From: support Date: Thu, 26 Jan 2023 18:16:53 +0000 (+0000) Subject: Built motion from commit 3a7e82ea.|2.6.29 X-Git-Url: http://repos.xcallymotion.com/base/%22https:/wiki.xcallymotion.com/display/XMV//%22%7B%7Blicense.messaging?a=commitdiff_plain;h=9c13168df7681d1800b48d23959b76c5602f9f63;p=motion2.git Built motion from commit 3a7e82ea.|2.6.29 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index 4cb3ae8..ba2bcfa 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -17,7 +17,7 @@ define({ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2023-01-26T17:37:48.491Z", + "time": "2023-01-26T18:08:14.690Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index 9a6f818..d928852 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2023-01-26T17:37:48.491Z", + "time": "2023-01-26T18:08:14.690Z", "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 962aef4..50ccb83 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 _0x7293=['contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]','urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]','TEXT','exports','VIRTUAL','getDataValue','action','STRING','contactManager','integration','motionbar','jscripty','urlForward','browser','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'];(function(_0x5c06b2,_0x3dcc51){var _0x126942=function(_0x1daa71){while(--_0x1daa71){_0x5c06b2['push'](_0x5c06b2['shift']());}};_0x126942(++_0x3dcc51);}(_0x7293,0xd6));var _0x3729=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x7293[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require('sequelize');module[_0x3729('0x0')]={'name':{'type':Sequelize[_0x3729('0x1')],'get':function(_0x151055){return this[_0x3729('0x2')](_0x3729('0x3'));}},'action':{'type':Sequelize[_0x3729('0x4')],'allowNull':![],'validate':{'isIn':{'args':[[_0x3729('0x5'),_0x3729('0x6'),_0x3729('0x7'),_0x3729('0x8'),_0x3729('0x9'),_0x3729('0xa'),_0x3729('0xb'),_0x3729('0xc')]],'msg':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'}},'comment':_0x3729('0xd')},'data1':{'type':Sequelize[_0x3729('0x4')](0x1000),'comment':'jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]'},'data2':{'type':Sequelize[_0x3729('0x4')](0x1000),'comment':'contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]'},'data3':{'type':Sequelize['STRING'](0x1000),'comment':_0x3729('0xe')},'data4':{'type':Sequelize['STRING'](0x1000),'comments':_0x3729('0xf')},'data5':{'type':Sequelize[_0x3729('0x4')](0x1000),'comments':_0x3729('0x10')},'data6':{'type':Sequelize[_0x3729('0x4')],'comments':_0x3729('0x11')},'data7':{'type':Sequelize[_0x3729('0x12')],'comments':'urlForward[body]'}}; \ No newline at end of file +var _0x121f=['integration','motionbar','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)]','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]','TEXT','urlForward[body]','exports','action','STRING','contactManager'];(function(_0x2341ab,_0x326a6c){var _0x54533e=function(_0x413273){while(--_0x413273){_0x2341ab['push'](_0x2341ab['shift']());}};_0x54533e(++_0x326a6c);}(_0x121f,0x68));var _0xf121=function(_0x149ca0,_0x2ac7f5){_0x149ca0=_0x149ca0-0x0;var _0x56b6b9=_0x121f[_0x149ca0];return _0x56b6b9;};'use strict';var Sequelize=require('sequelize');module[_0xf121('0x0')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x5d440c){return this['getDataValue'](_0xf121('0x1'));}},'action':{'type':Sequelize[_0xf121('0x2')],'allowNull':![],'validate':{'isIn':{'args':[[_0xf121('0x3'),_0xf121('0x4'),_0xf121('0x5'),'jscripty',_0xf121('0x6'),_0xf121('0x7'),_0xf121('0x8'),_0xf121('0x9')]],'msg':_0xf121('0xa')}},'comment':_0xf121('0xa')},'data1':{'type':Sequelize[_0xf121('0x2')](0x1000),'comment':_0xf121('0xb')},'data2':{'type':Sequelize[_0xf121('0x2')](0x1000),'comment':_0xf121('0xc')},'data3':{'type':Sequelize[_0xf121('0x2')](0x1000),'comment':_0xf121('0xd')},'data4':{'type':Sequelize[_0xf121('0x2')](0x1000),'comments':_0xf121('0xe')},'data5':{'type':Sequelize[_0xf121('0x2')](0x1000),'comments':_0xf121('0xf')},'data6':{'type':Sequelize[_0xf121('0x2')],'comments':'urlForward[headers],\x20browser[wsindowHeight]'},'data7':{'type':Sequelize[_0xf121('0x10')],'comments':_0xf121('0x11')}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index 70b59e3..f1d0b52 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 _0xabac=['Content-Range','json','apply','reject','save','then','destroy','error','stack','name','update','body','Action','find','params','eml-format','rimraf','zip-dir','mustache','util','path','to-csv','ejs','fs-extra','squel','querystring','papaparse','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set'];(function(_0x1c083c,_0x20b324){var _0x412b21=function(_0x388dc7){while(--_0x388dc7){_0x1c083c['push'](_0x1c083c['shift']());}};_0x412b21(++_0x20b324);}(_0xabac,0x1dd));var _0xcaba=function(_0x1eb18c,_0x4860ae){_0x1eb18c=_0x1eb18c-0x0;var _0x2eb78a=_0xabac[_0x1eb18c];return _0x2eb78a;};'use strict';var emlformat=require(_0xcaba('0x0'));var rimraf=require(_0xcaba('0x1'));var zipdir=require(_0xcaba('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xcaba('0x3'));var util=require(_0xcaba('0x4'));var path=require(_0xcaba('0x5'));var sox=require('sox');var csv=require(_0xcaba('0x6'));var ejs=require(_0xcaba('0x7'));var fs=require('fs');var fs_extra=require(_0xcaba('0x8'));var _=require('lodash');var squel=require(_0xcaba('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xcaba('0x6'));var querystring=require(_0xcaba('0xa'));var Papa=require(_0xcaba('0xb'));var Redis=require('ioredis');var authService=require(_0xcaba('0xc'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcaba('0xd'));var logger=require('../../config/logger')(_0xcaba('0xe'));var utils=require(_0xcaba('0xf'));var config=require(_0xcaba('0x10'));var licenseUtil=require(_0xcaba('0x11'));var db=require(_0xcaba('0x12'))['db'];function respondWithStatusCode(_0x329b3f,_0x1b1bd8){_0x1b1bd8=_0x1b1bd8||0xcc;return function(_0x52fe2f){if(_0x52fe2f){return _0x329b3f[_0xcaba('0x13')](_0x1b1bd8);}return _0x329b3f[_0xcaba('0x14')](_0x1b1bd8)[_0xcaba('0x15')]();};}function respondWithResult(_0x4b4554,_0x32a279){_0x32a279=_0x32a279||0xc8;return function(_0x5d3911){if(_0x5d3911){return _0x4b4554['status'](_0x32a279)['json'](_0x5d3911);}};}function respondWithFilteredResult(_0x16ab1e,_0x3c6ae7){return function(_0x340993){if(_0x340993){var _0x7bd979=typeof _0x3c6ae7['offset']===_0xcaba('0x16')&&typeof _0x3c6ae7[_0xcaba('0x17')]===_0xcaba('0x16');var _0x3034e6=_0x340993[_0xcaba('0x18')];var _0x32b98f=_0x7bd979?0x0:_0x3c6ae7[_0xcaba('0x19')];var _0x5a8407=_0x7bd979?_0x340993[_0xcaba('0x18')]:_0x3c6ae7[_0xcaba('0x19')]+_0x3c6ae7[_0xcaba('0x17')];var _0xdec068;if(_0x5a8407>=_0x3034e6){_0x5a8407=_0x3034e6;_0xdec068=0xc8;}else{_0xdec068=0xce;}_0x16ab1e[_0xcaba('0x14')](_0xdec068);return _0x16ab1e[_0xcaba('0x1a')](_0xcaba('0x1b'),_0x32b98f+'-'+_0x5a8407+'/'+_0x3034e6)[_0xcaba('0x1c')](_0x340993);}return null;};}function patchUpdates(_0x24ba81){return function(_0x2a53bf){try{jsonpatch[_0xcaba('0x1d')](_0x2a53bf,_0x24ba81,!![]);}catch(_0x538bff){return BPromise[_0xcaba('0x1e')](_0x538bff);}return _0x2a53bf[_0xcaba('0x1f')]();};}function saveUpdates(_0x269534,_0x3384e7){return function(_0xc09e81){if(_0xc09e81){return _0xc09e81['update'](_0x269534)[_0xcaba('0x20')](function(_0x1ee0c9){return _0x1ee0c9;});}return null;};}function removeEntity(_0x5540d8,_0x28f90f){return function(_0x229d18){if(_0x229d18){return _0x229d18[_0xcaba('0x21')]()[_0xcaba('0x20')](function(){_0x5540d8[_0xcaba('0x14')](0xcc)[_0xcaba('0x15')]();});}};}function handleEntityNotFound(_0x393cdd,_0x1b0a49){return function(_0x1fd7da){if(!_0x1fd7da){_0x393cdd[_0xcaba('0x13')](0x194);}return _0x1fd7da;};}function handleError(_0x3c7051,_0x240342){_0x240342=_0x240342||0x1f4;return function(_0x16e7ee){logger[_0xcaba('0x22')](_0x16e7ee[_0xcaba('0x23')]);if(_0x16e7ee[_0xcaba('0x24')]){delete _0x16e7ee[_0xcaba('0x24')];}_0x3c7051[_0xcaba('0x14')](_0x240342)['send'](_0x16e7ee);};}exports[_0xcaba('0x25')]=function(_0x2c3977,_0x43e210){if(_0x2c3977[_0xcaba('0x26')]['id']){delete _0x2c3977[_0xcaba('0x26')]['id'];}return db[_0xcaba('0x27')][_0xcaba('0x28')]({'where':{'id':_0x2c3977[_0xcaba('0x29')]['id']}})[_0xcaba('0x20')](handleEntityNotFound(_0x43e210,null))['then'](saveUpdates(_0x2c3977['body'],null))[_0xcaba('0x20')](respondWithResult(_0x43e210,null))['catch'](handleError(_0x43e210,null));};exports[_0xcaba('0x21')]=function(_0xebef53,_0x955d30){return db['Action'][_0xcaba('0x28')]({'where':{'id':_0xebef53[_0xcaba('0x29')]['id']}})[_0xcaba('0x20')](handleEntityNotFound(_0x955d30,null))[_0xcaba('0x20')](removeEntity(_0x955d30,null))['catch'](handleError(_0x955d30,null));}; \ No newline at end of file +var _0xa7d2=['rimraf','fast-json-patch','request-promise','bluebird','path','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','offset','limit','count','set','Content-Range','reject','save','update','then','destroy','end','error','stack','name','send','body','Action','find','catch','params'];(function(_0x2c82a5,_0x38f15f){var _0x5cd507=function(_0x3659ab){while(--_0x3659ab){_0x2c82a5['push'](_0x2c82a5['shift']());}};_0x5cd507(++_0x38f15f);}(_0xa7d2,0x7e));var _0x2a7d=function(_0x30d059,_0x5a0651){_0x30d059=_0x30d059-0x0;var _0x46e0e6=_0xa7d2[_0x30d059];return _0x46e0e6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2a7d('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2a7d('0x1'));var rp=require(_0x2a7d('0x2'));var moment=require('moment');var BPromise=require(_0x2a7d('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0x2a7d('0x4'));var sox=require('sox');var csv=require(_0x2a7d('0x5'));var ejs=require(_0x2a7d('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2a7d('0x7'));var squel=require('squel');var crypto=require(_0x2a7d('0x8'));var jsforce=require('jsforce');var deskjs=require(_0x2a7d('0x9'));var toCsv=require(_0x2a7d('0x5'));var querystring=require(_0x2a7d('0xa'));var Papa=require(_0x2a7d('0xb'));var Redis=require('ioredis');var authService=require(_0x2a7d('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0x2a7d('0xd'));var hardwareService=require(_0x2a7d('0xe'));var logger=require(_0x2a7d('0xf'))(_0x2a7d('0x10'));var utils=require(_0x2a7d('0x11'));var config=require(_0x2a7d('0x12'));var licenseUtil=require(_0x2a7d('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x48472c,_0x164286){_0x164286=_0x164286||0xcc;return function(_0x1b9dc9){if(_0x1b9dc9){return _0x48472c[_0x2a7d('0x14')](_0x164286);}return _0x48472c[_0x2a7d('0x15')](_0x164286)['end']();};}function respondWithResult(_0x1b086c,_0x420cf7){_0x420cf7=_0x420cf7||0xc8;return function(_0x238e93){if(_0x238e93){return _0x1b086c['status'](_0x420cf7)['json'](_0x238e93);}};}function respondWithFilteredResult(_0x41c18c,_0x178a5e){return function(_0x351f0f){if(_0x351f0f){var _0x3c26cc=typeof _0x178a5e[_0x2a7d('0x16')]==='undefined'&&typeof _0x178a5e[_0x2a7d('0x17')]==='undefined';var _0x1d5b17=_0x351f0f['count'];var _0x2e2304=_0x3c26cc?0x0:_0x178a5e[_0x2a7d('0x16')];var _0x388676=_0x3c26cc?_0x351f0f[_0x2a7d('0x18')]:_0x178a5e[_0x2a7d('0x16')]+_0x178a5e[_0x2a7d('0x17')];var _0x4705a4;if(_0x388676>=_0x1d5b17){_0x388676=_0x1d5b17;_0x4705a4=0xc8;}else{_0x4705a4=0xce;}_0x41c18c['status'](_0x4705a4);return _0x41c18c[_0x2a7d('0x19')](_0x2a7d('0x1a'),_0x2e2304+'-'+_0x388676+'/'+_0x1d5b17)['json'](_0x351f0f);}return null;};}function patchUpdates(_0x1494c2){return function(_0x57d8ef){try{jsonpatch['apply'](_0x57d8ef,_0x1494c2,!![]);}catch(_0x38978b){return BPromise[_0x2a7d('0x1b')](_0x38978b);}return _0x57d8ef[_0x2a7d('0x1c')]();};}function saveUpdates(_0x1a3757,_0x4c8a03){return function(_0x58977a){if(_0x58977a){return _0x58977a[_0x2a7d('0x1d')](_0x1a3757)[_0x2a7d('0x1e')](function(_0xb64d14){return _0xb64d14;});}return null;};}function removeEntity(_0x24fe92,_0x3b338d){return function(_0x372272){if(_0x372272){return _0x372272[_0x2a7d('0x1f')]()[_0x2a7d('0x1e')](function(){_0x24fe92[_0x2a7d('0x15')](0xcc)[_0x2a7d('0x20')]();});}};}function handleEntityNotFound(_0x12ea5c,_0x22f1b5){return function(_0x4933f4){if(!_0x4933f4){_0x12ea5c[_0x2a7d('0x14')](0x194);}return _0x4933f4;};}function handleError(_0xc4aa8b,_0xd8f5ce){_0xd8f5ce=_0xd8f5ce||0x1f4;return function(_0xd43b0){logger[_0x2a7d('0x21')](_0xd43b0[_0x2a7d('0x22')]);if(_0xd43b0[_0x2a7d('0x23')]){delete _0xd43b0[_0x2a7d('0x23')];}_0xc4aa8b[_0x2a7d('0x15')](_0xd8f5ce)[_0x2a7d('0x24')](_0xd43b0);};}exports[_0x2a7d('0x1d')]=function(_0xca2b7,_0x237c2c){if(_0xca2b7[_0x2a7d('0x25')]['id']){delete _0xca2b7[_0x2a7d('0x25')]['id'];}return db[_0x2a7d('0x26')][_0x2a7d('0x27')]({'where':{'id':_0xca2b7['params']['id']}})['then'](handleEntityNotFound(_0x237c2c,null))[_0x2a7d('0x1e')](saveUpdates(_0xca2b7['body'],null))['then'](respondWithResult(_0x237c2c,null))[_0x2a7d('0x28')](handleError(_0x237c2c,null));};exports['destroy']=function(_0x1b39ea,_0x2c0def){return db[_0x2a7d('0x26')][_0x2a7d('0x27')]({'where':{'id':_0x1b39ea[_0x2a7d('0x29')]['id']}})[_0x2a7d('0x1e')](handleEntityNotFound(_0x2c0def,null))[_0x2a7d('0x1e')](removeEntity(_0x2c0def,null))[_0x2a7d('0x28')](handleError(_0x2c0def,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 2201d65..5810046 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 _0x4487=['rimraf','../../config/environment','./action.attributes','exports','define','Action','tools_actions','lodash','../../config/logger','moment','bluebird','path'];(function(_0xeb48fa,_0xb4ee28){var _0xc91134=function(_0x7e3f3){while(--_0x7e3f3){_0xeb48fa['push'](_0xeb48fa['shift']());}};_0xc91134(++_0xb4ee28);}(_0x4487,0x11b));var _0x7448=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x4487[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0x7448('0x0'));var util=require('util');var logger=require(_0x7448('0x1'))('api');var moment=require(_0x7448('0x2'));var BPromise=require(_0x7448('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7448('0x4'));var rimraf=require(_0x7448('0x5'));var config=require(_0x7448('0x6'));var attributes=require(_0x7448('0x7'));module[_0x7448('0x8')]=function(_0x29ab25,_0x423bf9){return _0x29ab25[_0x7448('0x9')](_0x7448('0xa'),attributes,{'tableName':_0x7448('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x031d=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./action.attributes','exports','define','Action','tools_actions'];(function(_0x597aa0,_0x221a6e){var _0x70f136=function(_0x24c5e1){while(--_0x24c5e1){_0x597aa0['push'](_0x597aa0['shift']());}};_0x70f136(++_0x221a6e);}(_0x031d,0x8f));var _0xd031=function(_0x19b84f,_0x48765e){_0x19b84f=_0x19b84f-0x0;var _0x18067b=_0x031d[_0x19b84f];return _0x18067b;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xd031('0x0'))(_0xd031('0x1'));var moment=require(_0xd031('0x2'));var BPromise=require(_0xd031('0x3'));var rp=require(_0xd031('0x4'));var fs=require('fs');var path=require(_0xd031('0x5'));var rimraf=require(_0xd031('0x6'));var config=require(_0xd031('0x7'));var attributes=require(_0xd031('0x8'));module[_0xd031('0x9')]=function(_0x162b3f,_0x29fa79){return _0x162b3f[_0xd031('0xa')](_0xd031('0xb'),attributes,{'tableName':_0xd031('0xc'),'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 24ae0b2..02285ae 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 _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(_0x3c0051,_0x51f6db){var _0x543886=function(_0x5180b9){while(--_0x5180b9){_0x3c0051['push'](_0x3c0051['shift']());}};_0x543886(++_0x51f6db);}(_0x5fc3,0xa8));var _0x35fc=function(_0x375492,_0x4ed149){_0x375492=_0x375492-0x0;var _0x18ba5b=_0x5fc3[_0x375492];return _0x18ba5b;};'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 +var _0x1261=['then','info','Action,\x20%s,\x20%s','request\x20sent','Action,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request'];(function(_0x23bd40,_0x1bb06a){var _0x1efdaa=function(_0x46d204){while(--_0x46d204){_0x23bd40['push'](_0x23bd40['shift']());}};_0x1efdaa(++_0x1bb06a);}(_0x1261,0x144));var _0x1126=function(_0x2de0ab,_0x353746){_0x2de0ab=_0x2de0ab-0x0;var _0x7f8af9=_0x1261[_0x2de0ab];return _0x7f8af9;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var moment=require(_0x1126('0x1'));var BPromise=require(_0x1126('0x2'));var rs=require(_0x1126('0x3'));var fs=require('fs');var Redis=require(_0x1126('0x4'));var db=require(_0x1126('0x5'))['db'];var utils=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));var config=require(_0x1126('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1126('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x907180,_0x4f239c,_0x17e5f0){return new BPromise(function(_0x28772d,_0x245be9){return client[_0x1126('0xb')](_0x907180,_0x17e5f0)[_0x1126('0xc')](function(_0x59cfa1){logger[_0x1126('0xd')](_0x1126('0xe'),_0x4f239c,_0x1126('0xf'));logger['debug'](_0x1126('0x10'),_0x4f239c,'request\x20sent',JSON['stringify'](_0x59cfa1));if(_0x59cfa1[_0x1126('0x11')]){if(_0x59cfa1['error'][_0x1126('0x12')]===0x1f4){logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);return _0x245be9(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1['error']['message']);return _0x28772d(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}else{logger[_0x1126('0xd')]('Action,\x20%s,\x20%s',_0x4f239c,_0x1126('0xf'));_0x28772d(_0x59cfa1['result'][_0x1126('0x13')]);}})[_0x1126('0x14')](function(_0x257b5f){logger['error'](_0x1126('0xe'),_0x4f239c,_0x257b5f);_0x245be9(_0x257b5f);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index 1cd19b9..adca03b 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 _0x8d37=['multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./action.controller','put','/:id','isAuthenticated','update'];(function(_0x2ef691,_0x1af14d){var _0x399d1a=function(_0x48ddbb){while(--_0x48ddbb){_0x2ef691['push'](_0x2ef691['shift']());}};_0x399d1a(++_0x1af14d);}(_0x8d37,0x111));var _0x78d3=function(_0x25c8af,_0x74b7f8){_0x25c8af=_0x25c8af-0x0;var _0x36f703=_0x8d37[_0x25c8af];return _0x36f703;};'use strict';var multer=require(_0x78d3('0x0'));var util=require(_0x78d3('0x1'));var path=require(_0x78d3('0x2'));var timeout=require(_0x78d3('0x3'));var express=require(_0x78d3('0x4'));var router=express['Router']();var fs_extra=require(_0x78d3('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x78d3('0x6'));var config=require(_0x78d3('0x7'));var controller=require(_0x78d3('0x8'));router[_0x78d3('0x9')](_0x78d3('0xa'),auth[_0x78d3('0xb')](),controller[_0x78d3('0xc')]);router['delete'](_0x78d3('0xa'),auth[_0x78d3('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xb1a5=['isAuthenticated','destroy','exports','multer','util','path','Router','fs-extra','../../components/interaction/service','../../config/environment','./action.controller','/:id','update'];(function(_0x527c44,_0x398d6c){var _0x2a5896=function(_0x805c71){while(--_0x805c71){_0x527c44['push'](_0x527c44['shift']());}};_0x2a5896(++_0x398d6c);}(_0xb1a5,0x155));var _0x5b1a=function(_0x6ee645,_0x357f9a){_0x6ee645=_0x6ee645-0x0;var _0x377e33=_0xb1a5[_0x6ee645];return _0x377e33;};'use strict';var multer=require(_0x5b1a('0x0'));var util=require(_0x5b1a('0x1'));var path=require(_0x5b1a('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x5b1a('0x3')]();var fs_extra=require(_0x5b1a('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x5b1a('0x5'));var config=require(_0x5b1a('0x6'));var controller=require(_0x5b1a('0x7'));router['put'](_0x5b1a('0x8'),auth['isAuthenticated'](),controller[_0x5b1a('0x9')]);router['delete'](_0x5b1a('0x8'),auth[_0x5b1a('0xa')](),controller[_0x5b1a('0xb')]);module[_0x5b1a('0xc')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index 234b046..85ee270 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 _0x4819=['TEXT','exports','STRING'];(function(_0x5d07ff,_0x1f976f){var _0x5226ad=function(_0x1653a4){while(--_0x1653a4){_0x5d07ff['push'](_0x5d07ff['shift']());}};_0x5226ad(++_0x1f976f);}(_0x4819,0xcd));var _0x9481=function(_0x223b71,_0x597bfb){_0x223b71=_0x223b71-0x0;var _0x4131e4=_0x4819[_0x223b71];return _0x4131e4;};'use strict';var Sequelize=require('sequelize');module[_0x9481('0x0')]={'name':{'type':Sequelize[_0x9481('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x9481('0x1')]},'parent':{'type':Sequelize[_0x9481('0x1')]},'table':{'type':Sequelize[_0x9481('0x1')]},'conditions':{'type':Sequelize[_0x9481('0x2')]},'joins':{'type':Sequelize[_0x9481('0x2')]}}; \ No newline at end of file +var _0x5fd1=['STRING','TEXT','sequelize'];(function(_0x367e5b,_0x5721e4){var _0x4b909e=function(_0x22c6a4){while(--_0x22c6a4){_0x367e5b['push'](_0x367e5b['shift']());}};_0x4b909e(++_0x5721e4);}(_0x5fd1,0x155));var _0x15fd=function(_0x47b54a,_0x914027){_0x47b54a=_0x47b54a-0x0;var _0x3e40ee=_0x5fd1[_0x47b54a];return _0x3e40ee;};'use strict';var Sequelize=require(_0x15fd('0x0'));module['exports']={'name':{'type':Sequelize[_0x15fd('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x15fd('0x1')]},'parent':{'type':Sequelize[_0x15fd('0x1')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0x15fd('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index d6d9058..5ea8d6b 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 _0x2b8e=['GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','keyBy','select','from','table','metric','function','replace','format','orderBy','order','DESC','alias','joins','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','parse','clone','toString','sequelize','QueryTypes','SELECT','AVG(%s)','SEC_TO_TIME(%s)','IS\x20NOT\x20NULL','AnalyticMetric','MetricId','groupBy','output','web','fullPath','randomstring','generate','csv','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(*)','value','debug','Limited\x20Query:','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','end','status','json','undefined','offset','count','limit','set','Content-Range','apply','save','update','then','destroy','get','UserProfileResource','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','AnalyticCustomReport','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','userProfileId','CustomReports','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)'];(function(_0x315dd0,_0x357deb){var _0x3aa317=function(_0x2a7628){while(--_0x2a7628){_0x315dd0['push'](_0x315dd0['shift']());}};_0x3aa317(++_0x357deb);}(_0x2b8e,0xf4));var _0xe2b8=function(_0x2ea2a0,_0x1851b2){_0x2ea2a0=_0x2ea2a0-0x0;var _0x498e64=_0x2b8e[_0x2ea2a0];return _0x498e64;};'use strict';var emlformat=require(_0xe2b8('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xe2b8('0x1'));var rp=require(_0xe2b8('0x2'));var moment=require('moment');var BPromise=require(_0xe2b8('0x3'));var Mustache=require(_0xe2b8('0x4'));var util=require(_0xe2b8('0x5'));var path=require(_0xe2b8('0x6'));var sox=require('sox');var csv=require(_0xe2b8('0x7'));var ejs=require(_0xe2b8('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe2b8('0x9'));var squel=require(_0xe2b8('0xa'));var crypto=require(_0xe2b8('0xb'));var jsforce=require(_0xe2b8('0xc'));var deskjs=require(_0xe2b8('0xd'));var toCsv=require(_0xe2b8('0x7'));var querystring=require(_0xe2b8('0xe'));var Papa=require(_0xe2b8('0xf'));var Redis=require(_0xe2b8('0x10'));var authService=require(_0xe2b8('0x11'));var qs=require(_0xe2b8('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xe2b8('0x13'))(_0xe2b8('0x14'));var utils=require(_0xe2b8('0x15'));var config=require(_0xe2b8('0x16'));var licenseUtil=require(_0xe2b8('0x17'));var db=require(_0xe2b8('0x18'))['db'];var dbH=require(_0xe2b8('0x18'))[_0xe2b8('0x19')];function respondWithStatusCode(_0x4ebe2a,_0x1db250){_0x1db250=_0x1db250||0xcc;return function(_0x359b5b){if(_0x359b5b){return _0x4ebe2a[_0xe2b8('0x1a')](_0x1db250);}return _0x4ebe2a['status'](_0x1db250)[_0xe2b8('0x1b')]();};}function respondWithResult(_0x39e7ac,_0x55f52d){_0x55f52d=_0x55f52d||0xc8;return function(_0x598b37){if(_0x598b37){return _0x39e7ac[_0xe2b8('0x1c')](_0x55f52d)[_0xe2b8('0x1d')](_0x598b37);}};}function respondWithFilteredResult(_0x481308,_0x4069e8){return function(_0x1c0a82){if(_0x1c0a82){var _0x10a6f9=typeof _0x4069e8['offset']===_0xe2b8('0x1e')&&typeof _0x4069e8['limit']===_0xe2b8('0x1e');var _0x576946=_0x1c0a82['count'];var _0x3b326a=_0x10a6f9?0x0:_0x4069e8[_0xe2b8('0x1f')];var _0x4efc36=_0x10a6f9?_0x1c0a82[_0xe2b8('0x20')]:_0x4069e8['offset']+_0x4069e8[_0xe2b8('0x21')];var _0x386f5d;if(_0x4efc36>=_0x576946){_0x4efc36=_0x576946;_0x386f5d=0xc8;}else{_0x386f5d=0xce;}_0x481308[_0xe2b8('0x1c')](_0x386f5d);return _0x481308[_0xe2b8('0x22')](_0xe2b8('0x23'),_0x3b326a+'-'+_0x4efc36+'/'+_0x576946)[_0xe2b8('0x1d')](_0x1c0a82);}return null;};}function patchUpdates(_0x1e59ad){return function(_0x5eda53){try{jsonpatch[_0xe2b8('0x24')](_0x5eda53,_0x1e59ad,!![]);}catch(_0x1c38c4){return BPromise['reject'](_0x1c38c4);}return _0x5eda53[_0xe2b8('0x25')]();};}function saveUpdates(_0xefa3f5,_0x300dc5){return function(_0x357083){if(_0x357083){return _0x357083[_0xe2b8('0x26')](_0xefa3f5)[_0xe2b8('0x27')](function(_0x2aaeba){return _0x2aaeba;});}return null;};}function removeEntity(_0x24c205,_0x1624c2){return function(_0x49974e){if(_0x49974e){return _0x49974e[_0xe2b8('0x28')]()[_0xe2b8('0x27')](function(){var _0x3654d5=_0x49974e[_0xe2b8('0x29')]({'plain':!![]});var _0x1e310a='CustomReports';return db[_0xe2b8('0x2a')]['destroy']({'where':{'type':_0x1e310a,'resourceId':_0x3654d5['id']}})['then'](function(){return _0x49974e;});})['then'](function(){_0x24c205[_0xe2b8('0x1c')](0xcc)[_0xe2b8('0x1b')]();});}};}function handleEntityNotFound(_0x237a7b,_0x3c3eee){return function(_0x161ef1){if(!_0x161ef1){_0x237a7b[_0xe2b8('0x1a')](0x194);}return _0x161ef1;};}function handleError(_0x2d6d56,_0x210563){_0x210563=_0x210563||0x1f4;return function(_0x276b99){logger['error'](_0x276b99['stack']);if(_0x276b99[_0xe2b8('0x2b')]){delete _0x276b99[_0xe2b8('0x2b')];}_0x2d6d56['status'](_0x210563)[_0xe2b8('0x2c')](_0x276b99);};}exports[_0xe2b8('0x2d')]=function(_0x3536fd,_0x2b87e7){var _0x276e2d={},_0x233bc6={},_0x2ff8b0={'count':0x0,'rows':[]};var _0xbf9a0e=_[_0xe2b8('0x2e')](db['AnalyticCustomReport'][_0xe2b8('0x2f')],function(_0x3101cf){return{'name':_0x3101cf[_0xe2b8('0x30')],'type':_0x3101cf[_0xe2b8('0x31')][_0xe2b8('0x32')]};});_0x233bc6['model']=_[_0xe2b8('0x2e')](_0xbf9a0e,'name');_0x233bc6[_0xe2b8('0x33')]=_[_0xe2b8('0x34')](_0x3536fd[_0xe2b8('0x33')]);_0x233bc6[_0xe2b8('0x35')]=_[_0xe2b8('0x36')](_0x233bc6[_0xe2b8('0x37')],_0x233bc6['query']);_0x276e2d[_0xe2b8('0x38')]=_[_0xe2b8('0x36')](_0x233bc6[_0xe2b8('0x37')],qs[_0xe2b8('0x39')](_0x3536fd['query']['fields']));_0x276e2d['attributes']=_0x276e2d[_0xe2b8('0x38')][_0xe2b8('0x3a')]?_0x276e2d[_0xe2b8('0x38')]:_0x233bc6[_0xe2b8('0x37')];if(!_0x3536fd[_0xe2b8('0x33')][_0xe2b8('0x3b')](_0xe2b8('0x3c'))){_0x276e2d['limit']=qs[_0xe2b8('0x21')](_0x3536fd[_0xe2b8('0x33')]['limit']);_0x276e2d[_0xe2b8('0x1f')]=qs[_0xe2b8('0x1f')](_0x3536fd[_0xe2b8('0x33')][_0xe2b8('0x1f')]);}_0x276e2d['order']=qs[_0xe2b8('0x3d')](_0x3536fd[_0xe2b8('0x33')][_0xe2b8('0x3d')]);_0x276e2d[_0xe2b8('0x3e')]=qs[_0xe2b8('0x35')](_['pick'](_0x3536fd['query'],_0x233bc6[_0xe2b8('0x35')]),_0xbf9a0e);if(_0x3536fd['query'][_0xe2b8('0x3f')]){_0x276e2d[_0xe2b8('0x3e')]=_[_0xe2b8('0x40')](_0x276e2d[_0xe2b8('0x3e')],{'$or':_['map'](_0xbf9a0e,function(_0x44c440){if(_0x44c440[_0xe2b8('0x31')]!==_0xe2b8('0x41')){var _0x14f190={};_0x14f190[_0x44c440[_0xe2b8('0x2b')]]={'$like':'%'+_0x3536fd[_0xe2b8('0x33')][_0xe2b8('0x3f')]+'%'};return _0x14f190;}})});}_0x276e2d=_[_0xe2b8('0x40')]({},_0x276e2d,_0x3536fd[_0xe2b8('0x42')]);var _0x4fb5c6={'where':_0x276e2d[_0xe2b8('0x3e')]};return db[_0xe2b8('0x43')][_0xe2b8('0x20')](_0x4fb5c6)['then'](function(_0x4e0963){_0x2ff8b0[_0xe2b8('0x20')]=_0x4e0963;if(_0x3536fd[_0xe2b8('0x33')][_0xe2b8('0x44')]){_0x276e2d[_0xe2b8('0x45')]=[{'all':!![]}];}return db[_0xe2b8('0x43')][_0xe2b8('0x46')](_0x276e2d);})[_0xe2b8('0x27')](function(_0x5aa05c){_0x2ff8b0[_0xe2b8('0x47')]=_0x5aa05c;return _0x2ff8b0;})[_0xe2b8('0x27')](respondWithFilteredResult(_0x2b87e7,_0x276e2d))[_0xe2b8('0x48')](handleError(_0x2b87e7,null));};exports[_0xe2b8('0x49')]=function(_0x32c4fc,_0x1fed47){var _0x5b7573={'raw':![],'where':{'id':_0x32c4fc[_0xe2b8('0x4a')]['id']}},_0x101096={};_0x101096['model']=_[_0xe2b8('0x34')](db[_0xe2b8('0x43')][_0xe2b8('0x2f')]);_0x101096[_0xe2b8('0x33')]=_[_0xe2b8('0x34')](_0x32c4fc[_0xe2b8('0x33')]);_0x101096[_0xe2b8('0x35')]=_['intersection'](_0x101096['model'],_0x101096[_0xe2b8('0x33')]);_0x5b7573[_0xe2b8('0x38')]=_[_0xe2b8('0x36')](_0x101096[_0xe2b8('0x37')],qs[_0xe2b8('0x39')](_0x32c4fc[_0xe2b8('0x33')][_0xe2b8('0x39')]));_0x5b7573[_0xe2b8('0x38')]=_0x5b7573[_0xe2b8('0x38')][_0xe2b8('0x3a')]?_0x5b7573[_0xe2b8('0x38')]:_0x101096['model'];if(_0x32c4fc['query'][_0xe2b8('0x44')]){_0x5b7573[_0xe2b8('0x45')]=[{'all':!![]}];}_0x5b7573=_[_0xe2b8('0x40')]({},_0x5b7573,_0x32c4fc[_0xe2b8('0x42')]);return db[_0xe2b8('0x43')][_0xe2b8('0x4b')](_0x5b7573)[_0xe2b8('0x27')](handleEntityNotFound(_0x1fed47,null))['then'](respondWithResult(_0x1fed47,null))[_0xe2b8('0x48')](handleError(_0x1fed47,null));};exports[_0xe2b8('0x4c')]=function(_0x4929ed,_0x52af5d){return db[_0xe2b8('0x43')]['create'](_0x4929ed[_0xe2b8('0x4d')],{})[_0xe2b8('0x27')](function(_0x4e2211){var _0x2e8c79=_0x4929ed[_0xe2b8('0x4e')]['get']({'plain':!![]});if(!_0x2e8c79)throw new Error(_0xe2b8('0x4f'));if(_0x2e8c79[_0xe2b8('0x50')]===_0xe2b8('0x4e')){var _0x52663c=_0x4e2211['get']({'plain':!![]});var _0x2f8ef=_0xe2b8('0x51');return db[_0xe2b8('0x52')][_0xe2b8('0x4b')]({'where':{'name':_0x2f8ef,'userProfileId':_0x2e8c79[_0xe2b8('0x53')]},'raw':!![]})[_0xe2b8('0x27')](function(_0x2092a){if(_0x2092a&&_0x2092a['autoAssociation']===0x0){return db[_0xe2b8('0x2a')][_0xe2b8('0x4c')]({'name':_0x52663c['name'],'resourceId':_0x52663c['id'],'type':_0xe2b8('0x54'),'sectionId':_0x2092a['id']},{})['then'](function(){return _0x4e2211;});}else{return _0x4e2211;}})[_0xe2b8('0x48')](function(_0x1037cf){logger[_0xe2b8('0x55')](_0xe2b8('0x56'),_0x1037cf);throw _0x1037cf;});}return _0x4e2211;})[_0xe2b8('0x27')](respondWithResult(_0x52af5d,0xc9))[_0xe2b8('0x48')](handleError(_0x52af5d,null));};exports[_0xe2b8('0x26')]=function(_0xe2f6df,_0x2b5d21){if(_0xe2f6df[_0xe2b8('0x4d')]['id']){delete _0xe2f6df[_0xe2b8('0x4d')]['id'];}return db[_0xe2b8('0x43')][_0xe2b8('0x4b')]({'where':{'id':_0xe2f6df[_0xe2b8('0x4a')]['id']}})['then'](handleEntityNotFound(_0x2b5d21,null))[_0xe2b8('0x27')](saveUpdates(_0xe2f6df['body'],null))[_0xe2b8('0x27')](respondWithResult(_0x2b5d21,null))[_0xe2b8('0x48')](handleError(_0x2b5d21,null));};exports['destroy']=function(_0x5c543b,_0x7434bf){return db['AnalyticCustomReport'][_0xe2b8('0x4b')]({'where':{'id':_0x5c543b[_0xe2b8('0x4a')]['id']}})['then'](handleEntityNotFound(_0x7434bf,null))[_0xe2b8('0x27')](removeEntity(_0x7434bf,null))['catch'](handleError(_0x7434bf,null));};exports['preview']=function(_0x1a565a,_0x24c400){var _0x1a0ddc=0xa;var _0x3212df=[_0xe2b8('0x57'),_0xe2b8('0x58'),_0xe2b8('0x59'),_0xe2b8('0x5a')];var _0x33e8c6={'SUM':_0xe2b8('0x5b'),'COUNT':_0xe2b8('0x5c'),'COUNT DISTINCT':_0xe2b8('0x5d'),'MAX':_0xe2b8('0x5e'),'MIN':_0xe2b8('0x5f'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xe2b8('0x60'),'GROUP_CONCAT ASC':_0xe2b8('0x61'),'GROUP_CONCAT DESC':_0xe2b8('0x62')};var _0x4b4170={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xe2b8('0x63'),'HOUR':_0xe2b8('0x64'),'ROUND':_0xe2b8('0x65'),'UNIX_TIMESTAMP':_0xe2b8('0x66')};var _0x31db39=function(_0x12c46a){return!_[_0xe2b8('0x67')]([_0xe2b8('0x68'),'IS\x20NOT\x20NULL',_0xe2b8('0x69'),_0xe2b8('0x6a')],_0x12c46a);};var _0x2e9bdb=function(_0x15177b){if(!_0x15177b||!_0x15177b[_0xe2b8('0x6b')]['length']){return'';}for(var _0x4a076f='(',_0x248578=0x0;_0x248578<_0x15177b[_0xe2b8('0x6b')][_0xe2b8('0x3a')];_0x248578+=0x1){_0x248578>0x0&&(_0x4a076f+='\x20'+_0x15177b[_0xe2b8('0x6c')]+'\x20');_0x4a076f+=_0x15177b['rules'][_0x248578][_0xe2b8('0x6d')]?_0x2e9bdb(_0x15177b['rules'][_0x248578]['group']):_0x15177b[_0xe2b8('0x6b')][_0x248578][_0xe2b8('0x6e')]+'\x20'+_0x15177b['rules'][_0x248578][_0xe2b8('0x6f')]+(_0x31db39(_0x15177b['rules'][_0x248578][_0xe2b8('0x6f')])?'\x20'+_0x15177b[_0xe2b8('0x6b')][_0x248578]['value']:'');}return _0x4a076f+')';};var _0x1c2885={'where':{'id':_0x1a565a[_0xe2b8('0x4a')]['id']}},_0x417e72,_0xf0c45d,_0x2c7bca,_0x4efa01,_0x1e70e0;_0x1c2885=_[_0xe2b8('0x40')]({},_0x1c2885,_0x1a565a['options']);return db['AnalyticCustomReport'][_0xe2b8('0x4b')](_0x1c2885)[_0xe2b8('0x27')](function(_0x18d7fc){if(_0x18d7fc){_0x417e72=_0x18d7fc;return _0x18d7fc[_0xe2b8('0x70')]();}return null;})[_0xe2b8('0x27')](function(_0x97fa19){if(_0x97fa19){if(!_0x97fa19[_0xe2b8('0x3a')]){throw new db[(_0xe2b8('0x71'))][(_0xe2b8('0x72'))](_0xe2b8('0x73'),0x193);}_0xf0c45d=_0x97fa19;return db['AnalyticMetric'][_0xe2b8('0x46')]({'raw':!![]});}return null;})[_0xe2b8('0x27')](function(_0x4a140b){if(_0x4a140b){_0x2c7bca=_[_0xe2b8('0x74')](_0x4a140b,'id');var _0x18f814;var _0x4fa961=squel[_0xe2b8('0x75')]();_0x4fa961[_0xe2b8('0x76')](_0x417e72[_0xe2b8('0x77')]);for(var _0x305e73=0x0;_0x305e73<_0xf0c45d[_0xe2b8('0x3a')];_0x305e73+=0x1){_0x18f814=_0xf0c45d[_0x305e73]['MetricId']?_0x2c7bca[_0xf0c45d[_0x305e73]['MetricId']][_0xe2b8('0x78')]:_0xf0c45d[_0x305e73]['field'];_0x18f814=_0xf0c45d[_0x305e73][_0xe2b8('0x79')]?_[_0xe2b8('0x7a')](_0x33e8c6[_0xf0c45d[_0x305e73][_0xe2b8('0x79')]],'%s',_0x18f814):_0x18f814;_0x18f814=_0xf0c45d[_0x305e73][_0xe2b8('0x7b')]?_[_0xe2b8('0x7a')](_0x4b4170[_0xf0c45d[_0x305e73][_0xe2b8('0x7b')]],'%s',_0x18f814):_0x18f814;if(_0xf0c45d[_0x305e73]['groupBy']){_0x4fa961['group'](_0x18f814);}_0xf0c45d[_0x305e73][_0xe2b8('0x7c')]&&_0x4fa961[_0xe2b8('0x7d')](_0x18f814,_0xf0c45d[_0x305e73][_0xe2b8('0x7c')]===_0xe2b8('0x7e')?![]:!![]);_0x4fa961['field'](_0x18f814,_0xf0c45d[_0x305e73][_0xe2b8('0x7f')]||_0x18f814);}if(_0x417e72[_0xe2b8('0x80')]){_0x417e72[_0xe2b8('0x80')]=JSON['parse'](_0x417e72['joins']);for(var _0x3fb229=0x0;_0x3fb229<_0x417e72[_0xe2b8('0x80')]['length'];_0x3fb229+=0x1){if(_0x417e72[_0xe2b8('0x80')][_0x3fb229]['type']&&_[_0xe2b8('0x67')](_0x3212df,_0x417e72[_0xe2b8('0x80')][_0x3fb229][_0xe2b8('0x31')])&&_0x417e72[_0xe2b8('0x80')][_0x3fb229][_0xe2b8('0x81')]&&_0x417e72[_0xe2b8('0x80')][_0x3fb229][_0xe2b8('0x82')]&&_0x417e72[_0xe2b8('0x80')][_0x3fb229][_0xe2b8('0x83')]){_0x4fa961[_0x417e72[_0xe2b8('0x80')][_0x3fb229]['type']](_0x417e72[_0xe2b8('0x80')][_0x3fb229][_0xe2b8('0x82')],null,util[_0xe2b8('0x7b')](_0xe2b8('0x84'),_0x417e72[_0xe2b8('0x77')],_0x417e72['joins'][_0x3fb229][_0xe2b8('0x81')],_0x417e72['joins'][_0x3fb229][_0xe2b8('0x82')],_0x417e72['joins'][_0x3fb229]['foreignKey']));}}}if(_0x417e72[_0xe2b8('0x85')]){_0x417e72['conditions']=JSON[_0xe2b8('0x86')](_0x417e72[_0xe2b8('0x85')]);_0x4fa961[_0xe2b8('0x3e')](_0x2e9bdb(_0x417e72[_0xe2b8('0x85')][_0xe2b8('0x6d')]));}_0x1e70e0=_0x4fa961[_0xe2b8('0x87')]();_0x4fa961['limit'](_0x1a0ddc);_0x4fa961['offset'](0x0);logger['debug']('Limited\x20Query:',_0x4fa961[_0xe2b8('0x88')]());return dbH[_0xe2b8('0x89')][_0xe2b8('0x33')](_0x4fa961[_0xe2b8('0x88')](),{'type':dbH[_0xe2b8('0x89')][_0xe2b8('0x8a')][_0xe2b8('0x8b')]});}})['then'](respondWithResult(_0x24c400,null))[_0xe2b8('0x48')](handleError(_0x24c400,null));};function runReport(_0x1a4eeb,_0x4c9365,_0x919d6c){var _0x2bd08e=_0x4c9365['name'];var _0x5afeb5=0xa;var _0x52062d=[_0xe2b8('0x57'),_0xe2b8('0x58'),_0xe2b8('0x59'),_0xe2b8('0x5a')];var _0x44d195={'SUM':_0xe2b8('0x5b'),'COUNT':_0xe2b8('0x5c'),'COUNT DISTINCT':_0xe2b8('0x5d'),'MAX':_0xe2b8('0x5e'),'MIN':_0xe2b8('0x5f'),'AVG':_0xe2b8('0x8c'),'GROUP_CONCAT':_0xe2b8('0x60'),'GROUP_CONCAT ASC':_0xe2b8('0x61'),'GROUP_CONCAT DESC':_0xe2b8('0x62')};var _0x499c5c={'SEC_TO_TIME':_0xe2b8('0x8d'),'DATE':_0xe2b8('0x63'),'HOUR':_0xe2b8('0x64'),'ROUND':_0xe2b8('0x65'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x29662e=function(_0x3fda91){return!_['includes'](['IS\x20NULL',_0xe2b8('0x8e'),_0xe2b8('0x69'),_0xe2b8('0x6a')],_0x3fda91);};var _0x10368f=function(_0xb274ff){if(!_0xb274ff||!_0xb274ff[_0xe2b8('0x6b')][_0xe2b8('0x3a')]){return'';}for(var _0x5d2bb8='(',_0x4f2a60=0x0;_0x4f2a60<_0xb274ff['rules'][_0xe2b8('0x3a')];_0x4f2a60+=0x1){_0x4f2a60>0x0&&(_0x5d2bb8+='\x20'+_0xb274ff[_0xe2b8('0x6c')]+'\x20');_0x5d2bb8+=_0xb274ff[_0xe2b8('0x6b')][_0x4f2a60][_0xe2b8('0x6d')]?_0x10368f(_0xb274ff['rules'][_0x4f2a60][_0xe2b8('0x6d')]):_0xb274ff[_0xe2b8('0x6b')][_0x4f2a60][_0xe2b8('0x6e')]+'\x20'+_0xb274ff[_0xe2b8('0x6b')][_0x4f2a60][_0xe2b8('0x6f')]+(_0x29662e(_0xb274ff[_0xe2b8('0x6b')][_0x4f2a60]['condition'])?'\x20'+_0xb274ff['rules'][_0x4f2a60]['value']:'');}return _0x5d2bb8+')';};var _0x2728e1={'where':{'id':_0x1a4eeb['id']}},_0x2f612a,_0xcda5f9,_0x40516a,_0x24c8f8,_0x5e01f0;_0x2728e1=_[_0xe2b8('0x40')]({},_0x2728e1,_0x919d6c);return db[_0xe2b8('0x43')][_0xe2b8('0x4b')](_0x2728e1)[_0xe2b8('0x27')](function(_0x3f88ec){if(_0x3f88ec){_0x2f612a=_0x3f88ec;return _0x3f88ec[_0xe2b8('0x70')]();}return null;})['then'](function(_0x57703b){if(_0x57703b){if(!_0x57703b[_0xe2b8('0x3a')]){throw new db[(_0xe2b8('0x71'))][(_0xe2b8('0x72'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0xcda5f9=_0x57703b;return db[_0xe2b8('0x8f')][_0xe2b8('0x46')]({'raw':!![]});}return null;})[_0xe2b8('0x27')](function(_0x1dbcc4){if(_0x1dbcc4){_0x40516a=_[_0xe2b8('0x74')](_0x1dbcc4,'id');var _0x4ae833;var _0x255f25=squel['select']();_0x255f25[_0xe2b8('0x76')](_0x2f612a['table']);for(var _0x5b4167=0x0;_0x5b4167<_0xcda5f9[_0xe2b8('0x3a')];_0x5b4167+=0x1){_0x4ae833=_0xcda5f9[_0x5b4167][_0xe2b8('0x90')]?_0x40516a[_0xcda5f9[_0x5b4167]['MetricId']][_0xe2b8('0x78')]:_0xcda5f9[_0x5b4167][_0xe2b8('0x6e')];_0x4ae833=_0xcda5f9[_0x5b4167][_0xe2b8('0x79')]?_[_0xe2b8('0x7a')](_0x44d195[_0xcda5f9[_0x5b4167]['function']],'%s',_0x4ae833):_0x4ae833;_0x4ae833=_0xcda5f9[_0x5b4167][_0xe2b8('0x7b')]?_[_0xe2b8('0x7a')](_0x499c5c[_0xcda5f9[_0x5b4167][_0xe2b8('0x7b')]],'%s',_0x4ae833):_0x4ae833;if(_0xcda5f9[_0x5b4167][_0xe2b8('0x91')]){_0x255f25['group'](_0x4ae833);}_0xcda5f9[_0x5b4167]['orderBy']&&_0x255f25['order'](_0x4ae833,_0xcda5f9[_0x5b4167][_0xe2b8('0x7c')]===_0xe2b8('0x7e')?![]:!![]);_0x255f25[_0xe2b8('0x6e')](_0x4ae833,_0xcda5f9[_0x5b4167][_0xe2b8('0x7f')]||_0x4ae833);}if(_0x2f612a[_0xe2b8('0x80')]){_0x2f612a[_0xe2b8('0x80')]=JSON[_0xe2b8('0x86')](_0x2f612a[_0xe2b8('0x80')]);for(var _0x317114=0x0;_0x317114<_0x2f612a[_0xe2b8('0x80')][_0xe2b8('0x3a')];_0x317114+=0x1){if(_0x2f612a[_0xe2b8('0x80')][_0x317114][_0xe2b8('0x31')]&&_[_0xe2b8('0x67')](_0x52062d,_0x2f612a['joins'][_0x317114][_0xe2b8('0x31')])&&_0x2f612a['joins'][_0x317114][_0xe2b8('0x81')]&&_0x2f612a[_0xe2b8('0x80')][_0x317114]['foreignTable']&&_0x2f612a[_0xe2b8('0x80')][_0x317114][_0xe2b8('0x83')]){_0x255f25[_0x2f612a[_0xe2b8('0x80')][_0x317114][_0xe2b8('0x31')]](_0x2f612a[_0xe2b8('0x80')][_0x317114]['foreignTable'],null,util[_0xe2b8('0x7b')]('%s.%s\x20=\x20%s.%s',_0x2f612a[_0xe2b8('0x77')],_0x2f612a[_0xe2b8('0x80')][_0x317114]['parentKey'],_0x2f612a[_0xe2b8('0x80')][_0x317114][_0xe2b8('0x82')],_0x2f612a['joins'][_0x317114]['foreignKey']));}}}if(_0x2f612a[_0xe2b8('0x85')]){_0x2f612a[_0xe2b8('0x85')]=JSON[_0xe2b8('0x86')](_0x2f612a[_0xe2b8('0x85')]);_0x255f25[_0xe2b8('0x3e')](_0x10368f(_0x2f612a[_0xe2b8('0x85')][_0xe2b8('0x6d')]));}_0x5e01f0=_0x255f25[_0xe2b8('0x87')]();_0x255f25[_0xe2b8('0x21')](_0x5afeb5);_0x255f25[_0xe2b8('0x1f')](0x0);return;}})[_0xe2b8('0x27')](function(){if(_0x4c9365[_0xe2b8('0x92')]===_0xe2b8('0x93')){return null;}var _0x54d7f4=_[_0xe2b8('0x40')](_0x4c9365,{'name':_0x4c9365[_0xe2b8('0x94')]||_0x4c9365[_0xe2b8('0x2b')]||_0x2f612a[_0xe2b8('0x2b')],'basename':_0x2bd08e,'savename':util[_0xe2b8('0x7b')]('%s-%s.%s',_0x4c9365[_0xe2b8('0x2b')]||_0x2f612a['name'],require(_0xe2b8('0x95'))[_0xe2b8('0x96')](0x4),_0x4c9365[_0xe2b8('0x92')]||_0xe2b8('0x97')),'reportId':_0x2f612a['id'],'reportType':'custom'});return db[_0xe2b8('0x98')][_0xe2b8('0x4c')](_0x54d7f4,{'raw':!![]});})[_0xe2b8('0x27')](function(_0x256703){if(_0x2f612a['table']===_0xe2b8('0x99')){_0x5e01f0['where'](_0x2f612a[_0xe2b8('0x77')]+_0xe2b8('0x9a'),_0x4c9365[_0xe2b8('0x9b')],_0x4c9365[_0xe2b8('0x9c')]);}else{_0x5e01f0[_0xe2b8('0x3e')](_0x2f612a['table']+_0xe2b8('0x9d'),_0x4c9365['startDate'],_0x4c9365[_0xe2b8('0x9c')]);}if(_0x256703){logger[_0xe2b8('0x9e')](_0xe2b8('0x9f'),_0x5e01f0[_0xe2b8('0x88')]());require(_0xe2b8('0xa0'))[_0xe2b8('0xa1')](path[_0xe2b8('0x57')](__dirname,_0xe2b8('0xa2'),_0x256703['output']),[_0x256703['id'],_0x5e01f0[_0xe2b8('0x88')](),path['join'](__dirname,_0xe2b8('0xa3'),_0x256703[_0xe2b8('0xa4')]),_0x2bd08e]);return _0x256703;}else{var _0x1d81e6=squel['select']();_0x1d81e6[_0xe2b8('0x76')]('('+_0x5e01f0[_0xe2b8('0x88')]()+')',_0xe2b8('0xa5'));_0x1d81e6[_0xe2b8('0x6e')](_0xe2b8('0xa6'),_0xe2b8('0x20'));_0x5e01f0[_0xe2b8('0x21')](_0x4c9365[_0xe2b8('0x21')]||_0x5afeb5);_0x5e01f0[_0xe2b8('0x1f')](_0x4c9365['offset']||0x0);return dbH['sequelize'][_0xe2b8('0x33')](_0x1d81e6[_0xe2b8('0x88')](),{'type':dbH[_0xe2b8('0x89')][_0xe2b8('0x8a')][_0xe2b8('0x8b')]})['then'](function(_0x3be71c){if(!_0x3be71c['length']){_0x24c8f8=0x0;}else{_0x24c8f8=_0x3be71c[0x0]['count']||0x0;}return dbH['sequelize']['query'](_0x5e01f0[_0xe2b8('0x88')](),{'type':dbH[_0xe2b8('0x89')][_0xe2b8('0x8a')][_0xe2b8('0x8b')]});})[_0xe2b8('0x27')](function(_0x3a532f){return{'rows':_0x3a532f||[],'count':_0x24c8f8};});}});}exports['run']=function(_0x5c5e12,_0x12e3e8){return runReport(_0x5c5e12[_0xe2b8('0x4a')],_0x5c5e12[_0xe2b8('0x33')],_0x5c5e12[_0xe2b8('0x42')])[_0xe2b8('0x27')](respondWithResult(_0x12e3e8,null))[_0xe2b8('0x48')](handleError(_0x12e3e8,null));};exports['runReport']=runReport;exports[_0xe2b8('0x33')]=function(_0x4dfb04,_0x280b75){var _0x34d71b=0xa;var _0x5b0369=['join',_0xe2b8('0x58'),_0xe2b8('0x59'),'cross_join'];var _0x43ba45={'SUM':_0xe2b8('0x5b'),'COUNT':_0xe2b8('0x5c'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xe2b8('0x5e'),'MIN':_0xe2b8('0x5f'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xe2b8('0x60'),'GROUP_CONCAT ASC':_0xe2b8('0x61'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x21e026={'SEC_TO_TIME':_0xe2b8('0x8d'),'DATE':_0xe2b8('0x63'),'HOUR':_0xe2b8('0x64'),'ROUND':_0xe2b8('0x65'),'UNIX_TIMESTAMP':_0xe2b8('0x66')};var _0x4a80ea=function(_0x145ae4){return!_[_0xe2b8('0x67')](['IS\x20NULL',_0xe2b8('0x8e'),'IS\x20EMPTY',_0xe2b8('0x6a')],_0x145ae4);};var _0x2b9a03=function(_0x2c7665){if(!_0x2c7665||!_0x2c7665['rules'][_0xe2b8('0x3a')]){return'';}for(var _0x5133c2='(',_0x329ef7=0x0;_0x329ef7<_0x2c7665[_0xe2b8('0x6b')][_0xe2b8('0x3a')];_0x329ef7+=0x1){_0x329ef7>0x0&&(_0x5133c2+='\x20'+_0x2c7665[_0xe2b8('0x6c')]+'\x20');_0x5133c2+=_0x2c7665[_0xe2b8('0x6b')][_0x329ef7][_0xe2b8('0x6d')]?_0x2b9a03(_0x2c7665['rules'][_0x329ef7][_0xe2b8('0x6d')]):_0x2c7665[_0xe2b8('0x6b')][_0x329ef7][_0xe2b8('0x6e')]+'\x20'+_0x2c7665[_0xe2b8('0x6b')][_0x329ef7][_0xe2b8('0x6f')]+(_0x4a80ea(_0x2c7665['rules'][_0x329ef7][_0xe2b8('0x6f')])?'\x20'+_0x2c7665[_0xe2b8('0x6b')][_0x329ef7][_0xe2b8('0xa7')]:'');}return _0x5133c2+')';};var _0x54f9d8={'where':{'id':_0x4dfb04[_0xe2b8('0x4a')]['id']}},_0x142382,_0x3a01e6,_0x2265af,_0x36ab2d,_0x18cfe1;_0x54f9d8=_[_0xe2b8('0x40')]({},_0x54f9d8,_0x4dfb04[_0xe2b8('0x42')]);return db['AnalyticCustomReport']['find'](_0x54f9d8)[_0xe2b8('0x27')](function(_0x2bc025){if(_0x2bc025){_0x142382=_0x2bc025;return _0x2bc025[_0xe2b8('0x70')]();}return null;})[_0xe2b8('0x27')](function(_0x5a149f){if(_0x5a149f){if(!_0x5a149f[_0xe2b8('0x3a')]){throw new db[(_0xe2b8('0x71'))][(_0xe2b8('0x72'))](_0xe2b8('0x73'),0x193);}_0x3a01e6=_0x5a149f;return db[_0xe2b8('0x8f')]['findAll']({'raw':!![]});}return null;})[_0xe2b8('0x27')](function(_0x48ca73){if(_0x48ca73){_0x2265af=_['keyBy'](_0x48ca73,'id');var _0xdefce0;var _0x3ea6ff=squel[_0xe2b8('0x75')]();_0x3ea6ff[_0xe2b8('0x76')](_0x142382[_0xe2b8('0x77')]);for(var _0x37496a=0x0;_0x37496a<_0x3a01e6[_0xe2b8('0x3a')];_0x37496a+=0x1){_0xdefce0=_0x3a01e6[_0x37496a]['MetricId']?_0x2265af[_0x3a01e6[_0x37496a]['MetricId']]['metric']:_0x3a01e6[_0x37496a]['field'];_0xdefce0=_0x3a01e6[_0x37496a][_0xe2b8('0x79')]?_[_0xe2b8('0x7a')](_0x43ba45[_0x3a01e6[_0x37496a][_0xe2b8('0x79')]],'%s',_0xdefce0):_0xdefce0;_0xdefce0=_0x3a01e6[_0x37496a][_0xe2b8('0x7b')]?_[_0xe2b8('0x7a')](_0x21e026[_0x3a01e6[_0x37496a][_0xe2b8('0x7b')]],'%s',_0xdefce0):_0xdefce0;if(_0x3a01e6[_0x37496a][_0xe2b8('0x91')]){_0x3ea6ff['group'](_0xdefce0);}_0x3a01e6[_0x37496a][_0xe2b8('0x7c')]&&_0x3ea6ff['order'](_0xdefce0,_0x3a01e6[_0x37496a][_0xe2b8('0x7c')]==='DESC'?![]:!![]);_0x3ea6ff[_0xe2b8('0x6e')](_0xdefce0,_0x3a01e6[_0x37496a][_0xe2b8('0x7f')]||_0xdefce0);}if(_0x142382[_0xe2b8('0x80')]){_0x142382[_0xe2b8('0x80')]=JSON['parse'](_0x142382['joins']);for(var _0x4d9b7a=0x0;_0x4d9b7a<_0x142382[_0xe2b8('0x80')]['length'];_0x4d9b7a+=0x1){if(_0x142382[_0xe2b8('0x80')][_0x4d9b7a][_0xe2b8('0x31')]&&_['includes'](_0x5b0369,_0x142382[_0xe2b8('0x80')][_0x4d9b7a][_0xe2b8('0x31')])&&_0x142382[_0xe2b8('0x80')][_0x4d9b7a][_0xe2b8('0x81')]&&_0x142382[_0xe2b8('0x80')][_0x4d9b7a][_0xe2b8('0x82')]&&_0x142382[_0xe2b8('0x80')][_0x4d9b7a][_0xe2b8('0x83')]){_0x3ea6ff[_0x142382[_0xe2b8('0x80')][_0x4d9b7a][_0xe2b8('0x31')]](_0x142382[_0xe2b8('0x80')][_0x4d9b7a][_0xe2b8('0x82')],null,util['format'](_0xe2b8('0x84'),_0x142382[_0xe2b8('0x77')],_0x142382['joins'][_0x4d9b7a][_0xe2b8('0x81')],_0x142382[_0xe2b8('0x80')][_0x4d9b7a]['foreignTable'],_0x142382[_0xe2b8('0x80')][_0x4d9b7a][_0xe2b8('0x83')]));}}}if(_0x142382[_0xe2b8('0x85')]){_0x142382[_0xe2b8('0x85')]=JSON['parse'](_0x142382[_0xe2b8('0x85')]);_0x3ea6ff[_0xe2b8('0x3e')](_0x2b9a03(_0x142382['conditions'][_0xe2b8('0x6d')]));}_0x18cfe1=_0x3ea6ff[_0xe2b8('0x87')]();_0x3ea6ff['limit'](_0x34d71b);_0x3ea6ff['offset'](0x0);logger[_0xe2b8('0xa8')](_0xe2b8('0xa9'),_0x3ea6ff[_0xe2b8('0x88')]());return dbH[_0xe2b8('0x89')]['query'](_0x3ea6ff['toString'](),{'type':dbH[_0xe2b8('0x89')][_0xe2b8('0x8a')]['SELECT']});}})[_0xe2b8('0x27')](function(){return{'sql':_0x18cfe1[_0xe2b8('0x88')]()};})[_0xe2b8('0x27')](respondWithResult(_0x280b75,null))[_0xe2b8('0x48')](handleError(_0x280b75,null));}; \ No newline at end of file +var _0xe69c=['MIN(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','Sequelize','ValidationErrorItem','AnalyticMetric','keyBy','table','MetricId','function','replace','format','groupBy','orderBy','alias','joins','includes','parentKey','foreignKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','parse','clone','debug','toString','sequelize','QueryTypes','SELECT','SUM(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','SEC_TO_TIME(%s)','HOUR(%s)','IS\x20NULL','IS\x20NOT\x20NULL','getFields','Please\x20insert\x20at\x20least\x20one\x20field','from','metric','DESC','output','web','fullPath','%s-%s.%s','randomstring','csv','custom','AnalyticExtractedReport','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','Run\x20Query:','child_process','fork','../../files/reports','savename','countTable','COUNT(*)','runReport','COUNT(DISTINCT\x20%s)','AVG(%s)','select','Limited\x20Query:','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','dbH','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','save','update','destroy','then','get','UserProfileResource','error','stack','name','send','index','map','fieldName','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','type','VIRTUAL','merge','options','AnalyticCustomReport','include','findAll','rows','catch','show','params','keys','rawAttributes','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','body','preview','join','left_join','right_join','cross_join','COUNT(%s)','MAX(%s)'];(function(_0x3bb84d,_0x4e8270){var _0x506ca9=function(_0x44bdd5){while(--_0x44bdd5){_0x3bb84d['push'](_0x3bb84d['shift']());}};_0x506ca9(++_0x4e8270);}(_0xe69c,0x18e));var _0xce69=function(_0x39095c,_0x4b930f){_0x39095c=_0x39095c-0x0;var _0x2cf6a3=_0xe69c[_0x39095c];return _0x2cf6a3;};'use strict';var emlformat=require(_0xce69('0x0'));var rimraf=require(_0xce69('0x1'));var zipdir=require(_0xce69('0x2'));var jsonpatch=require(_0xce69('0x3'));var rp=require(_0xce69('0x4'));var moment=require(_0xce69('0x5'));var BPromise=require(_0xce69('0x6'));var Mustache=require(_0xce69('0x7'));var util=require(_0xce69('0x8'));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('fs-extra');var _=require(_0xce69('0x9'));var squel=require(_0xce69('0xa'));var crypto=require(_0xce69('0xb'));var jsforce=require(_0xce69('0xc'));var deskjs=require(_0xce69('0xd'));var toCsv=require(_0xce69('0xe'));var querystring=require(_0xce69('0xf'));var Papa=require(_0xce69('0x10'));var Redis=require('ioredis');var authService=require(_0xce69('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xce69('0x12'))(_0xce69('0x13'));var utils=require(_0xce69('0x14'));var config=require(_0xce69('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xce69('0x16'))['db'];var dbH=require(_0xce69('0x16'))[_0xce69('0x17')];function respondWithStatusCode(_0x13b90f,_0x3ab651){_0x3ab651=_0x3ab651||0xcc;return function(_0x5b7c62){if(_0x5b7c62){return _0x13b90f[_0xce69('0x18')](_0x3ab651);}return _0x13b90f['status'](_0x3ab651)[_0xce69('0x19')]();};}function respondWithResult(_0x231e3b,_0x2d4a6d){_0x2d4a6d=_0x2d4a6d||0xc8;return function(_0x287125){if(_0x287125){return _0x231e3b[_0xce69('0x1a')](_0x2d4a6d)[_0xce69('0x1b')](_0x287125);}};}function respondWithFilteredResult(_0xb51b30,_0x27dcca){return function(_0xd12b1){if(_0xd12b1){var _0xd48b0a=typeof _0x27dcca[_0xce69('0x1c')]===_0xce69('0x1d')&&typeof _0x27dcca[_0xce69('0x1e')]===_0xce69('0x1d');var _0x2569ab=_0xd12b1[_0xce69('0x1f')];var _0x160ef9=_0xd48b0a?0x0:_0x27dcca['offset'];var _0x191e71=_0xd48b0a?_0xd12b1[_0xce69('0x1f')]:_0x27dcca[_0xce69('0x1c')]+_0x27dcca[_0xce69('0x1e')];var _0x282bf6;if(_0x191e71>=_0x2569ab){_0x191e71=_0x2569ab;_0x282bf6=0xc8;}else{_0x282bf6=0xce;}_0xb51b30[_0xce69('0x1a')](_0x282bf6);return _0xb51b30['set'](_0xce69('0x20'),_0x160ef9+'-'+_0x191e71+'/'+_0x2569ab)[_0xce69('0x1b')](_0xd12b1);}return null;};}function patchUpdates(_0x4734ad){return function(_0x4080a3){try{jsonpatch[_0xce69('0x21')](_0x4080a3,_0x4734ad,!![]);}catch(_0x55eee5){return BPromise['reject'](_0x55eee5);}return _0x4080a3[_0xce69('0x22')]();};}function saveUpdates(_0x274acc,_0x369b9e){return function(_0x2f591d){if(_0x2f591d){return _0x2f591d[_0xce69('0x23')](_0x274acc)['then'](function(_0x4bd17b){return _0x4bd17b;});}return null;};}function removeEntity(_0x47c653,_0x34a4ec){return function(_0x974668){if(_0x974668){return _0x974668[_0xce69('0x24')]()[_0xce69('0x25')](function(){var _0x3dcda3=_0x974668[_0xce69('0x26')]({'plain':!![]});var _0x3b0519='CustomReports';return db[_0xce69('0x27')][_0xce69('0x24')]({'where':{'type':_0x3b0519,'resourceId':_0x3dcda3['id']}})[_0xce69('0x25')](function(){return _0x974668;});})['then'](function(){_0x47c653[_0xce69('0x1a')](0xcc)[_0xce69('0x19')]();});}};}function handleEntityNotFound(_0x28a8d4,_0x3cac82){return function(_0x5c4245){if(!_0x5c4245){_0x28a8d4[_0xce69('0x18')](0x194);}return _0x5c4245;};}function handleError(_0x2460ab,_0x164154){_0x164154=_0x164154||0x1f4;return function(_0x13cecc){logger[_0xce69('0x28')](_0x13cecc[_0xce69('0x29')]);if(_0x13cecc[_0xce69('0x2a')]){delete _0x13cecc[_0xce69('0x2a')];}_0x2460ab[_0xce69('0x1a')](_0x164154)[_0xce69('0x2b')](_0x13cecc);};}exports[_0xce69('0x2c')]=function(_0x5f5c1f,_0x42fef4){var _0x3ea59b={},_0x475a4b={},_0x3dd328={'count':0x0,'rows':[]};var _0x225526=_[_0xce69('0x2d')](db['AnalyticCustomReport']['rawAttributes'],function(_0x62420d){return{'name':_0x62420d[_0xce69('0x2e')],'type':_0x62420d['type']['key']};});_0x475a4b[_0xce69('0x2f')]=_['map'](_0x225526,_0xce69('0x2a'));_0x475a4b[_0xce69('0x30')]=_['keys'](_0x5f5c1f[_0xce69('0x30')]);_0x475a4b['filters']=_['intersection'](_0x475a4b['model'],_0x475a4b[_0xce69('0x30')]);_0x3ea59b['attributes']=_[_0xce69('0x31')](_0x475a4b[_0xce69('0x2f')],qs['fields'](_0x5f5c1f[_0xce69('0x30')][_0xce69('0x32')]));_0x3ea59b[_0xce69('0x33')]=_0x3ea59b[_0xce69('0x33')][_0xce69('0x34')]?_0x3ea59b[_0xce69('0x33')]:_0x475a4b['model'];if(!_0x5f5c1f[_0xce69('0x30')][_0xce69('0x35')](_0xce69('0x36'))){_0x3ea59b[_0xce69('0x1e')]=qs[_0xce69('0x1e')](_0x5f5c1f[_0xce69('0x30')][_0xce69('0x1e')]);_0x3ea59b['offset']=qs['offset'](_0x5f5c1f[_0xce69('0x30')][_0xce69('0x1c')]);}_0x3ea59b[_0xce69('0x37')]=qs[_0xce69('0x38')](_0x5f5c1f[_0xce69('0x30')][_0xce69('0x38')]);_0x3ea59b[_0xce69('0x39')]=qs[_0xce69('0x3a')](_[_0xce69('0x3b')](_0x5f5c1f[_0xce69('0x30')],_0x475a4b[_0xce69('0x3a')]),_0x225526);if(_0x5f5c1f[_0xce69('0x30')][_0xce69('0x3c')]){_0x3ea59b['where']=_['merge'](_0x3ea59b['where'],{'$or':_[_0xce69('0x2d')](_0x225526,function(_0x4cc964){if(_0x4cc964[_0xce69('0x3d')]!==_0xce69('0x3e')){var _0x4dc2ee={};_0x4dc2ee[_0x4cc964[_0xce69('0x2a')]]={'$like':'%'+_0x5f5c1f[_0xce69('0x30')][_0xce69('0x3c')]+'%'};return _0x4dc2ee;}})});}_0x3ea59b=_[_0xce69('0x3f')]({},_0x3ea59b,_0x5f5c1f[_0xce69('0x40')]);var _0x373922={'where':_0x3ea59b[_0xce69('0x39')]};return db[_0xce69('0x41')][_0xce69('0x1f')](_0x373922)[_0xce69('0x25')](function(_0x37034d){_0x3dd328[_0xce69('0x1f')]=_0x37034d;if(_0x5f5c1f[_0xce69('0x30')]['includeAll']){_0x3ea59b[_0xce69('0x42')]=[{'all':!![]}];}return db['AnalyticCustomReport'][_0xce69('0x43')](_0x3ea59b);})['then'](function(_0x23ce24){_0x3dd328[_0xce69('0x44')]=_0x23ce24;return _0x3dd328;})[_0xce69('0x25')](respondWithFilteredResult(_0x42fef4,_0x3ea59b))[_0xce69('0x45')](handleError(_0x42fef4,null));};exports[_0xce69('0x46')]=function(_0x5bc07f,_0x44f1d0){var _0x58dbab={'raw':![],'where':{'id':_0x5bc07f[_0xce69('0x47')]['id']}},_0x157103={};_0x157103[_0xce69('0x2f')]=_[_0xce69('0x48')](db[_0xce69('0x41')][_0xce69('0x49')]);_0x157103[_0xce69('0x30')]=_[_0xce69('0x48')](_0x5bc07f['query']);_0x157103[_0xce69('0x3a')]=_[_0xce69('0x31')](_0x157103['model'],_0x157103['query']);_0x58dbab['attributes']=_[_0xce69('0x31')](_0x157103['model'],qs[_0xce69('0x32')](_0x5bc07f['query'][_0xce69('0x32')]));_0x58dbab['attributes']=_0x58dbab['attributes'][_0xce69('0x34')]?_0x58dbab['attributes']:_0x157103[_0xce69('0x2f')];if(_0x5bc07f['query']['includeAll']){_0x58dbab['include']=[{'all':!![]}];}_0x58dbab=_['merge']({},_0x58dbab,_0x5bc07f[_0xce69('0x40')]);return db[_0xce69('0x41')][_0xce69('0x4a')](_0x58dbab)['then'](handleEntityNotFound(_0x44f1d0,null))[_0xce69('0x25')](respondWithResult(_0x44f1d0,null))[_0xce69('0x45')](handleError(_0x44f1d0,null));};exports[_0xce69('0x4b')]=function(_0x38a8eb,_0x1c3602){return db[_0xce69('0x41')]['create'](_0x38a8eb['body'],{})['then'](function(_0x3c3d88){var _0x2704e4=_0x38a8eb[_0xce69('0x4c')][_0xce69('0x26')]({'plain':!![]});if(!_0x2704e4)throw new Error(_0xce69('0x4d'));if(_0x2704e4[_0xce69('0x4e')]==='user'){var _0x1ada7d=_0x3c3d88[_0xce69('0x26')]({'plain':!![]});var _0x20679a='Reports';return db['UserProfileSection'][_0xce69('0x4a')]({'where':{'name':_0x20679a,'userProfileId':_0x2704e4['userProfileId']},'raw':!![]})[_0xce69('0x25')](function(_0xb45b48){if(_0xb45b48&&_0xb45b48[_0xce69('0x4f')]===0x0){return db[_0xce69('0x27')]['create']({'name':_0x1ada7d['name'],'resourceId':_0x1ada7d['id'],'type':'CustomReports','sectionId':_0xb45b48['id']},{})[_0xce69('0x25')](function(){return _0x3c3d88;});}else{return _0x3c3d88;}})[_0xce69('0x45')](function(_0x10b230){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x10b230);throw _0x10b230;});}return _0x3c3d88;})[_0xce69('0x25')](respondWithResult(_0x1c3602,0xc9))[_0xce69('0x45')](handleError(_0x1c3602,null));};exports[_0xce69('0x23')]=function(_0x2ebca6,_0x4a82a0){if(_0x2ebca6[_0xce69('0x50')]['id']){delete _0x2ebca6[_0xce69('0x50')]['id'];}return db['AnalyticCustomReport'][_0xce69('0x4a')]({'where':{'id':_0x2ebca6[_0xce69('0x47')]['id']}})[_0xce69('0x25')](handleEntityNotFound(_0x4a82a0,null))['then'](saveUpdates(_0x2ebca6['body'],null))[_0xce69('0x25')](respondWithResult(_0x4a82a0,null))['catch'](handleError(_0x4a82a0,null));};exports[_0xce69('0x24')]=function(_0x103f47,_0x451c79){return db[_0xce69('0x41')][_0xce69('0x4a')]({'where':{'id':_0x103f47[_0xce69('0x47')]['id']}})['then'](handleEntityNotFound(_0x451c79,null))['then'](removeEntity(_0x451c79,null))[_0xce69('0x45')](handleError(_0x451c79,null));};exports[_0xce69('0x51')]=function(_0x52bbb3,_0x394981){var _0x5add9f=0xa;var _0x10ae0b=[_0xce69('0x52'),_0xce69('0x53'),_0xce69('0x54'),_0xce69('0x55')];var _0x241baa={'SUM':'SUM(%s)','COUNT':_0xce69('0x56'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xce69('0x57'),'MIN':_0xce69('0x58'),'AVG':'AVG(%s)','GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xce69('0x59')};var _0x24f884={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xce69('0x5a'),'HOUR':'HOUR(%s)','ROUND':_0xce69('0x5b'),'UNIX_TIMESTAMP':_0xce69('0x5c')};var _0x46273a=function(_0x1b85fa){return!_['includes'](['IS\x20NULL','IS\x20NOT\x20NULL',_0xce69('0x5d'),_0xce69('0x5e')],_0x1b85fa);};var _0x22a4cb=function(_0x25f035){if(!_0x25f035||!_0x25f035[_0xce69('0x5f')][_0xce69('0x34')]){return'';}for(var _0x35ecb4='(',_0x472904=0x0;_0x472904<_0x25f035[_0xce69('0x5f')][_0xce69('0x34')];_0x472904+=0x1){_0x472904>0x0&&(_0x35ecb4+='\x20'+_0x25f035[_0xce69('0x60')]+'\x20');_0x35ecb4+=_0x25f035[_0xce69('0x5f')][_0x472904][_0xce69('0x61')]?_0x22a4cb(_0x25f035[_0xce69('0x5f')][_0x472904][_0xce69('0x61')]):_0x25f035[_0xce69('0x5f')][_0x472904][_0xce69('0x62')]+'\x20'+_0x25f035[_0xce69('0x5f')][_0x472904][_0xce69('0x63')]+(_0x46273a(_0x25f035[_0xce69('0x5f')][_0x472904][_0xce69('0x63')])?'\x20'+_0x25f035[_0xce69('0x5f')][_0x472904][_0xce69('0x64')]:'');}return _0x35ecb4+')';};var _0x2886ed={'where':{'id':_0x52bbb3[_0xce69('0x47')]['id']}},_0x34a552,_0x827585,_0x4ed999,_0x568f29,_0x4d2e72;_0x2886ed=_[_0xce69('0x3f')]({},_0x2886ed,_0x52bbb3[_0xce69('0x40')]);return db['AnalyticCustomReport'][_0xce69('0x4a')](_0x2886ed)[_0xce69('0x25')](function(_0x6a9c8a){if(_0x6a9c8a){_0x34a552=_0x6a9c8a;return _0x6a9c8a['getFields']();}return null;})[_0xce69('0x25')](function(_0x44e241){if(_0x44e241){if(!_0x44e241[_0xce69('0x34')]){throw new db[(_0xce69('0x65'))][(_0xce69('0x66'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x827585=_0x44e241;return db[_0xce69('0x67')][_0xce69('0x43')]({'raw':!![]});}return null;})[_0xce69('0x25')](function(_0x59e79d){if(_0x59e79d){_0x4ed999=_[_0xce69('0x68')](_0x59e79d,'id');var _0xe594bf;var _0x56eaa1=squel['select']();_0x56eaa1['from'](_0x34a552[_0xce69('0x69')]);for(var _0x23607d=0x0;_0x23607d<_0x827585[_0xce69('0x34')];_0x23607d+=0x1){_0xe594bf=_0x827585[_0x23607d]['MetricId']?_0x4ed999[_0x827585[_0x23607d][_0xce69('0x6a')]]['metric']:_0x827585[_0x23607d]['field'];_0xe594bf=_0x827585[_0x23607d][_0xce69('0x6b')]?_[_0xce69('0x6c')](_0x241baa[_0x827585[_0x23607d][_0xce69('0x6b')]],'%s',_0xe594bf):_0xe594bf;_0xe594bf=_0x827585[_0x23607d]['format']?_[_0xce69('0x6c')](_0x24f884[_0x827585[_0x23607d][_0xce69('0x6d')]],'%s',_0xe594bf):_0xe594bf;if(_0x827585[_0x23607d][_0xce69('0x6e')]){_0x56eaa1[_0xce69('0x61')](_0xe594bf);}_0x827585[_0x23607d]['orderBy']&&_0x56eaa1[_0xce69('0x37')](_0xe594bf,_0x827585[_0x23607d][_0xce69('0x6f')]==='DESC'?![]:!![]);_0x56eaa1[_0xce69('0x62')](_0xe594bf,_0x827585[_0x23607d][_0xce69('0x70')]||_0xe594bf);}if(_0x34a552[_0xce69('0x71')]){_0x34a552[_0xce69('0x71')]=JSON['parse'](_0x34a552[_0xce69('0x71')]);for(var _0xdefbe0=0x0;_0xdefbe0<_0x34a552['joins'][_0xce69('0x34')];_0xdefbe0+=0x1){if(_0x34a552[_0xce69('0x71')][_0xdefbe0]['type']&&_[_0xce69('0x72')](_0x10ae0b,_0x34a552[_0xce69('0x71')][_0xdefbe0][_0xce69('0x3d')])&&_0x34a552[_0xce69('0x71')][_0xdefbe0][_0xce69('0x73')]&&_0x34a552[_0xce69('0x71')][_0xdefbe0]['foreignTable']&&_0x34a552[_0xce69('0x71')][_0xdefbe0][_0xce69('0x74')]){_0x56eaa1[_0x34a552[_0xce69('0x71')][_0xdefbe0]['type']](_0x34a552[_0xce69('0x71')][_0xdefbe0][_0xce69('0x75')],null,util[_0xce69('0x6d')](_0xce69('0x76'),_0x34a552[_0xce69('0x69')],_0x34a552['joins'][_0xdefbe0][_0xce69('0x73')],_0x34a552['joins'][_0xdefbe0]['foreignTable'],_0x34a552[_0xce69('0x71')][_0xdefbe0][_0xce69('0x74')]));}}}if(_0x34a552[_0xce69('0x77')]){_0x34a552[_0xce69('0x77')]=JSON[_0xce69('0x78')](_0x34a552[_0xce69('0x77')]);_0x56eaa1[_0xce69('0x39')](_0x22a4cb(_0x34a552[_0xce69('0x77')][_0xce69('0x61')]));}_0x4d2e72=_0x56eaa1[_0xce69('0x79')]();_0x56eaa1['limit'](_0x5add9f);_0x56eaa1['offset'](0x0);logger[_0xce69('0x7a')]('Limited\x20Query:',_0x56eaa1[_0xce69('0x7b')]());return dbH[_0xce69('0x7c')][_0xce69('0x30')](_0x56eaa1[_0xce69('0x7b')](),{'type':dbH[_0xce69('0x7c')][_0xce69('0x7d')][_0xce69('0x7e')]});}})[_0xce69('0x25')](respondWithResult(_0x394981,null))[_0xce69('0x45')](handleError(_0x394981,null));};function runReport(_0x4e4acf,_0x3fcf30,_0x31ca2){var _0x2c737a=_0x3fcf30[_0xce69('0x2a')];var _0x2c5d0c=0xa;var _0x1bf196=[_0xce69('0x52'),_0xce69('0x53'),_0xce69('0x54'),_0xce69('0x55')];var _0x238c45={'SUM':_0xce69('0x7f'),'COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0xce69('0x80'),'GROUP_CONCAT ASC':_0xce69('0x81'),'GROUP_CONCAT DESC':_0xce69('0x59')};var _0x14dd5d={'SEC_TO_TIME':_0xce69('0x82'),'DATE':_0xce69('0x5a'),'HOUR':_0xce69('0x83'),'ROUND':_0xce69('0x5b'),'UNIX_TIMESTAMP':_0xce69('0x5c')};var _0x160181=function(_0x2cc67b){return!_[_0xce69('0x72')]([_0xce69('0x84'),_0xce69('0x85'),'IS\x20EMPTY',_0xce69('0x5e')],_0x2cc67b);};var _0x5c33ba=function(_0x4e8707){if(!_0x4e8707||!_0x4e8707[_0xce69('0x5f')][_0xce69('0x34')]){return'';}for(var _0x5c6962='(',_0xc27f60=0x0;_0xc27f60<_0x4e8707[_0xce69('0x5f')][_0xce69('0x34')];_0xc27f60+=0x1){_0xc27f60>0x0&&(_0x5c6962+='\x20'+_0x4e8707[_0xce69('0x60')]+'\x20');_0x5c6962+=_0x4e8707[_0xce69('0x5f')][_0xc27f60][_0xce69('0x61')]?_0x5c33ba(_0x4e8707[_0xce69('0x5f')][_0xc27f60][_0xce69('0x61')]):_0x4e8707['rules'][_0xc27f60]['field']+'\x20'+_0x4e8707[_0xce69('0x5f')][_0xc27f60][_0xce69('0x63')]+(_0x160181(_0x4e8707[_0xce69('0x5f')][_0xc27f60][_0xce69('0x63')])?'\x20'+_0x4e8707[_0xce69('0x5f')][_0xc27f60][_0xce69('0x64')]:'');}return _0x5c6962+')';};var _0x57a9ec={'where':{'id':_0x4e4acf['id']}},_0x316af7,_0x13a413,_0x3b3bf4,_0x3db941,_0x5b5ca4;_0x57a9ec=_[_0xce69('0x3f')]({},_0x57a9ec,_0x31ca2);return db[_0xce69('0x41')][_0xce69('0x4a')](_0x57a9ec)[_0xce69('0x25')](function(_0x383901){if(_0x383901){_0x316af7=_0x383901;return _0x383901[_0xce69('0x86')]();}return null;})[_0xce69('0x25')](function(_0x346465){if(_0x346465){if(!_0x346465['length']){throw new db[(_0xce69('0x65'))]['ValidationErrorItem'](_0xce69('0x87'),0x193);}_0x13a413=_0x346465;return db[_0xce69('0x67')][_0xce69('0x43')]({'raw':!![]});}return null;})['then'](function(_0x231829){if(_0x231829){_0x3b3bf4=_[_0xce69('0x68')](_0x231829,'id');var _0x374c3f;var _0xae18c0=squel['select']();_0xae18c0[_0xce69('0x88')](_0x316af7[_0xce69('0x69')]);for(var _0x521f8b=0x0;_0x521f8b<_0x13a413[_0xce69('0x34')];_0x521f8b+=0x1){_0x374c3f=_0x13a413[_0x521f8b]['MetricId']?_0x3b3bf4[_0x13a413[_0x521f8b][_0xce69('0x6a')]][_0xce69('0x89')]:_0x13a413[_0x521f8b][_0xce69('0x62')];_0x374c3f=_0x13a413[_0x521f8b]['function']?_[_0xce69('0x6c')](_0x238c45[_0x13a413[_0x521f8b][_0xce69('0x6b')]],'%s',_0x374c3f):_0x374c3f;_0x374c3f=_0x13a413[_0x521f8b][_0xce69('0x6d')]?_[_0xce69('0x6c')](_0x14dd5d[_0x13a413[_0x521f8b][_0xce69('0x6d')]],'%s',_0x374c3f):_0x374c3f;if(_0x13a413[_0x521f8b][_0xce69('0x6e')]){_0xae18c0['group'](_0x374c3f);}_0x13a413[_0x521f8b][_0xce69('0x6f')]&&_0xae18c0[_0xce69('0x37')](_0x374c3f,_0x13a413[_0x521f8b]['orderBy']===_0xce69('0x8a')?![]:!![]);_0xae18c0['field'](_0x374c3f,_0x13a413[_0x521f8b][_0xce69('0x70')]||_0x374c3f);}if(_0x316af7[_0xce69('0x71')]){_0x316af7[_0xce69('0x71')]=JSON[_0xce69('0x78')](_0x316af7[_0xce69('0x71')]);for(var _0x39f027=0x0;_0x39f027<_0x316af7['joins']['length'];_0x39f027+=0x1){if(_0x316af7[_0xce69('0x71')][_0x39f027][_0xce69('0x3d')]&&_['includes'](_0x1bf196,_0x316af7['joins'][_0x39f027][_0xce69('0x3d')])&&_0x316af7['joins'][_0x39f027][_0xce69('0x73')]&&_0x316af7[_0xce69('0x71')][_0x39f027][_0xce69('0x75')]&&_0x316af7[_0xce69('0x71')][_0x39f027][_0xce69('0x74')]){_0xae18c0[_0x316af7[_0xce69('0x71')][_0x39f027][_0xce69('0x3d')]](_0x316af7[_0xce69('0x71')][_0x39f027][_0xce69('0x75')],null,util[_0xce69('0x6d')](_0xce69('0x76'),_0x316af7[_0xce69('0x69')],_0x316af7[_0xce69('0x71')][_0x39f027][_0xce69('0x73')],_0x316af7[_0xce69('0x71')][_0x39f027][_0xce69('0x75')],_0x316af7['joins'][_0x39f027][_0xce69('0x74')]));}}}if(_0x316af7['conditions']){_0x316af7['conditions']=JSON[_0xce69('0x78')](_0x316af7[_0xce69('0x77')]);_0xae18c0['where'](_0x5c33ba(_0x316af7[_0xce69('0x77')][_0xce69('0x61')]));}_0x5b5ca4=_0xae18c0[_0xce69('0x79')]();_0xae18c0[_0xce69('0x1e')](_0x2c5d0c);_0xae18c0[_0xce69('0x1c')](0x0);return;}})['then'](function(){if(_0x3fcf30[_0xce69('0x8b')]===_0xce69('0x8c')){return null;}var _0x502200=_[_0xce69('0x3f')](_0x3fcf30,{'name':_0x3fcf30[_0xce69('0x8d')]||_0x3fcf30[_0xce69('0x2a')]||_0x316af7[_0xce69('0x2a')],'basename':_0x2c737a,'savename':util['format'](_0xce69('0x8e'),_0x3fcf30[_0xce69('0x2a')]||_0x316af7[_0xce69('0x2a')],require(_0xce69('0x8f'))['generate'](0x4),_0x3fcf30[_0xce69('0x8b')]||_0xce69('0x90')),'reportId':_0x316af7['id'],'reportType':_0xce69('0x91')});return db[_0xce69('0x92')][_0xce69('0x4b')](_0x502200,{'raw':!![]});})[_0xce69('0x25')](function(_0xa2d82e){if(_0x316af7[_0xce69('0x69')]==='cdr'){_0x5b5ca4['where'](_0x316af7[_0xce69('0x69')]+_0xce69('0x93'),_0x3fcf30[_0xce69('0x94')],_0x3fcf30['endDate']);}else{_0x5b5ca4[_0xce69('0x39')](_0x316af7[_0xce69('0x69')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x3fcf30[_0xce69('0x94')],_0x3fcf30[_0xce69('0x95')]);}if(_0xa2d82e){logger['info'](_0xce69('0x96'),_0x5b5ca4[_0xce69('0x7b')]());require(_0xce69('0x97'))[_0xce69('0x98')](path[_0xce69('0x52')](__dirname,'../../components/export/',_0xa2d82e['output']),[_0xa2d82e['id'],_0x5b5ca4[_0xce69('0x7b')](),path[_0xce69('0x52')](__dirname,_0xce69('0x99'),_0xa2d82e[_0xce69('0x9a')]),_0x2c737a]);return _0xa2d82e;}else{var _0x456337=squel['select']();_0x456337['from']('('+_0x5b5ca4[_0xce69('0x7b')]()+')',_0xce69('0x9b'));_0x456337[_0xce69('0x62')](_0xce69('0x9c'),_0xce69('0x1f'));_0x5b5ca4[_0xce69('0x1e')](_0x3fcf30[_0xce69('0x1e')]||_0x2c5d0c);_0x5b5ca4[_0xce69('0x1c')](_0x3fcf30[_0xce69('0x1c')]||0x0);return dbH['sequelize'][_0xce69('0x30')](_0x456337['toString'](),{'type':dbH[_0xce69('0x7c')]['QueryTypes'][_0xce69('0x7e')]})[_0xce69('0x25')](function(_0x4a24f9){if(!_0x4a24f9[_0xce69('0x34')]){_0x3db941=0x0;}else{_0x3db941=_0x4a24f9[0x0][_0xce69('0x1f')]||0x0;}return dbH['sequelize'][_0xce69('0x30')](_0x5b5ca4['toString'](),{'type':dbH[_0xce69('0x7c')]['QueryTypes'][_0xce69('0x7e')]});})[_0xce69('0x25')](function(_0x194eeb){return{'rows':_0x194eeb||[],'count':_0x3db941};});}});}exports['run']=function(_0x57ca37,_0x95a9a){return runReport(_0x57ca37[_0xce69('0x47')],_0x57ca37[_0xce69('0x30')],_0x57ca37['options'])[_0xce69('0x25')](respondWithResult(_0x95a9a,null))[_0xce69('0x45')](handleError(_0x95a9a,null));};exports[_0xce69('0x9d')]=runReport;exports[_0xce69('0x30')]=function(_0x436bd5,_0x1236d0){var _0x3ad10f=0xa;var _0x2e6a65=[_0xce69('0x52'),_0xce69('0x53'),'right_join',_0xce69('0x55')];var _0x3f0201={'SUM':_0xce69('0x7f'),'COUNT':_0xce69('0x56'),'COUNT DISTINCT':_0xce69('0x9e'),'MAX':_0xce69('0x57'),'MIN':_0xce69('0x58'),'AVG':_0xce69('0x9f'),'GROUP_CONCAT':_0xce69('0x80'),'GROUP_CONCAT ASC':_0xce69('0x81'),'GROUP_CONCAT DESC':_0xce69('0x59')};var _0x33df15={'SEC_TO_TIME':_0xce69('0x82'),'DATE':_0xce69('0x5a'),'HOUR':'HOUR(%s)','ROUND':_0xce69('0x5b'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x54bebb=function(_0x1999c6){return!_[_0xce69('0x72')](['IS\x20NULL',_0xce69('0x85'),_0xce69('0x5d'),'IS\x20NOT\x20EMPTY'],_0x1999c6);};var _0x3182fe=function(_0x35659e){if(!_0x35659e||!_0x35659e[_0xce69('0x5f')][_0xce69('0x34')]){return'';}for(var _0x3aeecc='(',_0x228aa4=0x0;_0x228aa4<_0x35659e['rules'][_0xce69('0x34')];_0x228aa4+=0x1){_0x228aa4>0x0&&(_0x3aeecc+='\x20'+_0x35659e[_0xce69('0x60')]+'\x20');_0x3aeecc+=_0x35659e[_0xce69('0x5f')][_0x228aa4][_0xce69('0x61')]?_0x3182fe(_0x35659e[_0xce69('0x5f')][_0x228aa4][_0xce69('0x61')]):_0x35659e[_0xce69('0x5f')][_0x228aa4]['field']+'\x20'+_0x35659e[_0xce69('0x5f')][_0x228aa4][_0xce69('0x63')]+(_0x54bebb(_0x35659e[_0xce69('0x5f')][_0x228aa4]['condition'])?'\x20'+_0x35659e[_0xce69('0x5f')][_0x228aa4][_0xce69('0x64')]:'');}return _0x3aeecc+')';};var _0xe93174={'where':{'id':_0x436bd5[_0xce69('0x47')]['id']}},_0xe4fbcc,_0x5c87b7,_0x447eab,_0x179eb3,_0x4da05f;_0xe93174=_[_0xce69('0x3f')]({},_0xe93174,_0x436bd5[_0xce69('0x40')]);return db[_0xce69('0x41')][_0xce69('0x4a')](_0xe93174)[_0xce69('0x25')](function(_0x55958c){if(_0x55958c){_0xe4fbcc=_0x55958c;return _0x55958c[_0xce69('0x86')]();}return null;})[_0xce69('0x25')](function(_0x24c30a){if(_0x24c30a){if(!_0x24c30a[_0xce69('0x34')]){throw new db[(_0xce69('0x65'))][(_0xce69('0x66'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x5c87b7=_0x24c30a;return db['AnalyticMetric'][_0xce69('0x43')]({'raw':!![]});}return null;})[_0xce69('0x25')](function(_0x1bac0f){if(_0x1bac0f){_0x447eab=_[_0xce69('0x68')](_0x1bac0f,'id');var _0x597aba;var _0x290c69=squel[_0xce69('0xa0')]();_0x290c69['from'](_0xe4fbcc[_0xce69('0x69')]);for(var _0x4c012d=0x0;_0x4c012d<_0x5c87b7[_0xce69('0x34')];_0x4c012d+=0x1){_0x597aba=_0x5c87b7[_0x4c012d]['MetricId']?_0x447eab[_0x5c87b7[_0x4c012d]['MetricId']][_0xce69('0x89')]:_0x5c87b7[_0x4c012d][_0xce69('0x62')];_0x597aba=_0x5c87b7[_0x4c012d][_0xce69('0x6b')]?_['replace'](_0x3f0201[_0x5c87b7[_0x4c012d][_0xce69('0x6b')]],'%s',_0x597aba):_0x597aba;_0x597aba=_0x5c87b7[_0x4c012d][_0xce69('0x6d')]?_[_0xce69('0x6c')](_0x33df15[_0x5c87b7[_0x4c012d][_0xce69('0x6d')]],'%s',_0x597aba):_0x597aba;if(_0x5c87b7[_0x4c012d]['groupBy']){_0x290c69[_0xce69('0x61')](_0x597aba);}_0x5c87b7[_0x4c012d][_0xce69('0x6f')]&&_0x290c69[_0xce69('0x37')](_0x597aba,_0x5c87b7[_0x4c012d][_0xce69('0x6f')]===_0xce69('0x8a')?![]:!![]);_0x290c69[_0xce69('0x62')](_0x597aba,_0x5c87b7[_0x4c012d]['alias']||_0x597aba);}if(_0xe4fbcc[_0xce69('0x71')]){_0xe4fbcc[_0xce69('0x71')]=JSON[_0xce69('0x78')](_0xe4fbcc[_0xce69('0x71')]);for(var _0xa8019b=0x0;_0xa8019b<_0xe4fbcc[_0xce69('0x71')][_0xce69('0x34')];_0xa8019b+=0x1){if(_0xe4fbcc[_0xce69('0x71')][_0xa8019b][_0xce69('0x3d')]&&_[_0xce69('0x72')](_0x2e6a65,_0xe4fbcc[_0xce69('0x71')][_0xa8019b]['type'])&&_0xe4fbcc[_0xce69('0x71')][_0xa8019b]['parentKey']&&_0xe4fbcc[_0xce69('0x71')][_0xa8019b]['foreignTable']&&_0xe4fbcc[_0xce69('0x71')][_0xa8019b]['foreignKey']){_0x290c69[_0xe4fbcc['joins'][_0xa8019b]['type']](_0xe4fbcc[_0xce69('0x71')][_0xa8019b]['foreignTable'],null,util[_0xce69('0x6d')](_0xce69('0x76'),_0xe4fbcc[_0xce69('0x69')],_0xe4fbcc[_0xce69('0x71')][_0xa8019b][_0xce69('0x73')],_0xe4fbcc[_0xce69('0x71')][_0xa8019b][_0xce69('0x75')],_0xe4fbcc[_0xce69('0x71')][_0xa8019b][_0xce69('0x74')]));}}}if(_0xe4fbcc[_0xce69('0x77')]){_0xe4fbcc[_0xce69('0x77')]=JSON[_0xce69('0x78')](_0xe4fbcc['conditions']);_0x290c69[_0xce69('0x39')](_0x3182fe(_0xe4fbcc['conditions'][_0xce69('0x61')]));}_0x4da05f=_0x290c69['clone']();_0x290c69['limit'](_0x3ad10f);_0x290c69[_0xce69('0x1c')](0x0);logger[_0xce69('0x7a')](_0xce69('0xa1'),_0x290c69[_0xce69('0x7b')]());return dbH[_0xce69('0x7c')][_0xce69('0x30')](_0x290c69[_0xce69('0x7b')](),{'type':dbH[_0xce69('0x7c')][_0xce69('0x7d')][_0xce69('0x7e')]});}})[_0xce69('0x25')](function(){return{'sql':_0x4da05f[_0xce69('0x7b')]()};})[_0xce69('0x25')](respondWithResult(_0x1236d0,null))[_0xce69('0x45')](handleError(_0x1236d0,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index de5611f..1b25e75 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 _0x3164=['path','../../config/environment','./analyticCustomReport.attributes','define','AnalyticCustomReport','analytics_custom_reports','lodash','util','../../config/logger','api','request-promise'];(function(_0x438c85,_0x559651){var _0x1ab3c8=function(_0x10ed70){while(--_0x10ed70){_0x438c85['push'](_0x438c85['shift']());}};_0x1ab3c8(++_0x559651);}(_0x3164,0x1c9));var _0x4316=function(_0x569d0f,_0x224a07){_0x569d0f=_0x569d0f-0x0;var _0x26d516=_0x3164[_0x569d0f];return _0x26d516;};'use strict';var _=require(_0x4316('0x0'));var util=require(_0x4316('0x1'));var logger=require(_0x4316('0x2'))(_0x4316('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x4316('0x4'));var fs=require('fs');var path=require(_0x4316('0x5'));var rimraf=require('rimraf');var config=require(_0x4316('0x6'));var attributes=require(_0x4316('0x7'));module['exports']=function(_0x34fd79,_0x5e1dfe){return _0x34fd79[_0x4316('0x8')](_0x4316('0x9'),attributes,{'tableName':_0x4316('0xa'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0c61=['bluebird','request-promise','path','../../config/environment','./analyticCustomReport.attributes','define','AnalyticCustomReport','analytics_custom_reports','lodash','util','../../config/logger','api','moment'];(function(_0x30df6a,_0x1c77b8){var _0xad223f=function(_0x565fe2){while(--_0x565fe2){_0x30df6a['push'](_0x30df6a['shift']());}};_0xad223f(++_0x1c77b8);}(_0x0c61,0x7d));var _0x10c6=function(_0x2272b5,_0x362458){_0x2272b5=_0x2272b5-0x0;var _0x110156=_0x0c61[_0x2272b5];return _0x110156;};'use strict';var _=require(_0x10c6('0x0'));var util=require(_0x10c6('0x1'));var logger=require(_0x10c6('0x2'))(_0x10c6('0x3'));var moment=require(_0x10c6('0x4'));var BPromise=require(_0x10c6('0x5'));var rp=require(_0x10c6('0x6'));var fs=require('fs');var path=require(_0x10c6('0x7'));var rimraf=require('rimraf');var config=require(_0x10c6('0x8'));var attributes=require(_0x10c6('0x9'));module['exports']=function(_0x2c59f3,_0x510e57){return _0x2c59f3[_0x10c6('0xa')](_0x10c6('0xb'),attributes,{'tableName':_0x10c6('0xc'),'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 fa72696..7c10c29 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 _0xb515=['rpc','../../config/environment','client','http','request','then','info','request\x20sent','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code','AnalyticCustomReport,\x20%s,\x20%s','message','catch','lodash','util','ioredis','../../config/utils','../../config/logger'];(function(_0x238f15,_0x796bce){var _0x28f0df=function(_0x78ecf3){while(--_0x78ecf3){_0x238f15['push'](_0x238f15['shift']());}};_0x28f0df(++_0x796bce);}(_0xb515,0x113));var _0x5b51=function(_0x42020e,_0x4b92fb){_0x42020e=_0x42020e-0x0;var _0x561551=_0xb515[_0x42020e];return _0x561551;};'use strict';var _=require(_0x5b51('0x0'));var util=require(_0x5b51('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5b51('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x5b51('0x3'));var logger=require(_0x5b51('0x4'))(_0x5b51('0x5'));var config=require(_0x5b51('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x5b51('0x7')][_0x5b51('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1f10fb,_0xfe4953,_0x3c31ac){return new BPromise(function(_0x43fc75,_0x1db2da){return client[_0x5b51('0x9')](_0x1f10fb,_0x3c31ac)[_0x5b51('0xa')](function(_0x23f6fc){logger[_0x5b51('0xb')]('AnalyticCustomReport,\x20%s,\x20%s',_0xfe4953,_0x5b51('0xc'));logger['debug'](_0x5b51('0xd'),_0xfe4953,_0x5b51('0xc'),JSON[_0x5b51('0xe')](_0x23f6fc));if(_0x23f6fc[_0x5b51('0xf')]){if(_0x23f6fc['error'][_0x5b51('0x10')]===0x1f4){logger['error'](_0x5b51('0x11'),_0xfe4953,_0x23f6fc[_0x5b51('0xf')][_0x5b51('0x12')]);return _0x1db2da(_0x23f6fc[_0x5b51('0xf')][_0x5b51('0x12')]);}logger[_0x5b51('0xf')](_0x5b51('0x11'),_0xfe4953,_0x23f6fc[_0x5b51('0xf')]['message']);return _0x43fc75(_0x23f6fc[_0x5b51('0xf')][_0x5b51('0x12')]);}else{logger[_0x5b51('0xb')]('AnalyticCustomReport,\x20%s,\x20%s',_0xfe4953,_0x5b51('0xc'));_0x43fc75(_0x23f6fc['result'][_0x5b51('0x12')]);}})[_0x5b51('0x13')](function(_0x77eec1){logger[_0x5b51('0xf')](_0x5b51('0x11'),_0xfe4953,_0x77eec1);_0x1db2da(_0x77eec1);});});} \ No newline at end of file +var _0x3a32=['info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x494376,_0x1c77a2){var _0x9fd443=function(_0xea6c32){while(--_0xea6c32){_0x494376['push'](_0x494376['shift']());}};_0x9fd443(++_0x1c77a2);}(_0x3a32,0x1c3));var _0x23a3=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0x3a32[_0x4709c0];return _0x13348b;};'use strict';var _=require('lodash');var util=require(_0x23a3('0x0'));var moment=require('moment');var BPromise=require(_0x23a3('0x1'));var rs=require(_0x23a3('0x2'));var fs=require('fs');var Redis=require(_0x23a3('0x3'));var db=require(_0x23a3('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x23a3('0x5'))(_0x23a3('0x6'));var config=require(_0x23a3('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x152402,_0x5a7116,_0x23b7db){return new BPromise(function(_0x5ecad8,_0x503f5c){return client['request'](_0x152402,_0x23b7db)['then'](function(_0x2d4323){logger[_0x23a3('0x8')](_0x23a3('0x9'),_0x5a7116,_0x23a3('0xa'));logger['debug'](_0x23a3('0xb'),_0x5a7116,_0x23a3('0xa'),JSON[_0x23a3('0xc')](_0x2d4323));if(_0x2d4323['error']){if(_0x2d4323[_0x23a3('0xd')]['code']===0x1f4){logger['error'](_0x23a3('0x9'),_0x5a7116,_0x2d4323[_0x23a3('0xd')][_0x23a3('0xe')]);return _0x503f5c(_0x2d4323[_0x23a3('0xd')][_0x23a3('0xe')]);}logger[_0x23a3('0xd')](_0x23a3('0x9'),_0x5a7116,_0x2d4323['error'][_0x23a3('0xe')]);return _0x5ecad8(_0x2d4323[_0x23a3('0xd')]['message']);}else{logger[_0x23a3('0x8')](_0x23a3('0x9'),_0x5a7116,_0x23a3('0xa'));_0x5ecad8(_0x2d4323[_0x23a3('0xf')][_0x23a3('0xe')]);}})[_0x23a3('0x10')](function(_0x54ff50){logger[_0x23a3('0xd')]('AnalyticCustomReport,\x20%s,\x20%s',_0x5a7116,_0x54ff50);_0x503f5c(_0x54ff50);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 6e0e1a2..1e2275c 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 _0x9ce5=['multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','get','isAuthenticated','index','/:id','show','/:id/preview','preview','/:id/run','run','query','post','put','update','delete','destroy','exports'];(function(_0x1b7523,_0x377040){var _0x36356d=function(_0x1869ff){while(--_0x1869ff){_0x1b7523['push'](_0x1b7523['shift']());}};_0x36356d(++_0x377040);}(_0x9ce5,0x108));var _0x59ce=function(_0x47a349,_0x4699d9){_0x47a349=_0x47a349-0x0;var _0x18ab75=_0x9ce5[_0x47a349];return _0x18ab75;};'use strict';var multer=require(_0x59ce('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x59ce('0x1'));var express=require(_0x59ce('0x2'));var router=express[_0x59ce('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x59ce('0x4'));var interaction=require(_0x59ce('0x5'));var config=require(_0x59ce('0x6'));var controller=require(_0x59ce('0x7'));router[_0x59ce('0x8')]('/',auth[_0x59ce('0x9')](),controller[_0x59ce('0xa')]);router[_0x59ce('0x8')](_0x59ce('0xb'),auth[_0x59ce('0x9')](),controller[_0x59ce('0xc')]);router[_0x59ce('0x8')](_0x59ce('0xd'),auth[_0x59ce('0x9')](),controller[_0x59ce('0xe')]);router[_0x59ce('0x8')](_0x59ce('0xf'),auth[_0x59ce('0x9')](),controller[_0x59ce('0x10')]);router[_0x59ce('0x8')]('/:id/query',auth[_0x59ce('0x9')](),controller[_0x59ce('0x11')]);router[_0x59ce('0x12')]('/',auth[_0x59ce('0x9')](),controller['create']);router[_0x59ce('0x13')]('/:id',auth[_0x59ce('0x9')](),controller[_0x59ce('0x14')]);router[_0x59ce('0x15')](_0x59ce('0xb'),auth[_0x59ce('0x9')](),controller[_0x59ce('0x16')]);module[_0x59ce('0x17')]=router; \ No newline at end of file +var _0x8828=['run','query','create','put','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','preview','/:id/run'];(function(_0x3edbf7,_0x5a0b17){var _0x42022c=function(_0x3883ed){while(--_0x3883ed){_0x3edbf7['push'](_0x3edbf7['shift']());}};_0x42022c(++_0x5a0b17);}(_0x8828,0xce));var _0x8882=function(_0x537942,_0x14347a){_0x537942=_0x537942-0x0;var _0x54d3c3=_0x8828[_0x537942];return _0x54d3c3;};'use strict';var multer=require(_0x8882('0x0'));var util=require(_0x8882('0x1'));var path=require(_0x8882('0x2'));var timeout=require('connect-timeout');var express=require(_0x8882('0x3'));var router=express[_0x8882('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x8882('0x5'));var interaction=require(_0x8882('0x6'));var config=require(_0x8882('0x7'));var controller=require('./analyticCustomReport.controller');router[_0x8882('0x8')]('/',auth['isAuthenticated'](),controller[_0x8882('0x9')]);router[_0x8882('0x8')](_0x8882('0xa'),auth[_0x8882('0xb')](),controller['show']);router[_0x8882('0x8')]('/:id/preview',auth['isAuthenticated'](),controller[_0x8882('0xc')]);router[_0x8882('0x8')](_0x8882('0xd'),auth['isAuthenticated'](),controller[_0x8882('0xe')]);router[_0x8882('0x8')]('/:id/query',auth[_0x8882('0xb')](),controller[_0x8882('0xf')]);router['post']('/',auth[_0x8882('0xb')](),controller[_0x8882('0x10')]);router[_0x8882('0x11')](_0x8882('0xa'),auth[_0x8882('0xb')](),controller[_0x8882('0x12')]);router[_0x8882('0x13')](_0x8882('0xa'),auth[_0x8882('0xb')](),controller[_0x8882('0x14')]);module[_0x8882('0x15')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index a8d1d1a..d6ec48d 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 _0x7dfd=['STRING','TEXT','sequelize','exports'];(function(_0x5d02ed,_0x4e5140){var _0x4bbd14=function(_0x271c29){while(--_0x271c29){_0x5d02ed['push'](_0x5d02ed['shift']());}};_0x4bbd14(++_0x4e5140);}(_0x7dfd,0x1c2));var _0xd7df=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7dfd[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xd7df('0x0'));module[_0xd7df('0x1')]={'name':{'type':Sequelize[_0xd7df('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xd7df('0x2')]},'parent':{'type':Sequelize[_0xd7df('0x2')]},'table':{'type':Sequelize[_0xd7df('0x2')]},'conditions':{'type':Sequelize[_0xd7df('0x3')]},'joins':{'type':Sequelize[_0xd7df('0x3')]}}; \ No newline at end of file +var _0xac9d=['TEXT','sequelize','exports','STRING'];(function(_0x5864d2,_0x42a789){var _0x410a6f=function(_0x171e64){while(--_0x171e64){_0x5864d2['push'](_0x5864d2['shift']());}};_0x410a6f(++_0x42a789);}(_0xac9d,0x14d));var _0xdac9=function(_0x15cdcb,_0x4340e9){_0x15cdcb=_0x15cdcb-0x0;var _0x37b069=_0xac9d[_0x15cdcb];return _0x37b069;};'use strict';var Sequelize=require(_0xdac9('0x0'));module[_0xdac9('0x1')]={'name':{'type':Sequelize[_0xdac9('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xdac9('0x2')]},'parent':{'type':Sequelize[_0xdac9('0x2')]},'table':{'type':Sequelize[_0xdac9('0x2')]},'conditions':{'type':Sequelize[_0xdac9('0x3')]},'joins':{'type':Sequelize[_0xdac9('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index 2531d52..4b4e2e7 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 _0xba34=['save','then','destroy','get','DefaultReports','UserProfileResource','error','name','send','index','map','AnalyticDefaultReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','VIRTUAL','merge','options','includeAll','include','findAll','show','params','find','create','body','user','role','UserProfileSection','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','preview','join','left_join','right_join','cross_join','SUM(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','getFields','Sequelize','ValidationErrorItem','keyBy','select','from','table','MetricId','metric','function','replace','format','groupBy','orderBy','DESC','alias','joins','parse','parentKey','foreignKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','clone','debug','Limited\x20Query:','toString','sequelize','SELECT','COUNT(%s)','AVG(%s)','IS\x20NOT\x20NULL','value','order','output','%s-%s.%s','randomstring','generate','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','endDate','startDate','info','Run\x20Query:','fork','countTable','QueryTypes','runReport','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','ROUND(%s)','Please\x20insert\x20at\x20least\x20one\x20field','eml-format','rimraf','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/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject'];(function(_0x453036,_0x521770){var _0x203aa2=function(_0x2d383a){while(--_0x2d383a){_0x453036['push'](_0x453036['shift']());}};_0x203aa2(++_0x521770);}(_0xba34,0x119));var _0x4ba3=function(_0xb80ab0,_0x4545ea){_0xb80ab0=_0xb80ab0-0x0;var _0x5c2cd9=_0xba34[_0xb80ab0];return _0x5c2cd9;};'use strict';var emlformat=require(_0x4ba3('0x0'));var rimraf=require(_0x4ba3('0x1'));var zipdir=require(_0x4ba3('0x2'));var jsonpatch=require(_0x4ba3('0x3'));var rp=require(_0x4ba3('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x4ba3('0x5'));var path=require(_0x4ba3('0x6'));var sox=require(_0x4ba3('0x7'));var csv=require(_0x4ba3('0x8'));var ejs=require(_0x4ba3('0x9'));var fs=require('fs');var fs_extra=require(_0x4ba3('0xa'));var _=require(_0x4ba3('0xb'));var squel=require('squel');var crypto=require(_0x4ba3('0xc'));var jsforce=require(_0x4ba3('0xd'));var deskjs=require(_0x4ba3('0xe'));var toCsv=require(_0x4ba3('0x8'));var querystring=require(_0x4ba3('0xf'));var Papa=require(_0x4ba3('0x10'));var Redis=require(_0x4ba3('0x11'));var authService=require(_0x4ba3('0x12'));var qs=require(_0x4ba3('0x13'));var as=require(_0x4ba3('0x14'));var hardwareService=require(_0x4ba3('0x15'));var logger=require('../../config/logger')(_0x4ba3('0x16'));var utils=require(_0x4ba3('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x4ba3('0x18'));var db=require('../../mysqldb')['db'];var dbH=require(_0x4ba3('0x19'))['dbH'];function respondWithStatusCode(_0x256f02,_0x4419b4){_0x4419b4=_0x4419b4||0xcc;return function(_0x29e498){if(_0x29e498){return _0x256f02[_0x4ba3('0x1a')](_0x4419b4);}return _0x256f02[_0x4ba3('0x1b')](_0x4419b4)[_0x4ba3('0x1c')]();};}function respondWithResult(_0x3a74f7,_0x12ac90){_0x12ac90=_0x12ac90||0xc8;return function(_0x1dec48){if(_0x1dec48){return _0x3a74f7[_0x4ba3('0x1b')](_0x12ac90)[_0x4ba3('0x1d')](_0x1dec48);}};}function respondWithFilteredResult(_0x301359,_0x29a9d1){return function(_0x25f584){if(_0x25f584){var _0x40e75b=typeof _0x29a9d1[_0x4ba3('0x1e')]==='undefined'&&typeof _0x29a9d1[_0x4ba3('0x1f')]===_0x4ba3('0x20');var _0x5ff7ce=_0x25f584[_0x4ba3('0x21')];var _0x556290=_0x40e75b?0x0:_0x29a9d1[_0x4ba3('0x1e')];var _0xe4eff9=_0x40e75b?_0x25f584[_0x4ba3('0x21')]:_0x29a9d1[_0x4ba3('0x1e')]+_0x29a9d1[_0x4ba3('0x1f')];var _0x125944;if(_0xe4eff9>=_0x5ff7ce){_0xe4eff9=_0x5ff7ce;_0x125944=0xc8;}else{_0x125944=0xce;}_0x301359['status'](_0x125944);return _0x301359['set'](_0x4ba3('0x22'),_0x556290+'-'+_0xe4eff9+'/'+_0x5ff7ce)['json'](_0x25f584);}return null;};}function patchUpdates(_0x18dff5){return function(_0x163967){try{jsonpatch[_0x4ba3('0x23')](_0x163967,_0x18dff5,!![]);}catch(_0xbc7023){return BPromise[_0x4ba3('0x24')](_0xbc7023);}return _0x163967[_0x4ba3('0x25')]();};}function saveUpdates(_0x4a0823,_0x143c78){return function(_0x1f87e1){if(_0x1f87e1){return _0x1f87e1['update'](_0x4a0823)[_0x4ba3('0x26')](function(_0x4ffe39){return _0x4ffe39;});}return null;};}function removeEntity(_0x1ae4de,_0x18abb3){return function(_0x11a917){if(_0x11a917){return _0x11a917[_0x4ba3('0x27')]()[_0x4ba3('0x26')](function(){var _0xe29a49=_0x11a917[_0x4ba3('0x28')]({'plain':!![]});var _0xe1f7d2=_0x4ba3('0x29');return db[_0x4ba3('0x2a')]['destroy']({'where':{'type':_0xe1f7d2,'resourceId':_0xe29a49['id']}})[_0x4ba3('0x26')](function(){return _0x11a917;});})[_0x4ba3('0x26')](function(){_0x1ae4de[_0x4ba3('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x10537e,_0x1fe5e2){return function(_0x44d78c){if(!_0x44d78c){_0x10537e['sendStatus'](0x194);}return _0x44d78c;};}function handleError(_0x10cae6,_0x843276){_0x843276=_0x843276||0x1f4;return function(_0x34ecb4){logger[_0x4ba3('0x2b')](_0x34ecb4['stack']);if(_0x34ecb4['name']){delete _0x34ecb4[_0x4ba3('0x2c')];}_0x10cae6[_0x4ba3('0x1b')](_0x843276)[_0x4ba3('0x2d')](_0x34ecb4);};}exports[_0x4ba3('0x2e')]=function(_0x2cb5d5,_0x11f88f){var _0x48b3b7={},_0x27444b={},_0x28f36c={'count':0x0,'rows':[]};var _0x24d8fc=_[_0x4ba3('0x2f')](db[_0x4ba3('0x30')][_0x4ba3('0x31')],function(_0x457236){return{'name':_0x457236[_0x4ba3('0x32')],'type':_0x457236[_0x4ba3('0x33')][_0x4ba3('0x34')]};});_0x27444b['model']=_['map'](_0x24d8fc,'name');_0x27444b[_0x4ba3('0x35')]=_[_0x4ba3('0x36')](_0x2cb5d5[_0x4ba3('0x35')]);_0x27444b[_0x4ba3('0x37')]=_[_0x4ba3('0x38')](_0x27444b[_0x4ba3('0x39')],_0x27444b[_0x4ba3('0x35')]);_0x48b3b7[_0x4ba3('0x3a')]=_[_0x4ba3('0x38')](_0x27444b[_0x4ba3('0x39')],qs[_0x4ba3('0x3b')](_0x2cb5d5[_0x4ba3('0x35')]['fields']));_0x48b3b7[_0x4ba3('0x3a')]=_0x48b3b7[_0x4ba3('0x3a')][_0x4ba3('0x3c')]?_0x48b3b7['attributes']:_0x27444b[_0x4ba3('0x39')];if(!_0x2cb5d5['query'][_0x4ba3('0x3d')](_0x4ba3('0x3e'))){_0x48b3b7[_0x4ba3('0x1f')]=qs[_0x4ba3('0x1f')](_0x2cb5d5[_0x4ba3('0x35')][_0x4ba3('0x1f')]);_0x48b3b7['offset']=qs[_0x4ba3('0x1e')](_0x2cb5d5[_0x4ba3('0x35')][_0x4ba3('0x1e')]);}_0x48b3b7['order']=qs[_0x4ba3('0x3f')](_0x2cb5d5[_0x4ba3('0x35')]['sort']);_0x48b3b7[_0x4ba3('0x40')]=qs['filters'](_['pick'](_0x2cb5d5[_0x4ba3('0x35')],_0x27444b[_0x4ba3('0x37')]),_0x24d8fc);if(_0x2cb5d5[_0x4ba3('0x35')][_0x4ba3('0x41')]){_0x48b3b7[_0x4ba3('0x40')]=_['merge'](_0x48b3b7[_0x4ba3('0x40')],{'$or':_[_0x4ba3('0x2f')](_0x24d8fc,function(_0x46d2ca){if(_0x46d2ca[_0x4ba3('0x33')]!==_0x4ba3('0x42')){var _0x2acc92={};_0x2acc92[_0x46d2ca[_0x4ba3('0x2c')]]={'$like':'%'+_0x2cb5d5[_0x4ba3('0x35')]['filter']+'%'};return _0x2acc92;}})});}_0x48b3b7=_[_0x4ba3('0x43')]({},_0x48b3b7,_0x2cb5d5[_0x4ba3('0x44')]);var _0x3cb07f={'where':_0x48b3b7[_0x4ba3('0x40')]};return db[_0x4ba3('0x30')][_0x4ba3('0x21')](_0x3cb07f)[_0x4ba3('0x26')](function(_0xdcc2a2){_0x28f36c[_0x4ba3('0x21')]=_0xdcc2a2;if(_0x2cb5d5[_0x4ba3('0x35')][_0x4ba3('0x45')]){_0x48b3b7[_0x4ba3('0x46')]=[{'all':!![]}];}return db[_0x4ba3('0x30')][_0x4ba3('0x47')](_0x48b3b7);})['then'](function(_0x5af671){_0x28f36c['rows']=_0x5af671;return _0x28f36c;})['then'](respondWithFilteredResult(_0x11f88f,_0x48b3b7))['catch'](handleError(_0x11f88f,null));};exports[_0x4ba3('0x48')]=function(_0x5c4659,_0x29e74d){var _0x5567c7={'raw':!![],'where':{'id':_0x5c4659[_0x4ba3('0x49')]['id']}},_0x53d6eb={};_0x53d6eb[_0x4ba3('0x39')]=_[_0x4ba3('0x36')](db[_0x4ba3('0x30')]['rawAttributes']);_0x53d6eb[_0x4ba3('0x35')]=_['keys'](_0x5c4659[_0x4ba3('0x35')]);_0x53d6eb['filters']=_[_0x4ba3('0x38')](_0x53d6eb[_0x4ba3('0x39')],_0x53d6eb[_0x4ba3('0x35')]);_0x5567c7[_0x4ba3('0x3a')]=_[_0x4ba3('0x38')](_0x53d6eb[_0x4ba3('0x39')],qs[_0x4ba3('0x3b')](_0x5c4659['query'][_0x4ba3('0x3b')]));_0x5567c7[_0x4ba3('0x3a')]=_0x5567c7[_0x4ba3('0x3a')][_0x4ba3('0x3c')]?_0x5567c7[_0x4ba3('0x3a')]:_0x53d6eb['model'];if(_0x5c4659['query'][_0x4ba3('0x45')]){_0x5567c7[_0x4ba3('0x46')]=[{'all':!![]}];}_0x5567c7=_[_0x4ba3('0x43')]({},_0x5567c7,_0x5c4659['options']);return db[_0x4ba3('0x30')][_0x4ba3('0x4a')](_0x5567c7)[_0x4ba3('0x26')](handleEntityNotFound(_0x29e74d,null))['then'](respondWithResult(_0x29e74d,null))['catch'](handleError(_0x29e74d,null));};exports[_0x4ba3('0x4b')]=function(_0x482a83,_0x439acf){return db[_0x4ba3('0x30')][_0x4ba3('0x4b')](_0x482a83[_0x4ba3('0x4c')],{})[_0x4ba3('0x26')](function(_0x213eb0){var _0x590739=_0x482a83[_0x4ba3('0x4d')][_0x4ba3('0x28')]({'plain':!![]});if(!_0x590739)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x590739[_0x4ba3('0x4e')]===_0x4ba3('0x4d')){var _0x156c2d=_0x213eb0[_0x4ba3('0x28')]({'plain':!![]});var _0x360472='Reports';return db[_0x4ba3('0x4f')][_0x4ba3('0x4a')]({'where':{'name':_0x360472,'userProfileId':_0x590739['userProfileId']},'raw':!![]})[_0x4ba3('0x26')](function(_0x19d70f){if(_0x19d70f&&_0x19d70f[_0x4ba3('0x50')]===0x0){return db[_0x4ba3('0x2a')][_0x4ba3('0x4b')]({'name':_0x156c2d[_0x4ba3('0x2c')],'resourceId':_0x156c2d['id'],'type':_0x4ba3('0x29'),'sectionId':_0x19d70f['id']},{})[_0x4ba3('0x26')](function(){return _0x213eb0;});}else{return _0x213eb0;}})[_0x4ba3('0x51')](function(_0x428a27){logger[_0x4ba3('0x2b')](_0x4ba3('0x52'),_0x428a27);throw _0x428a27;});}return _0x213eb0;})[_0x4ba3('0x26')](respondWithResult(_0x439acf,0xc9))[_0x4ba3('0x51')](handleError(_0x439acf,null));};exports[_0x4ba3('0x53')]=function(_0x48a3d4,_0x5e7ed5){if(_0x48a3d4['body']['id']){delete _0x48a3d4[_0x4ba3('0x4c')]['id'];}return db[_0x4ba3('0x30')][_0x4ba3('0x4a')]({'where':{'id':_0x48a3d4[_0x4ba3('0x49')]['id']}})[_0x4ba3('0x26')](handleEntityNotFound(_0x5e7ed5,null))['then'](saveUpdates(_0x48a3d4[_0x4ba3('0x4c')],null))[_0x4ba3('0x26')](respondWithResult(_0x5e7ed5,null))[_0x4ba3('0x51')](handleError(_0x5e7ed5,null));};exports[_0x4ba3('0x27')]=function(_0x5359d1,_0x1e83fb){return db[_0x4ba3('0x30')][_0x4ba3('0x4a')]({'where':{'id':_0x5359d1[_0x4ba3('0x49')]['id']}})[_0x4ba3('0x26')](handleEntityNotFound(_0x1e83fb,null))[_0x4ba3('0x26')](removeEntity(_0x1e83fb,null))[_0x4ba3('0x51')](handleError(_0x1e83fb,null));};exports[_0x4ba3('0x54')]=function(_0x328314,_0x4fa64d){var _0x20c849=0xa;var _0x42bb4b=[_0x4ba3('0x55'),_0x4ba3('0x56'),_0x4ba3('0x57'),_0x4ba3('0x58')];var _0x40827a={'SUM':_0x4ba3('0x59'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x4ba3('0x5a'),'MAX':_0x4ba3('0x5b'),'MIN':_0x4ba3('0x5c'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x4ba3('0x5d'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x4ba3('0x5e')};var _0x4cc10a={'SEC_TO_TIME':_0x4ba3('0x5f'),'DATE':_0x4ba3('0x60'),'HOUR':_0x4ba3('0x61'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x4ba3('0x62')};var _0xaef1b=function(_0x2a48fe){return!_[_0x4ba3('0x63')]([_0x4ba3('0x64'),'IS\x20NOT\x20NULL',_0x4ba3('0x65'),_0x4ba3('0x66')],_0x2a48fe);};var _0x34cc21=function(_0x469ef0){if(!_0x469ef0||!_0x469ef0[_0x4ba3('0x67')][_0x4ba3('0x3c')]){return'';}for(var _0x3fdf7f='(',_0x38699e=0x0;_0x38699e<_0x469ef0[_0x4ba3('0x67')][_0x4ba3('0x3c')];_0x38699e+=0x1){_0x38699e>0x0&&(_0x3fdf7f+='\x20'+_0x469ef0[_0x4ba3('0x68')]+'\x20');_0x3fdf7f+=_0x469ef0['rules'][_0x38699e][_0x4ba3('0x69')]?_0x34cc21(_0x469ef0[_0x4ba3('0x67')][_0x38699e]['group']):_0x469ef0['rules'][_0x38699e][_0x4ba3('0x6a')]+'\x20'+_0x469ef0[_0x4ba3('0x67')][_0x38699e]['condition']+(_0xaef1b(_0x469ef0[_0x4ba3('0x67')][_0x38699e][_0x4ba3('0x6b')])?'\x20'+_0x469ef0[_0x4ba3('0x67')][_0x38699e]['value']:'');}return _0x3fdf7f+')';};var _0x1f5815={'where':{'id':_0x328314['params']['id']}},_0x46224,_0x1af489,_0x11209b,_0x24a75a,_0x3a4838;_0x1f5815=_[_0x4ba3('0x43')]({},_0x1f5815,_0x328314[_0x4ba3('0x44')]);return db[_0x4ba3('0x30')]['find'](_0x1f5815)[_0x4ba3('0x26')](function(_0x2f8bcc){if(_0x2f8bcc){_0x46224=_0x2f8bcc;return _0x2f8bcc[_0x4ba3('0x6c')]();}return null;})[_0x4ba3('0x26')](function(_0x21c8b1){if(_0x21c8b1){if(!_0x21c8b1[_0x4ba3('0x3c')]){throw new db[(_0x4ba3('0x6d'))][(_0x4ba3('0x6e'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x1af489=_0x21c8b1;return db['AnalyticMetric'][_0x4ba3('0x47')]({'raw':!![]});}return null;})['then'](function(_0x13ee2c){if(_0x13ee2c){_0x11209b=_[_0x4ba3('0x6f')](_0x13ee2c,'id');var _0x442d66;var _0x5c7fc2=squel[_0x4ba3('0x70')]();_0x5c7fc2[_0x4ba3('0x71')](_0x46224[_0x4ba3('0x72')]);for(var _0x5baf26=0x0;_0x5baf26<_0x1af489[_0x4ba3('0x3c')];_0x5baf26+=0x1){_0x442d66=_0x1af489[_0x5baf26]['MetricId']?_0x11209b[_0x1af489[_0x5baf26][_0x4ba3('0x73')]][_0x4ba3('0x74')]:_0x1af489[_0x5baf26]['field'];_0x442d66=_0x1af489[_0x5baf26][_0x4ba3('0x75')]?_[_0x4ba3('0x76')](_0x40827a[_0x1af489[_0x5baf26][_0x4ba3('0x75')]],'%s',_0x442d66):_0x442d66;_0x442d66=_0x1af489[_0x5baf26][_0x4ba3('0x77')]?_[_0x4ba3('0x76')](_0x4cc10a[_0x1af489[_0x5baf26][_0x4ba3('0x77')]],'%s',_0x442d66):_0x442d66;if(_0x1af489[_0x5baf26][_0x4ba3('0x78')]){_0x5c7fc2[_0x4ba3('0x69')](_0x442d66);}_0x1af489[_0x5baf26][_0x4ba3('0x79')]&&_0x5c7fc2['order'](_0x442d66,_0x1af489[_0x5baf26][_0x4ba3('0x79')]===_0x4ba3('0x7a')?![]:!![]);_0x5c7fc2[_0x4ba3('0x6a')](_0x442d66,_0x1af489[_0x5baf26][_0x4ba3('0x7b')]||_0x442d66);}if(_0x46224[_0x4ba3('0x7c')]){_0x46224[_0x4ba3('0x7c')]=JSON[_0x4ba3('0x7d')](_0x46224[_0x4ba3('0x7c')]);for(var _0x365d94=0x0;_0x365d94<_0x46224[_0x4ba3('0x7c')][_0x4ba3('0x3c')];_0x365d94+=0x1){if(_0x46224[_0x4ba3('0x7c')][_0x365d94]['type']&&_[_0x4ba3('0x63')](_0x42bb4b,_0x46224[_0x4ba3('0x7c')][_0x365d94]['type'])&&_0x46224[_0x4ba3('0x7c')][_0x365d94][_0x4ba3('0x7e')]&&_0x46224['joins'][_0x365d94]['foreignTable']&&_0x46224[_0x4ba3('0x7c')][_0x365d94][_0x4ba3('0x7f')]){_0x5c7fc2[_0x46224[_0x4ba3('0x7c')][_0x365d94][_0x4ba3('0x33')]](_0x46224[_0x4ba3('0x7c')][_0x365d94][_0x4ba3('0x80')],null,util[_0x4ba3('0x77')](_0x4ba3('0x81'),_0x46224['table'],_0x46224[_0x4ba3('0x7c')][_0x365d94]['parentKey'],_0x46224[_0x4ba3('0x7c')][_0x365d94][_0x4ba3('0x80')],_0x46224[_0x4ba3('0x7c')][_0x365d94][_0x4ba3('0x7f')]));}}}if(_0x46224[_0x4ba3('0x82')]){_0x46224[_0x4ba3('0x82')]=JSON[_0x4ba3('0x7d')](_0x46224[_0x4ba3('0x82')]);_0x5c7fc2['where'](_0x34cc21(_0x46224[_0x4ba3('0x82')][_0x4ba3('0x69')]));}_0x3a4838=_0x5c7fc2[_0x4ba3('0x83')]();_0x5c7fc2['limit'](_0x20c849);_0x5c7fc2[_0x4ba3('0x1e')](0x0);logger[_0x4ba3('0x84')](_0x4ba3('0x85'),_0x5c7fc2[_0x4ba3('0x86')]());return dbH[_0x4ba3('0x87')][_0x4ba3('0x35')](_0x5c7fc2[_0x4ba3('0x86')](),{'type':dbH['sequelize']['QueryTypes'][_0x4ba3('0x88')]});}})['then'](respondWithResult(_0x4fa64d,null))[_0x4ba3('0x51')](handleError(_0x4fa64d,null));};function runReport(_0x15508f,_0x108679,_0x20f7db){var _0x5a3c63=_0x108679['name'];var _0x2d16e5=0xa;var _0x2b2132=['join',_0x4ba3('0x56'),_0x4ba3('0x57'),_0x4ba3('0x58')];var _0x1e8232={'SUM':_0x4ba3('0x59'),'COUNT':_0x4ba3('0x89'),'COUNT DISTINCT':_0x4ba3('0x5a'),'MAX':'MAX(%s)','MIN':_0x4ba3('0x5c'),'AVG':_0x4ba3('0x8a'),'GROUP_CONCAT':_0x4ba3('0x5d'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x4ba3('0x5e')};var _0x13dbc4={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x4ba3('0x60'),'HOUR':_0x4ba3('0x61'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x5aa412=function(_0x4ec70e){return!_[_0x4ba3('0x63')]([_0x4ba3('0x64'),_0x4ba3('0x8b'),_0x4ba3('0x65'),_0x4ba3('0x66')],_0x4ec70e);};var _0x333a97=function(_0x30d7a9){if(!_0x30d7a9||!_0x30d7a9['rules'][_0x4ba3('0x3c')]){return'';}for(var _0x4cd4a2='(',_0x31a725=0x0;_0x31a725<_0x30d7a9['rules'][_0x4ba3('0x3c')];_0x31a725+=0x1){_0x31a725>0x0&&(_0x4cd4a2+='\x20'+_0x30d7a9[_0x4ba3('0x68')]+'\x20');_0x4cd4a2+=_0x30d7a9[_0x4ba3('0x67')][_0x31a725][_0x4ba3('0x69')]?_0x333a97(_0x30d7a9[_0x4ba3('0x67')][_0x31a725]['group']):_0x30d7a9['rules'][_0x31a725][_0x4ba3('0x6a')]+'\x20'+_0x30d7a9[_0x4ba3('0x67')][_0x31a725][_0x4ba3('0x6b')]+(_0x5aa412(_0x30d7a9[_0x4ba3('0x67')][_0x31a725][_0x4ba3('0x6b')])?'\x20'+_0x30d7a9[_0x4ba3('0x67')][_0x31a725][_0x4ba3('0x8c')]:'');}return _0x4cd4a2+')';};var _0x3d8606={'where':{'id':_0x15508f['id']}},_0x2d00e3,_0x35441e,_0x217ea4,_0x40dcee,_0x5ea9d0;_0x3d8606=_[_0x4ba3('0x43')]({},_0x3d8606,_0x20f7db);return db['AnalyticDefaultReport'][_0x4ba3('0x4a')](_0x3d8606)[_0x4ba3('0x26')](function(_0x17b970){if(_0x17b970){_0x2d00e3=_0x17b970;return _0x17b970[_0x4ba3('0x6c')]();}return null;})['then'](function(_0x2a2dc2){if(_0x2a2dc2){if(!_0x2a2dc2[_0x4ba3('0x3c')]){throw new db[(_0x4ba3('0x6d'))][(_0x4ba3('0x6e'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x35441e=_0x2a2dc2;return db['AnalyticMetric'][_0x4ba3('0x47')]({'raw':!![]});}return null;})[_0x4ba3('0x26')](function(_0x3188c8){if(_0x3188c8){_0x217ea4=_['keyBy'](_0x3188c8,'id');var _0x2f793a;var _0x1194a5=squel[_0x4ba3('0x70')]();_0x1194a5[_0x4ba3('0x71')](_0x2d00e3[_0x4ba3('0x72')]);for(var _0x1e2134=0x0;_0x1e2134<_0x35441e['length'];_0x1e2134+=0x1){_0x2f793a=_0x35441e[_0x1e2134][_0x4ba3('0x73')]?_0x217ea4[_0x35441e[_0x1e2134]['MetricId']][_0x4ba3('0x74')]:_0x35441e[_0x1e2134][_0x4ba3('0x6a')];_0x2f793a=_0x35441e[_0x1e2134][_0x4ba3('0x75')]?_[_0x4ba3('0x76')](_0x1e8232[_0x35441e[_0x1e2134]['function']],'%s',_0x2f793a):_0x2f793a;_0x2f793a=_0x35441e[_0x1e2134][_0x4ba3('0x77')]?_[_0x4ba3('0x76')](_0x13dbc4[_0x35441e[_0x1e2134]['format']],'%s',_0x2f793a):_0x2f793a;if(_0x35441e[_0x1e2134][_0x4ba3('0x78')]){_0x1194a5['group'](_0x2f793a);}_0x35441e[_0x1e2134][_0x4ba3('0x79')]&&_0x1194a5[_0x4ba3('0x8d')](_0x2f793a,_0x35441e[_0x1e2134][_0x4ba3('0x79')]===_0x4ba3('0x7a')?![]:!![]);_0x1194a5[_0x4ba3('0x6a')](_0x2f793a,_0x35441e[_0x1e2134]['alias']||_0x2f793a);}if(_0x2d00e3['joins']){_0x2d00e3[_0x4ba3('0x7c')]=JSON[_0x4ba3('0x7d')](_0x2d00e3[_0x4ba3('0x7c')]);for(var _0x56244e=0x0;_0x56244e<_0x2d00e3[_0x4ba3('0x7c')][_0x4ba3('0x3c')];_0x56244e+=0x1){if(_0x2d00e3['joins'][_0x56244e][_0x4ba3('0x33')]&&_[_0x4ba3('0x63')](_0x2b2132,_0x2d00e3[_0x4ba3('0x7c')][_0x56244e][_0x4ba3('0x33')])&&_0x2d00e3[_0x4ba3('0x7c')][_0x56244e][_0x4ba3('0x7e')]&&_0x2d00e3[_0x4ba3('0x7c')][_0x56244e][_0x4ba3('0x80')]&&_0x2d00e3['joins'][_0x56244e][_0x4ba3('0x7f')]){_0x1194a5[_0x2d00e3[_0x4ba3('0x7c')][_0x56244e][_0x4ba3('0x33')]](_0x2d00e3[_0x4ba3('0x7c')][_0x56244e][_0x4ba3('0x80')],null,util[_0x4ba3('0x77')](_0x4ba3('0x81'),_0x2d00e3[_0x4ba3('0x72')],_0x2d00e3[_0x4ba3('0x7c')][_0x56244e][_0x4ba3('0x7e')],_0x2d00e3[_0x4ba3('0x7c')][_0x56244e][_0x4ba3('0x80')],_0x2d00e3[_0x4ba3('0x7c')][_0x56244e]['foreignKey']));}}}if(_0x2d00e3['conditions']){_0x2d00e3[_0x4ba3('0x82')]=JSON[_0x4ba3('0x7d')](_0x2d00e3[_0x4ba3('0x82')]);_0x1194a5[_0x4ba3('0x40')](_0x333a97(_0x2d00e3[_0x4ba3('0x82')][_0x4ba3('0x69')]));}_0x5ea9d0=_0x1194a5[_0x4ba3('0x83')]();_0x1194a5['limit'](_0x2d16e5);_0x1194a5['offset'](0x0);return;}})[_0x4ba3('0x26')](function(){if(_0x108679[_0x4ba3('0x8e')]==='web'){return null;}var _0x4fb6b5=_['merge'](_0x108679,{'name':_0x108679['fullPath']||_0x108679[_0x4ba3('0x2c')]||_0x2d00e3[_0x4ba3('0x2c')],'basename':_0x5a3c63,'savename':util[_0x4ba3('0x77')](_0x4ba3('0x8f'),_0x108679[_0x4ba3('0x2c')]||_0x2d00e3['name'],require(_0x4ba3('0x90'))[_0x4ba3('0x91')](0x4),_0x108679[_0x4ba3('0x8e')]||'csv'),'reportId':_0x2d00e3['id'],'reportType':'default'});return db['AnalyticExtractedReport']['create'](_0x4fb6b5,{'raw':!![]});})[_0x4ba3('0x26')](function(_0x17d501){if(_0x2d00e3[_0x4ba3('0x72')]===_0x4ba3('0x92')){_0x5ea9d0[_0x4ba3('0x40')](_0x2d00e3['table']+_0x4ba3('0x93'),_0x108679['startDate'],_0x108679[_0x4ba3('0x94')]);}else{_0x5ea9d0[_0x4ba3('0x40')](_0x2d00e3[_0x4ba3('0x72')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x108679[_0x4ba3('0x95')],_0x108679[_0x4ba3('0x94')]);}if(_0x17d501){logger[_0x4ba3('0x96')](_0x4ba3('0x97'),_0x5ea9d0['toString']());require('child_process')[_0x4ba3('0x98')](path[_0x4ba3('0x55')](__dirname,'../../components/export/',_0x17d501[_0x4ba3('0x8e')]),[_0x17d501['id'],_0x5ea9d0['toString'](),path['join'](__dirname,'../../files/reports',_0x17d501['savename']),_0x5a3c63]);return _0x17d501;}else{var _0x2d2ca3=squel[_0x4ba3('0x70')]();_0x2d2ca3[_0x4ba3('0x71')]('('+_0x5ea9d0[_0x4ba3('0x86')]()+')',_0x4ba3('0x99'));_0x2d2ca3['field']('COUNT(*)',_0x4ba3('0x21'));_0x5ea9d0['limit'](_0x108679[_0x4ba3('0x1f')]||_0x2d16e5);_0x5ea9d0[_0x4ba3('0x1e')](_0x108679[_0x4ba3('0x1e')]||0x0);return dbH['sequelize'][_0x4ba3('0x35')](_0x2d2ca3[_0x4ba3('0x86')](),{'type':dbH[_0x4ba3('0x87')][_0x4ba3('0x9a')][_0x4ba3('0x88')]})[_0x4ba3('0x26')](function(_0xc938c){if(!_0xc938c[_0x4ba3('0x3c')]){_0x40dcee=0x0;}else{_0x40dcee=_0xc938c[0x0][_0x4ba3('0x21')]||0x0;}return dbH['sequelize']['query'](_0x5ea9d0[_0x4ba3('0x86')](),{'type':dbH[_0x4ba3('0x87')][_0x4ba3('0x9a')][_0x4ba3('0x88')]});})[_0x4ba3('0x26')](function(_0xd97c26){return{'rows':_0xd97c26||[],'count':_0x40dcee};});}});}exports['run']=function(_0x1fbdc7,_0x9e45ec){return runReport(_0x1fbdc7['params'],_0x1fbdc7[_0x4ba3('0x35')],_0x1fbdc7[_0x4ba3('0x44')])[_0x4ba3('0x26')](respondWithResult(_0x9e45ec,null))[_0x4ba3('0x51')](handleError(_0x9e45ec,null));};exports[_0x4ba3('0x9b')]=runReport;exports[_0x4ba3('0x35')]=function(_0xddfb0c,_0x41c531){var _0x25bf75=0xa;var _0x18bd77=[_0x4ba3('0x55'),_0x4ba3('0x56'),_0x4ba3('0x57'),_0x4ba3('0x58')];var _0x2e812b={'SUM':'SUM(%s)','COUNT':_0x4ba3('0x89'),'COUNT DISTINCT':_0x4ba3('0x5a'),'MAX':'MAX(%s)','MIN':_0x4ba3('0x5c'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x4ba3('0x5d'),'GROUP_CONCAT ASC':_0x4ba3('0x9c'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x5dc74f={'SEC_TO_TIME':_0x4ba3('0x5f'),'DATE':'DATE(%s)','HOUR':_0x4ba3('0x61'),'ROUND':_0x4ba3('0x9d'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x1590f0=function(_0x5efab9){return!_[_0x4ba3('0x63')]([_0x4ba3('0x64'),_0x4ba3('0x8b'),'IS\x20EMPTY',_0x4ba3('0x66')],_0x5efab9);};var _0x4d3262=function(_0x4ad4d3){if(!_0x4ad4d3||!_0x4ad4d3[_0x4ba3('0x67')]['length']){return'';}for(var _0x4529a3='(',_0x9b9c64=0x0;_0x9b9c64<_0x4ad4d3[_0x4ba3('0x67')]['length'];_0x9b9c64+=0x1){_0x9b9c64>0x0&&(_0x4529a3+='\x20'+_0x4ad4d3['operator']+'\x20');_0x4529a3+=_0x4ad4d3[_0x4ba3('0x67')][_0x9b9c64][_0x4ba3('0x69')]?_0x4d3262(_0x4ad4d3[_0x4ba3('0x67')][_0x9b9c64][_0x4ba3('0x69')]):_0x4ad4d3[_0x4ba3('0x67')][_0x9b9c64]['field']+'\x20'+_0x4ad4d3[_0x4ba3('0x67')][_0x9b9c64][_0x4ba3('0x6b')]+(_0x1590f0(_0x4ad4d3[_0x4ba3('0x67')][_0x9b9c64][_0x4ba3('0x6b')])?'\x20'+_0x4ad4d3['rules'][_0x9b9c64][_0x4ba3('0x8c')]:'');}return _0x4529a3+')';};var _0x3073c5={'where':{'id':_0xddfb0c[_0x4ba3('0x49')]['id']}},_0x3d1c11,_0xa41747,_0x25c92c,_0x422a8d,_0x225746;_0x3073c5=_[_0x4ba3('0x43')]({},_0x3073c5,_0xddfb0c[_0x4ba3('0x44')]);return db[_0x4ba3('0x30')]['find'](_0x3073c5)[_0x4ba3('0x26')](function(_0x3db4c2){if(_0x3db4c2){_0x3d1c11=_0x3db4c2;return _0x3db4c2['getFields']();}return null;})[_0x4ba3('0x26')](function(_0x4a8449){if(_0x4a8449){if(!_0x4a8449[_0x4ba3('0x3c')]){throw new db[(_0x4ba3('0x6d'))][(_0x4ba3('0x6e'))](_0x4ba3('0x9e'),0x193);}_0xa41747=_0x4a8449;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0x4ba3('0x26')](function(_0xfaf98a){if(_0xfaf98a){_0x25c92c=_['keyBy'](_0xfaf98a,'id');var _0x30c904;var _0x267801=squel[_0x4ba3('0x70')]();_0x267801[_0x4ba3('0x71')](_0x3d1c11['table']);for(var _0x1bae1b=0x0;_0x1bae1b<_0xa41747[_0x4ba3('0x3c')];_0x1bae1b+=0x1){_0x30c904=_0xa41747[_0x1bae1b][_0x4ba3('0x73')]?_0x25c92c[_0xa41747[_0x1bae1b][_0x4ba3('0x73')]]['metric']:_0xa41747[_0x1bae1b][_0x4ba3('0x6a')];_0x30c904=_0xa41747[_0x1bae1b]['function']?_[_0x4ba3('0x76')](_0x2e812b[_0xa41747[_0x1bae1b][_0x4ba3('0x75')]],'%s',_0x30c904):_0x30c904;_0x30c904=_0xa41747[_0x1bae1b][_0x4ba3('0x77')]?_[_0x4ba3('0x76')](_0x5dc74f[_0xa41747[_0x1bae1b]['format']],'%s',_0x30c904):_0x30c904;if(_0xa41747[_0x1bae1b]['groupBy']){_0x267801[_0x4ba3('0x69')](_0x30c904);}_0xa41747[_0x1bae1b][_0x4ba3('0x79')]&&_0x267801[_0x4ba3('0x8d')](_0x30c904,_0xa41747[_0x1bae1b]['orderBy']==='DESC'?![]:!![]);_0x267801[_0x4ba3('0x6a')](_0x30c904,_0xa41747[_0x1bae1b][_0x4ba3('0x7b')]||_0x30c904);}if(_0x3d1c11[_0x4ba3('0x7c')]){_0x3d1c11[_0x4ba3('0x7c')]=JSON['parse'](_0x3d1c11[_0x4ba3('0x7c')]);for(var _0x2f4966=0x0;_0x2f4966<_0x3d1c11[_0x4ba3('0x7c')][_0x4ba3('0x3c')];_0x2f4966+=0x1){if(_0x3d1c11[_0x4ba3('0x7c')][_0x2f4966][_0x4ba3('0x33')]&&_[_0x4ba3('0x63')](_0x18bd77,_0x3d1c11[_0x4ba3('0x7c')][_0x2f4966][_0x4ba3('0x33')])&&_0x3d1c11[_0x4ba3('0x7c')][_0x2f4966][_0x4ba3('0x7e')]&&_0x3d1c11[_0x4ba3('0x7c')][_0x2f4966][_0x4ba3('0x80')]&&_0x3d1c11[_0x4ba3('0x7c')][_0x2f4966][_0x4ba3('0x7f')]){_0x267801[_0x3d1c11[_0x4ba3('0x7c')][_0x2f4966][_0x4ba3('0x33')]](_0x3d1c11[_0x4ba3('0x7c')][_0x2f4966]['foreignTable'],null,util[_0x4ba3('0x77')](_0x4ba3('0x81'),_0x3d1c11[_0x4ba3('0x72')],_0x3d1c11[_0x4ba3('0x7c')][_0x2f4966][_0x4ba3('0x7e')],_0x3d1c11[_0x4ba3('0x7c')][_0x2f4966]['foreignTable'],_0x3d1c11['joins'][_0x2f4966][_0x4ba3('0x7f')]));}}}if(_0x3d1c11[_0x4ba3('0x82')]){_0x3d1c11[_0x4ba3('0x82')]=JSON['parse'](_0x3d1c11[_0x4ba3('0x82')]);_0x267801[_0x4ba3('0x40')](_0x4d3262(_0x3d1c11[_0x4ba3('0x82')][_0x4ba3('0x69')]));}_0x225746=_0x267801[_0x4ba3('0x83')]();_0x267801[_0x4ba3('0x1f')](_0x25bf75);_0x267801[_0x4ba3('0x1e')](0x0);logger[_0x4ba3('0x84')](_0x4ba3('0x85'),_0x267801['toString']());return dbH[_0x4ba3('0x87')]['query'](_0x267801['toString'](),{'type':dbH[_0x4ba3('0x87')][_0x4ba3('0x9a')]['SELECT']});}})[_0x4ba3('0x26')](function(){return{'sql':_0x225746[_0x4ba3('0x86')]()};})[_0x4ba3('0x26')](respondWithResult(_0x41c531,null))[_0x4ba3('0x51')](handleError(_0x41c531,null));}; \ No newline at end of file +var _0xba34=['save','then','destroy','get','DefaultReports','UserProfileResource','error','name','send','index','map','AnalyticDefaultReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','VIRTUAL','merge','options','includeAll','include','findAll','show','params','find','create','body','user','role','UserProfileSection','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','preview','join','left_join','right_join','cross_join','SUM(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','getFields','Sequelize','ValidationErrorItem','keyBy','select','from','table','MetricId','metric','function','replace','format','groupBy','orderBy','DESC','alias','joins','parse','parentKey','foreignKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','clone','debug','Limited\x20Query:','toString','sequelize','SELECT','COUNT(%s)','AVG(%s)','IS\x20NOT\x20NULL','value','order','output','%s-%s.%s','randomstring','generate','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','endDate','startDate','info','Run\x20Query:','fork','countTable','QueryTypes','runReport','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','ROUND(%s)','Please\x20insert\x20at\x20least\x20one\x20field','eml-format','rimraf','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/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject'];(function(_0x13bd92,_0x4eea2b){var _0x4a35c2=function(_0x216c70){while(--_0x216c70){_0x13bd92['push'](_0x13bd92['shift']());}};_0x4a35c2(++_0x4eea2b);}(_0xba34,0x119));var _0x4ba3=function(_0x21a555,_0x492c70){_0x21a555=_0x21a555-0x0;var _0x4d7b95=_0xba34[_0x21a555];return _0x4d7b95;};'use strict';var emlformat=require(_0x4ba3('0x0'));var rimraf=require(_0x4ba3('0x1'));var zipdir=require(_0x4ba3('0x2'));var jsonpatch=require(_0x4ba3('0x3'));var rp=require(_0x4ba3('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x4ba3('0x5'));var path=require(_0x4ba3('0x6'));var sox=require(_0x4ba3('0x7'));var csv=require(_0x4ba3('0x8'));var ejs=require(_0x4ba3('0x9'));var fs=require('fs');var fs_extra=require(_0x4ba3('0xa'));var _=require(_0x4ba3('0xb'));var squel=require('squel');var crypto=require(_0x4ba3('0xc'));var jsforce=require(_0x4ba3('0xd'));var deskjs=require(_0x4ba3('0xe'));var toCsv=require(_0x4ba3('0x8'));var querystring=require(_0x4ba3('0xf'));var Papa=require(_0x4ba3('0x10'));var Redis=require(_0x4ba3('0x11'));var authService=require(_0x4ba3('0x12'));var qs=require(_0x4ba3('0x13'));var as=require(_0x4ba3('0x14'));var hardwareService=require(_0x4ba3('0x15'));var logger=require('../../config/logger')(_0x4ba3('0x16'));var utils=require(_0x4ba3('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x4ba3('0x18'));var db=require('../../mysqldb')['db'];var dbH=require(_0x4ba3('0x19'))['dbH'];function respondWithStatusCode(_0x256f02,_0x4419b4){_0x4419b4=_0x4419b4||0xcc;return function(_0x29e498){if(_0x29e498){return _0x256f02[_0x4ba3('0x1a')](_0x4419b4);}return _0x256f02[_0x4ba3('0x1b')](_0x4419b4)[_0x4ba3('0x1c')]();};}function respondWithResult(_0x3a74f7,_0x12ac90){_0x12ac90=_0x12ac90||0xc8;return function(_0x1dec48){if(_0x1dec48){return _0x3a74f7[_0x4ba3('0x1b')](_0x12ac90)[_0x4ba3('0x1d')](_0x1dec48);}};}function respondWithFilteredResult(_0x301359,_0x29a9d1){return function(_0x25f584){if(_0x25f584){var _0x40e75b=typeof _0x29a9d1[_0x4ba3('0x1e')]==='undefined'&&typeof _0x29a9d1[_0x4ba3('0x1f')]===_0x4ba3('0x20');var _0x5ff7ce=_0x25f584[_0x4ba3('0x21')];var _0x556290=_0x40e75b?0x0:_0x29a9d1[_0x4ba3('0x1e')];var _0xe4eff9=_0x40e75b?_0x25f584[_0x4ba3('0x21')]:_0x29a9d1[_0x4ba3('0x1e')]+_0x29a9d1[_0x4ba3('0x1f')];var _0x125944;if(_0xe4eff9>=_0x5ff7ce){_0xe4eff9=_0x5ff7ce;_0x125944=0xc8;}else{_0x125944=0xce;}_0x301359['status'](_0x125944);return _0x301359['set'](_0x4ba3('0x22'),_0x556290+'-'+_0xe4eff9+'/'+_0x5ff7ce)['json'](_0x25f584);}return null;};}function patchUpdates(_0x18dff5){return function(_0x163967){try{jsonpatch[_0x4ba3('0x23')](_0x163967,_0x18dff5,!![]);}catch(_0xbc7023){return BPromise[_0x4ba3('0x24')](_0xbc7023);}return _0x163967[_0x4ba3('0x25')]();};}function saveUpdates(_0x4a0823,_0x143c78){return function(_0x1f87e1){if(_0x1f87e1){return _0x1f87e1['update'](_0x4a0823)[_0x4ba3('0x26')](function(_0x4ffe39){return _0x4ffe39;});}return null;};}function removeEntity(_0x1ae4de,_0x18abb3){return function(_0x11a917){if(_0x11a917){return _0x11a917[_0x4ba3('0x27')]()[_0x4ba3('0x26')](function(){var _0xe29a49=_0x11a917[_0x4ba3('0x28')]({'plain':!![]});var _0xe1f7d2=_0x4ba3('0x29');return db[_0x4ba3('0x2a')]['destroy']({'where':{'type':_0xe1f7d2,'resourceId':_0xe29a49['id']}})[_0x4ba3('0x26')](function(){return _0x11a917;});})[_0x4ba3('0x26')](function(){_0x1ae4de[_0x4ba3('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x10537e,_0x1fe5e2){return function(_0x44d78c){if(!_0x44d78c){_0x10537e['sendStatus'](0x194);}return _0x44d78c;};}function handleError(_0x10cae6,_0x843276){_0x843276=_0x843276||0x1f4;return function(_0x34ecb4){logger[_0x4ba3('0x2b')](_0x34ecb4['stack']);if(_0x34ecb4['name']){delete _0x34ecb4[_0x4ba3('0x2c')];}_0x10cae6[_0x4ba3('0x1b')](_0x843276)[_0x4ba3('0x2d')](_0x34ecb4);};}exports[_0x4ba3('0x2e')]=function(_0x2cb5d5,_0x11f88f){var _0x48b3b7={},_0x27444b={},_0x28f36c={'count':0x0,'rows':[]};var _0x24d8fc=_[_0x4ba3('0x2f')](db[_0x4ba3('0x30')][_0x4ba3('0x31')],function(_0x457236){return{'name':_0x457236[_0x4ba3('0x32')],'type':_0x457236[_0x4ba3('0x33')][_0x4ba3('0x34')]};});_0x27444b['model']=_['map'](_0x24d8fc,'name');_0x27444b[_0x4ba3('0x35')]=_[_0x4ba3('0x36')](_0x2cb5d5[_0x4ba3('0x35')]);_0x27444b[_0x4ba3('0x37')]=_[_0x4ba3('0x38')](_0x27444b[_0x4ba3('0x39')],_0x27444b[_0x4ba3('0x35')]);_0x48b3b7[_0x4ba3('0x3a')]=_[_0x4ba3('0x38')](_0x27444b[_0x4ba3('0x39')],qs[_0x4ba3('0x3b')](_0x2cb5d5[_0x4ba3('0x35')]['fields']));_0x48b3b7[_0x4ba3('0x3a')]=_0x48b3b7[_0x4ba3('0x3a')][_0x4ba3('0x3c')]?_0x48b3b7['attributes']:_0x27444b[_0x4ba3('0x39')];if(!_0x2cb5d5['query'][_0x4ba3('0x3d')](_0x4ba3('0x3e'))){_0x48b3b7[_0x4ba3('0x1f')]=qs[_0x4ba3('0x1f')](_0x2cb5d5[_0x4ba3('0x35')][_0x4ba3('0x1f')]);_0x48b3b7['offset']=qs[_0x4ba3('0x1e')](_0x2cb5d5[_0x4ba3('0x35')][_0x4ba3('0x1e')]);}_0x48b3b7['order']=qs[_0x4ba3('0x3f')](_0x2cb5d5[_0x4ba3('0x35')]['sort']);_0x48b3b7[_0x4ba3('0x40')]=qs['filters'](_['pick'](_0x2cb5d5[_0x4ba3('0x35')],_0x27444b[_0x4ba3('0x37')]),_0x24d8fc);if(_0x2cb5d5[_0x4ba3('0x35')][_0x4ba3('0x41')]){_0x48b3b7[_0x4ba3('0x40')]=_['merge'](_0x48b3b7[_0x4ba3('0x40')],{'$or':_[_0x4ba3('0x2f')](_0x24d8fc,function(_0x46d2ca){if(_0x46d2ca[_0x4ba3('0x33')]!==_0x4ba3('0x42')){var _0x2acc92={};_0x2acc92[_0x46d2ca[_0x4ba3('0x2c')]]={'$like':'%'+_0x2cb5d5[_0x4ba3('0x35')]['filter']+'%'};return _0x2acc92;}})});}_0x48b3b7=_[_0x4ba3('0x43')]({},_0x48b3b7,_0x2cb5d5[_0x4ba3('0x44')]);var _0x3cb07f={'where':_0x48b3b7[_0x4ba3('0x40')]};return db[_0x4ba3('0x30')][_0x4ba3('0x21')](_0x3cb07f)[_0x4ba3('0x26')](function(_0xdcc2a2){_0x28f36c[_0x4ba3('0x21')]=_0xdcc2a2;if(_0x2cb5d5[_0x4ba3('0x35')][_0x4ba3('0x45')]){_0x48b3b7[_0x4ba3('0x46')]=[{'all':!![]}];}return db[_0x4ba3('0x30')][_0x4ba3('0x47')](_0x48b3b7);})['then'](function(_0x5af671){_0x28f36c['rows']=_0x5af671;return _0x28f36c;})['then'](respondWithFilteredResult(_0x11f88f,_0x48b3b7))['catch'](handleError(_0x11f88f,null));};exports[_0x4ba3('0x48')]=function(_0x5c4659,_0x29e74d){var _0x5567c7={'raw':!![],'where':{'id':_0x5c4659[_0x4ba3('0x49')]['id']}},_0x53d6eb={};_0x53d6eb[_0x4ba3('0x39')]=_[_0x4ba3('0x36')](db[_0x4ba3('0x30')]['rawAttributes']);_0x53d6eb[_0x4ba3('0x35')]=_['keys'](_0x5c4659[_0x4ba3('0x35')]);_0x53d6eb['filters']=_[_0x4ba3('0x38')](_0x53d6eb[_0x4ba3('0x39')],_0x53d6eb[_0x4ba3('0x35')]);_0x5567c7[_0x4ba3('0x3a')]=_[_0x4ba3('0x38')](_0x53d6eb[_0x4ba3('0x39')],qs[_0x4ba3('0x3b')](_0x5c4659['query'][_0x4ba3('0x3b')]));_0x5567c7[_0x4ba3('0x3a')]=_0x5567c7[_0x4ba3('0x3a')][_0x4ba3('0x3c')]?_0x5567c7[_0x4ba3('0x3a')]:_0x53d6eb['model'];if(_0x5c4659['query'][_0x4ba3('0x45')]){_0x5567c7[_0x4ba3('0x46')]=[{'all':!![]}];}_0x5567c7=_[_0x4ba3('0x43')]({},_0x5567c7,_0x5c4659['options']);return db[_0x4ba3('0x30')][_0x4ba3('0x4a')](_0x5567c7)[_0x4ba3('0x26')](handleEntityNotFound(_0x29e74d,null))['then'](respondWithResult(_0x29e74d,null))['catch'](handleError(_0x29e74d,null));};exports[_0x4ba3('0x4b')]=function(_0x482a83,_0x439acf){return db[_0x4ba3('0x30')][_0x4ba3('0x4b')](_0x482a83[_0x4ba3('0x4c')],{})[_0x4ba3('0x26')](function(_0x213eb0){var _0x590739=_0x482a83[_0x4ba3('0x4d')][_0x4ba3('0x28')]({'plain':!![]});if(!_0x590739)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x590739[_0x4ba3('0x4e')]===_0x4ba3('0x4d')){var _0x156c2d=_0x213eb0[_0x4ba3('0x28')]({'plain':!![]});var _0x360472='Reports';return db[_0x4ba3('0x4f')][_0x4ba3('0x4a')]({'where':{'name':_0x360472,'userProfileId':_0x590739['userProfileId']},'raw':!![]})[_0x4ba3('0x26')](function(_0x19d70f){if(_0x19d70f&&_0x19d70f[_0x4ba3('0x50')]===0x0){return db[_0x4ba3('0x2a')][_0x4ba3('0x4b')]({'name':_0x156c2d[_0x4ba3('0x2c')],'resourceId':_0x156c2d['id'],'type':_0x4ba3('0x29'),'sectionId':_0x19d70f['id']},{})[_0x4ba3('0x26')](function(){return _0x213eb0;});}else{return _0x213eb0;}})[_0x4ba3('0x51')](function(_0x428a27){logger[_0x4ba3('0x2b')](_0x4ba3('0x52'),_0x428a27);throw _0x428a27;});}return _0x213eb0;})[_0x4ba3('0x26')](respondWithResult(_0x439acf,0xc9))[_0x4ba3('0x51')](handleError(_0x439acf,null));};exports[_0x4ba3('0x53')]=function(_0x48a3d4,_0x5e7ed5){if(_0x48a3d4['body']['id']){delete _0x48a3d4[_0x4ba3('0x4c')]['id'];}return db[_0x4ba3('0x30')][_0x4ba3('0x4a')]({'where':{'id':_0x48a3d4[_0x4ba3('0x49')]['id']}})[_0x4ba3('0x26')](handleEntityNotFound(_0x5e7ed5,null))['then'](saveUpdates(_0x48a3d4[_0x4ba3('0x4c')],null))[_0x4ba3('0x26')](respondWithResult(_0x5e7ed5,null))[_0x4ba3('0x51')](handleError(_0x5e7ed5,null));};exports[_0x4ba3('0x27')]=function(_0x5359d1,_0x1e83fb){return db[_0x4ba3('0x30')][_0x4ba3('0x4a')]({'where':{'id':_0x5359d1[_0x4ba3('0x49')]['id']}})[_0x4ba3('0x26')](handleEntityNotFound(_0x1e83fb,null))[_0x4ba3('0x26')](removeEntity(_0x1e83fb,null))[_0x4ba3('0x51')](handleError(_0x1e83fb,null));};exports[_0x4ba3('0x54')]=function(_0x328314,_0x4fa64d){var _0x20c849=0xa;var _0x42bb4b=[_0x4ba3('0x55'),_0x4ba3('0x56'),_0x4ba3('0x57'),_0x4ba3('0x58')];var _0x40827a={'SUM':_0x4ba3('0x59'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x4ba3('0x5a'),'MAX':_0x4ba3('0x5b'),'MIN':_0x4ba3('0x5c'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x4ba3('0x5d'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x4ba3('0x5e')};var _0x4cc10a={'SEC_TO_TIME':_0x4ba3('0x5f'),'DATE':_0x4ba3('0x60'),'HOUR':_0x4ba3('0x61'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x4ba3('0x62')};var _0xaef1b=function(_0x2a48fe){return!_[_0x4ba3('0x63')]([_0x4ba3('0x64'),'IS\x20NOT\x20NULL',_0x4ba3('0x65'),_0x4ba3('0x66')],_0x2a48fe);};var _0x34cc21=function(_0x469ef0){if(!_0x469ef0||!_0x469ef0[_0x4ba3('0x67')][_0x4ba3('0x3c')]){return'';}for(var _0x3fdf7f='(',_0x38699e=0x0;_0x38699e<_0x469ef0[_0x4ba3('0x67')][_0x4ba3('0x3c')];_0x38699e+=0x1){_0x38699e>0x0&&(_0x3fdf7f+='\x20'+_0x469ef0[_0x4ba3('0x68')]+'\x20');_0x3fdf7f+=_0x469ef0['rules'][_0x38699e][_0x4ba3('0x69')]?_0x34cc21(_0x469ef0[_0x4ba3('0x67')][_0x38699e]['group']):_0x469ef0['rules'][_0x38699e][_0x4ba3('0x6a')]+'\x20'+_0x469ef0[_0x4ba3('0x67')][_0x38699e]['condition']+(_0xaef1b(_0x469ef0[_0x4ba3('0x67')][_0x38699e][_0x4ba3('0x6b')])?'\x20'+_0x469ef0[_0x4ba3('0x67')][_0x38699e]['value']:'');}return _0x3fdf7f+')';};var _0x1f5815={'where':{'id':_0x328314['params']['id']}},_0x46224,_0x1af489,_0x11209b,_0x24a75a,_0x3a4838;_0x1f5815=_[_0x4ba3('0x43')]({},_0x1f5815,_0x328314[_0x4ba3('0x44')]);return db[_0x4ba3('0x30')]['find'](_0x1f5815)[_0x4ba3('0x26')](function(_0x2f8bcc){if(_0x2f8bcc){_0x46224=_0x2f8bcc;return _0x2f8bcc[_0x4ba3('0x6c')]();}return null;})[_0x4ba3('0x26')](function(_0x21c8b1){if(_0x21c8b1){if(!_0x21c8b1[_0x4ba3('0x3c')]){throw new db[(_0x4ba3('0x6d'))][(_0x4ba3('0x6e'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x1af489=_0x21c8b1;return db['AnalyticMetric'][_0x4ba3('0x47')]({'raw':!![]});}return null;})['then'](function(_0x13ee2c){if(_0x13ee2c){_0x11209b=_[_0x4ba3('0x6f')](_0x13ee2c,'id');var _0x442d66;var _0x5c7fc2=squel[_0x4ba3('0x70')]();_0x5c7fc2[_0x4ba3('0x71')](_0x46224[_0x4ba3('0x72')]);for(var _0x5baf26=0x0;_0x5baf26<_0x1af489[_0x4ba3('0x3c')];_0x5baf26+=0x1){_0x442d66=_0x1af489[_0x5baf26]['MetricId']?_0x11209b[_0x1af489[_0x5baf26][_0x4ba3('0x73')]][_0x4ba3('0x74')]:_0x1af489[_0x5baf26]['field'];_0x442d66=_0x1af489[_0x5baf26][_0x4ba3('0x75')]?_[_0x4ba3('0x76')](_0x40827a[_0x1af489[_0x5baf26][_0x4ba3('0x75')]],'%s',_0x442d66):_0x442d66;_0x442d66=_0x1af489[_0x5baf26][_0x4ba3('0x77')]?_[_0x4ba3('0x76')](_0x4cc10a[_0x1af489[_0x5baf26][_0x4ba3('0x77')]],'%s',_0x442d66):_0x442d66;if(_0x1af489[_0x5baf26][_0x4ba3('0x78')]){_0x5c7fc2[_0x4ba3('0x69')](_0x442d66);}_0x1af489[_0x5baf26][_0x4ba3('0x79')]&&_0x5c7fc2['order'](_0x442d66,_0x1af489[_0x5baf26][_0x4ba3('0x79')]===_0x4ba3('0x7a')?![]:!![]);_0x5c7fc2[_0x4ba3('0x6a')](_0x442d66,_0x1af489[_0x5baf26][_0x4ba3('0x7b')]||_0x442d66);}if(_0x46224[_0x4ba3('0x7c')]){_0x46224[_0x4ba3('0x7c')]=JSON[_0x4ba3('0x7d')](_0x46224[_0x4ba3('0x7c')]);for(var _0x365d94=0x0;_0x365d94<_0x46224[_0x4ba3('0x7c')][_0x4ba3('0x3c')];_0x365d94+=0x1){if(_0x46224[_0x4ba3('0x7c')][_0x365d94]['type']&&_[_0x4ba3('0x63')](_0x42bb4b,_0x46224[_0x4ba3('0x7c')][_0x365d94]['type'])&&_0x46224[_0x4ba3('0x7c')][_0x365d94][_0x4ba3('0x7e')]&&_0x46224['joins'][_0x365d94]['foreignTable']&&_0x46224[_0x4ba3('0x7c')][_0x365d94][_0x4ba3('0x7f')]){_0x5c7fc2[_0x46224[_0x4ba3('0x7c')][_0x365d94][_0x4ba3('0x33')]](_0x46224[_0x4ba3('0x7c')][_0x365d94][_0x4ba3('0x80')],null,util[_0x4ba3('0x77')](_0x4ba3('0x81'),_0x46224['table'],_0x46224[_0x4ba3('0x7c')][_0x365d94]['parentKey'],_0x46224[_0x4ba3('0x7c')][_0x365d94][_0x4ba3('0x80')],_0x46224[_0x4ba3('0x7c')][_0x365d94][_0x4ba3('0x7f')]));}}}if(_0x46224[_0x4ba3('0x82')]){_0x46224[_0x4ba3('0x82')]=JSON[_0x4ba3('0x7d')](_0x46224[_0x4ba3('0x82')]);_0x5c7fc2['where'](_0x34cc21(_0x46224[_0x4ba3('0x82')][_0x4ba3('0x69')]));}_0x3a4838=_0x5c7fc2[_0x4ba3('0x83')]();_0x5c7fc2['limit'](_0x20c849);_0x5c7fc2[_0x4ba3('0x1e')](0x0);logger[_0x4ba3('0x84')](_0x4ba3('0x85'),_0x5c7fc2[_0x4ba3('0x86')]());return dbH[_0x4ba3('0x87')][_0x4ba3('0x35')](_0x5c7fc2[_0x4ba3('0x86')](),{'type':dbH['sequelize']['QueryTypes'][_0x4ba3('0x88')]});}})['then'](respondWithResult(_0x4fa64d,null))[_0x4ba3('0x51')](handleError(_0x4fa64d,null));};function runReport(_0x15508f,_0x108679,_0x20f7db){var _0x5a3c63=_0x108679['name'];var _0x2d16e5=0xa;var _0x2b2132=['join',_0x4ba3('0x56'),_0x4ba3('0x57'),_0x4ba3('0x58')];var _0x1e8232={'SUM':_0x4ba3('0x59'),'COUNT':_0x4ba3('0x89'),'COUNT DISTINCT':_0x4ba3('0x5a'),'MAX':'MAX(%s)','MIN':_0x4ba3('0x5c'),'AVG':_0x4ba3('0x8a'),'GROUP_CONCAT':_0x4ba3('0x5d'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x4ba3('0x5e')};var _0x13dbc4={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x4ba3('0x60'),'HOUR':_0x4ba3('0x61'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x5aa412=function(_0x4ec70e){return!_[_0x4ba3('0x63')]([_0x4ba3('0x64'),_0x4ba3('0x8b'),_0x4ba3('0x65'),_0x4ba3('0x66')],_0x4ec70e);};var _0x333a97=function(_0x30d7a9){if(!_0x30d7a9||!_0x30d7a9['rules'][_0x4ba3('0x3c')]){return'';}for(var _0x4cd4a2='(',_0x31a725=0x0;_0x31a725<_0x30d7a9['rules'][_0x4ba3('0x3c')];_0x31a725+=0x1){_0x31a725>0x0&&(_0x4cd4a2+='\x20'+_0x30d7a9[_0x4ba3('0x68')]+'\x20');_0x4cd4a2+=_0x30d7a9[_0x4ba3('0x67')][_0x31a725][_0x4ba3('0x69')]?_0x333a97(_0x30d7a9[_0x4ba3('0x67')][_0x31a725]['group']):_0x30d7a9['rules'][_0x31a725][_0x4ba3('0x6a')]+'\x20'+_0x30d7a9[_0x4ba3('0x67')][_0x31a725][_0x4ba3('0x6b')]+(_0x5aa412(_0x30d7a9[_0x4ba3('0x67')][_0x31a725][_0x4ba3('0x6b')])?'\x20'+_0x30d7a9[_0x4ba3('0x67')][_0x31a725][_0x4ba3('0x8c')]:'');}return _0x4cd4a2+')';};var _0x3d8606={'where':{'id':_0x15508f['id']}},_0x2d00e3,_0x35441e,_0x217ea4,_0x40dcee,_0x5ea9d0;_0x3d8606=_[_0x4ba3('0x43')]({},_0x3d8606,_0x20f7db);return db['AnalyticDefaultReport'][_0x4ba3('0x4a')](_0x3d8606)[_0x4ba3('0x26')](function(_0x17b970){if(_0x17b970){_0x2d00e3=_0x17b970;return _0x17b970[_0x4ba3('0x6c')]();}return null;})['then'](function(_0x2a2dc2){if(_0x2a2dc2){if(!_0x2a2dc2[_0x4ba3('0x3c')]){throw new db[(_0x4ba3('0x6d'))][(_0x4ba3('0x6e'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x35441e=_0x2a2dc2;return db['AnalyticMetric'][_0x4ba3('0x47')]({'raw':!![]});}return null;})[_0x4ba3('0x26')](function(_0x3188c8){if(_0x3188c8){_0x217ea4=_['keyBy'](_0x3188c8,'id');var _0x2f793a;var _0x1194a5=squel[_0x4ba3('0x70')]();_0x1194a5[_0x4ba3('0x71')](_0x2d00e3[_0x4ba3('0x72')]);for(var _0x1e2134=0x0;_0x1e2134<_0x35441e['length'];_0x1e2134+=0x1){_0x2f793a=_0x35441e[_0x1e2134][_0x4ba3('0x73')]?_0x217ea4[_0x35441e[_0x1e2134]['MetricId']][_0x4ba3('0x74')]:_0x35441e[_0x1e2134][_0x4ba3('0x6a')];_0x2f793a=_0x35441e[_0x1e2134][_0x4ba3('0x75')]?_[_0x4ba3('0x76')](_0x1e8232[_0x35441e[_0x1e2134]['function']],'%s',_0x2f793a):_0x2f793a;_0x2f793a=_0x35441e[_0x1e2134][_0x4ba3('0x77')]?_[_0x4ba3('0x76')](_0x13dbc4[_0x35441e[_0x1e2134]['format']],'%s',_0x2f793a):_0x2f793a;if(_0x35441e[_0x1e2134][_0x4ba3('0x78')]){_0x1194a5['group'](_0x2f793a);}_0x35441e[_0x1e2134][_0x4ba3('0x79')]&&_0x1194a5[_0x4ba3('0x8d')](_0x2f793a,_0x35441e[_0x1e2134][_0x4ba3('0x79')]===_0x4ba3('0x7a')?![]:!![]);_0x1194a5[_0x4ba3('0x6a')](_0x2f793a,_0x35441e[_0x1e2134]['alias']||_0x2f793a);}if(_0x2d00e3['joins']){_0x2d00e3[_0x4ba3('0x7c')]=JSON[_0x4ba3('0x7d')](_0x2d00e3[_0x4ba3('0x7c')]);for(var _0x56244e=0x0;_0x56244e<_0x2d00e3[_0x4ba3('0x7c')][_0x4ba3('0x3c')];_0x56244e+=0x1){if(_0x2d00e3['joins'][_0x56244e][_0x4ba3('0x33')]&&_[_0x4ba3('0x63')](_0x2b2132,_0x2d00e3[_0x4ba3('0x7c')][_0x56244e][_0x4ba3('0x33')])&&_0x2d00e3[_0x4ba3('0x7c')][_0x56244e][_0x4ba3('0x7e')]&&_0x2d00e3[_0x4ba3('0x7c')][_0x56244e][_0x4ba3('0x80')]&&_0x2d00e3['joins'][_0x56244e][_0x4ba3('0x7f')]){_0x1194a5[_0x2d00e3[_0x4ba3('0x7c')][_0x56244e][_0x4ba3('0x33')]](_0x2d00e3[_0x4ba3('0x7c')][_0x56244e][_0x4ba3('0x80')],null,util[_0x4ba3('0x77')](_0x4ba3('0x81'),_0x2d00e3[_0x4ba3('0x72')],_0x2d00e3[_0x4ba3('0x7c')][_0x56244e][_0x4ba3('0x7e')],_0x2d00e3[_0x4ba3('0x7c')][_0x56244e][_0x4ba3('0x80')],_0x2d00e3[_0x4ba3('0x7c')][_0x56244e]['foreignKey']));}}}if(_0x2d00e3['conditions']){_0x2d00e3[_0x4ba3('0x82')]=JSON[_0x4ba3('0x7d')](_0x2d00e3[_0x4ba3('0x82')]);_0x1194a5[_0x4ba3('0x40')](_0x333a97(_0x2d00e3[_0x4ba3('0x82')][_0x4ba3('0x69')]));}_0x5ea9d0=_0x1194a5[_0x4ba3('0x83')]();_0x1194a5['limit'](_0x2d16e5);_0x1194a5['offset'](0x0);return;}})[_0x4ba3('0x26')](function(){if(_0x108679[_0x4ba3('0x8e')]==='web'){return null;}var _0x4fb6b5=_['merge'](_0x108679,{'name':_0x108679['fullPath']||_0x108679[_0x4ba3('0x2c')]||_0x2d00e3[_0x4ba3('0x2c')],'basename':_0x5a3c63,'savename':util[_0x4ba3('0x77')](_0x4ba3('0x8f'),_0x108679[_0x4ba3('0x2c')]||_0x2d00e3['name'],require(_0x4ba3('0x90'))[_0x4ba3('0x91')](0x4),_0x108679[_0x4ba3('0x8e')]||'csv'),'reportId':_0x2d00e3['id'],'reportType':'default'});return db['AnalyticExtractedReport']['create'](_0x4fb6b5,{'raw':!![]});})[_0x4ba3('0x26')](function(_0x17d501){if(_0x2d00e3[_0x4ba3('0x72')]===_0x4ba3('0x92')){_0x5ea9d0[_0x4ba3('0x40')](_0x2d00e3['table']+_0x4ba3('0x93'),_0x108679['startDate'],_0x108679[_0x4ba3('0x94')]);}else{_0x5ea9d0[_0x4ba3('0x40')](_0x2d00e3[_0x4ba3('0x72')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x108679[_0x4ba3('0x95')],_0x108679[_0x4ba3('0x94')]);}if(_0x17d501){logger[_0x4ba3('0x96')](_0x4ba3('0x97'),_0x5ea9d0['toString']());require('child_process')[_0x4ba3('0x98')](path[_0x4ba3('0x55')](__dirname,'../../components/export/',_0x17d501[_0x4ba3('0x8e')]),[_0x17d501['id'],_0x5ea9d0['toString'](),path['join'](__dirname,'../../files/reports',_0x17d501['savename']),_0x5a3c63]);return _0x17d501;}else{var _0x2d2ca3=squel[_0x4ba3('0x70')]();_0x2d2ca3[_0x4ba3('0x71')]('('+_0x5ea9d0[_0x4ba3('0x86')]()+')',_0x4ba3('0x99'));_0x2d2ca3['field']('COUNT(*)',_0x4ba3('0x21'));_0x5ea9d0['limit'](_0x108679[_0x4ba3('0x1f')]||_0x2d16e5);_0x5ea9d0[_0x4ba3('0x1e')](_0x108679[_0x4ba3('0x1e')]||0x0);return dbH['sequelize'][_0x4ba3('0x35')](_0x2d2ca3[_0x4ba3('0x86')](),{'type':dbH[_0x4ba3('0x87')][_0x4ba3('0x9a')][_0x4ba3('0x88')]})[_0x4ba3('0x26')](function(_0xc938c){if(!_0xc938c[_0x4ba3('0x3c')]){_0x40dcee=0x0;}else{_0x40dcee=_0xc938c[0x0][_0x4ba3('0x21')]||0x0;}return dbH['sequelize']['query'](_0x5ea9d0[_0x4ba3('0x86')](),{'type':dbH[_0x4ba3('0x87')][_0x4ba3('0x9a')][_0x4ba3('0x88')]});})[_0x4ba3('0x26')](function(_0xd97c26){return{'rows':_0xd97c26||[],'count':_0x40dcee};});}});}exports['run']=function(_0x1fbdc7,_0x9e45ec){return runReport(_0x1fbdc7['params'],_0x1fbdc7[_0x4ba3('0x35')],_0x1fbdc7[_0x4ba3('0x44')])[_0x4ba3('0x26')](respondWithResult(_0x9e45ec,null))[_0x4ba3('0x51')](handleError(_0x9e45ec,null));};exports[_0x4ba3('0x9b')]=runReport;exports[_0x4ba3('0x35')]=function(_0xddfb0c,_0x41c531){var _0x25bf75=0xa;var _0x18bd77=[_0x4ba3('0x55'),_0x4ba3('0x56'),_0x4ba3('0x57'),_0x4ba3('0x58')];var _0x2e812b={'SUM':'SUM(%s)','COUNT':_0x4ba3('0x89'),'COUNT DISTINCT':_0x4ba3('0x5a'),'MAX':'MAX(%s)','MIN':_0x4ba3('0x5c'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x4ba3('0x5d'),'GROUP_CONCAT ASC':_0x4ba3('0x9c'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x5dc74f={'SEC_TO_TIME':_0x4ba3('0x5f'),'DATE':'DATE(%s)','HOUR':_0x4ba3('0x61'),'ROUND':_0x4ba3('0x9d'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x1590f0=function(_0x5efab9){return!_[_0x4ba3('0x63')]([_0x4ba3('0x64'),_0x4ba3('0x8b'),'IS\x20EMPTY',_0x4ba3('0x66')],_0x5efab9);};var _0x4d3262=function(_0x4ad4d3){if(!_0x4ad4d3||!_0x4ad4d3[_0x4ba3('0x67')]['length']){return'';}for(var _0x4529a3='(',_0x9b9c64=0x0;_0x9b9c64<_0x4ad4d3[_0x4ba3('0x67')]['length'];_0x9b9c64+=0x1){_0x9b9c64>0x0&&(_0x4529a3+='\x20'+_0x4ad4d3['operator']+'\x20');_0x4529a3+=_0x4ad4d3[_0x4ba3('0x67')][_0x9b9c64][_0x4ba3('0x69')]?_0x4d3262(_0x4ad4d3[_0x4ba3('0x67')][_0x9b9c64][_0x4ba3('0x69')]):_0x4ad4d3[_0x4ba3('0x67')][_0x9b9c64]['field']+'\x20'+_0x4ad4d3[_0x4ba3('0x67')][_0x9b9c64][_0x4ba3('0x6b')]+(_0x1590f0(_0x4ad4d3[_0x4ba3('0x67')][_0x9b9c64][_0x4ba3('0x6b')])?'\x20'+_0x4ad4d3['rules'][_0x9b9c64][_0x4ba3('0x8c')]:'');}return _0x4529a3+')';};var _0x3073c5={'where':{'id':_0xddfb0c[_0x4ba3('0x49')]['id']}},_0x3d1c11,_0xa41747,_0x25c92c,_0x422a8d,_0x225746;_0x3073c5=_[_0x4ba3('0x43')]({},_0x3073c5,_0xddfb0c[_0x4ba3('0x44')]);return db[_0x4ba3('0x30')]['find'](_0x3073c5)[_0x4ba3('0x26')](function(_0x3db4c2){if(_0x3db4c2){_0x3d1c11=_0x3db4c2;return _0x3db4c2['getFields']();}return null;})[_0x4ba3('0x26')](function(_0x4a8449){if(_0x4a8449){if(!_0x4a8449[_0x4ba3('0x3c')]){throw new db[(_0x4ba3('0x6d'))][(_0x4ba3('0x6e'))](_0x4ba3('0x9e'),0x193);}_0xa41747=_0x4a8449;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0x4ba3('0x26')](function(_0xfaf98a){if(_0xfaf98a){_0x25c92c=_['keyBy'](_0xfaf98a,'id');var _0x30c904;var _0x267801=squel[_0x4ba3('0x70')]();_0x267801[_0x4ba3('0x71')](_0x3d1c11['table']);for(var _0x1bae1b=0x0;_0x1bae1b<_0xa41747[_0x4ba3('0x3c')];_0x1bae1b+=0x1){_0x30c904=_0xa41747[_0x1bae1b][_0x4ba3('0x73')]?_0x25c92c[_0xa41747[_0x1bae1b][_0x4ba3('0x73')]]['metric']:_0xa41747[_0x1bae1b][_0x4ba3('0x6a')];_0x30c904=_0xa41747[_0x1bae1b]['function']?_[_0x4ba3('0x76')](_0x2e812b[_0xa41747[_0x1bae1b][_0x4ba3('0x75')]],'%s',_0x30c904):_0x30c904;_0x30c904=_0xa41747[_0x1bae1b][_0x4ba3('0x77')]?_[_0x4ba3('0x76')](_0x5dc74f[_0xa41747[_0x1bae1b]['format']],'%s',_0x30c904):_0x30c904;if(_0xa41747[_0x1bae1b]['groupBy']){_0x267801[_0x4ba3('0x69')](_0x30c904);}_0xa41747[_0x1bae1b][_0x4ba3('0x79')]&&_0x267801[_0x4ba3('0x8d')](_0x30c904,_0xa41747[_0x1bae1b]['orderBy']==='DESC'?![]:!![]);_0x267801[_0x4ba3('0x6a')](_0x30c904,_0xa41747[_0x1bae1b][_0x4ba3('0x7b')]||_0x30c904);}if(_0x3d1c11[_0x4ba3('0x7c')]){_0x3d1c11[_0x4ba3('0x7c')]=JSON['parse'](_0x3d1c11[_0x4ba3('0x7c')]);for(var _0x2f4966=0x0;_0x2f4966<_0x3d1c11[_0x4ba3('0x7c')][_0x4ba3('0x3c')];_0x2f4966+=0x1){if(_0x3d1c11[_0x4ba3('0x7c')][_0x2f4966][_0x4ba3('0x33')]&&_[_0x4ba3('0x63')](_0x18bd77,_0x3d1c11[_0x4ba3('0x7c')][_0x2f4966][_0x4ba3('0x33')])&&_0x3d1c11[_0x4ba3('0x7c')][_0x2f4966][_0x4ba3('0x7e')]&&_0x3d1c11[_0x4ba3('0x7c')][_0x2f4966][_0x4ba3('0x80')]&&_0x3d1c11[_0x4ba3('0x7c')][_0x2f4966][_0x4ba3('0x7f')]){_0x267801[_0x3d1c11[_0x4ba3('0x7c')][_0x2f4966][_0x4ba3('0x33')]](_0x3d1c11[_0x4ba3('0x7c')][_0x2f4966]['foreignTable'],null,util[_0x4ba3('0x77')](_0x4ba3('0x81'),_0x3d1c11[_0x4ba3('0x72')],_0x3d1c11[_0x4ba3('0x7c')][_0x2f4966][_0x4ba3('0x7e')],_0x3d1c11[_0x4ba3('0x7c')][_0x2f4966]['foreignTable'],_0x3d1c11['joins'][_0x2f4966][_0x4ba3('0x7f')]));}}}if(_0x3d1c11[_0x4ba3('0x82')]){_0x3d1c11[_0x4ba3('0x82')]=JSON['parse'](_0x3d1c11[_0x4ba3('0x82')]);_0x267801[_0x4ba3('0x40')](_0x4d3262(_0x3d1c11[_0x4ba3('0x82')][_0x4ba3('0x69')]));}_0x225746=_0x267801[_0x4ba3('0x83')]();_0x267801[_0x4ba3('0x1f')](_0x25bf75);_0x267801[_0x4ba3('0x1e')](0x0);logger[_0x4ba3('0x84')](_0x4ba3('0x85'),_0x267801['toString']());return dbH[_0x4ba3('0x87')]['query'](_0x267801['toString'](),{'type':dbH[_0x4ba3('0x87')][_0x4ba3('0x9a')]['SELECT']});}})[_0x4ba3('0x26')](function(){return{'sql':_0x225746[_0x4ba3('0x86')]()};})[_0x4ba3('0x26')](respondWithResult(_0x41c531,null))[_0x4ba3('0x51')](handleError(_0x41c531,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 4adf3d3..e1066c4 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 _0x1412=['util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./analyticDefaultReport.attributes','define','AnalyticDefaultReport','analytics_default_reports','lodash'];(function(_0x12f847,_0x403776){var _0x2c54e4=function(_0x541e47){while(--_0x541e47){_0x12f847['push'](_0x12f847['shift']());}};_0x2c54e4(++_0x403776);}(_0x1412,0x67));var _0x2141=function(_0x1a202a,_0x2b87e6){_0x1a202a=_0x1a202a-0x0;var _0xfb41ba=_0x1412[_0x1a202a];return _0xfb41ba;};'use strict';var _=require(_0x2141('0x0'));var util=require(_0x2141('0x1'));var logger=require(_0x2141('0x2'))(_0x2141('0x3'));var moment=require(_0x2141('0x4'));var BPromise=require(_0x2141('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2141('0x6'));var rimraf=require(_0x2141('0x7'));var config=require(_0x2141('0x8'));var attributes=require(_0x2141('0x9'));module['exports']=function(_0x317e43,_0x4ad54a){return _0x317e43[_0x2141('0xa')](_0x2141('0xb'),attributes,{'tableName':_0x2141('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x493f=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticDefaultReport.attributes','AnalyticDefaultReport','analytics_default_reports','util'];(function(_0x518157,_0x2e5e9d){var _0x53aa81=function(_0x2a0c1c){while(--_0x2a0c1c){_0x518157['push'](_0x518157['shift']());}};_0x53aa81(++_0x2e5e9d);}(_0x493f,0xfc));var _0xf493=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x493f[_0x4b369d];return _0x571a98;};'use strict';var _=require('lodash');var util=require(_0xf493('0x0'));var logger=require('../../config/logger')(_0xf493('0x1'));var moment=require(_0xf493('0x2'));var BPromise=require(_0xf493('0x3'));var rp=require(_0xf493('0x4'));var fs=require('fs');var path=require(_0xf493('0x5'));var rimraf=require(_0xf493('0x6'));var config=require(_0xf493('0x7'));var attributes=require(_0xf493('0x8'));module['exports']=function(_0x42ff05,_0x2f0b7c){return _0x42ff05['define'](_0xf493('0x9'),attributes,{'tableName':_0xf493('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js b/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js index 2da1dc0..f6b57f6 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 _0xcbbf=['message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x5d509d,_0x59bdc6){var _0x46085d=function(_0x4e12e0){while(--_0x4e12e0){_0x5d509d['push'](_0x5d509d['shift']());}};_0x46085d(++_0x59bdc6);}(_0xcbbf,0x100));var _0xfcbb=function(_0x537efb,_0xe69b8f){_0x537efb=_0x537efb-0x0;var _0x2400b5=_0xcbbf[_0x537efb];return _0x2400b5;};'use strict';var _=require(_0xfcbb('0x0'));var util=require(_0xfcbb('0x1'));var moment=require(_0xfcbb('0x2'));var BPromise=require('bluebird');var rs=require(_0xfcbb('0x3'));var fs=require('fs');var Redis=require(_0xfcbb('0x4'));var db=require(_0xfcbb('0x5'))['db'];var utils=require(_0xfcbb('0x6'));var logger=require('../../config/logger')(_0xfcbb('0x7'));var config=require(_0xfcbb('0x8'));var jayson=require(_0xfcbb('0x9'));var client=jayson[_0xfcbb('0xa')][_0xfcbb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x31a594,_0x4b5556,_0x48f259){return new BPromise(function(_0x461308,_0x561eb5){return client['request'](_0x31a594,_0x48f259)[_0xfcbb('0xc')](function(_0x60d747){logger[_0xfcbb('0xd')](_0xfcbb('0xe'),_0x4b5556,_0xfcbb('0xf'));logger['debug'](_0xfcbb('0x10'),_0x4b5556,_0xfcbb('0xf'),JSON[_0xfcbb('0x11')](_0x60d747));if(_0x60d747[_0xfcbb('0x12')]){if(_0x60d747[_0xfcbb('0x12')][_0xfcbb('0x13')]===0x1f4){logger[_0xfcbb('0x12')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x4b5556,_0x60d747[_0xfcbb('0x12')][_0xfcbb('0x14')]);return _0x561eb5(_0x60d747[_0xfcbb('0x12')]['message']);}logger['error'](_0xfcbb('0xe'),_0x4b5556,_0x60d747['error']['message']);return _0x461308(_0x60d747[_0xfcbb('0x12')][_0xfcbb('0x14')]);}else{logger[_0xfcbb('0xd')](_0xfcbb('0xe'),_0x4b5556,'request\x20sent');_0x461308(_0x60d747[_0xfcbb('0x15')][_0xfcbb('0x14')]);}})[_0xfcbb('0x16')](function(_0x404ef1){logger['error']('AnalyticDefaultReport,\x20%s,\x20%s',_0x4b5556,_0x404ef1);_0x561eb5(_0x404ef1);});});} \ No newline at end of file +var _0x3f96=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash'];(function(_0x2ee9df,_0x2fff2e){var _0x3ffe6e=function(_0x1de3c0){while(--_0x1de3c0){_0x2ee9df['push'](_0x2ee9df['shift']());}};_0x3ffe6e(++_0x2fff2e);}(_0x3f96,0xbc));var _0x63f9=function(_0x10da87,_0xdf1210){_0x10da87=_0x10da87-0x0;var _0x410cd1=_0x3f96[_0x10da87];return _0x410cd1;};'use strict';var _=require(_0x63f9('0x0'));var util=require('util');var moment=require(_0x63f9('0x1'));var BPromise=require(_0x63f9('0x2'));var rs=require(_0x63f9('0x3'));var fs=require('fs');var Redis=require(_0x63f9('0x4'));var db=require(_0x63f9('0x5'))['db'];var utils=require(_0x63f9('0x6'));var logger=require('../../config/logger')(_0x63f9('0x7'));var config=require(_0x63f9('0x8'));var jayson=require(_0x63f9('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5dd771,_0x45bc9c,_0x576277){return new BPromise(function(_0x1f0f4c,_0x5eff5e){return client['request'](_0x5dd771,_0x576277)['then'](function(_0x108dce){logger[_0x63f9('0xa')](_0x63f9('0xb'),_0x45bc9c,_0x63f9('0xc'));logger[_0x63f9('0xd')](_0x63f9('0xe'),_0x45bc9c,_0x63f9('0xc'),JSON[_0x63f9('0xf')](_0x108dce));if(_0x108dce[_0x63f9('0x10')]){if(_0x108dce[_0x63f9('0x10')][_0x63f9('0x11')]===0x1f4){logger[_0x63f9('0x10')](_0x63f9('0xb'),_0x45bc9c,_0x108dce[_0x63f9('0x10')][_0x63f9('0x12')]);return _0x5eff5e(_0x108dce[_0x63f9('0x10')][_0x63f9('0x12')]);}logger[_0x63f9('0x10')](_0x63f9('0xb'),_0x45bc9c,_0x108dce['error']['message']);return _0x1f0f4c(_0x108dce[_0x63f9('0x10')][_0x63f9('0x12')]);}else{logger[_0x63f9('0xa')](_0x63f9('0xb'),_0x45bc9c,_0x63f9('0xc'));_0x1f0f4c(_0x108dce[_0x63f9('0x13')][_0x63f9('0x12')]);}})[_0x63f9('0x14')](function(_0x28ccb9){logger[_0x63f9('0x10')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x45bc9c,_0x28ccb9);_0x5eff5e(_0x28ccb9);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index 5c3cae8..d603107 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 _0xfa24=['destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/run','run','/:id/query','query','post','create','update','delete'];(function(_0x45f040,_0x17a94d){var _0x5dc477=function(_0x4e50bd){while(--_0x4e50bd){_0x45f040['push'](_0x45f040['shift']());}};_0x5dc477(++_0x17a94d);}(_0xfa24,0xff));var _0x4fa2=function(_0x34c027,_0x123688){_0x34c027=_0x34c027-0x0;var _0x47bff0=_0xfa24[_0x34c027];return _0x47bff0;};'use strict';var multer=require(_0x4fa2('0x0'));var util=require('util');var path=require(_0x4fa2('0x1'));var timeout=require(_0x4fa2('0x2'));var express=require(_0x4fa2('0x3'));var router=express[_0x4fa2('0x4')]();var fs_extra=require(_0x4fa2('0x5'));var auth=require(_0x4fa2('0x6'));var interaction=require(_0x4fa2('0x7'));var config=require(_0x4fa2('0x8'));var controller=require('./analyticDefaultReport.controller');router[_0x4fa2('0x9')]('/',auth[_0x4fa2('0xa')](),controller['index']);router[_0x4fa2('0x9')](_0x4fa2('0xb'),auth['isAuthenticated'](),controller[_0x4fa2('0xc')]);router[_0x4fa2('0x9')]('/:id/preview',auth['isAuthenticated'](),controller['preview']);router[_0x4fa2('0x9')](_0x4fa2('0xd'),auth[_0x4fa2('0xa')](),controller[_0x4fa2('0xe')]);router['get'](_0x4fa2('0xf'),auth[_0x4fa2('0xa')](),controller[_0x4fa2('0x10')]);router[_0x4fa2('0x11')]('/',auth[_0x4fa2('0xa')](),controller[_0x4fa2('0x12')]);router['put'](_0x4fa2('0xb'),auth[_0x4fa2('0xa')](),controller[_0x4fa2('0x13')]);router[_0x4fa2('0x14')](_0x4fa2('0xb'),auth[_0x4fa2('0xa')](),controller[_0x4fa2('0x15')]);module[_0x4fa2('0x16')]=router; \ No newline at end of file +var _0xed8b=['util','path','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','./analyticDefaultReport.controller','get','isAuthenticated','index','/:id','show','/:id/preview','/:id/run','run','/:id/query','query','post','create','update','delete','destroy','multer'];(function(_0x1df25a,_0x2683f2){var _0xe11b8f=function(_0x3fbcc2){while(--_0x3fbcc2){_0x1df25a['push'](_0x1df25a['shift']());}};_0xe11b8f(++_0x2683f2);}(_0xed8b,0x158));var _0xbed8=function(_0x2c8a9e,_0xb2765f){_0x2c8a9e=_0x2c8a9e-0x0;var _0x1bbeb0=_0xed8b[_0x2c8a9e];return _0x1bbeb0;};'use strict';var multer=require(_0xbed8('0x0'));var util=require(_0xbed8('0x1'));var path=require(_0xbed8('0x2'));var timeout=require(_0xbed8('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xbed8('0x4'));var auth=require(_0xbed8('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xbed8('0x6'));var controller=require(_0xbed8('0x7'));router[_0xbed8('0x8')]('/',auth[_0xbed8('0x9')](),controller[_0xbed8('0xa')]);router[_0xbed8('0x8')](_0xbed8('0xb'),auth[_0xbed8('0x9')](),controller[_0xbed8('0xc')]);router['get'](_0xbed8('0xd'),auth['isAuthenticated'](),controller['preview']);router[_0xbed8('0x8')](_0xbed8('0xe'),auth['isAuthenticated'](),controller[_0xbed8('0xf')]);router[_0xbed8('0x8')](_0xbed8('0x10'),auth['isAuthenticated'](),controller[_0xbed8('0x11')]);router[_0xbed8('0x12')]('/',auth[_0xbed8('0x9')](),controller[_0xbed8('0x13')]);router['put']('/:id',auth[_0xbed8('0x9')](),controller[_0xbed8('0x14')]);router[_0xbed8('0x15')](_0xbed8('0xb'),auth['isAuthenticated'](),controller[_0xbed8('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index 2542587..1d6b220 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 _0x663f=['manual','scheduled','UNSIGNED','sequelize','moment','STRING','csv','pdf','xlsx','DATE','Loading','ENUM'];(function(_0x3e8398,_0x5be112){var _0x292e05=function(_0x42decc){while(--_0x42decc){_0x3e8398['push'](_0x3e8398['shift']());}};_0x292e05(++_0x5be112);}(_0x663f,0x183));var _0xf663=function(_0x3a2118,_0x31fc3c){_0x3a2118=_0x3a2118-0x0;var _0x1d181d=_0x663f[_0x3a2118];return _0x1d181d;};'use strict';var Sequelize=require(_0xf663('0x0'));var moment=require(_0xf663('0x1'));module['exports']={'name':{'type':Sequelize[_0xf663('0x2')],'allowNull':![]},'basename':{'type':Sequelize[_0xf663('0x2')],'allowNull':![]},'output':{'type':Sequelize['ENUM'](_0xf663('0x3'),_0xf663('0x4'),_0xf663('0x5')),'allowNull':![],'defaultValue':'csv'},'savename':{'type':Sequelize[_0xf663('0x2')],'allowNull':![]},'startDate':{'type':Sequelize[_0xf663('0x6')]},'endDate':{'type':Sequelize[_0xf663('0x6')]},'status':{'type':Sequelize[_0xf663('0x2')],'defaultValue':_0xf663('0x7')},'type':{'type':Sequelize[_0xf663('0x8')](_0xf663('0x9'),_0xf663('0xa')),'allowNull':![],'defaultValue':_0xf663('0x9')},'reportId':{'type':Sequelize['INTEGER'](0xb)[_0xf663('0xb')]},'reportType':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xc682=['ENUM','csv','pdf','xlsx','DATE','Loading','manual','UNSIGNED','sequelize','moment','exports','STRING'];(function(_0x99859d,_0x5be55d){var _0x17b2de=function(_0x16d505){while(--_0x16d505){_0x99859d['push'](_0x99859d['shift']());}};_0x17b2de(++_0x5be55d);}(_0xc682,0x128));var _0x2c68=function(_0x549782,_0x25e476){_0x549782=_0x549782-0x0;var _0x3b5097=_0xc682[_0x549782];return _0x3b5097;};'use strict';var Sequelize=require(_0x2c68('0x0'));var moment=require(_0x2c68('0x1'));module[_0x2c68('0x2')]={'name':{'type':Sequelize[_0x2c68('0x3')],'allowNull':![]},'basename':{'type':Sequelize['STRING'],'allowNull':![]},'output':{'type':Sequelize[_0x2c68('0x4')](_0x2c68('0x5'),_0x2c68('0x6'),_0x2c68('0x7')),'allowNull':![],'defaultValue':_0x2c68('0x5')},'savename':{'type':Sequelize['STRING'],'allowNull':![]},'startDate':{'type':Sequelize[_0x2c68('0x8')]},'endDate':{'type':Sequelize[_0x2c68('0x8')]},'status':{'type':Sequelize[_0x2c68('0x3')],'defaultValue':_0x2c68('0x9')},'type':{'type':Sequelize[_0x2c68('0x4')](_0x2c68('0xa'),'scheduled'),'allowNull':![],'defaultValue':'manual'},'reportId':{'type':Sequelize['INTEGER'](0xb)[_0x2c68('0xb')]},'reportType':{'type':Sequelize[_0x2c68('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index cdc8cc9..58dc71f 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 _0x566d=['request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','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','count','set','apply','update','then','destroy','get','UserProfileResource','end','stack','name','send','AnalyticExtractedReport','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','limit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','catch','show','params','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','ExtractedReports','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','download','output','existsSync','join','root','server/files/reports','savename','Sequelize','Report\x20not\x20found\x20or\x20empty','exists','format','basename','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x321421,_0x555332){var _0x5374a4=function(_0x31158f){while(--_0x31158f){_0x321421['push'](_0x321421['shift']());}};_0x5374a4(++_0x555332);}(_0x566d,0x116));var _0xd566=function(_0x48c132,_0x1fdb42){_0x48c132=_0x48c132-0x0;var _0x583afd=_0x566d[_0x48c132];return _0x583afd;};'use strict';var emlformat=require(_0xd566('0x0'));var rimraf=require(_0xd566('0x1'));var zipdir=require(_0xd566('0x2'));var jsonpatch=require(_0xd566('0x3'));var rp=require(_0xd566('0x4'));var moment=require(_0xd566('0x5'));var BPromise=require(_0xd566('0x6'));var Mustache=require(_0xd566('0x7'));var util=require(_0xd566('0x8'));var path=require(_0xd566('0x9'));var sox=require(_0xd566('0xa'));var csv=require(_0xd566('0xb'));var ejs=require(_0xd566('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xd566('0xd'));var crypto=require(_0xd566('0xe'));var jsforce=require(_0xd566('0xf'));var deskjs=require(_0xd566('0x10'));var toCsv=require(_0xd566('0xb'));var querystring=require(_0xd566('0x11'));var Papa=require(_0xd566('0x12'));var Redis=require(_0xd566('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xd566('0x14'));var as=require(_0xd566('0x15'));var hardwareService=require(_0xd566('0x16'));var logger=require(_0xd566('0x17'))('api');var utils=require(_0xd566('0x18'));var config=require(_0xd566('0x19'));var licenseUtil=require(_0xd566('0x1a'));var db=require(_0xd566('0x1b'))['db'];function respondWithStatusCode(_0x1552d7,_0x59ad8e){_0x59ad8e=_0x59ad8e||0xcc;return function(_0x55968e){if(_0x55968e){return _0x1552d7[_0xd566('0x1c')](_0x59ad8e);}return _0x1552d7[_0xd566('0x1d')](_0x59ad8e)['end']();};}function respondWithResult(_0x16a973,_0x25a271){_0x25a271=_0x25a271||0xc8;return function(_0x3652b8){if(_0x3652b8){return _0x16a973[_0xd566('0x1d')](_0x25a271)[_0xd566('0x1e')](_0x3652b8);}};}function respondWithFilteredResult(_0x174639,_0x1e7648){return function(_0x76b759){if(_0x76b759){var _0x26be6b=typeof _0x1e7648[_0xd566('0x1f')]===_0xd566('0x20')&&typeof _0x1e7648['limit']==='undefined';var _0x52e0fe=_0x76b759[_0xd566('0x21')];var _0x4bd741=_0x26be6b?0x0:_0x1e7648[_0xd566('0x1f')];var _0x4a6c68=_0x26be6b?_0x76b759[_0xd566('0x21')]:_0x1e7648[_0xd566('0x1f')]+_0x1e7648['limit'];var _0x2ca95f;if(_0x4a6c68>=_0x52e0fe){_0x4a6c68=_0x52e0fe;_0x2ca95f=0xc8;}else{_0x2ca95f=0xce;}_0x174639[_0xd566('0x1d')](_0x2ca95f);return _0x174639[_0xd566('0x22')]('Content-Range',_0x4bd741+'-'+_0x4a6c68+'/'+_0x52e0fe)[_0xd566('0x1e')](_0x76b759);}return null;};}function patchUpdates(_0xf82ec3){return function(_0x907da4){try{jsonpatch[_0xd566('0x23')](_0x907da4,_0xf82ec3,!![]);}catch(_0x3c40bd){return BPromise['reject'](_0x3c40bd);}return _0x907da4['save']();};}function saveUpdates(_0x27c06d,_0x4f0bf0){return function(_0x223e8d){if(_0x223e8d){return _0x223e8d[_0xd566('0x24')](_0x27c06d)[_0xd566('0x25')](function(_0x16163f){return _0x16163f;});}return null;};}function removeEntity(_0x3d9119,_0x198b0f){return function(_0x3bda04){if(_0x3bda04){return _0x3bda04[_0xd566('0x26')]()[_0xd566('0x25')](function(){var _0x150531=_0x3bda04[_0xd566('0x27')]({'plain':!![]});var _0x35668c='ExtractedReports';return db[_0xd566('0x28')][_0xd566('0x26')]({'where':{'type':_0x35668c,'resourceId':_0x150531['id']}})[_0xd566('0x25')](function(){return _0x3bda04;});})[_0xd566('0x25')](function(){_0x3d9119[_0xd566('0x1d')](0xcc)[_0xd566('0x29')]();});}};}function handleEntityNotFound(_0x395eab,_0x526a91){return function(_0x24f5b3){if(!_0x24f5b3){_0x395eab[_0xd566('0x1c')](0x194);}return _0x24f5b3;};}function handleError(_0x11e9f1,_0x7097b1){_0x7097b1=_0x7097b1||0x1f4;return function(_0x445edb){logger['error'](_0x445edb[_0xd566('0x2a')]);if(_0x445edb[_0xd566('0x2b')]){delete _0x445edb[_0xd566('0x2b')];}_0x11e9f1[_0xd566('0x1d')](_0x7097b1)[_0xd566('0x2c')](_0x445edb);};}exports['index']=function(_0x1f636f,_0x4e904a){var _0xc8b7c2={},_0x598cf8={},_0x453f97={'count':0x0,'rows':[]};var _0xa1aa=_['map'](db[_0xd566('0x2d')]['rawAttributes'],function(_0x12de11){return{'name':_0x12de11[_0xd566('0x2e')],'type':_0x12de11[_0xd566('0x2f')][_0xd566('0x30')]};});_0x598cf8[_0xd566('0x31')]=_[_0xd566('0x32')](_0xa1aa,'name');_0x598cf8[_0xd566('0x33')]=_[_0xd566('0x34')](_0x1f636f[_0xd566('0x33')]);_0x598cf8[_0xd566('0x35')]=_[_0xd566('0x36')](_0x598cf8[_0xd566('0x31')],_0x598cf8['query']);_0xc8b7c2[_0xd566('0x37')]=_[_0xd566('0x36')](_0x598cf8['model'],qs[_0xd566('0x38')](_0x1f636f[_0xd566('0x33')][_0xd566('0x38')]));_0xc8b7c2[_0xd566('0x37')]=_0xc8b7c2['attributes'][_0xd566('0x39')]?_0xc8b7c2[_0xd566('0x37')]:_0x598cf8[_0xd566('0x31')];if(!_0x1f636f[_0xd566('0x33')]['hasOwnProperty']('nolimit')){_0xc8b7c2[_0xd566('0x3a')]=qs[_0xd566('0x3a')](_0x1f636f['query'][_0xd566('0x3a')]);_0xc8b7c2[_0xd566('0x1f')]=qs['offset'](_0x1f636f[_0xd566('0x33')]['offset']);}_0xc8b7c2['order']=qs[_0xd566('0x3b')](_0x1f636f[_0xd566('0x33')][_0xd566('0x3b')]);_0xc8b7c2[_0xd566('0x3c')]=qs[_0xd566('0x35')](_[_0xd566('0x3d')](_0x1f636f[_0xd566('0x33')],_0x598cf8[_0xd566('0x35')]),_0xa1aa);if(_0x1f636f[_0xd566('0x33')][_0xd566('0x3e')]){_0xc8b7c2[_0xd566('0x3c')]=_[_0xd566('0x3f')](_0xc8b7c2[_0xd566('0x3c')],{'$or':_[_0xd566('0x32')](_0xa1aa,function(_0x5daabe){if(_0x5daabe['type']!==_0xd566('0x40')){var _0x1bebb9={};_0x1bebb9[_0x5daabe['name']]={'$like':'%'+_0x1f636f[_0xd566('0x33')]['filter']+'%'};return _0x1bebb9;}})});}_0xc8b7c2=_[_0xd566('0x3f')]({},_0xc8b7c2,_0x1f636f['options']);var _0x55ff1e={'where':_0xc8b7c2[_0xd566('0x3c')]};return db[_0xd566('0x2d')][_0xd566('0x21')](_0x55ff1e)[_0xd566('0x25')](function(_0x19f7b1){_0x453f97[_0xd566('0x21')]=_0x19f7b1;if(_0x1f636f[_0xd566('0x33')][_0xd566('0x41')]){_0xc8b7c2[_0xd566('0x42')]=[{'all':!![]}];}return db[_0xd566('0x2d')]['findAll'](_0xc8b7c2);})[_0xd566('0x25')](function(_0x3c0ae3){_0x453f97['rows']=_0x3c0ae3;return _0x453f97;})['then'](respondWithFilteredResult(_0x4e904a,_0xc8b7c2))[_0xd566('0x43')](handleError(_0x4e904a,null));};exports[_0xd566('0x44')]=function(_0x1fa31e,_0x15d904){var _0x25cdb7={'raw':!![],'where':{'id':_0x1fa31e[_0xd566('0x45')]['id']}},_0x3f41b8={};_0x3f41b8[_0xd566('0x31')]=_[_0xd566('0x34')](db['AnalyticExtractedReport']['rawAttributes']);_0x3f41b8[_0xd566('0x33')]=_[_0xd566('0x34')](_0x1fa31e[_0xd566('0x33')]);_0x3f41b8[_0xd566('0x35')]=_['intersection'](_0x3f41b8[_0xd566('0x31')],_0x3f41b8[_0xd566('0x33')]);_0x25cdb7[_0xd566('0x37')]=_[_0xd566('0x36')](_0x3f41b8[_0xd566('0x31')],qs[_0xd566('0x38')](_0x1fa31e[_0xd566('0x33')]['fields']));_0x25cdb7[_0xd566('0x37')]=_0x25cdb7['attributes'][_0xd566('0x39')]?_0x25cdb7[_0xd566('0x37')]:_0x3f41b8[_0xd566('0x31')];if(_0x1fa31e['query'][_0xd566('0x41')]){_0x25cdb7[_0xd566('0x42')]=[{'all':!![]}];}_0x25cdb7=_[_0xd566('0x3f')]({},_0x25cdb7,_0x1fa31e[_0xd566('0x46')]);return db['AnalyticExtractedReport'][_0xd566('0x47')](_0x25cdb7)[_0xd566('0x25')](handleEntityNotFound(_0x15d904,null))[_0xd566('0x25')](respondWithResult(_0x15d904,null))[_0xd566('0x43')](handleError(_0x15d904,null));};exports['create']=function(_0x42543b,_0xdb6989){return db['AnalyticExtractedReport'][_0xd566('0x48')](_0x42543b['body'],{})['then'](function(_0xe95c11){var _0x41d8ae=_0x42543b[_0xd566('0x49')][_0xd566('0x27')]({'plain':!![]});if(!_0x41d8ae)throw new Error(_0xd566('0x4a'));if(_0x41d8ae['role']===_0xd566('0x49')){var _0x14da64=_0xe95c11[_0xd566('0x27')]({'plain':!![]});var _0x58ac01=_0xd566('0x4b');return db[_0xd566('0x4c')]['find']({'where':{'name':_0x58ac01,'userProfileId':_0x41d8ae[_0xd566('0x4d')]},'raw':!![]})[_0xd566('0x25')](function(_0x313815){if(_0x313815&&_0x313815[_0xd566('0x4e')]===0x0){return db[_0xd566('0x28')]['create']({'name':_0x14da64[_0xd566('0x2b')],'resourceId':_0x14da64['id'],'type':_0x313815[_0xd566('0x2b')],'sectionId':_0x313815['id']},{})[_0xd566('0x25')](function(){return _0xe95c11;});}else{return _0xe95c11;}})[_0xd566('0x43')](function(_0x2f0043){logger[_0xd566('0x4f')](_0xd566('0x50'),_0x2f0043);throw _0x2f0043;});}return _0xe95c11;})[_0xd566('0x25')](respondWithResult(_0xdb6989,0xc9))[_0xd566('0x43')](handleError(_0xdb6989,null));};exports[_0xd566('0x24')]=function(_0x2b8bcc,_0x201a91){if(_0x2b8bcc['body']['id']){delete _0x2b8bcc[_0xd566('0x51')]['id'];}return db['AnalyticExtractedReport'][_0xd566('0x47')]({'where':{'id':_0x2b8bcc[_0xd566('0x45')]['id']}})['then'](handleEntityNotFound(_0x201a91,null))[_0xd566('0x25')](saveUpdates(_0x2b8bcc[_0xd566('0x51')],null))[_0xd566('0x25')](respondWithResult(_0x201a91,null))[_0xd566('0x43')](handleError(_0x201a91,null));};exports[_0xd566('0x26')]=function(_0x2d81e7,_0x3a32de){return db['AnalyticExtractedReport'][_0xd566('0x47')]({'where':{'id':_0x2d81e7[_0xd566('0x45')]['id']}})[_0xd566('0x25')](handleEntityNotFound(_0x3a32de,null))['then'](removeEntity(_0x3a32de,null))['catch'](handleError(_0x3a32de,null));};exports[_0xd566('0x52')]=function(_0x1a6503,_0xdf7c7a,_0x3c90f0){return db[_0xd566('0x2d')][_0xd566('0x47')]({'where':{'id':_0x1a6503[_0xd566('0x45')]['id']},'attributes':[_0xd566('0x2b'),'basename','savename',_0xd566('0x53')],'raw':!![]})[_0xd566('0x25')](handleEntityNotFound(_0xdf7c7a,null))[_0xd566('0x25')](function(_0x5b833a){if(_0x5b833a){if(!fs[_0xd566('0x54')](path[_0xd566('0x55')](config[_0xd566('0x56')],_0xd566('0x57'),_0x5b833a[_0xd566('0x58')]))){throw new db[(_0xd566('0x59'))]['ValidationError'](_0xd566('0x5a'));}if(_0x1a6503[_0xd566('0x33')][_0xd566('0x5b')]){return _0xdf7c7a[_0xd566('0x1c')](0xc8);}return _0xdf7c7a['download'](path[_0xd566('0x55')](config[_0xd566('0x56')],'server/files/reports',_0x5b833a[_0xd566('0x58')]),util[_0xd566('0x5c')]('%s.%s',_0x5b833a[_0xd566('0x5d')]||_0x5b833a[_0xd566('0x2b')],_0x5b833a['output']['toLowerCase']()));}})['catch'](handleError(_0xdf7c7a,null));}; \ No newline at end of file +var _0xa97b=['user','UserProfileSection','userProfileId','params','savename','output','join','root','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','sendStatus','download','server/files/reports','basename','toLowerCase','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','get','ExtractedReports','UserProfileResource','destroy','error','stack','name','index','rawAttributes','fieldName','key','map','query','filters','intersection','model','fields','attributes','length','order','sort','where','type','VIRTUAL','filter','merge','options','AnalyticExtractedReport','rows','catch','show','keys','include','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role'];(function(_0x549a12,_0x410002){var _0xca8e6d=function(_0x42ca99){while(--_0x42ca99){_0x549a12['push'](_0x549a12['shift']());}};_0xca8e6d(++_0x410002);}(_0xa97b,0x178));var _0xba97=function(_0x1d27f5,_0x19e0df){_0x1d27f5=_0x1d27f5-0x0;var _0x283ce1=_0xa97b[_0x1d27f5];return _0x283ce1;};'use strict';var emlformat=require(_0xba97('0x0'));var rimraf=require(_0xba97('0x1'));var zipdir=require(_0xba97('0x2'));var jsonpatch=require(_0xba97('0x3'));var rp=require(_0xba97('0x4'));var moment=require(_0xba97('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xba97('0x6'));var util=require(_0xba97('0x7'));var path=require('path');var sox=require(_0xba97('0x8'));var csv=require(_0xba97('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xba97('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xba97('0xb'));var jsforce=require(_0xba97('0xc'));var deskjs=require(_0xba97('0xd'));var toCsv=require('to-csv');var querystring=require(_0xba97('0xe'));var Papa=require(_0xba97('0xf'));var Redis=require(_0xba97('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xba97('0x11'));var as=require(_0xba97('0x12'));var hardwareService=require(_0xba97('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xba97('0x14'));var config=require(_0xba97('0x15'));var licenseUtil=require(_0xba97('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xf54411,_0x5329b2){_0x5329b2=_0x5329b2||0xcc;return function(_0x316258){if(_0x316258){return _0xf54411['sendStatus'](_0x5329b2);}return _0xf54411[_0xba97('0x17')](_0x5329b2)[_0xba97('0x18')]();};}function respondWithResult(_0x4221d8,_0xaffd76){_0xaffd76=_0xaffd76||0xc8;return function(_0x1e4877){if(_0x1e4877){return _0x4221d8['status'](_0xaffd76)[_0xba97('0x19')](_0x1e4877);}};}function respondWithFilteredResult(_0x1e17de,_0x1f14d8){return function(_0x4fa26d){if(_0x4fa26d){var _0x47d71f=typeof _0x1f14d8['offset']===_0xba97('0x1a')&&typeof _0x1f14d8[_0xba97('0x1b')]==='undefined';var _0x3cd37f=_0x4fa26d[_0xba97('0x1c')];var _0x5a0539=_0x47d71f?0x0:_0x1f14d8[_0xba97('0x1d')];var _0x40ad5e=_0x47d71f?_0x4fa26d[_0xba97('0x1c')]:_0x1f14d8[_0xba97('0x1d')]+_0x1f14d8['limit'];var _0x2f8967;if(_0x40ad5e>=_0x3cd37f){_0x40ad5e=_0x3cd37f;_0x2f8967=0xc8;}else{_0x2f8967=0xce;}_0x1e17de[_0xba97('0x17')](_0x2f8967);return _0x1e17de[_0xba97('0x1e')](_0xba97('0x1f'),_0x5a0539+'-'+_0x40ad5e+'/'+_0x3cd37f)[_0xba97('0x19')](_0x4fa26d);}return null;};}function patchUpdates(_0x3c7878){return function(_0x1b1173){try{jsonpatch['apply'](_0x1b1173,_0x3c7878,!![]);}catch(_0x3f58c4){return BPromise[_0xba97('0x20')](_0x3f58c4);}return _0x1b1173[_0xba97('0x21')]();};}function saveUpdates(_0x54efdb,_0x451d63){return function(_0x1b0a09){if(_0x1b0a09){return _0x1b0a09[_0xba97('0x22')](_0x54efdb)['then'](function(_0x588f0e){return _0x588f0e;});}return null;};}function removeEntity(_0x5c4203,_0x4f6c60){return function(_0x208fee){if(_0x208fee){return _0x208fee['destroy']()[_0xba97('0x23')](function(){var _0x194869=_0x208fee[_0xba97('0x24')]({'plain':!![]});var _0xd5ba7f=_0xba97('0x25');return db[_0xba97('0x26')][_0xba97('0x27')]({'where':{'type':_0xd5ba7f,'resourceId':_0x194869['id']}})[_0xba97('0x23')](function(){return _0x208fee;});})['then'](function(){_0x5c4203['status'](0xcc)[_0xba97('0x18')]();});}};}function handleEntityNotFound(_0x3c6d0a,_0x38ed36){return function(_0x2379eb){if(!_0x2379eb){_0x3c6d0a['sendStatus'](0x194);}return _0x2379eb;};}function handleError(_0x2c0f60,_0x2bd3b6){_0x2bd3b6=_0x2bd3b6||0x1f4;return function(_0x1342fb){logger[_0xba97('0x28')](_0x1342fb[_0xba97('0x29')]);if(_0x1342fb[_0xba97('0x2a')]){delete _0x1342fb[_0xba97('0x2a')];}_0x2c0f60[_0xba97('0x17')](_0x2bd3b6)['send'](_0x1342fb);};}exports[_0xba97('0x2b')]=function(_0x27c3bf,_0x204934){var _0x88b044={},_0x5a8261={},_0x2a8a7b={'count':0x0,'rows':[]};var _0x3b9b84=_['map'](db['AnalyticExtractedReport'][_0xba97('0x2c')],function(_0x45dad6){return{'name':_0x45dad6[_0xba97('0x2d')],'type':_0x45dad6['type'][_0xba97('0x2e')]};});_0x5a8261['model']=_[_0xba97('0x2f')](_0x3b9b84,_0xba97('0x2a'));_0x5a8261[_0xba97('0x30')]=_['keys'](_0x27c3bf[_0xba97('0x30')]);_0x5a8261[_0xba97('0x31')]=_[_0xba97('0x32')](_0x5a8261[_0xba97('0x33')],_0x5a8261[_0xba97('0x30')]);_0x88b044['attributes']=_[_0xba97('0x32')](_0x5a8261['model'],qs['fields'](_0x27c3bf[_0xba97('0x30')][_0xba97('0x34')]));_0x88b044[_0xba97('0x35')]=_0x88b044[_0xba97('0x35')][_0xba97('0x36')]?_0x88b044['attributes']:_0x5a8261[_0xba97('0x33')];if(!_0x27c3bf[_0xba97('0x30')]['hasOwnProperty']('nolimit')){_0x88b044[_0xba97('0x1b')]=qs['limit'](_0x27c3bf['query'][_0xba97('0x1b')]);_0x88b044[_0xba97('0x1d')]=qs[_0xba97('0x1d')](_0x27c3bf['query'][_0xba97('0x1d')]);}_0x88b044[_0xba97('0x37')]=qs[_0xba97('0x38')](_0x27c3bf['query']['sort']);_0x88b044[_0xba97('0x39')]=qs[_0xba97('0x31')](_['pick'](_0x27c3bf[_0xba97('0x30')],_0x5a8261[_0xba97('0x31')]),_0x3b9b84);if(_0x27c3bf[_0xba97('0x30')]['filter']){_0x88b044[_0xba97('0x39')]=_['merge'](_0x88b044[_0xba97('0x39')],{'$or':_['map'](_0x3b9b84,function(_0x4206c9){if(_0x4206c9[_0xba97('0x3a')]!==_0xba97('0x3b')){var _0x45d631={};_0x45d631[_0x4206c9[_0xba97('0x2a')]]={'$like':'%'+_0x27c3bf[_0xba97('0x30')][_0xba97('0x3c')]+'%'};return _0x45d631;}})});}_0x88b044=_[_0xba97('0x3d')]({},_0x88b044,_0x27c3bf[_0xba97('0x3e')]);var _0x125ef1={'where':_0x88b044[_0xba97('0x39')]};return db[_0xba97('0x3f')][_0xba97('0x1c')](_0x125ef1)[_0xba97('0x23')](function(_0x3eec2d){_0x2a8a7b['count']=_0x3eec2d;if(_0x27c3bf[_0xba97('0x30')]['includeAll']){_0x88b044['include']=[{'all':!![]}];}return db[_0xba97('0x3f')]['findAll'](_0x88b044);})[_0xba97('0x23')](function(_0x3c95c9){_0x2a8a7b[_0xba97('0x40')]=_0x3c95c9;return _0x2a8a7b;})['then'](respondWithFilteredResult(_0x204934,_0x88b044))[_0xba97('0x41')](handleError(_0x204934,null));};exports[_0xba97('0x42')]=function(_0x261272,_0x1f93ca){var _0x4c4fb9={'raw':!![],'where':{'id':_0x261272['params']['id']}},_0x5ee5fe={};_0x5ee5fe[_0xba97('0x33')]=_[_0xba97('0x43')](db[_0xba97('0x3f')][_0xba97('0x2c')]);_0x5ee5fe['query']=_[_0xba97('0x43')](_0x261272['query']);_0x5ee5fe['filters']=_[_0xba97('0x32')](_0x5ee5fe[_0xba97('0x33')],_0x5ee5fe[_0xba97('0x30')]);_0x4c4fb9[_0xba97('0x35')]=_[_0xba97('0x32')](_0x5ee5fe[_0xba97('0x33')],qs[_0xba97('0x34')](_0x261272[_0xba97('0x30')][_0xba97('0x34')]));_0x4c4fb9[_0xba97('0x35')]=_0x4c4fb9[_0xba97('0x35')][_0xba97('0x36')]?_0x4c4fb9['attributes']:_0x5ee5fe[_0xba97('0x33')];if(_0x261272[_0xba97('0x30')]['includeAll']){_0x4c4fb9[_0xba97('0x44')]=[{'all':!![]}];}_0x4c4fb9=_[_0xba97('0x3d')]({},_0x4c4fb9,_0x261272['options']);return db[_0xba97('0x3f')][_0xba97('0x45')](_0x4c4fb9)[_0xba97('0x23')](handleEntityNotFound(_0x1f93ca,null))[_0xba97('0x23')](respondWithResult(_0x1f93ca,null))[_0xba97('0x41')](handleError(_0x1f93ca,null));};exports[_0xba97('0x46')]=function(_0x1c4061,_0x79566d){return db[_0xba97('0x3f')]['create'](_0x1c4061[_0xba97('0x47')],{})['then'](function(_0x21f491){var _0x806035=_0x1c4061['user']['get']({'plain':!![]});if(!_0x806035)throw new Error(_0xba97('0x48'));if(_0x806035[_0xba97('0x49')]===_0xba97('0x4a')){var _0x58c2c4=_0x21f491[_0xba97('0x24')]({'plain':!![]});var _0x161c14='ExtractedReports';return db[_0xba97('0x4b')][_0xba97('0x45')]({'where':{'name':_0x161c14,'userProfileId':_0x806035[_0xba97('0x4c')]},'raw':!![]})['then'](function(_0xf8b320){if(_0xf8b320&&_0xf8b320['autoAssociation']===0x0){return db[_0xba97('0x26')][_0xba97('0x46')]({'name':_0x58c2c4[_0xba97('0x2a')],'resourceId':_0x58c2c4['id'],'type':_0xf8b320[_0xba97('0x2a')],'sectionId':_0xf8b320['id']},{})[_0xba97('0x23')](function(){return _0x21f491;});}else{return _0x21f491;}})[_0xba97('0x41')](function(_0x9c080e){logger[_0xba97('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x9c080e);throw _0x9c080e;});}return _0x21f491;})['then'](respondWithResult(_0x79566d,0xc9))['catch'](handleError(_0x79566d,null));};exports[_0xba97('0x22')]=function(_0x33c1be,_0x28f1bc){if(_0x33c1be['body']['id']){delete _0x33c1be['body']['id'];}return db[_0xba97('0x3f')][_0xba97('0x45')]({'where':{'id':_0x33c1be[_0xba97('0x4d')]['id']}})[_0xba97('0x23')](handleEntityNotFound(_0x28f1bc,null))[_0xba97('0x23')](saveUpdates(_0x33c1be[_0xba97('0x47')],null))['then'](respondWithResult(_0x28f1bc,null))[_0xba97('0x41')](handleError(_0x28f1bc,null));};exports['destroy']=function(_0x13025e,_0x24f400){return db[_0xba97('0x3f')]['find']({'where':{'id':_0x13025e[_0xba97('0x4d')]['id']}})[_0xba97('0x23')](handleEntityNotFound(_0x24f400,null))[_0xba97('0x23')](removeEntity(_0x24f400,null))['catch'](handleError(_0x24f400,null));};exports['download']=function(_0x346577,_0x5a83be,_0x3f35c8){return db[_0xba97('0x3f')]['find']({'where':{'id':_0x346577[_0xba97('0x4d')]['id']},'attributes':[_0xba97('0x2a'),'basename',_0xba97('0x4e'),_0xba97('0x4f')],'raw':!![]})['then'](handleEntityNotFound(_0x5a83be,null))[_0xba97('0x23')](function(_0x115658){if(_0x115658){if(!fs['existsSync'](path[_0xba97('0x50')](config[_0xba97('0x51')],'server/files/reports',_0x115658[_0xba97('0x4e')]))){throw new db[(_0xba97('0x52'))][(_0xba97('0x53'))](_0xba97('0x54'));}if(_0x346577[_0xba97('0x30')]['exists']){return _0x5a83be[_0xba97('0x55')](0xc8);}return _0x5a83be[_0xba97('0x56')](path[_0xba97('0x50')](config[_0xba97('0x51')],_0xba97('0x57'),_0x115658['savename']),util['format']('%s.%s',_0x115658[_0xba97('0x58')]||_0x115658[_0xba97('0x2a')],_0x115658[_0xba97('0x4f')][_0xba97('0x59')]()));}})['catch'](handleError(_0x5a83be,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 543d2d4..8969c23 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 _0x3d15=['bluebird','request-promise','path','rimraf','../../config/environment','exports','define','AnalyticExtractedReport','analytics_extracted_reports','lodash','util','api','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3d15,0x10d));var _0x53d1=function(_0x2ed51e,_0x20d606){_0x2ed51e=_0x2ed51e-0x0;var _0x44318c=_0x3d15[_0x2ed51e];return _0x44318c;};'use strict';var _=require(_0x53d1('0x0'));var util=require(_0x53d1('0x1'));var logger=require('../../config/logger')(_0x53d1('0x2'));var moment=require(_0x53d1('0x3'));var BPromise=require(_0x53d1('0x4'));var rp=require(_0x53d1('0x5'));var fs=require('fs');var path=require(_0x53d1('0x6'));var rimraf=require(_0x53d1('0x7'));var config=require(_0x53d1('0x8'));var attributes=require('./analyticExtractedReport.attributes');module[_0x53d1('0x9')]=function(_0x753e93,_0x5d444c){return _0x753e93[_0x53d1('0xa')](_0x53d1('0xb'),attributes,{'tableName':_0x53d1('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf692=['../../config/logger','api','bluebird','request-promise','path','../../config/environment','./analyticExtractedReport.attributes','exports','define','analytics_extracted_reports'];(function(_0x24392f,_0x15a3e5){var _0x591e33=function(_0xe0ccea){while(--_0xe0ccea){_0x24392f['push'](_0x24392f['shift']());}};_0x591e33(++_0x15a3e5);}(_0xf692,0x140));var _0x2f69=function(_0x1a6d77,_0x350cbf){_0x1a6d77=_0x1a6d77-0x0;var _0x18efe8=_0xf692[_0x1a6d77];return _0x18efe8;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x2f69('0x0'))(_0x2f69('0x1'));var moment=require('moment');var BPromise=require(_0x2f69('0x2'));var rp=require(_0x2f69('0x3'));var fs=require('fs');var path=require(_0x2f69('0x4'));var rimraf=require('rimraf');var config=require(_0x2f69('0x5'));var attributes=require(_0x2f69('0x6'));module[_0x2f69('0x7')]=function(_0x46ecd8,_0x1b02e9){return _0x46ecd8[_0x2f69('0x8')]('AnalyticExtractedReport',attributes,{'tableName':_0x2f69('0x9'),'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 39dad94..2139d96 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 _0xb22e=['then','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x21d105,_0x157e99){var _0x2523dc=function(_0x2de3c9){while(--_0x2de3c9){_0x21d105['push'](_0x21d105['shift']());}};_0x2523dc(++_0x157e99);}(_0xb22e,0xf2));var _0xeb22=function(_0x51907b,_0x473607){_0x51907b=_0x51907b-0x0;var _0x488abb=_0xb22e[_0x51907b];return _0x488abb;};'use strict';var _=require(_0xeb22('0x0'));var util=require(_0xeb22('0x1'));var moment=require(_0xeb22('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xeb22('0x3'));var db=require(_0xeb22('0x4'))['db'];var utils=require(_0xeb22('0x5'));var logger=require(_0xeb22('0x6'))(_0xeb22('0x7'));var config=require(_0xeb22('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xeb22('0x9')][_0xeb22('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x58fb35,_0x2d2edc,_0x57ec18){return new BPromise(function(_0x31f3de,_0xea454d){return client['request'](_0x58fb35,_0x57ec18)[_0xeb22('0xb')](function(_0x3fefe6){logger[_0xeb22('0xc')](_0xeb22('0xd'),_0x2d2edc,_0xeb22('0xe'));logger[_0xeb22('0xf')](_0xeb22('0x10'),_0x2d2edc,'request\x20sent',JSON[_0xeb22('0x11')](_0x3fefe6));if(_0x3fefe6[_0xeb22('0x12')]){if(_0x3fefe6[_0xeb22('0x12')][_0xeb22('0x13')]===0x1f4){logger[_0xeb22('0x12')](_0xeb22('0xd'),_0x2d2edc,_0x3fefe6[_0xeb22('0x12')]['message']);return _0xea454d(_0x3fefe6[_0xeb22('0x12')][_0xeb22('0x14')]);}logger[_0xeb22('0x12')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x2d2edc,_0x3fefe6[_0xeb22('0x12')]['message']);return _0x31f3de(_0x3fefe6[_0xeb22('0x12')][_0xeb22('0x14')]);}else{logger[_0xeb22('0xc')](_0xeb22('0xd'),_0x2d2edc,'request\x20sent');_0x31f3de(_0x3fefe6[_0xeb22('0x15')][_0xeb22('0x14')]);}})[_0xeb22('0x16')](function(_0x5e0389){logger[_0xeb22('0x12')](_0xeb22('0xd'),_0x2d2edc,_0x5e0389);_0xea454d(_0x5e0389);});});} \ No newline at end of file +var _0x4a2c=['info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4a2c,0xfb));var _0xc4a2=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0x4a2c[_0x47e7cb];return _0x2a8874;};'use strict';var _=require(_0xc4a2('0x0'));var util=require(_0xc4a2('0x1'));var moment=require('moment');var BPromise=require(_0xc4a2('0x2'));var rs=require(_0xc4a2('0x3'));var fs=require('fs');var Redis=require(_0xc4a2('0x4'));var db=require(_0xc4a2('0x5'))['db'];var utils=require(_0xc4a2('0x6'));var logger=require(_0xc4a2('0x7'))('rpc');var config=require(_0xc4a2('0x8'));var jayson=require(_0xc4a2('0x9'));var client=jayson[_0xc4a2('0xa')][_0xc4a2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x580975,_0x1e0cef,_0x6f657a){return new BPromise(function(_0x480858,_0x3050c4){return client['request'](_0x580975,_0x6f657a)[_0xc4a2('0xc')](function(_0x2863fc){logger[_0xc4a2('0xd')](_0xc4a2('0xe'),_0x1e0cef,_0xc4a2('0xf'));logger[_0xc4a2('0x10')](_0xc4a2('0x11'),_0x1e0cef,_0xc4a2('0xf'),JSON[_0xc4a2('0x12')](_0x2863fc));if(_0x2863fc['error']){if(_0x2863fc[_0xc4a2('0x13')]['code']===0x1f4){logger[_0xc4a2('0x13')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x1e0cef,_0x2863fc[_0xc4a2('0x13')][_0xc4a2('0x14')]);return _0x3050c4(_0x2863fc[_0xc4a2('0x13')][_0xc4a2('0x14')]);}logger['error'](_0xc4a2('0xe'),_0x1e0cef,_0x2863fc[_0xc4a2('0x13')]['message']);return _0x480858(_0x2863fc[_0xc4a2('0x13')][_0xc4a2('0x14')]);}else{logger[_0xc4a2('0xd')](_0xc4a2('0xe'),_0x1e0cef,_0xc4a2('0xf'));_0x480858(_0x2863fc[_0xc4a2('0x15')][_0xc4a2('0x14')]);}})['catch'](function(_0x2095e3){logger['error'](_0xc4a2('0xe'),_0x1e0cef,_0x2095e3);_0x3050c4(_0x2095e3);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index ac5bc12..264fcc0 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 _0xb325=['put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','/:id','get','/:id/download','download','post','create'];(function(_0x14bb26,_0x338a81){var _0x7c0e19=function(_0x3e935e){while(--_0x3e935e){_0x14bb26['push'](_0x14bb26['shift']());}};_0x7c0e19(++_0x338a81);}(_0xb325,0x191));var _0x5b32=function(_0x4b4d21,_0x55b44b){_0x4b4d21=_0x4b4d21-0x0;var _0x2ef303=_0xb325[_0x4b4d21];return _0x2ef303;};'use strict';var multer=require(_0x5b32('0x0'));var util=require('util');var path=require(_0x5b32('0x1'));var timeout=require(_0x5b32('0x2'));var express=require(_0x5b32('0x3'));var router=express[_0x5b32('0x4')]();var fs_extra=require(_0x5b32('0x5'));var auth=require(_0x5b32('0x6'));var interaction=require(_0x5b32('0x7'));var config=require(_0x5b32('0x8'));var controller=require('./analyticExtractedReport.controller');router['get']('/',auth[_0x5b32('0x9')](),controller[_0x5b32('0xa')]);router['get'](_0x5b32('0xb'),auth[_0x5b32('0x9')](),controller['show']);router[_0x5b32('0xc')](_0x5b32('0xd'),auth[_0x5b32('0x9')](),controller[_0x5b32('0xe')]);router[_0x5b32('0xf')]('/',auth['isAuthenticated'](),controller[_0x5b32('0x10')]);router[_0x5b32('0x11')]('/:id',auth[_0x5b32('0x9')](),controller[_0x5b32('0x12')]);router[_0x5b32('0x13')](_0x5b32('0xb'),auth['isAuthenticated'](),controller[_0x5b32('0x14')]);module[_0x5b32('0x15')]=router; \ No newline at end of file +var _0x36cd=['multer','express','fs-extra','../../components/auth/service','../../config/environment','./analyticExtractedReport.controller','isAuthenticated','index','/:id','show','get','/:id/download','download','post','create','put','delete'];(function(_0x2005b8,_0x2718b6){var _0x2b604e=function(_0x56c152){while(--_0x56c152){_0x2005b8['push'](_0x2005b8['shift']());}};_0x2b604e(++_0x2718b6);}(_0x36cd,0x1dc));var _0xd36c=function(_0x4d4c19,_0x3147ff){_0x4d4c19=_0x4d4c19-0x0;var _0xf9e510=_0x36cd[_0x4d4c19];return _0xf9e510;};'use strict';var multer=require(_0xd36c('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xd36c('0x1'));var router=express['Router']();var fs_extra=require(_0xd36c('0x2'));var auth=require(_0xd36c('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xd36c('0x4'));var controller=require(_0xd36c('0x5'));router['get']('/',auth[_0xd36c('0x6')](),controller[_0xd36c('0x7')]);router['get'](_0xd36c('0x8'),auth['isAuthenticated'](),controller[_0xd36c('0x9')]);router[_0xd36c('0xa')](_0xd36c('0xb'),auth[_0xd36c('0x6')](),controller[_0xd36c('0xc')]);router[_0xd36c('0xd')]('/',auth[_0xd36c('0x6')](),controller[_0xd36c('0xe')]);router[_0xd36c('0xf')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xd36c('0x10')]('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index 4916a7a..f633fd3 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 _0xd67b=['sequelize','exports','TEXT','STRING','BOOLEAN'];(function(_0x2f0496,_0x1b9148){var _0x4969df=function(_0x1cb905){while(--_0x1cb905){_0x2f0496['push'](_0x2f0496['shift']());}};_0x4969df(++_0x1b9148);}(_0xd67b,0xaf));var _0xbd67=function(_0x3f633d,_0x202ab8){_0x3f633d=_0x3f633d-0x0;var _0x5e7994=_0xd67b[_0x3f633d];return _0x5e7994;};'use strict';var Sequelize=require(_0xbd67('0x0'));module[_0xbd67('0x1')]={'field':{'type':Sequelize[_0xbd67('0x2')]},'alias':{'type':Sequelize[_0xbd67('0x3')]},'function':{'type':Sequelize[_0xbd67('0x3')]},'format':{'type':Sequelize['STRING']},'groupBy':{'type':Sequelize[_0xbd67('0x4')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0xbd67('0x3')]},'custom':{'type':Sequelize[_0xbd67('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0x78dc=['STRING','BOOLEAN','sequelize','exports','TEXT'];(function(_0x58675f,_0x390355){var _0x1cc7f0=function(_0x31d6d6){while(--_0x31d6d6){_0x58675f['push'](_0x58675f['shift']());}};_0x1cc7f0(++_0x390355);}(_0x78dc,0x1e7));var _0xc78d=function(_0x29771f,_0x1189ae){_0x29771f=_0x29771f-0x0;var _0x279baf=_0x78dc[_0x29771f];return _0x279baf;};'use strict';var Sequelize=require(_0xc78d('0x0'));module[_0xc78d('0x1')]={'field':{'type':Sequelize[_0xc78d('0x2')]},'alias':{'type':Sequelize['STRING']},'function':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0xc78d('0x3')]},'groupBy':{'type':Sequelize[_0xc78d('0x4')],'defaultValue':![]},'orderBy':{'type':Sequelize['STRING']},'custom':{'type':Sequelize[_0xc78d('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index 68d28c3..d1df7a9 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 _0x3b86=['model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','include','rows','catch','show','params','keys','rawAttributes','create','body','bulkCreate','update','find','bulkDestroy','destroy','ids','addFields','AnalyticCustomReport','findOne','sequelize','transaction','findAll','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','count','limit','Content-Range','apply','reject','save','then','error','stack','name','index','map','AnalyticFieldReport','fieldName','type','key'];(function(_0xc0f69f,_0x471ae5){var _0x18d76d=function(_0x1df04b){while(--_0x1df04b){_0xc0f69f['push'](_0xc0f69f['shift']());}};_0x18d76d(++_0x471ae5);}(_0x3b86,0x1da));var _0x63b8=function(_0x2d8e40,_0x306bb4){_0x2d8e40=_0x2d8e40-0x0;var _0x2da360=_0x3b86[_0x2d8e40];return _0x2da360;};'use strict';var emlformat=require(_0x63b8('0x0'));var rimraf=require(_0x63b8('0x1'));var zipdir=require(_0x63b8('0x2'));var jsonpatch=require(_0x63b8('0x3'));var rp=require('request-promise');var moment=require(_0x63b8('0x4'));var BPromise=require(_0x63b8('0x5'));var Mustache=require('mustache');var util=require(_0x63b8('0x6'));var path=require(_0x63b8('0x7'));var sox=require(_0x63b8('0x8'));var csv=require('to-csv');var ejs=require(_0x63b8('0x9'));var fs=require('fs');var fs_extra=require(_0x63b8('0xa'));var _=require(_0x63b8('0xb'));var squel=require(_0x63b8('0xc'));var crypto=require(_0x63b8('0xd'));var jsforce=require(_0x63b8('0xe'));var deskjs=require(_0x63b8('0xf'));var toCsv=require(_0x63b8('0x10'));var querystring=require(_0x63b8('0x11'));var Papa=require('papaparse');var Redis=require(_0x63b8('0x12'));var authService=require(_0x63b8('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x63b8('0x14'));var hardwareService=require(_0x63b8('0x15'));var logger=require('../../config/logger')(_0x63b8('0x16'));var utils=require(_0x63b8('0x17'));var config=require(_0x63b8('0x18'));var licenseUtil=require(_0x63b8('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3f8598,_0x3218b5){_0x3218b5=_0x3218b5||0xcc;return function(_0x2811aa){if(_0x2811aa){return _0x3f8598[_0x63b8('0x1a')](_0x3218b5);}return _0x3f8598['status'](_0x3218b5)[_0x63b8('0x1b')]();};}function respondWithResult(_0x4d4128,_0x76c055){_0x76c055=_0x76c055||0xc8;return function(_0xd2fcc1){if(_0xd2fcc1){return _0x4d4128[_0x63b8('0x1c')](_0x76c055)[_0x63b8('0x1d')](_0xd2fcc1);}};}function respondWithFilteredResult(_0x4bd90e,_0x470ac5){return function(_0x4a53f9){if(_0x4a53f9){var _0x1e0521=typeof _0x470ac5[_0x63b8('0x1e')]===_0x63b8('0x1f')&&typeof _0x470ac5['limit']==='undefined';var _0x5a1b04=_0x4a53f9['count'];var _0x597631=_0x1e0521?0x0:_0x470ac5['offset'];var _0x5159f5=_0x1e0521?_0x4a53f9[_0x63b8('0x20')]:_0x470ac5[_0x63b8('0x1e')]+_0x470ac5[_0x63b8('0x21')];var _0x5df28e;if(_0x5159f5>=_0x5a1b04){_0x5159f5=_0x5a1b04;_0x5df28e=0xc8;}else{_0x5df28e=0xce;}_0x4bd90e['status'](_0x5df28e);return _0x4bd90e['set'](_0x63b8('0x22'),_0x597631+'-'+_0x5159f5+'/'+_0x5a1b04)[_0x63b8('0x1d')](_0x4a53f9);}return null;};}function patchUpdates(_0x1c2794){return function(_0xcae2ea){try{jsonpatch[_0x63b8('0x23')](_0xcae2ea,_0x1c2794,!![]);}catch(_0x37a2cd){return BPromise[_0x63b8('0x24')](_0x37a2cd);}return _0xcae2ea[_0x63b8('0x25')]();};}function saveUpdates(_0x4be606,_0x2daa71){return function(_0xd1e28b){if(_0xd1e28b){return _0xd1e28b['update'](_0x4be606)[_0x63b8('0x26')](function(_0x5192e9){return _0x5192e9;});}return null;};}function removeEntity(_0x3f28ef,_0x4a5da0){return function(_0x336b6f){if(_0x336b6f){return _0x336b6f['destroy']()[_0x63b8('0x26')](function(){_0x3f28ef['status'](0xcc)[_0x63b8('0x1b')]();});}};}function handleEntityNotFound(_0x23109d,_0x162d09){return function(_0x52d3d1){if(!_0x52d3d1){_0x23109d[_0x63b8('0x1a')](0x194);}return _0x52d3d1;};}function handleError(_0x2ac639,_0x57a459){_0x57a459=_0x57a459||0x1f4;return function(_0x5ce518){logger[_0x63b8('0x27')](_0x5ce518[_0x63b8('0x28')]);if(_0x5ce518[_0x63b8('0x29')]){delete _0x5ce518[_0x63b8('0x29')];}_0x2ac639['status'](_0x57a459)['send'](_0x5ce518);};}exports[_0x63b8('0x2a')]=function(_0x1f1ce9,_0xe1aa9){var _0x13fb1f={},_0x1ebb98={},_0x1cdc30={'count':0x0,'rows':[]};var _0x53637c=_[_0x63b8('0x2b')](db[_0x63b8('0x2c')]['rawAttributes'],function(_0x12067f){return{'name':_0x12067f[_0x63b8('0x2d')],'type':_0x12067f[_0x63b8('0x2e')][_0x63b8('0x2f')]};});_0x1ebb98[_0x63b8('0x30')]=_[_0x63b8('0x2b')](_0x53637c,_0x63b8('0x29'));_0x1ebb98['query']=_['keys'](_0x1f1ce9[_0x63b8('0x31')]);_0x1ebb98['filters']=_[_0x63b8('0x32')](_0x1ebb98['model'],_0x1ebb98['query']);_0x13fb1f['attributes']=_['intersection'](_0x1ebb98[_0x63b8('0x30')],qs[_0x63b8('0x33')](_0x1f1ce9[_0x63b8('0x31')][_0x63b8('0x33')]));_0x13fb1f[_0x63b8('0x34')]=_0x13fb1f['attributes'][_0x63b8('0x35')]?_0x13fb1f[_0x63b8('0x34')]:_0x1ebb98[_0x63b8('0x30')];if(!_0x1f1ce9[_0x63b8('0x31')][_0x63b8('0x36')](_0x63b8('0x37'))){_0x13fb1f[_0x63b8('0x21')]=qs['limit'](_0x1f1ce9['query'][_0x63b8('0x21')]);_0x13fb1f[_0x63b8('0x1e')]=qs[_0x63b8('0x1e')](_0x1f1ce9['query'][_0x63b8('0x1e')]);}_0x13fb1f[_0x63b8('0x38')]=qs[_0x63b8('0x39')](_0x1f1ce9[_0x63b8('0x31')][_0x63b8('0x39')]);_0x13fb1f[_0x63b8('0x3a')]=qs[_0x63b8('0x3b')](_[_0x63b8('0x3c')](_0x1f1ce9[_0x63b8('0x31')],_0x1ebb98[_0x63b8('0x3b')]),_0x53637c);if(_0x1f1ce9['query']['filter']){_0x13fb1f[_0x63b8('0x3a')]=_[_0x63b8('0x3d')](_0x13fb1f[_0x63b8('0x3a')],{'$or':_[_0x63b8('0x2b')](_0x53637c,function(_0x1e8683){if(_0x1e8683[_0x63b8('0x2e')]!==_0x63b8('0x3e')){var _0xe8a6b8={};_0xe8a6b8[_0x1e8683[_0x63b8('0x29')]]={'$like':'%'+_0x1f1ce9[_0x63b8('0x31')][_0x63b8('0x3f')]+'%'};return _0xe8a6b8;}})});}_0x13fb1f=_[_0x63b8('0x3d')]({},_0x13fb1f,_0x1f1ce9[_0x63b8('0x40')]);var _0x4dc74e={'where':_0x13fb1f[_0x63b8('0x3a')]};return db[_0x63b8('0x2c')][_0x63b8('0x20')](_0x4dc74e)[_0x63b8('0x26')](function(_0x2e4fc2){_0x1cdc30[_0x63b8('0x20')]=_0x2e4fc2;if(_0x1f1ce9[_0x63b8('0x31')][_0x63b8('0x41')]){_0x13fb1f[_0x63b8('0x42')]=[{'all':!![]}];}return db[_0x63b8('0x2c')]['findAll'](_0x13fb1f);})[_0x63b8('0x26')](function(_0x2f9c35){_0x1cdc30[_0x63b8('0x43')]=_0x2f9c35;return _0x1cdc30;})[_0x63b8('0x26')](respondWithFilteredResult(_0xe1aa9,_0x13fb1f))[_0x63b8('0x44')](handleError(_0xe1aa9,null));};exports[_0x63b8('0x45')]=function(_0xdfa686,_0x31cb6b){var _0xf996a1={'raw':![],'where':{'id':_0xdfa686[_0x63b8('0x46')]['id']}},_0x1d1f28={};_0x1d1f28[_0x63b8('0x30')]=_[_0x63b8('0x47')](db[_0x63b8('0x2c')][_0x63b8('0x48')]);_0x1d1f28['query']=_[_0x63b8('0x47')](_0xdfa686[_0x63b8('0x31')]);_0x1d1f28['filters']=_[_0x63b8('0x32')](_0x1d1f28[_0x63b8('0x30')],_0x1d1f28[_0x63b8('0x31')]);_0xf996a1[_0x63b8('0x34')]=_[_0x63b8('0x32')](_0x1d1f28['model'],qs['fields'](_0xdfa686[_0x63b8('0x31')]['fields']));_0xf996a1['attributes']=_0xf996a1[_0x63b8('0x34')][_0x63b8('0x35')]?_0xf996a1['attributes']:_0x1d1f28[_0x63b8('0x30')];if(_0xdfa686['query'][_0x63b8('0x41')]){_0xf996a1[_0x63b8('0x42')]=[{'all':!![]}];}_0xf996a1=_[_0x63b8('0x3d')]({},_0xf996a1,_0xdfa686[_0x63b8('0x40')]);return db[_0x63b8('0x2c')]['find'](_0xf996a1)[_0x63b8('0x26')](handleEntityNotFound(_0x31cb6b,null))[_0x63b8('0x26')](respondWithResult(_0x31cb6b,null))['catch'](handleError(_0x31cb6b,null));};exports[_0x63b8('0x49')]=function(_0x30c279,_0x4935c2){return db[_0x63b8('0x2c')][_0x63b8('0x49')](_0x30c279[_0x63b8('0x4a')],{})[_0x63b8('0x26')](respondWithResult(_0x4935c2,0xc9))[_0x63b8('0x44')](handleError(_0x4935c2,null));};exports[_0x63b8('0x4b')]=function(_0x54cdc7,_0xb19a3e){return db[_0x63b8('0x2c')][_0x63b8('0x4b')](_0x54cdc7['body'],{'raw':![],'individualHooks':!![]})[_0x63b8('0x26')](respondWithResult(_0xb19a3e,0xc9))[_0x63b8('0x44')](handleError(_0xb19a3e,null));};exports[_0x63b8('0x4c')]=function(_0xbf0d3b,_0x194785){if(_0xbf0d3b['body']['id']){delete _0xbf0d3b[_0x63b8('0x4a')]['id'];}return db[_0x63b8('0x2c')][_0x63b8('0x4d')]({'where':{'id':_0xbf0d3b[_0x63b8('0x46')]['id']}})[_0x63b8('0x26')](handleEntityNotFound(_0x194785,null))[_0x63b8('0x26')](saveUpdates(_0xbf0d3b[_0x63b8('0x4a')],null))[_0x63b8('0x26')](respondWithResult(_0x194785,null))['catch'](handleError(_0x194785,null));};exports['destroy']=function(_0x483f52,_0x83d0b4){return db[_0x63b8('0x2c')][_0x63b8('0x4d')]({'where':{'id':_0x483f52[_0x63b8('0x46')]['id']}})[_0x63b8('0x26')](handleEntityNotFound(_0x83d0b4,null))[_0x63b8('0x26')](removeEntity(_0x83d0b4,null))[_0x63b8('0x44')](handleError(_0x83d0b4,null));};exports[_0x63b8('0x4e')]=function(_0x7a27d2,_0x370576){return db[_0x63b8('0x2c')][_0x63b8('0x4f')]({'where':{'id':_0x7a27d2[_0x63b8('0x31')][_0x63b8('0x50')]||[]},'raw':![],'individualHooks':!![]})[_0x63b8('0x26')](respondWithResult(_0x370576,0xcc))['catch'](handleError(_0x370576,null));};exports[_0x63b8('0x51')]=function(_0x1f1249,_0x2647af,_0x50986d){return db[_0x63b8('0x52')][_0x63b8('0x53')]({'where':{'id':_0x1f1249[_0x63b8('0x46')]['id']}})[_0x63b8('0x26')](handleEntityNotFound(_0x2647af,null))['then'](function(_0x3307d3){if(_0x3307d3){return db[_0x63b8('0x54')][_0x63b8('0x55')](function(_0xe51323){return db['AnalyticFieldReport'][_0x63b8('0x4f')]({'where':{'CustomReportId':_0x1f1249[_0x63b8('0x46')]['id']},'transaction':_0xe51323})[_0x63b8('0x26')](function(_0x221264){var _0x207627=_[_0x63b8('0x2b')](_0x1f1249[_0x63b8('0x4a')],function(_0x51ca11){delete _0x51ca11['id'];_0x51ca11['CustomReportId']=_0x1f1249[_0x63b8('0x46')]['id'];return _0x51ca11;});return db[_0x63b8('0x2c')][_0x63b8('0x4b')](_0x207627,{'transaction':_0xe51323});});})[_0x63b8('0x26')](function(){return db[_0x63b8('0x2c')][_0x63b8('0x56')]({'where':{'CustomReportId':_0x1f1249[_0x63b8('0x46')]['id']}});});}})[_0x63b8('0x26')](respondWithResult(_0x2647af,null))['catch'](handleError(_0x2647af,null));}; \ No newline at end of file +var _0xa67d=['nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','create','catch','bulkCreate','body','find','ids','addFields','AnalyticCustomReport','findOne','sequelize','transaction','CustomReportId','eml-format','zip-dir','fast-json-patch','moment','mustache','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','sendStatus','json','offset','limit','undefined','count','status','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','AnalyticFieldReport','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','hasOwnProperty'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xa67d,0x6e));var _0xda67=function(_0x375e04,_0x27dad6){_0x375e04=_0x375e04-0x0;var _0x250b96=_0xa67d[_0x375e04];return _0x250b96;};'use strict';var emlformat=require(_0xda67('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xda67('0x1'));var jsonpatch=require(_0xda67('0x2'));var rp=require('request-promise');var moment=require(_0xda67('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xda67('0x4'));var util=require('util');var path=require('path');var sox=require(_0xda67('0x5'));var csv=require(_0xda67('0x6'));var ejs=require(_0xda67('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xda67('0x8'));var squel=require(_0xda67('0x9'));var crypto=require(_0xda67('0xa'));var jsforce=require(_0xda67('0xb'));var deskjs=require(_0xda67('0xc'));var toCsv=require(_0xda67('0x6'));var querystring=require(_0xda67('0xd'));var Papa=require(_0xda67('0xe'));var Redis=require(_0xda67('0xf'));var authService=require(_0xda67('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xda67('0x11'));var hardwareService=require(_0xda67('0x12'));var logger=require('../../config/logger')(_0xda67('0x13'));var utils=require('../../config/utils');var config=require(_0xda67('0x14'));var licenseUtil=require(_0xda67('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2c76d9,_0x25e85a){_0x25e85a=_0x25e85a||0xcc;return function(_0x119c64){if(_0x119c64){return _0x2c76d9[_0xda67('0x16')](_0x25e85a);}return _0x2c76d9['status'](_0x25e85a)['end']();};}function respondWithResult(_0x41d94f,_0x573eac){_0x573eac=_0x573eac||0xc8;return function(_0x2e0b02){if(_0x2e0b02){return _0x41d94f['status'](_0x573eac)[_0xda67('0x17')](_0x2e0b02);}};}function respondWithFilteredResult(_0x1c0222,_0x18ffb0){return function(_0x1839a0){if(_0x1839a0){var _0x3478ae=typeof _0x18ffb0[_0xda67('0x18')]==='undefined'&&typeof _0x18ffb0[_0xda67('0x19')]===_0xda67('0x1a');var _0x2dc435=_0x1839a0[_0xda67('0x1b')];var _0x59aef2=_0x3478ae?0x0:_0x18ffb0[_0xda67('0x18')];var _0x29760b=_0x3478ae?_0x1839a0[_0xda67('0x1b')]:_0x18ffb0[_0xda67('0x18')]+_0x18ffb0[_0xda67('0x19')];var _0x21942c;if(_0x29760b>=_0x2dc435){_0x29760b=_0x2dc435;_0x21942c=0xc8;}else{_0x21942c=0xce;}_0x1c0222[_0xda67('0x1c')](_0x21942c);return _0x1c0222['set'](_0xda67('0x1d'),_0x59aef2+'-'+_0x29760b+'/'+_0x2dc435)[_0xda67('0x17')](_0x1839a0);}return null;};}function patchUpdates(_0xbc7e09){return function(_0x3f7d04){try{jsonpatch[_0xda67('0x1e')](_0x3f7d04,_0xbc7e09,!![]);}catch(_0xe1b578){return BPromise[_0xda67('0x1f')](_0xe1b578);}return _0x3f7d04[_0xda67('0x20')]();};}function saveUpdates(_0x1482f2,_0x59a862){return function(_0x25b070){if(_0x25b070){return _0x25b070[_0xda67('0x21')](_0x1482f2)[_0xda67('0x22')](function(_0x2b3d29){return _0x2b3d29;});}return null;};}function removeEntity(_0x16d2f2,_0x420bd3){return function(_0x39dcf1){if(_0x39dcf1){return _0x39dcf1[_0xda67('0x23')]()[_0xda67('0x22')](function(){_0x16d2f2[_0xda67('0x1c')](0xcc)[_0xda67('0x24')]();});}};}function handleEntityNotFound(_0x41ac23,_0x5cf0bd){return function(_0x2c3136){if(!_0x2c3136){_0x41ac23[_0xda67('0x16')](0x194);}return _0x2c3136;};}function handleError(_0xcc68df,_0x33f53e){_0x33f53e=_0x33f53e||0x1f4;return function(_0x295414){logger[_0xda67('0x25')](_0x295414[_0xda67('0x26')]);if(_0x295414[_0xda67('0x27')]){delete _0x295414[_0xda67('0x27')];}_0xcc68df[_0xda67('0x1c')](_0x33f53e)[_0xda67('0x28')](_0x295414);};}exports[_0xda67('0x29')]=function(_0xfa688a,_0x5afc59){var _0x5848bb={},_0x2df52d={},_0x2980bb={'count':0x0,'rows':[]};var _0x136a70=_['map'](db[_0xda67('0x2a')][_0xda67('0x2b')],function(_0x4e3df7){return{'name':_0x4e3df7[_0xda67('0x2c')],'type':_0x4e3df7[_0xda67('0x2d')][_0xda67('0x2e')]};});_0x2df52d[_0xda67('0x2f')]=_[_0xda67('0x30')](_0x136a70,_0xda67('0x27'));_0x2df52d[_0xda67('0x31')]=_[_0xda67('0x32')](_0xfa688a[_0xda67('0x31')]);_0x2df52d[_0xda67('0x33')]=_['intersection'](_0x2df52d[_0xda67('0x2f')],_0x2df52d[_0xda67('0x31')]);_0x5848bb[_0xda67('0x34')]=_[_0xda67('0x35')](_0x2df52d[_0xda67('0x2f')],qs['fields'](_0xfa688a[_0xda67('0x31')][_0xda67('0x36')]));_0x5848bb['attributes']=_0x5848bb[_0xda67('0x34')]['length']?_0x5848bb[_0xda67('0x34')]:_0x2df52d[_0xda67('0x2f')];if(!_0xfa688a['query'][_0xda67('0x37')](_0xda67('0x38'))){_0x5848bb[_0xda67('0x19')]=qs[_0xda67('0x19')](_0xfa688a['query']['limit']);_0x5848bb['offset']=qs[_0xda67('0x18')](_0xfa688a[_0xda67('0x31')]['offset']);}_0x5848bb[_0xda67('0x39')]=qs[_0xda67('0x3a')](_0xfa688a[_0xda67('0x31')][_0xda67('0x3a')]);_0x5848bb[_0xda67('0x3b')]=qs['filters'](_[_0xda67('0x3c')](_0xfa688a[_0xda67('0x31')],_0x2df52d[_0xda67('0x33')]),_0x136a70);if(_0xfa688a[_0xda67('0x31')][_0xda67('0x3d')]){_0x5848bb[_0xda67('0x3b')]=_['merge'](_0x5848bb[_0xda67('0x3b')],{'$or':_[_0xda67('0x30')](_0x136a70,function(_0x22a5c8){if(_0x22a5c8[_0xda67('0x2d')]!==_0xda67('0x3e')){var _0xcb5db={};_0xcb5db[_0x22a5c8[_0xda67('0x27')]]={'$like':'%'+_0xfa688a[_0xda67('0x31')][_0xda67('0x3d')]+'%'};return _0xcb5db;}})});}_0x5848bb=_[_0xda67('0x3f')]({},_0x5848bb,_0xfa688a[_0xda67('0x40')]);var _0x5f5c8d={'where':_0x5848bb[_0xda67('0x3b')]};return db[_0xda67('0x2a')]['count'](_0x5f5c8d)['then'](function(_0x271d59){_0x2980bb['count']=_0x271d59;if(_0xfa688a[_0xda67('0x31')][_0xda67('0x41')]){_0x5848bb[_0xda67('0x42')]=[{'all':!![]}];}return db[_0xda67('0x2a')][_0xda67('0x43')](_0x5848bb);})[_0xda67('0x22')](function(_0x4b76db){_0x2980bb[_0xda67('0x44')]=_0x4b76db;return _0x2980bb;})[_0xda67('0x22')](respondWithFilteredResult(_0x5afc59,_0x5848bb))['catch'](handleError(_0x5afc59,null));};exports[_0xda67('0x45')]=function(_0x534a07,_0x37d74f){var _0x1efc69={'raw':![],'where':{'id':_0x534a07[_0xda67('0x46')]['id']}},_0x3c8fd7={};_0x3c8fd7[_0xda67('0x2f')]=_[_0xda67('0x32')](db['AnalyticFieldReport'][_0xda67('0x2b')]);_0x3c8fd7[_0xda67('0x31')]=_['keys'](_0x534a07[_0xda67('0x31')]);_0x3c8fd7[_0xda67('0x33')]=_[_0xda67('0x35')](_0x3c8fd7[_0xda67('0x2f')],_0x3c8fd7[_0xda67('0x31')]);_0x1efc69[_0xda67('0x34')]=_[_0xda67('0x35')](_0x3c8fd7[_0xda67('0x2f')],qs[_0xda67('0x36')](_0x534a07['query']['fields']));_0x1efc69[_0xda67('0x34')]=_0x1efc69['attributes']['length']?_0x1efc69[_0xda67('0x34')]:_0x3c8fd7['model'];if(_0x534a07[_0xda67('0x31')][_0xda67('0x41')]){_0x1efc69['include']=[{'all':!![]}];}_0x1efc69=_['merge']({},_0x1efc69,_0x534a07['options']);return db[_0xda67('0x2a')]['find'](_0x1efc69)[_0xda67('0x22')](handleEntityNotFound(_0x37d74f,null))[_0xda67('0x22')](respondWithResult(_0x37d74f,null))['catch'](handleError(_0x37d74f,null));};exports[_0xda67('0x47')]=function(_0x108713,_0x2ecffd){return db[_0xda67('0x2a')]['create'](_0x108713['body'],{})[_0xda67('0x22')](respondWithResult(_0x2ecffd,0xc9))[_0xda67('0x48')](handleError(_0x2ecffd,null));};exports[_0xda67('0x49')]=function(_0x2a7924,_0x432609){return db['AnalyticFieldReport'][_0xda67('0x49')](_0x2a7924[_0xda67('0x4a')],{'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x432609,0xc9))[_0xda67('0x48')](handleError(_0x432609,null));};exports['update']=function(_0x589836,_0x3a795a){if(_0x589836[_0xda67('0x4a')]['id']){delete _0x589836[_0xda67('0x4a')]['id'];}return db[_0xda67('0x2a')][_0xda67('0x4b')]({'where':{'id':_0x589836[_0xda67('0x46')]['id']}})[_0xda67('0x22')](handleEntityNotFound(_0x3a795a,null))[_0xda67('0x22')](saveUpdates(_0x589836[_0xda67('0x4a')],null))[_0xda67('0x22')](respondWithResult(_0x3a795a,null))[_0xda67('0x48')](handleError(_0x3a795a,null));};exports[_0xda67('0x23')]=function(_0x555de0,_0x2a185b){return db[_0xda67('0x2a')][_0xda67('0x4b')]({'where':{'id':_0x555de0[_0xda67('0x46')]['id']}})[_0xda67('0x22')](handleEntityNotFound(_0x2a185b,null))['then'](removeEntity(_0x2a185b,null))[_0xda67('0x48')](handleError(_0x2a185b,null));};exports['bulkDestroy']=function(_0xe5bb00,_0x5d87ce){return db[_0xda67('0x2a')][_0xda67('0x23')]({'where':{'id':_0xe5bb00[_0xda67('0x31')][_0xda67('0x4c')]||[]},'raw':![],'individualHooks':!![]})[_0xda67('0x22')](respondWithResult(_0x5d87ce,0xcc))[_0xda67('0x48')](handleError(_0x5d87ce,null));};exports[_0xda67('0x4d')]=function(_0x36792a,_0x118171,_0x87df63){return db[_0xda67('0x4e')][_0xda67('0x4f')]({'where':{'id':_0x36792a[_0xda67('0x46')]['id']}})['then'](handleEntityNotFound(_0x118171,null))['then'](function(_0x559815){if(_0x559815){return db[_0xda67('0x50')][_0xda67('0x51')](function(_0x137a12){return db[_0xda67('0x2a')][_0xda67('0x23')]({'where':{'CustomReportId':_0x36792a[_0xda67('0x46')]['id']},'transaction':_0x137a12})[_0xda67('0x22')](function(_0x19bde6){var _0x51c9c0=_[_0xda67('0x30')](_0x36792a[_0xda67('0x4a')],function(_0x3f88b3){delete _0x3f88b3['id'];_0x3f88b3[_0xda67('0x52')]=_0x36792a[_0xda67('0x46')]['id'];return _0x3f88b3;});return db[_0xda67('0x2a')][_0xda67('0x49')](_0x51c9c0,{'transaction':_0x137a12});});})[_0xda67('0x22')](function(){return db['AnalyticFieldReport']['findAll']({'where':{'CustomReportId':_0x36792a[_0xda67('0x46')]['id']}});});}})['then'](respondWithResult(_0x118171,null))[_0xda67('0x48')](handleError(_0x118171,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index f0cf379..91a7de0 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 _0xc850=['./analyticFieldReport.attributes','exports','define','analytics_report_fields','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xc850,0xa0));var _0x0c85=function(_0x487933,_0x77076d){_0x487933=_0x487933-0x0;var _0x741518=_0xc850[_0x487933];return _0x741518;};'use strict';var _=require(_0x0c85('0x0'));var util=require(_0x0c85('0x1'));var logger=require(_0x0c85('0x2'))(_0x0c85('0x3'));var moment=require('moment');var BPromise=require(_0x0c85('0x4'));var rp=require(_0x0c85('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0c85('0x6'));var config=require(_0x0c85('0x7'));var attributes=require(_0x0c85('0x8'));module[_0x0c85('0x9')]=function(_0x3c5fef,_0x14d341){return _0x3c5fef[_0x0c85('0xa')]('AnalyticFieldReport',attributes,{'tableName':_0x0c85('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb218=['define','AnalyticFieldReport','analytics_report_fields','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x17bbaa,_0x576639){var _0x4d1ffc=function(_0x15c16f){while(--_0x15c16f){_0x17bbaa['push'](_0x17bbaa['shift']());}};_0x4d1ffc(++_0x576639);}(_0xb218,0x1bd));var _0x8b21=function(_0x4f37c1,_0x3ef93d){_0x4f37c1=_0x4f37c1-0x0;var _0x2e95f5=_0xb218[_0x4f37c1];return _0x2e95f5;};'use strict';var _=require('lodash');var util=require(_0x8b21('0x0'));var logger=require(_0x8b21('0x1'))(_0x8b21('0x2'));var moment=require(_0x8b21('0x3'));var BPromise=require(_0x8b21('0x4'));var rp=require(_0x8b21('0x5'));var fs=require('fs');var path=require(_0x8b21('0x6'));var rimraf=require(_0x8b21('0x7'));var config=require(_0x8b21('0x8'));var attributes=require('./analyticFieldReport.attributes');module[_0x8b21('0x9')]=function(_0x459312,_0x18c6f4){return _0x459312[_0x8b21('0xa')](_0x8b21('0xb'),attributes,{'tableName':_0x8b21('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.rpc.js b/server/api/analyticFieldReport/analyticFieldReport.rpc.js index 7f10618..721a3d8 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 _0xad93=['error','code','AnalyticFieldReport,\x20%s,\x20%s','message','catch','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x27016c,_0x530529){var _0x50209c=function(_0x20f6f1){while(--_0x20f6f1){_0x27016c['push'](_0x27016c['shift']());}};_0x50209c(++_0x530529);}(_0xad93,0x98));var _0x3ad9=function(_0x32f845,_0x335cb9){_0x32f845=_0x32f845-0x0;var _0x3c0de4=_0xad93[_0x32f845];return _0x3c0de4;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3ad9('0x0'));var BPromise=require(_0x3ad9('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3ad9('0x2'));var db=require(_0x3ad9('0x3'))['db'];var utils=require(_0x3ad9('0x4'));var logger=require(_0x3ad9('0x5'))(_0x3ad9('0x6'));var config=require(_0x3ad9('0x7'));var jayson=require(_0x3ad9('0x8'));var client=jayson[_0x3ad9('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x48a9ae,_0x3c1a02,_0x163fdc){return new BPromise(function(_0x167416,_0x3f33ec){return client[_0x3ad9('0xa')](_0x48a9ae,_0x163fdc)[_0x3ad9('0xb')](function(_0x5b0ff3){logger['info']('AnalyticFieldReport,\x20%s,\x20%s',_0x3c1a02,_0x3ad9('0xc'));logger[_0x3ad9('0xd')](_0x3ad9('0xe'),_0x3c1a02,_0x3ad9('0xc'),JSON[_0x3ad9('0xf')](_0x5b0ff3));if(_0x5b0ff3[_0x3ad9('0x10')]){if(_0x5b0ff3[_0x3ad9('0x10')][_0x3ad9('0x11')]===0x1f4){logger['error'](_0x3ad9('0x12'),_0x3c1a02,_0x5b0ff3[_0x3ad9('0x10')][_0x3ad9('0x13')]);return _0x3f33ec(_0x5b0ff3[_0x3ad9('0x10')]['message']);}logger[_0x3ad9('0x10')]('AnalyticFieldReport,\x20%s,\x20%s',_0x3c1a02,_0x5b0ff3[_0x3ad9('0x10')][_0x3ad9('0x13')]);return _0x167416(_0x5b0ff3[_0x3ad9('0x10')][_0x3ad9('0x13')]);}else{logger['info'](_0x3ad9('0x12'),_0x3c1a02,_0x3ad9('0xc'));_0x167416(_0x5b0ff3['result'][_0x3ad9('0x13')]);}})[_0x3ad9('0x14')](function(_0x5f29c5){logger['error']('AnalyticFieldReport,\x20%s,\x20%s',_0x3c1a02,_0x5f29c5);_0x3f33ec(_0x5f29c5);});});} \ No newline at end of file +var _0x7076=['http','request','then','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','error','message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client'];(function(_0x24075e,_0x1db54a){var _0x1c2084=function(_0xf1bac3){while(--_0xf1bac3){_0x24075e['push'](_0x24075e['shift']());}};_0x1c2084(++_0x1db54a);}(_0x7076,0x1c4));var _0x6707=function(_0x556f97,_0x251b92){_0x556f97=_0x556f97-0x0;var _0x350c16=_0x7076[_0x556f97];return _0x350c16;};'use strict';var _=require(_0x6707('0x0'));var util=require(_0x6707('0x1'));var moment=require(_0x6707('0x2'));var BPromise=require(_0x6707('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6707('0x4'));var db=require(_0x6707('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x6707('0x6'));var config=require(_0x6707('0x7'));var jayson=require(_0x6707('0x8'));var client=jayson[_0x6707('0x9')][_0x6707('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x307ee5,_0x46ac73,_0x273749){return new BPromise(function(_0x456a78,_0x1ed4e6){return client[_0x6707('0xb')](_0x307ee5,_0x273749)[_0x6707('0xc')](function(_0xe6951a){logger[_0x6707('0xd')](_0x6707('0xe'),_0x46ac73,_0x6707('0xf'));logger[_0x6707('0x10')](_0x6707('0x11'),_0x46ac73,'request\x20sent',JSON['stringify'](_0xe6951a));if(_0xe6951a[_0x6707('0x12')]){if(_0xe6951a[_0x6707('0x12')]['code']===0x1f4){logger[_0x6707('0x12')]('AnalyticFieldReport,\x20%s,\x20%s',_0x46ac73,_0xe6951a[_0x6707('0x12')][_0x6707('0x13')]);return _0x1ed4e6(_0xe6951a['error'][_0x6707('0x13')]);}logger[_0x6707('0x12')](_0x6707('0xe'),_0x46ac73,_0xe6951a['error']['message']);return _0x456a78(_0xe6951a['error'][_0x6707('0x13')]);}else{logger[_0x6707('0xd')](_0x6707('0xe'),_0x46ac73,'request\x20sent');_0x456a78(_0xe6951a[_0x6707('0x14')]['message']);}})['catch'](function(_0x3db090){logger[_0x6707('0x12')]('AnalyticFieldReport,\x20%s,\x20%s',_0x46ac73,_0x3db090);_0x1ed4e6(_0x3db090);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index bd42327..ddfc7c6 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(_0x453145,_0x5963d0){var _0x15c5cb=function(_0x1aeb4b){while(--_0x1aeb4b){_0x453145['push'](_0x453145['shift']());}};_0x15c5cb(++_0x5963d0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xa9e0[_0x47a7d0];return _0xb9bd08;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['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(_0x2810ca,_0xa85ae3){var _0x12d56c=function(_0x1d209d){while(--_0x1d209d){_0x2810ca['push'](_0x2810ca['shift']());}};_0x12d56c(++_0xa85ae3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0xa9e0[_0x37bd26];return _0xe83dc4;};'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 b1f76d0..570af8c 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 _0x18a9=['name','TEXT','STRING'];(function(_0x1278f6,_0x54e8aa){var _0x2e6d5a=function(_0x123ff9){while(--_0x123ff9){_0x1278f6['push'](_0x1278f6['shift']());}};_0x2e6d5a(++_0x54e8aa);}(_0x18a9,0x15b));var _0x918a=function(_0x5b80fb,_0x232d60){_0x5b80fb=_0x5b80fb-0x0;var _0x2d29a5=_0x18a9[_0x5b80fb];return _0x2d29a5;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x918a('0x0')],'allowNull':![],'unique':_0x918a('0x1')},'table':{'type':Sequelize[_0x918a('0x0')]},'metric':{'type':Sequelize[_0x918a('0x2')]},'description':{'type':Sequelize[_0x918a('0x0')]}}; \ No newline at end of file +var _0xd403=['exports','STRING','name','TEXT','sequelize'];(function(_0x10d4c0,_0x3bf5d1){var _0x45a5a9=function(_0x5e1bd8){while(--_0x5e1bd8){_0x10d4c0['push'](_0x10d4c0['shift']());}};_0x45a5a9(++_0x3bf5d1);}(_0xd403,0x1d5));var _0x3d40=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0xd403[_0x1cc8fe];return _0x230054;};'use strict';var Sequelize=require(_0x3d40('0x0'));module[_0x3d40('0x1')]={'name':{'type':Sequelize[_0x3d40('0x2')],'allowNull':![],'unique':_0x3d40('0x3')},'table':{'type':Sequelize['STRING']},'metric':{'type':Sequelize[_0x3d40('0x4')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index 599b463..fbaae88 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 _0x5fc3=['user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','then','destroy','get','Metrics','error','stack','name','send','index','map','AnalyticMetric','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','sort','pick','filter','where','VIRTUAL','options','includeAll','include','findAll','catch','show','params','merge','create','body'];(function(_0x41e520,_0x49fcc){var _0x2d8c5b=function(_0x48d8f5){while(--_0x48d8f5){_0x41e520['push'](_0x41e520['shift']());}};_0x2d8c5b(++_0x49fcc);}(_0x5fc3,0xa8));var _0x35fc=function(_0x5b1c50,_0x56e694){_0x5b1c50=_0x5b1c50-0x0;var _0x2d379b=_0x5fc3[_0x5b1c50];return _0x2d379b;};'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(){var _0x561bf8=_0x55e9e7[_0x35fc('0x26')]({'plain':!![]});var _0x5a93df=_0x35fc('0x27');return db['UserProfileResource'][_0x35fc('0x25')]({'where':{'type':_0x5a93df,'resourceId':_0x561bf8['id']}})['then'](function(){return _0x55e9e7;});})[_0x35fc('0x24')](function(){_0x2d8183[_0x35fc('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x519264,_0x47774c){return function(_0x58edb6){if(!_0x58edb6){_0x519264[_0x35fc('0x17')](0x194);}return _0x58edb6;};}function handleError(_0x1a5d92,_0x57001c){_0x57001c=_0x57001c||0x1f4;return function(_0x26b7cb){logger[_0x35fc('0x28')](_0x26b7cb[_0x35fc('0x29')]);if(_0x26b7cb[_0x35fc('0x2a')]){delete _0x26b7cb[_0x35fc('0x2a')];}_0x1a5d92[_0x35fc('0x18')](_0x57001c)[_0x35fc('0x2b')](_0x26b7cb);};}exports[_0x35fc('0x2c')]=function(_0x54aedc,_0x1cd1ae){var _0x220931={},_0x22af18={},_0x52acc5={'count':0x0,'rows':[]};var _0xe79f52=_[_0x35fc('0x2d')](db[_0x35fc('0x2e')][_0x35fc('0x2f')],function(_0xd8a4ca){return{'name':_0xd8a4ca[_0x35fc('0x30')],'type':_0xd8a4ca[_0x35fc('0x31')][_0x35fc('0x32')]};});_0x22af18[_0x35fc('0x33')]=_[_0x35fc('0x2d')](_0xe79f52,'name');_0x22af18['query']=_[_0x35fc('0x34')](_0x54aedc['query']);_0x22af18[_0x35fc('0x35')]=_[_0x35fc('0x36')](_0x22af18[_0x35fc('0x33')],_0x22af18[_0x35fc('0x37')]);_0x220931[_0x35fc('0x38')]=_[_0x35fc('0x36')](_0x22af18['model'],qs[_0x35fc('0x39')](_0x54aedc[_0x35fc('0x37')][_0x35fc('0x39')]));_0x220931[_0x35fc('0x38')]=_0x220931[_0x35fc('0x38')][_0x35fc('0x3a')]?_0x220931['attributes']:_0x22af18[_0x35fc('0x33')];if(!_0x54aedc[_0x35fc('0x37')][_0x35fc('0x3b')]('nolimit')){_0x220931[_0x35fc('0x1c')]=qs['limit'](_0x54aedc[_0x35fc('0x37')][_0x35fc('0x1c')]);_0x220931[_0x35fc('0x1a')]=qs[_0x35fc('0x1a')](_0x54aedc['query']['offset']);}_0x220931['order']=qs[_0x35fc('0x3c')](_0x54aedc['query'][_0x35fc('0x3c')]);_0x220931['where']=qs[_0x35fc('0x35')](_[_0x35fc('0x3d')](_0x54aedc[_0x35fc('0x37')],_0x22af18[_0x35fc('0x35')]),_0xe79f52);if(_0x54aedc[_0x35fc('0x37')][_0x35fc('0x3e')]){_0x220931[_0x35fc('0x3f')]=_['merge'](_0x220931[_0x35fc('0x3f')],{'$or':_[_0x35fc('0x2d')](_0xe79f52,function(_0x4e0ce3){if(_0x4e0ce3[_0x35fc('0x31')]!==_0x35fc('0x40')){var _0x1aac67={};_0x1aac67[_0x4e0ce3[_0x35fc('0x2a')]]={'$like':'%'+_0x54aedc[_0x35fc('0x37')][_0x35fc('0x3e')]+'%'};return _0x1aac67;}})});}_0x220931=_['merge']({},_0x220931,_0x54aedc[_0x35fc('0x41')]);var _0x267858={'where':_0x220931[_0x35fc('0x3f')]};return db['AnalyticMetric'][_0x35fc('0x1d')](_0x267858)[_0x35fc('0x24')](function(_0x596919){_0x52acc5[_0x35fc('0x1d')]=_0x596919;if(_0x54aedc[_0x35fc('0x37')][_0x35fc('0x42')]){_0x220931[_0x35fc('0x43')]=[{'all':!![]}];}return db[_0x35fc('0x2e')][_0x35fc('0x44')](_0x220931);})[_0x35fc('0x24')](function(_0x3ec51f){_0x52acc5['rows']=_0x3ec51f;return _0x52acc5;})['then'](respondWithFilteredResult(_0x1cd1ae,_0x220931))[_0x35fc('0x45')](handleError(_0x1cd1ae,null));};exports[_0x35fc('0x46')]=function(_0x4fdc6d,_0x5c2e5c){var _0x4ff202={'raw':!![],'where':{'id':_0x4fdc6d[_0x35fc('0x47')]['id']}},_0x79677d={};_0x79677d['model']=_[_0x35fc('0x34')](db[_0x35fc('0x2e')][_0x35fc('0x2f')]);_0x79677d[_0x35fc('0x37')]=_['keys'](_0x4fdc6d['query']);_0x79677d['filters']=_['intersection'](_0x79677d['model'],_0x79677d[_0x35fc('0x37')]);_0x4ff202[_0x35fc('0x38')]=_['intersection'](_0x79677d[_0x35fc('0x33')],qs['fields'](_0x4fdc6d[_0x35fc('0x37')][_0x35fc('0x39')]));_0x4ff202[_0x35fc('0x38')]=_0x4ff202[_0x35fc('0x38')][_0x35fc('0x3a')]?_0x4ff202['attributes']:_0x79677d[_0x35fc('0x33')];if(_0x4fdc6d[_0x35fc('0x37')]['includeAll']){_0x4ff202[_0x35fc('0x43')]=[{'all':!![]}];}_0x4ff202=_[_0x35fc('0x48')]({},_0x4ff202,_0x4fdc6d[_0x35fc('0x41')]);return db[_0x35fc('0x2e')]['find'](_0x4ff202)[_0x35fc('0x24')](handleEntityNotFound(_0x5c2e5c,null))['then'](respondWithResult(_0x5c2e5c,null))['catch'](handleError(_0x5c2e5c,null));};exports[_0x35fc('0x49')]=function(_0x9db7e8,_0x18dc78){return db[_0x35fc('0x2e')][_0x35fc('0x49')](_0x9db7e8[_0x35fc('0x4a')],{})[_0x35fc('0x24')](function(_0x16afa6){var _0x4f555f=_0x9db7e8[_0x35fc('0x4b')][_0x35fc('0x26')]({'plain':!![]});if(!_0x4f555f)throw new Error(_0x35fc('0x4c'));if(_0x4f555f[_0x35fc('0x4d')]===_0x35fc('0x4b')){var _0x1e3221=_0x16afa6[_0x35fc('0x26')]({'plain':!![]});var _0x347a4a=_0x35fc('0x27');return db[_0x35fc('0x4e')][_0x35fc('0x4f')]({'where':{'name':_0x347a4a,'userProfileId':_0x4f555f[_0x35fc('0x50')]},'raw':!![]})[_0x35fc('0x24')](function(_0x3146e2){if(_0x3146e2&&_0x3146e2['autoAssociation']===0x0){return db['UserProfileResource'][_0x35fc('0x49')]({'name':_0x1e3221[_0x35fc('0x2a')],'resourceId':_0x1e3221['id'],'type':_0x3146e2[_0x35fc('0x2a')],'sectionId':_0x3146e2['id']},{})[_0x35fc('0x24')](function(){return _0x16afa6;});}else{return _0x16afa6;}})[_0x35fc('0x45')](function(_0x3e6494){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3e6494);throw _0x3e6494;});}return _0x16afa6;})[_0x35fc('0x24')](respondWithResult(_0x18dc78,0xc9))[_0x35fc('0x45')](handleError(_0x18dc78,null));};exports[_0x35fc('0x23')]=function(_0x38bc78,_0x5b2595){if(_0x38bc78[_0x35fc('0x4a')]['id']){delete _0x38bc78[_0x35fc('0x4a')]['id'];}return db['AnalyticMetric'][_0x35fc('0x4f')]({'where':{'id':_0x38bc78[_0x35fc('0x47')]['id']}})['then'](handleEntityNotFound(_0x5b2595,null))[_0x35fc('0x24')](saveUpdates(_0x38bc78[_0x35fc('0x4a')],null))[_0x35fc('0x24')](respondWithResult(_0x5b2595,null))[_0x35fc('0x45')](handleError(_0x5b2595,null));};exports['destroy']=function(_0x4de34b,_0x502a15){return db[_0x35fc('0x2e')][_0x35fc('0x4f')]({'where':{'id':_0x4de34b['params']['id']}})[_0x35fc('0x24')](handleEntityNotFound(_0x502a15,null))[_0x35fc('0x24')](removeEntity(_0x502a15,null))[_0x35fc('0x45')](handleError(_0x502a15,null));}; \ No newline at end of file +var _0x1cb9=['user','Unable\x20to\x20retrieve\x20the\x20current\x20user','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','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','count','offset','Content-Range','json','reject','save','update','then','destroy','get','Metrics','error','stack','name','send','index','map','AnalyticMetric','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','filter','options','includeAll','include','findAll','show','params','keys','length','find','catch'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1cb9,0x14e));var _0x91cb=function(_0x3f66a8,_0x27806e){_0x3f66a8=_0x3f66a8-0x0;var _0xe8c56d=_0x1cb9[_0x3f66a8];return _0xe8c56d;};'use strict';var emlformat=require(_0x91cb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x91cb('0x1'));var jsonpatch=require(_0x91cb('0x2'));var rp=require(_0x91cb('0x3'));var moment=require(_0x91cb('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x91cb('0x5'));var util=require(_0x91cb('0x6'));var path=require('path');var sox=require(_0x91cb('0x7'));var csv=require(_0x91cb('0x8'));var ejs=require(_0x91cb('0x9'));var fs=require('fs');var fs_extra=require(_0x91cb('0xa'));var _=require(_0x91cb('0xb'));var squel=require(_0x91cb('0xc'));var crypto=require('crypto');var jsforce=require(_0x91cb('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x91cb('0x8'));var querystring=require('querystring');var Papa=require(_0x91cb('0xe'));var Redis=require(_0x91cb('0xf'));var authService=require(_0x91cb('0x10'));var qs=require(_0x91cb('0x11'));var as=require(_0x91cb('0x12'));var hardwareService=require(_0x91cb('0x13'));var logger=require(_0x91cb('0x14'))(_0x91cb('0x15'));var utils=require(_0x91cb('0x16'));var config=require(_0x91cb('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x91cb('0x18'))['db'];function respondWithStatusCode(_0x366f09,_0x4ba2f2){_0x4ba2f2=_0x4ba2f2||0xcc;return function(_0x20e6e0){if(_0x20e6e0){return _0x366f09[_0x91cb('0x19')](_0x4ba2f2);}return _0x366f09[_0x91cb('0x1a')](_0x4ba2f2)[_0x91cb('0x1b')]();};}function respondWithResult(_0x4a7d45,_0x4cc6ef){_0x4cc6ef=_0x4cc6ef||0xc8;return function(_0x4aae25){if(_0x4aae25){return _0x4a7d45[_0x91cb('0x1a')](_0x4cc6ef)['json'](_0x4aae25);}};}function respondWithFilteredResult(_0x528f73,_0x576369){return function(_0xc3629e){if(_0xc3629e){var _0x347980=typeof _0x576369['offset']===_0x91cb('0x1c')&&typeof _0x576369[_0x91cb('0x1d')]==='undefined';var _0xc594e3=_0xc3629e[_0x91cb('0x1e')];var _0x1cd34b=_0x347980?0x0:_0x576369[_0x91cb('0x1f')];var _0x5cc1c3=_0x347980?_0xc3629e[_0x91cb('0x1e')]:_0x576369[_0x91cb('0x1f')]+_0x576369['limit'];var _0x123847;if(_0x5cc1c3>=_0xc594e3){_0x5cc1c3=_0xc594e3;_0x123847=0xc8;}else{_0x123847=0xce;}_0x528f73['status'](_0x123847);return _0x528f73['set'](_0x91cb('0x20'),_0x1cd34b+'-'+_0x5cc1c3+'/'+_0xc594e3)[_0x91cb('0x21')](_0xc3629e);}return null;};}function patchUpdates(_0x56e409){return function(_0x51a1d5){try{jsonpatch['apply'](_0x51a1d5,_0x56e409,!![]);}catch(_0x438162){return BPromise[_0x91cb('0x22')](_0x438162);}return _0x51a1d5[_0x91cb('0x23')]();};}function saveUpdates(_0x1dbee2,_0x5c6a15){return function(_0x45c4b3){if(_0x45c4b3){return _0x45c4b3[_0x91cb('0x24')](_0x1dbee2)[_0x91cb('0x25')](function(_0x55fa78){return _0x55fa78;});}return null;};}function removeEntity(_0x26f18f,_0x1a7a54){return function(_0x2447e7){if(_0x2447e7){return _0x2447e7[_0x91cb('0x26')]()[_0x91cb('0x25')](function(){var _0x7ad361=_0x2447e7[_0x91cb('0x27')]({'plain':!![]});var _0x423c4f=_0x91cb('0x28');return db['UserProfileResource']['destroy']({'where':{'type':_0x423c4f,'resourceId':_0x7ad361['id']}})[_0x91cb('0x25')](function(){return _0x2447e7;});})['then'](function(){_0x26f18f[_0x91cb('0x1a')](0xcc)[_0x91cb('0x1b')]();});}};}function handleEntityNotFound(_0x318031,_0x5595c5){return function(_0x9b26a6){if(!_0x9b26a6){_0x318031['sendStatus'](0x194);}return _0x9b26a6;};}function handleError(_0x4572f6,_0x308e8c){_0x308e8c=_0x308e8c||0x1f4;return function(_0x3b3ee6){logger[_0x91cb('0x29')](_0x3b3ee6[_0x91cb('0x2a')]);if(_0x3b3ee6['name']){delete _0x3b3ee6[_0x91cb('0x2b')];}_0x4572f6['status'](_0x308e8c)[_0x91cb('0x2c')](_0x3b3ee6);};}exports[_0x91cb('0x2d')]=function(_0x445fe1,_0x4944bd){var _0x775c25={},_0x146e1f={},_0x25bbf9={'count':0x0,'rows':[]};var _0x361e4c=_[_0x91cb('0x2e')](db[_0x91cb('0x2f')][_0x91cb('0x30')],function(_0x3bbde3){return{'name':_0x3bbde3[_0x91cb('0x31')],'type':_0x3bbde3['type'][_0x91cb('0x32')]};});_0x146e1f[_0x91cb('0x33')]=_[_0x91cb('0x2e')](_0x361e4c,_0x91cb('0x2b'));_0x146e1f[_0x91cb('0x34')]=_['keys'](_0x445fe1[_0x91cb('0x34')]);_0x146e1f[_0x91cb('0x35')]=_[_0x91cb('0x36')](_0x146e1f[_0x91cb('0x33')],_0x146e1f[_0x91cb('0x34')]);_0x775c25['attributes']=_[_0x91cb('0x36')](_0x146e1f['model'],qs['fields'](_0x445fe1['query'][_0x91cb('0x37')]));_0x775c25['attributes']=_0x775c25[_0x91cb('0x38')]['length']?_0x775c25['attributes']:_0x146e1f[_0x91cb('0x33')];if(!_0x445fe1[_0x91cb('0x34')][_0x91cb('0x39')](_0x91cb('0x3a'))){_0x775c25[_0x91cb('0x1d')]=qs['limit'](_0x445fe1[_0x91cb('0x34')][_0x91cb('0x1d')]);_0x775c25[_0x91cb('0x1f')]=qs[_0x91cb('0x1f')](_0x445fe1['query']['offset']);}_0x775c25[_0x91cb('0x3b')]=qs[_0x91cb('0x3c')](_0x445fe1['query'][_0x91cb('0x3c')]);_0x775c25[_0x91cb('0x3d')]=qs['filters'](_[_0x91cb('0x3e')](_0x445fe1[_0x91cb('0x34')],_0x146e1f['filters']),_0x361e4c);if(_0x445fe1[_0x91cb('0x34')]['filter']){_0x775c25[_0x91cb('0x3d')]=_[_0x91cb('0x3f')](_0x775c25[_0x91cb('0x3d')],{'$or':_[_0x91cb('0x2e')](_0x361e4c,function(_0x51d0ea){if(_0x51d0ea[_0x91cb('0x40')]!=='VIRTUAL'){var _0xa90111={};_0xa90111[_0x51d0ea[_0x91cb('0x2b')]]={'$like':'%'+_0x445fe1['query'][_0x91cb('0x41')]+'%'};return _0xa90111;}})});}_0x775c25=_['merge']({},_0x775c25,_0x445fe1[_0x91cb('0x42')]);var _0x2eac87={'where':_0x775c25[_0x91cb('0x3d')]};return db[_0x91cb('0x2f')]['count'](_0x2eac87)[_0x91cb('0x25')](function(_0x5af0e6){_0x25bbf9[_0x91cb('0x1e')]=_0x5af0e6;if(_0x445fe1[_0x91cb('0x34')][_0x91cb('0x43')]){_0x775c25[_0x91cb('0x44')]=[{'all':!![]}];}return db[_0x91cb('0x2f')][_0x91cb('0x45')](_0x775c25);})[_0x91cb('0x25')](function(_0x3cc4c1){_0x25bbf9['rows']=_0x3cc4c1;return _0x25bbf9;})[_0x91cb('0x25')](respondWithFilteredResult(_0x4944bd,_0x775c25))['catch'](handleError(_0x4944bd,null));};exports[_0x91cb('0x46')]=function(_0x5537a0,_0x335879){var _0x52e82c={'raw':!![],'where':{'id':_0x5537a0[_0x91cb('0x47')]['id']}},_0x138f48={};_0x138f48[_0x91cb('0x33')]=_[_0x91cb('0x48')](db['AnalyticMetric'][_0x91cb('0x30')]);_0x138f48[_0x91cb('0x34')]=_['keys'](_0x5537a0[_0x91cb('0x34')]);_0x138f48[_0x91cb('0x35')]=_[_0x91cb('0x36')](_0x138f48[_0x91cb('0x33')],_0x138f48[_0x91cb('0x34')]);_0x52e82c[_0x91cb('0x38')]=_[_0x91cb('0x36')](_0x138f48[_0x91cb('0x33')],qs[_0x91cb('0x37')](_0x5537a0['query'][_0x91cb('0x37')]));_0x52e82c[_0x91cb('0x38')]=_0x52e82c[_0x91cb('0x38')][_0x91cb('0x49')]?_0x52e82c[_0x91cb('0x38')]:_0x138f48[_0x91cb('0x33')];if(_0x5537a0[_0x91cb('0x34')][_0x91cb('0x43')]){_0x52e82c['include']=[{'all':!![]}];}_0x52e82c=_[_0x91cb('0x3f')]({},_0x52e82c,_0x5537a0[_0x91cb('0x42')]);return db[_0x91cb('0x2f')][_0x91cb('0x4a')](_0x52e82c)['then'](handleEntityNotFound(_0x335879,null))[_0x91cb('0x25')](respondWithResult(_0x335879,null))[_0x91cb('0x4b')](handleError(_0x335879,null));};exports['create']=function(_0x212473,_0x47cdb7){return db[_0x91cb('0x2f')]['create'](_0x212473['body'],{})['then'](function(_0x98245b){var _0xff3d11=_0x212473[_0x91cb('0x4c')][_0x91cb('0x27')]({'plain':!![]});if(!_0xff3d11)throw new Error(_0x91cb('0x4d'));if(_0xff3d11['role']==='user'){var _0x1d26b8=_0x98245b[_0x91cb('0x27')]({'plain':!![]});var _0x140994=_0x91cb('0x28');return db['UserProfileSection']['find']({'where':{'name':_0x140994,'userProfileId':_0xff3d11['userProfileId']},'raw':!![]})[_0x91cb('0x25')](function(_0x490417){if(_0x490417&&_0x490417[_0x91cb('0x4e')]===0x0){return db['UserProfileResource'][_0x91cb('0x4f')]({'name':_0x1d26b8[_0x91cb('0x2b')],'resourceId':_0x1d26b8['id'],'type':_0x490417[_0x91cb('0x2b')],'sectionId':_0x490417['id']},{})[_0x91cb('0x25')](function(){return _0x98245b;});}else{return _0x98245b;}})[_0x91cb('0x4b')](function(_0x362532){logger[_0x91cb('0x29')](_0x91cb('0x50'),_0x362532);throw _0x362532;});}return _0x98245b;})[_0x91cb('0x25')](respondWithResult(_0x47cdb7,0xc9))[_0x91cb('0x4b')](handleError(_0x47cdb7,null));};exports[_0x91cb('0x24')]=function(_0x5752ed,_0x1e445a){if(_0x5752ed[_0x91cb('0x51')]['id']){delete _0x5752ed['body']['id'];}return db[_0x91cb('0x2f')][_0x91cb('0x4a')]({'where':{'id':_0x5752ed['params']['id']}})[_0x91cb('0x25')](handleEntityNotFound(_0x1e445a,null))[_0x91cb('0x25')](saveUpdates(_0x5752ed[_0x91cb('0x51')],null))[_0x91cb('0x25')](respondWithResult(_0x1e445a,null))[_0x91cb('0x4b')](handleError(_0x1e445a,null));};exports[_0x91cb('0x26')]=function(_0x1d4b96,_0x274fff){return db[_0x91cb('0x2f')][_0x91cb('0x4a')]({'where':{'id':_0x1d4b96[_0x91cb('0x47')]['id']}})['then'](handleEntityNotFound(_0x274fff,null))[_0x91cb('0x25')](removeEntity(_0x274fff,null))['catch'](handleError(_0x274fff,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index 222030b..3dd6258 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 _0x9829=['./analyticMetric.attributes','exports','define','AnalyticMetric','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x1f1e31,_0x27b5c3){var _0x229b56=function(_0x16db77){while(--_0x16db77){_0x1f1e31['push'](_0x1f1e31['shift']());}};_0x229b56(++_0x27b5c3);}(_0x9829,0xc4));var _0x9982=function(_0x1ae4a9,_0x4c0ed9){_0x1ae4a9=_0x1ae4a9-0x0;var _0x54d0b0=_0x9829[_0x1ae4a9];return _0x54d0b0;};'use strict';var _=require(_0x9982('0x0'));var util=require(_0x9982('0x1'));var logger=require(_0x9982('0x2'))(_0x9982('0x3'));var moment=require(_0x9982('0x4'));var BPromise=require('bluebird');var rp=require(_0x9982('0x5'));var fs=require('fs');var path=require(_0x9982('0x6'));var rimraf=require(_0x9982('0x7'));var config=require('../../config/environment');var attributes=require(_0x9982('0x8'));module[_0x9982('0x9')]=function(_0x58f8fe,_0x500dfd){return _0x58f8fe[_0x9982('0xa')](_0x9982('0xb'),attributes,{'tableName':'analytics_metrics','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdc97=['path','../../config/environment','./analyticMetric.attributes','exports','define','lodash','util','../../config/logger','moment','request-promise'];(function(_0x3b6652,_0x32486d){var _0x14d39f=function(_0x3a595a){while(--_0x3a595a){_0x3b6652['push'](_0x3b6652['shift']());}};_0x14d39f(++_0x32486d);}(_0xdc97,0x13b));var _0x7dc9=function(_0x35ed0b,_0x307816){_0x35ed0b=_0x35ed0b-0x0;var _0x4a50b1=_0xdc97[_0x35ed0b];return _0x4a50b1;};'use strict';var _=require(_0x7dc9('0x0'));var util=require(_0x7dc9('0x1'));var logger=require(_0x7dc9('0x2'))('api');var moment=require(_0x7dc9('0x3'));var BPromise=require('bluebird');var rp=require(_0x7dc9('0x4'));var fs=require('fs');var path=require(_0x7dc9('0x5'));var rimraf=require('rimraf');var config=require(_0x7dc9('0x6'));var attributes=require(_0x7dc9('0x7'));module[_0x7dc9('0x8')]=function(_0x3ba3ca,_0x589f02){return _0x3ba3ca[_0x7dc9('0x9')]('AnalyticMetric',attributes,{'tableName':'analytics_metrics','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.rpc.js b/server/api/analyticMetric/analyticMetric.rpc.js index 73588b3..6d8e112 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 _0xb518=['then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','request'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xb518,0x146));var _0x8b51=function(_0xfb89d1,_0x17f94e){_0xfb89d1=_0xfb89d1-0x0;var _0x58bf9b=_0xb518[_0xfb89d1];return _0x58bf9b;};'use strict';var _=require(_0x8b51('0x0'));var util=require('util');var moment=require(_0x8b51('0x1'));var BPromise=require('bluebird');var rs=require(_0x8b51('0x2'));var fs=require('fs');var Redis=require(_0x8b51('0x3'));var db=require(_0x8b51('0x4'))['db'];var utils=require(_0x8b51('0x5'));var logger=require('../../config/logger')(_0x8b51('0x6'));var config=require(_0x8b51('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x8b51('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x409078,_0x3e8544,_0x55f79a){return new BPromise(function(_0x5ef411,_0x5e6004){return client[_0x8b51('0x9')](_0x409078,_0x55f79a)[_0x8b51('0xa')](function(_0x172507){logger[_0x8b51('0xb')](_0x8b51('0xc'),_0x3e8544,_0x8b51('0xd'));logger['debug'](_0x8b51('0xe'),_0x3e8544,_0x8b51('0xd'),JSON[_0x8b51('0xf')](_0x172507));if(_0x172507[_0x8b51('0x10')]){if(_0x172507[_0x8b51('0x10')][_0x8b51('0x11')]===0x1f4){logger[_0x8b51('0x10')]('AnalyticMetric,\x20%s,\x20%s',_0x3e8544,_0x172507[_0x8b51('0x10')]['message']);return _0x5e6004(_0x172507[_0x8b51('0x10')]['message']);}logger['error'](_0x8b51('0xc'),_0x3e8544,_0x172507['error'][_0x8b51('0x12')]);return _0x5ef411(_0x172507[_0x8b51('0x10')][_0x8b51('0x12')]);}else{logger[_0x8b51('0xb')](_0x8b51('0xc'),_0x3e8544,'request\x20sent');_0x5ef411(_0x172507[_0x8b51('0x13')][_0x8b51('0x12')]);}})[_0x8b51('0x14')](function(_0xecb929){logger[_0x8b51('0x10')](_0x8b51('0xc'),_0x3e8544,_0xecb929);_0x5e6004(_0xecb929);});});} \ No newline at end of file +var _0xe701=['lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','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'];(function(_0x233912,_0x511ba5){var _0x44015e=function(_0x414a16){while(--_0x414a16){_0x233912['push'](_0x233912['shift']());}};_0x44015e(++_0x511ba5);}(_0xe701,0x1a0));var _0x1e70=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xe701[_0xfae23b];return _0x200640;};'use strict';var _=require(_0x1e70('0x0'));var util=require(_0x1e70('0x1'));var moment=require('moment');var BPromise=require(_0x1e70('0x2'));var rs=require(_0x1e70('0x3'));var fs=require('fs');var Redis=require(_0x1e70('0x4'));var db=require(_0x1e70('0x5'))['db'];var utils=require(_0x1e70('0x6'));var logger=require(_0x1e70('0x7'))(_0x1e70('0x8'));var config=require(_0x1e70('0x9'));var jayson=require(_0x1e70('0xa'));var client=jayson[_0x1e70('0xb')][_0x1e70('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3c9a8e,_0x4d0e27,_0x2ba828){return new BPromise(function(_0x32e2e6,_0x1e2bf5){return client[_0x1e70('0xd')](_0x3c9a8e,_0x2ba828)[_0x1e70('0xe')](function(_0x5bbb37){logger['info'](_0x1e70('0xf'),_0x4d0e27,_0x1e70('0x10'));logger[_0x1e70('0x11')](_0x1e70('0x12'),_0x4d0e27,_0x1e70('0x10'),JSON[_0x1e70('0x13')](_0x5bbb37));if(_0x5bbb37[_0x1e70('0x14')]){if(_0x5bbb37[_0x1e70('0x14')][_0x1e70('0x15')]===0x1f4){logger[_0x1e70('0x14')](_0x1e70('0xf'),_0x4d0e27,_0x5bbb37[_0x1e70('0x14')][_0x1e70('0x16')]);return _0x1e2bf5(_0x5bbb37[_0x1e70('0x14')][_0x1e70('0x16')]);}logger[_0x1e70('0x14')]('AnalyticMetric,\x20%s,\x20%s',_0x4d0e27,_0x5bbb37[_0x1e70('0x14')][_0x1e70('0x16')]);return _0x32e2e6(_0x5bbb37[_0x1e70('0x14')]['message']);}else{logger[_0x1e70('0x17')](_0x1e70('0xf'),_0x4d0e27,'request\x20sent');_0x32e2e6(_0x5bbb37[_0x1e70('0x18')][_0x1e70('0x16')]);}})[_0x1e70('0x19')](function(_0x1ac021){logger[_0x1e70('0x14')](_0x1e70('0xf'),_0x4d0e27,_0x1ac021);_0x1e2bf5(_0x1ac021);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index 8011930..8a3fae1 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 _0xac4f=['destroy','exports','multer','path','express','../../components/auth/service','../../components/interaction/service','./analyticMetric.controller','get','isAuthenticated','/:id','show','post','put','update','delete'];(function(_0x1c1969,_0x19eb95){var _0x1db48e=function(_0x41271e){while(--_0x41271e){_0x1c1969['push'](_0x1c1969['shift']());}};_0x1db48e(++_0x19eb95);}(_0xac4f,0x122));var _0xfac4=function(_0x1ac53b,_0x31c1f1){_0x1ac53b=_0x1ac53b-0x0;var _0x6dcc75=_0xac4f[_0x1ac53b];return _0x6dcc75;};'use strict';var multer=require(_0xfac4('0x0'));var util=require('util');var path=require(_0xfac4('0x1'));var timeout=require('connect-timeout');var express=require(_0xfac4('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xfac4('0x3'));var interaction=require(_0xfac4('0x4'));var config=require('../../config/environment');var controller=require(_0xfac4('0x5'));router[_0xfac4('0x6')]('/',auth[_0xfac4('0x7')](),controller['index']);router[_0xfac4('0x6')](_0xfac4('0x8'),auth[_0xfac4('0x7')](),controller[_0xfac4('0x9')]);router[_0xfac4('0xa')]('/',auth[_0xfac4('0x7')](),controller['create']);router[_0xfac4('0xb')](_0xfac4('0x8'),auth[_0xfac4('0x7')](),controller[_0xfac4('0xc')]);router[_0xfac4('0xd')](_0xfac4('0x8'),auth[_0xfac4('0x7')](),controller[_0xfac4('0xe')]);module[_0xfac4('0xf')]=router; \ No newline at end of file +var _0xa423=['post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./analyticMetric.controller','get','isAuthenticated','index','/:id','show'];(function(_0x1967dc,_0x2b8fbe){var _0x220571=function(_0x44e604){while(--_0x44e604){_0x1967dc['push'](_0x1967dc['shift']());}};_0x220571(++_0x2b8fbe);}(_0xa423,0x16c));var _0x3a42=function(_0x5155a2,_0x2b42ee){_0x5155a2=_0x5155a2-0x0;var _0x35a9bd=_0xa423[_0x5155a2];return _0x35a9bd;};'use strict';var multer=require(_0x3a42('0x0'));var util=require(_0x3a42('0x1'));var path=require(_0x3a42('0x2'));var timeout=require(_0x3a42('0x3'));var express=require(_0x3a42('0x4'));var router=express['Router']();var fs_extra=require(_0x3a42('0x5'));var auth=require(_0x3a42('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x3a42('0x7'));var controller=require(_0x3a42('0x8'));router[_0x3a42('0x9')]('/',auth[_0x3a42('0xa')](),controller[_0x3a42('0xb')]);router['get'](_0x3a42('0xc'),auth[_0x3a42('0xa')](),controller[_0x3a42('0xd')]);router[_0x3a42('0xe')]('/',auth[_0x3a42('0xa')](),controller[_0x3a42('0xf')]);router[_0x3a42('0x10')](_0x3a42('0xc'),auth[_0x3a42('0xa')](),controller[_0x3a42('0x11')]);router[_0x3a42('0x12')]('/:id',auth[_0x3a42('0xa')](),controller[_0x3a42('0x13')]);module[_0x3a42('0x14')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index 06bd2bb..9494a08 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 _0xa70c=['exports'];(function(_0x2bf888,_0x374f0b){var _0x3038d6=function(_0xe1b6d9){while(--_0xe1b6d9){_0x2bf888['push'](_0x2bf888['shift']());}};_0x3038d6(++_0x374f0b);}(_0xa70c,0x189));var _0xca70=function(_0x5b9dd7,_0x43a06e){_0x5b9dd7=_0x5b9dd7-0x0;var _0x49ec19=_0xa70c[_0x5b9dd7];return _0x49ec19;};'use strict';var Sequelize=require('sequelize');module[_0xca70('0x0')]={'tree':{'type':Sequelize['TEXT'],'allowNull':![]}}; \ No newline at end of file +var _0xefe5=['sequelize','TEXT'];(function(_0x33fcbb,_0x291d0f){var _0x2efe40=function(_0x2e9442){while(--_0x2e9442){_0x33fcbb['push'](_0x33fcbb['shift']());}};_0x2efe40(++_0x291d0f);}(_0xefe5,0xf6));var _0x5efe=function(_0x532ebf,_0x299c3b){_0x532ebf=_0x532ebf-0x0;var _0x1c6467=_0xefe5[_0x532ebf];return _0x1c6467;};'use strict';var Sequelize=require(_0x5efe('0x0'));module['exports']={'tree':{'type':Sequelize[_0x5efe('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 1d1c94b..9d4e1ae 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 _0xbfeb=['key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll','include','keys','find','catch','create','body','params','eml-format','fast-json-patch','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','error','stack','name','send','index','AnalyticTreeReport','rawAttributes','fieldName'];(function(_0x3b01a9,_0x2cb3fa){var _0x4aa436=function(_0xdbd8d){while(--_0xdbd8d){_0x3b01a9['push'](_0x3b01a9['shift']());}};_0x4aa436(++_0x2cb3fa);}(_0xbfeb,0x183));var _0xbbfe=function(_0x54d448,_0x584e5e){_0x54d448=_0x54d448-0x0;var _0x2177a8=_0xbfeb[_0x54d448];return _0x2177a8;};'use strict';var emlformat=require(_0xbbfe('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xbbfe('0x1'));var rp=require('request-promise');var moment=require(_0xbbfe('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xbbfe('0x3'));var util=require(_0xbbfe('0x4'));var path=require(_0xbbfe('0x5'));var sox=require(_0xbbfe('0x6'));var csv=require(_0xbbfe('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbbfe('0x8'));var _=require(_0xbbfe('0x9'));var squel=require(_0xbbfe('0xa'));var crypto=require(_0xbbfe('0xb'));var jsforce=require(_0xbbfe('0xc'));var deskjs=require(_0xbbfe('0xd'));var toCsv=require('to-csv');var querystring=require(_0xbbfe('0xe'));var Papa=require(_0xbbfe('0xf'));var Redis=require(_0xbbfe('0x10'));var authService=require(_0xbbfe('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xbbfe('0x12'));var hardwareService=require(_0xbbfe('0x13'));var logger=require(_0xbbfe('0x14'))(_0xbbfe('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xbbfe('0x16'));var db=require(_0xbbfe('0x17'))['db'];function respondWithStatusCode(_0x4ed695,_0x4e22e1){_0x4e22e1=_0x4e22e1||0xcc;return function(_0x5a7108){if(_0x5a7108){return _0x4ed695['sendStatus'](_0x4e22e1);}return _0x4ed695[_0xbbfe('0x18')](_0x4e22e1)[_0xbbfe('0x19')]();};}function respondWithResult(_0x598c68,_0x2e0e1b){_0x2e0e1b=_0x2e0e1b||0xc8;return function(_0x474907){if(_0x474907){return _0x598c68[_0xbbfe('0x18')](_0x2e0e1b)[_0xbbfe('0x1a')](_0x474907);}};}function respondWithFilteredResult(_0x555b52,_0x5f38a1){return function(_0x52080b){if(_0x52080b){var _0x37dadd=typeof _0x5f38a1[_0xbbfe('0x1b')]===_0xbbfe('0x1c')&&typeof _0x5f38a1[_0xbbfe('0x1d')]===_0xbbfe('0x1c');var _0x5d366a=_0x52080b[_0xbbfe('0x1e')];var _0x3c52c0=_0x37dadd?0x0:_0x5f38a1['offset'];var _0x4eb175=_0x37dadd?_0x52080b['count']:_0x5f38a1['offset']+_0x5f38a1[_0xbbfe('0x1d')];var _0x29aadc;if(_0x4eb175>=_0x5d366a){_0x4eb175=_0x5d366a;_0x29aadc=0xc8;}else{_0x29aadc=0xce;}_0x555b52[_0xbbfe('0x18')](_0x29aadc);return _0x555b52[_0xbbfe('0x1f')](_0xbbfe('0x20'),_0x3c52c0+'-'+_0x4eb175+'/'+_0x5d366a)[_0xbbfe('0x1a')](_0x52080b);}return null;};}function patchUpdates(_0x3d33f3){return function(_0x7919f2){try{jsonpatch[_0xbbfe('0x21')](_0x7919f2,_0x3d33f3,!![]);}catch(_0x3bdd31){return BPromise[_0xbbfe('0x22')](_0x3bdd31);}return _0x7919f2['save']();};}function saveUpdates(_0x5955a2,_0x2db963){return function(_0x3bff3d){if(_0x3bff3d){return _0x3bff3d[_0xbbfe('0x23')](_0x5955a2)[_0xbbfe('0x24')](function(_0xeba75a){return _0xeba75a;});}return null;};}function removeEntity(_0x3ac25c,_0x3580ff){return function(_0x556789){if(_0x556789){return _0x556789['destroy']()[_0xbbfe('0x24')](function(){_0x3ac25c['status'](0xcc)[_0xbbfe('0x19')]();});}};}function handleEntityNotFound(_0x48da81,_0x54d37d){return function(_0x316eb9){if(!_0x316eb9){_0x48da81['sendStatus'](0x194);}return _0x316eb9;};}function handleError(_0x37005f,_0x45a8bf){_0x45a8bf=_0x45a8bf||0x1f4;return function(_0x100a21){logger[_0xbbfe('0x25')](_0x100a21[_0xbbfe('0x26')]);if(_0x100a21[_0xbbfe('0x27')]){delete _0x100a21[_0xbbfe('0x27')];}_0x37005f['status'](_0x45a8bf)[_0xbbfe('0x28')](_0x100a21);};}exports[_0xbbfe('0x29')]=function(_0x2d9846,_0x1fc541){var _0x5aaaa3={},_0x338c20={},_0x3cf65d={'count':0x0,'rows':[]};var _0x464e28=_['map'](db[_0xbbfe('0x2a')][_0xbbfe('0x2b')],function(_0x305558){return{'name':_0x305558[_0xbbfe('0x2c')],'type':_0x305558['type'][_0xbbfe('0x2d')]};});_0x338c20[_0xbbfe('0x2e')]=_[_0xbbfe('0x2f')](_0x464e28,'name');_0x338c20[_0xbbfe('0x30')]=_['keys'](_0x2d9846[_0xbbfe('0x30')]);_0x338c20[_0xbbfe('0x31')]=_[_0xbbfe('0x32')](_0x338c20[_0xbbfe('0x2e')],_0x338c20[_0xbbfe('0x30')]);_0x5aaaa3[_0xbbfe('0x33')]=_['intersection'](_0x338c20[_0xbbfe('0x2e')],qs[_0xbbfe('0x34')](_0x2d9846[_0xbbfe('0x30')][_0xbbfe('0x34')]));_0x5aaaa3[_0xbbfe('0x33')]=_0x5aaaa3['attributes'][_0xbbfe('0x35')]?_0x5aaaa3['attributes']:_0x338c20[_0xbbfe('0x2e')];if(!_0x2d9846['query'][_0xbbfe('0x36')](_0xbbfe('0x37'))){_0x5aaaa3[_0xbbfe('0x1d')]=qs['limit'](_0x2d9846[_0xbbfe('0x30')][_0xbbfe('0x1d')]);_0x5aaaa3[_0xbbfe('0x1b')]=qs[_0xbbfe('0x1b')](_0x2d9846['query'][_0xbbfe('0x1b')]);}_0x5aaaa3['order']=qs[_0xbbfe('0x38')](_0x2d9846[_0xbbfe('0x30')][_0xbbfe('0x38')]);_0x5aaaa3[_0xbbfe('0x39')]=qs[_0xbbfe('0x31')](_[_0xbbfe('0x3a')](_0x2d9846[_0xbbfe('0x30')],_0x338c20[_0xbbfe('0x31')]),_0x464e28);if(_0x2d9846[_0xbbfe('0x30')]['filter']){_0x5aaaa3['where']=_[_0xbbfe('0x3b')](_0x5aaaa3[_0xbbfe('0x39')],{'$or':_['map'](_0x464e28,function(_0x2487cf){if(_0x2487cf[_0xbbfe('0x3c')]!==_0xbbfe('0x3d')){var _0x12cb91={};_0x12cb91[_0x2487cf[_0xbbfe('0x27')]]={'$like':'%'+_0x2d9846[_0xbbfe('0x30')][_0xbbfe('0x3e')]+'%'};return _0x12cb91;}})});}_0x5aaaa3=_[_0xbbfe('0x3b')]({},_0x5aaaa3,_0x2d9846[_0xbbfe('0x3f')]);var _0x1e34d5={'where':_0x5aaaa3[_0xbbfe('0x39')]};return db['AnalyticTreeReport'][_0xbbfe('0x1e')](_0x1e34d5)[_0xbbfe('0x24')](function(_0x28d67e){_0x3cf65d[_0xbbfe('0x1e')]=_0x28d67e;if(_0x2d9846[_0xbbfe('0x30')][_0xbbfe('0x40')]){_0x5aaaa3[_0xbbfe('0x41')]=[{'all':!![]}];}return db[_0xbbfe('0x2a')]['findAll'](_0x5aaaa3);})[_0xbbfe('0x24')](function(_0x32887c){_0x3cf65d['rows']=_0x32887c;return _0x3cf65d;})['then'](respondWithFilteredResult(_0x1fc541,_0x5aaaa3))['catch'](handleError(_0x1fc541,null));};exports['show']=function(_0x2ccd72,_0x15c1b4){var _0x40f317={'raw':!![],'where':{'id':_0x2ccd72['params']['id']}},_0x3b06a8={};_0x3b06a8[_0xbbfe('0x2e')]=_[_0xbbfe('0x42')](db['AnalyticTreeReport'][_0xbbfe('0x2b')]);_0x3b06a8[_0xbbfe('0x30')]=_[_0xbbfe('0x42')](_0x2ccd72[_0xbbfe('0x30')]);_0x3b06a8[_0xbbfe('0x31')]=_[_0xbbfe('0x32')](_0x3b06a8['model'],_0x3b06a8[_0xbbfe('0x30')]);_0x40f317['attributes']=_['intersection'](_0x3b06a8[_0xbbfe('0x2e')],qs['fields'](_0x2ccd72[_0xbbfe('0x30')][_0xbbfe('0x34')]));_0x40f317[_0xbbfe('0x33')]=_0x40f317[_0xbbfe('0x33')]['length']?_0x40f317['attributes']:_0x3b06a8['model'];if(_0x2ccd72[_0xbbfe('0x30')]['includeAll']){_0x40f317[_0xbbfe('0x41')]=[{'all':!![]}];}_0x40f317=_[_0xbbfe('0x3b')]({},_0x40f317,_0x2ccd72[_0xbbfe('0x3f')]);return db[_0xbbfe('0x2a')][_0xbbfe('0x43')](_0x40f317)['then'](handleEntityNotFound(_0x15c1b4,null))[_0xbbfe('0x24')](respondWithResult(_0x15c1b4,null))[_0xbbfe('0x44')](handleError(_0x15c1b4,null));};exports['create']=function(_0x332a38,_0x51aec5){return db[_0xbbfe('0x2a')][_0xbbfe('0x45')](_0x332a38[_0xbbfe('0x46')],{})[_0xbbfe('0x24')](respondWithResult(_0x51aec5,0xc9))[_0xbbfe('0x44')](handleError(_0x51aec5,null));};exports[_0xbbfe('0x23')]=function(_0x34f4a6,_0x3546a6){if(_0x34f4a6[_0xbbfe('0x46')]['id']){delete _0x34f4a6['body']['id'];}return db['AnalyticTreeReport']['find']({'where':{'id':_0x34f4a6[_0xbbfe('0x47')]['id']}})[_0xbbfe('0x24')](handleEntityNotFound(_0x3546a6,null))['then'](saveUpdates(_0x34f4a6[_0xbbfe('0x46')],null))[_0xbbfe('0x24')](respondWithResult(_0x3546a6,null))[_0xbbfe('0x44')](handleError(_0x3546a6,null));};exports['destroy']=function(_0x4aaca0,_0x2bdafd){return db['AnalyticTreeReport'][_0xbbfe('0x43')]({'where':{'id':_0x4aaca0[_0xbbfe('0x47')]['id']}})[_0xbbfe('0x24')](handleEntityNotFound(_0x2bdafd,null))[_0xbbfe('0x24')](removeEntity(_0x2bdafd,null))[_0xbbfe('0x44')](handleError(_0x2bdafd,null));}; \ No newline at end of file +var _0xd35b=['offset','limit','undefined','count','set','apply','reject','save','update','then','destroy','error','send','index','map','AnalyticTreeReport','fieldName','type','key','model','name','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','params','rawAttributes','find','create','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','fs-extra','lodash','squel','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','end','status','json'];(function(_0x1eb5b0,_0x10133c){var _0x130b7c=function(_0x11937a){while(--_0x11937a){_0x1eb5b0['push'](_0x1eb5b0['shift']());}};_0x130b7c(++_0x10133c);}(_0xd35b,0x1e6));var _0xbd35=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0xd35b[_0x618414];return _0x21c19a;};'use strict';var emlformat=require(_0xbd35('0x0'));var rimraf=require(_0xbd35('0x1'));var zipdir=require(_0xbd35('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbd35('0x3'));var moment=require(_0xbd35('0x4'));var BPromise=require(_0xbd35('0x5'));var Mustache=require(_0xbd35('0x6'));var util=require('util');var path=require(_0xbd35('0x7'));var sox=require(_0xbd35('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbd35('0x9'));var _=require(_0xbd35('0xa'));var squel=require(_0xbd35('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xbd35('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xbd35('0xd'));var Redis=require('ioredis');var authService=require(_0xbd35('0xe'));var qs=require(_0xbd35('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbd35('0x10'));var logger=require(_0xbd35('0x11'))(_0xbd35('0x12'));var utils=require(_0xbd35('0x13'));var config=require(_0xbd35('0x14'));var licenseUtil=require(_0xbd35('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x338f6c,_0x104057){_0x104057=_0x104057||0xcc;return function(_0x52639f){if(_0x52639f){return _0x338f6c['sendStatus'](_0x104057);}return _0x338f6c['status'](_0x104057)[_0xbd35('0x16')]();};}function respondWithResult(_0x4c7cb3,_0x5c8877){_0x5c8877=_0x5c8877||0xc8;return function(_0x45bc61){if(_0x45bc61){return _0x4c7cb3[_0xbd35('0x17')](_0x5c8877)[_0xbd35('0x18')](_0x45bc61);}};}function respondWithFilteredResult(_0x106628,_0x2daee0){return function(_0x17c21b){if(_0x17c21b){var _0x46f9a3=typeof _0x2daee0[_0xbd35('0x19')]==='undefined'&&typeof _0x2daee0[_0xbd35('0x1a')]===_0xbd35('0x1b');var _0x458468=_0x17c21b['count'];var _0x155db9=_0x46f9a3?0x0:_0x2daee0[_0xbd35('0x19')];var _0x1ce409=_0x46f9a3?_0x17c21b[_0xbd35('0x1c')]:_0x2daee0['offset']+_0x2daee0[_0xbd35('0x1a')];var _0x4212b6;if(_0x1ce409>=_0x458468){_0x1ce409=_0x458468;_0x4212b6=0xc8;}else{_0x4212b6=0xce;}_0x106628[_0xbd35('0x17')](_0x4212b6);return _0x106628[_0xbd35('0x1d')]('Content-Range',_0x155db9+'-'+_0x1ce409+'/'+_0x458468)[_0xbd35('0x18')](_0x17c21b);}return null;};}function patchUpdates(_0x59589d){return function(_0x144605){try{jsonpatch[_0xbd35('0x1e')](_0x144605,_0x59589d,!![]);}catch(_0x3e443a){return BPromise[_0xbd35('0x1f')](_0x3e443a);}return _0x144605[_0xbd35('0x20')]();};}function saveUpdates(_0x2b1a38,_0x5af94a){return function(_0x38547f){if(_0x38547f){return _0x38547f[_0xbd35('0x21')](_0x2b1a38)[_0xbd35('0x22')](function(_0x3e9dd9){return _0x3e9dd9;});}return null;};}function removeEntity(_0x41ddfd,_0x38c5bb){return function(_0x535603){if(_0x535603){return _0x535603[_0xbd35('0x23')]()['then'](function(){_0x41ddfd[_0xbd35('0x17')](0xcc)[_0xbd35('0x16')]();});}};}function handleEntityNotFound(_0x4144cf,_0x24e3fd){return function(_0x58a659){if(!_0x58a659){_0x4144cf['sendStatus'](0x194);}return _0x58a659;};}function handleError(_0x22e29d,_0x5e0ccd){_0x5e0ccd=_0x5e0ccd||0x1f4;return function(_0x2bc5ec){logger[_0xbd35('0x24')](_0x2bc5ec['stack']);if(_0x2bc5ec['name']){delete _0x2bc5ec['name'];}_0x22e29d[_0xbd35('0x17')](_0x5e0ccd)[_0xbd35('0x25')](_0x2bc5ec);};}exports[_0xbd35('0x26')]=function(_0x59cf91,_0x2d66b2){var _0xa0cd46={},_0x5009eb={},_0x47c229={'count':0x0,'rows':[]};var _0x2fe439=_[_0xbd35('0x27')](db[_0xbd35('0x28')]['rawAttributes'],function(_0x3ecb4b){return{'name':_0x3ecb4b[_0xbd35('0x29')],'type':_0x3ecb4b[_0xbd35('0x2a')][_0xbd35('0x2b')]};});_0x5009eb[_0xbd35('0x2c')]=_[_0xbd35('0x27')](_0x2fe439,_0xbd35('0x2d'));_0x5009eb[_0xbd35('0x2e')]=_[_0xbd35('0x2f')](_0x59cf91[_0xbd35('0x2e')]);_0x5009eb[_0xbd35('0x30')]=_[_0xbd35('0x31')](_0x5009eb[_0xbd35('0x2c')],_0x5009eb[_0xbd35('0x2e')]);_0xa0cd46['attributes']=_[_0xbd35('0x31')](_0x5009eb[_0xbd35('0x2c')],qs[_0xbd35('0x32')](_0x59cf91[_0xbd35('0x2e')][_0xbd35('0x32')]));_0xa0cd46[_0xbd35('0x33')]=_0xa0cd46['attributes'][_0xbd35('0x34')]?_0xa0cd46[_0xbd35('0x33')]:_0x5009eb[_0xbd35('0x2c')];if(!_0x59cf91[_0xbd35('0x2e')][_0xbd35('0x35')](_0xbd35('0x36'))){_0xa0cd46['limit']=qs[_0xbd35('0x1a')](_0x59cf91[_0xbd35('0x2e')][_0xbd35('0x1a')]);_0xa0cd46['offset']=qs['offset'](_0x59cf91[_0xbd35('0x2e')][_0xbd35('0x19')]);}_0xa0cd46[_0xbd35('0x37')]=qs[_0xbd35('0x38')](_0x59cf91[_0xbd35('0x2e')][_0xbd35('0x38')]);_0xa0cd46[_0xbd35('0x39')]=qs[_0xbd35('0x30')](_[_0xbd35('0x3a')](_0x59cf91['query'],_0x5009eb[_0xbd35('0x30')]),_0x2fe439);if(_0x59cf91['query']['filter']){_0xa0cd46['where']=_[_0xbd35('0x3b')](_0xa0cd46['where'],{'$or':_['map'](_0x2fe439,function(_0x170299){if(_0x170299[_0xbd35('0x2a')]!==_0xbd35('0x3c')){var _0xf0098e={};_0xf0098e[_0x170299[_0xbd35('0x2d')]]={'$like':'%'+_0x59cf91[_0xbd35('0x2e')][_0xbd35('0x3d')]+'%'};return _0xf0098e;}})});}_0xa0cd46=_[_0xbd35('0x3b')]({},_0xa0cd46,_0x59cf91[_0xbd35('0x3e')]);var _0x383546={'where':_0xa0cd46[_0xbd35('0x39')]};return db[_0xbd35('0x28')][_0xbd35('0x1c')](_0x383546)[_0xbd35('0x22')](function(_0x5d09ca){_0x47c229[_0xbd35('0x1c')]=_0x5d09ca;if(_0x59cf91[_0xbd35('0x2e')][_0xbd35('0x3f')]){_0xa0cd46[_0xbd35('0x40')]=[{'all':!![]}];}return db[_0xbd35('0x28')][_0xbd35('0x41')](_0xa0cd46);})[_0xbd35('0x22')](function(_0x72ae8d){_0x47c229['rows']=_0x72ae8d;return _0x47c229;})[_0xbd35('0x22')](respondWithFilteredResult(_0x2d66b2,_0xa0cd46))[_0xbd35('0x42')](handleError(_0x2d66b2,null));};exports[_0xbd35('0x43')]=function(_0x1db927,_0x47d3f7){var _0x120289={'raw':!![],'where':{'id':_0x1db927[_0xbd35('0x44')]['id']}},_0x387ca8={};_0x387ca8[_0xbd35('0x2c')]=_[_0xbd35('0x2f')](db['AnalyticTreeReport'][_0xbd35('0x45')]);_0x387ca8[_0xbd35('0x2e')]=_[_0xbd35('0x2f')](_0x1db927[_0xbd35('0x2e')]);_0x387ca8[_0xbd35('0x30')]=_[_0xbd35('0x31')](_0x387ca8[_0xbd35('0x2c')],_0x387ca8['query']);_0x120289[_0xbd35('0x33')]=_['intersection'](_0x387ca8['model'],qs[_0xbd35('0x32')](_0x1db927[_0xbd35('0x2e')][_0xbd35('0x32')]));_0x120289[_0xbd35('0x33')]=_0x120289[_0xbd35('0x33')][_0xbd35('0x34')]?_0x120289['attributes']:_0x387ca8[_0xbd35('0x2c')];if(_0x1db927[_0xbd35('0x2e')][_0xbd35('0x3f')]){_0x120289['include']=[{'all':!![]}];}_0x120289=_['merge']({},_0x120289,_0x1db927[_0xbd35('0x3e')]);return db['AnalyticTreeReport'][_0xbd35('0x46')](_0x120289)['then'](handleEntityNotFound(_0x47d3f7,null))[_0xbd35('0x22')](respondWithResult(_0x47d3f7,null))[_0xbd35('0x42')](handleError(_0x47d3f7,null));};exports[_0xbd35('0x47')]=function(_0x31de69,_0x5195c8){return db['AnalyticTreeReport'][_0xbd35('0x47')](_0x31de69[_0xbd35('0x48')],{})[_0xbd35('0x22')](respondWithResult(_0x5195c8,0xc9))[_0xbd35('0x42')](handleError(_0x5195c8,null));};exports[_0xbd35('0x21')]=function(_0x242111,_0x2adfd2){if(_0x242111['body']['id']){delete _0x242111[_0xbd35('0x48')]['id'];}return db['AnalyticTreeReport']['find']({'where':{'id':_0x242111[_0xbd35('0x44')]['id']}})['then'](handleEntityNotFound(_0x2adfd2,null))[_0xbd35('0x22')](saveUpdates(_0x242111[_0xbd35('0x48')],null))['then'](respondWithResult(_0x2adfd2,null))['catch'](handleError(_0x2adfd2,null));};exports[_0xbd35('0x23')]=function(_0x48caff,_0x2b441a){return db[_0xbd35('0x28')][_0xbd35('0x46')]({'where':{'id':_0x48caff[_0xbd35('0x44')]['id']}})[_0xbd35('0x22')](handleEntityNotFound(_0x2b441a,null))[_0xbd35('0x22')](removeEntity(_0x2b441a,null))[_0xbd35('0x42')](handleError(_0x2b441a,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 0f49e90..1cdfd4c 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 _0x7df0=['rimraf','../../config/environment','./analyticTreeReport.attributes','exports','define','AnalyticTreeReport','analytics_report_trees','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x401a3b,_0x2e37de){var _0x3b9ef4=function(_0xe2badb){while(--_0xe2badb){_0x401a3b['push'](_0x401a3b['shift']());}};_0x3b9ef4(++_0x2e37de);}(_0x7df0,0x14c));var _0x07df=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x7df0[_0x138adb];return _0x1b27f2;};'use strict';var _=require('lodash');var util=require(_0x07df('0x0'));var logger=require(_0x07df('0x1'))(_0x07df('0x2'));var moment=require('moment');var BPromise=require(_0x07df('0x3'));var rp=require(_0x07df('0x4'));var fs=require('fs');var path=require(_0x07df('0x5'));var rimraf=require(_0x07df('0x6'));var config=require(_0x07df('0x7'));var attributes=require(_0x07df('0x8'));module[_0x07df('0x9')]=function(_0x540c1f,_0xc3e433){return _0x540c1f[_0x07df('0xa')](_0x07df('0xb'),attributes,{'tableName':_0x07df('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1b54=['AnalyticTreeReport','analytics_report_trees','lodash','api','moment','bluebird','request-promise','path','../../config/environment','./analyticTreeReport.attributes','define'];(function(_0x31a471,_0x2f3dea){var _0x16f976=function(_0x1e5730){while(--_0x1e5730){_0x31a471['push'](_0x31a471['shift']());}};_0x16f976(++_0x2f3dea);}(_0x1b54,0x91));var _0x41b5=function(_0x3065df,_0x165df8){_0x3065df=_0x3065df-0x0;var _0x2c301f=_0x1b54[_0x3065df];return _0x2c301f;};'use strict';var _=require(_0x41b5('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x41b5('0x1'));var moment=require(_0x41b5('0x2'));var BPromise=require(_0x41b5('0x3'));var rp=require(_0x41b5('0x4'));var fs=require('fs');var path=require(_0x41b5('0x5'));var rimraf=require('rimraf');var config=require(_0x41b5('0x6'));var attributes=require(_0x41b5('0x7'));module['exports']=function(_0x22abe0,_0x1d0a67){return _0x22abe0[_0x41b5('0x8')](_0x41b5('0x9'),attributes,{'tableName':_0x41b5('0xa'),'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 0ec2692..764ad68 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 _0x1261=['then','info','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request'];(function(_0x5d93fb,_0x348924){var _0x344596=function(_0x106142){while(--_0x106142){_0x5d93fb['push'](_0x5d93fb['shift']());}};_0x344596(++_0x348924);}(_0x1261,0x144));var _0x1126=function(_0x2bc2a2,_0x51e95f){_0x2bc2a2=_0x2bc2a2-0x0;var _0x20de67=_0x1261[_0x2bc2a2];return _0x20de67;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var moment=require(_0x1126('0x1'));var BPromise=require(_0x1126('0x2'));var rs=require(_0x1126('0x3'));var fs=require('fs');var Redis=require(_0x1126('0x4'));var db=require(_0x1126('0x5'))['db'];var utils=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));var config=require(_0x1126('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1126('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x907180,_0x4f239c,_0x17e5f0){return new BPromise(function(_0x28772d,_0x245be9){return client[_0x1126('0xb')](_0x907180,_0x17e5f0)[_0x1126('0xc')](function(_0x59cfa1){logger[_0x1126('0xd')](_0x1126('0xe'),_0x4f239c,_0x1126('0xf'));logger['debug'](_0x1126('0x10'),_0x4f239c,'request\x20sent',JSON['stringify'](_0x59cfa1));if(_0x59cfa1[_0x1126('0x11')]){if(_0x59cfa1['error'][_0x1126('0x12')]===0x1f4){logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);return _0x245be9(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1['error']['message']);return _0x28772d(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}else{logger[_0x1126('0xd')]('AnalyticTreeReport,\x20%s,\x20%s',_0x4f239c,_0x1126('0xf'));_0x28772d(_0x59cfa1['result'][_0x1126('0x13')]);}})[_0x1126('0x14')](function(_0x257b5f){logger['error'](_0x1126('0xe'),_0x4f239c,_0x257b5f);_0x245be9(_0x257b5f);});});} \ No newline at end of file +var _0x1261=['then','info','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request'];(function(_0x4f279d,_0x2a09c2){var _0x2c8f53=function(_0x356a61){while(--_0x356a61){_0x4f279d['push'](_0x4f279d['shift']());}};_0x2c8f53(++_0x2a09c2);}(_0x1261,0x144));var _0x1126=function(_0x4d21ff,_0x19d202){_0x4d21ff=_0x4d21ff-0x0;var _0x22b554=_0x1261[_0x4d21ff];return _0x22b554;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var moment=require(_0x1126('0x1'));var BPromise=require(_0x1126('0x2'));var rs=require(_0x1126('0x3'));var fs=require('fs');var Redis=require(_0x1126('0x4'));var db=require(_0x1126('0x5'))['db'];var utils=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));var config=require(_0x1126('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1126('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x907180,_0x4f239c,_0x17e5f0){return new BPromise(function(_0x28772d,_0x245be9){return client[_0x1126('0xb')](_0x907180,_0x17e5f0)[_0x1126('0xc')](function(_0x59cfa1){logger[_0x1126('0xd')](_0x1126('0xe'),_0x4f239c,_0x1126('0xf'));logger['debug'](_0x1126('0x10'),_0x4f239c,'request\x20sent',JSON['stringify'](_0x59cfa1));if(_0x59cfa1[_0x1126('0x11')]){if(_0x59cfa1['error'][_0x1126('0x12')]===0x1f4){logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);return _0x245be9(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1['error']['message']);return _0x28772d(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}else{logger[_0x1126('0xd')]('AnalyticTreeReport,\x20%s,\x20%s',_0x4f239c,_0x1126('0xf'));_0x28772d(_0x59cfa1['result'][_0x1126('0x13')]);}})[_0x1126('0x14')](function(_0x257b5f){logger['error'](_0x1126('0xe'),_0x4f239c,_0x257b5f);_0x245be9(_0x257b5f);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index b2b6ee1..33ec73e 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 _0x1ca6=['post','create','put','update','delete','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','./analyticTreeReport.controller','get','isAuthenticated','index','/:id','show'];(function(_0x170bba,_0x2be92f){var _0xa7c249=function(_0x2b6505){while(--_0x2b6505){_0x170bba['push'](_0x170bba['shift']());}};_0xa7c249(++_0x2be92f);}(_0x1ca6,0x1e1));var _0x61ca=function(_0x32056c,_0x1b6db7){_0x32056c=_0x32056c-0x0;var _0x317313=_0x1ca6[_0x32056c];return _0x317313;};'use strict';var multer=require(_0x61ca('0x0'));var util=require(_0x61ca('0x1'));var path=require(_0x61ca('0x2'));var timeout=require('connect-timeout');var express=require(_0x61ca('0x3'));var router=express[_0x61ca('0x4')]();var fs_extra=require(_0x61ca('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x61ca('0x6'));var config=require('../../config/environment');var controller=require(_0x61ca('0x7'));router[_0x61ca('0x8')]('/',auth[_0x61ca('0x9')](),controller[_0x61ca('0xa')]);router[_0x61ca('0x8')](_0x61ca('0xb'),auth['isAuthenticated'](),controller[_0x61ca('0xc')]);router[_0x61ca('0xd')]('/',auth['isAuthenticated'](),controller[_0x61ca('0xe')]);router[_0x61ca('0xf')](_0x61ca('0xb'),auth[_0x61ca('0x9')](),controller[_0x61ca('0x10')]);router[_0x61ca('0x11')](_0x61ca('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x61ca('0x12')]=router; \ No newline at end of file +var _0xb5c4=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','multer','util','path'];(function(_0x1bf89a,_0x2a2949){var _0x198910=function(_0x171142){while(--_0x171142){_0x1bf89a['push'](_0x1bf89a['shift']());}};_0x198910(++_0x2a2949);}(_0xb5c4,0x129));var _0x4b5c=function(_0x11167c,_0xb0ff07){_0x11167c=_0x11167c-0x0;var _0x34bdb0=_0xb5c4[_0x11167c];return _0x34bdb0;};'use strict';var multer=require(_0x4b5c('0x0'));var util=require(_0x4b5c('0x1'));var path=require(_0x4b5c('0x2'));var timeout=require(_0x4b5c('0x3'));var express=require(_0x4b5c('0x4'));var router=express[_0x4b5c('0x5')]();var fs_extra=require(_0x4b5c('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x4b5c('0x7'));var config=require(_0x4b5c('0x8'));var controller=require(_0x4b5c('0x9'));router[_0x4b5c('0xa')]('/',auth[_0x4b5c('0xb')](),controller['index']);router[_0x4b5c('0xa')](_0x4b5c('0xc'),auth['isAuthenticated'](),controller[_0x4b5c('0xd')]);router[_0x4b5c('0xe')]('/',auth[_0x4b5c('0xb')](),controller[_0x4b5c('0xf')]);router[_0x4b5c('0x10')](_0x4b5c('0xc'),auth[_0x4b5c('0xb')](),controller[_0x4b5c('0x11')]);router[_0x4b5c('0x12')](_0x4b5c('0xc'),auth[_0x4b5c('0xb')](),controller[_0x4b5c('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index a558ff4..a60e7d6 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 _0xa7b4=['STRING','exports'];(function(_0x2be419,_0xf08292){var _0x1efa9f=function(_0x45373c){while(--_0x45373c){_0x2be419['push'](_0x2be419['shift']());}};_0x1efa9f(++_0xf08292);}(_0xa7b4,0x8d));var _0x4a7b=function(_0x2a6109,_0x47853d){_0x2a6109=_0x2a6109-0x0;var _0x36c3d9=_0xa7b4[_0x2a6109];return _0x36c3d9;};'use strict';var Sequelize=require('sequelize');module[_0x4a7b('0x0')]={'name':{'type':Sequelize[_0x4a7b('0x1')]},'basename':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x4a7b('0x1')]}}; \ No newline at end of file +var _0x35d0=['sequelize','exports','STRING'];(function(_0x499d15,_0x5376c1){var _0x189291=function(_0x52884f){while(--_0x52884f){_0x499d15['push'](_0x499d15['shift']());}};_0x189291(++_0x5376c1);}(_0x35d0,0xf9));var _0x035d=function(_0x215e65,_0x183f97){_0x215e65=_0x215e65-0x0;var _0xa85842=_0x35d0[_0x215e65];return _0xa85842;};'use strict';var Sequelize=require(_0x035d('0x0'));module[_0x035d('0x1')]={'name':{'type':Sequelize['STRING']},'basename':{'type':Sequelize[_0x035d('0x2')]},'type':{'type':Sequelize[_0x035d('0x2')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index 8a4ec0b..53a3a78 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 _0xf3bd=['length','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','include','find','catch','clone','params','get','omit','updatedAt','body','createdAt','create','update','file','filename','mimetype','download','findOne','ChatOfflineMessageId','root','join','offline-chat/','basename','eml-format','rimraf','request-promise','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','reject','save','then','destroy','end','error','stack','name','send','index','map','Attachment','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields'];(function(_0x3a4318,_0x13c6eb){var _0x36d746=function(_0x508617){while(--_0x508617){_0x3a4318['push'](_0x3a4318['shift']());}};_0x36d746(++_0x13c6eb);}(_0xf3bd,0x12a));var _0xdf3b=function(_0x510ad9,_0xf3a178){_0x510ad9=_0x510ad9-0x0;var _0x4ca16f=_0xf3bd[_0x510ad9];return _0x4ca16f;};'use strict';var emlformat=require(_0xdf3b('0x0'));var rimraf=require(_0xdf3b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xdf3b('0x2'));var moment=require('moment');var BPromise=require(_0xdf3b('0x3'));var Mustache=require(_0xdf3b('0x4'));var util=require(_0xdf3b('0x5'));var path=require(_0xdf3b('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xdf3b('0x7'));var fs=require('fs');var fs_extra=require(_0xdf3b('0x8'));var _=require(_0xdf3b('0x9'));var squel=require(_0xdf3b('0xa'));var crypto=require(_0xdf3b('0xb'));var jsforce=require(_0xdf3b('0xc'));var deskjs=require(_0xdf3b('0xd'));var toCsv=require(_0xdf3b('0xe'));var querystring=require(_0xdf3b('0xf'));var Papa=require(_0xdf3b('0x10'));var Redis=require(_0xdf3b('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xdf3b('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xdf3b('0x13'))('api');var utils=require('../../config/utils');var config=require(_0xdf3b('0x14'));var licenseUtil=require(_0xdf3b('0x15'));var db=require(_0xdf3b('0x16'))['db'];function respondWithStatusCode(_0x3ac033,_0x1d5874){_0x1d5874=_0x1d5874||0xcc;return function(_0x5a8527){if(_0x5a8527){return _0x3ac033[_0xdf3b('0x17')](_0x1d5874);}return _0x3ac033[_0xdf3b('0x18')](_0x1d5874)['end']();};}function respondWithResult(_0x39e20c,_0x1954bc){_0x1954bc=_0x1954bc||0xc8;return function(_0x11d628){if(_0x11d628){return _0x39e20c[_0xdf3b('0x18')](_0x1954bc)[_0xdf3b('0x19')](_0x11d628);}};}function respondWithFilteredResult(_0x28f05f,_0x1539cd){return function(_0x24c6f8){if(_0x24c6f8){var _0x2415a0=typeof _0x1539cd['offset']===_0xdf3b('0x1a')&&typeof _0x1539cd[_0xdf3b('0x1b')]==='undefined';var _0x6de785=_0x24c6f8[_0xdf3b('0x1c')];var _0x2989bf=_0x2415a0?0x0:_0x1539cd[_0xdf3b('0x1d')];var _0x3bcae5=_0x2415a0?_0x24c6f8[_0xdf3b('0x1c')]:_0x1539cd[_0xdf3b('0x1d')]+_0x1539cd[_0xdf3b('0x1b')];var _0x1767b9;if(_0x3bcae5>=_0x6de785){_0x3bcae5=_0x6de785;_0x1767b9=0xc8;}else{_0x1767b9=0xce;}_0x28f05f[_0xdf3b('0x18')](_0x1767b9);return _0x28f05f[_0xdf3b('0x1e')](_0xdf3b('0x1f'),_0x2989bf+'-'+_0x3bcae5+'/'+_0x6de785)[_0xdf3b('0x19')](_0x24c6f8);}return null;};}function patchUpdates(_0x39bed7){return function(_0x4c1553){try{jsonpatch['apply'](_0x4c1553,_0x39bed7,!![]);}catch(_0x20599f){return BPromise[_0xdf3b('0x20')](_0x20599f);}return _0x4c1553[_0xdf3b('0x21')]();};}function saveUpdates(_0x2bdffa,_0x1350c9){return function(_0x272abe){if(_0x272abe){return _0x272abe['update'](_0x2bdffa)[_0xdf3b('0x22')](function(_0x3ba581){return _0x3ba581;});}return null;};}function removeEntity(_0x436bad,_0x58cf04){return function(_0x1f1136){if(_0x1f1136){return _0x1f1136[_0xdf3b('0x23')]()['then'](function(){_0x436bad['status'](0xcc)[_0xdf3b('0x24')]();});}};}function handleEntityNotFound(_0x206e75,_0x4300ac){return function(_0x3fb056){if(!_0x3fb056){_0x206e75['sendStatus'](0x194);}return _0x3fb056;};}function handleError(_0x7fba88,_0x28c6f6){_0x28c6f6=_0x28c6f6||0x1f4;return function(_0x3feac6){logger[_0xdf3b('0x25')](_0x3feac6[_0xdf3b('0x26')]);if(_0x3feac6[_0xdf3b('0x27')]){delete _0x3feac6[_0xdf3b('0x27')];}_0x7fba88[_0xdf3b('0x18')](_0x28c6f6)[_0xdf3b('0x28')](_0x3feac6);};}exports[_0xdf3b('0x29')]=function(_0x946313,_0x3f8461){var _0x4cf65d={},_0x16d307={},_0x31abc4={'count':0x0,'rows':[]};var _0x39ce7c=_[_0xdf3b('0x2a')](db[_0xdf3b('0x2b')][_0xdf3b('0x2c')],function(_0x4b7f54){return{'name':_0x4b7f54[_0xdf3b('0x2d')],'type':_0x4b7f54[_0xdf3b('0x2e')][_0xdf3b('0x2f')]};});_0x16d307[_0xdf3b('0x30')]=_[_0xdf3b('0x2a')](_0x39ce7c,'name');_0x16d307[_0xdf3b('0x31')]=_[_0xdf3b('0x32')](_0x946313[_0xdf3b('0x31')]);_0x16d307['filters']=_[_0xdf3b('0x33')](_0x16d307[_0xdf3b('0x30')],_0x16d307[_0xdf3b('0x31')]);_0x4cf65d[_0xdf3b('0x34')]=_[_0xdf3b('0x33')](_0x16d307['model'],qs[_0xdf3b('0x35')](_0x946313['query'][_0xdf3b('0x35')]));_0x4cf65d[_0xdf3b('0x34')]=_0x4cf65d[_0xdf3b('0x34')][_0xdf3b('0x36')]?_0x4cf65d[_0xdf3b('0x34')]:_0x16d307[_0xdf3b('0x30')];if(!_0x946313[_0xdf3b('0x31')]['hasOwnProperty'](_0xdf3b('0x37'))){_0x4cf65d[_0xdf3b('0x1b')]=qs[_0xdf3b('0x1b')](_0x946313[_0xdf3b('0x31')][_0xdf3b('0x1b')]);_0x4cf65d['offset']=qs[_0xdf3b('0x1d')](_0x946313[_0xdf3b('0x31')][_0xdf3b('0x1d')]);}_0x4cf65d[_0xdf3b('0x38')]=qs[_0xdf3b('0x39')](_0x946313['query']['sort']);_0x4cf65d['where']=qs[_0xdf3b('0x3a')](_[_0xdf3b('0x3b')](_0x946313['query'],_0x16d307[_0xdf3b('0x3a')]),_0x39ce7c);if(_0x946313['query'][_0xdf3b('0x3c')]){_0x4cf65d[_0xdf3b('0x3d')]=_[_0xdf3b('0x3e')](_0x4cf65d[_0xdf3b('0x3d')],{'$or':_[_0xdf3b('0x2a')](_0x39ce7c,function(_0x111170){if(_0x111170[_0xdf3b('0x2e')]!==_0xdf3b('0x3f')){var _0x25cfbc={};_0x25cfbc[_0x111170['name']]={'$like':'%'+_0x946313[_0xdf3b('0x31')][_0xdf3b('0x3c')]+'%'};return _0x25cfbc;}})});}_0x4cf65d=_[_0xdf3b('0x3e')]({},_0x4cf65d,_0x946313[_0xdf3b('0x40')]);var _0x227054={'where':_0x4cf65d['where']};return db[_0xdf3b('0x2b')][_0xdf3b('0x1c')](_0x227054)['then'](function(_0x2fc8e8){_0x31abc4[_0xdf3b('0x1c')]=_0x2fc8e8;if(_0x946313[_0xdf3b('0x31')][_0xdf3b('0x41')]){_0x4cf65d[_0xdf3b('0x42')]=[{'all':!![]}];}return db[_0xdf3b('0x2b')]['findAll'](_0x4cf65d);})[_0xdf3b('0x22')](function(_0x55d676){_0x31abc4['rows']=_0x55d676;return _0x31abc4;})[_0xdf3b('0x22')](respondWithFilteredResult(_0x3f8461,_0x4cf65d))['catch'](handleError(_0x3f8461,null));};exports['show']=function(_0x1e6f21,_0x1369dd){var _0x4d9982={'raw':!![],'where':{'id':_0x1e6f21['params']['id']}},_0x58bd86={};_0x58bd86[_0xdf3b('0x30')]=_[_0xdf3b('0x32')](db[_0xdf3b('0x2b')][_0xdf3b('0x2c')]);_0x58bd86[_0xdf3b('0x31')]=_['keys'](_0x1e6f21[_0xdf3b('0x31')]);_0x58bd86[_0xdf3b('0x3a')]=_[_0xdf3b('0x33')](_0x58bd86[_0xdf3b('0x30')],_0x58bd86[_0xdf3b('0x31')]);_0x4d9982[_0xdf3b('0x34')]=_['intersection'](_0x58bd86['model'],qs[_0xdf3b('0x35')](_0x1e6f21[_0xdf3b('0x31')][_0xdf3b('0x35')]));_0x4d9982[_0xdf3b('0x34')]=_0x4d9982[_0xdf3b('0x34')]['length']?_0x4d9982[_0xdf3b('0x34')]:_0x58bd86[_0xdf3b('0x30')];if(_0x1e6f21[_0xdf3b('0x31')][_0xdf3b('0x41')]){_0x4d9982['include']=[{'all':!![]}];}_0x4d9982=_[_0xdf3b('0x3e')]({},_0x4d9982,_0x1e6f21[_0xdf3b('0x40')]);return db['Attachment'][_0xdf3b('0x43')](_0x4d9982)[_0xdf3b('0x22')](handleEntityNotFound(_0x1369dd,null))['then'](respondWithResult(_0x1369dd,null))[_0xdf3b('0x44')](handleError(_0x1369dd,null));};exports[_0xdf3b('0x45')]=function(_0x1a0f2d,_0x2315d6){var _0x1b0e7c={'where':{'id':_0x1a0f2d[_0xdf3b('0x46')]['id']}},_0x13884e={};_0x13884e[_0xdf3b('0x30')]=_[_0xdf3b('0x32')](db[_0xdf3b('0x2b')]['rawAttributes']);_0x1b0e7c['attributes']=_[_0xdf3b('0x33')](_0x13884e[_0xdf3b('0x30')],qs['fields'](_0x1a0f2d[_0xdf3b('0x31')]['fields']));_0x1b0e7c['attributes']=_0x1b0e7c['attributes'][_0xdf3b('0x36')]?_0x1b0e7c[_0xdf3b('0x34')]:_0x13884e['model'];if(_0x1a0f2d[_0xdf3b('0x31')][_0xdf3b('0x41')]){_0x1b0e7c[_0xdf3b('0x42')]=[{'all':!![]}];}_0x1b0e7c=_[_0xdf3b('0x3e')]({},_0x1b0e7c,_0x1a0f2d['options']);return db['Attachment']['find'](_0x1b0e7c)[_0xdf3b('0x22')](handleEntityNotFound(_0x2315d6,null))['then'](function(_0x5e53c7){if(_0x5e53c7){var _0xbfdc8=_0x5e53c7[_0xdf3b('0x47')]({'plain':!![]});_0xbfdc8=qs[_0xdf3b('0x48')](_0xbfdc8,['id','createdAt',_0xdf3b('0x49')]);_0x1a0f2d[_0xdf3b('0x4a')]=_[_0xdf3b('0x48')](_0x1a0f2d[_0xdf3b('0x4a')],['id',_0xdf3b('0x4b'),_0xdf3b('0x49')]);return db[_0xdf3b('0x2b')][_0xdf3b('0x4c')](_[_0xdf3b('0x3e')](_0xbfdc8,_0x1a0f2d['body']),{'include':_0x1a0f2d[_0xdf3b('0x31')][_0xdf3b('0x41')]?[{'all':!![]}]:undefined});}})[_0xdf3b('0x22')](respondWithResult(_0x2315d6,0xc9))['catch'](handleError(_0x2315d6,null));};exports[_0xdf3b('0x4d')]=function(_0x5b629d,_0x9ee0df){if(_0x5b629d[_0xdf3b('0x4a')]['id']){delete _0x5b629d[_0xdf3b('0x4a')]['id'];}return db[_0xdf3b('0x2b')]['find']({'where':{'id':_0x5b629d[_0xdf3b('0x46')]['id']}})[_0xdf3b('0x22')](handleEntityNotFound(_0x9ee0df,null))[_0xdf3b('0x22')](saveUpdates(_0x5b629d[_0xdf3b('0x4a')],null))[_0xdf3b('0x22')](respondWithResult(_0x9ee0df,null))[_0xdf3b('0x44')](handleError(_0x9ee0df,null));};exports[_0xdf3b('0x23')]=function(_0x22364e,_0x209bce){return db[_0xdf3b('0x2b')][_0xdf3b('0x43')]({'where':{'id':_0x22364e[_0xdf3b('0x46')]['id']}})[_0xdf3b('0x22')](handleEntityNotFound(_0x209bce,null))['then'](removeEntity(_0x209bce,null))[_0xdf3b('0x44')](handleError(_0x209bce,null));};exports['create']=function(_0x4e5f7e,_0x5d8eae,_0x586a11){_0x4e5f7e[_0xdf3b('0x4a')][_0xdf3b('0x27')]=_0x4e5f7e[_0xdf3b('0x4e')]['originalname'];_0x4e5f7e[_0xdf3b('0x4a')]['basename']=_0x4e5f7e[_0xdf3b('0x4e')][_0xdf3b('0x4f')];_0x4e5f7e['body'][_0xdf3b('0x2e')]=_0x4e5f7e[_0xdf3b('0x4e')][_0xdf3b('0x50')];return db['Attachment']['create'](_0x4e5f7e[_0xdf3b('0x4a')])['then'](respondWithResult(_0x5d8eae,0xc9))['catch'](handleError(_0x5d8eae,null));};exports[_0xdf3b('0x51')]=function(_0xe3b667,_0x5507b8,_0x25f727){return db[_0xdf3b('0x2b')][_0xdf3b('0x52')]({'where':{'id':_0xe3b667['params']['id']},'raw':!![]})[_0xdf3b('0x22')](handleEntityNotFound(_0x5507b8,null))[_0xdf3b('0x22')](function(_0x4a98fd){if(_0x4a98fd){var _0x11f89d=_0x4a98fd[_0xdf3b('0x53')]!==null;var _0x1d9195=path['join'](config[_0xdf3b('0x54')],'server/files/attachments/');if(_0x11f89d){_0x1d9195=path[_0xdf3b('0x55')](_0x1d9195,_0xdf3b('0x56'));}var _0x33083a=path['join'](_0x1d9195,_0x4a98fd[_0xdf3b('0x57')]);return _0x5507b8[_0xdf3b('0x51')](_0x33083a);}})[_0xdf3b('0x44')](handleError(_0x5507b8,null));}; \ No newline at end of file +var _0x2574=['moment','bluebird','mustache','path','sox','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','limit','count','set','Content-Range','json','reject','save','update','then','destroy','error','stack','send','index','Attachment','rawAttributes','fieldName','type','key','model','name','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','include','rows','catch','show','params','keys','includeAll','find','clone','omit','createdAt','body','updatedAt','create','file','filename','mimetype','download','ChatOfflineMessageId','join','server/files/attachments/','offline-chat/','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x3b67be,_0x8c9e58){var _0x1b726d=function(_0x164947){while(--_0x164947){_0x3b67be['push'](_0x3b67be['shift']());}};_0x1b726d(++_0x8c9e58);}(_0x2574,0x1b8));var _0x4257=function(_0x1cceb0,_0x3649da){_0x1cceb0=_0x1cceb0-0x0;var _0xa93eea=_0x2574[_0x1cceb0];return _0xa93eea;};'use strict';var emlformat=require(_0x4257('0x0'));var rimraf=require(_0x4257('0x1'));var zipdir=require(_0x4257('0x2'));var jsonpatch=require(_0x4257('0x3'));var rp=require(_0x4257('0x4'));var moment=require(_0x4257('0x5'));var BPromise=require(_0x4257('0x6'));var Mustache=require(_0x4257('0x7'));var util=require('util');var path=require(_0x4257('0x8'));var sox=require(_0x4257('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4257('0xa'));var squel=require(_0x4257('0xb'));var crypto=require(_0x4257('0xc'));var jsforce=require(_0x4257('0xd'));var deskjs=require(_0x4257('0xe'));var toCsv=require('to-csv');var querystring=require(_0x4257('0xf'));var Papa=require(_0x4257('0x10'));var Redis=require(_0x4257('0x11'));var authService=require(_0x4257('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x4257('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4257('0x14'))(_0x4257('0x15'));var utils=require(_0x4257('0x16'));var config=require(_0x4257('0x17'));var licenseUtil=require(_0x4257('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2e3ebb,_0x3ce985){_0x3ce985=_0x3ce985||0xcc;return function(_0x19becd){if(_0x19becd){return _0x2e3ebb[_0x4257('0x19')](_0x3ce985);}return _0x2e3ebb[_0x4257('0x1a')](_0x3ce985)[_0x4257('0x1b')]();};}function respondWithResult(_0x196f6d,_0x434eb8){_0x434eb8=_0x434eb8||0xc8;return function(_0x1fc773){if(_0x1fc773){return _0x196f6d[_0x4257('0x1a')](_0x434eb8)['json'](_0x1fc773);}};}function respondWithFilteredResult(_0x4ede11,_0xa2934d){return function(_0x21a748){if(_0x21a748){var _0x35021c=typeof _0xa2934d[_0x4257('0x1c')]==='undefined'&&typeof _0xa2934d[_0x4257('0x1d')]==='undefined';var _0x3eee47=_0x21a748[_0x4257('0x1e')];var _0x184aee=_0x35021c?0x0:_0xa2934d[_0x4257('0x1c')];var _0x4a866d=_0x35021c?_0x21a748['count']:_0xa2934d[_0x4257('0x1c')]+_0xa2934d[_0x4257('0x1d')];var _0x380281;if(_0x4a866d>=_0x3eee47){_0x4a866d=_0x3eee47;_0x380281=0xc8;}else{_0x380281=0xce;}_0x4ede11[_0x4257('0x1a')](_0x380281);return _0x4ede11[_0x4257('0x1f')](_0x4257('0x20'),_0x184aee+'-'+_0x4a866d+'/'+_0x3eee47)[_0x4257('0x21')](_0x21a748);}return null;};}function patchUpdates(_0x458993){return function(_0x44704f){try{jsonpatch['apply'](_0x44704f,_0x458993,!![]);}catch(_0x58f3ee){return BPromise[_0x4257('0x22')](_0x58f3ee);}return _0x44704f[_0x4257('0x23')]();};}function saveUpdates(_0x271304,_0x4c2284){return function(_0x5d1b21){if(_0x5d1b21){return _0x5d1b21[_0x4257('0x24')](_0x271304)[_0x4257('0x25')](function(_0x39b817){return _0x39b817;});}return null;};}function removeEntity(_0xa944cd,_0x2638e2){return function(_0x49ea5d){if(_0x49ea5d){return _0x49ea5d[_0x4257('0x26')]()[_0x4257('0x25')](function(){_0xa944cd[_0x4257('0x1a')](0xcc)[_0x4257('0x1b')]();});}};}function handleEntityNotFound(_0x63148f,_0x34aef7){return function(_0xdf20b4){if(!_0xdf20b4){_0x63148f[_0x4257('0x19')](0x194);}return _0xdf20b4;};}function handleError(_0x1caf3f,_0x1c3a25){_0x1c3a25=_0x1c3a25||0x1f4;return function(_0x34301f){logger[_0x4257('0x27')](_0x34301f[_0x4257('0x28')]);if(_0x34301f['name']){delete _0x34301f['name'];}_0x1caf3f[_0x4257('0x1a')](_0x1c3a25)[_0x4257('0x29')](_0x34301f);};}exports[_0x4257('0x2a')]=function(_0x50658b,_0x4ec4a3){var _0x3a40ab={},_0x8396f9={},_0x5d3de0={'count':0x0,'rows':[]};var _0x539cab=_['map'](db[_0x4257('0x2b')][_0x4257('0x2c')],function(_0x492991){return{'name':_0x492991[_0x4257('0x2d')],'type':_0x492991[_0x4257('0x2e')][_0x4257('0x2f')]};});_0x8396f9[_0x4257('0x30')]=_['map'](_0x539cab,_0x4257('0x31'));_0x8396f9[_0x4257('0x32')]=_['keys'](_0x50658b[_0x4257('0x32')]);_0x8396f9[_0x4257('0x33')]=_[_0x4257('0x34')](_0x8396f9[_0x4257('0x30')],_0x8396f9[_0x4257('0x32')]);_0x3a40ab['attributes']=_[_0x4257('0x34')](_0x8396f9[_0x4257('0x30')],qs[_0x4257('0x35')](_0x50658b[_0x4257('0x32')]['fields']));_0x3a40ab[_0x4257('0x36')]=_0x3a40ab[_0x4257('0x36')][_0x4257('0x37')]?_0x3a40ab[_0x4257('0x36')]:_0x8396f9['model'];if(!_0x50658b[_0x4257('0x32')][_0x4257('0x38')](_0x4257('0x39'))){_0x3a40ab['limit']=qs[_0x4257('0x1d')](_0x50658b[_0x4257('0x32')][_0x4257('0x1d')]);_0x3a40ab['offset']=qs[_0x4257('0x1c')](_0x50658b['query']['offset']);}_0x3a40ab[_0x4257('0x3a')]=qs[_0x4257('0x3b')](_0x50658b['query'][_0x4257('0x3b')]);_0x3a40ab[_0x4257('0x3c')]=qs[_0x4257('0x33')](_[_0x4257('0x3d')](_0x50658b[_0x4257('0x32')],_0x8396f9['filters']),_0x539cab);if(_0x50658b[_0x4257('0x32')][_0x4257('0x3e')]){_0x3a40ab[_0x4257('0x3c')]=_[_0x4257('0x3f')](_0x3a40ab['where'],{'$or':_[_0x4257('0x40')](_0x539cab,function(_0x245ac9){if(_0x245ac9['type']!==_0x4257('0x41')){var _0x40735f={};_0x40735f[_0x245ac9[_0x4257('0x31')]]={'$like':'%'+_0x50658b['query'][_0x4257('0x3e')]+'%'};return _0x40735f;}})});}_0x3a40ab=_[_0x4257('0x3f')]({},_0x3a40ab,_0x50658b[_0x4257('0x42')]);var _0x303c7b={'where':_0x3a40ab['where']};return db['Attachment'][_0x4257('0x1e')](_0x303c7b)[_0x4257('0x25')](function(_0x34e403){_0x5d3de0[_0x4257('0x1e')]=_0x34e403;if(_0x50658b[_0x4257('0x32')]['includeAll']){_0x3a40ab[_0x4257('0x43')]=[{'all':!![]}];}return db[_0x4257('0x2b')]['findAll'](_0x3a40ab);})[_0x4257('0x25')](function(_0x436ab3){_0x5d3de0[_0x4257('0x44')]=_0x436ab3;return _0x5d3de0;})[_0x4257('0x25')](respondWithFilteredResult(_0x4ec4a3,_0x3a40ab))[_0x4257('0x45')](handleError(_0x4ec4a3,null));};exports[_0x4257('0x46')]=function(_0x27fd32,_0x1ef66b){var _0x3de612={'raw':!![],'where':{'id':_0x27fd32[_0x4257('0x47')]['id']}},_0x104636={};_0x104636[_0x4257('0x30')]=_[_0x4257('0x48')](db[_0x4257('0x2b')][_0x4257('0x2c')]);_0x104636[_0x4257('0x32')]=_[_0x4257('0x48')](_0x27fd32[_0x4257('0x32')]);_0x104636['filters']=_[_0x4257('0x34')](_0x104636[_0x4257('0x30')],_0x104636['query']);_0x3de612[_0x4257('0x36')]=_[_0x4257('0x34')](_0x104636[_0x4257('0x30')],qs[_0x4257('0x35')](_0x27fd32[_0x4257('0x32')][_0x4257('0x35')]));_0x3de612[_0x4257('0x36')]=_0x3de612[_0x4257('0x36')][_0x4257('0x37')]?_0x3de612[_0x4257('0x36')]:_0x104636[_0x4257('0x30')];if(_0x27fd32[_0x4257('0x32')][_0x4257('0x49')]){_0x3de612[_0x4257('0x43')]=[{'all':!![]}];}_0x3de612=_[_0x4257('0x3f')]({},_0x3de612,_0x27fd32[_0x4257('0x42')]);return db[_0x4257('0x2b')][_0x4257('0x4a')](_0x3de612)[_0x4257('0x25')](handleEntityNotFound(_0x1ef66b,null))[_0x4257('0x25')](respondWithResult(_0x1ef66b,null))[_0x4257('0x45')](handleError(_0x1ef66b,null));};exports[_0x4257('0x4b')]=function(_0x81f54f,_0xc22b30){var _0x255d04={'where':{'id':_0x81f54f['params']['id']}},_0xde8656={};_0xde8656[_0x4257('0x30')]=_['keys'](db[_0x4257('0x2b')][_0x4257('0x2c')]);_0x255d04['attributes']=_[_0x4257('0x34')](_0xde8656['model'],qs[_0x4257('0x35')](_0x81f54f[_0x4257('0x32')]['fields']));_0x255d04['attributes']=_0x255d04[_0x4257('0x36')][_0x4257('0x37')]?_0x255d04[_0x4257('0x36')]:_0xde8656['model'];if(_0x81f54f['query'][_0x4257('0x49')]){_0x255d04[_0x4257('0x43')]=[{'all':!![]}];}_0x255d04=_[_0x4257('0x3f')]({},_0x255d04,_0x81f54f[_0x4257('0x42')]);return db[_0x4257('0x2b')]['find'](_0x255d04)['then'](handleEntityNotFound(_0xc22b30,null))[_0x4257('0x25')](function(_0x25c873){if(_0x25c873){var _0x2a8138=_0x25c873['get']({'plain':!![]});_0x2a8138=qs[_0x4257('0x4c')](_0x2a8138,['id',_0x4257('0x4d'),'updatedAt']);_0x81f54f['body']=_[_0x4257('0x4c')](_0x81f54f[_0x4257('0x4e')],['id',_0x4257('0x4d'),_0x4257('0x4f')]);return db[_0x4257('0x2b')]['create'](_[_0x4257('0x3f')](_0x2a8138,_0x81f54f['body']),{'include':_0x81f54f[_0x4257('0x32')][_0x4257('0x49')]?[{'all':!![]}]:undefined});}})[_0x4257('0x25')](respondWithResult(_0xc22b30,0xc9))[_0x4257('0x45')](handleError(_0xc22b30,null));};exports[_0x4257('0x24')]=function(_0x5a8ea7,_0xa6b050){if(_0x5a8ea7['body']['id']){delete _0x5a8ea7['body']['id'];}return db[_0x4257('0x2b')][_0x4257('0x4a')]({'where':{'id':_0x5a8ea7['params']['id']}})['then'](handleEntityNotFound(_0xa6b050,null))[_0x4257('0x25')](saveUpdates(_0x5a8ea7[_0x4257('0x4e')],null))['then'](respondWithResult(_0xa6b050,null))[_0x4257('0x45')](handleError(_0xa6b050,null));};exports[_0x4257('0x26')]=function(_0x1aea0f,_0x2da694){return db[_0x4257('0x2b')][_0x4257('0x4a')]({'where':{'id':_0x1aea0f[_0x4257('0x47')]['id']}})['then'](handleEntityNotFound(_0x2da694,null))[_0x4257('0x25')](removeEntity(_0x2da694,null))[_0x4257('0x45')](handleError(_0x2da694,null));};exports[_0x4257('0x50')]=function(_0x5d0216,_0x4c6ac2,_0x37c2f7){_0x5d0216[_0x4257('0x4e')][_0x4257('0x31')]=_0x5d0216[_0x4257('0x51')]['originalname'];_0x5d0216[_0x4257('0x4e')]['basename']=_0x5d0216[_0x4257('0x51')][_0x4257('0x52')];_0x5d0216[_0x4257('0x4e')][_0x4257('0x2e')]=_0x5d0216[_0x4257('0x51')][_0x4257('0x53')];return db[_0x4257('0x2b')]['create'](_0x5d0216[_0x4257('0x4e')])[_0x4257('0x25')](respondWithResult(_0x4c6ac2,0xc9))[_0x4257('0x45')](handleError(_0x4c6ac2,null));};exports[_0x4257('0x54')]=function(_0x41ef3f,_0x449ad0,_0x2f15f3){return db[_0x4257('0x2b')]['findOne']({'where':{'id':_0x41ef3f['params']['id']},'raw':!![]})[_0x4257('0x25')](handleEntityNotFound(_0x449ad0,null))[_0x4257('0x25')](function(_0x2a1da5){if(_0x2a1da5){var _0x3926ba=_0x2a1da5[_0x4257('0x55')]!==null;var _0x3873d6=path[_0x4257('0x56')](config['root'],_0x4257('0x57'));if(_0x3926ba){_0x3873d6=path[_0x4257('0x56')](_0x3873d6,_0x4257('0x58'));}var _0x1a5a50=path[_0x4257('0x56')](_0x3873d6,_0x2a1da5['basename']);return _0x449ad0[_0x4257('0x54')](_0x1a5a50);}})[_0x4257('0x45')](handleError(_0x449ad0,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index c6439f1..88027c7 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 _0xa21f=['../../config/logger','api','moment','path','rimraf','./attachment.attributes','exports','Attachment','attachments','lodash','util'];(function(_0x416c5a,_0x34326e){var _0x20c95a=function(_0x445afd){while(--_0x445afd){_0x416c5a['push'](_0x416c5a['shift']());}};_0x20c95a(++_0x34326e);}(_0xa21f,0x174));var _0xfa21=function(_0x820dcd,_0x44a136){_0x820dcd=_0x820dcd-0x0;var _0x1a7c7d=_0xa21f[_0x820dcd];return _0x1a7c7d;};'use strict';var _=require(_0xfa21('0x0'));var util=require(_0xfa21('0x1'));var logger=require(_0xfa21('0x2'))(_0xfa21('0x3'));var moment=require(_0xfa21('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xfa21('0x5'));var rimraf=require(_0xfa21('0x6'));var config=require('../../config/environment');var attributes=require(_0xfa21('0x7'));module[_0xfa21('0x8')]=function(_0x2310eb,_0x2574eb){return _0x2310eb['define'](_0xfa21('0x9'),attributes,{'tableName':_0xfa21('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf8d0=['./attachment.attributes','exports','attachments','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment'];(function(_0x3de2e8,_0x1faa8a){var _0x12481c=function(_0x318fe5){while(--_0x318fe5){_0x3de2e8['push'](_0x3de2e8['shift']());}};_0x12481c(++_0x1faa8a);}(_0xf8d0,0xf5));var _0x0f8d=function(_0x38b78a,_0x2b8c95){_0x38b78a=_0x38b78a-0x0;var _0x526299=_0xf8d0[_0x38b78a];return _0x526299;};'use strict';var _=require(_0x0f8d('0x0'));var util=require(_0x0f8d('0x1'));var logger=require(_0x0f8d('0x2'))(_0x0f8d('0x3'));var moment=require(_0x0f8d('0x4'));var BPromise=require(_0x0f8d('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x0f8d('0x6'));var config=require(_0x0f8d('0x7'));var attributes=require(_0x0f8d('0x8'));module[_0x0f8d('0x9')]=function(_0x565219,_0x415545){return _0x565219['define']('Attachment',attributes,{'tableName':_0x0f8d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/attachment/attachment.rpc.js b/server/api/attachment/attachment.rpc.js index 55d143b..15f5e1c 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 _0xc1c4=['Attachment','create','body','options','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Attachment,\x20%s,\x20%s','Attachment,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateAttachment'];(function(_0x44c31e,_0x461e58){var _0x3b79b6=function(_0x8cc30d){while(--_0x8cc30d){_0x44c31e['push'](_0x44c31e['shift']());}};_0x3b79b6(++_0x461e58);}(_0xc1c4,0x1c7));var _0x4c1c=function(_0x40b22c,_0x448a14){_0x40b22c=_0x40b22c-0x0;var _0x3384ed=_0xc1c4[_0x40b22c];return _0x3384ed;};'use strict';var _=require(_0x4c1c('0x0'));var util=require(_0x4c1c('0x1'));var moment=require(_0x4c1c('0x2'));var BPromise=require(_0x4c1c('0x3'));var rs=require(_0x4c1c('0x4'));var fs=require('fs');var Redis=require(_0x4c1c('0x5'));var db=require(_0x4c1c('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x4c1c('0x7'))(_0x4c1c('0x8'));var config=require(_0x4c1c('0x9'));var jayson=require(_0x4c1c('0xa'));var client=jayson['client'][_0x4c1c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4f5a4f,_0x5863d0,_0x20e276){return new BPromise(function(_0x3337e4,_0x486065){return client[_0x4c1c('0xc')](_0x4f5a4f,_0x20e276)[_0x4c1c('0xd')](function(_0x445441){logger[_0x4c1c('0xe')](_0x4c1c('0xf'),_0x5863d0,'request\x20sent');logger['debug'](_0x4c1c('0x10'),_0x5863d0,_0x4c1c('0x11'),JSON[_0x4c1c('0x12')](_0x445441));if(_0x445441[_0x4c1c('0x13')]){if(_0x445441[_0x4c1c('0x13')][_0x4c1c('0x14')]===0x1f4){logger['error']('Attachment,\x20%s,\x20%s',_0x5863d0,_0x445441[_0x4c1c('0x13')][_0x4c1c('0x15')]);return _0x486065(_0x445441[_0x4c1c('0x13')][_0x4c1c('0x15')]);}logger[_0x4c1c('0x13')]('Attachment,\x20%s,\x20%s',_0x5863d0,_0x445441[_0x4c1c('0x13')][_0x4c1c('0x15')]);return _0x3337e4(_0x445441['error'][_0x4c1c('0x15')]);}else{logger[_0x4c1c('0xe')](_0x4c1c('0xf'),_0x5863d0,_0x4c1c('0x11'));_0x3337e4(_0x445441[_0x4c1c('0x16')][_0x4c1c('0x15')]);}})[_0x4c1c('0x17')](function(_0x33641d){logger[_0x4c1c('0x13')](_0x4c1c('0xf'),_0x5863d0,_0x33641d);_0x486065(_0x33641d);});});}exports[_0x4c1c('0x18')]=function(_0x5a9217){var _0x1fad89=this;return new Promise(function(_0x213019,_0x64fe4b){return db[_0x4c1c('0x19')][_0x4c1c('0x1a')](_0x5a9217[_0x4c1c('0x1b')],{'raw':_0x5a9217[_0x4c1c('0x1c')]?_0x5a9217[_0x4c1c('0x1c')][_0x4c1c('0x1d')]===undefined?!![]:![]:!![]})[_0x4c1c('0xd')](function(_0x58aca9){logger['info'](_0x4c1c('0x18'),_0x5a9217);logger['debug'](_0x4c1c('0x18'),_0x5a9217,JSON[_0x4c1c('0x12')](_0x58aca9));_0x213019(_0x58aca9);})['catch'](function(_0x23377c){logger['error']('CreateAttachment',_0x23377c[_0x4c1c('0x15')],_0x5a9217);_0x64fe4b(_0x1fad89[_0x4c1c('0x13')](0x1f4,_0x23377c[_0x4c1c('0x15')]));});});}; \ No newline at end of file +var _0xb07f=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','Attachment,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','Attachment','create','options','raw','CreateAttachment','debug','lodash','util','moment','bluebird','randomstring'];(function(_0x46aff0,_0x122890){var _0x9d78cf=function(_0x3f14cb){while(--_0x3f14cb){_0x46aff0['push'](_0x46aff0['shift']());}};_0x9d78cf(++_0x122890);}(_0xb07f,0x109));var _0xfb07=function(_0x19a90a,_0x2e3aef){_0x19a90a=_0x19a90a-0x0;var _0x1abe5d=_0xb07f[_0x19a90a];return _0x1abe5d;};'use strict';var _=require(_0xfb07('0x0'));var util=require(_0xfb07('0x1'));var moment=require(_0xfb07('0x2'));var BPromise=require(_0xfb07('0x3'));var rs=require(_0xfb07('0x4'));var fs=require('fs');var Redis=require(_0xfb07('0x5'));var db=require(_0xfb07('0x6'))['db'];var utils=require(_0xfb07('0x7'));var logger=require(_0xfb07('0x8'))(_0xfb07('0x9'));var config=require(_0xfb07('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xfb07('0xb')][_0xfb07('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x14fc69,_0x1efe64,_0x41d73a){return new BPromise(function(_0x3bb9cf,_0x2b5000){return client[_0xfb07('0xd')](_0x14fc69,_0x41d73a)[_0xfb07('0xe')](function(_0x3d7220){logger[_0xfb07('0xf')](_0xfb07('0x10'),_0x1efe64,'request\x20sent');logger['debug']('Attachment,\x20%s,\x20%s,\x20%s',_0x1efe64,_0xfb07('0x11'),JSON[_0xfb07('0x12')](_0x3d7220));if(_0x3d7220['error']){if(_0x3d7220[_0xfb07('0x13')][_0xfb07('0x14')]===0x1f4){logger[_0xfb07('0x13')](_0xfb07('0x10'),_0x1efe64,_0x3d7220[_0xfb07('0x13')][_0xfb07('0x15')]);return _0x2b5000(_0x3d7220[_0xfb07('0x13')]['message']);}logger[_0xfb07('0x13')](_0xfb07('0x10'),_0x1efe64,_0x3d7220[_0xfb07('0x13')][_0xfb07('0x15')]);return _0x3bb9cf(_0x3d7220[_0xfb07('0x13')][_0xfb07('0x15')]);}else{logger[_0xfb07('0xf')](_0xfb07('0x10'),_0x1efe64,_0xfb07('0x11'));_0x3bb9cf(_0x3d7220[_0xfb07('0x16')][_0xfb07('0x15')]);}})[_0xfb07('0x17')](function(_0x1e42c4){logger[_0xfb07('0x13')]('Attachment,\x20%s,\x20%s',_0x1efe64,_0x1e42c4);_0x2b5000(_0x1e42c4);});});}exports['CreateAttachment']=function(_0x3e747e){var _0x44b9c4=this;return new Promise(function(_0x197f12,_0x5e4079){return db[_0xfb07('0x18')][_0xfb07('0x19')](_0x3e747e['body'],{'raw':_0x3e747e['options']?_0x3e747e[_0xfb07('0x1a')][_0xfb07('0x1b')]===undefined?!![]:![]:!![]})[_0xfb07('0xe')](function(_0x2c6c44){logger[_0xfb07('0xf')](_0xfb07('0x1c'),_0x3e747e);logger[_0xfb07('0x1d')](_0xfb07('0x1c'),_0x3e747e,JSON[_0xfb07('0x12')](_0x2c6c44));_0x197f12(_0x2c6c44);})['catch'](function(_0x45806a){logger['error'](_0xfb07('0x1c'),_0x45806a[_0xfb07('0x15')],_0x3e747e);_0x5e4079(_0x44b9c4[_0xfb07('0x13')](0x1f4,_0x45806a[_0xfb07('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 09633fb..2494075 100644 --- a/server/api/attachment/index.js +++ b/server/api/attachment/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['show','/:id/download','download','post','/:id/clone','clone','root','server/files/attachments/','format','now','originalname','replace','single','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./attachment.controller','get','isAuthenticated','index','/:id'];(function(_0xa3c969,_0x4760ff){var _0x265ad3=function(_0x488c37){while(--_0x488c37){_0xa3c969['push'](_0xa3c969['shift']());}};_0x265ad3(++_0x4760ff);}(_0x5f2f,0x73));var _0xf5f2=function(_0x2f3ba3,_0x8ff3){_0x2f3ba3=_0x2f3ba3-0x0;var _0x1525ee=_0x5f2f[_0x2f3ba3];return _0x1525ee;};'use strict';var multer=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var path=require(_0xf5f2('0x2'));var timeout=require(_0xf5f2('0x3'));var express=require(_0xf5f2('0x4'));var router=express[_0xf5f2('0x5')]();var fs_extra=require(_0xf5f2('0x6'));var auth=require(_0xf5f2('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf5f2('0x8'));router[_0xf5f2('0x9')]('/',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0xb')]);router[_0xf5f2('0x9')](_0xf5f2('0xc'),auth['isAuthenticated'](),controller[_0xf5f2('0xd')]);router[_0xf5f2('0x9')](_0xf5f2('0xe'),auth['isAuthenticated'](),controller[_0xf5f2('0xf')]);router[_0xf5f2('0x10')](_0xf5f2('0x11'),auth['isAuthenticated'](),controller[_0xf5f2('0x12')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x53fb33,_0xa7e1a6,_0x151aba){_0x151aba(null,path['join'](config[_0xf5f2('0x13')],_0xf5f2('0x14')));},'filename':function(_0x331482,_0x3f2997,_0x59bb6c){_0x59bb6c(null,util[_0xf5f2('0x15')]('%s-%s',Date[_0xf5f2('0x16')](),_0x3f2997[_0xf5f2('0x17')][_0xf5f2('0x18')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xf5f2('0x10')]('/',upload[_0xf5f2('0x19')]('file'),controller[_0xf5f2('0x1a')]);router[_0xf5f2('0x1b')](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x1c')]);router[_0xf5f2('0x1d')](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x1e')]);module[_0xf5f2('0x1f')]=router; \ No newline at end of file +var _0x5f2f=['show','/:id/download','download','post','/:id/clone','clone','root','server/files/attachments/','format','now','originalname','replace','single','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./attachment.controller','get','isAuthenticated','index','/:id'];(function(_0x577868,_0x27fcfd){var _0x5dbd6b=function(_0x568465){while(--_0x568465){_0x577868['push'](_0x577868['shift']());}};_0x5dbd6b(++_0x27fcfd);}(_0x5f2f,0x73));var _0xf5f2=function(_0x4f14bd,_0x28b9db){_0x4f14bd=_0x4f14bd-0x0;var _0x515b8b=_0x5f2f[_0x4f14bd];return _0x515b8b;};'use strict';var multer=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var path=require(_0xf5f2('0x2'));var timeout=require(_0xf5f2('0x3'));var express=require(_0xf5f2('0x4'));var router=express[_0xf5f2('0x5')]();var fs_extra=require(_0xf5f2('0x6'));var auth=require(_0xf5f2('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf5f2('0x8'));router[_0xf5f2('0x9')]('/',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0xb')]);router[_0xf5f2('0x9')](_0xf5f2('0xc'),auth['isAuthenticated'](),controller[_0xf5f2('0xd')]);router[_0xf5f2('0x9')](_0xf5f2('0xe'),auth['isAuthenticated'](),controller[_0xf5f2('0xf')]);router[_0xf5f2('0x10')](_0xf5f2('0x11'),auth['isAuthenticated'](),controller[_0xf5f2('0x12')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x53fb33,_0xa7e1a6,_0x151aba){_0x151aba(null,path['join'](config[_0xf5f2('0x13')],_0xf5f2('0x14')));},'filename':function(_0x331482,_0x3f2997,_0x59bb6c){_0x59bb6c(null,util[_0xf5f2('0x15')]('%s-%s',Date[_0xf5f2('0x16')](),_0x3f2997[_0xf5f2('0x17')][_0xf5f2('0x18')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xf5f2('0x10')]('/',upload[_0xf5f2('0x19')]('file'),controller[_0xf5f2('0x1a')]);router[_0xf5f2('0x1b')](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x1c')]);router[_0xf5f2('0x1d')](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x1e')]);module[_0xf5f2('0x1f')]=router; \ No newline at end of file diff --git a/server/api/authActiveDirectory/authActiveDirectory.controller.js b/server/api/authActiveDirectory/authActiveDirectory.controller.js index ac4387a..c33a4be 100644 --- a/server/api/authActiveDirectory/authActiveDirectory.controller.js +++ b/server/api/authActiveDirectory/authActiveDirectory.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5046=['clearBlockUser','getLicense','catch','status','send','message','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','User','passport','passport-local','Strategy','moment','activedirectory2','bluebird','util','../../mysqldb','../../components/auth/service','../../config/utils','../../config/logger','api','activedirectory','baseDN','url','domain','authenticate','error','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','Setting','findOne','adSsoEnabled','blockDuration','password','salt','role','disabled','blocked','blockedAt','online','user','agent','then','name','add','minutes'];(function(_0x218963,_0x3e9f27){var _0x79231=function(_0x46d2f1){while(--_0x46d2f1){_0x218963['push'](_0x218963['shift']());}};_0x79231(++_0x3e9f27);}(_0x5046,0x6d));var _0x6504=function(_0x1956bb,_0x4202e8){_0x1956bb=_0x1956bb-0x0;var _0x1420bf=_0x5046[_0x1956bb];return _0x1420bf;};'use strict';var passport=require(_0x6504('0x0'));var LocalStrategy=require(_0x6504('0x1'))[_0x6504('0x2')];var moment=require(_0x6504('0x3'));var ActiveDirectory=require(_0x6504('0x4'));var BPromise=require(_0x6504('0x5'));var util=require(_0x6504('0x6'));var db=require(_0x6504('0x7'))['db'];var authService=require(_0x6504('0x8'));var utils=require(_0x6504('0x9'));var config=require('../../config/environment');var logger=require(_0x6504('0xa'))(_0x6504('0xb'));function isActiveDirectoryConfigured(_0x4ba14c){var _0x493f92=![];if(typeof _0x4ba14c[_0x6504('0xc')]!=='undefined'){_0x493f92=_0x4ba14c[_0x6504('0xc')][_0x6504('0xd')]&&_0x4ba14c[_0x6504('0xc')][_0x6504('0xe')]&&_0x4ba14c[_0x6504('0xc')][_0x6504('0xf')];}return _0x493f92;}function adAuthenticate(_0x1a24a8,_0x540f62,_0x299951){return new BPromise(function(_0x4049fa,_0x3ce219){try{var _0x75f70b=new ActiveDirectory(_0x1a24a8);_0x75f70b[_0x6504('0x10')](_0x540f62,_0x299951,function(_0x297471,_0x2abe30){if(_0x297471){logger[_0x6504('0x11')]('Error\x20authenticate\x20%s:\x20%s',_0x540f62,util['inspect'](_0x297471,{'showHidden':![],'depth':null}));_0x3ce219(_0x6504('0x12'));}else if(!_0x2abe30){logger[_0x6504('0x11')](_0x6504('0x13'),_0x540f62);_0x3ce219('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x4049fa(_0x2abe30);}});}catch(_0x20575d){_0x3ce219(_0x20575d);}});}function ActiveDirectoryAuthenticate(_0x1e20c4,_0x2b199e,_0x255b57,_0x3df07c){var _0x6b9e02,_0x5b1e2d;if(!isActiveDirectoryConfigured(config)){logger[_0x6504('0x11')](_0x6504('0x14'),_0x2b199e);return _0x3df07c(null,![],{'message':_0x6504('0x12')});}return db[_0x6504('0x15')][_0x6504('0x16')]({'where':{'id':0x1},'attributes':[_0x6504('0x17'),_0x6504('0x18')],'raw':!![]})['then'](function(_0x9dd17f){_0x6b9e02=_0x9dd17f;if(!_0x6b9e02['adSsoEnabled']){logger[_0x6504('0x11')]('Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled',_0x2b199e);throw new Error(_0x6504('0x12'));}return _0x1e20c4[_0x6504('0x16')]({'attributes':['id','name',_0x6504('0x19'),_0x6504('0x1a'),_0x6504('0x1b'),_0x6504('0x1c'),_0x6504('0x1d'),_0x6504('0x1e'),_0x6504('0x1f')],'where':{'name':_0x2b199e,'role':{'$or':['admin',_0x6504('0x20'),_0x6504('0x21')]},'adSsoEnabled':!![]}});})[_0x6504('0x22')](function(_0x3c4418){if(!_0x3c4418||_0x3c4418&&_0x3c4418[_0x6504('0x23')]!==_0x2b199e){throw new Error(_0x6504('0x12'));}_0x5b1e2d=_0x3c4418;var _0x3bc0ad=_0x5b1e2d[_0x6504('0x23')]+'@'+config[_0x6504('0xc')]['domain'];return adAuthenticate(config[_0x6504('0xc')],_0x3bc0ad,_0x255b57);})[_0x6504('0x22')](function(_0x4529f2){if(_0x5b1e2d[_0x6504('0x1c')]){throw new Error(_0x6504('0x12'));}if(_0x6b9e02[_0x6504('0x18')]>0x0){if(_0x5b1e2d[_0x6504('0x1d')]){if(moment(_0x5b1e2d[_0x6504('0x1e')])[_0x6504('0x24')](_0x6b9e02[_0x6504('0x18')],_0x6504('0x25'))>moment()){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return utils[_0x6504('0x26')](_0x5b1e2d,0x0,![],null)[_0x6504('0x22')](function(){return utils[_0x6504('0x27')](_0x5b1e2d);})[_0x6504('0x22')](function(){return _0x3df07c(null,_0x5b1e2d);});}else{return utils[_0x6504('0x27')](_0x5b1e2d)[_0x6504('0x22')](function(){return _0x3df07c(null,_0x5b1e2d);});}}else{return utils[_0x6504('0x27')](_0x5b1e2d)[_0x6504('0x22')](function(){return _0x3df07c(null,_0x5b1e2d);});}})[_0x6504('0x28')](function(_0x182107){return _0x3df07c(null,![],_0x182107);});}function handleError(_0x21cb97,_0xec27e9,_0x55f58c){return _0x21cb97[_0x6504('0x29')](_0xec27e9||0x1f4)[_0x6504('0x2a')]({'message':_0x55f58c?_0x55f58c[_0x6504('0x2b')]||_0x55f58c:''});}exports['login']=function(_0x1e1274,_0xc1a200,_0x57fc43){passport[_0x6504('0x10')](_0x6504('0x2c'),function(_0x20c4c1,_0x140856,_0x4ab2ce){var _0x4bb1e0=_0x20c4c1||_0x4ab2ce;if(_0x4bb1e0){return handleError(_0xc1a200,0x191,_0x4bb1e0);}if(!_0x140856){return handleError(_0xc1a200,0x194,{'message':_0x6504('0x2d')});}else{var _0x44afd2={'payload':{'id':_0x140856['id'],'role':_0x140856[_0x6504('0x1b')]},'options':{'expiresIn':0x15180}};return authService[_0x6504('0x2e')](_0x44afd2)[_0x6504('0x22')](function(_0x30798f){_0xc1a200[_0x6504('0x2f')]({'id':_0x140856['id'],'token':_0x30798f,'statusCall':'','isAlreadyLogged':_0x140856['online']});});}})(_0x1e1274,_0xc1a200,_0x57fc43);};passport['use'](_0x6504('0x2c'),new LocalStrategy({'usernameField':_0x6504('0x23'),'passwordField':_0x6504('0x19')},function(_0x4f520a,_0x3a62e7,_0x2daa07){return ActiveDirectoryAuthenticate(db[_0x6504('0x30')],_0x4f520a,_0x3a62e7,_0x2daa07);})); \ No newline at end of file +var _0x9472=['Error\x20authenticate\x20%s:\x20Wrong\x20credentials','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','adSsoEnabled','then','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','findOne','name','password','role','blocked','blockedAt','user','agent','disabled','blockDuration','add','minutes','clearBlockUser','getLicense','catch','send','message','login','authenticate','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','json','online','use','User','passport','passport-local','Strategy','moment','../../components/auth/service','../../config/utils','../../config/environment','../../config/logger','activedirectory','undefined','baseDN','domain','Error\x20authenticate\x20%s:\x20%s','error'];(function(_0x39a677,_0x54b3cd){var _0x5571bf=function(_0x342f42){while(--_0x342f42){_0x39a677['push'](_0x39a677['shift']());}};_0x5571bf(++_0x54b3cd);}(_0x9472,0x1aa));var _0x2947=function(_0x240226,_0x1eab8e){_0x240226=_0x240226-0x0;var _0x5e64fd=_0x9472[_0x240226];return _0x5e64fd;};'use strict';var passport=require(_0x2947('0x0'));var LocalStrategy=require(_0x2947('0x1'))[_0x2947('0x2')];var moment=require(_0x2947('0x3'));var ActiveDirectory=require('activedirectory2');var BPromise=require('bluebird');var util=require('util');var db=require('../../mysqldb')['db'];var authService=require(_0x2947('0x4'));var utils=require(_0x2947('0x5'));var config=require(_0x2947('0x6'));var logger=require(_0x2947('0x7'))('api');function isActiveDirectoryConfigured(_0x21b99b){var _0x4f7469=![];if(typeof _0x21b99b[_0x2947('0x8')]!==_0x2947('0x9')){_0x4f7469=_0x21b99b[_0x2947('0x8')][_0x2947('0xa')]&&_0x21b99b[_0x2947('0x8')]['url']&&_0x21b99b['activedirectory'][_0x2947('0xb')];}return _0x4f7469;}function adAuthenticate(_0x1bcb35,_0x495092,_0x48dc7d){return new BPromise(function(_0x345d59,_0x1ba886){try{var _0x3a671a=new ActiveDirectory(_0x1bcb35);_0x3a671a['authenticate'](_0x495092,_0x48dc7d,function(_0x2d3537,_0x398bca){if(_0x2d3537){logger['error'](_0x2947('0xc'),_0x495092,util['inspect'](_0x2d3537,{'showHidden':![],'depth':null}));_0x1ba886('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else if(!_0x398bca){logger[_0x2947('0xd')](_0x2947('0xe'),_0x495092);_0x1ba886(_0x2947('0xf'));}else{_0x345d59(_0x398bca);}});}catch(_0x36296c){_0x1ba886(_0x36296c);}});}function ActiveDirectoryAuthenticate(_0x3ddb58,_0x34075e,_0x46d74e,_0x5e2428){var _0x2325c0,_0x5990cb;if(!isActiveDirectoryConfigured(config)){logger[_0x2947('0xd')]('Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured',_0x34075e);return _0x5e2428(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}return db['Setting']['findOne']({'where':{'id':0x1},'attributes':[_0x2947('0x10'),'blockDuration'],'raw':!![]})[_0x2947('0x11')](function(_0x3096b5){_0x2325c0=_0x3096b5;if(!_0x2325c0['adSsoEnabled']){logger[_0x2947('0xd')](_0x2947('0x12'),_0x34075e);throw new Error(_0x2947('0xf'));}return _0x3ddb58[_0x2947('0x13')]({'attributes':['id',_0x2947('0x14'),_0x2947('0x15'),'salt',_0x2947('0x16'),'disabled',_0x2947('0x17'),_0x2947('0x18'),'online'],'where':{'name':_0x34075e,'role':{'$or':['admin',_0x2947('0x19'),_0x2947('0x1a')]},'adSsoEnabled':!![]}});})[_0x2947('0x11')](function(_0x56a17e){if(!_0x56a17e||_0x56a17e&&_0x56a17e[_0x2947('0x14')]!==_0x34075e){throw new Error(_0x2947('0xf'));}_0x5990cb=_0x56a17e;var _0x1c0e1f=_0x5990cb['name']+'@'+config[_0x2947('0x8')][_0x2947('0xb')];return adAuthenticate(config['activedirectory'],_0x1c0e1f,_0x46d74e);})[_0x2947('0x11')](function(_0x1b483b){if(_0x5990cb[_0x2947('0x1b')]){throw new Error(_0x2947('0xf'));}if(_0x2325c0[_0x2947('0x1c')]>0x0){if(_0x5990cb['blocked']){if(moment(_0x5990cb[_0x2947('0x18')])[_0x2947('0x1d')](_0x2325c0['blockDuration'],_0x2947('0x1e'))>moment()){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return utils[_0x2947('0x1f')](_0x5990cb,0x0,![],null)[_0x2947('0x11')](function(){return utils[_0x2947('0x20')](_0x5990cb);})['then'](function(){return _0x5e2428(null,_0x5990cb);});}else{return utils[_0x2947('0x20')](_0x5990cb)['then'](function(){return _0x5e2428(null,_0x5990cb);});}}else{return utils[_0x2947('0x20')](_0x5990cb)[_0x2947('0x11')](function(){return _0x5e2428(null,_0x5990cb);});}})[_0x2947('0x21')](function(_0x8d616e){return _0x5e2428(null,![],_0x8d616e);});}function handleError(_0x38d48f,_0x393a7a,_0x453f3f){return _0x38d48f['status'](_0x393a7a||0x1f4)[_0x2947('0x22')]({'message':_0x453f3f?_0x453f3f[_0x2947('0x23')]||_0x453f3f:''});}exports[_0x2947('0x24')]=function(_0x11bbf2,_0x1d9b02,_0x3b0c9b){passport[_0x2947('0x25')](_0x2947('0x26'),function(_0x12a196,_0x4b6adc,_0x459c19){var _0x5b5f10=_0x12a196||_0x459c19;if(_0x5b5f10){return handleError(_0x1d9b02,0x191,_0x5b5f10);}if(!_0x4b6adc){return handleError(_0x1d9b02,0x194,{'message':_0x2947('0x27')});}else{var _0x4c59c1={'payload':{'id':_0x4b6adc['id'],'role':_0x4b6adc[_0x2947('0x16')]},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x4c59c1)[_0x2947('0x11')](function(_0x21f0cb){_0x1d9b02[_0x2947('0x28')]({'id':_0x4b6adc['id'],'token':_0x21f0cb,'statusCall':'','isAlreadyLogged':_0x4b6adc[_0x2947('0x29')]});});}})(_0x11bbf2,_0x1d9b02,_0x3b0c9b);};passport[_0x2947('0x2a')](_0x2947('0x26'),new LocalStrategy({'usernameField':_0x2947('0x14'),'passwordField':_0x2947('0x15')},function(_0xa73c76,_0x54b52d,_0x46f073){return ActiveDirectoryAuthenticate(db[_0x2947('0x2b')],_0xa73c76,_0x54b52d,_0x46f073);})); \ No newline at end of file diff --git a/server/api/authActiveDirectory/index.js b/server/api/authActiveDirectory/index.js index 2d28b65..78884aa 100644 --- a/server/api/authActiveDirectory/index.js +++ b/server/api/authActiveDirectory/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x888d=['Router','./authActiveDirectory.controller','post','login','exports','express'];(function(_0xfa12cc,_0x3c381c){var _0x50fa77=function(_0x184a7e){while(--_0x184a7e){_0xfa12cc['push'](_0xfa12cc['shift']());}};_0x50fa77(++_0x3c381c);}(_0x888d,0xb3));var _0xd888=function(_0x59243b,_0x18ebc0){_0x59243b=_0x59243b-0x0;var _0x45758e=_0x888d[_0x59243b];return _0x45758e;};'use strict';var express=require(_0xd888('0x0'));var router=express[_0xd888('0x1')]();var controller=require(_0xd888('0x2'));router[_0xd888('0x3')]('/',controller[_0xd888('0x4')]);module[_0xd888('0x5')]=router; \ No newline at end of file +var _0xf280=['./authActiveDirectory.controller','post','login','Router'];(function(_0x42c7e8,_0x415cba){var _0x3615ce=function(_0x312ed2){while(--_0x312ed2){_0x42c7e8['push'](_0x42c7e8['shift']());}};_0x3615ce(++_0x415cba);}(_0xf280,0xf3));var _0x0f28=function(_0x3a9635,_0x1ab817){_0x3a9635=_0x3a9635-0x0;var _0x10d08c=_0xf280[_0x3a9635];return _0x10d08c;};'use strict';var express=require('express');var router=express[_0x0f28('0x0')]();var controller=require(_0x0f28('0x1'));router[_0x0f28('0x2')]('/',controller[_0x0f28('0x3')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index a25f1ed..1ef9862 100644 --- a/server/api/authGoogle/authGoogle.controller.js +++ b/server/api/authGoogle/authGoogle.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['blockedAt','add','minutes','clearBlockUser','getLicense','catch','lodash','passport','passport-google-oauth20','moment','../../mysqldb','../../config/utils','login','authenticate','google','/login','email','use','secret','callbackURL','findOne','allowedLoginAttempts','blockDuration','then','User','find','map','value','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'];(function(_0x31e29a,_0x349c9b){var _0x32d892=function(_0x41cc86){while(--_0x41cc86){_0x31e29a['push'](_0x31e29a['shift']());}};_0x32d892(++_0x349c9b);}(_0x7a54,0x106));var _0x47a5=function(_0x2b7d97,_0x57fd4e){_0x2b7d97=_0x2b7d97-0x0;var _0x235ab4=_0x7a54[_0x2b7d97];return _0x235ab4;};'use strict';var _=require(_0x47a5('0x0'));var passport=require(_0x47a5('0x1'));var GoogleStrategy=require(_0x47a5('0x2'))['Strategy'];var moment=require(_0x47a5('0x3'));var db=require(_0x47a5('0x4'))['db'];var config=require('../../config/environment');var utils=require(_0x47a5('0x5'));exports[_0x47a5('0x6')]=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':_0x47a5('0x9'),'scope':['profile',_0x47a5('0xa')],'session':![]});exports['callback']=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':'/login','session':![]});passport[_0x47a5('0xb')](new GoogleStrategy({'clientID':config['google']?config['google']['clientID']:'id','clientSecret':config[_0x47a5('0x8')]?config[_0x47a5('0x8')]['clientSecret']:_0x47a5('0xc'),'callbackURL':config['google']?config['google'][_0x47a5('0xd')]:''},function(_0x69e4d4,_0x2f399b,_0x250fad,_0xd612dd){var _0xd308b8,_0x1eae59;return db['Setting'][_0x47a5('0xe')]({'where':{'id':0x1},'attributes':[_0x47a5('0xf'),_0x47a5('0x10')],'raw':!![]})[_0x47a5('0x11')](function(_0x139f25){_0xd308b8=_0x139f25;return db[_0x47a5('0x12')][_0x47a5('0x13')]({'where':{'email':_[_0x47a5('0x14')](_0x250fad['emails'],_0x47a5('0x15')),'role':{'$or':[_0x47a5('0x16'),_0x47a5('0x17'),_0x47a5('0x18')]}}});})[_0x47a5('0x11')](function(_0x574af6){_0x1eae59=_0x574af6;if(_0x1eae59){if(_0x1eae59['disabled']){return _0xd612dd(_0x47a5('0x19'));}else if(_0xd308b8['blockDuration']>0x0){if(_0x1eae59['blocked']){if(moment(_0x1eae59[_0x47a5('0x1a')])[_0x47a5('0x1b')](_0xd308b8[_0x47a5('0x10')],_0x47a5('0x1c'))>moment()){return _0xd612dd(_0x47a5('0x19'));}else{return utils[_0x47a5('0x1d')](_0x1eae59,0x0,![],null)[_0x47a5('0x11')](function(){return utils[_0x47a5('0x1e')](_0x1eae59);})[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils['getLicense'](_0x1eae59)[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils[_0x47a5('0x1e')](_0x1eae59)['then'](function(){return _0xd612dd(null,_0x1eae59);});}}return _0xd612dd(_0x47a5('0x19'));})[_0x47a5('0x1f')](function(_0x36874d){_0xd612dd(_0x36874d);});})); \ No newline at end of file +var _0x7a54=['blockedAt','add','minutes','clearBlockUser','getLicense','catch','lodash','passport','passport-google-oauth20','moment','../../mysqldb','../../config/utils','login','authenticate','google','/login','email','use','secret','callbackURL','findOne','allowedLoginAttempts','blockDuration','then','User','find','map','value','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'];(function(_0x580576,_0x2f107d){var _0x3f55a0=function(_0x2e180b){while(--_0x2e180b){_0x580576['push'](_0x580576['shift']());}};_0x3f55a0(++_0x2f107d);}(_0x7a54,0x106));var _0x47a5=function(_0x16f5d1,_0x3540cb){_0x16f5d1=_0x16f5d1-0x0;var _0x2164ef=_0x7a54[_0x16f5d1];return _0x2164ef;};'use strict';var _=require(_0x47a5('0x0'));var passport=require(_0x47a5('0x1'));var GoogleStrategy=require(_0x47a5('0x2'))['Strategy'];var moment=require(_0x47a5('0x3'));var db=require(_0x47a5('0x4'))['db'];var config=require('../../config/environment');var utils=require(_0x47a5('0x5'));exports[_0x47a5('0x6')]=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':_0x47a5('0x9'),'scope':['profile',_0x47a5('0xa')],'session':![]});exports['callback']=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':'/login','session':![]});passport[_0x47a5('0xb')](new GoogleStrategy({'clientID':config['google']?config['google']['clientID']:'id','clientSecret':config[_0x47a5('0x8')]?config[_0x47a5('0x8')]['clientSecret']:_0x47a5('0xc'),'callbackURL':config['google']?config['google'][_0x47a5('0xd')]:''},function(_0x69e4d4,_0x2f399b,_0x250fad,_0xd612dd){var _0xd308b8,_0x1eae59;return db['Setting'][_0x47a5('0xe')]({'where':{'id':0x1},'attributes':[_0x47a5('0xf'),_0x47a5('0x10')],'raw':!![]})[_0x47a5('0x11')](function(_0x139f25){_0xd308b8=_0x139f25;return db[_0x47a5('0x12')][_0x47a5('0x13')]({'where':{'email':_[_0x47a5('0x14')](_0x250fad['emails'],_0x47a5('0x15')),'role':{'$or':[_0x47a5('0x16'),_0x47a5('0x17'),_0x47a5('0x18')]}}});})[_0x47a5('0x11')](function(_0x574af6){_0x1eae59=_0x574af6;if(_0x1eae59){if(_0x1eae59['disabled']){return _0xd612dd(_0x47a5('0x19'));}else if(_0xd308b8['blockDuration']>0x0){if(_0x1eae59['blocked']){if(moment(_0x1eae59[_0x47a5('0x1a')])[_0x47a5('0x1b')](_0xd308b8[_0x47a5('0x10')],_0x47a5('0x1c'))>moment()){return _0xd612dd(_0x47a5('0x19'));}else{return utils[_0x47a5('0x1d')](_0x1eae59,0x0,![],null)[_0x47a5('0x11')](function(){return utils[_0x47a5('0x1e')](_0x1eae59);})[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils['getLicense'](_0x1eae59)[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils[_0x47a5('0x1e')](_0x1eae59)['then'](function(){return _0xd612dd(null,_0x1eae59);});}}return _0xd612dd(_0x47a5('0x19'));})[_0x47a5('0x1f')](function(_0x36874d){_0xd612dd(_0x36874d);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index 2844932..eb1aee0 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 _0x807b=['express','passport','Router','./authGoogle.controller','../user/user.controller.js','../../components/auth/service','get','login','callback','isMiddleware','setTokenCookie','exports'];(function(_0x27af7a,_0xe18331){var _0x4ee641=function(_0x512694){while(--_0x512694){_0x27af7a['push'](_0x27af7a['shift']());}};_0x4ee641(++_0xe18331);}(_0x807b,0x1bc));var _0xb807=function(_0xc42d8a,_0x2a7950){_0xc42d8a=_0xc42d8a-0x0;var _0x1b0ab5=_0x807b[_0xc42d8a];return _0x1b0ab5;};'use strict';var express=require(_0xb807('0x0'));var passport=require(_0xb807('0x1'));var router=express[_0xb807('0x2')]();var controller=require(_0xb807('0x3'));var userController=require(_0xb807('0x4'));var authService=require(_0xb807('0x5'));router[_0xb807('0x6')]('/',controller[_0xb807('0x7')]);router['get']('/callback',controller[_0xb807('0x8')],authService[_0xb807('0x9')],userController[_0xb807('0x7')],authService[_0xb807('0xa')]);module[_0xb807('0xb')]=router; \ No newline at end of file +var _0xbea0=['../user/user.controller.js','../../components/auth/service','get','login','/callback','callback','isMiddleware','setTokenCookie','exports','express','passport','./authGoogle.controller'];(function(_0x3a9635,_0x1ab817){var _0x10d08c=function(_0x222242){while(--_0x222242){_0x3a9635['push'](_0x3a9635['shift']());}};_0x10d08c(++_0x1ab817);}(_0xbea0,0x69));var _0x0bea=function(_0x1b2f0f,_0x2bf85f){_0x1b2f0f=_0x1b2f0f-0x0;var _0x574707=_0xbea0[_0x1b2f0f];return _0x574707;};'use strict';var express=require(_0x0bea('0x0'));var passport=require(_0x0bea('0x1'));var router=express['Router']();var controller=require(_0x0bea('0x2'));var userController=require(_0x0bea('0x3'));var authService=require(_0x0bea('0x4'));router[_0x0bea('0x5')]('/',controller[_0x0bea('0x6')]);router[_0x0bea('0x5')](_0x0bea('0x7'),controller[_0x0bea('0x8')],authService[_0x0bea('0x9')],userController['login'],authService[_0x0bea('0xa')]);module[_0x0bea('0xb')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index d8d9de3..e3e6663 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 _0xd4bc=['json','online','forgot','generate','body','User','resetPasswordToken','resetPasswordExpires','now','save','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','headers','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','status','Reset\x20Email\x20sent!','reset','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','validatePasswordPattern','previousPasswords','validatePasswordHistory','passwordHistoryLimit','Password\x20reset!','use','util','passport-local','lodash','randomstring','moment','../../mysqldb','../../components/auth/service','../../config/utils','client','http','Setting','findOne','blockDuration','then','name','password','disabled','blocked','blockedAt','loginAttempts','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','allowedLoginAttempts','minutes','clearBlockUser','add','getLicense','catch','MailAccount','find','MailServerOut','Smtp','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','merge','\x22%s\x22\x20<%s>','email','request','error','format','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','send','login','authenticate','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','role','signToken'];(function(_0x4fcb43,_0x2a54dc){var _0x3657ef=function(_0x479456){while(--_0x479456){_0x4fcb43['push'](_0x4fcb43['shift']());}};_0x3657ef(++_0x2a54dc);}(_0xd4bc,0x115));var _0xcd4b=function(_0x5f6a8a,_0x45f474){_0x5f6a8a=_0x5f6a8a-0x0;var _0x2cce4d=_0xd4bc[_0x5f6a8a];return _0x2cce4d;};'use strict';var util=require(_0xcd4b('0x0'));var passport=require('passport');var LocalStrategy=require(_0xcd4b('0x1'))['Strategy'];var jayson=require('jayson/promise');var _=require(_0xcd4b('0x2'));var rs=require(_0xcd4b('0x3'));var moment=require(_0xcd4b('0x4'));var db=require(_0xcd4b('0x5'))['db'];var authService=require(_0xcd4b('0x6'));var utils=require(_0xcd4b('0x7'));var client=jayson[_0xcd4b('0x8')][_0xcd4b('0x9')]({'port':0x232b});function localAuthenticate(_0x130984,_0x442205,_0x377b94,_0x3ffdfe){var _0x151a48,_0xcec9c9;return db[_0xcd4b('0xa')][_0xcd4b('0xb')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0xcd4b('0xc')],'raw':!![]})[_0xcd4b('0xd')](function(_0xf8f5ef){_0x151a48=_0xf8f5ef;return _0x130984['findOne']({'attributes':['id',_0xcd4b('0xe'),_0xcd4b('0xf'),'salt','role',_0xcd4b('0x10'),_0xcd4b('0x11'),_0xcd4b('0x12'),_0xcd4b('0x13')],'where':{'name':_0x442205,'role':{'$or':[_0xcd4b('0x14'),_0xcd4b('0x15'),_0xcd4b('0x16')]}}});})[_0xcd4b('0xd')](function(_0x15994a){if(!_0x15994a||_0x15994a&&_0x15994a[_0xcd4b('0xe')]!==_0x442205){throw new Error(_0xcd4b('0x17'));}else{_0xcec9c9=_0x15994a;return _0xcec9c9;}})[_0xcd4b('0xd')](function(){_0xcec9c9['authenticate'](_0x377b94,function(_0x4c02ee,_0x46dbd3){var _0xfd169e=_0xcec9c9['loginAttempts']+0x1;if(_0x4c02ee){return _0x3ffdfe(_0x4c02ee);}else if(!_0x46dbd3){if(_0xcec9c9[_0xcd4b('0x10')]){return _0x3ffdfe(null,![],{'message':_0xcd4b('0x17')});}else if(_0x151a48[_0xcd4b('0x18')]>0x0){if(_0xcec9c9[_0xcd4b('0x11')]){if(_0x151a48[_0xcd4b('0xc')]>0x0){if(moment(_0xcec9c9[_0xcd4b('0x12')])['add'](_0x151a48['blockDuration'],_0xcd4b('0x19'))>moment()){return _0x3ffdfe(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils['clearBlockUser'](_0xcec9c9,_0xfd169e,![],null)[_0xcd4b('0xd')](function(){return _0x3ffdfe(null,![],{'message':_0xcd4b('0x17')});});}}else{return _0x3ffdfe(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0xfd169e>=_0x151a48[_0xcd4b('0x18')]){return utils[_0xcd4b('0x1a')](_0xcec9c9,0x0,!![],moment())[_0xcd4b('0xd')](function(){return _0x3ffdfe(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}else{return utils[_0xcd4b('0x1a')](_0xcec9c9,_0xfd169e,![],null)[_0xcd4b('0xd')](function(){return _0x3ffdfe(null,![],{'message':_0xcd4b('0x17')});});}}}else{return _0x3ffdfe(null,![],{'message':_0xcd4b('0x17')});}}else{if(_0xcec9c9[_0xcd4b('0x10')]){return _0x3ffdfe(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x151a48[_0xcd4b('0x18')]>0x0){if(_0xcec9c9[_0xcd4b('0x11')]){if(_0x151a48[_0xcd4b('0xc')]>0x0){if(moment(_0xcec9c9[_0xcd4b('0x12')])[_0xcd4b('0x1b')](_0x151a48[_0xcd4b('0xc')],_0xcd4b('0x19'))>moment()){return _0x3ffdfe(null,![],{'message':_0xcd4b('0x17')});}else{return utils[_0xcd4b('0x1a')](_0xcec9c9,0x0,![],null)[_0xcd4b('0xd')](function(){return utils[_0xcd4b('0x1c')](_0xcec9c9);})['then'](function(){return _0x3ffdfe(null,_0xcec9c9);});}}else{return _0x3ffdfe(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{return utils['clearBlockUser'](_0xcec9c9,0x0,![],null)['then'](function(){return utils[_0xcd4b('0x1c')](_0xcec9c9);})[_0xcd4b('0xd')](function(){return _0x3ffdfe(null,_0xcec9c9);})[_0xcd4b('0x1d')](function(_0x267d48){return _0x3ffdfe(null,![],_0x267d48);});}}else{if(_0xcec9c9[_0xcd4b('0x11')]){return _0x3ffdfe(null,![],{'message':_0xcd4b('0x17')});}else{return utils[_0xcd4b('0x1c')](_0xcec9c9)[_0xcd4b('0xd')](function(){return _0x3ffdfe(null,_0xcec9c9);});}}}});})[_0xcd4b('0x1d')](function(_0x56d4bc){return _0x3ffdfe(null,![],_0x56d4bc);});}function sendServiceMail(_0x48cc14){return db[_0xcd4b('0x1e')][_0xcd4b('0x1f')]({'where':{'service':!![]},'attributes':['id','name','email'],'include':[{'model':db[_0xcd4b('0x20')],'as':_0xcd4b('0x21'),'include':[{'model':db[_0xcd4b('0x22')],'as':_0xcd4b('0x22')}]}]})['then'](function(_0x11dd91){if(!_0x11dd91){throw new Error(_0xcd4b('0x23'));}var _0x394b65=_0x11dd91['getSmtpOptions']();var _0x31ac45={'account':_0x394b65,'message':_[_0xcd4b('0x24')]({'from':util['format'](_0xcd4b('0x25'),_0x11dd91['name'],_0x11dd91[_0xcd4b('0x26')]||_0x11dd91['Smtp'][_0xcd4b('0x15')])},_0x48cc14)};return client[_0xcd4b('0x27')]('SendMail',_0x31ac45);})[_0xcd4b('0xd')](function(_0x33992e){if(_0x33992e[_0xcd4b('0x28')]){throw new Error(util[_0xcd4b('0x29')](_0xcd4b('0x2a'),_0x33992e['error'][_0xcd4b('0x2b')]||JSON['stringify'](_0x33992e[_0xcd4b('0x28')])));}return!![];});}function handleError(_0x449fff,_0x1fbf94,_0x274aa9){return _0x449fff['status'](_0x1fbf94||0x1f4)[_0xcd4b('0x2c')]({'message':_0x274aa9?_0x274aa9[_0xcd4b('0x2b')]||_0x274aa9:''});}exports[_0xcd4b('0x2d')]=function(_0x2b6896,_0x565955,_0x4ac448){passport[_0xcd4b('0x2e')](_0xcd4b('0x2f'),function(_0x5707fd,_0x439c1f,_0xff7218){var _0x1e0227=_0x5707fd||_0xff7218;if(_0x1e0227){return handleError(_0x565955,0x191,_0x1e0227);}if(!_0x439c1f){return handleError(_0x565955,0x194,{'message':_0xcd4b('0x30')});}else{var _0x73f8a8={'payload':{'id':_0x439c1f['id'],'role':_0x439c1f[_0xcd4b('0x31')]},'options':{'expiresIn':0x15180}};return authService[_0xcd4b('0x32')](_0x73f8a8)[_0xcd4b('0xd')](function(_0x21c2e6){_0x565955[_0xcd4b('0x33')]({'id':_0x439c1f['id'],'token':_0x21c2e6,'statusCall':'','isAlreadyLogged':_0x439c1f[_0xcd4b('0x34')]});});}})(_0x2b6896,_0x565955,_0x4ac448);};exports[_0xcd4b('0x35')]=function(_0x432e45,_0x5e4f32){if(!_0x432e45['body'][_0xcd4b('0x26')]){return handleError(_0x5e4f32,0x1f4,{'message':'Email\x20parameter\x20is\x20missing'});}var _0x2229d7=rs[_0xcd4b('0x36')]();_0x432e45['body']['email']=_0x432e45[_0xcd4b('0x37')][_0xcd4b('0x26')]['trim']()['toLowerCase']();var _0x25cd65;return db['Setting'][_0xcd4b('0xb')]({'where':{'id':0x1},'attributes':[_0xcd4b('0x18'),_0xcd4b('0xc')],'raw':!![]})['then'](function(_0x1a9581){_0x25cd65=_0x1a9581;return db[_0xcd4b('0x38')]['find']({'where':{'email':_0x432e45[_0xcd4b('0x37')]['email']}});})[_0xcd4b('0xd')](function(_0x2062ea){if(!_0x2062ea){throw new Error('This\x20email\x20is\x20not\x20registered.');}if(_0x2062ea[_0xcd4b('0x10')]){throw new Error('The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.');}if(_0x2062ea[_0xcd4b('0x11')]){if(moment(_0x2062ea['blockedAt'])[_0xcd4b('0x1b')](_0x25cd65[_0xcd4b('0xc')],_0xcd4b('0x19'))>moment()){throw new Error('The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.');}else{_0x2062ea[_0xcd4b('0x11')]=![];_0x2062ea['blockedAt']=null;}}_0x2062ea[_0xcd4b('0x39')]=_0x2229d7;_0x2062ea[_0xcd4b('0x3a')]=Date[_0xcd4b('0x3b')]()+0x36ee80;return _0x2062ea[_0xcd4b('0x3c')]();})[_0xcd4b('0xd')](function(){return sendServiceMail({'to':_0x432e45[_0xcd4b('0x37')][_0xcd4b('0x26')],'subject':_0xcd4b('0x3d'),'text':_0xcd4b('0x3e')+_0xcd4b('0x3f')+_0xcd4b('0x40')+_0x432e45[_0xcd4b('0x41')]['host']+_0xcd4b('0x42')+_0x2229d7+'\x0a\x0a'+_0xcd4b('0x43')});})[_0xcd4b('0xd')](function(){_0x5e4f32[_0xcd4b('0x44')](0xc8)[_0xcd4b('0x2c')]({'message':_0xcd4b('0x45')});})[_0xcd4b('0x1d')](function(_0x5902d8){return handleError(_0x5e4f32,0x1f4,_0x5902d8);});};exports[_0xcd4b('0x46')]=function(_0x3a483e,_0x13d0e9){return db['User']['find']({'where':{'resetPasswordToken':_0x3a483e[_0xcd4b('0x47')][_0xcd4b('0x48')],'resetPasswordExpires':{'$gt':Date[_0xcd4b('0x3b')]()}}})[_0xcd4b('0xd')](function(_0x53ebc1){if(!_0x53ebc1){throw new Error(_0xcd4b('0x49'));}return db[_0xcd4b('0xa')][_0xcd4b('0xb')]({'attributes':['id',_0xcd4b('0x4a'),_0xcd4b('0x4b'),'passwordHistoryLimit']})[_0xcd4b('0xd')](function(_0x354cbc){if(_0x354cbc['securePassword'])authService[_0xcd4b('0x4c')](_0x3a483e[_0xcd4b('0x37')][_0xcd4b('0xf')]);if(!_0x354cbc[_0xcd4b('0x4b')]||!_0x53ebc1[_0xcd4b('0x4d')])return _0x53ebc1;authService[_0xcd4b('0x4e')](_0x3a483e[_0xcd4b('0x37')][_0xcd4b('0xf')],_0x53ebc1[_0xcd4b('0x4d')],_0x354cbc[_0xcd4b('0x4f')]);return _0x53ebc1;})[_0xcd4b('0xd')](function(){_0x53ebc1[_0xcd4b('0xf')]=_0x3a483e[_0xcd4b('0x37')][_0xcd4b('0xf')];_0x53ebc1[_0xcd4b('0x39')]=null;_0x53ebc1[_0xcd4b('0x3a')]=null;return _0x53ebc1['save']();});})['then'](function(){_0x13d0e9[_0xcd4b('0x44')](0xc8)[_0xcd4b('0x2c')]({'message':_0xcd4b('0x50')});})[_0xcd4b('0x1d')](function(_0x73f0de){return handleError(_0x13d0e9,0x1f4,_0x73f0de);});};passport[_0xcd4b('0x51')](_0xcd4b('0x2f'),new LocalStrategy({'usernameField':_0xcd4b('0xe'),'passwordField':_0xcd4b('0xf')},function(_0x48833e,_0x3cf953,_0x175c04){return localAuthenticate(db[_0xcd4b('0x38')],_0x48833e,_0x3cf953,_0x175c04);})); \ No newline at end of file +var _0xbbe5=['The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','save','xCally\x20Motion\x20Password\x20Reset','https://','headers','host','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','reset','params','token','now','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','Setting','enforcePasswordHistory','passwordHistoryLimit','securePassword','previousPasswords','validatePasswordHistory','resetPasswordExpires','Password\x20reset!','use','util','passport','passport-local','Strategy','jayson/promise','lodash','randomstring','moment','../../mysqldb','../../components/auth/service','../../config/utils','client','http','findOne','allowedLoginAttempts','blockDuration','then','name','password','salt','role','disabled','agent','authenticate','loginAttempts','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blocked','add','minutes','clearBlockUser','blockedAt','catch','getLicense','MailAccount','email','MailServerOut','Smtp','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','getSmtpOptions','format','\x22%s\x22\x20<%s>','request','SendMail','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','error','status','send','login','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','online','forgot','body','generate','User','find','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xbbe5,0x116));var _0x5bbe=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbbe5[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0x5bbe('0x0'));var passport=require(_0x5bbe('0x1'));var LocalStrategy=require(_0x5bbe('0x2'))[_0x5bbe('0x3')];var jayson=require(_0x5bbe('0x4'));var _=require(_0x5bbe('0x5'));var rs=require(_0x5bbe('0x6'));var moment=require(_0x5bbe('0x7'));var db=require(_0x5bbe('0x8'))['db'];var authService=require(_0x5bbe('0x9'));var utils=require(_0x5bbe('0xa'));var client=jayson[_0x5bbe('0xb')][_0x5bbe('0xc')]({'port':0x232b});function localAuthenticate(_0xd997e3,_0x37fbd0,_0xb816de,_0x15b1cd){var _0x299766,_0xd4b901;return db['Setting'][_0x5bbe('0xd')]({'where':{'id':0x1},'attributes':[_0x5bbe('0xe'),_0x5bbe('0xf')],'raw':!![]})[_0x5bbe('0x10')](function(_0x744180){_0x299766=_0x744180;return _0xd997e3[_0x5bbe('0xd')]({'attributes':['id',_0x5bbe('0x11'),_0x5bbe('0x12'),_0x5bbe('0x13'),_0x5bbe('0x14'),_0x5bbe('0x15'),'blocked','blockedAt','loginAttempts'],'where':{'name':_0x37fbd0,'role':{'$or':['admin','user',_0x5bbe('0x16')]}}});})[_0x5bbe('0x10')](function(_0x21da84){if(!_0x21da84||_0x21da84&&_0x21da84['name']!==_0x37fbd0){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0xd4b901=_0x21da84;return _0xd4b901;}})['then'](function(){_0xd4b901[_0x5bbe('0x17')](_0xb816de,function(_0xb9ca8f,_0x23ec43){var _0x38c7ad=_0xd4b901[_0x5bbe('0x18')]+0x1;if(_0xb9ca8f){return _0x15b1cd(_0xb9ca8f);}else if(!_0x23ec43){if(_0xd4b901[_0x5bbe('0x15')]){return _0x15b1cd(null,![],{'message':_0x5bbe('0x19')});}else if(_0x299766['allowedLoginAttempts']>0x0){if(_0xd4b901[_0x5bbe('0x1a')]){if(_0x299766[_0x5bbe('0xf')]>0x0){if(moment(_0xd4b901['blockedAt'])[_0x5bbe('0x1b')](_0x299766[_0x5bbe('0xf')],_0x5bbe('0x1c'))>moment()){return _0x15b1cd(null,![],{'message':_0x5bbe('0x19')});}else{return utils['clearBlockUser'](_0xd4b901,_0x38c7ad,![],null)[_0x5bbe('0x10')](function(){return _0x15b1cd(null,![],{'message':_0x5bbe('0x19')});});}}else{return _0x15b1cd(null,![],{'message':_0x5bbe('0x19')});}}else{if(_0x38c7ad>=_0x299766['allowedLoginAttempts']){return utils[_0x5bbe('0x1d')](_0xd4b901,0x0,!![],moment())['then'](function(){return _0x15b1cd(null,![],{'message':_0x5bbe('0x19')});});}else{return utils[_0x5bbe('0x1d')](_0xd4b901,_0x38c7ad,![],null)['then'](function(){return _0x15b1cd(null,![],{'message':_0x5bbe('0x19')});});}}}else{return _0x15b1cd(null,![],{'message':_0x5bbe('0x19')});}}else{if(_0xd4b901[_0x5bbe('0x15')]){return _0x15b1cd(null,![],{'message':_0x5bbe('0x19')});}else if(_0x299766[_0x5bbe('0xe')]>0x0){if(_0xd4b901['blocked']){if(_0x299766[_0x5bbe('0xf')]>0x0){if(moment(_0xd4b901[_0x5bbe('0x1e')])[_0x5bbe('0x1b')](_0x299766[_0x5bbe('0xf')],'minutes')>moment()){return _0x15b1cd(null,![],{'message':_0x5bbe('0x19')});}else{return utils[_0x5bbe('0x1d')](_0xd4b901,0x0,![],null)[_0x5bbe('0x10')](function(){return utils['getLicense'](_0xd4b901);})[_0x5bbe('0x10')](function(){return _0x15b1cd(null,_0xd4b901);});}}else{return _0x15b1cd(null,![],{'message':_0x5bbe('0x19')});}}else{return utils['clearBlockUser'](_0xd4b901,0x0,![],null)['then'](function(){return utils['getLicense'](_0xd4b901);})[_0x5bbe('0x10')](function(){return _0x15b1cd(null,_0xd4b901);})[_0x5bbe('0x1f')](function(_0x127947){return _0x15b1cd(null,![],_0x127947);});}}else{if(_0xd4b901[_0x5bbe('0x1a')]){return _0x15b1cd(null,![],{'message':_0x5bbe('0x19')});}else{return utils[_0x5bbe('0x20')](_0xd4b901)[_0x5bbe('0x10')](function(){return _0x15b1cd(null,_0xd4b901);});}}}});})[_0x5bbe('0x1f')](function(_0x382670){return _0x15b1cd(null,![],_0x382670);});}function sendServiceMail(_0xe98c85){return db[_0x5bbe('0x21')]['find']({'where':{'service':!![]},'attributes':['id',_0x5bbe('0x11'),_0x5bbe('0x22')],'include':[{'model':db[_0x5bbe('0x23')],'as':_0x5bbe('0x24'),'include':[{'model':db[_0x5bbe('0x25')],'as':_0x5bbe('0x25')}]}]})[_0x5bbe('0x10')](function(_0x521588){if(!_0x521588){throw new Error(_0x5bbe('0x26'));}var _0x1abb36=_0x521588[_0x5bbe('0x27')]();var _0x999d65={'account':_0x1abb36,'message':_['merge']({'from':util[_0x5bbe('0x28')](_0x5bbe('0x29'),_0x521588[_0x5bbe('0x11')],_0x521588[_0x5bbe('0x22')]||_0x521588[_0x5bbe('0x24')]['user'])},_0xe98c85)};return client[_0x5bbe('0x2a')](_0x5bbe('0x2b'),_0x999d65);})[_0x5bbe('0x10')](function(_0x11e12a){if(_0x11e12a['error']){throw new Error(util['format'](_0x5bbe('0x2c'),_0x11e12a['error'][_0x5bbe('0x2d')]||JSON['stringify'](_0x11e12a[_0x5bbe('0x2e')])));}return!![];});}function handleError(_0x497d90,_0x2ee060,_0x4810f3){return _0x497d90[_0x5bbe('0x2f')](_0x2ee060||0x1f4)[_0x5bbe('0x30')]({'message':_0x4810f3?_0x4810f3[_0x5bbe('0x2d')]||_0x4810f3:''});}exports[_0x5bbe('0x31')]=function(_0x5d7935,_0x479d22,_0x2a0127){passport[_0x5bbe('0x17')](_0x5bbe('0x32'),function(_0x28c1ba,_0x2ec5bd,_0x17fbe7){var _0x28ede2=_0x28c1ba||_0x17fbe7;if(_0x28ede2){return handleError(_0x479d22,0x191,_0x28ede2);}if(!_0x2ec5bd){return handleError(_0x479d22,0x194,{'message':_0x5bbe('0x33')});}else{var _0x9bbac={'payload':{'id':_0x2ec5bd['id'],'role':_0x2ec5bd[_0x5bbe('0x14')]},'options':{'expiresIn':0x15180}};return authService[_0x5bbe('0x34')](_0x9bbac)[_0x5bbe('0x10')](function(_0x24c9e1){_0x479d22[_0x5bbe('0x35')]({'id':_0x2ec5bd['id'],'token':_0x24c9e1,'statusCall':'','isAlreadyLogged':_0x2ec5bd[_0x5bbe('0x36')]});});}})(_0x5d7935,_0x479d22,_0x2a0127);};exports[_0x5bbe('0x37')]=function(_0x7d8d80,_0x58bf57){if(!_0x7d8d80[_0x5bbe('0x38')][_0x5bbe('0x22')]){return handleError(_0x58bf57,0x1f4,{'message':'Email\x20parameter\x20is\x20missing'});}var _0x166370=rs[_0x5bbe('0x39')]();_0x7d8d80[_0x5bbe('0x38')][_0x5bbe('0x22')]=_0x7d8d80['body']['email']['trim']()['toLowerCase']();var _0x360849;return db['Setting']['findOne']({'where':{'id':0x1},'attributes':[_0x5bbe('0xe'),_0x5bbe('0xf')],'raw':!![]})[_0x5bbe('0x10')](function(_0x160561){_0x360849=_0x160561;return db[_0x5bbe('0x3a')][_0x5bbe('0x3b')]({'where':{'email':_0x7d8d80[_0x5bbe('0x38')]['email']}});})[_0x5bbe('0x10')](function(_0x42bb14){if(!_0x42bb14){throw new Error(_0x5bbe('0x3c'));}if(_0x42bb14[_0x5bbe('0x15')]){throw new Error(_0x5bbe('0x3d'));}if(_0x42bb14[_0x5bbe('0x1a')]){if(moment(_0x42bb14[_0x5bbe('0x1e')])['add'](_0x360849[_0x5bbe('0xf')],_0x5bbe('0x1c'))>moment()){throw new Error(_0x5bbe('0x3e'));}else{_0x42bb14[_0x5bbe('0x1a')]=![];_0x42bb14['blockedAt']=null;}}_0x42bb14[_0x5bbe('0x3f')]=_0x166370;_0x42bb14['resetPasswordExpires']=Date['now']()+0x36ee80;return _0x42bb14[_0x5bbe('0x40')]();})[_0x5bbe('0x10')](function(){return sendServiceMail({'to':_0x7d8d80['body']['email'],'subject':_0x5bbe('0x41'),'text':'You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a'+'Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a'+_0x5bbe('0x42')+_0x7d8d80[_0x5bbe('0x43')][_0x5bbe('0x44')]+_0x5bbe('0x45')+_0x166370+'\x0a\x0a'+_0x5bbe('0x46')});})[_0x5bbe('0x10')](function(){_0x58bf57[_0x5bbe('0x2f')](0xc8)['send']({'message':'Reset\x20Email\x20sent!'});})[_0x5bbe('0x1f')](function(_0xeff9f0){return handleError(_0x58bf57,0x1f4,_0xeff9f0);});};exports[_0x5bbe('0x47')]=function(_0x42f39a,_0x28e9a9){return db[_0x5bbe('0x3a')][_0x5bbe('0x3b')]({'where':{'resetPasswordToken':_0x42f39a[_0x5bbe('0x48')][_0x5bbe('0x49')],'resetPasswordExpires':{'$gt':Date[_0x5bbe('0x4a')]()}}})[_0x5bbe('0x10')](function(_0x32463b){if(!_0x32463b){throw new Error(_0x5bbe('0x4b'));}return db[_0x5bbe('0x4c')][_0x5bbe('0xd')]({'attributes':['id','securePassword',_0x5bbe('0x4d'),_0x5bbe('0x4e')]})['then'](function(_0x6b0cab){if(_0x6b0cab[_0x5bbe('0x4f')])authService['validatePasswordPattern'](_0x42f39a[_0x5bbe('0x38')][_0x5bbe('0x12')]);if(!_0x6b0cab['enforcePasswordHistory']||!_0x32463b[_0x5bbe('0x50')])return _0x32463b;authService[_0x5bbe('0x51')](_0x42f39a[_0x5bbe('0x38')][_0x5bbe('0x12')],_0x32463b[_0x5bbe('0x50')],_0x6b0cab['passwordHistoryLimit']);return _0x32463b;})[_0x5bbe('0x10')](function(){_0x32463b[_0x5bbe('0x12')]=_0x42f39a['body'][_0x5bbe('0x12')];_0x32463b[_0x5bbe('0x3f')]=null;_0x32463b[_0x5bbe('0x52')]=null;return _0x32463b['save']();});})[_0x5bbe('0x10')](function(){_0x28e9a9[_0x5bbe('0x2f')](0xc8)[_0x5bbe('0x30')]({'message':_0x5bbe('0x53')});})['catch'](function(_0x29b47e){return handleError(_0x28e9a9,0x1f4,_0x29b47e);});};passport[_0x5bbe('0x54')](_0x5bbe('0x32'),new LocalStrategy({'usernameField':_0x5bbe('0x11'),'passwordField':_0x5bbe('0x12')},function(_0x1adfad,_0x5c2f12,_0x599ff3){return localAuthenticate(db[_0x5bbe('0x3a')],_0x1adfad,_0x5c2f12,_0x599ff3);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index ad22667..5ad3c44 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 _0x9fae=['exports','express','Router','./authLocal.controller','post','/forgot','forgot','reset'];(function(_0xeb80c9,_0x3fe888){var _0x259c37=function(_0x49478c){while(--_0x49478c){_0xeb80c9['push'](_0xeb80c9['shift']());}};_0x259c37(++_0x3fe888);}(_0x9fae,0x111));var _0xe9fa=function(_0x58ca9b,_0x378045){_0x58ca9b=_0x58ca9b-0x0;var _0x1bf38c=_0x9fae[_0x58ca9b];return _0x1bf38c;};'use strict';var express=require(_0xe9fa('0x0'));var router=express[_0xe9fa('0x1')]();var controller=require(_0xe9fa('0x2'));router[_0xe9fa('0x3')]('/',controller['login']);router['post'](_0xe9fa('0x4'),controller[_0xe9fa('0x5')]);router[_0xe9fa('0x3')]('/reset/:token',controller[_0xe9fa('0x6')]);module[_0xe9fa('0x7')]=router; \ No newline at end of file +var _0x1841=['exports','Router','./authLocal.controller','login','/forgot','forgot','post','reset'];(function(_0xf80b3,_0x25d5f3){var _0x10c489=function(_0x3c5aee){while(--_0x3c5aee){_0xf80b3['push'](_0xf80b3['shift']());}};_0x10c489(++_0x25d5f3);}(_0x1841,0x199));var _0x1184=function(_0x582731,_0x209b85){_0x582731=_0x582731-0x0;var _0x4d81c9=_0x1841[_0x582731];return _0x4d81c9;};'use strict';var express=require('express');var router=express[_0x1184('0x0')]();var controller=require(_0x1184('0x1'));router['post']('/',controller[_0x1184('0x2')]);router['post'](_0x1184('0x3'),controller[_0x1184('0x4')]);router[_0x1184('0x5')]('/reset/:token',controller[_0x1184('0x6')]);module[_0x1184('0x7')]=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index 3158f17..0dc05a4 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 _0xf182=['sequelize','exports','STRING','BOOLEAN','INTEGER'];(function(_0x3350ec,_0x310200){var _0x28a0da=function(_0x278f5f){while(--_0x278f5f){_0x3350ec['push'](_0x3350ec['shift']());}};_0x28a0da(++_0x310200);}(_0xf182,0xb4));var _0x2f18=function(_0x3a7685,_0x9a8ccb){_0x3a7685=_0x3a7685-0x0;var _0x5d0aec=_0xf182[_0x3a7685];return _0x5d0aec;};'use strict';var Sequelize=require(_0x2f18('0x0'));module[_0x2f18('0x1')]={'name':{'type':Sequelize[_0x2f18('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0x2f18('0x2')]},'description':{'type':Sequelize[_0x2f18('0x2')]},'status':{'type':Sequelize[_0x2f18('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x2f18('0x4')],'defaultValue':0xa}}; \ No newline at end of file +var _0xdd94=['STRING','exports'];(function(_0x2685d3,_0xb4da0f){var _0x386649=function(_0x3b91e2){while(--_0x3b91e2){_0x2685d3['push'](_0x2685d3['shift']());}};_0x386649(++_0xb4da0f);}(_0xdd94,0x1ef));var _0x4dd9=function(_0x43008a,_0x3a895b){_0x43008a=_0x43008a-0x0;var _0x2a33c4=_0xdd94[_0x43008a];return _0x2a33c4;};'use strict';var Sequelize=require('sequelize');module[_0x4dd9('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'channel':{'type':Sequelize[_0x4dd9('0x1')]},'description':{'type':Sequelize[_0x4dd9('0x1')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timeout':{'type':Sequelize['INTEGER'],'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 533027d..dc6897f 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 _0x97c8=['name','send','map','Automation','rawAttributes','fieldName','type','query','keys','filters','intersection','model','fields','length','attributes','order','sort','pick','filter','where','merge','VIRTUAL','options','then','include','findAll','rows','catch','params','find','body','Condition','ids','omit','getConditions','findOne','hasOwnProperty','nolimit','addActions','Action','getActions','eml-format','rimraf','zip-dir','fast-json-patch','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/logger','../../config/utils','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','destroy','error','stack'];(function(_0x4e35a2,_0x4bd134){var _0x24def6=function(_0x2bb4bd){while(--_0x2bb4bd){_0x4e35a2['push'](_0x4e35a2['shift']());}};_0x24def6(++_0x4bd134);}(_0x97c8,0x79));var _0x897c=function(_0x549fb4,_0x57140c){_0x549fb4=_0x549fb4-0x0;var _0xc64c37=_0x97c8[_0x549fb4];return _0xc64c37;};'use strict';var emlformat=require(_0x897c('0x0'));var rimraf=require(_0x897c('0x1'));var zipdir=require(_0x897c('0x2'));var jsonpatch=require(_0x897c('0x3'));var rp=require(_0x897c('0x4'));var moment=require(_0x897c('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x897c('0x6'));var path=require(_0x897c('0x7'));var sox=require('sox');var csv=require(_0x897c('0x8'));var ejs=require(_0x897c('0x9'));var fs=require('fs');var fs_extra=require(_0x897c('0xa'));var _=require(_0x897c('0xb'));var squel=require(_0x897c('0xc'));var crypto=require(_0x897c('0xd'));var jsforce=require(_0x897c('0xe'));var deskjs=require(_0x897c('0xf'));var toCsv=require(_0x897c('0x8'));var querystring=require(_0x897c('0x10'));var Papa=require(_0x897c('0x11'));var Redis=require(_0x897c('0x12'));var authService=require(_0x897c('0x13'));var qs=require(_0x897c('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x897c('0x15'))('api');var utils=require(_0x897c('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x897c('0x17'))['db'];function respondWithStatusCode(_0x2fd3b7,_0x449b06){_0x449b06=_0x449b06||0xcc;return function(_0x38a5a3){if(_0x38a5a3){return _0x2fd3b7[_0x897c('0x18')](_0x449b06);}return _0x2fd3b7['status'](_0x449b06)['end']();};}function respondWithResult(_0x5d8ff7,_0x36eacb){_0x36eacb=_0x36eacb||0xc8;return function(_0x533145){if(_0x533145){return _0x5d8ff7[_0x897c('0x19')](_0x36eacb)[_0x897c('0x1a')](_0x533145);}};}function respondWithFilteredResult(_0x54c3e0,_0xcd1209){return function(_0x549ed5){if(_0x549ed5){var _0x570b31=typeof _0xcd1209['offset']===_0x897c('0x1b')&&typeof _0xcd1209[_0x897c('0x1c')]==='undefined';var _0x47c015=_0x549ed5[_0x897c('0x1d')];var _0x5399f6=_0x570b31?0x0:_0xcd1209[_0x897c('0x1e')];var _0x40c3e3=_0x570b31?_0x549ed5[_0x897c('0x1d')]:_0xcd1209['offset']+_0xcd1209['limit'];var _0x273afa;if(_0x40c3e3>=_0x47c015){_0x40c3e3=_0x47c015;_0x273afa=0xc8;}else{_0x273afa=0xce;}_0x54c3e0[_0x897c('0x19')](_0x273afa);return _0x54c3e0[_0x897c('0x1f')](_0x897c('0x20'),_0x5399f6+'-'+_0x40c3e3+'/'+_0x47c015)[_0x897c('0x1a')](_0x549ed5);}return null;};}function patchUpdates(_0x1e9872){return function(_0x328b4f){try{jsonpatch['apply'](_0x328b4f,_0x1e9872,!![]);}catch(_0x5b76bb){return BPromise[_0x897c('0x21')](_0x5b76bb);}return _0x328b4f[_0x897c('0x22')]();};}function saveUpdates(_0x23a8f2,_0x4aed8f){return function(_0x4245e4){if(_0x4245e4){return _0x4245e4[_0x897c('0x23')](_0x23a8f2)['then'](function(_0x389e00){return _0x389e00;});}return null;};}function removeEntity(_0x3ba0e1,_0x170895){return function(_0xf1058e){if(_0xf1058e){return _0xf1058e[_0x897c('0x24')]()['then'](function(){_0x3ba0e1[_0x897c('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1547ae,_0x1386e8){return function(_0x49bc8e){if(!_0x49bc8e){_0x1547ae['sendStatus'](0x194);}return _0x49bc8e;};}function handleError(_0x235dc2,_0x244628){_0x244628=_0x244628||0x1f4;return function(_0x4f69f3){logger[_0x897c('0x25')](_0x4f69f3[_0x897c('0x26')]);if(_0x4f69f3['name']){delete _0x4f69f3[_0x897c('0x27')];}_0x235dc2[_0x897c('0x19')](_0x244628)[_0x897c('0x28')](_0x4f69f3);};}exports['index']=function(_0x1ad1b2,_0x1b5faf){var _0x1cd783={},_0xecbef3={},_0x495ac8={'count':0x0,'rows':[]};var _0x545578=_[_0x897c('0x29')](db[_0x897c('0x2a')][_0x897c('0x2b')],function(_0x7efd3f){return{'name':_0x7efd3f[_0x897c('0x2c')],'type':_0x7efd3f[_0x897c('0x2d')]['key']};});_0xecbef3['model']=_['map'](_0x545578,_0x897c('0x27'));_0xecbef3[_0x897c('0x2e')]=_[_0x897c('0x2f')](_0x1ad1b2[_0x897c('0x2e')]);_0xecbef3[_0x897c('0x30')]=_[_0x897c('0x31')](_0xecbef3[_0x897c('0x32')],_0xecbef3[_0x897c('0x2e')]);_0x1cd783['attributes']=_['intersection'](_0xecbef3[_0x897c('0x32')],qs[_0x897c('0x33')](_0x1ad1b2[_0x897c('0x2e')]['fields']));_0x1cd783['attributes']=_0x1cd783['attributes'][_0x897c('0x34')]?_0x1cd783[_0x897c('0x35')]:_0xecbef3[_0x897c('0x32')];if(!_0x1ad1b2[_0x897c('0x2e')]['hasOwnProperty']('nolimit')){_0x1cd783[_0x897c('0x1c')]=qs[_0x897c('0x1c')](_0x1ad1b2[_0x897c('0x2e')]['limit']);_0x1cd783[_0x897c('0x1e')]=qs[_0x897c('0x1e')](_0x1ad1b2[_0x897c('0x2e')][_0x897c('0x1e')]);}_0x1cd783[_0x897c('0x36')]=qs['sort'](_0x1ad1b2[_0x897c('0x2e')][_0x897c('0x37')]);_0x1cd783['where']=qs[_0x897c('0x30')](_[_0x897c('0x38')](_0x1ad1b2['query'],_0xecbef3[_0x897c('0x30')]),_0x545578);if(_0x1ad1b2[_0x897c('0x2e')][_0x897c('0x39')]){_0x1cd783[_0x897c('0x3a')]=_[_0x897c('0x3b')](_0x1cd783[_0x897c('0x3a')],{'$or':_['map'](_0x545578,function(_0x352fe3){if(_0x352fe3['type']!==_0x897c('0x3c')){var _0x1aeb4d={};_0x1aeb4d[_0x352fe3[_0x897c('0x27')]]={'$like':'%'+_0x1ad1b2[_0x897c('0x2e')][_0x897c('0x39')]+'%'};return _0x1aeb4d;}})});}_0x1cd783=_['merge']({},_0x1cd783,_0x1ad1b2[_0x897c('0x3d')]);var _0x1a6391={'where':_0x1cd783[_0x897c('0x3a')]};return db[_0x897c('0x2a')][_0x897c('0x1d')](_0x1a6391)[_0x897c('0x3e')](function(_0x3aea5c){_0x495ac8['count']=_0x3aea5c;if(_0x1ad1b2[_0x897c('0x2e')]['includeAll']){_0x1cd783[_0x897c('0x3f')]=[{'all':!![]}];}return db[_0x897c('0x2a')][_0x897c('0x40')](_0x1cd783);})[_0x897c('0x3e')](function(_0x18e99c){_0x495ac8[_0x897c('0x41')]=_0x18e99c;return _0x495ac8;})['then'](respondWithFilteredResult(_0x1b5faf,_0x1cd783))[_0x897c('0x42')](handleError(_0x1b5faf,null));};exports['show']=function(_0x2977f7,_0x161cbb){var _0x2f42ac={'raw':![],'where':{'id':_0x2977f7[_0x897c('0x43')]['id']}},_0x5c00f1={};_0x5c00f1[_0x897c('0x32')]=_[_0x897c('0x2f')](db[_0x897c('0x2a')][_0x897c('0x2b')]);_0x5c00f1[_0x897c('0x2e')]=_['keys'](_0x2977f7['query']);_0x5c00f1[_0x897c('0x30')]=_[_0x897c('0x31')](_0x5c00f1[_0x897c('0x32')],_0x5c00f1[_0x897c('0x2e')]);_0x2f42ac['attributes']=_['intersection'](_0x5c00f1[_0x897c('0x32')],qs[_0x897c('0x33')](_0x2977f7[_0x897c('0x2e')][_0x897c('0x33')]));_0x2f42ac[_0x897c('0x35')]=_0x2f42ac[_0x897c('0x35')][_0x897c('0x34')]?_0x2f42ac[_0x897c('0x35')]:_0x5c00f1['model'];if(_0x2977f7['query']['includeAll']){_0x2f42ac['include']=[{'all':!![]}];}_0x2f42ac=_[_0x897c('0x3b')]({},_0x2f42ac,_0x2977f7['options']);return db[_0x897c('0x2a')][_0x897c('0x44')](_0x2f42ac)[_0x897c('0x3e')](handleEntityNotFound(_0x161cbb,null))[_0x897c('0x3e')](respondWithResult(_0x161cbb,null))['catch'](handleError(_0x161cbb,null));};exports['create']=function(_0x8c4719,_0x44940d){return db[_0x897c('0x2a')]['create'](_0x8c4719[_0x897c('0x45')],{})[_0x897c('0x3e')](respondWithResult(_0x44940d,0xc9))[_0x897c('0x42')](handleError(_0x44940d,null));};exports[_0x897c('0x23')]=function(_0x3e8a32,_0x31eb86){if(_0x3e8a32['body']['id']){delete _0x3e8a32['body']['id'];}return db[_0x897c('0x2a')][_0x897c('0x44')]({'where':{'id':_0x3e8a32[_0x897c('0x43')]['id']}})[_0x897c('0x3e')](handleEntityNotFound(_0x31eb86,null))[_0x897c('0x3e')](saveUpdates(_0x3e8a32[_0x897c('0x45')],null))['then'](respondWithResult(_0x31eb86,null))['catch'](handleError(_0x31eb86,null));};exports[_0x897c('0x24')]=function(_0x33be07,_0x50d9e4){return db['Automation'][_0x897c('0x44')]({'where':{'id':_0x33be07['params']['id']}})[_0x897c('0x3e')](handleEntityNotFound(_0x50d9e4,null))['then'](removeEntity(_0x50d9e4,null))[_0x897c('0x42')](handleError(_0x50d9e4,null));};exports['addConditions']=function(_0x3d947a,_0x41570a,_0x2ca258){return db[_0x897c('0x46')][_0x897c('0x44')]({'where':{'id':_0x3d947a[_0x897c('0x43')]['id']}})[_0x897c('0x3e')](handleEntityNotFound(_0x41570a,null))[_0x897c('0x3e')](function(_0xcc5dc9){if(_0xcc5dc9){return _0xcc5dc9['addConditions'](_0x3d947a[_0x897c('0x45')][_0x897c('0x47')],_[_0x897c('0x48')](_0x3d947a[_0x897c('0x45')],[_0x897c('0x47'),'id'])||{});}})[_0x897c('0x3e')](respondWithResult(_0x41570a,null))['catch'](handleError(_0x41570a,null));};exports[_0x897c('0x49')]=function(_0xd3c64d,_0x26dd0b,_0x5069e8){var _0x3a2c0a={};var _0x4a4e7d={};var _0x3d58c5;var _0x343b81;return db[_0x897c('0x2a')][_0x897c('0x4a')]({'where':{'id':_0xd3c64d[_0x897c('0x43')]['id']}})['then'](handleEntityNotFound(_0x26dd0b,null))[_0x897c('0x3e')](function(_0x161f1c){if(_0x161f1c){_0x3d58c5=_0x161f1c;_0x4a4e7d[_0x897c('0x32')]=_['keys'](db[_0x897c('0x46')][_0x897c('0x2b')]);_0x4a4e7d[_0x897c('0x2e')]=_[_0x897c('0x2f')](_0xd3c64d[_0x897c('0x2e')]);_0x4a4e7d['filters']=_[_0x897c('0x31')](_0x4a4e7d[_0x897c('0x32')],_0x4a4e7d[_0x897c('0x2e')]);_0x3a2c0a[_0x897c('0x35')]=_['intersection'](_0x4a4e7d[_0x897c('0x32')],qs[_0x897c('0x33')](_0xd3c64d[_0x897c('0x2e')]['fields']));_0x3a2c0a[_0x897c('0x35')]=_0x3a2c0a[_0x897c('0x35')][_0x897c('0x34')]?_0x3a2c0a[_0x897c('0x35')]:_0x4a4e7d[_0x897c('0x32')];_0x3a2c0a[_0x897c('0x36')]=qs[_0x897c('0x37')](_0xd3c64d[_0x897c('0x2e')][_0x897c('0x37')]);_0x3a2c0a[_0x897c('0x3a')]=qs[_0x897c('0x30')](_[_0x897c('0x38')](_0xd3c64d[_0x897c('0x2e')],_0x4a4e7d[_0x897c('0x30')]));if(_0xd3c64d[_0x897c('0x2e')]['filter']){_0x3a2c0a[_0x897c('0x3a')]=_[_0x897c('0x3b')](_0x3a2c0a['where'],{'$or':_[_0x897c('0x29')](_0x3a2c0a[_0x897c('0x35')],function(_0x27ac43){var _0x526a11={};_0x526a11[_0x27ac43]={'$like':'%'+_0xd3c64d[_0x897c('0x2e')][_0x897c('0x39')]+'%'};return _0x526a11;})});}_0x3a2c0a=_[_0x897c('0x3b')]({},_0x3a2c0a,_0xd3c64d[_0x897c('0x3d')]);return _0x3d58c5[_0x897c('0x49')](_0x3a2c0a);}})[_0x897c('0x3e')](function(_0x11894c){if(_0x11894c){_0x343b81=_0x11894c[_0x897c('0x34')];if(!_0xd3c64d[_0x897c('0x2e')][_0x897c('0x4b')](_0x897c('0x4c'))){_0x3a2c0a[_0x897c('0x1c')]=qs['limit'](_0xd3c64d[_0x897c('0x2e')][_0x897c('0x1c')]);_0x3a2c0a[_0x897c('0x1e')]=qs['offset'](_0xd3c64d[_0x897c('0x2e')][_0x897c('0x1e')]);}return _0x3d58c5[_0x897c('0x49')](_0x3a2c0a);}})[_0x897c('0x3e')](function(_0x2b6083){if(_0x2b6083){return _0x2b6083?{'count':_0x343b81,'rows':_0x2b6083}:null;}})['then'](respondWithResult(_0x26dd0b,null))[_0x897c('0x42')](handleError(_0x26dd0b,null));};exports[_0x897c('0x4d')]=function(_0xef07ca,_0x474b31,_0x21ac53){return db[_0x897c('0x4e')]['find']({'where':{'id':_0xef07ca[_0x897c('0x43')]['id']}})['then'](handleEntityNotFound(_0x474b31,null))['then'](function(_0x45472f){if(_0x45472f){return _0x45472f[_0x897c('0x4d')](_0xef07ca[_0x897c('0x45')][_0x897c('0x47')],_['omit'](_0xef07ca['body'],[_0x897c('0x47'),'id'])||{});}})['then'](respondWithResult(_0x474b31,null))[_0x897c('0x42')](handleError(_0x474b31,null));};exports['getActions']=function(_0x9122e6,_0x36c643,_0xf12eab){var _0x2b8a98={};var _0x348066={};var _0x3ed6f6;var _0x31274a;return db['Automation'][_0x897c('0x4a')]({'where':{'id':_0x9122e6[_0x897c('0x43')]['id']}})[_0x897c('0x3e')](handleEntityNotFound(_0x36c643,null))[_0x897c('0x3e')](function(_0x2a93dc){if(_0x2a93dc){_0x3ed6f6=_0x2a93dc;_0x348066[_0x897c('0x32')]=_[_0x897c('0x2f')](db[_0x897c('0x4e')][_0x897c('0x2b')]);_0x348066[_0x897c('0x2e')]=_[_0x897c('0x2f')](_0x9122e6['query']);_0x348066[_0x897c('0x30')]=_['intersection'](_0x348066[_0x897c('0x32')],_0x348066[_0x897c('0x2e')]);_0x2b8a98[_0x897c('0x35')]=_['intersection'](_0x348066[_0x897c('0x32')],qs[_0x897c('0x33')](_0x9122e6[_0x897c('0x2e')]['fields']));_0x2b8a98[_0x897c('0x35')]=_0x2b8a98[_0x897c('0x35')][_0x897c('0x34')]?_0x2b8a98['attributes']:_0x348066[_0x897c('0x32')];_0x2b8a98['order']=qs[_0x897c('0x37')](_0x9122e6[_0x897c('0x2e')][_0x897c('0x37')]);_0x2b8a98[_0x897c('0x3a')]=qs[_0x897c('0x30')](_[_0x897c('0x38')](_0x9122e6['query'],_0x348066['filters']));if(_0x9122e6['query'][_0x897c('0x39')]){_0x2b8a98[_0x897c('0x3a')]=_[_0x897c('0x3b')](_0x2b8a98[_0x897c('0x3a')],{'$or':_['map'](_0x2b8a98[_0x897c('0x35')],function(_0x1a2dec){var _0x5edefd={};_0x5edefd[_0x1a2dec]={'$like':'%'+_0x9122e6[_0x897c('0x2e')]['filter']+'%'};return _0x5edefd;})});}_0x2b8a98=_['merge']({},_0x2b8a98,_0x9122e6['options']);return _0x3ed6f6['getActions'](_0x2b8a98);}})[_0x897c('0x3e')](function(_0x550729){if(_0x550729){_0x31274a=_0x550729[_0x897c('0x34')];if(!_0x9122e6[_0x897c('0x2e')][_0x897c('0x4b')](_0x897c('0x4c'))){_0x2b8a98['limit']=qs['limit'](_0x9122e6[_0x897c('0x2e')]['limit']);_0x2b8a98['offset']=qs['offset'](_0x9122e6['query'][_0x897c('0x1e')]);}return _0x3ed6f6[_0x897c('0x4f')](_0x2b8a98);}})[_0x897c('0x3e')](function(_0x1d78d9){if(_0x1d78d9){return _0x1d78d9?{'count':_0x31274a,'rows':_0x1d78d9}:null;}})[_0x897c('0x3e')](respondWithResult(_0x36c643,null))[_0x897c('0x42')](handleError(_0x36c643,null));}; \ No newline at end of file +var _0xf409=['status','end','offset','undefined','count','limit','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','Automation','type','key','model','map','query','keys','attributes','fields','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','findAll','catch','show','rawAttributes','intersection','include','create','body','find','params','Condition','addConditions','omit','ids','length','getConditions','hasOwnProperty','addActions','Action','findOne','getActions','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus'];(function(_0x48ca9d,_0x24e394){var _0x286266=function(_0x2d6019){while(--_0x2d6019){_0x48ca9d['push'](_0x48ca9d['shift']());}};_0x286266(++_0x24e394);}(_0xf409,0x136));var _0x9f40=function(_0x1caf6a,_0x26a5bf){_0x1caf6a=_0x1caf6a-0x0;var _0x1bf493=_0xf409[_0x1caf6a];return _0x1bf493;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9f40('0x0'));var zipdir=require(_0x9f40('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9f40('0x2'));var moment=require(_0x9f40('0x3'));var BPromise=require(_0x9f40('0x4'));var Mustache=require(_0x9f40('0x5'));var util=require(_0x9f40('0x6'));var path=require(_0x9f40('0x7'));var sox=require(_0x9f40('0x8'));var csv=require(_0x9f40('0x9'));var ejs=require(_0x9f40('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9f40('0xb'));var squel=require(_0x9f40('0xc'));var crypto=require(_0x9f40('0xd'));var jsforce=require(_0x9f40('0xe'));var deskjs=require(_0x9f40('0xf'));var toCsv=require(_0x9f40('0x9'));var querystring=require(_0x9f40('0x10'));var Papa=require(_0x9f40('0x11'));var Redis=require(_0x9f40('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x9f40('0x13'));var as=require(_0x9f40('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9f40('0x15'))('api');var utils=require(_0x9f40('0x16'));var config=require(_0x9f40('0x17'));var licenseUtil=require(_0x9f40('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x50af7e,_0x51e967){_0x51e967=_0x51e967||0xcc;return function(_0xcce070){if(_0xcce070){return _0x50af7e[_0x9f40('0x19')](_0x51e967);}return _0x50af7e[_0x9f40('0x1a')](_0x51e967)[_0x9f40('0x1b')]();};}function respondWithResult(_0x34837a,_0x50b58a){_0x50b58a=_0x50b58a||0xc8;return function(_0x1d9ba2){if(_0x1d9ba2){return _0x34837a[_0x9f40('0x1a')](_0x50b58a)['json'](_0x1d9ba2);}};}function respondWithFilteredResult(_0x6057c1,_0x5da0ab){return function(_0x4fdc2e){if(_0x4fdc2e){var _0x4aa6d1=typeof _0x5da0ab[_0x9f40('0x1c')]===_0x9f40('0x1d')&&typeof _0x5da0ab['limit']===_0x9f40('0x1d');var _0x1ba030=_0x4fdc2e[_0x9f40('0x1e')];var _0x2d0ca4=_0x4aa6d1?0x0:_0x5da0ab[_0x9f40('0x1c')];var _0x1a144a=_0x4aa6d1?_0x4fdc2e['count']:_0x5da0ab[_0x9f40('0x1c')]+_0x5da0ab[_0x9f40('0x1f')];var _0x341383;if(_0x1a144a>=_0x1ba030){_0x1a144a=_0x1ba030;_0x341383=0xc8;}else{_0x341383=0xce;}_0x6057c1[_0x9f40('0x1a')](_0x341383);return _0x6057c1['set'](_0x9f40('0x20'),_0x2d0ca4+'-'+_0x1a144a+'/'+_0x1ba030)['json'](_0x4fdc2e);}return null;};}function patchUpdates(_0x9f1a51){return function(_0x312586){try{jsonpatch[_0x9f40('0x21')](_0x312586,_0x9f1a51,!![]);}catch(_0x132ef1){return BPromise[_0x9f40('0x22')](_0x132ef1);}return _0x312586[_0x9f40('0x23')]();};}function saveUpdates(_0x18fd6c,_0x53c141){return function(_0x32e7d1){if(_0x32e7d1){return _0x32e7d1[_0x9f40('0x24')](_0x18fd6c)[_0x9f40('0x25')](function(_0x26055a){return _0x26055a;});}return null;};}function removeEntity(_0x34c068,_0x41852e){return function(_0x186419){if(_0x186419){return _0x186419[_0x9f40('0x26')]()[_0x9f40('0x25')](function(){_0x34c068[_0x9f40('0x1a')](0xcc)[_0x9f40('0x1b')]();});}};}function handleEntityNotFound(_0x380405,_0x3577e0){return function(_0x2a6ed4){if(!_0x2a6ed4){_0x380405['sendStatus'](0x194);}return _0x2a6ed4;};}function handleError(_0x1d9800,_0x3f24ba){_0x3f24ba=_0x3f24ba||0x1f4;return function(_0x2cdebb){logger['error'](_0x2cdebb[_0x9f40('0x27')]);if(_0x2cdebb[_0x9f40('0x28')]){delete _0x2cdebb[_0x9f40('0x28')];}_0x1d9800[_0x9f40('0x1a')](_0x3f24ba)[_0x9f40('0x29')](_0x2cdebb);};}exports[_0x9f40('0x2a')]=function(_0x5c2561,_0x392e18){var _0x3498e9={},_0x557c6d={},_0xf0baf2={'count':0x0,'rows':[]};var _0x8f9b90=_['map'](db[_0x9f40('0x2b')]['rawAttributes'],function(_0x40036d){return{'name':_0x40036d['fieldName'],'type':_0x40036d[_0x9f40('0x2c')][_0x9f40('0x2d')]};});_0x557c6d[_0x9f40('0x2e')]=_[_0x9f40('0x2f')](_0x8f9b90,'name');_0x557c6d[_0x9f40('0x30')]=_[_0x9f40('0x31')](_0x5c2561['query']);_0x557c6d['filters']=_['intersection'](_0x557c6d[_0x9f40('0x2e')],_0x557c6d[_0x9f40('0x30')]);_0x3498e9[_0x9f40('0x32')]=_['intersection'](_0x557c6d[_0x9f40('0x2e')],qs[_0x9f40('0x33')](_0x5c2561[_0x9f40('0x30')][_0x9f40('0x33')]));_0x3498e9[_0x9f40('0x32')]=_0x3498e9[_0x9f40('0x32')]['length']?_0x3498e9[_0x9f40('0x32')]:_0x557c6d[_0x9f40('0x2e')];if(!_0x5c2561[_0x9f40('0x30')]['hasOwnProperty'](_0x9f40('0x34'))){_0x3498e9['limit']=qs['limit'](_0x5c2561[_0x9f40('0x30')][_0x9f40('0x1f')]);_0x3498e9['offset']=qs[_0x9f40('0x1c')](_0x5c2561[_0x9f40('0x30')][_0x9f40('0x1c')]);}_0x3498e9[_0x9f40('0x35')]=qs[_0x9f40('0x36')](_0x5c2561[_0x9f40('0x30')][_0x9f40('0x36')]);_0x3498e9[_0x9f40('0x37')]=qs['filters'](_[_0x9f40('0x38')](_0x5c2561['query'],_0x557c6d[_0x9f40('0x39')]),_0x8f9b90);if(_0x5c2561[_0x9f40('0x30')][_0x9f40('0x3a')]){_0x3498e9['where']=_[_0x9f40('0x3b')](_0x3498e9[_0x9f40('0x37')],{'$or':_['map'](_0x8f9b90,function(_0xbfc567){if(_0xbfc567['type']!==_0x9f40('0x3c')){var _0x237e10={};_0x237e10[_0xbfc567[_0x9f40('0x28')]]={'$like':'%'+_0x5c2561[_0x9f40('0x30')][_0x9f40('0x3a')]+'%'};return _0x237e10;}})});}_0x3498e9=_[_0x9f40('0x3b')]({},_0x3498e9,_0x5c2561[_0x9f40('0x3d')]);var _0xb36e93={'where':_0x3498e9[_0x9f40('0x37')]};return db['Automation'][_0x9f40('0x1e')](_0xb36e93)['then'](function(_0x560d58){_0xf0baf2[_0x9f40('0x1e')]=_0x560d58;if(_0x5c2561[_0x9f40('0x30')][_0x9f40('0x3e')]){_0x3498e9['include']=[{'all':!![]}];}return db[_0x9f40('0x2b')][_0x9f40('0x3f')](_0x3498e9);})[_0x9f40('0x25')](function(_0x1069e0){_0xf0baf2['rows']=_0x1069e0;return _0xf0baf2;})[_0x9f40('0x25')](respondWithFilteredResult(_0x392e18,_0x3498e9))[_0x9f40('0x40')](handleError(_0x392e18,null));};exports[_0x9f40('0x41')]=function(_0x5883c1,_0x5d5356){var _0x28e53c={'raw':![],'where':{'id':_0x5883c1['params']['id']}},_0x285403={};_0x285403[_0x9f40('0x2e')]=_[_0x9f40('0x31')](db[_0x9f40('0x2b')][_0x9f40('0x42')]);_0x285403[_0x9f40('0x30')]=_[_0x9f40('0x31')](_0x5883c1[_0x9f40('0x30')]);_0x285403[_0x9f40('0x39')]=_[_0x9f40('0x43')](_0x285403[_0x9f40('0x2e')],_0x285403[_0x9f40('0x30')]);_0x28e53c[_0x9f40('0x32')]=_[_0x9f40('0x43')](_0x285403[_0x9f40('0x2e')],qs[_0x9f40('0x33')](_0x5883c1[_0x9f40('0x30')]['fields']));_0x28e53c[_0x9f40('0x32')]=_0x28e53c['attributes']['length']?_0x28e53c[_0x9f40('0x32')]:_0x285403[_0x9f40('0x2e')];if(_0x5883c1[_0x9f40('0x30')][_0x9f40('0x3e')]){_0x28e53c[_0x9f40('0x44')]=[{'all':!![]}];}_0x28e53c=_[_0x9f40('0x3b')]({},_0x28e53c,_0x5883c1['options']);return db[_0x9f40('0x2b')]['find'](_0x28e53c)[_0x9f40('0x25')](handleEntityNotFound(_0x5d5356,null))['then'](respondWithResult(_0x5d5356,null))[_0x9f40('0x40')](handleError(_0x5d5356,null));};exports['create']=function(_0xcfb142,_0x539106){return db[_0x9f40('0x2b')][_0x9f40('0x45')](_0xcfb142['body'],{})['then'](respondWithResult(_0x539106,0xc9))[_0x9f40('0x40')](handleError(_0x539106,null));};exports[_0x9f40('0x24')]=function(_0x1ee72c,_0x2067c6){if(_0x1ee72c[_0x9f40('0x46')]['id']){delete _0x1ee72c[_0x9f40('0x46')]['id'];}return db[_0x9f40('0x2b')][_0x9f40('0x47')]({'where':{'id':_0x1ee72c[_0x9f40('0x48')]['id']}})[_0x9f40('0x25')](handleEntityNotFound(_0x2067c6,null))[_0x9f40('0x25')](saveUpdates(_0x1ee72c[_0x9f40('0x46')],null))['then'](respondWithResult(_0x2067c6,null))['catch'](handleError(_0x2067c6,null));};exports['destroy']=function(_0x4e97ec,_0x59392f){return db[_0x9f40('0x2b')][_0x9f40('0x47')]({'where':{'id':_0x4e97ec[_0x9f40('0x48')]['id']}})[_0x9f40('0x25')](handleEntityNotFound(_0x59392f,null))[_0x9f40('0x25')](removeEntity(_0x59392f,null))[_0x9f40('0x40')](handleError(_0x59392f,null));};exports['addConditions']=function(_0x3b93e9,_0x57ca8f,_0x22f65e){return db[_0x9f40('0x49')][_0x9f40('0x47')]({'where':{'id':_0x3b93e9[_0x9f40('0x48')]['id']}})[_0x9f40('0x25')](handleEntityNotFound(_0x57ca8f,null))[_0x9f40('0x25')](function(_0x5502bb){if(_0x5502bb){return _0x5502bb[_0x9f40('0x4a')](_0x3b93e9['body']['ids'],_[_0x9f40('0x4b')](_0x3b93e9[_0x9f40('0x46')],[_0x9f40('0x4c'),'id'])||{});}})[_0x9f40('0x25')](respondWithResult(_0x57ca8f,null))[_0x9f40('0x40')](handleError(_0x57ca8f,null));};exports['getConditions']=function(_0x5e462d,_0x3ac9d7,_0x4ff6c0){var _0x19b1d7={};var _0x2e43ac={};var _0x2f6657;var _0x4350b8;return db[_0x9f40('0x2b')]['findOne']({'where':{'id':_0x5e462d[_0x9f40('0x48')]['id']}})[_0x9f40('0x25')](handleEntityNotFound(_0x3ac9d7,null))[_0x9f40('0x25')](function(_0x591150){if(_0x591150){_0x2f6657=_0x591150;_0x2e43ac[_0x9f40('0x2e')]=_[_0x9f40('0x31')](db[_0x9f40('0x49')]['rawAttributes']);_0x2e43ac[_0x9f40('0x30')]=_['keys'](_0x5e462d[_0x9f40('0x30')]);_0x2e43ac[_0x9f40('0x39')]=_[_0x9f40('0x43')](_0x2e43ac[_0x9f40('0x2e')],_0x2e43ac[_0x9f40('0x30')]);_0x19b1d7[_0x9f40('0x32')]=_['intersection'](_0x2e43ac[_0x9f40('0x2e')],qs['fields'](_0x5e462d['query'][_0x9f40('0x33')]));_0x19b1d7[_0x9f40('0x32')]=_0x19b1d7[_0x9f40('0x32')][_0x9f40('0x4d')]?_0x19b1d7[_0x9f40('0x32')]:_0x2e43ac['model'];_0x19b1d7[_0x9f40('0x35')]=qs['sort'](_0x5e462d[_0x9f40('0x30')][_0x9f40('0x36')]);_0x19b1d7[_0x9f40('0x37')]=qs[_0x9f40('0x39')](_['pick'](_0x5e462d[_0x9f40('0x30')],_0x2e43ac[_0x9f40('0x39')]));if(_0x5e462d['query']['filter']){_0x19b1d7[_0x9f40('0x37')]=_[_0x9f40('0x3b')](_0x19b1d7[_0x9f40('0x37')],{'$or':_[_0x9f40('0x2f')](_0x19b1d7[_0x9f40('0x32')],function(_0xddbc4d){var _0x52e2a2={};_0x52e2a2[_0xddbc4d]={'$like':'%'+_0x5e462d[_0x9f40('0x30')]['filter']+'%'};return _0x52e2a2;})});}_0x19b1d7=_[_0x9f40('0x3b')]({},_0x19b1d7,_0x5e462d['options']);return _0x2f6657[_0x9f40('0x4e')](_0x19b1d7);}})['then'](function(_0x20e162){if(_0x20e162){_0x4350b8=_0x20e162[_0x9f40('0x4d')];if(!_0x5e462d['query'][_0x9f40('0x4f')]('nolimit')){_0x19b1d7['limit']=qs[_0x9f40('0x1f')](_0x5e462d[_0x9f40('0x30')][_0x9f40('0x1f')]);_0x19b1d7[_0x9f40('0x1c')]=qs[_0x9f40('0x1c')](_0x5e462d[_0x9f40('0x30')]['offset']);}return _0x2f6657[_0x9f40('0x4e')](_0x19b1d7);}})['then'](function(_0x1b9462){if(_0x1b9462){return _0x1b9462?{'count':_0x4350b8,'rows':_0x1b9462}:null;}})[_0x9f40('0x25')](respondWithResult(_0x3ac9d7,null))['catch'](handleError(_0x3ac9d7,null));};exports[_0x9f40('0x50')]=function(_0x1c10de,_0x253b23,_0x55adf9){return db[_0x9f40('0x51')][_0x9f40('0x47')]({'where':{'id':_0x1c10de['params']['id']}})['then'](handleEntityNotFound(_0x253b23,null))[_0x9f40('0x25')](function(_0x8d00cd){if(_0x8d00cd){return _0x8d00cd[_0x9f40('0x50')](_0x1c10de[_0x9f40('0x46')][_0x9f40('0x4c')],_[_0x9f40('0x4b')](_0x1c10de[_0x9f40('0x46')],[_0x9f40('0x4c'),'id'])||{});}})[_0x9f40('0x25')](respondWithResult(_0x253b23,null))['catch'](handleError(_0x253b23,null));};exports['getActions']=function(_0x163079,_0x179dc2,_0x39233c){var _0x1135c0={};var _0x52c9fc={};var _0x3d42fe;var _0x3d053a;return db[_0x9f40('0x2b')][_0x9f40('0x52')]({'where':{'id':_0x163079['params']['id']}})[_0x9f40('0x25')](handleEntityNotFound(_0x179dc2,null))[_0x9f40('0x25')](function(_0x4c5a1f){if(_0x4c5a1f){_0x3d42fe=_0x4c5a1f;_0x52c9fc['model']=_['keys'](db[_0x9f40('0x51')][_0x9f40('0x42')]);_0x52c9fc[_0x9f40('0x30')]=_[_0x9f40('0x31')](_0x163079[_0x9f40('0x30')]);_0x52c9fc[_0x9f40('0x39')]=_['intersection'](_0x52c9fc[_0x9f40('0x2e')],_0x52c9fc['query']);_0x1135c0[_0x9f40('0x32')]=_[_0x9f40('0x43')](_0x52c9fc['model'],qs[_0x9f40('0x33')](_0x163079[_0x9f40('0x30')][_0x9f40('0x33')]));_0x1135c0[_0x9f40('0x32')]=_0x1135c0[_0x9f40('0x32')]['length']?_0x1135c0[_0x9f40('0x32')]:_0x52c9fc[_0x9f40('0x2e')];_0x1135c0[_0x9f40('0x35')]=qs[_0x9f40('0x36')](_0x163079['query'][_0x9f40('0x36')]);_0x1135c0['where']=qs['filters'](_[_0x9f40('0x38')](_0x163079['query'],_0x52c9fc[_0x9f40('0x39')]));if(_0x163079['query'][_0x9f40('0x3a')]){_0x1135c0[_0x9f40('0x37')]=_[_0x9f40('0x3b')](_0x1135c0[_0x9f40('0x37')],{'$or':_[_0x9f40('0x2f')](_0x1135c0[_0x9f40('0x32')],function(_0x313072){var _0x479223={};_0x479223[_0x313072]={'$like':'%'+_0x163079['query'][_0x9f40('0x3a')]+'%'};return _0x479223;})});}_0x1135c0=_[_0x9f40('0x3b')]({},_0x1135c0,_0x163079[_0x9f40('0x3d')]);return _0x3d42fe[_0x9f40('0x53')](_0x1135c0);}})[_0x9f40('0x25')](function(_0x423f9a){if(_0x423f9a){_0x3d053a=_0x423f9a['length'];if(!_0x163079[_0x9f40('0x30')][_0x9f40('0x4f')]('nolimit')){_0x1135c0['limit']=qs[_0x9f40('0x1f')](_0x163079[_0x9f40('0x30')][_0x9f40('0x1f')]);_0x1135c0[_0x9f40('0x1c')]=qs['offset'](_0x163079[_0x9f40('0x30')][_0x9f40('0x1c')]);}return _0x3d42fe['getActions'](_0x1135c0);}})['then'](function(_0x49c050){if(_0x49c050){return _0x49c050?{'count':_0x3d053a,'rows':_0x49c050}:null;}})[_0x9f40('0x25')](respondWithResult(_0x179dc2,null))['catch'](handleError(_0x179dc2,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index c3ca61e..d55f9b5 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 _0xe523=['exports','define','tools_automations','lodash','util','api','moment','bluebird','../../config/environment'];(function(_0x37c3fc,_0x5ffca){var _0x43101f=function(_0x4efa08){while(--_0x4efa08){_0x37c3fc['push'](_0x37c3fc['shift']());}};_0x43101f(++_0x5ffca);}(_0xe523,0xc0));var _0x3e52=function(_0x5b47db,_0x1130a7){_0x5b47db=_0x5b47db-0x0;var _0x722a26=_0xe523[_0x5b47db];return _0x722a26;};'use strict';var _=require(_0x3e52('0x0'));var util=require(_0x3e52('0x1'));var logger=require('../../config/logger')(_0x3e52('0x2'));var moment=require(_0x3e52('0x3'));var BPromise=require(_0x3e52('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x3e52('0x5'));var attributes=require('./automation.attributes');module[_0x3e52('0x6')]=function(_0x40fdec,_0x11c7e3){return _0x40fdec[_0x3e52('0x7')]('Automation',attributes,{'tableName':_0x3e52('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0caf=['../../config/environment','./automation.attributes','exports','Automation','tools_automations','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x5c9618,_0x580e09){var _0x17172b=function(_0x4f7960){while(--_0x4f7960){_0x5c9618['push'](_0x5c9618['shift']());}};_0x17172b(++_0x580e09);}(_0x0caf,0x1bd));var _0xf0ca=function(_0x570698,_0x268058){_0x570698=_0x570698-0x0;var _0x5d07d5=_0x0caf[_0x570698];return _0x5d07d5;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xf0ca('0x0'));var moment=require(_0xf0ca('0x1'));var BPromise=require(_0xf0ca('0x2'));var rp=require(_0xf0ca('0x3'));var fs=require('fs');var path=require(_0xf0ca('0x4'));var rimraf=require(_0xf0ca('0x5'));var config=require(_0xf0ca('0x6'));var attributes=require(_0xf0ca('0x7'));module[_0xf0ca('0x8')]=function(_0x55e4e9,_0x3034e3){return _0x55e4e9['define'](_0xf0ca('0x9'),attributes,{'tableName':_0xf0ca('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/automation/automation.rpc.js b/server/api/automation/automation.rpc.js index 5d7c705..6c62674 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 _0x731b=['debug','Automation,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','Automation,\x20%s,\x20%s','request\x20sent'];(function(_0x158f01,_0x12af3e){var _0x5ef74e=function(_0x5e7adc){while(--_0x5e7adc){_0x158f01['push'](_0x158f01['shift']());}};_0x5ef74e(++_0x12af3e);}(_0x731b,0xf7));var _0xb731=function(_0x2d197d,_0x586725){_0x2d197d=_0x2d197d-0x0;var _0x332df8=_0x731b[_0x2d197d];return _0x332df8;};'use strict';var _=require(_0xb731('0x0'));var util=require(_0xb731('0x1'));var moment=require('moment');var BPromise=require(_0xb731('0x2'));var rs=require(_0xb731('0x3'));var fs=require('fs');var Redis=require(_0xb731('0x4'));var db=require(_0xb731('0x5'))['db'];var utils=require(_0xb731('0x6'));var logger=require(_0xb731('0x7'))('rpc');var config=require(_0xb731('0x8'));var jayson=require(_0xb731('0x9'));var client=jayson[_0xb731('0xa')][_0xb731('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x12c59b,_0x2b475d,_0x173768){return new BPromise(function(_0x58b83c,_0x2ab04b){return client[_0xb731('0xc')](_0x12c59b,_0x173768)[_0xb731('0xd')](function(_0x26488c){logger[_0xb731('0xe')](_0xb731('0xf'),_0x2b475d,_0xb731('0x10'));logger[_0xb731('0x11')](_0xb731('0x12'),_0x2b475d,_0xb731('0x10'),JSON[_0xb731('0x13')](_0x26488c));if(_0x26488c[_0xb731('0x14')]){if(_0x26488c[_0xb731('0x14')][_0xb731('0x15')]===0x1f4){logger[_0xb731('0x14')]('Automation,\x20%s,\x20%s',_0x2b475d,_0x26488c[_0xb731('0x14')]['message']);return _0x2ab04b(_0x26488c[_0xb731('0x14')][_0xb731('0x16')]);}logger[_0xb731('0x14')]('Automation,\x20%s,\x20%s',_0x2b475d,_0x26488c[_0xb731('0x14')]['message']);return _0x58b83c(_0x26488c['error']['message']);}else{logger[_0xb731('0xe')](_0xb731('0xf'),_0x2b475d,'request\x20sent');_0x58b83c(_0x26488c[_0xb731('0x17')][_0xb731('0x16')]);}})['catch'](function(_0x30da75){logger[_0xb731('0x14')](_0xb731('0xf'),_0x2b475d,_0x30da75);_0x2ab04b(_0x30da75);});});} \ No newline at end of file +var _0xb2f3=['message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','stringify','error','code','Automation,\x20%s,\x20%s'];(function(_0x5d00a6,_0x2749b5){var _0x36762e=function(_0x2227f4){while(--_0x2227f4){_0x5d00a6['push'](_0x5d00a6['shift']());}};_0x36762e(++_0x2749b5);}(_0xb2f3,0xfd));var _0x3b2f=function(_0x25e7cb,_0x3579b7){_0x25e7cb=_0x25e7cb-0x0;var _0x375d92=_0xb2f3[_0x25e7cb];return _0x375d92;};'use strict';var _=require(_0x3b2f('0x0'));var util=require(_0x3b2f('0x1'));var moment=require(_0x3b2f('0x2'));var BPromise=require(_0x3b2f('0x3'));var rs=require(_0x3b2f('0x4'));var fs=require('fs');var Redis=require(_0x3b2f('0x5'));var db=require(_0x3b2f('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x3b2f('0x7'))(_0x3b2f('0x8'));var config=require(_0x3b2f('0x9'));var jayson=require(_0x3b2f('0xa'));var client=jayson[_0x3b2f('0xb')][_0x3b2f('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x26719d,_0x4b3632,_0x200ca4){return new BPromise(function(_0x56e425,_0x266ed2){return client[_0x3b2f('0xd')](_0x26719d,_0x200ca4)[_0x3b2f('0xe')](function(_0x25134f){logger['info']('Automation,\x20%s,\x20%s',_0x4b3632,_0x3b2f('0xf'));logger[_0x3b2f('0x10')](_0x3b2f('0x11'),_0x4b3632,_0x3b2f('0xf'),JSON[_0x3b2f('0x12')](_0x25134f));if(_0x25134f[_0x3b2f('0x13')]){if(_0x25134f[_0x3b2f('0x13')][_0x3b2f('0x14')]===0x1f4){logger[_0x3b2f('0x13')](_0x3b2f('0x15'),_0x4b3632,_0x25134f[_0x3b2f('0x13')][_0x3b2f('0x16')]);return _0x266ed2(_0x25134f[_0x3b2f('0x13')][_0x3b2f('0x16')]);}logger[_0x3b2f('0x13')]('Automation,\x20%s,\x20%s',_0x4b3632,_0x25134f[_0x3b2f('0x13')]['message']);return _0x56e425(_0x25134f[_0x3b2f('0x13')][_0x3b2f('0x16')]);}else{logger['info'](_0x3b2f('0x15'),_0x4b3632,'request\x20sent');_0x56e425(_0x25134f[_0x3b2f('0x17')][_0x3b2f('0x16')]);}})[_0x3b2f('0x18')](function(_0xd2b1e9){logger['error']('Automation,\x20%s,\x20%s',_0x4b3632,_0xd2b1e9);_0x266ed2(_0xd2b1e9);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 93a3cd5..bf42f05 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 _0x1294=['../../components/interaction/service','../../config/environment','./automation.controller','get','isAuthenticated','index','/:id','show','getConditions','getActions','post','addActions','put','update','delete','destroy','multer','path','express','Router','../../components/auth/service'];(function(_0x45f4ba,_0x5498c8){var _0x44db14=function(_0x381dec){while(--_0x381dec){_0x45f4ba['push'](_0x45f4ba['shift']());}};_0x44db14(++_0x5498c8);}(_0x1294,0xb8));var _0x4129=function(_0x32ad52,_0x3867b7){_0x32ad52=_0x32ad52-0x0;var _0xd4d3d3=_0x1294[_0x32ad52];return _0xd4d3d3;};'use strict';var multer=require(_0x4129('0x0'));var util=require('util');var path=require(_0x4129('0x1'));var timeout=require('connect-timeout');var express=require(_0x4129('0x2'));var router=express[_0x4129('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x4129('0x4'));var interaction=require(_0x4129('0x5'));var config=require(_0x4129('0x6'));var controller=require(_0x4129('0x7'));router[_0x4129('0x8')]('/',auth[_0x4129('0x9')](),controller[_0x4129('0xa')]);router[_0x4129('0x8')](_0x4129('0xb'),auth[_0x4129('0x9')](),controller[_0x4129('0xc')]);router[_0x4129('0x8')]('/:id/conditions',auth[_0x4129('0x9')](),controller[_0x4129('0xd')]);router[_0x4129('0x8')]('/:id/actions',auth['isAuthenticated'](),controller[_0x4129('0xe')]);router[_0x4129('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/conditions',auth['isAuthenticated'](),controller['addConditions']);router[_0x4129('0xf')]('/:id/actions',auth[_0x4129('0x9')](),controller[_0x4129('0x10')]);router[_0x4129('0x11')](_0x4129('0xb'),auth[_0x4129('0x9')](),controller[_0x4129('0x12')]);router[_0x4129('0x13')](_0x4129('0xb'),auth[_0x4129('0x9')](),controller[_0x4129('0x14')]);module['exports']=router; \ No newline at end of file +var _0xf1e1=['../../config/environment','./automation.controller','get','isAuthenticated','index','/:id','show','/:id/conditions','getConditions','/:id/actions','getActions','post','create','addConditions','addActions','put','update','exports','multer','path','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x489410,_0x55d0eb){var _0x175263=function(_0x323aea){while(--_0x323aea){_0x489410['push'](_0x489410['shift']());}};_0x175263(++_0x55d0eb);}(_0xf1e1,0x102));var _0x1f1e=function(_0x3011b7,_0x56b4b0){_0x3011b7=_0x3011b7-0x0;var _0x304ca2=_0xf1e1[_0x3011b7];return _0x304ca2;};'use strict';var multer=require(_0x1f1e('0x0'));var util=require('util');var path=require(_0x1f1e('0x1'));var timeout=require('connect-timeout');var express=require(_0x1f1e('0x2'));var router=express['Router']();var fs_extra=require(_0x1f1e('0x3'));var auth=require(_0x1f1e('0x4'));var interaction=require(_0x1f1e('0x5'));var config=require(_0x1f1e('0x6'));var controller=require(_0x1f1e('0x7'));router[_0x1f1e('0x8')]('/',auth[_0x1f1e('0x9')](),controller[_0x1f1e('0xa')]);router[_0x1f1e('0x8')](_0x1f1e('0xb'),auth[_0x1f1e('0x9')](),controller[_0x1f1e('0xc')]);router[_0x1f1e('0x8')](_0x1f1e('0xd'),auth['isAuthenticated'](),controller[_0x1f1e('0xe')]);router[_0x1f1e('0x8')](_0x1f1e('0xf'),auth[_0x1f1e('0x9')](),controller[_0x1f1e('0x10')]);router[_0x1f1e('0x11')]('/',auth[_0x1f1e('0x9')](),controller[_0x1f1e('0x12')]);router[_0x1f1e('0x11')]('/:id/conditions',auth[_0x1f1e('0x9')](),controller[_0x1f1e('0x13')]);router[_0x1f1e('0x11')](_0x1f1e('0xf'),auth[_0x1f1e('0x9')](),controller[_0x1f1e('0x14')]);router[_0x1f1e('0x15')]('/:id',auth[_0x1f1e('0x9')](),controller[_0x1f1e('0x16')]);router['delete'](_0x1f1e('0xb'),auth[_0x1f1e('0x9')](),controller['destroy']);module[_0x1f1e('0x17')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index 22bea2c..e2d1865 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 _0x094c=['AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','exports','STRING','ENUM','ivr','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)','07:00-22:00,*,*,*','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Greeting','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','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)','#AgentReject\x20Retry\x20(min:1,\x20max:999)'];(function(_0x8579f9,_0x357bdd){var _0x129dea=function(_0x9a86){while(--_0x9a86){_0x8579f9['push'](_0x8579f9['shift']());}};_0x129dea(++_0x357bdd);}(_0x094c,0x131));var _0xc094=function(_0x3987a1,_0x447793){_0x3987a1=_0x3987a1-0x0;var _0xe2596e=_0x094c[_0x3987a1];return _0xe2596e;};'use strict';var Sequelize=require('sequelize');module[_0xc094('0x0')]={'name':{'type':Sequelize[_0xc094('0x1')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0xc094('0x2')](_0xc094('0x3')),'allowNull':![],'defaultValue':'ivr'},'description':{'type':Sequelize[_0xc094('0x1')]},'active':{'type':Sequelize[_0xc094('0x4')],'defaultValue':0x0,'comment':_0xc094('0x5')},'limitCalls':{'type':Sequelize[_0xc094('0x6')](0x4)[_0xc094('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0xc094('0x8')},'dialOriginateCallerIdName':{'type':Sequelize[_0xc094('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0xc094('0x6')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc094('0x9')},'dialCongestionMaxRetry':{'type':Sequelize[_0xc094('0x6')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc094('0xa')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xc094('0x6')](0x5)[_0xc094('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc094('0xb')},'dialBusyMaxRetry':{'type':Sequelize[_0xc094('0x6')](0x3)[_0xc094('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0xc094('0x6')](0x5)[_0xc094('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc094('0xc')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0xc094('0xd')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xc094('0x6')](0x5)[_0xc094('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc094('0xe')},'dialGlobalMaxRetry':{'type':Sequelize[_0xc094('0x6')](0x3)[_0xc094('0x7')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0xc094('0x1')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0xc094('0xf')},'dialCheckDuplicateType':{'type':Sequelize[_0xc094('0x2')](_0xc094('0x10'),_0xc094('0x11'),_0xc094('0x12')),'defaultValue':_0xc094('0x10')},'dialAMDActive':{'type':Sequelize[_0xc094('0x4')],'defaultValue':0x0,'comment':_0xc094('0x13')},'dialAMDInitialSilence':{'type':Sequelize[_0xc094('0x6')](0x9)[_0xc094('0x7')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0xc094('0x7')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xc094('0x14')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xc094('0x6')](0x9)[_0xc094('0x7')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xc094('0x6')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xc094('0x15')},'dialAMDMinWordLength':{'type':Sequelize[_0xc094('0x6')](0x9)[_0xc094('0x7')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xc094('0x16')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xc094('0x6')](0x9)[_0xc094('0x7')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xc094('0x17')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xc094('0x6')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xc094('0x18')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xc094('0x6')](0x5)[_0xc094('0x7')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0xc094('0x6')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xc094('0x19')},'dialOrderByScheduledAt':{'type':Sequelize[_0xc094('0x2')](_0xc094('0x1a'),_0xc094('0x1b')),'defaultValue':_0xc094('0x1a')},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize[_0xc094('0x6')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xc094('0x1c')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xc094('0x6')](0x3)[_0xc094('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc094('0x1d')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xc094('0x6')](0x5)[_0xc094('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc094('0x1e')},'dialDropMaxRetry':{'type':Sequelize[_0xc094('0x6')](0x3)[_0xc094('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc094('0x1f')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xc094('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc094('0x20')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xc094('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc094('0x21')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xc094('0x6')](0x5)[_0xc094('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc094('0x22')},'dialMachineMaxRetry':{'type':Sequelize[_0xc094('0x6')](0x3)[_0xc094('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc094('0x23')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xc094('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xc094('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc094('0x24')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xc094('0x6')](0x5)[_0xc094('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc094('0x25')}}; \ No newline at end of file +var _0x3441=['ENUM','ivr','STRING','INTEGER','Max\x20200\x20calls.','UNSIGNED','#Congestion\x20Retry\x20(min:1,\x20max:999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','BOOLEAN','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Maximum\x20Word\x20Length','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','name'];(function(_0x1d24eb,_0x12295b){var _0x1dc576=function(_0x4d5770){while(--_0x4d5770){_0x1d24eb['push'](_0x1d24eb['shift']());}};_0x1dc576(++_0x12295b);}(_0x3441,0x14b));var _0x1344=function(_0x108715,_0x3d57ce){_0x108715=_0x108715-0x0;var _0x32a07e=_0x3441[_0x108715];return _0x32a07e;};'use strict';var Sequelize=require(_0x1344('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x1344('0x1'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x1344('0x2')]('ivr'),'allowNull':![],'defaultValue':_0x1344('0x3')},'description':{'type':Sequelize[_0x1344('0x4')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'limitCalls':{'type':Sequelize[_0x1344('0x5')](0x4)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x1344('0x6')},'dialOriginateCallerIdName':{'type':Sequelize[_0x1344('0x4')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x1344('0x4')]},'dialOriginateTimeout':{'type':Sequelize[_0x1344('0x5')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialCongestionMaxRetry':{'type':Sequelize[_0x1344('0x5')](0x3)[_0x1344('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1344('0x8')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0x1344('0x5')](0x3)[_0x1344('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1344('0x9')},'dialBusyRetryFrequency':{'type':Sequelize[_0x1344('0x5')](0x5)[_0x1344('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1344('0xa')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x1344('0x5')](0x3)[_0x1344('0x7')],'defaultValue':0x3,'comment':_0x1344('0xb')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x1344('0x5')](0x5)[_0x1344('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1344('0xc')},'dialGlobalMaxRetry':{'type':Sequelize[_0x1344('0x5')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x1344('0xd')},'dialTimezone':{'type':Sequelize[_0x1344('0x4')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x1344('0x4')],'defaultValue':_0x1344('0xe')},'dialCheckDuplicateType':{'type':Sequelize[_0x1344('0x2')](_0x1344('0xf'),_0x1344('0x10'),_0x1344('0x11')),'defaultValue':_0x1344('0xf')},'dialAMDActive':{'type':Sequelize[_0x1344('0x12')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0x1344('0x5')](0x9)[_0x1344('0x7')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0x1344('0x5')](0x9)[_0x1344('0x7')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x1344('0x13')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x1344('0x5')](0x9)[_0x1344('0x7')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x1344('0x14')},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0x1344('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0x1344('0x5')](0x9)[_0x1344('0x7')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x1344('0x15')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x1344('0x5')](0x9)[_0x1344('0x7')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x1344('0x16')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x1344('0x5')](0x9)[_0x1344('0x7')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x1344('0x17')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x1344('0x5')](0x5)[_0x1344('0x7')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0x1344('0x5')](0x9)[_0x1344('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x1344('0x18')},'dialOrderByScheduledAt':{'type':Sequelize[_0x1344('0x2')](_0x1344('0x19'),'ASC'),'defaultValue':'DESC'},'dialPrefix':{'type':Sequelize[_0x1344('0x4')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x1344('0x5')](0x3)[_0x1344('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x1344('0x1a')},'dialCutDigit':{'type':Sequelize[_0x1344('0x5')](0x3)[_0x1344('0x7')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x1344('0x1b')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x1344('0x5')](0x3)[_0x1344('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1344('0x1c')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x1344('0x5')](0x5)[_0x1344('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1344('0x1d')},'dialDropMaxRetry':{'type':Sequelize[_0x1344('0x5')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1344('0x1e')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1344('0x1f')},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x1344('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1344('0x20')},'dialMachineMaxRetry':{'type':Sequelize[_0x1344('0x5')](0x3)[_0x1344('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1344('0x21')},'dialMachineRetryFrequency':{'type':Sequelize[_0x1344('0x5')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1344('0x22')},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x1344('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1344('0x23')},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1344('0x24')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 1e828fe..0a971ff 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 _0xa0a3=['CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','format','addLists','ids','spread','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','select','field','NOW()','CmListId','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','onlyIfOpen','COALESCE(phone,\x27\x27)','cm_hopper_additional_phones','cmHopperId','OrderBy','h.id','ci.item','ci.OrderBY','join','sequelize','push','all','removeLists','getBlackLists','addBlackLists','YYYY-MM-DD\x20HH:mm:ss','cm_hopper_black','removeBlackLists','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','update','then','destroy','get','UserProfileResource','name','send','map','Campaign','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','sort','where','pick','filter','merge','options','includeAll','findAll','rows','catch','show','params','include','create','body','user','role','UserProfileSection','find','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','getHoppers','CmHopper','nolimit','order','CampaignId','findOne','CmHopperHistory','getHopperFinals'];(function(_0x485843,_0x4d8e2b){var _0x1f7495=function(_0x4fd673){while(--_0x4fd673){_0x485843['push'](_0x485843['shift']());}};_0x1f7495(++_0x4d8e2b);}(_0xa0a3,0x1e0));var _0x3a0a=function(_0x26888c,_0x1e6a1a){_0x26888c=_0x26888c-0x0;var _0x563c69=_0xa0a3[_0x26888c];return _0x563c69;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3a0a('0x0'));var zipdir=require(_0x3a0a('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3a0a('0x2'));var moment=require(_0x3a0a('0x3'));var BPromise=require(_0x3a0a('0x4'));var Mustache=require(_0x3a0a('0x5'));var util=require(_0x3a0a('0x6'));var path=require(_0x3a0a('0x7'));var sox=require(_0x3a0a('0x8'));var csv=require(_0x3a0a('0x9'));var ejs=require(_0x3a0a('0xa'));var fs=require('fs');var fs_extra=require(_0x3a0a('0xb'));var _=require(_0x3a0a('0xc'));var squel=require(_0x3a0a('0xd'));var crypto=require(_0x3a0a('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x3a0a('0x9'));var querystring=require(_0x3a0a('0xf'));var Papa=require(_0x3a0a('0x10'));var Redis=require(_0x3a0a('0x11'));var authService=require(_0x3a0a('0x12'));var qs=require(_0x3a0a('0x13'));var as=require(_0x3a0a('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x3a0a('0x15'));var utils=require(_0x3a0a('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x3a0a('0x17'))['db'];function respondWithStatusCode(_0x1db53c,_0x52cb58){_0x52cb58=_0x52cb58||0xcc;return function(_0x2243d2){if(_0x2243d2){return _0x1db53c[_0x3a0a('0x18')](_0x52cb58);}return _0x1db53c[_0x3a0a('0x19')](_0x52cb58)[_0x3a0a('0x1a')]();};}function respondWithResult(_0x977120,_0x303dc7){_0x303dc7=_0x303dc7||0xc8;return function(_0x350d58){if(_0x350d58){return _0x977120[_0x3a0a('0x19')](_0x303dc7)[_0x3a0a('0x1b')](_0x350d58);}};}function respondWithFilteredResult(_0x21e0f7,_0x11eeee){return function(_0x22a60e){if(_0x22a60e){var _0x52f629=typeof _0x11eeee[_0x3a0a('0x1c')]==='undefined'&&typeof _0x11eeee[_0x3a0a('0x1d')]==='undefined';var _0x2f5e77=_0x22a60e[_0x3a0a('0x1e')];var _0x36582f=_0x52f629?0x0:_0x11eeee['offset'];var _0x104679=_0x52f629?_0x22a60e[_0x3a0a('0x1e')]:_0x11eeee['offset']+_0x11eeee[_0x3a0a('0x1d')];var _0x26f7bb;if(_0x104679>=_0x2f5e77){_0x104679=_0x2f5e77;_0x26f7bb=0xc8;}else{_0x26f7bb=0xce;}_0x21e0f7[_0x3a0a('0x19')](_0x26f7bb);return _0x21e0f7[_0x3a0a('0x1f')](_0x3a0a('0x20'),_0x36582f+'-'+_0x104679+'/'+_0x2f5e77)[_0x3a0a('0x1b')](_0x22a60e);}return null;};}function patchUpdates(_0x3e99f9){return function(_0x231541){try{jsonpatch[_0x3a0a('0x21')](_0x231541,_0x3e99f9,!![]);}catch(_0x430509){return BPromise['reject'](_0x430509);}return _0x231541['save']();};}function saveUpdates(_0x483039,_0x33560b){return function(_0x6681b2){if(_0x6681b2){return _0x6681b2[_0x3a0a('0x22')](_0x483039)[_0x3a0a('0x23')](function(_0x1468a9){return _0x1468a9;});}return null;};}function removeEntity(_0x49d60d,_0x280022){return function(_0x1d2eac){if(_0x1d2eac){return _0x1d2eac[_0x3a0a('0x24')]()['then'](function(){var _0x3a5955=_0x1d2eac[_0x3a0a('0x25')]({'plain':!![]});var _0x496348='IvrCampaigns';return db[_0x3a0a('0x26')][_0x3a0a('0x24')]({'where':{'type':_0x496348,'resourceId':_0x3a5955['id']}})[_0x3a0a('0x23')](function(){return _0x1d2eac;});})['then'](function(){_0x49d60d[_0x3a0a('0x19')](0xcc)[_0x3a0a('0x1a')]();});}};}function handleEntityNotFound(_0x130ca6,_0x188027){return function(_0x122e65){if(!_0x122e65){_0x130ca6['sendStatus'](0x194);}return _0x122e65;};}function handleError(_0x4a5481,_0x453040){_0x453040=_0x453040||0x1f4;return function(_0x3d01d8){logger['error'](_0x3d01d8['stack']);if(_0x3d01d8[_0x3a0a('0x27')]){delete _0x3d01d8[_0x3a0a('0x27')];}_0x4a5481[_0x3a0a('0x19')](_0x453040)[_0x3a0a('0x28')](_0x3d01d8);};}exports['index']=function(_0x5d7760,_0x38aaa0){var _0x23dd57={},_0x177181={},_0x4c99f9={'count':0x0,'rows':[]};var _0x1418b6=_[_0x3a0a('0x29')](db[_0x3a0a('0x2a')][_0x3a0a('0x2b')],function(_0x10b09f){return{'name':_0x10b09f[_0x3a0a('0x2c')],'type':_0x10b09f[_0x3a0a('0x2d')][_0x3a0a('0x2e')]};});_0x177181[_0x3a0a('0x2f')]=_['map'](_0x1418b6,_0x3a0a('0x27'));_0x177181[_0x3a0a('0x30')]=_[_0x3a0a('0x31')](_0x5d7760[_0x3a0a('0x30')]);_0x177181[_0x3a0a('0x32')]=_['intersection'](_0x177181[_0x3a0a('0x2f')],_0x177181[_0x3a0a('0x30')]);_0x23dd57[_0x3a0a('0x33')]=_[_0x3a0a('0x34')](_0x177181[_0x3a0a('0x2f')],qs[_0x3a0a('0x35')](_0x5d7760['query'][_0x3a0a('0x35')]));_0x23dd57[_0x3a0a('0x33')]=_0x23dd57[_0x3a0a('0x33')][_0x3a0a('0x36')]?_0x23dd57[_0x3a0a('0x33')]:_0x177181[_0x3a0a('0x2f')];if(!_0x5d7760[_0x3a0a('0x30')][_0x3a0a('0x37')]('nolimit')){_0x23dd57[_0x3a0a('0x1d')]=qs[_0x3a0a('0x1d')](_0x5d7760[_0x3a0a('0x30')][_0x3a0a('0x1d')]);_0x23dd57[_0x3a0a('0x1c')]=qs[_0x3a0a('0x1c')](_0x5d7760[_0x3a0a('0x30')][_0x3a0a('0x1c')]);}_0x23dd57['order']=qs[_0x3a0a('0x38')](_0x5d7760[_0x3a0a('0x30')][_0x3a0a('0x38')]);_0x23dd57[_0x3a0a('0x39')]=qs[_0x3a0a('0x32')](_[_0x3a0a('0x3a')](_0x5d7760[_0x3a0a('0x30')],_0x177181[_0x3a0a('0x32')]),_0x1418b6);if(_0x5d7760[_0x3a0a('0x30')]['filter']){_0x23dd57[_0x3a0a('0x39')]=_['merge'](_0x23dd57[_0x3a0a('0x39')],{'$or':_[_0x3a0a('0x29')](_0x1418b6,function(_0x17b5b3){if(_0x17b5b3[_0x3a0a('0x2d')]!=='VIRTUAL'){var _0x425c95={};_0x425c95[_0x17b5b3['name']]={'$like':'%'+_0x5d7760[_0x3a0a('0x30')][_0x3a0a('0x3b')]+'%'};return _0x425c95;}})});}_0x23dd57=_[_0x3a0a('0x3c')]({},_0x23dd57,_0x5d7760[_0x3a0a('0x3d')]);var _0x4d32f8={'where':_0x23dd57[_0x3a0a('0x39')]};return db['Campaign']['count'](_0x4d32f8)[_0x3a0a('0x23')](function(_0x4f9b60){_0x4c99f9['count']=_0x4f9b60;if(_0x5d7760[_0x3a0a('0x30')][_0x3a0a('0x3e')]){_0x23dd57['include']=[{'all':!![]}];}return db[_0x3a0a('0x2a')][_0x3a0a('0x3f')](_0x23dd57);})[_0x3a0a('0x23')](function(_0xd16d0){_0x4c99f9[_0x3a0a('0x40')]=_0xd16d0;return _0x4c99f9;})['then'](respondWithFilteredResult(_0x38aaa0,_0x23dd57))[_0x3a0a('0x41')](handleError(_0x38aaa0,null));};exports[_0x3a0a('0x42')]=function(_0x2b4a6b,_0x34ea81){var _0x45e170={'raw':![],'where':{'id':_0x2b4a6b[_0x3a0a('0x43')]['id']}},_0x34e633={};_0x34e633[_0x3a0a('0x2f')]=_['keys'](db['Campaign'][_0x3a0a('0x2b')]);_0x34e633[_0x3a0a('0x30')]=_[_0x3a0a('0x31')](_0x2b4a6b['query']);_0x34e633[_0x3a0a('0x32')]=_[_0x3a0a('0x34')](_0x34e633[_0x3a0a('0x2f')],_0x34e633[_0x3a0a('0x30')]);_0x45e170['attributes']=_[_0x3a0a('0x34')](_0x34e633['model'],qs[_0x3a0a('0x35')](_0x2b4a6b['query'][_0x3a0a('0x35')]));_0x45e170['attributes']=_0x45e170[_0x3a0a('0x33')][_0x3a0a('0x36')]?_0x45e170['attributes']:_0x34e633['model'];if(_0x2b4a6b[_0x3a0a('0x30')][_0x3a0a('0x3e')]){_0x45e170[_0x3a0a('0x44')]=[{'all':!![]}];}_0x45e170=_[_0x3a0a('0x3c')]({},_0x45e170,_0x2b4a6b[_0x3a0a('0x3d')]);return db[_0x3a0a('0x2a')]['find'](_0x45e170)['then'](handleEntityNotFound(_0x34ea81,null))[_0x3a0a('0x23')](respondWithResult(_0x34ea81,null))[_0x3a0a('0x41')](handleError(_0x34ea81,null));};exports['create']=function(_0x48aa92,_0x1ef695){return db['Campaign'][_0x3a0a('0x45')](_0x48aa92[_0x3a0a('0x46')],{})[_0x3a0a('0x23')](function(_0x34677a){var _0x385f83=_0x48aa92[_0x3a0a('0x47')]['get']({'plain':!![]});if(!_0x385f83)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x385f83[_0x3a0a('0x48')]===_0x3a0a('0x47')){var _0x201dca=_0x34677a[_0x3a0a('0x25')]({'plain':!![]});var _0x26f46c='IvrCampaigns';return db[_0x3a0a('0x49')][_0x3a0a('0x4a')]({'where':{'name':_0x26f46c,'userProfileId':_0x385f83['userProfileId']},'raw':!![]})['then'](function(_0x37d62d){if(_0x37d62d&&_0x37d62d[_0x3a0a('0x4b')]===0x0){return db[_0x3a0a('0x26')][_0x3a0a('0x45')]({'name':_0x201dca[_0x3a0a('0x27')],'resourceId':_0x201dca['id'],'type':_0x37d62d[_0x3a0a('0x27')],'sectionId':_0x37d62d['id']},{})[_0x3a0a('0x23')](function(){return _0x34677a;});}else{return _0x34677a;}})['catch'](function(_0x2905b7){logger[_0x3a0a('0x4c')](_0x3a0a('0x4d'),_0x2905b7);throw _0x2905b7;});}return _0x34677a;})[_0x3a0a('0x23')](respondWithResult(_0x1ef695,0xc9))[_0x3a0a('0x41')](handleError(_0x1ef695,null));};exports[_0x3a0a('0x4e')]=function(_0x93e846,_0x2ebdec){var _0x2cc478={'where':{'id':_0x93e846[_0x3a0a('0x43')]['id']}},_0x3fe96a={};_0x3fe96a[_0x3a0a('0x2f')]=_[_0x3a0a('0x31')](db['Campaign'][_0x3a0a('0x2b')]);_0x2cc478[_0x3a0a('0x33')]=_[_0x3a0a('0x34')](_0x3fe96a['model'],qs['fields'](_0x93e846[_0x3a0a('0x30')][_0x3a0a('0x35')]));_0x2cc478[_0x3a0a('0x33')]=_0x2cc478['attributes']['length']?_0x2cc478[_0x3a0a('0x33')]:_0x3fe96a[_0x3a0a('0x2f')];if(_0x93e846[_0x3a0a('0x30')]['includeAll']){_0x2cc478[_0x3a0a('0x44')]=[{'all':!![]}];}_0x2cc478=_[_0x3a0a('0x3c')]({},_0x2cc478,_0x93e846[_0x3a0a('0x3d')]);return db[_0x3a0a('0x2a')][_0x3a0a('0x4a')](_0x2cc478)['then'](handleEntityNotFound(_0x2ebdec,null))[_0x3a0a('0x23')](function(_0x5d3081){if(_0x5d3081){var _0x40df97=_0x5d3081[_0x3a0a('0x25')]({'plain':!![]});_0x40df97=qs[_0x3a0a('0x4f')](_0x40df97,['id',_0x3a0a('0x50'),'updatedAt']);_0x93e846[_0x3a0a('0x46')]=_['omit'](_0x93e846[_0x3a0a('0x46')],['id',_0x3a0a('0x50'),_0x3a0a('0x51')]);return db[_0x3a0a('0x2a')][_0x3a0a('0x45')](_[_0x3a0a('0x3c')](_0x40df97,_0x93e846[_0x3a0a('0x46')]),{'include':_0x93e846[_0x3a0a('0x30')][_0x3a0a('0x3e')]?[{'all':!![]}]:undefined})[_0x3a0a('0x23')](function(_0x25a7c8){var _0x8e7485=_0x93e846[_0x3a0a('0x47')][_0x3a0a('0x25')]({'plain':!![]});if(!_0x8e7485)throw new Error(_0x3a0a('0x52'));if(_0x8e7485[_0x3a0a('0x48')]===_0x3a0a('0x47')){var _0x3c8166=_0x25a7c8[_0x3a0a('0x25')]({'plain':!![]});var _0x182ba6='IvrCampaigns';return db[_0x3a0a('0x49')][_0x3a0a('0x4a')]({'where':{'name':_0x182ba6,'userProfileId':_0x8e7485[_0x3a0a('0x53')]},'raw':!![]})[_0x3a0a('0x23')](function(_0x2c807a){if(_0x2c807a&&_0x2c807a[_0x3a0a('0x4b')]===0x0){return db[_0x3a0a('0x26')][_0x3a0a('0x45')]({'name':_0x3c8166[_0x3a0a('0x27')],'resourceId':_0x3c8166['id'],'type':_0x2c807a[_0x3a0a('0x27')],'sectionId':_0x2c807a['id']},{})[_0x3a0a('0x23')](function(){return _0x25a7c8;});}else{return _0x25a7c8;}})[_0x3a0a('0x41')](function(_0x1a3227){logger[_0x3a0a('0x4c')](_0x3a0a('0x4d'),_0x1a3227);throw _0x1a3227;});}return _0x25a7c8;});}})['then'](respondWithResult(_0x2ebdec,0xc9))['catch'](handleError(_0x2ebdec,null));};exports['update']=function(_0x21b82c,_0x4ba52b){if(_0x21b82c[_0x3a0a('0x46')]['id']){delete _0x21b82c['body']['id'];}return db[_0x3a0a('0x2a')]['find']({'where':{'id':_0x21b82c[_0x3a0a('0x43')]['id']}})[_0x3a0a('0x23')](handleEntityNotFound(_0x4ba52b,null))['then'](saveUpdates(_0x21b82c[_0x3a0a('0x46')],null))['then'](respondWithResult(_0x4ba52b,null))[_0x3a0a('0x41')](handleError(_0x4ba52b,null));};exports[_0x3a0a('0x24')]=function(_0x2474ff,_0x2b0507){return db[_0x3a0a('0x2a')][_0x3a0a('0x4a')]({'where':{'id':_0x2474ff['params']['id']}})[_0x3a0a('0x23')](handleEntityNotFound(_0x2b0507,null))[_0x3a0a('0x23')](removeEntity(_0x2b0507,null))[_0x3a0a('0x41')](handleError(_0x2b0507,null));};exports[_0x3a0a('0x54')]=function(_0x476e45,_0x34f09a,_0x23836c){var _0x5404a9={'raw':!![],'where':{}};var _0x53f68e={};var _0x183e88={'count':0x0,'rows':[]};return db[_0x3a0a('0x2a')]['findOne']({'where':{'id':_0x476e45[_0x3a0a('0x43')]['id']}})[_0x3a0a('0x23')](handleEntityNotFound(_0x34f09a,null))['then'](function(_0x535379){if(_0x535379){_0x53f68e['model']=_[_0x3a0a('0x31')](db[_0x3a0a('0x55')]['rawAttributes']);_0x53f68e[_0x3a0a('0x30')]=_['keys'](_0x476e45[_0x3a0a('0x30')]);_0x53f68e[_0x3a0a('0x32')]=_[_0x3a0a('0x34')](_0x53f68e[_0x3a0a('0x2f')],_0x53f68e[_0x3a0a('0x30')]);_0x5404a9[_0x3a0a('0x33')]=_[_0x3a0a('0x34')](_0x53f68e[_0x3a0a('0x2f')],qs['fields'](_0x476e45['query']['fields']));_0x5404a9[_0x3a0a('0x33')]=_0x5404a9[_0x3a0a('0x33')]['length']?_0x5404a9[_0x3a0a('0x33')]:_0x53f68e[_0x3a0a('0x2f')];if(!_0x476e45[_0x3a0a('0x30')][_0x3a0a('0x37')](_0x3a0a('0x56'))){_0x5404a9['limit']=qs[_0x3a0a('0x1d')](_0x476e45[_0x3a0a('0x30')][_0x3a0a('0x1d')]);_0x5404a9[_0x3a0a('0x1c')]=qs['offset'](_0x476e45[_0x3a0a('0x30')][_0x3a0a('0x1c')]);}_0x5404a9[_0x3a0a('0x57')]=qs[_0x3a0a('0x38')](_0x476e45['query'][_0x3a0a('0x38')]);_0x5404a9[_0x3a0a('0x39')]=qs[_0x3a0a('0x32')](_[_0x3a0a('0x3a')](_0x476e45[_0x3a0a('0x30')],_0x53f68e['filters']));_0x5404a9[_0x3a0a('0x39')][_0x3a0a('0x58')]=_0x535379['id'];if(_0x476e45[_0x3a0a('0x30')][_0x3a0a('0x3b')]){_0x5404a9[_0x3a0a('0x39')]=_['merge'](_0x5404a9[_0x3a0a('0x39')],{'$or':_[_0x3a0a('0x29')](_0x5404a9['attributes'],function(_0x3872a3){var _0x27187b={};_0x27187b[_0x3872a3]={'$like':'%'+_0x476e45[_0x3a0a('0x30')]['filter']+'%'};return _0x27187b;})});}_0x5404a9=_[_0x3a0a('0x3c')]({},_0x5404a9,_0x476e45[_0x3a0a('0x3d')]);return db['CmHopper'][_0x3a0a('0x1e')]({'where':_0x5404a9[_0x3a0a('0x39')]})['then'](function(_0x226331){_0x183e88[_0x3a0a('0x1e')]=_0x226331;if(_0x476e45[_0x3a0a('0x30')]['includeAll']){_0x5404a9['include']=[{'all':!![]}];}return db[_0x3a0a('0x55')][_0x3a0a('0x3f')](_0x5404a9);})[_0x3a0a('0x23')](function(_0xfa7c6a){_0x183e88[_0x3a0a('0x40')]=_0xfa7c6a;return _0x183e88;});}})[_0x3a0a('0x23')](respondWithFilteredResult(_0x34f09a,_0x5404a9))[_0x3a0a('0x41')](handleError(_0x34f09a,null));};exports['getHopperHistories']=function(_0x37521a,_0x27315d,_0x426ae5){var _0x4a9744={'raw':!![],'where':{}};var _0x26b9a2={};var _0x489e7f={'count':0x0,'rows':[]};return db[_0x3a0a('0x2a')][_0x3a0a('0x59')]({'where':{'id':_0x37521a[_0x3a0a('0x43')]['id']}})[_0x3a0a('0x23')](handleEntityNotFound(_0x27315d,null))['then'](function(_0x479733){if(_0x479733){_0x26b9a2['model']=_['keys'](db['CmHopperHistory'][_0x3a0a('0x2b')]);_0x26b9a2[_0x3a0a('0x30')]=_[_0x3a0a('0x31')](_0x37521a[_0x3a0a('0x30')]);_0x26b9a2[_0x3a0a('0x32')]=_['intersection'](_0x26b9a2[_0x3a0a('0x2f')],_0x26b9a2[_0x3a0a('0x30')]);_0x4a9744[_0x3a0a('0x33')]=_[_0x3a0a('0x34')](_0x26b9a2[_0x3a0a('0x2f')],qs[_0x3a0a('0x35')](_0x37521a[_0x3a0a('0x30')][_0x3a0a('0x35')]));_0x4a9744[_0x3a0a('0x33')]=_0x4a9744[_0x3a0a('0x33')][_0x3a0a('0x36')]?_0x4a9744[_0x3a0a('0x33')]:_0x26b9a2[_0x3a0a('0x2f')];if(!_0x37521a[_0x3a0a('0x30')][_0x3a0a('0x37')](_0x3a0a('0x56'))){_0x4a9744[_0x3a0a('0x1d')]=qs[_0x3a0a('0x1d')](_0x37521a['query'][_0x3a0a('0x1d')]);_0x4a9744['offset']=qs[_0x3a0a('0x1c')](_0x37521a[_0x3a0a('0x30')]['offset']);}_0x4a9744[_0x3a0a('0x57')]=qs[_0x3a0a('0x38')](_0x37521a[_0x3a0a('0x30')][_0x3a0a('0x38')]);_0x4a9744[_0x3a0a('0x39')]=qs['filters'](_[_0x3a0a('0x3a')](_0x37521a[_0x3a0a('0x30')],_0x26b9a2[_0x3a0a('0x32')]));_0x4a9744[_0x3a0a('0x39')][_0x3a0a('0x58')]=_0x479733['id'];if(_0x37521a['query'][_0x3a0a('0x3b')]){_0x4a9744['where']=_[_0x3a0a('0x3c')](_0x4a9744[_0x3a0a('0x39')],{'$or':_['map'](_0x4a9744[_0x3a0a('0x33')],function(_0x5beab5){var _0x46f2d0={};_0x46f2d0[_0x5beab5]={'$like':'%'+_0x37521a[_0x3a0a('0x30')][_0x3a0a('0x3b')]+'%'};return _0x46f2d0;})});}_0x4a9744=_[_0x3a0a('0x3c')]({},_0x4a9744,_0x37521a[_0x3a0a('0x3d')]);return db[_0x3a0a('0x5a')][_0x3a0a('0x1e')]({'where':_0x4a9744[_0x3a0a('0x39')]})[_0x3a0a('0x23')](function(_0x55f6af){_0x489e7f[_0x3a0a('0x1e')]=_0x55f6af;if(_0x37521a[_0x3a0a('0x30')]['includeAll']){_0x4a9744['include']=[{'all':!![]}];}return db['CmHopperHistory'][_0x3a0a('0x3f')](_0x4a9744);})['then'](function(_0x2f1415){_0x489e7f['rows']=_0x2f1415;return _0x489e7f;});}})[_0x3a0a('0x23')](respondWithFilteredResult(_0x27315d,_0x4a9744))['catch'](handleError(_0x27315d,null));};exports[_0x3a0a('0x5b')]=function(_0x1aa7a1,_0x23dfb2,_0x3bf50a){var _0x2f6c41={'raw':!![],'where':{}};var _0x471d3a={};var _0x374390={'count':0x0,'rows':[]};return db[_0x3a0a('0x2a')][_0x3a0a('0x59')]({'where':{'id':_0x1aa7a1[_0x3a0a('0x43')]['id']}})['then'](handleEntityNotFound(_0x23dfb2,null))[_0x3a0a('0x23')](function(_0x41fe0b){if(_0x41fe0b){_0x471d3a[_0x3a0a('0x2f')]=_[_0x3a0a('0x31')](db['CmHopperFinal'][_0x3a0a('0x2b')]);_0x471d3a['query']=_[_0x3a0a('0x31')](_0x1aa7a1[_0x3a0a('0x30')]);_0x471d3a['filters']=_[_0x3a0a('0x34')](_0x471d3a[_0x3a0a('0x2f')],_0x471d3a['query']);_0x2f6c41[_0x3a0a('0x33')]=_['intersection'](_0x471d3a[_0x3a0a('0x2f')],qs[_0x3a0a('0x35')](_0x1aa7a1['query'][_0x3a0a('0x35')]));_0x2f6c41[_0x3a0a('0x33')]=_0x2f6c41[_0x3a0a('0x33')]['length']?_0x2f6c41[_0x3a0a('0x33')]:_0x471d3a[_0x3a0a('0x2f')];if(!_0x1aa7a1[_0x3a0a('0x30')]['hasOwnProperty'](_0x3a0a('0x56'))){_0x2f6c41[_0x3a0a('0x1d')]=qs[_0x3a0a('0x1d')](_0x1aa7a1[_0x3a0a('0x30')][_0x3a0a('0x1d')]);_0x2f6c41[_0x3a0a('0x1c')]=qs[_0x3a0a('0x1c')](_0x1aa7a1[_0x3a0a('0x30')]['offset']);}_0x2f6c41['order']=qs[_0x3a0a('0x38')](_0x1aa7a1[_0x3a0a('0x30')][_0x3a0a('0x38')]);_0x2f6c41[_0x3a0a('0x39')]=qs[_0x3a0a('0x32')](_[_0x3a0a('0x3a')](_0x1aa7a1[_0x3a0a('0x30')],_0x471d3a[_0x3a0a('0x32')]));_0x2f6c41[_0x3a0a('0x39')][_0x3a0a('0x58')]=_0x41fe0b['id'];if(_0x1aa7a1[_0x3a0a('0x30')][_0x3a0a('0x3b')]){_0x2f6c41[_0x3a0a('0x39')]=_[_0x3a0a('0x3c')](_0x2f6c41[_0x3a0a('0x39')],{'$or':_[_0x3a0a('0x29')](_0x2f6c41[_0x3a0a('0x33')],function(_0x5c27d0){var _0x50cada={};_0x50cada[_0x5c27d0]={'$like':'%'+_0x1aa7a1[_0x3a0a('0x30')][_0x3a0a('0x3b')]+'%'};return _0x50cada;})});}_0x2f6c41=_['merge']({},_0x2f6c41,_0x1aa7a1[_0x3a0a('0x3d')]);return db[_0x3a0a('0x5c')][_0x3a0a('0x1e')]({'where':_0x2f6c41['where']})[_0x3a0a('0x23')](function(_0x1bd9c6){_0x374390[_0x3a0a('0x1e')]=_0x1bd9c6;if(_0x1aa7a1['query'][_0x3a0a('0x3e')]){_0x2f6c41['include']=[{'all':!![]}];}return db[_0x3a0a('0x5c')]['findAll'](_0x2f6c41);})[_0x3a0a('0x23')](function(_0x13ea2a){_0x374390['rows']=_0x13ea2a;return _0x374390;});}})[_0x3a0a('0x23')](respondWithFilteredResult(_0x23dfb2,_0x2f6c41))['catch'](handleError(_0x23dfb2,null));};exports[_0x3a0a('0x5d')]=function(_0x26e790,_0x384dde,_0x33a254){var _0x2d828a={'raw':!![],'where':{}};var _0x389af5={};var _0x320ef5={'count':0x0,'rows':[]};return db[_0x3a0a('0x2a')][_0x3a0a('0x59')]({'where':{'id':_0x26e790[_0x3a0a('0x43')]['id']}})['then'](handleEntityNotFound(_0x384dde,null))[_0x3a0a('0x23')](function(_0x26113f){if(_0x26113f){_0x389af5[_0x3a0a('0x2f')]=_['keys'](db[_0x3a0a('0x5e')][_0x3a0a('0x2b')]);_0x389af5[_0x3a0a('0x30')]=_[_0x3a0a('0x31')](_0x26e790['query']);_0x389af5[_0x3a0a('0x32')]=_[_0x3a0a('0x34')](_0x389af5['model'],_0x389af5[_0x3a0a('0x30')]);_0x2d828a[_0x3a0a('0x33')]=_[_0x3a0a('0x34')](_0x389af5['model'],qs[_0x3a0a('0x35')](_0x26e790['query'][_0x3a0a('0x35')]));_0x2d828a[_0x3a0a('0x33')]=_0x2d828a[_0x3a0a('0x33')][_0x3a0a('0x36')]?_0x2d828a[_0x3a0a('0x33')]:_0x389af5[_0x3a0a('0x2f')];if(!_0x26e790[_0x3a0a('0x30')]['hasOwnProperty']('nolimit')){_0x2d828a[_0x3a0a('0x1d')]=qs[_0x3a0a('0x1d')](_0x26e790['query']['limit']);_0x2d828a['offset']=qs[_0x3a0a('0x1c')](_0x26e790['query'][_0x3a0a('0x1c')]);}_0x2d828a['order']=qs[_0x3a0a('0x38')](_0x26e790[_0x3a0a('0x30')][_0x3a0a('0x38')]);_0x2d828a['where']=qs[_0x3a0a('0x32')](_[_0x3a0a('0x3a')](_0x26e790[_0x3a0a('0x30')],_0x389af5[_0x3a0a('0x32')]));_0x2d828a[_0x3a0a('0x39')]['CampaignId']=_0x26113f['id'];if(_0x26e790['query']['filter']){_0x2d828a[_0x3a0a('0x39')]=_[_0x3a0a('0x3c')](_0x2d828a[_0x3a0a('0x39')],{'$or':_[_0x3a0a('0x29')](_0x2d828a[_0x3a0a('0x33')],function(_0x40a39f){var _0x529090={};_0x529090[_0x40a39f]={'$like':'%'+_0x26e790[_0x3a0a('0x30')][_0x3a0a('0x3b')]+'%'};return _0x529090;})});}_0x2d828a=_['merge']({},_0x2d828a,_0x26e790[_0x3a0a('0x3d')]);return db['CmHopperBlack']['count']({'where':_0x2d828a[_0x3a0a('0x39')]})[_0x3a0a('0x23')](function(_0x2fcc06){_0x320ef5['count']=_0x2fcc06;if(_0x26e790[_0x3a0a('0x30')][_0x3a0a('0x3e')]){_0x2d828a[_0x3a0a('0x44')]=[{'all':!![]}];}return db[_0x3a0a('0x5e')]['findAll'](_0x2d828a);})[_0x3a0a('0x23')](function(_0x36d289){_0x320ef5[_0x3a0a('0x40')]=_0x36d289;return _0x320ef5;});}})[_0x3a0a('0x23')](respondWithFilteredResult(_0x384dde,_0x2d828a))['catch'](handleError(_0x384dde,null));};exports[_0x3a0a('0x5f')]=function(_0x2fcdc6,_0x257d2f,_0x3f9d67){var _0x448cac={};var _0x51a37a={};var _0x24e245;var _0x1f2e1a;return db['Campaign'][_0x3a0a('0x59')]({'where':{'id':_0x2fcdc6[_0x3a0a('0x43')]['id']}})[_0x3a0a('0x23')](handleEntityNotFound(_0x257d2f,null))[_0x3a0a('0x23')](function(_0x5e96ee){if(_0x5e96ee){_0x24e245=_0x5e96ee;_0x51a37a['model']=_[_0x3a0a('0x31')](db[_0x3a0a('0x60')][_0x3a0a('0x2b')]);_0x51a37a['query']=_['keys'](_0x2fcdc6[_0x3a0a('0x30')]);_0x51a37a['filters']=_['intersection'](_0x51a37a['model'],_0x51a37a['query']);_0x448cac['attributes']=_['intersection'](_0x51a37a['model'],qs['fields'](_0x2fcdc6[_0x3a0a('0x30')][_0x3a0a('0x35')]));_0x448cac['attributes']=_0x448cac[_0x3a0a('0x33')]['length']?_0x448cac['attributes']:_0x51a37a[_0x3a0a('0x2f')];_0x448cac[_0x3a0a('0x57')]=qs['sort'](_0x2fcdc6[_0x3a0a('0x30')][_0x3a0a('0x38')]);_0x448cac['where']=qs['filters'](_[_0x3a0a('0x3a')](_0x2fcdc6[_0x3a0a('0x30')],_0x51a37a['filters']));if(_0x2fcdc6[_0x3a0a('0x30')][_0x3a0a('0x3b')]){_0x448cac[_0x3a0a('0x39')]=_[_0x3a0a('0x3c')](_0x448cac[_0x3a0a('0x39')],{'$or':_[_0x3a0a('0x29')](_0x448cac[_0x3a0a('0x33')],function(_0xc42873){var _0x4ef309={};_0x4ef309[_0xc42873]={'$like':'%'+_0x2fcdc6[_0x3a0a('0x30')][_0x3a0a('0x3b')]+'%'};return _0x4ef309;})});}_0x448cac=_[_0x3a0a('0x3c')]({},_0x448cac,_0x2fcdc6['options']);return _0x24e245[_0x3a0a('0x5f')](_0x448cac);}})['then'](function(_0x50b6bb){if(_0x50b6bb){_0x1f2e1a=_0x50b6bb[_0x3a0a('0x36')];if(!_0x2fcdc6[_0x3a0a('0x30')]['hasOwnProperty'](_0x3a0a('0x56'))){_0x448cac[_0x3a0a('0x1d')]=qs[_0x3a0a('0x1d')](_0x2fcdc6[_0x3a0a('0x30')][_0x3a0a('0x1d')]);_0x448cac[_0x3a0a('0x1c')]=qs[_0x3a0a('0x1c')](_0x2fcdc6[_0x3a0a('0x30')][_0x3a0a('0x1c')]);}return _0x24e245[_0x3a0a('0x5f')](_0x448cac);}})[_0x3a0a('0x23')](function(_0x22efd9){if(_0x22efd9){return _0x22efd9?{'count':_0x1f2e1a,'rows':_0x22efd9}:null;}})[_0x3a0a('0x23')](respondWithResult(_0x257d2f,null))[_0x3a0a('0x41')](handleError(_0x257d2f,null));};exports['addLists']=function(_0x6dda21,_0x1dcee2,_0x4eb4be){var _0x1dc909,_0x10192d;var _0x11f067=[];var _0xdb9665=moment()[_0x3a0a('0x61')]('YYYY-MM-DD\x20HH:mm:ss');return db[_0x3a0a('0x2a')][_0x3a0a('0x4a')]({'where':{'id':_0x6dda21[_0x3a0a('0x43')]['id']}})[_0x3a0a('0x23')](handleEntityNotFound(_0x1dcee2,null))['then'](function(_0x211cfd){if(_0x211cfd){_0x10192d=_0x211cfd;return _0x211cfd[_0x3a0a('0x62')](_0x6dda21['body'][_0x3a0a('0x63')],_[_0x3a0a('0x4f')](_0x6dda21[_0x3a0a('0x46')],[_0x3a0a('0x63'),'id'])||{});}return null;})[_0x3a0a('0x64')](function(_0x5edd19){var _0x488779;var _0x225721;_0x1dc909=_0x5edd19||[];var _0x5f55c5=[];if(_0x5edd19){for(var _0x113fb9=0x0;_0x113fb9<_0x5edd19['length'];_0x113fb9+=0x1){var _0x1316e8=_0x5edd19[_0x113fb9][_0x3a0a('0x25')]({'plain':!![]});_0x10192d['dialCheckDuplicateType']=_0x6dda21[_0x3a0a('0x46')]['dialCheckDuplicateType']?_0x6dda21['body'][_0x3a0a('0x65')]:_0x10192d[_0x3a0a('0x65')];switch(_0x10192d[_0x3a0a('0x65')]){case _0x3a0a('0x66'):_0x488779=squel[_0x3a0a('0x67')]()[_0x3a0a('0x68')](_0x3a0a('0x69'))[_0x3a0a('0x6a')]([_0x3a0a('0x6b'),_0x3a0a('0x6c'),_0x3a0a('0x6d'),_0x3a0a('0x6e'),_0x3a0a('0x58'),_0x3a0a('0x50'),'updatedAt'],squel[_0x3a0a('0x6f')]()[_0x3a0a('0x70')](_0x3a0a('0x6b'),'phone')[_0x3a0a('0x70')](_0x3a0a('0x71'),_0x3a0a('0x6c'))['field']('id',_0x3a0a('0x6d'))[_0x3a0a('0x70')](_0x1316e8[_0x3a0a('0x72')]['toString'](),_0x3a0a('0x6e'))[_0x3a0a('0x70')](_0x6dda21[_0x3a0a('0x43')]['id'][_0x3a0a('0x73')](),_0x3a0a('0x58'))[_0x3a0a('0x70')]('\x27'+_0xdb9665+'\x27',_0x3a0a('0x50'))[_0x3a0a('0x70')]('\x27'+_0xdb9665+'\x27',_0x3a0a('0x51'))[_0x3a0a('0x74')](_0x3a0a('0x75'))[_0x3a0a('0x39')](_0x3a0a('0x76'))[_0x3a0a('0x39')](_0x3a0a('0x77'),_0x1316e8['CmListId']['toString']())[_0x3a0a('0x39')](_0x3a0a('0x78'))[_0x3a0a('0x39')](_0x3a0a('0x79'),squel[_0x3a0a('0x6f')]()[_0x3a0a('0x70')](_0x3a0a('0x7a'))[_0x3a0a('0x74')](_0x3a0a('0x7b'))['where'](_0x3a0a('0x7c'),_0x6dda21[_0x3a0a('0x43')]['id'][_0x3a0a('0x73')]()))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0x3a0a('0x6f')]()[_0x3a0a('0x70')]('COALESCE(phone,\x27\x27)')[_0x3a0a('0x74')]('cm_hopper')['where'](_0x3a0a('0x7c'),_0x6dda21['params']['id'][_0x3a0a('0x73')]())))[_0x3a0a('0x73')]();break;case _0x3a0a('0x7d'):_0x488779=squel[_0x3a0a('0x67')]()[_0x3a0a('0x68')](_0x3a0a('0x69'))[_0x3a0a('0x6a')]([_0x3a0a('0x6b'),_0x3a0a('0x6c'),'ContactId','ListId',_0x3a0a('0x58'),_0x3a0a('0x50'),_0x3a0a('0x51')],squel[_0x3a0a('0x6f')]()['field'](_0x3a0a('0x6b'),_0x3a0a('0x6b'))[_0x3a0a('0x70')](_0x3a0a('0x71'),_0x3a0a('0x6c'))[_0x3a0a('0x70')]('id',_0x3a0a('0x6d'))['field'](_0x1316e8[_0x3a0a('0x72')][_0x3a0a('0x73')](),_0x3a0a('0x6e'))[_0x3a0a('0x70')](_0x6dda21[_0x3a0a('0x43')]['id'][_0x3a0a('0x73')](),_0x3a0a('0x58'))[_0x3a0a('0x70')]('\x27'+_0xdb9665+'\x27',_0x3a0a('0x50'))[_0x3a0a('0x70')]('\x27'+_0xdb9665+'\x27',_0x3a0a('0x51'))[_0x3a0a('0x74')](_0x3a0a('0x75'))[_0x3a0a('0x39')](_0x3a0a('0x76'))['where']('ListId\x20=\x20?',_0x1316e8[_0x3a0a('0x72')][_0x3a0a('0x73')]())[_0x3a0a('0x39')]('phone\x20IS\x20NOT\x20NULL')[_0x3a0a('0x39')](_0x3a0a('0x79'),squel['select']()['field'](_0x3a0a('0x7e'))[_0x3a0a('0x74')](_0x3a0a('0x69'))[_0x3a0a('0x39')](_0x3a0a('0x7c'),_0x6dda21[_0x3a0a('0x43')]['id'][_0x3a0a('0x73')]())))[_0x3a0a('0x73')]();break;default:_0x488779=squel[_0x3a0a('0x67')]()['into']('cm_hopper')['fromQuery']([_0x3a0a('0x6b'),_0x3a0a('0x6c'),'ContactId',_0x3a0a('0x6e'),_0x3a0a('0x58'),_0x3a0a('0x50'),_0x3a0a('0x51')],squel[_0x3a0a('0x6f')]()[_0x3a0a('0x70')]('phone',_0x3a0a('0x6b'))[_0x3a0a('0x70')]('NOW()',_0x3a0a('0x6c'))[_0x3a0a('0x70')]('id',_0x3a0a('0x6d'))['field'](_0x1316e8[_0x3a0a('0x72')][_0x3a0a('0x73')](),_0x3a0a('0x6e'))[_0x3a0a('0x70')](_0x6dda21['params']['id'][_0x3a0a('0x73')](),'CampaignId')[_0x3a0a('0x70')]('\x27'+_0xdb9665+'\x27',_0x3a0a('0x50'))[_0x3a0a('0x70')]('\x27'+_0xdb9665+'\x27','updatedAt')[_0x3a0a('0x74')](_0x3a0a('0x75'))['where'](_0x3a0a('0x76'))[_0x3a0a('0x39')](_0x3a0a('0x77'),_0x1316e8[_0x3a0a('0x72')][_0x3a0a('0x73')]())[_0x3a0a('0x39')]('phone\x20IS\x20NOT\x20NULL'))[_0x3a0a('0x73')]();}_0x225721=squel['insert']()[_0x3a0a('0x68')](_0x3a0a('0x7f'))['fromQuery']([_0x3a0a('0x80'),_0x3a0a('0x6c'),_0x3a0a('0x6b'),_0x3a0a('0x81'),'createdAt',_0x3a0a('0x51')],squel[_0x3a0a('0x6f')]()[_0x3a0a('0x70')](_0x3a0a('0x82'),'id')[_0x3a0a('0x70')](_0x3a0a('0x71'),_0x3a0a('0x6c'))[_0x3a0a('0x70')](_0x3a0a('0x83'),'phone')['field'](_0x3a0a('0x84'),'OrderBy')['field']('\x27'+_0xdb9665+'\x27',_0x3a0a('0x50'))[_0x3a0a('0x70')]('\x27'+_0xdb9665+'\x27',_0x3a0a('0x51'))[_0x3a0a('0x74')]('cm_contact_has_items','ci')[_0x3a0a('0x85')](_0x3a0a('0x69'),'h','h.ContactId\x20=\x20ci.CmContactId')[_0x3a0a('0x39')]('h.ListId\x20=\x20?',_0x1316e8[_0x3a0a('0x72')]['toString']())[_0x3a0a('0x39')]('h.CampaignId=?',_0x6dda21[_0x3a0a('0x43')]['id']['toString']())[_0x3a0a('0x39')]('h.createdAt\x20=\x20?',_0xdb9665))[_0x3a0a('0x73')]();_0x5f55c5['push'](db[_0x3a0a('0x86')][_0x3a0a('0x30')](_0x488779));_0x11f067[_0x3a0a('0x87')](db[_0x3a0a('0x86')][_0x3a0a('0x30')](_0x225721));}return BPromise['all'](_0x5f55c5);}})[_0x3a0a('0x23')](function(){return BPromise[_0x3a0a('0x88')](_0x11f067);})['then'](function(){return _0x1dc909;})[_0x3a0a('0x23')](respondWithResult(_0x1dcee2,null))[_0x3a0a('0x41')](handleError(_0x1dcee2,null));};exports[_0x3a0a('0x89')]=function(_0x16cd16,_0x34890f,_0x4ecc8d){return db[_0x3a0a('0x2a')][_0x3a0a('0x4a')]({'where':{'id':_0x16cd16[_0x3a0a('0x43')]['id']}})['then'](handleEntityNotFound(_0x34890f,null))[_0x3a0a('0x23')](function(_0x3706c5){if(_0x3706c5){return _0x3706c5[_0x3a0a('0x89')](_0x16cd16['query'][_0x3a0a('0x63')]);}})[_0x3a0a('0x23')](function(_0x516769){if(_0x516769){return db[_0x3a0a('0x55')][_0x3a0a('0x24')]({'where':{'ListId':_0x16cd16[_0x3a0a('0x30')][_0x3a0a('0x63')],'CampaignId':_0x16cd16[_0x3a0a('0x43')]['id']}})[_0x3a0a('0x23')](function(){return _0x516769;});}})[_0x3a0a('0x23')](respondWithStatusCode(_0x34890f,null))['catch'](handleError(_0x34890f,null));};exports[_0x3a0a('0x8a')]=function(_0x20ca4c,_0x3a0792,_0x190975){var _0x2385f9={};var _0x2751d3={};var _0x84b6db;var _0x7ccdaf;return db[_0x3a0a('0x2a')]['findOne']({'where':{'id':_0x20ca4c[_0x3a0a('0x43')]['id']}})[_0x3a0a('0x23')](handleEntityNotFound(_0x3a0792,null))[_0x3a0a('0x23')](function(_0x12a796){if(_0x12a796){_0x84b6db=_0x12a796;_0x2751d3[_0x3a0a('0x2f')]=_[_0x3a0a('0x31')](db[_0x3a0a('0x60')]['rawAttributes']);_0x2751d3[_0x3a0a('0x30')]=_[_0x3a0a('0x31')](_0x20ca4c[_0x3a0a('0x30')]);_0x2751d3[_0x3a0a('0x32')]=_[_0x3a0a('0x34')](_0x2751d3[_0x3a0a('0x2f')],_0x2751d3[_0x3a0a('0x30')]);_0x2385f9['attributes']=_[_0x3a0a('0x34')](_0x2751d3[_0x3a0a('0x2f')],qs[_0x3a0a('0x35')](_0x20ca4c[_0x3a0a('0x30')][_0x3a0a('0x35')]));_0x2385f9[_0x3a0a('0x33')]=_0x2385f9[_0x3a0a('0x33')][_0x3a0a('0x36')]?_0x2385f9['attributes']:_0x2751d3[_0x3a0a('0x2f')];_0x2385f9[_0x3a0a('0x57')]=qs[_0x3a0a('0x38')](_0x20ca4c['query'][_0x3a0a('0x38')]);_0x2385f9['where']=qs['filters'](_[_0x3a0a('0x3a')](_0x20ca4c['query'],_0x2751d3[_0x3a0a('0x32')]));if(_0x20ca4c[_0x3a0a('0x30')][_0x3a0a('0x3b')]){_0x2385f9[_0x3a0a('0x39')]=_[_0x3a0a('0x3c')](_0x2385f9[_0x3a0a('0x39')],{'$or':_['map'](_0x2385f9['attributes'],function(_0x15ad10){var _0x3c9447={};_0x3c9447[_0x15ad10]={'$like':'%'+_0x20ca4c['query'][_0x3a0a('0x3b')]+'%'};return _0x3c9447;})});}_0x2385f9=_[_0x3a0a('0x3c')]({},_0x2385f9,_0x20ca4c[_0x3a0a('0x3d')]);return _0x84b6db[_0x3a0a('0x8a')](_0x2385f9);}})[_0x3a0a('0x23')](function(_0x146304){if(_0x146304){_0x7ccdaf=_0x146304[_0x3a0a('0x36')];if(!_0x20ca4c[_0x3a0a('0x30')][_0x3a0a('0x37')](_0x3a0a('0x56'))){_0x2385f9[_0x3a0a('0x1d')]=qs[_0x3a0a('0x1d')](_0x20ca4c[_0x3a0a('0x30')][_0x3a0a('0x1d')]);_0x2385f9[_0x3a0a('0x1c')]=qs[_0x3a0a('0x1c')](_0x20ca4c[_0x3a0a('0x30')][_0x3a0a('0x1c')]);}return _0x84b6db[_0x3a0a('0x8a')](_0x2385f9);}})[_0x3a0a('0x23')](function(_0xeb71a7){if(_0xeb71a7){return _0xeb71a7?{'count':_0x7ccdaf,'rows':_0xeb71a7}:null;}})['then'](respondWithResult(_0x3a0792,null))[_0x3a0a('0x41')](handleError(_0x3a0792,null));};exports[_0x3a0a('0x8b')]=function(_0x2de985,_0x3c402c,_0x230670){var _0x4d1ee3,_0x423d6d;var _0x4eb5df=[];var _0x368231=moment()[_0x3a0a('0x61')](_0x3a0a('0x8c'));return db[_0x3a0a('0x2a')][_0x3a0a('0x4a')]({'where':{'id':_0x2de985[_0x3a0a('0x43')]['id']}})[_0x3a0a('0x23')](handleEntityNotFound(_0x3c402c,null))['then'](function(_0x58a7b9){if(_0x58a7b9){_0x423d6d=_0x58a7b9;return _0x58a7b9[_0x3a0a('0x8b')](_0x2de985[_0x3a0a('0x46')][_0x3a0a('0x63')],_['omit'](_0x2de985[_0x3a0a('0x46')],[_0x3a0a('0x63'),'id'])||{});}return null;})[_0x3a0a('0x64')](function(_0x4ec022){var _0x34db7d;var _0x579f30;_0x4d1ee3=_0x4ec022||[];var _0x365c38=[];if(_0x4ec022){for(var _0x1b2d91=0x0;_0x1b2d91<_0x4ec022[_0x3a0a('0x36')];_0x1b2d91+=0x1){var _0x339980=_0x4ec022[_0x1b2d91]['get']({'plain':!![]});_0x34db7d=squel[_0x3a0a('0x67')]()[_0x3a0a('0x68')](_0x3a0a('0x8d'))[_0x3a0a('0x6a')]([_0x3a0a('0x6b'),_0x3a0a('0x6d'),_0x3a0a('0x6e'),_0x3a0a('0x58'),_0x3a0a('0x50'),_0x3a0a('0x51')],squel[_0x3a0a('0x6f')]()[_0x3a0a('0x70')](_0x3a0a('0x6b'),_0x3a0a('0x6b'))[_0x3a0a('0x70')]('id',_0x3a0a('0x6d'))['field'](_0x339980[_0x3a0a('0x72')][_0x3a0a('0x73')](),_0x3a0a('0x6e'))['field'](_0x2de985[_0x3a0a('0x43')]['id'][_0x3a0a('0x73')](),_0x3a0a('0x58'))['field'](_0x3a0a('0x71'),_0x3a0a('0x50'))[_0x3a0a('0x70')](_0x3a0a('0x71'),_0x3a0a('0x51'))[_0x3a0a('0x74')](_0x3a0a('0x75'))[_0x3a0a('0x39')](_0x3a0a('0x76'))[_0x3a0a('0x39')]('ListId\x20=\x20?',_0x339980[_0x3a0a('0x72')][_0x3a0a('0x73')]())[_0x3a0a('0x39')]('phone\x20IS\x20NOT\x20NULL'))[_0x3a0a('0x73')]();_0x365c38[_0x3a0a('0x87')](db['sequelize'][_0x3a0a('0x30')](_0x34db7d));}return BPromise[_0x3a0a('0x88')](_0x365c38);}})['then'](function(){return _0x4d1ee3;})[_0x3a0a('0x23')](respondWithResult(_0x3c402c,null))['catch'](handleError(_0x3c402c,null));};exports[_0x3a0a('0x8e')]=function(_0x859139,_0x185016,_0x5ed8c8){return db[_0x3a0a('0x2a')][_0x3a0a('0x4a')]({'where':{'id':_0x859139['params']['id']}})[_0x3a0a('0x23')](handleEntityNotFound(_0x185016,null))[_0x3a0a('0x23')](function(_0xff99e8){if(_0xff99e8){return _0xff99e8[_0x3a0a('0x8e')](_0x859139[_0x3a0a('0x30')][_0x3a0a('0x63')]);}})[_0x3a0a('0x23')](function(_0x3ddec4){if(_0x3ddec4){return db[_0x3a0a('0x5e')]['destroy']({'where':{'ListId':_0x859139[_0x3a0a('0x30')][_0x3a0a('0x63')],'CampaignId':_0x859139[_0x3a0a('0x43')]['id']}})['then'](function(){return _0x3ddec4;});}})[_0x3a0a('0x23')](respondWithStatusCode(_0x185016,null))['catch'](handleError(_0x185016,null));}; \ No newline at end of file +var _0xc423=['YYYY-MM-DD\x20HH:mm:ss','ids','spread','dialCheckDuplicateType','always','insert','into','fromQuery','scheduledAt','ListId','select','field','phone','NOW()','ContactId','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','cm_hopper','onlyIfOpen','phone\x20IS\x20NOT\x20NULL','CmListId','cmHopperId','OrderBy','ci.item','ci.OrderBY','cm_contact_has_items','join','h.ContactId\x20=\x20ci.CmContactId','h.ListId\x20=\x20?','h.CampaignId=?','push','sequelize','all','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','json','undefined','offset','count','limit','set','apply','reject','update','then','destroy','get','UserProfileResource','end','sendStatus','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','length','options','Campaign','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','IvrCampaigns','UserProfileSection','find','autoAssociation','clone','params','omit','updatedAt','createdAt','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getHoppers','findOne','CmHopper','nolimit','pick','CampaignId','getHopperHistories','CmHopperHistory','order','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','CmList','getLists','addLists','format'];(function(_0x2704be,_0x2555d4){var _0x21d7b5=function(_0x5f2a1b){while(--_0x5f2a1b){_0x2704be['push'](_0x2704be['shift']());}};_0x21d7b5(++_0x2555d4);}(_0xc423,0x159));var _0x3c42=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0xc423[_0x138adb];return _0x1b27f2;};'use strict';var emlformat=require(_0x3c42('0x0'));var rimraf=require(_0x3c42('0x1'));var zipdir=require(_0x3c42('0x2'));var jsonpatch=require(_0x3c42('0x3'));var rp=require(_0x3c42('0x4'));var moment=require('moment');var BPromise=require(_0x3c42('0x5'));var Mustache=require(_0x3c42('0x6'));var util=require(_0x3c42('0x7'));var path=require('path');var sox=require(_0x3c42('0x8'));var csv=require(_0x3c42('0x9'));var ejs=require(_0x3c42('0xa'));var fs=require('fs');var fs_extra=require(_0x3c42('0xb'));var _=require(_0x3c42('0xc'));var squel=require(_0x3c42('0xd'));var crypto=require(_0x3c42('0xe'));var jsforce=require(_0x3c42('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x3c42('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x3c42('0x10'));var authService=require(_0x3c42('0x11'));var qs=require(_0x3c42('0x12'));var as=require(_0x3c42('0x13'));var hardwareService=require(_0x3c42('0x14'));var logger=require(_0x3c42('0x15'))(_0x3c42('0x16'));var utils=require(_0x3c42('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x3c42('0x18'));var db=require(_0x3c42('0x19'))['db'];function respondWithStatusCode(_0xa2570b,_0x18d617){_0x18d617=_0x18d617||0xcc;return function(_0x1f802b){if(_0x1f802b){return _0xa2570b['sendStatus'](_0x18d617);}return _0xa2570b[_0x3c42('0x1a')](_0x18d617)['end']();};}function respondWithResult(_0x385f99,_0x25d565){_0x25d565=_0x25d565||0xc8;return function(_0x475d11){if(_0x475d11){return _0x385f99['status'](_0x25d565)[_0x3c42('0x1b')](_0x475d11);}};}function respondWithFilteredResult(_0x2500ee,_0x57857b){return function(_0x5880b7){if(_0x5880b7){var _0x34ef38=typeof _0x57857b['offset']===_0x3c42('0x1c')&&typeof _0x57857b['limit']===_0x3c42('0x1c');var _0x469af7=_0x5880b7['count'];var _0x88b878=_0x34ef38?0x0:_0x57857b[_0x3c42('0x1d')];var _0xf59593=_0x34ef38?_0x5880b7[_0x3c42('0x1e')]:_0x57857b[_0x3c42('0x1d')]+_0x57857b[_0x3c42('0x1f')];var _0x194f2e;if(_0xf59593>=_0x469af7){_0xf59593=_0x469af7;_0x194f2e=0xc8;}else{_0x194f2e=0xce;}_0x2500ee[_0x3c42('0x1a')](_0x194f2e);return _0x2500ee[_0x3c42('0x20')]('Content-Range',_0x88b878+'-'+_0xf59593+'/'+_0x469af7)[_0x3c42('0x1b')](_0x5880b7);}return null;};}function patchUpdates(_0x34c476){return function(_0x2375cf){try{jsonpatch[_0x3c42('0x21')](_0x2375cf,_0x34c476,!![]);}catch(_0x4953e3){return BPromise[_0x3c42('0x22')](_0x4953e3);}return _0x2375cf['save']();};}function saveUpdates(_0x4a1a5d,_0x204fee){return function(_0xb91b37){if(_0xb91b37){return _0xb91b37[_0x3c42('0x23')](_0x4a1a5d)[_0x3c42('0x24')](function(_0x2b7fdd){return _0x2b7fdd;});}return null;};}function removeEntity(_0x272bb2,_0x3b17d7){return function(_0x1902d8){if(_0x1902d8){return _0x1902d8[_0x3c42('0x25')]()[_0x3c42('0x24')](function(){var _0x378696=_0x1902d8[_0x3c42('0x26')]({'plain':!![]});var _0x2d1f81='IvrCampaigns';return db[_0x3c42('0x27')][_0x3c42('0x25')]({'where':{'type':_0x2d1f81,'resourceId':_0x378696['id']}})[_0x3c42('0x24')](function(){return _0x1902d8;});})['then'](function(){_0x272bb2[_0x3c42('0x1a')](0xcc)[_0x3c42('0x28')]();});}};}function handleEntityNotFound(_0x4185bd,_0x3639e8){return function(_0x4d183c){if(!_0x4d183c){_0x4185bd[_0x3c42('0x29')](0x194);}return _0x4d183c;};}function handleError(_0x282013,_0x4589bc){_0x4589bc=_0x4589bc||0x1f4;return function(_0x3d96a1){logger[_0x3c42('0x2a')](_0x3d96a1[_0x3c42('0x2b')]);if(_0x3d96a1['name']){delete _0x3d96a1[_0x3c42('0x2c')];}_0x282013[_0x3c42('0x1a')](_0x4589bc)[_0x3c42('0x2d')](_0x3d96a1);};}exports['index']=function(_0x52971a,_0x567dcc){var _0x933fad={},_0x3b8d24={},_0x7afe1c={'count':0x0,'rows':[]};var _0x495172=_[_0x3c42('0x2e')](db['Campaign'][_0x3c42('0x2f')],function(_0x3c1606){return{'name':_0x3c1606[_0x3c42('0x30')],'type':_0x3c1606[_0x3c42('0x31')][_0x3c42('0x32')]};});_0x3b8d24[_0x3c42('0x33')]=_[_0x3c42('0x2e')](_0x495172,_0x3c42('0x2c'));_0x3b8d24['query']=_[_0x3c42('0x34')](_0x52971a[_0x3c42('0x35')]);_0x3b8d24[_0x3c42('0x36')]=_[_0x3c42('0x37')](_0x3b8d24[_0x3c42('0x33')],_0x3b8d24['query']);_0x933fad['attributes']=_[_0x3c42('0x37')](_0x3b8d24[_0x3c42('0x33')],qs[_0x3c42('0x38')](_0x52971a[_0x3c42('0x35')]['fields']));_0x933fad[_0x3c42('0x39')]=_0x933fad[_0x3c42('0x39')]['length']?_0x933fad[_0x3c42('0x39')]:_0x3b8d24['model'];if(!_0x52971a['query'][_0x3c42('0x3a')]('nolimit')){_0x933fad[_0x3c42('0x1f')]=qs[_0x3c42('0x1f')](_0x52971a['query'][_0x3c42('0x1f')]);_0x933fad[_0x3c42('0x1d')]=qs[_0x3c42('0x1d')](_0x52971a['query'][_0x3c42('0x1d')]);}_0x933fad['order']=qs['sort'](_0x52971a[_0x3c42('0x35')][_0x3c42('0x3b')]);_0x933fad[_0x3c42('0x3c')]=qs['filters'](_['pick'](_0x52971a[_0x3c42('0x35')],_0x3b8d24['filters']),_0x495172);if(_0x52971a[_0x3c42('0x35')][_0x3c42('0x3d')]){_0x933fad[_0x3c42('0x3c')]=_[_0x3c42('0x3e')](_0x933fad[_0x3c42('0x3c')],{'$or':_[_0x3c42('0x2e')](_0x495172,function(_0x4cea3b){if(_0x4cea3b[_0x3c42('0x31')]!==_0x3c42('0x3f')){var _0x2d12ba={};_0x2d12ba[_0x4cea3b[_0x3c42('0x2c')]]={'$like':'%'+_0x52971a[_0x3c42('0x35')]['filter']+'%'};return _0x2d12ba;}})});}_0x933fad=_[_0x3c42('0x3e')]({},_0x933fad,_0x52971a['options']);var _0x1eb5a9={'where':_0x933fad['where']};return db['Campaign'][_0x3c42('0x1e')](_0x1eb5a9)[_0x3c42('0x24')](function(_0x33ef27){_0x7afe1c[_0x3c42('0x1e')]=_0x33ef27;if(_0x52971a[_0x3c42('0x35')][_0x3c42('0x40')]){_0x933fad[_0x3c42('0x41')]=[{'all':!![]}];}return db['Campaign'][_0x3c42('0x42')](_0x933fad);})[_0x3c42('0x24')](function(_0x55db6e){_0x7afe1c[_0x3c42('0x43')]=_0x55db6e;return _0x7afe1c;})[_0x3c42('0x24')](respondWithFilteredResult(_0x567dcc,_0x933fad))[_0x3c42('0x44')](handleError(_0x567dcc,null));};exports['show']=function(_0x2bb542,_0x522ac0){var _0x550ec4={'raw':![],'where':{'id':_0x2bb542['params']['id']}},_0xffda55={};_0xffda55[_0x3c42('0x33')]=_[_0x3c42('0x34')](db['Campaign']['rawAttributes']);_0xffda55[_0x3c42('0x35')]=_[_0x3c42('0x34')](_0x2bb542[_0x3c42('0x35')]);_0xffda55[_0x3c42('0x36')]=_[_0x3c42('0x37')](_0xffda55['model'],_0xffda55[_0x3c42('0x35')]);_0x550ec4[_0x3c42('0x39')]=_[_0x3c42('0x37')](_0xffda55[_0x3c42('0x33')],qs['fields'](_0x2bb542[_0x3c42('0x35')][_0x3c42('0x38')]));_0x550ec4[_0x3c42('0x39')]=_0x550ec4[_0x3c42('0x39')][_0x3c42('0x45')]?_0x550ec4[_0x3c42('0x39')]:_0xffda55[_0x3c42('0x33')];if(_0x2bb542[_0x3c42('0x35')][_0x3c42('0x40')]){_0x550ec4['include']=[{'all':!![]}];}_0x550ec4=_[_0x3c42('0x3e')]({},_0x550ec4,_0x2bb542[_0x3c42('0x46')]);return db[_0x3c42('0x47')]['find'](_0x550ec4)[_0x3c42('0x24')](handleEntityNotFound(_0x522ac0,null))[_0x3c42('0x24')](respondWithResult(_0x522ac0,null))[_0x3c42('0x44')](handleError(_0x522ac0,null));};exports[_0x3c42('0x48')]=function(_0x4dd3ac,_0x19906f){return db['Campaign'][_0x3c42('0x48')](_0x4dd3ac[_0x3c42('0x49')],{})['then'](function(_0x2973d3){var _0x40c1a6=_0x4dd3ac[_0x3c42('0x4a')][_0x3c42('0x26')]({'plain':!![]});if(!_0x40c1a6)throw new Error(_0x3c42('0x4b'));if(_0x40c1a6[_0x3c42('0x4c')]==='user'){var _0x5b699a=_0x2973d3[_0x3c42('0x26')]({'plain':!![]});var _0x2e00ea=_0x3c42('0x4d');return db[_0x3c42('0x4e')][_0x3c42('0x4f')]({'where':{'name':_0x2e00ea,'userProfileId':_0x40c1a6['userProfileId']},'raw':!![]})[_0x3c42('0x24')](function(_0x200b7e){if(_0x200b7e&&_0x200b7e[_0x3c42('0x50')]===0x0){return db['UserProfileResource']['create']({'name':_0x5b699a[_0x3c42('0x2c')],'resourceId':_0x5b699a['id'],'type':_0x200b7e[_0x3c42('0x2c')],'sectionId':_0x200b7e['id']},{})[_0x3c42('0x24')](function(){return _0x2973d3;});}else{return _0x2973d3;}})[_0x3c42('0x44')](function(_0x2190fe){logger[_0x3c42('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2190fe);throw _0x2190fe;});}return _0x2973d3;})['then'](respondWithResult(_0x19906f,0xc9))[_0x3c42('0x44')](handleError(_0x19906f,null));};exports[_0x3c42('0x51')]=function(_0x59eabb,_0x396e11){var _0x700130={'where':{'id':_0x59eabb[_0x3c42('0x52')]['id']}},_0x13dbe5={};_0x13dbe5[_0x3c42('0x33')]=_['keys'](db['Campaign'][_0x3c42('0x2f')]);_0x700130[_0x3c42('0x39')]=_[_0x3c42('0x37')](_0x13dbe5[_0x3c42('0x33')],qs[_0x3c42('0x38')](_0x59eabb['query'][_0x3c42('0x38')]));_0x700130[_0x3c42('0x39')]=_0x700130['attributes'][_0x3c42('0x45')]?_0x700130[_0x3c42('0x39')]:_0x13dbe5['model'];if(_0x59eabb[_0x3c42('0x35')]['includeAll']){_0x700130[_0x3c42('0x41')]=[{'all':!![]}];}_0x700130=_[_0x3c42('0x3e')]({},_0x700130,_0x59eabb[_0x3c42('0x46')]);return db[_0x3c42('0x47')]['find'](_0x700130)[_0x3c42('0x24')](handleEntityNotFound(_0x396e11,null))['then'](function(_0x5abc36){if(_0x5abc36){var _0x480a83=_0x5abc36['get']({'plain':!![]});_0x480a83=qs[_0x3c42('0x53')](_0x480a83,['id','createdAt',_0x3c42('0x54')]);_0x59eabb[_0x3c42('0x49')]=_[_0x3c42('0x53')](_0x59eabb[_0x3c42('0x49')],['id',_0x3c42('0x55'),_0x3c42('0x54')]);return db[_0x3c42('0x47')][_0x3c42('0x48')](_[_0x3c42('0x3e')](_0x480a83,_0x59eabb[_0x3c42('0x49')]),{'include':_0x59eabb[_0x3c42('0x35')][_0x3c42('0x40')]?[{'all':!![]}]:undefined})[_0x3c42('0x24')](function(_0x1c0691){var _0x26a710=_0x59eabb['user'][_0x3c42('0x26')]({'plain':!![]});if(!_0x26a710)throw new Error(_0x3c42('0x4b'));if(_0x26a710[_0x3c42('0x4c')]===_0x3c42('0x4a')){var _0x4747b0=_0x1c0691[_0x3c42('0x26')]({'plain':!![]});var _0x36c5f6=_0x3c42('0x4d');return db[_0x3c42('0x4e')]['find']({'where':{'name':_0x36c5f6,'userProfileId':_0x26a710[_0x3c42('0x56')]},'raw':!![]})[_0x3c42('0x24')](function(_0x535aa2){if(_0x535aa2&&_0x535aa2[_0x3c42('0x50')]===0x0){return db[_0x3c42('0x27')][_0x3c42('0x48')]({'name':_0x4747b0['name'],'resourceId':_0x4747b0['id'],'type':_0x535aa2[_0x3c42('0x2c')],'sectionId':_0x535aa2['id']},{})[_0x3c42('0x24')](function(){return _0x1c0691;});}else{return _0x1c0691;}})[_0x3c42('0x44')](function(_0x294a72){logger[_0x3c42('0x2a')](_0x3c42('0x57'),_0x294a72);throw _0x294a72;});}return _0x1c0691;});}})['then'](respondWithResult(_0x396e11,0xc9))[_0x3c42('0x44')](handleError(_0x396e11,null));};exports[_0x3c42('0x23')]=function(_0x30f33a,_0x2b9854){if(_0x30f33a['body']['id']){delete _0x30f33a[_0x3c42('0x49')]['id'];}return db[_0x3c42('0x47')][_0x3c42('0x4f')]({'where':{'id':_0x30f33a[_0x3c42('0x52')]['id']}})['then'](handleEntityNotFound(_0x2b9854,null))[_0x3c42('0x24')](saveUpdates(_0x30f33a[_0x3c42('0x49')],null))[_0x3c42('0x24')](respondWithResult(_0x2b9854,null))[_0x3c42('0x44')](handleError(_0x2b9854,null));};exports[_0x3c42('0x25')]=function(_0x590ee2,_0xc3c493){return db['Campaign'][_0x3c42('0x4f')]({'where':{'id':_0x590ee2['params']['id']}})['then'](handleEntityNotFound(_0xc3c493,null))[_0x3c42('0x24')](removeEntity(_0xc3c493,null))['catch'](handleError(_0xc3c493,null));};exports[_0x3c42('0x58')]=function(_0x5823e9,_0x3dbea9,_0x45de32){var _0x1d161b={'raw':!![],'where':{}};var _0x26510f={};var _0x302cfb={'count':0x0,'rows':[]};return db[_0x3c42('0x47')][_0x3c42('0x59')]({'where':{'id':_0x5823e9[_0x3c42('0x52')]['id']}})[_0x3c42('0x24')](handleEntityNotFound(_0x3dbea9,null))[_0x3c42('0x24')](function(_0x349e1c){if(_0x349e1c){_0x26510f[_0x3c42('0x33')]=_[_0x3c42('0x34')](db[_0x3c42('0x5a')][_0x3c42('0x2f')]);_0x26510f[_0x3c42('0x35')]=_[_0x3c42('0x34')](_0x5823e9['query']);_0x26510f[_0x3c42('0x36')]=_[_0x3c42('0x37')](_0x26510f[_0x3c42('0x33')],_0x26510f[_0x3c42('0x35')]);_0x1d161b[_0x3c42('0x39')]=_[_0x3c42('0x37')](_0x26510f[_0x3c42('0x33')],qs[_0x3c42('0x38')](_0x5823e9[_0x3c42('0x35')]['fields']));_0x1d161b[_0x3c42('0x39')]=_0x1d161b['attributes'][_0x3c42('0x45')]?_0x1d161b[_0x3c42('0x39')]:_0x26510f[_0x3c42('0x33')];if(!_0x5823e9[_0x3c42('0x35')][_0x3c42('0x3a')](_0x3c42('0x5b'))){_0x1d161b[_0x3c42('0x1f')]=qs[_0x3c42('0x1f')](_0x5823e9[_0x3c42('0x35')][_0x3c42('0x1f')]);_0x1d161b[_0x3c42('0x1d')]=qs['offset'](_0x5823e9[_0x3c42('0x35')]['offset']);}_0x1d161b['order']=qs[_0x3c42('0x3b')](_0x5823e9[_0x3c42('0x35')][_0x3c42('0x3b')]);_0x1d161b[_0x3c42('0x3c')]=qs['filters'](_[_0x3c42('0x5c')](_0x5823e9[_0x3c42('0x35')],_0x26510f[_0x3c42('0x36')]));_0x1d161b[_0x3c42('0x3c')][_0x3c42('0x5d')]=_0x349e1c['id'];if(_0x5823e9[_0x3c42('0x35')][_0x3c42('0x3d')]){_0x1d161b[_0x3c42('0x3c')]=_[_0x3c42('0x3e')](_0x1d161b[_0x3c42('0x3c')],{'$or':_[_0x3c42('0x2e')](_0x1d161b['attributes'],function(_0x58d2dc){var _0x39136d={};_0x39136d[_0x58d2dc]={'$like':'%'+_0x5823e9['query']['filter']+'%'};return _0x39136d;})});}_0x1d161b=_['merge']({},_0x1d161b,_0x5823e9['options']);return db[_0x3c42('0x5a')]['count']({'where':_0x1d161b[_0x3c42('0x3c')]})['then'](function(_0x93e505){_0x302cfb[_0x3c42('0x1e')]=_0x93e505;if(_0x5823e9[_0x3c42('0x35')][_0x3c42('0x40')]){_0x1d161b[_0x3c42('0x41')]=[{'all':!![]}];}return db[_0x3c42('0x5a')][_0x3c42('0x42')](_0x1d161b);})[_0x3c42('0x24')](function(_0x3c6881){_0x302cfb['rows']=_0x3c6881;return _0x302cfb;});}})[_0x3c42('0x24')](respondWithFilteredResult(_0x3dbea9,_0x1d161b))[_0x3c42('0x44')](handleError(_0x3dbea9,null));};exports[_0x3c42('0x5e')]=function(_0x5b345c,_0x52f43e,_0x1b500d){var _0x351d59={'raw':!![],'where':{}};var _0x5c7253={};var _0x2abfb7={'count':0x0,'rows':[]};return db[_0x3c42('0x47')][_0x3c42('0x59')]({'where':{'id':_0x5b345c[_0x3c42('0x52')]['id']}})['then'](handleEntityNotFound(_0x52f43e,null))[_0x3c42('0x24')](function(_0x5ee1c8){if(_0x5ee1c8){_0x5c7253[_0x3c42('0x33')]=_[_0x3c42('0x34')](db[_0x3c42('0x5f')][_0x3c42('0x2f')]);_0x5c7253[_0x3c42('0x35')]=_['keys'](_0x5b345c[_0x3c42('0x35')]);_0x5c7253[_0x3c42('0x36')]=_[_0x3c42('0x37')](_0x5c7253[_0x3c42('0x33')],_0x5c7253[_0x3c42('0x35')]);_0x351d59[_0x3c42('0x39')]=_[_0x3c42('0x37')](_0x5c7253[_0x3c42('0x33')],qs[_0x3c42('0x38')](_0x5b345c[_0x3c42('0x35')][_0x3c42('0x38')]));_0x351d59['attributes']=_0x351d59[_0x3c42('0x39')][_0x3c42('0x45')]?_0x351d59[_0x3c42('0x39')]:_0x5c7253[_0x3c42('0x33')];if(!_0x5b345c[_0x3c42('0x35')][_0x3c42('0x3a')]('nolimit')){_0x351d59['limit']=qs[_0x3c42('0x1f')](_0x5b345c[_0x3c42('0x35')][_0x3c42('0x1f')]);_0x351d59[_0x3c42('0x1d')]=qs[_0x3c42('0x1d')](_0x5b345c[_0x3c42('0x35')][_0x3c42('0x1d')]);}_0x351d59[_0x3c42('0x60')]=qs[_0x3c42('0x3b')](_0x5b345c[_0x3c42('0x35')][_0x3c42('0x3b')]);_0x351d59[_0x3c42('0x3c')]=qs[_0x3c42('0x36')](_['pick'](_0x5b345c[_0x3c42('0x35')],_0x5c7253[_0x3c42('0x36')]));_0x351d59[_0x3c42('0x3c')][_0x3c42('0x5d')]=_0x5ee1c8['id'];if(_0x5b345c[_0x3c42('0x35')][_0x3c42('0x3d')]){_0x351d59['where']=_['merge'](_0x351d59[_0x3c42('0x3c')],{'$or':_[_0x3c42('0x2e')](_0x351d59[_0x3c42('0x39')],function(_0x1afd08){var _0x1ee90a={};_0x1ee90a[_0x1afd08]={'$like':'%'+_0x5b345c[_0x3c42('0x35')]['filter']+'%'};return _0x1ee90a;})});}_0x351d59=_['merge']({},_0x351d59,_0x5b345c['options']);return db[_0x3c42('0x5f')][_0x3c42('0x1e')]({'where':_0x351d59['where']})[_0x3c42('0x24')](function(_0x5b7012){_0x2abfb7[_0x3c42('0x1e')]=_0x5b7012;if(_0x5b345c['query'][_0x3c42('0x40')]){_0x351d59['include']=[{'all':!![]}];}return db[_0x3c42('0x5f')]['findAll'](_0x351d59);})[_0x3c42('0x24')](function(_0x169d0e){_0x2abfb7[_0x3c42('0x43')]=_0x169d0e;return _0x2abfb7;});}})['then'](respondWithFilteredResult(_0x52f43e,_0x351d59))[_0x3c42('0x44')](handleError(_0x52f43e,null));};exports[_0x3c42('0x61')]=function(_0x2bcdbe,_0x2aed3e,_0x268f0f){var _0x20824f={'raw':!![],'where':{}};var _0x454682={};var _0x2c7e66={'count':0x0,'rows':[]};return db['Campaign'][_0x3c42('0x59')]({'where':{'id':_0x2bcdbe[_0x3c42('0x52')]['id']}})[_0x3c42('0x24')](handleEntityNotFound(_0x2aed3e,null))['then'](function(_0x4950f2){if(_0x4950f2){_0x454682[_0x3c42('0x33')]=_[_0x3c42('0x34')](db[_0x3c42('0x62')][_0x3c42('0x2f')]);_0x454682[_0x3c42('0x35')]=_[_0x3c42('0x34')](_0x2bcdbe[_0x3c42('0x35')]);_0x454682[_0x3c42('0x36')]=_[_0x3c42('0x37')](_0x454682[_0x3c42('0x33')],_0x454682[_0x3c42('0x35')]);_0x20824f[_0x3c42('0x39')]=_['intersection'](_0x454682[_0x3c42('0x33')],qs[_0x3c42('0x38')](_0x2bcdbe[_0x3c42('0x35')][_0x3c42('0x38')]));_0x20824f[_0x3c42('0x39')]=_0x20824f['attributes'][_0x3c42('0x45')]?_0x20824f[_0x3c42('0x39')]:_0x454682[_0x3c42('0x33')];if(!_0x2bcdbe[_0x3c42('0x35')][_0x3c42('0x3a')](_0x3c42('0x5b'))){_0x20824f[_0x3c42('0x1f')]=qs[_0x3c42('0x1f')](_0x2bcdbe[_0x3c42('0x35')][_0x3c42('0x1f')]);_0x20824f[_0x3c42('0x1d')]=qs[_0x3c42('0x1d')](_0x2bcdbe[_0x3c42('0x35')][_0x3c42('0x1d')]);}_0x20824f[_0x3c42('0x60')]=qs['sort'](_0x2bcdbe['query'][_0x3c42('0x3b')]);_0x20824f[_0x3c42('0x3c')]=qs['filters'](_[_0x3c42('0x5c')](_0x2bcdbe[_0x3c42('0x35')],_0x454682['filters']));_0x20824f[_0x3c42('0x3c')][_0x3c42('0x5d')]=_0x4950f2['id'];if(_0x2bcdbe['query'][_0x3c42('0x3d')]){_0x20824f[_0x3c42('0x3c')]=_['merge'](_0x20824f[_0x3c42('0x3c')],{'$or':_[_0x3c42('0x2e')](_0x20824f[_0x3c42('0x39')],function(_0x3d2514){var _0x5ec59d={};_0x5ec59d[_0x3d2514]={'$like':'%'+_0x2bcdbe[_0x3c42('0x35')][_0x3c42('0x3d')]+'%'};return _0x5ec59d;})});}_0x20824f=_[_0x3c42('0x3e')]({},_0x20824f,_0x2bcdbe[_0x3c42('0x46')]);return db[_0x3c42('0x62')][_0x3c42('0x1e')]({'where':_0x20824f['where']})[_0x3c42('0x24')](function(_0x3cab39){_0x2c7e66[_0x3c42('0x1e')]=_0x3cab39;if(_0x2bcdbe[_0x3c42('0x35')][_0x3c42('0x40')]){_0x20824f[_0x3c42('0x41')]=[{'all':!![]}];}return db[_0x3c42('0x62')][_0x3c42('0x42')](_0x20824f);})[_0x3c42('0x24')](function(_0x5064f7){_0x2c7e66['rows']=_0x5064f7;return _0x2c7e66;});}})['then'](respondWithFilteredResult(_0x2aed3e,_0x20824f))[_0x3c42('0x44')](handleError(_0x2aed3e,null));};exports[_0x3c42('0x63')]=function(_0x3dc8ee,_0x346d8d,_0x3ce16f){var _0xda7645={'raw':!![],'where':{}};var _0x4bed75={};var _0x41b046={'count':0x0,'rows':[]};return db[_0x3c42('0x47')]['findOne']({'where':{'id':_0x3dc8ee[_0x3c42('0x52')]['id']}})[_0x3c42('0x24')](handleEntityNotFound(_0x346d8d,null))['then'](function(_0x5e3757){if(_0x5e3757){_0x4bed75['model']=_['keys'](db[_0x3c42('0x64')]['rawAttributes']);_0x4bed75[_0x3c42('0x35')]=_[_0x3c42('0x34')](_0x3dc8ee['query']);_0x4bed75[_0x3c42('0x36')]=_['intersection'](_0x4bed75[_0x3c42('0x33')],_0x4bed75[_0x3c42('0x35')]);_0xda7645[_0x3c42('0x39')]=_[_0x3c42('0x37')](_0x4bed75[_0x3c42('0x33')],qs['fields'](_0x3dc8ee['query'][_0x3c42('0x38')]));_0xda7645['attributes']=_0xda7645['attributes']['length']?_0xda7645[_0x3c42('0x39')]:_0x4bed75[_0x3c42('0x33')];if(!_0x3dc8ee[_0x3c42('0x35')][_0x3c42('0x3a')](_0x3c42('0x5b'))){_0xda7645['limit']=qs[_0x3c42('0x1f')](_0x3dc8ee[_0x3c42('0x35')][_0x3c42('0x1f')]);_0xda7645['offset']=qs['offset'](_0x3dc8ee[_0x3c42('0x35')][_0x3c42('0x1d')]);}_0xda7645[_0x3c42('0x60')]=qs[_0x3c42('0x3b')](_0x3dc8ee['query'][_0x3c42('0x3b')]);_0xda7645[_0x3c42('0x3c')]=qs[_0x3c42('0x36')](_['pick'](_0x3dc8ee[_0x3c42('0x35')],_0x4bed75[_0x3c42('0x36')]));_0xda7645[_0x3c42('0x3c')][_0x3c42('0x5d')]=_0x5e3757['id'];if(_0x3dc8ee[_0x3c42('0x35')][_0x3c42('0x3d')]){_0xda7645[_0x3c42('0x3c')]=_['merge'](_0xda7645[_0x3c42('0x3c')],{'$or':_[_0x3c42('0x2e')](_0xda7645[_0x3c42('0x39')],function(_0x52401c){var _0x58f387={};_0x58f387[_0x52401c]={'$like':'%'+_0x3dc8ee[_0x3c42('0x35')]['filter']+'%'};return _0x58f387;})});}_0xda7645=_[_0x3c42('0x3e')]({},_0xda7645,_0x3dc8ee[_0x3c42('0x46')]);return db[_0x3c42('0x64')][_0x3c42('0x1e')]({'where':_0xda7645[_0x3c42('0x3c')]})[_0x3c42('0x24')](function(_0x3cb933){_0x41b046[_0x3c42('0x1e')]=_0x3cb933;if(_0x3dc8ee[_0x3c42('0x35')]['includeAll']){_0xda7645[_0x3c42('0x41')]=[{'all':!![]}];}return db['CmHopperBlack'][_0x3c42('0x42')](_0xda7645);})[_0x3c42('0x24')](function(_0x40b5c0){_0x41b046[_0x3c42('0x43')]=_0x40b5c0;return _0x41b046;});}})['then'](respondWithFilteredResult(_0x346d8d,_0xda7645))[_0x3c42('0x44')](handleError(_0x346d8d,null));};exports['getLists']=function(_0x5c68d0,_0x392e6b,_0x2ea243){var _0x2baedc={};var _0x3e5993={};var _0x1c6e50;var _0x18fefe;return db[_0x3c42('0x47')][_0x3c42('0x59')]({'where':{'id':_0x5c68d0[_0x3c42('0x52')]['id']}})['then'](handleEntityNotFound(_0x392e6b,null))[_0x3c42('0x24')](function(_0x518c74){if(_0x518c74){_0x1c6e50=_0x518c74;_0x3e5993[_0x3c42('0x33')]=_[_0x3c42('0x34')](db[_0x3c42('0x65')][_0x3c42('0x2f')]);_0x3e5993[_0x3c42('0x35')]=_[_0x3c42('0x34')](_0x5c68d0[_0x3c42('0x35')]);_0x3e5993['filters']=_[_0x3c42('0x37')](_0x3e5993[_0x3c42('0x33')],_0x3e5993[_0x3c42('0x35')]);_0x2baedc[_0x3c42('0x39')]=_[_0x3c42('0x37')](_0x3e5993['model'],qs[_0x3c42('0x38')](_0x5c68d0['query'][_0x3c42('0x38')]));_0x2baedc[_0x3c42('0x39')]=_0x2baedc[_0x3c42('0x39')][_0x3c42('0x45')]?_0x2baedc[_0x3c42('0x39')]:_0x3e5993['model'];_0x2baedc[_0x3c42('0x60')]=qs[_0x3c42('0x3b')](_0x5c68d0[_0x3c42('0x35')][_0x3c42('0x3b')]);_0x2baedc['where']=qs[_0x3c42('0x36')](_[_0x3c42('0x5c')](_0x5c68d0[_0x3c42('0x35')],_0x3e5993['filters']));if(_0x5c68d0[_0x3c42('0x35')][_0x3c42('0x3d')]){_0x2baedc['where']=_['merge'](_0x2baedc[_0x3c42('0x3c')],{'$or':_[_0x3c42('0x2e')](_0x2baedc['attributes'],function(_0x76fff0){var _0x456bde={};_0x456bde[_0x76fff0]={'$like':'%'+_0x5c68d0[_0x3c42('0x35')][_0x3c42('0x3d')]+'%'};return _0x456bde;})});}_0x2baedc=_[_0x3c42('0x3e')]({},_0x2baedc,_0x5c68d0[_0x3c42('0x46')]);return _0x1c6e50[_0x3c42('0x66')](_0x2baedc);}})[_0x3c42('0x24')](function(_0x20bf8c){if(_0x20bf8c){_0x18fefe=_0x20bf8c[_0x3c42('0x45')];if(!_0x5c68d0[_0x3c42('0x35')][_0x3c42('0x3a')](_0x3c42('0x5b'))){_0x2baedc[_0x3c42('0x1f')]=qs[_0x3c42('0x1f')](_0x5c68d0['query']['limit']);_0x2baedc[_0x3c42('0x1d')]=qs[_0x3c42('0x1d')](_0x5c68d0['query']['offset']);}return _0x1c6e50[_0x3c42('0x66')](_0x2baedc);}})[_0x3c42('0x24')](function(_0x38ca9a){if(_0x38ca9a){return _0x38ca9a?{'count':_0x18fefe,'rows':_0x38ca9a}:null;}})['then'](respondWithResult(_0x392e6b,null))[_0x3c42('0x44')](handleError(_0x392e6b,null));};exports[_0x3c42('0x67')]=function(_0x202245,_0x51ab56,_0x3c2238){var _0x3c83a0,_0x152d3a;var _0x147c33=[];var _0x2e73c2=moment()[_0x3c42('0x68')](_0x3c42('0x69'));return db['Campaign'][_0x3c42('0x4f')]({'where':{'id':_0x202245[_0x3c42('0x52')]['id']}})[_0x3c42('0x24')](handleEntityNotFound(_0x51ab56,null))[_0x3c42('0x24')](function(_0x59e49b){if(_0x59e49b){_0x152d3a=_0x59e49b;return _0x59e49b[_0x3c42('0x67')](_0x202245[_0x3c42('0x49')][_0x3c42('0x6a')],_[_0x3c42('0x53')](_0x202245[_0x3c42('0x49')],[_0x3c42('0x6a'),'id'])||{});}return null;})[_0x3c42('0x6b')](function(_0x3a7cd2){var _0x493950;var _0x33d831;_0x3c83a0=_0x3a7cd2||[];var _0x5a7dd0=[];if(_0x3a7cd2){for(var _0x3765b7=0x0;_0x3765b7<_0x3a7cd2[_0x3c42('0x45')];_0x3765b7+=0x1){var _0x44cbcc=_0x3a7cd2[_0x3765b7][_0x3c42('0x26')]({'plain':!![]});_0x152d3a[_0x3c42('0x6c')]=_0x202245['body'][_0x3c42('0x6c')]?_0x202245[_0x3c42('0x49')]['dialCheckDuplicateType']:_0x152d3a[_0x3c42('0x6c')];switch(_0x152d3a[_0x3c42('0x6c')]){case _0x3c42('0x6d'):_0x493950=squel[_0x3c42('0x6e')]()[_0x3c42('0x6f')]('cm_hopper')[_0x3c42('0x70')](['phone',_0x3c42('0x71'),'ContactId',_0x3c42('0x72'),'CampaignId',_0x3c42('0x55'),'updatedAt'],squel[_0x3c42('0x73')]()[_0x3c42('0x74')](_0x3c42('0x75'),_0x3c42('0x75'))['field'](_0x3c42('0x76'),'scheduledAt')[_0x3c42('0x74')]('id',_0x3c42('0x77'))['field'](_0x44cbcc['CmListId'][_0x3c42('0x78')](),_0x3c42('0x72'))['field'](_0x202245[_0x3c42('0x52')]['id'][_0x3c42('0x78')](),_0x3c42('0x5d'))[_0x3c42('0x74')]('\x27'+_0x2e73c2+'\x27','createdAt')[_0x3c42('0x74')]('\x27'+_0x2e73c2+'\x27','updatedAt')[_0x3c42('0x79')](_0x3c42('0x7a'))[_0x3c42('0x3c')](_0x3c42('0x7b'))['where'](_0x3c42('0x7c'),_0x44cbcc['CmListId'][_0x3c42('0x78')]())[_0x3c42('0x3c')]('phone\x20IS\x20NOT\x20NULL')[_0x3c42('0x3c')](_0x3c42('0x7d'),squel[_0x3c42('0x73')]()[_0x3c42('0x74')](_0x3c42('0x7e'))['from']('cm_hopper_final')[_0x3c42('0x3c')](_0x3c42('0x7f'),_0x202245[_0x3c42('0x52')]['id']['toString']()))[_0x3c42('0x3c')](_0x3c42('0x7d'),squel[_0x3c42('0x73')]()[_0x3c42('0x74')](_0x3c42('0x80'))[_0x3c42('0x79')](_0x3c42('0x81'))[_0x3c42('0x3c')](_0x3c42('0x7f'),_0x202245[_0x3c42('0x52')]['id'][_0x3c42('0x78')]())))[_0x3c42('0x78')]();break;case _0x3c42('0x82'):_0x493950=squel[_0x3c42('0x6e')]()[_0x3c42('0x6f')](_0x3c42('0x81'))[_0x3c42('0x70')]([_0x3c42('0x75'),_0x3c42('0x71'),_0x3c42('0x77'),_0x3c42('0x72'),_0x3c42('0x5d'),_0x3c42('0x55'),_0x3c42('0x54')],squel[_0x3c42('0x73')]()[_0x3c42('0x74')]('phone',_0x3c42('0x75'))[_0x3c42('0x74')](_0x3c42('0x76'),_0x3c42('0x71'))[_0x3c42('0x74')]('id','ContactId')[_0x3c42('0x74')](_0x44cbcc['CmListId']['toString'](),'ListId')[_0x3c42('0x74')](_0x202245[_0x3c42('0x52')]['id'][_0x3c42('0x78')](),'CampaignId')[_0x3c42('0x74')]('\x27'+_0x2e73c2+'\x27',_0x3c42('0x55'))[_0x3c42('0x74')]('\x27'+_0x2e73c2+'\x27',_0x3c42('0x54'))['from'](_0x3c42('0x7a'))['where'](_0x3c42('0x7b'))[_0x3c42('0x3c')](_0x3c42('0x7c'),_0x44cbcc['CmListId']['toString']())['where'](_0x3c42('0x83'))[_0x3c42('0x3c')]('phone\x20NOT\x20IN\x20(?)',squel[_0x3c42('0x73')]()['field'](_0x3c42('0x80'))[_0x3c42('0x79')](_0x3c42('0x81'))[_0x3c42('0x3c')](_0x3c42('0x7f'),_0x202245[_0x3c42('0x52')]['id'][_0x3c42('0x78')]())))[_0x3c42('0x78')]();break;default:_0x493950=squel[_0x3c42('0x6e')]()[_0x3c42('0x6f')]('cm_hopper')[_0x3c42('0x70')]([_0x3c42('0x75'),'scheduledAt',_0x3c42('0x77'),_0x3c42('0x72'),'CampaignId',_0x3c42('0x55'),_0x3c42('0x54')],squel['select']()[_0x3c42('0x74')](_0x3c42('0x75'),_0x3c42('0x75'))[_0x3c42('0x74')](_0x3c42('0x76'),_0x3c42('0x71'))[_0x3c42('0x74')]('id',_0x3c42('0x77'))[_0x3c42('0x74')](_0x44cbcc[_0x3c42('0x84')]['toString'](),_0x3c42('0x72'))[_0x3c42('0x74')](_0x202245[_0x3c42('0x52')]['id'][_0x3c42('0x78')](),'CampaignId')[_0x3c42('0x74')]('\x27'+_0x2e73c2+'\x27',_0x3c42('0x55'))[_0x3c42('0x74')]('\x27'+_0x2e73c2+'\x27','updatedAt')[_0x3c42('0x79')]('cm_contacts')[_0x3c42('0x3c')](_0x3c42('0x7b'))[_0x3c42('0x3c')](_0x3c42('0x7c'),_0x44cbcc[_0x3c42('0x84')][_0x3c42('0x78')]())[_0x3c42('0x3c')]('phone\x20IS\x20NOT\x20NULL'))[_0x3c42('0x78')]();}_0x33d831=squel[_0x3c42('0x6e')]()[_0x3c42('0x6f')]('cm_hopper_additional_phones')[_0x3c42('0x70')]([_0x3c42('0x85'),'scheduledAt',_0x3c42('0x75'),_0x3c42('0x86'),_0x3c42('0x55'),_0x3c42('0x54')],squel[_0x3c42('0x73')]()[_0x3c42('0x74')]('h.id','id')[_0x3c42('0x74')](_0x3c42('0x76'),_0x3c42('0x71'))[_0x3c42('0x74')](_0x3c42('0x87'),'phone')[_0x3c42('0x74')](_0x3c42('0x88'),_0x3c42('0x86'))[_0x3c42('0x74')]('\x27'+_0x2e73c2+'\x27','createdAt')['field']('\x27'+_0x2e73c2+'\x27',_0x3c42('0x54'))['from'](_0x3c42('0x89'),'ci')[_0x3c42('0x8a')](_0x3c42('0x81'),'h',_0x3c42('0x8b'))[_0x3c42('0x3c')](_0x3c42('0x8c'),_0x44cbcc[_0x3c42('0x84')]['toString']())[_0x3c42('0x3c')](_0x3c42('0x8d'),_0x202245[_0x3c42('0x52')]['id']['toString']())[_0x3c42('0x3c')]('h.createdAt\x20=\x20?',_0x2e73c2))['toString']();_0x5a7dd0[_0x3c42('0x8e')](db[_0x3c42('0x8f')][_0x3c42('0x35')](_0x493950));_0x147c33[_0x3c42('0x8e')](db['sequelize']['query'](_0x33d831));}return BPromise[_0x3c42('0x90')](_0x5a7dd0);}})[_0x3c42('0x24')](function(){return BPromise[_0x3c42('0x90')](_0x147c33);})[_0x3c42('0x24')](function(){return _0x3c83a0;})[_0x3c42('0x24')](respondWithResult(_0x51ab56,null))[_0x3c42('0x44')](handleError(_0x51ab56,null));};exports['removeLists']=function(_0x4d445c,_0x3056a2,_0x28ae13){return db[_0x3c42('0x47')][_0x3c42('0x4f')]({'where':{'id':_0x4d445c[_0x3c42('0x52')]['id']}})[_0x3c42('0x24')](handleEntityNotFound(_0x3056a2,null))[_0x3c42('0x24')](function(_0xd348e){if(_0xd348e){return _0xd348e[_0x3c42('0x91')](_0x4d445c['query'][_0x3c42('0x6a')]);}})[_0x3c42('0x24')](function(_0x13b5da){if(_0x13b5da){return db['CmHopper']['destroy']({'where':{'ListId':_0x4d445c[_0x3c42('0x35')]['ids'],'CampaignId':_0x4d445c[_0x3c42('0x52')]['id']}})[_0x3c42('0x24')](function(){return _0x13b5da;});}})['then'](respondWithStatusCode(_0x3056a2,null))[_0x3c42('0x44')](handleError(_0x3056a2,null));};exports['getBlackLists']=function(_0x91db7e,_0x5365ab,_0x2fa400){var _0x421498={};var _0x4bc87e={};var _0x168cf8;var _0x3530a8;return db[_0x3c42('0x47')][_0x3c42('0x59')]({'where':{'id':_0x91db7e[_0x3c42('0x52')]['id']}})[_0x3c42('0x24')](handleEntityNotFound(_0x5365ab,null))[_0x3c42('0x24')](function(_0x3065b9){if(_0x3065b9){_0x168cf8=_0x3065b9;_0x4bc87e[_0x3c42('0x33')]=_[_0x3c42('0x34')](db[_0x3c42('0x65')]['rawAttributes']);_0x4bc87e[_0x3c42('0x35')]=_[_0x3c42('0x34')](_0x91db7e['query']);_0x4bc87e[_0x3c42('0x36')]=_[_0x3c42('0x37')](_0x4bc87e[_0x3c42('0x33')],_0x4bc87e[_0x3c42('0x35')]);_0x421498[_0x3c42('0x39')]=_['intersection'](_0x4bc87e[_0x3c42('0x33')],qs[_0x3c42('0x38')](_0x91db7e[_0x3c42('0x35')]['fields']));_0x421498[_0x3c42('0x39')]=_0x421498[_0x3c42('0x39')]['length']?_0x421498['attributes']:_0x4bc87e[_0x3c42('0x33')];_0x421498[_0x3c42('0x60')]=qs[_0x3c42('0x3b')](_0x91db7e[_0x3c42('0x35')][_0x3c42('0x3b')]);_0x421498[_0x3c42('0x3c')]=qs[_0x3c42('0x36')](_[_0x3c42('0x5c')](_0x91db7e['query'],_0x4bc87e['filters']));if(_0x91db7e[_0x3c42('0x35')]['filter']){_0x421498[_0x3c42('0x3c')]=_[_0x3c42('0x3e')](_0x421498[_0x3c42('0x3c')],{'$or':_[_0x3c42('0x2e')](_0x421498[_0x3c42('0x39')],function(_0x1b14a1){var _0xa200a9={};_0xa200a9[_0x1b14a1]={'$like':'%'+_0x91db7e[_0x3c42('0x35')][_0x3c42('0x3d')]+'%'};return _0xa200a9;})});}_0x421498=_['merge']({},_0x421498,_0x91db7e['options']);return _0x168cf8['getBlackLists'](_0x421498);}})[_0x3c42('0x24')](function(_0xc35975){if(_0xc35975){_0x3530a8=_0xc35975[_0x3c42('0x45')];if(!_0x91db7e[_0x3c42('0x35')]['hasOwnProperty']('nolimit')){_0x421498[_0x3c42('0x1f')]=qs[_0x3c42('0x1f')](_0x91db7e[_0x3c42('0x35')][_0x3c42('0x1f')]);_0x421498['offset']=qs[_0x3c42('0x1d')](_0x91db7e['query'][_0x3c42('0x1d')]);}return _0x168cf8[_0x3c42('0x92')](_0x421498);}})['then'](function(_0xc0135){if(_0xc0135){return _0xc0135?{'count':_0x3530a8,'rows':_0xc0135}:null;}})[_0x3c42('0x24')](respondWithResult(_0x5365ab,null))[_0x3c42('0x44')](handleError(_0x5365ab,null));};exports['addBlackLists']=function(_0x55b6b2,_0x4f2140,_0x274538){var _0x419092,_0x190c35;var _0x2570c4=[];var _0x360bbc=moment()['format'](_0x3c42('0x69'));return db['Campaign'][_0x3c42('0x4f')]({'where':{'id':_0x55b6b2[_0x3c42('0x52')]['id']}})[_0x3c42('0x24')](handleEntityNotFound(_0x4f2140,null))[_0x3c42('0x24')](function(_0x5e8f29){if(_0x5e8f29){_0x190c35=_0x5e8f29;return _0x5e8f29[_0x3c42('0x93')](_0x55b6b2['body'][_0x3c42('0x6a')],_['omit'](_0x55b6b2[_0x3c42('0x49')],[_0x3c42('0x6a'),'id'])||{});}return null;})[_0x3c42('0x6b')](function(_0x2ab1dd){var _0x43edd2;var _0x34c05b;_0x419092=_0x2ab1dd||[];var _0x7c86c5=[];if(_0x2ab1dd){for(var _0xef0939=0x0;_0xef0939<_0x2ab1dd[_0x3c42('0x45')];_0xef0939+=0x1){var _0x2818bc=_0x2ab1dd[_0xef0939][_0x3c42('0x26')]({'plain':!![]});_0x43edd2=squel[_0x3c42('0x6e')]()[_0x3c42('0x6f')](_0x3c42('0x94'))[_0x3c42('0x70')](['phone',_0x3c42('0x77'),'ListId','CampaignId',_0x3c42('0x55'),_0x3c42('0x54')],squel[_0x3c42('0x73')]()[_0x3c42('0x74')](_0x3c42('0x75'),'phone')[_0x3c42('0x74')]('id','ContactId')['field'](_0x2818bc[_0x3c42('0x84')][_0x3c42('0x78')](),_0x3c42('0x72'))[_0x3c42('0x74')](_0x55b6b2[_0x3c42('0x52')]['id'][_0x3c42('0x78')](),_0x3c42('0x5d'))[_0x3c42('0x74')](_0x3c42('0x76'),_0x3c42('0x55'))[_0x3c42('0x74')](_0x3c42('0x76'),_0x3c42('0x54'))['from'](_0x3c42('0x7a'))[_0x3c42('0x3c')](_0x3c42('0x7b'))['where']('ListId\x20=\x20?',_0x2818bc[_0x3c42('0x84')]['toString']())[_0x3c42('0x3c')]('phone\x20IS\x20NOT\x20NULL'))[_0x3c42('0x78')]();_0x7c86c5['push'](db[_0x3c42('0x8f')][_0x3c42('0x35')](_0x43edd2));}return BPromise[_0x3c42('0x90')](_0x7c86c5);}})[_0x3c42('0x24')](function(){return _0x419092;})[_0x3c42('0x24')](respondWithResult(_0x4f2140,null))[_0x3c42('0x44')](handleError(_0x4f2140,null));};exports[_0x3c42('0x95')]=function(_0x147dfa,_0x2b7a5a,_0x1704e3){return db[_0x3c42('0x47')]['find']({'where':{'id':_0x147dfa['params']['id']}})['then'](handleEntityNotFound(_0x2b7a5a,null))[_0x3c42('0x24')](function(_0x3cdad1){if(_0x3cdad1){return _0x3cdad1[_0x3c42('0x95')](_0x147dfa[_0x3c42('0x35')][_0x3c42('0x6a')]);}})['then'](function(_0x2174cd){if(_0x2174cd){return db[_0x3c42('0x64')][_0x3c42('0x25')]({'where':{'ListId':_0x147dfa[_0x3c42('0x35')][_0x3c42('0x6a')],'CampaignId':_0x147dfa['params']['id']}})[_0x3c42('0x24')](function(){return _0x2174cd;});}})[_0x3c42('0x24')](respondWithStatusCode(_0x2b7a5a,null))[_0x3c42('0x44')](handleError(_0x2b7a5a,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 5850c00..eb7da94 100644 --- a/server/api/campaign/campaign.model.js +++ b/server/api/campaign/campaign.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['exports','define','Campaign','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./campaign.attributes'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'campaigns','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./campaign.attributes','exports','Campaign','campaigns','lodash','util'];(function(_0x1f32cb,_0x10774e){var _0xff2722=function(_0x370c71){while(--_0x370c71){_0x1f32cb['push'](_0x1f32cb['shift']());}};_0xff2722(++_0x10774e);}(_0x7a54,0x106));var _0x47a5=function(_0x396e68,_0xf75ecb){_0x396e68=_0x396e68-0x0;var _0x2118a9=_0x7a54[_0x396e68];return _0x2118a9;};'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 2f448f9..0992457 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 _0xc112=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','Campaign','options','raw','where','limit','include','model','attributes','map','GetCampaign','stringify','lodash','util'];(function(_0x4709c8,_0x3384ca){var _0x478cdd=function(_0x5193ce){while(--_0x5193ce){_0x4709c8['push'](_0x4709c8['shift']());}};_0x478cdd(++_0x3384ca);}(_0xc112,0xec));var _0x2c11=function(_0x44dfe6,_0x4dd17a){_0x44dfe6=_0x44dfe6-0x0;var _0x3ccb75=_0xc112[_0x44dfe6];return _0x3ccb75;};'use strict';var _=require(_0x2c11('0x0'));var util=require(_0x2c11('0x1'));var moment=require(_0x2c11('0x2'));var BPromise=require('bluebird');var rs=require(_0x2c11('0x3'));var fs=require('fs');var Redis=require(_0x2c11('0x4'));var db=require(_0x2c11('0x5'))['db'];var utils=require(_0x2c11('0x6'));var logger=require(_0x2c11('0x7'))(_0x2c11('0x8'));var config=require(_0x2c11('0x9'));var jayson=require(_0x2c11('0xa'));var client=jayson[_0x2c11('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5c2399,_0x39c244,_0x1fada4){return new BPromise(function(_0x29dfcf,_0x43c1f5){return client['request'](_0x5c2399,_0x1fada4)[_0x2c11('0xc')](function(_0x1e0381){logger['info'](_0x2c11('0xd'),_0x39c244,_0x2c11('0xe'));logger[_0x2c11('0xf')](_0x2c11('0x10'),_0x39c244,_0x2c11('0xe'),JSON['stringify'](_0x1e0381));if(_0x1e0381[_0x2c11('0x11')]){if(_0x1e0381[_0x2c11('0x11')][_0x2c11('0x12')]===0x1f4){logger[_0x2c11('0x11')](_0x2c11('0xd'),_0x39c244,_0x1e0381[_0x2c11('0x11')][_0x2c11('0x13')]);return _0x43c1f5(_0x1e0381['error'][_0x2c11('0x13')]);}logger[_0x2c11('0x11')](_0x2c11('0xd'),_0x39c244,_0x1e0381[_0x2c11('0x11')][_0x2c11('0x13')]);return _0x29dfcf(_0x1e0381[_0x2c11('0x11')][_0x2c11('0x13')]);}else{logger[_0x2c11('0x14')](_0x2c11('0xd'),_0x39c244,_0x2c11('0xe'));_0x29dfcf(_0x1e0381[_0x2c11('0x15')]['message']);}})[_0x2c11('0x16')](function(_0x3c31e4){logger[_0x2c11('0x11')]('Campaign,\x20%s,\x20%s',_0x39c244,_0x3c31e4);_0x43c1f5(_0x3c31e4);});});}exports['GetCampaign']=function(_0x89a56){var _0x12ce46=this;return new Promise(function(_0x3988d7,_0x49304f){return db[_0x2c11('0x17')]['findAll']({'raw':_0x89a56[_0x2c11('0x18')]?_0x89a56[_0x2c11('0x18')][_0x2c11('0x19')]===undefined?!![]:![]:!![],'where':_0x89a56[_0x2c11('0x18')]?_0x89a56[_0x2c11('0x18')][_0x2c11('0x1a')]||null:null,'attributes':_0x89a56['options']?_0x89a56['options']['attributes']||null:null,'limit':_0x89a56[_0x2c11('0x18')]?_0x89a56[_0x2c11('0x18')][_0x2c11('0x1b')]||null:null,'include':_0x89a56[_0x2c11('0x18')]?_0x89a56[_0x2c11('0x18')][_0x2c11('0x1c')]?_['map'](_0x89a56[_0x2c11('0x18')][_0x2c11('0x1c')],function(_0x45b96f){return{'model':db[_0x45b96f[_0x2c11('0x1d')]],'as':_0x45b96f['as'],'attributes':_0x45b96f[_0x2c11('0x1e')],'include':_0x45b96f[_0x2c11('0x1c')]?_[_0x2c11('0x1f')](_0x45b96f[_0x2c11('0x1c')],function(_0x107983){return{'model':db[_0x107983[_0x2c11('0x1d')]],'as':_0x107983['as'],'attributes':_0x107983['attributes'],'include':_0x107983[_0x2c11('0x1c')]?_[_0x2c11('0x1f')](_0x107983[_0x2c11('0x1c')],function(_0x308da8){return{'model':db[_0x308da8[_0x2c11('0x1d')]],'as':_0x308da8['as'],'attributes':_0x308da8[_0x2c11('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x51af52){logger[_0x2c11('0x14')](_0x2c11('0x20'),_0x89a56);logger[_0x2c11('0xf')](_0x2c11('0x20'),_0x89a56,JSON[_0x2c11('0x21')](_0x51af52));_0x3988d7(_0x51af52);})[_0x2c11('0x16')](function(_0x2a494f){logger['error'](_0x2c11('0x20'),_0x2a494f[_0x2c11('0x13')],_0x89a56);_0x49304f(_0x12ce46[_0x2c11('0x11')](0x1f4,_0x2a494f[_0x2c11('0x13')]));});});}; \ No newline at end of file +var _0x45c8=['debug','stringify','error','code','message','result','options','raw','where','attributes','include','model','map','GetCampaign','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/environment','jayson/promise','client','request','then','info','Campaign,\x20%s,\x20%s','request\x20sent'];(function(_0x2a12c2,_0x5a05e1){var _0x5b82a7=function(_0x2d8b67){while(--_0x2d8b67){_0x2a12c2['push'](_0x2a12c2['shift']());}};_0x5b82a7(++_0x5a05e1);}(_0x45c8,0xef));var _0x845c=function(_0x12d43e,_0x2bf01d){_0x12d43e=_0x12d43e-0x0;var _0x151008=_0x45c8[_0x12d43e];return _0x151008;};'use strict';var _=require(_0x845c('0x0'));var util=require('util');var moment=require(_0x845c('0x1'));var BPromise=require(_0x845c('0x2'));var rs=require(_0x845c('0x3'));var fs=require('fs');var Redis=require(_0x845c('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x845c('0x5'));var jayson=require(_0x845c('0x6'));var client=jayson[_0x845c('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x335f38,_0x4a1a42,_0x42b569){return new BPromise(function(_0x4648e1,_0x3075cd){return client[_0x845c('0x8')](_0x335f38,_0x42b569)[_0x845c('0x9')](function(_0x34a8ae){logger[_0x845c('0xa')](_0x845c('0xb'),_0x4a1a42,_0x845c('0xc'));logger[_0x845c('0xd')]('Campaign,\x20%s,\x20%s,\x20%s',_0x4a1a42,'request\x20sent',JSON[_0x845c('0xe')](_0x34a8ae));if(_0x34a8ae[_0x845c('0xf')]){if(_0x34a8ae['error'][_0x845c('0x10')]===0x1f4){logger[_0x845c('0xf')](_0x845c('0xb'),_0x4a1a42,_0x34a8ae[_0x845c('0xf')][_0x845c('0x11')]);return _0x3075cd(_0x34a8ae[_0x845c('0xf')]['message']);}logger[_0x845c('0xf')](_0x845c('0xb'),_0x4a1a42,_0x34a8ae['error'][_0x845c('0x11')]);return _0x4648e1(_0x34a8ae[_0x845c('0xf')][_0x845c('0x11')]);}else{logger[_0x845c('0xa')](_0x845c('0xb'),_0x4a1a42,_0x845c('0xc'));_0x4648e1(_0x34a8ae[_0x845c('0x12')]['message']);}})['catch'](function(_0x3b1ff9){logger[_0x845c('0xf')](_0x845c('0xb'),_0x4a1a42,_0x3b1ff9);_0x3075cd(_0x3b1ff9);});});}exports['GetCampaign']=function(_0x1f9bed){var _0x104314=this;return new Promise(function(_0x452b54,_0x48e7d4){return db['Campaign']['findAll']({'raw':_0x1f9bed[_0x845c('0x13')]?_0x1f9bed['options'][_0x845c('0x14')]===undefined?!![]:![]:!![],'where':_0x1f9bed[_0x845c('0x13')]?_0x1f9bed[_0x845c('0x13')][_0x845c('0x15')]||null:null,'attributes':_0x1f9bed[_0x845c('0x13')]?_0x1f9bed['options'][_0x845c('0x16')]||null:null,'limit':_0x1f9bed['options']?_0x1f9bed[_0x845c('0x13')]['limit']||null:null,'include':_0x1f9bed[_0x845c('0x13')]?_0x1f9bed['options'][_0x845c('0x17')]?_['map'](_0x1f9bed[_0x845c('0x13')][_0x845c('0x17')],function(_0x362975){return{'model':db[_0x362975[_0x845c('0x18')]],'as':_0x362975['as'],'attributes':_0x362975[_0x845c('0x16')],'include':_0x362975[_0x845c('0x17')]?_['map'](_0x362975[_0x845c('0x17')],function(_0x5e3ec8){return{'model':db[_0x5e3ec8[_0x845c('0x18')]],'as':_0x5e3ec8['as'],'attributes':_0x5e3ec8[_0x845c('0x16')],'include':_0x5e3ec8['include']?_[_0x845c('0x19')](_0x5e3ec8[_0x845c('0x17')],function(_0x189c19){return{'model':db[_0x189c19['model']],'as':_0x189c19['as'],'attributes':_0x189c19['attributes']};}):[]};}):[]};}):[]:[]})[_0x845c('0x9')](function(_0x2a3c1d){logger[_0x845c('0xa')]('GetCampaign',_0x1f9bed);logger[_0x845c('0xd')](_0x845c('0x1a'),_0x1f9bed,JSON[_0x845c('0xe')](_0x2a3c1d));_0x452b54(_0x2a3c1d);})[_0x845c('0x1b')](function(_0x5d7b58){logger[_0x845c('0xf')](_0x845c('0x1a'),_0x5d7b58[_0x845c('0x11')],_0x1f9bed);_0x48e7d4(_0x104314['error'](0x1f4,_0x5d7b58[_0x845c('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 7c1a73b..8efdee5 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 _0x2cc1=['connect-timeout','express','Router','fs-extra','../../components/auth/service','./campaign.controller','get','/:id','isAuthenticated','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_black','getHopperBlacks','/:id/lists','post','create','/:id/clone','addLists','/:id/blacklists','addBlackLists','put','update','destroy','delete','removeLists','removeBlackLists','multer','util','path'];(function(_0x31edad,_0x1db381){var _0x4453fb=function(_0x5e9f00){while(--_0x5e9f00){_0x31edad['push'](_0x31edad['shift']());}};_0x4453fb(++_0x1db381);}(_0x2cc1,0x1bd));var _0x12cc=function(_0x4ad37c,_0x2e7490){_0x4ad37c=_0x4ad37c-0x0;var _0x288919=_0x2cc1[_0x4ad37c];return _0x288919;};'use strict';var multer=require(_0x12cc('0x0'));var util=require(_0x12cc('0x1'));var path=require(_0x12cc('0x2'));var timeout=require(_0x12cc('0x3'));var express=require(_0x12cc('0x4'));var router=express[_0x12cc('0x5')]();var fs_extra=require(_0x12cc('0x6'));var auth=require(_0x12cc('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x12cc('0x8'));router[_0x12cc('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x12cc('0x9')](_0x12cc('0xa'),auth[_0x12cc('0xb')](),controller[_0x12cc('0xc')]);router[_0x12cc('0x9')](_0x12cc('0xd'),auth[_0x12cc('0xb')](),controller[_0x12cc('0xe')]);router[_0x12cc('0x9')](_0x12cc('0xf'),auth[_0x12cc('0xb')](),controller[_0x12cc('0x10')]);router[_0x12cc('0x9')]('/:id/hopper_finals',auth[_0x12cc('0xb')](),controller['getHopperFinals']);router[_0x12cc('0x9')](_0x12cc('0x11'),auth[_0x12cc('0xb')](),controller[_0x12cc('0x12')]);router[_0x12cc('0x9')](_0x12cc('0x13'),auth['isAuthenticated'](),controller['getLists']);router[_0x12cc('0x9')]('/:id/blacklists',auth[_0x12cc('0xb')](),controller['getBlackLists']);router[_0x12cc('0x14')]('/',auth[_0x12cc('0xb')](),controller[_0x12cc('0x15')]);router[_0x12cc('0x14')](_0x12cc('0x16'),auth[_0x12cc('0xb')](),controller['clone']);router[_0x12cc('0x14')](_0x12cc('0x13'),auth['isAuthenticated'](),controller[_0x12cc('0x17')]);router[_0x12cc('0x14')](_0x12cc('0x18'),auth[_0x12cc('0xb')](),controller[_0x12cc('0x19')]);router[_0x12cc('0x1a')](_0x12cc('0xa'),auth[_0x12cc('0xb')](),controller[_0x12cc('0x1b')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x12cc('0x1c')]);router[_0x12cc('0x1d')](_0x12cc('0x13'),auth[_0x12cc('0xb')](),controller[_0x12cc('0x1e')]);router[_0x12cc('0x1d')](_0x12cc('0x18'),auth[_0x12cc('0xb')](),controller[_0x12cc('0x1f')]);module['exports']=router; \ No newline at end of file +var _0x5947=['../../components/interaction/service','../../config/environment','./campaign.controller','get','isAuthenticated','index','/:id','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_black','getHopperBlacks','/:id/lists','getLists','/:id/blacklists','getBlackLists','post','create','clone','addLists','put','destroy','delete','removeLists','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x4d8b5c,_0x11ec44){var _0x47a1e0=function(_0x752aa9){while(--_0x752aa9){_0x4d8b5c['push'](_0x4d8b5c['shift']());}};_0x47a1e0(++_0x11ec44);}(_0x5947,0x16e));var _0x7594=function(_0x48b479,_0x8f77c7){_0x48b479=_0x48b479-0x0;var _0x3e655f=_0x5947[_0x48b479];return _0x3e655f;};'use strict';var multer=require(_0x7594('0x0'));var util=require(_0x7594('0x1'));var path=require(_0x7594('0x2'));var timeout=require(_0x7594('0x3'));var express=require(_0x7594('0x4'));var router=express[_0x7594('0x5')]();var fs_extra=require(_0x7594('0x6'));var auth=require(_0x7594('0x7'));var interaction=require(_0x7594('0x8'));var config=require(_0x7594('0x9'));var controller=require(_0x7594('0xa'));router[_0x7594('0xb')]('/',auth[_0x7594('0xc')](),controller[_0x7594('0xd')]);router['get'](_0x7594('0xe'),auth['isAuthenticated'](),controller['show']);router[_0x7594('0xb')](_0x7594('0xf'),auth[_0x7594('0xc')](),controller[_0x7594('0x10')]);router[_0x7594('0xb')](_0x7594('0x11'),auth['isAuthenticated'](),controller[_0x7594('0x12')]);router[_0x7594('0xb')]('/:id/hopper_finals',auth[_0x7594('0xc')](),controller['getHopperFinals']);router[_0x7594('0xb')](_0x7594('0x13'),auth[_0x7594('0xc')](),controller[_0x7594('0x14')]);router[_0x7594('0xb')](_0x7594('0x15'),auth[_0x7594('0xc')](),controller[_0x7594('0x16')]);router[_0x7594('0xb')](_0x7594('0x17'),auth[_0x7594('0xc')](),controller[_0x7594('0x18')]);router[_0x7594('0x19')]('/',auth[_0x7594('0xc')](),controller[_0x7594('0x1a')]);router['post']('/:id/clone',auth[_0x7594('0xc')](),controller[_0x7594('0x1b')]);router[_0x7594('0x19')](_0x7594('0x15'),auth['isAuthenticated'](),controller[_0x7594('0x1c')]);router[_0x7594('0x19')](_0x7594('0x17'),auth[_0x7594('0xc')](),controller['addBlackLists']);router[_0x7594('0x1d')]('/:id',auth[_0x7594('0xc')](),controller['update']);router['delete'](_0x7594('0xe'),auth['isAuthenticated'](),controller[_0x7594('0x1e')]);router[_0x7594('0x1f')](_0x7594('0x15'),auth[_0x7594('0xc')](),controller[_0x7594('0x20')]);router[_0x7594('0x1f')](_0x7594('0x17'),auth[_0x7594('0xc')](),controller['removeBlackLists']);module[_0x7594('0x21')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index 1a3543a..d61530b 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 _0xd688=['medium','getDataValue','key','sequelize','exports','STRING','TEXT'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd688,0x122));var _0x8d68=function(_0x348148,_0x5db210){_0x348148=_0x348148-0x0;var _0x31d927=_0xd688[_0x348148];return _0x31d927;};'use strict';var Sequelize=require(_0x8d68('0x0'));module[_0x8d68('0x1')]={'key':{'type':Sequelize[_0x8d68('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0x8d68('0x3')],'length':_0x8d68('0x4'),'allowNull':![]},'description':{'type':Sequelize[_0x8d68('0x2')]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x8d68('0x5')](_0x8d68('0x6'));}}}; \ No newline at end of file +var _0x26e7=['key','sequelize','STRING','medium','VIRTUAL','getDataValue'];(function(_0x537565,_0x381e14){var _0x2c3ba2=function(_0x5b56a4){while(--_0x5b56a4){_0x537565['push'](_0x537565['shift']());}};_0x2c3ba2(++_0x381e14);}(_0x26e7,0x157));var _0x726e=function(_0x4dc7b9,_0x319d5a){_0x4dc7b9=_0x4dc7b9-0x0;var _0x3ab114=_0x26e7[_0x4dc7b9];return _0x3ab114;};'use strict';var Sequelize=require(_0x726e('0x0'));module['exports']={'key':{'type':Sequelize[_0x726e('0x1')],'allowNull':![]},'value':{'type':Sequelize['TEXT'],'length':_0x726e('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x726e('0x1')]},'name':{'type':Sequelize[_0x726e('0x3')],'get':function(){return this[_0x726e('0x4')](_0x726e('0x5'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index b61e3df..faa9327 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 _0x1e97=['save','update','then','get','UserProfileResource','destroy','error','stack','name','map','CannedAnswer','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','where','filter','merge','includeAll','include','rows','params','options','catch','body','find','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','role','UserProfileSection','CannedAnswers','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject'];(function(_0x531622,_0x5d58b7){var _0x32a0fb=function(_0x71ff7e){while(--_0x71ff7e){_0x531622['push'](_0x531622['shift']());}};_0x32a0fb(++_0x5d58b7);}(_0x1e97,0x184));var _0x71e9=function(_0x4e108d,_0x23a861){_0x4e108d=_0x4e108d-0x0;var _0x3b600c=_0x1e97[_0x4e108d];return _0x3b600c;};'use strict';var emlformat=require(_0x71e9('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x71e9('0x1'));var rp=require(_0x71e9('0x2'));var moment=require(_0x71e9('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x71e9('0x4'));var util=require(_0x71e9('0x5'));var path=require(_0x71e9('0x6'));var sox=require('sox');var csv=require(_0x71e9('0x7'));var ejs=require(_0x71e9('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x71e9('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x71e9('0x7'));var querystring=require(_0x71e9('0xa'));var Papa=require('papaparse');var Redis=require(_0x71e9('0xb'));var authService=require(_0x71e9('0xc'));var qs=require(_0x71e9('0xd'));var as=require(_0x71e9('0xe'));var hardwareService=require(_0x71e9('0xf'));var logger=require('../../config/logger')(_0x71e9('0x10'));var utils=require(_0x71e9('0x11'));var config=require(_0x71e9('0x12'));var licenseUtil=require(_0x71e9('0x13'));var db=require(_0x71e9('0x14'))['db'];function respondWithStatusCode(_0x58052b,_0x53f0f6){_0x53f0f6=_0x53f0f6||0xcc;return function(_0x4d9300){if(_0x4d9300){return _0x58052b[_0x71e9('0x15')](_0x53f0f6);}return _0x58052b[_0x71e9('0x16')](_0x53f0f6)[_0x71e9('0x17')]();};}function respondWithResult(_0x4ca779,_0x26f25e){_0x26f25e=_0x26f25e||0xc8;return function(_0x2ae29d){if(_0x2ae29d){return _0x4ca779[_0x71e9('0x16')](_0x26f25e)[_0x71e9('0x18')](_0x2ae29d);}};}function respondWithFilteredResult(_0x481f37,_0x17e77e){return function(_0x37c8b4){if(_0x37c8b4){var _0x1ec2bf=typeof _0x17e77e[_0x71e9('0x19')]===_0x71e9('0x1a')&&typeof _0x17e77e[_0x71e9('0x1b')]===_0x71e9('0x1a');var _0x2f44a0=_0x37c8b4[_0x71e9('0x1c')];var _0x168a89=_0x1ec2bf?0x0:_0x17e77e[_0x71e9('0x19')];var _0x4f6ad1=_0x1ec2bf?_0x37c8b4[_0x71e9('0x1c')]:_0x17e77e[_0x71e9('0x19')]+_0x17e77e[_0x71e9('0x1b')];var _0x5b90c8;if(_0x4f6ad1>=_0x2f44a0){_0x4f6ad1=_0x2f44a0;_0x5b90c8=0xc8;}else{_0x5b90c8=0xce;}_0x481f37[_0x71e9('0x16')](_0x5b90c8);return _0x481f37[_0x71e9('0x1d')](_0x71e9('0x1e'),_0x168a89+'-'+_0x4f6ad1+'/'+_0x2f44a0)['json'](_0x37c8b4);}return null;};}function patchUpdates(_0xc7a16f){return function(_0x3028ba){try{jsonpatch['apply'](_0x3028ba,_0xc7a16f,!![]);}catch(_0xa7c922){return BPromise[_0x71e9('0x1f')](_0xa7c922);}return _0x3028ba[_0x71e9('0x20')]();};}function saveUpdates(_0x1c0b91,_0x327dc4){return function(_0x5f14e7){if(_0x5f14e7){return _0x5f14e7[_0x71e9('0x21')](_0x1c0b91)['then'](function(_0xdb2a2){return _0xdb2a2;});}return null;};}function removeEntity(_0x3ae27f,_0x4ab5c5){return function(_0x56a8cd){if(_0x56a8cd){return _0x56a8cd['destroy']()[_0x71e9('0x22')](function(){var _0x57d8ee=_0x56a8cd[_0x71e9('0x23')]({'plain':!![]});var _0x3cce41='CannedAnswers';return db[_0x71e9('0x24')][_0x71e9('0x25')]({'where':{'type':_0x3cce41,'resourceId':_0x57d8ee['id']}})['then'](function(){return _0x56a8cd;});})[_0x71e9('0x22')](function(){_0x3ae27f[_0x71e9('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3417dc,_0x4fd560){return function(_0x284fe7){if(!_0x284fe7){_0x3417dc[_0x71e9('0x15')](0x194);}return _0x284fe7;};}function handleError(_0x2ccdc0,_0x3681e7){_0x3681e7=_0x3681e7||0x1f4;return function(_0x5a16d8){logger[_0x71e9('0x26')](_0x5a16d8[_0x71e9('0x27')]);if(_0x5a16d8['name']){delete _0x5a16d8[_0x71e9('0x28')];}_0x2ccdc0[_0x71e9('0x16')](_0x3681e7)['send'](_0x5a16d8);};}exports['index']=function(_0x9dd0c,_0xc5dde7){var _0xce1af6={},_0x4a6062={},_0x6f4294={'count':0x0,'rows':[]};var _0x3a4410=_[_0x71e9('0x29')](db[_0x71e9('0x2a')][_0x71e9('0x2b')],function(_0x218506){return{'name':_0x218506[_0x71e9('0x2c')],'type':_0x218506[_0x71e9('0x2d')][_0x71e9('0x2e')]};});_0x4a6062['model']=_[_0x71e9('0x29')](_0x3a4410,'name');_0x4a6062[_0x71e9('0x2f')]=_[_0x71e9('0x30')](_0x9dd0c[_0x71e9('0x2f')]);_0x4a6062[_0x71e9('0x31')]=_[_0x71e9('0x32')](_0x4a6062[_0x71e9('0x33')],_0x4a6062[_0x71e9('0x2f')]);_0xce1af6['attributes']=_[_0x71e9('0x32')](_0x4a6062[_0x71e9('0x33')],qs[_0x71e9('0x34')](_0x9dd0c[_0x71e9('0x2f')][_0x71e9('0x34')]));_0xce1af6[_0x71e9('0x35')]=_0xce1af6[_0x71e9('0x35')][_0x71e9('0x36')]?_0xce1af6[_0x71e9('0x35')]:_0x4a6062['model'];if(!_0x9dd0c[_0x71e9('0x2f')][_0x71e9('0x37')](_0x71e9('0x38'))){_0xce1af6['limit']=qs['limit'](_0x9dd0c[_0x71e9('0x2f')][_0x71e9('0x1b')]);_0xce1af6[_0x71e9('0x19')]=qs['offset'](_0x9dd0c['query'][_0x71e9('0x19')]);}_0xce1af6[_0x71e9('0x39')]=qs['sort'](_0x9dd0c[_0x71e9('0x2f')][_0x71e9('0x3a')]);_0xce1af6['where']=qs[_0x71e9('0x31')](_[_0x71e9('0x3b')](_0x9dd0c[_0x71e9('0x2f')],_0x4a6062['filters']),_0x3a4410);if(_0x9dd0c[_0x71e9('0x2f')]['filter']){_0xce1af6['where']=_['merge'](_0xce1af6[_0x71e9('0x3c')],{'$or':[{'key':{'$like':'%'+_0x9dd0c[_0x71e9('0x2f')][_0x71e9('0x3d')]+'%'}},{'value':{'$like':'%'+_0x9dd0c['query'][_0x71e9('0x3d')]+'%'}}]});}_0xce1af6=_[_0x71e9('0x3e')]({},_0xce1af6,_0x9dd0c['options']);var _0x5d991c={'where':_0xce1af6[_0x71e9('0x3c')]};return db[_0x71e9('0x2a')][_0x71e9('0x1c')](_0x5d991c)[_0x71e9('0x22')](function(_0x1d87a7){_0x6f4294[_0x71e9('0x1c')]=_0x1d87a7;if(_0x9dd0c[_0x71e9('0x2f')][_0x71e9('0x3f')]){_0xce1af6[_0x71e9('0x40')]=[{'all':!![]}];}return db[_0x71e9('0x2a')]['findAll'](_0xce1af6);})[_0x71e9('0x22')](function(_0x4ba93d){_0x6f4294[_0x71e9('0x41')]=_0x4ba93d;return _0x6f4294;})[_0x71e9('0x22')](respondWithFilteredResult(_0xc5dde7,_0xce1af6))['catch'](handleError(_0xc5dde7,null));};exports['show']=function(_0x50c23d,_0x369144){var _0x58dc44={'raw':!![],'where':{'id':_0x50c23d[_0x71e9('0x42')]['id']}},_0x8a9c89={};_0x8a9c89[_0x71e9('0x33')]=_[_0x71e9('0x30')](db['CannedAnswer'][_0x71e9('0x2b')]);_0x8a9c89[_0x71e9('0x2f')]=_[_0x71e9('0x30')](_0x50c23d['query']);_0x8a9c89['filters']=_['intersection'](_0x8a9c89[_0x71e9('0x33')],_0x8a9c89[_0x71e9('0x2f')]);_0x58dc44[_0x71e9('0x35')]=_[_0x71e9('0x32')](_0x8a9c89['model'],qs['fields'](_0x50c23d[_0x71e9('0x2f')][_0x71e9('0x34')]));_0x58dc44['attributes']=_0x58dc44[_0x71e9('0x35')]['length']?_0x58dc44[_0x71e9('0x35')]:_0x8a9c89['model'];if(_0x50c23d[_0x71e9('0x2f')]['includeAll']){_0x58dc44['include']=[{'all':!![]}];}_0x58dc44=_['merge']({},_0x58dc44,_0x50c23d[_0x71e9('0x43')]);return db[_0x71e9('0x2a')]['find'](_0x58dc44)['then'](handleEntityNotFound(_0x369144,null))[_0x71e9('0x22')](respondWithResult(_0x369144,null))[_0x71e9('0x44')](handleError(_0x369144,null));};exports[_0x71e9('0x21')]=function(_0x10054e,_0x632b6d){if(_0x10054e[_0x71e9('0x45')]['id']){delete _0x10054e[_0x71e9('0x45')]['id'];}return db[_0x71e9('0x2a')][_0x71e9('0x46')]({'where':{'id':_0x10054e[_0x71e9('0x42')]['id']}})[_0x71e9('0x22')](handleEntityNotFound(_0x632b6d,null))['then'](saveUpdates(_0x10054e['body'],null))[_0x71e9('0x22')](respondWithResult(_0x632b6d,null))[_0x71e9('0x44')](handleError(_0x632b6d,null));};exports[_0x71e9('0x25')]=function(_0x1e2565,_0x14044c){return db[_0x71e9('0x2a')]['find']({'where':{'id':_0x1e2565['params']['id']}})['then'](handleEntityNotFound(_0x14044c,null))[_0x71e9('0x22')](removeEntity(_0x14044c,null))[_0x71e9('0x44')](handleError(_0x14044c,null));};exports[_0x71e9('0x47')]=function(_0x1d9582,_0x5a837b){var _0x17fc10={'key':_0x1d9582[_0x71e9('0x45')][_0x71e9('0x2e')]};if(_0x1d9582[_0x71e9('0x45')]['MailAccountId']){_0x17fc10[_0x71e9('0x48')]=_0x1d9582[_0x71e9('0x45')][_0x71e9('0x48')];}else if(_0x1d9582[_0x71e9('0x45')][_0x71e9('0x49')]){_0x17fc10[_0x71e9('0x49')]=_0x1d9582[_0x71e9('0x45')]['SmsAccountId'];}else if(_0x1d9582['body'][_0x71e9('0x4a')]){_0x17fc10[_0x71e9('0x4a')]=_0x1d9582[_0x71e9('0x45')]['OpenchannelAccountId'];}else if(_0x1d9582[_0x71e9('0x45')][_0x71e9('0x4b')]){_0x17fc10[_0x71e9('0x4b')]=_0x1d9582['body'][_0x71e9('0x4b')];}return db[_0x71e9('0x2a')]['find']({'where':_0x17fc10})['then'](function(_0x44bc05){if(_0x44bc05){throw new db[(_0x71e9('0x4c'))][(_0x71e9('0x4d'))](_0x71e9('0x4e'));}return db[_0x71e9('0x2a')][_0x71e9('0x47')](_0x1d9582[_0x71e9('0x45')]);})[_0x71e9('0x22')](function(_0x509edd){var _0x1d8fc9=_0x1d9582[_0x71e9('0x4f')][_0x71e9('0x23')]({'plain':!![]});if(!_0x1d8fc9)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1d8fc9[_0x71e9('0x50')]===_0x71e9('0x4f')){var _0x2bccc9=_0x509edd[_0x71e9('0x23')]({'plain':!![]});return db[_0x71e9('0x51')]['find']({'where':{'name':_0x71e9('0x52'),'userProfileId':_0x1d8fc9['userProfileId']},'raw':!![]})['then'](function(_0x7a8fa8){if(_0x7a8fa8&&_0x7a8fa8['autoAssociation']===0x0){return db[_0x71e9('0x24')][_0x71e9('0x47')]({'name':_0x2bccc9[_0x71e9('0x28')],'resourceId':_0x2bccc9['id'],'type':_0x7a8fa8[_0x71e9('0x28')],'sectionId':_0x7a8fa8['id']},{})['then'](function(){return _0x509edd;});}else{return _0x509edd;}})[_0x71e9('0x44')](function(_0x31205f){logger[_0x71e9('0x26')](_0x71e9('0x53'),_0x31205f);throw _0x31205f;});}return _0x509edd;})[_0x71e9('0x22')](respondWithResult(_0x5a837b,0xc9))['catch'](handleError(_0x5a837b,null));}; \ No newline at end of file +var _0x98f3=['request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','count','set','reject','then','destroy','CannedAnswers','UserProfileResource','error','name','send','index','map','CannedAnswer','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','findAll','rows','catch','show','params','includeAll','body','find','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x240329,_0x52e261){var _0x1acda1=function(_0x552eac){while(--_0x552eac){_0x240329['push'](_0x240329['shift']());}};_0x1acda1(++_0x52e261);}(_0x98f3,0xa4));var _0x398f=function(_0x3938d2,_0x8e9793){_0x3938d2=_0x3938d2-0x0;var _0x45513c=_0x98f3[_0x3938d2];return _0x45513c;};'use strict';var emlformat=require(_0x398f('0x0'));var rimraf=require(_0x398f('0x1'));var zipdir=require(_0x398f('0x2'));var jsonpatch=require(_0x398f('0x3'));var rp=require(_0x398f('0x4'));var moment=require(_0x398f('0x5'));var BPromise=require(_0x398f('0x6'));var Mustache=require(_0x398f('0x7'));var util=require(_0x398f('0x8'));var path=require(_0x398f('0x9'));var sox=require('sox');var csv=require(_0x398f('0xa'));var ejs=require(_0x398f('0xb'));var fs=require('fs');var fs_extra=require(_0x398f('0xc'));var _=require('lodash');var squel=require(_0x398f('0xd'));var crypto=require(_0x398f('0xe'));var jsforce=require(_0x398f('0xf'));var deskjs=require(_0x398f('0x10'));var toCsv=require(_0x398f('0xa'));var querystring=require(_0x398f('0x11'));var Papa=require(_0x398f('0x12'));var Redis=require(_0x398f('0x13'));var authService=require(_0x398f('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x398f('0x15'));var hardwareService=require(_0x398f('0x16'));var logger=require(_0x398f('0x17'))(_0x398f('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x398f('0x19'));var db=require(_0x398f('0x1a'))['db'];function respondWithStatusCode(_0x428932,_0xfe6bc1){_0xfe6bc1=_0xfe6bc1||0xcc;return function(_0x1e4512){if(_0x1e4512){return _0x428932[_0x398f('0x1b')](_0xfe6bc1);}return _0x428932['status'](_0xfe6bc1)[_0x398f('0x1c')]();};}function respondWithResult(_0x37afdc,_0x2da765){_0x2da765=_0x2da765||0xc8;return function(_0x5efc09){if(_0x5efc09){return _0x37afdc[_0x398f('0x1d')](_0x2da765)[_0x398f('0x1e')](_0x5efc09);}};}function respondWithFilteredResult(_0x62215f,_0x10f60c){return function(_0x22ba04){if(_0x22ba04){var _0x10da6d=typeof _0x10f60c[_0x398f('0x1f')]==='undefined'&&typeof _0x10f60c[_0x398f('0x20')]==='undefined';var _0x3b4479=_0x22ba04[_0x398f('0x21')];var _0x534e7e=_0x10da6d?0x0:_0x10f60c[_0x398f('0x1f')];var _0x1f7586=_0x10da6d?_0x22ba04[_0x398f('0x21')]:_0x10f60c['offset']+_0x10f60c[_0x398f('0x20')];var _0x4d7289;if(_0x1f7586>=_0x3b4479){_0x1f7586=_0x3b4479;_0x4d7289=0xc8;}else{_0x4d7289=0xce;}_0x62215f[_0x398f('0x1d')](_0x4d7289);return _0x62215f[_0x398f('0x22')]('Content-Range',_0x534e7e+'-'+_0x1f7586+'/'+_0x3b4479)[_0x398f('0x1e')](_0x22ba04);}return null;};}function patchUpdates(_0x186475){return function(_0x55311b){try{jsonpatch['apply'](_0x55311b,_0x186475,!![]);}catch(_0x41b123){return BPromise[_0x398f('0x23')](_0x41b123);}return _0x55311b['save']();};}function saveUpdates(_0x559261,_0x47229e){return function(_0x1db0ae){if(_0x1db0ae){return _0x1db0ae['update'](_0x559261)[_0x398f('0x24')](function(_0x5c50c7){return _0x5c50c7;});}return null;};}function removeEntity(_0x2e128b,_0x467fa6){return function(_0x4fc1f2){if(_0x4fc1f2){return _0x4fc1f2[_0x398f('0x25')]()[_0x398f('0x24')](function(){var _0x4cd672=_0x4fc1f2['get']({'plain':!![]});var _0x306707=_0x398f('0x26');return db[_0x398f('0x27')][_0x398f('0x25')]({'where':{'type':_0x306707,'resourceId':_0x4cd672['id']}})[_0x398f('0x24')](function(){return _0x4fc1f2;});})[_0x398f('0x24')](function(){_0x2e128b[_0x398f('0x1d')](0xcc)[_0x398f('0x1c')]();});}};}function handleEntityNotFound(_0x45dd7d,_0x140ca9){return function(_0x143502){if(!_0x143502){_0x45dd7d[_0x398f('0x1b')](0x194);}return _0x143502;};}function handleError(_0x23284c,_0x376be9){_0x376be9=_0x376be9||0x1f4;return function(_0x368658){logger[_0x398f('0x28')](_0x368658['stack']);if(_0x368658[_0x398f('0x29')]){delete _0x368658['name'];}_0x23284c[_0x398f('0x1d')](_0x376be9)[_0x398f('0x2a')](_0x368658);};}exports[_0x398f('0x2b')]=function(_0xa47236,_0x532b31){var _0x51c83a={},_0x145a39={},_0x220bce={'count':0x0,'rows':[]};var _0x1e3edc=_[_0x398f('0x2c')](db[_0x398f('0x2d')]['rawAttributes'],function(_0x226100){return{'name':_0x226100['fieldName'],'type':_0x226100[_0x398f('0x2e')][_0x398f('0x2f')]};});_0x145a39['model']=_[_0x398f('0x2c')](_0x1e3edc,_0x398f('0x29'));_0x145a39[_0x398f('0x30')]=_[_0x398f('0x31')](_0xa47236[_0x398f('0x30')]);_0x145a39[_0x398f('0x32')]=_[_0x398f('0x33')](_0x145a39[_0x398f('0x34')],_0x145a39[_0x398f('0x30')]);_0x51c83a['attributes']=_[_0x398f('0x33')](_0x145a39[_0x398f('0x34')],qs[_0x398f('0x35')](_0xa47236[_0x398f('0x30')][_0x398f('0x35')]));_0x51c83a[_0x398f('0x36')]=_0x51c83a['attributes'][_0x398f('0x37')]?_0x51c83a[_0x398f('0x36')]:_0x145a39['model'];if(!_0xa47236['query'][_0x398f('0x38')](_0x398f('0x39'))){_0x51c83a[_0x398f('0x20')]=qs[_0x398f('0x20')](_0xa47236[_0x398f('0x30')][_0x398f('0x20')]);_0x51c83a[_0x398f('0x1f')]=qs[_0x398f('0x1f')](_0xa47236[_0x398f('0x30')][_0x398f('0x1f')]);}_0x51c83a[_0x398f('0x3a')]=qs[_0x398f('0x3b')](_0xa47236['query'][_0x398f('0x3b')]);_0x51c83a[_0x398f('0x3c')]=qs[_0x398f('0x32')](_[_0x398f('0x3d')](_0xa47236['query'],_0x145a39[_0x398f('0x32')]),_0x1e3edc);if(_0xa47236[_0x398f('0x30')][_0x398f('0x3e')]){_0x51c83a[_0x398f('0x3c')]=_[_0x398f('0x3f')](_0x51c83a[_0x398f('0x3c')],{'$or':[{'key':{'$like':'%'+_0xa47236[_0x398f('0x30')]['filter']+'%'}},{'value':{'$like':'%'+_0xa47236[_0x398f('0x30')][_0x398f('0x3e')]+'%'}}]});}_0x51c83a=_['merge']({},_0x51c83a,_0xa47236[_0x398f('0x40')]);var _0x5ee487={'where':_0x51c83a[_0x398f('0x3c')]};return db[_0x398f('0x2d')][_0x398f('0x21')](_0x5ee487)[_0x398f('0x24')](function(_0x2cd78d){_0x220bce['count']=_0x2cd78d;if(_0xa47236[_0x398f('0x30')]['includeAll']){_0x51c83a['include']=[{'all':!![]}];}return db['CannedAnswer'][_0x398f('0x41')](_0x51c83a);})[_0x398f('0x24')](function(_0x211c68){_0x220bce[_0x398f('0x42')]=_0x211c68;return _0x220bce;})[_0x398f('0x24')](respondWithFilteredResult(_0x532b31,_0x51c83a))[_0x398f('0x43')](handleError(_0x532b31,null));};exports[_0x398f('0x44')]=function(_0x2bafe8,_0x263563){var _0x34ec93={'raw':!![],'where':{'id':_0x2bafe8[_0x398f('0x45')]['id']}},_0x481bbf={};_0x481bbf[_0x398f('0x34')]=_['keys'](db[_0x398f('0x2d')]['rawAttributes']);_0x481bbf[_0x398f('0x30')]=_['keys'](_0x2bafe8[_0x398f('0x30')]);_0x481bbf[_0x398f('0x32')]=_[_0x398f('0x33')](_0x481bbf['model'],_0x481bbf['query']);_0x34ec93[_0x398f('0x36')]=_['intersection'](_0x481bbf['model'],qs[_0x398f('0x35')](_0x2bafe8[_0x398f('0x30')]['fields']));_0x34ec93['attributes']=_0x34ec93[_0x398f('0x36')]['length']?_0x34ec93[_0x398f('0x36')]:_0x481bbf[_0x398f('0x34')];if(_0x2bafe8[_0x398f('0x30')][_0x398f('0x46')]){_0x34ec93['include']=[{'all':!![]}];}_0x34ec93=_[_0x398f('0x3f')]({},_0x34ec93,_0x2bafe8[_0x398f('0x40')]);return db[_0x398f('0x2d')]['find'](_0x34ec93)[_0x398f('0x24')](handleEntityNotFound(_0x263563,null))[_0x398f('0x24')](respondWithResult(_0x263563,null))[_0x398f('0x43')](handleError(_0x263563,null));};exports['update']=function(_0x2df3d0,_0x48cf37){if(_0x2df3d0[_0x398f('0x47')]['id']){delete _0x2df3d0[_0x398f('0x47')]['id'];}return db[_0x398f('0x2d')][_0x398f('0x48')]({'where':{'id':_0x2df3d0[_0x398f('0x45')]['id']}})[_0x398f('0x24')](handleEntityNotFound(_0x48cf37,null))['then'](saveUpdates(_0x2df3d0[_0x398f('0x47')],null))[_0x398f('0x24')](respondWithResult(_0x48cf37,null))[_0x398f('0x43')](handleError(_0x48cf37,null));};exports[_0x398f('0x25')]=function(_0x5bef1e,_0x1beb10){return db[_0x398f('0x2d')][_0x398f('0x48')]({'where':{'id':_0x5bef1e[_0x398f('0x45')]['id']}})[_0x398f('0x24')](handleEntityNotFound(_0x1beb10,null))['then'](removeEntity(_0x1beb10,null))['catch'](handleError(_0x1beb10,null));};exports[_0x398f('0x49')]=function(_0x27dfca,_0x5d103b){var _0x2ae774={'key':_0x27dfca[_0x398f('0x47')][_0x398f('0x2f')]};if(_0x27dfca[_0x398f('0x47')][_0x398f('0x4a')]){_0x2ae774[_0x398f('0x4a')]=_0x27dfca[_0x398f('0x47')][_0x398f('0x4a')];}else if(_0x27dfca[_0x398f('0x47')]['SmsAccountId']){_0x2ae774[_0x398f('0x4b')]=_0x27dfca[_0x398f('0x47')][_0x398f('0x4b')];}else if(_0x27dfca['body'][_0x398f('0x4c')]){_0x2ae774[_0x398f('0x4c')]=_0x27dfca[_0x398f('0x47')][_0x398f('0x4c')];}else if(_0x27dfca[_0x398f('0x47')][_0x398f('0x4d')]){_0x2ae774['ChatWebsiteId']=_0x27dfca['body'][_0x398f('0x4d')];}return db['CannedAnswer'][_0x398f('0x48')]({'where':_0x2ae774})['then'](function(_0x4f252d){if(_0x4f252d){throw new db['Sequelize']['ValidationError']('The\x20inserted\x20key\x20already\x20exists.');}return db['CannedAnswer']['create'](_0x27dfca[_0x398f('0x47')]);})[_0x398f('0x24')](function(_0x22ed0e){var _0x3033a6=_0x27dfca['user'][_0x398f('0x4e')]({'plain':!![]});if(!_0x3033a6)throw new Error(_0x398f('0x4f'));if(_0x3033a6[_0x398f('0x50')]===_0x398f('0x51')){var _0x5ad9be=_0x22ed0e['get']({'plain':!![]});return db['UserProfileSection'][_0x398f('0x48')]({'where':{'name':'CannedAnswers','userProfileId':_0x3033a6[_0x398f('0x52')]},'raw':!![]})[_0x398f('0x24')](function(_0x1791d3){if(_0x1791d3&&_0x1791d3[_0x398f('0x53')]===0x0){return db[_0x398f('0x27')][_0x398f('0x49')]({'name':_0x5ad9be['name'],'resourceId':_0x5ad9be['id'],'type':_0x1791d3['name'],'sectionId':_0x1791d3['id']},{})['then'](function(){return _0x22ed0e;});}else{return _0x22ed0e;}})['catch'](function(_0x31f6e8){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x31f6e8);throw _0x31f6e8;});}return _0x22ed0e;})[_0x398f('0x24')](respondWithResult(_0x5d103b,0xc9))[_0x398f('0x43')](handleError(_0x5d103b,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index f33231c..766e27b 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 _0xdb3e=['CannedAnswer','utf8mb4_unicode_ci','util','api','moment','bluebird','path','rimraf','../../config/environment','./cannedAnswer.attributes','exports','define'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdb3e,0x1e2));var _0xedb3=function(_0x5453ef,_0x176f82){_0x5453ef=_0x5453ef-0x0;var _0x5b4260=_0xdb3e[_0x5453ef];return _0x5b4260;};'use strict';var _=require('lodash');var util=require(_0xedb3('0x0'));var logger=require('../../config/logger')(_0xedb3('0x1'));var moment=require(_0xedb3('0x2'));var BPromise=require(_0xedb3('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xedb3('0x4'));var rimraf=require(_0xedb3('0x5'));var config=require(_0xedb3('0x6'));var attributes=require(_0xedb3('0x7'));module[_0xedb3('0x8')]=function(_0x38cc0f,_0x39a058){return _0x38cc0f[_0xedb3('0x9')](_0xedb3('0xa'),attributes,{'tableName':'tools_canned_answers','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xedb3('0xb')});}; \ No newline at end of file +var _0x9ec6=['utf8mb4','utf8mb4_unicode_ci','util','request-promise','path','rimraf','../../config/environment','./cannedAnswer.attributes','exports','CannedAnswer','tools_canned_answers'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x9ec6,0x136));var _0x69ec=function(_0x334651,_0x6e99f6){_0x334651=_0x334651-0x0;var _0x29657c=_0x9ec6[_0x334651];return _0x29657c;};'use strict';var _=require('lodash');var util=require(_0x69ec('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x69ec('0x1'));var fs=require('fs');var path=require(_0x69ec('0x2'));var rimraf=require(_0x69ec('0x3'));var config=require(_0x69ec('0x4'));var attributes=require(_0x69ec('0x5'));module[_0x69ec('0x6')]=function(_0x5d95fa,_0x52206f){return _0x5d95fa['define'](_0x69ec('0x7'),attributes,{'tableName':_0x69ec('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x69ec('0x9'),'collate':_0x69ec('0xa')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index ce62ddf..21d4c0d 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(_0x1404ae,_0x56f6aa){var _0x53ef53=function(_0x2c9c71){while(--_0x2c9c71){_0x1404ae['push'](_0x1404ae['shift']());}};_0x53ef53(++_0x56f6aa);}(_0xa9e0,0x123));var _0x0a9e=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0xa9e0[_0x134c2e];return _0x2825db;};'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(_0x1c81b9,_0x54b5d9){var _0x42dd54=function(_0x16113a){while(--_0x16113a){_0x1c81b9['push'](_0x1c81b9['shift']());}};_0x42dd54(++_0x54b5d9);}(_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 diff --git a/server/api/cannedAnswer/index.js b/server/api/cannedAnswer/index.js index a02d16b..f9cac77 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 _0xe37a=['express','Router','fs-extra','../../components/auth/service','../../config/environment','./cannedAnswer.controller','get','isAuthenticated','/:id','show','create','update','delete','destroy','exports','multer','util','path'];(function(_0x28e74e,_0x53fdf1){var _0xb45ac1=function(_0x311a7a){while(--_0x311a7a){_0x28e74e['push'](_0x28e74e['shift']());}};_0xb45ac1(++_0x53fdf1);}(_0xe37a,0x69));var _0xae37=function(_0x801858,_0x5d6867){_0x801858=_0x801858-0x0;var _0xff36a5=_0xe37a[_0x801858];return _0xff36a5;};'use strict';var multer=require(_0xae37('0x0'));var util=require(_0xae37('0x1'));var path=require(_0xae37('0x2'));var timeout=require('connect-timeout');var express=require(_0xae37('0x3'));var router=express[_0xae37('0x4')]();var fs_extra=require(_0xae37('0x5'));var auth=require(_0xae37('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xae37('0x7'));var controller=require(_0xae37('0x8'));router[_0xae37('0x9')]('/',auth[_0xae37('0xa')](),controller['index']);router[_0xae37('0x9')](_0xae37('0xb'),auth[_0xae37('0xa')](),controller[_0xae37('0xc')]);router['post']('/',auth[_0xae37('0xa')](),controller[_0xae37('0xd')]);router['put']('/:id',auth[_0xae37('0xa')](),controller[_0xae37('0xe')]);router[_0xae37('0xf')](_0xae37('0xb'),auth['isAuthenticated'](),controller[_0xae37('0x10')]);module[_0xae37('0x11')]=router; \ No newline at end of file +var _0x9cdf=['get','index','isAuthenticated','show','post','create','put','/:id','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cannedAnswer.controller'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x9cdf,0x129));var _0xf9cd=function(_0x48f681,_0x53e162){_0x48f681=_0x48f681-0x0;var _0x16631d=_0x9cdf[_0x48f681];return _0x16631d;};'use strict';var multer=require(_0xf9cd('0x0'));var util=require(_0xf9cd('0x1'));var path=require(_0xf9cd('0x2'));var timeout=require(_0xf9cd('0x3'));var express=require(_0xf9cd('0x4'));var router=express[_0xf9cd('0x5')]();var fs_extra=require(_0xf9cd('0x6'));var auth=require(_0xf9cd('0x7'));var interaction=require(_0xf9cd('0x8'));var config=require(_0xf9cd('0x9'));var controller=require(_0xf9cd('0xa'));router[_0xf9cd('0xb')]('/',auth['isAuthenticated'](),controller[_0xf9cd('0xc')]);router['get']('/:id',auth[_0xf9cd('0xd')](),controller[_0xf9cd('0xe')]);router[_0xf9cd('0xf')]('/',auth[_0xf9cd('0xd')](),controller[_0xf9cd('0x10')]);router[_0xf9cd('0x11')](_0xf9cd('0x12'),auth[_0xf9cd('0xd')](),controller[_0xf9cd('0x13')]);router[_0xf9cd('0x14')](_0xf9cd('0x12'),auth[_0xf9cd('0xd')](),controller[_0xf9cd('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index 8f4b679..aecac10 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 _0x7d51=['INTEGER','sequelize','exports','STRING'];(function(_0x43d3fb,_0x2a7eca){var _0x42430a=function(_0x5241c0){while(--_0x5241c0){_0x43d3fb['push'](_0x43d3fb['shift']());}};_0x42430a(++_0x2a7eca);}(_0x7d51,0x1e9));var _0x17d5=function(_0x38134d,_0x1bd7c6){_0x38134d=_0x38134d-0x0;var _0x605689=_0x7d51[_0x38134d];return _0x605689;};'use strict';var Sequelize=require(_0x17d5('0x0'));module[_0x17d5('0x1')]={'calldate':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':'1970-01-01\x2000:00:01'},'clid':{'type':Sequelize[_0x17d5('0x2')]},'src':{'type':Sequelize['STRING']},'dst':{'type':Sequelize[_0x17d5('0x2')]},'dcontext':{'type':Sequelize[_0x17d5('0x2')]},'channel':{'type':Sequelize[_0x17d5('0x2')]},'dstchannel':{'type':Sequelize[_0x17d5('0x2')]},'lastapp':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize['STRING']},'duration':{'type':Sequelize[_0x17d5('0x3')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x17d5('0x3')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x17d5('0x2')]},'amaflags':{'type':Sequelize[_0x17d5('0x3')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x17d5('0x2')]},'userfield':{'type':Sequelize[_0x17d5('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0x17d5('0x2')]},'sequence':{'type':Sequelize[_0x17d5('0x2')]},'peeraccount':{'type':Sequelize[_0x17d5('0x2')]},'type':{'type':Sequelize[_0x17d5('0x2')]},'tag':{'type':Sequelize[_0x17d5('0x2')]}}; \ No newline at end of file +var _0xf150=['STRING','INTEGER','sequelize','exports','DATE'];(function(_0x3b231a,_0x53a00d){var _0x18d67a=function(_0x5e14c6){while(--_0x5e14c6){_0x3b231a['push'](_0x3b231a['shift']());}};_0x18d67a(++_0x53a00d);}(_0xf150,0x106));var _0x0f15=function(_0x114320,_0x2a04f2){_0x114320=_0x114320-0x0;var _0x1ff9fe=_0xf150[_0x114320];return _0x1ff9fe;};'use strict';var Sequelize=require(_0x0f15('0x0'));module[_0x0f15('0x1')]={'calldate':{'type':Sequelize[_0x0f15('0x2')],'allowNull':![],'defaultValue':'1970-01-01\x2000:00:01'},'clid':{'type':Sequelize[_0x0f15('0x3')]},'src':{'type':Sequelize[_0x0f15('0x3')]},'dst':{'type':Sequelize[_0x0f15('0x3')]},'dcontext':{'type':Sequelize[_0x0f15('0x3')]},'channel':{'type':Sequelize[_0x0f15('0x3')]},'dstchannel':{'type':Sequelize[_0x0f15('0x3')]},'lastapp':{'type':Sequelize[_0x0f15('0x3')]},'lastdata':{'type':Sequelize[_0x0f15('0x3')]},'duration':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x0f15('0x3')]},'amaflags':{'type':Sequelize[_0x0f15('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x0f15('0x3')]},'userfield':{'type':Sequelize[_0x0f15('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0x0f15('0x3')]},'sequence':{'type':Sequelize['STRING']},'peeraccount':{'type':Sequelize[_0x0f15('0x3')]},'type':{'type':Sequelize[_0x0f15('0x3')]},'tag':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index 4de9ce8..7b2408a 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 _0x919e=['Cdr','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','find','body','describe','eml-format','rimraf','zip-dir','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','update','then','destroy','sendStatus','error','name','send','map'];(function(_0x59771d,_0xa61611){var _0x4abb3d=function(_0xeba7e6){while(--_0xeba7e6){_0x59771d['push'](_0x59771d['shift']());}};_0x4abb3d(++_0xa61611);}(_0x919e,0x1d7));var _0xe919=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x919e[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0xe919('0x0'));var rimraf=require(_0xe919('0x1'));var zipdir=require(_0xe919('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe919('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xe919('0x4'));var util=require(_0xe919('0x5'));var path=require(_0xe919('0x6'));var sox=require(_0xe919('0x7'));var csv=require(_0xe919('0x8'));var ejs=require(_0xe919('0x9'));var fs=require('fs');var fs_extra=require(_0xe919('0xa'));var _=require('lodash');var squel=require(_0xe919('0xb'));var crypto=require(_0xe919('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xe919('0xd'));var toCsv=require('to-csv');var querystring=require(_0xe919('0xe'));var Papa=require(_0xe919('0xf'));var Redis=require(_0xe919('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xe919('0x11'));var as=require(_0xe919('0x12'));var hardwareService=require(_0xe919('0x13'));var logger=require('../../config/logger')(_0xe919('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xe919('0x15'))['db'];function respondWithStatusCode(_0xb06def,_0x40d013){_0x40d013=_0x40d013||0xcc;return function(_0x525f3e){if(_0x525f3e){return _0xb06def['sendStatus'](_0x40d013);}return _0xb06def[_0xe919('0x16')](_0x40d013)[_0xe919('0x17')]();};}function respondWithResult(_0x5c44d4,_0x3c09be){_0x3c09be=_0x3c09be||0xc8;return function(_0x1f88a0){if(_0x1f88a0){return _0x5c44d4[_0xe919('0x16')](_0x3c09be)[_0xe919('0x18')](_0x1f88a0);}};}function respondWithFilteredResult(_0x1e2bdd,_0x20d095){return function(_0x33b067){if(_0x33b067){var _0x5768f8=typeof _0x20d095[_0xe919('0x19')]==='undefined'&&typeof _0x20d095['limit']===_0xe919('0x1a');var _0x1ca098=_0x33b067['count'];var _0x4b3ea3=_0x5768f8?0x0:_0x20d095['offset'];var _0x1c820f=_0x5768f8?_0x33b067[_0xe919('0x1b')]:_0x20d095[_0xe919('0x19')]+_0x20d095[_0xe919('0x1c')];var _0x4a6945;if(_0x1c820f>=_0x1ca098){_0x1c820f=_0x1ca098;_0x4a6945=0xc8;}else{_0x4a6945=0xce;}_0x1e2bdd['status'](_0x4a6945);return _0x1e2bdd[_0xe919('0x1d')](_0xe919('0x1e'),_0x4b3ea3+'-'+_0x1c820f+'/'+_0x1ca098)[_0xe919('0x18')](_0x33b067);}return null;};}function patchUpdates(_0xd2a816){return function(_0x48d99f){try{jsonpatch[_0xe919('0x1f')](_0x48d99f,_0xd2a816,!![]);}catch(_0xc39074){return BPromise['reject'](_0xc39074);}return _0x48d99f['save']();};}function saveUpdates(_0x175b39,_0x483515){return function(_0x53e428){if(_0x53e428){return _0x53e428[_0xe919('0x20')](_0x175b39)[_0xe919('0x21')](function(_0x57056a){return _0x57056a;});}return null;};}function removeEntity(_0x26e01d,_0x5694b0){return function(_0x422934){if(_0x422934){return _0x422934[_0xe919('0x22')]()['then'](function(){_0x26e01d[_0xe919('0x16')](0xcc)[_0xe919('0x17')]();});}};}function handleEntityNotFound(_0x4607f5,_0x509bfa){return function(_0x2bb8d6){if(!_0x2bb8d6){_0x4607f5[_0xe919('0x23')](0x194);}return _0x2bb8d6;};}function handleError(_0x58f7a3,_0x19580b){_0x19580b=_0x19580b||0x1f4;return function(_0x354849){logger[_0xe919('0x24')](_0x354849['stack']);if(_0x354849[_0xe919('0x25')]){delete _0x354849['name'];}_0x58f7a3[_0xe919('0x16')](_0x19580b)[_0xe919('0x26')](_0x354849);};}exports['index']=function(_0x29b693,_0x5adb9b){var _0x101522={},_0x46d4f4={},_0x16d3a2={'count':0x0,'rows':[]};var _0x50e5cc=_[_0xe919('0x27')](db[_0xe919('0x28')][_0xe919('0x29')],function(_0x1090d4){return{'name':_0x1090d4[_0xe919('0x2a')],'type':_0x1090d4[_0xe919('0x2b')][_0xe919('0x2c')]};});_0x46d4f4[_0xe919('0x2d')]=_['map'](_0x50e5cc,_0xe919('0x25'));_0x46d4f4[_0xe919('0x2e')]=_['keys'](_0x29b693['query']);_0x46d4f4[_0xe919('0x2f')]=_[_0xe919('0x30')](_0x46d4f4[_0xe919('0x2d')],_0x46d4f4[_0xe919('0x2e')]);_0x101522[_0xe919('0x31')]=_[_0xe919('0x30')](_0x46d4f4[_0xe919('0x2d')],qs[_0xe919('0x32')](_0x29b693['query'][_0xe919('0x32')]));_0x101522[_0xe919('0x31')]=_0x101522[_0xe919('0x31')][_0xe919('0x33')]?_0x101522[_0xe919('0x31')]:_0x46d4f4[_0xe919('0x2d')];if(!_0x29b693[_0xe919('0x2e')][_0xe919('0x34')](_0xe919('0x35'))){_0x101522['limit']=qs[_0xe919('0x1c')](_0x29b693['query'][_0xe919('0x1c')]);_0x101522['offset']=qs['offset'](_0x29b693[_0xe919('0x2e')]['offset']);}_0x101522[_0xe919('0x36')]=qs[_0xe919('0x37')](_0x29b693['query']['sort']);_0x101522[_0xe919('0x38')]=qs[_0xe919('0x2f')](_[_0xe919('0x39')](_0x29b693[_0xe919('0x2e')],_0x46d4f4[_0xe919('0x2f')]),_0x50e5cc);if(_0x29b693[_0xe919('0x2e')][_0xe919('0x3a')]){_0x101522[_0xe919('0x38')]=_[_0xe919('0x3b')](_0x101522[_0xe919('0x38')],{'$or':_[_0xe919('0x27')](_0x50e5cc,function(_0x160774){if(_0x160774[_0xe919('0x2b')]!==_0xe919('0x3c')){var _0x35de99={};_0x35de99[_0x160774['name']]={'$like':'%'+_0x29b693[_0xe919('0x2e')][_0xe919('0x3a')]+'%'};return _0x35de99;}})});}_0x101522=_['merge']({},_0x101522,_0x29b693[_0xe919('0x3d')]);var _0xe34037={'where':_0x101522[_0xe919('0x38')]};return db[_0xe919('0x28')][_0xe919('0x1b')](_0xe34037)[_0xe919('0x21')](function(_0x48a291){_0x16d3a2[_0xe919('0x1b')]=_0x48a291;if(_0x29b693['query'][_0xe919('0x3e')]){_0x101522[_0xe919('0x3f')]=[{'all':!![]}];}return db['Cdr'][_0xe919('0x40')](_0x101522);})[_0xe919('0x21')](function(_0x717cce){_0x16d3a2[_0xe919('0x41')]=_0x717cce;return _0x16d3a2;})[_0xe919('0x21')](respondWithFilteredResult(_0x5adb9b,_0x101522))[_0xe919('0x42')](handleError(_0x5adb9b,null));};exports[_0xe919('0x43')]=function(_0x347384,_0xf4ec66){var _0x435bd8={'raw':!![],'where':{'id':_0x347384[_0xe919('0x44')]['id']}},_0x4cbdea={};_0x4cbdea['model']=_['keys'](db[_0xe919('0x28')][_0xe919('0x29')]);_0x4cbdea['query']=_[_0xe919('0x45')](_0x347384[_0xe919('0x2e')]);_0x4cbdea[_0xe919('0x2f')]=_['intersection'](_0x4cbdea[_0xe919('0x2d')],_0x4cbdea[_0xe919('0x2e')]);_0x435bd8[_0xe919('0x31')]=_[_0xe919('0x30')](_0x4cbdea['model'],qs[_0xe919('0x32')](_0x347384[_0xe919('0x2e')]['fields']));_0x435bd8[_0xe919('0x31')]=_0x435bd8[_0xe919('0x31')][_0xe919('0x33')]?_0x435bd8[_0xe919('0x31')]:_0x4cbdea[_0xe919('0x2d')];if(_0x347384['query'][_0xe919('0x3e')]){_0x435bd8['include']=[{'all':!![]}];}_0x435bd8=_[_0xe919('0x3b')]({},_0x435bd8,_0x347384[_0xe919('0x3d')]);return db[_0xe919('0x28')][_0xe919('0x46')](_0x435bd8)[_0xe919('0x21')](handleEntityNotFound(_0xf4ec66,null))[_0xe919('0x21')](respondWithResult(_0xf4ec66,null))[_0xe919('0x42')](handleError(_0xf4ec66,null));};exports['create']=function(_0x3cd8f4,_0x19d7b3){return db[_0xe919('0x28')]['create'](_0x3cd8f4[_0xe919('0x47')],{})[_0xe919('0x21')](respondWithResult(_0x19d7b3,0xc9))['catch'](handleError(_0x19d7b3,null));};exports[_0xe919('0x20')]=function(_0x3da722,_0x300d64){if(_0x3da722[_0xe919('0x47')]['id']){delete _0x3da722[_0xe919('0x47')]['id'];}return db[_0xe919('0x28')]['find']({'where':{'id':_0x3da722[_0xe919('0x44')]['id']}})[_0xe919('0x21')](handleEntityNotFound(_0x300d64,null))['then'](saveUpdates(_0x3da722[_0xe919('0x47')],null))[_0xe919('0x21')](respondWithResult(_0x300d64,null))[_0xe919('0x42')](handleError(_0x300d64,null));};exports[_0xe919('0x22')]=function(_0x125160,_0x1aae2c){return db[_0xe919('0x28')][_0xe919('0x46')]({'where':{'id':_0x125160[_0xe919('0x44')]['id']}})[_0xe919('0x21')](handleEntityNotFound(_0x1aae2c,null))['then'](removeEntity(_0x1aae2c,null))[_0xe919('0x42')](handleError(_0x1aae2c,null));};exports[_0xe919('0x48')]=function(_0x3a44bb,_0x3d4b2a){return db[_0xe919('0x28')][_0xe919('0x48')]()[_0xe919('0x21')](respondWithResult(_0x3d4b2a,null))[_0xe919('0x42')](handleError(_0x3d4b2a,null));}; \ No newline at end of file +var _0xac9d=['fields','hasOwnProperty','order','sort','pick','filter','where','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','merge','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','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/environment','../../config/license/util','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','update','then','destroy','sendStatus','error','stack','name','index','map','Cdr','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xac9d,0x14d));var _0xdac9=function(_0x42f3a5,_0x3a4470){_0x42f3a5=_0x42f3a5-0x0;var _0x1a7d74=_0xac9d[_0x42f3a5];return _0x1a7d74;};'use strict';var emlformat=require(_0xdac9('0x0'));var rimraf=require(_0xdac9('0x1'));var zipdir=require(_0xdac9('0x2'));var jsonpatch=require(_0xdac9('0x3'));var rp=require(_0xdac9('0x4'));var moment=require(_0xdac9('0x5'));var BPromise=require(_0xdac9('0x6'));var Mustache=require(_0xdac9('0x7'));var util=require('util');var path=require(_0xdac9('0x8'));var sox=require('sox');var csv=require(_0xdac9('0x9'));var ejs=require(_0xdac9('0xa'));var fs=require('fs');var fs_extra=require(_0xdac9('0xb'));var _=require(_0xdac9('0xc'));var squel=require(_0xdac9('0xd'));var crypto=require(_0xdac9('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xdac9('0xf'));var toCsv=require('to-csv');var querystring=require(_0xdac9('0x10'));var Papa=require(_0xdac9('0x11'));var Redis=require(_0xdac9('0x12'));var authService=require(_0xdac9('0x13'));var qs=require(_0xdac9('0x14'));var as=require(_0xdac9('0x15'));var hardwareService=require(_0xdac9('0x16'));var logger=require(_0xdac9('0x17'))(_0xdac9('0x18'));var utils=require('../../config/utils');var config=require(_0xdac9('0x19'));var licenseUtil=require(_0xdac9('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3d8e97,_0xeddbc1){_0xeddbc1=_0xeddbc1||0xcc;return function(_0xbfe6d8){if(_0xbfe6d8){return _0x3d8e97['sendStatus'](_0xeddbc1);}return _0x3d8e97[_0xdac9('0x1b')](_0xeddbc1)[_0xdac9('0x1c')]();};}function respondWithResult(_0x9e1bf6,_0x5f0bbd){_0x5f0bbd=_0x5f0bbd||0xc8;return function(_0x5dd536){if(_0x5dd536){return _0x9e1bf6[_0xdac9('0x1b')](_0x5f0bbd)[_0xdac9('0x1d')](_0x5dd536);}};}function respondWithFilteredResult(_0x50f9fe,_0x76af7a){return function(_0x36cbe4){if(_0x36cbe4){var _0x152ea5=typeof _0x76af7a[_0xdac9('0x1e')]===_0xdac9('0x1f')&&typeof _0x76af7a[_0xdac9('0x20')]===_0xdac9('0x1f');var _0xec1016=_0x36cbe4['count'];var _0x283343=_0x152ea5?0x0:_0x76af7a[_0xdac9('0x1e')];var _0x571e07=_0x152ea5?_0x36cbe4[_0xdac9('0x21')]:_0x76af7a[_0xdac9('0x1e')]+_0x76af7a[_0xdac9('0x20')];var _0x181d11;if(_0x571e07>=_0xec1016){_0x571e07=_0xec1016;_0x181d11=0xc8;}else{_0x181d11=0xce;}_0x50f9fe['status'](_0x181d11);return _0x50f9fe['set'](_0xdac9('0x22'),_0x283343+'-'+_0x571e07+'/'+_0xec1016)[_0xdac9('0x1d')](_0x36cbe4);}return null;};}function patchUpdates(_0x2b9d91){return function(_0x395ec7){try{jsonpatch['apply'](_0x395ec7,_0x2b9d91,!![]);}catch(_0x23ee5e){return BPromise[_0xdac9('0x23')](_0x23ee5e);}return _0x395ec7[_0xdac9('0x24')]();};}function saveUpdates(_0xae680a,_0xe7bd10){return function(_0x42317c){if(_0x42317c){return _0x42317c[_0xdac9('0x25')](_0xae680a)[_0xdac9('0x26')](function(_0x419f0c){return _0x419f0c;});}return null;};}function removeEntity(_0x33de5c,_0x5a0fa2){return function(_0x2943f5){if(_0x2943f5){return _0x2943f5[_0xdac9('0x27')]()[_0xdac9('0x26')](function(){_0x33de5c[_0xdac9('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1e631a,_0x5686db){return function(_0x3ce475){if(!_0x3ce475){_0x1e631a[_0xdac9('0x28')](0x194);}return _0x3ce475;};}function handleError(_0x566d8c,_0x433be9){_0x433be9=_0x433be9||0x1f4;return function(_0x5105f1){logger[_0xdac9('0x29')](_0x5105f1[_0xdac9('0x2a')]);if(_0x5105f1[_0xdac9('0x2b')]){delete _0x5105f1[_0xdac9('0x2b')];}_0x566d8c['status'](_0x433be9)['send'](_0x5105f1);};}exports[_0xdac9('0x2c')]=function(_0x170afd,_0x4fe3bd){var _0x4c4e21={},_0x3eed7a={},_0x3505c5={'count':0x0,'rows':[]};var _0x13efba=_[_0xdac9('0x2d')](db[_0xdac9('0x2e')][_0xdac9('0x2f')],function(_0xed99f9){return{'name':_0xed99f9[_0xdac9('0x30')],'type':_0xed99f9[_0xdac9('0x31')][_0xdac9('0x32')]};});_0x3eed7a[_0xdac9('0x33')]=_[_0xdac9('0x2d')](_0x13efba,_0xdac9('0x2b'));_0x3eed7a[_0xdac9('0x34')]=_[_0xdac9('0x35')](_0x170afd[_0xdac9('0x34')]);_0x3eed7a[_0xdac9('0x36')]=_[_0xdac9('0x37')](_0x3eed7a[_0xdac9('0x33')],_0x3eed7a[_0xdac9('0x34')]);_0x4c4e21[_0xdac9('0x38')]=_['intersection'](_0x3eed7a['model'],qs[_0xdac9('0x39')](_0x170afd[_0xdac9('0x34')][_0xdac9('0x39')]));_0x4c4e21[_0xdac9('0x38')]=_0x4c4e21[_0xdac9('0x38')]['length']?_0x4c4e21[_0xdac9('0x38')]:_0x3eed7a['model'];if(!_0x170afd[_0xdac9('0x34')][_0xdac9('0x3a')]('nolimit')){_0x4c4e21[_0xdac9('0x20')]=qs['limit'](_0x170afd['query'][_0xdac9('0x20')]);_0x4c4e21[_0xdac9('0x1e')]=qs[_0xdac9('0x1e')](_0x170afd[_0xdac9('0x34')][_0xdac9('0x1e')]);}_0x4c4e21[_0xdac9('0x3b')]=qs['sort'](_0x170afd[_0xdac9('0x34')][_0xdac9('0x3c')]);_0x4c4e21['where']=qs[_0xdac9('0x36')](_[_0xdac9('0x3d')](_0x170afd[_0xdac9('0x34')],_0x3eed7a[_0xdac9('0x36')]),_0x13efba);if(_0x170afd[_0xdac9('0x34')][_0xdac9('0x3e')]){_0x4c4e21[_0xdac9('0x3f')]=_['merge'](_0x4c4e21[_0xdac9('0x3f')],{'$or':_[_0xdac9('0x2d')](_0x13efba,function(_0x238769){if(_0x238769['type']!==_0xdac9('0x40')){var _0x338e4a={};_0x338e4a[_0x238769[_0xdac9('0x2b')]]={'$like':'%'+_0x170afd[_0xdac9('0x34')]['filter']+'%'};return _0x338e4a;}})});}_0x4c4e21=_['merge']({},_0x4c4e21,_0x170afd[_0xdac9('0x41')]);var _0xe47a3c={'where':_0x4c4e21[_0xdac9('0x3f')]};return db[_0xdac9('0x2e')][_0xdac9('0x21')](_0xe47a3c)['then'](function(_0x8435e8){_0x3505c5['count']=_0x8435e8;if(_0x170afd[_0xdac9('0x34')][_0xdac9('0x42')]){_0x4c4e21[_0xdac9('0x43')]=[{'all':!![]}];}return db[_0xdac9('0x2e')][_0xdac9('0x44')](_0x4c4e21);})[_0xdac9('0x26')](function(_0x413fb1){_0x3505c5[_0xdac9('0x45')]=_0x413fb1;return _0x3505c5;})[_0xdac9('0x26')](respondWithFilteredResult(_0x4fe3bd,_0x4c4e21))[_0xdac9('0x46')](handleError(_0x4fe3bd,null));};exports[_0xdac9('0x47')]=function(_0x24b570,_0x278826){var _0x441676={'raw':!![],'where':{'id':_0x24b570[_0xdac9('0x48')]['id']}},_0x5335ae={};_0x5335ae[_0xdac9('0x33')]=_['keys'](db[_0xdac9('0x2e')][_0xdac9('0x2f')]);_0x5335ae[_0xdac9('0x34')]=_[_0xdac9('0x35')](_0x24b570[_0xdac9('0x34')]);_0x5335ae[_0xdac9('0x36')]=_['intersection'](_0x5335ae[_0xdac9('0x33')],_0x5335ae['query']);_0x441676[_0xdac9('0x38')]=_[_0xdac9('0x37')](_0x5335ae[_0xdac9('0x33')],qs[_0xdac9('0x39')](_0x24b570['query']['fields']));_0x441676['attributes']=_0x441676[_0xdac9('0x38')]['length']?_0x441676['attributes']:_0x5335ae[_0xdac9('0x33')];if(_0x24b570[_0xdac9('0x34')]['includeAll']){_0x441676['include']=[{'all':!![]}];}_0x441676=_[_0xdac9('0x49')]({},_0x441676,_0x24b570[_0xdac9('0x41')]);return db[_0xdac9('0x2e')][_0xdac9('0x4a')](_0x441676)[_0xdac9('0x26')](handleEntityNotFound(_0x278826,null))[_0xdac9('0x26')](respondWithResult(_0x278826,null))[_0xdac9('0x46')](handleError(_0x278826,null));};exports[_0xdac9('0x4b')]=function(_0x5c008b,_0x621cf){return db[_0xdac9('0x2e')][_0xdac9('0x4b')](_0x5c008b[_0xdac9('0x4c')],{})[_0xdac9('0x26')](respondWithResult(_0x621cf,0xc9))[_0xdac9('0x46')](handleError(_0x621cf,null));};exports[_0xdac9('0x25')]=function(_0x37b498,_0x140dc5){if(_0x37b498[_0xdac9('0x4c')]['id']){delete _0x37b498[_0xdac9('0x4c')]['id'];}return db[_0xdac9('0x2e')][_0xdac9('0x4a')]({'where':{'id':_0x37b498[_0xdac9('0x48')]['id']}})['then'](handleEntityNotFound(_0x140dc5,null))['then'](saveUpdates(_0x37b498['body'],null))[_0xdac9('0x26')](respondWithResult(_0x140dc5,null))[_0xdac9('0x46')](handleError(_0x140dc5,null));};exports['destroy']=function(_0x2a60bd,_0x2843f2){return db[_0xdac9('0x2e')]['find']({'where':{'id':_0x2a60bd[_0xdac9('0x48')]['id']}})[_0xdac9('0x26')](handleEntityNotFound(_0x2843f2,null))['then'](removeEntity(_0x2843f2,null))['catch'](handleError(_0x2843f2,null));};exports[_0xdac9('0x4d')]=function(_0x4469d8,_0x222de9){return db[_0xdac9('0x2e')][_0xdac9('0x4d')]()[_0xdac9('0x26')](respondWithResult(_0x222de9,null))[_0xdac9('0x46')](handleError(_0x222de9,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 7e8218c..4d40519 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(_0x1fa081,_0x4e93e2){var _0x40dfee=function(_0x47b13d){while(--_0x47b13d){_0x1fa081['push'](_0x1fa081['shift']());}};_0x40dfee(++_0x4e93e2);}(_0x7a54,0x106));var _0x47a5=function(_0x3f28bd,_0x17d691){_0x3f28bd=_0x3f28bd-0x0;var _0x598bbf=_0x7a54[_0x3f28bd];return _0x598bbf;};'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(_0x378703,_0x3d66db){var _0xe400b7=function(_0xd5c02f){while(--_0xd5c02f){_0x378703['push'](_0x378703['shift']());}};_0xe400b7(++_0x3d66db);}(_0x7a54,0x106));var _0x47a5=function(_0x5a0564,_0x5b7241){_0x5a0564=_0x5a0564-0x0;var _0x59b2a0=_0x7a54[_0x5a0564];return _0x59b2a0;};'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 7bf1c33..2611708 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 _0xf178=['message','info','result','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','Cdr,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','Cdr,\x20%s,\x20%s'];(function(_0xd1d19a,_0x1933f0){var _0x52a79d=function(_0x5199e2){while(--_0x5199e2){_0xd1d19a['push'](_0xd1d19a['shift']());}};_0x52a79d(++_0x1933f0);}(_0xf178,0xa3));var _0x8f17=function(_0x391bce,_0x4dcec1){_0x391bce=_0x391bce-0x0;var _0x14075b=_0xf178[_0x391bce];return _0x14075b;};'use strict';var _=require('lodash');var util=require(_0x8f17('0x0'));var moment=require(_0x8f17('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8f17('0x2'));var db=require(_0x8f17('0x3'))['db'];var utils=require(_0x8f17('0x4'));var logger=require(_0x8f17('0x5'))(_0x8f17('0x6'));var config=require(_0x8f17('0x7'));var jayson=require(_0x8f17('0x8'));var client=jayson[_0x8f17('0x9')][_0x8f17('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x224122,_0x419e4f,_0x4f09f3){return new BPromise(function(_0x39c546,_0x25b925){return client[_0x8f17('0xb')](_0x224122,_0x4f09f3)['then'](function(_0x70c2e7){logger['info']('Cdr,\x20%s,\x20%s',_0x419e4f,'request\x20sent');logger['debug'](_0x8f17('0xc'),_0x419e4f,_0x8f17('0xd'),JSON[_0x8f17('0xe')](_0x70c2e7));if(_0x70c2e7[_0x8f17('0xf')]){if(_0x70c2e7['error']['code']===0x1f4){logger[_0x8f17('0xf')](_0x8f17('0x10'),_0x419e4f,_0x70c2e7[_0x8f17('0xf')][_0x8f17('0x11')]);return _0x25b925(_0x70c2e7[_0x8f17('0xf')]['message']);}logger[_0x8f17('0xf')](_0x8f17('0x10'),_0x419e4f,_0x70c2e7['error'][_0x8f17('0x11')]);return _0x39c546(_0x70c2e7['error'][_0x8f17('0x11')]);}else{logger[_0x8f17('0x12')](_0x8f17('0x10'),_0x419e4f,_0x8f17('0xd'));_0x39c546(_0x70c2e7[_0x8f17('0x13')][_0x8f17('0x11')]);}})['catch'](function(_0x1ba416){logger[_0x8f17('0xf')](_0x8f17('0x10'),_0x419e4f,_0x1ba416);_0x25b925(_0x1ba416);});});} \ No newline at end of file +var _0xc7c0=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','Cdr,\x20%s,\x20%s','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','ioredis','../../mysqldb'];(function(_0x4a40ce,_0x396eba){var _0x1919f0=function(_0x443658){while(--_0x443658){_0x4a40ce['push'](_0x4a40ce['shift']());}};_0x1919f0(++_0x396eba);}(_0xc7c0,0x154));var _0x0c7c=function(_0x4e51cd,_0x4f9ffa){_0x4e51cd=_0x4e51cd-0x0;var _0x16161f=_0xc7c0[_0x4e51cd];return _0x16161f;};'use strict';var _=require(_0x0c7c('0x0'));var util=require(_0x0c7c('0x1'));var moment=require(_0x0c7c('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0c7c('0x3'));var db=require(_0x0c7c('0x4'))['db'];var utils=require(_0x0c7c('0x5'));var logger=require(_0x0c7c('0x6'))(_0x0c7c('0x7'));var config=require(_0x0c7c('0x8'));var jayson=require(_0x0c7c('0x9'));var client=jayson[_0x0c7c('0xa')][_0x0c7c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5be967,_0x55440d,_0x1cd7ed){return new BPromise(function(_0x1da115,_0x5da380){return client[_0x0c7c('0xc')](_0x5be967,_0x1cd7ed)['then'](function(_0x45705a){logger[_0x0c7c('0xd')](_0x0c7c('0xe'),_0x55440d,_0x0c7c('0xf'));logger[_0x0c7c('0x10')](_0x0c7c('0x11'),_0x55440d,_0x0c7c('0xf'),JSON[_0x0c7c('0x12')](_0x45705a));if(_0x45705a['error']){if(_0x45705a[_0x0c7c('0x13')][_0x0c7c('0x14')]===0x1f4){logger['error'](_0x0c7c('0xe'),_0x55440d,_0x45705a[_0x0c7c('0x13')][_0x0c7c('0x15')]);return _0x5da380(_0x45705a[_0x0c7c('0x13')]['message']);}logger['error'](_0x0c7c('0xe'),_0x55440d,_0x45705a[_0x0c7c('0x13')]['message']);return _0x1da115(_0x45705a['error']['message']);}else{logger[_0x0c7c('0xd')]('Cdr,\x20%s,\x20%s',_0x55440d,_0x0c7c('0xf'));_0x1da115(_0x45705a[_0x0c7c('0x16')][_0x0c7c('0x15')]);}})['catch'](function(_0x31accd){logger[_0x0c7c('0x13')](_0x0c7c('0xe'),_0x55440d,_0x31accd);_0x5da380(_0x31accd);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index 97ed472..7a0f8ea 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(_0x1f8053,_0x111077){var _0x174fd8=function(_0x2f92fc){while(--_0x2f92fc){_0x1f8053['push'](_0x1f8053['shift']());}};_0x174fd8(++_0x111077);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./cdr.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file +var _0xd8b0=['destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update'];(function(_0x4cbe17,_0x300320){var _0x3070ef=function(_0xce193c){while(--_0xce193c){_0x4cbe17['push'](_0x4cbe17['shift']());}};_0x3070ef(++_0x300320);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./cdr.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index b046d87..8960578 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 _0x07df=['STRING','noop','TEXT','*,*,*,*','sequelize'];(function(_0x3f798d,_0x4cf2b7){var _0x36d478=function(_0x162dad){while(--_0x162dad){_0x3f798d['push'](_0x3f798d['shift']());}};_0x36d478(++_0x4cf2b7);}(_0x07df,0xfe));var _0xf07d=function(_0x50612d,_0x11166e){_0x50612d=_0x50612d-0x0;var _0x542103=_0x07df[_0x50612d];return _0x542103;};'use strict';var Sequelize=require(_0xf07d('0x0'));module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xf07d('0x1')],'allowNull':![],'defaultValue':_0xf07d('0x2')},'appdata':{'type':Sequelize[_0xf07d('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xf07d('0x4')}}; \ No newline at end of file +var _0x44f1=['INTEGER','TEXT','STRING','sequelize'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x44f1,0x157));var _0x144f=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0x44f1[_0x4709c0];return _0x13348b;};'use strict';var Sequelize=require(_0x144f('0x0'));module['exports']={'priority':{'type':Sequelize[_0x144f('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x144f('0x2')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x144f('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index ed00416..97bdba7 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 _0x8b2b=['set','Content-Range','reject','save','update','then','error','stack','name','send','show','params','model','keys','rawAttributes','query','filters','attributes','fields','length','includeAll','include','merge','ChatApplication','find','catch','body','destroy','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count'];(function(_0x3b01af,_0x295155){var _0x418e36=function(_0x200f1f){while(--_0x200f1f){_0x3b01af['push'](_0x3b01af['shift']());}};_0x418e36(++_0x295155);}(_0x8b2b,0x1c0));var _0xb8b2=function(_0x2872e0,_0x217dec){_0x2872e0=_0x2872e0-0x0;var _0x3be12d=_0x8b2b[_0x2872e0];return _0x3be12d;};'use strict';var emlformat=require(_0xb8b2('0x0'));var rimraf=require(_0xb8b2('0x1'));var zipdir=require(_0xb8b2('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb8b2('0x3'));var moment=require(_0xb8b2('0x4'));var BPromise=require(_0xb8b2('0x5'));var Mustache=require(_0xb8b2('0x6'));var util=require(_0xb8b2('0x7'));var path=require(_0xb8b2('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xb8b2('0x9'));var fs=require('fs');var fs_extra=require(_0xb8b2('0xa'));var _=require(_0xb8b2('0xb'));var squel=require(_0xb8b2('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xb8b2('0xd'));var toCsv=require(_0xb8b2('0xe'));var querystring=require(_0xb8b2('0xf'));var Papa=require(_0xb8b2('0x10'));var Redis=require(_0xb8b2('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xb8b2('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xb8b2('0x13'))(_0xb8b2('0x14'));var utils=require(_0xb8b2('0x15'));var config=require(_0xb8b2('0x16'));var licenseUtil=require(_0xb8b2('0x17'));var db=require(_0xb8b2('0x18'))['db'];function respondWithStatusCode(_0x584d41,_0x3440bf){_0x3440bf=_0x3440bf||0xcc;return function(_0x5bd724){if(_0x5bd724){return _0x584d41['sendStatus'](_0x3440bf);}return _0x584d41['status'](_0x3440bf)[_0xb8b2('0x19')]();};}function respondWithResult(_0xdc1d1d,_0x48b9df){_0x48b9df=_0x48b9df||0xc8;return function(_0x175885){if(_0x175885){return _0xdc1d1d[_0xb8b2('0x1a')](_0x48b9df)[_0xb8b2('0x1b')](_0x175885);}};}function respondWithFilteredResult(_0x142fb0,_0x46a592){return function(_0x5b614d){if(_0x5b614d){var _0x4b5a28=typeof _0x46a592[_0xb8b2('0x1c')]===_0xb8b2('0x1d')&&typeof _0x46a592[_0xb8b2('0x1e')]===_0xb8b2('0x1d');var _0xf04672=_0x5b614d['count'];var _0x47b94f=_0x4b5a28?0x0:_0x46a592[_0xb8b2('0x1c')];var _0x153b69=_0x4b5a28?_0x5b614d[_0xb8b2('0x1f')]:_0x46a592[_0xb8b2('0x1c')]+_0x46a592['limit'];var _0x23af66;if(_0x153b69>=_0xf04672){_0x153b69=_0xf04672;_0x23af66=0xc8;}else{_0x23af66=0xce;}_0x142fb0[_0xb8b2('0x1a')](_0x23af66);return _0x142fb0[_0xb8b2('0x20')](_0xb8b2('0x21'),_0x47b94f+'-'+_0x153b69+'/'+_0xf04672)[_0xb8b2('0x1b')](_0x5b614d);}return null;};}function patchUpdates(_0x1cbc65){return function(_0x34ca46){try{jsonpatch['apply'](_0x34ca46,_0x1cbc65,!![]);}catch(_0x382bbf){return BPromise[_0xb8b2('0x22')](_0x382bbf);}return _0x34ca46[_0xb8b2('0x23')]();};}function saveUpdates(_0x162d41,_0x316d3c){return function(_0x5a0a43){if(_0x5a0a43){return _0x5a0a43[_0xb8b2('0x24')](_0x162d41)['then'](function(_0xe3b28){return _0xe3b28;});}return null;};}function removeEntity(_0x8239a7,_0x2b40f8){return function(_0x20082f){if(_0x20082f){return _0x20082f['destroy']()[_0xb8b2('0x25')](function(){_0x8239a7[_0xb8b2('0x1a')](0xcc)[_0xb8b2('0x19')]();});}};}function handleEntityNotFound(_0x5a2afe,_0x49c5b1){return function(_0x517c2a){if(!_0x517c2a){_0x5a2afe['sendStatus'](0x194);}return _0x517c2a;};}function handleError(_0x36ae2d,_0x10d8f3){_0x10d8f3=_0x10d8f3||0x1f4;return function(_0x3bdb27){logger[_0xb8b2('0x26')](_0x3bdb27[_0xb8b2('0x27')]);if(_0x3bdb27[_0xb8b2('0x28')]){delete _0x3bdb27[_0xb8b2('0x28')];}_0x36ae2d[_0xb8b2('0x1a')](_0x10d8f3)[_0xb8b2('0x29')](_0x3bdb27);};}exports[_0xb8b2('0x2a')]=function(_0x2a236d,_0x6ae308){var _0x140b18={'raw':!![],'where':{'id':_0x2a236d[_0xb8b2('0x2b')]['id']}},_0xeb28c8={};_0xeb28c8[_0xb8b2('0x2c')]=_[_0xb8b2('0x2d')](db['ChatApplication'][_0xb8b2('0x2e')]);_0xeb28c8[_0xb8b2('0x2f')]=_[_0xb8b2('0x2d')](_0x2a236d[_0xb8b2('0x2f')]);_0xeb28c8[_0xb8b2('0x30')]=_['intersection'](_0xeb28c8[_0xb8b2('0x2c')],_0xeb28c8[_0xb8b2('0x2f')]);_0x140b18[_0xb8b2('0x31')]=_['intersection'](_0xeb28c8[_0xb8b2('0x2c')],qs[_0xb8b2('0x32')](_0x2a236d['query'][_0xb8b2('0x32')]));_0x140b18[_0xb8b2('0x31')]=_0x140b18[_0xb8b2('0x31')][_0xb8b2('0x33')]?_0x140b18[_0xb8b2('0x31')]:_0xeb28c8[_0xb8b2('0x2c')];if(_0x2a236d[_0xb8b2('0x2f')][_0xb8b2('0x34')]){_0x140b18[_0xb8b2('0x35')]=[{'all':!![]}];}_0x140b18=_[_0xb8b2('0x36')]({},_0x140b18,_0x2a236d['options']);return db[_0xb8b2('0x37')][_0xb8b2('0x38')](_0x140b18)['then'](handleEntityNotFound(_0x6ae308,null))[_0xb8b2('0x25')](respondWithResult(_0x6ae308,null))[_0xb8b2('0x39')](handleError(_0x6ae308,null));};exports[_0xb8b2('0x24')]=function(_0x350b23,_0xc3ac6){if(_0x350b23[_0xb8b2('0x3a')]['id']){delete _0x350b23[_0xb8b2('0x3a')]['id'];}return db[_0xb8b2('0x37')][_0xb8b2('0x38')]({'where':{'id':_0x350b23[_0xb8b2('0x2b')]['id']}})[_0xb8b2('0x25')](handleEntityNotFound(_0xc3ac6,null))[_0xb8b2('0x25')](saveUpdates(_0x350b23[_0xb8b2('0x3a')],null))[_0xb8b2('0x25')](respondWithResult(_0xc3ac6,null))[_0xb8b2('0x39')](handleError(_0xc3ac6,null));};exports[_0xb8b2('0x3b')]=function(_0x50c3d1,_0x9d012d){return db[_0xb8b2('0x37')][_0xb8b2('0x38')]({'where':{'id':_0x50c3d1[_0xb8b2('0x2b')]['id']}})[_0xb8b2('0x25')](handleEntityNotFound(_0x9d012d,null))[_0xb8b2('0x25')](removeEntity(_0x9d012d,null))[_0xb8b2('0x39')](handleError(_0x9d012d,null));}; \ No newline at end of file +var _0x4fdc=['params','model','keys','ChatApplication','rawAttributes','query','intersection','attributes','fields','length','includeAll','merge','options','find','catch','body','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','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','set','apply','reject','save','update','then','destroy','error','name','send','show'];(function(_0x4c936c,_0x444c3a){var _0x507867=function(_0x1ba829){while(--_0x1ba829){_0x4c936c['push'](_0x4c936c['shift']());}};_0x507867(++_0x444c3a);}(_0x4fdc,0x84));var _0xc4fd=function(_0x17a711,_0x498b53){_0x17a711=_0x17a711-0x0;var _0x7e0622=_0x4fdc[_0x17a711];return _0x7e0622;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc4fd('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc4fd('0x1'));var rp=require(_0xc4fd('0x2'));var moment=require(_0xc4fd('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xc4fd('0x4'));var util=require(_0xc4fd('0x5'));var path=require(_0xc4fd('0x6'));var sox=require(_0xc4fd('0x7'));var csv=require(_0xc4fd('0x8'));var ejs=require(_0xc4fd('0x9'));var fs=require('fs');var fs_extra=require(_0xc4fd('0xa'));var _=require('lodash');var squel=require(_0xc4fd('0xb'));var crypto=require(_0xc4fd('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xc4fd('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc4fd('0xe'));var Redis=require(_0xc4fd('0xf'));var authService=require(_0xc4fd('0x10'));var qs=require(_0xc4fd('0x11'));var as=require(_0xc4fd('0x12'));var hardwareService=require(_0xc4fd('0x13'));var logger=require(_0xc4fd('0x14'))(_0xc4fd('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xc4fd('0x16'));var db=require(_0xc4fd('0x17'))['db'];function respondWithStatusCode(_0x25fc9a,_0x4cecec){_0x4cecec=_0x4cecec||0xcc;return function(_0x31d6c0){if(_0x31d6c0){return _0x25fc9a[_0xc4fd('0x18')](_0x4cecec);}return _0x25fc9a[_0xc4fd('0x19')](_0x4cecec)[_0xc4fd('0x1a')]();};}function respondWithResult(_0x4577a8,_0x29d08c){_0x29d08c=_0x29d08c||0xc8;return function(_0x1d67f0){if(_0x1d67f0){return _0x4577a8[_0xc4fd('0x19')](_0x29d08c)[_0xc4fd('0x1b')](_0x1d67f0);}};}function respondWithFilteredResult(_0x553121,_0x75a44f){return function(_0x4c96e5){if(_0x4c96e5){var _0x5a248c=typeof _0x75a44f[_0xc4fd('0x1c')]===_0xc4fd('0x1d')&&typeof _0x75a44f['limit']==='undefined';var _0x6c739e=_0x4c96e5[_0xc4fd('0x1e')];var _0x2bc246=_0x5a248c?0x0:_0x75a44f[_0xc4fd('0x1c')];var _0xaf6c46=_0x5a248c?_0x4c96e5[_0xc4fd('0x1e')]:_0x75a44f[_0xc4fd('0x1c')]+_0x75a44f['limit'];var _0x1e440f;if(_0xaf6c46>=_0x6c739e){_0xaf6c46=_0x6c739e;_0x1e440f=0xc8;}else{_0x1e440f=0xce;}_0x553121[_0xc4fd('0x19')](_0x1e440f);return _0x553121[_0xc4fd('0x1f')]('Content-Range',_0x2bc246+'-'+_0xaf6c46+'/'+_0x6c739e)['json'](_0x4c96e5);}return null;};}function patchUpdates(_0x1a21ef){return function(_0x254278){try{jsonpatch[_0xc4fd('0x20')](_0x254278,_0x1a21ef,!![]);}catch(_0x3f6fe3){return BPromise[_0xc4fd('0x21')](_0x3f6fe3);}return _0x254278[_0xc4fd('0x22')]();};}function saveUpdates(_0x5bcb6c,_0x5271f8){return function(_0x30900b){if(_0x30900b){return _0x30900b[_0xc4fd('0x23')](_0x5bcb6c)[_0xc4fd('0x24')](function(_0x2eba79){return _0x2eba79;});}return null;};}function removeEntity(_0x1b206b,_0x433eb4){return function(_0x3006ad){if(_0x3006ad){return _0x3006ad[_0xc4fd('0x25')]()[_0xc4fd('0x24')](function(){_0x1b206b['status'](0xcc)[_0xc4fd('0x1a')]();});}};}function handleEntityNotFound(_0x18b1a8,_0x2ce202){return function(_0x2c8831){if(!_0x2c8831){_0x18b1a8[_0xc4fd('0x18')](0x194);}return _0x2c8831;};}function handleError(_0xb6052a,_0x331f1){_0x331f1=_0x331f1||0x1f4;return function(_0x15022d){logger[_0xc4fd('0x26')](_0x15022d['stack']);if(_0x15022d['name']){delete _0x15022d[_0xc4fd('0x27')];}_0xb6052a[_0xc4fd('0x19')](_0x331f1)[_0xc4fd('0x28')](_0x15022d);};}exports[_0xc4fd('0x29')]=function(_0x38ac21,_0x23435e){var _0x546a39={'raw':!![],'where':{'id':_0x38ac21[_0xc4fd('0x2a')]['id']}},_0x15d61b={};_0x15d61b[_0xc4fd('0x2b')]=_[_0xc4fd('0x2c')](db[_0xc4fd('0x2d')][_0xc4fd('0x2e')]);_0x15d61b[_0xc4fd('0x2f')]=_[_0xc4fd('0x2c')](_0x38ac21['query']);_0x15d61b['filters']=_[_0xc4fd('0x30')](_0x15d61b[_0xc4fd('0x2b')],_0x15d61b[_0xc4fd('0x2f')]);_0x546a39[_0xc4fd('0x31')]=_['intersection'](_0x15d61b[_0xc4fd('0x2b')],qs['fields'](_0x38ac21[_0xc4fd('0x2f')][_0xc4fd('0x32')]));_0x546a39['attributes']=_0x546a39[_0xc4fd('0x31')][_0xc4fd('0x33')]?_0x546a39[_0xc4fd('0x31')]:_0x15d61b[_0xc4fd('0x2b')];if(_0x38ac21[_0xc4fd('0x2f')][_0xc4fd('0x34')]){_0x546a39['include']=[{'all':!![]}];}_0x546a39=_[_0xc4fd('0x35')]({},_0x546a39,_0x38ac21[_0xc4fd('0x36')]);return db[_0xc4fd('0x2d')][_0xc4fd('0x37')](_0x546a39)[_0xc4fd('0x24')](handleEntityNotFound(_0x23435e,null))[_0xc4fd('0x24')](respondWithResult(_0x23435e,null))[_0xc4fd('0x38')](handleError(_0x23435e,null));};exports['update']=function(_0x258d35,_0x5875c6){if(_0x258d35['body']['id']){delete _0x258d35[_0xc4fd('0x39')]['id'];}return db['ChatApplication'][_0xc4fd('0x37')]({'where':{'id':_0x258d35[_0xc4fd('0x2a')]['id']}})[_0xc4fd('0x24')](handleEntityNotFound(_0x5875c6,null))['then'](saveUpdates(_0x258d35[_0xc4fd('0x39')],null))[_0xc4fd('0x24')](respondWithResult(_0x5875c6,null))[_0xc4fd('0x38')](handleError(_0x5875c6,null));};exports[_0xc4fd('0x25')]=function(_0x59d19e,_0x3390f6){return db[_0xc4fd('0x2d')][_0xc4fd('0x37')]({'where':{'id':_0x59d19e[_0xc4fd('0x2a')]['id']}})['then'](handleEntityNotFound(_0x3390f6,null))[_0xc4fd('0x24')](removeEntity(_0x3390f6,null))[_0xc4fd('0x38')](handleError(_0x3390f6,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index b91bce8..0b45f7e 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 _0xc200=['path','rimraf','../../config/environment','exports','ChatApplication','chat_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise'];(function(_0x102470,_0x199a01){var _0x558eaa=function(_0x12c74a){while(--_0x12c74a){_0x102470['push'](_0x102470['shift']());}};_0x558eaa(++_0x199a01);}(_0xc200,0x19e));var _0x0c20=function(_0x13b8f3,_0x442821){_0x13b8f3=_0x13b8f3-0x0;var _0x1a6d06=_0xc200[_0x13b8f3];return _0x1a6d06;};'use strict';var _=require(_0x0c20('0x0'));var util=require(_0x0c20('0x1'));var logger=require('../../config/logger')(_0x0c20('0x2'));var moment=require(_0x0c20('0x3'));var BPromise=require(_0x0c20('0x4'));var rp=require(_0x0c20('0x5'));var fs=require('fs');var path=require(_0x0c20('0x6'));var rimraf=require(_0x0c20('0x7'));var config=require(_0x0c20('0x8'));var attributes=require('./chatApplication.attributes');module[_0x0c20('0x9')]=function(_0x5407b0,_0xa49b23){return _0x5407b0['define'](_0x0c20('0xa'),attributes,{'tableName':_0x0c20('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x0c20('0xc'),'collate':_0x0c20('0xd')});}; \ No newline at end of file +var _0x2c46=['./chatApplication.attributes','exports','define','ChatApplication','chat_applications','utf8mb4','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x413dec,_0x453b1a){var _0x43b01d=function(_0x4a6c3f){while(--_0x4a6c3f){_0x413dec['push'](_0x413dec['shift']());}};_0x43b01d(++_0x453b1a);}(_0x2c46,0x6f));var _0x62c4=function(_0x2e91cd,_0x40146a){_0x2e91cd=_0x2e91cd-0x0;var _0x2c6dbb=_0x2c46[_0x2e91cd];return _0x2c6dbb;};'use strict';var _=require('lodash');var util=require(_0x62c4('0x0'));var logger=require(_0x62c4('0x1'))(_0x62c4('0x2'));var moment=require(_0x62c4('0x3'));var BPromise=require(_0x62c4('0x4'));var rp=require(_0x62c4('0x5'));var fs=require('fs');var path=require(_0x62c4('0x6'));var rimraf=require(_0x62c4('0x7'));var config=require(_0x62c4('0x8'));var attributes=require(_0x62c4('0x9'));module[_0x62c4('0xa')]=function(_0x400057,_0x2a719e){return _0x400057[_0x62c4('0xb')](_0x62c4('0xc'),attributes,{'tableName':_0x62c4('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x62c4('0xe'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index d753b11..6c73bbc 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 _0x69c8=['result','catch','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','ChatApplication,\x20%s,\x20%s','debug','ChatApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x1103e6,_0x3a0217){var _0x5bc0ef=function(_0x3e979b){while(--_0x3e979b){_0x1103e6['push'](_0x1103e6['shift']());}};_0x5bc0ef(++_0x3a0217);}(_0x69c8,0x1bb));var _0x869c=function(_0x205d4f,_0x1551d7){_0x205d4f=_0x205d4f-0x0;var _0x2a740b=_0x69c8[_0x205d4f];return _0x2a740b;};'use strict';var _=require(_0x869c('0x0'));var util=require('util');var moment=require(_0x869c('0x1'));var BPromise=require(_0x869c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x869c('0x3'))['db'];var utils=require(_0x869c('0x4'));var logger=require(_0x869c('0x5'))(_0x869c('0x6'));var config=require(_0x869c('0x7'));var jayson=require(_0x869c('0x8'));var client=jayson['client'][_0x869c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4637a5,_0x4e4f00,_0x181d3c){return new BPromise(function(_0x28ea6c,_0x3304ca){return client['request'](_0x4637a5,_0x181d3c)['then'](function(_0x4ca15a){logger[_0x869c('0xa')](_0x869c('0xb'),_0x4e4f00,'request\x20sent');logger[_0x869c('0xc')](_0x869c('0xd'),_0x4e4f00,_0x869c('0xe'),JSON[_0x869c('0xf')](_0x4ca15a));if(_0x4ca15a[_0x869c('0x10')]){if(_0x4ca15a[_0x869c('0x10')][_0x869c('0x11')]===0x1f4){logger[_0x869c('0x10')](_0x869c('0xb'),_0x4e4f00,_0x4ca15a[_0x869c('0x10')][_0x869c('0x12')]);return _0x3304ca(_0x4ca15a['error']['message']);}logger[_0x869c('0x10')](_0x869c('0xb'),_0x4e4f00,_0x4ca15a['error']['message']);return _0x28ea6c(_0x4ca15a[_0x869c('0x10')]['message']);}else{logger[_0x869c('0xa')](_0x869c('0xb'),_0x4e4f00,_0x869c('0xe'));_0x28ea6c(_0x4ca15a[_0x869c('0x13')][_0x869c('0x12')]);}})[_0x869c('0x14')](function(_0x1e4b0f){logger[_0x869c('0x10')](_0x869c('0xb'),_0x4e4f00,_0x1e4b0f);_0x3304ca(_0x1e4b0f);});});} \ No newline at end of file +var _0xc710=['ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatApplication,\x20%s,\x20%s','message','result','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug'];(function(_0x478f29,_0x68ff16){var _0x3868dc=function(_0x3644a8){while(--_0x3644a8){_0x478f29['push'](_0x478f29['shift']());}};_0x3868dc(++_0x68ff16);}(_0xc710,0x10b));var _0x0c71=function(_0x46ec24,_0x4d2d68){_0x46ec24=_0x46ec24-0x0;var _0x8e7299=_0xc710[_0x46ec24];return _0x8e7299;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x0c71('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0c71('0x1'));var db=require('../../mysqldb')['db'];var utils=require(_0x0c71('0x2'));var logger=require(_0x0c71('0x3'))(_0x0c71('0x4'));var config=require(_0x0c71('0x5'));var jayson=require(_0x0c71('0x6'));var client=jayson[_0x0c71('0x7')][_0x0c71('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x593877,_0x4528cc,_0x5585b2){return new BPromise(function(_0x11810f,_0x5c8be5){return client['request'](_0x593877,_0x5585b2)[_0x0c71('0x9')](function(_0x3099e6){logger[_0x0c71('0xa')]('ChatApplication,\x20%s,\x20%s',_0x4528cc,_0x0c71('0xb'));logger[_0x0c71('0xc')](_0x0c71('0xd'),_0x4528cc,_0x0c71('0xb'),JSON[_0x0c71('0xe')](_0x3099e6));if(_0x3099e6[_0x0c71('0xf')]){if(_0x3099e6['error'][_0x0c71('0x10')]===0x1f4){logger[_0x0c71('0xf')](_0x0c71('0x11'),_0x4528cc,_0x3099e6[_0x0c71('0xf')][_0x0c71('0x12')]);return _0x5c8be5(_0x3099e6[_0x0c71('0xf')]['message']);}logger[_0x0c71('0xf')](_0x0c71('0x11'),_0x4528cc,_0x3099e6['error']['message']);return _0x11810f(_0x3099e6[_0x0c71('0xf')]['message']);}else{logger[_0x0c71('0xa')]('ChatApplication,\x20%s,\x20%s',_0x4528cc,_0x0c71('0xb'));_0x11810f(_0x3099e6[_0x0c71('0x13')][_0x0c71('0x12')]);}})['catch'](function(_0x166b12){logger[_0x0c71('0xf')](_0x0c71('0x11'),_0x4528cc,_0x166b12);_0x5c8be5(_0x166b12);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 0e6be8f..cccdf68 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 _0xd06e=['show','put','update','delete','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatApplication.controller','get','/:id','isAuthenticated'];(function(_0x733977,_0x3c29e0){var _0x1b9b53=function(_0x39ac2a){while(--_0x39ac2a){_0x733977['push'](_0x733977['shift']());}};_0x1b9b53(++_0x3c29e0);}(_0xd06e,0x15b));var _0xed06=function(_0x480676,_0x49a1ce){_0x480676=_0x480676-0x0;var _0x2d75ec=_0xd06e[_0x480676];return _0x2d75ec;};'use strict';var multer=require(_0xed06('0x0'));var util=require(_0xed06('0x1'));var path=require(_0xed06('0x2'));var timeout=require(_0xed06('0x3'));var express=require(_0xed06('0x4'));var router=express['Router']();var fs_extra=require(_0xed06('0x5'));var auth=require(_0xed06('0x6'));var interaction=require(_0xed06('0x7'));var config=require(_0xed06('0x8'));var controller=require(_0xed06('0x9'));router[_0xed06('0xa')](_0xed06('0xb'),auth[_0xed06('0xc')](),controller[_0xed06('0xd')]);router[_0xed06('0xe')]('/:id',auth[_0xed06('0xc')](),controller[_0xed06('0xf')]);router[_0xed06('0x10')](_0xed06('0xb'),auth[_0xed06('0xc')](),controller[_0xed06('0x11')]);module['exports']=router; \ No newline at end of file +var _0x821f=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatApplication.controller','get','isAuthenticated','show','/:id','update','delete','exports','multer','path','connect-timeout','express'];(function(_0x49778d,_0x25e551){var _0x797b15=function(_0x33ae5a){while(--_0x33ae5a){_0x49778d['push'](_0x49778d['shift']());}};_0x797b15(++_0x25e551);}(_0x821f,0x1dc));var _0xf821=function(_0x513aa5,_0x1fba79){_0x513aa5=_0x513aa5-0x0;var _0x1a1a7c=_0x821f[_0x513aa5];return _0x1a1a7c;};'use strict';var multer=require(_0xf821('0x0'));var util=require('util');var path=require(_0xf821('0x1'));var timeout=require(_0xf821('0x2'));var express=require(_0xf821('0x3'));var router=express['Router']();var fs_extra=require(_0xf821('0x4'));var auth=require(_0xf821('0x5'));var interaction=require(_0xf821('0x6'));var config=require(_0xf821('0x7'));var controller=require(_0xf821('0x8'));router[_0xf821('0x9')]('/:id',auth[_0xf821('0xa')](),controller[_0xf821('0xb')]);router['put'](_0xf821('0xc'),auth[_0xf821('0xa')](),controller[_0xf821('0xd')]);router[_0xf821('0xe')](_0xf821('0xc'),auth[_0xf821('0xa')](),controller['destroy']);module[_0xf821('0xf')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index c6ab74e..aa4b1f0 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 _0x55aa=['STRING','BOOLEAN','exports'];(function(_0x11165e,_0x38ef90){var _0x27ae1a=function(_0x39deed){while(--_0x39deed){_0x11165e['push'](_0x11165e['shift']());}};_0x27ae1a(++_0x38ef90);}(_0x55aa,0x146));var _0xa55a=function(_0x2919e2,_0x3bed37){_0x2919e2=_0x2919e2-0x0;var _0x4d1062=_0x55aa[_0x2919e2];return _0x4d1062;};'use strict';var Sequelize=require('sequelize');module[_0xa55a('0x0')]={'name':{'type':Sequelize[_0xa55a('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xa55a('0x1')]},'write':{'type':Sequelize[_0xa55a('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0x63d4=['exports','STRING','BOOLEAN','sequelize'];(function(_0x86b78c,_0x3398fc){var _0x23c900=function(_0xda148c){while(--_0xda148c){_0x86b78c['push'](_0x86b78c['shift']());}};_0x23c900(++_0x3398fc);}(_0x63d4,0x117));var _0x463d=function(_0x1fa7ea,_0xf9eb23){_0x1fa7ea=_0x1fa7ea-0x0;var _0x207fa6=_0x63d4[_0x1fa7ea];return _0x207fa6;};'use strict';var Sequelize=require(_0x463d('0x0'));module[_0x463d('0x1')]={'name':{'type':Sequelize[_0x463d('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'write':{'type':Sequelize[_0x463d('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index 72b0a6a..4bd826f 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 _0xec8a=['ChatInternalMessage','user','omit','ids','getMembers','findOne','pick','hasOwnProperty','removeMembers','addMessage','getMessages','order','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','end','error','stack','name','send','index','map','ChatGroup','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','nolimit','sort','where','filters','filter','merge','options','includeAll','include','rows','catch','show','params','fields','length','find','create','body','destroy','describe','getUnread'];(function(_0x1b745b,_0x3e2d40){var _0x120a9d=function(_0x882a6c){while(--_0x882a6c){_0x1b745b['push'](_0x1b745b['shift']());}};_0x120a9d(++_0x3e2d40);}(_0xec8a,0x73));var _0xaec8=function(_0x58e5a5,_0x19b94b){_0x58e5a5=_0x58e5a5-0x0;var _0x362b61=_0xec8a[_0x58e5a5];return _0x362b61;};'use strict';var emlformat=require(_0xaec8('0x0'));var rimraf=require(_0xaec8('0x1'));var zipdir=require(_0xaec8('0x2'));var jsonpatch=require(_0xaec8('0x3'));var rp=require(_0xaec8('0x4'));var moment=require(_0xaec8('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xaec8('0x6'));var util=require('util');var path=require(_0xaec8('0x7'));var sox=require('sox');var csv=require(_0xaec8('0x8'));var ejs=require(_0xaec8('0x9'));var fs=require('fs');var fs_extra=require(_0xaec8('0xa'));var _=require(_0xaec8('0xb'));var squel=require(_0xaec8('0xc'));var crypto=require('crypto');var jsforce=require(_0xaec8('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xaec8('0x8'));var querystring=require(_0xaec8('0xe'));var Papa=require(_0xaec8('0xf'));var Redis=require(_0xaec8('0x10'));var authService=require(_0xaec8('0x11'));var qs=require(_0xaec8('0x12'));var as=require(_0xaec8('0x13'));var hardwareService=require(_0xaec8('0x14'));var logger=require('../../config/logger')(_0xaec8('0x15'));var utils=require(_0xaec8('0x16'));var config=require(_0xaec8('0x17'));var licenseUtil=require(_0xaec8('0x18'));var db=require(_0xaec8('0x19'))['db'];config[_0xaec8('0x1a')]=_[_0xaec8('0x1b')](config[_0xaec8('0x1a')],{'host':_0xaec8('0x1c'),'port':0x18eb});var socket=require(_0xaec8('0x1d'))(new Redis(config[_0xaec8('0x1a')]));require(_0xaec8('0x1e'))['register'](socket);function respondWithStatusCode(_0x2e7dcd,_0x1340d0){_0x1340d0=_0x1340d0||0xcc;return function(_0x4080e2){if(_0x4080e2){return _0x2e7dcd[_0xaec8('0x1f')](_0x1340d0);}return _0x2e7dcd[_0xaec8('0x20')](_0x1340d0)['end']();};}function respondWithResult(_0x10af0d,_0x297568){_0x297568=_0x297568||0xc8;return function(_0x73653f){if(_0x73653f){return _0x10af0d[_0xaec8('0x20')](_0x297568)[_0xaec8('0x21')](_0x73653f);}};}function respondWithFilteredResult(_0x5b6696,_0x33d75d){return function(_0x298723){if(_0x298723){var _0x4658f5=typeof _0x33d75d[_0xaec8('0x22')]===_0xaec8('0x23')&&typeof _0x33d75d[_0xaec8('0x24')]===_0xaec8('0x23');var _0x52b37d=_0x298723['count'];var _0x4d4b8a=_0x4658f5?0x0:_0x33d75d[_0xaec8('0x22')];var _0x59e820=_0x4658f5?_0x298723[_0xaec8('0x25')]:_0x33d75d['offset']+_0x33d75d['limit'];var _0x5cbecd;if(_0x59e820>=_0x52b37d){_0x59e820=_0x52b37d;_0x5cbecd=0xc8;}else{_0x5cbecd=0xce;}_0x5b6696[_0xaec8('0x20')](_0x5cbecd);return _0x5b6696[_0xaec8('0x26')](_0xaec8('0x27'),_0x4d4b8a+'-'+_0x59e820+'/'+_0x52b37d)['json'](_0x298723);}return null;};}function patchUpdates(_0x5052cf){return function(_0x4566c2){try{jsonpatch[_0xaec8('0x28')](_0x4566c2,_0x5052cf,!![]);}catch(_0x251274){return BPromise[_0xaec8('0x29')](_0x251274);}return _0x4566c2[_0xaec8('0x2a')]();};}function saveUpdates(_0x2f067c,_0x4f6c31){return function(_0x1fc9b8){if(_0x1fc9b8){return _0x1fc9b8[_0xaec8('0x2b')](_0x2f067c)['then'](function(_0x101bc7){return _0x101bc7;});}return null;};}function removeEntity(_0x59661e,_0xea716){return function(_0x3b096c){if(_0x3b096c){return _0x3b096c['destroy']()[_0xaec8('0x2c')](function(){_0x59661e[_0xaec8('0x20')](0xcc)[_0xaec8('0x2d')]();});}};}function handleEntityNotFound(_0x213d70,_0x3c7bb5){return function(_0x36298e){if(!_0x36298e){_0x213d70['sendStatus'](0x194);}return _0x36298e;};}function handleError(_0x1d2468,_0x5bb7ae){_0x5bb7ae=_0x5bb7ae||0x1f4;return function(_0x4e3a90){logger[_0xaec8('0x2e')](_0x4e3a90[_0xaec8('0x2f')]);if(_0x4e3a90['name']){delete _0x4e3a90[_0xaec8('0x30')];}_0x1d2468[_0xaec8('0x20')](_0x5bb7ae)[_0xaec8('0x31')](_0x4e3a90);};}exports[_0xaec8('0x32')]=function(_0x30246c,_0x4ad4c9){var _0x482517={},_0x3ce592={},_0x2a050e={'count':0x0,'rows':[]};var _0x9bd750=_[_0xaec8('0x33')](db[_0xaec8('0x34')][_0xaec8('0x35')],function(_0xa634f3){return{'name':_0xa634f3[_0xaec8('0x36')],'type':_0xa634f3[_0xaec8('0x37')][_0xaec8('0x38')]};});_0x3ce592['model']=_[_0xaec8('0x33')](_0x9bd750,'name');_0x3ce592[_0xaec8('0x39')]=_[_0xaec8('0x3a')](_0x30246c[_0xaec8('0x39')]);_0x3ce592['filters']=_[_0xaec8('0x3b')](_0x3ce592[_0xaec8('0x3c')],_0x3ce592[_0xaec8('0x39')]);_0x482517[_0xaec8('0x3d')]=_[_0xaec8('0x3b')](_0x3ce592[_0xaec8('0x3c')],qs['fields'](_0x30246c[_0xaec8('0x39')]['fields']));_0x482517[_0xaec8('0x3d')]=_0x482517[_0xaec8('0x3d')]['length']?_0x482517[_0xaec8('0x3d')]:_0x3ce592[_0xaec8('0x3c')];if(!_0x30246c['query']['hasOwnProperty'](_0xaec8('0x3e'))){_0x482517[_0xaec8('0x24')]=qs['limit'](_0x30246c[_0xaec8('0x39')][_0xaec8('0x24')]);_0x482517[_0xaec8('0x22')]=qs[_0xaec8('0x22')](_0x30246c[_0xaec8('0x39')]['offset']);}_0x482517['order']=qs[_0xaec8('0x3f')](_0x30246c['query']['sort']);_0x482517[_0xaec8('0x40')]=qs[_0xaec8('0x41')](_['pick'](_0x30246c['query'],_0x3ce592[_0xaec8('0x41')]),_0x9bd750);if(_0x30246c[_0xaec8('0x39')][_0xaec8('0x42')]){_0x482517['where']=_['merge'](_0x482517[_0xaec8('0x40')],{'$or':_[_0xaec8('0x33')](_0x9bd750,function(_0x135ad9){if(_0x135ad9[_0xaec8('0x37')]!=='VIRTUAL'){var _0x5f1b9f={};_0x5f1b9f[_0x135ad9[_0xaec8('0x30')]]={'$like':'%'+_0x30246c['query'][_0xaec8('0x42')]+'%'};return _0x5f1b9f;}})});}_0x482517=_[_0xaec8('0x43')]({},_0x482517,_0x30246c[_0xaec8('0x44')]);var _0xbc1de8={'where':_0x482517[_0xaec8('0x40')]};return db[_0xaec8('0x34')][_0xaec8('0x25')](_0xbc1de8)[_0xaec8('0x2c')](function(_0x4c96f4){_0x2a050e['count']=_0x4c96f4;if(_0x30246c[_0xaec8('0x39')][_0xaec8('0x45')]){_0x482517[_0xaec8('0x46')]=[{'all':!![]}];}return db[_0xaec8('0x34')]['findAll'](_0x482517);})[_0xaec8('0x2c')](function(_0x9acf9f){_0x2a050e[_0xaec8('0x47')]=_0x9acf9f;return _0x2a050e;})['then'](respondWithFilteredResult(_0x4ad4c9,_0x482517))[_0xaec8('0x48')](handleError(_0x4ad4c9,null));};exports[_0xaec8('0x49')]=function(_0x156b2f,_0x97591f){var _0x28aac6={'raw':!![],'where':{'id':_0x156b2f[_0xaec8('0x4a')]['id']}},_0x2561a6={};_0x2561a6[_0xaec8('0x3c')]=_['keys'](db[_0xaec8('0x34')]['rawAttributes']);_0x2561a6[_0xaec8('0x39')]=_[_0xaec8('0x3a')](_0x156b2f[_0xaec8('0x39')]);_0x2561a6[_0xaec8('0x41')]=_[_0xaec8('0x3b')](_0x2561a6[_0xaec8('0x3c')],_0x2561a6[_0xaec8('0x39')]);_0x28aac6[_0xaec8('0x3d')]=_[_0xaec8('0x3b')](_0x2561a6[_0xaec8('0x3c')],qs[_0xaec8('0x4b')](_0x156b2f['query']['fields']));_0x28aac6['attributes']=_0x28aac6['attributes'][_0xaec8('0x4c')]?_0x28aac6[_0xaec8('0x3d')]:_0x2561a6[_0xaec8('0x3c')];if(_0x156b2f[_0xaec8('0x39')][_0xaec8('0x45')]){_0x28aac6['include']=[{'all':!![]}];}_0x28aac6=_[_0xaec8('0x43')]({},_0x28aac6,_0x156b2f[_0xaec8('0x44')]);return db[_0xaec8('0x34')][_0xaec8('0x4d')](_0x28aac6)[_0xaec8('0x2c')](handleEntityNotFound(_0x97591f,null))['then'](respondWithResult(_0x97591f,null))[_0xaec8('0x48')](handleError(_0x97591f,null));};exports[_0xaec8('0x4e')]=function(_0x4f2016,_0x54454c){return db[_0xaec8('0x34')][_0xaec8('0x4e')](_0x4f2016[_0xaec8('0x4f')],{})[_0xaec8('0x2c')](respondWithResult(_0x54454c,0xc9))[_0xaec8('0x48')](handleError(_0x54454c,null));};exports[_0xaec8('0x2b')]=function(_0x41fb7f,_0x3a8a2e){if(_0x41fb7f['body']['id']){delete _0x41fb7f[_0xaec8('0x4f')]['id'];}return db[_0xaec8('0x34')][_0xaec8('0x4d')]({'where':{'id':_0x41fb7f[_0xaec8('0x4a')]['id']}})[_0xaec8('0x2c')](handleEntityNotFound(_0x3a8a2e,null))[_0xaec8('0x2c')](saveUpdates(_0x41fb7f[_0xaec8('0x4f')],null))[_0xaec8('0x2c')](respondWithResult(_0x3a8a2e,null))[_0xaec8('0x48')](handleError(_0x3a8a2e,null));};exports[_0xaec8('0x50')]=function(_0x3e4dc4,_0x1a44c7){return db['ChatGroup'][_0xaec8('0x4d')]({'where':{'id':_0x3e4dc4[_0xaec8('0x4a')]['id']}})[_0xaec8('0x2c')](handleEntityNotFound(_0x1a44c7,null))['then'](removeEntity(_0x1a44c7,null))[_0xaec8('0x48')](handleError(_0x1a44c7,null));};exports['describe']=function(_0x4eb966,_0xf8baa1){return db[_0xaec8('0x34')][_0xaec8('0x51')]()[_0xaec8('0x2c')](respondWithResult(_0xf8baa1,null))[_0xaec8('0x48')](handleError(_0xf8baa1,null));};exports[_0xaec8('0x52')]=function(_0x384567,_0x6dee1e,_0x5bf54e){return db[_0xaec8('0x53')][_0xaec8('0x25')]({'where':{'ChatGroupId':_0x384567['params']['id'],'ToId':_0x384567[_0xaec8('0x54')]['id'],'read':![]}})['then'](function(_0x51047c){return{'id':_['toInteger'](_0x384567[_0xaec8('0x4a')]['id']),'count':_0x51047c};})[_0xaec8('0x2c')](respondWithResult(_0x6dee1e,null))['catch'](handleError(_0x6dee1e,null));};exports['addMembers']=function(_0x58e95a,_0xf1b525,_0x2bc341){return db[_0xaec8('0x34')][_0xaec8('0x4d')]({'where':{'id':_0x58e95a[_0xaec8('0x4a')]['id']}})[_0xaec8('0x2c')](handleEntityNotFound(_0xf1b525,null))[_0xaec8('0x2c')](function(_0xd530b7){if(_0xd530b7){return _0xd530b7['addMembers'](_0x58e95a[_0xaec8('0x4f')]['ids'],_[_0xaec8('0x55')](_0x58e95a[_0xaec8('0x4f')],[_0xaec8('0x56'),'id'])||{});}})[_0xaec8('0x2c')](respondWithResult(_0xf1b525,null))[_0xaec8('0x48')](handleError(_0xf1b525,null));};exports[_0xaec8('0x57')]=function(_0x47a583,_0x290519,_0x2032eb){var _0x35553d={};var _0x23fa84={};var _0x3c604d;var _0x2ef7bd;return db[_0xaec8('0x34')][_0xaec8('0x58')]({'where':{'id':_0x47a583['params']['id']}})[_0xaec8('0x2c')](handleEntityNotFound(_0x290519,null))['then'](function(_0xcca249){if(_0xcca249){_0x3c604d=_0xcca249;_0x23fa84[_0xaec8('0x3c')]=_['keys'](db['User'][_0xaec8('0x35')]);_0x23fa84[_0xaec8('0x39')]=_[_0xaec8('0x3a')](_0x47a583[_0xaec8('0x39')]);_0x23fa84[_0xaec8('0x41')]=_['intersection'](_0x23fa84['model'],_0x23fa84['query']);_0x35553d[_0xaec8('0x3d')]=_[_0xaec8('0x3b')](_0x23fa84[_0xaec8('0x3c')],qs[_0xaec8('0x4b')](_0x47a583['query'][_0xaec8('0x4b')]));_0x35553d[_0xaec8('0x3d')]=_0x35553d[_0xaec8('0x3d')]['length']?_0x35553d[_0xaec8('0x3d')]:_0x23fa84[_0xaec8('0x3c')];_0x35553d['order']=qs[_0xaec8('0x3f')](_0x47a583[_0xaec8('0x39')][_0xaec8('0x3f')]);_0x35553d[_0xaec8('0x40')]=qs['filters'](_[_0xaec8('0x59')](_0x47a583['query'],_0x23fa84['filters']));if(_0x47a583[_0xaec8('0x39')]['filter']){_0x35553d[_0xaec8('0x40')]=_[_0xaec8('0x43')](_0x35553d[_0xaec8('0x40')],{'$or':_[_0xaec8('0x33')](_0x35553d[_0xaec8('0x3d')],function(_0x5d6f4b){var _0x3f7249={};_0x3f7249[_0x5d6f4b]={'$like':'%'+_0x47a583[_0xaec8('0x39')][_0xaec8('0x42')]+'%'};return _0x3f7249;})});}_0x35553d=_[_0xaec8('0x43')]({},_0x35553d,_0x47a583[_0xaec8('0x44')]);return _0x3c604d[_0xaec8('0x57')](_0x35553d);}})['then'](function(_0x53e6ad){if(_0x53e6ad){_0x2ef7bd=_0x53e6ad[_0xaec8('0x4c')];if(!_0x47a583[_0xaec8('0x39')][_0xaec8('0x5a')](_0xaec8('0x3e'))){_0x35553d[_0xaec8('0x24')]=qs[_0xaec8('0x24')](_0x47a583[_0xaec8('0x39')][_0xaec8('0x24')]);_0x35553d[_0xaec8('0x22')]=qs[_0xaec8('0x22')](_0x47a583['query'][_0xaec8('0x22')]);}return _0x3c604d[_0xaec8('0x57')](_0x35553d);}})['then'](function(_0x553e01){if(_0x553e01){return _0x553e01?{'count':_0x2ef7bd,'rows':_0x553e01}:null;}})[_0xaec8('0x2c')](respondWithResult(_0x290519,null))['catch'](handleError(_0x290519,null));};exports[_0xaec8('0x5b')]=function(_0x132ac7,_0x344ade,_0x1c14ae){return db[_0xaec8('0x34')]['find']({'where':{'id':_0x132ac7[_0xaec8('0x4a')]['id']}})['then'](handleEntityNotFound(_0x344ade,null))['then'](function(_0x505b82){if(_0x505b82){return _0x505b82[_0xaec8('0x5b')](_0x132ac7[_0xaec8('0x39')][_0xaec8('0x56')]);}})[_0xaec8('0x2c')](respondWithStatusCode(_0x344ade,null))[_0xaec8('0x48')](handleError(_0x344ade,null));};exports[_0xaec8('0x5c')]=function(_0x10526a,_0x2e9110,_0x3d3bb8){if(_0x10526a[_0xaec8('0x4f')]['id']){delete _0x10526a[_0xaec8('0x4f')]['id'];}return db[_0xaec8('0x34')][_0xaec8('0x4d')]({'where':{'id':_0x10526a[_0xaec8('0x4a')]['id']}})[_0xaec8('0x2c')](handleEntityNotFound(_0x2e9110,null))['then'](function(_0x2fae7c){if(_0x2fae7c){_0x10526a[_0xaec8('0x4f')]['ChatGroupId']=_0x2fae7c['id'];return db[_0xaec8('0x53')][_0xaec8('0x4e')](_0x10526a[_0xaec8('0x4f')]);}})[_0xaec8('0x2c')](respondWithResult(_0x2e9110,null))[_0xaec8('0x48')](handleError(_0x2e9110,null));};exports[_0xaec8('0x5d')]=function(_0x59ce3f,_0x34f357,_0x3296a7){var _0x39e8bf={};var _0x16cbb0={};var _0x3874b4;var _0x317d0c;return db[_0xaec8('0x34')][_0xaec8('0x58')]({'where':{'id':_0x59ce3f[_0xaec8('0x4a')]['id']}})[_0xaec8('0x2c')](handleEntityNotFound(_0x34f357,null))[_0xaec8('0x2c')](function(_0x17a8ee){if(_0x17a8ee){_0x3874b4=_0x17a8ee;_0x16cbb0[_0xaec8('0x3c')]=_[_0xaec8('0x3a')](db[_0xaec8('0x53')][_0xaec8('0x35')]);_0x16cbb0['query']=_[_0xaec8('0x3a')](_0x59ce3f[_0xaec8('0x39')]);_0x16cbb0['filters']=_['intersection'](_0x16cbb0[_0xaec8('0x3c')],_0x16cbb0[_0xaec8('0x39')]);_0x39e8bf[_0xaec8('0x3d')]=_[_0xaec8('0x3b')](_0x16cbb0['model'],qs['fields'](_0x59ce3f['query'][_0xaec8('0x4b')]));_0x39e8bf[_0xaec8('0x3d')]=_0x39e8bf[_0xaec8('0x3d')]['length']?_0x39e8bf[_0xaec8('0x3d')]:_0x16cbb0[_0xaec8('0x3c')];_0x39e8bf[_0xaec8('0x5e')]=qs[_0xaec8('0x3f')](_0x59ce3f[_0xaec8('0x39')][_0xaec8('0x3f')]);_0x39e8bf[_0xaec8('0x40')]=qs[_0xaec8('0x41')](_['pick'](_0x59ce3f[_0xaec8('0x39')],_0x16cbb0[_0xaec8('0x41')]));if(_0x59ce3f[_0xaec8('0x39')][_0xaec8('0x42')]){_0x39e8bf[_0xaec8('0x40')]=_['merge'](_0x39e8bf[_0xaec8('0x40')],{'$or':_['map'](_0x39e8bf['attributes'],function(_0x1dfb50){var _0x2bc2c={};_0x2bc2c[_0x1dfb50]={'$like':'%'+_0x59ce3f[_0xaec8('0x39')][_0xaec8('0x42')]+'%'};return _0x2bc2c;})});}if(_0x59ce3f['query'][_0xaec8('0x5f')]){var _0x3d2759=_0x59ce3f[_0xaec8('0x39')]['$gte'][_0xaec8('0x60')](',');var _0x5b0586={};_0x5b0586[_0x3d2759[0x0]]={'$gte':moment(_0x3d2759[0x1])[_0xaec8('0x61')](_0xaec8('0x62'))};_0x39e8bf[_0xaec8('0x40')]=_[_0xaec8('0x43')](_0x39e8bf[_0xaec8('0x40')],_0x5b0586);}_0x39e8bf=_[_0xaec8('0x43')]({},_0x39e8bf,_0x59ce3f[_0xaec8('0x44')]);return _0x3874b4[_0xaec8('0x5d')](_0x39e8bf);}})[_0xaec8('0x2c')](function(_0x8ade04){if(_0x8ade04){_0x317d0c=_0x8ade04[_0xaec8('0x4c')];if(!_0x59ce3f[_0xaec8('0x39')]['hasOwnProperty'](_0xaec8('0x3e'))){_0x39e8bf[_0xaec8('0x24')]=qs[_0xaec8('0x24')](_0x59ce3f[_0xaec8('0x39')][_0xaec8('0x24')]);_0x39e8bf[_0xaec8('0x22')]=qs['offset'](_0x59ce3f[_0xaec8('0x39')]['offset']);}return _0x3874b4['getMessages'](_0x39e8bf);}})[_0xaec8('0x2c')](function(_0x5663ea){if(_0x5663ea){return _0x5663ea?{'count':_0x317d0c,'rows':_0x5663ea}:null;}})[_0xaec8('0x2c')](respondWithResult(_0x34f357,null))[_0xaec8('0x48')](handleError(_0x34f357,null));}; \ No newline at end of file +var _0x0004=['findAll','rows','catch','params','find','body','describe','getUnread','ChatInternalMessage','user','toInteger','addMembers','ids','getMembers','User','pick','filter','removeMembers','addMessage','ChatGroupId','getMessages','findOne','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','./chatGroup.socket','register','end','status','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','ChatGroup','rawAttributes','fieldName','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','type','VIRTUAL','options','includeAll','include'];(function(_0x1c9e36,_0x3866a7){var _0x5f34d5=function(_0x1d1665){while(--_0x1d1665){_0x1c9e36['push'](_0x1c9e36['shift']());}};_0x5f34d5(++_0x3866a7);}(_0x0004,0xe0));var _0x4000=function(_0x23a477,_0x36bd86){_0x23a477=_0x23a477-0x0;var _0x1a6fb2=_0x0004[_0x23a477];return _0x1a6fb2;};'use strict';var emlformat=require(_0x4000('0x0'));var rimraf=require(_0x4000('0x1'));var zipdir=require(_0x4000('0x2'));var jsonpatch=require(_0x4000('0x3'));var rp=require(_0x4000('0x4'));var moment=require(_0x4000('0x5'));var BPromise=require(_0x4000('0x6'));var Mustache=require(_0x4000('0x7'));var util=require(_0x4000('0x8'));var path=require(_0x4000('0x9'));var sox=require(_0x4000('0xa'));var csv=require(_0x4000('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4000('0xc'));var squel=require(_0x4000('0xd'));var crypto=require(_0x4000('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x4000('0xf'));var toCsv=require(_0x4000('0xb'));var querystring=require(_0x4000('0x10'));var Papa=require('papaparse');var Redis=require(_0x4000('0x11'));var authService=require(_0x4000('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4000('0x13'));var logger=require(_0x4000('0x14'))(_0x4000('0x15'));var utils=require(_0x4000('0x16'));var config=require(_0x4000('0x17'));var licenseUtil=require(_0x4000('0x18'));var db=require('../../mysqldb')['db'];config[_0x4000('0x19')]=_[_0x4000('0x1a')](config[_0x4000('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x4000('0x1b'))(new Redis(config[_0x4000('0x19')]));require(_0x4000('0x1c'))[_0x4000('0x1d')](socket);function respondWithStatusCode(_0x52b63e,_0x4aacfc){_0x4aacfc=_0x4aacfc||0xcc;return function(_0x3bb30b){if(_0x3bb30b){return _0x52b63e['sendStatus'](_0x4aacfc);}return _0x52b63e['status'](_0x4aacfc)[_0x4000('0x1e')]();};}function respondWithResult(_0x9fddaa,_0x2ab5ee){_0x2ab5ee=_0x2ab5ee||0xc8;return function(_0x5ac15d){if(_0x5ac15d){return _0x9fddaa[_0x4000('0x1f')](_0x2ab5ee)[_0x4000('0x20')](_0x5ac15d);}};}function respondWithFilteredResult(_0x5a5e9d,_0x2c64eb){return function(_0x22617d){if(_0x22617d){var _0x22cadf=typeof _0x2c64eb[_0x4000('0x21')]===_0x4000('0x22')&&typeof _0x2c64eb[_0x4000('0x23')]===_0x4000('0x22');var _0x22f9f0=_0x22617d[_0x4000('0x24')];var _0x56e3b8=_0x22cadf?0x0:_0x2c64eb[_0x4000('0x21')];var _0x1b97dd=_0x22cadf?_0x22617d[_0x4000('0x24')]:_0x2c64eb['offset']+_0x2c64eb[_0x4000('0x23')];var _0x562599;if(_0x1b97dd>=_0x22f9f0){_0x1b97dd=_0x22f9f0;_0x562599=0xc8;}else{_0x562599=0xce;}_0x5a5e9d['status'](_0x562599);return _0x5a5e9d[_0x4000('0x25')]('Content-Range',_0x56e3b8+'-'+_0x1b97dd+'/'+_0x22f9f0)['json'](_0x22617d);}return null;};}function patchUpdates(_0x1003eb){return function(_0x2360e1){try{jsonpatch[_0x4000('0x26')](_0x2360e1,_0x1003eb,!![]);}catch(_0x2dc352){return BPromise['reject'](_0x2dc352);}return _0x2360e1[_0x4000('0x27')]();};}function saveUpdates(_0x5172cc,_0x56f101){return function(_0x5bfcdb){if(_0x5bfcdb){return _0x5bfcdb[_0x4000('0x28')](_0x5172cc)[_0x4000('0x29')](function(_0x1ee8d7){return _0x1ee8d7;});}return null;};}function removeEntity(_0x18cd0e,_0x19bb9a){return function(_0x11f7eb){if(_0x11f7eb){return _0x11f7eb[_0x4000('0x2a')]()['then'](function(){_0x18cd0e['status'](0xcc)[_0x4000('0x1e')]();});}};}function handleEntityNotFound(_0x1808e5,_0x3bd7ed){return function(_0x33fb52){if(!_0x33fb52){_0x1808e5[_0x4000('0x2b')](0x194);}return _0x33fb52;};}function handleError(_0x5cff85,_0x2019d4){_0x2019d4=_0x2019d4||0x1f4;return function(_0x560dde){logger[_0x4000('0x2c')](_0x560dde[_0x4000('0x2d')]);if(_0x560dde[_0x4000('0x2e')]){delete _0x560dde[_0x4000('0x2e')];}_0x5cff85['status'](_0x2019d4)[_0x4000('0x2f')](_0x560dde);};}exports[_0x4000('0x30')]=function(_0x3c7c18,_0x3b6864){var _0x5c5a42={},_0x43a194={},_0x1067e8={'count':0x0,'rows':[]};var _0x4e989b=_[_0x4000('0x31')](db[_0x4000('0x32')][_0x4000('0x33')],function(_0x441e01){return{'name':_0x441e01[_0x4000('0x34')],'type':_0x441e01['type'][_0x4000('0x35')]};});_0x43a194['model']=_[_0x4000('0x31')](_0x4e989b,_0x4000('0x2e'));_0x43a194[_0x4000('0x36')]=_[_0x4000('0x37')](_0x3c7c18[_0x4000('0x36')]);_0x43a194[_0x4000('0x38')]=_['intersection'](_0x43a194[_0x4000('0x39')],_0x43a194['query']);_0x5c5a42[_0x4000('0x3a')]=_[_0x4000('0x3b')](_0x43a194['model'],qs[_0x4000('0x3c')](_0x3c7c18[_0x4000('0x36')][_0x4000('0x3c')]));_0x5c5a42[_0x4000('0x3a')]=_0x5c5a42['attributes'][_0x4000('0x3d')]?_0x5c5a42[_0x4000('0x3a')]:_0x43a194[_0x4000('0x39')];if(!_0x3c7c18[_0x4000('0x36')][_0x4000('0x3e')](_0x4000('0x3f'))){_0x5c5a42['limit']=qs[_0x4000('0x23')](_0x3c7c18[_0x4000('0x36')]['limit']);_0x5c5a42[_0x4000('0x21')]=qs[_0x4000('0x21')](_0x3c7c18[_0x4000('0x36')][_0x4000('0x21')]);}_0x5c5a42[_0x4000('0x40')]=qs[_0x4000('0x41')](_0x3c7c18[_0x4000('0x36')][_0x4000('0x41')]);_0x5c5a42['where']=qs['filters'](_['pick'](_0x3c7c18['query'],_0x43a194['filters']),_0x4e989b);if(_0x3c7c18['query']['filter']){_0x5c5a42[_0x4000('0x42')]=_[_0x4000('0x43')](_0x5c5a42[_0x4000('0x42')],{'$or':_[_0x4000('0x31')](_0x4e989b,function(_0x71dabf){if(_0x71dabf[_0x4000('0x44')]!==_0x4000('0x45')){var _0xd259ee={};_0xd259ee[_0x71dabf[_0x4000('0x2e')]]={'$like':'%'+_0x3c7c18['query']['filter']+'%'};return _0xd259ee;}})});}_0x5c5a42=_['merge']({},_0x5c5a42,_0x3c7c18[_0x4000('0x46')]);var _0x322659={'where':_0x5c5a42['where']};return db['ChatGroup'][_0x4000('0x24')](_0x322659)[_0x4000('0x29')](function(_0x213bc6){_0x1067e8[_0x4000('0x24')]=_0x213bc6;if(_0x3c7c18[_0x4000('0x36')][_0x4000('0x47')]){_0x5c5a42[_0x4000('0x48')]=[{'all':!![]}];}return db[_0x4000('0x32')][_0x4000('0x49')](_0x5c5a42);})['then'](function(_0x5f33e5){_0x1067e8[_0x4000('0x4a')]=_0x5f33e5;return _0x1067e8;})[_0x4000('0x29')](respondWithFilteredResult(_0x3b6864,_0x5c5a42))[_0x4000('0x4b')](handleError(_0x3b6864,null));};exports['show']=function(_0x534b1e,_0x3a85a8){var _0x435d41={'raw':!![],'where':{'id':_0x534b1e[_0x4000('0x4c')]['id']}},_0x38f4fa={};_0x38f4fa[_0x4000('0x39')]=_[_0x4000('0x37')](db[_0x4000('0x32')][_0x4000('0x33')]);_0x38f4fa[_0x4000('0x36')]=_[_0x4000('0x37')](_0x534b1e[_0x4000('0x36')]);_0x38f4fa[_0x4000('0x38')]=_[_0x4000('0x3b')](_0x38f4fa[_0x4000('0x39')],_0x38f4fa['query']);_0x435d41['attributes']=_[_0x4000('0x3b')](_0x38f4fa[_0x4000('0x39')],qs[_0x4000('0x3c')](_0x534b1e[_0x4000('0x36')]['fields']));_0x435d41[_0x4000('0x3a')]=_0x435d41[_0x4000('0x3a')][_0x4000('0x3d')]?_0x435d41[_0x4000('0x3a')]:_0x38f4fa[_0x4000('0x39')];if(_0x534b1e[_0x4000('0x36')][_0x4000('0x47')]){_0x435d41[_0x4000('0x48')]=[{'all':!![]}];}_0x435d41=_['merge']({},_0x435d41,_0x534b1e['options']);return db['ChatGroup'][_0x4000('0x4d')](_0x435d41)[_0x4000('0x29')](handleEntityNotFound(_0x3a85a8,null))[_0x4000('0x29')](respondWithResult(_0x3a85a8,null))['catch'](handleError(_0x3a85a8,null));};exports['create']=function(_0x12bad3,_0x5af3b9){return db[_0x4000('0x32')]['create'](_0x12bad3[_0x4000('0x4e')],{})[_0x4000('0x29')](respondWithResult(_0x5af3b9,0xc9))[_0x4000('0x4b')](handleError(_0x5af3b9,null));};exports[_0x4000('0x28')]=function(_0xeeaf58,_0x502ec2){if(_0xeeaf58[_0x4000('0x4e')]['id']){delete _0xeeaf58[_0x4000('0x4e')]['id'];}return db[_0x4000('0x32')]['find']({'where':{'id':_0xeeaf58[_0x4000('0x4c')]['id']}})[_0x4000('0x29')](handleEntityNotFound(_0x502ec2,null))[_0x4000('0x29')](saveUpdates(_0xeeaf58[_0x4000('0x4e')],null))[_0x4000('0x29')](respondWithResult(_0x502ec2,null))[_0x4000('0x4b')](handleError(_0x502ec2,null));};exports[_0x4000('0x2a')]=function(_0x534036,_0x1d7bae){return db[_0x4000('0x32')][_0x4000('0x4d')]({'where':{'id':_0x534036[_0x4000('0x4c')]['id']}})[_0x4000('0x29')](handleEntityNotFound(_0x1d7bae,null))['then'](removeEntity(_0x1d7bae,null))[_0x4000('0x4b')](handleError(_0x1d7bae,null));};exports[_0x4000('0x4f')]=function(_0x19d690,_0x3c00cf){return db[_0x4000('0x32')][_0x4000('0x4f')]()['then'](respondWithResult(_0x3c00cf,null))[_0x4000('0x4b')](handleError(_0x3c00cf,null));};exports[_0x4000('0x50')]=function(_0x27436e,_0x1317a6,_0xd161f3){return db[_0x4000('0x51')][_0x4000('0x24')]({'where':{'ChatGroupId':_0x27436e[_0x4000('0x4c')]['id'],'ToId':_0x27436e[_0x4000('0x52')]['id'],'read':![]}})[_0x4000('0x29')](function(_0x43421b){return{'id':_[_0x4000('0x53')](_0x27436e[_0x4000('0x4c')]['id']),'count':_0x43421b};})[_0x4000('0x29')](respondWithResult(_0x1317a6,null))[_0x4000('0x4b')](handleError(_0x1317a6,null));};exports[_0x4000('0x54')]=function(_0x2326b9,_0x16cacc,_0x33fd51){return db[_0x4000('0x32')][_0x4000('0x4d')]({'where':{'id':_0x2326b9['params']['id']}})[_0x4000('0x29')](handleEntityNotFound(_0x16cacc,null))[_0x4000('0x29')](function(_0x2b3eed){if(_0x2b3eed){return _0x2b3eed['addMembers'](_0x2326b9[_0x4000('0x4e')]['ids'],_['omit'](_0x2326b9[_0x4000('0x4e')],[_0x4000('0x55'),'id'])||{});}})[_0x4000('0x29')](respondWithResult(_0x16cacc,null))[_0x4000('0x4b')](handleError(_0x16cacc,null));};exports[_0x4000('0x56')]=function(_0x3a2520,_0x1342a0,_0x2b5b6d){var _0xe45d90={};var _0x38ab73={};var _0x2611ad;var _0x3042e4;return db[_0x4000('0x32')]['findOne']({'where':{'id':_0x3a2520['params']['id']}})['then'](handleEntityNotFound(_0x1342a0,null))[_0x4000('0x29')](function(_0x134828){if(_0x134828){_0x2611ad=_0x134828;_0x38ab73['model']=_[_0x4000('0x37')](db[_0x4000('0x57')][_0x4000('0x33')]);_0x38ab73['query']=_[_0x4000('0x37')](_0x3a2520[_0x4000('0x36')]);_0x38ab73['filters']=_[_0x4000('0x3b')](_0x38ab73[_0x4000('0x39')],_0x38ab73[_0x4000('0x36')]);_0xe45d90['attributes']=_[_0x4000('0x3b')](_0x38ab73[_0x4000('0x39')],qs[_0x4000('0x3c')](_0x3a2520[_0x4000('0x36')]['fields']));_0xe45d90['attributes']=_0xe45d90[_0x4000('0x3a')][_0x4000('0x3d')]?_0xe45d90[_0x4000('0x3a')]:_0x38ab73['model'];_0xe45d90[_0x4000('0x40')]=qs[_0x4000('0x41')](_0x3a2520[_0x4000('0x36')][_0x4000('0x41')]);_0xe45d90[_0x4000('0x42')]=qs[_0x4000('0x38')](_[_0x4000('0x58')](_0x3a2520[_0x4000('0x36')],_0x38ab73['filters']));if(_0x3a2520[_0x4000('0x36')][_0x4000('0x59')]){_0xe45d90[_0x4000('0x42')]=_[_0x4000('0x43')](_0xe45d90['where'],{'$or':_['map'](_0xe45d90[_0x4000('0x3a')],function(_0x117f84){var _0x90f4e5={};_0x90f4e5[_0x117f84]={'$like':'%'+_0x3a2520['query'][_0x4000('0x59')]+'%'};return _0x90f4e5;})});}_0xe45d90=_['merge']({},_0xe45d90,_0x3a2520[_0x4000('0x46')]);return _0x2611ad['getMembers'](_0xe45d90);}})[_0x4000('0x29')](function(_0xddf384){if(_0xddf384){_0x3042e4=_0xddf384[_0x4000('0x3d')];if(!_0x3a2520[_0x4000('0x36')]['hasOwnProperty']('nolimit')){_0xe45d90[_0x4000('0x23')]=qs[_0x4000('0x23')](_0x3a2520['query'][_0x4000('0x23')]);_0xe45d90[_0x4000('0x21')]=qs[_0x4000('0x21')](_0x3a2520[_0x4000('0x36')][_0x4000('0x21')]);}return _0x2611ad['getMembers'](_0xe45d90);}})[_0x4000('0x29')](function(_0x138bfd){if(_0x138bfd){return _0x138bfd?{'count':_0x3042e4,'rows':_0x138bfd}:null;}})[_0x4000('0x29')](respondWithResult(_0x1342a0,null))[_0x4000('0x4b')](handleError(_0x1342a0,null));};exports[_0x4000('0x5a')]=function(_0x23eef3,_0x31fb93,_0x3230b0){return db[_0x4000('0x32')][_0x4000('0x4d')]({'where':{'id':_0x23eef3[_0x4000('0x4c')]['id']}})[_0x4000('0x29')](handleEntityNotFound(_0x31fb93,null))[_0x4000('0x29')](function(_0x2f1504){if(_0x2f1504){return _0x2f1504[_0x4000('0x5a')](_0x23eef3[_0x4000('0x36')][_0x4000('0x55')]);}})[_0x4000('0x29')](respondWithStatusCode(_0x31fb93,null))[_0x4000('0x4b')](handleError(_0x31fb93,null));};exports[_0x4000('0x5b')]=function(_0x42ec30,_0x1dd83c,_0x14b430){if(_0x42ec30[_0x4000('0x4e')]['id']){delete _0x42ec30[_0x4000('0x4e')]['id'];}return db['ChatGroup'][_0x4000('0x4d')]({'where':{'id':_0x42ec30[_0x4000('0x4c')]['id']}})['then'](handleEntityNotFound(_0x1dd83c,null))[_0x4000('0x29')](function(_0x24da11){if(_0x24da11){_0x42ec30[_0x4000('0x4e')][_0x4000('0x5c')]=_0x24da11['id'];return db[_0x4000('0x51')]['create'](_0x42ec30['body']);}})['then'](respondWithResult(_0x1dd83c,null))[_0x4000('0x4b')](handleError(_0x1dd83c,null));};exports[_0x4000('0x5d')]=function(_0x4899c4,_0x502936,_0x31e882){var _0x5d0e1e={};var _0x28ab1b={};var _0x11fa23;var _0x37b79d;return db[_0x4000('0x32')][_0x4000('0x5e')]({'where':{'id':_0x4899c4[_0x4000('0x4c')]['id']}})['then'](handleEntityNotFound(_0x502936,null))['then'](function(_0x3d1bec){if(_0x3d1bec){_0x11fa23=_0x3d1bec;_0x28ab1b[_0x4000('0x39')]=_[_0x4000('0x37')](db[_0x4000('0x51')][_0x4000('0x33')]);_0x28ab1b['query']=_['keys'](_0x4899c4[_0x4000('0x36')]);_0x28ab1b[_0x4000('0x38')]=_[_0x4000('0x3b')](_0x28ab1b['model'],_0x28ab1b['query']);_0x5d0e1e[_0x4000('0x3a')]=_['intersection'](_0x28ab1b[_0x4000('0x39')],qs['fields'](_0x4899c4[_0x4000('0x36')]['fields']));_0x5d0e1e['attributes']=_0x5d0e1e[_0x4000('0x3a')]['length']?_0x5d0e1e[_0x4000('0x3a')]:_0x28ab1b[_0x4000('0x39')];_0x5d0e1e[_0x4000('0x40')]=qs['sort'](_0x4899c4['query']['sort']);_0x5d0e1e[_0x4000('0x42')]=qs[_0x4000('0x38')](_['pick'](_0x4899c4[_0x4000('0x36')],_0x28ab1b['filters']));if(_0x4899c4['query'][_0x4000('0x59')]){_0x5d0e1e['where']=_[_0x4000('0x43')](_0x5d0e1e[_0x4000('0x42')],{'$or':_[_0x4000('0x31')](_0x5d0e1e[_0x4000('0x3a')],function(_0x579c0d){var _0x36e28d={};_0x36e28d[_0x579c0d]={'$like':'%'+_0x4899c4[_0x4000('0x36')][_0x4000('0x59')]+'%'};return _0x36e28d;})});}if(_0x4899c4[_0x4000('0x36')][_0x4000('0x5f')]){var _0x20ed8a=_0x4899c4[_0x4000('0x36')][_0x4000('0x5f')][_0x4000('0x60')](',');var _0x2fae90={};_0x2fae90[_0x20ed8a[0x0]]={'$gte':moment(_0x20ed8a[0x1])[_0x4000('0x61')](_0x4000('0x62'))};_0x5d0e1e[_0x4000('0x42')]=_['merge'](_0x5d0e1e['where'],_0x2fae90);}_0x5d0e1e=_[_0x4000('0x43')]({},_0x5d0e1e,_0x4899c4[_0x4000('0x46')]);return _0x11fa23['getMessages'](_0x5d0e1e);}})[_0x4000('0x29')](function(_0x17a35e){if(_0x17a35e){_0x37b79d=_0x17a35e['length'];if(!_0x4899c4['query']['hasOwnProperty'](_0x4000('0x3f'))){_0x5d0e1e[_0x4000('0x23')]=qs['limit'](_0x4899c4[_0x4000('0x36')]['limit']);_0x5d0e1e['offset']=qs[_0x4000('0x21')](_0x4899c4[_0x4000('0x36')][_0x4000('0x21')]);}return _0x11fa23[_0x4000('0x5d')](_0x5d0e1e);}})[_0x4000('0x29')](function(_0x303bfb){if(_0x303bfb){return _0x303bfb?{'count':_0x37b79d,'rows':_0x303bfb}:null;}})[_0x4000('0x29')](respondWithResult(_0x502936,null))[_0x4000('0x4b')](handleError(_0x502936,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index da32801..1907fac 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 _0x5386=['hook','events','../../mysqldb','ChatGroup','setMaxListeners','update','remove','emit'];(function(_0x65e286,_0x4f908c){var _0x231609=function(_0x33b706){while(--_0x33b706){_0x65e286['push'](_0x65e286['shift']());}};_0x231609(++_0x4f908c);}(_0x5386,0x1e1));var _0x6538=function(_0x42a584,_0x2d9ee3){_0x42a584=_0x42a584-0x0;var _0x56be59=_0x5386[_0x42a584];return _0x56be59;};'use strict';var EventEmitter=require(_0x6538('0x0'));var ChatGroup=require(_0x6538('0x1'))['db'][_0x6538('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x6538('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x6538('0x4'),'afterDestroy':_0x6538('0x5')};function emitEvent(_0x105c66){return function(_0x1d2feb,_0x3721e7,_0x1bf31b){ChatGroupEvents[_0x6538('0x6')](_0x105c66+':'+_0x1d2feb['id'],_0x1d2feb);ChatGroupEvents[_0x6538('0x6')](_0x105c66,_0x1d2feb);_0x1bf31b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatGroup[_0x6538('0x7')](e,emitEvent(event));}}module['exports']=ChatGroupEvents; \ No newline at end of file +var _0x0e66=['update','remove','emit','hasOwnProperty','exports','events','../../mysqldb','ChatGroup'];(function(_0x382c73,_0x199cab){var _0x1dd0bf=function(_0x358747){while(--_0x358747){_0x382c73['push'](_0x382c73['shift']());}};_0x1dd0bf(++_0x199cab);}(_0x0e66,0xb5));var _0x60e6=function(_0x5c5c52,_0x36d085){_0x5c5c52=_0x5c5c52-0x0;var _0x4229ff=_0x0e66[_0x5c5c52];return _0x4229ff;};'use strict';var EventEmitter=require(_0x60e6('0x0'));var ChatGroup=require(_0x60e6('0x1'))['db'][_0x60e6('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x60e6('0x3'),'afterDestroy':_0x60e6('0x4')};function emitEvent(_0x2a15bf){return function(_0xd71562,_0x44698d,_0x1af524){ChatGroupEvents['emit'](_0x2a15bf+':'+_0xd71562['id'],_0xd71562);ChatGroupEvents[_0x60e6('0x5')](_0x2a15bf,_0xd71562);_0x1af524(null);};}for(var e in events){if(events[_0x60e6('0x6')](e)){var event=events[e];ChatGroup['hook'](e,emitEvent(event));}}module[_0x60e6('0x7')]=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index d786d67..5b926b5 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 _0x0fd5=['path','rimraf','./chatGroup.attributes','exports','define','ChatGroup','chat_groups','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x2742db,_0x58e00c){var _0x18659e=function(_0x5bd3ac){while(--_0x5bd3ac){_0x2742db['push'](_0x2742db['shift']());}};_0x18659e(++_0x58e00c);}(_0x0fd5,0x13f));var _0x50fd=function(_0x5a726d,_0x653ee6){_0x5a726d=_0x5a726d-0x0;var _0x16157=_0x0fd5[_0x5a726d];return _0x16157;};'use strict';var _=require(_0x50fd('0x0'));var util=require('util');var logger=require(_0x50fd('0x1'))(_0x50fd('0x2'));var moment=require(_0x50fd('0x3'));var BPromise=require(_0x50fd('0x4'));var rp=require(_0x50fd('0x5'));var fs=require('fs');var path=require(_0x50fd('0x6'));var rimraf=require(_0x50fd('0x7'));var config=require('../../config/environment');var attributes=require(_0x50fd('0x8'));module[_0x50fd('0x9')]=function(_0x294fe8,_0x3224ac){return _0x294fe8[_0x50fd('0xa')](_0x50fd('0xb'),attributes,{'tableName':_0x50fd('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdb5c=['exports','ChatGroup','chat_groups','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatGroup.attributes'];(function(_0x5e348e,_0x5de913){var _0x1806e7=function(_0x536004){while(--_0x536004){_0x5e348e['push'](_0x5e348e['shift']());}};_0x1806e7(++_0x5de913);}(_0xdb5c,0x19b));var _0xcdb5=function(_0xdf7c37,_0x1a6d5a){_0xdf7c37=_0xdf7c37-0x0;var _0x3b989f=_0xdb5c[_0xdf7c37];return _0x3b989f;};'use strict';var _=require(_0xcdb5('0x0'));var util=require(_0xcdb5('0x1'));var logger=require('../../config/logger')(_0xcdb5('0x2'));var moment=require(_0xcdb5('0x3'));var BPromise=require(_0xcdb5('0x4'));var rp=require(_0xcdb5('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcdb5('0x6'));var config=require(_0xcdb5('0x7'));var attributes=require(_0xcdb5('0x8'));module[_0xcdb5('0x9')]=function(_0x1e3138,_0x75b025){return _0x1e3138['define'](_0xcdb5('0xa'),attributes,{'tableName':_0xcdb5('0xb'),'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 07a67a7..78c3479 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 _0x3f2b=['localhost','socket.io-emitter','./chatGroup.socket','register','request','then','info','request\x20sent','ChatGroup,\x20%s,\x20%s,\x20%s','error','code','ChatGroup,\x20%s,\x20%s','message','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis'];(function(_0x466822,_0x3ed1fd){var _0x27522d=function(_0x55f035){while(--_0x55f035){_0x466822['push'](_0x466822['shift']());}};_0x27522d(++_0x3ed1fd);}(_0x3f2b,0x72));var _0xb3f2=function(_0x4e68da,_0x57005b){_0x4e68da=_0x4e68da-0x0;var _0x251aa1=_0x3f2b[_0x4e68da];return _0x251aa1;};'use strict';var _=require(_0xb3f2('0x0'));var util=require('util');var moment=require(_0xb3f2('0x1'));var BPromise=require(_0xb3f2('0x2'));var rs=require(_0xb3f2('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb3f2('0x4'))['db'];var utils=require(_0xb3f2('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xb3f2('0x6'));var jayson=require(_0xb3f2('0x7'));var client=jayson[_0xb3f2('0x8')][_0xb3f2('0x9')]({'port':0x232a});config['redis']=_['defaults'](config[_0xb3f2('0xa')],{'host':_0xb3f2('0xb'),'port':0x18eb});var socket=require(_0xb3f2('0xc'))(new Redis(config[_0xb3f2('0xa')]));require(_0xb3f2('0xd'))[_0xb3f2('0xe')](socket);function respondWithRpcPromise(_0x415fd9,_0x314877,_0x94fada){return new BPromise(function(_0xf9b4be,_0x185c58){return client[_0xb3f2('0xf')](_0x415fd9,_0x94fada)[_0xb3f2('0x10')](function(_0xaf3b86){logger[_0xb3f2('0x11')]('ChatGroup,\x20%s,\x20%s',_0x314877,_0xb3f2('0x12'));logger['debug'](_0xb3f2('0x13'),_0x314877,_0xb3f2('0x12'),JSON['stringify'](_0xaf3b86));if(_0xaf3b86[_0xb3f2('0x14')]){if(_0xaf3b86[_0xb3f2('0x14')][_0xb3f2('0x15')]===0x1f4){logger['error'](_0xb3f2('0x16'),_0x314877,_0xaf3b86[_0xb3f2('0x14')][_0xb3f2('0x17')]);return _0x185c58(_0xaf3b86[_0xb3f2('0x14')][_0xb3f2('0x17')]);}logger[_0xb3f2('0x14')](_0xb3f2('0x16'),_0x314877,_0xaf3b86['error'][_0xb3f2('0x17')]);return _0xf9b4be(_0xaf3b86[_0xb3f2('0x14')][_0xb3f2('0x17')]);}else{logger[_0xb3f2('0x11')](_0xb3f2('0x16'),_0x314877,_0xb3f2('0x12'));_0xf9b4be(_0xaf3b86['result']['message']);}})[_0xb3f2('0x18')](function(_0x3a861a){logger[_0xb3f2('0x14')]('ChatGroup,\x20%s,\x20%s',_0x314877,_0x3a861a);_0x185c58(_0x3a861a);});});} \ No newline at end of file +var _0xe2cc=['catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','register','request','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','error','message','result'];(function(_0x4098e5,_0xd1a334){var _0x2c9c59=function(_0x416b84){while(--_0x416b84){_0x4098e5['push'](_0x4098e5['shift']());}};_0x2c9c59(++_0xd1a334);}(_0xe2cc,0x69));var _0xce2c=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xe2cc[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0xce2c('0x0'));var util=require(_0xce2c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xce2c('0x2'));var fs=require('fs');var Redis=require(_0xce2c('0x3'));var db=require(_0xce2c('0x4'))['db'];var utils=require(_0xce2c('0x5'));var logger=require(_0xce2c('0x6'))(_0xce2c('0x7'));var config=require(_0xce2c('0x8'));var jayson=require(_0xce2c('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0xce2c('0xa')]=_[_0xce2c('0xb')](config[_0xce2c('0xa')],{'host':_0xce2c('0xc'),'port':0x18eb});var socket=require(_0xce2c('0xd'))(new Redis(config[_0xce2c('0xa')]));require('./chatGroup.socket')[_0xce2c('0xe')](socket);function respondWithRpcPromise(_0x2c1dbc,_0xc1d46b,_0x159a5b){return new BPromise(function(_0x46e847,_0x4624fd){return client[_0xce2c('0xf')](_0x2c1dbc,_0x159a5b)[_0xce2c('0x10')](function(_0xd035b1){logger[_0xce2c('0x11')](_0xce2c('0x12'),_0xc1d46b,_0xce2c('0x13'));logger[_0xce2c('0x14')](_0xce2c('0x15'),_0xc1d46b,_0xce2c('0x13'),JSON['stringify'](_0xd035b1));if(_0xd035b1['error']){if(_0xd035b1[_0xce2c('0x16')]['code']===0x1f4){logger[_0xce2c('0x16')](_0xce2c('0x12'),_0xc1d46b,_0xd035b1[_0xce2c('0x16')][_0xce2c('0x17')]);return _0x4624fd(_0xd035b1['error'][_0xce2c('0x17')]);}logger[_0xce2c('0x16')](_0xce2c('0x12'),_0xc1d46b,_0xd035b1[_0xce2c('0x16')][_0xce2c('0x17')]);return _0x46e847(_0xd035b1[_0xce2c('0x16')][_0xce2c('0x17')]);}else{logger['info'](_0xce2c('0x12'),_0xc1d46b,_0xce2c('0x13'));_0x46e847(_0xd035b1[_0xce2c('0x18')][_0xce2c('0x17')]);}})[_0xce2c('0x19')](function(_0x4956ae){logger[_0xce2c('0x16')](_0xce2c('0x12'),_0xc1d46b,_0x4956ae);_0x4624fd(_0x4956ae);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 4b1d2b3..69d1632 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 _0xfd8a=['./chatGroup.events','save','remove','update','emit','removeListener','register'];(function(_0x31680c,_0x58360b){var _0x2a4582=function(_0x54a4ca){while(--_0x54a4ca){_0x31680c['push'](_0x31680c['shift']());}};_0x2a4582(++_0x58360b);}(_0xfd8a,0xc4));var _0xafd8=function(_0x8af54b,_0x280be5){_0x8af54b=_0x8af54b-0x0;var _0x27d8f0=_0xfd8a[_0x8af54b];return _0x27d8f0;};'use strict';var ChatGroupEvents=require(_0xafd8('0x0'));var events=[_0xafd8('0x1'),_0xafd8('0x2'),_0xafd8('0x3')];function createListener(_0x39553b,_0x2d99aa){return function(_0x40b1cf){_0x2d99aa[_0xafd8('0x4')](_0x39553b,_0x40b1cf);};}function removeListener(_0x5be7f2,_0x402618){return function(){ChatGroupEvents[_0xafd8('0x5')](_0x5be7f2,_0x402618);};}exports[_0xafd8('0x6')]=function(_0x368d22){for(var _0x44703b=0x0,_0x2f9bbe=events['length'];_0x44703b<_0x2f9bbe;_0x44703b++){var _0x5829f2=events[_0x44703b];var _0x14514e=createListener('chatGroup:'+_0x5829f2,_0x368d22);ChatGroupEvents['on'](_0x5829f2,_0x14514e);}}; \ No newline at end of file +var _0x1aaf=['update','emit','removeListener','register','length','chatGroup:','./chatGroup.events','save'];(function(_0x2479e1,_0xdd05b7){var _0xe199e5=function(_0x321ded){while(--_0x321ded){_0x2479e1['push'](_0x2479e1['shift']());}};_0xe199e5(++_0xdd05b7);}(_0x1aaf,0x1a6));var _0xf1aa=function(_0x3c2175,_0x2a733d){_0x3c2175=_0x3c2175-0x0;var _0x357e18=_0x1aaf[_0x3c2175];return _0x357e18;};'use strict';var ChatGroupEvents=require(_0xf1aa('0x0'));var events=[_0xf1aa('0x1'),'remove',_0xf1aa('0x2')];function createListener(_0x173ad7,_0x2d1162){return function(_0x2cb814){_0x2d1162[_0xf1aa('0x3')](_0x173ad7,_0x2cb814);};}function removeListener(_0x2cc380,_0x34a1a9){return function(){ChatGroupEvents[_0xf1aa('0x4')](_0x2cc380,_0x34a1a9);};}exports[_0xf1aa('0x5')]=function(_0x455e40){for(var _0x48563=0x0,_0x170875=events[_0xf1aa('0x6')];_0x48563<_0x170875;_0x48563++){var _0x4b4ff5=events[_0x48563];var _0x4ec964=createListener(_0xf1aa('0x7')+_0x4b4ff5,_0x455e40);ChatGroupEvents['on'](_0x4b4ff5,_0x4ec964);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 6e3a4f4..a58c2e7 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 _0x822d=['./chatGroup.controller','get','isAuthenticated','index','show','getUnread','/:id/members','getMembers','/:id/messages','post','create','addMembers','addMessage','put','update','/:id','destroy','delete','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x1ae93c,_0xdc1b18){var _0x1a92a5=function(_0x358bca){while(--_0x358bca){_0x1ae93c['push'](_0x1ae93c['shift']());}};_0x1a92a5(++_0xdc1b18);}(_0x822d,0xc9));var _0xd822=function(_0x2ab3d9,_0x50e716){_0x2ab3d9=_0x2ab3d9-0x0;var _0x210a54=_0x822d[_0x2ab3d9];return _0x210a54;};'use strict';var multer=require(_0xd822('0x0'));var util=require(_0xd822('0x1'));var path=require(_0xd822('0x2'));var timeout=require(_0xd822('0x3'));var express=require(_0xd822('0x4'));var router=express['Router']();var fs_extra=require(_0xd822('0x5'));var auth=require(_0xd822('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xd822('0x7'));router[_0xd822('0x8')]('/',auth[_0xd822('0x9')](),controller[_0xd822('0xa')]);router[_0xd822('0x8')]('/describe',auth[_0xd822('0x9')](),controller['describe']);router[_0xd822('0x8')]('/:id',auth[_0xd822('0x9')](),controller[_0xd822('0xb')]);router[_0xd822('0x8')]('/:id/unread',auth[_0xd822('0x9')](),controller[_0xd822('0xc')]);router['get'](_0xd822('0xd'),auth['isAuthenticated'](),controller[_0xd822('0xe')]);router[_0xd822('0x8')](_0xd822('0xf'),auth[_0xd822('0x9')](),controller['getMessages']);router[_0xd822('0x10')]('/',auth[_0xd822('0x9')](),controller[_0xd822('0x11')]);router[_0xd822('0x10')](_0xd822('0xd'),auth[_0xd822('0x9')](),controller[_0xd822('0x12')]);router['post'](_0xd822('0xf'),auth[_0xd822('0x9')](),controller[_0xd822('0x13')]);router[_0xd822('0x14')]('/:id',auth[_0xd822('0x9')](),controller[_0xd822('0x15')]);router['delete'](_0xd822('0x16'),auth[_0xd822('0x9')](),controller[_0xd822('0x17')]);router[_0xd822('0x18')](_0xd822('0xd'),auth['isAuthenticated'](),controller['removeMembers']);module[_0xd822('0x19')]=router; \ No newline at end of file +var _0x4898=['addMessage','put','/:id','update','destroy','delete','removeMembers','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatGroup.controller','isAuthenticated','get','/describe','describe','/:id/unread','getUnread','/:id/members','getMembers','/:id/messages','getMessages','create','addMembers','post'];(function(_0x5b010a,_0x334ff0){var _0x57ad97=function(_0x298de6){while(--_0x298de6){_0x5b010a['push'](_0x5b010a['shift']());}};_0x57ad97(++_0x334ff0);}(_0x4898,0x13e));var _0x8489=function(_0x4b022d,_0x255379){_0x4b022d=_0x4b022d-0x0;var _0x18e453=_0x4898[_0x4b022d];return _0x18e453;};'use strict';var multer=require(_0x8489('0x0'));var util=require(_0x8489('0x1'));var path=require('path');var timeout=require(_0x8489('0x2'));var express=require(_0x8489('0x3'));var router=express[_0x8489('0x4')]();var fs_extra=require(_0x8489('0x5'));var auth=require(_0x8489('0x6'));var interaction=require(_0x8489('0x7'));var config=require(_0x8489('0x8'));var controller=require(_0x8489('0x9'));router['get']('/',auth[_0x8489('0xa')](),controller['index']);router[_0x8489('0xb')](_0x8489('0xc'),auth[_0x8489('0xa')](),controller[_0x8489('0xd')]);router[_0x8489('0xb')]('/:id',auth[_0x8489('0xa')](),controller['show']);router[_0x8489('0xb')](_0x8489('0xe'),auth[_0x8489('0xa')](),controller[_0x8489('0xf')]);router[_0x8489('0xb')](_0x8489('0x10'),auth[_0x8489('0xa')](),controller[_0x8489('0x11')]);router[_0x8489('0xb')](_0x8489('0x12'),auth['isAuthenticated'](),controller[_0x8489('0x13')]);router['post']('/',auth['isAuthenticated'](),controller[_0x8489('0x14')]);router['post'](_0x8489('0x10'),auth[_0x8489('0xa')](),controller[_0x8489('0x15')]);router[_0x8489('0x16')](_0x8489('0x12'),auth[_0x8489('0xa')](),controller[_0x8489('0x17')]);router[_0x8489('0x18')](_0x8489('0x19'),auth[_0x8489('0xa')](),controller[_0x8489('0x1a')]);router['delete'](_0x8489('0x19'),auth[_0x8489('0xa')](),controller[_0x8489('0x1b')]);router[_0x8489('0x1c')](_0x8489('0x10'),auth[_0x8489('0xa')](),controller[_0x8489('0x1d')]);module[_0x8489('0x1e')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index 3459d93..e8eea96 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 _0xf59b=['ENUM','thumb','star','TEXT','STRING','DATE','exports','BOOLEAN','INTEGER'];(function(_0x547ede,_0x73d924){var _0x27adfb=function(_0x699a9d){while(--_0x699a9d){_0x547ede['push'](_0x547ede['shift']());}};_0x27adfb(++_0x73d924);}(_0xf59b,0x8d));var _0xbf59=function(_0x3f9fef,_0x3577bf){_0x3f9fef=_0x3f9fef-0x0;var _0x4f29c7=_0xf59b[_0x3f9fef];return _0x4f29c7;};'use strict';var Sequelize=require('sequelize');module[_0xbf59('0x0')]={'closed':{'type':Sequelize[_0xbf59('0x1')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0xbf59('0x2')]},'ratingType':{'type':Sequelize[_0xbf59('0x3')]('star',_0xbf59('0x4')),'defaultValue':_0xbf59('0x5')},'ratingMessage':{'type':Sequelize['TEXT']},'pathTranscript':{'type':Sequelize[_0xbf59('0x6')]},'mailTranscript':{'type':Sequelize[_0xbf59('0x7')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0xbf59('0x8')]},'disposition':{'type':Sequelize[_0xbf59('0x7')]},'secondDisposition':{'type':Sequelize[_0xbf59('0x7')]},'thirdDisposition':{'type':Sequelize[_0xbf59('0x7')]},'note':{'type':Sequelize[_0xbf59('0x7')]},'browserName':{'type':Sequelize[_0xbf59('0x7')]},'browserVersion':{'type':Sequelize[_0xbf59('0x7')]},'osName':{'type':Sequelize['STRING']},'osVersion':{'type':Sequelize[_0xbf59('0x7')]},'deviceModel':{'type':Sequelize[_0xbf59('0x7')]},'deviceVendor':{'type':Sequelize[_0xbf59('0x7')]},'deviceType':{'type':Sequelize[_0xbf59('0x7')]},'referer':{'type':Sequelize[_0xbf59('0x6')]},'customerIp':{'type':Sequelize[_0xbf59('0x7')]},'formData':{'type':Sequelize['TEXT']('long')},'read1stAt':{'type':Sequelize['DATE']},'lastMsgAt':{'type':Sequelize[_0xbf59('0x8')]},'lastMsgDirection':{'type':Sequelize[_0xbf59('0x3')]('in','out'),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0xbf59('0x7')]},'customerPort':{'type':Sequelize[_0xbf59('0x7')]},'vidaooSessionId':{'type':Sequelize[_0xbf59('0x6')]},'autoreplyExecuted':{'type':Sequelize[_0xbf59('0x1')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x7901=['exports','BOOLEAN','INTEGER','star','TEXT','STRING','DATE','ENUM','out','sequelize'];(function(_0x38457f,_0x443a67){var _0x3a2c70=function(_0x23167e){while(--_0x23167e){_0x38457f['push'](_0x38457f['shift']());}};_0x3a2c70(++_0x443a67);}(_0x7901,0x10d));var _0x1790=function(_0x5c3c9f,_0x2b6352){_0x5c3c9f=_0x5c3c9f-0x0;var _0x53f7e9=_0x7901[_0x5c3c9f];return _0x53f7e9;};'use strict';var Sequelize=require(_0x1790('0x0'));module[_0x1790('0x1')]={'closed':{'type':Sequelize[_0x1790('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x1790('0x3')]},'ratingType':{'type':Sequelize['ENUM'](_0x1790('0x4'),'thumb'),'defaultValue':_0x1790('0x4')},'ratingMessage':{'type':Sequelize[_0x1790('0x5')]},'pathTranscript':{'type':Sequelize[_0x1790('0x5')]},'mailTranscript':{'type':Sequelize[_0x1790('0x6')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x1790('0x7')]},'disposition':{'type':Sequelize[_0x1790('0x6')]},'secondDisposition':{'type':Sequelize[_0x1790('0x6')]},'thirdDisposition':{'type':Sequelize[_0x1790('0x6')]},'note':{'type':Sequelize[_0x1790('0x6')]},'browserName':{'type':Sequelize[_0x1790('0x6')]},'browserVersion':{'type':Sequelize[_0x1790('0x6')]},'osName':{'type':Sequelize[_0x1790('0x6')]},'osVersion':{'type':Sequelize['STRING']},'deviceModel':{'type':Sequelize[_0x1790('0x6')]},'deviceVendor':{'type':Sequelize[_0x1790('0x6')]},'deviceType':{'type':Sequelize[_0x1790('0x6')]},'referer':{'type':Sequelize[_0x1790('0x5')]},'customerIp':{'type':Sequelize[_0x1790('0x6')]},'formData':{'type':Sequelize['TEXT']('long')},'read1stAt':{'type':Sequelize[_0x1790('0x7')]},'lastMsgAt':{'type':Sequelize[_0x1790('0x7')]},'lastMsgDirection':{'type':Sequelize[_0x1790('0x8')]('in',_0x1790('0x9')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x1790('0x6')]},'customerPort':{'type':Sequelize[_0x1790('0x6')]},'vidaooSessionId':{'type':Sequelize[_0x1790('0x5')]},'autoreplyExecuted':{'type':Sequelize[_0x1790('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x1790('0x3')]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index 3fd4a1c..0f0df01 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 _0x680a=['offset','limit','undefined','count','set','Content-Range','update','stack','name','merge','body','agent','interaction','account','index','map','ChatInteraction','fieldName','getOptions','findAll','query','show','params','model','keys','rawAttributes','filters','fields','attributes','length','includeAll','options','find','create','destroy','describe','createVidaooSession','findOne','ChatWebsiteId','vidaooApiKey','vidaooEscalation','vidaooTopic','vidaooNote','user','email','contact','isNull','follow','vidaooMetadata','parse','metadata','Sequelize','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','Error\x20in\x20Vidaoo\x20configuration','join_url','out','ChatMessage','customUpdate','CmContact','Contact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','disposition','AbandonInteraction','attachmentUpload','file','originalname','basename','filename','type','mimetype','Unauthorized','Attachment','ChatOfflineMessageId','join','server/files/attachments/','offline-chat/','download','mailTranscript','root','format','transcript-%s.txt','now','User','ChatWebsite','ContactId','agentAlias','UserId','System','%s%d','alias','fullname','agent_fullname','[%s]\x20%s:\x20%s\x0a','createdAt','MM/DD/YYYY\x20HH:mm:ss','direction','secret','appendFileSync','MailAccount','MailServerOut','Smtp','CloudProvider','getSmtpOptions','SendMail','sendMail','\x22%s\x22\x20<%s>','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','intersection','hasOwnProperty','order','sort','where','pick','ChatInteractionId','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','include','rows','getMyMessages','nolimit','includeAgent','spread','Tag','emit','chatInteractionTags:save','removeTags','unix','toString','server','files','tmp','attachments','transcript-%d-%s.zip','lastName','push','Messages','Account','Owner','get','mkdirSync','N.A.','closedAt','browserName','osName','referer','customerIp','customerPort','existsSync','pipe','createWriteStream','firstName','read','value','renderFile','views','downloadInteraction.ejs','transcript-','Chat','createPdfFromHTML','err','unlinkSync','sendStatus','zip-dir','bluebird','mustache','util','path','ejs','lodash','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','register','jayson/promise','client','http','request','then','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatInteraction,\x20%s,\x20%s','message','info','catch','status','end','json'];(function(_0x205bb4,_0x88f7d){var _0x55b21f=function(_0xbfc15c){while(--_0xbfc15c){_0x205bb4['push'](_0x205bb4['shift']());}};_0x55b21f(++_0x88f7d);}(_0x680a,0xab));var _0xa680=function(_0x5ce444,_0x12d54a){_0x5ce444=_0x5ce444-0x0;var _0x575008=_0x680a[_0x5ce444];return _0x575008;};'use strict';var rimraf=require('rimraf');var zipdir=require(_0xa680('0x0'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xa680('0x1'));var Mustache=require(_0xa680('0x2'));var util=require(_0xa680('0x3'));var path=require(_0xa680('0x4'));var ejs=require(_0xa680('0x5'));var fs=require('fs');var _=require(_0xa680('0x6'));var Redis=require('ioredis');var interaction=require(_0xa680('0x7'));var qs=require(_0xa680('0x8'));var pdf=require(_0xa680('0x9'));var logger=require(_0xa680('0xa'))(_0xa680('0xb'));var config=require(_0xa680('0xc'));var db=require(_0xa680('0xd'))['db'];config[_0xa680('0xe')]=_[_0xa680('0xf')](config[_0xa680('0xe')],{'host':_0xa680('0x10'),'port':0x18eb});var socket=require(_0xa680('0x11'))(new Redis(config['redis']));require(_0xa680('0x12'))[_0xa680('0x13')](socket);var jayson=require(_0xa680('0x14'));var client=jayson[_0xa680('0x15')][_0xa680('0x16')]({'port':0x232b});var client9004=jayson['client']['http']({'port':0x232c});function respondWithRpcPromise(_0x62bec1,_0x33729c,_0x437c76,_0x371412){return new BPromise(function(_0x3ecbe2,_0xf9d8a4){var _0x550528=_0x371412||client;return _0x550528[_0xa680('0x17')](_0x62bec1,_0x437c76)[_0xa680('0x18')](function(_0x5400b9){logger['info']('ChatInteraction,\x20%s,\x20%s',_0x33729c,_0xa680('0x19'));logger[_0xa680('0x1a')](_0xa680('0x1b'),_0x33729c,'request\x20sent',JSON[_0xa680('0x1c')](_0x5400b9));if(_0x5400b9[_0xa680('0x1d')]){if(_0x5400b9[_0xa680('0x1d')][_0xa680('0x1e')]===0x1f4){logger['error'](_0xa680('0x1f'),_0x33729c,_0x5400b9[_0xa680('0x1d')]['message']);return _0xf9d8a4(_0x5400b9['error'][_0xa680('0x20')]);}logger['error'](_0xa680('0x1f'),_0x33729c,_0x5400b9[_0xa680('0x1d')][_0xa680('0x20')]);return _0x3ecbe2(_0x5400b9[_0xa680('0x1d')][_0xa680('0x20')]);}else{logger[_0xa680('0x21')](_0xa680('0x1f'),_0x33729c,_0xa680('0x19'));_0x3ecbe2(_0x5400b9['result']['message']);}})[_0xa680('0x22')](function(_0x4868b4){logger[_0xa680('0x1d')]('ChatInteraction,\x20%s,\x20%s',_0x33729c,_0x4868b4);_0xf9d8a4(_0x4868b4);});});}function respondWithStatusCode(_0xb7ad69,_0x21bc8b){_0x21bc8b=_0x21bc8b||0xcc;return function(_0x58bfff){if(_0x58bfff){return _0xb7ad69['sendStatus'](_0x21bc8b);}return _0xb7ad69[_0xa680('0x23')](_0x21bc8b)[_0xa680('0x24')]();};}function respondWithResult(_0x188062,_0x4be778){_0x4be778=_0x4be778||0xc8;return function(_0x4d559f){if(_0x4d559f){return _0x188062[_0xa680('0x23')](_0x4be778)[_0xa680('0x25')](_0x4d559f);}};}function respondWithFilteredResult(_0x5b8e5d,_0x224aab){return function(_0xa7309b){if(_0xa7309b){var _0x48ff46=typeof _0x224aab[_0xa680('0x26')]==='undefined'&&typeof _0x224aab[_0xa680('0x27')]===_0xa680('0x28');var _0x52f3e6=_0xa7309b[_0xa680('0x29')];var _0x286d5e=_0x48ff46?0x0:_0x224aab[_0xa680('0x26')];var _0x30ac75=_0x48ff46?_0xa7309b[_0xa680('0x29')]:_0x224aab[_0xa680('0x26')]+_0x224aab[_0xa680('0x27')];var _0xe62705;if(_0x30ac75>=_0x52f3e6){_0x30ac75=_0x52f3e6;_0xe62705=0xc8;}else{_0xe62705=0xce;}_0x5b8e5d[_0xa680('0x23')](_0xe62705);return _0x5b8e5d[_0xa680('0x2a')](_0xa680('0x2b'),_0x286d5e+'-'+_0x30ac75+'/'+_0x52f3e6)[_0xa680('0x25')](_0xa7309b);}return null;};}function saveUpdates(_0x388bb4){return function(_0x3d5df6){if(_0x3d5df6){return _0x3d5df6[_0xa680('0x2c')](_0x388bb4)['then'](function(_0x5dfef3){return _0x5dfef3;});}return null;};}function removeEntity(_0x5aee24){return function(_0x2a2ea2){if(_0x2a2ea2){return _0x2a2ea2['destroy']()[_0xa680('0x18')](function(){_0x5aee24[_0xa680('0x23')](0xcc)[_0xa680('0x24')]();});}};}function handleEntityNotFound(_0x3296a7){return function(_0x79f788){if(!_0x79f788){_0x3296a7['sendStatus'](0x194);}return _0x79f788;};}function handleError(_0x140f87,_0x36d2e8){_0x36d2e8=_0x36d2e8||0x1f4;return function(_0x4d3ed2){logger[_0xa680('0x1d')](_0x4d3ed2[_0xa680('0x2d')]);if(_0x4d3ed2['name']){delete _0x4d3ed2[_0xa680('0x2e')];}_0x140f87['status'](_0x36d2e8)['send'](_0x4d3ed2);};}function getMustacheRender(_0x503e4d,_0x25b709){return Mustache['render'](_0x503e4d,_[_0xa680('0x2f')](_0x25b709[_0xa680('0x30')],{'contact':_0x25b709['contact'],'message':_0x25b709['message'],'agent':_0x25b709[_0xa680('0x31')],'interaction':_0x25b709[_0xa680('0x32')],'account':_0x25b709[_0xa680('0x33')]}))||'';}exports[_0xa680('0x34')]=function(_0x20371e,_0x2a774){var _0x3dc734={};var _0x1990d4=_[_0xa680('0x35')](db[_0xa680('0x36')]['rawAttributes'],function(_0x444b51){return{'name':_0x444b51[_0xa680('0x37')],'type':_0x444b51['type']['key']};});_0x3dc734=qs[_0xa680('0x38')](_0x1990d4,_0x20371e);return interaction[_0xa680('0x39')]('chat',_0x20371e[_0xa680('0x3a')],_0x20371e['user'],_0x3dc734,_0x1990d4)[_0xa680('0x18')](respondWithFilteredResult(_0x2a774,_0x3dc734))[_0xa680('0x22')](handleError(_0x2a774,null));};exports[_0xa680('0x3b')]=function(_0x1867cc,_0x545687){var _0x7b80b8={'raw':![],'where':{'id':_0x1867cc[_0xa680('0x3c')]['id']}},_0x2b4a1f={};_0x2b4a1f[_0xa680('0x3d')]=_[_0xa680('0x3e')](db[_0xa680('0x36')][_0xa680('0x3f')]);_0x2b4a1f[_0xa680('0x3a')]=_[_0xa680('0x3e')](_0x1867cc[_0xa680('0x3a')]);_0x2b4a1f[_0xa680('0x40')]=_['intersection'](_0x2b4a1f['model'],_0x2b4a1f[_0xa680('0x3a')]);_0x7b80b8['attributes']=_['intersection'](_0x2b4a1f[_0xa680('0x3d')],qs[_0xa680('0x41')](_0x1867cc[_0xa680('0x3a')][_0xa680('0x41')]));_0x7b80b8[_0xa680('0x42')]=_0x7b80b8[_0xa680('0x42')][_0xa680('0x43')]?_0x7b80b8[_0xa680('0x42')]:_0x2b4a1f[_0xa680('0x3d')];if(_0x1867cc[_0xa680('0x3a')][_0xa680('0x44')]){_0x7b80b8['include']=[{'all':!![]}];}_0x7b80b8=_[_0xa680('0x2f')]({},_0x7b80b8,_0x1867cc[_0xa680('0x45')]);return db[_0xa680('0x36')][_0xa680('0x46')](_0x7b80b8)[_0xa680('0x18')](handleEntityNotFound(_0x545687,null))['then'](respondWithResult(_0x545687,null))[_0xa680('0x22')](handleError(_0x545687,null));};exports[_0xa680('0x47')]=function(_0x36f7b9,_0x214bba){return db[_0xa680('0x36')]['create'](_0x36f7b9['body'],{})[_0xa680('0x18')](respondWithResult(_0x214bba,0xc9))[_0xa680('0x22')](handleError(_0x214bba,null));};exports['update']=function(_0x58d1de,_0x3a9c89){if(_0x58d1de[_0xa680('0x30')]['id']){delete _0x58d1de[_0xa680('0x30')]['id'];}return db['ChatInteraction'][_0xa680('0x46')]({'where':{'id':_0x58d1de['params']['id']}})[_0xa680('0x18')](handleEntityNotFound(_0x3a9c89,null))['then'](saveUpdates(_0x58d1de[_0xa680('0x30')],null))[_0xa680('0x18')](respondWithResult(_0x3a9c89,null))['catch'](handleError(_0x3a9c89,null));};exports[_0xa680('0x48')]=function(_0x418a8b,_0x4540ee){return db[_0xa680('0x36')][_0xa680('0x46')]({'where':{'id':_0x418a8b[_0xa680('0x3c')]['id']}})[_0xa680('0x18')](handleEntityNotFound(_0x4540ee,null))['then'](removeEntity(_0x4540ee,null))[_0xa680('0x22')](handleError(_0x4540ee,null));};exports[_0xa680('0x49')]=function(_0x580d82,_0x46b1ce){return db[_0xa680('0x36')][_0xa680('0x49')]()['then'](respondWithResult(_0x46b1ce,null))[_0xa680('0x22')](handleError(_0x46b1ce,null));};exports[_0xa680('0x4a')]=function(_0x16e4e7,_0x2b6294){var _0x56c181=_0x16e4e7[_0xa680('0x3c')]['id'];var _0x536006;var _0x22c5a0;var _0x325ec3;return db[_0xa680('0x36')][_0xa680('0x4b')]({'where':{'id':_0x56c181}})['then'](function(_0x51a6af){_0x536006=_0x51a6af;return db['ChatWebsite'][_0xa680('0x4b')]({'where':{'id':_0x51a6af[_0xa680('0x4c')]},'attributes':['id',_0xa680('0x4d'),_0xa680('0x4e'),_0xa680('0x4f'),_0xa680('0x50'),'vidaooMetadata'],'raw':!![]});})[_0xa680('0x18')](function(_0x50d1f6){if(_0x50d1f6&&_0x50d1f6[_0xa680('0x4d')]&&_0x50d1f6[_0xa680('0x4e')]){_0x22c5a0=_0x50d1f6;var _0x22fb3f={'interaction':{'id':_0x56c181},'agent':{'id':_0x16e4e7[_0xa680('0x51')]['id'],'name':_0x16e4e7[_0xa680('0x51')]['name'],'fullname':_0x16e4e7['user']['fullname'],'email':_0x16e4e7[_0xa680('0x51')][_0xa680('0x52')]},'contact':_0x16e4e7['body'][_0xa680('0x53')],'account':_0x16e4e7[_0xa680('0x30')][_0xa680('0x33')]};var _0x7eaad3={'rejectUnauthorized':![],'method':'POST','url':'https://api-vidaoo.xcally.com/api/v1/meetings','headers':{'X-APIKEY':_0x50d1f6[_0xa680('0x4d')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x16e4e7['user'][_0xa680('0x52')]],'buttons':null,'topic':_0x22c5a0['vidaooTopic'],'note':_[_0xa680('0x54')](_0x22c5a0['vidaooNote'])?null:getMustacheRender(_0x22c5a0[_0xa680('0x50')],_0x22fb3f),'metadata':null},'redirect':_0xa680('0x55'),'json':!![]};try{if(!_[_0xa680('0x54')](_0x22c5a0[_0xa680('0x56')])){var _0x4116ca=getMustacheRender(_0x22c5a0[_0xa680('0x56')],_0x22fb3f);var _0x345d81=JSON[_0xa680('0x57')](_0x4116ca);_0x7eaad3['body'][_0xa680('0x58')]=_0x345d81;}}catch(_0x221d2d){throw new db[(_0xa680('0x59'))][(_0xa680('0x5a'))](_0xa680('0x5b'));}return rp(_0x7eaad3);}else{throw new db[(_0xa680('0x59'))][(_0xa680('0x5a'))](_0xa680('0x5c'));}})[_0xa680('0x18')](function(_0x47cb9d){_0x325ec3=_0x47cb9d;if(_0x325ec3['id']){var _0x4d34c4={'body':_0x325ec3[_0xa680('0x5d')],'ChatWebsiteId':_0x22c5a0['id'],'ChatInteractionId':_0x536006['id'],'direction':_0xa680('0x5e'),'UserId':_0x16e4e7['user']['id']};return db[_0xa680('0x5f')][_0xa680('0x47')](_0x4d34c4,{});}else{throw new db['Sequelize'][(_0xa680('0x5a'))]('Unable\x20to\x20create\x20Vidaoo\x20session');}})[_0xa680('0x18')](function(){return _0x536006['updateAttributes']({'vidaooSessionId':_0x325ec3['id']});})[_0xa680('0x18')](respondWithResult(_0x2b6294,null))[_0xa680('0x22')](handleError(_0x2b6294,null));};exports[_0xa680('0x60')]=function(_0x95b790,_0x4b5ede){if(_0x95b790[_0xa680('0x30')]['id']){delete _0x95b790[_0xa680('0x30')]['id'];}return db['ChatInteraction']['find']({'where':{'id':_0x95b790[_0xa680('0x3c')]['id']},'include':[{'model':db[_0xa680('0x61')],'as':_0xa680('0x62')}]})[_0xa680('0x18')](handleEntityNotFound(_0x4b5ede,null))[_0xa680('0x18')](saveUpdates(_0x95b790[_0xa680('0x30')],null))[_0xa680('0x18')](respondWithResult(_0x4b5ede,null))[_0xa680('0x22')](handleError(_0x4b5ede,null));};exports[_0xa680('0x63')]=function(_0x5bf3a9,_0x14e4b7){if(_0x5bf3a9['body']['id']){delete _0x5bf3a9['body']['id'];}return db[_0xa680('0x36')]['find']({'where':{'id':_0x5bf3a9[_0xa680('0x3c')]['id']}})[_0xa680('0x18')](function(_0x5d6d40){if(!_0x5d6d40){logger[_0xa680('0x1d')](_0xa680('0x64'),_0xa680('0x63'),0x194,_0xa680('0x65'));_0x14e4b7['sendStatus'](0x194);}else{if(_0x5d6d40['UserId']){throw new db['Sequelize'][(_0xa680('0x5a'))]('Interaction\x20already\x20assigned');}}return _0x5d6d40;})[_0xa680('0x18')](function(_0x24578d){if(_0x24578d){return _0x24578d[_0xa680('0x2c')]({'closed':_0x5bf3a9[_0xa680('0x30')]['closed'],'disposition':_0x5bf3a9['body'][_0xa680('0x66')]})[_0xa680('0x18')](function(_0x18dde0){return _0x18dde0;});}})['then'](function(){return respondWithRpcPromise(_0xa680('0x67'),_0xa680('0x63'),_0x5bf3a9[_0xa680('0x30')],client9004);})[_0xa680('0x18')](respondWithResult(_0x14e4b7,null))[_0xa680('0x22')](handleError(_0x14e4b7,null));};exports[_0xa680('0x68')]=function(_0x425e6d,_0x599183){_0x425e6d[_0xa680('0x30')][_0xa680('0x2e')]=_0x425e6d[_0xa680('0x69')][_0xa680('0x6a')];_0x425e6d[_0xa680('0x30')][_0xa680('0x6b')]=_0x425e6d['file'][_0xa680('0x6c')];_0x425e6d[_0xa680('0x30')][_0xa680('0x6d')]=_0x425e6d[_0xa680('0x69')][_0xa680('0x6e')];return db['Attachment'][_0xa680('0x47')](_0x425e6d['body'])[_0xa680('0x18')](respondWithResult(_0x599183,0xc9))[_0xa680('0x22')](handleError(_0x599183,null));};exports['attachmentDownload']=function(_0x5ba60a,_0x5baa54){return db[_0xa680('0x36')][_0xa680('0x4b')]({'where':{'id':_0x5ba60a[_0xa680('0x3c')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x5baa54,null))[_0xa680('0x18')](function(_0x372654){if(_0x372654){if(_0x372654['closed']){return _0x5baa54[_0xa680('0x23')](0x193)[_0xa680('0x25')]({'status':0x193,'message':_0xa680('0x6f')});}return db[_0xa680('0x70')][_0xa680('0x4b')]({'where':{'id':_0x5ba60a[_0xa680('0x3a')]['attachId']},'raw':!![]})[_0xa680('0x18')](handleEntityNotFound(_0x5baa54,null));}})[_0xa680('0x18')](function(_0x1599b6){if(_0x1599b6){var _0x4a2e4b=_0x1599b6[_0xa680('0x71')]!==null;var _0x1ac9ce=path[_0xa680('0x72')](config['root'],_0xa680('0x73'));if(_0x4a2e4b){_0x1ac9ce=path[_0xa680('0x72')](_0x1ac9ce,_0xa680('0x74'));}var _0x2a7983=path[_0xa680('0x72')](_0x1ac9ce,_0x1599b6[_0xa680('0x6b')]);return _0x5baa54[_0xa680('0x75')](_0x2a7983);}})[_0xa680('0x22')](handleError(_0x5baa54,null));};exports['close']=function(_0x4942f1,_0x389bad){var _0x10899c=null;var _0xed9306=null;var _0x1b0afc=null;if(_0x4942f1[_0xa680('0x30')]['id']){delete _0x4942f1[_0xa680('0x30')]['id'];}if(_0x4942f1[_0xa680('0x30')][_0xa680('0x76')]){_0x1b0afc=path[_0xa680('0x72')](config[_0xa680('0x77')],'server/files/chat/upload/',util[_0xa680('0x78')](_0xa680('0x79'),Date[_0xa680('0x7a')]()));_0x4942f1[_0xa680('0x30')]['pathTranscript']=_0x1b0afc;}return db[_0xa680('0x36')][_0xa680('0x46')]({'where':{'id':_0x4942f1[_0xa680('0x3c')]['id']},'include':[{'model':db['ChatMessage'],'as':'Messages','include':[{'model':db[_0xa680('0x7b')],'as':'User'}]}]})['then'](handleEntityNotFound(_0x389bad,null))['then'](saveUpdates(_0x4942f1['body'],null))[_0xa680('0x18')](function(_0x4909e2){if(_0x4909e2){_0x10899c=_0x4909e2;return db[_0xa680('0x7c')]['find']({'where':{'id':_0x10899c[_0xa680('0x4c')]}});}})[_0xa680('0x18')](function(_0x21ad52){if(_0x21ad52){_0xed9306=_0x21ad52;return db['CmContact']['find']({'where':{'id':_0x10899c[_0xa680('0x7d')]}});}})[_0xa680('0x18')](function(_0x5ee8ed){if(_0x5ee8ed){if(_0x1b0afc){var _0x1ff7b5=null;for(var _0x14978c=0x1;_0x14978c<_0x10899c['Messages'][_0xa680('0x43')];++_0x14978c){_0x1ff7b5=_0x10899c['Messages'][_0x14978c];var _0x147321=_0x1ff7b5['UserId']?util[_0xa680('0x78')]('%s%d',_0xed9306[_0xa680('0x7e')],_0x1ff7b5[_0xa680('0x7f')]):_0xa680('0x80');var _0x4314ee=_0x4942f1[_0xa680('0x30')]['customer']||util[_0xa680('0x78')](_0xa680('0x81'),'Visitor',_0x1ff7b5['ContactId']);switch(_0xed9306['agentIdentifier']){case'website_alias':_0x147321=_0x1ff7b5[_0xa680('0x7f')]?util[_0xa680('0x78')](_0xa680('0x81'),_0xed9306[_0xa680('0x7e')],_0x1ff7b5[_0xa680('0x7f')]):_0xa680('0x80');break;case'agent_alias':_0x147321=_0x1ff7b5[_0xa680('0x7f')]?_0x1ff7b5['User'][_0xa680('0x82')]||_0x1ff7b5[_0xa680('0x7b')][_0xa680('0x83')]:_0xa680('0x80');break;case _0xa680('0x84'):_0x147321=_0x1ff7b5['UserId']?_0x1ff7b5['User'][_0xa680('0x83')]:_0xa680('0x80');break;default:_0x147321=_0x1ff7b5[_0xa680('0x7f')]?util['format']('%s%d',_0xed9306[_0xa680('0x7e')],_0x1ff7b5[_0xa680('0x7f')]):_0xa680('0x80');}var _0x33fa31=util[_0xa680('0x78')](_0xa680('0x85'),moment(_0x1ff7b5[_0xa680('0x86')])['format'](_0xa680('0x87')),_0x1ff7b5[_0xa680('0x88')]==='in'?_0x4314ee:_0x147321,_0x1ff7b5[_0xa680('0x30')]);if(!_0x1ff7b5[_0xa680('0x89')]){fs[_0xa680('0x8a')](_0x1b0afc,_0x33fa31);}}return db[_0xa680('0x8b')]['findOne']({'where':{'service':!![]},'include':[{'model':db[_0xa680('0x8c')],'as':_0xa680('0x8d'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0xa680('0x8e'),'raw':!![]}]}]});}}})[_0xa680('0x18')](function(_0x5b9e4b){if(!_0x5b9e4b||!_0x5b9e4b[_0xa680('0x8d')]||!_0x4942f1[_0xa680('0x30')])return _0x10899c;var _0x4db571=_0x5b9e4b[_0xa680('0x8f')]();return respondWithRpcPromise(_0xa680('0x90'),_0xa680('0x91'),{'account':_0x4db571,'message':{'from':util[_0xa680('0x78')](_0xa680('0x92'),_0x5b9e4b[_0xa680('0x2e')],_0x5b9e4b[_0xa680('0x52')]||_0x5b9e4b['Smtp'][_0xa680('0x51')]),'to':_0x4942f1[_0xa680('0x30')]['mailTranscript'],'subject':_0xa680('0x93'),'text':util[_0xa680('0x78')](_0xa680('0x94'),_0x4942f1[_0xa680('0x30')][_0xa680('0x76')]),'attachments':[{'path':_0x1b0afc}]}})[_0xa680('0x18')](function(){return _0x10899c;})[_0xa680('0x22')](function(_0x40357b){logger[_0xa680('0x1d')](_0x40357b);});})[_0xa680('0x18')](respondWithStatusCode(_0x389bad,0xc8))[_0xa680('0x22')](handleError(_0x389bad,null));};exports['addMessage']=function(_0x3d3f82,_0x36853f){return db[_0xa680('0x5f')][_0xa680('0x46')]({'where':{'id':_0x3d3f82[_0xa680('0x3c')]['id']}})[_0xa680('0x18')](handleEntityNotFound(_0x36853f,null))[_0xa680('0x18')](function(_0x2f5944){if(_0x2f5944){return _0x2f5944[_0xa680('0x95')](_0x3d3f82[_0xa680('0x30')][_0xa680('0x96')],_[_0xa680('0x97')](_0x3d3f82[_0xa680('0x30')],[_0xa680('0x96'),'id'])||{});}})['then'](respondWithResult(_0x36853f,null))[_0xa680('0x22')](handleError(_0x36853f,null));};exports['getMessages']=function(_0x2bfdeb,_0x4dda21){var _0xb0d083={'raw':![],'where':{}};var _0x1d8e07={};var _0x3f6fc2={'count':0x0,'rows':[]};return db[_0xa680('0x36')][_0xa680('0x4b')]({'where':{'id':_0x2bfdeb[_0xa680('0x3c')]['id']}})[_0xa680('0x18')](handleEntityNotFound(_0x4dda21,null))[_0xa680('0x18')](function(_0x593d35){if(_0x593d35){_0x1d8e07[_0xa680('0x3d')]=_[_0xa680('0x3e')](db[_0xa680('0x5f')]['rawAttributes']);_0x1d8e07['query']=_[_0xa680('0x3e')](_0x2bfdeb[_0xa680('0x3a')]);_0x1d8e07['filters']=_[_0xa680('0x98')](_0x1d8e07[_0xa680('0x3d')],_0x1d8e07[_0xa680('0x3a')]);_0xb0d083[_0xa680('0x42')]=_[_0xa680('0x98')](_0x1d8e07[_0xa680('0x3d')],qs[_0xa680('0x41')](_0x2bfdeb[_0xa680('0x3a')][_0xa680('0x41')]));_0xb0d083['attributes']=_0xb0d083[_0xa680('0x42')]['length']?_0xb0d083[_0xa680('0x42')]:_0x1d8e07[_0xa680('0x3d')];if(!_0x2bfdeb['query'][_0xa680('0x99')]('nolimit')){_0xb0d083[_0xa680('0x27')]=qs[_0xa680('0x27')](_0x2bfdeb[_0xa680('0x3a')][_0xa680('0x27')]);_0xb0d083[_0xa680('0x26')]=qs[_0xa680('0x26')](_0x2bfdeb[_0xa680('0x3a')]['offset']);}_0xb0d083[_0xa680('0x9a')]=qs[_0xa680('0x9b')](_0x2bfdeb[_0xa680('0x3a')][_0xa680('0x9b')]);_0xb0d083[_0xa680('0x9c')]=qs['filters'](_[_0xa680('0x9d')](_0x2bfdeb['query'],_0x1d8e07['filters']));_0xb0d083[_0xa680('0x9c')][_0xa680('0x9e')]=_0x593d35['id'];if(_0x2bfdeb[_0xa680('0x3a')]['filter']){_0xb0d083[_0xa680('0x9c')]=_[_0xa680('0x2f')](_0xb0d083[_0xa680('0x9c')],{'$or':_['map'](_0xb0d083[_0xa680('0x42')],function(_0x4f65f2){var _0x2c1654={};_0x2c1654[_0x4f65f2]={'$like':'%'+_0x2bfdeb['query'][_0xa680('0x9f')]+'%'};return _0x2c1654;})});}if(_0x2bfdeb[_0xa680('0x3a')][_0xa680('0xa0')]){var _0x4ce04e=_0x2bfdeb[_0xa680('0x3a')][_0xa680('0xa0')][_0xa680('0xa1')](',');var _0x47e7cb={};_0x47e7cb[_0x4ce04e[0x0]]={'$gte':moment(_0x4ce04e[0x1])['format'](_0xa680('0xa2'))};_0xb0d083['where']=_['merge'](_0xb0d083[_0xa680('0x9c')],_0x47e7cb);}_0xb0d083=_[_0xa680('0x2f')]({},_0xb0d083,_0x2bfdeb[_0xa680('0x45')]);return db[_0xa680('0x5f')][_0xa680('0x29')]({'where':_0xb0d083[_0xa680('0x9c')]})['then'](function(_0x2ed634){_0x3f6fc2[_0xa680('0x29')]=_0x2ed634;if(_0x2bfdeb[_0xa680('0x3a')][_0xa680('0x44')]){_0xb0d083[_0xa680('0xa3')]=[{'all':!![]}];}return db[_0xa680('0x5f')]['findAll'](_0xb0d083);})[_0xa680('0x18')](function(_0x59f143){_0x3f6fc2[_0xa680('0xa4')]=_0x59f143;return _0x3f6fc2;});}})[_0xa680('0x18')](respondWithFilteredResult(_0x4dda21,_0xb0d083))[_0xa680('0x22')](handleError(_0x4dda21,null));};exports[_0xa680('0xa5')]=function(_0x5a1cee,_0x4c8596){var _0x25e088={'where':{}},_0x281df4={},_0x5717a3={'count':0x0,'rows':[]};return db['ChatInteraction'][_0xa680('0x4b')]({'where':{'id':_0x5a1cee[_0xa680('0x3c')]['id']}})[_0xa680('0x18')](handleEntityNotFound(_0x4c8596,null))['then'](function(_0x10d588){if(_0x10d588){_0x281df4[_0xa680('0x3d')]=_[_0xa680('0x3e')](db[_0xa680('0x5f')]['rawAttributes']);_0x281df4[_0xa680('0x3a')]=_['keys'](_0x5a1cee[_0xa680('0x3a')]);_0x281df4[_0xa680('0x40')]=_[_0xa680('0x98')](_0x281df4[_0xa680('0x3d')],_0x281df4[_0xa680('0x3a')]);_0x25e088[_0xa680('0x42')]=_['intersection'](_0x281df4[_0xa680('0x3d')],qs[_0xa680('0x41')](_0x5a1cee[_0xa680('0x3a')][_0xa680('0x41')]));_0x25e088[_0xa680('0x42')]=_0x25e088[_0xa680('0x42')][_0xa680('0x43')]?_0x25e088['attributes']:_0x281df4[_0xa680('0x3d')];if(!_0x5a1cee[_0xa680('0x3a')]['hasOwnProperty'](_0xa680('0xa6'))){_0x25e088[_0xa680('0x27')]=qs['limit'](_0x5a1cee[_0xa680('0x3a')][_0xa680('0x27')]);_0x25e088[_0xa680('0x26')]=qs[_0xa680('0x26')](_0x5a1cee['query']['offset']);}_0x25e088['order']=qs[_0xa680('0x9b')](_0x5a1cee['query']['sort']);_0x25e088[_0xa680('0x9c')]=qs[_0xa680('0x40')](_['pick'](_0x5a1cee[_0xa680('0x3a')],_0x281df4[_0xa680('0x40')]));_0x25e088['where'][_0xa680('0x9e')]=_0x10d588['id'];if(_0x5a1cee[_0xa680('0x3a')][_0xa680('0x9f')]){_0x25e088[_0xa680('0x9c')]=_['merge'](_0x25e088[_0xa680('0x9c')],{'$or':_[_0xa680('0x35')](_0x25e088[_0xa680('0x42')],function(_0x4c4bc6){var _0x3ac864={};_0x3ac864[_0x4c4bc6]={'$like':'%'+_0x5a1cee[_0xa680('0x3a')][_0xa680('0x9f')]+'%'};return _0x3ac864;})});}_0x25e088[_0xa680('0x9c')]['secret']=![];if(_0x5a1cee['query']['id']){_0x25e088['where']['id']={'$gt':_0x5a1cee['query']['id']};}_0x25e088=_[_0xa680('0x2f')]({},_0x25e088,_0x5a1cee[_0xa680('0x45')]);return db[_0xa680('0x5f')][_0xa680('0x29')]({'where':_0x25e088[_0xa680('0x9c')]})[_0xa680('0x18')](function(_0x380e7c){_0x5717a3[_0xa680('0x29')]=_0x380e7c;_0x25e088[_0xa680('0xa3')]=[];if(_0x5a1cee[_0xa680('0x3a')][_0xa680('0xa7')]){_0x25e088[_0xa680('0xa3')]['push']({'model':db[_0xa680('0x7b')],'as':_0xa680('0x7b'),'attributes':['id',_0xa680('0x83'),_0xa680('0x82')]});}if(_0x5a1cee[_0xa680('0x3a')]['includeAll']){_0x25e088[_0xa680('0xa3')]=[{'all':!![]}];}return db[_0xa680('0x5f')]['findAll'](_0x25e088);})[_0xa680('0x18')](function(_0xdd5735){_0x5717a3[_0xa680('0xa4')]=_0xdd5735;return _0x5717a3;});}})['then'](respondWithFilteredResult(_0x4c8596,_0x25e088))[_0xa680('0x22')](handleError(_0x4c8596,null));};exports['addTags']=function(_0x332319,_0x48e1bf){return db[_0xa680('0x36')]['find']({'where':{'id':_0x332319[_0xa680('0x3c')]['id']}})[_0xa680('0x18')](handleEntityNotFound(_0x48e1bf,null))[_0xa680('0x18')](function(_0x182d3d){if(_0x182d3d){return _0x182d3d['setTags'](_0x332319['body'][_0xa680('0x96')],_[_0xa680('0x97')](_0x332319[_0xa680('0x30')],[_0xa680('0x96'),'id'])||{})[_0xa680('0xa8')](function(){return db[_0xa680('0xa9')][_0xa680('0x39')]({'attributes':['id','name','color'],'where':{'id':_0x332319[_0xa680('0x30')]['ids']}});})[_0xa680('0x18')](function(_0xad1a40){socket[_0xa680('0xaa')](_0xa680('0xab'),{'id':Number(_0x332319[_0xa680('0x3c')]['id']),'tags':_0xad1a40||[]});return{'id':Number(_0x332319['params']['id']),'tags':_0xad1a40||[]};});}})[_0xa680('0x18')](respondWithResult(_0x48e1bf,null))[_0xa680('0x22')](handleError(_0x48e1bf,null));};exports[_0xa680('0xac')]=function(_0x3e3990,_0x4655ad){return db[_0xa680('0x36')][_0xa680('0x46')]({'where':{'id':_0x3e3990['params']['id']}})[_0xa680('0x18')](handleEntityNotFound(_0x4655ad,null))[_0xa680('0x18')](function(_0x354166){if(_0x354166){return _0x354166[_0xa680('0xac')](_0x3e3990[_0xa680('0x3a')]['ids']);}})[_0xa680('0x18')](respondWithStatusCode(_0x4655ad,null))[_0xa680('0x22')](handleError(_0x4655ad,null));};exports[_0xa680('0x75')]=function(_0x1ea298,_0x3a5c30){var _0x1312fa=moment()[_0xa680('0xad')]()[_0xa680('0xae')]();var _0x43c484=path[_0xa680('0x72')](config[_0xa680('0x77')],_0xa680('0xaf'),_0xa680('0xb0'),_0xa680('0xb1'));var _0x25c29d=path['join'](config[_0xa680('0x77')],_0xa680('0xaf'),'files',_0xa680('0xb2'));var _0x1fa35c=path[_0xa680('0x72')](_0x43c484,_0x1312fa);var _0x33d40f=util[_0xa680('0x78')](_0xa680('0xb3'),_0x1ea298[_0xa680('0x3c')]['id'],_0x1312fa);var _0x1729ab=path[_0xa680('0x72')](_0x43c484,_0x33d40f);var _0x94e702=[];_0x94e702['push']({'model':db['User'],'as':_0xa680('0x7b'),'attributes':['id',_0xa680('0x83')],'raw':!![]});_0x94e702['push']({'model':db['CmContact'],'as':_0xa680('0x62'),'attributes':['id','firstName',_0xa680('0xb4')],'raw':!![]});if(_0x1ea298[_0xa680('0x3a')][_0xa680('0xb2')]){_0x94e702[_0xa680('0xb5')]({'model':db[_0xa680('0x70')],'as':'Attachment','raw':!![]});}var _0x568b74=[{'model':db['ChatMessage'],'as':_0xa680('0xb6'),'attributes':['id',_0xa680('0x30'),_0xa680('0x86'),'direction','secret','read'],'include':_0x94e702}];_0x568b74[_0xa680('0xb5')]({'model':db['ChatWebsite'],'as':_0xa680('0xb7'),'attributes':['id','name']});_0x568b74[_0xa680('0xb5')]({'model':db[_0xa680('0x7b')],'as':_0xa680('0xb8'),'attributes':['id',_0xa680('0x83')]});return db[_0xa680('0x36')][_0xa680('0x46')]({'where':{'id':_0x1ea298['params']['id']},'include':_0x568b74})[_0xa680('0x18')](handleEntityNotFound(_0x3a5c30,null))[_0xa680('0x18')](function(_0x35aa6d){if(_0x35aa6d){var _0x8c5b7a=_0x35aa6d[_0xa680('0xb9')]({'plain':!![]});fs[_0xa680('0xba')](_0x1fa35c);var _0x395fdf={'channel':'Chat','account':_0x8c5b7a[_0xa680('0xb7')][_0xa680('0x2e')],'agent':_0x8c5b7a[_0xa680('0xb8')]?_0x8c5b7a[_0xa680('0xb8')][_0xa680('0x83')]:_0xa680('0xbb'),'createdAt':moment(_0x8c5b7a['createdAt'])[_0xa680('0x78')](_0xa680('0xa2'))[_0xa680('0xae')](),'closedAt':_0x8c5b7a['closed']?moment(_0x8c5b7a[_0xa680('0xbc')])['format'](_0xa680('0xa2'))['toString']():'','disposition':_0x8c5b7a[_0xa680('0x66')],'chatInfo':{'browser':_0x8c5b7a[_0xa680('0xbd')],'os':_0x8c5b7a[_0xa680('0xbe')],'referer':_0x8c5b7a[_0xa680('0xbf')],'customerIp':_0x8c5b7a[_0xa680('0xc0')],'customerPort':_0x8c5b7a['customerPort']?_0x8c5b7a[_0xa680('0xc1')]:_0xa680('0xbb')},'messages':_(_0x8c5b7a[_0xa680('0xb6')])['tail']()[_0xa680('0x9f')]({'secret':![]})['map'](function(_0x1a5acd){if(_0x1a5acd[_0xa680('0x70')]){var _0x45ad1d=path[_0xa680('0x72')](_0x25c29d,_0x1a5acd[_0xa680('0x70')][_0xa680('0x6b')]);if(fs[_0xa680('0xc2')](_0x45ad1d)){fs['createReadStream'](_0x45ad1d)[_0xa680('0xc3')](fs[_0xa680('0xc4')](path['join'](_0x1fa35c,_0x1a5acd[_0xa680('0x70')]['basename'])));}}return{'date':moment(_0x1a5acd[_0xa680('0x86')])[_0xa680('0x78')](_0xa680('0xa2'))['toString'](),'sender':_0x1a5acd[_0xa680('0x88')]==='out'?_0x1a5acd['User']?_0x1a5acd['User'][_0xa680('0x83')]:_0xa680('0x80'):_0x1a5acd[_0xa680('0x62')][_0xa680('0xc5')]+(_0x1a5acd[_0xa680('0x62')][_0xa680('0xb4')]?'\x20'+_0x1a5acd[_0xa680('0x62')][_0xa680('0xb4')]:''),'body':_0x1a5acd['Attachment']?_0x1a5acd[_0xa680('0x70')][_0xa680('0x6b')]:_0x1a5acd[_0xa680('0x30')],'direction':_0x1a5acd[_0xa680('0x88')]===_0xa680('0x5e')?'A':'C','secret':_0x1a5acd[_0xa680('0x89')],'read':_0x1a5acd[_0xa680('0xc6')],'attachment':_0x1a5acd[_0xa680('0x70')]};})[_0xa680('0xc7')]()};return ejs[_0xa680('0xc8')](path[_0xa680('0x72')](config[_0xa680('0x77')],'server',_0xa680('0xc9'),_0xa680('0xca')),{'interaction':_0x395fdf})[_0xa680('0x18')](function(_0x5d1e8e){var _0x139160=path[_0xa680('0x72')](_0x1fa35c,_0xa680('0xcb')+_0x8c5b7a['id']+'-'+_0x1312fa+'.pdf');var _0x52ea0c={'path':_0x139160,'channel':_0xa680('0xcc'),'interactionId':_0x8c5b7a['id']};return pdf[_0xa680('0xcd')](_0x5d1e8e,_0x52ea0c);})[_0xa680('0x18')](function(){return new Promise(function(_0x29364a,_0x281c82){zipdir(_0x1fa35c,{'saveTo':_0x1729ab},function(_0x4668d7,_0x56495f){if(_0x4668d7)return _0x281c82(_0x4668d7);return _0x29364a(_0x56495f);});})[_0xa680('0x18')](function(){return new BPromise(function(_0x693a79,_0x1ad28f){rimraf(_0x1fa35c,function(_0x328d32){if(_0x328d32)_0x1ad28f(_0x328d32);return _0x693a79();});});})['then'](function(){return _0x3a5c30['download'](_0x1729ab,_0x33d40f,function(_0x2de956){if(_0x2de956){logger[_0xa680('0x1d')](_0xa680('0xce'),_0x2de956);}else{fs[_0xa680('0xcf')](_0x1729ab);}});});});}else{return _0x3a5c30[_0xa680('0xd0')](0xc8);}})[_0xa680('0x22')](handleError(_0x3a5c30,null));}; \ No newline at end of file +var _0xb461=['Account','Owner','get','N.A.','toString','closedAt','disposition','browserName','osName','referer','tail','existsSync','createReadStream','firstName','read','renderFile','views','downloadInteraction.ejs','.pdf','err','unlinkSync','rimraf','zip-dir','moment','bluebird','mustache','util','path','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','defaults','socket.io-emitter','redis','jayson/promise','client','http','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','update','destroy','name','merge','body','contact','agent','interaction','account','map','ChatInteraction','rawAttributes','key','getOptions','findAll','chat','query','catch','model','keys','filters','attributes','intersection','fields','length','includeAll','include','options','find','create','params','describe','createVidaooSession','findOne','ChatWebsiteId','vidaooApiKey','vidaooEscalation','vidaooNote','user','fullname','email','vidaooTopic','isNull','follow','vidaooMetadata','parse','metadata','Sequelize','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','join_url','out','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','CmContact','Contact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','UserId','closed','AbandonInteraction','attachmentUpload','file','originalname','basename','filename','mimetype','Attachment','Unauthorized','ChatOfflineMessageId','server/files/attachments/','join','offline-chat/','download','mailTranscript','root','format','transcript-%s.txt','now','pathTranscript','Messages','ChatWebsite','ContactId','%s%d','agentAlias','customer','Visitor','agentIdentifier','website_alias','System','User','alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','createdAt','MM/DD/YYYY\x20HH:mm:ss','direction','appendFileSync','MailAccount','MailServerOut','Smtp','CloudProvider','getSmtpOptions','SendMail','\x22%s\x22\x20<%s>','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','hasOwnProperty','nolimit','order','sort','where','pick','filter','$gte','YYYY-MM-DD\x20HH:mm:ss','ChatInteractionId','includeAgent','push','rows','addTags','setTags','spread','Tag','color','emit','chatInteractionTags:save','removeTags','files','tmp','server','transcript-%d-%s.zip','lastName','secret'];(function(_0xdf3614,_0x3bab42){var _0x2d77f4=function(_0x3405fb){while(--_0x3405fb){_0xdf3614['push'](_0xdf3614['shift']());}};_0x2d77f4(++_0x3bab42);}(_0xb461,0xdf));var _0x1b46=function(_0x545707,_0x3acd90){_0x545707=_0x545707-0x0;var _0x54b9a7=_0xb461[_0x545707];return _0x54b9a7;};'use strict';var rimraf=require(_0x1b46('0x0'));var zipdir=require(_0x1b46('0x1'));var rp=require('request-promise');var moment=require(_0x1b46('0x2'));var BPromise=require(_0x1b46('0x3'));var Mustache=require(_0x1b46('0x4'));var util=require(_0x1b46('0x5'));var path=require(_0x1b46('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var Redis=require(_0x1b46('0x7'));var interaction=require(_0x1b46('0x8'));var qs=require(_0x1b46('0x9'));var pdf=require(_0x1b46('0xa'));var logger=require(_0x1b46('0xb'))(_0x1b46('0xc'));var config=require(_0x1b46('0xd'));var db=require(_0x1b46('0xe'))['db'];config['redis']=_[_0x1b46('0xf')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x1b46('0x10'))(new Redis(config[_0x1b46('0x11')]));require('./chatInteraction.socket')['register'](socket);var jayson=require(_0x1b46('0x12'));var client=jayson[_0x1b46('0x13')]['http']({'port':0x232b});var client9004=jayson[_0x1b46('0x13')][_0x1b46('0x14')]({'port':0x232c});function respondWithRpcPromise(_0x1967e4,_0x195df1,_0x5390f0,_0x3d48c2){return new BPromise(function(_0x276050,_0xc7d90d){var _0x63a7a4=_0x3d48c2||client;return _0x63a7a4[_0x1b46('0x15')](_0x1967e4,_0x5390f0)[_0x1b46('0x16')](function(_0x38dd7e){logger[_0x1b46('0x17')](_0x1b46('0x18'),_0x195df1,_0x1b46('0x19'));logger[_0x1b46('0x1a')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x195df1,_0x1b46('0x19'),JSON[_0x1b46('0x1b')](_0x38dd7e));if(_0x38dd7e[_0x1b46('0x1c')]){if(_0x38dd7e[_0x1b46('0x1c')]['code']===0x1f4){logger['error'](_0x1b46('0x18'),_0x195df1,_0x38dd7e[_0x1b46('0x1c')][_0x1b46('0x1d')]);return _0xc7d90d(_0x38dd7e['error']['message']);}logger[_0x1b46('0x1c')](_0x1b46('0x18'),_0x195df1,_0x38dd7e['error'][_0x1b46('0x1d')]);return _0x276050(_0x38dd7e['error'][_0x1b46('0x1d')]);}else{logger['info'](_0x1b46('0x18'),_0x195df1,'request\x20sent');_0x276050(_0x38dd7e[_0x1b46('0x1e')][_0x1b46('0x1d')]);}})['catch'](function(_0x19b900){logger[_0x1b46('0x1c')](_0x1b46('0x18'),_0x195df1,_0x19b900);_0xc7d90d(_0x19b900);});});}function respondWithStatusCode(_0x3f0b79,_0x689ae5){_0x689ae5=_0x689ae5||0xcc;return function(_0xee0926){if(_0xee0926){return _0x3f0b79[_0x1b46('0x1f')](_0x689ae5);}return _0x3f0b79[_0x1b46('0x20')](_0x689ae5)[_0x1b46('0x21')]();};}function respondWithResult(_0x246a19,_0x3b94d5){_0x3b94d5=_0x3b94d5||0xc8;return function(_0x38cbc2){if(_0x38cbc2){return _0x246a19[_0x1b46('0x20')](_0x3b94d5)['json'](_0x38cbc2);}};}function respondWithFilteredResult(_0x259fc6,_0x20a77c){return function(_0x11b652){if(_0x11b652){var _0x2a9bf8=typeof _0x20a77c[_0x1b46('0x22')]==='undefined'&&typeof _0x20a77c[_0x1b46('0x23')]===_0x1b46('0x24');var _0x414c52=_0x11b652[_0x1b46('0x25')];var _0x5d3fb5=_0x2a9bf8?0x0:_0x20a77c[_0x1b46('0x22')];var _0x264c3e=_0x2a9bf8?_0x11b652[_0x1b46('0x25')]:_0x20a77c['offset']+_0x20a77c[_0x1b46('0x23')];var _0x402632;if(_0x264c3e>=_0x414c52){_0x264c3e=_0x414c52;_0x402632=0xc8;}else{_0x402632=0xce;}_0x259fc6[_0x1b46('0x20')](_0x402632);return _0x259fc6[_0x1b46('0x26')](_0x1b46('0x27'),_0x5d3fb5+'-'+_0x264c3e+'/'+_0x414c52)[_0x1b46('0x28')](_0x11b652);}return null;};}function saveUpdates(_0x54b3bb){return function(_0x1f01b0){if(_0x1f01b0){return _0x1f01b0[_0x1b46('0x29')](_0x54b3bb)[_0x1b46('0x16')](function(_0x5665ab){return _0x5665ab;});}return null;};}function removeEntity(_0x1d2636){return function(_0x3bf354){if(_0x3bf354){return _0x3bf354[_0x1b46('0x2a')]()['then'](function(){_0x1d2636[_0x1b46('0x20')](0xcc)[_0x1b46('0x21')]();});}};}function handleEntityNotFound(_0x283638){return function(_0x124aa1){if(!_0x124aa1){_0x283638[_0x1b46('0x1f')](0x194);}return _0x124aa1;};}function handleError(_0x2e24c5,_0x5003f0){_0x5003f0=_0x5003f0||0x1f4;return function(_0x4b9c83){logger[_0x1b46('0x1c')](_0x4b9c83['stack']);if(_0x4b9c83[_0x1b46('0x2b')]){delete _0x4b9c83[_0x1b46('0x2b')];}_0x2e24c5[_0x1b46('0x20')](_0x5003f0)['send'](_0x4b9c83);};}function getMustacheRender(_0x163d7a,_0x335e02){return Mustache['render'](_0x163d7a,_[_0x1b46('0x2c')](_0x335e02[_0x1b46('0x2d')],{'contact':_0x335e02[_0x1b46('0x2e')],'message':_0x335e02['message'],'agent':_0x335e02[_0x1b46('0x2f')],'interaction':_0x335e02[_0x1b46('0x30')],'account':_0x335e02[_0x1b46('0x31')]}))||'';}exports['index']=function(_0x5ddb7d,_0x554ba4){var _0x49c890={};var _0x1d6dbb=_[_0x1b46('0x32')](db[_0x1b46('0x33')][_0x1b46('0x34')],function(_0x3e998c){return{'name':_0x3e998c['fieldName'],'type':_0x3e998c['type'][_0x1b46('0x35')]};});_0x49c890=qs[_0x1b46('0x36')](_0x1d6dbb,_0x5ddb7d);return interaction[_0x1b46('0x37')](_0x1b46('0x38'),_0x5ddb7d[_0x1b46('0x39')],_0x5ddb7d['user'],_0x49c890,_0x1d6dbb)[_0x1b46('0x16')](respondWithFilteredResult(_0x554ba4,_0x49c890))[_0x1b46('0x3a')](handleError(_0x554ba4,null));};exports['show']=function(_0x492a4e,_0x3d64bf){var _0x1c125d={'raw':![],'where':{'id':_0x492a4e['params']['id']}},_0x5a0af2={};_0x5a0af2[_0x1b46('0x3b')]=_[_0x1b46('0x3c')](db[_0x1b46('0x33')][_0x1b46('0x34')]);_0x5a0af2[_0x1b46('0x39')]=_[_0x1b46('0x3c')](_0x492a4e[_0x1b46('0x39')]);_0x5a0af2[_0x1b46('0x3d')]=_['intersection'](_0x5a0af2[_0x1b46('0x3b')],_0x5a0af2['query']);_0x1c125d[_0x1b46('0x3e')]=_[_0x1b46('0x3f')](_0x5a0af2['model'],qs['fields'](_0x492a4e['query'][_0x1b46('0x40')]));_0x1c125d['attributes']=_0x1c125d['attributes'][_0x1b46('0x41')]?_0x1c125d['attributes']:_0x5a0af2['model'];if(_0x492a4e[_0x1b46('0x39')][_0x1b46('0x42')]){_0x1c125d[_0x1b46('0x43')]=[{'all':!![]}];}_0x1c125d=_[_0x1b46('0x2c')]({},_0x1c125d,_0x492a4e[_0x1b46('0x44')]);return db[_0x1b46('0x33')][_0x1b46('0x45')](_0x1c125d)['then'](handleEntityNotFound(_0x3d64bf,null))[_0x1b46('0x16')](respondWithResult(_0x3d64bf,null))[_0x1b46('0x3a')](handleError(_0x3d64bf,null));};exports[_0x1b46('0x46')]=function(_0x3d6ab8,_0x427d11){return db[_0x1b46('0x33')][_0x1b46('0x46')](_0x3d6ab8['body'],{})[_0x1b46('0x16')](respondWithResult(_0x427d11,0xc9))[_0x1b46('0x3a')](handleError(_0x427d11,null));};exports[_0x1b46('0x29')]=function(_0x4acda7,_0x346a4f){if(_0x4acda7[_0x1b46('0x2d')]['id']){delete _0x4acda7['body']['id'];}return db[_0x1b46('0x33')]['find']({'where':{'id':_0x4acda7[_0x1b46('0x47')]['id']}})[_0x1b46('0x16')](handleEntityNotFound(_0x346a4f,null))[_0x1b46('0x16')](saveUpdates(_0x4acda7[_0x1b46('0x2d')],null))['then'](respondWithResult(_0x346a4f,null))[_0x1b46('0x3a')](handleError(_0x346a4f,null));};exports[_0x1b46('0x2a')]=function(_0x1b5afb,_0x3a958c){return db['ChatInteraction']['find']({'where':{'id':_0x1b5afb[_0x1b46('0x47')]['id']}})['then'](handleEntityNotFound(_0x3a958c,null))[_0x1b46('0x16')](removeEntity(_0x3a958c,null))['catch'](handleError(_0x3a958c,null));};exports[_0x1b46('0x48')]=function(_0x2a8764,_0x58c7dd){return db['ChatInteraction'][_0x1b46('0x48')]()[_0x1b46('0x16')](respondWithResult(_0x58c7dd,null))[_0x1b46('0x3a')](handleError(_0x58c7dd,null));};exports[_0x1b46('0x49')]=function(_0xe10228,_0x3de85c){var _0x304701=_0xe10228[_0x1b46('0x47')]['id'];var _0x36233e;var _0x3d4684;var _0x346a93;return db[_0x1b46('0x33')][_0x1b46('0x4a')]({'where':{'id':_0x304701}})['then'](function(_0x2fe59a){_0x36233e=_0x2fe59a;return db['ChatWebsite'][_0x1b46('0x4a')]({'where':{'id':_0x2fe59a[_0x1b46('0x4b')]},'attributes':['id',_0x1b46('0x4c'),_0x1b46('0x4d'),'vidaooTopic',_0x1b46('0x4e'),'vidaooMetadata'],'raw':!![]});})['then'](function(_0x218fee){if(_0x218fee&&_0x218fee[_0x1b46('0x4c')]&&_0x218fee[_0x1b46('0x4d')]){_0x3d4684=_0x218fee;var _0x363195={'interaction':{'id':_0x304701},'agent':{'id':_0xe10228['user']['id'],'name':_0xe10228[_0x1b46('0x4f')]['name'],'fullname':_0xe10228[_0x1b46('0x4f')][_0x1b46('0x50')],'email':_0xe10228[_0x1b46('0x4f')][_0x1b46('0x51')]},'contact':_0xe10228[_0x1b46('0x2d')][_0x1b46('0x2e')],'account':_0xe10228['body'][_0x1b46('0x31')]};var _0x577600={'rejectUnauthorized':![],'method':'POST','url':'https://api-vidaoo.xcally.com/api/v1/meetings','headers':{'X-APIKEY':_0x218fee[_0x1b46('0x4c')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0xe10228[_0x1b46('0x4f')][_0x1b46('0x51')]],'buttons':null,'topic':_0x3d4684[_0x1b46('0x52')],'note':_[_0x1b46('0x53')](_0x3d4684[_0x1b46('0x4e')])?null:getMustacheRender(_0x3d4684[_0x1b46('0x4e')],_0x363195),'metadata':null},'redirect':_0x1b46('0x54'),'json':!![]};try{if(!_['isNull'](_0x3d4684[_0x1b46('0x55')])){var _0x4af925=getMustacheRender(_0x3d4684[_0x1b46('0x55')],_0x363195);var _0x19c658=JSON[_0x1b46('0x56')](_0x4af925);_0x577600[_0x1b46('0x2d')][_0x1b46('0x57')]=_0x19c658;}}catch(_0x1b21cb){throw new db[(_0x1b46('0x58'))][(_0x1b46('0x59'))](_0x1b46('0x5a'));}return rp(_0x577600);}else{throw new db[(_0x1b46('0x58'))][(_0x1b46('0x59'))]('Error\x20in\x20Vidaoo\x20configuration');}})[_0x1b46('0x16')](function(_0x559f92){_0x346a93=_0x559f92;if(_0x346a93['id']){var _0x37df6c={'body':_0x346a93[_0x1b46('0x5b')],'ChatWebsiteId':_0x3d4684['id'],'ChatInteractionId':_0x36233e['id'],'direction':_0x1b46('0x5c'),'UserId':_0xe10228[_0x1b46('0x4f')]['id']};return db[_0x1b46('0x5d')][_0x1b46('0x46')](_0x37df6c,{});}else{throw new db['Sequelize']['ValidationError'](_0x1b46('0x5e'));}})[_0x1b46('0x16')](function(){return _0x36233e[_0x1b46('0x5f')]({'vidaooSessionId':_0x346a93['id']});})[_0x1b46('0x16')](respondWithResult(_0x3de85c,null))[_0x1b46('0x3a')](handleError(_0x3de85c,null));};exports[_0x1b46('0x60')]=function(_0x3ad5e7,_0x430e10){if(_0x3ad5e7[_0x1b46('0x2d')]['id']){delete _0x3ad5e7['body']['id'];}return db['ChatInteraction'][_0x1b46('0x45')]({'where':{'id':_0x3ad5e7[_0x1b46('0x47')]['id']},'include':[{'model':db[_0x1b46('0x61')],'as':_0x1b46('0x62')}]})[_0x1b46('0x16')](handleEntityNotFound(_0x430e10,null))[_0x1b46('0x16')](saveUpdates(_0x3ad5e7[_0x1b46('0x2d')],null))['then'](respondWithResult(_0x430e10,null))[_0x1b46('0x3a')](handleError(_0x430e10,null));};exports[_0x1b46('0x63')]=function(_0x15d1c3,_0x4bb199){if(_0x15d1c3[_0x1b46('0x2d')]['id']){delete _0x15d1c3['body']['id'];}return db[_0x1b46('0x33')]['find']({'where':{'id':_0x15d1c3['params']['id']}})['then'](function(_0x32e7b1){if(!_0x32e7b1){logger[_0x1b46('0x1c')](_0x1b46('0x64'),_0x1b46('0x63'),0x194,_0x1b46('0x65'));_0x4bb199[_0x1b46('0x1f')](0x194);}else{if(_0x32e7b1[_0x1b46('0x66')]){throw new db[(_0x1b46('0x58'))][(_0x1b46('0x59'))]('Interaction\x20already\x20assigned');}}return _0x32e7b1;})[_0x1b46('0x16')](function(_0x2db89c){if(_0x2db89c){return _0x2db89c[_0x1b46('0x29')]({'closed':_0x15d1c3['body'][_0x1b46('0x67')],'disposition':_0x15d1c3[_0x1b46('0x2d')]['disposition']})[_0x1b46('0x16')](function(_0x1f3f14){return _0x1f3f14;});}})[_0x1b46('0x16')](function(){return respondWithRpcPromise(_0x1b46('0x68'),_0x1b46('0x63'),_0x15d1c3['body'],client9004);})[_0x1b46('0x16')](respondWithResult(_0x4bb199,null))[_0x1b46('0x3a')](handleError(_0x4bb199,null));};exports[_0x1b46('0x69')]=function(_0x15301f,_0x3b2498){_0x15301f['body'][_0x1b46('0x2b')]=_0x15301f[_0x1b46('0x6a')][_0x1b46('0x6b')];_0x15301f[_0x1b46('0x2d')][_0x1b46('0x6c')]=_0x15301f[_0x1b46('0x6a')][_0x1b46('0x6d')];_0x15301f['body']['type']=_0x15301f[_0x1b46('0x6a')][_0x1b46('0x6e')];return db[_0x1b46('0x6f')][_0x1b46('0x46')](_0x15301f[_0x1b46('0x2d')])[_0x1b46('0x16')](respondWithResult(_0x3b2498,0xc9))['catch'](handleError(_0x3b2498,null));};exports['attachmentDownload']=function(_0x38474c,_0x4ee8b9){return db[_0x1b46('0x33')][_0x1b46('0x4a')]({'where':{'id':_0x38474c['params']['id']},'raw':!![]})[_0x1b46('0x16')](handleEntityNotFound(_0x4ee8b9,null))['then'](function(_0x5b1439){if(_0x5b1439){if(_0x5b1439[_0x1b46('0x67')]){return _0x4ee8b9['status'](0x193)['json']({'status':0x193,'message':_0x1b46('0x70')});}return db[_0x1b46('0x6f')][_0x1b46('0x4a')]({'where':{'id':_0x38474c[_0x1b46('0x39')]['attachId']},'raw':!![]})[_0x1b46('0x16')](handleEntityNotFound(_0x4ee8b9,null));}})[_0x1b46('0x16')](function(_0x28a33f){if(_0x28a33f){var _0x38729e=_0x28a33f[_0x1b46('0x71')]!==null;var _0x2b5209=path['join'](config['root'],_0x1b46('0x72'));if(_0x38729e){_0x2b5209=path[_0x1b46('0x73')](_0x2b5209,_0x1b46('0x74'));}var _0x37685f=path[_0x1b46('0x73')](_0x2b5209,_0x28a33f[_0x1b46('0x6c')]);return _0x4ee8b9[_0x1b46('0x75')](_0x37685f);}})[_0x1b46('0x3a')](handleError(_0x4ee8b9,null));};exports['close']=function(_0x2159ba,_0x18c28c){var _0x30e1ce=null;var _0x368f88=null;var _0x34a1bb=null;if(_0x2159ba[_0x1b46('0x2d')]['id']){delete _0x2159ba[_0x1b46('0x2d')]['id'];}if(_0x2159ba[_0x1b46('0x2d')][_0x1b46('0x76')]){_0x34a1bb=path['join'](config[_0x1b46('0x77')],'server/files/chat/upload/',util[_0x1b46('0x78')](_0x1b46('0x79'),Date[_0x1b46('0x7a')]()));_0x2159ba[_0x1b46('0x2d')][_0x1b46('0x7b')]=_0x34a1bb;}return db[_0x1b46('0x33')][_0x1b46('0x45')]({'where':{'id':_0x2159ba[_0x1b46('0x47')]['id']},'include':[{'model':db[_0x1b46('0x5d')],'as':_0x1b46('0x7c'),'include':[{'model':db['User'],'as':'User'}]}]})['then'](handleEntityNotFound(_0x18c28c,null))['then'](saveUpdates(_0x2159ba['body'],null))[_0x1b46('0x16')](function(_0x195684){if(_0x195684){_0x30e1ce=_0x195684;return db[_0x1b46('0x7d')][_0x1b46('0x45')]({'where':{'id':_0x30e1ce[_0x1b46('0x4b')]}});}})['then'](function(_0x166758){if(_0x166758){_0x368f88=_0x166758;return db[_0x1b46('0x61')][_0x1b46('0x45')]({'where':{'id':_0x30e1ce[_0x1b46('0x7e')]}});}})[_0x1b46('0x16')](function(_0x20351f){if(_0x20351f){if(_0x34a1bb){var _0x3afad0=null;for(var _0x26dbfa=0x1;_0x26dbfa<_0x30e1ce['Messages'][_0x1b46('0x41')];++_0x26dbfa){_0x3afad0=_0x30e1ce[_0x1b46('0x7c')][_0x26dbfa];var _0x599fa2=_0x3afad0[_0x1b46('0x66')]?util[_0x1b46('0x78')](_0x1b46('0x7f'),_0x368f88[_0x1b46('0x80')],_0x3afad0[_0x1b46('0x66')]):'System';var _0x740f85=_0x2159ba[_0x1b46('0x2d')][_0x1b46('0x81')]||util['format'](_0x1b46('0x7f'),_0x1b46('0x82'),_0x3afad0['ContactId']);switch(_0x368f88[_0x1b46('0x83')]){case _0x1b46('0x84'):_0x599fa2=_0x3afad0[_0x1b46('0x66')]?util['format'](_0x1b46('0x7f'),_0x368f88[_0x1b46('0x80')],_0x3afad0['UserId']):_0x1b46('0x85');break;case'agent_alias':_0x599fa2=_0x3afad0[_0x1b46('0x66')]?_0x3afad0[_0x1b46('0x86')][_0x1b46('0x87')]||_0x3afad0[_0x1b46('0x86')][_0x1b46('0x50')]:'System';break;case _0x1b46('0x88'):_0x599fa2=_0x3afad0[_0x1b46('0x66')]?_0x3afad0[_0x1b46('0x86')]['fullname']:_0x1b46('0x85');break;default:_0x599fa2=_0x3afad0['UserId']?util['format'](_0x1b46('0x7f'),_0x368f88[_0x1b46('0x80')],_0x3afad0[_0x1b46('0x66')]):_0x1b46('0x85');}var _0x86c4ca=util[_0x1b46('0x78')](_0x1b46('0x89'),moment(_0x3afad0[_0x1b46('0x8a')])[_0x1b46('0x78')](_0x1b46('0x8b')),_0x3afad0[_0x1b46('0x8c')]==='in'?_0x740f85:_0x599fa2,_0x3afad0[_0x1b46('0x2d')]);if(!_0x3afad0['secret']){fs[_0x1b46('0x8d')](_0x34a1bb,_0x86c4ca);}}return db[_0x1b46('0x8e')][_0x1b46('0x4a')]({'where':{'service':!![]},'include':[{'model':db[_0x1b46('0x8f')],'as':_0x1b46('0x90'),'raw':!![],'include':[{'model':db[_0x1b46('0x91')],'as':_0x1b46('0x91'),'raw':!![]}]}]});}}})[_0x1b46('0x16')](function(_0x59583d){if(!_0x59583d||!_0x59583d['Smtp']||!_0x2159ba[_0x1b46('0x2d')])return _0x30e1ce;var _0x447861=_0x59583d[_0x1b46('0x92')]();return respondWithRpcPromise(_0x1b46('0x93'),'sendMail',{'account':_0x447861,'message':{'from':util[_0x1b46('0x78')](_0x1b46('0x94'),_0x59583d['name'],_0x59583d[_0x1b46('0x51')]||_0x59583d['Smtp'][_0x1b46('0x4f')]),'to':_0x2159ba['body'][_0x1b46('0x76')],'subject':_0x1b46('0x95'),'text':util[_0x1b46('0x78')](_0x1b46('0x96'),_0x2159ba[_0x1b46('0x2d')]['mailTranscript']),'attachments':[{'path':_0x34a1bb}]}})['then'](function(){return _0x30e1ce;})[_0x1b46('0x3a')](function(_0x476203){logger[_0x1b46('0x1c')](_0x476203);});})[_0x1b46('0x16')](respondWithStatusCode(_0x18c28c,0xc8))[_0x1b46('0x3a')](handleError(_0x18c28c,null));};exports[_0x1b46('0x97')]=function(_0x5ae66d,_0xe99084){return db[_0x1b46('0x5d')][_0x1b46('0x45')]({'where':{'id':_0x5ae66d[_0x1b46('0x47')]['id']}})[_0x1b46('0x16')](handleEntityNotFound(_0xe99084,null))['then'](function(_0x9f251f){if(_0x9f251f){return _0x9f251f[_0x1b46('0x97')](_0x5ae66d['body'][_0x1b46('0x98')],_[_0x1b46('0x99')](_0x5ae66d[_0x1b46('0x2d')],[_0x1b46('0x98'),'id'])||{});}})[_0x1b46('0x16')](respondWithResult(_0xe99084,null))[_0x1b46('0x3a')](handleError(_0xe99084,null));};exports['getMessages']=function(_0x2d2a00,_0x5209e1){var _0x54f24c={'raw':![],'where':{}};var _0x344025={};var _0x5ae2cb={'count':0x0,'rows':[]};return db[_0x1b46('0x33')][_0x1b46('0x4a')]({'where':{'id':_0x2d2a00[_0x1b46('0x47')]['id']}})['then'](handleEntityNotFound(_0x5209e1,null))[_0x1b46('0x16')](function(_0x35517a){if(_0x35517a){_0x344025[_0x1b46('0x3b')]=_['keys'](db['ChatMessage'][_0x1b46('0x34')]);_0x344025['query']=_[_0x1b46('0x3c')](_0x2d2a00[_0x1b46('0x39')]);_0x344025[_0x1b46('0x3d')]=_[_0x1b46('0x3f')](_0x344025[_0x1b46('0x3b')],_0x344025['query']);_0x54f24c['attributes']=_[_0x1b46('0x3f')](_0x344025[_0x1b46('0x3b')],qs[_0x1b46('0x40')](_0x2d2a00[_0x1b46('0x39')][_0x1b46('0x40')]));_0x54f24c[_0x1b46('0x3e')]=_0x54f24c[_0x1b46('0x3e')][_0x1b46('0x41')]?_0x54f24c[_0x1b46('0x3e')]:_0x344025[_0x1b46('0x3b')];if(!_0x2d2a00[_0x1b46('0x39')][_0x1b46('0x9a')](_0x1b46('0x9b'))){_0x54f24c[_0x1b46('0x23')]=qs[_0x1b46('0x23')](_0x2d2a00[_0x1b46('0x39')]['limit']);_0x54f24c[_0x1b46('0x22')]=qs['offset'](_0x2d2a00[_0x1b46('0x39')][_0x1b46('0x22')]);}_0x54f24c[_0x1b46('0x9c')]=qs[_0x1b46('0x9d')](_0x2d2a00[_0x1b46('0x39')]['sort']);_0x54f24c[_0x1b46('0x9e')]=qs[_0x1b46('0x3d')](_[_0x1b46('0x9f')](_0x2d2a00[_0x1b46('0x39')],_0x344025[_0x1b46('0x3d')]));_0x54f24c[_0x1b46('0x9e')]['ChatInteractionId']=_0x35517a['id'];if(_0x2d2a00['query']['filter']){_0x54f24c[_0x1b46('0x9e')]=_['merge'](_0x54f24c[_0x1b46('0x9e')],{'$or':_[_0x1b46('0x32')](_0x54f24c[_0x1b46('0x3e')],function(_0x56a59b){var _0x2a17f0={};_0x2a17f0[_0x56a59b]={'$like':'%'+_0x2d2a00[_0x1b46('0x39')][_0x1b46('0xa0')]+'%'};return _0x2a17f0;})});}if(_0x2d2a00[_0x1b46('0x39')]['$gte']){var _0x2ef19b=_0x2d2a00['query'][_0x1b46('0xa1')]['split'](',');var _0x2775be={};_0x2775be[_0x2ef19b[0x0]]={'$gte':moment(_0x2ef19b[0x1])[_0x1b46('0x78')](_0x1b46('0xa2'))};_0x54f24c[_0x1b46('0x9e')]=_[_0x1b46('0x2c')](_0x54f24c[_0x1b46('0x9e')],_0x2775be);}_0x54f24c=_['merge']({},_0x54f24c,_0x2d2a00['options']);return db[_0x1b46('0x5d')][_0x1b46('0x25')]({'where':_0x54f24c[_0x1b46('0x9e')]})[_0x1b46('0x16')](function(_0x3c5263){_0x5ae2cb[_0x1b46('0x25')]=_0x3c5263;if(_0x2d2a00['query']['includeAll']){_0x54f24c['include']=[{'all':!![]}];}return db[_0x1b46('0x5d')][_0x1b46('0x37')](_0x54f24c);})[_0x1b46('0x16')](function(_0x507076){_0x5ae2cb['rows']=_0x507076;return _0x5ae2cb;});}})[_0x1b46('0x16')](respondWithFilteredResult(_0x5209e1,_0x54f24c))['catch'](handleError(_0x5209e1,null));};exports['getMyMessages']=function(_0x344168,_0xea3fc8){var _0x1810b4={'where':{}},_0x202643={},_0x5e7d15={'count':0x0,'rows':[]};return db[_0x1b46('0x33')]['findOne']({'where':{'id':_0x344168[_0x1b46('0x47')]['id']}})[_0x1b46('0x16')](handleEntityNotFound(_0xea3fc8,null))[_0x1b46('0x16')](function(_0x4153b6){if(_0x4153b6){_0x202643[_0x1b46('0x3b')]=_[_0x1b46('0x3c')](db['ChatMessage']['rawAttributes']);_0x202643[_0x1b46('0x39')]=_[_0x1b46('0x3c')](_0x344168[_0x1b46('0x39')]);_0x202643[_0x1b46('0x3d')]=_[_0x1b46('0x3f')](_0x202643[_0x1b46('0x3b')],_0x202643[_0x1b46('0x39')]);_0x1810b4[_0x1b46('0x3e')]=_['intersection'](_0x202643[_0x1b46('0x3b')],qs[_0x1b46('0x40')](_0x344168[_0x1b46('0x39')][_0x1b46('0x40')]));_0x1810b4[_0x1b46('0x3e')]=_0x1810b4['attributes'][_0x1b46('0x41')]?_0x1810b4['attributes']:_0x202643[_0x1b46('0x3b')];if(!_0x344168['query'][_0x1b46('0x9a')]('nolimit')){_0x1810b4[_0x1b46('0x23')]=qs['limit'](_0x344168[_0x1b46('0x39')]['limit']);_0x1810b4[_0x1b46('0x22')]=qs[_0x1b46('0x22')](_0x344168['query'][_0x1b46('0x22')]);}_0x1810b4[_0x1b46('0x9c')]=qs[_0x1b46('0x9d')](_0x344168[_0x1b46('0x39')][_0x1b46('0x9d')]);_0x1810b4[_0x1b46('0x9e')]=qs[_0x1b46('0x3d')](_['pick'](_0x344168['query'],_0x202643[_0x1b46('0x3d')]));_0x1810b4['where'][_0x1b46('0xa3')]=_0x4153b6['id'];if(_0x344168[_0x1b46('0x39')][_0x1b46('0xa0')]){_0x1810b4[_0x1b46('0x9e')]=_[_0x1b46('0x2c')](_0x1810b4[_0x1b46('0x9e')],{'$or':_[_0x1b46('0x32')](_0x1810b4[_0x1b46('0x3e')],function(_0x1ae064){var _0xe52915={};_0xe52915[_0x1ae064]={'$like':'%'+_0x344168[_0x1b46('0x39')]['filter']+'%'};return _0xe52915;})});}_0x1810b4['where']['secret']=![];if(_0x344168[_0x1b46('0x39')]['id']){_0x1810b4[_0x1b46('0x9e')]['id']={'$gt':_0x344168[_0x1b46('0x39')]['id']};}_0x1810b4=_[_0x1b46('0x2c')]({},_0x1810b4,_0x344168[_0x1b46('0x44')]);return db[_0x1b46('0x5d')][_0x1b46('0x25')]({'where':_0x1810b4['where']})[_0x1b46('0x16')](function(_0x9e2151){_0x5e7d15[_0x1b46('0x25')]=_0x9e2151;_0x1810b4['include']=[];if(_0x344168[_0x1b46('0x39')][_0x1b46('0xa4')]){_0x1810b4[_0x1b46('0x43')][_0x1b46('0xa5')]({'model':db['User'],'as':_0x1b46('0x86'),'attributes':['id','fullname',_0x1b46('0x87')]});}if(_0x344168[_0x1b46('0x39')]['includeAll']){_0x1810b4[_0x1b46('0x43')]=[{'all':!![]}];}return db[_0x1b46('0x5d')][_0x1b46('0x37')](_0x1810b4);})['then'](function(_0x2478a0){_0x5e7d15[_0x1b46('0xa6')]=_0x2478a0;return _0x5e7d15;});}})[_0x1b46('0x16')](respondWithFilteredResult(_0xea3fc8,_0x1810b4))['catch'](handleError(_0xea3fc8,null));};exports[_0x1b46('0xa7')]=function(_0x18018e,_0x54f025){return db['ChatInteraction'][_0x1b46('0x45')]({'where':{'id':_0x18018e[_0x1b46('0x47')]['id']}})[_0x1b46('0x16')](handleEntityNotFound(_0x54f025,null))[_0x1b46('0x16')](function(_0x1bdeec){if(_0x1bdeec){return _0x1bdeec[_0x1b46('0xa8')](_0x18018e['body']['ids'],_[_0x1b46('0x99')](_0x18018e['body'],[_0x1b46('0x98'),'id'])||{})[_0x1b46('0xa9')](function(){return db[_0x1b46('0xaa')][_0x1b46('0x37')]({'attributes':['id',_0x1b46('0x2b'),_0x1b46('0xab')],'where':{'id':_0x18018e['body']['ids']}});})[_0x1b46('0x16')](function(_0x404f54){socket[_0x1b46('0xac')](_0x1b46('0xad'),{'id':Number(_0x18018e[_0x1b46('0x47')]['id']),'tags':_0x404f54||[]});return{'id':Number(_0x18018e[_0x1b46('0x47')]['id']),'tags':_0x404f54||[]};});}})[_0x1b46('0x16')](respondWithResult(_0x54f025,null))[_0x1b46('0x3a')](handleError(_0x54f025,null));};exports[_0x1b46('0xae')]=function(_0x2248d3,_0x58cf19){return db[_0x1b46('0x33')][_0x1b46('0x45')]({'where':{'id':_0x2248d3['params']['id']}})['then'](handleEntityNotFound(_0x58cf19,null))[_0x1b46('0x16')](function(_0x234792){if(_0x234792){return _0x234792[_0x1b46('0xae')](_0x2248d3[_0x1b46('0x39')][_0x1b46('0x98')]);}})[_0x1b46('0x16')](respondWithStatusCode(_0x58cf19,null))['catch'](handleError(_0x58cf19,null));};exports[_0x1b46('0x75')]=function(_0x3ab633,_0x586cec){var _0x3329a7=moment()['unix']()['toString']();var _0x383039=path[_0x1b46('0x73')](config[_0x1b46('0x77')],'server',_0x1b46('0xaf'),_0x1b46('0xb0'));var _0x2d5276=path['join'](config['root'],_0x1b46('0xb1'),_0x1b46('0xaf'),'attachments');var _0x1ccf08=path[_0x1b46('0x73')](_0x383039,_0x3329a7);var _0x4ce1da=util[_0x1b46('0x78')](_0x1b46('0xb2'),_0x3ab633[_0x1b46('0x47')]['id'],_0x3329a7);var _0x4958b9=path[_0x1b46('0x73')](_0x383039,_0x4ce1da);var _0x2f5c56=[];_0x2f5c56[_0x1b46('0xa5')]({'model':db[_0x1b46('0x86')],'as':_0x1b46('0x86'),'attributes':['id',_0x1b46('0x50')],'raw':!![]});_0x2f5c56[_0x1b46('0xa5')]({'model':db[_0x1b46('0x61')],'as':_0x1b46('0x62'),'attributes':['id','firstName',_0x1b46('0xb3')],'raw':!![]});if(_0x3ab633[_0x1b46('0x39')]['attachments']){_0x2f5c56[_0x1b46('0xa5')]({'model':db[_0x1b46('0x6f')],'as':_0x1b46('0x6f'),'raw':!![]});}var _0x53f9f6=[{'model':db[_0x1b46('0x5d')],'as':_0x1b46('0x7c'),'attributes':['id',_0x1b46('0x2d'),'createdAt','direction',_0x1b46('0xb4'),'read'],'include':_0x2f5c56}];_0x53f9f6['push']({'model':db[_0x1b46('0x7d')],'as':_0x1b46('0xb5'),'attributes':['id',_0x1b46('0x2b')]});_0x53f9f6[_0x1b46('0xa5')]({'model':db[_0x1b46('0x86')],'as':_0x1b46('0xb6'),'attributes':['id','fullname']});return db['ChatInteraction'][_0x1b46('0x45')]({'where':{'id':_0x3ab633['params']['id']},'include':_0x53f9f6})[_0x1b46('0x16')](handleEntityNotFound(_0x586cec,null))[_0x1b46('0x16')](function(_0x3be2b3){if(_0x3be2b3){var _0x2f8efe=_0x3be2b3[_0x1b46('0xb7')]({'plain':!![]});fs['mkdirSync'](_0x1ccf08);var _0x2be572={'channel':'Chat','account':_0x2f8efe[_0x1b46('0xb5')][_0x1b46('0x2b')],'agent':_0x2f8efe[_0x1b46('0xb6')]?_0x2f8efe[_0x1b46('0xb6')]['fullname']:_0x1b46('0xb8'),'createdAt':moment(_0x2f8efe['createdAt'])[_0x1b46('0x78')](_0x1b46('0xa2'))[_0x1b46('0xb9')](),'closedAt':_0x2f8efe['closed']?moment(_0x2f8efe[_0x1b46('0xba')])['format'](_0x1b46('0xa2'))['toString']():'','disposition':_0x2f8efe[_0x1b46('0xbb')],'chatInfo':{'browser':_0x2f8efe[_0x1b46('0xbc')],'os':_0x2f8efe[_0x1b46('0xbd')],'referer':_0x2f8efe[_0x1b46('0xbe')],'customerIp':_0x2f8efe['customerIp'],'customerPort':_0x2f8efe['customerPort']?_0x2f8efe['customerPort']:_0x1b46('0xb8')},'messages':_(_0x2f8efe[_0x1b46('0x7c')])[_0x1b46('0xbf')]()['filter']({'secret':![]})[_0x1b46('0x32')](function(_0x3b1870){if(_0x3b1870[_0x1b46('0x6f')]){var _0x5bf71e=path['join'](_0x2d5276,_0x3b1870['Attachment'][_0x1b46('0x6c')]);if(fs[_0x1b46('0xc0')](_0x5bf71e)){fs[_0x1b46('0xc1')](_0x5bf71e)['pipe'](fs['createWriteStream'](path[_0x1b46('0x73')](_0x1ccf08,_0x3b1870[_0x1b46('0x6f')][_0x1b46('0x6c')])));}}return{'date':moment(_0x3b1870[_0x1b46('0x8a')])[_0x1b46('0x78')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'sender':_0x3b1870['direction']===_0x1b46('0x5c')?_0x3b1870[_0x1b46('0x86')]?_0x3b1870[_0x1b46('0x86')][_0x1b46('0x50')]:_0x1b46('0x85'):_0x3b1870['Contact'][_0x1b46('0xc2')]+(_0x3b1870[_0x1b46('0x62')][_0x1b46('0xb3')]?'\x20'+_0x3b1870[_0x1b46('0x62')]['lastName']:''),'body':_0x3b1870[_0x1b46('0x6f')]?_0x3b1870[_0x1b46('0x6f')][_0x1b46('0x6c')]:_0x3b1870['body'],'direction':_0x3b1870[_0x1b46('0x8c')]===_0x1b46('0x5c')?'A':'C','secret':_0x3b1870['secret'],'read':_0x3b1870[_0x1b46('0xc3')],'attachment':_0x3b1870[_0x1b46('0x6f')]};})['value']()};return ejs[_0x1b46('0xc4')](path[_0x1b46('0x73')](config[_0x1b46('0x77')],_0x1b46('0xb1'),_0x1b46('0xc5'),_0x1b46('0xc6')),{'interaction':_0x2be572})[_0x1b46('0x16')](function(_0x11ef97){var _0x5895b7=path['join'](_0x1ccf08,'transcript-'+_0x2f8efe['id']+'-'+_0x3329a7+_0x1b46('0xc7'));var _0x28d99e={'path':_0x5895b7,'channel':'Chat','interactionId':_0x2f8efe['id']};return pdf['createPdfFromHTML'](_0x11ef97,_0x28d99e);})['then'](function(){return new Promise(function(_0x18684a,_0x17d130){zipdir(_0x1ccf08,{'saveTo':_0x4958b9},function(_0xd89930,_0x44a512){if(_0xd89930)return _0x17d130(_0xd89930);return _0x18684a(_0x44a512);});})[_0x1b46('0x16')](function(){return new BPromise(function(_0x2bf5fc,_0x1e62bd){rimraf(_0x1ccf08,function(_0x146f1d){if(_0x146f1d)_0x1e62bd(_0x146f1d);return _0x2bf5fc();});});})[_0x1b46('0x16')](function(){return _0x586cec[_0x1b46('0x75')](_0x4958b9,_0x4ce1da,function(_0x54f888){if(_0x54f888){logger[_0x1b46('0x1c')](_0x1b46('0xc8'),_0x54f888);}else{fs[_0x1b46('0xc9')](_0x4958b9);}});});});}else{return _0x586cec[_0x1b46('0x1f')](0xc8);}})[_0x1b46('0x3a')](handleError(_0x586cec,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index 742f0ad..25600be 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 _0x69fb=['events','../../mysqldb','ChatInteraction','ChatMessage','save','update','remove','then','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x69fb,0xcc));var _0xb69f=function(_0x479884,_0x22712d){_0x479884=_0x479884-0x0;var _0x111a81=_0x69fb[_0x479884];return _0x111a81;};'use strict';var EventEmitter=require(_0xb69f('0x0'));var ChatInteraction=require(_0xb69f('0x1'))['db'][_0xb69f('0x2')];var ChatMessage=require(_0xb69f('0x1'))['db'][_0xb69f('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xb69f('0x4'),'afterUpdate':_0xb69f('0x5'),'afterDestroy':_0xb69f('0x6')};function emitEvent(_0x30f38e){return function(_0xe6c140,_0x44adf3,_0x151d96){_0xe6c140['getUsers']({'attributes':['id'],'raw':!![]})[_0xb69f('0x7')](function(_0xcf8c65){_0xe6c140['setDataValue']('Users',_0xcf8c65[_0xb69f('0x8')](function(_0x297f68){return{'id':_0x297f68['id']};}));return ChatMessage[_0xb69f('0x9')]({'where':{'ChatInteractionId':_0xe6c140['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x471a7d){_0xe6c140['setDataValue'](_0xb69f('0xa'),_0x471a7d[_0xb69f('0xb')]);ChatInteractionEvents['emit'](_0x30f38e+':'+_0xe6c140['id'],_0xe6c140);ChatInteractionEvents[_0xb69f('0xc')](_0x30f38e,_0xe6c140);_0x151d96(null);})[_0xb69f('0xd')](_0x151d96(null));};}for(var e in events){if(events[_0xb69f('0xe')](e)){var event=events[e];ChatInteraction[_0xb69f('0xf')](e,emitEvent(event));}}module[_0xb69f('0x10')]=ChatInteractionEvents; \ No newline at end of file +var _0xa460=['../../mysqldb','ChatInteraction','ChatMessage','setMaxListeners','save','remove','getUsers','then','setDataValue','Users','map','findAll','length','emit','hasOwnProperty','hook','exports'];(function(_0x1f5b2c,_0xb26f1b){var _0x57f588=function(_0x16f16f){while(--_0x16f16f){_0x1f5b2c['push'](_0x1f5b2c['shift']());}};_0x57f588(++_0xb26f1b);}(_0xa460,0x77));var _0x0a46=function(_0xff9fa7,_0x5eb1ef){_0xff9fa7=_0xff9fa7-0x0;var _0x29bb2c=_0xa460[_0xff9fa7];return _0x29bb2c;};'use strict';var EventEmitter=require('events');var ChatInteraction=require(_0x0a46('0x0'))['db'][_0x0a46('0x1')];var ChatMessage=require('../../mysqldb')['db'][_0x0a46('0x2')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x0a46('0x3')](0x0);var events={'afterCreate':_0x0a46('0x4'),'afterUpdate':'update','afterDestroy':_0x0a46('0x5')};function emitEvent(_0xfc99c3){return function(_0x4831a6,_0x180d66,_0x28c317){_0x4831a6[_0x0a46('0x6')]({'attributes':['id'],'raw':!![]})[_0x0a46('0x7')](function(_0x21f908){_0x4831a6[_0x0a46('0x8')](_0x0a46('0x9'),_0x21f908[_0x0a46('0xa')](function(_0x278c1c){return{'id':_0x278c1c['id']};}));return ChatMessage[_0x0a46('0xb')]({'where':{'ChatInteractionId':_0x4831a6['id'],'direction':'in','read':![]},'raw':!![]});})[_0x0a46('0x7')](function(_0x651702){_0x4831a6[_0x0a46('0x8')]('unreadMessages',_0x651702[_0x0a46('0xc')]);ChatInteractionEvents[_0x0a46('0xd')](_0xfc99c3+':'+_0x4831a6['id'],_0x4831a6);ChatInteractionEvents[_0x0a46('0xd')](_0xfc99c3,_0x4831a6);_0x28c317(null);})['catch'](_0x28c317(null));};}for(var e in events){if(events[_0x0a46('0xe')](e)){var event=events[e];ChatInteraction[_0x0a46('0xf')](e,emitEvent(event));}}module[_0x0a46('0x10')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index 7d43ae7..23e0dd2 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 _0x0611=['api','moment','request-promise','path','rimraf','./chatInteraction.attributes','exports','ChatInteraction','chat_interactions','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','util'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x0611,0x9f));var _0x1061=function(_0x1da9dd,_0x3c51f6){_0x1da9dd=_0x1da9dd-0x0;var _0x1176f2=_0x0611[_0x1da9dd];return _0x1176f2;};'use strict';var _=require('lodash');var util=require(_0x1061('0x0'));var logger=require('../../config/logger')(_0x1061('0x1'));var moment=require(_0x1061('0x2'));var BPromise=require('bluebird');var rp=require(_0x1061('0x3'));var fs=require('fs');var path=require(_0x1061('0x4'));var rimraf=require(_0x1061('0x5'));var config=require('../../config/environment');var attributes=require(_0x1061('0x6'));module[_0x1061('0x7')]=function(_0x3f64fc,_0x4b6c35){return _0x3f64fc['define'](_0x1061('0x8'),attributes,{'tableName':_0x1061('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xba8dc9,_0x3ec86f,_0x3b3186){if(_0xba8dc9[_0x1061('0xa')]('closed')){_0xba8dc9[_0x1061('0xb')]=moment()[_0x1061('0xc')](_0x1061('0xd'));}_0x3b3186(null,_0xba8dc9);}},'charset':_0x1061('0xe'),'collate':_0x1061('0xf')});}; \ No newline at end of file +var _0x8328=['YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./chatInteraction.attributes','exports','define','ChatInteraction','chat_interactions','closed','closedAt','format'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x8328,0xd4));var _0x8832=function(_0x4821cd,_0x28be42){_0x4821cd=_0x4821cd-0x0;var _0x6c489a=_0x8328[_0x4821cd];return _0x6c489a;};'use strict';var _=require(_0x8832('0x0'));var util=require(_0x8832('0x1'));var logger=require(_0x8832('0x2'))(_0x8832('0x3'));var moment=require(_0x8832('0x4'));var BPromise=require(_0x8832('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8832('0x6'));var rimraf=require('rimraf');var config=require(_0x8832('0x7'));var attributes=require(_0x8832('0x8'));module[_0x8832('0x9')]=function(_0x565fe9,_0x22c498){return _0x565fe9[_0x8832('0xa')](_0x8832('0xb'),attributes,{'tableName':_0x8832('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x9cbd5,_0x3fee55,_0x4aaecd){if(_0x9cbd5['changed'](_0x8832('0xd'))){_0x9cbd5[_0x8832('0xe')]=moment()[_0x8832('0xf')](_0x8832('0x10'));}_0x4aaecd(null,_0x9cbd5);}},'charset':_0x8832('0x11'),'collate':_0x8832('0x12')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index b36f6fa..96af378 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 _0x10ae=['util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','request','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','UpdateChatInteraction','ChatInteraction','update','body','options','raw','where','attributes','then','AddTagsToChatInteraction','addTags','omit','ids','AddTags','stringify','lodash'];(function(_0x36535e,_0x664d76){var _0x33982b=function(_0x22008b){while(--_0x22008b){_0x36535e['push'](_0x36535e['shift']());}};_0x33982b(++_0x664d76);}(_0x10ae,0x137));var _0xe10a=function(_0x3821b5,_0x2c73a7){_0x3821b5=_0x3821b5-0x0;var _0x14352b=_0x10ae[_0x3821b5];return _0x14352b;};'use strict';var _=require(_0xe10a('0x0'));var util=require(_0xe10a('0x1'));var moment=require(_0xe10a('0x2'));var BPromise=require('bluebird');var rs=require(_0xe10a('0x3'));var fs=require('fs');var Redis=require(_0xe10a('0x4'));var db=require(_0xe10a('0x5'))['db'];var utils=require(_0xe10a('0x6'));var logger=require(_0xe10a('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xe10a('0x8'));var client=jayson['client']['http']({'port':0x232a});config[_0xe10a('0x9')]=_[_0xe10a('0xa')](config[_0xe10a('0x9')],{'host':_0xe10a('0xb'),'port':0x18eb});var socket=require(_0xe10a('0xc'))(new Redis(config[_0xe10a('0x9')]));require(_0xe10a('0xd'))['register'](socket);function respondWithRpcPromise(_0x329bd6,_0x19a0a6,_0x585687){return new BPromise(function(_0x3a7ad5,_0x14aad6){return client[_0xe10a('0xe')](_0x329bd6,_0x585687)['then'](function(_0x23f628){logger[_0xe10a('0xf')](_0xe10a('0x10'),_0x19a0a6,_0xe10a('0x11'));logger[_0xe10a('0x12')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x19a0a6,_0xe10a('0x11'),JSON['stringify'](_0x23f628));if(_0x23f628[_0xe10a('0x13')]){if(_0x23f628['error'][_0xe10a('0x14')]===0x1f4){logger[_0xe10a('0x13')]('ChatInteraction,\x20%s,\x20%s',_0x19a0a6,_0x23f628[_0xe10a('0x13')][_0xe10a('0x15')]);return _0x14aad6(_0x23f628[_0xe10a('0x13')][_0xe10a('0x15')]);}logger[_0xe10a('0x13')]('ChatInteraction,\x20%s,\x20%s',_0x19a0a6,_0x23f628[_0xe10a('0x13')][_0xe10a('0x15')]);return _0x3a7ad5(_0x23f628['error']['message']);}else{logger[_0xe10a('0xf')]('ChatInteraction,\x20%s,\x20%s',_0x19a0a6,_0xe10a('0x11'));_0x3a7ad5(_0x23f628[_0xe10a('0x16')]['message']);}})[_0xe10a('0x17')](function(_0x4202d1){logger[_0xe10a('0x13')](_0xe10a('0x10'),_0x19a0a6,_0x4202d1);_0x14aad6(_0x4202d1);});});}exports[_0xe10a('0x18')]=function(_0x597492){var _0x3fb4e5=this;return new Promise(function(_0x36e9f9,_0x2225e7){return db[_0xe10a('0x19')][_0xe10a('0x1a')](_0x597492[_0xe10a('0x1b')],{'raw':_0x597492[_0xe10a('0x1c')]?_0x597492[_0xe10a('0x1c')][_0xe10a('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x597492[_0xe10a('0x1c')]?_0x597492[_0xe10a('0x1c')][_0xe10a('0x1e')]||null:null,'attributes':_0x597492[_0xe10a('0x1c')]?_0x597492[_0xe10a('0x1c')][_0xe10a('0x1f')]||null:null,'limit':_0x597492['options']?_0x597492[_0xe10a('0x1c')]['limit']||null:null})[_0xe10a('0x20')](function(_0x2926f3){logger['info']('UpdateChatInteraction',_0x597492);logger[_0xe10a('0x12')]('UpdateChatInteraction',_0x597492,JSON['stringify'](_0x2926f3));_0x36e9f9(_0x2926f3);})[_0xe10a('0x17')](function(_0x4c203d){logger[_0xe10a('0x13')]('UpdateChatInteraction',_0x4c203d['message'],_0x597492);_0x2225e7(_0x3fb4e5[_0xe10a('0x13')](0x1f4,_0x4c203d[_0xe10a('0x15')]));});});};exports[_0xe10a('0x21')]=function(_0x1a9419){return new Promise(function(_0x1e6b12,_0x2fb73e){return db['ChatInteraction']['find']({'where':_0x1a9419[_0xe10a('0x1c')]?_0x1a9419[_0xe10a('0x1c')][_0xe10a('0x1e')]||null:null})['then'](function(_0x14edd5){if(_0x14edd5){return _0x14edd5[_0xe10a('0x22')](_0x1a9419[_0xe10a('0x1b')]['ids'],_[_0xe10a('0x23')](_0x1a9419['body'],[_0xe10a('0x24'),'id'])||{});}})['spread'](function(_0x328022){logger['info'](_0xe10a('0x25'),_0x1a9419);logger['debug'](_0xe10a('0x25'),_0x1a9419,JSON[_0xe10a('0x26')](_0x328022));_0x1e6b12(_0x328022);})[_0xe10a('0x17')](function(_0x5a6101){logger[_0xe10a('0x13')](_0xe10a('0x25'),_0x5a6101[_0xe10a('0x15')],_0x1a9419);_0x2fb73e(_this['error'](0x1f4,_0x5a6101[_0xe10a('0x15')]));});});}; \ No newline at end of file +var _0xe11f=['jayson/promise','redis','defaults','register','request','then','info','ChatInteraction,\x20%s,\x20%s','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','update','body','options','raw','limit','UpdateChatInteraction','ChatInteraction','find','ids','omit','spread','AddTags','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x53b63f,_0x37af4d){var _0x24aecb=function(_0x2a3a11){while(--_0x2a3a11){_0x53b63f['push'](_0x53b63f['shift']());}};_0x24aecb(++_0x37af4d);}(_0xe11f,0x1b3));var _0xfe11=function(_0x42eab0,_0x2442e0){_0x42eab0=_0x42eab0-0x0;var _0x4c3f19=_0xe11f[_0x42eab0];return _0x4c3f19;};'use strict';var _=require('lodash');var util=require(_0xfe11('0x0'));var moment=require(_0xfe11('0x1'));var BPromise=require(_0xfe11('0x2'));var rs=require(_0xfe11('0x3'));var fs=require('fs');var Redis=require(_0xfe11('0x4'));var db=require(_0xfe11('0x5'))['db'];var utils=require(_0xfe11('0x6'));var logger=require(_0xfe11('0x7'))('rpc');var config=require(_0xfe11('0x8'));var jayson=require(_0xfe11('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0xfe11('0xa')]=_[_0xfe11('0xb')](config[_0xfe11('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./chatInteraction.socket')[_0xfe11('0xc')](socket);function respondWithRpcPromise(_0x1c95c1,_0xa00612,_0x5c576e){return new BPromise(function(_0x3ca0ed,_0x1e06a9){return client[_0xfe11('0xd')](_0x1c95c1,_0x5c576e)[_0xfe11('0xe')](function(_0x4da62d){logger[_0xfe11('0xf')](_0xfe11('0x10'),_0xa00612,'request\x20sent');logger[_0xfe11('0x11')](_0xfe11('0x12'),_0xa00612,_0xfe11('0x13'),JSON[_0xfe11('0x14')](_0x4da62d));if(_0x4da62d[_0xfe11('0x15')]){if(_0x4da62d[_0xfe11('0x15')]['code']===0x1f4){logger[_0xfe11('0x15')](_0xfe11('0x10'),_0xa00612,_0x4da62d[_0xfe11('0x15')][_0xfe11('0x16')]);return _0x1e06a9(_0x4da62d[_0xfe11('0x15')][_0xfe11('0x16')]);}logger['error'](_0xfe11('0x10'),_0xa00612,_0x4da62d[_0xfe11('0x15')][_0xfe11('0x16')]);return _0x3ca0ed(_0x4da62d[_0xfe11('0x15')][_0xfe11('0x16')]);}else{logger['info'](_0xfe11('0x10'),_0xa00612,_0xfe11('0x13'));_0x3ca0ed(_0x4da62d[_0xfe11('0x17')][_0xfe11('0x16')]);}})[_0xfe11('0x18')](function(_0x5ba26b){logger[_0xfe11('0x15')](_0xfe11('0x10'),_0xa00612,_0x5ba26b);_0x1e06a9(_0x5ba26b);});});}exports['UpdateChatInteraction']=function(_0x19aedd){var _0x36e419=this;return new Promise(function(_0x570b8f,_0x4befae){return db['ChatInteraction'][_0xfe11('0x19')](_0x19aedd[_0xfe11('0x1a')],{'raw':_0x19aedd[_0xfe11('0x1b')]?_0x19aedd[_0xfe11('0x1b')][_0xfe11('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x19aedd[_0xfe11('0x1b')]?_0x19aedd[_0xfe11('0x1b')]['where']||null:null,'attributes':_0x19aedd[_0xfe11('0x1b')]?_0x19aedd['options']['attributes']||null:null,'limit':_0x19aedd['options']?_0x19aedd[_0xfe11('0x1b')][_0xfe11('0x1d')]||null:null})[_0xfe11('0xe')](function(_0x413386){logger[_0xfe11('0xf')](_0xfe11('0x1e'),_0x19aedd);logger[_0xfe11('0x11')](_0xfe11('0x1e'),_0x19aedd,JSON['stringify'](_0x413386));_0x570b8f(_0x413386);})['catch'](function(_0x6dc8dd){logger[_0xfe11('0x15')]('UpdateChatInteraction',_0x6dc8dd[_0xfe11('0x16')],_0x19aedd);_0x4befae(_0x36e419[_0xfe11('0x15')](0x1f4,_0x6dc8dd[_0xfe11('0x16')]));});});};exports['AddTagsToChatInteraction']=function(_0x55da59){return new Promise(function(_0x485c6c,_0x4e0412){return db[_0xfe11('0x1f')][_0xfe11('0x20')]({'where':_0x55da59[_0xfe11('0x1b')]?_0x55da59[_0xfe11('0x1b')]['where']||null:null})[_0xfe11('0xe')](function(_0x232f67){if(_0x232f67){return _0x232f67['addTags'](_0x55da59[_0xfe11('0x1a')][_0xfe11('0x21')],_[_0xfe11('0x22')](_0x55da59['body'],['ids','id'])||{});}})[_0xfe11('0x23')](function(_0x2026ee){logger[_0xfe11('0xf')](_0xfe11('0x24'),_0x55da59);logger[_0xfe11('0x11')](_0xfe11('0x24'),_0x55da59,JSON[_0xfe11('0x14')](_0x2026ee));_0x485c6c(_0x2026ee);})[_0xfe11('0x18')](function(_0x324912){logger[_0xfe11('0x15')]('AddTags',_0x324912[_0xfe11('0x16')],_0x55da59);_0x4e0412(_this[_0xfe11('0x15')](0x1f4,_0x324912[_0xfe11('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 6c3df1a..3a5f03e 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 _0xc153=['remove','update','emit','register','chatInteraction:','save'];(function(_0x24c603,_0x5b6156){var _0x42c1f3=function(_0x4612c9){while(--_0x4612c9){_0x24c603['push'](_0x24c603['shift']());}};_0x42c1f3(++_0x5b6156);}(_0xc153,0x137));var _0x3c15=function(_0x559797,_0x416667){_0x559797=_0x559797-0x0;var _0x49a70f=_0xc153[_0x559797];return _0x49a70f;};'use strict';var ChatInteractionEvents=require('./chatInteraction.events');var events=[_0x3c15('0x0'),_0x3c15('0x1'),_0x3c15('0x2')];function createListener(_0x4b59a2,_0x4990f6){return function(_0x273498){_0x4990f6[_0x3c15('0x3')](_0x4b59a2,_0x273498);};}function removeListener(_0x227d61,_0x1dc83e){return function(){ChatInteractionEvents['removeListener'](_0x227d61,_0x1dc83e);};}exports[_0x3c15('0x4')]=function(_0x36eb08){for(var _0x101d4f=0x0,_0x589caa=events['length'];_0x101d4f<_0x589caa;_0x101d4f++){var _0x59b1e3=events[_0x101d4f];var _0x3cf90b=createListener(_0x3c15('0x5')+_0x59b1e3,_0x36eb08);ChatInteractionEvents['on'](_0x59b1e3,_0x3cf90b);}}; \ No newline at end of file +var _0x61b5=['save','remove','removeListener','register','length','chatInteraction:','./chatInteraction.events'];(function(_0x28202a,_0xad945d){var _0x2c9a9a=function(_0x3971bb){while(--_0x3971bb){_0x28202a['push'](_0x28202a['shift']());}};_0x2c9a9a(++_0xad945d);}(_0x61b5,0x1b8));var _0x561b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x61b5[_0x3dd15e];return _0x231fd0;};'use strict';var ChatInteractionEvents=require(_0x561b('0x0'));var events=[_0x561b('0x1'),_0x561b('0x2'),'update'];function createListener(_0x294bb4,_0x20ebb8){return function(_0x3ddd63){_0x20ebb8['emit'](_0x294bb4,_0x3ddd63);};}function removeListener(_0x173b5f,_0x239d99){return function(){ChatInteractionEvents[_0x561b('0x3')](_0x173b5f,_0x239d99);};}exports[_0x561b('0x4')]=function(_0x5f5d3c){for(var _0x15ebe0=0x0,_0x16d028=events[_0x561b('0x5')];_0x15ebe0<_0x16d028;_0x15ebe0++){var _0x307d6a=events[_0x15ebe0];var _0x40e91e=createListener(_0x561b('0x6')+_0x307d6a,_0x5f5d3c);ChatInteractionEvents['on'](_0x307d6a,_0x40e91e);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index d15bc68..a40b707 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 _0xebc8=['/:id/close','close','delete','chatinteraction:destroy','destroy','removeTags','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInteraction.controller','isAuthenticated','index','get','/describe','describe','isChatInteractionAuthorized','show','/:id/attachment_download','attachmentDownload','/:id/messages','getMessages','/:id/my_messages','getMyMessages','/:id/download','download','/:id/vidaoo','diskStorage','join','root','server/files/attachments/','replace','post','file','addMessage','/:id/tags','tracked','chat','put','/:id','update','/:id/custom_update','customUpdate','abandon'];(function(_0x57dc85,_0x3a6d51){var _0x563a2e=function(_0x5713b2){while(--_0x5713b2){_0x57dc85['push'](_0x57dc85['shift']());}};_0x563a2e(++_0x3a6d51);}(_0xebc8,0x9d));var _0x8ebc=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xebc8[_0x5ddb1c];return _0x354adc;};'use strict';var multer=require(_0x8ebc('0x0'));var util=require(_0x8ebc('0x1'));var path=require(_0x8ebc('0x2'));var timeout=require(_0x8ebc('0x3'));var express=require('express');var router=express[_0x8ebc('0x4')]();var fs_extra=require(_0x8ebc('0x5'));var auth=require(_0x8ebc('0x6'));var interaction=require(_0x8ebc('0x7'));var config=require(_0x8ebc('0x8'));var controller=require(_0x8ebc('0x9'));router['get']('/',auth[_0x8ebc('0xa')](),controller[_0x8ebc('0xb')]);router[_0x8ebc('0xc')](_0x8ebc('0xd'),auth['isAuthenticated'](),controller[_0x8ebc('0xe')]);router['get']('/:id',auth[_0x8ebc('0xf')](),controller[_0x8ebc('0x10')]);router[_0x8ebc('0xc')](_0x8ebc('0x11'),auth['isChatInteractionAuthorized'](),controller[_0x8ebc('0x12')]);router['get'](_0x8ebc('0x13'),auth[_0x8ebc('0xa')](),controller[_0x8ebc('0x14')]);router[_0x8ebc('0xc')](_0x8ebc('0x15'),auth[_0x8ebc('0xf')](),controller[_0x8ebc('0x16')]);router[_0x8ebc('0xc')](_0x8ebc('0x17'),auth[_0x8ebc('0xa')](),controller[_0x8ebc('0x18')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x8ebc('0x19'),auth[_0x8ebc('0xa')](),controller['createVidaooSession']);var upload=multer({'storage':multer[_0x8ebc('0x1a')]({'destination':function(_0x2765fd,_0x2efff4,_0x148f8c){_0x148f8c(null,path[_0x8ebc('0x1b')](config[_0x8ebc('0x1c')],_0x8ebc('0x1d')));},'filename':function(_0x17df71,_0x21d05f,_0x7680b6){_0x7680b6(null,util['format']('%s-%s',Date['now'](),_0x21d05f['originalname'][_0x8ebc('0x1e')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x8ebc('0x1f')]('/:id/attachment_upload',upload['single'](_0x8ebc('0x20')),controller['attachmentUpload']);router['post'](_0x8ebc('0x13'),auth[_0x8ebc('0xf')](),controller[_0x8ebc('0x21')]);router['post'](_0x8ebc('0x22'),auth['isAuthenticated'](),interaction[_0x8ebc('0x23')](_0x8ebc('0x24'),'chatinteraction:addtags'),controller['addTags']);router[_0x8ebc('0x25')](_0x8ebc('0x26'),auth[_0x8ebc('0xa')](),interaction[_0x8ebc('0x23')](_0x8ebc('0x24'),'chatinteraction:update'),controller[_0x8ebc('0x27')]);router[_0x8ebc('0x25')](_0x8ebc('0x28'),controller[_0x8ebc('0x29')]);router[_0x8ebc('0x25')]('/:id/abandon',auth[_0x8ebc('0xf')](),controller[_0x8ebc('0x2a')]);router[_0x8ebc('0x25')](_0x8ebc('0x2b'),controller[_0x8ebc('0x2c')]);router[_0x8ebc('0x2d')](_0x8ebc('0x26'),auth['isAuthenticated'](),interaction['tracked'](_0x8ebc('0x24'),_0x8ebc('0x2e')),controller[_0x8ebc('0x2f')]);router['delete'](_0x8ebc('0x22'),auth[_0x8ebc('0xa')](),controller[_0x8ebc('0x30')]);module[_0x8ebc('0x31')]=router; \ No newline at end of file +var _0x3f36=['../../components/interaction/service','../../config/environment','./chatInteraction.controller','get','index','/describe','isAuthenticated','/:id','isChatInteractionAuthorized','show','/:id/attachment_download','attachmentDownload','getMessages','/:id/my_messages','getMyMessages','/:id/download','create','post','/:id/vidaoo','createVidaooSession','diskStorage','root','server/files/attachments/','%s-%s','now','originalname','replace','/:id/attachment_upload','file','attachmentUpload','/:id/messages','chat','chatinteraction:addtags','addTags','put','tracked','chatinteraction:update','update','/:id/custom_update','customUpdate','/:id/abandon','abandon','/:id/close','close','delete','chatinteraction:destroy','destroy','/:id/tags','multer','util','path','express','Router','../../components/auth/service'];(function(_0x133d51,_0x1af5ef){var _0x4e1e18=function(_0x2bbb04){while(--_0x2bbb04){_0x133d51['push'](_0x133d51['shift']());}};_0x4e1e18(++_0x1af5ef);}(_0x3f36,0xd2));var _0x63f3=function(_0x545a3a,_0x3123aa){_0x545a3a=_0x545a3a-0x0;var _0x5a5493=_0x3f36[_0x545a3a];return _0x5a5493;};'use strict';var multer=require(_0x63f3('0x0'));var util=require(_0x63f3('0x1'));var path=require(_0x63f3('0x2'));var timeout=require('connect-timeout');var express=require(_0x63f3('0x3'));var router=express[_0x63f3('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x63f3('0x5'));var interaction=require(_0x63f3('0x6'));var config=require(_0x63f3('0x7'));var controller=require(_0x63f3('0x8'));router[_0x63f3('0x9')]('/',auth['isAuthenticated'](),controller[_0x63f3('0xa')]);router[_0x63f3('0x9')](_0x63f3('0xb'),auth[_0x63f3('0xc')](),controller['describe']);router[_0x63f3('0x9')](_0x63f3('0xd'),auth[_0x63f3('0xe')](),controller[_0x63f3('0xf')]);router[_0x63f3('0x9')](_0x63f3('0x10'),auth['isChatInteractionAuthorized'](),controller[_0x63f3('0x11')]);router[_0x63f3('0x9')]('/:id/messages',auth[_0x63f3('0xc')](),controller[_0x63f3('0x12')]);router[_0x63f3('0x9')](_0x63f3('0x13'),auth['isChatInteractionAuthorized'](),controller[_0x63f3('0x14')]);router['get'](_0x63f3('0x15'),auth[_0x63f3('0xc')](),controller['download']);router['post']('/',auth['isAuthenticated'](),controller[_0x63f3('0x16')]);router[_0x63f3('0x17')](_0x63f3('0x18'),auth[_0x63f3('0xc')](),controller[_0x63f3('0x19')]);var upload=multer({'storage':multer[_0x63f3('0x1a')]({'destination':function(_0x49b60a,_0x2db39a,_0x3b2517){_0x3b2517(null,path['join'](config[_0x63f3('0x1b')],_0x63f3('0x1c')));},'filename':function(_0x45fd7a,_0x446fb0,_0x19e953){_0x19e953(null,util['format'](_0x63f3('0x1d'),Date[_0x63f3('0x1e')](),_0x446fb0[_0x63f3('0x1f')][_0x63f3('0x20')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post'](_0x63f3('0x21'),upload['single'](_0x63f3('0x22')),controller[_0x63f3('0x23')]);router[_0x63f3('0x17')](_0x63f3('0x24'),auth[_0x63f3('0xe')](),controller['addMessage']);router['post']('/:id/tags',auth[_0x63f3('0xc')](),interaction['tracked'](_0x63f3('0x25'),_0x63f3('0x26')),controller[_0x63f3('0x27')]);router[_0x63f3('0x28')](_0x63f3('0xd'),auth[_0x63f3('0xc')](),interaction[_0x63f3('0x29')](_0x63f3('0x25'),_0x63f3('0x2a')),controller[_0x63f3('0x2b')]);router[_0x63f3('0x28')](_0x63f3('0x2c'),controller[_0x63f3('0x2d')]);router[_0x63f3('0x28')](_0x63f3('0x2e'),auth['isChatInteractionAuthorized'](),controller[_0x63f3('0x2f')]);router[_0x63f3('0x28')](_0x63f3('0x30'),controller[_0x63f3('0x31')]);router[_0x63f3('0x32')]('/:id',auth[_0x63f3('0xc')](),interaction[_0x63f3('0x29')](_0x63f3('0x25'),_0x63f3('0x33')),controller[_0x63f3('0x34')]);router['delete'](_0x63f3('0x35'),auth['isAuthenticated'](),controller['removeTags']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index bd590cb..4cd1b23 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 _0x737c=['BOOLEAN','INTEGER','sequelize','exports'];(function(_0x323006,_0x5b327b){var _0x460838=function(_0x2637bb){while(--_0x2637bb){_0x323006['push'](_0x323006['shift']());}};_0x460838(++_0x5b327b);}(_0x737c,0xa6));var _0xc737=function(_0x3fd9ce,_0x4b1fbe){_0x3fd9ce=_0x3fd9ce-0x0;var _0x3618d9=_0x737c[_0x3fd9ce];return _0x3618d9;};'use strict';var Sequelize=require(_0xc737('0x0'));module[_0xc737('0x1')]={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xc737('0x2')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0xc737('0x3')]}}; \ No newline at end of file +var _0x02f5=['INTEGER','exports','TEXT','medium','BOOLEAN'];(function(_0x40b0f,_0x3783e5){var _0x39a923=function(_0x1464b7){while(--_0x1464b7){_0x40b0f['push'](_0x40b0f['shift']());}};_0x39a923(++_0x3783e5);}(_0x02f5,0x169));var _0x502f=function(_0x3ea913,_0x255df2){_0x3ea913=_0x3ea913-0x0;var _0x2b4f28=_0x02f5[_0x3ea913];return _0x2b4f28;};'use strict';var Sequelize=require('sequelize');module[_0x502f('0x0')]={'body':{'type':Sequelize[_0x502f('0x1')](_0x502f('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x502f('0x3')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x502f('0x4')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index d671ea3..26b31db 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 _0x7ee9=['destroy','describe','messages','lastMessageAt','lastMessage','getUsers','User','findAll','admin','user','fullname','role','userpic','internal','lastLoginAt','sort','VoiceQueue','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','userProfileId','UserProfileResource','isEmpty','agent','resourceId','push','createdAt','FromId','ToId','read','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','fs-extra','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','register','status','end','json','offset','undefined','limit','count','set','apply','reject','save','then','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','where','filter','merge','options','includeAll','ChatInternalMessage','rows','catch','show','params','create','body','find'];(function(_0xb2fb09,_0x23241a){var _0x49b96c=function(_0x385f2a){while(--_0x385f2a){_0xb2fb09['push'](_0xb2fb09['shift']());}};_0x49b96c(++_0x23241a);}(_0x7ee9,0x157));var _0x97ee=function(_0x2ad19a,_0xb1e06a){_0x2ad19a=_0x2ad19a-0x0;var _0x4e4e65=_0x7ee9[_0x2ad19a];return _0x4e4e65;};'use strict';var emlformat=require(_0x97ee('0x0'));var rimraf=require(_0x97ee('0x1'));var zipdir=require(_0x97ee('0x2'));var jsonpatch=require(_0x97ee('0x3'));var rp=require(_0x97ee('0x4'));var moment=require('moment');var BPromise=require(_0x97ee('0x5'));var Mustache=require('mustache');var util=require(_0x97ee('0x6'));var path=require(_0x97ee('0x7'));var sox=require(_0x97ee('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x97ee('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x97ee('0xa'));var jsforce=require(_0x97ee('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x97ee('0xc'));var querystring=require(_0x97ee('0xd'));var Papa=require(_0x97ee('0xe'));var Redis=require('ioredis');var authService=require(_0x97ee('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x97ee('0x10'));var hardwareService=require(_0x97ee('0x11'));var logger=require(_0x97ee('0x12'))(_0x97ee('0x13'));var utils=require('../../config/utils');var config=require(_0x97ee('0x14'));var licenseUtil=require(_0x97ee('0x15'));var db=require(_0x97ee('0x16'))['db'];config[_0x97ee('0x17')]=_['defaults'](config[_0x97ee('0x17')],{'host':_0x97ee('0x18'),'port':0x18eb});var socket=require(_0x97ee('0x19'))(new Redis(config[_0x97ee('0x17')]));require('./chatInternalMessage.socket')[_0x97ee('0x1a')](socket);function respondWithStatusCode(_0x59d42b,_0x48305e){_0x48305e=_0x48305e||0xcc;return function(_0x237890){if(_0x237890){return _0x59d42b['sendStatus'](_0x48305e);}return _0x59d42b[_0x97ee('0x1b')](_0x48305e)[_0x97ee('0x1c')]();};}function respondWithResult(_0x4c0263,_0x4783db){_0x4783db=_0x4783db||0xc8;return function(_0x30fa3e){if(_0x30fa3e){return _0x4c0263[_0x97ee('0x1b')](_0x4783db)[_0x97ee('0x1d')](_0x30fa3e);}};}function respondWithFilteredResult(_0x970b1,_0x53ae9a){return function(_0x52681a){if(_0x52681a){var _0x4da0eb=typeof _0x53ae9a[_0x97ee('0x1e')]===_0x97ee('0x1f')&&typeof _0x53ae9a[_0x97ee('0x20')]==='undefined';var _0x1fbaae=_0x52681a[_0x97ee('0x21')];var _0x2dd888=_0x4da0eb?0x0:_0x53ae9a['offset'];var _0x37544c=_0x4da0eb?_0x52681a['count']:_0x53ae9a[_0x97ee('0x1e')]+_0x53ae9a[_0x97ee('0x20')];var _0x3b673b;if(_0x37544c>=_0x1fbaae){_0x37544c=_0x1fbaae;_0x3b673b=0xc8;}else{_0x3b673b=0xce;}_0x970b1[_0x97ee('0x1b')](_0x3b673b);return _0x970b1[_0x97ee('0x22')]('Content-Range',_0x2dd888+'-'+_0x37544c+'/'+_0x1fbaae)[_0x97ee('0x1d')](_0x52681a);}return null;};}function patchUpdates(_0x3e88ee){return function(_0x5c6bab){try{jsonpatch[_0x97ee('0x23')](_0x5c6bab,_0x3e88ee,!![]);}catch(_0x4d4ab5){return BPromise[_0x97ee('0x24')](_0x4d4ab5);}return _0x5c6bab[_0x97ee('0x25')]();};}function saveUpdates(_0x578fcc,_0x37c5f0){return function(_0x424e25){if(_0x424e25){return _0x424e25['update'](_0x578fcc)['then'](function(_0x3112e8){return _0x3112e8;});}return null;};}function removeEntity(_0x21b990,_0x9a4897){return function(_0x59f63b){if(_0x59f63b){return _0x59f63b['destroy']()[_0x97ee('0x26')](function(){_0x21b990[_0x97ee('0x1b')](0xcc)[_0x97ee('0x1c')]();});}};}function handleEntityNotFound(_0x34a442,_0x424889){return function(_0x258fa6){if(!_0x258fa6){_0x34a442[_0x97ee('0x27')](0x194);}return _0x258fa6;};}function handleError(_0x15b489,_0x324bec){_0x324bec=_0x324bec||0x1f4;return function(_0x132ae7){logger[_0x97ee('0x28')](_0x132ae7[_0x97ee('0x29')]);if(_0x132ae7[_0x97ee('0x2a')]){delete _0x132ae7[_0x97ee('0x2a')];}_0x15b489[_0x97ee('0x1b')](_0x324bec)[_0x97ee('0x2b')](_0x132ae7);};}exports[_0x97ee('0x2c')]=function(_0xc9270,_0x57d569){var _0x168d1b={},_0x3f5da6={},_0x406255={'count':0x0,'rows':[]};var _0x290700=_[_0x97ee('0x2d')](db['ChatInternalMessage'][_0x97ee('0x2e')],function(_0x3072f0){return{'name':_0x3072f0[_0x97ee('0x2f')],'type':_0x3072f0[_0x97ee('0x30')][_0x97ee('0x31')]};});_0x3f5da6[_0x97ee('0x32')]=_[_0x97ee('0x2d')](_0x290700,'name');_0x3f5da6[_0x97ee('0x33')]=_[_0x97ee('0x34')](_0xc9270['query']);_0x3f5da6[_0x97ee('0x35')]=_[_0x97ee('0x36')](_0x3f5da6[_0x97ee('0x32')],_0x3f5da6[_0x97ee('0x33')]);_0x168d1b[_0x97ee('0x37')]=_[_0x97ee('0x36')](_0x3f5da6[_0x97ee('0x32')],qs[_0x97ee('0x38')](_0xc9270[_0x97ee('0x33')][_0x97ee('0x38')]));_0x168d1b['attributes']=_0x168d1b[_0x97ee('0x37')][_0x97ee('0x39')]?_0x168d1b[_0x97ee('0x37')]:_0x3f5da6[_0x97ee('0x32')];if(!_0xc9270[_0x97ee('0x33')][_0x97ee('0x3a')]('nolimit')){_0x168d1b[_0x97ee('0x20')]=qs['limit'](_0xc9270[_0x97ee('0x33')][_0x97ee('0x20')]);_0x168d1b['offset']=qs[_0x97ee('0x1e')](_0xc9270['query']['offset']);}_0x168d1b[_0x97ee('0x3b')]=qs['sort'](_0xc9270[_0x97ee('0x33')]['sort']);_0x168d1b[_0x97ee('0x3c')]=qs[_0x97ee('0x35')](_['pick'](_0xc9270[_0x97ee('0x33')],_0x3f5da6[_0x97ee('0x35')]),_0x290700);if(_0xc9270[_0x97ee('0x33')][_0x97ee('0x3d')]){_0x168d1b['where']=_[_0x97ee('0x3e')](_0x168d1b[_0x97ee('0x3c')],{'$or':_[_0x97ee('0x2d')](_0x290700,function(_0x3a7f1a){if(_0x3a7f1a[_0x97ee('0x30')]!=='VIRTUAL'){var _0xf25710={};_0xf25710[_0x3a7f1a['name']]={'$like':'%'+_0xc9270[_0x97ee('0x33')][_0x97ee('0x3d')]+'%'};return _0xf25710;}})});}_0x168d1b=_[_0x97ee('0x3e')]({},_0x168d1b,_0xc9270[_0x97ee('0x3f')]);var _0x2351dc={'where':_0x168d1b[_0x97ee('0x3c')]};return db['ChatInternalMessage'][_0x97ee('0x21')](_0x2351dc)['then'](function(_0x4df13a){_0x406255[_0x97ee('0x21')]=_0x4df13a;if(_0xc9270[_0x97ee('0x33')][_0x97ee('0x40')]){_0x168d1b['include']=[{'all':!![]}];}return db[_0x97ee('0x41')]['findAll'](_0x168d1b);})[_0x97ee('0x26')](function(_0x1aa460){_0x406255[_0x97ee('0x42')]=_0x1aa460;return _0x406255;})['then'](respondWithFilteredResult(_0x57d569,_0x168d1b))[_0x97ee('0x43')](handleError(_0x57d569,null));};exports[_0x97ee('0x44')]=function(_0x582e0b,_0x2e29e6){var _0x758b66={'raw':!![],'where':{'id':_0x582e0b[_0x97ee('0x45')]['id']}},_0x264edb={};_0x264edb[_0x97ee('0x32')]=_['keys'](db[_0x97ee('0x41')]['rawAttributes']);_0x264edb[_0x97ee('0x33')]=_[_0x97ee('0x34')](_0x582e0b['query']);_0x264edb[_0x97ee('0x35')]=_[_0x97ee('0x36')](_0x264edb[_0x97ee('0x32')],_0x264edb[_0x97ee('0x33')]);_0x758b66[_0x97ee('0x37')]=_['intersection'](_0x264edb[_0x97ee('0x32')],qs['fields'](_0x582e0b['query'][_0x97ee('0x38')]));_0x758b66[_0x97ee('0x37')]=_0x758b66[_0x97ee('0x37')][_0x97ee('0x39')]?_0x758b66['attributes']:_0x264edb[_0x97ee('0x32')];if(_0x582e0b['query']['includeAll']){_0x758b66['include']=[{'all':!![]}];}_0x758b66=_[_0x97ee('0x3e')]({},_0x758b66,_0x582e0b[_0x97ee('0x3f')]);return db[_0x97ee('0x41')]['find'](_0x758b66)[_0x97ee('0x26')](handleEntityNotFound(_0x2e29e6,null))[_0x97ee('0x26')](respondWithResult(_0x2e29e6,null))[_0x97ee('0x43')](handleError(_0x2e29e6,null));};exports[_0x97ee('0x46')]=function(_0x3ed365,_0x3d6d08){return db[_0x97ee('0x41')][_0x97ee('0x46')](_0x3ed365[_0x97ee('0x47')],{})['then'](respondWithResult(_0x3d6d08,0xc9))[_0x97ee('0x43')](handleError(_0x3d6d08,null));};exports['update']=function(_0x2ea009,_0x5493da){if(_0x2ea009[_0x97ee('0x47')]['id']){delete _0x2ea009[_0x97ee('0x47')]['id'];}return db[_0x97ee('0x41')][_0x97ee('0x48')]({'where':{'id':_0x2ea009[_0x97ee('0x45')]['id']}})[_0x97ee('0x26')](handleEntityNotFound(_0x5493da,null))[_0x97ee('0x26')](saveUpdates(_0x2ea009[_0x97ee('0x47')],null))[_0x97ee('0x26')](respondWithResult(_0x5493da,null))['catch'](handleError(_0x5493da,null));};exports[_0x97ee('0x49')]=function(_0x4503b7,_0x3c292a){return db[_0x97ee('0x41')][_0x97ee('0x48')]({'where':{'id':_0x4503b7[_0x97ee('0x45')]['id']}})[_0x97ee('0x26')](handleEntityNotFound(_0x3c292a,null))[_0x97ee('0x26')](removeEntity(_0x3c292a,null))[_0x97ee('0x43')](handleError(_0x3c292a,null));};exports[_0x97ee('0x4a')]=function(_0x7def1d,_0x5ba070){return db[_0x97ee('0x41')][_0x97ee('0x4a')]()[_0x97ee('0x26')](respondWithResult(_0x5ba070,null))['catch'](handleError(_0x5ba070,null));};function wrapUser(_0x2b477c){return function(_0x4d1664){var _0x26a562=_0x2b477c['get']({'plain':!![]});_0x26a562[_0x97ee('0x4b')]=[];if(_0x4d1664){_0x26a562[_0x97ee('0x4c')]=_0x4d1664['createdAt'];_0x26a562[_0x97ee('0x4d')]=_0x4d1664;}else{_0x26a562[_0x97ee('0x4c')]=moment(0x0)['format']('YYYY-MM-DD\x20HH:mm:ss');_0x26a562[_0x97ee('0x4d')]={};}return _0x26a562;};}exports[_0x97ee('0x4e')]=function(_0x1ac72b,_0x2779ac,_0x10b0d8){var _0x4bbef3=[];return db[_0x97ee('0x4f')][_0x97ee('0x50')]({'where':{'role':['agent',_0x97ee('0x51'),_0x97ee('0x52')]},'attributes':['id',_0x97ee('0x53'),_0x97ee('0x2a'),_0x97ee('0x54'),_0x97ee('0x55'),_0x97ee('0x56'),'online',_0x97ee('0x57'),'allowmessenger','showWebBar'],'order':qs[_0x97ee('0x58')]('-online'),'include':[{'model':db[_0x97ee('0x59')],'as':'VoiceQueues','attributes':['id',_0x97ee('0x2a'),_0x97ee('0x30')],'through':{'attributes':[]}}]})['then'](function(_0xc9a0df){if(_0xc9a0df){var _0x14438d=_0x1ac72b['user'][_0x97ee('0x5a')]({'plain':!![]});if(!_0x14438d)throw new Error(_0x97ee('0x5b'));if(_0x14438d['role']===_0x97ee('0x52')){return db[_0x97ee('0x5c')][_0x97ee('0x48')]({'where':{'name':_0x97ee('0x5d'),'userProfileId':_0x14438d[_0x97ee('0x5e')]},'raw':!![]})['then'](function(_0x445e63){if(_0x445e63){if(_0x445e63['autoAssociation']===0x0){return db[_0x97ee('0x5f')][_0x97ee('0x50')]({'where':{'sectionId':_0x445e63['id']},'raw':!![]})[_0x97ee('0x26')](function(_0x995a93){var _0x5374d6=[];if(_[_0x97ee('0x60')](_0x995a93)){_0x5374d6=_[_0x97ee('0x3d')](_0xc9a0df,function(_0x19e0d6){if(_0x19e0d6[_0x97ee('0x54')]!==_0x97ee('0x61')){return _0x19e0d6;}});return _0x5374d6;}else{for(var _0x395c7e=0x0;_0x395c7e<_0xc9a0df[_0x97ee('0x39')];_0x395c7e++){var _0x46a251=_0xc9a0df[_0x395c7e];if(_0x46a251[_0x97ee('0x54')]===_0x97ee('0x61')){var _0xc4c18f=_['find'](_0x995a93,function(_0x2feda8){return _0x2feda8[_0x97ee('0x62')]===_0x46a251['id'];});if(_0xc4c18f)_0x5374d6[_0x97ee('0x63')](_0x46a251);}else{_0x5374d6[_0x97ee('0x63')](_0x46a251);}}return _0x5374d6;}});}else{return _0xc9a0df;}}else{var _0x58988d=_['filter'](_0xc9a0df,function(_0x5d7282){if(_0x5d7282[_0x97ee('0x54')]!==_0x97ee('0x61')){return _0x5d7282;}});return _0x58988d;}});}else{return _0xc9a0df;}}})[_0x97ee('0x26')](function(_0x31944c){var _0x2a1e13=[];if(_0x31944c){_0x4bbef3=_0x31944c;for(var _0x380fa6=0x0;_0x380fa6<_0x31944c[_0x97ee('0x39')];_0x380fa6+=0x1){_0x4bbef3[_0x380fa6][_0x97ee('0x4b')]=[];_0x2a1e13[_0x97ee('0x63')](db[_0x97ee('0x41')][_0x97ee('0x48')]({'where':{'FromId':[_0x1ac72b[_0x97ee('0x52')]['id'],_0x31944c[_0x380fa6]['id']],'ToId':[_0x1ac72b[_0x97ee('0x52')]['id'],_0x31944c[_0x380fa6]['id']],'ChatGroupId':null},'attributes':['id',_0x97ee('0x64'),_0x97ee('0x65'),_0x97ee('0x66'),_0x97ee('0x67'),_0x97ee('0x47')],'order':qs['sort']('-createdAt'),'limit':0x1,'offset':0x0,'raw':!![]})['then'](wrapUser(_0x31944c[_0x380fa6])));}return BPromise['all'](_0x2a1e13);}return[];})[_0x97ee('0x26')](function(_0x5a7a26){return{'rows':_0x5a7a26,'count':_0x5a7a26['length']};})[_0x97ee('0x26')](respondWithResult(_0x2779ac,null))[_0x97ee('0x43')](handleError(_0x2779ac,null));}; \ No newline at end of file +var _0xb027=['FromId','ToId','read','-createdAt','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','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/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','ChatInternalMessage','rawAttributes','fieldName','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','VIRTUAL','options','includeAll','findAll','rows','show','include','merge','find','create','body','catch','params','describe','get','messages','createdAt','lastMessage','lastMessageAt','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','agent','user','fullname','userpic','internal','online','allowmessenger','-online','VoiceQueue','VoiceQueues','type','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','resourceId','push'];(function(_0x417029,_0x37059f){var _0x3ca35e=function(_0x2d8180){while(--_0x2d8180){_0x417029['push'](_0x417029['shift']());}};_0x3ca35e(++_0x37059f);}(_0xb027,0x7a));var _0x7b02=function(_0x3bb859,_0x589816){_0x3bb859=_0x3bb859-0x0;var _0x3bf534=_0xb027[_0x3bb859];return _0x3bf534;};'use strict';var emlformat=require(_0x7b02('0x0'));var rimraf=require(_0x7b02('0x1'));var zipdir=require(_0x7b02('0x2'));var jsonpatch=require(_0x7b02('0x3'));var rp=require(_0x7b02('0x4'));var moment=require(_0x7b02('0x5'));var BPromise=require(_0x7b02('0x6'));var Mustache=require(_0x7b02('0x7'));var util=require(_0x7b02('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x7b02('0x9'));var ejs=require(_0x7b02('0xa'));var fs=require('fs');var fs_extra=require(_0x7b02('0xb'));var _=require(_0x7b02('0xc'));var squel=require(_0x7b02('0xd'));var crypto=require(_0x7b02('0xe'));var jsforce=require(_0x7b02('0xf'));var deskjs=require(_0x7b02('0x10'));var toCsv=require('to-csv');var querystring=require(_0x7b02('0x11'));var Papa=require(_0x7b02('0x12'));var Redis=require(_0x7b02('0x13'));var authService=require(_0x7b02('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x7b02('0x15'));var hardwareService=require(_0x7b02('0x16'));var logger=require('../../config/logger')(_0x7b02('0x17'));var utils=require(_0x7b02('0x18'));var config=require(_0x7b02('0x19'));var licenseUtil=require(_0x7b02('0x1a'));var db=require(_0x7b02('0x1b'))['db'];config[_0x7b02('0x1c')]=_[_0x7b02('0x1d')](config[_0x7b02('0x1c')],{'host':_0x7b02('0x1e'),'port':0x18eb});var socket=require(_0x7b02('0x1f'))(new Redis(config[_0x7b02('0x1c')]));require(_0x7b02('0x20'))[_0x7b02('0x21')](socket);function respondWithStatusCode(_0x3e1107,_0x3e58d1){_0x3e58d1=_0x3e58d1||0xcc;return function(_0x24101f){if(_0x24101f){return _0x3e1107[_0x7b02('0x22')](_0x3e58d1);}return _0x3e1107[_0x7b02('0x23')](_0x3e58d1)['end']();};}function respondWithResult(_0xcd779,_0x559f6a){_0x559f6a=_0x559f6a||0xc8;return function(_0x279055){if(_0x279055){return _0xcd779[_0x7b02('0x23')](_0x559f6a)['json'](_0x279055);}};}function respondWithFilteredResult(_0x6df65c,_0x2e15de){return function(_0x29a963){if(_0x29a963){var _0x22ac67=typeof _0x2e15de[_0x7b02('0x24')]===_0x7b02('0x25')&&typeof _0x2e15de[_0x7b02('0x26')]===_0x7b02('0x25');var _0x497528=_0x29a963[_0x7b02('0x27')];var _0x2c3979=_0x22ac67?0x0:_0x2e15de[_0x7b02('0x24')];var _0x2c3f8b=_0x22ac67?_0x29a963['count']:_0x2e15de['offset']+_0x2e15de[_0x7b02('0x26')];var _0x387c36;if(_0x2c3f8b>=_0x497528){_0x2c3f8b=_0x497528;_0x387c36=0xc8;}else{_0x387c36=0xce;}_0x6df65c[_0x7b02('0x23')](_0x387c36);return _0x6df65c[_0x7b02('0x28')](_0x7b02('0x29'),_0x2c3979+'-'+_0x2c3f8b+'/'+_0x497528)[_0x7b02('0x2a')](_0x29a963);}return null;};}function patchUpdates(_0x36e4bf){return function(_0x5ecc71){try{jsonpatch[_0x7b02('0x2b')](_0x5ecc71,_0x36e4bf,!![]);}catch(_0x156389){return BPromise[_0x7b02('0x2c')](_0x156389);}return _0x5ecc71[_0x7b02('0x2d')]();};}function saveUpdates(_0x5d2c4f,_0x3601dd){return function(_0x16dc31){if(_0x16dc31){return _0x16dc31[_0x7b02('0x2e')](_0x5d2c4f)['then'](function(_0x9797ea){return _0x9797ea;});}return null;};}function removeEntity(_0x307527,_0x2fccdf){return function(_0x577cfb){if(_0x577cfb){return _0x577cfb[_0x7b02('0x2f')]()[_0x7b02('0x30')](function(){_0x307527[_0x7b02('0x23')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2c0875,_0x5b68c1){return function(_0x4ca8aa){if(!_0x4ca8aa){_0x2c0875[_0x7b02('0x22')](0x194);}return _0x4ca8aa;};}function handleError(_0x28754a,_0x5b8b00){_0x5b8b00=_0x5b8b00||0x1f4;return function(_0x4fab79){logger[_0x7b02('0x31')](_0x4fab79[_0x7b02('0x32')]);if(_0x4fab79['name']){delete _0x4fab79[_0x7b02('0x33')];}_0x28754a[_0x7b02('0x23')](_0x5b8b00)[_0x7b02('0x34')](_0x4fab79);};}exports[_0x7b02('0x35')]=function(_0x5d0e46,_0x2f9e90){var _0x5d2475={},_0x35477c={},_0x204457={'count':0x0,'rows':[]};var _0x53b533=_[_0x7b02('0x36')](db[_0x7b02('0x37')][_0x7b02('0x38')],function(_0x400b92){return{'name':_0x400b92[_0x7b02('0x39')],'type':_0x400b92['type'][_0x7b02('0x3a')]};});_0x35477c[_0x7b02('0x3b')]=_[_0x7b02('0x36')](_0x53b533,_0x7b02('0x33'));_0x35477c['query']=_[_0x7b02('0x3c')](_0x5d0e46['query']);_0x35477c[_0x7b02('0x3d')]=_[_0x7b02('0x3e')](_0x35477c[_0x7b02('0x3b')],_0x35477c[_0x7b02('0x3f')]);_0x5d2475[_0x7b02('0x40')]=_['intersection'](_0x35477c[_0x7b02('0x3b')],qs[_0x7b02('0x41')](_0x5d0e46[_0x7b02('0x3f')][_0x7b02('0x41')]));_0x5d2475[_0x7b02('0x40')]=_0x5d2475[_0x7b02('0x40')][_0x7b02('0x42')]?_0x5d2475[_0x7b02('0x40')]:_0x35477c[_0x7b02('0x3b')];if(!_0x5d0e46[_0x7b02('0x3f')][_0x7b02('0x43')]('nolimit')){_0x5d2475[_0x7b02('0x26')]=qs[_0x7b02('0x26')](_0x5d0e46[_0x7b02('0x3f')][_0x7b02('0x26')]);_0x5d2475[_0x7b02('0x24')]=qs[_0x7b02('0x24')](_0x5d0e46['query']['offset']);}_0x5d2475[_0x7b02('0x44')]=qs[_0x7b02('0x45')](_0x5d0e46['query']['sort']);_0x5d2475['where']=qs[_0x7b02('0x3d')](_[_0x7b02('0x46')](_0x5d0e46[_0x7b02('0x3f')],_0x35477c[_0x7b02('0x3d')]),_0x53b533);if(_0x5d0e46[_0x7b02('0x3f')][_0x7b02('0x47')]){_0x5d2475['where']=_['merge'](_0x5d2475[_0x7b02('0x48')],{'$or':_[_0x7b02('0x36')](_0x53b533,function(_0x16652d){if(_0x16652d['type']!==_0x7b02('0x49')){var _0xbd3645={};_0xbd3645[_0x16652d['name']]={'$like':'%'+_0x5d0e46[_0x7b02('0x3f')][_0x7b02('0x47')]+'%'};return _0xbd3645;}})});}_0x5d2475=_['merge']({},_0x5d2475,_0x5d0e46[_0x7b02('0x4a')]);var _0x4d2c89={'where':_0x5d2475[_0x7b02('0x48')]};return db[_0x7b02('0x37')]['count'](_0x4d2c89)['then'](function(_0x30ce86){_0x204457[_0x7b02('0x27')]=_0x30ce86;if(_0x5d0e46[_0x7b02('0x3f')][_0x7b02('0x4b')]){_0x5d2475['include']=[{'all':!![]}];}return db[_0x7b02('0x37')][_0x7b02('0x4c')](_0x5d2475);})[_0x7b02('0x30')](function(_0x41f458){_0x204457[_0x7b02('0x4d')]=_0x41f458;return _0x204457;})[_0x7b02('0x30')](respondWithFilteredResult(_0x2f9e90,_0x5d2475))['catch'](handleError(_0x2f9e90,null));};exports[_0x7b02('0x4e')]=function(_0xf0d6c7,_0x3b6616){var _0x372625={'raw':!![],'where':{'id':_0xf0d6c7['params']['id']}},_0x44fdea={};_0x44fdea['model']=_[_0x7b02('0x3c')](db['ChatInternalMessage'][_0x7b02('0x38')]);_0x44fdea[_0x7b02('0x3f')]=_[_0x7b02('0x3c')](_0xf0d6c7[_0x7b02('0x3f')]);_0x44fdea[_0x7b02('0x3d')]=_[_0x7b02('0x3e')](_0x44fdea['model'],_0x44fdea[_0x7b02('0x3f')]);_0x372625['attributes']=_[_0x7b02('0x3e')](_0x44fdea['model'],qs[_0x7b02('0x41')](_0xf0d6c7[_0x7b02('0x3f')]['fields']));_0x372625[_0x7b02('0x40')]=_0x372625[_0x7b02('0x40')]['length']?_0x372625[_0x7b02('0x40')]:_0x44fdea[_0x7b02('0x3b')];if(_0xf0d6c7['query'][_0x7b02('0x4b')]){_0x372625[_0x7b02('0x4f')]=[{'all':!![]}];}_0x372625=_[_0x7b02('0x50')]({},_0x372625,_0xf0d6c7['options']);return db['ChatInternalMessage'][_0x7b02('0x51')](_0x372625)[_0x7b02('0x30')](handleEntityNotFound(_0x3b6616,null))['then'](respondWithResult(_0x3b6616,null))['catch'](handleError(_0x3b6616,null));};exports[_0x7b02('0x52')]=function(_0xb5dc49,_0x5a8d23){return db['ChatInternalMessage'][_0x7b02('0x52')](_0xb5dc49[_0x7b02('0x53')],{})[_0x7b02('0x30')](respondWithResult(_0x5a8d23,0xc9))[_0x7b02('0x54')](handleError(_0x5a8d23,null));};exports[_0x7b02('0x2e')]=function(_0x1f5f07,_0x323ab3){if(_0x1f5f07[_0x7b02('0x53')]['id']){delete _0x1f5f07['body']['id'];}return db['ChatInternalMessage']['find']({'where':{'id':_0x1f5f07[_0x7b02('0x55')]['id']}})[_0x7b02('0x30')](handleEntityNotFound(_0x323ab3,null))[_0x7b02('0x30')](saveUpdates(_0x1f5f07['body'],null))['then'](respondWithResult(_0x323ab3,null))[_0x7b02('0x54')](handleError(_0x323ab3,null));};exports[_0x7b02('0x2f')]=function(_0x324030,_0x582e65){return db['ChatInternalMessage'][_0x7b02('0x51')]({'where':{'id':_0x324030[_0x7b02('0x55')]['id']}})[_0x7b02('0x30')](handleEntityNotFound(_0x582e65,null))[_0x7b02('0x30')](removeEntity(_0x582e65,null))[_0x7b02('0x54')](handleError(_0x582e65,null));};exports[_0x7b02('0x56')]=function(_0x37a7ae,_0x41f182){return db[_0x7b02('0x37')]['describe']()[_0x7b02('0x30')](respondWithResult(_0x41f182,null))['catch'](handleError(_0x41f182,null));};function wrapUser(_0x1e9826){return function(_0x5010b2){var _0xf8d94f=_0x1e9826[_0x7b02('0x57')]({'plain':!![]});_0xf8d94f[_0x7b02('0x58')]=[];if(_0x5010b2){_0xf8d94f['lastMessageAt']=_0x5010b2[_0x7b02('0x59')];_0xf8d94f[_0x7b02('0x5a')]=_0x5010b2;}else{_0xf8d94f[_0x7b02('0x5b')]=moment(0x0)['format'](_0x7b02('0x5c'));_0xf8d94f[_0x7b02('0x5a')]={};}return _0xf8d94f;};}exports[_0x7b02('0x5d')]=function(_0x338054,_0x533ab1,_0x4d6e9e){var _0x2638ed=[];return db[_0x7b02('0x5e')][_0x7b02('0x4c')]({'where':{'role':[_0x7b02('0x5f'),'admin',_0x7b02('0x60')]},'attributes':['id',_0x7b02('0x61'),_0x7b02('0x33'),'role',_0x7b02('0x62'),_0x7b02('0x63'),_0x7b02('0x64'),'lastLoginAt',_0x7b02('0x65'),'showWebBar'],'order':qs[_0x7b02('0x45')](_0x7b02('0x66')),'include':[{'model':db[_0x7b02('0x67')],'as':_0x7b02('0x68'),'attributes':['id','name',_0x7b02('0x69')],'through':{'attributes':[]}}]})[_0x7b02('0x30')](function(_0x5b1955){if(_0x5b1955){var _0x2392ca=_0x338054[_0x7b02('0x60')][_0x7b02('0x57')]({'plain':!![]});if(!_0x2392ca)throw new Error(_0x7b02('0x6a'));if(_0x2392ca[_0x7b02('0x6b')]===_0x7b02('0x60')){return db[_0x7b02('0x6c')][_0x7b02('0x51')]({'where':{'name':'Agents','userProfileId':_0x2392ca[_0x7b02('0x6d')]},'raw':!![]})[_0x7b02('0x30')](function(_0x317b69){if(_0x317b69){if(_0x317b69[_0x7b02('0x6e')]===0x0){return db[_0x7b02('0x6f')][_0x7b02('0x4c')]({'where':{'sectionId':_0x317b69['id']},'raw':!![]})[_0x7b02('0x30')](function(_0xad203c){var _0xccd683=[];if(_['isEmpty'](_0xad203c)){_0xccd683=_[_0x7b02('0x47')](_0x5b1955,function(_0x2433de){if(_0x2433de['role']!==_0x7b02('0x5f')){return _0x2433de;}});return _0xccd683;}else{for(var _0x12c624=0x0;_0x12c624<_0x5b1955['length'];_0x12c624++){var _0x3730d3=_0x5b1955[_0x12c624];if(_0x3730d3[_0x7b02('0x6b')]==='agent'){var _0x3eb8fd=_[_0x7b02('0x51')](_0xad203c,function(_0x305524){return _0x305524[_0x7b02('0x70')]===_0x3730d3['id'];});if(_0x3eb8fd)_0xccd683[_0x7b02('0x71')](_0x3730d3);}else{_0xccd683[_0x7b02('0x71')](_0x3730d3);}}return _0xccd683;}});}else{return _0x5b1955;}}else{var _0x272cb3=_['filter'](_0x5b1955,function(_0x204f7c){if(_0x204f7c[_0x7b02('0x6b')]!==_0x7b02('0x5f')){return _0x204f7c;}});return _0x272cb3;}});}else{return _0x5b1955;}}})[_0x7b02('0x30')](function(_0x44d86a){var _0x58a4da=[];if(_0x44d86a){_0x2638ed=_0x44d86a;for(var _0x244c91=0x0;_0x244c91<_0x44d86a['length'];_0x244c91+=0x1){_0x2638ed[_0x244c91][_0x7b02('0x58')]=[];_0x58a4da[_0x7b02('0x71')](db['ChatInternalMessage'][_0x7b02('0x51')]({'where':{'FromId':[_0x338054[_0x7b02('0x60')]['id'],_0x44d86a[_0x244c91]['id']],'ToId':[_0x338054[_0x7b02('0x60')]['id'],_0x44d86a[_0x244c91]['id']],'ChatGroupId':null},'attributes':['id',_0x7b02('0x59'),_0x7b02('0x72'),_0x7b02('0x73'),_0x7b02('0x74'),_0x7b02('0x53')],'order':qs[_0x7b02('0x45')](_0x7b02('0x75')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x7b02('0x30')](wrapUser(_0x44d86a[_0x244c91])));}return BPromise['all'](_0x58a4da);}return[];})[_0x7b02('0x30')](function(_0x2b2315){return{'rows':_0x2b2315,'count':_0x2b2315[_0x7b02('0x42')]};})[_0x7b02('0x30')](respondWithResult(_0x533ab1,null))[_0x7b02('0x54')](handleError(_0x533ab1,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 66d10c2..74db85d 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 _0x074c=['ChatInternalMessage','setMaxListeners','update','remove','emit','hasOwnProperty','exports','events'];(function(_0x5e43e2,_0x281609){var _0x50cf18=function(_0x37566f){while(--_0x37566f){_0x5e43e2['push'](_0x5e43e2['shift']());}};_0x50cf18(++_0x281609);}(_0x074c,0x1d7));var _0xc074=function(_0x2387c5,_0xfcc74c){_0x2387c5=_0x2387c5-0x0;var _0x2c414c=_0x074c[_0x2387c5];return _0x2c414c;};'use strict';var EventEmitter=require(_0xc074('0x0'));var ChatInternalMessage=require('../../mysqldb')['db'][_0xc074('0x1')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0xc074('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xc074('0x3'),'afterDestroy':_0xc074('0x4')};function emitEvent(_0x207cf6){return function(_0x258bec,_0x336933,_0x24af89){ChatInternalMessageEvents[_0xc074('0x5')](_0x207cf6+':'+_0x258bec['id'],_0x258bec);ChatInternalMessageEvents[_0xc074('0x5')](_0x207cf6,_0x258bec);_0x24af89(null);};}for(var e in events){if(events[_0xc074('0x6')](e)){var event=events[e];ChatInternalMessage['hook'](e,emitEvent(event));}}module[_0xc074('0x7')]=ChatInternalMessageEvents; \ No newline at end of file +var _0x02b6=['ChatInternalMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x486ab6,_0x257c0a){var _0x1ce5ea=function(_0x1443a5){while(--_0x1443a5){_0x486ab6['push'](_0x486ab6['shift']());}};_0x1ce5ea(++_0x257c0a);}(_0x02b6,0xf0));var _0x602b=function(_0x1498b0,_0x36eb0a){_0x1498b0=_0x1498b0-0x0;var _0x39397b=_0x02b6[_0x1498b0];return _0x39397b;};'use strict';var EventEmitter=require(_0x602b('0x0'));var ChatInternalMessage=require(_0x602b('0x1'))['db'][_0x602b('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x602b('0x3')](0x0);var events={'afterCreate':_0x602b('0x4'),'afterUpdate':_0x602b('0x5'),'afterDestroy':_0x602b('0x6')};function emitEvent(_0x444118){return function(_0x4aa9b6,_0x5db393,_0x21b6b5){ChatInternalMessageEvents[_0x602b('0x7')](_0x444118+':'+_0x4aa9b6['id'],_0x4aa9b6);ChatInternalMessageEvents[_0x602b('0x7')](_0x444118,_0x4aa9b6);_0x21b6b5(null);};}for(var e in events){if(events[_0x602b('0x8')](e)){var event=events[e];ChatInternalMessage[_0x602b('0x9')](e,emitEvent(event));}}module[_0x602b('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 83b33d5..af88bf3 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 _0x1517=['exports','ChatInternalMessage','chat_internal_messages','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./chatInternalMessage.attributes'];(function(_0x346737,_0x3e6081){var _0x1ade2e=function(_0x15e50e){while(--_0x15e50e){_0x346737['push'](_0x346737['shift']());}};_0x1ade2e(++_0x3e6081);}(_0x1517,0x7d));var _0x7151=function(_0x197954,_0x3f61d0){_0x197954=_0x197954-0x0;var _0x231d54=_0x1517[_0x197954];return _0x231d54;};'use strict';var _=require(_0x7151('0x0'));var util=require(_0x7151('0x1'));var logger=require(_0x7151('0x2'))(_0x7151('0x3'));var moment=require(_0x7151('0x4'));var BPromise=require('bluebird');var rp=require(_0x7151('0x5'));var fs=require('fs');var path=require(_0x7151('0x6'));var rimraf=require(_0x7151('0x7'));var config=require(_0x7151('0x8'));var attributes=require(_0x7151('0x9'));module[_0x7151('0xa')]=function(_0x2493da,_0x1d4194){return _0x2493da['define'](_0x7151('0xb'),attributes,{'tableName':_0x7151('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7151('0xd'),'collate':_0x7151('0xe')});}; \ No newline at end of file +var _0x2134=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','define','ChatInternalMessage','chat_internal_messages','utf8mb4','utf8mb4_unicode_ci','lodash','util'];(function(_0x4f57e4,_0x18914d){var _0x4a584c=function(_0x312dcb){while(--_0x312dcb){_0x4f57e4['push'](_0x4f57e4['shift']());}};_0x4a584c(++_0x18914d);}(_0x2134,0x139));var _0x4213=function(_0x55faa8,_0x175707){_0x55faa8=_0x55faa8-0x0;var _0x9cc278=_0x2134[_0x55faa8];return _0x9cc278;};'use strict';var _=require(_0x4213('0x0'));var util=require(_0x4213('0x1'));var logger=require(_0x4213('0x2'))(_0x4213('0x3'));var moment=require(_0x4213('0x4'));var BPromise=require(_0x4213('0x5'));var rp=require(_0x4213('0x6'));var fs=require('fs');var path=require(_0x4213('0x7'));var rimraf=require(_0x4213('0x8'));var config=require('../../config/environment');var attributes=require('./chatInternalMessage.attributes');module[_0x4213('0x9')]=function(_0x57e0e9,_0x10ddd2){return _0x57e0e9[_0x4213('0xa')](_0x4213('0xb'),attributes,{'tableName':_0x4213('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x4213('0xd'),'collate':_0x4213('0xe')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index 9c313f9..1b33047 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 _0x7488=['rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','request','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x4a649a,_0x1050f9){var _0x42b360=function(_0x40faaf){while(--_0x40faaf){_0x4a649a['push'](_0x4a649a['shift']());}};_0x42b360(++_0x1050f9);}(_0x7488,0x19a));var _0x8748=function(_0x3cfc7a,_0x3d24a5){_0x3cfc7a=_0x3cfc7a-0x0;var _0x1f623c=_0x7488[_0x3cfc7a];return _0x1f623c;};'use strict';var _=require(_0x8748('0x0'));var util=require(_0x8748('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x8748('0x2'));var fs=require('fs');var Redis=require(_0x8748('0x3'));var db=require(_0x8748('0x4'))['db'];var utils=require(_0x8748('0x5'));var logger=require('../../config/logger')(_0x8748('0x6'));var config=require(_0x8748('0x7'));var jayson=require(_0x8748('0x8'));var client=jayson[_0x8748('0x9')][_0x8748('0xa')]({'port':0x232a});config['redis']=_[_0x8748('0xb')](config[_0x8748('0xc')],{'host':_0x8748('0xd'),'port':0x18eb});var socket=require(_0x8748('0xe'))(new Redis(config[_0x8748('0xc')]));require('./chatInternalMessage.socket')['register'](socket);function respondWithRpcPromise(_0x907b6c,_0x2906fc,_0x348fff){return new BPromise(function(_0x34fb60,_0x42013b){return client[_0x8748('0xf')](_0x907b6c,_0x348fff)['then'](function(_0x21fcd8){logger['info'](_0x8748('0x10'),_0x2906fc,_0x8748('0x11'));logger[_0x8748('0x12')](_0x8748('0x13'),_0x2906fc,_0x8748('0x11'),JSON[_0x8748('0x14')](_0x21fcd8));if(_0x21fcd8[_0x8748('0x15')]){if(_0x21fcd8[_0x8748('0x15')][_0x8748('0x16')]===0x1f4){logger[_0x8748('0x15')]('ChatInternalMessage,\x20%s,\x20%s',_0x2906fc,_0x21fcd8['error']['message']);return _0x42013b(_0x21fcd8[_0x8748('0x15')][_0x8748('0x17')]);}logger[_0x8748('0x15')]('ChatInternalMessage,\x20%s,\x20%s',_0x2906fc,_0x21fcd8[_0x8748('0x15')][_0x8748('0x17')]);return _0x34fb60(_0x21fcd8[_0x8748('0x15')][_0x8748('0x17')]);}else{logger[_0x8748('0x18')](_0x8748('0x10'),_0x2906fc,_0x8748('0x11'));_0x34fb60(_0x21fcd8[_0x8748('0x19')][_0x8748('0x17')]);}})['catch'](function(_0x22b6bb){logger[_0x8748('0x15')](_0x8748('0x10'),_0x2906fc,_0x22b6bb);_0x42013b(_0x22b6bb);});});} \ No newline at end of file +var _0x5347=['code','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','localhost','socket.io-emitter','redis','./chatInternalMessage.socket','register','request','then','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x48d12f,_0x5b66db){var _0x47fadc=function(_0x408a80){while(--_0x408a80){_0x48d12f['push'](_0x48d12f['shift']());}};_0x47fadc(++_0x5b66db);}(_0x5347,0x19a));var _0x7534=function(_0x5af565,_0xe531a7){_0x5af565=_0x5af565-0x0;var _0x2a311f=_0x5347[_0x5af565];return _0x2a311f;};'use strict';var _=require('lodash');var util=require(_0x7534('0x0'));var moment=require(_0x7534('0x1'));var BPromise=require(_0x7534('0x2'));var rs=require(_0x7534('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7534('0x4'))['db'];var utils=require(_0x7534('0x5'));var logger=require(_0x7534('0x6'))('rpc');var config=require(_0x7534('0x7'));var jayson=require(_0x7534('0x8'));var client=jayson[_0x7534('0x9')][_0x7534('0xa')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0x7534('0xb'),'port':0x18eb});var socket=require(_0x7534('0xc'))(new Redis(config[_0x7534('0xd')]));require(_0x7534('0xe'))[_0x7534('0xf')](socket);function respondWithRpcPromise(_0x154b40,_0x4e624d,_0x231544){return new BPromise(function(_0x349af2,_0x4d34ac){return client[_0x7534('0x10')](_0x154b40,_0x231544)[_0x7534('0x11')](function(_0xb6e41b){logger[_0x7534('0x12')](_0x7534('0x13'),_0x4e624d,_0x7534('0x14'));logger[_0x7534('0x15')](_0x7534('0x16'),_0x4e624d,'request\x20sent',JSON[_0x7534('0x17')](_0xb6e41b));if(_0xb6e41b[_0x7534('0x18')]){if(_0xb6e41b[_0x7534('0x18')][_0x7534('0x19')]===0x1f4){logger[_0x7534('0x18')](_0x7534('0x13'),_0x4e624d,_0xb6e41b[_0x7534('0x18')][_0x7534('0x1a')]);return _0x4d34ac(_0xb6e41b[_0x7534('0x18')][_0x7534('0x1a')]);}logger[_0x7534('0x18')](_0x7534('0x13'),_0x4e624d,_0xb6e41b[_0x7534('0x18')][_0x7534('0x1a')]);return _0x349af2(_0xb6e41b[_0x7534('0x18')]['message']);}else{logger['info'](_0x7534('0x13'),_0x4e624d,_0x7534('0x14'));_0x349af2(_0xb6e41b[_0x7534('0x1b')][_0x7534('0x1a')]);}})[_0x7534('0x1c')](function(_0x4dfa4c){logger['error'](_0x7534('0x13'),_0x4e624d,_0x4dfa4c);_0x4d34ac(_0x4dfa4c);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index 6683add..06f8b7f 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 _0xc450=['removeListener','length','chatInternalMessage:','./chatInternalMessage.events'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0xc450,0x103));var _0x0c45=function(_0x5a59cc,_0x57090f){_0x5a59cc=_0x5a59cc-0x0;var _0x31a246=_0xc450[_0x5a59cc];return _0x31a246;};'use strict';var ChatInternalMessageEvents=require(_0x0c45('0x0'));var events=['save','remove','update'];function createListener(_0x54ca45,_0x5b61d0){return function(_0x24ae48){_0x5b61d0['emit'](_0x54ca45,_0x24ae48);};}function removeListener(_0x4b08a7,_0x49b33b){return function(){ChatInternalMessageEvents[_0x0c45('0x1')](_0x4b08a7,_0x49b33b);};}exports['register']=function(_0x4b48f0){for(var _0x2d215b=0x0,_0xdd0469=events[_0x0c45('0x2')];_0x2d215b<_0xdd0469;_0x2d215b++){var _0x22f9c8=events[_0x2d215b];var _0x24620d=createListener(_0x0c45('0x3')+_0x22f9c8,_0x4b48f0);ChatInternalMessageEvents['on'](_0x22f9c8,_0x24620d);}}; \ No newline at end of file +var _0x3375=['save','remove','emit','removeListener','register','length','./chatInternalMessage.events'];(function(_0x34f164,_0x38ff8d){var _0x805fff=function(_0x54cc14){while(--_0x54cc14){_0x34f164['push'](_0x34f164['shift']());}};_0x805fff(++_0x38ff8d);}(_0x3375,0x141));var _0x5337=function(_0x422e80,_0x1bdf91){_0x422e80=_0x422e80-0x0;var _0x25728a=_0x3375[_0x422e80];return _0x25728a;};'use strict';var ChatInternalMessageEvents=require(_0x5337('0x0'));var events=[_0x5337('0x1'),_0x5337('0x2'),'update'];function createListener(_0x3920b3,_0x4d047a){return function(_0x11a09b){_0x4d047a[_0x5337('0x3')](_0x3920b3,_0x11a09b);};}function removeListener(_0x112645,_0x46e017){return function(){ChatInternalMessageEvents[_0x5337('0x4')](_0x112645,_0x46e017);};}exports[_0x5337('0x5')]=function(_0x3759a5){for(var _0x104db3=0x0,_0x1a6975=events[_0x5337('0x6')];_0x104db3<_0x1a6975;_0x104db3++){var _0x57088a=events[_0x104db3];var _0x24b22a=createListener('chatInternalMessage:'+_0x57088a,_0x3759a5);ChatInternalMessageEvents['on'](_0x57088a,_0x24b22a);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 1eeba09..9384c25 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 _0x43df=['index','/describe','describe','/users','/:id','show','post','create','put','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated'];(function(_0x1752c4,_0xc5d1dc){var _0x5cdb63=function(_0x45ff5d){while(--_0x45ff5d){_0x1752c4['push'](_0x1752c4['shift']());}};_0x5cdb63(++_0xc5d1dc);}(_0x43df,0x14d));var _0xf43d=function(_0x305d99,_0x30e499){_0x305d99=_0x305d99-0x0;var _0x1163cf=_0x43df[_0x305d99];return _0x1163cf;};'use strict';var multer=require(_0xf43d('0x0'));var util=require(_0xf43d('0x1'));var path=require('path');var timeout=require(_0xf43d('0x2'));var express=require(_0xf43d('0x3'));var router=express[_0xf43d('0x4')]();var fs_extra=require(_0xf43d('0x5'));var auth=require(_0xf43d('0x6'));var interaction=require(_0xf43d('0x7'));var config=require(_0xf43d('0x8'));var controller=require(_0xf43d('0x9'));router[_0xf43d('0xa')]('/',auth[_0xf43d('0xb')](),controller[_0xf43d('0xc')]);router['get'](_0xf43d('0xd'),auth[_0xf43d('0xb')](),controller[_0xf43d('0xe')]);router[_0xf43d('0xa')](_0xf43d('0xf'),auth[_0xf43d('0xb')](),controller['getUsers']);router[_0xf43d('0xa')](_0xf43d('0x10'),auth['isAuthenticated'](),controller[_0xf43d('0x11')]);router[_0xf43d('0x12')]('/',auth['isAuthenticated'](),controller[_0xf43d('0x13')]);router[_0xf43d('0x14')](_0xf43d('0x10'),controller['update']);router[_0xf43d('0x15')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xf43d('0x16')]=router; \ No newline at end of file +var _0x435f=['/:id','show','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','index','/describe','isAuthenticated','describe','/users','getUsers'];(function(_0x3b5e32,_0x1e6275){var _0x3f7670=function(_0x199ba9){while(--_0x199ba9){_0x3b5e32['push'](_0x3b5e32['shift']());}};_0x3f7670(++_0x1e6275);}(_0x435f,0x14a));var _0xf435=function(_0x2ef1a4,_0x1935e0){_0x2ef1a4=_0x2ef1a4-0x0;var _0x1aa1bc=_0x435f[_0x2ef1a4];return _0x1aa1bc;};'use strict';var multer=require(_0xf435('0x0'));var util=require(_0xf435('0x1'));var path=require(_0xf435('0x2'));var timeout=require(_0xf435('0x3'));var express=require('express');var router=express[_0xf435('0x4')]();var fs_extra=require(_0xf435('0x5'));var auth=require(_0xf435('0x6'));var interaction=require(_0xf435('0x7'));var config=require('../../config/environment');var controller=require('./chatInternalMessage.controller');router[_0xf435('0x8')]('/',auth['isAuthenticated'](),controller[_0xf435('0x9')]);router[_0xf435('0x8')](_0xf435('0xa'),auth[_0xf435('0xb')](),controller[_0xf435('0xc')]);router[_0xf435('0x8')](_0xf435('0xd'),auth[_0xf435('0xb')](),controller[_0xf435('0xe')]);router[_0xf435('0x8')](_0xf435('0xf'),auth[_0xf435('0xb')](),controller[_0xf435('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0xf435('0x11')]);router[_0xf435('0x12')](_0xf435('0xf'),controller[_0xf435('0x13')]);router[_0xf435('0x14')]('/:id',auth['isAuthenticated'](),controller[_0xf435('0x15')]);module[_0xf435('0x16')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index 5ddc9c0..1b65a0b 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 _0x566f=['ENUM','out','DATE','STRING','sequelize','exports','TEXT','medium','BOOLEAN'];(function(_0x382a59,_0x36357b){var _0x212183=function(_0xd52674){while(--_0xd52674){_0x382a59['push'](_0x382a59['shift']());}};_0x212183(++_0x36357b);}(_0x566f,0x124));var _0xf566=function(_0x29de5d,_0x6d02f0){_0x29de5d=_0x29de5d-0x0;var _0x2c1b77=_0x566f[_0x29de5d];return _0x2c1b77;};'use strict';var Sequelize=require(_0xf566('0x0'));module[_0xf566('0x1')]={'body':{'type':Sequelize[_0xf566('0x2')](_0xf566('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xf566('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0xf566('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xf566('0x5')]('in',_0xf566('0x6')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0xf566('0x7')]},'providerName':{'type':Sequelize[_0xf566('0x8')]},'providerResponse':{'type':Sequelize[_0xf566('0x2')]}}; \ No newline at end of file +var _0x659c=['medium','BOOLEAN','ENUM','out','STRING','TEXT','sequelize'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x659c,0x1aa));var _0xc659=function(_0x2c94d4,_0x43af5a){_0x2c94d4=_0x2c94d4-0x0;var _0x138a94=_0x659c[_0x2c94d4];return _0x138a94;};'use strict';var Sequelize=require(_0xc659('0x0'));module['exports']={'body':{'type':Sequelize['TEXT'](_0xc659('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0xc659('0x2')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xc659('0x3')]('in',_0xc659('0x4')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0xc659('0x5')]},'providerResponse':{'type':Sequelize[_0xc659('0x6')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index 1ec7771..8ae1a53 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 _0x1957=['[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','User','motionChannel','reject','rejectmessage','eml-format','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','jayson/promise','client','http','then','info','ChatMessage,\x20%s,\x20%s','debug','ChatMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','update','destroy','stack','send','index','map','ChatMessage','rawAttributes','fieldName','type','key','name','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','show','keys','includeAll','find','create','body','params','describe','accept','chat','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','ChatInteractionId','isNil','read1stAt','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','fullname','email','internal','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','parse','formData','ChatInteraction'];(function(_0x40822a,_0x582b60){var _0x357420=function(_0x6cee0b){while(--_0x6cee0b){_0x40822a['push'](_0x40822a['shift']());}};_0x357420(++_0x582b60);}(_0x1957,0x11a));var _0x7195=function(_0x289c3e,_0x3614b5){_0x289c3e=_0x289c3e-0x0;var _0x25a4b3=_0x1957[_0x289c3e];return _0x25a4b3;};'use strict';var emlformat=require(_0x7195('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x7195('0x1'));var rp=require('request-promise');var moment=require(_0x7195('0x2'));var BPromise=require(_0x7195('0x3'));var Mustache=require(_0x7195('0x4'));var util=require(_0x7195('0x5'));var path=require(_0x7195('0x6'));var sox=require(_0x7195('0x7'));var csv=require(_0x7195('0x8'));var ejs=require(_0x7195('0x9'));var fs=require('fs');var fs_extra=require(_0x7195('0xa'));var _=require('lodash');var squel=require(_0x7195('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x7195('0xc'));var toCsv=require(_0x7195('0x8'));var querystring=require(_0x7195('0xd'));var Papa=require(_0x7195('0xe'));var Redis=require(_0x7195('0xf'));var authService=require(_0x7195('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x7195('0x11'));var hardwareService=require(_0x7195('0x12'));var logger=require(_0x7195('0x13'))('api');var utils=require(_0x7195('0x14'));var config=require(_0x7195('0x15'));var licenseUtil=require(_0x7195('0x16'));var db=require(_0x7195('0x17'))['db'];config[_0x7195('0x18')]=_[_0x7195('0x19')](config[_0x7195('0x18')],{'host':_0x7195('0x1a'),'port':0x18eb});var socket=require(_0x7195('0x1b'))(new Redis(config['redis']));require(_0x7195('0x1c'))[_0x7195('0x1d')](socket);var jayson=require(_0x7195('0x1e'));var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0x7195('0x1f')][_0x7195('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x8d6782,_0x40bae0,_0x42f913,_0x33aff1){return new BPromise(function(_0x30ec17,_0x1e01f0){var _0x1b1d8d=_0x33aff1||client;return _0x1b1d8d['request'](_0x8d6782,_0x42f913)[_0x7195('0x21')](function(_0x32b52d){logger[_0x7195('0x22')](_0x7195('0x23'),_0x40bae0,'request\x20sent');logger[_0x7195('0x24')](_0x7195('0x25'),_0x40bae0,_0x7195('0x26'),JSON[_0x7195('0x27')](_0x32b52d));if(_0x32b52d[_0x7195('0x28')]){if(_0x32b52d[_0x7195('0x28')][_0x7195('0x29')]===0x1f4){logger[_0x7195('0x28')](_0x7195('0x23'),_0x40bae0,_0x32b52d[_0x7195('0x28')]['message']);return _0x1e01f0(_0x32b52d[_0x7195('0x28')]['message']);}logger[_0x7195('0x28')](_0x7195('0x23'),_0x40bae0,_0x32b52d[_0x7195('0x28')][_0x7195('0x2a')]);return _0x30ec17(_0x32b52d[_0x7195('0x28')]['message']);}else{logger[_0x7195('0x22')](_0x7195('0x23'),_0x40bae0,'request\x20sent');_0x30ec17(_0x32b52d[_0x7195('0x2b')][_0x7195('0x2a')]);}})[_0x7195('0x2c')](function(_0x261f17){logger[_0x7195('0x28')]('ChatMessage,\x20%s,\x20%s',_0x40bae0,_0x261f17);_0x1e01f0(_0x261f17);});});}function respondWithStatusCode(_0x2a4364,_0x36b13c){_0x36b13c=_0x36b13c||0xcc;return function(_0x195bb9){if(_0x195bb9){return _0x2a4364[_0x7195('0x2d')](_0x36b13c);}return _0x2a4364[_0x7195('0x2e')](_0x36b13c)[_0x7195('0x2f')]();};}function respondWithResult(_0x2eb0b7,_0x914551){_0x914551=_0x914551||0xc8;return function(_0x55460f){if(_0x55460f){return _0x2eb0b7[_0x7195('0x2e')](_0x914551)[_0x7195('0x30')](_0x55460f);}};}function respondWithFilteredResult(_0x2a30f9,_0x314410){return function(_0x1dfd04){if(_0x1dfd04){var _0x374b9d=typeof _0x314410[_0x7195('0x31')]===_0x7195('0x32')&&typeof _0x314410['limit']===_0x7195('0x32');var _0x1741ef=_0x1dfd04[_0x7195('0x33')];var _0x1cbce4=_0x374b9d?0x0:_0x314410['offset'];var _0x52c601=_0x374b9d?_0x1dfd04['count']:_0x314410[_0x7195('0x31')]+_0x314410[_0x7195('0x34')];var _0x3a4823;if(_0x52c601>=_0x1741ef){_0x52c601=_0x1741ef;_0x3a4823=0xc8;}else{_0x3a4823=0xce;}_0x2a30f9[_0x7195('0x2e')](_0x3a4823);return _0x2a30f9[_0x7195('0x35')](_0x7195('0x36'),_0x1cbce4+'-'+_0x52c601+'/'+_0x1741ef)[_0x7195('0x30')](_0x1dfd04);}return null;};}function patchUpdates(_0x4a08f0){return function(_0x317e08){try{jsonpatch[_0x7195('0x37')](_0x317e08,_0x4a08f0,!![]);}catch(_0x47c950){return BPromise['reject'](_0x47c950);}return _0x317e08['save']();};}function saveUpdates(_0x31a62a,_0x39c3d3){return function(_0x48313d){if(_0x48313d){return _0x48313d[_0x7195('0x38')](_0x31a62a)[_0x7195('0x21')](function(_0x402c00){return _0x402c00;});}return null;};}function removeEntity(_0x45b3a3,_0x39cf88){return function(_0x134897){if(_0x134897){return _0x134897[_0x7195('0x39')]()[_0x7195('0x21')](function(){_0x45b3a3[_0x7195('0x2e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3218db,_0xf6edce){return function(_0x50d5fc){if(!_0x50d5fc){_0x3218db[_0x7195('0x2d')](0x194);}return _0x50d5fc;};}function handleError(_0x4f10e8,_0x4f4b47){_0x4f4b47=_0x4f4b47||0x1f4;return function(_0x53ea78){logger['error'](_0x53ea78[_0x7195('0x3a')]);if(_0x53ea78['name']){delete _0x53ea78['name'];}_0x4f10e8[_0x7195('0x2e')](_0x4f4b47)[_0x7195('0x3b')](_0x53ea78);};}exports[_0x7195('0x3c')]=function(_0x4a7063,_0x4c00a9){var _0x381393={},_0x557f5a={},_0xe4b8fd={'count':0x0,'rows':[]};var _0x54dea2=_[_0x7195('0x3d')](db[_0x7195('0x3e')][_0x7195('0x3f')],function(_0x2bea86){return{'name':_0x2bea86[_0x7195('0x40')],'type':_0x2bea86[_0x7195('0x41')][_0x7195('0x42')]};});_0x557f5a['model']=_[_0x7195('0x3d')](_0x54dea2,_0x7195('0x43'));_0x557f5a['query']=_['keys'](_0x4a7063[_0x7195('0x44')]);_0x557f5a[_0x7195('0x45')]=_[_0x7195('0x46')](_0x557f5a[_0x7195('0x47')],_0x557f5a['query']);_0x381393[_0x7195('0x48')]=_[_0x7195('0x46')](_0x557f5a[_0x7195('0x47')],qs[_0x7195('0x49')](_0x4a7063['query']['fields']));_0x381393[_0x7195('0x48')]=_0x381393[_0x7195('0x48')][_0x7195('0x4a')]?_0x381393[_0x7195('0x48')]:_0x557f5a[_0x7195('0x47')];if(!_0x4a7063[_0x7195('0x44')][_0x7195('0x4b')]('nolimit')){_0x381393[_0x7195('0x34')]=qs[_0x7195('0x34')](_0x4a7063[_0x7195('0x44')][_0x7195('0x34')]);_0x381393[_0x7195('0x31')]=qs[_0x7195('0x31')](_0x4a7063['query'][_0x7195('0x31')]);}_0x381393[_0x7195('0x4c')]=qs[_0x7195('0x4d')](_0x4a7063['query'][_0x7195('0x4d')]);_0x381393[_0x7195('0x4e')]=qs[_0x7195('0x45')](_['pick'](_0x4a7063[_0x7195('0x44')],_0x557f5a[_0x7195('0x45')]),_0x54dea2);if(_0x4a7063['query'][_0x7195('0x4f')]){_0x381393[_0x7195('0x4e')]=_[_0x7195('0x50')](_0x381393['where'],{'$or':_[_0x7195('0x3d')](_0x54dea2,function(_0x5a3373){if(_0x5a3373['type']!==_0x7195('0x51')){var _0x3e44fe={};_0x3e44fe[_0x5a3373[_0x7195('0x43')]]={'$like':'%'+_0x4a7063[_0x7195('0x44')]['filter']+'%'};return _0x3e44fe;}})});}_0x381393=_[_0x7195('0x50')]({},_0x381393,_0x4a7063[_0x7195('0x52')]);var _0x113fc4={'where':_0x381393[_0x7195('0x4e')]};return db['ChatMessage'][_0x7195('0x33')](_0x113fc4)[_0x7195('0x21')](function(_0x2aaa98){_0xe4b8fd[_0x7195('0x33')]=_0x2aaa98;if(_0x4a7063['query']['includeAll']){_0x381393[_0x7195('0x53')]=[{'all':!![]}];}return db['ChatMessage'][_0x7195('0x54')](_0x381393);})[_0x7195('0x21')](function(_0x1f2500){_0xe4b8fd[_0x7195('0x55')]=_0x1f2500;return _0xe4b8fd;})[_0x7195('0x21')](respondWithFilteredResult(_0x4c00a9,_0x381393))[_0x7195('0x2c')](handleError(_0x4c00a9,null));};exports[_0x7195('0x56')]=function(_0x5c3bc2,_0x4ac5cb){var _0x5a4656={'raw':!![],'where':{'id':_0x5c3bc2['params']['id']}},_0x370c21={};_0x370c21['model']=_[_0x7195('0x57')](db[_0x7195('0x3e')][_0x7195('0x3f')]);_0x370c21['query']=_['keys'](_0x5c3bc2[_0x7195('0x44')]);_0x370c21[_0x7195('0x45')]=_[_0x7195('0x46')](_0x370c21[_0x7195('0x47')],_0x370c21[_0x7195('0x44')]);_0x5a4656[_0x7195('0x48')]=_[_0x7195('0x46')](_0x370c21[_0x7195('0x47')],qs[_0x7195('0x49')](_0x5c3bc2['query']['fields']));_0x5a4656[_0x7195('0x48')]=_0x5a4656[_0x7195('0x48')][_0x7195('0x4a')]?_0x5a4656[_0x7195('0x48')]:_0x370c21['model'];if(_0x5c3bc2[_0x7195('0x44')][_0x7195('0x58')]){_0x5a4656[_0x7195('0x53')]=[{'all':!![]}];}_0x5a4656=_[_0x7195('0x50')]({},_0x5a4656,_0x5c3bc2[_0x7195('0x52')]);return db[_0x7195('0x3e')][_0x7195('0x59')](_0x5a4656)[_0x7195('0x21')](handleEntityNotFound(_0x4ac5cb,null))['then'](respondWithResult(_0x4ac5cb,null))[_0x7195('0x2c')](handleError(_0x4ac5cb,null));};exports[_0x7195('0x5a')]=function(_0x396966,_0x624dfe){return db[_0x7195('0x3e')]['create'](_0x396966['body'],{})[_0x7195('0x21')](respondWithResult(_0x624dfe,0xc9))[_0x7195('0x2c')](handleError(_0x624dfe,null));};exports['update']=function(_0x4f0997,_0x1b6ad5){if(_0x4f0997[_0x7195('0x5b')]['id']){delete _0x4f0997[_0x7195('0x5b')]['id'];}return db[_0x7195('0x3e')][_0x7195('0x59')]({'where':{'id':_0x4f0997[_0x7195('0x5c')]['id']}})[_0x7195('0x21')](handleEntityNotFound(_0x1b6ad5,null))[_0x7195('0x21')](saveUpdates(_0x4f0997[_0x7195('0x5b')],null))[_0x7195('0x21')](respondWithResult(_0x1b6ad5,null))[_0x7195('0x2c')](handleError(_0x1b6ad5,null));};exports[_0x7195('0x39')]=function(_0x5b5a24,_0x9bc016){return db[_0x7195('0x3e')][_0x7195('0x59')]({'where':{'id':_0x5b5a24[_0x7195('0x5c')]['id']}})[_0x7195('0x21')](handleEntityNotFound(_0x9bc016,null))[_0x7195('0x21')](removeEntity(_0x9bc016,null))['catch'](handleError(_0x9bc016,null));};exports['describe']=function(_0x516c7e,_0x339854){return db[_0x7195('0x3e')][_0x7195('0x5d')]()['then'](respondWithResult(_0x339854,null))['catch'](handleError(_0x339854,null));};var interaction_log=require(_0x7195('0x13'))('chat-interactions');exports[_0x7195('0x5e')]=function(_0x4e6edf,_0x54eda2,_0x3be27d){var _0x431a0e={'agent':{},'channel':_0x7195('0x5f')};if(_0x4e6edf[_0x7195('0x5b')]['id']){delete _0x4e6edf[_0x7195('0x5b')]['id'];}_0x4e6edf[_0x7195('0x5b')]['read']=!![];_0x4e6edf[_0x7195('0x5b')][_0x7195('0x60')]=moment()[_0x7195('0x61')](_0x7195('0x62'));_0x4e6edf[_0x7195('0x5b')]['UserId']=_0x4e6edf[_0x7195('0x5b')][_0x7195('0x63')]||_0x4e6edf[_0x7195('0x64')]['id'];_0x431a0e[_0x7195('0x65')]['id']=_0x4e6edf[_0x7195('0x5b')][_0x7195('0x63')];return db['ChatMessage'][_0x7195('0x59')]({'where':{'id':_0x4e6edf[_0x7195('0x5c')]['id'],'UserId':null}})[_0x7195('0x21')](handleEntityNotFound(_0x54eda2,null))[_0x7195('0x21')](saveUpdates(_0x4e6edf[_0x7195('0x5b')],null))[_0x7195('0x21')](function(_0x305041){if(_0x305041){_0x431a0e['message']=_0x305041[_0x7195('0x66')]({'plain':!![]});return db['ChatInteraction'][_0x7195('0x59')]({'where':{'id':_0x305041[_0x7195('0x67')]}});}return null;})[_0x7195('0x21')](handleEntityNotFound(_0x54eda2,null))[_0x7195('0x21')](function(_0x4520c5){if(_0x4520c5){return _0x4520c5[_0x7195('0x38')]({'UserId':_0x4e6edf['body'][_0x7195('0x63')],'read1stAt':_[_0x7195('0x68')](_0x4520c5[_0x7195('0x69')])?moment()['format'](_0x7195('0x62')):undefined});}return null;})['then'](function(_0x86e1e8){if(_0x86e1e8){_0x431a0e[_0x7195('0x6a')]=_0x86e1e8[_0x7195('0x66')]({'plain':!![]});interaction_log[_0x7195('0x22')](_0x7195('0x6b'),_0x4e6edf[_0x7195('0x64')]['id'],_0x4e6edf[_0x7195('0x64')][_0x7195('0x43')],_0x4e6edf[_0x7195('0x64')][_0x7195('0x6c')],_0x431a0e[_0x7195('0x6a')]['id'],_0x4e6edf[_0x7195('0x5b')]?JSON['stringify'](_0x4e6edf[_0x7195('0x5b')]):_0x7195('0x6d'));return respondWithRpcPromise(_0x7195('0x6e'),_0x7195('0x6f'),_0x431a0e);}return null;})[_0x7195('0x21')](function(_0x5e77b4){var _0xc410d9=_0x7195('0x70')+_0x5e77b4['message'][_0x7195('0x71')];return db[_0x7195('0x72')]['query'](_0xc410d9,{'type':db[_0x7195('0x73')][_0x7195('0x74')][_0x7195('0x75')],'raw':!![]})[_0x7195('0x21')](function(_0x38a384){return _0x38a384;});})[_0x7195('0x21')](function(_0x5997d3){if(_0x5997d3){_0x431a0e[_0x7195('0x2a')][_0x7195('0x76')]=_0x5997d3[0x0];if(!_0x4e6edf[_0x7195('0x5b')]['UserId'])return;return db['User'][_0x7195('0x59')]({'where':{'id':_0x4e6edf[_0x7195('0x5b')][_0x7195('0x63')],'role':_0x7195('0x65')},'attributes':['id',_0x7195('0x43'),_0x7195('0x77'),_0x7195('0x78'),_0x7195('0x79')],'raw':!![]});}return null;})[_0x7195('0x21')](function(_0x151791){if(!_0x151791)return null;_0x431a0e[_0x7195('0x2a')][_0x7195('0x65')]=_0x151791;return _0x431a0e;})['then'](function(_0x32927d){if(_0x32927d){if(_0x4e6edf[_0x7195('0x5b')][_0x7195('0x7a')]){_0x431a0e[_0x7195('0x2a')][_0x7195('0x7b')]=util[_0x7195('0x61')](_0x7195('0x7c'),_0x4e6edf[_0x7195('0x64')]['name']);_0x431a0e[_0x7195('0x2a')][_0x7195('0x7d')]=_0x431a0e[_0x7195('0x7d')];_0x431a0e[_0x7195('0x2a')]['motionChannel']=_0x431a0e[_0x7195('0x7d')];_0x431a0e['message'][_0x7195('0x7e')]='accept';return respondWithRpcPromise(_0x7195('0x7f'),_0x7195('0x7f'),{'event':_0x7195('0x80'),'message':_[_0x7195('0x50')](_0x431a0e[_0x7195('0x2a')],JSON[_0x7195('0x81')](_0x431a0e['interaction'][_0x7195('0x82')]))},client9002)['then'](function(){return _0x431a0e;});}return _0x431a0e;}return null;})[_0x7195('0x21')](respondWithResult(_0x54eda2,null))[_0x7195('0x2c')](handleError(_0x54eda2,null));};var interaction_log=require(_0x7195('0x13'))('chat-interactions');exports['reject']=function(_0x2c7efb,_0x1fd40e,_0x2926ee){var _0x293708={'agent':{},'channel':_0x7195('0x5f')};if(_0x2c7efb[_0x7195('0x5b')]['id']){delete _0x2c7efb[_0x7195('0x5b')]['id'];}_0x2c7efb[_0x7195('0x5b')]['UserId']=_0x2c7efb[_0x7195('0x5b')][_0x7195('0x63')]||_0x2c7efb[_0x7195('0x64')]['id'];_0x293708['agent']['id']=_0x2c7efb[_0x7195('0x5b')][_0x7195('0x63')];return db[_0x7195('0x3e')][_0x7195('0x59')]({'where':{'id':_0x2c7efb[_0x7195('0x5c')]['id'],'UserId':null}})[_0x7195('0x21')](handleEntityNotFound(_0x1fd40e,null))[_0x7195('0x21')](function(_0x18dbef){if(_0x18dbef){_0x293708['message']=_0x18dbef[_0x7195('0x66')]({'plain':!![]});return db[_0x7195('0x83')][_0x7195('0x59')]({'where':{'id':_0x18dbef[_0x7195('0x67')]}});}return null;})[_0x7195('0x21')](handleEntityNotFound(_0x1fd40e,null))[_0x7195('0x21')](function(_0x22e119){if(_0x22e119){_0x293708['interaction']=_0x22e119[_0x7195('0x66')]({'plain':!![]});interaction_log['info'](_0x7195('0x84'),_0x2c7efb[_0x7195('0x64')]['id'],_0x2c7efb[_0x7195('0x64')][_0x7195('0x43')],_0x2c7efb['user'][_0x7195('0x6c')],_0x293708[_0x7195('0x6a')]['id'],_0x2c7efb[_0x7195('0x5b')]?JSON['stringify'](_0x2c7efb[_0x7195('0x5b')]):_0x7195('0x6d'));return respondWithRpcPromise('RejectMessage',_0x7195('0x85'),_0x293708);}return null;})[_0x7195('0x21')](function(_0x57355b){var _0x287e4b=_0x7195('0x70')+_0x57355b[_0x7195('0x2a')][_0x7195('0x71')];return db[_0x7195('0x72')]['query'](_0x287e4b,{'type':db[_0x7195('0x73')][_0x7195('0x74')]['SELECT'],'raw':!![]})[_0x7195('0x21')](function(_0x5a9c9a){return _0x5a9c9a;});})[_0x7195('0x21')](function(_0x51e5bb){if(_0x51e5bb){_0x293708[_0x7195('0x2a')][_0x7195('0x76')]=_0x51e5bb[0x0];if(!_0x2c7efb[_0x7195('0x5b')]['UserId'])return;return db[_0x7195('0x86')][_0x7195('0x59')]({'where':{'id':_0x2c7efb[_0x7195('0x5b')]['UserId'],'role':'agent'},'attributes':['id','name',_0x7195('0x77'),_0x7195('0x78'),'internal'],'raw':!![]});}return null;})['then'](function(_0x1a61d8){if(!_0x1a61d8)return null;_0x293708[_0x7195('0x2a')][_0x7195('0x65')]=_0x1a61d8;return _0x293708;})[_0x7195('0x21')](function(_0x1cf2b1){if(_0x1cf2b1){_0x1cf2b1[_0x7195('0x2a')][_0x7195('0x7b')]=util['format'](_0x7195('0x7c'),_0x2c7efb['user'][_0x7195('0x43')]);_0x1cf2b1[_0x7195('0x2a')][_0x7195('0x7d')]=_0x293708[_0x7195('0x7d')];_0x1cf2b1['message'][_0x7195('0x87')]=_0x293708[_0x7195('0x7d')];_0x1cf2b1[_0x7195('0x2a')][_0x7195('0x7e')]=_0x7195('0x88');respondWithRpcPromise(_0x7195('0x7f'),_0x7195('0x7f'),{'event':_0x7195('0x89'),'message':_[_0x7195('0x50')](_0x293708[_0x7195('0x2a')],JSON[_0x7195('0x81')](_0x293708[_0x7195('0x6a')][_0x7195('0x82')]))},client9002);return _0x293708;}return null;})['then'](respondWithResult(_0x1fd40e,null))[_0x7195('0x2c')](handleError(_0x1fd40e,null));}; \ No newline at end of file +var _0xf481=['squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','./chatMessage.socket','jayson/promise','client','http','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','destroy','stack','name','index','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','map','VIRTUAL','options','ChatMessage','findAll','rows','catch','show','params','keys','includeAll','include','find','create','body','describe','chat-interactions','chat','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','ChatInteraction','ChatInteractionId','get','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','SELECT','contact','fullname','internal','manual','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','parse','formData','reject','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','Sequelize','User','email','rejectmessage','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash'];(function(_0x11fdc2,_0x358b36){var _0x6ff572=function(_0x3d4cc4){while(--_0x3d4cc4){_0x11fdc2['push'](_0x11fdc2['shift']());}};_0x6ff572(++_0x358b36);}(_0xf481,0x78));var _0x1f48=function(_0x9adf1b,_0x3ac695){_0x9adf1b=_0x9adf1b-0x0;var _0x960269=_0xf481[_0x9adf1b];return _0x960269;};'use strict';var emlformat=require(_0x1f48('0x0'));var rimraf=require(_0x1f48('0x1'));var zipdir=require(_0x1f48('0x2'));var jsonpatch=require(_0x1f48('0x3'));var rp=require(_0x1f48('0x4'));var moment=require(_0x1f48('0x5'));var BPromise=require(_0x1f48('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x1f48('0x7'));var sox=require(_0x1f48('0x8'));var csv=require(_0x1f48('0x9'));var ejs=require(_0x1f48('0xa'));var fs=require('fs');var fs_extra=require(_0x1f48('0xb'));var _=require(_0x1f48('0xc'));var squel=require(_0x1f48('0xd'));var crypto=require('crypto');var jsforce=require(_0x1f48('0xe'));var deskjs=require(_0x1f48('0xf'));var toCsv=require(_0x1f48('0x9'));var querystring=require('querystring');var Papa=require(_0x1f48('0x10'));var Redis=require(_0x1f48('0x11'));var authService=require(_0x1f48('0x12'));var qs=require(_0x1f48('0x13'));var as=require(_0x1f48('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x1f48('0x15'));var utils=require(_0x1f48('0x16'));var config=require(_0x1f48('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x1f48('0x18'))['db'];config['redis']=_[_0x1f48('0x19')](config[_0x1f48('0x1a')],{'host':_0x1f48('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1f48('0x1a')]));require(_0x1f48('0x1c'))['register'](socket);var jayson=require(_0x1f48('0x1d'));var client=jayson[_0x1f48('0x1e')]['http']({'port':0x232c});var client9002=jayson[_0x1f48('0x1e')][_0x1f48('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0xa91472,_0x477aaa,_0xc1edd2,_0x1c7295){return new BPromise(function(_0x33ffe2,_0x5bdc98){var _0x32d1a=_0x1c7295||client;return _0x32d1a['request'](_0xa91472,_0xc1edd2)['then'](function(_0xeb13ac){logger['info'](_0x1f48('0x20'),_0x477aaa,_0x1f48('0x21'));logger[_0x1f48('0x22')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x477aaa,'request\x20sent',JSON[_0x1f48('0x23')](_0xeb13ac));if(_0xeb13ac[_0x1f48('0x24')]){if(_0xeb13ac[_0x1f48('0x24')][_0x1f48('0x25')]===0x1f4){logger[_0x1f48('0x24')](_0x1f48('0x20'),_0x477aaa,_0xeb13ac[_0x1f48('0x24')][_0x1f48('0x26')]);return _0x5bdc98(_0xeb13ac['error'][_0x1f48('0x26')]);}logger['error'](_0x1f48('0x20'),_0x477aaa,_0xeb13ac[_0x1f48('0x24')][_0x1f48('0x26')]);return _0x33ffe2(_0xeb13ac['error'][_0x1f48('0x26')]);}else{logger[_0x1f48('0x27')]('ChatMessage,\x20%s,\x20%s',_0x477aaa,_0x1f48('0x21'));_0x33ffe2(_0xeb13ac[_0x1f48('0x28')]['message']);}})['catch'](function(_0x396e4f){logger[_0x1f48('0x24')](_0x1f48('0x20'),_0x477aaa,_0x396e4f);_0x5bdc98(_0x396e4f);});});}function respondWithStatusCode(_0x7dddee,_0x420aaa){_0x420aaa=_0x420aaa||0xcc;return function(_0x95e4b5){if(_0x95e4b5){return _0x7dddee[_0x1f48('0x29')](_0x420aaa);}return _0x7dddee[_0x1f48('0x2a')](_0x420aaa)[_0x1f48('0x2b')]();};}function respondWithResult(_0x45f655,_0x1247c1){_0x1247c1=_0x1247c1||0xc8;return function(_0xb218b0){if(_0xb218b0){return _0x45f655[_0x1f48('0x2a')](_0x1247c1)[_0x1f48('0x2c')](_0xb218b0);}};}function respondWithFilteredResult(_0x1b3e48,_0x3c10f1){return function(_0x88dac5){if(_0x88dac5){var _0x505359=typeof _0x3c10f1[_0x1f48('0x2d')]===_0x1f48('0x2e')&&typeof _0x3c10f1[_0x1f48('0x2f')]===_0x1f48('0x2e');var _0x518c96=_0x88dac5[_0x1f48('0x30')];var _0x5788ea=_0x505359?0x0:_0x3c10f1[_0x1f48('0x2d')];var _0x4322a6=_0x505359?_0x88dac5[_0x1f48('0x30')]:_0x3c10f1[_0x1f48('0x2d')]+_0x3c10f1[_0x1f48('0x2f')];var _0x38aae6;if(_0x4322a6>=_0x518c96){_0x4322a6=_0x518c96;_0x38aae6=0xc8;}else{_0x38aae6=0xce;}_0x1b3e48[_0x1f48('0x2a')](_0x38aae6);return _0x1b3e48['set'](_0x1f48('0x31'),_0x5788ea+'-'+_0x4322a6+'/'+_0x518c96)['json'](_0x88dac5);}return null;};}function patchUpdates(_0x313c01){return function(_0x418969){try{jsonpatch[_0x1f48('0x32')](_0x418969,_0x313c01,!![]);}catch(_0x4e927c){return BPromise['reject'](_0x4e927c);}return _0x418969[_0x1f48('0x33')]();};}function saveUpdates(_0x40be07,_0x216fc8){return function(_0x1187f2){if(_0x1187f2){return _0x1187f2[_0x1f48('0x34')](_0x40be07)[_0x1f48('0x35')](function(_0x506e30){return _0x506e30;});}return null;};}function removeEntity(_0x4845c1,_0xef12d){return function(_0x2da1ee){if(_0x2da1ee){return _0x2da1ee[_0x1f48('0x36')]()[_0x1f48('0x35')](function(){_0x4845c1[_0x1f48('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x120049,_0x49d27b){return function(_0x1fe412){if(!_0x1fe412){_0x120049[_0x1f48('0x29')](0x194);}return _0x1fe412;};}function handleError(_0x19101a,_0x6db625){_0x6db625=_0x6db625||0x1f4;return function(_0x53d724){logger[_0x1f48('0x24')](_0x53d724[_0x1f48('0x37')]);if(_0x53d724[_0x1f48('0x38')]){delete _0x53d724[_0x1f48('0x38')];}_0x19101a['status'](_0x6db625)['send'](_0x53d724);};}exports[_0x1f48('0x39')]=function(_0x54932a,_0x3a76fd){var _0x2153f6={},_0x515c2d={},_0x4d0ed9={'count':0x0,'rows':[]};var _0x329376=_['map'](db['ChatMessage'][_0x1f48('0x3a')],function(_0xbbcb2){return{'name':_0xbbcb2[_0x1f48('0x3b')],'type':_0xbbcb2[_0x1f48('0x3c')][_0x1f48('0x3d')]};});_0x515c2d[_0x1f48('0x3e')]=_['map'](_0x329376,_0x1f48('0x38'));_0x515c2d[_0x1f48('0x3f')]=_['keys'](_0x54932a[_0x1f48('0x3f')]);_0x515c2d[_0x1f48('0x40')]=_[_0x1f48('0x41')](_0x515c2d[_0x1f48('0x3e')],_0x515c2d[_0x1f48('0x3f')]);_0x2153f6[_0x1f48('0x42')]=_[_0x1f48('0x41')](_0x515c2d[_0x1f48('0x3e')],qs[_0x1f48('0x43')](_0x54932a[_0x1f48('0x3f')][_0x1f48('0x43')]));_0x2153f6[_0x1f48('0x42')]=_0x2153f6['attributes'][_0x1f48('0x44')]?_0x2153f6[_0x1f48('0x42')]:_0x515c2d[_0x1f48('0x3e')];if(!_0x54932a[_0x1f48('0x3f')][_0x1f48('0x45')](_0x1f48('0x46'))){_0x2153f6[_0x1f48('0x2f')]=qs['limit'](_0x54932a[_0x1f48('0x3f')][_0x1f48('0x2f')]);_0x2153f6[_0x1f48('0x2d')]=qs[_0x1f48('0x2d')](_0x54932a[_0x1f48('0x3f')][_0x1f48('0x2d')]);}_0x2153f6[_0x1f48('0x47')]=qs['sort'](_0x54932a[_0x1f48('0x3f')]['sort']);_0x2153f6[_0x1f48('0x48')]=qs[_0x1f48('0x40')](_[_0x1f48('0x49')](_0x54932a[_0x1f48('0x3f')],_0x515c2d['filters']),_0x329376);if(_0x54932a[_0x1f48('0x3f')][_0x1f48('0x4a')]){_0x2153f6[_0x1f48('0x48')]=_[_0x1f48('0x4b')](_0x2153f6[_0x1f48('0x48')],{'$or':_[_0x1f48('0x4c')](_0x329376,function(_0x2f668b){if(_0x2f668b[_0x1f48('0x3c')]!==_0x1f48('0x4d')){var _0x19c13b={};_0x19c13b[_0x2f668b[_0x1f48('0x38')]]={'$like':'%'+_0x54932a[_0x1f48('0x3f')][_0x1f48('0x4a')]+'%'};return _0x19c13b;}})});}_0x2153f6=_[_0x1f48('0x4b')]({},_0x2153f6,_0x54932a[_0x1f48('0x4e')]);var _0x1e1c44={'where':_0x2153f6[_0x1f48('0x48')]};return db[_0x1f48('0x4f')][_0x1f48('0x30')](_0x1e1c44)[_0x1f48('0x35')](function(_0x2acf21){_0x4d0ed9[_0x1f48('0x30')]=_0x2acf21;if(_0x54932a[_0x1f48('0x3f')]['includeAll']){_0x2153f6['include']=[{'all':!![]}];}return db[_0x1f48('0x4f')][_0x1f48('0x50')](_0x2153f6);})[_0x1f48('0x35')](function(_0x58058b){_0x4d0ed9[_0x1f48('0x51')]=_0x58058b;return _0x4d0ed9;})['then'](respondWithFilteredResult(_0x3a76fd,_0x2153f6))[_0x1f48('0x52')](handleError(_0x3a76fd,null));};exports[_0x1f48('0x53')]=function(_0x2fc520,_0x36e7fb){var _0xf745eb={'raw':!![],'where':{'id':_0x2fc520[_0x1f48('0x54')]['id']}},_0xb9916e={};_0xb9916e[_0x1f48('0x3e')]=_[_0x1f48('0x55')](db[_0x1f48('0x4f')][_0x1f48('0x3a')]);_0xb9916e[_0x1f48('0x3f')]=_['keys'](_0x2fc520['query']);_0xb9916e[_0x1f48('0x40')]=_[_0x1f48('0x41')](_0xb9916e['model'],_0xb9916e[_0x1f48('0x3f')]);_0xf745eb[_0x1f48('0x42')]=_[_0x1f48('0x41')](_0xb9916e[_0x1f48('0x3e')],qs[_0x1f48('0x43')](_0x2fc520[_0x1f48('0x3f')][_0x1f48('0x43')]));_0xf745eb[_0x1f48('0x42')]=_0xf745eb[_0x1f48('0x42')][_0x1f48('0x44')]?_0xf745eb[_0x1f48('0x42')]:_0xb9916e['model'];if(_0x2fc520['query'][_0x1f48('0x56')]){_0xf745eb[_0x1f48('0x57')]=[{'all':!![]}];}_0xf745eb=_[_0x1f48('0x4b')]({},_0xf745eb,_0x2fc520[_0x1f48('0x4e')]);return db[_0x1f48('0x4f')][_0x1f48('0x58')](_0xf745eb)[_0x1f48('0x35')](handleEntityNotFound(_0x36e7fb,null))[_0x1f48('0x35')](respondWithResult(_0x36e7fb,null))[_0x1f48('0x52')](handleError(_0x36e7fb,null));};exports[_0x1f48('0x59')]=function(_0x5ce8d3,_0x49be4b){return db['ChatMessage'][_0x1f48('0x59')](_0x5ce8d3[_0x1f48('0x5a')],{})['then'](respondWithResult(_0x49be4b,0xc9))['catch'](handleError(_0x49be4b,null));};exports['update']=function(_0x427ad5,_0x19c3b1){if(_0x427ad5[_0x1f48('0x5a')]['id']){delete _0x427ad5[_0x1f48('0x5a')]['id'];}return db[_0x1f48('0x4f')]['find']({'where':{'id':_0x427ad5[_0x1f48('0x54')]['id']}})[_0x1f48('0x35')](handleEntityNotFound(_0x19c3b1,null))[_0x1f48('0x35')](saveUpdates(_0x427ad5[_0x1f48('0x5a')],null))[_0x1f48('0x35')](respondWithResult(_0x19c3b1,null))[_0x1f48('0x52')](handleError(_0x19c3b1,null));};exports[_0x1f48('0x36')]=function(_0x2271cc,_0x40e5b6){return db[_0x1f48('0x4f')][_0x1f48('0x58')]({'where':{'id':_0x2271cc[_0x1f48('0x54')]['id']}})['then'](handleEntityNotFound(_0x40e5b6,null))[_0x1f48('0x35')](removeEntity(_0x40e5b6,null))['catch'](handleError(_0x40e5b6,null));};exports[_0x1f48('0x5b')]=function(_0x27ad9,_0x2bab57){return db['ChatMessage'][_0x1f48('0x5b')]()[_0x1f48('0x35')](respondWithResult(_0x2bab57,null))['catch'](handleError(_0x2bab57,null));};var interaction_log=require('../../config/logger')(_0x1f48('0x5c'));exports['accept']=function(_0xc9d92c,_0xd51364,_0x16af02){var _0x16b955={'agent':{},'channel':_0x1f48('0x5d')};if(_0xc9d92c['body']['id']){delete _0xc9d92c[_0x1f48('0x5a')]['id'];}_0xc9d92c[_0x1f48('0x5a')][_0x1f48('0x5e')]=!![];_0xc9d92c[_0x1f48('0x5a')]['readAt']=moment()[_0x1f48('0x5f')](_0x1f48('0x60'));_0xc9d92c[_0x1f48('0x5a')][_0x1f48('0x61')]=_0xc9d92c[_0x1f48('0x5a')][_0x1f48('0x61')]||_0xc9d92c[_0x1f48('0x62')]['id'];_0x16b955[_0x1f48('0x63')]['id']=_0xc9d92c[_0x1f48('0x5a')]['UserId'];return db[_0x1f48('0x4f')][_0x1f48('0x58')]({'where':{'id':_0xc9d92c['params']['id'],'UserId':null}})[_0x1f48('0x35')](handleEntityNotFound(_0xd51364,null))[_0x1f48('0x35')](saveUpdates(_0xc9d92c['body'],null))[_0x1f48('0x35')](function(_0x383043){if(_0x383043){_0x16b955[_0x1f48('0x26')]=_0x383043['get']({'plain':!![]});return db[_0x1f48('0x64')][_0x1f48('0x58')]({'where':{'id':_0x383043[_0x1f48('0x65')]}});}return null;})[_0x1f48('0x35')](handleEntityNotFound(_0xd51364,null))[_0x1f48('0x35')](function(_0x2dc612){if(_0x2dc612){return _0x2dc612['update']({'UserId':_0xc9d92c[_0x1f48('0x5a')][_0x1f48('0x61')],'read1stAt':_['isNil'](_0x2dc612['read1stAt'])?moment()['format'](_0x1f48('0x60')):undefined});}return null;})[_0x1f48('0x35')](function(_0x2c5552){if(_0x2c5552){_0x16b955['interaction']=_0x2c5552[_0x1f48('0x66')]({'plain':!![]});interaction_log[_0x1f48('0x27')](_0x1f48('0x67'),_0xc9d92c[_0x1f48('0x62')]['id'],_0xc9d92c['user'][_0x1f48('0x38')],_0xc9d92c[_0x1f48('0x62')][_0x1f48('0x68')],_0x16b955[_0x1f48('0x69')]['id'],_0xc9d92c[_0x1f48('0x5a')]?JSON[_0x1f48('0x23')](_0xc9d92c[_0x1f48('0x5a')]):'null');return respondWithRpcPromise(_0x1f48('0x6a'),'acceptMessage',_0x16b955);}return null;})[_0x1f48('0x35')](function(_0x1cc08e){var _0x34f28b=_0x1f48('0x6b')+_0x1cc08e[_0x1f48('0x26')][_0x1f48('0x6c')];return db[_0x1f48('0x6d')][_0x1f48('0x3f')](_0x34f28b,{'type':db['Sequelize'][_0x1f48('0x6e')][_0x1f48('0x6f')],'raw':!![]})['then'](function(_0x303107){return _0x303107;});})[_0x1f48('0x35')](function(_0x4901de){if(_0x4901de){_0x16b955[_0x1f48('0x26')][_0x1f48('0x70')]=_0x4901de[0x0];if(!_0xc9d92c[_0x1f48('0x5a')][_0x1f48('0x61')])return;return db['User'][_0x1f48('0x58')]({'where':{'id':_0xc9d92c[_0x1f48('0x5a')][_0x1f48('0x61')],'role':'agent'},'attributes':['id',_0x1f48('0x38'),_0x1f48('0x71'),'email',_0x1f48('0x72')],'raw':!![]});}return null;})[_0x1f48('0x35')](function(_0x644b88){if(!_0x644b88)return null;_0x16b955['message']['agent']=_0x644b88;return _0x16b955;})[_0x1f48('0x35')](function(_0x28752f){if(_0x28752f){if(_0xc9d92c[_0x1f48('0x5a')][_0x1f48('0x73')]){_0x16b955[_0x1f48('0x26')]['interface']=util[_0x1f48('0x5f')](_0x1f48('0x74'),_0xc9d92c[_0x1f48('0x62')][_0x1f48('0x38')]);_0x16b955['message'][_0x1f48('0x75')]=_0x16b955['channel'];_0x16b955[_0x1f48('0x26')][_0x1f48('0x76')]=_0x16b955['channel'];_0x16b955[_0x1f48('0x26')][_0x1f48('0x77')]='accept';return respondWithRpcPromise(_0x1f48('0x78'),_0x1f48('0x78'),{'event':_0x1f48('0x79'),'message':_['merge'](_0x16b955[_0x1f48('0x26')],JSON[_0x1f48('0x7a')](_0x16b955['interaction'][_0x1f48('0x7b')]))},client9002)[_0x1f48('0x35')](function(){return _0x16b955;});}return _0x16b955;}return null;})[_0x1f48('0x35')](respondWithResult(_0xd51364,null))[_0x1f48('0x52')](handleError(_0xd51364,null));};var interaction_log=require('../../config/logger')(_0x1f48('0x5c'));exports[_0x1f48('0x7c')]=function(_0x135c90,_0x3387c5,_0x30da0c){var _0x1e6d43={'agent':{},'channel':'chat'};if(_0x135c90[_0x1f48('0x5a')]['id']){delete _0x135c90[_0x1f48('0x5a')]['id'];}_0x135c90['body']['UserId']=_0x135c90[_0x1f48('0x5a')][_0x1f48('0x61')]||_0x135c90['user']['id'];_0x1e6d43['agent']['id']=_0x135c90[_0x1f48('0x5a')][_0x1f48('0x61')];return db[_0x1f48('0x4f')][_0x1f48('0x58')]({'where':{'id':_0x135c90[_0x1f48('0x54')]['id'],'UserId':null}})[_0x1f48('0x35')](handleEntityNotFound(_0x3387c5,null))[_0x1f48('0x35')](function(_0x10615e){if(_0x10615e){_0x1e6d43[_0x1f48('0x26')]=_0x10615e[_0x1f48('0x66')]({'plain':!![]});return db[_0x1f48('0x64')][_0x1f48('0x58')]({'where':{'id':_0x10615e[_0x1f48('0x65')]}});}return null;})[_0x1f48('0x35')](handleEntityNotFound(_0x3387c5,null))['then'](function(_0x1e5830){if(_0x1e5830){_0x1e6d43[_0x1f48('0x69')]=_0x1e5830[_0x1f48('0x66')]({'plain':!![]});interaction_log[_0x1f48('0x27')](_0x1f48('0x7d'),_0x135c90[_0x1f48('0x62')]['id'],_0x135c90[_0x1f48('0x62')][_0x1f48('0x38')],_0x135c90['user'][_0x1f48('0x68')],_0x1e6d43[_0x1f48('0x69')]['id'],_0x135c90[_0x1f48('0x5a')]?JSON[_0x1f48('0x23')](_0x135c90['body']):_0x1f48('0x7e'));return respondWithRpcPromise(_0x1f48('0x7f'),_0x1f48('0x80'),_0x1e6d43);}return null;})['then'](function(_0x2b684e){var _0x5836f7=_0x1f48('0x6b')+_0x2b684e[_0x1f48('0x26')][_0x1f48('0x6c')];return db['sequelize'][_0x1f48('0x3f')](_0x5836f7,{'type':db[_0x1f48('0x81')][_0x1f48('0x6e')]['SELECT'],'raw':!![]})['then'](function(_0x32a092){return _0x32a092;});})['then'](function(_0x501d09){if(_0x501d09){_0x1e6d43[_0x1f48('0x26')][_0x1f48('0x70')]=_0x501d09[0x0];if(!_0x135c90[_0x1f48('0x5a')]['UserId'])return;return db[_0x1f48('0x82')][_0x1f48('0x58')]({'where':{'id':_0x135c90[_0x1f48('0x5a')][_0x1f48('0x61')],'role':_0x1f48('0x63')},'attributes':['id','name',_0x1f48('0x71'),_0x1f48('0x83'),_0x1f48('0x72')],'raw':!![]});}return null;})['then'](function(_0x4408ba){if(!_0x4408ba)return null;_0x1e6d43[_0x1f48('0x26')][_0x1f48('0x63')]=_0x4408ba;return _0x1e6d43;})[_0x1f48('0x35')](function(_0x5ae390){if(_0x5ae390){_0x5ae390[_0x1f48('0x26')]['interface']=util['format']('SIP/%s',_0x135c90[_0x1f48('0x62')][_0x1f48('0x38')]);_0x5ae390[_0x1f48('0x26')][_0x1f48('0x75')]=_0x1e6d43[_0x1f48('0x75')];_0x5ae390['message'][_0x1f48('0x76')]=_0x1e6d43[_0x1f48('0x75')];_0x5ae390['message'][_0x1f48('0x77')]=_0x1f48('0x7c');respondWithRpcPromise(_0x1f48('0x78'),_0x1f48('0x78'),{'event':_0x1f48('0x84'),'message':_[_0x1f48('0x4b')](_0x1e6d43[_0x1f48('0x26')],JSON['parse'](_0x1e6d43[_0x1f48('0x69')][_0x1f48('0x7b')]))},client9002);return _0x1e6d43;}return null;})[_0x1f48('0x35')](respondWithResult(_0x3387c5,null))[_0x1f48('0x52')](handleError(_0x3387c5,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 29570e4..4bdde9f 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 _0x88e9=['hook','exports','events','../../mysqldb','ChatMessage','save','update','remove','emit','hasOwnProperty'];(function(_0x252087,_0x28d2c7){var _0x10f21d=function(_0x300e75){while(--_0x300e75){_0x252087['push'](_0x252087['shift']());}};_0x10f21d(++_0x28d2c7);}(_0x88e9,0x7a));var _0x988e=function(_0x2e6235,_0x4ee47b){_0x2e6235=_0x2e6235-0x0;var _0x2550ea=_0x88e9[_0x2e6235];return _0x2550ea;};'use strict';var EventEmitter=require(_0x988e('0x0'));var ChatMessage=require(_0x988e('0x1'))['db'][_0x988e('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x988e('0x3'),'afterUpdate':_0x988e('0x4'),'afterDestroy':_0x988e('0x5')};function emitEvent(_0x3e409b){return function(_0x58a5b7,_0x201a7e,_0x2f03fa){ChatMessageEvents[_0x988e('0x6')](_0x3e409b+':'+_0x58a5b7['id'],_0x58a5b7);ChatMessageEvents[_0x988e('0x6')](_0x3e409b,_0x58a5b7);_0x2f03fa(null);};}for(var e in events){if(events[_0x988e('0x7')](e)){var event=events[e];ChatMessage[_0x988e('0x8')](e,emitEvent(event));}}module[_0x988e('0x9')]=ChatMessageEvents; \ No newline at end of file +var _0x738f=['remove','emit','hasOwnProperty','events','../../mysqldb','setMaxListeners','update'];(function(_0x3808ea,_0x16eeed){var _0x167a92=function(_0x3dda90){while(--_0x3dda90){_0x3808ea['push'](_0x3808ea['shift']());}};_0x167a92(++_0x16eeed);}(_0x738f,0x1bc));var _0xf738=function(_0x454cbd,_0x436d19){_0x454cbd=_0x454cbd-0x0;var _0x45b4bf=_0x738f[_0x454cbd];return _0x45b4bf;};'use strict';var EventEmitter=require(_0xf738('0x0'));var ChatMessage=require(_0xf738('0x1'))['db']['ChatMessage'];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0xf738('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xf738('0x3'),'afterDestroy':_0xf738('0x4')};function emitEvent(_0x1ac8c7){return function(_0x499839,_0x306d45,_0x19c6cc){ChatMessageEvents[_0xf738('0x5')](_0x1ac8c7+':'+_0x499839['id'],_0x499839);ChatMessageEvents[_0xf738('0x5')](_0x1ac8c7,_0x499839);_0x19c6cc(null);};}for(var e in events){if(events[_0xf738('0x6')](e)){var event=events[e];ChatMessage['hook'](e,emitEvent(event));}}module['exports']=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index c9d8c3b..c058675 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 _0x3fab=['isNil','UserId','then','update','catch','error','utf8mb4','utf8mb4_unicode_ci','../../config/logger','moment','request-promise','../../config/environment','./chatMessage.attributes','exports','define','ChatMessage','chat_messages','fti_chat_messages','body','FULLTEXT','models','get','toLowerCase','direction'];(function(_0x5519a9,_0x1c5147){var _0x32f2cc=function(_0x52ed58){while(--_0x52ed58){_0x5519a9['push'](_0x5519a9['shift']());}};_0x32f2cc(++_0x1c5147);}(_0x3fab,0xf8));var _0xb3fa=function(_0xba9879,_0x178a09){_0xba9879=_0xba9879-0x0;var _0x312144=_0x3fab[_0xba9879];return _0x312144;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xb3fa('0x0'))('api');var moment=require(_0xb3fa('0x1'));var BPromise=require('bluebird');var rp=require(_0xb3fa('0x2'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xb3fa('0x3'));var attributes=require(_0xb3fa('0x4'));module[_0xb3fa('0x5')]=function(_0x79e345,_0x30670f){return _0x79e345[_0xb3fa('0x6')](_0xb3fa('0x7'),attributes,{'tableName':_0xb3fa('0x8'),'paranoid':![],'indexes':[{'name':_0xb3fa('0x9'),'fields':[_0xb3fa('0xa')],'type':_0xb3fa('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4010f6,_0x224bae,_0x37cc77){var _0x3abe22=_0x79e345[_0xb3fa('0xc')];var _0x1a7155=_0x4010f6[_0xb3fa('0xd')]({'plain':!![]});if(_0x1a7155['direction'][_0xb3fa('0xe')]()==='in'||_0x1a7155[_0xb3fa('0xf')][_0xb3fa('0xe')]()==='out'&&!_0x1a7155['secret']&&!_[_0xb3fa('0x10')](_0x1a7155[_0xb3fa('0x11')])){_0x3abe22['ChatInteraction']['findOne']({'where':{'id':_0x1a7155['ChatInteractionId']}})[_0xb3fa('0x12')](function(_0x162ef4){if(_0x162ef4){_0x162ef4[_0xb3fa('0x13')]({'lastMsgAt':_0x1a7155['createdAt'],'lastMsgDirection':_0x1a7155[_0xb3fa('0xf')][_0xb3fa('0xe')]()});}})[_0xb3fa('0x14')](function(_0x569395){console[_0xb3fa('0x15')](_0x569395);});}_0x37cc77();}},'charset':_0xb3fa('0x16'),'collate':_0xb3fa('0x17')});}; \ No newline at end of file +var _0x2b82=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatMessage.attributes','exports','define','ChatMessage','chat_messages','fti_chat_messages','get','direction','out','secret','isNil','UserId','ChatInteraction','findOne','ChatInteractionId','update','createdAt','toLowerCase','utf8mb4','lodash','util','../../config/logger'];(function(_0x20581a,_0x44bbdc){var _0x39a71a=function(_0x510c73){while(--_0x510c73){_0x20581a['push'](_0x20581a['shift']());}};_0x39a71a(++_0x44bbdc);}(_0x2b82,0x11f));var _0x22b8=function(_0xdd317,_0x1100fc){_0xdd317=_0xdd317-0x0;var _0x3a3128=_0x2b82[_0xdd317];return _0x3a3128;};'use strict';var _=require(_0x22b8('0x0'));var util=require(_0x22b8('0x1'));var logger=require(_0x22b8('0x2'))(_0x22b8('0x3'));var moment=require(_0x22b8('0x4'));var BPromise=require(_0x22b8('0x5'));var rp=require(_0x22b8('0x6'));var fs=require('fs');var path=require(_0x22b8('0x7'));var rimraf=require(_0x22b8('0x8'));var config=require(_0x22b8('0x9'));var attributes=require(_0x22b8('0xa'));module[_0x22b8('0xb')]=function(_0x2341bc,_0x5aacdd){return _0x2341bc[_0x22b8('0xc')](_0x22b8('0xd'),attributes,{'tableName':_0x22b8('0xe'),'paranoid':![],'indexes':[{'name':_0x22b8('0xf'),'fields':['body'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2f14b2,_0x344742,_0x1962d7){var _0x18dd1a=_0x2341bc['models'];var _0x4fb629=_0x2f14b2[_0x22b8('0x10')]({'plain':!![]});if(_0x4fb629[_0x22b8('0x11')]['toLowerCase']()==='in'||_0x4fb629[_0x22b8('0x11')]['toLowerCase']()===_0x22b8('0x12')&&!_0x4fb629[_0x22b8('0x13')]&&!_[_0x22b8('0x14')](_0x4fb629[_0x22b8('0x15')])){_0x18dd1a[_0x22b8('0x16')][_0x22b8('0x17')]({'where':{'id':_0x4fb629[_0x22b8('0x18')]}})['then'](function(_0x50e467){if(_0x50e467){_0x50e467[_0x22b8('0x19')]({'lastMsgAt':_0x4fb629[_0x22b8('0x1a')],'lastMsgDirection':_0x4fb629[_0x22b8('0x11')][_0x22b8('0x1b')]()});}})['catch'](function(_0x4024e7){console['error'](_0x4024e7);});}_0x1962d7();}},'charset':_0x22b8('0x1c'),'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 677c15e..58a0b3e 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 _0x00c2=['catch','ChatMessage','body','options','raw','then','CreateChatMessage','lodash','util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','code','error','message'];(function(_0x331ebe,_0x1fdbfa){var _0x5311ef=function(_0xc76f7b){while(--_0xc76f7b){_0x331ebe['push'](_0x331ebe['shift']());}};_0x5311ef(++_0x1fdbfa);}(_0x00c2,0x6a));var _0x200c=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x00c2[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x200c('0x0'));var util=require(_0x200c('0x1'));var moment=require('moment');var BPromise=require(_0x200c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x200c('0x3'));var db=require(_0x200c('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x200c('0x5'))(_0x200c('0x6'));var config=require(_0x200c('0x7'));var jayson=require(_0x200c('0x8'));var client=jayson[_0x200c('0x9')][_0x200c('0xa')]({'port':0x232a});config[_0x200c('0xb')]=_[_0x200c('0xc')](config['redis'],{'host':_0x200c('0xd'),'port':0x18eb});var socket=require(_0x200c('0xe'))(new Redis(config['redis']));require(_0x200c('0xf'))[_0x200c('0x10')](socket);function respondWithRpcPromise(_0x113e58,_0x301da2,_0x52ca95){return new BPromise(function(_0x2ad205,_0x424186){return client['request'](_0x113e58,_0x52ca95)['then'](function(_0x276df4){logger[_0x200c('0x11')](_0x200c('0x12'),_0x301da2,_0x200c('0x13'));logger[_0x200c('0x14')](_0x200c('0x15'),_0x301da2,_0x200c('0x13'),JSON[_0x200c('0x16')](_0x276df4));if(_0x276df4['error']){if(_0x276df4['error'][_0x200c('0x17')]===0x1f4){logger[_0x200c('0x18')](_0x200c('0x12'),_0x301da2,_0x276df4[_0x200c('0x18')][_0x200c('0x19')]);return _0x424186(_0x276df4[_0x200c('0x18')][_0x200c('0x19')]);}logger[_0x200c('0x18')](_0x200c('0x12'),_0x301da2,_0x276df4[_0x200c('0x18')][_0x200c('0x19')]);return _0x2ad205(_0x276df4[_0x200c('0x18')][_0x200c('0x19')]);}else{logger['info'](_0x200c('0x12'),_0x301da2,_0x200c('0x13'));_0x2ad205(_0x276df4['result']['message']);}})[_0x200c('0x1a')](function(_0x59e244){logger[_0x200c('0x18')]('ChatMessage,\x20%s,\x20%s',_0x301da2,_0x59e244);_0x424186(_0x59e244);});});}exports['CreateChatMessage']=function(_0x1c4391){var _0x2d8a39=this;return new Promise(function(_0x3e4e01,_0xc3b98f){return db[_0x200c('0x1b')]['create'](_0x1c4391[_0x200c('0x1c')],{'raw':_0x1c4391[_0x200c('0x1d')]?_0x1c4391['options'][_0x200c('0x1e')]===undefined?!![]:![]:!![]})[_0x200c('0x1f')](function(_0x1dab90){logger[_0x200c('0x11')]('CreateChatMessage',_0x1c4391);logger[_0x200c('0x14')](_0x200c('0x20'),_0x1c4391,JSON[_0x200c('0x16')](_0x1dab90));_0x3e4e01(_0x1dab90);})[_0x200c('0x1a')](function(_0x1bb929){logger[_0x200c('0x18')]('CreateChatMessage',_0x1bb929['message'],_0x1c4391);_0xc3b98f(_0x2d8a39[_0x200c('0x18')](0x1f4,_0x1bb929[_0x200c('0x19')]));});});}; \ No newline at end of file +var _0xf228=['ChatMessage','body','options','raw','debug','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','redis','localhost','./chatMessage.socket','register','then','info','request\x20sent','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','ChatMessage,\x20%s,\x20%s','message','CreateChatMessage'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf228,0x1a9));var _0x8f22=function(_0xdd10f5,_0x30d632){_0xdd10f5=_0xdd10f5-0x0;var _0x35b464=_0xf228[_0xdd10f5];return _0x35b464;};'use strict';var _=require(_0x8f22('0x0'));var util=require(_0x8f22('0x1'));var moment=require('moment');var BPromise=require(_0x8f22('0x2'));var rs=require(_0x8f22('0x3'));var fs=require('fs');var Redis=require(_0x8f22('0x4'));var db=require(_0x8f22('0x5'))['db'];var utils=require(_0x8f22('0x6'));var logger=require(_0x8f22('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x8f22('0x8'));var client=jayson['client'][_0x8f22('0x9')]({'port':0x232a});config[_0x8f22('0xa')]=_['defaults'](config[_0x8f22('0xa')],{'host':_0x8f22('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8f22('0xa')]));require(_0x8f22('0xc'))[_0x8f22('0xd')](socket);function respondWithRpcPromise(_0x234225,_0x31ba70,_0x459d5b){return new BPromise(function(_0x223ae2,_0x21178b){return client['request'](_0x234225,_0x459d5b)[_0x8f22('0xe')](function(_0x1e16d4){logger[_0x8f22('0xf')]('ChatMessage,\x20%s,\x20%s',_0x31ba70,_0x8f22('0x10'));logger['debug'](_0x8f22('0x11'),_0x31ba70,_0x8f22('0x10'),JSON[_0x8f22('0x12')](_0x1e16d4));if(_0x1e16d4[_0x8f22('0x13')]){if(_0x1e16d4[_0x8f22('0x13')]['code']===0x1f4){logger[_0x8f22('0x13')](_0x8f22('0x14'),_0x31ba70,_0x1e16d4['error'][_0x8f22('0x15')]);return _0x21178b(_0x1e16d4[_0x8f22('0x13')]['message']);}logger[_0x8f22('0x13')](_0x8f22('0x14'),_0x31ba70,_0x1e16d4[_0x8f22('0x13')]['message']);return _0x223ae2(_0x1e16d4[_0x8f22('0x13')][_0x8f22('0x15')]);}else{logger[_0x8f22('0xf')](_0x8f22('0x14'),_0x31ba70,'request\x20sent');_0x223ae2(_0x1e16d4['result'][_0x8f22('0x15')]);}})['catch'](function(_0x14b1d9){logger['error'](_0x8f22('0x14'),_0x31ba70,_0x14b1d9);_0x21178b(_0x14b1d9);});});}exports[_0x8f22('0x16')]=function(_0x448533){var _0x305a5e=this;return new Promise(function(_0x446220,_0x5b45c5){return db[_0x8f22('0x17')]['create'](_0x448533[_0x8f22('0x18')],{'raw':_0x448533[_0x8f22('0x19')]?_0x448533[_0x8f22('0x19')][_0x8f22('0x1a')]===undefined?!![]:![]:!![]})[_0x8f22('0xe')](function(_0x475392){logger[_0x8f22('0xf')]('CreateChatMessage',_0x448533);logger[_0x8f22('0x1b')](_0x8f22('0x16'),_0x448533,JSON[_0x8f22('0x12')](_0x475392));_0x446220(_0x475392);})['catch'](function(_0x5bdef5){logger['error']('CreateChatMessage',_0x5bdef5['message'],_0x448533);_0x5b45c5(_0x305a5e[_0x8f22('0x13')](0x1f4,_0x5bdef5[_0x8f22('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index e950532..64af35b 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 _0xfd20=['register','chatMessage:','save','emit','removeListener'];(function(_0x19fd7d,_0x2b866d){var _0x46fd50=function(_0x10c4d0){while(--_0x10c4d0){_0x19fd7d['push'](_0x19fd7d['shift']());}};_0x46fd50(++_0x2b866d);}(_0xfd20,0x66));var _0x0fd2=function(_0x49c816,_0x198631){_0x49c816=_0x49c816-0x0;var _0x23bcac=_0xfd20[_0x49c816];return _0x23bcac;};'use strict';var ChatMessageEvents=require('./chatMessage.events');var events=[_0x0fd2('0x0'),'remove','update'];function createListener(_0x429df4,_0x28eb77){return function(_0x53caa3){_0x28eb77[_0x0fd2('0x1')](_0x429df4,_0x53caa3);};}function removeListener(_0x4c4975,_0x3661d3){return function(){ChatMessageEvents[_0x0fd2('0x2')](_0x4c4975,_0x3661d3);};}exports[_0x0fd2('0x3')]=function(_0xf25991){for(var _0x247d6e=0x0,_0x4d114c=events['length'];_0x247d6e<_0x4d114c;_0x247d6e++){var _0x32d460=events[_0x247d6e];var _0x15ba86=createListener(_0x0fd2('0x4')+_0x32d460,_0xf25991);ChatMessageEvents['on'](_0x32d460,_0x15ba86);}}; \ No newline at end of file +var _0x46e1=['remove','update','emit','register','length','./chatMessage.events','save'];(function(_0x46da84,_0x501012){var _0x3941f5=function(_0x385aa4){while(--_0x385aa4){_0x46da84['push'](_0x46da84['shift']());}};_0x3941f5(++_0x501012);}(_0x46e1,0x155));var _0x146e=function(_0x576c67,_0x1a22c2){_0x576c67=_0x576c67-0x0;var _0x178cac=_0x46e1[_0x576c67];return _0x178cac;};'use strict';var ChatMessageEvents=require(_0x146e('0x0'));var events=[_0x146e('0x1'),_0x146e('0x2'),_0x146e('0x3')];function createListener(_0x155784,_0x1ff284){return function(_0x3708b1){_0x1ff284[_0x146e('0x4')](_0x155784,_0x3708b1);};}function removeListener(_0x18dab9,_0x3bbaec){return function(){ChatMessageEvents['removeListener'](_0x18dab9,_0x3bbaec);};}exports[_0x146e('0x5')]=function(_0x1f1f15){for(var _0x3de564=0x0,_0x228fe7=events[_0x146e('0x6')];_0x3de564<_0x228fe7;_0x3de564++){var _0x35e40e=events[_0x3de564];var _0x1c1398=createListener('chatMessage:'+_0x35e40e,_0x1f1f15);ChatMessageEvents['on'](_0x35e40e,_0x1c1398);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index f3749d6..3b79162 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 _0xeb20=['post','tracked','chat','chatmessage:create','create','put','update','/:id/accept','accept','/:id/reject','delete','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatMessage.controller','get','isAuthenticated','index','/describe','/:id'];(function(_0x149065,_0x19d114){var _0x14d0af=function(_0x265c06){while(--_0x265c06){_0x149065['push'](_0x149065['shift']());}};_0x14d0af(++_0x19d114);}(_0xeb20,0x100));var _0x0eb2=function(_0x19babd,_0x1d4ef7){_0x19babd=_0x19babd-0x0;var _0x314eaf=_0xeb20[_0x19babd];return _0x314eaf;};'use strict';var multer=require('multer');var util=require(_0x0eb2('0x0'));var path=require('path');var timeout=require(_0x0eb2('0x1'));var express=require(_0x0eb2('0x2'));var router=express[_0x0eb2('0x3')]();var fs_extra=require(_0x0eb2('0x4'));var auth=require(_0x0eb2('0x5'));var interaction=require(_0x0eb2('0x6'));var config=require(_0x0eb2('0x7'));var controller=require(_0x0eb2('0x8'));router[_0x0eb2('0x9')]('/',auth[_0x0eb2('0xa')](),controller[_0x0eb2('0xb')]);router['get'](_0x0eb2('0xc'),auth[_0x0eb2('0xa')](),controller['describe']);router[_0x0eb2('0x9')](_0x0eb2('0xd'),auth[_0x0eb2('0xa')](),controller['show']);router[_0x0eb2('0xe')]('/',auth[_0x0eb2('0xa')](),interaction[_0x0eb2('0xf')](_0x0eb2('0x10'),_0x0eb2('0x11')),controller[_0x0eb2('0x12')]);router[_0x0eb2('0x13')](_0x0eb2('0xd'),controller[_0x0eb2('0x14')]);router[_0x0eb2('0x13')](_0x0eb2('0x15'),auth[_0x0eb2('0xa')](),controller[_0x0eb2('0x16')]);router[_0x0eb2('0x13')](_0x0eb2('0x17'),auth[_0x0eb2('0xa')](),controller['reject']);router[_0x0eb2('0x18')](_0x0eb2('0xd'),auth['isAuthenticated'](),controller[_0x0eb2('0x19')]);module[_0x0eb2('0x1a')]=router; \ No newline at end of file +var _0x21a0=['util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./chatMessage.controller','get','index','/describe','isAuthenticated','/:id','show','post','chat','create','put','/:id/accept','accept','reject','delete','exports'];(function(_0x47f0e6,_0x439f00){var _0x146919=function(_0x4b80e7){while(--_0x4b80e7){_0x47f0e6['push'](_0x47f0e6['shift']());}};_0x146919(++_0x439f00);}(_0x21a0,0x14a));var _0x021a=function(_0x4ed606,_0x2b3c9d){_0x4ed606=_0x4ed606-0x0;var _0x24d318=_0x21a0[_0x4ed606];return _0x24d318;};'use strict';var multer=require('multer');var util=require(_0x021a('0x0'));var path=require('path');var timeout=require(_0x021a('0x1'));var express=require(_0x021a('0x2'));var router=express[_0x021a('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x021a('0x4'));var interaction=require(_0x021a('0x5'));var config=require('../../config/environment');var controller=require(_0x021a('0x6'));router[_0x021a('0x7')]('/',auth['isAuthenticated'](),controller[_0x021a('0x8')]);router['get'](_0x021a('0x9'),auth[_0x021a('0xa')](),controller['describe']);router[_0x021a('0x7')](_0x021a('0xb'),auth[_0x021a('0xa')](),controller[_0x021a('0xc')]);router[_0x021a('0xd')]('/',auth['isAuthenticated'](),interaction['tracked'](_0x021a('0xe'),'chatmessage:create'),controller[_0x021a('0xf')]);router['put'](_0x021a('0xb'),controller['update']);router[_0x021a('0x10')](_0x021a('0x11'),auth[_0x021a('0xa')](),controller[_0x021a('0x12')]);router[_0x021a('0x10')]('/:id/reject',auth[_0x021a('0xa')](),controller[_0x021a('0x13')]);router[_0x021a('0x14')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x021a('0x15')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index ae1a894..61695a6 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 _0xdb28=['TEXT','medium','sequelize','exports'];(function(_0x2c1923,_0x26da04){var _0x3d38bb=function(_0xb95248){while(--_0xb95248){_0x2c1923['push'](_0x2c1923['shift']());}};_0x3d38bb(++_0x26da04);}(_0xdb28,0x106));var _0x8db2=function(_0x364511,_0x1db927){_0x364511=_0x364511-0x0;var _0x3dd973=_0xdb28[_0x364511];return _0x3dd973;};'use strict';var Sequelize=require(_0x8db2('0x0'));module[_0x8db2('0x1')]={'body':{'type':Sequelize[_0x8db2('0x2')](_0x8db2('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT'](_0x8db2('0x3')),'allowNull':![]}}; \ No newline at end of file +var _0xb10b=['medium','sequelize','TEXT'];(function(_0x518982,_0x4c692e){var _0x37554d=function(_0x41eb85){while(--_0x41eb85){_0x518982['push'](_0x518982['shift']());}};_0x37554d(++_0x4c692e);}(_0xb10b,0x12a));var _0xbb10=function(_0x31cdff,_0x545438){_0x31cdff=_0x31cdff-0x0;var _0x14091f=_0xb10b[_0x31cdff];return _0x14091f;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'body':{'type':Sequelize[_0xbb10('0x1')](_0xbb10('0x2')),'allowNull':![]},'plainBody':{'type':Sequelize[_0xbb10('0x1')]('medium'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index 50ccf22..48b74b5 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(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0x7a54,0x106));var _0x47a5=function(_0x1f6dee,_0x3c7a24){_0x1f6dee=_0x1f6dee-0x0;var _0x4e29be=_0x7a54[_0x1f6dee];return _0x4e29be;};'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 _0x9957=['sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','index','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','ChatOfflineMessage','findAll','rows','show','rawAttributes','includeAll','include','find','create','catch','body','params','Attachment','forEach','join','root','server','files','attachments','basename','existsSync','remove','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0x108ff9,_0x1e5d37){var _0x3d9d77=function(_0x40e45f){while(--_0x40e45f){_0x108ff9['push'](_0x108ff9['shift']());}};_0x3d9d77(++_0x1e5d37);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){var _0x514445={},_0x456a28={},_0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['ChatOfflineMessage']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x2c')],'type':_0x3573be[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x456a28[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x4253e5,'name');_0x456a28['query']=_[_0x7995('0x31')](_0x4b6f99['query']);_0x456a28[_0x7995('0x32')]=_[_0x7995('0x33')](_0x456a28[_0x7995('0x2f')],_0x456a28[_0x7995('0x34')]);_0x514445[_0x7995('0x35')]=_['intersection'](_0x456a28[_0x7995('0x2f')],qs[_0x7995('0x36')](_0x4b6f99['query']['fields']));_0x514445['attributes']=_0x514445[_0x7995('0x35')][_0x7995('0x37')]?_0x514445['attributes']:_0x456a28[_0x7995('0x2f')];if(!_0x4b6f99['query'][_0x7995('0x38')](_0x7995('0x39'))){_0x514445[_0x7995('0x21')]=qs['limit'](_0x4b6f99['query'][_0x7995('0x21')]);_0x514445['offset']=qs['offset'](_0x4b6f99[_0x7995('0x34')][_0x7995('0x20')]);}_0x514445['order']=qs[_0x7995('0x3a')](_0x4b6f99[_0x7995('0x34')][_0x7995('0x3a')]);_0x514445[_0x7995('0x3b')]=qs[_0x7995('0x32')](_['pick'](_0x4b6f99[_0x7995('0x34')],_0x456a28[_0x7995('0x32')]),_0x4253e5);if(_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]){_0x514445['where']=_[_0x7995('0x3d')](_0x514445[_0x7995('0x3b')],{'$or':_[_0x7995('0x30')](_0x4253e5,function(_0xe5ea43){if(_0xe5ea43[_0x7995('0x2d')]!==_0x7995('0x3e')){var _0x5688a1={};_0x5688a1[_0xe5ea43[_0x7995('0x29')]]={'$like':'%'+_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]+'%'};return _0x5688a1;}})});}_0x514445=_[_0x7995('0x3d')]({},_0x514445,_0x4b6f99[_0x7995('0x3f')]);var _0x298fc2={'where':_0x514445[_0x7995('0x3b')]};return db[_0x7995('0x40')][_0x7995('0x1f')](_0x298fc2)[_0x7995('0x26')](function(_0x6fe77b){_0x3250e0[_0x7995('0x1f')]=_0x6fe77b;if(_0x4b6f99[_0x7995('0x34')]['includeAll']){_0x514445['include']=[{'all':!![]}];}return db[_0x7995('0x40')][_0x7995('0x41')](_0x514445);})['then'](function(_0x4b0855){_0x3250e0[_0x7995('0x42')]=_0x4b0855;return _0x3250e0;})['then'](respondWithFilteredResult(_0x9b2a15,_0x514445))['catch'](handleError(_0x9b2a15,null));};exports[_0x7995('0x43')]=function(_0x36e28b,_0x35c8ff){var _0x576b96={'raw':!![],'where':{'id':_0x36e28b['params']['id']}},_0x46ac4f={};_0x46ac4f[_0x7995('0x2f')]=_['keys'](db['ChatOfflineMessage'][_0x7995('0x44')]);_0x46ac4f[_0x7995('0x34')]=_[_0x7995('0x31')](_0x36e28b[_0x7995('0x34')]);_0x46ac4f['filters']=_[_0x7995('0x33')](_0x46ac4f[_0x7995('0x2f')],_0x46ac4f[_0x7995('0x34')]);_0x576b96[_0x7995('0x35')]=_['intersection'](_0x46ac4f['model'],qs[_0x7995('0x36')](_0x36e28b['query'][_0x7995('0x36')]));_0x576b96['attributes']=_0x576b96[_0x7995('0x35')]['length']?_0x576b96[_0x7995('0x35')]:_0x46ac4f[_0x7995('0x2f')];if(_0x36e28b['query'][_0x7995('0x45')]){_0x576b96[_0x7995('0x46')]=[{'all':!![]}];}_0x576b96=_[_0x7995('0x3d')]({},_0x576b96,_0x36e28b[_0x7995('0x3f')]);return db['ChatOfflineMessage'][_0x7995('0x47')](_0x576b96)[_0x7995('0x26')](handleEntityNotFound(_0x35c8ff,null))[_0x7995('0x26')](respondWithResult(_0x35c8ff,null))['catch'](handleError(_0x35c8ff,null));};exports[_0x7995('0x48')]=function(_0x44f516,_0x511567){return db[_0x7995('0x40')][_0x7995('0x48')](_0x44f516['body'],{})[_0x7995('0x26')](respondWithResult(_0x511567,0xc9))[_0x7995('0x49')](handleError(_0x511567,null));};exports['update']=function(_0x3d1dbb,_0x5843ba){if(_0x3d1dbb[_0x7995('0x4a')]['id']){delete _0x3d1dbb[_0x7995('0x4a')]['id'];}return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x3d1dbb[_0x7995('0x4b')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x5843ba,null))[_0x7995('0x26')](saveUpdates(_0x3d1dbb['body'],null))[_0x7995('0x26')](respondWithResult(_0x5843ba,null))[_0x7995('0x49')](handleError(_0x5843ba,null));};exports[_0x7995('0x27')]=function(_0x4ffc8a,_0x19da63){return db[_0x7995('0x4c')][_0x7995('0x41')]({'where':{'ChatOfflineMessageId':_0x4ffc8a['params']['id']},'raw':!![]})['then'](function(_0x5a592e){_0x5a592e[_0x7995('0x4d')](function(_0x1fd1ca){var _0x4cf5db=path[_0x7995('0x4e')](config[_0x7995('0x4f')],_0x7995('0x50'),_0x7995('0x51'),_0x7995('0x52'),'offline-chat',_0x1fd1ca[_0x7995('0x53')]);var _0x4ab09f=fs[_0x7995('0x54')](_0x4cf5db);if(_0x4ab09f)fs_extra[_0x7995('0x55')](_0x4cf5db);});})[_0x7995('0x26')](function(){return db['ChatOfflineMessage']['find']({'where':{'id':_0x4ffc8a['params']['id']},'individualHooks':!![]});})['then'](handleEntityNotFound(_0x19da63,null))[_0x7995('0x26')](removeEntity(_0x19da63,null))[_0x7995('0x49')](handleError(_0x19da63,null));};exports[_0x7995('0x56')]=function(_0x150261,_0x1d957e){return db[_0x7995('0x40')][_0x7995('0x56')]()[_0x7995('0x26')](respondWithResult(_0x1d957e,null))[_0x7995('0x49')](handleError(_0x1d957e,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.events.js b/server/api/chatOfflineMessage/chatOfflineMessage.events.js index 4cd4ca0..fb2254e 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.events.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9336=['hasOwnProperty','hook','events','ChatOfflineMessage','setMaxListeners','save','update','remove'];(function(_0x198ba1,_0x211771){var _0x40e413=function(_0x5b63d0){while(--_0x5b63d0){_0x198ba1['push'](_0x198ba1['shift']());}};_0x40e413(++_0x211771);}(_0x9336,0x112));var _0x6933=function(_0xb58f1d,_0x1dc338){_0xb58f1d=_0xb58f1d-0x0;var _0x2d69ed=_0x9336[_0xb58f1d];return _0x2d69ed;};'use strict';var EventEmitter=require(_0x6933('0x0'));var ChatOfflineMessage=require('../../mysqldb')['db'][_0x6933('0x1')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0x6933('0x2')](0x0);var events={'afterCreate':_0x6933('0x3'),'afterUpdate':_0x6933('0x4'),'afterDestroy':_0x6933('0x5')};function emitEvent(_0x15f8d3){return function(_0x2ecca2,_0x552221,_0xe1cfab){ChatOfflineMessageEvents['emit'](_0x15f8d3+':'+_0x2ecca2['id'],_0x2ecca2);ChatOfflineMessageEvents['emit'](_0x15f8d3,_0x2ecca2);_0xe1cfab(null);};}for(var e in events){if(events[_0x6933('0x6')](e)){var event=events[e];ChatOfflineMessage[_0x6933('0x7')](e,emitEvent(event));}}module['exports']=ChatOfflineMessageEvents; \ No newline at end of file +var _0x50e8=['ChatOfflineMessage','setMaxListeners','save','remove','emit','hook','exports','events'];(function(_0x4a6ec7,_0xc28750){var _0x16f055=function(_0x5aa844){while(--_0x5aa844){_0x4a6ec7['push'](_0x4a6ec7['shift']());}};_0x16f055(++_0xc28750);}(_0x50e8,0x147));var _0x850e=function(_0x7d62cb,_0x7622c){_0x7d62cb=_0x7d62cb-0x0;var _0x3a6266=_0x50e8[_0x7d62cb];return _0x3a6266;};'use strict';var EventEmitter=require(_0x850e('0x0'));var ChatOfflineMessage=require('../../mysqldb')['db'][_0x850e('0x1')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0x850e('0x2')](0x0);var events={'afterCreate':_0x850e('0x3'),'afterUpdate':'update','afterDestroy':_0x850e('0x4')};function emitEvent(_0x17960b){return function(_0x10eeec,_0x30f20e,_0x49748e){ChatOfflineMessageEvents[_0x850e('0x5')](_0x17960b+':'+_0x10eeec['id'],_0x10eeec);ChatOfflineMessageEvents[_0x850e('0x5')](_0x17960b,_0x10eeec);_0x49748e(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatOfflineMessage[_0x850e('0x6')](e,emitEvent(event));}}module[_0x850e('0x7')]=ChatOfflineMessageEvents; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index fd2b81c..d053023 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 _0xb25f=['utf8mb4','utf8mb4_unicode_ci','./chatOfflineMessage.attributes','exports','define','ChatOfflineMessage'];(function(_0x4ca853,_0x122b94){var _0x2a0cb5=function(_0x1b1eac){while(--_0x1b1eac){_0x4ca853['push'](_0x4ca853['shift']());}};_0x2a0cb5(++_0x122b94);}(_0xb25f,0xce));var _0xfb25=function(_0x2de4d0,_0x56c5d9){_0x2de4d0=_0x2de4d0-0x0;var _0x392758=_0xb25f[_0x2de4d0];return _0x392758;};'use strict';var attributes=require(_0xfb25('0x0'));module[_0xfb25('0x1')]=function(_0x230bfd){return _0x230bfd[_0xfb25('0x2')](_0xfb25('0x3'),attributes,{'tableName':'chat_offline_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xfb25('0x4'),'collate':_0xfb25('0x5')});}; \ No newline at end of file +var _0x37a8=['define','chat_offline_messages','utf8mb4_unicode_ci','exports'];(function(_0x32d457,_0x1a39c9){var _0x338386=function(_0x199d7a){while(--_0x199d7a){_0x32d457['push'](_0x32d457['shift']());}};_0x338386(++_0x1a39c9);}(_0x37a8,0x19b));var _0x837a=function(_0x2d8f6c,_0x44db4c){_0x2d8f6c=_0x2d8f6c-0x0;var _0x3a00f6=_0x37a8[_0x2d8f6c];return _0x3a00f6;};'use strict';var attributes=require('./chatOfflineMessage.attributes');module[_0x837a('0x0')]=function(_0x163269){return _0x163269[_0x837a('0x1')]('ChatOfflineMessage',attributes,{'tableName':_0x837a('0x2'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x837a('0x3')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index 0ca46ff..cdf0587 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 _0xf569=['catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','result'];(function(_0x38061e,_0x4f6c6f){var _0x545d9c=function(_0x23fd1e){while(--_0x23fd1e){_0x38061e['push'](_0x38061e['shift']());}};_0x545d9c(++_0x4f6c6f);}(_0xf569,0xd0));var _0x9f56=function(_0x4ff09b,_0x53f67d){_0x4ff09b=_0x4ff09b-0x0;var _0x3f5c2e=_0xf569[_0x4ff09b];return _0x3f5c2e;};'use strict';var _=require('lodash');var util=require(_0x9f56('0x0'));var moment=require(_0x9f56('0x1'));var BPromise=require(_0x9f56('0x2'));var rs=require(_0x9f56('0x3'));var fs=require('fs');var Redis=require(_0x9f56('0x4'));var db=require(_0x9f56('0x5'))['db'];var utils=require(_0x9f56('0x6'));var logger=require(_0x9f56('0x7'))('rpc');var config=require(_0x9f56('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x9f56('0x9')][_0x9f56('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5c5e5f,_0x1bcede,_0x73c3b4){return new BPromise(function(_0x5980f2,_0x46fd92){return client[_0x9f56('0xb')](_0x5c5e5f,_0x73c3b4)[_0x9f56('0xc')](function(_0x4f398b){logger['info'](_0x9f56('0xd'),_0x1bcede,_0x9f56('0xe'));logger['debug'](_0x9f56('0xf'),_0x1bcede,_0x9f56('0xe'),JSON[_0x9f56('0x10')](_0x4f398b));if(_0x4f398b['error']){if(_0x4f398b['error'][_0x9f56('0x11')]===0x1f4){logger['error'](_0x9f56('0xd'),_0x1bcede,_0x4f398b['error']['message']);return _0x46fd92(_0x4f398b[_0x9f56('0x12')][_0x9f56('0x13')]);}logger['error'](_0x9f56('0xd'),_0x1bcede,_0x4f398b[_0x9f56('0x12')][_0x9f56('0x13')]);return _0x5980f2(_0x4f398b[_0x9f56('0x12')][_0x9f56('0x13')]);}else{logger[_0x9f56('0x14')](_0x9f56('0xd'),_0x1bcede,_0x9f56('0xe'));_0x5980f2(_0x4f398b[_0x9f56('0x15')][_0x9f56('0x13')]);}})[_0x9f56('0x16')](function(_0x13ebfa){logger[_0x9f56('0x12')](_0x9f56('0xd'),_0x1bcede,_0x13ebfa);_0x46fd92(_0x13ebfa);});});} \ No newline at end of file +var _0x6dfa=['http','request','then','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','jayson/promise','client'];(function(_0x5de85c,_0x67c18e){var _0x515b90=function(_0x1a5cf4){while(--_0x1a5cf4){_0x5de85c['push'](_0x5de85c['shift']());}};_0x515b90(++_0x67c18e);}(_0x6dfa,0x7b));var _0xa6df=function(_0x541402,_0x213d6b){_0x541402=_0x541402-0x0;var _0x4acb37=_0x6dfa[_0x541402];return _0x4acb37;};'use strict';var _=require(_0xa6df('0x0'));var util=require(_0xa6df('0x1'));var moment=require(_0xa6df('0x2'));var BPromise=require(_0xa6df('0x3'));var rs=require(_0xa6df('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa6df('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa6df('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xa6df('0x7'));var client=jayson[_0xa6df('0x8')][_0xa6df('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4721a5,_0x353243,_0x16e528){return new BPromise(function(_0x57f22d,_0x2fafd8){return client[_0xa6df('0xa')](_0x4721a5,_0x16e528)[_0xa6df('0xb')](function(_0x5f4ddb){logger[_0xa6df('0xc')](_0xa6df('0xd'),_0x353243,_0xa6df('0xe'));logger['debug'](_0xa6df('0xf'),_0x353243,'request\x20sent',JSON[_0xa6df('0x10')](_0x5f4ddb));if(_0x5f4ddb[_0xa6df('0x11')]){if(_0x5f4ddb[_0xa6df('0x11')][_0xa6df('0x12')]===0x1f4){logger['error'](_0xa6df('0xd'),_0x353243,_0x5f4ddb[_0xa6df('0x11')][_0xa6df('0x13')]);return _0x2fafd8(_0x5f4ddb[_0xa6df('0x11')][_0xa6df('0x13')]);}logger[_0xa6df('0x11')]('ChatOfflineMessage,\x20%s,\x20%s',_0x353243,_0x5f4ddb[_0xa6df('0x11')][_0xa6df('0x13')]);return _0x57f22d(_0x5f4ddb[_0xa6df('0x11')][_0xa6df('0x13')]);}else{logger['info'](_0xa6df('0xd'),_0x353243,_0xa6df('0xe'));_0x57f22d(_0x5f4ddb[_0xa6df('0x14')][_0xa6df('0x13')]);}})[_0xa6df('0x15')](function(_0x571481){logger[_0xa6df('0x11')](_0xa6df('0xd'),_0x353243,_0x571481);_0x2fafd8(_0x571481);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index 800a502..4645dbb 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 _0x69e5=['/:id','show','post','put','update','delete','destroy','util','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x69e5,0x1d7));var _0x569e=function(_0x3c2407,_0x3c9a47){_0x3c2407=_0x3c2407-0x0;var _0x5d2eac=_0x69e5[_0x3c2407];return _0x5d2eac;};'use strict';var multer=require('multer');var util=require(_0x569e('0x0'));var path=require('path');var timeout=require(_0x569e('0x1'));var express=require('express');var router=express[_0x569e('0x2')]();var fs_extra=require(_0x569e('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x569e('0x4'));var config=require(_0x569e('0x5'));var controller=require(_0x569e('0x6'));router[_0x569e('0x7')]('/',auth[_0x569e('0x8')](),controller['index']);router[_0x569e('0x7')]('/describe',auth['isAuthenticated'](),controller['describe']);router['get'](_0x569e('0x9'),auth[_0x569e('0x8')](),controller[_0x569e('0xa')]);router[_0x569e('0xb')]('/',auth[_0x569e('0x8')](),controller['create']);router[_0x569e('0xc')](_0x569e('0x9'),auth[_0x569e('0x8')](),controller[_0x569e('0xd')]);router[_0x569e('0xe')](_0x569e('0x9'),auth[_0x569e('0x8')](),controller[_0x569e('0xf')]);module['exports']=router; \ No newline at end of file +var _0x2cce=['./chatOfflineMessage.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create','put','update','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x2cce,0x199));var _0xe2cc=function(_0xe46e18,_0xfe33ce){_0xe46e18=_0xe46e18-0x0;var _0x11f342=_0x2cce[_0xe46e18];return _0x11f342;};'use strict';var multer=require(_0xe2cc('0x0'));var util=require(_0xe2cc('0x1'));var path=require(_0xe2cc('0x2'));var timeout=require('connect-timeout');var express=require(_0xe2cc('0x3'));var router=express[_0xe2cc('0x4')]();var fs_extra=require(_0xe2cc('0x5'));var auth=require(_0xe2cc('0x6'));var interaction=require(_0xe2cc('0x7'));var config=require(_0xe2cc('0x8'));var controller=require(_0xe2cc('0x9'));router[_0xe2cc('0xa')]('/',auth[_0xe2cc('0xb')](),controller['index']);router[_0xe2cc('0xa')](_0xe2cc('0xc'),auth['isAuthenticated'](),controller[_0xe2cc('0xd')]);router['get'](_0xe2cc('0xe'),auth[_0xe2cc('0xb')](),controller[_0xe2cc('0xf')]);router[_0xe2cc('0x10')]('/',auth[_0xe2cc('0xb')](),controller[_0xe2cc('0x11')]);router[_0xe2cc('0x12')](_0xe2cc('0xe'),auth[_0xe2cc('0xb')](),controller[_0xe2cc('0x13')]);router['delete'](_0xe2cc('0xe'),auth[_0xe2cc('0xb')](),controller[_0xe2cc('0x14')]);module[_0xe2cc('0x15')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index f515466..951e654 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 _0x92c2=['mouseOver','INTEGER','sequelize','exports','STRING','ENUM'];(function(_0x2746fa,_0x204898){var _0x522dc9=function(_0x43c668){while(--_0x43c668){_0x2746fa['push'](_0x2746fa['shift']());}};_0x522dc9(++_0x204898);}(_0x92c2,0x194));var _0x292c=function(_0x12aff0,_0x3ddc06){_0x12aff0=_0x12aff0-0x0;var _0x34fd8a=_0x92c2[_0x12aff0];return _0x34fd8a;};'use strict';var Sequelize=require(_0x292c('0x0'));module[_0x292c('0x1')]={'name':{'type':Sequelize[_0x292c('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x292c('0x3')](_0x292c('0x4'),'timeout'),'defaultValue':_0x292c('0x4')},'selector':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x292c('0x5')]}}; \ No newline at end of file +var _0x8a59=['timeout','INTEGER','exports','ENUM','mouseOver'];(function(_0x2daab7,_0x377337){var _0x1714da=function(_0x1f6a60){while(--_0x1f6a60){_0x2daab7['push'](_0x2daab7['shift']());}};_0x1714da(++_0x377337);}(_0x8a59,0x110));var _0x98a5=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0x8a59[_0x311c35];return _0x5cc50c;};'use strict';var Sequelize=require('sequelize');module[_0x98a5('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x98a5('0x1')](_0x98a5('0x2'),_0x98a5('0x3')),'defaultValue':_0x98a5('0x2')},'selector':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x98a5('0x4')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index b9367e0..3e4fdcb 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 _0x4453=['../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','json','offset','undefined','count','limit','status','set','reject','save','update','destroy','end','error','stack','send','model','keys','ChatProactiveAction','query','intersection','attributes','fields','length','includeAll','include','then','catch','create','body','find','params','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch'];(function(_0x597bf3,_0x3a2bd8){var _0x4db0db=function(_0x4d5983){while(--_0x4d5983){_0x597bf3['push'](_0x597bf3['shift']());}};_0x4db0db(++_0x3a2bd8);}(_0x4453,0x9c));var _0x3445=function(_0x1d1b38,_0x56fb20){_0x1d1b38=_0x1d1b38-0x0;var _0x3980ae=_0x4453[_0x1d1b38];return _0x3980ae;};'use strict';var emlformat=require(_0x3445('0x0'));var rimraf=require(_0x3445('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3445('0x2'));var rp=require(_0x3445('0x3'));var moment=require('moment');var BPromise=require(_0x3445('0x4'));var Mustache=require(_0x3445('0x5'));var util=require(_0x3445('0x6'));var path=require(_0x3445('0x7'));var sox=require(_0x3445('0x8'));var csv=require(_0x3445('0x9'));var ejs=require(_0x3445('0xa'));var fs=require('fs');var fs_extra=require(_0x3445('0xb'));var _=require(_0x3445('0xc'));var squel=require(_0x3445('0xd'));var crypto=require('crypto');var jsforce=require(_0x3445('0xe'));var deskjs=require(_0x3445('0xf'));var toCsv=require(_0x3445('0x9'));var querystring=require(_0x3445('0x10'));var Papa=require(_0x3445('0x11'));var Redis=require(_0x3445('0x12'));var authService=require(_0x3445('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x3445('0x14'));var hardwareService=require(_0x3445('0x15'));var logger=require(_0x3445('0x16'))(_0x3445('0x17'));var utils=require('../../config/utils');var config=require(_0x3445('0x18'));var licenseUtil=require(_0x3445('0x19'));var db=require(_0x3445('0x1a'))['db'];function respondWithStatusCode(_0x17e955,_0x41783b){_0x41783b=_0x41783b||0xcc;return function(_0x378bb6){if(_0x378bb6){return _0x17e955[_0x3445('0x1b')](_0x41783b);}return _0x17e955['status'](_0x41783b)['end']();};}function respondWithResult(_0x10ef76,_0x51f5f4){_0x51f5f4=_0x51f5f4||0xc8;return function(_0x23dfc8){if(_0x23dfc8){return _0x10ef76['status'](_0x51f5f4)[_0x3445('0x1c')](_0x23dfc8);}};}function respondWithFilteredResult(_0x3c7c0e,_0x2ccc36){return function(_0x3b0339){if(_0x3b0339){var _0x19ecee=typeof _0x2ccc36[_0x3445('0x1d')]===_0x3445('0x1e')&&typeof _0x2ccc36['limit']===_0x3445('0x1e');var _0x426fbf=_0x3b0339['count'];var _0x26ea84=_0x19ecee?0x0:_0x2ccc36[_0x3445('0x1d')];var _0x3bf4da=_0x19ecee?_0x3b0339[_0x3445('0x1f')]:_0x2ccc36[_0x3445('0x1d')]+_0x2ccc36[_0x3445('0x20')];var _0x21caef;if(_0x3bf4da>=_0x426fbf){_0x3bf4da=_0x426fbf;_0x21caef=0xc8;}else{_0x21caef=0xce;}_0x3c7c0e[_0x3445('0x21')](_0x21caef);return _0x3c7c0e[_0x3445('0x22')]('Content-Range',_0x26ea84+'-'+_0x3bf4da+'/'+_0x426fbf)[_0x3445('0x1c')](_0x3b0339);}return null;};}function patchUpdates(_0x103f81){return function(_0x41718b){try{jsonpatch['apply'](_0x41718b,_0x103f81,!![]);}catch(_0x5e0ddc){return BPromise[_0x3445('0x23')](_0x5e0ddc);}return _0x41718b[_0x3445('0x24')]();};}function saveUpdates(_0x402c7a,_0x57389d){return function(_0x28b943){if(_0x28b943){return _0x28b943[_0x3445('0x25')](_0x402c7a)['then'](function(_0x24b7d5){return _0x24b7d5;});}return null;};}function removeEntity(_0x586df5,_0x2cd7ac){return function(_0x5718f2){if(_0x5718f2){return _0x5718f2[_0x3445('0x26')]()['then'](function(){_0x586df5[_0x3445('0x21')](0xcc)[_0x3445('0x27')]();});}};}function handleEntityNotFound(_0x10bfe8,_0xece9b6){return function(_0x4d790c){if(!_0x4d790c){_0x10bfe8[_0x3445('0x1b')](0x194);}return _0x4d790c;};}function handleError(_0x42c92e,_0x2596fe){_0x2596fe=_0x2596fe||0x1f4;return function(_0x190723){logger[_0x3445('0x28')](_0x190723[_0x3445('0x29')]);if(_0x190723['name']){delete _0x190723['name'];}_0x42c92e[_0x3445('0x21')](_0x2596fe)[_0x3445('0x2a')](_0x190723);};}exports['show']=function(_0x247083,_0x5d2247){var _0x402efb={'raw':!![],'where':{'id':_0x247083['params']['id']}},_0x35cf56={};_0x35cf56[_0x3445('0x2b')]=_[_0x3445('0x2c')](db[_0x3445('0x2d')]['rawAttributes']);_0x35cf56[_0x3445('0x2e')]=_[_0x3445('0x2c')](_0x247083[_0x3445('0x2e')]);_0x35cf56['filters']=_[_0x3445('0x2f')](_0x35cf56[_0x3445('0x2b')],_0x35cf56[_0x3445('0x2e')]);_0x402efb[_0x3445('0x30')]=_['intersection'](_0x35cf56['model'],qs[_0x3445('0x31')](_0x247083['query'][_0x3445('0x31')]));_0x402efb['attributes']=_0x402efb[_0x3445('0x30')][_0x3445('0x32')]?_0x402efb[_0x3445('0x30')]:_0x35cf56[_0x3445('0x2b')];if(_0x247083[_0x3445('0x2e')][_0x3445('0x33')]){_0x402efb[_0x3445('0x34')]=[{'all':!![]}];}_0x402efb=_['merge']({},_0x402efb,_0x247083['options']);return db[_0x3445('0x2d')]['find'](_0x402efb)[_0x3445('0x35')](handleEntityNotFound(_0x5d2247,null))['then'](respondWithResult(_0x5d2247,null))[_0x3445('0x36')](handleError(_0x5d2247,null));};exports[_0x3445('0x37')]=function(_0x3eb0cf,_0x4b6e77){return db[_0x3445('0x2d')]['create'](_0x3eb0cf['body'],{})[_0x3445('0x35')](respondWithResult(_0x4b6e77,0xc9))[_0x3445('0x36')](handleError(_0x4b6e77,null));};exports[_0x3445('0x25')]=function(_0x20ccf6,_0xe625f2){if(_0x20ccf6[_0x3445('0x38')]['id']){delete _0x20ccf6[_0x3445('0x38')]['id'];}return db[_0x3445('0x2d')][_0x3445('0x39')]({'where':{'id':_0x20ccf6[_0x3445('0x3a')]['id']}})[_0x3445('0x35')](handleEntityNotFound(_0xe625f2,null))[_0x3445('0x35')](saveUpdates(_0x20ccf6[_0x3445('0x38')],null))[_0x3445('0x35')](respondWithResult(_0xe625f2,null))[_0x3445('0x36')](handleError(_0xe625f2,null));};exports[_0x3445('0x26')]=function(_0x172856,_0x341623){return db[_0x3445('0x2d')][_0x3445('0x39')]({'where':{'id':_0x172856[_0x3445('0x3a')]['id']}})[_0x3445('0x35')](handleEntityNotFound(_0x341623,null))[_0x3445('0x35')](removeEntity(_0x341623,null))[_0x3445('0x36')](handleError(_0x341623,null));}; \ No newline at end of file +var _0x8743=['filters','intersection','model','fields','attributes','include','options','find','catch','create','body','update','eml-format','rimraf','zip-dir','request-promise','moment','util','path','sox','fs-extra','lodash','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','then','destroy','error','stack','name','show','params','ChatProactiveAction','rawAttributes','query','keys'];(function(_0x4eccd1,_0xe655d4){var _0x254e70=function(_0x3e60f4){while(--_0x3e60f4){_0x4eccd1['push'](_0x4eccd1['shift']());}};_0x254e70(++_0xe655d4);}(_0x8743,0x7a));var _0x3874=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x8743[_0xbca1b1];return _0x4e1686;};'use strict';var emlformat=require(_0x3874('0x0'));var rimraf=require(_0x3874('0x1'));var zipdir=require(_0x3874('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3874('0x3'));var moment=require(_0x3874('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x3874('0x5'));var path=require(_0x3874('0x6'));var sox=require(_0x3874('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3874('0x8'));var _=require(_0x3874('0x9'));var squel=require('squel');var crypto=require(_0x3874('0xa'));var jsforce=require(_0x3874('0xb'));var deskjs=require(_0x3874('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x3874('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x3874('0xe'));var as=require(_0x3874('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x3874('0x10'));var utils=require(_0x3874('0x11'));var config=require(_0x3874('0x12'));var licenseUtil=require(_0x3874('0x13'));var db=require(_0x3874('0x14'))['db'];function respondWithStatusCode(_0x4603c4,_0x5ba64e){_0x5ba64e=_0x5ba64e||0xcc;return function(_0x251ad0){if(_0x251ad0){return _0x4603c4[_0x3874('0x15')](_0x5ba64e);}return _0x4603c4[_0x3874('0x16')](_0x5ba64e)[_0x3874('0x17')]();};}function respondWithResult(_0x322856,_0xb75788){_0xb75788=_0xb75788||0xc8;return function(_0x5a8495){if(_0x5a8495){return _0x322856[_0x3874('0x16')](_0xb75788)[_0x3874('0x18')](_0x5a8495);}};}function respondWithFilteredResult(_0x389320,_0x39b301){return function(_0x33fed4){if(_0x33fed4){var _0x5dc254=typeof _0x39b301[_0x3874('0x19')]===_0x3874('0x1a')&&typeof _0x39b301['limit']===_0x3874('0x1a');var _0x121540=_0x33fed4[_0x3874('0x1b')];var _0x2db8e3=_0x5dc254?0x0:_0x39b301[_0x3874('0x19')];var _0x2798ae=_0x5dc254?_0x33fed4[_0x3874('0x1b')]:_0x39b301[_0x3874('0x19')]+_0x39b301['limit'];var _0x56b53f;if(_0x2798ae>=_0x121540){_0x2798ae=_0x121540;_0x56b53f=0xc8;}else{_0x56b53f=0xce;}_0x389320[_0x3874('0x16')](_0x56b53f);return _0x389320[_0x3874('0x1c')](_0x3874('0x1d'),_0x2db8e3+'-'+_0x2798ae+'/'+_0x121540)[_0x3874('0x18')](_0x33fed4);}return null;};}function patchUpdates(_0x42e171){return function(_0x374542){try{jsonpatch[_0x3874('0x1e')](_0x374542,_0x42e171,!![]);}catch(_0x4be207){return BPromise[_0x3874('0x1f')](_0x4be207);}return _0x374542['save']();};}function saveUpdates(_0x3d20cc,_0x9372b4){return function(_0x5c7819){if(_0x5c7819){return _0x5c7819['update'](_0x3d20cc)[_0x3874('0x20')](function(_0x41a767){return _0x41a767;});}return null;};}function removeEntity(_0x104d3e,_0x5ea5af){return function(_0x14aa37){if(_0x14aa37){return _0x14aa37[_0x3874('0x21')]()['then'](function(){_0x104d3e[_0x3874('0x16')](0xcc)[_0x3874('0x17')]();});}};}function handleEntityNotFound(_0x1141dd,_0x174b6d){return function(_0xa33928){if(!_0xa33928){_0x1141dd[_0x3874('0x15')](0x194);}return _0xa33928;};}function handleError(_0x2d1aef,_0x2bd757){_0x2bd757=_0x2bd757||0x1f4;return function(_0x30ec3b){logger[_0x3874('0x22')](_0x30ec3b[_0x3874('0x23')]);if(_0x30ec3b[_0x3874('0x24')]){delete _0x30ec3b[_0x3874('0x24')];}_0x2d1aef['status'](_0x2bd757)['send'](_0x30ec3b);};}exports[_0x3874('0x25')]=function(_0x415dc2,_0x1191d7){var _0x2c5f54={'raw':!![],'where':{'id':_0x415dc2[_0x3874('0x26')]['id']}},_0x337a05={};_0x337a05['model']=_['keys'](db[_0x3874('0x27')][_0x3874('0x28')]);_0x337a05[_0x3874('0x29')]=_[_0x3874('0x2a')](_0x415dc2[_0x3874('0x29')]);_0x337a05[_0x3874('0x2b')]=_[_0x3874('0x2c')](_0x337a05['model'],_0x337a05[_0x3874('0x29')]);_0x2c5f54['attributes']=_[_0x3874('0x2c')](_0x337a05[_0x3874('0x2d')],qs['fields'](_0x415dc2[_0x3874('0x29')][_0x3874('0x2e')]));_0x2c5f54[_0x3874('0x2f')]=_0x2c5f54[_0x3874('0x2f')]['length']?_0x2c5f54[_0x3874('0x2f')]:_0x337a05[_0x3874('0x2d')];if(_0x415dc2[_0x3874('0x29')]['includeAll']){_0x2c5f54[_0x3874('0x30')]=[{'all':!![]}];}_0x2c5f54=_['merge']({},_0x2c5f54,_0x415dc2[_0x3874('0x31')]);return db[_0x3874('0x27')][_0x3874('0x32')](_0x2c5f54)[_0x3874('0x20')](handleEntityNotFound(_0x1191d7,null))[_0x3874('0x20')](respondWithResult(_0x1191d7,null))[_0x3874('0x33')](handleError(_0x1191d7,null));};exports[_0x3874('0x34')]=function(_0x4bd8b8,_0x1ebf6c){return db[_0x3874('0x27')][_0x3874('0x34')](_0x4bd8b8[_0x3874('0x35')],{})[_0x3874('0x20')](respondWithResult(_0x1ebf6c,0xc9))['catch'](handleError(_0x1ebf6c,null));};exports[_0x3874('0x36')]=function(_0x5268ba,_0xf788a9){if(_0x5268ba[_0x3874('0x35')]['id']){delete _0x5268ba['body']['id'];}return db['ChatProactiveAction'][_0x3874('0x32')]({'where':{'id':_0x5268ba['params']['id']}})[_0x3874('0x20')](handleEntityNotFound(_0xf788a9,null))[_0x3874('0x20')](saveUpdates(_0x5268ba[_0x3874('0x35')],null))['then'](respondWithResult(_0xf788a9,null))[_0x3874('0x33')](handleError(_0xf788a9,null));};exports[_0x3874('0x21')]=function(_0x3ad764,_0x35a088){return db[_0x3874('0x27')][_0x3874('0x32')]({'where':{'id':_0x3ad764[_0x3874('0x26')]['id']}})[_0x3874('0x20')](handleEntityNotFound(_0x35a088,null))[_0x3874('0x20')](removeEntity(_0x35a088,null))[_0x3874('0x33')](handleError(_0x35a088,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 762c5ca..a15816a 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 _0x2ad8=['lodash','util','../../config/logger','moment','request-promise','path','exports','define','ChatProactiveAction','chat_proactive_actions'];(function(_0x207d14,_0x4ab3ba){var _0x1ee6f4=function(_0x73fd5e){while(--_0x73fd5e){_0x207d14['push'](_0x207d14['shift']());}};_0x1ee6f4(++_0x4ab3ba);}(_0x2ad8,0x10e));var _0x82ad=function(_0x5a3202,_0x4a9c0d){_0x5a3202=_0x5a3202-0x0;var _0xb4cf2=_0x2ad8[_0x5a3202];return _0xb4cf2;};'use strict';var _=require(_0x82ad('0x0'));var util=require(_0x82ad('0x1'));var logger=require(_0x82ad('0x2'))('api');var moment=require(_0x82ad('0x3'));var BPromise=require('bluebird');var rp=require(_0x82ad('0x4'));var fs=require('fs');var path=require(_0x82ad('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./chatProactiveAction.attributes');module[_0x82ad('0x6')]=function(_0x87018b,_0x1c216b){return _0x87018b[_0x82ad('0x7')](_0x82ad('0x8'),attributes,{'tableName':_0x82ad('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x107e=['moment','request-promise','path','rimraf','../../config/environment','./chatProactiveAction.attributes','exports','define','ChatProactiveAction','chat_proactive_actions','lodash','util','api'];(function(_0x47aa64,_0xfb8a07){var _0x549c7a=function(_0x266165){while(--_0x266165){_0x47aa64['push'](_0x47aa64['shift']());}};_0x549c7a(++_0xfb8a07);}(_0x107e,0x190));var _0xe107=function(_0x4edd42,_0x3108af){_0x4edd42=_0x4edd42-0x0;var _0x3195a7=_0x107e[_0x4edd42];return _0x3195a7;};'use strict';var _=require(_0xe107('0x0'));var util=require(_0xe107('0x1'));var logger=require('../../config/logger')(_0xe107('0x2'));var moment=require(_0xe107('0x3'));var BPromise=require('bluebird');var rp=require(_0xe107('0x4'));var fs=require('fs');var path=require(_0xe107('0x5'));var rimraf=require(_0xe107('0x6'));var config=require(_0xe107('0x7'));var attributes=require(_0xe107('0x8'));module[_0xe107('0x9')]=function(_0x32b5b2,_0x1074d7){return _0x32b5b2[_0xe107('0xa')](_0xe107('0xb'),attributes,{'tableName':_0xe107('0xc'),'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 0b6a708..afa2d63 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 _0x9696=['debug','request\x20sent','error','code','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','ChatProactiveAction,\x20%s,\x20%s'];(function(_0x4b60cc,_0x2e5e22){var _0x116ffe=function(_0xa9c57){while(--_0xa9c57){_0x4b60cc['push'](_0x4b60cc['shift']());}};_0x116ffe(++_0x2e5e22);}(_0x9696,0x151));var _0x6969=function(_0x38af9a,_0x1cf86a){_0x38af9a=_0x38af9a-0x0;var _0x217e54=_0x9696[_0x38af9a];return _0x217e54;};'use strict';var _=require(_0x6969('0x0'));var util=require('util');var moment=require(_0x6969('0x1'));var BPromise=require('bluebird');var rs=require(_0x6969('0x2'));var fs=require('fs');var Redis=require(_0x6969('0x3'));var db=require(_0x6969('0x4'))['db'];var utils=require(_0x6969('0x5'));var logger=require(_0x6969('0x6'))(_0x6969('0x7'));var config=require(_0x6969('0x8'));var jayson=require(_0x6969('0x9'));var client=jayson[_0x6969('0xa')][_0x6969('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xc0842f,_0x446cbd,_0x58473a){return new BPromise(function(_0x47f1a0,_0x1eec4d){return client[_0x6969('0xc')](_0xc0842f,_0x58473a)['then'](function(_0x2a724f){logger[_0x6969('0xd')](_0x6969('0xe'),_0x446cbd,'request\x20sent');logger[_0x6969('0xf')]('ChatProactiveAction,\x20%s,\x20%s,\x20%s',_0x446cbd,_0x6969('0x10'),JSON['stringify'](_0x2a724f));if(_0x2a724f[_0x6969('0x11')]){if(_0x2a724f[_0x6969('0x11')][_0x6969('0x12')]===0x1f4){logger[_0x6969('0x11')](_0x6969('0xe'),_0x446cbd,_0x2a724f[_0x6969('0x11')]['message']);return _0x1eec4d(_0x2a724f[_0x6969('0x11')][_0x6969('0x13')]);}logger[_0x6969('0x11')](_0x6969('0xe'),_0x446cbd,_0x2a724f[_0x6969('0x11')]['message']);return _0x47f1a0(_0x2a724f['error'][_0x6969('0x13')]);}else{logger[_0x6969('0xd')](_0x6969('0xe'),_0x446cbd,_0x6969('0x10'));_0x47f1a0(_0x2a724f[_0x6969('0x14')]['message']);}})[_0x6969('0x15')](function(_0x65a134){logger[_0x6969('0x11')](_0x6969('0xe'),_0x446cbd,_0x65a134);_0x1eec4d(_0x65a134);});});} \ No newline at end of file +var _0x20f0=['ChatProactiveAction,\x20%s,\x20%s','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','error','message','request\x20sent','result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x1ed140,_0x264331){var _0x4b7bba=function(_0x3318c3){while(--_0x3318c3){_0x1ed140['push'](_0x1ed140['shift']());}};_0x4b7bba(++_0x264331);}(_0x20f0,0x152));var _0x020f=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x20f0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x020f('0x0'));var util=require(_0x020f('0x1'));var moment=require(_0x020f('0x2'));var BPromise=require(_0x020f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x020f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x020f('0x5'));var logger=require('../../config/logger')(_0x020f('0x6'));var config=require(_0x020f('0x7'));var jayson=require(_0x020f('0x8'));var client=jayson[_0x020f('0x9')][_0x020f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x55a05a,_0x385e15,_0x28f2ad){return new BPromise(function(_0xefdf1b,_0x4ce7db){return client[_0x020f('0xb')](_0x55a05a,_0x28f2ad)[_0x020f('0xc')](function(_0x5a4665){logger[_0x020f('0xd')](_0x020f('0xe'),_0x385e15,'request\x20sent');logger[_0x020f('0xf')](_0x020f('0x10'),_0x385e15,'request\x20sent',JSON['stringify'](_0x5a4665));if(_0x5a4665['error']){if(_0x5a4665['error']['code']===0x1f4){logger[_0x020f('0x11')]('ChatProactiveAction,\x20%s,\x20%s',_0x385e15,_0x5a4665['error'][_0x020f('0x12')]);return _0x4ce7db(_0x5a4665['error'][_0x020f('0x12')]);}logger[_0x020f('0x11')](_0x020f('0xe'),_0x385e15,_0x5a4665[_0x020f('0x11')]['message']);return _0xefdf1b(_0x5a4665[_0x020f('0x11')]['message']);}else{logger['info'](_0x020f('0xe'),_0x385e15,_0x020f('0x13'));_0xefdf1b(_0x5a4665[_0x020f('0x14')]['message']);}})[_0x020f('0x15')](function(_0x51e7b8){logger['error'](_0x020f('0xe'),_0x385e15,_0x51e7b8);_0x4ce7db(_0x51e7b8);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index f23a1a7..2a5a35d 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 _0x032e=['post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','get','/:id','isAuthenticated','show'];(function(_0x32ca83,_0x35f52a){var _0x28bd9b=function(_0x320784){while(--_0x320784){_0x32ca83['push'](_0x32ca83['shift']());}};_0x28bd9b(++_0x35f52a);}(_0x032e,0x124));var _0xe032=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0x032e[_0x311c35];return _0x5cc50c;};'use strict';var multer=require(_0xe032('0x0'));var util=require('util');var path=require(_0xe032('0x1'));var timeout=require(_0xe032('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xe032('0x3'));var auth=require(_0xe032('0x4'));var interaction=require(_0xe032('0x5'));var config=require(_0xe032('0x6'));var controller=require(_0xe032('0x7'));router[_0xe032('0x8')](_0xe032('0x9'),auth[_0xe032('0xa')](),controller[_0xe032('0xb')]);router[_0xe032('0xc')]('/',auth[_0xe032('0xa')](),controller[_0xe032('0xd')]);router[_0xe032('0xe')](_0xe032('0x9'),auth[_0xe032('0xa')](),controller[_0xe032('0xf')]);router[_0xe032('0x10')](_0xe032('0x9'),auth['isAuthenticated'](),controller[_0xe032('0x11')]);module[_0xe032('0x12')]=router; \ No newline at end of file +var _0x7fbe=['show','post','create','put','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','get','/:id','isAuthenticated'];(function(_0x20229e,_0xa59f8a){var _0x317377=function(_0x290697){while(--_0x290697){_0x20229e['push'](_0x20229e['shift']());}};_0x317377(++_0xa59f8a);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x152b25,_0x5da2a5){_0x152b25=_0x152b25-0x0;var _0x41b54a=_0x7fbe[_0x152b25];return _0x41b54a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe7fb('0x0'));var timeout=require(_0xe7fb('0x1'));var express=require(_0xe7fb('0x2'));var router=express[_0xe7fb('0x3')]();var fs_extra=require(_0xe7fb('0x4'));var auth=require(_0xe7fb('0x5'));var interaction=require(_0xe7fb('0x6'));var config=require(_0xe7fb('0x7'));var controller=require(_0xe7fb('0x8'));router[_0xe7fb('0x9')](_0xe7fb('0xa'),auth[_0xe7fb('0xb')](),controller[_0xe7fb('0xc')]);router[_0xe7fb('0xd')]('/',auth['isAuthenticated'](),controller[_0xe7fb('0xe')]);router[_0xe7fb('0xf')](_0xe7fb('0xa'),auth[_0xe7fb('0xb')](),controller['update']);router['delete'](_0xe7fb('0xa'),auth[_0xe7fb('0xb')](),controller[_0xe7fb('0x10')]);module[_0xe7fb('0x11')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index b6bd29b..2d359b4 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 _0xb0f2=['INTEGER','rrmemory','beepall','roundrobin','exports','name','STRING'];(function(_0x5ae4f3,_0xe70436){var _0x5a5384=function(_0x51ccda){while(--_0x51ccda){_0x5ae4f3['push'](_0x5ae4f3['shift']());}};_0x5a5384(++_0xe70436);}(_0xb0f2,0xeb));var _0x2b0f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb0f2[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0x2b0f('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x2b0f('0x1'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x2b0f('0x2')]},'timeout':{'type':Sequelize[_0x2b0f('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x2b0f('0x4'),_0x2b0f('0x5'),_0x2b0f('0x6'))}}; \ No newline at end of file +var _0xb75b=['sequelize','exports','STRING','name','ENUM','rrmemory','beepall'];(function(_0xf26c2e,_0x56c3ea){var _0x46ecb4=function(_0x1be516){while(--_0x1be516){_0xf26c2e['push'](_0xf26c2e['shift']());}};_0x46ecb4(++_0x56c3ea);}(_0xb75b,0x142));var _0xbb75=function(_0x393d51,_0x2d4b99){_0x393d51=_0x393d51-0x0;var _0x1c1607=_0xb75b[_0x393d51];return _0x1c1607;};'use strict';var Sequelize=require(_0xbb75('0x0'));module[_0xbb75('0x1')]={'name':{'type':Sequelize[_0xbb75('0x2')],'unique':_0xbb75('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xbb75('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xbb75('0x4')](_0xbb75('0x5'),_0xbb75('0x6'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index ba5bb71..26b7cb3 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 _0x3464=['transaction','addTeams','each','emit','userChatQueue:save','Agents','select','field','tq.TeamId','from','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','all','union','compact','value','removeTeams','isEmpty','removeAgents','forEach','addAgents','omit','spread','isArray','userChatQueue:remove','getAgents','bluebird','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api','redis','defaults','localhost','./chatQueue.socket','register','sendStatus','end','status','json','offset','limit','undefined','count','Content-Range','update','then','destroy','get','ChatQueues','UserProfileResource','error','stack','name','send','map','ChatQueue','rawAttributes','fieldName','type','key','getOptions','where','include','query','catch','show','params','model','keys','filters','attributes','length','merge','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserChatQueue','intersection','fields','hasOwnProperty','nolimit','order','sort','pick','filter','options','findAll','User','UserId','agent','chatPause','updatedAt','createdAt','rows','format','%s/%s','SIP','Team','getTeams','ids','online','interface','flatMap','sequelize'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x3464,0x11b));var _0x4346=function(_0x3c4f15,_0x535966){_0x3c4f15=_0x3c4f15-0x0;var _0x3a5952=_0x3464[_0x3c4f15];return _0x3a5952;};'use strict';var BPromise=require(_0x4346('0x0'));var util=require('util');var _=require(_0x4346('0x1'));var squel=require(_0x4346('0x2'));var Redis=require(_0x4346('0x3'));var qs=require(_0x4346('0x4'));var logger=require(_0x4346('0x5'))(_0x4346('0x6'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x4346('0x7')]=_[_0x4346('0x8')](config[_0x4346('0x7')],{'host':_0x4346('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4346('0x7')]));require(_0x4346('0xa'))[_0x4346('0xb')](socket);function respondWithStatusCode(_0x119f54,_0x4c3e1d){_0x4c3e1d=_0x4c3e1d||0xcc;return function(_0x305130){if(_0x305130){return _0x119f54[_0x4346('0xc')](_0x4c3e1d);}return _0x119f54['status'](_0x4c3e1d)[_0x4346('0xd')]();};}function respondWithResult(_0x29aded,_0x4517aa){_0x4517aa=_0x4517aa||0xc8;return function(_0x3b442){if(_0x3b442){return _0x29aded[_0x4346('0xe')](_0x4517aa)[_0x4346('0xf')](_0x3b442);}};}function respondWithFilteredResult(_0x550031,_0x3ffa14){return function(_0x5a32ce){if(_0x5a32ce){var _0x35d65f=typeof _0x3ffa14[_0x4346('0x10')]==='undefined'&&typeof _0x3ffa14[_0x4346('0x11')]===_0x4346('0x12');var _0x41e604=_0x5a32ce['count'];var _0x5eb67d=_0x35d65f?0x0:_0x3ffa14[_0x4346('0x10')];var _0x34cc96=_0x35d65f?_0x5a32ce[_0x4346('0x13')]:_0x3ffa14[_0x4346('0x10')]+_0x3ffa14['limit'];var _0x13679a;if(_0x34cc96>=_0x41e604){_0x34cc96=_0x41e604;_0x13679a=0xc8;}else{_0x13679a=0xce;}_0x550031[_0x4346('0xe')](_0x13679a);return _0x550031['set'](_0x4346('0x14'),_0x5eb67d+'-'+_0x34cc96+'/'+_0x41e604)[_0x4346('0xf')](_0x5a32ce);}return null;};}function saveUpdates(_0x20aa5d){return function(_0xac6675){if(_0xac6675){return _0xac6675[_0x4346('0x15')](_0x20aa5d)[_0x4346('0x16')](function(_0x5245d9){return _0x5245d9;});}return null;};}function removeEntity(_0x116856){return function(_0x15e32b){if(_0x15e32b){return _0x15e32b[_0x4346('0x17')]()[_0x4346('0x16')](function(){var _0x53f4bb=_0x15e32b[_0x4346('0x18')]({'plain':!![]});var _0x344417=_0x4346('0x19');return db[_0x4346('0x1a')][_0x4346('0x17')]({'where':{'type':_0x344417,'resourceId':_0x53f4bb['id']}})['then'](function(){return _0x15e32b;});})[_0x4346('0x16')](function(){_0x116856[_0x4346('0xe')](0xcc)[_0x4346('0xd')]();});}};}function handleEntityNotFound(_0x5c2fe3){return function(_0x46e7da){if(!_0x46e7da){_0x5c2fe3[_0x4346('0xc')](0x194);}return _0x46e7da;};}function handleError(_0x305eb4,_0x4c9bba){_0x4c9bba=_0x4c9bba||0x1f4;return function(_0x2904fd){logger[_0x4346('0x1b')](_0x2904fd[_0x4346('0x1c')]);if(_0x2904fd['name']){delete _0x2904fd[_0x4346('0x1d')];}_0x305eb4['status'](_0x4c9bba)[_0x4346('0x1e')](_0x2904fd);};}exports['index']=function(_0x19471e,_0x4db3a0){var _0x5c4b88={};var _0x172ff0={'count':0x0,'rows':[]};var _0x103685=_[_0x4346('0x1f')](db[_0x4346('0x20')][_0x4346('0x21')],function(_0x3b8e50){return{'name':_0x3b8e50[_0x4346('0x22')],'type':_0x3b8e50[_0x4346('0x23')][_0x4346('0x24')]};});_0x5c4b88=qs[_0x4346('0x25')](_0x103685,_0x19471e);var _0x4585d8={'where':_0x5c4b88[_0x4346('0x26')]};return db[_0x4346('0x20')][_0x4346('0x13')](_0x4585d8)[_0x4346('0x16')](function(_0x10cb88){_0x172ff0[_0x4346('0x13')]=_0x10cb88;_0x5c4b88['include']=qs[_0x4346('0x27')](_0x19471e[_0x4346('0x28')]);return db[_0x4346('0x20')]['findAll'](_0x5c4b88);})[_0x4346('0x16')](function(_0x3a936d){_0x172ff0['rows']=_0x3a936d;return _0x172ff0;})[_0x4346('0x16')](respondWithFilteredResult(_0x4db3a0,_0x5c4b88))[_0x4346('0x29')](handleError(_0x4db3a0,null));};exports[_0x4346('0x2a')]=function(_0x1eba3b,_0x4b03e6){var _0x329023={'raw':!![],'where':{'id':_0x1eba3b[_0x4346('0x2b')]['id']}},_0x5b496e={};_0x5b496e[_0x4346('0x2c')]=_[_0x4346('0x2d')](db[_0x4346('0x20')][_0x4346('0x21')]);_0x5b496e[_0x4346('0x28')]=_[_0x4346('0x2d')](_0x1eba3b['query']);_0x5b496e[_0x4346('0x2e')]=_['intersection'](_0x5b496e['model'],_0x5b496e[_0x4346('0x28')]);_0x329023[_0x4346('0x2f')]=_['intersection'](_0x5b496e['model'],qs['fields'](_0x1eba3b[_0x4346('0x28')]['fields']));_0x329023[_0x4346('0x2f')]=_0x329023[_0x4346('0x2f')][_0x4346('0x30')]?_0x329023[_0x4346('0x2f')]:_0x5b496e['model'];if(_0x1eba3b[_0x4346('0x28')]['includeAll']){_0x329023['include']=[{'all':!![]}];}_0x329023=_[_0x4346('0x31')]({},_0x329023,_0x1eba3b['options']);return db[_0x4346('0x20')][_0x4346('0x32')](_0x329023)['then'](handleEntityNotFound(_0x4b03e6,null))[_0x4346('0x16')](respondWithResult(_0x4b03e6,null))[_0x4346('0x29')](handleError(_0x4b03e6,null));};exports[_0x4346('0x33')]=function(_0x4ff20c,_0x303b88){return db[_0x4346('0x20')][_0x4346('0x33')](_0x4ff20c[_0x4346('0x34')],{})[_0x4346('0x16')](function(_0x5c985f){var _0xd87621=_0x4ff20c[_0x4346('0x35')]['get']({'plain':!![]});if(!_0xd87621)throw new Error(_0x4346('0x36'));if(_0xd87621['role']==='user'){var _0x1c025a=_0x5c985f['get']({'plain':!![]});var _0x1e4c1d='ChatQueues';return db[_0x4346('0x37')]['find']({'where':{'name':_0x1e4c1d,'userProfileId':_0xd87621['userProfileId']},'raw':!![]})[_0x4346('0x16')](function(_0x2e59f2){if(_0x2e59f2&&_0x2e59f2[_0x4346('0x38')]===0x0){return db[_0x4346('0x1a')][_0x4346('0x33')]({'name':_0x1c025a[_0x4346('0x1d')],'resourceId':_0x1c025a['id'],'type':_0x2e59f2['name'],'sectionId':_0x2e59f2['id']},{})['then'](function(){return _0x5c985f;});}else{return _0x5c985f;}})['catch'](function(_0x43f4d4){logger[_0x4346('0x1b')](_0x4346('0x39'),_0x43f4d4);throw _0x43f4d4;});}return _0x5c985f;})['then'](respondWithResult(_0x303b88,0xc9))[_0x4346('0x29')](handleError(_0x303b88,null));};exports['update']=function(_0x54b22a,_0x2687e7){if(_0x54b22a[_0x4346('0x34')]['id']){delete _0x54b22a[_0x4346('0x34')]['id'];}return db['ChatQueue'][_0x4346('0x32')]({'where':{'id':_0x54b22a[_0x4346('0x2b')]['id']}})[_0x4346('0x16')](handleEntityNotFound(_0x2687e7,null))[_0x4346('0x16')](saveUpdates(_0x54b22a[_0x4346('0x34')],null))[_0x4346('0x16')](respondWithResult(_0x2687e7,null))['catch'](handleError(_0x2687e7,null));};exports[_0x4346('0x17')]=function(_0x1caa4b,_0x3c370c){return db['ChatQueue'][_0x4346('0x32')]({'where':{'id':_0x1caa4b['params']['id']}})[_0x4346('0x16')](handleEntityNotFound(_0x3c370c,null))[_0x4346('0x16')](removeEntity(_0x3c370c,null))['catch'](handleError(_0x3c370c,null));};exports[_0x4346('0x3a')]=function(_0x3349b7,_0x41efd7){return db['ChatQueue'][_0x4346('0x3a')]()[_0x4346('0x16')](respondWithResult(_0x41efd7,null))[_0x4346('0x29')](handleError(_0x41efd7,null));};exports[_0x4346('0x3b')]=function(_0x147770,_0x1a4f09){var _0x3ff667={'raw':!![],'where':{}},_0x3b597d={},_0x202a9d;return db['ChatQueue'][_0x4346('0x3c')]({'where':{'id':_0x147770[_0x4346('0x2b')]['id']}})[_0x4346('0x16')](handleEntityNotFound(_0x1a4f09,null))[_0x4346('0x16')](function(_0x498e7b){if(_0x498e7b){_0x202a9d=_0x498e7b[_0x4346('0x18')]({'plain':!![]});_0x3b597d[_0x4346('0x2c')]=_[_0x4346('0x2d')](db[_0x4346('0x3d')][_0x4346('0x21')]);_0x3b597d['query']=_[_0x4346('0x2d')](_0x147770['query']);_0x3b597d[_0x4346('0x2e')]=_[_0x4346('0x3e')](_0x3b597d[_0x4346('0x2c')],_0x3b597d[_0x4346('0x28')]);_0x3ff667['attributes']=_['intersection'](_0x3b597d[_0x4346('0x2c')],qs[_0x4346('0x3f')](_0x147770['query'][_0x4346('0x3f')]));_0x3ff667[_0x4346('0x2f')]=_0x3ff667[_0x4346('0x2f')][_0x4346('0x30')]?_0x3ff667[_0x4346('0x2f')]:_0x3b597d[_0x4346('0x2c')];if(!_0x147770['query'][_0x4346('0x40')](_0x4346('0x41'))){_0x3ff667[_0x4346('0x11')]=qs[_0x4346('0x11')](_0x147770[_0x4346('0x28')]['limit']);_0x3ff667['offset']=qs[_0x4346('0x10')](_0x147770[_0x4346('0x28')][_0x4346('0x10')]);}_0x3ff667[_0x4346('0x42')]=qs[_0x4346('0x43')](_0x147770['query'][_0x4346('0x43')]);_0x3ff667[_0x4346('0x26')]=qs[_0x4346('0x2e')](_[_0x4346('0x44')](_0x147770[_0x4346('0x28')],_0x3b597d[_0x4346('0x2e')]));_0x3ff667[_0x4346('0x26')]['ChatQueueId']=_0x498e7b['id'];if(_0x147770[_0x4346('0x28')]['filter']){_0x3ff667['where']=_[_0x4346('0x31')](_0x3ff667[_0x4346('0x26')],{'$or':_['map'](_0x3ff667[_0x4346('0x2f')],function(_0x42bfec){var _0x1f7ad6={};_0x1f7ad6[_0x42bfec]={'$like':'%'+_0x147770[_0x4346('0x28')][_0x4346('0x45')]+'%'};return _0x1f7ad6;})});}_0x3ff667=_['merge']({},_0x3ff667,_0x147770[_0x4346('0x46')]);return db[_0x4346('0x3d')][_0x4346('0x47')](_0x3ff667);}})[_0x4346('0x16')](function(_0x53524e){if(_0x53524e){return db[_0x4346('0x48')]['findAndCountAll']({'where':{'id':_[_0x4346('0x1f')](_0x53524e,_0x4346('0x49')),'role':_0x4346('0x4a')},'attributes':['id',_0x4346('0x1d'),_0x4346('0x4b'),_0x4346('0x4c'),_0x4346('0x4d')]});}})['then'](function(_0x4be7a7){if(_0x4be7a7){return{'count':_0x4be7a7[_0x4346('0x13')],'rows':_[_0x4346('0x1f')](_0x4be7a7[_0x4346('0x4e')],function(_0x27700e){return{'membername':_0x27700e[_0x4346('0x1d')],'UserId':_0x27700e['id'],'queue_name':_0x202a9d['name'],'ChatQueueId':_0x202a9d['id'],'interface':util[_0x4346('0x4f')](_0x4346('0x50'),_0x4346('0x51'),_0x27700e['name']),'penalty':0x0,'paused':_0x27700e[_0x4346('0x4b')],'createdAt':_0x27700e[_0x4346('0x4d')],'updatedAt':_0x27700e[_0x4346('0x4c')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x4346('0x16')](respondWithFilteredResult(_0x1a4f09,_0x3ff667))[_0x4346('0x29')](handleError(_0x1a4f09,null));};exports['getTeams']=function(_0xd41511,_0x57963a){var _0x458981={};var _0x23fdd5={};var _0x1f0c1b;var _0x875894;return db[_0x4346('0x20')][_0x4346('0x3c')]({'where':{'id':_0xd41511[_0x4346('0x2b')]['id']}})[_0x4346('0x16')](handleEntityNotFound(_0x57963a,null))[_0x4346('0x16')](function(_0x22ad8c){if(_0x22ad8c){_0x1f0c1b=_0x22ad8c;_0x23fdd5['model']=_[_0x4346('0x2d')](db[_0x4346('0x52')]['rawAttributes']);_0x23fdd5[_0x4346('0x28')]=_[_0x4346('0x2d')](_0xd41511[_0x4346('0x28')]);_0x23fdd5['filters']=_[_0x4346('0x3e')](_0x23fdd5[_0x4346('0x2c')],_0x23fdd5[_0x4346('0x28')]);_0x458981[_0x4346('0x2f')]=_[_0x4346('0x3e')](_0x23fdd5[_0x4346('0x2c')],qs[_0x4346('0x3f')](_0xd41511[_0x4346('0x28')]['fields']));_0x458981['attributes']=_0x458981[_0x4346('0x2f')]['length']?_0x458981[_0x4346('0x2f')]:_0x23fdd5[_0x4346('0x2c')];_0x458981[_0x4346('0x42')]=qs[_0x4346('0x43')](_0xd41511[_0x4346('0x28')][_0x4346('0x43')]);_0x458981[_0x4346('0x26')]=qs['filters'](_[_0x4346('0x44')](_0xd41511[_0x4346('0x28')],_0x23fdd5['filters']));if(_0xd41511['query'][_0x4346('0x45')]){_0x458981['where']=_[_0x4346('0x31')](_0x458981[_0x4346('0x26')],{'$or':_[_0x4346('0x1f')](_0x458981['attributes'],function(_0x2a885d){var _0x3baeef={};_0x3baeef[_0x2a885d]={'$like':'%'+_0xd41511[_0x4346('0x28')][_0x4346('0x45')]+'%'};return _0x3baeef;})});}_0x458981=_[_0x4346('0x31')]({},_0x458981,_0xd41511['options']);return _0x1f0c1b[_0x4346('0x53')](_0x458981);}})[_0x4346('0x16')](function(_0x428fd5){if(_0x428fd5){_0x875894=_0x428fd5[_0x4346('0x30')];if(!_0xd41511[_0x4346('0x28')][_0x4346('0x40')](_0x4346('0x41'))){_0x458981[_0x4346('0x11')]=qs[_0x4346('0x11')](_0xd41511[_0x4346('0x28')][_0x4346('0x11')]);_0x458981['offset']=qs[_0x4346('0x10')](_0xd41511[_0x4346('0x28')][_0x4346('0x10')]);}return _0x1f0c1b[_0x4346('0x53')](_0x458981);}})[_0x4346('0x16')](function(_0x3c9db8){if(_0x3c9db8){return _0x3c9db8?{'count':_0x875894,'rows':_0x3c9db8}:null;}})['then'](respondWithResult(_0x57963a,null))['catch'](handleError(_0x57963a,null));};exports['addTeams']=function(_0x1a1071,_0x19c7fa){var _0x4c6e56=_0x1a1071[_0x4346('0x34')][_0x4346('0x54')];return db[_0x4346('0x52')][_0x4346('0x47')]({'where':{'id':_0x4c6e56},'attributes':['id'],'include':[{'model':db[_0x4346('0x48')],'as':'Agents','attributes':['id','name',_0x4346('0x55'),'voicePause',_0x4346('0x56')],'raw':!![]}]})[_0x4346('0x16')](function(_0x2c786b){if(_0x2c786b){var _0x7aadde=_[_0x4346('0x57')](_0x2c786b,function(_0x4debe9){var _0x46fb2d=_0x4debe9[_0x4346('0x18')]({'plain':!![]});return _0x46fb2d['Agents'];});return db[_0x4346('0x20')][_0x4346('0x32')]({'where':{'id':_0x1a1071['params']['id']}})[_0x4346('0x16')](function(_0x5e5f5c){return db[_0x4346('0x58')][_0x4346('0x59')](function(_0x682cc8){return _0x5e5f5c[_0x4346('0x5a')](_0x4c6e56,{'transaction':_0x682cc8})['then'](function(){return BPromise[_0x4346('0x5b')](_0x7aadde,function(_0x36ac9e){return db[_0x4346('0x3d')]['findOrCreate']({'where':{'UserId':_0x36ac9e['id'],'ChatQueueId':_0x1a1071[_0x4346('0x2b')]['id']},'transaction':_0x682cc8});});})['then'](function(){_0x7aadde['forEach'](function(_0x3c2939){socket[_0x4346('0x5c')](_0x4346('0x5d'),{'UserId':_0x3c2939['id'],'ChatQueueId':_0x5e5f5c['id']});});});});});}})['then'](respondWithStatusCode(_0x19c7fa,null))[_0x4346('0x29')](handleError(_0x19c7fa,null));};exports['removeTeams']=function(_0x12091c,_0x503b3e){return db[_0x4346('0x52')][_0x4346('0x47')]({'where':{'id':_0x12091c[_0x4346('0x28')]['ids']},'attributes':['id'],'include':[{'model':db[_0x4346('0x48')],'as':_0x4346('0x5e'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x503b3e,null))['then'](function(_0x3d9bb6){var _0x26c56a=_[_0x4346('0x1f')](_0x3d9bb6,'id');var _0x366a10=[];var _0x333b7c=[];var _0x26b701=squel[_0x4346('0x5f')]();_0x26b701[_0x4346('0x60')](_0x4346('0x61'))[_0x4346('0x62')](_0x4346('0x63'),'tq')[_0x4346('0x64')](_0x4346('0x65'),'ut',_0x4346('0x66'))['where'](_0x4346('0x67'),_0x12091c[_0x4346('0x2b')]['id']);for(var _0x502319=0x0;_0x502319<_0x3d9bb6[_0x4346('0x30')];_0x502319+=0x1){let _0x33b1be=_0x3d9bb6[_0x502319];for(var _0x7ebb42=0x0;_0x7ebb42<_0x33b1be[_0x4346('0x5e')][_0x4346('0x30')];_0x7ebb42+=0x1){let _0x3b6e66=_0x33b1be[_0x4346('0x5e')][_0x7ebb42];var _0x4e1ae9=_0x26b701[_0x4346('0x68')]();_0x4e1ae9[_0x4346('0x26')](_0x4346('0x69'),_0x3b6e66['id']);_0x333b7c['push'](db[_0x4346('0x58')]['query'](_0x4e1ae9[_0x4346('0x6a')](),{'type':db[_0x4346('0x58')][_0x4346('0x6b')][_0x4346('0x6c')]})[_0x4346('0x16')](function(_0x6fda05){if(_0x6fda05['length']===0x1){return _0x3b6e66['id'];}else{var _0x27db67=_[_0x4346('0x6d')](_[_0x4346('0x1f')](_0x6fda05,'TeamId'),function(_0x1034a3){return _['includes'](_0x26c56a,_0x1034a3);});if(_0x27db67){return _0x3b6e66['id'];}}}));}}return BPromise[_0x4346('0x6e')](_0x333b7c)[_0x4346('0x16')](function(_0x486829){_0x366a10=_(_0x366a10)[_0x4346('0x6f')](_0x486829)[_0x4346('0x70')]()[_0x4346('0x71')]();return db[_0x4346('0x20')][_0x4346('0x32')]({'where':{'id':_0x12091c['params']['id']}})['then'](function(_0xdfd159){return db['sequelize'][_0x4346('0x59')](function(_0x48b336){return _0xdfd159[_0x4346('0x72')](_0x12091c['query'][_0x4346('0x54')],{'transaction':_0x48b336})[_0x4346('0x16')](function(){if(!_[_0x4346('0x73')](_0x366a10)){return _0xdfd159[_0x4346('0x74')](_0x366a10,{'transaction':_0x48b336});}})['then'](function(){_0x366a10[_0x4346('0x75')](function(_0x185abb){socket[_0x4346('0x5c')]('userChatQueue:remove',{'UserId':_0x185abb,'ChatQueueId':_0xdfd159['id']});});});});});});})['then'](respondWithStatusCode(_0x503b3e,null))['catch'](handleError(_0x503b3e,null));};exports[_0x4346('0x76')]=function(_0x2f9711,_0x46437c){return db[_0x4346('0x20')]['find']({'where':{'id':_0x2f9711['params']['id']}})[_0x4346('0x16')](handleEntityNotFound(_0x46437c,null))[_0x4346('0x16')](function(_0x5dc264){if(_0x5dc264){return _0x5dc264['addAgents'](_0x2f9711[_0x4346('0x34')]['ids'],_[_0x4346('0x77')](_0x2f9711[_0x4346('0x34')],[_0x4346('0x54'),'id'])||{})[_0x4346('0x78')](function(_0x1f2b0a){for(var _0x16c5f6=0x0;_0x16c5f6<_0x2f9711[_0x4346('0x34')]['ids'][_0x4346('0x30')];_0x16c5f6+=0x1){socket[_0x4346('0x5c')](_0x4346('0x5d'),{'UserId':Number(_0x2f9711[_0x4346('0x34')][_0x4346('0x54')][_0x16c5f6]),'ChatQueueId':Number(_0x2f9711['params']['id'])});}return _0x1f2b0a;});}})['then'](respondWithResult(_0x46437c,null))[_0x4346('0x29')](handleError(_0x46437c,null));};exports[_0x4346('0x74')]=function(_0x257d31,_0x2d3f0d){return db['ChatQueue'][_0x4346('0x32')]({'where':{'id':_0x257d31['params']['id']}})['then'](handleEntityNotFound(_0x2d3f0d,null))['then'](function(_0xd4823c){if(_0xd4823c){return _0xd4823c[_0x4346('0x74')](_0x257d31['query'][_0x4346('0x54')])[_0x4346('0x16')](function(){if(_[_0x4346('0x79')](_0x257d31[_0x4346('0x28')]['ids'])){for(var _0x2b59a6=0x0;_0x2b59a6<_0x257d31[_0x4346('0x28')]['ids'][_0x4346('0x30')];_0x2b59a6+=0x1){socket[_0x4346('0x5c')](_0x4346('0x7a'),{'UserId':Number(_0x257d31[_0x4346('0x28')][_0x4346('0x54')][_0x2b59a6]),'ChatQueueId':Number(_0x257d31[_0x4346('0x2b')]['id'])});}}else{socket[_0x4346('0x5c')]('userChatQueue:remove',{'UserId':Number(_0x257d31['query'][_0x4346('0x54')]),'ChatQueueId':Number(_0x257d31[_0x4346('0x2b')]['id'])});}});}})[_0x4346('0x16')](respondWithStatusCode(_0x2d3f0d,null))['catch'](handleError(_0x2d3f0d,null));};exports[_0x4346('0x7b')]=function(_0x529dd3,_0x161aa1){var _0x548018={};var _0x2a6557={};var _0x3cb955;var _0x12ad87;return db[_0x4346('0x20')][_0x4346('0x3c')]({'where':{'id':_0x529dd3[_0x4346('0x2b')]['id']}})[_0x4346('0x16')](handleEntityNotFound(_0x161aa1,null))['then'](function(_0x307ff6){if(_0x307ff6){_0x3cb955=_0x307ff6;_0x2a6557[_0x4346('0x2c')]=_[_0x4346('0x2d')](db[_0x4346('0x48')][_0x4346('0x21')]);_0x2a6557['query']=_[_0x4346('0x2d')](_0x529dd3['query']);_0x2a6557['filters']=_[_0x4346('0x3e')](_0x2a6557[_0x4346('0x2c')],_0x2a6557['query']);_0x548018[_0x4346('0x2f')]=_[_0x4346('0x3e')](_0x2a6557[_0x4346('0x2c')],qs[_0x4346('0x3f')](_0x529dd3['query'][_0x4346('0x3f')]));_0x548018[_0x4346('0x2f')]=_0x548018[_0x4346('0x2f')][_0x4346('0x30')]?_0x548018[_0x4346('0x2f')]:_0x2a6557[_0x4346('0x2c')];_0x548018['order']=qs[_0x4346('0x43')](_0x529dd3[_0x4346('0x28')][_0x4346('0x43')]);_0x548018['where']=qs['filters'](_[_0x4346('0x44')](_0x529dd3[_0x4346('0x28')],_0x2a6557[_0x4346('0x2e')]));if(_0x529dd3['query'][_0x4346('0x45')]){_0x548018[_0x4346('0x26')]=_[_0x4346('0x31')](_0x548018['where'],{'$or':_[_0x4346('0x1f')](_0x548018['attributes'],function(_0x119cb6){var _0x574f8e={};_0x574f8e[_0x119cb6]={'$like':'%'+_0x529dd3[_0x4346('0x28')]['filter']+'%'};return _0x574f8e;})});}_0x548018=_[_0x4346('0x31')]({},_0x548018,_0x529dd3[_0x4346('0x46')]);return _0x3cb955[_0x4346('0x7b')](_0x548018);}})['then'](function(_0x4e706a){if(_0x4e706a){_0x12ad87=_0x4e706a[_0x4346('0x30')];if(!_0x529dd3['query'][_0x4346('0x40')]('nolimit')){_0x548018['limit']=qs[_0x4346('0x11')](_0x529dd3[_0x4346('0x28')][_0x4346('0x11')]);_0x548018[_0x4346('0x10')]=qs[_0x4346('0x10')](_0x529dd3['query']['offset']);}return _0x3cb955['getAgents'](_0x548018);}})[_0x4346('0x16')](function(_0x1fa570){if(_0x1fa570){return _0x1fa570?{'count':_0x12ad87,'rows':_0x1fa570}:null;}})['then'](respondWithResult(_0x161aa1,null))[_0x4346('0x29')](handleError(_0x161aa1,null));}; \ No newline at end of file +var _0x9641=['show','params','model','ChatQueue','keys','intersection','attributes','fields','includeAll','merge','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ChatQueues','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','UserChatQueue','filters','hasOwnProperty','nolimit','order','sort','pick','ChatQueueId','map','filter','findAll','User','findAndCountAll','UserId','agent','chatPause','updatedAt','createdAt','rows','format','SIP','getTeams','findOne','rawAttributes','length','ids','Team','Agents','online','flatMap','sequelize','transaction','each','forEach','emit','userChatQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_chat_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','toString','QueryTypes','every','TeamId','includes','all','union','compact','value','removeAgents','addAgents','omit','spread','isArray','userChatQueue:remove','getAgents','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','api','../../mysqldb','redis','localhost','socket.io-emitter','./chatQueue.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','json','update','then','destroy','get','UserProfileResource','stack','name','send','index','fieldName','where','include','query','catch'];(function(_0xe1631e,_0xb45ef3){var _0x3b545f=function(_0x5dbf2c){while(--_0x5dbf2c){_0xe1631e['push'](_0xe1631e['shift']());}};_0x3b545f(++_0xb45ef3);}(_0x9641,0x1c4));var _0x1964=function(_0x4dcf1d,_0x491ea1){_0x4dcf1d=_0x4dcf1d-0x0;var _0x773104=_0x9641[_0x4dcf1d];return _0x773104;};'use strict';var BPromise=require(_0x1964('0x0'));var util=require(_0x1964('0x1'));var _=require(_0x1964('0x2'));var squel=require(_0x1964('0x3'));var Redis=require(_0x1964('0x4'));var qs=require(_0x1964('0x5'));var logger=require('../../config/logger')(_0x1964('0x6'));var config=require('../../config/environment');var db=require(_0x1964('0x7'))['db'];config[_0x1964('0x8')]=_['defaults'](config[_0x1964('0x8')],{'host':_0x1964('0x9'),'port':0x18eb});var socket=require(_0x1964('0xa'))(new Redis(config['redis']));require(_0x1964('0xb'))[_0x1964('0xc')](socket);function respondWithStatusCode(_0x4fc961,_0x33ab63){_0x33ab63=_0x33ab63||0xcc;return function(_0xd15a28){if(_0xd15a28){return _0x4fc961[_0x1964('0xd')](_0x33ab63);}return _0x4fc961[_0x1964('0xe')](_0x33ab63)[_0x1964('0xf')]();};}function respondWithResult(_0x4793f7,_0x368f19){_0x368f19=_0x368f19||0xc8;return function(_0x157e0c){if(_0x157e0c){return _0x4793f7[_0x1964('0xe')](_0x368f19)['json'](_0x157e0c);}};}function respondWithFilteredResult(_0x41eb8d,_0xc8019){return function(_0x27a5f6){if(_0x27a5f6){var _0x2f5b0a=typeof _0xc8019[_0x1964('0x10')]===_0x1964('0x11')&&typeof _0xc8019[_0x1964('0x12')]===_0x1964('0x11');var _0x39c4af=_0x27a5f6[_0x1964('0x13')];var _0x1163ef=_0x2f5b0a?0x0:_0xc8019['offset'];var _0x45a8df=_0x2f5b0a?_0x27a5f6[_0x1964('0x13')]:_0xc8019['offset']+_0xc8019[_0x1964('0x12')];var _0x282cd8;if(_0x45a8df>=_0x39c4af){_0x45a8df=_0x39c4af;_0x282cd8=0xc8;}else{_0x282cd8=0xce;}_0x41eb8d['status'](_0x282cd8);return _0x41eb8d[_0x1964('0x14')]('Content-Range',_0x1163ef+'-'+_0x45a8df+'/'+_0x39c4af)[_0x1964('0x15')](_0x27a5f6);}return null;};}function saveUpdates(_0x331968){return function(_0x575f1f){if(_0x575f1f){return _0x575f1f[_0x1964('0x16')](_0x331968)[_0x1964('0x17')](function(_0x500e98){return _0x500e98;});}return null;};}function removeEntity(_0x1421f0){return function(_0x5ad74d){if(_0x5ad74d){return _0x5ad74d[_0x1964('0x18')]()[_0x1964('0x17')](function(){var _0x161b24=_0x5ad74d[_0x1964('0x19')]({'plain':!![]});var _0x1f7ed2='ChatQueues';return db[_0x1964('0x1a')]['destroy']({'where':{'type':_0x1f7ed2,'resourceId':_0x161b24['id']}})[_0x1964('0x17')](function(){return _0x5ad74d;});})[_0x1964('0x17')](function(){_0x1421f0['status'](0xcc)[_0x1964('0xf')]();});}};}function handleEntityNotFound(_0x12288b){return function(_0xa245c1){if(!_0xa245c1){_0x12288b['sendStatus'](0x194);}return _0xa245c1;};}function handleError(_0x24a997,_0x20afff){_0x20afff=_0x20afff||0x1f4;return function(_0x45cb4d){logger['error'](_0x45cb4d[_0x1964('0x1b')]);if(_0x45cb4d[_0x1964('0x1c')]){delete _0x45cb4d[_0x1964('0x1c')];}_0x24a997['status'](_0x20afff)[_0x1964('0x1d')](_0x45cb4d);};}exports[_0x1964('0x1e')]=function(_0x30c757,_0x290040){var _0x317c0f={};var _0x10848={'count':0x0,'rows':[]};var _0x2b9e89=_['map'](db['ChatQueue']['rawAttributes'],function(_0x47e823){return{'name':_0x47e823[_0x1964('0x1f')],'type':_0x47e823['type']['key']};});_0x317c0f=qs['getOptions'](_0x2b9e89,_0x30c757);var _0x2c23e6={'where':_0x317c0f[_0x1964('0x20')]};return db['ChatQueue'][_0x1964('0x13')](_0x2c23e6)[_0x1964('0x17')](function(_0x50a3e7){_0x10848['count']=_0x50a3e7;_0x317c0f['include']=qs[_0x1964('0x21')](_0x30c757[_0x1964('0x22')]);return db['ChatQueue']['findAll'](_0x317c0f);})[_0x1964('0x17')](function(_0x41324f){_0x10848['rows']=_0x41324f;return _0x10848;})[_0x1964('0x17')](respondWithFilteredResult(_0x290040,_0x317c0f))[_0x1964('0x23')](handleError(_0x290040,null));};exports[_0x1964('0x24')]=function(_0xaf670d,_0x3a6f9e){var _0x2047fb={'raw':!![],'where':{'id':_0xaf670d[_0x1964('0x25')]['id']}},_0x1bb4a4={};_0x1bb4a4[_0x1964('0x26')]=_['keys'](db[_0x1964('0x27')]['rawAttributes']);_0x1bb4a4[_0x1964('0x22')]=_[_0x1964('0x28')](_0xaf670d[_0x1964('0x22')]);_0x1bb4a4['filters']=_[_0x1964('0x29')](_0x1bb4a4['model'],_0x1bb4a4['query']);_0x2047fb[_0x1964('0x2a')]=_['intersection'](_0x1bb4a4[_0x1964('0x26')],qs['fields'](_0xaf670d[_0x1964('0x22')][_0x1964('0x2b')]));_0x2047fb[_0x1964('0x2a')]=_0x2047fb[_0x1964('0x2a')]['length']?_0x2047fb['attributes']:_0x1bb4a4[_0x1964('0x26')];if(_0xaf670d['query'][_0x1964('0x2c')]){_0x2047fb['include']=[{'all':!![]}];}_0x2047fb=_[_0x1964('0x2d')]({},_0x2047fb,_0xaf670d[_0x1964('0x2e')]);return db[_0x1964('0x27')][_0x1964('0x2f')](_0x2047fb)[_0x1964('0x17')](handleEntityNotFound(_0x3a6f9e,null))['then'](respondWithResult(_0x3a6f9e,null))[_0x1964('0x23')](handleError(_0x3a6f9e,null));};exports[_0x1964('0x30')]=function(_0x5483cc,_0x4c7bea){return db['ChatQueue'][_0x1964('0x30')](_0x5483cc[_0x1964('0x31')],{})['then'](function(_0x5d8df6){var _0x464f38=_0x5483cc[_0x1964('0x32')][_0x1964('0x19')]({'plain':!![]});if(!_0x464f38)throw new Error(_0x1964('0x33'));if(_0x464f38[_0x1964('0x34')]===_0x1964('0x32')){var _0x55acef=_0x5d8df6[_0x1964('0x19')]({'plain':!![]});var _0x3d380f=_0x1964('0x35');return db[_0x1964('0x36')]['find']({'where':{'name':_0x3d380f,'userProfileId':_0x464f38[_0x1964('0x37')]},'raw':!![]})[_0x1964('0x17')](function(_0x477b7a){if(_0x477b7a&&_0x477b7a['autoAssociation']===0x0){return db['UserProfileResource'][_0x1964('0x30')]({'name':_0x55acef[_0x1964('0x1c')],'resourceId':_0x55acef['id'],'type':_0x477b7a['name'],'sectionId':_0x477b7a['id']},{})[_0x1964('0x17')](function(){return _0x5d8df6;});}else{return _0x5d8df6;}})[_0x1964('0x23')](function(_0x1f2d6a){logger[_0x1964('0x38')](_0x1964('0x39'),_0x1f2d6a);throw _0x1f2d6a;});}return _0x5d8df6;})['then'](respondWithResult(_0x4c7bea,0xc9))[_0x1964('0x23')](handleError(_0x4c7bea,null));};exports[_0x1964('0x16')]=function(_0x174690,_0x5f018b){if(_0x174690['body']['id']){delete _0x174690[_0x1964('0x31')]['id'];}return db[_0x1964('0x27')]['find']({'where':{'id':_0x174690[_0x1964('0x25')]['id']}})[_0x1964('0x17')](handleEntityNotFound(_0x5f018b,null))[_0x1964('0x17')](saveUpdates(_0x174690[_0x1964('0x31')],null))[_0x1964('0x17')](respondWithResult(_0x5f018b,null))[_0x1964('0x23')](handleError(_0x5f018b,null));};exports['destroy']=function(_0x3b086e,_0x587790){return db[_0x1964('0x27')][_0x1964('0x2f')]({'where':{'id':_0x3b086e['params']['id']}})['then'](handleEntityNotFound(_0x587790,null))[_0x1964('0x17')](removeEntity(_0x587790,null))[_0x1964('0x23')](handleError(_0x587790,null));};exports[_0x1964('0x3a')]=function(_0x30323e,_0xaaf87){return db[_0x1964('0x27')][_0x1964('0x3a')]()[_0x1964('0x17')](respondWithResult(_0xaaf87,null))['catch'](handleError(_0xaaf87,null));};exports[_0x1964('0x3b')]=function(_0x1b91b9,_0x87e108){var _0x4ca65d={'raw':!![],'where':{}},_0x2f32f5={},_0x4fd21c;return db[_0x1964('0x27')]['findOne']({'where':{'id':_0x1b91b9[_0x1964('0x25')]['id']}})[_0x1964('0x17')](handleEntityNotFound(_0x87e108,null))[_0x1964('0x17')](function(_0x3eeedc){if(_0x3eeedc){_0x4fd21c=_0x3eeedc['get']({'plain':!![]});_0x2f32f5[_0x1964('0x26')]=_[_0x1964('0x28')](db[_0x1964('0x3c')]['rawAttributes']);_0x2f32f5[_0x1964('0x22')]=_[_0x1964('0x28')](_0x1b91b9['query']);_0x2f32f5[_0x1964('0x3d')]=_[_0x1964('0x29')](_0x2f32f5['model'],_0x2f32f5[_0x1964('0x22')]);_0x4ca65d[_0x1964('0x2a')]=_[_0x1964('0x29')](_0x2f32f5[_0x1964('0x26')],qs[_0x1964('0x2b')](_0x1b91b9[_0x1964('0x22')][_0x1964('0x2b')]));_0x4ca65d[_0x1964('0x2a')]=_0x4ca65d[_0x1964('0x2a')]['length']?_0x4ca65d['attributes']:_0x2f32f5[_0x1964('0x26')];if(!_0x1b91b9[_0x1964('0x22')][_0x1964('0x3e')](_0x1964('0x3f'))){_0x4ca65d['limit']=qs[_0x1964('0x12')](_0x1b91b9['query'][_0x1964('0x12')]);_0x4ca65d[_0x1964('0x10')]=qs['offset'](_0x1b91b9[_0x1964('0x22')][_0x1964('0x10')]);}_0x4ca65d[_0x1964('0x40')]=qs[_0x1964('0x41')](_0x1b91b9['query'][_0x1964('0x41')]);_0x4ca65d[_0x1964('0x20')]=qs[_0x1964('0x3d')](_[_0x1964('0x42')](_0x1b91b9['query'],_0x2f32f5['filters']));_0x4ca65d[_0x1964('0x20')][_0x1964('0x43')]=_0x3eeedc['id'];if(_0x1b91b9[_0x1964('0x22')]['filter']){_0x4ca65d[_0x1964('0x20')]=_[_0x1964('0x2d')](_0x4ca65d['where'],{'$or':_[_0x1964('0x44')](_0x4ca65d['attributes'],function(_0x55acf9){var _0x55dfdc={};_0x55dfdc[_0x55acf9]={'$like':'%'+_0x1b91b9[_0x1964('0x22')][_0x1964('0x45')]+'%'};return _0x55dfdc;})});}_0x4ca65d=_[_0x1964('0x2d')]({},_0x4ca65d,_0x1b91b9['options']);return db[_0x1964('0x3c')][_0x1964('0x46')](_0x4ca65d);}})[_0x1964('0x17')](function(_0x3809a0){if(_0x3809a0){return db[_0x1964('0x47')][_0x1964('0x48')]({'where':{'id':_[_0x1964('0x44')](_0x3809a0,_0x1964('0x49')),'role':_0x1964('0x4a')},'attributes':['id',_0x1964('0x1c'),_0x1964('0x4b'),_0x1964('0x4c'),_0x1964('0x4d')]});}})[_0x1964('0x17')](function(_0x228c11){if(_0x228c11){return{'count':_0x228c11[_0x1964('0x13')],'rows':_[_0x1964('0x44')](_0x228c11[_0x1964('0x4e')],function(_0x50c5f2){return{'membername':_0x50c5f2[_0x1964('0x1c')],'UserId':_0x50c5f2['id'],'queue_name':_0x4fd21c['name'],'ChatQueueId':_0x4fd21c['id'],'interface':util[_0x1964('0x4f')]('%s/%s',_0x1964('0x50'),_0x50c5f2['name']),'penalty':0x0,'paused':_0x50c5f2[_0x1964('0x4b')],'createdAt':_0x50c5f2[_0x1964('0x4d')],'updatedAt':_0x50c5f2[_0x1964('0x4c')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x1964('0x17')](respondWithFilteredResult(_0x87e108,_0x4ca65d))[_0x1964('0x23')](handleError(_0x87e108,null));};exports[_0x1964('0x51')]=function(_0x321d55,_0x28eee7){var _0xc503b5={};var _0xbfdb03={};var _0x57f30a;var _0x72cb62;return db[_0x1964('0x27')][_0x1964('0x52')]({'where':{'id':_0x321d55['params']['id']}})[_0x1964('0x17')](handleEntityNotFound(_0x28eee7,null))[_0x1964('0x17')](function(_0x4f8ce5){if(_0x4f8ce5){_0x57f30a=_0x4f8ce5;_0xbfdb03[_0x1964('0x26')]=_[_0x1964('0x28')](db['Team'][_0x1964('0x53')]);_0xbfdb03[_0x1964('0x22')]=_[_0x1964('0x28')](_0x321d55[_0x1964('0x22')]);_0xbfdb03['filters']=_['intersection'](_0xbfdb03[_0x1964('0x26')],_0xbfdb03[_0x1964('0x22')]);_0xc503b5[_0x1964('0x2a')]=_[_0x1964('0x29')](_0xbfdb03[_0x1964('0x26')],qs[_0x1964('0x2b')](_0x321d55[_0x1964('0x22')][_0x1964('0x2b')]));_0xc503b5[_0x1964('0x2a')]=_0xc503b5[_0x1964('0x2a')][_0x1964('0x54')]?_0xc503b5[_0x1964('0x2a')]:_0xbfdb03['model'];_0xc503b5['order']=qs[_0x1964('0x41')](_0x321d55[_0x1964('0x22')]['sort']);_0xc503b5['where']=qs[_0x1964('0x3d')](_[_0x1964('0x42')](_0x321d55['query'],_0xbfdb03[_0x1964('0x3d')]));if(_0x321d55[_0x1964('0x22')][_0x1964('0x45')]){_0xc503b5[_0x1964('0x20')]=_[_0x1964('0x2d')](_0xc503b5[_0x1964('0x20')],{'$or':_['map'](_0xc503b5['attributes'],function(_0x42184){var _0xc4542={};_0xc4542[_0x42184]={'$like':'%'+_0x321d55[_0x1964('0x22')][_0x1964('0x45')]+'%'};return _0xc4542;})});}_0xc503b5=_[_0x1964('0x2d')]({},_0xc503b5,_0x321d55[_0x1964('0x2e')]);return _0x57f30a['getTeams'](_0xc503b5);}})[_0x1964('0x17')](function(_0x2c42f5){if(_0x2c42f5){_0x72cb62=_0x2c42f5[_0x1964('0x54')];if(!_0x321d55[_0x1964('0x22')][_0x1964('0x3e')]('nolimit')){_0xc503b5[_0x1964('0x12')]=qs[_0x1964('0x12')](_0x321d55[_0x1964('0x22')]['limit']);_0xc503b5['offset']=qs[_0x1964('0x10')](_0x321d55['query']['offset']);}return _0x57f30a[_0x1964('0x51')](_0xc503b5);}})['then'](function(_0x2db97c){if(_0x2db97c){return _0x2db97c?{'count':_0x72cb62,'rows':_0x2db97c}:null;}})[_0x1964('0x17')](respondWithResult(_0x28eee7,null))[_0x1964('0x23')](handleError(_0x28eee7,null));};exports['addTeams']=function(_0x1ded33,_0x26333b){var _0x2f7255=_0x1ded33['body'][_0x1964('0x55')];return db[_0x1964('0x56')][_0x1964('0x46')]({'where':{'id':_0x2f7255},'attributes':['id'],'include':[{'model':db[_0x1964('0x47')],'as':_0x1964('0x57'),'attributes':['id',_0x1964('0x1c'),_0x1964('0x58'),'voicePause','interface'],'raw':!![]}]})['then'](function(_0x22cfb6){if(_0x22cfb6){var _0x3a5471=_[_0x1964('0x59')](_0x22cfb6,function(_0xbe9909){var _0x3bd31f=_0xbe9909['get']({'plain':!![]});return _0x3bd31f[_0x1964('0x57')];});return db[_0x1964('0x27')][_0x1964('0x2f')]({'where':{'id':_0x1ded33[_0x1964('0x25')]['id']}})[_0x1964('0x17')](function(_0xbd784f){return db[_0x1964('0x5a')][_0x1964('0x5b')](function(_0x5903d6){return _0xbd784f['addTeams'](_0x2f7255,{'transaction':_0x5903d6})[_0x1964('0x17')](function(){return BPromise[_0x1964('0x5c')](_0x3a5471,function(_0x5ece11){return db[_0x1964('0x3c')]['findOrCreate']({'where':{'UserId':_0x5ece11['id'],'ChatQueueId':_0x1ded33[_0x1964('0x25')]['id']},'transaction':_0x5903d6});});})[_0x1964('0x17')](function(){_0x3a5471[_0x1964('0x5d')](function(_0x4c7e68){socket[_0x1964('0x5e')](_0x1964('0x5f'),{'UserId':_0x4c7e68['id'],'ChatQueueId':_0xbd784f['id']});});});});});}})[_0x1964('0x17')](respondWithStatusCode(_0x26333b,null))[_0x1964('0x23')](handleError(_0x26333b,null));};exports[_0x1964('0x60')]=function(_0x12dbb9,_0x46ba79){return db[_0x1964('0x56')]['findAll']({'where':{'id':_0x12dbb9[_0x1964('0x22')]['ids']},'attributes':['id'],'include':[{'model':db[_0x1964('0x47')],'as':_0x1964('0x57'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x46ba79,null))[_0x1964('0x17')](function(_0x5d5e10){var _0x1b8a73=_['map'](_0x5d5e10,'id');var _0x11236f=[];var _0x475a81=[];var _0x4a0705=squel[_0x1964('0x61')]();_0x4a0705[_0x1964('0x62')](_0x1964('0x63'))[_0x1964('0x64')](_0x1964('0x65'),'tq')['join'](_0x1964('0x66'),'ut',_0x1964('0x67'))[_0x1964('0x20')]('ChatQueueId\x20=\x20?',_0x12dbb9[_0x1964('0x25')]['id']);for(var _0x8f18cf=0x0;_0x8f18cf<_0x5d5e10[_0x1964('0x54')];_0x8f18cf+=0x1){let _0x19e084=_0x5d5e10[_0x8f18cf];for(var _0x34c6c1=0x0;_0x34c6c1<_0x19e084[_0x1964('0x57')][_0x1964('0x54')];_0x34c6c1+=0x1){let _0x2b4272=_0x19e084[_0x1964('0x57')][_0x34c6c1];var _0x2360b5=_0x4a0705[_0x1964('0x68')]();_0x2360b5[_0x1964('0x20')](_0x1964('0x69'),_0x2b4272['id']);_0x475a81['push'](db[_0x1964('0x5a')][_0x1964('0x22')](_0x2360b5[_0x1964('0x6a')](),{'type':db[_0x1964('0x5a')][_0x1964('0x6b')]['SELECT']})['then'](function(_0x56b332){if(_0x56b332[_0x1964('0x54')]===0x1){return _0x2b4272['id'];}else{var _0x980d6d=_[_0x1964('0x6c')](_[_0x1964('0x44')](_0x56b332,_0x1964('0x6d')),function(_0x568dfb){return _[_0x1964('0x6e')](_0x1b8a73,_0x568dfb);});if(_0x980d6d){return _0x2b4272['id'];}}}));}}return BPromise[_0x1964('0x6f')](_0x475a81)['then'](function(_0x457f1a){_0x11236f=_(_0x11236f)[_0x1964('0x70')](_0x457f1a)[_0x1964('0x71')]()[_0x1964('0x72')]();return db['ChatQueue']['find']({'where':{'id':_0x12dbb9[_0x1964('0x25')]['id']}})[_0x1964('0x17')](function(_0x5c0dc2){return db[_0x1964('0x5a')][_0x1964('0x5b')](function(_0x3c6b4b){return _0x5c0dc2[_0x1964('0x60')](_0x12dbb9[_0x1964('0x22')][_0x1964('0x55')],{'transaction':_0x3c6b4b})[_0x1964('0x17')](function(){if(!_['isEmpty'](_0x11236f)){return _0x5c0dc2[_0x1964('0x73')](_0x11236f,{'transaction':_0x3c6b4b});}})[_0x1964('0x17')](function(){_0x11236f[_0x1964('0x5d')](function(_0x5e3f32){socket[_0x1964('0x5e')]('userChatQueue:remove',{'UserId':_0x5e3f32,'ChatQueueId':_0x5c0dc2['id']});});});});});});})[_0x1964('0x17')](respondWithStatusCode(_0x46ba79,null))[_0x1964('0x23')](handleError(_0x46ba79,null));};exports[_0x1964('0x74')]=function(_0x2ede00,_0x585186){return db[_0x1964('0x27')][_0x1964('0x2f')]({'where':{'id':_0x2ede00[_0x1964('0x25')]['id']}})[_0x1964('0x17')](handleEntityNotFound(_0x585186,null))['then'](function(_0x27a0eb){if(_0x27a0eb){return _0x27a0eb[_0x1964('0x74')](_0x2ede00['body'][_0x1964('0x55')],_[_0x1964('0x75')](_0x2ede00[_0x1964('0x31')],['ids','id'])||{})[_0x1964('0x76')](function(_0x10af77){for(var _0x3e715f=0x0;_0x3e715f<_0x2ede00[_0x1964('0x31')][_0x1964('0x55')][_0x1964('0x54')];_0x3e715f+=0x1){socket[_0x1964('0x5e')](_0x1964('0x5f'),{'UserId':Number(_0x2ede00['body']['ids'][_0x3e715f]),'ChatQueueId':Number(_0x2ede00[_0x1964('0x25')]['id'])});}return _0x10af77;});}})[_0x1964('0x17')](respondWithResult(_0x585186,null))[_0x1964('0x23')](handleError(_0x585186,null));};exports[_0x1964('0x73')]=function(_0x55c215,_0x34593a){return db[_0x1964('0x27')][_0x1964('0x2f')]({'where':{'id':_0x55c215[_0x1964('0x25')]['id']}})['then'](handleEntityNotFound(_0x34593a,null))['then'](function(_0x16a99e){if(_0x16a99e){return _0x16a99e[_0x1964('0x73')](_0x55c215['query'][_0x1964('0x55')])[_0x1964('0x17')](function(){if(_[_0x1964('0x77')](_0x55c215[_0x1964('0x22')]['ids'])){for(var _0x1663da=0x0;_0x1663da<_0x55c215['query']['ids']['length'];_0x1663da+=0x1){socket[_0x1964('0x5e')](_0x1964('0x78'),{'UserId':Number(_0x55c215['query']['ids'][_0x1663da]),'ChatQueueId':Number(_0x55c215[_0x1964('0x25')]['id'])});}}else{socket[_0x1964('0x5e')](_0x1964('0x78'),{'UserId':Number(_0x55c215[_0x1964('0x22')][_0x1964('0x55')]),'ChatQueueId':Number(_0x55c215[_0x1964('0x25')]['id'])});}});}})[_0x1964('0x17')](respondWithStatusCode(_0x34593a,null))[_0x1964('0x23')](handleError(_0x34593a,null));};exports[_0x1964('0x79')]=function(_0x10e2b0,_0x23f9dd){var _0x596de4={};var _0x582395={};var _0x19cabe;var _0xc03ad6;return db[_0x1964('0x27')][_0x1964('0x52')]({'where':{'id':_0x10e2b0[_0x1964('0x25')]['id']}})[_0x1964('0x17')](handleEntityNotFound(_0x23f9dd,null))['then'](function(_0x4f54b4){if(_0x4f54b4){_0x19cabe=_0x4f54b4;_0x582395[_0x1964('0x26')]=_[_0x1964('0x28')](db[_0x1964('0x47')][_0x1964('0x53')]);_0x582395[_0x1964('0x22')]=_[_0x1964('0x28')](_0x10e2b0[_0x1964('0x22')]);_0x582395[_0x1964('0x3d')]=_[_0x1964('0x29')](_0x582395[_0x1964('0x26')],_0x582395[_0x1964('0x22')]);_0x596de4[_0x1964('0x2a')]=_[_0x1964('0x29')](_0x582395[_0x1964('0x26')],qs[_0x1964('0x2b')](_0x10e2b0['query'][_0x1964('0x2b')]));_0x596de4['attributes']=_0x596de4[_0x1964('0x2a')][_0x1964('0x54')]?_0x596de4[_0x1964('0x2a')]:_0x582395[_0x1964('0x26')];_0x596de4['order']=qs[_0x1964('0x41')](_0x10e2b0[_0x1964('0x22')]['sort']);_0x596de4[_0x1964('0x20')]=qs[_0x1964('0x3d')](_[_0x1964('0x42')](_0x10e2b0[_0x1964('0x22')],_0x582395[_0x1964('0x3d')]));if(_0x10e2b0[_0x1964('0x22')][_0x1964('0x45')]){_0x596de4[_0x1964('0x20')]=_[_0x1964('0x2d')](_0x596de4[_0x1964('0x20')],{'$or':_[_0x1964('0x44')](_0x596de4[_0x1964('0x2a')],function(_0x219be7){var _0x5263f2={};_0x5263f2[_0x219be7]={'$like':'%'+_0x10e2b0[_0x1964('0x22')]['filter']+'%'};return _0x5263f2;})});}_0x596de4=_[_0x1964('0x2d')]({},_0x596de4,_0x10e2b0['options']);return _0x19cabe[_0x1964('0x79')](_0x596de4);}})[_0x1964('0x17')](function(_0x530abb){if(_0x530abb){_0xc03ad6=_0x530abb[_0x1964('0x54')];if(!_0x10e2b0[_0x1964('0x22')][_0x1964('0x3e')](_0x1964('0x3f'))){_0x596de4[_0x1964('0x12')]=qs[_0x1964('0x12')](_0x10e2b0[_0x1964('0x22')][_0x1964('0x12')]);_0x596de4['offset']=qs[_0x1964('0x10')](_0x10e2b0[_0x1964('0x22')][_0x1964('0x10')]);}return _0x19cabe[_0x1964('0x79')](_0x596de4);}})[_0x1964('0x17')](function(_0xcaa8f9){if(_0xcaa8f9){return _0xcaa8f9?{'count':_0xc03ad6,'rows':_0xcaa8f9}:null;}})[_0x1964('0x17')](respondWithResult(_0x23f9dd,null))['catch'](handleError(_0x23f9dd,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index 3cab2f5..078257e 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 _0xd8df=['hasOwnProperty','hook','exports','events','../../mysqldb','ChatQueue','remove','emit'];(function(_0x4f550,_0x3edd72){var _0xd18547=function(_0x33dec3){while(--_0x33dec3){_0x4f550['push'](_0x4f550['shift']());}};_0xd18547(++_0x3edd72);}(_0xd8df,0x163));var _0xfd8d=function(_0x44406c,_0x302c2f){_0x44406c=_0x44406c-0x0;var _0xe3b344=_0xd8df[_0x44406c];return _0xe3b344;};'use strict';var EventEmitter=require(_0xfd8d('0x0'));var ChatQueue=require(_0xfd8d('0x1'))['db'][_0xfd8d('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xfd8d('0x3')};function emitEvent(_0xab4ef3){return function(_0x33750a,_0x53592e,_0x5b2d87){ChatQueueEvents[_0xfd8d('0x4')](_0xab4ef3+':'+_0x33750a['id'],_0x33750a);ChatQueueEvents[_0xfd8d('0x4')](_0xab4ef3,_0x33750a);_0x5b2d87(null);};}for(var e in events){if(events[_0xfd8d('0x5')](e)){var event=events[e];ChatQueue[_0xfd8d('0x6')](e,emitEvent(event));}}module[_0xfd8d('0x7')]=ChatQueueEvents; \ No newline at end of file +var _0xe17c=['setMaxListeners','save','update','remove','emit','hook','exports','../../mysqldb'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xe17c,0x8f));var _0xce17=function(_0x3e90ac,_0x20fcbe){_0x3e90ac=_0x3e90ac-0x0;var _0x352e0f=_0xe17c[_0x3e90ac];return _0x352e0f;};'use strict';var EventEmitter=require('events');var ChatQueue=require(_0xce17('0x0'))['db']['ChatQueue'];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0xce17('0x1')](0x0);var events={'afterCreate':_0xce17('0x2'),'afterUpdate':_0xce17('0x3'),'afterDestroy':_0xce17('0x4')};function emitEvent(_0x30f162){return function(_0xd49066,_0x5d6f44,_0x3ff39f){ChatQueueEvents[_0xce17('0x5')](_0x30f162+':'+_0xd49066['id'],_0xd49066);ChatQueueEvents[_0xce17('0x5')](_0x30f162,_0xd49066);_0x3ff39f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatQueue[_0xce17('0x6')](e,emitEvent(event));}}module[_0xce17('0x7')]=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index e36507c..ddcea8d 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 _0xa408=['chat_queues','util','bluebird','request-promise','../../config/environment','./chatQueue.attributes','exports','define','ChatQueue'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xa408,0x184));var _0x8a40=function(_0x5f1cf8,_0x5e0923){_0x5f1cf8=_0x5f1cf8-0x0;var _0x27d0fa=_0xa408[_0x5f1cf8];return _0x27d0fa;};'use strict';var _=require('lodash');var util=require(_0x8a40('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x8a40('0x1'));var rp=require(_0x8a40('0x2'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x8a40('0x3'));var attributes=require(_0x8a40('0x4'));module[_0x8a40('0x5')]=function(_0x6b0196,_0x63a881){return _0x6b0196[_0x8a40('0x6')](_0x8a40('0x7'),attributes,{'tableName':_0x8a40('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3b91=['lodash','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./chatQueue.attributes','exports','define','chat_queues'];(function(_0x27a842,_0x53f3ce){var _0x233a7f=function(_0x26d602){while(--_0x26d602){_0x27a842['push'](_0x27a842['shift']());}};_0x233a7f(++_0x53f3ce);}(_0x3b91,0x14a));var _0x13b9=function(_0x3d9939,_0x3bb2b){_0x3d9939=_0x3d9939-0x0;var _0x269bd8=_0x3b91[_0x3d9939];return _0x269bd8;};'use strict';var _=require(_0x13b9('0x0'));var util=require('util');var logger=require(_0x13b9('0x1'))(_0x13b9('0x2'));var moment=require(_0x13b9('0x3'));var BPromise=require('bluebird');var rp=require(_0x13b9('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x13b9('0x5'));var config=require(_0x13b9('0x6'));var attributes=require(_0x13b9('0x7'));module[_0x13b9('0x8')]=function(_0x4b10e9,_0x693049){return _0x4b10e9[_0x13b9('0x9')]('ChatQueue',attributes,{'tableName':_0x13b9('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 d220e6d..bce0b91 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 _0x3af5=['redis','localhost','socket.io-emitter','./chatQueue.socket','then','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','ChatQueue','findAll','options','raw','where','attributes','limit','include','map','model','stringify','ShowChatQueue','lodash','util','bluebird','randomstring','../../config/utils','../../config/environment','jayson/promise','http','defaults'];(function(_0x1dcf41,_0x1c200b){var _0x15eb43=function(_0x452a30){while(--_0x452a30){_0x1dcf41['push'](_0x1dcf41['shift']());}};_0x15eb43(++_0x1c200b);}(_0x3af5,0x1d3));var _0x53af=function(_0x20008a,_0x362490){_0x20008a=_0x20008a-0x0;var _0x5d0f1c=_0x3af5[_0x20008a];return _0x5d0f1c;};'use strict';var _=require(_0x53af('0x0'));var util=require(_0x53af('0x1'));var moment=require('moment');var BPromise=require(_0x53af('0x2'));var rs=require(_0x53af('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x53af('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x53af('0x5'));var jayson=require(_0x53af('0x6'));var client=jayson['client'][_0x53af('0x7')]({'port':0x232a});config['redis']=_[_0x53af('0x8')](config[_0x53af('0x9')],{'host':_0x53af('0xa'),'port':0x18eb});var socket=require(_0x53af('0xb'))(new Redis(config[_0x53af('0x9')]));require(_0x53af('0xc'))['register'](socket);function respondWithRpcPromise(_0x52b4d1,_0x10ee70,_0x5727e6){return new BPromise(function(_0x370cdc,_0x4673a9){return client['request'](_0x52b4d1,_0x5727e6)[_0x53af('0xd')](function(_0x1a08ca){logger['info'](_0x53af('0xe'),_0x10ee70,_0x53af('0xf'));logger[_0x53af('0x10')]('ChatQueue,\x20%s,\x20%s,\x20%s',_0x10ee70,_0x53af('0xf'),JSON['stringify'](_0x1a08ca));if(_0x1a08ca[_0x53af('0x11')]){if(_0x1a08ca[_0x53af('0x11')][_0x53af('0x12')]===0x1f4){logger[_0x53af('0x11')](_0x53af('0xe'),_0x10ee70,_0x1a08ca[_0x53af('0x11')][_0x53af('0x13')]);return _0x4673a9(_0x1a08ca[_0x53af('0x11')][_0x53af('0x13')]);}logger[_0x53af('0x11')]('ChatQueue,\x20%s,\x20%s',_0x10ee70,_0x1a08ca[_0x53af('0x11')][_0x53af('0x13')]);return _0x370cdc(_0x1a08ca[_0x53af('0x11')][_0x53af('0x13')]);}else{logger[_0x53af('0x14')](_0x53af('0xe'),_0x10ee70,_0x53af('0xf'));_0x370cdc(_0x1a08ca['result'][_0x53af('0x13')]);}})[_0x53af('0x15')](function(_0xae3142){logger[_0x53af('0x11')]('ChatQueue,\x20%s,\x20%s',_0x10ee70,_0xae3142);_0x4673a9(_0xae3142);});});}exports['GetChatQueue']=function(_0x167dc2){var _0x3f5503=this;return new Promise(function(_0x37ecb3,_0x5a31d6){return db[_0x53af('0x16')][_0x53af('0x17')]({'raw':_0x167dc2[_0x53af('0x18')]?_0x167dc2[_0x53af('0x18')][_0x53af('0x19')]===undefined?!![]:![]:!![],'where':_0x167dc2[_0x53af('0x18')]?_0x167dc2[_0x53af('0x18')][_0x53af('0x1a')]||null:null,'attributes':_0x167dc2['options']?_0x167dc2[_0x53af('0x18')][_0x53af('0x1b')]||null:null,'limit':_0x167dc2[_0x53af('0x18')]?_0x167dc2[_0x53af('0x18')][_0x53af('0x1c')]||null:null,'include':_0x167dc2[_0x53af('0x18')]?_0x167dc2['options'][_0x53af('0x1d')]?_[_0x53af('0x1e')](_0x167dc2[_0x53af('0x18')][_0x53af('0x1d')],function(_0x480665){return{'model':db[_0x480665[_0x53af('0x1f')]],'as':_0x480665['as'],'attributes':_0x480665[_0x53af('0x1b')],'include':_0x480665[_0x53af('0x1d')]?_[_0x53af('0x1e')](_0x480665[_0x53af('0x1d')],function(_0x152dcc){return{'model':db[_0x152dcc[_0x53af('0x1f')]],'as':_0x152dcc['as'],'attributes':_0x152dcc[_0x53af('0x1b')],'include':_0x152dcc['include']?_[_0x53af('0x1e')](_0x152dcc[_0x53af('0x1d')],function(_0xc9b0df){return{'model':db[_0xc9b0df[_0x53af('0x1f')]],'as':_0xc9b0df['as'],'attributes':_0xc9b0df[_0x53af('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x53af('0xd')](function(_0x154cc2){logger['info']('GetChatQueue',_0x167dc2);logger[_0x53af('0x10')]('GetChatQueue',_0x167dc2,JSON[_0x53af('0x20')](_0x154cc2));_0x37ecb3(_0x154cc2);})[_0x53af('0x15')](function(_0x38563d){logger[_0x53af('0x11')]('GetChatQueue',_0x38563d[_0x53af('0x13')],_0x167dc2);_0x5a31d6(_0x3f5503[_0x53af('0x11')](0x1f4,_0x38563d['message']));});});};exports['ShowChatQueue']=function(_0xc0dae3){var _0x1fa69c=this;return new Promise(function(_0x1a688c,_0x243ee5){return db['ChatQueue']['find']({'raw':_0xc0dae3[_0x53af('0x18')]?_0xc0dae3[_0x53af('0x18')][_0x53af('0x19')]===undefined?!![]:![]:!![],'where':_0xc0dae3['options']?_0xc0dae3['options'][_0x53af('0x1a')]||null:null,'attributes':_0xc0dae3[_0x53af('0x18')]?_0xc0dae3[_0x53af('0x18')][_0x53af('0x1b')]||null:null,'include':_0xc0dae3[_0x53af('0x18')]?_0xc0dae3[_0x53af('0x18')][_0x53af('0x1d')]?_['map'](_0xc0dae3[_0x53af('0x18')][_0x53af('0x1d')],function(_0x51784e){return{'model':db[_0x51784e[_0x53af('0x1f')]],'as':_0x51784e['as'],'attributes':_0x51784e[_0x53af('0x1b')],'include':_0x51784e[_0x53af('0x1d')]?_[_0x53af('0x1e')](_0x51784e[_0x53af('0x1d')],function(_0x576bfc){return{'model':db[_0x576bfc[_0x53af('0x1f')]],'as':_0x576bfc['as'],'attributes':_0x576bfc['attributes'],'include':_0x576bfc[_0x53af('0x1d')]?_[_0x53af('0x1e')](_0x576bfc[_0x53af('0x1d')],function(_0x1213a6){return{'model':db[_0x1213a6[_0x53af('0x1f')]],'as':_0x1213a6['as'],'attributes':_0x1213a6['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5e3295){logger[_0x53af('0x14')]('ShowChatQueue',_0xc0dae3);logger['debug']('ShowChatQueue',_0xc0dae3,JSON[_0x53af('0x20')](_0x5e3295));_0x1a688c(_0x5e3295);})[_0x53af('0x15')](function(_0x440655){logger[_0x53af('0x11')](_0x53af('0x21'),_0x440655[_0x53af('0x13')],_0xc0dae3);_0x243ee5(_0x1fa69c[_0x53af('0x11')](0x1f4,_0x440655[_0x53af('0x13')]));});});}; \ No newline at end of file +var _0x46aa=['error','code','message','result','GetChatQueue','ChatQueue','findAll','options','where','attributes','limit','include','map','model','catch','find','raw','ShowChatQueue','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','request','then','info','ChatQueue,\x20%s,\x20%s','debug','ChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x2d5b03,_0x4f63b5){var _0x2013ef=function(_0x17eea8){while(--_0x17eea8){_0x2d5b03['push'](_0x2d5b03['shift']());}};_0x2013ef(++_0x4f63b5);}(_0x46aa,0x90));var _0xa46a=function(_0x36ed48,_0x1ee0d4){_0x36ed48=_0x36ed48-0x0;var _0x51c63a=_0x46aa[_0x36ed48];return _0x51c63a;};'use strict';var _=require(_0xa46a('0x0'));var util=require(_0xa46a('0x1'));var moment=require(_0xa46a('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa46a('0x3'));var db=require(_0xa46a('0x4'))['db'];var utils=require(_0xa46a('0x5'));var logger=require(_0xa46a('0x6'))(_0xa46a('0x7'));var config=require(_0xa46a('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xa46a('0x9')]['http']({'port':0x232a});config[_0xa46a('0xa')]=_[_0xa46a('0xb')](config[_0xa46a('0xa')],{'host':_0xa46a('0xc'),'port':0x18eb});var socket=require(_0xa46a('0xd'))(new Redis(config[_0xa46a('0xa')]));require(_0xa46a('0xe'))[_0xa46a('0xf')](socket);function respondWithRpcPromise(_0x3fd2f5,_0x4df886,_0x597f42){return new BPromise(function(_0x33053a,_0x293bb1){return client[_0xa46a('0x10')](_0x3fd2f5,_0x597f42)[_0xa46a('0x11')](function(_0x2dce6d){logger[_0xa46a('0x12')](_0xa46a('0x13'),_0x4df886,'request\x20sent');logger[_0xa46a('0x14')](_0xa46a('0x15'),_0x4df886,_0xa46a('0x16'),JSON[_0xa46a('0x17')](_0x2dce6d));if(_0x2dce6d[_0xa46a('0x18')]){if(_0x2dce6d[_0xa46a('0x18')][_0xa46a('0x19')]===0x1f4){logger[_0xa46a('0x18')](_0xa46a('0x13'),_0x4df886,_0x2dce6d['error'][_0xa46a('0x1a')]);return _0x293bb1(_0x2dce6d[_0xa46a('0x18')][_0xa46a('0x1a')]);}logger[_0xa46a('0x18')]('ChatQueue,\x20%s,\x20%s',_0x4df886,_0x2dce6d[_0xa46a('0x18')]['message']);return _0x33053a(_0x2dce6d[_0xa46a('0x18')]['message']);}else{logger[_0xa46a('0x12')](_0xa46a('0x13'),_0x4df886,_0xa46a('0x16'));_0x33053a(_0x2dce6d[_0xa46a('0x1b')][_0xa46a('0x1a')]);}})['catch'](function(_0x26412c){logger['error'](_0xa46a('0x13'),_0x4df886,_0x26412c);_0x293bb1(_0x26412c);});});}exports[_0xa46a('0x1c')]=function(_0x15d126){var _0x4b32e5=this;return new Promise(function(_0x216909,_0x5f0daf){return db[_0xa46a('0x1d')][_0xa46a('0x1e')]({'raw':_0x15d126[_0xa46a('0x1f')]?_0x15d126[_0xa46a('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x15d126['options']?_0x15d126['options'][_0xa46a('0x20')]||null:null,'attributes':_0x15d126[_0xa46a('0x1f')]?_0x15d126[_0xa46a('0x1f')][_0xa46a('0x21')]||null:null,'limit':_0x15d126[_0xa46a('0x1f')]?_0x15d126[_0xa46a('0x1f')][_0xa46a('0x22')]||null:null,'include':_0x15d126[_0xa46a('0x1f')]?_0x15d126[_0xa46a('0x1f')][_0xa46a('0x23')]?_[_0xa46a('0x24')](_0x15d126[_0xa46a('0x1f')][_0xa46a('0x23')],function(_0xe668f0){return{'model':db[_0xe668f0[_0xa46a('0x25')]],'as':_0xe668f0['as'],'attributes':_0xe668f0[_0xa46a('0x21')],'include':_0xe668f0[_0xa46a('0x23')]?_[_0xa46a('0x24')](_0xe668f0['include'],function(_0x170ac9){return{'model':db[_0x170ac9[_0xa46a('0x25')]],'as':_0x170ac9['as'],'attributes':_0x170ac9[_0xa46a('0x21')],'include':_0x170ac9['include']?_[_0xa46a('0x24')](_0x170ac9[_0xa46a('0x23')],function(_0x100770){return{'model':db[_0x100770[_0xa46a('0x25')]],'as':_0x100770['as'],'attributes':_0x100770[_0xa46a('0x21')]};}):[]};}):[]};}):[]:[]})[_0xa46a('0x11')](function(_0x2df63d){logger[_0xa46a('0x12')](_0xa46a('0x1c'),_0x15d126);logger[_0xa46a('0x14')]('GetChatQueue',_0x15d126,JSON['stringify'](_0x2df63d));_0x216909(_0x2df63d);})[_0xa46a('0x26')](function(_0x19dbf4){logger['error'](_0xa46a('0x1c'),_0x19dbf4[_0xa46a('0x1a')],_0x15d126);_0x5f0daf(_0x4b32e5[_0xa46a('0x18')](0x1f4,_0x19dbf4[_0xa46a('0x1a')]));});});};exports['ShowChatQueue']=function(_0x593f40){var _0x200686=this;return new Promise(function(_0x316161,_0x4702aa){return db[_0xa46a('0x1d')][_0xa46a('0x27')]({'raw':_0x593f40['options']?_0x593f40[_0xa46a('0x1f')][_0xa46a('0x28')]===undefined?!![]:![]:!![],'where':_0x593f40['options']?_0x593f40[_0xa46a('0x1f')]['where']||null:null,'attributes':_0x593f40[_0xa46a('0x1f')]?_0x593f40[_0xa46a('0x1f')][_0xa46a('0x21')]||null:null,'include':_0x593f40['options']?_0x593f40[_0xa46a('0x1f')]['include']?_[_0xa46a('0x24')](_0x593f40[_0xa46a('0x1f')][_0xa46a('0x23')],function(_0x4e218c){return{'model':db[_0x4e218c[_0xa46a('0x25')]],'as':_0x4e218c['as'],'attributes':_0x4e218c['attributes'],'include':_0x4e218c[_0xa46a('0x23')]?_['map'](_0x4e218c['include'],function(_0x5dce40){return{'model':db[_0x5dce40['model']],'as':_0x5dce40['as'],'attributes':_0x5dce40[_0xa46a('0x21')],'include':_0x5dce40[_0xa46a('0x23')]?_[_0xa46a('0x24')](_0x5dce40[_0xa46a('0x23')],function(_0x4860b4){return{'model':db[_0x4860b4['model']],'as':_0x4860b4['as'],'attributes':_0x4860b4[_0xa46a('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4a860e){logger[_0xa46a('0x12')](_0xa46a('0x29'),_0x593f40);logger[_0xa46a('0x14')]('ShowChatQueue',_0x593f40,JSON[_0xa46a('0x17')](_0x4a860e));_0x316161(_0x4a860e);})[_0xa46a('0x26')](function(_0x56b791){logger[_0xa46a('0x18')](_0xa46a('0x29'),_0x56b791[_0xa46a('0x1a')],_0x593f40);_0x4702aa(_0x200686[_0xa46a('0x18')](0x1f4,_0x56b791[_0xa46a('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index b70dedf..72a3ef7 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 _0xed1f=['register','length','./chatQueue.events','save','remove','update','emit','removeListener'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xed1f,0x6a));var _0xfed1=function(_0x411017,_0x4a8117){_0x411017=_0x411017-0x0;var _0x2adeea=_0xed1f[_0x411017];return _0x2adeea;};'use strict';var ChatQueueEvents=require(_0xfed1('0x0'));var events=[_0xfed1('0x1'),_0xfed1('0x2'),_0xfed1('0x3')];function createListener(_0xa45937,_0x25f345){return function(_0x1dd614){_0x25f345[_0xfed1('0x4')](_0xa45937,_0x1dd614);};}function removeListener(_0x2209b3,_0x45c3c1){return function(){ChatQueueEvents[_0xfed1('0x5')](_0x2209b3,_0x45c3c1);};}exports[_0xfed1('0x6')]=function(_0x3d6706){for(var _0x42751d=0x0,_0x380e18=events[_0xfed1('0x7')];_0x42751d<_0x380e18;_0x42751d++){var _0x2a6082=events[_0x42751d];var _0x2967ef=createListener('chatQueue:'+_0x2a6082,_0x3d6706);ChatQueueEvents['on'](_0x2a6082,_0x2967ef);}}; \ No newline at end of file +var _0x4b84=['./chatQueue.events','save','emit','length'];(function(_0x453b3f,_0x3c3e86){var _0x5ae1fc=function(_0x4d3446){while(--_0x4d3446){_0x453b3f['push'](_0x453b3f['shift']());}};_0x5ae1fc(++_0x3c3e86);}(_0x4b84,0x1cc));var _0x44b8=function(_0x1dc24d,_0x541fa4){_0x1dc24d=_0x1dc24d-0x0;var _0x5d7fb2=_0x4b84[_0x1dc24d];return _0x5d7fb2;};'use strict';var ChatQueueEvents=require(_0x44b8('0x0'));var events=[_0x44b8('0x1'),'remove','update'];function createListener(_0x765943,_0x519db3){return function(_0x4b8ad8){_0x519db3[_0x44b8('0x2')](_0x765943,_0x4b8ad8);};}function removeListener(_0x31282a,_0x39ad16){return function(){ChatQueueEvents['removeListener'](_0x31282a,_0x39ad16);};}exports['register']=function(_0x55f25d){for(var _0x996a8b=0x0,_0x54274b=events[_0x44b8('0x3')];_0x996a8b<_0x54274b;_0x996a8b++){var _0x5947f7=events[_0x996a8b];var _0x3e87c5=createListener('chatQueue:'+_0x5947f7,_0x55f25d);ChatQueueEvents['on'](_0x5947f7,_0x3e87c5);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index a985933..b9c7cfd 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 _0xe14b=['/describe','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','/:id','delete','destroy','removeAgents','exports','multer','util','express','Router','../../components/auth/service','./chatQueue.controller','get','isAuthenticated','index'];(function(_0x57f576,_0x44ff3e){var _0x2f0655=function(_0x58b35e){while(--_0x58b35e){_0x57f576['push'](_0x57f576['shift']());}};_0x2f0655(++_0x44ff3e);}(_0xe14b,0x93));var _0xbe14=function(_0x56b8eb,_0x1b90ab){_0x56b8eb=_0x56b8eb-0x0;var _0x31494f=_0xe14b[_0x56b8eb];return _0x31494f;};'use strict';var multer=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbe14('0x2'));var router=express[_0xbe14('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xbe14('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xbe14('0x5'));router[_0xbe14('0x6')]('/',auth[_0xbe14('0x7')](),controller[_0xbe14('0x8')]);router[_0xbe14('0x6')](_0xbe14('0x9'),auth[_0xbe14('0x7')](),controller['describe']);router['get']('/:id',auth[_0xbe14('0x7')](),controller[_0xbe14('0xa')]);router[_0xbe14('0x6')](_0xbe14('0xb'),auth['isAuthenticated'](),controller['getMembers']);router[_0xbe14('0x6')](_0xbe14('0xc'),auth['isAuthenticated'](),controller[_0xbe14('0xd')]);router[_0xbe14('0x6')](_0xbe14('0xe'),auth[_0xbe14('0x7')](),controller[_0xbe14('0xf')]);router[_0xbe14('0x10')]('/',auth[_0xbe14('0x7')](),controller[_0xbe14('0x11')]);router[_0xbe14('0x10')](_0xbe14('0xc'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x12')]);router[_0xbe14('0x10')]('/:id/users',auth['isAuthenticated'](),controller[_0xbe14('0x13')]);router[_0xbe14('0x14')](_0xbe14('0x15'),auth[_0xbe14('0x7')](),controller['update']);router[_0xbe14('0x16')](_0xbe14('0x15'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x17')]);router[_0xbe14('0x16')](_0xbe14('0xc'),auth[_0xbe14('0x7')](),controller['removeTeams']);router[_0xbe14('0x16')](_0xbe14('0xe'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x18')]);module[_0xbe14('0x19')]=router; \ No newline at end of file +var _0x7217=['../../config/environment','./chatQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','post','addTeams','update','delete','destroy','removeTeams','removeAgents','exports','multer','path','connect-timeout','express','Router','fs-extra'];(function(_0x16a2c2,_0x28a2eb){var _0x5273a9=function(_0x731530){while(--_0x731530){_0x16a2c2['push'](_0x16a2c2['shift']());}};_0x5273a9(++_0x28a2eb);}(_0x7217,0x19e));var _0x7721=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0x7217[_0x2160a9];return _0xa88cf7;};'use strict';var multer=require(_0x7721('0x0'));var util=require('util');var path=require(_0x7721('0x1'));var timeout=require(_0x7721('0x2'));var express=require(_0x7721('0x3'));var router=express[_0x7721('0x4')]();var fs_extra=require(_0x7721('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7721('0x6'));var controller=require(_0x7721('0x7'));router[_0x7721('0x8')]('/',auth[_0x7721('0x9')](),controller[_0x7721('0xa')]);router[_0x7721('0x8')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller[_0x7721('0xc')]);router[_0x7721('0x8')](_0x7721('0xd'),auth[_0x7721('0x9')](),controller[_0x7721('0xe')]);router[_0x7721('0x8')](_0x7721('0xf'),auth['isAuthenticated'](),controller[_0x7721('0x10')]);router[_0x7721('0x8')](_0x7721('0x11'),auth[_0x7721('0x9')](),controller[_0x7721('0x12')]);router[_0x7721('0x8')](_0x7721('0x13'),auth[_0x7721('0x9')](),controller['getAgents']);router[_0x7721('0x14')]('/',auth[_0x7721('0x9')](),controller['create']);router[_0x7721('0x14')](_0x7721('0x11'),auth[_0x7721('0x9')](),controller[_0x7721('0x15')]);router['post'](_0x7721('0x13'),auth[_0x7721('0x9')](),controller['addAgents']);router['put']('/:id',auth[_0x7721('0x9')](),controller[_0x7721('0x16')]);router[_0x7721('0x17')](_0x7721('0xd'),auth['isAuthenticated'](),controller[_0x7721('0x18')]);router['delete'](_0x7721('0x11'),auth['isAuthenticated'](),controller[_0x7721('0x19')]);router[_0x7721('0x17')](_0x7721('0x13'),auth[_0x7721('0x9')](),controller[_0x7721('0x1a')]);module[_0x7721('0x1b')]=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index c821a27..e132c83 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 _0x68f5=['STRING','DATE','moment','sequelize','exports'];(function(_0x6d97cc,_0xc03086){var _0x32fc5c=function(_0x4b0755){while(--_0x4b0755){_0x6d97cc['push'](_0x6d97cc['shift']());}};_0x32fc5c(++_0xc03086);}(_0x68f5,0x11a));var _0x568f=function(_0x1b3d0e,_0x1fba2f){_0x1b3d0e=_0x1b3d0e-0x0;var _0x2dac24=_0x68f5[_0x1b3d0e];return _0x2dac24;};'use strict';var moment=require(_0x568f('0x0'));var Sequelize=require(_0x568f('0x1'));module[_0x568f('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x568f('0x3')]},'joinAt':{'type':Sequelize[_0x568f('0x4')]},'leaveAt':{'type':Sequelize[_0x568f('0x4')]},'acceptAt':{'type':Sequelize[_0x568f('0x4')]},'exitAt':{'type':Sequelize[_0x568f('0x4')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x1593=['exports','STRING','DATE','moment','sequelize'];(function(_0xd3606f,_0x38bdc9){var _0x561ed4=function(_0x4bfa5c){while(--_0x4bfa5c){_0xd3606f['push'](_0xd3606f['shift']());}};_0x561ed4(++_0x38bdc9);}(_0x1593,0x12a));var _0x3159=function(_0x3a9680,_0x2fddd9){_0x3a9680=_0x3a9680-0x0;var _0x5f0698=_0x1593[_0x3a9680];return _0x5f0698;};'use strict';var moment=require(_0x3159('0x0'));var Sequelize=require(_0x3159('0x1'));module[_0x3159('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x3159('0x3')]},'joinAt':{'type':Sequelize[_0x3159('0x4')]},'leaveAt':{'type':Sequelize[_0x3159('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x3159('0x3')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index 1303838..227f252 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 _0x5ff9=['show','find','catch','create','body','destroy','params','describe','eml-format','rimraf','fast-json-patch','request-promise','mustache','sox','to-csv','fs-extra','squel','crypto','desk.js','querystring','papaparse','../../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','undefined','count','limit','set','Content-Range','apply','reject','update','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','VIRTUAL','filter','merge','options','ChatQueueReport','includeAll','include','findAll'];(function(_0x3b1b23,_0x21bccd){var _0x1efc85=function(_0x102a95){while(--_0x102a95){_0x3b1b23['push'](_0x3b1b23['shift']());}};_0x1efc85(++_0x21bccd);}(_0x5ff9,0xa0));var _0x95ff=function(_0xa3f784,_0x12bba2){_0xa3f784=_0xa3f784-0x0;var _0x2c5827=_0x5ff9[_0xa3f784];return _0x2c5827;};'use strict';var emlformat=require(_0x95ff('0x0'));var rimraf=require(_0x95ff('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x95ff('0x2'));var rp=require(_0x95ff('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x95ff('0x4'));var util=require('util');var path=require('path');var sox=require(_0x95ff('0x5'));var csv=require(_0x95ff('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x95ff('0x7'));var _=require('lodash');var squel=require(_0x95ff('0x8'));var crypto=require(_0x95ff('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x95ff('0xa'));var toCsv=require('to-csv');var querystring=require(_0x95ff('0xb'));var Papa=require(_0x95ff('0xc'));var Redis=require('ioredis');var authService=require(_0x95ff('0xd'));var qs=require(_0x95ff('0xe'));var as=require(_0x95ff('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x95ff('0x10'))(_0x95ff('0x11'));var utils=require(_0x95ff('0x12'));var config=require(_0x95ff('0x13'));var licenseUtil=require(_0x95ff('0x14'));var db=require(_0x95ff('0x15'))['db'];function respondWithStatusCode(_0x52a97e,_0x5293e9){_0x5293e9=_0x5293e9||0xcc;return function(_0x39ce1b){if(_0x39ce1b){return _0x52a97e[_0x95ff('0x16')](_0x5293e9);}return _0x52a97e[_0x95ff('0x17')](_0x5293e9)[_0x95ff('0x18')]();};}function respondWithResult(_0x59bcac,_0x3a29fc){_0x3a29fc=_0x3a29fc||0xc8;return function(_0x40c53b){if(_0x40c53b){return _0x59bcac['status'](_0x3a29fc)[_0x95ff('0x19')](_0x40c53b);}};}function respondWithFilteredResult(_0x1b6c9a,_0x4cc1f2){return function(_0x59c504){if(_0x59c504){var _0xf8fee=typeof _0x4cc1f2[_0x95ff('0x1a')]===_0x95ff('0x1b')&&typeof _0x4cc1f2['limit']===_0x95ff('0x1b');var _0x4fd920=_0x59c504['count'];var _0x1929c4=_0xf8fee?0x0:_0x4cc1f2[_0x95ff('0x1a')];var _0x1c67e4=_0xf8fee?_0x59c504[_0x95ff('0x1c')]:_0x4cc1f2['offset']+_0x4cc1f2[_0x95ff('0x1d')];var _0x1467df;if(_0x1c67e4>=_0x4fd920){_0x1c67e4=_0x4fd920;_0x1467df=0xc8;}else{_0x1467df=0xce;}_0x1b6c9a[_0x95ff('0x17')](_0x1467df);return _0x1b6c9a[_0x95ff('0x1e')](_0x95ff('0x1f'),_0x1929c4+'-'+_0x1c67e4+'/'+_0x4fd920)['json'](_0x59c504);}return null;};}function patchUpdates(_0x363691){return function(_0x409963){try{jsonpatch[_0x95ff('0x20')](_0x409963,_0x363691,!![]);}catch(_0x169dcb){return BPromise[_0x95ff('0x21')](_0x169dcb);}return _0x409963['save']();};}function saveUpdates(_0x552067,_0x1151d8){return function(_0x2d02f2){if(_0x2d02f2){return _0x2d02f2[_0x95ff('0x22')](_0x552067)[_0x95ff('0x23')](function(_0x4be963){return _0x4be963;});}return null;};}function removeEntity(_0x3cf2eb,_0x1f79b1){return function(_0x4fa568){if(_0x4fa568){return _0x4fa568['destroy']()[_0x95ff('0x23')](function(){_0x3cf2eb['status'](0xcc)[_0x95ff('0x18')]();});}};}function handleEntityNotFound(_0x206d30,_0xbc5e96){return function(_0x1830f5){if(!_0x1830f5){_0x206d30[_0x95ff('0x16')](0x194);}return _0x1830f5;};}function handleError(_0x2b4926,_0x4e5178){_0x4e5178=_0x4e5178||0x1f4;return function(_0x43e339){logger[_0x95ff('0x24')](_0x43e339[_0x95ff('0x25')]);if(_0x43e339[_0x95ff('0x26')]){delete _0x43e339[_0x95ff('0x26')];}_0x2b4926[_0x95ff('0x17')](_0x4e5178)[_0x95ff('0x27')](_0x43e339);};}exports[_0x95ff('0x28')]=function(_0x258339,_0x3b4919){var _0x37b9bc={},_0x2fcc8b={},_0x2bc475={'count':0x0,'rows':[]};var _0x89c03d=_[_0x95ff('0x29')](db['ChatQueueReport'][_0x95ff('0x2a')],function(_0x73f4c){return{'name':_0x73f4c[_0x95ff('0x2b')],'type':_0x73f4c[_0x95ff('0x2c')][_0x95ff('0x2d')]};});_0x2fcc8b[_0x95ff('0x2e')]=_[_0x95ff('0x29')](_0x89c03d,'name');_0x2fcc8b[_0x95ff('0x2f')]=_[_0x95ff('0x30')](_0x258339[_0x95ff('0x2f')]);_0x2fcc8b[_0x95ff('0x31')]=_[_0x95ff('0x32')](_0x2fcc8b[_0x95ff('0x2e')],_0x2fcc8b['query']);_0x37b9bc[_0x95ff('0x33')]=_[_0x95ff('0x32')](_0x2fcc8b[_0x95ff('0x2e')],qs[_0x95ff('0x34')](_0x258339[_0x95ff('0x2f')][_0x95ff('0x34')]));_0x37b9bc[_0x95ff('0x33')]=_0x37b9bc['attributes'][_0x95ff('0x35')]?_0x37b9bc[_0x95ff('0x33')]:_0x2fcc8b['model'];if(!_0x258339[_0x95ff('0x2f')][_0x95ff('0x36')](_0x95ff('0x37'))){_0x37b9bc[_0x95ff('0x1d')]=qs[_0x95ff('0x1d')](_0x258339[_0x95ff('0x2f')][_0x95ff('0x1d')]);_0x37b9bc[_0x95ff('0x1a')]=qs[_0x95ff('0x1a')](_0x258339['query'][_0x95ff('0x1a')]);}_0x37b9bc[_0x95ff('0x38')]=qs[_0x95ff('0x39')](_0x258339[_0x95ff('0x2f')]['sort']);_0x37b9bc['where']=qs[_0x95ff('0x31')](_[_0x95ff('0x3a')](_0x258339[_0x95ff('0x2f')],_0x2fcc8b[_0x95ff('0x31')]),_0x89c03d);if(_0x258339['query']['filter']){_0x37b9bc[_0x95ff('0x3b')]=_['merge'](_0x37b9bc[_0x95ff('0x3b')],{'$or':_[_0x95ff('0x29')](_0x89c03d,function(_0x3d1670){if(_0x3d1670[_0x95ff('0x2c')]!==_0x95ff('0x3c')){var _0x1c0d9d={};_0x1c0d9d[_0x3d1670[_0x95ff('0x26')]]={'$like':'%'+_0x258339[_0x95ff('0x2f')][_0x95ff('0x3d')]+'%'};return _0x1c0d9d;}})});}_0x37b9bc=_[_0x95ff('0x3e')]({},_0x37b9bc,_0x258339[_0x95ff('0x3f')]);var _0x595807={'where':_0x37b9bc['where']};return db[_0x95ff('0x40')][_0x95ff('0x1c')](_0x595807)[_0x95ff('0x23')](function(_0x4ff017){_0x2bc475[_0x95ff('0x1c')]=_0x4ff017;if(_0x258339['query'][_0x95ff('0x41')]){_0x37b9bc[_0x95ff('0x42')]=[{'all':!![]}];}return db[_0x95ff('0x40')][_0x95ff('0x43')](_0x37b9bc);})[_0x95ff('0x23')](function(_0x56de6f){_0x2bc475['rows']=_0x56de6f;return _0x2bc475;})[_0x95ff('0x23')](respondWithFilteredResult(_0x3b4919,_0x37b9bc))['catch'](handleError(_0x3b4919,null));};exports[_0x95ff('0x44')]=function(_0x5eb53c,_0x501b48){var _0x152710={'raw':!![],'where':{'id':_0x5eb53c['params']['id']}},_0x199883={};_0x199883[_0x95ff('0x2e')]=_[_0x95ff('0x30')](db[_0x95ff('0x40')][_0x95ff('0x2a')]);_0x199883[_0x95ff('0x2f')]=_[_0x95ff('0x30')](_0x5eb53c[_0x95ff('0x2f')]);_0x199883[_0x95ff('0x31')]=_['intersection'](_0x199883[_0x95ff('0x2e')],_0x199883[_0x95ff('0x2f')]);_0x152710[_0x95ff('0x33')]=_['intersection'](_0x199883[_0x95ff('0x2e')],qs[_0x95ff('0x34')](_0x5eb53c[_0x95ff('0x2f')][_0x95ff('0x34')]));_0x152710['attributes']=_0x152710[_0x95ff('0x33')][_0x95ff('0x35')]?_0x152710[_0x95ff('0x33')]:_0x199883[_0x95ff('0x2e')];if(_0x5eb53c[_0x95ff('0x2f')][_0x95ff('0x41')]){_0x152710['include']=[{'all':!![]}];}_0x152710=_[_0x95ff('0x3e')]({},_0x152710,_0x5eb53c['options']);return db[_0x95ff('0x40')][_0x95ff('0x45')](_0x152710)[_0x95ff('0x23')](handleEntityNotFound(_0x501b48,null))['then'](respondWithResult(_0x501b48,null))[_0x95ff('0x46')](handleError(_0x501b48,null));};exports[_0x95ff('0x47')]=function(_0x5c1cb4,_0x3e5051){return db['ChatQueueReport'][_0x95ff('0x47')](_0x5c1cb4[_0x95ff('0x48')],{})[_0x95ff('0x23')](respondWithResult(_0x3e5051,0xc9))[_0x95ff('0x46')](handleError(_0x3e5051,null));};exports[_0x95ff('0x22')]=function(_0x582a03,_0x58c9f2){if(_0x582a03[_0x95ff('0x48')]['id']){delete _0x582a03['body']['id'];}return db[_0x95ff('0x40')][_0x95ff('0x45')]({'where':{'id':_0x582a03['params']['id']}})[_0x95ff('0x23')](handleEntityNotFound(_0x58c9f2,null))['then'](saveUpdates(_0x582a03[_0x95ff('0x48')],null))[_0x95ff('0x23')](respondWithResult(_0x58c9f2,null))[_0x95ff('0x46')](handleError(_0x58c9f2,null));};exports[_0x95ff('0x49')]=function(_0x36e05f,_0x117ac1){return db[_0x95ff('0x40')][_0x95ff('0x45')]({'where':{'id':_0x36e05f[_0x95ff('0x4a')]['id']}})[_0x95ff('0x23')](handleEntityNotFound(_0x117ac1,null))[_0x95ff('0x23')](removeEntity(_0x117ac1,null))['catch'](handleError(_0x117ac1,null));};exports['describe']=function(_0x1c91cd,_0x5c892a){return db[_0x95ff('0x40')][_0x95ff('0x4b')]()[_0x95ff('0x23')](respondWithResult(_0x5c892a,null))['catch'](handleError(_0x5c892a,null));}; \ No newline at end of file +var _0x00f0=['hasOwnProperty','order','sort','pick','where','merge','VIRTUAL','filter','options','include','rows','catch','show','params','includeAll','find','create','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','status','end','offset','undefined','limit','count','set','json','apply','reject','then','destroy','sendStatus','error','stack','name','send','ChatQueueReport','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length'];(function(_0x2fac3a,_0x3549db){var _0x48e332=function(_0x5d6487){while(--_0x5d6487){_0x2fac3a['push'](_0x2fac3a['shift']());}};_0x48e332(++_0x3549db);}(_0x00f0,0xec));var _0x000f=function(_0x5828fb,_0x24eb0b){_0x5828fb=_0x5828fb-0x0;var _0x3412dd=_0x00f0[_0x5828fb];return _0x3412dd;};'use strict';var emlformat=require(_0x000f('0x0'));var rimraf=require(_0x000f('0x1'));var zipdir=require(_0x000f('0x2'));var jsonpatch=require(_0x000f('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x000f('0x4'));var Mustache=require('mustache');var util=require(_0x000f('0x5'));var path=require('path');var sox=require(_0x000f('0x6'));var csv=require(_0x000f('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x000f('0x8'));var _=require(_0x000f('0x9'));var squel=require(_0x000f('0xa'));var crypto=require(_0x000f('0xb'));var jsforce=require(_0x000f('0xc'));var deskjs=require(_0x000f('0xd'));var toCsv=require(_0x000f('0x7'));var querystring=require(_0x000f('0xe'));var Papa=require(_0x000f('0xf'));var Redis=require(_0x000f('0x10'));var authService=require(_0x000f('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x000f('0x12'));var logger=require(_0x000f('0x13'))('api');var utils=require(_0x000f('0x14'));var config=require(_0x000f('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x11f9c2,_0x442695){_0x442695=_0x442695||0xcc;return function(_0x5ddeb0){if(_0x5ddeb0){return _0x11f9c2['sendStatus'](_0x442695);}return _0x11f9c2[_0x000f('0x16')](_0x442695)[_0x000f('0x17')]();};}function respondWithResult(_0x3f29cc,_0x2f1002){_0x2f1002=_0x2f1002||0xc8;return function(_0x4a7ed8){if(_0x4a7ed8){return _0x3f29cc[_0x000f('0x16')](_0x2f1002)['json'](_0x4a7ed8);}};}function respondWithFilteredResult(_0x4a6f6d,_0x3a9e55){return function(_0x4d2b59){if(_0x4d2b59){var _0x1870b3=typeof _0x3a9e55[_0x000f('0x18')]===_0x000f('0x19')&&typeof _0x3a9e55[_0x000f('0x1a')]===_0x000f('0x19');var _0x1fb6e9=_0x4d2b59[_0x000f('0x1b')];var _0x86ac21=_0x1870b3?0x0:_0x3a9e55[_0x000f('0x18')];var _0x1e396b=_0x1870b3?_0x4d2b59[_0x000f('0x1b')]:_0x3a9e55[_0x000f('0x18')]+_0x3a9e55[_0x000f('0x1a')];var _0x4f0d93;if(_0x1e396b>=_0x1fb6e9){_0x1e396b=_0x1fb6e9;_0x4f0d93=0xc8;}else{_0x4f0d93=0xce;}_0x4a6f6d[_0x000f('0x16')](_0x4f0d93);return _0x4a6f6d[_0x000f('0x1c')]('Content-Range',_0x86ac21+'-'+_0x1e396b+'/'+_0x1fb6e9)[_0x000f('0x1d')](_0x4d2b59);}return null;};}function patchUpdates(_0x51e8c7){return function(_0x4d9752){try{jsonpatch[_0x000f('0x1e')](_0x4d9752,_0x51e8c7,!![]);}catch(_0x1b1ad9){return BPromise[_0x000f('0x1f')](_0x1b1ad9);}return _0x4d9752['save']();};}function saveUpdates(_0x53046d,_0x3b3b20){return function(_0x860334){if(_0x860334){return _0x860334['update'](_0x53046d)[_0x000f('0x20')](function(_0x5ae592){return _0x5ae592;});}return null;};}function removeEntity(_0x3c793c,_0x548751){return function(_0x2a0ce4){if(_0x2a0ce4){return _0x2a0ce4[_0x000f('0x21')]()[_0x000f('0x20')](function(){_0x3c793c[_0x000f('0x16')](0xcc)[_0x000f('0x17')]();});}};}function handleEntityNotFound(_0x2b2b22,_0x5ed9ec){return function(_0x461d33){if(!_0x461d33){_0x2b2b22[_0x000f('0x22')](0x194);}return _0x461d33;};}function handleError(_0x6a6401,_0x55d962){_0x55d962=_0x55d962||0x1f4;return function(_0x12578c){logger[_0x000f('0x23')](_0x12578c[_0x000f('0x24')]);if(_0x12578c[_0x000f('0x25')]){delete _0x12578c[_0x000f('0x25')];}_0x6a6401[_0x000f('0x16')](_0x55d962)[_0x000f('0x26')](_0x12578c);};}exports['index']=function(_0x11c2a2,_0x3dfe25){var _0x42e13f={},_0x43e318={},_0x49ac76={'count':0x0,'rows':[]};var _0x8bc0ff=_['map'](db[_0x000f('0x27')][_0x000f('0x28')],function(_0x3cd2c2){return{'name':_0x3cd2c2[_0x000f('0x29')],'type':_0x3cd2c2[_0x000f('0x2a')]['key']};});_0x43e318[_0x000f('0x2b')]=_[_0x000f('0x2c')](_0x8bc0ff,'name');_0x43e318[_0x000f('0x2d')]=_[_0x000f('0x2e')](_0x11c2a2[_0x000f('0x2d')]);_0x43e318[_0x000f('0x2f')]=_[_0x000f('0x30')](_0x43e318[_0x000f('0x2b')],_0x43e318[_0x000f('0x2d')]);_0x42e13f[_0x000f('0x31')]=_['intersection'](_0x43e318[_0x000f('0x2b')],qs['fields'](_0x11c2a2['query'][_0x000f('0x32')]));_0x42e13f[_0x000f('0x31')]=_0x42e13f[_0x000f('0x31')][_0x000f('0x33')]?_0x42e13f[_0x000f('0x31')]:_0x43e318[_0x000f('0x2b')];if(!_0x11c2a2['query'][_0x000f('0x34')]('nolimit')){_0x42e13f['limit']=qs[_0x000f('0x1a')](_0x11c2a2[_0x000f('0x2d')]['limit']);_0x42e13f['offset']=qs[_0x000f('0x18')](_0x11c2a2['query']['offset']);}_0x42e13f[_0x000f('0x35')]=qs[_0x000f('0x36')](_0x11c2a2[_0x000f('0x2d')]['sort']);_0x42e13f['where']=qs[_0x000f('0x2f')](_[_0x000f('0x37')](_0x11c2a2[_0x000f('0x2d')],_0x43e318[_0x000f('0x2f')]),_0x8bc0ff);if(_0x11c2a2['query']['filter']){_0x42e13f[_0x000f('0x38')]=_[_0x000f('0x39')](_0x42e13f['where'],{'$or':_['map'](_0x8bc0ff,function(_0x2e02fb){if(_0x2e02fb[_0x000f('0x2a')]!==_0x000f('0x3a')){var _0x54c56c={};_0x54c56c[_0x2e02fb['name']]={'$like':'%'+_0x11c2a2['query'][_0x000f('0x3b')]+'%'};return _0x54c56c;}})});}_0x42e13f=_['merge']({},_0x42e13f,_0x11c2a2[_0x000f('0x3c')]);var _0x275904={'where':_0x42e13f[_0x000f('0x38')]};return db[_0x000f('0x27')][_0x000f('0x1b')](_0x275904)['then'](function(_0x5d0d6a){_0x49ac76[_0x000f('0x1b')]=_0x5d0d6a;if(_0x11c2a2[_0x000f('0x2d')]['includeAll']){_0x42e13f[_0x000f('0x3d')]=[{'all':!![]}];}return db['ChatQueueReport']['findAll'](_0x42e13f);})['then'](function(_0x729d24){_0x49ac76[_0x000f('0x3e')]=_0x729d24;return _0x49ac76;})[_0x000f('0x20')](respondWithFilteredResult(_0x3dfe25,_0x42e13f))[_0x000f('0x3f')](handleError(_0x3dfe25,null));};exports[_0x000f('0x40')]=function(_0x888afb,_0x2c82ef){var _0x4c5d38={'raw':!![],'where':{'id':_0x888afb[_0x000f('0x41')]['id']}},_0x52b393={};_0x52b393['model']=_[_0x000f('0x2e')](db[_0x000f('0x27')][_0x000f('0x28')]);_0x52b393['query']=_[_0x000f('0x2e')](_0x888afb['query']);_0x52b393[_0x000f('0x2f')]=_[_0x000f('0x30')](_0x52b393[_0x000f('0x2b')],_0x52b393['query']);_0x4c5d38[_0x000f('0x31')]=_[_0x000f('0x30')](_0x52b393['model'],qs[_0x000f('0x32')](_0x888afb[_0x000f('0x2d')][_0x000f('0x32')]));_0x4c5d38[_0x000f('0x31')]=_0x4c5d38[_0x000f('0x31')][_0x000f('0x33')]?_0x4c5d38[_0x000f('0x31')]:_0x52b393['model'];if(_0x888afb['query'][_0x000f('0x42')]){_0x4c5d38[_0x000f('0x3d')]=[{'all':!![]}];}_0x4c5d38=_[_0x000f('0x39')]({},_0x4c5d38,_0x888afb[_0x000f('0x3c')]);return db[_0x000f('0x27')][_0x000f('0x43')](_0x4c5d38)[_0x000f('0x20')](handleEntityNotFound(_0x2c82ef,null))[_0x000f('0x20')](respondWithResult(_0x2c82ef,null))[_0x000f('0x3f')](handleError(_0x2c82ef,null));};exports[_0x000f('0x44')]=function(_0x9952c3,_0x2a8e7f){return db[_0x000f('0x27')][_0x000f('0x44')](_0x9952c3[_0x000f('0x45')],{})[_0x000f('0x20')](respondWithResult(_0x2a8e7f,0xc9))[_0x000f('0x3f')](handleError(_0x2a8e7f,null));};exports[_0x000f('0x46')]=function(_0x2d3700,_0x5257de){if(_0x2d3700[_0x000f('0x45')]['id']){delete _0x2d3700[_0x000f('0x45')]['id'];}return db[_0x000f('0x27')][_0x000f('0x43')]({'where':{'id':_0x2d3700[_0x000f('0x41')]['id']}})[_0x000f('0x20')](handleEntityNotFound(_0x5257de,null))['then'](saveUpdates(_0x2d3700['body'],null))[_0x000f('0x20')](respondWithResult(_0x5257de,null))[_0x000f('0x3f')](handleError(_0x5257de,null));};exports[_0x000f('0x21')]=function(_0x53467d,_0x1331c3){return db[_0x000f('0x27')][_0x000f('0x43')]({'where':{'id':_0x53467d[_0x000f('0x41')]['id']}})[_0x000f('0x20')](handleEntityNotFound(_0x1331c3,null))['then'](removeEntity(_0x1331c3,null))[_0x000f('0x3f')](handleError(_0x1331c3,null));};exports[_0x000f('0x47')]=function(_0x20b069,_0x51b5af){return db[_0x000f('0x27')]['describe']()['then'](respondWithResult(_0x51b5af,null))[_0x000f('0x3f')](handleError(_0x51b5af,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 77313fb..27d436a 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 _0xe706=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define','ChatQueueReport','report_chat_queue','uniqueid','lodash','util'];(function(_0x1b7171,_0x533d9a){var _0x3c3db2=function(_0x4d7038){while(--_0x4d7038){_0x1b7171['push'](_0x1b7171['shift']());}};_0x3c3db2(++_0x533d9a);}(_0xe706,0xa3));var _0x6e70=function(_0x4a611d,_0x36da69){_0x4a611d=_0x4a611d-0x0;var _0xde08a3=_0xe706[_0x4a611d];return _0xde08a3;};'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 +var _0xb10b=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define','report_chat_queue','uniqueid','lodash'];(function(_0x580b15,_0x28afa4){var _0x1adb1b=function(_0x47a01f){while(--_0x47a01f){_0x580b15['push'](_0x580b15['shift']());}};_0x1adb1b(++_0x28afa4);}(_0xb10b,0x12a));var _0xbb10=function(_0x2f59f1,_0xdfe0c6){_0x2f59f1=_0x2f59f1-0x0;var _0x2ee114=_0xb10b[_0x2f59f1];return _0x2ee114;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var logger=require(_0xbb10('0x1'))(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var BPromise=require('bluebird');var rp=require(_0xbb10('0x4'));var fs=require('fs');var path=require(_0xbb10('0x5'));var rimraf=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var attributes=require(_0xbb10('0x8'));module[_0xbb10('0x9')]=function(_0x481979,_0x328583){return _0x481979[_0xbb10('0xa')]('ChatQueueReport',attributes,{'tableName':_0xbb10('0xb'),'paranoid':![],'indexes':[{'name':_0xbb10('0xc'),'fields':[_0xbb10('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index 969d472..2eb7131 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 _0xb746=['attributes','util','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','client','http','request','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','error','message','result','catch','CreateChatQueueReport','ChatQueueReport','create','body','options','raw','stringify','UpdateChatQueueReport','where'];(function(_0x12b8ec,_0x1655be){var _0x21af77=function(_0xe59f){while(--_0xe59f){_0x12b8ec['push'](_0x12b8ec['shift']());}};_0x21af77(++_0x1655be);}(_0xb746,0x187));var _0x6b74=function(_0x4667e3,_0x4d446c){_0x4667e3=_0x4667e3-0x0;var _0x3d3ed4=_0xb746[_0x4667e3];return _0x3d3ed4;};'use strict';var _=require('lodash');var util=require(_0x6b74('0x0'));var moment=require(_0x6b74('0x1'));var BPromise=require(_0x6b74('0x2'));var rs=require(_0x6b74('0x3'));var fs=require('fs');var Redis=require(_0x6b74('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x6b74('0x5'))('rpc');var config=require(_0x6b74('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x6b74('0x7')][_0x6b74('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x570a1c,_0x83cd31,_0x52d98c){return new BPromise(function(_0x5518d8,_0x6d3d5a){return client[_0x6b74('0x9')](_0x570a1c,_0x52d98c)[_0x6b74('0xa')](function(_0x569c0a){logger[_0x6b74('0xb')](_0x6b74('0xc'),_0x83cd31,_0x6b74('0xd'));logger[_0x6b74('0xe')](_0x6b74('0xf'),_0x83cd31,_0x6b74('0xd'),JSON['stringify'](_0x569c0a));if(_0x569c0a[_0x6b74('0x10')]){if(_0x569c0a[_0x6b74('0x10')]['code']===0x1f4){logger['error'](_0x6b74('0xc'),_0x83cd31,_0x569c0a[_0x6b74('0x10')][_0x6b74('0x11')]);return _0x6d3d5a(_0x569c0a[_0x6b74('0x10')][_0x6b74('0x11')]);}logger[_0x6b74('0x10')](_0x6b74('0xc'),_0x83cd31,_0x569c0a[_0x6b74('0x10')]['message']);return _0x5518d8(_0x569c0a[_0x6b74('0x10')][_0x6b74('0x11')]);}else{logger[_0x6b74('0xb')](_0x6b74('0xc'),_0x83cd31,_0x6b74('0xd'));_0x5518d8(_0x569c0a[_0x6b74('0x12')][_0x6b74('0x11')]);}})[_0x6b74('0x13')](function(_0x2f1dfc){logger['error'](_0x6b74('0xc'),_0x83cd31,_0x2f1dfc);_0x6d3d5a(_0x2f1dfc);});});}exports[_0x6b74('0x14')]=function(_0x22b623){var _0x5d4923=this;return new Promise(function(_0x5f2b0a,_0x5371c7){return db[_0x6b74('0x15')][_0x6b74('0x16')](_0x22b623[_0x6b74('0x17')],{'raw':_0x22b623['options']?_0x22b623[_0x6b74('0x18')][_0x6b74('0x19')]===undefined?!![]:![]:!![]})[_0x6b74('0xa')](function(_0x3078bc){logger[_0x6b74('0xb')]('CreateChatQueueReport',_0x22b623);logger[_0x6b74('0xe')]('CreateChatQueueReport',_0x22b623,JSON[_0x6b74('0x1a')](_0x3078bc));_0x5f2b0a(_0x3078bc);})[_0x6b74('0x13')](function(_0x1a56e7){logger[_0x6b74('0x10')](_0x6b74('0x14'),_0x1a56e7[_0x6b74('0x11')],_0x22b623);_0x5371c7(_0x5d4923['error'](0x1f4,_0x1a56e7['message']));});});};exports[_0x6b74('0x1b')]=function(_0xf1b1e4){var _0x2829f9=this;return new Promise(function(_0x1911bf,_0x3b2a9a){return db['ChatQueueReport']['update'](_0xf1b1e4[_0x6b74('0x17')],{'raw':_0xf1b1e4[_0x6b74('0x18')]?_0xf1b1e4[_0x6b74('0x18')][_0x6b74('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xf1b1e4['options']?_0xf1b1e4[_0x6b74('0x18')][_0x6b74('0x1c')]||null:null,'attributes':_0xf1b1e4[_0x6b74('0x18')]?_0xf1b1e4['options'][_0x6b74('0x1d')]||null:null,'limit':_0xf1b1e4[_0x6b74('0x18')]?_0xf1b1e4[_0x6b74('0x18')]['limit']||null:null})[_0x6b74('0xa')](function(_0x54056e){logger[_0x6b74('0xb')](_0x6b74('0x1b'),_0xf1b1e4);logger['debug'](_0x6b74('0x1b'),_0xf1b1e4,JSON[_0x6b74('0x1a')](_0x54056e));_0x1911bf(_0x54056e);})['catch'](function(_0x6ba794){logger[_0x6b74('0x10')]('UpdateChatQueueReport',_0x6ba794[_0x6b74('0x11')],_0xf1b1e4);_0x3b2a9a(_0x2829f9['error'](0x1f4,_0x6ba794[_0x6b74('0x11')]));});});}; \ No newline at end of file +var _0xf850=['moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','create','body','options','CreateChatQueueReport','UpdateChatQueueReport','update','raw','where','limit','util'];(function(_0x2d2f95,_0x59070d){var _0x2e9379=function(_0x24aba2){while(--_0x24aba2){_0x2d2f95['push'](_0x2d2f95['shift']());}};_0x2e9379(++_0x59070d);}(_0xf850,0x9a));var _0x0f85=function(_0x3d5f8a,_0x471f1b){_0x3d5f8a=_0x3d5f8a-0x0;var _0x3a6291=_0xf850[_0x3d5f8a];return _0x3a6291;};'use strict';var _=require('lodash');var util=require(_0x0f85('0x0'));var moment=require(_0x0f85('0x1'));var BPromise=require(_0x0f85('0x2'));var rs=require(_0x0f85('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0f85('0x4'))['db'];var utils=require(_0x0f85('0x5'));var logger=require(_0x0f85('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x0f85('0x7'));var client=jayson[_0x0f85('0x8')][_0x0f85('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1597c5,_0x2625c5,_0x5751f6){return new BPromise(function(_0x2e8ee6,_0x14dfaa){return client[_0x0f85('0xa')](_0x1597c5,_0x5751f6)[_0x0f85('0xb')](function(_0x495d85){logger['info'](_0x0f85('0xc'),_0x2625c5,_0x0f85('0xd'));logger[_0x0f85('0xe')](_0x0f85('0xf'),_0x2625c5,_0x0f85('0xd'),JSON[_0x0f85('0x10')](_0x495d85));if(_0x495d85[_0x0f85('0x11')]){if(_0x495d85[_0x0f85('0x11')]['code']===0x1f4){logger[_0x0f85('0x11')]('ChatQueueReport,\x20%s,\x20%s',_0x2625c5,_0x495d85[_0x0f85('0x11')][_0x0f85('0x12')]);return _0x14dfaa(_0x495d85['error'][_0x0f85('0x12')]);}logger[_0x0f85('0x11')](_0x0f85('0xc'),_0x2625c5,_0x495d85[_0x0f85('0x11')]['message']);return _0x2e8ee6(_0x495d85[_0x0f85('0x11')][_0x0f85('0x12')]);}else{logger[_0x0f85('0x13')](_0x0f85('0xc'),_0x2625c5,'request\x20sent');_0x2e8ee6(_0x495d85[_0x0f85('0x14')][_0x0f85('0x12')]);}})[_0x0f85('0x15')](function(_0x25db5f){logger[_0x0f85('0x11')](_0x0f85('0xc'),_0x2625c5,_0x25db5f);_0x14dfaa(_0x25db5f);});});}exports['CreateChatQueueReport']=function(_0x434200){var _0x329869=this;return new Promise(function(_0xcdba50,_0xeb2bc0){return db['ChatQueueReport'][_0x0f85('0x16')](_0x434200[_0x0f85('0x17')],{'raw':_0x434200['options']?_0x434200[_0x0f85('0x18')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x40ade4){logger[_0x0f85('0x13')]('CreateChatQueueReport',_0x434200);logger[_0x0f85('0xe')](_0x0f85('0x19'),_0x434200,JSON[_0x0f85('0x10')](_0x40ade4));_0xcdba50(_0x40ade4);})['catch'](function(_0x270832){logger[_0x0f85('0x11')](_0x0f85('0x19'),_0x270832[_0x0f85('0x12')],_0x434200);_0xeb2bc0(_0x329869['error'](0x1f4,_0x270832[_0x0f85('0x12')]));});});};exports[_0x0f85('0x1a')]=function(_0x57e254){var _0x5d274c=this;return new Promise(function(_0x4b62c7,_0x11b5dc){return db['ChatQueueReport'][_0x0f85('0x1b')](_0x57e254[_0x0f85('0x17')],{'raw':_0x57e254[_0x0f85('0x18')]?_0x57e254['options'][_0x0f85('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x57e254[_0x0f85('0x18')]?_0x57e254[_0x0f85('0x18')][_0x0f85('0x1d')]||null:null,'attributes':_0x57e254[_0x0f85('0x18')]?_0x57e254[_0x0f85('0x18')]['attributes']||null:null,'limit':_0x57e254[_0x0f85('0x18')]?_0x57e254[_0x0f85('0x18')][_0x0f85('0x1e')]||null:null})[_0x0f85('0xb')](function(_0x32f0c6){logger[_0x0f85('0x13')](_0x0f85('0x1a'),_0x57e254);logger[_0x0f85('0xe')]('UpdateChatQueueReport',_0x57e254,JSON['stringify'](_0x32f0c6));_0x4b62c7(_0x32f0c6);})[_0x0f85('0x15')](function(_0x1d96f5){logger[_0x0f85('0x11')]('UpdateChatQueueReport',_0x1d96f5['message'],_0x57e254);_0x11b5dc(_0x5d274c[_0x0f85('0x11')](0x1f4,_0x1d96f5[_0x0f85('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index d23bc9f..5260918 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 _0x15b0=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','index','isAuthenticated','show','post','create','put','update','delete','/:id','destroy','multer','util','path'];(function(_0x2d7c0a,_0x1c9c50){var _0x3f51e7=function(_0x3e1ee1){while(--_0x3e1ee1){_0x2d7c0a['push'](_0x2d7c0a['shift']());}};_0x3f51e7(++_0x1c9c50);}(_0x15b0,0xd9));var _0x015b=function(_0x593b33,_0x1ea034){_0x593b33=_0x593b33-0x0;var _0x2f17a2=_0x15b0[_0x593b33];return _0x2f17a2;};'use strict';var multer=require(_0x015b('0x0'));var util=require(_0x015b('0x1'));var path=require(_0x015b('0x2'));var timeout=require(_0x015b('0x3'));var express=require(_0x015b('0x4'));var router=express[_0x015b('0x5')]();var fs_extra=require(_0x015b('0x6'));var auth=require(_0x015b('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x015b('0x8'));var controller=require('./chatQueueReport.controller');router[_0x015b('0x9')]('/',auth['isAuthenticated'](),controller[_0x015b('0xa')]);router['get']('/describe',auth[_0x015b('0xb')](),controller['describe']);router[_0x015b('0x9')]('/:id',auth[_0x015b('0xb')](),controller[_0x015b('0xc')]);router[_0x015b('0xd')]('/',auth['isAuthenticated'](),controller[_0x015b('0xe')]);router[_0x015b('0xf')]('/:id',auth[_0x015b('0xb')](),controller[_0x015b('0x10')]);router[_0x015b('0x11')](_0x015b('0x12'),auth[_0x015b('0xb')](),controller[_0x015b('0x13')]);module['exports']=router; \ No newline at end of file +var _0xde7d=['exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatQueueReport.controller','get','index','/describe','isAuthenticated','describe','/:id','post','put','update','destroy'];(function(_0x51153d,_0x173369){var _0x134a20=function(_0x3f36db){while(--_0x3f36db){_0x51153d['push'](_0x51153d['shift']());}};_0x134a20(++_0x173369);}(_0xde7d,0x141));var _0xdde7=function(_0x526640,_0x59b927){_0x526640=_0x526640-0x0;var _0x4ce32b=_0xde7d[_0x526640];return _0x4ce32b;};'use strict';var multer=require(_0xdde7('0x0'));var util=require(_0xdde7('0x1'));var path=require('path');var timeout=require(_0xdde7('0x2'));var express=require(_0xdde7('0x3'));var router=express[_0xdde7('0x4')]();var fs_extra=require(_0xdde7('0x5'));var auth=require(_0xdde7('0x6'));var interaction=require(_0xdde7('0x7'));var config=require('../../config/environment');var controller=require(_0xdde7('0x8'));router[_0xdde7('0x9')]('/',auth['isAuthenticated'](),controller[_0xdde7('0xa')]);router[_0xdde7('0x9')](_0xdde7('0xb'),auth[_0xdde7('0xc')](),controller[_0xdde7('0xd')]);router[_0xdde7('0x9')](_0xdde7('0xe'),auth[_0xdde7('0xc')](),controller['show']);router[_0xdde7('0xf')]('/',auth[_0xdde7('0xc')](),controller['create']);router[_0xdde7('0x10')]('/:id',auth[_0xdde7('0xc')](),controller[_0xdde7('0x11')]);router['delete']('/:id',auth[_0xdde7('0xc')](),controller[_0xdde7('0x12')]);module[_0xdde7('0x13')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index c7dcbfb..3840d19 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 _0x70e0=['NOW','moment','sequelize','exports','account','agent','queue'];(function(_0x267fa3,_0x3027ea){var _0xc4653c=function(_0x3f7909){while(--_0x3f7909){_0x267fa3['push'](_0x267fa3['shift']());}};_0xc4653c(++_0x3027ea);}(_0x70e0,0x17b));var _0x070e=function(_0x252733,_0x1226da){_0x252733=_0x252733-0x0;var _0x17ab14=_0x70e0[_0x252733];return _0x17ab14;};'use strict';var moment=require(_0x070e('0x0'));var Sequelize=require(_0x070e('0x1'));module[_0x070e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x070e('0x3'),_0x070e('0x4'),_0x070e('0x5')),'allowNull':![],'defaultValue':_0x070e('0x5')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x070e('0x6')]}}; \ No newline at end of file +var _0x70e0=['NOW','moment','sequelize','exports','account','agent','queue'];(function(_0x694142,_0x2401c3){var _0x418ac5=function(_0x44ec11){while(--_0x44ec11){_0x694142['push'](_0x694142['shift']());}};_0x418ac5(++_0x2401c3);}(_0x70e0,0x17b));var _0x070e=function(_0x1c1777,_0x4290ba){_0x1c1777=_0x1c1777-0x0;var _0x191f95=_0x70e0[_0x1c1777];return _0x191f95;};'use strict';var moment=require(_0x070e('0x0'));var Sequelize=require(_0x070e('0x1'));module[_0x070e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x070e('0x3'),_0x070e('0x4'),_0x070e('0x5')),'allowNull':![],'defaultValue':_0x070e('0x5')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x070e('0x6')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index c85639a..c445307 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 _0x34e3=['papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','sendStatus','name','send','index','map','ChatTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','describe','rimraf','fast-json-patch','bluebird','mustache','sox','to-csv','fs-extra','lodash','jsforce','desk.js','querystring'];(function(_0x148448,_0x50abd9){var _0x10ef46=function(_0x27ad04){while(--_0x27ad04){_0x148448['push'](_0x148448['shift']());}};_0x10ef46(++_0x50abd9);}(_0x34e3,0xc4));var _0x334e=function(_0x5a88e8,_0x3827a3){_0x5a88e8=_0x5a88e8-0x0;var _0x51de83=_0x34e3[_0x5a88e8];return _0x51de83;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x334e('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x334e('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x334e('0x2'));var Mustache=require(_0x334e('0x3'));var util=require('util');var path=require('path');var sox=require(_0x334e('0x4'));var csv=require(_0x334e('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x334e('0x6'));var _=require(_0x334e('0x7'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x334e('0x8'));var deskjs=require(_0x334e('0x9'));var toCsv=require(_0x334e('0x5'));var querystring=require(_0x334e('0xa'));var Papa=require(_0x334e('0xb'));var Redis=require(_0x334e('0xc'));var authService=require(_0x334e('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x334e('0xe'));var hardwareService=require(_0x334e('0xf'));var logger=require('../../config/logger')(_0x334e('0x10'));var utils=require('../../config/utils');var config=require(_0x334e('0x11'));var licenseUtil=require(_0x334e('0x12'));var db=require(_0x334e('0x13'))['db'];function respondWithStatusCode(_0x49c0c4,_0x560233){_0x560233=_0x560233||0xcc;return function(_0x471321){if(_0x471321){return _0x49c0c4['sendStatus'](_0x560233);}return _0x49c0c4[_0x334e('0x14')](_0x560233)['end']();};}function respondWithResult(_0x408cf2,_0x36a47a){_0x36a47a=_0x36a47a||0xc8;return function(_0xc95b6a){if(_0xc95b6a){return _0x408cf2[_0x334e('0x14')](_0x36a47a)[_0x334e('0x15')](_0xc95b6a);}};}function respondWithFilteredResult(_0x2386ee,_0x9af5eb){return function(_0x8cf419){if(_0x8cf419){var _0x749685=typeof _0x9af5eb[_0x334e('0x16')]===_0x334e('0x17')&&typeof _0x9af5eb[_0x334e('0x18')]===_0x334e('0x17');var _0x3cd725=_0x8cf419['count'];var _0x5c3475=_0x749685?0x0:_0x9af5eb['offset'];var _0x14efed=_0x749685?_0x8cf419[_0x334e('0x19')]:_0x9af5eb[_0x334e('0x16')]+_0x9af5eb[_0x334e('0x18')];var _0x4ee64d;if(_0x14efed>=_0x3cd725){_0x14efed=_0x3cd725;_0x4ee64d=0xc8;}else{_0x4ee64d=0xce;}_0x2386ee[_0x334e('0x14')](_0x4ee64d);return _0x2386ee['set'](_0x334e('0x1a'),_0x5c3475+'-'+_0x14efed+'/'+_0x3cd725)[_0x334e('0x15')](_0x8cf419);}return null;};}function patchUpdates(_0x1022cb){return function(_0xc21bec){try{jsonpatch[_0x334e('0x1b')](_0xc21bec,_0x1022cb,!![]);}catch(_0x144b58){return BPromise[_0x334e('0x1c')](_0x144b58);}return _0xc21bec[_0x334e('0x1d')]();};}function saveUpdates(_0x523b4c,_0x31c6e6){return function(_0x116f4e){if(_0x116f4e){return _0x116f4e[_0x334e('0x1e')](_0x523b4c)[_0x334e('0x1f')](function(_0x42a55f){return _0x42a55f;});}return null;};}function removeEntity(_0x2d1a00,_0x4e32fb){return function(_0x48f4b9){if(_0x48f4b9){return _0x48f4b9[_0x334e('0x20')]()['then'](function(){_0x2d1a00[_0x334e('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x512166,_0xbd91dd){return function(_0x4cda0b){if(!_0x4cda0b){_0x512166[_0x334e('0x21')](0x194);}return _0x4cda0b;};}function handleError(_0x48e6db,_0x1ec53){_0x1ec53=_0x1ec53||0x1f4;return function(_0xc8348){logger['error'](_0xc8348['stack']);if(_0xc8348['name']){delete _0xc8348[_0x334e('0x22')];}_0x48e6db['status'](_0x1ec53)[_0x334e('0x23')](_0xc8348);};}exports[_0x334e('0x24')]=function(_0x4cbb5e,_0x8c4a88){var _0x5c78bb={},_0x560924={},_0x616afa={'count':0x0,'rows':[]};var _0x94f2df=_[_0x334e('0x25')](db[_0x334e('0x26')][_0x334e('0x27')],function(_0x266abd){return{'name':_0x266abd[_0x334e('0x28')],'type':_0x266abd[_0x334e('0x29')][_0x334e('0x2a')]};});_0x560924[_0x334e('0x2b')]=_['map'](_0x94f2df,_0x334e('0x22'));_0x560924[_0x334e('0x2c')]=_[_0x334e('0x2d')](_0x4cbb5e['query']);_0x560924[_0x334e('0x2e')]=_[_0x334e('0x2f')](_0x560924[_0x334e('0x2b')],_0x560924[_0x334e('0x2c')]);_0x5c78bb[_0x334e('0x30')]=_[_0x334e('0x2f')](_0x560924[_0x334e('0x2b')],qs[_0x334e('0x31')](_0x4cbb5e[_0x334e('0x2c')][_0x334e('0x31')]));_0x5c78bb[_0x334e('0x30')]=_0x5c78bb['attributes'][_0x334e('0x32')]?_0x5c78bb[_0x334e('0x30')]:_0x560924[_0x334e('0x2b')];if(!_0x4cbb5e[_0x334e('0x2c')]['hasOwnProperty']('nolimit')){_0x5c78bb[_0x334e('0x18')]=qs[_0x334e('0x18')](_0x4cbb5e['query']['limit']);_0x5c78bb[_0x334e('0x16')]=qs[_0x334e('0x16')](_0x4cbb5e[_0x334e('0x2c')]['offset']);}_0x5c78bb[_0x334e('0x33')]=qs[_0x334e('0x34')](_0x4cbb5e[_0x334e('0x2c')][_0x334e('0x34')]);_0x5c78bb[_0x334e('0x35')]=qs['filters'](_[_0x334e('0x36')](_0x4cbb5e['query'],_0x560924[_0x334e('0x2e')]),_0x94f2df);if(_0x4cbb5e[_0x334e('0x2c')]['filter']){_0x5c78bb[_0x334e('0x35')]=_['merge'](_0x5c78bb[_0x334e('0x35')],{'$or':_[_0x334e('0x25')](_0x94f2df,function(_0x58a179){if(_0x58a179[_0x334e('0x29')]!==_0x334e('0x37')){var _0xbc3949={};_0xbc3949[_0x58a179[_0x334e('0x22')]]={'$like':'%'+_0x4cbb5e[_0x334e('0x2c')]['filter']+'%'};return _0xbc3949;}})});}_0x5c78bb=_[_0x334e('0x38')]({},_0x5c78bb,_0x4cbb5e['options']);var _0x3d93a0={'where':_0x5c78bb[_0x334e('0x35')]};return db[_0x334e('0x26')][_0x334e('0x19')](_0x3d93a0)[_0x334e('0x1f')](function(_0x3a88f9){_0x616afa[_0x334e('0x19')]=_0x3a88f9;if(_0x4cbb5e['query'][_0x334e('0x39')]){_0x5c78bb[_0x334e('0x3a')]=[{'all':!![]}];}return db['ChatTransferReport'][_0x334e('0x3b')](_0x5c78bb);})[_0x334e('0x1f')](function(_0x5768ce){_0x616afa[_0x334e('0x3c')]=_0x5768ce;return _0x616afa;})['then'](respondWithFilteredResult(_0x8c4a88,_0x5c78bb))[_0x334e('0x3d')](handleError(_0x8c4a88,null));};exports[_0x334e('0x3e')]=function(_0x226abc,_0x21aa64){var _0x5688c5={'raw':!![],'where':{'id':_0x226abc[_0x334e('0x3f')]['id']}},_0x3a2a0d={};_0x3a2a0d['model']=_['keys'](db[_0x334e('0x26')]['rawAttributes']);_0x3a2a0d[_0x334e('0x2c')]=_[_0x334e('0x2d')](_0x226abc[_0x334e('0x2c')]);_0x3a2a0d[_0x334e('0x2e')]=_[_0x334e('0x2f')](_0x3a2a0d[_0x334e('0x2b')],_0x3a2a0d[_0x334e('0x2c')]);_0x5688c5[_0x334e('0x30')]=_[_0x334e('0x2f')](_0x3a2a0d[_0x334e('0x2b')],qs['fields'](_0x226abc[_0x334e('0x2c')][_0x334e('0x31')]));_0x5688c5[_0x334e('0x30')]=_0x5688c5[_0x334e('0x30')][_0x334e('0x32')]?_0x5688c5[_0x334e('0x30')]:_0x3a2a0d['model'];if(_0x226abc[_0x334e('0x2c')]['includeAll']){_0x5688c5[_0x334e('0x3a')]=[{'all':!![]}];}_0x5688c5=_[_0x334e('0x38')]({},_0x5688c5,_0x226abc[_0x334e('0x40')]);return db[_0x334e('0x26')][_0x334e('0x41')](_0x5688c5)[_0x334e('0x1f')](handleEntityNotFound(_0x21aa64,null))[_0x334e('0x1f')](respondWithResult(_0x21aa64,null))[_0x334e('0x3d')](handleError(_0x21aa64,null));};exports['create']=function(_0x1d55c2,_0x1941d2){return db[_0x334e('0x26')][_0x334e('0x42')](_0x1d55c2['body'],{})[_0x334e('0x1f')](respondWithResult(_0x1941d2,0xc9))[_0x334e('0x3d')](handleError(_0x1941d2,null));};exports[_0x334e('0x1e')]=function(_0x408362,_0x54c9a4){if(_0x408362[_0x334e('0x43')]['id']){delete _0x408362[_0x334e('0x43')]['id'];}return db['ChatTransferReport']['find']({'where':{'id':_0x408362[_0x334e('0x3f')]['id']}})[_0x334e('0x1f')](handleEntityNotFound(_0x54c9a4,null))['then'](saveUpdates(_0x408362[_0x334e('0x43')],null))[_0x334e('0x1f')](respondWithResult(_0x54c9a4,null))[_0x334e('0x3d')](handleError(_0x54c9a4,null));};exports[_0x334e('0x20')]=function(_0x1dd99e,_0x12cf30){return db[_0x334e('0x26')][_0x334e('0x41')]({'where':{'id':_0x1dd99e[_0x334e('0x3f')]['id']}})[_0x334e('0x1f')](handleEntityNotFound(_0x12cf30,null))[_0x334e('0x1f')](removeEntity(_0x12cf30,null))[_0x334e('0x3d')](handleError(_0x12cf30,null));};exports[_0x334e('0x44')]=function(_0x2c9619,_0x5cae35){return db[_0x334e('0x26')][_0x334e('0x44')]()[_0x334e('0x1f')](respondWithResult(_0x5cae35,null))[_0x334e('0x3d')](handleError(_0x5cae35,null));}; \ No newline at end of file +var _0x985d=['../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','limit','undefined','set','reject','then','destroy','stack','name','send','index','map','ChatTransferReport','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','count','include','rows','catch','show','params','rawAttributes','includeAll','body','update','find','describe','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','ioredis','../../components/auth/service','../../components/parsers/advancedSearch'];(function(_0xd9c489,_0x3dfdc3){var _0x5504eb=function(_0x5bd4a8){while(--_0x5bd4a8){_0xd9c489['push'](_0xd9c489['shift']());}};_0x5504eb(++_0x3dfdc3);}(_0x985d,0x10b));var _0xd985=function(_0x3d1903,_0x347db6){_0x3d1903=_0x3d1903-0x0;var _0x3c3d11=_0x985d[_0x3d1903];return _0x3c3d11;};'use strict';var emlformat=require(_0xd985('0x0'));var rimraf=require(_0xd985('0x1'));var zipdir=require(_0xd985('0x2'));var jsonpatch=require(_0xd985('0x3'));var rp=require(_0xd985('0x4'));var moment=require(_0xd985('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xd985('0x6'));var path=require(_0xd985('0x7'));var sox=require(_0xd985('0x8'));var csv=require(_0xd985('0x9'));var ejs=require(_0xd985('0xa'));var fs=require('fs');var fs_extra=require(_0xd985('0xb'));var _=require(_0xd985('0xc'));var squel=require(_0xd985('0xd'));var crypto=require('crypto');var jsforce=require(_0xd985('0xe'));var deskjs=require(_0xd985('0xf'));var toCsv=require(_0xd985('0x9'));var querystring=require(_0xd985('0x10'));var Papa=require(_0xd985('0x11'));var Redis=require(_0xd985('0x12'));var authService=require(_0xd985('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xd985('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd985('0x15'))(_0xd985('0x16'));var utils=require('../../config/utils');var config=require(_0xd985('0x17'));var licenseUtil=require(_0xd985('0x18'));var db=require(_0xd985('0x19'))['db'];function respondWithStatusCode(_0x4bb652,_0xc0bc10){_0xc0bc10=_0xc0bc10||0xcc;return function(_0x59f6b3){if(_0x59f6b3){return _0x4bb652[_0xd985('0x1a')](_0xc0bc10);}return _0x4bb652[_0xd985('0x1b')](_0xc0bc10)['end']();};}function respondWithResult(_0x3c31c0,_0x1909c9){_0x1909c9=_0x1909c9||0xc8;return function(_0x32c046){if(_0x32c046){return _0x3c31c0[_0xd985('0x1b')](_0x1909c9)['json'](_0x32c046);}};}function respondWithFilteredResult(_0x3e847d,_0x1671e4){return function(_0x11c29e){if(_0x11c29e){var _0x1ef03c=typeof _0x1671e4[_0xd985('0x1c')]==='undefined'&&typeof _0x1671e4[_0xd985('0x1d')]===_0xd985('0x1e');var _0x30302e=_0x11c29e['count'];var _0x44c917=_0x1ef03c?0x0:_0x1671e4[_0xd985('0x1c')];var _0x320971=_0x1ef03c?_0x11c29e['count']:_0x1671e4[_0xd985('0x1c')]+_0x1671e4[_0xd985('0x1d')];var _0x250837;if(_0x320971>=_0x30302e){_0x320971=_0x30302e;_0x250837=0xc8;}else{_0x250837=0xce;}_0x3e847d['status'](_0x250837);return _0x3e847d[_0xd985('0x1f')]('Content-Range',_0x44c917+'-'+_0x320971+'/'+_0x30302e)['json'](_0x11c29e);}return null;};}function patchUpdates(_0x532bd4){return function(_0x4b0153){try{jsonpatch['apply'](_0x4b0153,_0x532bd4,!![]);}catch(_0x3c0091){return BPromise[_0xd985('0x20')](_0x3c0091);}return _0x4b0153['save']();};}function saveUpdates(_0x34b381,_0x4e10c3){return function(_0x5ae3a4){if(_0x5ae3a4){return _0x5ae3a4['update'](_0x34b381)[_0xd985('0x21')](function(_0x3e1715){return _0x3e1715;});}return null;};}function removeEntity(_0x56a09d,_0x75bdda){return function(_0x368497){if(_0x368497){return _0x368497[_0xd985('0x22')]()[_0xd985('0x21')](function(){_0x56a09d[_0xd985('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x341bd3,_0x292a69){return function(_0x3a3004){if(!_0x3a3004){_0x341bd3[_0xd985('0x1a')](0x194);}return _0x3a3004;};}function handleError(_0x135231,_0x1ff5b5){_0x1ff5b5=_0x1ff5b5||0x1f4;return function(_0x480ede){logger['error'](_0x480ede[_0xd985('0x23')]);if(_0x480ede['name']){delete _0x480ede[_0xd985('0x24')];}_0x135231[_0xd985('0x1b')](_0x1ff5b5)[_0xd985('0x25')](_0x480ede);};}exports[_0xd985('0x26')]=function(_0x5d46c9,_0x5b923f){var _0xa62cb8={},_0x18c362={},_0xbb4af8={'count':0x0,'rows':[]};var _0x33aab5=_[_0xd985('0x27')](db[_0xd985('0x28')]['rawAttributes'],function(_0x4e8763){return{'name':_0x4e8763[_0xd985('0x29')],'type':_0x4e8763['type'][_0xd985('0x2a')]};});_0x18c362[_0xd985('0x2b')]=_[_0xd985('0x27')](_0x33aab5,_0xd985('0x24'));_0x18c362[_0xd985('0x2c')]=_[_0xd985('0x2d')](_0x5d46c9[_0xd985('0x2c')]);_0x18c362[_0xd985('0x2e')]=_[_0xd985('0x2f')](_0x18c362[_0xd985('0x2b')],_0x18c362['query']);_0xa62cb8[_0xd985('0x30')]=_['intersection'](_0x18c362[_0xd985('0x2b')],qs['fields'](_0x5d46c9['query'][_0xd985('0x31')]));_0xa62cb8[_0xd985('0x30')]=_0xa62cb8[_0xd985('0x30')][_0xd985('0x32')]?_0xa62cb8['attributes']:_0x18c362[_0xd985('0x2b')];if(!_0x5d46c9['query']['hasOwnProperty'](_0xd985('0x33'))){_0xa62cb8[_0xd985('0x1d')]=qs[_0xd985('0x1d')](_0x5d46c9['query'][_0xd985('0x1d')]);_0xa62cb8[_0xd985('0x1c')]=qs[_0xd985('0x1c')](_0x5d46c9[_0xd985('0x2c')][_0xd985('0x1c')]);}_0xa62cb8[_0xd985('0x34')]=qs[_0xd985('0x35')](_0x5d46c9[_0xd985('0x2c')][_0xd985('0x35')]);_0xa62cb8[_0xd985('0x36')]=qs[_0xd985('0x2e')](_[_0xd985('0x37')](_0x5d46c9[_0xd985('0x2c')],_0x18c362[_0xd985('0x2e')]),_0x33aab5);if(_0x5d46c9[_0xd985('0x2c')][_0xd985('0x38')]){_0xa62cb8[_0xd985('0x36')]=_[_0xd985('0x39')](_0xa62cb8['where'],{'$or':_[_0xd985('0x27')](_0x33aab5,function(_0x5aa984){if(_0x5aa984[_0xd985('0x3a')]!==_0xd985('0x3b')){var _0x149a1d={};_0x149a1d[_0x5aa984[_0xd985('0x24')]]={'$like':'%'+_0x5d46c9[_0xd985('0x2c')][_0xd985('0x38')]+'%'};return _0x149a1d;}})});}_0xa62cb8=_['merge']({},_0xa62cb8,_0x5d46c9['options']);var _0x565d38={'where':_0xa62cb8[_0xd985('0x36')]};return db[_0xd985('0x28')][_0xd985('0x3c')](_0x565d38)[_0xd985('0x21')](function(_0x18fdd6){_0xbb4af8[_0xd985('0x3c')]=_0x18fdd6;if(_0x5d46c9[_0xd985('0x2c')]['includeAll']){_0xa62cb8[_0xd985('0x3d')]=[{'all':!![]}];}return db['ChatTransferReport']['findAll'](_0xa62cb8);})['then'](function(_0x379f6c){_0xbb4af8[_0xd985('0x3e')]=_0x379f6c;return _0xbb4af8;})['then'](respondWithFilteredResult(_0x5b923f,_0xa62cb8))[_0xd985('0x3f')](handleError(_0x5b923f,null));};exports[_0xd985('0x40')]=function(_0x51cb63,_0xf2fcaa){var _0x7b8132={'raw':!![],'where':{'id':_0x51cb63[_0xd985('0x41')]['id']}},_0x5e41e4={};_0x5e41e4['model']=_[_0xd985('0x2d')](db[_0xd985('0x28')][_0xd985('0x42')]);_0x5e41e4[_0xd985('0x2c')]=_['keys'](_0x51cb63['query']);_0x5e41e4['filters']=_[_0xd985('0x2f')](_0x5e41e4[_0xd985('0x2b')],_0x5e41e4[_0xd985('0x2c')]);_0x7b8132[_0xd985('0x30')]=_['intersection'](_0x5e41e4[_0xd985('0x2b')],qs[_0xd985('0x31')](_0x51cb63[_0xd985('0x2c')][_0xd985('0x31')]));_0x7b8132['attributes']=_0x7b8132[_0xd985('0x30')][_0xd985('0x32')]?_0x7b8132[_0xd985('0x30')]:_0x5e41e4[_0xd985('0x2b')];if(_0x51cb63['query'][_0xd985('0x43')]){_0x7b8132[_0xd985('0x3d')]=[{'all':!![]}];}_0x7b8132=_[_0xd985('0x39')]({},_0x7b8132,_0x51cb63['options']);return db[_0xd985('0x28')]['find'](_0x7b8132)[_0xd985('0x21')](handleEntityNotFound(_0xf2fcaa,null))[_0xd985('0x21')](respondWithResult(_0xf2fcaa,null))['catch'](handleError(_0xf2fcaa,null));};exports['create']=function(_0x42262a,_0x248bcb){return db['ChatTransferReport']['create'](_0x42262a[_0xd985('0x44')],{})[_0xd985('0x21')](respondWithResult(_0x248bcb,0xc9))[_0xd985('0x3f')](handleError(_0x248bcb,null));};exports[_0xd985('0x45')]=function(_0x9c2e99,_0x1f82f7){if(_0x9c2e99[_0xd985('0x44')]['id']){delete _0x9c2e99[_0xd985('0x44')]['id'];}return db[_0xd985('0x28')][_0xd985('0x46')]({'where':{'id':_0x9c2e99[_0xd985('0x41')]['id']}})['then'](handleEntityNotFound(_0x1f82f7,null))[_0xd985('0x21')](saveUpdates(_0x9c2e99['body'],null))[_0xd985('0x21')](respondWithResult(_0x1f82f7,null))[_0xd985('0x3f')](handleError(_0x1f82f7,null));};exports[_0xd985('0x22')]=function(_0x3706c3,_0x3c4afa){return db['ChatTransferReport'][_0xd985('0x46')]({'where':{'id':_0x3706c3[_0xd985('0x41')]['id']}})[_0xd985('0x21')](handleEntityNotFound(_0x3c4afa,null))[_0xd985('0x21')](removeEntity(_0x3c4afa,null))[_0xd985('0x3f')](handleError(_0x3c4afa,null));};exports[_0xd985('0x47')]=function(_0x23da96,_0x15c7d2){return db[_0xd985('0x28')][_0xd985('0x47')]()[_0xd985('0x21')](respondWithResult(_0x15c7d2,null))[_0xd985('0x3f')](handleError(_0x15c7d2,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 00233ec..d37a9d5 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 _0xa225=['moment','bluebird','request-promise','path','../../config/environment','./chatTransferReport.attributes','exports','ChatTransferReport','report_chat_transfer','uniqueid','lodash','util','../../config/logger','api'];(function(_0x2909de,_0x1accd9){var _0x2a1d54=function(_0x523e19){while(--_0x523e19){_0x2909de['push'](_0x2909de['shift']());}};_0x2a1d54(++_0x1accd9);}(_0xa225,0x1bc));var _0x5a22=function(_0x4f7fe0,_0x18201f){_0x4f7fe0=_0x4f7fe0-0x0;var _0x1e2851=_0xa225[_0x4f7fe0];return _0x1e2851;};'use strict';var _=require(_0x5a22('0x0'));var util=require(_0x5a22('0x1'));var logger=require(_0x5a22('0x2'))(_0x5a22('0x3'));var moment=require(_0x5a22('0x4'));var BPromise=require(_0x5a22('0x5'));var rp=require(_0x5a22('0x6'));var fs=require('fs');var path=require(_0x5a22('0x7'));var rimraf=require('rimraf');var config=require(_0x5a22('0x8'));var attributes=require(_0x5a22('0x9'));module[_0x5a22('0xa')]=function(_0x416929,_0x3a4076){return _0x416929['define'](_0x5a22('0xb'),attributes,{'tableName':_0x5a22('0xc'),'paranoid':![],'indexes':[{'name':_0x5a22('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xbaec=['api','moment','request-promise','path','../../config/environment','./chatTransferReport.attributes','exports','define','report_chat_transfer','uniqueid','lodash','util','../../config/logger'];(function(_0x2a55f8,_0x540ac4){var _0x245efd=function(_0x4dbc19){while(--_0x4dbc19){_0x2a55f8['push'](_0x2a55f8['shift']());}};_0x245efd(++_0x540ac4);}(_0xbaec,0x135));var _0xcbae=function(_0x77773a,_0x5a7026){_0x77773a=_0x77773a-0x0;var _0x1091a2=_0xbaec[_0x77773a];return _0x1091a2;};'use strict';var _=require(_0xcbae('0x0'));var util=require(_0xcbae('0x1'));var logger=require(_0xcbae('0x2'))(_0xcbae('0x3'));var moment=require(_0xcbae('0x4'));var BPromise=require('bluebird');var rp=require(_0xcbae('0x5'));var fs=require('fs');var path=require(_0xcbae('0x6'));var rimraf=require('rimraf');var config=require(_0xcbae('0x7'));var attributes=require(_0xcbae('0x8'));module[_0xcbae('0x9')]=function(_0x3d952c,_0x2e2011){return _0x3d952c[_0xcbae('0xa')]('ChatTransferReport',attributes,{'tableName':_0xcbae('0xb'),'paranoid':![],'indexes':[{'name':_0xcbae('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index 514ac09..a3775bc 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 _0x7a8a=['client','then','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x2cf34f,_0x113909){var _0xe590ce=function(_0x36fe65){while(--_0x36fe65){_0x2cf34f['push'](_0x2cf34f['shift']());}};_0xe590ce(++_0x113909);}(_0x7a8a,0x173));var _0xa7a8=function(_0x119b59,_0x586bca){_0x119b59=_0x119b59-0x0;var _0x549482=_0x7a8a[_0x119b59];return _0x549482;};'use strict';var _=require(_0xa7a8('0x0'));var util=require('util');var moment=require(_0xa7a8('0x1'));var BPromise=require('bluebird');var rs=require(_0xa7a8('0x2'));var fs=require('fs');var Redis=require(_0xa7a8('0x3'));var db=require(_0xa7a8('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa7a8('0x5'))(_0xa7a8('0x6'));var config=require(_0xa7a8('0x7'));var jayson=require(_0xa7a8('0x8'));var client=jayson[_0xa7a8('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x352b94,_0x409313,_0x305055){return new BPromise(function(_0x17757b,_0x237425){return client['request'](_0x352b94,_0x305055)[_0xa7a8('0xa')](function(_0x443541){logger[_0xa7a8('0xb')](_0xa7a8('0xc'),_0x409313,_0xa7a8('0xd'));logger[_0xa7a8('0xe')](_0xa7a8('0xf'),_0x409313,'request\x20sent',JSON['stringify'](_0x443541));if(_0x443541[_0xa7a8('0x10')]){if(_0x443541[_0xa7a8('0x10')]['code']===0x1f4){logger[_0xa7a8('0x10')]('ChatTransferReport,\x20%s,\x20%s',_0x409313,_0x443541[_0xa7a8('0x10')][_0xa7a8('0x11')]);return _0x237425(_0x443541[_0xa7a8('0x10')][_0xa7a8('0x11')]);}logger[_0xa7a8('0x10')]('ChatTransferReport,\x20%s,\x20%s',_0x409313,_0x443541[_0xa7a8('0x10')][_0xa7a8('0x11')]);return _0x17757b(_0x443541[_0xa7a8('0x10')]['message']);}else{logger[_0xa7a8('0xb')](_0xa7a8('0xc'),_0x409313,_0xa7a8('0xd'));_0x17757b(_0x443541[_0xa7a8('0x12')][_0xa7a8('0x11')]);}})[_0xa7a8('0x13')](function(_0x28a7be){logger[_0xa7a8('0x10')](_0xa7a8('0xc'),_0x409313,_0x28a7be);_0x237425(_0x28a7be);});});} \ No newline at end of file +var _0x9bcb=['lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch'];(function(_0x32e954,_0x3df224){var _0x20a9ab=function(_0x48bd44){while(--_0x48bd44){_0x32e954['push'](_0x32e954['shift']());}};_0x20a9ab(++_0x3df224);}(_0x9bcb,0x14a));var _0xb9bc=function(_0x4221f9,_0x43fa14){_0x4221f9=_0x4221f9-0x0;var _0x4e85a6=_0x9bcb[_0x4221f9];return _0x4e85a6;};'use strict';var _=require(_0xb9bc('0x0'));var util=require(_0xb9bc('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb9bc('0x2'));var fs=require('fs');var Redis=require(_0xb9bc('0x3'));var db=require(_0xb9bc('0x4'))['db'];var utils=require(_0xb9bc('0x5'));var logger=require(_0xb9bc('0x6'))('rpc');var config=require(_0xb9bc('0x7'));var jayson=require(_0xb9bc('0x8'));var client=jayson[_0xb9bc('0x9')][_0xb9bc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2e9658,_0x47b26a,_0x2e33d5){return new BPromise(function(_0x2f99b3,_0x27c4fc){return client[_0xb9bc('0xb')](_0x2e9658,_0x2e33d5)['then'](function(_0x478103){logger[_0xb9bc('0xc')](_0xb9bc('0xd'),_0x47b26a,_0xb9bc('0xe'));logger[_0xb9bc('0xf')](_0xb9bc('0x10'),_0x47b26a,_0xb9bc('0xe'),JSON['stringify'](_0x478103));if(_0x478103[_0xb9bc('0x11')]){if(_0x478103[_0xb9bc('0x11')][_0xb9bc('0x12')]===0x1f4){logger[_0xb9bc('0x11')](_0xb9bc('0xd'),_0x47b26a,_0x478103[_0xb9bc('0x11')]['message']);return _0x27c4fc(_0x478103['error'][_0xb9bc('0x13')]);}logger[_0xb9bc('0x11')](_0xb9bc('0xd'),_0x47b26a,_0x478103[_0xb9bc('0x11')][_0xb9bc('0x13')]);return _0x2f99b3(_0x478103[_0xb9bc('0x11')][_0xb9bc('0x13')]);}else{logger[_0xb9bc('0xc')](_0xb9bc('0xd'),_0x47b26a,'request\x20sent');_0x2f99b3(_0x478103[_0xb9bc('0x14')][_0xb9bc('0x13')]);}})[_0xb9bc('0x15')](function(_0x34b4c6){logger[_0xb9bc('0x11')]('ChatTransferReport,\x20%s,\x20%s',_0x47b26a,_0x34b4c6);_0x27c4fc(_0x34b4c6);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 1ecb2d7..440bc1d 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 _0x603d=['multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatTransferReport.controller','get','isAuthenticated','index','/describe','/:id','create','update','delete','exports'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x603d,0xc6));var _0xd603=function(_0x228ade,_0x47e287){_0x228ade=_0x228ade-0x0;var _0x2f177a=_0x603d[_0x228ade];return _0x2f177a;};'use strict';var multer=require(_0xd603('0x0'));var util=require(_0xd603('0x1'));var path=require(_0xd603('0x2'));var timeout=require(_0xd603('0x3'));var express=require(_0xd603('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xd603('0x5'));var interaction=require(_0xd603('0x6'));var config=require(_0xd603('0x7'));var controller=require(_0xd603('0x8'));router[_0xd603('0x9')]('/',auth[_0xd603('0xa')](),controller[_0xd603('0xb')]);router[_0xd603('0x9')](_0xd603('0xc'),auth[_0xd603('0xa')](),controller['describe']);router['get'](_0xd603('0xd'),auth[_0xd603('0xa')](),controller['show']);router['post']('/',auth[_0xd603('0xa')](),controller[_0xd603('0xe')]);router['put'](_0xd603('0xd'),auth[_0xd603('0xa')](),controller[_0xd603('0xf')]);router[_0xd603('0x10')](_0xd603('0xd'),auth[_0xd603('0xa')](),controller['destroy']);module[_0xd603('0x11')]=router; \ No newline at end of file +var _0xf57b=['/:id','show','post','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatTransferReport.controller','get','/describe','isAuthenticated','describe'];(function(_0x473833,_0x22c51f){var _0x462aa9=function(_0x19a207){while(--_0x19a207){_0x473833['push'](_0x473833['shift']());}};_0x462aa9(++_0x22c51f);}(_0xf57b,0x147));var _0xbf57=function(_0x155547,_0x159a85){_0x155547=_0x155547-0x0;var _0x66aa33=_0xf57b[_0x155547];return _0x66aa33;};'use strict';var multer=require(_0xbf57('0x0'));var util=require(_0xbf57('0x1'));var path=require('path');var timeout=require(_0xbf57('0x2'));var express=require(_0xbf57('0x3'));var router=express[_0xbf57('0x4')]();var fs_extra=require(_0xbf57('0x5'));var auth=require(_0xbf57('0x6'));var interaction=require(_0xbf57('0x7'));var config=require('../../config/environment');var controller=require(_0xbf57('0x8'));router[_0xbf57('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xbf57('0xa'),auth[_0xbf57('0xb')](),controller[_0xbf57('0xc')]);router[_0xbf57('0x9')](_0xbf57('0xd'),auth['isAuthenticated'](),controller[_0xbf57('0xe')]);router[_0xbf57('0xf')]('/',auth[_0xbf57('0xb')](),controller['create']);router['put'](_0xbf57('0xd'),auth[_0xbf57('0xb')](),controller[_0xbf57('0x10')]);router[_0xbf57('0x11')](_0xbf57('0xd'),auth[_0xbf57('0xb')](),controller[_0xbf57('0x12')]);module[_0xbf57('0x13')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index d846b9e..ae65e71 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 _0x4917=['Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Type\x20a\x20message','Skip','Feedback','star','thumb','stringify','input','name','text','onlineForm','setDataValue','Comments','getDataValue','parse','offlineForm','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','website_alias','bottom_right','alternate','#fafafa','System','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','randomstring','STRING','address','email','Agent','#ffffff','INTEGER','BOOLEAN','ENUM','rounded','squared','We\x20are\x20here!','Chat','Send'];(function(_0x3c4ae4,_0x1bfaf3){var _0x3d4c2d=function(_0x172bc4){while(--_0x172bc4){_0x3c4ae4['push'](_0x3c4ae4['shift']());}};_0x3d4c2d(++_0x1bfaf3);}(_0x4917,0xd8));var _0x7491=function(_0x17a7c0,_0x22e66e){_0x17a7c0=_0x17a7c0-0x0;var _0x34cfd2=_0x4917[_0x17a7c0];return _0x34cfd2;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x7491('0x0'));module['exports']={'name':{'type':Sequelize[_0x7491('0x1')],'allowNull':![]},'address':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x7491('0x2')},'description':{'type':Sequelize['STRING']},'mapKey':{'type':Sequelize['STRING'],'defaultValue':_0x7491('0x3')},'mapKeyOffline':{'type':Sequelize[_0x7491('0x1')],'defaultValue':'email'},'key':{'type':Sequelize[_0x7491('0x1')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x7491('0x1')],'defaultValue':_0x7491('0x4')},'customerAlias':{'type':Sequelize[_0x7491('0x1')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x7491('0x1')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x7491('0x1')],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x7491('0x5'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0x7491('0x1')],'allowNull':![],'defaultValue':_0x7491('0x5'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x7491('0x6')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x7491('0x1')]},'animation':{'type':Sequelize[_0x7491('0x7')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x7491('0x8')](_0x7491('0x9'),_0x7491('0xa')),'defaultValue':'rounded'},'header_online':{'type':Sequelize['STRING'],'defaultValue':_0x7491('0xb')},'start_chat_button':{'type':Sequelize[_0x7491('0x1')],'defaultValue':_0x7491('0xc')},'offline_chat_button':{'type':Sequelize[_0x7491('0x1')],'defaultValue':_0x7491('0xd')},'header_offline':{'type':Sequelize[_0x7491('0x1')],'defaultValue':'Contact\x20us'},'download_transcript':{'type':Sequelize[_0x7491('0x7')],'defaultValue':!![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x7491('0x1')],'defaultValue':_0x7491('0xe')},'defaultWhiteLabel':{'type':Sequelize[_0x7491('0x7')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x7491('0xf')]},'closingQuestion':{'type':Sequelize[_0x7491('0x1')],'defaultValue':_0x7491('0x10')},'formSubmitSuccessMessage':{'type':Sequelize[_0x7491('0x1')],'defaultValue':_0x7491('0x11')},'formSubmitFailureMessage':{'type':Sequelize[_0x7491('0x1')],'defaultValue':_0x7491('0x12')},'noteTitle':{'type':Sequelize[_0x7491('0x1')],'defaultValue':'Note'},'placeholderMessage':{'type':Sequelize['STRING'],'defaultValue':_0x7491('0x13')},'closingMessage':{'type':Sequelize[_0x7491('0x1')],'defaultValue':'Thanks\x20you\x20for\x20your\x20time!'},'closingMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0x7491('0xd')},'skipMessageButton':{'type':Sequelize[_0x7491('0x1')],'defaultValue':_0x7491('0x14')},'conditionAgreement':{'type':Sequelize[_0x7491('0x7')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x7491('0x7')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x7491('0x7')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x7491('0x7')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize['STRING'],'defaultValue':_0x7491('0x15')},'ratingType':{'type':Sequelize[_0x7491('0x8')](_0x7491('0x16'),_0x7491('0x17')),'defaultValue':_0x7491('0x16')},'ratingStarsNumber':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x7491('0xf')],'defaultValue':function(){return JSON[_0x7491('0x18')]({'items':[{'type':_0x7491('0x19'),'variable':null,'config':{'placeholder':_0x7491('0x1a'),'type':_0x7491('0x1b'),'required':!![]},'props':{'title':_0x7491('0x1a'),'helpText':''}},{'type':_0x7491('0x19'),'props':{'title':_0x7491('0x3'),'helpText':''},'config':{'required':!![],'placeholder':_0x7491('0x3'),'type':_0x7491('0x3')},'variable':null}],'fromKey':0x1});},'get':function(){return this['getDataValue']('onlineForm')?JSON['parse'](this['getDataValue'](_0x7491('0x1c'))):{};},'set':function(_0x6680d9){return this[_0x7491('0x1d')](_0x7491('0x1c'),JSON[_0x7491('0x18')](_0x6680d9));}},'offlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0x7491('0x18')]({'items':[{'type':_0x7491('0x19'),'props':{'title':_0x7491('0x3'),'helpText':''},'config':{'required':!![],'placeholder':_0x7491('0x3'),'type':_0x7491('0x3')},'variable':null},{'type':'textarea','config':{'placeholder':_0x7491('0x1e')},'props':{'title':_0x7491('0x1e'),'helpText':'Leave\x20your\x20comments'}}],'fromKey':0x0});},'get':function(){return this[_0x7491('0x1f')]('offlineForm')?JSON[_0x7491('0x20')](this[_0x7491('0x1f')]('offlineForm')):{};},'set':function(_0x3a192e){return this[_0x7491('0x1d')](_0x7491('0x21'),JSON['stringify'](_0x3a192e));}},'token':{'type':Sequelize[_0x7491('0x1')],'defaultValue':function(){return rs[_0x7491('0x22')]();}},'autoclose':{'type':Sequelize[_0x7491('0x7')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x7491('0x7')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x7491('0x7')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x7491('0x1')]},'forwardOffline':{'type':Sequelize[_0x7491('0x7')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x7491('0x1')]},'waitingTitle':{'type':Sequelize[_0x7491('0x1')],'defaultValue':_0x7491('0x23')},'waitingMessage':{'type':Sequelize['STRING'],'defaultValue':'Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.'},'offlineMessageSubject':{'type':Sequelize['STRING'],'defaultValue':'New\x20offline\x20message\x20from\x20websiteName'},'offlineMessageBody':{'type':Sequelize['STRING'],'defaultValue':_0x7491('0x24')},'enableUnmanagedNote':{'type':Sequelize[_0x7491('0x7')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x7491('0x1')],'defaultValue':'Your\x20request\x20has\x20not\x20been\x20processed.'},'skipUnmanaged':{'type':Sequelize[_0x7491('0x1')],'defaultValue':'Skip'},'sendUnmanaged':{'type':Sequelize[_0x7491('0x1')],'defaultValue':'Send'},'enableCustomerAttachment':{'type':Sequelize[_0x7491('0x7')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentAvatar':{'type':Sequelize['TEXT']},'showAgentAvatar':{'type':Sequelize[_0x7491('0x7')],'defaultValue':![]},'timezone':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x7491('0xf')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x7491('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x7491('0x7')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x7491('0x7')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize['STRING'],'defaultValue':_0x7491('0x25')},'waitForTheAssignedAgent':{'type':Sequelize[_0x7491('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x7491('0x1')],'defaultValue':_0x7491('0x26')},'verticalAlignment':{'type':Sequelize[_0x7491('0x6')],'defaultValue':0x1e},'labelText':{'type':Sequelize['STRING'],'defaultValue':'CHAT'},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0x7491('0x27')},'defaultTitle':{'type':Sequelize[_0x7491('0x1')]},'customerAvatar':{'type':Sequelize[_0x7491('0xf')]},'showCustomerAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x7491('0x6')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x7491('0x1')],'allowNull':![],'defaultValue':_0x7491('0x28'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x7491('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x7491('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x7491('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x7491('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x7491('0x1')],'defaultValue':_0x7491('0x29')},'systemAvatar':{'type':Sequelize[_0x7491('0xf')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x7491('0x6')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x7491('0x7')],'defaultValue':![],'comment':_0x7491('0x2a'),'set':function(_0x409d0f){if(!_0x409d0f)this[_0x7491('0x1d')](_0x7491('0x2b'),null);this[_0x7491('0x1d')](_0x7491('0x2c'),_0x409d0f);}},'vidaooEscalation':{'type':Sequelize[_0x7491('0x7')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize['STRING']},'vidaooTopic':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'Generated\x20by\x20XCALLY\x20Motion'},'vidaooNote':{'type':Sequelize['STRING'],'defaultValue':function(){return _0x7491('0x2d');}},'vidaooMetadata':{'type':Sequelize[_0x7491('0xf')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x7491('0x7')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x7491('0xf')]}}; \ No newline at end of file +var _0xd74f=['mandatoryDispositionPauseId','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','randomstring','STRING','address','email','Agent','#011F6A','#ffffff','BOOLEAN','ENUM','rounded','Chat','Send','Contact\x20us','INTEGER','Powered\x20by\x20xCALLY','TEXT','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Thanks\x20you\x20for\x20your\x20time!','Skip','Feedback','star','stringify','input','text','name','parse','getDataValue','onlineForm','setDataValue','textarea','Comments','Leave\x20your\x20comments','offlineForm','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','CHAT','alternate','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue'];(function(_0x3d8304,_0x3a115c){var _0x1ca763=function(_0x1ebff2){while(--_0x1ebff2){_0x3d8304['push'](_0x3d8304['shift']());}};_0x1ca763(++_0x3a115c);}(_0xd74f,0x1d7));var _0xfd74=function(_0x36afc9,_0x330ac6){_0x36afc9=_0x36afc9-0x0;var _0x3c5d2b=_0xd74f[_0x36afc9];return _0x3c5d2b;};'use strict';var Sequelize=require('sequelize');var rs=require(_0xfd74('0x0'));module['exports']={'name':{'type':Sequelize[_0xfd74('0x1')],'allowNull':![]},'address':{'type':Sequelize[_0xfd74('0x1')],'allowNull':![],'unique':_0xfd74('0x2')},'description':{'type':Sequelize[_0xfd74('0x1')]},'mapKey':{'type':Sequelize['STRING'],'defaultValue':_0xfd74('0x3')},'mapKeyOffline':{'type':Sequelize[_0xfd74('0x1')],'defaultValue':'email'},'key':{'type':Sequelize[_0xfd74('0x1')],'allowNull':![]},'agentAlias':{'type':Sequelize['STRING'],'defaultValue':_0xfd74('0x4')},'customerAlias':{'type':Sequelize[_0xfd74('0x1')],'defaultValue':'Me'},'color':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xfd74('0x5'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0xfd74('0x1')],'allowNull':![],'defaultValue':_0xfd74('0x5'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0xfd74('0x1')],'allowNull':![],'defaultValue':_0xfd74('0x6'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0xfd74('0x1')],'allowNull':![],'defaultValue':_0xfd74('0x6'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xf},'remote':{'type':Sequelize[_0xfd74('0x1')]},'animation':{'type':Sequelize[_0xfd74('0x7')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0xfd74('0x8')](_0xfd74('0x9'),'squared'),'defaultValue':_0xfd74('0x9')},'header_online':{'type':Sequelize[_0xfd74('0x1')],'defaultValue':'We\x20are\x20here!'},'start_chat_button':{'type':Sequelize[_0xfd74('0x1')],'defaultValue':_0xfd74('0xa')},'offline_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0xfd74('0xb')},'header_offline':{'type':Sequelize[_0xfd74('0x1')],'defaultValue':_0xfd74('0xc')},'download_transcript':{'type':Sequelize[_0xfd74('0x7')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0xfd74('0xd')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0xfd74('0x1')],'defaultValue':_0xfd74('0xe')},'defaultWhiteLabel':{'type':Sequelize[_0xfd74('0x7')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0xfd74('0xf')]},'closingQuestion':{'type':Sequelize[_0xfd74('0x1')],'defaultValue':'Do\x20you\x20want\x20to\x20close\x20the\x20interaction?'},'formSubmitSuccessMessage':{'type':Sequelize[_0xfd74('0x1')],'defaultValue':_0xfd74('0x10')},'formSubmitFailureMessage':{'type':Sequelize[_0xfd74('0x1')],'defaultValue':_0xfd74('0x11')},'noteTitle':{'type':Sequelize[_0xfd74('0x1')],'defaultValue':_0xfd74('0x12')},'placeholderMessage':{'type':Sequelize['STRING'],'defaultValue':'Type\x20a\x20message'},'closingMessage':{'type':Sequelize[_0xfd74('0x1')],'defaultValue':_0xfd74('0x13')},'closingMessageButton':{'type':Sequelize[_0xfd74('0x1')],'defaultValue':'Send'},'skipMessageButton':{'type':Sequelize[_0xfd74('0x1')],'defaultValue':_0xfd74('0x14')},'conditionAgreement':{'type':Sequelize[_0xfd74('0x7')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0xfd74('0x7')],'defaultValue':![]},'enableFeedback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0xfd74('0x7')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0xfd74('0x1')],'defaultValue':_0xfd74('0x15')},'ratingType':{'type':Sequelize[_0xfd74('0x8')](_0xfd74('0x16'),'thumb'),'defaultValue':_0xfd74('0x16')},'ratingStarsNumber':{'type':Sequelize[_0xfd74('0xd')],'defaultValue':0x5},'onlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0xfd74('0x17')]({'items':[{'type':_0xfd74('0x18'),'variable':null,'config':{'placeholder':'name','type':_0xfd74('0x19'),'required':!![]},'props':{'title':_0xfd74('0x1a'),'helpText':''}},{'type':_0xfd74('0x18'),'props':{'title':_0xfd74('0x3'),'helpText':''},'config':{'required':!![],'placeholder':_0xfd74('0x3'),'type':_0xfd74('0x3')},'variable':null}],'fromKey':0x1});},'get':function(){return this['getDataValue']('onlineForm')?JSON[_0xfd74('0x1b')](this[_0xfd74('0x1c')](_0xfd74('0x1d'))):{};},'set':function(_0x56a0e3){return this[_0xfd74('0x1e')](_0xfd74('0x1d'),JSON[_0xfd74('0x17')](_0x56a0e3));}},'offlineForm':{'type':Sequelize[_0xfd74('0xf')],'defaultValue':function(){return JSON[_0xfd74('0x17')]({'items':[{'type':'input','props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0xfd74('0x3'),'type':_0xfd74('0x3')},'variable':null},{'type':_0xfd74('0x1f'),'config':{'placeholder':'Comments'},'props':{'title':_0xfd74('0x20'),'helpText':_0xfd74('0x21')}}],'fromKey':0x0});},'get':function(){return this['getDataValue'](_0xfd74('0x22'))?JSON['parse'](this[_0xfd74('0x1c')]('offlineForm')):{};},'set':function(_0x139de4){return this[_0xfd74('0x1e')](_0xfd74('0x22'),JSON[_0xfd74('0x17')](_0x139de4));}},'token':{'type':Sequelize[_0xfd74('0x1')],'defaultValue':function(){return rs['generate']();}},'autoclose':{'type':Sequelize[_0xfd74('0x7')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xfd74('0x7')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0xfd74('0x7')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0xfd74('0x1')]},'forwardOffline':{'type':Sequelize[_0xfd74('0x7')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize['STRING']},'waitingTitle':{'type':Sequelize['STRING'],'defaultValue':_0xfd74('0x23')},'waitingMessage':{'type':Sequelize[_0xfd74('0x1')],'defaultValue':_0xfd74('0x24')},'offlineMessageSubject':{'type':Sequelize[_0xfd74('0x1')],'defaultValue':_0xfd74('0x25')},'offlineMessageBody':{'type':Sequelize[_0xfd74('0x1')],'defaultValue':_0xfd74('0x26')},'enableUnmanagedNote':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0xfd74('0x1')],'defaultValue':_0xfd74('0x27')},'skipUnmanaged':{'type':Sequelize[_0xfd74('0x1')],'defaultValue':_0xfd74('0x14')},'sendUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0xfd74('0xb')},'enableCustomerAttachment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0xfd74('0x7')],'defaultValue':![]},'agentAvatar':{'type':Sequelize['TEXT']},'showAgentAvatar':{'type':Sequelize[_0xfd74('0x7')],'defaultValue':![]},'timezone':{'type':Sequelize[_0xfd74('0x1')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xfd74('0x28');}},'notificationSound':{'type':Sequelize[_0xfd74('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xfd74('0x7')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0xfd74('0x7')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0xfd74('0x1')],'defaultValue':_0xfd74('0x29')},'waitForTheAssignedAgent':{'type':Sequelize[_0xfd74('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xfd74('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0xfd74('0x1')],'defaultValue':_0xfd74('0x2a')},'verticalAlignment':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0xfd74('0x1')],'defaultValue':_0xfd74('0x2b')},'messagesAlignment':{'type':Sequelize[_0xfd74('0x1')],'defaultValue':_0xfd74('0x2c')},'defaultTitle':{'type':Sequelize[_0xfd74('0x1')]},'customerAvatar':{'type':Sequelize[_0xfd74('0xf')]},'showCustomerAvatar':{'type':Sequelize[_0xfd74('0x7')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0xfd74('0xd')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0xfd74('0x1')],'allowNull':![],'defaultValue':_0xfd74('0x2d'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0xfd74('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xfd74('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xfd74('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xfd74('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0xfd74('0x1')],'defaultValue':_0xfd74('0x2e')},'systemAvatar':{'type':Sequelize['TEXT']},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0xfd74('0x2f')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xfd74('0x30'),'set':function(_0x1099d5){if(!_0x1099d5)this[_0xfd74('0x1e')](_0xfd74('0x31'),null);this[_0xfd74('0x1e')]('mandatoryDisposition',_0x1099d5);}},'vidaooEscalation':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0xfd74('0x1')]},'vidaooTopic':{'type':Sequelize[_0xfd74('0x1')],'allowNull':![],'defaultValue':_0xfd74('0x32')},'vidaooNote':{'type':Sequelize[_0xfd74('0x1')],'defaultValue':function(){return _0xfd74('0x33');}},'vidaooMetadata':{'type':Sequelize['TEXT'],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0xfd74('0x7')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0xfd74('0xf')]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 0d70d33..8d26e3d 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 _0x80f7=['updatedAt','includes','CompanyId','ListId','Invalid\x20MapKey\x20parameter.\x20Allowed\x20values:\x20','DESC','ChatApplication','interval','Chat\x20Website\x20with\x20id\x20%s\x20not\x20found','account','applications','Applications','priority','asc','list','List','Contacts','from','contact','headers','closed','ChatInteraction','Writing\x20on\x20closed\x20interaction','threadId','ContactId','interaction','messageId','created','autoclose','push','close','unmanaged','*,*,*,*','ChatMessage','AttachmentId','UserId','User','unshift','agent','forcedOwnership','ChatQueue','queueId','startRouting','EventManager','offline','Sequelize','no\x20available\x20attributes','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','MailAccount','findOrCreate','spread','readFileSync','server/files/templates/chatOfflineMessage.ejs','render','toPairs','offlineMessageBody','fromString','originalname','server','files','attachments','offline-chat','basename','sequelize','transaction','Attachment','bulkCreate','MailServerOut','Smtp','CloudProvider','forwardOffline','forwardOfflineAddress','SendMail','email','offlineMessageSubject','openNewInteraction','MailAccountId','toPairsIn','mapValues','Chat','NotifyMailAccount','notifyMail','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','ids','omit','Contact','Owner','fullname','internal','Tag','Tags','color','tag','Intervals','getProactiveActions','../../config/license/util','License','increment','chatLicenseExceeded','server/files/chat/iframe.ejs','utf8','origin','http://localhost:9000','remoteAddress','virtual','verticalAlignment','labelText','textColor','textButtonColor','color_button','backgroundColor','hideWhenOffline','addApplications','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findAndCountAll','finally','getApplications','addProactiveActions','chatProactiveAction','ChatProactiveAction','online','offlineForm','onlineForm','items','fromKey','getOfflineMessages','ChatOfflineMessage','Attachments','addAgents','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','util','path','ejs','fs-extra','lodash','querystring','html-to-text','ioredis','jayson/promise','../../components/parsers/qs','../../config/logger','../../config/environment','../../errors/api','APIBadRequestError','APINotFoundError','APIOutOfIntervalError','handleError','APIConflictError','./helpers/wildcard-expressions','url','URL','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','client','http','request','then','ChatWebsite,\x20%s,\x20%s','request\x20sent','ChatWebsite,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','update','destroy','get','ChatWebsites','UserProfileResource','send','user-agent-parser','getResult','customerIp','cf-connecting-ip','x-forwarded-for','first','firstName','lastName','x-real-port','referer','browser','name','format','%s\x20%s','unknown','version','device','vendor','%s\x20%s\x20%s','model','type','stringify','map','ChatWebsite','rawAttributes','fieldName','key','query','keys','intersection','attributes','fields','nolimit','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','Pause','length','create','body','split','trim','testWildcardValidity','\x22\x20is\x20not\x20a\x20valid\x20wildcard\x20expression','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','find','userProfileId','autoAssociation','address','forEach','mandatoryDispositionPause','describe','addDisposition','ChatWebsiteId','Disposition','getDispositions','findOne','hasOwnProperty','order','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','sitepic','filename','agentAvatar','file','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','getLogo','getLicense','custom','join','root','server/files/images/logos/','download','getAvatar','isNil','existsSync','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','Interval','timezone','ifTime','notify','chat','mapKey','MapKey\x20is\x20mandatory','isEmpty','Body\x20is\x20mandatory','CmContact','createdAt'];(function(_0x568496,_0x565afd){var _0x26c5c1=function(_0x4d251e){while(--_0x4d251e){_0x568496['push'](_0x568496['shift']());}};_0x26c5c1(++_0x565afd);}(_0x80f7,0x91));var _0x780f=function(_0x450a0d,_0x21839f){_0x450a0d=_0x450a0d-0x0;var _0x41e651=_0x80f7[_0x450a0d];return _0x41e651;};'use strict';var Mustache=require('mustache');var util=require(_0x780f('0x0'));var path=require(_0x780f('0x1'));var ejs=require(_0x780f('0x2'));var fs=require('fs');var fs_extra=require(_0x780f('0x3'));var _=require(_0x780f('0x4'));var querystring=require(_0x780f('0x5'));var htmlToText=require(_0x780f('0x6'));var Redis=require(_0x780f('0x7'));var jayson=require(_0x780f('0x8'));var qs=require(_0x780f('0x9'));var logger=require(_0x780f('0xa'))('api');var config=require(_0x780f('0xb'));var APIBadRequestError=require(_0x780f('0xc'))[_0x780f('0xd')];var APINotFoundError=require(_0x780f('0xc'))[_0x780f('0xe')];var APIOutOfIntervalError=require(_0x780f('0xc'))[_0x780f('0xf')];var APIHandleError=require(_0x780f('0xc'))[_0x780f('0x10')];var APIConflictError=require(_0x780f('0xc'))[_0x780f('0x11')];var wildcardUtils=require(_0x780f('0x12'));var URL=require(_0x780f('0x13'))[_0x780f('0x14')];var db=require(_0x780f('0x15'))['db'];config[_0x780f('0x16')]=_[_0x780f('0x17')](config[_0x780f('0x16')],{'host':_0x780f('0x18'),'port':0x18eb});var socket=require(_0x780f('0x19'))(new Redis(config[_0x780f('0x16')]));require(_0x780f('0x1a'))[_0x780f('0x1b')](socket);var client=jayson[_0x780f('0x1c')][_0x780f('0x1d')]({'port':0x232c});var client9002=jayson[_0x780f('0x1c')][_0x780f('0x1d')]({'port':0x232a});var client9003=jayson[_0x780f('0x1c')][_0x780f('0x1d')]({'port':0x232b});var client9001=jayson['client'][_0x780f('0x1d')]({'port':0x2329});function respondWithRpcPromise(_0x55662d,_0x40d59c,_0x47c428,_0x4ead40){return new Promise(function(_0x1747dc,_0x2cbf2a){var _0x1157b7=_0x4ead40||client;return _0x1157b7[_0x780f('0x1e')](_0x55662d,_0x47c428)[_0x780f('0x1f')](function(_0x4ea166){logger['info'](_0x780f('0x20'),_0x40d59c,_0x780f('0x21'));logger['debug'](_0x780f('0x22'),_0x40d59c,_0x780f('0x21'),JSON['stringify'](_0x4ea166));if(_0x4ea166[_0x780f('0x23')]){if(_0x4ea166['error'][_0x780f('0x24')]===0x1f4){logger[_0x780f('0x23')](_0x780f('0x20'),_0x40d59c,_0x4ea166[_0x780f('0x23')]['message']);return _0x2cbf2a(_0x4ea166['error'][_0x780f('0x25')]);}logger[_0x780f('0x23')]('ChatWebsite,\x20%s,\x20%s',_0x40d59c,_0x4ea166['error'][_0x780f('0x25')]);return _0x1747dc(_0x4ea166['error'][_0x780f('0x25')]);}else{logger[_0x780f('0x26')]('ChatWebsite,\x20%s,\x20%s',_0x40d59c,_0x780f('0x21'));_0x1747dc(_0x4ea166[_0x780f('0x27')][_0x780f('0x25')]);}})[_0x780f('0x28')](function(_0x249cce){logger['error']('ChatWebsite,\x20%s,\x20%s',_0x40d59c,_0x249cce);_0x2cbf2a(_0x249cce);});});}function respondWithStatusCode(_0x55584c,_0x2d8f9e){_0x2d8f9e=_0x2d8f9e||0xcc;return function(_0x422f77){if(_0x422f77){return _0x55584c[_0x780f('0x29')](_0x2d8f9e);}return _0x55584c['status'](_0x2d8f9e)[_0x780f('0x2a')]();};}function respondWithResult(_0x25b332,_0x5b527a){_0x5b527a=_0x5b527a||0xc8;return function(_0x1aa703){if(_0x1aa703){return _0x25b332[_0x780f('0x2b')](_0x5b527a)[_0x780f('0x2c')](_0x1aa703);}};}function respondWithFilteredResult(_0x433938,_0x35e734){return function(_0x2db668){if(_0x2db668){var _0x2c9db2=typeof _0x35e734[_0x780f('0x2d')]==='undefined'&&typeof _0x35e734['limit']===_0x780f('0x2e');var _0x43f145=_0x2db668[_0x780f('0x2f')];var _0x1c5644=_0x2c9db2?0x0:_0x35e734['offset'];var _0x3c1675=_0x2c9db2?_0x2db668[_0x780f('0x2f')]:_0x35e734[_0x780f('0x2d')]+_0x35e734[_0x780f('0x30')];var _0x186c83;if(_0x3c1675>=_0x43f145){_0x3c1675=_0x43f145;_0x186c83=0xc8;}else{_0x186c83=0xce;}_0x433938[_0x780f('0x2b')](_0x186c83);return _0x433938[_0x780f('0x31')](_0x780f('0x32'),_0x1c5644+'-'+_0x3c1675+'/'+_0x43f145)[_0x780f('0x2c')](_0x2db668);}return null;};}function saveUpdates(_0x5ca7be){return function(_0x182e06){if(_0x182e06){return _0x182e06[_0x780f('0x33')](_0x5ca7be)[_0x780f('0x1f')](function(_0x37a164){return _0x37a164;});}return null;};}function removeEntity(_0x5d5366){return function(_0x47c6b3){if(_0x47c6b3){return _0x47c6b3[_0x780f('0x34')]()[_0x780f('0x1f')](function(){var _0x561b07=_0x47c6b3[_0x780f('0x35')]({'plain':!![]});var _0x7be426=_0x780f('0x36');return db[_0x780f('0x37')][_0x780f('0x34')]({'where':{'type':_0x7be426,'resourceId':_0x561b07['id']}})[_0x780f('0x1f')](function(){return _0x47c6b3;});})[_0x780f('0x1f')](function(){_0x5d5366[_0x780f('0x2b')](0xcc)[_0x780f('0x2a')]();});}};}function handleEntityNotFound(_0x7a1321){return function(_0x19403a){if(!_0x19403a){_0x7a1321[_0x780f('0x29')](0x194);}return _0x19403a;};}function handleError(_0x9a929a,_0x3b1242){_0x3b1242=_0x3b1242||0x1f4;return function(_0xe6185){logger[_0x780f('0x23')](_0xe6185['stack']);if(_0xe6185['name']){delete _0xe6185['name'];}_0x9a929a[_0x780f('0x2b')](_0x3b1242)[_0x780f('0x38')](_0xe6185);};}function createInteractionObject(_0x2c36a0,_0x274a6e,_0x35baaa,_0x1c0e63){var _0x5eda61=require(_0x780f('0x39'));var _0x43157d=new _0x5eda61();var _0x3502f6=_0x43157d['setUA'](_0x35baaa['user-agent'])[_0x780f('0x3a')]();var _0x4ad707=_0x274a6e[_0x780f('0x3b')];if(_0x35baaa['cf-connecting-ip']){_0x4ad707=_0x35baaa[_0x780f('0x3c')];}else if(_0x35baaa[_0x780f('0x3d')]){_0x4ad707=_[_0x780f('0x3e')](_0x35baaa[_0x780f('0x3d')]['split'](','));}return{'ContactId':_0x1c0e63['id'],'ChatWebsiteId':_0x2c36a0,'from':(_0x1c0e63[_0x780f('0x3f')]||'')+'\x20'+(_0x1c0e63[_0x780f('0x40')]||''),'customerIp':_0x4ad707,'customerPort':_0x35baaa[_0x780f('0x41')]?_0x35baaa[_0x780f('0x41')]:null,'referer':_0x274a6e[_0x780f('0x42')],'browserName':_0x3502f6[_0x780f('0x43')][_0x780f('0x44')]&&_0x3502f6[_0x780f('0x43')]['version']?util[_0x780f('0x45')](_0x780f('0x46'),_0x3502f6[_0x780f('0x43')][_0x780f('0x44')],_0x3502f6['browser']['version']):_0x780f('0x47'),'browserVersion':_0x3502f6[_0x780f('0x43')][_0x780f('0x48')]||_0x780f('0x47'),'osName':util[_0x780f('0x45')]('%s\x20%s',_0x3502f6['os']['name'],_0x3502f6['os'][_0x780f('0x48')]),'osVersion':_0x3502f6['os'][_0x780f('0x48')],'deviceModel':_0x3502f6[_0x780f('0x49')]['model']&&_0x3502f6[_0x780f('0x49')][_0x780f('0x4a')]?util[_0x780f('0x45')](_0x780f('0x4b'),_0x3502f6[_0x780f('0x49')][_0x780f('0x4c')],_0x3502f6[_0x780f('0x49')][_0x780f('0x4a')],_0x3502f6[_0x780f('0x49')]['type']):null,'deviceVendor':_0x3502f6[_0x780f('0x49')]['vendor'],'deviceType':_0x3502f6[_0x780f('0x49')][_0x780f('0x4d')],'formData':JSON[_0x780f('0x4e')](_0x274a6e)};}exports['index']=function(_0x217452,_0x57628c){var _0xc6e209={'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x5178ba={},_0x4427fd={'count':0x0,'rows':[]};var _0x5482c0=_[_0x780f('0x4f')](db[_0x780f('0x50')][_0x780f('0x51')],function(_0x373896){return{'name':_0x373896[_0x780f('0x52')],'type':_0x373896[_0x780f('0x4d')][_0x780f('0x53')]};});_0x5178ba[_0x780f('0x4c')]=_[_0x780f('0x4f')](_0x5482c0,_0x780f('0x44'));_0x5178ba[_0x780f('0x54')]=_[_0x780f('0x55')](_0x217452['query']);_0x5178ba['filters']=_[_0x780f('0x56')](_0x5178ba[_0x780f('0x4c')],_0x5178ba[_0x780f('0x54')]);_0xc6e209[_0x780f('0x57')]=_[_0x780f('0x56')](_0x5178ba[_0x780f('0x4c')],qs['fields'](_0x217452[_0x780f('0x54')][_0x780f('0x58')]));_0xc6e209[_0x780f('0x57')]=_0xc6e209[_0x780f('0x57')]['length']?_0xc6e209[_0x780f('0x57')]:_0x5178ba['model'];if(!_0x217452[_0x780f('0x54')]['hasOwnProperty'](_0x780f('0x59'))){_0xc6e209[_0x780f('0x30')]=qs[_0x780f('0x30')](_0x217452['query'][_0x780f('0x30')]);_0xc6e209[_0x780f('0x2d')]=qs['offset'](_0x217452[_0x780f('0x54')][_0x780f('0x2d')]);}_0xc6e209['order']=qs[_0x780f('0x5a')](_0x217452['query'][_0x780f('0x5a')]);_0xc6e209[_0x780f('0x5b')]=qs[_0x780f('0x5c')](_[_0x780f('0x5d')](_0x217452['query'],_0x5178ba[_0x780f('0x5c')]),_0x5482c0);if(_0x217452[_0x780f('0x54')]['filter']){_0xc6e209['where']=_[_0x780f('0x5e')](_0xc6e209[_0x780f('0x5b')],{'$or':_[_0x780f('0x4f')](_0x5482c0,function(_0x43dfd2){if(_0x43dfd2['type']!==_0x780f('0x5f')){var _0x22b61f={};_0x22b61f[_0x43dfd2[_0x780f('0x44')]]={'$like':'%'+_0x217452[_0x780f('0x54')][_0x780f('0x60')]+'%'};return _0x22b61f;}})});}_0xc6e209=_[_0x780f('0x5e')]({},_0xc6e209,_0x217452[_0x780f('0x61')]);var _0x4ca595={'where':_0xc6e209[_0x780f('0x5b')]};return db[_0x780f('0x50')]['count'](_0x4ca595)['then'](function(_0x555d60){_0x4427fd[_0x780f('0x2f')]=_0x555d60;if(_0x217452[_0x780f('0x54')][_0x780f('0x62')]){_0xc6e209[_0x780f('0x63')]=[{'all':!![]}];}return db[_0x780f('0x50')][_0x780f('0x64')](_0xc6e209);})[_0x780f('0x1f')](function(_0x4b1219){_0x4427fd[_0x780f('0x65')]=_0x4b1219;return _0x4427fd;})[_0x780f('0x1f')](respondWithFilteredResult(_0x57628c,_0xc6e209))[_0x780f('0x28')](handleError(_0x57628c,null));};exports[_0x780f('0x66')]=function(_0x1e10cd,_0x193cf5){var _0x1c87b7={'raw':![],'where':{'id':_0x1e10cd[_0x780f('0x67')]['id']},'include':[{'model':db[_0x780f('0x68')],'as':'mandatoryDispositionPause'}]},_0x31ff8a={};_0x31ff8a[_0x780f('0x4c')]=_['keys'](db[_0x780f('0x50')][_0x780f('0x51')]);_0x31ff8a[_0x780f('0x54')]=_[_0x780f('0x55')](_0x1e10cd[_0x780f('0x54')]);_0x31ff8a[_0x780f('0x5c')]=_['intersection'](_0x31ff8a[_0x780f('0x4c')],_0x31ff8a[_0x780f('0x54')]);_0x1c87b7[_0x780f('0x57')]=_[_0x780f('0x56')](_0x31ff8a[_0x780f('0x4c')],qs[_0x780f('0x58')](_0x1e10cd[_0x780f('0x54')][_0x780f('0x58')]));_0x1c87b7['attributes']=_0x1c87b7[_0x780f('0x57')][_0x780f('0x69')]?_0x1c87b7[_0x780f('0x57')]:_0x31ff8a[_0x780f('0x4c')];if(_0x1e10cd[_0x780f('0x54')][_0x780f('0x62')]){_0x1c87b7[_0x780f('0x63')]=[{'all':!![]}];}_0x1c87b7=_[_0x780f('0x5e')]({},_0x1c87b7,_0x1e10cd[_0x780f('0x61')]);return db[_0x780f('0x50')]['find'](_0x1c87b7)[_0x780f('0x1f')](handleEntityNotFound(_0x193cf5,null))[_0x780f('0x1f')](respondWithResult(_0x193cf5,null))[_0x780f('0x28')](handleError(_0x193cf5,null));};exports[_0x780f('0x6a')]=function(_0x3720b9,_0x161f3d){var _0x164d7f=null;_0x3720b9[_0x780f('0x6b')]['address'][_0x780f('0x6c')](',')['forEach'](_0x5251f2=>{if(_0x5251f2[_0x780f('0x6d')]()!==''&&!wildcardUtils[_0x780f('0x6e')](_0x5251f2[_0x780f('0x6d')]())){_0x164d7f=new APIBadRequestError('\x22'+_0x5251f2[_0x780f('0x6d')]()+_0x780f('0x6f'));}});if(_0x164d7f){return handleError(_0x161f3d,null)(_0x164d7f);}return db[_0x780f('0x50')][_0x780f('0x6a')](_0x3720b9[_0x780f('0x6b')],{})[_0x780f('0x1f')](function(_0x56a907){var _0x5a671f=_0x3720b9['user']['get']({'plain':!![]});if(!_0x5a671f)throw new Error(_0x780f('0x70'));if(_0x5a671f[_0x780f('0x71')]===_0x780f('0x72')){var _0x3474fe=_0x56a907[_0x780f('0x35')]({'plain':!![]});var _0x3e1ecf=_0x780f('0x36');return db['UserProfileSection'][_0x780f('0x73')]({'where':{'name':_0x3e1ecf,'userProfileId':_0x5a671f[_0x780f('0x74')]},'raw':!![]})[_0x780f('0x1f')](function(_0x39c77a){if(_0x39c77a&&_0x39c77a[_0x780f('0x75')]===0x0){return db['UserProfileResource'][_0x780f('0x6a')]({'name':_0x3474fe[_0x780f('0x44')],'resourceId':_0x3474fe['id'],'type':_0x39c77a[_0x780f('0x44')],'sectionId':_0x39c77a['id']},{})[_0x780f('0x1f')](function(){return _0x56a907;});}else{return _0x56a907;}})[_0x780f('0x28')](function(_0xdca7d4){logger[_0x780f('0x23')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xdca7d4);throw _0xdca7d4;});}return _0x56a907;})[_0x780f('0x1f')](respondWithResult(_0x161f3d,0xc9))[_0x780f('0x28')](handleError(_0x161f3d,null));};exports[_0x780f('0x33')]=function(_0xf7864b,_0x2b396e){var _0x2856b2=null;_0xf7864b[_0x780f('0x6b')][_0x780f('0x76')][_0x780f('0x6c')](',')[_0x780f('0x77')](_0xc737bc=>{if(_0xc737bc[_0x780f('0x6d')]()!==''&&!wildcardUtils[_0x780f('0x6e')](_0xc737bc[_0x780f('0x6d')]())){_0x2856b2=new APIBadRequestError('\x22'+_0xc737bc['trim']()+_0x780f('0x6f'));}});if(_0x2856b2){return handleError(_0x2b396e,null)(_0x2856b2);}if(_0xf7864b[_0x780f('0x6b')]['id']){delete _0xf7864b['body']['id'];}return db[_0x780f('0x50')][_0x780f('0x73')]({'where':{'id':_0xf7864b[_0x780f('0x67')]['id']},'include':[{'model':db[_0x780f('0x68')],'as':_0x780f('0x78')}]})[_0x780f('0x1f')](handleEntityNotFound(_0x2b396e,null))['then'](saveUpdates(_0xf7864b[_0x780f('0x6b')],null))[_0x780f('0x1f')](respondWithResult(_0x2b396e,null))[_0x780f('0x28')](handleError(_0x2b396e,null));};exports[_0x780f('0x34')]=function(_0x2252b7,_0x154774){return db['ChatWebsite'][_0x780f('0x73')]({'where':{'id':_0x2252b7['params']['id']}})[_0x780f('0x1f')](handleEntityNotFound(_0x154774,null))[_0x780f('0x1f')](removeEntity(_0x154774,null))[_0x780f('0x28')](handleError(_0x154774,null));};exports[_0x780f('0x79')]=function(_0x55a4e9,_0x393fa1){return db[_0x780f('0x50')][_0x780f('0x79')]()[_0x780f('0x1f')](respondWithResult(_0x393fa1,null))[_0x780f('0x28')](handleError(_0x393fa1,null));};exports[_0x780f('0x7a')]=function(_0x76002a,_0x222fdf){if(_0x76002a[_0x780f('0x6b')]['id']){delete _0x76002a['body']['id'];}return db[_0x780f('0x50')][_0x780f('0x73')]({'where':{'id':_0x76002a['params']['id']}})['then'](handleEntityNotFound(_0x222fdf,null))[_0x780f('0x1f')](function(_0x35835f){if(_0x35835f){_0x76002a['body'][_0x780f('0x7b')]=_0x35835f['id'];return db[_0x780f('0x7c')][_0x780f('0x6a')](_0x76002a[_0x780f('0x6b')]);}})[_0x780f('0x1f')](respondWithResult(_0x222fdf,null))[_0x780f('0x28')](handleError(_0x222fdf,null));};exports[_0x780f('0x7d')]=function(_0x48ba82,_0x378259){var _0xd01200={'raw':![],'where':{}};var _0x4a2d51={};var _0x6f3674={'count':0x0,'rows':[]};return db[_0x780f('0x50')][_0x780f('0x7e')]({'where':{'id':_0x48ba82[_0x780f('0x67')]['id']}})[_0x780f('0x1f')](handleEntityNotFound(_0x378259,null))[_0x780f('0x1f')](function(_0x5e0635){if(_0x5e0635){_0x4a2d51[_0x780f('0x4c')]=_[_0x780f('0x55')](db['Disposition']['rawAttributes']);_0x4a2d51[_0x780f('0x54')]=_['keys'](_0x48ba82[_0x780f('0x54')]);_0x4a2d51[_0x780f('0x5c')]=_[_0x780f('0x56')](_0x4a2d51['model'],_0x4a2d51[_0x780f('0x54')]);_0xd01200['attributes']=_[_0x780f('0x56')](_0x4a2d51[_0x780f('0x4c')],qs[_0x780f('0x58')](_0x48ba82[_0x780f('0x54')][_0x780f('0x58')]));_0xd01200[_0x780f('0x57')]=_0xd01200['attributes'][_0x780f('0x69')]?_0xd01200[_0x780f('0x57')]:_0x4a2d51[_0x780f('0x4c')];if(!_0x48ba82[_0x780f('0x54')][_0x780f('0x7f')](_0x780f('0x59'))){_0xd01200['limit']=qs[_0x780f('0x30')](_0x48ba82[_0x780f('0x54')]['limit']);_0xd01200[_0x780f('0x2d')]=qs[_0x780f('0x2d')](_0x48ba82['query'][_0x780f('0x2d')]);}_0xd01200[_0x780f('0x80')]=qs['sort'](_0x48ba82[_0x780f('0x54')][_0x780f('0x5a')]);_0xd01200[_0x780f('0x5b')]=qs[_0x780f('0x5c')](_[_0x780f('0x5d')](_0x48ba82[_0x780f('0x54')],_0x4a2d51['filters']));_0xd01200[_0x780f('0x5b')][_0x780f('0x7b')]=_0x5e0635['id'];if(_0x48ba82[_0x780f('0x54')][_0x780f('0x60')]){_0xd01200[_0x780f('0x5b')]=_[_0x780f('0x5e')](_0xd01200['where'],{'$or':_[_0x780f('0x4f')](_0xd01200['attributes'],function(_0x2235ab){var _0x274bb1={};_0x274bb1[_0x2235ab]={'$like':'%'+_0x48ba82[_0x780f('0x54')]['filter']+'%'};return _0x274bb1;})});}_0xd01200=_[_0x780f('0x5e')]({},_0xd01200,_0x48ba82[_0x780f('0x61')]);return db[_0x780f('0x7c')][_0x780f('0x2f')]({'where':_0xd01200[_0x780f('0x5b')]})[_0x780f('0x1f')](function(_0x21830e){_0x6f3674[_0x780f('0x2f')]=_0x21830e;if(_0x48ba82[_0x780f('0x54')][_0x780f('0x62')]){_0xd01200[_0x780f('0x63')]=[{'all':!![]}];}return db[_0x780f('0x7c')][_0x780f('0x64')](_0xd01200);})[_0x780f('0x1f')](function(_0x48a70c){_0x6f3674['rows']=_0x48a70c;return _0x6f3674;});}})[_0x780f('0x1f')](respondWithFilteredResult(_0x378259,_0xd01200))[_0x780f('0x28')](handleError(_0x378259,null));};exports[_0x780f('0x81')]=function(_0x52b01c,_0x1b9265){return db[_0x780f('0x50')][_0x780f('0x73')]({'where':{'id':_0x52b01c[_0x780f('0x67')]['id']}})[_0x780f('0x1f')](handleEntityNotFound(_0x1b9265,null))[_0x780f('0x1f')](function(_0x1a4488){if(_0x1a4488){return _0x1a4488['removeDispositions'](_0x52b01c[_0x780f('0x54')]['ids']);}})[_0x780f('0x1f')](respondWithStatusCode(_0x1b9265,null))['catch'](handleError(_0x1b9265,null));};exports[_0x780f('0x82')]=function(_0x4f78fb,_0x51129c){if(_0x4f78fb[_0x780f('0x6b')]['id']){delete _0x4f78fb['body']['id'];}return db['ChatWebsite'][_0x780f('0x73')]({'where':{'id':_0x4f78fb[_0x780f('0x67')]['id']}})['then'](handleEntityNotFound(_0x51129c,null))[_0x780f('0x1f')](function(_0x5a0d26){if(_0x5a0d26){_0x4f78fb[_0x780f('0x6b')][_0x780f('0x7b')]=_0x5a0d26['id'];return db[_0x780f('0x83')][_0x780f('0x6a')](_0x4f78fb[_0x780f('0x6b')]);}})['then'](respondWithResult(_0x51129c,null))['catch'](handleError(_0x51129c,null));};exports[_0x780f('0x84')]=function(_0x3a339a,_0x3f138f){var _0x3a5df0={'raw':![],'where':{}};var _0x599ceb={};var _0x3dc348={'count':0x0,'rows':[]};return db[_0x780f('0x50')][_0x780f('0x7e')]({'where':{'id':_0x3a339a[_0x780f('0x67')]['id']}})['then'](handleEntityNotFound(_0x3f138f,null))[_0x780f('0x1f')](function(_0x1da8d7){if(_0x1da8d7){_0x599ceb[_0x780f('0x4c')]=_[_0x780f('0x55')](db[_0x780f('0x83')]['rawAttributes']);_0x599ceb[_0x780f('0x54')]=_[_0x780f('0x55')](_0x3a339a['query']);_0x599ceb['filters']=_[_0x780f('0x56')](_0x599ceb[_0x780f('0x4c')],_0x599ceb[_0x780f('0x54')]);_0x3a5df0[_0x780f('0x57')]=_[_0x780f('0x56')](_0x599ceb['model'],qs[_0x780f('0x58')](_0x3a339a[_0x780f('0x54')][_0x780f('0x58')]));_0x3a5df0[_0x780f('0x57')]=_0x3a5df0[_0x780f('0x57')]['length']?_0x3a5df0[_0x780f('0x57')]:_0x599ceb[_0x780f('0x4c')];if(!_0x3a339a['query'][_0x780f('0x7f')](_0x780f('0x59'))){_0x3a5df0[_0x780f('0x30')]=qs['limit'](_0x3a339a[_0x780f('0x54')][_0x780f('0x30')]);_0x3a5df0['offset']=qs['offset'](_0x3a339a[_0x780f('0x54')][_0x780f('0x2d')]);}_0x3a5df0[_0x780f('0x80')]=qs['sort'](_0x3a339a[_0x780f('0x54')]['sort']);_0x3a5df0[_0x780f('0x5b')]=qs[_0x780f('0x5c')](_[_0x780f('0x5d')](_0x3a339a[_0x780f('0x54')],_0x599ceb[_0x780f('0x5c')]));_0x3a5df0['where'][_0x780f('0x7b')]=_0x1da8d7['id'];if(_0x3a339a[_0x780f('0x54')][_0x780f('0x60')]){_0x3a5df0[_0x780f('0x5b')]=_[_0x780f('0x5e')](_0x3a5df0[_0x780f('0x5b')],{'$or':_[_0x780f('0x4f')](_0x3a5df0['attributes'],function(_0x5408e0){var _0x3ebcde={};_0x3ebcde[_0x5408e0]={'$like':'%'+_0x3a339a[_0x780f('0x54')]['filter']+'%'};return _0x3ebcde;})});}_0x3a5df0=_[_0x780f('0x5e')]({},_0x3a5df0,_0x3a339a[_0x780f('0x61')]);return db[_0x780f('0x83')][_0x780f('0x2f')]({'where':_0x3a5df0[_0x780f('0x5b')]})[_0x780f('0x1f')](function(_0x4f240a){_0x3dc348[_0x780f('0x2f')]=_0x4f240a;if(_0x3a339a['query'][_0x780f('0x62')]){_0x3a5df0[_0x780f('0x63')]=[{'all':!![]}];}return db[_0x780f('0x83')][_0x780f('0x64')](_0x3a5df0);})[_0x780f('0x1f')](function(_0x19c1a2){_0x3dc348[_0x780f('0x65')]=_0x19c1a2;return _0x3dc348;});}})[_0x780f('0x1f')](respondWithFilteredResult(_0x3f138f,_0x3a5df0))['catch'](handleError(_0x3f138f,null));};exports[_0x780f('0x85')]=function(_0x1d3fe8,_0x1f8bda){return db[_0x780f('0x50')][_0x780f('0x73')]({'where':{'id':_0x1d3fe8[_0x780f('0x67')]['id']}})[_0x780f('0x1f')](handleEntityNotFound(_0x1f8bda,null))['then'](function(_0x2a9e94){if(_0x2a9e94){return _0x2a9e94[_0x780f('0x85')](_0x1d3fe8[_0x780f('0x54')]['ids']);}})[_0x780f('0x1f')](respondWithStatusCode(_0x1f8bda,null))[_0x780f('0x28')](handleError(_0x1f8bda,null));};exports['addLogo']=function(_0x24fc44,_0xba803b){_0x24fc44[_0x780f('0x6b')][_0x780f('0x86')]=_0x24fc44['file'][_0x780f('0x87')];return db[_0x780f('0x50')][_0x780f('0x73')]({'where':{'id':_0x24fc44[_0x780f('0x67')]['id']}})[_0x780f('0x1f')](handleEntityNotFound(_0xba803b,null))[_0x780f('0x1f')](saveUpdates(_0x24fc44['body'],null))[_0x780f('0x1f')](respondWithResult(_0xba803b,null))['catch'](handleError(_0xba803b,null));};exports['addAvatar']=function(_0x3d7059,_0x42c5b1){_0x3d7059[_0x780f('0x6b')][_0x780f('0x88')]=_0x3d7059[_0x780f('0x89')][_0x780f('0x87')];return db[_0x780f('0x50')][_0x780f('0x73')]({'where':{'id':_0x3d7059['params']['id']}})[_0x780f('0x1f')](handleEntityNotFound(_0x42c5b1,null))['then'](saveUpdates(_0x3d7059[_0x780f('0x6b')],null))[_0x780f('0x1f')](respondWithResult(_0x42c5b1,null))[_0x780f('0x28')](handleError(_0x42c5b1,null));};exports[_0x780f('0x8a')]=function(_0x1b98d2,_0x6bd54b){_0x1b98d2[_0x780f('0x6b')][_0x780f('0x8b')]=_0x1b98d2['file'][_0x780f('0x87')];return db[_0x780f('0x50')][_0x780f('0x73')]({'where':{'id':_0x1b98d2[_0x780f('0x67')]['id']}})['then'](handleEntityNotFound(_0x6bd54b,null))['then'](saveUpdates(_0x1b98d2[_0x780f('0x6b')],null))[_0x780f('0x1f')](respondWithResult(_0x6bd54b,null))['catch'](handleError(_0x6bd54b,null));};exports[_0x780f('0x8c')]=function(_0x21e048,_0x66123a){_0x21e048[_0x780f('0x6b')][_0x780f('0x8d')]=_0x21e048['file'][_0x780f('0x87')];return db[_0x780f('0x50')][_0x780f('0x73')]({'where':{'id':_0x21e048[_0x780f('0x67')]['id']}})[_0x780f('0x1f')](handleEntityNotFound(_0x66123a,null))[_0x780f('0x1f')](saveUpdates(_0x21e048[_0x780f('0x6b')],null))[_0x780f('0x1f')](respondWithResult(_0x66123a,null))[_0x780f('0x28')](handleError(_0x66123a,null));};exports[_0x780f('0x8e')]=function(_0x445fb2,_0x3ace87){var _0x43aff9=path['join'](config['root'],'server/files/images/logos/default_logo.svg');var _0x274952={'where':{'id':_0x445fb2['params']['id']},'attributes':['id',_0x780f('0x86')],'raw':!![]};var _0x4f7543=![];return require('../../config/license/util')[_0x780f('0x8f')]()[_0x780f('0x1f')](function(_0x3eb08d){if(_0x3eb08d){_0x4f7543=_0x3eb08d[_0x780f('0x90')];}})['then'](function(){return db['ChatWebsite'][_0x780f('0x73')](_0x274952);})[_0x780f('0x1f')](handleEntityNotFound(_0x3ace87,null))[_0x780f('0x1f')](function(_0x5dbdb9){if(_0x5dbdb9){if(!_['isNil'](_0x5dbdb9[_0x780f('0x86')])){if(fs['existsSync'](path[_0x780f('0x91')](config[_0x780f('0x92')],_0x780f('0x93'),_0x5dbdb9[_0x780f('0x86')]))&&_0x4f7543){_0x43aff9=path[_0x780f('0x91')](config[_0x780f('0x92')],_0x780f('0x93'),_0x5dbdb9[_0x780f('0x86')]);}}return _0x3ace87[_0x780f('0x94')](_0x43aff9);}})['catch'](handleError(_0x3ace87,null));};exports[_0x780f('0x95')]=function(_0x9da09e,_0x56031a){var _0x52788c=path[_0x780f('0x91')](config['root'],'server/files/images/avatars/default_avatar.png');var _0x261367={'where':{'id':_0x9da09e[_0x780f('0x67')]['id']},'attributes':['id',_0x780f('0x88')],'raw':!![]};return db[_0x780f('0x50')][_0x780f('0x73')](_0x261367)[_0x780f('0x1f')](handleEntityNotFound(_0x56031a,null))[_0x780f('0x1f')](function(_0x285ebc){if(_0x285ebc){if(!_[_0x780f('0x96')](_0x285ebc[_0x780f('0x88')])){if(fs[_0x780f('0x97')](path[_0x780f('0x91')](config[_0x780f('0x92')],_0x780f('0x98'),_0x285ebc[_0x780f('0x88')]))){_0x52788c=path[_0x780f('0x91')](config[_0x780f('0x92')],'server/files/images/avatars/',_0x285ebc[_0x780f('0x88')]);}}return _0x56031a[_0x780f('0x94')](_0x52788c);}})[_0x780f('0x28')](handleError(_0x56031a,null));};exports[_0x780f('0x99')]=function(_0x58e73d,_0x152e79){var _0x2d4ef5=path[_0x780f('0x91')](config[_0x780f('0x92')],_0x780f('0x9a'));var _0x4c9cd5={'where':{'id':_0x58e73d['params']['id']},'attributes':['id',_0x780f('0x8b'),'showCustomerAvatar'],'raw':!![]};return db[_0x780f('0x50')][_0x780f('0x73')](_0x4c9cd5)['then'](handleEntityNotFound(_0x152e79,null))[_0x780f('0x1f')](function(_0x231ae9){if(_0x231ae9){if(!_['isNil'](_0x231ae9[_0x780f('0x8b')])){if(fs['existsSync'](path['join'](config['root'],_0x780f('0x98'),_0x231ae9[_0x780f('0x8b')]))&&_0x231ae9[_0x780f('0x9b')]){_0x2d4ef5=path['join'](config[_0x780f('0x92')],'server/files/images/avatars/',_0x231ae9[_0x780f('0x8b')]);}}return _0x152e79[_0x780f('0x94')](_0x2d4ef5);}})['catch'](handleError(_0x152e79,null));};exports[_0x780f('0x9c')]=function(_0x4a503a,_0x45b0f4){var _0x25164e=path[_0x780f('0x91')](config[_0x780f('0x92')],_0x780f('0x9d'));var _0x49a59f={'where':{'id':_0x4a503a[_0x780f('0x67')]['id']},'attributes':['id',_0x780f('0x8d')],'raw':!![]};return db[_0x780f('0x50')][_0x780f('0x73')](_0x49a59f)[_0x780f('0x1f')](handleEntityNotFound(_0x45b0f4,null))[_0x780f('0x1f')](function(_0x35afac){if(_0x35afac){if(!_[_0x780f('0x96')](_0x35afac[_0x780f('0x8d')])){if(fs[_0x780f('0x97')](path[_0x780f('0x91')](config[_0x780f('0x92')],_0x780f('0x98'),_0x35afac[_0x780f('0x8d')]))){_0x25164e=path[_0x780f('0x91')](config[_0x780f('0x92')],_0x780f('0x98'),_0x35afac['systemAvatar']);}}return _0x45b0f4[_0x780f('0x94')](_0x25164e);}})[_0x780f('0x28')](handleError(_0x45b0f4,null));};function checkWebsiteInterval(_0x332c3e){var _0x9a91a=_0x332c3e[_0x780f('0x9e')];if(!_0x9a91a){return Promise['resolve'](_0x332c3e);}var _0x33829a=_0x332c3e[_0x780f('0x9f')]||undefined;return _0x9a91a[_0x780f('0xa0')](_0x33829a)['then'](function(_0x17403e){if(!_0x17403e){throw new APIOutOfIntervalError();}return _0x332c3e;});}exports[_0x780f('0xa1')]=function(_0x451045,_0x233235){var _0x5cdbd0={'body':_0x451045[_0x780f('0x6b')],'channel':_0x780f('0xa2')};var _0x4d8fbc=[];var _0x4ee7b0=[];var _0x1bf1f4={};var _0x45adcb=![];if(_0x451045[_0x780f('0x6b')]['id']){delete _0x451045['body']['id'];}if(_[_0x780f('0x96')](_0x451045[_0x780f('0x6b')]['from'])){throw new APIBadRequestError('From\x20is\x20mandatory');}if(_[_0x780f('0x96')](_0x451045['body'][_0x780f('0xa3')])){throw new APIBadRequestError(_0x780f('0xa4'));}if(_[_0x780f('0xa5')](_0x451045['body'][_0x780f('0x6b')])){throw new APIBadRequestError(_0x780f('0xa6'));}var _0x371b1c=_0x451045[_0x780f('0x6b')][_0x780f('0x3b')]&&_0x451045[_0x780f('0x6b')][_0x780f('0x42')];return db[_0x780f('0xa7')][_0x780f('0x79')]()['then'](function(_0x106c84){if(!_0x106c84){throw new Error('No\x20available\x20attributes');}_0x4d8fbc=Object[_0x780f('0x55')](_0x106c84)[_0x780f('0x60')](function(_0xae9756){return![_0x780f('0xa8'),_0x780f('0xa9')][_0x780f('0xaa')](_0xae9756);});_0x4ee7b0=Object[_0x780f('0x55')](_0x106c84)[_0x780f('0x60')](function(_0x54ef17){return!['createdAt',_0x780f('0xa9'),_0x780f('0xab'),_0x780f('0xac')][_0x780f('0xaa')](_0x54ef17);});if(!_[_0x780f('0xaa')](_0x4ee7b0,_0x451045[_0x780f('0x6b')]['mapKey'])){throw new APIBadRequestError(_0x780f('0xad')+_0x4ee7b0[_0x780f('0x91')](',\x20'));}_0x1bf1f4[_0x451045['body'][_0x780f('0xa3')]]=_0x451045[_0x780f('0x6b')]['from'];})[_0x780f('0x1f')](function(){return db[_0x780f('0x50')]['find']({'where':{'id':_0x451045[_0x780f('0x67')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db['CmContact'],'as':'Contacts','where':_0x1bf1f4,'limit':0x1,'order':[['updatedAt',_0x780f('0xae')]]}]},{'model':db[_0x780f('0xaf')],'as':'Applications'},{'model':db[_0x780f('0x9e')],'as':'Interval','include':[{'model':db[_0x780f('0x9e')],'as':'Intervals','attributes':['id',_0x780f('0xb0')],'raw':!![]}]}]});})[_0x780f('0x1f')](function(_0x4a473b){if(!_0x4a473b){throw new APINotFoundError(util[_0x780f('0x45')](_0x780f('0xb1'),_0x451045[_0x780f('0x67')]['id']));}if(_0x371b1c){return checkWebsiteInterval(_0x4a473b);}return _0x4a473b;})['then'](function(_0x45fca1){_0x5cdbd0[_0x780f('0xb2')]=_0x45fca1;_0x5cdbd0[_0x780f('0xb3')]=_['orderBy'](_0x45fca1[_0x780f('0xb4')],[_0x780f('0xb5')],[_0x780f('0xb6')]);if(_0x5cdbd0[_0x780f('0xb2')][_0x780f('0xb4')]){delete _0x5cdbd0['account'][_0x780f('0xb4')];}_0x5cdbd0[_0x780f('0xb7')]=_0x45fca1[_0x780f('0xb8')]||{'id':_0x45fca1[_0x780f('0xac')]};if(_0x5cdbd0[_0x780f('0xb7')]&&_0x5cdbd0[_0x780f('0xb7')]['Contacts'][_0x780f('0x69')]){return _0x5cdbd0[_0x780f('0xb7')][_0x780f('0xb9')][0x0];}var _0x27f8bb=_[_0x780f('0x17')](_0x451045[_0x780f('0x6b')],{'firstName':_0x451045[_0x780f('0x6b')][_0x780f('0xba')],'ListId':_0x45fca1[_0x780f('0xac')]});_0x27f8bb[_0x451045[_0x780f('0x6b')][_0x780f('0xa3')]]=_0x451045[_0x780f('0x6b')][_0x780f('0xba')];return db['CmContact'][_0x780f('0x6a')](_0x27f8bb,{'fields':_0x4d8fbc,'raw':!![]});})[_0x780f('0x1f')](function(_0x2d1133){_0x5cdbd0[_0x780f('0xbb')]=_0x2d1133;var _0x5a3e80=createInteractionObject(_0x451045[_0x780f('0x67')]['id'],_0x451045['body'],_0x451045[_0x780f('0xbc')],_0x2d1133);var _0x19fba6={'ChatWebsiteId':_0x451045[_0x780f('0x67')]['id']};if(_0x451045[_0x780f('0x6b')]['threadId']){_0x19fba6['threadId']=_0x451045['body']['threadId'];_0x19fba6[_0x780f('0xbd')]=![];return db[_0x780f('0xbe')]['find']({'where':_0x19fba6})[_0x780f('0x1f')](function(_0x3ad050){var _0x3820e1=_0x451045['body'][_0x780f('0x3b')]&&_0x451045['body'][_0x780f('0x42')];if(_0x3ad050){_0x45adcb=!![];return _0x3ad050;}else if(!_0x3820e1&&_0x3ad050&&_0x3ad050[_0x780f('0xbd')]){throw new APIConflictError(_0x780f('0xbf'));}_0x5a3e80[_0x780f('0xc0')]=_0x451045[_0x780f('0x6b')][_0x780f('0xc0')];_0x5a3e80['externalUrl']=_0x451045[_0x780f('0x6b')]['externalUrl'];return db['ChatInteraction'][_0x780f('0x6a')](_0x5a3e80);});}_0x19fba6[_0x780f('0xc1')]=_0x2d1133['id'];if(_0x451045[_0x780f('0x6b')]['interaction']&&_0x451045[_0x780f('0x6b')][_0x780f('0xc2')]['id']){_0x19fba6['id']=_0x451045[_0x780f('0x6b')][_0x780f('0xc2')]['id'];return db['ChatInteraction'][_0x780f('0x73')]({'where':_0x19fba6})['then'](function(_0x4b5856){var _0xd3fc9a=_0x451045['body']['customerIp']&&_0x451045[_0x780f('0x6b')][_0x780f('0x42')];if(!_0xd3fc9a&&_0x4b5856&&_0x4b5856[_0x780f('0xbd')]){throw new APIConflictError(_0x780f('0xbf'));}else if(_0x4b5856){_0x45adcb=!![];return _0x4b5856;}else{return db['ChatInteraction']['create'](_0x5a3e80);}});}return db[_0x780f('0xbe')]['create'](_0x5a3e80);})[_0x780f('0x1f')](function(_0x4b1292){if(!_0x45adcb){return _0x4b1292;}var _0x698e2b={'from':(_0x5cdbd0[_0x780f('0xbb')]['firstName']||'')+'\x20'+(_0x5cdbd0[_0x780f('0xbb')]['lastName']||'')};if(_0x451045[_0x780f('0x6b')]['threadId']&&_0x451045[_0x780f('0x6b')][_0x780f('0xc3')]&&_0x451045['body'][_0x780f('0xc0')]!=_0x451045[_0x780f('0x6b')]['messageId']){_0x698e2b[_0x780f('0xc0')]=_0x451045[_0x780f('0x6b')]['messageId'];}return _0x4b1292[_0x780f('0x33')](_0x698e2b);})[_0x780f('0x1f')](function(_0x21a67f){_0x5cdbd0[_0x780f('0xc2')]=_0x21a67f[_0x780f('0x35')]({'plain':!![]});_0x5cdbd0[_0x780f('0xc2')][_0x780f('0xc4')]=!_0x45adcb;if(_0x5cdbd0[_0x780f('0xc2')][_0x780f('0xc4')]){if(_0x5cdbd0['account'][_0x780f('0xc5')]){_0x5cdbd0['applications'][_0x780f('0xc6')]({'id':0x0,'priority':_0x5cdbd0['applications'][_0x780f('0x69')]+0x1,'app':_0x780f('0xc7'),'appdata':_0x780f('0xc8'),'interval':_0x780f('0xc9')});}}return db[_0x780f('0xca')]['create']({'body':_0x451045[_0x780f('0x6b')][_0x780f('0x6b')],'ChatWebsiteId':_0x451045[_0x780f('0x67')]['id'],'ChatInteractionId':_0x21a67f['id'],'direction':'in','ContactId':_0x5cdbd0['contact']['id'],'AttachmentId':_0x451045[_0x780f('0x6b')][_0x780f('0xcb')]});})['then'](function(_0x1802f5){_0x5cdbd0[_0x780f('0x25')]=_0x1802f5;if(!_0x5cdbd0['interaction'][_0x780f('0xcc')]){return;}return db[_0x780f('0xcd')]['find']({'attributes':['id','name'],'where':{'id':_0x5cdbd0[_0x780f('0xc2')][_0x780f('0xcc')]}});})[_0x780f('0x1f')](function(_0x4e3dcb){if(_0x4e3dcb){_0x5cdbd0['applications'][_0x780f('0xce')]({'id':0x0,'priority':0x0,'app':_0x780f('0xcf'),'appdata':_0x4e3dcb['name']+','+(_0x5cdbd0['account']['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});_0x5cdbd0[_0x780f('0xd0')]=!![];}if(!_0x5cdbd0['interaction']['queueId']){return;}return db[_0x780f('0xd1')]['find']({'attributes':['id',_0x780f('0x44')],'where':{'id':_0x5cdbd0[_0x780f('0xc2')][_0x780f('0xd2')]}});})[_0x780f('0x1f')](function(_0x216504){if(_0x216504){_0x5cdbd0[_0x780f('0xb3')][_0x780f('0xce')]({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x216504[_0x780f('0x44')]+','+(_0x5cdbd0[_0x780f('0xb2')]['waitForTheAssignedQueue']||0x12c),'interval':_0x780f('0xc9')});}return respondWithRpcPromise('Start',_0x780f('0xd3'),_0x5cdbd0);})[_0x780f('0x1f')](function(_0x3d18c0){respondWithRpcPromise(_0x780f('0xd4'),'EventManager',{'event':_0x780f('0xa1'),'message':_0x3d18c0},client9002);return _0x3d18c0;})[_0x780f('0x1f')](respondWithResult(_0x233235,null))[_0x780f('0x28')](APIHandleError(_0x233235));};exports[_0x780f('0xd5')]=function(_0x2763c1,_0x46da4e){var _0x4a7be9,_0x38de46,_0x8edbd4;var _0x105f4b=[];var _0x27ef9d={};var _0xae0745=_0x2763c1['files']||[];var _0x537c93=[];var _0x563b6f;return db[_0x780f('0xa7')][_0x780f('0x79')]()[_0x780f('0x1f')](function(_0x2909b8){if(!_0x2909b8){throw new db[(_0x780f('0xd6'))]['ValidationError'](_0x780f('0xd7'));}_0x105f4b=_['difference'](_[_0x780f('0x55')](_0x2909b8),['createdAt',_0x780f('0xa9'),_0x780f('0xab'),_0x780f('0xac')]);if(_0x2763c1['body']['id']){delete _0x2763c1[_0x780f('0x6b')]['id'];}if(_[_0x780f('0x96')](_0x2763c1[_0x780f('0x6b')][_0x780f('0xba')])){throw _0x46da4e[_0x780f('0x2b')](0x1f4)['send'](new db[(_0x780f('0xd6'))][(_0x780f('0xd8'))](_0x780f('0xd9')));}if(_[_0x780f('0x96')](_0x2763c1[_0x780f('0x6b')][_0x780f('0x6b')])||_0x2763c1[_0x780f('0x6b')][_0x780f('0x6b')]===''){throw _0x46da4e[_0x780f('0x2b')](0x1f4)['send'](new db[(_0x780f('0xd6'))]['ValidationError'](_0x780f('0xda')));}if(_[_0x780f('0x96')](_0x2763c1[_0x780f('0x6b')][_0x780f('0xdb')])){throw _0x46da4e[_0x780f('0x2b')](0x1f4)['send'](new db[(_0x780f('0xd6'))]['ValidationError'](_0x780f('0xdc')+_0x105f4b));}if(!_[_0x780f('0xaa')](_0x105f4b,_0x2763c1[_0x780f('0x6b')][_0x780f('0xdb')])){throw _0x46da4e[_0x780f('0x2b')](0x1f4)[_0x780f('0x38')](new db[(_0x780f('0xd6'))][(_0x780f('0xd8'))](_0x780f('0xdd')+_0x105f4b));}_0x27ef9d[_0x2763c1[_0x780f('0x6b')][_0x780f('0xdb')]]=_0x2763c1[_0x780f('0x6b')]['from'];})[_0x780f('0x1f')](function(){return db[_0x780f('0x50')][_0x780f('0x73')]({'where':{'id':_0x2763c1[_0x780f('0x67')]['id']},'include':[{'model':db[_0x780f('0xde')],'as':_0x780f('0xb8')},{'model':db['MailAccount'],'as':_0x780f('0xdf')}]});})[_0x780f('0x1f')](handleEntityNotFound(_0x46da4e,null))[_0x780f('0x1f')](function(_0x2d358a){if(_0x2d358a&&_0x2d358a['List']){_0x38de46=_0x2d358a;var _0x16adee=_[_0x780f('0x17')](_0x2763c1[_0x780f('0x6b')],{'firstName':_0x2763c1[_0x780f('0x6b')][_0x780f('0xba')],'phone':_0x2763c1[_0x780f('0x6b')][_0x780f('0xba')],'ListId':_0x2d358a['ListId']});_0x16adee[_0x2763c1[_0x780f('0x6b')][_0x780f('0xdb')]]=_0x2763c1[_0x780f('0x6b')]['from'];return db['CmContact'][_0x780f('0xe0')]({'where':_0x27ef9d,'defaults':_0x16adee});}})[_0x780f('0xe1')](function(_0x3d9df1){if(_0x3d9df1){_0x8edbd4=_0x3d9df1;var _0x370f5f=fs[_0x780f('0xe2')](path['join'](config['root'],_0x780f('0xe3')),'utf8');var _0x3d196f=ejs[_0x780f('0xe4')](_0x370f5f,{'body':_[_0x780f('0xe5')](_0x2763c1[_0x780f('0x6b')][_0x780f('0x6b')]),'bodyTitle':_0x38de46[_0x780f('0xe6')]});return db['ChatOfflineMessage'][_0x780f('0x6a')]({'body':_0x3d196f,'plainBody':htmlToText[_0x780f('0xe7')](_0x3d196f),'ContactId':_0x3d9df1['id'],'ChatWebsiteId':_0x38de46['id']});}})['then'](function(_0x511f2b){_0x563b6f=_0x511f2b;if(_0xae0745[_0x780f('0x69')]){var _0x2c5514=_0xae0745[_0x780f('0x4f')](function(_0xa889ce){return{'name':_0xa889ce[_0x780f('0xe8')],'basename':_0xa889ce['filename'],'type':_0xa889ce['mimetype'],'ChatOfflineMessageId':_0x511f2b['id']};});_0x537c93=_0x2c5514['map'](_0x41ec61=>{var _0x9bcf9d={'filename':_0x41ec61['name'],'path':path['join'](config[_0x780f('0x92')],_0x780f('0xe9'),_0x780f('0xea'),_0x780f('0xeb'),_0x780f('0xec'),_0x41ec61[_0x780f('0xed')])};return _0x9bcf9d;});if(!_0x38de46['openNewInteraction']){return db[_0x780f('0xee')][_0x780f('0xef')](function(_0x23bc2e){return db[_0x780f('0xf0')][_0x780f('0xf1')](_0x2c5514,{'transaction':_0x23bc2e});});}}})[_0x780f('0x1f')](function(){if(_0x563b6f){_0x4a7be9=_0x563b6f;return db['MailAccount']['findOne']({'where':{'service':!![]},'include':[{'model':db[_0x780f('0xf2')],'as':_0x780f('0xf3'),'raw':!![],'include':[{'model':db[_0x780f('0xf4')],'as':_0x780f('0xf4'),'raw':!![]}]}]});}})[_0x780f('0x1f')](function(_0x3e7ceb){if(_0x3e7ceb&&_0x3e7ceb[_0x780f('0xf3')]&&_0x38de46[_0x780f('0xf5')]&&_0x38de46[_0x780f('0xf6')]){var _0x99f8fe=_0x3e7ceb['getSmtpOptions']();return respondWithRpcPromise(_0x780f('0xf7'),'sendMail',{'account':_0x99f8fe,'message':{'from':util[_0x780f('0x45')]('\x22%s\x22\x20<%s>',_0x3e7ceb[_0x780f('0x44')],_0x3e7ceb[_0x780f('0xf8')]||_0x3e7ceb[_0x780f('0xf3')][_0x780f('0x72')]),'to':_0x38de46['forwardOfflineAddress'],'subject':_0x38de46[_0x780f('0xf9')],'html':_0x4a7be9[_0x780f('0x6b')],'attachments':_0x537c93}},client9003)[_0x780f('0x1f')](function(){return _0x4a7be9;})[_0x780f('0x28')](function(_0x24aef2){logger[_0x780f('0x23')](_0x24aef2);});}})['then'](function(){if(_0x38de46&&_0x38de46[_0x780f('0xfa')]&&_0x38de46[_0x780f('0xfb')]){var _0x55a8dc=[];if(_0xae0745[_0x780f('0x69')]){_0x55a8dc=_0xae0745[_0x780f('0x4f')](function(_0x28bf7d){return{'name':_0x28bf7d['originalname'],'basename':_0x28bf7d[_0x780f('0x87')],'type':_0x28bf7d['mimetype'],'ChatOfflineMessageId':_0x563b6f['id']};});}var _0x11371e;if(!_[_0x780f('0x96')](_0x38de46['subjectOffline'])){var _0x2b443b=_['map'](_0x2763c1['body'],function(_0x4704e8){return _0x4704e8;});var _0x1539e9=_[_0x780f('0xfc')](_0x2b443b)[0x0];var _0x43546f=_[_0x780f('0xfd')](_0x1539e9,function(_0x519f1a){return _0x519f1a;});_0x11371e=_0x43546f[0x1][_0x38de46['subjectOffline']];}var _0x1035fb={'from':_0x8edbd4[_0x780f('0xf8')],'firstName':_0x8edbd4[_0x780f('0x3f')],'lastName':_0x8edbd4[_0x780f('0x40')],'mapKey':_0x780f('0xf8'),'message':{'from':_0x8edbd4[_0x780f('0xf8')],'to':_0x38de46[_0x780f('0xdf')][_0x780f('0xf8')],'cc':'','subject':_[_0x780f('0x96')](_0x11371e)?_0x38de46['offlineMessageSubject']:_0x11371e,'messageId':'','sentAt':new Date(),'attach':_0x55a8dc[_0x780f('0x69')],'attachments':_0x55a8dc,'originChannel':_0x780f('0xfe'),'ChatWebsiteId':_0x38de46['id'],'ChatOfflineMessageId':_0x4a7be9['id'],'originTo':_0x38de46['MailAccount']['email']},'body':_0x4a7be9[_0x780f('0x6b')]};var _0x2a9541={'account':{'id':_0x38de46[_0x780f('0xfb')]},'body':_0x1035fb,'log':_0x780f('0xff')};return respondWithRpcPromise(_0x780f('0xff'),_0x780f('0x100'),_0x2a9541,client9001)['then'](function(){return _0x4a7be9;})['catch'](function(_0x25a4f1){logger[_0x780f('0x23')](_0x25a4f1);});}return;})[_0x780f('0x1f')](function(){if(_0x4a7be9){return _0x4a7be9;}})[_0x780f('0x1f')](respondWithResult(_0x46da4e,null))[_0x780f('0x28')](function(){for(var _0x28219c of _0xae0745){var _0x36b927=path['join'](config['root'],_0x780f('0xe9'),_0x780f('0xea'),_0x780f('0xeb'),_0x780f('0xec'),_0x28219c[_0x780f('0x87')]);fs_extra[_0x780f('0x101')](_0x36b927)['catch'](function(_0xbd8f4){logger['error'](_0x780f('0x102'),_0x36b927,_0xbd8f4);});}});};exports[_0x780f('0x103')]=function(_0x196cec,_0x58d94a){return db[_0x780f('0xbe')][_0x780f('0x73')]({'where':{'id':_0x196cec['params']['id']}})['then'](handleEntityNotFound(_0x58d94a,null))[_0x780f('0x1f')](function(_0x44064c){if(_0x44064c){return _0x44064c[_0x780f('0x103')](_0x196cec['body'][_0x780f('0x104')],_[_0x780f('0x105')](_0x196cec['body'],[_0x780f('0x104'),'id'])||{});}})['then'](respondWithResult(_0x58d94a,null))[_0x780f('0x28')](handleError(_0x58d94a,null));};exports['getInteractions']=function(_0x36b9a4,_0x1a5ba0){var _0x5ec736={'raw':![],'where':{}};var _0x3e2b3={};var _0x2b238f={'count':0x0,'rows':[]};return db[_0x780f('0x50')][_0x780f('0x7e')]({'where':{'id':_0x36b9a4['params']['id']}})[_0x780f('0x1f')](handleEntityNotFound(_0x1a5ba0,null))[_0x780f('0x1f')](function(_0x3c634b){if(_0x3c634b){_0x3e2b3['model']=_[_0x780f('0x55')](db['ChatInteraction'][_0x780f('0x51')]);_0x3e2b3[_0x780f('0x54')]=_[_0x780f('0x55')](_0x36b9a4[_0x780f('0x54')]);_0x3e2b3[_0x780f('0x5c')]=_[_0x780f('0x56')](_0x3e2b3[_0x780f('0x4c')],_0x3e2b3[_0x780f('0x54')]);_0x5ec736['attributes']=_[_0x780f('0x56')](_0x3e2b3[_0x780f('0x4c')],qs[_0x780f('0x58')](_0x36b9a4['query'][_0x780f('0x58')]));_0x5ec736[_0x780f('0x57')]=_0x5ec736[_0x780f('0x57')][_0x780f('0x69')]?_0x5ec736[_0x780f('0x57')]:_0x3e2b3['model'];if(!_0x36b9a4[_0x780f('0x54')][_0x780f('0x7f')](_0x780f('0x59'))){_0x5ec736[_0x780f('0x30')]=qs[_0x780f('0x30')](_0x36b9a4[_0x780f('0x54')]['limit']);_0x5ec736['offset']=qs[_0x780f('0x2d')](_0x36b9a4[_0x780f('0x54')][_0x780f('0x2d')]);}_0x5ec736['order']=qs[_0x780f('0x5a')](_0x36b9a4[_0x780f('0x54')][_0x780f('0x5a')]);_0x5ec736[_0x780f('0x5b')]=qs['filters'](_['pick'](_0x36b9a4['query'],_0x3e2b3[_0x780f('0x5c')]));_0x5ec736['where']['ChatWebsiteId']=_0x3c634b['id'];if(_0x36b9a4[_0x780f('0x54')][_0x780f('0x60')]){_0x5ec736[_0x780f('0x5b')]=_[_0x780f('0x5e')](_0x5ec736[_0x780f('0x5b')],{'$or':_['map'](_0x5ec736[_0x780f('0x57')],function(_0xf62374){var _0x5f2a7e={};_0x5f2a7e[_0xf62374]={'$like':'%'+_0x36b9a4[_0x780f('0x54')]['filter']+'%'};return _0x5f2a7e;})});}_0x5ec736=_[_0x780f('0x5e')]({},_0x5ec736,_0x36b9a4[_0x780f('0x61')]);return db[_0x780f('0xbe')]['count']({'where':_0x5ec736['where']})[_0x780f('0x1f')](function(_0x436344){_0x2b238f[_0x780f('0x2f')]=_0x436344;if(_0x36b9a4[_0x780f('0x54')][_0x780f('0x62')]){_0x5ec736[_0x780f('0x63')]=[{'model':db['CmContact'],'as':_0x780f('0x106'),'required':![]},{'model':db['User'],'as':_0x780f('0x107'),'attributes':[_0x780f('0x44'),_0x780f('0x108'),_0x780f('0x109')],'required':![]},{'model':db[_0x780f('0x10a')],'as':_0x780f('0x10b'),'attributes':['id',_0x780f('0x44'),_0x780f('0x10c')],'where':_0x36b9a4[_0x780f('0x54')][_0x780f('0x10d')]?{'id':_0x36b9a4[_0x780f('0x54')][_0x780f('0x10d')]}:undefined,'required':_0x36b9a4[_0x780f('0x54')][_0x780f('0x10d')]?!![]:![]}];}return db['ChatInteraction'][_0x780f('0x64')](_0x5ec736);})[_0x780f('0x1f')](function(_0x4e1838){_0x2b238f['rows']=_0x4e1838;return _0x2b238f;});}})['then'](respondWithFilteredResult(_0x1a5ba0,_0x5ec736))['catch'](handleError(_0x1a5ba0,null));};exports['getSnippet']=function(_0x3a7f03,_0xb4a15d){var _0xe3b403=0x0;var _0x251afe=0x0;var _0x2b70ef=![];var _0x6d9f64;var _0x133803;return db[_0x780f('0x50')]['find']({'where':{'id':_0x3a7f03['params']['id']},'include':[{'model':db[_0x780f('0x9e')],'as':'Interval','include':[{'model':db[_0x780f('0x9e')],'as':_0x780f('0x10e'),'attributes':['id','interval']}]}]})[_0x780f('0x1f')](handleEntityNotFound(_0xb4a15d,null))['then'](function(_0x2d173e){if(_0x2d173e){_0x6d9f64=_0x2d173e;return _0x2d173e[_0x780f('0x10f')]({'raw':!![]});}})[_0x780f('0x1f')](function(_0x3e03a6){if(_0x6d9f64){if(_0x3e03a6){_0x133803=_0x3e03a6;}}return require(_0x780f('0x110'))['getLicense']();})['then'](function(_0x32ba87){if(_0x32ba87){_0x251afe=_0x32ba87['virtual'];_0x2b70ef=_0x32ba87[_0x780f('0x90')];}})[_0x780f('0x1f')](function(){return db[_0x780f('0xbe')][_0x780f('0x2f')]({'where':{'closed':![]}});})[_0x780f('0x1f')](function(_0x3ba7bb){_0xe3b403=_0x3ba7bb;if(_0x251afe&&_0x3ba7bb>_0x251afe){return db[_0x780f('0x111')]['findOne']({'where':{'id':0x1}})[_0x780f('0x1f')](function(_0x4b8e84){if(_0x4b8e84){_0x4b8e84[_0x780f('0x112')](_0x780f('0x113'));}});}})[_0x780f('0x1f')](function(){var _0x47eff8=_0x6d9f64[_0x780f('0x9e')];var _0x14bcbf=_0x6d9f64['timezone']||undefined;return _0x47eff8?_0x47eff8['ifTime'](_0x14bcbf):!![];})['then'](function(_0xe639c4){var _0x4f6232=fs[_0x780f('0xe2')](path['join'](config[_0x780f('0x92')],_0x780f('0x114')),_0x780f('0x115'));var _0x563b61='3.9.0';var _0x472fb0=![];var _0x3e0c73,_0x53e57c;if(_0x3a7f03[_0x780f('0xbc')][_0x780f('0x42')]){_0x3e0c73=new URL(_0x3a7f03['headers'][_0x780f('0x42')])[_0x780f('0x116')];}else if(_0x3a7f03[_0x780f('0xbc')]['origin']){_0x3e0c73=new URL(_0x3a7f03[_0x780f('0xbc')][_0x780f('0x116')])[_0x780f('0x116')];}else{_0x3e0c73=_0x780f('0x117');}_0x53e57c=typeof _0x6d9f64[_0x780f('0x76')][_0x780f('0x6c')](',')[_0x780f('0x73')](function(_0x58d950){return wildcardUtils['testWebsiteWithWildcard'](_0x58d950,_0x3e0c73);})!==_0x780f('0x2e');var _0x43c844={'chatVersion':_0x563b61,'chatWebsiteAddressOrigin':_0x53e57c?_0x3e0c73:_0x6d9f64['address'],'remote':_0x6d9f64['remote'],'query':querystring[_0x780f('0x4e')](_[_0x780f('0x5e')](_0x6d9f64[_0x780f('0x35')]({'plain':!![]}),{'customerIp':_0x3a7f03['headers']['x-forwarded-for']||_0x3a7f03['headers']['x-real-ip']||_0x3a7f03['connection'][_0x780f('0x118')]||_0x3a7f03['ip'],'referer':_0x3a7f03[_0x780f('0xbc')]['referer'],'openedInteractions':_0xe3b403,'maxInteractions':_0x251afe,'virtual':_0x2b70ef[_0x780f('0x119')],'online':_0xe639c4,'custom':_0x2b70ef,'address':_0x53e57c?_0x3e0c73:null}))['replace'](/'/g,'\x5c\x27')};_0xb4a15d[_0x780f('0x38')](ejs[_0x780f('0xe4')](Mustache[_0x780f('0xe4')](_0x4f6232,_0x43c844),{'proactiveActions':_0x133803,'alignment':_0x6d9f64['alignment'],'verticalAlignment':_0x6d9f64[_0x780f('0x11a')],'div_color':_0x6d9f64['color'],'labelText':_0x6d9f64[_0x780f('0x11b')],'text_color':_0x6d9f64[_0x780f('0x11c')],'text_button_color':_0x6d9f64[_0x780f('0x11d')],'button_color':_0x6d9f64[_0x780f('0x11e')],'background_color':_0x6d9f64[_0x780f('0x11f')],'hideWhenOffline':_0x6d9f64[_0x780f('0x120')],'intervalId':_0x6d9f64['IntervalId'],'isDevelopment':_0x472fb0,'chatVersion':_0x563b61}));})[_0x780f('0x28')](handleError(_0xb4a15d,null));};exports[_0x780f('0x121')]=function(_0x232f2a,_0x3c38c2){var _0x47d83c=_0x232f2a[_0x780f('0x67')]['id'];var _0x406dfe=_0x232f2a[_0x780f('0x6b')];var _0x1a4af8=0xc8;var _0x4b1abd=null;return db[_0x780f('0xee')][_0x780f('0xef')]({'isolationLevel':db['sequelize'][_0x780f('0x122')][_0x780f('0x123')][_0x780f('0x124')]},function(_0x3a75ea){return db[_0x780f('0x50')]['findOne']({'where':{'id':_0x47d83c},'transaction':_0x3a75ea})[_0x780f('0x1f')](function(_0x2bcd13){if(_0x2bcd13){return db[_0x780f('0xaf')]['destroy']({'where':{'ChatWebsiteId':_0x47d83c},'transaction':_0x3a75ea})[_0x780f('0x1f')](function(){var _0x1da524=_[_0x780f('0x4f')](_0x406dfe,function(_0x489d3e){_0x489d3e[_0x780f('0x7b')]=_0x47d83c;return _0x489d3e;});return db[_0x780f('0xaf')][_0x780f('0xf1')](_0x1da524,{'transaction':_0x3a75ea});});}else{_0x1a4af8=0x194;_0x4b1abd=[];}});})[_0x780f('0x1f')](function(){if(_0x1a4af8!==0x194){return db[_0x780f('0xaf')][_0x780f('0x125')]({'where':{'ChatWebsiteId':_0x47d83c},'order':_0x780f('0xb5')})['then'](function(_0x530c1c){_0x4b1abd=_0x530c1c;});}})[_0x780f('0x28')](function(_0x20a494){_0x1a4af8=0x1f4;logger[_0x780f('0x23')](_0x20a494['stack']);if(_0x20a494['name']){delete _0x20a494[_0x780f('0x44')];}_0x4b1abd=_0x20a494;})[_0x780f('0x126')](function(){if(_0x4b1abd===null){_0x3c38c2[_0x780f('0x29')](_0x1a4af8);}else{if(_0x1a4af8===0x1f4){_0x3c38c2[_0x780f('0x2b')](_0x1a4af8)[_0x780f('0x38')](_0x4b1abd);}else{_0x3c38c2[_0x780f('0x2b')](_0x1a4af8)[_0x780f('0x2c')](_0x4b1abd);}}});};exports[_0x780f('0x127')]=function(_0x30a4dc,_0xafe98d){var _0x102ed4={};var _0x4b1e03={};var _0x460f1f;var _0x1e49ef;return db['ChatWebsite']['findOne']({'where':{'id':_0x30a4dc['params']['id']}})['then'](handleEntityNotFound(_0xafe98d,null))[_0x780f('0x1f')](function(_0x2d396a){if(_0x2d396a){_0x460f1f=_0x2d396a;_0x4b1e03[_0x780f('0x4c')]=_[_0x780f('0x55')](db[_0x780f('0xaf')]['rawAttributes']);_0x4b1e03[_0x780f('0x54')]=_[_0x780f('0x55')](_0x30a4dc[_0x780f('0x54')]);_0x4b1e03[_0x780f('0x5c')]=_[_0x780f('0x56')](_0x4b1e03[_0x780f('0x4c')],_0x4b1e03[_0x780f('0x54')]);_0x102ed4[_0x780f('0x57')]=_[_0x780f('0x56')](_0x4b1e03[_0x780f('0x4c')],qs['fields'](_0x30a4dc[_0x780f('0x54')]['fields']));_0x102ed4[_0x780f('0x57')]=_0x102ed4['attributes'][_0x780f('0x69')]?_0x102ed4[_0x780f('0x57')]:_0x4b1e03[_0x780f('0x4c')];_0x102ed4[_0x780f('0x80')]=qs[_0x780f('0x5a')](_0x30a4dc[_0x780f('0x54')][_0x780f('0x5a')]);_0x102ed4[_0x780f('0x5b')]=qs[_0x780f('0x5c')](_[_0x780f('0x5d')](_0x30a4dc[_0x780f('0x54')],_0x4b1e03[_0x780f('0x5c')]));if(_0x30a4dc[_0x780f('0x54')]['filter']){_0x102ed4[_0x780f('0x5b')]=_[_0x780f('0x5e')](_0x102ed4[_0x780f('0x5b')],{'$or':_[_0x780f('0x4f')](_0x102ed4[_0x780f('0x57')],function(_0x31536b){var _0x3cb300={};_0x3cb300[_0x31536b]={'$like':'%'+_0x30a4dc[_0x780f('0x54')]['filter']+'%'};return _0x3cb300;})});}_0x102ed4=_[_0x780f('0x5e')]({},_0x102ed4,_0x30a4dc[_0x780f('0x61')]);return _0x460f1f[_0x780f('0x127')](_0x102ed4);}})['then'](function(_0x2e7fd6){if(_0x2e7fd6){_0x1e49ef=_0x2e7fd6[_0x780f('0x69')];if(!_0x30a4dc['query'][_0x780f('0x7f')](_0x780f('0x59'))){_0x102ed4['limit']=qs[_0x780f('0x30')](_0x30a4dc['query'][_0x780f('0x30')]);_0x102ed4['offset']=qs[_0x780f('0x2d')](_0x30a4dc[_0x780f('0x54')][_0x780f('0x2d')]);}return _0x460f1f['getApplications'](_0x102ed4);}})[_0x780f('0x1f')](function(_0x59f50d){if(_0x59f50d){return _0x59f50d?{'count':_0x1e49ef,'rows':_0x59f50d}:null;}})[_0x780f('0x1f')](respondWithResult(_0xafe98d,null))[_0x780f('0x28')](handleError(_0xafe98d,null));};exports[_0x780f('0x128')]=function(_0x5d1010,_0x8cd1f1){return db[_0x780f('0x129')][_0x780f('0x73')]({'where':{'id':_0x5d1010['params']['id']}})[_0x780f('0x1f')](handleEntityNotFound(_0x8cd1f1,null))[_0x780f('0x1f')](function(_0x5c0aa8){if(_0x5c0aa8){return _0x5c0aa8[_0x780f('0x128')](_0x5d1010[_0x780f('0x6b')][_0x780f('0x104')],_[_0x780f('0x105')](_0x5d1010[_0x780f('0x6b')],[_0x780f('0x104'),'id'])||{});}})[_0x780f('0x1f')](respondWithResult(_0x8cd1f1,null))[_0x780f('0x28')](handleError(_0x8cd1f1,null));};exports[_0x780f('0x10f')]=function(_0x34d674,_0x1a9ca5){var _0x3362e5={};var _0x3ceea3={};var _0x5b9010;var _0x452d41;return db[_0x780f('0x50')][_0x780f('0x7e')]({'where':{'id':_0x34d674['params']['id']}})['then'](handleEntityNotFound(_0x1a9ca5,null))[_0x780f('0x1f')](function(_0x3fa869){if(_0x3fa869){_0x5b9010=_0x3fa869;_0x3ceea3[_0x780f('0x4c')]=_[_0x780f('0x55')](db[_0x780f('0x12a')][_0x780f('0x51')]);_0x3ceea3[_0x780f('0x54')]=_['keys'](_0x34d674['query']);_0x3ceea3['filters']=_[_0x780f('0x56')](_0x3ceea3['model'],_0x3ceea3[_0x780f('0x54')]);_0x3362e5['attributes']=_['intersection'](_0x3ceea3[_0x780f('0x4c')],qs['fields'](_0x34d674['query'][_0x780f('0x58')]));_0x3362e5[_0x780f('0x57')]=_0x3362e5['attributes'][_0x780f('0x69')]?_0x3362e5[_0x780f('0x57')]:_0x3ceea3[_0x780f('0x4c')];_0x3362e5[_0x780f('0x80')]=qs[_0x780f('0x5a')](_0x34d674[_0x780f('0x54')][_0x780f('0x5a')]);_0x3362e5[_0x780f('0x5b')]=qs[_0x780f('0x5c')](_['pick'](_0x34d674[_0x780f('0x54')],_0x3ceea3['filters']));if(_0x34d674[_0x780f('0x54')]['filter']){_0x3362e5[_0x780f('0x5b')]=_[_0x780f('0x5e')](_0x3362e5[_0x780f('0x5b')],{'$or':_['map'](_0x3362e5[_0x780f('0x57')],function(_0x31388d){var _0x3f530d={};_0x3f530d[_0x31388d]={'$like':'%'+_0x34d674[_0x780f('0x54')]['filter']+'%'};return _0x3f530d;})});}_0x3362e5=_[_0x780f('0x5e')]({},_0x3362e5,_0x34d674[_0x780f('0x61')]);return _0x5b9010[_0x780f('0x10f')](_0x3362e5);}})[_0x780f('0x1f')](function(_0x197741){if(_0x197741){_0x452d41=_0x197741['length'];if(!_0x34d674[_0x780f('0x54')][_0x780f('0x7f')](_0x780f('0x59'))){_0x3362e5[_0x780f('0x30')]=qs[_0x780f('0x30')](_0x34d674['query'][_0x780f('0x30')]);_0x3362e5[_0x780f('0x2d')]=qs[_0x780f('0x2d')](_0x34d674[_0x780f('0x54')][_0x780f('0x2d')]);}return _0x5b9010[_0x780f('0x10f')](_0x3362e5);}})[_0x780f('0x1f')](function(_0x1ff1d7){if(_0x1ff1d7){return _0x1ff1d7?{'count':_0x452d41,'rows':_0x1ff1d7}:null;}})[_0x780f('0x1f')](respondWithResult(_0x1a9ca5,null))[_0x780f('0x28')](handleError(_0x1a9ca5,null));};exports['getFields']=function(_0x1cd10f,_0x48ce6c){var _0x26b7ed=_0x1cd10f[_0x780f('0x54')][_0x780f('0x12b')]==='false'?_0x780f('0x12c'):_0x780f('0x12d');return db[_0x780f('0x50')]['find']({'attributes':['id',_0x26b7ed],'where':{'id':_0x1cd10f[_0x780f('0x67')]['id']}})[_0x780f('0x1f')](handleEntityNotFound(_0x48ce6c,null))[_0x780f('0x1f')](function(_0x301277){if(_0x301277){var _0x403c44=_0x301277[_0x26b7ed];var _0x3d5358=_0x403c44&&_0x403c44[_0x780f('0x12e')]?_0x403c44[_0x780f('0x12e')]:[];_0x48ce6c['send']({'fromKey':_[_0x780f('0x96')](_0x403c44[_0x780f('0x12f')])?undefined:_0x403c44[_0x780f('0x12f')],'count':_0x3d5358['length'],'rows':_0x3d5358});}})[_0x780f('0x28')](handleError(_0x48ce6c,null));};exports[_0x780f('0x130')]=function(_0x4affd1,_0x255be3){var _0x30b928={'raw':![],'where':{}};var _0x163e87={};var _0xca5fb={'count':0x0,'rows':[]};return db[_0x780f('0x50')][_0x780f('0x7e')]({'where':{'id':_0x4affd1[_0x780f('0x67')]['id']}})[_0x780f('0x1f')](handleEntityNotFound(_0x255be3,null))['then'](function(_0x34413b){if(_0x34413b){_0x163e87['model']=_[_0x780f('0x55')](db[_0x780f('0x131')][_0x780f('0x51')]);_0x163e87['query']=_[_0x780f('0x55')](_0x4affd1[_0x780f('0x54')]);_0x163e87[_0x780f('0x5c')]=_[_0x780f('0x56')](_0x163e87[_0x780f('0x4c')],_0x163e87[_0x780f('0x54')]);_0x30b928[_0x780f('0x57')]=_[_0x780f('0x56')](_0x163e87[_0x780f('0x4c')],qs[_0x780f('0x58')](_0x4affd1[_0x780f('0x54')]['fields']));_0x30b928[_0x780f('0x57')]=_0x30b928['attributes'][_0x780f('0x69')]?_0x30b928[_0x780f('0x57')]:_0x163e87['model'];if(!_0x4affd1[_0x780f('0x54')][_0x780f('0x7f')]('nolimit')){_0x30b928[_0x780f('0x30')]=qs[_0x780f('0x30')](_0x4affd1[_0x780f('0x54')]['limit']);_0x30b928[_0x780f('0x2d')]=qs[_0x780f('0x2d')](_0x4affd1['query'][_0x780f('0x2d')]);}_0x30b928[_0x780f('0x80')]=qs[_0x780f('0x5a')](_0x4affd1[_0x780f('0x54')]['sort']);_0x30b928[_0x780f('0x5b')]=qs[_0x780f('0x5c')](_['pick'](_0x4affd1[_0x780f('0x54')],_0x163e87['filters']));_0x30b928[_0x780f('0x5b')][_0x780f('0x7b')]=_0x34413b['id'];if(_0x4affd1['query']['filter']){_0x30b928[_0x780f('0x5b')]=_['merge'](_0x30b928[_0x780f('0x5b')],{'$or':_[_0x780f('0x4f')](_0x30b928[_0x780f('0x57')],function(_0x1a33ad){var _0x29c16c={};_0x29c16c[_0x1a33ad]={'$like':'%'+_0x4affd1['query'][_0x780f('0x60')]+'%'};return _0x29c16c;})});}_0x30b928=_['merge']({},_0x30b928,_0x4affd1[_0x780f('0x61')]);return db['ChatOfflineMessage']['count']({'where':_0x30b928[_0x780f('0x5b')]})[_0x780f('0x1f')](function(_0x27dacd){_0xca5fb[_0x780f('0x2f')]=_0x27dacd;if(_0x4affd1[_0x780f('0x54')][_0x780f('0x62')]){_0x30b928[_0x780f('0x63')]=[{'all':!![]}];}else{_0x30b928[_0x780f('0x63')]=[{'model':db['CmContact'],'as':_0x780f('0x106'),'required':![]},{'model':db[_0x780f('0xf0')],'as':_0x780f('0x132'),'required':![]}];}return db[_0x780f('0x131')][_0x780f('0x64')](_0x30b928);})[_0x780f('0x1f')](function(_0x20136e){_0xca5fb[_0x780f('0x65')]=_0x20136e;return _0xca5fb;});}})['then'](respondWithFilteredResult(_0x255be3,_0x30b928))[_0x780f('0x28')](handleError(_0x255be3,null));};exports[_0x780f('0x133')]=function(_0x3948be,_0xf76d46){return db[_0x780f('0x50')]['find']({'where':{'id':_0x3948be[_0x780f('0x67')]['id']}})[_0x780f('0x1f')](handleEntityNotFound(_0xf76d46,null))[_0x780f('0x1f')](function(_0x38b5f6){if(_0x38b5f6){return _0x38b5f6['addAgents'](_0x3948be['body'][_0x780f('0x104')],_[_0x780f('0x105')](_0x3948be['body'],[_0x780f('0x104'),'id'])||{})[_0x780f('0xe1')](function(_0x16a4b8){for(var _0x582c45=0x0;_0x582c45<_0x3948be['body'][_0x780f('0x104')][_0x780f('0x69')];_0x582c45+=0x1){socket[_0x780f('0x134')](_0x780f('0x135'),{'UserId':Number(_0x3948be[_0x780f('0x6b')][_0x780f('0x104')][_0x582c45]),'ChatWebsiteId':Number(_0x3948be[_0x780f('0x67')]['id'])});}return _0x16a4b8;});}})[_0x780f('0x1f')](respondWithResult(_0xf76d46,null))[_0x780f('0x28')](handleError(_0xf76d46,null));};exports[_0x780f('0x136')]=function(_0x36770a,_0x3878cb){return db[_0x780f('0x50')]['find']({'where':{'id':_0x36770a[_0x780f('0x67')]['id']}})[_0x780f('0x1f')](handleEntityNotFound(_0x3878cb,null))[_0x780f('0x1f')](function(_0x53b5b4){if(_0x53b5b4){return _0x53b5b4[_0x780f('0x136')](_0x36770a[_0x780f('0x54')][_0x780f('0x104')])[_0x780f('0x1f')](function(){if(_[_0x780f('0x137')](_0x36770a[_0x780f('0x54')]['ids'])){for(var _0x1d57fb=0x0;_0x1d57fb<_0x36770a['query'][_0x780f('0x104')][_0x780f('0x69')];_0x1d57fb+=0x1){socket[_0x780f('0x134')](_0x780f('0x138'),{'UserId':Number(_0x36770a['query'][_0x780f('0x104')][_0x1d57fb]),'ChatWebsiteId':Number(_0x36770a[_0x780f('0x67')]['id'])});}}else{socket[_0x780f('0x134')](_0x780f('0x138'),{'UserId':Number(_0x36770a[_0x780f('0x54')][_0x780f('0x104')]),'ChatWebsiteId':Number(_0x36770a[_0x780f('0x67')]['id'])});}});}})[_0x780f('0x1f')](respondWithStatusCode(_0x3878cb,null))['catch'](handleError(_0x3878cb,null));};exports['getAgents']=function(_0x3de4ab,_0x49602c){var _0x30e854={};var _0x2fdd7e={};var _0x13bf0a;var _0x3ada1d;return db['ChatWebsite'][_0x780f('0x7e')]({'where':{'id':_0x3de4ab[_0x780f('0x67')]['id']}})['then'](handleEntityNotFound(_0x49602c,null))[_0x780f('0x1f')](function(_0x5b4dd7){if(_0x5b4dd7){_0x13bf0a=_0x5b4dd7;_0x2fdd7e['model']=_[_0x780f('0x55')](db[_0x780f('0xcd')][_0x780f('0x51')]);_0x2fdd7e[_0x780f('0x54')]=_[_0x780f('0x55')](_0x3de4ab[_0x780f('0x54')]);_0x2fdd7e[_0x780f('0x5c')]=_[_0x780f('0x56')](_0x2fdd7e[_0x780f('0x4c')],_0x2fdd7e['query']);_0x30e854[_0x780f('0x57')]=_[_0x780f('0x56')](_0x2fdd7e['model'],qs['fields'](_0x3de4ab[_0x780f('0x54')][_0x780f('0x58')]));_0x30e854[_0x780f('0x57')]=_0x30e854[_0x780f('0x57')][_0x780f('0x69')]?_0x30e854[_0x780f('0x57')]:_0x2fdd7e[_0x780f('0x4c')];_0x30e854[_0x780f('0x80')]=qs[_0x780f('0x5a')](_0x3de4ab[_0x780f('0x54')]['sort']);_0x30e854[_0x780f('0x5b')]=qs[_0x780f('0x5c')](_[_0x780f('0x5d')](_0x3de4ab[_0x780f('0x54')],_0x2fdd7e[_0x780f('0x5c')]));if(_0x3de4ab['query']['filter']){_0x30e854[_0x780f('0x5b')]=_[_0x780f('0x5e')](_0x30e854['where'],{'$or':_[_0x780f('0x4f')](_0x30e854[_0x780f('0x57')],function(_0x488213){var _0x261fa8={};_0x261fa8[_0x488213]={'$like':'%'+_0x3de4ab[_0x780f('0x54')][_0x780f('0x60')]+'%'};return _0x261fa8;})});}_0x30e854=_[_0x780f('0x5e')]({},_0x30e854,_0x3de4ab[_0x780f('0x61')]);return _0x13bf0a[_0x780f('0x139')](_0x30e854);}})['then'](function(_0x4c65e1){if(_0x4c65e1){_0x3ada1d=_0x4c65e1[_0x780f('0x69')];if(!_0x3de4ab[_0x780f('0x54')][_0x780f('0x7f')](_0x780f('0x59'))){_0x30e854[_0x780f('0x30')]=qs[_0x780f('0x30')](_0x3de4ab[_0x780f('0x54')][_0x780f('0x30')]);_0x30e854['offset']=qs[_0x780f('0x2d')](_0x3de4ab[_0x780f('0x54')]['offset']);}return _0x13bf0a[_0x780f('0x139')](_0x30e854);}})[_0x780f('0x1f')](function(_0x5eed1e){if(_0x5eed1e){return _0x5eed1e?{'count':_0x3ada1d,'rows':_0x5eed1e}:null;}})[_0x780f('0x1f')](respondWithResult(_0x49602c,null))[_0x780f('0x28')](handleError(_0x49602c,null));}; \ No newline at end of file +var _0xbfe5=['account','list','Contacts','contact','headers','threadId','closed','Writing\x20on\x20closed\x20interaction','externalUrl','ChatInteraction','ContactId','interaction','firstName','messageId','created','autoclose','close','unmanaged','*,*,*,*','ChatMessage','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','forcedOwnership','queueId','ChatQueue','Start','startRouting','EventManager','offline','files','Sequelize','ValidationError','no\x20available\x20attributes','difference','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline','send','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','spread','readFileSync','utf8','render','toPairs','offlineMessageBody','fromString','originalname','mimetype','attachments','offline-chat','openNewInteraction','transaction','Attachment','MailServerOut','Smtp','CloudProvider','forwardOffline','forwardOfflineAddress','getSmtpOptions','email','offlineMessageSubject','MailAccountId','mapValues','subjectOffline','NotifyMailAccount','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','getInteractions','Contact','Owner','fullname','Tag','Tags','color','tag','getSnippet','getProactiveActions','getLicense','custom','increment','chatLicenseExceeded','timezone','ifTime','server/files/chat/iframe.ejs','3.9.0','origin','http://localhost:9000','x-real-ip','connection','virtual','textColor','textButtonColor','color_button','backgroundColor','hideWhenOffline','IntervalId','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','stack','getApplications','addProactiveActions','ChatProactiveAction','online','offlineForm','onlineForm','items','getOfflineMessages','ChatOfflineMessage','Attachments','addAgents','userChatWebsite:save','removeAgents','isArray','emit','userChatWebsite:remove','getAgents','mustache','util','path','fs-extra','querystring','html-to-text','jayson/promise','../../components/parsers/qs','../../config/logger','api','../../config/environment','APIBadRequestError','../../errors/api','APINotFoundError','APIOutOfIntervalError','handleError','APIConflictError','./helpers/wildcard-expressions','url','URL','../../mysqldb','redis','defaults','socket.io-emitter','register','client','http','request','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','sendStatus','status','offset','undefined','limit','count','Content-Range','json','destroy','then','get','ChatWebsites','UserProfileResource','name','user-agent-parser','user-agent','getResult','customerIp','cf-connecting-ip','x-forwarded-for','split','lastName','x-real-port','referer','browser','format','%s\x20%s','unknown','version','device','%s\x20%s\x20%s','vendor','type','index','Pause','map','ChatWebsite','rawAttributes','fieldName','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','show','params','mandatoryDispositionPause','keys','find','create','body','address','forEach','trim','testWildcardValidity','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','addDisposition','ChatWebsiteId','Disposition','getDispositions','findOne','order','findAll','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','file','filename','addAvatar','agentAvatar','addCustomerAvatar','customerAvatar','systemAvatar','join','root','server/files/images/logos/default_logo.svg','sitepic','../../config/license/util','isNil','existsSync','server/files/images/logos/','download','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','Interval','resolve','chat','from','From\x20is\x20mandatory','mapKey','MapKey\x20is\x20mandatory','isEmpty','Body\x20is\x20mandatory','CmContact','No\x20available\x20attributes','createdAt','updatedAt','includes','CompanyId','ListId','Invalid\x20MapKey\x20parameter.\x20Allowed\x20values:\x20','CmList','List','ChatApplication','Applications','Intervals','interval','applications','priority','asc'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xbfe5,0x7f));var _0x5bfe=function(_0x413ebf,_0xd0a647){_0x413ebf=_0x413ebf-0x0;var _0x4a602d=_0xbfe5[_0x413ebf];return _0x4a602d;};'use strict';var Mustache=require(_0x5bfe('0x0'));var util=require(_0x5bfe('0x1'));var path=require(_0x5bfe('0x2'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5bfe('0x3'));var _=require('lodash');var querystring=require(_0x5bfe('0x4'));var htmlToText=require(_0x5bfe('0x5'));var Redis=require('ioredis');var jayson=require(_0x5bfe('0x6'));var qs=require(_0x5bfe('0x7'));var logger=require(_0x5bfe('0x8'))(_0x5bfe('0x9'));var config=require(_0x5bfe('0xa'));var APIBadRequestError=require('../../errors/api')[_0x5bfe('0xb')];var APINotFoundError=require(_0x5bfe('0xc'))[_0x5bfe('0xd')];var APIOutOfIntervalError=require('../../errors/api')[_0x5bfe('0xe')];var APIHandleError=require(_0x5bfe('0xc'))[_0x5bfe('0xf')];var APIConflictError=require(_0x5bfe('0xc'))[_0x5bfe('0x10')];var wildcardUtils=require(_0x5bfe('0x11'));var URL=require(_0x5bfe('0x12'))[_0x5bfe('0x13')];var db=require(_0x5bfe('0x14'))['db'];config[_0x5bfe('0x15')]=_[_0x5bfe('0x16')](config[_0x5bfe('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0x5bfe('0x17'))(new Redis(config[_0x5bfe('0x15')]));require('./chatWebsite.socket')[_0x5bfe('0x18')](socket);var client=jayson[_0x5bfe('0x19')][_0x5bfe('0x1a')]({'port':0x232c});var client9002=jayson[_0x5bfe('0x19')][_0x5bfe('0x1a')]({'port':0x232a});var client9003=jayson[_0x5bfe('0x19')][_0x5bfe('0x1a')]({'port':0x232b});var client9001=jayson['client']['http']({'port':0x2329});function respondWithRpcPromise(_0x211d30,_0x1833cd,_0x57a08b,_0x110b0c){return new Promise(function(_0x36f221,_0x44f874){var _0x3486b9=_0x110b0c||client;return _0x3486b9[_0x5bfe('0x1b')](_0x211d30,_0x57a08b)['then'](function(_0x159b8a){logger['info'](_0x5bfe('0x1c'),_0x1833cd,_0x5bfe('0x1d'));logger[_0x5bfe('0x1e')](_0x5bfe('0x1f'),_0x1833cd,_0x5bfe('0x1d'),JSON[_0x5bfe('0x20')](_0x159b8a));if(_0x159b8a['error']){if(_0x159b8a[_0x5bfe('0x21')]['code']===0x1f4){logger[_0x5bfe('0x21')](_0x5bfe('0x1c'),_0x1833cd,_0x159b8a[_0x5bfe('0x21')][_0x5bfe('0x22')]);return _0x44f874(_0x159b8a[_0x5bfe('0x21')][_0x5bfe('0x22')]);}logger[_0x5bfe('0x21')](_0x5bfe('0x1c'),_0x1833cd,_0x159b8a['error'][_0x5bfe('0x22')]);return _0x36f221(_0x159b8a[_0x5bfe('0x21')]['message']);}else{logger[_0x5bfe('0x23')]('ChatWebsite,\x20%s,\x20%s',_0x1833cd,'request\x20sent');_0x36f221(_0x159b8a[_0x5bfe('0x24')][_0x5bfe('0x22')]);}})[_0x5bfe('0x25')](function(_0x2baeb4){logger['error'](_0x5bfe('0x1c'),_0x1833cd,_0x2baeb4);_0x44f874(_0x2baeb4);});});}function respondWithStatusCode(_0x165f43,_0x5116ca){_0x5116ca=_0x5116ca||0xcc;return function(_0x409fd7){if(_0x409fd7){return _0x165f43[_0x5bfe('0x26')](_0x5116ca);}return _0x165f43[_0x5bfe('0x27')](_0x5116ca)['end']();};}function respondWithResult(_0x3781a9,_0xa53029){_0xa53029=_0xa53029||0xc8;return function(_0x3ec223){if(_0x3ec223){return _0x3781a9['status'](_0xa53029)['json'](_0x3ec223);}};}function respondWithFilteredResult(_0x4ed0ca,_0x58e10c){return function(_0x407e78){if(_0x407e78){var _0x427a0b=typeof _0x58e10c[_0x5bfe('0x28')]===_0x5bfe('0x29')&&typeof _0x58e10c[_0x5bfe('0x2a')]===_0x5bfe('0x29');var _0x200f90=_0x407e78[_0x5bfe('0x2b')];var _0x27824d=_0x427a0b?0x0:_0x58e10c['offset'];var _0x503d34=_0x427a0b?_0x407e78['count']:_0x58e10c[_0x5bfe('0x28')]+_0x58e10c[_0x5bfe('0x2a')];var _0x386f58;if(_0x503d34>=_0x200f90){_0x503d34=_0x200f90;_0x386f58=0xc8;}else{_0x386f58=0xce;}_0x4ed0ca['status'](_0x386f58);return _0x4ed0ca['set'](_0x5bfe('0x2c'),_0x27824d+'-'+_0x503d34+'/'+_0x200f90)[_0x5bfe('0x2d')](_0x407e78);}return null;};}function saveUpdates(_0x18771a){return function(_0x1a29e5){if(_0x1a29e5){return _0x1a29e5['update'](_0x18771a)['then'](function(_0x5ca11a){return _0x5ca11a;});}return null;};}function removeEntity(_0x545a18){return function(_0x45900c){if(_0x45900c){return _0x45900c[_0x5bfe('0x2e')]()[_0x5bfe('0x2f')](function(){var _0x24a30a=_0x45900c[_0x5bfe('0x30')]({'plain':!![]});var _0x431c6d=_0x5bfe('0x31');return db[_0x5bfe('0x32')][_0x5bfe('0x2e')]({'where':{'type':_0x431c6d,'resourceId':_0x24a30a['id']}})[_0x5bfe('0x2f')](function(){return _0x45900c;});})['then'](function(){_0x545a18[_0x5bfe('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x392fa9){return function(_0x4c3086){if(!_0x4c3086){_0x392fa9['sendStatus'](0x194);}return _0x4c3086;};}function handleError(_0x145a71,_0x3b1aa8){_0x3b1aa8=_0x3b1aa8||0x1f4;return function(_0x36666a){logger[_0x5bfe('0x21')](_0x36666a['stack']);if(_0x36666a['name']){delete _0x36666a[_0x5bfe('0x33')];}_0x145a71['status'](_0x3b1aa8)['send'](_0x36666a);};}function createInteractionObject(_0x4ef722,_0x5f3247,_0x262671,_0x41ab75){var _0x463302=require(_0x5bfe('0x34'));var _0x38f0c0=new _0x463302();var _0x1ec596=_0x38f0c0['setUA'](_0x262671[_0x5bfe('0x35')])[_0x5bfe('0x36')]();var _0x390073=_0x5f3247[_0x5bfe('0x37')];if(_0x262671[_0x5bfe('0x38')]){_0x390073=_0x262671['cf-connecting-ip'];}else if(_0x262671['x-forwarded-for']){_0x390073=_['first'](_0x262671[_0x5bfe('0x39')][_0x5bfe('0x3a')](','));}return{'ContactId':_0x41ab75['id'],'ChatWebsiteId':_0x4ef722,'from':(_0x41ab75['firstName']||'')+'\x20'+(_0x41ab75[_0x5bfe('0x3b')]||''),'customerIp':_0x390073,'customerPort':_0x262671[_0x5bfe('0x3c')]?_0x262671[_0x5bfe('0x3c')]:null,'referer':_0x5f3247[_0x5bfe('0x3d')],'browserName':_0x1ec596[_0x5bfe('0x3e')][_0x5bfe('0x33')]&&_0x1ec596['browser']['version']?util[_0x5bfe('0x3f')](_0x5bfe('0x40'),_0x1ec596['browser']['name'],_0x1ec596[_0x5bfe('0x3e')]['version']):_0x5bfe('0x41'),'browserVersion':_0x1ec596[_0x5bfe('0x3e')][_0x5bfe('0x42')]||_0x5bfe('0x41'),'osName':util[_0x5bfe('0x3f')](_0x5bfe('0x40'),_0x1ec596['os']['name'],_0x1ec596['os'][_0x5bfe('0x42')]),'osVersion':_0x1ec596['os']['version'],'deviceModel':_0x1ec596[_0x5bfe('0x43')]['model']&&_0x1ec596[_0x5bfe('0x43')]['vendor']?util[_0x5bfe('0x3f')](_0x5bfe('0x44'),_0x1ec596[_0x5bfe('0x43')]['model'],_0x1ec596[_0x5bfe('0x43')][_0x5bfe('0x45')],_0x1ec596[_0x5bfe('0x43')][_0x5bfe('0x46')]):null,'deviceVendor':_0x1ec596[_0x5bfe('0x43')][_0x5bfe('0x45')],'deviceType':_0x1ec596[_0x5bfe('0x43')][_0x5bfe('0x46')],'formData':JSON[_0x5bfe('0x20')](_0x5f3247)};}exports[_0x5bfe('0x47')]=function(_0x1ca9e1,_0xe81b4b){var _0xac66d3={'include':[{'model':db[_0x5bfe('0x48')],'as':'mandatoryDispositionPause'}]},_0xacf349={},_0x1d13b2={'count':0x0,'rows':[]};var _0x5b47c4=_[_0x5bfe('0x49')](db[_0x5bfe('0x4a')][_0x5bfe('0x4b')],function(_0x193a9e){return{'name':_0x193a9e[_0x5bfe('0x4c')],'type':_0x193a9e[_0x5bfe('0x46')]['key']};});_0xacf349['model']=_[_0x5bfe('0x49')](_0x5b47c4,_0x5bfe('0x33'));_0xacf349[_0x5bfe('0x4d')]=_['keys'](_0x1ca9e1[_0x5bfe('0x4d')]);_0xacf349[_0x5bfe('0x4e')]=_[_0x5bfe('0x4f')](_0xacf349[_0x5bfe('0x50')],_0xacf349['query']);_0xac66d3[_0x5bfe('0x51')]=_[_0x5bfe('0x4f')](_0xacf349[_0x5bfe('0x50')],qs[_0x5bfe('0x52')](_0x1ca9e1[_0x5bfe('0x4d')][_0x5bfe('0x52')]));_0xac66d3[_0x5bfe('0x51')]=_0xac66d3['attributes'][_0x5bfe('0x53')]?_0xac66d3['attributes']:_0xacf349[_0x5bfe('0x50')];if(!_0x1ca9e1[_0x5bfe('0x4d')][_0x5bfe('0x54')](_0x5bfe('0x55'))){_0xac66d3[_0x5bfe('0x2a')]=qs[_0x5bfe('0x2a')](_0x1ca9e1[_0x5bfe('0x4d')][_0x5bfe('0x2a')]);_0xac66d3[_0x5bfe('0x28')]=qs['offset'](_0x1ca9e1[_0x5bfe('0x4d')][_0x5bfe('0x28')]);}_0xac66d3['order']=qs[_0x5bfe('0x56')](_0x1ca9e1[_0x5bfe('0x4d')]['sort']);_0xac66d3[_0x5bfe('0x57')]=qs[_0x5bfe('0x4e')](_[_0x5bfe('0x58')](_0x1ca9e1[_0x5bfe('0x4d')],_0xacf349[_0x5bfe('0x4e')]),_0x5b47c4);if(_0x1ca9e1['query'][_0x5bfe('0x59')]){_0xac66d3[_0x5bfe('0x57')]=_[_0x5bfe('0x5a')](_0xac66d3[_0x5bfe('0x57')],{'$or':_[_0x5bfe('0x49')](_0x5b47c4,function(_0x595a7c){if(_0x595a7c[_0x5bfe('0x46')]!==_0x5bfe('0x5b')){var _0x107216={};_0x107216[_0x595a7c[_0x5bfe('0x33')]]={'$like':'%'+_0x1ca9e1[_0x5bfe('0x4d')][_0x5bfe('0x59')]+'%'};return _0x107216;}})});}_0xac66d3=_['merge']({},_0xac66d3,_0x1ca9e1[_0x5bfe('0x5c')]);var _0x153d8f={'where':_0xac66d3[_0x5bfe('0x57')]};return db[_0x5bfe('0x4a')][_0x5bfe('0x2b')](_0x153d8f)['then'](function(_0x74a713){_0x1d13b2[_0x5bfe('0x2b')]=_0x74a713;if(_0x1ca9e1[_0x5bfe('0x4d')][_0x5bfe('0x5d')]){_0xac66d3[_0x5bfe('0x5e')]=[{'all':!![]}];}return db['ChatWebsite']['findAll'](_0xac66d3);})['then'](function(_0x52c069){_0x1d13b2[_0x5bfe('0x5f')]=_0x52c069;return _0x1d13b2;})[_0x5bfe('0x2f')](respondWithFilteredResult(_0xe81b4b,_0xac66d3))[_0x5bfe('0x25')](handleError(_0xe81b4b,null));};exports[_0x5bfe('0x60')]=function(_0x263dd7,_0x142f6e){var _0x510e45={'raw':![],'where':{'id':_0x263dd7[_0x5bfe('0x61')]['id']},'include':[{'model':db[_0x5bfe('0x48')],'as':_0x5bfe('0x62')}]},_0x4398a6={};_0x4398a6[_0x5bfe('0x50')]=_[_0x5bfe('0x63')](db[_0x5bfe('0x4a')][_0x5bfe('0x4b')]);_0x4398a6[_0x5bfe('0x4d')]=_[_0x5bfe('0x63')](_0x263dd7[_0x5bfe('0x4d')]);_0x4398a6[_0x5bfe('0x4e')]=_[_0x5bfe('0x4f')](_0x4398a6[_0x5bfe('0x50')],_0x4398a6['query']);_0x510e45[_0x5bfe('0x51')]=_[_0x5bfe('0x4f')](_0x4398a6[_0x5bfe('0x50')],qs[_0x5bfe('0x52')](_0x263dd7[_0x5bfe('0x4d')]['fields']));_0x510e45['attributes']=_0x510e45[_0x5bfe('0x51')][_0x5bfe('0x53')]?_0x510e45['attributes']:_0x4398a6[_0x5bfe('0x50')];if(_0x263dd7[_0x5bfe('0x4d')][_0x5bfe('0x5d')]){_0x510e45[_0x5bfe('0x5e')]=[{'all':!![]}];}_0x510e45=_[_0x5bfe('0x5a')]({},_0x510e45,_0x263dd7[_0x5bfe('0x5c')]);return db[_0x5bfe('0x4a')][_0x5bfe('0x64')](_0x510e45)[_0x5bfe('0x2f')](handleEntityNotFound(_0x142f6e,null))[_0x5bfe('0x2f')](respondWithResult(_0x142f6e,null))[_0x5bfe('0x25')](handleError(_0x142f6e,null));};exports[_0x5bfe('0x65')]=function(_0x5c8930,_0x2bcf67){var _0x5d0040=null;_0x5c8930[_0x5bfe('0x66')][_0x5bfe('0x67')]['split'](',')[_0x5bfe('0x68')](_0x46a22f=>{if(_0x46a22f[_0x5bfe('0x69')]()!==''&&!wildcardUtils[_0x5bfe('0x6a')](_0x46a22f['trim']())){_0x5d0040=new APIBadRequestError('\x22'+_0x46a22f[_0x5bfe('0x69')]()+'\x22\x20is\x20not\x20a\x20valid\x20wildcard\x20expression');}});if(_0x5d0040){return handleError(_0x2bcf67,null)(_0x5d0040);}return db['ChatWebsite']['create'](_0x5c8930[_0x5bfe('0x66')],{})[_0x5bfe('0x2f')](function(_0x4c8c45){var _0xee86dd=_0x5c8930[_0x5bfe('0x6b')][_0x5bfe('0x30')]({'plain':!![]});if(!_0xee86dd)throw new Error(_0x5bfe('0x6c'));if(_0xee86dd['role']==='user'){var _0x23944d=_0x4c8c45[_0x5bfe('0x30')]({'plain':!![]});var _0x7d71f3=_0x5bfe('0x31');return db[_0x5bfe('0x6d')][_0x5bfe('0x64')]({'where':{'name':_0x7d71f3,'userProfileId':_0xee86dd[_0x5bfe('0x6e')]},'raw':!![]})['then'](function(_0x320642){if(_0x320642&&_0x320642[_0x5bfe('0x6f')]===0x0){return db[_0x5bfe('0x32')]['create']({'name':_0x23944d['name'],'resourceId':_0x23944d['id'],'type':_0x320642[_0x5bfe('0x33')],'sectionId':_0x320642['id']},{})['then'](function(){return _0x4c8c45;});}else{return _0x4c8c45;}})['catch'](function(_0x32de6f){logger[_0x5bfe('0x21')](_0x5bfe('0x70'),_0x32de6f);throw _0x32de6f;});}return _0x4c8c45;})[_0x5bfe('0x2f')](respondWithResult(_0x2bcf67,0xc9))[_0x5bfe('0x25')](handleError(_0x2bcf67,null));};exports[_0x5bfe('0x71')]=function(_0x10284a,_0x28bc2e){var _0x3dc252=null;_0x10284a[_0x5bfe('0x66')][_0x5bfe('0x67')][_0x5bfe('0x3a')](',')[_0x5bfe('0x68')](_0x434150=>{if(_0x434150['trim']()!==''&&!wildcardUtils['testWildcardValidity'](_0x434150[_0x5bfe('0x69')]())){_0x3dc252=new APIBadRequestError('\x22'+_0x434150['trim']()+'\x22\x20is\x20not\x20a\x20valid\x20wildcard\x20expression');}});if(_0x3dc252){return handleError(_0x28bc2e,null)(_0x3dc252);}if(_0x10284a[_0x5bfe('0x66')]['id']){delete _0x10284a[_0x5bfe('0x66')]['id'];}return db['ChatWebsite'][_0x5bfe('0x64')]({'where':{'id':_0x10284a[_0x5bfe('0x61')]['id']},'include':[{'model':db[_0x5bfe('0x48')],'as':_0x5bfe('0x62')}]})[_0x5bfe('0x2f')](handleEntityNotFound(_0x28bc2e,null))['then'](saveUpdates(_0x10284a['body'],null))[_0x5bfe('0x2f')](respondWithResult(_0x28bc2e,null))[_0x5bfe('0x25')](handleError(_0x28bc2e,null));};exports[_0x5bfe('0x2e')]=function(_0x1d014b,_0x4d8d39){return db[_0x5bfe('0x4a')][_0x5bfe('0x64')]({'where':{'id':_0x1d014b['params']['id']}})[_0x5bfe('0x2f')](handleEntityNotFound(_0x4d8d39,null))[_0x5bfe('0x2f')](removeEntity(_0x4d8d39,null))[_0x5bfe('0x25')](handleError(_0x4d8d39,null));};exports[_0x5bfe('0x72')]=function(_0x1af462,_0x55c4a6){return db[_0x5bfe('0x4a')]['describe']()[_0x5bfe('0x2f')](respondWithResult(_0x55c4a6,null))['catch'](handleError(_0x55c4a6,null));};exports[_0x5bfe('0x73')]=function(_0x2095b4,_0x370e14){if(_0x2095b4['body']['id']){delete _0x2095b4[_0x5bfe('0x66')]['id'];}return db[_0x5bfe('0x4a')][_0x5bfe('0x64')]({'where':{'id':_0x2095b4[_0x5bfe('0x61')]['id']}})[_0x5bfe('0x2f')](handleEntityNotFound(_0x370e14,null))[_0x5bfe('0x2f')](function(_0x155057){if(_0x155057){_0x2095b4[_0x5bfe('0x66')][_0x5bfe('0x74')]=_0x155057['id'];return db[_0x5bfe('0x75')][_0x5bfe('0x65')](_0x2095b4[_0x5bfe('0x66')]);}})['then'](respondWithResult(_0x370e14,null))[_0x5bfe('0x25')](handleError(_0x370e14,null));};exports[_0x5bfe('0x76')]=function(_0x3c5f88,_0x8763c4){var _0x361e1f={'raw':![],'where':{}};var _0x35a6a7={};var _0x18d258={'count':0x0,'rows':[]};return db[_0x5bfe('0x4a')][_0x5bfe('0x77')]({'where':{'id':_0x3c5f88[_0x5bfe('0x61')]['id']}})['then'](handleEntityNotFound(_0x8763c4,null))[_0x5bfe('0x2f')](function(_0x509a12){if(_0x509a12){_0x35a6a7[_0x5bfe('0x50')]=_[_0x5bfe('0x63')](db[_0x5bfe('0x75')][_0x5bfe('0x4b')]);_0x35a6a7[_0x5bfe('0x4d')]=_[_0x5bfe('0x63')](_0x3c5f88[_0x5bfe('0x4d')]);_0x35a6a7[_0x5bfe('0x4e')]=_[_0x5bfe('0x4f')](_0x35a6a7[_0x5bfe('0x50')],_0x35a6a7[_0x5bfe('0x4d')]);_0x361e1f[_0x5bfe('0x51')]=_[_0x5bfe('0x4f')](_0x35a6a7[_0x5bfe('0x50')],qs[_0x5bfe('0x52')](_0x3c5f88[_0x5bfe('0x4d')][_0x5bfe('0x52')]));_0x361e1f[_0x5bfe('0x51')]=_0x361e1f[_0x5bfe('0x51')][_0x5bfe('0x53')]?_0x361e1f['attributes']:_0x35a6a7[_0x5bfe('0x50')];if(!_0x3c5f88[_0x5bfe('0x4d')][_0x5bfe('0x54')]('nolimit')){_0x361e1f[_0x5bfe('0x2a')]=qs[_0x5bfe('0x2a')](_0x3c5f88['query']['limit']);_0x361e1f['offset']=qs[_0x5bfe('0x28')](_0x3c5f88[_0x5bfe('0x4d')][_0x5bfe('0x28')]);}_0x361e1f[_0x5bfe('0x78')]=qs[_0x5bfe('0x56')](_0x3c5f88[_0x5bfe('0x4d')][_0x5bfe('0x56')]);_0x361e1f['where']=qs[_0x5bfe('0x4e')](_['pick'](_0x3c5f88[_0x5bfe('0x4d')],_0x35a6a7[_0x5bfe('0x4e')]));_0x361e1f[_0x5bfe('0x57')][_0x5bfe('0x74')]=_0x509a12['id'];if(_0x3c5f88[_0x5bfe('0x4d')][_0x5bfe('0x59')]){_0x361e1f[_0x5bfe('0x57')]=_[_0x5bfe('0x5a')](_0x361e1f['where'],{'$or':_['map'](_0x361e1f[_0x5bfe('0x51')],function(_0x57a9b6){var _0x442b69={};_0x442b69[_0x57a9b6]={'$like':'%'+_0x3c5f88[_0x5bfe('0x4d')][_0x5bfe('0x59')]+'%'};return _0x442b69;})});}_0x361e1f=_[_0x5bfe('0x5a')]({},_0x361e1f,_0x3c5f88['options']);return db[_0x5bfe('0x75')][_0x5bfe('0x2b')]({'where':_0x361e1f[_0x5bfe('0x57')]})['then'](function(_0x2ac5a1){_0x18d258[_0x5bfe('0x2b')]=_0x2ac5a1;if(_0x3c5f88[_0x5bfe('0x4d')][_0x5bfe('0x5d')]){_0x361e1f[_0x5bfe('0x5e')]=[{'all':!![]}];}return db['Disposition'][_0x5bfe('0x79')](_0x361e1f);})[_0x5bfe('0x2f')](function(_0x1926c7){_0x18d258['rows']=_0x1926c7;return _0x18d258;});}})[_0x5bfe('0x2f')](respondWithFilteredResult(_0x8763c4,_0x361e1f))[_0x5bfe('0x25')](handleError(_0x8763c4,null));};exports[_0x5bfe('0x7a')]=function(_0x3affba,_0x2e84dd){return db[_0x5bfe('0x4a')][_0x5bfe('0x64')]({'where':{'id':_0x3affba[_0x5bfe('0x61')]['id']}})['then'](handleEntityNotFound(_0x2e84dd,null))[_0x5bfe('0x2f')](function(_0x17dffe){if(_0x17dffe){return _0x17dffe[_0x5bfe('0x7a')](_0x3affba['query'][_0x5bfe('0x7b')]);}})[_0x5bfe('0x2f')](respondWithStatusCode(_0x2e84dd,null))[_0x5bfe('0x25')](handleError(_0x2e84dd,null));};exports[_0x5bfe('0x7c')]=function(_0x51d5f5,_0x21af92){if(_0x51d5f5[_0x5bfe('0x66')]['id']){delete _0x51d5f5[_0x5bfe('0x66')]['id'];}return db[_0x5bfe('0x4a')][_0x5bfe('0x64')]({'where':{'id':_0x51d5f5['params']['id']}})['then'](handleEntityNotFound(_0x21af92,null))['then'](function(_0x2a12c4){if(_0x2a12c4){_0x51d5f5[_0x5bfe('0x66')][_0x5bfe('0x74')]=_0x2a12c4['id'];return db[_0x5bfe('0x7d')][_0x5bfe('0x65')](_0x51d5f5[_0x5bfe('0x66')]);}})[_0x5bfe('0x2f')](respondWithResult(_0x21af92,null))[_0x5bfe('0x25')](handleError(_0x21af92,null));};exports[_0x5bfe('0x7e')]=function(_0x68e16c,_0x3a965d){var _0x55cc02={'raw':![],'where':{}};var _0x3bc22a={};var _0x48c0fb={'count':0x0,'rows':[]};return db[_0x5bfe('0x4a')][_0x5bfe('0x77')]({'where':{'id':_0x68e16c[_0x5bfe('0x61')]['id']}})[_0x5bfe('0x2f')](handleEntityNotFound(_0x3a965d,null))['then'](function(_0x4a61db){if(_0x4a61db){_0x3bc22a[_0x5bfe('0x50')]=_[_0x5bfe('0x63')](db[_0x5bfe('0x7d')][_0x5bfe('0x4b')]);_0x3bc22a['query']=_['keys'](_0x68e16c[_0x5bfe('0x4d')]);_0x3bc22a[_0x5bfe('0x4e')]=_[_0x5bfe('0x4f')](_0x3bc22a[_0x5bfe('0x50')],_0x3bc22a[_0x5bfe('0x4d')]);_0x55cc02[_0x5bfe('0x51')]=_[_0x5bfe('0x4f')](_0x3bc22a[_0x5bfe('0x50')],qs[_0x5bfe('0x52')](_0x68e16c[_0x5bfe('0x4d')][_0x5bfe('0x52')]));_0x55cc02[_0x5bfe('0x51')]=_0x55cc02[_0x5bfe('0x51')][_0x5bfe('0x53')]?_0x55cc02['attributes']:_0x3bc22a[_0x5bfe('0x50')];if(!_0x68e16c[_0x5bfe('0x4d')][_0x5bfe('0x54')](_0x5bfe('0x55'))){_0x55cc02[_0x5bfe('0x2a')]=qs[_0x5bfe('0x2a')](_0x68e16c[_0x5bfe('0x4d')]['limit']);_0x55cc02['offset']=qs[_0x5bfe('0x28')](_0x68e16c[_0x5bfe('0x4d')][_0x5bfe('0x28')]);}_0x55cc02[_0x5bfe('0x78')]=qs[_0x5bfe('0x56')](_0x68e16c[_0x5bfe('0x4d')][_0x5bfe('0x56')]);_0x55cc02[_0x5bfe('0x57')]=qs[_0x5bfe('0x4e')](_[_0x5bfe('0x58')](_0x68e16c[_0x5bfe('0x4d')],_0x3bc22a[_0x5bfe('0x4e')]));_0x55cc02[_0x5bfe('0x57')]['ChatWebsiteId']=_0x4a61db['id'];if(_0x68e16c[_0x5bfe('0x4d')][_0x5bfe('0x59')]){_0x55cc02[_0x5bfe('0x57')]=_[_0x5bfe('0x5a')](_0x55cc02['where'],{'$or':_['map'](_0x55cc02[_0x5bfe('0x51')],function(_0x3afdcf){var _0x1618ac={};_0x1618ac[_0x3afdcf]={'$like':'%'+_0x68e16c[_0x5bfe('0x4d')]['filter']+'%'};return _0x1618ac;})});}_0x55cc02=_['merge']({},_0x55cc02,_0x68e16c[_0x5bfe('0x5c')]);return db['CannedAnswer']['count']({'where':_0x55cc02[_0x5bfe('0x57')]})[_0x5bfe('0x2f')](function(_0x21963a){_0x48c0fb[_0x5bfe('0x2b')]=_0x21963a;if(_0x68e16c['query'][_0x5bfe('0x5d')]){_0x55cc02[_0x5bfe('0x5e')]=[{'all':!![]}];}return db[_0x5bfe('0x7d')][_0x5bfe('0x79')](_0x55cc02);})[_0x5bfe('0x2f')](function(_0x17439e){_0x48c0fb[_0x5bfe('0x5f')]=_0x17439e;return _0x48c0fb;});}})[_0x5bfe('0x2f')](respondWithFilteredResult(_0x3a965d,_0x55cc02))[_0x5bfe('0x25')](handleError(_0x3a965d,null));};exports[_0x5bfe('0x7f')]=function(_0x108bf6,_0x5dbed9){return db[_0x5bfe('0x4a')][_0x5bfe('0x64')]({'where':{'id':_0x108bf6[_0x5bfe('0x61')]['id']}})[_0x5bfe('0x2f')](handleEntityNotFound(_0x5dbed9,null))[_0x5bfe('0x2f')](function(_0x5b2942){if(_0x5b2942){return _0x5b2942[_0x5bfe('0x7f')](_0x108bf6['query'][_0x5bfe('0x7b')]);}})[_0x5bfe('0x2f')](respondWithStatusCode(_0x5dbed9,null))[_0x5bfe('0x25')](handleError(_0x5dbed9,null));};exports['addLogo']=function(_0x4d38e9,_0x5736d7){_0x4d38e9[_0x5bfe('0x66')]['sitepic']=_0x4d38e9[_0x5bfe('0x80')][_0x5bfe('0x81')];return db[_0x5bfe('0x4a')][_0x5bfe('0x64')]({'where':{'id':_0x4d38e9[_0x5bfe('0x61')]['id']}})[_0x5bfe('0x2f')](handleEntityNotFound(_0x5736d7,null))[_0x5bfe('0x2f')](saveUpdates(_0x4d38e9[_0x5bfe('0x66')],null))[_0x5bfe('0x2f')](respondWithResult(_0x5736d7,null))['catch'](handleError(_0x5736d7,null));};exports[_0x5bfe('0x82')]=function(_0x3d978b,_0x207273){_0x3d978b[_0x5bfe('0x66')][_0x5bfe('0x83')]=_0x3d978b[_0x5bfe('0x80')][_0x5bfe('0x81')];return db[_0x5bfe('0x4a')]['find']({'where':{'id':_0x3d978b['params']['id']}})[_0x5bfe('0x2f')](handleEntityNotFound(_0x207273,null))[_0x5bfe('0x2f')](saveUpdates(_0x3d978b[_0x5bfe('0x66')],null))['then'](respondWithResult(_0x207273,null))[_0x5bfe('0x25')](handleError(_0x207273,null));};exports[_0x5bfe('0x84')]=function(_0x4a3a00,_0x3ce6bf){_0x4a3a00[_0x5bfe('0x66')][_0x5bfe('0x85')]=_0x4a3a00[_0x5bfe('0x80')][_0x5bfe('0x81')];return db['ChatWebsite'][_0x5bfe('0x64')]({'where':{'id':_0x4a3a00['params']['id']}})[_0x5bfe('0x2f')](handleEntityNotFound(_0x3ce6bf,null))['then'](saveUpdates(_0x4a3a00[_0x5bfe('0x66')],null))[_0x5bfe('0x2f')](respondWithResult(_0x3ce6bf,null))[_0x5bfe('0x25')](handleError(_0x3ce6bf,null));};exports['addSystemAvatar']=function(_0x102aed,_0x356b90){_0x102aed[_0x5bfe('0x66')][_0x5bfe('0x86')]=_0x102aed[_0x5bfe('0x80')][_0x5bfe('0x81')];return db[_0x5bfe('0x4a')]['find']({'where':{'id':_0x102aed['params']['id']}})[_0x5bfe('0x2f')](handleEntityNotFound(_0x356b90,null))[_0x5bfe('0x2f')](saveUpdates(_0x102aed[_0x5bfe('0x66')],null))[_0x5bfe('0x2f')](respondWithResult(_0x356b90,null))['catch'](handleError(_0x356b90,null));};exports['getLogo']=function(_0x7ccf95,_0x38cf19){var _0x1ad3bd=path[_0x5bfe('0x87')](config[_0x5bfe('0x88')],_0x5bfe('0x89'));var _0x1c244b={'where':{'id':_0x7ccf95['params']['id']},'attributes':['id',_0x5bfe('0x8a')],'raw':!![]};var _0x1bfca9=![];return require(_0x5bfe('0x8b'))['getLicense']()[_0x5bfe('0x2f')](function(_0x59f15){if(_0x59f15){_0x1bfca9=_0x59f15['custom'];}})['then'](function(){return db[_0x5bfe('0x4a')][_0x5bfe('0x64')](_0x1c244b);})[_0x5bfe('0x2f')](handleEntityNotFound(_0x38cf19,null))[_0x5bfe('0x2f')](function(_0x36cf06){if(_0x36cf06){if(!_[_0x5bfe('0x8c')](_0x36cf06[_0x5bfe('0x8a')])){if(fs[_0x5bfe('0x8d')](path['join'](config[_0x5bfe('0x88')],_0x5bfe('0x8e'),_0x36cf06[_0x5bfe('0x8a')]))&&_0x1bfca9){_0x1ad3bd=path[_0x5bfe('0x87')](config[_0x5bfe('0x88')],'server/files/images/logos/',_0x36cf06[_0x5bfe('0x8a')]);}}return _0x38cf19[_0x5bfe('0x8f')](_0x1ad3bd);}})[_0x5bfe('0x25')](handleError(_0x38cf19,null));};exports['getAvatar']=function(_0x3b6e7e,_0x3aeb36){var _0xb41be9=path[_0x5bfe('0x87')](config[_0x5bfe('0x88')],_0x5bfe('0x90'));var _0x2c13c0={'where':{'id':_0x3b6e7e[_0x5bfe('0x61')]['id']},'attributes':['id',_0x5bfe('0x83')],'raw':!![]};return db['ChatWebsite'][_0x5bfe('0x64')](_0x2c13c0)[_0x5bfe('0x2f')](handleEntityNotFound(_0x3aeb36,null))[_0x5bfe('0x2f')](function(_0xf50eee){if(_0xf50eee){if(!_[_0x5bfe('0x8c')](_0xf50eee[_0x5bfe('0x83')])){if(fs[_0x5bfe('0x8d')](path[_0x5bfe('0x87')](config['root'],_0x5bfe('0x91'),_0xf50eee[_0x5bfe('0x83')]))){_0xb41be9=path[_0x5bfe('0x87')](config['root'],_0x5bfe('0x91'),_0xf50eee[_0x5bfe('0x83')]);}}return _0x3aeb36[_0x5bfe('0x8f')](_0xb41be9);}})[_0x5bfe('0x25')](handleError(_0x3aeb36,null));};exports[_0x5bfe('0x92')]=function(_0x532626,_0x175d48){var _0x4156b7=path[_0x5bfe('0x87')](config[_0x5bfe('0x88')],_0x5bfe('0x93'));var _0x25c6b2={'where':{'id':_0x532626[_0x5bfe('0x61')]['id']},'attributes':['id',_0x5bfe('0x85'),_0x5bfe('0x94')],'raw':!![]};return db[_0x5bfe('0x4a')][_0x5bfe('0x64')](_0x25c6b2)[_0x5bfe('0x2f')](handleEntityNotFound(_0x175d48,null))[_0x5bfe('0x2f')](function(_0x2af5ae){if(_0x2af5ae){if(!_[_0x5bfe('0x8c')](_0x2af5ae['customerAvatar'])){if(fs[_0x5bfe('0x8d')](path[_0x5bfe('0x87')](config[_0x5bfe('0x88')],_0x5bfe('0x91'),_0x2af5ae['customerAvatar']))&&_0x2af5ae[_0x5bfe('0x94')]){_0x4156b7=path[_0x5bfe('0x87')](config[_0x5bfe('0x88')],_0x5bfe('0x91'),_0x2af5ae['customerAvatar']);}}return _0x175d48[_0x5bfe('0x8f')](_0x4156b7);}})['catch'](handleError(_0x175d48,null));};exports[_0x5bfe('0x95')]=function(_0x1a6f8e,_0x306437){var _0x1f14e0=path[_0x5bfe('0x87')](config[_0x5bfe('0x88')],_0x5bfe('0x96'));var _0x188207={'where':{'id':_0x1a6f8e[_0x5bfe('0x61')]['id']},'attributes':['id','systemAvatar'],'raw':!![]};return db[_0x5bfe('0x4a')][_0x5bfe('0x64')](_0x188207)[_0x5bfe('0x2f')](handleEntityNotFound(_0x306437,null))['then'](function(_0x54556e){if(_0x54556e){if(!_['isNil'](_0x54556e[_0x5bfe('0x86')])){if(fs[_0x5bfe('0x8d')](path[_0x5bfe('0x87')](config['root'],'server/files/images/avatars/',_0x54556e['systemAvatar']))){_0x1f14e0=path[_0x5bfe('0x87')](config[_0x5bfe('0x88')],_0x5bfe('0x91'),_0x54556e[_0x5bfe('0x86')]);}}return _0x306437[_0x5bfe('0x8f')](_0x1f14e0);}})[_0x5bfe('0x25')](handleError(_0x306437,null));};function checkWebsiteInterval(_0x556516){var _0x33ce45=_0x556516[_0x5bfe('0x97')];if(!_0x33ce45){return Promise[_0x5bfe('0x98')](_0x556516);}var _0x2ce920=_0x556516['timezone']||undefined;return _0x33ce45['ifTime'](_0x2ce920)['then'](function(_0x43026c){if(!_0x43026c){throw new APIOutOfIntervalError();}return _0x556516;});}exports['notify']=function(_0x314177,_0x58adcd){var _0x58c74f={'body':_0x314177[_0x5bfe('0x66')],'channel':_0x5bfe('0x99')};var _0x11fc3a=[];var _0x37b0cc=[];var _0x48e37e={};var _0x10755c=![];if(_0x314177['body']['id']){delete _0x314177[_0x5bfe('0x66')]['id'];}if(_[_0x5bfe('0x8c')](_0x314177['body'][_0x5bfe('0x9a')])){throw new APIBadRequestError(_0x5bfe('0x9b'));}if(_['isNil'](_0x314177[_0x5bfe('0x66')][_0x5bfe('0x9c')])){throw new APIBadRequestError(_0x5bfe('0x9d'));}if(_[_0x5bfe('0x9e')](_0x314177['body']['body'])){throw new APIBadRequestError(_0x5bfe('0x9f'));}var _0xc8f92a=_0x314177[_0x5bfe('0x66')][_0x5bfe('0x37')]&&_0x314177[_0x5bfe('0x66')]['referer'];return db[_0x5bfe('0xa0')][_0x5bfe('0x72')]()[_0x5bfe('0x2f')](function(_0x3e14f7){if(!_0x3e14f7){throw new Error(_0x5bfe('0xa1'));}_0x11fc3a=Object['keys'](_0x3e14f7)[_0x5bfe('0x59')](function(_0x50b3e4){return![_0x5bfe('0xa2'),_0x5bfe('0xa3')][_0x5bfe('0xa4')](_0x50b3e4);});_0x37b0cc=Object[_0x5bfe('0x63')](_0x3e14f7)[_0x5bfe('0x59')](function(_0x5b3a02){return!['createdAt',_0x5bfe('0xa3'),_0x5bfe('0xa5'),_0x5bfe('0xa6')]['includes'](_0x5b3a02);});if(!_[_0x5bfe('0xa4')](_0x37b0cc,_0x314177[_0x5bfe('0x66')]['mapKey'])){throw new APIBadRequestError(_0x5bfe('0xa7')+_0x37b0cc[_0x5bfe('0x87')](',\x20'));}_0x48e37e[_0x314177['body']['mapKey']]=_0x314177[_0x5bfe('0x66')][_0x5bfe('0x9a')];})[_0x5bfe('0x2f')](function(){return db[_0x5bfe('0x4a')]['find']({'where':{'id':_0x314177['params']['id']},'include':[{'model':db[_0x5bfe('0xa8')],'as':_0x5bfe('0xa9'),'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x48e37e,'limit':0x1,'order':[[_0x5bfe('0xa3'),'DESC']]}]},{'model':db[_0x5bfe('0xaa')],'as':_0x5bfe('0xab')},{'model':db[_0x5bfe('0x97')],'as':'Interval','include':[{'model':db[_0x5bfe('0x97')],'as':_0x5bfe('0xac'),'attributes':['id',_0x5bfe('0xad')],'raw':!![]}]}]});})[_0x5bfe('0x2f')](function(_0x2d7fdf){if(!_0x2d7fdf){throw new APINotFoundError(util[_0x5bfe('0x3f')]('Chat\x20Website\x20with\x20id\x20%s\x20not\x20found',_0x314177[_0x5bfe('0x61')]['id']));}if(_0xc8f92a){return checkWebsiteInterval(_0x2d7fdf);}return _0x2d7fdf;})[_0x5bfe('0x2f')](function(_0x28571d){_0x58c74f['account']=_0x28571d;_0x58c74f[_0x5bfe('0xae')]=_['orderBy'](_0x28571d['Applications'],[_0x5bfe('0xaf')],[_0x5bfe('0xb0')]);if(_0x58c74f[_0x5bfe('0xb1')][_0x5bfe('0xab')]){delete _0x58c74f['account'][_0x5bfe('0xab')];}_0x58c74f[_0x5bfe('0xb2')]=_0x28571d['List']||{'id':_0x28571d[_0x5bfe('0xa6')]};if(_0x58c74f[_0x5bfe('0xb2')]&&_0x58c74f[_0x5bfe('0xb2')][_0x5bfe('0xb3')][_0x5bfe('0x53')]){return _0x58c74f[_0x5bfe('0xb2')]['Contacts'][0x0];}var _0x3dfbaa=_['defaults'](_0x314177['body'],{'firstName':_0x314177[_0x5bfe('0x66')][_0x5bfe('0x9a')],'ListId':_0x28571d[_0x5bfe('0xa6')]});_0x3dfbaa[_0x314177[_0x5bfe('0x66')][_0x5bfe('0x9c')]]=_0x314177[_0x5bfe('0x66')][_0x5bfe('0x9a')];return db[_0x5bfe('0xa0')][_0x5bfe('0x65')](_0x3dfbaa,{'fields':_0x11fc3a,'raw':!![]});})[_0x5bfe('0x2f')](function(_0x5727a4){_0x58c74f[_0x5bfe('0xb4')]=_0x5727a4;var _0x2a2369=createInteractionObject(_0x314177['params']['id'],_0x314177[_0x5bfe('0x66')],_0x314177[_0x5bfe('0xb5')],_0x5727a4);var _0x28255e={'ChatWebsiteId':_0x314177[_0x5bfe('0x61')]['id']};if(_0x314177[_0x5bfe('0x66')][_0x5bfe('0xb6')]){_0x28255e['threadId']=_0x314177[_0x5bfe('0x66')]['threadId'];_0x28255e[_0x5bfe('0xb7')]=![];return db['ChatInteraction']['find']({'where':_0x28255e})[_0x5bfe('0x2f')](function(_0x1427f4){var _0x3fa232=_0x314177[_0x5bfe('0x66')][_0x5bfe('0x37')]&&_0x314177[_0x5bfe('0x66')][_0x5bfe('0x3d')];if(_0x1427f4){_0x10755c=!![];return _0x1427f4;}else if(!_0x3fa232&&_0x1427f4&&_0x1427f4[_0x5bfe('0xb7')]){throw new APIConflictError(_0x5bfe('0xb8'));}_0x2a2369[_0x5bfe('0xb6')]=_0x314177[_0x5bfe('0x66')][_0x5bfe('0xb6')];_0x2a2369[_0x5bfe('0xb9')]=_0x314177['body'][_0x5bfe('0xb9')];return db[_0x5bfe('0xba')]['create'](_0x2a2369);});}_0x28255e[_0x5bfe('0xbb')]=_0x5727a4['id'];if(_0x314177[_0x5bfe('0x66')]['interaction']&&_0x314177['body']['interaction']['id']){_0x28255e['id']=_0x314177['body'][_0x5bfe('0xbc')]['id'];return db[_0x5bfe('0xba')][_0x5bfe('0x64')]({'where':_0x28255e})['then'](function(_0x377667){var _0xca76eb=_0x314177['body'][_0x5bfe('0x37')]&&_0x314177['body']['referer'];if(!_0xca76eb&&_0x377667&&_0x377667[_0x5bfe('0xb7')]){throw new APIConflictError(_0x5bfe('0xb8'));}else if(_0x377667){_0x10755c=!![];return _0x377667;}else{return db[_0x5bfe('0xba')][_0x5bfe('0x65')](_0x2a2369);}});}return db['ChatInteraction'][_0x5bfe('0x65')](_0x2a2369);})[_0x5bfe('0x2f')](function(_0x5866c7){if(!_0x10755c){return _0x5866c7;}var _0x5135c2={'from':(_0x58c74f[_0x5bfe('0xb4')][_0x5bfe('0xbd')]||'')+'\x20'+(_0x58c74f[_0x5bfe('0xb4')][_0x5bfe('0x3b')]||'')};if(_0x314177[_0x5bfe('0x66')][_0x5bfe('0xb6')]&&_0x314177[_0x5bfe('0x66')]['messageId']&&_0x314177[_0x5bfe('0x66')][_0x5bfe('0xb6')]!=_0x314177[_0x5bfe('0x66')][_0x5bfe('0xbe')]){_0x5135c2[_0x5bfe('0xb6')]=_0x314177[_0x5bfe('0x66')][_0x5bfe('0xbe')];}return _0x5866c7[_0x5bfe('0x71')](_0x5135c2);})[_0x5bfe('0x2f')](function(_0x8e0bdf){_0x58c74f[_0x5bfe('0xbc')]=_0x8e0bdf[_0x5bfe('0x30')]({'plain':!![]});_0x58c74f[_0x5bfe('0xbc')][_0x5bfe('0xbf')]=!_0x10755c;if(_0x58c74f['interaction'][_0x5bfe('0xbf')]){if(_0x58c74f[_0x5bfe('0xb1')][_0x5bfe('0xc0')]){_0x58c74f[_0x5bfe('0xae')]['push']({'id':0x0,'priority':_0x58c74f[_0x5bfe('0xae')][_0x5bfe('0x53')]+0x1,'app':_0x5bfe('0xc1'),'appdata':_0x5bfe('0xc2'),'interval':_0x5bfe('0xc3')});}}return db[_0x5bfe('0xc4')][_0x5bfe('0x65')]({'body':_0x314177[_0x5bfe('0x66')][_0x5bfe('0x66')],'ChatWebsiteId':_0x314177[_0x5bfe('0x61')]['id'],'ChatInteractionId':_0x8e0bdf['id'],'direction':'in','ContactId':_0x58c74f[_0x5bfe('0xb4')]['id'],'AttachmentId':_0x314177[_0x5bfe('0x66')][_0x5bfe('0xc5')]});})[_0x5bfe('0x2f')](function(_0x143c39){_0x58c74f[_0x5bfe('0x22')]=_0x143c39;if(!_0x58c74f[_0x5bfe('0xbc')][_0x5bfe('0xc6')]){return;}return db[_0x5bfe('0xc7')][_0x5bfe('0x64')]({'attributes':['id',_0x5bfe('0x33')],'where':{'id':_0x58c74f['interaction']['UserId']}});})[_0x5bfe('0x2f')](function(_0xeb5f27){if(_0xeb5f27){_0x58c74f['applications'][_0x5bfe('0xc8')]({'id':0x0,'priority':0x0,'app':_0x5bfe('0xc9'),'appdata':_0xeb5f27[_0x5bfe('0x33')]+','+(_0x58c74f[_0x5bfe('0xb1')][_0x5bfe('0xca')]||0xa),'interval':'*,*,*,*'});_0x58c74f[_0x5bfe('0xcb')]=!![];}if(!_0x58c74f['interaction'][_0x5bfe('0xcc')]){return;}return db[_0x5bfe('0xcd')]['find']({'attributes':['id',_0x5bfe('0x33')],'where':{'id':_0x58c74f[_0x5bfe('0xbc')][_0x5bfe('0xcc')]}});})['then'](function(_0x565dff){if(_0x565dff){_0x58c74f[_0x5bfe('0xae')][_0x5bfe('0xc8')]({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x565dff['name']+','+(_0x58c74f[_0x5bfe('0xb1')]['waitForTheAssignedQueue']||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x5bfe('0xce'),_0x5bfe('0xcf'),_0x58c74f);})[_0x5bfe('0x2f')](function(_0x123e29){respondWithRpcPromise(_0x5bfe('0xd0'),_0x5bfe('0xd0'),{'event':'notify','message':_0x123e29},client9002);return _0x123e29;})[_0x5bfe('0x2f')](respondWithResult(_0x58adcd,null))[_0x5bfe('0x25')](APIHandleError(_0x58adcd));};exports[_0x5bfe('0xd1')]=function(_0x3518d1,_0x2d4cc0){var _0x3b6304,_0x19c63b,_0x2545b7;var _0x207024=[];var _0x395a18={};var _0x43dd8f=_0x3518d1[_0x5bfe('0xd2')]||[];var _0x3ba9a0=[];var _0x2273c7;return db['CmContact'][_0x5bfe('0x72')]()[_0x5bfe('0x2f')](function(_0x169570){if(!_0x169570){throw new db[(_0x5bfe('0xd3'))][(_0x5bfe('0xd4'))](_0x5bfe('0xd5'));}_0x207024=_[_0x5bfe('0xd6')](_[_0x5bfe('0x63')](_0x169570),[_0x5bfe('0xa2'),'updatedAt',_0x5bfe('0xa5'),_0x5bfe('0xa6')]);if(_0x3518d1['body']['id']){delete _0x3518d1['body']['id'];}if(_['isNil'](_0x3518d1[_0x5bfe('0x66')][_0x5bfe('0x9a')])){throw _0x2d4cc0[_0x5bfe('0x27')](0x1f4)['send'](new db[(_0x5bfe('0xd3'))]['ValidationError']('from\x20is\x20mandatory'));}if(_['isNil'](_0x3518d1[_0x5bfe('0x66')]['body'])||_0x3518d1[_0x5bfe('0x66')][_0x5bfe('0x66')]===''){throw _0x2d4cc0[_0x5bfe('0x27')](0x1f4)['send'](new db[(_0x5bfe('0xd3'))]['ValidationError'](_0x5bfe('0xd7')));}if(_[_0x5bfe('0x8c')](_0x3518d1[_0x5bfe('0x66')]['mapKeyOffline'])){throw _0x2d4cc0[_0x5bfe('0x27')](0x1f4)['send'](new db[(_0x5bfe('0xd3'))]['ValidationError'](_0x5bfe('0xd8')+_0x207024));}if(!_['includes'](_0x207024,_0x3518d1['body'][_0x5bfe('0xd9')])){throw _0x2d4cc0[_0x5bfe('0x27')](0x1f4)[_0x5bfe('0xda')](new db[(_0x5bfe('0xd3'))][(_0x5bfe('0xd4'))](_0x5bfe('0xdb')+_0x207024));}_0x395a18[_0x3518d1[_0x5bfe('0x66')][_0x5bfe('0xd9')]]=_0x3518d1[_0x5bfe('0x66')][_0x5bfe('0x9a')];})[_0x5bfe('0x2f')](function(){return db['ChatWebsite']['find']({'where':{'id':_0x3518d1[_0x5bfe('0x61')]['id']},'include':[{'model':db['CmList'],'as':'List'},{'model':db[_0x5bfe('0xdc')],'as':_0x5bfe('0xdc')}]});})[_0x5bfe('0x2f')](handleEntityNotFound(_0x2d4cc0,null))['then'](function(_0x270a50){if(_0x270a50&&_0x270a50[_0x5bfe('0xa9')]){_0x19c63b=_0x270a50;var _0x544160=_[_0x5bfe('0x16')](_0x3518d1['body'],{'firstName':_0x3518d1['body']['from'],'phone':_0x3518d1['body'][_0x5bfe('0x9a')],'ListId':_0x270a50[_0x5bfe('0xa6')]});_0x544160[_0x3518d1['body'][_0x5bfe('0xd9')]]=_0x3518d1[_0x5bfe('0x66')][_0x5bfe('0x9a')];return db[_0x5bfe('0xa0')][_0x5bfe('0xdd')]({'where':_0x395a18,'defaults':_0x544160});}})[_0x5bfe('0xde')](function(_0x26b881){if(_0x26b881){_0x2545b7=_0x26b881;var _0x2f752d=fs[_0x5bfe('0xdf')](path[_0x5bfe('0x87')](config[_0x5bfe('0x88')],'server/files/templates/chatOfflineMessage.ejs'),_0x5bfe('0xe0'));var _0x2722b4=ejs[_0x5bfe('0xe1')](_0x2f752d,{'body':_[_0x5bfe('0xe2')](_0x3518d1[_0x5bfe('0x66')][_0x5bfe('0x66')]),'bodyTitle':_0x19c63b[_0x5bfe('0xe3')]});return db['ChatOfflineMessage'][_0x5bfe('0x65')]({'body':_0x2722b4,'plainBody':htmlToText[_0x5bfe('0xe4')](_0x2722b4),'ContactId':_0x26b881['id'],'ChatWebsiteId':_0x19c63b['id']});}})[_0x5bfe('0x2f')](function(_0x42ef0d){_0x2273c7=_0x42ef0d;if(_0x43dd8f[_0x5bfe('0x53')]){var _0x2baed1=_0x43dd8f[_0x5bfe('0x49')](function(_0xd21125){return{'name':_0xd21125[_0x5bfe('0xe5')],'basename':_0xd21125[_0x5bfe('0x81')],'type':_0xd21125[_0x5bfe('0xe6')],'ChatOfflineMessageId':_0x42ef0d['id']};});_0x3ba9a0=_0x2baed1[_0x5bfe('0x49')](_0xd465b2=>{var _0x2f8929={'filename':_0xd465b2['name'],'path':path[_0x5bfe('0x87')](config[_0x5bfe('0x88')],'server',_0x5bfe('0xd2'),_0x5bfe('0xe7'),_0x5bfe('0xe8'),_0xd465b2['basename'])};return _0x2f8929;});if(!_0x19c63b[_0x5bfe('0xe9')]){return db['sequelize'][_0x5bfe('0xea')](function(_0x5ec0ad){return db[_0x5bfe('0xeb')]['bulkCreate'](_0x2baed1,{'transaction':_0x5ec0ad});});}}})['then'](function(){if(_0x2273c7){_0x3b6304=_0x2273c7;return db[_0x5bfe('0xdc')][_0x5bfe('0x77')]({'where':{'service':!![]},'include':[{'model':db[_0x5bfe('0xec')],'as':_0x5bfe('0xed'),'raw':!![],'include':[{'model':db[_0x5bfe('0xee')],'as':'CloudProvider','raw':!![]}]}]});}})[_0x5bfe('0x2f')](function(_0x1a3668){if(_0x1a3668&&_0x1a3668['Smtp']&&_0x19c63b[_0x5bfe('0xef')]&&_0x19c63b[_0x5bfe('0xf0')]){var _0x333d9a=_0x1a3668[_0x5bfe('0xf1')]();return respondWithRpcPromise('SendMail','sendMail',{'account':_0x333d9a,'message':{'from':util[_0x5bfe('0x3f')]('\x22%s\x22\x20<%s>',_0x1a3668[_0x5bfe('0x33')],_0x1a3668[_0x5bfe('0xf2')]||_0x1a3668['Smtp'][_0x5bfe('0x6b')]),'to':_0x19c63b[_0x5bfe('0xf0')],'subject':_0x19c63b[_0x5bfe('0xf3')],'html':_0x3b6304[_0x5bfe('0x66')],'attachments':_0x3ba9a0}},client9003)[_0x5bfe('0x2f')](function(){return _0x3b6304;})[_0x5bfe('0x25')](function(_0x2732c4){logger['error'](_0x2732c4);});}})[_0x5bfe('0x2f')](function(){if(_0x19c63b&&_0x19c63b[_0x5bfe('0xe9')]&&_0x19c63b[_0x5bfe('0xf4')]){var _0x2e7b7d=[];if(_0x43dd8f[_0x5bfe('0x53')]){_0x2e7b7d=_0x43dd8f[_0x5bfe('0x49')](function(_0x36e21e){return{'name':_0x36e21e[_0x5bfe('0xe5')],'basename':_0x36e21e['filename'],'type':_0x36e21e[_0x5bfe('0xe6')],'ChatOfflineMessageId':_0x2273c7['id']};});}var _0x20834a;if(!_[_0x5bfe('0x8c')](_0x19c63b['subjectOffline'])){var _0xef82b2=_[_0x5bfe('0x49')](_0x3518d1[_0x5bfe('0x66')],function(_0x270c34){return _0x270c34;});var _0x4a1b9b=_['toPairsIn'](_0xef82b2)[0x0];var _0x5f23cf=_[_0x5bfe('0xf5')](_0x4a1b9b,function(_0x32ba83){return _0x32ba83;});_0x20834a=_0x5f23cf[0x1][_0x19c63b[_0x5bfe('0xf6')]];}var _0xa973c={'from':_0x2545b7[_0x5bfe('0xf2')],'firstName':_0x2545b7[_0x5bfe('0xbd')],'lastName':_0x2545b7[_0x5bfe('0x3b')],'mapKey':_0x5bfe('0xf2'),'message':{'from':_0x2545b7[_0x5bfe('0xf2')],'to':_0x19c63b['MailAccount'][_0x5bfe('0xf2')],'cc':'','subject':_[_0x5bfe('0x8c')](_0x20834a)?_0x19c63b['offlineMessageSubject']:_0x20834a,'messageId':'','sentAt':new Date(),'attach':_0x2e7b7d['length'],'attachments':_0x2e7b7d,'originChannel':'Chat','ChatWebsiteId':_0x19c63b['id'],'ChatOfflineMessageId':_0x3b6304['id'],'originTo':_0x19c63b[_0x5bfe('0xdc')]['email']},'body':_0x3b6304[_0x5bfe('0x66')]};var _0x901d35={'account':{'id':_0x19c63b[_0x5bfe('0xf4')]},'body':_0xa973c,'log':_0x5bfe('0xf7')};return respondWithRpcPromise(_0x5bfe('0xf7'),'notifyMail',_0x901d35,client9001)[_0x5bfe('0x2f')](function(){return _0x3b6304;})[_0x5bfe('0x25')](function(_0x480c6c){logger['error'](_0x480c6c);});}return;})[_0x5bfe('0x2f')](function(){if(_0x3b6304){return _0x3b6304;}})['then'](respondWithResult(_0x2d4cc0,null))['catch'](function(){for(var _0x49a99e of _0x43dd8f){var _0x5f3de7=path[_0x5bfe('0x87')](config[_0x5bfe('0x88')],'server',_0x5bfe('0xd2'),'attachments',_0x5bfe('0xe8'),_0x49a99e[_0x5bfe('0x81')]);fs_extra[_0x5bfe('0xf8')](_0x5f3de7)[_0x5bfe('0x25')](function(_0x5031b6){logger[_0x5bfe('0x21')](_0x5bfe('0xf9'),_0x5f3de7,_0x5031b6);});}});};exports[_0x5bfe('0xfa')]=function(_0x5245c6,_0x2ba202){return db[_0x5bfe('0xba')][_0x5bfe('0x64')]({'where':{'id':_0x5245c6['params']['id']}})[_0x5bfe('0x2f')](handleEntityNotFound(_0x2ba202,null))[_0x5bfe('0x2f')](function(_0x5603d1){if(_0x5603d1){return _0x5603d1['addInteraction'](_0x5245c6[_0x5bfe('0x66')][_0x5bfe('0x7b')],_[_0x5bfe('0xfb')](_0x5245c6[_0x5bfe('0x66')],['ids','id'])||{});}})['then'](respondWithResult(_0x2ba202,null))[_0x5bfe('0x25')](handleError(_0x2ba202,null));};exports[_0x5bfe('0xfc')]=function(_0xa9a636,_0x4d1e73){var _0xa7bd72={'raw':![],'where':{}};var _0x1fb2a5={};var _0x39446d={'count':0x0,'rows':[]};return db[_0x5bfe('0x4a')][_0x5bfe('0x77')]({'where':{'id':_0xa9a636[_0x5bfe('0x61')]['id']}})[_0x5bfe('0x2f')](handleEntityNotFound(_0x4d1e73,null))[_0x5bfe('0x2f')](function(_0x4945cc){if(_0x4945cc){_0x1fb2a5[_0x5bfe('0x50')]=_[_0x5bfe('0x63')](db['ChatInteraction'][_0x5bfe('0x4b')]);_0x1fb2a5['query']=_[_0x5bfe('0x63')](_0xa9a636[_0x5bfe('0x4d')]);_0x1fb2a5[_0x5bfe('0x4e')]=_[_0x5bfe('0x4f')](_0x1fb2a5[_0x5bfe('0x50')],_0x1fb2a5[_0x5bfe('0x4d')]);_0xa7bd72[_0x5bfe('0x51')]=_[_0x5bfe('0x4f')](_0x1fb2a5[_0x5bfe('0x50')],qs[_0x5bfe('0x52')](_0xa9a636[_0x5bfe('0x4d')]['fields']));_0xa7bd72[_0x5bfe('0x51')]=_0xa7bd72['attributes']['length']?_0xa7bd72[_0x5bfe('0x51')]:_0x1fb2a5[_0x5bfe('0x50')];if(!_0xa9a636[_0x5bfe('0x4d')][_0x5bfe('0x54')](_0x5bfe('0x55'))){_0xa7bd72[_0x5bfe('0x2a')]=qs[_0x5bfe('0x2a')](_0xa9a636[_0x5bfe('0x4d')][_0x5bfe('0x2a')]);_0xa7bd72[_0x5bfe('0x28')]=qs[_0x5bfe('0x28')](_0xa9a636[_0x5bfe('0x4d')][_0x5bfe('0x28')]);}_0xa7bd72[_0x5bfe('0x78')]=qs[_0x5bfe('0x56')](_0xa9a636[_0x5bfe('0x4d')][_0x5bfe('0x56')]);_0xa7bd72[_0x5bfe('0x57')]=qs[_0x5bfe('0x4e')](_[_0x5bfe('0x58')](_0xa9a636['query'],_0x1fb2a5['filters']));_0xa7bd72[_0x5bfe('0x57')]['ChatWebsiteId']=_0x4945cc['id'];if(_0xa9a636[_0x5bfe('0x4d')]['filter']){_0xa7bd72['where']=_['merge'](_0xa7bd72[_0x5bfe('0x57')],{'$or':_['map'](_0xa7bd72['attributes'],function(_0x205c08){var _0x114b59={};_0x114b59[_0x205c08]={'$like':'%'+_0xa9a636[_0x5bfe('0x4d')][_0x5bfe('0x59')]+'%'};return _0x114b59;})});}_0xa7bd72=_[_0x5bfe('0x5a')]({},_0xa7bd72,_0xa9a636['options']);return db[_0x5bfe('0xba')]['count']({'where':_0xa7bd72['where']})[_0x5bfe('0x2f')](function(_0x3dc78b){_0x39446d[_0x5bfe('0x2b')]=_0x3dc78b;if(_0xa9a636[_0x5bfe('0x4d')][_0x5bfe('0x5d')]){_0xa7bd72[_0x5bfe('0x5e')]=[{'model':db['CmContact'],'as':_0x5bfe('0xfd'),'required':![]},{'model':db[_0x5bfe('0xc7')],'as':_0x5bfe('0xfe'),'attributes':['name',_0x5bfe('0xff'),'internal'],'required':![]},{'model':db[_0x5bfe('0x100')],'as':_0x5bfe('0x101'),'attributes':['id',_0x5bfe('0x33'),_0x5bfe('0x102')],'where':_0xa9a636[_0x5bfe('0x4d')][_0x5bfe('0x103')]?{'id':_0xa9a636['query'][_0x5bfe('0x103')]}:undefined,'required':_0xa9a636['query'][_0x5bfe('0x103')]?!![]:![]}];}return db[_0x5bfe('0xba')][_0x5bfe('0x79')](_0xa7bd72);})['then'](function(_0x3f043a){_0x39446d[_0x5bfe('0x5f')]=_0x3f043a;return _0x39446d;});}})[_0x5bfe('0x2f')](respondWithFilteredResult(_0x4d1e73,_0xa7bd72))[_0x5bfe('0x25')](handleError(_0x4d1e73,null));};exports[_0x5bfe('0x104')]=function(_0x20e1e0,_0x1f19aa){var _0x1d4140=0x0;var _0x1e25ea=0x0;var _0xe27017=![];var _0x3083a5;var _0x5a601e;return db[_0x5bfe('0x4a')][_0x5bfe('0x64')]({'where':{'id':_0x20e1e0[_0x5bfe('0x61')]['id']},'include':[{'model':db['Interval'],'as':_0x5bfe('0x97'),'include':[{'model':db['Interval'],'as':'Intervals','attributes':['id','interval']}]}]})[_0x5bfe('0x2f')](handleEntityNotFound(_0x1f19aa,null))[_0x5bfe('0x2f')](function(_0x6c1360){if(_0x6c1360){_0x3083a5=_0x6c1360;return _0x6c1360[_0x5bfe('0x105')]({'raw':!![]});}})[_0x5bfe('0x2f')](function(_0x17941b){if(_0x3083a5){if(_0x17941b){_0x5a601e=_0x17941b;}}return require(_0x5bfe('0x8b'))[_0x5bfe('0x106')]();})[_0x5bfe('0x2f')](function(_0x407b41){if(_0x407b41){_0x1e25ea=_0x407b41['virtual'];_0xe27017=_0x407b41[_0x5bfe('0x107')];}})[_0x5bfe('0x2f')](function(){return db[_0x5bfe('0xba')][_0x5bfe('0x2b')]({'where':{'closed':![]}});})['then'](function(_0x5d1536){_0x1d4140=_0x5d1536;if(_0x1e25ea&&_0x5d1536>_0x1e25ea){return db['License'][_0x5bfe('0x77')]({'where':{'id':0x1}})['then'](function(_0x1bce88){if(_0x1bce88){_0x1bce88[_0x5bfe('0x108')](_0x5bfe('0x109'));}});}})[_0x5bfe('0x2f')](function(){var _0x4710d5=_0x3083a5['Interval'];var _0x3a0df8=_0x3083a5[_0x5bfe('0x10a')]||undefined;return _0x4710d5?_0x4710d5[_0x5bfe('0x10b')](_0x3a0df8):!![];})[_0x5bfe('0x2f')](function(_0x107b59){var _0x1f3fb1=fs[_0x5bfe('0xdf')](path[_0x5bfe('0x87')](config[_0x5bfe('0x88')],_0x5bfe('0x10c')),_0x5bfe('0xe0'));var _0x66c918=_0x5bfe('0x10d');var _0x2845fe=![];var _0x1426a3,_0x1a052d;if(_0x20e1e0['headers'][_0x5bfe('0x3d')]){_0x1426a3=new URL(_0x20e1e0[_0x5bfe('0xb5')]['referer'])[_0x5bfe('0x10e')];}else if(_0x20e1e0[_0x5bfe('0xb5')]['origin']){_0x1426a3=new URL(_0x20e1e0[_0x5bfe('0xb5')][_0x5bfe('0x10e')])['origin'];}else{_0x1426a3=_0x5bfe('0x10f');}_0x1a052d=typeof _0x3083a5[_0x5bfe('0x67')]['split'](',')['find'](function(_0x5f3db){return wildcardUtils['testWebsiteWithWildcard'](_0x5f3db,_0x1426a3);})!==_0x5bfe('0x29');var _0x376304={'chatVersion':_0x66c918,'chatWebsiteAddressOrigin':_0x1a052d?_0x1426a3:_0x3083a5['address'],'remote':_0x3083a5['remote'],'query':querystring['stringify'](_[_0x5bfe('0x5a')](_0x3083a5[_0x5bfe('0x30')]({'plain':!![]}),{'customerIp':_0x20e1e0[_0x5bfe('0xb5')][_0x5bfe('0x39')]||_0x20e1e0['headers'][_0x5bfe('0x110')]||_0x20e1e0[_0x5bfe('0x111')]['remoteAddress']||_0x20e1e0['ip'],'referer':_0x20e1e0['headers'][_0x5bfe('0x3d')],'openedInteractions':_0x1d4140,'maxInteractions':_0x1e25ea,'virtual':_0xe27017[_0x5bfe('0x112')],'online':_0x107b59,'custom':_0xe27017,'address':_0x1a052d?_0x1426a3:null}))['replace'](/'/g,'\x5c\x27')};_0x1f19aa[_0x5bfe('0xda')](ejs[_0x5bfe('0xe1')](Mustache[_0x5bfe('0xe1')](_0x1f3fb1,_0x376304),{'proactiveActions':_0x5a601e,'alignment':_0x3083a5['alignment'],'verticalAlignment':_0x3083a5['verticalAlignment'],'div_color':_0x3083a5['color'],'labelText':_0x3083a5['labelText'],'text_color':_0x3083a5[_0x5bfe('0x113')],'text_button_color':_0x3083a5[_0x5bfe('0x114')],'button_color':_0x3083a5[_0x5bfe('0x115')],'background_color':_0x3083a5[_0x5bfe('0x116')],'hideWhenOffline':_0x3083a5[_0x5bfe('0x117')],'intervalId':_0x3083a5[_0x5bfe('0x118')],'isDevelopment':_0x2845fe,'chatVersion':_0x66c918}));})['catch'](handleError(_0x1f19aa,null));};exports['addApplications']=function(_0x41c490,_0x13f1ea){var _0x2fe295=_0x41c490['params']['id'];var _0x5be06b=_0x41c490['body'];var _0x25065c=0xc8;var _0x451400=null;return db[_0x5bfe('0x119')][_0x5bfe('0xea')]({'isolationLevel':db[_0x5bfe('0x119')][_0x5bfe('0x11a')][_0x5bfe('0x11b')][_0x5bfe('0x11c')]},function(_0x3305f7){return db[_0x5bfe('0x4a')][_0x5bfe('0x77')]({'where':{'id':_0x2fe295},'transaction':_0x3305f7})[_0x5bfe('0x2f')](function(_0x5c4aa5){if(_0x5c4aa5){return db[_0x5bfe('0xaa')]['destroy']({'where':{'ChatWebsiteId':_0x2fe295},'transaction':_0x3305f7})[_0x5bfe('0x2f')](function(){var _0x43facb=_['map'](_0x5be06b,function(_0x300d10){_0x300d10[_0x5bfe('0x74')]=_0x2fe295;return _0x300d10;});return db[_0x5bfe('0xaa')][_0x5bfe('0x11d')](_0x43facb,{'transaction':_0x3305f7});});}else{_0x25065c=0x194;_0x451400=[];}});})['then'](function(){if(_0x25065c!==0x194){return db['ChatApplication']['findAndCountAll']({'where':{'ChatWebsiteId':_0x2fe295},'order':'priority'})['then'](function(_0x42bc71){_0x451400=_0x42bc71;});}})[_0x5bfe('0x25')](function(_0x2ac3fc){_0x25065c=0x1f4;logger[_0x5bfe('0x21')](_0x2ac3fc[_0x5bfe('0x11e')]);if(_0x2ac3fc[_0x5bfe('0x33')]){delete _0x2ac3fc[_0x5bfe('0x33')];}_0x451400=_0x2ac3fc;})['finally'](function(){if(_0x451400===null){_0x13f1ea[_0x5bfe('0x26')](_0x25065c);}else{if(_0x25065c===0x1f4){_0x13f1ea[_0x5bfe('0x27')](_0x25065c)[_0x5bfe('0xda')](_0x451400);}else{_0x13f1ea[_0x5bfe('0x27')](_0x25065c)['json'](_0x451400);}}});};exports['getApplications']=function(_0x422100,_0x231f13){var _0x4437b0={};var _0x2d08e5={};var _0x3638ea;var _0x65f722;return db[_0x5bfe('0x4a')][_0x5bfe('0x77')]({'where':{'id':_0x422100['params']['id']}})[_0x5bfe('0x2f')](handleEntityNotFound(_0x231f13,null))[_0x5bfe('0x2f')](function(_0x1fe240){if(_0x1fe240){_0x3638ea=_0x1fe240;_0x2d08e5[_0x5bfe('0x50')]=_['keys'](db[_0x5bfe('0xaa')][_0x5bfe('0x4b')]);_0x2d08e5[_0x5bfe('0x4d')]=_[_0x5bfe('0x63')](_0x422100[_0x5bfe('0x4d')]);_0x2d08e5[_0x5bfe('0x4e')]=_[_0x5bfe('0x4f')](_0x2d08e5[_0x5bfe('0x50')],_0x2d08e5[_0x5bfe('0x4d')]);_0x4437b0[_0x5bfe('0x51')]=_[_0x5bfe('0x4f')](_0x2d08e5['model'],qs[_0x5bfe('0x52')](_0x422100['query'][_0x5bfe('0x52')]));_0x4437b0[_0x5bfe('0x51')]=_0x4437b0[_0x5bfe('0x51')][_0x5bfe('0x53')]?_0x4437b0[_0x5bfe('0x51')]:_0x2d08e5[_0x5bfe('0x50')];_0x4437b0[_0x5bfe('0x78')]=qs[_0x5bfe('0x56')](_0x422100[_0x5bfe('0x4d')]['sort']);_0x4437b0[_0x5bfe('0x57')]=qs[_0x5bfe('0x4e')](_['pick'](_0x422100[_0x5bfe('0x4d')],_0x2d08e5[_0x5bfe('0x4e')]));if(_0x422100[_0x5bfe('0x4d')]['filter']){_0x4437b0[_0x5bfe('0x57')]=_[_0x5bfe('0x5a')](_0x4437b0[_0x5bfe('0x57')],{'$or':_[_0x5bfe('0x49')](_0x4437b0[_0x5bfe('0x51')],function(_0x10b19e){var _0x48cccc={};_0x48cccc[_0x10b19e]={'$like':'%'+_0x422100[_0x5bfe('0x4d')]['filter']+'%'};return _0x48cccc;})});}_0x4437b0=_['merge']({},_0x4437b0,_0x422100[_0x5bfe('0x5c')]);return _0x3638ea[_0x5bfe('0x11f')](_0x4437b0);}})[_0x5bfe('0x2f')](function(_0x30dac4){if(_0x30dac4){_0x65f722=_0x30dac4[_0x5bfe('0x53')];if(!_0x422100['query'][_0x5bfe('0x54')](_0x5bfe('0x55'))){_0x4437b0[_0x5bfe('0x2a')]=qs[_0x5bfe('0x2a')](_0x422100[_0x5bfe('0x4d')][_0x5bfe('0x2a')]);_0x4437b0['offset']=qs[_0x5bfe('0x28')](_0x422100[_0x5bfe('0x4d')][_0x5bfe('0x28')]);}return _0x3638ea['getApplications'](_0x4437b0);}})[_0x5bfe('0x2f')](function(_0x59b1fc){if(_0x59b1fc){return _0x59b1fc?{'count':_0x65f722,'rows':_0x59b1fc}:null;}})[_0x5bfe('0x2f')](respondWithResult(_0x231f13,null))[_0x5bfe('0x25')](handleError(_0x231f13,null));};exports['addProactiveActions']=function(_0x598964,_0xe79fae){return db['chatProactiveAction'][_0x5bfe('0x64')]({'where':{'id':_0x598964[_0x5bfe('0x61')]['id']}})['then'](handleEntityNotFound(_0xe79fae,null))[_0x5bfe('0x2f')](function(_0x54c464){if(_0x54c464){return _0x54c464[_0x5bfe('0x120')](_0x598964['body'][_0x5bfe('0x7b')],_[_0x5bfe('0xfb')](_0x598964[_0x5bfe('0x66')],[_0x5bfe('0x7b'),'id'])||{});}})[_0x5bfe('0x2f')](respondWithResult(_0xe79fae,null))[_0x5bfe('0x25')](handleError(_0xe79fae,null));};exports['getProactiveActions']=function(_0x445a19,_0x1aded2){var _0xdfd4c6={};var _0xf3f240={};var _0x2db45c;var _0xf425e9;return db[_0x5bfe('0x4a')][_0x5bfe('0x77')]({'where':{'id':_0x445a19['params']['id']}})[_0x5bfe('0x2f')](handleEntityNotFound(_0x1aded2,null))[_0x5bfe('0x2f')](function(_0xc63969){if(_0xc63969){_0x2db45c=_0xc63969;_0xf3f240['model']=_[_0x5bfe('0x63')](db[_0x5bfe('0x121')][_0x5bfe('0x4b')]);_0xf3f240[_0x5bfe('0x4d')]=_['keys'](_0x445a19[_0x5bfe('0x4d')]);_0xf3f240[_0x5bfe('0x4e')]=_[_0x5bfe('0x4f')](_0xf3f240[_0x5bfe('0x50')],_0xf3f240[_0x5bfe('0x4d')]);_0xdfd4c6[_0x5bfe('0x51')]=_[_0x5bfe('0x4f')](_0xf3f240['model'],qs['fields'](_0x445a19[_0x5bfe('0x4d')]['fields']));_0xdfd4c6[_0x5bfe('0x51')]=_0xdfd4c6[_0x5bfe('0x51')][_0x5bfe('0x53')]?_0xdfd4c6[_0x5bfe('0x51')]:_0xf3f240[_0x5bfe('0x50')];_0xdfd4c6[_0x5bfe('0x78')]=qs[_0x5bfe('0x56')](_0x445a19[_0x5bfe('0x4d')][_0x5bfe('0x56')]);_0xdfd4c6[_0x5bfe('0x57')]=qs['filters'](_[_0x5bfe('0x58')](_0x445a19[_0x5bfe('0x4d')],_0xf3f240['filters']));if(_0x445a19['query'][_0x5bfe('0x59')]){_0xdfd4c6['where']=_['merge'](_0xdfd4c6[_0x5bfe('0x57')],{'$or':_[_0x5bfe('0x49')](_0xdfd4c6[_0x5bfe('0x51')],function(_0x14b132){var _0x404fef={};_0x404fef[_0x14b132]={'$like':'%'+_0x445a19['query'][_0x5bfe('0x59')]+'%'};return _0x404fef;})});}_0xdfd4c6=_['merge']({},_0xdfd4c6,_0x445a19[_0x5bfe('0x5c')]);return _0x2db45c['getProactiveActions'](_0xdfd4c6);}})[_0x5bfe('0x2f')](function(_0x75478b){if(_0x75478b){_0xf425e9=_0x75478b['length'];if(!_0x445a19[_0x5bfe('0x4d')]['hasOwnProperty'](_0x5bfe('0x55'))){_0xdfd4c6[_0x5bfe('0x2a')]=qs[_0x5bfe('0x2a')](_0x445a19[_0x5bfe('0x4d')][_0x5bfe('0x2a')]);_0xdfd4c6['offset']=qs[_0x5bfe('0x28')](_0x445a19[_0x5bfe('0x4d')][_0x5bfe('0x28')]);}return _0x2db45c[_0x5bfe('0x105')](_0xdfd4c6);}})[_0x5bfe('0x2f')](function(_0x5826f9){if(_0x5826f9){return _0x5826f9?{'count':_0xf425e9,'rows':_0x5826f9}:null;}})['then'](respondWithResult(_0x1aded2,null))[_0x5bfe('0x25')](handleError(_0x1aded2,null));};exports['getFields']=function(_0x4bea1f,_0x34edf0){var _0xc15889=_0x4bea1f[_0x5bfe('0x4d')][_0x5bfe('0x122')]==='false'?_0x5bfe('0x123'):_0x5bfe('0x124');return db['ChatWebsite'][_0x5bfe('0x64')]({'attributes':['id',_0xc15889],'where':{'id':_0x4bea1f[_0x5bfe('0x61')]['id']}})[_0x5bfe('0x2f')](handleEntityNotFound(_0x34edf0,null))[_0x5bfe('0x2f')](function(_0x8926e0){if(_0x8926e0){var _0x33c183=_0x8926e0[_0xc15889];var _0x20db5b=_0x33c183&&_0x33c183[_0x5bfe('0x125')]?_0x33c183[_0x5bfe('0x125')]:[];_0x34edf0[_0x5bfe('0xda')]({'fromKey':_[_0x5bfe('0x8c')](_0x33c183['fromKey'])?undefined:_0x33c183['fromKey'],'count':_0x20db5b[_0x5bfe('0x53')],'rows':_0x20db5b});}})[_0x5bfe('0x25')](handleError(_0x34edf0,null));};exports[_0x5bfe('0x126')]=function(_0x5ccc51,_0x5bbc16){var _0x4a4a68={'raw':![],'where':{}};var _0x3dcf1d={};var _0x2bb241={'count':0x0,'rows':[]};return db[_0x5bfe('0x4a')][_0x5bfe('0x77')]({'where':{'id':_0x5ccc51[_0x5bfe('0x61')]['id']}})['then'](handleEntityNotFound(_0x5bbc16,null))[_0x5bfe('0x2f')](function(_0x441b7a){if(_0x441b7a){_0x3dcf1d[_0x5bfe('0x50')]=_[_0x5bfe('0x63')](db[_0x5bfe('0x127')][_0x5bfe('0x4b')]);_0x3dcf1d[_0x5bfe('0x4d')]=_[_0x5bfe('0x63')](_0x5ccc51[_0x5bfe('0x4d')]);_0x3dcf1d['filters']=_[_0x5bfe('0x4f')](_0x3dcf1d[_0x5bfe('0x50')],_0x3dcf1d['query']);_0x4a4a68[_0x5bfe('0x51')]=_['intersection'](_0x3dcf1d[_0x5bfe('0x50')],qs['fields'](_0x5ccc51[_0x5bfe('0x4d')][_0x5bfe('0x52')]));_0x4a4a68['attributes']=_0x4a4a68[_0x5bfe('0x51')][_0x5bfe('0x53')]?_0x4a4a68[_0x5bfe('0x51')]:_0x3dcf1d[_0x5bfe('0x50')];if(!_0x5ccc51[_0x5bfe('0x4d')][_0x5bfe('0x54')](_0x5bfe('0x55'))){_0x4a4a68['limit']=qs['limit'](_0x5ccc51[_0x5bfe('0x4d')][_0x5bfe('0x2a')]);_0x4a4a68[_0x5bfe('0x28')]=qs['offset'](_0x5ccc51['query'][_0x5bfe('0x28')]);}_0x4a4a68[_0x5bfe('0x78')]=qs[_0x5bfe('0x56')](_0x5ccc51[_0x5bfe('0x4d')][_0x5bfe('0x56')]);_0x4a4a68['where']=qs[_0x5bfe('0x4e')](_[_0x5bfe('0x58')](_0x5ccc51[_0x5bfe('0x4d')],_0x3dcf1d['filters']));_0x4a4a68[_0x5bfe('0x57')][_0x5bfe('0x74')]=_0x441b7a['id'];if(_0x5ccc51[_0x5bfe('0x4d')][_0x5bfe('0x59')]){_0x4a4a68[_0x5bfe('0x57')]=_[_0x5bfe('0x5a')](_0x4a4a68[_0x5bfe('0x57')],{'$or':_[_0x5bfe('0x49')](_0x4a4a68[_0x5bfe('0x51')],function(_0x4f794f){var _0x1167ba={};_0x1167ba[_0x4f794f]={'$like':'%'+_0x5ccc51[_0x5bfe('0x4d')][_0x5bfe('0x59')]+'%'};return _0x1167ba;})});}_0x4a4a68=_[_0x5bfe('0x5a')]({},_0x4a4a68,_0x5ccc51[_0x5bfe('0x5c')]);return db[_0x5bfe('0x127')][_0x5bfe('0x2b')]({'where':_0x4a4a68[_0x5bfe('0x57')]})[_0x5bfe('0x2f')](function(_0x26973b){_0x2bb241[_0x5bfe('0x2b')]=_0x26973b;if(_0x5ccc51[_0x5bfe('0x4d')]['includeAll']){_0x4a4a68[_0x5bfe('0x5e')]=[{'all':!![]}];}else{_0x4a4a68[_0x5bfe('0x5e')]=[{'model':db['CmContact'],'as':_0x5bfe('0xfd'),'required':![]},{'model':db['Attachment'],'as':_0x5bfe('0x128'),'required':![]}];}return db['ChatOfflineMessage'][_0x5bfe('0x79')](_0x4a4a68);})['then'](function(_0x140920){_0x2bb241[_0x5bfe('0x5f')]=_0x140920;return _0x2bb241;});}})[_0x5bfe('0x2f')](respondWithFilteredResult(_0x5bbc16,_0x4a4a68))[_0x5bfe('0x25')](handleError(_0x5bbc16,null));};exports[_0x5bfe('0x129')]=function(_0x338fac,_0x26f89c){return db[_0x5bfe('0x4a')][_0x5bfe('0x64')]({'where':{'id':_0x338fac[_0x5bfe('0x61')]['id']}})[_0x5bfe('0x2f')](handleEntityNotFound(_0x26f89c,null))[_0x5bfe('0x2f')](function(_0x3fdb2d){if(_0x3fdb2d){return _0x3fdb2d[_0x5bfe('0x129')](_0x338fac[_0x5bfe('0x66')][_0x5bfe('0x7b')],_[_0x5bfe('0xfb')](_0x338fac[_0x5bfe('0x66')],[_0x5bfe('0x7b'),'id'])||{})[_0x5bfe('0xde')](function(_0x2f67a5){for(var _0x18797c=0x0;_0x18797c<_0x338fac[_0x5bfe('0x66')]['ids']['length'];_0x18797c+=0x1){socket['emit'](_0x5bfe('0x12a'),{'UserId':Number(_0x338fac[_0x5bfe('0x66')][_0x5bfe('0x7b')][_0x18797c]),'ChatWebsiteId':Number(_0x338fac['params']['id'])});}return _0x2f67a5;});}})['then'](respondWithResult(_0x26f89c,null))[_0x5bfe('0x25')](handleError(_0x26f89c,null));};exports[_0x5bfe('0x12b')]=function(_0x33b94f,_0x54aecf){return db['ChatWebsite'][_0x5bfe('0x64')]({'where':{'id':_0x33b94f['params']['id']}})[_0x5bfe('0x2f')](handleEntityNotFound(_0x54aecf,null))['then'](function(_0x5fb508){if(_0x5fb508){return _0x5fb508[_0x5bfe('0x12b')](_0x33b94f[_0x5bfe('0x4d')]['ids'])['then'](function(){if(_[_0x5bfe('0x12c')](_0x33b94f[_0x5bfe('0x4d')][_0x5bfe('0x7b')])){for(var _0x12da1e=0x0;_0x12da1e<_0x33b94f[_0x5bfe('0x4d')][_0x5bfe('0x7b')]['length'];_0x12da1e+=0x1){socket[_0x5bfe('0x12d')](_0x5bfe('0x12e'),{'UserId':Number(_0x33b94f[_0x5bfe('0x4d')][_0x5bfe('0x7b')][_0x12da1e]),'ChatWebsiteId':Number(_0x33b94f[_0x5bfe('0x61')]['id'])});}}else{socket[_0x5bfe('0x12d')](_0x5bfe('0x12e'),{'UserId':Number(_0x33b94f[_0x5bfe('0x4d')]['ids']),'ChatWebsiteId':Number(_0x33b94f['params']['id'])});}});}})[_0x5bfe('0x2f')](respondWithStatusCode(_0x54aecf,null))[_0x5bfe('0x25')](handleError(_0x54aecf,null));};exports[_0x5bfe('0x12f')]=function(_0x477c7f,_0x3307a3){var _0x5cfd02={};var _0x456330={};var _0x2fa689;var _0x380dcb;return db[_0x5bfe('0x4a')]['findOne']({'where':{'id':_0x477c7f[_0x5bfe('0x61')]['id']}})[_0x5bfe('0x2f')](handleEntityNotFound(_0x3307a3,null))[_0x5bfe('0x2f')](function(_0x8c4877){if(_0x8c4877){_0x2fa689=_0x8c4877;_0x456330[_0x5bfe('0x50')]=_[_0x5bfe('0x63')](db[_0x5bfe('0xc7')][_0x5bfe('0x4b')]);_0x456330[_0x5bfe('0x4d')]=_['keys'](_0x477c7f['query']);_0x456330[_0x5bfe('0x4e')]=_[_0x5bfe('0x4f')](_0x456330[_0x5bfe('0x50')],_0x456330[_0x5bfe('0x4d')]);_0x5cfd02[_0x5bfe('0x51')]=_[_0x5bfe('0x4f')](_0x456330[_0x5bfe('0x50')],qs['fields'](_0x477c7f[_0x5bfe('0x4d')][_0x5bfe('0x52')]));_0x5cfd02['attributes']=_0x5cfd02['attributes']['length']?_0x5cfd02[_0x5bfe('0x51')]:_0x456330[_0x5bfe('0x50')];_0x5cfd02[_0x5bfe('0x78')]=qs[_0x5bfe('0x56')](_0x477c7f['query'][_0x5bfe('0x56')]);_0x5cfd02['where']=qs[_0x5bfe('0x4e')](_[_0x5bfe('0x58')](_0x477c7f[_0x5bfe('0x4d')],_0x456330['filters']));if(_0x477c7f['query'][_0x5bfe('0x59')]){_0x5cfd02[_0x5bfe('0x57')]=_['merge'](_0x5cfd02[_0x5bfe('0x57')],{'$or':_['map'](_0x5cfd02['attributes'],function(_0x40fc40){var _0x222f78={};_0x222f78[_0x40fc40]={'$like':'%'+_0x477c7f[_0x5bfe('0x4d')][_0x5bfe('0x59')]+'%'};return _0x222f78;})});}_0x5cfd02=_[_0x5bfe('0x5a')]({},_0x5cfd02,_0x477c7f[_0x5bfe('0x5c')]);return _0x2fa689[_0x5bfe('0x12f')](_0x5cfd02);}})[_0x5bfe('0x2f')](function(_0x170de4){if(_0x170de4){_0x380dcb=_0x170de4[_0x5bfe('0x53')];if(!_0x477c7f[_0x5bfe('0x4d')][_0x5bfe('0x54')](_0x5bfe('0x55'))){_0x5cfd02['limit']=qs['limit'](_0x477c7f[_0x5bfe('0x4d')][_0x5bfe('0x2a')]);_0x5cfd02[_0x5bfe('0x28')]=qs[_0x5bfe('0x28')](_0x477c7f[_0x5bfe('0x4d')]['offset']);}return _0x2fa689[_0x5bfe('0x12f')](_0x5cfd02);}})[_0x5bfe('0x2f')](function(_0x1dcdf9){if(_0x1dcdf9){return _0x1dcdf9?{'count':_0x380dcb,'rows':_0x1dcdf9}:null;}})[_0x5bfe('0x2f')](respondWithResult(_0x3307a3,null))[_0x5bfe('0x25')](handleError(_0x3307a3,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index b77a209..d835b44 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 _0x16e4=['exports','events','../../mysqldb','ChatWebsite','setMaxListeners','save','update','emit','hasOwnProperty','hook'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x16e4,0x97));var _0x416e=function(_0x219cc2,_0xa571ff){_0x219cc2=_0x219cc2-0x0;var _0x354d0c=_0x16e4[_0x219cc2];return _0x354d0c;};'use strict';var EventEmitter=require(_0x416e('0x0'));var ChatWebsite=require(_0x416e('0x1'))['db'][_0x416e('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x416e('0x3')](0x0);var events={'afterCreate':_0x416e('0x4'),'afterUpdate':_0x416e('0x5'),'afterDestroy':'remove'};function emitEvent(_0xdf95eb){return function(_0x4a161c,_0x344e7b,_0x30af74){ChatWebsiteEvents['emit'](_0xdf95eb+':'+_0x4a161c['id'],_0x4a161c);ChatWebsiteEvents[_0x416e('0x6')](_0xdf95eb,_0x4a161c);_0x30af74(null);};}for(var e in events){if(events[_0x416e('0x7')](e)){var event=events[e];ChatWebsite[_0x416e('0x8')](e,emitEvent(event));}}module[_0x416e('0x9')]=ChatWebsiteEvents; \ No newline at end of file +var _0xdf70=['ChatWebsite','save','update','emit','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x4ca694,_0x378f4c){var _0x1e5385=function(_0x28c57b){while(--_0x28c57b){_0x4ca694['push'](_0x4ca694['shift']());}};_0x1e5385(++_0x378f4c);}(_0xdf70,0x86));var _0x0df7=function(_0x2dd092,_0x10a19e){_0x2dd092=_0x2dd092-0x0;var _0x2c9e3c=_0xdf70[_0x2dd092];return _0x2c9e3c;};'use strict';var EventEmitter=require(_0x0df7('0x0'));var ChatWebsite=require(_0x0df7('0x1'))['db'][_0x0df7('0x2')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x0df7('0x3'),'afterUpdate':_0x0df7('0x4'),'afterDestroy':'remove'};function emitEvent(_0x2b074b){return function(_0x4ae128,_0x278b96,_0x2f3c43){ChatWebsiteEvents['emit'](_0x2b074b+':'+_0x4ae128['id'],_0x4ae128);ChatWebsiteEvents[_0x0df7('0x5')](_0x2b074b,_0x4ae128);_0x2f3c43(null);};}for(var e in events){if(events[_0x0df7('0x6')](e)){var event=events[e];ChatWebsite[_0x0df7('0x7')](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 8cf5d0f..07665c6 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 _0xcbaa=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','ChatWebsite','lodash','util','api'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xcbaa,0x11d));var _0xacba=function(_0x44f974,_0x4db616){_0x44f974=_0x44f974-0x0;var _0x805dbd=_0xcbaa[_0x44f974];return _0x805dbd;};'use strict';var _=require(_0xacba('0x0'));var util=require(_0xacba('0x1'));var logger=require('../../config/logger')(_0xacba('0x2'));var moment=require(_0xacba('0x3'));var BPromise=require(_0xacba('0x4'));var rp=require(_0xacba('0x5'));var fs=require('fs');var path=require(_0xacba('0x6'));var rimraf=require(_0xacba('0x7'));var config=require(_0xacba('0x8'));var attributes=require('./chatWebsite.attributes');module[_0xacba('0x9')]=function(_0x45ab26,_0x515e09){return _0x45ab26[_0xacba('0xa')](_0xacba('0xb'),attributes,{'tableName':'chat_websites','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x795e=['ChatWebsite','chat_websites','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./chatWebsite.attributes','exports','define'];(function(_0x566911,_0x4ce4c6){var _0x16ed11=function(_0x521d9a){while(--_0x521d9a){_0x566911['push'](_0x566911['shift']());}};_0x16ed11(++_0x4ce4c6);}(_0x795e,0x17c));var _0xe795=function(_0xee0162,_0x1398ae){_0xee0162=_0xee0162-0x0;var _0x5983df=_0x795e[_0xee0162];return _0x5983df;};'use strict';var _=require(_0xe795('0x0'));var util=require(_0xe795('0x1'));var logger=require(_0xe795('0x2'))(_0xe795('0x3'));var moment=require(_0xe795('0x4'));var BPromise=require(_0xe795('0x5'));var rp=require(_0xe795('0x6'));var fs=require('fs');var path=require(_0xe795('0x7'));var rimraf=require(_0xe795('0x8'));var config=require('../../config/environment');var attributes=require(_0xe795('0x9'));module[_0xe795('0xa')]=function(_0x491a85,_0x13308a){return _0x491a85[_0xe795('0xb')](_0xe795('0xc'),attributes,{'tableName':_0xe795('0xd'),'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 df32166..098d3d8 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 _0xd49f=['stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./chatWebsite.socket','register','request','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x4b379d,_0x2d6c06){var _0x35f203=function(_0x5d78ba){while(--_0x5d78ba){_0x4b379d['push'](_0x4b379d['shift']());}};_0x35f203(++_0x2d6c06);}(_0xd49f,0x165));var _0xfd49=function(_0x5f1d5a,_0x1c85a7){_0x5f1d5a=_0x5f1d5a-0x0;var _0x449071=_0xd49f[_0x5f1d5a];return _0x449071;};'use strict';var _=require(_0xfd49('0x0'));var util=require(_0xfd49('0x1'));var moment=require('moment');var BPromise=require(_0xfd49('0x2'));var rs=require(_0xfd49('0x3'));var fs=require('fs');var Redis=require(_0xfd49('0x4'));var db=require(_0xfd49('0x5'))['db'];var utils=require(_0xfd49('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xfd49('0x7'));var jayson=require(_0xfd49('0x8'));var client=jayson[_0xfd49('0x9')][_0xfd49('0xa')]({'port':0x232a});config[_0xfd49('0xb')]=_['defaults'](config[_0xfd49('0xb')],{'host':_0xfd49('0xc'),'port':0x18eb});var socket=require(_0xfd49('0xd'))(new Redis(config[_0xfd49('0xb')]));require(_0xfd49('0xe'))[_0xfd49('0xf')](socket);function respondWithRpcPromise(_0x4e0172,_0x5e3aa4,_0x33a3c6){return new BPromise(function(_0x32add7,_0x1366b9){return client[_0xfd49('0x10')](_0x4e0172,_0x33a3c6)['then'](function(_0x3c95a6){logger[_0xfd49('0x11')](_0xfd49('0x12'),_0x5e3aa4,_0xfd49('0x13'));logger[_0xfd49('0x14')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x5e3aa4,_0xfd49('0x13'),JSON[_0xfd49('0x15')](_0x3c95a6));if(_0x3c95a6[_0xfd49('0x16')]){if(_0x3c95a6[_0xfd49('0x16')][_0xfd49('0x17')]===0x1f4){logger[_0xfd49('0x16')](_0xfd49('0x12'),_0x5e3aa4,_0x3c95a6['error'][_0xfd49('0x18')]);return _0x1366b9(_0x3c95a6[_0xfd49('0x16')]['message']);}logger[_0xfd49('0x16')]('ChatWebsite,\x20%s,\x20%s',_0x5e3aa4,_0x3c95a6['error'][_0xfd49('0x18')]);return _0x32add7(_0x3c95a6[_0xfd49('0x16')]['message']);}else{logger[_0xfd49('0x11')]('ChatWebsite,\x20%s,\x20%s',_0x5e3aa4,'request\x20sent');_0x32add7(_0x3c95a6[_0xfd49('0x19')][_0xfd49('0x18')]);}})[_0xfd49('0x1a')](function(_0x1fde74){logger[_0xfd49('0x16')](_0xfd49('0x12'),_0x5e3aa4,_0x1fde74);_0x1366b9(_0x1fde74);});});} \ No newline at end of file +var _0x481f=['redis','localhost','./chatWebsite.socket','register','request','then','info','request\x20sent','debug','stringify','error','code','ChatWebsite,\x20%s,\x20%s','message','catch','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x481f,0x1e3));var _0xf481=function(_0x1f706a,_0x1661cb){_0x1f706a=_0x1f706a-0x0;var _0x51d3c2=_0x481f[_0x1f706a];return _0x51d3c2;};'use strict';var _=require(_0xf481('0x0'));var util=require(_0xf481('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf481('0x2'));var db=require(_0xf481('0x3'))['db'];var utils=require(_0xf481('0x4'));var logger=require(_0xf481('0x5'))(_0xf481('0x6'));var config=require(_0xf481('0x7'));var jayson=require(_0xf481('0x8'));var client=jayson[_0xf481('0x9')][_0xf481('0xa')]({'port':0x232a});config[_0xf481('0xb')]=_['defaults'](config['redis'],{'host':_0xf481('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf481('0xb')]));require(_0xf481('0xd'))[_0xf481('0xe')](socket);function respondWithRpcPromise(_0x343335,_0x381af1,_0x50f373){return new BPromise(function(_0x4427df,_0x569110){return client[_0xf481('0xf')](_0x343335,_0x50f373)[_0xf481('0x10')](function(_0x507f88){logger[_0xf481('0x11')]('ChatWebsite,\x20%s,\x20%s',_0x381af1,_0xf481('0x12'));logger[_0xf481('0x13')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x381af1,_0xf481('0x12'),JSON[_0xf481('0x14')](_0x507f88));if(_0x507f88[_0xf481('0x15')]){if(_0x507f88[_0xf481('0x15')][_0xf481('0x16')]===0x1f4){logger[_0xf481('0x15')](_0xf481('0x17'),_0x381af1,_0x507f88['error'][_0xf481('0x18')]);return _0x569110(_0x507f88[_0xf481('0x15')]['message']);}logger[_0xf481('0x15')](_0xf481('0x17'),_0x381af1,_0x507f88['error'][_0xf481('0x18')]);return _0x4427df(_0x507f88[_0xf481('0x15')][_0xf481('0x18')]);}else{logger['info'](_0xf481('0x17'),_0x381af1,_0xf481('0x12'));_0x4427df(_0x507f88['result'][_0xf481('0x18')]);}})[_0xf481('0x19')](function(_0x333e57){logger[_0xf481('0x15')](_0xf481('0x17'),_0x381af1,_0x333e57);_0x569110(_0x333e57);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index 2350430..e248740 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 _0x137d=['save','remove','emit','removeListener','register','length','chatWebsite:','./chatWebsite.events'];(function(_0x36eaaa,_0x326732){var _0x461349=function(_0x4e4180){while(--_0x4e4180){_0x36eaaa['push'](_0x36eaaa['shift']());}};_0x461349(++_0x326732);}(_0x137d,0x1df));var _0xd137=function(_0x414ff1,_0xf0462b){_0x414ff1=_0x414ff1-0x0;var _0x29c53f=_0x137d[_0x414ff1];return _0x29c53f;};'use strict';var ChatWebsiteEvents=require(_0xd137('0x0'));var events=[_0xd137('0x1'),_0xd137('0x2'),'update'];function createListener(_0x11c945,_0x78b57e){return function(_0x3a8d27){_0x78b57e[_0xd137('0x3')](_0x11c945,_0x3a8d27);};}function removeListener(_0xe01d85,_0x394af9){return function(){ChatWebsiteEvents[_0xd137('0x4')](_0xe01d85,_0x394af9);};}exports[_0xd137('0x5')]=function(_0x3e94d1){for(var _0x158980=0x0,_0x166c0b=events[_0xd137('0x6')];_0x158980<_0x166c0b;_0x158980++){var _0x16a2c3=events[_0x158980];var _0x36fd4d=createListener(_0xd137('0x7')+_0x16a2c3,_0x3e94d1);ChatWebsiteEvents['on'](_0x16a2c3,_0x36fd4d);}}; \ No newline at end of file +var _0x6289=['remove','update','emit','register','length','chatWebsite:','./chatWebsite.events','save'];(function(_0x1abecb,_0x5c7c25){var _0xdc9219=function(_0x429f5b){while(--_0x429f5b){_0x1abecb['push'](_0x1abecb['shift']());}};_0xdc9219(++_0x5c7c25);}(_0x6289,0xee));var _0x9628=function(_0x13e8ac,_0x25c0c0){_0x13e8ac=_0x13e8ac-0x0;var _0xc77ea6=_0x6289[_0x13e8ac];return _0xc77ea6;};'use strict';var ChatWebsiteEvents=require(_0x9628('0x0'));var events=[_0x9628('0x1'),_0x9628('0x2'),_0x9628('0x3')];function createListener(_0x3f889b,_0x3da49a){return function(_0x4edf5d){_0x3da49a[_0x9628('0x4')](_0x3f889b,_0x4edf5d);};}function removeListener(_0x240e1a,_0x399606){return function(){ChatWebsiteEvents['removeListener'](_0x240e1a,_0x399606);};}exports[_0x9628('0x5')]=function(_0x3bf860){for(var _0x442541=0x0,_0x1f3cc5=events[_0x9628('0x6')];_0x442541<_0x1f3cc5;_0x442541++){var _0x4b9c95=events[_0x442541];var _0x4be383=createListener(_0x9628('0x7')+_0x4b9c95,_0x3bf860);ChatWebsiteEvents['on'](_0x4b9c95,_0x4be383);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/helpers/wildcard-expressions.js b/server/api/chatWebsite/helpers/wildcard-expressions.js index 49e96a8..d627caa 100644 --- a/server/api/chatWebsite/helpers/wildcard-expressions.js +++ b/server/api/chatWebsite/helpers/wildcard-expressions.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd9fb=['([\x5cw]+)','localhost','exports','../../../utils/misc','escapeRegExp','url','URL','replace','test','trim'];(function(_0x47378a,_0x55cc2f){var _0x9bebe3=function(_0x115e69){while(--_0x115e69){_0x47378a['push'](_0x47378a['shift']());}};_0x9bebe3(++_0x55cc2f);}(_0xd9fb,0x189));var _0xbd9f=function(_0xd1d19a,_0x1933f0){_0xd1d19a=_0xd1d19a-0x0;var _0x52a79d=_0xd9fb[_0xd1d19a];return _0x52a79d;};var escapeRegExp=require(_0xbd9f('0x0'))[_0xbd9f('0x1')];var URL=require(_0xbd9f('0x2'))[_0xbd9f('0x3')];function testWildcardValidity(_0xc03acd){var _0x22804e=!![];try{new URL(_0xc03acd[_0xbd9f('0x4')]('*','localhost'));}catch(_0x2d4213){_0x22804e=![];}return _0x22804e&&new RegExp(/(http(s)?):\/\/(\*|(((\*\.)+)?([a-zA-Z0-9\-_]+\.){0,}([a-zA-Z0-9\-_]+)))(:[\d]+)?\/?$/)[_0xbd9f('0x5')](_0xc03acd);}function testWebsiteWithWildcard(_0x4ce2e2,_0x469446){var _0x5b6052;var _0x2e7eea=escapeRegExp(_0x4ce2e2[_0xbd9f('0x6')]()['replace'](/\/$/,''))[_0xbd9f('0x4')]('\x5c*',_0xbd9f('0x7'));try{new URL(_0x4ce2e2[_0xbd9f('0x4')]('\x5c*',_0xbd9f('0x8')));_0x5b6052=new RegExp(_0x2e7eea)['test'](_0x469446);}catch(_0x37163c){_0x5b6052=![];}return _0x5b6052;}module[_0xbd9f('0x9')]={'testWebsiteWithWildcard':testWebsiteWithWildcard,'testWildcardValidity':testWildcardValidity}; \ No newline at end of file +var _0xf417=['url','URL','replace','test','exports','escapeRegExp'];(function(_0x55d003,_0x54c624){var _0x316a58=function(_0x483ee7){while(--_0x483ee7){_0x55d003['push'](_0x55d003['shift']());}};_0x316a58(++_0x54c624);}(_0xf417,0x8f));var _0x7f41=function(_0x15d229,_0x132b33){_0x15d229=_0x15d229-0x0;var _0x2ebafc=_0xf417[_0x15d229];return _0x2ebafc;};var escapeRegExp=require('../../../utils/misc')[_0x7f41('0x0')];var URL=require(_0x7f41('0x1'))[_0x7f41('0x2')];function testWildcardValidity(_0x57aab7){var _0x85053=!![];try{new URL(_0x57aab7['replace']('*','localhost'));}catch(_0x2b7d4c){_0x85053=![];}return _0x85053&&new RegExp(/(http(s)?):\/\/(\*|(((\*\.)+)?([a-zA-Z0-9\-_]+\.){0,}([a-zA-Z0-9\-_]+)))(:[\d]+)?\/?$/)['test'](_0x57aab7);}function testWebsiteWithWildcard(_0x51b0cb,_0x5ad014){var _0x5ecdb2;var _0x1775d8=escapeRegExp(_0x51b0cb['trim']()[_0x7f41('0x3')](/\/$/,''))[_0x7f41('0x3')]('\x5c*','([\x5cw]+)');try{new URL(_0x51b0cb[_0x7f41('0x3')]('\x5c*','localhost'));_0x5ecdb2=new RegExp(_0x1775d8)[_0x7f41('0x4')](_0x5ad014);}catch(_0x5f3a44){_0x5ecdb2=![];}return _0x5ecdb2;}module[_0x7f41('0x5')]={'testWebsiteWithWildcard':testWebsiteWithWildcard,'testWildcardValidity':testWildcardValidity}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index 275e53a..1afdea6 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 _0x6bb3=['create','/:id/dispositions','addDisposition','addAnswer','diskStorage','join','root','server/files/images/logos/','%s-%s','now','file','addLogo','server/files/images/avatars/','format','originalname','/:id/avatar','single','addAvatar','addCustomerAvatar','/:id/system_avatar','addSystemAvatar','notify','attachments','offline-chat','ensureDir','extname','replace','offline','addInteraction','addApplications','addAgents','put','update','delete','removeDispositions','removeAnswers','removeAgents','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','isAuthenticated','/describe','describe','/:id','getDispositions','/:id/canned_answers','getAnswers','/:id/logo','getLogo','getAvatar','/:id/customer_avatar','getSystemAvatar','getInteractions','getSnippet','/:id/applications','/:id/proactive_actions','getProactiveActions','/:id/fields','/:id/offline_messages','getOfflineMessages','/:id/users','getAgents','post'];(function(_0x12c4cd,_0xdebe29){var _0x18a029=function(_0x4c4272){while(--_0x4c4272){_0x12c4cd['push'](_0x12c4cd['shift']());}};_0x18a029(++_0xdebe29);}(_0x6bb3,0x142));var _0x36bb=function(_0x36641f,_0x1de996){_0x36641f=_0x36641f-0x0;var _0x264197=_0x6bb3[_0x36641f];return _0x264197;};'use strict';var multer=require('multer');var util=require(_0x36bb('0x0'));var path=require('path');var timeout=require(_0x36bb('0x1'));var express=require(_0x36bb('0x2'));var router=express[_0x36bb('0x3')]();var fs_extra=require(_0x36bb('0x4'));var auth=require(_0x36bb('0x5'));var interaction=require(_0x36bb('0x6'));var config=require(_0x36bb('0x7'));var controller=require(_0x36bb('0x8'));router[_0x36bb('0x9')]('/',auth[_0x36bb('0xa')](),controller['index']);router[_0x36bb('0x9')](_0x36bb('0xb'),auth[_0x36bb('0xa')](),controller[_0x36bb('0xc')]);router[_0x36bb('0x9')](_0x36bb('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x36bb('0x9')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x36bb('0xe')]);router[_0x36bb('0x9')](_0x36bb('0xf'),auth[_0x36bb('0xa')](),controller[_0x36bb('0x10')]);router[_0x36bb('0x9')](_0x36bb('0x11'),controller[_0x36bb('0x12')]);router[_0x36bb('0x9')]('/:id/avatar',controller[_0x36bb('0x13')]);router['get'](_0x36bb('0x14'),controller['getCustomerAvatar']);router['get']('/:id/system_avatar',controller[_0x36bb('0x15')]);router['get']('/:id/interactions',auth['isAuthenticated'](),controller[_0x36bb('0x16')]);router[_0x36bb('0x9')]('/:id/snippet',controller[_0x36bb('0x17')]);router['get'](_0x36bb('0x18'),auth[_0x36bb('0xa')](),controller['getApplications']);router[_0x36bb('0x9')](_0x36bb('0x19'),auth[_0x36bb('0xa')](),controller[_0x36bb('0x1a')]);router[_0x36bb('0x9')](_0x36bb('0x1b'),controller['getFields']);router[_0x36bb('0x9')](_0x36bb('0x1c'),auth[_0x36bb('0xa')](),controller[_0x36bb('0x1d')]);router[_0x36bb('0x9')](_0x36bb('0x1e'),auth[_0x36bb('0xa')](),controller[_0x36bb('0x1f')]);router[_0x36bb('0x20')]('/',auth[_0x36bb('0xa')](),controller[_0x36bb('0x21')]);router[_0x36bb('0x20')](_0x36bb('0x22'),auth['isAuthenticated'](),controller[_0x36bb('0x23')]);router[_0x36bb('0x20')]('/:id/canned_answers',auth[_0x36bb('0xa')](),controller[_0x36bb('0x24')]);var upload=multer({'storage':multer[_0x36bb('0x25')]({'destination':function(_0x2db83f,_0x2789a4,_0x20031e){_0x20031e(null,path[_0x36bb('0x26')](config[_0x36bb('0x27')],_0x36bb('0x28')));},'filename':function(_0x3e7ecc,_0x2cb669,_0x5e7152){_0x5e7152(null,util['format'](_0x36bb('0x29'),Date[_0x36bb('0x2a')](),_0x2cb669['originalname']));}})});router[_0x36bb('0x20')](_0x36bb('0x11'),upload['single'](_0x36bb('0x2b')),controller[_0x36bb('0x2c')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xf21f61,_0xff0c13,_0x5b33be){_0x5b33be(null,path[_0x36bb('0x26')](config[_0x36bb('0x27')],_0x36bb('0x2d')));},'filename':function(_0x1cec0b,_0x465170,_0x3eb143){_0x3eb143(null,util[_0x36bb('0x2e')](_0x36bb('0x29'),Date[_0x36bb('0x2a')](),_0x465170[_0x36bb('0x2f')]));}})});router[_0x36bb('0x20')](_0x36bb('0x30'),upload[_0x36bb('0x31')](_0x36bb('0x2b')),controller[_0x36bb('0x32')]);var upload=multer({'storage':multer[_0x36bb('0x25')]({'destination':function(_0x20faeb,_0x265e52,_0x372801){_0x372801(null,path[_0x36bb('0x26')](config[_0x36bb('0x27')],_0x36bb('0x2d')));},'filename':function(_0xf7c36c,_0x44353a,_0x1aecbc){_0x1aecbc(null,util[_0x36bb('0x2e')](_0x36bb('0x29'),Date[_0x36bb('0x2a')](),_0x44353a[_0x36bb('0x2f')]));}})});router[_0x36bb('0x20')]('/:id/customer_avatar',upload['single'](_0x36bb('0x2b')),controller[_0x36bb('0x33')]);var upload=multer({'storage':multer[_0x36bb('0x25')]({'destination':function(_0x5dc791,_0x16af64,_0x44b9fc){_0x44b9fc(null,path[_0x36bb('0x26')](config[_0x36bb('0x27')],'server/files/images/avatars/'));},'filename':function(_0x4ffa58,_0x551d3b,_0x2c2131){_0x2c2131(null,util['format'](_0x36bb('0x29'),Date[_0x36bb('0x2a')](),_0x551d3b[_0x36bb('0x2f')]));}})});router[_0x36bb('0x20')](_0x36bb('0x34'),upload[_0x36bb('0x31')](_0x36bb('0x2b')),controller[_0x36bb('0x35')]);router['post']('/:id/notify',controller[_0x36bb('0x36')]);const offlineUploadMulter=multer({'storage':multer[_0x36bb('0x25')]({'destination':function(_0x52c40b,_0x4492a6,_0x6ac561){const _0xfaa7b2=path[_0x36bb('0x26')](config[_0x36bb('0x27')],'server/files',_0x36bb('0x37'),_0x36bb('0x38'));fs_extra[_0x36bb('0x39')](_0xfaa7b2,function(){_0x6ac561(null,_0xfaa7b2);});},'filename':function(_0x476868,_0x2b1cad,_0x264579){const _0x286bba=_0x2b1cad['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x28da9f=path[_0x36bb('0x3a')](_0x286bba);const _0x15efb2=Date[_0x36bb('0x2a')]()+'-'+_0x286bba[_0x36bb('0x3b')](_0x28da9f,'')+_0x28da9f;_0x264579(null,_0x15efb2);}})});router['post']('/:id/offline',offlineUploadMulter['any'](),controller[_0x36bb('0x3c')]);router[_0x36bb('0x20')]('/:id/interactions',auth['isAuthenticated'](),controller[_0x36bb('0x3d')]);router['post'](_0x36bb('0x18'),auth[_0x36bb('0xa')](),controller[_0x36bb('0x3e')]);router[_0x36bb('0x20')](_0x36bb('0x19'),auth[_0x36bb('0xa')](),controller['addProactiveActions']);router['post'](_0x36bb('0x1e'),auth[_0x36bb('0xa')](),controller[_0x36bb('0x3f')]);router[_0x36bb('0x40')]('/:id',auth['isAuthenticated'](),controller[_0x36bb('0x41')]);router[_0x36bb('0x42')](_0x36bb('0xd'),auth[_0x36bb('0xa')](),controller['destroy']);router[_0x36bb('0x42')]('/:id/dispositions',auth[_0x36bb('0xa')](),controller[_0x36bb('0x43')]);router['delete'](_0x36bb('0xf'),auth[_0x36bb('0xa')](),controller[_0x36bb('0x44')]);router['delete'](_0x36bb('0x1e'),auth[_0x36bb('0xa')](),controller[_0x36bb('0x45')]);module[_0x36bb('0x46')]=router; \ No newline at end of file +var _0x4a3f=['/:id/avatar','/:id/customer_avatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','getSnippet','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','getFields','/:id/offline_messages','getOfflineMessages','/:id/users','getAgents','post','addAnswer','diskStorage','root','server/files/images/logos/','format','%s-%s','originalname','/:id/logo','single','file','addLogo','server/files/images/avatars/','now','addAvatar','join','addSystemAvatar','/:id/notify','notify','server/files','attachments','offline-chat','ensureDir','replace','extname','/:id/offline','any','addInteraction','addAgents','update','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatWebsite.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','getLogo'];(function(_0x291110,_0x37822a){var _0x26e2e6=function(_0x1980eb){while(--_0x1980eb){_0x291110['push'](_0x291110['shift']());}};_0x26e2e6(++_0x37822a);}(_0x4a3f,0x80));var _0xf4a3=function(_0x5ff464,_0x5038d7){_0x5ff464=_0x5ff464-0x0;var _0x347182=_0x4a3f[_0x5ff464];return _0x347182;};'use strict';var multer=require(_0xf4a3('0x0'));var util=require(_0xf4a3('0x1'));var path=require(_0xf4a3('0x2'));var timeout=require(_0xf4a3('0x3'));var express=require(_0xf4a3('0x4'));var router=express[_0xf4a3('0x5')]();var fs_extra=require(_0xf4a3('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xf4a3('0x7'));var config=require(_0xf4a3('0x8'));var controller=require(_0xf4a3('0x9'));router[_0xf4a3('0xa')]('/',auth[_0xf4a3('0xb')](),controller[_0xf4a3('0xc')]);router['get'](_0xf4a3('0xd'),auth[_0xf4a3('0xb')](),controller[_0xf4a3('0xe')]);router[_0xf4a3('0xa')](_0xf4a3('0xf'),auth[_0xf4a3('0xb')](),controller[_0xf4a3('0x10')]);router[_0xf4a3('0xa')](_0xf4a3('0x11'),auth[_0xf4a3('0xb')](),controller[_0xf4a3('0x12')]);router[_0xf4a3('0xa')](_0xf4a3('0x13'),auth[_0xf4a3('0xb')](),controller[_0xf4a3('0x14')]);router['get']('/:id/logo',controller[_0xf4a3('0x15')]);router[_0xf4a3('0xa')](_0xf4a3('0x16'),controller['getAvatar']);router[_0xf4a3('0xa')](_0xf4a3('0x17'),controller['getCustomerAvatar']);router[_0xf4a3('0xa')](_0xf4a3('0x18'),controller[_0xf4a3('0x19')]);router[_0xf4a3('0xa')](_0xf4a3('0x1a'),auth[_0xf4a3('0xb')](),controller[_0xf4a3('0x1b')]);router[_0xf4a3('0xa')](_0xf4a3('0x1c'),controller[_0xf4a3('0x1d')]);router['get'](_0xf4a3('0x1e'),auth[_0xf4a3('0xb')](),controller[_0xf4a3('0x1f')]);router[_0xf4a3('0xa')](_0xf4a3('0x20'),auth['isAuthenticated'](),controller[_0xf4a3('0x21')]);router[_0xf4a3('0xa')](_0xf4a3('0x22'),controller[_0xf4a3('0x23')]);router[_0xf4a3('0xa')](_0xf4a3('0x24'),auth['isAuthenticated'](),controller[_0xf4a3('0x25')]);router['get'](_0xf4a3('0x26'),auth['isAuthenticated'](),controller[_0xf4a3('0x27')]);router[_0xf4a3('0x28')]('/',auth[_0xf4a3('0xb')](),controller['create']);router[_0xf4a3('0x28')](_0xf4a3('0x11'),auth[_0xf4a3('0xb')](),controller['addDisposition']);router[_0xf4a3('0x28')](_0xf4a3('0x13'),auth[_0xf4a3('0xb')](),controller[_0xf4a3('0x29')]);var upload=multer({'storage':multer[_0xf4a3('0x2a')]({'destination':function(_0x3463e5,_0x111cb2,_0x26796a){_0x26796a(null,path['join'](config[_0xf4a3('0x2b')],_0xf4a3('0x2c')));},'filename':function(_0x454973,_0x2cbaa5,_0x56a251){_0x56a251(null,util[_0xf4a3('0x2d')](_0xf4a3('0x2e'),Date['now'](),_0x2cbaa5[_0xf4a3('0x2f')]));}})});router[_0xf4a3('0x28')](_0xf4a3('0x30'),upload[_0xf4a3('0x31')](_0xf4a3('0x32')),controller[_0xf4a3('0x33')]);var upload=multer({'storage':multer[_0xf4a3('0x2a')]({'destination':function(_0x13ecfe,_0x54a6c3,_0x64d9ad){_0x64d9ad(null,path['join'](config['root'],_0xf4a3('0x34')));},'filename':function(_0x2a1462,_0xff4918,_0x3d94b9){_0x3d94b9(null,util[_0xf4a3('0x2d')]('%s-%s',Date[_0xf4a3('0x35')](),_0xff4918[_0xf4a3('0x2f')]));}})});router[_0xf4a3('0x28')]('/:id/avatar',upload['single'](_0xf4a3('0x32')),controller[_0xf4a3('0x36')]);var upload=multer({'storage':multer[_0xf4a3('0x2a')]({'destination':function(_0x1328d9,_0x421e44,_0x3047a0){_0x3047a0(null,path[_0xf4a3('0x37')](config[_0xf4a3('0x2b')],_0xf4a3('0x34')));},'filename':function(_0x146a5c,_0x3d5bd9,_0x35e515){_0x35e515(null,util['format'](_0xf4a3('0x2e'),Date[_0xf4a3('0x35')](),_0x3d5bd9[_0xf4a3('0x2f')]));}})});router[_0xf4a3('0x28')]('/:id/customer_avatar',upload['single'](_0xf4a3('0x32')),controller['addCustomerAvatar']);var upload=multer({'storage':multer[_0xf4a3('0x2a')]({'destination':function(_0x208729,_0x42ef39,_0x5be004){_0x5be004(null,path[_0xf4a3('0x37')](config[_0xf4a3('0x2b')],'server/files/images/avatars/'));},'filename':function(_0x327357,_0x2c40f9,_0x103c8a){_0x103c8a(null,util[_0xf4a3('0x2d')](_0xf4a3('0x2e'),Date[_0xf4a3('0x35')](),_0x2c40f9[_0xf4a3('0x2f')]));}})});router['post'](_0xf4a3('0x18'),upload[_0xf4a3('0x31')](_0xf4a3('0x32')),controller[_0xf4a3('0x38')]);router[_0xf4a3('0x28')](_0xf4a3('0x39'),controller[_0xf4a3('0x3a')]);const offlineUploadMulter=multer({'storage':multer['diskStorage']({'destination':function(_0x28341d,_0x94427a,_0x3b52af){const _0x316d64=path[_0xf4a3('0x37')](config[_0xf4a3('0x2b')],_0xf4a3('0x3b'),_0xf4a3('0x3c'),_0xf4a3('0x3d'));fs_extra[_0xf4a3('0x3e')](_0x316d64,function(){_0x3b52af(null,_0x316d64);});},'filename':function(_0x153dae,_0x1b7725,_0x5cf629){const _0x599880=_0x1b7725[_0xf4a3('0x2f')][_0xf4a3('0x3f')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x4a8148=path[_0xf4a3('0x40')](_0x599880);const _0x487332=Date[_0xf4a3('0x35')]()+'-'+_0x599880[_0xf4a3('0x3f')](_0x4a8148,'')+_0x4a8148;_0x5cf629(null,_0x487332);}})});router[_0xf4a3('0x28')](_0xf4a3('0x41'),offlineUploadMulter[_0xf4a3('0x42')](),controller['offline']);router[_0xf4a3('0x28')](_0xf4a3('0x1a'),auth[_0xf4a3('0xb')](),controller[_0xf4a3('0x43')]);router[_0xf4a3('0x28')](_0xf4a3('0x1e'),auth['isAuthenticated'](),controller['addApplications']);router[_0xf4a3('0x28')](_0xf4a3('0x20'),auth[_0xf4a3('0xb')](),controller['addProactiveActions']);router[_0xf4a3('0x28')](_0xf4a3('0x26'),auth[_0xf4a3('0xb')](),controller[_0xf4a3('0x44')]);router['put'](_0xf4a3('0xf'),auth[_0xf4a3('0xb')](),controller[_0xf4a3('0x45')]);router[_0xf4a3('0x46')](_0xf4a3('0xf'),auth[_0xf4a3('0xb')](),controller['destroy']);router[_0xf4a3('0x46')](_0xf4a3('0x11'),auth['isAuthenticated'](),controller[_0xf4a3('0x47')]);router['delete']('/:id/canned_answers',auth[_0xf4a3('0xb')](),controller[_0xf4a3('0x48')]);router[_0xf4a3('0x46')]('/:id/users',auth[_0xf4a3('0xb')](),controller[_0xf4a3('0x49')]);module[_0xf4a3('0x4a')]=router; \ No newline at end of file diff --git a/server/api/client-side-logs.js b/server/api/client-side-logs.js index a471dec..7911d1b 100644 --- a/server/api/client-side-logs.js +++ b/server/api/client-side-logs.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4065=['/client-logs','use','isAuthenticated','exports','beaver-logger/server','express','../components/auth/service','Router','env','production','get','client-side-logger','Client-Side\x20logger\x20not\x20found!','expressEndpoint'];(function(_0x1ccdf7,_0x215d5a){var _0x52a0ae=function(_0x40324a){while(--_0x40324a){_0x1ccdf7['push'](_0x1ccdf7['shift']());}};_0x52a0ae(++_0x215d5a);}(_0x4065,0xc8));var _0x5406=function(_0x292e70,_0x4ec903){_0x292e70=_0x292e70-0x0;var _0x507abb=_0x4065[_0x292e70];return _0x507abb;};var beaverLogger=require(_0x5406('0x0'));var express=require(_0x5406('0x1'));var auth=require(_0x5406('0x2'));var config=require('../config/environment');var router=express[_0x5406('0x3')]();var isProduction=config[_0x5406('0x4')]===_0x5406('0x5')||![];function clientSideLogs(_0x3b5e62,_0xb7b26b,_0x1818c9){var _0x496b42=_0x3b5e62['app'][_0x5406('0x6')](_0x5406('0x7'));if(!_0x496b42){throw new Error(_0x5406('0x8'));}return beaverLogger[_0x5406('0x9')]({'uri':_0x5406('0xa'),'logger':_0x496b42,'enableCors':!isProduction})(_0x3b5e62,_0xb7b26b,_0x1818c9);}router[_0x5406('0xb')](auth[_0x5406('0xc')](),clientSideLogs);module[_0x5406('0xd')]=router; \ No newline at end of file +var _0xdb56=['beaver-logger/server','express','../components/auth/service','../config/environment','Router','env','production','client-side-logger','Client-Side\x20logger\x20not\x20found!','expressEndpoint','isAuthenticated','exports'];(function(_0x357803,_0x553e69){var _0x4c2fc9=function(_0x24cdb6){while(--_0x24cdb6){_0x357803['push'](_0x357803['shift']());}};_0x4c2fc9(++_0x553e69);}(_0xdb56,0x1a4));var _0x6db5=function(_0x1bdcc8,_0x519d7c){_0x1bdcc8=_0x1bdcc8-0x0;var _0x1141bf=_0xdb56[_0x1bdcc8];return _0x1141bf;};var beaverLogger=require(_0x6db5('0x0'));var express=require(_0x6db5('0x1'));var auth=require(_0x6db5('0x2'));var config=require(_0x6db5('0x3'));var router=express[_0x6db5('0x4')]();var isProduction=config[_0x6db5('0x5')]===_0x6db5('0x6')||![];function clientSideLogs(_0x51eba4,_0x2abac9,_0x393e2d){var _0x52ee73=_0x51eba4['app']['get'](_0x6db5('0x7'));if(!_0x52ee73){throw new Error(_0x6db5('0x8'));}return beaverLogger[_0x6db5('0x9')]({'uri':'/client-logs','logger':_0x52ee73,'enableCors':!isProduction})(_0x51eba4,_0x2abac9,_0x393e2d);}router['use'](auth[_0x6db5('0xa')](),clientSideLogs);module[_0x6db5('0xb')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index 35ffea4..c2fe968 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 _0x03ad=['MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','sequelize','STRING','ENUM','AmazonAWS','Google','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret','MicrosoftAzure\x20=>\x20access_token','TEXT','MicrosoftAzure\x20=>\x20refresh_token'];(function(_0x5ed475,_0x3a75b9){var _0x543d0e=function(_0xbd2a0a){while(--_0xbd2a0a){_0x5ed475['push'](_0x5ed475['shift']());}};_0x543d0e(++_0x3a75b9);}(_0x03ad,0xe5));var _0xd03a=function(_0x2d093b,_0x460963){_0x2d093b=_0x2d093b-0x0;var _0x1abe4e=_0x03ad[_0x2d093b];return _0x1abe4e;};'use strict';var Sequelize=require(_0xd03a('0x0'));module['exports']={'name':{'type':Sequelize[_0xd03a('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0xd03a('0x2')](_0xd03a('0x3'),_0xd03a('0x4'),'MicrosoftAzure'),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0xd03a('0x2')]('Outlook365','Dynamics365')},'data1':{'type':Sequelize[_0xd03a('0x1')],'comment':_0xd03a('0x5')},'data2':{'type':Sequelize[_0xd03a('0x1')],'comment':_0xd03a('0x6')},'data3':{'type':Sequelize['STRING'],'comment':_0xd03a('0x7')},'data4':{'type':Sequelize[_0xd03a('0x1')],'comment':'MicrosoftAzure\x20=>\x20redirect_uri'},'data5':{'type':Sequelize['TEXT'],'comment':_0xd03a('0x8')},'data6':{'type':Sequelize[_0xd03a('0x9')],'comment':_0xd03a('0xa')},'data7':{'type':Sequelize[_0xd03a('0x9')],'comment':_0xd03a('0xb')}}; \ No newline at end of file +var _0x68bd=['ENUM','AmazonAWS','MicrosoftAzure','Dynamics365','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20tenant','STRING','MicrosoftAzure\x20=>\x20client_secret','MicrosoftAzure\x20=>\x20redirect_uri','MicrosoftAzure\x20=>\x20access_token','TEXT','MicrosoftAzure\x20=>\x20refresh_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','sequelize','exports'];(function(_0x2aa0e7,_0x4e5145){var _0x1472c0=function(_0x4deaeb){while(--_0x4deaeb){_0x2aa0e7['push'](_0x2aa0e7['shift']());}};_0x1472c0(++_0x4e5145);}(_0x68bd,0x166));var _0xd68b=function(_0x219772,_0x329feb){_0x219772=_0x219772-0x0;var _0x1865e2=_0x68bd[_0x219772];return _0x1865e2;};'use strict';var Sequelize=require(_0xd68b('0x0'));module[_0xd68b('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0xd68b('0x2')](_0xd68b('0x3'),'Google',_0xd68b('0x4')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0xd68b('0x2')]('Outlook365',_0xd68b('0x5'))},'data1':{'type':Sequelize['STRING'],'comment':_0xd68b('0x6')},'data2':{'type':Sequelize['STRING'],'comment':_0xd68b('0x7')},'data3':{'type':Sequelize[_0xd68b('0x8')],'comment':_0xd68b('0x9')},'data4':{'type':Sequelize[_0xd68b('0x8')],'comment':_0xd68b('0xa')},'data5':{'type':Sequelize['TEXT'],'comment':_0xd68b('0xb')},'data6':{'type':Sequelize[_0xd68b('0xc')],'comment':_0xd68b('0xd')},'data7':{'type':Sequelize[_0xd68b('0xc')],'comment':_0xd68b('0xe')}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index 37d96a9..b59e095 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 _0x5178=['oauth2MicrosoftAuthorize','findOne','generateMicrosoftAuthorizationUrl','oauth2MicrosoftCallback','state','Invalid\x20state\x20parameter','parse','from','base64','isValidIdToken','id_token','oauth2Claims','Unable\x20to\x20validate\x20id_token','getOauth2MicrosoftAccessToken','code','access_token','data6','refresh_token','data5','emit','message','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','stringify','ioredis','../../components/parsers/qs','../../components/encryptor','../../config/environment','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','end','status','json','offset','undefined','limit','Content-Range','update','then','error','stack','send','map','CloudProvider','fieldName','type','model','name','query','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','service','MicrosoftAzure','data3','catch','show','params','keys','rawAttributes','filters','find','decryptString','create','body','values','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','encryptString','destroy'];(function(_0x17ccc0,_0x9c3b80){var _0x1f1dd3=function(_0x5406b8){while(--_0x5406b8){_0x17ccc0['push'](_0x17ccc0['shift']());}};_0x1f1dd3(++_0x9c3b80);}(_0x5178,0x17b));var _0x8517=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x5178[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var Redis=require(_0x8517('0x0'));var qs=require(_0x8517('0x1'));var encryptor=require(_0x8517('0x2'));var config=require(_0x8517('0x3'));var logger=require(_0x8517('0x4'))(_0x8517('0x5'));var db=require(_0x8517('0x6'))['db'];var oauth=require('./cloudProvider.oauth');config[_0x8517('0x7')]=_[_0x8517('0x8')](config[_0x8517('0x7')],{'host':_0x8517('0x9'),'port':0x18eb});var socket=require(_0x8517('0xa'))(new Redis(config[_0x8517('0x7')]));var redis=new Redis(config[_0x8517('0x7')]);function respondWithStatusCode(_0x32ed0c,_0x3514c1){_0x3514c1=_0x3514c1||0xcc;return function(_0x2f249c){if(_0x2f249c){return _0x32ed0c[_0x8517('0xb')](_0x3514c1);}return _0x32ed0c['status'](_0x3514c1)[_0x8517('0xc')]();};}function respondWithResult(_0x1dfeeb,_0x285d03){_0x285d03=_0x285d03||0xc8;return function(_0x11dbd1){if(_0x11dbd1){return _0x1dfeeb[_0x8517('0xd')](_0x285d03)[_0x8517('0xe')](_0x11dbd1);}};}function respondWithFilteredResult(_0x5b7fdc,_0x2f1749){return function(_0x800736){if(_0x800736){var _0x548e1c=typeof _0x2f1749[_0x8517('0xf')]===_0x8517('0x10')&&typeof _0x2f1749[_0x8517('0x11')]===_0x8517('0x10');var _0x10f69f=_0x800736['count'];var _0x42ea53=_0x548e1c?0x0:_0x2f1749[_0x8517('0xf')];var _0xd0b60f=_0x548e1c?_0x800736['count']:_0x2f1749[_0x8517('0xf')]+_0x2f1749[_0x8517('0x11')];var _0x2ef334;if(_0xd0b60f>=_0x10f69f){_0xd0b60f=_0x10f69f;_0x2ef334=0xc8;}else{_0x2ef334=0xce;}_0x5b7fdc[_0x8517('0xd')](_0x2ef334);return _0x5b7fdc['set'](_0x8517('0x12'),_0x42ea53+'-'+_0xd0b60f+'/'+_0x10f69f)['json'](_0x800736);}return null;};}function saveUpdates(_0x35da83){return function(_0x393994){if(_0x393994){return _0x393994[_0x8517('0x13')](_0x35da83)[_0x8517('0x14')](function(_0x2846b7){return _0x2846b7;});}return null;};}function removeEntity(_0x374903){return function(_0x36feaf){if(_0x36feaf){return _0x36feaf['destroy']()[_0x8517('0x14')](function(){_0x374903[_0x8517('0xd')](0xcc)[_0x8517('0xc')]();});}};}function handleEntityNotFound(_0x2adfe3){return function(_0x48d882){if(!_0x48d882){_0x2adfe3[_0x8517('0xb')](0x194);}return _0x48d882;};}function handleError(_0x392bc8,_0x18b523){_0x18b523=_0x18b523||0x1f4;return function(_0x337c42){logger[_0x8517('0x15')](_0x337c42[_0x8517('0x16')]);if(_0x337c42['name']){delete _0x337c42['name'];}_0x392bc8[_0x8517('0xd')](_0x18b523)[_0x8517('0x17')](_0x337c42);};}function maskClientSecret(_0xba24f9){return _['padEnd'](_0xba24f9['slice'](0x0,0x3),0x14,'*');}exports['index']=function(_0x475a9c,_0x31120c){var _0x290e7c={},_0x365182={},_0x5399ba={'count':0x0,'rows':[]};var _0x4c4415=_[_0x8517('0x18')](db[_0x8517('0x19')]['rawAttributes'],function(_0x45c102){return{'name':_0x45c102[_0x8517('0x1a')],'type':_0x45c102[_0x8517('0x1b')]['key']};});_0x365182[_0x8517('0x1c')]=_['map'](_0x4c4415,_0x8517('0x1d'));_0x365182['query']=_['keys'](_0x475a9c[_0x8517('0x1e')]);_0x365182['filters']=_[_0x8517('0x1f')](_0x365182[_0x8517('0x1c')],_0x365182[_0x8517('0x1e')]);_0x290e7c[_0x8517('0x20')]=_[_0x8517('0x1f')](_0x365182[_0x8517('0x1c')],qs[_0x8517('0x21')](_0x475a9c[_0x8517('0x1e')][_0x8517('0x21')]));_0x290e7c['attributes']=_0x290e7c['attributes'][_0x8517('0x22')]?_0x290e7c[_0x8517('0x20')]:_0x365182['model'];if(!_0x475a9c[_0x8517('0x1e')]['hasOwnProperty'](_0x8517('0x23'))){_0x290e7c['limit']=qs[_0x8517('0x11')](_0x475a9c[_0x8517('0x1e')][_0x8517('0x11')]);_0x290e7c[_0x8517('0xf')]=qs['offset'](_0x475a9c[_0x8517('0x1e')][_0x8517('0xf')]);}_0x290e7c['order']=qs[_0x8517('0x24')](_0x475a9c[_0x8517('0x1e')][_0x8517('0x24')]);_0x290e7c[_0x8517('0x25')]=qs['filters'](_[_0x8517('0x26')](_0x475a9c[_0x8517('0x1e')],_0x365182['filters']),_0x4c4415);if(_0x475a9c['query'][_0x8517('0x27')]){_0x290e7c[_0x8517('0x25')]=_[_0x8517('0x28')](_0x290e7c['where'],{'$or':_[_0x8517('0x18')](_0x4c4415,function(_0x52fa99){if(_0x52fa99[_0x8517('0x1b')]!==_0x8517('0x29')){var _0x17012d={};_0x17012d[_0x52fa99[_0x8517('0x1d')]]={'$like':'%'+_0x475a9c[_0x8517('0x1e')][_0x8517('0x27')]+'%'};return _0x17012d;}})});}_0x290e7c=_[_0x8517('0x28')]({},_0x290e7c,_0x475a9c[_0x8517('0x2a')]);var _0x2ef168={'where':_0x290e7c[_0x8517('0x25')]};return db['CloudProvider'][_0x8517('0x2b')](_0x2ef168)[_0x8517('0x14')](function(_0x262cec){_0x5399ba['count']=_0x262cec;if(_0x475a9c[_0x8517('0x1e')][_0x8517('0x2c')]){_0x290e7c[_0x8517('0x2d')]=[{'all':!![]}];}return db[_0x8517('0x19')][_0x8517('0x2e')](_0x290e7c);})[_0x8517('0x14')](function(_0x152c54){_0x5399ba['rows']=_[_0x8517('0x18')](_0x152c54,function(_0x1c8183){if(_0x1c8183[_0x8517('0x2f')]===_0x8517('0x30')){var _0x461376=encryptor['decryptString'](_0x1c8183[_0x8517('0x31')]);_0x1c8183['data3']=maskClientSecret(_0x461376);}return _0x1c8183;});return _0x5399ba;})[_0x8517('0x14')](respondWithFilteredResult(_0x31120c,_0x290e7c))[_0x8517('0x32')](handleError(_0x31120c,null));};exports[_0x8517('0x33')]=function(_0x23c9b8,_0xc6ab81){var _0x4b1b6d={'raw':!![],'where':{'id':_0x23c9b8[_0x8517('0x34')]['id']}},_0x3cb45a={};_0x3cb45a[_0x8517('0x1c')]=_[_0x8517('0x35')](db['CloudProvider'][_0x8517('0x36')]);_0x3cb45a[_0x8517('0x1e')]=_[_0x8517('0x35')](_0x23c9b8['query']);_0x3cb45a[_0x8517('0x37')]=_[_0x8517('0x1f')](_0x3cb45a['model'],_0x3cb45a[_0x8517('0x1e')]);_0x4b1b6d[_0x8517('0x20')]=_[_0x8517('0x1f')](_0x3cb45a[_0x8517('0x1c')],qs['fields'](_0x23c9b8[_0x8517('0x1e')][_0x8517('0x21')]));_0x4b1b6d[_0x8517('0x20')]=_0x4b1b6d[_0x8517('0x20')][_0x8517('0x22')]?_0x4b1b6d[_0x8517('0x20')]:_0x3cb45a[_0x8517('0x1c')];if(_0x23c9b8[_0x8517('0x1e')][_0x8517('0x2c')]){_0x4b1b6d[_0x8517('0x2d')]=[{'all':!![]}];}_0x4b1b6d=_[_0x8517('0x28')]({},_0x4b1b6d,_0x23c9b8[_0x8517('0x2a')]);return db[_0x8517('0x19')][_0x8517('0x38')](_0x4b1b6d)[_0x8517('0x14')](handleEntityNotFound(_0xc6ab81,null))[_0x8517('0x14')](function(_0x22830d){if(_0x22830d['service']===_0x8517('0x30')){var _0x16dd08=encryptor[_0x8517('0x39')](_0x22830d[_0x8517('0x31')]);_0x22830d[_0x8517('0x31')]=maskClientSecret(_0x16dd08);}return _0x22830d;})['then'](respondWithResult(_0xc6ab81,null))['catch'](handleError(_0xc6ab81,null));};exports[_0x8517('0x3a')]=function(_0x596da1,_0x49ce35){if(!_0x596da1[_0x8517('0x3b')][_0x8517('0x1d')])throw new Error('Name\x20parameter\x20not\x20specified');if(!_0x596da1[_0x8517('0x3b')][_0x8517('0x2f')])throw new Error('Service\x20parameter\x20not\x20specified');var _0x4a52a3=db[_0x8517('0x19')]['rawAttributes']['service'][_0x8517('0x3c')];if(!_0x4a52a3[_0x8517('0x3d')](_0x596da1['body'][_0x8517('0x2f')]))throw new Error(_0x8517('0x3e')+_0x4a52a3[_0x8517('0x3f')](',\x20'));if(_0x596da1[_0x8517('0x3b')]['service']===_0x8517('0x30')&&_0x596da1[_0x8517('0x3b')][_0x8517('0x31')]){_0x596da1[_0x8517('0x3b')][_0x8517('0x31')]=encryptor['encryptString'](_0x596da1['body'][_0x8517('0x31')]);}return db[_0x8517('0x19')][_0x8517('0x3a')](_0x596da1[_0x8517('0x3b')],{})[_0x8517('0x14')](respondWithResult(_0x49ce35,0xc9))[_0x8517('0x32')](handleError(_0x49ce35,null));};exports[_0x8517('0x13')]=function(_0x13101b,_0x3129c7){if(_0x13101b['body']['id']){delete _0x13101b[_0x8517('0x3b')]['id'];}return db['CloudProvider'][_0x8517('0x38')]({'where':{'id':_0x13101b['params']['id']}})[_0x8517('0x14')](handleEntityNotFound(_0x3129c7,null))['then'](function(_0x23ed23){if(_0x23ed23[_0x8517('0x2f')]===_0x8517('0x30')&&_0x13101b[_0x8517('0x3b')]['data3']){_0x13101b[_0x8517('0x3b')]['data3']=encryptor[_0x8517('0x40')](_0x13101b[_0x8517('0x3b')][_0x8517('0x31')]);}return _0x23ed23;})[_0x8517('0x14')](saveUpdates(_0x13101b['body'],null))[_0x8517('0x14')](respondWithResult(_0x3129c7,null))[_0x8517('0x32')](handleError(_0x3129c7,null));};exports[_0x8517('0x41')]=function(_0x245bc0,_0x28de09){return db[_0x8517('0x19')][_0x8517('0x38')]({'where':{'id':_0x245bc0[_0x8517('0x34')]['id']}})['then'](handleEntityNotFound(_0x28de09,null))[_0x8517('0x14')](removeEntity(_0x28de09,null))['catch'](handleError(_0x28de09,null));};exports[_0x8517('0x42')]=function(_0x125c20,_0x48c48e){return db[_0x8517('0x19')][_0x8517('0x43')]({'where':{'id':_0x125c20['params']['id']},'raw':!![]})[_0x8517('0x14')](function(_0x437aa2){if(!_0x437aa2)return _0x48c48e[_0x8517('0xb')](0x194);return{'url':oauth[_0x8517('0x44')](_0x437aa2,_0x125c20['user']['id'])};})[_0x8517('0x14')](respondWithResult(_0x48c48e,null))[_0x8517('0x32')](handleError(_0x48c48e,null));};exports[_0x8517('0x45')]=function(_0x413d20,_0x168713){var _0x3b4ce6=_0x413d20[_0x8517('0x3b')];var _0x564283;var _0x2b9278;if(_0x3b4ce6[_0x8517('0x15')])throw _0x3b4ce6;redis['get'](_0x3b4ce6[_0x8517('0x46')])[_0x8517('0x14')](function(_0x4bba55){if(!_0x4bba55)throw new Error(_0x8517('0x47'));_0x564283=JSON[_0x8517('0x48')](_0x4bba55);var _0x46705d=Buffer[_0x8517('0x49')](_0x3b4ce6[_0x8517('0x46')],_0x8517('0x4a'))['toString']('ascii');_0x2b9278=JSON['parse'](_0x46705d);if(!oauth[_0x8517('0x4b')](_0x3b4ce6[_0x8517('0x4c')],_0x564283[_0x8517('0x4d')]))throw new Error(_0x8517('0x4e'));redis['del'](_0x3b4ce6[_0x8517('0x46')]);return oauth[_0x8517('0x4f')](_0x3b4ce6[_0x8517('0x50')],_0x564283);})[_0x8517('0x14')](function(_0x9ab90d){_0x564283['data5']=_0x9ab90d[_0x8517('0x51')];_0x564283[_0x8517('0x52')]=_0x9ab90d[_0x8517('0x53')];return db['CloudProvider']['update']({'data5':_0x564283[_0x8517('0x54')],'data6':_0x564283['data6']},{'where':{'id':_0x564283['id']}});})[_0x8517('0x14')](function(){oauth['startRefreshInterval'](_0x564283);socket[_0x8517('0x55')]('microsoftAuthorization:success',{'id':_0x2b9278['id']});return;})['then'](respondWithStatusCode(_0x168713,null))['catch'](function(_0x616a81){if(_0x2b9278){socket[_0x8517('0x55')]('microsoftAuthorization:error',{'id':_0x2b9278['id']});}if(!_0x564283){logger['error']('Invalid\x20authentication\x20state\x20parameter',_0x616a81);return _0x168713['status'](0x1f4)[_0x8517('0x17')](_0x616a81[_0x8517('0x56')]);}logger[_0x8517('0x15')](_0x8517('0x57'),_0x564283['id'],JSON[_0x8517('0x58')](_0x616a81));});}; \ No newline at end of file +var _0xb761=['Name\x20parameter\x20not\x20specified','Service\x20parameter\x20not\x20specified','rawAttributes','includes','join','encryptString','findOne','generateMicrosoftAuthorizationUrl','user','get','state','Invalid\x20state\x20parameter','parse','from','base64','isValidIdToken','id_token','oauth2Claims','Unable\x20to\x20validate\x20id_token','code','data5','access_token','refresh_token','data6','startRefreshInterval','emit','microsoftAuthorization:success','microsoftAuthorization:error','Invalid\x20authentication\x20state\x20parameter','message','stringify','lodash','ioredis','../../components/parsers/qs','../../components/encryptor','api','../../mysqldb','./cloudProvider.oauth','redis','defaults','localhost','socket.io-emitter','status','json','offset','undefined','limit','count','Content-Range','update','destroy','then','end','sendStatus','error','stack','name','send','padEnd','slice','fieldName','type','key','map','keys','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','where','merge','VIRTUAL','filter','options','includeAll','CloudProvider','findAll','rows','MicrosoftAzure','decryptString','data3','catch','show','params','find','service','create','body'];(function(_0x1e691f,_0x215f5f){var _0x5b37cb=function(_0x1ffe30){while(--_0x1ffe30){_0x1e691f['push'](_0x1e691f['shift']());}};_0x5b37cb(++_0x215f5f);}(_0xb761,0x193));var _0x1b76=function(_0x5302fb,_0x1a2db3){_0x5302fb=_0x5302fb-0x0;var _0x43e6a4=_0xb761[_0x5302fb];return _0x43e6a4;};'use strict';var _=require(_0x1b76('0x0'));var Redis=require(_0x1b76('0x1'));var qs=require(_0x1b76('0x2'));var encryptor=require(_0x1b76('0x3'));var config=require('../../config/environment');var logger=require('../../config/logger')(_0x1b76('0x4'));var db=require(_0x1b76('0x5'))['db'];var oauth=require(_0x1b76('0x6'));config[_0x1b76('0x7')]=_[_0x1b76('0x8')](config[_0x1b76('0x7')],{'host':_0x1b76('0x9'),'port':0x18eb});var socket=require(_0x1b76('0xa'))(new Redis(config['redis']));var redis=new Redis(config['redis']);function respondWithStatusCode(_0xfbe403,_0x48e8b4){_0x48e8b4=_0x48e8b4||0xcc;return function(_0x259417){if(_0x259417){return _0xfbe403['sendStatus'](_0x48e8b4);}return _0xfbe403[_0x1b76('0xb')](_0x48e8b4)['end']();};}function respondWithResult(_0x427159,_0x38ab8a){_0x38ab8a=_0x38ab8a||0xc8;return function(_0x321120){if(_0x321120){return _0x427159[_0x1b76('0xb')](_0x38ab8a)[_0x1b76('0xc')](_0x321120);}};}function respondWithFilteredResult(_0x581ce7,_0x3133d9){return function(_0x7a25c7){if(_0x7a25c7){var _0x35129a=typeof _0x3133d9[_0x1b76('0xd')]===_0x1b76('0xe')&&typeof _0x3133d9[_0x1b76('0xf')]===_0x1b76('0xe');var _0x2e7f19=_0x7a25c7[_0x1b76('0x10')];var _0x99ea0b=_0x35129a?0x0:_0x3133d9[_0x1b76('0xd')];var _0x433867=_0x35129a?_0x7a25c7['count']:_0x3133d9[_0x1b76('0xd')]+_0x3133d9['limit'];var _0x3f45db;if(_0x433867>=_0x2e7f19){_0x433867=_0x2e7f19;_0x3f45db=0xc8;}else{_0x3f45db=0xce;}_0x581ce7[_0x1b76('0xb')](_0x3f45db);return _0x581ce7['set'](_0x1b76('0x11'),_0x99ea0b+'-'+_0x433867+'/'+_0x2e7f19)['json'](_0x7a25c7);}return null;};}function saveUpdates(_0x2ad55c){return function(_0x118713){if(_0x118713){return _0x118713[_0x1b76('0x12')](_0x2ad55c)['then'](function(_0x5cd4a8){return _0x5cd4a8;});}return null;};}function removeEntity(_0x587405){return function(_0x43554d){if(_0x43554d){return _0x43554d[_0x1b76('0x13')]()[_0x1b76('0x14')](function(){_0x587405[_0x1b76('0xb')](0xcc)[_0x1b76('0x15')]();});}};}function handleEntityNotFound(_0x5de128){return function(_0x4a1a53){if(!_0x4a1a53){_0x5de128[_0x1b76('0x16')](0x194);}return _0x4a1a53;};}function handleError(_0x475313,_0x9566e4){_0x9566e4=_0x9566e4||0x1f4;return function(_0x20fa8a){logger[_0x1b76('0x17')](_0x20fa8a[_0x1b76('0x18')]);if(_0x20fa8a[_0x1b76('0x19')]){delete _0x20fa8a[_0x1b76('0x19')];}_0x475313[_0x1b76('0xb')](_0x9566e4)[_0x1b76('0x1a')](_0x20fa8a);};}function maskClientSecret(_0x5caf6a){return _[_0x1b76('0x1b')](_0x5caf6a[_0x1b76('0x1c')](0x0,0x3),0x14,'*');}exports['index']=function(_0x2a87ad,_0x55d768){var _0x93b809={},_0x35fae3={},_0x3605a8={'count':0x0,'rows':[]};var _0x282235=_['map'](db['CloudProvider']['rawAttributes'],function(_0xb17cde){return{'name':_0xb17cde[_0x1b76('0x1d')],'type':_0xb17cde[_0x1b76('0x1e')][_0x1b76('0x1f')]};});_0x35fae3['model']=_[_0x1b76('0x20')](_0x282235,'name');_0x35fae3['query']=_[_0x1b76('0x21')](_0x2a87ad[_0x1b76('0x22')]);_0x35fae3[_0x1b76('0x23')]=_[_0x1b76('0x24')](_0x35fae3[_0x1b76('0x25')],_0x35fae3[_0x1b76('0x22')]);_0x93b809[_0x1b76('0x26')]=_['intersection'](_0x35fae3[_0x1b76('0x25')],qs[_0x1b76('0x27')](_0x2a87ad['query'][_0x1b76('0x27')]));_0x93b809[_0x1b76('0x26')]=_0x93b809['attributes']['length']?_0x93b809[_0x1b76('0x26')]:_0x35fae3['model'];if(!_0x2a87ad[_0x1b76('0x22')][_0x1b76('0x28')](_0x1b76('0x29'))){_0x93b809[_0x1b76('0xf')]=qs[_0x1b76('0xf')](_0x2a87ad['query']['limit']);_0x93b809['offset']=qs[_0x1b76('0xd')](_0x2a87ad['query'][_0x1b76('0xd')]);}_0x93b809[_0x1b76('0x2a')]=qs['sort'](_0x2a87ad[_0x1b76('0x22')]['sort']);_0x93b809['where']=qs[_0x1b76('0x23')](_['pick'](_0x2a87ad[_0x1b76('0x22')],_0x35fae3['filters']),_0x282235);if(_0x2a87ad[_0x1b76('0x22')]['filter']){_0x93b809[_0x1b76('0x2b')]=_[_0x1b76('0x2c')](_0x93b809[_0x1b76('0x2b')],{'$or':_[_0x1b76('0x20')](_0x282235,function(_0x38915a){if(_0x38915a[_0x1b76('0x1e')]!==_0x1b76('0x2d')){var _0x210a61={};_0x210a61[_0x38915a[_0x1b76('0x19')]]={'$like':'%'+_0x2a87ad[_0x1b76('0x22')][_0x1b76('0x2e')]+'%'};return _0x210a61;}})});}_0x93b809=_[_0x1b76('0x2c')]({},_0x93b809,_0x2a87ad[_0x1b76('0x2f')]);var _0x368cfc={'where':_0x93b809['where']};return db['CloudProvider']['count'](_0x368cfc)[_0x1b76('0x14')](function(_0x1f6f3b){_0x3605a8['count']=_0x1f6f3b;if(_0x2a87ad[_0x1b76('0x22')][_0x1b76('0x30')]){_0x93b809['include']=[{'all':!![]}];}return db[_0x1b76('0x31')][_0x1b76('0x32')](_0x93b809);})['then'](function(_0x133a51){_0x3605a8[_0x1b76('0x33')]=_['map'](_0x133a51,function(_0x105870){if(_0x105870['service']===_0x1b76('0x34')){var _0x11735f=encryptor[_0x1b76('0x35')](_0x105870[_0x1b76('0x36')]);_0x105870[_0x1b76('0x36')]=maskClientSecret(_0x11735f);}return _0x105870;});return _0x3605a8;})[_0x1b76('0x14')](respondWithFilteredResult(_0x55d768,_0x93b809))[_0x1b76('0x37')](handleError(_0x55d768,null));};exports[_0x1b76('0x38')]=function(_0x78cadc,_0x260e25){var _0xc48214={'raw':!![],'where':{'id':_0x78cadc[_0x1b76('0x39')]['id']}},_0x3e8059={};_0x3e8059[_0x1b76('0x25')]=_[_0x1b76('0x21')](db[_0x1b76('0x31')]['rawAttributes']);_0x3e8059[_0x1b76('0x22')]=_[_0x1b76('0x21')](_0x78cadc[_0x1b76('0x22')]);_0x3e8059[_0x1b76('0x23')]=_['intersection'](_0x3e8059[_0x1b76('0x25')],_0x3e8059[_0x1b76('0x22')]);_0xc48214['attributes']=_['intersection'](_0x3e8059[_0x1b76('0x25')],qs['fields'](_0x78cadc[_0x1b76('0x22')][_0x1b76('0x27')]));_0xc48214[_0x1b76('0x26')]=_0xc48214[_0x1b76('0x26')]['length']?_0xc48214[_0x1b76('0x26')]:_0x3e8059[_0x1b76('0x25')];if(_0x78cadc[_0x1b76('0x22')][_0x1b76('0x30')]){_0xc48214['include']=[{'all':!![]}];}_0xc48214=_['merge']({},_0xc48214,_0x78cadc[_0x1b76('0x2f')]);return db[_0x1b76('0x31')][_0x1b76('0x3a')](_0xc48214)[_0x1b76('0x14')](handleEntityNotFound(_0x260e25,null))[_0x1b76('0x14')](function(_0x42af52){if(_0x42af52[_0x1b76('0x3b')]===_0x1b76('0x34')){var _0x3a5ed5=encryptor[_0x1b76('0x35')](_0x42af52['data3']);_0x42af52[_0x1b76('0x36')]=maskClientSecret(_0x3a5ed5);}return _0x42af52;})[_0x1b76('0x14')](respondWithResult(_0x260e25,null))[_0x1b76('0x37')](handleError(_0x260e25,null));};exports[_0x1b76('0x3c')]=function(_0x19d75b,_0x4620bd){if(!_0x19d75b[_0x1b76('0x3d')][_0x1b76('0x19')])throw new Error(_0x1b76('0x3e'));if(!_0x19d75b['body'][_0x1b76('0x3b')])throw new Error(_0x1b76('0x3f'));var _0x2fa10e=db[_0x1b76('0x31')][_0x1b76('0x40')][_0x1b76('0x3b')]['values'];if(!_0x2fa10e[_0x1b76('0x41')](_0x19d75b[_0x1b76('0x3d')]['service']))throw new Error('Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20'+_0x2fa10e[_0x1b76('0x42')](',\x20'));if(_0x19d75b[_0x1b76('0x3d')][_0x1b76('0x3b')]===_0x1b76('0x34')&&_0x19d75b[_0x1b76('0x3d')][_0x1b76('0x36')]){_0x19d75b[_0x1b76('0x3d')]['data3']=encryptor[_0x1b76('0x43')](_0x19d75b['body'][_0x1b76('0x36')]);}return db[_0x1b76('0x31')][_0x1b76('0x3c')](_0x19d75b[_0x1b76('0x3d')],{})[_0x1b76('0x14')](respondWithResult(_0x4620bd,0xc9))[_0x1b76('0x37')](handleError(_0x4620bd,null));};exports[_0x1b76('0x12')]=function(_0x5334d3,_0xbc56e4){if(_0x5334d3[_0x1b76('0x3d')]['id']){delete _0x5334d3[_0x1b76('0x3d')]['id'];}return db[_0x1b76('0x31')][_0x1b76('0x3a')]({'where':{'id':_0x5334d3[_0x1b76('0x39')]['id']}})['then'](handleEntityNotFound(_0xbc56e4,null))[_0x1b76('0x14')](function(_0x1686ac){if(_0x1686ac[_0x1b76('0x3b')]===_0x1b76('0x34')&&_0x5334d3[_0x1b76('0x3d')][_0x1b76('0x36')]){_0x5334d3[_0x1b76('0x3d')][_0x1b76('0x36')]=encryptor[_0x1b76('0x43')](_0x5334d3[_0x1b76('0x3d')]['data3']);}return _0x1686ac;})[_0x1b76('0x14')](saveUpdates(_0x5334d3[_0x1b76('0x3d')],null))[_0x1b76('0x14')](respondWithResult(_0xbc56e4,null))['catch'](handleError(_0xbc56e4,null));};exports[_0x1b76('0x13')]=function(_0x20abdf,_0x45a82a){return db[_0x1b76('0x31')][_0x1b76('0x3a')]({'where':{'id':_0x20abdf[_0x1b76('0x39')]['id']}})[_0x1b76('0x14')](handleEntityNotFound(_0x45a82a,null))[_0x1b76('0x14')](removeEntity(_0x45a82a,null))['catch'](handleError(_0x45a82a,null));};exports['oauth2MicrosoftAuthorize']=function(_0x4c369e,_0xcaa2eb){return db[_0x1b76('0x31')][_0x1b76('0x44')]({'where':{'id':_0x4c369e[_0x1b76('0x39')]['id']},'raw':!![]})['then'](function(_0x197dc9){if(!_0x197dc9)return _0xcaa2eb[_0x1b76('0x16')](0x194);return{'url':oauth[_0x1b76('0x45')](_0x197dc9,_0x4c369e[_0x1b76('0x46')]['id'])};})[_0x1b76('0x14')](respondWithResult(_0xcaa2eb,null))[_0x1b76('0x37')](handleError(_0xcaa2eb,null));};exports['oauth2MicrosoftCallback']=function(_0x22e5ed,_0x5c8442){var _0x426863=_0x22e5ed['body'];var _0x59c237;var _0x2a4a59;if(_0x426863[_0x1b76('0x17')])throw _0x426863;redis[_0x1b76('0x47')](_0x426863[_0x1b76('0x48')])[_0x1b76('0x14')](function(_0x17dd75){if(!_0x17dd75)throw new Error(_0x1b76('0x49'));_0x59c237=JSON[_0x1b76('0x4a')](_0x17dd75);var _0x34a163=Buffer[_0x1b76('0x4b')](_0x426863['state'],_0x1b76('0x4c'))['toString']('ascii');_0x2a4a59=JSON[_0x1b76('0x4a')](_0x34a163);if(!oauth[_0x1b76('0x4d')](_0x426863[_0x1b76('0x4e')],_0x59c237[_0x1b76('0x4f')]))throw new Error(_0x1b76('0x50'));redis['del'](_0x426863['state']);return oauth['getOauth2MicrosoftAccessToken'](_0x426863[_0x1b76('0x51')],_0x59c237);})[_0x1b76('0x14')](function(_0x410226){_0x59c237[_0x1b76('0x52')]=_0x410226[_0x1b76('0x53')];_0x59c237['data6']=_0x410226[_0x1b76('0x54')];return db[_0x1b76('0x31')][_0x1b76('0x12')]({'data5':_0x59c237[_0x1b76('0x52')],'data6':_0x59c237[_0x1b76('0x55')]},{'where':{'id':_0x59c237['id']}});})[_0x1b76('0x14')](function(){oauth[_0x1b76('0x56')](_0x59c237);socket[_0x1b76('0x57')](_0x1b76('0x58'),{'id':_0x2a4a59['id']});return;})[_0x1b76('0x14')](respondWithStatusCode(_0x5c8442,null))['catch'](function(_0x4ac67d){if(_0x2a4a59){socket[_0x1b76('0x57')](_0x1b76('0x59'),{'id':_0x2a4a59['id']});}if(!_0x59c237){logger[_0x1b76('0x17')](_0x1b76('0x5a'),_0x4ac67d);return _0x5c8442[_0x1b76('0xb')](0x1f4)[_0x1b76('0x1a')](_0x4ac67d[_0x1b76('0x5b')]);}logger['error']('Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s',_0x59c237['id'],JSON[_0x1b76('0x5c')](_0x4ac67d));});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index c3eacc2..c4a7dc7 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 _0x71d3=['./cloudProvider.attributes','exports','CloudProvider','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf'];(function(_0x2aa0f6,_0x50784f){var _0x3555e2=function(_0x29b9d4){while(--_0x29b9d4){_0x2aa0f6['push'](_0x2aa0f6['shift']());}};_0x3555e2(++_0x50784f);}(_0x71d3,0x193));var _0x371d=function(_0xc71e2a,_0x44cf5a){_0xc71e2a=_0xc71e2a-0x0;var _0x51f7ff=_0x71d3[_0xc71e2a];return _0x51f7ff;};'use strict';var _=require(_0x371d('0x0'));var util=require(_0x371d('0x1'));var logger=require(_0x371d('0x2'))('api');var moment=require('moment');var BPromise=require(_0x371d('0x3'));var rp=require(_0x371d('0x4'));var fs=require('fs');var path=require(_0x371d('0x5'));var rimraf=require(_0x371d('0x6'));var config=require('../../config/environment');var attributes=require(_0x371d('0x7'));module[_0x371d('0x8')]=function(_0x2cb80b,_0x24867b){return _0x2cb80b['define'](_0x371d('0x9'),attributes,{'tableName':'cloud_providers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1f63=['request-promise','rimraf','../../config/environment','define','cloud_providers','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x38987f,_0xc79720){var _0x4cb697=function(_0x1af5ae){while(--_0x1af5ae){_0x38987f['push'](_0x38987f['shift']());}};_0x4cb697(++_0xc79720);}(_0x1f63,0x1b2));var _0x31f6=function(_0x1590ba,_0x66d2ad){_0x1590ba=_0x1590ba-0x0;var _0xa2da41=_0x1f63[_0x1590ba];return _0xa2da41;};'use strict';var _=require(_0x31f6('0x0'));var util=require(_0x31f6('0x1'));var logger=require(_0x31f6('0x2'))(_0x31f6('0x3'));var moment=require(_0x31f6('0x4'));var BPromise=require(_0x31f6('0x5'));var rp=require(_0x31f6('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x31f6('0x7'));var config=require(_0x31f6('0x8'));var attributes=require('./cloudProvider.attributes');module['exports']=function(_0x24ad0d,_0x687318){return _0x24ad0d[_0x31f6('0x9')]('CloudProvider',attributes,{'tableName':_0x31f6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.oauth.js b/server/api/cloudProvider/cloudProvider.oauth.js index d5e5787..336541e 100644 --- a/server/api/cloudProvider/cloudProvider.oauth.js +++ b/server/api/cloudProvider/cloudProvider.oauth.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4c4b=['data6','data4','decryptString','POST','data2','data5','access_token','update','catch','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','authorization_code','intervals','bind','all','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','lodash','crypto','jsonwebtoken','ioredis','request-promise','util','../../components/encryptor','../../config/environment','api','../../config/schedule/cloud-provider','redis','defaults','localhost','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','profile','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','openid','map','type','Dynamics365','push','data7','/.default','join','Outlook365','replace','{TENANT_ID}','code','id_token','from','toString','base64','hex','data1','redirect_uri','response_mode','form_post','scope','state','nonce','prompt','login','oauth2Claims','decode','payload','iss','issuer','audience','exp','resolve','then','data3','CloudProvider','findOne','refresh_token'];(function(_0x411017,_0x4a8117){var _0x2adeea=function(_0x545222){while(--_0x545222){_0x411017['push'](_0x411017['shift']());}};_0x2adeea(++_0x4a8117);}(_0x4c4b,0x130));var _0xb4c4=function(_0x13843f,_0x50422d){_0x13843f=_0x13843f-0x0;var _0x1063ae=_0x4c4b[_0x13843f];return _0x1063ae;};'use strict';var _=require(_0xb4c4('0x0'));var crypto=require(_0xb4c4('0x1'));var jwt=require(_0xb4c4('0x2'));var moment=require('moment');var Redis=require(_0xb4c4('0x3'));var rp=require(_0xb4c4('0x4'));var util=require(_0xb4c4('0x5'));var encryptor=require(_0xb4c4('0x6'));var config=require(_0xb4c4('0x7'));var logger=require('../../config/logger')(_0xb4c4('0x8'));var schedule=require(_0xb4c4('0x9'));var db=require('../../mysqldb')['db'];config[_0xb4c4('0xa')]=_[_0xb4c4('0xb')](config[_0xb4c4('0xa')],{'host':_0xb4c4('0xc'),'port':0x18eb});var redis=new Redis(config['redis']);var MICROSOFT_AUTH_URL=_0xb4c4('0xd');var AZURE_AUTH_SCOPES={'Outlook365':['openid',_0xb4c4('0xe'),'email',_0xb4c4('0xf'),_0xb4c4('0x10'),'https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send'],'Dynamics365':[_0xb4c4('0x11'),_0xb4c4('0xf')]};var MICROSOFT_AUTH_ENDPOINT='/authorize';var MICROSOFT_TOKEN_ENDPOINT='/token';var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x4b9189){var _0x552db5=_[_0xb4c4('0x12')](AZURE_AUTH_SCOPES[_0x4b9189[_0xb4c4('0x13')]]);if(_0x4b9189[_0xb4c4('0x13')]===_0xb4c4('0x14'))_0x552db5[_0xb4c4('0x15')](_0x4b9189[_0xb4c4('0x16')]+_0xb4c4('0x17'));return _0x552db5[_0xb4c4('0x18')]('\x20');}function getAccessTokenScope(_0x1ea7aa){if(_0x1ea7aa[_0xb4c4('0x13')]===_0xb4c4('0x19'))return _0xb4c4('0x10');if(_0x1ea7aa[_0xb4c4('0x13')]===_0xb4c4('0x14'))return _0x1ea7aa[_0xb4c4('0x16')]+_0xb4c4('0x17');}function generateMicrosoftAuthorizationUrl(_0x115d2d,_0xe9f8e1){var _0x1afce8=MICROSOFT_AUTH_URL[_0xb4c4('0x1a')](_0xb4c4('0x1b'),_0x115d2d['data2']);var _0x1031f0=[_0xb4c4('0x1c'),_0xb4c4('0x1d')];var _0x264a8a=Buffer[_0xb4c4('0x1e')](JSON['stringify']({'id':_0xe9f8e1}))[_0xb4c4('0x1f')](_0xb4c4('0x20'));var _0x4bee66=crypto['randomBytes'](0x10)[_0xb4c4('0x1f')](_0xb4c4('0x21'));var _0x33c6c6=getAuthorizationScopes(_0x115d2d);var _0x1a73f2=[{'key':'client_id','value':_0x115d2d[_0xb4c4('0x22')]},{'key':'response_type','value':encodeURIComponent(_0x1031f0[_0xb4c4('0x18')]('\x20'))},{'key':_0xb4c4('0x23'),'value':_0x115d2d['data4']},{'key':_0xb4c4('0x24'),'value':_0xb4c4('0x25')},{'key':_0xb4c4('0x26'),'value':encodeURIComponent(_0x33c6c6)},{'key':_0xb4c4('0x27'),'value':_0x264a8a},{'key':_0xb4c4('0x28'),'value':_0x4bee66},{'key':_0xb4c4('0x29'),'value':_0xb4c4('0x2a')}];var _0x5c51b6=_0x1afce8+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0xb4c4('0x12')](_0x1a73f2,function(_0x54e026){return _0x54e026['key']+'='+_0x54e026['value'];})[_0xb4c4('0x18')]('&');_0x115d2d[_0xb4c4('0x2b')]={'issuer':_0x1afce8[_0xb4c4('0x1a')]('oauth2/',''),'audience':_0x115d2d[_0xb4c4('0x22')],'state':_0x264a8a,'nonce':_0x4bee66};redis['set'](_0x264a8a,JSON['stringify'](_0x115d2d));return _0x5c51b6;}function isValidIdToken(_0x4e2a0d,_0x2f66cc){try{var _0x608c06=jwt[_0xb4c4('0x2c')](_0x4e2a0d,{'complete':!![]});var _0x5e3797=_0x608c06[_0xb4c4('0x2d')];if(_0x5e3797[_0xb4c4('0x2e')]!==_0x2f66cc[_0xb4c4('0x2f')])return![];if(_0x5e3797['aud']!==_0x2f66cc[_0xb4c4('0x30')])return![];if(_0x5e3797[_0xb4c4('0x28')]!==_0x2f66cc[_0xb4c4('0x28')])return![];if(moment()['isAfter'](moment['unix'](_0x5e3797[_0xb4c4('0x31')])))return![];return!![];}catch(_0x4a83d9){throw _0x4a83d9;}}function refreshOauth2MicrosoftAccessToken(_0x503920){return Promise[_0xb4c4('0x32')]()[_0xb4c4('0x33')](function(){if(_0x503920[_0xb4c4('0x34')])return _0x503920;return db[_0xb4c4('0x35')][_0xb4c4('0x36')]({'where':{'id':_0x503920['id']},'raw':!![]});})['then'](function(_0x4e1d2b){var _0x316809={'grant_type':_0xb4c4('0x37'),'refresh_token':_0x4e1d2b[_0xb4c4('0x38')],'scope':getAccessTokenScope(_0x4e1d2b),'redirect_uri':_0x4e1d2b[_0xb4c4('0x39')],'client_id':_0x4e1d2b[_0xb4c4('0x22')],'client_secret':encryptor[_0xb4c4('0x3a')](_0x4e1d2b[_0xb4c4('0x34')])};var _0x5d8a13={'method':_0xb4c4('0x3b'),'uri':MICROSOFT_AUTH_URL[_0xb4c4('0x1a')](_0xb4c4('0x1b'),_0x4e1d2b[_0xb4c4('0x3c')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x316809,'json':!![]};return rp(_0x5d8a13);})[_0xb4c4('0x33')](function(_0x5e917f){_0x503920[_0xb4c4('0x3d')]=_0x5e917f[_0xb4c4('0x3e')];_0x503920['data6']=_0x5e917f[_0xb4c4('0x37')];return db[_0xb4c4('0x35')][_0xb4c4('0x3f')]({'data5':_0x503920[_0xb4c4('0x3d')],'data6':_0x503920['data6']},{'where':{'id':_0x503920['id']}});})['then'](function(){return _0x503920;})[_0xb4c4('0x40')](function(_0x52884a){logger[_0xb4c4('0x41')](_0xb4c4('0x42'),_0x503920['id'],_0x52884a);});}function getOauth2MicrosoftAccessToken(_0x546a3c,_0x3871a3){var _0x26483e={'grant_type':_0xb4c4('0x43'),'code':_0x546a3c,'scope':getAccessTokenScope(_0x3871a3),'redirect_uri':_0x3871a3[_0xb4c4('0x39')],'client_id':_0x3871a3[_0xb4c4('0x22')],'client_secret':encryptor['decryptString'](_0x3871a3[_0xb4c4('0x34')])};var _0x3451a3={'method':_0xb4c4('0x3b'),'uri':MICROSOFT_AUTH_URL[_0xb4c4('0x1a')]('{TENANT_ID}',_0x3871a3['data2'])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x26483e,'json':!![]};return rp(_0x3451a3);}function startRefreshInterval(_0x54b0ff){var _0x550e5f=schedule[_0xb4c4('0x44')];if(_0x550e5f[_0x54b0ff['id']])clearInterval(_0x550e5f[_0x54b0ff['id']]);_0x550e5f[_0x54b0ff['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0xb4c4('0x45')](this,{'id':_0x54b0ff['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0xb4c4('0x44')]=_0x550e5f;}function startAllRefreshIntervals(){return db['CloudProvider']['findAll']({'where':{'data6':{'$ne':null}},'raw':!![]})[_0xb4c4('0x33')](function(_0x5b8028){var _0x373326=_0x5b8028['map'](function(_0x109274){return refreshOauth2MicrosoftAccessToken(_0x109274)[_0xb4c4('0x33')](function(_0x2f6f99){startRefreshInterval(_0x2f6f99);});});return Promise[_0xb4c4('0x46')](_0x373326);})[_0xb4c4('0x40')](function(_0x2320ec){var _0x3de65b=_0x2320ec?util['inspect'](_0x2320ec,{'showHidden':![],'depth':null}):'';logger['error'](_0xb4c4('0x47'),_0x3de65b);});}module['exports']={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file +var _0xd1a0=['oauth2Claims','oauth2/','set','iss','aud','audience','isAfter','data3','CloudProvider','findOne','then','refresh_token','data6','decryptString','POST','data5','update','catch','authorization_code','intervals','bind','findAll','all','inspect','error','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','exports','crypto','jsonwebtoken','moment','ioredis','util','../../components/encryptor','../../config/environment','../../config/logger','../../config/schedule/cloud-provider','../../mysqldb','defaults','localhost','redis','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','openid','profile','email','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','type','Dynamics365','push','/.default','join','data7','replace','{TENANT_ID}','code','id_token','stringify','base64','randomBytes','toString','hex','client_id','data1','response_type','redirect_uri','data4','response_mode','form_post','scope','state','nonce','prompt','map','key','value'];(function(_0x1c6eac,_0x4332c7){var _0xc286ae=function(_0x2fb253){while(--_0x2fb253){_0x1c6eac['push'](_0x1c6eac['shift']());}};_0xc286ae(++_0x4332c7);}(_0xd1a0,0xfc));var _0x0d1a=function(_0x5d7440,_0x2740ce){_0x5d7440=_0x5d7440-0x0;var _0x1a8920=_0xd1a0[_0x5d7440];return _0x1a8920;};'use strict';var _=require('lodash');var crypto=require(_0x0d1a('0x0'));var jwt=require(_0x0d1a('0x1'));var moment=require(_0x0d1a('0x2'));var Redis=require(_0x0d1a('0x3'));var rp=require('request-promise');var util=require(_0x0d1a('0x4'));var encryptor=require(_0x0d1a('0x5'));var config=require(_0x0d1a('0x6'));var logger=require(_0x0d1a('0x7'))('api');var schedule=require(_0x0d1a('0x8'));var db=require(_0x0d1a('0x9'))['db'];config['redis']=_[_0x0d1a('0xa')](config['redis'],{'host':_0x0d1a('0xb'),'port':0x18eb});var redis=new Redis(config[_0x0d1a('0xc')]);var MICROSOFT_AUTH_URL=_0x0d1a('0xd');var AZURE_AUTH_SCOPES={'Outlook365':[_0x0d1a('0xe'),_0x0d1a('0xf'),_0x0d1a('0x10'),_0x0d1a('0x11'),_0x0d1a('0x12'),'https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send'],'Dynamics365':[_0x0d1a('0xe'),'offline_access']};var MICROSOFT_AUTH_ENDPOINT='/authorize';var MICROSOFT_TOKEN_ENDPOINT='/token';var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x24384f){var _0x18ccb1=_['map'](AZURE_AUTH_SCOPES[_0x24384f[_0x0d1a('0x13')]]);if(_0x24384f['type']===_0x0d1a('0x14'))_0x18ccb1[_0x0d1a('0x15')](_0x24384f['data7']+_0x0d1a('0x16'));return _0x18ccb1[_0x0d1a('0x17')]('\x20');}function getAccessTokenScope(_0x1dc67){if(_0x1dc67[_0x0d1a('0x13')]==='Outlook365')return _0x0d1a('0x12');if(_0x1dc67['type']===_0x0d1a('0x14'))return _0x1dc67[_0x0d1a('0x18')]+_0x0d1a('0x16');}function generateMicrosoftAuthorizationUrl(_0x3d6751,_0x21b0c9){var _0x26c194=MICROSOFT_AUTH_URL[_0x0d1a('0x19')](_0x0d1a('0x1a'),_0x3d6751['data2']);var _0x31b07d=[_0x0d1a('0x1b'),_0x0d1a('0x1c')];var _0x4cb4ed=Buffer['from'](JSON[_0x0d1a('0x1d')]({'id':_0x21b0c9}))['toString'](_0x0d1a('0x1e'));var _0x353caf=crypto[_0x0d1a('0x1f')](0x10)[_0x0d1a('0x20')](_0x0d1a('0x21'));var _0x5a4b5a=getAuthorizationScopes(_0x3d6751);var _0x3c1845=[{'key':_0x0d1a('0x22'),'value':_0x3d6751[_0x0d1a('0x23')]},{'key':_0x0d1a('0x24'),'value':encodeURIComponent(_0x31b07d[_0x0d1a('0x17')]('\x20'))},{'key':_0x0d1a('0x25'),'value':_0x3d6751[_0x0d1a('0x26')]},{'key':_0x0d1a('0x27'),'value':_0x0d1a('0x28')},{'key':_0x0d1a('0x29'),'value':encodeURIComponent(_0x5a4b5a)},{'key':_0x0d1a('0x2a'),'value':_0x4cb4ed},{'key':_0x0d1a('0x2b'),'value':_0x353caf},{'key':_0x0d1a('0x2c'),'value':'login'}];var _0x17905c=_0x26c194+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0x0d1a('0x2d')](_0x3c1845,function(_0x272f54){return _0x272f54[_0x0d1a('0x2e')]+'='+_0x272f54[_0x0d1a('0x2f')];})['join']('&');_0x3d6751[_0x0d1a('0x30')]={'issuer':_0x26c194[_0x0d1a('0x19')](_0x0d1a('0x31'),''),'audience':_0x3d6751['data1'],'state':_0x4cb4ed,'nonce':_0x353caf};redis[_0x0d1a('0x32')](_0x4cb4ed,JSON[_0x0d1a('0x1d')](_0x3d6751));return _0x17905c;}function isValidIdToken(_0x298698,_0x3b4d0d){try{var _0x5624f6=jwt['decode'](_0x298698,{'complete':!![]});var _0x442d4e=_0x5624f6['payload'];if(_0x442d4e[_0x0d1a('0x33')]!==_0x3b4d0d['issuer'])return![];if(_0x442d4e[_0x0d1a('0x34')]!==_0x3b4d0d[_0x0d1a('0x35')])return![];if(_0x442d4e['nonce']!==_0x3b4d0d[_0x0d1a('0x2b')])return![];if(moment()[_0x0d1a('0x36')](moment['unix'](_0x442d4e['exp'])))return![];return!![];}catch(_0x44e382){throw _0x44e382;}}function refreshOauth2MicrosoftAccessToken(_0x2f60f1){return Promise['resolve']()['then'](function(){if(_0x2f60f1[_0x0d1a('0x37')])return _0x2f60f1;return db[_0x0d1a('0x38')][_0x0d1a('0x39')]({'where':{'id':_0x2f60f1['id']},'raw':!![]});})[_0x0d1a('0x3a')](function(_0x121228){var _0x53fa71={'grant_type':_0x0d1a('0x3b'),'refresh_token':_0x121228[_0x0d1a('0x3c')],'scope':getAccessTokenScope(_0x121228),'redirect_uri':_0x121228[_0x0d1a('0x26')],'client_id':_0x121228['data1'],'client_secret':encryptor[_0x0d1a('0x3d')](_0x121228[_0x0d1a('0x37')])};var _0x5e9e67={'method':_0x0d1a('0x3e'),'uri':MICROSOFT_AUTH_URL[_0x0d1a('0x19')](_0x0d1a('0x1a'),_0x121228['data2'])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x53fa71,'json':!![]};return rp(_0x5e9e67);})[_0x0d1a('0x3a')](function(_0x455d17){_0x2f60f1[_0x0d1a('0x3f')]=_0x455d17['access_token'];_0x2f60f1[_0x0d1a('0x3c')]=_0x455d17[_0x0d1a('0x3b')];return db['CloudProvider'][_0x0d1a('0x40')]({'data5':_0x2f60f1[_0x0d1a('0x3f')],'data6':_0x2f60f1['data6']},{'where':{'id':_0x2f60f1['id']}});})[_0x0d1a('0x3a')](function(){return _0x2f60f1;})[_0x0d1a('0x41')](function(_0x577082){logger['error']('Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s',_0x2f60f1['id'],_0x577082);});}function getOauth2MicrosoftAccessToken(_0x5c5cda,_0x40748c){var _0x360991={'grant_type':_0x0d1a('0x42'),'code':_0x5c5cda,'scope':getAccessTokenScope(_0x40748c),'redirect_uri':_0x40748c[_0x0d1a('0x26')],'client_id':_0x40748c['data1'],'client_secret':encryptor[_0x0d1a('0x3d')](_0x40748c[_0x0d1a('0x37')])};var _0x26665a={'method':'POST','uri':MICROSOFT_AUTH_URL[_0x0d1a('0x19')](_0x0d1a('0x1a'),_0x40748c['data2'])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x360991,'json':!![]};return rp(_0x26665a);}function startRefreshInterval(_0x287a73){var _0x412095=schedule[_0x0d1a('0x43')];if(_0x412095[_0x287a73['id']])clearInterval(_0x412095[_0x287a73['id']]);_0x412095[_0x287a73['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0x0d1a('0x44')](this,{'id':_0x287a73['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0x0d1a('0x43')]=_0x412095;}function startAllRefreshIntervals(){return db[_0x0d1a('0x38')][_0x0d1a('0x45')]({'where':{'data6':{'$ne':null}},'raw':!![]})['then'](function(_0x262476){var _0x1a6093=_0x262476[_0x0d1a('0x2d')](function(_0x488cfc){return refreshOauth2MicrosoftAccessToken(_0x488cfc)[_0x0d1a('0x3a')](function(_0x1be2e0){startRefreshInterval(_0x1be2e0);});});return Promise[_0x0d1a('0x46')](_0x1a6093);})[_0x0d1a('0x41')](function(_0x14760d){var _0x4acbf7=_0x14760d?util[_0x0d1a('0x47')](_0x14760d,{'showHidden':![],'depth':null}):'';logger[_0x0d1a('0x48')](_0x0d1a('0x49'),_0x4acbf7);});}module[_0x0d1a('0x4a')]={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.rpc.js b/server/api/cloudProvider/cloudProvider.rpc.js index 081678a..c1f03e7 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 _0xf970=['../../config/logger','../../config/environment','jayson/promise','client','http','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x26efac,_0x21ab8a){var _0x8482e4=function(_0x14db32){while(--_0x14db32){_0x26efac['push'](_0x26efac['shift']());}};_0x8482e4(++_0x21ab8a);}(_0xf970,0x1d9));var _0x0f97=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xf970[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x0f97('0x0'));var util=require('util');var moment=require(_0x0f97('0x1'));var BPromise=require(_0x0f97('0x2'));var rs=require(_0x0f97('0x3'));var fs=require('fs');var Redis=require(_0x0f97('0x4'));var db=require(_0x0f97('0x5'))['db'];var utils=require(_0x0f97('0x6'));var logger=require(_0x0f97('0x7'))('rpc');var config=require(_0x0f97('0x8'));var jayson=require(_0x0f97('0x9'));var client=jayson[_0x0f97('0xa')][_0x0f97('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2e3515,_0x3244a6,_0x12fbb3){return new BPromise(function(_0x374083,_0x2891f7){return client['request'](_0x2e3515,_0x12fbb3)['then'](function(_0x12397b){logger['info'](_0x0f97('0xc'),_0x3244a6,_0x0f97('0xd'));logger[_0x0f97('0xe')]('CloudProvider,\x20%s,\x20%s,\x20%s',_0x3244a6,_0x0f97('0xd'),JSON['stringify'](_0x12397b));if(_0x12397b[_0x0f97('0xf')]){if(_0x12397b[_0x0f97('0xf')][_0x0f97('0x10')]===0x1f4){logger[_0x0f97('0xf')](_0x0f97('0xc'),_0x3244a6,_0x12397b['error'][_0x0f97('0x11')]);return _0x2891f7(_0x12397b[_0x0f97('0xf')][_0x0f97('0x11')]);}logger[_0x0f97('0xf')](_0x0f97('0xc'),_0x3244a6,_0x12397b[_0x0f97('0xf')][_0x0f97('0x11')]);return _0x374083(_0x12397b['error']['message']);}else{logger[_0x0f97('0x12')](_0x0f97('0xc'),_0x3244a6,_0x0f97('0xd'));_0x374083(_0x12397b[_0x0f97('0x13')]['message']);}})['catch'](function(_0x336f61){logger[_0x0f97('0xf')](_0x0f97('0xc'),_0x3244a6,_0x336f61);_0x2891f7(_0x336f61);});});} \ No newline at end of file +var _0x7366=['message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','request','info','CloudProvider,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code'];(function(_0x43ec6e,_0x431c14){var _0x15a42d=function(_0x30c106){while(--_0x30c106){_0x43ec6e['push'](_0x43ec6e['shift']());}};_0x15a42d(++_0x431c14);}(_0x7366,0x9d));var _0x6736=function(_0x3ab8d7,_0x462b06){_0x3ab8d7=_0x3ab8d7-0x0;var _0x58092a=_0x7366[_0x3ab8d7];return _0x58092a;};'use strict';var _=require(_0x6736('0x0'));var util=require(_0x6736('0x1'));var moment=require(_0x6736('0x2'));var BPromise=require(_0x6736('0x3'));var rs=require(_0x6736('0x4'));var fs=require('fs');var Redis=require(_0x6736('0x5'));var db=require(_0x6736('0x6'))['db'];var utils=require(_0x6736('0x7'));var logger=require(_0x6736('0x8'))('rpc');var config=require(_0x6736('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x6736('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x32e0c1,_0x2cc35d,_0x4f4944){return new BPromise(function(_0x123b3c,_0x3a966c){return client[_0x6736('0xb')](_0x32e0c1,_0x4f4944)['then'](function(_0x1d0c58){logger[_0x6736('0xc')](_0x6736('0xd'),_0x2cc35d,'request\x20sent');logger[_0x6736('0xe')]('CloudProvider,\x20%s,\x20%s,\x20%s',_0x2cc35d,_0x6736('0xf'),JSON[_0x6736('0x10')](_0x1d0c58));if(_0x1d0c58['error']){if(_0x1d0c58[_0x6736('0x11')][_0x6736('0x12')]===0x1f4){logger['error']('CloudProvider,\x20%s,\x20%s',_0x2cc35d,_0x1d0c58['error'][_0x6736('0x13')]);return _0x3a966c(_0x1d0c58[_0x6736('0x11')][_0x6736('0x13')]);}logger[_0x6736('0x11')](_0x6736('0xd'),_0x2cc35d,_0x1d0c58[_0x6736('0x11')][_0x6736('0x13')]);return _0x123b3c(_0x1d0c58[_0x6736('0x11')][_0x6736('0x13')]);}else{logger[_0x6736('0xc')](_0x6736('0xd'),_0x2cc35d,_0x6736('0xf'));_0x123b3c(_0x1d0c58[_0x6736('0x14')][_0x6736('0x13')]);}})[_0x6736('0x15')](function(_0x3290a1){logger['error'](_0x6736('0xd'),_0x2cc35d,_0x3290a1);_0x3a966c(_0x3290a1);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index 79a66e2..08cc785 100644 --- a/server/api/cloudProvider/index.js +++ b/server/api/cloudProvider/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1261=['/:id','show','create','put','update','delete','/:id/oauth2/microsoft/authorize/','post','exports','Router','../../components/auth/service','./cloudProvider.controller','get','isAuthenticated','index'];(function(_0x20fb02,_0x96c029){var _0x24a33e=function(_0x4b5c8a){while(--_0x4b5c8a){_0x20fb02['push'](_0x20fb02['shift']());}};_0x24a33e(++_0x96c029);}(_0x1261,0x144));var _0x1126=function(_0x310a23,_0x49f6b5){_0x310a23=_0x310a23-0x0;var _0x50fe57=_0x1261[_0x310a23];return _0x50fe57;};'use strict';var express=require('express');var router=express[_0x1126('0x0')]();var auth=require(_0x1126('0x1'));var controller=require(_0x1126('0x2'));router[_0x1126('0x3')]('/',auth[_0x1126('0x4')](),controller[_0x1126('0x5')]);router[_0x1126('0x3')](_0x1126('0x6'),auth[_0x1126('0x4')](),controller[_0x1126('0x7')]);router['post']('/',auth['isAuthenticated'](),controller[_0x1126('0x8')]);router[_0x1126('0x9')]('/:id',auth[_0x1126('0x4')](),controller[_0x1126('0xa')]);router[_0x1126('0xb')](_0x1126('0x6'),auth[_0x1126('0x4')](),controller['destroy']);router[_0x1126('0x3')](_0x1126('0xc'),auth[_0x1126('0x4')](),controller['oauth2MicrosoftAuthorize']);router[_0x1126('0xd')]('/oauth2/microsoft/callback',controller['oauth2MicrosoftCallback']);module[_0x1126('0xe')]=router; \ No newline at end of file +var _0x5f2f=['exports','express','Router','../../components/auth/service','./cloudProvider.controller','get','isAuthenticated','index','show','post','create','put','/:id','update','delete','destroy','/:id/oauth2/microsoft/authorize/','oauth2MicrosoftAuthorize','oauth2MicrosoftCallback'];(function(_0x183256,_0x1a596d){var _0x5394a2=function(_0x192025){while(--_0x192025){_0x183256['push'](_0x183256['shift']());}};_0x5394a2(++_0x1a596d);}(_0x5f2f,0x73));var _0xf5f2=function(_0x1cc92b,_0x306fbf){_0x1cc92b=_0x1cc92b-0x0;var _0x5871cc=_0x5f2f[_0x1cc92b];return _0x5871cc;};'use strict';var express=require(_0xf5f2('0x0'));var router=express[_0xf5f2('0x1')]();var auth=require(_0xf5f2('0x2'));var controller=require(_0xf5f2('0x3'));router[_0xf5f2('0x4')]('/',auth[_0xf5f2('0x5')](),controller[_0xf5f2('0x6')]);router[_0xf5f2('0x4')]('/:id',auth['isAuthenticated'](),controller[_0xf5f2('0x7')]);router[_0xf5f2('0x8')]('/',auth[_0xf5f2('0x5')](),controller[_0xf5f2('0x9')]);router[_0xf5f2('0xa')](_0xf5f2('0xb'),auth['isAuthenticated'](),controller[_0xf5f2('0xc')]);router[_0xf5f2('0xd')](_0xf5f2('0xb'),auth['isAuthenticated'](),controller[_0xf5f2('0xe')]);router[_0xf5f2('0x4')](_0xf5f2('0xf'),auth['isAuthenticated'](),controller[_0xf5f2('0x10')]);router['post']('/oauth2/microsoft/callback',controller[_0xf5f2('0x11')]);module[_0xf5f2('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index ded89fb..1253b85 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 _0xc7a9=['sequelize','exports','STRING','name'];(function(_0x328169,_0x4c1d1b){var _0x20617a=function(_0x1e7f97){while(--_0x1e7f97){_0x328169['push'](_0x328169['shift']());}};_0x20617a(++_0x4c1d1b);}(_0xc7a9,0x134));var _0x9c7a=function(_0x1f2dc0,_0x54fff9){_0x1f2dc0=_0x1f2dc0-0x0;var _0x101674=_0xc7a9[_0x1f2dc0];return _0x101674;};'use strict';var Sequelize=require(_0x9c7a('0x0'));module[_0x9c7a('0x1')]={'name':{'type':Sequelize[_0x9c7a('0x2')],'unique':_0x9c7a('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x9c7a('0x2')]},'companyId':{'type':Sequelize[_0x9c7a('0x2')]},'website':{'type':Sequelize[_0x9c7a('0x2')]},'phone':{'type':Sequelize[_0x9c7a('0x2')]},'fax':{'type':Sequelize[_0x9c7a('0x2')]},'type':{'type':Sequelize['STRING']},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x9c7a('0x2')]},'country':{'type':Sequelize[_0x9c7a('0x2')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x9c7a('0x2')]},'sStreet':{'type':Sequelize[_0x9c7a('0x2')]},'sPostalCode':{'type':Sequelize[_0x9c7a('0x2')]},'sCity':{'type':Sequelize[_0x9c7a('0x2')]},'sCountry':{'type':Sequelize[_0x9c7a('0x2')]},'description':{'type':Sequelize[_0x9c7a('0x2')]}}; \ No newline at end of file +var _0x6a99=['sequelize','exports','name','STRING'];(function(_0x5ef6bd,_0x3e2cfc){var _0x119b83=function(_0x584837){while(--_0x584837){_0x5ef6bd['push'](_0x5ef6bd['shift']());}};_0x119b83(++_0x3e2cfc);}(_0x6a99,0x148));var _0x96a9=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x6a99[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x96a9('0x0'));module[_0x96a9('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x96a9('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x96a9('0x3')]},'companyId':{'type':Sequelize['STRING']},'website':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x96a9('0x3')]},'fax':{'type':Sequelize[_0x96a9('0x3')]},'type':{'type':Sequelize['STRING']},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0x96a9('0x3')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x96a9('0x3')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x96a9('0x3')]},'sStreet':{'type':Sequelize[_0x96a9('0x3')]},'sPostalCode':{'type':Sequelize[_0x96a9('0x3')]},'sCity':{'type':Sequelize['STRING']},'sCountry':{'type':Sequelize[_0x96a9('0x3')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index e036970..114148a 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 _0xc2f7=['merge','hasOwnProperty','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','offset','undefined','count','limit','Content-Range','apply','reject','save','then','destroy','get','UserProfileResource','end','sendStatus','error','stack','name','send','index','CmCompany','describe','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','map','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Companies','UserProfileSection','find','userProfileId','create','update','addContacts','CmContact','ids','omit','getContacts'];(function(_0x5f4777,_0x1df9ba){var _0x187998=function(_0x1458f7){while(--_0x1458f7){_0x5f4777['push'](_0x5f4777['shift']());}};_0x187998(++_0x1df9ba);}(_0xc2f7,0x15a));var _0x7c2f=function(_0x22408c,_0x34b6ca){_0x22408c=_0x22408c-0x0;var _0x165585=_0xc2f7[_0x22408c];return _0x165585;};'use strict';var emlformat=require(_0x7c2f('0x0'));var rimraf=require(_0x7c2f('0x1'));var zipdir=require(_0x7c2f('0x2'));var jsonpatch=require(_0x7c2f('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x7c2f('0x4'));var Mustache=require('mustache');var util=require(_0x7c2f('0x5'));var path=require(_0x7c2f('0x6'));var sox=require(_0x7c2f('0x7'));var csv=require(_0x7c2f('0x8'));var ejs=require(_0x7c2f('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7c2f('0xa'));var squel=require('squel');var crypto=require(_0x7c2f('0xb'));var jsforce=require(_0x7c2f('0xc'));var deskjs=require(_0x7c2f('0xd'));var toCsv=require(_0x7c2f('0x8'));var querystring=require('querystring');var Papa=require(_0x7c2f('0xe'));var Redis=require('ioredis');var authService=require(_0x7c2f('0xf'));var qs=require(_0x7c2f('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7c2f('0x11'));var logger=require(_0x7c2f('0x12'))(_0x7c2f('0x13'));var utils=require(_0x7c2f('0x14'));var config=require(_0x7c2f('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x7c2f('0x16'))['db'];function respondWithStatusCode(_0x54509e,_0x46e499){_0x46e499=_0x46e499||0xcc;return function(_0x2c5e5c){if(_0x2c5e5c){return _0x54509e['sendStatus'](_0x46e499);}return _0x54509e[_0x7c2f('0x17')](_0x46e499)['end']();};}function respondWithResult(_0x206b6c,_0x6d40ab){_0x6d40ab=_0x6d40ab||0xc8;return function(_0x4bf77a){if(_0x4bf77a){return _0x206b6c[_0x7c2f('0x17')](_0x6d40ab)['json'](_0x4bf77a);}};}function respondWithFilteredResult(_0x2a4772,_0x37092e){return function(_0x4062d4){if(_0x4062d4){var _0x6f5dda=typeof _0x37092e[_0x7c2f('0x18')]==='undefined'&&typeof _0x37092e['limit']===_0x7c2f('0x19');var _0x556b60=_0x4062d4[_0x7c2f('0x1a')];var _0x5da0e4=_0x6f5dda?0x0:_0x37092e[_0x7c2f('0x18')];var _0x144dac=_0x6f5dda?_0x4062d4[_0x7c2f('0x1a')]:_0x37092e[_0x7c2f('0x18')]+_0x37092e[_0x7c2f('0x1b')];var _0x331cf1;if(_0x144dac>=_0x556b60){_0x144dac=_0x556b60;_0x331cf1=0xc8;}else{_0x331cf1=0xce;}_0x2a4772[_0x7c2f('0x17')](_0x331cf1);return _0x2a4772['set'](_0x7c2f('0x1c'),_0x5da0e4+'-'+_0x144dac+'/'+_0x556b60)['json'](_0x4062d4);}return null;};}function patchUpdates(_0x5ab432){return function(_0x552509){try{jsonpatch[_0x7c2f('0x1d')](_0x552509,_0x5ab432,!![]);}catch(_0x419a73){return BPromise[_0x7c2f('0x1e')](_0x419a73);}return _0x552509[_0x7c2f('0x1f')]();};}function saveUpdates(_0x1c4c68,_0x4a58d8){return function(_0x3c3b20){if(_0x3c3b20){return _0x3c3b20['update'](_0x1c4c68)[_0x7c2f('0x20')](function(_0xc9dd84){return _0xc9dd84;});}return null;};}function removeEntity(_0x2f5710,_0x4f6bdc){return function(_0x380d9a){if(_0x380d9a){return _0x380d9a[_0x7c2f('0x21')]()[_0x7c2f('0x20')](function(){var _0x295e37=_0x380d9a[_0x7c2f('0x22')]({'plain':!![]});var _0x522b6d='Companies';return db[_0x7c2f('0x23')]['destroy']({'where':{'type':_0x522b6d,'resourceId':_0x295e37['id']}})[_0x7c2f('0x20')](function(){return _0x380d9a;});})[_0x7c2f('0x20')](function(){_0x2f5710[_0x7c2f('0x17')](0xcc)[_0x7c2f('0x24')]();});}};}function handleEntityNotFound(_0x1e0b76,_0x419cf4){return function(_0x523bf3){if(!_0x523bf3){_0x1e0b76[_0x7c2f('0x25')](0x194);}return _0x523bf3;};}function handleError(_0x52cad7,_0x2ac2f4){_0x2ac2f4=_0x2ac2f4||0x1f4;return function(_0x5ef872){logger[_0x7c2f('0x26')](_0x5ef872[_0x7c2f('0x27')]);if(_0x5ef872[_0x7c2f('0x28')]){delete _0x5ef872[_0x7c2f('0x28')];}_0x52cad7[_0x7c2f('0x17')](_0x2ac2f4)[_0x7c2f('0x29')](_0x5ef872);};}exports[_0x7c2f('0x2a')]=function(_0x5411e6,_0x4c9302){var _0x19adde={},_0x1958ce={},_0x164032={'count':0x0,'rows':[]};return db[_0x7c2f('0x2b')][_0x7c2f('0x2c')]()['then'](function(_0x53b3bd){_0x1958ce[_0x7c2f('0x2d')]=_[_0x7c2f('0x2e')](_0x53b3bd);_0x1958ce[_0x7c2f('0x2f')]=_[_0x7c2f('0x2e')](_0x5411e6[_0x7c2f('0x2f')]);_0x1958ce[_0x7c2f('0x30')]=_[_0x7c2f('0x31')](_0x1958ce[_0x7c2f('0x2d')],_0x1958ce[_0x7c2f('0x2f')]);_0x19adde[_0x7c2f('0x32')]=_[_0x7c2f('0x31')](_0x1958ce[_0x7c2f('0x2d')],qs[_0x7c2f('0x33')](_0x5411e6[_0x7c2f('0x2f')][_0x7c2f('0x33')]));_0x19adde[_0x7c2f('0x32')]=_0x19adde[_0x7c2f('0x32')][_0x7c2f('0x34')]?_0x19adde[_0x7c2f('0x32')]:_0x1958ce[_0x7c2f('0x2d')];if(!_0x5411e6[_0x7c2f('0x2f')]['hasOwnProperty'](_0x7c2f('0x35'))){_0x19adde[_0x7c2f('0x1b')]=qs[_0x7c2f('0x1b')](_0x5411e6['query'][_0x7c2f('0x1b')]);_0x19adde[_0x7c2f('0x18')]=qs['offset'](_0x5411e6['query'][_0x7c2f('0x18')]);}_0x19adde[_0x7c2f('0x36')]=qs[_0x7c2f('0x37')](_0x5411e6[_0x7c2f('0x2f')][_0x7c2f('0x37')]);_0x19adde['where']=qs[_0x7c2f('0x30')](_[_0x7c2f('0x38')](_0x5411e6['query'],_0x1958ce[_0x7c2f('0x30')]),_0x53b3bd);if(_0x5411e6['query'][_0x7c2f('0x39')]){_0x19adde[_0x7c2f('0x3a')]=_['merge'](_0x19adde[_0x7c2f('0x3a')],{'$or':_[_0x7c2f('0x3b')](_0x19adde[_0x7c2f('0x32')],function(_0x543582){var _0x5323f9={};_0x5323f9[_0x543582]={'$like':'%'+_0x5411e6['query'][_0x7c2f('0x39')]+'%'};return _0x5323f9;})});}_0x19adde=_['merge']({},_0x19adde,_0x5411e6[_0x7c2f('0x3c')]);var _0x23df97={'where':_0x19adde['where']};return db['CmCompany'][_0x7c2f('0x1a')](_0x23df97)[_0x7c2f('0x20')](function(_0x522dfb){_0x164032['count']=_0x522dfb;if(_0x5411e6[_0x7c2f('0x2f')][_0x7c2f('0x3d')]){_0x19adde[_0x7c2f('0x3e')]=[{'all':!![]}];}return db['CmCompany'][_0x7c2f('0x3f')](_0x19adde);})['then'](function(_0x83e0b6){_0x164032[_0x7c2f('0x40')]=_0x83e0b6;return _0x164032;})[_0x7c2f('0x20')](respondWithFilteredResult(_0x4c9302,_0x19adde))[_0x7c2f('0x41')](handleError(_0x4c9302,null));})[_0x7c2f('0x41')](handleError(_0x4c9302,null));};exports[_0x7c2f('0x42')]=function(_0x52239e,_0x562885){var _0x47d91b={'raw':![],'where':{'id':_0x52239e[_0x7c2f('0x43')]['id']}},_0x237f7f={};_0x237f7f[_0x7c2f('0x2d')]=_[_0x7c2f('0x2e')](db['CmCompany'][_0x7c2f('0x44')]);_0x237f7f['query']=_[_0x7c2f('0x2e')](_0x52239e['query']);_0x237f7f['filters']=_[_0x7c2f('0x31')](_0x237f7f[_0x7c2f('0x2d')],_0x237f7f[_0x7c2f('0x2f')]);_0x47d91b['attributes']=_[_0x7c2f('0x31')](_0x237f7f[_0x7c2f('0x2d')],qs['fields'](_0x52239e[_0x7c2f('0x2f')][_0x7c2f('0x33')]));_0x47d91b[_0x7c2f('0x32')]=_0x47d91b[_0x7c2f('0x32')]['length']?_0x47d91b[_0x7c2f('0x32')]:_0x237f7f['model'];if(_0x52239e['query'][_0x7c2f('0x3d')]){_0x47d91b['include']=[{'all':!![]}];}_0x47d91b=_['merge']({},_0x47d91b,_0x52239e[_0x7c2f('0x3c')]);return db[_0x7c2f('0x2b')]['find'](_0x47d91b)[_0x7c2f('0x20')](handleEntityNotFound(_0x562885,null))[_0x7c2f('0x20')](respondWithResult(_0x562885,null))['catch'](handleError(_0x562885,null));};exports['create']=function(_0x1f78dd,_0x4006b9){return db[_0x7c2f('0x2b')]['create'](_0x1f78dd[_0x7c2f('0x45')],{})[_0x7c2f('0x20')](function(_0x491685){var _0x1be66f=_0x1f78dd[_0x7c2f('0x46')][_0x7c2f('0x22')]({'plain':!![]});if(!_0x1be66f)throw new Error(_0x7c2f('0x47'));if(_0x1be66f[_0x7c2f('0x48')]==='user'){var _0x3d705f=_0x491685[_0x7c2f('0x22')]({'plain':!![]});var _0x290ee5=_0x7c2f('0x49');return db[_0x7c2f('0x4a')][_0x7c2f('0x4b')]({'where':{'name':_0x290ee5,'userProfileId':_0x1be66f[_0x7c2f('0x4c')]},'raw':!![]})[_0x7c2f('0x20')](function(_0x5b39c9){if(_0x5b39c9&&_0x5b39c9['autoAssociation']===0x0){return db[_0x7c2f('0x23')][_0x7c2f('0x4d')]({'name':_0x3d705f['name'],'resourceId':_0x3d705f['id'],'type':_0x5b39c9[_0x7c2f('0x28')],'sectionId':_0x5b39c9['id']},{})[_0x7c2f('0x20')](function(){return _0x491685;});}else{return _0x491685;}})[_0x7c2f('0x41')](function(_0x2e65ab){logger[_0x7c2f('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2e65ab);throw _0x2e65ab;});}return _0x491685;})[_0x7c2f('0x20')](respondWithResult(_0x4006b9,0xc9))['catch'](handleError(_0x4006b9,null));};exports[_0x7c2f('0x4e')]=function(_0x48583c,_0x5c0c01){if(_0x48583c[_0x7c2f('0x45')]['id']){delete _0x48583c[_0x7c2f('0x45')]['id'];}return db['CmCompany'][_0x7c2f('0x4b')]({'where':{'id':_0x48583c[_0x7c2f('0x43')]['id']}})['then'](handleEntityNotFound(_0x5c0c01,null))[_0x7c2f('0x20')](saveUpdates(_0x48583c['body'],null))['then'](respondWithResult(_0x5c0c01,null))['catch'](handleError(_0x5c0c01,null));};exports[_0x7c2f('0x21')]=function(_0x5cf576,_0x166ef0){return db[_0x7c2f('0x2b')][_0x7c2f('0x4b')]({'where':{'id':_0x5cf576[_0x7c2f('0x43')]['id']}})[_0x7c2f('0x20')](handleEntityNotFound(_0x166ef0,null))[_0x7c2f('0x20')](removeEntity(_0x166ef0,null))['catch'](handleError(_0x166ef0,null));};exports[_0x7c2f('0x2c')]=function(_0x5b85c3,_0x18eb89){return db[_0x7c2f('0x2b')]['describe']()['then'](respondWithResult(_0x18eb89,null))[_0x7c2f('0x41')](handleError(_0x18eb89,null));};exports[_0x7c2f('0x4f')]=function(_0x5df6fd,_0x295282,_0x45fb36){return db[_0x7c2f('0x50')][_0x7c2f('0x4b')]({'where':{'id':_0x5df6fd[_0x7c2f('0x43')]['id']}})[_0x7c2f('0x20')](handleEntityNotFound(_0x295282,null))[_0x7c2f('0x20')](function(_0x11e91a){if(_0x11e91a){return _0x11e91a[_0x7c2f('0x4f')](_0x5df6fd['body'][_0x7c2f('0x51')],_[_0x7c2f('0x52')](_0x5df6fd[_0x7c2f('0x45')],[_0x7c2f('0x51'),'id'])||{});}})[_0x7c2f('0x20')](respondWithResult(_0x295282,null))[_0x7c2f('0x41')](handleError(_0x295282,null));};exports[_0x7c2f('0x53')]=function(_0x382be6,_0x29e95f,_0x4d6912){var _0x5910e6={};var _0x2dab5d={};var _0x28256a;var _0x4a31e8;return db['CmCompany']['findOne']({'where':{'id':_0x382be6[_0x7c2f('0x43')]['id']}})['then'](handleEntityNotFound(_0x29e95f,null))[_0x7c2f('0x20')](function(_0x606fb9){if(_0x606fb9){_0x28256a=_0x606fb9;_0x2dab5d[_0x7c2f('0x2d')]=_[_0x7c2f('0x2e')](db[_0x7c2f('0x50')]['rawAttributes']);_0x2dab5d[_0x7c2f('0x2f')]=_[_0x7c2f('0x2e')](_0x382be6[_0x7c2f('0x2f')]);_0x2dab5d['filters']=_['intersection'](_0x2dab5d[_0x7c2f('0x2d')],_0x2dab5d[_0x7c2f('0x2f')]);_0x5910e6['attributes']=_[_0x7c2f('0x31')](_0x2dab5d[_0x7c2f('0x2d')],qs[_0x7c2f('0x33')](_0x382be6[_0x7c2f('0x2f')][_0x7c2f('0x33')]));_0x5910e6[_0x7c2f('0x32')]=_0x5910e6[_0x7c2f('0x32')][_0x7c2f('0x34')]?_0x5910e6[_0x7c2f('0x32')]:_0x2dab5d['model'];_0x5910e6['order']=qs[_0x7c2f('0x37')](_0x382be6[_0x7c2f('0x2f')][_0x7c2f('0x37')]);_0x5910e6['where']=qs[_0x7c2f('0x30')](_[_0x7c2f('0x38')](_0x382be6[_0x7c2f('0x2f')],_0x2dab5d[_0x7c2f('0x30')]));if(_0x382be6[_0x7c2f('0x2f')]['filter']){_0x5910e6[_0x7c2f('0x3a')]=_[_0x7c2f('0x54')](_0x5910e6[_0x7c2f('0x3a')],{'$or':_[_0x7c2f('0x3b')](_0x5910e6[_0x7c2f('0x32')],function(_0x284e2a){var _0x11cf76={};_0x11cf76[_0x284e2a]={'$like':'%'+_0x382be6['query'][_0x7c2f('0x39')]+'%'};return _0x11cf76;})});}_0x5910e6=_[_0x7c2f('0x54')]({},_0x5910e6,_0x382be6[_0x7c2f('0x3c')]);return _0x28256a['getContacts'](_0x5910e6);}})[_0x7c2f('0x20')](function(_0x346b49){if(_0x346b49){_0x4a31e8=_0x346b49[_0x7c2f('0x34')];if(!_0x382be6[_0x7c2f('0x2f')][_0x7c2f('0x55')](_0x7c2f('0x35'))){_0x5910e6[_0x7c2f('0x1b')]=qs[_0x7c2f('0x1b')](_0x382be6['query'][_0x7c2f('0x1b')]);_0x5910e6[_0x7c2f('0x18')]=qs[_0x7c2f('0x18')](_0x382be6['query'][_0x7c2f('0x18')]);}return _0x28256a[_0x7c2f('0x53')](_0x5910e6);}})[_0x7c2f('0x20')](function(_0x2b81cc){if(_0x2b81cc){return _0x2b81cc?{'count':_0x4a31e8,'rows':_0x2b81cc}:null;}})['then'](respondWithResult(_0x29e95f,null))[_0x7c2f('0x41')](handleError(_0x29e95f,null));}; \ No newline at end of file +var _0xeae0=['user','get','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','find','params','addContacts','CmContact','ids','getContacts','findOne','pick','options','eml-format','rimraf','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/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','destroy','Companies','UserProfileResource','error','stack','name','send','index','CmCompany','describe','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','map','filter','merge','include','findAll','rows','catch','show','rawAttributes','includeAll','create','body'];(function(_0x342baa,_0x4a110f){var _0x1208f3=function(_0x56a645){while(--_0x56a645){_0x342baa['push'](_0x342baa['shift']());}};_0x1208f3(++_0x4a110f);}(_0xeae0,0xc4));var _0x0eae=function(_0x546aaf,_0x1ed138){_0x546aaf=_0x546aaf-0x0;var _0x1cbf6d=_0xeae0[_0x546aaf];return _0x1cbf6d;};'use strict';var emlformat=require(_0x0eae('0x0'));var rimraf=require(_0x0eae('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0eae('0x2'));var rp=require(_0x0eae('0x3'));var moment=require(_0x0eae('0x4'));var BPromise=require(_0x0eae('0x5'));var Mustache=require(_0x0eae('0x6'));var util=require(_0x0eae('0x7'));var path=require(_0x0eae('0x8'));var sox=require(_0x0eae('0x9'));var csv=require(_0x0eae('0xa'));var ejs=require(_0x0eae('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x0eae('0xc'));var crypto=require(_0x0eae('0xd'));var jsforce=require(_0x0eae('0xe'));var deskjs=require(_0x0eae('0xf'));var toCsv=require(_0x0eae('0xa'));var querystring=require('querystring');var Papa=require(_0x0eae('0x10'));var Redis=require(_0x0eae('0x11'));var authService=require(_0x0eae('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x0eae('0x13'));var hardwareService=require(_0x0eae('0x14'));var logger=require(_0x0eae('0x15'))(_0x0eae('0x16'));var utils=require(_0x0eae('0x17'));var config=require(_0x0eae('0x18'));var licenseUtil=require(_0x0eae('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2b376d,_0x3c4b6e){_0x3c4b6e=_0x3c4b6e||0xcc;return function(_0x55de99){if(_0x55de99){return _0x2b376d[_0x0eae('0x1a')](_0x3c4b6e);}return _0x2b376d[_0x0eae('0x1b')](_0x3c4b6e)[_0x0eae('0x1c')]();};}function respondWithResult(_0x3e59ab,_0x4ae3cd){_0x4ae3cd=_0x4ae3cd||0xc8;return function(_0xd6f5c4){if(_0xd6f5c4){return _0x3e59ab[_0x0eae('0x1b')](_0x4ae3cd)[_0x0eae('0x1d')](_0xd6f5c4);}};}function respondWithFilteredResult(_0x19e27e,_0xbea7be){return function(_0x3277a7){if(_0x3277a7){var _0x17ddf6=typeof _0xbea7be[_0x0eae('0x1e')]===_0x0eae('0x1f')&&typeof _0xbea7be[_0x0eae('0x20')]===_0x0eae('0x1f');var _0x325bfd=_0x3277a7[_0x0eae('0x21')];var _0x4641e6=_0x17ddf6?0x0:_0xbea7be[_0x0eae('0x1e')];var _0x373c1c=_0x17ddf6?_0x3277a7[_0x0eae('0x21')]:_0xbea7be[_0x0eae('0x1e')]+_0xbea7be[_0x0eae('0x20')];var _0x2aced1;if(_0x373c1c>=_0x325bfd){_0x373c1c=_0x325bfd;_0x2aced1=0xc8;}else{_0x2aced1=0xce;}_0x19e27e[_0x0eae('0x1b')](_0x2aced1);return _0x19e27e['set'](_0x0eae('0x22'),_0x4641e6+'-'+_0x373c1c+'/'+_0x325bfd)[_0x0eae('0x1d')](_0x3277a7);}return null;};}function patchUpdates(_0x255ffe){return function(_0x486c46){try{jsonpatch[_0x0eae('0x23')](_0x486c46,_0x255ffe,!![]);}catch(_0x532140){return BPromise[_0x0eae('0x24')](_0x532140);}return _0x486c46[_0x0eae('0x25')]();};}function saveUpdates(_0x34c8d7,_0x27320b){return function(_0x598da9){if(_0x598da9){return _0x598da9['update'](_0x34c8d7)[_0x0eae('0x26')](function(_0x4c09dd){return _0x4c09dd;});}return null;};}function removeEntity(_0x2627a8,_0x35a870){return function(_0x1e421c){if(_0x1e421c){return _0x1e421c[_0x0eae('0x27')]()[_0x0eae('0x26')](function(){var _0x54d995=_0x1e421c['get']({'plain':!![]});var _0x2ee6ba=_0x0eae('0x28');return db[_0x0eae('0x29')]['destroy']({'where':{'type':_0x2ee6ba,'resourceId':_0x54d995['id']}})['then'](function(){return _0x1e421c;});})['then'](function(){_0x2627a8[_0x0eae('0x1b')](0xcc)[_0x0eae('0x1c')]();});}};}function handleEntityNotFound(_0x1f3d89,_0x3f1304){return function(_0x4ed33f){if(!_0x4ed33f){_0x1f3d89[_0x0eae('0x1a')](0x194);}return _0x4ed33f;};}function handleError(_0x334519,_0x2dd9b0){_0x2dd9b0=_0x2dd9b0||0x1f4;return function(_0x4c1414){logger[_0x0eae('0x2a')](_0x4c1414[_0x0eae('0x2b')]);if(_0x4c1414[_0x0eae('0x2c')]){delete _0x4c1414['name'];}_0x334519[_0x0eae('0x1b')](_0x2dd9b0)[_0x0eae('0x2d')](_0x4c1414);};}exports[_0x0eae('0x2e')]=function(_0x1db8df,_0x3ba4a7){var _0x291078={},_0x288f74={},_0x3b42e8={'count':0x0,'rows':[]};return db[_0x0eae('0x2f')][_0x0eae('0x30')]()['then'](function(_0x5da938){_0x288f74[_0x0eae('0x31')]=_[_0x0eae('0x32')](_0x5da938);_0x288f74[_0x0eae('0x33')]=_[_0x0eae('0x32')](_0x1db8df[_0x0eae('0x33')]);_0x288f74[_0x0eae('0x34')]=_[_0x0eae('0x35')](_0x288f74[_0x0eae('0x31')],_0x288f74[_0x0eae('0x33')]);_0x291078['attributes']=_['intersection'](_0x288f74[_0x0eae('0x31')],qs[_0x0eae('0x36')](_0x1db8df[_0x0eae('0x33')][_0x0eae('0x36')]));_0x291078[_0x0eae('0x37')]=_0x291078[_0x0eae('0x37')][_0x0eae('0x38')]?_0x291078[_0x0eae('0x37')]:_0x288f74[_0x0eae('0x31')];if(!_0x1db8df[_0x0eae('0x33')][_0x0eae('0x39')](_0x0eae('0x3a'))){_0x291078[_0x0eae('0x20')]=qs['limit'](_0x1db8df[_0x0eae('0x33')][_0x0eae('0x20')]);_0x291078[_0x0eae('0x1e')]=qs[_0x0eae('0x1e')](_0x1db8df[_0x0eae('0x33')]['offset']);}_0x291078[_0x0eae('0x3b')]=qs[_0x0eae('0x3c')](_0x1db8df[_0x0eae('0x33')][_0x0eae('0x3c')]);_0x291078[_0x0eae('0x3d')]=qs[_0x0eae('0x34')](_['pick'](_0x1db8df[_0x0eae('0x33')],_0x288f74[_0x0eae('0x34')]),_0x5da938);if(_0x1db8df[_0x0eae('0x33')]['filter']){_0x291078[_0x0eae('0x3d')]=_['merge'](_0x291078['where'],{'$or':_[_0x0eae('0x3e')](_0x291078[_0x0eae('0x37')],function(_0x1817ac){var _0x24eba2={};_0x24eba2[_0x1817ac]={'$like':'%'+_0x1db8df['query'][_0x0eae('0x3f')]+'%'};return _0x24eba2;})});}_0x291078=_[_0x0eae('0x40')]({},_0x291078,_0x1db8df['options']);var _0x4792df={'where':_0x291078['where']};return db[_0x0eae('0x2f')][_0x0eae('0x21')](_0x4792df)[_0x0eae('0x26')](function(_0x51d187){_0x3b42e8[_0x0eae('0x21')]=_0x51d187;if(_0x1db8df[_0x0eae('0x33')]['includeAll']){_0x291078[_0x0eae('0x41')]=[{'all':!![]}];}return db['CmCompany'][_0x0eae('0x42')](_0x291078);})['then'](function(_0x40a19d){_0x3b42e8[_0x0eae('0x43')]=_0x40a19d;return _0x3b42e8;})['then'](respondWithFilteredResult(_0x3ba4a7,_0x291078))[_0x0eae('0x44')](handleError(_0x3ba4a7,null));})['catch'](handleError(_0x3ba4a7,null));};exports[_0x0eae('0x45')]=function(_0x4c62f4,_0xd3503c){var _0x7a0285={'raw':![],'where':{'id':_0x4c62f4['params']['id']}},_0x195ff3={};_0x195ff3[_0x0eae('0x31')]=_['keys'](db[_0x0eae('0x2f')][_0x0eae('0x46')]);_0x195ff3[_0x0eae('0x33')]=_[_0x0eae('0x32')](_0x4c62f4[_0x0eae('0x33')]);_0x195ff3[_0x0eae('0x34')]=_['intersection'](_0x195ff3[_0x0eae('0x31')],_0x195ff3[_0x0eae('0x33')]);_0x7a0285[_0x0eae('0x37')]=_[_0x0eae('0x35')](_0x195ff3[_0x0eae('0x31')],qs['fields'](_0x4c62f4[_0x0eae('0x33')][_0x0eae('0x36')]));_0x7a0285[_0x0eae('0x37')]=_0x7a0285[_0x0eae('0x37')][_0x0eae('0x38')]?_0x7a0285[_0x0eae('0x37')]:_0x195ff3[_0x0eae('0x31')];if(_0x4c62f4[_0x0eae('0x33')][_0x0eae('0x47')]){_0x7a0285['include']=[{'all':!![]}];}_0x7a0285=_['merge']({},_0x7a0285,_0x4c62f4['options']);return db[_0x0eae('0x2f')]['find'](_0x7a0285)[_0x0eae('0x26')](handleEntityNotFound(_0xd3503c,null))[_0x0eae('0x26')](respondWithResult(_0xd3503c,null))[_0x0eae('0x44')](handleError(_0xd3503c,null));};exports['create']=function(_0x43ca79,_0x22750e){return db[_0x0eae('0x2f')][_0x0eae('0x48')](_0x43ca79[_0x0eae('0x49')],{})[_0x0eae('0x26')](function(_0x3d7ac2){var _0x2e37b3=_0x43ca79[_0x0eae('0x4a')][_0x0eae('0x4b')]({'plain':!![]});if(!_0x2e37b3)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2e37b3[_0x0eae('0x4c')]===_0x0eae('0x4a')){var _0x4ea693=_0x3d7ac2['get']({'plain':!![]});var _0x18d3e8=_0x0eae('0x28');return db[_0x0eae('0x4d')]['find']({'where':{'name':_0x18d3e8,'userProfileId':_0x2e37b3[_0x0eae('0x4e')]},'raw':!![]})[_0x0eae('0x26')](function(_0x2b3b63){if(_0x2b3b63&&_0x2b3b63['autoAssociation']===0x0){return db[_0x0eae('0x29')][_0x0eae('0x48')]({'name':_0x4ea693[_0x0eae('0x2c')],'resourceId':_0x4ea693['id'],'type':_0x2b3b63[_0x0eae('0x2c')],'sectionId':_0x2b3b63['id']},{})[_0x0eae('0x26')](function(){return _0x3d7ac2;});}else{return _0x3d7ac2;}})[_0x0eae('0x44')](function(_0x444b82){logger[_0x0eae('0x2a')](_0x0eae('0x4f'),_0x444b82);throw _0x444b82;});}return _0x3d7ac2;})['then'](respondWithResult(_0x22750e,0xc9))[_0x0eae('0x44')](handleError(_0x22750e,null));};exports[_0x0eae('0x50')]=function(_0x196629,_0x289dde){if(_0x196629[_0x0eae('0x49')]['id']){delete _0x196629[_0x0eae('0x49')]['id'];}return db['CmCompany'][_0x0eae('0x51')]({'where':{'id':_0x196629[_0x0eae('0x52')]['id']}})[_0x0eae('0x26')](handleEntityNotFound(_0x289dde,null))[_0x0eae('0x26')](saveUpdates(_0x196629['body'],null))[_0x0eae('0x26')](respondWithResult(_0x289dde,null))['catch'](handleError(_0x289dde,null));};exports['destroy']=function(_0x1989ca,_0x54b765){return db['CmCompany'][_0x0eae('0x51')]({'where':{'id':_0x1989ca['params']['id']}})['then'](handleEntityNotFound(_0x54b765,null))[_0x0eae('0x26')](removeEntity(_0x54b765,null))[_0x0eae('0x44')](handleError(_0x54b765,null));};exports[_0x0eae('0x30')]=function(_0x5d5bfd,_0x5844c0){return db['CmCompany'][_0x0eae('0x30')]()[_0x0eae('0x26')](respondWithResult(_0x5844c0,null))[_0x0eae('0x44')](handleError(_0x5844c0,null));};exports[_0x0eae('0x53')]=function(_0x2e95de,_0x528dfe,_0x39632c){return db[_0x0eae('0x54')][_0x0eae('0x51')]({'where':{'id':_0x2e95de['params']['id']}})[_0x0eae('0x26')](handleEntityNotFound(_0x528dfe,null))[_0x0eae('0x26')](function(_0x3b323){if(_0x3b323){return _0x3b323[_0x0eae('0x53')](_0x2e95de['body'][_0x0eae('0x55')],_['omit'](_0x2e95de[_0x0eae('0x49')],[_0x0eae('0x55'),'id'])||{});}})['then'](respondWithResult(_0x528dfe,null))[_0x0eae('0x44')](handleError(_0x528dfe,null));};exports[_0x0eae('0x56')]=function(_0x430c2b,_0x188b7e,_0x337dab){var _0x228437={};var _0x4c6549={};var _0x3e5c9e;var _0x210542;return db['CmCompany'][_0x0eae('0x57')]({'where':{'id':_0x430c2b[_0x0eae('0x52')]['id']}})[_0x0eae('0x26')](handleEntityNotFound(_0x188b7e,null))[_0x0eae('0x26')](function(_0x487690){if(_0x487690){_0x3e5c9e=_0x487690;_0x4c6549[_0x0eae('0x31')]=_[_0x0eae('0x32')](db[_0x0eae('0x54')][_0x0eae('0x46')]);_0x4c6549['query']=_[_0x0eae('0x32')](_0x430c2b['query']);_0x4c6549[_0x0eae('0x34')]=_[_0x0eae('0x35')](_0x4c6549[_0x0eae('0x31')],_0x4c6549[_0x0eae('0x33')]);_0x228437[_0x0eae('0x37')]=_[_0x0eae('0x35')](_0x4c6549[_0x0eae('0x31')],qs[_0x0eae('0x36')](_0x430c2b[_0x0eae('0x33')][_0x0eae('0x36')]));_0x228437[_0x0eae('0x37')]=_0x228437[_0x0eae('0x37')][_0x0eae('0x38')]?_0x228437[_0x0eae('0x37')]:_0x4c6549[_0x0eae('0x31')];_0x228437[_0x0eae('0x3b')]=qs[_0x0eae('0x3c')](_0x430c2b[_0x0eae('0x33')][_0x0eae('0x3c')]);_0x228437['where']=qs[_0x0eae('0x34')](_[_0x0eae('0x58')](_0x430c2b[_0x0eae('0x33')],_0x4c6549[_0x0eae('0x34')]));if(_0x430c2b[_0x0eae('0x33')][_0x0eae('0x3f')]){_0x228437['where']=_['merge'](_0x228437['where'],{'$or':_[_0x0eae('0x3e')](_0x228437[_0x0eae('0x37')],function(_0x582862){var _0x350bb1={};_0x350bb1[_0x582862]={'$like':'%'+_0x430c2b[_0x0eae('0x33')][_0x0eae('0x3f')]+'%'};return _0x350bb1;})});}_0x228437=_[_0x0eae('0x40')]({},_0x228437,_0x430c2b[_0x0eae('0x59')]);return _0x3e5c9e['getContacts'](_0x228437);}})[_0x0eae('0x26')](function(_0x2e3b48){if(_0x2e3b48){_0x210542=_0x2e3b48[_0x0eae('0x38')];if(!_0x430c2b[_0x0eae('0x33')][_0x0eae('0x39')](_0x0eae('0x3a'))){_0x228437[_0x0eae('0x20')]=qs[_0x0eae('0x20')](_0x430c2b[_0x0eae('0x33')][_0x0eae('0x20')]);_0x228437[_0x0eae('0x1e')]=qs['offset'](_0x430c2b[_0x0eae('0x33')]['offset']);}return _0x3e5c9e[_0x0eae('0x56')](_0x228437);}})[_0x0eae('0x26')](function(_0x306517){if(_0x306517){return _0x306517?{'count':_0x210542,'rows':_0x306517}:null;}})[_0x0eae('0x26')](respondWithResult(_0x188b7e,null))[_0x0eae('0x44')](handleError(_0x188b7e,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index fae718c..48bbe2a 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 _0x671c=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports','define','CmCompany','cm_companies'];(function(_0x10d76c,_0x5a2b0f){var _0x4a4376=function(_0x143621){while(--_0x143621){_0x10d76c['push'](_0x10d76c['shift']());}};_0x4a4376(++_0x5a2b0f);}(_0x671c,0x11e));var _0xc671=function(_0x5c6067,_0x4e0ce3){_0x5c6067=_0x5c6067-0x0;var _0x3d31d3=_0x671c[_0x5c6067];return _0x3d31d3;};'use strict';var _=require(_0xc671('0x0'));var util=require(_0xc671('0x1'));var logger=require(_0xc671('0x2'))(_0xc671('0x3'));var moment=require(_0xc671('0x4'));var BPromise=require(_0xc671('0x5'));var rp=require(_0xc671('0x6'));var fs=require('fs');var path=require(_0xc671('0x7'));var rimraf=require('rimraf');var config=require(_0xc671('0x8'));var attributes=require('./cmCompany.attributes');module[_0xc671('0x9')]=function(_0x54d7f2,_0xfa3728){return _0x54d7f2[_0xc671('0xa')](_0xc671('0xb'),attributes,{'tableName':_0xc671('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0556=['CmCompany','cm_companies','util','../../config/logger','api','request-promise','./cmCompany.attributes','exports','define'];(function(_0x31520d,_0x50046a){var _0x4d0d26=function(_0x187fe0){while(--_0x187fe0){_0x31520d['push'](_0x31520d['shift']());}};_0x4d0d26(++_0x50046a);}(_0x0556,0x80));var _0x6055=function(_0x27ed41,_0xb780a1){_0x27ed41=_0x27ed41-0x0;var _0x507934=_0x0556[_0x27ed41];return _0x507934;};'use strict';var _=require('lodash');var util=require(_0x6055('0x0'));var logger=require(_0x6055('0x1'))(_0x6055('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x6055('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x6055('0x4'));module[_0x6055('0x5')]=function(_0x1df437,_0x556a5a){return _0x1df437[_0x6055('0x6')](_0x6055('0x7'),attributes,{'tableName':_0x6055('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.rpc.js b/server/api/cmCompany/cmCompany.rpc.js index 0112326..ca45cea 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 _0x3c73=['lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','request','then','info','request\x20sent','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','code','CmCompany,\x20%s,\x20%s','message','result'];(function(_0x56ad12,_0xbdbe29){var _0x34403a=function(_0x4a5969){while(--_0x4a5969){_0x56ad12['push'](_0x56ad12['shift']());}};_0x34403a(++_0xbdbe29);}(_0x3c73,0x1ce));var _0x33c7=function(_0x4e95f6,_0x59292a){_0x4e95f6=_0x4e95f6-0x0;var _0x799a=_0x3c73[_0x4e95f6];return _0x799a;};'use strict';var _=require(_0x33c7('0x0'));var util=require(_0x33c7('0x1'));var moment=require(_0x33c7('0x2'));var BPromise=require('bluebird');var rs=require(_0x33c7('0x3'));var fs=require('fs');var Redis=require(_0x33c7('0x4'));var db=require(_0x33c7('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x33c7('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x33c7('0x7'));var client=jayson[_0x33c7('0x8')][_0x33c7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x389957,_0x1c5c21,_0x482b90){return new BPromise(function(_0x45fe15,_0x1dc72b){return client[_0x33c7('0xa')](_0x389957,_0x482b90)[_0x33c7('0xb')](function(_0x442b25){logger[_0x33c7('0xc')]('CmCompany,\x20%s,\x20%s',_0x1c5c21,_0x33c7('0xd'));logger['debug'](_0x33c7('0xe'),_0x1c5c21,'request\x20sent',JSON[_0x33c7('0xf')](_0x442b25));if(_0x442b25[_0x33c7('0x10')]){if(_0x442b25[_0x33c7('0x10')][_0x33c7('0x11')]===0x1f4){logger[_0x33c7('0x10')](_0x33c7('0x12'),_0x1c5c21,_0x442b25[_0x33c7('0x10')]['message']);return _0x1dc72b(_0x442b25[_0x33c7('0x10')][_0x33c7('0x13')]);}logger[_0x33c7('0x10')](_0x33c7('0x12'),_0x1c5c21,_0x442b25[_0x33c7('0x10')][_0x33c7('0x13')]);return _0x45fe15(_0x442b25[_0x33c7('0x10')]['message']);}else{logger['info'](_0x33c7('0x12'),_0x1c5c21,'request\x20sent');_0x45fe15(_0x442b25[_0x33c7('0x14')]['message']);}})['catch'](function(_0x2329c7){logger['error']('CmCompany,\x20%s,\x20%s',_0x1c5c21,_0x2329c7);_0x1dc72b(_0x2329c7);});});} \ No newline at end of file +var _0x74a9=['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','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x548901,_0x1fa0a9){var _0x2d4ac3=function(_0x28d9b6){while(--_0x28d9b6){_0x548901['push'](_0x548901['shift']());}};_0x2d4ac3(++_0x1fa0a9);}(_0x74a9,0x108));var _0x974a=function(_0x57b38f,_0xc26f33){_0x57b38f=_0x57b38f-0x0;var _0x6aa12c=_0x74a9[_0x57b38f];return _0x6aa12c;};'use strict';var _=require(_0x974a('0x0'));var util=require(_0x974a('0x1'));var moment=require('moment');var BPromise=require(_0x974a('0x2'));var rs=require(_0x974a('0x3'));var fs=require('fs');var Redis=require(_0x974a('0x4'));var db=require(_0x974a('0x5'))['db'];var utils=require(_0x974a('0x6'));var logger=require(_0x974a('0x7'))(_0x974a('0x8'));var config=require(_0x974a('0x9'));var jayson=require(_0x974a('0xa'));var client=jayson[_0x974a('0xb')][_0x974a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x59b890,_0x15cad2,_0x16b2e8){return new BPromise(function(_0x56e148,_0x26b37e){return client[_0x974a('0xd')](_0x59b890,_0x16b2e8)[_0x974a('0xe')](function(_0x2c3469){logger[_0x974a('0xf')](_0x974a('0x10'),_0x15cad2,_0x974a('0x11'));logger[_0x974a('0x12')](_0x974a('0x13'),_0x15cad2,_0x974a('0x11'),JSON[_0x974a('0x14')](_0x2c3469));if(_0x2c3469[_0x974a('0x15')]){if(_0x2c3469['error'][_0x974a('0x16')]===0x1f4){logger[_0x974a('0x15')](_0x974a('0x10'),_0x15cad2,_0x2c3469[_0x974a('0x15')][_0x974a('0x17')]);return _0x26b37e(_0x2c3469[_0x974a('0x15')][_0x974a('0x17')]);}logger[_0x974a('0x15')](_0x974a('0x10'),_0x15cad2,_0x2c3469[_0x974a('0x15')][_0x974a('0x17')]);return _0x56e148(_0x2c3469['error']['message']);}else{logger[_0x974a('0xf')]('CmCompany,\x20%s,\x20%s',_0x15cad2,'request\x20sent');_0x56e148(_0x2c3469[_0x974a('0x18')][_0x974a('0x17')]);}})['catch'](function(_0x3d220d){logger['error'](_0x974a('0x10'),_0x15cad2,_0x3d220d);_0x26b37e(_0x3d220d);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index d9f817f..4fc531a 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 _0x252c=['/:id/contacts','getContacts','post','create','addContacts','delete','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cmCompany.controller','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0x8e2097,_0x1ed2d1){var _0x45b706=function(_0x444abe){while(--_0x444abe){_0x8e2097['push'](_0x8e2097['shift']());}};_0x45b706(++_0x1ed2d1);}(_0x252c,0x18e));var _0xc252=function(_0x23c1f3,_0x56dfd6){_0x23c1f3=_0x23c1f3-0x0;var _0x1cbd48=_0x252c[_0x23c1f3];return _0x1cbd48;};'use strict';var multer=require(_0xc252('0x0'));var util=require(_0xc252('0x1'));var path=require(_0xc252('0x2'));var timeout=require(_0xc252('0x3'));var express=require('express');var router=express[_0xc252('0x4')]();var fs_extra=require(_0xc252('0x5'));var auth=require(_0xc252('0x6'));var interaction=require(_0xc252('0x7'));var config=require('../../config/environment');var controller=require(_0xc252('0x8'));router[_0xc252('0x9')]('/',auth[_0xc252('0xa')](),controller[_0xc252('0xb')]);router[_0xc252('0x9')](_0xc252('0xc'),auth[_0xc252('0xa')](),controller[_0xc252('0xd')]);router[_0xc252('0x9')](_0xc252('0xe'),auth['isAuthenticated'](),controller[_0xc252('0xf')]);router[_0xc252('0x9')](_0xc252('0x10'),auth[_0xc252('0xa')](),controller[_0xc252('0x11')]);router[_0xc252('0x12')]('/',auth['isAuthenticated'](),controller[_0xc252('0x13')]);router['post'](_0xc252('0x10'),auth[_0xc252('0xa')](),controller[_0xc252('0x14')]);router['put'](_0xc252('0xe'),auth[_0xc252('0xa')](),controller['update']);router[_0xc252('0x15')](_0xc252('0xe'),auth['isAuthenticated'](),controller[_0xc252('0x16')]);module['exports']=router; \ No newline at end of file +var _0x6d27=['isAuthenticated','index','/describe','describe','/:id','show','/:id/contacts','post','put','delete','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./cmCompany.controller','get'];(function(_0x30aee9,_0x3ad8df){var _0x3ea70b=function(_0x268c11){while(--_0x268c11){_0x30aee9['push'](_0x30aee9['shift']());}};_0x3ea70b(++_0x3ad8df);}(_0x6d27,0x15b));var _0x76d2=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0x6d27[_0x422905];return _0x33dc6c;};'use strict';var multer=require(_0x76d2('0x0'));var util=require(_0x76d2('0x1'));var path=require(_0x76d2('0x2'));var timeout=require('connect-timeout');var express=require(_0x76d2('0x3'));var router=express[_0x76d2('0x4')]();var fs_extra=require(_0x76d2('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x76d2('0x6'));var config=require(_0x76d2('0x7'));var controller=require(_0x76d2('0x8'));router[_0x76d2('0x9')]('/',auth[_0x76d2('0xa')](),controller[_0x76d2('0xb')]);router[_0x76d2('0x9')](_0x76d2('0xc'),auth['isAuthenticated'](),controller[_0x76d2('0xd')]);router['get'](_0x76d2('0xe'),auth['isAuthenticated'](),controller[_0x76d2('0xf')]);router[_0x76d2('0x9')](_0x76d2('0x10'),auth[_0x76d2('0xa')](),controller['getContacts']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x76d2('0x11')]('/:id/contacts',auth['isAuthenticated'](),controller['addContacts']);router[_0x76d2('0x12')](_0x76d2('0xe'),auth[_0x76d2('0xa')](),controller['update']);router[_0x76d2('0x13')](_0x76d2('0xe'),auth[_0x76d2('0xa')](),controller['destroy']);module[_0x76d2('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 086894d..c9a13c4 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 _0x235c=['sequelize','exports','STRING','TEXT','INTEGER','DATE','NOW','lodash'];(function(_0x353bbb,_0x56e1ab){var _0x4e6a0e=function(_0x2e1703){while(--_0x2e1703){_0x353bbb['push'](_0x353bbb['shift']());}};_0x4e6a0e(++_0x56e1ab);}(_0x235c,0x18f));var _0xc235=function(_0x2b1f33,_0x55855b){_0x2b1f33=_0x2b1f33-0x0;var _0x7840d3=_0x235c[_0x2b1f33];return _0x7840d3;};'use strict';var _=require(_0xc235('0x0'));var Sequelize=require(_0xc235('0x1'));module[_0xc235('0x2')]={'firstName':{'type':Sequelize[_0xc235('0x3')],'allowNull':![]},'lastName':{'type':Sequelize[_0xc235('0x3')]},'street':{'type':Sequelize[_0xc235('0x3')]},'postalCode':{'type':Sequelize[_0xc235('0x3')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0xc235('0x3')]},'dateOfBirth':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xc235('0x4')]},'phone':{'type':Sequelize[_0xc235('0x3')]},'mobile':{'type':Sequelize[_0xc235('0x3')]},'fax':{'type':Sequelize[_0xc235('0x3')]},'email':{'type':Sequelize['STRING']},'url':{'type':Sequelize[_0xc235('0x3')]},'facebook':{'type':Sequelize[_0xc235('0x3')]},'fb_data':{'type':Sequelize[_0xc235('0x3')]},'twitter':{'type':Sequelize[_0xc235('0x3')]},'skype':{'type':Sequelize[_0xc235('0x3')]},'teams':{'type':Sequelize['STRING']},'viber':{'type':Sequelize['STRING']},'line':{'type':Sequelize['STRING']},'wechat':{'type':Sequelize[_0xc235('0x3')]},'telegram':{'type':Sequelize[_0xc235('0x3')]},'UserId':{'type':Sequelize[_0xc235('0x5')]},'AdditionalPhones':{'type':Sequelize[_0xc235('0x3')]},'priority':{'type':Sequelize[_0xc235('0x5')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xc235('0x6')],'defaultValue':Sequelize[_0xc235('0x7')]},'dialTimezone':{'type':Sequelize[_0xc235('0x3')]},'utcOffset':{'type':Sequelize[_0xc235('0x5')]}}; \ No newline at end of file +var _0xed7a=['lodash','sequelize','exports','STRING','TEXT','INTEGER','UNSIGNED','DATE','NOW'];(function(_0x10bd33,_0x2c9707){var _0x5d8786=function(_0xc42fed){while(--_0xc42fed){_0x10bd33['push'](_0x10bd33['shift']());}};_0x5d8786(++_0x2c9707);}(_0xed7a,0x1c2));var _0xaed7=function(_0x2b1ef5,_0x36920d){_0x2b1ef5=_0x2b1ef5-0x0;var _0x12e95d=_0xed7a[_0x2b1ef5];return _0x12e95d;};'use strict';var _=require(_0xaed7('0x0'));var Sequelize=require(_0xaed7('0x1'));module[_0xaed7('0x2')]={'firstName':{'type':Sequelize[_0xaed7('0x3')],'allowNull':![]},'lastName':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0xaed7('0x3')]},'postalCode':{'type':Sequelize[_0xaed7('0x3')]},'city':{'type':Sequelize[_0xaed7('0x3')]},'country':{'type':Sequelize[_0xaed7('0x3')]},'dateOfBirth':{'type':Sequelize[_0xaed7('0x3')]},'description':{'type':Sequelize[_0xaed7('0x4')]},'phone':{'type':Sequelize[_0xaed7('0x3')]},'mobile':{'type':Sequelize[_0xaed7('0x3')]},'fax':{'type':Sequelize[_0xaed7('0x3')]},'email':{'type':Sequelize[_0xaed7('0x3')]},'url':{'type':Sequelize['STRING']},'facebook':{'type':Sequelize[_0xaed7('0x3')]},'fb_data':{'type':Sequelize[_0xaed7('0x3')]},'twitter':{'type':Sequelize['STRING']},'skype':{'type':Sequelize[_0xaed7('0x3')]},'teams':{'type':Sequelize['STRING']},'viber':{'type':Sequelize[_0xaed7('0x3')]},'line':{'type':Sequelize['STRING']},'wechat':{'type':Sequelize[_0xaed7('0x3')]},'telegram':{'type':Sequelize['STRING']},'UserId':{'type':Sequelize[_0xaed7('0x5')]},'AdditionalPhones':{'type':Sequelize[_0xaed7('0x3')]},'priority':{'type':Sequelize[_0xaed7('0x5')](0x2)[_0xaed7('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xaed7('0x7')],'defaultValue':Sequelize[_0xaed7('0x8')]},'dialTimezone':{'type':Sequelize[_0xaed7('0x3')]},'utcOffset':{'type':Sequelize[_0xaed7('0x5')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index daf847f..370b109 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 _0xb36a=['phone','getTags','findOne','model','rawAttributes','intersection','attributes','fields','order','sort','filters','merge','options','nolimit','limit','setTags','ids','OrderBy','items','item_types','ItemTypeId','description','contact\x20phone\x20exists','PHONE','CmHopperAdditionalPhone','item','literal','CmHopperId','ItemType.OrderBy','sequelize','`ItemType`.OrderBy','fromContactId','toContactId','getHoppers','ContactId','filter','includeAll','include','rows','getHopperHistories','CmHopperHistory','pick','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','split','Incorrect\x20binding\x20parameters\x20passed!','zipObject','firstName','No\x20firstName\x20column\x20specified','root','server/files/tmp','file','chmodSync','child_process','CompanyId','pid','upload','createReadStream','import','User','agent','No\x20phone\x20column\x20specified','binding','../../components/import/cm/csv2','stringify','start\x20child\x20process\x20correctly!','exit','importUpdates','fork','../../components/import/cm/csvUpdates','error\x20child\x20process','getJourney','mail','chat','sms','openchannel','fax','whatsapp','voice','-createdAt','resolve','channel','toLowerCase','Invalid\x20channel','range','parse','Invalid\x20date\x20for\x20range\x20from\x20filter','isValid','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter','uniqueid','source','destination','endtime','duration','note','createdAt','userDisposition','userSecondDisposition','userThirdDisposition','fullname','alias','findAndCountAll','startCase','Website','Account','closed','disposition','UserId','key','DESC','customerPort','deviceModel','osName','ratingType','ratingValue','referer','substatus','threadId','Interaction','Owner','flatten','sortBy','reverse','value','slice','moment','bluebird','util','path','lodash','squel','papaparse','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment/shared','../../mysqldb','redis','localhost','socket.io-emitter','./cmContact.socket','register','status','json','undefined','count','offset','set','Content-Range','update','then','sendStatus','error','stack','name','send','index','describe','findAll','query','catch','destroy','CmContact','params','length','keys','startsWith','columnName','displayName','analytics','CmCustomField','cf_','custom','type','values','info','Custom\x20field\x20%s\x20not\x20found\x20on\x20cm_contacts\x20table','forEach','hasOwnProperty','body','from','get','mergeWith','tags','isArray','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','[CmContact][merge][destroy][CmHopperBlack],\x20%s','ChatInteraction','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxMessage','OpenchannelMessage','CmContactHasItem','CmHopperFinal','ReportAgentPreview','VoiceCallReport','ChatQueueReport','FaxQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappQueueReport','create','join','isNil','timezones','utcOffset','additionalPhones','bulkCreate','duplicates','where','push','ListId','spread','contact','all','show','find','Tag','Tags','color','tag','ContactItemType','ItemType','Phones.OrderBy','$and','map','dialTimezone','omit','pickBy','format','cf_%d','isEmpty','cm_contacts','id\x20=\x20?','text'];(function(_0x1c87bc,_0x1ed010){var _0xbba8f6=function(_0x3efae1){while(--_0x3efae1){_0x1c87bc['push'](_0x1c87bc['shift']());}};_0xbba8f6(++_0x1ed010);}(_0xb36a,0x83));var _0xab36=function(_0x28ee99,_0x1c3d97){_0x28ee99=_0x28ee99-0x0;var _0x599dda=_0xb36a[_0x28ee99];return _0x599dda;};'use strict';var moment=require(_0xab36('0x0'));var BPromise=require(_0xab36('0x1'));var util=require(_0xab36('0x2'));var path=require(_0xab36('0x3'));var fs=require('fs');var _=require(_0xab36('0x4'));var squel=require(_0xab36('0x5'));var Papa=require(_0xab36('0x6'));var Redis=require(_0xab36('0x7'));var contacts=require('../../components/contacts');var qs=require(_0xab36('0x8'));var logger=require(_0xab36('0x9'))('api');var config=require('../../config/environment');var shared=require(_0xab36('0xa'));var db=require(_0xab36('0xb'))['db'];config[_0xab36('0xc')]=_['defaults'](config[_0xab36('0xc')],{'host':_0xab36('0xd'),'port':0x18eb});var socket=require(_0xab36('0xe'))(new Redis(config['redis']));require(_0xab36('0xf'))[_0xab36('0x10')](socket);function respondWithResult(_0x424087,_0x1a2994){_0x1a2994=_0x1a2994||0xc8;return function(_0x576f1f){if(_0x576f1f){return _0x424087[_0xab36('0x11')](_0x1a2994)[_0xab36('0x12')](_0x576f1f);}};}function respondWithFilteredResult(_0x2cd8b6,_0x1e93d2){return function(_0xcc69aa){if(_0xcc69aa){var _0x1d07cb=typeof _0x1e93d2['offset']===_0xab36('0x13')&&typeof _0x1e93d2['limit']===_0xab36('0x13');var _0x5a3014=_0xcc69aa[_0xab36('0x14')];var _0x26f7b7=_0x1d07cb?0x0:_0x1e93d2[_0xab36('0x15')];var _0x1e3d85=_0x1d07cb?_0xcc69aa[_0xab36('0x14')]:_0x1e93d2[_0xab36('0x15')]+_0x1e93d2['limit'];var _0x24f34b;if(_0x1e3d85>=_0x5a3014){_0x1e3d85=_0x5a3014;_0x24f34b=0xc8;}else{_0x24f34b=0xce;}_0x2cd8b6[_0xab36('0x11')](_0x24f34b);return _0x2cd8b6[_0xab36('0x16')](_0xab36('0x17'),_0x26f7b7+'-'+_0x1e3d85+'/'+_0x5a3014)['json'](_0xcc69aa);}return null;};}function saveUpdates(_0x34d182){return function(_0x1c4974){if(_0x1c4974){return _0x1c4974[_0xab36('0x18')](_0x34d182)[_0xab36('0x19')](function(_0x413c87){return _0x413c87;});}return null;};}function removeEntity(_0x46429e){return function(_0xf989bd){if(_0xf989bd){return _0xf989bd['destroy']()[_0xab36('0x19')](function(){_0x46429e[_0xab36('0x11')](0xcc)['end']();});}};}function handleEntityNotFound(_0x49d01d){return function(_0x24dfd7){if(!_0x24dfd7){_0x49d01d[_0xab36('0x1a')](0x194);}return _0x24dfd7;};}function handleError(_0x3ea1c1,_0x2c78e5){_0x2c78e5=_0x2c78e5||0x1f4;return function(_0x172b24){logger[_0xab36('0x1b')](_0x172b24[_0xab36('0x1c')]);if(_0x172b24[_0xab36('0x1d')]){delete _0x172b24[_0xab36('0x1d')];}_0x3ea1c1['status'](_0x2c78e5)[_0xab36('0x1e')](_0x172b24);};}exports[_0xab36('0x1f')]=function(_0x39519b,_0x25700c){var _0x5ac9c2={};return contacts[_0xab36('0x20')]()[_0xab36('0x19')](function(_0x1c433b){_0x5ac9c2=qs['getOptions'](_0x1c433b,_0x39519b);return contacts[_0xab36('0x21')](_0x39519b[_0xab36('0x22')],_0x39519b['user'],_0x5ac9c2,_0x1c433b);})[_0xab36('0x19')](respondWithFilteredResult(_0x25700c,_0x5ac9c2))[_0xab36('0x23')](handleError(_0x25700c,null));};exports[_0xab36('0x24')]=function(_0xd75ba2,_0x5c2f70){return db[_0xab36('0x25')]['find']({'where':{'id':_0xd75ba2[_0xab36('0x26')]['id']}})[_0xab36('0x19')](handleEntityNotFound(_0x5c2f70,null))[_0xab36('0x19')](removeEntity(_0x5c2f70,null))[_0xab36('0x23')](handleError(_0x5c2f70,null));};exports[_0xab36('0x20')]=function(_0x114514,_0x25d070){return db[_0xab36('0x25')][_0xab36('0x20')]()[_0xab36('0x19')](function(_0x249488){delete _0x249488['tags'];for(var _0x183250=0x0;_0x1832500x0){return new Promise(function(_0x3f4668){var _0x469ad7=[];for(var _0x22b978=0x0;_0x22b978<_0x5cda37[_0xab36('0x27')];_0x22b978++){_0x469ad7[_0xab36('0x5d')](insertAdditionalPhones(_0x5cda37[_0x22b978][_0xab36('0x60')],_0x5cda37[_0x22b978][_0xab36('0x59')]));}Promise[_0xab36('0x61')](_0x469ad7)[_0xab36('0x19')](function(){_0x3f4668(0x1);});})[_0xab36('0x19')](function(){return{'success':_0x1a681f,'failure':_0x1eb1c1,'duplicates':_0x4a1919};});}else{return{'success':_0x1a681f,'failure':_0x1eb1c1,'duplicates':_0x4a1919};}}})['then'](respondWithResult(_0x17e934,0xc9))['catch'](handleError(_0x17e934,null));};exports[_0xab36('0x62')]=function(_0x3344a3,_0x9e7064){var _0x2a6681;return db[_0xab36('0x25')][_0xab36('0x20')]()['then'](function(_0x29f92f){return db[_0xab36('0x25')][_0xab36('0x63')]({'where':{'id':_0x3344a3[_0xab36('0x26')]['id']},'include':[{'model':db[_0xab36('0x64')],'as':_0xab36('0x65'),'attributes':['id','name',_0xab36('0x66')],'required':_0x3344a3[_0xab36('0x22')][_0xab36('0x67')]?!![]:![]},{'model':db['CmContactHasItem'],'as':'Phones','where':{'CmContactId':_0x3344a3[_0xab36('0x26')]['id']},'required':![],'include':[{'model':db[_0xab36('0x68')],'as':_0xab36('0x69')}]}],'order':[db['sequelize']['literal'](_0xab36('0x6a'))],'attributes':_[_0xab36('0x28')](_0x29f92f)});})[_0xab36('0x19')](function(_0x57178e){if(!_['isNil'](_0x57178e)){_0x2a6681=_0x57178e['get']({'plain':!![]});var _0x6c975d={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x57178e&&_0x57178e[_0xab36('0x5e')]){if(_0x57178e[_0xab36('0x5e')]){_0x6c975d[_0xab36('0x5c')][_0xab36('0x6b')][_0xab36('0x5d')]({'ListId':{'$ne':_0x57178e['ListId']}});}}return db[_0xab36('0x2d')][_0xab36('0x21')](_0x6c975d);}})[_0xab36('0x19')](function(_0x44182d){if(!_['isNil'](_0x44182d)){return _['omit'](_0x2a6681,_[_0xab36('0x6c')](_0x44182d,function(_0x1bdaf1){return util['format']('cf_%d',_0x1bdaf1['id']);}));}})[_0xab36('0x19')](handleEntityNotFound(_0x9e7064,null))[_0xab36('0x19')](respondWithResult(_0x9e7064,null))[_0xab36('0x23')](handleError(_0x9e7064,null));};exports[_0xab36('0x18')]=function(_0x399bab,_0x30f0b9){var _0x4edef2;if(_0x399bab[_0xab36('0x36')]['id']){delete _0x399bab[_0xab36('0x36')]['id'];}if(!_['isNil'](_0x399bab[_0xab36('0x36')][_0xab36('0x6d')])){var _0x44056a=_0x399bab[_0xab36('0x36')][_0xab36('0x6d')];if(!_[_0xab36('0x56')](shared[_0xab36('0x57')][_0x44056a]))_0x399bab['body'][_0xab36('0x58')]=shared[_0xab36('0x57')][_0x44056a][_0xab36('0x58')];}return db['CmContact'][_0xab36('0x63')]({'where':{'id':_0x399bab[_0xab36('0x26')]['id']}})[_0xab36('0x19')](handleEntityNotFound(_0x30f0b9,null))['then'](saveUpdates(_0x399bab[_0xab36('0x36')],null))['then'](function(_0x5eed38){_0x4edef2=_0x5eed38;var _0x184fed={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x5eed38&&_0x5eed38['ListId']){if(_0x5eed38[_0xab36('0x5e')]){_0x184fed[_0xab36('0x5c')]['$and'][_0xab36('0x5d')]({'ListId':{'$ne':_0x5eed38[_0xab36('0x5e')]}});}}return db[_0xab36('0x2d')]['findAll'](_0x184fed);})['then'](function(_0x2f6c98){if(_0x2f6c98){return _[_0xab36('0x6e')](_[_0xab36('0x6f')](_0x399bab['body'],function(_0x4a5c0d,_0x487cb1){return _[_0xab36('0x29')](_0x487cb1,_0xab36('0x2e'));}),_[_0xab36('0x6c')](_0x2f6c98,function(_0x1b5cc8){return util[_0xab36('0x70')](_0xab36('0x71'),_0x1b5cc8['id']);}));}})[_0xab36('0x19')](function(_0x29acfb){if(_0x29acfb&&!_[_0xab36('0x72')](_0x29acfb)){var _0x13d44f=squel[_0xab36('0x18')]()['table'](_0xab36('0x73'))['setFields'](_0x29acfb)[_0xab36('0x5c')](_0xab36('0x74'),_0x399bab['params']['id'])['toParam']();return db['sequelize'][_0xab36('0x22')](_0x13d44f[_0xab36('0x75')],{'replacements':_0x13d44f['values']});}})[_0xab36('0x19')](function(){if(_0x399bab[_0xab36('0x36')][_0xab36('0x76')]&&_0x4edef2){return db[_0xab36('0x3d')]['update']({'phone':_0x399bab['body'][_0xab36('0x76')],'OrderBy':0x0},{'where':{'ContactId':_0x4edef2['id']}});}})[_0xab36('0x19')](function(){return _0x4edef2;})['then'](respondWithResult(_0x30f0b9,null))[_0xab36('0x23')](handleError(_0x30f0b9,null));};exports[_0xab36('0x77')]=function(_0x219caf,_0xc6b7f){var _0x611f52={};var _0x5b228e={};var _0x258cb9;var _0x471e3d;return db[_0xab36('0x25')][_0xab36('0x78')]({'where':{'id':_0x219caf[_0xab36('0x26')]['id']}})['then'](handleEntityNotFound(_0xc6b7f,null))[_0xab36('0x19')](function(_0x22236c){if(_0x22236c){_0x258cb9=_0x22236c;_0x5b228e[_0xab36('0x79')]=_[_0xab36('0x28')](db[_0xab36('0x64')][_0xab36('0x7a')]);_0x5b228e[_0xab36('0x22')]=_[_0xab36('0x28')](_0x219caf[_0xab36('0x22')]);_0x5b228e['filters']=_[_0xab36('0x7b')](_0x5b228e['model'],_0x5b228e[_0xab36('0x22')]);_0x611f52[_0xab36('0x7c')]=_[_0xab36('0x7b')](_0x5b228e[_0xab36('0x79')],qs[_0xab36('0x7d')](_0x219caf['query'][_0xab36('0x7d')]));_0x611f52[_0xab36('0x7c')]=_0x611f52['attributes']['length']?_0x611f52[_0xab36('0x7c')]:_0x5b228e[_0xab36('0x79')];_0x611f52[_0xab36('0x7e')]=qs['sort'](_0x219caf[_0xab36('0x22')][_0xab36('0x7f')]);_0x611f52['where']=qs[_0xab36('0x80')](_['pick'](_0x219caf['query'],_0x5b228e[_0xab36('0x80')]));if(_0x219caf[_0xab36('0x22')]['filter']){_0x611f52[_0xab36('0x5c')]=_[_0xab36('0x81')](_0x611f52[_0xab36('0x5c')],{'$or':_[_0xab36('0x6c')](_0x611f52['attributes'],function(_0x1a56e1){var _0x1890ae={};_0x1890ae[_0x1a56e1]={'$like':'%'+_0x219caf[_0xab36('0x22')]['filter']+'%'};return _0x1890ae;})});}_0x611f52=_[_0xab36('0x81')]({},_0x611f52,_0x219caf[_0xab36('0x82')]);return _0x258cb9[_0xab36('0x77')](_0x611f52);}})['then'](function(_0xc396ac){if(_0xc396ac){_0x471e3d=_0xc396ac['length'];if(!_0x219caf['query']['hasOwnProperty'](_0xab36('0x83'))){_0x611f52[_0xab36('0x84')]=qs[_0xab36('0x84')](_0x219caf[_0xab36('0x22')][_0xab36('0x84')]);_0x611f52['offset']=qs[_0xab36('0x15')](_0x219caf['query'][_0xab36('0x15')]);}return _0x258cb9[_0xab36('0x77')](_0x611f52);}})[_0xab36('0x19')](function(_0x99dd8e){if(_0x99dd8e){return _0x99dd8e?{'count':_0x471e3d,'rows':_0x99dd8e}:null;}})[_0xab36('0x19')](respondWithResult(_0xc6b7f,null))['catch'](handleError(_0xc6b7f,null));};exports[_0xab36('0x85')]=function(_0x3e5e72,_0x360b3b){if(_0x3e5e72[_0xab36('0x36')]['id']){delete _0x3e5e72['body']['id'];}return db[_0xab36('0x25')][_0xab36('0x78')]({'where':{'id':_0x3e5e72['params']['id']}})['then'](handleEntityNotFound(_0x360b3b,null))[_0xab36('0x19')](function(_0x332ee3){if(_0x332ee3){return _0x332ee3['setTags'](_0x3e5e72[_0xab36('0x36')][_0xab36('0x86')]||[]);}return null;})['then'](respondWithResult(_0x360b3b,null))[_0xab36('0x23')](handleError(_0x360b3b,null));};exports['setAdditionalPhones']=function(_0x3dbe6c,_0x11e14a){var _0x32c155=[];_0x32c155[_0xab36('0x5d')](addAdditionalPhones(_0x3dbe6c[_0xab36('0x36')]));Promise['all'](_0x32c155)['then'](function(){_0x32c155=[];_0x32c155[_0xab36('0x5d')](deleteCmHopperPhones(_0x3dbe6c['body']['id']));_0x32c155[_0xab36('0x5d')](addCmHopperPhones(_0x3dbe6c['body']['id']));Promise[_0xab36('0x61')](_0x32c155)[_0xab36('0x19')](function(){return[0x1];})[_0xab36('0x19')](respondWithResult(_0x11e14a,null));});};function addAdditionalPhones(_0x3af90a){var _0x16b814;return new Promise(function(_0x3411d0){return db['CmContactHasItem'][_0xab36('0x24')]({'where':{'CmContactId':_0x3af90a['id']}})[_0xab36('0x19')](function(){db['ContactItemType'][_0xab36('0x21')]({'raw':!![],'attributes':['id',_0xab36('0x87')]})['then'](function(_0x42cf64){var _0x4202ed=[];for(var _0x116e39=0x0;_0x116e39<_0x3af90a[_0xab36('0x88')]['length'];_0x116e39++){var _0xfae751=_0x3af90a[_0xab36('0x89')]?_[_0xab36('0x56')](_0x3af90a[_0xab36('0x89')][_0x116e39])?'':_0x3af90a['item_types'][_0x116e39]:_0x3af90a[_0xab36('0x88')][_0x116e39][_0xab36('0x8a')]?_0x3af90a[_0xab36('0x88')][_0x116e39][_0xab36('0x8a')]:'';var _0x2bac5e=_[_0xab36('0x56')](_0x3af90a[_0xab36('0x88')][_0x116e39][_0xab36('0x8b')])?'':_0x3af90a[_0xab36('0x88')][_0x116e39]['description'];var _0x1d99af=_0xfae751+':'+_0x3af90a[_0xab36('0x88')][_0x116e39][_0xab36('0x76')]+'§'+_0x2bac5e;if(_[_0xab36('0x56')](_0x16b814))_0x16b814=_0x1d99af;else _0x16b814+=';'+_0x1d99af;var _0x15e2b9=null;var _0x127156=null;if(_0x3af90a[_0xab36('0x89')]){if(!_[_0xab36('0x56')](_0x3af90a[_0xab36('0x89')][_0x116e39])){_0x127156=_[_0xab36('0x63')](_0x42cf64,function(_0x3730fa){return _0x3730fa['id']===_0x3af90a[_0xab36('0x89')][_0x116e39];});if(!_[_0xab36('0x56')](_0x127156)){_0x15e2b9=_0x127156[_0xab36('0x87')];}}}else{if(!_[_0xab36('0x56')](_0x3af90a[_0xab36('0x88')][_0x116e39])){_0x127156=_[_0xab36('0x63')](_0x42cf64,function(_0x250d8d){return _0x250d8d['id']===_0x3af90a['items'][_0x116e39][_0xab36('0x8a')];});if(!_[_0xab36('0x56')](_0x127156)){_0x15e2b9=_0x116e39;}}}if(_[_0xab36('0x56')](_0x15e2b9)){_0x15e2b9=0x64;}_0x4202ed[_0xab36('0x5d')](addAdditionalPhone(_0x3af90a['id'],_0x3af90a[_0xab36('0x88')][_0x116e39]['phone'],_0x3af90a['item_types']?_[_0xab36('0x56')](_0x3af90a[_0xab36('0x89')][_0x116e39])?null:_0x3af90a[_0xab36('0x89')][_0x116e39]:_0x3af90a[_0xab36('0x88')][_0x116e39][_0xab36('0x8a')]?_0x3af90a[_0xab36('0x88')][_0x116e39][_0xab36('0x8a')]:null,_0x15e2b9,_0x2bac5e));}Promise[_0xab36('0x61')](_0x4202ed)[_0xab36('0x19')](function(){db['CmContact']['update']({'AdditionalPhones':_0x16b814},{'where':{'id':_0x3af90a['id']}})[_0xab36('0x19')](function(){_0x3411d0(0x1);});});});});});}function addAdditionalPhone(_0x4f29cd,_0x16a7b5,_0x435f89,_0x321ff0,_0x1afd1c){return db['CmContactHasItem']['find']({'where':{'CmContactId':_0x4f29cd,'item':_0x16a7b5}})[_0xab36('0x19')](function(_0x11d8e5){if(_0x11d8e5)logger['info'](_0xab36('0x8c'),_0x11d8e5);else{db[_0xab36('0x49')][_0xab36('0x54')]({'CmContactId':_0x4f29cd,'item':_0x16a7b5,'ItemTypeId':_0x435f89,'OrderBy':_0x321ff0,'ItemClass':_0xab36('0x8d'),'description':_0x1afd1c});}});}function deleteCmHopperPhones(_0xd32b05){return new Promise(function(_0x4db3eb){return db[_0xab36('0x3d')][_0xab36('0x21')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0xd32b05}})[_0xab36('0x19')](function(_0x5cc91d){db[_0xab36('0x8e')][_0xab36('0x24')]({'where':{'CmHopperId':{'$in':_[_0xab36('0x6c')](_0x5cc91d,'id')}}});})[_0xab36('0x19')](function(){_0x4db3eb(0x1);});});}function addCmHopperPhones(_0x1ca599){return new Promise(function(_0x502c0b){return db[_0xab36('0x3d')][_0xab36('0x21')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x1ca599}})[_0xab36('0x19')](function(_0x11ed8a){var _0x20ad46=[];_['map'](_0x11ed8a,function(_0x5bfdd5){_0x20ad46[_0xab36('0x5d')](createCmHopperPhone(_0x1ca599,_0x5bfdd5['id']));});Promise[_0xab36('0x61')](_0x20ad46)[_0xab36('0x19')](function(){_0x502c0b(0x1);});});});}function createCmHopperPhone(_0x6c711a,_0x4e39e8){return new Promise(function(_0x2e1982){db['CmContactHasItem'][_0xab36('0x21')]({'raw':!![],'attributes':[_0xab36('0x8f'),_0xab36('0x87')],'where':{'CmContactId':_0x6c711a,'ItemClass':'PHONE'},'include':[{'model':db[_0xab36('0x68')],'attributes':[_0xab36('0x87')],'as':_0xab36('0x69')}],'order':[_0xab36('0x87'),db['sequelize'][_0xab36('0x90')]('`ItemType`.OrderBy')]})[_0xab36('0x19')](function(_0x11a722){var _0x23b40e=0x1;var _0x5435d8=_[_0xab36('0x6c')](_0x11a722,function(_0x550b13){_0x550b13[_0xab36('0x91')]=_0x4e39e8;_0x550b13[_0xab36('0x76')]=_0x550b13[_0xab36('0x8f')];_0x550b13[_0xab36('0x87')]=_0x23b40e;delete _0x550b13[_0xab36('0x92')];_0x23b40e=_0x23b40e+0x1;return _0x550b13;});return db['CmHopperAdditionalPhone'][_0xab36('0x5a')](_0x5435d8,{});})[_0xab36('0x19')](function(){_0x2e1982(0x1);});});}function insertAdditionalPhones(_0x394134,_0x464dcc){return new Promise(function(_0xbc13bd){var _0x423b59=[];for(var _0x55c24e=0x0;_0x55c24e<_0x464dcc['length'];_0x55c24e++){var _0x4959bf=_0x464dcc[_0x55c24e];_0x423b59[_0xab36('0x5d')](parseContactItemType(_0x4959bf));}Promise[_0xab36('0x61')](_0x423b59)[_0xab36('0x19')](function(){var _0x3d36b2={'id':_0x394134['id'],'items':_0x464dcc};return addAdditionalPhones(_0x3d36b2)[_0xab36('0x19')](function(){return addCmHopperPhones(_0x394134['id']);});})[_0xab36('0x19')](function(){_0xbc13bd(_0x394134);});});}function parseContactItemType(_0x44dca3){return new Promise(function(_0x33ac84){if(_0x44dca3[_0xab36('0x35')]('ItemTypeId')){_0x33ac84(_0x44dca3);}else{return db['ContactItemType'][_0xab36('0x63')]({'where':{'name':_0x44dca3[_0xab36('0x69')]}})[_0xab36('0x19')](function(_0x330704){if(_[_0xab36('0x56')](_0x330704))_0x44dca3[_0xab36('0x8a')]=null;else _0x44dca3[_0xab36('0x8a')]=_0x330704['id'];_0x33ac84(_0x44dca3);});}});}exports['getAdditionalPhones']=function(_0x467349,_0x475509){return db[_0xab36('0x49')][_0xab36('0x21')]({'raw':!![],'where':{'CmContactId':_0x467349[_0xab36('0x26')]['id'],'ItemClass':_0xab36('0x8d')},'include':[{'model':db[_0xab36('0x68')],'as':_0xab36('0x69')}],'order':[[_0xab36('0x87')],[db[_0xab36('0x93')][_0xab36('0x90')](_0xab36('0x94'))]]})[_0xab36('0x19')](function(_0x5ec824){return _0x5ec824;})['then'](respondWithResult(_0x475509,null))[_0xab36('0x23')](handleError(_0x475509,null));};exports['duplicateAdditionalPhones']=function(_0xcaf18e,_0x54fc56){return db[_0xab36('0x49')][_0xab36('0x21')]({'raw':!![],'where':{'CmContactId':_0xcaf18e[_0xab36('0x36')][_0xab36('0x95')]}})[_0xab36('0x19')](function(_0x430782){var _0x302fa8=_['map'](_0x430782,function(_0x1c5ee4){_0x1c5ee4['CmContactId']=_0xcaf18e['body'][_0xab36('0x96')];return _0x1c5ee4;});return db[_0xab36('0x49')][_0xab36('0x5a')](_0x302fa8,{});})[_0xab36('0x19')](function(){return addCmHopperPhones(_0xcaf18e[_0xab36('0x36')][_0xab36('0x96')]);})[_0xab36('0x19')](function(){return['ok'];})[_0xab36('0x19')](respondWithResult(_0x54fc56,null))['catch'](handleError(_0x54fc56,null));};exports['rescheduleAdditionalPhones']=function(_0x23f25d,_0xca0612){var _0x186b23=[];_0x186b23[_0xab36('0x5d')](createCmHopperPhone(_0x23f25d[_0xab36('0x36')]['id'],_0x23f25d[_0xab36('0x36')]['hopperId']));Promise[_0xab36('0x61')](_0x186b23)[_0xab36('0x19')](function(){return[0x1];})[_0xab36('0x19')](respondWithResult(_0xca0612,null));};exports[_0xab36('0x97')]=function(_0x330d2f,_0xcffa99){var _0x1f3138={'raw':![],'where':{}};var _0x862f4c={};var _0x12cf3c={'count':0x0,'rows':[]};return db['CmContact']['findOne']({'where':{'id':_0x330d2f['params']['id']}})[_0xab36('0x19')](handleEntityNotFound(_0xcffa99,null))[_0xab36('0x19')](function(_0x6247c1){if(_0x6247c1){_0x862f4c[_0xab36('0x79')]=_[_0xab36('0x28')](db[_0xab36('0x3d')][_0xab36('0x7a')]);_0x862f4c[_0xab36('0x22')]=_[_0xab36('0x28')](_0x330d2f[_0xab36('0x22')]);_0x862f4c[_0xab36('0x80')]=_[_0xab36('0x7b')](_0x862f4c[_0xab36('0x79')],_0x862f4c[_0xab36('0x22')]);_0x1f3138[_0xab36('0x7c')]=_[_0xab36('0x7b')](_0x862f4c['model'],qs[_0xab36('0x7d')](_0x330d2f['query'][_0xab36('0x7d')]));_0x1f3138[_0xab36('0x7c')]=_0x1f3138[_0xab36('0x7c')][_0xab36('0x27')]?_0x1f3138[_0xab36('0x7c')]:_0x862f4c[_0xab36('0x79')];if(!_0x330d2f[_0xab36('0x22')][_0xab36('0x35')](_0xab36('0x83'))){_0x1f3138['limit']=qs[_0xab36('0x84')](_0x330d2f[_0xab36('0x22')][_0xab36('0x84')]);_0x1f3138[_0xab36('0x15')]=qs['offset'](_0x330d2f['query'][_0xab36('0x15')]);}_0x1f3138[_0xab36('0x7e')]=qs['sort'](_0x330d2f[_0xab36('0x22')][_0xab36('0x7f')]);_0x1f3138[_0xab36('0x5c')]=qs[_0xab36('0x80')](_['pick'](_0x330d2f[_0xab36('0x22')],_0x862f4c['filters']));_0x1f3138[_0xab36('0x5c')][_0xab36('0x98')]=_0x6247c1['id'];if(_0x330d2f['query'][_0xab36('0x99')]){_0x1f3138['where']=_[_0xab36('0x81')](_0x1f3138['where'],{'$or':_[_0xab36('0x6c')](_0x1f3138[_0xab36('0x7c')],function(_0x5b8dc7){var _0x12caad={};_0x12caad[_0x5b8dc7]={'$like':'%'+_0x330d2f[_0xab36('0x22')][_0xab36('0x99')]+'%'};return _0x12caad;})});}_0x1f3138=_['merge']({},_0x1f3138,_0x330d2f[_0xab36('0x82')]);return db[_0xab36('0x3d')][_0xab36('0x14')]({'where':_0x1f3138[_0xab36('0x5c')]})[_0xab36('0x19')](function(_0x315104){_0x12cf3c[_0xab36('0x14')]=_0x315104;if(_0x330d2f['query'][_0xab36('0x9a')]){_0x1f3138[_0xab36('0x9b')]=[{'all':!![]}];}return db[_0xab36('0x3d')][_0xab36('0x21')](_0x1f3138);})[_0xab36('0x19')](function(_0x3d41b5){_0x12cf3c[_0xab36('0x9c')]=_0x3d41b5;return _0x12cf3c;});}})['then'](respondWithFilteredResult(_0xcffa99,_0x1f3138))[_0xab36('0x23')](handleError(_0xcffa99,null));};exports[_0xab36('0x9d')]=function(_0x1f842f,_0x394a56){var _0x5f52fc={'raw':!![],'where':{}};var _0x415606={};var _0x23f73c={'count':0x0,'rows':[]};return db['CmContact'][_0xab36('0x78')]({'where':{'id':_0x1f842f[_0xab36('0x26')]['id']}})[_0xab36('0x19')](handleEntityNotFound(_0x394a56,null))['then'](function(_0x425024){if(_0x425024){_0x415606[_0xab36('0x79')]=_[_0xab36('0x28')](db[_0xab36('0x9e')]['rawAttributes']);_0x415606['query']=_[_0xab36('0x28')](_0x1f842f[_0xab36('0x22')]);_0x415606[_0xab36('0x80')]=_[_0xab36('0x7b')](_0x415606[_0xab36('0x79')],_0x415606[_0xab36('0x22')]);_0x5f52fc[_0xab36('0x7c')]=_[_0xab36('0x7b')](_0x415606['model'],qs[_0xab36('0x7d')](_0x1f842f[_0xab36('0x22')][_0xab36('0x7d')]));_0x5f52fc[_0xab36('0x7c')]=_0x5f52fc['attributes'][_0xab36('0x27')]?_0x5f52fc[_0xab36('0x7c')]:_0x415606[_0xab36('0x79')];if(!_0x1f842f[_0xab36('0x22')][_0xab36('0x35')]('nolimit')){_0x5f52fc[_0xab36('0x84')]=qs[_0xab36('0x84')](_0x1f842f[_0xab36('0x22')][_0xab36('0x84')]);_0x5f52fc['offset']=qs[_0xab36('0x15')](_0x1f842f['query'][_0xab36('0x15')]);}_0x5f52fc[_0xab36('0x7e')]=qs['sort'](_0x1f842f[_0xab36('0x22')][_0xab36('0x7f')]);_0x5f52fc[_0xab36('0x5c')]=qs['filters'](_['pick'](_0x1f842f[_0xab36('0x22')],_0x415606[_0xab36('0x80')]));_0x5f52fc[_0xab36('0x5c')][_0xab36('0x98')]=_0x425024['id'];if(_0x1f842f['query'][_0xab36('0x99')]){_0x5f52fc['where']=_[_0xab36('0x81')](_0x5f52fc[_0xab36('0x5c')],{'$or':_[_0xab36('0x6c')](_0x5f52fc[_0xab36('0x7c')],function(_0x52a6b8){var _0x3ef984={};_0x3ef984[_0x52a6b8]={'$like':'%'+_0x1f842f[_0xab36('0x22')][_0xab36('0x99')]+'%'};return _0x3ef984;})});}_0x5f52fc=_['merge']({},_0x5f52fc,_0x1f842f[_0xab36('0x82')]);return db[_0xab36('0x9e')]['count']({'where':_0x5f52fc[_0xab36('0x5c')]})[_0xab36('0x19')](function(_0x13bae8){_0x23f73c[_0xab36('0x14')]=_0x13bae8;if(_0x1f842f[_0xab36('0x22')]['includeAll']){_0x5f52fc[_0xab36('0x9b')]=[{'all':!![]}];}return db['CmHopperHistory'][_0xab36('0x21')](_0x5f52fc);})['then'](function(_0x21ac7e){_0x23f73c[_0xab36('0x9c')]=_0x21ac7e;return _0x23f73c;});}})[_0xab36('0x19')](respondWithFilteredResult(_0x394a56,_0x5f52fc))['catch'](handleError(_0x394a56,null));};exports['getHopperFinals']=function(_0x11d079,_0x573e88){var _0x2dac03={'raw':!![],'where':{}};var _0x33c1c6={};var _0x1bffdc={'count':0x0,'rows':[]};return db[_0xab36('0x25')][_0xab36('0x78')]({'where':{'id':_0x11d079[_0xab36('0x26')]['id']}})['then'](handleEntityNotFound(_0x573e88,null))[_0xab36('0x19')](function(_0x2f18ee){if(_0x2f18ee){_0x33c1c6[_0xab36('0x79')]=_[_0xab36('0x28')](db[_0xab36('0x4a')][_0xab36('0x7a')]);_0x33c1c6[_0xab36('0x22')]=_[_0xab36('0x28')](_0x11d079[_0xab36('0x22')]);_0x33c1c6[_0xab36('0x80')]=_[_0xab36('0x7b')](_0x33c1c6[_0xab36('0x79')],_0x33c1c6[_0xab36('0x22')]);_0x2dac03[_0xab36('0x7c')]=_[_0xab36('0x7b')](_0x33c1c6[_0xab36('0x79')],qs[_0xab36('0x7d')](_0x11d079[_0xab36('0x22')][_0xab36('0x7d')]));_0x2dac03[_0xab36('0x7c')]=_0x2dac03['attributes'][_0xab36('0x27')]?_0x2dac03['attributes']:_0x33c1c6[_0xab36('0x79')];if(!_0x11d079['query'][_0xab36('0x35')]('nolimit')){_0x2dac03['limit']=qs[_0xab36('0x84')](_0x11d079[_0xab36('0x22')][_0xab36('0x84')]);_0x2dac03[_0xab36('0x15')]=qs[_0xab36('0x15')](_0x11d079[_0xab36('0x22')][_0xab36('0x15')]);}_0x2dac03[_0xab36('0x7e')]=qs['sort'](_0x11d079[_0xab36('0x22')][_0xab36('0x7f')]);_0x2dac03[_0xab36('0x5c')]=qs[_0xab36('0x80')](_[_0xab36('0x9f')](_0x11d079[_0xab36('0x22')],_0x33c1c6[_0xab36('0x80')]));_0x2dac03['where'][_0xab36('0x98')]=_0x2f18ee['id'];if(_0x11d079['query'][_0xab36('0x99')]){_0x2dac03[_0xab36('0x5c')]=_[_0xab36('0x81')](_0x2dac03[_0xab36('0x5c')],{'$or':_[_0xab36('0x6c')](_0x2dac03[_0xab36('0x7c')],function(_0x4f10dd){var _0x4c990f={};_0x4c990f[_0x4f10dd]={'$like':'%'+_0x11d079[_0xab36('0x22')][_0xab36('0x99')]+'%'};return _0x4c990f;})});}_0x2dac03=_[_0xab36('0x81')]({},_0x2dac03,_0x11d079[_0xab36('0x82')]);return db[_0xab36('0x4a')][_0xab36('0x14')]({'where':_0x2dac03[_0xab36('0x5c')]})[_0xab36('0x19')](function(_0x411e59){_0x1bffdc['count']=_0x411e59;if(_0x11d079[_0xab36('0x22')][_0xab36('0x9a')]){_0x2dac03[_0xab36('0x9b')]=[{'all':!![]}];}return db[_0xab36('0x4a')]['findAll'](_0x2dac03);})['then'](function(_0x231975){_0x1bffdc[_0xab36('0x9c')]=_0x231975;return _0x1bffdc;});}})['then'](respondWithFilteredResult(_0x573e88,_0x2dac03))[_0xab36('0x23')](handleError(_0x573e88,null));};exports['getJscriptySessions']=function(_0x2b3279,_0x1439d4){var _0x5d98d={'raw':!![],'where':{}};var _0x1b8f41={};var _0x234b51={'count':0x0,'rows':[]};return db['CmContact'][_0xab36('0x78')]({'where':{'id':_0x2b3279['params']['id']}})[_0xab36('0x19')](handleEntityNotFound(_0x1439d4,null))['then'](function(_0x38799a){if(_0x38799a){_0x1b8f41[_0xab36('0x79')]=_[_0xab36('0x28')](db[_0xab36('0x52')][_0xab36('0x7a')]);_0x1b8f41['query']=_[_0xab36('0x28')](_0x2b3279[_0xab36('0x22')]);_0x1b8f41[_0xab36('0x80')]=_['intersection'](_0x1b8f41['model'],_0x1b8f41[_0xab36('0x22')]);_0x5d98d[_0xab36('0x7c')]=_[_0xab36('0x7b')](_0x1b8f41['model'],qs[_0xab36('0x7d')](_0x2b3279['query']['fields']));_0x5d98d[_0xab36('0x7c')]=_0x5d98d[_0xab36('0x7c')][_0xab36('0x27')]?_0x5d98d['attributes']:_0x1b8f41[_0xab36('0x79')];if(!_0x2b3279[_0xab36('0x22')]['hasOwnProperty']('nolimit')){_0x5d98d[_0xab36('0x84')]=qs[_0xab36('0x84')](_0x2b3279[_0xab36('0x22')][_0xab36('0x84')]);_0x5d98d[_0xab36('0x15')]=qs[_0xab36('0x15')](_0x2b3279[_0xab36('0x22')][_0xab36('0x15')]);}_0x5d98d['order']=qs['sort'](_0x2b3279['query'][_0xab36('0x7f')]);_0x5d98d[_0xab36('0x5c')]=qs[_0xab36('0x80')](_['pick'](_0x2b3279[_0xab36('0x22')],_0x1b8f41[_0xab36('0x80')]));_0x5d98d[_0xab36('0x5c')]['ContactId']=_0x38799a['id'];if(_0x2b3279[_0xab36('0x22')][_0xab36('0x99')]){_0x5d98d['where']=_['merge'](_0x5d98d['where'],{'$or':_[_0xab36('0x6c')](_0x5d98d[_0xab36('0x7c')],function(_0x593068){var _0xa3cc28={};_0xa3cc28[_0x593068]={'$like':'%'+_0x2b3279[_0xab36('0x22')]['filter']+'%'};return _0xa3cc28;})});}_0x5d98d=_['merge']({},_0x5d98d,_0x2b3279['options']);return db[_0xab36('0x52')][_0xab36('0x14')]({'where':_0x5d98d[_0xab36('0x5c')]})[_0xab36('0x19')](function(_0xebec54){_0x234b51[_0xab36('0x14')]=_0xebec54;if(_0x2b3279['query'][_0xab36('0x9a')]){_0x5d98d[_0xab36('0x9b')]=[{'all':!![]}];}return db[_0xab36('0x52')][_0xab36('0x21')](_0x5d98d);})[_0xab36('0x19')](function(_0x43520c){_0x234b51[_0xab36('0x9c')]=_0x43520c;return _0x234b51;});}})[_0xab36('0x19')](respondWithFilteredResult(_0x1439d4,_0x5d98d))[_0xab36('0x23')](handleError(_0x1439d4,null));};exports['uploadCsv']=function(_0x48e82b,_0x2b22ce){try{if(!_0x48e82b['body']['ListId']){throw new Error(_0xab36('0xa0'));}if(!_0x48e82b[_0xab36('0x36')][_0xab36('0xa1')]){throw new Error(_0xab36('0xa2'));}if(!_0x48e82b[_0xab36('0x36')][_0xab36('0xa3')]){throw new Error(_0xab36('0xa4'));}if(!_0x48e82b[_0xab36('0x36')][_0xab36('0xa5')]){throw new Error(_0xab36('0xa6'));}var _0x5b7ae0=_0x48e82b[_0xab36('0x36')]['binding_keys'][_0xab36('0xa7')](',');var _0x44004b=_0x48e82b[_0xab36('0x36')][_0xab36('0xa3')]['split'](',');if(!_0x5b7ae0[_0xab36('0x27')]||!_0x44004b[_0xab36('0x27')]||_0x5b7ae0[_0xab36('0x27')]!==_0x44004b[_0xab36('0x27')]){throw new Error(_0xab36('0xa8'));}_0x48e82b[_0xab36('0x36')]['fields']=_[_0xab36('0xa9')](_0x5b7ae0,_0x44004b);if(!_0x48e82b[_0xab36('0x36')][_0xab36('0x7d')][_0xab36('0x76')]){throw new Error('No\x20phone\x20column\x20specified');}if(!_0x48e82b['body'][_0xab36('0x7d')][_0xab36('0xaa')]){throw new Error(_0xab36('0xab'));}var _0x5313a9=path[_0xab36('0x55')](config[_0xab36('0xac')],_0xab36('0xad'),_0x48e82b[_0xab36('0xae')]['filename']);fs[_0xab36('0xaf')](_0x5313a9,parseInt('0777',0x8));var _0xc8e58=require(_0xab36('0xb0'))['fork'](path['join'](__dirname,'../../components/import/cm/csv'),[_0x5313a9,_0x48e82b[_0xab36('0x36')][_0xab36('0xa1')],_0x48e82b['body']['binding_values'],_0x48e82b[_0xab36('0x36')][_0xab36('0x5e')],_0x48e82b[_0xab36('0x36')][_0xab36('0xb1')],_0x48e82b['body'][_0xab36('0x5b')],_0x48e82b[_0xab36('0x36')]['socket_timestamp']]);return _0x2b22ce[_0xab36('0x11')](0xc8)[_0xab36('0x12')]({'message':'File\x20uploaded\x20correctly!','pid':_0xc8e58[_0xab36('0xb2')]});}catch(_0x2d80a8){return _0x2b22ce['status'](0x1f4)['send'](_0x2d80a8);}};exports[_0xab36('0xb3')]=function(_0x49eb84,_0x2f8c5a){var _0x4e1523=fs[_0xab36('0xb4')](_0x49eb84['file'][_0xab36('0x3')]);Papa['parse'](_0x4e1523,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x1ab8bc){return _0x2f8c5a[_0xab36('0x11')](0xc8)[_0xab36('0x12')]({'file':_0x49eb84[_0xab36('0xae')],'fields':_0x1ab8bc['meta'][_0xab36('0x7d')]});}});};exports[_0xab36('0xb5')]=function(_0x4ee570,_0x4ef907){return db[_0xab36('0xb6')][_0xab36('0x21')]({'raw':!![],'attributes':['id'],'where':{'role':_0xab36('0xb7')}})[_0xab36('0x19')](function(_0x1c09a7){var _0xdf5f85=![];if(!_0x4ee570[_0xab36('0x36')][_0xab36('0x5e')]){throw new Error(_0xab36('0xa0'));}if(!_0x4ee570['body']['binding'][_0xab36('0x76')]){throw new Error(_0xab36('0xb8'));}if(!_0x4ee570['body'][_0xab36('0xb9')][_0xab36('0xaa')]){throw new Error(_0xab36('0xab'));}if(!_0x4ee570['body'][_0xab36('0xa5')]){throw new Error(_0xab36('0xa6'));}var _0x30ed04=require(_0xab36('0xb0'))['fork'](path[_0xab36('0x55')](__dirname,_0xab36('0xba')),[_0x4ee570['params']['id'],JSON['stringify'](_0x4ee570[_0xab36('0x36')]),JSON[_0xab36('0xbb')](_0x1c09a7)]);_0x30ed04['on']('message',function(){_0xdf5f85=!![];return _0x4ef907['status'](0xc8)['json']({'message':_0xab36('0xbc'),'pid':_0x30ed04[_0xab36('0xb2')]});});_0x30ed04['on'](_0xab36('0xbd'),function(_0x46db31){if(_0x46db31&&!_0xdf5f85){return _0x4ef907[_0xab36('0x11')](0x1f4)[_0xab36('0x12')]({'message':'error\x20child\x20process','pid':_0x30ed04[_0xab36('0xb2')]});}});})['catch'](handleError(_0x4ef907,null));};exports[_0xab36('0xbe')]=function(_0xcb7a2,_0x445a0a){return db[_0xab36('0xb6')][_0xab36('0x21')]({'raw':!![],'attributes':['id'],'where':{'role':_0xab36('0xb7')}})[_0xab36('0x19')](function(_0x44a44c){var _0xccf83e=![];if(!_0xcb7a2[_0xab36('0x36')][_0xab36('0x5e')]){throw new Error('No\x20ListId\x20specified');}if(!_0xcb7a2[_0xab36('0x36')][_0xab36('0xb9')][_0xab36('0x76')]){throw new Error('No\x20phone\x20column\x20specified');}if(!_0xcb7a2['body'][_0xab36('0xb9')][_0xab36('0xaa')]){throw new Error('No\x20firstName\x20column\x20specified');}if(!_0xcb7a2['body'][_0xab36('0xa5')]){throw new Error(_0xab36('0xa6'));}var _0x413d0d=require('child_process')[_0xab36('0xbf')](path['join'](__dirname,_0xab36('0xc0')),[_0xcb7a2[_0xab36('0x26')]['id'],JSON[_0xab36('0xbb')](_0xcb7a2[_0xab36('0x36')]),JSON[_0xab36('0xbb')](_0x44a44c)]);_0x413d0d['on']('message',function(){_0xccf83e=!![];return _0x445a0a[_0xab36('0x11')](0xc8)[_0xab36('0x12')]({'message':_0xab36('0xbc'),'pid':_0x413d0d[_0xab36('0xb2')]});});_0x413d0d['on'](_0xab36('0xbd'),function(_0x1dd1b3){if(_0x1dd1b3&&!_0xccf83e){return _0x445a0a[_0xab36('0x11')](0x1f4)[_0xab36('0x12')]({'message':_0xab36('0xc1'),'pid':_0x413d0d[_0xab36('0xb2')]});}});})['catch'](handleError(_0x445a0a,null));};exports[_0xab36('0xc2')]=function(_0x30b3ee,_0x3f9f1a){var _0x1235d4=[_0xab36('0xc3'),_0xab36('0xc4'),_0xab36('0xc5'),_0xab36('0xc6'),_0xab36('0xc7'),_0xab36('0xc8'),_0xab36('0xc9')];var _0x25a3bd={'offset':0x0,'order':qs[_0xab36('0x7f')](_0xab36('0xca'))},_0x4ec7c0={'count':0x0,'rows':[]};Promise[_0xab36('0xcb')]()['then'](function(){if(_0x30b3ee['query']['channel']){if(!_['includes'](_0x1235d4,_0x30b3ee[_0xab36('0x22')][_0xab36('0xcc')][_0xab36('0xcd')]())){throw new Error(_0xab36('0xce'));}_0x1235d4=[_0x30b3ee[_0xab36('0x22')][_0xab36('0xcc')]['toLowerCase']()];}if(_0x30b3ee[_0xab36('0x22')][_0xab36('0xcf')]){try{var _0x358d4b=JSON[_0xab36('0xd0')](_0x30b3ee['query'][_0xab36('0xcf')]);if(!moment(_0x358d4b['from'])['isValid']()){throw new Error(_0xab36('0xd1'));}if(!moment(_0x358d4b['to'])[_0xab36('0xd2')]()){throw new Error(_0xab36('0xd3'));}}catch(_0x5c8074){throw new Error(_0xab36('0xd4'));}}if(!_0x30b3ee[_0xab36('0x22')][_0xab36('0x35')](_0xab36('0x83'))){_0x25a3bd[_0xab36('0x84')]=qs[_0xab36('0x84')](_0x30b3ee[_0xab36('0x22')][_0xab36('0x84')]||0xa);_0x25a3bd[_0xab36('0x15')]=qs[_0xab36('0x15')](_0x30b3ee[_0xab36('0x22')][_0xab36('0x15')]);}var _0x369530=_0x1235d4['map'](function(_0x474f73){if(_0x474f73==='voice'){var _0x49a482={'attributes':['id',_0xab36('0xd5'),_0xab36('0x30'),_0xab36('0xd6'),_0xab36('0xd7'),'callerid','starttime',_0xab36('0xd8'),_0xab36('0xd9'),_0xab36('0xda'),_0xab36('0xdb'),_0xab36('0xdc'),_0xab36('0xdd'),_0xab36('0xde'),'UserId'],'where':{'ContactId':_0x30b3ee['params']['id']},'include':[{'model':db[_0xab36('0xb6')],'as':_0xab36('0xb6'),'attributes':['id',_0xab36('0x1d'),_0xab36('0xdf'),_0xab36('0xe0')]}],'order':[['createdAt','DESC']]};if(_0x30b3ee['query'][_0xab36('0xcf')]){_0x49a482[_0xab36('0x5c')][_0xab36('0xdb')]={'$gte':_0x358d4b[_0xab36('0x37')],'$lte':_0x358d4b['to']};}return db[_0xab36('0x4c')][_0xab36('0xe1')](_0x49a482)['then'](function(_0x300d8b){_0x4ec7c0[_0xab36('0x14')]+=_0x300d8b[_0xab36('0x14')];return _[_0xab36('0x6c')](_0x300d8b[_0xab36('0x9c')],function(_0xe5606b){var _0x3d9d4c=_0xe5606b[_0xab36('0x38')]({'plain':!![]});_0x3d9d4c[_0xab36('0xcc')]=_0x474f73;if(_0x3d9d4c['User']){_0x3d9d4c['User']={'id':_0x3d9d4c[_0xab36('0xb6')]['id'],'name':_0x3d9d4c[_0xab36('0xb6')][_0xab36('0x1d')],'fullname':_0x3d9d4c['User']['fullname'],'alias':_0x3d9d4c['User'][_0xab36('0xe0')]};}return _0x3d9d4c;});});}else{var _0x43786e=_[_0xab36('0xe2')](_0x474f73)+(_0x474f73===_0xab36('0xc4')?_0xab36('0xe3'):_0xab36('0xe4'));var _0x18128d={'attributes':['id',_0xab36('0xe5'),'closedAt','createdAt',_0xab36('0xda'),_0xab36('0xe6'),'secondDisposition','thirdDisposition',_0xab36('0xe7'),_0x43786e+'Id'],'where':{'ContactId':_0x30b3ee[_0xab36('0x26')]['id']},'include':[{'model':db[_0x43786e],'as':_0xab36('0xe4'),'attributes':['id',_0xab36('0x1d'),_0xab36('0xe8')]},{'model':db[_0xab36('0xb6')],'as':'Owner','attributes':['id','name',_0xab36('0xdf')]},{'model':db[_0xab36('0x64')],'as':_0xab36('0x65'),'attributes':['id','name',_0xab36('0x66')],'through':{'attributes':[]}}],'order':[[_0xab36('0xdb'),_0xab36('0xe9')]]};if(_0x30b3ee['query'][_0xab36('0xcf')]){_0x18128d[_0xab36('0x5c')][_0xab36('0xdb')]={'$gte':_0x358d4b[_0xab36('0x37')],'$lte':_0x358d4b['to']};}switch(_0x474f73){case _0xab36('0xc4'):_0x18128d['attributes'][_0xab36('0x5d')]('browserName','customerIp',_0xab36('0xea'),_0xab36('0xeb'),_0xab36('0xec'),'ratingMessage',_0xab36('0xed'),_0xab36('0xee'),_0xab36('0xef'));break;case'mail':_0x18128d['attributes']['push']('subject',_0xab36('0xf0'));break;case'openchannel':_0x18128d[_0xab36('0x7c')][_0xab36('0x5d')]('externalUrl',_0xab36('0xf1'));break;}return db[_[_0xab36('0xe2')](_0x474f73)+_0xab36('0xf2')][_0xab36('0xe1')](_0x18128d)[_0xab36('0x19')](function(_0x194f0c){_0x4ec7c0['count']+=_0x194f0c[_0xab36('0x14')];return _[_0xab36('0x6c')](_0x194f0c[_0xab36('0x9c')],function(_0x4549d3){var _0x44dc=_0x4549d3['get']({'plain':!![]});_0x44dc[_0xab36('0xcc')]=_0x474f73;if(_0x44dc[_0xab36('0xf3')]){_0x44dc[_0xab36('0xf3')]={'id':_0x44dc[_0xab36('0xf3')]['id'],'name':_0x44dc[_0xab36('0xf3')][_0xab36('0x1d')],'fullname':_0x44dc[_0xab36('0xf3')][_0xab36('0xdf')]};}return _0x44dc;});});}});return Promise['all'](_0x369530);})[_0xab36('0x19')](function(_0x37618f){return _(_0x37618f)[_0xab36('0xf4')]()[_0xab36('0xf5')](_0xab36('0xdb'))[_0xab36('0xf6')]()[_0xab36('0xf7')]();})[_0xab36('0x19')](function(_0xcb6eca){_0x4ec7c0[_0xab36('0x9c')]=_0x25a3bd[_0xab36('0x84')]?_0xcb6eca[_0xab36('0xf8')](_0x25a3bd[_0xab36('0x15')],_0x25a3bd[_0xab36('0x15')]+_0x25a3bd['limit']):_0xcb6eca;return _0x4ec7c0;})['then'](respondWithFilteredResult(_0x3f9f1a,_0x25a3bd))[_0xab36('0x23')](handleError(_0x3f9f1a,null));}; \ No newline at end of file +var _0x9fca=['CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','update','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelMessage','CmContactHasItem','CmHopperFinal','CmHopperHistory','ReportAgentPreview','FaxQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappQueueReport','isNil','dialTimezone','timezones','utcOffset','additionalPhones','bulkCreate','each','duplicates','where','$or','ListId','findOrCreate','spread','push','contact','all','show','find','params','color','ContactItemType','ItemType','sequelize','literal','omit','map','format','cf_%d','pickBy','isEmpty','table','setFields','id\x20=\x20?','text','phone','getTags','model','Tag','rawAttributes','filters','attributes','fields','order','sort','filter','options','nolimit','setTags','ids','setAdditionalPhones','item_types','items','ItemTypeId','description','contact\x20phone\x20exists','PHONE','item','OrderBy','`ItemType`.OrderBy','CmHopperId','CmHopperAdditionalPhone','getAdditionalPhones','duplicateAdditionalPhones','fromContactId','CmContactId','toContactId','rescheduleAdditionalPhones','getHoppers','findOne','intersection','ContactId','includeAll','include','rows','getHopperHistories','pick','getHopperFinals','No\x20ListId\x20specified','binding_keys','binding_values','No\x20association\x20values\x20specified!','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','split','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','file','chmodSync','0777','child_process','fork','../../components/import/cm/csv','socket_timestamp','File\x20uploaded\x20correctly!','pid','send','upload','parse','meta','import','User','agent','binding','../../components/import/cm/csv2','stringify','message','start\x20child\x20process\x20correctly!','exit','error\x20child\x20process','getJourney','mail','openchannel','fax','whatsapp','voice','resolve','channel','includes','Invalid\x20channel','toLowerCase','range','isValid','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter','uniqueid','source','destination','callerid','starttime','endtime','duration','note','createdAt','userDisposition','userThirdDisposition','fullname','DESC','VoiceCallReport','findAndCountAll','chat','Website','Account','closed','closedAt','disposition','secondDisposition','thirdDisposition','UserId','Owner','Tags','browserName','customerIp','osName','ratingMessage','ratingValue','referer','subject','substatus','externalUrl','threadId','Interaction','sortBy','reverse','value','slice','moment','bluebird','util','path','squel','papaparse','ioredis','../../components/contacts','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/environment/shared','defaults','redis','localhost','./cmContact.socket','register','status','json','offset','limit','undefined','count','set','Content-Range','destroy','then','end','sendStatus','error','name','describe','findAll','query','catch','CmContact','tags','keys','startsWith','cf_','displayName','analytics','CmCustomField','length','columnName','alias','custom','values','info','Custom\x20field\x20%s\x20not\x20found\x20on\x20cm_contacts\x20table','forEach','hasOwnProperty','merge','body','get','mergeWith','isArray','join','[CmContact][merge]\x20to\x20%s\x20from\x20%s','from'];(function(_0x5dce91,_0x395507){var _0x1c7a12=function(_0x9f2f9b){while(--_0x9f2f9b){_0x5dce91['push'](_0x5dce91['shift']());}};_0x1c7a12(++_0x395507);}(_0x9fca,0x1b9));var _0xa9fc=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x9fca[_0x122ef9];return _0x42fba0;};'use strict';var moment=require(_0xa9fc('0x0'));var BPromise=require(_0xa9fc('0x1'));var util=require(_0xa9fc('0x2'));var path=require(_0xa9fc('0x3'));var fs=require('fs');var _=require('lodash');var squel=require(_0xa9fc('0x4'));var Papa=require(_0xa9fc('0x5'));var Redis=require(_0xa9fc('0x6'));var contacts=require(_0xa9fc('0x7'));var qs=require(_0xa9fc('0x8'));var logger=require(_0xa9fc('0x9'))(_0xa9fc('0xa'));var config=require(_0xa9fc('0xb'));var shared=require(_0xa9fc('0xc'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xa9fc('0xd')](config[_0xa9fc('0xe')],{'host':_0xa9fc('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa9fc('0xe')]));require(_0xa9fc('0x10'))[_0xa9fc('0x11')](socket);function respondWithResult(_0x48b0d8,_0x27cbc6){_0x27cbc6=_0x27cbc6||0xc8;return function(_0x634c74){if(_0x634c74){return _0x48b0d8[_0xa9fc('0x12')](_0x27cbc6)[_0xa9fc('0x13')](_0x634c74);}};}function respondWithFilteredResult(_0x423201,_0x33ff1d){return function(_0x1e7486){if(_0x1e7486){var _0x16b617=typeof _0x33ff1d[_0xa9fc('0x14')]==='undefined'&&typeof _0x33ff1d[_0xa9fc('0x15')]===_0xa9fc('0x16');var _0x4d7062=_0x1e7486[_0xa9fc('0x17')];var _0x3b7fa=_0x16b617?0x0:_0x33ff1d['offset'];var _0x389876=_0x16b617?_0x1e7486[_0xa9fc('0x17')]:_0x33ff1d['offset']+_0x33ff1d[_0xa9fc('0x15')];var _0x3d2100;if(_0x389876>=_0x4d7062){_0x389876=_0x4d7062;_0x3d2100=0xc8;}else{_0x3d2100=0xce;}_0x423201[_0xa9fc('0x12')](_0x3d2100);return _0x423201[_0xa9fc('0x18')](_0xa9fc('0x19'),_0x3b7fa+'-'+_0x389876+'/'+_0x4d7062)[_0xa9fc('0x13')](_0x1e7486);}return null;};}function saveUpdates(_0x4b8d66){return function(_0x3a5416){if(_0x3a5416){return _0x3a5416['update'](_0x4b8d66)['then'](function(_0x1fef08){return _0x1fef08;});}return null;};}function removeEntity(_0x326951){return function(_0x3f16dc){if(_0x3f16dc){return _0x3f16dc[_0xa9fc('0x1a')]()[_0xa9fc('0x1b')](function(){_0x326951[_0xa9fc('0x12')](0xcc)[_0xa9fc('0x1c')]();});}};}function handleEntityNotFound(_0x2a34a2){return function(_0x1071a2){if(!_0x1071a2){_0x2a34a2[_0xa9fc('0x1d')](0x194);}return _0x1071a2;};}function handleError(_0x944ae2,_0x13ab95){_0x13ab95=_0x13ab95||0x1f4;return function(_0x1510cb){logger[_0xa9fc('0x1e')](_0x1510cb['stack']);if(_0x1510cb['name']){delete _0x1510cb[_0xa9fc('0x1f')];}_0x944ae2[_0xa9fc('0x12')](_0x13ab95)['send'](_0x1510cb);};}exports['index']=function(_0x370cc4,_0x1d1afa){var _0x54634b={};return contacts[_0xa9fc('0x20')]()[_0xa9fc('0x1b')](function(_0x187ae7){_0x54634b=qs['getOptions'](_0x187ae7,_0x370cc4);return contacts[_0xa9fc('0x21')](_0x370cc4[_0xa9fc('0x22')],_0x370cc4['user'],_0x54634b,_0x187ae7);})[_0xa9fc('0x1b')](respondWithFilteredResult(_0x1d1afa,_0x54634b))['catch'](handleError(_0x1d1afa,null));};exports[_0xa9fc('0x1a')]=function(_0x2dcd95,_0x5da48e){return db['CmContact']['find']({'where':{'id':_0x2dcd95['params']['id']}})[_0xa9fc('0x1b')](handleEntityNotFound(_0x5da48e,null))['then'](removeEntity(_0x5da48e,null))[_0xa9fc('0x23')](handleError(_0x5da48e,null));};exports[_0xa9fc('0x20')]=function(_0xc24e1b,_0x1112c8){return db[_0xa9fc('0x24')][_0xa9fc('0x20')]()[_0xa9fc('0x1b')](function(_0x32833a){delete _0x32833a[_0xa9fc('0x25')];for(var _0x38f26e=0x0;_0x38f26e0x0){return new Promise(function(_0x33a8a7){var _0x24179f=[];for(var _0x2bb387=0x0;_0x2bb387<_0x12c8cd[_0xa9fc('0x2c')];_0x2bb387++){_0x24179f[_0xa9fc('0x62')](insertAdditionalPhones(_0x12c8cd[_0x2bb387][_0xa9fc('0x63')],_0x12c8cd[_0x2bb387][_0xa9fc('0x59')]));}Promise[_0xa9fc('0x64')](_0x24179f)[_0xa9fc('0x1b')](function(){_0x33a8a7(0x1);});})['then'](function(){return{'success':_0x3bd1b6,'failure':_0x2dec18,'duplicates':_0x4113b0};});}else{return{'success':_0x3bd1b6,'failure':_0x2dec18,'duplicates':_0x4113b0};}}})[_0xa9fc('0x1b')](respondWithResult(_0x4c254e,0xc9))[_0xa9fc('0x23')](handleError(_0x4c254e,null));};exports[_0xa9fc('0x65')]=function(_0x21bfb3,_0x300c89){var _0x53f494;return db[_0xa9fc('0x24')][_0xa9fc('0x20')]()[_0xa9fc('0x1b')](function(_0x206494){return db[_0xa9fc('0x24')][_0xa9fc('0x66')]({'where':{'id':_0x21bfb3[_0xa9fc('0x67')]['id']},'include':[{'model':db['Tag'],'as':'Tags','attributes':['id',_0xa9fc('0x1f'),_0xa9fc('0x68')],'required':_0x21bfb3[_0xa9fc('0x22')]['tag']?!![]:![]},{'model':db[_0xa9fc('0x4b')],'as':'Phones','where':{'CmContactId':_0x21bfb3[_0xa9fc('0x67')]['id']},'required':![],'include':[{'model':db[_0xa9fc('0x69')],'as':_0xa9fc('0x6a')}]}],'order':[db[_0xa9fc('0x6b')][_0xa9fc('0x6c')]('Phones.OrderBy')],'attributes':_[_0xa9fc('0x26')](_0x206494)});})['then'](function(_0x2bb996){if(!_['isNil'](_0x2bb996)){_0x53f494=_0x2bb996[_0xa9fc('0x37')]({'plain':!![]});var _0x4d44eb={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x2bb996&&_0x2bb996['ListId']){if(_0x2bb996['ListId']){_0x4d44eb[_0xa9fc('0x5d')]['$and'][_0xa9fc('0x62')]({'ListId':{'$ne':_0x2bb996[_0xa9fc('0x5f')]}});}}return db[_0xa9fc('0x2b')][_0xa9fc('0x21')](_0x4d44eb);}})[_0xa9fc('0x1b')](function(_0x857eae){if(!_['isNil'](_0x857eae)){return _[_0xa9fc('0x6d')](_0x53f494,_[_0xa9fc('0x6e')](_0x857eae,function(_0x5795a2){return util[_0xa9fc('0x6f')](_0xa9fc('0x70'),_0x5795a2['id']);}));}})['then'](handleEntityNotFound(_0x300c89,null))['then'](respondWithResult(_0x300c89,null))[_0xa9fc('0x23')](handleError(_0x300c89,null));};exports[_0xa9fc('0x43')]=function(_0x49a6e3,_0x50acbe){var _0x1bb142;if(_0x49a6e3[_0xa9fc('0x36')]['id']){delete _0x49a6e3['body']['id'];}if(!_['isNil'](_0x49a6e3[_0xa9fc('0x36')][_0xa9fc('0x56')])){var _0x4f06ae=_0x49a6e3[_0xa9fc('0x36')][_0xa9fc('0x56')];if(!_[_0xa9fc('0x55')](shared[_0xa9fc('0x57')][_0x4f06ae]))_0x49a6e3[_0xa9fc('0x36')][_0xa9fc('0x58')]=shared[_0xa9fc('0x57')][_0x4f06ae][_0xa9fc('0x58')];}return db['CmContact'][_0xa9fc('0x66')]({'where':{'id':_0x49a6e3['params']['id']}})[_0xa9fc('0x1b')](handleEntityNotFound(_0x50acbe,null))['then'](saveUpdates(_0x49a6e3[_0xa9fc('0x36')],null))[_0xa9fc('0x1b')](function(_0x5c0dd8){_0x1bb142=_0x5c0dd8;var _0x1c9268={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x5c0dd8&&_0x5c0dd8[_0xa9fc('0x5f')]){if(_0x5c0dd8[_0xa9fc('0x5f')]){_0x1c9268[_0xa9fc('0x5d')]['$and']['push']({'ListId':{'$ne':_0x5c0dd8[_0xa9fc('0x5f')]}});}}return db[_0xa9fc('0x2b')][_0xa9fc('0x21')](_0x1c9268);})[_0xa9fc('0x1b')](function(_0x4f2276){if(_0x4f2276){return _[_0xa9fc('0x6d')](_[_0xa9fc('0x71')](_0x49a6e3['body'],function(_0x4691e,_0x4dd660){return _[_0xa9fc('0x27')](_0x4dd660,_0xa9fc('0x28'));}),_['map'](_0x4f2276,function(_0x1f8529){return util['format'](_0xa9fc('0x70'),_0x1f8529['id']);}));}})[_0xa9fc('0x1b')](function(_0x4a867b){if(_0x4a867b&&!_[_0xa9fc('0x72')](_0x4a867b)){var _0x336ce5=squel['update']()[_0xa9fc('0x73')]('cm_contacts')[_0xa9fc('0x74')](_0x4a867b)[_0xa9fc('0x5d')](_0xa9fc('0x75'),_0x49a6e3[_0xa9fc('0x67')]['id'])['toParam']();return db[_0xa9fc('0x6b')][_0xa9fc('0x22')](_0x336ce5[_0xa9fc('0x76')],{'replacements':_0x336ce5[_0xa9fc('0x30')]});}})[_0xa9fc('0x1b')](function(){if(_0x49a6e3[_0xa9fc('0x36')][_0xa9fc('0x77')]&&_0x1bb142){return db[_0xa9fc('0x3d')][_0xa9fc('0x43')]({'phone':_0x49a6e3[_0xa9fc('0x36')][_0xa9fc('0x77')],'OrderBy':0x0},{'where':{'ContactId':_0x1bb142['id']}});}})['then'](function(){return _0x1bb142;})[_0xa9fc('0x1b')](respondWithResult(_0x50acbe,null))[_0xa9fc('0x23')](handleError(_0x50acbe,null));};exports[_0xa9fc('0x78')]=function(_0x530cde,_0x53cf5d){var _0x294994={};var _0x19b865={};var _0x3e1dd8;var _0x2f3abb;return db[_0xa9fc('0x24')]['findOne']({'where':{'id':_0x530cde[_0xa9fc('0x67')]['id']}})[_0xa9fc('0x1b')](handleEntityNotFound(_0x53cf5d,null))['then'](function(_0x12e0f0){if(_0x12e0f0){_0x3e1dd8=_0x12e0f0;_0x19b865[_0xa9fc('0x79')]=_['keys'](db[_0xa9fc('0x7a')][_0xa9fc('0x7b')]);_0x19b865[_0xa9fc('0x22')]=_[_0xa9fc('0x26')](_0x530cde[_0xa9fc('0x22')]);_0x19b865[_0xa9fc('0x7c')]=_['intersection'](_0x19b865[_0xa9fc('0x79')],_0x19b865[_0xa9fc('0x22')]);_0x294994[_0xa9fc('0x7d')]=_['intersection'](_0x19b865[_0xa9fc('0x79')],qs[_0xa9fc('0x7e')](_0x530cde[_0xa9fc('0x22')][_0xa9fc('0x7e')]));_0x294994[_0xa9fc('0x7d')]=_0x294994[_0xa9fc('0x7d')][_0xa9fc('0x2c')]?_0x294994[_0xa9fc('0x7d')]:_0x19b865[_0xa9fc('0x79')];_0x294994[_0xa9fc('0x7f')]=qs[_0xa9fc('0x80')](_0x530cde[_0xa9fc('0x22')][_0xa9fc('0x80')]);_0x294994[_0xa9fc('0x5d')]=qs[_0xa9fc('0x7c')](_['pick'](_0x530cde[_0xa9fc('0x22')],_0x19b865[_0xa9fc('0x7c')]));if(_0x530cde[_0xa9fc('0x22')][_0xa9fc('0x81')]){_0x294994[_0xa9fc('0x5d')]=_[_0xa9fc('0x35')](_0x294994['where'],{'$or':_[_0xa9fc('0x6e')](_0x294994[_0xa9fc('0x7d')],function(_0x2bfad9){var _0x3a63f5={};_0x3a63f5[_0x2bfad9]={'$like':'%'+_0x530cde['query'][_0xa9fc('0x81')]+'%'};return _0x3a63f5;})});}_0x294994=_['merge']({},_0x294994,_0x530cde[_0xa9fc('0x82')]);return _0x3e1dd8[_0xa9fc('0x78')](_0x294994);}})[_0xa9fc('0x1b')](function(_0x2ef85e){if(_0x2ef85e){_0x2f3abb=_0x2ef85e[_0xa9fc('0x2c')];if(!_0x530cde[_0xa9fc('0x22')][_0xa9fc('0x34')](_0xa9fc('0x83'))){_0x294994[_0xa9fc('0x15')]=qs[_0xa9fc('0x15')](_0x530cde[_0xa9fc('0x22')]['limit']);_0x294994[_0xa9fc('0x14')]=qs['offset'](_0x530cde[_0xa9fc('0x22')][_0xa9fc('0x14')]);}return _0x3e1dd8[_0xa9fc('0x78')](_0x294994);}})[_0xa9fc('0x1b')](function(_0x2b3578){if(_0x2b3578){return _0x2b3578?{'count':_0x2f3abb,'rows':_0x2b3578}:null;}})[_0xa9fc('0x1b')](respondWithResult(_0x53cf5d,null))[_0xa9fc('0x23')](handleError(_0x53cf5d,null));};exports[_0xa9fc('0x84')]=function(_0x331954,_0xfc49e1){if(_0x331954['body']['id']){delete _0x331954[_0xa9fc('0x36')]['id'];}return db[_0xa9fc('0x24')]['findOne']({'where':{'id':_0x331954[_0xa9fc('0x67')]['id']}})['then'](handleEntityNotFound(_0xfc49e1,null))['then'](function(_0x34b959){if(_0x34b959){return _0x34b959[_0xa9fc('0x84')](_0x331954[_0xa9fc('0x36')][_0xa9fc('0x85')]||[]);}return null;})[_0xa9fc('0x1b')](respondWithResult(_0xfc49e1,null))[_0xa9fc('0x23')](handleError(_0xfc49e1,null));};exports[_0xa9fc('0x86')]=function(_0x1d6c92,_0x493fa0){var _0x5c2566=[];_0x5c2566[_0xa9fc('0x62')](addAdditionalPhones(_0x1d6c92[_0xa9fc('0x36')]));Promise['all'](_0x5c2566)[_0xa9fc('0x1b')](function(){_0x5c2566=[];_0x5c2566[_0xa9fc('0x62')](deleteCmHopperPhones(_0x1d6c92[_0xa9fc('0x36')]['id']));_0x5c2566[_0xa9fc('0x62')](addCmHopperPhones(_0x1d6c92['body']['id']));Promise[_0xa9fc('0x64')](_0x5c2566)[_0xa9fc('0x1b')](function(){return[0x1];})[_0xa9fc('0x1b')](respondWithResult(_0x493fa0,null));});};function addAdditionalPhones(_0x43440e){var _0x4f7777;return new Promise(function(_0x1b8641){return db['CmContactHasItem'][_0xa9fc('0x1a')]({'where':{'CmContactId':_0x43440e['id']}})['then'](function(){db[_0xa9fc('0x69')][_0xa9fc('0x21')]({'raw':!![],'attributes':['id','OrderBy']})[_0xa9fc('0x1b')](function(_0x556f19){var _0x2aefee=[];for(var _0x59ff3d=0x0;_0x59ff3d<_0x43440e['items'][_0xa9fc('0x2c')];_0x59ff3d++){var _0x58ca2b=_0x43440e[_0xa9fc('0x87')]?_['isNil'](_0x43440e[_0xa9fc('0x87')][_0x59ff3d])?'':_0x43440e[_0xa9fc('0x87')][_0x59ff3d]:_0x43440e[_0xa9fc('0x88')][_0x59ff3d][_0xa9fc('0x89')]?_0x43440e[_0xa9fc('0x88')][_0x59ff3d]['ItemTypeId']:'';var _0x75dafa=_[_0xa9fc('0x55')](_0x43440e[_0xa9fc('0x88')][_0x59ff3d][_0xa9fc('0x8a')])?'':_0x43440e[_0xa9fc('0x88')][_0x59ff3d][_0xa9fc('0x8a')];var _0x5b8d19=_0x58ca2b+':'+_0x43440e['items'][_0x59ff3d][_0xa9fc('0x77')]+'§'+_0x75dafa;if(_[_0xa9fc('0x55')](_0x4f7777))_0x4f7777=_0x5b8d19;else _0x4f7777+=';'+_0x5b8d19;var _0x3b7e93=null;var _0x5dfeab=null;if(_0x43440e[_0xa9fc('0x87')]){if(!_[_0xa9fc('0x55')](_0x43440e[_0xa9fc('0x87')][_0x59ff3d])){_0x5dfeab=_['find'](_0x556f19,function(_0x1f9a7e){return _0x1f9a7e['id']===_0x43440e[_0xa9fc('0x87')][_0x59ff3d];});if(!_[_0xa9fc('0x55')](_0x5dfeab)){_0x3b7e93=_0x5dfeab['OrderBy'];}}}else{if(!_[_0xa9fc('0x55')](_0x43440e['items'][_0x59ff3d])){_0x5dfeab=_['find'](_0x556f19,function(_0x2c7d1c){return _0x2c7d1c['id']===_0x43440e[_0xa9fc('0x88')][_0x59ff3d][_0xa9fc('0x89')];});if(!_[_0xa9fc('0x55')](_0x5dfeab)){_0x3b7e93=_0x59ff3d;}}}if(_[_0xa9fc('0x55')](_0x3b7e93)){_0x3b7e93=0x64;}_0x2aefee[_0xa9fc('0x62')](addAdditionalPhone(_0x43440e['id'],_0x43440e['items'][_0x59ff3d]['phone'],_0x43440e[_0xa9fc('0x87')]?_[_0xa9fc('0x55')](_0x43440e[_0xa9fc('0x87')][_0x59ff3d])?null:_0x43440e[_0xa9fc('0x87')][_0x59ff3d]:_0x43440e[_0xa9fc('0x88')][_0x59ff3d][_0xa9fc('0x89')]?_0x43440e[_0xa9fc('0x88')][_0x59ff3d][_0xa9fc('0x89')]:null,_0x3b7e93,_0x75dafa));}Promise[_0xa9fc('0x64')](_0x2aefee)[_0xa9fc('0x1b')](function(){db[_0xa9fc('0x24')][_0xa9fc('0x43')]({'AdditionalPhones':_0x4f7777},{'where':{'id':_0x43440e['id']}})[_0xa9fc('0x1b')](function(){_0x1b8641(0x1);});});});});});}function addAdditionalPhone(_0x4ba739,_0x126499,_0x2ad100,_0xe7f084,_0x268f49){return db[_0xa9fc('0x4b')][_0xa9fc('0x66')]({'where':{'CmContactId':_0x4ba739,'item':_0x126499}})['then'](function(_0x3b9e61){if(_0x3b9e61)logger[_0xa9fc('0x31')](_0xa9fc('0x8b'),_0x3b9e61);else{db['CmContactHasItem'][_0xa9fc('0x41')]({'CmContactId':_0x4ba739,'item':_0x126499,'ItemTypeId':_0x2ad100,'OrderBy':_0xe7f084,'ItemClass':_0xa9fc('0x8c'),'description':_0x268f49});}});}function deleteCmHopperPhones(_0x2bff66){return new Promise(function(_0x14bcc5){return db[_0xa9fc('0x3d')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x2bff66}})[_0xa9fc('0x1b')](function(_0x48f441){db['CmHopperAdditionalPhone']['destroy']({'where':{'CmHopperId':{'$in':_['map'](_0x48f441,'id')}}});})[_0xa9fc('0x1b')](function(){_0x14bcc5(0x1);});});}function addCmHopperPhones(_0x1e6685){return new Promise(function(_0x3e6fb9){return db[_0xa9fc('0x3d')][_0xa9fc('0x21')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x1e6685}})['then'](function(_0x43adc6){var _0x5b1914=[];_['map'](_0x43adc6,function(_0x5804d6){_0x5b1914[_0xa9fc('0x62')](createCmHopperPhone(_0x1e6685,_0x5804d6['id']));});Promise[_0xa9fc('0x64')](_0x5b1914)[_0xa9fc('0x1b')](function(){_0x3e6fb9(0x1);});});});}function createCmHopperPhone(_0x401a5a,_0x4965ed){return new Promise(function(_0x2ed1f1){db[_0xa9fc('0x4b')][_0xa9fc('0x21')]({'raw':!![],'attributes':[_0xa9fc('0x8d'),_0xa9fc('0x8e')],'where':{'CmContactId':_0x401a5a,'ItemClass':_0xa9fc('0x8c')},'include':[{'model':db['ContactItemType'],'attributes':[_0xa9fc('0x8e')],'as':'ItemType'}],'order':[_0xa9fc('0x8e'),db[_0xa9fc('0x6b')][_0xa9fc('0x6c')](_0xa9fc('0x8f'))]})['then'](function(_0x5da72e){var _0x50c733=0x1;var _0x75f0e6=_[_0xa9fc('0x6e')](_0x5da72e,function(_0x5c6787){_0x5c6787[_0xa9fc('0x90')]=_0x4965ed;_0x5c6787[_0xa9fc('0x77')]=_0x5c6787[_0xa9fc('0x8d')];_0x5c6787[_0xa9fc('0x8e')]=_0x50c733;delete _0x5c6787['ItemType.OrderBy'];_0x50c733=_0x50c733+0x1;return _0x5c6787;});return db[_0xa9fc('0x91')][_0xa9fc('0x5a')](_0x75f0e6,{});})[_0xa9fc('0x1b')](function(){_0x2ed1f1(0x1);});});}function insertAdditionalPhones(_0x24c1e8,_0xb7a2f2){return new Promise(function(_0x2867ac){var _0x2b8908=[];for(var _0x5a06c2=0x0;_0x5a06c2<_0xb7a2f2[_0xa9fc('0x2c')];_0x5a06c2++){var _0xf19005=_0xb7a2f2[_0x5a06c2];_0x2b8908['push'](parseContactItemType(_0xf19005));}Promise['all'](_0x2b8908)['then'](function(){var _0x4effd5={'id':_0x24c1e8['id'],'items':_0xb7a2f2};return addAdditionalPhones(_0x4effd5)['then'](function(){return addCmHopperPhones(_0x24c1e8['id']);});})[_0xa9fc('0x1b')](function(){_0x2867ac(_0x24c1e8);});});}function parseContactItemType(_0x57d640){return new Promise(function(_0x1705d4){if(_0x57d640[_0xa9fc('0x34')](_0xa9fc('0x89'))){_0x1705d4(_0x57d640);}else{return db[_0xa9fc('0x69')][_0xa9fc('0x66')]({'where':{'name':_0x57d640[_0xa9fc('0x6a')]}})['then'](function(_0x493f4c){if(_['isNil'](_0x493f4c))_0x57d640[_0xa9fc('0x89')]=null;else _0x57d640['ItemTypeId']=_0x493f4c['id'];_0x1705d4(_0x57d640);});}});}exports[_0xa9fc('0x92')]=function(_0x4f3acf,_0x5cf4d8){return db[_0xa9fc('0x4b')][_0xa9fc('0x21')]({'raw':!![],'where':{'CmContactId':_0x4f3acf[_0xa9fc('0x67')]['id'],'ItemClass':_0xa9fc('0x8c')},'include':[{'model':db['ContactItemType'],'as':_0xa9fc('0x6a')}],'order':[[_0xa9fc('0x8e')],[db[_0xa9fc('0x6b')][_0xa9fc('0x6c')](_0xa9fc('0x8f'))]]})['then'](function(_0x532430){return _0x532430;})['then'](respondWithResult(_0x5cf4d8,null))[_0xa9fc('0x23')](handleError(_0x5cf4d8,null));};exports[_0xa9fc('0x93')]=function(_0x455017,_0x784af3){return db[_0xa9fc('0x4b')][_0xa9fc('0x21')]({'raw':!![],'where':{'CmContactId':_0x455017[_0xa9fc('0x36')][_0xa9fc('0x94')]}})[_0xa9fc('0x1b')](function(_0x50985e){var _0xb15bf2=_[_0xa9fc('0x6e')](_0x50985e,function(_0x11f9fe){_0x11f9fe[_0xa9fc('0x95')]=_0x455017[_0xa9fc('0x36')][_0xa9fc('0x96')];return _0x11f9fe;});return db[_0xa9fc('0x4b')][_0xa9fc('0x5a')](_0xb15bf2,{});})[_0xa9fc('0x1b')](function(){return addCmHopperPhones(_0x455017[_0xa9fc('0x36')][_0xa9fc('0x96')]);})['then'](function(){return['ok'];})[_0xa9fc('0x1b')](respondWithResult(_0x784af3,null))['catch'](handleError(_0x784af3,null));};exports[_0xa9fc('0x97')]=function(_0xb7617,_0x6297dd){var _0x291a62=[];_0x291a62['push'](createCmHopperPhone(_0xb7617[_0xa9fc('0x36')]['id'],_0xb7617['body']['hopperId']));Promise['all'](_0x291a62)[_0xa9fc('0x1b')](function(){return[0x1];})[_0xa9fc('0x1b')](respondWithResult(_0x6297dd,null));};exports[_0xa9fc('0x98')]=function(_0x43b45c,_0x50113b){var _0x497a15={'raw':![],'where':{}};var _0x2d116a={};var _0x4beac6={'count':0x0,'rows':[]};return db[_0xa9fc('0x24')][_0xa9fc('0x99')]({'where':{'id':_0x43b45c[_0xa9fc('0x67')]['id']}})[_0xa9fc('0x1b')](handleEntityNotFound(_0x50113b,null))['then'](function(_0x4f27e1){if(_0x4f27e1){_0x2d116a['model']=_[_0xa9fc('0x26')](db[_0xa9fc('0x3d')][_0xa9fc('0x7b')]);_0x2d116a[_0xa9fc('0x22')]=_[_0xa9fc('0x26')](_0x43b45c[_0xa9fc('0x22')]);_0x2d116a['filters']=_[_0xa9fc('0x9a')](_0x2d116a[_0xa9fc('0x79')],_0x2d116a[_0xa9fc('0x22')]);_0x497a15[_0xa9fc('0x7d')]=_['intersection'](_0x2d116a[_0xa9fc('0x79')],qs[_0xa9fc('0x7e')](_0x43b45c[_0xa9fc('0x22')][_0xa9fc('0x7e')]));_0x497a15[_0xa9fc('0x7d')]=_0x497a15[_0xa9fc('0x7d')][_0xa9fc('0x2c')]?_0x497a15[_0xa9fc('0x7d')]:_0x2d116a[_0xa9fc('0x79')];if(!_0x43b45c[_0xa9fc('0x22')][_0xa9fc('0x34')]('nolimit')){_0x497a15['limit']=qs[_0xa9fc('0x15')](_0x43b45c[_0xa9fc('0x22')][_0xa9fc('0x15')]);_0x497a15[_0xa9fc('0x14')]=qs['offset'](_0x43b45c['query']['offset']);}_0x497a15[_0xa9fc('0x7f')]=qs['sort'](_0x43b45c[_0xa9fc('0x22')][_0xa9fc('0x80')]);_0x497a15[_0xa9fc('0x5d')]=qs[_0xa9fc('0x7c')](_['pick'](_0x43b45c[_0xa9fc('0x22')],_0x2d116a[_0xa9fc('0x7c')]));_0x497a15['where'][_0xa9fc('0x9b')]=_0x4f27e1['id'];if(_0x43b45c[_0xa9fc('0x22')][_0xa9fc('0x81')]){_0x497a15['where']=_['merge'](_0x497a15['where'],{'$or':_['map'](_0x497a15[_0xa9fc('0x7d')],function(_0xfe5420){var _0x1c179b={};_0x1c179b[_0xfe5420]={'$like':'%'+_0x43b45c[_0xa9fc('0x22')][_0xa9fc('0x81')]+'%'};return _0x1c179b;})});}_0x497a15=_[_0xa9fc('0x35')]({},_0x497a15,_0x43b45c['options']);return db['CmHopper'][_0xa9fc('0x17')]({'where':_0x497a15[_0xa9fc('0x5d')]})[_0xa9fc('0x1b')](function(_0x293133){_0x4beac6[_0xa9fc('0x17')]=_0x293133;if(_0x43b45c[_0xa9fc('0x22')][_0xa9fc('0x9c')]){_0x497a15[_0xa9fc('0x9d')]=[{'all':!![]}];}return db[_0xa9fc('0x3d')][_0xa9fc('0x21')](_0x497a15);})[_0xa9fc('0x1b')](function(_0x4c9f03){_0x4beac6[_0xa9fc('0x9e')]=_0x4c9f03;return _0x4beac6;});}})[_0xa9fc('0x1b')](respondWithFilteredResult(_0x50113b,_0x497a15))[_0xa9fc('0x23')](handleError(_0x50113b,null));};exports[_0xa9fc('0x9f')]=function(_0x43fefe,_0x458fac){var _0x30c9ea={'raw':!![],'where':{}};var _0x4064ab={};var _0x741434={'count':0x0,'rows':[]};return db[_0xa9fc('0x24')][_0xa9fc('0x99')]({'where':{'id':_0x43fefe['params']['id']}})[_0xa9fc('0x1b')](handleEntityNotFound(_0x458fac,null))[_0xa9fc('0x1b')](function(_0x1e4ee0){if(_0x1e4ee0){_0x4064ab[_0xa9fc('0x79')]=_['keys'](db[_0xa9fc('0x4d')][_0xa9fc('0x7b')]);_0x4064ab[_0xa9fc('0x22')]=_['keys'](_0x43fefe['query']);_0x4064ab[_0xa9fc('0x7c')]=_[_0xa9fc('0x9a')](_0x4064ab['model'],_0x4064ab[_0xa9fc('0x22')]);_0x30c9ea['attributes']=_[_0xa9fc('0x9a')](_0x4064ab['model'],qs['fields'](_0x43fefe['query'][_0xa9fc('0x7e')]));_0x30c9ea[_0xa9fc('0x7d')]=_0x30c9ea[_0xa9fc('0x7d')]['length']?_0x30c9ea['attributes']:_0x4064ab[_0xa9fc('0x79')];if(!_0x43fefe['query'][_0xa9fc('0x34')](_0xa9fc('0x83'))){_0x30c9ea[_0xa9fc('0x15')]=qs[_0xa9fc('0x15')](_0x43fefe['query'][_0xa9fc('0x15')]);_0x30c9ea[_0xa9fc('0x14')]=qs[_0xa9fc('0x14')](_0x43fefe['query']['offset']);}_0x30c9ea[_0xa9fc('0x7f')]=qs[_0xa9fc('0x80')](_0x43fefe[_0xa9fc('0x22')][_0xa9fc('0x80')]);_0x30c9ea[_0xa9fc('0x5d')]=qs[_0xa9fc('0x7c')](_[_0xa9fc('0xa0')](_0x43fefe[_0xa9fc('0x22')],_0x4064ab['filters']));_0x30c9ea[_0xa9fc('0x5d')][_0xa9fc('0x9b')]=_0x1e4ee0['id'];if(_0x43fefe[_0xa9fc('0x22')][_0xa9fc('0x81')]){_0x30c9ea[_0xa9fc('0x5d')]=_[_0xa9fc('0x35')](_0x30c9ea[_0xa9fc('0x5d')],{'$or':_[_0xa9fc('0x6e')](_0x30c9ea[_0xa9fc('0x7d')],function(_0x24a689){var _0x34117f={};_0x34117f[_0x24a689]={'$like':'%'+_0x43fefe[_0xa9fc('0x22')]['filter']+'%'};return _0x34117f;})});}_0x30c9ea=_[_0xa9fc('0x35')]({},_0x30c9ea,_0x43fefe[_0xa9fc('0x82')]);return db[_0xa9fc('0x4d')]['count']({'where':_0x30c9ea[_0xa9fc('0x5d')]})['then'](function(_0x4b1d8d){_0x741434[_0xa9fc('0x17')]=_0x4b1d8d;if(_0x43fefe[_0xa9fc('0x22')][_0xa9fc('0x9c')]){_0x30c9ea[_0xa9fc('0x9d')]=[{'all':!![]}];}return db[_0xa9fc('0x4d')][_0xa9fc('0x21')](_0x30c9ea);})[_0xa9fc('0x1b')](function(_0x2fcc47){_0x741434[_0xa9fc('0x9e')]=_0x2fcc47;return _0x741434;});}})['then'](respondWithFilteredResult(_0x458fac,_0x30c9ea))[_0xa9fc('0x23')](handleError(_0x458fac,null));};exports[_0xa9fc('0xa1')]=function(_0x4ff8b5,_0x2bdfca){var _0x2c881c={'raw':!![],'where':{}};var _0x3efe92={};var _0x4f3845={'count':0x0,'rows':[]};return db[_0xa9fc('0x24')][_0xa9fc('0x99')]({'where':{'id':_0x4ff8b5['params']['id']}})[_0xa9fc('0x1b')](handleEntityNotFound(_0x2bdfca,null))[_0xa9fc('0x1b')](function(_0x4c452e){if(_0x4c452e){_0x3efe92[_0xa9fc('0x79')]=_[_0xa9fc('0x26')](db[_0xa9fc('0x4c')]['rawAttributes']);_0x3efe92[_0xa9fc('0x22')]=_[_0xa9fc('0x26')](_0x4ff8b5[_0xa9fc('0x22')]);_0x3efe92[_0xa9fc('0x7c')]=_[_0xa9fc('0x9a')](_0x3efe92[_0xa9fc('0x79')],_0x3efe92[_0xa9fc('0x22')]);_0x2c881c[_0xa9fc('0x7d')]=_[_0xa9fc('0x9a')](_0x3efe92['model'],qs['fields'](_0x4ff8b5[_0xa9fc('0x22')][_0xa9fc('0x7e')]));_0x2c881c[_0xa9fc('0x7d')]=_0x2c881c[_0xa9fc('0x7d')][_0xa9fc('0x2c')]?_0x2c881c[_0xa9fc('0x7d')]:_0x3efe92[_0xa9fc('0x79')];if(!_0x4ff8b5[_0xa9fc('0x22')][_0xa9fc('0x34')](_0xa9fc('0x83'))){_0x2c881c[_0xa9fc('0x15')]=qs[_0xa9fc('0x15')](_0x4ff8b5[_0xa9fc('0x22')][_0xa9fc('0x15')]);_0x2c881c[_0xa9fc('0x14')]=qs[_0xa9fc('0x14')](_0x4ff8b5[_0xa9fc('0x22')][_0xa9fc('0x14')]);}_0x2c881c[_0xa9fc('0x7f')]=qs[_0xa9fc('0x80')](_0x4ff8b5[_0xa9fc('0x22')][_0xa9fc('0x80')]);_0x2c881c[_0xa9fc('0x5d')]=qs[_0xa9fc('0x7c')](_[_0xa9fc('0xa0')](_0x4ff8b5[_0xa9fc('0x22')],_0x3efe92[_0xa9fc('0x7c')]));_0x2c881c['where']['ContactId']=_0x4c452e['id'];if(_0x4ff8b5[_0xa9fc('0x22')][_0xa9fc('0x81')]){_0x2c881c[_0xa9fc('0x5d')]=_[_0xa9fc('0x35')](_0x2c881c[_0xa9fc('0x5d')],{'$or':_['map'](_0x2c881c[_0xa9fc('0x7d')],function(_0x297576){var _0x26481b={};_0x26481b[_0x297576]={'$like':'%'+_0x4ff8b5[_0xa9fc('0x22')][_0xa9fc('0x81')]+'%'};return _0x26481b;})});}_0x2c881c=_['merge']({},_0x2c881c,_0x4ff8b5[_0xa9fc('0x82')]);return db[_0xa9fc('0x4c')][_0xa9fc('0x17')]({'where':_0x2c881c[_0xa9fc('0x5d')]})[_0xa9fc('0x1b')](function(_0x27f3a7){_0x4f3845['count']=_0x27f3a7;if(_0x4ff8b5['query'][_0xa9fc('0x9c')]){_0x2c881c[_0xa9fc('0x9d')]=[{'all':!![]}];}return db['CmHopperFinal'][_0xa9fc('0x21')](_0x2c881c);})[_0xa9fc('0x1b')](function(_0x17651e){_0x4f3845[_0xa9fc('0x9e')]=_0x17651e;return _0x4f3845;});}})[_0xa9fc('0x1b')](respondWithFilteredResult(_0x2bdfca,_0x2c881c))[_0xa9fc('0x23')](handleError(_0x2bdfca,null));};exports['getJscriptySessions']=function(_0x36a009,_0x53ad10){var _0x2a65a7={'raw':!![],'where':{}};var _0x35b8f0={};var _0x4a475d={'count':0x0,'rows':[]};return db['CmContact'][_0xa9fc('0x99')]({'where':{'id':_0x36a009[_0xa9fc('0x67')]['id']}})[_0xa9fc('0x1b')](handleEntityNotFound(_0x53ad10,null))[_0xa9fc('0x1b')](function(_0x391421){if(_0x391421){_0x35b8f0['model']=_['keys'](db['JscriptySessionReport'][_0xa9fc('0x7b')]);_0x35b8f0[_0xa9fc('0x22')]=_[_0xa9fc('0x26')](_0x36a009[_0xa9fc('0x22')]);_0x35b8f0[_0xa9fc('0x7c')]=_[_0xa9fc('0x9a')](_0x35b8f0[_0xa9fc('0x79')],_0x35b8f0[_0xa9fc('0x22')]);_0x2a65a7['attributes']=_['intersection'](_0x35b8f0['model'],qs[_0xa9fc('0x7e')](_0x36a009[_0xa9fc('0x22')]['fields']));_0x2a65a7[_0xa9fc('0x7d')]=_0x2a65a7[_0xa9fc('0x7d')][_0xa9fc('0x2c')]?_0x2a65a7[_0xa9fc('0x7d')]:_0x35b8f0['model'];if(!_0x36a009[_0xa9fc('0x22')]['hasOwnProperty'](_0xa9fc('0x83'))){_0x2a65a7[_0xa9fc('0x15')]=qs['limit'](_0x36a009[_0xa9fc('0x22')][_0xa9fc('0x15')]);_0x2a65a7['offset']=qs['offset'](_0x36a009['query'][_0xa9fc('0x14')]);}_0x2a65a7['order']=qs[_0xa9fc('0x80')](_0x36a009[_0xa9fc('0x22')][_0xa9fc('0x80')]);_0x2a65a7[_0xa9fc('0x5d')]=qs[_0xa9fc('0x7c')](_[_0xa9fc('0xa0')](_0x36a009[_0xa9fc('0x22')],_0x35b8f0[_0xa9fc('0x7c')]));_0x2a65a7[_0xa9fc('0x5d')]['ContactId']=_0x391421['id'];if(_0x36a009[_0xa9fc('0x22')][_0xa9fc('0x81')]){_0x2a65a7[_0xa9fc('0x5d')]=_[_0xa9fc('0x35')](_0x2a65a7['where'],{'$or':_[_0xa9fc('0x6e')](_0x2a65a7[_0xa9fc('0x7d')],function(_0x11dd40){var _0x8848b4={};_0x8848b4[_0x11dd40]={'$like':'%'+_0x36a009[_0xa9fc('0x22')][_0xa9fc('0x81')]+'%'};return _0x8848b4;})});}_0x2a65a7=_['merge']({},_0x2a65a7,_0x36a009[_0xa9fc('0x82')]);return db[_0xa9fc('0x53')][_0xa9fc('0x17')]({'where':_0x2a65a7[_0xa9fc('0x5d')]})[_0xa9fc('0x1b')](function(_0x37329f){_0x4a475d['count']=_0x37329f;if(_0x36a009['query'][_0xa9fc('0x9c')]){_0x2a65a7[_0xa9fc('0x9d')]=[{'all':!![]}];}return db[_0xa9fc('0x53')][_0xa9fc('0x21')](_0x2a65a7);})[_0xa9fc('0x1b')](function(_0x3ba21f){_0x4a475d['rows']=_0x3ba21f;return _0x4a475d;});}})[_0xa9fc('0x1b')](respondWithFilteredResult(_0x53ad10,_0x2a65a7))[_0xa9fc('0x23')](handleError(_0x53ad10,null));};exports['uploadCsv']=function(_0x8f52b7,_0x3df43c){try{if(!_0x8f52b7[_0xa9fc('0x36')][_0xa9fc('0x5f')]){throw new Error(_0xa9fc('0xa2'));}if(!_0x8f52b7[_0xa9fc('0x36')][_0xa9fc('0xa3')]){throw new Error('No\x20association\x20keys\x20specified!');}if(!_0x8f52b7[_0xa9fc('0x36')][_0xa9fc('0xa4')]){throw new Error(_0xa9fc('0xa5'));}if(!_0x8f52b7[_0xa9fc('0x36')]['socket_timestamp']){throw new Error(_0xa9fc('0xa6'));}var _0x12a812=_0x8f52b7[_0xa9fc('0x36')]['binding_keys'][_0xa9fc('0xa7')](',');var _0x523df6=_0x8f52b7[_0xa9fc('0x36')]['binding_values'][_0xa9fc('0xa7')](',');if(!_0x12a812['length']||!_0x523df6[_0xa9fc('0x2c')]||_0x12a812[_0xa9fc('0x2c')]!==_0x523df6[_0xa9fc('0x2c')]){throw new Error('Incorrect\x20binding\x20parameters\x20passed!');}_0x8f52b7['body'][_0xa9fc('0x7e')]=_['zipObject'](_0x12a812,_0x523df6);if(!_0x8f52b7[_0xa9fc('0x36')][_0xa9fc('0x7e')][_0xa9fc('0x77')]){throw new Error(_0xa9fc('0xa8'));}if(!_0x8f52b7[_0xa9fc('0x36')][_0xa9fc('0x7e')][_0xa9fc('0xa9')]){throw new Error(_0xa9fc('0xaa'));}var _0x22764c=path[_0xa9fc('0x3a')](config[_0xa9fc('0xab')],'server/files/tmp',_0x8f52b7[_0xa9fc('0xac')]['filename']);fs[_0xa9fc('0xad')](_0x22764c,parseInt(_0xa9fc('0xae'),0x8));var _0x729d38=require(_0xa9fc('0xaf'))[_0xa9fc('0xb0')](path[_0xa9fc('0x3a')](__dirname,_0xa9fc('0xb1')),[_0x22764c,_0x8f52b7[_0xa9fc('0x36')][_0xa9fc('0xa3')],_0x8f52b7[_0xa9fc('0x36')][_0xa9fc('0xa4')],_0x8f52b7[_0xa9fc('0x36')][_0xa9fc('0x5f')],_0x8f52b7[_0xa9fc('0x36')]['CompanyId'],_0x8f52b7[_0xa9fc('0x36')][_0xa9fc('0x5c')],_0x8f52b7[_0xa9fc('0x36')][_0xa9fc('0xb2')]]);return _0x3df43c[_0xa9fc('0x12')](0xc8)['json']({'message':_0xa9fc('0xb3'),'pid':_0x729d38[_0xa9fc('0xb4')]});}catch(_0xc57858){return _0x3df43c[_0xa9fc('0x12')](0x1f4)[_0xa9fc('0xb5')](_0xc57858);}};exports[_0xa9fc('0xb6')]=function(_0x327efa,_0x58f776){var _0x4e81c7=fs['createReadStream'](_0x327efa['file']['path']);Papa[_0xa9fc('0xb7')](_0x4e81c7,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x1fb580){return _0x58f776[_0xa9fc('0x12')](0xc8)[_0xa9fc('0x13')]({'file':_0x327efa[_0xa9fc('0xac')],'fields':_0x1fb580[_0xa9fc('0xb8')][_0xa9fc('0x7e')]});}});};exports[_0xa9fc('0xb9')]=function(_0x52a890,_0x285aa5){return db[_0xa9fc('0xba')][_0xa9fc('0x21')]({'raw':!![],'attributes':['id'],'where':{'role':_0xa9fc('0xbb')}})[_0xa9fc('0x1b')](function(_0x13ec2e){var _0x4a8792=![];if(!_0x52a890[_0xa9fc('0x36')][_0xa9fc('0x5f')]){throw new Error(_0xa9fc('0xa2'));}if(!_0x52a890[_0xa9fc('0x36')][_0xa9fc('0xbc')][_0xa9fc('0x77')]){throw new Error('No\x20phone\x20column\x20specified');}if(!_0x52a890[_0xa9fc('0x36')][_0xa9fc('0xbc')]['firstName']){throw new Error('No\x20firstName\x20column\x20specified');}if(!_0x52a890[_0xa9fc('0x36')]['socket_timestamp']){throw new Error(_0xa9fc('0xa6'));}var _0x3d8dd8=require(_0xa9fc('0xaf'))[_0xa9fc('0xb0')](path[_0xa9fc('0x3a')](__dirname,_0xa9fc('0xbd')),[_0x52a890[_0xa9fc('0x67')]['id'],JSON['stringify'](_0x52a890[_0xa9fc('0x36')]),JSON[_0xa9fc('0xbe')](_0x13ec2e)]);_0x3d8dd8['on'](_0xa9fc('0xbf'),function(){_0x4a8792=!![];return _0x285aa5[_0xa9fc('0x12')](0xc8)[_0xa9fc('0x13')]({'message':_0xa9fc('0xc0'),'pid':_0x3d8dd8['pid']});});_0x3d8dd8['on'](_0xa9fc('0xc1'),function(_0x571228){if(_0x571228&&!_0x4a8792){return _0x285aa5[_0xa9fc('0x12')](0x1f4)['json']({'message':_0xa9fc('0xc2'),'pid':_0x3d8dd8[_0xa9fc('0xb4')]});}});})[_0xa9fc('0x23')](handleError(_0x285aa5,null));};exports['importUpdates']=function(_0x57606e,_0x3f8511){return db[_0xa9fc('0xba')]['findAll']({'raw':!![],'attributes':['id'],'where':{'role':'agent'}})[_0xa9fc('0x1b')](function(_0x196b1){var _0x3c8ee0=![];if(!_0x57606e[_0xa9fc('0x36')][_0xa9fc('0x5f')]){throw new Error(_0xa9fc('0xa2'));}if(!_0x57606e[_0xa9fc('0x36')][_0xa9fc('0xbc')][_0xa9fc('0x77')]){throw new Error(_0xa9fc('0xa8'));}if(!_0x57606e[_0xa9fc('0x36')][_0xa9fc('0xbc')][_0xa9fc('0xa9')]){throw new Error(_0xa9fc('0xaa'));}if(!_0x57606e[_0xa9fc('0x36')][_0xa9fc('0xb2')]){throw new Error(_0xa9fc('0xa6'));}var _0x724bd0=require(_0xa9fc('0xaf'))[_0xa9fc('0xb0')](path['join'](__dirname,'../../components/import/cm/csvUpdates'),[_0x57606e[_0xa9fc('0x67')]['id'],JSON[_0xa9fc('0xbe')](_0x57606e[_0xa9fc('0x36')]),JSON[_0xa9fc('0xbe')](_0x196b1)]);_0x724bd0['on'](_0xa9fc('0xbf'),function(){_0x3c8ee0=!![];return _0x3f8511[_0xa9fc('0x12')](0xc8)[_0xa9fc('0x13')]({'message':_0xa9fc('0xc0'),'pid':_0x724bd0['pid']});});_0x724bd0['on'](_0xa9fc('0xc1'),function(_0x5d6fc0){if(_0x5d6fc0&&!_0x3c8ee0){return _0x3f8511['status'](0x1f4)['json']({'message':_0xa9fc('0xc2'),'pid':_0x724bd0[_0xa9fc('0xb4')]});}});})[_0xa9fc('0x23')](handleError(_0x3f8511,null));};exports[_0xa9fc('0xc3')]=function(_0x2efebe,_0xbf607d){var _0x289384=[_0xa9fc('0xc4'),'chat','sms',_0xa9fc('0xc5'),_0xa9fc('0xc6'),_0xa9fc('0xc7'),_0xa9fc('0xc8')];var _0x352e18={'offset':0x0,'order':qs[_0xa9fc('0x80')]('-createdAt')},_0x367d0e={'count':0x0,'rows':[]};Promise[_0xa9fc('0xc9')]()[_0xa9fc('0x1b')](function(){if(_0x2efebe[_0xa9fc('0x22')][_0xa9fc('0xca')]){if(!_[_0xa9fc('0xcb')](_0x289384,_0x2efebe[_0xa9fc('0x22')][_0xa9fc('0xca')]['toLowerCase']())){throw new Error(_0xa9fc('0xcc'));}_0x289384=[_0x2efebe[_0xa9fc('0x22')]['channel'][_0xa9fc('0xcd')]()];}if(_0x2efebe['query'][_0xa9fc('0xce')]){try{var _0x2f08bf=JSON[_0xa9fc('0xb7')](_0x2efebe[_0xa9fc('0x22')][_0xa9fc('0xce')]);if(!moment(_0x2f08bf[_0xa9fc('0x3c')])[_0xa9fc('0xcf')]()){throw new Error('Invalid\x20date\x20for\x20range\x20from\x20filter');}if(!moment(_0x2f08bf['to'])[_0xa9fc('0xcf')]()){throw new Error(_0xa9fc('0xd0'));}}catch(_0x171aff){throw new Error(_0xa9fc('0xd1'));}}if(!_0x2efebe[_0xa9fc('0x22')][_0xa9fc('0x34')](_0xa9fc('0x83'))){_0x352e18[_0xa9fc('0x15')]=qs[_0xa9fc('0x15')](_0x2efebe[_0xa9fc('0x22')][_0xa9fc('0x15')]||0xa);_0x352e18[_0xa9fc('0x14')]=qs['offset'](_0x2efebe[_0xa9fc('0x22')][_0xa9fc('0x14')]);}var _0x2f0715=_0x289384[_0xa9fc('0x6e')](function(_0x20c045){if(_0x20c045==='voice'){var _0x169723={'attributes':['id',_0xa9fc('0xd2'),'type',_0xa9fc('0xd3'),_0xa9fc('0xd4'),_0xa9fc('0xd5'),_0xa9fc('0xd6'),_0xa9fc('0xd7'),_0xa9fc('0xd8'),_0xa9fc('0xd9'),_0xa9fc('0xda'),_0xa9fc('0xdb'),'userSecondDisposition',_0xa9fc('0xdc'),'UserId'],'where':{'ContactId':_0x2efebe[_0xa9fc('0x67')]['id']},'include':[{'model':db[_0xa9fc('0xba')],'as':_0xa9fc('0xba'),'attributes':['id',_0xa9fc('0x1f'),_0xa9fc('0xdd'),_0xa9fc('0x2e')]}],'order':[[_0xa9fc('0xda'),_0xa9fc('0xde')]]};if(_0x2efebe[_0xa9fc('0x22')][_0xa9fc('0xce')]){_0x169723[_0xa9fc('0x5d')][_0xa9fc('0xda')]={'$gte':_0x2f08bf['from'],'$lte':_0x2f08bf['to']};}return db[_0xa9fc('0xdf')][_0xa9fc('0xe0')](_0x169723)['then'](function(_0x5c5a2b){_0x367d0e[_0xa9fc('0x17')]+=_0x5c5a2b[_0xa9fc('0x17')];return _[_0xa9fc('0x6e')](_0x5c5a2b[_0xa9fc('0x9e')],function(_0x250120){var _0x384e15=_0x250120[_0xa9fc('0x37')]({'plain':!![]});_0x384e15[_0xa9fc('0xca')]=_0x20c045;if(_0x384e15['User']){_0x384e15['User']={'id':_0x384e15[_0xa9fc('0xba')]['id'],'name':_0x384e15[_0xa9fc('0xba')][_0xa9fc('0x1f')],'fullname':_0x384e15[_0xa9fc('0xba')][_0xa9fc('0xdd')],'alias':_0x384e15['User'][_0xa9fc('0x2e')]};}return _0x384e15;});});}else{var _0x3e41d5=_['startCase'](_0x20c045)+(_0x20c045===_0xa9fc('0xe1')?_0xa9fc('0xe2'):_0xa9fc('0xe3'));var _0x944857={'attributes':['id',_0xa9fc('0xe4'),_0xa9fc('0xe5'),'createdAt','note',_0xa9fc('0xe6'),_0xa9fc('0xe7'),_0xa9fc('0xe8'),_0xa9fc('0xe9'),_0x3e41d5+'Id'],'where':{'ContactId':_0x2efebe['params']['id']},'include':[{'model':db[_0x3e41d5],'as':'Account','attributes':['id','name','key']},{'model':db[_0xa9fc('0xba')],'as':_0xa9fc('0xea'),'attributes':['id',_0xa9fc('0x1f'),_0xa9fc('0xdd')]},{'model':db['Tag'],'as':_0xa9fc('0xeb'),'attributes':['id','name',_0xa9fc('0x68')],'through':{'attributes':[]}}],'order':[['createdAt',_0xa9fc('0xde')]]};if(_0x2efebe[_0xa9fc('0x22')][_0xa9fc('0xce')]){_0x944857[_0xa9fc('0x5d')][_0xa9fc('0xda')]={'$gte':_0x2f08bf['from'],'$lte':_0x2f08bf['to']};}switch(_0x20c045){case'chat':_0x944857['attributes'][_0xa9fc('0x62')](_0xa9fc('0xec'),_0xa9fc('0xed'),'customerPort','deviceModel',_0xa9fc('0xee'),_0xa9fc('0xef'),'ratingType',_0xa9fc('0xf0'),_0xa9fc('0xf1'));break;case _0xa9fc('0xc4'):_0x944857['attributes'][_0xa9fc('0x62')](_0xa9fc('0xf2'),_0xa9fc('0xf3'));break;case _0xa9fc('0xc5'):_0x944857[_0xa9fc('0x7d')]['push'](_0xa9fc('0xf4'),_0xa9fc('0xf5'));break;}return db[_['startCase'](_0x20c045)+_0xa9fc('0xf6')][_0xa9fc('0xe0')](_0x944857)[_0xa9fc('0x1b')](function(_0x39e073){_0x367d0e[_0xa9fc('0x17')]+=_0x39e073[_0xa9fc('0x17')];return _[_0xa9fc('0x6e')](_0x39e073['rows'],function(_0x3ceea2){var _0x57c8c7=_0x3ceea2['get']({'plain':!![]});_0x57c8c7[_0xa9fc('0xca')]=_0x20c045;if(_0x57c8c7[_0xa9fc('0xea')]){_0x57c8c7[_0xa9fc('0xea')]={'id':_0x57c8c7[_0xa9fc('0xea')]['id'],'name':_0x57c8c7[_0xa9fc('0xea')][_0xa9fc('0x1f')],'fullname':_0x57c8c7[_0xa9fc('0xea')][_0xa9fc('0xdd')]};}return _0x57c8c7;});});}});return Promise['all'](_0x2f0715);})[_0xa9fc('0x1b')](function(_0x3f3ec1){return _(_0x3f3ec1)['flatten']()[_0xa9fc('0xf7')](_0xa9fc('0xda'))[_0xa9fc('0xf8')]()[_0xa9fc('0xf9')]();})['then'](function(_0x1c6acf){_0x367d0e[_0xa9fc('0x9e')]=_0x352e18['limit']?_0x1c6acf[_0xa9fc('0xfa')](_0x352e18[_0xa9fc('0x14')],_0x352e18[_0xa9fc('0x14')]+_0x352e18[_0xa9fc('0x15')]):_0x1c6acf;return _0x367d0e;})[_0xa9fc('0x1b')](respondWithFilteredResult(_0xbf607d,_0x352e18))['catch'](handleError(_0xbf607d,null));}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.events.js b/server/api/cmContact/cmContact.events.js index 18cc235..a124db1 100644 --- a/server/api/cmContact/cmContact.events.js +++ b/server/api/cmContact/cmContact.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3276=['hook','events','../../mysqldb','setMaxListeners','update','remove','emit','hasOwnProperty'];(function(_0x4aa838,_0x4aa14f){var _0x3abff0=function(_0x402d55){while(--_0x402d55){_0x4aa838['push'](_0x4aa838['shift']());}};_0x3abff0(++_0x4aa14f);}(_0x3276,0xe1));var _0x6327=function(_0x22db06,_0x16814b){_0x22db06=_0x22db06-0x0;var _0x3c5402=_0x3276[_0x22db06];return _0x3c5402;};'use strict';var EventEmitter=require(_0x6327('0x0'));var CmContact=require(_0x6327('0x1'))['db']['CmContact'];var CmContactEvents=new EventEmitter();CmContactEvents[_0x6327('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x6327('0x3'),'afterDestroy':_0x6327('0x4')};function emitEvent(_0x177f4d){return function(_0x2e1392,_0x3952af,_0x43c7d5){CmContactEvents[_0x6327('0x5')](_0x177f4d+':'+_0x2e1392['id'],_0x2e1392);CmContactEvents[_0x6327('0x5')](_0x177f4d,_0x2e1392);_0x43c7d5(null);};}for(var e in events){if(events[_0x6327('0x6')](e)){var event=events[e];CmContact[_0x6327('0x7')](e,emitEvent(event));}}module['exports']=CmContactEvents; \ No newline at end of file +var _0x0add=['events','setMaxListeners','save','update','remove','hasOwnProperty','hook','exports'];(function(_0x2042d7,_0x313b47){var _0x1df24d=function(_0x59c5c8){while(--_0x59c5c8){_0x2042d7['push'](_0x2042d7['shift']());}};_0x1df24d(++_0x313b47);}(_0x0add,0xb0));var _0xd0ad=function(_0x631a3c,_0x1b61b6){_0x631a3c=_0x631a3c-0x0;var _0x2bdfa3=_0x0add[_0x631a3c];return _0x2bdfa3;};'use strict';var EventEmitter=require(_0xd0ad('0x0'));var CmContact=require('../../mysqldb')['db']['CmContact'];var CmContactEvents=new EventEmitter();CmContactEvents[_0xd0ad('0x1')](0x0);var events={'afterCreate':_0xd0ad('0x2'),'afterUpdate':_0xd0ad('0x3'),'afterDestroy':_0xd0ad('0x4')};function emitEvent(_0x1947f8){return function(_0x1cdcce,_0x14decd,_0x3b665b){CmContactEvents['emit'](_0x1947f8+':'+_0x1cdcce['id'],_0x1cdcce);CmContactEvents['emit'](_0x1947f8,_0x1cdcce);_0x3b665b(null);};}for(var e in events){if(events[_0xd0ad('0x5')](e)){var event=events[e];CmContact[_0xd0ad('0x6')](e,emitEvent(event));}}module[_0xd0ad('0x7')]=CmContactEvents; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.model.js b/server/api/cmContact/cmContact.model.js index fd50b85..002f0ae 100644 --- a/server/api/cmContact/cmContact.model.js +++ b/server/api/cmContact/cmContact.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x76c4=['moment','../../config/environment/shared','./cmContact.attributes','Campaign','VoiceQueue','scheduledat','format','isNil','dialTimezone','resolve','then','timezones','utcOffset','add','minutes','YYYY-MM-DD\x20HH:mm:ss','phone','ListId','priority','callbackUniqueid','assign','CmHopper','findOne','[Always]\x20Hopper\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','[Always]\x20Hopper\x20Final\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','\x20in\x20Campaign\x20with\x20id\x20','CampaignId','VoiceQueueId','[OnlyIfOpen]\x20Hopper\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','create','always','onlyIfOpen','findAll','dialCheckDuplicateType','CmList','Lists','map','all','outbound','CmHopperBlack','BlackLists','define','CmContact','cm_contacts','fti_cm_contacts','lastName','fax','email','FULLTEXT','utf8mb4','utf8mb4_unicode_ci','models','get','error','[cmContact][afterCreate]\x20List\x20not\x20found\x20for\x20contact\x20with\x20id\x20','catch','[cmContact][afterCreate]','isEmpty','length','destroy','ContactId','push','info','[CmContact][afterDestroy][Succesfull]','inspect','[CmContact][afterDestroy][Error]','lodash','util','../../config/logger'];(function(_0x56c6a9,_0x1239ee){var _0xa3ad43=function(_0x386c0a){while(--_0x386c0a){_0x56c6a9['push'](_0x56c6a9['shift']());}};_0xa3ad43(++_0x1239ee);}(_0x76c4,0x19b));var _0x476c=function(_0xb7baaa,_0x602427){_0xb7baaa=_0xb7baaa-0x0;var _0x2c7a11=_0x76c4[_0xb7baaa];return _0x2c7a11;};'use strict';var _=require(_0x476c('0x0'));var util=require(_0x476c('0x1'));var logger=require(_0x476c('0x2'))('api');var moment=require(_0x476c('0x3'));var shared=require(_0x476c('0x4'));var attributes=require(_0x476c('0x5'));function getTimezoneCallbackAt(_0x33f84f,_0x3a6fc4,_0x5ec12b,_0x4f5f3f){var _0x1bd092=_0x4f5f3f?_0x476c('0x6'):_0x476c('0x7');var _0x126b74=_0x5ec12b[_0x476c('0x8')]?_0x5ec12b[_0x476c('0x8')]:moment()[_0x476c('0x9')]('YYYY-MM-DD\x20HH:mm:ss');if(_[_0x476c('0xa')](_0x5ec12b[_0x476c('0xb')])){return Promise[_0x476c('0xc')](_0x126b74);}return _0x33f84f[_0x1bd092]['findOne']({'where':{'id':_0x3a6fc4}})[_0x476c('0xd')](function(_0x3f52bf){if(_['isNil'](_0x3f52bf)||_[_0x476c('0xa')](_0x3f52bf['dialTimezone'])){return Promise[_0x476c('0xc')](_0x126b74);}var _0x1bf6f3=shared[_0x476c('0xe')];var _0x2e9477=_0x1bf6f3[_0x3f52bf[_0x476c('0xb')]];var _0x3a54f8=_0x1bf6f3[_0x5ec12b[_0x476c('0xb')]];if(_[_0x476c('0xa')](_0x2e9477)&&_['isNil'](_0x3a54f8)){return Promise['resolve'](_0x126b74);}var _0x4218ae=_0x2e9477[_0x476c('0xf')]-_0x3a54f8['utcOffset'];var _0x38ff59=_0x5ec12b[_0x476c('0x8')]?_0x5ec12b[_0x476c('0x8')]:moment();_0x126b74=moment(_0x38ff59)[_0x476c('0x10')](_0x4218ae,_0x476c('0x11'))[_0x476c('0x9')](_0x476c('0x12'));return Promise[_0x476c('0xc')](_0x126b74);});}function getNewHopperPayload(_0xd2b9b8){return{'phone':_0xd2b9b8[_0x476c('0x13')],'ContactId':_0xd2b9b8['id'],'ListId':_0xd2b9b8[_0x476c('0x14')],'scheduledat':_0xd2b9b8[_0x476c('0x8')]?_0xd2b9b8['scheduledat']:moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'priority':_0xd2b9b8[_0x476c('0x15')]?_0xd2b9b8[_0x476c('0x15')]:0x2,'callback':_0xd2b9b8[_0x476c('0x16')]?!![]:![],'callbackuniqueid':_0xd2b9b8[_0x476c('0x16')]?_0xd2b9b8[_0x476c('0x16')]:undefined,'callbackat':_0xd2b9b8[_0x476c('0x16')]?moment()[_0x476c('0x9')](_0x476c('0x12')):undefined};}function handleAlwaysCheckDuplicate(_0x3e76e0,_0x28df30,_0x34407f,_0x45c02){var _0x20e12a={'phone':_0x34407f[_0x476c('0x13')]};var _0x14aae6={'calleridnum':_0x34407f[_0x476c('0x13')]};if(_0x45c02){Object[_0x476c('0x17')](_0x20e12a,{'CampaignId':_0x28df30['id']});Object[_0x476c('0x17')](_0x14aae6,{'CampaignId':_0x28df30['id']});}else{Object[_0x476c('0x17')](_0x20e12a,{'VoiceQueueId':_0x28df30['id']});Object[_0x476c('0x17')](_0x14aae6,{'VoiceQueueId':_0x28df30['id']});}return _0x3e76e0[_0x476c('0x18')][_0x476c('0x19')]({'where':_0x20e12a})['then'](function(_0x5d5190){if(_0x5d5190){throw new Error(_0x476c('0x1a')+_0x34407f[_0x476c('0x13')]+'\x20in\x20Campaign\x20with\x20id\x20'+_0x28df30['id']);}return _0x3e76e0['CmHopperFinal']['findOne']({'where':_0x14aae6});})['then'](function(_0x4b48b2){if(_0x4b48b2){throw new Error(_0x476c('0x1b')+_0x34407f['phone']+_0x476c('0x1c')+_0x28df30['id']);}var _0x2aff2a=getNewHopperPayload(_0x34407f);if(_0x45c02){_0x2aff2a[_0x476c('0x1d')]=_0x28df30['id'];}else{_0x2aff2a[_0x476c('0x1e')]=_0x28df30['id'];}return _0x3e76e0[_0x476c('0x18')]['create'](_0x2aff2a);});}function handleOnlyIfOpenCheckDuplicate(_0x410179,_0x1eeadb,_0x31a93f,_0x33991f){var _0x588d92={'phone':_0x31a93f['phone']};if(_0x33991f){Object['assign'](_0x588d92,{'CampaignId':_0x1eeadb['id']});}else{Object[_0x476c('0x17')](_0x588d92,{'VoiceQueueId':_0x1eeadb['id']});}return _0x410179[_0x476c('0x18')][_0x476c('0x19')]({'where':_0x588d92})[_0x476c('0xd')](function(_0x1700f0){if(_0x1700f0){throw new Error(_0x476c('0x1f')+_0x31a93f[_0x476c('0x13')]+_0x476c('0x1c')+_0x1eeadb['id']);}var _0x45607a=getNewHopperPayload(_0x31a93f);if(_0x33991f){_0x45607a['CampaignId']=_0x1eeadb['id'];}else{_0x45607a[_0x476c('0x1e')]=_0x1eeadb['id'];}return _0x410179[_0x476c('0x18')][_0x476c('0x20')](_0x45607a);});}function handleNeverCheckDuplicate(_0x4663f7,_0x4ce6bd,_0x456456){var _0x3b3dcd=getNewHopperPayload(_0x456456);_0x3b3dcd[_0x476c('0x1e')]=_0x4ce6bd['id'];return _0x4663f7[_0x476c('0x18')][_0x476c('0x20')](_0x3b3dcd);}function handleCheckDuplicate(_0x1e4498,_0x1d3983,_0x3f227b,_0x1bc713){return getTimezoneCallbackAt(_0x1e4498,_0x1d3983,_0x3f227b,_0x1bc713)[_0x476c('0xd')](function(_0x523735){_0x3f227b[_0x476c('0x8')]=_0x523735;switch(_0x1d3983['dialCheckDuplicateType']){case _0x476c('0x21'):return handleAlwaysCheckDuplicate(_0x1e4498,_0x1d3983,_0x3f227b,_0x1bc713);case _0x476c('0x22'):return handleOnlyIfOpenCheckDuplicate(_0x1e4498,_0x1d3983,_0x3f227b,_0x1bc713);default:return handleNeverCheckDuplicate(_0x1e4498,_0x1d3983,_0x3f227b);}});}function createHopperForVoiceQueues(_0x4e78cf,_0xd1b0e5){return _0x4e78cf[_0x476c('0x7')][_0x476c('0x23')]({'where':{'type':'outbound'},'attributes':['id',_0x476c('0x24'),'dialTimezone'],'include':[{'model':_0x4e78cf[_0x476c('0x25')],'as':_0x476c('0x26'),'where':{'id':_0xd1b0e5[_0x476c('0x14')]}}],'raw':!![]})[_0x476c('0xd')](function(_0x12d63b){var _0x3740f8=_0x12d63b['map'](function(_0x5d7fe1){return handleCheckDuplicate(_0x4e78cf,_0x5d7fe1,_0xd1b0e5,![]);});return Promise['all'](_0x3740f8);});}function createHopperForCampaigns(_0x28d67b,_0x26e1ba){return _0x28d67b[_0x476c('0x6')][_0x476c('0x23')]({'attributes':['id',_0x476c('0x24'),_0x476c('0xb')],'include':[{'model':_0x28d67b[_0x476c('0x25')],'as':_0x476c('0x26'),'where':{'id':_0x26e1ba[_0x476c('0x14')]}}],'raw':!![]})['then'](function(_0x55de40){var _0x4877b5=_0x55de40[_0x476c('0x27')](function(_0x3c106f){return handleCheckDuplicate(_0x28d67b,_0x3c106f,_0x26e1ba,!![]);});return Promise[_0x476c('0x28')](_0x4877b5);});}function createHopperBlackForVoiceQueues(_0x41118f,_0x3fca8a){return _0x41118f[_0x476c('0x7')]['findAll']({'where':{'type':_0x476c('0x29')},'attributes':['id'],'include':[{'model':_0x41118f['CmList'],'as':'BlackLists','where':{'id':_0x3fca8a[_0x476c('0x14')]}}],'raw':!![]})[_0x476c('0xd')](function(_0x545fdb){var _0x4b4c2f=_0x545fdb[_0x476c('0x27')](function(_0x1e3fde){return _0x41118f[_0x476c('0x2a')][_0x476c('0x20')]({'phone':_0x3fca8a['phone'],'ContactId':_0x3fca8a['id'],'ListId':_0x3fca8a['ListId'],'VoiceQueueId':_0x1e3fde['id']});});return Promise[_0x476c('0x28')](_0x4b4c2f);});}function createHopperBlackForCampaigns(_0x5c3c01,_0x5b5009){return _0x5c3c01[_0x476c('0x6')]['findAll']({'attributes':['id'],'include':[{'model':_0x5c3c01[_0x476c('0x25')],'as':_0x476c('0x2b'),'where':{'id':_0x5b5009[_0x476c('0x14')]}}],'raw':!![]})[_0x476c('0xd')](function(_0x46df46){var _0x230181=_0x46df46[_0x476c('0x27')](function(_0x42e2ed){return _0x5c3c01['CmHopperBlack'][_0x476c('0x20')]({'phone':_0x5b5009[_0x476c('0x13')],'ContactId':_0x5b5009['id'],'ListId':_0x5b5009[_0x476c('0x14')],'CampaignId':_0x42e2ed['id']});});return Promise[_0x476c('0x28')](_0x230181);});}module['exports']=function(_0x1cb6f7){return _0x1cb6f7[_0x476c('0x2c')](_0x476c('0x2d'),attributes,{'tableName':_0x476c('0x2e'),'paranoid':!![],'indexes':[{'name':_0x476c('0x13'),'fields':[_0x476c('0x13')]},{'name':_0x476c('0x2f'),'fields':['firstName',_0x476c('0x30'),_0x476c('0x13'),'mobile',_0x476c('0x31'),_0x476c('0x32')],'type':_0x476c('0x33')}],'timestamps':!![],'charset':_0x476c('0x34'),'collate':_0x476c('0x35'),'hooks':{'afterCreate':function(_0x5be874,_0x1649f5,_0xb9edb4){var _0x149e55=_0x1cb6f7[_0x476c('0x36')];var _0x2368ca=_0x5be874[_0x476c('0x37')]({'plain':!![]});if(!_0x2368ca['ListId']){logger[_0x476c('0x38')](_0x476c('0x39')+_0x2368ca['id']);return _0xb9edb4();}if(!_0x2368ca['phone']){return _0xb9edb4();}return createHopperForVoiceQueues(_0x149e55,_0x2368ca)[_0x476c('0xd')](function(){return createHopperBlackForVoiceQueues(_0x149e55,_0x2368ca);})['then'](function(){return createHopperForCampaigns(_0x149e55,_0x2368ca);})[_0x476c('0xd')](function(){return createHopperBlackForCampaigns(_0x149e55,_0x2368ca);})[_0x476c('0xd')](function(){return _0xb9edb4();})[_0x476c('0x3a')](function(_0x4a615b){logger[_0x476c('0x38')](_0x476c('0x3b'),_0x4a615b['message']);_0xb9edb4();});},'afterDestroy':function(_0x4f6901,_0x10176c,_0x77c15){var _0x5c3769=_0x1cb6f7[_0x476c('0x36')];var _0x4dffbb=_0x4f6901[_0x476c('0x37')]({'plain':!![]});return _0x5c3769[_0x476c('0x18')]['findAll']({'raw':!![],'where':{'ListId':_0x4dffbb[_0x476c('0x14')],'ContactId':_0x4dffbb['id']}})[_0x476c('0xd')](function(_0xbdc6db){if(!_[_0x476c('0x3c')](_0xbdc6db)){var _0x13dca0=[];for(var _0x4289d5=0x0;_0x4289d5<_0xbdc6db[_0x476c('0x3d')];_0x4289d5+=0x1){var _0x26dc4a=_0x5c3769['CmHopper'][_0x476c('0x3e')]({'where':{'ListId':_0xbdc6db[_0x4289d5][_0x476c('0x14')],'ContactId':_0xbdc6db[_0x4289d5][_0x476c('0x3f')],'VoiceQueueId':_0xbdc6db[_0x4289d5][_0x476c('0x1e')],'CampaignId':_0xbdc6db[_0x4289d5][_0x476c('0x1d')]}});_0x13dca0[_0x476c('0x40')](_0x26dc4a);}return Promise[_0x476c('0x28')](_0x13dca0);}})[_0x476c('0xd')](function(_0x882340){logger[_0x476c('0x41')](_0x476c('0x42'),util[_0x476c('0x43')](_0x882340,{'showHidden':![],'depth':null}));_0x77c15();})['catch'](function(_0x5477e7){logger[_0x476c('0x38')](_0x476c('0x44'),util['inspect'](_0x5477e7,{'showHidden':![],'depth':null}));_0x77c15(_0x5477e7);});}}});}; \ No newline at end of file +var _0xea7a=['CmHopper','[Always]\x20Hopper\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','CmHopperFinal','[Always]\x20Hopper\x20Final\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','\x20in\x20Campaign\x20with\x20id\x20','CampaignId','create','[OnlyIfOpen]\x20Hopper\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','VoiceQueueId','dialCheckDuplicateType','always','outbound','CmList','Lists','ListId','map','Campaign','findAll','all','BlackLists','CmHopperBlack','exports','define','CmContact','fti_cm_contacts','firstName','lastName','mobile','fax','FULLTEXT','utf8mb4_unicode_ci','models','get','error','[cmContact][afterCreate]\x20List\x20not\x20found\x20for\x20contact\x20with\x20id\x20','catch','message','isEmpty','length','destroy','ContactId','push','inspect','[CmContact][afterDestroy][Error]','util','../../config/logger','moment','../../config/environment/shared','./cmContact.attributes','VoiceQueue','scheduledat','format','YYYY-MM-DD\x20HH:mm:ss','isNil','dialTimezone','findOne','then','resolve','utcOffset','minutes','phone','priority','callbackUniqueid','assign'];(function(_0xf013bd,_0x4774e3){var _0x47fd09=function(_0x204cfb){while(--_0x204cfb){_0xf013bd['push'](_0xf013bd['shift']());}};_0x47fd09(++_0x4774e3);}(_0xea7a,0x1ac));var _0xaea7=function(_0x3cde44,_0x162986){_0x3cde44=_0x3cde44-0x0;var _0x398a9e=_0xea7a[_0x3cde44];return _0x398a9e;};'use strict';var _=require('lodash');var util=require(_0xaea7('0x0'));var logger=require(_0xaea7('0x1'))('api');var moment=require(_0xaea7('0x2'));var shared=require(_0xaea7('0x3'));var attributes=require(_0xaea7('0x4'));function getTimezoneCallbackAt(_0x5b01e9,_0x138419,_0x2fa338,_0x3ad700){var _0x10f195=_0x3ad700?'Campaign':_0xaea7('0x5');var _0x2edacc=_0x2fa338[_0xaea7('0x6')]?_0x2fa338[_0xaea7('0x6')]:moment()[_0xaea7('0x7')](_0xaea7('0x8'));if(_[_0xaea7('0x9')](_0x2fa338[_0xaea7('0xa')])){return Promise['resolve'](_0x2edacc);}return _0x5b01e9[_0x10f195][_0xaea7('0xb')]({'where':{'id':_0x138419}})[_0xaea7('0xc')](function(_0x505daf){if(_[_0xaea7('0x9')](_0x505daf)||_[_0xaea7('0x9')](_0x505daf[_0xaea7('0xa')])){return Promise[_0xaea7('0xd')](_0x2edacc);}var _0x42ccee=shared['timezones'];var _0x52782e=_0x42ccee[_0x505daf['dialTimezone']];var _0x2eef9e=_0x42ccee[_0x2fa338['dialTimezone']];if(_[_0xaea7('0x9')](_0x52782e)&&_[_0xaea7('0x9')](_0x2eef9e)){return Promise['resolve'](_0x2edacc);}var _0x55899a=_0x52782e[_0xaea7('0xe')]-_0x2eef9e['utcOffset'];var _0x1a8582=_0x2fa338[_0xaea7('0x6')]?_0x2fa338[_0xaea7('0x6')]:moment();_0x2edacc=moment(_0x1a8582)['add'](_0x55899a,_0xaea7('0xf'))['format']('YYYY-MM-DD\x20HH:mm:ss');return Promise['resolve'](_0x2edacc);});}function getNewHopperPayload(_0x57202){return{'phone':_0x57202[_0xaea7('0x10')],'ContactId':_0x57202['id'],'ListId':_0x57202['ListId'],'scheduledat':_0x57202[_0xaea7('0x6')]?_0x57202[_0xaea7('0x6')]:moment()['format'](_0xaea7('0x8')),'priority':_0x57202[_0xaea7('0x11')]?_0x57202[_0xaea7('0x11')]:0x2,'callback':_0x57202[_0xaea7('0x12')]?!![]:![],'callbackuniqueid':_0x57202[_0xaea7('0x12')]?_0x57202[_0xaea7('0x12')]:undefined,'callbackat':_0x57202[_0xaea7('0x12')]?moment()[_0xaea7('0x7')](_0xaea7('0x8')):undefined};}function handleAlwaysCheckDuplicate(_0x4862e0,_0x22043c,_0x42f310,_0x57e951){var _0x2cb985={'phone':_0x42f310[_0xaea7('0x10')]};var _0x3c3dfd={'calleridnum':_0x42f310[_0xaea7('0x10')]};if(_0x57e951){Object['assign'](_0x2cb985,{'CampaignId':_0x22043c['id']});Object[_0xaea7('0x13')](_0x3c3dfd,{'CampaignId':_0x22043c['id']});}else{Object[_0xaea7('0x13')](_0x2cb985,{'VoiceQueueId':_0x22043c['id']});Object[_0xaea7('0x13')](_0x3c3dfd,{'VoiceQueueId':_0x22043c['id']});}return _0x4862e0[_0xaea7('0x14')][_0xaea7('0xb')]({'where':_0x2cb985})['then'](function(_0x51f486){if(_0x51f486){throw new Error(_0xaea7('0x15')+_0x42f310[_0xaea7('0x10')]+'\x20in\x20Campaign\x20with\x20id\x20'+_0x22043c['id']);}return _0x4862e0[_0xaea7('0x16')][_0xaea7('0xb')]({'where':_0x3c3dfd});})[_0xaea7('0xc')](function(_0x25e0ea){if(_0x25e0ea){throw new Error(_0xaea7('0x17')+_0x42f310[_0xaea7('0x10')]+_0xaea7('0x18')+_0x22043c['id']);}var _0x535b32=getNewHopperPayload(_0x42f310);if(_0x57e951){_0x535b32[_0xaea7('0x19')]=_0x22043c['id'];}else{_0x535b32['VoiceQueueId']=_0x22043c['id'];}return _0x4862e0[_0xaea7('0x14')][_0xaea7('0x1a')](_0x535b32);});}function handleOnlyIfOpenCheckDuplicate(_0x4c3085,_0x599b67,_0x26e636,_0x17faec){var _0x1e6595={'phone':_0x26e636[_0xaea7('0x10')]};if(_0x17faec){Object[_0xaea7('0x13')](_0x1e6595,{'CampaignId':_0x599b67['id']});}else{Object[_0xaea7('0x13')](_0x1e6595,{'VoiceQueueId':_0x599b67['id']});}return _0x4c3085['CmHopper'][_0xaea7('0xb')]({'where':_0x1e6595})[_0xaea7('0xc')](function(_0x2ae63f){if(_0x2ae63f){throw new Error(_0xaea7('0x1b')+_0x26e636[_0xaea7('0x10')]+'\x20in\x20Campaign\x20with\x20id\x20'+_0x599b67['id']);}var _0x204cc8=getNewHopperPayload(_0x26e636);if(_0x17faec){_0x204cc8[_0xaea7('0x19')]=_0x599b67['id'];}else{_0x204cc8['VoiceQueueId']=_0x599b67['id'];}return _0x4c3085[_0xaea7('0x14')][_0xaea7('0x1a')](_0x204cc8);});}function handleNeverCheckDuplicate(_0x456387,_0x4f8738,_0x4d6ebd){var _0x52cbfa=getNewHopperPayload(_0x4d6ebd);_0x52cbfa[_0xaea7('0x1c')]=_0x4f8738['id'];return _0x456387[_0xaea7('0x14')][_0xaea7('0x1a')](_0x52cbfa);}function handleCheckDuplicate(_0x55e4aa,_0x51bd74,_0x1ef265,_0x19cfd6){return getTimezoneCallbackAt(_0x55e4aa,_0x51bd74,_0x1ef265,_0x19cfd6)[_0xaea7('0xc')](function(_0x41db9c){_0x1ef265[_0xaea7('0x6')]=_0x41db9c;switch(_0x51bd74[_0xaea7('0x1d')]){case _0xaea7('0x1e'):return handleAlwaysCheckDuplicate(_0x55e4aa,_0x51bd74,_0x1ef265,_0x19cfd6);case'onlyIfOpen':return handleOnlyIfOpenCheckDuplicate(_0x55e4aa,_0x51bd74,_0x1ef265,_0x19cfd6);default:return handleNeverCheckDuplicate(_0x55e4aa,_0x51bd74,_0x1ef265);}});}function createHopperForVoiceQueues(_0x5f55b2,_0x11e96e){return _0x5f55b2[_0xaea7('0x5')]['findAll']({'where':{'type':_0xaea7('0x1f')},'attributes':['id',_0xaea7('0x1d'),_0xaea7('0xa')],'include':[{'model':_0x5f55b2[_0xaea7('0x20')],'as':_0xaea7('0x21'),'where':{'id':_0x11e96e[_0xaea7('0x22')]}}],'raw':!![]})[_0xaea7('0xc')](function(_0x2ab242){var _0x420bfe=_0x2ab242[_0xaea7('0x23')](function(_0x4769f0){return handleCheckDuplicate(_0x5f55b2,_0x4769f0,_0x11e96e,![]);});return Promise['all'](_0x420bfe);});}function createHopperForCampaigns(_0x5dd512,_0x20c4b9){return _0x5dd512[_0xaea7('0x24')][_0xaea7('0x25')]({'attributes':['id','dialCheckDuplicateType',_0xaea7('0xa')],'include':[{'model':_0x5dd512[_0xaea7('0x20')],'as':_0xaea7('0x21'),'where':{'id':_0x20c4b9['ListId']}}],'raw':!![]})[_0xaea7('0xc')](function(_0x4d03c4){var _0x433552=_0x4d03c4[_0xaea7('0x23')](function(_0xd15565){return handleCheckDuplicate(_0x5dd512,_0xd15565,_0x20c4b9,!![]);});return Promise[_0xaea7('0x26')](_0x433552);});}function createHopperBlackForVoiceQueues(_0x34d4ea,_0x573cec){return _0x34d4ea['VoiceQueue'][_0xaea7('0x25')]({'where':{'type':_0xaea7('0x1f')},'attributes':['id'],'include':[{'model':_0x34d4ea['CmList'],'as':_0xaea7('0x27'),'where':{'id':_0x573cec[_0xaea7('0x22')]}}],'raw':!![]})[_0xaea7('0xc')](function(_0x135fd0){var _0x1482c1=_0x135fd0[_0xaea7('0x23')](function(_0x55c73a){return _0x34d4ea[_0xaea7('0x28')][_0xaea7('0x1a')]({'phone':_0x573cec[_0xaea7('0x10')],'ContactId':_0x573cec['id'],'ListId':_0x573cec[_0xaea7('0x22')],'VoiceQueueId':_0x55c73a['id']});});return Promise[_0xaea7('0x26')](_0x1482c1);});}function createHopperBlackForCampaigns(_0x28f7b9,_0x12c7f3){return _0x28f7b9[_0xaea7('0x24')][_0xaea7('0x25')]({'attributes':['id'],'include':[{'model':_0x28f7b9[_0xaea7('0x20')],'as':_0xaea7('0x27'),'where':{'id':_0x12c7f3['ListId']}}],'raw':!![]})[_0xaea7('0xc')](function(_0xf86e25){var _0xe70859=_0xf86e25[_0xaea7('0x23')](function(_0x2b7143){return _0x28f7b9[_0xaea7('0x28')][_0xaea7('0x1a')]({'phone':_0x12c7f3[_0xaea7('0x10')],'ContactId':_0x12c7f3['id'],'ListId':_0x12c7f3[_0xaea7('0x22')],'CampaignId':_0x2b7143['id']});});return Promise[_0xaea7('0x26')](_0xe70859);});}module[_0xaea7('0x29')]=function(_0x370a09){return _0x370a09[_0xaea7('0x2a')](_0xaea7('0x2b'),attributes,{'tableName':'cm_contacts','paranoid':!![],'indexes':[{'name':'phone','fields':[_0xaea7('0x10')]},{'name':_0xaea7('0x2c'),'fields':[_0xaea7('0x2d'),_0xaea7('0x2e'),_0xaea7('0x10'),_0xaea7('0x2f'),_0xaea7('0x30'),'email'],'type':_0xaea7('0x31')}],'timestamps':!![],'charset':'utf8mb4','collate':_0xaea7('0x32'),'hooks':{'afterCreate':function(_0x3b7402,_0x462aad,_0x5950a9){var _0xed693a=_0x370a09[_0xaea7('0x33')];var _0x1b4165=_0x3b7402[_0xaea7('0x34')]({'plain':!![]});if(!_0x1b4165['ListId']){logger[_0xaea7('0x35')](_0xaea7('0x36')+_0x1b4165['id']);return _0x5950a9();}if(!_0x1b4165[_0xaea7('0x10')]){return _0x5950a9();}return createHopperForVoiceQueues(_0xed693a,_0x1b4165)[_0xaea7('0xc')](function(){return createHopperBlackForVoiceQueues(_0xed693a,_0x1b4165);})[_0xaea7('0xc')](function(){return createHopperForCampaigns(_0xed693a,_0x1b4165);})[_0xaea7('0xc')](function(){return createHopperBlackForCampaigns(_0xed693a,_0x1b4165);})[_0xaea7('0xc')](function(){return _0x5950a9();})[_0xaea7('0x37')](function(_0x45f81b){logger[_0xaea7('0x35')]('[cmContact][afterCreate]',_0x45f81b[_0xaea7('0x38')]);_0x5950a9();});},'afterDestroy':function(_0x2e084a,_0x36914b,_0x54c2aa){var _0x4695cf=_0x370a09[_0xaea7('0x33')];var _0x5cfa45=_0x2e084a[_0xaea7('0x34')]({'plain':!![]});return _0x4695cf[_0xaea7('0x14')]['findAll']({'raw':!![],'where':{'ListId':_0x5cfa45['ListId'],'ContactId':_0x5cfa45['id']}})['then'](function(_0x2980c0){if(!_[_0xaea7('0x39')](_0x2980c0)){var _0x15cf5a=[];for(var _0x1e7d36=0x0;_0x1e7d36<_0x2980c0[_0xaea7('0x3a')];_0x1e7d36+=0x1){var _0x9cf75f=_0x4695cf[_0xaea7('0x14')][_0xaea7('0x3b')]({'where':{'ListId':_0x2980c0[_0x1e7d36][_0xaea7('0x22')],'ContactId':_0x2980c0[_0x1e7d36][_0xaea7('0x3c')],'VoiceQueueId':_0x2980c0[_0x1e7d36][_0xaea7('0x1c')],'CampaignId':_0x2980c0[_0x1e7d36][_0xaea7('0x19')]}});_0x15cf5a[_0xaea7('0x3d')](_0x9cf75f);}return Promise[_0xaea7('0x26')](_0x15cf5a);}})[_0xaea7('0xc')](function(_0x45d384){logger['info']('[CmContact][afterDestroy][Succesfull]',util[_0xaea7('0x3e')](_0x45d384,{'showHidden':![],'depth':null}));_0x54c2aa();})[_0xaea7('0x37')](function(_0x4d45bd){logger[_0xaea7('0x35')](_0xaea7('0x3f'),util[_0xaea7('0x3e')](_0x4d45bd,{'showHidden':![],'depth':null}));_0x54c2aa(_0x4d45bd);});}}});}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.rpc.js b/server/api/cmContact/cmContact.rpc.js index 820ea73..dcccb1e 100644 --- a/server/api/cmContact/cmContact.rpc.js +++ b/server/api/cmContact/cmContact.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['phone','ListId','Contact','CmContactId','create','body','keys','length','startsWith','update','table','cm_contacts','id\x20=\x20?','sequelize','query','CreateCmContact','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','./cmContact.socket','register','info','CmContact,\x20%s,\x20%s','request\x20sent','debug','CmContact,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetCmContact','CmContact','findAll','options','where','limit','include','map','model','attributes','then','stringify','CmContactHasItem','find'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0xa9e0[_0x4dbaad];return _0x226c72;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var squel=require('squel');var db=require(_0x0a9e('0x4'))['db'];var utils=require(_0x0a9e('0x5'));var logger=require(_0x0a9e('0x6'))(_0x0a9e('0x7'));var config=require(_0x0a9e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x0a9e('0x9')][_0x0a9e('0xa')]({'port':0x232a});config[_0x0a9e('0xb')]=_['defaults'](config['redis'],{'host':_0x0a9e('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0a9e('0xd'))[_0x0a9e('0xe')](socket);function respondWithRpcPromise(_0x307b3e,_0x3ab53f,_0xfeb75b){return new BPromise(function(_0xbd1168,_0x4a4c56){return client['request'](_0x307b3e,_0xfeb75b)['then'](function(_0x4cfe67){logger[_0x0a9e('0xf')](_0x0a9e('0x10'),_0x3ab53f,_0x0a9e('0x11'));logger[_0x0a9e('0x12')](_0x0a9e('0x13'),_0x3ab53f,_0x0a9e('0x11'),JSON['stringify'](_0x4cfe67));if(_0x4cfe67[_0x0a9e('0x14')]){if(_0x4cfe67[_0x0a9e('0x14')][_0x0a9e('0x15')]===0x1f4){logger[_0x0a9e('0x14')](_0x0a9e('0x10'),_0x3ab53f,_0x4cfe67[_0x0a9e('0x14')]['message']);return _0x4a4c56(_0x4cfe67[_0x0a9e('0x14')]['message']);}logger[_0x0a9e('0x14')]('CmContact,\x20%s,\x20%s',_0x3ab53f,_0x4cfe67[_0x0a9e('0x14')][_0x0a9e('0x16')]);return _0xbd1168(_0x4cfe67['error'][_0x0a9e('0x16')]);}else{logger['info'](_0x0a9e('0x10'),_0x3ab53f,_0x0a9e('0x11'));_0xbd1168(_0x4cfe67[_0x0a9e('0x17')][_0x0a9e('0x16')]);}})[_0x0a9e('0x18')](function(_0x2eb11f){logger[_0x0a9e('0x14')](_0x0a9e('0x10'),_0x3ab53f,_0x2eb11f);_0x4a4c56(_0x2eb11f);});});}exports[_0x0a9e('0x19')]=function(_0x112016){var _0x1c696a=this;return new Promise(function(_0x105080,_0x4bb1e3){return db[_0x0a9e('0x1a')][_0x0a9e('0x1b')]({'raw':_0x112016['options']?_0x112016[_0x0a9e('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x112016['options']?_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1d')]||null:null,'attributes':_0x112016[_0x0a9e('0x1c')]?_0x112016[_0x0a9e('0x1c')]['attributes']||null:null,'limit':_0x112016[_0x0a9e('0x1c')]?_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1e')]||null:null,'include':_0x112016[_0x0a9e('0x1c')]?_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1f')]?_[_0x0a9e('0x20')](_0x112016['options']['include'],function(_0x197ec0){return{'model':db[_0x197ec0[_0x0a9e('0x21')]],'as':_0x197ec0['as'],'attributes':_0x197ec0[_0x0a9e('0x22')],'include':_0x197ec0[_0x0a9e('0x1f')]?_['map'](_0x197ec0[_0x0a9e('0x1f')],function(_0x479bc4){return{'model':db[_0x479bc4[_0x0a9e('0x21')]],'as':_0x479bc4['as'],'attributes':_0x479bc4['attributes'],'include':_0x479bc4[_0x0a9e('0x1f')]?_[_0x0a9e('0x20')](_0x479bc4[_0x0a9e('0x1f')],function(_0x14433c){return{'model':db[_0x14433c[_0x0a9e('0x21')]],'as':_0x14433c['as'],'attributes':_0x14433c[_0x0a9e('0x22')]};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x23')](function(_0x14de77){logger['info'](_0x0a9e('0x19'),_0x112016);logger[_0x0a9e('0x12')](_0x0a9e('0x19'),_0x112016,JSON[_0x0a9e('0x24')](_0x14de77));if(_0x14de77['length']==0x0){return db[_0x0a9e('0x25')][_0x0a9e('0x26')]({'raw':!![],'where':{'item':_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x27')]},'include':[{'model':db[_0x0a9e('0x1a')],'where':{'ListId':_0x112016[_0x0a9e('0x1c')][_0x0a9e('0x1d')][_0x0a9e('0x28')],'deletedAt':{'$eq':null}},'as':_0x0a9e('0x29')}]})['then'](function(_0x426950){if(_['isNil'](_0x426950)){_0x105080(_0x14de77);}else{var _0x2407f9=_0x426950[_0x0a9e('0x2a')];return db[_0x0a9e('0x1a')][_0x0a9e('0x1b')]({'raw':!![],'where':{'id':_0x2407f9},'attributes':_0x112016[_0x0a9e('0x1c')]?_0x112016['options'][_0x0a9e('0x22')]||null:null})[_0x0a9e('0x23')](function(_0x40cb85){_0x105080(_0x40cb85);});}});}else{_0x105080(_0x14de77);}})[_0x0a9e('0x18')](function(_0x2b45ea){logger[_0x0a9e('0x14')](_0x0a9e('0x19'),_0x2b45ea[_0x0a9e('0x16')],_0x112016);_0x4bb1e3(_0x1c696a['error'](0x1f4,_0x2b45ea[_0x0a9e('0x16')]));});});};exports['CreateCmContact']=function(_0x2cc7a0){var _0x14b13f=this;return new Promise(function(_0x2b7e7f,_0x3f3d41){return db['CmContact'][_0x0a9e('0x2b')](_0x2cc7a0[_0x0a9e('0x2c')],{'raw':_0x2cc7a0[_0x0a9e('0x1c')]?_0x2cc7a0[_0x0a9e('0x1c')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x1e8694){var _0x5640eb;for(var _0x24936a=0x0;_0x24936a{}\s\\|]/g,'-');_0x59181e(null,util[_0x0a9e('0x26')]('%s-%s%s',path[_0x0a9e('0x27')](_0x5ea472['originalname'],path[_0x0a9e('0x28')](_0x5ea472['originalname'])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x5ea472[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')](_0x0a9e('0x2a'),upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3652a7,_0x468813,_0x2b1f27){_0x2b1f27(null,path[_0x0a9e('0x21')](config['root'],_0x0a9e('0x23')));},'filename':function(_0x40e7a3,_0x1843b2,_0x824a4f){_0x1843b2[_0x0a9e('0x24')]=_0x1843b2[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x824a4f(null,util[_0x0a9e('0x26')](_0x0a9e('0x2e'),path['basename'](_0x1843b2[_0x0a9e('0x24')],path['extname'](_0x1843b2[_0x0a9e('0x24')])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x1843b2[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')]('/upload',upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2f')]);router[_0x0a9e('0x18')](_0x0a9e('0x30'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x31')]);router[_0x0a9e('0x18')]('/uploadUpdates/:id',auth[_0x0a9e('0xd')](),controller['importUpdates']);router[_0x0a9e('0x32')](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x34')]);router['delete'](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x35')]);module[_0x0a9e('0x36')]=router; \ No newline at end of file +var _0xa9e0=['basename','extname','now','/csv','single','file','uploadCsv','%s-%s%s','upload','/upload/:id','import','put','/:id','update','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContact.controller','get','index','/describe','show','/:id/tags','isAuthenticated','getTags','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperFinals','/:id/jscripty_sessions','getJscriptySessions','/:id/journey','getJourney','post','create','/create_many','bulkCreate','setTags','setAdditionalPhones','/:id/duplicateAdditionalPhones','/:id/rescheduleAdditionalPhones','rescheduleAdditionalPhones','join','root','server/files/tmp','originalname','replace','format'];(function(_0x234c08,_0x5f2220){var _0x6389ae=function(_0x426729){while(--_0x426729){_0x234c08['push'](_0x234c08['shift']());}};_0x6389ae(++_0x5f2220);}(_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'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/phones',auth['isAuthenticated'](),controller['getAdditionalPhones']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getHopperHistories']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x18')]('/merge',auth[_0x0a9e('0xd')](),controller['merge']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/phones',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x1e'),auth['isAuthenticated'](),controller['duplicateAdditionalPhones']);router[_0x0a9e('0x18')](_0x0a9e('0x1f'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xfb6e48,_0x2fb0e4,_0x3b45bc){_0x3b45bc(null,path[_0x0a9e('0x21')](config[_0x0a9e('0x22')],_0x0a9e('0x23')));},'filename':function(_0x16b1ca,_0x5ea472,_0x59181e){_0x5ea472[_0x0a9e('0x24')]=_0x5ea472[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x59181e(null,util[_0x0a9e('0x26')]('%s-%s%s',path[_0x0a9e('0x27')](_0x5ea472['originalname'],path[_0x0a9e('0x28')](_0x5ea472['originalname'])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x5ea472[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')](_0x0a9e('0x2a'),upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3652a7,_0x468813,_0x2b1f27){_0x2b1f27(null,path[_0x0a9e('0x21')](config['root'],_0x0a9e('0x23')));},'filename':function(_0x40e7a3,_0x1843b2,_0x824a4f){_0x1843b2[_0x0a9e('0x24')]=_0x1843b2[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x824a4f(null,util[_0x0a9e('0x26')](_0x0a9e('0x2e'),path['basename'](_0x1843b2[_0x0a9e('0x24')],path['extname'](_0x1843b2[_0x0a9e('0x24')])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x1843b2[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')]('/upload',upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2f')]);router[_0x0a9e('0x18')](_0x0a9e('0x30'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x31')]);router[_0x0a9e('0x18')]('/uploadUpdates/:id',auth[_0x0a9e('0xd')](),controller['importUpdates']);router[_0x0a9e('0x32')](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x34')]);router['delete'](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x35')]);module[_0x0a9e('0x36')]=router; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.attributes.js b/server/api/cmContactHasItem/cmContactHasItem.attributes.js index d71c2a3..b60be97 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.attributes.js +++ b/server/api/cmContactHasItem/cmContactHasItem.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x720c=['STRING','sequelize','INTEGER'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x720c,0x154));var _0xc720=function(_0x18fcde,_0x20f1c1){_0x18fcde=_0x18fcde-0x0;var _0x29bfb7=_0x720c[_0x18fcde];return _0x29bfb7;};'use strict';var Sequelize=require(_0xc720('0x0'));module['exports']={'CmContactId':{'type':Sequelize[_0xc720('0x1')],'primaryKey':!![]},'item':{'type':Sequelize[_0xc720('0x2')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0xc720('0x1')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0xc720('0x2')],'defaultValue':'PHONE'},'OrderBy':{'type':Sequelize[_0xc720('0x1')],'defaultValue':null},'description':{'type':Sequelize[_0xc720('0x2')],'defaultValue':null}}; \ No newline at end of file +var _0x99e9=['exports','INTEGER','STRING','PHONE'];(function(_0x39021c,_0x280ffc){var _0x5c5578=function(_0x439793){while(--_0x439793){_0x39021c['push'](_0x39021c['shift']());}};_0x5c5578(++_0x280ffc);}(_0x99e9,0xb4));var _0x999e=function(_0x459a0a,_0x25c46f){_0x459a0a=_0x459a0a-0x0;var _0x4ab46c=_0x99e9[_0x459a0a];return _0x4ab46c;};'use strict';var Sequelize=require('sequelize');module[_0x999e('0x0')]={'CmContactId':{'type':Sequelize[_0x999e('0x1')],'primaryKey':!![]},'item':{'type':Sequelize[_0x999e('0x2')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0x999e('0x1')],'defaultValue':null},'ItemClass':{'type':Sequelize['STRING'],'defaultValue':_0x999e('0x3')},'OrderBy':{'type':Sequelize[_0x999e('0x1')],'defaultValue':null},'description':{'type':Sequelize[_0x999e('0x2')],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.controller.js b/server/api/cmContactHasItem/cmContactHasItem.controller.js index 1fc44b7..baf7121 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.controller.js +++ b/server/api/cmContactHasItem/cmContactHasItem.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb0c5=['body','params','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','json','offset','undefined','limit','count','apply','reject','save','then','destroy','get','CmContactHasItems','UserProfileResource','status','end','stack','name','send','index','map','rawAttributes','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','CmContactHasItem','rows','catch','show','keys','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','error'];(function(_0x88f99f,_0x10d180){var _0x2dc4d4=function(_0x4399f9){while(--_0x4399f9){_0x88f99f['push'](_0x88f99f['shift']());}};_0x2dc4d4(++_0x10d180);}(_0xb0c5,0x1a1));var _0x5b0c=function(_0x55a54d,_0x40057a){_0x55a54d=_0x55a54d-0x0;var _0x3808a2=_0xb0c5[_0x55a54d];return _0x3808a2;};'use strict';var emlformat=require(_0x5b0c('0x0'));var rimraf=require(_0x5b0c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5b0c('0x2'));var rp=require(_0x5b0c('0x3'));var moment=require(_0x5b0c('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x5b0c('0x5'));var util=require('util');var path=require(_0x5b0c('0x6'));var sox=require(_0x5b0c('0x7'));var csv=require('to-csv');var ejs=require(_0x5b0c('0x8'));var fs=require('fs');var fs_extra=require(_0x5b0c('0x9'));var _=require(_0x5b0c('0xa'));var squel=require('squel');var crypto=require(_0x5b0c('0xb'));var jsforce=require(_0x5b0c('0xc'));var deskjs=require(_0x5b0c('0xd'));var toCsv=require(_0x5b0c('0xe'));var querystring=require('querystring');var Papa=require(_0x5b0c('0xf'));var Redis=require(_0x5b0c('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x5b0c('0x11'));var as=require(_0x5b0c('0x12'));var hardwareService=require(_0x5b0c('0x13'));var logger=require(_0x5b0c('0x14'))(_0x5b0c('0x15'));var utils=require(_0x5b0c('0x16'));var config=require(_0x5b0c('0x17'));var licenseUtil=require(_0x5b0c('0x18'));var db=require(_0x5b0c('0x19'))['db'];function respondWithStatusCode(_0x1d5dfc,_0x5acc3f){_0x5acc3f=_0x5acc3f||0xcc;return function(_0x34cada){if(_0x34cada){return _0x1d5dfc[_0x5b0c('0x1a')](_0x5acc3f);}return _0x1d5dfc['status'](_0x5acc3f)['end']();};}function respondWithResult(_0x4dac23,_0x2be327){_0x2be327=_0x2be327||0xc8;return function(_0x1118b3){if(_0x1118b3){return _0x4dac23['status'](_0x2be327)[_0x5b0c('0x1b')](_0x1118b3);}};}function respondWithFilteredResult(_0x59438c,_0x5f36fe){return function(_0x4f1010){if(_0x4f1010){var _0x5c3891=typeof _0x5f36fe[_0x5b0c('0x1c')]===_0x5b0c('0x1d')&&typeof _0x5f36fe[_0x5b0c('0x1e')]===_0x5b0c('0x1d');var _0x639528=_0x4f1010[_0x5b0c('0x1f')];var _0x326bd1=_0x5c3891?0x0:_0x5f36fe[_0x5b0c('0x1c')];var _0x58b2b9=_0x5c3891?_0x4f1010['count']:_0x5f36fe['offset']+_0x5f36fe['limit'];var _0x803018;if(_0x58b2b9>=_0x639528){_0x58b2b9=_0x639528;_0x803018=0xc8;}else{_0x803018=0xce;}_0x59438c['status'](_0x803018);return _0x59438c['set']('Content-Range',_0x326bd1+'-'+_0x58b2b9+'/'+_0x639528)['json'](_0x4f1010);}return null;};}function patchUpdates(_0x54b6e2){return function(_0x3d7569){try{jsonpatch[_0x5b0c('0x20')](_0x3d7569,_0x54b6e2,!![]);}catch(_0x50060b){return BPromise[_0x5b0c('0x21')](_0x50060b);}return _0x3d7569[_0x5b0c('0x22')]();};}function saveUpdates(_0x32b326,_0x473ace){return function(_0x1b82a4){if(_0x1b82a4){return _0x1b82a4['update'](_0x32b326)[_0x5b0c('0x23')](function(_0x412978){return _0x412978;});}return null;};}function removeEntity(_0x2842cc,_0x1f5128){return function(_0x171eb0){if(_0x171eb0){return _0x171eb0[_0x5b0c('0x24')]()[_0x5b0c('0x23')](function(){var _0x5dbf31=_0x171eb0[_0x5b0c('0x25')]({'plain':!![]});var _0x2f221f=_0x5b0c('0x26');return db[_0x5b0c('0x27')][_0x5b0c('0x24')]({'where':{'type':_0x2f221f,'resourceId':_0x5dbf31['id']}})[_0x5b0c('0x23')](function(){return _0x171eb0;});})['then'](function(){_0x2842cc[_0x5b0c('0x28')](0xcc)[_0x5b0c('0x29')]();});}};}function handleEntityNotFound(_0x4d1689,_0x495e77){return function(_0x1e4829){if(!_0x1e4829){_0x4d1689[_0x5b0c('0x1a')](0x194);}return _0x1e4829;};}function handleError(_0x28e188,_0x37da16){_0x37da16=_0x37da16||0x1f4;return function(_0x189280){logger['error'](_0x189280[_0x5b0c('0x2a')]);if(_0x189280[_0x5b0c('0x2b')]){delete _0x189280['name'];}_0x28e188[_0x5b0c('0x28')](_0x37da16)[_0x5b0c('0x2c')](_0x189280);};}exports[_0x5b0c('0x2d')]=function(_0xa1bd41,_0x255f2d){var _0x46f399={},_0x3cc1be={},_0x1955f5={'count':0x0,'rows':[]};var _0x3c5eb0=_[_0x5b0c('0x2e')](db['CmContactHasItem'][_0x5b0c('0x2f')],function(_0x45117e){return{'name':_0x45117e['fieldName'],'type':_0x45117e[_0x5b0c('0x30')][_0x5b0c('0x31')]};});_0x3cc1be[_0x5b0c('0x32')]=_[_0x5b0c('0x2e')](_0x3c5eb0,'name');_0x3cc1be[_0x5b0c('0x33')]=_['keys'](_0xa1bd41['query']);_0x3cc1be[_0x5b0c('0x34')]=_['intersection'](_0x3cc1be[_0x5b0c('0x32')],_0x3cc1be[_0x5b0c('0x33')]);_0x46f399['attributes']=_[_0x5b0c('0x35')](_0x3cc1be[_0x5b0c('0x32')],qs[_0x5b0c('0x36')](_0xa1bd41[_0x5b0c('0x33')][_0x5b0c('0x36')]));_0x46f399[_0x5b0c('0x37')]=_0x46f399['attributes'][_0x5b0c('0x38')]?_0x46f399[_0x5b0c('0x37')]:_0x3cc1be['model'];if(!_0xa1bd41[_0x5b0c('0x33')][_0x5b0c('0x39')](_0x5b0c('0x3a'))){_0x46f399[_0x5b0c('0x1e')]=qs['limit'](_0xa1bd41[_0x5b0c('0x33')][_0x5b0c('0x1e')]);_0x46f399[_0x5b0c('0x1c')]=qs['offset'](_0xa1bd41[_0x5b0c('0x33')][_0x5b0c('0x1c')]);}_0x46f399[_0x5b0c('0x3b')]=qs[_0x5b0c('0x3c')](_0xa1bd41[_0x5b0c('0x33')]['sort']);_0x46f399[_0x5b0c('0x3d')]=qs[_0x5b0c('0x34')](_[_0x5b0c('0x3e')](_0xa1bd41[_0x5b0c('0x33')],_0x3cc1be[_0x5b0c('0x34')]),_0x3c5eb0);if(_0xa1bd41['query'][_0x5b0c('0x3f')]){_0x46f399['where']=_[_0x5b0c('0x40')](_0x46f399['where'],{'$or':_['map'](_0x3c5eb0,function(_0x4287b3){if(_0x4287b3[_0x5b0c('0x30')]!==_0x5b0c('0x41')){var _0x4c026d={};_0x4c026d[_0x4287b3[_0x5b0c('0x2b')]]={'$like':'%'+_0xa1bd41[_0x5b0c('0x33')][_0x5b0c('0x3f')]+'%'};return _0x4c026d;}})});}_0x46f399=_[_0x5b0c('0x40')]({},_0x46f399,_0xa1bd41[_0x5b0c('0x42')]);var _0x11f369={'where':_0x46f399[_0x5b0c('0x3d')]};return db['CmContactHasItem'][_0x5b0c('0x1f')](_0x11f369)[_0x5b0c('0x23')](function(_0x18bbab){_0x1955f5[_0x5b0c('0x1f')]=_0x18bbab;if(_0xa1bd41[_0x5b0c('0x33')]['includeAll']){_0x46f399[_0x5b0c('0x43')]=[{'all':!![]}];}return db[_0x5b0c('0x44')]['findAll'](_0x46f399);})['then'](function(_0x80b056){_0x1955f5[_0x5b0c('0x45')]=_0x80b056;return _0x1955f5;})[_0x5b0c('0x23')](respondWithFilteredResult(_0x255f2d,_0x46f399))[_0x5b0c('0x46')](handleError(_0x255f2d,null));};exports[_0x5b0c('0x47')]=function(_0xe1cf84,_0x3ac0a2){var _0x103af7={'raw':!![],'where':{'id':_0xe1cf84['params']['id']}},_0x264aff={};_0x264aff[_0x5b0c('0x32')]=_[_0x5b0c('0x48')](db[_0x5b0c('0x44')][_0x5b0c('0x2f')]);_0x264aff['query']=_[_0x5b0c('0x48')](_0xe1cf84[_0x5b0c('0x33')]);_0x264aff[_0x5b0c('0x34')]=_[_0x5b0c('0x35')](_0x264aff[_0x5b0c('0x32')],_0x264aff[_0x5b0c('0x33')]);_0x103af7[_0x5b0c('0x37')]=_[_0x5b0c('0x35')](_0x264aff[_0x5b0c('0x32')],qs[_0x5b0c('0x36')](_0xe1cf84[_0x5b0c('0x33')]['fields']));_0x103af7['attributes']=_0x103af7[_0x5b0c('0x37')][_0x5b0c('0x38')]?_0x103af7['attributes']:_0x264aff[_0x5b0c('0x32')];if(_0xe1cf84[_0x5b0c('0x33')]['includeAll']){_0x103af7['include']=[{'all':!![]}];}_0x103af7=_[_0x5b0c('0x40')]({},_0x103af7,_0xe1cf84[_0x5b0c('0x42')]);return db['CmContactHasItem'][_0x5b0c('0x49')](_0x103af7)[_0x5b0c('0x23')](handleEntityNotFound(_0x3ac0a2,null))[_0x5b0c('0x23')](respondWithResult(_0x3ac0a2,null))[_0x5b0c('0x46')](handleError(_0x3ac0a2,null));};exports[_0x5b0c('0x4a')]=function(_0x34a125,_0x375129){return db[_0x5b0c('0x44')][_0x5b0c('0x4a')](_0x34a125['body'],{})[_0x5b0c('0x23')](function(_0x2c6309){var _0x4443fd=_0x34a125[_0x5b0c('0x4b')][_0x5b0c('0x25')]({'plain':!![]});if(!_0x4443fd)throw new Error(_0x5b0c('0x4c'));if(_0x4443fd[_0x5b0c('0x4d')]===_0x5b0c('0x4b')){var _0x3557ae=_0x2c6309[_0x5b0c('0x25')]({'plain':!![]});var _0x8cccd1=_0x5b0c('0x26');return db[_0x5b0c('0x4e')][_0x5b0c('0x49')]({'where':{'name':_0x8cccd1,'userProfileId':_0x4443fd['userProfileId']},'raw':!![]})[_0x5b0c('0x23')](function(_0x3a2750){if(_0x3a2750&&_0x3a2750[_0x5b0c('0x4f')]===0x0){return db['UserProfileResource'][_0x5b0c('0x4a')]({'name':_0x3557ae[_0x5b0c('0x2b')],'resourceId':_0x3557ae['id'],'type':_0x3a2750['name'],'sectionId':_0x3a2750['id']},{})[_0x5b0c('0x23')](function(){return _0x2c6309;});}else{return _0x2c6309;}})[_0x5b0c('0x46')](function(_0x414aae){logger[_0x5b0c('0x50')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x414aae);throw _0x414aae;});}return _0x2c6309;})[_0x5b0c('0x23')](respondWithResult(_0x375129,0xc9))[_0x5b0c('0x46')](handleError(_0x375129,null));};exports['update']=function(_0x4204ed,_0x387232){if(_0x4204ed[_0x5b0c('0x51')]['id']){delete _0x4204ed[_0x5b0c('0x51')]['id'];}return db['CmContactHasItem'][_0x5b0c('0x49')]({'where':{'id':_0x4204ed[_0x5b0c('0x52')]['id']}})[_0x5b0c('0x23')](handleEntityNotFound(_0x387232,null))[_0x5b0c('0x23')](saveUpdates(_0x4204ed[_0x5b0c('0x51')],null))[_0x5b0c('0x23')](respondWithResult(_0x387232,null))['catch'](handleError(_0x387232,null));};exports[_0x5b0c('0x24')]=function(_0x34d9f1,_0x11b8ff){return db[_0x5b0c('0x44')][_0x5b0c('0x49')]({'where':{'id':_0x34d9f1['params']['id']}})['then'](handleEntityNotFound(_0x11b8ff,null))[_0x5b0c('0x23')](removeEntity(_0x11b8ff,null))['catch'](handleError(_0x11b8ff,null));}; \ No newline at end of file +var _0x6464=['../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','get','error','stack','name','send','index','map','CmContactHasItem','rawAttributes','fieldName','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','params','keys','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','destroy','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis'];(function(_0x5e70f2,_0x562fce){var _0x5204fc=function(_0x37fcd8){while(--_0x37fcd8){_0x5e70f2['push'](_0x5e70f2['shift']());}};_0x5204fc(++_0x562fce);}(_0x6464,0x93));var _0x4646=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6464[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x4646('0x0'));var rimraf=require(_0x4646('0x1'));var zipdir=require(_0x4646('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4646('0x3'));var moment=require(_0x4646('0x4'));var BPromise=require(_0x4646('0x5'));var Mustache=require('mustache');var util=require(_0x4646('0x6'));var path=require('path');var sox=require(_0x4646('0x7'));var csv=require(_0x4646('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4646('0x9'));var _=require(_0x4646('0xa'));var squel=require(_0x4646('0xb'));var crypto=require(_0x4646('0xc'));var jsforce=require(_0x4646('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x4646('0x8'));var querystring=require(_0x4646('0xe'));var Papa=require(_0x4646('0xf'));var Redis=require(_0x4646('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x4646('0x11'));var hardwareService=require(_0x4646('0x12'));var logger=require('../../config/logger')(_0x4646('0x13'));var utils=require(_0x4646('0x14'));var config=require(_0x4646('0x15'));var licenseUtil=require(_0x4646('0x16'));var db=require(_0x4646('0x17'))['db'];function respondWithStatusCode(_0x256366,_0x2d1acc){_0x2d1acc=_0x2d1acc||0xcc;return function(_0x4cd94e){if(_0x4cd94e){return _0x256366[_0x4646('0x18')](_0x2d1acc);}return _0x256366[_0x4646('0x19')](_0x2d1acc)[_0x4646('0x1a')]();};}function respondWithResult(_0x231615,_0x268a97){_0x268a97=_0x268a97||0xc8;return function(_0x4ea9e5){if(_0x4ea9e5){return _0x231615[_0x4646('0x19')](_0x268a97)[_0x4646('0x1b')](_0x4ea9e5);}};}function respondWithFilteredResult(_0x2715c3,_0x5a2f8d){return function(_0x5f1622){if(_0x5f1622){var _0x2971bd=typeof _0x5a2f8d[_0x4646('0x1c')]===_0x4646('0x1d')&&typeof _0x5a2f8d[_0x4646('0x1e')]===_0x4646('0x1d');var _0x39c8fa=_0x5f1622['count'];var _0x24c2bf=_0x2971bd?0x0:_0x5a2f8d[_0x4646('0x1c')];var _0x59fad8=_0x2971bd?_0x5f1622[_0x4646('0x1f')]:_0x5a2f8d['offset']+_0x5a2f8d[_0x4646('0x1e')];var _0x239418;if(_0x59fad8>=_0x39c8fa){_0x59fad8=_0x39c8fa;_0x239418=0xc8;}else{_0x239418=0xce;}_0x2715c3['status'](_0x239418);return _0x2715c3[_0x4646('0x20')]('Content-Range',_0x24c2bf+'-'+_0x59fad8+'/'+_0x39c8fa)[_0x4646('0x1b')](_0x5f1622);}return null;};}function patchUpdates(_0x5047c8){return function(_0x5ed4d2){try{jsonpatch[_0x4646('0x21')](_0x5ed4d2,_0x5047c8,!![]);}catch(_0x55b187){return BPromise[_0x4646('0x22')](_0x55b187);}return _0x5ed4d2[_0x4646('0x23')]();};}function saveUpdates(_0x516d3c,_0x390be3){return function(_0x1b98c9){if(_0x1b98c9){return _0x1b98c9[_0x4646('0x24')](_0x516d3c)[_0x4646('0x25')](function(_0x568003){return _0x568003;});}return null;};}function removeEntity(_0x3442ec,_0x5abf79){return function(_0x1ce7f2){if(_0x1ce7f2){return _0x1ce7f2['destroy']()[_0x4646('0x25')](function(){var _0x21841f=_0x1ce7f2[_0x4646('0x26')]({'plain':!![]});var _0x5581af='CmContactHasItems';return db['UserProfileResource']['destroy']({'where':{'type':_0x5581af,'resourceId':_0x21841f['id']}})[_0x4646('0x25')](function(){return _0x1ce7f2;});})['then'](function(){_0x3442ec[_0x4646('0x19')](0xcc)[_0x4646('0x1a')]();});}};}function handleEntityNotFound(_0x4d45f8,_0x2b7459){return function(_0x185bcc){if(!_0x185bcc){_0x4d45f8['sendStatus'](0x194);}return _0x185bcc;};}function handleError(_0x35146d,_0x1a4a05){_0x1a4a05=_0x1a4a05||0x1f4;return function(_0x417c07){logger[_0x4646('0x27')](_0x417c07[_0x4646('0x28')]);if(_0x417c07['name']){delete _0x417c07[_0x4646('0x29')];}_0x35146d['status'](_0x1a4a05)[_0x4646('0x2a')](_0x417c07);};}exports[_0x4646('0x2b')]=function(_0x9b3350,_0x3d9335){var _0x499b8d={},_0x441507={},_0x1ff39f={'count':0x0,'rows':[]};var _0x3c0696=_[_0x4646('0x2c')](db[_0x4646('0x2d')][_0x4646('0x2e')],function(_0x4a0d32){return{'name':_0x4a0d32[_0x4646('0x2f')],'type':_0x4a0d32['type']['key']};});_0x441507[_0x4646('0x30')]=_['map'](_0x3c0696,_0x4646('0x29'));_0x441507[_0x4646('0x31')]=_['keys'](_0x9b3350[_0x4646('0x31')]);_0x441507[_0x4646('0x32')]=_[_0x4646('0x33')](_0x441507[_0x4646('0x30')],_0x441507[_0x4646('0x31')]);_0x499b8d[_0x4646('0x34')]=_['intersection'](_0x441507['model'],qs[_0x4646('0x35')](_0x9b3350['query'][_0x4646('0x35')]));_0x499b8d['attributes']=_0x499b8d[_0x4646('0x34')][_0x4646('0x36')]?_0x499b8d[_0x4646('0x34')]:_0x441507[_0x4646('0x30')];if(!_0x9b3350[_0x4646('0x31')][_0x4646('0x37')]('nolimit')){_0x499b8d[_0x4646('0x1e')]=qs[_0x4646('0x1e')](_0x9b3350[_0x4646('0x31')]['limit']);_0x499b8d[_0x4646('0x1c')]=qs[_0x4646('0x1c')](_0x9b3350[_0x4646('0x31')][_0x4646('0x1c')]);}_0x499b8d[_0x4646('0x38')]=qs[_0x4646('0x39')](_0x9b3350['query'][_0x4646('0x39')]);_0x499b8d[_0x4646('0x3a')]=qs['filters'](_['pick'](_0x9b3350[_0x4646('0x31')],_0x441507['filters']),_0x3c0696);if(_0x9b3350[_0x4646('0x31')]['filter']){_0x499b8d[_0x4646('0x3a')]=_[_0x4646('0x3b')](_0x499b8d[_0x4646('0x3a')],{'$or':_[_0x4646('0x2c')](_0x3c0696,function(_0x559d30){if(_0x559d30[_0x4646('0x3c')]!==_0x4646('0x3d')){var _0x407f6c={};_0x407f6c[_0x559d30[_0x4646('0x29')]]={'$like':'%'+_0x9b3350['query'][_0x4646('0x3e')]+'%'};return _0x407f6c;}})});}_0x499b8d=_['merge']({},_0x499b8d,_0x9b3350[_0x4646('0x3f')]);var _0x3aa044={'where':_0x499b8d[_0x4646('0x3a')]};return db[_0x4646('0x2d')][_0x4646('0x1f')](_0x3aa044)[_0x4646('0x25')](function(_0x240ac2){_0x1ff39f[_0x4646('0x1f')]=_0x240ac2;if(_0x9b3350['query'][_0x4646('0x40')]){_0x499b8d[_0x4646('0x41')]=[{'all':!![]}];}return db[_0x4646('0x2d')][_0x4646('0x42')](_0x499b8d);})[_0x4646('0x25')](function(_0x3d9c05){_0x1ff39f['rows']=_0x3d9c05;return _0x1ff39f;})[_0x4646('0x25')](respondWithFilteredResult(_0x3d9335,_0x499b8d))[_0x4646('0x43')](handleError(_0x3d9335,null));};exports[_0x4646('0x44')]=function(_0x54ff6b,_0x1bc1d6){var _0x35f63e={'raw':!![],'where':{'id':_0x54ff6b[_0x4646('0x45')]['id']}},_0xff196f={};_0xff196f[_0x4646('0x30')]=_[_0x4646('0x46')](db[_0x4646('0x2d')][_0x4646('0x2e')]);_0xff196f[_0x4646('0x31')]=_[_0x4646('0x46')](_0x54ff6b[_0x4646('0x31')]);_0xff196f[_0x4646('0x32')]=_[_0x4646('0x33')](_0xff196f[_0x4646('0x30')],_0xff196f[_0x4646('0x31')]);_0x35f63e[_0x4646('0x34')]=_[_0x4646('0x33')](_0xff196f[_0x4646('0x30')],qs[_0x4646('0x35')](_0x54ff6b[_0x4646('0x31')][_0x4646('0x35')]));_0x35f63e[_0x4646('0x34')]=_0x35f63e['attributes']['length']?_0x35f63e['attributes']:_0xff196f[_0x4646('0x30')];if(_0x54ff6b[_0x4646('0x31')][_0x4646('0x40')]){_0x35f63e[_0x4646('0x41')]=[{'all':!![]}];}_0x35f63e=_[_0x4646('0x3b')]({},_0x35f63e,_0x54ff6b[_0x4646('0x3f')]);return db[_0x4646('0x2d')][_0x4646('0x47')](_0x35f63e)[_0x4646('0x25')](handleEntityNotFound(_0x1bc1d6,null))['then'](respondWithResult(_0x1bc1d6,null))[_0x4646('0x43')](handleError(_0x1bc1d6,null));};exports[_0x4646('0x48')]=function(_0x12c71c,_0x6012f4){return db[_0x4646('0x2d')]['create'](_0x12c71c[_0x4646('0x49')],{})[_0x4646('0x25')](function(_0x144313){var _0x21087e=_0x12c71c[_0x4646('0x4a')][_0x4646('0x26')]({'plain':!![]});if(!_0x21087e)throw new Error(_0x4646('0x4b'));if(_0x21087e[_0x4646('0x4c')]==='user'){var _0x4678df=_0x144313[_0x4646('0x26')]({'plain':!![]});var _0x5ad3b0='CmContactHasItems';return db[_0x4646('0x4d')][_0x4646('0x47')]({'where':{'name':_0x5ad3b0,'userProfileId':_0x21087e[_0x4646('0x4e')]},'raw':!![]})[_0x4646('0x25')](function(_0x36fbed){if(_0x36fbed&&_0x36fbed[_0x4646('0x4f')]===0x0){return db['UserProfileResource'][_0x4646('0x48')]({'name':_0x4678df[_0x4646('0x29')],'resourceId':_0x4678df['id'],'type':_0x36fbed[_0x4646('0x29')],'sectionId':_0x36fbed['id']},{})[_0x4646('0x25')](function(){return _0x144313;});}else{return _0x144313;}})[_0x4646('0x43')](function(_0x373358){logger[_0x4646('0x27')](_0x4646('0x50'),_0x373358);throw _0x373358;});}return _0x144313;})[_0x4646('0x25')](respondWithResult(_0x6012f4,0xc9))[_0x4646('0x43')](handleError(_0x6012f4,null));};exports[_0x4646('0x24')]=function(_0x524e9a,_0x52b88b){if(_0x524e9a['body']['id']){delete _0x524e9a[_0x4646('0x49')]['id'];}return db[_0x4646('0x2d')]['find']({'where':{'id':_0x524e9a[_0x4646('0x45')]['id']}})[_0x4646('0x25')](handleEntityNotFound(_0x52b88b,null))[_0x4646('0x25')](saveUpdates(_0x524e9a['body'],null))[_0x4646('0x25')](respondWithResult(_0x52b88b,null))[_0x4646('0x43')](handleError(_0x52b88b,null));};exports[_0x4646('0x51')]=function(_0x1ecdd0,_0x4b2ac3){return db[_0x4646('0x2d')][_0x4646('0x47')]({'where':{'id':_0x1ecdd0['params']['id']}})[_0x4646('0x25')](handleEntityNotFound(_0x4b2ac3,null))['then'](removeEntity(_0x4b2ac3,null))['catch'](handleError(_0x4b2ac3,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index 4631687..d9bd125 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.model.js +++ b/server/api/cmContactHasItem/cmContactHasItem.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4147=['../../config/logger','api','moment','request-promise','path','../../config/environment','./cmContactHasItem.attributes','exports','define','CmContactHasItem','cm_contact_has_items','lodash','util'];(function(_0x39e2b1,_0x2d89c7){var _0x20672c=function(_0xcbcbcf){while(--_0xcbcbcf){_0x39e2b1['push'](_0x39e2b1['shift']());}};_0x20672c(++_0x2d89c7);}(_0x4147,0x1b8));var _0x7414=function(_0xc5c2e2,_0x246901){_0xc5c2e2=_0xc5c2e2-0x0;var _0x2ad80b=_0x4147[_0xc5c2e2];return _0x2ad80b;};'use strict';var _=require(_0x7414('0x0'));var util=require(_0x7414('0x1'));var logger=require(_0x7414('0x2'))(_0x7414('0x3'));var moment=require(_0x7414('0x4'));var BPromise=require('bluebird');var rp=require(_0x7414('0x5'));var fs=require('fs');var path=require(_0x7414('0x6'));var rimraf=require('rimraf');var config=require(_0x7414('0x7'));var attributes=require(_0x7414('0x8'));module[_0x7414('0x9')]=function(_0x3216af,_0xf46e64){return _0x3216af[_0x7414('0xa')](_0x7414('0xb'),attributes,{'tableName':_0x7414('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcea9=['bluebird','request-promise','path','rimraf','../../config/environment','./cmContactHasItem.attributes','exports','define','CmContactHasItem','cm_contact_has_items','lodash','util','../../config/logger','moment'];(function(_0x370723,_0x179030){var _0x4f82bb=function(_0x49f0ee){while(--_0x49f0ee){_0x370723['push'](_0x370723['shift']());}};_0x4f82bb(++_0x179030);}(_0xcea9,0x1bc));var _0x9cea=function(_0x2ee6fd,_0x256f22){_0x2ee6fd=_0x2ee6fd-0x0;var _0x2e9b8d=_0xcea9[_0x2ee6fd];return _0x2e9b8d;};'use strict';var _=require(_0x9cea('0x0'));var util=require(_0x9cea('0x1'));var logger=require(_0x9cea('0x2'))('api');var moment=require(_0x9cea('0x3'));var BPromise=require(_0x9cea('0x4'));var rp=require(_0x9cea('0x5'));var fs=require('fs');var path=require(_0x9cea('0x6'));var rimraf=require(_0x9cea('0x7'));var config=require(_0x9cea('0x8'));var attributes=require(_0x9cea('0x9'));module[_0x9cea('0xa')]=function(_0x5d963b,_0x1befc9){return _0x5d963b[_0x9cea('0xb')](_0x9cea('0xc'),attributes,{'tableName':_0x9cea('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.rpc.js b/server/api/cmContactHasItem/cmContactHasItem.rpc.js index 81157bc..dea8850 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.rpc.js +++ b/server/api/cmContactHasItem/cmContactHasItem.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1508=['catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','CmContactHasItem,\x20%s,\x20%s','request\x20sent','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','stringify','error','message','info'];(function(_0x5b75ec,_0x2fe2ff){var _0x76ce6f=function(_0x303437){while(--_0x303437){_0x5b75ec['push'](_0x5b75ec['shift']());}};_0x76ce6f(++_0x2fe2ff);}(_0x1508,0xb1));var _0x8150=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x1508[_0x1facfa];return _0x9ec701;};'use strict';var _=require('lodash');var util=require(_0x8150('0x0'));var moment=require(_0x8150('0x1'));var BPromise=require(_0x8150('0x2'));var rs=require(_0x8150('0x3'));var fs=require('fs');var Redis=require(_0x8150('0x4'));var db=require(_0x8150('0x5'))['db'];var utils=require(_0x8150('0x6'));var logger=require(_0x8150('0x7'))(_0x8150('0x8'));var config=require('../../config/environment');var jayson=require(_0x8150('0x9'));var client=jayson[_0x8150('0xa')][_0x8150('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3b8fe2,_0x752fb5,_0x3c75fa){return new BPromise(function(_0x1b801f,_0x56c0d9){return client['request'](_0x3b8fe2,_0x3c75fa)[_0x8150('0xc')](function(_0x521052){logger['info'](_0x8150('0xd'),_0x752fb5,_0x8150('0xe'));logger[_0x8150('0xf')](_0x8150('0x10'),_0x752fb5,'request\x20sent',JSON[_0x8150('0x11')](_0x521052));if(_0x521052[_0x8150('0x12')]){if(_0x521052['error']['code']===0x1f4){logger[_0x8150('0x12')]('CmContactHasItem,\x20%s,\x20%s',_0x752fb5,_0x521052['error'][_0x8150('0x13')]);return _0x56c0d9(_0x521052[_0x8150('0x12')][_0x8150('0x13')]);}logger[_0x8150('0x12')](_0x8150('0xd'),_0x752fb5,_0x521052[_0x8150('0x12')][_0x8150('0x13')]);return _0x1b801f(_0x521052['error']['message']);}else{logger[_0x8150('0x14')](_0x8150('0xd'),_0x752fb5,'request\x20sent');_0x1b801f(_0x521052['result'][_0x8150('0x13')]);}})[_0x8150('0x15')](function(_0x2643a5){logger[_0x8150('0x12')]('CmContactHasItem,\x20%s,\x20%s',_0x752fb5,_0x2643a5);_0x56c0d9(_0x2643a5);});});} \ No newline at end of file +var _0xebf2=['CmContactHasItem,\x20%s,\x20%s','CmContactHasItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then'];(function(_0x3102af,_0x137b65){var _0x3c208c=function(_0x5d88ee){while(--_0x5d88ee){_0x3102af['push'](_0x3102af['shift']());}};_0x3c208c(++_0x137b65);}(_0xebf2,0x12f));var _0x2ebf=function(_0x258acd,_0x1703a7){_0x258acd=_0x258acd-0x0;var _0x3bc534=_0xebf2[_0x258acd];return _0x3bc534;};'use strict';var _=require(_0x2ebf('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x2ebf('0x1'));var rs=require(_0x2ebf('0x2'));var fs=require('fs');var Redis=require(_0x2ebf('0x3'));var db=require(_0x2ebf('0x4'))['db'];var utils=require(_0x2ebf('0x5'));var logger=require(_0x2ebf('0x6'))(_0x2ebf('0x7'));var config=require(_0x2ebf('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x2ebf('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x194bc6,_0x1255e7,_0x196e71){return new BPromise(function(_0x3736b2,_0x3e4604){return client[_0x2ebf('0xa')](_0x194bc6,_0x196e71)[_0x2ebf('0xb')](function(_0x436545){logger['info'](_0x2ebf('0xc'),_0x1255e7,'request\x20sent');logger['debug'](_0x2ebf('0xd'),_0x1255e7,'request\x20sent',JSON[_0x2ebf('0xe')](_0x436545));if(_0x436545[_0x2ebf('0xf')]){if(_0x436545['error'][_0x2ebf('0x10')]===0x1f4){logger[_0x2ebf('0xf')](_0x2ebf('0xc'),_0x1255e7,_0x436545[_0x2ebf('0xf')][_0x2ebf('0x11')]);return _0x3e4604(_0x436545[_0x2ebf('0xf')][_0x2ebf('0x11')]);}logger[_0x2ebf('0xf')]('CmContactHasItem,\x20%s,\x20%s',_0x1255e7,_0x436545[_0x2ebf('0xf')]['message']);return _0x3736b2(_0x436545[_0x2ebf('0xf')][_0x2ebf('0x11')]);}else{logger[_0x2ebf('0x12')](_0x2ebf('0xc'),_0x1255e7,_0x2ebf('0x13'));_0x3736b2(_0x436545['result'][_0x2ebf('0x11')]);}})[_0x2ebf('0x14')](function(_0x1c2c1e){logger[_0x2ebf('0xf')](_0x2ebf('0xc'),_0x1255e7,_0x1c2c1e);_0x3e4604(_0x1c2c1e);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index 822a881..c3e12f7 100644 --- a/server/api/cmContactHasItem/index.js +++ b/server/api/cmContactHasItem/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2560=['put','update','destroy','exports','multer','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContactHasItem.controller','get','/:id','isAuthenticated','post','create'];(function(_0x380168,_0x40546c){var _0x12e86d=function(_0x559ef7){while(--_0x559ef7){_0x380168['push'](_0x380168['shift']());}};_0x12e86d(++_0x40546c);}(_0x2560,0x104));var _0x0256=function(_0x250849,_0x2c8dc){_0x250849=_0x250849-0x0;var _0xf9a38c=_0x2560[_0x250849];return _0xf9a38c;};'use strict';var multer=require(_0x0256('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x0256('0x1'));var router=express[_0x0256('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x0256('0x3'));var interaction=require(_0x0256('0x4'));var config=require(_0x0256('0x5'));var controller=require(_0x0256('0x6'));router[_0x0256('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x0256('0x7')](_0x0256('0x8'),auth[_0x0256('0x9')](),controller['show']);router[_0x0256('0xa')]('/',auth[_0x0256('0x9')](),controller[_0x0256('0xb')]);router[_0x0256('0xc')](_0x0256('0x8'),auth[_0x0256('0x9')](),controller[_0x0256('0xd')]);router['delete'](_0x0256('0x8'),auth[_0x0256('0x9')](),controller[_0x0256('0xe')]);module[_0x0256('0xf')]=router; \ No newline at end of file +var _0x9d1f=['./cmContactHasItem.controller','isAuthenticated','index','/:id','show','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x5ecaab,_0x2f3053){var _0x3db1a8=function(_0x48df9f){while(--_0x48df9f){_0x5ecaab['push'](_0x5ecaab['shift']());}};_0x3db1a8(++_0x2f3053);}(_0x9d1f,0x1a9));var _0xf9d1=function(_0x99ff94,_0x47a1b1){_0x99ff94=_0x99ff94-0x0;var _0x1b5bc0=_0x9d1f[_0x99ff94];return _0x1b5bc0;};'use strict';var multer=require(_0xf9d1('0x0'));var util=require('util');var path=require(_0xf9d1('0x1'));var timeout=require(_0xf9d1('0x2'));var express=require(_0xf9d1('0x3'));var router=express['Router']();var fs_extra=require(_0xf9d1('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xf9d1('0x5'));var config=require(_0xf9d1('0x6'));var controller=require(_0xf9d1('0x7'));router['get']('/',auth[_0xf9d1('0x8')](),controller[_0xf9d1('0x9')]);router['get'](_0xf9d1('0xa'),auth[_0xf9d1('0x8')](),controller[_0xf9d1('0xb')]);router['post']('/',auth[_0xf9d1('0x8')](),controller[_0xf9d1('0xc')]);router[_0xf9d1('0xd')]('/:id',auth['isAuthenticated'](),controller[_0xf9d1('0xe')]);router[_0xf9d1('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xf9d1('0x10')]);module[_0xf9d1('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index 5063f9c..28e00d9 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 _0xf158=['name','type','select','parse','values','stringify','BOOLEAN','voice','sequelize','lodash','exports','VIRTUAL','getDataValue','alias','STRING','setDataValue'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf158,0x1e8));var _0x8f15=function(_0x36f4d5,_0xabd719){_0x36f4d5=_0x36f4d5-0x0;var _0x4bb87d=_0xf158[_0x36f4d5];return _0x4bb87d;};'use strict';var Sequelize=require(_0x8f15('0x0'));var _=require(_0x8f15('0x1'));module[_0x8f15('0x2')]={'name':{'type':Sequelize[_0x8f15('0x3')],'get':function(_0x112a4e){return this[_0x8f15('0x4')](_0x8f15('0x5'));}},'alias':{'type':Sequelize[_0x8f15('0x6')],'allowNull':![],'set':function(_0x142354){this[_0x8f15('0x7')](_0x8f15('0x5'),_0x142354?_0x142354:this['getDataValue'](_0x8f15('0x8')));}},'type':{'type':Sequelize[_0x8f15('0x6')],'allowNull':![]},'values':{'type':Sequelize['TEXT']('long'),'get':function(){if(this['getDataValue'](_0x8f15('0x9'))===_0x8f15('0xa')){return JSON[_0x8f15('0xb')](this[_0x8f15('0x4')]('values'));}else{return this[_0x8f15('0x4')](_0x8f15('0xc'));}},'set':function(_0x34dc17){if(Array['isArray'](_0x34dc17)){this[_0x8f15('0x7')](_0x8f15('0xc'),JSON[_0x8f15('0xd')](_0x34dc17));}else{this[_0x8f15('0x7')](_0x8f15('0xc'),_0x34dc17);}}},'required':{'type':Sequelize[_0x8f15('0xe')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x8f15('0xe')],'defaultValue':![]},'actionType':{'type':Sequelize['ENUM'](_0x8f15('0xf'))}}; \ No newline at end of file +var _0x36b3=['parse','values','stringify','BOOLEAN','ENUM','lodash','exports','VIRTUAL','getDataValue','alias','STRING','setDataValue','name','TEXT','long','select'];(function(_0x2ce828,_0xd4d658){var _0x167434=function(_0x50e798){while(--_0x50e798){_0x2ce828['push'](_0x2ce828['shift']());}};_0x167434(++_0xd4d658);}(_0x36b3,0x65));var _0x336b=function(_0x182179,_0x349b67){_0x182179=_0x182179-0x0;var _0x2870ae=_0x36b3[_0x182179];return _0x2870ae;};'use strict';var Sequelize=require('sequelize');var _=require(_0x336b('0x0'));module[_0x336b('0x1')]={'name':{'type':Sequelize[_0x336b('0x2')],'get':function(_0x437ed0){return this[_0x336b('0x3')](_0x336b('0x4'));}},'alias':{'type':Sequelize[_0x336b('0x5')],'allowNull':![],'set':function(_0x59ffc6){this[_0x336b('0x6')](_0x336b('0x4'),_0x59ffc6?_0x59ffc6:this[_0x336b('0x3')](_0x336b('0x7')));}},'type':{'type':Sequelize[_0x336b('0x5')],'allowNull':![]},'values':{'type':Sequelize[_0x336b('0x8')](_0x336b('0x9')),'get':function(){if(this['getDataValue']('type')===_0x336b('0xa')){return JSON[_0x336b('0xb')](this[_0x336b('0x3')]('values'));}else{return this['getDataValue']('values');}},'set':function(_0x266f88){if(Array['isArray'](_0x266f88)){this[_0x336b('0x6')](_0x336b('0xc'),JSON[_0x336b('0xd')](_0x266f88));}else{this[_0x336b('0x6')](_0x336b('0xc'),_0x266f88);}}},'required':{'type':Sequelize[_0x336b('0xe')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x336b('0xe')],'defaultValue':![]},'actionType':{'type':Sequelize[_0x336b('0xf')]('voice')}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index cff96cf..ceca200 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 _0x361a=['fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','reject','save','destroy','then','error','stack','send','map','CmCustomField','fieldName','type','key','model','differenceBy','name','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','include','findAll','catch','show','params','rawAttributes','find','body','create','sequelize','transaction','Sequelize','TEXT','number','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','addColumn','cm_contacts','cf_%d','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs'];(function(_0x98197,_0xea7356){var _0x5d9199=function(_0x135375){while(--_0x135375){_0x98197['push'](_0x98197['shift']());}};_0x5d9199(++_0xea7356);}(_0x361a,0x102));var _0xa361=function(_0xb1235c,_0x20af79){_0xb1235c=_0xb1235c-0x0;var _0x236917=_0x361a[_0xb1235c];return _0x236917;};'use strict';var emlformat=require(_0xa361('0x0'));var rimraf=require(_0xa361('0x1'));var zipdir=require(_0xa361('0x2'));var jsonpatch=require(_0xa361('0x3'));var rp=require('request-promise');var moment=require(_0xa361('0x4'));var BPromise=require(_0xa361('0x5'));var Mustache=require(_0xa361('0x6'));var util=require(_0xa361('0x7'));var path=require(_0xa361('0x8'));var sox=require(_0xa361('0x9'));var csv=require(_0xa361('0xa'));var ejs=require(_0xa361('0xb'));var fs=require('fs');var fs_extra=require(_0xa361('0xc'));var _=require('lodash');var squel=require(_0xa361('0xd'));var crypto=require(_0xa361('0xe'));var jsforce=require(_0xa361('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xa361('0xa'));var querystring=require(_0xa361('0x10'));var Papa=require(_0xa361('0x11'));var Redis=require(_0xa361('0x12'));var authService=require(_0xa361('0x13'));var qs=require(_0xa361('0x14'));var as=require(_0xa361('0x15'));var hardwareService=require(_0xa361('0x16'));var logger=require('../../config/logger')(_0xa361('0x17'));var utils=require(_0xa361('0x18'));var config=require(_0xa361('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xa361('0x1a'))['db'];function respondWithStatusCode(_0x2e1428,_0x2d4a55){_0x2d4a55=_0x2d4a55||0xcc;return function(_0x7a028b){if(_0x7a028b){return _0x2e1428[_0xa361('0x1b')](_0x2d4a55);}return _0x2e1428[_0xa361('0x1c')](_0x2d4a55)[_0xa361('0x1d')]();};}function respondWithResult(_0x11fcb7,_0x49ab7a){_0x49ab7a=_0x49ab7a||0xc8;return function(_0x11166e){if(_0x11166e){return _0x11fcb7['status'](_0x49ab7a)[_0xa361('0x1e')](_0x11166e);}};}function respondWithFilteredResult(_0x502c3d,_0x26f7e6){return function(_0x17fbc4){if(_0x17fbc4){var _0x293f14=typeof _0x26f7e6[_0xa361('0x1f')]==='undefined'&&typeof _0x26f7e6[_0xa361('0x20')]===_0xa361('0x21');var _0x5ef3fc=_0x17fbc4[_0xa361('0x22')];var _0x432faa=_0x293f14?0x0:_0x26f7e6[_0xa361('0x1f')];var _0x3989a7=_0x293f14?_0x17fbc4[_0xa361('0x22')]:_0x26f7e6[_0xa361('0x1f')]+_0x26f7e6[_0xa361('0x20')];var _0x204884;if(_0x3989a7>=_0x5ef3fc){_0x3989a7=_0x5ef3fc;_0x204884=0xc8;}else{_0x204884=0xce;}_0x502c3d[_0xa361('0x1c')](_0x204884);return _0x502c3d[_0xa361('0x23')]('Content-Range',_0x432faa+'-'+_0x3989a7+'/'+_0x5ef3fc)['json'](_0x17fbc4);}return null;};}function patchUpdates(_0x566e82){return function(_0x258a3d){try{jsonpatch[_0xa361('0x24')](_0x258a3d,_0x566e82,!![]);}catch(_0x35c9a4){return BPromise[_0xa361('0x25')](_0x35c9a4);}return _0x258a3d[_0xa361('0x26')]();};}function saveUpdates(_0x1daf54,_0x174b4f){return function(_0x466520){if(_0x466520){return _0x466520['update'](_0x1daf54)['then'](function(_0x3b41e0){return _0x3b41e0;});}return null;};}function removeEntity(_0x2dfc9e,_0x3ef3b2){return function(_0x1a98d3){if(_0x1a98d3){return _0x1a98d3[_0xa361('0x27')]()[_0xa361('0x28')](function(){_0x2dfc9e['status'](0xcc)[_0xa361('0x1d')]();});}};}function handleEntityNotFound(_0x112ae5,_0x4c6421){return function(_0x3bef86){if(!_0x3bef86){_0x112ae5[_0xa361('0x1b')](0x194);}return _0x3bef86;};}function handleError(_0x17b803,_0x37c825){_0x37c825=_0x37c825||0x1f4;return function(_0x3a2e21){logger[_0xa361('0x29')](_0x3a2e21[_0xa361('0x2a')]);if(_0x3a2e21['name']){delete _0x3a2e21['name'];}_0x17b803[_0xa361('0x1c')](_0x37c825)[_0xa361('0x2b')](_0x3a2e21);};}exports['index']=function(_0x239845,_0x32db6b){var _0xe0ee9e={},_0x28fcb2={},_0x2154c9={'count':0x0,'rows':[]};var _0x47ca65=_[_0xa361('0x2c')](db[_0xa361('0x2d')]['rawAttributes'],function(_0x3f3f48){return{'name':_0x3f3f48[_0xa361('0x2e')],'type':_0x3f3f48[_0xa361('0x2f')][_0xa361('0x30')]};});_0x28fcb2[_0xa361('0x31')]=_[_0xa361('0x32')](_['map'](_0x47ca65,_0xa361('0x33')),[_0xa361('0x33')]);_0x28fcb2['query']=_[_0xa361('0x34')](_0x239845[_0xa361('0x35')]);_0x28fcb2[_0xa361('0x36')]=_[_0xa361('0x37')](_0x28fcb2[_0xa361('0x31')],_0x28fcb2[_0xa361('0x35')]);_0xe0ee9e['attributes']=_[_0xa361('0x37')](_0x28fcb2['model'],qs[_0xa361('0x38')](_0x239845[_0xa361('0x35')]['fields']));_0xe0ee9e[_0xa361('0x39')]=_0xe0ee9e[_0xa361('0x39')][_0xa361('0x3a')]?_0xe0ee9e[_0xa361('0x39')]:_0x28fcb2[_0xa361('0x31')];if(!_0x239845[_0xa361('0x35')][_0xa361('0x3b')](_0xa361('0x3c'))){_0xe0ee9e[_0xa361('0x20')]=qs[_0xa361('0x20')](_0x239845[_0xa361('0x35')][_0xa361('0x20')]);_0xe0ee9e[_0xa361('0x1f')]=qs[_0xa361('0x1f')](_0x239845[_0xa361('0x35')][_0xa361('0x1f')]);}_0xe0ee9e[_0xa361('0x3d')]=qs[_0xa361('0x3e')](_0x239845[_0xa361('0x35')]['sort']);_0xe0ee9e[_0xa361('0x3f')]=qs[_0xa361('0x36')](_['pick'](_0x239845[_0xa361('0x35')],_0x28fcb2[_0xa361('0x36')]),_0x47ca65);if(_0x239845[_0xa361('0x35')][_0xa361('0x40')]){_0xe0ee9e['where']=_[_0xa361('0x41')](_0xe0ee9e[_0xa361('0x3f')],{'$or':_[_0xa361('0x2c')](_0x47ca65,function(_0x30037c){if(_0x30037c[_0xa361('0x2f')]!=='VIRTUAL'){var _0x5df5d5={};_0x5df5d5[_0x30037c[_0xa361('0x33')]]={'$like':'%'+_0x239845[_0xa361('0x35')][_0xa361('0x40')]+'%'};return _0x5df5d5;}})});}_0xe0ee9e=_[_0xa361('0x41')]({},_0xe0ee9e,_0x239845[_0xa361('0x42')]);var _0x3f0328={'where':_0xe0ee9e[_0xa361('0x3f')]};return db[_0xa361('0x2d')][_0xa361('0x22')](_0x3f0328)[_0xa361('0x28')](function(_0x56157a){_0x2154c9['count']=_0x56157a;if(_0x239845['query'][_0xa361('0x43')]){_0xe0ee9e[_0xa361('0x44')]=[{'all':!![]}];}return db['CmCustomField'][_0xa361('0x45')](_0xe0ee9e);})['then'](function(_0x27ddbd){_0x2154c9['rows']=_0x27ddbd;return _0x2154c9;})['then'](respondWithFilteredResult(_0x32db6b,_0xe0ee9e))[_0xa361('0x46')](handleError(_0x32db6b,null));};exports[_0xa361('0x47')]=function(_0x4b26af,_0xa462f9){var _0x4db2cc={'raw':!![],'where':{'id':_0x4b26af[_0xa361('0x48')]['id']}},_0x3141d6={};_0x3141d6['model']=_[_0xa361('0x34')](db[_0xa361('0x2d')][_0xa361('0x49')]);_0x3141d6[_0xa361('0x35')]=_[_0xa361('0x34')](_0x4b26af[_0xa361('0x35')]);_0x3141d6[_0xa361('0x36')]=_[_0xa361('0x37')](_0x3141d6[_0xa361('0x31')],_0x3141d6[_0xa361('0x35')]);_0x4db2cc[_0xa361('0x39')]=_[_0xa361('0x37')](_0x3141d6[_0xa361('0x31')],qs['fields'](_0x4b26af[_0xa361('0x35')][_0xa361('0x38')]));_0x4db2cc['attributes']=_0x4db2cc[_0xa361('0x39')][_0xa361('0x3a')]?_0x4db2cc[_0xa361('0x39')]:_0x3141d6['model'];if(_0x4b26af['query'][_0xa361('0x43')]){_0x4db2cc[_0xa361('0x44')]=[{'all':!![]}];}_0x4db2cc=_[_0xa361('0x41')]({},_0x4db2cc,_0x4b26af[_0xa361('0x42')]);return db[_0xa361('0x2d')][_0xa361('0x4a')](_0x4db2cc)['then'](handleEntityNotFound(_0xa462f9,null))[_0xa361('0x28')](respondWithResult(_0xa462f9,null))[_0xa361('0x46')](handleError(_0xa462f9,null));};exports['update']=function(_0x333c3d,_0x18c6c5){if(_0x333c3d[_0xa361('0x4b')]['id']){delete _0x333c3d[_0xa361('0x4b')]['id'];}return db[_0xa361('0x2d')][_0xa361('0x4a')]({'where':{'id':_0x333c3d[_0xa361('0x48')]['id']}})[_0xa361('0x28')](handleEntityNotFound(_0x18c6c5,null))[_0xa361('0x28')](saveUpdates(_0x333c3d[_0xa361('0x4b')],null))['then'](respondWithResult(_0x18c6c5,null))[_0xa361('0x46')](handleError(_0x18c6c5,null));};exports[_0xa361('0x27')]=function(_0x2538c1,_0x1b90be){return db[_0xa361('0x2d')][_0xa361('0x4a')]({'where':{'id':_0x2538c1[_0xa361('0x48')]['id']}})[_0xa361('0x28')](handleEntityNotFound(_0x1b90be,null))[_0xa361('0x28')](removeEntity(_0x1b90be,null))[_0xa361('0x46')](handleError(_0x1b90be,null));};exports[_0xa361('0x4c')]=function(_0x1e3a31,_0x236756){var _0x266e0f;return db[_0xa361('0x4d')][_0xa361('0x4e')](function(_0x5265fc){return db[_0xa361('0x2d')][_0xa361('0x4c')](_0x1e3a31[_0xa361('0x4b')],{'transaction':_0x5265fc})[_0xa361('0x28')](function(_0x231f85){_0x266e0f=_0x231f85;var _0xa86724={'type':db[_0xa361('0x4f')][_0xa361('0x50')],'transaction':_0x5265fc};switch(_0x1e3a31[_0xa361('0x4b')][_0xa361('0x2f')]){case'text':_0xa86724['type']=db[_0xa361('0x4f')][_0xa361('0x50')];break;case _0xa361('0x51'):_0xa86724[_0xa361('0x2f')]=db[_0xa361('0x4f')][_0xa361('0x52')];break;case _0xa361('0x53'):_0xa86724['type']=db['Sequelize'][_0xa361('0x54')];_0xa86724[_0xa361('0x55')]=![];break;default:}return db[_0xa361('0x4d')][_0xa361('0x56')][_0xa361('0x57')](_0xa361('0x58'),util['format'](_0xa361('0x59'),_0x266e0f['id']),_0xa86724);})[_0xa361('0x28')](function(){return _0x266e0f;});})['then'](respondWithResult(_0x236756,0xc9))[_0xa361('0x46')](handleError(_0x236756,null));}; \ No newline at end of file +var _0x31dc=['../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','end','status','undefined','count','offset','limit','set','Content-Range','json','reject','save','update','then','destroy','sendStatus','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','CmCustomField','findAll','rows','catch','show','params','body','find','create','transaction','Sequelize','TEXT','text','INTEGER','switch','BOOLEAN','sequelize','addColumn','cm_contacts','format','cf_%d','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x54cd49,_0x4db590){var _0x43e8cf=function(_0x5ee9a3){while(--_0x5ee9a3){_0x54cd49['push'](_0x54cd49['shift']());}};_0x43e8cf(++_0x4db590);}(_0x31dc,0x1ab));var _0xc31d=function(_0x37f36a,_0x2833dd){_0x37f36a=_0x37f36a-0x0;var _0x477e04=_0x31dc[_0x37f36a];return _0x477e04;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc31d('0x0'));var zipdir=require(_0xc31d('0x1'));var jsonpatch=require(_0xc31d('0x2'));var rp=require(_0xc31d('0x3'));var moment=require(_0xc31d('0x4'));var BPromise=require(_0xc31d('0x5'));var Mustache=require(_0xc31d('0x6'));var util=require(_0xc31d('0x7'));var path=require(_0xc31d('0x8'));var sox=require(_0xc31d('0x9'));var csv=require(_0xc31d('0xa'));var ejs=require(_0xc31d('0xb'));var fs=require('fs');var fs_extra=require(_0xc31d('0xc'));var _=require(_0xc31d('0xd'));var squel=require(_0xc31d('0xe'));var crypto=require('crypto');var jsforce=require(_0xc31d('0xf'));var deskjs=require(_0xc31d('0x10'));var toCsv=require(_0xc31d('0xa'));var querystring=require(_0xc31d('0x11'));var Papa=require(_0xc31d('0x12'));var Redis=require(_0xc31d('0x13'));var authService=require(_0xc31d('0x14'));var qs=require(_0xc31d('0x15'));var as=require(_0xc31d('0x16'));var hardwareService=require(_0xc31d('0x17'));var logger=require(_0xc31d('0x18'))(_0xc31d('0x19'));var utils=require('../../config/utils');var config=require(_0xc31d('0x1a'));var licenseUtil=require(_0xc31d('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4c31a7,_0x34a0b0){_0x34a0b0=_0x34a0b0||0xcc;return function(_0x16c6be){if(_0x16c6be){return _0x4c31a7['sendStatus'](_0x34a0b0);}return _0x4c31a7['status'](_0x34a0b0)[_0xc31d('0x1c')]();};}function respondWithResult(_0x4b3958,_0x2c2132){_0x2c2132=_0x2c2132||0xc8;return function(_0x16c6c0){if(_0x16c6c0){return _0x4b3958[_0xc31d('0x1d')](_0x2c2132)['json'](_0x16c6c0);}};}function respondWithFilteredResult(_0x5c49e6,_0x28001b){return function(_0xb040ff){if(_0xb040ff){var _0x525c67=typeof _0x28001b['offset']===_0xc31d('0x1e')&&typeof _0x28001b['limit']===_0xc31d('0x1e');var _0x451715=_0xb040ff[_0xc31d('0x1f')];var _0xbb4d50=_0x525c67?0x0:_0x28001b[_0xc31d('0x20')];var _0x44e05b=_0x525c67?_0xb040ff[_0xc31d('0x1f')]:_0x28001b[_0xc31d('0x20')]+_0x28001b[_0xc31d('0x21')];var _0x2112c9;if(_0x44e05b>=_0x451715){_0x44e05b=_0x451715;_0x2112c9=0xc8;}else{_0x2112c9=0xce;}_0x5c49e6[_0xc31d('0x1d')](_0x2112c9);return _0x5c49e6[_0xc31d('0x22')](_0xc31d('0x23'),_0xbb4d50+'-'+_0x44e05b+'/'+_0x451715)[_0xc31d('0x24')](_0xb040ff);}return null;};}function patchUpdates(_0x193b5e){return function(_0x20b793){try{jsonpatch['apply'](_0x20b793,_0x193b5e,!![]);}catch(_0x291e44){return BPromise[_0xc31d('0x25')](_0x291e44);}return _0x20b793[_0xc31d('0x26')]();};}function saveUpdates(_0x4eaba6,_0x49df1a){return function(_0x114a27){if(_0x114a27){return _0x114a27[_0xc31d('0x27')](_0x4eaba6)[_0xc31d('0x28')](function(_0xef6e21){return _0xef6e21;});}return null;};}function removeEntity(_0x4bffe3,_0x56cca5){return function(_0x38bce1){if(_0x38bce1){return _0x38bce1[_0xc31d('0x29')]()[_0xc31d('0x28')](function(){_0x4bffe3[_0xc31d('0x1d')](0xcc)[_0xc31d('0x1c')]();});}};}function handleEntityNotFound(_0x54a717,_0x49372e){return function(_0x4d4f0c){if(!_0x4d4f0c){_0x54a717[_0xc31d('0x2a')](0x194);}return _0x4d4f0c;};}function handleError(_0x59734d,_0x2d2e9e){_0x2d2e9e=_0x2d2e9e||0x1f4;return function(_0x2f71cd){logger['error'](_0x2f71cd['stack']);if(_0x2f71cd[_0xc31d('0x2b')]){delete _0x2f71cd[_0xc31d('0x2b')];}_0x59734d['status'](_0x2d2e9e)['send'](_0x2f71cd);};}exports[_0xc31d('0x2c')]=function(_0x449249,_0x143186){var _0x101f2c={},_0x26a0b3={},_0x26493d={'count':0x0,'rows':[]};var _0x2e3779=_[_0xc31d('0x2d')](db['CmCustomField'][_0xc31d('0x2e')],function(_0x12495c){return{'name':_0x12495c[_0xc31d('0x2f')],'type':_0x12495c[_0xc31d('0x30')][_0xc31d('0x31')]};});_0x26a0b3[_0xc31d('0x32')]=_['differenceBy'](_['map'](_0x2e3779,_0xc31d('0x2b')),[_0xc31d('0x2b')]);_0x26a0b3[_0xc31d('0x33')]=_[_0xc31d('0x34')](_0x449249[_0xc31d('0x33')]);_0x26a0b3[_0xc31d('0x35')]=_[_0xc31d('0x36')](_0x26a0b3['model'],_0x26a0b3['query']);_0x101f2c[_0xc31d('0x37')]=_[_0xc31d('0x36')](_0x26a0b3[_0xc31d('0x32')],qs[_0xc31d('0x38')](_0x449249[_0xc31d('0x33')][_0xc31d('0x38')]));_0x101f2c[_0xc31d('0x37')]=_0x101f2c[_0xc31d('0x37')][_0xc31d('0x39')]?_0x101f2c[_0xc31d('0x37')]:_0x26a0b3[_0xc31d('0x32')];if(!_0x449249['query'][_0xc31d('0x3a')](_0xc31d('0x3b'))){_0x101f2c['limit']=qs[_0xc31d('0x21')](_0x449249[_0xc31d('0x33')]['limit']);_0x101f2c['offset']=qs[_0xc31d('0x20')](_0x449249[_0xc31d('0x33')]['offset']);}_0x101f2c[_0xc31d('0x3c')]=qs['sort'](_0x449249[_0xc31d('0x33')][_0xc31d('0x3d')]);_0x101f2c[_0xc31d('0x3e')]=qs['filters'](_[_0xc31d('0x3f')](_0x449249['query'],_0x26a0b3[_0xc31d('0x35')]),_0x2e3779);if(_0x449249[_0xc31d('0x33')]['filter']){_0x101f2c[_0xc31d('0x3e')]=_[_0xc31d('0x40')](_0x101f2c[_0xc31d('0x3e')],{'$or':_[_0xc31d('0x2d')](_0x2e3779,function(_0x1e1690){if(_0x1e1690['type']!==_0xc31d('0x41')){var _0x4053f1={};_0x4053f1[_0x1e1690[_0xc31d('0x2b')]]={'$like':'%'+_0x449249['query'][_0xc31d('0x42')]+'%'};return _0x4053f1;}})});}_0x101f2c=_[_0xc31d('0x40')]({},_0x101f2c,_0x449249['options']);var _0x4c8078={'where':_0x101f2c[_0xc31d('0x3e')]};return db['CmCustomField'][_0xc31d('0x1f')](_0x4c8078)[_0xc31d('0x28')](function(_0x169ffd){_0x26493d['count']=_0x169ffd;if(_0x449249[_0xc31d('0x33')][_0xc31d('0x43')]){_0x101f2c[_0xc31d('0x44')]=[{'all':!![]}];}return db[_0xc31d('0x45')][_0xc31d('0x46')](_0x101f2c);})['then'](function(_0x35e83f){_0x26493d[_0xc31d('0x47')]=_0x35e83f;return _0x26493d;})[_0xc31d('0x28')](respondWithFilteredResult(_0x143186,_0x101f2c))[_0xc31d('0x48')](handleError(_0x143186,null));};exports[_0xc31d('0x49')]=function(_0x496702,_0x20e5cb){var _0x12d52b={'raw':!![],'where':{'id':_0x496702[_0xc31d('0x4a')]['id']}},_0x1901c3={};_0x1901c3[_0xc31d('0x32')]=_['keys'](db['CmCustomField'][_0xc31d('0x2e')]);_0x1901c3[_0xc31d('0x33')]=_[_0xc31d('0x34')](_0x496702['query']);_0x1901c3[_0xc31d('0x35')]=_['intersection'](_0x1901c3['model'],_0x1901c3[_0xc31d('0x33')]);_0x12d52b[_0xc31d('0x37')]=_['intersection'](_0x1901c3[_0xc31d('0x32')],qs[_0xc31d('0x38')](_0x496702[_0xc31d('0x33')][_0xc31d('0x38')]));_0x12d52b['attributes']=_0x12d52b['attributes']['length']?_0x12d52b[_0xc31d('0x37')]:_0x1901c3[_0xc31d('0x32')];if(_0x496702[_0xc31d('0x33')][_0xc31d('0x43')]){_0x12d52b[_0xc31d('0x44')]=[{'all':!![]}];}_0x12d52b=_[_0xc31d('0x40')]({},_0x12d52b,_0x496702['options']);return db[_0xc31d('0x45')]['find'](_0x12d52b)[_0xc31d('0x28')](handleEntityNotFound(_0x20e5cb,null))[_0xc31d('0x28')](respondWithResult(_0x20e5cb,null))[_0xc31d('0x48')](handleError(_0x20e5cb,null));};exports[_0xc31d('0x27')]=function(_0x11acf3,_0x2fb6c5){if(_0x11acf3[_0xc31d('0x4b')]['id']){delete _0x11acf3[_0xc31d('0x4b')]['id'];}return db[_0xc31d('0x45')][_0xc31d('0x4c')]({'where':{'id':_0x11acf3[_0xc31d('0x4a')]['id']}})[_0xc31d('0x28')](handleEntityNotFound(_0x2fb6c5,null))['then'](saveUpdates(_0x11acf3[_0xc31d('0x4b')],null))['then'](respondWithResult(_0x2fb6c5,null))[_0xc31d('0x48')](handleError(_0x2fb6c5,null));};exports['destroy']=function(_0x4d004a,_0x11a37c){return db[_0xc31d('0x45')]['find']({'where':{'id':_0x4d004a[_0xc31d('0x4a')]['id']}})[_0xc31d('0x28')](handleEntityNotFound(_0x11a37c,null))['then'](removeEntity(_0x11a37c,null))[_0xc31d('0x48')](handleError(_0x11a37c,null));};exports[_0xc31d('0x4d')]=function(_0x2043cd,_0x289fd3){var _0x4b81d4;return db['sequelize'][_0xc31d('0x4e')](function(_0x2ac945){return db[_0xc31d('0x45')][_0xc31d('0x4d')](_0x2043cd[_0xc31d('0x4b')],{'transaction':_0x2ac945})[_0xc31d('0x28')](function(_0x295563){_0x4b81d4=_0x295563;var _0x1f93de={'type':db[_0xc31d('0x4f')][_0xc31d('0x50')],'transaction':_0x2ac945};switch(_0x2043cd['body'][_0xc31d('0x30')]){case _0xc31d('0x51'):_0x1f93de[_0xc31d('0x30')]=db[_0xc31d('0x4f')][_0xc31d('0x50')];break;case'number':_0x1f93de[_0xc31d('0x30')]=db['Sequelize'][_0xc31d('0x52')];break;case _0xc31d('0x53'):_0x1f93de[_0xc31d('0x30')]=db[_0xc31d('0x4f')][_0xc31d('0x54')];_0x1f93de['defaultValue']=![];break;default:}return db[_0xc31d('0x55')]['queryInterface'][_0xc31d('0x56')](_0xc31d('0x57'),util[_0xc31d('0x58')](_0xc31d('0x59'),_0x4b81d4['id']),_0x1f93de);})['then'](function(){return _0x4b81d4;});})[_0xc31d('0x28')](respondWithResult(_0x289fd3,0xc9))[_0xc31d('0x48')](handleError(_0x289fd3,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 26f1388..6fdc93e 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 _0x3687=['CmCustomField','cm_custom_fields','util','api','moment','request-promise','path','../../config/environment','exports'];(function(_0x43fd9e,_0x44804d){var _0x468a23=function(_0x119a12){while(--_0x119a12){_0x43fd9e['push'](_0x43fd9e['shift']());}};_0x468a23(++_0x44804d);}(_0x3687,0xa4));var _0x7368=function(_0x25aac1,_0x31e4c6){_0x25aac1=_0x25aac1-0x0;var _0x3c75ba=_0x3687[_0x25aac1];return _0x3c75ba;};'use strict';var _=require('lodash');var util=require(_0x7368('0x0'));var logger=require('../../config/logger')(_0x7368('0x1'));var moment=require(_0x7368('0x2'));var BPromise=require('bluebird');var rp=require(_0x7368('0x3'));var fs=require('fs');var path=require(_0x7368('0x4'));var rimraf=require('rimraf');var config=require(_0x7368('0x5'));var attributes=require('./cmCustomField.attributes');module[_0x7368('0x6')]=function(_0x49ede2,_0x41a479){return _0x49ede2['define'](_0x7368('0x7'),attributes,{'tableName':_0x7368('0x8'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5e26=['path','rimraf','../../config/environment','exports','define','CmCustomField','lodash','util','api','moment','bluebird'];(function(_0x4cf0db,_0x1421bc){var _0x35a736=function(_0x389855){while(--_0x389855){_0x4cf0db['push'](_0x4cf0db['shift']());}};_0x35a736(++_0x1421bc);}(_0x5e26,0x1a8));var _0x65e2=function(_0x4be3e7,_0x3a7f05){_0x4be3e7=_0x4be3e7-0x0;var _0x4d44a0=_0x5e26[_0x4be3e7];return _0x4d44a0;};'use strict';var _=require(_0x65e2('0x0'));var util=require(_0x65e2('0x1'));var logger=require('../../config/logger')(_0x65e2('0x2'));var moment=require(_0x65e2('0x3'));var BPromise=require(_0x65e2('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x65e2('0x5'));var rimraf=require(_0x65e2('0x6'));var config=require(_0x65e2('0x7'));var attributes=require('./cmCustomField.attributes');module[_0x65e2('0x8')]=function(_0x4bd14a,_0x235c31){return _0x4bd14a[_0x65e2('0x9')](_0x65e2('0xa'),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 510d76f..43395b0 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 _0xf80f=['error','code','CmCustomField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x215c7f,_0x445791){var _0x5e0d70=function(_0x998e7a){while(--_0x998e7a){_0x215c7f['push'](_0x215c7f['shift']());}};_0x5e0d70(++_0x445791);}(_0xf80f,0x196));var _0xff80=function(_0x32fc0c,_0x520834){_0x32fc0c=_0x32fc0c-0x0;var _0x229503=_0xf80f[_0x32fc0c];return _0x229503;};'use strict';var _=require(_0xff80('0x0'));var util=require(_0xff80('0x1'));var moment=require(_0xff80('0x2'));var BPromise=require('bluebird');var rs=require(_0xff80('0x3'));var fs=require('fs');var Redis=require(_0xff80('0x4'));var db=require(_0xff80('0x5'))['db'];var utils=require(_0xff80('0x6'));var logger=require(_0xff80('0x7'))(_0xff80('0x8'));var config=require(_0xff80('0x9'));var jayson=require(_0xff80('0xa'));var client=jayson[_0xff80('0xb')][_0xff80('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x11ad9f,_0x11186e,_0x15d47b){return new BPromise(function(_0x320222,_0xfdfca1){return client['request'](_0x11ad9f,_0x15d47b)[_0xff80('0xd')](function(_0x487e06){logger[_0xff80('0xe')]('CmCustomField,\x20%s,\x20%s',_0x11186e,_0xff80('0xf'));logger[_0xff80('0x10')](_0xff80('0x11'),_0x11186e,'request\x20sent',JSON[_0xff80('0x12')](_0x487e06));if(_0x487e06[_0xff80('0x13')]){if(_0x487e06[_0xff80('0x13')][_0xff80('0x14')]===0x1f4){logger[_0xff80('0x13')](_0xff80('0x15'),_0x11186e,_0x487e06[_0xff80('0x13')][_0xff80('0x16')]);return _0xfdfca1(_0x487e06[_0xff80('0x13')][_0xff80('0x16')]);}logger[_0xff80('0x13')]('CmCustomField,\x20%s,\x20%s',_0x11186e,_0x487e06[_0xff80('0x13')][_0xff80('0x16')]);return _0x320222(_0x487e06[_0xff80('0x13')][_0xff80('0x16')]);}else{logger[_0xff80('0xe')](_0xff80('0x15'),_0x11186e,_0xff80('0xf'));_0x320222(_0x487e06[_0xff80('0x17')][_0xff80('0x16')]);}})[_0xff80('0x18')](function(_0x330b26){logger['error'](_0xff80('0x15'),_0x11186e,_0x330b26);_0xfdfca1(_0x330b26);});});} \ No newline at end of file +var _0x4b17=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','CmCustomField,\x20%s,\x20%s','debug','CmCustomField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','moment','bluebird','ioredis'];(function(_0x171242,_0x40e339){var _0x4cca06=function(_0x16fb6e){while(--_0x16fb6e){_0x171242['push'](_0x171242['shift']());}};_0x4cca06(++_0x40e339);}(_0x4b17,0x105));var _0x74b1=function(_0x1c3370,_0xf617e8){_0x1c3370=_0x1c3370-0x0;var _0xa9b358=_0x4b17[_0x1c3370];return _0xa9b358;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x74b1('0x0'));var BPromise=require(_0x74b1('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x74b1('0x2'));var db=require(_0x74b1('0x3'))['db'];var utils=require(_0x74b1('0x4'));var logger=require(_0x74b1('0x5'))(_0x74b1('0x6'));var config=require(_0x74b1('0x7'));var jayson=require(_0x74b1('0x8'));var client=jayson[_0x74b1('0x9')][_0x74b1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x400fad,_0x46b473,_0x297286){return new BPromise(function(_0x150bcf,_0x23adaf){return client[_0x74b1('0xb')](_0x400fad,_0x297286)[_0x74b1('0xc')](function(_0x3e4de4){logger['info'](_0x74b1('0xd'),_0x46b473,'request\x20sent');logger[_0x74b1('0xe')](_0x74b1('0xf'),_0x46b473,_0x74b1('0x10'),JSON[_0x74b1('0x11')](_0x3e4de4));if(_0x3e4de4[_0x74b1('0x12')]){if(_0x3e4de4[_0x74b1('0x12')][_0x74b1('0x13')]===0x1f4){logger['error']('CmCustomField,\x20%s,\x20%s',_0x46b473,_0x3e4de4[_0x74b1('0x12')][_0x74b1('0x14')]);return _0x23adaf(_0x3e4de4[_0x74b1('0x12')]['message']);}logger[_0x74b1('0x12')](_0x74b1('0xd'),_0x46b473,_0x3e4de4[_0x74b1('0x12')][_0x74b1('0x14')]);return _0x150bcf(_0x3e4de4['error'][_0x74b1('0x14')]);}else{logger[_0x74b1('0x15')]('CmCustomField,\x20%s,\x20%s',_0x46b473,'request\x20sent');_0x150bcf(_0x3e4de4[_0x74b1('0x16')]['message']);}})[_0x74b1('0x17')](function(_0x4a695d){logger[_0x74b1('0x12')]('CmCustomField,\x20%s,\x20%s',_0x46b473,_0x4a695d);_0x23adaf(_0x4a695d);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 057253d..8b81ec0 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 _0x6d19=['../../config/environment','./cmCustomField.controller','get','index','/:id','show','post','isAuthenticated','create','put','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x46a53b,_0x2fd0c2){var _0x200ef5=function(_0x3debc6){while(--_0x3debc6){_0x46a53b['push'](_0x46a53b['shift']());}};_0x200ef5(++_0x2fd0c2);}(_0x6d19,0x160));var _0x96d1=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x6d19[_0x42cae2];return _0x5f256f;};'use strict';var multer=require(_0x96d1('0x0'));var util=require(_0x96d1('0x1'));var path=require(_0x96d1('0x2'));var timeout=require(_0x96d1('0x3'));var express=require(_0x96d1('0x4'));var router=express[_0x96d1('0x5')]();var fs_extra=require(_0x96d1('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x96d1('0x7'));var config=require(_0x96d1('0x8'));var controller=require(_0x96d1('0x9'));router[_0x96d1('0xa')]('/',auth['isAuthenticated'](),controller[_0x96d1('0xb')]);router[_0x96d1('0xa')](_0x96d1('0xc'),auth['isAuthenticated'](),controller[_0x96d1('0xd')]);router[_0x96d1('0xe')]('/',auth[_0x96d1('0xf')](),controller[_0x96d1('0x10')]);router[_0x96d1('0x11')](_0x96d1('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x96d1('0x12')](_0x96d1('0xc'),auth['isAuthenticated'](),controller[_0x96d1('0x13')]);module['exports']=router; \ No newline at end of file +var _0x7827=['show','put','update','delete','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCustomField.controller','index','get','/:id','isAuthenticated'];(function(_0x138ef9,_0xd07bb1){var _0x21de58=function(_0x3745b3){while(--_0x3745b3){_0x138ef9['push'](_0x138ef9['shift']());}};_0x21de58(++_0xd07bb1);}(_0x7827,0x19d));var _0x7782=function(_0x55d58f,_0x2bea83){_0x55d58f=_0x55d58f-0x0;var _0x1ad6e6=_0x7827[_0x55d58f];return _0x1ad6e6;};'use strict';var multer=require(_0x7782('0x0'));var util=require(_0x7782('0x1'));var path=require(_0x7782('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x7782('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x7782('0x4'));var interaction=require(_0x7782('0x5'));var config=require(_0x7782('0x6'));var controller=require(_0x7782('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x7782('0x8')]);router[_0x7782('0x9')](_0x7782('0xa'),auth[_0x7782('0xb')](),controller[_0x7782('0xc')]);router['post']('/',auth[_0x7782('0xb')](),controller['create']);router[_0x7782('0xd')](_0x7782('0xa'),auth[_0x7782('0xb')](),controller[_0x7782('0xe')]);router[_0x7782('0xf')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x7782('0x10')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index 6e4b44d..803a2c0 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 _0x5341=['BOOLEAN','DATE','contactListQueue','sequelize','STRING','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER'];(function(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0x5341,0xab));var _0x1534=function(_0x30278a,_0x1c8da6){_0x30278a=_0x30278a-0x0;var _0x945666=_0x5341[_0x30278a];return _0x945666;};'use strict';var moment=require('moment');var Sequelize=require(_0x1534('0x0'));module['exports']={'phone':{'type':Sequelize[_0x1534('0x1')],'allowNull':![]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()[_0x1534('0x2')](_0x1534('0x3'))},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x1534('0x4')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x1534('0x4')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x1534('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x1534('0x1')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x1534('0x6')]},'priority':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x1534('0x5')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x1534('0x4')],'unique':_0x1534('0x7')},'ListId':{'type':Sequelize[_0x1534('0x4')],'unique':_0x1534('0x7')},'UserId':{'type':Sequelize[_0x1534('0x4')]},'VoiceQueueId':{'type':Sequelize[_0x1534('0x4')],'unique':_0x1534('0x7')},'CampaignId':{'type':Sequelize[_0x1534('0x4')]},'countnosuchnumberretry':{'type':Sequelize[_0x1534('0x4')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x1534('0x4')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x1534('0x4')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x1534('0x4')],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0x1534('0x4')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize['STRING']},'recallmeNotifiedDate':{'type':Sequelize[_0x1534('0x6')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file +var _0x156c=['DATE','INTEGER','BOOLEAN','contactListQueue','sequelize','STRING'];(function(_0x3f5e06,_0x2d78a9){var _0x467d64=function(_0x3bcf29){while(--_0x3bcf29){_0x3f5e06['push'](_0x3f5e06['shift']());}};_0x467d64(++_0x2d78a9);}(_0x156c,0x1d8));var _0xc156=function(_0x1034bb,_0x4e20b3){_0x1034bb=_0x1034bb-0x0;var _0x453fdb=_0x156c[_0x1034bb];return _0x453fdb;};'use strict';var moment=require('moment');var Sequelize=require(_0xc156('0x0'));module['exports']={'phone':{'type':Sequelize[_0xc156('0x1')],'allowNull':![]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0xc156('0x2')],'defaultValue':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0xc156('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xc156('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xc156('0x3')],'defaultValue':0x0},'callback':{'type':Sequelize[_0xc156('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0xc156('0x2')]},'priority':{'type':Sequelize[_0xc156('0x3')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xc156('0x3')],'unique':_0xc156('0x5')},'ListId':{'type':Sequelize[_0xc156('0x3')],'unique':_0xc156('0x5')},'UserId':{'type':Sequelize[_0xc156('0x3')]},'VoiceQueueId':{'type':Sequelize[_0xc156('0x3')],'unique':_0xc156('0x5')},'CampaignId':{'type':Sequelize[_0xc156('0x3')]},'countnosuchnumberretry':{'type':Sequelize[_0xc156('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xc156('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xc156('0x3')],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0xc156('0x3')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xc156('0x1')]},'recallmeNotifiedDate':{'type':Sequelize[_0xc156('0x2')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.controller.js b/server/api/cmHopper/cmHopper.controller.js index 2220597..b9df702 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 _0x4b84=['campaigntype','CmContact','ContactId','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','CmHopperAdditionalPhone','end','getPreview','getVoiceQueues','outbound','dialOrderByScheduledAt','dialPreviewAutoRecallMe','transaction','value','direction','isEmpty','hopperIds','priority','ASC','scheduledAt','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','recallme','UPDATE','Contact','CmCompany','List','Queue','getPreviewRecall','sequelize','LOCK','Company','dialActive','getOpenContacts','preview','format','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','sendStatus','getTimezones','timezones','push','getTimezone','moment','lodash','api','undefined','count','offset','limit','status','set','json','then','error','index','map','rawAttributes','fieldName','type','key','model','name','query','keys','filters','concat','$or','$gte','$lt','$lte','$ne','$eq','$between','$in','$notIn','$notLike','$iLike','$notILike','$overlap','$contains','$any','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','CmHopper','includeAll','findAll','rows','catch','params','include','find','create','body','update','describe','destroy','VoiceQueueId','CampaignId','VoiceQueue','Campaign','omit','dataValues','createdAt','updatedAt','statedesc','deleted','campaign','membername','user','UserId','deletedat','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone'];(function(_0x563d3b,_0x40812b){var _0xcc6fa4=function(_0x262fd8){while(--_0x262fd8){_0x563d3b['push'](_0x563d3b['shift']());}};_0xcc6fa4(++_0x40812b);}(_0x4b84,0x1cc));var _0x44b8=function(_0x5ca5bc,_0x5b8a9d){_0x5ca5bc=_0x5ca5bc-0x0;var _0x26ca86=_0x4b84[_0x5ca5bc];return _0x26ca86;};'use strict';var moment=require(_0x44b8('0x0'));var _=require(_0x44b8('0x1'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x44b8('0x2'));var shared=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithResult(_0x3b26c7,_0x31282a){_0x31282a=_0x31282a||0xc8;return function(_0x39ad16){if(_0x39ad16){return _0x3b26c7['status'](_0x31282a)['json'](_0x39ad16);}};}function respondWithFilteredResult(_0x55f25d,_0x996a8b){return function(_0x54274b){if(_0x54274b){var _0x327f59=typeof _0x996a8b['offset']===_0x44b8('0x3')&&typeof _0x996a8b['limit']==='undefined';var _0x41d515=_0x54274b[_0x44b8('0x4')];var _0x30ebc3=_0x327f59?0x0:_0x996a8b['offset'];var _0xc650ec=_0x327f59?_0x54274b[_0x44b8('0x4')]:_0x996a8b[_0x44b8('0x5')]+_0x996a8b[_0x44b8('0x6')];var _0x24dd10;if(_0xc650ec>=_0x41d515){_0xc650ec=_0x41d515;_0x24dd10=0xc8;}else{_0x24dd10=0xce;}_0x55f25d[_0x44b8('0x7')](_0x24dd10);return _0x55f25d[_0x44b8('0x8')]('Content-Range',_0x30ebc3+'-'+_0xc650ec+'/'+_0x41d515)[_0x44b8('0x9')](_0x54274b);}return null;};}function saveUpdates(_0x4301a6,_0x4bcc43){return function(_0x194230){if(_0x194230){return _0x194230['update'](_0x4301a6)[_0x44b8('0xa')](function(_0x18d642){return _0x18d642;});}return null;};}function handleEntityNotFound(_0x4df670,_0x63e8f6){return function(_0x4be54c){if(!_0x4be54c){_0x4df670['sendStatus'](0x194);}return _0x4be54c;};}function handleError(_0x2a3e4c,_0x2af0ad){_0x2af0ad=_0x2af0ad||0x1f4;return function(_0x1722da){logger[_0x44b8('0xb')](_0x1722da['stack']);if(_0x1722da['name']){delete _0x1722da['name'];}_0x2a3e4c[_0x44b8('0x7')](_0x2af0ad)['send'](_0x1722da);};}exports[_0x44b8('0xc')]=function(_0x31651b,_0x55e258){var _0x36743e={},_0xe3de8f={},_0x5103f5={'count':0x0,'rows':[]};var _0x89bc30=_[_0x44b8('0xd')](db['CmHopper'][_0x44b8('0xe')],function(_0x8b4301){return{'name':_0x8b4301[_0x44b8('0xf')],'type':_0x8b4301[_0x44b8('0x10')][_0x44b8('0x11')]};});_0xe3de8f[_0x44b8('0x12')]=_[_0x44b8('0xd')](_0x89bc30,_0x44b8('0x13'));_0xe3de8f[_0x44b8('0x14')]=_[_0x44b8('0x15')](_0x31651b[_0x44b8('0x14')]);_0xe3de8f[_0x44b8('0x16')]=_['intersection'](_0xe3de8f[_0x44b8('0x12')],_0xe3de8f[_0x44b8('0x14')]);_0xe3de8f[_0x44b8('0x16')]=_[_0x44b8('0x17')](_0xe3de8f[_0x44b8('0x16')],['$and',_0x44b8('0x18'),'$gt',_0x44b8('0x19'),_0x44b8('0x1a'),_0x44b8('0x1b'),_0x44b8('0x1c'),_0x44b8('0x1d'),'$not',_0x44b8('0x1e'),'$notBetween',_0x44b8('0x1f'),_0x44b8('0x20'),'$like',_0x44b8('0x21'),_0x44b8('0x22'),_0x44b8('0x23'),'$like',_0x44b8('0x24'),_0x44b8('0x25'),'$contained',_0x44b8('0x26')]);_0x36743e['attributes']=_[_0x44b8('0x27')](_0xe3de8f['model'],qs['fields'](_0x31651b['query'][_0x44b8('0x28')]));_0x36743e[_0x44b8('0x29')]=_0x36743e[_0x44b8('0x29')][_0x44b8('0x2a')]?_0x36743e[_0x44b8('0x29')]:_0xe3de8f[_0x44b8('0x12')];if(!_0x31651b[_0x44b8('0x14')][_0x44b8('0x2b')](_0x44b8('0x2c'))){_0x36743e[_0x44b8('0x6')]=qs[_0x44b8('0x6')](_0x31651b[_0x44b8('0x14')][_0x44b8('0x6')]);_0x36743e['offset']=qs[_0x44b8('0x5')](_0x31651b['query'][_0x44b8('0x5')]);}_0x36743e[_0x44b8('0x2d')]=qs[_0x44b8('0x2e')](_0x31651b[_0x44b8('0x14')][_0x44b8('0x2e')]);_0x36743e['where']=qs[_0x44b8('0x16')](_[_0x44b8('0x2f')](_0x31651b[_0x44b8('0x14')],_0xe3de8f[_0x44b8('0x16')]),_0x89bc30);if(_0x31651b[_0x44b8('0x14')]['filter']){_0x36743e[_0x44b8('0x30')]=_[_0x44b8('0x31')](_0x36743e[_0x44b8('0x30')],{'$or':_[_0x44b8('0xd')](_0x89bc30,function(_0x140a79){if(_0x140a79[_0x44b8('0x10')]!==_0x44b8('0x32')){var _0x14a9d7={};_0x14a9d7[_0x140a79[_0x44b8('0x13')]]={'$like':'%'+_0x31651b[_0x44b8('0x14')][_0x44b8('0x33')]+'%'};return _0x14a9d7;}})});}_0x36743e=_[_0x44b8('0x31')]({},_0x36743e,_0x31651b[_0x44b8('0x34')]);var _0xae15f4={'where':_0x36743e[_0x44b8('0x30')]};return db[_0x44b8('0x35')][_0x44b8('0x4')](_0xae15f4)[_0x44b8('0xa')](function(_0x28faa9){_0x5103f5[_0x44b8('0x4')]=_0x28faa9;if(_0x31651b[_0x44b8('0x14')][_0x44b8('0x36')]){_0x36743e['include']=[{'all':!![]}];}return db[_0x44b8('0x35')][_0x44b8('0x37')](_0x36743e);})['then'](function(_0x25688b){_0x5103f5[_0x44b8('0x38')]=_0x25688b;return _0x5103f5;})[_0x44b8('0xa')](respondWithFilteredResult(_0x55e258,_0x36743e))[_0x44b8('0x39')](handleError(_0x55e258,null));};exports['show']=function(_0x221543,_0x11e4e3){var _0x3611b4={'raw':!![],'where':{'id':_0x221543[_0x44b8('0x3a')]['id']}},_0x1ee3cc={};_0x1ee3cc[_0x44b8('0x12')]=_[_0x44b8('0x15')](db[_0x44b8('0x35')][_0x44b8('0xe')]);_0x1ee3cc[_0x44b8('0x14')]=_[_0x44b8('0x15')](_0x221543[_0x44b8('0x14')]);_0x1ee3cc[_0x44b8('0x16')]=_[_0x44b8('0x27')](_0x1ee3cc[_0x44b8('0x12')],_0x1ee3cc[_0x44b8('0x14')]);_0x3611b4['attributes']=_[_0x44b8('0x27')](_0x1ee3cc[_0x44b8('0x12')],qs[_0x44b8('0x28')](_0x221543['query'][_0x44b8('0x28')]));_0x3611b4[_0x44b8('0x29')]=_0x3611b4[_0x44b8('0x29')]['length']?_0x3611b4[_0x44b8('0x29')]:_0x1ee3cc[_0x44b8('0x12')];if(_0x221543[_0x44b8('0x14')][_0x44b8('0x36')]){_0x3611b4[_0x44b8('0x3b')]=[{'all':!![]}];}_0x3611b4=_['merge']({},_0x3611b4,_0x221543['options']);return db[_0x44b8('0x35')][_0x44b8('0x3c')](_0x3611b4)[_0x44b8('0xa')](handleEntityNotFound(_0x11e4e3,null))[_0x44b8('0xa')](respondWithResult(_0x11e4e3,null))[_0x44b8('0x39')](handleError(_0x11e4e3,null));};exports[_0x44b8('0x3d')]=function(_0x3fc41b,_0x457348){return db[_0x44b8('0x35')][_0x44b8('0x3d')](_0x3fc41b[_0x44b8('0x3e')],{})[_0x44b8('0xa')](respondWithResult(_0x457348,0xc9))[_0x44b8('0x39')](handleError(_0x457348,null));};exports[_0x44b8('0x3f')]=function(_0x149731,_0x60eeb2){if(_0x149731[_0x44b8('0x3e')]['id']){delete _0x149731[_0x44b8('0x3e')]['id'];}return db[_0x44b8('0x35')]['find']({'where':{'id':_0x149731['params']['id']}})[_0x44b8('0xa')](handleEntityNotFound(_0x60eeb2,null))[_0x44b8('0xa')](saveUpdates(_0x149731[_0x44b8('0x3e')],null))[_0x44b8('0xa')](respondWithResult(_0x60eeb2,null))[_0x44b8('0x39')](handleError(_0x60eeb2,null));};exports[_0x44b8('0x40')]=function(_0x411ed6,_0x4fe73f){return db[_0x44b8('0x35')]['describe']()[_0x44b8('0xa')](respondWithResult(_0x4fe73f,null))[_0x44b8('0x39')](handleError(_0x4fe73f,null));};exports[_0x44b8('0x41')]=function(_0x9207bf,_0x103d57){var _0x35ca19;var _0x491600=_0x9207bf[_0x44b8('0x3a')]['id'];return db[_0x44b8('0x35')][_0x44b8('0x3c')]({'where':{'id':_0x9207bf[_0x44b8('0x3a')]['id']}})['then'](handleEntityNotFound(_0x103d57,null))[_0x44b8('0xa')](function(_0x2f549d){if(_0x2f549d){return _0x2f549d[_0x44b8('0x41')]()[_0x44b8('0xa')](function(_0x44ec23){return _0x44ec23;});}})[_0x44b8('0xa')](function(_0x500bad){_0x35ca19=_0x500bad;if(_0x500bad){if(_0x500bad[_0x44b8('0x42')]||_0x500bad[_0x44b8('0x43')]){return db[_0x500bad[_0x44b8('0x42')]?_0x44b8('0x44'):_0x44b8('0x45')]['find']({'where':{'id':_0x500bad['VoiceQueueId']?_0x500bad[_0x44b8('0x42')]:_0x500bad['CampaignId']},'attributes':['id',_0x44b8('0x13')],'raw':!![]});}}})['then'](function(_0x40164d){var _0x434d6a={};if(_0x40164d){_[_0x44b8('0x31')](_0x434d6a,_[_0x44b8('0x46')](_0x35ca19[_0x44b8('0x47')],[_0x44b8('0x48'),_0x44b8('0x49'),'id']));_0x434d6a['state']=0x15;_0x434d6a[_0x44b8('0x4a')]=_0x44b8('0x4b');_0x434d6a[_0x44b8('0x4c')]=_0x40164d['name'];_0x434d6a[_0x44b8('0x4d')]=_0x9207bf[_0x44b8('0x4e')][_0x44b8('0x13')];_0x434d6a[_0x44b8('0x4f')]=_0x9207bf['user']['id'];_0x434d6a[_0x44b8('0x4b')]=!![];_0x434d6a[_0x44b8('0x50')]=moment()['format'](_0x44b8('0x51'));_0x434d6a[_0x44b8('0x52')]=_0x35ca19[_0x44b8('0x53')];_0x434d6a[_0x44b8('0x54')]=_0x35ca19[_0x44b8('0x42')]?'queue':'ivr';return db[_0x44b8('0x55')][_0x44b8('0x3c')]({'where':{'id':_0x434d6a[_0x44b8('0x56')]},'attributes':[_0x44b8('0x57'),_0x44b8('0x58')]})[_0x44b8('0xa')](function(_0x3c9534){if(!_[_0x44b8('0x59')](_0x103d57)&&!_[_0x44b8('0x59')](_0x3c9534[_0x44b8('0x57')])){_0x434d6a[_0x44b8('0x5a')]=_0x3c9534[_0x44b8('0x57')];if(!_['isNil'](_0x3c9534[_0x44b8('0x58')])){_0x434d6a[_0x44b8('0x5a')]+='\x20'+_0x3c9534[_0x44b8('0x58')];}}})[_0x44b8('0x5b')](function(){return db[_0x44b8('0x5c')][_0x44b8('0x3d')](_0x434d6a);});}})[_0x44b8('0xa')](function(_0x172ff3){return db[_0x44b8('0x5d')][_0x44b8('0x41')]({'where':{'CmHopperId':_0x491600}});})[_0x44b8('0xa')](function(){return _0x103d57[_0x44b8('0x7')](0xcc)[_0x44b8('0x5e')]();})[_0x44b8('0x39')](handleError(_0x103d57,null));};exports[_0x44b8('0x5f')]=function(_0x293c2e,_0x25f91c){var _0x20e563=[];return db['CmContact'][_0x44b8('0x40')]()[_0x44b8('0xa')](function(_0x10e519){_0x20e563=_[_0x44b8('0x15')](_0x10e519);return _0x293c2e[_0x44b8('0x4e')][_0x44b8('0x60')]({'where':{'type':_0x44b8('0x61'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id',_0x44b8('0x62'),_0x44b8('0x63')],'raw':!![]});})['then'](function(_0x2a95f6){if(_0x2a95f6&&_0x2a95f6[_0x44b8('0x2a')]){return db['sequelize'][_0x44b8('0x64')](function(_0x454fe6){var _0x370618={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0x44b8('0x51'))},'VoiceQueueId':{'$in':_['map'](_0x2a95f6,'id')},'$or':[{'UserId':null},{'UserId':_0x293c2e[_0x44b8('0x4e')]['id']}]};var _0x5161ea={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x2a95f6)[_0x44b8('0x33')]([_0x44b8('0x63'),0x0])[_0x44b8('0xd')]('id')[_0x44b8('0x65')]()},'$or':[{'UserId':null},{'UserId':_0x293c2e[_0x44b8('0x4e')]['id']}]};var _0x230b6a={'$or':[_0x370618,_0x5161ea]};var _0x4c7edd=[];if(_0x293c2e[_0x44b8('0x3e')]['direction']&&_0x293c2e[_0x44b8('0x3e')][_0x44b8('0x66')]==='prev'){if(!_[_0x44b8('0x67')](_0x293c2e[_0x44b8('0x3e')][_0x44b8('0x68')])){_0x230b6a['id']={'$in':_0x293c2e[_0x44b8('0x3e')][_0x44b8('0x68')]};}_0x4c7edd=[[_0x44b8('0x69'),_0x44b8('0x6a')],[_0x44b8('0x6b'),_0x2a95f6[0x0][_0x44b8('0x62')]===_0x44b8('0x6a')?_0x44b8('0x6c'):_0x44b8('0x6a')],db['sequelize'][_0x44b8('0x6d')](_0x44b8('0x6e')),['id',_0x44b8('0x6c')]];}else{if(!_['isEmpty'](_0x293c2e[_0x44b8('0x3e')][_0x44b8('0x68')])){_0x230b6a['id']={'$notIn':_0x293c2e['body'][_0x44b8('0x68')]};}_0x4c7edd=[[_0x44b8('0x69'),_0x44b8('0x6c')],[_0x44b8('0x6b'),_0x2a95f6[0x0][_0x44b8('0x62')]],db['sequelize'][_0x44b8('0x6d')](_0x44b8('0x6f')),['id',_0x44b8('0x6a')]];}return db[_0x44b8('0x35')][_0x44b8('0x70')]({'attributes':['id',_0x44b8('0x71'),_0x44b8('0x53'),_0x44b8('0x72')],'where':_0x230b6a,'order':_0x4c7edd,'transaction':_0x454fe6,'lock':_0x454fe6['LOCK'][_0x44b8('0x73')],'include':[{'model':db[_0x44b8('0x55')],'as':_0x44b8('0x74'),'attributes':_0x20e563,'include':[{'model':db[_0x44b8('0x75')],'as':'Company','attributes':['id','name']}]},{'model':db['CmList'],'as':_0x44b8('0x76'),'attributes':['id',_0x44b8('0x13')]},{'model':db[_0x44b8('0x44')],'as':_0x44b8('0x77'),'attributes':['id',_0x44b8('0x13'),'dialActive']}]})[_0x44b8('0xa')](function(_0x58180f){if(_0x58180f){return _0x58180f[_0x44b8('0x3f')]({'UserId':_0x293c2e[_0x44b8('0x4e')]['id']},{'transaction':_0x454fe6});}});});}})[_0x44b8('0xa')](handleEntityNotFound(_0x25f91c,null))['then'](respondWithResult(_0x25f91c,null))['catch'](handleError(_0x25f91c,null));};exports[_0x44b8('0x78')]=function(_0x1964b2,_0x248e6c,_0x536734){var _0x1f5277=[];var _0x36f217=_0x1964b2[_0x44b8('0x3a')]['id'];var _0x15b209=_0x1964b2[_0x44b8('0x4e')]['id'];return db['CmContact'][_0x44b8('0x40')]()[_0x44b8('0xa')](function(_0xbbdab9){_0x1f5277=_[_0x44b8('0x15')](_0xbbdab9);return db[_0x44b8('0x79')]['transaction'](function(_0x40571c){const _0x4c7cdf={'id':_0x36f217};return db[_0x44b8('0x35')][_0x44b8('0x70')]({'attributes':['id',_0x44b8('0x71'),_0x44b8('0x72')],'where':_0x4c7cdf,'transaction':_0x40571c,'lock':_0x40571c[_0x44b8('0x7a')]['UPDATE'],'include':[{'model':db[_0x44b8('0x55')],'as':_0x44b8('0x74'),'attributes':_0x1f5277,'include':[{'model':db['CmCompany'],'as':_0x44b8('0x7b'),'attributes':['id',_0x44b8('0x13')]}]},{'model':db['CmList'],'as':_0x44b8('0x76'),'attributes':['id','name']},{'model':db['VoiceQueue'],'as':_0x44b8('0x77'),'attributes':['id',_0x44b8('0x13'),_0x44b8('0x7c')]}]})['then'](function(_0x510760){if(_0x510760){return _0x510760['update']({'UserId':_0x15b209},{'transaction':_0x40571c});}});});})[_0x44b8('0xa')](handleEntityNotFound(_0x248e6c,null))[_0x44b8('0xa')](respondWithResult(_0x248e6c,null))[_0x44b8('0x39')](handleError(_0x248e6c,null));};exports[_0x44b8('0x7d')]=function(_0x1a5621,_0x221e65){return _0x1a5621[_0x44b8('0x4e')][_0x44b8('0x60')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0x44b8('0x7e')},'attributes':['id'],'raw':!![]})['then'](function(_0x59e7b4){if(_0x59e7b4&&_0x59e7b4['length']){return db[_0x44b8('0x35')]['count']({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x44b8('0x7f')](_0x44b8('0x51'))},'VoiceQueueId':{'$in':_[_0x44b8('0xd')](_0x59e7b4,'id')},'$or':[{'UserId':null},{'UserId':_0x1a5621[_0x44b8('0x4e')]['id']}]}});}return 0x0;})[_0x44b8('0xa')](function(_0x245ba3){if(!_[_0x44b8('0x59')](_0x245ba3)&&_[_0x44b8('0x80')](_0x245ba3)){return _0x221e65['status'](0xc8)[_0x44b8('0x9')]({'contacts':_0x245ba3});}else{logger[_0x44b8('0xb')](_0x44b8('0x81'),_0x44b8('0x7d'),0x194,_0x44b8('0x82'));_0x221e65[_0x44b8('0x83')](0x194);}})[_0x44b8('0x39')](handleError(_0x221e65,null));};exports[_0x44b8('0x84')]=function(_0x40fec3,_0x5f4734){var _0x4b45a7=shared[_0x44b8('0x85')];var _0x553aa9=[];_[_0x44b8('0xd')](_0x4b45a7,function(_0x444419){_0x553aa9[_0x44b8('0x86')]({'id':_0x444419['name'],'name':_0x444419['name'],'utcOffset':_0x444419['utcOffset']});});return _0x5f4734[_0x44b8('0x7')](0xc8)['json']({'tz':_0x553aa9});};exports[_0x44b8('0x87')]=function(_0x2812da,_0xf18cb2){var _0x322a49=shared[_0x44b8('0x85')];var _0xf643d3={};if(!_[_0x44b8('0x59')](_0x322a49[_0x2812da[_0x44b8('0x3e')]['id']]))_0xf643d3=_0x322a49[_0x2812da[_0x44b8('0x3e')]['id']];return _0xf18cb2[_0x44b8('0x7')](0xc8)[_0x44b8('0x9')](_0xf643d3);}; \ No newline at end of file +var _0x5ad3=['campaign','membername','user','deleted','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','queue','ivr','CmContact','ContactId','firstName','isNil','calleridname','lastName','finally','CmHopperFinal','getVoiceQueues','preview','dialPreviewAutoRecallMe','transaction','value','direction','prev','isEmpty','hopperIds','priority','ASC','dialOrderByScheduledAt','DESC','literal','sequelize','COALESCE(CmHopper.UserId,\x200)\x20DESC','LOCK','UPDATE','Contact','CmCompany','Company','CmList','List','VoiceQueue','Queue','dialActive','update','getPreviewRecall','findOne','scheduledat','recallme','getOpenContacts','outbound','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','getTimezones','timezones','push','utcOffset','getTimezone','moment','lodash','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','status','json','offset','undefined','limit','set','Content-Range','then','sendStatus','stack','name','send','index','map','fieldName','key','model','query','keys','filters','intersection','concat','$and','$or','$gte','$lt','$lte','$ne','$eq','$between','$notBetween','$in','$notIn','$like','$notLike','$iLike','$notILike','$overlap','$contains','$contained','$any','attributes','fields','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','CmHopper','count','include','findAll','rows','catch','show','params','rawAttributes','length','includeAll','find','create','body','describe','destroy','VoiceQueueId','CampaignId','Campaign','dataValues','createdAt','updatedAt','state'];(function(_0x370c4d,_0x38ac8d){var _0x3d2648=function(_0x32b19c){while(--_0x32b19c){_0x370c4d['push'](_0x370c4d['shift']());}};_0x3d2648(++_0x38ac8d);}(_0x5ad3,0x1e2));var _0x35ad=function(_0x325a08,_0x571fff){_0x325a08=_0x325a08-0x0;var _0x436e01=_0x5ad3[_0x325a08];return _0x436e01;};'use strict';var moment=require(_0x35ad('0x0'));var _=require(_0x35ad('0x1'));var qs=require(_0x35ad('0x2'));var logger=require(_0x35ad('0x3'))('api');var shared=require(_0x35ad('0x4'));var db=require(_0x35ad('0x5'))['db'];function respondWithResult(_0xc77352,_0x69a0b3){_0x69a0b3=_0x69a0b3||0xc8;return function(_0x450f55){if(_0x450f55){return _0xc77352[_0x35ad('0x6')](_0x69a0b3)[_0x35ad('0x7')](_0x450f55);}};}function respondWithFilteredResult(_0x436dcb,_0x36c606){return function(_0x31cc6a){if(_0x31cc6a){var _0x4edc59=typeof _0x36c606[_0x35ad('0x8')]===_0x35ad('0x9')&&typeof _0x36c606[_0x35ad('0xa')]==='undefined';var _0x2498c1=_0x31cc6a['count'];var _0x5a29e3=_0x4edc59?0x0:_0x36c606[_0x35ad('0x8')];var _0x3e9830=_0x4edc59?_0x31cc6a['count']:_0x36c606[_0x35ad('0x8')]+_0x36c606[_0x35ad('0xa')];var _0x4ad760;if(_0x3e9830>=_0x2498c1){_0x3e9830=_0x2498c1;_0x4ad760=0xc8;}else{_0x4ad760=0xce;}_0x436dcb['status'](_0x4ad760);return _0x436dcb[_0x35ad('0xb')](_0x35ad('0xc'),_0x5a29e3+'-'+_0x3e9830+'/'+_0x2498c1)['json'](_0x31cc6a);}return null;};}function saveUpdates(_0x3c4dd5,_0x33e2ec){return function(_0x595fe8){if(_0x595fe8){return _0x595fe8['update'](_0x3c4dd5)[_0x35ad('0xd')](function(_0x2e81c8){return _0x2e81c8;});}return null;};}function handleEntityNotFound(_0x3cda5e,_0x4b7ad9){return function(_0x3e2676){if(!_0x3e2676){_0x3cda5e[_0x35ad('0xe')](0x194);}return _0x3e2676;};}function handleError(_0x591917,_0x1494be){_0x1494be=_0x1494be||0x1f4;return function(_0x4d5185){logger['error'](_0x4d5185[_0x35ad('0xf')]);if(_0x4d5185[_0x35ad('0x10')]){delete _0x4d5185[_0x35ad('0x10')];}_0x591917['status'](_0x1494be)[_0x35ad('0x11')](_0x4d5185);};}exports[_0x35ad('0x12')]=function(_0x233394,_0x3158a1){var _0x3a73c8={},_0x418416={},_0x49e960={'count':0x0,'rows':[]};var _0xd32a43=_[_0x35ad('0x13')](db['CmHopper']['rawAttributes'],function(_0x3251d9){return{'name':_0x3251d9[_0x35ad('0x14')],'type':_0x3251d9['type'][_0x35ad('0x15')]};});_0x418416[_0x35ad('0x16')]=_['map'](_0xd32a43,_0x35ad('0x10'));_0x418416[_0x35ad('0x17')]=_[_0x35ad('0x18')](_0x233394[_0x35ad('0x17')]);_0x418416[_0x35ad('0x19')]=_[_0x35ad('0x1a')](_0x418416[_0x35ad('0x16')],_0x418416[_0x35ad('0x17')]);_0x418416[_0x35ad('0x19')]=_[_0x35ad('0x1b')](_0x418416['filters'],[_0x35ad('0x1c'),_0x35ad('0x1d'),'$gt',_0x35ad('0x1e'),_0x35ad('0x1f'),_0x35ad('0x20'),_0x35ad('0x21'),_0x35ad('0x22'),'$not',_0x35ad('0x23'),_0x35ad('0x24'),_0x35ad('0x25'),_0x35ad('0x26'),_0x35ad('0x27'),_0x35ad('0x28'),_0x35ad('0x29'),_0x35ad('0x2a'),'$like',_0x35ad('0x2b'),_0x35ad('0x2c'),_0x35ad('0x2d'),_0x35ad('0x2e')]);_0x3a73c8[_0x35ad('0x2f')]=_['intersection'](_0x418416['model'],qs[_0x35ad('0x30')](_0x233394['query'][_0x35ad('0x30')]));_0x3a73c8['attributes']=_0x3a73c8['attributes']['length']?_0x3a73c8['attributes']:_0x418416[_0x35ad('0x16')];if(!_0x233394['query']['hasOwnProperty'](_0x35ad('0x31'))){_0x3a73c8['limit']=qs[_0x35ad('0xa')](_0x233394['query'][_0x35ad('0xa')]);_0x3a73c8['offset']=qs[_0x35ad('0x8')](_0x233394['query'][_0x35ad('0x8')]);}_0x3a73c8[_0x35ad('0x32')]=qs[_0x35ad('0x33')](_0x233394['query'][_0x35ad('0x33')]);_0x3a73c8[_0x35ad('0x34')]=qs[_0x35ad('0x19')](_[_0x35ad('0x35')](_0x233394[_0x35ad('0x17')],_0x418416['filters']),_0xd32a43);if(_0x233394['query'][_0x35ad('0x36')]){_0x3a73c8[_0x35ad('0x34')]=_[_0x35ad('0x37')](_0x3a73c8[_0x35ad('0x34')],{'$or':_['map'](_0xd32a43,function(_0x199e97){if(_0x199e97[_0x35ad('0x38')]!==_0x35ad('0x39')){var _0x1eb043={};_0x1eb043[_0x199e97[_0x35ad('0x10')]]={'$like':'%'+_0x233394[_0x35ad('0x17')]['filter']+'%'};return _0x1eb043;}})});}_0x3a73c8=_['merge']({},_0x3a73c8,_0x233394[_0x35ad('0x3a')]);var _0x2800e7={'where':_0x3a73c8[_0x35ad('0x34')]};return db[_0x35ad('0x3b')][_0x35ad('0x3c')](_0x2800e7)[_0x35ad('0xd')](function(_0x11e7e2){_0x49e960[_0x35ad('0x3c')]=_0x11e7e2;if(_0x233394[_0x35ad('0x17')]['includeAll']){_0x3a73c8[_0x35ad('0x3d')]=[{'all':!![]}];}return db['CmHopper'][_0x35ad('0x3e')](_0x3a73c8);})[_0x35ad('0xd')](function(_0x450635){_0x49e960[_0x35ad('0x3f')]=_0x450635;return _0x49e960;})[_0x35ad('0xd')](respondWithFilteredResult(_0x3158a1,_0x3a73c8))[_0x35ad('0x40')](handleError(_0x3158a1,null));};exports[_0x35ad('0x41')]=function(_0x1bfd91,_0x15894b){var _0x5dd327={'raw':!![],'where':{'id':_0x1bfd91[_0x35ad('0x42')]['id']}},_0x200e4d={};_0x200e4d[_0x35ad('0x16')]=_['keys'](db[_0x35ad('0x3b')][_0x35ad('0x43')]);_0x200e4d[_0x35ad('0x17')]=_[_0x35ad('0x18')](_0x1bfd91[_0x35ad('0x17')]);_0x200e4d[_0x35ad('0x19')]=_[_0x35ad('0x1a')](_0x200e4d[_0x35ad('0x16')],_0x200e4d[_0x35ad('0x17')]);_0x5dd327[_0x35ad('0x2f')]=_[_0x35ad('0x1a')](_0x200e4d['model'],qs[_0x35ad('0x30')](_0x1bfd91['query'][_0x35ad('0x30')]));_0x5dd327[_0x35ad('0x2f')]=_0x5dd327[_0x35ad('0x2f')][_0x35ad('0x44')]?_0x5dd327[_0x35ad('0x2f')]:_0x200e4d[_0x35ad('0x16')];if(_0x1bfd91[_0x35ad('0x17')][_0x35ad('0x45')]){_0x5dd327[_0x35ad('0x3d')]=[{'all':!![]}];}_0x5dd327=_['merge']({},_0x5dd327,_0x1bfd91[_0x35ad('0x3a')]);return db[_0x35ad('0x3b')][_0x35ad('0x46')](_0x5dd327)[_0x35ad('0xd')](handleEntityNotFound(_0x15894b,null))[_0x35ad('0xd')](respondWithResult(_0x15894b,null))['catch'](handleError(_0x15894b,null));};exports[_0x35ad('0x47')]=function(_0x2ac7f4,_0x5b78e3){return db['CmHopper'][_0x35ad('0x47')](_0x2ac7f4[_0x35ad('0x48')],{})[_0x35ad('0xd')](respondWithResult(_0x5b78e3,0xc9))[_0x35ad('0x40')](handleError(_0x5b78e3,null));};exports['update']=function(_0x19c5f1,_0x1e3794){if(_0x19c5f1[_0x35ad('0x48')]['id']){delete _0x19c5f1[_0x35ad('0x48')]['id'];}return db[_0x35ad('0x3b')][_0x35ad('0x46')]({'where':{'id':_0x19c5f1[_0x35ad('0x42')]['id']}})['then'](handleEntityNotFound(_0x1e3794,null))[_0x35ad('0xd')](saveUpdates(_0x19c5f1[_0x35ad('0x48')],null))[_0x35ad('0xd')](respondWithResult(_0x1e3794,null))['catch'](handleError(_0x1e3794,null));};exports['describe']=function(_0x5644c4,_0x3eb46b){return db[_0x35ad('0x3b')][_0x35ad('0x49')]()[_0x35ad('0xd')](respondWithResult(_0x3eb46b,null))['catch'](handleError(_0x3eb46b,null));};exports[_0x35ad('0x4a')]=function(_0x46c462,_0x3583ca){var _0x2e384a;var _0x43d1ab=_0x46c462[_0x35ad('0x42')]['id'];return db['CmHopper']['find']({'where':{'id':_0x46c462[_0x35ad('0x42')]['id']}})[_0x35ad('0xd')](handleEntityNotFound(_0x3583ca,null))['then'](function(_0x4fbf0c){if(_0x4fbf0c){return _0x4fbf0c[_0x35ad('0x4a')]()[_0x35ad('0xd')](function(_0x196ebd){return _0x196ebd;});}})['then'](function(_0x486a11){_0x2e384a=_0x486a11;if(_0x486a11){if(_0x486a11[_0x35ad('0x4b')]||_0x486a11[_0x35ad('0x4c')]){return db[_0x486a11[_0x35ad('0x4b')]?'VoiceQueue':_0x35ad('0x4d')][_0x35ad('0x46')]({'where':{'id':_0x486a11[_0x35ad('0x4b')]?_0x486a11[_0x35ad('0x4b')]:_0x486a11[_0x35ad('0x4c')]},'attributes':['id',_0x35ad('0x10')],'raw':!![]});}}})['then'](function(_0x119b99){var _0x22415d={};if(_0x119b99){_[_0x35ad('0x37')](_0x22415d,_['omit'](_0x2e384a[_0x35ad('0x4e')],[_0x35ad('0x4f'),_0x35ad('0x50'),'id']));_0x22415d[_0x35ad('0x51')]=0x15;_0x22415d['statedesc']='deleted';_0x22415d[_0x35ad('0x52')]=_0x119b99[_0x35ad('0x10')];_0x22415d[_0x35ad('0x53')]=_0x46c462[_0x35ad('0x54')][_0x35ad('0x10')];_0x22415d['UserId']=_0x46c462[_0x35ad('0x54')]['id'];_0x22415d[_0x35ad('0x55')]=!![];_0x22415d[_0x35ad('0x56')]=moment()[_0x35ad('0x57')](_0x35ad('0x58'));_0x22415d[_0x35ad('0x59')]=_0x2e384a['phone'];_0x22415d['campaigntype']=_0x2e384a[_0x35ad('0x4b')]?_0x35ad('0x5a'):_0x35ad('0x5b');return db[_0x35ad('0x5c')][_0x35ad('0x46')]({'where':{'id':_0x22415d[_0x35ad('0x5d')]},'attributes':[_0x35ad('0x5e'),'lastName']})[_0x35ad('0xd')](function(_0x13229d){if(!_[_0x35ad('0x5f')](_0x3583ca)&&!_[_0x35ad('0x5f')](_0x13229d['firstName'])){_0x22415d[_0x35ad('0x60')]=_0x13229d[_0x35ad('0x5e')];if(!_['isNil'](_0x13229d[_0x35ad('0x61')])){_0x22415d[_0x35ad('0x60')]+='\x20'+_0x13229d[_0x35ad('0x61')];}}})[_0x35ad('0x62')](function(){return db[_0x35ad('0x63')][_0x35ad('0x47')](_0x22415d);});}})[_0x35ad('0xd')](function(_0x1eda5e){return db['CmHopperAdditionalPhone'][_0x35ad('0x4a')]({'where':{'CmHopperId':_0x43d1ab}});})[_0x35ad('0xd')](function(){return _0x3583ca[_0x35ad('0x6')](0xcc)['end']();})[_0x35ad('0x40')](handleError(_0x3583ca,null));};exports['getPreview']=function(_0x24cfdc,_0x3536b3){var _0x218e57=[];return db[_0x35ad('0x5c')]['describe']()[_0x35ad('0xd')](function(_0x47420e){_0x218e57=_[_0x35ad('0x18')](_0x47420e);return _0x24cfdc[_0x35ad('0x54')][_0x35ad('0x64')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0x35ad('0x65')},'attributes':['id','dialOrderByScheduledAt',_0x35ad('0x66')],'raw':!![]});})[_0x35ad('0xd')](function(_0x4951dc){if(_0x4951dc&&_0x4951dc[_0x35ad('0x44')]){return db['sequelize'][_0x35ad('0x67')](function(_0x3f1d05){var _0x5c71a7={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x35ad('0x57')](_0x35ad('0x58'))},'VoiceQueueId':{'$in':_[_0x35ad('0x13')](_0x4951dc,'id')},'$or':[{'UserId':null},{'UserId':_0x24cfdc[_0x35ad('0x54')]['id']}]};var _0x38d087={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x4951dc)[_0x35ad('0x36')]([_0x35ad('0x66'),0x0])['map']('id')[_0x35ad('0x68')]()},'$or':[{'UserId':null},{'UserId':_0x24cfdc[_0x35ad('0x54')]['id']}]};var _0x261823={'$or':[_0x5c71a7,_0x38d087]};var _0x3c7b45=[];if(_0x24cfdc[_0x35ad('0x48')][_0x35ad('0x69')]&&_0x24cfdc[_0x35ad('0x48')]['direction']===_0x35ad('0x6a')){if(!_[_0x35ad('0x6b')](_0x24cfdc[_0x35ad('0x48')][_0x35ad('0x6c')])){_0x261823['id']={'$in':_0x24cfdc[_0x35ad('0x48')]['hopperIds']};}_0x3c7b45=[[_0x35ad('0x6d'),_0x35ad('0x6e')],['scheduledAt',_0x4951dc[0x0][_0x35ad('0x6f')]===_0x35ad('0x6e')?_0x35ad('0x70'):_0x35ad('0x6e')],db['sequelize'][_0x35ad('0x71')]('COALESCE(CmHopper.UserId,\x200)\x20ASC'),['id',_0x35ad('0x70')]];}else{if(!_[_0x35ad('0x6b')](_0x24cfdc[_0x35ad('0x48')]['hopperIds'])){_0x261823['id']={'$notIn':_0x24cfdc[_0x35ad('0x48')]['hopperIds']};}_0x3c7b45=[[_0x35ad('0x6d'),'DESC'],['scheduledAt',_0x4951dc[0x0][_0x35ad('0x6f')]],db[_0x35ad('0x72')]['literal'](_0x35ad('0x73')),['id',_0x35ad('0x6e')]];}return db[_0x35ad('0x3b')]['findOne']({'attributes':['id','scheduledat','phone','recallme'],'where':_0x261823,'order':_0x3c7b45,'transaction':_0x3f1d05,'lock':_0x3f1d05[_0x35ad('0x74')][_0x35ad('0x75')],'include':[{'model':db[_0x35ad('0x5c')],'as':_0x35ad('0x76'),'attributes':_0x218e57,'include':[{'model':db[_0x35ad('0x77')],'as':_0x35ad('0x78'),'attributes':['id','name']}]},{'model':db[_0x35ad('0x79')],'as':_0x35ad('0x7a'),'attributes':['id','name']},{'model':db[_0x35ad('0x7b')],'as':_0x35ad('0x7c'),'attributes':['id','name',_0x35ad('0x7d')]}]})[_0x35ad('0xd')](function(_0x4409db){if(_0x4409db){return _0x4409db[_0x35ad('0x7e')]({'UserId':_0x24cfdc['user']['id']},{'transaction':_0x3f1d05});}});});}})[_0x35ad('0xd')](handleEntityNotFound(_0x3536b3,null))[_0x35ad('0xd')](respondWithResult(_0x3536b3,null))[_0x35ad('0x40')](handleError(_0x3536b3,null));};exports[_0x35ad('0x7f')]=function(_0x46165b,_0x1617c7,_0x40fbd3){var _0x3dc5e5=[];var _0xd021df=_0x46165b[_0x35ad('0x42')]['id'];var _0x4f8fe9=_0x46165b['user']['id'];return db[_0x35ad('0x5c')][_0x35ad('0x49')]()['then'](function(_0x41d174){_0x3dc5e5=_[_0x35ad('0x18')](_0x41d174);return db[_0x35ad('0x72')][_0x35ad('0x67')](function(_0x3602d4){const _0x44a9d4={'id':_0xd021df};return db['CmHopper'][_0x35ad('0x80')]({'attributes':['id',_0x35ad('0x81'),_0x35ad('0x82')],'where':_0x44a9d4,'transaction':_0x3602d4,'lock':_0x3602d4[_0x35ad('0x74')][_0x35ad('0x75')],'include':[{'model':db[_0x35ad('0x5c')],'as':_0x35ad('0x76'),'attributes':_0x3dc5e5,'include':[{'model':db[_0x35ad('0x77')],'as':'Company','attributes':['id',_0x35ad('0x10')]}]},{'model':db[_0x35ad('0x79')],'as':_0x35ad('0x7a'),'attributes':['id',_0x35ad('0x10')]},{'model':db['VoiceQueue'],'as':_0x35ad('0x7c'),'attributes':['id','name',_0x35ad('0x7d')]}]})['then'](function(_0x4edf91){if(_0x4edf91){return _0x4edf91[_0x35ad('0x7e')]({'UserId':_0x4f8fe9},{'transaction':_0x3602d4});}});});})[_0x35ad('0xd')](handleEntityNotFound(_0x1617c7,null))[_0x35ad('0xd')](respondWithResult(_0x1617c7,null))['catch'](handleError(_0x1617c7,null));};exports[_0x35ad('0x83')]=function(_0x52c478,_0x4125ed){return _0x52c478[_0x35ad('0x54')][_0x35ad('0x64')]({'where':{'type':_0x35ad('0x84'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id'],'raw':!![]})[_0x35ad('0xd')](function(_0x5a919f){if(_0x5a919f&&_0x5a919f[_0x35ad('0x44')]){return db['CmHopper'][_0x35ad('0x3c')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x35ad('0x57')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_['map'](_0x5a919f,'id')},'$or':[{'UserId':null},{'UserId':_0x52c478['user']['id']}]}});}return 0x0;})[_0x35ad('0xd')](function(_0x3f0897){if(!_[_0x35ad('0x5f')](_0x3f0897)&&_[_0x35ad('0x85')](_0x3f0897)){return _0x4125ed[_0x35ad('0x6')](0xc8)['json']({'contacts':_0x3f0897});}else{logger['error'](_0x35ad('0x86'),'getOpenContacts',0x194,_0x35ad('0x87'));_0x4125ed['sendStatus'](0x194);}})[_0x35ad('0x40')](handleError(_0x4125ed,null));};exports[_0x35ad('0x88')]=function(_0x777835,_0x6d8f0c){var _0x5b2b32=shared[_0x35ad('0x89')];var _0x17241c=[];_[_0x35ad('0x13')](_0x5b2b32,function(_0x3b7c41){_0x17241c[_0x35ad('0x8a')]({'id':_0x3b7c41[_0x35ad('0x10')],'name':_0x3b7c41[_0x35ad('0x10')],'utcOffset':_0x3b7c41[_0x35ad('0x8b')]});});return _0x6d8f0c['status'](0xc8)[_0x35ad('0x7')]({'tz':_0x17241c});};exports[_0x35ad('0x8c')]=function(_0x47aa75,_0x496e31){var _0x5b2b80=shared[_0x35ad('0x89')];var _0x331090={};if(!_[_0x35ad('0x5f')](_0x5b2b80[_0x47aa75[_0x35ad('0x48')]['id']]))_0x331090=_0x5b2b80[_0x47aa75['body']['id']];return _0x496e31[_0x35ad('0x6')](0xc8)[_0x35ad('0x7')](_0x331090);}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index b53751a..9e988ce 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 _0x326f=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopper.attributes','exports','define','CmHopper','cm_hopper','scheduledat','priority','lodash'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x326f,0xd1));var _0xf326=function(_0x4266c0,_0x404f59){_0x4266c0=_0x4266c0-0x0;var _0x1a5d4e=_0x326f[_0x4266c0];return _0x1a5d4e;};'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':['scheduledat']},{'name':'phone','fields':['phone']},{'name':_0xf326('0xe'),'fields':[_0xf326('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7096=['bluebird','request-promise','path','rimraf','../../config/environment','./cmHopper.attributes','exports','define','CmHopper','cm_hopper','scheduledat','phone','priority','util','api'];(function(_0x5365c6,_0x19e1ee){var _0x4203a9=function(_0x49f6b1){while(--_0x49f6b1){_0x5365c6['push'](_0x5365c6['shift']());}};_0x4203a9(++_0x19e1ee);}(_0x7096,0x10c));var _0x6709=function(_0x42245d,_0x51758f){_0x42245d=_0x42245d-0x0;var _0x4b211a=_0x7096[_0x42245d];return _0x4b211a;};'use strict';var _=require('lodash');var util=require(_0x6709('0x0'));var logger=require('../../config/logger')(_0x6709('0x1'));var moment=require('moment');var BPromise=require(_0x6709('0x2'));var rp=require(_0x6709('0x3'));var fs=require('fs');var path=require(_0x6709('0x4'));var rimraf=require(_0x6709('0x5'));var config=require(_0x6709('0x6'));var attributes=require(_0x6709('0x7'));module[_0x6709('0x8')]=function(_0x9d630f,_0xa35832){return _0x9d630f[_0x6709('0x9')](_0x6709('0xa'),attributes,{'tableName':_0x6709('0xb'),'paranoid':![],'indexes':[{'name':_0x6709('0xc'),'fields':['scheduledat']},{'name':'phone','fields':[_0x6709('0xd')]},{'name':_0x6709('0xe'),'fields':[_0x6709('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 8ff5b57..2544f67 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 _0x72e6=['message','find','raw','ShowCmHopper','CreateCmHopper','create','body','info','UpdateCmHopper','update','then','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','DestroyCmHopper','destroy','GetContactDialer','CmContact','sequelize','transaction','order','LOCK','UPDATE','Contact','User','name','voicePause','push','includes','all','length','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','CmHopperFinal','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','MoveContactManagedDialer','CountReScheduled','COUNT','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','\x20,\x201,\x20null','GetContactRecallMe','UserId','GetCmHopperPreview','describe','keys','GetContactByPhone','findOne','phone','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueIds','interval','availableAgentsIds','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','Agent','CmList','List','bluebird','../../mysqldb','GetCmHopper','CmHopper','findAll','options','where','attributes','limit','map','model','include','debug','stringify','catch','error'];(function(_0x29e0eb,_0x9acb52){var _0x597d2d=function(_0x596ef9){while(--_0x596ef9){_0x29e0eb['push'](_0x29e0eb['shift']());}};_0x597d2d(++_0x9acb52);}(_0x72e6,0xda));var _0x672e=function(_0x5a3475,_0x18becb){_0x5a3475=_0x5a3475-0x0;var _0x565c69=_0x72e6[_0x5a3475];return _0x565c69;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x672e('0x0'));var db=require(_0x672e('0x1'))['db'];var logger=require('../../config/logger')('rpc');exports[_0x672e('0x2')]=function(_0x136fd9){var _0x47e5ab=this;return new Promise(function(_0x52d380,_0x48aff2){return db[_0x672e('0x3')][_0x672e('0x4')]({'raw':_0x136fd9[_0x672e('0x5')]?_0x136fd9[_0x672e('0x5')]['raw']===undefined?!![]:![]:!![],'where':_0x136fd9[_0x672e('0x5')]?_0x136fd9[_0x672e('0x5')][_0x672e('0x6')]||null:null,'attributes':_0x136fd9[_0x672e('0x5')]?_0x136fd9['options'][_0x672e('0x7')]||null:null,'limit':_0x136fd9[_0x672e('0x5')]?_0x136fd9[_0x672e('0x5')][_0x672e('0x8')]||null:null,'include':_0x136fd9[_0x672e('0x5')]?_0x136fd9[_0x672e('0x5')]['include']?_[_0x672e('0x9')](_0x136fd9[_0x672e('0x5')]['include'],function(_0x34cd83){return{'model':db[_0x34cd83[_0x672e('0xa')]],'as':_0x34cd83['as'],'attributes':_0x34cd83['attributes'],'include':_0x34cd83['include']?_['map'](_0x34cd83[_0x672e('0xb')],function(_0x16ef09){return{'model':db[_0x16ef09['model']],'as':_0x16ef09['as'],'attributes':_0x16ef09['attributes'],'include':_0x16ef09[_0x672e('0xb')]?_[_0x672e('0x9')](_0x16ef09[_0x672e('0xb')],function(_0x4fdbab){return{'model':db[_0x4fdbab[_0x672e('0xa')]],'as':_0x4fdbab['as'],'attributes':_0x4fdbab[_0x672e('0x7')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2d735a){logger['info'](_0x672e('0x2'),_0x136fd9);logger[_0x672e('0xc')](_0x672e('0x2'),_0x136fd9,JSON[_0x672e('0xd')](_0x2d735a));_0x52d380(_0x2d735a);})[_0x672e('0xe')](function(_0x39ce4d){logger[_0x672e('0xf')](_0x672e('0x2'),_0x39ce4d[_0x672e('0x10')],_0x136fd9);_0x48aff2(_0x47e5ab['error'](0x1f4,_0x39ce4d['message']));});});};exports['ShowCmHopper']=function(_0x4a6166){var _0x31b497=this;return new Promise(function(_0x15733c,_0x47e92c){return db[_0x672e('0x3')][_0x672e('0x11')]({'raw':_0x4a6166[_0x672e('0x5')]?_0x4a6166[_0x672e('0x5')][_0x672e('0x12')]===undefined?!![]:![]:!![],'where':_0x4a6166['options']?_0x4a6166[_0x672e('0x5')][_0x672e('0x6')]||null:null,'attributes':_0x4a6166[_0x672e('0x5')]?_0x4a6166[_0x672e('0x5')][_0x672e('0x7')]||null:null,'include':_0x4a6166['options']?_0x4a6166[_0x672e('0x5')][_0x672e('0xb')]?_[_0x672e('0x9')](_0x4a6166[_0x672e('0x5')]['include'],function(_0x54c6fe){return{'model':db[_0x54c6fe['model']],'as':_0x54c6fe['as'],'attributes':_0x54c6fe[_0x672e('0x7')],'include':_0x54c6fe[_0x672e('0xb')]?_[_0x672e('0x9')](_0x54c6fe[_0x672e('0xb')],function(_0x281d37){return{'model':db[_0x281d37[_0x672e('0xa')]],'as':_0x281d37['as'],'attributes':_0x281d37[_0x672e('0x7')],'include':_0x281d37['include']?_[_0x672e('0x9')](_0x281d37['include'],function(_0x309459){return{'model':db[_0x309459[_0x672e('0xa')]],'as':_0x309459['as'],'attributes':_0x309459[_0x672e('0x7')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2b200a){logger['info'](_0x672e('0x13'),_0x4a6166);logger[_0x672e('0xc')](_0x672e('0x13'),_0x4a6166,JSON[_0x672e('0xd')](_0x2b200a));_0x15733c(_0x2b200a);})[_0x672e('0xe')](function(_0x536e33){logger[_0x672e('0xf')](_0x672e('0x13'),_0x536e33[_0x672e('0x10')],_0x4a6166);_0x47e92c(_0x31b497['error'](0x1f4,_0x536e33[_0x672e('0x10')]));});});};exports[_0x672e('0x14')]=function(_0x23ebc2){var _0xc5c4c7=this;return new Promise(function(_0x5a77ba,_0x5d106e){return db[_0x672e('0x3')][_0x672e('0x15')](_0x23ebc2[_0x672e('0x16')],{'raw':_0x23ebc2['options']?_0x23ebc2[_0x672e('0x5')][_0x672e('0x12')]===undefined?!![]:![]:!![]})['then'](function(_0x1b8b2c){logger[_0x672e('0x17')](_0x672e('0x14'),_0x23ebc2);logger[_0x672e('0xc')](_0x672e('0x14'),_0x23ebc2,JSON[_0x672e('0xd')](_0x1b8b2c));_0x5a77ba(_0x1b8b2c);})['catch'](function(_0x112dc3){logger[_0x672e('0xf')](_0x672e('0x14'),_0x112dc3['message'],_0x23ebc2);_0x5d106e(_0xc5c4c7[_0x672e('0xf')](0x1f4,_0x112dc3[_0x672e('0x10')]));});});};exports[_0x672e('0x18')]=function(_0x4ca859){var _0x534909=this;return new Promise(function(_0x21ae28,_0x5c5d1c){return db[_0x672e('0x3')][_0x672e('0x19')](_0x4ca859[_0x672e('0x16')],{'raw':_0x4ca859[_0x672e('0x5')]?_0x4ca859[_0x672e('0x5')][_0x672e('0x12')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4ca859[_0x672e('0x5')]?_0x4ca859[_0x672e('0x5')][_0x672e('0x6')]||null:null,'attributes':_0x4ca859[_0x672e('0x5')]?_0x4ca859[_0x672e('0x5')][_0x672e('0x7')]||null:null,'limit':_0x4ca859['options']?_0x4ca859[_0x672e('0x5')][_0x672e('0x8')]||null:null})[_0x672e('0x1a')](function(_0x57fada){logger[_0x672e('0x17')](_0x672e('0x18'),_0x4ca859);logger[_0x672e('0x17')](_0x672e('0x1b'),JSON[_0x672e('0xd')](_0x4ca859[_0x672e('0x5')]['where']),_0x4ca859[_0x672e('0x16')][_0x672e('0x1c')]);logger[_0x672e('0xc')](_0x672e('0x18'),_0x4ca859,JSON['stringify'](_0x57fada));_0x21ae28(_0x57fada);})[_0x672e('0xe')](function(_0x1b2c97){logger[_0x672e('0xf')](_0x672e('0x18'),_0x1b2c97[_0x672e('0x10')],_0x4ca859);_0x5c5d1c(_0x534909['error'](0x1f4,_0x1b2c97['message']));});});};exports[_0x672e('0x1d')]=function(_0x28fc25){var _0x583f22=this;return new Promise(function(_0x309829,_0x8e1bae){return db[_0x672e('0x3')][_0x672e('0x1e')]({'where':_0x28fc25[_0x672e('0x5')]?_0x28fc25[_0x672e('0x5')]['where']||null:null})[_0x672e('0x1a')](function(_0x34050d){logger[_0x672e('0x17')]('DestroyCmHopper',_0x28fc25);logger[_0x672e('0xc')](_0x672e('0x1d'),_0x28fc25,JSON[_0x672e('0xd')](_0x34050d));_0x309829(_0x34050d);})[_0x672e('0xe')](function(_0x3ed5df){logger['error']('DestroyCmHopper',_0x3ed5df[_0x672e('0x10')],_0x28fc25);_0x8e1bae(_0x583f22[_0x672e('0xf')](0x1f4,_0x3ed5df[_0x672e('0x10')]));});});};exports[_0x672e('0x1f')]=function(_0x44ddf6){var _0x36f2fa=this;return new Promise(function(_0x495bcd,_0x218cbb){return db[_0x672e('0x20')]['describe']()[_0x672e('0x1a')](function(_0x1d18db){return db[_0x672e('0x21')][_0x672e('0x22')](function(_0x436e29){return db[_0x672e('0x3')][_0x672e('0x4')]({'where':_0x44ddf6[_0x672e('0x5')]?_0x44ddf6[_0x672e('0x5')]['where']||null:null,'attributes':_0x44ddf6[_0x672e('0x5')]?_0x44ddf6[_0x672e('0x5')][_0x672e('0x7')]||null:null,'limit':_0x44ddf6[_0x672e('0x5')]?_0x44ddf6['options'][_0x672e('0x8')]||null:null,'order':_0x44ddf6[_0x672e('0x5')]?_0x44ddf6[_0x672e('0x5')][_0x672e('0x23')]||null:null,'transaction':_0x436e29,'lock':_0x436e29[_0x672e('0x24')][_0x672e('0x25')],'include':[{'model':db[_0x672e('0x20')],'as':_0x672e('0x26'),'attributes':_['keys'](_0x1d18db)},{'model':db[_0x672e('0x27')],'as':'Agent','attributes':['id',_0x672e('0x28'),_0x672e('0x29')]}]})['then'](function(_0x5eeef8){var _0x1bd01d=[];var _0x40d9d3=[];for(var _0x11d130=0x0;_0x11d130<_0x5eeef8['length'];_0x11d130+=0x1){var _0x4adb2f=_0x5eeef8[_0x11d130]['UserId'];if(_0x4adb2f===null){_0x1bd01d[_0x672e('0x2a')](_0x5eeef8[_0x11d130]['update'](_0x44ddf6[_0x672e('0x16')],{'transaction':_0x436e29}));}else if(!_0x40d9d3[_0x672e('0x2b')](_0x4adb2f)){_0x40d9d3[_0x672e('0x2a')](_0x4adb2f);_0x1bd01d[_0x672e('0x2a')](_0x5eeef8[_0x11d130][_0x672e('0x19')](_0x44ddf6[_0x672e('0x16')],{'transaction':_0x436e29}));}}return BPromise[_0x672e('0x2c')](_0x1bd01d);});})[_0x672e('0x1a')](function(_0x26fa80){logger[_0x672e('0x17')](_0x672e('0x1f'),_0x44ddf6);if(_0x26fa80[_0x672e('0x2d')]>0x0){logger[_0x672e('0x17')](_0x672e('0x2e'),_0x26fa80[0x0][_0x672e('0x2f')]['id'],_0x26fa80[0x0]['dataValues'][_0x672e('0x30')],_0x26fa80[0x0][_0x672e('0x2f')][_0x672e('0x1c')]);}logger['debug']('GetContactDialer',_0x44ddf6,JSON[_0x672e('0xd')](_0x26fa80));_0x495bcd(_0x26fa80);})[_0x672e('0xe')](function(_0x2f33ca){logger['error'](_0x672e('0x1f'),_0x2f33ca[_0x672e('0x10')],_0x44ddf6);_0x218cbb(_0x36f2fa[_0x672e('0xf')](0x1f4,_0x2f33ca['message']));});});});};exports['MoveContactManagedDialer']=function(_0xd69d41){var _0x746d04=this;return new Promise(function(_0x39a2f8,_0x92765d){return db[_0x672e('0x21')]['transaction'](function(_0x472e79){return db[_0x672e('0x31')][_0x672e('0x15')](_0xd69d41[_0x672e('0x16')],{'raw':_0xd69d41['options']?_0xd69d41[_0x672e('0x5')]['raw']===undefined?!![]:![]:!![],'transaction':_0x472e79})[_0x672e('0x1a')](function(){logger[_0x672e('0x17')](_0x672e('0x32'),JSON['stringify'](_0xd69d41[_0x672e('0x5')][_0x672e('0x6')]),_0xd69d41[_0x672e('0x5')][_0x672e('0x6')][_0x672e('0x1c')]);return db[_0x672e('0x3')][_0x672e('0x1e')]({'where':_0xd69d41[_0x672e('0x5')]?_0xd69d41[_0x672e('0x5')][_0x672e('0x6')]||null:null,'transaction':_0x472e79});});})[_0x672e('0x1a')](function(_0x2bfacd){logger['info']('MoveContactManagedDialer',_0xd69d41);logger[_0x672e('0xc')](_0x672e('0x33'),_0xd69d41,JSON[_0x672e('0xd')](_0x2bfacd));_0x39a2f8(_0x2bfacd);})['catch'](function(_0x31ad7b){logger[_0x672e('0xf')](_0x672e('0x33'),_0x31ad7b[_0x672e('0x10')],_0xd69d41);_0x92765d(_0x746d04['error'](0x1f4,_0x31ad7b[_0x672e('0x10')]));});});};exports[_0x672e('0x34')]=function(_0x10c734){var _0x3cfc54=this;return new Promise(function(_0x570b4d,_0x417765){return db[_0x672e('0x3')]['findAll']({'raw':_0x10c734['options']?_0x10c734[_0x672e('0x5')][_0x672e('0x12')]===undefined?!![]:![]:!![],'where':_0x10c734['options']?_0x10c734[_0x672e('0x5')][_0x672e('0x6')]||null:null,'attributes':[[db[_0x672e('0x21')]['fn'](_0x672e('0x35'),db['sequelize']['fn']('IF',db[_0x672e('0x21')][_0x672e('0x36')](_0x672e('0x37')+util[_0x672e('0x38')](_0x672e('0x39'),moment()['format']('YYYY-MM-DD\x20HH:mm:ss'))+_0x672e('0x3a')))),'contactsRescheduled']]})['then'](function(_0x5c44b8){logger[_0x672e('0x17')](_0x672e('0x34'),_0x10c734);logger[_0x672e('0xc')](_0x672e('0x34'),_0x10c734,JSON[_0x672e('0xd')](_0x5c44b8));_0x570b4d(_0x5c44b8);})['catch'](function(_0x377f93){logger[_0x672e('0xf')](_0x672e('0x34'),_0x377f93[_0x672e('0x10')],_0x10c734);_0x417765(_0x3cfc54[_0x672e('0xf')](0x1f4,_0x377f93[_0x672e('0x10')]));});});};exports[_0x672e('0x3b')]=function(_0xd10306){var _0x5555d6=this;return new Promise(function(_0x12df60,_0x887c8a){return db[_0x672e('0x20')]['describe']()[_0x672e('0x1a')](function(){return db[_0x672e('0x21')][_0x672e('0x22')](function(_0x56659d){return db['CmHopper'][_0x672e('0x4')]({'where':_0xd10306[_0x672e('0x5')]?_0xd10306[_0x672e('0x5')][_0x672e('0x6')]||null:null,'attributes':_0xd10306[_0x672e('0x5')]?_0xd10306[_0x672e('0x5')][_0x672e('0x7')]||null:null,'limit':0x1,'order':_0xd10306[_0x672e('0x5')]?_0xd10306['options'][_0x672e('0x23')]||null:null,'group':db['CmHopper'][_0x672e('0x3c')],'transaction':_0x56659d,'lock':_0x56659d['LOCK']['UPDATE'],'include':_0xd10306['options']?_0xd10306['options'][_0x672e('0xb')]?_[_0x672e('0x9')](_0xd10306['options']['include'],function(_0x5835bd){return{'model':db[_0x5835bd[_0x672e('0xa')]],'as':_0x5835bd['as'],'attributes':_0x5835bd[_0x672e('0x7')],'include':_0x5835bd[_0x672e('0xb')]?_['map'](_0x5835bd[_0x672e('0xb')],function(_0x1bce30){return{'model':db[_0x1bce30[_0x672e('0xa')]],'as':_0x1bce30['as'],'attributes':_0x1bce30[_0x672e('0x7')],'include':_0x1bce30[_0x672e('0xb')]?_[_0x672e('0x9')](_0x1bce30[_0x672e('0xb')],function(_0x3095c1){return{'model':db[_0x3095c1[_0x672e('0xa')]],'as':_0x3095c1['as'],'attributes':_0x3095c1['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x2336b3){var _0x13ad78=[];for(var _0x1ef372=0x0;_0x1ef372<_0x2336b3[_0x672e('0x2d')];_0x1ef372+=0x1){_0x13ad78['push'](_0x2336b3[_0x1ef372][_0x672e('0x19')](_0xd10306[_0x672e('0x16')],{'transaction':_0x56659d}));}return BPromise[_0x672e('0x2c')](_0x13ad78);});})[_0x672e('0x1a')](function(_0x4adc29){logger[_0x672e('0x17')](_0x672e('0x3b'),_0xd10306);logger['debug'](_0x672e('0x3b'),_0xd10306,JSON['stringify'](_0x4adc29));_0x12df60(_0x4adc29);})[_0x672e('0xe')](function(_0x2cf415){logger[_0x672e('0xf')](_0x672e('0x3b'),_0x2cf415[_0x672e('0x10')],_0xd10306);_0x887c8a(_0x5555d6[_0x672e('0xf')](0x1f4,_0x2cf415[_0x672e('0x10')]));});});});};exports[_0x672e('0x3d')]=function(_0x587084){var _0xc7b83c=this;return new Promise(function(_0x53a88d,_0x4eba70){db[_0x672e('0x20')][_0x672e('0x3e')]()['then'](function(_0x1b0a08){return db[_0x672e('0x3')][_0x672e('0x4')]({'raw':_0x587084[_0x672e('0x5')]?_0x587084[_0x672e('0x5')][_0x672e('0x12')]===undefined?!![]:![]:!![],'where':_0x587084[_0x672e('0x5')]?_0x587084[_0x672e('0x5')][_0x672e('0x6')]||null:null,'attributes':_0x587084['options']?_0x587084[_0x672e('0x5')][_0x672e('0x7')]||null:null,'limit':_0x587084['options']?_0x587084['options'][_0x672e('0x8')]||null:null,'include':_0x587084[_0x672e('0x5')]?_0x587084['options'][_0x672e('0xb')]?_['map'](_0x587084['options'][_0x672e('0xb')],function(_0x45ecb0){return{'model':db[_0x45ecb0[_0x672e('0xa')]],'as':_0x45ecb0['as'],'attributes':_0x45ecb0['as']===_0x672e('0x26')?_[_0x672e('0x3f')](_0x1b0a08):_0x45ecb0[_0x672e('0x7')],'include':_0x45ecb0['include']?_[_0x672e('0x9')](_0x45ecb0['include'],function(_0x47cc14){return{'model':db[_0x47cc14[_0x672e('0xa')]],'as':_0x47cc14['as'],'attributes':_0x47cc14[_0x672e('0x7')],'include':_0x47cc14[_0x672e('0xb')]?_[_0x672e('0x9')](_0x47cc14[_0x672e('0xb')],function(_0xa0c316){return{'model':db[_0xa0c316['model']],'as':_0xa0c316['as'],'attributes':_0xa0c316[_0x672e('0x7')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x572ccd){logger['info'](_0x672e('0x2'),_0x587084);logger[_0x672e('0xc')](_0x672e('0x2'),_0x587084,JSON[_0x672e('0xd')](_0x572ccd));_0x53a88d(_0x572ccd);})[_0x672e('0xe')](function(_0x40b465){logger['error'](_0x672e('0x2'),_0x40b465[_0x672e('0x10')],_0x587084);_0x4eba70(_0xc7b83c[_0x672e('0xf')](0x1f4,_0x40b465[_0x672e('0x10')]));});});});};exports[_0x672e('0x40')]=function(_0x521996){var _0x107e13=this;return new Promise(function(_0x1cf89d,_0x412864){return db[_0x672e('0x20')][_0x672e('0x41')]({'raw':!![],'where':{'phone':_0x521996['options'][_0x672e('0x6')][_0x672e('0x42')]},'attributes':['id','dialTimezone'],'order':[['id','DESC']]})['then'](function(_0x371df6){logger[_0x672e('0x17')](_0x672e('0x43'),_0x521996);logger[_0x672e('0xc')](_0x672e('0x43'),_0x521996,JSON[_0x672e('0xd')](_0x371df6));_0x1cf89d(_0x371df6);})['catch'](function(_0x1b50a0){logger[_0x672e('0xf')](_0x672e('0x43'),_0x1b50a0['message'],_0x521996);_0x412864(_0x107e13[_0x672e('0xf')](0x1f4,_0x1b50a0[_0x672e('0x10')]));});});};exports[_0x672e('0x44')]=function(_0x1c512c){var _0xc8b304=this;return new Promise(function(_0x367daf,_0x3bd048){return db['sequelize'][_0x672e('0x22')](function(_0x479ada){var _0x412318=_0x1c512c[_0x672e('0x5')]&&_0x1c512c[_0x672e('0x5')]['where']?_0x1c512c[_0x672e('0x5')][_0x672e('0x6')]:{};return db[_0x672e('0x3')][_0x672e('0x19')](_0x1c512c['body'],{'where':_0x412318,'transaction':_0x479ada})[_0x672e('0x1a')](function(_0x3612ca){logger[_0x672e('0x17')](_0x672e('0x44'),_0x1c512c);logger[_0x672e('0xc')]('ResetActiveCalls',_0x1c512c,JSON[_0x672e('0xd')](_0x3612ca));_0x367daf(_0x3612ca);})[_0x672e('0xe')](function(_0x137c50){logger[_0x672e('0xf')](_0x672e('0x44'),_0x137c50[_0x672e('0x10')],_0x1c512c);_0x3bd048(_0xc8b304[_0x672e('0xf')](0x1f4,_0x137c50[_0x672e('0x10')]));});});});};exports[_0x672e('0x45')]=function(_0x1bc94e){var _0x282cfc=this;var _0xb64289=_0x1bc94e[_0x672e('0x16')][_0x672e('0x6')][_0x672e('0x46')];var _0x27073d=_0x1bc94e['body'][_0x672e('0x6')][_0x672e('0x47')];var _0x16d02a=_0x1bc94e[_0x672e('0x16')][_0x672e('0x6')][_0x672e('0x48')];return new Promise(function(_0x443cdb,_0x3f8dec){return db['CmHopper']['findAll']({'where':{'voiceQueueId':{'$in':_0xb64289},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0x672e('0x21')][_0x672e('0x36')](_0x672e('0x49')+_0x27073d+_0x672e('0x4a')),'$gt':db['sequelize']['literal']('NOW()')}},'UserId':{'$in':_0x16d02a}},'include':[{'model':db[_0x672e('0x20')],'as':_0x672e('0x26')},{'model':db[_0x672e('0x27')],'as':_0x672e('0x4b'),'attributes':['id',_0x672e('0x28'),_0x672e('0x29')]},{'model':db[_0x672e('0x4c')],'as':_0x672e('0x4d')}]})[_0x672e('0x1a')](function(_0x314c7c){if(_0x314c7c[_0x672e('0x2d')]>0x0){return db['sequelize'][_0x672e('0x22')](function(_0x2641e5){return db[_0x672e('0x3')]['update']({'recallmeNotifiedDate':db[_0x672e('0x21')][_0x672e('0x36')]('NOW()')},{'where':{'id':{'$in':_[_0x672e('0x9')](_0x314c7c,'id')}},'transaction':_0x2641e5})['then'](function(){_0x443cdb(_0x314c7c);})['catch'](function(_0x305303){logger['error']('CmHopperHandlePreviewRecallNotifications',_0x305303[_0x672e('0x10')],_0x1bc94e);_0x3f8dec(_0x282cfc['error'](0x1f4,_0x305303['message']));});})[_0x672e('0xe')](function(_0x1d331e){logger[_0x672e('0xf')]('CmHopperHandlePreviewRecallNotifications',_0x1d331e[_0x672e('0x10')],_0x1bc94e);_0x3f8dec(_0x282cfc[_0x672e('0xf')](0x1f4,_0x1d331e[_0x672e('0x10')]));});}else{_0x443cdb(_0x314c7c);}});});}; \ No newline at end of file +var _0xa415=['util','moment','../../mysqldb','../../config/logger','rpc','GetCmHopper','CmHopper','findAll','options','raw','where','attributes','limit','map','include','model','then','debug','stringify','catch','error','message','ShowCmHopper','find','CreateCmHopper','create','info','UpdateCmHopper','update','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','body','DestroyCmHopper','destroy','GetContactDialer','describe','sequelize','transaction','order','LOCK','User','Agent','voicePause','length','includes','push','all','dataValues','active','MoveContactManagedDialer','COUNT','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','CountReScheduled','CmContact','UserId','UPDATE','GetContactRecallMe','GetCmHopperPreview','Contact','GetContactByPhone','findOne','phone','dialTimezone','DESC','getContactByPhone','ResetActiveCalls','interval','availableAgentsIds','NOW()\x20+\x20INTERVAL\x20','name','NOW()','CmHopperHandlePreviewRecallNotifications','lodash'];(function(_0x3305de,_0x16582f){var _0x3b5a84=function(_0x57d7e1){while(--_0x57d7e1){_0x3305de['push'](_0x3305de['shift']());}};_0x3b5a84(++_0x16582f);}(_0xa415,0x185));var _0x5a41=function(_0x2e7eb9,_0xbbf996){_0x2e7eb9=_0x2e7eb9-0x0;var _0x819a1a=_0xa415[_0x2e7eb9];return _0x819a1a;};'use strict';var _=require(_0x5a41('0x0'));var util=require(_0x5a41('0x1'));var moment=require(_0x5a41('0x2'));var BPromise=require('bluebird');var db=require(_0x5a41('0x3'))['db'];var logger=require(_0x5a41('0x4'))(_0x5a41('0x5'));exports[_0x5a41('0x6')]=function(_0x595337){var _0x3ac1ec=this;return new Promise(function(_0x18dbdd,_0x2ae3b8){return db[_0x5a41('0x7')][_0x5a41('0x8')]({'raw':_0x595337['options']?_0x595337[_0x5a41('0x9')][_0x5a41('0xa')]===undefined?!![]:![]:!![],'where':_0x595337[_0x5a41('0x9')]?_0x595337['options'][_0x5a41('0xb')]||null:null,'attributes':_0x595337[_0x5a41('0x9')]?_0x595337['options'][_0x5a41('0xc')]||null:null,'limit':_0x595337[_0x5a41('0x9')]?_0x595337[_0x5a41('0x9')][_0x5a41('0xd')]||null:null,'include':_0x595337[_0x5a41('0x9')]?_0x595337[_0x5a41('0x9')]['include']?_[_0x5a41('0xe')](_0x595337[_0x5a41('0x9')][_0x5a41('0xf')],function(_0x19c8dd){return{'model':db[_0x19c8dd[_0x5a41('0x10')]],'as':_0x19c8dd['as'],'attributes':_0x19c8dd['attributes'],'include':_0x19c8dd[_0x5a41('0xf')]?_[_0x5a41('0xe')](_0x19c8dd[_0x5a41('0xf')],function(_0x4959ab){return{'model':db[_0x4959ab['model']],'as':_0x4959ab['as'],'attributes':_0x4959ab[_0x5a41('0xc')],'include':_0x4959ab[_0x5a41('0xf')]?_[_0x5a41('0xe')](_0x4959ab[_0x5a41('0xf')],function(_0x3d82f0){return{'model':db[_0x3d82f0[_0x5a41('0x10')]],'as':_0x3d82f0['as'],'attributes':_0x3d82f0[_0x5a41('0xc')]};}):[]};}):[]};}):[]:[]})[_0x5a41('0x11')](function(_0x1a4e56){logger['info']('GetCmHopper',_0x595337);logger[_0x5a41('0x12')](_0x5a41('0x6'),_0x595337,JSON[_0x5a41('0x13')](_0x1a4e56));_0x18dbdd(_0x1a4e56);})[_0x5a41('0x14')](function(_0x4c53f5){logger[_0x5a41('0x15')](_0x5a41('0x6'),_0x4c53f5[_0x5a41('0x16')],_0x595337);_0x2ae3b8(_0x3ac1ec['error'](0x1f4,_0x4c53f5[_0x5a41('0x16')]));});});};exports[_0x5a41('0x17')]=function(_0x51b2e9){var _0x110a32=this;return new Promise(function(_0x3f620a,_0x37e88d){return db[_0x5a41('0x7')][_0x5a41('0x18')]({'raw':_0x51b2e9['options']?_0x51b2e9[_0x5a41('0x9')][_0x5a41('0xa')]===undefined?!![]:![]:!![],'where':_0x51b2e9[_0x5a41('0x9')]?_0x51b2e9[_0x5a41('0x9')][_0x5a41('0xb')]||null:null,'attributes':_0x51b2e9[_0x5a41('0x9')]?_0x51b2e9['options'][_0x5a41('0xc')]||null:null,'include':_0x51b2e9['options']?_0x51b2e9[_0x5a41('0x9')]['include']?_[_0x5a41('0xe')](_0x51b2e9[_0x5a41('0x9')][_0x5a41('0xf')],function(_0x42f08c){return{'model':db[_0x42f08c[_0x5a41('0x10')]],'as':_0x42f08c['as'],'attributes':_0x42f08c[_0x5a41('0xc')],'include':_0x42f08c['include']?_[_0x5a41('0xe')](_0x42f08c['include'],function(_0x1e4e53){return{'model':db[_0x1e4e53[_0x5a41('0x10')]],'as':_0x1e4e53['as'],'attributes':_0x1e4e53[_0x5a41('0xc')],'include':_0x1e4e53[_0x5a41('0xf')]?_['map'](_0x1e4e53['include'],function(_0x46f2fb){return{'model':db[_0x46f2fb[_0x5a41('0x10')]],'as':_0x46f2fb['as'],'attributes':_0x46f2fb[_0x5a41('0xc')]};}):[]};}):[]};}):[]:[]})[_0x5a41('0x11')](function(_0x2001df){logger['info']('ShowCmHopper',_0x51b2e9);logger[_0x5a41('0x12')](_0x5a41('0x17'),_0x51b2e9,JSON[_0x5a41('0x13')](_0x2001df));_0x3f620a(_0x2001df);})[_0x5a41('0x14')](function(_0x12de3e){logger[_0x5a41('0x15')](_0x5a41('0x17'),_0x12de3e['message'],_0x51b2e9);_0x37e88d(_0x110a32['error'](0x1f4,_0x12de3e['message']));});});};exports[_0x5a41('0x19')]=function(_0x56cd32){var _0x575c35=this;return new Promise(function(_0x3deeb5,_0x3cb8ba){return db['CmHopper'][_0x5a41('0x1a')](_0x56cd32['body'],{'raw':_0x56cd32['options']?_0x56cd32[_0x5a41('0x9')][_0x5a41('0xa')]===undefined?!![]:![]:!![]})[_0x5a41('0x11')](function(_0x2f3e0a){logger[_0x5a41('0x1b')]('CreateCmHopper',_0x56cd32);logger[_0x5a41('0x12')]('CreateCmHopper',_0x56cd32,JSON[_0x5a41('0x13')](_0x2f3e0a));_0x3deeb5(_0x2f3e0a);})[_0x5a41('0x14')](function(_0x1aeaf5){logger['error'](_0x5a41('0x19'),_0x1aeaf5['message'],_0x56cd32);_0x3cb8ba(_0x575c35[_0x5a41('0x15')](0x1f4,_0x1aeaf5[_0x5a41('0x16')]));});});};exports[_0x5a41('0x1c')]=function(_0x1933e2){var _0x1bee4d=this;return new Promise(function(_0x39770f,_0x74bd5d){return db[_0x5a41('0x7')][_0x5a41('0x1d')](_0x1933e2['body'],{'raw':_0x1933e2[_0x5a41('0x9')]?_0x1933e2['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1933e2[_0x5a41('0x9')]?_0x1933e2[_0x5a41('0x9')][_0x5a41('0xb')]||null:null,'attributes':_0x1933e2[_0x5a41('0x9')]?_0x1933e2[_0x5a41('0x9')][_0x5a41('0xc')]||null:null,'limit':_0x1933e2[_0x5a41('0x9')]?_0x1933e2[_0x5a41('0x9')]['limit']||null:null})['then'](function(_0x55590e){logger[_0x5a41('0x1b')](_0x5a41('0x1c'),_0x1933e2);logger[_0x5a41('0x1b')](_0x5a41('0x1e'),JSON['stringify'](_0x1933e2[_0x5a41('0x9')]['where']),_0x1933e2[_0x5a41('0x1f')]['active']);logger[_0x5a41('0x12')](_0x5a41('0x1c'),_0x1933e2,JSON['stringify'](_0x55590e));_0x39770f(_0x55590e);})[_0x5a41('0x14')](function(_0x57585e){logger[_0x5a41('0x15')](_0x5a41('0x1c'),_0x57585e['message'],_0x1933e2);_0x74bd5d(_0x1bee4d[_0x5a41('0x15')](0x1f4,_0x57585e['message']));});});};exports[_0x5a41('0x20')]=function(_0x10db77){var _0x3775df=this;return new Promise(function(_0x30f11f,_0x3dffbd){return db[_0x5a41('0x7')][_0x5a41('0x21')]({'where':_0x10db77[_0x5a41('0x9')]?_0x10db77[_0x5a41('0x9')][_0x5a41('0xb')]||null:null})[_0x5a41('0x11')](function(_0x58105c){logger[_0x5a41('0x1b')](_0x5a41('0x20'),_0x10db77);logger[_0x5a41('0x12')]('DestroyCmHopper',_0x10db77,JSON['stringify'](_0x58105c));_0x30f11f(_0x58105c);})['catch'](function(_0x2cb670){logger[_0x5a41('0x15')](_0x5a41('0x20'),_0x2cb670[_0x5a41('0x16')],_0x10db77);_0x3dffbd(_0x3775df[_0x5a41('0x15')](0x1f4,_0x2cb670['message']));});});};exports[_0x5a41('0x22')]=function(_0x323c33){var _0x4507a1=this;return new Promise(function(_0x4175df,_0x5284a5){return db['CmContact'][_0x5a41('0x23')]()[_0x5a41('0x11')](function(_0x5e7069){return db[_0x5a41('0x24')][_0x5a41('0x25')](function(_0x5f3290){return db[_0x5a41('0x7')][_0x5a41('0x8')]({'where':_0x323c33[_0x5a41('0x9')]?_0x323c33['options']['where']||null:null,'attributes':_0x323c33[_0x5a41('0x9')]?_0x323c33[_0x5a41('0x9')]['attributes']||null:null,'limit':_0x323c33['options']?_0x323c33['options'][_0x5a41('0xd')]||null:null,'order':_0x323c33[_0x5a41('0x9')]?_0x323c33['options'][_0x5a41('0x26')]||null:null,'transaction':_0x5f3290,'lock':_0x5f3290[_0x5a41('0x27')]['UPDATE'],'include':[{'model':db['CmContact'],'as':'Contact','attributes':_['keys'](_0x5e7069)},{'model':db[_0x5a41('0x28')],'as':_0x5a41('0x29'),'attributes':['id','name',_0x5a41('0x2a')]}]})[_0x5a41('0x11')](function(_0x290694){var _0x355fc3=[];var _0x328c26=[];for(var _0xf5bc4d=0x0;_0xf5bc4d<_0x290694[_0x5a41('0x2b')];_0xf5bc4d+=0x1){var _0x174447=_0x290694[_0xf5bc4d]['UserId'];if(_0x174447===null){_0x355fc3['push'](_0x290694[_0xf5bc4d][_0x5a41('0x1d')](_0x323c33[_0x5a41('0x1f')],{'transaction':_0x5f3290}));}else if(!_0x328c26[_0x5a41('0x2c')](_0x174447)){_0x328c26[_0x5a41('0x2d')](_0x174447);_0x355fc3['push'](_0x290694[_0xf5bc4d][_0x5a41('0x1d')](_0x323c33[_0x5a41('0x1f')],{'transaction':_0x5f3290}));}}return BPromise[_0x5a41('0x2e')](_0x355fc3);});})[_0x5a41('0x11')](function(_0x464331){logger['info'](_0x5a41('0x22'),_0x323c33);if(_0x464331[_0x5a41('0x2b')]>0x0){logger[_0x5a41('0x1b')]('GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]',_0x464331[0x0][_0x5a41('0x2f')]['id'],_0x464331[0x0][_0x5a41('0x2f')]['ContactId'],_0x464331[0x0]['dataValues'][_0x5a41('0x30')]);}logger[_0x5a41('0x12')]('GetContactDialer',_0x323c33,JSON[_0x5a41('0x13')](_0x464331));_0x4175df(_0x464331);})[_0x5a41('0x14')](function(_0x594006){logger[_0x5a41('0x15')](_0x5a41('0x22'),_0x594006['message'],_0x323c33);_0x5284a5(_0x4507a1[_0x5a41('0x15')](0x1f4,_0x594006[_0x5a41('0x16')]));});});});};exports[_0x5a41('0x31')]=function(_0x267455){var _0x37cb7e=this;return new Promise(function(_0x1ece1c,_0x24f35b){return db[_0x5a41('0x24')]['transaction'](function(_0x1a9902){return db['CmHopperFinal']['create'](_0x267455[_0x5a41('0x1f')],{'raw':_0x267455[_0x5a41('0x9')]?_0x267455[_0x5a41('0x9')][_0x5a41('0xa')]===undefined?!![]:![]:!![],'transaction':_0x1a9902})[_0x5a41('0x11')](function(){logger[_0x5a41('0x1b')]('MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON['stringify'](_0x267455[_0x5a41('0x9')][_0x5a41('0xb')]),_0x267455[_0x5a41('0x9')][_0x5a41('0xb')][_0x5a41('0x30')]);return db['CmHopper'][_0x5a41('0x21')]({'where':_0x267455['options']?_0x267455[_0x5a41('0x9')][_0x5a41('0xb')]||null:null,'transaction':_0x1a9902});});})[_0x5a41('0x11')](function(_0x13407e){logger[_0x5a41('0x1b')]('MoveContactManagedDialer',_0x267455);logger[_0x5a41('0x12')](_0x5a41('0x31'),_0x267455,JSON[_0x5a41('0x13')](_0x13407e));_0x1ece1c(_0x13407e);})['catch'](function(_0x1036bf){logger['error'](_0x5a41('0x31'),_0x1036bf[_0x5a41('0x16')],_0x267455);_0x24f35b(_0x37cb7e[_0x5a41('0x15')](0x1f4,_0x1036bf[_0x5a41('0x16')]));});});};exports['CountReScheduled']=function(_0x24ff13){var _0x3ac144=this;return new Promise(function(_0x48fac9,_0x83dd51){return db[_0x5a41('0x7')]['findAll']({'raw':_0x24ff13[_0x5a41('0x9')]?_0x24ff13['options'][_0x5a41('0xa')]===undefined?!![]:![]:!![],'where':_0x24ff13[_0x5a41('0x9')]?_0x24ff13[_0x5a41('0x9')]['where']||null:null,'attributes':[[db[_0x5a41('0x24')]['fn'](_0x5a41('0x32'),db[_0x5a41('0x24')]['fn']('IF',db[_0x5a41('0x24')][_0x5a41('0x33')](_0x5a41('0x34')+util[_0x5a41('0x35')](_0x5a41('0x36'),moment()[_0x5a41('0x35')](_0x5a41('0x37')))+_0x5a41('0x38')))),_0x5a41('0x39')]]})[_0x5a41('0x11')](function(_0x42b6ca){logger[_0x5a41('0x1b')]('CountReScheduled',_0x24ff13);logger['debug'](_0x5a41('0x3a'),_0x24ff13,JSON[_0x5a41('0x13')](_0x42b6ca));_0x48fac9(_0x42b6ca);})[_0x5a41('0x14')](function(_0x23303d){logger[_0x5a41('0x15')](_0x5a41('0x3a'),_0x23303d[_0x5a41('0x16')],_0x24ff13);_0x83dd51(_0x3ac144[_0x5a41('0x15')](0x1f4,_0x23303d['message']));});});};exports['GetContactRecallMe']=function(_0x248232){var _0x2fda43=this;return new Promise(function(_0x1817b3,_0x34d6a3){return db[_0x5a41('0x3b')][_0x5a41('0x23')]()[_0x5a41('0x11')](function(){return db[_0x5a41('0x24')][_0x5a41('0x25')](function(_0x26977e){return db['CmHopper'][_0x5a41('0x8')]({'where':_0x248232[_0x5a41('0x9')]?_0x248232[_0x5a41('0x9')][_0x5a41('0xb')]||null:null,'attributes':_0x248232['options']?_0x248232[_0x5a41('0x9')][_0x5a41('0xc')]||null:null,'limit':0x1,'order':_0x248232[_0x5a41('0x9')]?_0x248232['options'][_0x5a41('0x26')]||null:null,'group':db[_0x5a41('0x7')][_0x5a41('0x3c')],'transaction':_0x26977e,'lock':_0x26977e[_0x5a41('0x27')][_0x5a41('0x3d')],'include':_0x248232[_0x5a41('0x9')]?_0x248232['options'][_0x5a41('0xf')]?_[_0x5a41('0xe')](_0x248232[_0x5a41('0x9')][_0x5a41('0xf')],function(_0x36c0da){return{'model':db[_0x36c0da['model']],'as':_0x36c0da['as'],'attributes':_0x36c0da['attributes'],'include':_0x36c0da['include']?_[_0x5a41('0xe')](_0x36c0da[_0x5a41('0xf')],function(_0xa27f33){return{'model':db[_0xa27f33[_0x5a41('0x10')]],'as':_0xa27f33['as'],'attributes':_0xa27f33['attributes'],'include':_0xa27f33['include']?_[_0x5a41('0xe')](_0xa27f33[_0x5a41('0xf')],function(_0x210da3){return{'model':db[_0x210da3[_0x5a41('0x10')]],'as':_0x210da3['as'],'attributes':_0x210da3['attributes']};}):[]};}):[]};}):[]:[]})[_0x5a41('0x11')](function(_0x445aca){var _0x432998=[];for(var _0x221b21=0x0;_0x221b21<_0x445aca[_0x5a41('0x2b')];_0x221b21+=0x1){_0x432998['push'](_0x445aca[_0x221b21][_0x5a41('0x1d')](_0x248232[_0x5a41('0x1f')],{'transaction':_0x26977e}));}return BPromise[_0x5a41('0x2e')](_0x432998);});})[_0x5a41('0x11')](function(_0x52dff8){logger[_0x5a41('0x1b')]('GetContactRecallMe',_0x248232);logger[_0x5a41('0x12')](_0x5a41('0x3e'),_0x248232,JSON[_0x5a41('0x13')](_0x52dff8));_0x1817b3(_0x52dff8);})[_0x5a41('0x14')](function(_0x55a891){logger[_0x5a41('0x15')](_0x5a41('0x3e'),_0x55a891['message'],_0x248232);_0x34d6a3(_0x2fda43[_0x5a41('0x15')](0x1f4,_0x55a891[_0x5a41('0x16')]));});});});};exports[_0x5a41('0x3f')]=function(_0x59b11d){var _0x53e772=this;return new Promise(function(_0x4d0fc2,_0x2a2740){db[_0x5a41('0x3b')][_0x5a41('0x23')]()['then'](function(_0x2def82){return db[_0x5a41('0x7')][_0x5a41('0x8')]({'raw':_0x59b11d[_0x5a41('0x9')]?_0x59b11d[_0x5a41('0x9')][_0x5a41('0xa')]===undefined?!![]:![]:!![],'where':_0x59b11d[_0x5a41('0x9')]?_0x59b11d[_0x5a41('0x9')][_0x5a41('0xb')]||null:null,'attributes':_0x59b11d[_0x5a41('0x9')]?_0x59b11d['options'][_0x5a41('0xc')]||null:null,'limit':_0x59b11d[_0x5a41('0x9')]?_0x59b11d['options'][_0x5a41('0xd')]||null:null,'include':_0x59b11d[_0x5a41('0x9')]?_0x59b11d[_0x5a41('0x9')][_0x5a41('0xf')]?_[_0x5a41('0xe')](_0x59b11d[_0x5a41('0x9')][_0x5a41('0xf')],function(_0x44a8b3){return{'model':db[_0x44a8b3['model']],'as':_0x44a8b3['as'],'attributes':_0x44a8b3['as']===_0x5a41('0x40')?_['keys'](_0x2def82):_0x44a8b3['attributes'],'include':_0x44a8b3[_0x5a41('0xf')]?_[_0x5a41('0xe')](_0x44a8b3[_0x5a41('0xf')],function(_0x35acef){return{'model':db[_0x35acef[_0x5a41('0x10')]],'as':_0x35acef['as'],'attributes':_0x35acef[_0x5a41('0xc')],'include':_0x35acef[_0x5a41('0xf')]?_['map'](_0x35acef[_0x5a41('0xf')],function(_0x1a1a65){return{'model':db[_0x1a1a65['model']],'as':_0x1a1a65['as'],'attributes':_0x1a1a65[_0x5a41('0xc')]};}):[]};}):[]};}):[]:[]})[_0x5a41('0x11')](function(_0x553015){logger['info']('GetCmHopper',_0x59b11d);logger['debug'](_0x5a41('0x6'),_0x59b11d,JSON[_0x5a41('0x13')](_0x553015));_0x4d0fc2(_0x553015);})['catch'](function(_0x2c8034){logger[_0x5a41('0x15')](_0x5a41('0x6'),_0x2c8034[_0x5a41('0x16')],_0x59b11d);_0x2a2740(_0x53e772['error'](0x1f4,_0x2c8034['message']));});});});};exports[_0x5a41('0x41')]=function(_0x2f88ea){var _0x19617e=this;return new Promise(function(_0x10e8ce,_0x3a972b){return db['CmContact'][_0x5a41('0x42')]({'raw':!![],'where':{'phone':_0x2f88ea[_0x5a41('0x9')]['where'][_0x5a41('0x43')]},'attributes':['id',_0x5a41('0x44')],'order':[['id',_0x5a41('0x45')]]})['then'](function(_0x5a8b90){logger[_0x5a41('0x1b')]('getContactByPhone',_0x2f88ea);logger[_0x5a41('0x12')](_0x5a41('0x46'),_0x2f88ea,JSON[_0x5a41('0x13')](_0x5a8b90));_0x10e8ce(_0x5a8b90);})[_0x5a41('0x14')](function(_0x30db28){logger[_0x5a41('0x15')]('getContactByPhone',_0x30db28[_0x5a41('0x16')],_0x2f88ea);_0x3a972b(_0x19617e[_0x5a41('0x15')](0x1f4,_0x30db28['message']));});});};exports['ResetActiveCalls']=function(_0x1948b9){var _0x4409f3=this;return new Promise(function(_0x514b9d,_0x10305e){return db[_0x5a41('0x24')][_0x5a41('0x25')](function(_0x17b9a7){var _0x1b05b7=_0x1948b9[_0x5a41('0x9')]&&_0x1948b9[_0x5a41('0x9')]['where']?_0x1948b9[_0x5a41('0x9')][_0x5a41('0xb')]:{};return db['CmHopper']['update'](_0x1948b9['body'],{'where':_0x1b05b7,'transaction':_0x17b9a7})['then'](function(_0x3e1a89){logger[_0x5a41('0x1b')](_0x5a41('0x47'),_0x1948b9);logger[_0x5a41('0x12')]('ResetActiveCalls',_0x1948b9,JSON['stringify'](_0x3e1a89));_0x514b9d(_0x3e1a89);})[_0x5a41('0x14')](function(_0x4085d1){logger[_0x5a41('0x15')](_0x5a41('0x47'),_0x4085d1[_0x5a41('0x16')],_0x1948b9);_0x10305e(_0x4409f3['error'](0x1f4,_0x4085d1[_0x5a41('0x16')]));});});});};exports['CmHopperHandlePreviewRecallNotifications']=function(_0x4e1475){var _0x2ca371=this;var _0x1590fe=_0x4e1475[_0x5a41('0x1f')][_0x5a41('0xb')]['voiceQueueIds'];var _0x466c27=_0x4e1475[_0x5a41('0x1f')][_0x5a41('0xb')][_0x5a41('0x48')];var _0x54a615=_0x4e1475['body'][_0x5a41('0xb')][_0x5a41('0x49')];return new Promise(function(_0x3af483,_0x5b0aa9){return db[_0x5a41('0x7')]['findAll']({'where':{'voiceQueueId':{'$in':_0x1590fe},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0x5a41('0x24')][_0x5a41('0x33')](_0x5a41('0x4a')+_0x466c27+'\x20MINUTE'),'$gt':db[_0x5a41('0x24')][_0x5a41('0x33')]('NOW()')}},'UserId':{'$in':_0x54a615}},'include':[{'model':db[_0x5a41('0x3b')],'as':_0x5a41('0x40')},{'model':db[_0x5a41('0x28')],'as':_0x5a41('0x29'),'attributes':['id',_0x5a41('0x4b'),_0x5a41('0x2a')]},{'model':db['CmList'],'as':'List'}]})[_0x5a41('0x11')](function(_0x2a0526){if(_0x2a0526[_0x5a41('0x2b')]>0x0){return db['sequelize'][_0x5a41('0x25')](function(_0x4581eb){return db[_0x5a41('0x7')][_0x5a41('0x1d')]({'recallmeNotifiedDate':db['sequelize'][_0x5a41('0x33')](_0x5a41('0x4c'))},{'where':{'id':{'$in':_['map'](_0x2a0526,'id')}},'transaction':_0x4581eb})[_0x5a41('0x11')](function(){_0x3af483(_0x2a0526);})[_0x5a41('0x14')](function(_0x262288){logger[_0x5a41('0x15')](_0x5a41('0x4d'),_0x262288[_0x5a41('0x16')],_0x4e1475);_0x5b0aa9(_0x2ca371['error'](0x1f4,_0x262288['message']));});})[_0x5a41('0x14')](function(_0x5438be){logger[_0x5a41('0x15')](_0x5a41('0x4d'),_0x5438be[_0x5a41('0x16')],_0x4e1475);_0x5b0aa9(_0x2ca371['error'](0x1f4,_0x5438be['message']));});}else{_0x3af483(_0x2a0526);}});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 605c3f0..916dd47 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 _0x55e8=['exports','Router','./cmHopper.controller','get','isAuthenticated','index','/opencontacts','getTimezones','/:id','/:id/previewrecall','getPreviewRecall','post','create','/preview','getPreview','/timezone','getTimezone','delete','destroy'];(function(_0x3c6443,_0xa2d657){var _0x2e3899=function(_0x33329a){while(--_0x33329a){_0x3c6443['push'](_0x3c6443['shift']());}};_0x2e3899(++_0xa2d657);}(_0x55e8,0x16a));var _0x855e=function(_0x3e1234,_0x5377b7){_0x3e1234=_0x3e1234-0x0;var _0x56ac40=_0x55e8[_0x3e1234];return _0x56ac40;};'use strict';var express=require('express');var router=express[_0x855e('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x855e('0x1'));router[_0x855e('0x2')]('/',auth[_0x855e('0x3')](),controller[_0x855e('0x4')]);router['get']('/describe',auth[_0x855e('0x3')](),controller['describe']);router['get'](_0x855e('0x5'),auth[_0x855e('0x3')](),controller['getOpenContacts']);router[_0x855e('0x2')]('/timezones',auth[_0x855e('0x3')](),controller[_0x855e('0x6')]);router[_0x855e('0x2')](_0x855e('0x7'),auth[_0x855e('0x3')](),controller['show']);router[_0x855e('0x2')](_0x855e('0x8'),auth[_0x855e('0x3')](),controller[_0x855e('0x9')]);router[_0x855e('0xa')]('/',auth[_0x855e('0x3')](),controller[_0x855e('0xb')]);router[_0x855e('0xa')](_0x855e('0xc'),auth[_0x855e('0x3')](),controller[_0x855e('0xd')]);router['post'](_0x855e('0xe'),auth[_0x855e('0x3')](),controller[_0x855e('0xf')]);router['put'](_0x855e('0x7'),auth[_0x855e('0x3')](),controller['update']);router[_0x855e('0x10')](_0x855e('0x7'),auth['isAuthenticated'](),controller[_0x855e('0x11')]);module[_0x855e('0x12')]=router; \ No newline at end of file +var _0x5ed0=['getOpenContacts','getTimezones','/:id','show','/:id/previewrecall','create','post','/preview','getPreview','/timezone','getTimezone','put','update','destroy','express','Router','../../components/auth/service','isAuthenticated','index','get','/describe','describe','/opencontacts'];(function(_0x1e0cbf,_0x56256a){var _0x339896=function(_0x411124){while(--_0x411124){_0x1e0cbf['push'](_0x1e0cbf['shift']());}};_0x339896(++_0x56256a);}(_0x5ed0,0x150));var _0x05ed=function(_0x494387,_0x4a8c16){_0x494387=_0x494387-0x0;var _0x2697bb=_0x5ed0[_0x494387];return _0x2697bb;};'use strict';var express=require(_0x05ed('0x0'));var router=express[_0x05ed('0x1')]();var auth=require(_0x05ed('0x2'));var controller=require('./cmHopper.controller');router['get']('/',auth[_0x05ed('0x3')](),controller[_0x05ed('0x4')]);router[_0x05ed('0x5')](_0x05ed('0x6'),auth[_0x05ed('0x3')](),controller[_0x05ed('0x7')]);router['get'](_0x05ed('0x8'),auth[_0x05ed('0x3')](),controller[_0x05ed('0x9')]);router[_0x05ed('0x5')]('/timezones',auth['isAuthenticated'](),controller[_0x05ed('0xa')]);router[_0x05ed('0x5')](_0x05ed('0xb'),auth[_0x05ed('0x3')](),controller[_0x05ed('0xc')]);router[_0x05ed('0x5')](_0x05ed('0xd'),auth['isAuthenticated'](),controller['getPreviewRecall']);router['post']('/',auth[_0x05ed('0x3')](),controller[_0x05ed('0xe')]);router[_0x05ed('0xf')](_0x05ed('0x10'),auth['isAuthenticated'](),controller[_0x05ed('0x11')]);router[_0x05ed('0xf')](_0x05ed('0x12'),auth['isAuthenticated'](),controller[_0x05ed('0x13')]);router[_0x05ed('0x14')](_0x05ed('0xb'),auth[_0x05ed('0x3')](),controller[_0x05ed('0x15')]);router['delete'](_0x05ed('0xb'),auth[_0x05ed('0x3')](),controller[_0x05ed('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js index 28b0fc8..48cd239 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3262=['format','sequelize','INTEGER','DATE'];(function(_0x15fef1,_0x21c57a){var _0x5f50a7=function(_0x320b83){while(--_0x320b83){_0x15fef1['push'](_0x15fef1['shift']());}};_0x5f50a7(++_0x21c57a);}(_0x3262,0xd9));var _0x2326=function(_0x2888a4,_0x1fc157){_0x2888a4=_0x2888a4-0x0;var _0x7f650c=_0x3262[_0x2888a4];return _0x7f650c;};'use strict';var moment=require('moment');var Sequelize=require(_0x2326('0x0'));module['exports']={'CmHopperId':{'type':Sequelize[_0x2326('0x1')]},'phone':{'type':Sequelize['STRING'],'allowNull':![]},'OrderBy':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x2326('0x2')],'defaultValue':moment()[_0x2326('0x3')]('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0x2326('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x2326('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x2326('0x1')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x2326('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x2326('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x2326('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x2326('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xa2fd=['moment','sequelize','exports','INTEGER','STRING','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x1b4b01,_0x43eb55){var _0x521446=function(_0x3767a4){while(--_0x3767a4){_0x1b4b01['push'](_0x1b4b01['shift']());}};_0x521446(++_0x43eb55);}(_0xa2fd,0x12d));var _0xda2f=function(_0x3b55eb,_0x18cbab){_0x3b55eb=_0x3b55eb-0x0;var _0x5cdb2a=_0xa2fd[_0x3b55eb];return _0x5cdb2a;};'use strict';var moment=require(_0xda2f('0x0'));var Sequelize=require(_0xda2f('0x1'));module[_0xda2f('0x2')]={'CmHopperId':{'type':Sequelize[_0xda2f('0x3')]},'phone':{'type':Sequelize[_0xda2f('0x4')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0xda2f('0x3')],'defaultValue':0x0},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()[_0xda2f('0x5')](_0xda2f('0x6'))},'countbusyretry':{'type':Sequelize[_0xda2f('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xda2f('0x3')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0xda2f('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xda2f('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xda2f('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xda2f('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xda2f('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js index 49bba89..1b519b4 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9200=['params','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','save','then','error','stack','name','send','index','map','CmHopperAdditionalPhone','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','include','rows','catch','show','create','user','get','role','UserProfileSection','find','userProfileId','autoAssociation','update','body'];(function(_0x5f2f5d,_0x2acb71){var _0x38acbb=function(_0x4aa0f6){while(--_0x4aa0f6){_0x5f2f5d['push'](_0x5f2f5d['shift']());}};_0x38acbb(++_0x2acb71);}(_0x9200,0x192));var _0x0920=function(_0x48d1f4,_0x96793b){_0x48d1f4=_0x48d1f4-0x0;var _0x3fcc6b=_0x9200[_0x48d1f4];return _0x3fcc6b;};'use strict';var emlformat=require(_0x0920('0x0'));var rimraf=require(_0x0920('0x1'));var zipdir=require(_0x0920('0x2'));var jsonpatch=require(_0x0920('0x3'));var rp=require(_0x0920('0x4'));var moment=require('moment');var BPromise=require(_0x0920('0x5'));var Mustache=require(_0x0920('0x6'));var util=require('util');var path=require(_0x0920('0x7'));var sox=require(_0x0920('0x8'));var csv=require(_0x0920('0x9'));var ejs=require(_0x0920('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0920('0xb'));var squel=require(_0x0920('0xc'));var crypto=require(_0x0920('0xd'));var jsforce=require(_0x0920('0xe'));var deskjs=require(_0x0920('0xf'));var toCsv=require(_0x0920('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x0920('0x10'));var authService=require(_0x0920('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0920('0x12'));var logger=require(_0x0920('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x0920('0x14'));var licenseUtil=require(_0x0920('0x15'));var db=require(_0x0920('0x16'))['db'];function respondWithStatusCode(_0x10a483,_0x2fe4d){_0x2fe4d=_0x2fe4d||0xcc;return function(_0x1457a0){if(_0x1457a0){return _0x10a483[_0x0920('0x17')](_0x2fe4d);}return _0x10a483[_0x0920('0x18')](_0x2fe4d)[_0x0920('0x19')]();};}function respondWithResult(_0xb09497,_0x4e789e){_0x4e789e=_0x4e789e||0xc8;return function(_0x462abc){if(_0x462abc){return _0xb09497[_0x0920('0x18')](_0x4e789e)[_0x0920('0x1a')](_0x462abc);}};}function respondWithFilteredResult(_0x544443,_0x17fe94){return function(_0x4dd1fb){if(_0x4dd1fb){var _0x267210=typeof _0x17fe94['offset']===_0x0920('0x1b')&&typeof _0x17fe94[_0x0920('0x1c')]===_0x0920('0x1b');var _0x5831c9=_0x4dd1fb[_0x0920('0x1d')];var _0x4e41f5=_0x267210?0x0:_0x17fe94[_0x0920('0x1e')];var _0x444cc3=_0x267210?_0x4dd1fb[_0x0920('0x1d')]:_0x17fe94[_0x0920('0x1e')]+_0x17fe94[_0x0920('0x1c')];var _0x54983f;if(_0x444cc3>=_0x5831c9){_0x444cc3=_0x5831c9;_0x54983f=0xc8;}else{_0x54983f=0xce;}_0x544443['status'](_0x54983f);return _0x544443[_0x0920('0x1f')](_0x0920('0x20'),_0x4e41f5+'-'+_0x444cc3+'/'+_0x5831c9)[_0x0920('0x1a')](_0x4dd1fb);}return null;};}function patchUpdates(_0x23c662){return function(_0x23567e){try{jsonpatch[_0x0920('0x21')](_0x23567e,_0x23c662,!![]);}catch(_0x53ad8d){return BPromise['reject'](_0x53ad8d);}return _0x23567e[_0x0920('0x22')]();};}function saveUpdates(_0x3183e1,_0x2673dd){return function(_0x99c1ad){if(_0x99c1ad){return _0x99c1ad['update'](_0x3183e1)[_0x0920('0x23')](function(_0x5c3df9){return _0x5c3df9;});}return null;};}function removeEntity(_0x2eefe3,_0x246cf6){return function(_0x189d44){if(_0x189d44){return _0x189d44['destroy']()[_0x0920('0x23')](function(){var _0x6cc55e=_0x189d44['get']({'plain':!![]});var _0x5dd225='CmHopperAdditionalPhones';return db['UserProfileResource']['destroy']({'where':{'type':_0x5dd225,'resourceId':_0x6cc55e['id']}})[_0x0920('0x23')](function(){return _0x189d44;});})[_0x0920('0x23')](function(){_0x2eefe3[_0x0920('0x18')](0xcc)[_0x0920('0x19')]();});}};}function handleEntityNotFound(_0x33157d,_0x1b5261){return function(_0x5c668f){if(!_0x5c668f){_0x33157d['sendStatus'](0x194);}return _0x5c668f;};}function handleError(_0x23e9fa,_0x4a79a1){_0x4a79a1=_0x4a79a1||0x1f4;return function(_0x3d3bd5){logger[_0x0920('0x24')](_0x3d3bd5[_0x0920('0x25')]);if(_0x3d3bd5['name']){delete _0x3d3bd5[_0x0920('0x26')];}_0x23e9fa['status'](_0x4a79a1)[_0x0920('0x27')](_0x3d3bd5);};}exports[_0x0920('0x28')]=function(_0x47c327,_0x1117f9){var _0x42d34e={},_0x34c39d={},_0x5040be={'count':0x0,'rows':[]};var _0x5a63d2=_[_0x0920('0x29')](db[_0x0920('0x2a')][_0x0920('0x2b')],function(_0x572107){return{'name':_0x572107[_0x0920('0x2c')],'type':_0x572107[_0x0920('0x2d')][_0x0920('0x2e')]};});_0x34c39d[_0x0920('0x2f')]=_[_0x0920('0x29')](_0x5a63d2,'name');_0x34c39d[_0x0920('0x30')]=_[_0x0920('0x31')](_0x47c327[_0x0920('0x30')]);_0x34c39d[_0x0920('0x32')]=_[_0x0920('0x33')](_0x34c39d[_0x0920('0x2f')],_0x34c39d['query']);_0x42d34e[_0x0920('0x34')]=_[_0x0920('0x33')](_0x34c39d[_0x0920('0x2f')],qs[_0x0920('0x35')](_0x47c327[_0x0920('0x30')][_0x0920('0x35')]));_0x42d34e[_0x0920('0x34')]=_0x42d34e[_0x0920('0x34')][_0x0920('0x36')]?_0x42d34e['attributes']:_0x34c39d['model'];if(!_0x47c327[_0x0920('0x30')][_0x0920('0x37')](_0x0920('0x38'))){_0x42d34e['limit']=qs[_0x0920('0x1c')](_0x47c327[_0x0920('0x30')][_0x0920('0x1c')]);_0x42d34e[_0x0920('0x1e')]=qs[_0x0920('0x1e')](_0x47c327['query'][_0x0920('0x1e')]);}_0x42d34e[_0x0920('0x39')]=qs[_0x0920('0x3a')](_0x47c327[_0x0920('0x30')][_0x0920('0x3a')]);_0x42d34e[_0x0920('0x3b')]=qs['filters'](_['pick'](_0x47c327[_0x0920('0x30')],_0x34c39d[_0x0920('0x32')]),_0x5a63d2);if(_0x47c327['query'][_0x0920('0x3c')]){_0x42d34e['where']=_['merge'](_0x42d34e[_0x0920('0x3b')],{'$or':_[_0x0920('0x29')](_0x5a63d2,function(_0x2a2528){if(_0x2a2528[_0x0920('0x2d')]!=='VIRTUAL'){var _0x5a9d67={};_0x5a9d67[_0x2a2528[_0x0920('0x26')]]={'$like':'%'+_0x47c327[_0x0920('0x30')][_0x0920('0x3c')]+'%'};return _0x5a9d67;}})});}_0x42d34e=_[_0x0920('0x3d')]({},_0x42d34e,_0x47c327[_0x0920('0x3e')]);var _0x2a33e2={'where':_0x42d34e[_0x0920('0x3b')]};return db[_0x0920('0x2a')][_0x0920('0x1d')](_0x2a33e2)[_0x0920('0x23')](function(_0x6466){_0x5040be[_0x0920('0x1d')]=_0x6466;if(_0x47c327[_0x0920('0x30')][_0x0920('0x3f')]){_0x42d34e[_0x0920('0x40')]=[{'all':!![]}];}return db[_0x0920('0x2a')]['findAll'](_0x42d34e);})[_0x0920('0x23')](function(_0x45438e){_0x5040be[_0x0920('0x41')]=_0x45438e;return _0x5040be;})['then'](respondWithFilteredResult(_0x1117f9,_0x42d34e))[_0x0920('0x42')](handleError(_0x1117f9,null));};exports[_0x0920('0x43')]=function(_0x24218a,_0x426c70){var _0x5c5629={'raw':!![],'where':{'id':_0x24218a['params']['id']}},_0x420746={};_0x420746[_0x0920('0x2f')]=_[_0x0920('0x31')](db['CmHopperAdditionalPhone']['rawAttributes']);_0x420746[_0x0920('0x30')]=_[_0x0920('0x31')](_0x24218a[_0x0920('0x30')]);_0x420746[_0x0920('0x32')]=_[_0x0920('0x33')](_0x420746[_0x0920('0x2f')],_0x420746['query']);_0x5c5629[_0x0920('0x34')]=_[_0x0920('0x33')](_0x420746[_0x0920('0x2f')],qs[_0x0920('0x35')](_0x24218a[_0x0920('0x30')]['fields']));_0x5c5629[_0x0920('0x34')]=_0x5c5629[_0x0920('0x34')][_0x0920('0x36')]?_0x5c5629[_0x0920('0x34')]:_0x420746[_0x0920('0x2f')];if(_0x24218a[_0x0920('0x30')]['includeAll']){_0x5c5629[_0x0920('0x40')]=[{'all':!![]}];}_0x5c5629=_[_0x0920('0x3d')]({},_0x5c5629,_0x24218a[_0x0920('0x3e')]);return db[_0x0920('0x2a')]['find'](_0x5c5629)['then'](handleEntityNotFound(_0x426c70,null))['then'](respondWithResult(_0x426c70,null))[_0x0920('0x42')](handleError(_0x426c70,null));};exports[_0x0920('0x44')]=function(_0x394227,_0x16d71f){return db['CmHopperAdditionalPhone'][_0x0920('0x44')](_0x394227['body'],{})[_0x0920('0x23')](function(_0x5095bb){var _0x3c8bb8=_0x394227[_0x0920('0x45')][_0x0920('0x46')]({'plain':!![]});if(!_0x3c8bb8)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3c8bb8[_0x0920('0x47')]===_0x0920('0x45')){var _0x5f3c2e=_0x5095bb['get']({'plain':!![]});var _0x2a2940='CmHopperAdditionalPhones';return db[_0x0920('0x48')][_0x0920('0x49')]({'where':{'name':_0x2a2940,'userProfileId':_0x3c8bb8[_0x0920('0x4a')]},'raw':!![]})[_0x0920('0x23')](function(_0x1857fb){if(_0x1857fb&&_0x1857fb[_0x0920('0x4b')]===0x0){return db['UserProfileResource'][_0x0920('0x44')]({'name':_0x5f3c2e[_0x0920('0x26')],'resourceId':_0x5f3c2e['id'],'type':_0x1857fb[_0x0920('0x26')],'sectionId':_0x1857fb['id']},{})[_0x0920('0x23')](function(){return _0x5095bb;});}else{return _0x5095bb;}})[_0x0920('0x42')](function(_0x31dd10){logger[_0x0920('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x31dd10);throw _0x31dd10;});}return _0x5095bb;})['then'](respondWithResult(_0x16d71f,0xc9))[_0x0920('0x42')](handleError(_0x16d71f,null));};exports[_0x0920('0x4c')]=function(_0x2f28af,_0x396532){if(_0x2f28af['body']['id']){delete _0x2f28af[_0x0920('0x4d')]['id'];}return db['CmHopperAdditionalPhone']['find']({'where':{'id':_0x2f28af[_0x0920('0x4e')]['id']}})[_0x0920('0x23')](handleEntityNotFound(_0x396532,null))['then'](saveUpdates(_0x2f28af[_0x0920('0x4d')],null))[_0x0920('0x23')](respondWithResult(_0x396532,null))[_0x0920('0x42')](handleError(_0x396532,null));};exports[_0x0920('0x4f')]=function(_0x4d4063,_0x258a22){return db['CmHopperAdditionalPhone'][_0x0920('0x49')]({'where':{'id':_0x4d4063['params']['id']}})[_0x0920('0x23')](handleEntityNotFound(_0x258a22,null))[_0x0920('0x23')](removeEntity(_0x258a22,null))[_0x0920('0x42')](handleError(_0x258a22,null));}; \ No newline at end of file +var _0x7ab7=['stack','name','map','CmHopperAdditionalPhone','type','key','model','keys','query','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','catch','show','rawAttributes','includeAll','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','CmHopperAdditionalPhones','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','fs-extra','lodash','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','get','UserProfileResource','destroy','error'];(function(_0x4a743d,_0x530094){var _0x53d6ea=function(_0x567504){while(--_0x567504){_0x4a743d['push'](_0x4a743d['shift']());}};_0x53d6ea(++_0x530094);}(_0x7ab7,0x163));var _0x77ab=function(_0x59467b,_0x1fe071){_0x59467b=_0x59467b-0x0;var _0x31a10f=_0x7ab7[_0x59467b];return _0x31a10f;};'use strict';var emlformat=require(_0x77ab('0x0'));var rimraf=require(_0x77ab('0x1'));var zipdir=require(_0x77ab('0x2'));var jsonpatch=require(_0x77ab('0x3'));var rp=require(_0x77ab('0x4'));var moment=require(_0x77ab('0x5'));var BPromise=require(_0x77ab('0x6'));var Mustache=require(_0x77ab('0x7'));var util=require(_0x77ab('0x8'));var path=require('path');var sox=require(_0x77ab('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x77ab('0xa'));var _=require(_0x77ab('0xb'));var squel=require(_0x77ab('0xc'));var crypto=require(_0x77ab('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x77ab('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x77ab('0xf'));var Redis=require('ioredis');var authService=require(_0x77ab('0x10'));var qs=require(_0x77ab('0x11'));var as=require(_0x77ab('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x77ab('0x13'))(_0x77ab('0x14'));var utils=require(_0x77ab('0x15'));var config=require(_0x77ab('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x22e39b,_0x344e46){_0x344e46=_0x344e46||0xcc;return function(_0x2d9001){if(_0x2d9001){return _0x22e39b['sendStatus'](_0x344e46);}return _0x22e39b[_0x77ab('0x17')](_0x344e46)[_0x77ab('0x18')]();};}function respondWithResult(_0x172fe2,_0xbcc76e){_0xbcc76e=_0xbcc76e||0xc8;return function(_0x5e5ba3){if(_0x5e5ba3){return _0x172fe2[_0x77ab('0x17')](_0xbcc76e)[_0x77ab('0x19')](_0x5e5ba3);}};}function respondWithFilteredResult(_0x57b117,_0x1e8545){return function(_0x211eb8){if(_0x211eb8){var _0x33dfbd=typeof _0x1e8545[_0x77ab('0x1a')]===_0x77ab('0x1b')&&typeof _0x1e8545[_0x77ab('0x1c')]==='undefined';var _0x452afc=_0x211eb8[_0x77ab('0x1d')];var _0x5dd60b=_0x33dfbd?0x0:_0x1e8545['offset'];var _0x257e98=_0x33dfbd?_0x211eb8[_0x77ab('0x1d')]:_0x1e8545['offset']+_0x1e8545[_0x77ab('0x1c')];var _0x31de7a;if(_0x257e98>=_0x452afc){_0x257e98=_0x452afc;_0x31de7a=0xc8;}else{_0x31de7a=0xce;}_0x57b117['status'](_0x31de7a);return _0x57b117[_0x77ab('0x1e')]('Content-Range',_0x5dd60b+'-'+_0x257e98+'/'+_0x452afc)['json'](_0x211eb8);}return null;};}function patchUpdates(_0x1f7b48){return function(_0x4285d9){try{jsonpatch[_0x77ab('0x1f')](_0x4285d9,_0x1f7b48,!![]);}catch(_0x3e7b66){return BPromise[_0x77ab('0x20')](_0x3e7b66);}return _0x4285d9[_0x77ab('0x21')]();};}function saveUpdates(_0x2187be,_0x403f89){return function(_0x59bc36){if(_0x59bc36){return _0x59bc36[_0x77ab('0x22')](_0x2187be)[_0x77ab('0x23')](function(_0x31bb3c){return _0x31bb3c;});}return null;};}function removeEntity(_0x53c9af,_0x53d68e){return function(_0x49c4de){if(_0x49c4de){return _0x49c4de['destroy']()[_0x77ab('0x23')](function(){var _0x3aeab6=_0x49c4de[_0x77ab('0x24')]({'plain':!![]});var _0x4bfaa1='CmHopperAdditionalPhones';return db[_0x77ab('0x25')][_0x77ab('0x26')]({'where':{'type':_0x4bfaa1,'resourceId':_0x3aeab6['id']}})['then'](function(){return _0x49c4de;});})['then'](function(){_0x53c9af[_0x77ab('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ebfff,_0x263bbf){return function(_0x3b2b67){if(!_0x3b2b67){_0x2ebfff['sendStatus'](0x194);}return _0x3b2b67;};}function handleError(_0x2e6d31,_0x57f11d){_0x57f11d=_0x57f11d||0x1f4;return function(_0x15b04d){logger[_0x77ab('0x27')](_0x15b04d[_0x77ab('0x28')]);if(_0x15b04d[_0x77ab('0x29')]){delete _0x15b04d[_0x77ab('0x29')];}_0x2e6d31[_0x77ab('0x17')](_0x57f11d)['send'](_0x15b04d);};}exports['index']=function(_0x229e33,_0x4e604c){var _0x46d183={},_0x292b5b={},_0x2e62dd={'count':0x0,'rows':[]};var _0x4a6b32=_[_0x77ab('0x2a')](db[_0x77ab('0x2b')]['rawAttributes'],function(_0xe2dc0f){return{'name':_0xe2dc0f['fieldName'],'type':_0xe2dc0f[_0x77ab('0x2c')][_0x77ab('0x2d')]};});_0x292b5b[_0x77ab('0x2e')]=_[_0x77ab('0x2a')](_0x4a6b32,'name');_0x292b5b['query']=_[_0x77ab('0x2f')](_0x229e33[_0x77ab('0x30')]);_0x292b5b[_0x77ab('0x31')]=_[_0x77ab('0x32')](_0x292b5b[_0x77ab('0x2e')],_0x292b5b['query']);_0x46d183[_0x77ab('0x33')]=_[_0x77ab('0x32')](_0x292b5b[_0x77ab('0x2e')],qs[_0x77ab('0x34')](_0x229e33[_0x77ab('0x30')][_0x77ab('0x34')]));_0x46d183[_0x77ab('0x33')]=_0x46d183[_0x77ab('0x33')]['length']?_0x46d183[_0x77ab('0x33')]:_0x292b5b[_0x77ab('0x2e')];if(!_0x229e33['query']['hasOwnProperty'](_0x77ab('0x35'))){_0x46d183['limit']=qs[_0x77ab('0x1c')](_0x229e33[_0x77ab('0x30')][_0x77ab('0x1c')]);_0x46d183[_0x77ab('0x1a')]=qs[_0x77ab('0x1a')](_0x229e33[_0x77ab('0x30')][_0x77ab('0x1a')]);}_0x46d183[_0x77ab('0x36')]=qs[_0x77ab('0x37')](_0x229e33[_0x77ab('0x30')]['sort']);_0x46d183[_0x77ab('0x38')]=qs[_0x77ab('0x31')](_[_0x77ab('0x39')](_0x229e33[_0x77ab('0x30')],_0x292b5b[_0x77ab('0x31')]),_0x4a6b32);if(_0x229e33[_0x77ab('0x30')][_0x77ab('0x3a')]){_0x46d183[_0x77ab('0x38')]=_[_0x77ab('0x3b')](_0x46d183['where'],{'$or':_[_0x77ab('0x2a')](_0x4a6b32,function(_0x387b90){if(_0x387b90[_0x77ab('0x2c')]!==_0x77ab('0x3c')){var _0x4bac58={};_0x4bac58[_0x387b90[_0x77ab('0x29')]]={'$like':'%'+_0x229e33[_0x77ab('0x30')]['filter']+'%'};return _0x4bac58;}})});}_0x46d183=_[_0x77ab('0x3b')]({},_0x46d183,_0x229e33[_0x77ab('0x3d')]);var _0x3d5d5f={'where':_0x46d183[_0x77ab('0x38')]};return db[_0x77ab('0x2b')]['count'](_0x3d5d5f)['then'](function(_0x2ee2cf){_0x2e62dd[_0x77ab('0x1d')]=_0x2ee2cf;if(_0x229e33[_0x77ab('0x30')]['includeAll']){_0x46d183[_0x77ab('0x3e')]=[{'all':!![]}];}return db[_0x77ab('0x2b')]['findAll'](_0x46d183);})[_0x77ab('0x23')](function(_0x213196){_0x2e62dd['rows']=_0x213196;return _0x2e62dd;})[_0x77ab('0x23')](respondWithFilteredResult(_0x4e604c,_0x46d183))[_0x77ab('0x3f')](handleError(_0x4e604c,null));};exports[_0x77ab('0x40')]=function(_0x530ddb,_0x316660){var _0x2fc8e8={'raw':!![],'where':{'id':_0x530ddb['params']['id']}},_0x993839={};_0x993839[_0x77ab('0x2e')]=_['keys'](db[_0x77ab('0x2b')][_0x77ab('0x41')]);_0x993839[_0x77ab('0x30')]=_[_0x77ab('0x2f')](_0x530ddb[_0x77ab('0x30')]);_0x993839[_0x77ab('0x31')]=_[_0x77ab('0x32')](_0x993839[_0x77ab('0x2e')],_0x993839[_0x77ab('0x30')]);_0x2fc8e8[_0x77ab('0x33')]=_[_0x77ab('0x32')](_0x993839[_0x77ab('0x2e')],qs[_0x77ab('0x34')](_0x530ddb['query'][_0x77ab('0x34')]));_0x2fc8e8[_0x77ab('0x33')]=_0x2fc8e8['attributes']['length']?_0x2fc8e8['attributes']:_0x993839[_0x77ab('0x2e')];if(_0x530ddb['query'][_0x77ab('0x42')]){_0x2fc8e8['include']=[{'all':!![]}];}_0x2fc8e8=_['merge']({},_0x2fc8e8,_0x530ddb[_0x77ab('0x3d')]);return db[_0x77ab('0x2b')][_0x77ab('0x43')](_0x2fc8e8)[_0x77ab('0x23')](handleEntityNotFound(_0x316660,null))[_0x77ab('0x23')](respondWithResult(_0x316660,null))[_0x77ab('0x3f')](handleError(_0x316660,null));};exports['create']=function(_0x52594d,_0x1691a5){return db[_0x77ab('0x2b')]['create'](_0x52594d[_0x77ab('0x44')],{})[_0x77ab('0x23')](function(_0x215ef2){var _0x1ded24=_0x52594d[_0x77ab('0x45')]['get']({'plain':!![]});if(!_0x1ded24)throw new Error(_0x77ab('0x46'));if(_0x1ded24[_0x77ab('0x47')]===_0x77ab('0x45')){var _0x55cab5=_0x215ef2[_0x77ab('0x24')]({'plain':!![]});var _0x57e8c5=_0x77ab('0x48');return db[_0x77ab('0x49')][_0x77ab('0x43')]({'where':{'name':_0x57e8c5,'userProfileId':_0x1ded24[_0x77ab('0x4a')]},'raw':!![]})[_0x77ab('0x23')](function(_0x5ed007){if(_0x5ed007&&_0x5ed007[_0x77ab('0x4b')]===0x0){return db['UserProfileResource'][_0x77ab('0x4c')]({'name':_0x55cab5[_0x77ab('0x29')],'resourceId':_0x55cab5['id'],'type':_0x5ed007[_0x77ab('0x29')],'sectionId':_0x5ed007['id']},{})['then'](function(){return _0x215ef2;});}else{return _0x215ef2;}})[_0x77ab('0x3f')](function(_0x3c64a5){logger[_0x77ab('0x27')](_0x77ab('0x4d'),_0x3c64a5);throw _0x3c64a5;});}return _0x215ef2;})['then'](respondWithResult(_0x1691a5,0xc9))[_0x77ab('0x3f')](handleError(_0x1691a5,null));};exports[_0x77ab('0x22')]=function(_0xe8cf91,_0x26d07b){if(_0xe8cf91[_0x77ab('0x44')]['id']){delete _0xe8cf91[_0x77ab('0x44')]['id'];}return db[_0x77ab('0x2b')][_0x77ab('0x43')]({'where':{'id':_0xe8cf91[_0x77ab('0x4e')]['id']}})['then'](handleEntityNotFound(_0x26d07b,null))['then'](saveUpdates(_0xe8cf91[_0x77ab('0x44')],null))[_0x77ab('0x23')](respondWithResult(_0x26d07b,null))[_0x77ab('0x3f')](handleError(_0x26d07b,null));};exports[_0x77ab('0x26')]=function(_0x2a1432,_0x502c97){return db['CmHopperAdditionalPhone']['find']({'where':{'id':_0x2a1432[_0x77ab('0x4e')]['id']}})[_0x77ab('0x23')](handleEntityNotFound(_0x502c97,null))[_0x77ab('0x23')](removeEntity(_0x502c97,null))[_0x77ab('0x3f')](handleError(_0x502c97,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index 7351384..081c816 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa6fb=['api','moment','bluebird','request-promise','./cmHopperAdditionalPhone.attributes','CmHopperAdditionalPhone','cm_hopper_additional_phones','lodash','util','../../config/logger'];(function(_0x2df507,_0x553862){var _0x1f7167=function(_0x11319e){while(--_0x11319e){_0x2df507['push'](_0x2df507['shift']());}};_0x1f7167(++_0x553862);}(_0xa6fb,0x13d));var _0xba6f=function(_0x4b982f,_0x235dfb){_0x4b982f=_0x4b982f-0x0;var _0x5afa0f=_0xa6fb[_0x4b982f];return _0x5afa0f;};'use strict';var _=require(_0xba6f('0x0'));var util=require(_0xba6f('0x1'));var logger=require(_0xba6f('0x2'))(_0xba6f('0x3'));var moment=require(_0xba6f('0x4'));var BPromise=require(_0xba6f('0x5'));var rp=require(_0xba6f('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xba6f('0x7'));module['exports']=function(_0x3b6e89,_0x3cb9d4){return _0x3b6e89['define'](_0xba6f('0x8'),attributes,{'tableName':_0xba6f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x56e6=['exports','CmHopperAdditionalPhone','cm_hopper_additional_phones','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./cmHopperAdditionalPhone.attributes'];(function(_0x43ed53,_0x529fd6){var _0x674257=function(_0x5dee90){while(--_0x5dee90){_0x43ed53['push'](_0x43ed53['shift']());}};_0x674257(++_0x529fd6);}(_0x56e6,0x6b));var _0x656e=function(_0x1c4903,_0x2c8ecd){_0x1c4903=_0x1c4903-0x0;var _0x1f0af5=_0x56e6[_0x1c4903];return _0x1f0af5;};'use strict';var _=require(_0x656e('0x0'));var util=require(_0x656e('0x1'));var logger=require(_0x656e('0x2'))(_0x656e('0x3'));var moment=require(_0x656e('0x4'));var BPromise=require(_0x656e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x656e('0x6'));var rimraf=require(_0x656e('0x7'));var config=require(_0x656e('0x8'));var attributes=require(_0x656e('0x9'));module[_0x656e('0xa')]=function(_0x3fef98,_0x81c232){return _0x3fef98['define'](_0x656e('0xb'),attributes,{'tableName':_0x656e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js index 20ddb77..7428e95 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0a1c=['error','code','message','result','catch','VerifyAdditionalPhones','CmHopper','findOne','ContactId','body','ListId','VoiceQueueId','CampaignId','then','CmHopperAdditionalPhone','OrderBy','ASC','countbusyretry','countcongestionretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','entity','countnoanswerretry','dialGlobalMaxRetry','SwapAdditionalPhones','duration','waitTime','isNil','scheduledat','add','minutes','phone','createdAt','update','activateAdditionalPhone','IncrementPreviewCounters','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','info','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent'];(function(_0x3e697c,_0x459b86){var _0x34121d=function(_0x28646e){while(--_0x28646e){_0x3e697c['push'](_0x3e697c['shift']());}};_0x34121d(++_0x459b86);}(_0x0a1c,0x1cf));var _0xc0a1=function(_0x1e6659,_0x1f860c){_0x1e6659=_0x1e6659-0x0;var _0x4d16e4=_0x0a1c[_0x1e6659];return _0x4d16e4;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xc0a1('0x0'));var BPromise=require(_0xc0a1('0x1'));var rs=require(_0xc0a1('0x2'));var fs=require('fs');var Redis=require(_0xc0a1('0x3'));var db=require(_0xc0a1('0x4'))['db'];var utils=require(_0xc0a1('0x5'));var logger=require(_0xc0a1('0x6'))(_0xc0a1('0x7'));var config=require(_0xc0a1('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xc0a1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5aa7a2,_0x29d99c,_0xc37649){return new BPromise(function(_0x5567b6,_0x59bba8){return client[_0xc0a1('0xa')](_0x5aa7a2,_0xc37649)['then'](function(_0x5c64f6){logger[_0xc0a1('0xb')](_0xc0a1('0xc'),_0x29d99c,_0xc0a1('0xd'));logger['debug']('CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s',_0x29d99c,_0xc0a1('0xd'),JSON['stringify'](_0x5c64f6));if(_0x5c64f6['error']){if(_0x5c64f6[_0xc0a1('0xe')][_0xc0a1('0xf')]===0x1f4){logger[_0xc0a1('0xe')](_0xc0a1('0xc'),_0x29d99c,_0x5c64f6[_0xc0a1('0xe')][_0xc0a1('0x10')]);return _0x59bba8(_0x5c64f6[_0xc0a1('0xe')]['message']);}logger[_0xc0a1('0xe')](_0xc0a1('0xc'),_0x29d99c,_0x5c64f6[_0xc0a1('0xe')][_0xc0a1('0x10')]);return _0x5567b6(_0x5c64f6['error']['message']);}else{logger[_0xc0a1('0xb')](_0xc0a1('0xc'),_0x29d99c,_0xc0a1('0xd'));_0x5567b6(_0x5c64f6[_0xc0a1('0x11')]['message']);}})[_0xc0a1('0x12')](function(_0x486f0e){logger['error'](_0xc0a1('0xc'),_0x29d99c,_0x486f0e);_0x59bba8(_0x486f0e);});});}exports[_0xc0a1('0x13')]=function(_0x57aed3){var _0x2f0ad1=this;return new Promise(function(_0x3d272d,_0x21c410){return db[_0xc0a1('0x14')][_0xc0a1('0x15')]({'raw':!![],'where':{'ContactId':_0x57aed3['body'][_0xc0a1('0x16')],'ListId':_0x57aed3[_0xc0a1('0x17')][_0xc0a1('0x18')],'VoiceQueueId':_0x57aed3[_0xc0a1('0x17')][_0xc0a1('0x19')]===undefined?null:_0x57aed3[_0xc0a1('0x17')]['VoiceQueueId'],'CampaignId':_0x57aed3[_0xc0a1('0x17')]['CampaignId']===undefined?null:_0x57aed3[_0xc0a1('0x17')][_0xc0a1('0x1a')]}})[_0xc0a1('0x1b')](function(_0x46ca77){if(_0x46ca77!=null){return db[_0xc0a1('0x1c')][_0xc0a1('0x15')]({'raw':!![],'where':{'CmHopperId':_0x46ca77['id'],'OrderBy':{'$gt':_0x46ca77[_0xc0a1('0x1d')]}},'order':[[_0xc0a1('0x1d'),_0xc0a1('0x1e')]]})[_0xc0a1('0x1b')](function(_0x28823d){var _0x4d6e14=0x0;if(_0x28823d){if(_0x28823d[_0xc0a1('0x1f')]+_0x28823d[_0xc0a1('0x20')]+_0x28823d['countnoanswerretry']+_0x28823d[_0xc0a1('0x21')]+_0x28823d[_0xc0a1('0x22')]+_0x28823d[_0xc0a1('0x23')]+_0x28823d[_0xc0a1('0x24')]+_0x28823d[_0xc0a1('0x25')]<_0x57aed3[_0xc0a1('0x26')]['dialGlobalMaxRetry'])_0x4d6e14=0x1;_0x3d272d({'additional':_0x4d6e14});}else{return db['CmHopperAdditionalPhone']['findOne']({'raw':!![],'where':{'CmHopperId':_0x46ca77['id']},'order':[[_0xc0a1('0x1d'),'ASC']]})[_0xc0a1('0x1b')](function(_0x3823c9){var _0x51a179=0x0;if(_0x3823c9){if(_0x3823c9['countbusyretry']+_0x3823c9[_0xc0a1('0x20')]+_0x3823c9[_0xc0a1('0x27')]+_0x3823c9[_0xc0a1('0x21')]+_0x3823c9[_0xc0a1('0x22')]+_0x3823c9[_0xc0a1('0x23')]+_0x3823c9['countmachineretry']+_0x3823c9[_0xc0a1('0x25')]<_0x57aed3[_0xc0a1('0x26')][_0xc0a1('0x28')])_0x51a179=0x1;_0x3d272d({'additional':_0x51a179});}else{_0x3d272d({'additional':0x0});}})[_0xc0a1('0x12')](function(_0x1ffc83){logger[_0xc0a1('0xe')]('VerifyAdditionalPhones',_0x1ffc83['message']);_0x21c410(_0x2f0ad1[_0xc0a1('0xe')](0x1f4,_0x1ffc83[_0xc0a1('0x10')]));});}})[_0xc0a1('0x12')](function(_0x207b3e){logger[_0xc0a1('0xe')](_0xc0a1('0x13'),_0x207b3e[_0xc0a1('0x10')]);_0x21c410(_0x2f0ad1['error'](0x1f4,_0x207b3e['message']));});}else _0x3d272d({'additional':0x0});});});};exports[_0xc0a1('0x29')]=function(_0x1e9e96){var _0x1c0840=this;return new Promise(function(_0x18aeea,_0x4190dc){return db[_0xc0a1('0x14')][_0xc0a1('0x15')]({'raw':!![],'where':{'ContactId':_0x1e9e96[_0xc0a1('0x17')][_0xc0a1('0x16')],'ListId':_0x1e9e96[_0xc0a1('0x17')][_0xc0a1('0x18')],'VoiceQueueId':_0x1e9e96[_0xc0a1('0x17')][_0xc0a1('0x19')]===undefined?null:_0x1e9e96[_0xc0a1('0x17')][_0xc0a1('0x19')],'CampaignId':_0x1e9e96[_0xc0a1('0x17')][_0xc0a1('0x1a')]===undefined?null:_0x1e9e96['body'][_0xc0a1('0x1a')]}})[_0xc0a1('0x1b')](function(_0x326b30){if(_0x326b30!=null){return db['CmHopperAdditionalPhone'][_0xc0a1('0x15')]({'raw':!![],'where':{'CmHopperId':_0x326b30['id'],'OrderBy':{'$gte':_0x326b30['OrderBy']}},'order':[[_0xc0a1('0x1d'),'ASC']]})['then'](function(_0xa2dd9e){if(_0xa2dd9e)return activateAdditionalPhone(_0x326b30,_0x1e9e96[_0xc0a1('0x17')],_0xa2dd9e,_0x1e9e96['duration'],_0x1e9e96['waitTime'])[_0xc0a1('0x1b')](function(_0x445fc8){_0x18aeea(_0x445fc8);});else{return db[_0xc0a1('0x1c')][_0xc0a1('0x15')]({'raw':!![],'where':{'CmHopperId':_0x326b30['id']},'order':[[_0xc0a1('0x1d'),_0xc0a1('0x1e')]]})['then'](function(_0x97013e){if(_0x97013e)return activateAdditionalPhone(_0x326b30,_0x1e9e96[_0xc0a1('0x17')],_0x97013e,_0x1e9e96[_0xc0a1('0x2a')],_0x1e9e96[_0xc0a1('0x2b')])[_0xc0a1('0x1b')](function(_0x55f310){_0x18aeea(_0x55f310);});else{_0x18aeea({'id':_0x326b30['id'],'phone':''});}})[_0xc0a1('0x12')](function(_0xb0b40e){logger[_0xc0a1('0xe')](_0xc0a1('0x13'),_0xb0b40e[_0xc0a1('0x10')]);_0x4190dc(_0x1c0840['error'](0x1f4,_0xb0b40e[_0xc0a1('0x10')]));});}})[_0xc0a1('0x12')](function(_0x50315e){logger[_0xc0a1('0xe')](_0xc0a1('0x13'),_0x50315e[_0xc0a1('0x10')]);_0x4190dc(_0x1c0840['error'](0x1f4,_0x50315e[_0xc0a1('0x10')]));});}else _0x18aeea(0x1);});});};function activateAdditionalPhone(_0x1a6216,_0x17806a,_0x4ceefa,_0x256c0b,_0x5515db){return new Promise(function(_0x509b6c,_0x39fd9f){var _0x133c45;if(_[_0xc0a1('0x2c')](_0x4ceefa[_0xc0a1('0x2d')])){_0x4ceefa[_0xc0a1('0x2d')]=moment();}if(moment()>moment(_0x4ceefa[_0xc0a1('0x2d')])){_0x133c45=moment()[_0xc0a1('0x2e')](_0x5515db||0x3,_0xc0a1('0x2f'));}else{if(_0x4ceefa[_0xc0a1('0x1d')]==0x0){_0x133c45=moment(_0x4ceefa[_0xc0a1('0x2d')]);}else{_0x133c45=moment()[_0xc0a1('0x2e')](_0x5515db||0x3,_0xc0a1('0x2f'));}}if(_['isNil'](_0x133c45)){_0x133c45=moment()[_0xc0a1('0x2e')](_0x5515db||0x3,_0xc0a1('0x2f'));}var _0x5bc264={'phone':_0x1a6216['phone'],'active':0x0,'OrderBy':_['isNil'](_0x1a6216[_0xc0a1('0x1d')])?0x0:_0x1a6216[_0xc0a1('0x1d')],'scheduledat':moment()[_0xc0a1('0x2e')](_0x256c0b||0x1,_0xc0a1('0x2f')),'countbusyretry':_0x17806a[_0xc0a1('0x1f')],'countcongestionretry':_0x17806a[_0xc0a1('0x20')],'countnoanswerretry':_0x17806a[_0xc0a1('0x27')],'countnosuchnumberretry':_0x17806a[_0xc0a1('0x21')],'countdropretry':_0x17806a['countdropretry'],'countabandonedretry':_0x17806a[_0xc0a1('0x23')],'countmachineretry':_0x17806a[_0xc0a1('0x24')],'countagentrejectretry':_0x17806a[_0xc0a1('0x25')],'createdAt':_0x17806a['createdAt'],'updatedAt':_0x17806a['updatedAt']};var _0x3e441e={'CmHopperId':_0x1a6216['id'],'phone':_0x4ceefa[_0xc0a1('0x30')],'active':0x0,'OrderBy':_[_0xc0a1('0x2c')](_0x4ceefa['OrderBy'])?0x0:_0x4ceefa[_0xc0a1('0x1d')],'scheduledat':_0x133c45,'countbusyretry':_0x4ceefa[_0xc0a1('0x1f')],'countcongestionretry':_0x4ceefa[_0xc0a1('0x20')],'countnoanswerretry':_0x4ceefa[_0xc0a1('0x27')],'countnosuchnumberretry':_0x4ceefa[_0xc0a1('0x21')],'countdropretry':_0x4ceefa['countdropretry'],'countabandonedretry':_0x4ceefa[_0xc0a1('0x23')],'countmachineretry':_0x4ceefa['countmachineretry'],'countagentrejectretry':_0x4ceefa[_0xc0a1('0x25')],'createdAt':_0x4ceefa[_0xc0a1('0x31')],'updatedAt':_0x4ceefa['updatedAt']};return db['sequelize']['transaction'](function(_0x169fd7){return db[_0xc0a1('0x1c')][_0xc0a1('0x32')](_0x5bc264,{'where':{'id':_0x4ceefa['id']}},{'transaction':_0x169fd7})['then'](function(){return db['CmHopper'][_0xc0a1('0x32')](_0x3e441e,{'where':{'id':_0x1a6216['id']}},{'transaction':_0x169fd7});});})[_0xc0a1('0x1b')](function(_0x5cfc8e){_0x509b6c({'id':_0x1a6216['id'],'phone':_0x4ceefa['phone']});})[_0xc0a1('0x12')](function(_0x18c89f){logger[_0xc0a1('0xe')](_0xc0a1('0x33'),_0x18c89f[_0xc0a1('0x10')]);_0x39fd9f({'error':_0x18c89f[_0xc0a1('0x10')]});});});}exports[_0xc0a1('0x34')]=function(_0x42a4e4){var _0x507b0f=this;return new Promise(function(_0x4820d0,_0x1aa2dc){return db['CmHopper']['update'](_0x42a4e4['body']['field'],{'where':{'id':_0x42a4e4['body']['id']}})[_0xc0a1('0x1b')](function(_0x4e67de){_0x4820d0(_0x4e67de);})[_0xc0a1('0x12')](function(_0x12f247){logger[_0xc0a1('0xe')](_0xc0a1('0x34'),_0x12f247[_0xc0a1('0x10')]);_0x1aa2dc(_0x507b0f[_0xc0a1('0xe')](0x1f4,_0x12f247['message']));});});}; \ No newline at end of file +var _0xd4c6=['CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','VerifyAdditionalPhones','CmHopper','findOne','body','ContactId','ListId','VoiceQueueId','CampaignId','CmHopperAdditionalPhone','OrderBy','ASC','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry','countmachineretry','countagentrejectretry','entity','dialGlobalMaxRetry','countnosuchnumberretry','countabandonedretry','SwapAdditionalPhones','duration','waitTime','isNil','scheduledat','minutes','add','phone','updatedAt','createdAt','update','IncrementPreviewCounters','field','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x5db26f,_0x5e845e){var _0x1a4d29=function(_0x577138){while(--_0x577138){_0x5db26f['push'](_0x5db26f['shift']());}};_0x1a4d29(++_0x5e845e);}(_0xd4c6,0x9c));var _0x6d4c=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xd4c6[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x6d4c('0x0'));var util=require('util');var moment=require(_0x6d4c('0x1'));var BPromise=require(_0x6d4c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6d4c('0x3'));var db=require(_0x6d4c('0x4'))['db'];var utils=require(_0x6d4c('0x5'));var logger=require(_0x6d4c('0x6'))(_0x6d4c('0x7'));var config=require(_0x6d4c('0x8'));var jayson=require(_0x6d4c('0x9'));var client=jayson[_0x6d4c('0xa')][_0x6d4c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x280861,_0x449b7f,_0x53d0b9){return new BPromise(function(_0x4dd4df,_0x43ad4d){return client[_0x6d4c('0xc')](_0x280861,_0x53d0b9)[_0x6d4c('0xd')](function(_0x512e12){logger[_0x6d4c('0xe')](_0x6d4c('0xf'),_0x449b7f,_0x6d4c('0x10'));logger[_0x6d4c('0x11')]('CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s',_0x449b7f,_0x6d4c('0x10'),JSON['stringify'](_0x512e12));if(_0x512e12[_0x6d4c('0x12')]){if(_0x512e12['error'][_0x6d4c('0x13')]===0x1f4){logger['error'](_0x6d4c('0xf'),_0x449b7f,_0x512e12[_0x6d4c('0x12')][_0x6d4c('0x14')]);return _0x43ad4d(_0x512e12[_0x6d4c('0x12')]['message']);}logger[_0x6d4c('0x12')](_0x6d4c('0xf'),_0x449b7f,_0x512e12['error']['message']);return _0x4dd4df(_0x512e12[_0x6d4c('0x12')][_0x6d4c('0x14')]);}else{logger[_0x6d4c('0xe')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x449b7f,_0x6d4c('0x10'));_0x4dd4df(_0x512e12[_0x6d4c('0x15')][_0x6d4c('0x14')]);}})[_0x6d4c('0x16')](function(_0x152074){logger[_0x6d4c('0x12')](_0x6d4c('0xf'),_0x449b7f,_0x152074);_0x43ad4d(_0x152074);});});}exports[_0x6d4c('0x17')]=function(_0x40b026){var _0x36013b=this;return new Promise(function(_0x30e49c,_0x3319c9){return db[_0x6d4c('0x18')][_0x6d4c('0x19')]({'raw':!![],'where':{'ContactId':_0x40b026[_0x6d4c('0x1a')][_0x6d4c('0x1b')],'ListId':_0x40b026[_0x6d4c('0x1a')][_0x6d4c('0x1c')],'VoiceQueueId':_0x40b026[_0x6d4c('0x1a')][_0x6d4c('0x1d')]===undefined?null:_0x40b026[_0x6d4c('0x1a')]['VoiceQueueId'],'CampaignId':_0x40b026[_0x6d4c('0x1a')][_0x6d4c('0x1e')]===undefined?null:_0x40b026[_0x6d4c('0x1a')]['CampaignId']}})['then'](function(_0x1d4fef){if(_0x1d4fef!=null){return db[_0x6d4c('0x1f')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x1d4fef['id'],'OrderBy':{'$gt':_0x1d4fef['OrderBy']}},'order':[[_0x6d4c('0x20'),_0x6d4c('0x21')]]})[_0x6d4c('0xd')](function(_0x2857ea){var _0x110aa3=0x0;if(_0x2857ea){if(_0x2857ea[_0x6d4c('0x22')]+_0x2857ea[_0x6d4c('0x23')]+_0x2857ea[_0x6d4c('0x24')]+_0x2857ea['countnosuchnumberretry']+_0x2857ea[_0x6d4c('0x25')]+_0x2857ea['countabandonedretry']+_0x2857ea[_0x6d4c('0x26')]+_0x2857ea[_0x6d4c('0x27')]<_0x40b026[_0x6d4c('0x28')][_0x6d4c('0x29')])_0x110aa3=0x1;_0x30e49c({'additional':_0x110aa3});}else{return db[_0x6d4c('0x1f')][_0x6d4c('0x19')]({'raw':!![],'where':{'CmHopperId':_0x1d4fef['id']},'order':[['OrderBy','ASC']]})[_0x6d4c('0xd')](function(_0x49a267){var _0x3c44e=0x0;if(_0x49a267){if(_0x49a267[_0x6d4c('0x22')]+_0x49a267[_0x6d4c('0x23')]+_0x49a267[_0x6d4c('0x24')]+_0x49a267[_0x6d4c('0x2a')]+_0x49a267[_0x6d4c('0x25')]+_0x49a267[_0x6d4c('0x2b')]+_0x49a267[_0x6d4c('0x26')]+_0x49a267['countagentrejectretry']<_0x40b026['entity'][_0x6d4c('0x29')])_0x3c44e=0x1;_0x30e49c({'additional':_0x3c44e});}else{_0x30e49c({'additional':0x0});}})[_0x6d4c('0x16')](function(_0x26514b){logger[_0x6d4c('0x12')](_0x6d4c('0x17'),_0x26514b[_0x6d4c('0x14')]);_0x3319c9(_0x36013b[_0x6d4c('0x12')](0x1f4,_0x26514b[_0x6d4c('0x14')]));});}})[_0x6d4c('0x16')](function(_0x522cba){logger['error'](_0x6d4c('0x17'),_0x522cba[_0x6d4c('0x14')]);_0x3319c9(_0x36013b[_0x6d4c('0x12')](0x1f4,_0x522cba['message']));});}else _0x30e49c({'additional':0x0});});});};exports[_0x6d4c('0x2c')]=function(_0x3b859d){var _0x5e5eff=this;return new Promise(function(_0x113c40,_0x5926c2){return db[_0x6d4c('0x18')][_0x6d4c('0x19')]({'raw':!![],'where':{'ContactId':_0x3b859d[_0x6d4c('0x1a')]['ContactId'],'ListId':_0x3b859d[_0x6d4c('0x1a')][_0x6d4c('0x1c')],'VoiceQueueId':_0x3b859d[_0x6d4c('0x1a')][_0x6d4c('0x1d')]===undefined?null:_0x3b859d[_0x6d4c('0x1a')][_0x6d4c('0x1d')],'CampaignId':_0x3b859d['body'][_0x6d4c('0x1e')]===undefined?null:_0x3b859d[_0x6d4c('0x1a')][_0x6d4c('0x1e')]}})['then'](function(_0x11222e){if(_0x11222e!=null){return db[_0x6d4c('0x1f')][_0x6d4c('0x19')]({'raw':!![],'where':{'CmHopperId':_0x11222e['id'],'OrderBy':{'$gte':_0x11222e['OrderBy']}},'order':[['OrderBy',_0x6d4c('0x21')]]})['then'](function(_0x75d973){if(_0x75d973)return activateAdditionalPhone(_0x11222e,_0x3b859d[_0x6d4c('0x1a')],_0x75d973,_0x3b859d[_0x6d4c('0x2d')],_0x3b859d[_0x6d4c('0x2e')])[_0x6d4c('0xd')](function(_0x50e7a8){_0x113c40(_0x50e7a8);});else{return db[_0x6d4c('0x1f')][_0x6d4c('0x19')]({'raw':!![],'where':{'CmHopperId':_0x11222e['id']},'order':[[_0x6d4c('0x20'),_0x6d4c('0x21')]]})['then'](function(_0x3cc4c4){if(_0x3cc4c4)return activateAdditionalPhone(_0x11222e,_0x3b859d['body'],_0x3cc4c4,_0x3b859d[_0x6d4c('0x2d')],_0x3b859d['waitTime'])[_0x6d4c('0xd')](function(_0x3abd3e){_0x113c40(_0x3abd3e);});else{_0x113c40({'id':_0x11222e['id'],'phone':''});}})[_0x6d4c('0x16')](function(_0x48b195){logger['error'](_0x6d4c('0x17'),_0x48b195[_0x6d4c('0x14')]);_0x5926c2(_0x5e5eff['error'](0x1f4,_0x48b195[_0x6d4c('0x14')]));});}})['catch'](function(_0x3eb2e8){logger[_0x6d4c('0x12')]('VerifyAdditionalPhones',_0x3eb2e8[_0x6d4c('0x14')]);_0x5926c2(_0x5e5eff[_0x6d4c('0x12')](0x1f4,_0x3eb2e8['message']));});}else _0x113c40(0x1);});});};function activateAdditionalPhone(_0x2f54a6,_0x4ec648,_0x30f61f,_0x1a7d4b,_0x1be16b){return new Promise(function(_0x383bf3,_0xdc5024){var _0x12d4aa;if(_[_0x6d4c('0x2f')](_0x30f61f[_0x6d4c('0x30')])){_0x30f61f['scheduledat']=moment();}if(moment()>moment(_0x30f61f[_0x6d4c('0x30')])){_0x12d4aa=moment()['add'](_0x1be16b||0x3,_0x6d4c('0x31'));}else{if(_0x30f61f[_0x6d4c('0x20')]==0x0){_0x12d4aa=moment(_0x30f61f[_0x6d4c('0x30')]);}else{_0x12d4aa=moment()[_0x6d4c('0x32')](_0x1be16b||0x3,_0x6d4c('0x31'));}}if(_['isNil'](_0x12d4aa)){_0x12d4aa=moment()[_0x6d4c('0x32')](_0x1be16b||0x3,'minutes');}var _0x1d8ec0={'phone':_0x2f54a6[_0x6d4c('0x33')],'active':0x0,'OrderBy':_[_0x6d4c('0x2f')](_0x2f54a6['OrderBy'])?0x0:_0x2f54a6[_0x6d4c('0x20')],'scheduledat':moment()[_0x6d4c('0x32')](_0x1a7d4b||0x1,_0x6d4c('0x31')),'countbusyretry':_0x4ec648[_0x6d4c('0x22')],'countcongestionretry':_0x4ec648[_0x6d4c('0x23')],'countnoanswerretry':_0x4ec648[_0x6d4c('0x24')],'countnosuchnumberretry':_0x4ec648['countnosuchnumberretry'],'countdropretry':_0x4ec648[_0x6d4c('0x25')],'countabandonedretry':_0x4ec648[_0x6d4c('0x2b')],'countmachineretry':_0x4ec648[_0x6d4c('0x26')],'countagentrejectretry':_0x4ec648[_0x6d4c('0x27')],'createdAt':_0x4ec648['createdAt'],'updatedAt':_0x4ec648[_0x6d4c('0x34')]};var _0xb89e7c={'CmHopperId':_0x2f54a6['id'],'phone':_0x30f61f['phone'],'active':0x0,'OrderBy':_[_0x6d4c('0x2f')](_0x30f61f[_0x6d4c('0x20')])?0x0:_0x30f61f[_0x6d4c('0x20')],'scheduledat':_0x12d4aa,'countbusyretry':_0x30f61f[_0x6d4c('0x22')],'countcongestionretry':_0x30f61f[_0x6d4c('0x23')],'countnoanswerretry':_0x30f61f[_0x6d4c('0x24')],'countnosuchnumberretry':_0x30f61f['countnosuchnumberretry'],'countdropretry':_0x30f61f[_0x6d4c('0x25')],'countabandonedretry':_0x30f61f[_0x6d4c('0x2b')],'countmachineretry':_0x30f61f['countmachineretry'],'countagentrejectretry':_0x30f61f[_0x6d4c('0x27')],'createdAt':_0x30f61f[_0x6d4c('0x35')],'updatedAt':_0x30f61f[_0x6d4c('0x34')]};return db['sequelize']['transaction'](function(_0x4b3a2b){return db[_0x6d4c('0x1f')][_0x6d4c('0x36')](_0x1d8ec0,{'where':{'id':_0x30f61f['id']}},{'transaction':_0x4b3a2b})[_0x6d4c('0xd')](function(){return db[_0x6d4c('0x18')][_0x6d4c('0x36')](_0xb89e7c,{'where':{'id':_0x2f54a6['id']}},{'transaction':_0x4b3a2b});});})[_0x6d4c('0xd')](function(_0x73d2c5){_0x383bf3({'id':_0x2f54a6['id'],'phone':_0x30f61f['phone']});})[_0x6d4c('0x16')](function(_0x544337){logger[_0x6d4c('0x12')]('activateAdditionalPhone',_0x544337[_0x6d4c('0x14')]);_0xdc5024({'error':_0x544337[_0x6d4c('0x14')]});});});}exports[_0x6d4c('0x37')]=function(_0x542755){var _0x476723=this;return new Promise(function(_0xd3e637,_0x55295e){return db['CmHopper'][_0x6d4c('0x36')](_0x542755['body'][_0x6d4c('0x38')],{'where':{'id':_0x542755['body']['id']}})[_0x6d4c('0xd')](function(_0x59b637){_0xd3e637(_0x59b637);})[_0x6d4c('0x16')](function(_0x50f7ff){logger['error'](_0x6d4c('0x37'),_0x50f7ff[_0x6d4c('0x14')]);_0x55295e(_0x476723[_0x6d4c('0x12')](0x1f4,_0x50f7ff[_0x6d4c('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index 39b9dff..cf3067a 100644 --- a/server/api/cmHopperAdditionalPhone/index.js +++ b/server/api/cmHopperAdditionalPhone/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x112a=['../../config/environment','./cmHopperAdditionalPhone.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x493f77,_0x4567ac){var _0x472bf8=function(_0x1ceab4){while(--_0x1ceab4){_0x493f77['push'](_0x493f77['shift']());}};_0x472bf8(++_0x4567ac);}(_0x112a,0x115));var _0xa112=function(_0xb96c37,_0x468c64){_0xb96c37=_0xb96c37-0x0;var _0x85992f=_0x112a[_0xb96c37];return _0x85992f;};'use strict';var multer=require(_0xa112('0x0'));var util=require(_0xa112('0x1'));var path=require(_0xa112('0x2'));var timeout=require(_0xa112('0x3'));var express=require(_0xa112('0x4'));var router=express[_0xa112('0x5')]();var fs_extra=require(_0xa112('0x6'));var auth=require(_0xa112('0x7'));var interaction=require(_0xa112('0x8'));var config=require(_0xa112('0x9'));var controller=require(_0xa112('0xa'));router[_0xa112('0xb')]('/',auth[_0xa112('0xc')](),controller[_0xa112('0xd')]);router[_0xa112('0xb')](_0xa112('0xe'),auth[_0xa112('0xc')](),controller[_0xa112('0xf')]);router[_0xa112('0x10')]('/',auth[_0xa112('0xc')](),controller[_0xa112('0x11')]);router[_0xa112('0x12')](_0xa112('0xe'),auth['isAuthenticated'](),controller[_0xa112('0x13')]);router['delete'](_0xa112('0xe'),auth[_0xa112('0xc')](),controller[_0xa112('0x14')]);module[_0xa112('0x15')]=router; \ No newline at end of file +var _0xd099=['/:id','isAuthenticated','post','create','put','update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index'];(function(_0x37599e,_0x5585ea){var _0x5c4859=function(_0x464651){while(--_0x464651){_0x37599e['push'](_0x37599e['shift']());}};_0x5c4859(++_0x5585ea);}(_0xd099,0x1bd));var _0x9d09=function(_0x195690,_0x13d76e){_0x195690=_0x195690-0x0;var _0xcd8219=_0xd099[_0x195690];return _0xcd8219;};'use strict';var multer=require(_0x9d09('0x0'));var util=require(_0x9d09('0x1'));var path=require(_0x9d09('0x2'));var timeout=require(_0x9d09('0x3'));var express=require('express');var router=express[_0x9d09('0x4')]();var fs_extra=require(_0x9d09('0x5'));var auth=require(_0x9d09('0x6'));var interaction=require(_0x9d09('0x7'));var config=require(_0x9d09('0x8'));var controller=require('./cmHopperAdditionalPhone.controller');router[_0x9d09('0x9')]('/',auth['isAuthenticated'](),controller[_0x9d09('0xa')]);router[_0x9d09('0x9')](_0x9d09('0xb'),auth[_0x9d09('0xc')](),controller['show']);router[_0x9d09('0xd')]('/',auth['isAuthenticated'](),controller[_0x9d09('0xe')]);router[_0x9d09('0xf')](_0x9d09('0xb'),auth['isAuthenticated'](),controller[_0x9d09('0x10')]);router[_0x9d09('0x11')](_0x9d09('0xb'),auth[_0x9d09('0xc')](),controller['destroy']);module[_0x9d09('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index ece985d..1acb073 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 _0xd094=['INTEGER','contactListQueue','sequelize','exports'];(function(_0x119d5a,_0x19b457){var _0x15bff4=function(_0x1b7c78){while(--_0x1b7c78){_0x119d5a['push'](_0x119d5a['shift']());}};_0x15bff4(++_0x19b457);}(_0xd094,0x96));var _0x4d09=function(_0x1d740e,_0x5c0f9a){_0x1d740e=_0x1d740e-0x0;var _0x5a5fdc=_0xd094[_0x1d740e];return _0x5a5fdc;};'use strict';var moment=require('moment');var Sequelize=require(_0x4d09('0x0'));module[_0x4d09('0x1')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0x4d09('0x2')],'unique':'contactListQueue'},'VoiceQueueId':{'type':Sequelize[_0x4d09('0x2')],'unique':_0x4d09('0x3')}}; \ No newline at end of file +var _0x1670=['sequelize','STRING','contactListQueue','INTEGER','moment'];(function(_0x5788f3,_0x275670){var _0x4f1d41=function(_0x239592){while(--_0x239592){_0x5788f3['push'](_0x5788f3['shift']());}};_0x4f1d41(++_0x275670);}(_0x1670,0x9a));var _0x0167=function(_0x1f2cf1,_0x35c074){_0x1f2cf1=_0x1f2cf1-0x0;var _0x47493f=_0x1670[_0x1f2cf1];return _0x47493f;};'use strict';var moment=require(_0x0167('0x0'));var Sequelize=require(_0x0167('0x1'));module['exports']={'phone':{'type':Sequelize[_0x0167('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0x0167('0x3')},'ListId':{'type':Sequelize[_0x0167('0x4')],'unique':_0x0167('0x3')},'VoiceQueueId':{'type':Sequelize[_0x0167('0x4')],'unique':'contactListQueue'}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index c87fb40..3d859e5 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 _0x10ee=['include','findAll','rows','show','params','rawAttributes','fields','length','find','body','catch','destroy','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','error','name','send','map','CmHopperBlack','fieldName','type','key','query','keys','filters','intersection','model','attributes','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll'];(function(_0x34926f,_0x3db4c){var _0xe68b89=function(_0x47cedf){while(--_0x47cedf){_0x34926f['push'](_0x34926f['shift']());}};_0xe68b89(++_0x3db4c);}(_0x10ee,0xed));var _0xe10e=function(_0x40220a,_0x22feb1){_0x40220a=_0x40220a-0x0;var _0x3903cc=_0x10ee[_0x40220a];return _0x3903cc;};'use strict';var emlformat=require(_0xe10e('0x0'));var rimraf=require(_0xe10e('0x1'));var zipdir=require(_0xe10e('0x2'));var jsonpatch=require(_0xe10e('0x3'));var rp=require('request-promise');var moment=require(_0xe10e('0x4'));var BPromise=require(_0xe10e('0x5'));var Mustache=require(_0xe10e('0x6'));var util=require(_0xe10e('0x7'));var path=require(_0xe10e('0x8'));var sox=require('sox');var csv=require(_0xe10e('0x9'));var ejs=require(_0xe10e('0xa'));var fs=require('fs');var fs_extra=require(_0xe10e('0xb'));var _=require('lodash');var squel=require(_0xe10e('0xc'));var crypto=require(_0xe10e('0xd'));var jsforce=require(_0xe10e('0xe'));var deskjs=require(_0xe10e('0xf'));var toCsv=require('to-csv');var querystring=require(_0xe10e('0x10'));var Papa=require(_0xe10e('0x11'));var Redis=require(_0xe10e('0x12'));var authService=require(_0xe10e('0x13'));var qs=require(_0xe10e('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xe10e('0x15'))(_0xe10e('0x16'));var utils=require('../../config/utils');var config=require(_0xe10e('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xe10e('0x18'))['db'];function respondWithStatusCode(_0x24869b,_0x5cbd1f){_0x5cbd1f=_0x5cbd1f||0xcc;return function(_0x4c4b3d){if(_0x4c4b3d){return _0x24869b[_0xe10e('0x19')](_0x5cbd1f);}return _0x24869b[_0xe10e('0x1a')](_0x5cbd1f)[_0xe10e('0x1b')]();};}function respondWithResult(_0x25a273,_0x4a5b42){_0x4a5b42=_0x4a5b42||0xc8;return function(_0x2ccc45){if(_0x2ccc45){return _0x25a273['status'](_0x4a5b42)[_0xe10e('0x1c')](_0x2ccc45);}};}function respondWithFilteredResult(_0x96948e,_0x2e37b2){return function(_0xc6f530){if(_0xc6f530){var _0x4584cc=typeof _0x2e37b2[_0xe10e('0x1d')]===_0xe10e('0x1e')&&typeof _0x2e37b2[_0xe10e('0x1f')]===_0xe10e('0x1e');var _0x20a404=_0xc6f530[_0xe10e('0x20')];var _0x91f0d1=_0x4584cc?0x0:_0x2e37b2[_0xe10e('0x1d')];var _0x148e99=_0x4584cc?_0xc6f530[_0xe10e('0x20')]:_0x2e37b2[_0xe10e('0x1d')]+_0x2e37b2[_0xe10e('0x1f')];var _0x15881e;if(_0x148e99>=_0x20a404){_0x148e99=_0x20a404;_0x15881e=0xc8;}else{_0x15881e=0xce;}_0x96948e[_0xe10e('0x1a')](_0x15881e);return _0x96948e[_0xe10e('0x21')](_0xe10e('0x22'),_0x91f0d1+'-'+_0x148e99+'/'+_0x20a404)[_0xe10e('0x1c')](_0xc6f530);}return null;};}function patchUpdates(_0x3eb773){return function(_0xcac481){try{jsonpatch[_0xe10e('0x23')](_0xcac481,_0x3eb773,!![]);}catch(_0x5d9d3b){return BPromise[_0xe10e('0x24')](_0x5d9d3b);}return _0xcac481['save']();};}function saveUpdates(_0x519cd9,_0xf447ea){return function(_0x1f70c0){if(_0x1f70c0){return _0x1f70c0[_0xe10e('0x25')](_0x519cd9)[_0xe10e('0x26')](function(_0xa77246){return _0xa77246;});}return null;};}function removeEntity(_0x3075eb,_0x2dfa94){return function(_0x5bcf42){if(_0x5bcf42){return _0x5bcf42['destroy']()[_0xe10e('0x26')](function(){_0x3075eb[_0xe10e('0x1a')](0xcc)[_0xe10e('0x1b')]();});}};}function handleEntityNotFound(_0x246999,_0x429400){return function(_0x4663bc){if(!_0x4663bc){_0x246999['sendStatus'](0x194);}return _0x4663bc;};}function handleError(_0x4afd2c,_0x120000){_0x120000=_0x120000||0x1f4;return function(_0x1ca188){logger[_0xe10e('0x27')](_0x1ca188['stack']);if(_0x1ca188[_0xe10e('0x28')]){delete _0x1ca188[_0xe10e('0x28')];}_0x4afd2c['status'](_0x120000)[_0xe10e('0x29')](_0x1ca188);};}exports['index']=function(_0x32b32b,_0x37f1f7){var _0x43a746={},_0x26f024={},_0x43e721={'count':0x0,'rows':[]};var _0x23ff93=_[_0xe10e('0x2a')](db[_0xe10e('0x2b')]['rawAttributes'],function(_0x17eeb9){return{'name':_0x17eeb9[_0xe10e('0x2c')],'type':_0x17eeb9[_0xe10e('0x2d')][_0xe10e('0x2e')]};});_0x26f024['model']=_[_0xe10e('0x2a')](_0x23ff93,_0xe10e('0x28'));_0x26f024[_0xe10e('0x2f')]=_[_0xe10e('0x30')](_0x32b32b[_0xe10e('0x2f')]);_0x26f024[_0xe10e('0x31')]=_[_0xe10e('0x32')](_0x26f024['model'],_0x26f024[_0xe10e('0x2f')]);_0x43a746['attributes']=_[_0xe10e('0x32')](_0x26f024[_0xe10e('0x33')],qs['fields'](_0x32b32b[_0xe10e('0x2f')]['fields']));_0x43a746[_0xe10e('0x34')]=_0x43a746[_0xe10e('0x34')]['length']?_0x43a746[_0xe10e('0x34')]:_0x26f024[_0xe10e('0x33')];if(!_0x32b32b['query'][_0xe10e('0x35')](_0xe10e('0x36'))){_0x43a746[_0xe10e('0x1f')]=qs['limit'](_0x32b32b[_0xe10e('0x2f')][_0xe10e('0x1f')]);_0x43a746[_0xe10e('0x1d')]=qs[_0xe10e('0x1d')](_0x32b32b[_0xe10e('0x2f')][_0xe10e('0x1d')]);}_0x43a746[_0xe10e('0x37')]=qs['sort'](_0x32b32b[_0xe10e('0x2f')][_0xe10e('0x38')]);_0x43a746[_0xe10e('0x39')]=qs[_0xe10e('0x31')](_['pick'](_0x32b32b['query'],_0x26f024['filters']),_0x23ff93);if(_0x32b32b[_0xe10e('0x2f')]['filter']){_0x43a746[_0xe10e('0x39')]=_[_0xe10e('0x3a')](_0x43a746[_0xe10e('0x39')],{'$or':_['map'](_0x23ff93,function(_0x2708c1){if(_0x2708c1[_0xe10e('0x2d')]!==_0xe10e('0x3b')){var _0x223a13={};_0x223a13[_0x2708c1['name']]={'$like':'%'+_0x32b32b[_0xe10e('0x2f')][_0xe10e('0x3c')]+'%'};return _0x223a13;}})});}_0x43a746=_[_0xe10e('0x3a')]({},_0x43a746,_0x32b32b[_0xe10e('0x3d')]);var _0x511cec={'where':_0x43a746[_0xe10e('0x39')]};return db[_0xe10e('0x2b')][_0xe10e('0x20')](_0x511cec)['then'](function(_0x2aee23){_0x43e721[_0xe10e('0x20')]=_0x2aee23;if(_0x32b32b['query'][_0xe10e('0x3e')]){_0x43a746[_0xe10e('0x3f')]=[{'all':!![]}];}return db[_0xe10e('0x2b')][_0xe10e('0x40')](_0x43a746);})[_0xe10e('0x26')](function(_0x2e8db1){_0x43e721[_0xe10e('0x41')]=_0x2e8db1;return _0x43e721;})['then'](respondWithFilteredResult(_0x37f1f7,_0x43a746))['catch'](handleError(_0x37f1f7,null));};exports[_0xe10e('0x42')]=function(_0x366c62,_0x5e985e){var _0x12a787={'raw':!![],'where':{'id':_0x366c62[_0xe10e('0x43')]['id']}},_0x37e988={};_0x37e988[_0xe10e('0x33')]=_[_0xe10e('0x30')](db[_0xe10e('0x2b')][_0xe10e('0x44')]);_0x37e988[_0xe10e('0x2f')]=_[_0xe10e('0x30')](_0x366c62[_0xe10e('0x2f')]);_0x37e988[_0xe10e('0x31')]=_['intersection'](_0x37e988[_0xe10e('0x33')],_0x37e988[_0xe10e('0x2f')]);_0x12a787[_0xe10e('0x34')]=_[_0xe10e('0x32')](_0x37e988[_0xe10e('0x33')],qs[_0xe10e('0x45')](_0x366c62[_0xe10e('0x2f')][_0xe10e('0x45')]));_0x12a787[_0xe10e('0x34')]=_0x12a787[_0xe10e('0x34')][_0xe10e('0x46')]?_0x12a787['attributes']:_0x37e988[_0xe10e('0x33')];if(_0x366c62[_0xe10e('0x2f')]['includeAll']){_0x12a787[_0xe10e('0x3f')]=[{'all':!![]}];}_0x12a787=_[_0xe10e('0x3a')]({},_0x12a787,_0x366c62['options']);return db[_0xe10e('0x2b')][_0xe10e('0x47')](_0x12a787)[_0xe10e('0x26')](handleEntityNotFound(_0x5e985e,null))[_0xe10e('0x26')](respondWithResult(_0x5e985e,null))['catch'](handleError(_0x5e985e,null));};exports['update']=function(_0x2c6b70,_0xc801b){if(_0x2c6b70['body']['id']){delete _0x2c6b70['body']['id'];}return db['CmHopperBlack'][_0xe10e('0x47')]({'where':{'id':_0x2c6b70[_0xe10e('0x43')]['id']}})['then'](handleEntityNotFound(_0xc801b,null))['then'](saveUpdates(_0x2c6b70[_0xe10e('0x48')],null))[_0xe10e('0x26')](respondWithResult(_0xc801b,null))[_0xe10e('0x49')](handleError(_0xc801b,null));};exports[_0xe10e('0x4a')]=function(_0x182167,_0x1eb529){return db['CmHopperBlack'][_0xe10e('0x47')]({'where':{'id':_0x182167[_0xe10e('0x43')]['id']}})[_0xe10e('0x26')](handleEntityNotFound(_0x1eb529,null))[_0xe10e('0x26')](removeEntity(_0x1eb529,null))[_0xe10e('0x49')](handleError(_0x1eb529,null));};exports['describe']=function(_0x55ade0,_0x42d728){return db['CmHopperBlack']['describe']()[_0xe10e('0x26')](respondWithResult(_0x42d728,null))['catch'](handleError(_0x42d728,null));}; \ No newline at end of file +var _0x5771=['request-promise','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','json','offset','undefined','limit','count','status','Content-Range','apply','reject','then','destroy','end','sendStatus','error','stack','name','index','map','CmHopperBlack','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','rows','catch','params','rawAttributes','find','body','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x37b546,_0x8c85de){var _0x24a3b5=function(_0x337bc5){while(--_0x337bc5){_0x37b546['push'](_0x37b546['shift']());}};_0x24a3b5(++_0x8c85de);}(_0x5771,0x114));var _0x1577=function(_0x30948a,_0x55c1d2){_0x30948a=_0x30948a-0x0;var _0x36318d=_0x5771[_0x30948a];return _0x36318d;};'use strict';var emlformat=require(_0x1577('0x0'));var rimraf=require(_0x1577('0x1'));var zipdir=require(_0x1577('0x2'));var jsonpatch=require(_0x1577('0x3'));var rp=require(_0x1577('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x1577('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x1577('0x6'));var ejs=require(_0x1577('0x7'));var fs=require('fs');var fs_extra=require(_0x1577('0x8'));var _=require(_0x1577('0x9'));var squel=require(_0x1577('0xa'));var crypto=require(_0x1577('0xb'));var jsforce=require(_0x1577('0xc'));var deskjs=require(_0x1577('0xd'));var toCsv=require(_0x1577('0x6'));var querystring=require('querystring');var Papa=require(_0x1577('0xe'));var Redis=require(_0x1577('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x1577('0x10'));var hardwareService=require(_0x1577('0x11'));var logger=require('../../config/logger')(_0x1577('0x12'));var utils=require(_0x1577('0x13'));var config=require(_0x1577('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x1577('0x15'))['db'];function respondWithStatusCode(_0x2e7e2d,_0x2562b6){_0x2562b6=_0x2562b6||0xcc;return function(_0x5403f7){if(_0x5403f7){return _0x2e7e2d['sendStatus'](_0x2562b6);}return _0x2e7e2d['status'](_0x2562b6)['end']();};}function respondWithResult(_0x5dfcf3,_0x1917ee){_0x1917ee=_0x1917ee||0xc8;return function(_0x260a96){if(_0x260a96){return _0x5dfcf3['status'](_0x1917ee)[_0x1577('0x16')](_0x260a96);}};}function respondWithFilteredResult(_0x21ca9e,_0x4faba6){return function(_0x575dbb){if(_0x575dbb){var _0x4f6c5a=typeof _0x4faba6[_0x1577('0x17')]===_0x1577('0x18')&&typeof _0x4faba6[_0x1577('0x19')]==='undefined';var _0x1299f8=_0x575dbb[_0x1577('0x1a')];var _0x4ac695=_0x4f6c5a?0x0:_0x4faba6['offset'];var _0x167d2b=_0x4f6c5a?_0x575dbb['count']:_0x4faba6[_0x1577('0x17')]+_0x4faba6['limit'];var _0x4cbc25;if(_0x167d2b>=_0x1299f8){_0x167d2b=_0x1299f8;_0x4cbc25=0xc8;}else{_0x4cbc25=0xce;}_0x21ca9e[_0x1577('0x1b')](_0x4cbc25);return _0x21ca9e['set'](_0x1577('0x1c'),_0x4ac695+'-'+_0x167d2b+'/'+_0x1299f8)[_0x1577('0x16')](_0x575dbb);}return null;};}function patchUpdates(_0x7d71df){return function(_0x52ef3e){try{jsonpatch[_0x1577('0x1d')](_0x52ef3e,_0x7d71df,!![]);}catch(_0x3fb78c){return BPromise[_0x1577('0x1e')](_0x3fb78c);}return _0x52ef3e['save']();};}function saveUpdates(_0x2dd525,_0x2ee577){return function(_0xfc89c7){if(_0xfc89c7){return _0xfc89c7['update'](_0x2dd525)[_0x1577('0x1f')](function(_0x3c802e){return _0x3c802e;});}return null;};}function removeEntity(_0x508927,_0x504cdc){return function(_0x20df48){if(_0x20df48){return _0x20df48[_0x1577('0x20')]()[_0x1577('0x1f')](function(){_0x508927[_0x1577('0x1b')](0xcc)[_0x1577('0x21')]();});}};}function handleEntityNotFound(_0x56364c,_0x27d287){return function(_0x1c3a1d){if(!_0x1c3a1d){_0x56364c[_0x1577('0x22')](0x194);}return _0x1c3a1d;};}function handleError(_0x2912cc,_0x5e7124){_0x5e7124=_0x5e7124||0x1f4;return function(_0x320801){logger[_0x1577('0x23')](_0x320801[_0x1577('0x24')]);if(_0x320801[_0x1577('0x25')]){delete _0x320801[_0x1577('0x25')];}_0x2912cc['status'](_0x5e7124)['send'](_0x320801);};}exports[_0x1577('0x26')]=function(_0x1126b4,_0x65c8b5){var _0xd71b6={},_0x1e938a={},_0x174f22={'count':0x0,'rows':[]};var _0x4f6f7c=_[_0x1577('0x27')](db[_0x1577('0x28')]['rawAttributes'],function(_0x89d7ac){return{'name':_0x89d7ac[_0x1577('0x29')],'type':_0x89d7ac['type'][_0x1577('0x2a')]};});_0x1e938a[_0x1577('0x2b')]=_[_0x1577('0x27')](_0x4f6f7c,_0x1577('0x25'));_0x1e938a[_0x1577('0x2c')]=_[_0x1577('0x2d')](_0x1126b4[_0x1577('0x2c')]);_0x1e938a[_0x1577('0x2e')]=_[_0x1577('0x2f')](_0x1e938a['model'],_0x1e938a[_0x1577('0x2c')]);_0xd71b6[_0x1577('0x30')]=_['intersection'](_0x1e938a[_0x1577('0x2b')],qs[_0x1577('0x31')](_0x1126b4['query']['fields']));_0xd71b6[_0x1577('0x30')]=_0xd71b6[_0x1577('0x30')][_0x1577('0x32')]?_0xd71b6[_0x1577('0x30')]:_0x1e938a[_0x1577('0x2b')];if(!_0x1126b4[_0x1577('0x2c')][_0x1577('0x33')](_0x1577('0x34'))){_0xd71b6[_0x1577('0x19')]=qs[_0x1577('0x19')](_0x1126b4['query'][_0x1577('0x19')]);_0xd71b6[_0x1577('0x17')]=qs[_0x1577('0x17')](_0x1126b4[_0x1577('0x2c')]['offset']);}_0xd71b6[_0x1577('0x35')]=qs[_0x1577('0x36')](_0x1126b4[_0x1577('0x2c')][_0x1577('0x36')]);_0xd71b6[_0x1577('0x37')]=qs[_0x1577('0x2e')](_[_0x1577('0x38')](_0x1126b4[_0x1577('0x2c')],_0x1e938a[_0x1577('0x2e')]),_0x4f6f7c);if(_0x1126b4[_0x1577('0x2c')][_0x1577('0x39')]){_0xd71b6['where']=_[_0x1577('0x3a')](_0xd71b6[_0x1577('0x37')],{'$or':_[_0x1577('0x27')](_0x4f6f7c,function(_0x452d9c){if(_0x452d9c[_0x1577('0x3b')]!==_0x1577('0x3c')){var _0x405f00={};_0x405f00[_0x452d9c['name']]={'$like':'%'+_0x1126b4[_0x1577('0x2c')][_0x1577('0x39')]+'%'};return _0x405f00;}})});}_0xd71b6=_[_0x1577('0x3a')]({},_0xd71b6,_0x1126b4[_0x1577('0x3d')]);var _0x44bea3={'where':_0xd71b6[_0x1577('0x37')]};return db['CmHopperBlack'][_0x1577('0x1a')](_0x44bea3)[_0x1577('0x1f')](function(_0x3a5397){_0x174f22['count']=_0x3a5397;if(_0x1126b4[_0x1577('0x2c')][_0x1577('0x3e')]){_0xd71b6[_0x1577('0x3f')]=[{'all':!![]}];}return db[_0x1577('0x28')]['findAll'](_0xd71b6);})[_0x1577('0x1f')](function(_0x322b2f){_0x174f22[_0x1577('0x40')]=_0x322b2f;return _0x174f22;})['then'](respondWithFilteredResult(_0x65c8b5,_0xd71b6))[_0x1577('0x41')](handleError(_0x65c8b5,null));};exports['show']=function(_0x3a21f8,_0xb4830a){var _0x23a3de={'raw':!![],'where':{'id':_0x3a21f8[_0x1577('0x42')]['id']}},_0x28bc66={};_0x28bc66[_0x1577('0x2b')]=_[_0x1577('0x2d')](db[_0x1577('0x28')][_0x1577('0x43')]);_0x28bc66['query']=_[_0x1577('0x2d')](_0x3a21f8[_0x1577('0x2c')]);_0x28bc66[_0x1577('0x2e')]=_[_0x1577('0x2f')](_0x28bc66[_0x1577('0x2b')],_0x28bc66[_0x1577('0x2c')]);_0x23a3de[_0x1577('0x30')]=_[_0x1577('0x2f')](_0x28bc66['model'],qs[_0x1577('0x31')](_0x3a21f8[_0x1577('0x2c')][_0x1577('0x31')]));_0x23a3de[_0x1577('0x30')]=_0x23a3de[_0x1577('0x30')][_0x1577('0x32')]?_0x23a3de[_0x1577('0x30')]:_0x28bc66[_0x1577('0x2b')];if(_0x3a21f8[_0x1577('0x2c')][_0x1577('0x3e')]){_0x23a3de[_0x1577('0x3f')]=[{'all':!![]}];}_0x23a3de=_[_0x1577('0x3a')]({},_0x23a3de,_0x3a21f8[_0x1577('0x3d')]);return db['CmHopperBlack'][_0x1577('0x44')](_0x23a3de)[_0x1577('0x1f')](handleEntityNotFound(_0xb4830a,null))[_0x1577('0x1f')](respondWithResult(_0xb4830a,null))[_0x1577('0x41')](handleError(_0xb4830a,null));};exports['update']=function(_0xe800f8,_0x37cd71){if(_0xe800f8['body']['id']){delete _0xe800f8[_0x1577('0x45')]['id'];}return db[_0x1577('0x28')][_0x1577('0x44')]({'where':{'id':_0xe800f8[_0x1577('0x42')]['id']}})['then'](handleEntityNotFound(_0x37cd71,null))['then'](saveUpdates(_0xe800f8[_0x1577('0x45')],null))['then'](respondWithResult(_0x37cd71,null))['catch'](handleError(_0x37cd71,null));};exports[_0x1577('0x20')]=function(_0x2a53fc,_0x29533e){return db[_0x1577('0x28')][_0x1577('0x44')]({'where':{'id':_0x2a53fc[_0x1577('0x42')]['id']}})[_0x1577('0x1f')](handleEntityNotFound(_0x29533e,null))['then'](removeEntity(_0x29533e,null))['catch'](handleError(_0x29533e,null));};exports['describe']=function(_0x202fc5,_0x109b2f){return db['CmHopperBlack']['describe']()['then'](respondWithResult(_0x109b2f,null))[_0x1577('0x41')](handleError(_0x109b2f,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index 2aa34e6..cebc61d 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 _0xfeaa=['../../config/environment','./cmHopperBlack.attributes','exports','CmHopperBlack','cm_hopper_black','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x543a5e,_0x33dd65){var _0x29afa6=function(_0x42d2ec){while(--_0x42d2ec){_0x543a5e['push'](_0x543a5e['shift']());}};_0x29afa6(++_0x33dd65);}(_0xfeaa,0x95));var _0xafea=function(_0x2d8f47,_0x16d3d8){_0x2d8f47=_0x2d8f47-0x0;var _0x389eba=_0xfeaa[_0x2d8f47];return _0x389eba;};'use strict';var _=require(_0xafea('0x0'));var util=require('util');var logger=require(_0xafea('0x1'))('api');var moment=require(_0xafea('0x2'));var BPromise=require(_0xafea('0x3'));var rp=require(_0xafea('0x4'));var fs=require('fs');var path=require(_0xafea('0x5'));var rimraf=require(_0xafea('0x6'));var config=require(_0xafea('0x7'));var attributes=require(_0xafea('0x8'));module[_0xafea('0x9')]=function(_0x32cfb7,_0x4cf562){return _0x32cfb7['define'](_0xafea('0xa'),attributes,{'tableName':_0xafea('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd7e9=['path','rimraf','./cmHopperBlack.attributes','exports','define','cm_hopper_black','lodash','util','api','moment','request-promise'];(function(_0x1dcc9c,_0x52d29f){var _0x5367d0=function(_0x3504cd){while(--_0x3504cd){_0x1dcc9c['push'](_0x1dcc9c['shift']());}};_0x5367d0(++_0x52d29f);}(_0xd7e9,0x1be));var _0x9d7e=function(_0x386746,_0x519481){_0x386746=_0x386746-0x0;var _0x52302d=_0xd7e9[_0x386746];return _0x52302d;};'use strict';var _=require(_0x9d7e('0x0'));var util=require(_0x9d7e('0x1'));var logger=require('../../config/logger')(_0x9d7e('0x2'));var moment=require(_0x9d7e('0x3'));var BPromise=require('bluebird');var rp=require(_0x9d7e('0x4'));var fs=require('fs');var path=require(_0x9d7e('0x5'));var rimraf=require(_0x9d7e('0x6'));var config=require('../../config/environment');var attributes=require(_0x9d7e('0x7'));module[_0x9d7e('0x8')]=function(_0x2223f4,_0xb6af8e){return _0x2223f4[_0x9d7e('0x9')]('CmHopperBlack',attributes,{'tableName':_0x9d7e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.rpc.js b/server/api/cmHopperBlack/cmHopperBlack.rpc.js index 4230fbd..4acbc57 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 _0xde80=['GetCmHopperBlack','CmHopperBlack','findAll','options','raw','where','attributes','include','map','model','UpdateCmHopperBlack','update','body','limit','DestroyCmHopperBlack','destroy','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','jayson/promise','client','http','then','info','request\x20sent','debug','stringify','error','code','message','CmHopperBlack,\x20%s,\x20%s'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xde80,0x10d));var _0x0de8=function(_0xe11966,_0x455d9d){_0xe11966=_0xe11966-0x0;var _0x2fa7e1=_0xde80[_0xe11966];return _0x2fa7e1;};'use strict';var _=require(_0x0de8('0x0'));var util=require(_0x0de8('0x1'));var moment=require(_0x0de8('0x2'));var BPromise=require(_0x0de8('0x3'));var rs=require(_0x0de8('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x0de8('0x5'));var logger=require(_0x0de8('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x0de8('0x7'));var client=jayson[_0x0de8('0x8')][_0x0de8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4bdef0,_0x5ee4be,_0x469076){return new BPromise(function(_0x50e91b,_0x386163){return client['request'](_0x4bdef0,_0x469076)[_0x0de8('0xa')](function(_0x3d1666){logger[_0x0de8('0xb')]('CmHopperBlack,\x20%s,\x20%s',_0x5ee4be,_0x0de8('0xc'));logger[_0x0de8('0xd')]('CmHopperBlack,\x20%s,\x20%s,\x20%s',_0x5ee4be,_0x0de8('0xc'),JSON[_0x0de8('0xe')](_0x3d1666));if(_0x3d1666[_0x0de8('0xf')]){if(_0x3d1666[_0x0de8('0xf')][_0x0de8('0x10')]===0x1f4){logger[_0x0de8('0xf')]('CmHopperBlack,\x20%s,\x20%s',_0x5ee4be,_0x3d1666[_0x0de8('0xf')][_0x0de8('0x11')]);return _0x386163(_0x3d1666[_0x0de8('0xf')][_0x0de8('0x11')]);}logger[_0x0de8('0xf')](_0x0de8('0x12'),_0x5ee4be,_0x3d1666[_0x0de8('0xf')][_0x0de8('0x11')]);return _0x50e91b(_0x3d1666[_0x0de8('0xf')][_0x0de8('0x11')]);}else{logger[_0x0de8('0xb')](_0x0de8('0x12'),_0x5ee4be,_0x0de8('0xc'));_0x50e91b(_0x3d1666['result']['message']);}})['catch'](function(_0x4f81ef){logger['error'](_0x0de8('0x12'),_0x5ee4be,_0x4f81ef);_0x386163(_0x4f81ef);});});}exports[_0x0de8('0x13')]=function(_0x1f0c6e){var _0x20e76c=this;return new Promise(function(_0xe25f6,_0xbd685c){return db[_0x0de8('0x14')][_0x0de8('0x15')]({'raw':_0x1f0c6e[_0x0de8('0x16')]?_0x1f0c6e[_0x0de8('0x16')][_0x0de8('0x17')]===undefined?!![]:![]:!![],'where':_0x1f0c6e['options']?_0x1f0c6e[_0x0de8('0x16')][_0x0de8('0x18')]||null:null,'attributes':_0x1f0c6e[_0x0de8('0x16')]?_0x1f0c6e[_0x0de8('0x16')][_0x0de8('0x19')]||null:null,'limit':_0x1f0c6e[_0x0de8('0x16')]?_0x1f0c6e['options']['limit']||null:null,'include':_0x1f0c6e[_0x0de8('0x16')]?_0x1f0c6e[_0x0de8('0x16')][_0x0de8('0x1a')]?_[_0x0de8('0x1b')](_0x1f0c6e['options']['include'],function(_0x2cc82d){return{'model':db[_0x2cc82d[_0x0de8('0x1c')]],'as':_0x2cc82d['as'],'attributes':_0x2cc82d[_0x0de8('0x19')],'include':_0x2cc82d['include']?_['map'](_0x2cc82d[_0x0de8('0x1a')],function(_0x5e36e7){return{'model':db[_0x5e36e7['model']],'as':_0x5e36e7['as'],'attributes':_0x5e36e7[_0x0de8('0x19')],'include':_0x5e36e7[_0x0de8('0x1a')]?_['map'](_0x5e36e7['include'],function(_0xb71b67){return{'model':db[_0xb71b67[_0x0de8('0x1c')]],'as':_0xb71b67['as'],'attributes':_0xb71b67[_0x0de8('0x19')]};}):[]};}):[]};}):[]:[]})[_0x0de8('0xa')](function(_0x5bf504){logger[_0x0de8('0xb')](_0x0de8('0x13'),_0x1f0c6e);logger['debug'](_0x0de8('0x13'),_0x1f0c6e,JSON[_0x0de8('0xe')](_0x5bf504));_0xe25f6(_0x5bf504);})['catch'](function(_0x49596a){logger[_0x0de8('0xf')]('GetCmHopperBlack',_0x49596a[_0x0de8('0x11')],_0x1f0c6e);_0xbd685c(_0x20e76c[_0x0de8('0xf')](0x1f4,_0x49596a[_0x0de8('0x11')]));});});};exports[_0x0de8('0x1d')]=function(_0x5d11d7){var _0x2dce51=this;return new Promise(function(_0x577111,_0x275e35){return db['CmHopperBlack'][_0x0de8('0x1e')](_0x5d11d7[_0x0de8('0x1f')],{'raw':_0x5d11d7[_0x0de8('0x16')]?_0x5d11d7[_0x0de8('0x16')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5d11d7[_0x0de8('0x16')]?_0x5d11d7[_0x0de8('0x16')][_0x0de8('0x18')]||null:null,'attributes':_0x5d11d7['options']?_0x5d11d7[_0x0de8('0x16')][_0x0de8('0x19')]||null:null,'limit':_0x5d11d7['options']?_0x5d11d7['options'][_0x0de8('0x20')]||null:null})['then'](function(_0x1185e6){logger['info']('UpdateCmHopperBlack',_0x5d11d7);logger['debug'](_0x0de8('0x1d'),_0x5d11d7,JSON['stringify'](_0x1185e6));_0x577111(_0x1185e6);})['catch'](function(_0x43763c){logger[_0x0de8('0xf')](_0x0de8('0x1d'),_0x43763c['message'],_0x5d11d7);_0x275e35(_0x2dce51[_0x0de8('0xf')](0x1f4,_0x43763c[_0x0de8('0x11')]));});});};exports[_0x0de8('0x21')]=function(_0x2a997f){var _0xdc9c32=this;return new Promise(function(_0x244f81,_0x3d1658){return db[_0x0de8('0x14')][_0x0de8('0x22')]({'where':_0x2a997f[_0x0de8('0x16')]?_0x2a997f['options'][_0x0de8('0x18')]||null:null})[_0x0de8('0xa')](function(_0x40f15e){logger[_0x0de8('0xb')](_0x0de8('0x21'),_0x2a997f);logger['debug'](_0x0de8('0x21'),_0x2a997f,JSON[_0x0de8('0xe')](_0x40f15e));_0x244f81(_0x40f15e);})[_0x0de8('0x23')](function(_0x22ea0e){logger[_0x0de8('0xf')](_0x0de8('0x21'),_0x22ea0e[_0x0de8('0x11')],_0x2a997f);_0x3d1658(_0xdc9c32[_0x0de8('0xf')](0x1f4,_0x22ea0e[_0x0de8('0x11')]));});});}; \ No newline at end of file +var _0xf68f=['result','catch','GetCmHopperBlack','CmHopperBlack','findAll','options','raw','limit','include','map','model','attributes','UpdateCmHopperBlack','update','where','DestroyCmHopperBlack','destroy','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','CmHopperBlack,\x20%s,\x20%s','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info'];(function(_0x489c35,_0x8b6524){var _0x414a4d=function(_0x31b44b){while(--_0x31b44b){_0x489c35['push'](_0x489c35['shift']());}};_0x414a4d(++_0x8b6524);}(_0xf68f,0x1b3));var _0xff68=function(_0x56d7e0,_0x30c8de){_0x56d7e0=_0x56d7e0-0x0;var _0x54a715=_0xf68f[_0x56d7e0];return _0x54a715;};'use strict';var _=require(_0xff68('0x0'));var util=require(_0xff68('0x1'));var moment=require('moment');var BPromise=require(_0xff68('0x2'));var rs=require(_0xff68('0x3'));var fs=require('fs');var Redis=require(_0xff68('0x4'));var db=require(_0xff68('0x5'))['db'];var utils=require(_0xff68('0x6'));var logger=require('../../config/logger')(_0xff68('0x7'));var config=require('../../config/environment');var jayson=require(_0xff68('0x8'));var client=jayson[_0xff68('0x9')][_0xff68('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5dd326,_0x144514,_0x31782e){return new BPromise(function(_0x291119,_0x394de2){return client[_0xff68('0xb')](_0x5dd326,_0x31782e)[_0xff68('0xc')](function(_0x5975fb){logger['info'](_0xff68('0xd'),_0x144514,'request\x20sent');logger[_0xff68('0xe')](_0xff68('0xf'),_0x144514,'request\x20sent',JSON[_0xff68('0x10')](_0x5975fb));if(_0x5975fb[_0xff68('0x11')]){if(_0x5975fb['error'][_0xff68('0x12')]===0x1f4){logger[_0xff68('0x11')]('CmHopperBlack,\x20%s,\x20%s',_0x144514,_0x5975fb['error'][_0xff68('0x13')]);return _0x394de2(_0x5975fb[_0xff68('0x11')][_0xff68('0x13')]);}logger[_0xff68('0x11')](_0xff68('0xd'),_0x144514,_0x5975fb['error']['message']);return _0x291119(_0x5975fb[_0xff68('0x11')][_0xff68('0x13')]);}else{logger[_0xff68('0x14')](_0xff68('0xd'),_0x144514,'request\x20sent');_0x291119(_0x5975fb[_0xff68('0x15')][_0xff68('0x13')]);}})[_0xff68('0x16')](function(_0x48d022){logger['error'](_0xff68('0xd'),_0x144514,_0x48d022);_0x394de2(_0x48d022);});});}exports[_0xff68('0x17')]=function(_0x4b893a){var _0x3f00a0=this;return new Promise(function(_0x4d5acd,_0x37b977){return db[_0xff68('0x18')][_0xff68('0x19')]({'raw':_0x4b893a[_0xff68('0x1a')]?_0x4b893a['options'][_0xff68('0x1b')]===undefined?!![]:![]:!![],'where':_0x4b893a[_0xff68('0x1a')]?_0x4b893a[_0xff68('0x1a')]['where']||null:null,'attributes':_0x4b893a[_0xff68('0x1a')]?_0x4b893a[_0xff68('0x1a')]['attributes']||null:null,'limit':_0x4b893a[_0xff68('0x1a')]?_0x4b893a[_0xff68('0x1a')][_0xff68('0x1c')]||null:null,'include':_0x4b893a[_0xff68('0x1a')]?_0x4b893a[_0xff68('0x1a')][_0xff68('0x1d')]?_[_0xff68('0x1e')](_0x4b893a[_0xff68('0x1a')][_0xff68('0x1d')],function(_0x96c000){return{'model':db[_0x96c000[_0xff68('0x1f')]],'as':_0x96c000['as'],'attributes':_0x96c000['attributes'],'include':_0x96c000[_0xff68('0x1d')]?_[_0xff68('0x1e')](_0x96c000[_0xff68('0x1d')],function(_0x169edb){return{'model':db[_0x169edb[_0xff68('0x1f')]],'as':_0x169edb['as'],'attributes':_0x169edb[_0xff68('0x20')],'include':_0x169edb['include']?_[_0xff68('0x1e')](_0x169edb[_0xff68('0x1d')],function(_0xf909fa){return{'model':db[_0xf909fa[_0xff68('0x1f')]],'as':_0xf909fa['as'],'attributes':_0xf909fa[_0xff68('0x20')]};}):[]};}):[]};}):[]:[]})[_0xff68('0xc')](function(_0x5c1966){logger['info'](_0xff68('0x17'),_0x4b893a);logger[_0xff68('0xe')](_0xff68('0x17'),_0x4b893a,JSON['stringify'](_0x5c1966));_0x4d5acd(_0x5c1966);})[_0xff68('0x16')](function(_0x2bd057){logger[_0xff68('0x11')](_0xff68('0x17'),_0x2bd057['message'],_0x4b893a);_0x37b977(_0x3f00a0[_0xff68('0x11')](0x1f4,_0x2bd057[_0xff68('0x13')]));});});};exports[_0xff68('0x21')]=function(_0x4f8ff2){var _0x4887bb=this;return new Promise(function(_0x391a0d,_0x3fecbd){return db['CmHopperBlack'][_0xff68('0x22')](_0x4f8ff2['body'],{'raw':_0x4f8ff2['options']?_0x4f8ff2[_0xff68('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4f8ff2[_0xff68('0x1a')]?_0x4f8ff2[_0xff68('0x1a')][_0xff68('0x23')]||null:null,'attributes':_0x4f8ff2[_0xff68('0x1a')]?_0x4f8ff2[_0xff68('0x1a')][_0xff68('0x20')]||null:null,'limit':_0x4f8ff2[_0xff68('0x1a')]?_0x4f8ff2[_0xff68('0x1a')][_0xff68('0x1c')]||null:null})[_0xff68('0xc')](function(_0x481975){logger[_0xff68('0x14')](_0xff68('0x21'),_0x4f8ff2);logger['debug'](_0xff68('0x21'),_0x4f8ff2,JSON[_0xff68('0x10')](_0x481975));_0x391a0d(_0x481975);})[_0xff68('0x16')](function(_0x153ebf){logger[_0xff68('0x11')](_0xff68('0x21'),_0x153ebf[_0xff68('0x13')],_0x4f8ff2);_0x3fecbd(_0x4887bb['error'](0x1f4,_0x153ebf[_0xff68('0x13')]));});});};exports[_0xff68('0x24')]=function(_0x31b7a8){var _0x405aec=this;return new Promise(function(_0x45430b,_0x3779b2){return db['CmHopperBlack'][_0xff68('0x25')]({'where':_0x31b7a8[_0xff68('0x1a')]?_0x31b7a8['options'][_0xff68('0x23')]||null:null})['then'](function(_0x5809c9){logger[_0xff68('0x14')](_0xff68('0x24'),_0x31b7a8);logger[_0xff68('0xe')](_0xff68('0x24'),_0x31b7a8,JSON[_0xff68('0x10')](_0x5809c9));_0x45430b(_0x5809c9);})[_0xff68('0x16')](function(_0x1644ac){logger[_0xff68('0x11')]('DestroyCmHopperBlack',_0x1644ac['message'],_0x31b7a8);_0x3779b2(_0x405aec[_0xff68('0x11')](0x1f4,_0x1644ac[_0xff68('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 6054936..ee66adf 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 _0x9536=['connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','get','index','/describe','isAuthenticated','describe','/:id','show','update','delete','destroy','exports','multer','util','path'];(function(_0x23ee7c,_0x1c2ae4){var _0x746716=function(_0x403e14){while(--_0x403e14){_0x23ee7c['push'](_0x23ee7c['shift']());}};_0x746716(++_0x1c2ae4);}(_0x9536,0x179));var _0x6953=function(_0x1d83db,_0x89d115){_0x1d83db=_0x1d83db-0x0;var _0x2dc1d1=_0x9536[_0x1d83db];return _0x2dc1d1;};'use strict';var multer=require(_0x6953('0x0'));var util=require(_0x6953('0x1'));var path=require(_0x6953('0x2'));var timeout=require(_0x6953('0x3'));var express=require('express');var router=express[_0x6953('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x6953('0x5'));var interaction=require(_0x6953('0x6'));var config=require(_0x6953('0x7'));var controller=require(_0x6953('0x8'));router[_0x6953('0x9')]('/',auth['isAuthenticated'](),controller[_0x6953('0xa')]);router[_0x6953('0x9')](_0x6953('0xb'),auth[_0x6953('0xc')](),controller[_0x6953('0xd')]);router['get'](_0x6953('0xe'),auth[_0x6953('0xc')](),controller[_0x6953('0xf')]);router['put'](_0x6953('0xe'),auth[_0x6953('0xc')](),controller[_0x6953('0x10')]);router[_0x6953('0x11')](_0x6953('0xe'),auth[_0x6953('0xc')](),controller[_0x6953('0x12')]);module[_0x6953('0x13')]=router; \ No newline at end of file +var _0x4c60=['connect-timeout','Router','./cmHopperBlack.controller','get','isAuthenticated','index','/describe','/:id','show','update','exports','multer','util','path'];(function(_0x33e952,_0x29a2b0){var _0x28b06e=function(_0x21ede0){while(--_0x21ede0){_0x33e952['push'](_0x33e952['shift']());}};_0x28b06e(++_0x29a2b0);}(_0x4c60,0xc1));var _0x04c6=function(_0x210d6d,_0x3b699e){_0x210d6d=_0x210d6d-0x0;var _0x3b1446=_0x4c60[_0x210d6d];return _0x3b1446;};'use strict';var multer=require(_0x04c6('0x0'));var util=require(_0x04c6('0x1'));var path=require(_0x04c6('0x2'));var timeout=require(_0x04c6('0x3'));var express=require('express');var router=express[_0x04c6('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x04c6('0x5'));router[_0x04c6('0x6')]('/',auth[_0x04c6('0x7')](),controller[_0x04c6('0x8')]);router[_0x04c6('0x6')](_0x04c6('0x9'),auth[_0x04c6('0x7')](),controller['describe']);router[_0x04c6('0x6')](_0x04c6('0xa'),auth[_0x04c6('0x7')](),controller[_0x04c6('0xb')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x04c6('0xc')]);router['delete'](_0x04c6('0xa'),auth[_0x04c6('0x7')](),controller['destroy']);module[_0x04c6('0xd')]=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index 91112dd..a5cdc09 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 _0xa61e=['INTEGER','STRING','DATE','diff','seconds','BOOLEAN','sequelize','exports'];(function(_0x352658,_0x13068b){var _0x5a9f8f=function(_0x1ac831){while(--_0x1ac831){_0x352658['push'](_0x352658['shift']());}};_0x5a9f8f(++_0x13068b);}(_0xa61e,0x1d6));var _0xea61=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0xa61e[_0xae7c2f];return _0x5d7001;};'use strict';var Sequelize=require(_0xea61('0x0'));var moment=require('moment');module[_0xea61('0x1')]={'state':{'type':Sequelize[_0xea61('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xea61('0x3')]},'scheduledat':{'type':Sequelize[_0xea61('0x4')]},'countbusyretry':{'type':Sequelize[_0xea61('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xea61('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xea61('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xea61('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xea61('0x3')]},'originatecalleridnum':{'type':Sequelize[_0xea61('0x3')]},'originatecalleridname':{'type':Sequelize[_0xea61('0x3')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xea61('0x4')]},'responsetime':{'type':Sequelize[_0xea61('0x4')]},'answertime':{'type':Sequelize[_0xea61('0x4')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0xea61('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xea61('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xea61('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xea61('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xea61('0x3')]},'campaign':{'type':Sequelize[_0xea61('0x3')]},'campaigntype':{'type':Sequelize[_0xea61('0x3')]},'membername':{'type':Sequelize[_0xea61('0x3')]},'reason':{'type':Sequelize[_0xea61('0x3')]},'disposition':{'type':Sequelize[_0xea61('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xea61('0x3')]},'dispositionat':{'type':Sequelize[_0xea61('0x4')],'set':function(_0x18fbf4){var _0x36a5c3=this['getDataValue']('endtime');if(_0x36a5c3&&_0x18fbf4){this['setDataValue']('followuptime',moment(_0x18fbf4)[_0xea61('0x5')](moment(_0x36a5c3),_0xea61('0x6')));}}},'amd':{'type':Sequelize[_0xea61('0x7')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'blacklist':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0xea61('0x7')],'defaultValue':![]},'rescheduledat':{'type':Sequelize['DATE']},'callback':{'type':Sequelize[_0xea61('0x7')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xea61('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xea61('0x4')]},'deleted':{'type':Sequelize[_0xea61('0x3')],'defaultValue':null},'deletedat':{'type':Sequelize[_0xea61('0x4')]},'recallme':{'type':Sequelize[_0xea61('0x7')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0xea61('0x4')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xea61('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xea61('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xea61('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xea61('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x015e=['STRING','DATE','getDataValue','setDataValue','diff','seconds','BOOLEAN','sequelize','moment','INTEGER'];(function(_0x347d4f,_0x2afda3){var _0x176590=function(_0x4f7db4){while(--_0x4f7db4){_0x347d4f['push'](_0x347d4f['shift']());}};_0x176590(++_0x2afda3);}(_0x015e,0x6b));var _0xe015=function(_0x381589,_0x27a707){_0x381589=_0x381589-0x0;var _0x2a075d=_0x015e[_0x381589];return _0x2a075d;};'use strict';var Sequelize=require(_0xe015('0x0'));var moment=require(_0xe015('0x1'));module['exports']={'state':{'type':Sequelize[_0xe015('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xe015('0x3')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0xe015('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xe015('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xe015('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xe015('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xe015('0x3')]},'originatecalleridnum':{'type':Sequelize[_0xe015('0x3')]},'originatecalleridname':{'type':Sequelize[_0xe015('0x3')]},'calleridnum':{'type':Sequelize[_0xe015('0x3')]},'calleridname':{'type':Sequelize[_0xe015('0x3')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0xe015('0x4')]},'answertime':{'type':Sequelize[_0xe015('0x4')]},'droptime':{'type':Sequelize[_0xe015('0x4')]},'endtime':{'type':Sequelize[_0xe015('0x4')]},'ringtime':{'type':Sequelize[_0xe015('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xe015('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xe015('0x3')]},'campaign':{'type':Sequelize[_0xe015('0x3')]},'campaigntype':{'type':Sequelize[_0xe015('0x3')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0xe015('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xe015('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'dispositionat':{'type':Sequelize['DATE'],'set':function(_0x316d6b){var _0x458718=this[_0xe015('0x5')]('endtime');if(_0x458718&&_0x316d6b){this[_0xe015('0x6')]('followuptime',moment(_0x316d6b)[_0xe015('0x7')](moment(_0x458718),_0xe015('0x8')));}}},'amd':{'type':Sequelize[_0xe015('0x9')],'defaultValue':![]},'fax':{'type':Sequelize[_0xe015('0x9')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0xe015('0x9')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0xe015('0x9')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0xe015('0x4')]},'callback':{'type':Sequelize[_0xe015('0x9')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xe015('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xe015('0x4')]},'deleted':{'type':Sequelize[_0xe015('0x3')],'defaultValue':null},'deletedat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0xe015('0x9')],'defaultValue':![]},'agiafterat':{'type':Sequelize['DATE']},'countnosuchnumberretry':{'type':Sequelize[_0xe015('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xe015('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xe015('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 d0a41cb..30855f8 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 _0x524e=['destroy','name','send','index','map','rawAttributes','key','model','keys','filters','intersection','attributes','fields','query','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','CmHopperFinal','then','includeAll','include','findAll','rows','catch','show','length','find','describe','body','uniqueid','params','sequelize','COUNT','`state`\x20=\x200,\x201,\x20null','noSuchContacts','literal','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2022,\x201,\x20null','countContactsIvrCampaignHopperFinal','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','moveContactsQueueCampaignHopperFinal','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ListId','VoiceQueueId','createdAt','select','field','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','updatedAt','from','cm_hopper_final','toString','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','VoiceQueueId\x20=\x20?','group','Campaign','ContactId','ANY_VALUE(calleridnum)','CampaignId','CampaignId\x20=\x20?','state\x20=\x20?','calleridnum','CmHopper','findOne','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','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','sendStatus','status','end','json','offset','limit','count','set','apply','reject','save','update'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x524e,0x15e));var _0xe524=function(_0x450b21,_0x4260a0){_0x450b21=_0x450b21-0x0;var _0x8b9008=_0x524e[_0x450b21];return _0x8b9008;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe524('0x0'));var jsonpatch=require(_0xe524('0x1'));var rp=require(_0xe524('0x2'));var moment=require(_0xe524('0x3'));var BPromise=require(_0xe524('0x4'));var Mustache=require(_0xe524('0x5'));var util=require(_0xe524('0x6'));var path=require(_0xe524('0x7'));var sox=require(_0xe524('0x8'));var csv=require(_0xe524('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe524('0xa'));var _=require(_0xe524('0xb'));var squel=require(_0xe524('0xc'));var crypto=require('crypto');var jsforce=require(_0xe524('0xd'));var deskjs=require(_0xe524('0xe'));var toCsv=require(_0xe524('0x9'));var querystring=require(_0xe524('0xf'));var Papa=require(_0xe524('0x10'));var Redis=require(_0xe524('0x11'));var authService=require(_0xe524('0x12'));var qs=require(_0xe524('0x13'));var as=require(_0xe524('0x14'));var hardwareService=require(_0xe524('0x15'));var logger=require(_0xe524('0x16'))(_0xe524('0x17'));var utils=require(_0xe524('0x18'));var config=require(_0xe524('0x19'));var licenseUtil=require(_0xe524('0x1a'));var db=require(_0xe524('0x1b'))['db'];function respondWithStatusCode(_0x5077c1,_0x4b0f51){_0x4b0f51=_0x4b0f51||0xcc;return function(_0xfdc2a5){if(_0xfdc2a5){return _0x5077c1[_0xe524('0x1c')](_0x4b0f51);}return _0x5077c1[_0xe524('0x1d')](_0x4b0f51)[_0xe524('0x1e')]();};}function respondWithResult(_0x20a852,_0x57c1b6){_0x57c1b6=_0x57c1b6||0xc8;return function(_0x12ff75){if(_0x12ff75){return _0x20a852['status'](_0x57c1b6)[_0xe524('0x1f')](_0x12ff75);}};}function respondWithFilteredResult(_0x1b0af6,_0x48165e){return function(_0x569660){if(_0x569660){var _0x488fce=typeof _0x48165e[_0xe524('0x20')]==='undefined'&&typeof _0x48165e[_0xe524('0x21')]==='undefined';var _0x5c8736=_0x569660['count'];var _0x3a4027=_0x488fce?0x0:_0x48165e['offset'];var _0x11b2a1=_0x488fce?_0x569660[_0xe524('0x22')]:_0x48165e[_0xe524('0x20')]+_0x48165e[_0xe524('0x21')];var _0x5d7b17;if(_0x11b2a1>=_0x5c8736){_0x11b2a1=_0x5c8736;_0x5d7b17=0xc8;}else{_0x5d7b17=0xce;}_0x1b0af6[_0xe524('0x1d')](_0x5d7b17);return _0x1b0af6[_0xe524('0x23')]('Content-Range',_0x3a4027+'-'+_0x11b2a1+'/'+_0x5c8736)[_0xe524('0x1f')](_0x569660);}return null;};}function patchUpdates(_0x309f85){return function(_0x43a4f9){try{jsonpatch[_0xe524('0x24')](_0x43a4f9,_0x309f85,!![]);}catch(_0x1c4194){return BPromise[_0xe524('0x25')](_0x1c4194);}return _0x43a4f9[_0xe524('0x26')]();};}function saveUpdates(_0x375219,_0x7dfe97){return function(_0x5c4d21){if(_0x5c4d21){return _0x5c4d21[_0xe524('0x27')](_0x375219)['then'](function(_0x577d1f){return _0x577d1f;});}return null;};}function removeEntity(_0x2d2f83,_0x23df5e){return function(_0x1ad106){if(_0x1ad106){return _0x1ad106[_0xe524('0x28')]()['then'](function(){_0x2d2f83[_0xe524('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x17e245,_0xcf5db){return function(_0xd62772){if(!_0xd62772){_0x17e245[_0xe524('0x1c')](0x194);}return _0xd62772;};}function handleError(_0x4102d9,_0xfd5965){_0xfd5965=_0xfd5965||0x1f4;return function(_0x2141db){logger['error'](_0x2141db['stack']);if(_0x2141db[_0xe524('0x29')]){delete _0x2141db[_0xe524('0x29')];}_0x4102d9[_0xe524('0x1d')](_0xfd5965)[_0xe524('0x2a')](_0x2141db);};}exports[_0xe524('0x2b')]=function(_0x5405e4,_0x52f140){var _0x4b1ff={},_0x25e7a7={},_0x3aedd9={'count':0x0,'rows':[]};var _0x8070e4=_[_0xe524('0x2c')](db['CmHopperFinal'][_0xe524('0x2d')],function(_0x9a7e98){return{'name':_0x9a7e98['fieldName'],'type':_0x9a7e98['type'][_0xe524('0x2e')]};});_0x25e7a7[_0xe524('0x2f')]=_['map'](_0x8070e4,_0xe524('0x29'));_0x25e7a7['query']=_[_0xe524('0x30')](_0x5405e4['query']);_0x25e7a7[_0xe524('0x31')]=_[_0xe524('0x32')](_0x25e7a7[_0xe524('0x2f')],_0x25e7a7['query']);_0x4b1ff[_0xe524('0x33')]=_['intersection'](_0x25e7a7[_0xe524('0x2f')],qs[_0xe524('0x34')](_0x5405e4[_0xe524('0x35')]['fields']));_0x4b1ff[_0xe524('0x33')]=_0x4b1ff[_0xe524('0x33')]['length']?_0x4b1ff[_0xe524('0x33')]:_0x25e7a7[_0xe524('0x2f')];if(!_0x5405e4[_0xe524('0x35')][_0xe524('0x36')]('nolimit')){_0x4b1ff[_0xe524('0x21')]=qs[_0xe524('0x21')](_0x5405e4[_0xe524('0x35')][_0xe524('0x21')]);_0x4b1ff[_0xe524('0x20')]=qs[_0xe524('0x20')](_0x5405e4[_0xe524('0x35')][_0xe524('0x20')]);}_0x4b1ff['order']=qs[_0xe524('0x37')](_0x5405e4['query'][_0xe524('0x37')]);_0x4b1ff[_0xe524('0x38')]=qs['filters'](_[_0xe524('0x39')](_0x5405e4['query'],_0x25e7a7[_0xe524('0x31')]),_0x8070e4);if(_0x5405e4[_0xe524('0x35')][_0xe524('0x3a')]){_0x4b1ff[_0xe524('0x38')]=_[_0xe524('0x3b')](_0x4b1ff[_0xe524('0x38')],{'$or':_[_0xe524('0x2c')](_0x8070e4,function(_0x13762c){if(_0x13762c['type']!==_0xe524('0x3c')){var _0x940c05={};_0x940c05[_0x13762c[_0xe524('0x29')]]={'$like':'%'+_0x5405e4[_0xe524('0x35')][_0xe524('0x3a')]+'%'};return _0x940c05;}})});}_0x4b1ff=_[_0xe524('0x3b')]({},_0x4b1ff,_0x5405e4[_0xe524('0x3d')]);var _0x158d45={'where':_0x4b1ff['where']};return db[_0xe524('0x3e')][_0xe524('0x22')](_0x158d45)[_0xe524('0x3f')](function(_0x59781b){_0x3aedd9[_0xe524('0x22')]=_0x59781b;if(_0x5405e4['query'][_0xe524('0x40')]){_0x4b1ff[_0xe524('0x41')]=[{'all':!![]}];}return db[_0xe524('0x3e')][_0xe524('0x42')](_0x4b1ff);})[_0xe524('0x3f')](function(_0x4746cd){_0x3aedd9[_0xe524('0x43')]=_0x4746cd;return _0x3aedd9;})['then'](respondWithFilteredResult(_0x52f140,_0x4b1ff))[_0xe524('0x44')](handleError(_0x52f140,null));};exports[_0xe524('0x45')]=function(_0x13c54c,_0x376505){var _0x438962={'raw':!![],'where':{'id':_0x13c54c['params']['id']}},_0x1ae283={};_0x1ae283[_0xe524('0x2f')]=_[_0xe524('0x30')](db[_0xe524('0x3e')]['rawAttributes']);_0x1ae283[_0xe524('0x35')]=_['keys'](_0x13c54c['query']);_0x1ae283[_0xe524('0x31')]=_[_0xe524('0x32')](_0x1ae283['model'],_0x1ae283[_0xe524('0x35')]);_0x438962[_0xe524('0x33')]=_[_0xe524('0x32')](_0x1ae283[_0xe524('0x2f')],qs['fields'](_0x13c54c['query'][_0xe524('0x34')]));_0x438962[_0xe524('0x33')]=_0x438962['attributes'][_0xe524('0x46')]?_0x438962['attributes']:_0x1ae283[_0xe524('0x2f')];if(_0x13c54c[_0xe524('0x35')][_0xe524('0x40')]){_0x438962[_0xe524('0x41')]=[{'all':!![]}];}_0x438962=_[_0xe524('0x3b')]({},_0x438962,_0x13c54c[_0xe524('0x3d')]);return db[_0xe524('0x3e')][_0xe524('0x47')](_0x438962)[_0xe524('0x3f')](handleEntityNotFound(_0x376505,null))[_0xe524('0x3f')](respondWithResult(_0x376505,null))[_0xe524('0x44')](handleError(_0x376505,null));};exports[_0xe524('0x48')]=function(_0x3d7ab7,_0x33b1c8){return db[_0xe524('0x3e')]['describe']()[_0xe524('0x3f')](respondWithResult(_0x33b1c8,null))['catch'](handleError(_0x33b1c8,null));};exports['update']=function(_0x24f313,_0x59fe6b){if(_0x24f313[_0xe524('0x49')][_0xe524('0x4a')]){delete _0x24f313['body'][_0xe524('0x4a')];}return db['CmHopperFinal']['find']({'where':{'uniqueid':_0x24f313[_0xe524('0x4b')]['id']}})[_0xe524('0x3f')](handleEntityNotFound(_0x59fe6b,null))[_0xe524('0x3f')](saveUpdates(_0x24f313['body'],null))['then'](respondWithResult(_0x59fe6b,null))['catch'](handleError(_0x59fe6b,null));};exports['countContactsQueueCampaignHopperFinal']=function(_0x4f7a64,_0x5477ca,_0x45f504){return db[_0xe524('0x3e')]['findAll']({'raw':![],'where':{'VoiceQueueId':_0x4f7a64[_0xe524('0x4b')]['id']},'attributes':[[db[_0xe524('0x4c')]['fn'](_0xe524('0x4d'),db[_0xe524('0x4c')]['fn']('IF',db[_0xe524('0x4c')]['literal'](_0xe524('0x4e')))),_0xe524('0x4f')],[db[_0xe524('0x4c')]['fn']('COUNT',db[_0xe524('0x4c')]['fn']('IF',db['sequelize'][_0xe524('0x50')](_0xe524('0x51')))),_0xe524('0x52')],[db[_0xe524('0x4c')]['fn'](_0xe524('0x4d'),db[_0xe524('0x4c')]['fn']('IF',db[_0xe524('0x4c')][_0xe524('0x50')](_0xe524('0x53')))),_0xe524('0x54')],[db[_0xe524('0x4c')]['fn'](_0xe524('0x4d'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0xe524('0x55')))),_0xe524('0x56')],[db[_0xe524('0x4c')]['fn'](_0xe524('0x4d'),db[_0xe524('0x4c')]['fn']('IF',db[_0xe524('0x4c')][_0xe524('0x50')](_0xe524('0x57')))),_0xe524('0x58')],[db[_0xe524('0x4c')]['fn'](_0xe524('0x4d'),db['sequelize']['fn']('IF',db[_0xe524('0x4c')][_0xe524('0x50')]('`state`\x20=\x2011\x20,\x201,\x20null'))),'abandonedContacts'],[db['sequelize']['fn']('COUNT',db[_0xe524('0x4c')]['fn']('IF',db[_0xe524('0x4c')][_0xe524('0x50')](_0xe524('0x59')))),'reCallContacts'],[db[_0xe524('0x4c')]['fn'](_0xe524('0x4d'),db[_0xe524('0x4c')]['fn']('IF',db[_0xe524('0x4c')]['literal']('`state`\x20=\x2019,\x201,\x20null'))),'answeringMachine']]})[_0xe524('0x3f')](handleEntityNotFound(_0x5477ca,null))['then'](respondWithResult(_0x5477ca,null))[_0xe524('0x44')](handleError(_0x5477ca,null));};exports[_0xe524('0x5a')]=function(_0x3f4201,_0x287ab8,_0x2b2a0e){return db['CmHopperFinal']['findAll']({'raw':![],'where':{'CampaignId':_0x3f4201[_0xe524('0x4b')]['id']},'attributes':[[db[_0xe524('0x4c')]['fn'](_0xe524('0x4d'),db[_0xe524('0x4c')]['fn']('IF',db[_0xe524('0x4c')][_0xe524('0x50')]('`state`\x20=\x200,\x201,\x20null'))),_0xe524('0x4f')],[db[_0xe524('0x4c')]['fn'](_0xe524('0x4d'),db['sequelize']['fn']('IF',db[_0xe524('0x4c')][_0xe524('0x50')](_0xe524('0x51')))),'noAnswerContacts'],[db['sequelize']['fn'](_0xe524('0x4d'),db[_0xe524('0x4c')]['fn']('IF',db[_0xe524('0x4c')][_0xe524('0x50')](_0xe524('0x53')))),'busyContacts'],[db[_0xe524('0x4c')]['fn'](_0xe524('0x4d'),db[_0xe524('0x4c')]['fn']('IF',db[_0xe524('0x4c')][_0xe524('0x50')](_0xe524('0x55')))),_0xe524('0x56')],[db[_0xe524('0x4c')]['fn'](_0xe524('0x4d'),db[_0xe524('0x4c')]['fn']('IF',db[_0xe524('0x4c')]['literal'](_0xe524('0x57')))),_0xe524('0x58')],[db[_0xe524('0x4c')]['fn'](_0xe524('0x4d'),db[_0xe524('0x4c')]['fn']('IF',db['sequelize'][_0xe524('0x50')](_0xe524('0x5b')))),_0xe524('0x5c')],[db[_0xe524('0x4c')]['fn'](_0xe524('0x4d'),db[_0xe524('0x4c')]['fn']('IF',db[_0xe524('0x4c')]['literal'](_0xe524('0x59')))),_0xe524('0x5d')],[db[_0xe524('0x4c')]['fn'](_0xe524('0x4d'),db['sequelize']['fn']('IF',db[_0xe524('0x4c')]['literal'](_0xe524('0x5e')))),_0xe524('0x5f')]]})[_0xe524('0x3f')](handleEntityNotFound(_0x287ab8,null))['then'](respondWithResult(_0x287ab8,null))[_0xe524('0x44')](handleError(_0x287ab8,null));};exports[_0xe524('0x60')]=function(_0x43d125,_0x13905f,_0x4514d4){return db['VoiceQueue'][_0xe524('0x47')]({'where':{'id':_0x43d125[_0xe524('0x4b')]['id']}})[_0xe524('0x3f')](handleEntityNotFound(_0x13905f,null))[_0xe524('0x3f')](function(_0x109da1){var _0x57b6bb;if(_0x109da1){_0x57b6bb=squel[_0xe524('0x61')]()[_0xe524('0x62')](_0xe524('0x63'))[_0xe524('0x64')]([_0xe524('0x65'),_0xe524('0x66'),'ContactId',_0xe524('0x67'),_0xe524('0x68'),_0xe524('0x69'),'updatedAt'],squel[_0xe524('0x6a')]()[_0xe524('0x6b')]('ANY_VALUE(calleridnum)',_0xe524('0x65'))[_0xe524('0x6b')](_0xe524('0x6c'),_0xe524('0x66'))[_0xe524('0x6b')](_0xe524('0x6d'),'ContactId')[_0xe524('0x6b')](_0xe524('0x6e'),_0xe524('0x67'))[_0xe524('0x6b')](_0xe524('0x6f'),_0xe524('0x68'))[_0xe524('0x6b')](_0xe524('0x6c'),_0xe524('0x69'))[_0xe524('0x6b')](_0xe524('0x6c'),_0xe524('0x70'))[_0xe524('0x71')](_0xe524('0x72'))[_0xe524('0x38')]('VoiceQueueId\x20=\x20?',_0x43d125[_0xe524('0x4b')]['id'][_0xe524('0x73')]())[_0xe524('0x38')]('state\x20=\x20?',_0x43d125[_0xe524('0x49')][_0xe524('0x74')]['toString']())['where'](_0xe524('0x75'))['where'](_0xe524('0x76'),squel['select']()[_0xe524('0x6b')](_0xe524('0x65'))[_0xe524('0x71')](_0xe524('0x63'))['where']('VoiceQueueId\x20=\x20?',_0x43d125[_0xe524('0x4b')]['id'][_0xe524('0x73')]()))['where'](_0xe524('0x76'),squel[_0xe524('0x6a')]()[_0xe524('0x6b')]('calleridnum')[_0xe524('0x71')](_0xe524('0x72'))[_0xe524('0x38')](_0xe524('0x77'),_0x43d125[_0xe524('0x4b')]['id'][_0xe524('0x73')]())['where']('state\x20=\x204'))[_0xe524('0x78')]('ContactId'))[_0xe524('0x73')]();return db[_0xe524('0x4c')][_0xe524('0x35')](_0x57b6bb);}return[];})['then'](respondWithResult(_0x13905f,null))[_0xe524('0x44')](handleError(_0x13905f,null));};exports['moveContactsIvrCampaignHopperFinal']=function(_0x1681c5,_0x41e693,_0xfc62e5){return db[_0xe524('0x79')][_0xe524('0x47')]({'where':{'id':_0x1681c5[_0xe524('0x4b')]['id']}})['then'](handleEntityNotFound(_0x41e693,null))[_0xe524('0x3f')](function(_0x35d0f4){var _0xa8334;if(_0x35d0f4){_0xa8334=squel['insert']()[_0xe524('0x62')](_0xe524('0x63'))['fromQuery']([_0xe524('0x65'),_0xe524('0x66'),_0xe524('0x7a'),_0xe524('0x67'),'CampaignId',_0xe524('0x69'),_0xe524('0x70')],squel[_0xe524('0x6a')]()['field'](_0xe524('0x7b'),'phone')[_0xe524('0x6b')](_0xe524('0x6c'),_0xe524('0x66'))['field'](_0xe524('0x6d'),_0xe524('0x7a'))[_0xe524('0x6b')]('ANY_VALUE(ListId)','ListId')[_0xe524('0x6b')]('ANY_VALUE(CampaignId)',_0xe524('0x7c'))['field'](_0xe524('0x6c'),_0xe524('0x69'))['field'](_0xe524('0x6c'),_0xe524('0x70'))['from']('cm_hopper_final')[_0xe524('0x38')](_0xe524('0x7d'),_0x1681c5[_0xe524('0x4b')]['id']['toString']())[_0xe524('0x38')](_0xe524('0x7e'),_0x1681c5[_0xe524('0x49')][_0xe524('0x74')][_0xe524('0x73')]())[_0xe524('0x38')]('calleridnum\x20IS\x20NOT\x20NULL')[_0xe524('0x38')](_0xe524('0x76'),squel['select']()['field'](_0xe524('0x65'))[_0xe524('0x71')](_0xe524('0x63'))[_0xe524('0x38')]('CampaignId\x20=\x20?',_0x1681c5[_0xe524('0x4b')]['id'][_0xe524('0x73')]()))['where']('calleridnum\x20NOT\x20IN\x20(?)',squel[_0xe524('0x6a')]()[_0xe524('0x6b')](_0xe524('0x7f'))[_0xe524('0x71')](_0xe524('0x72'))[_0xe524('0x38')]('CampaignId\x20=\x20?',_0x1681c5['params']['id'][_0xe524('0x73')]())[_0xe524('0x38')]('state\x20=\x204'))['group'](_0xe524('0x7a')))[_0xe524('0x73')]();return db[_0xe524('0x4c')][_0xe524('0x35')](_0xa8334);}return[];})[_0xe524('0x3f')](respondWithResult(_0x41e693,null))[_0xe524('0x44')](handleError(_0x41e693,null));};exports['checkContactHopper']=function(_0x555801,_0x3e8668,_0x390093){return db[_0xe524('0x80')][_0xe524('0x81')]({'where':{'VoiceQueueId':_0x555801[_0xe524('0x49')][_0xe524('0x68')],'CampaignId':_0x555801[_0xe524('0x49')][_0xe524('0x7c')],'ContactId':_0x555801['body'][_0xe524('0x7a')]}})[_0xe524('0x3f')](handleEntityNotFound(_0x3e8668,null))[_0xe524('0x3f')](function(_0x5242b7){if(_0x5242b7){return _0x5242b7;}return null;})['then'](respondWithResult(_0x3e8668,null))[_0xe524('0x44')](handleError(_0x3e8668,null));}; \ No newline at end of file +var _0x7096=['group','moveContactsIvrCampaignHopperFinal','Campaign','CampaignId','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','state\x20=\x20?','findOne','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','name','send','map','rawAttributes','fieldName','type','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','limit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','params','CmHopperFinal','find','catch','describe','body','uniqueid','countContactsQueueCampaignHopperFinal','findAll','sequelize','COUNT','`state`\x20=\x200,\x201,\x20null','literal','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','`state`\x20=\x2019,\x201,\x20null','countContactsIvrCampaignHopperFinal','noSuchContacts','`state`\x20=\x2011\x20,\x201,\x20null','reCallContacts','moveContactsQueueCampaignHopperFinal','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','VoiceQueueId','updatedAt','select','field','ANY_VALUE(calleridnum)','NOW()','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','createdAt','from','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum','state\x20=\x204'];(function(_0x36acc5,_0x27b43a){var _0x528065=function(_0x23b5b6){while(--_0x23b5b6){_0x36acc5['push'](_0x36acc5['shift']());}};_0x528065(++_0x27b43a);}(_0x7096,0x10c));var _0x6709=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x7096[_0xbca1b1];return _0x4e1686;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6709('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6709('0x1'));var rp=require('request-promise');var moment=require(_0x6709('0x2'));var BPromise=require(_0x6709('0x3'));var Mustache=require(_0x6709('0x4'));var util=require(_0x6709('0x5'));var path=require(_0x6709('0x6'));var sox=require(_0x6709('0x7'));var csv=require(_0x6709('0x8'));var ejs=require(_0x6709('0x9'));var fs=require('fs');var fs_extra=require(_0x6709('0xa'));var _=require(_0x6709('0xb'));var squel=require(_0x6709('0xc'));var crypto=require(_0x6709('0xd'));var jsforce=require(_0x6709('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6709('0xf'));var Papa=require(_0x6709('0x10'));var Redis=require(_0x6709('0x11'));var authService=require(_0x6709('0x12'));var qs=require(_0x6709('0x13'));var as=require(_0x6709('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6709('0x15'));var utils=require(_0x6709('0x16'));var config=require(_0x6709('0x17'));var licenseUtil=require(_0x6709('0x18'));var db=require(_0x6709('0x19'))['db'];function respondWithStatusCode(_0x288f51,_0x1d56a5){_0x1d56a5=_0x1d56a5||0xcc;return function(_0x1ac547){if(_0x1ac547){return _0x288f51['sendStatus'](_0x1d56a5);}return _0x288f51[_0x6709('0x1a')](_0x1d56a5)[_0x6709('0x1b')]();};}function respondWithResult(_0x4d5255,_0x3706e1){_0x3706e1=_0x3706e1||0xc8;return function(_0x4e4587){if(_0x4e4587){return _0x4d5255[_0x6709('0x1a')](_0x3706e1)['json'](_0x4e4587);}};}function respondWithFilteredResult(_0x41af1f,_0x4bc059){return function(_0x149233){if(_0x149233){var _0x28866a=typeof _0x4bc059[_0x6709('0x1c')]===_0x6709('0x1d')&&typeof _0x4bc059['limit']==='undefined';var _0x5c4f94=_0x149233[_0x6709('0x1e')];var _0x235a54=_0x28866a?0x0:_0x4bc059['offset'];var _0x9c1fd8=_0x28866a?_0x149233[_0x6709('0x1e')]:_0x4bc059[_0x6709('0x1c')]+_0x4bc059['limit'];var _0x13cf04;if(_0x9c1fd8>=_0x5c4f94){_0x9c1fd8=_0x5c4f94;_0x13cf04=0xc8;}else{_0x13cf04=0xce;}_0x41af1f[_0x6709('0x1a')](_0x13cf04);return _0x41af1f[_0x6709('0x1f')](_0x6709('0x20'),_0x235a54+'-'+_0x9c1fd8+'/'+_0x5c4f94)['json'](_0x149233);}return null;};}function patchUpdates(_0x3c4971){return function(_0x1edac3){try{jsonpatch[_0x6709('0x21')](_0x1edac3,_0x3c4971,!![]);}catch(_0x3cf882){return BPromise[_0x6709('0x22')](_0x3cf882);}return _0x1edac3[_0x6709('0x23')]();};}function saveUpdates(_0x45921e,_0x17763d){return function(_0x386224){if(_0x386224){return _0x386224[_0x6709('0x24')](_0x45921e)[_0x6709('0x25')](function(_0xa36371){return _0xa36371;});}return null;};}function removeEntity(_0x5cf48b,_0x29f25f){return function(_0x81138e){if(_0x81138e){return _0x81138e[_0x6709('0x26')]()['then'](function(){_0x5cf48b[_0x6709('0x1a')](0xcc)[_0x6709('0x1b')]();});}};}function handleEntityNotFound(_0x20a347,_0x44b465){return function(_0x588e00){if(!_0x588e00){_0x20a347[_0x6709('0x27')](0x194);}return _0x588e00;};}function handleError(_0x3076fe,_0x50f7d6){_0x50f7d6=_0x50f7d6||0x1f4;return function(_0x585073){logger[_0x6709('0x28')](_0x585073['stack']);if(_0x585073[_0x6709('0x29')]){delete _0x585073[_0x6709('0x29')];}_0x3076fe['status'](_0x50f7d6)[_0x6709('0x2a')](_0x585073);};}exports['index']=function(_0x46a325,_0x3cd555){var _0x5b6906={},_0x137137={},_0x4e6989={'count':0x0,'rows':[]};var _0xe066d8=_[_0x6709('0x2b')](db['CmHopperFinal'][_0x6709('0x2c')],function(_0x5deff5){return{'name':_0x5deff5[_0x6709('0x2d')],'type':_0x5deff5[_0x6709('0x2e')]['key']};});_0x137137['model']=_[_0x6709('0x2b')](_0xe066d8,_0x6709('0x29'));_0x137137[_0x6709('0x2f')]=_[_0x6709('0x30')](_0x46a325[_0x6709('0x2f')]);_0x137137[_0x6709('0x31')]=_[_0x6709('0x32')](_0x137137[_0x6709('0x33')],_0x137137[_0x6709('0x2f')]);_0x5b6906['attributes']=_[_0x6709('0x32')](_0x137137[_0x6709('0x33')],qs[_0x6709('0x34')](_0x46a325[_0x6709('0x2f')]['fields']));_0x5b6906[_0x6709('0x35')]=_0x5b6906[_0x6709('0x35')][_0x6709('0x36')]?_0x5b6906[_0x6709('0x35')]:_0x137137['model'];if(!_0x46a325[_0x6709('0x2f')][_0x6709('0x37')]('nolimit')){_0x5b6906[_0x6709('0x38')]=qs[_0x6709('0x38')](_0x46a325['query'][_0x6709('0x38')]);_0x5b6906[_0x6709('0x1c')]=qs[_0x6709('0x1c')](_0x46a325[_0x6709('0x2f')][_0x6709('0x1c')]);}_0x5b6906[_0x6709('0x39')]=qs[_0x6709('0x3a')](_0x46a325['query'][_0x6709('0x3a')]);_0x5b6906[_0x6709('0x3b')]=qs['filters'](_[_0x6709('0x3c')](_0x46a325[_0x6709('0x2f')],_0x137137[_0x6709('0x31')]),_0xe066d8);if(_0x46a325[_0x6709('0x2f')][_0x6709('0x3d')]){_0x5b6906[_0x6709('0x3b')]=_['merge'](_0x5b6906[_0x6709('0x3b')],{'$or':_['map'](_0xe066d8,function(_0x31e05a){if(_0x31e05a[_0x6709('0x2e')]!==_0x6709('0x3e')){var _0x48492f={};_0x48492f[_0x31e05a[_0x6709('0x29')]]={'$like':'%'+_0x46a325[_0x6709('0x2f')][_0x6709('0x3d')]+'%'};return _0x48492f;}})});}_0x5b6906=_[_0x6709('0x3f')]({},_0x5b6906,_0x46a325[_0x6709('0x40')]);var _0x1030ee={'where':_0x5b6906[_0x6709('0x3b')]};return db['CmHopperFinal'][_0x6709('0x1e')](_0x1030ee)[_0x6709('0x25')](function(_0x50fbcd){_0x4e6989[_0x6709('0x1e')]=_0x50fbcd;if(_0x46a325[_0x6709('0x2f')][_0x6709('0x41')]){_0x5b6906[_0x6709('0x42')]=[{'all':!![]}];}return db['CmHopperFinal']['findAll'](_0x5b6906);})[_0x6709('0x25')](function(_0x3f0da1){_0x4e6989[_0x6709('0x43')]=_0x3f0da1;return _0x4e6989;})[_0x6709('0x25')](respondWithFilteredResult(_0x3cd555,_0x5b6906))['catch'](handleError(_0x3cd555,null));};exports['show']=function(_0x5af1fb,_0x3d4237){var _0x293577={'raw':!![],'where':{'id':_0x5af1fb[_0x6709('0x44')]['id']}},_0x54f74e={};_0x54f74e[_0x6709('0x33')]=_['keys'](db['CmHopperFinal'][_0x6709('0x2c')]);_0x54f74e[_0x6709('0x2f')]=_[_0x6709('0x30')](_0x5af1fb[_0x6709('0x2f')]);_0x54f74e[_0x6709('0x31')]=_['intersection'](_0x54f74e[_0x6709('0x33')],_0x54f74e['query']);_0x293577[_0x6709('0x35')]=_[_0x6709('0x32')](_0x54f74e[_0x6709('0x33')],qs['fields'](_0x5af1fb[_0x6709('0x2f')]['fields']));_0x293577['attributes']=_0x293577[_0x6709('0x35')][_0x6709('0x36')]?_0x293577[_0x6709('0x35')]:_0x54f74e[_0x6709('0x33')];if(_0x5af1fb[_0x6709('0x2f')][_0x6709('0x41')]){_0x293577[_0x6709('0x42')]=[{'all':!![]}];}_0x293577=_[_0x6709('0x3f')]({},_0x293577,_0x5af1fb[_0x6709('0x40')]);return db[_0x6709('0x45')][_0x6709('0x46')](_0x293577)[_0x6709('0x25')](handleEntityNotFound(_0x3d4237,null))[_0x6709('0x25')](respondWithResult(_0x3d4237,null))[_0x6709('0x47')](handleError(_0x3d4237,null));};exports[_0x6709('0x48')]=function(_0x4f82a0,_0xfbb810){return db['CmHopperFinal']['describe']()[_0x6709('0x25')](respondWithResult(_0xfbb810,null))[_0x6709('0x47')](handleError(_0xfbb810,null));};exports[_0x6709('0x24')]=function(_0xe8dd1,_0x22363b){if(_0xe8dd1[_0x6709('0x49')][_0x6709('0x4a')]){delete _0xe8dd1[_0x6709('0x49')]['uniqueid'];}return db[_0x6709('0x45')][_0x6709('0x46')]({'where':{'uniqueid':_0xe8dd1[_0x6709('0x44')]['id']}})[_0x6709('0x25')](handleEntityNotFound(_0x22363b,null))['then'](saveUpdates(_0xe8dd1[_0x6709('0x49')],null))['then'](respondWithResult(_0x22363b,null))[_0x6709('0x47')](handleError(_0x22363b,null));};exports[_0x6709('0x4b')]=function(_0x2a563b,_0xb257b5,_0x35c9cd){return db['CmHopperFinal'][_0x6709('0x4c')]({'raw':![],'where':{'VoiceQueueId':_0x2a563b[_0x6709('0x44')]['id']},'attributes':[[db[_0x6709('0x4d')]['fn'](_0x6709('0x4e'),db[_0x6709('0x4d')]['fn']('IF',db['sequelize']['literal'](_0x6709('0x4f')))),'noSuchContacts'],[db['sequelize']['fn'](_0x6709('0x4e'),db[_0x6709('0x4d')]['fn']('IF',db[_0x6709('0x4d')][_0x6709('0x50')](_0x6709('0x51')))),_0x6709('0x52')],[db[_0x6709('0x4d')]['fn'](_0x6709('0x4e'),db[_0x6709('0x4d')]['fn']('IF',db[_0x6709('0x4d')][_0x6709('0x50')]('`state`\x20=\x205,\x201,\x20null'))),_0x6709('0x53')],[db[_0x6709('0x4d')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x6709('0x4d')][_0x6709('0x50')](_0x6709('0x54')))),_0x6709('0x55')],[db['sequelize']['fn'](_0x6709('0x4e'),db['sequelize']['fn']('IF',db[_0x6709('0x4d')][_0x6709('0x50')](_0x6709('0x56')))),_0x6709('0x57')],[db[_0x6709('0x4d')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x6709('0x4d')][_0x6709('0x50')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x6709('0x58')],[db[_0x6709('0x4d')]['fn']('COUNT',db[_0x6709('0x4d')]['fn']('IF',db[_0x6709('0x4d')][_0x6709('0x50')](_0x6709('0x59')))),'reCallContacts'],[db['sequelize']['fn'](_0x6709('0x4e'),db['sequelize']['fn']('IF',db[_0x6709('0x4d')][_0x6709('0x50')](_0x6709('0x5a')))),'answeringMachine']]})[_0x6709('0x25')](handleEntityNotFound(_0xb257b5,null))['then'](respondWithResult(_0xb257b5,null))['catch'](handleError(_0xb257b5,null));};exports[_0x6709('0x5b')]=function(_0x511bae,_0x124199,_0x5cf7c0){return db[_0x6709('0x45')][_0x6709('0x4c')]({'raw':![],'where':{'CampaignId':_0x511bae[_0x6709('0x44')]['id']},'attributes':[[db[_0x6709('0x4d')]['fn']('COUNT',db[_0x6709('0x4d')]['fn']('IF',db[_0x6709('0x4d')][_0x6709('0x50')](_0x6709('0x4f')))),_0x6709('0x5c')],[db[_0x6709('0x4d')]['fn'](_0x6709('0x4e'),db['sequelize']['fn']('IF',db[_0x6709('0x4d')][_0x6709('0x50')](_0x6709('0x51')))),_0x6709('0x52')],[db[_0x6709('0x4d')]['fn'](_0x6709('0x4e'),db[_0x6709('0x4d')]['fn']('IF',db[_0x6709('0x4d')][_0x6709('0x50')]('`state`\x20=\x205,\x201,\x20null'))),_0x6709('0x53')],[db[_0x6709('0x4d')]['fn']('COUNT',db[_0x6709('0x4d')]['fn']('IF',db[_0x6709('0x4d')][_0x6709('0x50')](_0x6709('0x54')))),_0x6709('0x55')],[db[_0x6709('0x4d')]['fn'](_0x6709('0x4e'),db[_0x6709('0x4d')]['fn']('IF',db[_0x6709('0x4d')]['literal'](_0x6709('0x56')))),_0x6709('0x57')],[db[_0x6709('0x4d')]['fn'](_0x6709('0x4e'),db[_0x6709('0x4d')]['fn']('IF',db[_0x6709('0x4d')][_0x6709('0x50')](_0x6709('0x5d')))),_0x6709('0x58')],[db[_0x6709('0x4d')]['fn'](_0x6709('0x4e'),db['sequelize']['fn']('IF',db[_0x6709('0x4d')]['literal']('`state`\x20=\x2022,\x201,\x20null'))),_0x6709('0x5e')],[db[_0x6709('0x4d')]['fn'](_0x6709('0x4e'),db[_0x6709('0x4d')]['fn']('IF',db[_0x6709('0x4d')][_0x6709('0x50')](_0x6709('0x5a')))),'answeringMachine']]})['then'](handleEntityNotFound(_0x124199,null))[_0x6709('0x25')](respondWithResult(_0x124199,null))['catch'](handleError(_0x124199,null));};exports[_0x6709('0x5f')]=function(_0x47b7d9,_0x123183,_0x2f1faf){return db['VoiceQueue']['find']({'where':{'id':_0x47b7d9['params']['id']}})[_0x6709('0x25')](handleEntityNotFound(_0x123183,null))[_0x6709('0x25')](function(_0x24c584){var _0xbbfc50;if(_0x24c584){_0xbbfc50=squel[_0x6709('0x60')]()[_0x6709('0x61')](_0x6709('0x62'))[_0x6709('0x63')]([_0x6709('0x64'),_0x6709('0x65'),_0x6709('0x66'),_0x6709('0x67'),_0x6709('0x68'),'createdAt',_0x6709('0x69')],squel[_0x6709('0x6a')]()[_0x6709('0x6b')](_0x6709('0x6c'),'phone')['field'](_0x6709('0x6d'),'scheduledAt')['field'](_0x6709('0x6e'),_0x6709('0x66'))['field'](_0x6709('0x6f'),_0x6709('0x67'))[_0x6709('0x6b')](_0x6709('0x70'),_0x6709('0x68'))['field']('NOW()',_0x6709('0x71'))[_0x6709('0x6b')]('NOW()',_0x6709('0x69'))[_0x6709('0x72')](_0x6709('0x73'))['where'](_0x6709('0x74'),_0x47b7d9[_0x6709('0x44')]['id'][_0x6709('0x75')]())[_0x6709('0x3b')]('state\x20=\x20?',_0x47b7d9['body'][_0x6709('0x76')][_0x6709('0x75')]())[_0x6709('0x3b')](_0x6709('0x77'))[_0x6709('0x3b')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x6709('0x6a')]()[_0x6709('0x6b')]('phone')[_0x6709('0x72')](_0x6709('0x62'))[_0x6709('0x3b')](_0x6709('0x74'),_0x47b7d9[_0x6709('0x44')]['id']['toString']()))[_0x6709('0x3b')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x6709('0x6a')]()['field'](_0x6709('0x78'))[_0x6709('0x72')](_0x6709('0x73'))[_0x6709('0x3b')]('VoiceQueueId\x20=\x20?',_0x47b7d9[_0x6709('0x44')]['id'][_0x6709('0x75')]())[_0x6709('0x3b')](_0x6709('0x79')))[_0x6709('0x7a')](_0x6709('0x66')))['toString']();return db[_0x6709('0x4d')][_0x6709('0x2f')](_0xbbfc50);}return[];})[_0x6709('0x25')](respondWithResult(_0x123183,null))['catch'](handleError(_0x123183,null));};exports[_0x6709('0x7b')]=function(_0x124270,_0x57f14e,_0x4388a1){return db[_0x6709('0x7c')][_0x6709('0x46')]({'where':{'id':_0x124270['params']['id']}})[_0x6709('0x25')](handleEntityNotFound(_0x57f14e,null))[_0x6709('0x25')](function(_0x409723){var _0x5c8564;if(_0x409723){_0x5c8564=squel[_0x6709('0x60')]()[_0x6709('0x61')](_0x6709('0x62'))[_0x6709('0x63')]([_0x6709('0x64'),_0x6709('0x65'),'ContactId',_0x6709('0x67'),_0x6709('0x7d'),'createdAt',_0x6709('0x69')],squel[_0x6709('0x6a')]()[_0x6709('0x6b')]('ANY_VALUE(calleridnum)',_0x6709('0x64'))[_0x6709('0x6b')](_0x6709('0x6d'),_0x6709('0x65'))[_0x6709('0x6b')](_0x6709('0x6e'),_0x6709('0x66'))['field'](_0x6709('0x6f'),_0x6709('0x67'))[_0x6709('0x6b')](_0x6709('0x7e'),_0x6709('0x7d'))[_0x6709('0x6b')](_0x6709('0x6d'),'createdAt')[_0x6709('0x6b')]('NOW()',_0x6709('0x69'))[_0x6709('0x72')](_0x6709('0x73'))[_0x6709('0x3b')](_0x6709('0x7f'),_0x124270[_0x6709('0x44')]['id'][_0x6709('0x75')]())[_0x6709('0x3b')](_0x6709('0x80'),_0x124270[_0x6709('0x49')][_0x6709('0x76')][_0x6709('0x75')]())[_0x6709('0x3b')](_0x6709('0x77'))['where']('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x6709('0x6a')]()[_0x6709('0x6b')]('phone')[_0x6709('0x72')](_0x6709('0x62'))[_0x6709('0x3b')](_0x6709('0x7f'),_0x124270[_0x6709('0x44')]['id'][_0x6709('0x75')]()))[_0x6709('0x3b')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x6709('0x6a')]()[_0x6709('0x6b')](_0x6709('0x78'))[_0x6709('0x72')]('cm_hopper_final')['where'](_0x6709('0x7f'),_0x124270[_0x6709('0x44')]['id'][_0x6709('0x75')]())[_0x6709('0x3b')](_0x6709('0x79')))[_0x6709('0x7a')](_0x6709('0x66')))[_0x6709('0x75')]();return db[_0x6709('0x4d')][_0x6709('0x2f')](_0x5c8564);}return[];})[_0x6709('0x25')](respondWithResult(_0x57f14e,null))[_0x6709('0x47')](handleError(_0x57f14e,null));};exports['checkContactHopper']=function(_0x4767b7,_0x5f7adc,_0x393934){return db['CmHopper'][_0x6709('0x81')]({'where':{'VoiceQueueId':_0x4767b7[_0x6709('0x49')]['VoiceQueueId'],'CampaignId':_0x4767b7[_0x6709('0x49')]['CampaignId'],'ContactId':_0x4767b7[_0x6709('0x49')][_0x6709('0x66')]}})[_0x6709('0x25')](handleEntityNotFound(_0x5f7adc,null))[_0x6709('0x25')](function(_0x45cd4e){if(_0x45cd4e){return _0x45cd4e;}return null;})[_0x6709('0x25')](respondWithResult(_0x5f7adc,null))[_0x6709('0x47')](handleError(_0x5f7adc,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index d57f234..ef810de 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 _0x6077=['../../config/logger','api','moment','path','../../config/environment','./cmHopperFinal.attributes','define','CmHopperFinal','calleridnum','uniqueid','lodash','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6077,0x1de));var _0x7607=function(_0x4dd63b,_0x1bf52d){_0x4dd63b=_0x4dd63b-0x0;var _0x1a5ccd=_0x6077[_0x4dd63b];return _0x1a5ccd;};'use strict';var _=require(_0x7607('0x0'));var util=require(_0x7607('0x1'));var logger=require(_0x7607('0x2'))(_0x7607('0x3'));var moment=require(_0x7607('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x7607('0x5'));var rimraf=require('rimraf');var config=require(_0x7607('0x6'));var attributes=require(_0x7607('0x7'));module['exports']=function(_0x2f8dd0,_0xd7b847){return _0x2f8dd0[_0x7607('0x8')](_0x7607('0x9'),attributes,{'tableName':'cm_hopper_final','paranoid':![],'indexes':[{'name':_0x7607('0xa'),'fields':['calleridnum']},{'name':_0x7607('0xb'),'fields':[_0x7607('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb82b=['uniqueid','lodash','../../config/logger','api','moment','bluebird','path','rimraf','exports','define','calleridnum'];(function(_0x3e6668,_0x39a7ca){var _0x541850=function(_0x3939f1){while(--_0x3939f1){_0x3e6668['push'](_0x3e6668['shift']());}};_0x541850(++_0x39a7ca);}(_0xb82b,0x114));var _0xbb82=function(_0x502c7d,_0x2f1285){_0x502c7d=_0x502c7d-0x0;var _0x30b7ed=_0xb82b[_0x502c7d];return _0x30b7ed;};'use strict';var _=require(_0xbb82('0x0'));var util=require('util');var logger=require(_0xbb82('0x1'))(_0xbb82('0x2'));var moment=require(_0xbb82('0x3'));var BPromise=require(_0xbb82('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xbb82('0x5'));var rimraf=require(_0xbb82('0x6'));var config=require('../../config/environment');var attributes=require('./cmHopperFinal.attributes');module[_0xbb82('0x7')]=function(_0x27bee8,_0x46dc89){return _0x27bee8[_0xbb82('0x8')]('CmHopperFinal',attributes,{'tableName':'cm_hopper_final','paranoid':![],'indexes':[{'name':_0xbb82('0x9'),'fields':[_0xbb82('0x9')]},{'name':_0xbb82('0xa'),'fields':[_0xbb82('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index 43cacdc..ffcd0e3 100644 --- a/server/api/cmHopperFinal/cmHopperFinal.rpc.js +++ b/server/api/cmHopperFinal/cmHopperFinal.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['debug','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopperFinal,\x20%s,\x20%s','CmHopperFinal,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateCmHopperFinal','CmHopperFinal','create','options','raw'];(function(_0x4e0b7d,_0x5648c9){var _0x1406fa=function(_0x44c744){while(--_0x44c744){_0x4e0b7d['push'](_0x4e0b7d['shift']());}};_0x1406fa(++_0x5648c9);}(_0xb10b,0x12a));var _0xbb10=function(_0x3d542c,_0x2098ae){_0x3d542c=_0x3d542c-0x0;var _0x4946de=_0xb10b[_0x3d542c];return _0x4946de;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![]})[_0xbb10('0xc')](function(_0xdf237d){logger[_0xbb10('0xd')]('CreateCmHopperFinal',_0x378da8);logger[_0xbb10('0x1a')](_0xbb10('0x15'),_0x378da8,JSON['stringify'](_0xdf237d));_0x575cca(_0xdf237d);})['catch'](function(_0x8e2b97){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x8e2b97[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x8e2b97[_0xbb10('0x13')]));});});}; \ No newline at end of file +var _0x7a54=['../../config/environment','jayson/promise','http','info','CmHopperFinal,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','CmHopperFinal','create','body','options','raw','CreateCmHopperFinal','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x3fc269,_0x2b738e){var _0x5a7d09=function(_0x5ceb33){while(--_0x5ceb33){_0x3fc269['push'](_0x3fc269['shift']());}};_0x5a7d09(++_0x2b738e);}(_0x7a54,0x106));var _0x47a5=function(_0x4f6934,_0xfc56e0){_0x4f6934=_0x4f6934-0x0;var _0x26a9ae=_0x7a54[_0x4f6934];return _0x26a9ae;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('CmHopperFinal,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['CreateCmHopperFinal']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')](_0x5247fd[_0x47a5('0x17')],{'raw':_0x5247fd[_0x47a5('0x18')]?_0x5247fd[_0x47a5('0x18')][_0x47a5('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1570bc){logger[_0x47a5('0xb')]('CreateCmHopperFinal',_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1a'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1570bc));_0xaf70a6(_0x1570bc);})['catch'](function(_0xb8ae6c){logger[_0x47a5('0xf')](_0x47a5('0x1a'),_0xb8ae6c[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81['error'](0x1f4,_0xb8ae6c[_0x47a5('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index 504850d..bea4770 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 _0x2ba0=['post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','update','exports','util','path','Router','../../components/auth/service','../../components/interaction/service','./cmHopperFinal.controller','index','/describe','isAuthenticated','describe','/:id','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','get','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal'];(function(_0x273c39,_0x1052e6){var _0x46d6b5=function(_0x44f1fb){while(--_0x44f1fb){_0x273c39['push'](_0x273c39['shift']());}};_0x46d6b5(++_0x1052e6);}(_0x2ba0,0x1dd));var _0x02ba=function(_0x5cc8d9,_0x489eee){_0x5cc8d9=_0x5cc8d9-0x0;var _0x1e4704=_0x2ba0[_0x5cc8d9];return _0x1e4704;};'use strict';var multer=require('multer');var util=require(_0x02ba('0x0'));var path=require(_0x02ba('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x02ba('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x02ba('0x3'));var interaction=require(_0x02ba('0x4'));var config=require('../../config/environment');var controller=require(_0x02ba('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0x02ba('0x6')]);router['get'](_0x02ba('0x7'),auth[_0x02ba('0x8')](),controller[_0x02ba('0x9')]);router['get'](_0x02ba('0xa'),auth[_0x02ba('0x8')](),controller[_0x02ba('0xb')]);router['get'](_0x02ba('0xc'),auth[_0x02ba('0x8')](),controller[_0x02ba('0xd')]);router[_0x02ba('0xe')](_0x02ba('0xf'),auth['isAuthenticated'](),controller[_0x02ba('0x10')]);router[_0x02ba('0x11')](_0x02ba('0x12'),auth[_0x02ba('0x8')](),controller[_0x02ba('0x13')]);router[_0x02ba('0x11')](_0x02ba('0x14'),auth[_0x02ba('0x8')](),controller[_0x02ba('0x15')]);router['post'](_0x02ba('0x16'),auth[_0x02ba('0x8')](),controller[_0x02ba('0x17')]);router['put']('/:id',auth[_0x02ba('0x8')](),controller[_0x02ba('0x18')]);module[_0x02ba('0x19')]=router; \ No newline at end of file +var _0x052c=['moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','update','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post'];(function(_0x5002a7,_0x1dc26f){var _0x427c99=function(_0x216f33){while(--_0x216f33){_0x5002a7['push'](_0x5002a7['shift']());}};_0x427c99(++_0x1dc26f);}(_0x052c,0xe6));var _0xc052=function(_0x395671,_0x3798a8){_0x395671=_0x395671-0x0;var _0x33440e=_0x052c[_0x395671];return _0x33440e;};'use strict';var multer=require(_0xc052('0x0'));var util=require(_0xc052('0x1'));var path=require(_0xc052('0x2'));var timeout=require(_0xc052('0x3'));var express=require(_0xc052('0x4'));var router=express[_0xc052('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xc052('0x6'));var config=require(_0xc052('0x7'));var controller=require('./cmHopperFinal.controller');router[_0xc052('0x8')]('/',auth[_0xc052('0x9')](),controller[_0xc052('0xa')]);router[_0xc052('0x8')](_0xc052('0xb'),auth[_0xc052('0x9')](),controller[_0xc052('0xc')]);router[_0xc052('0x8')](_0xc052('0xd'),auth[_0xc052('0x9')](),controller[_0xc052('0xe')]);router[_0xc052('0x8')](_0xc052('0xf'),auth[_0xc052('0x9')](),controller[_0xc052('0x10')]);router['get'](_0xc052('0x11'),auth[_0xc052('0x9')](),controller[_0xc052('0x12')]);router[_0xc052('0x13')]('/voice/queue/moveContacts/:id',auth['isAuthenticated'](),controller[_0xc052('0x14')]);router[_0xc052('0x13')](_0xc052('0x15'),auth['isAuthenticated'](),controller[_0xc052('0x16')]);router['post'](_0xc052('0x17'),auth[_0xc052('0x9')](),controller['checkContactHopper']);router['put'](_0xc052('0xd'),auth[_0xc052('0x9')](),controller[_0xc052('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index df2cfb5..47e7bf3 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 _0xf898=['DATE','INTEGER','BOOLEAN','sequelize','exports','STRING'];(function(_0x37b67e,_0x2c3ceb){var _0x2072bf=function(_0x4f2d2b){while(--_0x4f2d2b){_0x37b67e['push'](_0x37b67e['shift']());}};_0x2072bf(++_0x2c3ceb);}(_0xf898,0x14d));var _0x8f89=function(_0x47714d,_0x518cd5){_0x47714d=_0x47714d-0x0;var _0x338896=_0xf898[_0x47714d];return _0x338896;};'use strict';var Sequelize=require(_0x8f89('0x0'));module[_0x8f89('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x8f89('0x2')]},'scheduledat':{'type':Sequelize[_0x8f89('0x3')]},'countbusyretry':{'type':Sequelize[_0x8f89('0x4')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x8f89('0x4')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0x8f89('0x2')]},'originatecalleridname':{'type':Sequelize[_0x8f89('0x2')]},'calleridnum':{'type':Sequelize[_0x8f89('0x2')]},'calleridname':{'type':Sequelize[_0x8f89('0x2')]},'starttime':{'type':Sequelize[_0x8f89('0x3')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x8f89('0x3')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x8f89('0x4')],'defaultValue':0x0},'talktime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x8f89('0x4')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0x8f89('0x2')]},'campaigntype':{'type':Sequelize[_0x8f89('0x2')]},'membername':{'type':Sequelize[_0x8f89('0x2')]},'reason':{'type':Sequelize[_0x8f89('0x2')]},'amd':{'type':Sequelize[_0x8f89('0x5')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x8f89('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x8f89('0x3')]},'recallme':{'type':Sequelize[_0x8f89('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x8f89('0x3')]},'edited':{'type':Sequelize[_0x8f89('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x8f89('0x4')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x8f89('0x4')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x8f89('0x4')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xf621=['STRING','BOOLEAN','sequelize','exports','INTEGER','DATE'];(function(_0x29436c,_0x260a6a){var _0x3760a2=function(_0xc9ee2){while(--_0xc9ee2){_0x29436c['push'](_0x29436c['shift']());}};_0x3760a2(++_0x260a6a);}(_0xf621,0x1b8));var _0x1f62=function(_0x5027b1,_0x1409a5){_0x5027b1=_0x5027b1-0x0;var _0x4a46cf=_0xf621[_0x5027b1];return _0x4a46cf;};'use strict';var Sequelize=require(_0x1f62('0x0'));module[_0x1f62('0x1')]={'state':{'type':Sequelize[_0x1f62('0x2')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x1f62('0x3')]},'countbusyretry':{'type':Sequelize[_0x1f62('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x1f62('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x1f62('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x1f62('0x4')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x1f62('0x4')]},'calleridname':{'type':Sequelize[_0x1f62('0x4')]},'starttime':{'type':Sequelize[_0x1f62('0x3')]},'responsetime':{'type':Sequelize[_0x1f62('0x3')]},'answertime':{'type':Sequelize[_0x1f62('0x3')]},'droptime':{'type':Sequelize[_0x1f62('0x3')]},'endtime':{'type':Sequelize[_0x1f62('0x3')]},'ringtime':{'type':Sequelize[_0x1f62('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x1f62('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x1f62('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0x1f62('0x4')]},'campaigntype':{'type':Sequelize[_0x1f62('0x4')]},'membername':{'type':Sequelize[_0x1f62('0x4')]},'reason':{'type':Sequelize[_0x1f62('0x4')]},'amd':{'type':Sequelize[_0x1f62('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0x1f62('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0x1f62('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x1f62('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x1f62('0x3')]},'recallme':{'type':Sequelize[_0x1f62('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x1f62('0x3')]},'edited':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x1f62('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x1f62('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x1f62('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x1f62('0x4')]}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index e24e6f6..0086482 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 _0xedc6=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','end','status','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','then','destroy','error','name','index','map','CmHopperHistory','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','merge','find','create','body','describe','update','uniqueid','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','../../components/parsers/qs'];(function(_0x545666,_0x86e245){var _0x883f4d=function(_0x33c02f){while(--_0x33c02f){_0x545666['push'](_0x545666['shift']());}};_0x883f4d(++_0x86e245);}(_0xedc6,0x12a));var _0x6edc=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0xedc6[_0x29b609];return _0x54c952;};'use strict';var emlformat=require(_0x6edc('0x0'));var rimraf=require(_0x6edc('0x1'));var zipdir=require(_0x6edc('0x2'));var jsonpatch=require(_0x6edc('0x3'));var rp=require(_0x6edc('0x4'));var moment=require(_0x6edc('0x5'));var BPromise=require(_0x6edc('0x6'));var Mustache=require(_0x6edc('0x7'));var util=require(_0x6edc('0x8'));var path=require('path');var sox=require(_0x6edc('0x9'));var csv=require(_0x6edc('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6edc('0xb'));var _=require(_0x6edc('0xc'));var squel=require(_0x6edc('0xd'));var crypto=require(_0x6edc('0xe'));var jsforce=require(_0x6edc('0xf'));var deskjs=require(_0x6edc('0x10'));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(_0x6edc('0x11'));var as=require(_0x6edc('0x12'));var hardwareService=require(_0x6edc('0x13'));var logger=require(_0x6edc('0x14'))(_0x6edc('0x15'));var utils=require('../../config/utils');var config=require(_0x6edc('0x16'));var licenseUtil=require(_0x6edc('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x360831,_0x46113d){_0x46113d=_0x46113d||0xcc;return function(_0x3f7fa8){if(_0x3f7fa8){return _0x360831[_0x6edc('0x18')](_0x46113d);}return _0x360831['status'](_0x46113d)[_0x6edc('0x19')]();};}function respondWithResult(_0x2ab2f0,_0x53d484){_0x53d484=_0x53d484||0xc8;return function(_0x1faf6d){if(_0x1faf6d){return _0x2ab2f0[_0x6edc('0x1a')](_0x53d484)['json'](_0x1faf6d);}};}function respondWithFilteredResult(_0x32882c,_0x4d6896){return function(_0x4e4ee3){if(_0x4e4ee3){var _0x5bbc30=typeof _0x4d6896[_0x6edc('0x1b')]===_0x6edc('0x1c')&&typeof _0x4d6896['limit']===_0x6edc('0x1c');var _0x533d11=_0x4e4ee3[_0x6edc('0x1d')];var _0xf1a6b1=_0x5bbc30?0x0:_0x4d6896[_0x6edc('0x1b')];var _0x257d80=_0x5bbc30?_0x4e4ee3[_0x6edc('0x1d')]:_0x4d6896[_0x6edc('0x1b')]+_0x4d6896[_0x6edc('0x1e')];var _0x28fd26;if(_0x257d80>=_0x533d11){_0x257d80=_0x533d11;_0x28fd26=0xc8;}else{_0x28fd26=0xce;}_0x32882c['status'](_0x28fd26);return _0x32882c[_0x6edc('0x1f')](_0x6edc('0x20'),_0xf1a6b1+'-'+_0x257d80+'/'+_0x533d11)[_0x6edc('0x21')](_0x4e4ee3);}return null;};}function patchUpdates(_0x1a1f20){return function(_0x29682b){try{jsonpatch[_0x6edc('0x22')](_0x29682b,_0x1a1f20,!![]);}catch(_0x32f782){return BPromise[_0x6edc('0x23')](_0x32f782);}return _0x29682b[_0x6edc('0x24')]();};}function saveUpdates(_0x164089,_0x23cc60){return function(_0x3a2dee){if(_0x3a2dee){return _0x3a2dee['update'](_0x164089)[_0x6edc('0x25')](function(_0x2b0fa1){return _0x2b0fa1;});}return null;};}function removeEntity(_0x412f8e,_0xce2a3e){return function(_0x39ab06){if(_0x39ab06){return _0x39ab06[_0x6edc('0x26')]()[_0x6edc('0x25')](function(){_0x412f8e[_0x6edc('0x1a')](0xcc)[_0x6edc('0x19')]();});}};}function handleEntityNotFound(_0x51d33f,_0x2e445c){return function(_0x416c83){if(!_0x416c83){_0x51d33f[_0x6edc('0x18')](0x194);}return _0x416c83;};}function handleError(_0x10d5b1,_0x5f3a5e){_0x5f3a5e=_0x5f3a5e||0x1f4;return function(_0x1a6425){logger[_0x6edc('0x27')](_0x1a6425['stack']);if(_0x1a6425[_0x6edc('0x28')]){delete _0x1a6425[_0x6edc('0x28')];}_0x10d5b1['status'](_0x5f3a5e)['send'](_0x1a6425);};}exports[_0x6edc('0x29')]=function(_0x5c9a61,_0x1589b3){var _0x4ea3ce={},_0x1567fd={},_0x37c7a2={'count':0x0,'rows':[]};var _0x112fd6=_[_0x6edc('0x2a')](db[_0x6edc('0x2b')][_0x6edc('0x2c')],function(_0x4f8243){return{'name':_0x4f8243[_0x6edc('0x2d')],'type':_0x4f8243[_0x6edc('0x2e')][_0x6edc('0x2f')]};});_0x1567fd[_0x6edc('0x30')]=_['map'](_0x112fd6,_0x6edc('0x28'));_0x1567fd[_0x6edc('0x31')]=_[_0x6edc('0x32')](_0x5c9a61[_0x6edc('0x31')]);_0x1567fd[_0x6edc('0x33')]=_[_0x6edc('0x34')](_0x1567fd[_0x6edc('0x30')],_0x1567fd[_0x6edc('0x31')]);_0x4ea3ce[_0x6edc('0x35')]=_[_0x6edc('0x34')](_0x1567fd['model'],qs[_0x6edc('0x36')](_0x5c9a61[_0x6edc('0x31')]['fields']));_0x4ea3ce['attributes']=_0x4ea3ce[_0x6edc('0x35')][_0x6edc('0x37')]?_0x4ea3ce[_0x6edc('0x35')]:_0x1567fd['model'];if(!_0x5c9a61[_0x6edc('0x31')][_0x6edc('0x38')](_0x6edc('0x39'))){_0x4ea3ce[_0x6edc('0x1e')]=qs[_0x6edc('0x1e')](_0x5c9a61[_0x6edc('0x31')]['limit']);_0x4ea3ce[_0x6edc('0x1b')]=qs[_0x6edc('0x1b')](_0x5c9a61[_0x6edc('0x31')][_0x6edc('0x1b')]);}_0x4ea3ce[_0x6edc('0x3a')]=qs[_0x6edc('0x3b')](_0x5c9a61[_0x6edc('0x31')][_0x6edc('0x3b')]);_0x4ea3ce[_0x6edc('0x3c')]=qs[_0x6edc('0x33')](_[_0x6edc('0x3d')](_0x5c9a61['query'],_0x1567fd[_0x6edc('0x33')]),_0x112fd6);if(_0x5c9a61['query']['filter']){_0x4ea3ce[_0x6edc('0x3c')]=_['merge'](_0x4ea3ce[_0x6edc('0x3c')],{'$or':_['map'](_0x112fd6,function(_0x1a8162){if(_0x1a8162['type']!==_0x6edc('0x3e')){var _0x2b54c0={};_0x2b54c0[_0x1a8162[_0x6edc('0x28')]]={'$like':'%'+_0x5c9a61['query'][_0x6edc('0x3f')]+'%'};return _0x2b54c0;}})});}_0x4ea3ce=_['merge']({},_0x4ea3ce,_0x5c9a61[_0x6edc('0x40')]);var _0x1aa08b={'where':_0x4ea3ce[_0x6edc('0x3c')]};return db[_0x6edc('0x2b')][_0x6edc('0x1d')](_0x1aa08b)['then'](function(_0x2ba658){_0x37c7a2[_0x6edc('0x1d')]=_0x2ba658;if(_0x5c9a61[_0x6edc('0x31')][_0x6edc('0x41')]){_0x4ea3ce[_0x6edc('0x42')]=[{'all':!![]}];}return db[_0x6edc('0x2b')][_0x6edc('0x43')](_0x4ea3ce);})[_0x6edc('0x25')](function(_0x2be30e){_0x37c7a2[_0x6edc('0x44')]=_0x2be30e;return _0x37c7a2;})[_0x6edc('0x25')](respondWithFilteredResult(_0x1589b3,_0x4ea3ce))[_0x6edc('0x45')](handleError(_0x1589b3,null));};exports[_0x6edc('0x46')]=function(_0x4861e4,_0x5442c0){var _0x3b6d92={'raw':!![],'where':{'id':_0x4861e4[_0x6edc('0x47')]['id']}},_0x2119ac={};_0x2119ac[_0x6edc('0x30')]=_['keys'](db[_0x6edc('0x2b')][_0x6edc('0x2c')]);_0x2119ac[_0x6edc('0x31')]=_[_0x6edc('0x32')](_0x4861e4['query']);_0x2119ac[_0x6edc('0x33')]=_[_0x6edc('0x34')](_0x2119ac['model'],_0x2119ac[_0x6edc('0x31')]);_0x3b6d92[_0x6edc('0x35')]=_[_0x6edc('0x34')](_0x2119ac[_0x6edc('0x30')],qs[_0x6edc('0x36')](_0x4861e4['query'][_0x6edc('0x36')]));_0x3b6d92['attributes']=_0x3b6d92[_0x6edc('0x35')][_0x6edc('0x37')]?_0x3b6d92[_0x6edc('0x35')]:_0x2119ac[_0x6edc('0x30')];if(_0x4861e4[_0x6edc('0x31')][_0x6edc('0x41')]){_0x3b6d92['include']=[{'all':!![]}];}_0x3b6d92=_[_0x6edc('0x48')]({},_0x3b6d92,_0x4861e4[_0x6edc('0x40')]);return db[_0x6edc('0x2b')][_0x6edc('0x49')](_0x3b6d92)[_0x6edc('0x25')](handleEntityNotFound(_0x5442c0,null))[_0x6edc('0x25')](respondWithResult(_0x5442c0,null))[_0x6edc('0x45')](handleError(_0x5442c0,null));};exports[_0x6edc('0x4a')]=function(_0x35517f,_0x57c5da){return db['CmHopperHistory'][_0x6edc('0x4a')](_0x35517f[_0x6edc('0x4b')],{})['then'](respondWithResult(_0x57c5da,0xc9))[_0x6edc('0x45')](handleError(_0x57c5da,null));};exports[_0x6edc('0x4c')]=function(_0x31265b,_0xd86af7){return db[_0x6edc('0x2b')][_0x6edc('0x4c')]()['then'](respondWithResult(_0xd86af7,null))[_0x6edc('0x45')](handleError(_0xd86af7,null));};exports[_0x6edc('0x4d')]=function(_0x1164ff,_0x23a8cb){if(_0x1164ff[_0x6edc('0x4b')]['uniqueid']){delete _0x1164ff['body'][_0x6edc('0x4e')];}return db[_0x6edc('0x2b')][_0x6edc('0x49')]({'where':{'uniqueid':_0x1164ff[_0x6edc('0x47')]['id']}})[_0x6edc('0x25')](handleEntityNotFound(_0x23a8cb,null))['then'](saveUpdates(_0x1164ff[_0x6edc('0x4b')],null))['then'](respondWithResult(_0x23a8cb,null))['catch'](handleError(_0x23a8cb,null));}; \ No newline at end of file +var _0x1b72=['key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','pick','filter','where','merge','type','VIRTUAL','CmHopperHistory','includeAll','include','rows','show','params','rawAttributes','find','catch','describe','body','uniqueid','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','reject','save','update','then','destroy','name','send','index','map'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x1b72,0x149));var _0x21b7=function(_0x5f3f88,_0x562baf){_0x5f3f88=_0x5f3f88-0x0;var _0xd08119=_0x1b72[_0x5f3f88];return _0xd08119;};'use strict';var emlformat=require(_0x21b7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x21b7('0x1'));var jsonpatch=require(_0x21b7('0x2'));var rp=require(_0x21b7('0x3'));var moment=require(_0x21b7('0x4'));var BPromise=require(_0x21b7('0x5'));var Mustache=require(_0x21b7('0x6'));var util=require(_0x21b7('0x7'));var path=require(_0x21b7('0x8'));var sox=require(_0x21b7('0x9'));var csv=require(_0x21b7('0xa'));var ejs=require(_0x21b7('0xb'));var fs=require('fs');var fs_extra=require(_0x21b7('0xc'));var _=require(_0x21b7('0xd'));var squel=require(_0x21b7('0xe'));var crypto=require(_0x21b7('0xf'));var jsforce=require(_0x21b7('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x21b7('0xa'));var querystring=require(_0x21b7('0x11'));var Papa=require(_0x21b7('0x12'));var Redis=require(_0x21b7('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x21b7('0x14'));var as=require(_0x21b7('0x15'));var hardwareService=require(_0x21b7('0x16'));var logger=require(_0x21b7('0x17'))('api');var utils=require('../../config/utils');var config=require(_0x21b7('0x18'));var licenseUtil=require(_0x21b7('0x19'));var db=require(_0x21b7('0x1a'))['db'];function respondWithStatusCode(_0x590c56,_0x24da60){_0x24da60=_0x24da60||0xcc;return function(_0x152efe){if(_0x152efe){return _0x590c56[_0x21b7('0x1b')](_0x24da60);}return _0x590c56[_0x21b7('0x1c')](_0x24da60)[_0x21b7('0x1d')]();};}function respondWithResult(_0x560119,_0x300a0f){_0x300a0f=_0x300a0f||0xc8;return function(_0x3dcd69){if(_0x3dcd69){return _0x560119[_0x21b7('0x1c')](_0x300a0f)[_0x21b7('0x1e')](_0x3dcd69);}};}function respondWithFilteredResult(_0x3cdc44,_0x150b13){return function(_0x508743){if(_0x508743){var _0x52110e=typeof _0x150b13['offset']===_0x21b7('0x1f')&&typeof _0x150b13[_0x21b7('0x20')]==='undefined';var _0x55c601=_0x508743[_0x21b7('0x21')];var _0x207ae7=_0x52110e?0x0:_0x150b13[_0x21b7('0x22')];var _0x157814=_0x52110e?_0x508743[_0x21b7('0x21')]:_0x150b13['offset']+_0x150b13[_0x21b7('0x20')];var _0x18d6de;if(_0x157814>=_0x55c601){_0x157814=_0x55c601;_0x18d6de=0xc8;}else{_0x18d6de=0xce;}_0x3cdc44[_0x21b7('0x1c')](_0x18d6de);return _0x3cdc44[_0x21b7('0x23')]('Content-Range',_0x207ae7+'-'+_0x157814+'/'+_0x55c601)[_0x21b7('0x1e')](_0x508743);}return null;};}function patchUpdates(_0x29d6ab){return function(_0x1f12b2){try{jsonpatch[_0x21b7('0x24')](_0x1f12b2,_0x29d6ab,!![]);}catch(_0xafd066){return BPromise[_0x21b7('0x25')](_0xafd066);}return _0x1f12b2[_0x21b7('0x26')]();};}function saveUpdates(_0x109816,_0x1845f5){return function(_0x2b295e){if(_0x2b295e){return _0x2b295e[_0x21b7('0x27')](_0x109816)[_0x21b7('0x28')](function(_0x336dd3){return _0x336dd3;});}return null;};}function removeEntity(_0x16fb78,_0x31c39b){return function(_0x39aa7d){if(_0x39aa7d){return _0x39aa7d[_0x21b7('0x29')]()[_0x21b7('0x28')](function(){_0x16fb78['status'](0xcc)[_0x21b7('0x1d')]();});}};}function handleEntityNotFound(_0x14d38c,_0x59368a){return function(_0x453457){if(!_0x453457){_0x14d38c[_0x21b7('0x1b')](0x194);}return _0x453457;};}function handleError(_0x40a30b,_0x56265f){_0x56265f=_0x56265f||0x1f4;return function(_0x1df3e0){logger['error'](_0x1df3e0['stack']);if(_0x1df3e0['name']){delete _0x1df3e0[_0x21b7('0x2a')];}_0x40a30b[_0x21b7('0x1c')](_0x56265f)[_0x21b7('0x2b')](_0x1df3e0);};}exports[_0x21b7('0x2c')]=function(_0x417f91,_0x4fd1a0){var _0x3f1201={},_0x54526e={},_0x4581c9={'count':0x0,'rows':[]};var _0x29b9df=_[_0x21b7('0x2d')](db['CmHopperHistory']['rawAttributes'],function(_0x487e84){return{'name':_0x487e84['fieldName'],'type':_0x487e84['type'][_0x21b7('0x2e')]};});_0x54526e[_0x21b7('0x2f')]=_[_0x21b7('0x2d')](_0x29b9df,_0x21b7('0x2a'));_0x54526e[_0x21b7('0x30')]=_[_0x21b7('0x31')](_0x417f91[_0x21b7('0x30')]);_0x54526e[_0x21b7('0x32')]=_[_0x21b7('0x33')](_0x54526e[_0x21b7('0x2f')],_0x54526e[_0x21b7('0x30')]);_0x3f1201[_0x21b7('0x34')]=_['intersection'](_0x54526e[_0x21b7('0x2f')],qs['fields'](_0x417f91[_0x21b7('0x30')][_0x21b7('0x35')]));_0x3f1201['attributes']=_0x3f1201[_0x21b7('0x34')][_0x21b7('0x36')]?_0x3f1201[_0x21b7('0x34')]:_0x54526e['model'];if(!_0x417f91[_0x21b7('0x30')]['hasOwnProperty'](_0x21b7('0x37'))){_0x3f1201['limit']=qs[_0x21b7('0x20')](_0x417f91[_0x21b7('0x30')][_0x21b7('0x20')]);_0x3f1201['offset']=qs['offset'](_0x417f91[_0x21b7('0x30')][_0x21b7('0x22')]);}_0x3f1201['order']=qs[_0x21b7('0x38')](_0x417f91['query'][_0x21b7('0x38')]);_0x3f1201['where']=qs[_0x21b7('0x32')](_[_0x21b7('0x39')](_0x417f91[_0x21b7('0x30')],_0x54526e['filters']),_0x29b9df);if(_0x417f91[_0x21b7('0x30')][_0x21b7('0x3a')]){_0x3f1201[_0x21b7('0x3b')]=_[_0x21b7('0x3c')](_0x3f1201['where'],{'$or':_[_0x21b7('0x2d')](_0x29b9df,function(_0xb6f491){if(_0xb6f491[_0x21b7('0x3d')]!==_0x21b7('0x3e')){var _0x6a1628={};_0x6a1628[_0xb6f491[_0x21b7('0x2a')]]={'$like':'%'+_0x417f91[_0x21b7('0x30')]['filter']+'%'};return _0x6a1628;}})});}_0x3f1201=_[_0x21b7('0x3c')]({},_0x3f1201,_0x417f91['options']);var _0x42c501={'where':_0x3f1201[_0x21b7('0x3b')]};return db[_0x21b7('0x3f')][_0x21b7('0x21')](_0x42c501)[_0x21b7('0x28')](function(_0x1078da){_0x4581c9[_0x21b7('0x21')]=_0x1078da;if(_0x417f91[_0x21b7('0x30')][_0x21b7('0x40')]){_0x3f1201[_0x21b7('0x41')]=[{'all':!![]}];}return db['CmHopperHistory']['findAll'](_0x3f1201);})[_0x21b7('0x28')](function(_0x4951e3){_0x4581c9[_0x21b7('0x42')]=_0x4951e3;return _0x4581c9;})[_0x21b7('0x28')](respondWithFilteredResult(_0x4fd1a0,_0x3f1201))['catch'](handleError(_0x4fd1a0,null));};exports[_0x21b7('0x43')]=function(_0x4f73dc,_0x8da5ec){var _0x9ab212={'raw':!![],'where':{'id':_0x4f73dc[_0x21b7('0x44')]['id']}},_0x4e5a80={};_0x4e5a80[_0x21b7('0x2f')]=_[_0x21b7('0x31')](db[_0x21b7('0x3f')][_0x21b7('0x45')]);_0x4e5a80[_0x21b7('0x30')]=_['keys'](_0x4f73dc[_0x21b7('0x30')]);_0x4e5a80['filters']=_[_0x21b7('0x33')](_0x4e5a80['model'],_0x4e5a80['query']);_0x9ab212[_0x21b7('0x34')]=_[_0x21b7('0x33')](_0x4e5a80[_0x21b7('0x2f')],qs[_0x21b7('0x35')](_0x4f73dc[_0x21b7('0x30')][_0x21b7('0x35')]));_0x9ab212[_0x21b7('0x34')]=_0x9ab212[_0x21b7('0x34')]['length']?_0x9ab212[_0x21b7('0x34')]:_0x4e5a80[_0x21b7('0x2f')];if(_0x4f73dc['query'][_0x21b7('0x40')]){_0x9ab212[_0x21b7('0x41')]=[{'all':!![]}];}_0x9ab212=_[_0x21b7('0x3c')]({},_0x9ab212,_0x4f73dc['options']);return db[_0x21b7('0x3f')][_0x21b7('0x46')](_0x9ab212)[_0x21b7('0x28')](handleEntityNotFound(_0x8da5ec,null))[_0x21b7('0x28')](respondWithResult(_0x8da5ec,null))[_0x21b7('0x47')](handleError(_0x8da5ec,null));};exports['create']=function(_0x2127fd,_0x464a8a){return db[_0x21b7('0x3f')]['create'](_0x2127fd['body'],{})[_0x21b7('0x28')](respondWithResult(_0x464a8a,0xc9))[_0x21b7('0x47')](handleError(_0x464a8a,null));};exports[_0x21b7('0x48')]=function(_0x482dc6,_0x237d11){return db['CmHopperHistory']['describe']()[_0x21b7('0x28')](respondWithResult(_0x237d11,null))[_0x21b7('0x47')](handleError(_0x237d11,null));};exports[_0x21b7('0x27')]=function(_0x190944,_0x5da266){if(_0x190944[_0x21b7('0x49')][_0x21b7('0x4a')]){delete _0x190944[_0x21b7('0x49')][_0x21b7('0x4a')];}return db[_0x21b7('0x3f')]['find']({'where':{'uniqueid':_0x190944[_0x21b7('0x44')]['id']}})[_0x21b7('0x28')](handleEntityNotFound(_0x5da266,null))['then'](saveUpdates(_0x190944[_0x21b7('0x49')],null))[_0x21b7('0x28')](respondWithResult(_0x5da266,null))['catch'](handleError(_0x5da266,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index 9122082..23b2a6d 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 _0x4d68=['bluebird','path','../../config/environment','exports','cm_hopper_history','endtime','uniqueid','lodash','util','../../config/logger','api','moment'];(function(_0x5b2f23,_0xffc5a2){var _0x62a012=function(_0x55c733){while(--_0x55c733){_0x5b2f23['push'](_0x5b2f23['shift']());}};_0x62a012(++_0xffc5a2);}(_0x4d68,0x1c3));var _0x84d6=function(_0x35e92e,_0x21581b){_0x35e92e=_0x35e92e-0x0;var _0x1205a8=_0x4d68[_0x35e92e];return _0x1205a8;};'use strict';var _=require(_0x84d6('0x0'));var util=require(_0x84d6('0x1'));var logger=require(_0x84d6('0x2'))(_0x84d6('0x3'));var moment=require(_0x84d6('0x4'));var BPromise=require(_0x84d6('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x84d6('0x6'));var rimraf=require('rimraf');var config=require(_0x84d6('0x7'));var attributes=require('./cmHopperHistory.attributes');module[_0x84d6('0x8')]=function(_0x368a18,_0x20957c){return _0x368a18['define']('CmHopperHistory',attributes,{'tableName':_0x84d6('0x9'),'paranoid':![],'indexes':[{'name':_0x84d6('0xa'),'fields':[_0x84d6('0xa')]},{'name':_0x84d6('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xc6d7=['../../config/environment','./cmHopperHistory.attributes','exports','define','CmHopperHistory','cm_hopper_history','endtime','uniqueid','lodash','util','../../config/logger','api','request-promise','path','rimraf'];(function(_0xc4d810,_0x508239){var _0x53a550=function(_0x3980e2){while(--_0x3980e2){_0xc4d810['push'](_0xc4d810['shift']());}};_0x53a550(++_0x508239);}(_0xc6d7,0x71));var _0x7c6d=function(_0x12291f,_0x197437){_0x12291f=_0x12291f-0x0;var _0x34f403=_0xc6d7[_0x12291f];return _0x34f403;};'use strict';var _=require(_0x7c6d('0x0'));var util=require(_0x7c6d('0x1'));var logger=require(_0x7c6d('0x2'))(_0x7c6d('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x7c6d('0x4'));var fs=require('fs');var path=require(_0x7c6d('0x5'));var rimraf=require(_0x7c6d('0x6'));var config=require(_0x7c6d('0x7'));var attributes=require(_0x7c6d('0x8'));module[_0x7c6d('0x9')]=function(_0x679fc1,_0x4120c1){return _0x679fc1[_0x7c6d('0xa')](_0x7c6d('0xb'),attributes,{'tableName':_0x7c6d('0xc'),'paranoid':![],'indexes':[{'name':_0x7c6d('0xd'),'fields':[_0x7c6d('0xd')]},{'name':_0x7c6d('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 5f6f639..938c091 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 _0xa204=['CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','message','result','CreateCmHopperHistory','CmHopperHistory','create','body','options','raw','AvgHandleTime','where','sequelize','COUNT','col','literal','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','catch','GetVoiceQueueHopperHistory','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','`state`\x20=\x204,\x201,\x20null','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','then','GetCampaignHopperHistory','findAll','ivrAnswerCallsDay','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug'];(function(_0xb875ee,_0x583042){var _0x4c7f3a=function(_0x1f6661){while(--_0x1f6661){_0xb875ee['push'](_0xb875ee['shift']());}};_0x4c7f3a(++_0x583042);}(_0xa204,0x152));var _0x4a20=function(_0x280875,_0x137bcb){_0x280875=_0x280875-0x0;var _0x74acfe=_0xa204[_0x280875];return _0x74acfe;};'use strict';var _=require(_0x4a20('0x0'));var util=require(_0x4a20('0x1'));var moment=require('moment');var BPromise=require(_0x4a20('0x2'));var rs=require(_0x4a20('0x3'));var fs=require('fs');var Redis=require(_0x4a20('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x4a20('0x5'));var logger=require(_0x4a20('0x6'))(_0x4a20('0x7'));var config=require(_0x4a20('0x8'));var jayson=require(_0x4a20('0x9'));var client=jayson[_0x4a20('0xa')][_0x4a20('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2a549b,_0x57ce07,_0x27e3ec){return new BPromise(function(_0x31a214,_0x2d5107){return client[_0x4a20('0xc')](_0x2a549b,_0x27e3ec)['then'](function(_0x4fa4d6){logger[_0x4a20('0xd')](_0x4a20('0xe'),_0x57ce07,_0x4a20('0xf'));logger[_0x4a20('0x10')](_0x4a20('0x11'),_0x57ce07,_0x4a20('0xf'),JSON[_0x4a20('0x12')](_0x4fa4d6));if(_0x4fa4d6[_0x4a20('0x13')]){if(_0x4fa4d6[_0x4a20('0x13')]['code']===0x1f4){logger[_0x4a20('0x13')](_0x4a20('0xe'),_0x57ce07,_0x4fa4d6['error'][_0x4a20('0x14')]);return _0x2d5107(_0x4fa4d6[_0x4a20('0x13')][_0x4a20('0x14')]);}logger['error'](_0x4a20('0xe'),_0x57ce07,_0x4fa4d6['error']['message']);return _0x31a214(_0x4fa4d6['error'][_0x4a20('0x14')]);}else{logger['info'](_0x4a20('0xe'),_0x57ce07,'request\x20sent');_0x31a214(_0x4fa4d6[_0x4a20('0x15')][_0x4a20('0x14')]);}})['catch'](function(_0x3bd783){logger['error']('CmHopperHistory,\x20%s,\x20%s',_0x57ce07,_0x3bd783);_0x2d5107(_0x3bd783);});});}exports[_0x4a20('0x16')]=function(_0x8a23f1){var _0x296156=this;return new Promise(function(_0x557e7d,_0x57f0f7){return db[_0x4a20('0x17')][_0x4a20('0x18')](_0x8a23f1[_0x4a20('0x19')],{'raw':_0x8a23f1[_0x4a20('0x1a')]?_0x8a23f1[_0x4a20('0x1a')][_0x4a20('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x2dfa58){logger[_0x4a20('0xd')](_0x4a20('0x16'),_0x8a23f1);logger[_0x4a20('0x10')]('CreateCmHopperHistory',_0x8a23f1,JSON['stringify'](_0x2dfa58));_0x557e7d(_0x2dfa58);})['catch'](function(_0x425ace){logger['error'](_0x4a20('0x16'),_0x425ace[_0x4a20('0x14')],_0x8a23f1);_0x57f0f7(_0x296156[_0x4a20('0x13')](0x1f4,_0x425ace['message']));});});};exports[_0x4a20('0x1c')]=function(_0x368dad){var _0x14f788=this;return new Promise(function(_0xd24d0e,_0x63a154){return db[_0x4a20('0x17')]['findAll']({'raw':_0x368dad['options']?_0x368dad[_0x4a20('0x1a')][_0x4a20('0x1b')]===undefined?!![]:![]:!![],'where':_0x368dad[_0x4a20('0x1a')]?_0x368dad[_0x4a20('0x1a')][_0x4a20('0x1d')]||null:null,'attributes':[[db[_0x4a20('0x1e')]['fn'](_0x4a20('0x1f'),db['sequelize'][_0x4a20('0x20')]('id')),'predictiveIntervalTotalCalls'],[db[_0x4a20('0x1e')]['fn'](_0x4a20('0x1f'),db['sequelize']['fn']('IF',db[_0x4a20('0x1e')][_0x4a20('0x21')]('`state`\x20=\x204,\x201,\x20null'))),_0x4a20('0x22')],[db[_0x4a20('0x1e')]['fn']('COUNT',db[_0x4a20('0x1e')]['fn']('IF',db[_0x4a20('0x1e')][_0x4a20('0x21')](_0x4a20('0x23')))),'predictiveIntervalDroppedCallsTimeout'],[db[_0x4a20('0x1e')]['fn'](_0x4a20('0x1f'),db['sequelize']['fn']('IF',db[_0x4a20('0x1e')][_0x4a20('0x21')](_0x4a20('0x24')))),_0x4a20('0x25')],[db['sequelize']['fn'](_0x4a20('0x26'),db['sequelize']['fn']('IF',db[_0x4a20('0x1e')][_0x4a20('0x21')](_0x4a20('0x27')))),'predictiveIntervalAvgHoldtime'],[db[_0x4a20('0x1e')]['fn']('AVG',db[_0x4a20('0x1e')]['fn']('IF',db[_0x4a20('0x1e')]['literal']('`state`\x20=\x204,\x20`talktime`,\x20null'))),'predictiveIntervalAvgTalktime']]})['then'](function(_0x387da0){logger[_0x4a20('0xd')](_0x4a20('0x1c'),_0x368dad);logger[_0x4a20('0x10')](_0x4a20('0x1c'),_0x368dad,JSON['stringify'](_0x387da0));_0xd24d0e(_0x387da0);})[_0x4a20('0x28')](function(_0x51752e){logger['error'](_0x4a20('0x1c'),_0x51752e['message'],_0x368dad);_0x63a154(_0x14f788[_0x4a20('0x13')](0x1f4,_0x51752e[_0x4a20('0x14')]));});});};exports[_0x4a20('0x29')]=function(_0x1ffbfd){var _0x15f754=this;return new Promise(function(_0x89baeb,_0x4009b8){return db[_0x4a20('0x17')]['findAll']({'raw':_0x1ffbfd[_0x4a20('0x1a')]?_0x1ffbfd[_0x4a20('0x1a')][_0x4a20('0x1b')]===undefined?!![]:![]:!![],'where':_0x1ffbfd[_0x4a20('0x1a')]?_0x1ffbfd['options'][_0x4a20('0x1d')]||null:null,'attributes':[[_0x4a20('0x2a'),_0x4a20('0x2b')],[db[_0x4a20('0x1e')]['fn']('COUNT',db[_0x4a20('0x1e')]['fn']('IF',db[_0x4a20('0x1e')]['literal'](_0x4a20('0x2c')))),_0x4a20('0x2d')],[db[_0x4a20('0x1e')]['fn'](_0x4a20('0x1f'),db[_0x4a20('0x1e')]['fn']('IF',db['sequelize'][_0x4a20('0x21')](_0x4a20('0x2e')))),_0x4a20('0x2f')],[db[_0x4a20('0x1e')]['fn'](_0x4a20('0x1f'),db[_0x4a20('0x1e')]['fn']('IF',db[_0x4a20('0x1e')][_0x4a20('0x21')](_0x4a20('0x30')))),_0x4a20('0x31')],[db['sequelize']['fn'](_0x4a20('0x1f'),db[_0x4a20('0x1e')]['fn']('IF',db[_0x4a20('0x1e')][_0x4a20('0x21')](_0x4a20('0x32')))),_0x4a20('0x33')],[db[_0x4a20('0x1e')]['fn'](_0x4a20('0x1f'),db[_0x4a20('0x1e')]['fn']('IF',db[_0x4a20('0x1e')]['literal'](_0x4a20('0x34')))),'outboundCongestionCallsDay'],[db[_0x4a20('0x1e')]['fn'](_0x4a20('0x1f'),db[_0x4a20('0x1e')]['fn']('IF',db[_0x4a20('0x1e')][_0x4a20('0x21')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x4a20('0x35')],[db['sequelize']['fn']('COUNT',db[_0x4a20('0x1e')]['fn']('IF',db[_0x4a20('0x1e')][_0x4a20('0x21')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x4a20('0x36')],[db[_0x4a20('0x1e')]['fn'](_0x4a20('0x1f'),db['sequelize']['fn']('IF',db[_0x4a20('0x1e')][_0x4a20('0x21')](_0x4a20('0x37')))),_0x4a20('0x38')],[db[_0x4a20('0x1e')]['fn'](_0x4a20('0x1f'),db[_0x4a20('0x1e')]['fn']('IF',db['sequelize'][_0x4a20('0x21')](_0x4a20('0x39')))),_0x4a20('0x3a')],[db[_0x4a20('0x1e')]['fn'](_0x4a20('0x1f'),db[_0x4a20('0x1e')]['fn']('IF',db[_0x4a20('0x1e')][_0x4a20('0x21')](_0x4a20('0x3b')))),'outboundOriginateFailureCallsDay'],[db[_0x4a20('0x1e')]['fn'](_0x4a20('0x1f'),db['sequelize']['fn']('IF',db['sequelize'][_0x4a20('0x21')](_0x4a20('0x3c')))),_0x4a20('0x3d')],[db[_0x4a20('0x1e')]['fn']('COUNT',db[_0x4a20('0x1e')]['fn']('IF',db[_0x4a20('0x1e')][_0x4a20('0x21')](_0x4a20('0x3e')))),_0x4a20('0x3f')],[db[_0x4a20('0x1e')]['fn']('COUNT',db[_0x4a20('0x1e')]['fn']('IF',db[_0x4a20('0x1e')][_0x4a20('0x21')](_0x4a20('0x40')))),_0x4a20('0x3d')],[db[_0x4a20('0x1e')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize']['literal'](_0x4a20('0x41')))),_0x4a20('0x42')]],'group':[_0x4a20('0x2a')]})[_0x4a20('0x43')](function(_0x5a9d7a){logger[_0x4a20('0xd')](_0x4a20('0x29'),_0x1ffbfd);logger['debug'](_0x4a20('0x29'),_0x1ffbfd,JSON['stringify'](_0x5a9d7a));_0x89baeb(_0x5a9d7a);})[_0x4a20('0x28')](function(_0x46bbd2){logger[_0x4a20('0x13')](_0x4a20('0x29'),_0x46bbd2[_0x4a20('0x14')],_0x1ffbfd);_0x4009b8(_0x15f754['error'](0x1f4,_0x46bbd2[_0x4a20('0x14')]));});});};exports[_0x4a20('0x44')]=function(_0x2c941b){var _0xffceac=this;return new Promise(function(_0x2f95d3,_0x2460bf){return db[_0x4a20('0x17')][_0x4a20('0x45')]({'raw':_0x2c941b['options']?_0x2c941b[_0x4a20('0x1a')][_0x4a20('0x1b')]===undefined?!![]:![]:!![],'where':_0x2c941b[_0x4a20('0x1a')]?_0x2c941b[_0x4a20('0x1a')]['where']||null:null,'attributes':[[_0x4a20('0x2a'),_0x4a20('0x2b')],[db[_0x4a20('0x1e')]['fn'](_0x4a20('0x1f'),db['sequelize'][_0x4a20('0x20')]('id')),'ivrTotalCallsDays'],[db[_0x4a20('0x1e')]['fn'](_0x4a20('0x1f'),db[_0x4a20('0x1e')]['fn']('IF',db[_0x4a20('0x1e')][_0x4a20('0x21')](_0x4a20('0x30')))),_0x4a20('0x46')]],'group':[_0x4a20('0x2a')]})[_0x4a20('0x43')](function(_0x10d462){logger[_0x4a20('0xd')](_0x4a20('0x44'),_0x2c941b);logger['debug'](_0x4a20('0x44'),_0x2c941b,JSON[_0x4a20('0x12')](_0x10d462));_0x2f95d3(_0x10d462);})[_0x4a20('0x28')](function(_0x23346d){logger[_0x4a20('0x13')](_0x4a20('0x44'),_0x23346d[_0x4a20('0x14')],_0x2c941b);_0x2460bf(_0xffceac[_0x4a20('0x13')](0x1f4,_0x23346d[_0x4a20('0x14')]));});});}; \ No newline at end of file +var _0x296f=['options','raw','stringify','AvgHandleTime','findAll','where','sequelize','COUNT','col','predictiveIntervalTotalCalls','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','literal','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','then','GetVoiceQueueHopperHistory','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','GetCampaignHopperHistory','ivrTotalCallsDays','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','http','request','info','CmHopperHistory,\x20%s,\x20%s','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','CreateCmHopperHistory','CmHopperHistory','create','body'];(function(_0x3960a3,_0x5e59b8){var _0x2e103b=function(_0x1255a1){while(--_0x1255a1){_0x3960a3['push'](_0x3960a3['shift']());}};_0x2e103b(++_0x5e59b8);}(_0x296f,0xf0));var _0xf296=function(_0x184759,_0x1cc38a){_0x184759=_0x184759-0x0;var _0xf26d5f=_0x296f[_0x184759];return _0xf26d5f;};'use strict';var _=require(_0xf296('0x0'));var util=require(_0xf296('0x1'));var moment=require(_0xf296('0x2'));var BPromise=require(_0xf296('0x3'));var rs=require(_0xf296('0x4'));var fs=require('fs');var Redis=require(_0xf296('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xf296('0x6'))(_0xf296('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xf296('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x325b39,_0x5123d3,_0x300f99){return new BPromise(function(_0x3197bc,_0x4b05c5){return client[_0xf296('0x9')](_0x325b39,_0x300f99)['then'](function(_0x1ec8cc){logger[_0xf296('0xa')](_0xf296('0xb'),_0x5123d3,'request\x20sent');logger[_0xf296('0xc')](_0xf296('0xd'),_0x5123d3,_0xf296('0xe'),JSON['stringify'](_0x1ec8cc));if(_0x1ec8cc[_0xf296('0xf')]){if(_0x1ec8cc[_0xf296('0xf')][_0xf296('0x10')]===0x1f4){logger[_0xf296('0xf')](_0xf296('0xb'),_0x5123d3,_0x1ec8cc['error']['message']);return _0x4b05c5(_0x1ec8cc[_0xf296('0xf')][_0xf296('0x11')]);}logger['error'](_0xf296('0xb'),_0x5123d3,_0x1ec8cc[_0xf296('0xf')]['message']);return _0x3197bc(_0x1ec8cc[_0xf296('0xf')][_0xf296('0x11')]);}else{logger['info']('CmHopperHistory,\x20%s,\x20%s',_0x5123d3,'request\x20sent');_0x3197bc(_0x1ec8cc[_0xf296('0x12')][_0xf296('0x11')]);}})[_0xf296('0x13')](function(_0x3d3225){logger[_0xf296('0xf')](_0xf296('0xb'),_0x5123d3,_0x3d3225);_0x4b05c5(_0x3d3225);});});}exports[_0xf296('0x14')]=function(_0x2ea567){var _0x5ab6b0=this;return new Promise(function(_0xe0c845,_0x2a931c){return db[_0xf296('0x15')][_0xf296('0x16')](_0x2ea567[_0xf296('0x17')],{'raw':_0x2ea567[_0xf296('0x18')]?_0x2ea567['options'][_0xf296('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x15744d){logger[_0xf296('0xa')]('CreateCmHopperHistory',_0x2ea567);logger[_0xf296('0xc')](_0xf296('0x14'),_0x2ea567,JSON[_0xf296('0x1a')](_0x15744d));_0xe0c845(_0x15744d);})['catch'](function(_0x3f8a9e){logger[_0xf296('0xf')]('CreateCmHopperHistory',_0x3f8a9e[_0xf296('0x11')],_0x2ea567);_0x2a931c(_0x5ab6b0[_0xf296('0xf')](0x1f4,_0x3f8a9e[_0xf296('0x11')]));});});};exports[_0xf296('0x1b')]=function(_0x130993){var _0x15d49c=this;return new Promise(function(_0x520415,_0xbf51bb){return db[_0xf296('0x15')][_0xf296('0x1c')]({'raw':_0x130993[_0xf296('0x18')]?_0x130993[_0xf296('0x18')][_0xf296('0x19')]===undefined?!![]:![]:!![],'where':_0x130993['options']?_0x130993[_0xf296('0x18')][_0xf296('0x1d')]||null:null,'attributes':[[db[_0xf296('0x1e')]['fn'](_0xf296('0x1f'),db[_0xf296('0x1e')][_0xf296('0x20')]('id')),_0xf296('0x21')],[db[_0xf296('0x1e')]['fn'](_0xf296('0x1f'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0xf296('0x22')))),_0xf296('0x23')],[db[_0xf296('0x1e')]['fn'](_0xf296('0x1f'),db[_0xf296('0x1e')]['fn']('IF',db['sequelize'][_0xf296('0x24')]('`state`\x20=\x2010,\x201,\x20null'))),_0xf296('0x25')],[db['sequelize']['fn'](_0xf296('0x1f'),db[_0xf296('0x1e')]['fn']('IF',db[_0xf296('0x1e')][_0xf296('0x24')](_0xf296('0x26')))),_0xf296('0x27')],[db[_0xf296('0x1e')]['fn'](_0xf296('0x28'),db['sequelize']['fn']('IF',db[_0xf296('0x1e')]['literal'](_0xf296('0x29')))),_0xf296('0x2a')],[db['sequelize']['fn'](_0xf296('0x28'),db[_0xf296('0x1e')]['fn']('IF',db['sequelize'][_0xf296('0x24')]('`state`\x20=\x204,\x20`talktime`,\x20null'))),'predictiveIntervalAvgTalktime']]})[_0xf296('0x2b')](function(_0x551c06){logger[_0xf296('0xa')]('AvgHandleTime',_0x130993);logger[_0xf296('0xc')](_0xf296('0x1b'),_0x130993,JSON[_0xf296('0x1a')](_0x551c06));_0x520415(_0x551c06);})[_0xf296('0x13')](function(_0x2c0938){logger['error']('AvgHandleTime',_0x2c0938[_0xf296('0x11')],_0x130993);_0xbf51bb(_0x15d49c[_0xf296('0xf')](0x1f4,_0x2c0938[_0xf296('0x11')]));});});};exports[_0xf296('0x2c')]=function(_0x12cc29){var _0x106268=this;return new Promise(function(_0x5cbf00,_0xd9d055){return db[_0xf296('0x15')][_0xf296('0x1c')]({'raw':_0x12cc29[_0xf296('0x18')]?_0x12cc29[_0xf296('0x18')][_0xf296('0x19')]===undefined?!![]:![]:!![],'where':_0x12cc29['options']?_0x12cc29['options'][_0xf296('0x1d')]||null:null,'attributes':[[_0xf296('0x2d'),_0xf296('0x2e')],[db[_0xf296('0x1e')]['fn']('COUNT',db[_0xf296('0x1e')]['fn']('IF',db['sequelize'][_0xf296('0x24')](_0xf296('0x2f')))),_0xf296('0x30')],[db['sequelize']['fn']('COUNT',db[_0xf296('0x1e')]['fn']('IF',db['sequelize'][_0xf296('0x24')]('`state`\x20=\x203,\x201,\x20null'))),'outboundNoAnswerCallsDay'],[db[_0xf296('0x1e')]['fn']('COUNT',db[_0xf296('0x1e')]['fn']('IF',db['sequelize'][_0xf296('0x24')](_0xf296('0x22')))),_0xf296('0x31')],[db['sequelize']['fn']('COUNT',db[_0xf296('0x1e')]['fn']('IF',db['sequelize'][_0xf296('0x24')](_0xf296('0x32')))),_0xf296('0x33')],[db['sequelize']['fn']('COUNT',db[_0xf296('0x1e')]['fn']('IF',db[_0xf296('0x1e')][_0xf296('0x24')](_0xf296('0x34')))),_0xf296('0x35')],[db[_0xf296('0x1e')]['fn'](_0xf296('0x1f'),db[_0xf296('0x1e')]['fn']('IF',db['sequelize'][_0xf296('0x24')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0xf296('0x36')],[db[_0xf296('0x1e')]['fn']('COUNT',db[_0xf296('0x1e')]['fn']('IF',db[_0xf296('0x1e')][_0xf296('0x24')](_0xf296('0x37')))),'outboundDropCallsDayCallersExit'],[db[_0xf296('0x1e')]['fn'](_0xf296('0x1f'),db[_0xf296('0x1e')]['fn']('IF',db[_0xf296('0x1e')][_0xf296('0x24')](_0xf296('0x38')))),_0xf296('0x39')],[db[_0xf296('0x1e')]['fn'](_0xf296('0x1f'),db[_0xf296('0x1e')]['fn']('IF',db[_0xf296('0x1e')][_0xf296('0x24')](_0xf296('0x3a')))),'outboundBlacklistCallsDay'],[db['sequelize']['fn'](_0xf296('0x1f'),db[_0xf296('0x1e')]['fn']('IF',db['sequelize'][_0xf296('0x24')]('`state`\x20=\x2014,\x201,\x20null'))),'outboundOriginateFailureCallsDay'],[db[_0xf296('0x1e')]['fn'](_0xf296('0x1f'),db[_0xf296('0x1e')]['fn']('IF',db['sequelize'][_0xf296('0x24')](_0xf296('0x3b')))),_0xf296('0x3c')],[db[_0xf296('0x1e')]['fn'](_0xf296('0x1f'),db[_0xf296('0x1e')]['fn']('IF',db[_0xf296('0x1e')]['literal'](_0xf296('0x3d')))),'outboundAnswerAgiCallsDay'],[db[_0xf296('0x1e')]['fn'](_0xf296('0x1f'),db[_0xf296('0x1e')]['fn']('IF',db[_0xf296('0x1e')][_0xf296('0x24')]('`state`\x20=\x2020,\x201,\x20null'))),_0xf296('0x3c')],[db[_0xf296('0x1e')]['fn'](_0xf296('0x1f'),db[_0xf296('0x1e')]['fn']('IF',db[_0xf296('0x1e')][_0xf296('0x24')](_0xf296('0x3e')))),_0xf296('0x3f')]],'group':['campaign']})[_0xf296('0x2b')](function(_0x20d3ce){logger[_0xf296('0xa')](_0xf296('0x2c'),_0x12cc29);logger[_0xf296('0xc')](_0xf296('0x2c'),_0x12cc29,JSON[_0xf296('0x1a')](_0x20d3ce));_0x5cbf00(_0x20d3ce);})['catch'](function(_0x44e23c){logger['error'](_0xf296('0x2c'),_0x44e23c[_0xf296('0x11')],_0x12cc29);_0xd9d055(_0x106268['error'](0x1f4,_0x44e23c[_0xf296('0x11')]));});});};exports[_0xf296('0x40')]=function(_0x3dac07){var _0xf6d81=this;return new Promise(function(_0x1478a2,_0x453f13){return db['CmHopperHistory'][_0xf296('0x1c')]({'raw':_0x3dac07[_0xf296('0x18')]?_0x3dac07[_0xf296('0x18')][_0xf296('0x19')]===undefined?!![]:![]:!![],'where':_0x3dac07['options']?_0x3dac07[_0xf296('0x18')][_0xf296('0x1d')]||null:null,'attributes':[[_0xf296('0x2d'),'name'],[db[_0xf296('0x1e')]['fn']('COUNT',db['sequelize']['col']('id')),_0xf296('0x41')],[db[_0xf296('0x1e')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0xf296('0x24')](_0xf296('0x22')))),'ivrAnswerCallsDay']],'group':[_0xf296('0x2d')]})['then'](function(_0x4a29ed){logger[_0xf296('0xa')](_0xf296('0x40'),_0x3dac07);logger[_0xf296('0xc')]('GetCampaignHopperHistory',_0x3dac07,JSON['stringify'](_0x4a29ed));_0x1478a2(_0x4a29ed);})[_0xf296('0x13')](function(_0x1d3529){logger[_0xf296('0xf')](_0xf296('0x40'),_0x1d3529[_0xf296('0x11')],_0x3dac07);_0x453f13(_0xf6d81['error'](0x1f4,_0x1d3529[_0xf296('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index b467977..f5ea6bb 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 _0x3937=['describe','/:id','show','post','create','put','update','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','get','isAuthenticated','index','/describe'];(function(_0x46361e,_0x243aaf){var _0x14e302=function(_0x9ebecf){while(--_0x9ebecf){_0x46361e['push'](_0x46361e['shift']());}};_0x14e302(++_0x243aaf);}(_0x3937,0xef));var _0x7393=function(_0x4510c3,_0x9e97c){_0x4510c3=_0x4510c3-0x0;var _0x4e62b8=_0x3937[_0x4510c3];return _0x4e62b8;};'use strict';var multer=require('multer');var util=require(_0x7393('0x0'));var path=require(_0x7393('0x1'));var timeout=require(_0x7393('0x2'));var express=require(_0x7393('0x3'));var router=express[_0x7393('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x7393('0x5'));var interaction=require(_0x7393('0x6'));var config=require(_0x7393('0x7'));var controller=require(_0x7393('0x8'));router[_0x7393('0x9')]('/',auth[_0x7393('0xa')](),controller[_0x7393('0xb')]);router[_0x7393('0x9')](_0x7393('0xc'),auth['isAuthenticated'](),controller[_0x7393('0xd')]);router[_0x7393('0x9')](_0x7393('0xe'),auth['isAuthenticated'](),controller[_0x7393('0xf')]);router[_0x7393('0x10')]('/',auth[_0x7393('0xa')](),controller[_0x7393('0x11')]);router[_0x7393('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x7393('0x13')]);module[_0x7393('0x14')]=router; \ No newline at end of file +var _0x6a7b=['Router','fs-extra','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','isAuthenticated','index','/describe','describe','/:id','show','post','put','update','exports','multer','util','path','connect-timeout','express'];(function(_0x11cbbd,_0x5d4106){var _0x153af2=function(_0xd8cb94){while(--_0xd8cb94){_0x11cbbd['push'](_0x11cbbd['shift']());}};_0x153af2(++_0x5d4106);}(_0x6a7b,0x1ef));var _0xb6a7=function(_0x44c294,_0x59715b){_0x44c294=_0x44c294-0x0;var _0x558e34=_0x6a7b[_0x44c294];return _0x558e34;};'use strict';var multer=require(_0xb6a7('0x0'));var util=require(_0xb6a7('0x1'));var path=require(_0xb6a7('0x2'));var timeout=require(_0xb6a7('0x3'));var express=require(_0xb6a7('0x4'));var router=express[_0xb6a7('0x5')]();var fs_extra=require(_0xb6a7('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xb6a7('0x7'));var config=require(_0xb6a7('0x8'));var controller=require(_0xb6a7('0x9'));router['get']('/',auth[_0xb6a7('0xa')](),controller[_0xb6a7('0xb')]);router['get'](_0xb6a7('0xc'),auth[_0xb6a7('0xa')](),controller[_0xb6a7('0xd')]);router['get'](_0xb6a7('0xe'),auth[_0xb6a7('0xa')](),controller[_0xb6a7('0xf')]);router[_0xb6a7('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0xb6a7('0x11')]('/:id',auth[_0xb6a7('0xa')](),controller[_0xb6a7('0x12')]);module[_0xb6a7('0x13')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index 9833fb4..bc36db3 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 _0x6b4e=['exports'];(function(_0x2a7ad4,_0x2fdc48){var _0xa15bf8=function(_0x2e66d6){while(--_0x2e66d6){_0x2a7ad4['push'](_0x2a7ad4['shift']());}};_0xa15bf8(++_0x2fdc48);}(_0x6b4e,0x1a8));var _0xe6b4=function(_0x1b23ea,_0x4a7bb4){_0x1b23ea=_0x1b23ea-0x0;var _0x174d7d=_0x6b4e[_0x1b23ea];return _0x174d7d;};'use strict';var Sequelize=require('sequelize');module[_0xe6b4('0x0')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'dialPrefix':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xb715=['name','STRING','exports'];(function(_0x503641,_0x33a3cf){var _0x17757d=function(_0xc2ba4e){while(--_0xc2ba4e){_0x503641['push'](_0x503641['shift']());}};_0x17757d(++_0x33a3cf);}(_0xb715,0x16d));var _0x5b71=function(_0x1d50e5,_0xa3b6dd){_0x1d50e5=_0x1d50e5-0x0;var _0xb18375=_0xb715[_0x1d50e5];return _0xb18375;};'use strict';var Sequelize=require('sequelize');module[_0x5b71('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x5b71('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x5b71('0x2')]},'dialPrefix':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index a163faa..62c950a 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 _0xb304=['name','send','index','map','CmList','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','user','role','Lists','UserProfileSection','userProfileId','autoAssociation','describe','addDisposition','ListId','getDispositions','findOne','Disposition','pick','addContacts','CmContact','isArray','tags','join','push','each','omit','success','dataValues','errors','message','Malformed\x20request\x20syntax','getContacts','CustomFields','concat','format','cf_%d','raw','getContactsCsv','OrderBy','CmCustomField','alias','select','from','c.ListId\x20=\x20?','c.deletedAt\x20is\x20null','field','c.cf_','customField_','item','cm_contact_has_items','ItemTypeId\x20=\x20?','additionalPhone_','description','CmContactId\x20=\x20c.id','toString','now','writeFileSync','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','Content-type','text/csv','download','addCustomField','sequelize','transaction','addCustomFields','text','Sequelize','TEXT','number','INTEGER','switch','defaultValue','queryInterface','addColumn','cm_contacts','cf_%s','getGlobalCustomFields','findAndCountAll','addAgents','ids','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','User','info','eml-format','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./cmList.socket','register','sendStatus','status','json','limit','undefined','count','offset','apply','reject','save','update','destroy','then','get','UserProfileResource','end','error','stack'];(function(_0x48d6a3,_0x37c848){var _0x38bfa0=function(_0x3fba2e){while(--_0x3fba2e){_0x48d6a3['push'](_0x48d6a3['shift']());}};_0x38bfa0(++_0x37c848);}(_0xb304,0x7a));var _0x4b30=function(_0xc9bce3,_0x52e450){_0xc9bce3=_0xc9bce3-0x0;var _0x2c2602=_0xb304[_0xc9bce3];return _0x2c2602;};'use strict';var emlformat=require(_0x4b30('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x4b30('0x1'));var rp=require(_0x4b30('0x2'));var moment=require(_0x4b30('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x4b30('0x4'));var util=require('util');var path=require(_0x4b30('0x5'));var sox=require(_0x4b30('0x6'));var csv=require(_0x4b30('0x7'));var ejs=require(_0x4b30('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4b30('0x9'));var squel=require(_0x4b30('0xa'));var crypto=require(_0x4b30('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x4b30('0xc'));var toCsv=require(_0x4b30('0x7'));var querystring=require(_0x4b30('0xd'));var Papa=require(_0x4b30('0xe'));var Redis=require(_0x4b30('0xf'));var authService=require(_0x4b30('0x10'));var qs=require(_0x4b30('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4b30('0x12'));var logger=require(_0x4b30('0x13'))(_0x4b30('0x14'));var utils=require(_0x4b30('0x15'));var config=require(_0x4b30('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x4b30('0x17'))['db'];var csv_results;config[_0x4b30('0x18')]=_[_0x4b30('0x19')](config[_0x4b30('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x4b30('0x1a'))(new Redis(config[_0x4b30('0x18')]));require(_0x4b30('0x1b'))[_0x4b30('0x1c')](socket);function respondWithStatusCode(_0x151730,_0x3863a5){_0x3863a5=_0x3863a5||0xcc;return function(_0x383fb5){if(_0x383fb5){return _0x151730[_0x4b30('0x1d')](_0x3863a5);}return _0x151730['status'](_0x3863a5)['end']();};}function respondWithResult(_0x550f77,_0x383a90){_0x383a90=_0x383a90||0xc8;return function(_0x27a6b3){if(_0x27a6b3){return _0x550f77[_0x4b30('0x1e')](_0x383a90)[_0x4b30('0x1f')](_0x27a6b3);}};}function respondWithFilteredResult(_0x4dfab,_0x51ae32){return function(_0x1c276d){if(_0x1c276d){var _0x17647c=typeof _0x51ae32['offset']==='undefined'&&typeof _0x51ae32[_0x4b30('0x20')]===_0x4b30('0x21');var _0x3ef105=_0x1c276d[_0x4b30('0x22')];var _0x1853a3=_0x17647c?0x0:_0x51ae32[_0x4b30('0x23')];var _0x333674=_0x17647c?_0x1c276d[_0x4b30('0x22')]:_0x51ae32[_0x4b30('0x23')]+_0x51ae32[_0x4b30('0x20')];var _0x230f22;if(_0x333674>=_0x3ef105){_0x333674=_0x3ef105;_0x230f22=0xc8;}else{_0x230f22=0xce;}_0x4dfab['status'](_0x230f22);return _0x4dfab['set']('Content-Range',_0x1853a3+'-'+_0x333674+'/'+_0x3ef105)['json'](_0x1c276d);}return null;};}function patchUpdates(_0x4e4e7a){return function(_0x57e4bc){try{jsonpatch[_0x4b30('0x24')](_0x57e4bc,_0x4e4e7a,!![]);}catch(_0x5df6ec){return BPromise[_0x4b30('0x25')](_0x5df6ec);}return _0x57e4bc[_0x4b30('0x26')]();};}function saveUpdates(_0x5b96ce,_0x3aac37){return function(_0xf55f07){if(_0xf55f07){return _0xf55f07[_0x4b30('0x27')](_0x5b96ce)['then'](function(_0x5b8dbb){return _0x5b8dbb;});}return null;};}function removeEntity(_0x5358d2,_0xd8a8a0){return function(_0x5d4b62){if(_0x5d4b62){return _0x5d4b62[_0x4b30('0x28')]()[_0x4b30('0x29')](function(){var _0x116eba=_0x5d4b62[_0x4b30('0x2a')]({'plain':!![]});var _0x2b2682='Lists';return db[_0x4b30('0x2b')]['destroy']({'where':{'type':_0x2b2682,'resourceId':_0x116eba['id']}})[_0x4b30('0x29')](function(){return _0x5d4b62;});})[_0x4b30('0x29')](function(){_0x5358d2[_0x4b30('0x1e')](0xcc)[_0x4b30('0x2c')]();});}};}function handleEntityNotFound(_0x40e88b,_0x117974){return function(_0x31cfd0){if(!_0x31cfd0){_0x40e88b[_0x4b30('0x1d')](0x194);}return _0x31cfd0;};}function handleError(_0x25a5af,_0x58c6fe){_0x58c6fe=_0x58c6fe||0x1f4;return function(_0x4ae215){logger[_0x4b30('0x2d')](_0x4ae215[_0x4b30('0x2e')]);if(_0x4ae215[_0x4b30('0x2f')]){delete _0x4ae215[_0x4b30('0x2f')];}_0x25a5af['status'](_0x58c6fe)[_0x4b30('0x30')](_0x4ae215);};}exports[_0x4b30('0x31')]=function(_0x433eda,_0x5518c4){var _0x28aa78={},_0x5be291={},_0x286e99={'count':0x0,'rows':[]};var _0x2a4930=_[_0x4b30('0x32')](db[_0x4b30('0x33')]['rawAttributes'],function(_0x514571){return{'name':_0x514571[_0x4b30('0x34')],'type':_0x514571[_0x4b30('0x35')][_0x4b30('0x36')]};});_0x5be291[_0x4b30('0x37')]=_['map'](_0x2a4930,'name');_0x5be291[_0x4b30('0x38')]=_[_0x4b30('0x39')](_0x433eda[_0x4b30('0x38')]);_0x5be291[_0x4b30('0x3a')]=_[_0x4b30('0x3b')](_0x5be291['model'],_0x5be291[_0x4b30('0x38')]);_0x28aa78[_0x4b30('0x3c')]=_[_0x4b30('0x3b')](_0x5be291['model'],qs[_0x4b30('0x3d')](_0x433eda[_0x4b30('0x38')][_0x4b30('0x3d')]));_0x28aa78[_0x4b30('0x3c')]=_0x28aa78[_0x4b30('0x3c')][_0x4b30('0x3e')]?_0x28aa78[_0x4b30('0x3c')]:_0x5be291[_0x4b30('0x37')];if(!_0x433eda['query'][_0x4b30('0x3f')](_0x4b30('0x40'))){_0x28aa78[_0x4b30('0x20')]=qs[_0x4b30('0x20')](_0x433eda[_0x4b30('0x38')][_0x4b30('0x20')]);_0x28aa78['offset']=qs[_0x4b30('0x23')](_0x433eda[_0x4b30('0x38')][_0x4b30('0x23')]);}_0x28aa78[_0x4b30('0x41')]=qs['sort'](_0x433eda['query'][_0x4b30('0x42')]);_0x28aa78[_0x4b30('0x43')]=qs['filters'](_['pick'](_0x433eda[_0x4b30('0x38')],_0x5be291[_0x4b30('0x3a')]),_0x2a4930);if(_0x433eda[_0x4b30('0x38')][_0x4b30('0x44')]){_0x28aa78['where']=_['merge'](_0x28aa78[_0x4b30('0x43')],{'$or':_[_0x4b30('0x32')](_0x2a4930,function(_0x59f7ad){if(_0x59f7ad[_0x4b30('0x35')]!==_0x4b30('0x45')){var _0x4bae14={};_0x4bae14[_0x59f7ad[_0x4b30('0x2f')]]={'$like':'%'+_0x433eda[_0x4b30('0x38')][_0x4b30('0x44')]+'%'};return _0x4bae14;}})});}_0x28aa78=_[_0x4b30('0x46')]({},_0x28aa78,_0x433eda[_0x4b30('0x47')]);var _0x356391={'where':_0x28aa78['where']};return db[_0x4b30('0x33')][_0x4b30('0x22')](_0x356391)[_0x4b30('0x29')](function(_0x3c587a){_0x286e99[_0x4b30('0x22')]=_0x3c587a;if(_0x433eda['query'][_0x4b30('0x48')]){_0x28aa78[_0x4b30('0x49')]=[{'all':!![]}];}return db['CmList'][_0x4b30('0x4a')](_0x28aa78);})[_0x4b30('0x29')](function(_0x251465){_0x286e99[_0x4b30('0x4b')]=_0x251465;return _0x286e99;})[_0x4b30('0x29')](respondWithFilteredResult(_0x5518c4,_0x28aa78))[_0x4b30('0x4c')](handleError(_0x5518c4,null));};exports[_0x4b30('0x4d')]=function(_0x7fa169,_0x4fb00a){var _0x552bb6={'raw':![],'where':{'id':_0x7fa169[_0x4b30('0x4e')]['id']}},_0x67e96d={};_0x67e96d['model']=_['keys'](db[_0x4b30('0x33')][_0x4b30('0x4f')]);_0x67e96d['query']=_[_0x4b30('0x39')](_0x7fa169[_0x4b30('0x38')]);_0x67e96d[_0x4b30('0x3a')]=_['intersection'](_0x67e96d['model'],_0x67e96d[_0x4b30('0x38')]);_0x552bb6['attributes']=_[_0x4b30('0x3b')](_0x67e96d['model'],qs['fields'](_0x7fa169[_0x4b30('0x38')][_0x4b30('0x3d')]));_0x552bb6[_0x4b30('0x3c')]=_0x552bb6[_0x4b30('0x3c')][_0x4b30('0x3e')]?_0x552bb6['attributes']:_0x67e96d[_0x4b30('0x37')];if(_0x7fa169[_0x4b30('0x38')][_0x4b30('0x48')]){_0x552bb6[_0x4b30('0x49')]=[{'all':!![]}];}_0x552bb6=_['merge']({},_0x552bb6,_0x7fa169[_0x4b30('0x47')]);return db[_0x4b30('0x33')][_0x4b30('0x50')](_0x552bb6)['then'](handleEntityNotFound(_0x4fb00a,null))['then'](respondWithResult(_0x4fb00a,null))['catch'](handleError(_0x4fb00a,null));};exports['create']=function(_0x52a9ed,_0x4a0f87){return db[_0x4b30('0x33')][_0x4b30('0x51')](_0x52a9ed[_0x4b30('0x52')],{})[_0x4b30('0x29')](function(_0x5f41a4){var _0xa9d38a=_0x52a9ed[_0x4b30('0x53')][_0x4b30('0x2a')]({'plain':!![]});if(!_0xa9d38a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xa9d38a[_0x4b30('0x54')]===_0x4b30('0x53')){var _0x2e2d34=_0x5f41a4[_0x4b30('0x2a')]({'plain':!![]});var _0x28566a=_0x4b30('0x55');return db[_0x4b30('0x56')][_0x4b30('0x50')]({'where':{'name':_0x28566a,'userProfileId':_0xa9d38a[_0x4b30('0x57')]},'raw':!![]})[_0x4b30('0x29')](function(_0x39cfdf){if(_0x39cfdf&&_0x39cfdf[_0x4b30('0x58')]===0x0){return db[_0x4b30('0x2b')][_0x4b30('0x51')]({'name':_0x2e2d34['name'],'resourceId':_0x2e2d34['id'],'type':_0x39cfdf[_0x4b30('0x2f')],'sectionId':_0x39cfdf['id']},{})[_0x4b30('0x29')](function(){return _0x5f41a4;});}else{return _0x5f41a4;}})['catch'](function(_0x1dc9aa){logger[_0x4b30('0x2d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1dc9aa);throw _0x1dc9aa;});}return _0x5f41a4;})[_0x4b30('0x29')](respondWithResult(_0x4a0f87,0xc9))[_0x4b30('0x4c')](handleError(_0x4a0f87,null));};exports[_0x4b30('0x27')]=function(_0x4ade60,_0x522385){if(_0x4ade60[_0x4b30('0x52')]['id']){delete _0x4ade60[_0x4b30('0x52')]['id'];}return db[_0x4b30('0x33')]['find']({'where':{'id':_0x4ade60[_0x4b30('0x4e')]['id']}})[_0x4b30('0x29')](handleEntityNotFound(_0x522385,null))[_0x4b30('0x29')](saveUpdates(_0x4ade60[_0x4b30('0x52')],null))[_0x4b30('0x29')](respondWithResult(_0x522385,null))['catch'](handleError(_0x522385,null));};exports['destroy']=function(_0x511206,_0x4284b4){return db['CmList']['find']({'where':{'id':_0x511206[_0x4b30('0x4e')]['id']}})['then'](handleEntityNotFound(_0x4284b4,null))[_0x4b30('0x29')](removeEntity(_0x4284b4,null))[_0x4b30('0x4c')](handleError(_0x4284b4,null));};exports[_0x4b30('0x59')]=function(_0x400bf8,_0x4d1c83){return db['CmList'][_0x4b30('0x59')]()['then'](respondWithResult(_0x4d1c83,null))['catch'](handleError(_0x4d1c83,null));};exports[_0x4b30('0x5a')]=function(_0x555a7c,_0x449140,_0x307cf9){if(_0x555a7c[_0x4b30('0x52')]['id']){delete _0x555a7c[_0x4b30('0x52')]['id'];}return db['CmList'][_0x4b30('0x50')]({'where':{'id':_0x555a7c[_0x4b30('0x4e')]['id']}})['then'](handleEntityNotFound(_0x449140,null))['then'](function(_0xb24e24){if(_0xb24e24){_0x555a7c[_0x4b30('0x52')][_0x4b30('0x5b')]=_0xb24e24['id'];return db['Disposition']['create'](_0x555a7c[_0x4b30('0x52')]);}})['then'](respondWithResult(_0x449140,null))[_0x4b30('0x4c')](handleError(_0x449140,null));};exports[_0x4b30('0x5c')]=function(_0x3c2788,_0x75da40,_0x4cf3d7){var _0x2671d4={'raw':![],'where':{}};var _0x1e9e46={};var _0x303470={'count':0x0,'rows':[]};return db[_0x4b30('0x33')][_0x4b30('0x5d')]({'where':{'id':_0x3c2788[_0x4b30('0x4e')]['id']}})[_0x4b30('0x29')](handleEntityNotFound(_0x75da40,null))[_0x4b30('0x29')](function(_0x285b57){if(_0x285b57){_0x1e9e46[_0x4b30('0x37')]=_[_0x4b30('0x39')](db[_0x4b30('0x5e')][_0x4b30('0x4f')]);_0x1e9e46[_0x4b30('0x38')]=_[_0x4b30('0x39')](_0x3c2788[_0x4b30('0x38')]);_0x1e9e46['filters']=_[_0x4b30('0x3b')](_0x1e9e46[_0x4b30('0x37')],_0x1e9e46[_0x4b30('0x38')]);_0x2671d4['attributes']=_[_0x4b30('0x3b')](_0x1e9e46[_0x4b30('0x37')],qs['fields'](_0x3c2788[_0x4b30('0x38')][_0x4b30('0x3d')]));_0x2671d4['attributes']=_0x2671d4[_0x4b30('0x3c')][_0x4b30('0x3e')]?_0x2671d4[_0x4b30('0x3c')]:_0x1e9e46[_0x4b30('0x37')];if(!_0x3c2788[_0x4b30('0x38')][_0x4b30('0x3f')](_0x4b30('0x40'))){_0x2671d4['limit']=qs[_0x4b30('0x20')](_0x3c2788['query'][_0x4b30('0x20')]);_0x2671d4[_0x4b30('0x23')]=qs[_0x4b30('0x23')](_0x3c2788[_0x4b30('0x38')][_0x4b30('0x23')]);}_0x2671d4['order']=qs['sort'](_0x3c2788[_0x4b30('0x38')][_0x4b30('0x42')]);_0x2671d4[_0x4b30('0x43')]=qs[_0x4b30('0x3a')](_[_0x4b30('0x5f')](_0x3c2788[_0x4b30('0x38')],_0x1e9e46[_0x4b30('0x3a')]));_0x2671d4[_0x4b30('0x43')][_0x4b30('0x5b')]=_0x285b57['id'];if(_0x3c2788[_0x4b30('0x38')][_0x4b30('0x44')]){_0x2671d4[_0x4b30('0x43')]=_[_0x4b30('0x46')](_0x2671d4[_0x4b30('0x43')],{'$or':_[_0x4b30('0x32')](_0x2671d4[_0x4b30('0x3c')],function(_0x3217d0){var _0x2a914a={};_0x2a914a[_0x3217d0]={'$like':'%'+_0x3c2788[_0x4b30('0x38')][_0x4b30('0x44')]+'%'};return _0x2a914a;})});}_0x2671d4=_[_0x4b30('0x46')]({},_0x2671d4,_0x3c2788[_0x4b30('0x47')]);return db[_0x4b30('0x5e')][_0x4b30('0x22')]({'where':_0x2671d4[_0x4b30('0x43')]})[_0x4b30('0x29')](function(_0x2450bd){_0x303470['count']=_0x2450bd;if(_0x3c2788[_0x4b30('0x38')][_0x4b30('0x48')]){_0x2671d4[_0x4b30('0x49')]=[{'all':!![]}];}return db[_0x4b30('0x5e')]['findAll'](_0x2671d4);})[_0x4b30('0x29')](function(_0x314c79){_0x303470[_0x4b30('0x4b')]=_0x314c79;return _0x303470;});}})[_0x4b30('0x29')](respondWithFilteredResult(_0x75da40,_0x2671d4))['catch'](handleError(_0x75da40,null));};exports['removeDispositions']=function(_0x336681,_0x54c567,_0x5ead45){return db[_0x4b30('0x33')][_0x4b30('0x50')]({'where':{'id':_0x336681[_0x4b30('0x4e')]['id']}})[_0x4b30('0x29')](handleEntityNotFound(_0x54c567,null))[_0x4b30('0x29')](function(_0x5715bb){if(_0x5715bb){return _0x5715bb['removeDispositions'](_0x336681[_0x4b30('0x38')]['ids']);}})[_0x4b30('0x29')](respondWithStatusCode(_0x54c567,null))['catch'](handleError(_0x54c567,null));};exports[_0x4b30('0x60')]=function(_0x553f44,_0x57a0b0,_0x36988e){return db[_0x4b30('0x33')]['find']({'where':{'id':_0x553f44['params']['id']}})['then'](handleEntityNotFound(_0x57a0b0,null))['then'](function(_0x42e048){if(_0x42e048){var _0x3f3151=[];var _0x4aa917={'success':[],'errors':[]};return db[_0x4b30('0x61')][_0x4b30('0x59')]()['then'](function(_0x5df247){if(_0x553f44[_0x4b30('0x52')]['tags']&&_[_0x4b30('0x62')](_0x553f44[_0x4b30('0x52')][_0x4b30('0x63')])){if(_0x553f44['body']['tags'][_0x4b30('0x3e')]){_0x553f44[_0x4b30('0x52')][_0x4b30('0x63')]=_0x553f44[_0x4b30('0x52')]['tags'][_0x4b30('0x64')](';')+';';}else{_0x553f44[_0x4b30('0x52')][_0x4b30('0x63')]=null;}}else{_0x553f44['body'][_0x4b30('0x63')]=null;}if(_0x553f44[_0x4b30('0x52')]&&_[_0x4b30('0x62')](_0x553f44[_0x4b30('0x52')])){for(var _0x237a43=0x0;_0x237a43<_0x553f44[_0x4b30('0x52')]['length'];_0x237a43+=0x1){_0x553f44[_0x4b30('0x52')][_0x237a43]['ListId']=_0x553f44[_0x4b30('0x4e')]['id'];_0x3f3151[_0x4b30('0x65')](_0x553f44[_0x4b30('0x52')][_0x237a43]);}return BPromise[_0x4b30('0x66')](_0x3f3151,function(_0x8cf619){return db[_0x4b30('0x61')][_0x4b30('0x51')](_[_0x4b30('0x67')](_0x8cf619,['ids','id'])||{},{'fields':_[_0x4b30('0x39')](_0x5df247),'raw':!![]})[_0x4b30('0x29')](function(_0x3be055){_0x4aa917[_0x4b30('0x68')][_0x4b30('0x65')](_0x3be055[_0x4b30('0x69')]);})['catch'](function(_0x491634){_0x4aa917[_0x4b30('0x6a')][_0x4b30('0x65')]({'data':_0x8cf619,'error':_0x491634[_0x4b30('0x6b')]});});})[_0x4b30('0x29')](function(_0x4cac2e){return _0x4aa917;})['catch'](function(_0x23e4db){return _0x23e4db;});}else{_0x57a0b0[_0x4b30('0x1e')](0x190)[_0x4b30('0x1f')]({'message':_0x4b30('0x6c')});}});}})[_0x4b30('0x29')](respondWithResult(_0x57a0b0,null))[_0x4b30('0x4c')](handleError(_0x57a0b0,null));};exports[_0x4b30('0x6d')]=function(_0x1c24be,_0x46a1c3,_0x5c55f3){var _0x5b642f;return db['CmList'][_0x4b30('0x50')]({'where':{'id':_0x1c24be[_0x4b30('0x4e')]['id']},'include':[{'model':db['CmCustomField'],'as':_0x4b30('0x6e')}]})[_0x4b30('0x29')](handleEntityNotFound(_0x46a1c3,null))[_0x4b30('0x29')](function(_0x5df91f){if(_0x5df91f){_0x5b642f=_0x5df91f;return db[_0x4b30('0x61')][_0x4b30('0x4f')];}})[_0x4b30('0x29')](function(_0x3fed0c){if(_0x3fed0c){var _0x12c015={};var _0x2a4fc4={};_0x2a4fc4[_0x4b30('0x37')]=_[_0x4b30('0x6f')](_[_0x4b30('0x39')](_0x3fed0c),_['map'](_0x5b642f[_0x4b30('0x6e')],function(_0x2b93a9){return util[_0x4b30('0x70')](_0x4b30('0x71'),_0x2b93a9['id']);}));_0x2a4fc4['query']=_['keys'](_0x1c24be[_0x4b30('0x38')]);_0x2a4fc4['filters']=_[_0x4b30('0x3b')](_0x2a4fc4[_0x4b30('0x37')],_0x2a4fc4[_0x4b30('0x38')]);_0x12c015['attributes']=_[_0x4b30('0x3b')](_0x2a4fc4[_0x4b30('0x37')],qs[_0x4b30('0x3d')](_0x1c24be[_0x4b30('0x38')][_0x4b30('0x3d')]));_0x12c015['attributes']=_0x12c015['attributes'][_0x4b30('0x3e')]?_0x12c015['attributes']:_0x2a4fc4[_0x4b30('0x37')];if(!_0x1c24be[_0x4b30('0x38')][_0x4b30('0x3f')]('nolimit')){_0x12c015['limit']=qs[_0x4b30('0x20')](_0x1c24be['query'][_0x4b30('0x20')]);_0x12c015[_0x4b30('0x23')]=qs['offset'](_0x1c24be[_0x4b30('0x38')][_0x4b30('0x23')]);}_0x12c015['order']=qs['sort'](_0x1c24be[_0x4b30('0x38')][_0x4b30('0x42')]);_0x12c015[_0x4b30('0x43')]=qs[_0x4b30('0x3a')](_[_0x4b30('0x5f')](_0x1c24be[_0x4b30('0x38')],_0x2a4fc4[_0x4b30('0x3a')]));_0x12c015[_0x4b30('0x72')]=!![];if(_0x1c24be['query'][_0x4b30('0x44')]){_0x12c015[_0x4b30('0x43')]=_[_0x4b30('0x46')](_0x12c015[_0x4b30('0x43')],{'$or':_[_0x4b30('0x32')](_0x12c015[_0x4b30('0x3c')],function(_0x1fd959){var _0x4ac2e0={};_0x4ac2e0[_0x1fd959]={'$like':'%'+_0x1c24be['query'][_0x4b30('0x44')]+'%'};return _0x4ac2e0;})});}_0x12c015=_[_0x4b30('0x46')]({},_0x12c015,_0x1c24be['options']);return _0x5b642f[_0x4b30('0x6d')](_0x12c015);}})[_0x4b30('0x29')](respondWithResult(_0x46a1c3,null))[_0x4b30('0x4c')](handleError(_0x46a1c3,null));};exports[_0x4b30('0x73')]=function(_0x5bb837,_0x6fdc3a,_0x1e0680){var _0x5d9647;var _0x3c43ab;var _0x4c6b24;var _0x143446=_0x5bb837[_0x4b30('0x4e')]['id'];csv_results=[];return db['ContactItemType'][_0x4b30('0x4a')]({'attributes':['id',_0x4b30('0x2f')],'raw':!![],'order':[_0x4b30('0x74')]})[_0x4b30('0x29')](function(_0x36506f){_0x5d9647=_0x36506f;var _0x242fca=_[_0x4b30('0x39')](db['CmContact']['rawAttributes']);return db[_0x4b30('0x75')][_0x4b30('0x4a')]({'raw':!![],'attributes':['id',_0x4b30('0x76')]})['then'](function(_0x5c66a9){_0x3c43ab=_0x5c66a9;var _0x43bf5a=squel[_0x4b30('0x77')]()['fields'](_0x242fca)[_0x4b30('0x78')]('cm_contacts','c')[_0x4b30('0x43')](_0x4b30('0x79'),_0x143446)['where'](_0x4b30('0x7a'))['distinct']();for(var _0x15d9eb=0x0;_0x15d9eb<_0x3c43ab[_0x4b30('0x3e')];_0x15d9eb++){_0x43bf5a[_0x4b30('0x7b')](_0x4b30('0x7c')+_0x3c43ab[_0x15d9eb]['id'],_0x4b30('0x7d')+_0x3c43ab[_0x15d9eb][_0x4b30('0x76')]);}for(var _0x15d9eb=0x0;_0x15d9eb<_0x5d9647['length'];_0x15d9eb++){_0x43bf5a[_0x4b30('0x7b')](squel[_0x4b30('0x77')]()['field'](_0x4b30('0x7e'))['from'](_0x4b30('0x7f'))['where'](_0x4b30('0x80'),_0x5d9647[_0x15d9eb]['id'])[_0x4b30('0x43')]('CmContactId\x20=\x20c.id'),_0x4b30('0x81')+_0x5d9647[_0x15d9eb]['name']);_0x43bf5a[_0x4b30('0x7b')](squel[_0x4b30('0x77')]()[_0x4b30('0x7b')](_0x4b30('0x82'))[_0x4b30('0x78')]('cm_contact_has_items')[_0x4b30('0x43')](_0x4b30('0x80'),_0x5d9647[_0x15d9eb]['id'])[_0x4b30('0x43')](_0x4b30('0x83')),'description_additionalPhone_'+_0x5d9647[_0x15d9eb][_0x4b30('0x2f')]);}var _0x428c01=[];_0x428c01['push'](_0x43bf5a[_0x4b30('0x84')]());BPromise['each'](_0x428c01,handleQuery)['then'](function(_0x5736c2){handleQuery(_0x43bf5a[_0x4b30('0x84')]());var _0x217593=csv_results[0x0];if(!_['isEmpty'](_0x217593)){var _0x180af1=toCsv(_0x217593);var _0x3058b0=Date[_0x4b30('0x85')]();fs[_0x4b30('0x86')](util[_0x4b30('0x70')](_0x4b30('0x87'),_0x143446,_0x3058b0),_0x180af1);_0x6fdc3a[_0x4b30('0x88')](_0x4b30('0x89'),_0x4b30('0x8a')+util[_0x4b30('0x70')](_0x4b30('0x8b'),_0x143446,_0x3058b0));_0x6fdc3a[_0x4b30('0x88')](_0x4b30('0x8c'),_0x4b30('0x8d'));return _0x6fdc3a[_0x4b30('0x8e')](util['format'](_0x4b30('0x87'),_0x143446,_0x3058b0));}else{return _0x6fdc3a[_0x4b30('0x1d')](0xcc);}});});});};exports[_0x4b30('0x8f')]=function(_0x18294c,_0x554bec,_0x31277b){var _0x43dde2;delete _0x18294c[_0x4b30('0x52')]['id'];return db['CmList']['findOne']({'where':{'id':_0x18294c[_0x4b30('0x4e')]['id']}})['then'](handleEntityNotFound(_0x554bec,null))[_0x4b30('0x29')](function(_0x9da596){if(_0x9da596){return db[_0x4b30('0x90')][_0x4b30('0x91')](function(_0x17a74a){return db[_0x4b30('0x75')][_0x4b30('0x51')](_0x18294c['body'],{'transaction':_0x17a74a})[_0x4b30('0x29')](function(_0x2299ef){_0x43dde2=_0x2299ef;return _0x9da596[_0x4b30('0x92')](_0x2299ef,{'transaction':_0x17a74a});})['then'](function(){var _0x4e0d96={'type':db['Sequelize']['TEXT'],'transaction':_0x17a74a};switch(_0x18294c[_0x4b30('0x52')][_0x4b30('0x35')]){case _0x4b30('0x93'):_0x4e0d96[_0x4b30('0x35')]=db[_0x4b30('0x94')][_0x4b30('0x95')];break;case _0x4b30('0x96'):_0x4e0d96[_0x4b30('0x35')]=db[_0x4b30('0x94')][_0x4b30('0x97')];break;case _0x4b30('0x98'):_0x4e0d96[_0x4b30('0x35')]=db['Sequelize']['BOOLEAN'];_0x4e0d96[_0x4b30('0x99')]=![];break;default:}return db[_0x4b30('0x90')][_0x4b30('0x9a')][_0x4b30('0x9b')](_0x4b30('0x9c'),util['format'](_0x4b30('0x9d'),_0x43dde2['id']),_0x4e0d96);})[_0x4b30('0x29')](function(){return _0x43dde2;});});}})[_0x4b30('0x29')](respondWithResult(_0x554bec,null))[_0x4b30('0x4c')](handleError(_0x554bec,null));};exports['getCustomFields']=function(_0x5eb40d,_0xa29a36,_0x5f4b0c){var _0x4e2166={};var _0x240df2={};var _0xf97e3d;var _0x237392;return db[_0x4b30('0x33')][_0x4b30('0x5d')]({'where':{'id':_0x5eb40d['params']['id']}})[_0x4b30('0x29')](handleEntityNotFound(_0xa29a36,null))[_0x4b30('0x29')](function(_0x2c115d){if(_0x2c115d){_0xf97e3d=_0x2c115d;_0x240df2[_0x4b30('0x37')]=_['keys'](db[_0x4b30('0x75')][_0x4b30('0x4f')]);_0x240df2[_0x4b30('0x38')]=_[_0x4b30('0x39')](_0x5eb40d[_0x4b30('0x38')]);_0x240df2[_0x4b30('0x3a')]=_['intersection'](_0x240df2[_0x4b30('0x37')],_0x240df2[_0x4b30('0x38')]);_0x4e2166[_0x4b30('0x3c')]=_[_0x4b30('0x3b')](_0x240df2[_0x4b30('0x37')],qs['fields'](_0x5eb40d[_0x4b30('0x38')][_0x4b30('0x3d')]));_0x4e2166[_0x4b30('0x3c')]=_0x4e2166['attributes'][_0x4b30('0x3e')]?_0x4e2166[_0x4b30('0x3c')]:_0x240df2['model'];_0x4e2166[_0x4b30('0x41')]=qs[_0x4b30('0x42')](_0x5eb40d[_0x4b30('0x38')][_0x4b30('0x42')]);_0x4e2166[_0x4b30('0x43')]=qs[_0x4b30('0x3a')](_[_0x4b30('0x5f')](_0x5eb40d[_0x4b30('0x38')],_0x240df2[_0x4b30('0x3a')]));_0x4e2166[_0x4b30('0x43')]=_['merge'](_0x4e2166[_0x4b30('0x43')],{'$or':[{'ListId':_0x2c115d['id']},{'ListId':null}]});if(_0x5eb40d[_0x4b30('0x38')]['filter']){_0x4e2166[_0x4b30('0x43')]=_[_0x4b30('0x46')](_0x4e2166[_0x4b30('0x43')],{'$or':_[_0x4b30('0x32')](_0x4e2166[_0x4b30('0x3c')],function(_0x32c314){var _0x49a16b={};_0x49a16b[_0x32c314]={'$like':'%'+_0x5eb40d[_0x4b30('0x38')][_0x4b30('0x44')]+'%'};return _0x49a16b;})});}_0x4e2166=_[_0x4b30('0x46')]({},_0x4e2166,_0x5eb40d[_0x4b30('0x47')]);return db['CmCustomField']['findAndCountAll'](_0x4e2166);}})[_0x4b30('0x29')](respondWithResult(_0xa29a36,null))['catch'](handleError(_0xa29a36,null));};exports[_0x4b30('0x9e')]=function(_0x5aa1b5,_0x3d3bdd){return db[_0x4b30('0x75')][_0x4b30('0x9f')]({'where':{'ListId':null}})[_0x4b30('0x29')](handleEntityNotFound(_0x3d3bdd,null))[_0x4b30('0x29')](function(_0x234310){return _0x234310;})[_0x4b30('0x29')](respondWithResult(_0x3d3bdd,null))['catch'](handleError(_0x3d3bdd,null));};exports['addAgents']=function(_0xf8b923,_0x2219b2,_0x50b9b6){return db['CmList'][_0x4b30('0x50')]({'where':{'id':_0xf8b923[_0x4b30('0x4e')]['id']}})[_0x4b30('0x29')](handleEntityNotFound(_0x2219b2,null))[_0x4b30('0x29')](function(_0x576eef){if(_0x576eef){return _0x576eef[_0x4b30('0xa0')](_0xf8b923[_0x4b30('0x52')]['ids'],_[_0x4b30('0x67')](_0xf8b923[_0x4b30('0x52')],[_0x4b30('0xa1'),'id'])||{})['spread'](function(_0x27824c){for(var _0x50f9b6=0x0;_0x50f9b6<_0xf8b923['body']['ids'][_0x4b30('0x3e')];_0x50f9b6+=0x1){socket[_0x4b30('0xa2')](_0x4b30('0xa3'),{'UserId':Number(_0xf8b923['body'][_0x4b30('0xa1')][_0x50f9b6]),'CmListId':Number(_0xf8b923[_0x4b30('0x4e')]['id'])});}return _0x27824c;});}})[_0x4b30('0x29')](respondWithResult(_0x2219b2,null))['catch'](handleError(_0x2219b2,null));};exports['removeAgents']=function(_0x41cfc2,_0x1f93f7,_0x1e227c){return db[_0x4b30('0x33')][_0x4b30('0x50')]({'where':{'id':_0x41cfc2[_0x4b30('0x4e')]['id']}})['then'](handleEntityNotFound(_0x1f93f7,null))[_0x4b30('0x29')](function(_0x38179b){if(_0x38179b){return _0x38179b[_0x4b30('0xa4')](_0x41cfc2[_0x4b30('0x38')][_0x4b30('0xa1')])[_0x4b30('0x29')](function(){if(_[_0x4b30('0x62')](_0x41cfc2[_0x4b30('0x38')]['ids'])){for(var _0x180460=0x0;_0x180460<_0x41cfc2[_0x4b30('0x38')][_0x4b30('0xa1')][_0x4b30('0x3e')];_0x180460+=0x1){socket['emit'](_0x4b30('0xa5'),{'UserId':Number(_0x41cfc2[_0x4b30('0x38')][_0x4b30('0xa1')][_0x180460]),'CmListId':Number(_0x41cfc2[_0x4b30('0x4e')]['id'])});}}else{socket[_0x4b30('0xa2')](_0x4b30('0xa5'),{'UserId':Number(_0x41cfc2[_0x4b30('0x38')][_0x4b30('0xa1')]),'CmListId':Number(_0x41cfc2[_0x4b30('0x4e')]['id'])});}});}})[_0x4b30('0x29')](respondWithStatusCode(_0x1f93f7,null))['catch'](handleError(_0x1f93f7,null));};exports[_0x4b30('0xa6')]=function(_0x1fb803,_0x347fdf,_0x390ae8){var _0x152d90={};var _0x3db0f8={};var _0x316971;var _0x42fab8;return db[_0x4b30('0x33')][_0x4b30('0x5d')]({'where':{'id':_0x1fb803[_0x4b30('0x4e')]['id']}})[_0x4b30('0x29')](handleEntityNotFound(_0x347fdf,null))['then'](function(_0x23ccfd){if(_0x23ccfd){_0x316971=_0x23ccfd;_0x3db0f8[_0x4b30('0x37')]=_[_0x4b30('0x39')](db[_0x4b30('0xa7')]['rawAttributes']);_0x3db0f8[_0x4b30('0x38')]=_[_0x4b30('0x39')](_0x1fb803[_0x4b30('0x38')]);_0x3db0f8[_0x4b30('0x3a')]=_[_0x4b30('0x3b')](_0x3db0f8['model'],_0x3db0f8[_0x4b30('0x38')]);_0x152d90[_0x4b30('0x3c')]=_[_0x4b30('0x3b')](_0x3db0f8[_0x4b30('0x37')],qs[_0x4b30('0x3d')](_0x1fb803[_0x4b30('0x38')]['fields']));_0x152d90[_0x4b30('0x3c')]=_0x152d90[_0x4b30('0x3c')]['length']?_0x152d90['attributes']:_0x3db0f8[_0x4b30('0x37')];_0x152d90['order']=qs['sort'](_0x1fb803[_0x4b30('0x38')][_0x4b30('0x42')]);_0x152d90[_0x4b30('0x43')]=qs[_0x4b30('0x3a')](_[_0x4b30('0x5f')](_0x1fb803[_0x4b30('0x38')],_0x3db0f8[_0x4b30('0x3a')]));if(_0x1fb803[_0x4b30('0x38')][_0x4b30('0x44')]){_0x152d90[_0x4b30('0x43')]=_[_0x4b30('0x46')](_0x152d90[_0x4b30('0x43')],{'$or':_['map'](_0x152d90[_0x4b30('0x3c')],function(_0x1a28c8){var _0x4d594d={};_0x4d594d[_0x1a28c8]={'$like':'%'+_0x1fb803[_0x4b30('0x38')]['filter']+'%'};return _0x4d594d;})});}_0x152d90=_[_0x4b30('0x46')]({},_0x152d90,_0x1fb803[_0x4b30('0x47')]);return _0x316971[_0x4b30('0xa6')](_0x152d90);}})['then'](function(_0x2a9c33){if(_0x2a9c33){_0x42fab8=_0x2a9c33[_0x4b30('0x3e')];if(!_0x1fb803['query'][_0x4b30('0x3f')](_0x4b30('0x40'))){_0x152d90[_0x4b30('0x20')]=qs[_0x4b30('0x20')](_0x1fb803[_0x4b30('0x38')][_0x4b30('0x20')]);_0x152d90[_0x4b30('0x23')]=qs[_0x4b30('0x23')](_0x1fb803[_0x4b30('0x38')][_0x4b30('0x23')]);}return _0x316971[_0x4b30('0xa6')](_0x152d90);}})['then'](function(_0x237785){if(_0x237785){return _0x237785?{'count':_0x42fab8,'rows':_0x237785}:null;}})[_0x4b30('0x29')](respondWithResult(_0x347fdf,null))['catch'](handleError(_0x347fdf,null));};function handleQuery(_0x6bcd6e){logger[_0x4b30('0xa8')](_0x6bcd6e);return db[_0x4b30('0x90')]['query'](_0x6bcd6e)['spread'](function(_0x3d3bda){csv_results['push'](_0x3d3bda);})[_0x4b30('0x4c')](function(_0x5afef0){logger['error'](_0x5afef0[_0x4b30('0x6b')]);});} \ No newline at end of file +var _0x9e4a=['mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./cmList.socket','register','sendStatus','status','end','json','offset','undefined','limit','apply','reject','update','then','destroy','get','Lists','UserProfileResource','error','stack','name','send','index','CmList','rawAttributes','fieldName','type','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','filters','pick','filter','where','merge','map','count','includeAll','findAll','rows','catch','options','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','ListId','Disposition','getDispositions','findOne','nolimit','removeDispositions','ids','CmContact','tags','omit','push','dataValues','errors','message','Malformed\x20request\x20syntax','getContacts','CmCustomField','CustomFields','concat','raw','getContactsCsv','alias','select','from','cm_contacts','c.deletedAt\x20is\x20null','distinct','field','c.cf_','cm_contact_has_items','ItemTypeId\x20=\x20?','CmContactId\x20=\x20c.id','description','toString','each','isEmpty','now','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','format','list_%d_%s.csv','Content-type','text/csv','download','addCustomField','sequelize','transaction','addCustomFields','Sequelize','TEXT','switch','defaultValue','queryInterface','addColumn','cf_%s','getCustomFields','getGlobalCustomFields','findAndCountAll','addAgents','spread','emit','isArray','getAgents','eml-format','rimraf','zip-dir','moment','bluebird'];(function(_0x6cf19c,_0x2f3f02){var _0xce14f3=function(_0x474587){while(--_0x474587){_0x6cf19c['push'](_0x6cf19c['shift']());}};_0xce14f3(++_0x2f3f02);}(_0x9e4a,0x1c3));var _0xa9e4=function(_0x12fc8d,_0x19ee33){_0x12fc8d=_0x12fc8d-0x0;var _0x3f9d04=_0x9e4a[_0x12fc8d];return _0x3f9d04;};'use strict';var emlformat=require(_0xa9e4('0x0'));var rimraf=require(_0xa9e4('0x1'));var zipdir=require(_0xa9e4('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa9e4('0x3'));var BPromise=require(_0xa9e4('0x4'));var Mustache=require(_0xa9e4('0x5'));var util=require(_0xa9e4('0x6'));var path=require(_0xa9e4('0x7'));var sox=require(_0xa9e4('0x8'));var csv=require('to-csv');var ejs=require(_0xa9e4('0x9'));var fs=require('fs');var fs_extra=require(_0xa9e4('0xa'));var _=require(_0xa9e4('0xb'));var squel=require('squel');var crypto=require(_0xa9e4('0xc'));var jsforce=require(_0xa9e4('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xa9e4('0xe'));var querystring=require(_0xa9e4('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa9e4('0x10'));var qs=require(_0xa9e4('0x11'));var as=require(_0xa9e4('0x12'));var hardwareService=require(_0xa9e4('0x13'));var logger=require(_0xa9e4('0x14'))(_0xa9e4('0x15'));var utils=require('../../config/utils');var config=require(_0xa9e4('0x16'));var licenseUtil=require(_0xa9e4('0x17'));var db=require(_0xa9e4('0x18'))['db'];var csv_results;config[_0xa9e4('0x19')]=_['defaults'](config[_0xa9e4('0x19')],{'host':_0xa9e4('0x1a'),'port':0x18eb});var socket=require(_0xa9e4('0x1b'))(new Redis(config[_0xa9e4('0x19')]));require(_0xa9e4('0x1c'))[_0xa9e4('0x1d')](socket);function respondWithStatusCode(_0x334c84,_0x3e2b69){_0x3e2b69=_0x3e2b69||0xcc;return function(_0x30dba1){if(_0x30dba1){return _0x334c84[_0xa9e4('0x1e')](_0x3e2b69);}return _0x334c84[_0xa9e4('0x1f')](_0x3e2b69)[_0xa9e4('0x20')]();};}function respondWithResult(_0x46adca,_0x2bd6e6){_0x2bd6e6=_0x2bd6e6||0xc8;return function(_0xfe82e9){if(_0xfe82e9){return _0x46adca['status'](_0x2bd6e6)[_0xa9e4('0x21')](_0xfe82e9);}};}function respondWithFilteredResult(_0x31b64e,_0x54781a){return function(_0x2e544a){if(_0x2e544a){var _0x5760d=typeof _0x54781a[_0xa9e4('0x22')]===_0xa9e4('0x23')&&typeof _0x54781a[_0xa9e4('0x24')]===_0xa9e4('0x23');var _0x34c8f1=_0x2e544a['count'];var _0xfb35f9=_0x5760d?0x0:_0x54781a[_0xa9e4('0x22')];var _0x3e47e9=_0x5760d?_0x2e544a['count']:_0x54781a[_0xa9e4('0x22')]+_0x54781a['limit'];var _0x262533;if(_0x3e47e9>=_0x34c8f1){_0x3e47e9=_0x34c8f1;_0x262533=0xc8;}else{_0x262533=0xce;}_0x31b64e['status'](_0x262533);return _0x31b64e['set']('Content-Range',_0xfb35f9+'-'+_0x3e47e9+'/'+_0x34c8f1)['json'](_0x2e544a);}return null;};}function patchUpdates(_0x23daf2){return function(_0x4bf8da){try{jsonpatch[_0xa9e4('0x25')](_0x4bf8da,_0x23daf2,!![]);}catch(_0x2fdefa){return BPromise[_0xa9e4('0x26')](_0x2fdefa);}return _0x4bf8da['save']();};}function saveUpdates(_0xb139d7,_0x4e3119){return function(_0x3cb9d3){if(_0x3cb9d3){return _0x3cb9d3[_0xa9e4('0x27')](_0xb139d7)[_0xa9e4('0x28')](function(_0x5b8a25){return _0x5b8a25;});}return null;};}function removeEntity(_0x22d439,_0xd28d2){return function(_0xa19ea5){if(_0xa19ea5){return _0xa19ea5[_0xa9e4('0x29')]()['then'](function(){var _0x3da11c=_0xa19ea5[_0xa9e4('0x2a')]({'plain':!![]});var _0x28b3cd=_0xa9e4('0x2b');return db[_0xa9e4('0x2c')][_0xa9e4('0x29')]({'where':{'type':_0x28b3cd,'resourceId':_0x3da11c['id']}})[_0xa9e4('0x28')](function(){return _0xa19ea5;});})[_0xa9e4('0x28')](function(){_0x22d439[_0xa9e4('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x35bc55,_0x4affb4){return function(_0x57c636){if(!_0x57c636){_0x35bc55['sendStatus'](0x194);}return _0x57c636;};}function handleError(_0x19f35b,_0xfb8d09){_0xfb8d09=_0xfb8d09||0x1f4;return function(_0x49086e){logger[_0xa9e4('0x2d')](_0x49086e[_0xa9e4('0x2e')]);if(_0x49086e[_0xa9e4('0x2f')]){delete _0x49086e['name'];}_0x19f35b[_0xa9e4('0x1f')](_0xfb8d09)[_0xa9e4('0x30')](_0x49086e);};}exports[_0xa9e4('0x31')]=function(_0x5ac02,_0x2388ac){var _0x780106={},_0x412b36={},_0x51e490={'count':0x0,'rows':[]};var _0x18e5de=_['map'](db[_0xa9e4('0x32')][_0xa9e4('0x33')],function(_0x11629e){return{'name':_0x11629e[_0xa9e4('0x34')],'type':_0x11629e[_0xa9e4('0x35')]['key']};});_0x412b36['model']=_['map'](_0x18e5de,_0xa9e4('0x2f'));_0x412b36[_0xa9e4('0x36')]=_[_0xa9e4('0x37')](_0x5ac02[_0xa9e4('0x36')]);_0x412b36['filters']=_[_0xa9e4('0x38')](_0x412b36[_0xa9e4('0x39')],_0x412b36['query']);_0x780106[_0xa9e4('0x3a')]=_[_0xa9e4('0x38')](_0x412b36['model'],qs[_0xa9e4('0x3b')](_0x5ac02['query'][_0xa9e4('0x3b')]));_0x780106[_0xa9e4('0x3a')]=_0x780106[_0xa9e4('0x3a')][_0xa9e4('0x3c')]?_0x780106[_0xa9e4('0x3a')]:_0x412b36['model'];if(!_0x5ac02[_0xa9e4('0x36')][_0xa9e4('0x3d')]('nolimit')){_0x780106[_0xa9e4('0x24')]=qs[_0xa9e4('0x24')](_0x5ac02[_0xa9e4('0x36')][_0xa9e4('0x24')]);_0x780106['offset']=qs['offset'](_0x5ac02[_0xa9e4('0x36')][_0xa9e4('0x22')]);}_0x780106[_0xa9e4('0x3e')]=qs[_0xa9e4('0x3f')](_0x5ac02['query']['sort']);_0x780106['where']=qs[_0xa9e4('0x40')](_[_0xa9e4('0x41')](_0x5ac02['query'],_0x412b36['filters']),_0x18e5de);if(_0x5ac02[_0xa9e4('0x36')][_0xa9e4('0x42')]){_0x780106[_0xa9e4('0x43')]=_[_0xa9e4('0x44')](_0x780106['where'],{'$or':_[_0xa9e4('0x45')](_0x18e5de,function(_0x3764e4){if(_0x3764e4[_0xa9e4('0x35')]!=='VIRTUAL'){var _0x478ddc={};_0x478ddc[_0x3764e4[_0xa9e4('0x2f')]]={'$like':'%'+_0x5ac02[_0xa9e4('0x36')][_0xa9e4('0x42')]+'%'};return _0x478ddc;}})});}_0x780106=_[_0xa9e4('0x44')]({},_0x780106,_0x5ac02['options']);var _0xbd850c={'where':_0x780106['where']};return db[_0xa9e4('0x32')][_0xa9e4('0x46')](_0xbd850c)['then'](function(_0x53a243){_0x51e490['count']=_0x53a243;if(_0x5ac02[_0xa9e4('0x36')][_0xa9e4('0x47')]){_0x780106['include']=[{'all':!![]}];}return db['CmList'][_0xa9e4('0x48')](_0x780106);})[_0xa9e4('0x28')](function(_0x587982){_0x51e490[_0xa9e4('0x49')]=_0x587982;return _0x51e490;})[_0xa9e4('0x28')](respondWithFilteredResult(_0x2388ac,_0x780106))[_0xa9e4('0x4a')](handleError(_0x2388ac,null));};exports['show']=function(_0x3fda92,_0x15fea9){var _0x5c8237={'raw':![],'where':{'id':_0x3fda92['params']['id']}},_0x41885e={};_0x41885e['model']=_[_0xa9e4('0x37')](db[_0xa9e4('0x32')]['rawAttributes']);_0x41885e[_0xa9e4('0x36')]=_[_0xa9e4('0x37')](_0x3fda92[_0xa9e4('0x36')]);_0x41885e[_0xa9e4('0x40')]=_['intersection'](_0x41885e[_0xa9e4('0x39')],_0x41885e[_0xa9e4('0x36')]);_0x5c8237[_0xa9e4('0x3a')]=_[_0xa9e4('0x38')](_0x41885e[_0xa9e4('0x39')],qs[_0xa9e4('0x3b')](_0x3fda92[_0xa9e4('0x36')]['fields']));_0x5c8237[_0xa9e4('0x3a')]=_0x5c8237[_0xa9e4('0x3a')][_0xa9e4('0x3c')]?_0x5c8237[_0xa9e4('0x3a')]:_0x41885e[_0xa9e4('0x39')];if(_0x3fda92[_0xa9e4('0x36')][_0xa9e4('0x47')]){_0x5c8237['include']=[{'all':!![]}];}_0x5c8237=_[_0xa9e4('0x44')]({},_0x5c8237,_0x3fda92[_0xa9e4('0x4b')]);return db['CmList'][_0xa9e4('0x4c')](_0x5c8237)[_0xa9e4('0x28')](handleEntityNotFound(_0x15fea9,null))[_0xa9e4('0x28')](respondWithResult(_0x15fea9,null))[_0xa9e4('0x4a')](handleError(_0x15fea9,null));};exports['create']=function(_0x3bcd53,_0x543435){return db[_0xa9e4('0x32')][_0xa9e4('0x4d')](_0x3bcd53[_0xa9e4('0x4e')],{})[_0xa9e4('0x28')](function(_0x593e45){var _0x7e90de=_0x3bcd53[_0xa9e4('0x4f')][_0xa9e4('0x2a')]({'plain':!![]});if(!_0x7e90de)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x7e90de[_0xa9e4('0x50')]===_0xa9e4('0x4f')){var _0x4ceb48=_0x593e45['get']({'plain':!![]});var _0x4bf31d=_0xa9e4('0x2b');return db[_0xa9e4('0x51')][_0xa9e4('0x4c')]({'where':{'name':_0x4bf31d,'userProfileId':_0x7e90de[_0xa9e4('0x52')]},'raw':!![]})[_0xa9e4('0x28')](function(_0x2608bc){if(_0x2608bc&&_0x2608bc[_0xa9e4('0x53')]===0x0){return db[_0xa9e4('0x2c')]['create']({'name':_0x4ceb48[_0xa9e4('0x2f')],'resourceId':_0x4ceb48['id'],'type':_0x2608bc[_0xa9e4('0x2f')],'sectionId':_0x2608bc['id']},{})[_0xa9e4('0x28')](function(){return _0x593e45;});}else{return _0x593e45;}})[_0xa9e4('0x4a')](function(_0x385c0d){logger[_0xa9e4('0x2d')](_0xa9e4('0x54'),_0x385c0d);throw _0x385c0d;});}return _0x593e45;})['then'](respondWithResult(_0x543435,0xc9))[_0xa9e4('0x4a')](handleError(_0x543435,null));};exports[_0xa9e4('0x27')]=function(_0x2e2df5,_0x4e9f73){if(_0x2e2df5[_0xa9e4('0x4e')]['id']){delete _0x2e2df5[_0xa9e4('0x4e')]['id'];}return db[_0xa9e4('0x32')]['find']({'where':{'id':_0x2e2df5[_0xa9e4('0x55')]['id']}})[_0xa9e4('0x28')](handleEntityNotFound(_0x4e9f73,null))[_0xa9e4('0x28')](saveUpdates(_0x2e2df5[_0xa9e4('0x4e')],null))[_0xa9e4('0x28')](respondWithResult(_0x4e9f73,null))['catch'](handleError(_0x4e9f73,null));};exports['destroy']=function(_0x5ecce6,_0x412d30){return db[_0xa9e4('0x32')][_0xa9e4('0x4c')]({'where':{'id':_0x5ecce6[_0xa9e4('0x55')]['id']}})['then'](handleEntityNotFound(_0x412d30,null))['then'](removeEntity(_0x412d30,null))[_0xa9e4('0x4a')](handleError(_0x412d30,null));};exports[_0xa9e4('0x56')]=function(_0x22c551,_0x9c3f2d){return db[_0xa9e4('0x32')]['describe']()[_0xa9e4('0x28')](respondWithResult(_0x9c3f2d,null))['catch'](handleError(_0x9c3f2d,null));};exports['addDisposition']=function(_0x124308,_0x5507b8,_0x5c3cca){if(_0x124308[_0xa9e4('0x4e')]['id']){delete _0x124308[_0xa9e4('0x4e')]['id'];}return db['CmList'][_0xa9e4('0x4c')]({'where':{'id':_0x124308[_0xa9e4('0x55')]['id']}})[_0xa9e4('0x28')](handleEntityNotFound(_0x5507b8,null))['then'](function(_0x4a1230){if(_0x4a1230){_0x124308[_0xa9e4('0x4e')][_0xa9e4('0x57')]=_0x4a1230['id'];return db[_0xa9e4('0x58')][_0xa9e4('0x4d')](_0x124308[_0xa9e4('0x4e')]);}})['then'](respondWithResult(_0x5507b8,null))[_0xa9e4('0x4a')](handleError(_0x5507b8,null));};exports[_0xa9e4('0x59')]=function(_0x249afc,_0x2ea0fc,_0x593f16){var _0x23e8dd={'raw':![],'where':{}};var _0x4a16c1={};var _0x19c9b3={'count':0x0,'rows':[]};return db[_0xa9e4('0x32')][_0xa9e4('0x5a')]({'where':{'id':_0x249afc[_0xa9e4('0x55')]['id']}})[_0xa9e4('0x28')](handleEntityNotFound(_0x2ea0fc,null))[_0xa9e4('0x28')](function(_0x25b6e3){if(_0x25b6e3){_0x4a16c1[_0xa9e4('0x39')]=_[_0xa9e4('0x37')](db[_0xa9e4('0x58')]['rawAttributes']);_0x4a16c1['query']=_[_0xa9e4('0x37')](_0x249afc[_0xa9e4('0x36')]);_0x4a16c1['filters']=_[_0xa9e4('0x38')](_0x4a16c1['model'],_0x4a16c1['query']);_0x23e8dd[_0xa9e4('0x3a')]=_['intersection'](_0x4a16c1[_0xa9e4('0x39')],qs[_0xa9e4('0x3b')](_0x249afc[_0xa9e4('0x36')][_0xa9e4('0x3b')]));_0x23e8dd[_0xa9e4('0x3a')]=_0x23e8dd[_0xa9e4('0x3a')][_0xa9e4('0x3c')]?_0x23e8dd[_0xa9e4('0x3a')]:_0x4a16c1['model'];if(!_0x249afc[_0xa9e4('0x36')][_0xa9e4('0x3d')](_0xa9e4('0x5b'))){_0x23e8dd[_0xa9e4('0x24')]=qs[_0xa9e4('0x24')](_0x249afc[_0xa9e4('0x36')][_0xa9e4('0x24')]);_0x23e8dd[_0xa9e4('0x22')]=qs[_0xa9e4('0x22')](_0x249afc[_0xa9e4('0x36')]['offset']);}_0x23e8dd[_0xa9e4('0x3e')]=qs[_0xa9e4('0x3f')](_0x249afc['query'][_0xa9e4('0x3f')]);_0x23e8dd[_0xa9e4('0x43')]=qs[_0xa9e4('0x40')](_[_0xa9e4('0x41')](_0x249afc['query'],_0x4a16c1[_0xa9e4('0x40')]));_0x23e8dd['where'][_0xa9e4('0x57')]=_0x25b6e3['id'];if(_0x249afc[_0xa9e4('0x36')][_0xa9e4('0x42')]){_0x23e8dd[_0xa9e4('0x43')]=_['merge'](_0x23e8dd[_0xa9e4('0x43')],{'$or':_['map'](_0x23e8dd[_0xa9e4('0x3a')],function(_0x175a46){var _0x4ab032={};_0x4ab032[_0x175a46]={'$like':'%'+_0x249afc['query'][_0xa9e4('0x42')]+'%'};return _0x4ab032;})});}_0x23e8dd=_[_0xa9e4('0x44')]({},_0x23e8dd,_0x249afc[_0xa9e4('0x4b')]);return db['Disposition'][_0xa9e4('0x46')]({'where':_0x23e8dd['where']})['then'](function(_0x2f537b){_0x19c9b3[_0xa9e4('0x46')]=_0x2f537b;if(_0x249afc[_0xa9e4('0x36')]['includeAll']){_0x23e8dd['include']=[{'all':!![]}];}return db[_0xa9e4('0x58')][_0xa9e4('0x48')](_0x23e8dd);})['then'](function(_0x4cea0a){_0x19c9b3['rows']=_0x4cea0a;return _0x19c9b3;});}})['then'](respondWithFilteredResult(_0x2ea0fc,_0x23e8dd))[_0xa9e4('0x4a')](handleError(_0x2ea0fc,null));};exports[_0xa9e4('0x5c')]=function(_0x51c258,_0x29b2a6,_0x280b51){return db['CmList'][_0xa9e4('0x4c')]({'where':{'id':_0x51c258[_0xa9e4('0x55')]['id']}})[_0xa9e4('0x28')](handleEntityNotFound(_0x29b2a6,null))[_0xa9e4('0x28')](function(_0x9c86fa){if(_0x9c86fa){return _0x9c86fa[_0xa9e4('0x5c')](_0x51c258[_0xa9e4('0x36')][_0xa9e4('0x5d')]);}})[_0xa9e4('0x28')](respondWithStatusCode(_0x29b2a6,null))[_0xa9e4('0x4a')](handleError(_0x29b2a6,null));};exports['addContacts']=function(_0x1847d1,_0x401133,_0x51c18c){return db['CmList'][_0xa9e4('0x4c')]({'where':{'id':_0x1847d1['params']['id']}})[_0xa9e4('0x28')](handleEntityNotFound(_0x401133,null))['then'](function(_0x2d1175){if(_0x2d1175){var _0x5c2889=[];var _0x2348bf={'success':[],'errors':[]};return db[_0xa9e4('0x5e')][_0xa9e4('0x56')]()['then'](function(_0x11f01e){if(_0x1847d1['body']['tags']&&_['isArray'](_0x1847d1['body'][_0xa9e4('0x5f')])){if(_0x1847d1[_0xa9e4('0x4e')][_0xa9e4('0x5f')][_0xa9e4('0x3c')]){_0x1847d1[_0xa9e4('0x4e')][_0xa9e4('0x5f')]=_0x1847d1['body'][_0xa9e4('0x5f')]['join'](';')+';';}else{_0x1847d1[_0xa9e4('0x4e')]['tags']=null;}}else{_0x1847d1[_0xa9e4('0x4e')][_0xa9e4('0x5f')]=null;}if(_0x1847d1[_0xa9e4('0x4e')]&&_['isArray'](_0x1847d1[_0xa9e4('0x4e')])){for(var _0x1770b1=0x0;_0x1770b1<_0x1847d1[_0xa9e4('0x4e')][_0xa9e4('0x3c')];_0x1770b1+=0x1){_0x1847d1[_0xa9e4('0x4e')][_0x1770b1][_0xa9e4('0x57')]=_0x1847d1['params']['id'];_0x5c2889['push'](_0x1847d1['body'][_0x1770b1]);}return BPromise['each'](_0x5c2889,function(_0xe58bd2){return db['CmContact']['create'](_[_0xa9e4('0x60')](_0xe58bd2,['ids','id'])||{},{'fields':_[_0xa9e4('0x37')](_0x11f01e),'raw':!![]})[_0xa9e4('0x28')](function(_0x2051b1){_0x2348bf['success'][_0xa9e4('0x61')](_0x2051b1[_0xa9e4('0x62')]);})[_0xa9e4('0x4a')](function(_0x159cda){_0x2348bf[_0xa9e4('0x63')]['push']({'data':_0xe58bd2,'error':_0x159cda[_0xa9e4('0x64')]});});})[_0xa9e4('0x28')](function(_0x11d175){return _0x2348bf;})[_0xa9e4('0x4a')](function(_0x3b17a6){return _0x3b17a6;});}else{_0x401133['status'](0x190)['json']({'message':_0xa9e4('0x65')});}});}})[_0xa9e4('0x28')](respondWithResult(_0x401133,null))['catch'](handleError(_0x401133,null));};exports[_0xa9e4('0x66')]=function(_0x252fe1,_0x131c65,_0x3a2c4c){var _0x55ff0f;return db[_0xa9e4('0x32')][_0xa9e4('0x4c')]({'where':{'id':_0x252fe1[_0xa9e4('0x55')]['id']},'include':[{'model':db[_0xa9e4('0x67')],'as':_0xa9e4('0x68')}]})['then'](handleEntityNotFound(_0x131c65,null))['then'](function(_0x57d214){if(_0x57d214){_0x55ff0f=_0x57d214;return db['CmContact'][_0xa9e4('0x33')];}})[_0xa9e4('0x28')](function(_0x1ba82a){if(_0x1ba82a){var _0x40b818={};var _0x561a30={};_0x561a30['model']=_[_0xa9e4('0x69')](_[_0xa9e4('0x37')](_0x1ba82a),_[_0xa9e4('0x45')](_0x55ff0f[_0xa9e4('0x68')],function(_0x349947){return util['format']('cf_%d',_0x349947['id']);}));_0x561a30[_0xa9e4('0x36')]=_[_0xa9e4('0x37')](_0x252fe1[_0xa9e4('0x36')]);_0x561a30['filters']=_[_0xa9e4('0x38')](_0x561a30[_0xa9e4('0x39')],_0x561a30[_0xa9e4('0x36')]);_0x40b818[_0xa9e4('0x3a')]=_['intersection'](_0x561a30[_0xa9e4('0x39')],qs['fields'](_0x252fe1[_0xa9e4('0x36')][_0xa9e4('0x3b')]));_0x40b818[_0xa9e4('0x3a')]=_0x40b818['attributes']['length']?_0x40b818[_0xa9e4('0x3a')]:_0x561a30[_0xa9e4('0x39')];if(!_0x252fe1['query'][_0xa9e4('0x3d')](_0xa9e4('0x5b'))){_0x40b818[_0xa9e4('0x24')]=qs['limit'](_0x252fe1[_0xa9e4('0x36')][_0xa9e4('0x24')]);_0x40b818[_0xa9e4('0x22')]=qs['offset'](_0x252fe1[_0xa9e4('0x36')][_0xa9e4('0x22')]);}_0x40b818[_0xa9e4('0x3e')]=qs[_0xa9e4('0x3f')](_0x252fe1[_0xa9e4('0x36')][_0xa9e4('0x3f')]);_0x40b818[_0xa9e4('0x43')]=qs[_0xa9e4('0x40')](_['pick'](_0x252fe1[_0xa9e4('0x36')],_0x561a30['filters']));_0x40b818[_0xa9e4('0x6a')]=!![];if(_0x252fe1[_0xa9e4('0x36')][_0xa9e4('0x42')]){_0x40b818[_0xa9e4('0x43')]=_[_0xa9e4('0x44')](_0x40b818[_0xa9e4('0x43')],{'$or':_[_0xa9e4('0x45')](_0x40b818['attributes'],function(_0x7c8784){var _0x28fdd9={};_0x28fdd9[_0x7c8784]={'$like':'%'+_0x252fe1[_0xa9e4('0x36')][_0xa9e4('0x42')]+'%'};return _0x28fdd9;})});}_0x40b818=_[_0xa9e4('0x44')]({},_0x40b818,_0x252fe1[_0xa9e4('0x4b')]);return _0x55ff0f[_0xa9e4('0x66')](_0x40b818);}})[_0xa9e4('0x28')](respondWithResult(_0x131c65,null))[_0xa9e4('0x4a')](handleError(_0x131c65,null));};exports[_0xa9e4('0x6b')]=function(_0x410098,_0x195f23,_0xaf9007){var _0x50ca1c;var _0x4d8205;var _0x5e8e91;var _0x542530=_0x410098[_0xa9e4('0x55')]['id'];csv_results=[];return db['ContactItemType'][_0xa9e4('0x48')]({'attributes':['id',_0xa9e4('0x2f')],'raw':!![],'order':['OrderBy']})[_0xa9e4('0x28')](function(_0x341689){_0x50ca1c=_0x341689;var _0x2178aa=_[_0xa9e4('0x37')](db[_0xa9e4('0x5e')][_0xa9e4('0x33')]);return db[_0xa9e4('0x67')]['findAll']({'raw':!![],'attributes':['id',_0xa9e4('0x6c')]})[_0xa9e4('0x28')](function(_0x2f3b1c){_0x4d8205=_0x2f3b1c;var _0x3a1d8b=squel[_0xa9e4('0x6d')]()[_0xa9e4('0x3b')](_0x2178aa)[_0xa9e4('0x6e')](_0xa9e4('0x6f'),'c')[_0xa9e4('0x43')]('c.ListId\x20=\x20?',_0x542530)[_0xa9e4('0x43')](_0xa9e4('0x70'))[_0xa9e4('0x71')]();for(var _0x347abb=0x0;_0x347abb<_0x4d8205[_0xa9e4('0x3c')];_0x347abb++){_0x3a1d8b[_0xa9e4('0x72')](_0xa9e4('0x73')+_0x4d8205[_0x347abb]['id'],'customField_'+_0x4d8205[_0x347abb][_0xa9e4('0x6c')]);}for(var _0x347abb=0x0;_0x347abb<_0x50ca1c['length'];_0x347abb++){_0x3a1d8b[_0xa9e4('0x72')](squel[_0xa9e4('0x6d')]()[_0xa9e4('0x72')]('item')[_0xa9e4('0x6e')](_0xa9e4('0x74'))[_0xa9e4('0x43')](_0xa9e4('0x75'),_0x50ca1c[_0x347abb]['id'])[_0xa9e4('0x43')](_0xa9e4('0x76')),'additionalPhone_'+_0x50ca1c[_0x347abb][_0xa9e4('0x2f')]);_0x3a1d8b['field'](squel[_0xa9e4('0x6d')]()[_0xa9e4('0x72')](_0xa9e4('0x77'))[_0xa9e4('0x6e')](_0xa9e4('0x74'))[_0xa9e4('0x43')](_0xa9e4('0x75'),_0x50ca1c[_0x347abb]['id'])[_0xa9e4('0x43')](_0xa9e4('0x76')),'description_additionalPhone_'+_0x50ca1c[_0x347abb]['name']);}var _0x3a1c75=[];_0x3a1c75['push'](_0x3a1d8b[_0xa9e4('0x78')]());BPromise[_0xa9e4('0x79')](_0x3a1c75,handleQuery)[_0xa9e4('0x28')](function(_0x93469b){handleQuery(_0x3a1d8b[_0xa9e4('0x78')]());var _0x2f0beb=csv_results[0x0];if(!_[_0xa9e4('0x7a')](_0x2f0beb)){var _0x42a8cf=toCsv(_0x2f0beb);var _0x408b67=Date[_0xa9e4('0x7b')]();fs['writeFileSync'](util['format'](_0xa9e4('0x7c'),_0x542530,_0x408b67),_0x42a8cf);_0x195f23[_0xa9e4('0x7d')](_0xa9e4('0x7e'),_0xa9e4('0x7f')+util[_0xa9e4('0x80')](_0xa9e4('0x81'),_0x542530,_0x408b67));_0x195f23[_0xa9e4('0x7d')](_0xa9e4('0x82'),_0xa9e4('0x83'));return _0x195f23[_0xa9e4('0x84')](util[_0xa9e4('0x80')](_0xa9e4('0x7c'),_0x542530,_0x408b67));}else{return _0x195f23['sendStatus'](0xcc);}});});});};exports[_0xa9e4('0x85')]=function(_0x3aa932,_0x487765,_0x1ae2d4){var _0x1e39f0;delete _0x3aa932[_0xa9e4('0x4e')]['id'];return db[_0xa9e4('0x32')]['findOne']({'where':{'id':_0x3aa932[_0xa9e4('0x55')]['id']}})[_0xa9e4('0x28')](handleEntityNotFound(_0x487765,null))[_0xa9e4('0x28')](function(_0x2aea85){if(_0x2aea85){return db[_0xa9e4('0x86')][_0xa9e4('0x87')](function(_0x579d58){return db['CmCustomField'][_0xa9e4('0x4d')](_0x3aa932[_0xa9e4('0x4e')],{'transaction':_0x579d58})[_0xa9e4('0x28')](function(_0x2cf206){_0x1e39f0=_0x2cf206;return _0x2aea85[_0xa9e4('0x88')](_0x2cf206,{'transaction':_0x579d58});})[_0xa9e4('0x28')](function(){var _0x231c93={'type':db[_0xa9e4('0x89')][_0xa9e4('0x8a')],'transaction':_0x579d58};switch(_0x3aa932[_0xa9e4('0x4e')]['type']){case'text':_0x231c93['type']=db[_0xa9e4('0x89')][_0xa9e4('0x8a')];break;case'number':_0x231c93[_0xa9e4('0x35')]=db[_0xa9e4('0x89')]['INTEGER'];break;case _0xa9e4('0x8b'):_0x231c93[_0xa9e4('0x35')]=db[_0xa9e4('0x89')]['BOOLEAN'];_0x231c93[_0xa9e4('0x8c')]=![];break;default:}return db['sequelize'][_0xa9e4('0x8d')][_0xa9e4('0x8e')](_0xa9e4('0x6f'),util[_0xa9e4('0x80')](_0xa9e4('0x8f'),_0x1e39f0['id']),_0x231c93);})[_0xa9e4('0x28')](function(){return _0x1e39f0;});});}})[_0xa9e4('0x28')](respondWithResult(_0x487765,null))[_0xa9e4('0x4a')](handleError(_0x487765,null));};exports[_0xa9e4('0x90')]=function(_0x32b778,_0x3cd938,_0x20956c){var _0x4c1a02={};var _0x310824={};var _0x12dcbe;var _0x37262f;return db[_0xa9e4('0x32')][_0xa9e4('0x5a')]({'where':{'id':_0x32b778['params']['id']}})[_0xa9e4('0x28')](handleEntityNotFound(_0x3cd938,null))['then'](function(_0x4e3e74){if(_0x4e3e74){_0x12dcbe=_0x4e3e74;_0x310824[_0xa9e4('0x39')]=_[_0xa9e4('0x37')](db[_0xa9e4('0x67')][_0xa9e4('0x33')]);_0x310824[_0xa9e4('0x36')]=_[_0xa9e4('0x37')](_0x32b778[_0xa9e4('0x36')]);_0x310824[_0xa9e4('0x40')]=_[_0xa9e4('0x38')](_0x310824[_0xa9e4('0x39')],_0x310824[_0xa9e4('0x36')]);_0x4c1a02['attributes']=_[_0xa9e4('0x38')](_0x310824[_0xa9e4('0x39')],qs[_0xa9e4('0x3b')](_0x32b778[_0xa9e4('0x36')][_0xa9e4('0x3b')]));_0x4c1a02['attributes']=_0x4c1a02[_0xa9e4('0x3a')][_0xa9e4('0x3c')]?_0x4c1a02[_0xa9e4('0x3a')]:_0x310824['model'];_0x4c1a02['order']=qs[_0xa9e4('0x3f')](_0x32b778[_0xa9e4('0x36')]['sort']);_0x4c1a02[_0xa9e4('0x43')]=qs[_0xa9e4('0x40')](_[_0xa9e4('0x41')](_0x32b778[_0xa9e4('0x36')],_0x310824[_0xa9e4('0x40')]));_0x4c1a02['where']=_[_0xa9e4('0x44')](_0x4c1a02['where'],{'$or':[{'ListId':_0x4e3e74['id']},{'ListId':null}]});if(_0x32b778[_0xa9e4('0x36')][_0xa9e4('0x42')]){_0x4c1a02[_0xa9e4('0x43')]=_[_0xa9e4('0x44')](_0x4c1a02[_0xa9e4('0x43')],{'$or':_[_0xa9e4('0x45')](_0x4c1a02[_0xa9e4('0x3a')],function(_0x183811){var _0x5227b4={};_0x5227b4[_0x183811]={'$like':'%'+_0x32b778['query'][_0xa9e4('0x42')]+'%'};return _0x5227b4;})});}_0x4c1a02=_[_0xa9e4('0x44')]({},_0x4c1a02,_0x32b778['options']);return db['CmCustomField']['findAndCountAll'](_0x4c1a02);}})[_0xa9e4('0x28')](respondWithResult(_0x3cd938,null))[_0xa9e4('0x4a')](handleError(_0x3cd938,null));};exports[_0xa9e4('0x91')]=function(_0x3c2d1c,_0x2ec4f8){return db[_0xa9e4('0x67')][_0xa9e4('0x92')]({'where':{'ListId':null}})['then'](handleEntityNotFound(_0x2ec4f8,null))[_0xa9e4('0x28')](function(_0x2b25e4){return _0x2b25e4;})[_0xa9e4('0x28')](respondWithResult(_0x2ec4f8,null))[_0xa9e4('0x4a')](handleError(_0x2ec4f8,null));};exports[_0xa9e4('0x93')]=function(_0xe8864f,_0x3eda95,_0x1f809c){return db[_0xa9e4('0x32')][_0xa9e4('0x4c')]({'where':{'id':_0xe8864f[_0xa9e4('0x55')]['id']}})[_0xa9e4('0x28')](handleEntityNotFound(_0x3eda95,null))[_0xa9e4('0x28')](function(_0x410c13){if(_0x410c13){return _0x410c13[_0xa9e4('0x93')](_0xe8864f[_0xa9e4('0x4e')][_0xa9e4('0x5d')],_[_0xa9e4('0x60')](_0xe8864f[_0xa9e4('0x4e')],[_0xa9e4('0x5d'),'id'])||{})[_0xa9e4('0x94')](function(_0x3f76b9){for(var _0x670c3c=0x0;_0x670c3c<_0xe8864f['body'][_0xa9e4('0x5d')][_0xa9e4('0x3c')];_0x670c3c+=0x1){socket[_0xa9e4('0x95')]('userCmList:save',{'UserId':Number(_0xe8864f[_0xa9e4('0x4e')][_0xa9e4('0x5d')][_0x670c3c]),'CmListId':Number(_0xe8864f[_0xa9e4('0x55')]['id'])});}return _0x3f76b9;});}})[_0xa9e4('0x28')](respondWithResult(_0x3eda95,null))['catch'](handleError(_0x3eda95,null));};exports['removeAgents']=function(_0x4958db,_0x26387a,_0x2697c5){return db[_0xa9e4('0x32')][_0xa9e4('0x4c')]({'where':{'id':_0x4958db['params']['id']}})['then'](handleEntityNotFound(_0x26387a,null))['then'](function(_0x3a92cd){if(_0x3a92cd){return _0x3a92cd['removeAgents'](_0x4958db[_0xa9e4('0x36')]['ids'])[_0xa9e4('0x28')](function(){if(_[_0xa9e4('0x96')](_0x4958db[_0xa9e4('0x36')]['ids'])){for(var _0x3f706d=0x0;_0x3f706d<_0x4958db[_0xa9e4('0x36')][_0xa9e4('0x5d')][_0xa9e4('0x3c')];_0x3f706d+=0x1){socket[_0xa9e4('0x95')]('userCmList:remove',{'UserId':Number(_0x4958db[_0xa9e4('0x36')]['ids'][_0x3f706d]),'CmListId':Number(_0x4958db[_0xa9e4('0x55')]['id'])});}}else{socket[_0xa9e4('0x95')]('userCmList:remove',{'UserId':Number(_0x4958db[_0xa9e4('0x36')][_0xa9e4('0x5d')]),'CmListId':Number(_0x4958db[_0xa9e4('0x55')]['id'])});}});}})[_0xa9e4('0x28')](respondWithStatusCode(_0x26387a,null))[_0xa9e4('0x4a')](handleError(_0x26387a,null));};exports[_0xa9e4('0x97')]=function(_0x2a81d4,_0x55d176,_0xe68c74){var _0x336fff={};var _0x1f6dec={};var _0x2ccaac;var _0x399054;return db[_0xa9e4('0x32')]['findOne']({'where':{'id':_0x2a81d4[_0xa9e4('0x55')]['id']}})[_0xa9e4('0x28')](handleEntityNotFound(_0x55d176,null))[_0xa9e4('0x28')](function(_0x11e296){if(_0x11e296){_0x2ccaac=_0x11e296;_0x1f6dec[_0xa9e4('0x39')]=_['keys'](db['User']['rawAttributes']);_0x1f6dec['query']=_[_0xa9e4('0x37')](_0x2a81d4[_0xa9e4('0x36')]);_0x1f6dec[_0xa9e4('0x40')]=_['intersection'](_0x1f6dec[_0xa9e4('0x39')],_0x1f6dec[_0xa9e4('0x36')]);_0x336fff[_0xa9e4('0x3a')]=_[_0xa9e4('0x38')](_0x1f6dec[_0xa9e4('0x39')],qs[_0xa9e4('0x3b')](_0x2a81d4[_0xa9e4('0x36')][_0xa9e4('0x3b')]));_0x336fff[_0xa9e4('0x3a')]=_0x336fff[_0xa9e4('0x3a')][_0xa9e4('0x3c')]?_0x336fff['attributes']:_0x1f6dec[_0xa9e4('0x39')];_0x336fff[_0xa9e4('0x3e')]=qs['sort'](_0x2a81d4[_0xa9e4('0x36')][_0xa9e4('0x3f')]);_0x336fff[_0xa9e4('0x43')]=qs['filters'](_['pick'](_0x2a81d4['query'],_0x1f6dec[_0xa9e4('0x40')]));if(_0x2a81d4[_0xa9e4('0x36')][_0xa9e4('0x42')]){_0x336fff[_0xa9e4('0x43')]=_[_0xa9e4('0x44')](_0x336fff[_0xa9e4('0x43')],{'$or':_[_0xa9e4('0x45')](_0x336fff['attributes'],function(_0x91201d){var _0x5632d0={};_0x5632d0[_0x91201d]={'$like':'%'+_0x2a81d4[_0xa9e4('0x36')][_0xa9e4('0x42')]+'%'};return _0x5632d0;})});}_0x336fff=_[_0xa9e4('0x44')]({},_0x336fff,_0x2a81d4[_0xa9e4('0x4b')]);return _0x2ccaac[_0xa9e4('0x97')](_0x336fff);}})['then'](function(_0x1d6b2b){if(_0x1d6b2b){_0x399054=_0x1d6b2b[_0xa9e4('0x3c')];if(!_0x2a81d4[_0xa9e4('0x36')][_0xa9e4('0x3d')](_0xa9e4('0x5b'))){_0x336fff['limit']=qs[_0xa9e4('0x24')](_0x2a81d4['query']['limit']);_0x336fff[_0xa9e4('0x22')]=qs['offset'](_0x2a81d4[_0xa9e4('0x36')][_0xa9e4('0x22')]);}return _0x2ccaac[_0xa9e4('0x97')](_0x336fff);}})['then'](function(_0x503930){if(_0x503930){return _0x503930?{'count':_0x399054,'rows':_0x503930}:null;}})['then'](respondWithResult(_0x55d176,null))[_0xa9e4('0x4a')](handleError(_0x55d176,null));};function handleQuery(_0x1bb903){logger['info'](_0x1bb903);return db[_0xa9e4('0x86')][_0xa9e4('0x36')](_0x1bb903)['spread'](function(_0x501ab2){csv_results[_0xa9e4('0x61')](_0x501ab2);})[_0xa9e4('0x4a')](function(_0x238f8a){logger[_0xa9e4('0x2d')](_0x238f8a[_0xa9e4('0x64')]);});} \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index 3549566..73fc2f7 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 _0x5fc3=['events','../../mysqldb','setMaxListeners','save','update','remove','emit','hook'];(function(_0x57da0a,_0x284aed){var _0x3145d5=function(_0xfe7c3b){while(--_0xfe7c3b){_0x57da0a['push'](_0x57da0a['shift']());}};_0x3145d5(++_0x284aed);}(_0x5fc3,0xa8));var _0x35fc=function(_0x59d0cc,_0xa7c52b){_0x59d0cc=_0x59d0cc-0x0;var _0x2ae79f=_0x5fc3[_0x59d0cc];return _0x2ae79f;};'use strict';var EventEmitter=require(_0x35fc('0x0'));var CmList=require(_0x35fc('0x1'))['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents[_0x35fc('0x2')](0x0);var events={'afterCreate':_0x35fc('0x3'),'afterUpdate':_0x35fc('0x4'),'afterDestroy':_0x35fc('0x5')};function emitEvent(_0xb4f9ce){return function(_0x5e75e6,_0x2d1404,_0x1d5fec){CmListEvents[_0x35fc('0x6')](_0xb4f9ce+':'+_0x5e75e6['id'],_0x5e75e6);CmListEvents['emit'](_0xb4f9ce,_0x5e75e6);_0x1d5fec(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmList[_0x35fc('0x7')](e,emitEvent(event));}}module['exports']=CmListEvents; \ No newline at end of file +var _0x814b=['update','emit','hook','exports','events','../../mysqldb','CmList','setMaxListeners','save'];(function(_0x24a007,_0x135279){var _0x5175d4=function(_0x223792){while(--_0x223792){_0x24a007['push'](_0x24a007['shift']());}};_0x5175d4(++_0x135279);}(_0x814b,0x1a2));var _0xb814=function(_0x3a19d4,_0x3f19a4){_0x3a19d4=_0x3a19d4-0x0;var _0x5b858b=_0x814b[_0x3a19d4];return _0x5b858b;};'use strict';var EventEmitter=require(_0xb814('0x0'));var CmList=require(_0xb814('0x1'))['db'][_0xb814('0x2')];var CmListEvents=new EventEmitter();CmListEvents[_0xb814('0x3')](0x0);var events={'afterCreate':_0xb814('0x4'),'afterUpdate':_0xb814('0x5'),'afterDestroy':'remove'};function emitEvent(_0x38c21a){return function(_0x3e1e9,_0x258866,_0x4237bc){CmListEvents[_0xb814('0x6')](_0x38c21a+':'+_0x3e1e9['id'],_0x3e1e9);CmListEvents[_0xb814('0x6')](_0x38c21a,_0x3e1e9);_0x4237bc(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmList[_0xb814('0x7')](e,emitEvent(event));}}module[_0xb814('0x8')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index 6a209e2..ede539b 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 _0x22fb=['define','CmList','../../config/logger','moment','bluebird','request-promise','path','rimraf','./cmList.attributes','exports'];(function(_0x24b61e,_0x20ce95){var _0x1ea8e8=function(_0x519c55){while(--_0x519c55){_0x24b61e['push'](_0x24b61e['shift']());}};_0x1ea8e8(++_0x20ce95);}(_0x22fb,0x192));var _0xb22f=function(_0x6c5282,_0x570f88){_0x6c5282=_0x6c5282-0x0;var _0x524093=_0x22fb[_0x6c5282];return _0x524093;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xb22f('0x0'))('api');var moment=require(_0xb22f('0x1'));var BPromise=require(_0xb22f('0x2'));var rp=require(_0xb22f('0x3'));var fs=require('fs');var path=require(_0xb22f('0x4'));var rimraf=require(_0xb22f('0x5'));var config=require('../../config/environment');var attributes=require(_0xb22f('0x6'));module[_0xb22f('0x7')]=function(_0x2d1fb3,_0xc3ffcc){return _0x2d1fb3[_0xb22f('0x8')](_0xb22f('0x9'),attributes,{'tableName':'cm_lists','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6f0d=['./cmList.attributes','define','CmList','cm_lists','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0xaa1b3e,_0x47d976){var _0x454d7d=function(_0x575b32){while(--_0x575b32){_0xaa1b3e['push'](_0xaa1b3e['shift']());}};_0x454d7d(++_0x47d976);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x374b72,_0xfbd9e9){_0x374b72=_0x374b72-0x0;var _0x3fb7f8=_0x6f0d[_0x374b72];return _0x3fb7f8;};'use strict';var _=require('lodash');var util=require(_0xd6f0('0x0'));var logger=require(_0xd6f0('0x1'))(_0xd6f0('0x2'));var moment=require(_0xd6f0('0x3'));var BPromise=require('bluebird');var rp=require(_0xd6f0('0x4'));var fs=require('fs');var path=require(_0xd6f0('0x5'));var rimraf=require(_0xd6f0('0x6'));var config=require(_0xd6f0('0x7'));var attributes=require(_0xd6f0('0x8'));module['exports']=function(_0x2d2ce6,_0x4a8b0c){return _0x2d2ce6[_0xd6f0('0x9')](_0xd6f0('0xa'),attributes,{'tableName':_0xd6f0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmList/cmList.rpc.js b/server/api/cmList/cmList.rpc.js index d1bf54c..a590b32 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 _0xb095=['debug','CmList,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','CmList,\x20%s,\x20%s','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','request','then','info'];(function(_0x3dca5f,_0x50e36b){var _0x271423=function(_0x164b80){while(--_0x164b80){_0x3dca5f['push'](_0x3dca5f['shift']());}};_0x271423(++_0x50e36b);}(_0xb095,0xcc));var _0x5b09=function(_0x3e6ad1,_0x483e6e){_0x3e6ad1=_0x3e6ad1-0x0;var _0x289e9a=_0xb095[_0x3e6ad1];return _0x289e9a;};'use strict';var _=require(_0x5b09('0x0'));var util=require(_0x5b09('0x1'));var moment=require(_0x5b09('0x2'));var BPromise=require('bluebird');var rs=require(_0x5b09('0x3'));var fs=require('fs');var Redis=require(_0x5b09('0x4'));var db=require(_0x5b09('0x5'))['db'];var utils=require(_0x5b09('0x6'));var logger=require(_0x5b09('0x7'))('rpc');var config=require(_0x5b09('0x8'));var jayson=require(_0x5b09('0x9'));var client=jayson['client'][_0x5b09('0xa')]({'port':0x232a});config[_0x5b09('0xb')]=_[_0x5b09('0xc')](config[_0x5b09('0xb')],{'host':_0x5b09('0xd'),'port':0x18eb});var socket=require(_0x5b09('0xe'))(new Redis(config[_0x5b09('0xb')]));require(_0x5b09('0xf'))[_0x5b09('0x10')](socket);function respondWithRpcPromise(_0x20d63f,_0x265942,_0x3ddba3){return new BPromise(function(_0x36ce23,_0x1ba1d5){return client[_0x5b09('0x11')](_0x20d63f,_0x3ddba3)[_0x5b09('0x12')](function(_0xdf86ce){logger[_0x5b09('0x13')]('CmList,\x20%s,\x20%s',_0x265942,'request\x20sent');logger[_0x5b09('0x14')](_0x5b09('0x15'),_0x265942,_0x5b09('0x16'),JSON['stringify'](_0xdf86ce));if(_0xdf86ce[_0x5b09('0x17')]){if(_0xdf86ce[_0x5b09('0x17')][_0x5b09('0x18')]===0x1f4){logger[_0x5b09('0x17')]('CmList,\x20%s,\x20%s',_0x265942,_0xdf86ce[_0x5b09('0x17')][_0x5b09('0x19')]);return _0x1ba1d5(_0xdf86ce[_0x5b09('0x17')][_0x5b09('0x19')]);}logger[_0x5b09('0x17')]('CmList,\x20%s,\x20%s',_0x265942,_0xdf86ce['error'][_0x5b09('0x19')]);return _0x36ce23(_0xdf86ce['error']['message']);}else{logger[_0x5b09('0x13')](_0x5b09('0x1a'),_0x265942,_0x5b09('0x16'));_0x36ce23(_0xdf86ce['result'][_0x5b09('0x19')]);}})[_0x5b09('0x1b')](function(_0x32e81c){logger[_0x5b09('0x17')](_0x5b09('0x1a'),_0x265942,_0x32e81c);_0x1ba1d5(_0x32e81c);});});} \ No newline at end of file +var _0xe444=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./cmList.socket','register','request\x20sent','debug','stringify','error','code','CmList,\x20%s,\x20%s','message','info','result','catch','util','randomstring','../../mysqldb'];(function(_0x54defc,_0x627178){var _0x1955d3=function(_0x299afe){while(--_0x299afe){_0x54defc['push'](_0x54defc['shift']());}};_0x1955d3(++_0x627178);}(_0xe444,0xde));var _0x4e44=function(_0x3efa63,_0x45d014){_0x3efa63=_0x3efa63-0x0;var _0x545229=_0xe444[_0x3efa63];return _0x545229;};'use strict';var _=require('lodash');var util=require(_0x4e44('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x4e44('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4e44('0x2'))['db'];var utils=require(_0x4e44('0x3'));var logger=require(_0x4e44('0x4'))(_0x4e44('0x5'));var config=require(_0x4e44('0x6'));var jayson=require(_0x4e44('0x7'));var client=jayson[_0x4e44('0x8')][_0x4e44('0x9')]({'port':0x232a});config[_0x4e44('0xa')]=_[_0x4e44('0xb')](config[_0x4e44('0xa')],{'host':_0x4e44('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4e44('0xa')]));require(_0x4e44('0xd'))[_0x4e44('0xe')](socket);function respondWithRpcPromise(_0x559fb5,_0x55f663,_0x1a8849){return new BPromise(function(_0x17b107,_0x21d018){return client['request'](_0x559fb5,_0x1a8849)['then'](function(_0x3893dd){logger['info']('CmList,\x20%s,\x20%s',_0x55f663,_0x4e44('0xf'));logger[_0x4e44('0x10')]('CmList,\x20%s,\x20%s,\x20%s',_0x55f663,_0x4e44('0xf'),JSON[_0x4e44('0x11')](_0x3893dd));if(_0x3893dd[_0x4e44('0x12')]){if(_0x3893dd['error'][_0x4e44('0x13')]===0x1f4){logger[_0x4e44('0x12')](_0x4e44('0x14'),_0x55f663,_0x3893dd[_0x4e44('0x12')][_0x4e44('0x15')]);return _0x21d018(_0x3893dd['error'][_0x4e44('0x15')]);}logger[_0x4e44('0x12')](_0x4e44('0x14'),_0x55f663,_0x3893dd[_0x4e44('0x12')]['message']);return _0x17b107(_0x3893dd['error'][_0x4e44('0x15')]);}else{logger[_0x4e44('0x16')](_0x4e44('0x14'),_0x55f663,'request\x20sent');_0x17b107(_0x3893dd[_0x4e44('0x17')]['message']);}})[_0x4e44('0x18')](function(_0xf5b876){logger['error'](_0x4e44('0x14'),_0x55f663,_0xf5b876);_0x21d018(_0xf5b876);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 3b3c6a8..965890f 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 _0x4af9=['./cmList.events','save','remove','update','emit','removeListener','register','length'];(function(_0x54d91f,_0x4d32c4){var _0x8b3ca=function(_0x1a5dc3){while(--_0x1a5dc3){_0x54d91f['push'](_0x54d91f['shift']());}};_0x8b3ca(++_0x4d32c4);}(_0x4af9,0x188));var _0x94af=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4af9[_0x3dd15e];return _0x231fd0;};'use strict';var CmListEvents=require(_0x94af('0x0'));var events=[_0x94af('0x1'),_0x94af('0x2'),_0x94af('0x3')];function createListener(_0x3c1c25,_0x5f7f66){return function(_0x5576e9){_0x5f7f66[_0x94af('0x4')](_0x3c1c25,_0x5576e9);};}function removeListener(_0x5c32c1,_0x2dc43c){return function(){CmListEvents[_0x94af('0x5')](_0x5c32c1,_0x2dc43c);};}exports[_0x94af('0x6')]=function(_0x7eebde){for(var _0x10e81e=0x0,_0x4463cf=events[_0x94af('0x7')];_0x10e81e<_0x4463cf;_0x10e81e++){var _0x2b0994=events[_0x10e81e];var _0x5e9197=createListener('cmList:'+_0x2b0994,_0x7eebde);CmListEvents['on'](_0x2b0994,_0x5e9197);}}; \ No newline at end of file +var _0x34a5=['remove','update','register','cmList:','./cmList.events','save'];(function(_0x1f9179,_0x598964){var _0x2974c9=function(_0x52443b){while(--_0x52443b){_0x1f9179['push'](_0x1f9179['shift']());}};_0x2974c9(++_0x598964);}(_0x34a5,0xdc));var _0x534a=function(_0x1c7609,_0xf27224){_0x1c7609=_0x1c7609-0x0;var _0x1cd189=_0x34a5[_0x1c7609];return _0x1cd189;};'use strict';var CmListEvents=require(_0x534a('0x0'));var events=[_0x534a('0x1'),_0x534a('0x2'),_0x534a('0x3')];function createListener(_0x23e8d8,_0x253fbb){return function(_0x4853ce){_0x253fbb['emit'](_0x23e8d8,_0x4853ce);};}function removeListener(_0xd8acc,_0x115007){return function(){CmListEvents['removeListener'](_0xd8acc,_0x115007);};}exports[_0x534a('0x4')]=function(_0x49f19a){for(var _0x17f8d6=0x0,_0x21fce1=events['length'];_0x17f8d6<_0x21fce1;_0x17f8d6++){var _0x51202b=events[_0x17f8d6];var _0x26ad9c=createListener(_0x534a('0x5')+_0x51202b,_0x49f19a);CmListEvents['on'](_0x51202b,_0x26ad9c);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index 746d1da..8b38c87 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 _0x634d=['/describe','isAuthenticated','describe','getGlobalCustomFields','/:id','/:id/contacts','/:id/contacts/csv','getContactsCsv','/:id/fields','getCustomFields','/:id/users','getAgents','post','/:id/dispositions','addDisposition','addContacts','addCustomField','addAgents','put','update','delete','destroy','removeDispositions','removeAgents','multer','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','./cmList.controller','get','index'];(function(_0x2acae7,_0x49d89c){var _0x2be409=function(_0x59407a){while(--_0x59407a){_0x2acae7['push'](_0x2acae7['shift']());}};_0x2be409(++_0x49d89c);}(_0x634d,0x120));var _0xd634=function(_0x1467bc,_0x452b04){_0x1467bc=_0x1467bc-0x0;var _0x44f841=_0x634d[_0x1467bc];return _0x44f841;};'use strict';var multer=require(_0xd634('0x0'));var util=require(_0xd634('0x1'));var path=require(_0xd634('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xd634('0x3'));var auth=require(_0xd634('0x4'));var interaction=require(_0xd634('0x5'));var config=require('../../config/environment');var controller=require(_0xd634('0x6'));router[_0xd634('0x7')]('/',auth['isAuthenticated'](),controller[_0xd634('0x8')]);router[_0xd634('0x7')](_0xd634('0x9'),auth[_0xd634('0xa')](),controller[_0xd634('0xb')]);router[_0xd634('0x7')]('/global_fields',auth[_0xd634('0xa')](),controller[_0xd634('0xc')]);router['get'](_0xd634('0xd'),auth[_0xd634('0xa')](),controller['show']);router[_0xd634('0x7')]('/:id/dispositions',auth['isAuthenticated'](),controller['getDispositions']);router[_0xd634('0x7')](_0xd634('0xe'),auth[_0xd634('0xa')](),controller['getContacts']);router['get'](_0xd634('0xf'),auth[_0xd634('0xa')](),controller[_0xd634('0x10')]);router['get'](_0xd634('0x11'),auth[_0xd634('0xa')](),controller[_0xd634('0x12')]);router[_0xd634('0x7')](_0xd634('0x13'),auth[_0xd634('0xa')](),controller[_0xd634('0x14')]);router[_0xd634('0x15')]('/',auth[_0xd634('0xa')](),controller['create']);router[_0xd634('0x15')](_0xd634('0x16'),auth[_0xd634('0xa')](),controller[_0xd634('0x17')]);router[_0xd634('0x15')](_0xd634('0xe'),auth[_0xd634('0xa')](),controller[_0xd634('0x18')]);router[_0xd634('0x15')](_0xd634('0x11'),auth['isAuthenticated'](),controller[_0xd634('0x19')]);router[_0xd634('0x15')](_0xd634('0x13'),auth[_0xd634('0xa')](),controller[_0xd634('0x1a')]);router[_0xd634('0x1b')](_0xd634('0xd'),auth[_0xd634('0xa')](),controller[_0xd634('0x1c')]);router[_0xd634('0x1d')]('/:id',auth['isAuthenticated'](),controller[_0xd634('0x1e')]);router[_0xd634('0x1d')](_0xd634('0x16'),auth['isAuthenticated'](),controller[_0xd634('0x1f')]);router[_0xd634('0x1d')]('/:id/users',auth['isAuthenticated'](),controller[_0xd634('0x20')]);module['exports']=router; \ No newline at end of file +var _0x4e09=['getGlobalCustomFields','/:id','/:id/dispositions','getDispositions','/:id/contacts/csv','/:id/fields','getCustomFields','/:id/users','getAgents','post','create','addDisposition','/:id/contacts','addContacts','addCustomField','put','update','destroy','delete','removeDispositions','removeAgents','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmList.controller','get','isAuthenticated','index','describe'];(function(_0x4cde40,_0x233b70){var _0x199409=function(_0x2d1c2d){while(--_0x2d1c2d){_0x4cde40['push'](_0x4cde40['shift']());}};_0x199409(++_0x233b70);}(_0x4e09,0xa2));var _0x94e0=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x4e09[_0x59ee6f];return _0x4c0979;};'use strict';var multer=require(_0x94e0('0x0'));var util=require('util');var path=require(_0x94e0('0x1'));var timeout=require('connect-timeout');var express=require(_0x94e0('0x2'));var router=express[_0x94e0('0x3')]();var fs_extra=require(_0x94e0('0x4'));var auth=require(_0x94e0('0x5'));var interaction=require(_0x94e0('0x6'));var config=require(_0x94e0('0x7'));var controller=require(_0x94e0('0x8'));router[_0x94e0('0x9')]('/',auth[_0x94e0('0xa')](),controller[_0x94e0('0xb')]);router[_0x94e0('0x9')]('/describe',auth[_0x94e0('0xa')](),controller[_0x94e0('0xc')]);router[_0x94e0('0x9')]('/global_fields',auth[_0x94e0('0xa')](),controller[_0x94e0('0xd')]);router['get'](_0x94e0('0xe'),auth[_0x94e0('0xa')](),controller['show']);router['get'](_0x94e0('0xf'),auth[_0x94e0('0xa')](),controller[_0x94e0('0x10')]);router[_0x94e0('0x9')]('/:id/contacts',auth[_0x94e0('0xa')](),controller['getContacts']);router[_0x94e0('0x9')](_0x94e0('0x11'),auth[_0x94e0('0xa')](),controller['getContactsCsv']);router['get'](_0x94e0('0x12'),auth[_0x94e0('0xa')](),controller[_0x94e0('0x13')]);router[_0x94e0('0x9')](_0x94e0('0x14'),auth['isAuthenticated'](),controller[_0x94e0('0x15')]);router[_0x94e0('0x16')]('/',auth[_0x94e0('0xa')](),controller[_0x94e0('0x17')]);router[_0x94e0('0x16')](_0x94e0('0xf'),auth[_0x94e0('0xa')](),controller[_0x94e0('0x18')]);router[_0x94e0('0x16')](_0x94e0('0x19'),auth[_0x94e0('0xa')](),controller[_0x94e0('0x1a')]);router[_0x94e0('0x16')](_0x94e0('0x12'),auth['isAuthenticated'](),controller[_0x94e0('0x1b')]);router['post'](_0x94e0('0x14'),auth[_0x94e0('0xa')](),controller['addAgents']);router[_0x94e0('0x1c')](_0x94e0('0xe'),auth[_0x94e0('0xa')](),controller[_0x94e0('0x1d')]);router['delete'](_0x94e0('0xe'),auth[_0x94e0('0xa')](),controller[_0x94e0('0x1e')]);router[_0x94e0('0x1f')](_0x94e0('0xf'),auth[_0x94e0('0xa')](),controller[_0x94e0('0x20')]);router[_0x94e0('0x1f')](_0x94e0('0x14'),auth[_0x94e0('0xa')](),controller[_0x94e0('0x21')]);module[_0x94e0('0x22')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index 055813c..739bcd6 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 _0x5b61=['STRING','sequelize','VIRTUAL','getDataValue'];(function(_0x478f5c,_0x3faee9){var _0xb4eabb=function(_0xc30d14){while(--_0xc30d14){_0x478f5c['push'](_0x478f5c['shift']());}};_0xb4eabb(++_0x3faee9);}(_0x5b61,0x145));var _0x15b6=function(_0x4ed520,_0x21be63){_0x4ed520=_0x4ed520-0x0;var _0x4415a6=_0x5b61[_0x4ed520];return _0x4415a6;};'use strict';var Sequelize=require(_0x15b6('0x0'));module['exports']={'name':{'type':Sequelize[_0x15b6('0x1')],'get':function(_0x417bb9){return this[_0x15b6('0x2')]('field');}},'field':{'type':Sequelize[_0x15b6('0x3')],'allowNull':![]},'operator':{'type':Sequelize[_0x15b6('0x3')],'allowNull':![]},'value':{'type':Sequelize[_0x15b6('0x3')],'allowNull':![]}}; \ No newline at end of file +var _0xecdc=['sequelize','VIRTUAL','getDataValue','field','STRING'];(function(_0x2c63a4,_0xad7e3){var _0x421379=function(_0x3fefcf){while(--_0x3fefcf){_0x2c63a4['push'](_0x2c63a4['shift']());}};_0x421379(++_0xad7e3);}(_0xecdc,0xe6));var _0xcecd=function(_0x348be4,_0x165924){_0x348be4=_0x348be4-0x0;var _0x193a61=_0xecdc[_0x348be4];return _0x193a61;};'use strict';var Sequelize=require(_0xcecd('0x0'));module['exports']={'name':{'type':Sequelize[_0xcecd('0x1')],'get':function(_0x482785){return this[_0xcecd('0x2')](_0xcecd('0x3'));}},'field':{'type':Sequelize['STRING'],'allowNull':![]},'operator':{'type':Sequelize[_0xcecd('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0xcecd('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 324071d..78728f5 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(_0x352004,_0x437119){var _0x33e56a=function(_0x4fb831){while(--_0x4fb831){_0x352004['push'](_0x352004['shift']());}};_0x33e56a(++_0x437119);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'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(_0x48f2e6,_0x525b59){var _0xc03b86=function(_0x70b4a6){while(--_0x70b4a6){_0x48f2e6['push'](_0x48f2e6['shift']());}};_0xc03b86(++_0x525b59);}(_0x7a54,0x106));var _0x47a5=function(_0x1541e6,_0x2ac77f){_0x1541e6=_0x1541e6-0x0;var _0x2b781d=_0x7a54[_0x1541e6];return _0x2b781d;};'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 99ed936..3fe34e4 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 _0xe690=['../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./condition.attributes','exports','define','Condition','tools_conditions','util'];(function(_0x5668f4,_0x19c70b){var _0x439229=function(_0x360af3){while(--_0x360af3){_0x5668f4['push'](_0x5668f4['shift']());}};_0x439229(++_0x19c70b);}(_0xe690,0x15b));var _0x0e69=function(_0x356ec3,_0xbaffd2){_0x356ec3=_0x356ec3-0x0;var _0x539694=_0xe690[_0x356ec3];return _0x539694;};'use strict';var _=require('lodash');var util=require(_0x0e69('0x0'));var logger=require(_0x0e69('0x1'))(_0x0e69('0x2'));var moment=require(_0x0e69('0x3'));var BPromise=require('bluebird');var rp=require(_0x0e69('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0e69('0x5'));var config=require(_0x0e69('0x6'));var attributes=require(_0x0e69('0x7'));module[_0x0e69('0x8')]=function(_0x296d39,_0x472a59){return _0x296d39[_0x0e69('0x9')](_0x0e69('0xa'),attributes,{'tableName':_0x0e69('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x37dc=['request-promise','path','./condition.attributes','Condition','tools_conditions','util','../../config/logger','api','moment','bluebird'];(function(_0x17575f,_0x2ac70a){var _0x3741d4=function(_0x13c92c){while(--_0x13c92c){_0x17575f['push'](_0x17575f['shift']());}};_0x3741d4(++_0x2ac70a);}(_0x37dc,0x14f));var _0xc37d=function(_0x2f8c1e,_0x34a72d){_0x2f8c1e=_0x2f8c1e-0x0;var _0x539436=_0x37dc[_0x2f8c1e];return _0x539436;};'use strict';var _=require('lodash');var util=require(_0xc37d('0x0'));var logger=require(_0xc37d('0x1'))(_0xc37d('0x2'));var moment=require(_0xc37d('0x3'));var BPromise=require(_0xc37d('0x4'));var rp=require(_0xc37d('0x5'));var fs=require('fs');var path=require(_0xc37d('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xc37d('0x7'));module['exports']=function(_0x5db5c5,_0x4ca4a0){return _0x5db5c5['define'](_0xc37d('0x8'),attributes,{'tableName':_0xc37d('0x9'),'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 f512c84..2cd7464 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 _0x5a57=['info','Condition,\x20%s,\x20%s','debug','Condition,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','request','then'];(function(_0x3fad0d,_0x1c123b){var _0x5b003e=function(_0xf9c02f){while(--_0xf9c02f){_0x3fad0d['push'](_0x3fad0d['shift']());}};_0x5b003e(++_0x1c123b);}(_0x5a57,0x14b));var _0x75a5=function(_0x3c858f,_0x235201){_0x3c858f=_0x3c858f-0x0;var _0x198090=_0x5a57[_0x3c858f];return _0x198090;};'use strict';var _=require(_0x75a5('0x0'));var util=require('util');var moment=require(_0x75a5('0x1'));var BPromise=require(_0x75a5('0x2'));var rs=require(_0x75a5('0x3'));var fs=require('fs');var Redis=require(_0x75a5('0x4'));var db=require(_0x75a5('0x5'))['db'];var utils=require(_0x75a5('0x6'));var logger=require('../../config/logger')(_0x75a5('0x7'));var config=require(_0x75a5('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x55e5fc,_0x28ade6,_0x451b34){return new BPromise(function(_0x5871ba,_0x101c14){return client[_0x75a5('0x9')](_0x55e5fc,_0x451b34)[_0x75a5('0xa')](function(_0x206646){logger[_0x75a5('0xb')](_0x75a5('0xc'),_0x28ade6,'request\x20sent');logger[_0x75a5('0xd')](_0x75a5('0xe'),_0x28ade6,_0x75a5('0xf'),JSON['stringify'](_0x206646));if(_0x206646['error']){if(_0x206646[_0x75a5('0x10')][_0x75a5('0x11')]===0x1f4){logger[_0x75a5('0x10')]('Condition,\x20%s,\x20%s',_0x28ade6,_0x206646['error'][_0x75a5('0x12')]);return _0x101c14(_0x206646[_0x75a5('0x10')][_0x75a5('0x12')]);}logger[_0x75a5('0x10')](_0x75a5('0xc'),_0x28ade6,_0x206646[_0x75a5('0x10')][_0x75a5('0x12')]);return _0x5871ba(_0x206646['error'][_0x75a5('0x12')]);}else{logger[_0x75a5('0xb')](_0x75a5('0xc'),_0x28ade6,_0x75a5('0xf'));_0x5871ba(_0x206646['result'][_0x75a5('0x12')]);}})['catch'](function(_0x154d50){logger[_0x75a5('0x10')](_0x75a5('0xc'),_0x28ade6,_0x154d50);_0x101c14(_0x154d50);});});} \ No newline at end of file +var _0xfa7e=['info','Condition,\x20%s,\x20%s','debug','Condition,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x1ab2fd,_0x1a4c3b){var _0x1e6564=function(_0x2d66cb){while(--_0x2d66cb){_0x1ab2fd['push'](_0x1ab2fd['shift']());}};_0x1e6564(++_0x1a4c3b);}(_0xfa7e,0x18a));var _0xefa7=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0xfa7e[_0x2d7f0e];return _0x110b07;};'use strict';var _=require(_0xefa7('0x0'));var util=require(_0xefa7('0x1'));var moment=require(_0xefa7('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xefa7('0x3'));var db=require(_0xefa7('0x4'))['db'];var utils=require(_0xefa7('0x5'));var logger=require(_0xefa7('0x6'))(_0xefa7('0x7'));var config=require(_0xefa7('0x8'));var jayson=require(_0xefa7('0x9'));var client=jayson[_0xefa7('0xa')][_0xefa7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x41b839,_0x340dd9,_0x9f8ce2){return new BPromise(function(_0x372781,_0x18ae2c){return client[_0xefa7('0xc')](_0x41b839,_0x9f8ce2)[_0xefa7('0xd')](function(_0x342520){logger[_0xefa7('0xe')](_0xefa7('0xf'),_0x340dd9,'request\x20sent');logger[_0xefa7('0x10')](_0xefa7('0x11'),_0x340dd9,_0xefa7('0x12'),JSON[_0xefa7('0x13')](_0x342520));if(_0x342520[_0xefa7('0x14')]){if(_0x342520[_0xefa7('0x14')][_0xefa7('0x15')]===0x1f4){logger[_0xefa7('0x14')](_0xefa7('0xf'),_0x340dd9,_0x342520['error']['message']);return _0x18ae2c(_0x342520[_0xefa7('0x14')]['message']);}logger['error']('Condition,\x20%s,\x20%s',_0x340dd9,_0x342520[_0xefa7('0x14')][_0xefa7('0x16')]);return _0x372781(_0x342520['error'][_0xefa7('0x16')]);}else{logger['info'](_0xefa7('0xf'),_0x340dd9,'request\x20sent');_0x372781(_0x342520['result'][_0xefa7('0x16')]);}})[_0xefa7('0x17')](function(_0x1bc00f){logger[_0xefa7('0x14')](_0xefa7('0xf'),_0x340dd9,_0x1bc00f);_0x18ae2c(_0x1bc00f);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 82dd85c..1b20c59 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 _0x82d1=['/:id','update','isAuthenticated','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./condition.controller','put'];(function(_0x12a626,_0x244ddb){var _0x237a12=function(_0xd0aa0d){while(--_0xd0aa0d){_0x12a626['push'](_0x12a626['shift']());}};_0x237a12(++_0x244ddb);}(_0x82d1,0x1c6));var _0x182d=function(_0x3e08b0,_0x1c95d5){_0x3e08b0=_0x3e08b0-0x0;var _0x432106=_0x82d1[_0x3e08b0];return _0x432106;};'use strict';var multer=require(_0x182d('0x0'));var util=require(_0x182d('0x1'));var path=require(_0x182d('0x2'));var timeout=require(_0x182d('0x3'));var express=require(_0x182d('0x4'));var router=express[_0x182d('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x182d('0x6'));var interaction=require(_0x182d('0x7'));var config=require(_0x182d('0x8'));var controller=require(_0x182d('0x9'));router[_0x182d('0xa')](_0x182d('0xb'),auth['isAuthenticated'](),controller[_0x182d('0xc')]);router['delete'](_0x182d('0xb'),auth[_0x182d('0xd')](),controller['destroy']);module[_0x182d('0xe')]=router; \ No newline at end of file +var _0x75bc=['destroy','util','express','Router','fs-extra','../../components/interaction/service','./condition.controller','update','delete','/:id','isAuthenticated'];(function(_0x457b4c,_0x450765){var _0x6477b7=function(_0x27474d){while(--_0x27474d){_0x457b4c['push'](_0x457b4c['shift']());}};_0x6477b7(++_0x450765);}(_0x75bc,0x1a3));var _0xc75b=function(_0x3bb336,_0x5a090d){_0x3bb336=_0x3bb336-0x0;var _0x15140f=_0x75bc[_0x3bb336];return _0x15140f;};'use strict';var multer=require('multer');var util=require(_0xc75b('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xc75b('0x1'));var router=express[_0xc75b('0x2')]();var fs_extra=require(_0xc75b('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xc75b('0x4'));var config=require('../../config/environment');var controller=require(_0xc75b('0x5'));router['put']('/:id',auth['isAuthenticated'](),controller[_0xc75b('0x6')]);router[_0xc75b('0x7')](_0xc75b('0x8'),auth[_0xc75b('0x9')](),controller[_0xc75b('0xa')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.attributes.js b/server/api/contactItemType/contactItemType.attributes.js index 5625534..a020531 100644 --- a/server/api/contactItemType/contactItemType.attributes.js +++ b/server/api/contactItemType/contactItemType.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3c1b=['exports','INTEGER','STRING','sequelize'];(function(_0x36125b,_0x5a888a){var _0x3e3479=function(_0xe3efeb){while(--_0xe3efeb){_0x36125b['push'](_0x36125b['shift']());}};_0x3e3479(++_0x5a888a);}(_0x3c1b,0x15b));var _0xb3c1=function(_0xb2189d,_0x59da17){_0xb2189d=_0xb2189d-0x0;var _0x3c50ce=_0x3c1b[_0xb2189d];return _0x3c50ce;};'use strict';var Sequelize=require(_0xb3c1('0x0'));module[_0xb3c1('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'OrderBy':{'type':Sequelize[_0xb3c1('0x2')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0xb3c1('0x3')],'allowNull':!![]}}; \ No newline at end of file +var _0x7f1f=['name','sequelize'];(function(_0xe1bc5,_0xfee479){var _0x36904c=function(_0x2e0db5){while(--_0x2e0db5){_0xe1bc5['push'](_0xe1bc5['shift']());}};_0x36904c(++_0xfee479);}(_0x7f1f,0x1c5));var _0xf7f1=function(_0xb0f7c3,_0x4eae95){_0xb0f7c3=_0xb0f7c3-0x0;var _0x28ea68=_0x7f1f[_0xb0f7c3];return _0x28ea68;};'use strict';var Sequelize=require(_0xf7f1('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xf7f1('0x1')},'OrderBy':{'type':Sequelize['INTEGER'],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.controller.js b/server/api/contactItemType/contactItemType.controller.js index 03c51ac..6bb4aa1 100644 --- a/server/api/contactItemType/contactItemType.controller.js +++ b/server/api/contactItemType/contactItemType.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd7d1=['autoAssociation','UserProfileResource','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','CmContactHasItem','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','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','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','then','destroy','get','end','error','stack','name','index','map','ContactItemType','rawAttributes','fieldName','type','query','keys','filters','intersection','model','fields','attributes','length','order','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','findAll','catch','params','include','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','ContactItemTypes','UserProfileSection','userProfileId'];(function(_0x1d2179,_0x4cc753){var _0xc9c536=function(_0xb9ea9e){while(--_0xb9ea9e){_0x1d2179['push'](_0x1d2179['shift']());}};_0xc9c536(++_0x4cc753);}(_0xd7d1,0x1b3));var _0x1d7d=function(_0x462d87,_0x45e1a6){_0x462d87=_0x462d87-0x0;var _0x2c6936=_0xd7d1[_0x462d87];return _0x2c6936;};'use strict';var emlformat=require(_0x1d7d('0x0'));var rimraf=require(_0x1d7d('0x1'));var zipdir=require(_0x1d7d('0x2'));var jsonpatch=require(_0x1d7d('0x3'));var rp=require(_0x1d7d('0x4'));var moment=require(_0x1d7d('0x5'));var BPromise=require(_0x1d7d('0x6'));var Mustache=require(_0x1d7d('0x7'));var util=require(_0x1d7d('0x8'));var path=require(_0x1d7d('0x9'));var sox=require(_0x1d7d('0xa'));var csv=require(_0x1d7d('0xb'));var ejs=require(_0x1d7d('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1d7d('0xd'));var squel=require(_0x1d7d('0xe'));var crypto=require(_0x1d7d('0xf'));var jsforce=require(_0x1d7d('0x10'));var deskjs=require(_0x1d7d('0x11'));var toCsv=require(_0x1d7d('0xb'));var querystring=require(_0x1d7d('0x12'));var Papa=require(_0x1d7d('0x13'));var Redis=require(_0x1d7d('0x14'));var authService=require(_0x1d7d('0x15'));var qs=require(_0x1d7d('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1d7d('0x17'));var logger=require('../../config/logger')(_0x1d7d('0x18'));var utils=require(_0x1d7d('0x19'));var config=require(_0x1d7d('0x1a'));var licenseUtil=require(_0x1d7d('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x11b83f,_0x5ae1c9){_0x5ae1c9=_0x5ae1c9||0xcc;return function(_0x577e07){if(_0x577e07){return _0x11b83f[_0x1d7d('0x1c')](_0x5ae1c9);}return _0x11b83f[_0x1d7d('0x1d')](_0x5ae1c9)['end']();};}function respondWithResult(_0x55dba7,_0x1d3822){_0x1d3822=_0x1d3822||0xc8;return function(_0x334e78){if(_0x334e78){return _0x55dba7[_0x1d7d('0x1d')](_0x1d3822)[_0x1d7d('0x1e')](_0x334e78);}};}function respondWithFilteredResult(_0xeb05b3,_0x53423f){return function(_0x28adf3){if(_0x28adf3){var _0x1de6cc=typeof _0x53423f['offset']===_0x1d7d('0x1f')&&typeof _0x53423f[_0x1d7d('0x20')]===_0x1d7d('0x1f');var _0x47826a=_0x28adf3[_0x1d7d('0x21')];var _0x4db4f2=_0x1de6cc?0x0:_0x53423f[_0x1d7d('0x22')];var _0x191024=_0x1de6cc?_0x28adf3['count']:_0x53423f['offset']+_0x53423f[_0x1d7d('0x20')];var _0x1a5101;if(_0x191024>=_0x47826a){_0x191024=_0x47826a;_0x1a5101=0xc8;}else{_0x1a5101=0xce;}_0xeb05b3[_0x1d7d('0x1d')](_0x1a5101);return _0xeb05b3[_0x1d7d('0x23')](_0x1d7d('0x24'),_0x4db4f2+'-'+_0x191024+'/'+_0x47826a)[_0x1d7d('0x1e')](_0x28adf3);}return null;};}function patchUpdates(_0x54d401){return function(_0x225f85){try{jsonpatch[_0x1d7d('0x25')](_0x225f85,_0x54d401,!![]);}catch(_0x3a93d0){return BPromise['reject'](_0x3a93d0);}return _0x225f85[_0x1d7d('0x26')]();};}function saveUpdates(_0x12c54b,_0x4a1cdc){return function(_0x5950bd){if(_0x5950bd){return _0x5950bd[_0x1d7d('0x27')](_0x12c54b)[_0x1d7d('0x28')](function(_0x3d631f){return _0x3d631f;});}return null;};}function removeEntity(_0x5097b8,_0x377653){return function(_0x106376){if(_0x106376){return _0x106376[_0x1d7d('0x29')]()[_0x1d7d('0x28')](function(){var _0x4fa346=_0x106376[_0x1d7d('0x2a')]({'plain':!![]});var _0x151198='ContactItemTypes';return db['UserProfileResource'][_0x1d7d('0x29')]({'where':{'type':_0x151198,'resourceId':_0x4fa346['id']}})['then'](function(){return _0x106376;});})[_0x1d7d('0x28')](function(){_0x5097b8[_0x1d7d('0x1d')](0xcc)[_0x1d7d('0x2b')]();});}};}function handleEntityNotFound(_0x22c40d,_0x465938){return function(_0x59f827){if(!_0x59f827){_0x22c40d[_0x1d7d('0x1c')](0x194);}return _0x59f827;};}function handleError(_0x98c1ad,_0x352d5a){_0x352d5a=_0x352d5a||0x1f4;return function(_0x58672c){logger[_0x1d7d('0x2c')](_0x58672c[_0x1d7d('0x2d')]);if(_0x58672c[_0x1d7d('0x2e')]){delete _0x58672c['name'];}_0x98c1ad['status'](_0x352d5a)['send'](_0x58672c);};}exports[_0x1d7d('0x2f')]=function(_0x329f56,_0x559f19){var _0x1ebcbc={},_0x3e4136={},_0x16a81d={'count':0x0,'rows':[]};var _0x3336ab=_[_0x1d7d('0x30')](db[_0x1d7d('0x31')][_0x1d7d('0x32')],function(_0x803dc9){return{'name':_0x803dc9[_0x1d7d('0x33')],'type':_0x803dc9[_0x1d7d('0x34')]['key']};});_0x3e4136['model']=_[_0x1d7d('0x30')](_0x3336ab,_0x1d7d('0x2e'));_0x3e4136[_0x1d7d('0x35')]=_[_0x1d7d('0x36')](_0x329f56[_0x1d7d('0x35')]);_0x3e4136[_0x1d7d('0x37')]=_[_0x1d7d('0x38')](_0x3e4136[_0x1d7d('0x39')],_0x3e4136[_0x1d7d('0x35')]);_0x1ebcbc['attributes']=_[_0x1d7d('0x38')](_0x3e4136[_0x1d7d('0x39')],qs[_0x1d7d('0x3a')](_0x329f56[_0x1d7d('0x35')]['fields']));_0x1ebcbc['attributes']=_0x1ebcbc[_0x1d7d('0x3b')][_0x1d7d('0x3c')]?_0x1ebcbc['attributes']:_0x3e4136[_0x1d7d('0x39')];if(!_0x329f56[_0x1d7d('0x35')]['hasOwnProperty']('nolimit')){_0x1ebcbc[_0x1d7d('0x20')]=qs[_0x1d7d('0x20')](_0x329f56[_0x1d7d('0x35')][_0x1d7d('0x20')]);_0x1ebcbc[_0x1d7d('0x22')]=qs[_0x1d7d('0x22')](_0x329f56[_0x1d7d('0x35')][_0x1d7d('0x22')]);}_0x1ebcbc[_0x1d7d('0x3d')]=qs[_0x1d7d('0x3e')](_0x329f56['query']['sort']);_0x1ebcbc['where']=qs['filters'](_[_0x1d7d('0x3f')](_0x329f56['query'],_0x3e4136[_0x1d7d('0x37')]),_0x3336ab);if(_0x329f56[_0x1d7d('0x35')][_0x1d7d('0x40')]){_0x1ebcbc['where']=_[_0x1d7d('0x41')](_0x1ebcbc[_0x1d7d('0x42')],{'$or':_[_0x1d7d('0x30')](_0x3336ab,function(_0x5b7e01){if(_0x5b7e01[_0x1d7d('0x34')]!==_0x1d7d('0x43')){var _0xfb9845={};_0xfb9845[_0x5b7e01[_0x1d7d('0x2e')]]={'$like':'%'+_0x329f56['query'][_0x1d7d('0x40')]+'%'};return _0xfb9845;}})});}_0x1ebcbc=_[_0x1d7d('0x41')]({},_0x1ebcbc,_0x329f56[_0x1d7d('0x44')]);var _0x456d51={'where':_0x1ebcbc['where']};return db[_0x1d7d('0x31')]['count'](_0x456d51)[_0x1d7d('0x28')](function(_0x31b850){_0x16a81d[_0x1d7d('0x21')]=_0x31b850;if(_0x329f56[_0x1d7d('0x35')][_0x1d7d('0x45')]){_0x1ebcbc['include']=[{'all':!![]}];}return db['ContactItemType'][_0x1d7d('0x46')](_0x1ebcbc);})[_0x1d7d('0x28')](function(_0x1637fc){_0x16a81d['rows']=_0x1637fc;return _0x16a81d;})['then'](respondWithFilteredResult(_0x559f19,_0x1ebcbc))[_0x1d7d('0x47')](handleError(_0x559f19,null));};exports['show']=function(_0x86e7bc,_0x379e75){var _0x1d1064={'raw':!![],'where':{'id':_0x86e7bc[_0x1d7d('0x48')]['id']}},_0x21394c={};_0x21394c[_0x1d7d('0x39')]=_[_0x1d7d('0x36')](db['ContactItemType'][_0x1d7d('0x32')]);_0x21394c[_0x1d7d('0x35')]=_['keys'](_0x86e7bc[_0x1d7d('0x35')]);_0x21394c[_0x1d7d('0x37')]=_[_0x1d7d('0x38')](_0x21394c[_0x1d7d('0x39')],_0x21394c[_0x1d7d('0x35')]);_0x1d1064[_0x1d7d('0x3b')]=_[_0x1d7d('0x38')](_0x21394c[_0x1d7d('0x39')],qs[_0x1d7d('0x3a')](_0x86e7bc[_0x1d7d('0x35')][_0x1d7d('0x3a')]));_0x1d1064[_0x1d7d('0x3b')]=_0x1d1064['attributes'][_0x1d7d('0x3c')]?_0x1d1064['attributes']:_0x21394c[_0x1d7d('0x39')];if(_0x86e7bc['query'][_0x1d7d('0x45')]){_0x1d1064[_0x1d7d('0x49')]=[{'all':!![]}];}_0x1d1064=_[_0x1d7d('0x41')]({},_0x1d1064,_0x86e7bc[_0x1d7d('0x44')]);return db['ContactItemType'][_0x1d7d('0x4a')](_0x1d1064)['then'](handleEntityNotFound(_0x379e75,null))['then'](respondWithResult(_0x379e75,null))[_0x1d7d('0x47')](handleError(_0x379e75,null));};exports['create']=function(_0x57e416,_0x3727be){return db[_0x1d7d('0x31')]['create'](_0x57e416[_0x1d7d('0x4b')],{})[_0x1d7d('0x28')](function(_0x527711){var _0x1f3a63=_0x57e416[_0x1d7d('0x4c')][_0x1d7d('0x2a')]({'plain':!![]});if(!_0x1f3a63)throw new Error(_0x1d7d('0x4d'));if(_0x1f3a63['role']==='user'){var _0x3f73eb=_0x527711[_0x1d7d('0x2a')]({'plain':!![]});var _0x35ff5d=_0x1d7d('0x4e');return db[_0x1d7d('0x4f')]['find']({'where':{'name':_0x35ff5d,'userProfileId':_0x1f3a63[_0x1d7d('0x50')]},'raw':!![]})[_0x1d7d('0x28')](function(_0x344b66){if(_0x344b66&&_0x344b66[_0x1d7d('0x51')]===0x0){return db[_0x1d7d('0x52')][_0x1d7d('0x53')]({'name':_0x3f73eb[_0x1d7d('0x2e')],'resourceId':_0x3f73eb['id'],'type':_0x344b66[_0x1d7d('0x2e')],'sectionId':_0x344b66['id']},{})[_0x1d7d('0x28')](function(){return _0x527711;});}else{return _0x527711;}})['catch'](function(_0x3e7c4c){logger[_0x1d7d('0x2c')](_0x1d7d('0x54'),_0x3e7c4c);throw _0x3e7c4c;});}return _0x527711;})['then'](respondWithResult(_0x3727be,0xc9))['catch'](handleError(_0x3727be,null));};exports[_0x1d7d('0x27')]=function(_0x2d4cc3,_0x3f5434){if(_0x2d4cc3['body']['id']){delete _0x2d4cc3[_0x1d7d('0x4b')]['id'];}return db[_0x1d7d('0x31')]['find']({'where':{'id':_0x2d4cc3[_0x1d7d('0x48')]['id']}})[_0x1d7d('0x28')](handleEntityNotFound(_0x3f5434,null))[_0x1d7d('0x28')](saveUpdates(_0x2d4cc3[_0x1d7d('0x4b')],null))['then'](respondWithResult(_0x3f5434,null))[_0x1d7d('0x47')](handleError(_0x3f5434,null));};exports[_0x1d7d('0x29')]=function(_0x4ba6ec,_0x4d4c34){return db[_0x1d7d('0x31')][_0x1d7d('0x4a')]({'where':{'id':_0x4ba6ec['params']['id']}})['then'](handleEntityNotFound(_0x4d4c34,null))[_0x1d7d('0x28')](db[_0x1d7d('0x55')][_0x1d7d('0x27')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x4ba6ec[_0x1d7d('0x48')]['id']}}))['then'](removeEntity(_0x4d4c34,null))[_0x1d7d('0x47')](handleError(_0x4d4c34,null));}; \ No newline at end of file +var _0x7916=['../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','undefined','limit','count','offset','set','Content-Range','reject','update','then','get','destroy','end','error','name','send','index','map','ContactItemType','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','length','attributes','nolimit','sort','where','merge','VIRTUAL','filter','options','includeAll','findAll','rows','catch','params','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','CmContactHasItem','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','fs-extra','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs'];(function(_0x5c2e3e,_0x26ecd3){var _0x53f64a=function(_0x2b5df8){while(--_0x2b5df8){_0x5c2e3e['push'](_0x5c2e3e['shift']());}};_0x53f64a(++_0x26ecd3);}(_0x7916,0x128));var _0x6791=function(_0x287069,_0x535ca){_0x287069=_0x287069-0x0;var _0x591e66=_0x7916[_0x287069];return _0x591e66;};'use strict';var emlformat=require(_0x6791('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6791('0x1'));var jsonpatch=require(_0x6791('0x2'));var rp=require('request-promise');var moment=require(_0x6791('0x3'));var BPromise=require(_0x6791('0x4'));var Mustache=require(_0x6791('0x5'));var util=require(_0x6791('0x6'));var path=require('path');var sox=require(_0x6791('0x7'));var csv=require('to-csv');var ejs=require(_0x6791('0x8'));var fs=require('fs');var fs_extra=require(_0x6791('0x9'));var _=require('lodash');var squel=require(_0x6791('0xa'));var crypto=require('crypto');var jsforce=require(_0x6791('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6791('0xc'));var Papa=require(_0x6791('0xd'));var Redis=require('ioredis');var authService=require(_0x6791('0xe'));var qs=require(_0x6791('0xf'));var as=require(_0x6791('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6791('0x11'))(_0x6791('0x12'));var utils=require(_0x6791('0x13'));var config=require(_0x6791('0x14'));var licenseUtil=require(_0x6791('0x15'));var db=require(_0x6791('0x16'))['db'];function respondWithStatusCode(_0x61ac73,_0x16c62b){_0x16c62b=_0x16c62b||0xcc;return function(_0x423e22){if(_0x423e22){return _0x61ac73[_0x6791('0x17')](_0x16c62b);}return _0x61ac73[_0x6791('0x18')](_0x16c62b)['end']();};}function respondWithResult(_0x4b1719,_0x34b28d){_0x34b28d=_0x34b28d||0xc8;return function(_0x5122f9){if(_0x5122f9){return _0x4b1719[_0x6791('0x18')](_0x34b28d)['json'](_0x5122f9);}};}function respondWithFilteredResult(_0x3be9f0,_0x163898){return function(_0x517910){if(_0x517910){var _0x3e4792=typeof _0x163898['offset']===_0x6791('0x19')&&typeof _0x163898[_0x6791('0x1a')]==='undefined';var _0xbc35d=_0x517910[_0x6791('0x1b')];var _0x5bec14=_0x3e4792?0x0:_0x163898[_0x6791('0x1c')];var _0x4d8a79=_0x3e4792?_0x517910[_0x6791('0x1b')]:_0x163898[_0x6791('0x1c')]+_0x163898[_0x6791('0x1a')];var _0x3a72ce;if(_0x4d8a79>=_0xbc35d){_0x4d8a79=_0xbc35d;_0x3a72ce=0xc8;}else{_0x3a72ce=0xce;}_0x3be9f0[_0x6791('0x18')](_0x3a72ce);return _0x3be9f0[_0x6791('0x1d')](_0x6791('0x1e'),_0x5bec14+'-'+_0x4d8a79+'/'+_0xbc35d)['json'](_0x517910);}return null;};}function patchUpdates(_0x4a2922){return function(_0x306acb){try{jsonpatch['apply'](_0x306acb,_0x4a2922,!![]);}catch(_0x21ef16){return BPromise[_0x6791('0x1f')](_0x21ef16);}return _0x306acb['save']();};}function saveUpdates(_0x17f200,_0x309610){return function(_0x15b9ab){if(_0x15b9ab){return _0x15b9ab[_0x6791('0x20')](_0x17f200)['then'](function(_0x3e17b3){return _0x3e17b3;});}return null;};}function removeEntity(_0x1b516d,_0x4a8717){return function(_0x53bb44){if(_0x53bb44){return _0x53bb44['destroy']()[_0x6791('0x21')](function(){var _0x502043=_0x53bb44[_0x6791('0x22')]({'plain':!![]});var _0x5409f1='ContactItemTypes';return db['UserProfileResource'][_0x6791('0x23')]({'where':{'type':_0x5409f1,'resourceId':_0x502043['id']}})[_0x6791('0x21')](function(){return _0x53bb44;});})[_0x6791('0x21')](function(){_0x1b516d['status'](0xcc)[_0x6791('0x24')]();});}};}function handleEntityNotFound(_0x30cc17,_0x493a59){return function(_0x342107){if(!_0x342107){_0x30cc17['sendStatus'](0x194);}return _0x342107;};}function handleError(_0x424b0e,_0x49dd24){_0x49dd24=_0x49dd24||0x1f4;return function(_0x4fc5d5){logger[_0x6791('0x25')](_0x4fc5d5['stack']);if(_0x4fc5d5[_0x6791('0x26')]){delete _0x4fc5d5[_0x6791('0x26')];}_0x424b0e['status'](_0x49dd24)[_0x6791('0x27')](_0x4fc5d5);};}exports[_0x6791('0x28')]=function(_0x234c5e,_0xd36448){var _0x5d9d54={},_0x4f91d6={},_0x348b9c={'count':0x0,'rows':[]};var _0x5e5ac3=_[_0x6791('0x29')](db[_0x6791('0x2a')][_0x6791('0x2b')],function(_0x2b98b8){return{'name':_0x2b98b8[_0x6791('0x2c')],'type':_0x2b98b8[_0x6791('0x2d')][_0x6791('0x2e')]};});_0x4f91d6[_0x6791('0x2f')]=_[_0x6791('0x29')](_0x5e5ac3,_0x6791('0x26'));_0x4f91d6['query']=_[_0x6791('0x30')](_0x234c5e[_0x6791('0x31')]);_0x4f91d6[_0x6791('0x32')]=_[_0x6791('0x33')](_0x4f91d6[_0x6791('0x2f')],_0x4f91d6[_0x6791('0x31')]);_0x5d9d54['attributes']=_['intersection'](_0x4f91d6['model'],qs[_0x6791('0x34')](_0x234c5e[_0x6791('0x31')][_0x6791('0x34')]));_0x5d9d54['attributes']=_0x5d9d54['attributes'][_0x6791('0x35')]?_0x5d9d54[_0x6791('0x36')]:_0x4f91d6[_0x6791('0x2f')];if(!_0x234c5e[_0x6791('0x31')]['hasOwnProperty'](_0x6791('0x37'))){_0x5d9d54[_0x6791('0x1a')]=qs[_0x6791('0x1a')](_0x234c5e['query'][_0x6791('0x1a')]);_0x5d9d54['offset']=qs['offset'](_0x234c5e[_0x6791('0x31')][_0x6791('0x1c')]);}_0x5d9d54['order']=qs[_0x6791('0x38')](_0x234c5e[_0x6791('0x31')][_0x6791('0x38')]);_0x5d9d54[_0x6791('0x39')]=qs[_0x6791('0x32')](_['pick'](_0x234c5e[_0x6791('0x31')],_0x4f91d6[_0x6791('0x32')]),_0x5e5ac3);if(_0x234c5e[_0x6791('0x31')]['filter']){_0x5d9d54[_0x6791('0x39')]=_[_0x6791('0x3a')](_0x5d9d54[_0x6791('0x39')],{'$or':_['map'](_0x5e5ac3,function(_0x11a012){if(_0x11a012[_0x6791('0x2d')]!==_0x6791('0x3b')){var _0x122aa5={};_0x122aa5[_0x11a012['name']]={'$like':'%'+_0x234c5e[_0x6791('0x31')][_0x6791('0x3c')]+'%'};return _0x122aa5;}})});}_0x5d9d54=_[_0x6791('0x3a')]({},_0x5d9d54,_0x234c5e[_0x6791('0x3d')]);var _0x12f121={'where':_0x5d9d54[_0x6791('0x39')]};return db[_0x6791('0x2a')][_0x6791('0x1b')](_0x12f121)[_0x6791('0x21')](function(_0x4e4004){_0x348b9c['count']=_0x4e4004;if(_0x234c5e[_0x6791('0x31')][_0x6791('0x3e')]){_0x5d9d54['include']=[{'all':!![]}];}return db[_0x6791('0x2a')][_0x6791('0x3f')](_0x5d9d54);})[_0x6791('0x21')](function(_0x3edb86){_0x348b9c[_0x6791('0x40')]=_0x3edb86;return _0x348b9c;})[_0x6791('0x21')](respondWithFilteredResult(_0xd36448,_0x5d9d54))[_0x6791('0x41')](handleError(_0xd36448,null));};exports['show']=function(_0xb3bea8,_0x4b9fca){var _0x17ecf0={'raw':!![],'where':{'id':_0xb3bea8[_0x6791('0x42')]['id']}},_0xfc170e={};_0xfc170e[_0x6791('0x2f')]=_['keys'](db[_0x6791('0x2a')][_0x6791('0x2b')]);_0xfc170e[_0x6791('0x31')]=_[_0x6791('0x30')](_0xb3bea8[_0x6791('0x31')]);_0xfc170e[_0x6791('0x32')]=_[_0x6791('0x33')](_0xfc170e[_0x6791('0x2f')],_0xfc170e['query']);_0x17ecf0[_0x6791('0x36')]=_[_0x6791('0x33')](_0xfc170e[_0x6791('0x2f')],qs[_0x6791('0x34')](_0xb3bea8['query'][_0x6791('0x34')]));_0x17ecf0[_0x6791('0x36')]=_0x17ecf0['attributes'][_0x6791('0x35')]?_0x17ecf0['attributes']:_0xfc170e[_0x6791('0x2f')];if(_0xb3bea8[_0x6791('0x31')][_0x6791('0x3e')]){_0x17ecf0[_0x6791('0x43')]=[{'all':!![]}];}_0x17ecf0=_[_0x6791('0x3a')]({},_0x17ecf0,_0xb3bea8[_0x6791('0x3d')]);return db[_0x6791('0x2a')][_0x6791('0x44')](_0x17ecf0)[_0x6791('0x21')](handleEntityNotFound(_0x4b9fca,null))['then'](respondWithResult(_0x4b9fca,null))[_0x6791('0x41')](handleError(_0x4b9fca,null));};exports['create']=function(_0x10e806,_0x2bb86a){return db[_0x6791('0x2a')][_0x6791('0x45')](_0x10e806[_0x6791('0x46')],{})['then'](function(_0x2bc08d){var _0x35e087=_0x10e806[_0x6791('0x47')][_0x6791('0x22')]({'plain':!![]});if(!_0x35e087)throw new Error(_0x6791('0x48'));if(_0x35e087['role']===_0x6791('0x47')){var _0x42948b=_0x2bc08d['get']({'plain':!![]});var _0x3df699='ContactItemTypes';return db[_0x6791('0x49')][_0x6791('0x44')]({'where':{'name':_0x3df699,'userProfileId':_0x35e087[_0x6791('0x4a')]},'raw':!![]})[_0x6791('0x21')](function(_0x558069){if(_0x558069&&_0x558069[_0x6791('0x4b')]===0x0){return db[_0x6791('0x4c')]['create']({'name':_0x42948b[_0x6791('0x26')],'resourceId':_0x42948b['id'],'type':_0x558069[_0x6791('0x26')],'sectionId':_0x558069['id']},{})[_0x6791('0x21')](function(){return _0x2bc08d;});}else{return _0x2bc08d;}})['catch'](function(_0x355e97){logger[_0x6791('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x355e97);throw _0x355e97;});}return _0x2bc08d;})[_0x6791('0x21')](respondWithResult(_0x2bb86a,0xc9))[_0x6791('0x41')](handleError(_0x2bb86a,null));};exports['update']=function(_0x169531,_0x216498){if(_0x169531[_0x6791('0x46')]['id']){delete _0x169531[_0x6791('0x46')]['id'];}return db['ContactItemType'][_0x6791('0x44')]({'where':{'id':_0x169531[_0x6791('0x42')]['id']}})[_0x6791('0x21')](handleEntityNotFound(_0x216498,null))['then'](saveUpdates(_0x169531['body'],null))[_0x6791('0x21')](respondWithResult(_0x216498,null))[_0x6791('0x41')](handleError(_0x216498,null));};exports[_0x6791('0x23')]=function(_0x45756f,_0x288f05){return db['ContactItemType']['find']({'where':{'id':_0x45756f[_0x6791('0x42')]['id']}})['then'](handleEntityNotFound(_0x288f05,null))['then'](db[_0x6791('0x4d')][_0x6791('0x20')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x45756f[_0x6791('0x42')]['id']}}))[_0x6791('0x21')](removeEntity(_0x288f05,null))[_0x6791('0x41')](handleError(_0x288f05,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index 78e14e0..ab3fc01 100644 --- a/server/api/contactItemType/contactItemType.model.js +++ b/server/api/contactItemType/contactItemType.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdd56=['api','moment','bluebird','request-promise','path','rimraf','./contactItemType.attributes','define','ContactItemType','tools_contact_item_types','lodash','util','../../config/logger'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xdd56,0x1b7));var _0x6dd5=function(_0x4692bf,_0x5b0ba7){_0x4692bf=_0x4692bf-0x0;var _0x514134=_0xdd56[_0x4692bf];return _0x514134;};'use strict';var _=require(_0x6dd5('0x0'));var util=require(_0x6dd5('0x1'));var logger=require(_0x6dd5('0x2'))(_0x6dd5('0x3'));var moment=require(_0x6dd5('0x4'));var BPromise=require(_0x6dd5('0x5'));var rp=require(_0x6dd5('0x6'));var fs=require('fs');var path=require(_0x6dd5('0x7'));var rimraf=require(_0x6dd5('0x8'));var config=require('../../config/environment');var attributes=require(_0x6dd5('0x9'));module['exports']=function(_0x4aefd0,_0x314cde){return _0x4aefd0[_0x6dd5('0xa')](_0x6dd5('0xb'),attributes,{'tableName':_0x6dd5('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x00c2=['./contactItemType.attributes','define','ContactItemType','tools_contact_item_types','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x91e6a3,_0x2183e0){var _0x5d195e=function(_0x274bdc){while(--_0x274bdc){_0x91e6a3['push'](_0x91e6a3['shift']());}};_0x5d195e(++_0x2183e0);}(_0x00c2,0x7c));var _0x200c=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x00c2[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x200c('0x0'));var util=require(_0x200c('0x1'));var logger=require(_0x200c('0x2'))(_0x200c('0x3'));var moment=require(_0x200c('0x4'));var BPromise=require(_0x200c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x200c('0x6'));var rimraf=require(_0x200c('0x7'));var config=require('../../config/environment');var attributes=require(_0x200c('0x8'));module['exports']=function(_0x2a5a0d,_0x49f2ed){return _0x2a5a0d[_0x200c('0x9')](_0x200c('0xa'),attributes,{'tableName':_0x200c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.rpc.js b/server/api/contactItemType/contactItemType.rpc.js index b5c1775..b74aa3c 100644 --- a/server/api/contactItemType/contactItemType.rpc.js +++ b/server/api/contactItemType/contactItemType.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x57f5=['stringify','error','code','message','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','ContactItemType,\x20%s,\x20%s','request\x20sent','ContactItemType,\x20%s,\x20%s,\x20%s'];(function(_0x12a880,_0x2e8fc2){var _0x12967d=function(_0x4e9f8b){while(--_0x4e9f8b){_0x12a880['push'](_0x12a880['shift']());}};_0x12967d(++_0x2e8fc2);}(_0x57f5,0x1e7));var _0x557f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x57f5[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x557f('0x0'));var moment=require(_0x557f('0x1'));var BPromise=require(_0x557f('0x2'));var rs=require(_0x557f('0x3'));var fs=require('fs');var Redis=require(_0x557f('0x4'));var db=require(_0x557f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x557f('0x6'))(_0x557f('0x7'));var config=require(_0x557f('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x557f('0x9')][_0x557f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x57a024,_0x50fcee,_0x2fa740){return new BPromise(function(_0x154e12,_0x29f588){return client[_0x557f('0xb')](_0x57a024,_0x2fa740)[_0x557f('0xc')](function(_0x481b45){logger[_0x557f('0xd')](_0x557f('0xe'),_0x50fcee,_0x557f('0xf'));logger['debug'](_0x557f('0x10'),_0x50fcee,_0x557f('0xf'),JSON[_0x557f('0x11')](_0x481b45));if(_0x481b45[_0x557f('0x12')]){if(_0x481b45[_0x557f('0x12')][_0x557f('0x13')]===0x1f4){logger[_0x557f('0x12')](_0x557f('0xe'),_0x50fcee,_0x481b45['error'][_0x557f('0x14')]);return _0x29f588(_0x481b45['error'][_0x557f('0x14')]);}logger[_0x557f('0x12')](_0x557f('0xe'),_0x50fcee,_0x481b45[_0x557f('0x12')]['message']);return _0x154e12(_0x481b45['error'][_0x557f('0x14')]);}else{logger[_0x557f('0xd')](_0x557f('0xe'),_0x50fcee,'request\x20sent');_0x154e12(_0x481b45['result'][_0x557f('0x14')]);}})['catch'](function(_0x4a9c04){logger[_0x557f('0x12')](_0x557f('0xe'),_0x50fcee,_0x4a9c04);_0x29f588(_0x4a9c04);});});} \ No newline at end of file +var _0xb2ef=['http','request','then','info','ContactItemType,\x20%s,\x20%s','request\x20sent','ContactItemType,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client'];(function(_0x1a4a78,_0x1190a6){var _0x315029=function(_0xf83a4c){while(--_0xf83a4c){_0x1a4a78['push'](_0x1a4a78['shift']());}};_0x315029(++_0x1190a6);}(_0xb2ef,0x7b));var _0xfb2e=function(_0x932300,_0x35a7b6){_0x932300=_0x932300-0x0;var _0x390db3=_0xb2ef[_0x932300];return _0x390db3;};'use strict';var _=require(_0xfb2e('0x0'));var util=require(_0xfb2e('0x1'));var moment=require('moment');var BPromise=require(_0xfb2e('0x2'));var rs=require(_0xfb2e('0x3'));var fs=require('fs');var Redis=require(_0xfb2e('0x4'));var db=require(_0xfb2e('0x5'))['db'];var utils=require(_0xfb2e('0x6'));var logger=require(_0xfb2e('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xfb2e('0x8')][_0xfb2e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x478335,_0x4ba089,_0x52b158){return new BPromise(function(_0x8ad8ef,_0x26ffb9){return client[_0xfb2e('0xa')](_0x478335,_0x52b158)[_0xfb2e('0xb')](function(_0xeee487){logger[_0xfb2e('0xc')](_0xfb2e('0xd'),_0x4ba089,_0xfb2e('0xe'));logger['debug'](_0xfb2e('0xf'),_0x4ba089,_0xfb2e('0xe'),JSON[_0xfb2e('0x10')](_0xeee487));if(_0xeee487[_0xfb2e('0x11')]){if(_0xeee487[_0xfb2e('0x11')][_0xfb2e('0x12')]===0x1f4){logger[_0xfb2e('0x11')]('ContactItemType,\x20%s,\x20%s',_0x4ba089,_0xeee487[_0xfb2e('0x11')][_0xfb2e('0x13')]);return _0x26ffb9(_0xeee487['error'][_0xfb2e('0x13')]);}logger['error']('ContactItemType,\x20%s,\x20%s',_0x4ba089,_0xeee487[_0xfb2e('0x11')]['message']);return _0x8ad8ef(_0xeee487['error'][_0xfb2e('0x13')]);}else{logger[_0xfb2e('0xc')]('ContactItemType,\x20%s,\x20%s',_0x4ba089,_0xfb2e('0xe'));_0x8ad8ef(_0xeee487[_0xfb2e('0x14')][_0xfb2e('0x13')]);}})[_0xfb2e('0x15')](function(_0x47c181){logger[_0xfb2e('0x11')](_0xfb2e('0xd'),_0x4ba089,_0x47c181);_0x26ffb9(_0x47c181);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index 51bac66..0ae8e4c 100644 --- a/server/api/contactItemType/index.js +++ b/server/api/contactItemType/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb4eb=['fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','express'];(function(_0x1d1d64,_0x5497b5){var _0x23b1d3=function(_0x3fc949){while(--_0x3fc949){_0x1d1d64['push'](_0x1d1d64['shift']());}};_0x23b1d3(++_0x5497b5);}(_0xb4eb,0x152));var _0xbb4e=function(_0x481784,_0x5cb506){_0x481784=_0x481784-0x0;var _0x92d05e=_0xb4eb[_0x481784];return _0x92d05e;};'use strict';var multer=require(_0xbb4e('0x0'));var util=require(_0xbb4e('0x1'));var path=require(_0xbb4e('0x2'));var timeout=require('connect-timeout');var express=require(_0xbb4e('0x3'));var router=express['Router']();var fs_extra=require(_0xbb4e('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xbb4e('0x5'));var config=require(_0xbb4e('0x6'));var controller=require('./contactItemType.controller');router[_0xbb4e('0x7')]('/',auth[_0xbb4e('0x8')](),controller[_0xbb4e('0x9')]);router[_0xbb4e('0x7')](_0xbb4e('0xa'),auth[_0xbb4e('0x8')](),controller[_0xbb4e('0xb')]);router[_0xbb4e('0xc')]('/',auth['isAuthenticated'](),controller[_0xbb4e('0xd')]);router[_0xbb4e('0xe')](_0xbb4e('0xa'),auth[_0xbb4e('0x8')](),controller[_0xbb4e('0xf')]);router[_0xbb4e('0x10')](_0xbb4e('0xa'),auth[_0xbb4e('0x8')](),controller[_0xbb4e('0x11')]);module[_0xbb4e('0x12')]=router; \ No newline at end of file +var _0x418b=['../../config/environment','./contactItemType.controller','get','index','/:id','isAuthenticated','show','post','create','put','update','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x7bc9bd,_0x485c9d){var _0x68fe14=function(_0x220479){while(--_0x220479){_0x7bc9bd['push'](_0x7bc9bd['shift']());}};_0x68fe14(++_0x485c9d);}(_0x418b,0x1e7));var _0xb418=function(_0x39f5fa,_0x26a39f){_0x39f5fa=_0x39f5fa-0x0;var _0x1ac658=_0x418b[_0x39f5fa];return _0x1ac658;};'use strict';var multer=require(_0xb418('0x0'));var util=require(_0xb418('0x1'));var path=require('path');var timeout=require(_0xb418('0x2'));var express=require(_0xb418('0x3'));var router=express['Router']();var fs_extra=require(_0xb418('0x4'));var auth=require(_0xb418('0x5'));var interaction=require(_0xb418('0x6'));var config=require(_0xb418('0x7'));var controller=require(_0xb418('0x8'));router[_0xb418('0x9')]('/',auth['isAuthenticated'](),controller[_0xb418('0xa')]);router[_0xb418('0x9')](_0xb418('0xb'),auth[_0xb418('0xc')](),controller[_0xb418('0xd')]);router[_0xb418('0xe')]('/',auth[_0xb418('0xc')](),controller[_0xb418('0xf')]);router[_0xb418('0x10')](_0xb418('0xb'),auth[_0xb418('0xc')](),controller[_0xb418('0x11')]);router['delete'](_0xb418('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0xb418('0x12')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index 1ed325e..7621b60 100644 --- a/server/api/dashboard/dashboard.attributes.js +++ b/server/api/dashboard/dashboard.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['name','sequelize','STRING'];(function(_0x1d1cf4,_0x49bad5){var _0x3cf6a9=function(_0x2c1391){while(--_0x2c1391){_0x1d1cf4['push'](_0x1d1cf4['shift']());}};_0x3cf6a9(++_0x49bad5);}(_0xb10b,0x12a));var _0xbb10=function(_0x16e5b3,_0x30d91d){_0x16e5b3=_0x16e5b3-0x0;var _0x4d6874=_0xb10b[_0x16e5b3];return _0x4d6874;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'name':{'type':Sequelize[_0xbb10('0x1')],'allowNull':![],'unique':_0xbb10('0x2')},'description':{'type':Sequelize[_0xbb10('0x1')]}}; \ No newline at end of file +var _0xb7e7=['STRING','sequelize'];(function(_0x456fb1,_0x859a1d){var _0x4083d6=function(_0xe1d0f2){while(--_0xe1d0f2){_0x456fb1['push'](_0x456fb1['shift']());}};_0x4083d6(++_0x859a1d);}(_0xb7e7,0x121));var _0x7b7e=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0xb7e7[_0x49ca18];return _0x145d54;};'use strict';var Sequelize=require(_0x7b7e('0x0'));module['exports']={'name':{'type':Sequelize[_0x7b7e('0x1')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0x7b7e('0x1')]}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index 933fa23..ecd8415 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 _0x3264=['params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','includeAll','omit','createdAt','updatedAt','autoAssociation','UserProfileResource','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrFaxAccounts','attrWhatsappAccounts','web-report','attrReport','attrRefresh','addItem','DashboardId','DashboardItem','getItems','findOne','order','pick','nolimit','eml-format','rimraf','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','jsforce','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./dashboard.socket','register','sendStatus','status','end','json','offset','limit','count','Content-Range','apply','reject','save','update','then','get','CustomDashboards','destroy','error','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','sort','where','filter','merge','VIRTUAL','options','Dashboard','include','findAll','rows','catch'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3264,0x1b7));var _0x4326=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0x3264[_0x18ab2a];return _0x16dcee;};'use strict';var emlformat=require(_0x4326('0x0'));var rimraf=require(_0x4326('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x4326('0x2'));var moment=require(_0x4326('0x3'));var BPromise=require(_0x4326('0x4'));var Mustache=require(_0x4326('0x5'));var util=require('util');var path=require(_0x4326('0x6'));var sox=require(_0x4326('0x7'));var csv=require(_0x4326('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4326('0x9'));var squel=require(_0x4326('0xa'));var crypto=require('crypto');var jsforce=require(_0x4326('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x4326('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x4326('0xc'));var qs=require(_0x4326('0xd'));var as=require(_0x4326('0xe'));var hardwareService=require(_0x4326('0xf'));var logger=require('../../config/logger')('api');var utils=require(_0x4326('0x10'));var config=require(_0x4326('0x11'));var licenseUtil=require(_0x4326('0x12'));var db=require(_0x4326('0x13'))['db'];config[_0x4326('0x14')]=_[_0x4326('0x15')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x4326('0x16'))(new Redis(config[_0x4326('0x14')]));require(_0x4326('0x17'))[_0x4326('0x18')](socket);function respondWithStatusCode(_0x3ecec1,_0x547ea5){_0x547ea5=_0x547ea5||0xcc;return function(_0x12eee0){if(_0x12eee0){return _0x3ecec1[_0x4326('0x19')](_0x547ea5);}return _0x3ecec1[_0x4326('0x1a')](_0x547ea5)[_0x4326('0x1b')]();};}function respondWithResult(_0x3e3593,_0x54c7f2){_0x54c7f2=_0x54c7f2||0xc8;return function(_0x14acf2){if(_0x14acf2){return _0x3e3593['status'](_0x54c7f2)[_0x4326('0x1c')](_0x14acf2);}};}function respondWithFilteredResult(_0x28a9a6,_0x1ffefa){return function(_0x270b3e){if(_0x270b3e){var _0x2698cc=typeof _0x1ffefa[_0x4326('0x1d')]==='undefined'&&typeof _0x1ffefa[_0x4326('0x1e')]==='undefined';var _0x40b1ea=_0x270b3e[_0x4326('0x1f')];var _0x1613c5=_0x2698cc?0x0:_0x1ffefa[_0x4326('0x1d')];var _0x1272b3=_0x2698cc?_0x270b3e[_0x4326('0x1f')]:_0x1ffefa[_0x4326('0x1d')]+_0x1ffefa[_0x4326('0x1e')];var _0x1558d2;if(_0x1272b3>=_0x40b1ea){_0x1272b3=_0x40b1ea;_0x1558d2=0xc8;}else{_0x1558d2=0xce;}_0x28a9a6['status'](_0x1558d2);return _0x28a9a6['set'](_0x4326('0x20'),_0x1613c5+'-'+_0x1272b3+'/'+_0x40b1ea)[_0x4326('0x1c')](_0x270b3e);}return null;};}function patchUpdates(_0x351634){return function(_0x51d8fa){try{jsonpatch[_0x4326('0x21')](_0x51d8fa,_0x351634,!![]);}catch(_0x4df144){return BPromise[_0x4326('0x22')](_0x4df144);}return _0x51d8fa[_0x4326('0x23')]();};}function saveUpdates(_0x553cc6,_0x25162e){return function(_0x373501){if(_0x373501){return _0x373501[_0x4326('0x24')](_0x553cc6)[_0x4326('0x25')](function(_0x2937c4){return _0x2937c4;});}return null;};}function removeEntity(_0x4f6318,_0x11c4c5){return function(_0x4d41dd){if(_0x4d41dd){return _0x4d41dd['destroy']()[_0x4326('0x25')](function(){var _0x21403b=_0x4d41dd[_0x4326('0x26')]({'plain':!![]});var _0xb9f6d3=_0x4326('0x27');return db['UserProfileResource'][_0x4326('0x28')]({'where':{'type':_0xb9f6d3,'resourceId':_0x21403b['id']}})['then'](function(){return _0x4d41dd;});})[_0x4326('0x25')](function(){_0x4f6318[_0x4326('0x1a')](0xcc)[_0x4326('0x1b')]();});}};}function handleEntityNotFound(_0x3f07ca,_0x146439){return function(_0x1a8441){if(!_0x1a8441){_0x3f07ca['sendStatus'](0x194);}return _0x1a8441;};}function handleError(_0x4c2eac,_0x80f211){_0x80f211=_0x80f211||0x1f4;return function(_0x2419d7){logger[_0x4326('0x29')](_0x2419d7['stack']);if(_0x2419d7[_0x4326('0x2a')]){delete _0x2419d7[_0x4326('0x2a')];}_0x4c2eac[_0x4326('0x1a')](_0x80f211)[_0x4326('0x2b')](_0x2419d7);};}exports['index']=function(_0x61ce3a,_0x15fa58){var _0x3a448f={},_0x5f1150={},_0x54c384={'count':0x0,'rows':[]};var _0x4bc537=_[_0x4326('0x2c')](db['Dashboard'][_0x4326('0x2d')],function(_0x4da22c){return{'name':_0x4da22c[_0x4326('0x2e')],'type':_0x4da22c[_0x4326('0x2f')][_0x4326('0x30')]};});_0x5f1150[_0x4326('0x31')]=_[_0x4326('0x2c')](_0x4bc537,_0x4326('0x2a'));_0x5f1150[_0x4326('0x32')]=_[_0x4326('0x33')](_0x61ce3a[_0x4326('0x32')]);_0x5f1150[_0x4326('0x34')]=_[_0x4326('0x35')](_0x5f1150[_0x4326('0x31')],_0x5f1150[_0x4326('0x32')]);_0x3a448f['attributes']=_[_0x4326('0x35')](_0x5f1150['model'],qs[_0x4326('0x36')](_0x61ce3a[_0x4326('0x32')][_0x4326('0x36')]));_0x3a448f[_0x4326('0x37')]=_0x3a448f[_0x4326('0x37')][_0x4326('0x38')]?_0x3a448f['attributes']:_0x5f1150[_0x4326('0x31')];if(!_0x61ce3a[_0x4326('0x32')][_0x4326('0x39')]('nolimit')){_0x3a448f[_0x4326('0x1e')]=qs['limit'](_0x61ce3a['query'][_0x4326('0x1e')]);_0x3a448f[_0x4326('0x1d')]=qs[_0x4326('0x1d')](_0x61ce3a[_0x4326('0x32')]['offset']);}_0x3a448f['order']=qs[_0x4326('0x3a')](_0x61ce3a[_0x4326('0x32')]['sort']);_0x3a448f[_0x4326('0x3b')]=qs['filters'](_['pick'](_0x61ce3a[_0x4326('0x32')],_0x5f1150['filters']),_0x4bc537);if(_0x61ce3a[_0x4326('0x32')][_0x4326('0x3c')]){_0x3a448f[_0x4326('0x3b')]=_[_0x4326('0x3d')](_0x3a448f[_0x4326('0x3b')],{'$or':_[_0x4326('0x2c')](_0x4bc537,function(_0x3f3d57){if(_0x3f3d57[_0x4326('0x2f')]!==_0x4326('0x3e')){var _0x4de72a={};_0x4de72a[_0x3f3d57[_0x4326('0x2a')]]={'$like':'%'+_0x61ce3a['query'][_0x4326('0x3c')]+'%'};return _0x4de72a;}})});}_0x3a448f=_[_0x4326('0x3d')]({},_0x3a448f,_0x61ce3a[_0x4326('0x3f')]);var _0x2eae8c={'where':_0x3a448f[_0x4326('0x3b')]};return db[_0x4326('0x40')][_0x4326('0x1f')](_0x2eae8c)[_0x4326('0x25')](function(_0xa48151){_0x54c384[_0x4326('0x1f')]=_0xa48151;if(_0x61ce3a[_0x4326('0x32')]['includeAll']){_0x3a448f[_0x4326('0x41')]=[{'all':!![]}];}return db[_0x4326('0x40')][_0x4326('0x42')](_0x3a448f);})[_0x4326('0x25')](function(_0x566b0e){_0x54c384[_0x4326('0x43')]=_0x566b0e;return _0x54c384;})[_0x4326('0x25')](respondWithFilteredResult(_0x15fa58,_0x3a448f))[_0x4326('0x44')](handleError(_0x15fa58,null));};exports['show']=function(_0x187b73,_0x3b9489){var _0x5bff33={'raw':![],'where':{'id':_0x187b73[_0x4326('0x45')]['id']}},_0x44cdaa={};_0x44cdaa['model']=_[_0x4326('0x33')](db[_0x4326('0x40')][_0x4326('0x2d')]);_0x44cdaa[_0x4326('0x32')]=_[_0x4326('0x33')](_0x187b73['query']);_0x44cdaa['filters']=_[_0x4326('0x35')](_0x44cdaa[_0x4326('0x31')],_0x44cdaa['query']);_0x5bff33[_0x4326('0x37')]=_['intersection'](_0x44cdaa[_0x4326('0x31')],qs[_0x4326('0x36')](_0x187b73[_0x4326('0x32')]['fields']));_0x5bff33[_0x4326('0x37')]=_0x5bff33['attributes'][_0x4326('0x38')]?_0x5bff33[_0x4326('0x37')]:_0x44cdaa[_0x4326('0x31')];if(_0x187b73[_0x4326('0x32')]['includeAll']){_0x5bff33[_0x4326('0x41')]=[{'all':!![]}];}_0x5bff33=_[_0x4326('0x3d')]({},_0x5bff33,_0x187b73[_0x4326('0x3f')]);return db[_0x4326('0x40')][_0x4326('0x46')](_0x5bff33)['then'](handleEntityNotFound(_0x3b9489,null))[_0x4326('0x25')](respondWithResult(_0x3b9489,null))['catch'](handleError(_0x3b9489,null));};exports[_0x4326('0x47')]=function(_0x24693a,_0x2d71eb){return db[_0x4326('0x40')]['create'](_0x24693a[_0x4326('0x48')],{})[_0x4326('0x25')](function(_0x3ceb1c){var _0x29463f=_0x24693a[_0x4326('0x49')][_0x4326('0x26')]({'plain':!![]});if(!_0x29463f)throw new Error(_0x4326('0x4a'));if(_0x29463f[_0x4326('0x4b')]===_0x4326('0x49')){var _0x3ce5e3=_0x3ceb1c[_0x4326('0x26')]({'plain':!![]});var _0x54f7b4=_0x4326('0x27');return db[_0x4326('0x4c')][_0x4326('0x46')]({'where':{'name':_0x54f7b4,'userProfileId':_0x29463f[_0x4326('0x4d')]},'raw':!![]})[_0x4326('0x25')](function(_0x31f4f7){if(_0x31f4f7&&_0x31f4f7['autoAssociation']===0x0){return db['UserProfileResource'][_0x4326('0x47')]({'name':_0x3ce5e3[_0x4326('0x2a')],'resourceId':_0x3ce5e3['id'],'type':_0x31f4f7[_0x4326('0x2a')],'sectionId':_0x31f4f7['id']},{})[_0x4326('0x25')](function(){return _0x3ceb1c;});}else{return _0x3ceb1c;}})['catch'](function(_0x5e1164){logger[_0x4326('0x29')](_0x4326('0x4e'),_0x5e1164);throw _0x5e1164;});}return _0x3ceb1c;})[_0x4326('0x25')](respondWithResult(_0x2d71eb,0xc9))[_0x4326('0x44')](handleError(_0x2d71eb,null));};exports[_0x4326('0x4f')]=function(_0x5ac69e,_0x4c3325){var _0x4bd941={'where':{'id':_0x5ac69e['params']['id']}},_0x536ea0={};_0x536ea0['model']=_[_0x4326('0x33')](db[_0x4326('0x40')][_0x4326('0x2d')]);_0x4bd941['attributes']=_['intersection'](_0x536ea0[_0x4326('0x31')],qs[_0x4326('0x36')](_0x5ac69e[_0x4326('0x32')][_0x4326('0x36')]));_0x4bd941['attributes']=_0x4bd941['attributes'][_0x4326('0x38')]?_0x4bd941[_0x4326('0x37')]:_0x536ea0['model'];if(_0x5ac69e[_0x4326('0x32')][_0x4326('0x50')]){_0x4bd941['include']=[{'all':!![]}];}_0x4bd941=_[_0x4326('0x3d')]({},_0x4bd941,_0x5ac69e[_0x4326('0x3f')]);return db[_0x4326('0x40')][_0x4326('0x46')](_0x4bd941)[_0x4326('0x25')](handleEntityNotFound(_0x4c3325,null))[_0x4326('0x25')](function(_0x778e2c){if(_0x778e2c){var _0x14f1e5=_0x778e2c[_0x4326('0x26')]({'plain':!![]});_0x14f1e5=qs[_0x4326('0x51')](_0x14f1e5,['id',_0x4326('0x52'),_0x4326('0x53')]);_0x5ac69e['body']=_['omit'](_0x5ac69e[_0x4326('0x48')],['id',_0x4326('0x52'),_0x4326('0x53')]);return db[_0x4326('0x40')][_0x4326('0x47')](_['merge'](_0x14f1e5,_0x5ac69e[_0x4326('0x48')]),{'include':_0x5ac69e[_0x4326('0x32')][_0x4326('0x50')]?[{'all':!![]}]:undefined})[_0x4326('0x25')](function(_0x3f7895){var _0x26fcb7=_0x5ac69e[_0x4326('0x49')]['get']({'plain':!![]});if(!_0x26fcb7)throw new Error(_0x4326('0x4a'));if(_0x26fcb7[_0x4326('0x4b')]===_0x4326('0x49')){var _0xf7eda8=_0x3f7895[_0x4326('0x26')]({'plain':!![]});var _0x471b36=_0x4326('0x27');return db[_0x4326('0x4c')][_0x4326('0x46')]({'where':{'name':_0x471b36,'userProfileId':_0x26fcb7['userProfileId']},'raw':!![]})[_0x4326('0x25')](function(_0x296f11){if(_0x296f11&&_0x296f11[_0x4326('0x54')]===0x0){return db[_0x4326('0x55')][_0x4326('0x47')]({'name':_0xf7eda8[_0x4326('0x2a')],'resourceId':_0xf7eda8['id'],'type':_0x296f11['name'],'sectionId':_0x296f11['id']},{})['then'](function(){return _0x3f7895;});}else{return _0x3f7895;}})['catch'](function(_0x32afca){logger['error'](_0x4326('0x4e'),_0x32afca);throw _0x32afca;});}return _0x3f7895;});}})[_0x4326('0x25')](respondWithResult(_0x4c3325,0xc9))[_0x4326('0x44')](handleError(_0x4c3325,null));};exports[_0x4326('0x24')]=function(_0xf28bc1,_0x4c9e6d){if(_0xf28bc1['body']['id']){delete _0xf28bc1[_0x4326('0x48')]['id'];}return db[_0x4326('0x40')]['find']({'where':{'id':_0xf28bc1[_0x4326('0x45')]['id']}})[_0x4326('0x25')](handleEntityNotFound(_0x4c9e6d,null))[_0x4326('0x25')](saveUpdates(_0xf28bc1[_0x4326('0x48')],null))['then'](respondWithResult(_0x4c9e6d,null))[_0x4326('0x44')](handleError(_0x4c9e6d,null));};exports[_0x4326('0x28')]=function(_0x599246,_0x4e9afe){return db['Dashboard'][_0x4326('0x46')]({'where':{'id':_0x599246[_0x4326('0x45')]['id']}})[_0x4326('0x25')](handleEntityNotFound(_0x4e9afe,null))['then'](removeEntity(_0x4e9afe,null))['catch'](handleError(_0x4e9afe,null));};function widgetAttributes(_0x139ff4){try{switch(_0x139ff4[_0x4326('0x2f')]){case _0x4326('0x56'):return[{'name':_0x4326('0x57'),'value':_0x139ff4[_0x4326('0x57')]||(_0x139ff4[_0x4326('0x58')]&&_0x139ff4[_0x4326('0x58')][0x0]?_0x139ff4[_0x4326('0x58')][0x0][_0x4326('0x59')]:undefined)||_0x4326('0x5a')}];case _0x4326('0x5b'):return[{'name':_0x4326('0x5c'),'value':_0x139ff4[_0x4326('0x5c')]||(_0x139ff4[_0x4326('0x58')]&&_0x139ff4[_0x4326('0x58')][0x0]?_0x139ff4['attrs'][0x0]['value']:undefined)||''}];case _0x4326('0x5d'):return[{'name':_0x4326('0x5e'),'value':_0x139ff4[_0x4326('0x5e')]||(_0x139ff4[_0x4326('0x58')]&&_0x139ff4[_0x4326('0x58')][0x0]?_0x139ff4[_0x4326('0x58')][0x0][_0x4326('0x59')]:undefined)||_0x4326('0x5f')},{'name':_0x4326('0x60'),'value':_0x139ff4[_0x4326('0x60')]||(_0x139ff4[_0x4326('0x58')]&&_0x139ff4[_0x4326('0x58')][0x1]?_0x139ff4[_0x4326('0x58')][0x1]['value']:undefined)||_0x4326('0x61')},{'name':'attrFontSize','value':_0x139ff4[_0x4326('0x62')]||(_0x139ff4['attrs']&&_0x139ff4[_0x4326('0x58')][0x2]?_0x139ff4[_0x4326('0x58')][0x2][_0x4326('0x59')]:undefined)||0xc}];case _0x4326('0x63'):return[{'name':_0x4326('0x64'),'value':_0x139ff4['attrMetric']||(_0x139ff4['attrs']&&_0x139ff4['attrs'][0x0]?_0x139ff4['attrs'][0x0][_0x4326('0x59')]:undefined)||_0x4326('0x65')},{'name':_0x4326('0x66'),'value':_0x139ff4[_0x4326('0x66')]||(_0x139ff4[_0x4326('0x58')]&&_0x139ff4[_0x4326('0x58')][0x1]?_0x139ff4[_0x4326('0x58')][0x1][_0x4326('0x59')]:undefined)||[]},{'name':'attrFontSize','value':_0x139ff4[_0x4326('0x62')]||(_0x139ff4['attrs']&&_0x139ff4['attrs'][0x2]?_0x139ff4[_0x4326('0x58')][0x2][_0x4326('0x59')]:undefined)||0x14},{'name':'attrChannel','value':_0x139ff4[_0x4326('0x67')]||(_0x139ff4['attrs']&&_0x139ff4[_0x4326('0x58')][0x3]?_0x139ff4[_0x4326('0x58')][0x3]['value']:undefined)||_0x4326('0x68')},{'name':_0x4326('0x69'),'value':_0x139ff4[_0x4326('0x69')]||(_0x139ff4[_0x4326('0x58')]&&_0x139ff4[_0x4326('0x58')][0x4]?_0x139ff4[_0x4326('0x58')][0x4][_0x4326('0x59')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x139ff4['attrFaxAccounts']||(_0x139ff4['attrs']&&_0x139ff4[_0x4326('0x58')][0x5]?_0x139ff4[_0x4326('0x58')][0x5][_0x4326('0x59')]:undefined)||''},{'name':_0x4326('0x6a'),'value':_0x139ff4[_0x4326('0x6a')]||(_0x139ff4['attrs']&&_0x139ff4[_0x4326('0x58')][0x6]?_0x139ff4[_0x4326('0x58')][0x6]['value']:undefined)||''},{'name':_0x4326('0x6b'),'value':_0x139ff4[_0x4326('0x6b')]||(_0x139ff4[_0x4326('0x58')]&&_0x139ff4['attrs'][0x7]?_0x139ff4['attrs'][0x7]['value']:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x139ff4['attrWhatsappAccounts']||(_0x139ff4[_0x4326('0x58')]&&_0x139ff4[_0x4326('0x58')][0x8]?_0x139ff4[_0x4326('0x58')][0x8][_0x4326('0x59')]:undefined)||''},{'name':_0x4326('0x6c'),'value':_0x139ff4[_0x4326('0x6c')]||(_0x139ff4[_0x4326('0x58')]&&_0x139ff4[_0x4326('0x58')][0x9]?_0x139ff4[_0x4326('0x58')][0x9][_0x4326('0x59')]:undefined)||''}];case _0x4326('0x6d'):case _0x4326('0x6e'):return[{'name':'attrSerie1','value':_0x139ff4[_0x4326('0x6f')]||(_0x139ff4[_0x4326('0x58')]&&_0x139ff4[_0x4326('0x58')][0x0]?_0x139ff4[_0x4326('0x58')][0x0][_0x4326('0x59')]:undefined)||'total'},{'name':_0x4326('0x70'),'value':_0x139ff4[_0x4326('0x70')]||(_0x139ff4[_0x4326('0x58')]&&_0x139ff4['attrs'][0x1]?_0x139ff4[_0x4326('0x58')][0x1][_0x4326('0x59')]:undefined)||null},{'name':_0x4326('0x71'),'value':_0x139ff4['attrSerie3']||(_0x139ff4[_0x4326('0x58')]&&_0x139ff4[_0x4326('0x58')][0x2]?_0x139ff4[_0x4326('0x58')][0x2]['value']:undefined)||null},{'name':'attrVoiceQueues','value':_0x139ff4['attrVoiceQueues']||(_0x139ff4[_0x4326('0x58')]&&_0x139ff4[_0x4326('0x58')][0x3]?_0x139ff4[_0x4326('0x58')][0x3][_0x4326('0x59')]:undefined)||[]},{'name':_0x4326('0x67'),'value':_0x139ff4[_0x4326('0x67')]||(_0x139ff4[_0x4326('0x58')]&&_0x139ff4[_0x4326('0x58')][0x4]?_0x139ff4[_0x4326('0x58')][0x4][_0x4326('0x59')]:undefined)||_0x4326('0x68')},{'name':'attrEmailAccounts','value':_0x139ff4[_0x4326('0x69')]||(_0x139ff4[_0x4326('0x58')]&&_0x139ff4['attrs'][0x5]?_0x139ff4['attrs'][0x5][_0x4326('0x59')]:undefined)||''},{'name':_0x4326('0x72'),'value':_0x139ff4[_0x4326('0x72')]||(_0x139ff4[_0x4326('0x58')]&&_0x139ff4['attrs'][0x6]?_0x139ff4[_0x4326('0x58')][0x6][_0x4326('0x59')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x139ff4[_0x4326('0x6a')]||(_0x139ff4[_0x4326('0x58')]&&_0x139ff4[_0x4326('0x58')][0x7]?_0x139ff4[_0x4326('0x58')][0x7][_0x4326('0x59')]:undefined)||''},{'name':_0x4326('0x6b'),'value':_0x139ff4[_0x4326('0x6b')]||(_0x139ff4[_0x4326('0x58')]&&_0x139ff4[_0x4326('0x58')][0x8]?_0x139ff4[_0x4326('0x58')][0x8][_0x4326('0x59')]:undefined)||''},{'name':_0x4326('0x73'),'value':_0x139ff4[_0x4326('0x73')]||(_0x139ff4['attrs']&&_0x139ff4[_0x4326('0x58')][0x9]?_0x139ff4[_0x4326('0x58')][0x9][_0x4326('0x59')]:undefined)||''},{'name':_0x4326('0x6c'),'value':_0x139ff4[_0x4326('0x6c')]||(_0x139ff4['attrs']&&_0x139ff4[_0x4326('0x58')][0xa]?_0x139ff4['attrs'][0xa][_0x4326('0x59')]:undefined)||''}];case _0x4326('0x74'):return[{'name':_0x4326('0x75'),'type':_0x139ff4['reportType']||(_0x139ff4[_0x4326('0x58')]&&_0x139ff4[_0x4326('0x58')][0x0]?_0x139ff4['attrs'][0x0]['type']:undefined)||null,'value':_0x139ff4['attrReport']||(_0x139ff4[_0x4326('0x58')]&&_0x139ff4['attrs'][0x0]?_0x139ff4[_0x4326('0x58')][0x0][_0x4326('0x59')]:undefined)||null},{'name':_0x4326('0x76'),'value':_0x139ff4['attrRefresh']||(_0x139ff4[_0x4326('0x58')]&&_0x139ff4[_0x4326('0x58')][0x1]?_0x139ff4['attrs'][0x1][_0x4326('0x59')]:undefined)||0x0}];default:return[];}}catch(_0x3d405c){logger['error']('widgetAttributes:\x20%s',JSON['stringify'](_0x3d405c));return[];}}exports[_0x4326('0x77')]=function(_0x1cba5e,_0x549bd8,_0x552c75){if(_0x1cba5e[_0x4326('0x48')]['id']){delete _0x1cba5e[_0x4326('0x48')]['id'];}return db['Dashboard'][_0x4326('0x46')]({'where':{'id':_0x1cba5e[_0x4326('0x45')]['id']}})['then'](handleEntityNotFound(_0x549bd8,null))[_0x4326('0x25')](function(_0x190d36){if(_0x190d36){_0x1cba5e[_0x4326('0x48')][_0x4326('0x78')]=_0x190d36['id'];_0x1cba5e['body']['attrs']=widgetAttributes(_0x1cba5e[_0x4326('0x48')]);return db[_0x4326('0x79')][_0x4326('0x47')](_0x1cba5e[_0x4326('0x48')]);}})[_0x4326('0x25')](respondWithResult(_0x549bd8,null))[_0x4326('0x44')](handleError(_0x549bd8,null));};exports[_0x4326('0x7a')]=function(_0x2bc2ff,_0x34e296,_0x42794a){var _0x2d0d48={};var _0x6cabe5={};var _0x171c1d;var _0x554566;return db[_0x4326('0x40')][_0x4326('0x7b')]({'where':{'id':_0x2bc2ff[_0x4326('0x45')]['id']}})['then'](handleEntityNotFound(_0x34e296,null))[_0x4326('0x25')](function(_0x564d18){if(_0x564d18){_0x171c1d=_0x564d18;_0x6cabe5['model']=_[_0x4326('0x33')](db['DashboardItem']['rawAttributes']);_0x6cabe5[_0x4326('0x32')]=_[_0x4326('0x33')](_0x2bc2ff[_0x4326('0x32')]);_0x6cabe5[_0x4326('0x34')]=_[_0x4326('0x35')](_0x6cabe5['model'],_0x6cabe5[_0x4326('0x32')]);_0x2d0d48['attributes']=_[_0x4326('0x35')](_0x6cabe5[_0x4326('0x31')],qs['fields'](_0x2bc2ff[_0x4326('0x32')]['fields']));_0x2d0d48[_0x4326('0x37')]=_0x2d0d48['attributes']['length']?_0x2d0d48[_0x4326('0x37')]:_0x6cabe5[_0x4326('0x31')];_0x2d0d48[_0x4326('0x7c')]=qs[_0x4326('0x3a')](_0x2bc2ff[_0x4326('0x32')][_0x4326('0x3a')]);_0x2d0d48[_0x4326('0x3b')]=qs['filters'](_[_0x4326('0x7d')](_0x2bc2ff[_0x4326('0x32')],_0x6cabe5[_0x4326('0x34')]));if(_0x2bc2ff[_0x4326('0x32')][_0x4326('0x3c')]){_0x2d0d48[_0x4326('0x3b')]=_[_0x4326('0x3d')](_0x2d0d48['where'],{'$or':_[_0x4326('0x2c')](_0x2d0d48[_0x4326('0x37')],function(_0x390ff4){var _0x4ad749={};_0x4ad749[_0x390ff4]={'$like':'%'+_0x2bc2ff[_0x4326('0x32')]['filter']+'%'};return _0x4ad749;})});}_0x2d0d48=_[_0x4326('0x3d')]({},_0x2d0d48,_0x2bc2ff[_0x4326('0x3f')]);return _0x171c1d['getItems'](_0x2d0d48);}})['then'](function(_0x2ea89c){if(_0x2ea89c){_0x554566=_0x2ea89c['length'];if(!_0x2bc2ff[_0x4326('0x32')][_0x4326('0x39')](_0x4326('0x7e'))){_0x2d0d48[_0x4326('0x1e')]=qs[_0x4326('0x1e')](_0x2bc2ff['query'][_0x4326('0x1e')]);_0x2d0d48[_0x4326('0x1d')]=qs['offset'](_0x2bc2ff[_0x4326('0x32')][_0x4326('0x1d')]);}return _0x171c1d['getItems'](_0x2d0d48);}})[_0x4326('0x25')](function(_0x45f94c){if(_0x45f94c){return _0x45f94c?{'count':_0x554566,'rows':_0x45f94c}:null;}})[_0x4326('0x25')](respondWithResult(_0x34e296,null))[_0x4326('0x44')](handleError(_0x34e296,null));}; \ No newline at end of file +var _0x6995=['findOne','getItems','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./dashboard.socket','register','sendStatus','end','offset','undefined','limit','count','status','set','json','reject','save','then','CustomDashboards','UserProfileResource','destroy','error','stack','name','index','map','rawAttributes','fieldName','query','keys','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','merge','type','filter','options','Dashboard','includeAll','include','findAll','rows','catch','show','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','omit','updatedAt','createdAt','iframe','attrUrl','attrs','https://','custom','attrPath','value','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','attrMetric','total','attrVoiceQueues','attrChannel','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrOpenchannelAccounts','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardId','DashboardItem'];(function(_0x367e5b,_0x5721e4){var _0x4b909e=function(_0x22c6a4){while(--_0x22c6a4){_0x367e5b['push'](_0x367e5b['shift']());}};_0x4b909e(++_0x5721e4);}(_0x6995,0x82));var _0x5699=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x6995[_0x4b369d];return _0x571a98;};'use strict';var emlformat=require(_0x5699('0x0'));var rimraf=require(_0x5699('0x1'));var zipdir=require(_0x5699('0x2'));var jsonpatch=require(_0x5699('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x5699('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x5699('0x5'));var sox=require(_0x5699('0x6'));var csv=require(_0x5699('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5699('0x8'));var _=require(_0x5699('0x9'));var squel=require(_0x5699('0xa'));var crypto=require(_0x5699('0xb'));var jsforce=require(_0x5699('0xc'));var deskjs=require(_0x5699('0xd'));var toCsv=require(_0x5699('0x7'));var querystring=require(_0x5699('0xe'));var Papa=require(_0x5699('0xf'));var Redis=require(_0x5699('0x10'));var authService=require(_0x5699('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x5699('0x12'));var hardwareService=require(_0x5699('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x5699('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x5699('0x15'));var db=require(_0x5699('0x16'))['db'];config['redis']=_['defaults'](config[_0x5699('0x17')],{'host':_0x5699('0x18'),'port':0x18eb});var socket=require(_0x5699('0x19'))(new Redis(config[_0x5699('0x17')]));require(_0x5699('0x1a'))[_0x5699('0x1b')](socket);function respondWithStatusCode(_0x453fd9,_0x2b17de){_0x2b17de=_0x2b17de||0xcc;return function(_0x2a5113){if(_0x2a5113){return _0x453fd9[_0x5699('0x1c')](_0x2b17de);}return _0x453fd9['status'](_0x2b17de)[_0x5699('0x1d')]();};}function respondWithResult(_0xbd508,_0x31c336){_0x31c336=_0x31c336||0xc8;return function(_0x1e9d54){if(_0x1e9d54){return _0xbd508['status'](_0x31c336)['json'](_0x1e9d54);}};}function respondWithFilteredResult(_0x4fe657,_0xb5a7f0){return function(_0x3abb86){if(_0x3abb86){var _0x5d47c8=typeof _0xb5a7f0[_0x5699('0x1e')]===_0x5699('0x1f')&&typeof _0xb5a7f0[_0x5699('0x20')]==='undefined';var _0x4804bc=_0x3abb86[_0x5699('0x21')];var _0x44dbf6=_0x5d47c8?0x0:_0xb5a7f0[_0x5699('0x1e')];var _0x146aab=_0x5d47c8?_0x3abb86[_0x5699('0x21')]:_0xb5a7f0[_0x5699('0x1e')]+_0xb5a7f0['limit'];var _0x2529b0;if(_0x146aab>=_0x4804bc){_0x146aab=_0x4804bc;_0x2529b0=0xc8;}else{_0x2529b0=0xce;}_0x4fe657[_0x5699('0x22')](_0x2529b0);return _0x4fe657[_0x5699('0x23')]('Content-Range',_0x44dbf6+'-'+_0x146aab+'/'+_0x4804bc)[_0x5699('0x24')](_0x3abb86);}return null;};}function patchUpdates(_0x274e77){return function(_0x4c02b1){try{jsonpatch['apply'](_0x4c02b1,_0x274e77,!![]);}catch(_0x27053e){return BPromise[_0x5699('0x25')](_0x27053e);}return _0x4c02b1[_0x5699('0x26')]();};}function saveUpdates(_0x38f4c5,_0x550d2a){return function(_0x3c92a6){if(_0x3c92a6){return _0x3c92a6['update'](_0x38f4c5)[_0x5699('0x27')](function(_0x4576c4){return _0x4576c4;});}return null;};}function removeEntity(_0x55bf34,_0x2eb824){return function(_0x7793e8){if(_0x7793e8){return _0x7793e8['destroy']()[_0x5699('0x27')](function(){var _0x347cbd=_0x7793e8['get']({'plain':!![]});var _0x4cc02c=_0x5699('0x28');return db[_0x5699('0x29')][_0x5699('0x2a')]({'where':{'type':_0x4cc02c,'resourceId':_0x347cbd['id']}})[_0x5699('0x27')](function(){return _0x7793e8;});})['then'](function(){_0x55bf34[_0x5699('0x22')](0xcc)[_0x5699('0x1d')]();});}};}function handleEntityNotFound(_0x4f2598,_0x29d3ed){return function(_0x121ae8){if(!_0x121ae8){_0x4f2598[_0x5699('0x1c')](0x194);}return _0x121ae8;};}function handleError(_0x569b39,_0x2e105a){_0x2e105a=_0x2e105a||0x1f4;return function(_0x8fd536){logger[_0x5699('0x2b')](_0x8fd536[_0x5699('0x2c')]);if(_0x8fd536[_0x5699('0x2d')]){delete _0x8fd536[_0x5699('0x2d')];}_0x569b39['status'](_0x2e105a)['send'](_0x8fd536);};}exports[_0x5699('0x2e')]=function(_0x290f91,_0x25b8e4){var _0x54e9b0={},_0x5495da={},_0x4a55c3={'count':0x0,'rows':[]};var _0x2e3fe5=_[_0x5699('0x2f')](db['Dashboard'][_0x5699('0x30')],function(_0x29edc3){return{'name':_0x29edc3[_0x5699('0x31')],'type':_0x29edc3['type']['key']};});_0x5495da['model']=_[_0x5699('0x2f')](_0x2e3fe5,_0x5699('0x2d'));_0x5495da[_0x5699('0x32')]=_[_0x5699('0x33')](_0x290f91[_0x5699('0x32')]);_0x5495da['filters']=_['intersection'](_0x5495da[_0x5699('0x34')],_0x5495da[_0x5699('0x32')]);_0x54e9b0[_0x5699('0x35')]=_[_0x5699('0x36')](_0x5495da[_0x5699('0x34')],qs[_0x5699('0x37')](_0x290f91[_0x5699('0x32')]['fields']));_0x54e9b0[_0x5699('0x35')]=_0x54e9b0[_0x5699('0x35')][_0x5699('0x38')]?_0x54e9b0['attributes']:_0x5495da[_0x5699('0x34')];if(!_0x290f91[_0x5699('0x32')][_0x5699('0x39')](_0x5699('0x3a'))){_0x54e9b0[_0x5699('0x20')]=qs['limit'](_0x290f91['query'][_0x5699('0x20')]);_0x54e9b0['offset']=qs[_0x5699('0x1e')](_0x290f91[_0x5699('0x32')][_0x5699('0x1e')]);}_0x54e9b0[_0x5699('0x3b')]=qs[_0x5699('0x3c')](_0x290f91['query'][_0x5699('0x3c')]);_0x54e9b0[_0x5699('0x3d')]=qs['filters'](_[_0x5699('0x3e')](_0x290f91['query'],_0x5495da[_0x5699('0x3f')]),_0x2e3fe5);if(_0x290f91['query']['filter']){_0x54e9b0[_0x5699('0x3d')]=_[_0x5699('0x40')](_0x54e9b0[_0x5699('0x3d')],{'$or':_[_0x5699('0x2f')](_0x2e3fe5,function(_0x53ee40){if(_0x53ee40[_0x5699('0x41')]!=='VIRTUAL'){var _0x3f71c2={};_0x3f71c2[_0x53ee40[_0x5699('0x2d')]]={'$like':'%'+_0x290f91[_0x5699('0x32')][_0x5699('0x42')]+'%'};return _0x3f71c2;}})});}_0x54e9b0=_['merge']({},_0x54e9b0,_0x290f91[_0x5699('0x43')]);var _0x5b8072={'where':_0x54e9b0[_0x5699('0x3d')]};return db[_0x5699('0x44')][_0x5699('0x21')](_0x5b8072)[_0x5699('0x27')](function(_0x1ae4c2){_0x4a55c3[_0x5699('0x21')]=_0x1ae4c2;if(_0x290f91['query'][_0x5699('0x45')]){_0x54e9b0[_0x5699('0x46')]=[{'all':!![]}];}return db[_0x5699('0x44')][_0x5699('0x47')](_0x54e9b0);})[_0x5699('0x27')](function(_0x4147ed){_0x4a55c3[_0x5699('0x48')]=_0x4147ed;return _0x4a55c3;})[_0x5699('0x27')](respondWithFilteredResult(_0x25b8e4,_0x54e9b0))[_0x5699('0x49')](handleError(_0x25b8e4,null));};exports[_0x5699('0x4a')]=function(_0xc498ba,_0x7e038){var _0x3dadb6={'raw':![],'where':{'id':_0xc498ba['params']['id']}},_0x5745c={};_0x5745c[_0x5699('0x34')]=_['keys'](db[_0x5699('0x44')]['rawAttributes']);_0x5745c[_0x5699('0x32')]=_['keys'](_0xc498ba[_0x5699('0x32')]);_0x5745c[_0x5699('0x3f')]=_[_0x5699('0x36')](_0x5745c[_0x5699('0x34')],_0x5745c[_0x5699('0x32')]);_0x3dadb6['attributes']=_[_0x5699('0x36')](_0x5745c['model'],qs[_0x5699('0x37')](_0xc498ba['query'][_0x5699('0x37')]));_0x3dadb6[_0x5699('0x35')]=_0x3dadb6[_0x5699('0x35')][_0x5699('0x38')]?_0x3dadb6['attributes']:_0x5745c[_0x5699('0x34')];if(_0xc498ba[_0x5699('0x32')][_0x5699('0x45')]){_0x3dadb6[_0x5699('0x46')]=[{'all':!![]}];}_0x3dadb6=_[_0x5699('0x40')]({},_0x3dadb6,_0xc498ba['options']);return db[_0x5699('0x44')][_0x5699('0x4b')](_0x3dadb6)[_0x5699('0x27')](handleEntityNotFound(_0x7e038,null))['then'](respondWithResult(_0x7e038,null))[_0x5699('0x49')](handleError(_0x7e038,null));};exports[_0x5699('0x4c')]=function(_0xfd9d2a,_0x17d6e5){return db[_0x5699('0x44')][_0x5699('0x4c')](_0xfd9d2a[_0x5699('0x4d')],{})[_0x5699('0x27')](function(_0x1e12d0){var _0x235315=_0xfd9d2a[_0x5699('0x4e')][_0x5699('0x4f')]({'plain':!![]});if(!_0x235315)throw new Error(_0x5699('0x50'));if(_0x235315[_0x5699('0x51')]==='user'){var _0x2f3bdf=_0x1e12d0['get']({'plain':!![]});var _0x45a0bc=_0x5699('0x28');return db[_0x5699('0x52')][_0x5699('0x4b')]({'where':{'name':_0x45a0bc,'userProfileId':_0x235315[_0x5699('0x53')]},'raw':!![]})['then'](function(_0x152ae7){if(_0x152ae7&&_0x152ae7['autoAssociation']===0x0){return db[_0x5699('0x29')][_0x5699('0x4c')]({'name':_0x2f3bdf['name'],'resourceId':_0x2f3bdf['id'],'type':_0x152ae7[_0x5699('0x2d')],'sectionId':_0x152ae7['id']},{})[_0x5699('0x27')](function(){return _0x1e12d0;});}else{return _0x1e12d0;}})[_0x5699('0x49')](function(_0x1bd150){logger['error'](_0x5699('0x54'),_0x1bd150);throw _0x1bd150;});}return _0x1e12d0;})[_0x5699('0x27')](respondWithResult(_0x17d6e5,0xc9))[_0x5699('0x49')](handleError(_0x17d6e5,null));};exports[_0x5699('0x55')]=function(_0x579f12,_0x812558){var _0x80541={'where':{'id':_0x579f12[_0x5699('0x56')]['id']}},_0xd1e471={};_0xd1e471[_0x5699('0x34')]=_[_0x5699('0x33')](db[_0x5699('0x44')][_0x5699('0x30')]);_0x80541['attributes']=_['intersection'](_0xd1e471[_0x5699('0x34')],qs['fields'](_0x579f12['query'][_0x5699('0x37')]));_0x80541[_0x5699('0x35')]=_0x80541[_0x5699('0x35')][_0x5699('0x38')]?_0x80541[_0x5699('0x35')]:_0xd1e471[_0x5699('0x34')];if(_0x579f12[_0x5699('0x32')][_0x5699('0x45')]){_0x80541[_0x5699('0x46')]=[{'all':!![]}];}_0x80541=_[_0x5699('0x40')]({},_0x80541,_0x579f12[_0x5699('0x43')]);return db[_0x5699('0x44')][_0x5699('0x4b')](_0x80541)[_0x5699('0x27')](handleEntityNotFound(_0x812558,null))['then'](function(_0xee1c91){if(_0xee1c91){var _0x593bbe=_0xee1c91[_0x5699('0x4f')]({'plain':!![]});_0x593bbe=qs[_0x5699('0x57')](_0x593bbe,['id','createdAt',_0x5699('0x58')]);_0x579f12[_0x5699('0x4d')]=_[_0x5699('0x57')](_0x579f12[_0x5699('0x4d')],['id',_0x5699('0x59'),'updatedAt']);return db[_0x5699('0x44')]['create'](_[_0x5699('0x40')](_0x593bbe,_0x579f12[_0x5699('0x4d')]),{'include':_0x579f12[_0x5699('0x32')]['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0xe84b0d){var _0x47063d=_0x579f12[_0x5699('0x4e')][_0x5699('0x4f')]({'plain':!![]});if(!_0x47063d)throw new Error(_0x5699('0x50'));if(_0x47063d[_0x5699('0x51')]===_0x5699('0x4e')){var _0x1f26e1=_0xe84b0d[_0x5699('0x4f')]({'plain':!![]});var _0x17819d='CustomDashboards';return db[_0x5699('0x52')][_0x5699('0x4b')]({'where':{'name':_0x17819d,'userProfileId':_0x47063d[_0x5699('0x53')]},'raw':!![]})[_0x5699('0x27')](function(_0x547803){if(_0x547803&&_0x547803['autoAssociation']===0x0){return db['UserProfileResource'][_0x5699('0x4c')]({'name':_0x1f26e1[_0x5699('0x2d')],'resourceId':_0x1f26e1['id'],'type':_0x547803['name'],'sectionId':_0x547803['id']},{})[_0x5699('0x27')](function(){return _0xe84b0d;});}else{return _0xe84b0d;}})[_0x5699('0x49')](function(_0xcce32d){logger[_0x5699('0x2b')](_0x5699('0x54'),_0xcce32d);throw _0xcce32d;});}return _0xe84b0d;});}})[_0x5699('0x27')](respondWithResult(_0x812558,0xc9))[_0x5699('0x49')](handleError(_0x812558,null));};exports['update']=function(_0x3f8c75,_0x177f6a){if(_0x3f8c75[_0x5699('0x4d')]['id']){delete _0x3f8c75['body']['id'];}return db[_0x5699('0x44')][_0x5699('0x4b')]({'where':{'id':_0x3f8c75[_0x5699('0x56')]['id']}})['then'](handleEntityNotFound(_0x177f6a,null))['then'](saveUpdates(_0x3f8c75['body'],null))[_0x5699('0x27')](respondWithResult(_0x177f6a,null))[_0x5699('0x49')](handleError(_0x177f6a,null));};exports[_0x5699('0x2a')]=function(_0x534e79,_0x17e443){return db[_0x5699('0x44')][_0x5699('0x4b')]({'where':{'id':_0x534e79[_0x5699('0x56')]['id']}})[_0x5699('0x27')](handleEntityNotFound(_0x17e443,null))[_0x5699('0x27')](removeEntity(_0x17e443,null))['catch'](handleError(_0x17e443,null));};function widgetAttributes(_0x69db3){try{switch(_0x69db3[_0x5699('0x41')]){case _0x5699('0x5a'):return[{'name':'attrUrl','value':_0x69db3[_0x5699('0x5b')]||(_0x69db3[_0x5699('0x5c')]&&_0x69db3[_0x5699('0x5c')][0x0]?_0x69db3[_0x5699('0x5c')][0x0]['value']:undefined)||_0x5699('0x5d')}];case _0x5699('0x5e'):return[{'name':_0x5699('0x5f'),'value':_0x69db3['attrPath']||(_0x69db3[_0x5699('0x5c')]&&_0x69db3['attrs'][0x0]?_0x69db3['attrs'][0x0][_0x5699('0x60')]:undefined)||''}];case _0x5699('0x61'):return[{'name':_0x5699('0x62'),'value':_0x69db3[_0x5699('0x62')]||(_0x69db3[_0x5699('0x5c')]&&_0x69db3[_0x5699('0x5c')][0x0]?_0x69db3['attrs'][0x0][_0x5699('0x60')]:undefined)||_0x5699('0x63')},{'name':'attrTimezone','value':_0x69db3[_0x5699('0x64')]||(_0x69db3[_0x5699('0x5c')]&&_0x69db3[_0x5699('0x5c')][0x1]?_0x69db3[_0x5699('0x5c')][0x1][_0x5699('0x60')]:undefined)||_0x5699('0x65')},{'name':_0x5699('0x66'),'value':_0x69db3[_0x5699('0x66')]||(_0x69db3[_0x5699('0x5c')]&&_0x69db3[_0x5699('0x5c')][0x2]?_0x69db3[_0x5699('0x5c')][0x2]['value']:undefined)||0xc}];case'counter':return[{'name':'attrMetric','value':_0x69db3[_0x5699('0x67')]||(_0x69db3[_0x5699('0x5c')]&&_0x69db3[_0x5699('0x5c')][0x0]?_0x69db3['attrs'][0x0]['value']:undefined)||_0x5699('0x68')},{'name':_0x5699('0x69'),'value':_0x69db3['attrVoiceQueues']||(_0x69db3[_0x5699('0x5c')]&&_0x69db3[_0x5699('0x5c')][0x1]?_0x69db3[_0x5699('0x5c')][0x1][_0x5699('0x60')]:undefined)||[]},{'name':_0x5699('0x66'),'value':_0x69db3[_0x5699('0x66')]||(_0x69db3[_0x5699('0x5c')]&&_0x69db3[_0x5699('0x5c')][0x2]?_0x69db3[_0x5699('0x5c')][0x2]['value']:undefined)||0x14},{'name':_0x5699('0x6a'),'value':_0x69db3[_0x5699('0x6a')]||(_0x69db3[_0x5699('0x5c')]&&_0x69db3[_0x5699('0x5c')][0x3]?_0x69db3['attrs'][0x3][_0x5699('0x60')]:undefined)||'voice'},{'name':_0x5699('0x6b'),'value':_0x69db3[_0x5699('0x6b')]||(_0x69db3[_0x5699('0x5c')]&&_0x69db3[_0x5699('0x5c')][0x4]?_0x69db3['attrs'][0x4][_0x5699('0x60')]:undefined)||''},{'name':_0x5699('0x6c'),'value':_0x69db3['attrFaxAccounts']||(_0x69db3[_0x5699('0x5c')]&&_0x69db3[_0x5699('0x5c')][0x5]?_0x69db3[_0x5699('0x5c')][0x5][_0x5699('0x60')]:undefined)||''},{'name':_0x5699('0x6d'),'value':_0x69db3['attrSmsAccounts']||(_0x69db3[_0x5699('0x5c')]&&_0x69db3[_0x5699('0x5c')][0x6]?_0x69db3[_0x5699('0x5c')][0x6][_0x5699('0x60')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x69db3['attrOpenchannelAccounts']||(_0x69db3['attrs']&&_0x69db3[_0x5699('0x5c')][0x7]?_0x69db3['attrs'][0x7][_0x5699('0x60')]:undefined)||''},{'name':_0x5699('0x6e'),'value':_0x69db3['attrWhatsappAccounts']||(_0x69db3[_0x5699('0x5c')]&&_0x69db3[_0x5699('0x5c')][0x8]?_0x69db3[_0x5699('0x5c')][0x8][_0x5699('0x60')]:undefined)||''},{'name':_0x5699('0x6f'),'value':_0x69db3[_0x5699('0x6f')]||(_0x69db3[_0x5699('0x5c')]&&_0x69db3[_0x5699('0x5c')][0x9]?_0x69db3['attrs'][0x9][_0x5699('0x60')]:undefined)||''}];case _0x5699('0x70'):case _0x5699('0x71'):return[{'name':_0x5699('0x72'),'value':_0x69db3['attrSerie1']||(_0x69db3[_0x5699('0x5c')]&&_0x69db3[_0x5699('0x5c')][0x0]?_0x69db3[_0x5699('0x5c')][0x0][_0x5699('0x60')]:undefined)||_0x5699('0x68')},{'name':_0x5699('0x73'),'value':_0x69db3['attrSerie2']||(_0x69db3[_0x5699('0x5c')]&&_0x69db3[_0x5699('0x5c')][0x1]?_0x69db3[_0x5699('0x5c')][0x1]['value']:undefined)||null},{'name':_0x5699('0x74'),'value':_0x69db3['attrSerie3']||(_0x69db3[_0x5699('0x5c')]&&_0x69db3['attrs'][0x2]?_0x69db3[_0x5699('0x5c')][0x2][_0x5699('0x60')]:undefined)||null},{'name':_0x5699('0x69'),'value':_0x69db3['attrVoiceQueues']||(_0x69db3[_0x5699('0x5c')]&&_0x69db3[_0x5699('0x5c')][0x3]?_0x69db3[_0x5699('0x5c')][0x3][_0x5699('0x60')]:undefined)||[]},{'name':_0x5699('0x6a'),'value':_0x69db3[_0x5699('0x6a')]||(_0x69db3['attrs']&&_0x69db3[_0x5699('0x5c')][0x4]?_0x69db3['attrs'][0x4]['value']:undefined)||'voice'},{'name':_0x5699('0x6b'),'value':_0x69db3['attrEmailAccounts']||(_0x69db3[_0x5699('0x5c')]&&_0x69db3[_0x5699('0x5c')][0x5]?_0x69db3[_0x5699('0x5c')][0x5]['value']:undefined)||''},{'name':_0x5699('0x6c'),'value':_0x69db3[_0x5699('0x6c')]||(_0x69db3['attrs']&&_0x69db3['attrs'][0x6]?_0x69db3['attrs'][0x6][_0x5699('0x60')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x69db3['attrSmsAccounts']||(_0x69db3[_0x5699('0x5c')]&&_0x69db3[_0x5699('0x5c')][0x7]?_0x69db3[_0x5699('0x5c')][0x7][_0x5699('0x60')]:undefined)||''},{'name':_0x5699('0x75'),'value':_0x69db3['attrOpenchannelAccounts']||(_0x69db3[_0x5699('0x5c')]&&_0x69db3[_0x5699('0x5c')][0x8]?_0x69db3[_0x5699('0x5c')][0x8][_0x5699('0x60')]:undefined)||''},{'name':_0x5699('0x6e'),'value':_0x69db3[_0x5699('0x6e')]||(_0x69db3['attrs']&&_0x69db3['attrs'][0x9]?_0x69db3[_0x5699('0x5c')][0x9][_0x5699('0x60')]:undefined)||''},{'name':_0x5699('0x6f'),'value':_0x69db3[_0x5699('0x6f')]||(_0x69db3[_0x5699('0x5c')]&&_0x69db3[_0x5699('0x5c')][0xa]?_0x69db3[_0x5699('0x5c')][0xa][_0x5699('0x60')]:undefined)||''}];case'web-report':return[{'name':_0x5699('0x76'),'type':_0x69db3[_0x5699('0x77')]||(_0x69db3[_0x5699('0x5c')]&&_0x69db3[_0x5699('0x5c')][0x0]?_0x69db3['attrs'][0x0][_0x5699('0x41')]:undefined)||null,'value':_0x69db3[_0x5699('0x76')]||(_0x69db3[_0x5699('0x5c')]&&_0x69db3[_0x5699('0x5c')][0x0]?_0x69db3[_0x5699('0x5c')][0x0]['value']:undefined)||null},{'name':_0x5699('0x78'),'value':_0x69db3['attrRefresh']||(_0x69db3[_0x5699('0x5c')]&&_0x69db3[_0x5699('0x5c')][0x1]?_0x69db3[_0x5699('0x5c')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x59ecb4){logger[_0x5699('0x2b')](_0x5699('0x79'),JSON[_0x5699('0x7a')](_0x59ecb4));return[];}}exports[_0x5699('0x7b')]=function(_0x40fba5,_0x4bb32d,_0x42cbbe){if(_0x40fba5['body']['id']){delete _0x40fba5['body']['id'];}return db[_0x5699('0x44')][_0x5699('0x4b')]({'where':{'id':_0x40fba5[_0x5699('0x56')]['id']}})[_0x5699('0x27')](handleEntityNotFound(_0x4bb32d,null))[_0x5699('0x27')](function(_0x141d0b){if(_0x141d0b){_0x40fba5[_0x5699('0x4d')][_0x5699('0x7c')]=_0x141d0b['id'];_0x40fba5[_0x5699('0x4d')][_0x5699('0x5c')]=widgetAttributes(_0x40fba5[_0x5699('0x4d')]);return db[_0x5699('0x7d')][_0x5699('0x4c')](_0x40fba5[_0x5699('0x4d')]);}})[_0x5699('0x27')](respondWithResult(_0x4bb32d,null))[_0x5699('0x49')](handleError(_0x4bb32d,null));};exports['getItems']=function(_0x27c8,_0x295c1f,_0xc01b77){var _0x39ff7d={};var _0x39b6f5={};var _0x200e43;var _0xd0c2c1;return db['Dashboard'][_0x5699('0x7e')]({'where':{'id':_0x27c8[_0x5699('0x56')]['id']}})['then'](handleEntityNotFound(_0x295c1f,null))['then'](function(_0x39a04c){if(_0x39a04c){_0x200e43=_0x39a04c;_0x39b6f5[_0x5699('0x34')]=_['keys'](db['DashboardItem'][_0x5699('0x30')]);_0x39b6f5[_0x5699('0x32')]=_['keys'](_0x27c8['query']);_0x39b6f5[_0x5699('0x3f')]=_[_0x5699('0x36')](_0x39b6f5[_0x5699('0x34')],_0x39b6f5[_0x5699('0x32')]);_0x39ff7d[_0x5699('0x35')]=_['intersection'](_0x39b6f5[_0x5699('0x34')],qs['fields'](_0x27c8[_0x5699('0x32')][_0x5699('0x37')]));_0x39ff7d[_0x5699('0x35')]=_0x39ff7d['attributes'][_0x5699('0x38')]?_0x39ff7d[_0x5699('0x35')]:_0x39b6f5[_0x5699('0x34')];_0x39ff7d['order']=qs[_0x5699('0x3c')](_0x27c8['query'][_0x5699('0x3c')]);_0x39ff7d[_0x5699('0x3d')]=qs['filters'](_['pick'](_0x27c8[_0x5699('0x32')],_0x39b6f5['filters']));if(_0x27c8['query'][_0x5699('0x42')]){_0x39ff7d[_0x5699('0x3d')]=_[_0x5699('0x40')](_0x39ff7d['where'],{'$or':_[_0x5699('0x2f')](_0x39ff7d[_0x5699('0x35')],function(_0x2bf16c){var _0x298811={};_0x298811[_0x2bf16c]={'$like':'%'+_0x27c8['query']['filter']+'%'};return _0x298811;})});}_0x39ff7d=_[_0x5699('0x40')]({},_0x39ff7d,_0x27c8[_0x5699('0x43')]);return _0x200e43[_0x5699('0x7f')](_0x39ff7d);}})[_0x5699('0x27')](function(_0x2074fe){if(_0x2074fe){_0xd0c2c1=_0x2074fe[_0x5699('0x38')];if(!_0x27c8[_0x5699('0x32')][_0x5699('0x39')](_0x5699('0x3a'))){_0x39ff7d[_0x5699('0x20')]=qs[_0x5699('0x20')](_0x27c8[_0x5699('0x32')][_0x5699('0x20')]);_0x39ff7d[_0x5699('0x1e')]=qs[_0x5699('0x1e')](_0x27c8[_0x5699('0x32')][_0x5699('0x1e')]);}return _0x200e43[_0x5699('0x7f')](_0x39ff7d);}})[_0x5699('0x27')](function(_0x408fc2){if(_0x408fc2){return _0x408fc2?{'count':_0xd0c2c1,'rows':_0x408fc2}:null;}})[_0x5699('0x27')](respondWithResult(_0x295c1f,null))[_0x5699('0x49')](handleError(_0x295c1f,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 8b2e366..0f73924 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 _0xd9d0=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','Dashboard','setMaxListeners','update'];(function(_0x239dba,_0x309e95){var _0x1ceb11=function(_0x14efe6){while(--_0x14efe6){_0x239dba['push'](_0x239dba['shift']());}};_0x1ceb11(++_0x309e95);}(_0xd9d0,0xe5));var _0x0d9d=function(_0x25d4b1,_0x4e896d){_0x25d4b1=_0x25d4b1-0x0;var _0x2d51a5=_0xd9d0[_0x25d4b1];return _0x2d51a5;};'use strict';var EventEmitter=require(_0x0d9d('0x0'));var Dashboard=require(_0x0d9d('0x1'))['db'][_0x0d9d('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x0d9d('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x0d9d('0x4'),'afterDestroy':'remove'};function emitEvent(_0x3fd7e9){return function(_0x23ed48,_0x51f0b7,_0x408cbc){DashboardEvents[_0x0d9d('0x5')](_0x3fd7e9+':'+_0x23ed48['id'],_0x23ed48);DashboardEvents['emit'](_0x3fd7e9,_0x23ed48);_0x408cbc(null);};}for(var e in events){if(events[_0x0d9d('0x6')](e)){var event=events[e];Dashboard[_0x0d9d('0x7')](e,emitEvent(event));}}module[_0x0d9d('0x8')]=DashboardEvents; \ No newline at end of file +var _0xbc22=['hook','exports','../../mysqldb','setMaxListeners','update','remove','emit'];(function(_0x190729,_0x40bb81){var _0x3d9a34=function(_0x12c4de){while(--_0x12c4de){_0x190729['push'](_0x190729['shift']());}};_0x3d9a34(++_0x40bb81);}(_0xbc22,0x79));var _0x2bc2=function(_0x1443eb,_0x203408){_0x1443eb=_0x1443eb-0x0;var _0x2b8810=_0xbc22[_0x1443eb];return _0x2b8810;};'use strict';var EventEmitter=require('events');var Dashboard=require(_0x2bc2('0x0'))['db']['Dashboard'];var DashboardEvents=new EventEmitter();DashboardEvents[_0x2bc2('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x2bc2('0x2'),'afterDestroy':_0x2bc2('0x3')};function emitEvent(_0x25c4f0){return function(_0x44daa9,_0xfb9e77,_0x230c2d){DashboardEvents[_0x2bc2('0x4')](_0x25c4f0+':'+_0x44daa9['id'],_0x44daa9);DashboardEvents[_0x2bc2('0x4')](_0x25c4f0,_0x44daa9);_0x230c2d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Dashboard[_0x2bc2('0x5')](e,emitEvent(event));}}module[_0x2bc2('0x6')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index 441e041..6f1b5b2 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 _0x3ce1=['dashboards','lodash','util','../../config/logger','moment','bluebird','path','rimraf','./dashboard.attributes','exports','Dashboard'];(function(_0x69a79e,_0x1cf909){var _0x2b1d0c=function(_0x5a0e26){while(--_0x5a0e26){_0x69a79e['push'](_0x69a79e['shift']());}};_0x2b1d0c(++_0x1cf909);}(_0x3ce1,0xbc));var _0x13ce=function(_0x5253c6,_0x45317e){_0x5253c6=_0x5253c6-0x0;var _0x2297c0=_0x3ce1[_0x5253c6];return _0x2297c0;};'use strict';var _=require(_0x13ce('0x0'));var util=require(_0x13ce('0x1'));var logger=require(_0x13ce('0x2'))('api');var moment=require(_0x13ce('0x3'));var BPromise=require(_0x13ce('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x13ce('0x5'));var rimraf=require(_0x13ce('0x6'));var config=require('../../config/environment');var attributes=require(_0x13ce('0x7'));module[_0x13ce('0x8')]=function(_0x149c70,_0x5e6b8a){return _0x149c70['define'](_0x13ce('0x9'),attributes,{'tableName':_0x13ce('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4708=['Dashboard','dashboards','lodash','util','bluebird','request-promise','rimraf','../../config/environment','./dashboard.attributes','exports','define'];(function(_0x6c91b4,_0x4d27c9){var _0x8a9024=function(_0xf76227){while(--_0xf76227){_0x6c91b4['push'](_0x6c91b4['shift']());}};_0x8a9024(++_0x4d27c9);}(_0x4708,0xa7));var _0x8470=function(_0x48bd8e,_0x306408){_0x48bd8e=_0x48bd8e-0x0;var _0x477844=_0x4708[_0x48bd8e];return _0x477844;};'use strict';var _=require(_0x8470('0x0'));var util=require(_0x8470('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x8470('0x2'));var rp=require(_0x8470('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8470('0x4'));var config=require(_0x8470('0x5'));var attributes=require(_0x8470('0x6'));module[_0x8470('0x7')]=function(_0x310710,_0x45206e){return _0x310710[_0x8470('0x8')](_0x8470('0x9'),attributes,{'tableName':_0x8470('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.rpc.js b/server/api/dashboard/dashboard.rpc.js index 1a888b0..e2a0761 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 _0x961d=['then','info','Dashboard,\x20%s,\x20%s','Dashboard,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter','./dashboard.socket','register','request'];(function(_0x5185e7,_0x27126d){var _0xcf6da9=function(_0x2251b4){while(--_0x2251b4){_0x5185e7['push'](_0x5185e7['shift']());}};_0xcf6da9(++_0x27126d);}(_0x961d,0x14a));var _0xd961=function(_0x2ed8f3,_0x4aa12f){_0x2ed8f3=_0x2ed8f3-0x0;var _0x525a55=_0x961d[_0x2ed8f3];return _0x525a55;};'use strict';var _=require(_0xd961('0x0'));var util=require(_0xd961('0x1'));var moment=require(_0xd961('0x2'));var BPromise=require(_0xd961('0x3'));var rs=require(_0xd961('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd961('0x5'))['db'];var utils=require(_0xd961('0x6'));var logger=require('../../config/logger')(_0xd961('0x7'));var config=require(_0xd961('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd961('0x9')][_0xd961('0xa')]({'port':0x232a});config['redis']=_[_0xd961('0xb')](config[_0xd961('0xc')],{'host':_0xd961('0xd'),'port':0x18eb});var socket=require(_0xd961('0xe'))(new Redis(config[_0xd961('0xc')]));require(_0xd961('0xf'))[_0xd961('0x10')](socket);function respondWithRpcPromise(_0x3ef341,_0x5a3fcc,_0x4c486f){return new BPromise(function(_0x439443,_0x18c451){return client[_0xd961('0x11')](_0x3ef341,_0x4c486f)[_0xd961('0x12')](function(_0x699352){logger[_0xd961('0x13')](_0xd961('0x14'),_0x5a3fcc,'request\x20sent');logger['debug'](_0xd961('0x15'),_0x5a3fcc,_0xd961('0x16'),JSON[_0xd961('0x17')](_0x699352));if(_0x699352[_0xd961('0x18')]){if(_0x699352[_0xd961('0x18')][_0xd961('0x19')]===0x1f4){logger[_0xd961('0x18')](_0xd961('0x14'),_0x5a3fcc,_0x699352[_0xd961('0x18')][_0xd961('0x1a')]);return _0x18c451(_0x699352[_0xd961('0x18')][_0xd961('0x1a')]);}logger['error'](_0xd961('0x14'),_0x5a3fcc,_0x699352[_0xd961('0x18')][_0xd961('0x1a')]);return _0x439443(_0x699352['error'][_0xd961('0x1a')]);}else{logger[_0xd961('0x13')](_0xd961('0x14'),_0x5a3fcc,_0xd961('0x16'));_0x439443(_0x699352[_0xd961('0x1b')][_0xd961('0x1a')]);}})[_0xd961('0x1c')](function(_0x309a4a){logger['error'](_0xd961('0x14'),_0x5a3fcc,_0x309a4a);_0x18c451(_0x309a4a);});});} \ No newline at end of file +var _0x2f9a=['register','request','then','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','code','error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','redis','defaults','localhost','./dashboard.socket'];(function(_0x2542e3,_0x2a2867){var _0x1f8cea=function(_0x107a95){while(--_0x107a95){_0x2542e3['push'](_0x2542e3['shift']());}};_0x1f8cea(++_0x2a2867);}(_0x2f9a,0x186));var _0xa2f9=function(_0x3a7257,_0x30b139){_0x3a7257=_0x3a7257-0x0;var _0x467d25=_0x2f9a[_0x3a7257];return _0x467d25;};'use strict';var _=require(_0xa2f9('0x0'));var util=require(_0xa2f9('0x1'));var moment=require(_0xa2f9('0x2'));var BPromise=require(_0xa2f9('0x3'));var rs=require(_0xa2f9('0x4'));var fs=require('fs');var Redis=require(_0xa2f9('0x5'));var db=require(_0xa2f9('0x6'))['db'];var utils=require(_0xa2f9('0x7'));var logger=require('../../config/logger')(_0xa2f9('0x8'));var config=require('../../config/environment');var jayson=require(_0xa2f9('0x9'));var client=jayson[_0xa2f9('0xa')][_0xa2f9('0xb')]({'port':0x232a});config[_0xa2f9('0xc')]=_[_0xa2f9('0xd')](config[_0xa2f9('0xc')],{'host':_0xa2f9('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa2f9('0xc')]));require(_0xa2f9('0xf'))[_0xa2f9('0x10')](socket);function respondWithRpcPromise(_0x3951cd,_0x2fd99f,_0x51fb4b){return new BPromise(function(_0x28b685,_0x3a70c6){return client[_0xa2f9('0x11')](_0x3951cd,_0x51fb4b)[_0xa2f9('0x12')](function(_0x5d159b){logger[_0xa2f9('0x13')](_0xa2f9('0x14'),_0x2fd99f,_0xa2f9('0x15'));logger[_0xa2f9('0x16')](_0xa2f9('0x17'),_0x2fd99f,_0xa2f9('0x15'),JSON[_0xa2f9('0x18')](_0x5d159b));if(_0x5d159b['error']){if(_0x5d159b['error'][_0xa2f9('0x19')]===0x1f4){logger[_0xa2f9('0x1a')](_0xa2f9('0x14'),_0x2fd99f,_0x5d159b[_0xa2f9('0x1a')][_0xa2f9('0x1b')]);return _0x3a70c6(_0x5d159b['error'][_0xa2f9('0x1b')]);}logger['error'](_0xa2f9('0x14'),_0x2fd99f,_0x5d159b[_0xa2f9('0x1a')]['message']);return _0x28b685(_0x5d159b['error'][_0xa2f9('0x1b')]);}else{logger['info']('Dashboard,\x20%s,\x20%s',_0x2fd99f,_0xa2f9('0x15'));_0x28b685(_0x5d159b['result'][_0xa2f9('0x1b')]);}})[_0xa2f9('0x1c')](function(_0x525493){logger[_0xa2f9('0x1a')](_0xa2f9('0x14'),_0x2fd99f,_0x525493);_0x3a70c6(_0x525493);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index d9f80df..82d03ef 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 _0x54cc=['removeListener','register','length','dashboard:','remove','update','emit'];(function(_0x371213,_0x4c4187){var _0x531244=function(_0x209a3d){while(--_0x209a3d){_0x371213['push'](_0x371213['shift']());}};_0x531244(++_0x4c4187);}(_0x54cc,0x1d9));var _0xc54c=function(_0xd349bc,_0x1d436e){_0xd349bc=_0xd349bc-0x0;var _0x638079=_0x54cc[_0xd349bc];return _0x638079;};'use strict';var DashboardEvents=require('./dashboard.events');var events=['save',_0xc54c('0x0'),_0xc54c('0x1')];function createListener(_0x26f6f3,_0xe347f0){return function(_0x56b5e5){_0xe347f0[_0xc54c('0x2')](_0x26f6f3,_0x56b5e5);};}function removeListener(_0x4fed07,_0x5bbf50){return function(){DashboardEvents[_0xc54c('0x3')](_0x4fed07,_0x5bbf50);};}exports[_0xc54c('0x4')]=function(_0x97703c){for(var _0x5883f2=0x0,_0x9883eb=events[_0xc54c('0x5')];_0x5883f2<_0x9883eb;_0x5883f2++){var _0x1834a3=events[_0x5883f2];var _0xad4c28=createListener(_0xc54c('0x6')+_0x1834a3,_0x97703c);DashboardEvents['on'](_0x1834a3,_0xad4c28);}}; \ No newline at end of file +var _0xe5af=['emit','removeListener','register','dashboard:','save','remove'];(function(_0x54a6df,_0xdba0dd){var _0x1e5e19=function(_0x1c4ab7){while(--_0x1c4ab7){_0x54a6df['push'](_0x54a6df['shift']());}};_0x1e5e19(++_0xdba0dd);}(_0xe5af,0x94));var _0xfe5a=function(_0x1fc2d8,_0xe76a5a){_0x1fc2d8=_0x1fc2d8-0x0;var _0x3cd535=_0xe5af[_0x1fc2d8];return _0x3cd535;};'use strict';var DashboardEvents=require('./dashboard.events');var events=[_0xfe5a('0x0'),_0xfe5a('0x1'),'update'];function createListener(_0x10b942,_0x5ee32b){return function(_0x1a6ab7){_0x5ee32b[_0xfe5a('0x2')](_0x10b942,_0x1a6ab7);};}function removeListener(_0x3b4a8c,_0x4c8395){return function(){DashboardEvents[_0xfe5a('0x3')](_0x3b4a8c,_0x4c8395);};}exports[_0xfe5a('0x4')]=function(_0x730be){for(var _0x39f7d3=0x0,_0x880ca6=events['length'];_0x39f7d3<_0x880ca6;_0x39f7d3++){var _0x1e3282=events[_0x39f7d3];var _0x1f9a82=createListener(_0xfe5a('0x5')+_0x1e3282,_0x730be);DashboardEvents['on'](_0x1e3282,_0x1f9a82);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 68de6ab..c4e7075 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 _0x09e8=['getItems','post','create','/:id/clone','clone','addItem','put','update','destroy','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','./dashboard.controller','get','index','/:id','show','/:id/items','isAuthenticated'];(function(_0x3fa325,_0x119391){var _0x34c97d=function(_0x1ffba8){while(--_0x1ffba8){_0x3fa325['push'](_0x3fa325['shift']());}};_0x34c97d(++_0x119391);}(_0x09e8,0xc1));var _0x809e=function(_0x4efaff,_0x4626bc){_0x4efaff=_0x4efaff-0x0;var _0x566b79=_0x09e8[_0x4efaff];return _0x566b79;};'use strict';var multer=require(_0x809e('0x0'));var util=require(_0x809e('0x1'));var path=require(_0x809e('0x2'));var timeout=require(_0x809e('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x809e('0x4'));var auth=require(_0x809e('0x5'));var interaction=require(_0x809e('0x6'));var config=require('../../config/environment');var controller=require(_0x809e('0x7'));router[_0x809e('0x8')]('/',auth['isAuthenticated'](),controller[_0x809e('0x9')]);router[_0x809e('0x8')](_0x809e('0xa'),auth['isAuthenticated'](),controller[_0x809e('0xb')]);router[_0x809e('0x8')](_0x809e('0xc'),auth[_0x809e('0xd')](),controller[_0x809e('0xe')]);router[_0x809e('0xf')]('/',auth['isAuthenticated'](),controller[_0x809e('0x10')]);router[_0x809e('0xf')](_0x809e('0x11'),auth[_0x809e('0xd')](),controller[_0x809e('0x12')]);router[_0x809e('0xf')](_0x809e('0xc'),auth[_0x809e('0xd')](),controller[_0x809e('0x13')]);router[_0x809e('0x14')]('/:id',auth[_0x809e('0xd')](),controller[_0x809e('0x15')]);router['delete'](_0x809e('0xa'),auth['isAuthenticated'](),controller[_0x809e('0x16')]);module['exports']=router; \ No newline at end of file +var _0x400a=['../../components/interaction/service','../../config/environment','./dashboard.controller','get','index','/:id','isAuthenticated','show','getItems','create','post','/:id/clone','clone','addItem','put','update','delete','destroy','exports','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x680821,_0x23e67f){var _0x3f132c=function(_0x1bbcea){while(--_0x1bbcea){_0x680821['push'](_0x680821['shift']());}};_0x3f132c(++_0x23e67f);}(_0x400a,0x1f3));var _0xa400=function(_0x325ba7,_0x68f81){_0x325ba7=_0x325ba7-0x0;var _0x6e8de5=_0x400a[_0x325ba7];return _0x6e8de5;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xa400('0x0'));var express=require(_0xa400('0x1'));var router=express[_0xa400('0x2')]();var fs_extra=require(_0xa400('0x3'));var auth=require(_0xa400('0x4'));var interaction=require(_0xa400('0x5'));var config=require(_0xa400('0x6'));var controller=require(_0xa400('0x7'));router[_0xa400('0x8')]('/',auth['isAuthenticated'](),controller[_0xa400('0x9')]);router[_0xa400('0x8')](_0xa400('0xa'),auth[_0xa400('0xb')](),controller[_0xa400('0xc')]);router['get']('/:id/items',auth['isAuthenticated'](),controller[_0xa400('0xd')]);router['post']('/',auth[_0xa400('0xb')](),controller[_0xa400('0xe')]);router[_0xa400('0xf')](_0xa400('0x10'),auth[_0xa400('0xb')](),controller[_0xa400('0x11')]);router[_0xa400('0xf')]('/:id/items',auth[_0xa400('0xb')](),controller[_0xa400('0x12')]);router[_0xa400('0x13')]('/:id',auth[_0xa400('0xb')](),controller[_0xa400('0x14')]);router[_0xa400('0x15')](_0xa400('0xa'),auth[_0xa400('0xb')](),controller[_0xa400('0x16')]);module[_0xa400('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 b424089..a28972b 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 _0xd8fb=['exports','long','parse','attrs','setDataValue','stringify','INTEGER','#ffffff','STRING','sequelize','squel','lodash'];(function(_0x4f5c57,_0x1099d3){var _0x5097b6=function(_0x2a7cd5){while(--_0x2a7cd5){_0x4f5c57['push'](_0x4f5c57['shift']());}};_0x5097b6(++_0x1099d3);}(_0xd8fb,0x99));var _0xbd8f=function(_0x3253c3,_0x429ce0){_0x3253c3=_0x3253c3-0x0;var _0x493dc1=_0xd8fb[_0x3253c3];return _0x493dc1;};'use strict';var Sequelize=require(_0xbd8f('0x0'));var squel=require(_0xbd8f('0x1'));var _=require(_0xbd8f('0x2'));module[_0xbd8f('0x3')]={'title':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['STRING'](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize['TEXT'](_0xbd8f('0x4')),'get':function(){try{return JSON[_0xbd8f('0x5')](this['getDataValue'](_0xbd8f('0x6')));}catch(_0x2343bf){return[];}},'set':function(_0x5543b2){try{this[_0xbd8f('0x7')]('attrs',JSON[_0xbd8f('0x8')](_0x5543b2));}catch(_0x578499){this[_0xbd8f('0x7')](_0xbd8f('0x6'),JSON['stringify']([]));}}},'sizeX':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0xbd8f('0x9')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0xbd8f('0x9')]},'col':{'type':Sequelize[_0xbd8f('0x9')]},'background':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xbd8f('0xa'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0xbd8f('0xb')],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize['STRING']},'titleFontSize':{'type':Sequelize[_0xbd8f('0x9')],'defaultValue':0xc}}; \ No newline at end of file +var _0x33af=['attrs','setDataValue','stringify','INTEGER','#ffffff','squel','exports','STRING','TEXT','long','parse'];(function(_0x40119d,_0x1ed432){var _0x34f3fa=function(_0x46bcf3){while(--_0x46bcf3){_0x40119d['push'](_0x40119d['shift']());}};_0x34f3fa(++_0x1ed432);}(_0x33af,0xec));var _0xf33a=function(_0x194cb5,_0x479e8a){_0x194cb5=_0x194cb5-0x0;var _0x55db4b=_0x33af[_0x194cb5];return _0x55db4b;};'use strict';var Sequelize=require('sequelize');var squel=require(_0xf33a('0x0'));var _=require('lodash');module[_0xf33a('0x1')]={'title':{'type':Sequelize[_0xf33a('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xf33a('0x2')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0xf33a('0x3')](_0xf33a('0x4')),'get':function(){try{return JSON[_0xf33a('0x5')](this['getDataValue'](_0xf33a('0x6')));}catch(_0x44cfa5){return[];}},'set':function(_0x583e54){try{this[_0xf33a('0x7')](_0xf33a('0x6'),JSON[_0xf33a('0x8')](_0x583e54));}catch(_0x2f3730){this[_0xf33a('0x7')](_0xf33a('0x6'),JSON['stringify']([]));}}},'sizeX':{'type':Sequelize[_0xf33a('0x9')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0xf33a('0x9')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0xf33a('0x9')]},'col':{'type':Sequelize[_0xf33a('0x9')]},'background':{'type':Sequelize[_0xf33a('0x2')],'allowNull':![],'defaultValue':_0xf33a('0xa'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0xf33a('0x2')]},'titleFontSize':{'type':Sequelize[_0xf33a('0x9')],'defaultValue':0xc}}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.controller.js b/server/api/dashboardItem/dashboardItem.controller.js index 52d8480..694b441 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 _0x7923=['intersection','fields','length','query','merge','options','find','then','destroy','iframe','attrUrl','attrs','value','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrReport','reportType','type','attrRefresh','stringify','create','body','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','to-csv','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./dashboardItem.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','stack','name','send','show','params','model','keys','DashboardItem','rawAttributes','filters','attributes'];(function(_0x4eb3fc,_0x3b443b){var _0x2a8249=function(_0xf039e0){while(--_0xf039e0){_0x4eb3fc['push'](_0x4eb3fc['shift']());}};_0x2a8249(++_0x3b443b);}(_0x7923,0x8f));var _0x3792=function(_0x10e49c,_0x27e27b){_0x10e49c=_0x10e49c-0x0;var _0x87cf6a=_0x7923[_0x10e49c];return _0x87cf6a;};'use strict';var emlformat=require(_0x3792('0x0'));var rimraf=require(_0x3792('0x1'));var zipdir=require(_0x3792('0x2'));var jsonpatch=require(_0x3792('0x3'));var rp=require(_0x3792('0x4'));var moment=require(_0x3792('0x5'));var BPromise=require(_0x3792('0x6'));var Mustache=require('mustache');var util=require(_0x3792('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x3792('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3792('0x9'));var _=require(_0x3792('0xa'));var squel=require(_0x3792('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3792('0xc'));var toCsv=require(_0x3792('0x8'));var querystring=require('querystring');var Papa=require(_0x3792('0xd'));var Redis=require(_0x3792('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x3792('0xf'));var as=require(_0x3792('0x10'));var hardwareService=require(_0x3792('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x3792('0x12'));var config=require(_0x3792('0x13'));var licenseUtil=require(_0x3792('0x14'));var db=require(_0x3792('0x15'))['db'];config['redis']=_['defaults'](config[_0x3792('0x16')],{'host':_0x3792('0x17'),'port':0x18eb});var socket=require(_0x3792('0x18'))(new Redis(config[_0x3792('0x16')]));require(_0x3792('0x19'))[_0x3792('0x1a')](socket);function respondWithStatusCode(_0x41139d,_0x2dc722){_0x2dc722=_0x2dc722||0xcc;return function(_0x44398b){if(_0x44398b){return _0x41139d[_0x3792('0x1b')](_0x2dc722);}return _0x41139d[_0x3792('0x1c')](_0x2dc722)[_0x3792('0x1d')]();};}function respondWithResult(_0x4247cd,_0x26a4ba){_0x26a4ba=_0x26a4ba||0xc8;return function(_0x46653b){if(_0x46653b){return _0x4247cd[_0x3792('0x1c')](_0x26a4ba)[_0x3792('0x1e')](_0x46653b);}};}function respondWithFilteredResult(_0x4a8e1c,_0x24eb3c){return function(_0x2547d8){if(_0x2547d8){var _0xb69786=typeof _0x24eb3c[_0x3792('0x1f')]===_0x3792('0x20')&&typeof _0x24eb3c['limit']===_0x3792('0x20');var _0xc75467=_0x2547d8[_0x3792('0x21')];var _0x3c36b5=_0xb69786?0x0:_0x24eb3c[_0x3792('0x1f')];var _0x5647ac=_0xb69786?_0x2547d8['count']:_0x24eb3c[_0x3792('0x1f')]+_0x24eb3c[_0x3792('0x22')];var _0x4e0ba4;if(_0x5647ac>=_0xc75467){_0x5647ac=_0xc75467;_0x4e0ba4=0xc8;}else{_0x4e0ba4=0xce;}_0x4a8e1c[_0x3792('0x1c')](_0x4e0ba4);return _0x4a8e1c[_0x3792('0x23')](_0x3792('0x24'),_0x3c36b5+'-'+_0x5647ac+'/'+_0xc75467)['json'](_0x2547d8);}return null;};}function patchUpdates(_0x4ca818){return function(_0x2d1ab5){try{jsonpatch[_0x3792('0x25')](_0x2d1ab5,_0x4ca818,!![]);}catch(_0x3fa77a){return BPromise[_0x3792('0x26')](_0x3fa77a);}return _0x2d1ab5['save']();};}function saveUpdates(_0x515dc0,_0x48f41c){return function(_0x21c266){if(_0x21c266){return _0x21c266[_0x3792('0x27')](_0x515dc0)['then'](function(_0x530c04){return _0x530c04;});}return null;};}function removeEntity(_0x3bf510,_0x2328fe){return function(_0x401080){if(_0x401080){return _0x401080['destroy']()['then'](function(){_0x3bf510[_0x3792('0x1c')](0xcc)[_0x3792('0x1d')]();});}};}function handleEntityNotFound(_0x53369e,_0x483e79){return function(_0x7e2964){if(!_0x7e2964){_0x53369e[_0x3792('0x1b')](0x194);}return _0x7e2964;};}function handleError(_0x1334d2,_0x2908ab){_0x2908ab=_0x2908ab||0x1f4;return function(_0x4ca06c){logger['error'](_0x4ca06c[_0x3792('0x28')]);if(_0x4ca06c[_0x3792('0x29')]){delete _0x4ca06c[_0x3792('0x29')];}_0x1334d2[_0x3792('0x1c')](_0x2908ab)[_0x3792('0x2a')](_0x4ca06c);};}exports[_0x3792('0x2b')]=function(_0x2816e9,_0x44cc37){var _0xe83f5c={'raw':![],'where':{'id':_0x2816e9[_0x3792('0x2c')]['id']}},_0x4b2ba4={};_0x4b2ba4[_0x3792('0x2d')]=_[_0x3792('0x2e')](db[_0x3792('0x2f')][_0x3792('0x30')]);_0x4b2ba4['query']=_['keys'](_0x2816e9['query']);_0x4b2ba4[_0x3792('0x31')]=_['intersection'](_0x4b2ba4[_0x3792('0x2d')],_0x4b2ba4['query']);_0xe83f5c[_0x3792('0x32')]=_[_0x3792('0x33')](_0x4b2ba4[_0x3792('0x2d')],qs[_0x3792('0x34')](_0x2816e9['query'][_0x3792('0x34')]));_0xe83f5c['attributes']=_0xe83f5c['attributes'][_0x3792('0x35')]?_0xe83f5c[_0x3792('0x32')]:_0x4b2ba4[_0x3792('0x2d')];if(_0x2816e9[_0x3792('0x36')]['includeAll']){_0xe83f5c['include']=[{'all':!![]}];}_0xe83f5c=_[_0x3792('0x37')]({},_0xe83f5c,_0x2816e9[_0x3792('0x38')]);return db[_0x3792('0x2f')][_0x3792('0x39')](_0xe83f5c)[_0x3792('0x3a')](handleEntityNotFound(_0x44cc37,null))[_0x3792('0x3a')](respondWithResult(_0x44cc37,null))['catch'](handleError(_0x44cc37,null));};exports[_0x3792('0x3b')]=function(_0x46187c,_0x11c655){return db[_0x3792('0x2f')][_0x3792('0x39')]({'where':{'id':_0x46187c[_0x3792('0x2c')]['id']}})[_0x3792('0x3a')](handleEntityNotFound(_0x11c655,null))[_0x3792('0x3a')](removeEntity(_0x11c655,null))['catch'](handleError(_0x11c655,null));};function widgetAttributes(_0x5be5b7){try{switch(_0x5be5b7['type']){case _0x3792('0x3c'):return[{'name':_0x3792('0x3d'),'value':_0x5be5b7[_0x3792('0x3d')]||(_0x5be5b7['attrs']&&_0x5be5b7['attrs'][0x0]?_0x5be5b7[_0x3792('0x3e')][0x0][_0x3792('0x3f')]:undefined)||'https://'}];case _0x3792('0x40'):return[{'name':_0x3792('0x41'),'value':_0x5be5b7[_0x3792('0x41')]||(_0x5be5b7['attrs']&&_0x5be5b7[_0x3792('0x3e')][0x0]?_0x5be5b7['attrs'][0x0][_0x3792('0x3f')]:undefined)||''}];case _0x3792('0x42'):return[{'name':_0x3792('0x43'),'value':_0x5be5b7['attrHourFormat']||(_0x5be5b7[_0x3792('0x3e')]&&_0x5be5b7[_0x3792('0x3e')][0x0]?_0x5be5b7[_0x3792('0x3e')][0x0][_0x3792('0x3f')]:undefined)||_0x3792('0x44')},{'name':'attrTimezone','value':_0x5be5b7[_0x3792('0x45')]||(_0x5be5b7[_0x3792('0x3e')]&&_0x5be5b7[_0x3792('0x3e')][0x1]?_0x5be5b7[_0x3792('0x3e')][0x1]['value']:undefined)||_0x3792('0x46')},{'name':_0x3792('0x47'),'value':_0x5be5b7[_0x3792('0x47')]||(_0x5be5b7['attrs']&&_0x5be5b7[_0x3792('0x3e')][0x2]?_0x5be5b7[_0x3792('0x3e')][0x2][_0x3792('0x3f')]:undefined)||0xc}];case _0x3792('0x48'):return[{'name':_0x3792('0x49'),'value':_0x5be5b7[_0x3792('0x49')]||(_0x5be5b7[_0x3792('0x3e')]&&_0x5be5b7[_0x3792('0x3e')][0x0]?_0x5be5b7[_0x3792('0x3e')][0x0][_0x3792('0x3f')]:undefined)||_0x3792('0x4a')},{'name':_0x3792('0x4b'),'value':_0x5be5b7[_0x3792('0x4b')]||(_0x5be5b7[_0x3792('0x3e')]&&_0x5be5b7[_0x3792('0x3e')][0x1]?_0x5be5b7[_0x3792('0x3e')][0x1][_0x3792('0x3f')]:undefined)||[]},{'name':_0x3792('0x47'),'value':_0x5be5b7[_0x3792('0x47')]||(_0x5be5b7[_0x3792('0x3e')]&&_0x5be5b7[_0x3792('0x3e')][0x2]?_0x5be5b7[_0x3792('0x3e')][0x2]['value']:undefined)||0x14},{'name':_0x3792('0x4c'),'value':_0x5be5b7['attrChannel']||(_0x5be5b7[_0x3792('0x3e')]&&_0x5be5b7[_0x3792('0x3e')][0x3]?_0x5be5b7[_0x3792('0x3e')][0x3]['value']:undefined)||_0x3792('0x4d')},{'name':_0x3792('0x4e'),'value':_0x5be5b7['attrEmailAccounts']||(_0x5be5b7[_0x3792('0x3e')]&&_0x5be5b7[_0x3792('0x3e')][0x4]?_0x5be5b7[_0x3792('0x3e')][0x4][_0x3792('0x3f')]:undefined)||''},{'name':_0x3792('0x4f'),'value':_0x5be5b7[_0x3792('0x4f')]||(_0x5be5b7[_0x3792('0x3e')]&&_0x5be5b7[_0x3792('0x3e')][0x5]?_0x5be5b7[_0x3792('0x3e')][0x5][_0x3792('0x3f')]:undefined)||''},{'name':_0x3792('0x50'),'value':_0x5be5b7[_0x3792('0x50')]||(_0x5be5b7[_0x3792('0x3e')]&&_0x5be5b7[_0x3792('0x3e')][0x6]?_0x5be5b7[_0x3792('0x3e')][0x6][_0x3792('0x3f')]:undefined)||''},{'name':_0x3792('0x51'),'value':_0x5be5b7[_0x3792('0x51')]||(_0x5be5b7[_0x3792('0x3e')]&&_0x5be5b7[_0x3792('0x3e')][0x7]?_0x5be5b7[_0x3792('0x3e')][0x7][_0x3792('0x3f')]:undefined)||''},{'name':_0x3792('0x52'),'value':_0x5be5b7[_0x3792('0x52')]||(_0x5be5b7[_0x3792('0x3e')]&&_0x5be5b7['attrs'][0x8]?_0x5be5b7['attrs'][0x8]['value']:undefined)||''},{'name':_0x3792('0x53'),'value':_0x5be5b7[_0x3792('0x53')]||(_0x5be5b7[_0x3792('0x3e')]&&_0x5be5b7['attrs'][0x9]?_0x5be5b7[_0x3792('0x3e')][0x9][_0x3792('0x3f')]:undefined)||''}];case _0x3792('0x54'):case _0x3792('0x55'):return[{'name':_0x3792('0x56'),'value':_0x5be5b7['attrSerie1']||(_0x5be5b7[_0x3792('0x3e')]&&_0x5be5b7[_0x3792('0x3e')][0x0]?_0x5be5b7[_0x3792('0x3e')][0x0][_0x3792('0x3f')]:undefined)||'total'},{'name':_0x3792('0x57'),'value':_0x5be5b7[_0x3792('0x57')]||(_0x5be5b7[_0x3792('0x3e')]&&_0x5be5b7[_0x3792('0x3e')][0x1]?_0x5be5b7['attrs'][0x1]['value']:undefined)||null},{'name':'attrSerie3','value':_0x5be5b7[_0x3792('0x58')]||(_0x5be5b7['attrs']&&_0x5be5b7[_0x3792('0x3e')][0x2]?_0x5be5b7['attrs'][0x2]['value']:undefined)||null},{'name':'attrVoiceQueues','value':_0x5be5b7['attrVoiceQueues']||(_0x5be5b7[_0x3792('0x3e')]&&_0x5be5b7[_0x3792('0x3e')][0x3]?_0x5be5b7[_0x3792('0x3e')][0x3]['value']:undefined)||[]},{'name':_0x3792('0x4c'),'value':_0x5be5b7[_0x3792('0x4c')]||(_0x5be5b7['attrs']&&_0x5be5b7[_0x3792('0x3e')][0x4]?_0x5be5b7[_0x3792('0x3e')][0x4][_0x3792('0x3f')]:undefined)||_0x3792('0x4d')},{'name':_0x3792('0x4e'),'value':_0x5be5b7[_0x3792('0x4e')]||(_0x5be5b7[_0x3792('0x3e')]&&_0x5be5b7[_0x3792('0x3e')][0x5]?_0x5be5b7['attrs'][0x5][_0x3792('0x3f')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x5be5b7['attrFaxAccounts']||(_0x5be5b7[_0x3792('0x3e')]&&_0x5be5b7[_0x3792('0x3e')][0x6]?_0x5be5b7[_0x3792('0x3e')][0x6][_0x3792('0x3f')]:undefined)||''},{'name':_0x3792('0x50'),'value':_0x5be5b7[_0x3792('0x50')]||(_0x5be5b7[_0x3792('0x3e')]&&_0x5be5b7[_0x3792('0x3e')][0x7]?_0x5be5b7['attrs'][0x7][_0x3792('0x3f')]:undefined)||''},{'name':_0x3792('0x51'),'value':_0x5be5b7[_0x3792('0x51')]||(_0x5be5b7[_0x3792('0x3e')]&&_0x5be5b7['attrs'][0x8]?_0x5be5b7[_0x3792('0x3e')][0x8][_0x3792('0x3f')]:undefined)||''},{'name':_0x3792('0x52'),'value':_0x5be5b7['attrWhatsappAccounts']||(_0x5be5b7['attrs']&&_0x5be5b7[_0x3792('0x3e')][0x9]?_0x5be5b7[_0x3792('0x3e')][0x9][_0x3792('0x3f')]:undefined)||''},{'name':'attrChatWebsites','value':_0x5be5b7[_0x3792('0x53')]||(_0x5be5b7[_0x3792('0x3e')]&&_0x5be5b7[_0x3792('0x3e')][0xa]?_0x5be5b7[_0x3792('0x3e')][0xa][_0x3792('0x3f')]:undefined)||''}];case'web-report':return[{'name':_0x3792('0x59'),'type':_0x5be5b7[_0x3792('0x5a')]||(_0x5be5b7[_0x3792('0x3e')]&&_0x5be5b7[_0x3792('0x3e')][0x0]?_0x5be5b7['attrs'][0x0][_0x3792('0x5b')]:undefined)||null,'value':_0x5be5b7[_0x3792('0x59')]||(_0x5be5b7[_0x3792('0x3e')]&&_0x5be5b7['attrs'][0x0]?_0x5be5b7['attrs'][0x0]['value']:undefined)||null},{'name':_0x3792('0x5c'),'value':_0x5be5b7[_0x3792('0x5c')]||(_0x5be5b7[_0x3792('0x3e')]&&_0x5be5b7[_0x3792('0x3e')][0x1]?_0x5be5b7['attrs'][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x32f563){logger['error']('widgetAttributes:\x20%s',JSON[_0x3792('0x5d')](_0x32f563));return[];}}exports[_0x3792('0x5e')]=function(_0x3ecab6,_0x3632ac){if(_0x3ecab6[_0x3792('0x5f')]){_0x3ecab6[_0x3792('0x5f')][_0x3792('0x3e')]=widgetAttributes(_0x3ecab6[_0x3792('0x5f')]);}return db[_0x3792('0x2f')][_0x3792('0x5e')](_0x3ecab6['body'],{})['then'](respondWithResult(_0x3632ac,0xc9))[_0x3792('0x60')](handleError(_0x3632ac,null));};exports['update']=function(_0x33d0bc,_0x53b379){if(_0x33d0bc[_0x3792('0x5f')]['id']){delete _0x33d0bc[_0x3792('0x5f')]['id'];}_0x33d0bc[_0x3792('0x5f')][_0x3792('0x3e')]=widgetAttributes(_0x33d0bc['body']);return db['DashboardItem'][_0x3792('0x39')]({'where':{'id':_0x33d0bc[_0x3792('0x2c')]['id']}})['then'](handleEntityNotFound(_0x53b379,null))[_0x3792('0x3a')](saveUpdates(_0x33d0bc['body'],null))['then'](respondWithResult(_0x53b379,null))['catch'](handleError(_0x53b379,null));}; \ No newline at end of file +var _0xdc86=['ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','socket.io-emitter','redis','./dashboardItem.socket','sendStatus','status','end','offset','count','limit','set','Content-Range','json','apply','save','update','destroy','then','stack','name','send','show','model','rawAttributes','query','keys','intersection','fields','attributes','length','merge','DashboardItem','find','catch','params','type','iframe','attrUrl','attrs','value','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','counter','attrMetric','total','attrVoiceQueues','attrFontSize','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrChatWebsites','multibar-chart','attrSerie1','attrSerie3','attrOpenchannelAccounts','attrWhatsappAccounts','web-report','attrReport','reportType','attrRefresh','error','stringify','create','body','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','to-csv'];(function(_0x3fb875,_0x5b6071){var _0x58d97e=function(_0xd06db8){while(--_0xd06db8){_0x3fb875['push'](_0x3fb875['shift']());}};_0x58d97e(++_0x5b6071);}(_0xdc86,0x118));var _0x6dc8=function(_0x3070dc,_0x40cf11){_0x3070dc=_0x3070dc-0x0;var _0x431489=_0xdc86[_0x3070dc];return _0x431489;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6dc8('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6dc8('0x1'));var rp=require('request-promise');var moment=require(_0x6dc8('0x2'));var BPromise=require(_0x6dc8('0x3'));var Mustache=require(_0x6dc8('0x4'));var util=require(_0x6dc8('0x5'));var path=require(_0x6dc8('0x6'));var sox=require('sox');var csv=require(_0x6dc8('0x7'));var ejs=require(_0x6dc8('0x8'));var fs=require('fs');var fs_extra=require(_0x6dc8('0x9'));var _=require(_0x6dc8('0xa'));var squel=require(_0x6dc8('0xb'));var crypto=require(_0x6dc8('0xc'));var jsforce=require(_0x6dc8('0xd'));var deskjs=require(_0x6dc8('0xe'));var toCsv=require('to-csv');var querystring=require(_0x6dc8('0xf'));var Papa=require('papaparse');var Redis=require(_0x6dc8('0x10'));var authService=require(_0x6dc8('0x11'));var qs=require(_0x6dc8('0x12'));var as=require(_0x6dc8('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6dc8('0x14'))(_0x6dc8('0x15'));var utils=require(_0x6dc8('0x16'));var config=require(_0x6dc8('0x17'));var licenseUtil=require(_0x6dc8('0x18'));var db=require(_0x6dc8('0x19'))['db'];config['redis']=_[_0x6dc8('0x1a')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x6dc8('0x1b'))(new Redis(config[_0x6dc8('0x1c')]));require(_0x6dc8('0x1d'))['register'](socket);function respondWithStatusCode(_0x23acc6,_0xfe3af3){_0xfe3af3=_0xfe3af3||0xcc;return function(_0xa4d1cf){if(_0xa4d1cf){return _0x23acc6[_0x6dc8('0x1e')](_0xfe3af3);}return _0x23acc6[_0x6dc8('0x1f')](_0xfe3af3)[_0x6dc8('0x20')]();};}function respondWithResult(_0x351c11,_0x29a9f7){_0x29a9f7=_0x29a9f7||0xc8;return function(_0x34428a){if(_0x34428a){return _0x351c11['status'](_0x29a9f7)['json'](_0x34428a);}};}function respondWithFilteredResult(_0x2702c5,_0x396efc){return function(_0x209ae4){if(_0x209ae4){var _0x3c8a6d=typeof _0x396efc[_0x6dc8('0x21')]==='undefined'&&typeof _0x396efc['limit']==='undefined';var _0x2247c4=_0x209ae4['count'];var _0xdc910d=_0x3c8a6d?0x0:_0x396efc['offset'];var _0x3cd3ce=_0x3c8a6d?_0x209ae4[_0x6dc8('0x22')]:_0x396efc[_0x6dc8('0x21')]+_0x396efc[_0x6dc8('0x23')];var _0x1949be;if(_0x3cd3ce>=_0x2247c4){_0x3cd3ce=_0x2247c4;_0x1949be=0xc8;}else{_0x1949be=0xce;}_0x2702c5[_0x6dc8('0x1f')](_0x1949be);return _0x2702c5[_0x6dc8('0x24')](_0x6dc8('0x25'),_0xdc910d+'-'+_0x3cd3ce+'/'+_0x2247c4)[_0x6dc8('0x26')](_0x209ae4);}return null;};}function patchUpdates(_0x5526cd){return function(_0x2cc8db){try{jsonpatch[_0x6dc8('0x27')](_0x2cc8db,_0x5526cd,!![]);}catch(_0x30afb5){return BPromise['reject'](_0x30afb5);}return _0x2cc8db[_0x6dc8('0x28')]();};}function saveUpdates(_0x5c78db,_0x125df7){return function(_0x3309fa){if(_0x3309fa){return _0x3309fa[_0x6dc8('0x29')](_0x5c78db)['then'](function(_0x56895f){return _0x56895f;});}return null;};}function removeEntity(_0x1983f8,_0x14ec58){return function(_0x57ce0a){if(_0x57ce0a){return _0x57ce0a[_0x6dc8('0x2a')]()[_0x6dc8('0x2b')](function(){_0x1983f8[_0x6dc8('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x49ece3,_0x2163e7){return function(_0x15d815){if(!_0x15d815){_0x49ece3['sendStatus'](0x194);}return _0x15d815;};}function handleError(_0x3c12a4,_0x5889e3){_0x5889e3=_0x5889e3||0x1f4;return function(_0x482cc6){logger['error'](_0x482cc6[_0x6dc8('0x2c')]);if(_0x482cc6[_0x6dc8('0x2d')]){delete _0x482cc6[_0x6dc8('0x2d')];}_0x3c12a4[_0x6dc8('0x1f')](_0x5889e3)[_0x6dc8('0x2e')](_0x482cc6);};}exports[_0x6dc8('0x2f')]=function(_0x186f36,_0x437671){var _0x38b4ff={'raw':![],'where':{'id':_0x186f36['params']['id']}},_0x25c6ab={};_0x25c6ab[_0x6dc8('0x30')]=_['keys'](db['DashboardItem'][_0x6dc8('0x31')]);_0x25c6ab[_0x6dc8('0x32')]=_[_0x6dc8('0x33')](_0x186f36[_0x6dc8('0x32')]);_0x25c6ab['filters']=_[_0x6dc8('0x34')](_0x25c6ab['model'],_0x25c6ab[_0x6dc8('0x32')]);_0x38b4ff['attributes']=_[_0x6dc8('0x34')](_0x25c6ab[_0x6dc8('0x30')],qs['fields'](_0x186f36[_0x6dc8('0x32')][_0x6dc8('0x35')]));_0x38b4ff['attributes']=_0x38b4ff[_0x6dc8('0x36')][_0x6dc8('0x37')]?_0x38b4ff[_0x6dc8('0x36')]:_0x25c6ab[_0x6dc8('0x30')];if(_0x186f36[_0x6dc8('0x32')]['includeAll']){_0x38b4ff['include']=[{'all':!![]}];}_0x38b4ff=_[_0x6dc8('0x38')]({},_0x38b4ff,_0x186f36['options']);return db[_0x6dc8('0x39')][_0x6dc8('0x3a')](_0x38b4ff)['then'](handleEntityNotFound(_0x437671,null))['then'](respondWithResult(_0x437671,null))[_0x6dc8('0x3b')](handleError(_0x437671,null));};exports['destroy']=function(_0x143460,_0x21dc4e){return db[_0x6dc8('0x39')][_0x6dc8('0x3a')]({'where':{'id':_0x143460[_0x6dc8('0x3c')]['id']}})[_0x6dc8('0x2b')](handleEntityNotFound(_0x21dc4e,null))[_0x6dc8('0x2b')](removeEntity(_0x21dc4e,null))['catch'](handleError(_0x21dc4e,null));};function widgetAttributes(_0x1dd44c){try{switch(_0x1dd44c[_0x6dc8('0x3d')]){case _0x6dc8('0x3e'):return[{'name':_0x6dc8('0x3f'),'value':_0x1dd44c[_0x6dc8('0x3f')]||(_0x1dd44c[_0x6dc8('0x40')]&&_0x1dd44c[_0x6dc8('0x40')][0x0]?_0x1dd44c[_0x6dc8('0x40')][0x0][_0x6dc8('0x41')]:undefined)||'https://'}];case'custom':return[{'name':_0x6dc8('0x42'),'value':_0x1dd44c[_0x6dc8('0x42')]||(_0x1dd44c['attrs']&&_0x1dd44c[_0x6dc8('0x40')][0x0]?_0x1dd44c[_0x6dc8('0x40')][0x0][_0x6dc8('0x41')]:undefined)||''}];case _0x6dc8('0x43'):return[{'name':_0x6dc8('0x44'),'value':_0x1dd44c[_0x6dc8('0x44')]||(_0x1dd44c[_0x6dc8('0x40')]&&_0x1dd44c[_0x6dc8('0x40')][0x0]?_0x1dd44c[_0x6dc8('0x40')][0x0][_0x6dc8('0x41')]:undefined)||_0x6dc8('0x45')},{'name':_0x6dc8('0x46'),'value':_0x1dd44c[_0x6dc8('0x46')]||(_0x1dd44c[_0x6dc8('0x40')]&&_0x1dd44c[_0x6dc8('0x40')][0x1]?_0x1dd44c[_0x6dc8('0x40')][0x1][_0x6dc8('0x41')]:undefined)||_0x6dc8('0x47')},{'name':'attrFontSize','value':_0x1dd44c['attrFontSize']||(_0x1dd44c[_0x6dc8('0x40')]&&_0x1dd44c[_0x6dc8('0x40')][0x2]?_0x1dd44c[_0x6dc8('0x40')][0x2][_0x6dc8('0x41')]:undefined)||0xc}];case _0x6dc8('0x48'):return[{'name':_0x6dc8('0x49'),'value':_0x1dd44c[_0x6dc8('0x49')]||(_0x1dd44c[_0x6dc8('0x40')]&&_0x1dd44c[_0x6dc8('0x40')][0x0]?_0x1dd44c['attrs'][0x0][_0x6dc8('0x41')]:undefined)||_0x6dc8('0x4a')},{'name':_0x6dc8('0x4b'),'value':_0x1dd44c[_0x6dc8('0x4b')]||(_0x1dd44c[_0x6dc8('0x40')]&&_0x1dd44c['attrs'][0x1]?_0x1dd44c[_0x6dc8('0x40')][0x1]['value']:undefined)||[]},{'name':_0x6dc8('0x4c'),'value':_0x1dd44c['attrFontSize']||(_0x1dd44c['attrs']&&_0x1dd44c['attrs'][0x2]?_0x1dd44c['attrs'][0x2][_0x6dc8('0x41')]:undefined)||0x14},{'name':_0x6dc8('0x4d'),'value':_0x1dd44c[_0x6dc8('0x4d')]||(_0x1dd44c[_0x6dc8('0x40')]&&_0x1dd44c[_0x6dc8('0x40')][0x3]?_0x1dd44c[_0x6dc8('0x40')][0x3][_0x6dc8('0x41')]:undefined)||_0x6dc8('0x4e')},{'name':_0x6dc8('0x4f'),'value':_0x1dd44c[_0x6dc8('0x4f')]||(_0x1dd44c['attrs']&&_0x1dd44c['attrs'][0x4]?_0x1dd44c[_0x6dc8('0x40')][0x4][_0x6dc8('0x41')]:undefined)||''},{'name':_0x6dc8('0x50'),'value':_0x1dd44c[_0x6dc8('0x50')]||(_0x1dd44c[_0x6dc8('0x40')]&&_0x1dd44c[_0x6dc8('0x40')][0x5]?_0x1dd44c[_0x6dc8('0x40')][0x5][_0x6dc8('0x41')]:undefined)||''},{'name':_0x6dc8('0x51'),'value':_0x1dd44c['attrSmsAccounts']||(_0x1dd44c[_0x6dc8('0x40')]&&_0x1dd44c[_0x6dc8('0x40')][0x6]?_0x1dd44c[_0x6dc8('0x40')][0x6][_0x6dc8('0x41')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x1dd44c['attrOpenchannelAccounts']||(_0x1dd44c[_0x6dc8('0x40')]&&_0x1dd44c['attrs'][0x7]?_0x1dd44c[_0x6dc8('0x40')][0x7][_0x6dc8('0x41')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x1dd44c['attrWhatsappAccounts']||(_0x1dd44c['attrs']&&_0x1dd44c[_0x6dc8('0x40')][0x8]?_0x1dd44c[_0x6dc8('0x40')][0x8][_0x6dc8('0x41')]:undefined)||''},{'name':'attrChatWebsites','value':_0x1dd44c[_0x6dc8('0x52')]||(_0x1dd44c[_0x6dc8('0x40')]&&_0x1dd44c[_0x6dc8('0x40')][0x9]?_0x1dd44c[_0x6dc8('0x40')][0x9][_0x6dc8('0x41')]:undefined)||''}];case _0x6dc8('0x53'):case'pie-chart':return[{'name':_0x6dc8('0x54'),'value':_0x1dd44c[_0x6dc8('0x54')]||(_0x1dd44c['attrs']&&_0x1dd44c[_0x6dc8('0x40')][0x0]?_0x1dd44c['attrs'][0x0]['value']:undefined)||_0x6dc8('0x4a')},{'name':'attrSerie2','value':_0x1dd44c['attrSerie2']||(_0x1dd44c[_0x6dc8('0x40')]&&_0x1dd44c[_0x6dc8('0x40')][0x1]?_0x1dd44c[_0x6dc8('0x40')][0x1]['value']:undefined)||null},{'name':_0x6dc8('0x55'),'value':_0x1dd44c['attrSerie3']||(_0x1dd44c[_0x6dc8('0x40')]&&_0x1dd44c[_0x6dc8('0x40')][0x2]?_0x1dd44c[_0x6dc8('0x40')][0x2][_0x6dc8('0x41')]:undefined)||null},{'name':_0x6dc8('0x4b'),'value':_0x1dd44c[_0x6dc8('0x4b')]||(_0x1dd44c['attrs']&&_0x1dd44c[_0x6dc8('0x40')][0x3]?_0x1dd44c[_0x6dc8('0x40')][0x3][_0x6dc8('0x41')]:undefined)||[]},{'name':_0x6dc8('0x4d'),'value':_0x1dd44c[_0x6dc8('0x4d')]||(_0x1dd44c[_0x6dc8('0x40')]&&_0x1dd44c['attrs'][0x4]?_0x1dd44c['attrs'][0x4][_0x6dc8('0x41')]:undefined)||_0x6dc8('0x4e')},{'name':_0x6dc8('0x4f'),'value':_0x1dd44c[_0x6dc8('0x4f')]||(_0x1dd44c[_0x6dc8('0x40')]&&_0x1dd44c[_0x6dc8('0x40')][0x5]?_0x1dd44c[_0x6dc8('0x40')][0x5]['value']:undefined)||''},{'name':_0x6dc8('0x50'),'value':_0x1dd44c[_0x6dc8('0x50')]||(_0x1dd44c[_0x6dc8('0x40')]&&_0x1dd44c['attrs'][0x6]?_0x1dd44c['attrs'][0x6][_0x6dc8('0x41')]:undefined)||''},{'name':_0x6dc8('0x51'),'value':_0x1dd44c['attrSmsAccounts']||(_0x1dd44c[_0x6dc8('0x40')]&&_0x1dd44c[_0x6dc8('0x40')][0x7]?_0x1dd44c[_0x6dc8('0x40')][0x7][_0x6dc8('0x41')]:undefined)||''},{'name':_0x6dc8('0x56'),'value':_0x1dd44c['attrOpenchannelAccounts']||(_0x1dd44c[_0x6dc8('0x40')]&&_0x1dd44c['attrs'][0x8]?_0x1dd44c['attrs'][0x8][_0x6dc8('0x41')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x1dd44c[_0x6dc8('0x57')]||(_0x1dd44c[_0x6dc8('0x40')]&&_0x1dd44c[_0x6dc8('0x40')][0x9]?_0x1dd44c[_0x6dc8('0x40')][0x9]['value']:undefined)||''},{'name':_0x6dc8('0x52'),'value':_0x1dd44c[_0x6dc8('0x52')]||(_0x1dd44c['attrs']&&_0x1dd44c[_0x6dc8('0x40')][0xa]?_0x1dd44c['attrs'][0xa][_0x6dc8('0x41')]:undefined)||''}];case _0x6dc8('0x58'):return[{'name':_0x6dc8('0x59'),'type':_0x1dd44c[_0x6dc8('0x5a')]||(_0x1dd44c['attrs']&&_0x1dd44c[_0x6dc8('0x40')][0x0]?_0x1dd44c['attrs'][0x0][_0x6dc8('0x3d')]:undefined)||null,'value':_0x1dd44c[_0x6dc8('0x59')]||(_0x1dd44c[_0x6dc8('0x40')]&&_0x1dd44c['attrs'][0x0]?_0x1dd44c[_0x6dc8('0x40')][0x0][_0x6dc8('0x41')]:undefined)||null},{'name':_0x6dc8('0x5b'),'value':_0x1dd44c['attrRefresh']||(_0x1dd44c[_0x6dc8('0x40')]&&_0x1dd44c['attrs'][0x1]?_0x1dd44c['attrs'][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x422fee){logger[_0x6dc8('0x5c')]('widgetAttributes:\x20%s',JSON[_0x6dc8('0x5d')](_0x422fee));return[];}}exports[_0x6dc8('0x5e')]=function(_0x4a27f5,_0x2590ac){if(_0x4a27f5['body']){_0x4a27f5[_0x6dc8('0x5f')][_0x6dc8('0x40')]=widgetAttributes(_0x4a27f5[_0x6dc8('0x5f')]);}return db[_0x6dc8('0x39')][_0x6dc8('0x5e')](_0x4a27f5[_0x6dc8('0x5f')],{})[_0x6dc8('0x2b')](respondWithResult(_0x2590ac,0xc9))[_0x6dc8('0x3b')](handleError(_0x2590ac,null));};exports['update']=function(_0x306a52,_0x27b144){if(_0x306a52[_0x6dc8('0x5f')]['id']){delete _0x306a52[_0x6dc8('0x5f')]['id'];}_0x306a52[_0x6dc8('0x5f')]['attrs']=widgetAttributes(_0x306a52['body']);return db[_0x6dc8('0x39')][_0x6dc8('0x3a')]({'where':{'id':_0x306a52[_0x6dc8('0x3c')]['id']}})[_0x6dc8('0x2b')](handleEntityNotFound(_0x27b144,null))['then'](saveUpdates(_0x306a52[_0x6dc8('0x5f')],null))['then'](respondWithResult(_0x27b144,null))['catch'](handleError(_0x27b144,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index e2bc1db..d5a2d03 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 _0x6427=['../../mysqldb','save','emit','hasOwnProperty','hook','events'];(function(_0x61e635,_0x16f4df){var _0x13e7c4=function(_0x465f33){while(--_0x465f33){_0x61e635['push'](_0x61e635['shift']());}};_0x13e7c4(++_0x16f4df);}(_0x6427,0x191));var _0x7642=function(_0x4e9628,_0x250573){_0x4e9628=_0x4e9628-0x0;var _0x27bc8c=_0x6427[_0x4e9628];return _0x27bc8c;};'use strict';var EventEmitter=require(_0x7642('0x0'));var DashboardItem=require(_0x7642('0x1'))['db']['DashboardItem'];var DashboardItemEvents=new EventEmitter();DashboardItemEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x7642('0x2'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x5404d4){return function(_0x849593,_0x47ffca,_0x45f6d3){DashboardItemEvents[_0x7642('0x3')](_0x5404d4+':'+_0x849593['id'],_0x849593);DashboardItemEvents['emit'](_0x5404d4,_0x849593);_0x45f6d3(null);};}for(var e in events){if(events[_0x7642('0x4')](e)){var event=events[e];DashboardItem[_0x7642('0x5')](e,emitEvent(event));}}module['exports']=DashboardItemEvents; \ No newline at end of file +var _0x2b63=['events','../../mysqldb','update','emit','hasOwnProperty','hook'];(function(_0x263f4c,_0x438626){var _0x3a78d3=function(_0xbdb00f){while(--_0xbdb00f){_0x263f4c['push'](_0x263f4c['shift']());}};_0x3a78d3(++_0x438626);}(_0x2b63,0x1d4));var _0x32b6=function(_0x5ab554,_0x56b60a){_0x5ab554=_0x5ab554-0x0;var _0x55f7b9=_0x2b63[_0x5ab554];return _0x55f7b9;};'use strict';var EventEmitter=require(_0x32b6('0x0'));var DashboardItem=require(_0x32b6('0x1'))['db']['DashboardItem'];var DashboardItemEvents=new EventEmitter();DashboardItemEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x32b6('0x2'),'afterDestroy':'remove'};function emitEvent(_0x215b1b){return function(_0x3860d9,_0x599fb8,_0x1c9fa4){DashboardItemEvents['emit'](_0x215b1b+':'+_0x3860d9['id'],_0x3860d9);DashboardItemEvents[_0x32b6('0x3')](_0x215b1b,_0x3860d9);_0x1c9fa4(null);};}for(var e in events){if(events[_0x32b6('0x4')](e)){var event=events[e];DashboardItem[_0x32b6('0x5')](e,emitEvent(event));}}module['exports']=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index ec14707..c744a29 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 _0xd2b4=['DashboardItem','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./dashboardItem.attributes','exports'];(function(_0xa46696,_0x31968d){var _0x5bca82=function(_0x386e72){while(--_0x386e72){_0xa46696['push'](_0xa46696['shift']());}};_0x5bca82(++_0x31968d);}(_0xd2b4,0xa6));var _0x4d2b=function(_0x496333,_0x1c47d6){_0x496333=_0x496333-0x0;var _0x44256e=_0xd2b4[_0x496333];return _0x44256e;};'use strict';var _=require('lodash');var util=require(_0x4d2b('0x0'));var logger=require('../../config/logger')(_0x4d2b('0x1'));var moment=require(_0x4d2b('0x2'));var BPromise=require(_0x4d2b('0x3'));var rp=require(_0x4d2b('0x4'));var fs=require('fs');var path=require(_0x4d2b('0x5'));var rimraf=require(_0x4d2b('0x6'));var config=require(_0x4d2b('0x7'));var attributes=require(_0x4d2b('0x8'));module[_0x4d2b('0x9')]=function(_0x168b12,_0x5d1f36){return _0x168b12['define'](_0x4d2b('0xa'),attributes,{'tableName':'dashboard_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf511=['path','rimraf','../../config/environment','dashboard_items','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x5f2d31,_0x4a7572){var _0x39f6e8=function(_0x4f87e5){while(--_0x4f87e5){_0x5f2d31['push'](_0x5f2d31['shift']());}};_0x39f6e8(++_0x4a7572);}(_0xf511,0x19b));var _0x1f51=function(_0xc87d08,_0x59c9be){_0xc87d08=_0xc87d08-0x0;var _0x30a714=_0xf511[_0xc87d08];return _0x30a714;};'use strict';var _=require(_0x1f51('0x0'));var util=require(_0x1f51('0x1'));var logger=require(_0x1f51('0x2'))(_0x1f51('0x3'));var moment=require(_0x1f51('0x4'));var BPromise=require(_0x1f51('0x5'));var rp=require(_0x1f51('0x6'));var fs=require('fs');var path=require(_0x1f51('0x7'));var rimraf=require(_0x1f51('0x8'));var config=require(_0x1f51('0x9'));var attributes=require('./dashboardItem.attributes');module['exports']=function(_0x2893d7,_0x5af5d0){return _0x2893d7['define']('DashboardItem',attributes,{'tableName':_0x1f51('0xa'),'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 f5e361d..e6f6323 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 _0x8ae5=['DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','register','then','info','DashboardItem,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x3227a6,_0x4b3c0c){var _0x165d7c=function(_0x1a9c78){while(--_0x1a9c78){_0x3227a6['push'](_0x3227a6['shift']());}};_0x165d7c(++_0x4b3c0c);}(_0x8ae5,0x72));var _0x58ae=function(_0xd19e44,_0x306aea){_0xd19e44=_0xd19e44-0x0;var _0x4d670b=_0x8ae5[_0xd19e44];return _0x4d670b;};'use strict';var _=require(_0x58ae('0x0'));var util=require('util');var moment=require(_0x58ae('0x1'));var BPromise=require(_0x58ae('0x2'));var rs=require(_0x58ae('0x3'));var fs=require('fs');var Redis=require(_0x58ae('0x4'));var db=require(_0x58ae('0x5'))['db'];var utils=require(_0x58ae('0x6'));var logger=require('../../config/logger')(_0x58ae('0x7'));var config=require('../../config/environment');var jayson=require(_0x58ae('0x8'));var client=jayson[_0x58ae('0x9')]['http']({'port':0x232a});config[_0x58ae('0xa')]=_[_0x58ae('0xb')](config['redis'],{'host':_0x58ae('0xc'),'port':0x18eb});var socket=require(_0x58ae('0xd'))(new Redis(config[_0x58ae('0xa')]));require(_0x58ae('0xe'))[_0x58ae('0xf')](socket);function respondWithRpcPromise(_0x41d0e8,_0x36c1c5,_0x14c225){return new BPromise(function(_0x457e95,_0x5d3084){return client['request'](_0x41d0e8,_0x14c225)[_0x58ae('0x10')](function(_0x2353a6){logger[_0x58ae('0x11')](_0x58ae('0x12'),_0x36c1c5,_0x58ae('0x13'));logger[_0x58ae('0x14')](_0x58ae('0x15'),_0x36c1c5,'request\x20sent',JSON[_0x58ae('0x16')](_0x2353a6));if(_0x2353a6[_0x58ae('0x17')]){if(_0x2353a6[_0x58ae('0x17')][_0x58ae('0x18')]===0x1f4){logger['error'](_0x58ae('0x12'),_0x36c1c5,_0x2353a6[_0x58ae('0x17')][_0x58ae('0x19')]);return _0x5d3084(_0x2353a6[_0x58ae('0x17')][_0x58ae('0x19')]);}logger[_0x58ae('0x17')](_0x58ae('0x12'),_0x36c1c5,_0x2353a6[_0x58ae('0x17')][_0x58ae('0x19')]);return _0x457e95(_0x2353a6[_0x58ae('0x17')][_0x58ae('0x19')]);}else{logger[_0x58ae('0x11')](_0x58ae('0x12'),_0x36c1c5,_0x58ae('0x13'));_0x457e95(_0x2353a6['result']['message']);}})[_0x58ae('0x1a')](function(_0x11db91){logger[_0x58ae('0x17')](_0x58ae('0x12'),_0x36c1c5,_0x11db91);_0x5d3084(_0x11db91);});});} \ No newline at end of file +var _0xc088=['message','DashboardItem,\x20%s,\x20%s','request\x20sent','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','./dashboardItem.socket','request','info','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x29632e,_0x5ecba4){var _0x426e04=function(_0x4eb357){while(--_0x4eb357){_0x29632e['push'](_0x29632e['shift']());}};_0x426e04(++_0x5ecba4);}(_0xc088,0xfd));var _0x8c08=function(_0x52d898,_0x91fa8){_0x52d898=_0x52d898-0x0;var _0x1645cc=_0xc088[_0x52d898];return _0x1645cc;};'use strict';var _=require(_0x8c08('0x0'));var util=require(_0x8c08('0x1'));var moment=require(_0x8c08('0x2'));var BPromise=require(_0x8c08('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8c08('0x4'));var db=require(_0x8c08('0x5'))['db'];var utils=require(_0x8c08('0x6'));var logger=require(_0x8c08('0x7'))(_0x8c08('0x8'));var config=require(_0x8c08('0x9'));var jayson=require(_0x8c08('0xa'));var client=jayson['client']['http']({'port':0x232a});config[_0x8c08('0xb')]=_[_0x8c08('0xc')](config[_0x8c08('0xb')],{'host':_0x8c08('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x8c08('0xe'))['register'](socket);function respondWithRpcPromise(_0x45b466,_0x44affc,_0x489995){return new BPromise(function(_0xb3fdf6,_0x3acf03){return client[_0x8c08('0xf')](_0x45b466,_0x489995)['then'](function(_0xa9a4a5){logger[_0x8c08('0x10')]('DashboardItem,\x20%s,\x20%s',_0x44affc,'request\x20sent');logger[_0x8c08('0x11')](_0x8c08('0x12'),_0x44affc,'request\x20sent',JSON[_0x8c08('0x13')](_0xa9a4a5));if(_0xa9a4a5[_0x8c08('0x14')]){if(_0xa9a4a5[_0x8c08('0x14')][_0x8c08('0x15')]===0x1f4){logger[_0x8c08('0x14')]('DashboardItem,\x20%s,\x20%s',_0x44affc,_0xa9a4a5['error'][_0x8c08('0x16')]);return _0x3acf03(_0xa9a4a5[_0x8c08('0x14')][_0x8c08('0x16')]);}logger[_0x8c08('0x14')](_0x8c08('0x17'),_0x44affc,_0xa9a4a5[_0x8c08('0x14')]['message']);return _0xb3fdf6(_0xa9a4a5[_0x8c08('0x14')][_0x8c08('0x16')]);}else{logger['info'](_0x8c08('0x17'),_0x44affc,_0x8c08('0x18'));_0xb3fdf6(_0xa9a4a5['result']['message']);}})['catch'](function(_0x2d7889){logger['error'](_0x8c08('0x17'),_0x44affc,_0x2d7889);_0x3acf03(_0x2d7889);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index 4a52b37..f37a0fb 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 _0xd599=['remove','update','removeListener','register','length','dashboardItem:','./dashboardItem.events','save'];(function(_0x18fe54,_0xff789){var _0xccb1ee=function(_0x513cf3){while(--_0x513cf3){_0x18fe54['push'](_0x18fe54['shift']());}};_0xccb1ee(++_0xff789);}(_0xd599,0x19e));var _0x9d59=function(_0x144017,_0x56680b){_0x144017=_0x144017-0x0;var _0x4aee58=_0xd599[_0x144017];return _0x4aee58;};'use strict';var DashboardItemEvents=require(_0x9d59('0x0'));var events=[_0x9d59('0x1'),_0x9d59('0x2'),_0x9d59('0x3')];function createListener(_0x18a54c,_0x3ffd62){return function(_0x21adac){_0x3ffd62['emit'](_0x18a54c,_0x21adac);};}function removeListener(_0x5e3c21,_0x4aaa8e){return function(){DashboardItemEvents[_0x9d59('0x4')](_0x5e3c21,_0x4aaa8e);};}exports[_0x9d59('0x5')]=function(_0x10c952){for(var _0x1f6fa9=0x0,_0x905c54=events[_0x9d59('0x6')];_0x1f6fa9<_0x905c54;_0x1f6fa9++){var _0x4ef7ff=events[_0x1f6fa9];var _0x1b7696=createListener(_0x9d59('0x7')+_0x4ef7ff,_0x10c952);DashboardItemEvents['on'](_0x4ef7ff,_0x1b7696);}}; \ No newline at end of file +var _0x1de9=['register','length','dashboardItem:','./dashboardItem.events','save','remove','update','removeListener'];(function(_0x50da78,_0x37c5b0){var _0x2af5ae=function(_0x368c59){while(--_0x368c59){_0x50da78['push'](_0x50da78['shift']());}};_0x2af5ae(++_0x37c5b0);}(_0x1de9,0x12b));var _0x91de=function(_0x22685c,_0x478276){_0x22685c=_0x22685c-0x0;var _0x429490=_0x1de9[_0x22685c];return _0x429490;};'use strict';var DashboardItemEvents=require(_0x91de('0x0'));var events=[_0x91de('0x1'),_0x91de('0x2'),_0x91de('0x3')];function createListener(_0x5cc01f,_0x18b60e){return function(_0x1401b0){_0x18b60e['emit'](_0x5cc01f,_0x1401b0);};}function removeListener(_0x596ec0,_0x5a86d1){return function(){DashboardItemEvents[_0x91de('0x4')](_0x596ec0,_0x5a86d1);};}exports[_0x91de('0x5')]=function(_0x38f359){for(var _0x1a16f0=0x0,_0x41751b=events[_0x91de('0x6')];_0x1a16f0<_0x41751b;_0x1a16f0++){var _0x4e943a=events[_0x1a16f0];var _0x1be83f=createListener(_0x91de('0x7')+_0x4e943a,_0x38f359);DashboardItemEvents['on'](_0x4e943a,_0x1be83f);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index 91c4a3a..044c5c9 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 _0x1505=['isAuthenticated','show','create','put','update','delete','destroy','multer','path','express','Router','../../config/environment','./dashboardItem.controller','get','/:id'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x1505,0x1d8));var _0x5150=function(_0x547976,_0x2da222){_0x547976=_0x547976-0x0;var _0x4dd7c4=_0x1505[_0x547976];return _0x4dd7c4;};'use strict';var multer=require(_0x5150('0x0'));var util=require('util');var path=require(_0x5150('0x1'));var timeout=require('connect-timeout');var express=require(_0x5150('0x2'));var router=express[_0x5150('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x5150('0x4'));var controller=require(_0x5150('0x5'));router[_0x5150('0x6')](_0x5150('0x7'),auth[_0x5150('0x8')](),controller[_0x5150('0x9')]);router['post']('/',auth[_0x5150('0x8')](),controller[_0x5150('0xa')]);router[_0x5150('0xb')](_0x5150('0x7'),auth[_0x5150('0x8')](),controller[_0x5150('0xc')]);router[_0x5150('0xd')](_0x5150('0x7'),auth[_0x5150('0x8')](),controller[_0x5150('0xe')]);module['exports']=router; \ No newline at end of file +var _0x1abe=['delete','destroy','multer','path','express','Router','fs-extra','../../components/auth/service','./dashboardItem.controller','get','/:id','isAuthenticated','post','create','put','update'];(function(_0x1ca4c3,_0x554126){var _0x4426a6=function(_0x11e9b0){while(--_0x11e9b0){_0x1ca4c3['push'](_0x1ca4c3['shift']());}};_0x4426a6(++_0x554126);}(_0x1abe,0xe2));var _0xe1ab=function(_0x13479b,_0x3aed2d){_0x13479b=_0x13479b-0x0;var _0x169966=_0x1abe[_0x13479b];return _0x169966;};'use strict';var multer=require(_0xe1ab('0x0'));var util=require('util');var path=require(_0xe1ab('0x1'));var timeout=require('connect-timeout');var express=require(_0xe1ab('0x2'));var router=express[_0xe1ab('0x3')]();var fs_extra=require(_0xe1ab('0x4'));var auth=require(_0xe1ab('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xe1ab('0x6'));router[_0xe1ab('0x7')](_0xe1ab('0x8'),auth[_0xe1ab('0x9')](),controller['show']);router[_0xe1ab('0xa')]('/',auth[_0xe1ab('0x9')](),controller[_0xe1ab('0xb')]);router[_0xe1ab('0xc')](_0xe1ab('0x8'),auth[_0xe1ab('0x9')](),controller[_0xe1ab('0xd')]);router[_0xe1ab('0xe')](_0xe1ab('0x8'),auth[_0xe1ab('0x9')](),controller[_0xe1ab('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index 816ff26..b83304f 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 _0x6e10=['exports','STRING','ENUM','first','second','third','sequelize'];(function(_0x11d841,_0x467b37){var _0x20dece=function(_0x28c19d){while(--_0x28c19d){_0x11d841['push'](_0x11d841['shift']());}};_0x20dece(++_0x467b37);}(_0x6e10,0x1c6));var _0x06e1=function(_0x4948ec,_0x2586e3){_0x4948ec=_0x4948ec-0x0;var _0x20bda4=_0x6e10[_0x4948ec];return _0x20bda4;};'use strict';var Sequelize=require(_0x06e1('0x0'));module[_0x06e1('0x1')]={'name':{'type':Sequelize[_0x06e1('0x2')],'allowNull':![]},'level':{'type':Sequelize[_0x06e1('0x3')](_0x06e1('0x4'),_0x06e1('0x5'),_0x06e1('0x6')),'allowNull':![],'defaultValue':_0x06e1('0x4')},'description':{'type':Sequelize[_0x06e1('0x2')]}}; \ No newline at end of file +var _0xaefb=['first','second','third','sequelize','STRING'];(function(_0x2bc4df,_0x397a6f){var _0x4bcc54=function(_0xc72ce8){while(--_0xc72ce8){_0x2bc4df['push'](_0x2bc4df['shift']());}};_0x4bcc54(++_0x397a6f);}(_0xaefb,0x1a7));var _0xbaef=function(_0x4d6ac0,_0x201628){_0x4d6ac0=_0x4d6ac0-0x0;var _0x5296c4=_0xaefb[_0x4d6ac0];return _0x5296c4;};'use strict';var Sequelize=require(_0xbaef('0x0'));module['exports']={'name':{'type':Sequelize[_0xbaef('0x1')],'allowNull':![]},'level':{'type':Sequelize['ENUM'](_0xbaef('0x2'),_0xbaef('0x3'),_0xbaef('0x4')),'allowNull':![],'defaultValue':_0xbaef('0x2')},'description':{'type':Sequelize[_0xbaef('0x1')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index f29038f..1eda409 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 _0xc69b=['desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','Dispositions','UserProfileResource','sendStatus','error','name','index','map','Disposition','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','user','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce'];(function(_0x2c2526,_0x2c1188){var _0x45439d=function(_0x4b8898){while(--_0x4b8898){_0x2c2526['push'](_0x2c2526['shift']());}};_0x45439d(++_0x2c1188);}(_0xc69b,0x14a));var _0xbc69=function(_0x5550b3,_0x2d0ee0){_0x5550b3=_0x5550b3-0x0;var _0x4b8fc4=_0xc69b[_0x5550b3];return _0x4b8fc4;};'use strict';var emlformat=require(_0xbc69('0x0'));var rimraf=require(_0xbc69('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xbc69('0x2'));var moment=require(_0xbc69('0x3'));var BPromise=require(_0xbc69('0x4'));var Mustache=require(_0xbc69('0x5'));var util=require(_0xbc69('0x6'));var path=require(_0xbc69('0x7'));var sox=require(_0xbc69('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbc69('0x9'));var _=require(_0xbc69('0xa'));var squel=require(_0xbc69('0xb'));var crypto=require(_0xbc69('0xc'));var jsforce=require(_0xbc69('0xd'));var deskjs=require(_0xbc69('0xe'));var toCsv=require(_0xbc69('0xf'));var querystring=require(_0xbc69('0x10'));var Papa=require(_0xbc69('0x11'));var Redis=require(_0xbc69('0x12'));var authService=require(_0xbc69('0x13'));var qs=require(_0xbc69('0x14'));var as=require(_0xbc69('0x15'));var hardwareService=require(_0xbc69('0x16'));var logger=require(_0xbc69('0x17'))(_0xbc69('0x18'));var utils=require(_0xbc69('0x19'));var config=require(_0xbc69('0x1a'));var licenseUtil=require(_0xbc69('0x1b'));var db=require(_0xbc69('0x1c'))['db'];function respondWithStatusCode(_0x5109ff,_0x5f3efa){_0x5f3efa=_0x5f3efa||0xcc;return function(_0x2a38b3){if(_0x2a38b3){return _0x5109ff['sendStatus'](_0x5f3efa);}return _0x5109ff['status'](_0x5f3efa)[_0xbc69('0x1d')]();};}function respondWithResult(_0x4fd24c,_0x3fff23){_0x3fff23=_0x3fff23||0xc8;return function(_0x3be604){if(_0x3be604){return _0x4fd24c[_0xbc69('0x1e')](_0x3fff23)['json'](_0x3be604);}};}function respondWithFilteredResult(_0x275a11,_0x44a58d){return function(_0x49b7f){if(_0x49b7f){var _0x32db83=typeof _0x44a58d[_0xbc69('0x1f')]===_0xbc69('0x20')&&typeof _0x44a58d[_0xbc69('0x21')]===_0xbc69('0x20');var _0x5c4b3b=_0x49b7f[_0xbc69('0x22')];var _0x536d97=_0x32db83?0x0:_0x44a58d['offset'];var _0x4c3d55=_0x32db83?_0x49b7f[_0xbc69('0x22')]:_0x44a58d[_0xbc69('0x1f')]+_0x44a58d[_0xbc69('0x21')];var _0x297d0d;if(_0x4c3d55>=_0x5c4b3b){_0x4c3d55=_0x5c4b3b;_0x297d0d=0xc8;}else{_0x297d0d=0xce;}_0x275a11[_0xbc69('0x1e')](_0x297d0d);return _0x275a11[_0xbc69('0x23')](_0xbc69('0x24'),_0x536d97+'-'+_0x4c3d55+'/'+_0x5c4b3b)['json'](_0x49b7f);}return null;};}function patchUpdates(_0x50d81c){return function(_0xf6fef8){try{jsonpatch[_0xbc69('0x25')](_0xf6fef8,_0x50d81c,!![]);}catch(_0x4a1a4d){return BPromise[_0xbc69('0x26')](_0x4a1a4d);}return _0xf6fef8[_0xbc69('0x27')]();};}function saveUpdates(_0x39feb2,_0x5415b8){return function(_0x330570){if(_0x330570){return _0x330570[_0xbc69('0x28')](_0x39feb2)[_0xbc69('0x29')](function(_0x2ceecc){return _0x2ceecc;});}return null;};}function removeEntity(_0xeecd0d,_0x439215){return function(_0x385bee){if(_0x385bee){return _0x385bee[_0xbc69('0x2a')]()[_0xbc69('0x29')](function(){var _0x1410a2=_0x385bee[_0xbc69('0x2b')]({'plain':!![]});var _0xa821b1=_0xbc69('0x2c');return db[_0xbc69('0x2d')][_0xbc69('0x2a')]({'where':{'type':_0xa821b1,'resourceId':_0x1410a2['id']}})[_0xbc69('0x29')](function(){return _0x385bee;});})['then'](function(){_0xeecd0d[_0xbc69('0x1e')](0xcc)[_0xbc69('0x1d')]();});}};}function handleEntityNotFound(_0x43ff36,_0x1fd059){return function(_0x543a6e){if(!_0x543a6e){_0x43ff36[_0xbc69('0x2e')](0x194);}return _0x543a6e;};}function handleError(_0x12e651,_0xf5c07d){_0xf5c07d=_0xf5c07d||0x1f4;return function(_0x1ad8c0){logger[_0xbc69('0x2f')](_0x1ad8c0['stack']);if(_0x1ad8c0[_0xbc69('0x30')]){delete _0x1ad8c0[_0xbc69('0x30')];}_0x12e651['status'](_0xf5c07d)['send'](_0x1ad8c0);};}exports[_0xbc69('0x31')]=function(_0xa171f7,_0x2b5b99){var _0x44f2fc={},_0x1767fa={},_0x2620d5={'count':0x0,'rows':[]};var _0x2297b8=_[_0xbc69('0x32')](db[_0xbc69('0x33')][_0xbc69('0x34')],function(_0x401898){return{'name':_0x401898[_0xbc69('0x35')],'type':_0x401898['type'][_0xbc69('0x36')]};});_0x1767fa[_0xbc69('0x37')]=_[_0xbc69('0x32')](_0x2297b8,_0xbc69('0x30'));_0x1767fa[_0xbc69('0x38')]=_[_0xbc69('0x39')](_0xa171f7['query']);_0x1767fa[_0xbc69('0x3a')]=_[_0xbc69('0x3b')](_0x1767fa[_0xbc69('0x37')],_0x1767fa[_0xbc69('0x38')]);_0x44f2fc['attributes']=_['intersection'](_0x1767fa[_0xbc69('0x37')],qs[_0xbc69('0x3c')](_0xa171f7['query'][_0xbc69('0x3c')]));_0x44f2fc[_0xbc69('0x3d')]=_0x44f2fc[_0xbc69('0x3d')][_0xbc69('0x3e')]?_0x44f2fc[_0xbc69('0x3d')]:_0x1767fa['model'];if(!_0xa171f7[_0xbc69('0x38')][_0xbc69('0x3f')](_0xbc69('0x40'))){_0x44f2fc[_0xbc69('0x21')]=qs['limit'](_0xa171f7[_0xbc69('0x38')][_0xbc69('0x21')]);_0x44f2fc[_0xbc69('0x1f')]=qs['offset'](_0xa171f7['query'][_0xbc69('0x1f')]);}_0x44f2fc['order']=qs['sort'](_0xa171f7[_0xbc69('0x38')][_0xbc69('0x41')]);_0x44f2fc[_0xbc69('0x42')]=qs[_0xbc69('0x3a')](_[_0xbc69('0x43')](_0xa171f7['query'],_0x1767fa[_0xbc69('0x3a')]),_0x2297b8);if(_0xa171f7[_0xbc69('0x38')][_0xbc69('0x44')]){_0x44f2fc['where']=_[_0xbc69('0x45')](_0x44f2fc[_0xbc69('0x42')],{'$or':_['map'](_0x2297b8,function(_0x3ccb27){if(_0x3ccb27['type']!==_0xbc69('0x46')){var _0x3c176f={};_0x3c176f[_0x3ccb27[_0xbc69('0x30')]]={'$like':'%'+_0xa171f7[_0xbc69('0x38')][_0xbc69('0x44')]+'%'};return _0x3c176f;}})});}_0x44f2fc=_[_0xbc69('0x45')]({},_0x44f2fc,_0xa171f7[_0xbc69('0x47')]);var _0x2b1a29={'where':_0x44f2fc[_0xbc69('0x42')]};return db[_0xbc69('0x33')][_0xbc69('0x22')](_0x2b1a29)['then'](function(_0x3f4178){_0x2620d5[_0xbc69('0x22')]=_0x3f4178;if(_0xa171f7[_0xbc69('0x38')]['includeAll']){_0x44f2fc[_0xbc69('0x48')]=[{'all':!![]}];}return db['Disposition'][_0xbc69('0x49')](_0x44f2fc);})[_0xbc69('0x29')](function(_0x110fd2){_0x2620d5[_0xbc69('0x4a')]=_0x110fd2;return _0x2620d5;})[_0xbc69('0x29')](respondWithFilteredResult(_0x2b5b99,_0x44f2fc))[_0xbc69('0x4b')](handleError(_0x2b5b99,null));};exports[_0xbc69('0x4c')]=function(_0x3cd7ce,_0x478e5b){var _0x566626={'raw':!![],'where':{'id':_0x3cd7ce[_0xbc69('0x4d')]['id']}},_0x56b372={};_0x56b372[_0xbc69('0x37')]=_[_0xbc69('0x39')](db[_0xbc69('0x33')][_0xbc69('0x34')]);_0x56b372[_0xbc69('0x38')]=_[_0xbc69('0x39')](_0x3cd7ce[_0xbc69('0x38')]);_0x56b372['filters']=_[_0xbc69('0x3b')](_0x56b372[_0xbc69('0x37')],_0x56b372[_0xbc69('0x38')]);_0x566626[_0xbc69('0x3d')]=_[_0xbc69('0x3b')](_0x56b372[_0xbc69('0x37')],qs[_0xbc69('0x3c')](_0x3cd7ce[_0xbc69('0x38')][_0xbc69('0x3c')]));_0x566626[_0xbc69('0x3d')]=_0x566626[_0xbc69('0x3d')][_0xbc69('0x3e')]?_0x566626[_0xbc69('0x3d')]:_0x56b372[_0xbc69('0x37')];if(_0x3cd7ce[_0xbc69('0x38')][_0xbc69('0x4e')]){_0x566626[_0xbc69('0x48')]=[{'all':!![]}];}_0x566626=_[_0xbc69('0x45')]({},_0x566626,_0x3cd7ce[_0xbc69('0x47')]);return db[_0xbc69('0x33')][_0xbc69('0x4f')](_0x566626)[_0xbc69('0x29')](handleEntityNotFound(_0x478e5b,null))[_0xbc69('0x29')](respondWithResult(_0x478e5b,null))[_0xbc69('0x4b')](handleError(_0x478e5b,null));};exports[_0xbc69('0x50')]=function(_0x18ff56,_0x1e4dc1){return db[_0xbc69('0x33')][_0xbc69('0x50')](_0x18ff56[_0xbc69('0x51')],{})[_0xbc69('0x29')](function(_0x5d11dd){var _0x1772f2=_0x18ff56[_0xbc69('0x52')]['get']({'plain':!![]});if(!_0x1772f2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1772f2[_0xbc69('0x53')]===_0xbc69('0x52')){var _0x3c6703=_0x5d11dd[_0xbc69('0x2b')]({'plain':!![]});var _0x170d71=_0xbc69('0x2c');return db[_0xbc69('0x54')][_0xbc69('0x4f')]({'where':{'name':_0x170d71,'userProfileId':_0x1772f2['userProfileId']},'raw':!![]})[_0xbc69('0x29')](function(_0x4fa1d5){if(_0x4fa1d5&&_0x4fa1d5['autoAssociation']===0x0){return db[_0xbc69('0x2d')][_0xbc69('0x50')]({'name':_0x3c6703['name'],'resourceId':_0x3c6703['id'],'type':_0x4fa1d5[_0xbc69('0x30')],'sectionId':_0x4fa1d5['id']},{})[_0xbc69('0x29')](function(){return _0x5d11dd;});}else{return _0x5d11dd;}})[_0xbc69('0x4b')](function(_0x10f300){logger[_0xbc69('0x2f')](_0xbc69('0x55'),_0x10f300);throw _0x10f300;});}return _0x5d11dd;})['then'](respondWithResult(_0x1e4dc1,0xc9))['catch'](handleError(_0x1e4dc1,null));};exports[_0xbc69('0x28')]=function(_0xbd07a5,_0x23e404){if(_0xbd07a5[_0xbc69('0x51')]['id']){delete _0xbd07a5[_0xbc69('0x51')]['id'];}return db[_0xbc69('0x33')][_0xbc69('0x4f')]({'where':{'id':_0xbd07a5[_0xbc69('0x4d')]['id']}})['then'](handleEntityNotFound(_0x23e404,null))['then'](saveUpdates(_0xbd07a5['body'],null))[_0xbc69('0x29')](respondWithResult(_0x23e404,null))[_0xbc69('0x4b')](handleError(_0x23e404,null));};exports[_0xbc69('0x2a')]=function(_0x2d5ec3,_0x261b42){return db[_0xbc69('0x33')][_0xbc69('0x4f')]({'where':{'id':_0x2d5ec3[_0xbc69('0x4d')]['id']}})['then'](handleEntityNotFound(_0x261b42,null))['then'](removeEntity(_0x261b42,null))[_0xbc69('0x4b')](handleError(_0x261b42,null));}; \ No newline at end of file +var _0x2caf=['order','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','findAll','rows','catch','params','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','end','status','json','offset','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','Dispositions','UserProfileResource','sendStatus','error','stack','name','send','index','Disposition','rawAttributes','fieldName','type','key','model','map','keys','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit'];(function(_0x5a8a4d,_0x299752){var _0x4c69c5=function(_0x516832){while(--_0x516832){_0x5a8a4d['push'](_0x5a8a4d['shift']());}};_0x4c69c5(++_0x299752);}(_0x2caf,0x6a));var _0xf2ca=function(_0xc68e6b,_0x1c75ab){_0xc68e6b=_0xc68e6b-0x0;var _0x1e0661=_0x2caf[_0xc68e6b];return _0x1e0661;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xf2ca('0x0'));var rp=require('request-promise');var moment=require(_0xf2ca('0x1'));var BPromise=require(_0xf2ca('0x2'));var Mustache=require(_0xf2ca('0x3'));var util=require(_0xf2ca('0x4'));var path=require(_0xf2ca('0x5'));var sox=require(_0xf2ca('0x6'));var csv=require(_0xf2ca('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf2ca('0x8'));var _=require(_0xf2ca('0x9'));var squel=require(_0xf2ca('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xf2ca('0xb'));var toCsv=require(_0xf2ca('0x7'));var querystring=require(_0xf2ca('0xc'));var Papa=require(_0xf2ca('0xd'));var Redis=require(_0xf2ca('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xf2ca('0xf'));var as=require(_0xf2ca('0x10'));var hardwareService=require(_0xf2ca('0x11'));var logger=require(_0xf2ca('0x12'))(_0xf2ca('0x13'));var utils=require(_0xf2ca('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xf2ca('0x15'));var db=require(_0xf2ca('0x16'))['db'];function respondWithStatusCode(_0x54a3cb,_0x88529f){_0x88529f=_0x88529f||0xcc;return function(_0x383112){if(_0x383112){return _0x54a3cb['sendStatus'](_0x88529f);}return _0x54a3cb['status'](_0x88529f)[_0xf2ca('0x17')]();};}function respondWithResult(_0x52a278,_0x284484){_0x284484=_0x284484||0xc8;return function(_0x3123fe){if(_0x3123fe){return _0x52a278[_0xf2ca('0x18')](_0x284484)[_0xf2ca('0x19')](_0x3123fe);}};}function respondWithFilteredResult(_0x410997,_0x2057a2){return function(_0x2ddfac){if(_0x2ddfac){var _0x5aec64=typeof _0x2057a2[_0xf2ca('0x1a')]==='undefined'&&typeof _0x2057a2[_0xf2ca('0x1b')]==='undefined';var _0x235e79=_0x2ddfac[_0xf2ca('0x1c')];var _0x59ea3c=_0x5aec64?0x0:_0x2057a2[_0xf2ca('0x1a')];var _0x160230=_0x5aec64?_0x2ddfac[_0xf2ca('0x1c')]:_0x2057a2[_0xf2ca('0x1a')]+_0x2057a2[_0xf2ca('0x1b')];var _0x1ca233;if(_0x160230>=_0x235e79){_0x160230=_0x235e79;_0x1ca233=0xc8;}else{_0x1ca233=0xce;}_0x410997[_0xf2ca('0x18')](_0x1ca233);return _0x410997[_0xf2ca('0x1d')](_0xf2ca('0x1e'),_0x59ea3c+'-'+_0x160230+'/'+_0x235e79)[_0xf2ca('0x19')](_0x2ddfac);}return null;};}function patchUpdates(_0xea662){return function(_0x55dc6a){try{jsonpatch[_0xf2ca('0x1f')](_0x55dc6a,_0xea662,!![]);}catch(_0x45a028){return BPromise[_0xf2ca('0x20')](_0x45a028);}return _0x55dc6a[_0xf2ca('0x21')]();};}function saveUpdates(_0x41cb71,_0x386c58){return function(_0x1bbd60){if(_0x1bbd60){return _0x1bbd60[_0xf2ca('0x22')](_0x41cb71)['then'](function(_0x14791b){return _0x14791b;});}return null;};}function removeEntity(_0x1767f7,_0x56ebed){return function(_0x1c032c){if(_0x1c032c){return _0x1c032c[_0xf2ca('0x23')]()[_0xf2ca('0x24')](function(){var _0x509e33=_0x1c032c['get']({'plain':!![]});var _0xbfcb0b=_0xf2ca('0x25');return db[_0xf2ca('0x26')][_0xf2ca('0x23')]({'where':{'type':_0xbfcb0b,'resourceId':_0x509e33['id']}})[_0xf2ca('0x24')](function(){return _0x1c032c;});})[_0xf2ca('0x24')](function(){_0x1767f7[_0xf2ca('0x18')](0xcc)[_0xf2ca('0x17')]();});}};}function handleEntityNotFound(_0x570aea,_0x18bca4){return function(_0x2b09a3){if(!_0x2b09a3){_0x570aea[_0xf2ca('0x27')](0x194);}return _0x2b09a3;};}function handleError(_0x1b36e0,_0x45d347){_0x45d347=_0x45d347||0x1f4;return function(_0x41fc04){logger[_0xf2ca('0x28')](_0x41fc04[_0xf2ca('0x29')]);if(_0x41fc04[_0xf2ca('0x2a')]){delete _0x41fc04[_0xf2ca('0x2a')];}_0x1b36e0[_0xf2ca('0x18')](_0x45d347)[_0xf2ca('0x2b')](_0x41fc04);};}exports[_0xf2ca('0x2c')]=function(_0x456e64,_0x2b0649){var _0x2f57f5={},_0x2a9a1f={},_0x440888={'count':0x0,'rows':[]};var _0x270a5d=_['map'](db[_0xf2ca('0x2d')][_0xf2ca('0x2e')],function(_0x1c5310){return{'name':_0x1c5310[_0xf2ca('0x2f')],'type':_0x1c5310[_0xf2ca('0x30')][_0xf2ca('0x31')]};});_0x2a9a1f[_0xf2ca('0x32')]=_[_0xf2ca('0x33')](_0x270a5d,_0xf2ca('0x2a'));_0x2a9a1f['query']=_[_0xf2ca('0x34')](_0x456e64[_0xf2ca('0x35')]);_0x2a9a1f[_0xf2ca('0x36')]=_['intersection'](_0x2a9a1f[_0xf2ca('0x32')],_0x2a9a1f['query']);_0x2f57f5[_0xf2ca('0x37')]=_[_0xf2ca('0x38')](_0x2a9a1f[_0xf2ca('0x32')],qs[_0xf2ca('0x39')](_0x456e64[_0xf2ca('0x35')]['fields']));_0x2f57f5['attributes']=_0x2f57f5[_0xf2ca('0x37')]['length']?_0x2f57f5[_0xf2ca('0x37')]:_0x2a9a1f[_0xf2ca('0x32')];if(!_0x456e64[_0xf2ca('0x35')][_0xf2ca('0x3a')](_0xf2ca('0x3b'))){_0x2f57f5[_0xf2ca('0x1b')]=qs[_0xf2ca('0x1b')](_0x456e64[_0xf2ca('0x35')][_0xf2ca('0x1b')]);_0x2f57f5[_0xf2ca('0x1a')]=qs[_0xf2ca('0x1a')](_0x456e64[_0xf2ca('0x35')][_0xf2ca('0x1a')]);}_0x2f57f5[_0xf2ca('0x3c')]=qs[_0xf2ca('0x3d')](_0x456e64[_0xf2ca('0x35')]['sort']);_0x2f57f5[_0xf2ca('0x3e')]=qs[_0xf2ca('0x36')](_[_0xf2ca('0x3f')](_0x456e64[_0xf2ca('0x35')],_0x2a9a1f['filters']),_0x270a5d);if(_0x456e64[_0xf2ca('0x35')]['filter']){_0x2f57f5[_0xf2ca('0x3e')]=_[_0xf2ca('0x40')](_0x2f57f5[_0xf2ca('0x3e')],{'$or':_[_0xf2ca('0x33')](_0x270a5d,function(_0x385904){if(_0x385904['type']!==_0xf2ca('0x41')){var _0x2c299e={};_0x2c299e[_0x385904['name']]={'$like':'%'+_0x456e64[_0xf2ca('0x35')][_0xf2ca('0x42')]+'%'};return _0x2c299e;}})});}_0x2f57f5=_[_0xf2ca('0x40')]({},_0x2f57f5,_0x456e64['options']);var _0x40130e={'where':_0x2f57f5['where']};return db[_0xf2ca('0x2d')][_0xf2ca('0x1c')](_0x40130e)[_0xf2ca('0x24')](function(_0x43b2c2){_0x440888[_0xf2ca('0x1c')]=_0x43b2c2;if(_0x456e64[_0xf2ca('0x35')][_0xf2ca('0x43')]){_0x2f57f5[_0xf2ca('0x44')]=[{'all':!![]}];}return db[_0xf2ca('0x2d')][_0xf2ca('0x45')](_0x2f57f5);})[_0xf2ca('0x24')](function(_0x3360d9){_0x440888[_0xf2ca('0x46')]=_0x3360d9;return _0x440888;})[_0xf2ca('0x24')](respondWithFilteredResult(_0x2b0649,_0x2f57f5))[_0xf2ca('0x47')](handleError(_0x2b0649,null));};exports['show']=function(_0x2b7479,_0x32b194){var _0x20d5bf={'raw':!![],'where':{'id':_0x2b7479[_0xf2ca('0x48')]['id']}},_0x89e9d={};_0x89e9d[_0xf2ca('0x32')]=_[_0xf2ca('0x34')](db[_0xf2ca('0x2d')][_0xf2ca('0x2e')]);_0x89e9d[_0xf2ca('0x35')]=_[_0xf2ca('0x34')](_0x2b7479[_0xf2ca('0x35')]);_0x89e9d[_0xf2ca('0x36')]=_['intersection'](_0x89e9d['model'],_0x89e9d[_0xf2ca('0x35')]);_0x20d5bf[_0xf2ca('0x37')]=_['intersection'](_0x89e9d[_0xf2ca('0x32')],qs['fields'](_0x2b7479[_0xf2ca('0x35')][_0xf2ca('0x39')]));_0x20d5bf[_0xf2ca('0x37')]=_0x20d5bf['attributes'][_0xf2ca('0x49')]?_0x20d5bf[_0xf2ca('0x37')]:_0x89e9d['model'];if(_0x2b7479[_0xf2ca('0x35')][_0xf2ca('0x43')]){_0x20d5bf[_0xf2ca('0x44')]=[{'all':!![]}];}_0x20d5bf=_[_0xf2ca('0x40')]({},_0x20d5bf,_0x2b7479['options']);return db[_0xf2ca('0x2d')][_0xf2ca('0x4a')](_0x20d5bf)[_0xf2ca('0x24')](handleEntityNotFound(_0x32b194,null))['then'](respondWithResult(_0x32b194,null))['catch'](handleError(_0x32b194,null));};exports[_0xf2ca('0x4b')]=function(_0x2f7596,_0x1a65c6){return db[_0xf2ca('0x2d')][_0xf2ca('0x4b')](_0x2f7596[_0xf2ca('0x4c')],{})['then'](function(_0x4d595b){var _0x22b216=_0x2f7596[_0xf2ca('0x4d')]['get']({'plain':!![]});if(!_0x22b216)throw new Error(_0xf2ca('0x4e'));if(_0x22b216['role']===_0xf2ca('0x4d')){var _0x59bbb8=_0x4d595b[_0xf2ca('0x4f')]({'plain':!![]});var _0x5f3fc7='Dispositions';return db[_0xf2ca('0x50')][_0xf2ca('0x4a')]({'where':{'name':_0x5f3fc7,'userProfileId':_0x22b216['userProfileId']},'raw':!![]})[_0xf2ca('0x24')](function(_0x3b7014){if(_0x3b7014&&_0x3b7014[_0xf2ca('0x51')]===0x0){return db[_0xf2ca('0x26')][_0xf2ca('0x4b')]({'name':_0x59bbb8[_0xf2ca('0x2a')],'resourceId':_0x59bbb8['id'],'type':_0x3b7014['name'],'sectionId':_0x3b7014['id']},{})[_0xf2ca('0x24')](function(){return _0x4d595b;});}else{return _0x4d595b;}})[_0xf2ca('0x47')](function(_0x4a34f6){logger[_0xf2ca('0x28')](_0xf2ca('0x52'),_0x4a34f6);throw _0x4a34f6;});}return _0x4d595b;})[_0xf2ca('0x24')](respondWithResult(_0x1a65c6,0xc9))[_0xf2ca('0x47')](handleError(_0x1a65c6,null));};exports[_0xf2ca('0x22')]=function(_0x5273ba,_0x4cd8a3){if(_0x5273ba['body']['id']){delete _0x5273ba[_0xf2ca('0x4c')]['id'];}return db[_0xf2ca('0x2d')][_0xf2ca('0x4a')]({'where':{'id':_0x5273ba[_0xf2ca('0x48')]['id']}})['then'](handleEntityNotFound(_0x4cd8a3,null))[_0xf2ca('0x24')](saveUpdates(_0x5273ba[_0xf2ca('0x4c')],null))[_0xf2ca('0x24')](respondWithResult(_0x4cd8a3,null))[_0xf2ca('0x47')](handleError(_0x4cd8a3,null));};exports[_0xf2ca('0x23')]=function(_0x2d04a8,_0x1ee306){return db['Disposition'][_0xf2ca('0x4a')]({'where':{'id':_0x2d04a8[_0xf2ca('0x48')]['id']}})[_0xf2ca('0x24')](handleEntityNotFound(_0x1ee306,null))['then'](removeEntity(_0x1ee306,null))[_0xf2ca('0x47')](handleError(_0x1ee306,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index aa74c14..4ce3f80 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 _0x2b49=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','name_voice','name','ListId','name_chat','name_mail','MailAccountId','name_sms','SmsAccountId','name_fax','FaxAccountId','name_openchannel','OpenchannelAccountId','name_whatsapp','lodash'];(function(_0x3e5060,_0x23438a){var _0x34e0f9=function(_0x4bc65f){while(--_0x4bc65f){_0x3e5060['push'](_0x3e5060['shift']());}};_0x34e0f9(++_0x23438a);}(_0x2b49,0x95));var _0x92b4=function(_0x331b2b,_0xfc4d1b){_0x331b2b=_0x331b2b-0x0;var _0x39a6d4=_0x2b49[_0x331b2b];return _0x39a6d4;};'use strict';var _=require(_0x92b4('0x0'));var util=require(_0x92b4('0x1'));var logger=require(_0x92b4('0x2'))(_0x92b4('0x3'));var moment=require(_0x92b4('0x4'));var BPromise=require(_0x92b4('0x5'));var rp=require(_0x92b4('0x6'));var fs=require('fs');var path=require(_0x92b4('0x7'));var rimraf=require(_0x92b4('0x8'));var config=require(_0x92b4('0x9'));var attributes=require('./disposition.attributes');module[_0x92b4('0xa')]=function(_0x7b8a6c,_0x243d8f){return _0x7b8a6c[_0x92b4('0xb')]('Disposition',attributes,{'tableName':'tools_dispositions','paranoid':![],'indexes':[{'unique':!![],'name':_0x92b4('0xc'),'fields':[_0x92b4('0xd'),_0x92b4('0xe')]},{'unique':!![],'name':_0x92b4('0xf'),'fields':[_0x92b4('0xd'),'ChatWebsiteId']},{'unique':!![],'name':_0x92b4('0x10'),'fields':[_0x92b4('0xd'),_0x92b4('0x11')]},{'unique':!![],'name':_0x92b4('0x12'),'fields':[_0x92b4('0xd'),_0x92b4('0x13')]},{'unique':!![],'name':_0x92b4('0x14'),'fields':[_0x92b4('0xd'),_0x92b4('0x15')]},{'unique':!![],'name':_0x92b4('0x16'),'fields':['name',_0x92b4('0x17')]},{'unique':!![],'name':_0x92b4('0x18'),'fields':[_0x92b4('0xd'),'WhatsappAccountId']}],'timestamps':!![]});}; \ No newline at end of file +var _0xe17e=['ListId','name_chat','name','ChatWebsiteId','name_mail','MailAccountId','FaxAccountId','name_openchannel','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','api','moment','request-promise','rimraf','./disposition.attributes','exports','Disposition','tools_dispositions','name_voice'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xe17e,0xab));var _0xee17=function(_0x5695b7,_0x59582f){_0x5695b7=_0x5695b7-0x0;var _0x59ff08=_0xe17e[_0x5695b7];return _0x59ff08;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xee17('0x0'));var moment=require(_0xee17('0x1'));var BPromise=require('bluebird');var rp=require(_0xee17('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0xee17('0x3'));var config=require('../../config/environment');var attributes=require(_0xee17('0x4'));module[_0xee17('0x5')]=function(_0x2ae329,_0x4ff8f4){return _0x2ae329['define'](_0xee17('0x6'),attributes,{'tableName':_0xee17('0x7'),'paranoid':![],'indexes':[{'unique':!![],'name':_0xee17('0x8'),'fields':['name',_0xee17('0x9')]},{'unique':!![],'name':_0xee17('0xa'),'fields':[_0xee17('0xb'),_0xee17('0xc')]},{'unique':!![],'name':_0xee17('0xd'),'fields':[_0xee17('0xb'),_0xee17('0xe')]},{'unique':!![],'name':'name_sms','fields':['name','SmsAccountId']},{'unique':!![],'name':'name_fax','fields':['name',_0xee17('0xf')]},{'unique':!![],'name':_0xee17('0x10'),'fields':['name',_0xee17('0x11')]},{'unique':!![],'name':_0xee17('0x12'),'fields':['name',_0xee17('0x13')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index 84622d3..241f269 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(_0x31fc46,_0x23fbc4){var _0x3416db=function(_0x314e95){while(--_0x314e95){_0x31fc46['push'](_0x31fc46['shift']());}};_0x3416db(++_0x23fbc4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0xa9e0[_0x311c35];return _0x5cc50c;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file +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(_0x5434db,_0x81bce6){var _0x2e8288=function(_0x2b15cc){while(--_0x2b15cc){_0x5434db['push'](_0x5434db['shift']());}};_0x2e8288(++_0x81bce6);}(_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 56b7e6e..d16d5ca 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 _0x0e5e=['update','delete','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','post','create','put'];(function(_0x3dfefc,_0x273917){var _0x2f8f9b=function(_0x4c6cb9){while(--_0x4c6cb9){_0x3dfefc['push'](_0x3dfefc['shift']());}};_0x2f8f9b(++_0x273917);}(_0x0e5e,0xd0));var _0xe0e5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0e5e[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xe0e5('0x0'));var util=require(_0xe0e5('0x1'));var path=require(_0xe0e5('0x2'));var timeout=require(_0xe0e5('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xe0e5('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xe0e5('0x5'));var config=require(_0xe0e5('0x6'));var controller=require('./disposition.controller');router[_0xe0e5('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xe0e5('0x7')](_0xe0e5('0x8'),auth[_0xe0e5('0x9')](),controller['show']);router[_0xe0e5('0xa')]('/',auth[_0xe0e5('0x9')](),controller[_0xe0e5('0xb')]);router[_0xe0e5('0xc')]('/:id',auth[_0xe0e5('0x9')](),controller[_0xe0e5('0xd')]);router[_0xe0e5('0xe')](_0xe0e5('0x8'),auth[_0xe0e5('0x9')](),controller[_0xe0e5('0xf')]);module[_0xe0e5('0x10')]=router; \ No newline at end of file +var _0x584e=['exports','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./disposition.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy'];(function(_0x29fefa,_0x3c9ba0){var _0x530b05=function(_0xc21842){while(--_0xc21842){_0x29fefa['push'](_0x29fefa['shift']());}};_0x530b05(++_0x3c9ba0);}(_0x584e,0x1dc));var _0xe584=function(_0x2d3ab3,_0x47d90b){_0x2d3ab3=_0x2d3ab3-0x0;var _0x321f9e=_0x584e[_0x2d3ab3];return _0x321f9e;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xe584('0x0'));var express=require(_0xe584('0x1'));var router=express[_0xe584('0x2')]();var fs_extra=require(_0xe584('0x3'));var auth=require(_0xe584('0x4'));var interaction=require(_0xe584('0x5'));var config=require('../../config/environment');var controller=require(_0xe584('0x6'));router[_0xe584('0x7')]('/',auth[_0xe584('0x8')](),controller[_0xe584('0x9')]);router['get'](_0xe584('0xa'),auth[_0xe584('0x8')](),controller[_0xe584('0xb')]);router[_0xe584('0xc')]('/',auth['isAuthenticated'](),controller[_0xe584('0xd')]);router[_0xe584('0xe')](_0xe584('0xa'),auth['isAuthenticated'](),controller[_0xe584('0xf')]);router[_0xe584('0x10')](_0xe584('0xa'),auth[_0xe584('0x8')](),controller[_0xe584('0x11')]);module[_0xe584('0x12')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index b86ad27..acbaa68 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 _0xfdbd=['sequelize','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','2400','4800','14400','7200','9600','12000','v17,v27,v29','INTEGER','SIP','IAX','DADHI','KHOMP','BOOLEAN','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition'];(function(_0x549fb4,_0x57140c){var _0xc64c37=function(_0x40e702){while(--_0x40e702){_0x549fb4['push'](_0x549fb4['shift']());}};_0xc64c37(++_0x57140c);}(_0xfdbd,0xf0));var _0xdfdb=function(_0x17730a,_0x362127){_0x17730a=_0x17730a-0x0;var _0x485db1=_0xfdbd[_0x17730a];return _0x485db1;};'use strict';var Sequelize=require(_0xdfdb('0x0'));module[_0xdfdb('0x1')]={'name':{'type':Sequelize[_0xdfdb('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xdfdb('0x2')]},'ecm':{'type':Sequelize[_0xdfdb('0x3')](_0xdfdb('0x4'),'no'),'defaultValue':_0xdfdb('0x4')},'headerinfo':{'type':Sequelize[_0xdfdb('0x2')],'defaultValue':_0xdfdb('0x5')},'localstationid':{'type':Sequelize['STRING'],'unique':_0xdfdb('0x6')},'minrate':{'type':Sequelize['ENUM'](_0xdfdb('0x7'),_0xdfdb('0x8'),'7200','9600','12000',_0xdfdb('0x9')),'defaultValue':_0xdfdb('0x8')},'maxrate':{'type':Sequelize['ENUM'](_0xdfdb('0x7'),_0xdfdb('0x8'),_0xdfdb('0xa'),_0xdfdb('0xb'),_0xdfdb('0xc'),_0xdfdb('0x9')),'defaultValue':_0xdfdb('0x9')},'modem':{'type':Sequelize['STRING'],'defaultValue':_0xdfdb('0xd')},'gateway':{'type':Sequelize[_0xdfdb('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0xdfdb('0xe')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0xdfdb('0x3')](_0xdfdb('0xf'),_0xdfdb('0x10'),_0xdfdb('0x11'),_0xdfdb('0x12')),'defaultValue':_0xdfdb('0xf')},'key':{'type':Sequelize[_0xdfdb('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0xdfdb('0x13')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xdfdb('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xdfdb('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xdfdb('0x13')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xdfdb('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xdfdb('0x13')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xdfdb('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xdfdb('0x13')],'defaultValue':![],'comment':_0xdfdb('0x14'),'set':function(_0x2c1070){if(!_0x2c1070)this['setDataValue'](_0xdfdb('0x15'),null);this[_0xdfdb('0x16')](_0xdfdb('0x17'),_0x2c1070);}}}; \ No newline at end of file +var _0x5496=['Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','sequelize','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','4800','7200','12000','14400','2400','9600','v17,v27,v29','INTEGER','DADHI','KHOMP','TEXT'];(function(_0xfc7019,_0x277c9e){var _0x2af8f4=function(_0x2a2ef3){while(--_0x2a2ef3){_0xfc7019['push'](_0xfc7019['shift']());}};_0x2af8f4(++_0x277c9e);}(_0x5496,0x175));var _0x6549=function(_0x2a2421,_0x1987a8){_0x2a2421=_0x2a2421-0x0;var _0x4aed6c=_0x5496[_0x2a2421];return _0x4aed6c;};'use strict';var Sequelize=require(_0x6549('0x0'));module[_0x6549('0x1')]={'name':{'type':Sequelize[_0x6549('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x6549('0x2')]},'ecm':{'type':Sequelize[_0x6549('0x3')]('yes','no'),'defaultValue':_0x6549('0x4')},'headerinfo':{'type':Sequelize['STRING'],'defaultValue':_0x6549('0x5')},'localstationid':{'type':Sequelize[_0x6549('0x2')],'unique':_0x6549('0x6')},'minrate':{'type':Sequelize['ENUM']('2400',_0x6549('0x7'),_0x6549('0x8'),'9600',_0x6549('0x9'),_0x6549('0xa')),'defaultValue':_0x6549('0x7')},'maxrate':{'type':Sequelize['ENUM'](_0x6549('0xb'),_0x6549('0x7'),_0x6549('0x8'),_0x6549('0xc'),_0x6549('0x9'),_0x6549('0xa')),'defaultValue':'14400'},'modem':{'type':Sequelize['STRING'],'defaultValue':_0x6549('0xd')},'gateway':{'type':Sequelize[_0x6549('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x6549('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x6549('0xe')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x6549('0x3')]('SIP','IAX',_0x6549('0xf'),_0x6549('0x10')),'defaultValue':'SIP'},'key':{'type':Sequelize[_0x6549('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x6549('0x11')],'defaultValue':function(){return _0x6549('0x12');}},'notificationSound':{'type':Sequelize[_0x6549('0x13')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x6549('0x13')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x6549('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x6549('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x6549('0x13')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x6549('0xe')],'allowNull':!![],'defaultValue':null,'comment':_0x6549('0x14')},'mandatoryDisposition':{'type':Sequelize[_0x6549('0x13')],'defaultValue':![],'comment':_0x6549('0x15'),'set':function(_0xffc8b9){if(!_0xffc8b9)this['setDataValue']('mandatoryDispositionPauseId',null);this[_0x6549('0x16')]('mandatoryDisposition',_0xffc8b9);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 54d7415..0d9cb19 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 _0x453f=['ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','spread','emit','userFaxAccount:save','removeAgents','userFaxAccount:remove','getAgents','eml-format','request-promise','bluebird','mustache','path','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','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','register','jayson/promise','http','client','request','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxAccount,\x20%s,\x20%s','message','info','result','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','sendStatus','stack','name','Pause','map','FaxAccount','rawAttributes','fieldName','type','key','keys','query','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','include','rows','catch','show','params','mandatoryDispositionPause','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','FaxAccounts','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','FaxAccountId','Disposition','getDispositions','findOne','findAll','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','removeAnswers','addInteraction','FaxInteraction','omit','getInteractions','CmContact','Contact','User','Owner','fullname','Tag','Tags','color','tag','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','bulkCreate','priority','finally','send','getApplications','context','from-voip-provider','exten','localstationid','system','description','Fax\x20Extension','appdata','Answer','CDR(type)=inbound-fax','ecm','gateway','headerinfo','maxrate','minrate','modem','t38timeout','FAXOPT(','push','Wait','ReceiveFax','addAccountApplications','VoiceExtension','tech','createdAt','updatedAt','TrunkId','findById','getMessages','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','CmList','List','Contacts','DESC','attachments','join','server/files/attachments','basename','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','fax','ListId','Send\x20Fax\x20failed','out','filename','Messages','Contact\x20not\x20found'];(function(_0x47fd9e,_0x22305e){var _0x5927af=function(_0x186fb0){while(--_0x186fb0){_0x47fd9e['push'](_0x47fd9e['shift']());}};_0x5927af(++_0x22305e);}(_0x453f,0xd5));var _0xf453=function(_0x52017e,_0x190239){_0x52017e=_0x52017e-0x0;var _0x3894af=_0x453f[_0x52017e];return _0x3894af;};'use strict';var emlformat=require(_0xf453('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xf453('0x1'));var moment=require('moment');var BPromise=require(_0xf453('0x2'));var Mustache=require(_0xf453('0x3'));var util=require('util');var path=require(_0xf453('0x4'));var sox=require(_0xf453('0x5'));var csv=require(_0xf453('0x6'));var ejs=require(_0xf453('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf453('0x8'));var squel=require(_0xf453('0x9'));var crypto=require(_0xf453('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xf453('0xb'));var toCsv=require(_0xf453('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xf453('0xc'));var authService=require(_0xf453('0xd'));var qs=require(_0xf453('0xe'));var as=require(_0xf453('0xf'));var hardwareService=require(_0xf453('0x10'));var logger=require(_0xf453('0x11'))('api');var utils=require(_0xf453('0x12'));var config=require(_0xf453('0x13'));var licenseUtil=require(_0xf453('0x14'));var db=require(_0xf453('0x15'))['db'];config[_0xf453('0x16')]=_[_0xf453('0x17')](config['redis'],{'host':_0xf453('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf453('0x16')]));require('./faxAccount.socket')[_0xf453('0x19')](socket);var jayson=require(_0xf453('0x1a'));var client=jayson['client'][_0xf453('0x1b')]({'port':0x232c});var client9002=jayson[_0xf453('0x1c')][_0xf453('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x2933ba,_0x469607,_0x45f88f,_0x27e37a){return new BPromise(function(_0x471ff5,_0x286873){var _0x3e8814=_0x27e37a||client;return _0x3e8814[_0xf453('0x1d')](_0x2933ba,_0x45f88f)['then'](function(_0x491f54){logger['info']('FaxAccount,\x20%s,\x20%s',_0x469607,_0xf453('0x1e'));logger[_0xf453('0x1f')](_0xf453('0x20'),_0x469607,_0xf453('0x1e'),JSON[_0xf453('0x21')](_0x491f54));if(_0x491f54['error']){if(_0x491f54[_0xf453('0x22')][_0xf453('0x23')]===0x1f4){logger[_0xf453('0x22')](_0xf453('0x24'),_0x469607,_0x491f54[_0xf453('0x22')][_0xf453('0x25')]);return _0x286873(_0x491f54[_0xf453('0x22')][_0xf453('0x25')]);}logger[_0xf453('0x22')](_0xf453('0x24'),_0x469607,_0x491f54[_0xf453('0x22')]['message']);return _0x471ff5(_0x491f54['error']['message']);}else{logger[_0xf453('0x26')](_0xf453('0x24'),_0x469607,'request\x20sent');_0x471ff5(_0x491f54[_0xf453('0x27')][_0xf453('0x25')]);}})['catch'](function(_0x3960ae){logger[_0xf453('0x22')](_0xf453('0x24'),_0x469607,_0x3960ae);_0x286873(_0x3960ae);});});}function respondWithStatusCode(_0x15815e,_0x4fd11f){_0x4fd11f=_0x4fd11f||0xcc;return function(_0x4fca61){if(_0x4fca61){return _0x15815e['sendStatus'](_0x4fd11f);}return _0x15815e[_0xf453('0x28')](_0x4fd11f)[_0xf453('0x29')]();};}function respondWithResult(_0x55c28b,_0x309252){_0x309252=_0x309252||0xc8;return function(_0x433d9d){if(_0x433d9d){return _0x55c28b['status'](_0x309252)[_0xf453('0x2a')](_0x433d9d);}};}function respondWithFilteredResult(_0x3efa7c,_0x149ccc){return function(_0x27a14d){if(_0x27a14d){var _0x1f357f=typeof _0x149ccc[_0xf453('0x2b')]===_0xf453('0x2c')&&typeof _0x149ccc[_0xf453('0x2d')]===_0xf453('0x2c');var _0x89a03=_0x27a14d[_0xf453('0x2e')];var _0x46d742=_0x1f357f?0x0:_0x149ccc['offset'];var _0x3fa01a=_0x1f357f?_0x27a14d[_0xf453('0x2e')]:_0x149ccc[_0xf453('0x2b')]+_0x149ccc[_0xf453('0x2d')];var _0x1cea33;if(_0x3fa01a>=_0x89a03){_0x3fa01a=_0x89a03;_0x1cea33=0xc8;}else{_0x1cea33=0xce;}_0x3efa7c[_0xf453('0x28')](_0x1cea33);return _0x3efa7c[_0xf453('0x2f')](_0xf453('0x30'),_0x46d742+'-'+_0x3fa01a+'/'+_0x89a03)['json'](_0x27a14d);}return null;};}function patchUpdates(_0x17b450){return function(_0x198ba2){try{jsonpatch[_0xf453('0x31')](_0x198ba2,_0x17b450,!![]);}catch(_0x1ff9ec){return BPromise[_0xf453('0x32')](_0x1ff9ec);}return _0x198ba2[_0xf453('0x33')]();};}function saveUpdates(_0x1dcb8a,_0x3898e6){return function(_0x578c8c){if(_0x578c8c){return _0x578c8c[_0xf453('0x34')](_0x1dcb8a)[_0xf453('0x35')](function(_0x78f62c){return _0x78f62c;});}return null;};}function removeEntity(_0x120077,_0x4ca508){return function(_0x4ef9f4){if(_0x4ef9f4){return _0x4ef9f4[_0xf453('0x36')]()[_0xf453('0x35')](function(){var _0x397e7f=_0x4ef9f4[_0xf453('0x37')]({'plain':!![]});var _0x19c129='FaxAccounts';return db[_0xf453('0x38')][_0xf453('0x36')]({'where':{'type':_0x19c129,'resourceId':_0x397e7f['id']}})[_0xf453('0x35')](function(){return _0x4ef9f4;});})['then'](function(){_0x120077[_0xf453('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5b3315,_0x508e13){return function(_0x556a06){if(!_0x556a06){_0x5b3315[_0xf453('0x39')](0x194);}return _0x556a06;};}function handleError(_0x470966,_0x3bb42b){_0x3bb42b=_0x3bb42b||0x1f4;return function(_0x1b3685){logger[_0xf453('0x22')](_0x1b3685[_0xf453('0x3a')]);if(_0x1b3685[_0xf453('0x3b')]){delete _0x1b3685[_0xf453('0x3b')];}_0x470966[_0xf453('0x28')](_0x3bb42b)['send'](_0x1b3685);};}exports['index']=function(_0x2d7441,_0x2e38b8){var _0x24a24f={'include':[{'model':db[_0xf453('0x3c')],'as':'mandatoryDispositionPause'}]},_0x2c3f93={},_0x5e17ce={'count':0x0,'rows':[]};var _0x355f14=_[_0xf453('0x3d')](db[_0xf453('0x3e')][_0xf453('0x3f')],function(_0x1a3fda){return{'name':_0x1a3fda[_0xf453('0x40')],'type':_0x1a3fda[_0xf453('0x41')][_0xf453('0x42')]};});_0x2c3f93['model']=_[_0xf453('0x3d')](_0x355f14,_0xf453('0x3b'));_0x2c3f93['query']=_[_0xf453('0x43')](_0x2d7441[_0xf453('0x44')]);_0x2c3f93['filters']=_['intersection'](_0x2c3f93[_0xf453('0x45')],_0x2c3f93[_0xf453('0x44')]);_0x24a24f['attributes']=_[_0xf453('0x46')](_0x2c3f93[_0xf453('0x45')],qs[_0xf453('0x47')](_0x2d7441[_0xf453('0x44')][_0xf453('0x47')]));_0x24a24f[_0xf453('0x48')]=_0x24a24f['attributes'][_0xf453('0x49')]?_0x24a24f['attributes']:_0x2c3f93[_0xf453('0x45')];if(!_0x2d7441[_0xf453('0x44')][_0xf453('0x4a')](_0xf453('0x4b'))){_0x24a24f[_0xf453('0x2d')]=qs[_0xf453('0x2d')](_0x2d7441[_0xf453('0x44')][_0xf453('0x2d')]);_0x24a24f[_0xf453('0x2b')]=qs[_0xf453('0x2b')](_0x2d7441[_0xf453('0x44')][_0xf453('0x2b')]);}_0x24a24f[_0xf453('0x4c')]=qs[_0xf453('0x4d')](_0x2d7441[_0xf453('0x44')][_0xf453('0x4d')]);_0x24a24f[_0xf453('0x4e')]=qs[_0xf453('0x4f')](_[_0xf453('0x50')](_0x2d7441[_0xf453('0x44')],_0x2c3f93[_0xf453('0x4f')]),_0x355f14);if(_0x2d7441['query'][_0xf453('0x51')]){_0x24a24f[_0xf453('0x4e')]=_[_0xf453('0x52')](_0x24a24f[_0xf453('0x4e')],{'$or':_[_0xf453('0x3d')](_0x355f14,function(_0x3c8f89){if(_0x3c8f89[_0xf453('0x41')]!=='VIRTUAL'){var _0x8646b3={};_0x8646b3[_0x3c8f89['name']]={'$like':'%'+_0x2d7441[_0xf453('0x44')][_0xf453('0x51')]+'%'};return _0x8646b3;}})});}_0x24a24f=_['merge']({},_0x24a24f,_0x2d7441[_0xf453('0x53')]);var _0x4a0dba={'where':_0x24a24f['where']};return db[_0xf453('0x3e')][_0xf453('0x2e')](_0x4a0dba)['then'](function(_0x40eac5){_0x5e17ce[_0xf453('0x2e')]=_0x40eac5;if(_0x2d7441[_0xf453('0x44')][_0xf453('0x54')]){_0x24a24f[_0xf453('0x55')]=[{'all':!![]}];}return db[_0xf453('0x3e')]['findAll'](_0x24a24f);})['then'](function(_0x5b3a29){_0x5e17ce[_0xf453('0x56')]=_0x5b3a29;return _0x5e17ce;})[_0xf453('0x35')](respondWithFilteredResult(_0x2e38b8,_0x24a24f))[_0xf453('0x57')](handleError(_0x2e38b8,null));};exports[_0xf453('0x58')]=function(_0x43152a,_0xeb73eb){var _0x3409a9={'raw':![],'where':{'id':_0x43152a[_0xf453('0x59')]['id']},'include':[{'model':db[_0xf453('0x3c')],'as':_0xf453('0x5a')}]},_0x4935eb={};_0x4935eb[_0xf453('0x45')]=_['keys'](db['FaxAccount'][_0xf453('0x3f')]);_0x4935eb[_0xf453('0x44')]=_[_0xf453('0x43')](_0x43152a[_0xf453('0x44')]);_0x4935eb[_0xf453('0x4f')]=_[_0xf453('0x46')](_0x4935eb['model'],_0x4935eb[_0xf453('0x44')]);_0x3409a9[_0xf453('0x48')]=_[_0xf453('0x46')](_0x4935eb[_0xf453('0x45')],qs[_0xf453('0x47')](_0x43152a['query'][_0xf453('0x47')]));_0x3409a9[_0xf453('0x48')]=_0x3409a9[_0xf453('0x48')][_0xf453('0x49')]?_0x3409a9['attributes']:_0x4935eb['model'];if(_0x43152a[_0xf453('0x44')][_0xf453('0x54')]){_0x3409a9['include']=[{'all':!![]}];}_0x3409a9=_[_0xf453('0x52')]({},_0x3409a9,_0x43152a[_0xf453('0x53')]);return db[_0xf453('0x3e')][_0xf453('0x5b')](_0x3409a9)['then'](handleEntityNotFound(_0xeb73eb,null))[_0xf453('0x35')](respondWithResult(_0xeb73eb,null))[_0xf453('0x57')](handleError(_0xeb73eb,null));};exports[_0xf453('0x5c')]=function(_0x23b261,_0x2f418b){return db[_0xf453('0x3e')][_0xf453('0x5c')](_0x23b261[_0xf453('0x5d')],{})[_0xf453('0x35')](function(_0x526499){var _0x4ed8ef=_0x23b261[_0xf453('0x5e')][_0xf453('0x37')]({'plain':!![]});if(!_0x4ed8ef)throw new Error(_0xf453('0x5f'));if(_0x4ed8ef[_0xf453('0x60')]===_0xf453('0x5e')){var _0x4bc18b=_0x526499[_0xf453('0x37')]({'plain':!![]});var _0x1cfb83=_0xf453('0x61');return db[_0xf453('0x62')]['find']({'where':{'name':_0x1cfb83,'userProfileId':_0x4ed8ef[_0xf453('0x63')]},'raw':!![]})['then'](function(_0x25ad02){if(_0x25ad02&&_0x25ad02['autoAssociation']===0x0){return db['UserProfileResource'][_0xf453('0x5c')]({'name':_0x4bc18b[_0xf453('0x3b')],'resourceId':_0x4bc18b['id'],'type':_0x25ad02[_0xf453('0x3b')],'sectionId':_0x25ad02['id']},{})[_0xf453('0x35')](function(){return _0x526499;});}else{return _0x526499;}})[_0xf453('0x57')](function(_0x889302){logger[_0xf453('0x22')](_0xf453('0x64'),_0x889302);throw _0x889302;});}return _0x526499;})[_0xf453('0x35')](respondWithResult(_0x2f418b,0xc9))[_0xf453('0x57')](handleError(_0x2f418b,null));};exports[_0xf453('0x34')]=function(_0x38033a,_0x4818c9){if(_0x38033a[_0xf453('0x5d')]['id']){delete _0x38033a['body']['id'];}return db[_0xf453('0x3e')][_0xf453('0x5b')]({'where':{'id':_0x38033a[_0xf453('0x59')]['id']},'include':[{'model':db[_0xf453('0x3c')],'as':_0xf453('0x5a')}]})[_0xf453('0x35')](handleEntityNotFound(_0x4818c9,null))['then'](saveUpdates(_0x38033a[_0xf453('0x5d')],null))[_0xf453('0x35')](respondWithResult(_0x4818c9,null))[_0xf453('0x57')](handleError(_0x4818c9,null));};exports[_0xf453('0x36')]=function(_0x14893a,_0x58e014){return db['FaxAccount'][_0xf453('0x5b')]({'where':{'id':_0x14893a[_0xf453('0x59')]['id']}})['then'](handleEntityNotFound(_0x58e014,null))[_0xf453('0x35')](removeEntity(_0x58e014,null))['catch'](handleError(_0x58e014,null));};exports[_0xf453('0x65')]=function(_0x430c04,_0x54ee8c){return db['FaxAccount'][_0xf453('0x65')]()[_0xf453('0x35')](respondWithResult(_0x54ee8c,null))['catch'](handleError(_0x54ee8c,null));};exports[_0xf453('0x66')]=function(_0x17e2ec,_0xd22939,_0x41480b){if(_0x17e2ec[_0xf453('0x5d')]['id']){delete _0x17e2ec['body']['id'];}return db[_0xf453('0x3e')][_0xf453('0x5b')]({'where':{'id':_0x17e2ec[_0xf453('0x59')]['id']}})['then'](handleEntityNotFound(_0xd22939,null))[_0xf453('0x35')](function(_0x56d127){if(_0x56d127){_0x17e2ec[_0xf453('0x5d')][_0xf453('0x67')]=_0x56d127['id'];return db[_0xf453('0x68')]['create'](_0x17e2ec[_0xf453('0x5d')]);}})['then'](respondWithResult(_0xd22939,null))[_0xf453('0x57')](handleError(_0xd22939,null));};exports[_0xf453('0x69')]=function(_0x1af4cf,_0x807658,_0x3be77a){var _0x52341b={'raw':![],'where':{}};var _0x1c02ad={};var _0x13c2db={'count':0x0,'rows':[]};return db[_0xf453('0x3e')][_0xf453('0x6a')]({'where':{'id':_0x1af4cf[_0xf453('0x59')]['id']}})[_0xf453('0x35')](handleEntityNotFound(_0x807658,null))[_0xf453('0x35')](function(_0x21408c){if(_0x21408c){_0x1c02ad[_0xf453('0x45')]=_[_0xf453('0x43')](db['Disposition'][_0xf453('0x3f')]);_0x1c02ad[_0xf453('0x44')]=_[_0xf453('0x43')](_0x1af4cf[_0xf453('0x44')]);_0x1c02ad['filters']=_['intersection'](_0x1c02ad['model'],_0x1c02ad[_0xf453('0x44')]);_0x52341b[_0xf453('0x48')]=_[_0xf453('0x46')](_0x1c02ad[_0xf453('0x45')],qs[_0xf453('0x47')](_0x1af4cf['query'][_0xf453('0x47')]));_0x52341b[_0xf453('0x48')]=_0x52341b['attributes']['length']?_0x52341b['attributes']:_0x1c02ad[_0xf453('0x45')];if(!_0x1af4cf[_0xf453('0x44')]['hasOwnProperty'](_0xf453('0x4b'))){_0x52341b[_0xf453('0x2d')]=qs[_0xf453('0x2d')](_0x1af4cf[_0xf453('0x44')][_0xf453('0x2d')]);_0x52341b['offset']=qs[_0xf453('0x2b')](_0x1af4cf['query'][_0xf453('0x2b')]);}_0x52341b['order']=qs[_0xf453('0x4d')](_0x1af4cf[_0xf453('0x44')][_0xf453('0x4d')]);_0x52341b[_0xf453('0x4e')]=qs[_0xf453('0x4f')](_[_0xf453('0x50')](_0x1af4cf[_0xf453('0x44')],_0x1c02ad[_0xf453('0x4f')]));_0x52341b[_0xf453('0x4e')]['FaxAccountId']=_0x21408c['id'];if(_0x1af4cf[_0xf453('0x44')][_0xf453('0x51')]){_0x52341b[_0xf453('0x4e')]=_[_0xf453('0x52')](_0x52341b[_0xf453('0x4e')],{'$or':_[_0xf453('0x3d')](_0x52341b['attributes'],function(_0x5aaaed){var _0x2e009f={};_0x2e009f[_0x5aaaed]={'$like':'%'+_0x1af4cf['query']['filter']+'%'};return _0x2e009f;})});}_0x52341b=_[_0xf453('0x52')]({},_0x52341b,_0x1af4cf[_0xf453('0x53')]);return db[_0xf453('0x68')][_0xf453('0x2e')]({'where':_0x52341b[_0xf453('0x4e')]})[_0xf453('0x35')](function(_0xc1986f){_0x13c2db[_0xf453('0x2e')]=_0xc1986f;if(_0x1af4cf['query']['includeAll']){_0x52341b[_0xf453('0x55')]=[{'all':!![]}];}return db[_0xf453('0x68')][_0xf453('0x6b')](_0x52341b);})[_0xf453('0x35')](function(_0x114719){_0x13c2db[_0xf453('0x56')]=_0x114719;return _0x13c2db;});}})[_0xf453('0x35')](respondWithFilteredResult(_0x807658,_0x52341b))[_0xf453('0x57')](handleError(_0x807658,null));};exports[_0xf453('0x6c')]=function(_0x22ea82,_0x43d63b,_0x1a76f3){return db[_0xf453('0x3e')][_0xf453('0x5b')]({'where':{'id':_0x22ea82[_0xf453('0x59')]['id']}})[_0xf453('0x35')](handleEntityNotFound(_0x43d63b,null))['then'](function(_0xa5cede){if(_0xa5cede){return _0xa5cede[_0xf453('0x6c')](_0x22ea82[_0xf453('0x44')][_0xf453('0x6d')]);}})[_0xf453('0x35')](respondWithStatusCode(_0x43d63b,null))[_0xf453('0x57')](handleError(_0x43d63b,null));};exports[_0xf453('0x6e')]=function(_0x3e96c1,_0x1d0a8d,_0x5b5d8a){if(_0x3e96c1[_0xf453('0x5d')]['id']){delete _0x3e96c1['body']['id'];}return db[_0xf453('0x3e')]['find']({'where':{'id':_0x3e96c1[_0xf453('0x59')]['id']}})['then'](handleEntityNotFound(_0x1d0a8d,null))[_0xf453('0x35')](function(_0x291fab){if(_0x291fab){_0x3e96c1[_0xf453('0x5d')][_0xf453('0x67')]=_0x291fab['id'];return db['CannedAnswer'][_0xf453('0x5c')](_0x3e96c1[_0xf453('0x5d')]);}})[_0xf453('0x35')](respondWithResult(_0x1d0a8d,null))[_0xf453('0x57')](handleError(_0x1d0a8d,null));};exports[_0xf453('0x6f')]=function(_0x164801,_0x3be550,_0x1a8244){var _0x1915d1={'raw':![],'where':{}};var _0x453366={};var _0x5755b0={'count':0x0,'rows':[]};return db[_0xf453('0x3e')][_0xf453('0x6a')]({'where':{'id':_0x164801[_0xf453('0x59')]['id']}})[_0xf453('0x35')](handleEntityNotFound(_0x3be550,null))[_0xf453('0x35')](function(_0x4e1560){if(_0x4e1560){_0x453366['model']=_[_0xf453('0x43')](db['CannedAnswer'][_0xf453('0x3f')]);_0x453366[_0xf453('0x44')]=_[_0xf453('0x43')](_0x164801[_0xf453('0x44')]);_0x453366['filters']=_[_0xf453('0x46')](_0x453366[_0xf453('0x45')],_0x453366[_0xf453('0x44')]);_0x1915d1['attributes']=_['intersection'](_0x453366[_0xf453('0x45')],qs[_0xf453('0x47')](_0x164801['query'][_0xf453('0x47')]));_0x1915d1[_0xf453('0x48')]=_0x1915d1[_0xf453('0x48')][_0xf453('0x49')]?_0x1915d1[_0xf453('0x48')]:_0x453366[_0xf453('0x45')];if(!_0x164801[_0xf453('0x44')][_0xf453('0x4a')](_0xf453('0x4b'))){_0x1915d1['limit']=qs[_0xf453('0x2d')](_0x164801[_0xf453('0x44')]['limit']);_0x1915d1[_0xf453('0x2b')]=qs['offset'](_0x164801[_0xf453('0x44')][_0xf453('0x2b')]);}_0x1915d1[_0xf453('0x4c')]=qs[_0xf453('0x4d')](_0x164801[_0xf453('0x44')][_0xf453('0x4d')]);_0x1915d1[_0xf453('0x4e')]=qs[_0xf453('0x4f')](_[_0xf453('0x50')](_0x164801[_0xf453('0x44')],_0x453366['filters']));_0x1915d1['where'][_0xf453('0x67')]=_0x4e1560['id'];if(_0x164801[_0xf453('0x44')][_0xf453('0x51')]){_0x1915d1[_0xf453('0x4e')]=_[_0xf453('0x52')](_0x1915d1[_0xf453('0x4e')],{'$or':_[_0xf453('0x3d')](_0x1915d1[_0xf453('0x48')],function(_0x193e51){var _0x5df280={};_0x5df280[_0x193e51]={'$like':'%'+_0x164801[_0xf453('0x44')]['filter']+'%'};return _0x5df280;})});}_0x1915d1=_['merge']({},_0x1915d1,_0x164801[_0xf453('0x53')]);return db[_0xf453('0x70')][_0xf453('0x2e')]({'where':_0x1915d1[_0xf453('0x4e')]})['then'](function(_0x408d81){_0x5755b0['count']=_0x408d81;if(_0x164801[_0xf453('0x44')][_0xf453('0x54')]){_0x1915d1[_0xf453('0x55')]=[{'all':!![]}];}return db[_0xf453('0x70')]['findAll'](_0x1915d1);})[_0xf453('0x35')](function(_0x395410){_0x5755b0[_0xf453('0x56')]=_0x395410;return _0x5755b0;});}})[_0xf453('0x35')](respondWithFilteredResult(_0x3be550,_0x1915d1))[_0xf453('0x57')](handleError(_0x3be550,null));};exports[_0xf453('0x71')]=function(_0x470909,_0x28b539,_0x3fc91f){return db[_0xf453('0x3e')][_0xf453('0x5b')]({'where':{'id':_0x470909[_0xf453('0x59')]['id']}})[_0xf453('0x35')](handleEntityNotFound(_0x28b539,null))[_0xf453('0x35')](function(_0x54fe65){if(_0x54fe65){return _0x54fe65['removeAnswers'](_0x470909['query'][_0xf453('0x6d')]);}})[_0xf453('0x35')](respondWithStatusCode(_0x28b539,null))[_0xf453('0x57')](handleError(_0x28b539,null));};exports[_0xf453('0x72')]=function(_0x5ec8f8,_0x1bb99b,_0x56010f){return db[_0xf453('0x73')][_0xf453('0x5b')]({'where':{'id':_0x5ec8f8[_0xf453('0x59')]['id']}})[_0xf453('0x35')](handleEntityNotFound(_0x1bb99b,null))[_0xf453('0x35')](function(_0x113157){if(_0x113157){return _0x113157['addInteraction'](_0x5ec8f8[_0xf453('0x5d')][_0xf453('0x6d')],_[_0xf453('0x74')](_0x5ec8f8['body'],[_0xf453('0x6d'),'id'])||{});}})[_0xf453('0x35')](respondWithResult(_0x1bb99b,null))['catch'](handleError(_0x1bb99b,null));};exports[_0xf453('0x75')]=function(_0x1115f2,_0x57de44,_0x332661){var _0x41a09c={'raw':![],'where':{}};var _0x43d09b={};var _0x5ed3cd={'count':0x0,'rows':[]};return db[_0xf453('0x3e')]['findOne']({'where':{'id':_0x1115f2[_0xf453('0x59')]['id']}})[_0xf453('0x35')](handleEntityNotFound(_0x57de44,null))[_0xf453('0x35')](function(_0x5b7ab9){if(_0x5b7ab9){_0x43d09b[_0xf453('0x45')]=_[_0xf453('0x43')](db[_0xf453('0x73')][_0xf453('0x3f')]);_0x43d09b[_0xf453('0x44')]=_[_0xf453('0x43')](_0x1115f2[_0xf453('0x44')]);_0x43d09b[_0xf453('0x4f')]=_['intersection'](_0x43d09b['model'],_0x43d09b[_0xf453('0x44')]);_0x41a09c[_0xf453('0x48')]=_['intersection'](_0x43d09b[_0xf453('0x45')],qs[_0xf453('0x47')](_0x1115f2[_0xf453('0x44')]['fields']));_0x41a09c['attributes']=_0x41a09c[_0xf453('0x48')][_0xf453('0x49')]?_0x41a09c[_0xf453('0x48')]:_0x43d09b[_0xf453('0x45')];if(!_0x1115f2['query'][_0xf453('0x4a')](_0xf453('0x4b'))){_0x41a09c[_0xf453('0x2d')]=qs[_0xf453('0x2d')](_0x1115f2[_0xf453('0x44')][_0xf453('0x2d')]);_0x41a09c[_0xf453('0x2b')]=qs[_0xf453('0x2b')](_0x1115f2[_0xf453('0x44')][_0xf453('0x2b')]);}_0x41a09c['order']=qs[_0xf453('0x4d')](_0x1115f2[_0xf453('0x44')][_0xf453('0x4d')]);_0x41a09c[_0xf453('0x4e')]=qs[_0xf453('0x4f')](_['pick'](_0x1115f2[_0xf453('0x44')],_0x43d09b[_0xf453('0x4f')]));_0x41a09c[_0xf453('0x4e')][_0xf453('0x67')]=_0x5b7ab9['id'];if(_0x1115f2[_0xf453('0x44')][_0xf453('0x51')]){_0x41a09c['where']=_['merge'](_0x41a09c[_0xf453('0x4e')],{'$or':_[_0xf453('0x3d')](_0x41a09c[_0xf453('0x48')],function(_0x3815b5){var _0x195689={};_0x195689[_0x3815b5]={'$like':'%'+_0x1115f2[_0xf453('0x44')][_0xf453('0x51')]+'%'};return _0x195689;})});}_0x41a09c=_[_0xf453('0x52')]({},_0x41a09c,_0x1115f2[_0xf453('0x53')]);return db[_0xf453('0x73')][_0xf453('0x2e')]({'where':_0x41a09c['where']})[_0xf453('0x35')](function(_0x5efe09){_0x5ed3cd['count']=_0x5efe09;if(_0x1115f2['query'][_0xf453('0x54')]){_0x41a09c[_0xf453('0x55')]=[{'model':db[_0xf453('0x76')],'as':_0xf453('0x77'),'required':![]},{'model':db[_0xf453('0x78')],'as':_0xf453('0x79'),'attributes':[_0xf453('0x3b'),_0xf453('0x7a'),'internal'],'required':![]},{'model':db[_0xf453('0x7b')],'as':_0xf453('0x7c'),'attributes':['id','name',_0xf453('0x7d')],'where':_0x1115f2[_0xf453('0x44')][_0xf453('0x7e')]?{'id':_0x1115f2['query'][_0xf453('0x7e')]}:undefined,'required':_0x1115f2['query']['tag']?!![]:![]}];}return db[_0xf453('0x73')][_0xf453('0x6b')](_0x41a09c);})[_0xf453('0x35')](function(_0x4b5a26){_0x5ed3cd[_0xf453('0x56')]=_0x4b5a26;return _0x5ed3cd;});}})[_0xf453('0x35')](respondWithFilteredResult(_0x57de44,_0x41a09c))['catch'](handleError(_0x57de44,null));};exports['addApplications']=function(_0x277527,_0xf6f321){var _0x3750bb=_0x277527['params']['id'];var _0x1d91fa=_0x277527['body'];var _0x52f81d=0xc8;var _0x2979b1=null;return db[_0xf453('0x7f')][_0xf453('0x80')]({'isolationLevel':db[_0xf453('0x7f')][_0xf453('0x81')][_0xf453('0x82')][_0xf453('0x83')]},function(_0x2e8579){return db[_0xf453('0x3e')][_0xf453('0x6a')]({'where':{'id':_0x3750bb},'transaction':_0x2e8579})['then'](function(_0x24d442){if(_0x24d442){return db['FaxApplication'][_0xf453('0x36')]({'where':{'FaxAccountId':_0x3750bb},'transaction':_0x2e8579})[_0xf453('0x35')](function(){var _0x4817e4=_[_0xf453('0x3d')](_0x1d91fa,function(_0x4fae17){_0x4fae17[_0xf453('0x67')]=_0x3750bb;return _0x4fae17;});return db[_0xf453('0x84')][_0xf453('0x85')](_0x4817e4,{'transaction':_0x2e8579});});}else{_0x52f81d=0x194;_0x2979b1=[];}});})[_0xf453('0x35')](function(){if(_0x52f81d!==0x194){return db[_0xf453('0x84')]['findAndCountAll']({'where':{'FaxAccountId':_0x3750bb},'order':_0xf453('0x86')})['then'](function(_0x26bea1){_0x2979b1=_0x26bea1;});}})[_0xf453('0x57')](function(_0x3d5ccf){_0x52f81d=0x1f4;logger[_0xf453('0x22')](_0x3d5ccf[_0xf453('0x3a')]);if(_0x3d5ccf['name']){delete _0x3d5ccf[_0xf453('0x3b')];}_0x2979b1=_0x3d5ccf;})[_0xf453('0x87')](function(){if(_0x2979b1===null){_0xf6f321['sendStatus'](_0x52f81d);}else{if(_0x52f81d===0x1f4){_0xf6f321[_0xf453('0x28')](_0x52f81d)[_0xf453('0x88')](_0x2979b1);}else{_0xf6f321[_0xf453('0x28')](_0x52f81d)[_0xf453('0x2a')](_0x2979b1);}}});};exports['getApplications']=function(_0x7779c6,_0x51d575,_0x25ccd5){var _0x2948b9={};var _0x12d49a={};var _0x58f683;var _0x669146;return db[_0xf453('0x3e')][_0xf453('0x6a')]({'where':{'id':_0x7779c6[_0xf453('0x59')]['id']}})[_0xf453('0x35')](handleEntityNotFound(_0x51d575,null))[_0xf453('0x35')](function(_0x5749a7){if(_0x5749a7){_0x58f683=_0x5749a7;_0x12d49a[_0xf453('0x45')]=_[_0xf453('0x43')](db['FaxApplication'][_0xf453('0x3f')]);_0x12d49a[_0xf453('0x44')]=_[_0xf453('0x43')](_0x7779c6[_0xf453('0x44')]);_0x12d49a[_0xf453('0x4f')]=_[_0xf453('0x46')](_0x12d49a['model'],_0x12d49a['query']);_0x2948b9['attributes']=_[_0xf453('0x46')](_0x12d49a[_0xf453('0x45')],qs[_0xf453('0x47')](_0x7779c6['query'][_0xf453('0x47')]));_0x2948b9['attributes']=_0x2948b9['attributes'][_0xf453('0x49')]?_0x2948b9[_0xf453('0x48')]:_0x12d49a[_0xf453('0x45')];_0x2948b9['order']=qs[_0xf453('0x4d')](_0x7779c6[_0xf453('0x44')][_0xf453('0x4d')]);_0x2948b9[_0xf453('0x4e')]=qs[_0xf453('0x4f')](_[_0xf453('0x50')](_0x7779c6[_0xf453('0x44')],_0x12d49a[_0xf453('0x4f')]));if(_0x7779c6[_0xf453('0x44')]['filter']){_0x2948b9[_0xf453('0x4e')]=_[_0xf453('0x52')](_0x2948b9['where'],{'$or':_[_0xf453('0x3d')](_0x2948b9[_0xf453('0x48')],function(_0x9a8810){var _0xb63724={};_0xb63724[_0x9a8810]={'$like':'%'+_0x7779c6[_0xf453('0x44')][_0xf453('0x51')]+'%'};return _0xb63724;})});}_0x2948b9=_[_0xf453('0x52')]({},_0x2948b9,_0x7779c6[_0xf453('0x53')]);return _0x58f683[_0xf453('0x89')](_0x2948b9);}})[_0xf453('0x35')](function(_0x125fcf){if(_0x125fcf){_0x669146=_0x125fcf[_0xf453('0x49')];if(!_0x7779c6['query'][_0xf453('0x4a')]('nolimit')){_0x2948b9[_0xf453('0x2d')]=qs['limit'](_0x7779c6[_0xf453('0x44')]['limit']);_0x2948b9[_0xf453('0x2b')]=qs[_0xf453('0x2b')](_0x7779c6[_0xf453('0x44')][_0xf453('0x2b')]);}return _0x58f683[_0xf453('0x89')](_0x2948b9);}})['then'](function(_0x3d41d2){if(_0x3d41d2){return _0x3d41d2?{'count':_0x669146,'rows':_0x3d41d2}:null;}})[_0xf453('0x35')](respondWithResult(_0x51d575,null))['catch'](handleError(_0x51d575,null));};function Extension(_0x496c5a,_0x36bacf,_0x5a3a12,_0x4ee172){this[_0xf453('0x8a')]=_0xf453('0x8b');this[_0xf453('0x8c')]=_0x496c5a[_0xf453('0x8d')];this['app']=_0x4ee172;this[_0xf453('0x41')]=_0xf453('0x8e');this[_0xf453('0x8f')]=_0xf453('0x90');this[_0xf453('0x67')]=_0x496c5a['id'];this[_0xf453('0x86')]=_0x36bacf;this[_0xf453('0x91')]=_0x5a3a12;}function createExtensionsReciveFax(_0x3a5d2c){var _0x360350=0x1;var _0x215c3f=[];_0x215c3f['push'](new Extension(_0x3a5d2c,_0x360350,'',_0xf453('0x92')));_0x360350+=0x1;_0x215c3f['push'](new Extension(_0x3a5d2c,_0x360350,_0xf453('0x93'),'Set'));_0x360350+=0x1;for(var _0x22f5cf in _0x3a5d2c){if(_0x3a5d2c[_0xf453('0x4a')](_0x22f5cf)&&(_0x22f5cf===_0xf453('0x94')||_0x22f5cf===_0xf453('0x8d')||_0x22f5cf===_0xf453('0x95')||_0x22f5cf==='faxdetect'||_0x22f5cf===_0xf453('0x96')||_0x22f5cf===_0xf453('0x97')||_0x22f5cf===_0xf453('0x98')||_0x22f5cf===_0xf453('0x99')||_0x22f5cf===_0xf453('0x9a'))){_0x215c3f['push'](new Extension(_0x3a5d2c,_0x360350,_0xf453('0x9b')+_0x22f5cf+')='+_0x3a5d2c[_0x22f5cf],'Set'));_0x360350+=0x1;}}_0x215c3f[_0xf453('0x9c')](new Extension(_0x3a5d2c,_0x360350,'6',_0xf453('0x9d')));_0x360350+=0x1;_0x215c3f['push'](new Extension(_0x3a5d2c,_0x360350,'/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',_0xf453('0x9e')));_0x360350=0x0;return _0x215c3f;}exports[_0xf453('0x9f')]=function(_0x1848bd,_0x2ecc6a,_0x1b3225){var _0x32a22d;return db[_0xf453('0x7f')][_0xf453('0x80')](function(_0x5a70cd){return db[_0xf453('0x3e')][_0xf453('0x5c')](_0x1848bd[_0xf453('0x5d')],{'transaction':_0x5a70cd})[_0xf453('0x35')](function(_0xf0126c){_0x32a22d=_0xf0126c[_0xf453('0x37')]({'plain':!![]});return db[_0xf453('0xa0')][_0xf453('0x85')](createExtensionsReciveFax(_0x32a22d),{'transaction':_0x5a70cd});});})[_0xf453('0x35')](function(){return _0x32a22d;})[_0xf453('0x35')](respondWithResult(_0x2ecc6a,null))[_0xf453('0x57')](handleError(_0x2ecc6a,null));};exports['updateAccountApplications']=function(_0x22d9ed,_0x26ae4c,_0x5207ca){var _0x4694a6;return db[_0xf453('0x7f')][_0xf453('0x80')](function(_0x3011f8){return db[_0xf453('0x3e')][_0xf453('0x34')](_0x22d9ed[_0xf453('0x5d')],{'where':{'id':_0x22d9ed[_0xf453('0x5d')]['id']},'transaction':_0x3011f8})[_0xf453('0x35')](function(_0x59d147){return db['VoiceExtension'][_0xf453('0x36')]({'where':{'FaxAccountId':_0x22d9ed['body']['id']},'transaction':_0x3011f8})['then'](function(_0x47d5a1){return db[_0xf453('0xa0')][_0xf453('0x85')](createExtensionsReciveFax(_[_0xf453('0x74')](_0x22d9ed[_0xf453('0x5d')],[_0xf453('0xa1'),_0xf453('0x42'),_0xf453('0xa2'),_0xf453('0xa3'),_0xf453('0xa4'),'ListId'])),{'transaction':_0x3011f8});});});})[_0xf453('0x35')](function(){return db[_0xf453('0x3e')][_0xf453('0xa5')](_0x22d9ed[_0xf453('0x5d')]['id']);})[_0xf453('0x35')](respondWithResult(_0x26ae4c,null))[_0xf453('0x57')](handleError(_0x26ae4c,null));};exports[_0xf453('0xa6')]=function(_0x3ea9b5,_0x1e8ec7,_0x56ddc4){var _0x45dd40={'raw':!![],'where':{}};var _0x2edbc5={};var _0xc5c819={'count':0x0,'rows':[]};return db[_0xf453('0x3e')][_0xf453('0x6a')]({'where':{'id':_0x3ea9b5['params']['id']}})[_0xf453('0x35')](handleEntityNotFound(_0x1e8ec7,null))[_0xf453('0x35')](function(_0x473e5e){if(_0x473e5e){_0x2edbc5[_0xf453('0x45')]=_[_0xf453('0x43')](db[_0xf453('0xa7')][_0xf453('0x3f')]);_0x2edbc5[_0xf453('0x44')]=_['keys'](_0x3ea9b5['query']);_0x2edbc5[_0xf453('0x4f')]=_[_0xf453('0x46')](_0x2edbc5[_0xf453('0x45')],_0x2edbc5[_0xf453('0x44')]);_0x45dd40[_0xf453('0x48')]=_['intersection'](_0x2edbc5[_0xf453('0x45')],qs['fields'](_0x3ea9b5[_0xf453('0x44')][_0xf453('0x47')]));_0x45dd40[_0xf453('0x48')]=_0x45dd40[_0xf453('0x48')][_0xf453('0x49')]?_0x45dd40[_0xf453('0x48')]:_0x2edbc5[_0xf453('0x45')];if(!_0x3ea9b5[_0xf453('0x44')]['hasOwnProperty'](_0xf453('0x4b'))){_0x45dd40[_0xf453('0x2d')]=qs['limit'](_0x3ea9b5[_0xf453('0x44')][_0xf453('0x2d')]);_0x45dd40[_0xf453('0x2b')]=qs[_0xf453('0x2b')](_0x3ea9b5[_0xf453('0x44')]['offset']);}_0x45dd40[_0xf453('0x4c')]=qs[_0xf453('0x4d')](_0x3ea9b5[_0xf453('0x44')][_0xf453('0x4d')]);_0x45dd40[_0xf453('0x4e')]=qs[_0xf453('0x4f')](_[_0xf453('0x50')](_0x3ea9b5[_0xf453('0x44')],_0x2edbc5[_0xf453('0x4f')]));_0x45dd40[_0xf453('0x4e')]['FaxAccountId']=_0x473e5e['id'];if(_0x3ea9b5[_0xf453('0x44')][_0xf453('0x51')]){_0x45dd40[_0xf453('0x4e')]=_['merge'](_0x45dd40[_0xf453('0x4e')],{'$or':_[_0xf453('0x3d')](_0x45dd40['attributes'],function(_0x1c7437){var _0x339d33={};_0x339d33[_0x1c7437]={'$like':'%'+_0x3ea9b5[_0xf453('0x44')]['filter']+'%'};return _0x339d33;})});}if(_0x3ea9b5['query']['$gte']){var _0x3c44e6=_0x3ea9b5[_0xf453('0x44')][_0xf453('0xa8')][_0xf453('0xa9')](',');var _0x5f1b7={};_0x5f1b7[_0x3c44e6[0x0]]={'$gte':moment(_0x3c44e6[0x1])[_0xf453('0xaa')](_0xf453('0xab'))};_0x45dd40[_0xf453('0x4e')]=_[_0xf453('0x52')](_0x45dd40[_0xf453('0x4e')],_0x5f1b7);}_0x45dd40=_[_0xf453('0x52')]({},_0x45dd40,_0x3ea9b5['options']);return db[_0xf453('0xa7')][_0xf453('0x2e')]({'where':_0x45dd40[_0xf453('0x4e')]})[_0xf453('0x35')](function(_0x192f41){_0xc5c819[_0xf453('0x2e')]=_0x192f41;if(_0x3ea9b5['query'][_0xf453('0x54')]){_0x45dd40[_0xf453('0x55')]=[{'all':!![]}];}return db[_0xf453('0xa7')][_0xf453('0x6b')](_0x45dd40);})[_0xf453('0x35')](function(_0x3b63e1){_0xc5c819[_0xf453('0x56')]=_0x3b63e1;return _0xc5c819;});}})[_0xf453('0x35')](respondWithFilteredResult(_0x1e8ec7,_0x45dd40))[_0xf453('0x57')](handleError(_0x1e8ec7,null));};exports['send']=function(_0x74ff79,_0x80b887,_0x411d75){var _0x5a04c8,_0x185f94={},_0x44e848;if(_0x74ff79[_0xf453('0x5d')]['to']){_0x44e848=_0x74ff79[_0xf453('0x5d')]['to'][0x0];}return db[_0xf453('0x3e')]['find']({'where':{'id':_0x74ff79[_0xf453('0x59')]['id']},'include':[{'model':db[_0xf453('0xac')],'as':_0xf453('0xad'),'include':[{'model':db[_0xf453('0x76')],'as':_0xf453('0xae'),'where':{'fax':_0x44e848},'limit':0x1,'order':[[_0xf453('0xa3'),_0xf453('0xaf')]]}]}]})[_0xf453('0x35')](handleEntityNotFound(_0x80b887,null))['then'](function(_0x1523e0){_0x5a04c8=_0x1523e0;if(_0x74ff79[_0xf453('0x5d')][_0xf453('0xb0')]&&_0x74ff79['body'][_0xf453('0xb0')][_0xf453('0x49')]){for(var _0x5d394c=0x0;_0x5d394c<_0x74ff79['body'][_0xf453('0xb0')][_0xf453('0x49')];_0x5d394c+=0x1){_0x74ff79[_0xf453('0x5d')][_0xf453('0xb0')][_0x5d394c]={'filename':_0x74ff79['body'][_0xf453('0xb0')][_0x5d394c][_0xf453('0x3b')],'id':_0x74ff79[_0xf453('0x5d')][_0xf453('0xb0')][_0x5d394c]['id'],'path':path[_0xf453('0xb1')](config['root'],_0xf453('0xb2'),_0x74ff79['body'][_0xf453('0xb0')][_0x5d394c][_0xf453('0xb3')])};}}return respondWithRpcPromise(_0xf453('0xb4'),'CheckAfterSend',{'FaxAccountId':_[_0xf453('0xb5')](_0x74ff79[_0xf453('0x59')]['id'])?undefined:_0x74ff79[_0xf453('0x59')]['id'],'path':_[_0xf453('0xb5')](_0x74ff79['body'][_0xf453('0xb0')][0x0]['path'])?undefined:_0x74ff79[_0xf453('0x5d')][_0xf453('0xb0')][0x0][_0xf453('0x4')],'fax':_['isNil'](_0x74ff79[_0xf453('0x5d')]['to'][0x0])?undefined:_0x74ff79['body']['to'][0x0]},client9002);})[_0xf453('0x35')](function(){if(_0x5a04c8){if(_['isNil'](_0x74ff79[_0xf453('0x5d')][_0xf453('0xb6')])){_0x74ff79[_0xf453('0x5d')][_0xf453('0xb6')]=util[_0xf453('0xaa')](_0xf453('0xb7'),_0x5a04c8[_0xf453('0x3b')],_0x5a04c8[_0xf453('0xb8')]);}if(_0x5a04c8[_0xf453('0xad')]){if(_0x5a04c8[_0xf453('0xad')][_0xf453('0xae')][_0xf453('0x49')]){return _0x5a04c8[_0xf453('0xad')][_0xf453('0xae')][0x0];}else{return db[_0xf453('0x76')][_0xf453('0x5c')](_['defaults'](_0x74ff79[_0xf453('0x5d')],{'firstName':_0x74ff79['body']['to'][0x0],'phone':_0x74ff79['body']['to'][0x0],'fax':_0x74ff79[_0xf453('0x5d')]['to'][0x0],'ListId':_0x5a04c8[_0xf453('0xb9')]}));}}else{throw new Error('List\x20not\x20found');}}else{throw new Error(_0xf453('0xba'));}})[_0xf453('0x35')](function(_0x56a662){if(_0x56a662){return db[_0xf453('0x73')]['find']({'where':{'ContactId':_0x56a662['id'],'closed':![],'FaxAccountId':_0x5a04c8['id']}})[_0xf453('0x35')](function(_0x274121){if(_0x274121){return[_0x274121,![]];}return db[_0xf453('0x73')][_0xf453('0x5c')]({'UserId':_0x74ff79[_0xf453('0x5e')]['id'],'ContactId':_0x56a662['id'],'FaxAccountId':_0x5a04c8['id'],'fax':_0x74ff79[_0xf453('0x5d')]['to'][0x0],'firstMsgDirection':_0xf453('0xbb'),'Messages':[_[_0xf453('0x52')](_0x74ff79[_0xf453('0x5d')],{'read':![],'body':_0x74ff79[_0xf453('0x5d')][_0xf453('0xb0')][0x0][_0xf453('0xbc')],'FaxAccountId':_0x5a04c8['id'],'UserId':_0x74ff79['user']['id'],'ContactId':_0x56a662['id'],'AttachmentId':_0x74ff79['body'][_0xf453('0xb0')][0x0]['id']})]},{'include':[{'model':db['FaxMessage'],'as':_0xf453('0xbd')}]})['then'](function(_0x5f3f1d){return[_0x5f3f1d,!![]];});});}else{throw new Error(_0xf453('0xbe'));}})['spread'](function(_0x2f56f4,_0x186f7a){if(_0x186f7a){return _0x2f56f4;}return db[_0xf453('0xa7')][_0xf453('0x5c')]({'direction':_0xf453('0xbb'),'read':![],'body':_0x74ff79[_0xf453('0x5d')][_0xf453('0xb0')][0x0]['filename'],'FaxAccountId':_0x5a04c8['id'],'FaxInteractionId':_0x2f56f4['id'],'UserId':_0x74ff79[_0xf453('0x5e')]['id'],'ContactId':_0x2f56f4[_0xf453('0xbf')],'AttachmentId':_0x74ff79[_0xf453('0x5d')][_0xf453('0xb0')][0x0]['id']})['then'](function(_0x5862a3){_0x2f56f4[_0xf453('0xc0')]['Messages']=[];_0x2f56f4['dataValues'][_0xf453('0xbd')][_0xf453('0x9c')](_0x5862a3['dataValues']);return _0x2f56f4;});})[_0xf453('0x35')](function(_0x10a844){respondWithRpcPromise(_0xf453('0xc1'),'SendFax',{'FaxAccountId':_[_0xf453('0xb5')](_0x74ff79[_0xf453('0x59')]['id'])?undefined:_0x74ff79['params']['id'],'path':_[_0xf453('0xb5')](_0x74ff79['body'][_0xf453('0xb0')][0x0][_0xf453('0x4')])?undefined:_0x74ff79[_0xf453('0x5d')][_0xf453('0xb0')][0x0]['path'],'fax':_[_0xf453('0xb5')](_0x74ff79['body']['to'][0x0])?undefined:_0x74ff79[_0xf453('0x5d')]['to'][0x0],'AttachmentId':_0x74ff79['body'][_0xf453('0xb0')][0x0]['id']},client9002)[_0xf453('0x35')](function(_0x14d3c3){logger[_0xf453('0x26')](_0xf453('0xc2'),_0x14d3c3);})[_0xf453('0x57')](function(_0xd97959){logger[_0xf453('0x26')](_0xf453('0xc2'),_0xd97959);});return _0x10a844;})[_0xf453('0x35')](respondWithResult(_0x80b887,null))['catch'](handleError(_0x80b887,null));};exports[_0xf453('0xc3')]=function(_0x37bb20,_0x3f28df,_0x48ce3e){return db['FaxAccount']['find']({'where':{'id':_0x37bb20['params']['id']}})[_0xf453('0x35')](handleEntityNotFound(_0x3f28df,null))[_0xf453('0x35')](function(_0x4a0435){if(_0x4a0435){return _0x4a0435[_0xf453('0xc3')](_0x37bb20['body'][_0xf453('0x6d')],_[_0xf453('0x74')](_0x37bb20[_0xf453('0x5d')],['ids','id'])||{})[_0xf453('0xc4')](function(_0x2f546c){for(var _0x399bd9=0x0;_0x399bd9<_0x37bb20[_0xf453('0x5d')][_0xf453('0x6d')][_0xf453('0x49')];_0x399bd9+=0x1){socket[_0xf453('0xc5')](_0xf453('0xc6'),{'UserId':Number(_0x37bb20[_0xf453('0x5d')][_0xf453('0x6d')][_0x399bd9]),'FaxAccountId':Number(_0x37bb20['params']['id'])});}return _0x2f546c;});}})['then'](respondWithResult(_0x3f28df,null))[_0xf453('0x57')](handleError(_0x3f28df,null));};exports[_0xf453('0xc7')]=function(_0x196209,_0x3bef84,_0x4b2b6f){return db[_0xf453('0x3e')][_0xf453('0x5b')]({'where':{'id':_0x196209[_0xf453('0x59')]['id']}})['then'](handleEntityNotFound(_0x3bef84,null))[_0xf453('0x35')](function(_0x31d4fe){if(_0x31d4fe){return _0x31d4fe['removeAgents'](_0x196209[_0xf453('0x44')]['ids'])[_0xf453('0x35')](function(){if(_['isArray'](_0x196209['query']['ids'])){for(var _0x9bca55=0x0;_0x9bca55<_0x196209[_0xf453('0x44')][_0xf453('0x6d')][_0xf453('0x49')];_0x9bca55+=0x1){socket['emit']('userFaxAccount:remove',{'UserId':Number(_0x196209['query']['ids'][_0x9bca55]),'FaxAccountId':Number(_0x196209[_0xf453('0x59')]['id'])});}}else{socket['emit'](_0xf453('0xc8'),{'UserId':Number(_0x196209['query'][_0xf453('0x6d')]),'FaxAccountId':Number(_0x196209[_0xf453('0x59')]['id'])});}});}})[_0xf453('0x35')](respondWithStatusCode(_0x3bef84,null))[_0xf453('0x57')](handleError(_0x3bef84,null));};exports[_0xf453('0xc9')]=function(_0x6ae284,_0xfa30df,_0x2758fb){var _0x5acd29={};var _0x282183={};var _0x1f024f;var _0x2dd766;return db['FaxAccount'][_0xf453('0x6a')]({'where':{'id':_0x6ae284['params']['id']}})[_0xf453('0x35')](handleEntityNotFound(_0xfa30df,null))[_0xf453('0x35')](function(_0x29a318){if(_0x29a318){_0x1f024f=_0x29a318;_0x282183[_0xf453('0x45')]=_[_0xf453('0x43')](db[_0xf453('0x78')][_0xf453('0x3f')]);_0x282183['query']=_[_0xf453('0x43')](_0x6ae284[_0xf453('0x44')]);_0x282183[_0xf453('0x4f')]=_[_0xf453('0x46')](_0x282183[_0xf453('0x45')],_0x282183[_0xf453('0x44')]);_0x5acd29['attributes']=_['intersection'](_0x282183[_0xf453('0x45')],qs[_0xf453('0x47')](_0x6ae284['query'][_0xf453('0x47')]));_0x5acd29[_0xf453('0x48')]=_0x5acd29[_0xf453('0x48')][_0xf453('0x49')]?_0x5acd29[_0xf453('0x48')]:_0x282183[_0xf453('0x45')];_0x5acd29[_0xf453('0x4c')]=qs[_0xf453('0x4d')](_0x6ae284[_0xf453('0x44')][_0xf453('0x4d')]);_0x5acd29['where']=qs[_0xf453('0x4f')](_[_0xf453('0x50')](_0x6ae284[_0xf453('0x44')],_0x282183[_0xf453('0x4f')]));if(_0x6ae284[_0xf453('0x44')][_0xf453('0x51')]){_0x5acd29[_0xf453('0x4e')]=_[_0xf453('0x52')](_0x5acd29[_0xf453('0x4e')],{'$or':_[_0xf453('0x3d')](_0x5acd29[_0xf453('0x48')],function(_0x51a045){var _0x3abd37={};_0x3abd37[_0x51a045]={'$like':'%'+_0x6ae284[_0xf453('0x44')][_0xf453('0x51')]+'%'};return _0x3abd37;})});}_0x5acd29=_[_0xf453('0x52')]({},_0x5acd29,_0x6ae284[_0xf453('0x53')]);return _0x1f024f[_0xf453('0xc9')](_0x5acd29);}})[_0xf453('0x35')](function(_0x342d7e){if(_0x342d7e){_0x2dd766=_0x342d7e[_0xf453('0x49')];if(!_0x6ae284[_0xf453('0x44')][_0xf453('0x4a')](_0xf453('0x4b'))){_0x5acd29['limit']=qs[_0xf453('0x2d')](_0x6ae284[_0xf453('0x44')]['limit']);_0x5acd29[_0xf453('0x2b')]=qs['offset'](_0x6ae284[_0xf453('0x44')]['offset']);}return _0x1f024f['getAgents'](_0x5acd29);}})[_0xf453('0x35')](function(_0x15bea6){if(_0x15bea6){return _0x15bea6?{'count':_0x2dd766,'rows':_0x15bea6}:null;}})[_0xf453('0x35')](respondWithResult(_0xfa30df,null))[_0xf453('0x57')](handleError(_0xfa30df,null));}; \ No newline at end of file +var _0x33eb=['send','index','Pause','map','FaxAccount','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','includeAll','include','show','params','mandatoryDispositionPause','length','options','find','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','body','describe','addDisposition','FaxAccountId','getDispositions','findOne','nolimit','filter','Disposition','findAll','rows','removeDispositions','ids','CannedAnswer','removeAnswers','addInteraction','FaxInteraction','omit','getInteractions','CmContact','User','Owner','fullname','internal','color','tag','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','bulkCreate','finally','json','getApplications','context','from-voip-provider','exten','localstationid','description','Fax\x20Extension','priority','appdata','push','Set','ecm','gateway','faxdetect','headerinfo','maxrate','minrate','t38timeout','FAXOPT(','/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','tech','updatedAt','TrunkId','findById','getMessages','$gte','split','YYYY-MM-DD\x20HH:mm:ss','FaxMessage','CmList','List','Contacts','DESC','attachments','join','root','basename','CheckAfterSend','isNil','\x22%s\x22\x20<%s>','fax','create','ListId','List\x20not\x20found','Send\x20Fax\x20failed','out','filename','Contact\x20not\x20found','spread','dataValues','Messages','SendFax','SendFaxRpc,\x20%s','addAgents','removeAgents','isArray','emit','userFaxAccount:remove','getAgents','eml-format','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','jayson/promise','client','http','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','end','offset','undefined','limit','count','Content-Range','apply','save','update','destroy','get','FaxAccounts','UserProfileResource','stack','name'];(function(_0x1561b3,_0x5cafa3){var _0x4aa638=function(_0x4a147d){while(--_0x4a147d){_0x1561b3['push'](_0x1561b3['shift']());}};_0x4aa638(++_0x5cafa3);}(_0x33eb,0x14b));var _0xb33e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x33eb[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0xb33e('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xb33e('0x1'));var rp=require(_0xb33e('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xb33e('0x3'));var util=require(_0xb33e('0x4'));var path=require(_0xb33e('0x5'));var sox=require(_0xb33e('0x6'));var csv=require(_0xb33e('0x7'));var ejs=require(_0xb33e('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb33e('0x9'));var squel=require(_0xb33e('0xa'));var crypto=require(_0xb33e('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xb33e('0xc'));var toCsv=require('to-csv');var querystring=require(_0xb33e('0xd'));var Papa=require(_0xb33e('0xe'));var Redis=require(_0xb33e('0xf'));var authService=require(_0xb33e('0x10'));var qs=require(_0xb33e('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb33e('0x12'));var logger=require(_0xb33e('0x13'))('api');var utils=require(_0xb33e('0x14'));var config=require(_0xb33e('0x15'));var licenseUtil=require(_0xb33e('0x16'));var db=require(_0xb33e('0x17'))['db'];config[_0xb33e('0x18')]=_[_0xb33e('0x19')](config[_0xb33e('0x18')],{'host':_0xb33e('0x1a'),'port':0x18eb});var socket=require(_0xb33e('0x1b'))(new Redis(config[_0xb33e('0x18')]));require(_0xb33e('0x1c'))[_0xb33e('0x1d')](socket);var jayson=require(_0xb33e('0x1e'));var client=jayson[_0xb33e('0x1f')]['http']({'port':0x232c});var client9002=jayson[_0xb33e('0x1f')][_0xb33e('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x23d3cb,_0x5b4892,_0xc8357d,_0x59e74e){return new BPromise(function(_0x1e1800,_0x45a642){var _0x2f208d=_0x59e74e||client;return _0x2f208d[_0xb33e('0x21')](_0x23d3cb,_0xc8357d)[_0xb33e('0x22')](function(_0x5a7941){logger[_0xb33e('0x23')](_0xb33e('0x24'),_0x5b4892,_0xb33e('0x25'));logger['debug'](_0xb33e('0x26'),_0x5b4892,_0xb33e('0x25'),JSON[_0xb33e('0x27')](_0x5a7941));if(_0x5a7941[_0xb33e('0x28')]){if(_0x5a7941[_0xb33e('0x28')]['code']===0x1f4){logger[_0xb33e('0x28')](_0xb33e('0x24'),_0x5b4892,_0x5a7941[_0xb33e('0x28')][_0xb33e('0x29')]);return _0x45a642(_0x5a7941[_0xb33e('0x28')][_0xb33e('0x29')]);}logger[_0xb33e('0x28')]('FaxAccount,\x20%s,\x20%s',_0x5b4892,_0x5a7941[_0xb33e('0x28')][_0xb33e('0x29')]);return _0x1e1800(_0x5a7941[_0xb33e('0x28')][_0xb33e('0x29')]);}else{logger[_0xb33e('0x23')](_0xb33e('0x24'),_0x5b4892,_0xb33e('0x25'));_0x1e1800(_0x5a7941[_0xb33e('0x2a')]['message']);}})[_0xb33e('0x2b')](function(_0x1718a1){logger['error'](_0xb33e('0x24'),_0x5b4892,_0x1718a1);_0x45a642(_0x1718a1);});});}function respondWithStatusCode(_0x238b8c,_0x5c7bf7){_0x5c7bf7=_0x5c7bf7||0xcc;return function(_0x1ec2b2){if(_0x1ec2b2){return _0x238b8c[_0xb33e('0x2c')](_0x5c7bf7);}return _0x238b8c[_0xb33e('0x2d')](_0x5c7bf7)[_0xb33e('0x2e')]();};}function respondWithResult(_0x4b763f,_0x4c4340){_0x4c4340=_0x4c4340||0xc8;return function(_0x9dbebe){if(_0x9dbebe){return _0x4b763f[_0xb33e('0x2d')](_0x4c4340)['json'](_0x9dbebe);}};}function respondWithFilteredResult(_0x19c984,_0x25bf28){return function(_0x5ab28e){if(_0x5ab28e){var _0xf65a65=typeof _0x25bf28[_0xb33e('0x2f')]===_0xb33e('0x30')&&typeof _0x25bf28[_0xb33e('0x31')]===_0xb33e('0x30');var _0x3418fc=_0x5ab28e[_0xb33e('0x32')];var _0x2d1853=_0xf65a65?0x0:_0x25bf28['offset'];var _0x5657ae=_0xf65a65?_0x5ab28e['count']:_0x25bf28[_0xb33e('0x2f')]+_0x25bf28['limit'];var _0x343f03;if(_0x5657ae>=_0x3418fc){_0x5657ae=_0x3418fc;_0x343f03=0xc8;}else{_0x343f03=0xce;}_0x19c984[_0xb33e('0x2d')](_0x343f03);return _0x19c984['set'](_0xb33e('0x33'),_0x2d1853+'-'+_0x5657ae+'/'+_0x3418fc)['json'](_0x5ab28e);}return null;};}function patchUpdates(_0x186dae){return function(_0x33d95e){try{jsonpatch[_0xb33e('0x34')](_0x33d95e,_0x186dae,!![]);}catch(_0x5a41fc){return BPromise['reject'](_0x5a41fc);}return _0x33d95e[_0xb33e('0x35')]();};}function saveUpdates(_0x34f560,_0x595e3e){return function(_0x546c06){if(_0x546c06){return _0x546c06[_0xb33e('0x36')](_0x34f560)[_0xb33e('0x22')](function(_0x274942){return _0x274942;});}return null;};}function removeEntity(_0x33b706,_0x6b7483){return function(_0x4616ab){if(_0x4616ab){return _0x4616ab[_0xb33e('0x37')]()[_0xb33e('0x22')](function(){var _0x26efa1=_0x4616ab[_0xb33e('0x38')]({'plain':!![]});var _0x174e76=_0xb33e('0x39');return db[_0xb33e('0x3a')][_0xb33e('0x37')]({'where':{'type':_0x174e76,'resourceId':_0x26efa1['id']}})[_0xb33e('0x22')](function(){return _0x4616ab;});})[_0xb33e('0x22')](function(){_0x33b706[_0xb33e('0x2d')](0xcc)[_0xb33e('0x2e')]();});}};}function handleEntityNotFound(_0x4d2a43,_0x3c460d){return function(_0x4f2d61){if(!_0x4f2d61){_0x4d2a43[_0xb33e('0x2c')](0x194);}return _0x4f2d61;};}function handleError(_0x2bb90e,_0x592724){_0x592724=_0x592724||0x1f4;return function(_0x3a59c2){logger[_0xb33e('0x28')](_0x3a59c2[_0xb33e('0x3b')]);if(_0x3a59c2[_0xb33e('0x3c')]){delete _0x3a59c2[_0xb33e('0x3c')];}_0x2bb90e['status'](_0x592724)[_0xb33e('0x3d')](_0x3a59c2);};}exports[_0xb33e('0x3e')]=function(_0x512c85,_0x12db06){var _0x3ea1ce={'include':[{'model':db[_0xb33e('0x3f')],'as':'mandatoryDispositionPause'}]},_0x5dcc63={},_0x4d12ec={'count':0x0,'rows':[]};var _0x53fca3=_[_0xb33e('0x40')](db[_0xb33e('0x41')][_0xb33e('0x42')],function(_0x25daeb){return{'name':_0x25daeb[_0xb33e('0x43')],'type':_0x25daeb[_0xb33e('0x44')][_0xb33e('0x45')]};});_0x5dcc63['model']=_[_0xb33e('0x40')](_0x53fca3,_0xb33e('0x3c'));_0x5dcc63[_0xb33e('0x46')]=_[_0xb33e('0x47')](_0x512c85['query']);_0x5dcc63[_0xb33e('0x48')]=_[_0xb33e('0x49')](_0x5dcc63['model'],_0x5dcc63['query']);_0x3ea1ce['attributes']=_[_0xb33e('0x49')](_0x5dcc63[_0xb33e('0x4a')],qs[_0xb33e('0x4b')](_0x512c85['query']['fields']));_0x3ea1ce[_0xb33e('0x4c')]=_0x3ea1ce[_0xb33e('0x4c')]['length']?_0x3ea1ce['attributes']:_0x5dcc63[_0xb33e('0x4a')];if(!_0x512c85[_0xb33e('0x46')][_0xb33e('0x4d')]('nolimit')){_0x3ea1ce['limit']=qs['limit'](_0x512c85[_0xb33e('0x46')][_0xb33e('0x31')]);_0x3ea1ce[_0xb33e('0x2f')]=qs[_0xb33e('0x2f')](_0x512c85[_0xb33e('0x46')][_0xb33e('0x2f')]);}_0x3ea1ce[_0xb33e('0x4e')]=qs[_0xb33e('0x4f')](_0x512c85[_0xb33e('0x46')][_0xb33e('0x4f')]);_0x3ea1ce[_0xb33e('0x50')]=qs[_0xb33e('0x48')](_[_0xb33e('0x51')](_0x512c85[_0xb33e('0x46')],_0x5dcc63['filters']),_0x53fca3);if(_0x512c85['query']['filter']){_0x3ea1ce[_0xb33e('0x50')]=_[_0xb33e('0x52')](_0x3ea1ce['where'],{'$or':_[_0xb33e('0x40')](_0x53fca3,function(_0x58b8d3){if(_0x58b8d3[_0xb33e('0x44')]!==_0xb33e('0x53')){var _0x1ad125={};_0x1ad125[_0x58b8d3[_0xb33e('0x3c')]]={'$like':'%'+_0x512c85[_0xb33e('0x46')]['filter']+'%'};return _0x1ad125;}})});}_0x3ea1ce=_['merge']({},_0x3ea1ce,_0x512c85['options']);var _0x591526={'where':_0x3ea1ce[_0xb33e('0x50')]};return db[_0xb33e('0x41')]['count'](_0x591526)[_0xb33e('0x22')](function(_0x5c54f9){_0x4d12ec[_0xb33e('0x32')]=_0x5c54f9;if(_0x512c85[_0xb33e('0x46')][_0xb33e('0x54')]){_0x3ea1ce[_0xb33e('0x55')]=[{'all':!![]}];}return db['FaxAccount']['findAll'](_0x3ea1ce);})[_0xb33e('0x22')](function(_0x709881){_0x4d12ec['rows']=_0x709881;return _0x4d12ec;})[_0xb33e('0x22')](respondWithFilteredResult(_0x12db06,_0x3ea1ce))['catch'](handleError(_0x12db06,null));};exports[_0xb33e('0x56')]=function(_0x52e428,_0x2d6dd9){var _0x1f464e={'raw':![],'where':{'id':_0x52e428[_0xb33e('0x57')]['id']},'include':[{'model':db['Pause'],'as':_0xb33e('0x58')}]},_0x51f6af={};_0x51f6af[_0xb33e('0x4a')]=_[_0xb33e('0x47')](db['FaxAccount'][_0xb33e('0x42')]);_0x51f6af['query']=_[_0xb33e('0x47')](_0x52e428[_0xb33e('0x46')]);_0x51f6af[_0xb33e('0x48')]=_[_0xb33e('0x49')](_0x51f6af[_0xb33e('0x4a')],_0x51f6af[_0xb33e('0x46')]);_0x1f464e[_0xb33e('0x4c')]=_['intersection'](_0x51f6af[_0xb33e('0x4a')],qs[_0xb33e('0x4b')](_0x52e428[_0xb33e('0x46')][_0xb33e('0x4b')]));_0x1f464e[_0xb33e('0x4c')]=_0x1f464e[_0xb33e('0x4c')][_0xb33e('0x59')]?_0x1f464e[_0xb33e('0x4c')]:_0x51f6af['model'];if(_0x52e428[_0xb33e('0x46')][_0xb33e('0x54')]){_0x1f464e[_0xb33e('0x55')]=[{'all':!![]}];}_0x1f464e=_['merge']({},_0x1f464e,_0x52e428[_0xb33e('0x5a')]);return db['FaxAccount'][_0xb33e('0x5b')](_0x1f464e)['then'](handleEntityNotFound(_0x2d6dd9,null))[_0xb33e('0x22')](respondWithResult(_0x2d6dd9,null))[_0xb33e('0x2b')](handleError(_0x2d6dd9,null));};exports['create']=function(_0x1d66ff,_0x7830bc){return db[_0xb33e('0x41')]['create'](_0x1d66ff['body'],{})[_0xb33e('0x22')](function(_0x15bfdb){var _0x1e5e5f=_0x1d66ff[_0xb33e('0x5c')][_0xb33e('0x38')]({'plain':!![]});if(!_0x1e5e5f)throw new Error(_0xb33e('0x5d'));if(_0x1e5e5f[_0xb33e('0x5e')]===_0xb33e('0x5c')){var _0x5583ad=_0x15bfdb[_0xb33e('0x38')]({'plain':!![]});var _0x399501='FaxAccounts';return db[_0xb33e('0x5f')]['find']({'where':{'name':_0x399501,'userProfileId':_0x1e5e5f[_0xb33e('0x60')]},'raw':!![]})[_0xb33e('0x22')](function(_0x8fd08a){if(_0x8fd08a&&_0x8fd08a[_0xb33e('0x61')]===0x0){return db['UserProfileResource']['create']({'name':_0x5583ad[_0xb33e('0x3c')],'resourceId':_0x5583ad['id'],'type':_0x8fd08a[_0xb33e('0x3c')],'sectionId':_0x8fd08a['id']},{})['then'](function(){return _0x15bfdb;});}else{return _0x15bfdb;}})[_0xb33e('0x2b')](function(_0x5204df){logger[_0xb33e('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5204df);throw _0x5204df;});}return _0x15bfdb;})[_0xb33e('0x22')](respondWithResult(_0x7830bc,0xc9))[_0xb33e('0x2b')](handleError(_0x7830bc,null));};exports[_0xb33e('0x36')]=function(_0x5ab5b1,_0x4985e1){if(_0x5ab5b1[_0xb33e('0x62')]['id']){delete _0x5ab5b1[_0xb33e('0x62')]['id'];}return db[_0xb33e('0x41')]['find']({'where':{'id':_0x5ab5b1[_0xb33e('0x57')]['id']},'include':[{'model':db[_0xb33e('0x3f')],'as':'mandatoryDispositionPause'}]})[_0xb33e('0x22')](handleEntityNotFound(_0x4985e1,null))[_0xb33e('0x22')](saveUpdates(_0x5ab5b1[_0xb33e('0x62')],null))[_0xb33e('0x22')](respondWithResult(_0x4985e1,null))[_0xb33e('0x2b')](handleError(_0x4985e1,null));};exports[_0xb33e('0x37')]=function(_0x23d9d7,_0x255b94){return db[_0xb33e('0x41')][_0xb33e('0x5b')]({'where':{'id':_0x23d9d7[_0xb33e('0x57')]['id']}})[_0xb33e('0x22')](handleEntityNotFound(_0x255b94,null))[_0xb33e('0x22')](removeEntity(_0x255b94,null))[_0xb33e('0x2b')](handleError(_0x255b94,null));};exports[_0xb33e('0x63')]=function(_0x34212b,_0x2bbfc5){return db[_0xb33e('0x41')][_0xb33e('0x63')]()[_0xb33e('0x22')](respondWithResult(_0x2bbfc5,null))[_0xb33e('0x2b')](handleError(_0x2bbfc5,null));};exports[_0xb33e('0x64')]=function(_0x4ff4bd,_0x3575b2,_0xf76762){if(_0x4ff4bd[_0xb33e('0x62')]['id']){delete _0x4ff4bd[_0xb33e('0x62')]['id'];}return db[_0xb33e('0x41')][_0xb33e('0x5b')]({'where':{'id':_0x4ff4bd[_0xb33e('0x57')]['id']}})[_0xb33e('0x22')](handleEntityNotFound(_0x3575b2,null))[_0xb33e('0x22')](function(_0x50651b){if(_0x50651b){_0x4ff4bd[_0xb33e('0x62')][_0xb33e('0x65')]=_0x50651b['id'];return db['Disposition']['create'](_0x4ff4bd[_0xb33e('0x62')]);}})[_0xb33e('0x22')](respondWithResult(_0x3575b2,null))[_0xb33e('0x2b')](handleError(_0x3575b2,null));};exports[_0xb33e('0x66')]=function(_0x94989a,_0x4854cb,_0x306bc5){var _0x34db2a={'raw':![],'where':{}};var _0x4c82e5={};var _0x72d8ea={'count':0x0,'rows':[]};return db[_0xb33e('0x41')][_0xb33e('0x67')]({'where':{'id':_0x94989a[_0xb33e('0x57')]['id']}})[_0xb33e('0x22')](handleEntityNotFound(_0x4854cb,null))[_0xb33e('0x22')](function(_0x74e01a){if(_0x74e01a){_0x4c82e5[_0xb33e('0x4a')]=_[_0xb33e('0x47')](db['Disposition']['rawAttributes']);_0x4c82e5[_0xb33e('0x46')]=_[_0xb33e('0x47')](_0x94989a['query']);_0x4c82e5[_0xb33e('0x48')]=_[_0xb33e('0x49')](_0x4c82e5[_0xb33e('0x4a')],_0x4c82e5['query']);_0x34db2a['attributes']=_[_0xb33e('0x49')](_0x4c82e5['model'],qs[_0xb33e('0x4b')](_0x94989a[_0xb33e('0x46')][_0xb33e('0x4b')]));_0x34db2a['attributes']=_0x34db2a[_0xb33e('0x4c')][_0xb33e('0x59')]?_0x34db2a['attributes']:_0x4c82e5[_0xb33e('0x4a')];if(!_0x94989a[_0xb33e('0x46')][_0xb33e('0x4d')](_0xb33e('0x68'))){_0x34db2a[_0xb33e('0x31')]=qs[_0xb33e('0x31')](_0x94989a[_0xb33e('0x46')][_0xb33e('0x31')]);_0x34db2a['offset']=qs['offset'](_0x94989a[_0xb33e('0x46')][_0xb33e('0x2f')]);}_0x34db2a[_0xb33e('0x4e')]=qs['sort'](_0x94989a['query'][_0xb33e('0x4f')]);_0x34db2a[_0xb33e('0x50')]=qs[_0xb33e('0x48')](_[_0xb33e('0x51')](_0x94989a[_0xb33e('0x46')],_0x4c82e5['filters']));_0x34db2a['where']['FaxAccountId']=_0x74e01a['id'];if(_0x94989a['query'][_0xb33e('0x69')]){_0x34db2a[_0xb33e('0x50')]=_['merge'](_0x34db2a[_0xb33e('0x50')],{'$or':_['map'](_0x34db2a['attributes'],function(_0x1680bd){var _0x15cc64={};_0x15cc64[_0x1680bd]={'$like':'%'+_0x94989a[_0xb33e('0x46')][_0xb33e('0x69')]+'%'};return _0x15cc64;})});}_0x34db2a=_[_0xb33e('0x52')]({},_0x34db2a,_0x94989a[_0xb33e('0x5a')]);return db[_0xb33e('0x6a')][_0xb33e('0x32')]({'where':_0x34db2a[_0xb33e('0x50')]})[_0xb33e('0x22')](function(_0xd88656){_0x72d8ea[_0xb33e('0x32')]=_0xd88656;if(_0x94989a['query'][_0xb33e('0x54')]){_0x34db2a['include']=[{'all':!![]}];}return db[_0xb33e('0x6a')][_0xb33e('0x6b')](_0x34db2a);})[_0xb33e('0x22')](function(_0x5657ab){_0x72d8ea[_0xb33e('0x6c')]=_0x5657ab;return _0x72d8ea;});}})[_0xb33e('0x22')](respondWithFilteredResult(_0x4854cb,_0x34db2a))[_0xb33e('0x2b')](handleError(_0x4854cb,null));};exports[_0xb33e('0x6d')]=function(_0x15ab16,_0x37d98d,_0x53900b){return db[_0xb33e('0x41')][_0xb33e('0x5b')]({'where':{'id':_0x15ab16[_0xb33e('0x57')]['id']}})['then'](handleEntityNotFound(_0x37d98d,null))[_0xb33e('0x22')](function(_0x55b6f2){if(_0x55b6f2){return _0x55b6f2[_0xb33e('0x6d')](_0x15ab16[_0xb33e('0x46')][_0xb33e('0x6e')]);}})[_0xb33e('0x22')](respondWithStatusCode(_0x37d98d,null))[_0xb33e('0x2b')](handleError(_0x37d98d,null));};exports['addAnswer']=function(_0x50facd,_0x3eef0b,_0x539e35){if(_0x50facd['body']['id']){delete _0x50facd['body']['id'];}return db['FaxAccount'][_0xb33e('0x5b')]({'where':{'id':_0x50facd[_0xb33e('0x57')]['id']}})[_0xb33e('0x22')](handleEntityNotFound(_0x3eef0b,null))[_0xb33e('0x22')](function(_0x29f7f7){if(_0x29f7f7){_0x50facd[_0xb33e('0x62')]['FaxAccountId']=_0x29f7f7['id'];return db[_0xb33e('0x6f')]['create'](_0x50facd[_0xb33e('0x62')]);}})[_0xb33e('0x22')](respondWithResult(_0x3eef0b,null))[_0xb33e('0x2b')](handleError(_0x3eef0b,null));};exports['getAnswers']=function(_0x2a3aa1,_0x167e24,_0x549252){var _0x47036f={'raw':![],'where':{}};var _0x2d747d={};var _0x4b3c0a={'count':0x0,'rows':[]};return db[_0xb33e('0x41')][_0xb33e('0x67')]({'where':{'id':_0x2a3aa1[_0xb33e('0x57')]['id']}})[_0xb33e('0x22')](handleEntityNotFound(_0x167e24,null))[_0xb33e('0x22')](function(_0x292499){if(_0x292499){_0x2d747d[_0xb33e('0x4a')]=_[_0xb33e('0x47')](db[_0xb33e('0x6f')][_0xb33e('0x42')]);_0x2d747d[_0xb33e('0x46')]=_[_0xb33e('0x47')](_0x2a3aa1[_0xb33e('0x46')]);_0x2d747d[_0xb33e('0x48')]=_[_0xb33e('0x49')](_0x2d747d[_0xb33e('0x4a')],_0x2d747d[_0xb33e('0x46')]);_0x47036f[_0xb33e('0x4c')]=_[_0xb33e('0x49')](_0x2d747d[_0xb33e('0x4a')],qs['fields'](_0x2a3aa1[_0xb33e('0x46')][_0xb33e('0x4b')]));_0x47036f[_0xb33e('0x4c')]=_0x47036f[_0xb33e('0x4c')][_0xb33e('0x59')]?_0x47036f['attributes']:_0x2d747d[_0xb33e('0x4a')];if(!_0x2a3aa1[_0xb33e('0x46')][_0xb33e('0x4d')](_0xb33e('0x68'))){_0x47036f['limit']=qs['limit'](_0x2a3aa1[_0xb33e('0x46')][_0xb33e('0x31')]);_0x47036f[_0xb33e('0x2f')]=qs[_0xb33e('0x2f')](_0x2a3aa1[_0xb33e('0x46')][_0xb33e('0x2f')]);}_0x47036f['order']=qs[_0xb33e('0x4f')](_0x2a3aa1[_0xb33e('0x46')]['sort']);_0x47036f[_0xb33e('0x50')]=qs[_0xb33e('0x48')](_[_0xb33e('0x51')](_0x2a3aa1[_0xb33e('0x46')],_0x2d747d[_0xb33e('0x48')]));_0x47036f[_0xb33e('0x50')][_0xb33e('0x65')]=_0x292499['id'];if(_0x2a3aa1['query'][_0xb33e('0x69')]){_0x47036f['where']=_[_0xb33e('0x52')](_0x47036f[_0xb33e('0x50')],{'$or':_[_0xb33e('0x40')](_0x47036f[_0xb33e('0x4c')],function(_0x1e7a3f){var _0x2a8a04={};_0x2a8a04[_0x1e7a3f]={'$like':'%'+_0x2a3aa1[_0xb33e('0x46')]['filter']+'%'};return _0x2a8a04;})});}_0x47036f=_[_0xb33e('0x52')]({},_0x47036f,_0x2a3aa1[_0xb33e('0x5a')]);return db[_0xb33e('0x6f')][_0xb33e('0x32')]({'where':_0x47036f[_0xb33e('0x50')]})[_0xb33e('0x22')](function(_0x27ad67){_0x4b3c0a[_0xb33e('0x32')]=_0x27ad67;if(_0x2a3aa1[_0xb33e('0x46')][_0xb33e('0x54')]){_0x47036f[_0xb33e('0x55')]=[{'all':!![]}];}return db[_0xb33e('0x6f')][_0xb33e('0x6b')](_0x47036f);})[_0xb33e('0x22')](function(_0x2f05eb){_0x4b3c0a[_0xb33e('0x6c')]=_0x2f05eb;return _0x4b3c0a;});}})[_0xb33e('0x22')](respondWithFilteredResult(_0x167e24,_0x47036f))[_0xb33e('0x2b')](handleError(_0x167e24,null));};exports[_0xb33e('0x70')]=function(_0x4999ef,_0x2551d3,_0x2d5ba9){return db[_0xb33e('0x41')][_0xb33e('0x5b')]({'where':{'id':_0x4999ef[_0xb33e('0x57')]['id']}})[_0xb33e('0x22')](handleEntityNotFound(_0x2551d3,null))[_0xb33e('0x22')](function(_0x486aae){if(_0x486aae){return _0x486aae['removeAnswers'](_0x4999ef[_0xb33e('0x46')][_0xb33e('0x6e')]);}})[_0xb33e('0x22')](respondWithStatusCode(_0x2551d3,null))[_0xb33e('0x2b')](handleError(_0x2551d3,null));};exports[_0xb33e('0x71')]=function(_0x1f9741,_0x5dcec7,_0x57805d){return db[_0xb33e('0x72')][_0xb33e('0x5b')]({'where':{'id':_0x1f9741[_0xb33e('0x57')]['id']}})[_0xb33e('0x22')](handleEntityNotFound(_0x5dcec7,null))['then'](function(_0x17170e){if(_0x17170e){return _0x17170e[_0xb33e('0x71')](_0x1f9741[_0xb33e('0x62')][_0xb33e('0x6e')],_[_0xb33e('0x73')](_0x1f9741['body'],['ids','id'])||{});}})[_0xb33e('0x22')](respondWithResult(_0x5dcec7,null))[_0xb33e('0x2b')](handleError(_0x5dcec7,null));};exports[_0xb33e('0x74')]=function(_0x2c0689,_0x5b6449,_0x3a0c83){var _0x5e0bd9={'raw':![],'where':{}};var _0x11f76a={};var _0x307d81={'count':0x0,'rows':[]};return db[_0xb33e('0x41')][_0xb33e('0x67')]({'where':{'id':_0x2c0689[_0xb33e('0x57')]['id']}})[_0xb33e('0x22')](handleEntityNotFound(_0x5b6449,null))[_0xb33e('0x22')](function(_0x2d0e05){if(_0x2d0e05){_0x11f76a['model']=_[_0xb33e('0x47')](db[_0xb33e('0x72')][_0xb33e('0x42')]);_0x11f76a[_0xb33e('0x46')]=_[_0xb33e('0x47')](_0x2c0689['query']);_0x11f76a[_0xb33e('0x48')]=_[_0xb33e('0x49')](_0x11f76a[_0xb33e('0x4a')],_0x11f76a[_0xb33e('0x46')]);_0x5e0bd9['attributes']=_[_0xb33e('0x49')](_0x11f76a[_0xb33e('0x4a')],qs[_0xb33e('0x4b')](_0x2c0689['query'][_0xb33e('0x4b')]));_0x5e0bd9[_0xb33e('0x4c')]=_0x5e0bd9[_0xb33e('0x4c')]['length']?_0x5e0bd9[_0xb33e('0x4c')]:_0x11f76a['model'];if(!_0x2c0689[_0xb33e('0x46')][_0xb33e('0x4d')](_0xb33e('0x68'))){_0x5e0bd9['limit']=qs['limit'](_0x2c0689['query'][_0xb33e('0x31')]);_0x5e0bd9[_0xb33e('0x2f')]=qs[_0xb33e('0x2f')](_0x2c0689['query'][_0xb33e('0x2f')]);}_0x5e0bd9[_0xb33e('0x4e')]=qs[_0xb33e('0x4f')](_0x2c0689[_0xb33e('0x46')][_0xb33e('0x4f')]);_0x5e0bd9[_0xb33e('0x50')]=qs[_0xb33e('0x48')](_[_0xb33e('0x51')](_0x2c0689[_0xb33e('0x46')],_0x11f76a[_0xb33e('0x48')]));_0x5e0bd9[_0xb33e('0x50')][_0xb33e('0x65')]=_0x2d0e05['id'];if(_0x2c0689[_0xb33e('0x46')][_0xb33e('0x69')]){_0x5e0bd9[_0xb33e('0x50')]=_['merge'](_0x5e0bd9[_0xb33e('0x50')],{'$or':_[_0xb33e('0x40')](_0x5e0bd9['attributes'],function(_0x59b7f5){var _0xec1a0b={};_0xec1a0b[_0x59b7f5]={'$like':'%'+_0x2c0689[_0xb33e('0x46')][_0xb33e('0x69')]+'%'};return _0xec1a0b;})});}_0x5e0bd9=_[_0xb33e('0x52')]({},_0x5e0bd9,_0x2c0689[_0xb33e('0x5a')]);return db['FaxInteraction'][_0xb33e('0x32')]({'where':_0x5e0bd9['where']})[_0xb33e('0x22')](function(_0x1182d8){_0x307d81['count']=_0x1182d8;if(_0x2c0689[_0xb33e('0x46')]['includeAll']){_0x5e0bd9[_0xb33e('0x55')]=[{'model':db[_0xb33e('0x75')],'as':'Contact','required':![]},{'model':db[_0xb33e('0x76')],'as':_0xb33e('0x77'),'attributes':[_0xb33e('0x3c'),_0xb33e('0x78'),_0xb33e('0x79')],'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0xb33e('0x3c'),_0xb33e('0x7a')],'where':_0x2c0689[_0xb33e('0x46')][_0xb33e('0x7b')]?{'id':_0x2c0689['query'][_0xb33e('0x7b')]}:undefined,'required':_0x2c0689[_0xb33e('0x46')]['tag']?!![]:![]}];}return db[_0xb33e('0x72')][_0xb33e('0x6b')](_0x5e0bd9);})[_0xb33e('0x22')](function(_0x2a0d71){_0x307d81[_0xb33e('0x6c')]=_0x2a0d71;return _0x307d81;});}})[_0xb33e('0x22')](respondWithFilteredResult(_0x5b6449,_0x5e0bd9))[_0xb33e('0x2b')](handleError(_0x5b6449,null));};exports['addApplications']=function(_0x44ea21,_0x11f571){var _0x59e1b6=_0x44ea21['params']['id'];var _0x1732d9=_0x44ea21[_0xb33e('0x62')];var _0x1cfabe=0xc8;var _0x4d1d5a=null;return db[_0xb33e('0x7c')][_0xb33e('0x7d')]({'isolationLevel':db[_0xb33e('0x7c')][_0xb33e('0x7e')][_0xb33e('0x7f')][_0xb33e('0x80')]},function(_0x130f14){return db[_0xb33e('0x41')][_0xb33e('0x67')]({'where':{'id':_0x59e1b6},'transaction':_0x130f14})['then'](function(_0xbccbdf){if(_0xbccbdf){return db[_0xb33e('0x81')][_0xb33e('0x37')]({'where':{'FaxAccountId':_0x59e1b6},'transaction':_0x130f14})['then'](function(){var _0x53d94d=_['map'](_0x1732d9,function(_0x42f251){_0x42f251[_0xb33e('0x65')]=_0x59e1b6;return _0x42f251;});return db['FaxApplication'][_0xb33e('0x82')](_0x53d94d,{'transaction':_0x130f14});});}else{_0x1cfabe=0x194;_0x4d1d5a=[];}});})[_0xb33e('0x22')](function(){if(_0x1cfabe!==0x194){return db[_0xb33e('0x81')]['findAndCountAll']({'where':{'FaxAccountId':_0x59e1b6},'order':'priority'})['then'](function(_0x36feab){_0x4d1d5a=_0x36feab;});}})[_0xb33e('0x2b')](function(_0x389bc9){_0x1cfabe=0x1f4;logger[_0xb33e('0x28')](_0x389bc9[_0xb33e('0x3b')]);if(_0x389bc9[_0xb33e('0x3c')]){delete _0x389bc9[_0xb33e('0x3c')];}_0x4d1d5a=_0x389bc9;})[_0xb33e('0x83')](function(){if(_0x4d1d5a===null){_0x11f571[_0xb33e('0x2c')](_0x1cfabe);}else{if(_0x1cfabe===0x1f4){_0x11f571[_0xb33e('0x2d')](_0x1cfabe)['send'](_0x4d1d5a);}else{_0x11f571['status'](_0x1cfabe)[_0xb33e('0x84')](_0x4d1d5a);}}});};exports[_0xb33e('0x85')]=function(_0x4ffef5,_0x2e5724,_0x44ab1b){var _0x1b3f5d={};var _0x168e8e={};var _0x5ea253;var _0x5424a7;return db['FaxAccount']['findOne']({'where':{'id':_0x4ffef5[_0xb33e('0x57')]['id']}})[_0xb33e('0x22')](handleEntityNotFound(_0x2e5724,null))[_0xb33e('0x22')](function(_0x463a87){if(_0x463a87){_0x5ea253=_0x463a87;_0x168e8e['model']=_[_0xb33e('0x47')](db['FaxApplication'][_0xb33e('0x42')]);_0x168e8e[_0xb33e('0x46')]=_[_0xb33e('0x47')](_0x4ffef5['query']);_0x168e8e['filters']=_[_0xb33e('0x49')](_0x168e8e[_0xb33e('0x4a')],_0x168e8e[_0xb33e('0x46')]);_0x1b3f5d[_0xb33e('0x4c')]=_[_0xb33e('0x49')](_0x168e8e[_0xb33e('0x4a')],qs[_0xb33e('0x4b')](_0x4ffef5[_0xb33e('0x46')][_0xb33e('0x4b')]));_0x1b3f5d[_0xb33e('0x4c')]=_0x1b3f5d['attributes'][_0xb33e('0x59')]?_0x1b3f5d[_0xb33e('0x4c')]:_0x168e8e['model'];_0x1b3f5d[_0xb33e('0x4e')]=qs[_0xb33e('0x4f')](_0x4ffef5[_0xb33e('0x46')][_0xb33e('0x4f')]);_0x1b3f5d[_0xb33e('0x50')]=qs[_0xb33e('0x48')](_['pick'](_0x4ffef5[_0xb33e('0x46')],_0x168e8e['filters']));if(_0x4ffef5[_0xb33e('0x46')][_0xb33e('0x69')]){_0x1b3f5d[_0xb33e('0x50')]=_['merge'](_0x1b3f5d['where'],{'$or':_[_0xb33e('0x40')](_0x1b3f5d[_0xb33e('0x4c')],function(_0x7c6d97){var _0x35ffbd={};_0x35ffbd[_0x7c6d97]={'$like':'%'+_0x4ffef5[_0xb33e('0x46')][_0xb33e('0x69')]+'%'};return _0x35ffbd;})});}_0x1b3f5d=_[_0xb33e('0x52')]({},_0x1b3f5d,_0x4ffef5[_0xb33e('0x5a')]);return _0x5ea253['getApplications'](_0x1b3f5d);}})[_0xb33e('0x22')](function(_0x375dfe){if(_0x375dfe){_0x5424a7=_0x375dfe['length'];if(!_0x4ffef5[_0xb33e('0x46')]['hasOwnProperty'](_0xb33e('0x68'))){_0x1b3f5d[_0xb33e('0x31')]=qs['limit'](_0x4ffef5[_0xb33e('0x46')]['limit']);_0x1b3f5d['offset']=qs['offset'](_0x4ffef5[_0xb33e('0x46')]['offset']);}return _0x5ea253['getApplications'](_0x1b3f5d);}})[_0xb33e('0x22')](function(_0x1a5537){if(_0x1a5537){return _0x1a5537?{'count':_0x5424a7,'rows':_0x1a5537}:null;}})[_0xb33e('0x22')](respondWithResult(_0x2e5724,null))[_0xb33e('0x2b')](handleError(_0x2e5724,null));};function Extension(_0x47beee,_0x5a3a83,_0x52b852,_0x4d9eea){this[_0xb33e('0x86')]=_0xb33e('0x87');this[_0xb33e('0x88')]=_0x47beee[_0xb33e('0x89')];this['app']=_0x4d9eea;this[_0xb33e('0x44')]='system';this[_0xb33e('0x8a')]=_0xb33e('0x8b');this[_0xb33e('0x65')]=_0x47beee['id'];this[_0xb33e('0x8c')]=_0x5a3a83;this[_0xb33e('0x8d')]=_0x52b852;}function createExtensionsReciveFax(_0x1f3e88){var _0x4e4f33=0x1;var _0x315740=[];_0x315740[_0xb33e('0x8e')](new Extension(_0x1f3e88,_0x4e4f33,'','Answer'));_0x4e4f33+=0x1;_0x315740['push'](new Extension(_0x1f3e88,_0x4e4f33,'CDR(type)=inbound-fax',_0xb33e('0x8f')));_0x4e4f33+=0x1;for(var _0x7108e8 in _0x1f3e88){if(_0x1f3e88['hasOwnProperty'](_0x7108e8)&&(_0x7108e8===_0xb33e('0x90')||_0x7108e8===_0xb33e('0x89')||_0x7108e8===_0xb33e('0x91')||_0x7108e8===_0xb33e('0x92')||_0x7108e8===_0xb33e('0x93')||_0x7108e8===_0xb33e('0x94')||_0x7108e8===_0xb33e('0x95')||_0x7108e8==='modem'||_0x7108e8===_0xb33e('0x96'))){_0x315740[_0xb33e('0x8e')](new Extension(_0x1f3e88,_0x4e4f33,_0xb33e('0x97')+_0x7108e8+')='+_0x1f3e88[_0x7108e8],_0xb33e('0x8f')));_0x4e4f33+=0x1;}}_0x315740[_0xb33e('0x8e')](new Extension(_0x1f3e88,_0x4e4f33,'6','Wait'));_0x4e4f33+=0x1;_0x315740['push'](new Extension(_0x1f3e88,_0x4e4f33,_0xb33e('0x98'),_0xb33e('0x99')));_0x4e4f33=0x0;return _0x315740;}exports[_0xb33e('0x9a')]=function(_0x4b9104,_0x1f02d1,_0x375c75){var _0x505b84;return db['sequelize'][_0xb33e('0x7d')](function(_0x5729ab){return db[_0xb33e('0x41')]['create'](_0x4b9104[_0xb33e('0x62')],{'transaction':_0x5729ab})[_0xb33e('0x22')](function(_0x143bd3){_0x505b84=_0x143bd3[_0xb33e('0x38')]({'plain':!![]});return db[_0xb33e('0x9b')][_0xb33e('0x82')](createExtensionsReciveFax(_0x505b84),{'transaction':_0x5729ab});});})['then'](function(){return _0x505b84;})['then'](respondWithResult(_0x1f02d1,null))['catch'](handleError(_0x1f02d1,null));};exports[_0xb33e('0x9c')]=function(_0x44b629,_0x1bff49,_0xfee81){var _0x2f7e6b;return db['sequelize'][_0xb33e('0x7d')](function(_0x1bff21){return db[_0xb33e('0x41')][_0xb33e('0x36')](_0x44b629[_0xb33e('0x62')],{'where':{'id':_0x44b629[_0xb33e('0x62')]['id']},'transaction':_0x1bff21})[_0xb33e('0x22')](function(_0x2f4500){return db[_0xb33e('0x9b')]['destroy']({'where':{'FaxAccountId':_0x44b629[_0xb33e('0x62')]['id']},'transaction':_0x1bff21})[_0xb33e('0x22')](function(_0x3a7359){return db[_0xb33e('0x9b')][_0xb33e('0x82')](createExtensionsReciveFax(_['omit'](_0x44b629[_0xb33e('0x62')],[_0xb33e('0x9d'),_0xb33e('0x45'),'createdAt',_0xb33e('0x9e'),_0xb33e('0x9f'),'ListId'])),{'transaction':_0x1bff21});});});})[_0xb33e('0x22')](function(){return db[_0xb33e('0x41')][_0xb33e('0xa0')](_0x44b629[_0xb33e('0x62')]['id']);})[_0xb33e('0x22')](respondWithResult(_0x1bff49,null))[_0xb33e('0x2b')](handleError(_0x1bff49,null));};exports[_0xb33e('0xa1')]=function(_0x33364f,_0x105029,_0x13b945){var _0x4a8378={'raw':!![],'where':{}};var _0x864348={};var _0x180d96={'count':0x0,'rows':[]};return db[_0xb33e('0x41')]['findOne']({'where':{'id':_0x33364f[_0xb33e('0x57')]['id']}})[_0xb33e('0x22')](handleEntityNotFound(_0x105029,null))[_0xb33e('0x22')](function(_0x13daa){if(_0x13daa){_0x864348[_0xb33e('0x4a')]=_[_0xb33e('0x47')](db['FaxMessage'][_0xb33e('0x42')]);_0x864348[_0xb33e('0x46')]=_[_0xb33e('0x47')](_0x33364f[_0xb33e('0x46')]);_0x864348[_0xb33e('0x48')]=_[_0xb33e('0x49')](_0x864348[_0xb33e('0x4a')],_0x864348[_0xb33e('0x46')]);_0x4a8378['attributes']=_[_0xb33e('0x49')](_0x864348[_0xb33e('0x4a')],qs[_0xb33e('0x4b')](_0x33364f[_0xb33e('0x46')]['fields']));_0x4a8378[_0xb33e('0x4c')]=_0x4a8378['attributes']['length']?_0x4a8378[_0xb33e('0x4c')]:_0x864348[_0xb33e('0x4a')];if(!_0x33364f[_0xb33e('0x46')]['hasOwnProperty'](_0xb33e('0x68'))){_0x4a8378[_0xb33e('0x31')]=qs['limit'](_0x33364f[_0xb33e('0x46')][_0xb33e('0x31')]);_0x4a8378[_0xb33e('0x2f')]=qs[_0xb33e('0x2f')](_0x33364f[_0xb33e('0x46')][_0xb33e('0x2f')]);}_0x4a8378[_0xb33e('0x4e')]=qs[_0xb33e('0x4f')](_0x33364f[_0xb33e('0x46')][_0xb33e('0x4f')]);_0x4a8378[_0xb33e('0x50')]=qs[_0xb33e('0x48')](_[_0xb33e('0x51')](_0x33364f[_0xb33e('0x46')],_0x864348[_0xb33e('0x48')]));_0x4a8378['where']['FaxAccountId']=_0x13daa['id'];if(_0x33364f['query'][_0xb33e('0x69')]){_0x4a8378[_0xb33e('0x50')]=_[_0xb33e('0x52')](_0x4a8378['where'],{'$or':_[_0xb33e('0x40')](_0x4a8378[_0xb33e('0x4c')],function(_0x268ca5){var _0x1f6618={};_0x1f6618[_0x268ca5]={'$like':'%'+_0x33364f[_0xb33e('0x46')][_0xb33e('0x69')]+'%'};return _0x1f6618;})});}if(_0x33364f[_0xb33e('0x46')][_0xb33e('0xa2')]){var _0x688b2e=_0x33364f[_0xb33e('0x46')]['$gte'][_0xb33e('0xa3')](',');var _0x2f80ab={};_0x2f80ab[_0x688b2e[0x0]]={'$gte':moment(_0x688b2e[0x1])['format'](_0xb33e('0xa4'))};_0x4a8378[_0xb33e('0x50')]=_[_0xb33e('0x52')](_0x4a8378[_0xb33e('0x50')],_0x2f80ab);}_0x4a8378=_[_0xb33e('0x52')]({},_0x4a8378,_0x33364f[_0xb33e('0x5a')]);return db[_0xb33e('0xa5')][_0xb33e('0x32')]({'where':_0x4a8378[_0xb33e('0x50')]})[_0xb33e('0x22')](function(_0x198a74){_0x180d96[_0xb33e('0x32')]=_0x198a74;if(_0x33364f[_0xb33e('0x46')][_0xb33e('0x54')]){_0x4a8378[_0xb33e('0x55')]=[{'all':!![]}];}return db[_0xb33e('0xa5')]['findAll'](_0x4a8378);})[_0xb33e('0x22')](function(_0x135797){_0x180d96[_0xb33e('0x6c')]=_0x135797;return _0x180d96;});}})[_0xb33e('0x22')](respondWithFilteredResult(_0x105029,_0x4a8378))['catch'](handleError(_0x105029,null));};exports[_0xb33e('0x3d')]=function(_0x514ae0,_0x1bf216,_0x10fba3){var _0x5c8f93,_0x3abc35={},_0x46bd3d;if(_0x514ae0[_0xb33e('0x62')]['to']){_0x46bd3d=_0x514ae0[_0xb33e('0x62')]['to'][0x0];}return db[_0xb33e('0x41')][_0xb33e('0x5b')]({'where':{'id':_0x514ae0[_0xb33e('0x57')]['id']},'include':[{'model':db[_0xb33e('0xa6')],'as':_0xb33e('0xa7'),'include':[{'model':db[_0xb33e('0x75')],'as':_0xb33e('0xa8'),'where':{'fax':_0x46bd3d},'limit':0x1,'order':[[_0xb33e('0x9e'),_0xb33e('0xa9')]]}]}]})[_0xb33e('0x22')](handleEntityNotFound(_0x1bf216,null))['then'](function(_0x2d6bbb){_0x5c8f93=_0x2d6bbb;if(_0x514ae0[_0xb33e('0x62')][_0xb33e('0xaa')]&&_0x514ae0[_0xb33e('0x62')][_0xb33e('0xaa')][_0xb33e('0x59')]){for(var _0x3a0bad=0x0;_0x3a0bad<_0x514ae0[_0xb33e('0x62')][_0xb33e('0xaa')]['length'];_0x3a0bad+=0x1){_0x514ae0[_0xb33e('0x62')]['attachments'][_0x3a0bad]={'filename':_0x514ae0['body'][_0xb33e('0xaa')][_0x3a0bad][_0xb33e('0x3c')],'id':_0x514ae0[_0xb33e('0x62')]['attachments'][_0x3a0bad]['id'],'path':path[_0xb33e('0xab')](config[_0xb33e('0xac')],'server/files/attachments',_0x514ae0[_0xb33e('0x62')][_0xb33e('0xaa')][_0x3a0bad][_0xb33e('0xad')])};}}return respondWithRpcPromise('CheckAfterSend',_0xb33e('0xae'),{'FaxAccountId':_['isNil'](_0x514ae0[_0xb33e('0x57')]['id'])?undefined:_0x514ae0[_0xb33e('0x57')]['id'],'path':_['isNil'](_0x514ae0['body'][_0xb33e('0xaa')][0x0][_0xb33e('0x5')])?undefined:_0x514ae0['body'][_0xb33e('0xaa')][0x0][_0xb33e('0x5')],'fax':_[_0xb33e('0xaf')](_0x514ae0['body']['to'][0x0])?undefined:_0x514ae0[_0xb33e('0x62')]['to'][0x0]},client9002);})[_0xb33e('0x22')](function(){if(_0x5c8f93){if(_['isNil'](_0x514ae0[_0xb33e('0x62')]['from'])){_0x514ae0[_0xb33e('0x62')]['from']=util['format'](_0xb33e('0xb0'),_0x5c8f93[_0xb33e('0x3c')],_0x5c8f93[_0xb33e('0xb1')]);}if(_0x5c8f93[_0xb33e('0xa7')]){if(_0x5c8f93[_0xb33e('0xa7')][_0xb33e('0xa8')]['length']){return _0x5c8f93[_0xb33e('0xa7')][_0xb33e('0xa8')][0x0];}else{return db[_0xb33e('0x75')][_0xb33e('0xb2')](_['defaults'](_0x514ae0[_0xb33e('0x62')],{'firstName':_0x514ae0[_0xb33e('0x62')]['to'][0x0],'phone':_0x514ae0['body']['to'][0x0],'fax':_0x514ae0[_0xb33e('0x62')]['to'][0x0],'ListId':_0x5c8f93[_0xb33e('0xb3')]}));}}else{throw new Error(_0xb33e('0xb4'));}}else{throw new Error(_0xb33e('0xb5'));}})[_0xb33e('0x22')](function(_0x246f1d){if(_0x246f1d){return db[_0xb33e('0x72')]['find']({'where':{'ContactId':_0x246f1d['id'],'closed':![],'FaxAccountId':_0x5c8f93['id']}})[_0xb33e('0x22')](function(_0x496841){if(_0x496841){return[_0x496841,![]];}return db[_0xb33e('0x72')][_0xb33e('0xb2')]({'UserId':_0x514ae0[_0xb33e('0x5c')]['id'],'ContactId':_0x246f1d['id'],'FaxAccountId':_0x5c8f93['id'],'fax':_0x514ae0[_0xb33e('0x62')]['to'][0x0],'firstMsgDirection':_0xb33e('0xb6'),'Messages':[_[_0xb33e('0x52')](_0x514ae0[_0xb33e('0x62')],{'read':![],'body':_0x514ae0[_0xb33e('0x62')][_0xb33e('0xaa')][0x0][_0xb33e('0xb7')],'FaxAccountId':_0x5c8f93['id'],'UserId':_0x514ae0[_0xb33e('0x5c')]['id'],'ContactId':_0x246f1d['id'],'AttachmentId':_0x514ae0[_0xb33e('0x62')]['attachments'][0x0]['id']})]},{'include':[{'model':db['FaxMessage'],'as':'Messages'}]})[_0xb33e('0x22')](function(_0x4a448d){return[_0x4a448d,!![]];});});}else{throw new Error(_0xb33e('0xb8'));}})[_0xb33e('0xb9')](function(_0x1be5cf,_0x3fe478){if(_0x3fe478){return _0x1be5cf;}return db[_0xb33e('0xa5')][_0xb33e('0xb2')]({'direction':_0xb33e('0xb6'),'read':![],'body':_0x514ae0[_0xb33e('0x62')][_0xb33e('0xaa')][0x0]['filename'],'FaxAccountId':_0x5c8f93['id'],'FaxInteractionId':_0x1be5cf['id'],'UserId':_0x514ae0['user']['id'],'ContactId':_0x1be5cf['ContactId'],'AttachmentId':_0x514ae0[_0xb33e('0x62')][_0xb33e('0xaa')][0x0]['id']})['then'](function(_0x2d3711){_0x1be5cf[_0xb33e('0xba')][_0xb33e('0xbb')]=[];_0x1be5cf[_0xb33e('0xba')][_0xb33e('0xbb')][_0xb33e('0x8e')](_0x2d3711[_0xb33e('0xba')]);return _0x1be5cf;});})[_0xb33e('0x22')](function(_0x5e262a){respondWithRpcPromise(_0xb33e('0xbc'),_0xb33e('0xbc'),{'FaxAccountId':_[_0xb33e('0xaf')](_0x514ae0[_0xb33e('0x57')]['id'])?undefined:_0x514ae0['params']['id'],'path':_[_0xb33e('0xaf')](_0x514ae0[_0xb33e('0x62')][_0xb33e('0xaa')][0x0]['path'])?undefined:_0x514ae0[_0xb33e('0x62')]['attachments'][0x0][_0xb33e('0x5')],'fax':_[_0xb33e('0xaf')](_0x514ae0[_0xb33e('0x62')]['to'][0x0])?undefined:_0x514ae0[_0xb33e('0x62')]['to'][0x0],'AttachmentId':_0x514ae0['body'][_0xb33e('0xaa')][0x0]['id']},client9002)[_0xb33e('0x22')](function(_0x21bef0){logger['info'](_0xb33e('0xbd'),_0x21bef0);})[_0xb33e('0x2b')](function(_0x5f5857){logger[_0xb33e('0x23')]('SendFaxRpc,\x20%s',_0x5f5857);});return _0x5e262a;})[_0xb33e('0x22')](respondWithResult(_0x1bf216,null))[_0xb33e('0x2b')](handleError(_0x1bf216,null));};exports[_0xb33e('0xbe')]=function(_0xc973df,_0x2b9c24,_0x3020b5){return db[_0xb33e('0x41')][_0xb33e('0x5b')]({'where':{'id':_0xc973df['params']['id']}})[_0xb33e('0x22')](handleEntityNotFound(_0x2b9c24,null))['then'](function(_0x2e14c2){if(_0x2e14c2){return _0x2e14c2[_0xb33e('0xbe')](_0xc973df[_0xb33e('0x62')]['ids'],_['omit'](_0xc973df[_0xb33e('0x62')],[_0xb33e('0x6e'),'id'])||{})[_0xb33e('0xb9')](function(_0x2fe5a2){for(var _0x45a573=0x0;_0x45a573<_0xc973df[_0xb33e('0x62')][_0xb33e('0x6e')][_0xb33e('0x59')];_0x45a573+=0x1){socket['emit']('userFaxAccount:save',{'UserId':Number(_0xc973df[_0xb33e('0x62')][_0xb33e('0x6e')][_0x45a573]),'FaxAccountId':Number(_0xc973df['params']['id'])});}return _0x2fe5a2;});}})[_0xb33e('0x22')](respondWithResult(_0x2b9c24,null))[_0xb33e('0x2b')](handleError(_0x2b9c24,null));};exports['removeAgents']=function(_0x1981e8,_0x584b07,_0x124490){return db[_0xb33e('0x41')][_0xb33e('0x5b')]({'where':{'id':_0x1981e8[_0xb33e('0x57')]['id']}})['then'](handleEntityNotFound(_0x584b07,null))['then'](function(_0x3c7119){if(_0x3c7119){return _0x3c7119[_0xb33e('0xbf')](_0x1981e8['query'][_0xb33e('0x6e')])[_0xb33e('0x22')](function(){if(_[_0xb33e('0xc0')](_0x1981e8[_0xb33e('0x46')][_0xb33e('0x6e')])){for(var _0x173fde=0x0;_0x173fde<_0x1981e8[_0xb33e('0x46')][_0xb33e('0x6e')][_0xb33e('0x59')];_0x173fde+=0x1){socket[_0xb33e('0xc1')]('userFaxAccount:remove',{'UserId':Number(_0x1981e8[_0xb33e('0x46')][_0xb33e('0x6e')][_0x173fde]),'FaxAccountId':Number(_0x1981e8[_0xb33e('0x57')]['id'])});}}else{socket[_0xb33e('0xc1')](_0xb33e('0xc2'),{'UserId':Number(_0x1981e8['query'][_0xb33e('0x6e')]),'FaxAccountId':Number(_0x1981e8[_0xb33e('0x57')]['id'])});}});}})[_0xb33e('0x22')](respondWithStatusCode(_0x584b07,null))[_0xb33e('0x2b')](handleError(_0x584b07,null));};exports[_0xb33e('0xc3')]=function(_0x26d981,_0x2bcbfb,_0x3431d5){var _0x1485d9={};var _0x1a6941={};var _0x1eee58;var _0x46e348;return db['FaxAccount'][_0xb33e('0x67')]({'where':{'id':_0x26d981['params']['id']}})[_0xb33e('0x22')](handleEntityNotFound(_0x2bcbfb,null))[_0xb33e('0x22')](function(_0x42d0a5){if(_0x42d0a5){_0x1eee58=_0x42d0a5;_0x1a6941[_0xb33e('0x4a')]=_[_0xb33e('0x47')](db['User'][_0xb33e('0x42')]);_0x1a6941[_0xb33e('0x46')]=_[_0xb33e('0x47')](_0x26d981[_0xb33e('0x46')]);_0x1a6941['filters']=_[_0xb33e('0x49')](_0x1a6941[_0xb33e('0x4a')],_0x1a6941[_0xb33e('0x46')]);_0x1485d9['attributes']=_['intersection'](_0x1a6941[_0xb33e('0x4a')],qs[_0xb33e('0x4b')](_0x26d981[_0xb33e('0x46')][_0xb33e('0x4b')]));_0x1485d9[_0xb33e('0x4c')]=_0x1485d9[_0xb33e('0x4c')][_0xb33e('0x59')]?_0x1485d9[_0xb33e('0x4c')]:_0x1a6941[_0xb33e('0x4a')];_0x1485d9[_0xb33e('0x4e')]=qs[_0xb33e('0x4f')](_0x26d981[_0xb33e('0x46')][_0xb33e('0x4f')]);_0x1485d9[_0xb33e('0x50')]=qs[_0xb33e('0x48')](_['pick'](_0x26d981['query'],_0x1a6941[_0xb33e('0x48')]));if(_0x26d981[_0xb33e('0x46')]['filter']){_0x1485d9['where']=_[_0xb33e('0x52')](_0x1485d9[_0xb33e('0x50')],{'$or':_[_0xb33e('0x40')](_0x1485d9[_0xb33e('0x4c')],function(_0x11b616){var _0x38a7ad={};_0x38a7ad[_0x11b616]={'$like':'%'+_0x26d981[_0xb33e('0x46')][_0xb33e('0x69')]+'%'};return _0x38a7ad;})});}_0x1485d9=_[_0xb33e('0x52')]({},_0x1485d9,_0x26d981[_0xb33e('0x5a')]);return _0x1eee58['getAgents'](_0x1485d9);}})[_0xb33e('0x22')](function(_0x179e3f){if(_0x179e3f){_0x46e348=_0x179e3f[_0xb33e('0x59')];if(!_0x26d981['query'][_0xb33e('0x4d')](_0xb33e('0x68'))){_0x1485d9[_0xb33e('0x31')]=qs['limit'](_0x26d981[_0xb33e('0x46')][_0xb33e('0x31')]);_0x1485d9[_0xb33e('0x2f')]=qs[_0xb33e('0x2f')](_0x26d981[_0xb33e('0x46')][_0xb33e('0x2f')]);}return _0x1eee58[_0xb33e('0xc3')](_0x1485d9);}})['then'](function(_0x16cd2f){if(_0x16cd2f){return _0x16cd2f?{'count':_0x46e348,'rows':_0x16cd2f}:null;}})[_0xb33e('0x22')](respondWithResult(_0x2bcbfb,null))[_0xb33e('0x2b')](handleError(_0x2bcbfb,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 2f65048..8ecd585 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 _0xd3d3=['hook','exports','FaxAccount','setMaxListeners','emit','hasOwnProperty'];(function(_0x39adbc,_0x206482){var _0x57628d=function(_0x40d2aa){while(--_0x40d2aa){_0x39adbc['push'](_0x39adbc['shift']());}};_0x57628d(++_0x206482);}(_0xd3d3,0x19a));var _0x3d3d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd3d3[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require('events');var FaxAccount=require('../../mysqldb')['db'][_0x3d3d('0x0')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x3d3d('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0xd18336){return function(_0xf51158,_0x2fceb1,_0x4f0996){FaxAccountEvents[_0x3d3d('0x2')](_0xd18336+':'+_0xf51158['id'],_0xf51158);FaxAccountEvents['emit'](_0xd18336,_0xf51158);_0x4f0996(null);};}for(var e in events){if(events[_0x3d3d('0x3')](e)){var event=events[e];FaxAccount[_0x3d3d('0x4')](e,emitEvent(event));}}module[_0x3d3d('0x5')]=FaxAccountEvents; \ No newline at end of file +var _0x5e68=['update','remove','emit','hasOwnProperty','exports','events','../../mysqldb','FaxAccount','setMaxListeners'];(function(_0x16471d,_0x4872a5){var _0x180605=function(_0x52ba8c){while(--_0x52ba8c){_0x16471d['push'](_0x16471d['shift']());}};_0x180605(++_0x4872a5);}(_0x5e68,0x140));var _0x85e6=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x5e68[_0x5b644e];return _0x49c6bf;};'use strict';var EventEmitter=require(_0x85e6('0x0'));var FaxAccount=require(_0x85e6('0x1'))['db'][_0x85e6('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x85e6('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x85e6('0x4'),'afterDestroy':_0x85e6('0x5')};function emitEvent(_0x5e3090){return function(_0x52a5ed,_0x49a7fa,_0x2890cf){FaxAccountEvents[_0x85e6('0x6')](_0x5e3090+':'+_0x52a5ed['id'],_0x52a5ed);FaxAccountEvents[_0x85e6('0x6')](_0x5e3090,_0x52a5ed);_0x2890cf(null);};}for(var e in events){if(events[_0x85e6('0x7')](e)){var event=events[e];FaxAccount['hook'](e,emitEvent(event));}}module[_0x85e6('0x8')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index d64e942..d012dff 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 _0x11c7=['../../config/logger','bluebird','request-promise','rimraf','../../config/environment','./faxAccount.attributes','exports','FaxAccount','fax_accounts','lodash','util'];(function(_0x532b5b,_0xce6ec8){var _0x169ff9=function(_0x4d2804){while(--_0x4d2804){_0x532b5b['push'](_0x532b5b['shift']());}};_0x169ff9(++_0xce6ec8);}(_0x11c7,0x111));var _0x711c=function(_0x4e7e88,_0x343ab5){_0x4e7e88=_0x4e7e88-0x0;var _0x1cbe4c=_0x11c7[_0x4e7e88];return _0x1cbe4c;};'use strict';var _=require(_0x711c('0x0'));var util=require(_0x711c('0x1'));var logger=require(_0x711c('0x2'))('api');var moment=require('moment');var BPromise=require(_0x711c('0x3'));var rp=require(_0x711c('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x711c('0x5'));var config=require(_0x711c('0x6'));var attributes=require(_0x711c('0x7'));module[_0x711c('0x8')]=function(_0x18501a,_0x48a287){return _0x18501a['define'](_0x711c('0x9'),attributes,{'tableName':_0x711c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3291=['exports','fax_accounts','lodash','util','api','bluebird','request-promise','path','rimraf','./faxAccount.attributes'];(function(_0xe4b85,_0x2fb5d6){var _0x162164=function(_0x4ea6b3){while(--_0x4ea6b3){_0xe4b85['push'](_0xe4b85['shift']());}};_0x162164(++_0x2fb5d6);}(_0x3291,0xe8));var _0x1329=function(_0x385b3b,_0x505f70){_0x385b3b=_0x385b3b-0x0;var _0x3cf325=_0x3291[_0x385b3b];return _0x3cf325;};'use strict';var _=require(_0x1329('0x0'));var util=require(_0x1329('0x1'));var logger=require('../../config/logger')(_0x1329('0x2'));var moment=require('moment');var BPromise=require(_0x1329('0x3'));var rp=require(_0x1329('0x4'));var fs=require('fs');var path=require(_0x1329('0x5'));var rimraf=require(_0x1329('0x6'));var config=require('../../config/environment');var attributes=require(_0x1329('0x7'));module[_0x1329('0x8')]=function(_0x14099d,_0x49a49e){return _0x14099d['define']('FaxAccount',attributes,{'tableName':_0x1329('0x9'),'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 8ace4b5..b03a0fe 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 _0xa065=['map','model','info','GetFaxAccount','debug','body','fax','CmContact','describe','Sequelize','no\x20available\x20attributes','difference','keys','createdAt','updatedAt','isNil','from','from\x20is\x20mandatory','ValidationError','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList','List','Contacts','DESC','FaxApplication','Applications','get','applications','list','orderBy','length','defaults','ListId','create','contact','FaxInteraction','find','Contact\x20not\x20found','spread','autoclose','push','unmanaged','*,*,*,*','created','FaxMessage','AttachmentId','interaction','User','name','UserId','unshift','waitForTheAssignedAgent','queueId','FaxQueue','Start','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','redis','localhost','./faxAccount.socket','register','then','FaxAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','FaxAccount','findAll','raw','options','where','attributes','limit','include'];(function(_0x657e65,_0x307cb8){var _0x24c8ea=function(_0x5e1b88){while(--_0x5e1b88){_0x657e65['push'](_0x657e65['shift']());}};_0x24c8ea(++_0x307cb8);}(_0xa065,0x153));var _0x5a06=function(_0xef349,_0x6ac770){_0xef349=_0xef349-0x0;var _0x5679de=_0xa065[_0xef349];return _0x5679de;};'use strict';var _=require(_0x5a06('0x0'));var util=require(_0x5a06('0x1'));var moment=require(_0x5a06('0x2'));var BPromise=require(_0x5a06('0x3'));var rs=require(_0x5a06('0x4'));var fs=require('fs');var Redis=require(_0x5a06('0x5'));var db=require(_0x5a06('0x6'))['db'];var utils=require(_0x5a06('0x7'));var logger=require(_0x5a06('0x8'))(_0x5a06('0x9'));var config=require('../../config/environment');var jayson=require(_0x5a06('0xa'));var client=jayson[_0x5a06('0xb')]['http']({'port':0x232c});config[_0x5a06('0xc')]=_['defaults'](config[_0x5a06('0xc')],{'host':_0x5a06('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x5a06('0xe'))[_0x5a06('0xf')](socket);function respondWithRpcPromise(_0x411c53,_0x1b8199,_0x4be5c8){return new BPromise(function(_0x44bb81,_0x2c69e5){return client['request'](_0x411c53,_0x4be5c8)[_0x5a06('0x10')](function(_0x1de1f3){logger['info'](_0x5a06('0x11'),_0x1b8199,'request\x20sent');logger['debug']('FaxAccount,\x20%s,\x20%s,\x20%s',_0x1b8199,_0x5a06('0x12'),JSON[_0x5a06('0x13')](_0x1de1f3));if(_0x1de1f3['error']){if(_0x1de1f3[_0x5a06('0x14')][_0x5a06('0x15')]===0x1f4){logger['error'](_0x5a06('0x11'),_0x1b8199,_0x1de1f3[_0x5a06('0x14')][_0x5a06('0x16')]);return _0x2c69e5(_0x1de1f3[_0x5a06('0x14')][_0x5a06('0x16')]);}logger[_0x5a06('0x14')](_0x5a06('0x11'),_0x1b8199,_0x1de1f3[_0x5a06('0x14')][_0x5a06('0x16')]);return _0x44bb81(_0x1de1f3['error']['message']);}else{logger['info']('FaxAccount,\x20%s,\x20%s',_0x1b8199,'request\x20sent');_0x44bb81(_0x1de1f3[_0x5a06('0x17')]['message']);}})[_0x5a06('0x18')](function(_0x13f64c){logger[_0x5a06('0x14')]('FaxAccount,\x20%s,\x20%s',_0x1b8199,_0x13f64c);_0x2c69e5(_0x13f64c);});});}exports['GetFaxAccount']=function(_0x5a9887){var _0x529666=this;return new Promise(function(_0x316b7b,_0x32f830){return db[_0x5a06('0x19')][_0x5a06('0x1a')]({'raw':_0x5a9887['options']?_0x5a9887['options'][_0x5a06('0x1b')]===undefined?!![]:![]:!![],'where':_0x5a9887[_0x5a06('0x1c')]?_0x5a9887[_0x5a06('0x1c')][_0x5a06('0x1d')]||null:null,'attributes':_0x5a9887[_0x5a06('0x1c')]?_0x5a9887[_0x5a06('0x1c')][_0x5a06('0x1e')]||null:null,'limit':_0x5a9887[_0x5a06('0x1c')]?_0x5a9887[_0x5a06('0x1c')][_0x5a06('0x1f')]||null:null,'include':_0x5a9887[_0x5a06('0x1c')]?_0x5a9887['options'][_0x5a06('0x20')]?_[_0x5a06('0x21')](_0x5a9887[_0x5a06('0x1c')]['include'],function(_0xbc8ff0){return{'model':db[_0xbc8ff0[_0x5a06('0x22')]],'as':_0xbc8ff0['as'],'attributes':_0xbc8ff0['attributes'],'include':_0xbc8ff0[_0x5a06('0x20')]?_['map'](_0xbc8ff0[_0x5a06('0x20')],function(_0x3474b8){return{'model':db[_0x3474b8[_0x5a06('0x22')]],'as':_0x3474b8['as'],'attributes':_0x3474b8['attributes'],'include':_0x3474b8[_0x5a06('0x20')]?_[_0x5a06('0x21')](_0x3474b8[_0x5a06('0x20')],function(_0x137387){return{'model':db[_0x137387['model']],'as':_0x137387['as'],'attributes':_0x137387[_0x5a06('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x5a06('0x10')](function(_0x18369c){logger[_0x5a06('0x23')](_0x5a06('0x24'),_0x5a9887);logger[_0x5a06('0x25')]('GetFaxAccount',_0x5a9887,JSON[_0x5a06('0x13')](_0x18369c));_0x316b7b(_0x18369c);})[_0x5a06('0x18')](function(_0x3dc215){logger['error'](_0x5a06('0x24'),_0x3dc215[_0x5a06('0x16')],_0x5a9887);_0x32f830(_0x529666['error'](0x1f4,_0x3dc215['message']));});});};exports['NotifyFaxAccount']=function(_0x4131eb,_0x3be99b,_0x2f0740){var _0x2d68d7=this;return new Promise(function(_0x26c8b5,_0x5e5512){var _0x23f055={'body':_0x4131eb[_0x5a06('0x26')],'channel':_0x5a06('0x27')};var _0x15f566=[];var _0x2a7495=[];var _0x2bc37a={};return db[_0x5a06('0x28')][_0x5a06('0x29')]()[_0x5a06('0x10')](function(_0x4295bd){if(!_0x4295bd){throw new db[(_0x5a06('0x2a'))]['ValidationError'](_0x5a06('0x2b'));}_0x15f566=_[_0x5a06('0x2c')](_[_0x5a06('0x2d')](_0x4295bd),['createdAt','updatedAt']);_0x2a7495=_[_0x5a06('0x2c')](_[_0x5a06('0x2d')](_0x4295bd),[_0x5a06('0x2e'),_0x5a06('0x2f'),'CompanyId','ListId']);if(_0x4131eb[_0x5a06('0x26')]['id']){delete _0x4131eb[_0x5a06('0x26')]['id'];}if(_[_0x5a06('0x30')](_0x4131eb[_0x5a06('0x26')][_0x5a06('0x31')])){throw new db[(_0x5a06('0x2a'))]['ValidationError'](_0x5a06('0x32'));}if(_[_0x5a06('0x30')](_0x4131eb[_0x5a06('0x26')]['body'])||_0x4131eb[_0x5a06('0x26')][_0x5a06('0x26')]===''){throw new db[(_0x5a06('0x2a'))][(_0x5a06('0x33'))](_0x5a06('0x34'));}if(_[_0x5a06('0x30')](_0x4131eb[_0x5a06('0x26')][_0x5a06('0x35')])){throw new db['Sequelize'][(_0x5a06('0x33'))](_0x5a06('0x36')+_0x2a7495);}if(!_[_0x5a06('0x37')](_0x2a7495,_0x4131eb[_0x5a06('0x26')][_0x5a06('0x35')])){throw new db[(_0x5a06('0x2a'))][(_0x5a06('0x33'))](_0x5a06('0x38')+_0x2a7495);}_0x2bc37a[_0x4131eb[_0x5a06('0x26')][_0x5a06('0x35')]]=_0x4131eb['body']['from'];})[_0x5a06('0x10')](function(){return db['FaxAccount']['find']({'where':{'id':_0x4131eb[_0x5a06('0x39')]['id']},'include':[{'model':db[_0x5a06('0x3a')],'as':_0x5a06('0x3b'),'include':[{'model':db[_0x5a06('0x28')],'as':_0x5a06('0x3c'),'where':_0x2bc37a,'limit':0x1,'order':[[_0x5a06('0x2f'),_0x5a06('0x3d')]]}]},{'model':db[_0x5a06('0x3e')],'as':_0x5a06('0x3f')}]});})['then'](function(_0x5e9670){if(_0x5e9670&&_0x5e9670['List']){var _0x5f10fd=_0x5e9670[_0x5a06('0x40')]({'plain':!![]});_0x23f055['account']=_0x5f10fd;_0x23f055[_0x5a06('0x41')]=_0x5f10fd[_0x5a06('0x3f')];_0x23f055[_0x5a06('0x42')]=_0x5f10fd[_0x5a06('0x3b')];_0x23f055[_0x5a06('0x41')]=_[_0x5a06('0x43')](_0x23f055[_0x5a06('0x41')],['priority'],['asc']);if(_0x23f055[_0x5a06('0x39')]['Applications']){delete _0x23f055[_0x5a06('0x39')][_0x5a06('0x3f')];}if(_0x23f055[_0x5a06('0x39')][_0x5a06('0x3b')]&&_0x23f055['account']['List'][_0x5a06('0x3c')][_0x5a06('0x44')]){return _0x23f055[_0x5a06('0x39')][_0x5a06('0x3b')]['Contacts'][0x0];}var _0x513d4d=_[_0x5a06('0x45')](_0x4131eb[_0x5a06('0x26')],{'firstName':_0x4131eb[_0x5a06('0x26')][_0x5a06('0x31')],'ListId':_0x5f10fd[_0x5a06('0x46')]});_0x513d4d[_0x4131eb['body'][_0x5a06('0x35')]]=_0x4131eb['body']['from'];return db[_0x5a06('0x28')][_0x5a06('0x47')](_0x513d4d,{'fields':_0x15f566,'raw':!![]});}})[_0x5a06('0x10')](function(_0x5a6dba){_0x23f055[_0x5a06('0x48')]=_0x5a6dba;if(_0x5a6dba){var _0x23694f={'ContactId':_0x5a6dba['id'],'FaxAccountId':_0x4131eb['account']['id'],'fax':_0x5a6dba[_0x5a06('0x27')]};return db[_0x5a06('0x49')][_0x5a06('0x4a')]({'where':{'ContactId':_0x5a6dba['id'],'closed':![],'FaxAccountId':_0x4131eb[_0x5a06('0x39')]['id']}})['then'](function(_0x4feb9a){if(_0x4feb9a){return[_0x4feb9a,![]];}return db['FaxInteraction'][_0x5a06('0x47')](_0x23694f)['then'](function(_0x38e260){return[_0x38e260,!![]];});});}else{throw new Error(_0x5a06('0x4b'));}})[_0x5a06('0x4c')](function(_0x3bb711,_0x3fd98f){var _0x3f47fe=_0x3bb711[_0x5a06('0x40')]({'plain':!![]});if(_0x3fd98f){if(_0x23f055[_0x5a06('0x39')][_0x5a06('0x4d')]){_0x23f055[_0x5a06('0x41')][_0x5a06('0x4e')]({'id':0x0,'priority':_0x23f055[_0x5a06('0x41')]['length']+0x1,'app':'close','appdata':_0x5a06('0x4f'),'interval':_0x5a06('0x50')});}_0x3f47fe[_0x5a06('0x51')]=!![];}else{_0x3f47fe['created']=![];}_0x23f055['interaction']=_0x3f47fe;return db[_0x5a06('0x52')][_0x5a06('0x47')]({'body':_0x4131eb[_0x5a06('0x26')]['body'],'FaxAccountId':_0x4131eb[_0x5a06('0x39')]['id'],'FaxInteractionId':_0x3bb711['id'],'direction':'in','ContactId':_0x3bb711['ContactId'],'AttachmentId':_0x4131eb[_0x5a06('0x26')][_0x5a06('0x53')]});})['then'](function(_0x43a802){_0x23f055[_0x5a06('0x16')]=_0x43a802;if(!_0x23f055[_0x5a06('0x54')]['UserId'])return;return db[_0x5a06('0x55')][_0x5a06('0x4a')]({'attributes':['id',_0x5a06('0x56')],'where':{'id':_0x23f055[_0x5a06('0x54')][_0x5a06('0x57')]}});})[_0x5a06('0x10')](function(_0x781770){if(_0x781770){_0x23f055[_0x5a06('0x41')][_0x5a06('0x58')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x781770[_0x5a06('0x56')]+','+(_0x23f055[_0x5a06('0x39')][_0x5a06('0x59')]||0xa),'interval':_0x5a06('0x50')});}if(!_0x23f055[_0x5a06('0x54')][_0x5a06('0x5a')])return;return db[_0x5a06('0x5b')][_0x5a06('0x4a')]({'attributes':['id',_0x5a06('0x56')],'where':{'id':_0x23f055[_0x5a06('0x54')][_0x5a06('0x5a')]}});})['then'](function(_0x28d2ad){if(_0x28d2ad){_0x23f055[_0x5a06('0x41')]['unshift']({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x28d2ad[_0x5a06('0x56')]+','+(_0x23f055['account']['waitForTheAssignedQueue']||0x12c),'interval':_0x5a06('0x50')});}return respondWithRpcPromise(_0x5a06('0x5c'),'startRouting',_0x23f055);})[_0x5a06('0x10')](function(_0x4313c8){_0x26c8b5(_0x4313c8);})['catch'](function(_0x1bf142){_0x5e5512(_0x2d68d7['error'](0x1f4,_0x1bf142[_0x5a06('0x16')]));});});}; \ No newline at end of file +var _0x7a55=['lodash','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','localhost','./faxAccount.socket','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetFaxAccount','FaxAccount','options','raw','where','attributes','limit','map','include','model','debug','NotifyFaxAccount','body','CmContact','describe','Sequelize','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','ValidationError','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','CmList','List','Contacts','Applications','get','account','applications','orderBy','length','defaults','create','contact','fax','FaxInteraction','Contact\x20not\x20found','spread','push','close','*,*,*,*','created','interaction','AttachmentId','UserId','User','name','unshift','agent','waitForTheAssignedAgent','queueId','queue','Start','startRouting'];(function(_0x188471,_0x4d6909){var _0x16e675=function(_0x53df21){while(--_0x53df21){_0x188471['push'](_0x188471['shift']());}};_0x16e675(++_0x4d6909);}(_0x7a55,0x154));var _0x57a5=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x7a55[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x57a5('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x57a5('0x1'));var db=require(_0x57a5('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x57a5('0x3'))(_0x57a5('0x4'));var config=require(_0x57a5('0x5'));var jayson=require(_0x57a5('0x6'));var client=jayson['client'][_0x57a5('0x7')]({'port':0x232c});config[_0x57a5('0x8')]=_['defaults'](config[_0x57a5('0x8')],{'host':_0x57a5('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x57a5('0x8')]));require(_0x57a5('0xa'))['register'](socket);function respondWithRpcPromise(_0x5b8d90,_0x4c4e9d,_0x28295c){return new BPromise(function(_0x490e74,_0x1b3adf){return client[_0x57a5('0xb')](_0x5b8d90,_0x28295c)[_0x57a5('0xc')](function(_0xf2b241){logger[_0x57a5('0xd')](_0x57a5('0xe'),_0x4c4e9d,'request\x20sent');logger['debug']('FaxAccount,\x20%s,\x20%s,\x20%s',_0x4c4e9d,_0x57a5('0xf'),JSON[_0x57a5('0x10')](_0xf2b241));if(_0xf2b241[_0x57a5('0x11')]){if(_0xf2b241[_0x57a5('0x11')][_0x57a5('0x12')]===0x1f4){logger[_0x57a5('0x11')]('FaxAccount,\x20%s,\x20%s',_0x4c4e9d,_0xf2b241['error'][_0x57a5('0x13')]);return _0x1b3adf(_0xf2b241[_0x57a5('0x11')][_0x57a5('0x13')]);}logger['error'](_0x57a5('0xe'),_0x4c4e9d,_0xf2b241[_0x57a5('0x11')][_0x57a5('0x13')]);return _0x490e74(_0xf2b241[_0x57a5('0x11')][_0x57a5('0x13')]);}else{logger[_0x57a5('0xd')](_0x57a5('0xe'),_0x4c4e9d,'request\x20sent');_0x490e74(_0xf2b241[_0x57a5('0x14')]['message']);}})[_0x57a5('0x15')](function(_0x3cc347){logger[_0x57a5('0x11')]('FaxAccount,\x20%s,\x20%s',_0x4c4e9d,_0x3cc347);_0x1b3adf(_0x3cc347);});});}exports[_0x57a5('0x16')]=function(_0x214d3b){var _0x5a721d=this;return new Promise(function(_0x11c6a7,_0x56df65){return db[_0x57a5('0x17')]['findAll']({'raw':_0x214d3b[_0x57a5('0x18')]?_0x214d3b[_0x57a5('0x18')][_0x57a5('0x19')]===undefined?!![]:![]:!![],'where':_0x214d3b['options']?_0x214d3b[_0x57a5('0x18')][_0x57a5('0x1a')]||null:null,'attributes':_0x214d3b[_0x57a5('0x18')]?_0x214d3b[_0x57a5('0x18')][_0x57a5('0x1b')]||null:null,'limit':_0x214d3b[_0x57a5('0x18')]?_0x214d3b[_0x57a5('0x18')][_0x57a5('0x1c')]||null:null,'include':_0x214d3b[_0x57a5('0x18')]?_0x214d3b['options']['include']?_[_0x57a5('0x1d')](_0x214d3b[_0x57a5('0x18')][_0x57a5('0x1e')],function(_0x37d002){return{'model':db[_0x37d002['model']],'as':_0x37d002['as'],'attributes':_0x37d002[_0x57a5('0x1b')],'include':_0x37d002['include']?_[_0x57a5('0x1d')](_0x37d002[_0x57a5('0x1e')],function(_0x42fd51){return{'model':db[_0x42fd51[_0x57a5('0x1f')]],'as':_0x42fd51['as'],'attributes':_0x42fd51[_0x57a5('0x1b')],'include':_0x42fd51[_0x57a5('0x1e')]?_[_0x57a5('0x1d')](_0x42fd51[_0x57a5('0x1e')],function(_0x192df3){return{'model':db[_0x192df3[_0x57a5('0x1f')]],'as':_0x192df3['as'],'attributes':_0x192df3[_0x57a5('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x57a5('0xc')](function(_0x58ca36){logger['info'](_0x57a5('0x16'),_0x214d3b);logger[_0x57a5('0x20')](_0x57a5('0x16'),_0x214d3b,JSON[_0x57a5('0x10')](_0x58ca36));_0x11c6a7(_0x58ca36);})[_0x57a5('0x15')](function(_0x1b21d3){logger[_0x57a5('0x11')](_0x57a5('0x16'),_0x1b21d3[_0x57a5('0x13')],_0x214d3b);_0x56df65(_0x5a721d[_0x57a5('0x11')](0x1f4,_0x1b21d3[_0x57a5('0x13')]));});});};exports[_0x57a5('0x21')]=function(_0x3e0b96,_0x337f74,_0x6960ac){var _0x218be3=this;return new Promise(function(_0x36c5b7,_0x1144bc){var _0xb640e9={'body':_0x3e0b96[_0x57a5('0x22')],'channel':'fax'};var _0x36c09f=[];var _0x443371=[];var _0x221376={};return db[_0x57a5('0x23')][_0x57a5('0x24')]()[_0x57a5('0xc')](function(_0x46409){if(!_0x46409){throw new db[(_0x57a5('0x25'))]['ValidationError'](_0x57a5('0x26'));}_0x36c09f=_[_0x57a5('0x27')](_['keys'](_0x46409),[_0x57a5('0x28'),_0x57a5('0x29')]);_0x443371=_[_0x57a5('0x27')](_['keys'](_0x46409),['createdAt',_0x57a5('0x29'),_0x57a5('0x2a'),_0x57a5('0x2b')]);if(_0x3e0b96[_0x57a5('0x22')]['id']){delete _0x3e0b96[_0x57a5('0x22')]['id'];}if(_[_0x57a5('0x2c')](_0x3e0b96['body'][_0x57a5('0x2d')])){throw new db[(_0x57a5('0x25'))]['ValidationError'](_0x57a5('0x2e'));}if(_[_0x57a5('0x2c')](_0x3e0b96[_0x57a5('0x22')][_0x57a5('0x22')])||_0x3e0b96[_0x57a5('0x22')]['body']===''){throw new db['Sequelize'][(_0x57a5('0x2f'))](_0x57a5('0x30'));}if(_[_0x57a5('0x2c')](_0x3e0b96['body'][_0x57a5('0x31')])){throw new db['Sequelize'][(_0x57a5('0x2f'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x443371);}if(!_[_0x57a5('0x32')](_0x443371,_0x3e0b96[_0x57a5('0x22')]['mapKey'])){throw new db['Sequelize'][(_0x57a5('0x2f'))](_0x57a5('0x33')+_0x443371);}_0x221376[_0x3e0b96[_0x57a5('0x22')][_0x57a5('0x31')]]=_0x3e0b96[_0x57a5('0x22')][_0x57a5('0x2d')];})[_0x57a5('0xc')](function(){return db[_0x57a5('0x17')][_0x57a5('0x34')]({'where':{'id':_0x3e0b96['account']['id']},'include':[{'model':db[_0x57a5('0x35')],'as':_0x57a5('0x36'),'include':[{'model':db['CmContact'],'as':_0x57a5('0x37'),'where':_0x221376,'limit':0x1,'order':[[_0x57a5('0x29'),'DESC']]}]},{'model':db['FaxApplication'],'as':_0x57a5('0x38')}]});})[_0x57a5('0xc')](function(_0x44d6c8){if(_0x44d6c8&&_0x44d6c8[_0x57a5('0x36')]){var _0x38d81b=_0x44d6c8[_0x57a5('0x39')]({'plain':!![]});_0xb640e9[_0x57a5('0x3a')]=_0x38d81b;_0xb640e9[_0x57a5('0x3b')]=_0x38d81b[_0x57a5('0x38')];_0xb640e9['list']=_0x38d81b['List'];_0xb640e9[_0x57a5('0x3b')]=_[_0x57a5('0x3c')](_0xb640e9['applications'],['priority'],['asc']);if(_0xb640e9['account']['Applications']){delete _0xb640e9[_0x57a5('0x3a')][_0x57a5('0x38')];}if(_0xb640e9[_0x57a5('0x3a')][_0x57a5('0x36')]&&_0xb640e9['account'][_0x57a5('0x36')]['Contacts'][_0x57a5('0x3d')]){return _0xb640e9['account'][_0x57a5('0x36')][_0x57a5('0x37')][0x0];}var _0x295abb=_[_0x57a5('0x3e')](_0x3e0b96[_0x57a5('0x22')],{'firstName':_0x3e0b96['body']['from'],'ListId':_0x38d81b[_0x57a5('0x2b')]});_0x295abb[_0x3e0b96['body'][_0x57a5('0x31')]]=_0x3e0b96[_0x57a5('0x22')][_0x57a5('0x2d')];return db[_0x57a5('0x23')][_0x57a5('0x3f')](_0x295abb,{'fields':_0x36c09f,'raw':!![]});}})[_0x57a5('0xc')](function(_0x48eb7e){_0xb640e9[_0x57a5('0x40')]=_0x48eb7e;if(_0x48eb7e){var _0x28840c={'ContactId':_0x48eb7e['id'],'FaxAccountId':_0x3e0b96[_0x57a5('0x3a')]['id'],'fax':_0x48eb7e[_0x57a5('0x41')]};return db[_0x57a5('0x42')]['find']({'where':{'ContactId':_0x48eb7e['id'],'closed':![],'FaxAccountId':_0x3e0b96['account']['id']}})[_0x57a5('0xc')](function(_0x96e67){if(_0x96e67){return[_0x96e67,![]];}return db[_0x57a5('0x42')][_0x57a5('0x3f')](_0x28840c)[_0x57a5('0xc')](function(_0x5822ce){return[_0x5822ce,!![]];});});}else{throw new Error(_0x57a5('0x43'));}})[_0x57a5('0x44')](function(_0x152d46,_0x48d0fd){var _0x426342=_0x152d46[_0x57a5('0x39')]({'plain':!![]});if(_0x48d0fd){if(_0xb640e9[_0x57a5('0x3a')]['autoclose']){_0xb640e9['applications'][_0x57a5('0x45')]({'id':0x0,'priority':_0xb640e9['applications'][_0x57a5('0x3d')]+0x1,'app':_0x57a5('0x46'),'appdata':'unmanaged','interval':_0x57a5('0x47')});}_0x426342[_0x57a5('0x48')]=!![];}else{_0x426342['created']=![];}_0xb640e9[_0x57a5('0x49')]=_0x426342;return db['FaxMessage'][_0x57a5('0x3f')]({'body':_0x3e0b96['body']['body'],'FaxAccountId':_0x3e0b96[_0x57a5('0x3a')]['id'],'FaxInteractionId':_0x152d46['id'],'direction':'in','ContactId':_0x152d46['ContactId'],'AttachmentId':_0x3e0b96[_0x57a5('0x22')][_0x57a5('0x4a')]});})[_0x57a5('0xc')](function(_0x18d552){_0xb640e9['message']=_0x18d552;if(!_0xb640e9['interaction'][_0x57a5('0x4b')])return;return db[_0x57a5('0x4c')]['find']({'attributes':['id',_0x57a5('0x4d')],'where':{'id':_0xb640e9[_0x57a5('0x49')]['UserId']}});})[_0x57a5('0xc')](function(_0xce455b){if(_0xce455b){_0xb640e9['applications'][_0x57a5('0x4e')]({'id':0x0,'priority':0x0,'app':_0x57a5('0x4f'),'appdata':_0xce455b[_0x57a5('0x4d')]+','+(_0xb640e9[_0x57a5('0x3a')][_0x57a5('0x50')]||0xa),'interval':_0x57a5('0x47')});}if(!_0xb640e9['interaction'][_0x57a5('0x51')])return;return db['FaxQueue'][_0x57a5('0x34')]({'attributes':['id',_0x57a5('0x4d')],'where':{'id':_0xb640e9[_0x57a5('0x49')][_0x57a5('0x51')]}});})[_0x57a5('0xc')](function(_0x2bfe0a){if(_0x2bfe0a){_0xb640e9['applications'][_0x57a5('0x4e')]({'id':0x0,'priority':0x1,'app':_0x57a5('0x52'),'appdata':_0x2bfe0a[_0x57a5('0x4d')]+','+(_0xb640e9[_0x57a5('0x3a')]['waitForTheAssignedQueue']||0x12c),'interval':_0x57a5('0x47')});}return respondWithRpcPromise(_0x57a5('0x53'),_0x57a5('0x54'),_0xb640e9);})[_0x57a5('0xc')](function(_0x1613e6){_0x36c5b7(_0x1613e6);})['catch'](function(_0x5635c6){_0x1144bc(_0x218be3[_0x57a5('0x11')](0x1f4,_0x5635c6[_0x57a5('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index a034386..29cd9dc 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 _0x4e19=['faxAccount:','./faxAccount.events','save','update','emit','removeListener','register','length'];(function(_0x3cfe4e,_0x3e2fed){var _0x22e983=function(_0x75f797){while(--_0x75f797){_0x3cfe4e['push'](_0x3cfe4e['shift']());}};_0x22e983(++_0x3e2fed);}(_0x4e19,0xe1));var _0x94e1=function(_0x57d232,_0x1eb10c){_0x57d232=_0x57d232-0x0;var _0x4c7e6d=_0x4e19[_0x57d232];return _0x4c7e6d;};'use strict';var FaxAccountEvents=require(_0x94e1('0x0'));var events=[_0x94e1('0x1'),'remove',_0x94e1('0x2')];function createListener(_0x2280af,_0xd59361){return function(_0x2c0553){_0xd59361[_0x94e1('0x3')](_0x2280af,_0x2c0553);};}function removeListener(_0x2e287b,_0xac83c8){return function(){FaxAccountEvents[_0x94e1('0x4')](_0x2e287b,_0xac83c8);};}exports[_0x94e1('0x5')]=function(_0x3a2952){for(var _0x595711=0x0,_0x24908e=events[_0x94e1('0x6')];_0x595711<_0x24908e;_0x595711++){var _0x1943be=events[_0x595711];var _0x2aec24=createListener(_0x94e1('0x7')+_0x1943be,_0x3a2952);FaxAccountEvents['on'](_0x1943be,_0x2aec24);}}; \ No newline at end of file +var _0x5850=['update','emit','removeListener','register','length','faxAccount:','./faxAccount.events'];(function(_0x3cc9dd,_0x257db9){var _0x3bd24f=function(_0x3b0081){while(--_0x3b0081){_0x3cc9dd['push'](_0x3cc9dd['shift']());}};_0x3bd24f(++_0x257db9);}(_0x5850,0xdf));var _0x0585=function(_0x3e59b2,_0x830bc5){_0x3e59b2=_0x3e59b2-0x0;var _0x2eec7f=_0x5850[_0x3e59b2];return _0x2eec7f;};'use strict';var FaxAccountEvents=require(_0x0585('0x0'));var events=['save','remove',_0x0585('0x1')];function createListener(_0xe2df31,_0x4d6ed6){return function(_0x456970){_0x4d6ed6[_0x0585('0x2')](_0xe2df31,_0x456970);};}function removeListener(_0x4d1148,_0x501557){return function(){FaxAccountEvents[_0x0585('0x3')](_0x4d1148,_0x501557);};}exports[_0x0585('0x4')]=function(_0x5e4bba){for(var _0xce04f4=0x0,_0x46bed4=events[_0x0585('0x5')];_0xce04f4<_0x46bed4;_0xce04f4++){var _0x23e9a5=events[_0xce04f4];var _0x113a61=createListener(_0x0585('0x6')+_0x23e9a5,_0x5e4bba);FaxAccountEvents['on'](_0x23e9a5,_0x113a61);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 6b2aefe..9071e7f 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 _0x5dac=['delete','destroy','removeAnswers','removeAgents','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./faxAccount.controller','isAuthenticated','index','get','/describe','describe','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/interactions','getInteractions','getApplications','/:id/messages','getMessages','/:id/users','post','create','addDisposition','addAnswer','addInteraction','/:id/applications','/updateaccountapplications','updateAccountApplications','/:id/send','put','/:id','update'];(function(_0x13187a,_0x2fcec4){var _0x65b85f=function(_0x33bf1f){while(--_0x33bf1f){_0x13187a['push'](_0x13187a['shift']());}};_0x65b85f(++_0x2fcec4);}(_0x5dac,0xf4));var _0xc5da=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x5dac[_0x1facfa];return _0x9ec701;};'use strict';var multer=require(_0xc5da('0x0'));var util=require(_0xc5da('0x1'));var path=require('path');var timeout=require(_0xc5da('0x2'));var express=require(_0xc5da('0x3'));var router=express[_0xc5da('0x4')]();var fs_extra=require(_0xc5da('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xc5da('0x6'));var config=require(_0xc5da('0x7'));var controller=require(_0xc5da('0x8'));router['get']('/',auth[_0xc5da('0x9')](),controller[_0xc5da('0xa')]);router[_0xc5da('0xb')](_0xc5da('0xc'),auth[_0xc5da('0x9')](),controller[_0xc5da('0xd')]);router[_0xc5da('0xb')]('/:id',auth[_0xc5da('0x9')](),controller['show']);router[_0xc5da('0xb')](_0xc5da('0xe'),auth['isAuthenticated'](),controller[_0xc5da('0xf')]);router[_0xc5da('0xb')](_0xc5da('0x10'),auth[_0xc5da('0x9')](),controller[_0xc5da('0x11')]);router[_0xc5da('0xb')](_0xc5da('0x12'),auth['isAuthenticated'](),controller[_0xc5da('0x13')]);router['get']('/:id/applications',auth[_0xc5da('0x9')](),controller[_0xc5da('0x14')]);router[_0xc5da('0xb')](_0xc5da('0x15'),auth['isAuthenticated'](),controller[_0xc5da('0x16')]);router[_0xc5da('0xb')](_0xc5da('0x17'),auth[_0xc5da('0x9')](),controller['getAgents']);router[_0xc5da('0x18')]('/',auth[_0xc5da('0x9')](),controller[_0xc5da('0x19')]);router['post'](_0xc5da('0xe'),auth[_0xc5da('0x9')](),controller[_0xc5da('0x1a')]);router[_0xc5da('0x18')](_0xc5da('0x10'),auth[_0xc5da('0x9')](),controller[_0xc5da('0x1b')]);router[_0xc5da('0x18')](_0xc5da('0x12'),auth['isAuthenticated'](),controller[_0xc5da('0x1c')]);router[_0xc5da('0x18')](_0xc5da('0x1d'),auth[_0xc5da('0x9')](),controller['addApplications']);router[_0xc5da('0x18')]('/addaccountapplications',auth[_0xc5da('0x9')](),controller['addAccountApplications']);router[_0xc5da('0x18')](_0xc5da('0x1e'),auth[_0xc5da('0x9')](),controller[_0xc5da('0x1f')]);router[_0xc5da('0x18')](_0xc5da('0x20'),auth[_0xc5da('0x9')](),controller['send']);router[_0xc5da('0x18')](_0xc5da('0x17'),auth[_0xc5da('0x9')](),controller['addAgents']);router[_0xc5da('0x21')](_0xc5da('0x22'),auth['isAuthenticated'](),controller[_0xc5da('0x23')]);router[_0xc5da('0x24')]('/:id',auth[_0xc5da('0x9')](),controller[_0xc5da('0x25')]);router[_0xc5da('0x24')](_0xc5da('0xe'),auth['isAuthenticated'](),controller['removeDispositions']);router[_0xc5da('0x24')]('/:id/canned_answers',auth[_0xc5da('0x9')](),controller[_0xc5da('0x26')]);router[_0xc5da('0x24')](_0xc5da('0x17'),auth[_0xc5da('0x9')](),controller[_0xc5da('0x27')]);module['exports']=router; \ No newline at end of file +var _0xabf9=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','show','/:id/dispositions','getDispositions','getAnswers','/:id/interactions','getInteractions','getApplications','/:id/messages','getMessages','/:id/users','getAgents','create','post','addDisposition','/:id/canned_answers','addAnswer','addInteraction','/:id/applications','addApplications','/addaccountapplications','/updateaccountapplications','/:id/send','addAgents','put','delete','destroy','removeDispositions','removeAgents','exports','multer','util'];(function(_0x199c03,_0x3254aa){var _0x11a7d4=function(_0x49e1da){while(--_0x49e1da){_0x199c03['push'](_0x199c03['shift']());}};_0x11a7d4(++_0x3254aa);}(_0xabf9,0x12b));var _0x9abf=function(_0x5af96a,_0x5f1722){_0x5af96a=_0x5af96a-0x0;var _0x385921=_0xabf9[_0x5af96a];return _0x385921;};'use strict';var multer=require(_0x9abf('0x0'));var util=require(_0x9abf('0x1'));var path=require(_0x9abf('0x2'));var timeout=require(_0x9abf('0x3'));var express=require('express');var router=express[_0x9abf('0x4')]();var fs_extra=require(_0x9abf('0x5'));var auth=require(_0x9abf('0x6'));var interaction=require(_0x9abf('0x7'));var config=require(_0x9abf('0x8'));var controller=require('./faxAccount.controller');router[_0x9abf('0x9')]('/',auth[_0x9abf('0xa')](),controller[_0x9abf('0xb')]);router['get']('/describe',auth[_0x9abf('0xa')](),controller[_0x9abf('0xc')]);router['get'](_0x9abf('0xd'),auth['isAuthenticated'](),controller[_0x9abf('0xe')]);router[_0x9abf('0x9')](_0x9abf('0xf'),auth[_0x9abf('0xa')](),controller[_0x9abf('0x10')]);router[_0x9abf('0x9')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x9abf('0x11')]);router[_0x9abf('0x9')](_0x9abf('0x12'),auth['isAuthenticated'](),controller[_0x9abf('0x13')]);router[_0x9abf('0x9')]('/:id/applications',auth[_0x9abf('0xa')](),controller[_0x9abf('0x14')]);router[_0x9abf('0x9')](_0x9abf('0x15'),auth[_0x9abf('0xa')](),controller[_0x9abf('0x16')]);router[_0x9abf('0x9')](_0x9abf('0x17'),auth[_0x9abf('0xa')](),controller[_0x9abf('0x18')]);router['post']('/',auth[_0x9abf('0xa')](),controller[_0x9abf('0x19')]);router[_0x9abf('0x1a')](_0x9abf('0xf'),auth[_0x9abf('0xa')](),controller[_0x9abf('0x1b')]);router[_0x9abf('0x1a')](_0x9abf('0x1c'),auth[_0x9abf('0xa')](),controller[_0x9abf('0x1d')]);router[_0x9abf('0x1a')]('/:id/interactions',auth[_0x9abf('0xa')](),controller[_0x9abf('0x1e')]);router[_0x9abf('0x1a')](_0x9abf('0x1f'),auth[_0x9abf('0xa')](),controller[_0x9abf('0x20')]);router[_0x9abf('0x1a')](_0x9abf('0x21'),auth[_0x9abf('0xa')](),controller['addAccountApplications']);router['post'](_0x9abf('0x22'),auth[_0x9abf('0xa')](),controller['updateAccountApplications']);router[_0x9abf('0x1a')](_0x9abf('0x23'),auth[_0x9abf('0xa')](),controller['send']);router[_0x9abf('0x1a')](_0x9abf('0x17'),auth[_0x9abf('0xa')](),controller[_0x9abf('0x24')]);router[_0x9abf('0x25')](_0x9abf('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x9abf('0x26')](_0x9abf('0xd'),auth[_0x9abf('0xa')](),controller[_0x9abf('0x27')]);router[_0x9abf('0x26')]('/:id/dispositions',auth[_0x9abf('0xa')](),controller[_0x9abf('0x28')]);router['delete'](_0x9abf('0x1c'),auth[_0x9abf('0xa')](),controller['removeAnswers']);router[_0x9abf('0x26')](_0x9abf('0x17'),auth[_0x9abf('0xa')](),controller[_0x9abf('0x29')]);module[_0x9abf('0x2a')]=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index bee7604..4ba381e 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 _0x7687=['STRING','noop','TEXT','exports'];(function(_0x59c301,_0x359c50){var _0x3866b9=function(_0x2d380e){while(--_0x2d380e){_0x59c301['push'](_0x59c301['shift']());}};_0x3866b9(++_0x359c50);}(_0x7687,0x1e3));var _0x7768=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0x7687[_0x134c2e];return _0x2825db;};'use strict';var Sequelize=require('sequelize');module[_0x7768('0x0')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x7768('0x1')],'allowNull':![],'defaultValue':_0x7768('0x2')},'appdata':{'type':Sequelize[_0x7768('0x3')]()},'description':{'type':Sequelize[_0x7768('0x1')]},'interval':{'type':Sequelize[_0x7768('0x1')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x09f5=['noop','TEXT','sequelize','INTEGER','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x09f5,0x1b0));var _0x509f=function(_0x2129b2,_0x3637a8){_0x2129b2=_0x2129b2-0x0;var _0x5dc81d=_0x09f5[_0x2129b2];return _0x5dc81d;};'use strict';var Sequelize=require(_0x509f('0x0'));module['exports']={'priority':{'type':Sequelize[_0x509f('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x509f('0x2')],'allowNull':![],'defaultValue':_0x509f('0x3')},'appdata':{'type':Sequelize[_0x509f('0x4')]()},'description':{'type':Sequelize[_0x509f('0x2')]},'interval':{'type':Sequelize[_0x509f('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index d1cd888..2200e16 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 _0x3494=['nolimit','order','sort','where','pick','filters','filter','type','merge','FaxApplication','includeAll','include','findAll','rows','catch','show','params','rawAttributes','options','create','find','body','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','fieldName','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x3494,0x106));var _0x4349=function(_0x4cee3e,_0x55413a){_0x4cee3e=_0x4cee3e-0x0;var _0x18c390=_0x3494[_0x4cee3e];return _0x18c390;};'use strict';var emlformat=require(_0x4349('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4349('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4349('0x2'));var moment=require(_0x4349('0x3'));var BPromise=require(_0x4349('0x4'));var Mustache=require(_0x4349('0x5'));var util=require(_0x4349('0x6'));var path=require('path');var sox=require(_0x4349('0x7'));var csv=require(_0x4349('0x8'));var ejs=require(_0x4349('0x9'));var fs=require('fs');var fs_extra=require(_0x4349('0xa'));var _=require('lodash');var squel=require(_0x4349('0xb'));var crypto=require(_0x4349('0xc'));var jsforce=require(_0x4349('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x4349('0x8'));var querystring=require(_0x4349('0xe'));var Papa=require(_0x4349('0xf'));var Redis=require(_0x4349('0x10'));var authService=require(_0x4349('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x4349('0x12'));var hardwareService=require(_0x4349('0x13'));var logger=require(_0x4349('0x14'))(_0x4349('0x15'));var utils=require(_0x4349('0x16'));var config=require(_0x4349('0x17'));var licenseUtil=require(_0x4349('0x18'));var db=require(_0x4349('0x19'))['db'];function respondWithStatusCode(_0x73da72,_0x2b418b){_0x2b418b=_0x2b418b||0xcc;return function(_0x4ba8de){if(_0x4ba8de){return _0x73da72['sendStatus'](_0x2b418b);}return _0x73da72[_0x4349('0x1a')](_0x2b418b)[_0x4349('0x1b')]();};}function respondWithResult(_0x592ab7,_0x82d563){_0x82d563=_0x82d563||0xc8;return function(_0x5696c8){if(_0x5696c8){return _0x592ab7[_0x4349('0x1a')](_0x82d563)[_0x4349('0x1c')](_0x5696c8);}};}function respondWithFilteredResult(_0x3e2fb4,_0x4b469f){return function(_0xb46758){if(_0xb46758){var _0x7e1bc9=typeof _0x4b469f['offset']===_0x4349('0x1d')&&typeof _0x4b469f[_0x4349('0x1e')]===_0x4349('0x1d');var _0x5b8bf4=_0xb46758['count'];var _0xab8de6=_0x7e1bc9?0x0:_0x4b469f[_0x4349('0x1f')];var _0x3f33b3=_0x7e1bc9?_0xb46758[_0x4349('0x20')]:_0x4b469f[_0x4349('0x1f')]+_0x4b469f[_0x4349('0x1e')];var _0x269ad4;if(_0x3f33b3>=_0x5b8bf4){_0x3f33b3=_0x5b8bf4;_0x269ad4=0xc8;}else{_0x269ad4=0xce;}_0x3e2fb4['status'](_0x269ad4);return _0x3e2fb4[_0x4349('0x21')](_0x4349('0x22'),_0xab8de6+'-'+_0x3f33b3+'/'+_0x5b8bf4)[_0x4349('0x1c')](_0xb46758);}return null;};}function patchUpdates(_0x1e84fd){return function(_0x47a9f0){try{jsonpatch[_0x4349('0x23')](_0x47a9f0,_0x1e84fd,!![]);}catch(_0x40ed37){return BPromise[_0x4349('0x24')](_0x40ed37);}return _0x47a9f0[_0x4349('0x25')]();};}function saveUpdates(_0x1ab7ad,_0x17febd){return function(_0x508645){if(_0x508645){return _0x508645[_0x4349('0x26')](_0x1ab7ad)[_0x4349('0x27')](function(_0x31338b){return _0x31338b;});}return null;};}function removeEntity(_0xd8901a,_0x289654){return function(_0x42ae78){if(_0x42ae78){return _0x42ae78[_0x4349('0x28')]()[_0x4349('0x27')](function(){_0xd8901a['status'](0xcc)[_0x4349('0x1b')]();});}};}function handleEntityNotFound(_0xcfaf43,_0x4ca2d0){return function(_0x3f5029){if(!_0x3f5029){_0xcfaf43[_0x4349('0x29')](0x194);}return _0x3f5029;};}function handleError(_0x4c09e1,_0x8b8b1d){_0x8b8b1d=_0x8b8b1d||0x1f4;return function(_0x2a81c4){logger[_0x4349('0x2a')](_0x2a81c4[_0x4349('0x2b')]);if(_0x2a81c4[_0x4349('0x2c')]){delete _0x2a81c4[_0x4349('0x2c')];}_0x4c09e1[_0x4349('0x1a')](_0x8b8b1d)[_0x4349('0x2d')](_0x2a81c4);};}exports[_0x4349('0x2e')]=function(_0xcd36d0,_0x2178a8){var _0x301c53={},_0x5f1980={},_0x4bfbfd={'count':0x0,'rows':[]};var _0x4e4397=_[_0x4349('0x2f')](db['FaxApplication']['rawAttributes'],function(_0x18aecd){return{'name':_0x18aecd[_0x4349('0x30')],'type':_0x18aecd['type'][_0x4349('0x31')]};});_0x5f1980['model']=_['map'](_0x4e4397,'name');_0x5f1980[_0x4349('0x32')]=_[_0x4349('0x33')](_0xcd36d0[_0x4349('0x32')]);_0x5f1980['filters']=_[_0x4349('0x34')](_0x5f1980[_0x4349('0x35')],_0x5f1980[_0x4349('0x32')]);_0x301c53[_0x4349('0x36')]=_[_0x4349('0x34')](_0x5f1980[_0x4349('0x35')],qs[_0x4349('0x37')](_0xcd36d0[_0x4349('0x32')]['fields']));_0x301c53['attributes']=_0x301c53[_0x4349('0x36')][_0x4349('0x38')]?_0x301c53[_0x4349('0x36')]:_0x5f1980[_0x4349('0x35')];if(!_0xcd36d0[_0x4349('0x32')][_0x4349('0x39')](_0x4349('0x3a'))){_0x301c53[_0x4349('0x1e')]=qs[_0x4349('0x1e')](_0xcd36d0[_0x4349('0x32')][_0x4349('0x1e')]);_0x301c53[_0x4349('0x1f')]=qs[_0x4349('0x1f')](_0xcd36d0['query'][_0x4349('0x1f')]);}_0x301c53[_0x4349('0x3b')]=qs[_0x4349('0x3c')](_0xcd36d0[_0x4349('0x32')][_0x4349('0x3c')]);_0x301c53[_0x4349('0x3d')]=qs['filters'](_[_0x4349('0x3e')](_0xcd36d0[_0x4349('0x32')],_0x5f1980[_0x4349('0x3f')]),_0x4e4397);if(_0xcd36d0[_0x4349('0x32')][_0x4349('0x40')]){_0x301c53[_0x4349('0x3d')]=_['merge'](_0x301c53[_0x4349('0x3d')],{'$or':_[_0x4349('0x2f')](_0x4e4397,function(_0x45a318){if(_0x45a318[_0x4349('0x41')]!=='VIRTUAL'){var _0x253308={};_0x253308[_0x45a318[_0x4349('0x2c')]]={'$like':'%'+_0xcd36d0[_0x4349('0x32')][_0x4349('0x40')]+'%'};return _0x253308;}})});}_0x301c53=_[_0x4349('0x42')]({},_0x301c53,_0xcd36d0['options']);var _0x1cd26f={'where':_0x301c53[_0x4349('0x3d')]};return db[_0x4349('0x43')][_0x4349('0x20')](_0x1cd26f)[_0x4349('0x27')](function(_0x59f9ae){_0x4bfbfd[_0x4349('0x20')]=_0x59f9ae;if(_0xcd36d0['query'][_0x4349('0x44')]){_0x301c53[_0x4349('0x45')]=[{'all':!![]}];}return db[_0x4349('0x43')][_0x4349('0x46')](_0x301c53);})[_0x4349('0x27')](function(_0x57098b){_0x4bfbfd[_0x4349('0x47')]=_0x57098b;return _0x4bfbfd;})[_0x4349('0x27')](respondWithFilteredResult(_0x2178a8,_0x301c53))[_0x4349('0x48')](handleError(_0x2178a8,null));};exports[_0x4349('0x49')]=function(_0x2da8ae,_0x550160){var _0x4ee683={'raw':!![],'where':{'id':_0x2da8ae[_0x4349('0x4a')]['id']}},_0x5657cf={};_0x5657cf[_0x4349('0x35')]=_[_0x4349('0x33')](db['FaxApplication'][_0x4349('0x4b')]);_0x5657cf['query']=_['keys'](_0x2da8ae[_0x4349('0x32')]);_0x5657cf[_0x4349('0x3f')]=_['intersection'](_0x5657cf[_0x4349('0x35')],_0x5657cf[_0x4349('0x32')]);_0x4ee683[_0x4349('0x36')]=_[_0x4349('0x34')](_0x5657cf[_0x4349('0x35')],qs[_0x4349('0x37')](_0x2da8ae[_0x4349('0x32')]['fields']));_0x4ee683[_0x4349('0x36')]=_0x4ee683['attributes'][_0x4349('0x38')]?_0x4ee683[_0x4349('0x36')]:_0x5657cf[_0x4349('0x35')];if(_0x2da8ae[_0x4349('0x32')][_0x4349('0x44')]){_0x4ee683[_0x4349('0x45')]=[{'all':!![]}];}_0x4ee683=_[_0x4349('0x42')]({},_0x4ee683,_0x2da8ae[_0x4349('0x4c')]);return db['FaxApplication']['find'](_0x4ee683)[_0x4349('0x27')](handleEntityNotFound(_0x550160,null))[_0x4349('0x27')](respondWithResult(_0x550160,null))[_0x4349('0x48')](handleError(_0x550160,null));};exports[_0x4349('0x4d')]=function(_0x5e8322,_0x198233){return db['FaxApplication'][_0x4349('0x4d')](_0x5e8322['body'],{})[_0x4349('0x27')](respondWithResult(_0x198233,0xc9))['catch'](handleError(_0x198233,null));};exports[_0x4349('0x26')]=function(_0x2f0881,_0x121ac8){if(_0x2f0881['body']['id']){delete _0x2f0881['body']['id'];}return db['FaxApplication'][_0x4349('0x4e')]({'where':{'id':_0x2f0881[_0x4349('0x4a')]['id']}})[_0x4349('0x27')](handleEntityNotFound(_0x121ac8,null))['then'](saveUpdates(_0x2f0881[_0x4349('0x4f')],null))[_0x4349('0x27')](respondWithResult(_0x121ac8,null))['catch'](handleError(_0x121ac8,null));};exports[_0x4349('0x28')]=function(_0x94a0a3,_0x5aeb50){return db[_0x4349('0x43')][_0x4349('0x4e')]({'where':{'id':_0x94a0a3[_0x4349('0x4a')]['id']}})[_0x4349('0x27')](handleEntityNotFound(_0x5aeb50,null))[_0x4349('0x27')](removeEntity(_0x5aeb50,null))[_0x4349('0x48')](handleError(_0x5aeb50,null));}; \ No newline at end of file +var _0x21b9=['moment','bluebird','mustache','util','to-csv','ejs','fs-extra','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','destroy','end','error','stack','name','send','index','map','FaxApplication','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','keys','length','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x40bffc,_0x3a45d7){var _0x3007e9=function(_0x4c8fda){while(--_0x4c8fda){_0x40bffc['push'](_0x40bffc['shift']());}};_0x3007e9(++_0x3a45d7);}(_0x21b9,0x127));var _0x921b=function(_0x1ba87a,_0x1d07c1){_0x1ba87a=_0x1ba87a-0x0;var _0x57b5bc=_0x21b9[_0x1ba87a];return _0x57b5bc;};'use strict';var emlformat=require(_0x921b('0x0'));var rimraf=require(_0x921b('0x1'));var zipdir=require(_0x921b('0x2'));var jsonpatch=require(_0x921b('0x3'));var rp=require(_0x921b('0x4'));var moment=require(_0x921b('0x5'));var BPromise=require(_0x921b('0x6'));var Mustache=require(_0x921b('0x7'));var util=require(_0x921b('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x921b('0x9'));var ejs=require(_0x921b('0xa'));var fs=require('fs');var fs_extra=require(_0x921b('0xb'));var _=require('lodash');var squel=require(_0x921b('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x921b('0xd'));var toCsv=require(_0x921b('0x9'));var querystring=require('querystring');var Papa=require(_0x921b('0xe'));var Redis=require(_0x921b('0xf'));var authService=require(_0x921b('0x10'));var qs=require(_0x921b('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x921b('0x12'));var logger=require(_0x921b('0x13'))('api');var utils=require(_0x921b('0x14'));var config=require(_0x921b('0x15'));var licenseUtil=require(_0x921b('0x16'));var db=require(_0x921b('0x17'))['db'];function respondWithStatusCode(_0x17f5eb,_0x2c815e){_0x2c815e=_0x2c815e||0xcc;return function(_0x1aca2b){if(_0x1aca2b){return _0x17f5eb[_0x921b('0x18')](_0x2c815e);}return _0x17f5eb[_0x921b('0x19')](_0x2c815e)['end']();};}function respondWithResult(_0x5ea569,_0x9711c0){_0x9711c0=_0x9711c0||0xc8;return function(_0x3d132c){if(_0x3d132c){return _0x5ea569['status'](_0x9711c0)[_0x921b('0x1a')](_0x3d132c);}};}function respondWithFilteredResult(_0xe84f0a,_0x254c16){return function(_0x4e26f8){if(_0x4e26f8){var _0x16ff31=typeof _0x254c16[_0x921b('0x1b')]===_0x921b('0x1c')&&typeof _0x254c16[_0x921b('0x1d')]===_0x921b('0x1c');var _0x12cb1d=_0x4e26f8[_0x921b('0x1e')];var _0xc7b5a9=_0x16ff31?0x0:_0x254c16[_0x921b('0x1b')];var _0x16ff88=_0x16ff31?_0x4e26f8[_0x921b('0x1e')]:_0x254c16[_0x921b('0x1b')]+_0x254c16[_0x921b('0x1d')];var _0x270bb0;if(_0x16ff88>=_0x12cb1d){_0x16ff88=_0x12cb1d;_0x270bb0=0xc8;}else{_0x270bb0=0xce;}_0xe84f0a['status'](_0x270bb0);return _0xe84f0a['set'](_0x921b('0x1f'),_0xc7b5a9+'-'+_0x16ff88+'/'+_0x12cb1d)['json'](_0x4e26f8);}return null;};}function patchUpdates(_0x24ab24){return function(_0x37dadd){try{jsonpatch[_0x921b('0x20')](_0x37dadd,_0x24ab24,!![]);}catch(_0x5efb4f){return BPromise['reject'](_0x5efb4f);}return _0x37dadd[_0x921b('0x21')]();};}function saveUpdates(_0xf95beb,_0x12c619){return function(_0xfcecb7){if(_0xfcecb7){return _0xfcecb7[_0x921b('0x22')](_0xf95beb)[_0x921b('0x23')](function(_0x292df3){return _0x292df3;});}return null;};}function removeEntity(_0x4458db,_0x54eed9){return function(_0x514732){if(_0x514732){return _0x514732[_0x921b('0x24')]()[_0x921b('0x23')](function(){_0x4458db[_0x921b('0x19')](0xcc)[_0x921b('0x25')]();});}};}function handleEntityNotFound(_0x4edb81,_0x2f939a){return function(_0x1be99e){if(!_0x1be99e){_0x4edb81[_0x921b('0x18')](0x194);}return _0x1be99e;};}function handleError(_0x5512e,_0x3a78c5){_0x3a78c5=_0x3a78c5||0x1f4;return function(_0x2eb0d3){logger[_0x921b('0x26')](_0x2eb0d3[_0x921b('0x27')]);if(_0x2eb0d3[_0x921b('0x28')]){delete _0x2eb0d3[_0x921b('0x28')];}_0x5512e[_0x921b('0x19')](_0x3a78c5)[_0x921b('0x29')](_0x2eb0d3);};}exports[_0x921b('0x2a')]=function(_0xffb847,_0x1ccdd4){var _0x288574={},_0x3b2885={},_0x123d50={'count':0x0,'rows':[]};var _0x4ec323=_[_0x921b('0x2b')](db[_0x921b('0x2c')][_0x921b('0x2d')],function(_0x20ad4e){return{'name':_0x20ad4e['fieldName'],'type':_0x20ad4e[_0x921b('0x2e')][_0x921b('0x2f')]};});_0x3b2885[_0x921b('0x30')]=_['map'](_0x4ec323,_0x921b('0x28'));_0x3b2885['query']=_['keys'](_0xffb847[_0x921b('0x31')]);_0x3b2885[_0x921b('0x32')]=_[_0x921b('0x33')](_0x3b2885[_0x921b('0x30')],_0x3b2885[_0x921b('0x31')]);_0x288574[_0x921b('0x34')]=_[_0x921b('0x33')](_0x3b2885[_0x921b('0x30')],qs[_0x921b('0x35')](_0xffb847['query'][_0x921b('0x35')]));_0x288574[_0x921b('0x34')]=_0x288574[_0x921b('0x34')]['length']?_0x288574[_0x921b('0x34')]:_0x3b2885[_0x921b('0x30')];if(!_0xffb847['query']['hasOwnProperty'](_0x921b('0x36'))){_0x288574[_0x921b('0x1d')]=qs[_0x921b('0x1d')](_0xffb847[_0x921b('0x31')]['limit']);_0x288574[_0x921b('0x1b')]=qs[_0x921b('0x1b')](_0xffb847[_0x921b('0x31')][_0x921b('0x1b')]);}_0x288574[_0x921b('0x37')]=qs[_0x921b('0x38')](_0xffb847[_0x921b('0x31')]['sort']);_0x288574[_0x921b('0x39')]=qs[_0x921b('0x32')](_[_0x921b('0x3a')](_0xffb847[_0x921b('0x31')],_0x3b2885[_0x921b('0x32')]),_0x4ec323);if(_0xffb847[_0x921b('0x31')][_0x921b('0x3b')]){_0x288574['where']=_['merge'](_0x288574[_0x921b('0x39')],{'$or':_[_0x921b('0x2b')](_0x4ec323,function(_0x2af488){if(_0x2af488['type']!==_0x921b('0x3c')){var _0x679872={};_0x679872[_0x2af488[_0x921b('0x28')]]={'$like':'%'+_0xffb847[_0x921b('0x31')][_0x921b('0x3b')]+'%'};return _0x679872;}})});}_0x288574=_[_0x921b('0x3d')]({},_0x288574,_0xffb847[_0x921b('0x3e')]);var _0x5a7039={'where':_0x288574['where']};return db['FaxApplication'][_0x921b('0x1e')](_0x5a7039)[_0x921b('0x23')](function(_0x3b7e26){_0x123d50['count']=_0x3b7e26;if(_0xffb847[_0x921b('0x31')][_0x921b('0x3f')]){_0x288574[_0x921b('0x40')]=[{'all':!![]}];}return db['FaxApplication'][_0x921b('0x41')](_0x288574);})[_0x921b('0x23')](function(_0xcf5233){_0x123d50[_0x921b('0x42')]=_0xcf5233;return _0x123d50;})['then'](respondWithFilteredResult(_0x1ccdd4,_0x288574))['catch'](handleError(_0x1ccdd4,null));};exports[_0x921b('0x43')]=function(_0x452acf,_0x3d4f66){var _0x379b0a={'raw':!![],'where':{'id':_0x452acf[_0x921b('0x44')]['id']}},_0x28ea3b={};_0x28ea3b['model']=_['keys'](db['FaxApplication'][_0x921b('0x2d')]);_0x28ea3b[_0x921b('0x31')]=_[_0x921b('0x45')](_0x452acf[_0x921b('0x31')]);_0x28ea3b['filters']=_[_0x921b('0x33')](_0x28ea3b[_0x921b('0x30')],_0x28ea3b[_0x921b('0x31')]);_0x379b0a['attributes']=_[_0x921b('0x33')](_0x28ea3b[_0x921b('0x30')],qs[_0x921b('0x35')](_0x452acf[_0x921b('0x31')][_0x921b('0x35')]));_0x379b0a['attributes']=_0x379b0a[_0x921b('0x34')][_0x921b('0x46')]?_0x379b0a['attributes']:_0x28ea3b[_0x921b('0x30')];if(_0x452acf['query']['includeAll']){_0x379b0a[_0x921b('0x40')]=[{'all':!![]}];}_0x379b0a=_[_0x921b('0x3d')]({},_0x379b0a,_0x452acf[_0x921b('0x3e')]);return db[_0x921b('0x2c')][_0x921b('0x47')](_0x379b0a)[_0x921b('0x23')](handleEntityNotFound(_0x3d4f66,null))['then'](respondWithResult(_0x3d4f66,null))[_0x921b('0x48')](handleError(_0x3d4f66,null));};exports['create']=function(_0x14f1f3,_0x4490df){return db[_0x921b('0x2c')][_0x921b('0x49')](_0x14f1f3[_0x921b('0x4a')],{})[_0x921b('0x23')](respondWithResult(_0x4490df,0xc9))[_0x921b('0x48')](handleError(_0x4490df,null));};exports[_0x921b('0x22')]=function(_0x2f8e4d,_0xbe3456){if(_0x2f8e4d[_0x921b('0x4a')]['id']){delete _0x2f8e4d[_0x921b('0x4a')]['id'];}return db[_0x921b('0x2c')][_0x921b('0x47')]({'where':{'id':_0x2f8e4d['params']['id']}})['then'](handleEntityNotFound(_0xbe3456,null))['then'](saveUpdates(_0x2f8e4d[_0x921b('0x4a')],null))[_0x921b('0x23')](respondWithResult(_0xbe3456,null))[_0x921b('0x48')](handleError(_0xbe3456,null));};exports[_0x921b('0x24')]=function(_0x53869b,_0x17262a){return db[_0x921b('0x2c')][_0x921b('0x47')]({'where':{'id':_0x53869b['params']['id']}})['then'](handleEntityNotFound(_0x17262a,null))[_0x921b('0x23')](removeEntity(_0x17262a,null))[_0x921b('0x48')](handleError(_0x17262a,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index f53ca3d..320de2b 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 _0x6d5e=['fax_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxApplication.attributes','define','FaxApplication'];(function(_0x37fa4f,_0x379eb2){var _0x17133f=function(_0x38b3ee){while(--_0x38b3ee){_0x37fa4f['push'](_0x37fa4f['shift']());}};_0x17133f(++_0x379eb2);}(_0x6d5e,0x1a7));var _0xe6d5=function(_0x30b53b,_0x54fb29){_0x30b53b=_0x30b53b-0x0;var _0x499105=_0x6d5e[_0x30b53b];return _0x499105;};'use strict';var _=require(_0xe6d5('0x0'));var util=require(_0xe6d5('0x1'));var logger=require(_0xe6d5('0x2'))('api');var moment=require(_0xe6d5('0x3'));var BPromise=require(_0xe6d5('0x4'));var rp=require(_0xe6d5('0x5'));var fs=require('fs');var path=require(_0xe6d5('0x6'));var rimraf=require(_0xe6d5('0x7'));var config=require(_0xe6d5('0x8'));var attributes=require(_0xe6d5('0x9'));module['exports']=function(_0x5266a7,_0x17927a){return _0x5266a7[_0xe6d5('0xa')](_0xe6d5('0xb'),attributes,{'tableName':_0xe6d5('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe6d5('0xd'),'collate':_0xe6d5('0xe')});}; \ No newline at end of file +var _0x0bee=['rimraf','../../config/environment','./faxApplication.attributes','define','FaxApplication','fax_applications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x317227,_0x1146f8){var _0x1f202d=function(_0x268d58){while(--_0x268d58){_0x317227['push'](_0x317227['shift']());}};_0x1f202d(++_0x1146f8);}(_0x0bee,0xe8));var _0xe0be=function(_0x2a8da1,_0x3ecd35){_0x2a8da1=_0x2a8da1-0x0;var _0x99770c=_0x0bee[_0x2a8da1];return _0x99770c;};'use strict';var _=require('lodash');var util=require(_0xe0be('0x0'));var logger=require(_0xe0be('0x1'))(_0xe0be('0x2'));var moment=require('moment');var BPromise=require(_0xe0be('0x3'));var rp=require(_0xe0be('0x4'));var fs=require('fs');var path=require(_0xe0be('0x5'));var rimraf=require(_0xe0be('0x6'));var config=require(_0xe0be('0x7'));var attributes=require(_0xe0be('0x8'));module['exports']=function(_0x4ec9a1,_0x108e4d){return _0x4ec9a1[_0xe0be('0x9')](_0xe0be('0xa'),attributes,{'tableName':_0xe0be('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xe0be('0xc'),'collate':_0xe0be('0xd')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index 5d6d7d5..07a8e84 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 _0x4841=['options','raw','where','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','FaxApplication,\x20%s,\x20%s','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','UpdateFaxApplication','FaxApplication','update','body'];(function(_0x44e6fd,_0x25a37a){var _0x11e582=function(_0x4a0271){while(--_0x4a0271){_0x44e6fd['push'](_0x44e6fd['shift']());}};_0x11e582(++_0x25a37a);}(_0x4841,0xfc));var _0x1484=function(_0x4279fa,_0xa5ed34){_0x4279fa=_0x4279fa-0x0;var _0x1cd0b6=_0x4841[_0x4279fa];return _0x1cd0b6;};'use strict';var _=require(_0x1484('0x0'));var util=require(_0x1484('0x1'));var moment=require(_0x1484('0x2'));var BPromise=require(_0x1484('0x3'));var rs=require(_0x1484('0x4'));var fs=require('fs');var Redis=require(_0x1484('0x5'));var db=require(_0x1484('0x6'))['db'];var utils=require(_0x1484('0x7'));var logger=require(_0x1484('0x8'))(_0x1484('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x1484('0xa')][_0x1484('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x480e4a,_0x1acbc4,_0x2e0d64){return new BPromise(function(_0x1437bb,_0x20e979){return client[_0x1484('0xc')](_0x480e4a,_0x2e0d64)[_0x1484('0xd')](function(_0x3f000d){logger[_0x1484('0xe')](_0x1484('0xf'),_0x1acbc4,'request\x20sent');logger['debug'](_0x1484('0x10'),_0x1acbc4,'request\x20sent',JSON[_0x1484('0x11')](_0x3f000d));if(_0x3f000d[_0x1484('0x12')]){if(_0x3f000d[_0x1484('0x12')][_0x1484('0x13')]===0x1f4){logger[_0x1484('0x12')](_0x1484('0xf'),_0x1acbc4,_0x3f000d[_0x1484('0x12')][_0x1484('0x14')]);return _0x20e979(_0x3f000d[_0x1484('0x12')][_0x1484('0x14')]);}logger[_0x1484('0x12')](_0x1484('0xf'),_0x1acbc4,_0x3f000d[_0x1484('0x12')][_0x1484('0x14')]);return _0x1437bb(_0x3f000d[_0x1484('0x12')][_0x1484('0x14')]);}else{logger[_0x1484('0xe')]('FaxApplication,\x20%s,\x20%s',_0x1acbc4,_0x1484('0x15'));_0x1437bb(_0x3f000d['result']['message']);}})[_0x1484('0x16')](function(_0x530245){logger[_0x1484('0x12')](_0x1484('0xf'),_0x1acbc4,_0x530245);_0x20e979(_0x530245);});});}exports[_0x1484('0x17')]=function(_0x23dd1a){var _0x389f5f=this;return new Promise(function(_0x53ed40,_0x24c744){return db[_0x1484('0x18')][_0x1484('0x19')](_0x23dd1a[_0x1484('0x1a')],{'raw':_0x23dd1a[_0x1484('0x1b')]?_0x23dd1a[_0x1484('0x1b')][_0x1484('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x23dd1a[_0x1484('0x1b')]?_0x23dd1a[_0x1484('0x1b')][_0x1484('0x1d')]||null:null,'attributes':_0x23dd1a['options']?_0x23dd1a['options']['attributes']||null:null,'limit':_0x23dd1a['options']?_0x23dd1a[_0x1484('0x1b')][_0x1484('0x1e')]||null:null})[_0x1484('0xd')](function(_0x22c925){logger[_0x1484('0xe')](_0x1484('0x17'),_0x23dd1a);logger['debug']('UpdateFaxApplication',_0x23dd1a,JSON['stringify'](_0x22c925));_0x53ed40(_0x22c925);})[_0x1484('0x16')](function(_0x7e6a69){logger['error'](_0x1484('0x17'),_0x7e6a69[_0x1484('0x14')],_0x23dd1a);_0x24c744(_0x389f5f['error'](0x1f4,_0x7e6a69['message']));});});}; \ No newline at end of file +var _0x2fda=['randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','request','then','info','FaxApplication,\x20%s,\x20%s','request\x20sent','error','message','result','UpdateFaxApplication','FaxApplication','update','body','options','raw','where','attributes','limit','debug','stringify','catch','lodash','bluebird'];(function(_0x69ab24,_0x372e47){var _0x106e55=function(_0xbdda13){while(--_0xbdda13){_0x69ab24['push'](_0x69ab24['shift']());}};_0x106e55(++_0x372e47);}(_0x2fda,0x186));var _0xa2fd=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0x2fda[_0x54d4fe];return _0x1ab5bb;};'use strict';var _=require(_0xa2fd('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xa2fd('0x1'));var rs=require(_0xa2fd('0x2'));var fs=require('fs');var Redis=require(_0xa2fd('0x3'));var db=require(_0xa2fd('0x4'))['db'];var utils=require(_0xa2fd('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xa2fd('0x6'));var client=jayson[_0xa2fd('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x11994b,_0x2058d3,_0x290063){return new BPromise(function(_0x4abb3a,_0x213134){return client[_0xa2fd('0x8')](_0x11994b,_0x290063)[_0xa2fd('0x9')](function(_0x2683fc){logger[_0xa2fd('0xa')](_0xa2fd('0xb'),_0x2058d3,'request\x20sent');logger['debug']('FaxApplication,\x20%s,\x20%s,\x20%s',_0x2058d3,_0xa2fd('0xc'),JSON['stringify'](_0x2683fc));if(_0x2683fc[_0xa2fd('0xd')]){if(_0x2683fc[_0xa2fd('0xd')]['code']===0x1f4){logger['error'](_0xa2fd('0xb'),_0x2058d3,_0x2683fc[_0xa2fd('0xd')][_0xa2fd('0xe')]);return _0x213134(_0x2683fc[_0xa2fd('0xd')][_0xa2fd('0xe')]);}logger[_0xa2fd('0xd')]('FaxApplication,\x20%s,\x20%s',_0x2058d3,_0x2683fc['error'][_0xa2fd('0xe')]);return _0x4abb3a(_0x2683fc['error'][_0xa2fd('0xe')]);}else{logger['info'](_0xa2fd('0xb'),_0x2058d3,_0xa2fd('0xc'));_0x4abb3a(_0x2683fc[_0xa2fd('0xf')][_0xa2fd('0xe')]);}})['catch'](function(_0x1a64a4){logger[_0xa2fd('0xd')](_0xa2fd('0xb'),_0x2058d3,_0x1a64a4);_0x213134(_0x1a64a4);});});}exports[_0xa2fd('0x10')]=function(_0x39f7b2){var _0x5c0697=this;return new Promise(function(_0x466df1,_0x22a3aa){return db[_0xa2fd('0x11')][_0xa2fd('0x12')](_0x39f7b2[_0xa2fd('0x13')],{'raw':_0x39f7b2[_0xa2fd('0x14')]?_0x39f7b2[_0xa2fd('0x14')][_0xa2fd('0x15')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x39f7b2[_0xa2fd('0x14')]?_0x39f7b2[_0xa2fd('0x14')][_0xa2fd('0x16')]||null:null,'attributes':_0x39f7b2['options']?_0x39f7b2[_0xa2fd('0x14')][_0xa2fd('0x17')]||null:null,'limit':_0x39f7b2[_0xa2fd('0x14')]?_0x39f7b2[_0xa2fd('0x14')][_0xa2fd('0x18')]||null:null})['then'](function(_0x40e0f8){logger[_0xa2fd('0xa')](_0xa2fd('0x10'),_0x39f7b2);logger[_0xa2fd('0x19')](_0xa2fd('0x10'),_0x39f7b2,JSON[_0xa2fd('0x1a')](_0x40e0f8));_0x466df1(_0x40e0f8);})[_0xa2fd('0x1b')](function(_0x1cf9e3){logger[_0xa2fd('0xd')]('UpdateFaxApplication',_0x1cf9e3[_0xa2fd('0xe')],_0x39f7b2);_0x22a3aa(_0x5c0697[_0xa2fd('0xd')](0x1f4,_0x1cf9e3[_0xa2fd('0xe')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index ff6ca36..127f06c 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 _0x9c00=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxApplication.controller','get','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer','util'];(function(_0x4ccc24,_0x53a1f9){var _0x4066f6=function(_0x514e96){while(--_0x514e96){_0x4ccc24['push'](_0x4ccc24['shift']());}};_0x4066f6(++_0x53a1f9);}(_0x9c00,0x1a0));var _0x09c0=function(_0x38b297,_0x27dcd0){_0x38b297=_0x38b297-0x0;var _0x5e8157=_0x9c00[_0x38b297];return _0x5e8157;};'use strict';var multer=require(_0x09c0('0x0'));var util=require(_0x09c0('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x09c0('0x2'));var router=express[_0x09c0('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x09c0('0x4'));var interaction=require(_0x09c0('0x5'));var config=require(_0x09c0('0x6'));var controller=require(_0x09c0('0x7'));router[_0x09c0('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x09c0('0x8')](_0x09c0('0x9'),auth[_0x09c0('0xa')](),controller[_0x09c0('0xb')]);router[_0x09c0('0xc')]('/',auth['isAuthenticated'](),controller[_0x09c0('0xd')]);router[_0x09c0('0xe')](_0x09c0('0x9'),auth[_0x09c0('0xa')](),controller[_0x09c0('0xf')]);router[_0x09c0('0x10')](_0x09c0('0x9'),auth[_0x09c0('0xa')](),controller[_0x09c0('0x11')]);module[_0x09c0('0x12')]=router; \ No newline at end of file +var _0x8603=['../../components/interaction/service','./faxApplication.controller','isAuthenticated','index','get','/:id','create','put','update','exports','util','path','connect-timeout','fs-extra','../../components/auth/service'];(function(_0x17406e,_0x1049fd){var _0x2bfc5a=function(_0x2aae05){while(--_0x2aae05){_0x17406e['push'](_0x17406e['shift']());}};_0x2bfc5a(++_0x1049fd);}(_0x8603,0x190));var _0x3860=function(_0x9ea38c,_0x9d044c){_0x9ea38c=_0x9ea38c-0x0;var _0x2db088=_0x8603[_0x9ea38c];return _0x2db088;};'use strict';var multer=require('multer');var util=require(_0x3860('0x0'));var path=require(_0x3860('0x1'));var timeout=require(_0x3860('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x3860('0x3'));var auth=require(_0x3860('0x4'));var interaction=require(_0x3860('0x5'));var config=require('../../config/environment');var controller=require(_0x3860('0x6'));router['get']('/',auth[_0x3860('0x7')](),controller[_0x3860('0x8')]);router[_0x3860('0x9')](_0x3860('0xa'),auth[_0x3860('0x7')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x3860('0xb')]);router[_0x3860('0xc')]('/:id',auth[_0x3860('0x7')](),controller[_0x3860('0xd')]);router['delete'](_0x3860('0xa'),auth[_0x3860('0x7')](),controller['destroy']);module[_0x3860('0xe')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index 168c88f..7ec5183 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 _0x7b84=['STRING','ENUM','out','INTEGER','sequelize','exports','BOOLEAN','DATE'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0x7b84,0x17c));var _0x47b8=function(_0x3dac43,_0x181d1f){_0x3dac43=_0x3dac43-0x0;var _0x252919=_0x7b84[_0x3dac43];return _0x252919;};'use strict';var Sequelize=require(_0x47b8('0x0'));module[_0x47b8('0x1')]={'closed':{'type':Sequelize[_0x47b8('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x47b8('0x3')]},'disposition':{'type':Sequelize[_0x47b8('0x4')]},'secondDisposition':{'type':Sequelize[_0x47b8('0x4')]},'thirdDisposition':{'type':Sequelize[_0x47b8('0x4')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x47b8('0x3')]},'fax':{'type':Sequelize[_0x47b8('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x47b8('0x5')]('in',_0x47b8('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x47b8('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x47b8('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'queueId':{'type':Sequelize[_0x47b8('0x7')]}}; \ No newline at end of file +var _0xacf4=['ENUM','out','INTEGER','BOOLEAN','DATE','STRING'];(function(_0x42695c,_0xf045c6){var _0x3482c6=function(_0x15176f){while(--_0x15176f){_0x42695c['push'](_0x42695c['shift']());}};_0x3482c6(++_0xf045c6);}(_0xacf4,0xe7));var _0x4acf=function(_0x946ca8,_0x1c580f){_0x946ca8=_0x946ca8-0x0;var _0x13bc4d=_0xacf4[_0x946ca8];return _0x13bc4d;};'use strict';var Sequelize=require('sequelize');module['exports']={'closed':{'type':Sequelize[_0x4acf('0x0')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x4acf('0x1')]},'disposition':{'type':Sequelize[_0x4acf('0x2')]},'secondDisposition':{'type':Sequelize[_0x4acf('0x2')]},'thirdDisposition':{'type':Sequelize[_0x4acf('0x2')]},'note':{'type':Sequelize[_0x4acf('0x2')]},'read1stAt':{'type':Sequelize[_0x4acf('0x1')]},'fax':{'type':Sequelize['STRING']},'firstMsgDirection':{'type':Sequelize[_0x4acf('0x3')]('in',_0x4acf('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x4acf('0x3')]('in',_0x4acf('0x4')),'defaultValue':'in','allowNull':![]},'queueId':{'type':Sequelize[_0x4acf('0x5')]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index 580d6ef..b6c0b4a 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 _0xb6b7=['../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','localhost','./faxInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','destroy','then','stack','name','send','index','map','FaxInteraction','rawAttributes','fieldName','key','getOptions','findAll','fax','query','user','catch','show','params','model','filters','intersection','attributes','fields','length','includeAll','include','options','find','create','body','update','describe','addMessage','FaxMessage','omit','ids','getMessages','findOne','keys','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','count','rows','addTags','setTags','spread','Tag','color','emit','removeTags','download','toString','join','files','root','attachments','push','Attachment','Messages','createdAt','mkdirSync','existsSync','createReadStream','pipe','resolve','log','unlinkSync','rimraf','zip-dir','moment','bluebird','util','path','ioredis'];(function(_0x356ae7,_0x579015){var _0x3751dd=function(_0x53b707){while(--_0x53b707){_0x356ae7['push'](_0x356ae7['shift']());}};_0x3751dd(++_0x579015);}(_0xb6b7,0xc7));var _0x7b6b=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xb6b7[_0x2dafbe];return _0x58a45a;};'use strict';var rimraf=require(_0x7b6b('0x0'));var zipdir=require(_0x7b6b('0x1'));var moment=require(_0x7b6b('0x2'));var BPromise=require(_0x7b6b('0x3'));var util=require(_0x7b6b('0x4'));var path=require(_0x7b6b('0x5'));var fs=require('fs');var _=require('lodash');var Redis=require(_0x7b6b('0x6'));var interaction=require(_0x7b6b('0x7'));var qs=require(_0x7b6b('0x8'));var logger=require(_0x7b6b('0x9'))(_0x7b6b('0xa'));var config=require('../../config/environment');var db=require(_0x7b6b('0xb'))['db'];config[_0x7b6b('0xc')]=_['defaults'](config[_0x7b6b('0xc')],{'host':_0x7b6b('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7b6b('0xc')]));require(_0x7b6b('0xe'))[_0x7b6b('0xf')](socket);function respondWithStatusCode(_0x316e61,_0x53ca6e){_0x53ca6e=_0x53ca6e||0xcc;return function(_0x3c3f8c){if(_0x3c3f8c){return _0x316e61[_0x7b6b('0x10')](_0x53ca6e);}return _0x316e61[_0x7b6b('0x11')](_0x53ca6e)[_0x7b6b('0x12')]();};}function respondWithResult(_0x19c887,_0x1245f7){_0x1245f7=_0x1245f7||0xc8;return function(_0x37195f){if(_0x37195f){return _0x19c887['status'](_0x1245f7)[_0x7b6b('0x13')](_0x37195f);}};}function respondWithFilteredResult(_0x2228a4,_0x342a3f){return function(_0x60e17){if(_0x60e17){var _0x5b4540=typeof _0x342a3f[_0x7b6b('0x14')]===_0x7b6b('0x15')&&typeof _0x342a3f['limit']==='undefined';var _0x2f47b9=_0x60e17['count'];var _0x455a8a=_0x5b4540?0x0:_0x342a3f[_0x7b6b('0x14')];var _0x5b9846=_0x5b4540?_0x60e17['count']:_0x342a3f[_0x7b6b('0x14')]+_0x342a3f[_0x7b6b('0x16')];var _0x3d0584;if(_0x5b9846>=_0x2f47b9){_0x5b9846=_0x2f47b9;_0x3d0584=0xc8;}else{_0x3d0584=0xce;}_0x2228a4[_0x7b6b('0x11')](_0x3d0584);return _0x2228a4[_0x7b6b('0x17')](_0x7b6b('0x18'),_0x455a8a+'-'+_0x5b9846+'/'+_0x2f47b9)[_0x7b6b('0x13')](_0x60e17);}return null;};}function saveUpdates(_0x5bfc0d){return function(_0x546484){if(_0x546484){return _0x546484['update'](_0x5bfc0d)['then'](function(_0x430dbb){return _0x430dbb;});}return null;};}function removeEntity(_0x11b4d4){return function(_0x2e53a2){if(_0x2e53a2){return _0x2e53a2[_0x7b6b('0x19')]()[_0x7b6b('0x1a')](function(){_0x11b4d4[_0x7b6b('0x11')](0xcc)[_0x7b6b('0x12')]();});}};}function handleEntityNotFound(_0x58541c){return function(_0x35b402){if(!_0x35b402){_0x58541c[_0x7b6b('0x10')](0x194);}return _0x35b402;};}function handleError(_0x479192,_0x3176e6){_0x3176e6=_0x3176e6||0x1f4;return function(_0x1d1907){logger['error'](_0x1d1907[_0x7b6b('0x1b')]);if(_0x1d1907[_0x7b6b('0x1c')]){delete _0x1d1907[_0x7b6b('0x1c')];}_0x479192[_0x7b6b('0x11')](_0x3176e6)[_0x7b6b('0x1d')](_0x1d1907);};}exports[_0x7b6b('0x1e')]=function(_0x56ee7a,_0x5436ef){var _0x292512={};var _0x3c58df=_[_0x7b6b('0x1f')](db[_0x7b6b('0x20')][_0x7b6b('0x21')],function(_0x3c3374){return{'name':_0x3c3374[_0x7b6b('0x22')],'type':_0x3c3374['type'][_0x7b6b('0x23')]};});_0x292512=qs[_0x7b6b('0x24')](_0x3c58df,_0x56ee7a);return interaction[_0x7b6b('0x25')](_0x7b6b('0x26'),_0x56ee7a[_0x7b6b('0x27')],_0x56ee7a[_0x7b6b('0x28')],_0x292512,_0x3c58df)['then'](respondWithFilteredResult(_0x5436ef,_0x292512))[_0x7b6b('0x29')](handleError(_0x5436ef,null));};exports[_0x7b6b('0x2a')]=function(_0x268e19,_0x4a441f){var _0x56464d={'raw':![],'where':{'id':_0x268e19[_0x7b6b('0x2b')]['id']}},_0x59debc={};_0x59debc[_0x7b6b('0x2c')]=_['keys'](db['FaxInteraction']['rawAttributes']);_0x59debc[_0x7b6b('0x27')]=_['keys'](_0x268e19[_0x7b6b('0x27')]);_0x59debc[_0x7b6b('0x2d')]=_[_0x7b6b('0x2e')](_0x59debc[_0x7b6b('0x2c')],_0x59debc[_0x7b6b('0x27')]);_0x56464d[_0x7b6b('0x2f')]=_[_0x7b6b('0x2e')](_0x59debc['model'],qs[_0x7b6b('0x30')](_0x268e19[_0x7b6b('0x27')][_0x7b6b('0x30')]));_0x56464d[_0x7b6b('0x2f')]=_0x56464d[_0x7b6b('0x2f')][_0x7b6b('0x31')]?_0x56464d[_0x7b6b('0x2f')]:_0x59debc[_0x7b6b('0x2c')];if(_0x268e19[_0x7b6b('0x27')][_0x7b6b('0x32')]){_0x56464d[_0x7b6b('0x33')]=[{'all':!![]}];}_0x56464d=_['merge']({},_0x56464d,_0x268e19[_0x7b6b('0x34')]);return db[_0x7b6b('0x20')][_0x7b6b('0x35')](_0x56464d)[_0x7b6b('0x1a')](handleEntityNotFound(_0x4a441f,null))['then'](respondWithResult(_0x4a441f,null))[_0x7b6b('0x29')](handleError(_0x4a441f,null));};exports[_0x7b6b('0x36')]=function(_0x4fded2,_0x39855a){return db[_0x7b6b('0x20')][_0x7b6b('0x36')](_0x4fded2[_0x7b6b('0x37')],{})[_0x7b6b('0x1a')](respondWithResult(_0x39855a,0xc9))['catch'](handleError(_0x39855a,null));};exports[_0x7b6b('0x38')]=function(_0x8e848d,_0x2b17dd){if(_0x8e848d['body']['id']){delete _0x8e848d[_0x7b6b('0x37')]['id'];}return db[_0x7b6b('0x20')]['find']({'where':{'id':_0x8e848d[_0x7b6b('0x2b')]['id']}})[_0x7b6b('0x1a')](handleEntityNotFound(_0x2b17dd,null))[_0x7b6b('0x1a')](saveUpdates(_0x8e848d['body'],null))[_0x7b6b('0x1a')](respondWithResult(_0x2b17dd,null))[_0x7b6b('0x29')](handleError(_0x2b17dd,null));};exports[_0x7b6b('0x19')]=function(_0x41eec8,_0x2def88){return db[_0x7b6b('0x20')][_0x7b6b('0x35')]({'where':{'id':_0x41eec8[_0x7b6b('0x2b')]['id']}})[_0x7b6b('0x1a')](handleEntityNotFound(_0x2def88,null))[_0x7b6b('0x1a')](removeEntity(_0x2def88,null))[_0x7b6b('0x29')](handleError(_0x2def88,null));};exports[_0x7b6b('0x39')]=function(_0x353d5d,_0x121be7){return db[_0x7b6b('0x20')][_0x7b6b('0x39')]()[_0x7b6b('0x1a')](respondWithResult(_0x121be7,null))['catch'](handleError(_0x121be7,null));};exports[_0x7b6b('0x3a')]=function(_0x24811b,_0x1e8215){return db[_0x7b6b('0x3b')][_0x7b6b('0x35')]({'where':{'id':_0x24811b[_0x7b6b('0x2b')]['id']}})['then'](handleEntityNotFound(_0x1e8215,null))['then'](function(_0x2f14bf){if(_0x2f14bf){return _0x2f14bf[_0x7b6b('0x3a')](_0x24811b[_0x7b6b('0x37')]['ids'],_[_0x7b6b('0x3c')](_0x24811b[_0x7b6b('0x37')],[_0x7b6b('0x3d'),'id'])||{});}})[_0x7b6b('0x1a')](respondWithResult(_0x1e8215,null))[_0x7b6b('0x29')](handleError(_0x1e8215,null));};exports[_0x7b6b('0x3e')]=function(_0x25969c,_0x35b797){var _0x307fbc={'raw':![],'where':{}};var _0x3ce1a1={};var _0x5df530={'count':0x0,'rows':[]};return db[_0x7b6b('0x20')][_0x7b6b('0x3f')]({'where':{'id':_0x25969c[_0x7b6b('0x2b')]['id']}})['then'](handleEntityNotFound(_0x35b797,null))[_0x7b6b('0x1a')](function(_0x3f9367){if(_0x3f9367){_0x3ce1a1[_0x7b6b('0x2c')]=_['keys'](db['FaxMessage'][_0x7b6b('0x21')]);_0x3ce1a1[_0x7b6b('0x27')]=_[_0x7b6b('0x40')](_0x25969c[_0x7b6b('0x27')]);_0x3ce1a1['filters']=_[_0x7b6b('0x2e')](_0x3ce1a1[_0x7b6b('0x2c')],_0x3ce1a1['query']);_0x307fbc[_0x7b6b('0x2f')]=_[_0x7b6b('0x2e')](_0x3ce1a1[_0x7b6b('0x2c')],qs[_0x7b6b('0x30')](_0x25969c[_0x7b6b('0x27')][_0x7b6b('0x30')]));_0x307fbc[_0x7b6b('0x2f')]=_0x307fbc[_0x7b6b('0x2f')][_0x7b6b('0x31')]?_0x307fbc[_0x7b6b('0x2f')]:_0x3ce1a1[_0x7b6b('0x2c')];if(!_0x25969c[_0x7b6b('0x27')][_0x7b6b('0x41')](_0x7b6b('0x42'))){_0x307fbc[_0x7b6b('0x16')]=qs[_0x7b6b('0x16')](_0x25969c['query'][_0x7b6b('0x16')]);_0x307fbc['offset']=qs[_0x7b6b('0x14')](_0x25969c[_0x7b6b('0x27')][_0x7b6b('0x14')]);}_0x307fbc[_0x7b6b('0x43')]=qs[_0x7b6b('0x44')](_0x25969c[_0x7b6b('0x27')]['sort']);_0x307fbc[_0x7b6b('0x45')]=qs['filters'](_[_0x7b6b('0x46')](_0x25969c[_0x7b6b('0x27')],_0x3ce1a1[_0x7b6b('0x2d')]));_0x307fbc[_0x7b6b('0x45')]['FaxInteractionId']=_0x3f9367['id'];if(_0x25969c[_0x7b6b('0x27')][_0x7b6b('0x47')]){_0x307fbc[_0x7b6b('0x45')]=_[_0x7b6b('0x48')](_0x307fbc['where'],{'$or':_[_0x7b6b('0x1f')](_0x307fbc['attributes'],function(_0x2c7ee1){var _0x796ced={};_0x796ced[_0x2c7ee1]={'$like':'%'+_0x25969c['query'][_0x7b6b('0x47')]+'%'};return _0x796ced;})});}if(_0x25969c[_0x7b6b('0x27')]['$gte']){var _0x478aa5=_0x25969c[_0x7b6b('0x27')][_0x7b6b('0x49')][_0x7b6b('0x4a')](',');var _0x162144={};_0x162144[_0x478aa5[0x0]]={'$gte':moment(_0x478aa5[0x1])[_0x7b6b('0x4b')](_0x7b6b('0x4c'))};_0x307fbc[_0x7b6b('0x45')]=_[_0x7b6b('0x48')](_0x307fbc[_0x7b6b('0x45')],_0x162144);}_0x307fbc=_['merge']({},_0x307fbc,_0x25969c[_0x7b6b('0x34')]);return db[_0x7b6b('0x3b')][_0x7b6b('0x4d')]({'where':_0x307fbc[_0x7b6b('0x45')]})[_0x7b6b('0x1a')](function(_0x472af2){_0x5df530[_0x7b6b('0x4d')]=_0x472af2;if(_0x25969c[_0x7b6b('0x27')]['includeAll']){_0x307fbc[_0x7b6b('0x33')]=[{'all':!![]}];}return db[_0x7b6b('0x3b')][_0x7b6b('0x25')](_0x307fbc);})[_0x7b6b('0x1a')](function(_0x5703e4){_0x5df530[_0x7b6b('0x4e')]=_0x5703e4;return _0x5df530;});}})['then'](respondWithFilteredResult(_0x35b797,_0x307fbc))[_0x7b6b('0x29')](handleError(_0x35b797,null));};exports[_0x7b6b('0x4f')]=function(_0x17d0c7,_0x345cf8){return db[_0x7b6b('0x20')][_0x7b6b('0x35')]({'where':{'id':_0x17d0c7[_0x7b6b('0x2b')]['id']}})[_0x7b6b('0x1a')](handleEntityNotFound(_0x345cf8,null))['then'](function(_0x5085c8){if(_0x5085c8){return _0x5085c8[_0x7b6b('0x50')](_0x17d0c7[_0x7b6b('0x37')][_0x7b6b('0x3d')],_[_0x7b6b('0x3c')](_0x17d0c7[_0x7b6b('0x37')],[_0x7b6b('0x3d'),'id'])||{})[_0x7b6b('0x51')](function(){return db[_0x7b6b('0x52')]['findAll']({'attributes':['id',_0x7b6b('0x1c'),_0x7b6b('0x53')],'where':{'id':_0x17d0c7[_0x7b6b('0x37')][_0x7b6b('0x3d')]}});})[_0x7b6b('0x1a')](function(_0x2fba7b){socket[_0x7b6b('0x54')]('faxInteractionTags:save',{'id':Number(_0x17d0c7[_0x7b6b('0x2b')]['id']),'tags':_0x2fba7b||[]});return{'id':Number(_0x17d0c7[_0x7b6b('0x2b')]['id']),'tags':_0x2fba7b||[]};});}})['then'](respondWithResult(_0x345cf8,null))[_0x7b6b('0x29')](handleError(_0x345cf8,null));};exports[_0x7b6b('0x55')]=function(_0x674571,_0xb08816){return db[_0x7b6b('0x20')]['find']({'where':{'id':_0x674571['params']['id']}})['then'](handleEntityNotFound(_0xb08816,null))[_0x7b6b('0x1a')](function(_0x22db74){if(_0x22db74){return _0x22db74[_0x7b6b('0x55')](_0x674571['query']['ids']);}})['then'](respondWithStatusCode(_0xb08816,null))[_0x7b6b('0x29')](handleError(_0xb08816,null));};exports[_0x7b6b('0x56')]=function(_0x4a7845,_0x1c96b7){var _0x1f20d0=moment()['unix']()[_0x7b6b('0x57')]();var _0x5af7ca=path[_0x7b6b('0x58')](config['root'],'server',_0x7b6b('0x59'),'tmp');var _0x217e36=path['join'](config[_0x7b6b('0x5a')],'server',_0x7b6b('0x59'),_0x7b6b('0x5b'));var _0x382622=path['join'](_0x5af7ca,_0x1f20d0);var _0x5d8c38=util[_0x7b6b('0x4b')]('transcript-%d-%s.zip',_0x4a7845['params']['id'],_0x1f20d0);var _0x10cb05=path[_0x7b6b('0x58')](_0x5af7ca,_0x5d8c38);var _0x111dc8=[];_0x111dc8[_0x7b6b('0x5c')]({'model':db[_0x7b6b('0x5d')],'as':'Attachment','raw':!![]});var _0x48085e=[{'model':db[_0x7b6b('0x3b')],'as':_0x7b6b('0x5e'),'attributes':['id',_0x7b6b('0x37'),_0x7b6b('0x5f')],'include':_0x111dc8}];return db[_0x7b6b('0x20')][_0x7b6b('0x35')]({'where':{'id':_0x4a7845[_0x7b6b('0x2b')]['id']},'include':_0x48085e})[_0x7b6b('0x1a')](handleEntityNotFound(_0x1c96b7,null))[_0x7b6b('0x1a')](function(_0x1fd01f){if(_0x1fd01f&&_0x1fd01f[_0x7b6b('0x5e')]){var _0x487315=_0x1fd01f['get']({'plain':!![]});fs[_0x7b6b('0x60')](_0x382622);for(var _0x2bc22d=0x0;_0x2bc22d<_0x487315[_0x7b6b('0x5e')][_0x7b6b('0x31')];_0x2bc22d++){var _0x1f26d4=_0x487315[_0x7b6b('0x5e')][_0x2bc22d][_0x7b6b('0x5d')];if(_0x1f26d4){var _0x5b1188=path['join'](_0x217e36,_0x1f26d4['basename']);if(fs[_0x7b6b('0x61')](_0x5b1188)){fs[_0x7b6b('0x62')](_0x5b1188)[_0x7b6b('0x63')](fs['createWriteStream'](path[_0x7b6b('0x58')](_0x382622,_0x1f26d4['basename'])));}}}return BPromise[_0x7b6b('0x64')]()[_0x7b6b('0x1a')](function(){return new BPromise(function(_0x3d1d79,_0x501772){zipdir(_0x382622,{'saveTo':_0x10cb05},function(_0x2a269c,_0x13b4fe){if(_0x2a269c)return _0x501772(_0x2a269c);return _0x3d1d79(_0x13b4fe);});})[_0x7b6b('0x1a')](function(){return new BPromise(function(_0x52dbdc,_0x3254bf){rimraf(_0x382622,function(_0x4b68c2){if(_0x4b68c2)_0x3254bf(_0x4b68c2);return _0x52dbdc();});});})[_0x7b6b('0x1a')](function(){return _0x1c96b7[_0x7b6b('0x56')](_0x10cb05,_0x5d8c38,function(_0x2e338f){if(_0x2e338f){console[_0x7b6b('0x65')]('err',_0x2e338f);}else{fs[_0x7b6b('0x66')](_0x10cb05);}});});});}else{return _0x1c96b7[_0x7b6b('0x10')](0xc8);}})[_0x7b6b('0x29')](handleError(_0x1c96b7,null));}; \ No newline at end of file +var _0x62d3=['filter','$gte','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','rows','setTags','ids','omit','spread','emit','removeTags','join','server','files','root','attachments','transcript-%d-%s.zip','Attachment','Messages','createdAt','get','mkdirSync','length','basename','createReadStream','pipe','resolve','download','log','unlinkSync','rimraf','zip-dir','bluebird','util','lodash','ioredis','../../components/interaction/service','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','./faxInteraction.socket','register','sendStatus','end','json','undefined','limit','count','status','set','Content-Range','update','then','error','stack','name','send','map','FaxInteraction','rawAttributes','fieldName','type','key','findAll','query','user','show','params','model','keys','intersection','attributes','fields','include','merge','options','find','catch','create','body','describe','FaxMessage','addMessage','getMessages','findOne','filters','hasOwnProperty','nolimit','offset','where','pick','FaxInteractionId'];(function(_0x328b1c,_0xec0b4f){var _0x4dbeaa=function(_0x432519){while(--_0x432519){_0x328b1c['push'](_0x328b1c['shift']());}};_0x4dbeaa(++_0xec0b4f);}(_0x62d3,0x7f));var _0x362d=function(_0x59b18a,_0x16e8a6){_0x59b18a=_0x59b18a-0x0;var _0x50ffe3=_0x62d3[_0x59b18a];return _0x50ffe3;};'use strict';var rimraf=require(_0x362d('0x0'));var zipdir=require(_0x362d('0x1'));var moment=require('moment');var BPromise=require(_0x362d('0x2'));var util=require(_0x362d('0x3'));var path=require('path');var fs=require('fs');var _=require(_0x362d('0x4'));var Redis=require(_0x362d('0x5'));var interaction=require(_0x362d('0x6'));var qs=require('../../components/parsers/qs');var logger=require(_0x362d('0x7'))(_0x362d('0x8'));var config=require(_0x362d('0x9'));var db=require(_0x362d('0xa'))['db'];config[_0x362d('0xb')]=_[_0x362d('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x362d('0xb')]));require(_0x362d('0xd'))[_0x362d('0xe')](socket);function respondWithStatusCode(_0x49e50d,_0xc5fa27){_0xc5fa27=_0xc5fa27||0xcc;return function(_0x42e93e){if(_0x42e93e){return _0x49e50d[_0x362d('0xf')](_0xc5fa27);}return _0x49e50d['status'](_0xc5fa27)[_0x362d('0x10')]();};}function respondWithResult(_0x2691ab,_0x201d35){_0x201d35=_0x201d35||0xc8;return function(_0x23788b){if(_0x23788b){return _0x2691ab['status'](_0x201d35)[_0x362d('0x11')](_0x23788b);}};}function respondWithFilteredResult(_0x5da767,_0x305811){return function(_0x1d6a24){if(_0x1d6a24){var _0x1da3ff=typeof _0x305811['offset']===_0x362d('0x12')&&typeof _0x305811[_0x362d('0x13')]===_0x362d('0x12');var _0x2c6a84=_0x1d6a24[_0x362d('0x14')];var _0x29a476=_0x1da3ff?0x0:_0x305811['offset'];var _0x457a88=_0x1da3ff?_0x1d6a24[_0x362d('0x14')]:_0x305811['offset']+_0x305811['limit'];var _0x38090f;if(_0x457a88>=_0x2c6a84){_0x457a88=_0x2c6a84;_0x38090f=0xc8;}else{_0x38090f=0xce;}_0x5da767[_0x362d('0x15')](_0x38090f);return _0x5da767[_0x362d('0x16')](_0x362d('0x17'),_0x29a476+'-'+_0x457a88+'/'+_0x2c6a84)[_0x362d('0x11')](_0x1d6a24);}return null;};}function saveUpdates(_0x2053fb){return function(_0x145220){if(_0x145220){return _0x145220[_0x362d('0x18')](_0x2053fb)[_0x362d('0x19')](function(_0x234450){return _0x234450;});}return null;};}function removeEntity(_0x1e0ef8){return function(_0x324d60){if(_0x324d60){return _0x324d60['destroy']()[_0x362d('0x19')](function(){_0x1e0ef8[_0x362d('0x15')](0xcc)[_0x362d('0x10')]();});}};}function handleEntityNotFound(_0x3f3553){return function(_0x12ba1d){if(!_0x12ba1d){_0x3f3553[_0x362d('0xf')](0x194);}return _0x12ba1d;};}function handleError(_0x157b47,_0x1a2c43){_0x1a2c43=_0x1a2c43||0x1f4;return function(_0x35117a){logger[_0x362d('0x1a')](_0x35117a[_0x362d('0x1b')]);if(_0x35117a[_0x362d('0x1c')]){delete _0x35117a['name'];}_0x157b47[_0x362d('0x15')](_0x1a2c43)[_0x362d('0x1d')](_0x35117a);};}exports['index']=function(_0x3de82d,_0x33da27){var _0x3c0aed={};var _0x593b37=_[_0x362d('0x1e')](db[_0x362d('0x1f')][_0x362d('0x20')],function(_0x23f9e6){return{'name':_0x23f9e6[_0x362d('0x21')],'type':_0x23f9e6[_0x362d('0x22')][_0x362d('0x23')]};});_0x3c0aed=qs['getOptions'](_0x593b37,_0x3de82d);return interaction[_0x362d('0x24')]('fax',_0x3de82d[_0x362d('0x25')],_0x3de82d[_0x362d('0x26')],_0x3c0aed,_0x593b37)[_0x362d('0x19')](respondWithFilteredResult(_0x33da27,_0x3c0aed))['catch'](handleError(_0x33da27,null));};exports[_0x362d('0x27')]=function(_0x1e96a0,_0x3905e6){var _0x484187={'raw':![],'where':{'id':_0x1e96a0[_0x362d('0x28')]['id']}},_0x1795a1={};_0x1795a1[_0x362d('0x29')]=_[_0x362d('0x2a')](db[_0x362d('0x1f')][_0x362d('0x20')]);_0x1795a1['query']=_['keys'](_0x1e96a0[_0x362d('0x25')]);_0x1795a1['filters']=_[_0x362d('0x2b')](_0x1795a1['model'],_0x1795a1[_0x362d('0x25')]);_0x484187[_0x362d('0x2c')]=_[_0x362d('0x2b')](_0x1795a1[_0x362d('0x29')],qs['fields'](_0x1e96a0['query'][_0x362d('0x2d')]));_0x484187['attributes']=_0x484187['attributes']['length']?_0x484187[_0x362d('0x2c')]:_0x1795a1[_0x362d('0x29')];if(_0x1e96a0[_0x362d('0x25')]['includeAll']){_0x484187[_0x362d('0x2e')]=[{'all':!![]}];}_0x484187=_[_0x362d('0x2f')]({},_0x484187,_0x1e96a0[_0x362d('0x30')]);return db[_0x362d('0x1f')][_0x362d('0x31')](_0x484187)[_0x362d('0x19')](handleEntityNotFound(_0x3905e6,null))[_0x362d('0x19')](respondWithResult(_0x3905e6,null))[_0x362d('0x32')](handleError(_0x3905e6,null));};exports['create']=function(_0x4e48f0,_0x5ba001){return db[_0x362d('0x1f')][_0x362d('0x33')](_0x4e48f0[_0x362d('0x34')],{})[_0x362d('0x19')](respondWithResult(_0x5ba001,0xc9))[_0x362d('0x32')](handleError(_0x5ba001,null));};exports[_0x362d('0x18')]=function(_0x28d7ca,_0x1600b9){if(_0x28d7ca[_0x362d('0x34')]['id']){delete _0x28d7ca[_0x362d('0x34')]['id'];}return db[_0x362d('0x1f')][_0x362d('0x31')]({'where':{'id':_0x28d7ca[_0x362d('0x28')]['id']}})[_0x362d('0x19')](handleEntityNotFound(_0x1600b9,null))['then'](saveUpdates(_0x28d7ca['body'],null))[_0x362d('0x19')](respondWithResult(_0x1600b9,null))[_0x362d('0x32')](handleError(_0x1600b9,null));};exports['destroy']=function(_0x9e8782,_0x334b26){return db[_0x362d('0x1f')][_0x362d('0x31')]({'where':{'id':_0x9e8782[_0x362d('0x28')]['id']}})[_0x362d('0x19')](handleEntityNotFound(_0x334b26,null))[_0x362d('0x19')](removeEntity(_0x334b26,null))[_0x362d('0x32')](handleError(_0x334b26,null));};exports[_0x362d('0x35')]=function(_0x62c6de,_0xf1377f){return db[_0x362d('0x1f')][_0x362d('0x35')]()[_0x362d('0x19')](respondWithResult(_0xf1377f,null))[_0x362d('0x32')](handleError(_0xf1377f,null));};exports['addMessage']=function(_0x455fa4,_0x400033){return db[_0x362d('0x36')][_0x362d('0x31')]({'where':{'id':_0x455fa4[_0x362d('0x28')]['id']}})[_0x362d('0x19')](handleEntityNotFound(_0x400033,null))['then'](function(_0x16469a){if(_0x16469a){return _0x16469a[_0x362d('0x37')](_0x455fa4[_0x362d('0x34')]['ids'],_['omit'](_0x455fa4[_0x362d('0x34')],['ids','id'])||{});}})[_0x362d('0x19')](respondWithResult(_0x400033,null))[_0x362d('0x32')](handleError(_0x400033,null));};exports[_0x362d('0x38')]=function(_0x46c88a,_0x175806){var _0x1b1874={'raw':![],'where':{}};var _0x269729={};var _0x15acd2={'count':0x0,'rows':[]};return db[_0x362d('0x1f')][_0x362d('0x39')]({'where':{'id':_0x46c88a['params']['id']}})[_0x362d('0x19')](handleEntityNotFound(_0x175806,null))[_0x362d('0x19')](function(_0x5dd4f6){if(_0x5dd4f6){_0x269729[_0x362d('0x29')]=_[_0x362d('0x2a')](db[_0x362d('0x36')][_0x362d('0x20')]);_0x269729[_0x362d('0x25')]=_[_0x362d('0x2a')](_0x46c88a[_0x362d('0x25')]);_0x269729[_0x362d('0x3a')]=_[_0x362d('0x2b')](_0x269729['model'],_0x269729[_0x362d('0x25')]);_0x1b1874[_0x362d('0x2c')]=_[_0x362d('0x2b')](_0x269729[_0x362d('0x29')],qs[_0x362d('0x2d')](_0x46c88a[_0x362d('0x25')]['fields']));_0x1b1874[_0x362d('0x2c')]=_0x1b1874['attributes']['length']?_0x1b1874[_0x362d('0x2c')]:_0x269729[_0x362d('0x29')];if(!_0x46c88a[_0x362d('0x25')][_0x362d('0x3b')](_0x362d('0x3c'))){_0x1b1874[_0x362d('0x13')]=qs['limit'](_0x46c88a[_0x362d('0x25')][_0x362d('0x13')]);_0x1b1874['offset']=qs[_0x362d('0x3d')](_0x46c88a['query'][_0x362d('0x3d')]);}_0x1b1874['order']=qs['sort'](_0x46c88a['query']['sort']);_0x1b1874[_0x362d('0x3e')]=qs[_0x362d('0x3a')](_[_0x362d('0x3f')](_0x46c88a[_0x362d('0x25')],_0x269729[_0x362d('0x3a')]));_0x1b1874[_0x362d('0x3e')][_0x362d('0x40')]=_0x5dd4f6['id'];if(_0x46c88a[_0x362d('0x25')][_0x362d('0x41')]){_0x1b1874[_0x362d('0x3e')]=_[_0x362d('0x2f')](_0x1b1874[_0x362d('0x3e')],{'$or':_[_0x362d('0x1e')](_0x1b1874[_0x362d('0x2c')],function(_0x274604){var _0x121da7={};_0x121da7[_0x274604]={'$like':'%'+_0x46c88a[_0x362d('0x25')]['filter']+'%'};return _0x121da7;})});}if(_0x46c88a[_0x362d('0x25')][_0x362d('0x42')]){var _0x1a00ef=_0x46c88a[_0x362d('0x25')][_0x362d('0x42')]['split'](',');var _0x35dcf0={};_0x35dcf0[_0x1a00ef[0x0]]={'$gte':moment(_0x1a00ef[0x1])[_0x362d('0x43')](_0x362d('0x44'))};_0x1b1874[_0x362d('0x3e')]=_['merge'](_0x1b1874[_0x362d('0x3e')],_0x35dcf0);}_0x1b1874=_[_0x362d('0x2f')]({},_0x1b1874,_0x46c88a[_0x362d('0x30')]);return db[_0x362d('0x36')][_0x362d('0x14')]({'where':_0x1b1874[_0x362d('0x3e')]})[_0x362d('0x19')](function(_0x5bbea7){_0x15acd2['count']=_0x5bbea7;if(_0x46c88a[_0x362d('0x25')][_0x362d('0x45')]){_0x1b1874[_0x362d('0x2e')]=[{'all':!![]}];}return db[_0x362d('0x36')][_0x362d('0x24')](_0x1b1874);})['then'](function(_0x2928e4){_0x15acd2[_0x362d('0x46')]=_0x2928e4;return _0x15acd2;});}})[_0x362d('0x19')](respondWithFilteredResult(_0x175806,_0x1b1874))[_0x362d('0x32')](handleError(_0x175806,null));};exports['addTags']=function(_0x456e37,_0x1957ab){return db[_0x362d('0x1f')][_0x362d('0x31')]({'where':{'id':_0x456e37[_0x362d('0x28')]['id']}})[_0x362d('0x19')](handleEntityNotFound(_0x1957ab,null))[_0x362d('0x19')](function(_0x5c4123){if(_0x5c4123){return _0x5c4123[_0x362d('0x47')](_0x456e37[_0x362d('0x34')][_0x362d('0x48')],_[_0x362d('0x49')](_0x456e37[_0x362d('0x34')],['ids','id'])||{})[_0x362d('0x4a')](function(){return db['Tag']['findAll']({'attributes':['id',_0x362d('0x1c'),'color'],'where':{'id':_0x456e37['body'][_0x362d('0x48')]}});})[_0x362d('0x19')](function(_0x15dcd3){socket[_0x362d('0x4b')]('faxInteractionTags:save',{'id':Number(_0x456e37[_0x362d('0x28')]['id']),'tags':_0x15dcd3||[]});return{'id':Number(_0x456e37[_0x362d('0x28')]['id']),'tags':_0x15dcd3||[]};});}})['then'](respondWithResult(_0x1957ab,null))[_0x362d('0x32')](handleError(_0x1957ab,null));};exports[_0x362d('0x4c')]=function(_0x5834da,_0x3eb1bf){return db[_0x362d('0x1f')][_0x362d('0x31')]({'where':{'id':_0x5834da[_0x362d('0x28')]['id']}})[_0x362d('0x19')](handleEntityNotFound(_0x3eb1bf,null))[_0x362d('0x19')](function(_0x91d3f7){if(_0x91d3f7){return _0x91d3f7[_0x362d('0x4c')](_0x5834da[_0x362d('0x25')]['ids']);}})[_0x362d('0x19')](respondWithStatusCode(_0x3eb1bf,null))[_0x362d('0x32')](handleError(_0x3eb1bf,null));};exports['download']=function(_0x4b34e1,_0x5e95fd){var _0xb1fb33=moment()['unix']()['toString']();var _0x593fbb=path[_0x362d('0x4d')](config['root'],_0x362d('0x4e'),_0x362d('0x4f'),'tmp');var _0x3b803d=path[_0x362d('0x4d')](config[_0x362d('0x50')],_0x362d('0x4e'),'files',_0x362d('0x51'));var _0x18be14=path[_0x362d('0x4d')](_0x593fbb,_0xb1fb33);var _0xd0dc99=util['format'](_0x362d('0x52'),_0x4b34e1[_0x362d('0x28')]['id'],_0xb1fb33);var _0x32eb1e=path[_0x362d('0x4d')](_0x593fbb,_0xd0dc99);var _0x55d341=[];_0x55d341['push']({'model':db[_0x362d('0x53')],'as':_0x362d('0x53'),'raw':!![]});var _0xdb2d61=[{'model':db[_0x362d('0x36')],'as':_0x362d('0x54'),'attributes':['id',_0x362d('0x34'),_0x362d('0x55')],'include':_0x55d341}];return db[_0x362d('0x1f')][_0x362d('0x31')]({'where':{'id':_0x4b34e1[_0x362d('0x28')]['id']},'include':_0xdb2d61})[_0x362d('0x19')](handleEntityNotFound(_0x5e95fd,null))[_0x362d('0x19')](function(_0x22c9ba){if(_0x22c9ba&&_0x22c9ba[_0x362d('0x54')]){var _0x5365bc=_0x22c9ba[_0x362d('0x56')]({'plain':!![]});fs[_0x362d('0x57')](_0x18be14);for(var _0x3663c6=0x0;_0x3663c6<_0x5365bc[_0x362d('0x54')][_0x362d('0x58')];_0x3663c6++){var _0x138142=_0x5365bc['Messages'][_0x3663c6][_0x362d('0x53')];if(_0x138142){var _0x9efa0d=path[_0x362d('0x4d')](_0x3b803d,_0x138142[_0x362d('0x59')]);if(fs['existsSync'](_0x9efa0d)){fs[_0x362d('0x5a')](_0x9efa0d)[_0x362d('0x5b')](fs['createWriteStream'](path[_0x362d('0x4d')](_0x18be14,_0x138142[_0x362d('0x59')])));}}}return BPromise[_0x362d('0x5c')]()['then'](function(){return new BPromise(function(_0x348456,_0x26dbcd){zipdir(_0x18be14,{'saveTo':_0x32eb1e},function(_0x55af27,_0x1b7b6a){if(_0x55af27)return _0x26dbcd(_0x55af27);return _0x348456(_0x1b7b6a);});})['then'](function(){return new BPromise(function(_0x3a181c,_0x4d4a30){rimraf(_0x18be14,function(_0x498302){if(_0x498302)_0x4d4a30(_0x498302);return _0x3a181c();});});})[_0x362d('0x19')](function(){return _0x5e95fd[_0x362d('0x5d')](_0x32eb1e,_0xd0dc99,function(_0x54cebf){if(_0x54cebf){console[_0x362d('0x5e')]('err',_0x54cebf);}else{fs[_0x362d('0x5f')](_0x32eb1e);}});});});}else{return _0x5e95fd[_0x362d('0xf')](0xc8);}})[_0x362d('0x32')](handleError(_0x5e95fd,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index a9c75a6..c8a7f39 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 _0x7970=['map','unreadMessages','length','emit','catch','hasOwnProperty','hook','events','../../mysqldb','FaxMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users'];(function(_0x2b49fc,_0x40cd4f){var _0x46a5f8=function(_0x18eb67){while(--_0x18eb67){_0x2b49fc['push'](_0x2b49fc['shift']());}};_0x46a5f8(++_0x40cd4f);}(_0x7970,0x1ed));var _0x0797=function(_0x2426cc,_0x1fd020){_0x2426cc=_0x2426cc-0x0;var _0x3bb2d1=_0x7970[_0x2426cc];return _0x3bb2d1;};'use strict';var EventEmitter=require(_0x0797('0x0'));var FaxInteraction=require(_0x0797('0x1'))['db']['FaxInteraction'];var FaxMessage=require(_0x0797('0x1'))['db'][_0x0797('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x0797('0x3')](0x0);var events={'afterCreate':_0x0797('0x4'),'afterUpdate':_0x0797('0x5'),'afterDestroy':_0x0797('0x6')};function emitEvent(_0x1a3834){return function(_0x38245b,_0x725172,_0x3889f2){_0x38245b[_0x0797('0x7')]({'attributes':['id'],'raw':!![]})[_0x0797('0x8')](function(_0x478d75){_0x38245b[_0x0797('0x9')](_0x0797('0xa'),_0x478d75[_0x0797('0xb')](function(_0x37bd3c){return{'id':_0x37bd3c['id']};}));return FaxMessage['findAll']({'where':{'FaxInteractionId':_0x38245b['id'],'direction':'in','read':![]},'raw':!![]});})[_0x0797('0x8')](function(_0x3c8a9f){_0x38245b[_0x0797('0x9')](_0x0797('0xc'),_0x3c8a9f[_0x0797('0xd')]);FaxInteractionEvents[_0x0797('0xe')](_0x1a3834+':'+_0x38245b['id'],_0x38245b);FaxInteractionEvents['emit'](_0x1a3834,_0x38245b);_0x3889f2(null);})[_0x0797('0xf')](_0x3889f2(null));};}for(var e in events){if(events[_0x0797('0x10')](e)){var event=events[e];FaxInteraction[_0x0797('0x11')](e,emitEvent(event));}}module['exports']=FaxInteractionEvents; \ No newline at end of file +var _0x3608=['emit','catch','hook','../../mysqldb','FaxInteraction','update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length'];(function(_0x397cfb,_0xb8f317){var _0x15fed9=function(_0x3eba43){while(--_0x3eba43){_0x397cfb['push'](_0x397cfb['shift']());}};_0x15fed9(++_0xb8f317);}(_0x3608,0xa8));var _0x8360=function(_0x1e5560,_0x578cb2){_0x1e5560=_0x1e5560-0x0;var _0x482e4b=_0x3608[_0x1e5560];return _0x482e4b;};'use strict';var EventEmitter=require('events');var FaxInteraction=require(_0x8360('0x0'))['db'][_0x8360('0x1')];var FaxMessage=require(_0x8360('0x0'))['db']['FaxMessage'];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x8360('0x2'),'afterDestroy':_0x8360('0x3')};function emitEvent(_0x4352a5){return function(_0x5242a7,_0x398349,_0x3082d6){_0x5242a7[_0x8360('0x4')]({'attributes':['id'],'raw':!![]})[_0x8360('0x5')](function(_0x76cf49){_0x5242a7[_0x8360('0x6')](_0x8360('0x7'),_0x76cf49[_0x8360('0x8')](function(_0x24277b){return{'id':_0x24277b['id']};}));return FaxMessage[_0x8360('0x9')]({'where':{'FaxInteractionId':_0x5242a7['id'],'direction':'in','read':![]},'raw':!![]});})[_0x8360('0x5')](function(_0x48ae9d){_0x5242a7[_0x8360('0x6')](_0x8360('0xa'),_0x48ae9d[_0x8360('0xb')]);FaxInteractionEvents[_0x8360('0xc')](_0x4352a5+':'+_0x5242a7['id'],_0x5242a7);FaxInteractionEvents['emit'](_0x4352a5,_0x5242a7);_0x3082d6(null);})[_0x8360('0xd')](_0x3082d6(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxInteraction[_0x8360('0xe')](e,emitEvent(event));}}module['exports']=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index 8765d88..473fe48 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 _0x11d3=['moment','path','rimraf','../../config/environment','./faxInteraction.attributes','exports','define','FaxInteraction','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x11d3,0x1ac));var _0x311d=function(_0x57c3a2,_0xf75938){_0x57c3a2=_0x57c3a2-0x0;var _0x5b572f=_0x11d3[_0x57c3a2];return _0x5b572f;};'use strict';var _=require(_0x311d('0x0'));var util=require(_0x311d('0x1'));var logger=require(_0x311d('0x2'))(_0x311d('0x3'));var moment=require(_0x311d('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x311d('0x5'));var rimraf=require(_0x311d('0x6'));var config=require(_0x311d('0x7'));var attributes=require(_0x311d('0x8'));module[_0x311d('0x9')]=function(_0x4443f6,_0x1e93a0){return _0x4443f6[_0x311d('0xa')](_0x311d('0xb'),attributes,{'tableName':'fax_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1917f5,_0x23fbb9,_0x4402c1){if(_0x1917f5[_0x311d('0xc')]('closed')){_0x1917f5[_0x311d('0xd')]=moment()[_0x311d('0xe')](_0x311d('0xf'));}_0x4402c1(null,_0x1917f5);}}});}; \ No newline at end of file +var _0x3186=['fax_interactions','changed','YYYY-MM-DD\x20HH:mm:ss','lodash','util','api','moment','bluebird','rimraf','../../config/environment','./faxInteraction.attributes','exports','define','FaxInteraction'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3186,0xb9));var _0x6318=function(_0x45e71e,_0x1d5611){_0x45e71e=_0x45e71e-0x0;var _0x268fee=_0x3186[_0x45e71e];return _0x268fee;};'use strict';var _=require(_0x6318('0x0'));var util=require(_0x6318('0x1'));var logger=require('../../config/logger')(_0x6318('0x2'));var moment=require(_0x6318('0x3'));var BPromise=require(_0x6318('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x6318('0x5'));var config=require(_0x6318('0x6'));var attributes=require(_0x6318('0x7'));module[_0x6318('0x8')]=function(_0x4c6aae,_0x6566bf){return _0x4c6aae[_0x6318('0x9')](_0x6318('0xa'),attributes,{'tableName':_0x6318('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x27729a,_0x4febaf,_0x37bc0f){if(_0x27729a[_0x6318('0xc')]('closed')){_0x27729a['closedAt']=moment()['format'](_0x6318('0xd'));}_0x37bc0f(null,_0x27729a);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index 8d1bf4d..218c8a2 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 _0x97b9=['addTags','body','ids','omit','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','redis','localhost','./faxInteraction.socket','register','request','then','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','UpdateFaxInteraction','FaxInteraction','update','options','raw','attributes','info','AddTagsToFaxInteraction','find','where'];(function(_0x1b0c34,_0x5d82b4){var _0x3fd9d4=function(_0x99e499){while(--_0x99e499){_0x1b0c34['push'](_0x1b0c34['shift']());}};_0x3fd9d4(++_0x5d82b4);}(_0x97b9,0x83));var _0x997b=function(_0x4d9e82,_0x14aff1){_0x4d9e82=_0x4d9e82-0x0;var _0x139241=_0x97b9[_0x4d9e82];return _0x139241;};'use strict';var _=require(_0x997b('0x0'));var util=require(_0x997b('0x1'));var moment=require(_0x997b('0x2'));var BPromise=require(_0x997b('0x3'));var rs=require(_0x997b('0x4'));var fs=require('fs');var Redis=require(_0x997b('0x5'));var db=require(_0x997b('0x6'))['db'];var utils=require(_0x997b('0x7'));var logger=require('../../config/logger')(_0x997b('0x8'));var config=require(_0x997b('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x997b('0xa')][_0x997b('0xb')]({'port':0x232a});config[_0x997b('0xc')]=_['defaults'](config[_0x997b('0xc')],{'host':_0x997b('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x997b('0xc')]));require(_0x997b('0xe'))[_0x997b('0xf')](socket);function respondWithRpcPromise(_0x3ef195,_0x5e080d,_0x2e6dec){return new BPromise(function(_0x1dc4d1,_0x315c5b){return client[_0x997b('0x10')](_0x3ef195,_0x2e6dec)[_0x997b('0x11')](function(_0x1b67ec){logger['info'](_0x997b('0x12'),_0x5e080d,_0x997b('0x13'));logger[_0x997b('0x14')](_0x997b('0x15'),_0x5e080d,_0x997b('0x13'),JSON[_0x997b('0x16')](_0x1b67ec));if(_0x1b67ec[_0x997b('0x17')]){if(_0x1b67ec['error'][_0x997b('0x18')]===0x1f4){logger['error'](_0x997b('0x12'),_0x5e080d,_0x1b67ec[_0x997b('0x17')][_0x997b('0x19')]);return _0x315c5b(_0x1b67ec['error'][_0x997b('0x19')]);}logger[_0x997b('0x17')](_0x997b('0x12'),_0x5e080d,_0x1b67ec[_0x997b('0x17')][_0x997b('0x19')]);return _0x1dc4d1(_0x1b67ec[_0x997b('0x17')]['message']);}else{logger['info']('FaxInteraction,\x20%s,\x20%s',_0x5e080d,'request\x20sent');_0x1dc4d1(_0x1b67ec['result'][_0x997b('0x19')]);}})[_0x997b('0x1a')](function(_0x5aca97){logger['error'](_0x997b('0x12'),_0x5e080d,_0x5aca97);_0x315c5b(_0x5aca97);});});}exports[_0x997b('0x1b')]=function(_0x580c59){var _0x38fa13=this;return new Promise(function(_0x389556,_0x44356a){return db[_0x997b('0x1c')][_0x997b('0x1d')](_0x580c59['body'],{'raw':_0x580c59[_0x997b('0x1e')]?_0x580c59[_0x997b('0x1e')][_0x997b('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x580c59[_0x997b('0x1e')]?_0x580c59[_0x997b('0x1e')]['where']||null:null,'attributes':_0x580c59[_0x997b('0x1e')]?_0x580c59['options'][_0x997b('0x20')]||null:null,'limit':_0x580c59[_0x997b('0x1e')]?_0x580c59[_0x997b('0x1e')]['limit']||null:null})[_0x997b('0x11')](function(_0x169aff){logger[_0x997b('0x21')](_0x997b('0x1b'),_0x580c59);logger['debug'](_0x997b('0x1b'),_0x580c59,JSON[_0x997b('0x16')](_0x169aff));_0x389556(_0x169aff);})[_0x997b('0x1a')](function(_0x5554dc){logger['error'](_0x997b('0x1b'),_0x5554dc[_0x997b('0x19')],_0x580c59);_0x44356a(_0x38fa13[_0x997b('0x17')](0x1f4,_0x5554dc['message']));});});};exports[_0x997b('0x22')]=function(_0x41e377){return new Promise(function(_0x25a104,_0x23a88a){return db[_0x997b('0x1c')][_0x997b('0x23')]({'where':_0x41e377[_0x997b('0x1e')]?_0x41e377[_0x997b('0x1e')][_0x997b('0x24')]||null:null})[_0x997b('0x11')](function(_0x8e18d8){if(_0x8e18d8){return _0x8e18d8[_0x997b('0x25')](_0x41e377[_0x997b('0x26')][_0x997b('0x27')],_[_0x997b('0x28')](_0x41e377['body'],[_0x997b('0x27'),'id'])||{});}})['spread'](function(_0x32cc03){logger['info'](_0x997b('0x29'),_0x41e377);logger[_0x997b('0x14')](_0x997b('0x29'),_0x41e377,JSON[_0x997b('0x16')](_0x32cc03));_0x25a104(_0x32cc03);})[_0x997b('0x1a')](function(_0x508b08){logger[_0x997b('0x17')]('AddTags',_0x508b08['message'],_0x41e377);_0x23a88a(_this[_0x997b('0x17')](0x1f4,_0x508b08[_0x997b('0x19')]));});});}; \ No newline at end of file +var _0x5152=['info','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','update','options','raw','attributes','limit','UpdateFaxInteraction','AddTagsToFaxInteraction','FaxInteraction','find','where','body','ids','omit','spread','AddTags','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','request','then'];(function(_0x1a28b5,_0x343d12){var _0x58d62f=function(_0x5aa604){while(--_0x5aa604){_0x1a28b5['push'](_0x1a28b5['shift']());}};_0x58d62f(++_0x343d12);}(_0x5152,0x1dc));var _0x2515=function(_0x1cbcf1,_0x3f9fd9){_0x1cbcf1=_0x1cbcf1-0x0;var _0x3a06f0=_0x5152[_0x1cbcf1];return _0x3a06f0;};'use strict';var _=require(_0x2515('0x0'));var util=require(_0x2515('0x1'));var moment=require(_0x2515('0x2'));var BPromise=require('bluebird');var rs=require(_0x2515('0x3'));var fs=require('fs');var Redis=require(_0x2515('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2515('0x5'));var logger=require(_0x2515('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x2515('0x7'));var client=jayson[_0x2515('0x8')]['http']({'port':0x232a});config[_0x2515('0x9')]=_[_0x2515('0xa')](config[_0x2515('0x9')],{'host':_0x2515('0xb'),'port':0x18eb});var socket=require(_0x2515('0xc'))(new Redis(config[_0x2515('0x9')]));require(_0x2515('0xd'))['register'](socket);function respondWithRpcPromise(_0x1378ce,_0x4a7285,_0x1c9204){return new BPromise(function(_0x962da7,_0x49b0c2){return client[_0x2515('0xe')](_0x1378ce,_0x1c9204)[_0x2515('0xf')](function(_0x1da28f){logger[_0x2515('0x10')](_0x2515('0x11'),_0x4a7285,_0x2515('0x12'));logger[_0x2515('0x13')]('FaxInteraction,\x20%s,\x20%s,\x20%s',_0x4a7285,'request\x20sent',JSON[_0x2515('0x14')](_0x1da28f));if(_0x1da28f['error']){if(_0x1da28f[_0x2515('0x15')][_0x2515('0x16')]===0x1f4){logger['error'](_0x2515('0x11'),_0x4a7285,_0x1da28f[_0x2515('0x15')][_0x2515('0x17')]);return _0x49b0c2(_0x1da28f[_0x2515('0x15')][_0x2515('0x17')]);}logger[_0x2515('0x15')](_0x2515('0x11'),_0x4a7285,_0x1da28f[_0x2515('0x15')]['message']);return _0x962da7(_0x1da28f['error'][_0x2515('0x17')]);}else{logger['info']('FaxInteraction,\x20%s,\x20%s',_0x4a7285,_0x2515('0x12'));_0x962da7(_0x1da28f[_0x2515('0x18')][_0x2515('0x17')]);}})[_0x2515('0x19')](function(_0x4e8116){logger[_0x2515('0x15')](_0x2515('0x11'),_0x4a7285,_0x4e8116);_0x49b0c2(_0x4e8116);});});}exports['UpdateFaxInteraction']=function(_0x1ec050){var _0x59aa33=this;return new Promise(function(_0x39c38e,_0x2b755d){return db['FaxInteraction'][_0x2515('0x1a')](_0x1ec050['body'],{'raw':_0x1ec050[_0x2515('0x1b')]?_0x1ec050[_0x2515('0x1b')][_0x2515('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1ec050[_0x2515('0x1b')]?_0x1ec050[_0x2515('0x1b')]['where']||null:null,'attributes':_0x1ec050['options']?_0x1ec050[_0x2515('0x1b')][_0x2515('0x1d')]||null:null,'limit':_0x1ec050[_0x2515('0x1b')]?_0x1ec050[_0x2515('0x1b')][_0x2515('0x1e')]||null:null})[_0x2515('0xf')](function(_0x30f4d6){logger[_0x2515('0x10')](_0x2515('0x1f'),_0x1ec050);logger[_0x2515('0x13')]('UpdateFaxInteraction',_0x1ec050,JSON[_0x2515('0x14')](_0x30f4d6));_0x39c38e(_0x30f4d6);})[_0x2515('0x19')](function(_0x1a1ae3){logger[_0x2515('0x15')](_0x2515('0x1f'),_0x1a1ae3[_0x2515('0x17')],_0x1ec050);_0x2b755d(_0x59aa33[_0x2515('0x15')](0x1f4,_0x1a1ae3[_0x2515('0x17')]));});});};exports[_0x2515('0x20')]=function(_0x5bb5b5){return new Promise(function(_0x1dff94,_0x4e7a88){return db[_0x2515('0x21')][_0x2515('0x22')]({'where':_0x5bb5b5['options']?_0x5bb5b5[_0x2515('0x1b')][_0x2515('0x23')]||null:null})[_0x2515('0xf')](function(_0x3230a1){if(_0x3230a1){return _0x3230a1['addTags'](_0x5bb5b5[_0x2515('0x24')][_0x2515('0x25')],_[_0x2515('0x26')](_0x5bb5b5['body'],[_0x2515('0x25'),'id'])||{});}})[_0x2515('0x27')](function(_0x1d2c38){logger[_0x2515('0x10')](_0x2515('0x28'),_0x5bb5b5);logger[_0x2515('0x13')](_0x2515('0x28'),_0x5bb5b5,JSON['stringify'](_0x1d2c38));_0x1dff94(_0x1d2c38);})[_0x2515('0x19')](function(_0x3c8d6b){logger['error'](_0x2515('0x28'),_0x3c8d6b['message'],_0x5bb5b5);_0x4e7a88(_this[_0x2515('0x15')](0x1f4,_0x3c8d6b[_0x2515('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 26db7f2..6bf942b 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 _0x9c20=['save','update','emit','register','length','./faxInteraction.events'];(function(_0x4ec474,_0x427476){var _0x59dad0=function(_0x373cc3){while(--_0x373cc3){_0x4ec474['push'](_0x4ec474['shift']());}};_0x59dad0(++_0x427476);}(_0x9c20,0xa7));var _0x09c2=function(_0x7cb764,_0x417900){_0x7cb764=_0x7cb764-0x0;var _0x37714b=_0x9c20[_0x7cb764];return _0x37714b;};'use strict';var FaxInteractionEvents=require(_0x09c2('0x0'));var events=[_0x09c2('0x1'),'remove',_0x09c2('0x2')];function createListener(_0x5c4da7,_0x215b94){return function(_0xf6a3c5){_0x215b94[_0x09c2('0x3')](_0x5c4da7,_0xf6a3c5);};}function removeListener(_0x22b23c,_0xead51c){return function(){FaxInteractionEvents['removeListener'](_0x22b23c,_0xead51c);};}exports[_0x09c2('0x4')]=function(_0x464402){for(var _0x24869c=0x0,_0x45ad5b=events[_0x09c2('0x5')];_0x24869c<_0x45ad5b;_0x24869c++){var _0x12fa2b=events[_0x24869c];var _0x1e32d5=createListener('faxInteraction:'+_0x12fa2b,_0x464402);FaxInteractionEvents['on'](_0x12fa2b,_0x1e32d5);}}; \ No newline at end of file +var _0xe746=['update','emit','length','faxInteraction:','./faxInteraction.events'];(function(_0x2f1b61,_0x3b7bc5){var _0x23a054=function(_0x16f61a){while(--_0x16f61a){_0x2f1b61['push'](_0x2f1b61['shift']());}};_0x23a054(++_0x3b7bc5);}(_0xe746,0x135));var _0x6e74=function(_0x567a44,_0x5b1d98){_0x567a44=_0x567a44-0x0;var _0x1b1b2e=_0xe746[_0x567a44];return _0x1b1b2e;};'use strict';var FaxInteractionEvents=require(_0x6e74('0x0'));var events=['save','remove',_0x6e74('0x1')];function createListener(_0x3facb6,_0x37e82d){return function(_0x1d4071){_0x37e82d[_0x6e74('0x2')](_0x3facb6,_0x1d4071);};}function removeListener(_0x4fa51e,_0x25d27a){return function(){FaxInteractionEvents['removeListener'](_0x4fa51e,_0x25d27a);};}exports['register']=function(_0xb76aca){for(var _0x69effa=0x0,_0x10b5d0=events[_0x6e74('0x3')];_0x69effa<_0x10b5d0;_0x69effa++){var _0x203830=events[_0x69effa];var _0x1bedc5=createListener(_0x6e74('0x4')+_0x203830,_0xb76aca);FaxInteractionEvents['on'](_0x203830,_0x1bedc5);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 6259377..b9de176 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 _0xa2d7=['put','/:id','fax','update','delete','removeTags','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./faxInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id/messages','getMessages','/:id/download','download','post','addMessage','/:id/tags','tracked','addTags'];(function(_0x1834d3,_0xba4f88){var _0x4b049a=function(_0x3c0cc7){while(--_0x3c0cc7){_0x1834d3['push'](_0x1834d3['shift']());}};_0x4b049a(++_0xba4f88);}(_0xa2d7,0x1ba));var _0x7a2d=function(_0x3000b5,_0x327998){_0x3000b5=_0x3000b5-0x0;var _0x506e3b=_0xa2d7[_0x3000b5];return _0x506e3b;};'use strict';var multer=require(_0x7a2d('0x0'));var util=require(_0x7a2d('0x1'));var path=require(_0x7a2d('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x7a2d('0x3')]();var fs_extra=require(_0x7a2d('0x4'));var auth=require(_0x7a2d('0x5'));var interaction=require(_0x7a2d('0x6'));var config=require('../../config/environment');var controller=require(_0x7a2d('0x7'));router[_0x7a2d('0x8')]('/',auth[_0x7a2d('0x9')](),controller[_0x7a2d('0xa')]);router['get'](_0x7a2d('0xb'),auth[_0x7a2d('0x9')](),controller[_0x7a2d('0xc')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0x7a2d('0x8')](_0x7a2d('0xd'),auth[_0x7a2d('0x9')](),controller[_0x7a2d('0xe')]);router[_0x7a2d('0x8')](_0x7a2d('0xf'),auth[_0x7a2d('0x9')](),controller[_0x7a2d('0x10')]);router[_0x7a2d('0x11')]('/',auth[_0x7a2d('0x9')](),controller['create']);router[_0x7a2d('0x11')](_0x7a2d('0xd'),auth[_0x7a2d('0x9')](),controller[_0x7a2d('0x12')]);router[_0x7a2d('0x11')](_0x7a2d('0x13'),auth[_0x7a2d('0x9')](),interaction[_0x7a2d('0x14')]('fax','faxinteraction:addtags'),controller[_0x7a2d('0x15')]);router[_0x7a2d('0x16')](_0x7a2d('0x17'),auth[_0x7a2d('0x9')](),interaction[_0x7a2d('0x14')](_0x7a2d('0x18'),'faxinteraction:update'),controller[_0x7a2d('0x19')]);router[_0x7a2d('0x1a')](_0x7a2d('0x17'),auth[_0x7a2d('0x9')](),interaction[_0x7a2d('0x14')](_0x7a2d('0x18'),'faxinteraction:destroy'),controller['destroy']);router[_0x7a2d('0x1a')](_0x7a2d('0x13'),auth[_0x7a2d('0x9')](),controller[_0x7a2d('0x1b')]);module[_0x7a2d('0x1c')]=router; \ No newline at end of file +var _0xc495=['show','/:id/messages','getMessages','/:id/download','download','post','create','/:id/tags','fax','faxinteraction:addtags','put','tracked','faxinteraction:update','update','delete','faxinteraction:destroy','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./faxInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x217741,_0x4c9dec){var _0x2ccb1b=function(_0x57f881){while(--_0x57f881){_0x217741['push'](_0x217741['shift']());}};_0x2ccb1b(++_0x4c9dec);}(_0xc495,0x1e0));var _0x5c49=function(_0x3ce0ce,_0x509c9a){_0x3ce0ce=_0x3ce0ce-0x0;var _0x3f576a=_0xc495[_0x3ce0ce];return _0x3f576a;};'use strict';var multer=require(_0x5c49('0x0'));var util=require(_0x5c49('0x1'));var path=require(_0x5c49('0x2'));var timeout=require(_0x5c49('0x3'));var express=require(_0x5c49('0x4'));var router=express[_0x5c49('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x5c49('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x5c49('0x7'));var controller=require(_0x5c49('0x8'));router[_0x5c49('0x9')]('/',auth[_0x5c49('0xa')](),controller[_0x5c49('0xb')]);router[_0x5c49('0x9')](_0x5c49('0xc'),auth['isAuthenticated'](),controller[_0x5c49('0xd')]);router[_0x5c49('0x9')](_0x5c49('0xe'),auth[_0x5c49('0xa')](),controller[_0x5c49('0xf')]);router[_0x5c49('0x9')](_0x5c49('0x10'),auth['isAuthenticated'](),controller[_0x5c49('0x11')]);router[_0x5c49('0x9')](_0x5c49('0x12'),auth['isAuthenticated'](),controller[_0x5c49('0x13')]);router[_0x5c49('0x14')]('/',auth[_0x5c49('0xa')](),controller[_0x5c49('0x15')]);router['post']('/:id/messages',auth[_0x5c49('0xa')](),controller['addMessage']);router[_0x5c49('0x14')](_0x5c49('0x16'),auth[_0x5c49('0xa')](),interaction['tracked'](_0x5c49('0x17'),_0x5c49('0x18')),controller['addTags']);router[_0x5c49('0x19')](_0x5c49('0xe'),auth['isAuthenticated'](),interaction[_0x5c49('0x1a')](_0x5c49('0x17'),_0x5c49('0x1b')),controller[_0x5c49('0x1c')]);router[_0x5c49('0x1d')](_0x5c49('0xe'),auth['isAuthenticated'](),interaction[_0x5c49('0x1a')](_0x5c49('0x17'),_0x5c49('0x1e')),controller[_0x5c49('0x1f')]);router[_0x5c49('0x1d')]('/:id/tags',auth['isAuthenticated'](),controller['removeTags']);module[_0x5c49('0x20')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index 4b80dfc..3bc3694 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 _0x180f=['medium','BOOLEAN','out','TEXT','DATE','sequelize','exports'];(function(_0x3be7e9,_0x2393da){var _0x45497c=function(_0x1c952f){while(--_0x1c952f){_0x3be7e9['push'](_0x3be7e9['shift']());}};_0x45497c(++_0x2393da);}(_0x180f,0xf3));var _0xf180=function(_0x4a04de,_0x2e342c){_0x4a04de=_0x4a04de-0x0;var _0xbbe018=_0x180f[_0x4a04de];return _0xbbe018;};'use strict';var Sequelize=require(_0xf180('0x0'));module[_0xf180('0x1')]={'body':{'type':Sequelize['TEXT'](_0xf180('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xf180('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xf180('0x4')),'defaultValue':_0xf180('0x4'),'allowNull':![]},'failMessage':{'type':Sequelize[_0xf180('0x5')],'defaultValue':null},'readAt':{'type':Sequelize[_0xf180('0x6')]}}; \ No newline at end of file +var _0xffe1=['TEXT','DATE','sequelize','exports','BOOLEAN','ENUM','out'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xffe1,0x175));var _0x1ffe=function(_0x4c8518,_0x24cf38){_0x4c8518=_0x4c8518-0x0;var _0x35b4f9=_0xffe1[_0x4c8518];return _0x35b4f9;};'use strict';var Sequelize=require(_0x1ffe('0x0'));module[_0x1ffe('0x1')]={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x1ffe('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x1ffe('0x3')]('in',_0x1ffe('0x4')),'defaultValue':'out','allowNull':![]},'failMessage':{'type':Sequelize[_0x1ffe('0x5')],'defaultValue':null},'readAt':{'type':Sequelize[_0x1ffe('0x6')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 89d5426..f90bf93 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 _0x25d4=['localhost','socket.io-emitter','./faxMessage.socket','register','http','client','request','then','FaxMessage,\x20%s,\x20%s','request\x20sent','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','sendStatus','send','index','map','FaxMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','rows','show','params','include','options','find','body','describe','fax-interactions','accept','fax','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','FaxInteraction','FaxInteractionId','read1stAt','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','name','role','interaction','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','User','fullname','email','internal','agent','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','ContactId','contact','create','CmContact','findOne','isNil','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','AttachmentId','join','root','files','attachments','Attachment','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults'];(function(_0x2dadb9,_0x42cfe6){var _0x2f0097=function(_0x21163f){while(--_0x21163f){_0x2dadb9['push'](_0x2dadb9['shift']());}};_0x2f0097(++_0x42cfe6);}(_0x25d4,0x19c));var _0x425d=function(_0x462267,_0x53f1bf){_0x462267=_0x462267-0x0;var _0x2252bf=_0x25d4[_0x462267];return _0x2252bf;};'use strict';var emlformat=require(_0x425d('0x0'));var rimraf=require(_0x425d('0x1'));var zipdir=require(_0x425d('0x2'));var jsonpatch=require(_0x425d('0x3'));var rp=require(_0x425d('0x4'));var moment=require(_0x425d('0x5'));var BPromise=require(_0x425d('0x6'));var Mustache=require('mustache');var util=require(_0x425d('0x7'));var path=require(_0x425d('0x8'));var sox=require(_0x425d('0x9'));var csv=require('to-csv');var ejs=require(_0x425d('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x425d('0xb'));var squel=require('squel');var crypto=require(_0x425d('0xc'));var jsforce=require(_0x425d('0xd'));var deskjs=require(_0x425d('0xe'));var toCsv=require(_0x425d('0xf'));var querystring=require(_0x425d('0x10'));var Papa=require(_0x425d('0x11'));var Redis=require('ioredis');var authService=require(_0x425d('0x12'));var qs=require(_0x425d('0x13'));var as=require(_0x425d('0x14'));var hardwareService=require(_0x425d('0x15'));var logger=require(_0x425d('0x16'))(_0x425d('0x17'));var utils=require(_0x425d('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x425d('0x19'));var db=require(_0x425d('0x1a'))['db'];config[_0x425d('0x1b')]=_[_0x425d('0x1c')](config[_0x425d('0x1b')],{'host':_0x425d('0x1d'),'port':0x18eb});var socket=require(_0x425d('0x1e'))(new Redis(config[_0x425d('0x1b')]));require(_0x425d('0x1f'))[_0x425d('0x20')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x425d('0x21')]({'port':0x232c});var client9002=jayson[_0x425d('0x22')][_0x425d('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x19cde0,_0x2a9e8f,_0x39811c,_0x34e3a7){return new BPromise(function(_0xb2e907,_0xf8da0b){var _0x178e91=_0x34e3a7||client;return _0x178e91[_0x425d('0x23')](_0x19cde0,_0x39811c)[_0x425d('0x24')](function(_0x14c6cc){logger['info'](_0x425d('0x25'),_0x2a9e8f,_0x425d('0x26'));logger['debug'](_0x425d('0x27'),_0x2a9e8f,'request\x20sent',JSON[_0x425d('0x28')](_0x14c6cc));if(_0x14c6cc[_0x425d('0x29')]){if(_0x14c6cc['error'][_0x425d('0x2a')]===0x1f4){logger[_0x425d('0x29')](_0x425d('0x25'),_0x2a9e8f,_0x14c6cc[_0x425d('0x29')][_0x425d('0x2b')]);return _0xf8da0b(_0x14c6cc[_0x425d('0x29')][_0x425d('0x2b')]);}logger[_0x425d('0x29')](_0x425d('0x25'),_0x2a9e8f,_0x14c6cc['error'][_0x425d('0x2b')]);return _0xb2e907(_0x14c6cc[_0x425d('0x29')][_0x425d('0x2b')]);}else{logger['info'](_0x425d('0x25'),_0x2a9e8f,_0x425d('0x26'));_0xb2e907(_0x14c6cc['result'][_0x425d('0x2b')]);}})[_0x425d('0x2c')](function(_0x3e0482){logger[_0x425d('0x29')](_0x425d('0x25'),_0x2a9e8f,_0x3e0482);_0xf8da0b(_0x3e0482);});});}function respondWithStatusCode(_0x59d8f7,_0x341d12){_0x341d12=_0x341d12||0xcc;return function(_0x38085b){if(_0x38085b){return _0x59d8f7['sendStatus'](_0x341d12);}return _0x59d8f7[_0x425d('0x2d')](_0x341d12)[_0x425d('0x2e')]();};}function respondWithResult(_0x37fe4f,_0x4a5518){_0x4a5518=_0x4a5518||0xc8;return function(_0x52f1bb){if(_0x52f1bb){return _0x37fe4f['status'](_0x4a5518)[_0x425d('0x2f')](_0x52f1bb);}};}function respondWithFilteredResult(_0x3aaab4,_0x3c4149){return function(_0x2c35cf){if(_0x2c35cf){var _0x36d688=typeof _0x3c4149['offset']===_0x425d('0x30')&&typeof _0x3c4149['limit']===_0x425d('0x30');var _0x25f167=_0x2c35cf[_0x425d('0x31')];var _0x51c2f9=_0x36d688?0x0:_0x3c4149[_0x425d('0x32')];var _0x551dac=_0x36d688?_0x2c35cf[_0x425d('0x31')]:_0x3c4149[_0x425d('0x32')]+_0x3c4149[_0x425d('0x33')];var _0x2e1658;if(_0x551dac>=_0x25f167){_0x551dac=_0x25f167;_0x2e1658=0xc8;}else{_0x2e1658=0xce;}_0x3aaab4['status'](_0x2e1658);return _0x3aaab4[_0x425d('0x34')](_0x425d('0x35'),_0x51c2f9+'-'+_0x551dac+'/'+_0x25f167)[_0x425d('0x2f')](_0x2c35cf);}return null;};}function patchUpdates(_0x56762c){return function(_0x4a93a2){try{jsonpatch[_0x425d('0x36')](_0x4a93a2,_0x56762c,!![]);}catch(_0x422f04){return BPromise[_0x425d('0x37')](_0x422f04);}return _0x4a93a2[_0x425d('0x38')]();};}function saveUpdates(_0x264370,_0x19b211){return function(_0x1e58d1){if(_0x1e58d1){return _0x1e58d1[_0x425d('0x39')](_0x264370)[_0x425d('0x24')](function(_0xb38cc1){return _0xb38cc1;});}return null;};}function removeEntity(_0x3e8d7f,_0x1cc987){return function(_0x4ccfd0){if(_0x4ccfd0){return _0x4ccfd0[_0x425d('0x3a')]()[_0x425d('0x24')](function(){_0x3e8d7f['status'](0xcc)[_0x425d('0x2e')]();});}};}function handleEntityNotFound(_0x168c83,_0x33c3f5){return function(_0x5e4f34){if(!_0x5e4f34){_0x168c83[_0x425d('0x3b')](0x194);}return _0x5e4f34;};}function handleError(_0x5ad0d5,_0x139679){_0x139679=_0x139679||0x1f4;return function(_0x37876b){logger[_0x425d('0x29')](_0x37876b['stack']);if(_0x37876b['name']){delete _0x37876b['name'];}_0x5ad0d5[_0x425d('0x2d')](_0x139679)[_0x425d('0x3c')](_0x37876b);};}exports[_0x425d('0x3d')]=function(_0x20208d,_0x1b98cf){var _0x44d00f={},_0x51f2ee={},_0x419e6d={'count':0x0,'rows':[]};var _0x2a496e=_[_0x425d('0x3e')](db[_0x425d('0x3f')][_0x425d('0x40')],function(_0x280fc8){return{'name':_0x280fc8[_0x425d('0x41')],'type':_0x280fc8[_0x425d('0x42')][_0x425d('0x43')]};});_0x51f2ee[_0x425d('0x44')]=_[_0x425d('0x3e')](_0x2a496e,'name');_0x51f2ee[_0x425d('0x45')]=_[_0x425d('0x46')](_0x20208d[_0x425d('0x45')]);_0x51f2ee[_0x425d('0x47')]=_['intersection'](_0x51f2ee[_0x425d('0x44')],_0x51f2ee['query']);_0x44d00f[_0x425d('0x48')]=_[_0x425d('0x49')](_0x51f2ee[_0x425d('0x44')],qs[_0x425d('0x4a')](_0x20208d['query']['fields']));_0x44d00f[_0x425d('0x48')]=_0x44d00f['attributes'][_0x425d('0x4b')]?_0x44d00f[_0x425d('0x48')]:_0x51f2ee[_0x425d('0x44')];if(!_0x20208d['query']['hasOwnProperty'](_0x425d('0x4c'))){_0x44d00f['limit']=qs[_0x425d('0x33')](_0x20208d[_0x425d('0x45')][_0x425d('0x33')]);_0x44d00f[_0x425d('0x32')]=qs[_0x425d('0x32')](_0x20208d['query'][_0x425d('0x32')]);}_0x44d00f[_0x425d('0x4d')]=qs[_0x425d('0x4e')](_0x20208d['query'][_0x425d('0x4e')]);_0x44d00f[_0x425d('0x4f')]=qs[_0x425d('0x47')](_[_0x425d('0x50')](_0x20208d[_0x425d('0x45')],_0x51f2ee[_0x425d('0x47')]),_0x2a496e);if(_0x20208d['query'][_0x425d('0x51')]){_0x44d00f[_0x425d('0x4f')]=_[_0x425d('0x52')](_0x44d00f['where'],{'$or':_[_0x425d('0x3e')](_0x2a496e,function(_0x371524){if(_0x371524[_0x425d('0x42')]!==_0x425d('0x53')){var _0x18a54e={};_0x18a54e[_0x371524['name']]={'$like':'%'+_0x20208d['query'][_0x425d('0x51')]+'%'};return _0x18a54e;}})});}_0x44d00f=_[_0x425d('0x52')]({},_0x44d00f,_0x20208d['options']);var _0xc19b92={'where':_0x44d00f[_0x425d('0x4f')]};return db[_0x425d('0x3f')][_0x425d('0x31')](_0xc19b92)['then'](function(_0x3543a9){_0x419e6d['count']=_0x3543a9;if(_0x20208d[_0x425d('0x45')][_0x425d('0x54')]){_0x44d00f['include']=[{'all':!![]}];}return db[_0x425d('0x3f')][_0x425d('0x55')](_0x44d00f);})[_0x425d('0x24')](function(_0x5eea07){_0x419e6d[_0x425d('0x56')]=_0x5eea07;return _0x419e6d;})[_0x425d('0x24')](respondWithFilteredResult(_0x1b98cf,_0x44d00f))[_0x425d('0x2c')](handleError(_0x1b98cf,null));};exports[_0x425d('0x57')]=function(_0x4807c5,_0x1ae843){var _0x136181={'raw':!![],'where':{'id':_0x4807c5[_0x425d('0x58')]['id']}},_0x220475={};_0x220475[_0x425d('0x44')]=_[_0x425d('0x46')](db[_0x425d('0x3f')][_0x425d('0x40')]);_0x220475[_0x425d('0x45')]=_[_0x425d('0x46')](_0x4807c5[_0x425d('0x45')]);_0x220475['filters']=_[_0x425d('0x49')](_0x220475[_0x425d('0x44')],_0x220475[_0x425d('0x45')]);_0x136181['attributes']=_[_0x425d('0x49')](_0x220475[_0x425d('0x44')],qs[_0x425d('0x4a')](_0x4807c5[_0x425d('0x45')]['fields']));_0x136181[_0x425d('0x48')]=_0x136181[_0x425d('0x48')][_0x425d('0x4b')]?_0x136181['attributes']:_0x220475[_0x425d('0x44')];if(_0x4807c5['query'][_0x425d('0x54')]){_0x136181[_0x425d('0x59')]=[{'all':!![]}];}_0x136181=_[_0x425d('0x52')]({},_0x136181,_0x4807c5[_0x425d('0x5a')]);return db[_0x425d('0x3f')][_0x425d('0x5b')](_0x136181)[_0x425d('0x24')](handleEntityNotFound(_0x1ae843,null))[_0x425d('0x24')](respondWithResult(_0x1ae843,null))[_0x425d('0x2c')](handleError(_0x1ae843,null));};exports['update']=function(_0x423a5b,_0x5d89fb){if(_0x423a5b[_0x425d('0x5c')]['id']){delete _0x423a5b['body']['id'];}return db[_0x425d('0x3f')]['find']({'where':{'id':_0x423a5b[_0x425d('0x58')]['id']}})[_0x425d('0x24')](handleEntityNotFound(_0x5d89fb,null))[_0x425d('0x24')](saveUpdates(_0x423a5b['body'],null))['then'](respondWithResult(_0x5d89fb,null))[_0x425d('0x2c')](handleError(_0x5d89fb,null));};exports['destroy']=function(_0x29f8a8,_0x7f6ae0){return db[_0x425d('0x3f')][_0x425d('0x5b')]({'where':{'id':_0x29f8a8[_0x425d('0x58')]['id']}})[_0x425d('0x24')](handleEntityNotFound(_0x7f6ae0,null))[_0x425d('0x24')](removeEntity(_0x7f6ae0,null))[_0x425d('0x2c')](handleError(_0x7f6ae0,null));};exports[_0x425d('0x5d')]=function(_0x23f3bf,_0x145e68){return db[_0x425d('0x3f')][_0x425d('0x5d')]()[_0x425d('0x24')](respondWithResult(_0x145e68,null))['catch'](handleError(_0x145e68,null));};var interaction_log=require(_0x425d('0x16'))(_0x425d('0x5e'));exports[_0x425d('0x5f')]=function(_0x12a0f2,_0x4d23ce,_0x346757){var _0x4d8219={'agent':{},'channel':_0x425d('0x60')};if(_0x12a0f2['body']['id']){delete _0x12a0f2[_0x425d('0x5c')]['id'];}_0x12a0f2['body'][_0x425d('0x61')]=!![];_0x12a0f2[_0x425d('0x5c')][_0x425d('0x62')]=moment()[_0x425d('0x63')](_0x425d('0x64'));_0x12a0f2['body'][_0x425d('0x65')]=_0x12a0f2[_0x425d('0x5c')][_0x425d('0x65')]||_0x12a0f2[_0x425d('0x66')]['id'];_0x4d8219['agent']['id']=_0x12a0f2[_0x425d('0x5c')][_0x425d('0x65')];return db['FaxMessage'][_0x425d('0x5b')]({'where':{'id':_0x12a0f2['params']['id'],'UserId':null}})[_0x425d('0x24')](handleEntityNotFound(_0x4d23ce,null))[_0x425d('0x24')](saveUpdates(_0x12a0f2[_0x425d('0x5c')],null))[_0x425d('0x24')](function(_0xed131c){if(_0xed131c){_0x4d8219[_0x425d('0x2b')]=_0xed131c[_0x425d('0x67')]({'plain':!![]});return db[_0x425d('0x68')]['find']({'where':{'id':_0xed131c[_0x425d('0x69')]}});}return null;})['then'](handleEntityNotFound(_0x4d23ce,null))[_0x425d('0x24')](function(_0x2705e3){if(_0x2705e3){return _0x2705e3['update']({'UserId':_0x12a0f2[_0x425d('0x5c')][_0x425d('0x65')],'read1stAt':_['isNil'](_0x2705e3[_0x425d('0x6a')])?moment()[_0x425d('0x63')](_0x425d('0x64')):undefined});}return null;})[_0x425d('0x24')](function(_0x57c3dd){if(_0x57c3dd){_0x4d8219['interaction']=_0x57c3dd[_0x425d('0x67')]({'plain':!![]});interaction_log['info'](_0x425d('0x6b'),_0x12a0f2[_0x425d('0x66')]['id'],_0x12a0f2['user'][_0x425d('0x6c')],_0x12a0f2[_0x425d('0x66')][_0x425d('0x6d')],_0x4d8219[_0x425d('0x6e')]['id'],_0x12a0f2[_0x425d('0x5c')]?JSON[_0x425d('0x28')](_0x12a0f2[_0x425d('0x5c')]):_0x425d('0x6f'));return respondWithRpcPromise(_0x425d('0x70'),'acceptMessage',_0x4d8219);}return null;})[_0x425d('0x24')](function(_0x2997a8){var _0x2c33ab=_0x425d('0x71')+_0x2997a8['message']['ContactId'];return db[_0x425d('0x72')][_0x425d('0x45')](_0x2c33ab,{'type':db[_0x425d('0x73')][_0x425d('0x74')]['SELECT'],'raw':!![]})[_0x425d('0x24')](function(_0x13b137){return _0x13b137;});})[_0x425d('0x24')](function(_0x4680df){if(_0x4680df){_0x4d8219[_0x425d('0x2b')]['contact']=_0x4680df[0x0];if(!_0x12a0f2[_0x425d('0x5c')][_0x425d('0x65')])return;return db[_0x425d('0x75')][_0x425d('0x5b')]({'where':{'id':_0x12a0f2['body']['UserId'],'role':'agent'},'attributes':['id',_0x425d('0x6c'),_0x425d('0x76'),_0x425d('0x77'),_0x425d('0x78')],'raw':!![]});}return null;})[_0x425d('0x24')](function(_0x219b54){if(!_0x219b54)return null;_0x4d8219[_0x425d('0x2b')][_0x425d('0x79')]=_0x219b54;return _0x4d8219;})[_0x425d('0x24')](function(_0x13233a){if(_0x13233a){if(_0x12a0f2[_0x425d('0x5c')]['manual']){_0x4d8219[_0x425d('0x2b')][_0x425d('0x7a')]=util[_0x425d('0x63')](_0x425d('0x7b'),_0x12a0f2['user'][_0x425d('0x6c')]);_0x4d8219[_0x425d('0x2b')][_0x425d('0x7c')]=_0x4d8219[_0x425d('0x7c')];_0x4d8219[_0x425d('0x2b')][_0x425d('0x7d')]=_0x4d8219[_0x425d('0x7c')];_0x4d8219['message'][_0x425d('0x7e')]=_0x425d('0x5f');return respondWithRpcPromise('EventManager',_0x425d('0x7f'),{'event':_0x425d('0x80'),'message':_0x4d8219[_0x425d('0x2b')]},client9002)['then'](function(){return _0x4d8219;});}return _0x4d8219;}return null;})[_0x425d('0x24')](respondWithResult(_0x4d23ce,null))[_0x425d('0x2c')](handleError(_0x4d23ce,null));};var interaction_log=require(_0x425d('0x16'))(_0x425d('0x5e'));exports['reject']=function(_0x478f20,_0x493f31,_0x3440a4){var _0xe2351f={'agent':{},'channel':_0x425d('0x60')};if(_0x478f20[_0x425d('0x5c')]['id']){delete _0x478f20[_0x425d('0x5c')]['id'];}_0x478f20['body']['UserId']=_0x478f20['body']['UserId']||_0x478f20[_0x425d('0x66')]['id'];_0xe2351f[_0x425d('0x79')]['id']=_0x478f20[_0x425d('0x5c')]['UserId'];return db[_0x425d('0x3f')][_0x425d('0x5b')]({'where':{'id':_0x478f20['params']['id'],'UserId':null}})[_0x425d('0x24')](handleEntityNotFound(_0x493f31,null))[_0x425d('0x24')](function(_0x4dbbb5){if(_0x4dbbb5){_0xe2351f[_0x425d('0x2b')]=_0x4dbbb5[_0x425d('0x67')]({'plain':!![]});return db['FaxInteraction']['find']({'where':{'id':_0x4dbbb5[_0x425d('0x69')]}});}return null;})[_0x425d('0x24')](handleEntityNotFound(_0x493f31,null))[_0x425d('0x24')](function(_0x5c99d5){if(_0x5c99d5){_0xe2351f['interaction']=_0x5c99d5[_0x425d('0x67')]({'plain':!![]});interaction_log['info'](_0x425d('0x81'),_0x478f20[_0x425d('0x66')]['id'],_0x478f20[_0x425d('0x66')][_0x425d('0x6c')],_0x478f20[_0x425d('0x66')][_0x425d('0x6d')],_0xe2351f[_0x425d('0x6e')]['id'],_0x478f20['body']?JSON['stringify'](_0x478f20[_0x425d('0x5c')]):_0x425d('0x6f'));return respondWithRpcPromise(_0x425d('0x82'),_0x425d('0x83'),_0xe2351f);}return null;})[_0x425d('0x24')](function(_0x403cc2){var _0x2a2066=_0x425d('0x71')+_0x403cc2[_0x425d('0x2b')][_0x425d('0x84')];return db['sequelize']['query'](_0x2a2066,{'type':db['Sequelize']['QueryTypes']['SELECT'],'raw':!![]})[_0x425d('0x24')](function(_0x3cda02){return _0x3cda02;});})[_0x425d('0x24')](function(_0x1c0890){if(_0x1c0890){_0xe2351f['message'][_0x425d('0x85')]=_0x1c0890[0x0];if(!_0x478f20[_0x425d('0x5c')][_0x425d('0x65')])return;return db[_0x425d('0x75')][_0x425d('0x5b')]({'where':{'id':_0x478f20[_0x425d('0x5c')][_0x425d('0x65')],'role':_0x425d('0x79')},'attributes':['id',_0x425d('0x6c'),'fullname',_0x425d('0x77'),_0x425d('0x78')],'raw':!![]});}return null;})['then'](function(_0x485fbf){if(!_0x485fbf)return null;_0xe2351f[_0x425d('0x2b')][_0x425d('0x79')]=_0x485fbf;return _0xe2351f;})['then'](function(_0x3a853a){if(_0x3a853a){_0x3a853a['message']['interface']=util[_0x425d('0x63')]('SIP/%s',_0x478f20['user'][_0x425d('0x6c')]);_0x3a853a[_0x425d('0x2b')][_0x425d('0x7c')]=_0xe2351f[_0x425d('0x7c')];_0x3a853a['message'][_0x425d('0x7d')]=_0xe2351f[_0x425d('0x7c')];_0x3a853a[_0x425d('0x2b')]['event']='reject';respondWithRpcPromise('EventManager',_0x425d('0x7f'),{'event':'rejectmessage','message':_0x3a853a['message']},client9002);return _0xe2351f;}return null;})[_0x425d('0x24')](respondWithResult(_0x493f31,null))[_0x425d('0x2c')](handleError(_0x493f31,null));};exports[_0x425d('0x86')]=function(_0x3c3812,_0x5957f3){var _0x44f3ed;return db[_0x425d('0x3f')][_0x425d('0x86')](_0x3c3812[_0x425d('0x5c')],{})[_0x425d('0x24')](function(_0x39e173){_0x44f3ed=_0x39e173;return db[_0x425d('0x87')][_0x425d('0x88')]({'where':{'id':_0x44f3ed['ContactId']}});})['then'](function(_0x5d43a4){if(_[_0x425d('0x89')](_0x5d43a4)){return;}else{_0x44f3ed['fax']=_0x5d43a4['fax'];return db['Attachment']['findOne']({'where':{'id':_0x44f3ed['AttachmentId']}});}})[_0x425d('0x24')](function(_0x26d13c){return respondWithRpcPromise(_0x425d('0x8a'),_0x425d('0x8a'),{'FaxAccountId':_['isNil'](_0x3c3812['body'])?undefined:_0x3c3812[_0x425d('0x5c')][_0x425d('0x8b')],'path':_[_0x425d('0x89')](_0x26d13c)?undefined:util[_0x425d('0x63')](_0x425d('0x8c'),_0x26d13c['basename']),'fax':_[_0x425d('0x89')](_0x44f3ed[_0x425d('0x60')])?undefined:_0x44f3ed['fax'],'AttachmentId':_0x44f3ed[_0x425d('0x8d')]},client9002);})['then'](respondWithResult(_0x5957f3,0xc9))[_0x425d('0x2c')](handleError(_0x5957f3,null));};exports['download']=function(_0x405327,_0x21c1da){var _0x278523=path[_0x425d('0x8e')](config[_0x425d('0x8f')],'server',_0x425d('0x90'),_0x425d('0x91'));return db[_0x425d('0x3f')][_0x425d('0x5b')]({'where':{'id':_0x405327[_0x425d('0x58')]['id']},'include':[{'model':db[_0x425d('0x92')],'as':_0x425d('0x92')}]})['then'](handleEntityNotFound(_0x21c1da,null))[_0x425d('0x24')](function(_0x4f65eb){if(_0x4f65eb){return _0x21c1da['download'](path[_0x425d('0x8e')](_0x278523,_0x4f65eb[_0x425d('0x92')]['basename']));}})[_0x425d('0x2c')](handleError(_0x21c1da,null));}; \ No newline at end of file +var _0xd056=['defaults','localhost','./faxMessage.socket','register','jayson/promise','client','http','request','then','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','sendStatus','stack','name','send','index','rawAttributes','fieldName','model','keys','filters','query','attributes','intersection','length','hasOwnProperty','sort','where','filter','merge','map','VIRTUAL','FaxMessage','count','includeAll','include','findAll','params','fields','options','find','body','destroy','describe','fax','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','FaxInteraction','FaxInteractionId','read1stAt','interaction','info','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','contact','fullname','email','manual','interface','SIP/%s','channel','motionChannel','EventManager','acceptmessage','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','ContactId','SELECT','User','internal','event','create','CmContact','findOne','isNil','Attachment','AttachmentId','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','download','join','root','files','attachments','basename','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis'];(function(_0x24a88e,_0x22a0b8){var _0x232cbb=function(_0x50b7a4){while(--_0x50b7a4){_0x24a88e['push'](_0x24a88e['shift']());}};_0x232cbb(++_0x22a0b8);}(_0xd056,0x74));var _0x6d05=function(_0x183b08,_0xa84ad0){_0x183b08=_0x183b08-0x0;var _0x515fd2=_0xd056[_0x183b08];return _0x515fd2;};'use strict';var emlformat=require(_0x6d05('0x0'));var rimraf=require(_0x6d05('0x1'));var zipdir=require(_0x6d05('0x2'));var jsonpatch=require(_0x6d05('0x3'));var rp=require(_0x6d05('0x4'));var moment=require(_0x6d05('0x5'));var BPromise=require(_0x6d05('0x6'));var Mustache=require(_0x6d05('0x7'));var util=require(_0x6d05('0x8'));var path=require(_0x6d05('0x9'));var sox=require('sox');var csv=require(_0x6d05('0xa'));var ejs=require(_0x6d05('0xb'));var fs=require('fs');var fs_extra=require(_0x6d05('0xc'));var _=require('lodash');var squel=require(_0x6d05('0xd'));var crypto=require(_0x6d05('0xe'));var jsforce=require(_0x6d05('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6d05('0x10'));var Papa=require(_0x6d05('0x11'));var Redis=require(_0x6d05('0x12'));var authService=require(_0x6d05('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x6d05('0x14'));var hardwareService=require(_0x6d05('0x15'));var logger=require(_0x6d05('0x16'))(_0x6d05('0x17'));var utils=require(_0x6d05('0x18'));var config=require(_0x6d05('0x19'));var licenseUtil=require(_0x6d05('0x1a'));var db=require(_0x6d05('0x1b'))['db'];config[_0x6d05('0x1c')]=_[_0x6d05('0x1d')](config[_0x6d05('0x1c')],{'host':_0x6d05('0x1e'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x6d05('0x1f'))[_0x6d05('0x20')](socket);var jayson=require(_0x6d05('0x21'));var client=jayson[_0x6d05('0x22')][_0x6d05('0x23')]({'port':0x232c});var client9002=jayson[_0x6d05('0x22')][_0x6d05('0x23')]({'port':0x232a});function respondWithRpcPromise(_0x413a7f,_0x2d0d7e,_0x497465,_0x32a596){return new BPromise(function(_0x1960ff,_0x413093){var _0xcc666=_0x32a596||client;return _0xcc666[_0x6d05('0x24')](_0x413a7f,_0x497465)[_0x6d05('0x25')](function(_0x205cf8){logger['info'](_0x6d05('0x26'),_0x2d0d7e,_0x6d05('0x27'));logger[_0x6d05('0x28')](_0x6d05('0x29'),_0x2d0d7e,'request\x20sent',JSON[_0x6d05('0x2a')](_0x205cf8));if(_0x205cf8[_0x6d05('0x2b')]){if(_0x205cf8['error'][_0x6d05('0x2c')]===0x1f4){logger[_0x6d05('0x2b')](_0x6d05('0x26'),_0x2d0d7e,_0x205cf8[_0x6d05('0x2b')][_0x6d05('0x2d')]);return _0x413093(_0x205cf8[_0x6d05('0x2b')][_0x6d05('0x2d')]);}logger[_0x6d05('0x2b')](_0x6d05('0x26'),_0x2d0d7e,_0x205cf8[_0x6d05('0x2b')][_0x6d05('0x2d')]);return _0x1960ff(_0x205cf8[_0x6d05('0x2b')][_0x6d05('0x2d')]);}else{logger['info']('FaxMessage,\x20%s,\x20%s',_0x2d0d7e,'request\x20sent');_0x1960ff(_0x205cf8['result'][_0x6d05('0x2d')]);}})[_0x6d05('0x2e')](function(_0x52f3cc){logger[_0x6d05('0x2b')](_0x6d05('0x26'),_0x2d0d7e,_0x52f3cc);_0x413093(_0x52f3cc);});});}function respondWithStatusCode(_0x481683,_0x46cd47){_0x46cd47=_0x46cd47||0xcc;return function(_0x4f9d0e){if(_0x4f9d0e){return _0x481683['sendStatus'](_0x46cd47);}return _0x481683[_0x6d05('0x2f')](_0x46cd47)[_0x6d05('0x30')]();};}function respondWithResult(_0x58b90b,_0xb6e24d){_0xb6e24d=_0xb6e24d||0xc8;return function(_0x1c3f80){if(_0x1c3f80){return _0x58b90b[_0x6d05('0x2f')](_0xb6e24d)[_0x6d05('0x31')](_0x1c3f80);}};}function respondWithFilteredResult(_0x3e848c,_0x431971){return function(_0x2e7670){if(_0x2e7670){var _0x591edc=typeof _0x431971[_0x6d05('0x32')]===_0x6d05('0x33')&&typeof _0x431971[_0x6d05('0x34')]==='undefined';var _0x2408d5=_0x2e7670['count'];var _0x285fbe=_0x591edc?0x0:_0x431971[_0x6d05('0x32')];var _0x2023ab=_0x591edc?_0x2e7670['count']:_0x431971[_0x6d05('0x32')]+_0x431971[_0x6d05('0x34')];var _0x5e8879;if(_0x2023ab>=_0x2408d5){_0x2023ab=_0x2408d5;_0x5e8879=0xc8;}else{_0x5e8879=0xce;}_0x3e848c[_0x6d05('0x2f')](_0x5e8879);return _0x3e848c[_0x6d05('0x35')](_0x6d05('0x36'),_0x285fbe+'-'+_0x2023ab+'/'+_0x2408d5)[_0x6d05('0x31')](_0x2e7670);}return null;};}function patchUpdates(_0x598fbf){return function(_0x6b785e){try{jsonpatch[_0x6d05('0x37')](_0x6b785e,_0x598fbf,!![]);}catch(_0x8b4968){return BPromise[_0x6d05('0x38')](_0x8b4968);}return _0x6b785e[_0x6d05('0x39')]();};}function saveUpdates(_0x372ae4,_0x3d6e92){return function(_0x1eff7c){if(_0x1eff7c){return _0x1eff7c[_0x6d05('0x3a')](_0x372ae4)[_0x6d05('0x25')](function(_0x4aab10){return _0x4aab10;});}return null;};}function removeEntity(_0x24fe0c,_0x3d6af9){return function(_0x4a4e9f){if(_0x4a4e9f){return _0x4a4e9f['destroy']()[_0x6d05('0x25')](function(){_0x24fe0c['status'](0xcc)[_0x6d05('0x30')]();});}};}function handleEntityNotFound(_0x4a411c,_0x35ad08){return function(_0xe81831){if(!_0xe81831){_0x4a411c[_0x6d05('0x3b')](0x194);}return _0xe81831;};}function handleError(_0x58432d,_0x2ee755){_0x2ee755=_0x2ee755||0x1f4;return function(_0x137758){logger[_0x6d05('0x2b')](_0x137758[_0x6d05('0x3c')]);if(_0x137758['name']){delete _0x137758[_0x6d05('0x3d')];}_0x58432d['status'](_0x2ee755)[_0x6d05('0x3e')](_0x137758);};}exports[_0x6d05('0x3f')]=function(_0x5a02c8,_0x1f2be6){var _0x1daf2f={},_0x51c272={},_0x599408={'count':0x0,'rows':[]};var _0x2566a3=_['map'](db['FaxMessage'][_0x6d05('0x40')],function(_0x4d792f){return{'name':_0x4d792f[_0x6d05('0x41')],'type':_0x4d792f['type']['key']};});_0x51c272[_0x6d05('0x42')]=_['map'](_0x2566a3,_0x6d05('0x3d'));_0x51c272['query']=_[_0x6d05('0x43')](_0x5a02c8['query']);_0x51c272[_0x6d05('0x44')]=_['intersection'](_0x51c272['model'],_0x51c272[_0x6d05('0x45')]);_0x1daf2f[_0x6d05('0x46')]=_[_0x6d05('0x47')](_0x51c272[_0x6d05('0x42')],qs['fields'](_0x5a02c8[_0x6d05('0x45')]['fields']));_0x1daf2f['attributes']=_0x1daf2f[_0x6d05('0x46')][_0x6d05('0x48')]?_0x1daf2f['attributes']:_0x51c272[_0x6d05('0x42')];if(!_0x5a02c8[_0x6d05('0x45')][_0x6d05('0x49')]('nolimit')){_0x1daf2f['limit']=qs[_0x6d05('0x34')](_0x5a02c8[_0x6d05('0x45')][_0x6d05('0x34')]);_0x1daf2f[_0x6d05('0x32')]=qs[_0x6d05('0x32')](_0x5a02c8[_0x6d05('0x45')][_0x6d05('0x32')]);}_0x1daf2f['order']=qs[_0x6d05('0x4a')](_0x5a02c8['query'][_0x6d05('0x4a')]);_0x1daf2f[_0x6d05('0x4b')]=qs[_0x6d05('0x44')](_['pick'](_0x5a02c8[_0x6d05('0x45')],_0x51c272[_0x6d05('0x44')]),_0x2566a3);if(_0x5a02c8[_0x6d05('0x45')][_0x6d05('0x4c')]){_0x1daf2f[_0x6d05('0x4b')]=_[_0x6d05('0x4d')](_0x1daf2f[_0x6d05('0x4b')],{'$or':_[_0x6d05('0x4e')](_0x2566a3,function(_0xc744de){if(_0xc744de['type']!==_0x6d05('0x4f')){var _0x1ce9d7={};_0x1ce9d7[_0xc744de[_0x6d05('0x3d')]]={'$like':'%'+_0x5a02c8['query'][_0x6d05('0x4c')]+'%'};return _0x1ce9d7;}})});}_0x1daf2f=_[_0x6d05('0x4d')]({},_0x1daf2f,_0x5a02c8['options']);var _0x2c2747={'where':_0x1daf2f[_0x6d05('0x4b')]};return db[_0x6d05('0x50')][_0x6d05('0x51')](_0x2c2747)[_0x6d05('0x25')](function(_0x3fe9d5){_0x599408['count']=_0x3fe9d5;if(_0x5a02c8[_0x6d05('0x45')][_0x6d05('0x52')]){_0x1daf2f[_0x6d05('0x53')]=[{'all':!![]}];}return db[_0x6d05('0x50')][_0x6d05('0x54')](_0x1daf2f);})[_0x6d05('0x25')](function(_0x167151){_0x599408['rows']=_0x167151;return _0x599408;})[_0x6d05('0x25')](respondWithFilteredResult(_0x1f2be6,_0x1daf2f))['catch'](handleError(_0x1f2be6,null));};exports['show']=function(_0xc46e01,_0x192fe0){var _0x3ece23={'raw':!![],'where':{'id':_0xc46e01[_0x6d05('0x55')]['id']}},_0x25c6db={};_0x25c6db['model']=_[_0x6d05('0x43')](db[_0x6d05('0x50')]['rawAttributes']);_0x25c6db[_0x6d05('0x45')]=_[_0x6d05('0x43')](_0xc46e01['query']);_0x25c6db[_0x6d05('0x44')]=_[_0x6d05('0x47')](_0x25c6db[_0x6d05('0x42')],_0x25c6db['query']);_0x3ece23[_0x6d05('0x46')]=_[_0x6d05('0x47')](_0x25c6db['model'],qs['fields'](_0xc46e01[_0x6d05('0x45')][_0x6d05('0x56')]));_0x3ece23['attributes']=_0x3ece23[_0x6d05('0x46')][_0x6d05('0x48')]?_0x3ece23[_0x6d05('0x46')]:_0x25c6db[_0x6d05('0x42')];if(_0xc46e01['query'][_0x6d05('0x52')]){_0x3ece23[_0x6d05('0x53')]=[{'all':!![]}];}_0x3ece23=_[_0x6d05('0x4d')]({},_0x3ece23,_0xc46e01[_0x6d05('0x57')]);return db[_0x6d05('0x50')][_0x6d05('0x58')](_0x3ece23)['then'](handleEntityNotFound(_0x192fe0,null))[_0x6d05('0x25')](respondWithResult(_0x192fe0,null))['catch'](handleError(_0x192fe0,null));};exports['update']=function(_0x1720e8,_0x4bcd44){if(_0x1720e8[_0x6d05('0x59')]['id']){delete _0x1720e8['body']['id'];}return db['FaxMessage'][_0x6d05('0x58')]({'where':{'id':_0x1720e8[_0x6d05('0x55')]['id']}})[_0x6d05('0x25')](handleEntityNotFound(_0x4bcd44,null))[_0x6d05('0x25')](saveUpdates(_0x1720e8['body'],null))[_0x6d05('0x25')](respondWithResult(_0x4bcd44,null))[_0x6d05('0x2e')](handleError(_0x4bcd44,null));};exports[_0x6d05('0x5a')]=function(_0x1dca67,_0x245169){return db['FaxMessage'][_0x6d05('0x58')]({'where':{'id':_0x1dca67[_0x6d05('0x55')]['id']}})[_0x6d05('0x25')](handleEntityNotFound(_0x245169,null))[_0x6d05('0x25')](removeEntity(_0x245169,null))[_0x6d05('0x2e')](handleError(_0x245169,null));};exports[_0x6d05('0x5b')]=function(_0x294397,_0x4cb3bd){return db['FaxMessage'][_0x6d05('0x5b')]()['then'](respondWithResult(_0x4cb3bd,null))['catch'](handleError(_0x4cb3bd,null));};var interaction_log=require(_0x6d05('0x16'))('fax-interactions');exports['accept']=function(_0x2e8174,_0x120f66,_0x1c1c2e){var _0x1a59dd={'agent':{},'channel':_0x6d05('0x5c')};if(_0x2e8174[_0x6d05('0x59')]['id']){delete _0x2e8174['body']['id'];}_0x2e8174[_0x6d05('0x59')][_0x6d05('0x5d')]=!![];_0x2e8174['body']['readAt']=moment()[_0x6d05('0x5e')](_0x6d05('0x5f'));_0x2e8174[_0x6d05('0x59')]['UserId']=_0x2e8174[_0x6d05('0x59')][_0x6d05('0x60')]||_0x2e8174['user']['id'];_0x1a59dd[_0x6d05('0x61')]['id']=_0x2e8174[_0x6d05('0x59')][_0x6d05('0x60')];return db[_0x6d05('0x50')][_0x6d05('0x58')]({'where':{'id':_0x2e8174[_0x6d05('0x55')]['id'],'UserId':null}})[_0x6d05('0x25')](handleEntityNotFound(_0x120f66,null))['then'](saveUpdates(_0x2e8174['body'],null))[_0x6d05('0x25')](function(_0x5719c6){if(_0x5719c6){_0x1a59dd[_0x6d05('0x2d')]=_0x5719c6[_0x6d05('0x62')]({'plain':!![]});return db[_0x6d05('0x63')]['find']({'where':{'id':_0x5719c6[_0x6d05('0x64')]}});}return null;})[_0x6d05('0x25')](handleEntityNotFound(_0x120f66,null))[_0x6d05('0x25')](function(_0x2a8d7f){if(_0x2a8d7f){return _0x2a8d7f[_0x6d05('0x3a')]({'UserId':_0x2e8174[_0x6d05('0x59')][_0x6d05('0x60')],'read1stAt':_['isNil'](_0x2a8d7f[_0x6d05('0x65')])?moment()['format'](_0x6d05('0x5f')):undefined});}return null;})['then'](function(_0xd8d2a1){if(_0xd8d2a1){_0x1a59dd[_0x6d05('0x66')]=_0xd8d2a1['get']({'plain':!![]});interaction_log[_0x6d05('0x67')](_0x6d05('0x68'),_0x2e8174[_0x6d05('0x69')]['id'],_0x2e8174[_0x6d05('0x69')][_0x6d05('0x3d')],_0x2e8174['user'][_0x6d05('0x6a')],_0x1a59dd['interaction']['id'],_0x2e8174[_0x6d05('0x59')]?JSON['stringify'](_0x2e8174[_0x6d05('0x59')]):'null');return respondWithRpcPromise(_0x6d05('0x6b'),_0x6d05('0x6c'),_0x1a59dd);}return null;})['then'](function(_0x1b458d){var _0x517b9f=_0x6d05('0x6d')+_0x1b458d[_0x6d05('0x2d')]['ContactId'];return db[_0x6d05('0x6e')][_0x6d05('0x45')](_0x517b9f,{'type':db[_0x6d05('0x6f')][_0x6d05('0x70')]['SELECT'],'raw':!![]})[_0x6d05('0x25')](function(_0x25e841){return _0x25e841;});})[_0x6d05('0x25')](function(_0x56afdf){if(_0x56afdf){_0x1a59dd[_0x6d05('0x2d')][_0x6d05('0x71')]=_0x56afdf[0x0];if(!_0x2e8174[_0x6d05('0x59')][_0x6d05('0x60')])return;return db['User'][_0x6d05('0x58')]({'where':{'id':_0x2e8174[_0x6d05('0x59')][_0x6d05('0x60')],'role':'agent'},'attributes':['id',_0x6d05('0x3d'),_0x6d05('0x72'),_0x6d05('0x73'),'internal'],'raw':!![]});}return null;})[_0x6d05('0x25')](function(_0x10a6c0){if(!_0x10a6c0)return null;_0x1a59dd[_0x6d05('0x2d')][_0x6d05('0x61')]=_0x10a6c0;return _0x1a59dd;})[_0x6d05('0x25')](function(_0x254975){if(_0x254975){if(_0x2e8174[_0x6d05('0x59')][_0x6d05('0x74')]){_0x1a59dd[_0x6d05('0x2d')][_0x6d05('0x75')]=util['format'](_0x6d05('0x76'),_0x2e8174['user'][_0x6d05('0x3d')]);_0x1a59dd['message'][_0x6d05('0x77')]=_0x1a59dd['channel'];_0x1a59dd[_0x6d05('0x2d')][_0x6d05('0x78')]=_0x1a59dd[_0x6d05('0x77')];_0x1a59dd[_0x6d05('0x2d')]['event']='accept';return respondWithRpcPromise(_0x6d05('0x79'),'EventManager',{'event':_0x6d05('0x7a'),'message':_0x1a59dd[_0x6d05('0x2d')]},client9002)[_0x6d05('0x25')](function(){return _0x1a59dd;});}return _0x1a59dd;}return null;})[_0x6d05('0x25')](respondWithResult(_0x120f66,null))['catch'](handleError(_0x120f66,null));};var interaction_log=require('../../config/logger')('fax-interactions');exports[_0x6d05('0x38')]=function(_0x20101d,_0xed23c8,_0x7ea906){var _0x10fd7a={'agent':{},'channel':_0x6d05('0x5c')};if(_0x20101d[_0x6d05('0x59')]['id']){delete _0x20101d[_0x6d05('0x59')]['id'];}_0x20101d[_0x6d05('0x59')][_0x6d05('0x60')]=_0x20101d[_0x6d05('0x59')][_0x6d05('0x60')]||_0x20101d[_0x6d05('0x69')]['id'];_0x10fd7a['agent']['id']=_0x20101d[_0x6d05('0x59')][_0x6d05('0x60')];return db[_0x6d05('0x50')][_0x6d05('0x58')]({'where':{'id':_0x20101d[_0x6d05('0x55')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0xed23c8,null))[_0x6d05('0x25')](function(_0x12096a){if(_0x12096a){_0x10fd7a[_0x6d05('0x2d')]=_0x12096a[_0x6d05('0x62')]({'plain':!![]});return db[_0x6d05('0x63')]['find']({'where':{'id':_0x12096a[_0x6d05('0x64')]}});}return null;})[_0x6d05('0x25')](handleEntityNotFound(_0xed23c8,null))[_0x6d05('0x25')](function(_0x566196){if(_0x566196){_0x10fd7a[_0x6d05('0x66')]=_0x566196[_0x6d05('0x62')]({'plain':!![]});interaction_log[_0x6d05('0x67')](_0x6d05('0x7b'),_0x20101d[_0x6d05('0x69')]['id'],_0x20101d['user'][_0x6d05('0x3d')],_0x20101d[_0x6d05('0x69')]['role'],_0x10fd7a['interaction']['id'],_0x20101d['body']?JSON[_0x6d05('0x2a')](_0x20101d['body']):_0x6d05('0x7c'));return respondWithRpcPromise(_0x6d05('0x7d'),'rejectMessage',_0x10fd7a);}return null;})[_0x6d05('0x25')](function(_0xa829d3){var _0x419836=_0x6d05('0x6d')+_0xa829d3[_0x6d05('0x2d')][_0x6d05('0x7e')];return db['sequelize'][_0x6d05('0x45')](_0x419836,{'type':db[_0x6d05('0x6f')][_0x6d05('0x70')][_0x6d05('0x7f')],'raw':!![]})['then'](function(_0x22e274){return _0x22e274;});})[_0x6d05('0x25')](function(_0x39eb9c){if(_0x39eb9c){_0x10fd7a[_0x6d05('0x2d')]['contact']=_0x39eb9c[0x0];if(!_0x20101d[_0x6d05('0x59')][_0x6d05('0x60')])return;return db[_0x6d05('0x80')][_0x6d05('0x58')]({'where':{'id':_0x20101d['body'][_0x6d05('0x60')],'role':_0x6d05('0x61')},'attributes':['id',_0x6d05('0x3d'),_0x6d05('0x72'),_0x6d05('0x73'),_0x6d05('0x81')],'raw':!![]});}return null;})[_0x6d05('0x25')](function(_0x170542){if(!_0x170542)return null;_0x10fd7a[_0x6d05('0x2d')][_0x6d05('0x61')]=_0x170542;return _0x10fd7a;})[_0x6d05('0x25')](function(_0x1016b2){if(_0x1016b2){_0x1016b2[_0x6d05('0x2d')][_0x6d05('0x75')]=util[_0x6d05('0x5e')](_0x6d05('0x76'),_0x20101d['user'][_0x6d05('0x3d')]);_0x1016b2[_0x6d05('0x2d')]['channel']=_0x10fd7a[_0x6d05('0x77')];_0x1016b2[_0x6d05('0x2d')][_0x6d05('0x78')]=_0x10fd7a['channel'];_0x1016b2[_0x6d05('0x2d')][_0x6d05('0x82')]=_0x6d05('0x38');respondWithRpcPromise(_0x6d05('0x79'),'EventManager',{'event':'rejectmessage','message':_0x1016b2[_0x6d05('0x2d')]},client9002);return _0x10fd7a;}return null;})[_0x6d05('0x25')](respondWithResult(_0xed23c8,null))['catch'](handleError(_0xed23c8,null));};exports['create']=function(_0x56760b,_0x53af53){var _0x439c1c;return db[_0x6d05('0x50')][_0x6d05('0x83')](_0x56760b['body'],{})[_0x6d05('0x25')](function(_0x7f7d15){_0x439c1c=_0x7f7d15;return db[_0x6d05('0x84')][_0x6d05('0x85')]({'where':{'id':_0x439c1c[_0x6d05('0x7e')]}});})['then'](function(_0x58c9e4){if(_[_0x6d05('0x86')](_0x58c9e4)){return;}else{_0x439c1c[_0x6d05('0x5c')]=_0x58c9e4[_0x6d05('0x5c')];return db[_0x6d05('0x87')]['findOne']({'where':{'id':_0x439c1c[_0x6d05('0x88')]}});}})[_0x6d05('0x25')](function(_0x494742){return respondWithRpcPromise('SendFax','SendFax',{'FaxAccountId':_['isNil'](_0x56760b[_0x6d05('0x59')])?undefined:_0x56760b['body'][_0x6d05('0x89')],'path':_[_0x6d05('0x86')](_0x494742)?undefined:util[_0x6d05('0x5e')](_0x6d05('0x8a'),_0x494742['basename']),'fax':_[_0x6d05('0x86')](_0x439c1c[_0x6d05('0x5c')])?undefined:_0x439c1c[_0x6d05('0x5c')],'AttachmentId':_0x439c1c[_0x6d05('0x88')]},client9002);})[_0x6d05('0x25')](respondWithResult(_0x53af53,0xc9))['catch'](handleError(_0x53af53,null));};exports[_0x6d05('0x8b')]=function(_0x33c3aa,_0x21ad50){var _0x43609f=path[_0x6d05('0x8c')](config[_0x6d05('0x8d')],'server',_0x6d05('0x8e'),_0x6d05('0x8f'));return db[_0x6d05('0x50')][_0x6d05('0x58')]({'where':{'id':_0x33c3aa['params']['id']},'include':[{'model':db['Attachment'],'as':'Attachment'}]})['then'](handleEntityNotFound(_0x21ad50,null))[_0x6d05('0x25')](function(_0x5d3e67){if(_0x5d3e67){return _0x21ad50[_0x6d05('0x8b')](path[_0x6d05('0x8c')](_0x43609f,_0x5d3e67[_0x6d05('0x87')][_0x6d05('0x90')]));}})['catch'](handleError(_0x21ad50,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 005dce4..b37dbd1 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 _0x1fa9=['save','update','remove','emit','hook','exports','events','FaxMessage'];(function(_0x135c3d,_0xf4d149){var _0x23c7ea=function(_0x2de680){while(--_0x2de680){_0x135c3d['push'](_0x135c3d['shift']());}};_0x23c7ea(++_0xf4d149);}(_0x1fa9,0x136));var _0x91fa=function(_0x30ec7b,_0x86d660){_0x30ec7b=_0x30ec7b-0x0;var _0x1813d4=_0x1fa9[_0x30ec7b];return _0x1813d4;};'use strict';var EventEmitter=require(_0x91fa('0x0'));var FaxMessage=require('../../mysqldb')['db'][_0x91fa('0x1')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x91fa('0x2'),'afterUpdate':_0x91fa('0x3'),'afterDestroy':_0x91fa('0x4')};function emitEvent(_0x57f230){return function(_0x191166,_0x33b35a,_0x4779be){FaxMessageEvents[_0x91fa('0x5')](_0x57f230+':'+_0x191166['id'],_0x191166);FaxMessageEvents[_0x91fa('0x5')](_0x57f230,_0x191166);_0x4779be(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxMessage[_0x91fa('0x6')](e,emitEvent(event));}}module[_0x91fa('0x7')]=FaxMessageEvents; \ No newline at end of file +var _0x71ad=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','update','remove'];(function(_0x445d48,_0x14c018){var _0x212bd8=function(_0x23f7e9){while(--_0x23f7e9){_0x445d48['push'](_0x445d48['shift']());}};_0x212bd8(++_0x14c018);}(_0x71ad,0xee));var _0xd71a=function(_0x5d1df2,_0x11d401){_0x5d1df2=_0x5d1df2-0x0;var _0x2e5cfe=_0x71ad[_0x5d1df2];return _0x2e5cfe;};'use strict';var EventEmitter=require(_0xd71a('0x0'));var FaxMessage=require(_0xd71a('0x1'))['db']['FaxMessage'];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0xd71a('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xd71a('0x3'),'afterDestroy':_0xd71a('0x4')};function emitEvent(_0x4861ef){return function(_0x3976b4,_0x5192c5,_0x51626c){FaxMessageEvents[_0xd71a('0x5')](_0x4861ef+':'+_0x3976b4['id'],_0x3976b4);FaxMessageEvents['emit'](_0x4861ef,_0x3976b4);_0x51626c(null);};}for(var e in events){if(events[_0xd71a('0x6')](e)){var event=events[e];FaxMessage[_0xd71a('0x7')](e,emitEvent(event));}}module[_0xd71a('0x8')]=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index 956f2a3..694e905 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 _0x3d55=['../../config/environment','./faxMessage.attributes','exports','fax_messages','fti_fax_messages','FULLTEXT','get','direction','toLowerCase','out','UserId','FaxInteraction','findOne','FaxInteractionId','then','createdAt','catch','error','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x3070dc,_0x40cf11){var _0x431489=function(_0x49bc2a){while(--_0x49bc2a){_0x3070dc['push'](_0x3070dc['shift']());}};_0x431489(++_0x40cf11);}(_0x3d55,0x165));var _0x53d5=function(_0x3073c5,_0x426ccc){_0x3073c5=_0x3073c5-0x0;var _0x35f385=_0x3d55[_0x3073c5];return _0x35f385;};'use strict';var _=require(_0x53d5('0x0'));var util=require(_0x53d5('0x1'));var logger=require(_0x53d5('0x2'))('api');var moment=require(_0x53d5('0x3'));var BPromise=require(_0x53d5('0x4'));var rp=require(_0x53d5('0x5'));var fs=require('fs');var path=require(_0x53d5('0x6'));var rimraf=require('rimraf');var config=require(_0x53d5('0x7'));var attributes=require(_0x53d5('0x8'));module[_0x53d5('0x9')]=function(_0x2d526b,_0xc24d34){return _0x2d526b['define']('FaxMessage',attributes,{'tableName':_0x53d5('0xa'),'paranoid':![],'indexes':[{'name':_0x53d5('0xb'),'fields':['body'],'type':_0x53d5('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x32207b,_0x43723a,_0x49f919){var _0x44a278=_0x2d526b['models'];var _0x55d7bc=_0x32207b[_0x53d5('0xd')]({'plain':!![]});if(_0x55d7bc[_0x53d5('0xe')][_0x53d5('0xf')]()==='in'||_0x55d7bc['direction'][_0x53d5('0xf')]()===_0x53d5('0x10')&&!_0x55d7bc['secret']&&!_['isNil'](_0x55d7bc[_0x53d5('0x11')])){_0x44a278[_0x53d5('0x12')][_0x53d5('0x13')]({'where':{'id':_0x55d7bc[_0x53d5('0x14')]}})[_0x53d5('0x15')](function(_0x10caf4){if(_0x10caf4){_0x10caf4['update']({'lastMsgAt':_0x55d7bc[_0x53d5('0x16')],'lastMsgDirection':_0x55d7bc[_0x53d5('0xe')][_0x53d5('0xf')]()});}})[_0x53d5('0x17')](function(_0x3b3c85){console[_0x53d5('0x18')](_0x3b3c85);});}_0x49f919();}},'charset':'utf8mb4','collate':_0x53d5('0x19')});}; \ No newline at end of file +var _0x32bd=['bluebird','request-promise','path','rimraf','../../config/environment','./faxMessage.attributes','exports','FaxMessage','fax_messages','fti_fax_messages','FULLTEXT','get','toLowerCase','direction','out','secret','isNil','FaxInteraction','FaxInteractionId','then','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','../../config/logger','api'];(function(_0x342baa,_0x4a110f){var _0x1208f3=function(_0x56a645){while(--_0x56a645){_0x342baa['push'](_0x342baa['shift']());}};_0x1208f3(++_0x4a110f);}(_0x32bd,0x6e));var _0xd32b=function(_0x4f7798,_0x2a289e){_0x4f7798=_0x4f7798-0x0;var _0x548da8=_0x32bd[_0x4f7798];return _0x548da8;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xd32b('0x0'))(_0xd32b('0x1'));var moment=require('moment');var BPromise=require(_0xd32b('0x2'));var rp=require(_0xd32b('0x3'));var fs=require('fs');var path=require(_0xd32b('0x4'));var rimraf=require(_0xd32b('0x5'));var config=require(_0xd32b('0x6'));var attributes=require(_0xd32b('0x7'));module[_0xd32b('0x8')]=function(_0x4bb2f3,_0xda4ea4){return _0x4bb2f3['define'](_0xd32b('0x9'),attributes,{'tableName':_0xd32b('0xa'),'paranoid':![],'indexes':[{'name':_0xd32b('0xb'),'fields':['body'],'type':_0xd32b('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0xe74c7f,_0x507521,_0x43941b){var _0x4ed2af=_0x4bb2f3['models'];var _0x3f4839=_0xe74c7f[_0xd32b('0xd')]({'plain':!![]});if(_0x3f4839['direction'][_0xd32b('0xe')]()==='in'||_0x3f4839[_0xd32b('0xf')][_0xd32b('0xe')]()===_0xd32b('0x10')&&!_0x3f4839[_0xd32b('0x11')]&&!_[_0xd32b('0x12')](_0x3f4839['UserId'])){_0x4ed2af[_0xd32b('0x13')]['findOne']({'where':{'id':_0x3f4839[_0xd32b('0x14')]}})[_0xd32b('0x15')](function(_0x2c9dec){if(_0x2c9dec){_0x2c9dec[_0xd32b('0x16')]({'lastMsgAt':_0x3f4839[_0xd32b('0x17')],'lastMsgDirection':_0x3f4839[_0xd32b('0xf')][_0xd32b('0xe')]()});}})[_0xd32b('0x18')](function(_0x48fc03){console[_0xd32b('0x19')](_0x48fc03);});}_0x43941b();}},'charset':_0xd32b('0x1a'),'collate':_0xd32b('0x1b')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index 4b3c209..7217cea 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 _0xf3cd=['redis','defaults','socket.io-emitter','register','request','then','info','FaxMessage,\x20%s,\x20%s','debug','FaxMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateFaxMessage','body','options','raw','UpdateFaxMessage','FaxMessage','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x455433,_0x34fdb5){var _0x50d9d2=function(_0x254b3f){while(--_0x254b3f){_0x455433['push'](_0x455433['shift']());}};_0x50d9d2(++_0x34fdb5);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x1a2d1c,_0x4a1873){_0x1a2d1c=_0x1a2d1c-0x0;var _0x56eb67=_0xf3cd[_0x1a2d1c];return _0x56eb67;};'use strict';var _=require(_0xdf3c('0x0'));var util=require(_0xdf3c('0x1'));var moment=require(_0xdf3c('0x2'));var BPromise=require(_0xdf3c('0x3'));var rs=require(_0xdf3c('0x4'));var fs=require('fs');var Redis=require(_0xdf3c('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xdf3c('0x6'));var logger=require(_0xdf3c('0x7'))(_0xdf3c('0x8'));var config=require('../../config/environment');var jayson=require(_0xdf3c('0x9'));var client=jayson[_0xdf3c('0xa')][_0xdf3c('0xb')]({'port':0x232a});config[_0xdf3c('0xc')]=_[_0xdf3c('0xd')](config[_0xdf3c('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0xdf3c('0xe'))(new Redis(config['redis']));require('./faxMessage.socket')[_0xdf3c('0xf')](socket);function respondWithRpcPromise(_0x981616,_0x5ef936,_0x1dba4c){return new BPromise(function(_0x205f33,_0x2d420c){return client[_0xdf3c('0x10')](_0x981616,_0x1dba4c)[_0xdf3c('0x11')](function(_0x1c456b){logger[_0xdf3c('0x12')](_0xdf3c('0x13'),_0x5ef936,'request\x20sent');logger[_0xdf3c('0x14')](_0xdf3c('0x15'),_0x5ef936,_0xdf3c('0x16'),JSON[_0xdf3c('0x17')](_0x1c456b));if(_0x1c456b['error']){if(_0x1c456b[_0xdf3c('0x18')][_0xdf3c('0x19')]===0x1f4){logger[_0xdf3c('0x18')]('FaxMessage,\x20%s,\x20%s',_0x5ef936,_0x1c456b[_0xdf3c('0x18')][_0xdf3c('0x1a')]);return _0x2d420c(_0x1c456b[_0xdf3c('0x18')][_0xdf3c('0x1a')]);}logger[_0xdf3c('0x18')](_0xdf3c('0x13'),_0x5ef936,_0x1c456b[_0xdf3c('0x18')][_0xdf3c('0x1a')]);return _0x205f33(_0x1c456b[_0xdf3c('0x18')][_0xdf3c('0x1a')]);}else{logger['info'](_0xdf3c('0x13'),_0x5ef936,_0xdf3c('0x16'));_0x205f33(_0x1c456b[_0xdf3c('0x1b')][_0xdf3c('0x1a')]);}})[_0xdf3c('0x1c')](function(_0x113b56){logger[_0xdf3c('0x18')](_0xdf3c('0x13'),_0x5ef936,_0x113b56);_0x2d420c(_0x113b56);});});}exports[_0xdf3c('0x1d')]=function(_0x18fb5f){var _0x267488=this;return new Promise(function(_0x3d14cc,_0x25487c){return db['FaxMessage']['create'](_0x18fb5f[_0xdf3c('0x1e')],{'raw':_0x18fb5f['options']?_0x18fb5f[_0xdf3c('0x1f')][_0xdf3c('0x20')]===undefined?!![]:![]:!![]})[_0xdf3c('0x11')](function(_0x38b319){logger[_0xdf3c('0x12')](_0xdf3c('0x1d'),_0x18fb5f);logger['debug'](_0xdf3c('0x1d'),_0x18fb5f,JSON[_0xdf3c('0x17')](_0x38b319));_0x3d14cc(_0x38b319);})[_0xdf3c('0x1c')](function(_0x24754a){logger[_0xdf3c('0x18')](_0xdf3c('0x1d'),_0x24754a[_0xdf3c('0x1a')],_0x18fb5f);_0x25487c(_0x267488[_0xdf3c('0x18')](0x1f4,_0x24754a[_0xdf3c('0x1a')]));});});};exports[_0xdf3c('0x21')]=function(_0x4c076c){var _0xd284d7=this;return new Promise(function(_0x153daa,_0x4b57a4){return db[_0xdf3c('0x22')]['update'](_0x4c076c['body'],{'raw':_0x4c076c['options']?_0x4c076c[_0xdf3c('0x1f')][_0xdf3c('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4c076c['options']?_0x4c076c['options'][_0xdf3c('0x23')]||null:null,'attributes':_0x4c076c[_0xdf3c('0x1f')]?_0x4c076c[_0xdf3c('0x1f')][_0xdf3c('0x24')]||null:null,'limit':_0x4c076c['options']?_0x4c076c[_0xdf3c('0x1f')][_0xdf3c('0x25')]||null:null})['then'](function(_0x51e0a4){logger[_0xdf3c('0x12')](_0xdf3c('0x21'),_0x4c076c);logger[_0xdf3c('0x14')]('UpdateFaxMessage',_0x4c076c,JSON[_0xdf3c('0x17')](_0x51e0a4));_0x153daa(_0x51e0a4);})[_0xdf3c('0x1c')](function(_0x21e7b8){logger[_0xdf3c('0x18')]('UpdateFaxMessage',_0x21e7b8[_0xdf3c('0x1a')],_0x4c076c);_0x4b57a4(_0xd284d7[_0xdf3c('0x18')](0x1f4,_0x21e7b8['message']));});});}; \ No newline at end of file +var _0xe14d=['code','message','result','catch','FaxMessage','create','body','options','raw','CreateFaxMessage','UpdateFaxMessage','update','attributes','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./faxMessage.socket','register','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x32b5da,_0x45d994){var _0x1304ab=function(_0x30b6e6){while(--_0x30b6e6){_0x32b5da['push'](_0x32b5da['shift']());}};_0x1304ab(++_0x45d994);}(_0xe14d,0x1ee));var _0xde14=function(_0x266618,_0x18f637){_0x266618=_0x266618-0x0;var _0x54dbf5=_0xe14d[_0x266618];return _0x54dbf5;};'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});config['redis']=_['defaults'](config[_0xde14('0xc')],{'host':_0xde14('0xd'),'port':0x18eb});var socket=require(_0xde14('0xe'))(new Redis(config[_0xde14('0xc')]));require(_0xde14('0xf'))[_0xde14('0x10')](socket);function respondWithRpcPromise(_0xa17e8,_0x1ce0a2,_0x4b2b15){return new BPromise(function(_0x1a7167,_0xe785fb){return client[_0xde14('0x11')](_0xa17e8,_0x4b2b15)[_0xde14('0x12')](function(_0x8e0e){logger[_0xde14('0x13')](_0xde14('0x14'),_0x1ce0a2,_0xde14('0x15'));logger[_0xde14('0x16')](_0xde14('0x17'),_0x1ce0a2,_0xde14('0x15'),JSON[_0xde14('0x18')](_0x8e0e));if(_0x8e0e[_0xde14('0x19')]){if(_0x8e0e[_0xde14('0x19')][_0xde14('0x1a')]===0x1f4){logger['error']('FaxMessage,\x20%s,\x20%s',_0x1ce0a2,_0x8e0e[_0xde14('0x19')][_0xde14('0x1b')]);return _0xe785fb(_0x8e0e[_0xde14('0x19')]['message']);}logger[_0xde14('0x19')](_0xde14('0x14'),_0x1ce0a2,_0x8e0e[_0xde14('0x19')][_0xde14('0x1b')]);return _0x1a7167(_0x8e0e[_0xde14('0x19')][_0xde14('0x1b')]);}else{logger[_0xde14('0x13')](_0xde14('0x14'),_0x1ce0a2,_0xde14('0x15'));_0x1a7167(_0x8e0e[_0xde14('0x1c')]['message']);}})[_0xde14('0x1d')](function(_0x3bfc59){logger[_0xde14('0x19')](_0xde14('0x14'),_0x1ce0a2,_0x3bfc59);_0xe785fb(_0x3bfc59);});});}exports['CreateFaxMessage']=function(_0x394de7){var _0x53e905=this;return new Promise(function(_0x45d101,_0x4c24a8){return db[_0xde14('0x1e')][_0xde14('0x1f')](_0x394de7[_0xde14('0x20')],{'raw':_0x394de7[_0xde14('0x21')]?_0x394de7[_0xde14('0x21')][_0xde14('0x22')]===undefined?!![]:![]:!![]})[_0xde14('0x12')](function(_0x2dd9e7){logger[_0xde14('0x13')](_0xde14('0x23'),_0x394de7);logger[_0xde14('0x16')](_0xde14('0x23'),_0x394de7,JSON[_0xde14('0x18')](_0x2dd9e7));_0x45d101(_0x2dd9e7);})['catch'](function(_0x42dd4f){logger[_0xde14('0x19')](_0xde14('0x23'),_0x42dd4f[_0xde14('0x1b')],_0x394de7);_0x4c24a8(_0x53e905[_0xde14('0x19')](0x1f4,_0x42dd4f[_0xde14('0x1b')]));});});};exports[_0xde14('0x24')]=function(_0x23c735){var _0x1618e1=this;return new Promise(function(_0x350a78,_0x4eff65){return db[_0xde14('0x1e')][_0xde14('0x25')](_0x23c735[_0xde14('0x20')],{'raw':_0x23c735[_0xde14('0x21')]?_0x23c735['options'][_0xde14('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x23c735[_0xde14('0x21')]?_0x23c735[_0xde14('0x21')]['where']||null:null,'attributes':_0x23c735[_0xde14('0x21')]?_0x23c735['options'][_0xde14('0x26')]||null:null,'limit':_0x23c735[_0xde14('0x21')]?_0x23c735[_0xde14('0x21')][_0xde14('0x27')]||null:null})[_0xde14('0x12')](function(_0x237d3f){logger[_0xde14('0x13')](_0xde14('0x24'),_0x23c735);logger['debug'](_0xde14('0x24'),_0x23c735,JSON[_0xde14('0x18')](_0x237d3f));_0x350a78(_0x237d3f);})['catch'](function(_0xf25a9e){logger['error'](_0xde14('0x24'),_0xf25a9e[_0xde14('0x1b')],_0x23c735);_0x4eff65(_0x1618e1[_0xde14('0x19')](0x1f4,_0xf25a9e[_0xde14('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index 3c1001c..ebcb5eb 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 _0x9a19=['./faxMessage.events','save','remove','update','emit','removeListener','register','length','faxMessage:'];(function(_0x256b72,_0x340985){var _0x2183e3=function(_0xf7fd37){while(--_0xf7fd37){_0x256b72['push'](_0x256b72['shift']());}};_0x2183e3(++_0x340985);}(_0x9a19,0x105));var _0x99a1=function(_0x2261ce,_0x9ed8b6){_0x2261ce=_0x2261ce-0x0;var _0x524640=_0x9a19[_0x2261ce];return _0x524640;};'use strict';var FaxMessageEvents=require(_0x99a1('0x0'));var events=[_0x99a1('0x1'),_0x99a1('0x2'),_0x99a1('0x3')];function createListener(_0xbd58bf,_0x1ce860){return function(_0x39cb7b){_0x1ce860[_0x99a1('0x4')](_0xbd58bf,_0x39cb7b);};}function removeListener(_0x332dee,_0x4fa4d2){return function(){FaxMessageEvents[_0x99a1('0x5')](_0x332dee,_0x4fa4d2);};}exports[_0x99a1('0x6')]=function(_0x2cb2da){for(var _0x4ed9c7=0x0,_0x233490=events[_0x99a1('0x7')];_0x4ed9c7<_0x233490;_0x4ed9c7++){var _0x2ca523=events[_0x4ed9c7];var _0x548e24=createListener(_0x99a1('0x8')+_0x2ca523,_0x2cb2da);FaxMessageEvents['on'](_0x2ca523,_0x548e24);}}; \ No newline at end of file +var _0xdb20=['register','./faxMessage.events','save','update','emit','removeListener'];(function(_0x82a0a6,_0x25a650){var _0x32d71c=function(_0x58aa31){while(--_0x58aa31){_0x82a0a6['push'](_0x82a0a6['shift']());}};_0x32d71c(++_0x25a650);}(_0xdb20,0x163));var _0x0db2=function(_0x96ea5a,_0x98e495){_0x96ea5a=_0x96ea5a-0x0;var _0x405bce=_0xdb20[_0x96ea5a];return _0x405bce;};'use strict';var FaxMessageEvents=require(_0x0db2('0x0'));var events=[_0x0db2('0x1'),'remove',_0x0db2('0x2')];function createListener(_0x5da49e,_0x2e4c77){return function(_0x3adafd){_0x2e4c77[_0x0db2('0x3')](_0x5da49e,_0x3adafd);};}function removeListener(_0x50f05e,_0x4d283b){return function(){FaxMessageEvents[_0x0db2('0x4')](_0x50f05e,_0x4d283b);};}exports[_0x0db2('0x5')]=function(_0x426922){for(var _0x1ee49d=0x0,_0x40205d=events['length'];_0x1ee49d<_0x40205d;_0x1ee49d++){var _0x1dc5a1=events[_0x1ee49d];var _0x198e65=createListener('faxMessage:'+_0x1dc5a1,_0x426922);FaxMessageEvents['on'](_0x1dc5a1,_0x198e65);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index 3104a66..88924ea 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 _0xe205=['../../components/interaction/service','./faxMessage.controller','get','isAuthenticated','index','/:id','/:id/download','download','tracked','fax','faxmessage:create','create','put','update','reject','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x4de950,_0x2bc8f8){var _0x312e51=function(_0x2ac86e){while(--_0x2ac86e){_0x4de950['push'](_0x4de950['shift']());}};_0x312e51(++_0x2bc8f8);}(_0xe205,0xa7));var _0x5e20=function(_0x19dcda,_0x34ec3b){_0x19dcda=_0x19dcda-0x0;var _0x144064=_0xe205[_0x19dcda];return _0x144064;};'use strict';var multer=require(_0x5e20('0x0'));var util=require(_0x5e20('0x1'));var path=require(_0x5e20('0x2'));var timeout=require(_0x5e20('0x3'));var express=require(_0x5e20('0x4'));var router=express[_0x5e20('0x5')]();var fs_extra=require(_0x5e20('0x6'));var auth=require(_0x5e20('0x7'));var interaction=require(_0x5e20('0x8'));var config=require('../../config/environment');var controller=require(_0x5e20('0x9'));router[_0x5e20('0xa')]('/',auth[_0x5e20('0xb')](),controller[_0x5e20('0xc')]);router['get']('/describe',auth[_0x5e20('0xb')](),controller['describe']);router['get'](_0x5e20('0xd'),auth[_0x5e20('0xb')](),controller['show']);router[_0x5e20('0xa')](_0x5e20('0xe'),auth[_0x5e20('0xb')](),controller[_0x5e20('0xf')]);router['post']('/',auth[_0x5e20('0xb')](),interaction[_0x5e20('0x10')](_0x5e20('0x11'),_0x5e20('0x12')),controller[_0x5e20('0x13')]);router[_0x5e20('0x14')]('/:id',auth[_0x5e20('0xb')](),controller[_0x5e20('0x15')]);router[_0x5e20('0x14')]('/:id/accept',auth[_0x5e20('0xb')](),controller['accept']);router[_0x5e20('0x14')]('/:id/reject',auth[_0x5e20('0xb')](),controller[_0x5e20('0x16')]);router[_0x5e20('0x17')](_0x5e20('0xd'),auth[_0x5e20('0xb')](),controller['destroy']);module[_0x5e20('0x18')]=router; \ No newline at end of file +var _0xbf6e=['accept','reject','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./faxMessage.controller','get','isAuthenticated','index','/describe','/:id','/:id/download','download','post','tracked','fax','faxmessage:create','put','update','/:id/accept'];(function(_0x555ebb,_0x4b1b68){var _0x3c0a4a=function(_0x312e2f){while(--_0x312e2f){_0x555ebb['push'](_0x555ebb['shift']());}};_0x3c0a4a(++_0x4b1b68);}(_0xbf6e,0x149));var _0xebf6=function(_0x156627,_0x27ec9a){_0x156627=_0x156627-0x0;var _0x174ce9=_0xbf6e[_0x156627];return _0x174ce9;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xebf6('0x0'));var timeout=require(_0xebf6('0x1'));var express=require(_0xebf6('0x2'));var router=express[_0xebf6('0x3')]();var fs_extra=require(_0xebf6('0x4'));var auth=require(_0xebf6('0x5'));var interaction=require(_0xebf6('0x6'));var config=require('../../config/environment');var controller=require(_0xebf6('0x7'));router[_0xebf6('0x8')]('/',auth[_0xebf6('0x9')](),controller[_0xebf6('0xa')]);router[_0xebf6('0x8')](_0xebf6('0xb'),auth[_0xebf6('0x9')](),controller['describe']);router[_0xebf6('0x8')](_0xebf6('0xc'),auth[_0xebf6('0x9')](),controller['show']);router[_0xebf6('0x8')](_0xebf6('0xd'),auth['isAuthenticated'](),controller[_0xebf6('0xe')]);router[_0xebf6('0xf')]('/',auth[_0xebf6('0x9')](),interaction[_0xebf6('0x10')](_0xebf6('0x11'),_0xebf6('0x12')),controller['create']);router[_0xebf6('0x13')](_0xebf6('0xc'),auth['isAuthenticated'](),controller[_0xebf6('0x14')]);router[_0xebf6('0x13')](_0xebf6('0x15'),auth[_0xebf6('0x9')](),controller[_0xebf6('0x16')]);router['put']('/:id/reject',auth['isAuthenticated'](),controller[_0xebf6('0x17')]);router[_0xebf6('0x18')]('/:id',auth[_0xebf6('0x9')](),controller[_0xebf6('0x19')]);module[_0xebf6('0x1a')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index 70b06c2..42f9d9a 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 _0xd5bc=['sequelize','exports','STRING','name','INTEGER','ENUM','rrmemory','roundrobin'];(function(_0x57f8c0,_0x136cf6){var _0x117f08=function(_0x426cd4){while(--_0x426cd4){_0x57f8c0['push'](_0x57f8c0['shift']());}};_0x117f08(++_0x136cf6);}(_0xd5bc,0x78));var _0xcd5b=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xd5bc[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0xcd5b('0x0'));module[_0xcd5b('0x1')]={'name':{'type':Sequelize[_0xcd5b('0x2')],'unique':_0xcd5b('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xcd5b('0x2')]},'timeout':{'type':Sequelize[_0xcd5b('0x4')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xcd5b('0x5')](_0xcd5b('0x6'),'beepall',_0xcd5b('0x7')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0xcd5b('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x434b=['name','INTEGER','rrmemory','beepall','roundrobin','STRING'];(function(_0x4e9d3c,_0x1f4b98){var _0x2d0825=function(_0x384676){while(--_0x384676){_0x4e9d3c['push'](_0x4e9d3c['shift']());}};_0x2d0825(++_0x1f4b98);}(_0x434b,0x17f));var _0xb434=function(_0x1daaa9,_0x220393){_0x1daaa9=_0x1daaa9-0x0;var _0x1dd221=_0x434b[_0x1daaa9];return _0x1dd221;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xb434('0x0')],'unique':_0xb434('0x1'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xb434('0x2')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xb434('0x3'),_0xb434('0x4'),_0xb434('0x5')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0xb434('0x2')],'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 34cd6a2..932ef3a 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 _0x6d19=['localhost','socket.io-emitter','register','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','update','destroy','then','get','FaxQueues','UserProfileResource','end','error','stack','name','index','map','type','key','getOptions','where','include','query','rows','catch','show','params','model','keys','rawAttributes','filters','intersection','fields','attributes','includeAll','merge','FaxQueue','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','describe','getMembers','findOne','UserFaxQueue','length','hasOwnProperty','nolimit','sort','filter','options','findAll','User','findAndCountAll','UserId','agent','updatedAt','createdAt','format','%s/%s','SIP','getTeams','Team','order','pick','addTeams','ids','Agents','online','interface','flatMap','transaction','each','findOrCreate','forEach','emit','userFaxQueue:save','removeTeams','select','field','tq.TeamId','team_has_fax_queues','join','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','push','sequelize','QueryTypes','SELECT','every','TeamId','includes','all','value','removeAgents','userFaxQueue:remove','addAgents','omit','spread','isArray','getAgents','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','defaults'];(function(_0x5de1bc,_0x434be1){var _0x19f4b8=function(_0x35f764){while(--_0x35f764){_0x5de1bc['push'](_0x5de1bc['shift']());}};_0x19f4b8(++_0x434be1);}(_0x6d19,0x160));var _0x96d1=function(_0x4ed4d2,_0x47acf7){_0x4ed4d2=_0x4ed4d2-0x0;var _0x15ae2e=_0x6d19[_0x4ed4d2];return _0x15ae2e;};'use strict';var BPromise=require(_0x96d1('0x0'));var util=require(_0x96d1('0x1'));var _=require(_0x96d1('0x2'));var squel=require(_0x96d1('0x3'));var Redis=require(_0x96d1('0x4'));var qs=require(_0x96d1('0x5'));var logger=require(_0x96d1('0x6'))('api');var config=require(_0x96d1('0x7'));var db=require(_0x96d1('0x8'))['db'];config[_0x96d1('0x9')]=_[_0x96d1('0xa')](config['redis'],{'host':_0x96d1('0xb'),'port':0x18eb});var socket=require(_0x96d1('0xc'))(new Redis(config[_0x96d1('0x9')]));require('./faxQueue.socket')[_0x96d1('0xd')](socket);function respondWithStatusCode(_0x3f7a36,_0x163b0a){_0x163b0a=_0x163b0a||0xcc;return function(_0x4e1e7a){if(_0x4e1e7a){return _0x3f7a36[_0x96d1('0xe')](_0x163b0a);}return _0x3f7a36[_0x96d1('0xf')](_0x163b0a)['end']();};}function respondWithResult(_0x4bd620,_0x44e65d){_0x44e65d=_0x44e65d||0xc8;return function(_0x2de9e3){if(_0x2de9e3){return _0x4bd620['status'](_0x44e65d)[_0x96d1('0x10')](_0x2de9e3);}};}function respondWithFilteredResult(_0x51b089,_0x15b2c1){return function(_0x3c52f1){if(_0x3c52f1){var _0x31b953=typeof _0x15b2c1[_0x96d1('0x11')]===_0x96d1('0x12')&&typeof _0x15b2c1[_0x96d1('0x13')]==='undefined';var _0x35e728=_0x3c52f1[_0x96d1('0x14')];var _0x10e057=_0x31b953?0x0:_0x15b2c1[_0x96d1('0x11')];var _0x2fd5c6=_0x31b953?_0x3c52f1['count']:_0x15b2c1['offset']+_0x15b2c1[_0x96d1('0x13')];var _0x446023;if(_0x2fd5c6>=_0x35e728){_0x2fd5c6=_0x35e728;_0x446023=0xc8;}else{_0x446023=0xce;}_0x51b089[_0x96d1('0xf')](_0x446023);return _0x51b089[_0x96d1('0x15')](_0x96d1('0x16'),_0x10e057+'-'+_0x2fd5c6+'/'+_0x35e728)[_0x96d1('0x10')](_0x3c52f1);}return null;};}function saveUpdates(_0x45dc6f){return function(_0x455751){if(_0x455751){return _0x455751[_0x96d1('0x17')](_0x45dc6f)['then'](function(_0x18c73f){return _0x18c73f;});}return null;};}function removeEntity(_0x1c3540){return function(_0x3ed4ff){if(_0x3ed4ff){return _0x3ed4ff[_0x96d1('0x18')]()[_0x96d1('0x19')](function(){var _0x4ae4c5=_0x3ed4ff[_0x96d1('0x1a')]({'plain':!![]});var _0x28ad24=_0x96d1('0x1b');return db[_0x96d1('0x1c')]['destroy']({'where':{'type':_0x28ad24,'resourceId':_0x4ae4c5['id']}})[_0x96d1('0x19')](function(){return _0x3ed4ff;});})[_0x96d1('0x19')](function(){_0x1c3540[_0x96d1('0xf')](0xcc)[_0x96d1('0x1d')]();});}};}function handleEntityNotFound(_0x54af14){return function(_0x339ce1){if(!_0x339ce1){_0x54af14[_0x96d1('0xe')](0x194);}return _0x339ce1;};}function handleError(_0x186bae,_0x1390ac){_0x1390ac=_0x1390ac||0x1f4;return function(_0x5a0584){logger[_0x96d1('0x1e')](_0x5a0584[_0x96d1('0x1f')]);if(_0x5a0584['name']){delete _0x5a0584[_0x96d1('0x20')];}_0x186bae[_0x96d1('0xf')](_0x1390ac)['send'](_0x5a0584);};}exports[_0x96d1('0x21')]=function(_0x153cad,_0x1c3399){var _0x5462ec={};var _0x424d1e={'count':0x0,'rows':[]};var _0x46aa64=_[_0x96d1('0x22')](db['FaxQueue']['rawAttributes'],function(_0xd88eb7){return{'name':_0xd88eb7['fieldName'],'type':_0xd88eb7[_0x96d1('0x23')][_0x96d1('0x24')]};});_0x5462ec=qs[_0x96d1('0x25')](_0x46aa64,_0x153cad);var _0x312394={'where':_0x5462ec[_0x96d1('0x26')]};return db['FaxQueue'][_0x96d1('0x14')](_0x312394)[_0x96d1('0x19')](function(_0x433b36){_0x424d1e[_0x96d1('0x14')]=_0x433b36;_0x5462ec[_0x96d1('0x27')]=qs[_0x96d1('0x27')](_0x153cad[_0x96d1('0x28')]);return db['FaxQueue']['findAll'](_0x5462ec);})[_0x96d1('0x19')](function(_0x266d2c){_0x424d1e[_0x96d1('0x29')]=_0x266d2c;return _0x424d1e;})[_0x96d1('0x19')](respondWithFilteredResult(_0x1c3399,_0x5462ec))[_0x96d1('0x2a')](handleError(_0x1c3399,null));};exports[_0x96d1('0x2b')]=function(_0x5938ce,_0x148d6c){var _0x24bab3={'raw':!![],'where':{'id':_0x5938ce[_0x96d1('0x2c')]['id']}},_0x4b7e21={};_0x4b7e21[_0x96d1('0x2d')]=_[_0x96d1('0x2e')](db['FaxQueue'][_0x96d1('0x2f')]);_0x4b7e21[_0x96d1('0x28')]=_[_0x96d1('0x2e')](_0x5938ce[_0x96d1('0x28')]);_0x4b7e21[_0x96d1('0x30')]=_[_0x96d1('0x31')](_0x4b7e21['model'],_0x4b7e21[_0x96d1('0x28')]);_0x24bab3['attributes']=_['intersection'](_0x4b7e21['model'],qs[_0x96d1('0x32')](_0x5938ce[_0x96d1('0x28')][_0x96d1('0x32')]));_0x24bab3[_0x96d1('0x33')]=_0x24bab3[_0x96d1('0x33')]['length']?_0x24bab3[_0x96d1('0x33')]:_0x4b7e21[_0x96d1('0x2d')];if(_0x5938ce[_0x96d1('0x28')][_0x96d1('0x34')]){_0x24bab3[_0x96d1('0x27')]=[{'all':!![]}];}_0x24bab3=_[_0x96d1('0x35')]({},_0x24bab3,_0x5938ce['options']);return db[_0x96d1('0x36')][_0x96d1('0x37')](_0x24bab3)[_0x96d1('0x19')](handleEntityNotFound(_0x148d6c,null))[_0x96d1('0x19')](respondWithResult(_0x148d6c,null))[_0x96d1('0x2a')](handleError(_0x148d6c,null));};exports[_0x96d1('0x38')]=function(_0x4610eb,_0x4d70be){return db['FaxQueue'][_0x96d1('0x38')](_0x4610eb[_0x96d1('0x39')],{})[_0x96d1('0x19')](function(_0x309964){var _0xc87d85=_0x4610eb['user'][_0x96d1('0x1a')]({'plain':!![]});if(!_0xc87d85)throw new Error(_0x96d1('0x3a'));if(_0xc87d85['role']===_0x96d1('0x3b')){var _0x26439c=_0x309964[_0x96d1('0x1a')]({'plain':!![]});var _0x3b13cd='FaxQueues';return db[_0x96d1('0x3c')]['find']({'where':{'name':_0x3b13cd,'userProfileId':_0xc87d85['userProfileId']},'raw':!![]})[_0x96d1('0x19')](function(_0x3e10f3){if(_0x3e10f3&&_0x3e10f3['autoAssociation']===0x0){return db['UserProfileResource'][_0x96d1('0x38')]({'name':_0x26439c['name'],'resourceId':_0x26439c['id'],'type':_0x3e10f3[_0x96d1('0x20')],'sectionId':_0x3e10f3['id']},{})['then'](function(){return _0x309964;});}else{return _0x309964;}})[_0x96d1('0x2a')](function(_0x525045){logger[_0x96d1('0x1e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x525045);throw _0x525045;});}return _0x309964;})['then'](respondWithResult(_0x4d70be,0xc9))[_0x96d1('0x2a')](handleError(_0x4d70be,null));};exports['update']=function(_0x59f0e7,_0x1244ed){if(_0x59f0e7[_0x96d1('0x39')]['id']){delete _0x59f0e7[_0x96d1('0x39')]['id'];}return db[_0x96d1('0x36')][_0x96d1('0x37')]({'where':{'id':_0x59f0e7['params']['id']}})['then'](handleEntityNotFound(_0x1244ed,null))['then'](saveUpdates(_0x59f0e7[_0x96d1('0x39')],null))[_0x96d1('0x19')](respondWithResult(_0x1244ed,null))[_0x96d1('0x2a')](handleError(_0x1244ed,null));};exports[_0x96d1('0x18')]=function(_0x36ba8b,_0x1b4267){return db['FaxQueue']['find']({'where':{'id':_0x36ba8b[_0x96d1('0x2c')]['id']}})[_0x96d1('0x19')](handleEntityNotFound(_0x1b4267,null))[_0x96d1('0x19')](removeEntity(_0x1b4267,null))[_0x96d1('0x2a')](handleError(_0x1b4267,null));};exports[_0x96d1('0x3d')]=function(_0x29755d,_0x90bc88){return db[_0x96d1('0x36')]['describe']()['then'](respondWithResult(_0x90bc88,null))[_0x96d1('0x2a')](handleError(_0x90bc88,null));};exports[_0x96d1('0x3e')]=function(_0x56ac15,_0xe9a96e){var _0x4cabf5={'raw':!![],'where':{}},_0x3e347b={},_0x16ac35;return db[_0x96d1('0x36')][_0x96d1('0x3f')]({'where':{'id':_0x56ac15[_0x96d1('0x2c')]['id']}})[_0x96d1('0x19')](handleEntityNotFound(_0xe9a96e,null))['then'](function(_0xa1bd8d){if(_0xa1bd8d){_0x16ac35=_0xa1bd8d[_0x96d1('0x1a')]({'plain':!![]});_0x3e347b['model']=_[_0x96d1('0x2e')](db[_0x96d1('0x40')][_0x96d1('0x2f')]);_0x3e347b[_0x96d1('0x28')]=_[_0x96d1('0x2e')](_0x56ac15[_0x96d1('0x28')]);_0x3e347b[_0x96d1('0x30')]=_[_0x96d1('0x31')](_0x3e347b[_0x96d1('0x2d')],_0x3e347b[_0x96d1('0x28')]);_0x4cabf5[_0x96d1('0x33')]=_[_0x96d1('0x31')](_0x3e347b[_0x96d1('0x2d')],qs[_0x96d1('0x32')](_0x56ac15['query'][_0x96d1('0x32')]));_0x4cabf5[_0x96d1('0x33')]=_0x4cabf5[_0x96d1('0x33')][_0x96d1('0x41')]?_0x4cabf5[_0x96d1('0x33')]:_0x3e347b[_0x96d1('0x2d')];if(!_0x56ac15['query'][_0x96d1('0x42')](_0x96d1('0x43'))){_0x4cabf5['limit']=qs[_0x96d1('0x13')](_0x56ac15[_0x96d1('0x28')][_0x96d1('0x13')]);_0x4cabf5['offset']=qs[_0x96d1('0x11')](_0x56ac15['query'][_0x96d1('0x11')]);}_0x4cabf5['order']=qs[_0x96d1('0x44')](_0x56ac15[_0x96d1('0x28')][_0x96d1('0x44')]);_0x4cabf5[_0x96d1('0x26')]=qs[_0x96d1('0x30')](_['pick'](_0x56ac15[_0x96d1('0x28')],_0x3e347b[_0x96d1('0x30')]));_0x4cabf5[_0x96d1('0x26')]['FaxQueueId']=_0xa1bd8d['id'];if(_0x56ac15[_0x96d1('0x28')][_0x96d1('0x45')]){_0x4cabf5['where']=_['merge'](_0x4cabf5[_0x96d1('0x26')],{'$or':_[_0x96d1('0x22')](_0x4cabf5[_0x96d1('0x33')],function(_0x5228f5){var _0xc21ea3={};_0xc21ea3[_0x5228f5]={'$like':'%'+_0x56ac15['query'][_0x96d1('0x45')]+'%'};return _0xc21ea3;})});}_0x4cabf5=_[_0x96d1('0x35')]({},_0x4cabf5,_0x56ac15[_0x96d1('0x46')]);return db['UserFaxQueue'][_0x96d1('0x47')](_0x4cabf5);}})[_0x96d1('0x19')](function(_0x9317e){if(_0x9317e){return db[_0x96d1('0x48')][_0x96d1('0x49')]({'where':{'id':_[_0x96d1('0x22')](_0x9317e,_0x96d1('0x4a')),'role':_0x96d1('0x4b')},'attributes':['id',_0x96d1('0x20'),'faxPause',_0x96d1('0x4c'),_0x96d1('0x4d')]});}})[_0x96d1('0x19')](function(_0x2f2f93){if(_0x2f2f93){return{'count':_0x2f2f93[_0x96d1('0x14')],'rows':_[_0x96d1('0x22')](_0x2f2f93[_0x96d1('0x29')],function(_0x36b1d5){return{'membername':_0x36b1d5[_0x96d1('0x20')],'UserId':_0x36b1d5['id'],'queue_name':_0x16ac35['name'],'FaxQueueId':_0x16ac35['id'],'interface':util[_0x96d1('0x4e')](_0x96d1('0x4f'),_0x96d1('0x50'),_0x36b1d5['name']),'penalty':0x0,'paused':_0x36b1d5['faxPause'],'createdAt':_0x36b1d5['createdAt'],'updatedAt':_0x36b1d5['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x96d1('0x19')](respondWithFilteredResult(_0xe9a96e,_0x4cabf5))[_0x96d1('0x2a')](handleError(_0xe9a96e,null));};exports[_0x96d1('0x51')]=function(_0x371fe3,_0x38c243){var _0x2c2016={};var _0x54e23f={};var _0x2e6474;var _0x151613;return db[_0x96d1('0x36')][_0x96d1('0x3f')]({'where':{'id':_0x371fe3[_0x96d1('0x2c')]['id']}})[_0x96d1('0x19')](handleEntityNotFound(_0x38c243,null))[_0x96d1('0x19')](function(_0x2f81ab){if(_0x2f81ab){_0x2e6474=_0x2f81ab;_0x54e23f[_0x96d1('0x2d')]=_[_0x96d1('0x2e')](db[_0x96d1('0x52')]['rawAttributes']);_0x54e23f['query']=_[_0x96d1('0x2e')](_0x371fe3[_0x96d1('0x28')]);_0x54e23f[_0x96d1('0x30')]=_[_0x96d1('0x31')](_0x54e23f[_0x96d1('0x2d')],_0x54e23f[_0x96d1('0x28')]);_0x2c2016[_0x96d1('0x33')]=_[_0x96d1('0x31')](_0x54e23f[_0x96d1('0x2d')],qs['fields'](_0x371fe3['query'][_0x96d1('0x32')]));_0x2c2016[_0x96d1('0x33')]=_0x2c2016[_0x96d1('0x33')][_0x96d1('0x41')]?_0x2c2016[_0x96d1('0x33')]:_0x54e23f[_0x96d1('0x2d')];_0x2c2016[_0x96d1('0x53')]=qs[_0x96d1('0x44')](_0x371fe3[_0x96d1('0x28')][_0x96d1('0x44')]);_0x2c2016[_0x96d1('0x26')]=qs['filters'](_[_0x96d1('0x54')](_0x371fe3[_0x96d1('0x28')],_0x54e23f[_0x96d1('0x30')]));if(_0x371fe3[_0x96d1('0x28')][_0x96d1('0x45')]){_0x2c2016[_0x96d1('0x26')]=_[_0x96d1('0x35')](_0x2c2016[_0x96d1('0x26')],{'$or':_['map'](_0x2c2016['attributes'],function(_0x4341c3){var _0x45aea1={};_0x45aea1[_0x4341c3]={'$like':'%'+_0x371fe3['query'][_0x96d1('0x45')]+'%'};return _0x45aea1;})});}_0x2c2016=_[_0x96d1('0x35')]({},_0x2c2016,_0x371fe3[_0x96d1('0x46')]);return _0x2e6474['getTeams'](_0x2c2016);}})['then'](function(_0x530a63){if(_0x530a63){_0x151613=_0x530a63['length'];if(!_0x371fe3[_0x96d1('0x28')]['hasOwnProperty'](_0x96d1('0x43'))){_0x2c2016[_0x96d1('0x13')]=qs[_0x96d1('0x13')](_0x371fe3[_0x96d1('0x28')]['limit']);_0x2c2016[_0x96d1('0x11')]=qs['offset'](_0x371fe3[_0x96d1('0x28')][_0x96d1('0x11')]);}return _0x2e6474['getTeams'](_0x2c2016);}})[_0x96d1('0x19')](function(_0x2bcdfe){if(_0x2bcdfe){return _0x2bcdfe?{'count':_0x151613,'rows':_0x2bcdfe}:null;}})[_0x96d1('0x19')](respondWithResult(_0x38c243,null))['catch'](handleError(_0x38c243,null));};exports[_0x96d1('0x55')]=function(_0x5a2a70,_0x57c7f4){var _0x4ce12e=_0x5a2a70[_0x96d1('0x39')][_0x96d1('0x56')];return db[_0x96d1('0x52')][_0x96d1('0x47')]({'where':{'id':_0x4ce12e},'attributes':['id'],'include':[{'model':db[_0x96d1('0x48')],'as':_0x96d1('0x57'),'attributes':['id',_0x96d1('0x20'),_0x96d1('0x58'),'voicePause',_0x96d1('0x59')],'raw':!![]}]})[_0x96d1('0x19')](function(_0x4cc65c){if(_0x4cc65c){var _0x497ebc=_[_0x96d1('0x5a')](_0x4cc65c,function(_0x5ac127){var _0x308c41=_0x5ac127['get']({'plain':!![]});return _0x308c41['Agents'];});return db[_0x96d1('0x36')][_0x96d1('0x37')]({'where':{'id':_0x5a2a70['params']['id']}})[_0x96d1('0x19')](function(_0x2be742){return db['sequelize'][_0x96d1('0x5b')](function(_0x59572f){return _0x2be742[_0x96d1('0x55')](_0x4ce12e,{'transaction':_0x59572f})[_0x96d1('0x19')](function(){return BPromise[_0x96d1('0x5c')](_0x497ebc,function(_0x30cc6d){return db[_0x96d1('0x40')][_0x96d1('0x5d')]({'where':{'UserId':_0x30cc6d['id'],'FaxQueueId':_0x5a2a70['params']['id']},'transaction':_0x59572f});});})[_0x96d1('0x19')](function(){_0x497ebc[_0x96d1('0x5e')](function(_0x3f1325){socket[_0x96d1('0x5f')](_0x96d1('0x60'),{'UserId':_0x3f1325['id'],'FaxQueueId':_0x2be742['id']});});});});});}})[_0x96d1('0x19')](respondWithStatusCode(_0x57c7f4,null))[_0x96d1('0x2a')](handleError(_0x57c7f4,null));};exports[_0x96d1('0x61')]=function(_0x52277b,_0x471b38){return db[_0x96d1('0x52')][_0x96d1('0x47')]({'where':{'id':_0x52277b[_0x96d1('0x28')][_0x96d1('0x56')]},'attributes':['id'],'include':[{'model':db[_0x96d1('0x48')],'as':_0x96d1('0x57'),'attributes':['id'],'raw':!![]}]})[_0x96d1('0x19')](handleEntityNotFound(_0x471b38,null))['then'](function(_0x4354c3){var _0x13266d=_[_0x96d1('0x22')](_0x4354c3,'id');var _0x5e0a48=[];var _0x3785d7=[];var _0x5a5842=squel[_0x96d1('0x62')]();_0x5a5842[_0x96d1('0x63')](_0x96d1('0x64'))['from'](_0x96d1('0x65'),'tq')[_0x96d1('0x66')]('user_has_teams','ut',_0x96d1('0x67'))[_0x96d1('0x26')]('FaxQueueId\x20=\x20?',_0x52277b[_0x96d1('0x2c')]['id']);for(var _0x3d7bfd=0x0;_0x3d7bfd<_0x4354c3[_0x96d1('0x41')];_0x3d7bfd+=0x1){let _0x2df9e7=_0x4354c3[_0x3d7bfd];for(var _0x5986ae=0x0;_0x5986ae<_0x2df9e7[_0x96d1('0x57')][_0x96d1('0x41')];_0x5986ae+=0x1){let _0x3f3024=_0x2df9e7[_0x96d1('0x57')][_0x5986ae];var _0x339ee9=_0x5a5842['clone']();_0x339ee9[_0x96d1('0x26')](_0x96d1('0x68'),_0x3f3024['id']);_0x3785d7[_0x96d1('0x69')](db['sequelize'][_0x96d1('0x28')](_0x339ee9['toString'](),{'type':db[_0x96d1('0x6a')][_0x96d1('0x6b')][_0x96d1('0x6c')]})['then'](function(_0x575e59){if(_0x575e59[_0x96d1('0x41')]===0x1){return _0x3f3024['id'];}else{var _0xe3c728=_[_0x96d1('0x6d')](_['map'](_0x575e59,_0x96d1('0x6e')),function(_0x5cdbce){return _[_0x96d1('0x6f')](_0x13266d,_0x5cdbce);});if(_0xe3c728){return _0x3f3024['id'];}}}));}}return BPromise[_0x96d1('0x70')](_0x3785d7)['then'](function(_0x2b1349){_0x5e0a48=_(_0x5e0a48)['union'](_0x2b1349)['compact']()[_0x96d1('0x71')]();return db[_0x96d1('0x36')][_0x96d1('0x37')]({'where':{'id':_0x52277b[_0x96d1('0x2c')]['id']}})['then'](function(_0x3bbbc0){return db[_0x96d1('0x6a')]['transaction'](function(_0x3e05c3){return _0x3bbbc0[_0x96d1('0x61')](_0x52277b[_0x96d1('0x28')][_0x96d1('0x56')],{'transaction':_0x3e05c3})[_0x96d1('0x19')](function(){if(!_['isEmpty'](_0x5e0a48)){return _0x3bbbc0[_0x96d1('0x72')](_0x5e0a48,{'transaction':_0x3e05c3});}})[_0x96d1('0x19')](function(){_0x5e0a48[_0x96d1('0x5e')](function(_0x40450f){socket[_0x96d1('0x5f')](_0x96d1('0x73'),{'UserId':_0x40450f,'FaxQueueId':_0x3bbbc0['id']});});});});});});})[_0x96d1('0x19')](respondWithStatusCode(_0x471b38,null))['catch'](handleError(_0x471b38,null));};exports[_0x96d1('0x74')]=function(_0x2dd021,_0x311142){return db[_0x96d1('0x36')][_0x96d1('0x37')]({'where':{'id':_0x2dd021['params']['id']}})['then'](handleEntityNotFound(_0x311142,null))['then'](function(_0xf0b620){if(_0xf0b620){return _0xf0b620[_0x96d1('0x74')](_0x2dd021[_0x96d1('0x39')][_0x96d1('0x56')],_[_0x96d1('0x75')](_0x2dd021['body'],['ids','id'])||{})[_0x96d1('0x76')](function(_0x5957ca){for(var _0x521214=0x0;_0x521214<_0x2dd021[_0x96d1('0x39')][_0x96d1('0x56')]['length'];_0x521214+=0x1){socket[_0x96d1('0x5f')](_0x96d1('0x60'),{'UserId':Number(_0x2dd021[_0x96d1('0x39')][_0x96d1('0x56')][_0x521214]),'FaxQueueId':Number(_0x2dd021[_0x96d1('0x2c')]['id'])});}return _0x5957ca;});}})['then'](respondWithResult(_0x311142,null))[_0x96d1('0x2a')](handleError(_0x311142,null));};exports['removeAgents']=function(_0x128098,_0x2bc023){return db[_0x96d1('0x36')]['find']({'where':{'id':_0x128098[_0x96d1('0x2c')]['id']}})[_0x96d1('0x19')](handleEntityNotFound(_0x2bc023,null))[_0x96d1('0x19')](function(_0x55c9b1){if(_0x55c9b1){return _0x55c9b1[_0x96d1('0x72')](_0x128098[_0x96d1('0x28')][_0x96d1('0x56')])[_0x96d1('0x19')](function(){if(_[_0x96d1('0x77')](_0x128098[_0x96d1('0x28')]['ids'])){for(var _0x1e3df7=0x0;_0x1e3df7<_0x128098[_0x96d1('0x28')][_0x96d1('0x56')][_0x96d1('0x41')];_0x1e3df7+=0x1){socket[_0x96d1('0x5f')](_0x96d1('0x73'),{'UserId':Number(_0x128098[_0x96d1('0x28')][_0x96d1('0x56')][_0x1e3df7]),'FaxQueueId':Number(_0x128098[_0x96d1('0x2c')]['id'])});}}else{socket[_0x96d1('0x5f')](_0x96d1('0x73'),{'UserId':Number(_0x128098[_0x96d1('0x28')][_0x96d1('0x56')]),'FaxQueueId':Number(_0x128098[_0x96d1('0x2c')]['id'])});}});}})['then'](respondWithStatusCode(_0x2bc023,null))[_0x96d1('0x2a')](handleError(_0x2bc023,null));};exports[_0x96d1('0x78')]=function(_0x18bad3,_0x5b8262){var _0x4525eb={};var _0x2fd56c={};var _0x56f38f;var _0x20916b;return db[_0x96d1('0x36')]['findOne']({'where':{'id':_0x18bad3[_0x96d1('0x2c')]['id']}})[_0x96d1('0x19')](handleEntityNotFound(_0x5b8262,null))[_0x96d1('0x19')](function(_0xc92f92){if(_0xc92f92){_0x56f38f=_0xc92f92;_0x2fd56c[_0x96d1('0x2d')]=_[_0x96d1('0x2e')](db['User'][_0x96d1('0x2f')]);_0x2fd56c[_0x96d1('0x28')]=_[_0x96d1('0x2e')](_0x18bad3[_0x96d1('0x28')]);_0x2fd56c[_0x96d1('0x30')]=_['intersection'](_0x2fd56c[_0x96d1('0x2d')],_0x2fd56c[_0x96d1('0x28')]);_0x4525eb['attributes']=_[_0x96d1('0x31')](_0x2fd56c[_0x96d1('0x2d')],qs[_0x96d1('0x32')](_0x18bad3[_0x96d1('0x28')][_0x96d1('0x32')]));_0x4525eb[_0x96d1('0x33')]=_0x4525eb['attributes'][_0x96d1('0x41')]?_0x4525eb[_0x96d1('0x33')]:_0x2fd56c[_0x96d1('0x2d')];_0x4525eb[_0x96d1('0x53')]=qs[_0x96d1('0x44')](_0x18bad3['query'][_0x96d1('0x44')]);_0x4525eb['where']=qs['filters'](_[_0x96d1('0x54')](_0x18bad3[_0x96d1('0x28')],_0x2fd56c['filters']));if(_0x18bad3[_0x96d1('0x28')][_0x96d1('0x45')]){_0x4525eb[_0x96d1('0x26')]=_[_0x96d1('0x35')](_0x4525eb[_0x96d1('0x26')],{'$or':_['map'](_0x4525eb[_0x96d1('0x33')],function(_0x4279f9){var _0x209642={};_0x209642[_0x4279f9]={'$like':'%'+_0x18bad3['query']['filter']+'%'};return _0x209642;})});}_0x4525eb=_[_0x96d1('0x35')]({},_0x4525eb,_0x18bad3[_0x96d1('0x46')]);return _0x56f38f[_0x96d1('0x78')](_0x4525eb);}})[_0x96d1('0x19')](function(_0xe76ca0){if(_0xe76ca0){_0x20916b=_0xe76ca0['length'];if(!_0x18bad3[_0x96d1('0x28')][_0x96d1('0x42')]('nolimit')){_0x4525eb[_0x96d1('0x13')]=qs[_0x96d1('0x13')](_0x18bad3[_0x96d1('0x28')][_0x96d1('0x13')]);_0x4525eb[_0x96d1('0x11')]=qs['offset'](_0x18bad3[_0x96d1('0x28')][_0x96d1('0x11')]);}return _0x56f38f[_0x96d1('0x78')](_0x4525eb);}})['then'](function(_0x495ca0){if(_0x495ca0){return _0x495ca0?{'count':_0x20916b,'rows':_0x495ca0}:null;}})[_0x96d1('0x19')](respondWithResult(_0x5b8262,null))[_0x96d1('0x2a')](handleError(_0x5b8262,null));}; \ No newline at end of file +var _0x781d=['send','index','map','FaxQueue','rawAttributes','fieldName','getOptions','where','include','query','rows','model','keys','filters','intersection','attributes','fields','length','merge','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','FaxQueues','find','userProfileId','autoAssociation','catch','params','describe','UserFaxQueue','hasOwnProperty','order','pick','filter','findAll','findAndCountAll','UserId','agent','faxPause','format','%s/%s','createdAt','updatedAt','getTeams','findOne','Team','sort','options','nolimit','ids','User','Agents','online','voicePause','interface','flatMap','sequelize','transaction','addTeams','forEach','userFaxQueue:save','removeTeams','select','field','from','team_has_fax_queues','join','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','all','union','compact','value','isEmpty','userFaxQueue:remove','addAgents','omit','spread','emit','removeAgents','isArray','getAgents','bluebird','util','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./faxQueue.socket','register','status','end','offset','undefined','limit','count','set','Content-Range','json','update','destroy','then','get','UserProfileResource','sendStatus','stack','name'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x781d,0x14a));var _0xd781=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x781d[_0x618414];return _0x21c19a;};'use strict';var BPromise=require(_0xd781('0x0'));var util=require(_0xd781('0x1'));var _=require('lodash');var squel=require('squel');var Redis=require(_0xd781('0x2'));var qs=require(_0xd781('0x3'));var logger=require(_0xd781('0x4'))(_0xd781('0x5'));var config=require(_0xd781('0x6'));var db=require(_0xd781('0x7'))['db'];config[_0xd781('0x8')]=_[_0xd781('0x9')](config[_0xd781('0x8')],{'host':_0xd781('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd781('0x8')]));require(_0xd781('0xb'))[_0xd781('0xc')](socket);function respondWithStatusCode(_0x248172,_0x4b1a57){_0x4b1a57=_0x4b1a57||0xcc;return function(_0x1e7779){if(_0x1e7779){return _0x248172['sendStatus'](_0x4b1a57);}return _0x248172[_0xd781('0xd')](_0x4b1a57)[_0xd781('0xe')]();};}function respondWithResult(_0x509ca7,_0x346756){_0x346756=_0x346756||0xc8;return function(_0x29c2a7){if(_0x29c2a7){return _0x509ca7['status'](_0x346756)['json'](_0x29c2a7);}};}function respondWithFilteredResult(_0x40a900,_0x28b74c){return function(_0x36f086){if(_0x36f086){var _0x17a929=typeof _0x28b74c[_0xd781('0xf')]===_0xd781('0x10')&&typeof _0x28b74c[_0xd781('0x11')]===_0xd781('0x10');var _0xb895a1=_0x36f086[_0xd781('0x12')];var _0xd454e7=_0x17a929?0x0:_0x28b74c['offset'];var _0x477bdc=_0x17a929?_0x36f086[_0xd781('0x12')]:_0x28b74c['offset']+_0x28b74c[_0xd781('0x11')];var _0x48bffc;if(_0x477bdc>=_0xb895a1){_0x477bdc=_0xb895a1;_0x48bffc=0xc8;}else{_0x48bffc=0xce;}_0x40a900[_0xd781('0xd')](_0x48bffc);return _0x40a900[_0xd781('0x13')](_0xd781('0x14'),_0xd454e7+'-'+_0x477bdc+'/'+_0xb895a1)[_0xd781('0x15')](_0x36f086);}return null;};}function saveUpdates(_0x42a9c1){return function(_0x22ffd5){if(_0x22ffd5){return _0x22ffd5[_0xd781('0x16')](_0x42a9c1)['then'](function(_0x1407fc){return _0x1407fc;});}return null;};}function removeEntity(_0x3f2922){return function(_0x395d9c){if(_0x395d9c){return _0x395d9c[_0xd781('0x17')]()[_0xd781('0x18')](function(){var _0x35e1bb=_0x395d9c[_0xd781('0x19')]({'plain':!![]});var _0x1d6fc7='FaxQueues';return db[_0xd781('0x1a')][_0xd781('0x17')]({'where':{'type':_0x1d6fc7,'resourceId':_0x35e1bb['id']}})[_0xd781('0x18')](function(){return _0x395d9c;});})[_0xd781('0x18')](function(){_0x3f2922[_0xd781('0xd')](0xcc)[_0xd781('0xe')]();});}};}function handleEntityNotFound(_0x1adcbd){return function(_0x5dd1f0){if(!_0x5dd1f0){_0x1adcbd[_0xd781('0x1b')](0x194);}return _0x5dd1f0;};}function handleError(_0x4e2c56,_0x567fdf){_0x567fdf=_0x567fdf||0x1f4;return function(_0x187a5a){logger['error'](_0x187a5a[_0xd781('0x1c')]);if(_0x187a5a[_0xd781('0x1d')]){delete _0x187a5a[_0xd781('0x1d')];}_0x4e2c56[_0xd781('0xd')](_0x567fdf)[_0xd781('0x1e')](_0x187a5a);};}exports[_0xd781('0x1f')]=function(_0x221f14,_0x316d43){var _0x10940b={};var _0x5662db={'count':0x0,'rows':[]};var _0x529ca1=_[_0xd781('0x20')](db[_0xd781('0x21')][_0xd781('0x22')],function(_0x57b41e){return{'name':_0x57b41e[_0xd781('0x23')],'type':_0x57b41e['type']['key']};});_0x10940b=qs[_0xd781('0x24')](_0x529ca1,_0x221f14);var _0x54fe00={'where':_0x10940b[_0xd781('0x25')]};return db[_0xd781('0x21')]['count'](_0x54fe00)['then'](function(_0x43cc74){_0x5662db['count']=_0x43cc74;_0x10940b[_0xd781('0x26')]=qs['include'](_0x221f14[_0xd781('0x27')]);return db[_0xd781('0x21')]['findAll'](_0x10940b);})['then'](function(_0x432d14){_0x5662db[_0xd781('0x28')]=_0x432d14;return _0x5662db;})[_0xd781('0x18')](respondWithFilteredResult(_0x316d43,_0x10940b))['catch'](handleError(_0x316d43,null));};exports['show']=function(_0x360f72,_0xd283ab){var _0x36a889={'raw':!![],'where':{'id':_0x360f72['params']['id']}},_0x5bcd40={};_0x5bcd40[_0xd781('0x29')]=_[_0xd781('0x2a')](db['FaxQueue'][_0xd781('0x22')]);_0x5bcd40[_0xd781('0x27')]=_['keys'](_0x360f72[_0xd781('0x27')]);_0x5bcd40[_0xd781('0x2b')]=_[_0xd781('0x2c')](_0x5bcd40[_0xd781('0x29')],_0x5bcd40['query']);_0x36a889[_0xd781('0x2d')]=_[_0xd781('0x2c')](_0x5bcd40[_0xd781('0x29')],qs[_0xd781('0x2e')](_0x360f72['query'][_0xd781('0x2e')]));_0x36a889[_0xd781('0x2d')]=_0x36a889['attributes'][_0xd781('0x2f')]?_0x36a889['attributes']:_0x5bcd40[_0xd781('0x29')];if(_0x360f72[_0xd781('0x27')]['includeAll']){_0x36a889[_0xd781('0x26')]=[{'all':!![]}];}_0x36a889=_[_0xd781('0x30')]({},_0x36a889,_0x360f72['options']);return db[_0xd781('0x21')]['find'](_0x36a889)[_0xd781('0x18')](handleEntityNotFound(_0xd283ab,null))[_0xd781('0x18')](respondWithResult(_0xd283ab,null))['catch'](handleError(_0xd283ab,null));};exports[_0xd781('0x31')]=function(_0x1854c3,_0x5651de){return db[_0xd781('0x21')][_0xd781('0x31')](_0x1854c3[_0xd781('0x32')],{})['then'](function(_0x123c8f){var _0x22b94e=_0x1854c3[_0xd781('0x33')][_0xd781('0x19')]({'plain':!![]});if(!_0x22b94e)throw new Error(_0xd781('0x34'));if(_0x22b94e[_0xd781('0x35')]===_0xd781('0x33')){var _0x140567=_0x123c8f[_0xd781('0x19')]({'plain':!![]});var _0x5c6026=_0xd781('0x36');return db['UserProfileSection'][_0xd781('0x37')]({'where':{'name':_0x5c6026,'userProfileId':_0x22b94e[_0xd781('0x38')]},'raw':!![]})['then'](function(_0x1a5833){if(_0x1a5833&&_0x1a5833[_0xd781('0x39')]===0x0){return db[_0xd781('0x1a')][_0xd781('0x31')]({'name':_0x140567['name'],'resourceId':_0x140567['id'],'type':_0x1a5833[_0xd781('0x1d')],'sectionId':_0x1a5833['id']},{})['then'](function(){return _0x123c8f;});}else{return _0x123c8f;}})[_0xd781('0x3a')](function(_0xcdaacf){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xcdaacf);throw _0xcdaacf;});}return _0x123c8f;})[_0xd781('0x18')](respondWithResult(_0x5651de,0xc9))[_0xd781('0x3a')](handleError(_0x5651de,null));};exports[_0xd781('0x16')]=function(_0x23bbab,_0x53aba6){if(_0x23bbab[_0xd781('0x32')]['id']){delete _0x23bbab[_0xd781('0x32')]['id'];}return db['FaxQueue']['find']({'where':{'id':_0x23bbab[_0xd781('0x3b')]['id']}})[_0xd781('0x18')](handleEntityNotFound(_0x53aba6,null))[_0xd781('0x18')](saveUpdates(_0x23bbab['body'],null))['then'](respondWithResult(_0x53aba6,null))[_0xd781('0x3a')](handleError(_0x53aba6,null));};exports[_0xd781('0x17')]=function(_0x3c7076,_0x411b63){return db[_0xd781('0x21')][_0xd781('0x37')]({'where':{'id':_0x3c7076['params']['id']}})['then'](handleEntityNotFound(_0x411b63,null))[_0xd781('0x18')](removeEntity(_0x411b63,null))[_0xd781('0x3a')](handleError(_0x411b63,null));};exports[_0xd781('0x3c')]=function(_0x46efdc,_0x10a6e4){return db['FaxQueue'][_0xd781('0x3c')]()[_0xd781('0x18')](respondWithResult(_0x10a6e4,null))[_0xd781('0x3a')](handleError(_0x10a6e4,null));};exports['getMembers']=function(_0x1009d5,_0x14642a){var _0x2f1f7a={'raw':!![],'where':{}},_0x5a0cdd={},_0xda7824;return db[_0xd781('0x21')]['findOne']({'where':{'id':_0x1009d5['params']['id']}})[_0xd781('0x18')](handleEntityNotFound(_0x14642a,null))[_0xd781('0x18')](function(_0x1efb2a){if(_0x1efb2a){_0xda7824=_0x1efb2a['get']({'plain':!![]});_0x5a0cdd[_0xd781('0x29')]=_[_0xd781('0x2a')](db[_0xd781('0x3d')][_0xd781('0x22')]);_0x5a0cdd[_0xd781('0x27')]=_[_0xd781('0x2a')](_0x1009d5[_0xd781('0x27')]);_0x5a0cdd['filters']=_[_0xd781('0x2c')](_0x5a0cdd[_0xd781('0x29')],_0x5a0cdd[_0xd781('0x27')]);_0x2f1f7a['attributes']=_[_0xd781('0x2c')](_0x5a0cdd[_0xd781('0x29')],qs['fields'](_0x1009d5[_0xd781('0x27')][_0xd781('0x2e')]));_0x2f1f7a[_0xd781('0x2d')]=_0x2f1f7a[_0xd781('0x2d')][_0xd781('0x2f')]?_0x2f1f7a['attributes']:_0x5a0cdd[_0xd781('0x29')];if(!_0x1009d5['query'][_0xd781('0x3e')]('nolimit')){_0x2f1f7a[_0xd781('0x11')]=qs[_0xd781('0x11')](_0x1009d5['query'][_0xd781('0x11')]);_0x2f1f7a['offset']=qs['offset'](_0x1009d5['query'][_0xd781('0xf')]);}_0x2f1f7a[_0xd781('0x3f')]=qs['sort'](_0x1009d5[_0xd781('0x27')]['sort']);_0x2f1f7a[_0xd781('0x25')]=qs[_0xd781('0x2b')](_[_0xd781('0x40')](_0x1009d5[_0xd781('0x27')],_0x5a0cdd['filters']));_0x2f1f7a[_0xd781('0x25')]['FaxQueueId']=_0x1efb2a['id'];if(_0x1009d5[_0xd781('0x27')]['filter']){_0x2f1f7a[_0xd781('0x25')]=_[_0xd781('0x30')](_0x2f1f7a['where'],{'$or':_[_0xd781('0x20')](_0x2f1f7a[_0xd781('0x2d')],function(_0xee40c9){var _0x32fd9f={};_0x32fd9f[_0xee40c9]={'$like':'%'+_0x1009d5[_0xd781('0x27')][_0xd781('0x41')]+'%'};return _0x32fd9f;})});}_0x2f1f7a=_['merge']({},_0x2f1f7a,_0x1009d5['options']);return db[_0xd781('0x3d')][_0xd781('0x42')](_0x2f1f7a);}})[_0xd781('0x18')](function(_0x15cad9){if(_0x15cad9){return db['User'][_0xd781('0x43')]({'where':{'id':_['map'](_0x15cad9,_0xd781('0x44')),'role':_0xd781('0x45')},'attributes':['id',_0xd781('0x1d'),_0xd781('0x46'),'updatedAt','createdAt']});}})[_0xd781('0x18')](function(_0x567345){if(_0x567345){return{'count':_0x567345[_0xd781('0x12')],'rows':_[_0xd781('0x20')](_0x567345[_0xd781('0x28')],function(_0x1a590d){return{'membername':_0x1a590d[_0xd781('0x1d')],'UserId':_0x1a590d['id'],'queue_name':_0xda7824['name'],'FaxQueueId':_0xda7824['id'],'interface':util[_0xd781('0x47')](_0xd781('0x48'),'SIP',_0x1a590d[_0xd781('0x1d')]),'penalty':0x0,'paused':_0x1a590d[_0xd781('0x46')],'createdAt':_0x1a590d[_0xd781('0x49')],'updatedAt':_0x1a590d[_0xd781('0x4a')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xd781('0x18')](respondWithFilteredResult(_0x14642a,_0x2f1f7a))[_0xd781('0x3a')](handleError(_0x14642a,null));};exports[_0xd781('0x4b')]=function(_0x12d2ab,_0x19f91e){var _0x11e400={};var _0x2dd800={};var _0x42f6c9;var _0x57d205;return db[_0xd781('0x21')][_0xd781('0x4c')]({'where':{'id':_0x12d2ab[_0xd781('0x3b')]['id']}})[_0xd781('0x18')](handleEntityNotFound(_0x19f91e,null))['then'](function(_0x1a725b){if(_0x1a725b){_0x42f6c9=_0x1a725b;_0x2dd800[_0xd781('0x29')]=_[_0xd781('0x2a')](db[_0xd781('0x4d')][_0xd781('0x22')]);_0x2dd800['query']=_['keys'](_0x12d2ab[_0xd781('0x27')]);_0x2dd800['filters']=_['intersection'](_0x2dd800['model'],_0x2dd800['query']);_0x11e400[_0xd781('0x2d')]=_['intersection'](_0x2dd800[_0xd781('0x29')],qs[_0xd781('0x2e')](_0x12d2ab[_0xd781('0x27')][_0xd781('0x2e')]));_0x11e400[_0xd781('0x2d')]=_0x11e400['attributes'][_0xd781('0x2f')]?_0x11e400[_0xd781('0x2d')]:_0x2dd800[_0xd781('0x29')];_0x11e400[_0xd781('0x3f')]=qs[_0xd781('0x4e')](_0x12d2ab[_0xd781('0x27')]['sort']);_0x11e400['where']=qs[_0xd781('0x2b')](_['pick'](_0x12d2ab[_0xd781('0x27')],_0x2dd800[_0xd781('0x2b')]));if(_0x12d2ab[_0xd781('0x27')][_0xd781('0x41')]){_0x11e400['where']=_[_0xd781('0x30')](_0x11e400[_0xd781('0x25')],{'$or':_[_0xd781('0x20')](_0x11e400[_0xd781('0x2d')],function(_0x13cf90){var _0x5429fd={};_0x5429fd[_0x13cf90]={'$like':'%'+_0x12d2ab[_0xd781('0x27')]['filter']+'%'};return _0x5429fd;})});}_0x11e400=_[_0xd781('0x30')]({},_0x11e400,_0x12d2ab[_0xd781('0x4f')]);return _0x42f6c9['getTeams'](_0x11e400);}})['then'](function(_0x15b7e6){if(_0x15b7e6){_0x57d205=_0x15b7e6[_0xd781('0x2f')];if(!_0x12d2ab[_0xd781('0x27')][_0xd781('0x3e')](_0xd781('0x50'))){_0x11e400[_0xd781('0x11')]=qs[_0xd781('0x11')](_0x12d2ab[_0xd781('0x27')][_0xd781('0x11')]);_0x11e400['offset']=qs[_0xd781('0xf')](_0x12d2ab[_0xd781('0x27')]['offset']);}return _0x42f6c9[_0xd781('0x4b')](_0x11e400);}})['then'](function(_0x2948a6){if(_0x2948a6){return _0x2948a6?{'count':_0x57d205,'rows':_0x2948a6}:null;}})[_0xd781('0x18')](respondWithResult(_0x19f91e,null))['catch'](handleError(_0x19f91e,null));};exports['addTeams']=function(_0x3fda63,_0x3c34e8){var _0x437ef3=_0x3fda63[_0xd781('0x32')][_0xd781('0x51')];return db[_0xd781('0x4d')]['findAll']({'where':{'id':_0x437ef3},'attributes':['id'],'include':[{'model':db[_0xd781('0x52')],'as':_0xd781('0x53'),'attributes':['id',_0xd781('0x1d'),_0xd781('0x54'),_0xd781('0x55'),_0xd781('0x56')],'raw':!![]}]})[_0xd781('0x18')](function(_0x38fbc3){if(_0x38fbc3){var _0x24b96e=_[_0xd781('0x57')](_0x38fbc3,function(_0x437e40){var _0x48dd7a=_0x437e40[_0xd781('0x19')]({'plain':!![]});return _0x48dd7a['Agents'];});return db[_0xd781('0x21')][_0xd781('0x37')]({'where':{'id':_0x3fda63[_0xd781('0x3b')]['id']}})[_0xd781('0x18')](function(_0x25c66a){return db[_0xd781('0x58')][_0xd781('0x59')](function(_0x19beb3){return _0x25c66a[_0xd781('0x5a')](_0x437ef3,{'transaction':_0x19beb3})[_0xd781('0x18')](function(){return BPromise['each'](_0x24b96e,function(_0xaa4b46){return db[_0xd781('0x3d')]['findOrCreate']({'where':{'UserId':_0xaa4b46['id'],'FaxQueueId':_0x3fda63[_0xd781('0x3b')]['id']},'transaction':_0x19beb3});});})[_0xd781('0x18')](function(){_0x24b96e[_0xd781('0x5b')](function(_0x4c330c){socket['emit'](_0xd781('0x5c'),{'UserId':_0x4c330c['id'],'FaxQueueId':_0x25c66a['id']});});});});});}})['then'](respondWithStatusCode(_0x3c34e8,null))[_0xd781('0x3a')](handleError(_0x3c34e8,null));};exports[_0xd781('0x5d')]=function(_0x417e5c,_0x1624a3){return db[_0xd781('0x4d')]['findAll']({'where':{'id':_0x417e5c[_0xd781('0x27')][_0xd781('0x51')]},'attributes':['id'],'include':[{'model':db[_0xd781('0x52')],'as':_0xd781('0x53'),'attributes':['id'],'raw':!![]}]})[_0xd781('0x18')](handleEntityNotFound(_0x1624a3,null))[_0xd781('0x18')](function(_0x1b8ce0){var _0x32dc27=_[_0xd781('0x20')](_0x1b8ce0,'id');var _0x3a1045=[];var _0x47d6a3=[];var _0x4de9de=squel[_0xd781('0x5e')]();_0x4de9de[_0xd781('0x5f')]('tq.TeamId')[_0xd781('0x60')](_0xd781('0x61'),'tq')[_0xd781('0x62')]('user_has_teams','ut',_0xd781('0x63'))[_0xd781('0x25')]('FaxQueueId\x20=\x20?',_0x417e5c[_0xd781('0x3b')]['id']);for(var _0x549004=0x0;_0x549004<_0x1b8ce0[_0xd781('0x2f')];_0x549004+=0x1){let _0x23dba5=_0x1b8ce0[_0x549004];for(var _0x3e0749=0x0;_0x3e0749<_0x23dba5[_0xd781('0x53')][_0xd781('0x2f')];_0x3e0749+=0x1){let _0x5d6524=_0x23dba5[_0xd781('0x53')][_0x3e0749];var _0x44b4d4=_0x4de9de[_0xd781('0x64')]();_0x44b4d4[_0xd781('0x25')](_0xd781('0x65'),_0x5d6524['id']);_0x47d6a3[_0xd781('0x66')](db['sequelize'][_0xd781('0x27')](_0x44b4d4[_0xd781('0x67')](),{'type':db['sequelize'][_0xd781('0x68')][_0xd781('0x69')]})['then'](function(_0x1ba077){if(_0x1ba077[_0xd781('0x2f')]===0x1){return _0x5d6524['id'];}else{var _0x44e8c9=_[_0xd781('0x6a')](_[_0xd781('0x20')](_0x1ba077,'TeamId'),function(_0x50cfad){return _['includes'](_0x32dc27,_0x50cfad);});if(_0x44e8c9){return _0x5d6524['id'];}}}));}}return BPromise[_0xd781('0x6b')](_0x47d6a3)[_0xd781('0x18')](function(_0x476023){_0x3a1045=_(_0x3a1045)[_0xd781('0x6c')](_0x476023)[_0xd781('0x6d')]()[_0xd781('0x6e')]();return db[_0xd781('0x21')][_0xd781('0x37')]({'where':{'id':_0x417e5c[_0xd781('0x3b')]['id']}})['then'](function(_0x2c2217){return db[_0xd781('0x58')][_0xd781('0x59')](function(_0x460946){return _0x2c2217[_0xd781('0x5d')](_0x417e5c['query']['ids'],{'transaction':_0x460946})['then'](function(){if(!_[_0xd781('0x6f')](_0x3a1045)){return _0x2c2217['removeAgents'](_0x3a1045,{'transaction':_0x460946});}})[_0xd781('0x18')](function(){_0x3a1045[_0xd781('0x5b')](function(_0x4dcba3){socket['emit'](_0xd781('0x70'),{'UserId':_0x4dcba3,'FaxQueueId':_0x2c2217['id']});});});});});});})[_0xd781('0x18')](respondWithStatusCode(_0x1624a3,null))[_0xd781('0x3a')](handleError(_0x1624a3,null));};exports[_0xd781('0x71')]=function(_0x5b6163,_0x38aec8){return db[_0xd781('0x21')][_0xd781('0x37')]({'where':{'id':_0x5b6163[_0xd781('0x3b')]['id']}})[_0xd781('0x18')](handleEntityNotFound(_0x38aec8,null))['then'](function(_0x3d5f26){if(_0x3d5f26){return _0x3d5f26[_0xd781('0x71')](_0x5b6163['body'][_0xd781('0x51')],_[_0xd781('0x72')](_0x5b6163[_0xd781('0x32')],[_0xd781('0x51'),'id'])||{})[_0xd781('0x73')](function(_0x441e08){for(var _0x289ecb=0x0;_0x289ecb<_0x5b6163[_0xd781('0x32')]['ids']['length'];_0x289ecb+=0x1){socket[_0xd781('0x74')](_0xd781('0x5c'),{'UserId':Number(_0x5b6163['body'][_0xd781('0x51')][_0x289ecb]),'FaxQueueId':Number(_0x5b6163[_0xd781('0x3b')]['id'])});}return _0x441e08;});}})['then'](respondWithResult(_0x38aec8,null))[_0xd781('0x3a')](handleError(_0x38aec8,null));};exports[_0xd781('0x75')]=function(_0x5e14fe,_0x18f3dd){return db['FaxQueue'][_0xd781('0x37')]({'where':{'id':_0x5e14fe[_0xd781('0x3b')]['id']}})[_0xd781('0x18')](handleEntityNotFound(_0x18f3dd,null))['then'](function(_0x5a2252){if(_0x5a2252){return _0x5a2252[_0xd781('0x75')](_0x5e14fe[_0xd781('0x27')]['ids'])[_0xd781('0x18')](function(){if(_[_0xd781('0x76')](_0x5e14fe[_0xd781('0x27')][_0xd781('0x51')])){for(var _0xb777fd=0x0;_0xb777fd<_0x5e14fe[_0xd781('0x27')][_0xd781('0x51')][_0xd781('0x2f')];_0xb777fd+=0x1){socket['emit'](_0xd781('0x70'),{'UserId':Number(_0x5e14fe[_0xd781('0x27')][_0xd781('0x51')][_0xb777fd]),'FaxQueueId':Number(_0x5e14fe[_0xd781('0x3b')]['id'])});}}else{socket[_0xd781('0x74')]('userFaxQueue:remove',{'UserId':Number(_0x5e14fe[_0xd781('0x27')][_0xd781('0x51')]),'FaxQueueId':Number(_0x5e14fe[_0xd781('0x3b')]['id'])});}});}})[_0xd781('0x18')](respondWithStatusCode(_0x18f3dd,null))[_0xd781('0x3a')](handleError(_0x18f3dd,null));};exports[_0xd781('0x77')]=function(_0x25f0c4,_0x5628ba){var _0x50907b={};var _0x591e26={};var _0x5257f1;var _0x307e1b;return db['FaxQueue'][_0xd781('0x4c')]({'where':{'id':_0x25f0c4['params']['id']}})['then'](handleEntityNotFound(_0x5628ba,null))[_0xd781('0x18')](function(_0x35ee69){if(_0x35ee69){_0x5257f1=_0x35ee69;_0x591e26[_0xd781('0x29')]=_[_0xd781('0x2a')](db[_0xd781('0x52')][_0xd781('0x22')]);_0x591e26[_0xd781('0x27')]=_[_0xd781('0x2a')](_0x25f0c4[_0xd781('0x27')]);_0x591e26[_0xd781('0x2b')]=_[_0xd781('0x2c')](_0x591e26[_0xd781('0x29')],_0x591e26[_0xd781('0x27')]);_0x50907b['attributes']=_[_0xd781('0x2c')](_0x591e26[_0xd781('0x29')],qs[_0xd781('0x2e')](_0x25f0c4[_0xd781('0x27')][_0xd781('0x2e')]));_0x50907b[_0xd781('0x2d')]=_0x50907b[_0xd781('0x2d')]['length']?_0x50907b[_0xd781('0x2d')]:_0x591e26[_0xd781('0x29')];_0x50907b[_0xd781('0x3f')]=qs[_0xd781('0x4e')](_0x25f0c4['query'][_0xd781('0x4e')]);_0x50907b[_0xd781('0x25')]=qs['filters'](_[_0xd781('0x40')](_0x25f0c4['query'],_0x591e26['filters']));if(_0x25f0c4['query'][_0xd781('0x41')]){_0x50907b[_0xd781('0x25')]=_['merge'](_0x50907b[_0xd781('0x25')],{'$or':_[_0xd781('0x20')](_0x50907b[_0xd781('0x2d')],function(_0x3c21d5){var _0xc98c3={};_0xc98c3[_0x3c21d5]={'$like':'%'+_0x25f0c4[_0xd781('0x27')][_0xd781('0x41')]+'%'};return _0xc98c3;})});}_0x50907b=_['merge']({},_0x50907b,_0x25f0c4[_0xd781('0x4f')]);return _0x5257f1[_0xd781('0x77')](_0x50907b);}})['then'](function(_0x1df34c){if(_0x1df34c){_0x307e1b=_0x1df34c[_0xd781('0x2f')];if(!_0x25f0c4['query'][_0xd781('0x3e')]('nolimit')){_0x50907b['limit']=qs[_0xd781('0x11')](_0x25f0c4[_0xd781('0x27')][_0xd781('0x11')]);_0x50907b[_0xd781('0xf')]=qs[_0xd781('0xf')](_0x25f0c4[_0xd781('0x27')][_0xd781('0xf')]);}return _0x5257f1['getAgents'](_0x50907b);}})[_0xd781('0x18')](function(_0x2e767f){if(_0x2e767f){return _0x2e767f?{'count':_0x307e1b,'rows':_0x2e767f}:null;}})['then'](respondWithResult(_0x5628ba,null))[_0xd781('0x3a')](handleError(_0x5628ba,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 2002ae5..1ec402b 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 _0xe4cb=['setMaxListeners','save','update','remove','emit','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x40178c,_0x326170){var _0x4622d0=function(_0x5d05f5){while(--_0x5d05f5){_0x40178c['push'](_0x40178c['shift']());}};_0x4622d0(++_0x326170);}(_0xe4cb,0x97));var _0xbe4c=function(_0x4a07d9,_0x8f8c4f){_0x4a07d9=_0x4a07d9-0x0;var _0x108c37=_0xe4cb[_0x4a07d9];return _0x108c37;};'use strict';var EventEmitter=require(_0xbe4c('0x0'));var FaxQueue=require(_0xbe4c('0x1'))['db']['FaxQueue'];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0xbe4c('0x2')](0x0);var events={'afterCreate':_0xbe4c('0x3'),'afterUpdate':_0xbe4c('0x4'),'afterDestroy':_0xbe4c('0x5')};function emitEvent(_0x41ca57){return function(_0xf80379,_0x2b8135,_0x13e314){FaxQueueEvents[_0xbe4c('0x6')](_0x41ca57+':'+_0xf80379['id'],_0xf80379);FaxQueueEvents['emit'](_0x41ca57,_0xf80379);_0x13e314(null);};}for(var e in events){if(events[_0xbe4c('0x7')](e)){var event=events[e];FaxQueue['hook'](e,emitEvent(event));}}module[_0xbe4c('0x8')]=FaxQueueEvents; \ No newline at end of file +var _0x283b=['update','emit','hasOwnProperty','hook','exports','../../mysqldb','FaxQueue','save'];(function(_0x3d5722,_0x3960e0){var _0x367eda=function(_0x26b5a2){while(--_0x26b5a2){_0x3d5722['push'](_0x3d5722['shift']());}};_0x367eda(++_0x3960e0);}(_0x283b,0x11d));var _0xb283=function(_0x42d57b,_0x4e962d){_0x42d57b=_0x42d57b-0x0;var _0x43ec08=_0x283b[_0x42d57b];return _0x43ec08;};'use strict';var EventEmitter=require('events');var FaxQueue=require(_0xb283('0x0'))['db'][_0xb283('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xb283('0x2'),'afterUpdate':_0xb283('0x3'),'afterDestroy':'remove'};function emitEvent(_0x34ec90){return function(_0x73fdd7,_0x1e67d3,_0x5306f1){FaxQueueEvents['emit'](_0x34ec90+':'+_0x73fdd7['id'],_0x73fdd7);FaxQueueEvents[_0xb283('0x4')](_0x34ec90,_0x73fdd7);_0x5306f1(null);};}for(var e in events){if(events[_0xb283('0x5')](e)){var event=events[e];FaxQueue[_0xb283('0x6')](e,emitEvent(event));}}module[_0xb283('0x7')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index c0d1f8e..b281163 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 _0x342c=['./faxQueue.attributes','exports','define','FaxQueue','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x599f41,_0x4db732){var _0x2e4d58=function(_0x14c882){while(--_0x14c882){_0x599f41['push'](_0x599f41['shift']());}};_0x2e4d58(++_0x4db732);}(_0x342c,0xfb));var _0xc342=function(_0x289f6b,_0x2c269d){_0x289f6b=_0x289f6b-0x0;var _0x324bea=_0x342c[_0x289f6b];return _0x324bea;};'use strict';var _=require(_0xc342('0x0'));var util=require(_0xc342('0x1'));var logger=require(_0xc342('0x2'))(_0xc342('0x3'));var moment=require(_0xc342('0x4'));var BPromise=require(_0xc342('0x5'));var rp=require(_0xc342('0x6'));var fs=require('fs');var path=require(_0xc342('0x7'));var rimraf=require('rimraf');var config=require(_0xc342('0x8'));var attributes=require(_0xc342('0x9'));module[_0xc342('0xa')]=function(_0xb8b7a1,_0x354478){return _0xb8b7a1[_0xc342('0xb')](_0xc342('0xc'),attributes,{'tableName':'fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdb3e=['fax_queues','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./faxQueue.attributes','define'];(function(_0x12ef39,_0x18d320){var _0x47a734=function(_0x112dcf){while(--_0x112dcf){_0x12ef39['push'](_0x12ef39['shift']());}};_0x47a734(++_0x18d320);}(_0xdb3e,0x12d));var _0xedb3=function(_0x51404f,_0x2d1fcd){_0x51404f=_0x51404f-0x0;var _0x403f33=_0xdb3e[_0x51404f];return _0x403f33;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xedb3('0x0'))(_0xedb3('0x1'));var moment=require(_0xedb3('0x2'));var BPromise=require(_0xedb3('0x3'));var rp=require(_0xedb3('0x4'));var fs=require('fs');var path=require(_0xedb3('0x5'));var rimraf=require(_0xedb3('0x6'));var config=require('../../config/environment');var attributes=require(_0xedb3('0x7'));module['exports']=function(_0x3e3c45,_0x114046){return _0x3e3c45[_0xedb3('0x8')]('FaxQueue',attributes,{'tableName':_0xedb3('0x9'),'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 74b604d..cb0f9be 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 _0x1777=['code','message','result','FaxQueue','findAll','options','raw','where','attributes','limit','include','map','model','GetFaxQueue','catch','ShowFaxQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','register','then','info','FaxQueue,\x20%s,\x20%s','debug','FaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x22de44,_0x4be4e2){var _0x765644=function(_0x159860){while(--_0x159860){_0x22de44['push'](_0x22de44['shift']());}};_0x765644(++_0x4be4e2);}(_0x1777,0x136));var _0x7177=function(_0x436087,_0x1db9a7){_0x436087=_0x436087-0x0;var _0xeac751=_0x1777[_0x436087];return _0xeac751;};'use strict';var _=require(_0x7177('0x0'));var util=require(_0x7177('0x1'));var moment=require(_0x7177('0x2'));var BPromise=require(_0x7177('0x3'));var rs=require(_0x7177('0x4'));var fs=require('fs');var Redis=require(_0x7177('0x5'));var db=require(_0x7177('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x7177('0x7'))(_0x7177('0x8'));var config=require(_0x7177('0x9'));var jayson=require(_0x7177('0xa'));var client=jayson[_0x7177('0xb')]['http']({'port':0x232a});config[_0x7177('0xc')]=_[_0x7177('0xd')](config[_0x7177('0xc')],{'host':_0x7177('0xe'),'port':0x18eb});var socket=require(_0x7177('0xf'))(new Redis(config[_0x7177('0xc')]));require(_0x7177('0x10'))[_0x7177('0x11')](socket);function respondWithRpcPromise(_0x12f2c4,_0x422ba1,_0x19fea4){return new BPromise(function(_0x21cea0,_0x554c67){return client['request'](_0x12f2c4,_0x19fea4)[_0x7177('0x12')](function(_0x4ab089){logger[_0x7177('0x13')](_0x7177('0x14'),_0x422ba1,'request\x20sent');logger[_0x7177('0x15')](_0x7177('0x16'),_0x422ba1,_0x7177('0x17'),JSON[_0x7177('0x18')](_0x4ab089));if(_0x4ab089[_0x7177('0x19')]){if(_0x4ab089['error'][_0x7177('0x1a')]===0x1f4){logger[_0x7177('0x19')](_0x7177('0x14'),_0x422ba1,_0x4ab089['error'][_0x7177('0x1b')]);return _0x554c67(_0x4ab089['error'][_0x7177('0x1b')]);}logger[_0x7177('0x19')](_0x7177('0x14'),_0x422ba1,_0x4ab089[_0x7177('0x19')][_0x7177('0x1b')]);return _0x21cea0(_0x4ab089[_0x7177('0x19')]['message']);}else{logger[_0x7177('0x13')](_0x7177('0x14'),_0x422ba1,'request\x20sent');_0x21cea0(_0x4ab089[_0x7177('0x1c')][_0x7177('0x1b')]);}})['catch'](function(_0x56b9f0){logger[_0x7177('0x19')]('FaxQueue,\x20%s,\x20%s',_0x422ba1,_0x56b9f0);_0x554c67(_0x56b9f0);});});}exports['GetFaxQueue']=function(_0x17118b){var _0x41be19=this;return new Promise(function(_0x580ede,_0x445e71){return db[_0x7177('0x1d')][_0x7177('0x1e')]({'raw':_0x17118b[_0x7177('0x1f')]?_0x17118b[_0x7177('0x1f')][_0x7177('0x20')]===undefined?!![]:![]:!![],'where':_0x17118b[_0x7177('0x1f')]?_0x17118b[_0x7177('0x1f')][_0x7177('0x21')]||null:null,'attributes':_0x17118b[_0x7177('0x1f')]?_0x17118b[_0x7177('0x1f')][_0x7177('0x22')]||null:null,'limit':_0x17118b[_0x7177('0x1f')]?_0x17118b['options'][_0x7177('0x23')]||null:null,'include':_0x17118b[_0x7177('0x1f')]?_0x17118b[_0x7177('0x1f')][_0x7177('0x24')]?_[_0x7177('0x25')](_0x17118b[_0x7177('0x1f')]['include'],function(_0x28c87d){return{'model':db[_0x28c87d[_0x7177('0x26')]],'as':_0x28c87d['as'],'attributes':_0x28c87d[_0x7177('0x22')],'include':_0x28c87d[_0x7177('0x24')]?_['map'](_0x28c87d[_0x7177('0x24')],function(_0x1be0f0){return{'model':db[_0x1be0f0['model']],'as':_0x1be0f0['as'],'attributes':_0x1be0f0[_0x7177('0x22')],'include':_0x1be0f0[_0x7177('0x24')]?_[_0x7177('0x25')](_0x1be0f0[_0x7177('0x24')],function(_0x49afd9){return{'model':db[_0x49afd9[_0x7177('0x26')]],'as':_0x49afd9['as'],'attributes':_0x49afd9[_0x7177('0x22')]};}):[]};}):[]};}):[]:[]})[_0x7177('0x12')](function(_0x4e743a){logger[_0x7177('0x13')](_0x7177('0x27'),_0x17118b);logger['debug'](_0x7177('0x27'),_0x17118b,JSON[_0x7177('0x18')](_0x4e743a));_0x580ede(_0x4e743a);})[_0x7177('0x28')](function(_0x27318a){logger[_0x7177('0x19')]('GetFaxQueue',_0x27318a['message'],_0x17118b);_0x445e71(_0x41be19[_0x7177('0x19')](0x1f4,_0x27318a[_0x7177('0x1b')]));});});};exports['ShowFaxQueue']=function(_0x59da1e){var _0x237f1f=this;return new Promise(function(_0xc749b9,_0x3c2e4e){return db['FaxQueue']['find']({'raw':_0x59da1e[_0x7177('0x1f')]?_0x59da1e[_0x7177('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x59da1e['options']?_0x59da1e[_0x7177('0x1f')]['where']||null:null,'attributes':_0x59da1e['options']?_0x59da1e['options'][_0x7177('0x22')]||null:null,'include':_0x59da1e[_0x7177('0x1f')]?_0x59da1e[_0x7177('0x1f')][_0x7177('0x24')]?_[_0x7177('0x25')](_0x59da1e[_0x7177('0x1f')][_0x7177('0x24')],function(_0x5f2916){return{'model':db[_0x5f2916[_0x7177('0x26')]],'as':_0x5f2916['as'],'attributes':_0x5f2916[_0x7177('0x22')],'include':_0x5f2916[_0x7177('0x24')]?_['map'](_0x5f2916[_0x7177('0x24')],function(_0x2e5121){return{'model':db[_0x2e5121[_0x7177('0x26')]],'as':_0x2e5121['as'],'attributes':_0x2e5121[_0x7177('0x22')],'include':_0x2e5121['include']?_[_0x7177('0x25')](_0x2e5121[_0x7177('0x24')],function(_0x84e05d){return{'model':db[_0x84e05d[_0x7177('0x26')]],'as':_0x84e05d['as'],'attributes':_0x84e05d['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x211500){logger[_0x7177('0x13')](_0x7177('0x29'),_0x59da1e);logger['debug']('ShowFaxQueue',_0x59da1e,JSON[_0x7177('0x18')](_0x211500));_0xc749b9(_0x211500);})['catch'](function(_0x27862c){logger[_0x7177('0x19')](_0x7177('0x29'),_0x27862c['message'],_0x59da1e);_0x3c2e4e(_0x237f1f[_0x7177('0x19')](0x1f4,_0x27862c[_0x7177('0x1b')]));});});}; \ No newline at end of file +var _0xb8be=['GetFaxQueue','FaxQueue','options','raw','where','attributes','include','model','map','catch','ShowFaxQueue','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./faxQueue.socket','register','request','then','info','FaxQueue,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xb8be,0x80));var _0xeb8b=function(_0x25d2fb,_0x18a774){_0x25d2fb=_0x25d2fb-0x0;var _0x1ded53=_0xb8be[_0x25d2fb];return _0x1ded53;};'use strict';var _=require('lodash');var util=require(_0xeb8b('0x0'));var moment=require(_0xeb8b('0x1'));var BPromise=require(_0xeb8b('0x2'));var rs=require(_0xeb8b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xeb8b('0x4'));var logger=require(_0xeb8b('0x5'))(_0xeb8b('0x6'));var config=require(_0xeb8b('0x7'));var jayson=require(_0xeb8b('0x8'));var client=jayson[_0xeb8b('0x9')][_0xeb8b('0xa')]({'port':0x232a});config['redis']=_[_0xeb8b('0xb')](config[_0xeb8b('0xc')],{'host':_0xeb8b('0xd'),'port':0x18eb});var socket=require(_0xeb8b('0xe'))(new Redis(config[_0xeb8b('0xc')]));require(_0xeb8b('0xf'))[_0xeb8b('0x10')](socket);function respondWithRpcPromise(_0x179e48,_0x1a3ca9,_0x437a3c){return new BPromise(function(_0x3a6eae,_0x5687b0){return client[_0xeb8b('0x11')](_0x179e48,_0x437a3c)[_0xeb8b('0x12')](function(_0x262bbd){logger[_0xeb8b('0x13')](_0xeb8b('0x14'),_0x1a3ca9,'request\x20sent');logger[_0xeb8b('0x15')]('FaxQueue,\x20%s,\x20%s,\x20%s',_0x1a3ca9,_0xeb8b('0x16'),JSON[_0xeb8b('0x17')](_0x262bbd));if(_0x262bbd[_0xeb8b('0x18')]){if(_0x262bbd[_0xeb8b('0x18')][_0xeb8b('0x19')]===0x1f4){logger[_0xeb8b('0x18')](_0xeb8b('0x14'),_0x1a3ca9,_0x262bbd[_0xeb8b('0x18')][_0xeb8b('0x1a')]);return _0x5687b0(_0x262bbd[_0xeb8b('0x18')]['message']);}logger[_0xeb8b('0x18')](_0xeb8b('0x14'),_0x1a3ca9,_0x262bbd[_0xeb8b('0x18')][_0xeb8b('0x1a')]);return _0x3a6eae(_0x262bbd[_0xeb8b('0x18')][_0xeb8b('0x1a')]);}else{logger[_0xeb8b('0x13')](_0xeb8b('0x14'),_0x1a3ca9,_0xeb8b('0x16'));_0x3a6eae(_0x262bbd[_0xeb8b('0x1b')][_0xeb8b('0x1a')]);}})['catch'](function(_0x42d0d3){logger[_0xeb8b('0x18')](_0xeb8b('0x14'),_0x1a3ca9,_0x42d0d3);_0x5687b0(_0x42d0d3);});});}exports[_0xeb8b('0x1c')]=function(_0x25d674){var _0x525ba4=this;return new Promise(function(_0xf62003,_0x412b8c){return db[_0xeb8b('0x1d')]['findAll']({'raw':_0x25d674[_0xeb8b('0x1e')]?_0x25d674['options'][_0xeb8b('0x1f')]===undefined?!![]:![]:!![],'where':_0x25d674['options']?_0x25d674[_0xeb8b('0x1e')][_0xeb8b('0x20')]||null:null,'attributes':_0x25d674[_0xeb8b('0x1e')]?_0x25d674['options'][_0xeb8b('0x21')]||null:null,'limit':_0x25d674[_0xeb8b('0x1e')]?_0x25d674[_0xeb8b('0x1e')]['limit']||null:null,'include':_0x25d674[_0xeb8b('0x1e')]?_0x25d674[_0xeb8b('0x1e')]['include']?_['map'](_0x25d674[_0xeb8b('0x1e')][_0xeb8b('0x22')],function(_0x36dd73){return{'model':db[_0x36dd73[_0xeb8b('0x23')]],'as':_0x36dd73['as'],'attributes':_0x36dd73[_0xeb8b('0x21')],'include':_0x36dd73[_0xeb8b('0x22')]?_[_0xeb8b('0x24')](_0x36dd73['include'],function(_0x21354d){return{'model':db[_0x21354d['model']],'as':_0x21354d['as'],'attributes':_0x21354d['attributes'],'include':_0x21354d['include']?_[_0xeb8b('0x24')](_0x21354d[_0xeb8b('0x22')],function(_0x50de4a){return{'model':db[_0x50de4a[_0xeb8b('0x23')]],'as':_0x50de4a['as'],'attributes':_0x50de4a['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5c09b4){logger[_0xeb8b('0x13')]('GetFaxQueue',_0x25d674);logger[_0xeb8b('0x15')](_0xeb8b('0x1c'),_0x25d674,JSON[_0xeb8b('0x17')](_0x5c09b4));_0xf62003(_0x5c09b4);})[_0xeb8b('0x25')](function(_0x38401f){logger[_0xeb8b('0x18')](_0xeb8b('0x1c'),_0x38401f['message'],_0x25d674);_0x412b8c(_0x525ba4[_0xeb8b('0x18')](0x1f4,_0x38401f['message']));});});};exports[_0xeb8b('0x26')]=function(_0x50a74f){var _0x4d4f25=this;return new Promise(function(_0x93032f,_0x5898a7){return db['FaxQueue']['find']({'raw':_0x50a74f[_0xeb8b('0x1e')]?_0x50a74f['options'][_0xeb8b('0x1f')]===undefined?!![]:![]:!![],'where':_0x50a74f[_0xeb8b('0x1e')]?_0x50a74f['options'][_0xeb8b('0x20')]||null:null,'attributes':_0x50a74f[_0xeb8b('0x1e')]?_0x50a74f[_0xeb8b('0x1e')][_0xeb8b('0x21')]||null:null,'include':_0x50a74f[_0xeb8b('0x1e')]?_0x50a74f['options']['include']?_[_0xeb8b('0x24')](_0x50a74f[_0xeb8b('0x1e')]['include'],function(_0x534d76){return{'model':db[_0x534d76['model']],'as':_0x534d76['as'],'attributes':_0x534d76[_0xeb8b('0x21')],'include':_0x534d76[_0xeb8b('0x22')]?_[_0xeb8b('0x24')](_0x534d76[_0xeb8b('0x22')],function(_0xe7fbe7){return{'model':db[_0xe7fbe7['model']],'as':_0xe7fbe7['as'],'attributes':_0xe7fbe7[_0xeb8b('0x21')],'include':_0xe7fbe7[_0xeb8b('0x22')]?_[_0xeb8b('0x24')](_0xe7fbe7[_0xeb8b('0x22')],function(_0x9fb403){return{'model':db[_0x9fb403[_0xeb8b('0x23')]],'as':_0x9fb403['as'],'attributes':_0x9fb403[_0xeb8b('0x21')]};}):[]};}):[]};}):[]:[]})[_0xeb8b('0x12')](function(_0x59ee37){logger[_0xeb8b('0x13')](_0xeb8b('0x26'),_0x50a74f);logger[_0xeb8b('0x15')](_0xeb8b('0x26'),_0x50a74f,JSON[_0xeb8b('0x17')](_0x59ee37));_0x93032f(_0x59ee37);})[_0xeb8b('0x25')](function(_0x47a613){logger[_0xeb8b('0x18')](_0xeb8b('0x26'),_0x47a613[_0xeb8b('0x1a')],_0x50a74f);_0x5898a7(_0x4d4f25['error'](0x1f4,_0x47a613['message']));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index e47eb7d..329576a 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 _0xe1e6=['./faxQueue.events','update','emit','removeListener','register','length','faxQueue:'];(function(_0x306731,_0x302751){var _0x1de49f=function(_0x39c334){while(--_0x39c334){_0x306731['push'](_0x306731['shift']());}};_0x1de49f(++_0x302751);}(_0xe1e6,0x196));var _0x6e1e=function(_0x216bb5,_0x4af124){_0x216bb5=_0x216bb5-0x0;var _0x324d27=_0xe1e6[_0x216bb5];return _0x324d27;};'use strict';var FaxQueueEvents=require(_0x6e1e('0x0'));var events=['save','remove',_0x6e1e('0x1')];function createListener(_0x456871,_0xa29ac3){return function(_0x2771b4){_0xa29ac3[_0x6e1e('0x2')](_0x456871,_0x2771b4);};}function removeListener(_0x5013c0,_0x1e02fa){return function(){FaxQueueEvents[_0x6e1e('0x3')](_0x5013c0,_0x1e02fa);};}exports[_0x6e1e('0x4')]=function(_0xfeeb35){for(var _0x282a55=0x0,_0x5e3e01=events[_0x6e1e('0x5')];_0x282a55<_0x5e3e01;_0x282a55++){var _0x5f0408=events[_0x282a55];var _0x5f1983=createListener(_0x6e1e('0x6')+_0x5f0408,_0xfeeb35);FaxQueueEvents['on'](_0x5f0408,_0x5f1983);}}; \ No newline at end of file +var _0xe200=['faxQueue:','./faxQueue.events','save','remove','update','register','length'];(function(_0x4e9d3c,_0x1f4b98){var _0x2d0825=function(_0x384676){while(--_0x384676){_0x4e9d3c['push'](_0x4e9d3c['shift']());}};_0x2d0825(++_0x1f4b98);}(_0xe200,0x8d));var _0x0e20=function(_0x276974,_0x3b6eed){_0x276974=_0x276974-0x0;var _0x37396f=_0xe200[_0x276974];return _0x37396f;};'use strict';var FaxQueueEvents=require(_0x0e20('0x0'));var events=[_0x0e20('0x1'),_0x0e20('0x2'),_0x0e20('0x3')];function createListener(_0x2f2c75,_0x266e5d){return function(_0x45f462){_0x266e5d['emit'](_0x2f2c75,_0x45f462);};}function removeListener(_0x5c0f7e,_0x5857f4){return function(){FaxQueueEvents['removeListener'](_0x5c0f7e,_0x5857f4);};}exports[_0x0e20('0x4')]=function(_0x588114){for(var _0x1d6095=0x0,_0x5a33ce=events[_0x0e20('0x5')];_0x1d6095<_0x5a33ce;_0x1d6095++){var _0x278070=events[_0x1d6095];var _0x2f76b3=createListener(_0x0e20('0x6')+_0x278070,_0x588114);FaxQueueEvents['on'](_0x278070,_0x2f76b3);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 7f5dfb2..51cd6a8 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 _0x5d17=['addAgents','update','delete','destroy','removeTeams','removeAgents','multer','util','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./faxQueue.controller','get','index','/describe','isAuthenticated','describe','/:id','getMembers','getTeams','/:id/users','getAgents','create','post','/:id/teams'];(function(_0x30f07a,_0x98341){var _0xb38461=function(_0x7b287a){while(--_0x7b287a){_0x30f07a['push'](_0x30f07a['shift']());}};_0xb38461(++_0x98341);}(_0x5d17,0x114));var _0x75d1=function(_0x355958,_0x71c9ef){_0x355958=_0x355958-0x0;var _0x2daee2=_0x5d17[_0x355958];return _0x2daee2;};'use strict';var multer=require(_0x75d1('0x0'));var util=require(_0x75d1('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x75d1('0x2'));var router=express[_0x75d1('0x3')]();var fs_extra=require(_0x75d1('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x75d1('0x5'));var config=require(_0x75d1('0x6'));var controller=require(_0x75d1('0x7'));router[_0x75d1('0x8')]('/',auth['isAuthenticated'](),controller[_0x75d1('0x9')]);router[_0x75d1('0x8')](_0x75d1('0xa'),auth[_0x75d1('0xb')](),controller[_0x75d1('0xc')]);router[_0x75d1('0x8')](_0x75d1('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x75d1('0x8')]('/:id/members',auth['isAuthenticated'](),controller[_0x75d1('0xe')]);router[_0x75d1('0x8')]('/:id/teams',auth[_0x75d1('0xb')](),controller[_0x75d1('0xf')]);router[_0x75d1('0x8')](_0x75d1('0x10'),auth[_0x75d1('0xb')](),controller[_0x75d1('0x11')]);router['post']('/',auth[_0x75d1('0xb')](),controller[_0x75d1('0x12')]);router[_0x75d1('0x13')](_0x75d1('0x14'),auth['isAuthenticated'](),controller['addTeams']);router['post'](_0x75d1('0x10'),auth[_0x75d1('0xb')](),controller[_0x75d1('0x15')]);router['put'](_0x75d1('0xd'),auth[_0x75d1('0xb')](),controller[_0x75d1('0x16')]);router[_0x75d1('0x17')](_0x75d1('0xd'),auth[_0x75d1('0xb')](),controller[_0x75d1('0x18')]);router[_0x75d1('0x17')](_0x75d1('0x14'),auth[_0x75d1('0xb')](),controller[_0x75d1('0x19')]);router['delete']('/:id/users',auth[_0x75d1('0xb')](),controller[_0x75d1('0x1a')]);module['exports']=router; \ No newline at end of file +var _0x0eeb=['connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','index','/:id','show','/:id/members','/:id/teams','/:id/users','getAgents','addTeams','addAgents','put','update','delete','destroy','removeAgents','multer','util','path'];(function(_0x3b5aa3,_0x5e7fa0){var _0x23d2e4=function(_0x595d71){while(--_0x595d71){_0x3b5aa3['push'](_0x3b5aa3['shift']());}};_0x23d2e4(++_0x5e7fa0);}(_0x0eeb,0xc5));var _0xb0ee=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x0eeb[_0x59ee6f];return _0x4c0979;};'use strict';var multer=require(_0xb0ee('0x0'));var util=require(_0xb0ee('0x1'));var path=require(_0xb0ee('0x2'));var timeout=require(_0xb0ee('0x3'));var express=require(_0xb0ee('0x4'));var router=express[_0xb0ee('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xb0ee('0x6'));var config=require(_0xb0ee('0x7'));var controller=require(_0xb0ee('0x8'));router[_0xb0ee('0x9')]('/',auth[_0xb0ee('0xa')](),controller[_0xb0ee('0xb')]);router[_0xb0ee('0x9')]('/describe',auth[_0xb0ee('0xa')](),controller['describe']);router[_0xb0ee('0x9')](_0xb0ee('0xc'),auth[_0xb0ee('0xa')](),controller[_0xb0ee('0xd')]);router[_0xb0ee('0x9')](_0xb0ee('0xe'),auth['isAuthenticated'](),controller['getMembers']);router[_0xb0ee('0x9')](_0xb0ee('0xf'),auth['isAuthenticated'](),controller['getTeams']);router[_0xb0ee('0x9')](_0xb0ee('0x10'),auth[_0xb0ee('0xa')](),controller[_0xb0ee('0x11')]);router['post']('/',auth[_0xb0ee('0xa')](),controller['create']);router['post']('/:id/teams',auth[_0xb0ee('0xa')](),controller[_0xb0ee('0x12')]);router['post'](_0xb0ee('0x10'),auth[_0xb0ee('0xa')](),controller[_0xb0ee('0x13')]);router[_0xb0ee('0x14')](_0xb0ee('0xc'),auth[_0xb0ee('0xa')](),controller[_0xb0ee('0x15')]);router[_0xb0ee('0x16')]('/:id',auth['isAuthenticated'](),controller[_0xb0ee('0x17')]);router['delete'](_0xb0ee('0xf'),auth[_0xb0ee('0xa')](),controller['removeTeams']);router['delete'](_0xb0ee('0x10'),auth[_0xb0ee('0xa')](),controller[_0xb0ee('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index d7c3061..ab09a0e 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 _0xc524=['STRING','DATE','sequelize'];(function(_0x4574c8,_0x2dd90e){var _0x23279e=function(_0xe80014){while(--_0xe80014){_0x4574c8['push'](_0x4574c8['shift']());}};_0x23279e(++_0x2dd90e);}(_0xc524,0x140));var _0x4c52=function(_0x5610d2,_0x1ac569){_0x5610d2=_0x5610d2-0x0;var _0x32032e=_0xc524[_0x5610d2];return _0x32032e;};'use strict';var moment=require('moment');var Sequelize=require(_0x4c52('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x4c52('0x1')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x4c52('0x2')]},'leaveAt':{'type':Sequelize[_0x4c52('0x2')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x4c52('0x2')]},'reason':{'type':Sequelize[_0x4c52('0x1')]}}; \ No newline at end of file +var _0x4e3e=['DATE','moment','exports','STRING'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x4e3e,0x139));var _0xe4e3=function(_0x5599aa,_0x1b9ffe){_0x5599aa=_0x5599aa-0x0;var _0x4b0f34=_0x4e3e[_0x5599aa];return _0x4b0f34;};'use strict';var moment=require(_0xe4e3('0x0'));var Sequelize=require('sequelize');module[_0xe4e3('0x1')]={'uniqueid':{'type':Sequelize[_0xe4e3('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xe4e3('0x2')]},'joinAt':{'type':Sequelize[_0xe4e3('0x3')]},'leaveAt':{'type':Sequelize[_0xe4e3('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xe4e3('0x3')]},'reason':{'type':Sequelize[_0xe4e3('0x2')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index c65e14f..108ff1c 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 _0xb544=['lodash','crypto','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','undefined','offset','count','limit','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','map','FaxQueueReport','rawAttributes','fieldName','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','include','findAll','rows','show','params','includeAll','find','catch','body','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path'];(function(_0x3a733e,_0xf03ef9){var _0x267f06=function(_0x52e0fe){while(--_0x52e0fe){_0x3a733e['push'](_0x3a733e['shift']());}};_0x267f06(++_0xf03ef9);}(_0xb544,0xd0));var _0x4b54=function(_0x1e4360,_0x930b9b){_0x1e4360=_0x1e4360-0x0;var _0x31e6b4=_0xb544[_0x1e4360];return _0x31e6b4;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4b54('0x0'));var jsonpatch=require(_0x4b54('0x1'));var rp=require(_0x4b54('0x2'));var moment=require(_0x4b54('0x3'));var BPromise=require(_0x4b54('0x4'));var Mustache=require(_0x4b54('0x5'));var util=require(_0x4b54('0x6'));var path=require(_0x4b54('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4b54('0x8'));var squel=require('squel');var crypto=require(_0x4b54('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x4b54('0xa'));var toCsv=require(_0x4b54('0xb'));var querystring=require('querystring');var Papa=require(_0x4b54('0xc'));var Redis=require(_0x4b54('0xd'));var authService=require(_0x4b54('0xe'));var qs=require(_0x4b54('0xf'));var as=require(_0x4b54('0x10'));var hardwareService=require(_0x4b54('0x11'));var logger=require(_0x4b54('0x12'))('api');var utils=require(_0x4b54('0x13'));var config=require(_0x4b54('0x14'));var licenseUtil=require(_0x4b54('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x16a4a6,_0x177f63){_0x177f63=_0x177f63||0xcc;return function(_0x4ea709){if(_0x4ea709){return _0x16a4a6[_0x4b54('0x16')](_0x177f63);}return _0x16a4a6[_0x4b54('0x17')](_0x177f63)['end']();};}function respondWithResult(_0x169d4e,_0x240a17){_0x240a17=_0x240a17||0xc8;return function(_0x4c0911){if(_0x4c0911){return _0x169d4e['status'](_0x240a17)[_0x4b54('0x18')](_0x4c0911);}};}function respondWithFilteredResult(_0x5c87db,_0x100d85){return function(_0x56955f){if(_0x56955f){var _0x160951=typeof _0x100d85['offset']===_0x4b54('0x19')&&typeof _0x100d85['limit']==='undefined';var _0x189b57=_0x56955f['count'];var _0x2f58cf=_0x160951?0x0:_0x100d85[_0x4b54('0x1a')];var _0x3b7702=_0x160951?_0x56955f[_0x4b54('0x1b')]:_0x100d85[_0x4b54('0x1a')]+_0x100d85[_0x4b54('0x1c')];var _0x5e9b49;if(_0x3b7702>=_0x189b57){_0x3b7702=_0x189b57;_0x5e9b49=0xc8;}else{_0x5e9b49=0xce;}_0x5c87db['status'](_0x5e9b49);return _0x5c87db['set'](_0x4b54('0x1d'),_0x2f58cf+'-'+_0x3b7702+'/'+_0x189b57)[_0x4b54('0x18')](_0x56955f);}return null;};}function patchUpdates(_0x5756f9){return function(_0x2e6ac8){try{jsonpatch[_0x4b54('0x1e')](_0x2e6ac8,_0x5756f9,!![]);}catch(_0x3610ac){return BPromise[_0x4b54('0x1f')](_0x3610ac);}return _0x2e6ac8[_0x4b54('0x20')]();};}function saveUpdates(_0x2460c5,_0x204282){return function(_0x449246){if(_0x449246){return _0x449246[_0x4b54('0x21')](_0x2460c5)[_0x4b54('0x22')](function(_0x1fbf12){return _0x1fbf12;});}return null;};}function removeEntity(_0x56a455,_0x34c526){return function(_0x5e71b2){if(_0x5e71b2){return _0x5e71b2[_0x4b54('0x23')]()[_0x4b54('0x22')](function(){_0x56a455[_0x4b54('0x17')](0xcc)[_0x4b54('0x24')]();});}};}function handleEntityNotFound(_0x506205,_0x40ffd9){return function(_0x18bb65){if(!_0x18bb65){_0x506205[_0x4b54('0x16')](0x194);}return _0x18bb65;};}function handleError(_0xbdb7f5,_0x1f9a79){_0x1f9a79=_0x1f9a79||0x1f4;return function(_0x5e4750){logger[_0x4b54('0x25')](_0x5e4750[_0x4b54('0x26')]);if(_0x5e4750[_0x4b54('0x27')]){delete _0x5e4750[_0x4b54('0x27')];}_0xbdb7f5[_0x4b54('0x17')](_0x1f9a79)[_0x4b54('0x28')](_0x5e4750);};}exports[_0x4b54('0x29')]=function(_0x9c99d9,_0x19792c){var _0x19b661={},_0x148779={},_0x5d87cc={'count':0x0,'rows':[]};var _0x5c0690=_[_0x4b54('0x2a')](db[_0x4b54('0x2b')][_0x4b54('0x2c')],function(_0x4b354e){return{'name':_0x4b354e[_0x4b54('0x2d')],'type':_0x4b354e['type']['key']};});_0x148779[_0x4b54('0x2e')]=_['map'](_0x5c0690,'name');_0x148779[_0x4b54('0x2f')]=_[_0x4b54('0x30')](_0x9c99d9[_0x4b54('0x2f')]);_0x148779[_0x4b54('0x31')]=_[_0x4b54('0x32')](_0x148779[_0x4b54('0x2e')],_0x148779[_0x4b54('0x2f')]);_0x19b661['attributes']=_[_0x4b54('0x32')](_0x148779[_0x4b54('0x2e')],qs[_0x4b54('0x33')](_0x9c99d9[_0x4b54('0x2f')][_0x4b54('0x33')]));_0x19b661[_0x4b54('0x34')]=_0x19b661[_0x4b54('0x34')]['length']?_0x19b661[_0x4b54('0x34')]:_0x148779[_0x4b54('0x2e')];if(!_0x9c99d9[_0x4b54('0x2f')][_0x4b54('0x35')](_0x4b54('0x36'))){_0x19b661[_0x4b54('0x1c')]=qs['limit'](_0x9c99d9[_0x4b54('0x2f')][_0x4b54('0x1c')]);_0x19b661['offset']=qs[_0x4b54('0x1a')](_0x9c99d9['query'][_0x4b54('0x1a')]);}_0x19b661[_0x4b54('0x37')]=qs['sort'](_0x9c99d9['query'][_0x4b54('0x38')]);_0x19b661[_0x4b54('0x39')]=qs[_0x4b54('0x31')](_[_0x4b54('0x3a')](_0x9c99d9[_0x4b54('0x2f')],_0x148779['filters']),_0x5c0690);if(_0x9c99d9[_0x4b54('0x2f')][_0x4b54('0x3b')]){_0x19b661[_0x4b54('0x39')]=_[_0x4b54('0x3c')](_0x19b661['where'],{'$or':_[_0x4b54('0x2a')](_0x5c0690,function(_0x2ab71f){if(_0x2ab71f['type']!=='VIRTUAL'){var _0x15e232={};_0x15e232[_0x2ab71f[_0x4b54('0x27')]]={'$like':'%'+_0x9c99d9['query'][_0x4b54('0x3b')]+'%'};return _0x15e232;}})});}_0x19b661=_[_0x4b54('0x3c')]({},_0x19b661,_0x9c99d9[_0x4b54('0x3d')]);var _0x4667c3={'where':_0x19b661[_0x4b54('0x39')]};return db[_0x4b54('0x2b')]['count'](_0x4667c3)[_0x4b54('0x22')](function(_0x17c42d){_0x5d87cc[_0x4b54('0x1b')]=_0x17c42d;if(_0x9c99d9[_0x4b54('0x2f')]['includeAll']){_0x19b661[_0x4b54('0x3e')]=[{'all':!![]}];}return db[_0x4b54('0x2b')][_0x4b54('0x3f')](_0x19b661);})['then'](function(_0x382961){_0x5d87cc[_0x4b54('0x40')]=_0x382961;return _0x5d87cc;})[_0x4b54('0x22')](respondWithFilteredResult(_0x19792c,_0x19b661))['catch'](handleError(_0x19792c,null));};exports[_0x4b54('0x41')]=function(_0x55c5bc,_0x57fbad){var _0x1789fd={'raw':!![],'where':{'id':_0x55c5bc[_0x4b54('0x42')]['id']}},_0x886d18={};_0x886d18['model']=_[_0x4b54('0x30')](db[_0x4b54('0x2b')][_0x4b54('0x2c')]);_0x886d18[_0x4b54('0x2f')]=_[_0x4b54('0x30')](_0x55c5bc['query']);_0x886d18[_0x4b54('0x31')]=_[_0x4b54('0x32')](_0x886d18[_0x4b54('0x2e')],_0x886d18[_0x4b54('0x2f')]);_0x1789fd[_0x4b54('0x34')]=_[_0x4b54('0x32')](_0x886d18['model'],qs['fields'](_0x55c5bc[_0x4b54('0x2f')]['fields']));_0x1789fd[_0x4b54('0x34')]=_0x1789fd[_0x4b54('0x34')]['length']?_0x1789fd[_0x4b54('0x34')]:_0x886d18[_0x4b54('0x2e')];if(_0x55c5bc[_0x4b54('0x2f')][_0x4b54('0x43')]){_0x1789fd['include']=[{'all':!![]}];}_0x1789fd=_[_0x4b54('0x3c')]({},_0x1789fd,_0x55c5bc[_0x4b54('0x3d')]);return db[_0x4b54('0x2b')][_0x4b54('0x44')](_0x1789fd)[_0x4b54('0x22')](handleEntityNotFound(_0x57fbad,null))[_0x4b54('0x22')](respondWithResult(_0x57fbad,null))[_0x4b54('0x45')](handleError(_0x57fbad,null));};exports['create']=function(_0x5b50a4,_0x3bb788){return db[_0x4b54('0x2b')]['create'](_0x5b50a4[_0x4b54('0x46')],{})[_0x4b54('0x22')](respondWithResult(_0x3bb788,0xc9))[_0x4b54('0x45')](handleError(_0x3bb788,null));};exports['update']=function(_0x55beb3,_0x96e27){if(_0x55beb3[_0x4b54('0x46')]['id']){delete _0x55beb3[_0x4b54('0x46')]['id'];}return db['FaxQueueReport'][_0x4b54('0x44')]({'where':{'id':_0x55beb3[_0x4b54('0x42')]['id']}})[_0x4b54('0x22')](handleEntityNotFound(_0x96e27,null))[_0x4b54('0x22')](saveUpdates(_0x55beb3[_0x4b54('0x46')],null))['then'](respondWithResult(_0x96e27,null))[_0x4b54('0x45')](handleError(_0x96e27,null));};exports['destroy']=function(_0x28652a,_0x59df24){return db['FaxQueueReport']['find']({'where':{'id':_0x28652a[_0x4b54('0x42')]['id']}})[_0x4b54('0x22')](handleEntityNotFound(_0x59df24,null))[_0x4b54('0x22')](removeEntity(_0x59df24,null))[_0x4b54('0x45')](handleError(_0x59df24,null));};exports[_0x4b54('0x47')]=function(_0x4bb189,_0x455d64){return db[_0x4b54('0x2b')]['describe']()[_0x4b54('0x22')](respondWithResult(_0x455d64,null))['catch'](handleError(_0x455d64,null));}; \ No newline at end of file +var _0x7d86=['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','offset','undefined','count','limit','set','json','save','then','stack','name','send','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filters','filter','merge','map','options','includeAll','include','FaxQueueReport','findAll','catch','show','params','create','body','update','destroy','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring'];(function(_0x2f78bd,_0x3c4b24){var _0x48383e=function(_0x293c8d){while(--_0x293c8d){_0x2f78bd['push'](_0x2f78bd['shift']());}};_0x48383e(++_0x3c4b24);}(_0x7d86,0x86));var _0x67d8=function(_0x162b5c,_0x425b60){_0x162b5c=_0x162b5c-0x0;var _0x38a217=_0x7d86[_0x162b5c];return _0x38a217;};'use strict';var emlformat=require(_0x67d8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x67d8('0x1'));var jsonpatch=require(_0x67d8('0x2'));var rp=require(_0x67d8('0x3'));var moment=require(_0x67d8('0x4'));var BPromise=require(_0x67d8('0x5'));var Mustache=require(_0x67d8('0x6'));var util=require(_0x67d8('0x7'));var path=require('path');var sox=require(_0x67d8('0x8'));var csv=require(_0x67d8('0x9'));var ejs=require(_0x67d8('0xa'));var fs=require('fs');var fs_extra=require(_0x67d8('0xb'));var _=require(_0x67d8('0xc'));var squel=require(_0x67d8('0xd'));var crypto=require(_0x67d8('0xe'));var jsforce=require(_0x67d8('0xf'));var deskjs=require(_0x67d8('0x10'));var toCsv=require(_0x67d8('0x9'));var querystring=require(_0x67d8('0x11'));var Papa=require(_0x67d8('0x12'));var Redis=require(_0x67d8('0x13'));var authService=require(_0x67d8('0x14'));var qs=require(_0x67d8('0x15'));var as=require(_0x67d8('0x16'));var hardwareService=require(_0x67d8('0x17'));var logger=require(_0x67d8('0x18'))(_0x67d8('0x19'));var utils=require(_0x67d8('0x1a'));var config=require(_0x67d8('0x1b'));var licenseUtil=require('../../config/license/util');var db=require(_0x67d8('0x1c'))['db'];function respondWithStatusCode(_0x3e90ac,_0x29218b){_0x29218b=_0x29218b||0xcc;return function(_0x4ea2e9){if(_0x4ea2e9){return _0x3e90ac[_0x67d8('0x1d')](_0x29218b);}return _0x3e90ac[_0x67d8('0x1e')](_0x29218b)[_0x67d8('0x1f')]();};}function respondWithResult(_0x13758c,_0x2d54e6){_0x2d54e6=_0x2d54e6||0xc8;return function(_0x2d7851){if(_0x2d7851){return _0x13758c[_0x67d8('0x1e')](_0x2d54e6)['json'](_0x2d7851);}};}function respondWithFilteredResult(_0x4757c4,_0x2f83e9){return function(_0x32784b){if(_0x32784b){var _0x509998=typeof _0x2f83e9[_0x67d8('0x20')]===_0x67d8('0x21')&&typeof _0x2f83e9['limit']===_0x67d8('0x21');var _0xaf5197=_0x32784b[_0x67d8('0x22')];var _0xefaaea=_0x509998?0x0:_0x2f83e9[_0x67d8('0x20')];var _0x2a9e66=_0x509998?_0x32784b['count']:_0x2f83e9[_0x67d8('0x20')]+_0x2f83e9[_0x67d8('0x23')];var _0x434810;if(_0x2a9e66>=_0xaf5197){_0x2a9e66=_0xaf5197;_0x434810=0xc8;}else{_0x434810=0xce;}_0x4757c4[_0x67d8('0x1e')](_0x434810);return _0x4757c4[_0x67d8('0x24')]('Content-Range',_0xefaaea+'-'+_0x2a9e66+'/'+_0xaf5197)[_0x67d8('0x25')](_0x32784b);}return null;};}function patchUpdates(_0x1f682e){return function(_0x47c40a){try{jsonpatch['apply'](_0x47c40a,_0x1f682e,!![]);}catch(_0x360b29){return BPromise['reject'](_0x360b29);}return _0x47c40a[_0x67d8('0x26')]();};}function saveUpdates(_0x322f4b,_0xdcba3e){return function(_0x490e0e){if(_0x490e0e){return _0x490e0e['update'](_0x322f4b)[_0x67d8('0x27')](function(_0x1eedd6){return _0x1eedd6;});}return null;};}function removeEntity(_0x43694a,_0x3949ce){return function(_0x2072d4){if(_0x2072d4){return _0x2072d4['destroy']()[_0x67d8('0x27')](function(){_0x43694a[_0x67d8('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x509ee9,_0x18e515){return function(_0x336d5f){if(!_0x336d5f){_0x509ee9['sendStatus'](0x194);}return _0x336d5f;};}function handleError(_0x3eb6e1,_0x36fec9){_0x36fec9=_0x36fec9||0x1f4;return function(_0x4de8ae){logger['error'](_0x4de8ae[_0x67d8('0x28')]);if(_0x4de8ae[_0x67d8('0x29')]){delete _0x4de8ae['name'];}_0x3eb6e1[_0x67d8('0x1e')](_0x36fec9)[_0x67d8('0x2a')](_0x4de8ae);};}exports['index']=function(_0x1e7e8f,_0x5c7f05){var _0x7232a4={},_0x8531f3={},_0x300bc7={'count':0x0,'rows':[]};var _0x48074a=_['map'](db['FaxQueueReport'][_0x67d8('0x2b')],function(_0x51bcfc){return{'name':_0x51bcfc[_0x67d8('0x2c')],'type':_0x51bcfc[_0x67d8('0x2d')][_0x67d8('0x2e')]};});_0x8531f3[_0x67d8('0x2f')]=_['map'](_0x48074a,_0x67d8('0x29'));_0x8531f3[_0x67d8('0x30')]=_[_0x67d8('0x31')](_0x1e7e8f[_0x67d8('0x30')]);_0x8531f3['filters']=_['intersection'](_0x8531f3[_0x67d8('0x2f')],_0x8531f3[_0x67d8('0x30')]);_0x7232a4['attributes']=_[_0x67d8('0x32')](_0x8531f3[_0x67d8('0x2f')],qs[_0x67d8('0x33')](_0x1e7e8f[_0x67d8('0x30')][_0x67d8('0x33')]));_0x7232a4[_0x67d8('0x34')]=_0x7232a4[_0x67d8('0x34')][_0x67d8('0x35')]?_0x7232a4['attributes']:_0x8531f3['model'];if(!_0x1e7e8f[_0x67d8('0x30')][_0x67d8('0x36')]('nolimit')){_0x7232a4[_0x67d8('0x23')]=qs[_0x67d8('0x23')](_0x1e7e8f[_0x67d8('0x30')][_0x67d8('0x23')]);_0x7232a4[_0x67d8('0x20')]=qs['offset'](_0x1e7e8f['query'][_0x67d8('0x20')]);}_0x7232a4[_0x67d8('0x37')]=qs[_0x67d8('0x38')](_0x1e7e8f[_0x67d8('0x30')]['sort']);_0x7232a4[_0x67d8('0x39')]=qs['filters'](_[_0x67d8('0x3a')](_0x1e7e8f[_0x67d8('0x30')],_0x8531f3[_0x67d8('0x3b')]),_0x48074a);if(_0x1e7e8f[_0x67d8('0x30')][_0x67d8('0x3c')]){_0x7232a4[_0x67d8('0x39')]=_[_0x67d8('0x3d')](_0x7232a4['where'],{'$or':_[_0x67d8('0x3e')](_0x48074a,function(_0x105989){if(_0x105989[_0x67d8('0x2d')]!=='VIRTUAL'){var _0x5632d5={};_0x5632d5[_0x105989[_0x67d8('0x29')]]={'$like':'%'+_0x1e7e8f['query'][_0x67d8('0x3c')]+'%'};return _0x5632d5;}})});}_0x7232a4=_[_0x67d8('0x3d')]({},_0x7232a4,_0x1e7e8f[_0x67d8('0x3f')]);var _0x3872ac={'where':_0x7232a4[_0x67d8('0x39')]};return db['FaxQueueReport'][_0x67d8('0x22')](_0x3872ac)[_0x67d8('0x27')](function(_0x4901b0){_0x300bc7[_0x67d8('0x22')]=_0x4901b0;if(_0x1e7e8f[_0x67d8('0x30')][_0x67d8('0x40')]){_0x7232a4[_0x67d8('0x41')]=[{'all':!![]}];}return db[_0x67d8('0x42')][_0x67d8('0x43')](_0x7232a4);})['then'](function(_0x1370b6){_0x300bc7['rows']=_0x1370b6;return _0x300bc7;})[_0x67d8('0x27')](respondWithFilteredResult(_0x5c7f05,_0x7232a4))[_0x67d8('0x44')](handleError(_0x5c7f05,null));};exports[_0x67d8('0x45')]=function(_0x1d90a7,_0x3735e2){var _0x2ec437={'raw':!![],'where':{'id':_0x1d90a7[_0x67d8('0x46')]['id']}},_0x280149={};_0x280149[_0x67d8('0x2f')]=_[_0x67d8('0x31')](db[_0x67d8('0x42')][_0x67d8('0x2b')]);_0x280149[_0x67d8('0x30')]=_[_0x67d8('0x31')](_0x1d90a7[_0x67d8('0x30')]);_0x280149[_0x67d8('0x3b')]=_[_0x67d8('0x32')](_0x280149[_0x67d8('0x2f')],_0x280149[_0x67d8('0x30')]);_0x2ec437[_0x67d8('0x34')]=_[_0x67d8('0x32')](_0x280149[_0x67d8('0x2f')],qs[_0x67d8('0x33')](_0x1d90a7[_0x67d8('0x30')][_0x67d8('0x33')]));_0x2ec437[_0x67d8('0x34')]=_0x2ec437[_0x67d8('0x34')][_0x67d8('0x35')]?_0x2ec437['attributes']:_0x280149[_0x67d8('0x2f')];if(_0x1d90a7[_0x67d8('0x30')][_0x67d8('0x40')]){_0x2ec437[_0x67d8('0x41')]=[{'all':!![]}];}_0x2ec437=_[_0x67d8('0x3d')]({},_0x2ec437,_0x1d90a7[_0x67d8('0x3f')]);return db['FaxQueueReport']['find'](_0x2ec437)[_0x67d8('0x27')](handleEntityNotFound(_0x3735e2,null))['then'](respondWithResult(_0x3735e2,null))[_0x67d8('0x44')](handleError(_0x3735e2,null));};exports[_0x67d8('0x47')]=function(_0x582a12,_0x145f32){return db[_0x67d8('0x42')][_0x67d8('0x47')](_0x582a12[_0x67d8('0x48')],{})['then'](respondWithResult(_0x145f32,0xc9))[_0x67d8('0x44')](handleError(_0x145f32,null));};exports[_0x67d8('0x49')]=function(_0x17be11,_0x3c4e7f){if(_0x17be11['body']['id']){delete _0x17be11[_0x67d8('0x48')]['id'];}return db[_0x67d8('0x42')]['find']({'where':{'id':_0x17be11[_0x67d8('0x46')]['id']}})[_0x67d8('0x27')](handleEntityNotFound(_0x3c4e7f,null))[_0x67d8('0x27')](saveUpdates(_0x17be11[_0x67d8('0x48')],null))['then'](respondWithResult(_0x3c4e7f,null))['catch'](handleError(_0x3c4e7f,null));};exports[_0x67d8('0x4a')]=function(_0x5a2132,_0x3850ce){return db[_0x67d8('0x42')]['find']({'where':{'id':_0x5a2132[_0x67d8('0x46')]['id']}})[_0x67d8('0x27')](handleEntityNotFound(_0x3850ce,null))['then'](removeEntity(_0x3850ce,null))['catch'](handleError(_0x3850ce,null));};exports[_0x67d8('0x4b')]=function(_0x1e0759,_0x519744){return db[_0x67d8('0x42')][_0x67d8('0x4b')]()[_0x67d8('0x27')](respondWithResult(_0x519744,null))['catch'](handleError(_0x519744,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index 642dbc3..75d7fd4 100644 --- a/server/api/faxQueueReport/faxQueueReport.model.js +++ b/server/api/faxQueueReport/faxQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1cb9=['api','moment','bluebird','path','rimraf','./faxQueueReport.attributes','exports','define','FaxQueueReport','uniqueid','lodash','../../config/logger'];(function(_0x3a7634,_0x2db384){var _0x23bbe9=function(_0x226734){while(--_0x226734){_0x3a7634['push'](_0x3a7634['shift']());}};_0x23bbe9(++_0x2db384);}(_0x1cb9,0x14e));var _0x91cb=function(_0x57b705,_0x50afc0){_0x57b705=_0x57b705-0x0;var _0x2be433=_0x1cb9[_0x57b705];return _0x2be433;};'use strict';var _=require(_0x91cb('0x0'));var util=require('util');var logger=require(_0x91cb('0x1'))(_0x91cb('0x2'));var moment=require(_0x91cb('0x3'));var BPromise=require(_0x91cb('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x91cb('0x5'));var rimraf=require(_0x91cb('0x6'));var config=require('../../config/environment');var attributes=require(_0x91cb('0x7'));module[_0x91cb('0x8')]=function(_0x186dc3,_0x28543e){return _0x186dc3[_0x91cb('0x9')](_0x91cb('0xa'),attributes,{'tableName':'report_fax_queue','paranoid':![],'indexes':[{'name':_0x91cb('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x814b=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','define','FaxQueueReport','uniqueid','lodash','util'];(function(_0x2f3d29,_0x150e7b){var _0x53d69d=function(_0x45f6ec){while(--_0x45f6ec){_0x2f3d29['push'](_0x2f3d29['shift']());}};_0x53d69d(++_0x150e7b);}(_0x814b,0x1a2));var _0xb814=function(_0x2550ce,_0x45209b){_0x2550ce=_0x2550ce-0x0;var _0x25748d=_0x814b[_0x2550ce];return _0x25748d;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var logger=require(_0xb814('0x2'))(_0xb814('0x3'));var moment=require(_0xb814('0x4'));var BPromise=require(_0xb814('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb814('0x6'));var rimraf=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var attributes=require(_0xb814('0x9'));module[_0xb814('0xa')]=function(_0x322a70,_0x53e507){return _0x322a70[_0xb814('0xb')](_0xb814('0xc'),attributes,{'tableName':'report_fax_queue','paranoid':![],'indexes':[{'name':_0xb814('0xd'),'fields':[_0xb814('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index d334f92..a923d11 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 _0xa5a3=['../../config/utils','../../config/environment','jayson/promise','client','http','request','debug','request\x20sent','stringify','error','code','FaxQueueReport,\x20%s,\x20%s','message','info','result','catch','CreateFaxQueueReport','body','options','raw','UpdateFaxQueueReport','FaxQueueReport','update','lodash','moment','bluebird','randomstring','../../mysqldb'];(function(_0x42bfb7,_0x25a3ec){var _0x5c497d=function(_0x48e83e){while(--_0x48e83e){_0x42bfb7['push'](_0x42bfb7['shift']());}};_0x5c497d(++_0x25a3ec);}(_0xa5a3,0x12f));var _0x3a5a=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0xa5a3[_0x1035c1];return _0x308d67;};'use strict';var _=require(_0x3a5a('0x0'));var util=require('util');var moment=require(_0x3a5a('0x1'));var BPromise=require(_0x3a5a('0x2'));var rs=require(_0x3a5a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3a5a('0x4'))['db'];var utils=require(_0x3a5a('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x3a5a('0x6'));var jayson=require(_0x3a5a('0x7'));var client=jayson[_0x3a5a('0x8')][_0x3a5a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x43ac75,_0x483913,_0x1474d2){return new BPromise(function(_0x2287b0,_0x34d35){return client[_0x3a5a('0xa')](_0x43ac75,_0x1474d2)['then'](function(_0x552750){logger['info']('FaxQueueReport,\x20%s,\x20%s',_0x483913,'request\x20sent');logger[_0x3a5a('0xb')]('FaxQueueReport,\x20%s,\x20%s,\x20%s',_0x483913,_0x3a5a('0xc'),JSON[_0x3a5a('0xd')](_0x552750));if(_0x552750[_0x3a5a('0xe')]){if(_0x552750['error'][_0x3a5a('0xf')]===0x1f4){logger['error'](_0x3a5a('0x10'),_0x483913,_0x552750[_0x3a5a('0xe')][_0x3a5a('0x11')]);return _0x34d35(_0x552750[_0x3a5a('0xe')][_0x3a5a('0x11')]);}logger[_0x3a5a('0xe')](_0x3a5a('0x10'),_0x483913,_0x552750[_0x3a5a('0xe')][_0x3a5a('0x11')]);return _0x2287b0(_0x552750[_0x3a5a('0xe')][_0x3a5a('0x11')]);}else{logger[_0x3a5a('0x12')]('FaxQueueReport,\x20%s,\x20%s',_0x483913,_0x3a5a('0xc'));_0x2287b0(_0x552750[_0x3a5a('0x13')]['message']);}})[_0x3a5a('0x14')](function(_0x215784){logger['error'](_0x3a5a('0x10'),_0x483913,_0x215784);_0x34d35(_0x215784);});});}exports[_0x3a5a('0x15')]=function(_0x15776f){var _0x2016dc=this;return new Promise(function(_0x36ba66,_0x424a99){return db['FaxQueueReport']['create'](_0x15776f[_0x3a5a('0x16')],{'raw':_0x15776f[_0x3a5a('0x17')]?_0x15776f[_0x3a5a('0x17')][_0x3a5a('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x5b5834){logger[_0x3a5a('0x12')](_0x3a5a('0x15'),_0x15776f);logger[_0x3a5a('0xb')]('CreateFaxQueueReport',_0x15776f,JSON['stringify'](_0x5b5834));_0x36ba66(_0x5b5834);})[_0x3a5a('0x14')](function(_0x370891){logger[_0x3a5a('0xe')](_0x3a5a('0x15'),_0x370891[_0x3a5a('0x11')],_0x15776f);_0x424a99(_0x2016dc['error'](0x1f4,_0x370891[_0x3a5a('0x11')]));});});};exports[_0x3a5a('0x19')]=function(_0x1bd184){var _0x1eade1=this;return new Promise(function(_0x5a00a1,_0x499e48){return db[_0x3a5a('0x1a')][_0x3a5a('0x1b')](_0x1bd184[_0x3a5a('0x16')],{'raw':_0x1bd184[_0x3a5a('0x17')]?_0x1bd184[_0x3a5a('0x17')][_0x3a5a('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1bd184[_0x3a5a('0x17')]?_0x1bd184['options']['where']||null:null,'attributes':_0x1bd184[_0x3a5a('0x17')]?_0x1bd184['options']['attributes']||null:null,'limit':_0x1bd184[_0x3a5a('0x17')]?_0x1bd184[_0x3a5a('0x17')]['limit']||null:null})['then'](function(_0x31919d){logger['info'](_0x3a5a('0x19'),_0x1bd184);logger[_0x3a5a('0xb')](_0x3a5a('0x19'),_0x1bd184,JSON['stringify'](_0x31919d));_0x5a00a1(_0x31919d);})[_0x3a5a('0x14')](function(_0x52a36f){logger[_0x3a5a('0xe')](_0x3a5a('0x19'),_0x52a36f['message'],_0x1bd184);_0x499e48(_0x1eade1['error'](0x1f4,_0x52a36f[_0x3a5a('0x11')]));});});}; \ No newline at end of file +var _0x72d7=['debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateFaxQueueReport','FaxQueueReport','create','options','raw','then','UpdateFaxQueueReport','update','body','attributes','limit','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent'];(function(_0x1c96da,_0x4318c7){var _0x36d2df=function(_0x2c4ea0){while(--_0x2c4ea0){_0x1c96da['push'](_0x1c96da['shift']());}};_0x36d2df(++_0x4318c7);}(_0x72d7,0x76));var _0x772d=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0x72d7[_0x521929];return _0x632436;};'use strict';var _=require(_0x772d('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x772d('0x1'));var rs=require(_0x772d('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x772d('0x3'))['db'];var utils=require(_0x772d('0x4'));var logger=require(_0x772d('0x5'))('rpc');var config=require(_0x772d('0x6'));var jayson=require(_0x772d('0x7'));var client=jayson[_0x772d('0x8')][_0x772d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x48e6a6,_0xfb9c9b,_0x41bd4c){return new BPromise(function(_0x30020a,_0x546cce){return client[_0x772d('0xa')](_0x48e6a6,_0x41bd4c)['then'](function(_0x31b2c8){logger[_0x772d('0xb')](_0x772d('0xc'),_0xfb9c9b,_0x772d('0xd'));logger[_0x772d('0xe')](_0x772d('0xf'),_0xfb9c9b,_0x772d('0xd'),JSON[_0x772d('0x10')](_0x31b2c8));if(_0x31b2c8[_0x772d('0x11')]){if(_0x31b2c8[_0x772d('0x11')][_0x772d('0x12')]===0x1f4){logger[_0x772d('0x11')](_0x772d('0xc'),_0xfb9c9b,_0x31b2c8[_0x772d('0x11')]['message']);return _0x546cce(_0x31b2c8[_0x772d('0x11')][_0x772d('0x13')]);}logger['error']('FaxQueueReport,\x20%s,\x20%s',_0xfb9c9b,_0x31b2c8[_0x772d('0x11')][_0x772d('0x13')]);return _0x30020a(_0x31b2c8[_0x772d('0x11')]['message']);}else{logger[_0x772d('0xb')](_0x772d('0xc'),_0xfb9c9b,_0x772d('0xd'));_0x30020a(_0x31b2c8[_0x772d('0x14')][_0x772d('0x13')]);}})[_0x772d('0x15')](function(_0xed0fa6){logger['error']('FaxQueueReport,\x20%s,\x20%s',_0xfb9c9b,_0xed0fa6);_0x546cce(_0xed0fa6);});});}exports[_0x772d('0x16')]=function(_0x355c2a){var _0x3ec852=this;return new Promise(function(_0x2a96af,_0x1355f4){return db[_0x772d('0x17')][_0x772d('0x18')](_0x355c2a['body'],{'raw':_0x355c2a[_0x772d('0x19')]?_0x355c2a[_0x772d('0x19')][_0x772d('0x1a')]===undefined?!![]:![]:!![]})[_0x772d('0x1b')](function(_0x1e8778){logger[_0x772d('0xb')](_0x772d('0x16'),_0x355c2a);logger[_0x772d('0xe')](_0x772d('0x16'),_0x355c2a,JSON['stringify'](_0x1e8778));_0x2a96af(_0x1e8778);})['catch'](function(_0x79ba99){logger[_0x772d('0x11')](_0x772d('0x16'),_0x79ba99[_0x772d('0x13')],_0x355c2a);_0x1355f4(_0x3ec852[_0x772d('0x11')](0x1f4,_0x79ba99[_0x772d('0x13')]));});});};exports[_0x772d('0x1c')]=function(_0x1b5c62){var _0x3013f4=this;return new Promise(function(_0x2a8a88,_0x1167f4){return db[_0x772d('0x17')][_0x772d('0x1d')](_0x1b5c62[_0x772d('0x1e')],{'raw':_0x1b5c62['options']?_0x1b5c62[_0x772d('0x19')][_0x772d('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1b5c62['options']?_0x1b5c62['options']['where']||null:null,'attributes':_0x1b5c62[_0x772d('0x19')]?_0x1b5c62[_0x772d('0x19')][_0x772d('0x1f')]||null:null,'limit':_0x1b5c62['options']?_0x1b5c62['options'][_0x772d('0x20')]||null:null})[_0x772d('0x1b')](function(_0x401f34){logger[_0x772d('0xb')](_0x772d('0x1c'),_0x1b5c62);logger['debug'](_0x772d('0x1c'),_0x1b5c62,JSON[_0x772d('0x10')](_0x401f34));_0x2a8a88(_0x401f34);})[_0x772d('0x15')](function(_0x284706){logger[_0x772d('0x11')](_0x772d('0x1c'),_0x284706[_0x772d('0x13')],_0x1b5c62);_0x1167f4(_0x3013f4['error'](0x1f4,_0x284706[_0x772d('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index e29ccac..f1e1831 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 _0xc0fa=['destroy','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','show','post','create','put','update','delete'];(function(_0x1c053d,_0x3d3fff){var _0x8a8fe4=function(_0x333232){while(--_0x333232){_0x1c053d['push'](_0x1c053d['shift']());}};_0x8a8fe4(++_0x3d3fff);}(_0xc0fa,0x8e));var _0xac0f=function(_0x4aa4e6,_0x278c45){_0x4aa4e6=_0x4aa4e6-0x0;var _0x322588=_0xc0fa[_0x4aa4e6];return _0x322588;};'use strict';var multer=require('multer');var util=require(_0xac0f('0x0'));var path=require(_0xac0f('0x1'));var timeout=require(_0xac0f('0x2'));var express=require(_0xac0f('0x3'));var router=express[_0xac0f('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xac0f('0x5'));var config=require(_0xac0f('0x6'));var controller=require('./faxQueueReport.controller');router[_0xac0f('0x7')]('/',auth[_0xac0f('0x8')](),controller[_0xac0f('0x9')]);router[_0xac0f('0x7')]('/describe',auth[_0xac0f('0x8')](),controller[_0xac0f('0xa')]);router[_0xac0f('0x7')](_0xac0f('0xb'),auth[_0xac0f('0x8')](),controller[_0xac0f('0xc')]);router[_0xac0f('0xd')]('/',auth[_0xac0f('0x8')](),controller[_0xac0f('0xe')]);router[_0xac0f('0xf')](_0xac0f('0xb'),auth[_0xac0f('0x8')](),controller[_0xac0f('0x10')]);router[_0xac0f('0x11')](_0xac0f('0xb'),auth['isAuthenticated'](),controller[_0xac0f('0x12')]);module[_0xac0f('0x13')]=router; \ No newline at end of file +var _0xd324=['delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueueReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create','update'];(function(_0xc05e87,_0x5c6dba){var _0x47c69f=function(_0x2720df){while(--_0x2720df){_0xc05e87['push'](_0xc05e87['shift']());}};_0x47c69f(++_0x5c6dba);}(_0xd324,0x1bc));var _0x4d32=function(_0x3d2438,_0x2e7922){_0x3d2438=_0x3d2438-0x0;var _0xd18de5=_0xd324[_0x3d2438];return _0xd18de5;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4d32('0x0'));var timeout=require(_0x4d32('0x1'));var express=require(_0x4d32('0x2'));var router=express[_0x4d32('0x3')]();var fs_extra=require(_0x4d32('0x4'));var auth=require(_0x4d32('0x5'));var interaction=require(_0x4d32('0x6'));var config=require(_0x4d32('0x7'));var controller=require(_0x4d32('0x8'));router[_0x4d32('0x9')]('/',auth[_0x4d32('0xa')](),controller['index']);router['get'](_0x4d32('0xb'),auth[_0x4d32('0xa')](),controller[_0x4d32('0xc')]);router[_0x4d32('0x9')](_0x4d32('0xd'),auth[_0x4d32('0xa')](),controller[_0x4d32('0xe')]);router[_0x4d32('0xf')]('/',auth[_0x4d32('0xa')](),controller[_0x4d32('0x10')]);router['put'](_0x4d32('0xd'),auth[_0x4d32('0xa')](),controller[_0x4d32('0x11')]);router[_0x4d32('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x4d32('0x13')]);module[_0x4d32('0x14')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index b8d79a8..82aa885 100644 --- a/server/api/faxTransferReport/faxTransferReport.attributes.js +++ b/server/api/faxTransferReport/faxTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9c44=['ENUM','account','agent','queue','NOW','exports','STRING'];(function(_0x2f2cb6,_0x5f5576){var _0x33c4a7=function(_0x57b59c){while(--_0x57b59c){_0x2f2cb6['push'](_0x2f2cb6['shift']());}};_0x33c4a7(++_0x5f5576);}(_0x9c44,0x178));var _0x49c4=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x9c44[_0x2d7f0e];return _0x110b07;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x49c4('0x0')]={'uniqueid':{'type':Sequelize[_0x49c4('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x49c4('0x2')](_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x49c4('0x6')]}}; \ No newline at end of file +var _0x9c44=['ENUM','account','agent','queue','NOW','exports','STRING'];(function(_0x1d06a5,_0x4fc577){var _0xbaab59=function(_0x458664){while(--_0x458664){_0x1d06a5['push'](_0x1d06a5['shift']());}};_0xbaab59(++_0x4fc577);}(_0x9c44,0x178));var _0x49c4=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0x9c44[_0x17b6e3];return _0x3906f3;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x49c4('0x0')]={'uniqueid':{'type':Sequelize[_0x49c4('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x49c4('0x2')](_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x49c4('0x6')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index 9394827..a565f81 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 _0x1213=['create','body','describe','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','update','then','destroy','error','stack','name','index','FaxTransferReport','fieldName','type','key','model','map','query','keys','attributes','intersection','fields','length','nolimit','sort','pick','filters','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find'];(function(_0x14563f,_0x376828){var _0x4f0d09=function(_0x10ce33){while(--_0x10ce33){_0x14563f['push'](_0x14563f['shift']());}};_0x4f0d09(++_0x376828);}(_0x1213,0x1a7));var _0x3121=function(_0x38dcff,_0x5f249d){_0x38dcff=_0x38dcff-0x0;var _0x6cb881=_0x1213[_0x38dcff];return _0x6cb881;};'use strict';var emlformat=require(_0x3121('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3121('0x1'));var jsonpatch=require(_0x3121('0x2'));var rp=require('request-promise');var moment=require(_0x3121('0x3'));var BPromise=require(_0x3121('0x4'));var Mustache=require(_0x3121('0x5'));var util=require(_0x3121('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x3121('0x7'));var ejs=require(_0x3121('0x8'));var fs=require('fs');var fs_extra=require(_0x3121('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x3121('0xa'));var jsforce=require(_0x3121('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x3121('0x7'));var querystring=require(_0x3121('0xc'));var Papa=require(_0x3121('0xd'));var Redis=require(_0x3121('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x3121('0xf'));var as=require(_0x3121('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x3121('0x11'));var config=require(_0x3121('0x12'));var licenseUtil=require(_0x3121('0x13'));var db=require(_0x3121('0x14'))['db'];function respondWithStatusCode(_0x219ede,_0x57c6f5){_0x57c6f5=_0x57c6f5||0xcc;return function(_0x2bcae6){if(_0x2bcae6){return _0x219ede[_0x3121('0x15')](_0x57c6f5);}return _0x219ede[_0x3121('0x16')](_0x57c6f5)[_0x3121('0x17')]();};}function respondWithResult(_0x52df0a,_0x3e2bf1){_0x3e2bf1=_0x3e2bf1||0xc8;return function(_0x2d542a){if(_0x2d542a){return _0x52df0a['status'](_0x3e2bf1)[_0x3121('0x18')](_0x2d542a);}};}function respondWithFilteredResult(_0x12b0d6,_0x166ef7){return function(_0xa91e10){if(_0xa91e10){var _0x1ce592=typeof _0x166ef7[_0x3121('0x19')]===_0x3121('0x1a')&&typeof _0x166ef7[_0x3121('0x1b')]===_0x3121('0x1a');var _0x68820f=_0xa91e10[_0x3121('0x1c')];var _0x55de74=_0x1ce592?0x0:_0x166ef7[_0x3121('0x19')];var _0x2c309f=_0x1ce592?_0xa91e10[_0x3121('0x1c')]:_0x166ef7[_0x3121('0x19')]+_0x166ef7[_0x3121('0x1b')];var _0x557cc8;if(_0x2c309f>=_0x68820f){_0x2c309f=_0x68820f;_0x557cc8=0xc8;}else{_0x557cc8=0xce;}_0x12b0d6[_0x3121('0x16')](_0x557cc8);return _0x12b0d6[_0x3121('0x1d')]('Content-Range',_0x55de74+'-'+_0x2c309f+'/'+_0x68820f)['json'](_0xa91e10);}return null;};}function patchUpdates(_0x2a09c5){return function(_0x4476ea){try{jsonpatch['apply'](_0x4476ea,_0x2a09c5,!![]);}catch(_0x2c4a31){return BPromise['reject'](_0x2c4a31);}return _0x4476ea['save']();};}function saveUpdates(_0xf05c3d,_0x336112){return function(_0x11fc0e){if(_0x11fc0e){return _0x11fc0e[_0x3121('0x1e')](_0xf05c3d)[_0x3121('0x1f')](function(_0x496f4f){return _0x496f4f;});}return null;};}function removeEntity(_0x431912,_0x3cb93e){return function(_0xb98293){if(_0xb98293){return _0xb98293[_0x3121('0x20')]()[_0x3121('0x1f')](function(){_0x431912['status'](0xcc)[_0x3121('0x17')]();});}};}function handleEntityNotFound(_0x65bbba,_0x1c1e44){return function(_0x551bfb){if(!_0x551bfb){_0x65bbba[_0x3121('0x15')](0x194);}return _0x551bfb;};}function handleError(_0x1400fc,_0x18018c){_0x18018c=_0x18018c||0x1f4;return function(_0x20d42e){logger[_0x3121('0x21')](_0x20d42e[_0x3121('0x22')]);if(_0x20d42e[_0x3121('0x23')]){delete _0x20d42e[_0x3121('0x23')];}_0x1400fc[_0x3121('0x16')](_0x18018c)['send'](_0x20d42e);};}exports[_0x3121('0x24')]=function(_0x1171b1,_0x55f590){var _0x58c123={},_0x149466={},_0x13f681={'count':0x0,'rows':[]};var _0x5c7448=_['map'](db[_0x3121('0x25')]['rawAttributes'],function(_0x1be38a){return{'name':_0x1be38a[_0x3121('0x26')],'type':_0x1be38a[_0x3121('0x27')][_0x3121('0x28')]};});_0x149466[_0x3121('0x29')]=_[_0x3121('0x2a')](_0x5c7448,_0x3121('0x23'));_0x149466[_0x3121('0x2b')]=_[_0x3121('0x2c')](_0x1171b1[_0x3121('0x2b')]);_0x149466['filters']=_['intersection'](_0x149466[_0x3121('0x29')],_0x149466[_0x3121('0x2b')]);_0x58c123[_0x3121('0x2d')]=_[_0x3121('0x2e')](_0x149466[_0x3121('0x29')],qs[_0x3121('0x2f')](_0x1171b1[_0x3121('0x2b')]['fields']));_0x58c123[_0x3121('0x2d')]=_0x58c123[_0x3121('0x2d')][_0x3121('0x30')]?_0x58c123[_0x3121('0x2d')]:_0x149466['model'];if(!_0x1171b1['query']['hasOwnProperty'](_0x3121('0x31'))){_0x58c123['limit']=qs[_0x3121('0x1b')](_0x1171b1[_0x3121('0x2b')][_0x3121('0x1b')]);_0x58c123['offset']=qs[_0x3121('0x19')](_0x1171b1[_0x3121('0x2b')][_0x3121('0x19')]);}_0x58c123['order']=qs[_0x3121('0x32')](_0x1171b1[_0x3121('0x2b')][_0x3121('0x32')]);_0x58c123['where']=qs['filters'](_[_0x3121('0x33')](_0x1171b1[_0x3121('0x2b')],_0x149466[_0x3121('0x34')]),_0x5c7448);if(_0x1171b1[_0x3121('0x2b')][_0x3121('0x35')]){_0x58c123[_0x3121('0x36')]=_[_0x3121('0x37')](_0x58c123[_0x3121('0x36')],{'$or':_[_0x3121('0x2a')](_0x5c7448,function(_0x7897cd){if(_0x7897cd['type']!==_0x3121('0x38')){var _0x286c89={};_0x286c89[_0x7897cd[_0x3121('0x23')]]={'$like':'%'+_0x1171b1['query']['filter']+'%'};return _0x286c89;}})});}_0x58c123=_[_0x3121('0x37')]({},_0x58c123,_0x1171b1[_0x3121('0x39')]);var _0x56ef62={'where':_0x58c123[_0x3121('0x36')]};return db[_0x3121('0x25')][_0x3121('0x1c')](_0x56ef62)['then'](function(_0x131f0f){_0x13f681['count']=_0x131f0f;if(_0x1171b1[_0x3121('0x2b')][_0x3121('0x3a')]){_0x58c123[_0x3121('0x3b')]=[{'all':!![]}];}return db[_0x3121('0x25')][_0x3121('0x3c')](_0x58c123);})['then'](function(_0x9d5284){_0x13f681[_0x3121('0x3d')]=_0x9d5284;return _0x13f681;})[_0x3121('0x1f')](respondWithFilteredResult(_0x55f590,_0x58c123))[_0x3121('0x3e')](handleError(_0x55f590,null));};exports[_0x3121('0x3f')]=function(_0x8e183c,_0x27e5f7){var _0x3097bf={'raw':!![],'where':{'id':_0x8e183c[_0x3121('0x40')]['id']}},_0x14da6e={};_0x14da6e['model']=_[_0x3121('0x2c')](db[_0x3121('0x25')][_0x3121('0x41')]);_0x14da6e[_0x3121('0x2b')]=_[_0x3121('0x2c')](_0x8e183c[_0x3121('0x2b')]);_0x14da6e['filters']=_['intersection'](_0x14da6e[_0x3121('0x29')],_0x14da6e[_0x3121('0x2b')]);_0x3097bf[_0x3121('0x2d')]=_[_0x3121('0x2e')](_0x14da6e[_0x3121('0x29')],qs['fields'](_0x8e183c[_0x3121('0x2b')][_0x3121('0x2f')]));_0x3097bf[_0x3121('0x2d')]=_0x3097bf[_0x3121('0x2d')][_0x3121('0x30')]?_0x3097bf['attributes']:_0x14da6e[_0x3121('0x29')];if(_0x8e183c[_0x3121('0x2b')]['includeAll']){_0x3097bf[_0x3121('0x3b')]=[{'all':!![]}];}_0x3097bf=_[_0x3121('0x37')]({},_0x3097bf,_0x8e183c[_0x3121('0x39')]);return db[_0x3121('0x25')][_0x3121('0x42')](_0x3097bf)[_0x3121('0x1f')](handleEntityNotFound(_0x27e5f7,null))[_0x3121('0x1f')](respondWithResult(_0x27e5f7,null))[_0x3121('0x3e')](handleError(_0x27e5f7,null));};exports[_0x3121('0x43')]=function(_0xa46a1f,_0x4d345e){return db[_0x3121('0x25')][_0x3121('0x43')](_0xa46a1f[_0x3121('0x44')],{})[_0x3121('0x1f')](respondWithResult(_0x4d345e,0xc9))[_0x3121('0x3e')](handleError(_0x4d345e,null));};exports[_0x3121('0x1e')]=function(_0x4e0e97,_0x587531){if(_0x4e0e97[_0x3121('0x44')]['id']){delete _0x4e0e97[_0x3121('0x44')]['id'];}return db[_0x3121('0x25')][_0x3121('0x42')]({'where':{'id':_0x4e0e97['params']['id']}})[_0x3121('0x1f')](handleEntityNotFound(_0x587531,null))[_0x3121('0x1f')](saveUpdates(_0x4e0e97[_0x3121('0x44')],null))[_0x3121('0x1f')](respondWithResult(_0x587531,null))[_0x3121('0x3e')](handleError(_0x587531,null));};exports[_0x3121('0x20')]=function(_0x16d4e0,_0x13e7f2){return db[_0x3121('0x25')][_0x3121('0x42')]({'where':{'id':_0x16d4e0[_0x3121('0x40')]['id']}})[_0x3121('0x1f')](handleEntityNotFound(_0x13e7f2,null))[_0x3121('0x1f')](removeEntity(_0x13e7f2,null))['catch'](handleError(_0x13e7f2,null));};exports[_0x3121('0x45')]=function(_0x4bcd9b,_0x108b6a){return db['FaxTransferReport']['describe']()[_0x3121('0x1f')](respondWithResult(_0x108b6a,null))[_0x3121('0x3e')](handleError(_0x108b6a,null));}; \ No newline at end of file +var _0x5a8f=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','update','then','destroy','end','name','send','index','map','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','FaxTransferReport','includeAll','findAll','rows','catch','show','rawAttributes','length','include','options','create','body','find','params','describe','rimraf','fast-json-patch','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis'];(function(_0x28c4e7,_0x214293){var _0xb4a4b0=function(_0x373d41){while(--_0x373d41){_0x28c4e7['push'](_0x28c4e7['shift']());}};_0xb4a4b0(++_0x214293);}(_0x5a8f,0x119));var _0xf5a8=function(_0x22d076,_0x1bb313){_0x22d076=_0x22d076-0x0;var _0x119e6d=_0x5a8f[_0x22d076];return _0x119e6d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf5a8('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf5a8('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xf5a8('0x2'));var Mustache=require('mustache');var util=require(_0xf5a8('0x3'));var path=require(_0xf5a8('0x4'));var sox=require(_0xf5a8('0x5'));var csv=require(_0xf5a8('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf5a8('0x7'));var _=require(_0xf5a8('0x8'));var squel=require(_0xf5a8('0x9'));var crypto=require(_0xf5a8('0xa'));var jsforce=require(_0xf5a8('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xf5a8('0xc'));var Papa=require(_0xf5a8('0xd'));var Redis=require(_0xf5a8('0xe'));var authService=require(_0xf5a8('0xf'));var qs=require(_0xf5a8('0x10'));var as=require(_0xf5a8('0x11'));var hardwareService=require(_0xf5a8('0x12'));var logger=require('../../config/logger')(_0xf5a8('0x13'));var utils=require(_0xf5a8('0x14'));var config=require(_0xf5a8('0x15'));var licenseUtil=require(_0xf5a8('0x16'));var db=require(_0xf5a8('0x17'))['db'];function respondWithStatusCode(_0x3b2425,_0x46ef4e){_0x46ef4e=_0x46ef4e||0xcc;return function(_0x4a082d){if(_0x4a082d){return _0x3b2425[_0xf5a8('0x18')](_0x46ef4e);}return _0x3b2425[_0xf5a8('0x19')](_0x46ef4e)['end']();};}function respondWithResult(_0x59916b,_0x27c521){_0x27c521=_0x27c521||0xc8;return function(_0x2ebd4f){if(_0x2ebd4f){return _0x59916b[_0xf5a8('0x19')](_0x27c521)[_0xf5a8('0x1a')](_0x2ebd4f);}};}function respondWithFilteredResult(_0x14bc06,_0x43eef4){return function(_0x1ad9fe){if(_0x1ad9fe){var _0x2666bc=typeof _0x43eef4[_0xf5a8('0x1b')]==='undefined'&&typeof _0x43eef4[_0xf5a8('0x1c')]===_0xf5a8('0x1d');var _0x2ae4f4=_0x1ad9fe[_0xf5a8('0x1e')];var _0x15356b=_0x2666bc?0x0:_0x43eef4[_0xf5a8('0x1b')];var _0x5b7e13=_0x2666bc?_0x1ad9fe[_0xf5a8('0x1e')]:_0x43eef4[_0xf5a8('0x1b')]+_0x43eef4[_0xf5a8('0x1c')];var _0x451d8a;if(_0x5b7e13>=_0x2ae4f4){_0x5b7e13=_0x2ae4f4;_0x451d8a=0xc8;}else{_0x451d8a=0xce;}_0x14bc06['status'](_0x451d8a);return _0x14bc06[_0xf5a8('0x1f')](_0xf5a8('0x20'),_0x15356b+'-'+_0x5b7e13+'/'+_0x2ae4f4)['json'](_0x1ad9fe);}return null;};}function patchUpdates(_0x26fa79){return function(_0x276dd4){try{jsonpatch[_0xf5a8('0x21')](_0x276dd4,_0x26fa79,!![]);}catch(_0x5b5ff5){return BPromise['reject'](_0x5b5ff5);}return _0x276dd4['save']();};}function saveUpdates(_0x39233e,_0x17202a){return function(_0x5ed058){if(_0x5ed058){return _0x5ed058[_0xf5a8('0x22')](_0x39233e)[_0xf5a8('0x23')](function(_0x8d6593){return _0x8d6593;});}return null;};}function removeEntity(_0x14910a,_0x286cc6){return function(_0x1aafa6){if(_0x1aafa6){return _0x1aafa6[_0xf5a8('0x24')]()[_0xf5a8('0x23')](function(){_0x14910a['status'](0xcc)[_0xf5a8('0x25')]();});}};}function handleEntityNotFound(_0x116195,_0xc4841a){return function(_0x470a1b){if(!_0x470a1b){_0x116195['sendStatus'](0x194);}return _0x470a1b;};}function handleError(_0x5c8d5c,_0x3d0f6b){_0x3d0f6b=_0x3d0f6b||0x1f4;return function(_0x34f536){logger['error'](_0x34f536['stack']);if(_0x34f536[_0xf5a8('0x26')]){delete _0x34f536['name'];}_0x5c8d5c['status'](_0x3d0f6b)[_0xf5a8('0x27')](_0x34f536);};}exports[_0xf5a8('0x28')]=function(_0x5b7dfb,_0x788226){var _0x15bc1d={},_0x4fb3d1={},_0x32bb91={'count':0x0,'rows':[]};var _0x3a1698=_[_0xf5a8('0x29')](db['FaxTransferReport']['rawAttributes'],function(_0x5f2f3a){return{'name':_0x5f2f3a[_0xf5a8('0x2a')],'type':_0x5f2f3a[_0xf5a8('0x2b')]['key']};});_0x4fb3d1[_0xf5a8('0x2c')]=_['map'](_0x3a1698,_0xf5a8('0x26'));_0x4fb3d1[_0xf5a8('0x2d')]=_[_0xf5a8('0x2e')](_0x5b7dfb[_0xf5a8('0x2d')]);_0x4fb3d1[_0xf5a8('0x2f')]=_[_0xf5a8('0x30')](_0x4fb3d1[_0xf5a8('0x2c')],_0x4fb3d1[_0xf5a8('0x2d')]);_0x15bc1d[_0xf5a8('0x31')]=_['intersection'](_0x4fb3d1[_0xf5a8('0x2c')],qs[_0xf5a8('0x32')](_0x5b7dfb[_0xf5a8('0x2d')][_0xf5a8('0x32')]));_0x15bc1d[_0xf5a8('0x31')]=_0x15bc1d[_0xf5a8('0x31')]['length']?_0x15bc1d[_0xf5a8('0x31')]:_0x4fb3d1[_0xf5a8('0x2c')];if(!_0x5b7dfb[_0xf5a8('0x2d')][_0xf5a8('0x33')](_0xf5a8('0x34'))){_0x15bc1d[_0xf5a8('0x1c')]=qs['limit'](_0x5b7dfb[_0xf5a8('0x2d')]['limit']);_0x15bc1d[_0xf5a8('0x1b')]=qs[_0xf5a8('0x1b')](_0x5b7dfb[_0xf5a8('0x2d')][_0xf5a8('0x1b')]);}_0x15bc1d[_0xf5a8('0x35')]=qs[_0xf5a8('0x36')](_0x5b7dfb[_0xf5a8('0x2d')][_0xf5a8('0x36')]);_0x15bc1d['where']=qs[_0xf5a8('0x2f')](_[_0xf5a8('0x37')](_0x5b7dfb[_0xf5a8('0x2d')],_0x4fb3d1[_0xf5a8('0x2f')]),_0x3a1698);if(_0x5b7dfb['query'][_0xf5a8('0x38')]){_0x15bc1d[_0xf5a8('0x39')]=_[_0xf5a8('0x3a')](_0x15bc1d['where'],{'$or':_[_0xf5a8('0x29')](_0x3a1698,function(_0x48bc70){if(_0x48bc70[_0xf5a8('0x2b')]!=='VIRTUAL'){var _0x12430b={};_0x12430b[_0x48bc70[_0xf5a8('0x26')]]={'$like':'%'+_0x5b7dfb[_0xf5a8('0x2d')][_0xf5a8('0x38')]+'%'};return _0x12430b;}})});}_0x15bc1d=_[_0xf5a8('0x3a')]({},_0x15bc1d,_0x5b7dfb['options']);var _0x2b6bb4={'where':_0x15bc1d['where']};return db[_0xf5a8('0x3b')][_0xf5a8('0x1e')](_0x2b6bb4)['then'](function(_0x5894eb){_0x32bb91['count']=_0x5894eb;if(_0x5b7dfb['query'][_0xf5a8('0x3c')]){_0x15bc1d['include']=[{'all':!![]}];}return db[_0xf5a8('0x3b')][_0xf5a8('0x3d')](_0x15bc1d);})[_0xf5a8('0x23')](function(_0x5ddab3){_0x32bb91[_0xf5a8('0x3e')]=_0x5ddab3;return _0x32bb91;})[_0xf5a8('0x23')](respondWithFilteredResult(_0x788226,_0x15bc1d))[_0xf5a8('0x3f')](handleError(_0x788226,null));};exports[_0xf5a8('0x40')]=function(_0x56a890,_0x5acfbf){var _0x125b3e={'raw':!![],'where':{'id':_0x56a890['params']['id']}},_0x398f6f={};_0x398f6f[_0xf5a8('0x2c')]=_[_0xf5a8('0x2e')](db['FaxTransferReport'][_0xf5a8('0x41')]);_0x398f6f[_0xf5a8('0x2d')]=_['keys'](_0x56a890[_0xf5a8('0x2d')]);_0x398f6f['filters']=_[_0xf5a8('0x30')](_0x398f6f[_0xf5a8('0x2c')],_0x398f6f[_0xf5a8('0x2d')]);_0x125b3e[_0xf5a8('0x31')]=_['intersection'](_0x398f6f[_0xf5a8('0x2c')],qs[_0xf5a8('0x32')](_0x56a890['query'][_0xf5a8('0x32')]));_0x125b3e['attributes']=_0x125b3e[_0xf5a8('0x31')][_0xf5a8('0x42')]?_0x125b3e['attributes']:_0x398f6f[_0xf5a8('0x2c')];if(_0x56a890[_0xf5a8('0x2d')]['includeAll']){_0x125b3e[_0xf5a8('0x43')]=[{'all':!![]}];}_0x125b3e=_['merge']({},_0x125b3e,_0x56a890[_0xf5a8('0x44')]);return db[_0xf5a8('0x3b')]['find'](_0x125b3e)['then'](handleEntityNotFound(_0x5acfbf,null))[_0xf5a8('0x23')](respondWithResult(_0x5acfbf,null))[_0xf5a8('0x3f')](handleError(_0x5acfbf,null));};exports['create']=function(_0x4ef02d,_0x513066){return db[_0xf5a8('0x3b')][_0xf5a8('0x45')](_0x4ef02d[_0xf5a8('0x46')],{})[_0xf5a8('0x23')](respondWithResult(_0x513066,0xc9))[_0xf5a8('0x3f')](handleError(_0x513066,null));};exports['update']=function(_0x37a155,_0x52db9d){if(_0x37a155['body']['id']){delete _0x37a155[_0xf5a8('0x46')]['id'];}return db[_0xf5a8('0x3b')]['find']({'where':{'id':_0x37a155['params']['id']}})[_0xf5a8('0x23')](handleEntityNotFound(_0x52db9d,null))[_0xf5a8('0x23')](saveUpdates(_0x37a155[_0xf5a8('0x46')],null))['then'](respondWithResult(_0x52db9d,null))[_0xf5a8('0x3f')](handleError(_0x52db9d,null));};exports[_0xf5a8('0x24')]=function(_0x1f4573,_0x4e8ff1){return db[_0xf5a8('0x3b')][_0xf5a8('0x47')]({'where':{'id':_0x1f4573[_0xf5a8('0x48')]['id']}})[_0xf5a8('0x23')](handleEntityNotFound(_0x4e8ff1,null))['then'](removeEntity(_0x4e8ff1,null))[_0xf5a8('0x3f')](handleError(_0x4e8ff1,null));};exports[_0xf5a8('0x49')]=function(_0x138453,_0x334a45){return db['FaxTransferReport']['describe']()['then'](respondWithResult(_0x334a45,null))[_0xf5a8('0x3f')](handleError(_0x334a45,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index e3b4ac0..0311657 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 _0x62cf=['bluebird','rimraf','../../config/environment','./faxTransferReport.attributes','exports','define','FaxTransferReport','report_fax_transfer','uniqueid','lodash','../../config/logger','moment'];(function(_0x1b7e60,_0xefa61a){var _0x12e244=function(_0x2e0b18){while(--_0x2e0b18){_0x1b7e60['push'](_0x1b7e60['shift']());}};_0x12e244(++_0xefa61a);}(_0x62cf,0x81));var _0xf62c=function(_0x590ace,_0x5c2b6a){_0x590ace=_0x590ace-0x0;var _0x356fff=_0x62cf[_0x590ace];return _0x356fff;};'use strict';var _=require(_0xf62c('0x0'));var util=require('util');var logger=require(_0xf62c('0x1'))('api');var moment=require(_0xf62c('0x2'));var BPromise=require(_0xf62c('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xf62c('0x4'));var config=require(_0xf62c('0x5'));var attributes=require(_0xf62c('0x6'));module[_0xf62c('0x7')]=function(_0x3604f0,_0x40487e){return _0x3604f0[_0xf62c('0x8')](_0xf62c('0x9'),attributes,{'tableName':_0xf62c('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xf62c('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x38fd=['define','report_fax_transfer','uniqueid','lodash','util','../../config/logger','moment','bluebird','request-promise','path','./faxTransferReport.attributes','exports'];(function(_0x57a697,_0xe2f0f6){var _0x4c2383=function(_0x45e2cb){while(--_0x45e2cb){_0x57a697['push'](_0x57a697['shift']());}};_0x4c2383(++_0xe2f0f6);}(_0x38fd,0x117));var _0xd38f=function(_0x4fb813,_0x4a9f9f){_0x4fb813=_0x4fb813-0x0;var _0x5782f7=_0x38fd[_0x4fb813];return _0x5782f7;};'use strict';var _=require(_0xd38f('0x0'));var util=require(_0xd38f('0x1'));var logger=require(_0xd38f('0x2'))('api');var moment=require(_0xd38f('0x3'));var BPromise=require(_0xd38f('0x4'));var rp=require(_0xd38f('0x5'));var fs=require('fs');var path=require(_0xd38f('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xd38f('0x7'));module[_0xd38f('0x8')]=function(_0x52868c,_0x3e0d55){return _0x52868c[_0xd38f('0x9')]('FaxTransferReport',attributes,{'tableName':_0xd38f('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xd38f('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index 4522ec7..26861b5 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 _0x6bc5=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','util','moment','bluebird','ioredis'];(function(_0x1c98d9,_0x52c359){var _0x1e7092=function(_0x32881a){while(--_0x32881a){_0x1c98d9['push'](_0x1c98d9['shift']());}};_0x1e7092(++_0x52c359);}(_0x6bc5,0xd3));var _0x56bc=function(_0x34e083,_0x6fd8f3){_0x34e083=_0x34e083-0x0;var _0x2d87db=_0x6bc5[_0x34e083];return _0x2d87db;};'use strict';var _=require(_0x56bc('0x0'));var util=require(_0x56bc('0x1'));var moment=require(_0x56bc('0x2'));var BPromise=require(_0x56bc('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x56bc('0x4'));var db=require(_0x56bc('0x5'))['db'];var utils=require(_0x56bc('0x6'));var logger=require(_0x56bc('0x7'))(_0x56bc('0x8'));var config=require(_0x56bc('0x9'));var jayson=require(_0x56bc('0xa'));var client=jayson[_0x56bc('0xb')][_0x56bc('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x383201,_0x149b9c,_0x2bdd36){return new BPromise(function(_0x2cb790,_0x1267e2){return client[_0x56bc('0xd')](_0x383201,_0x2bdd36)[_0x56bc('0xe')](function(_0x49580c){logger[_0x56bc('0xf')](_0x56bc('0x10'),_0x149b9c,_0x56bc('0x11'));logger[_0x56bc('0x12')]('FaxTransferReport,\x20%s,\x20%s,\x20%s',_0x149b9c,'request\x20sent',JSON[_0x56bc('0x13')](_0x49580c));if(_0x49580c[_0x56bc('0x14')]){if(_0x49580c[_0x56bc('0x14')][_0x56bc('0x15')]===0x1f4){logger[_0x56bc('0x14')](_0x56bc('0x10'),_0x149b9c,_0x49580c['error'][_0x56bc('0x16')]);return _0x1267e2(_0x49580c['error'][_0x56bc('0x16')]);}logger[_0x56bc('0x14')](_0x56bc('0x10'),_0x149b9c,_0x49580c['error'][_0x56bc('0x16')]);return _0x2cb790(_0x49580c[_0x56bc('0x14')][_0x56bc('0x16')]);}else{logger[_0x56bc('0xf')]('FaxTransferReport,\x20%s,\x20%s',_0x149b9c,'request\x20sent');_0x2cb790(_0x49580c[_0x56bc('0x17')]['message']);}})['catch'](function(_0x157bd3){logger[_0x56bc('0x14')]('FaxTransferReport,\x20%s,\x20%s',_0x149b9c,_0x157bd3);_0x1267e2(_0x157bd3);});});} \ No newline at end of file +var _0x6a08=['code','message','error','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x46b4ee,_0x4cdce8){var _0x599b94=function(_0x18ba76){while(--_0x18ba76){_0x46b4ee['push'](_0x46b4ee['shift']());}};_0x599b94(++_0x4cdce8);}(_0x6a08,0x6d));var _0x86a0=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0x6a08[_0x4ea69d];return _0x5318e0;};'use strict';var _=require(_0x86a0('0x0'));var util=require('util');var moment=require(_0x86a0('0x1'));var BPromise=require(_0x86a0('0x2'));var rs=require(_0x86a0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x86a0('0x4'))['db'];var utils=require(_0x86a0('0x5'));var logger=require(_0x86a0('0x6'))(_0x86a0('0x7'));var config=require(_0x86a0('0x8'));var jayson=require(_0x86a0('0x9'));var client=jayson[_0x86a0('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x312ae5,_0x440f90,_0x37d385){return new BPromise(function(_0x27746f,_0x563fca){return client['request'](_0x312ae5,_0x37d385)['then'](function(_0x5c1779){logger[_0x86a0('0xb')](_0x86a0('0xc'),_0x440f90,_0x86a0('0xd'));logger[_0x86a0('0xe')](_0x86a0('0xf'),_0x440f90,'request\x20sent',JSON[_0x86a0('0x10')](_0x5c1779));if(_0x5c1779['error']){if(_0x5c1779['error'][_0x86a0('0x11')]===0x1f4){logger['error'](_0x86a0('0xc'),_0x440f90,_0x5c1779['error'][_0x86a0('0x12')]);return _0x563fca(_0x5c1779[_0x86a0('0x13')][_0x86a0('0x12')]);}logger['error'](_0x86a0('0xc'),_0x440f90,_0x5c1779[_0x86a0('0x13')][_0x86a0('0x12')]);return _0x27746f(_0x5c1779[_0x86a0('0x13')][_0x86a0('0x12')]);}else{logger[_0x86a0('0xb')](_0x86a0('0xc'),_0x440f90,'request\x20sent');_0x27746f(_0x5c1779['result']['message']);}})[_0x86a0('0x14')](function(_0xb20240){logger['error'](_0x86a0('0xc'),_0x440f90,_0xb20240);_0x563fca(_0xb20240);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index a243960..3eb6d98 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 _0x1b91=['connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path'];(function(_0x46218b,_0x5ee48b){var _0x5aa909=function(_0x27e1ea){while(--_0x27e1ea){_0x46218b['push'](_0x46218b['shift']());}};_0x5aa909(++_0x5ee48b);}(_0x1b91,0x1c5));var _0x11b9=function(_0x5db59e,_0x18e1ae){_0x5db59e=_0x5db59e-0x0;var _0x54bc9f=_0x1b91[_0x5db59e];return _0x54bc9f;};'use strict';var multer=require(_0x11b9('0x0'));var util=require(_0x11b9('0x1'));var path=require(_0x11b9('0x2'));var timeout=require(_0x11b9('0x3'));var express=require(_0x11b9('0x4'));var router=express['Router']();var fs_extra=require(_0x11b9('0x5'));var auth=require(_0x11b9('0x6'));var interaction=require(_0x11b9('0x7'));var config=require(_0x11b9('0x8'));var controller=require(_0x11b9('0x9'));router[_0x11b9('0xa')]('/',auth[_0x11b9('0xb')](),controller[_0x11b9('0xc')]);router[_0x11b9('0xa')](_0x11b9('0xd'),auth[_0x11b9('0xb')](),controller[_0x11b9('0xe')]);router['get'](_0x11b9('0xf'),auth[_0x11b9('0xb')](),controller[_0x11b9('0x10')]);router[_0x11b9('0x11')]('/',auth[_0x11b9('0xb')](),controller[_0x11b9('0x12')]);router[_0x11b9('0x13')](_0x11b9('0xf'),auth[_0x11b9('0xb')](),controller[_0x11b9('0x14')]);router[_0x11b9('0x15')](_0x11b9('0xf'),auth[_0x11b9('0xb')](),controller[_0x11b9('0x16')]);module[_0x11b9('0x17')]=router; \ No newline at end of file +var _0xbc52=['fs-extra','../../components/auth/service','../../config/environment','./faxTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','util','connect-timeout','express','Router'];(function(_0x1a93c8,_0x2aa42e){var _0x2c7760=function(_0x4d776e){while(--_0x4d776e){_0x1a93c8['push'](_0x1a93c8['shift']());}};_0x2c7760(++_0x2aa42e);}(_0xbc52,0x137));var _0x2bc5=function(_0x4bf8a0,_0x56a898){_0x4bf8a0=_0x4bf8a0-0x0;var _0x536c30=_0xbc52[_0x4bf8a0];return _0x536c30;};'use strict';var multer=require('multer');var util=require(_0x2bc5('0x0'));var path=require('path');var timeout=require(_0x2bc5('0x1'));var express=require(_0x2bc5('0x2'));var router=express[_0x2bc5('0x3')]();var fs_extra=require(_0x2bc5('0x4'));var auth=require(_0x2bc5('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x2bc5('0x6'));var controller=require(_0x2bc5('0x7'));router[_0x2bc5('0x8')]('/',auth[_0x2bc5('0x9')](),controller[_0x2bc5('0xa')]);router['get'](_0x2bc5('0xb'),auth[_0x2bc5('0x9')](),controller[_0x2bc5('0xc')]);router[_0x2bc5('0x8')](_0x2bc5('0xd'),auth[_0x2bc5('0x9')](),controller[_0x2bc5('0xe')]);router[_0x2bc5('0xf')]('/',auth['isAuthenticated'](),controller[_0x2bc5('0x10')]);router[_0x2bc5('0x11')](_0x2bc5('0xd'),auth[_0x2bc5('0x9')](),controller[_0x2bc5('0x12')]);router[_0x2bc5('0x13')](_0x2bc5('0xd'),auth[_0x2bc5('0x9')](),controller[_0x2bc5('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 5367d51..f030329 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 _0x42b2=['update','delete','destroy','exports','multer','util','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','./intDeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','post','create','put'];(function(_0x3c1309,_0x66e161){var _0x4b71bf=function(_0x46426e){while(--_0x46426e){_0x3c1309['push'](_0x3c1309['shift']());}};_0x4b71bf(++_0x66e161);}(_0x42b2,0x17a));var _0x242b=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x42b2[_0x6c993a];return _0x27f547;};'use strict';var multer=require(_0x242b('0x0'));var util=require(_0x242b('0x1'));var path=require('path');var timeout=require(_0x242b('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x242b('0x3'));var auth=require(_0x242b('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x242b('0x5'));var controller=require(_0x242b('0x6'));router[_0x242b('0x7')]('/',auth[_0x242b('0x8')](),controller[_0x242b('0x9')]);router[_0x242b('0x7')](_0x242b('0xa'),auth[_0x242b('0x8')](),controller[_0x242b('0xb')]);router[_0x242b('0x7')](_0x242b('0xc'),auth[_0x242b('0x8')](),controller[_0x242b('0xd')]);router[_0x242b('0x7')](_0x242b('0xe'),auth[_0x242b('0x8')](),controller['getFields']);router[_0x242b('0xf')]('/',auth[_0x242b('0x8')](),controller[_0x242b('0x10')]);router['post']('/:id/configurations',auth[_0x242b('0x8')](),controller['addConfiguration']);router[_0x242b('0x11')](_0x242b('0xa'),auth[_0x242b('0x8')](),controller[_0x242b('0x12')]);router[_0x242b('0x13')]('/:id',auth[_0x242b('0x8')](),controller[_0x242b('0x14')]);module[_0x242b('0x15')]=router; \ No newline at end of file +var _0xfd99=['../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','/:id/configurations','/:id/fields','create','post','update','delete','destroy','exports','multer','path','express','Router','../../components/auth/service'];(function(_0x5a4604,_0x25bbd3){var _0x3c6fd8=function(_0x376509){while(--_0x376509){_0x5a4604['push'](_0x5a4604['shift']());}};_0x3c6fd8(++_0x25bbd3);}(_0xfd99,0x163));var _0x9fd9=function(_0x717a5c,_0xfe474f){_0x717a5c=_0x717a5c-0x0;var _0x326de3=_0xfd99[_0x717a5c];return _0x326de3;};'use strict';var multer=require(_0x9fd9('0x0'));var util=require('util');var path=require(_0x9fd9('0x1'));var timeout=require('connect-timeout');var express=require(_0x9fd9('0x2'));var router=express[_0x9fd9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x9fd9('0x4'));var interaction=require(_0x9fd9('0x5'));var config=require(_0x9fd9('0x6'));var controller=require('./intDeskAccount.controller');router['get']('/',auth[_0x9fd9('0x7')](),controller[_0x9fd9('0x8')]);router[_0x9fd9('0x9')](_0x9fd9('0xa'),auth[_0x9fd9('0x7')](),controller[_0x9fd9('0xb')]);router[_0x9fd9('0x9')](_0x9fd9('0xc'),auth[_0x9fd9('0x7')](),controller['getConfigurations']);router[_0x9fd9('0x9')](_0x9fd9('0xd'),auth['isAuthenticated'](),controller['getFields']);router['post']('/',auth[_0x9fd9('0x7')](),controller[_0x9fd9('0xe')]);router[_0x9fd9('0xf')](_0x9fd9('0xc'),auth[_0x9fd9('0x7')](),controller['addConfiguration']);router['put'](_0x9fd9('0xa'),auth[_0x9fd9('0x7')](),controller[_0x9fd9('0x10')]);router[_0x9fd9('0x11')]('/:id',auth[_0x9fd9('0x7')](),controller[_0x9fd9('0x12')]);module[_0x9fd9('0x13')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index a1c9806..f1e3981 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 _0x8210=['exports','STRING','ENUM','basic','newTab','integrationTab'];(function(_0x14892a,_0x4abed2){var _0x4557ab=function(_0x37a2c4){while(--_0x37a2c4){_0x14892a['push'](_0x14892a['shift']());}};_0x4557ab(++_0x4abed2);}(_0x8210,0xd8));var _0x0821=function(_0x543084,_0x4337f5){_0x543084=_0x543084-0x0;var _0x306a57=_0x8210[_0x543084];return _0x306a57;};'use strict';var Sequelize=require('sequelize');module[_0x0821('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x0821('0x1')]},'username':{'type':Sequelize[_0x0821('0x1')]},'remoteUri':{'type':Sequelize[_0x0821('0x1')]},'authType':{'type':Sequelize[_0x0821('0x2')](_0x0821('0x3')),'defaultValue':'basic'},'password':{'type':Sequelize['STRING']},'consumerKey':{'type':Sequelize[_0x0821('0x1')]},'consumerSecret':{'type':Sequelize[_0x0821('0x1')]},'token':{'type':Sequelize['STRING']},'tokenSecret':{'type':Sequelize[_0x0821('0x1')]},'serverUrl':{'type':Sequelize[_0x0821('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x0821('0x2')]('integrationTab',_0x0821('0x4')),'defaultValue':_0x0821('0x5')}}; \ No newline at end of file +var _0xc3d4=['integrationTab','newTab','sequelize','exports','STRING','ENUM','basic'];(function(_0x2f7f7f,_0x5a8c15){var _0x3db089=function(_0x260408){while(--_0x260408){_0x2f7f7f['push'](_0x2f7f7f['shift']());}};_0x3db089(++_0x5a8c15);}(_0xc3d4,0xb1));var _0x4c3d=function(_0x3fb539,_0x386423){_0x3fb539=_0x3fb539-0x0;var _0x3ebf14=_0xc3d4[_0x3fb539];return _0x3ebf14;};'use strict';var Sequelize=require(_0x4c3d('0x0'));module[_0x4c3d('0x1')]={'name':{'type':Sequelize[_0x4c3d('0x2')]},'description':{'type':Sequelize[_0x4c3d('0x2')]},'username':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x4c3d('0x2')]},'authType':{'type':Sequelize[_0x4c3d('0x3')](_0x4c3d('0x4')),'defaultValue':'basic'},'password':{'type':Sequelize[_0x4c3d('0x2')]},'consumerKey':{'type':Sequelize[_0x4c3d('0x2')]},'consumerSecret':{'type':Sequelize[_0x4c3d('0x2')]},'token':{'type':Sequelize[_0x4c3d('0x2')]},'tokenSecret':{'type':Sequelize[_0x4c3d('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x4c3d('0x3')](_0x4c3d('0x5'),_0x4c3d('0x6')),'defaultValue':_0x4c3d('0x5')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index 7f5b814..76b54e4 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 _0xe684=['_embedded','entries','label','test','getFields,\x20%s,\x20%s,\x20%s','getFields','Wrong\x20credentials','statusCode','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','undefined','limit','offset','set','Content-Range','json','apply','reject','save','destroy','status','error','stack','name','send','index','map','DeskAccount','rawAttributes','fieldName','model','query','keys','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','count','then','findAll','rows','catch','params','intersection','includeAll','include','find','create','body','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','channel','type','Descriptions','getDescriptions','DeskConfiguration','DeskField','priority','authType','username','consumerKey','consumerSecret','token','remoteUri','slice','substring','lastIndexOf','GET','format','%s/custom_fields','application/json','basic','headers','Authorization','Basic\x20%s','%s:%s','password','toString','concat'];(function(_0x441400,_0x1af52f){var _0x18b13b=function(_0x38c988){while(--_0x38c988){_0x441400['push'](_0x441400['shift']());}};_0x18b13b(++_0x1af52f);}(_0xe684,0xf2));var _0x4e68=function(_0x1fc122,_0x5e2c17){_0x1fc122=_0x1fc122-0x0;var _0xa2cb13=_0xe684[_0x1fc122];return _0xa2cb13;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4e68('0x0'));var zipdir=require(_0x4e68('0x1'));var jsonpatch=require(_0x4e68('0x2'));var rp=require(_0x4e68('0x3'));var moment=require(_0x4e68('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x4e68('0x5'));var util=require('util');var path=require('path');var sox=require(_0x4e68('0x6'));var csv=require(_0x4e68('0x7'));var ejs=require(_0x4e68('0x8'));var fs=require('fs');var fs_extra=require(_0x4e68('0x9'));var _=require(_0x4e68('0xa'));var squel=require(_0x4e68('0xb'));var crypto=require('crypto');var jsforce=require(_0x4e68('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x4e68('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x4e68('0xd'));var authService=require(_0x4e68('0xe'));var qs=require(_0x4e68('0xf'));var as=require(_0x4e68('0x10'));var hardwareService=require(_0x4e68('0x11'));var logger=require(_0x4e68('0x12'))(_0x4e68('0x13'));var utils=require(_0x4e68('0x14'));var config=require(_0x4e68('0x15'));var licenseUtil=require(_0x4e68('0x16'));var db=require(_0x4e68('0x17'))['db'];var integrations=require(_0x4e68('0x18'));function respondWithStatusCode(_0x3f434b,_0x513126){_0x513126=_0x513126||0xcc;return function(_0x437ed3){if(_0x437ed3){return _0x3f434b[_0x4e68('0x19')](_0x513126);}return _0x3f434b['status'](_0x513126)[_0x4e68('0x1a')]();};}function respondWithResult(_0x402464,_0x8d5106){_0x8d5106=_0x8d5106||0xc8;return function(_0x3d26ce){if(_0x3d26ce){return _0x402464['status'](_0x8d5106)['json'](_0x3d26ce);}};}function respondWithFilteredResult(_0x253f3e,_0x107b8d){return function(_0x2f239d){if(_0x2f239d){var _0x3d80dd=typeof _0x107b8d['offset']===_0x4e68('0x1b')&&typeof _0x107b8d[_0x4e68('0x1c')]===_0x4e68('0x1b');var _0x3579c6=_0x2f239d['count'];var _0x43cb59=_0x3d80dd?0x0:_0x107b8d[_0x4e68('0x1d')];var _0x434fd4=_0x3d80dd?_0x2f239d['count']:_0x107b8d['offset']+_0x107b8d[_0x4e68('0x1c')];var _0x127e21;if(_0x434fd4>=_0x3579c6){_0x434fd4=_0x3579c6;_0x127e21=0xc8;}else{_0x127e21=0xce;}_0x253f3e['status'](_0x127e21);return _0x253f3e[_0x4e68('0x1e')](_0x4e68('0x1f'),_0x43cb59+'-'+_0x434fd4+'/'+_0x3579c6)[_0x4e68('0x20')](_0x2f239d);}return null;};}function patchUpdates(_0x32cd21){return function(_0xdcf169){try{jsonpatch[_0x4e68('0x21')](_0xdcf169,_0x32cd21,!![]);}catch(_0x489349){return BPromise[_0x4e68('0x22')](_0x489349);}return _0xdcf169[_0x4e68('0x23')]();};}function saveUpdates(_0x457001,_0xa7e840){return function(_0x24df05){if(_0x24df05){return _0x24df05['update'](_0x457001)['then'](function(_0x2d2952){return _0x2d2952;});}return null;};}function removeEntity(_0x2d76b8,_0x601324){return function(_0x40ea61){if(_0x40ea61){return _0x40ea61[_0x4e68('0x24')]()['then'](function(){_0x2d76b8[_0x4e68('0x25')](0xcc)[_0x4e68('0x1a')]();});}};}function handleEntityNotFound(_0xd9f3ce,_0xa4829f){return function(_0x5b4511){if(!_0x5b4511){_0xd9f3ce['sendStatus'](0x194);}return _0x5b4511;};}function handleError(_0x29286b,_0x5d790c){_0x5d790c=_0x5d790c||0x1f4;return function(_0x51cb09){logger[_0x4e68('0x26')](_0x51cb09[_0x4e68('0x27')]);if(_0x51cb09[_0x4e68('0x28')]){delete _0x51cb09[_0x4e68('0x28')];}_0x29286b['status'](_0x5d790c)[_0x4e68('0x29')](_0x51cb09);};}exports[_0x4e68('0x2a')]=function(_0x3cc583,_0x2b74f6){var _0x226d90={},_0x5b5061={},_0x19c853={'count':0x0,'rows':[]};var _0x83822c=_[_0x4e68('0x2b')](db[_0x4e68('0x2c')][_0x4e68('0x2d')],function(_0x18205e){return{'name':_0x18205e[_0x4e68('0x2e')],'type':_0x18205e['type']['key']};});_0x5b5061[_0x4e68('0x2f')]=_[_0x4e68('0x2b')](_0x83822c,_0x4e68('0x28'));_0x5b5061[_0x4e68('0x30')]=_[_0x4e68('0x31')](_0x3cc583[_0x4e68('0x30')]);_0x5b5061['filters']=_['intersection'](_0x5b5061[_0x4e68('0x2f')],_0x5b5061[_0x4e68('0x30')]);_0x226d90[_0x4e68('0x32')]=_['intersection'](_0x5b5061[_0x4e68('0x2f')],qs[_0x4e68('0x33')](_0x3cc583[_0x4e68('0x30')]['fields']));_0x226d90[_0x4e68('0x32')]=_0x226d90[_0x4e68('0x32')][_0x4e68('0x34')]?_0x226d90[_0x4e68('0x32')]:_0x5b5061[_0x4e68('0x2f')];if(!_0x3cc583[_0x4e68('0x30')][_0x4e68('0x35')](_0x4e68('0x36'))){_0x226d90['limit']=qs[_0x4e68('0x1c')](_0x3cc583[_0x4e68('0x30')]['limit']);_0x226d90[_0x4e68('0x1d')]=qs[_0x4e68('0x1d')](_0x3cc583[_0x4e68('0x30')]['offset']);}_0x226d90[_0x4e68('0x37')]=qs['sort'](_0x3cc583[_0x4e68('0x30')][_0x4e68('0x38')]);_0x226d90[_0x4e68('0x39')]=qs[_0x4e68('0x3a')](_[_0x4e68('0x3b')](_0x3cc583[_0x4e68('0x30')],_0x5b5061['filters']),_0x83822c);if(_0x3cc583[_0x4e68('0x30')][_0x4e68('0x3c')]){_0x226d90[_0x4e68('0x39')]=_[_0x4e68('0x3d')](_0x226d90[_0x4e68('0x39')],{'$or':_['map'](_0x83822c,function(_0x156766){if(_0x156766['type']!==_0x4e68('0x3e')){var _0x1f8bb3={};_0x1f8bb3[_0x156766['name']]={'$like':'%'+_0x3cc583['query'][_0x4e68('0x3c')]+'%'};return _0x1f8bb3;}})});}_0x226d90=_[_0x4e68('0x3d')]({},_0x226d90,_0x3cc583[_0x4e68('0x3f')]);var _0x4a2f82={'where':_0x226d90[_0x4e68('0x39')]};return db['DeskAccount'][_0x4e68('0x40')](_0x4a2f82)[_0x4e68('0x41')](function(_0x3c9427){_0x19c853[_0x4e68('0x40')]=_0x3c9427;if(_0x3cc583[_0x4e68('0x30')]['includeAll']){_0x226d90['include']=[{'all':!![]}];}return db[_0x4e68('0x2c')][_0x4e68('0x42')](_0x226d90);})[_0x4e68('0x41')](function(_0x22e5a4){_0x19c853[_0x4e68('0x43')]=_0x22e5a4;return _0x19c853;})[_0x4e68('0x41')](respondWithFilteredResult(_0x2b74f6,_0x226d90))[_0x4e68('0x44')](handleError(_0x2b74f6,null));};exports['show']=function(_0xecf839,_0x4aff4b){var _0x12373e={'raw':![],'where':{'id':_0xecf839[_0x4e68('0x45')]['id']}},_0x53d6f5={};_0x53d6f5[_0x4e68('0x2f')]=_[_0x4e68('0x31')](db[_0x4e68('0x2c')]['rawAttributes']);_0x53d6f5[_0x4e68('0x30')]=_[_0x4e68('0x31')](_0xecf839[_0x4e68('0x30')]);_0x53d6f5['filters']=_[_0x4e68('0x46')](_0x53d6f5['model'],_0x53d6f5[_0x4e68('0x30')]);_0x12373e[_0x4e68('0x32')]=_[_0x4e68('0x46')](_0x53d6f5[_0x4e68('0x2f')],qs[_0x4e68('0x33')](_0xecf839[_0x4e68('0x30')][_0x4e68('0x33')]));_0x12373e['attributes']=_0x12373e['attributes']['length']?_0x12373e[_0x4e68('0x32')]:_0x53d6f5[_0x4e68('0x2f')];if(_0xecf839[_0x4e68('0x30')][_0x4e68('0x47')]){_0x12373e[_0x4e68('0x48')]=[{'all':!![]}];}_0x12373e=_['merge']({},_0x12373e,_0xecf839[_0x4e68('0x3f')]);return db[_0x4e68('0x2c')][_0x4e68('0x49')](_0x12373e)[_0x4e68('0x41')](handleEntityNotFound(_0x4aff4b,null))[_0x4e68('0x41')](respondWithResult(_0x4aff4b,null))[_0x4e68('0x44')](handleError(_0x4aff4b,null));};exports[_0x4e68('0x4a')]=function(_0x546e88,_0x4a9199){return db[_0x4e68('0x2c')][_0x4e68('0x4a')](_0x546e88['body'],{})[_0x4e68('0x41')](respondWithResult(_0x4a9199,0xc9))[_0x4e68('0x44')](handleError(_0x4a9199,null));};exports['update']=function(_0x3611ba,_0x5d7d4a){if(_0x3611ba[_0x4e68('0x4b')]['id']){delete _0x3611ba[_0x4e68('0x4b')]['id'];}return db['DeskAccount'][_0x4e68('0x49')]({'where':{'id':_0x3611ba[_0x4e68('0x45')]['id']}})['then'](handleEntityNotFound(_0x5d7d4a,null))[_0x4e68('0x41')](saveUpdates(_0x3611ba['body'],null))[_0x4e68('0x41')](respondWithResult(_0x5d7d4a,null))[_0x4e68('0x44')](handleError(_0x5d7d4a,null));};exports[_0x4e68('0x24')]=function(_0x326d12,_0x1ddb60){return db['DeskAccount'][_0x4e68('0x49')]({'where':{'id':_0x326d12[_0x4e68('0x45')]['id']}})[_0x4e68('0x41')](handleEntityNotFound(_0x1ddb60,null))[_0x4e68('0x41')](removeEntity(_0x1ddb60,null))['catch'](handleError(_0x1ddb60,null));};exports[_0x4e68('0x4c')]=function(_0x4e5356,_0x24da30,_0x5ca98e){var _0x671513={};var _0x109953={};var _0x51f0ec;var _0x4a28e7;return db[_0x4e68('0x2c')]['findOne']({'where':{'id':_0x4e5356[_0x4e68('0x45')]['id']}})['then'](handleEntityNotFound(_0x24da30,null))[_0x4e68('0x41')](function(_0x20290b){if(_0x20290b){_0x51f0ec=_0x20290b;_0x109953['model']=_['keys'](db['DeskConfiguration'][_0x4e68('0x2d')]);_0x109953[_0x4e68('0x30')]=_[_0x4e68('0x31')](_0x4e5356[_0x4e68('0x30')]);_0x109953['filters']=_[_0x4e68('0x46')](_0x109953[_0x4e68('0x2f')],_0x109953[_0x4e68('0x30')]);_0x671513['attributes']=_[_0x4e68('0x46')](_0x109953['model'],qs[_0x4e68('0x33')](_0x4e5356['query'][_0x4e68('0x33')]));_0x671513[_0x4e68('0x32')]=_0x671513[_0x4e68('0x32')][_0x4e68('0x34')]?_0x671513['attributes']:_0x109953[_0x4e68('0x2f')];_0x671513[_0x4e68('0x37')]=qs[_0x4e68('0x38')](_0x4e5356[_0x4e68('0x30')]['sort']);_0x671513['where']=qs[_0x4e68('0x3a')](_[_0x4e68('0x3b')](_0x4e5356['query'],_0x109953[_0x4e68('0x3a')]));if(_0x4e5356['query']['filter']){_0x671513[_0x4e68('0x39')]=_[_0x4e68('0x3d')](_0x671513[_0x4e68('0x39')],{'$or':_[_0x4e68('0x2b')](_0x671513[_0x4e68('0x32')],function(_0x337364){var _0x399b0d={};_0x399b0d[_0x337364]={'$like':'%'+_0x4e5356[_0x4e68('0x30')][_0x4e68('0x3c')]+'%'};return _0x399b0d;})});}_0x671513=_['merge']({},_0x671513,_0x4e5356[_0x4e68('0x3f')]);return _0x51f0ec[_0x4e68('0x4c')](_0x671513);}})[_0x4e68('0x41')](function(_0x2c9914){if(_0x2c9914){_0x4a28e7=_0x2c9914[_0x4e68('0x34')];if(!_0x4e5356[_0x4e68('0x30')]['hasOwnProperty'](_0x4e68('0x36'))){_0x671513[_0x4e68('0x1c')]=qs[_0x4e68('0x1c')](_0x4e5356[_0x4e68('0x30')][_0x4e68('0x1c')]);_0x671513['offset']=qs[_0x4e68('0x1d')](_0x4e5356[_0x4e68('0x30')][_0x4e68('0x1d')]);}return _0x51f0ec[_0x4e68('0x4c')](_0x671513);}})[_0x4e68('0x41')](function(_0x40eefa){if(_0x40eefa){return _0x40eefa?{'count':_0x4a28e7,'rows':_0x40eefa}:null;}})['then'](respondWithResult(_0x24da30,null))[_0x4e68('0x44')](handleError(_0x24da30,null));};exports[_0x4e68('0x4d')]=function(_0x3b8131,_0x59666e,_0x148952){if(_0x3b8131[_0x4e68('0x4b')]['id']){delete _0x3b8131[_0x4e68('0x4b')]['id'];}return db[_0x4e68('0x2c')]['findOne']({'where':{'id':_0x3b8131['params']['id']}})[_0x4e68('0x41')](handleEntityNotFound(_0x59666e,null))[_0x4e68('0x41')](function(_0x10b1cd){if(_0x10b1cd){_0x3b8131[_0x4e68('0x4b')][_0x4e68('0x4e')]=_0x10b1cd['id'];_0x3b8131[_0x4e68('0x4b')][_0x4e68('0x4f')]=integrations[_0x4e68('0x50')](_0x3b8131[_0x4e68('0x4b')][_0x4e68('0x51')],_0x3b8131[_0x4e68('0x4b')][_0x4e68('0x52')]);_0x3b8131[_0x4e68('0x4b')][_0x4e68('0x53')]=integrations[_0x4e68('0x54')](_0x3b8131[_0x4e68('0x4b')][_0x4e68('0x51')],_0x3b8131[_0x4e68('0x4b')][_0x4e68('0x52')]);return db[_0x4e68('0x55')]['create'](_0x3b8131[_0x4e68('0x4b')],{'include':[{'model':db['DeskField'],'as':_0x4e68('0x4f')},{'model':db[_0x4e68('0x56')],'as':_0x4e68('0x53')}]});}return null;})[_0x4e68('0x41')](respondWithResult(_0x59666e,null))[_0x4e68('0x44')](handleError(_0x59666e,null));};exports['getFields']=function(_0x5403b4,_0x3949ed,_0x66b9a9){var _0x2b8b6c=[{'name':_0x4e68('0x57'),'label':_0x4e68('0x57'),'custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x109e6d='';return db[_0x4e68('0x2c')]['findOne']({'where':{'id':_0x5403b4['params']['id']},'attributes':['id','remoteUri',_0x4e68('0x58'),_0x4e68('0x59'),'password',_0x4e68('0x5a'),_0x4e68('0x5b'),_0x4e68('0x5c'),'tokenSecret']})['then'](handleEntityNotFound(_0x3949ed,null))['then'](function(_0x1b47dc){if(_0x1b47dc){_0x109e6d=_0x1b47dc[_0x4e68('0x5d')];var _0x1c1d74=_0x109e6d[_0x4e68('0x5e')](-0x1);if(_0x1c1d74==='/'){_0x109e6d=_0x109e6d[_0x4e68('0x5f')](0x0,_0x109e6d[_0x4e68('0x60')](_0x1c1d74));}var _0x4e26aa={'method':_0x4e68('0x61'),'uri':util[_0x4e68('0x62')](_0x4e68('0x63'),_0x109e6d),'headers':{'Content-Type':_0x4e68('0x64'),'Accept':_0x4e68('0x64')},'json':!![]};if(_0x1b47dc[_0x4e68('0x58')]===_0x4e68('0x65')){_0x4e26aa[_0x4e68('0x66')][_0x4e68('0x67')]=util[_0x4e68('0x62')](_0x4e68('0x68'),new Buffer(util['format'](_0x4e68('0x69'),_0x1b47dc['username'],_0x1b47dc[_0x4e68('0x6a')]))[_0x4e68('0x6b')]('base64'));}return rp(_0x4e26aa)[_0x4e68('0x41')](function(_0x32c35c){return _0x2b8b6c[_0x4e68('0x6c')](_['map'](_0x32c35c[_0x4e68('0x6d')][_0x4e68('0x6e')],function(_0x2397aa){return{'id':_0x2397aa['name'],'name':_0x2397aa['name'],'type':_0x2397aa[_0x4e68('0x52')],'active':_0x2397aa['active'],'label':_0x2397aa[_0x4e68('0x6f')],'custom':!![]};}));});}})[_0x4e68('0x41')](function(_0x568457){return{'count':_0x568457[_0x4e68('0x34')],'rows':_0x568457};})[_0x4e68('0x41')](respondWithResult(_0x3949ed,null))[_0x4e68('0x44')](function(_0xaee2c4){var _0x54b9b4=_0x5403b4[_0x4e68('0x30')][_0x4e68('0x70')]?0x1f4:_0xaee2c4['statusCode']||0x1f4;logger['error'](_0x4e68('0x71'),_0x4e68('0x72'),_0x54b9b4,JSON['stringify'](_0xaee2c4));delete _0xaee2c4[_0x4e68('0x28')];if(_0x54b9b4===0x191){_0x54b9b4=0x190;}_0x3949ed[_0x4e68('0x25')](_0x54b9b4)[_0x4e68('0x29')](_0x5403b4[_0x4e68('0x30')][_0x4e68('0x70')]?{'message':_0x4e68('0x73'),'statusCode':_0xaee2c4[_0x4e68('0x74')]}:_0xaee2c4);});}; \ No newline at end of file +var _0xb39f=['key','map','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','include','findAll','rows','catch','params','keys','includeAll','options','find','create','body','destroy','getConfigurations','findOne','DeskConfiguration','sort','addConfiguration','AccountId','Subjects','getDescriptions','channel','DeskField','Descriptions','getFields','priority','remoteUri','password','consumerSecret','token','tokenSecret','slice','substring','lastIndexOf','GET','format','%s/custom_fields','application/json','authType','basic','headers','Authorization','Basic\x20%s','%s:%s','toString','base64','concat','_embedded','entries','active','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','stack','name','index','DeskAccount','rawAttributes','fieldName','type'];(function(_0x3fb493,_0x1c45b5){var _0x3a6f26=function(_0x32dc3f){while(--_0x32dc3f){_0x3fb493['push'](_0x3fb493['shift']());}};_0x3a6f26(++_0x1c45b5);}(_0xb39f,0xbd));var _0xfb39=function(_0x38364a,_0x5c3d1a){_0x38364a=_0x38364a-0x0;var _0x25e387=_0xb39f[_0x38364a];return _0x25e387;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfb39('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfb39('0x1'));var rp=require(_0xfb39('0x2'));var moment=require('moment');var BPromise=require(_0xfb39('0x3'));var Mustache=require(_0xfb39('0x4'));var util=require(_0xfb39('0x5'));var path=require(_0xfb39('0x6'));var sox=require(_0xfb39('0x7'));var csv=require('to-csv');var ejs=require(_0xfb39('0x8'));var fs=require('fs');var fs_extra=require(_0xfb39('0x9'));var _=require(_0xfb39('0xa'));var squel=require(_0xfb39('0xb'));var crypto=require(_0xfb39('0xc'));var jsforce=require(_0xfb39('0xd'));var deskjs=require(_0xfb39('0xe'));var toCsv=require('to-csv');var querystring=require(_0xfb39('0xf'));var Papa=require(_0xfb39('0x10'));var Redis=require(_0xfb39('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xfb39('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfb39('0x13'));var logger=require(_0xfb39('0x14'))('api');var utils=require(_0xfb39('0x15'));var config=require(_0xfb39('0x16'));var licenseUtil=require(_0xfb39('0x17'));var db=require('../../mysqldb')['db'];var integrations=require(_0xfb39('0x18'));function respondWithStatusCode(_0x30f936,_0x49bf6c){_0x49bf6c=_0x49bf6c||0xcc;return function(_0x1f61d4){if(_0x1f61d4){return _0x30f936[_0xfb39('0x19')](_0x49bf6c);}return _0x30f936[_0xfb39('0x1a')](_0x49bf6c)[_0xfb39('0x1b')]();};}function respondWithResult(_0x6f124d,_0x389b8e){_0x389b8e=_0x389b8e||0xc8;return function(_0x95ad7b){if(_0x95ad7b){return _0x6f124d[_0xfb39('0x1a')](_0x389b8e)['json'](_0x95ad7b);}};}function respondWithFilteredResult(_0x100b2c,_0x99ccde){return function(_0x4e0524){if(_0x4e0524){var _0x543a59=typeof _0x99ccde[_0xfb39('0x1c')]===_0xfb39('0x1d')&&typeof _0x99ccde[_0xfb39('0x1e')]==='undefined';var _0x14bf37=_0x4e0524[_0xfb39('0x1f')];var _0x5a19c5=_0x543a59?0x0:_0x99ccde[_0xfb39('0x1c')];var _0x2e121d=_0x543a59?_0x4e0524[_0xfb39('0x1f')]:_0x99ccde[_0xfb39('0x1c')]+_0x99ccde['limit'];var _0x33fbba;if(_0x2e121d>=_0x14bf37){_0x2e121d=_0x14bf37;_0x33fbba=0xc8;}else{_0x33fbba=0xce;}_0x100b2c[_0xfb39('0x1a')](_0x33fbba);return _0x100b2c[_0xfb39('0x20')](_0xfb39('0x21'),_0x5a19c5+'-'+_0x2e121d+'/'+_0x14bf37)['json'](_0x4e0524);}return null;};}function patchUpdates(_0x3953f8){return function(_0x2c4215){try{jsonpatch[_0xfb39('0x22')](_0x2c4215,_0x3953f8,!![]);}catch(_0x396d4c){return BPromise['reject'](_0x396d4c);}return _0x2c4215[_0xfb39('0x23')]();};}function saveUpdates(_0x4219d7,_0x46615f){return function(_0x3b2b40){if(_0x3b2b40){return _0x3b2b40[_0xfb39('0x24')](_0x4219d7)[_0xfb39('0x25')](function(_0x59d03c){return _0x59d03c;});}return null;};}function removeEntity(_0x5a3778,_0x26ae91){return function(_0x273243){if(_0x273243){return _0x273243['destroy']()[_0xfb39('0x25')](function(){_0x5a3778['status'](0xcc)[_0xfb39('0x1b')]();});}};}function handleEntityNotFound(_0x52bbb1,_0x781d89){return function(_0x36e7b1){if(!_0x36e7b1){_0x52bbb1[_0xfb39('0x19')](0x194);}return _0x36e7b1;};}function handleError(_0x2188f2,_0x5335b9){_0x5335b9=_0x5335b9||0x1f4;return function(_0x2bf024){logger['error'](_0x2bf024[_0xfb39('0x26')]);if(_0x2bf024[_0xfb39('0x27')]){delete _0x2bf024[_0xfb39('0x27')];}_0x2188f2[_0xfb39('0x1a')](_0x5335b9)['send'](_0x2bf024);};}exports[_0xfb39('0x28')]=function(_0xd470db,_0x158c14){var _0x4bc93c={},_0x466696={},_0x97e0cf={'count':0x0,'rows':[]};var _0x53c00f=_['map'](db[_0xfb39('0x29')][_0xfb39('0x2a')],function(_0x4ed74b){return{'name':_0x4ed74b[_0xfb39('0x2b')],'type':_0x4ed74b[_0xfb39('0x2c')][_0xfb39('0x2d')]};});_0x466696['model']=_[_0xfb39('0x2e')](_0x53c00f,_0xfb39('0x27'));_0x466696[_0xfb39('0x2f')]=_['keys'](_0xd470db[_0xfb39('0x2f')]);_0x466696[_0xfb39('0x30')]=_[_0xfb39('0x31')](_0x466696['model'],_0x466696['query']);_0x4bc93c[_0xfb39('0x32')]=_[_0xfb39('0x31')](_0x466696[_0xfb39('0x33')],qs[_0xfb39('0x34')](_0xd470db[_0xfb39('0x2f')][_0xfb39('0x34')]));_0x4bc93c[_0xfb39('0x32')]=_0x4bc93c[_0xfb39('0x32')][_0xfb39('0x35')]?_0x4bc93c['attributes']:_0x466696[_0xfb39('0x33')];if(!_0xd470db[_0xfb39('0x2f')][_0xfb39('0x36')](_0xfb39('0x37'))){_0x4bc93c['limit']=qs['limit'](_0xd470db[_0xfb39('0x2f')][_0xfb39('0x1e')]);_0x4bc93c['offset']=qs['offset'](_0xd470db[_0xfb39('0x2f')]['offset']);}_0x4bc93c[_0xfb39('0x38')]=qs['sort'](_0xd470db[_0xfb39('0x2f')]['sort']);_0x4bc93c[_0xfb39('0x39')]=qs[_0xfb39('0x30')](_[_0xfb39('0x3a')](_0xd470db['query'],_0x466696[_0xfb39('0x30')]),_0x53c00f);if(_0xd470db[_0xfb39('0x2f')][_0xfb39('0x3b')]){_0x4bc93c['where']=_[_0xfb39('0x3c')](_0x4bc93c['where'],{'$or':_[_0xfb39('0x2e')](_0x53c00f,function(_0x13abb9){if(_0x13abb9['type']!==_0xfb39('0x3d')){var _0x25b234={};_0x25b234[_0x13abb9[_0xfb39('0x27')]]={'$like':'%'+_0xd470db[_0xfb39('0x2f')][_0xfb39('0x3b')]+'%'};return _0x25b234;}})});}_0x4bc93c=_[_0xfb39('0x3c')]({},_0x4bc93c,_0xd470db['options']);var _0x29d751={'where':_0x4bc93c[_0xfb39('0x39')]};return db['DeskAccount'][_0xfb39('0x1f')](_0x29d751)[_0xfb39('0x25')](function(_0x4932fa){_0x97e0cf[_0xfb39('0x1f')]=_0x4932fa;if(_0xd470db['query']['includeAll']){_0x4bc93c[_0xfb39('0x3e')]=[{'all':!![]}];}return db[_0xfb39('0x29')][_0xfb39('0x3f')](_0x4bc93c);})[_0xfb39('0x25')](function(_0x2d943a){_0x97e0cf[_0xfb39('0x40')]=_0x2d943a;return _0x97e0cf;})[_0xfb39('0x25')](respondWithFilteredResult(_0x158c14,_0x4bc93c))[_0xfb39('0x41')](handleError(_0x158c14,null));};exports['show']=function(_0x828f68,_0x20394f){var _0x572171={'raw':![],'where':{'id':_0x828f68[_0xfb39('0x42')]['id']}},_0x9ec11e={};_0x9ec11e[_0xfb39('0x33')]=_[_0xfb39('0x43')](db[_0xfb39('0x29')][_0xfb39('0x2a')]);_0x9ec11e[_0xfb39('0x2f')]=_['keys'](_0x828f68[_0xfb39('0x2f')]);_0x9ec11e['filters']=_['intersection'](_0x9ec11e[_0xfb39('0x33')],_0x9ec11e[_0xfb39('0x2f')]);_0x572171[_0xfb39('0x32')]=_[_0xfb39('0x31')](_0x9ec11e[_0xfb39('0x33')],qs['fields'](_0x828f68[_0xfb39('0x2f')][_0xfb39('0x34')]));_0x572171[_0xfb39('0x32')]=_0x572171[_0xfb39('0x32')][_0xfb39('0x35')]?_0x572171[_0xfb39('0x32')]:_0x9ec11e[_0xfb39('0x33')];if(_0x828f68[_0xfb39('0x2f')][_0xfb39('0x44')]){_0x572171[_0xfb39('0x3e')]=[{'all':!![]}];}_0x572171=_['merge']({},_0x572171,_0x828f68[_0xfb39('0x45')]);return db[_0xfb39('0x29')][_0xfb39('0x46')](_0x572171)['then'](handleEntityNotFound(_0x20394f,null))['then'](respondWithResult(_0x20394f,null))[_0xfb39('0x41')](handleError(_0x20394f,null));};exports[_0xfb39('0x47')]=function(_0x5eb5c1,_0x37fba0){return db[_0xfb39('0x29')][_0xfb39('0x47')](_0x5eb5c1[_0xfb39('0x48')],{})[_0xfb39('0x25')](respondWithResult(_0x37fba0,0xc9))[_0xfb39('0x41')](handleError(_0x37fba0,null));};exports[_0xfb39('0x24')]=function(_0x2b8d7c,_0x2aa18e){if(_0x2b8d7c[_0xfb39('0x48')]['id']){delete _0x2b8d7c['body']['id'];}return db[_0xfb39('0x29')][_0xfb39('0x46')]({'where':{'id':_0x2b8d7c[_0xfb39('0x42')]['id']}})['then'](handleEntityNotFound(_0x2aa18e,null))[_0xfb39('0x25')](saveUpdates(_0x2b8d7c[_0xfb39('0x48')],null))[_0xfb39('0x25')](respondWithResult(_0x2aa18e,null))[_0xfb39('0x41')](handleError(_0x2aa18e,null));};exports[_0xfb39('0x49')]=function(_0x1a7af6,_0x566850){return db[_0xfb39('0x29')]['find']({'where':{'id':_0x1a7af6['params']['id']}})[_0xfb39('0x25')](handleEntityNotFound(_0x566850,null))[_0xfb39('0x25')](removeEntity(_0x566850,null))[_0xfb39('0x41')](handleError(_0x566850,null));};exports[_0xfb39('0x4a')]=function(_0x1956cf,_0x407d97,_0x36b39d){var _0x208cc0={};var _0x1d2a4e={};var _0x5651d8;var _0x17955e;return db[_0xfb39('0x29')][_0xfb39('0x4b')]({'where':{'id':_0x1956cf[_0xfb39('0x42')]['id']}})[_0xfb39('0x25')](handleEntityNotFound(_0x407d97,null))[_0xfb39('0x25')](function(_0x46350e){if(_0x46350e){_0x5651d8=_0x46350e;_0x1d2a4e[_0xfb39('0x33')]=_['keys'](db[_0xfb39('0x4c')][_0xfb39('0x2a')]);_0x1d2a4e['query']=_['keys'](_0x1956cf[_0xfb39('0x2f')]);_0x1d2a4e[_0xfb39('0x30')]=_[_0xfb39('0x31')](_0x1d2a4e[_0xfb39('0x33')],_0x1d2a4e[_0xfb39('0x2f')]);_0x208cc0['attributes']=_[_0xfb39('0x31')](_0x1d2a4e['model'],qs[_0xfb39('0x34')](_0x1956cf['query'][_0xfb39('0x34')]));_0x208cc0['attributes']=_0x208cc0['attributes'][_0xfb39('0x35')]?_0x208cc0[_0xfb39('0x32')]:_0x1d2a4e[_0xfb39('0x33')];_0x208cc0[_0xfb39('0x38')]=qs[_0xfb39('0x4d')](_0x1956cf[_0xfb39('0x2f')][_0xfb39('0x4d')]);_0x208cc0['where']=qs[_0xfb39('0x30')](_[_0xfb39('0x3a')](_0x1956cf[_0xfb39('0x2f')],_0x1d2a4e[_0xfb39('0x30')]));if(_0x1956cf[_0xfb39('0x2f')][_0xfb39('0x3b')]){_0x208cc0[_0xfb39('0x39')]=_[_0xfb39('0x3c')](_0x208cc0[_0xfb39('0x39')],{'$or':_[_0xfb39('0x2e')](_0x208cc0['attributes'],function(_0x29b159){var _0x1e5690={};_0x1e5690[_0x29b159]={'$like':'%'+_0x1956cf[_0xfb39('0x2f')]['filter']+'%'};return _0x1e5690;})});}_0x208cc0=_['merge']({},_0x208cc0,_0x1956cf['options']);return _0x5651d8[_0xfb39('0x4a')](_0x208cc0);}})[_0xfb39('0x25')](function(_0x5bb9e1){if(_0x5bb9e1){_0x17955e=_0x5bb9e1[_0xfb39('0x35')];if(!_0x1956cf[_0xfb39('0x2f')][_0xfb39('0x36')](_0xfb39('0x37'))){_0x208cc0[_0xfb39('0x1e')]=qs[_0xfb39('0x1e')](_0x1956cf[_0xfb39('0x2f')][_0xfb39('0x1e')]);_0x208cc0[_0xfb39('0x1c')]=qs[_0xfb39('0x1c')](_0x1956cf[_0xfb39('0x2f')][_0xfb39('0x1c')]);}return _0x5651d8['getConfigurations'](_0x208cc0);}})[_0xfb39('0x25')](function(_0x48535a){if(_0x48535a){return _0x48535a?{'count':_0x17955e,'rows':_0x48535a}:null;}})[_0xfb39('0x25')](respondWithResult(_0x407d97,null))[_0xfb39('0x41')](handleError(_0x407d97,null));};exports[_0xfb39('0x4e')]=function(_0x19f16b,_0x4862e0,_0x228b82){if(_0x19f16b[_0xfb39('0x48')]['id']){delete _0x19f16b[_0xfb39('0x48')]['id'];}return db[_0xfb39('0x29')][_0xfb39('0x4b')]({'where':{'id':_0x19f16b['params']['id']}})[_0xfb39('0x25')](handleEntityNotFound(_0x4862e0,null))[_0xfb39('0x25')](function(_0x1bf000){if(_0x1bf000){_0x19f16b[_0xfb39('0x48')][_0xfb39('0x4f')]=_0x1bf000['id'];_0x19f16b['body'][_0xfb39('0x50')]=integrations['getSubjects'](_0x19f16b[_0xfb39('0x48')]['channel'],_0x19f16b['body'][_0xfb39('0x2c')]);_0x19f16b[_0xfb39('0x48')]['Descriptions']=integrations[_0xfb39('0x51')](_0x19f16b['body'][_0xfb39('0x52')],_0x19f16b['body'][_0xfb39('0x2c')]);return db[_0xfb39('0x4c')][_0xfb39('0x47')](_0x19f16b[_0xfb39('0x48')],{'include':[{'model':db[_0xfb39('0x53')],'as':_0xfb39('0x50')},{'model':db[_0xfb39('0x53')],'as':_0xfb39('0x54')}]});}return null;})['then'](respondWithResult(_0x4862e0,null))[_0xfb39('0x41')](handleError(_0x4862e0,null));};exports[_0xfb39('0x55')]=function(_0x30db66,_0x1be228,_0x4b7447){var _0x4712eb=[{'name':'priority','label':_0xfb39('0x56'),'custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x360b31='';return db[_0xfb39('0x29')][_0xfb39('0x4b')]({'where':{'id':_0x30db66['params']['id']},'attributes':['id',_0xfb39('0x57'),'authType','username',_0xfb39('0x58'),'consumerKey',_0xfb39('0x59'),_0xfb39('0x5a'),_0xfb39('0x5b')]})[_0xfb39('0x25')](handleEntityNotFound(_0x1be228,null))[_0xfb39('0x25')](function(_0x40682b){if(_0x40682b){_0x360b31=_0x40682b[_0xfb39('0x57')];var _0x4cb474=_0x360b31[_0xfb39('0x5c')](-0x1);if(_0x4cb474==='/'){_0x360b31=_0x360b31[_0xfb39('0x5d')](0x0,_0x360b31[_0xfb39('0x5e')](_0x4cb474));}var _0x2f9375={'method':_0xfb39('0x5f'),'uri':util[_0xfb39('0x60')](_0xfb39('0x61'),_0x360b31),'headers':{'Content-Type':'application/json','Accept':_0xfb39('0x62')},'json':!![]};if(_0x40682b[_0xfb39('0x63')]===_0xfb39('0x64')){_0x2f9375[_0xfb39('0x65')][_0xfb39('0x66')]=util[_0xfb39('0x60')](_0xfb39('0x67'),new Buffer(util['format'](_0xfb39('0x68'),_0x40682b['username'],_0x40682b[_0xfb39('0x58')]))[_0xfb39('0x69')](_0xfb39('0x6a')));}return rp(_0x2f9375)[_0xfb39('0x25')](function(_0x34ff82){return _0x4712eb[_0xfb39('0x6b')](_[_0xfb39('0x2e')](_0x34ff82[_0xfb39('0x6c')][_0xfb39('0x6d')],function(_0x476438){return{'id':_0x476438['name'],'name':_0x476438[_0xfb39('0x27')],'type':_0x476438[_0xfb39('0x2c')],'active':_0x476438[_0xfb39('0x6e')],'label':_0x476438['label'],'custom':!![]};}));});}})[_0xfb39('0x25')](function(_0x29acbd){return{'count':_0x29acbd[_0xfb39('0x35')],'rows':_0x29acbd};})[_0xfb39('0x25')](respondWithResult(_0x1be228,null))[_0xfb39('0x41')](function(_0x58b1f2){var _0x4fc68b=_0x30db66[_0xfb39('0x2f')][_0xfb39('0x6f')]?0x1f4:_0x58b1f2[_0xfb39('0x70')]||0x1f4;logger['error'](_0xfb39('0x71'),_0xfb39('0x55'),_0x4fc68b,JSON[_0xfb39('0x72')](_0x58b1f2));delete _0x58b1f2[_0xfb39('0x27')];if(_0x4fc68b===0x191){_0x4fc68b=0x190;}_0x1be228[_0xfb39('0x1a')](_0x4fc68b)[_0xfb39('0x73')](_0x30db66['query'][_0xfb39('0x6f')]?{'message':_0xfb39('0x74'),'statusCode':_0x58b1f2[_0xfb39('0x70')]}:_0x58b1f2);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 2aa9b25..9b3584e 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 _0x22a8=['lodash','util','../../config/logger','api','bluebird','path','rimraf','../../components/integrations/configuration','DeskAccount','int_desk_accounts'];(function(_0xbb14db,_0x3ee8c6){var _0x36bed7=function(_0x16c478){while(--_0x16c478){_0xbb14db['push'](_0xbb14db['shift']());}};_0x36bed7(++_0x3ee8c6);}(_0x22a8,0x96));var _0x822a=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x22a8[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0x822a('0x0'));var util=require(_0x822a('0x1'));var logger=require(_0x822a('0x2'))(_0x822a('0x3'));var moment=require('moment');var BPromise=require(_0x822a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x822a('0x5'));var rimraf=require(_0x822a('0x6'));var config=require('../../config/environment');var attributes=require('./intDeskAccount.attributes');var integrations=require(_0x822a('0x7'));module['exports']=function(_0x4d2006,_0x44b61c){return _0x4d2006['define'](_0x822a('0x8'),attributes,{'tableName':_0x822a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8218=['int_desk_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','exports','define','DeskAccount'];(function(_0x29dbdd,_0x2be173){var _0x419f27=function(_0x4bf291){while(--_0x4bf291){_0x29dbdd['push'](_0x29dbdd['shift']());}};_0x419f27(++_0x2be173);}(_0x8218,0x10f));var _0x8821=function(_0x432bed,_0x5e10aa){_0x432bed=_0x432bed-0x0;var _0xab0f97=_0x8218[_0x432bed];return _0xab0f97;};'use strict';var _=require(_0x8821('0x0'));var util=require(_0x8821('0x1'));var logger=require(_0x8821('0x2'))(_0x8821('0x3'));var moment=require(_0x8821('0x4'));var BPromise=require(_0x8821('0x5'));var rp=require(_0x8821('0x6'));var fs=require('fs');var path=require(_0x8821('0x7'));var rimraf=require(_0x8821('0x8'));var config=require(_0x8821('0x9'));var attributes=require('./intDeskAccount.attributes');var integrations=require(_0x8821('0xa'));module[_0x8821('0xb')]=function(_0x4f7aa7,_0x2db2b8){return _0x4f7aa7[_0x8821('0xc')](_0x8821('0xd'),attributes,{'tableName':_0x8821('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.rpc.js b/server/api/intDeskAccount/intDeskAccount.rpc.js index e7fdf80..ee50652 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 _0xc10b=['find','where','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','DeskAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','GetDeskAccount','findAll','options','raw','attributes','limit','include','map','model','info','debug','catch','ShowDeskAccount','DeskAccount'];(function(_0x6235d2,_0x1822db){var _0x4f7477=function(_0x2cd01f){while(--_0x2cd01f){_0x6235d2['push'](_0x6235d2['shift']());}};_0x4f7477(++_0x1822db);}(_0xc10b,0x71));var _0xbc10=function(_0x40a825,_0x3bac79){_0x40a825=_0x40a825-0x0;var _0x273a54=_0xc10b[_0x40a825];return _0x273a54;};'use strict';var _=require(_0xbc10('0x0'));var util=require(_0xbc10('0x1'));var moment=require(_0xbc10('0x2'));var BPromise=require(_0xbc10('0x3'));var rs=require(_0xbc10('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbc10('0x5'))['db'];var utils=require(_0xbc10('0x6'));var logger=require(_0xbc10('0x7'))('rpc');var config=require(_0xbc10('0x8'));var jayson=require(_0xbc10('0x9'));var client=jayson[_0xbc10('0xa')][_0xbc10('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4e01f1,_0x3050df,_0x3c77d3){return new BPromise(function(_0x17390e,_0x1859cc){return client[_0xbc10('0xc')](_0x4e01f1,_0x3c77d3)[_0xbc10('0xd')](function(_0x1c1fd3){logger['info'](_0xbc10('0xe'),_0x3050df,'request\x20sent');logger['debug']('DeskAccount,\x20%s,\x20%s,\x20%s',_0x3050df,_0xbc10('0xf'),JSON[_0xbc10('0x10')](_0x1c1fd3));if(_0x1c1fd3[_0xbc10('0x11')]){if(_0x1c1fd3['error'][_0xbc10('0x12')]===0x1f4){logger[_0xbc10('0x11')](_0xbc10('0xe'),_0x3050df,_0x1c1fd3['error'][_0xbc10('0x13')]);return _0x1859cc(_0x1c1fd3[_0xbc10('0x11')][_0xbc10('0x13')]);}logger['error'](_0xbc10('0xe'),_0x3050df,_0x1c1fd3[_0xbc10('0x11')][_0xbc10('0x13')]);return _0x17390e(_0x1c1fd3[_0xbc10('0x11')][_0xbc10('0x13')]);}else{logger['info']('DeskAccount,\x20%s,\x20%s',_0x3050df,_0xbc10('0xf'));_0x17390e(_0x1c1fd3[_0xbc10('0x14')]['message']);}})['catch'](function(_0xe3eb6){logger[_0xbc10('0x11')]('DeskAccount,\x20%s,\x20%s',_0x3050df,_0xe3eb6);_0x1859cc(_0xe3eb6);});});}exports[_0xbc10('0x15')]=function(_0x4cc9bb){var _0xe5165f=this;return new Promise(function(_0x559ef6,_0x47551e){return db['DeskAccount'][_0xbc10('0x16')]({'raw':_0x4cc9bb[_0xbc10('0x17')]?_0x4cc9bb[_0xbc10('0x17')][_0xbc10('0x18')]===undefined?!![]:![]:!![],'where':_0x4cc9bb[_0xbc10('0x17')]?_0x4cc9bb[_0xbc10('0x17')]['where']||null:null,'attributes':_0x4cc9bb[_0xbc10('0x17')]?_0x4cc9bb['options'][_0xbc10('0x19')]||null:null,'limit':_0x4cc9bb[_0xbc10('0x17')]?_0x4cc9bb[_0xbc10('0x17')][_0xbc10('0x1a')]||null:null,'include':_0x4cc9bb[_0xbc10('0x17')]?_0x4cc9bb[_0xbc10('0x17')][_0xbc10('0x1b')]?_[_0xbc10('0x1c')](_0x4cc9bb[_0xbc10('0x17')][_0xbc10('0x1b')],function(_0x29f7f0){return{'model':db[_0x29f7f0['model']],'as':_0x29f7f0['as'],'attributes':_0x29f7f0['attributes'],'include':_0x29f7f0[_0xbc10('0x1b')]?_[_0xbc10('0x1c')](_0x29f7f0['include'],function(_0x20eb49){return{'model':db[_0x20eb49[_0xbc10('0x1d')]],'as':_0x20eb49['as'],'attributes':_0x20eb49[_0xbc10('0x19')],'include':_0x20eb49[_0xbc10('0x1b')]?_[_0xbc10('0x1c')](_0x20eb49['include'],function(_0x550fd7){return{'model':db[_0x550fd7[_0xbc10('0x1d')]],'as':_0x550fd7['as'],'attributes':_0x550fd7[_0xbc10('0x19')]};}):[]};}):[]};}):[]:[]})[_0xbc10('0xd')](function(_0x585ba8){logger[_0xbc10('0x1e')]('GetDeskAccount',_0x4cc9bb);logger[_0xbc10('0x1f')](_0xbc10('0x15'),_0x4cc9bb,JSON['stringify'](_0x585ba8));_0x559ef6(_0x585ba8);})[_0xbc10('0x20')](function(_0xeb5f1b){logger[_0xbc10('0x11')](_0xbc10('0x15'),_0xeb5f1b[_0xbc10('0x13')],_0x4cc9bb);_0x47551e(_0xe5165f[_0xbc10('0x11')](0x1f4,_0xeb5f1b[_0xbc10('0x13')]));});});};exports[_0xbc10('0x21')]=function(_0x5e16ad){var _0x5f2bf8=this;return new Promise(function(_0x271c55,_0x62f192){return db[_0xbc10('0x22')][_0xbc10('0x23')]({'raw':_0x5e16ad[_0xbc10('0x17')]?_0x5e16ad[_0xbc10('0x17')][_0xbc10('0x18')]===undefined?!![]:![]:!![],'where':_0x5e16ad[_0xbc10('0x17')]?_0x5e16ad[_0xbc10('0x17')][_0xbc10('0x24')]||null:null,'attributes':_0x5e16ad[_0xbc10('0x17')]?_0x5e16ad[_0xbc10('0x17')][_0xbc10('0x19')]||null:null,'include':_0x5e16ad[_0xbc10('0x17')]?_0x5e16ad['options'][_0xbc10('0x1b')]?_[_0xbc10('0x1c')](_0x5e16ad[_0xbc10('0x17')][_0xbc10('0x1b')],function(_0x30e232){return{'model':db[_0x30e232['model']],'as':_0x30e232['as'],'attributes':_0x30e232[_0xbc10('0x19')],'include':_0x30e232[_0xbc10('0x1b')]?_[_0xbc10('0x1c')](_0x30e232[_0xbc10('0x1b')],function(_0x47a2e8){return{'model':db[_0x47a2e8['model']],'as':_0x47a2e8['as'],'attributes':_0x47a2e8[_0xbc10('0x19')],'include':_0x47a2e8[_0xbc10('0x1b')]?_[_0xbc10('0x1c')](_0x47a2e8[_0xbc10('0x1b')],function(_0x52c6f0){return{'model':db[_0x52c6f0['model']],'as':_0x52c6f0['as'],'attributes':_0x52c6f0[_0xbc10('0x19')]};}):[]};}):[]};}):[]:[]})[_0xbc10('0xd')](function(_0xce2a54){logger['info'](_0xbc10('0x21'),_0x5e16ad);logger['debug']('ShowDeskAccount',_0x5e16ad,JSON[_0xbc10('0x10')](_0xce2a54));_0x271c55(_0xce2a54);})[_0xbc10('0x20')](function(_0x55b4d8){logger[_0xbc10('0x11')](_0xbc10('0x21'),_0x55b4d8[_0xbc10('0x13')],_0x5e16ad);_0x62f192(_0x5f2bf8[_0xbc10('0x11')](0x1f4,_0x55b4d8[_0xbc10('0x13')]));});});}; \ No newline at end of file +var _0x4295=['DeskAccount','options','raw','attributes','limit','include','map','model','ShowDeskAccount','find','where','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client','then','DeskAccount,\x20%s,\x20%s','debug','DeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','GetDeskAccount'];(function(_0x339d21,_0x585c40){var _0x549bbd=function(_0x29266d){while(--_0x29266d){_0x339d21['push'](_0x339d21['shift']());}};_0x549bbd(++_0x585c40);}(_0x4295,0x15f));var _0x5429=function(_0x1f6ba3,_0x5b7a1d){_0x1f6ba3=_0x1f6ba3-0x0;var _0x218b24=_0x4295[_0x1f6ba3];return _0x218b24;};'use strict';var _=require(_0x5429('0x0'));var util=require(_0x5429('0x1'));var moment=require(_0x5429('0x2'));var BPromise=require(_0x5429('0x3'));var rs=require(_0x5429('0x4'));var fs=require('fs');var Redis=require(_0x5429('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x5429('0x6'));var logger=require(_0x5429('0x7'))('rpc');var config=require(_0x5429('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x5429('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3357b9,_0x9efb1d,_0x304bbd){return new BPromise(function(_0x5cf21e,_0x15cef2){return client['request'](_0x3357b9,_0x304bbd)[_0x5429('0xa')](function(_0x36a019){logger['info'](_0x5429('0xb'),_0x9efb1d,'request\x20sent');logger[_0x5429('0xc')](_0x5429('0xd'),_0x9efb1d,_0x5429('0xe'),JSON[_0x5429('0xf')](_0x36a019));if(_0x36a019[_0x5429('0x10')]){if(_0x36a019['error'][_0x5429('0x11')]===0x1f4){logger['error'](_0x5429('0xb'),_0x9efb1d,_0x36a019[_0x5429('0x10')][_0x5429('0x12')]);return _0x15cef2(_0x36a019[_0x5429('0x10')][_0x5429('0x12')]);}logger[_0x5429('0x10')](_0x5429('0xb'),_0x9efb1d,_0x36a019[_0x5429('0x10')][_0x5429('0x12')]);return _0x5cf21e(_0x36a019[_0x5429('0x10')][_0x5429('0x12')]);}else{logger[_0x5429('0x13')](_0x5429('0xb'),_0x9efb1d,'request\x20sent');_0x5cf21e(_0x36a019[_0x5429('0x14')][_0x5429('0x12')]);}})[_0x5429('0x15')](function(_0x1f3517){logger[_0x5429('0x10')]('DeskAccount,\x20%s,\x20%s',_0x9efb1d,_0x1f3517);_0x15cef2(_0x1f3517);});});}exports[_0x5429('0x16')]=function(_0x45ea92){var _0x5f07b6=this;return new Promise(function(_0x49da08,_0x14934d){return db[_0x5429('0x17')]['findAll']({'raw':_0x45ea92['options']?_0x45ea92[_0x5429('0x18')][_0x5429('0x19')]===undefined?!![]:![]:!![],'where':_0x45ea92['options']?_0x45ea92['options']['where']||null:null,'attributes':_0x45ea92[_0x5429('0x18')]?_0x45ea92[_0x5429('0x18')][_0x5429('0x1a')]||null:null,'limit':_0x45ea92['options']?_0x45ea92[_0x5429('0x18')][_0x5429('0x1b')]||null:null,'include':_0x45ea92[_0x5429('0x18')]?_0x45ea92[_0x5429('0x18')][_0x5429('0x1c')]?_[_0x5429('0x1d')](_0x45ea92['options'][_0x5429('0x1c')],function(_0x1f3a6d){return{'model':db[_0x1f3a6d[_0x5429('0x1e')]],'as':_0x1f3a6d['as'],'attributes':_0x1f3a6d['attributes'],'include':_0x1f3a6d[_0x5429('0x1c')]?_[_0x5429('0x1d')](_0x1f3a6d[_0x5429('0x1c')],function(_0x11b606){return{'model':db[_0x11b606['model']],'as':_0x11b606['as'],'attributes':_0x11b606[_0x5429('0x1a')],'include':_0x11b606[_0x5429('0x1c')]?_[_0x5429('0x1d')](_0x11b606[_0x5429('0x1c')],function(_0x17680d){return{'model':db[_0x17680d[_0x5429('0x1e')]],'as':_0x17680d['as'],'attributes':_0x17680d[_0x5429('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x43ef43){logger[_0x5429('0x13')](_0x5429('0x16'),_0x45ea92);logger[_0x5429('0xc')](_0x5429('0x16'),_0x45ea92,JSON['stringify'](_0x43ef43));_0x49da08(_0x43ef43);})[_0x5429('0x15')](function(_0x3dc763){logger[_0x5429('0x10')](_0x5429('0x16'),_0x3dc763[_0x5429('0x12')],_0x45ea92);_0x14934d(_0x5f07b6['error'](0x1f4,_0x3dc763['message']));});});};exports[_0x5429('0x1f')]=function(_0x32e2a2){var _0x16e7f2=this;return new Promise(function(_0x2c8ca0,_0x4d17e3){return db['DeskAccount'][_0x5429('0x20')]({'raw':_0x32e2a2[_0x5429('0x18')]?_0x32e2a2[_0x5429('0x18')][_0x5429('0x19')]===undefined?!![]:![]:!![],'where':_0x32e2a2[_0x5429('0x18')]?_0x32e2a2[_0x5429('0x18')][_0x5429('0x21')]||null:null,'attributes':_0x32e2a2[_0x5429('0x18')]?_0x32e2a2[_0x5429('0x18')]['attributes']||null:null,'include':_0x32e2a2[_0x5429('0x18')]?_0x32e2a2[_0x5429('0x18')]['include']?_[_0x5429('0x1d')](_0x32e2a2[_0x5429('0x18')][_0x5429('0x1c')],function(_0x4d43c0){return{'model':db[_0x4d43c0['model']],'as':_0x4d43c0['as'],'attributes':_0x4d43c0[_0x5429('0x1a')],'include':_0x4d43c0[_0x5429('0x1c')]?_[_0x5429('0x1d')](_0x4d43c0[_0x5429('0x1c')],function(_0x26cc18){return{'model':db[_0x26cc18['model']],'as':_0x26cc18['as'],'attributes':_0x26cc18[_0x5429('0x1a')],'include':_0x26cc18[_0x5429('0x1c')]?_[_0x5429('0x1d')](_0x26cc18['include'],function(_0x50bfe0){return{'model':db[_0x50bfe0[_0x5429('0x1e')]],'as':_0x50bfe0['as'],'attributes':_0x50bfe0['attributes']};}):[]};}):[]};}):[]:[]})[_0x5429('0xa')](function(_0xc0a2b0){logger[_0x5429('0x13')](_0x5429('0x1f'),_0x32e2a2);logger[_0x5429('0xc')]('ShowDeskAccount',_0x32e2a2,JSON['stringify'](_0xc0a2b0));_0x2c8ca0(_0xc0a2b0);})[_0x5429('0x15')](function(_0x1c87e3){logger['error'](_0x5429('0x1f'),_0x1c87e3['message'],_0x32e2a2);_0x4d17e3(_0x16e7f2[_0x5429('0x10')](0x1f4,_0x1c87e3['message']));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index 3a50569..a57b89b 100644 --- a/server/api/intDeskConfiguration/index.js +++ b/server/api/intDeskConfiguration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x55ca=['../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','setTags','put','/:id','update','destroy','exports','multer','util','Router','fs-extra','../../components/interaction/service'];(function(_0x19e928,_0x26a0e4){var _0x4e941f=function(_0x52a5cd){while(--_0x52a5cd){_0x19e928['push'](_0x19e928['shift']());}};_0x4e941f(++_0x26a0e4);}(_0x55ca,0x126));var _0xa55c=function(_0x1a663e,_0x357c47){_0x1a663e=_0x1a663e-0x0;var _0x4055ab=_0x55ca[_0x1a663e];return _0x4055ab;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var fs_extra=require(_0xa55c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var controller=require(_0xa55c('0x6'));router[_0xa55c('0x7')]('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0x9')]);router[_0xa55c('0x7')]('/:id',auth[_0xa55c('0x8')](),controller[_0xa55c('0xa')]);router['get'](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller['getFields']);router['get'](_0xa55c('0xc'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xd')]);router[_0xa55c('0x7')](_0xa55c('0xe'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xf')]);router[_0xa55c('0x7')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller['getTags']);router['post']('/',auth[_0xa55c('0x8')](),controller['create']);router['post']('/:id/tags',auth[_0xa55c('0x8')](),controller[_0xa55c('0x11')]);router[_0xa55c('0x12')](_0xa55c('0x13'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x14')]);router['delete'](_0xa55c('0x13'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x15')]);module[_0xa55c('0x16')]=router; \ No newline at end of file +var _0x55ca=['../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','setTags','put','/:id','update','destroy','exports','multer','util','Router','fs-extra','../../components/interaction/service'];(function(_0x2b305c,_0x5ae303){var _0x5d8c85=function(_0x33129f){while(--_0x33129f){_0x2b305c['push'](_0x2b305c['shift']());}};_0x5d8c85(++_0x5ae303);}(_0x55ca,0x126));var _0xa55c=function(_0x2794e4,_0x11bcf6){_0x2794e4=_0x2794e4-0x0;var _0xf860d4=_0x55ca[_0x2794e4];return _0xf860d4;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var fs_extra=require(_0xa55c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var controller=require(_0xa55c('0x6'));router[_0xa55c('0x7')]('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0x9')]);router[_0xa55c('0x7')]('/:id',auth[_0xa55c('0x8')](),controller[_0xa55c('0xa')]);router['get'](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller['getFields']);router['get'](_0xa55c('0xc'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xd')]);router[_0xa55c('0x7')](_0xa55c('0xe'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xf')]);router[_0xa55c('0x7')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller['getTags']);router['post']('/',auth[_0xa55c('0x8')](),controller['create']);router['post']('/:id/tags',auth[_0xa55c('0x8')](),controller[_0xa55c('0x11')]);router[_0xa55c('0x12')](_0xa55c('0x13'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x14')]);router['delete'](_0xa55c('0x13'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x15')]);module[_0xa55c('0x16')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index 5b65a7f..df88bbf 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 _0xe139=['sequelize','STRING'];(function(_0x61725a,_0x16e673){var _0x348a90=function(_0x2faa0c){while(--_0x2faa0c){_0x61725a['push'](_0x61725a['shift']());}};_0x348a90(++_0x16e673);}(_0xe139,0x18a));var _0x9e13=function(_0x2faa08,_0xa5a3e){_0x2faa08=_0x2faa08-0x0;var _0x5f3d00=_0xe139[_0x2faa08];return _0x5f3d00;};'use strict';var Sequelize=require(_0x9e13('0x0'));module['exports']={'name':{'type':Sequelize[_0x9e13('0x1')]},'description':{'type':Sequelize[_0x9e13('0x1')]}}; \ No newline at end of file +var _0x2eb5=['STRING','sequelize','exports'];(function(_0x2d1c7a,_0x541663){var _0x7cd040=function(_0x586859){while(--_0x586859){_0x2d1c7a['push'](_0x2d1c7a['shift']());}};_0x7cd040(++_0x541663);}(_0x2eb5,0x1c9));var _0x52eb=function(_0x47cb3d,_0xeea136){_0x47cb3d=_0x47cb3d-0x0;var _0x429868=_0x2eb5[_0x47cb3d];return _0x429868;};'use strict';var Sequelize=require(_0x52eb('0x0'));module[_0x52eb('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x52eb('0x2')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index 8ce887d..614d60e 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 _0xa1ec=['fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','show','params','find','catch','create','body','getFields','DeskField','hasOwnProperty','getSubjects','findOne','getDescriptions','getTags','ids','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','destroy','error','stack','name','index','map','DeskConfiguration','rawAttributes'];(function(_0xb3284d,_0x5f07b0){var _0x2ea499=function(_0x1c50d7){while(--_0x1c50d7){_0xb3284d['push'](_0xb3284d['shift']());}};_0x2ea499(++_0x5f07b0);}(_0xa1ec,0x17d));var _0xca1e=function(_0x42cac2,_0x2e68bc){_0x42cac2=_0x42cac2-0x0;var _0x54401c=_0xa1ec[_0x42cac2];return _0x54401c;};'use strict';var emlformat=require(_0xca1e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xca1e('0x1'));var jsonpatch=require(_0xca1e('0x2'));var rp=require(_0xca1e('0x3'));var moment=require(_0xca1e('0x4'));var BPromise=require(_0xca1e('0x5'));var Mustache=require(_0xca1e('0x6'));var util=require(_0xca1e('0x7'));var path=require(_0xca1e('0x8'));var sox=require(_0xca1e('0x9'));var csv=require(_0xca1e('0xa'));var ejs=require(_0xca1e('0xb'));var fs=require('fs');var fs_extra=require(_0xca1e('0xc'));var _=require(_0xca1e('0xd'));var squel=require(_0xca1e('0xe'));var crypto=require(_0xca1e('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xca1e('0x10'));var toCsv=require('to-csv');var querystring=require(_0xca1e('0x11'));var Papa=require(_0xca1e('0x12'));var Redis=require(_0xca1e('0x13'));var authService=require(_0xca1e('0x14'));var qs=require(_0xca1e('0x15'));var as=require(_0xca1e('0x16'));var hardwareService=require(_0xca1e('0x17'));var logger=require(_0xca1e('0x18'))(_0xca1e('0x19'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xca1e('0x1a'));var db=require(_0xca1e('0x1b'))['db'];function respondWithStatusCode(_0x2a3f80,_0x451a6e){_0x451a6e=_0x451a6e||0xcc;return function(_0x2ab1c8){if(_0x2ab1c8){return _0x2a3f80['sendStatus'](_0x451a6e);}return _0x2a3f80['status'](_0x451a6e)[_0xca1e('0x1c')]();};}function respondWithResult(_0x223aa4,_0x20e70e){_0x20e70e=_0x20e70e||0xc8;return function(_0x52a0d2){if(_0x52a0d2){return _0x223aa4[_0xca1e('0x1d')](_0x20e70e)[_0xca1e('0x1e')](_0x52a0d2);}};}function respondWithFilteredResult(_0x5580ec,_0x27a83d){return function(_0x228aa4){if(_0x228aa4){var _0x53e94f=typeof _0x27a83d[_0xca1e('0x1f')]===_0xca1e('0x20')&&typeof _0x27a83d['limit']==='undefined';var _0x50109a=_0x228aa4[_0xca1e('0x21')];var _0x2583db=_0x53e94f?0x0:_0x27a83d[_0xca1e('0x1f')];var _0x5b8745=_0x53e94f?_0x228aa4[_0xca1e('0x21')]:_0x27a83d[_0xca1e('0x1f')]+_0x27a83d[_0xca1e('0x22')];var _0x359faa;if(_0x5b8745>=_0x50109a){_0x5b8745=_0x50109a;_0x359faa=0xc8;}else{_0x359faa=0xce;}_0x5580ec[_0xca1e('0x1d')](_0x359faa);return _0x5580ec[_0xca1e('0x23')](_0xca1e('0x24'),_0x2583db+'-'+_0x5b8745+'/'+_0x50109a)[_0xca1e('0x1e')](_0x228aa4);}return null;};}function patchUpdates(_0x90783e){return function(_0x38a260){try{jsonpatch[_0xca1e('0x25')](_0x38a260,_0x90783e,!![]);}catch(_0x304d7a){return BPromise['reject'](_0x304d7a);}return _0x38a260[_0xca1e('0x26')]();};}function saveUpdates(_0x4db09b,_0x5a04dd){return function(_0x3ec355){if(_0x3ec355){return _0x3ec355[_0xca1e('0x27')](_0x4db09b)[_0xca1e('0x28')](function(_0x3cc80b){return _0x3cc80b;});}return null;};}function removeEntity(_0x4f86c0,_0x3d0353){return function(_0x3b32af){if(_0x3b32af){return _0x3b32af[_0xca1e('0x29')]()['then'](function(){_0x4f86c0['status'](0xcc)[_0xca1e('0x1c')]();});}};}function handleEntityNotFound(_0x1b652b,_0x141acd){return function(_0x7ce061){if(!_0x7ce061){_0x1b652b['sendStatus'](0x194);}return _0x7ce061;};}function handleError(_0x278441,_0x303aa7){_0x303aa7=_0x303aa7||0x1f4;return function(_0xde387e){logger[_0xca1e('0x2a')](_0xde387e[_0xca1e('0x2b')]);if(_0xde387e['name']){delete _0xde387e[_0xca1e('0x2c')];}_0x278441[_0xca1e('0x1d')](_0x303aa7)['send'](_0xde387e);};}exports[_0xca1e('0x2d')]=function(_0x4bdfbb,_0x2c4d56){var _0x1187e5={},_0x4403dd={},_0x2c15d3={'count':0x0,'rows':[]};var _0x3684d3=_[_0xca1e('0x2e')](db[_0xca1e('0x2f')][_0xca1e('0x30')],function(_0x2b1b82){return{'name':_0x2b1b82[_0xca1e('0x31')],'type':_0x2b1b82[_0xca1e('0x32')][_0xca1e('0x33')]};});_0x4403dd[_0xca1e('0x34')]=_['map'](_0x3684d3,_0xca1e('0x2c'));_0x4403dd[_0xca1e('0x35')]=_[_0xca1e('0x36')](_0x4bdfbb['query']);_0x4403dd[_0xca1e('0x37')]=_['intersection'](_0x4403dd[_0xca1e('0x34')],_0x4403dd[_0xca1e('0x35')]);_0x1187e5['attributes']=_[_0xca1e('0x38')](_0x4403dd['model'],qs[_0xca1e('0x39')](_0x4bdfbb[_0xca1e('0x35')]['fields']));_0x1187e5[_0xca1e('0x3a')]=_0x1187e5[_0xca1e('0x3a')][_0xca1e('0x3b')]?_0x1187e5[_0xca1e('0x3a')]:_0x4403dd[_0xca1e('0x34')];if(!_0x4bdfbb[_0xca1e('0x35')]['hasOwnProperty'](_0xca1e('0x3c'))){_0x1187e5[_0xca1e('0x22')]=qs[_0xca1e('0x22')](_0x4bdfbb[_0xca1e('0x35')][_0xca1e('0x22')]);_0x1187e5[_0xca1e('0x1f')]=qs[_0xca1e('0x1f')](_0x4bdfbb[_0xca1e('0x35')][_0xca1e('0x1f')]);}_0x1187e5[_0xca1e('0x3d')]=qs[_0xca1e('0x3e')](_0x4bdfbb[_0xca1e('0x35')]['sort']);_0x1187e5[_0xca1e('0x3f')]=qs[_0xca1e('0x37')](_[_0xca1e('0x40')](_0x4bdfbb['query'],_0x4403dd['filters']),_0x3684d3);if(_0x4bdfbb['query']['filter']){_0x1187e5[_0xca1e('0x3f')]=_['merge'](_0x1187e5[_0xca1e('0x3f')],{'$or':_[_0xca1e('0x2e')](_0x3684d3,function(_0x3d0a71){if(_0x3d0a71['type']!==_0xca1e('0x41')){var _0x32f725={};_0x32f725[_0x3d0a71['name']]={'$like':'%'+_0x4bdfbb[_0xca1e('0x35')][_0xca1e('0x42')]+'%'};return _0x32f725;}})});}_0x1187e5=_[_0xca1e('0x43')]({},_0x1187e5,_0x4bdfbb[_0xca1e('0x44')]);var _0x22c41f={'where':_0x1187e5['where']};return db[_0xca1e('0x2f')][_0xca1e('0x21')](_0x22c41f)[_0xca1e('0x28')](function(_0x3f2353){_0x2c15d3[_0xca1e('0x21')]=_0x3f2353;if(_0x4bdfbb[_0xca1e('0x35')][_0xca1e('0x45')]){_0x1187e5[_0xca1e('0x46')]=[{'all':!![]}];}return db[_0xca1e('0x2f')][_0xca1e('0x47')](_0x1187e5);})[_0xca1e('0x28')](function(_0x20dda6){_0x2c15d3['rows']=_0x20dda6;return _0x2c15d3;})[_0xca1e('0x28')](respondWithFilteredResult(_0x2c4d56,_0x1187e5))['catch'](handleError(_0x2c4d56,null));};exports[_0xca1e('0x48')]=function(_0x2bb76f,_0x3907cc){var _0x32c091={'raw':![],'where':{'id':_0x2bb76f[_0xca1e('0x49')]['id']}},_0x5eda70={};_0x5eda70[_0xca1e('0x34')]=_['keys'](db[_0xca1e('0x2f')]['rawAttributes']);_0x5eda70[_0xca1e('0x35')]=_[_0xca1e('0x36')](_0x2bb76f[_0xca1e('0x35')]);_0x5eda70[_0xca1e('0x37')]=_[_0xca1e('0x38')](_0x5eda70['model'],_0x5eda70['query']);_0x32c091[_0xca1e('0x3a')]=_['intersection'](_0x5eda70[_0xca1e('0x34')],qs[_0xca1e('0x39')](_0x2bb76f[_0xca1e('0x35')][_0xca1e('0x39')]));_0x32c091[_0xca1e('0x3a')]=_0x32c091[_0xca1e('0x3a')][_0xca1e('0x3b')]?_0x32c091[_0xca1e('0x3a')]:_0x5eda70['model'];if(_0x2bb76f[_0xca1e('0x35')][_0xca1e('0x45')]){_0x32c091[_0xca1e('0x46')]=[{'all':!![]}];}_0x32c091=_[_0xca1e('0x43')]({},_0x32c091,_0x2bb76f['options']);return db[_0xca1e('0x2f')][_0xca1e('0x4a')](_0x32c091)[_0xca1e('0x28')](handleEntityNotFound(_0x3907cc,null))[_0xca1e('0x28')](respondWithResult(_0x3907cc,null))[_0xca1e('0x4b')](handleError(_0x3907cc,null));};exports[_0xca1e('0x4c')]=function(_0x2cdbb0,_0x5dbc48){return db[_0xca1e('0x2f')][_0xca1e('0x4c')](_0x2cdbb0[_0xca1e('0x4d')],{})[_0xca1e('0x28')](respondWithResult(_0x5dbc48,0xc9))[_0xca1e('0x4b')](handleError(_0x5dbc48,null));};exports[_0xca1e('0x27')]=function(_0x349bb7,_0x1889d8){if(_0x349bb7['body']['id']){delete _0x349bb7[_0xca1e('0x4d')]['id'];}return db[_0xca1e('0x2f')][_0xca1e('0x4a')]({'where':{'id':_0x349bb7[_0xca1e('0x49')]['id']}})[_0xca1e('0x28')](handleEntityNotFound(_0x1889d8,null))[_0xca1e('0x28')](saveUpdates(_0x349bb7['body'],null))[_0xca1e('0x28')](respondWithResult(_0x1889d8,null))['catch'](handleError(_0x1889d8,null));};exports[_0xca1e('0x29')]=function(_0x44cc5f,_0x33f08c){return db[_0xca1e('0x2f')][_0xca1e('0x4a')]({'where':{'id':_0x44cc5f[_0xca1e('0x49')]['id']}})[_0xca1e('0x28')](handleEntityNotFound(_0x33f08c,null))['then'](removeEntity(_0x33f08c,null))[_0xca1e('0x4b')](handleError(_0x33f08c,null));};exports[_0xca1e('0x4e')]=function(_0x109a13,_0x1618ea,_0x3ceaea){var _0x29dcb5={};var _0x185ae7={};var _0x5be9b3;var _0xfd4aa7;return db['DeskConfiguration']['findOne']({'where':{'id':_0x109a13[_0xca1e('0x49')]['id']}})[_0xca1e('0x28')](handleEntityNotFound(_0x1618ea,null))[_0xca1e('0x28')](function(_0x36095c){if(_0x36095c){_0x5be9b3=_0x36095c;_0x185ae7['model']=_[_0xca1e('0x36')](db[_0xca1e('0x4f')][_0xca1e('0x30')]);_0x185ae7[_0xca1e('0x35')]=_[_0xca1e('0x36')](_0x109a13['query']);_0x185ae7[_0xca1e('0x37')]=_[_0xca1e('0x38')](_0x185ae7[_0xca1e('0x34')],_0x185ae7[_0xca1e('0x35')]);_0x29dcb5[_0xca1e('0x3a')]=_[_0xca1e('0x38')](_0x185ae7[_0xca1e('0x34')],qs[_0xca1e('0x39')](_0x109a13[_0xca1e('0x35')][_0xca1e('0x39')]));_0x29dcb5['attributes']=_0x29dcb5['attributes'][_0xca1e('0x3b')]?_0x29dcb5[_0xca1e('0x3a')]:_0x185ae7[_0xca1e('0x34')];_0x29dcb5[_0xca1e('0x3d')]=qs[_0xca1e('0x3e')](_0x109a13[_0xca1e('0x35')][_0xca1e('0x3e')]);_0x29dcb5['where']=qs[_0xca1e('0x37')](_[_0xca1e('0x40')](_0x109a13[_0xca1e('0x35')],_0x185ae7[_0xca1e('0x37')]));if(_0x109a13[_0xca1e('0x35')][_0xca1e('0x42')]){_0x29dcb5['where']=_['merge'](_0x29dcb5['where'],{'$or':_[_0xca1e('0x2e')](_0x29dcb5['attributes'],function(_0x2e21e0){var _0x1b824b={};_0x1b824b[_0x2e21e0]={'$like':'%'+_0x109a13[_0xca1e('0x35')][_0xca1e('0x42')]+'%'};return _0x1b824b;})});}_0x29dcb5=_[_0xca1e('0x43')]({},_0x29dcb5,_0x109a13[_0xca1e('0x44')]);return _0x5be9b3[_0xca1e('0x4e')](_0x29dcb5);}})[_0xca1e('0x28')](function(_0x20a851){if(_0x20a851){_0xfd4aa7=_0x20a851[_0xca1e('0x3b')];if(!_0x109a13[_0xca1e('0x35')][_0xca1e('0x50')](_0xca1e('0x3c'))){_0x29dcb5[_0xca1e('0x22')]=qs[_0xca1e('0x22')](_0x109a13[_0xca1e('0x35')][_0xca1e('0x22')]);_0x29dcb5[_0xca1e('0x1f')]=qs['offset'](_0x109a13['query'][_0xca1e('0x1f')]);}return _0x5be9b3['getFields'](_0x29dcb5);}})[_0xca1e('0x28')](function(_0x4a0c0c){if(_0x4a0c0c){return _0x4a0c0c?{'count':_0xfd4aa7,'rows':_0x4a0c0c}:null;}})[_0xca1e('0x28')](respondWithResult(_0x1618ea,null))[_0xca1e('0x4b')](handleError(_0x1618ea,null));};exports[_0xca1e('0x51')]=function(_0x4eb4b5,_0x39d933,_0x1b3452){var _0x419265={};var _0x4ba910={};var _0x2425d9;var _0x59be92;return db['DeskConfiguration'][_0xca1e('0x52')]({'where':{'id':_0x4eb4b5[_0xca1e('0x49')]['id']}})[_0xca1e('0x28')](handleEntityNotFound(_0x39d933,null))[_0xca1e('0x28')](function(_0x1a43d6){if(_0x1a43d6){_0x2425d9=_0x1a43d6;_0x4ba910['model']=_[_0xca1e('0x36')](db[_0xca1e('0x4f')]['rawAttributes']);_0x4ba910[_0xca1e('0x35')]=_['keys'](_0x4eb4b5['query']);_0x4ba910[_0xca1e('0x37')]=_[_0xca1e('0x38')](_0x4ba910[_0xca1e('0x34')],_0x4ba910[_0xca1e('0x35')]);_0x419265[_0xca1e('0x3a')]=_[_0xca1e('0x38')](_0x4ba910[_0xca1e('0x34')],qs['fields'](_0x4eb4b5[_0xca1e('0x35')][_0xca1e('0x39')]));_0x419265[_0xca1e('0x3a')]=_0x419265[_0xca1e('0x3a')]['length']?_0x419265[_0xca1e('0x3a')]:_0x4ba910[_0xca1e('0x34')];_0x419265[_0xca1e('0x3d')]=qs[_0xca1e('0x3e')](_0x4eb4b5['query'][_0xca1e('0x3e')]);_0x419265['where']=qs[_0xca1e('0x37')](_[_0xca1e('0x40')](_0x4eb4b5[_0xca1e('0x35')],_0x4ba910[_0xca1e('0x37')]));if(_0x4eb4b5['query'][_0xca1e('0x42')]){_0x419265[_0xca1e('0x3f')]=_[_0xca1e('0x43')](_0x419265[_0xca1e('0x3f')],{'$or':_['map'](_0x419265[_0xca1e('0x3a')],function(_0x52564a){var _0x24da22={};_0x24da22[_0x52564a]={'$like':'%'+_0x4eb4b5['query']['filter']+'%'};return _0x24da22;})});}_0x419265=_[_0xca1e('0x43')]({},_0x419265,_0x4eb4b5['options']);return _0x2425d9['getSubjects'](_0x419265);}})[_0xca1e('0x28')](function(_0xcf7fdb){if(_0xcf7fdb){_0x59be92=_0xcf7fdb[_0xca1e('0x3b')];if(!_0x4eb4b5[_0xca1e('0x35')]['hasOwnProperty']('nolimit')){_0x419265[_0xca1e('0x22')]=qs[_0xca1e('0x22')](_0x4eb4b5[_0xca1e('0x35')]['limit']);_0x419265[_0xca1e('0x1f')]=qs[_0xca1e('0x1f')](_0x4eb4b5['query'][_0xca1e('0x1f')]);}return _0x2425d9['getSubjects'](_0x419265);}})[_0xca1e('0x28')](function(_0x105e7e){if(_0x105e7e){return _0x105e7e?{'count':_0x59be92,'rows':_0x105e7e}:null;}})[_0xca1e('0x28')](respondWithResult(_0x39d933,null))[_0xca1e('0x4b')](handleError(_0x39d933,null));};exports[_0xca1e('0x53')]=function(_0x48bcda,_0x368ca6,_0x53b9af){var _0x30a337={};var _0xaf4fd4={};var _0x994c31;var _0x22a3e6;return db[_0xca1e('0x2f')][_0xca1e('0x52')]({'where':{'id':_0x48bcda[_0xca1e('0x49')]['id']}})[_0xca1e('0x28')](handleEntityNotFound(_0x368ca6,null))[_0xca1e('0x28')](function(_0x3f01b9){if(_0x3f01b9){_0x994c31=_0x3f01b9;_0xaf4fd4[_0xca1e('0x34')]=_[_0xca1e('0x36')](db[_0xca1e('0x4f')][_0xca1e('0x30')]);_0xaf4fd4[_0xca1e('0x35')]=_['keys'](_0x48bcda[_0xca1e('0x35')]);_0xaf4fd4[_0xca1e('0x37')]=_[_0xca1e('0x38')](_0xaf4fd4['model'],_0xaf4fd4['query']);_0x30a337[_0xca1e('0x3a')]=_['intersection'](_0xaf4fd4[_0xca1e('0x34')],qs[_0xca1e('0x39')](_0x48bcda[_0xca1e('0x35')]['fields']));_0x30a337[_0xca1e('0x3a')]=_0x30a337[_0xca1e('0x3a')][_0xca1e('0x3b')]?_0x30a337[_0xca1e('0x3a')]:_0xaf4fd4['model'];_0x30a337[_0xca1e('0x3d')]=qs[_0xca1e('0x3e')](_0x48bcda[_0xca1e('0x35')][_0xca1e('0x3e')]);_0x30a337[_0xca1e('0x3f')]=qs[_0xca1e('0x37')](_['pick'](_0x48bcda[_0xca1e('0x35')],_0xaf4fd4['filters']));if(_0x48bcda[_0xca1e('0x35')][_0xca1e('0x42')]){_0x30a337[_0xca1e('0x3f')]=_[_0xca1e('0x43')](_0x30a337['where'],{'$or':_[_0xca1e('0x2e')](_0x30a337[_0xca1e('0x3a')],function(_0x3d2735){var _0x4c227b={};_0x4c227b[_0x3d2735]={'$like':'%'+_0x48bcda[_0xca1e('0x35')][_0xca1e('0x42')]+'%'};return _0x4c227b;})});}_0x30a337=_[_0xca1e('0x43')]({},_0x30a337,_0x48bcda['options']);return _0x994c31[_0xca1e('0x53')](_0x30a337);}})[_0xca1e('0x28')](function(_0x173ff5){if(_0x173ff5){_0x22a3e6=_0x173ff5[_0xca1e('0x3b')];if(!_0x48bcda['query'][_0xca1e('0x50')](_0xca1e('0x3c'))){_0x30a337['limit']=qs[_0xca1e('0x22')](_0x48bcda[_0xca1e('0x35')][_0xca1e('0x22')]);_0x30a337[_0xca1e('0x1f')]=qs[_0xca1e('0x1f')](_0x48bcda[_0xca1e('0x35')]['offset']);}return _0x994c31['getDescriptions'](_0x30a337);}})[_0xca1e('0x28')](function(_0x44c31f){if(_0x44c31f){return _0x44c31f?{'count':_0x22a3e6,'rows':_0x44c31f}:null;}})[_0xca1e('0x28')](respondWithResult(_0x368ca6,null))[_0xca1e('0x4b')](handleError(_0x368ca6,null));};exports[_0xca1e('0x54')]=function(_0x2ac21a,_0x21baae,_0x5c381a){var _0x44959c={};var _0x1102eb={};var _0x30b6e0;var _0x3f0e7f;return db[_0xca1e('0x2f')]['findOne']({'where':{'id':_0x2ac21a[_0xca1e('0x49')]['id']}})['then'](handleEntityNotFound(_0x21baae,null))['then'](function(_0x2bf2ac){if(_0x2bf2ac){_0x30b6e0=_0x2bf2ac;_0x1102eb[_0xca1e('0x34')]=_[_0xca1e('0x36')](db['Tag'][_0xca1e('0x30')]);_0x1102eb[_0xca1e('0x35')]=_['keys'](_0x2ac21a[_0xca1e('0x35')]);_0x1102eb[_0xca1e('0x37')]=_[_0xca1e('0x38')](_0x1102eb[_0xca1e('0x34')],_0x1102eb[_0xca1e('0x35')]);_0x44959c[_0xca1e('0x3a')]=_[_0xca1e('0x38')](_0x1102eb['model'],qs[_0xca1e('0x39')](_0x2ac21a[_0xca1e('0x35')]['fields']));_0x44959c[_0xca1e('0x3a')]=_0x44959c[_0xca1e('0x3a')][_0xca1e('0x3b')]?_0x44959c['attributes']:_0x1102eb[_0xca1e('0x34')];_0x44959c['order']=qs[_0xca1e('0x3e')](_0x2ac21a[_0xca1e('0x35')][_0xca1e('0x3e')]);_0x44959c['where']=qs[_0xca1e('0x37')](_[_0xca1e('0x40')](_0x2ac21a['query'],_0x1102eb['filters']));if(_0x2ac21a['query']['filter']){_0x44959c[_0xca1e('0x3f')]=_[_0xca1e('0x43')](_0x44959c[_0xca1e('0x3f')],{'$or':_[_0xca1e('0x2e')](_0x44959c['attributes'],function(_0x4efd93){var _0x3f4dac={};_0x3f4dac[_0x4efd93]={'$like':'%'+_0x2ac21a['query'][_0xca1e('0x42')]+'%'};return _0x3f4dac;})});}_0x44959c=_[_0xca1e('0x43')]({},_0x44959c,_0x2ac21a[_0xca1e('0x44')]);return _0x30b6e0[_0xca1e('0x54')](_0x44959c);}})['then'](function(_0x2919a6){if(_0x2919a6){_0x3f0e7f=_0x2919a6[_0xca1e('0x3b')];if(!_0x2ac21a[_0xca1e('0x35')][_0xca1e('0x50')](_0xca1e('0x3c'))){_0x44959c['limit']=qs[_0xca1e('0x22')](_0x2ac21a[_0xca1e('0x35')][_0xca1e('0x22')]);_0x44959c[_0xca1e('0x1f')]=qs[_0xca1e('0x1f')](_0x2ac21a[_0xca1e('0x35')][_0xca1e('0x1f')]);}return _0x30b6e0[_0xca1e('0x54')](_0x44959c);}})['then'](function(_0x11da35){if(_0x11da35){return _0x11da35?{'count':_0x3f0e7f,'rows':_0x11da35}:null;}})[_0xca1e('0x28')](respondWithResult(_0x21baae,null))[_0xca1e('0x4b')](handleError(_0x21baae,null));};exports['setTags']=function(_0x312f77,_0x3c6f21,_0x103ef7){if(_0x312f77[_0xca1e('0x4d')]['id']){delete _0x312f77['body']['id'];}return db['DeskConfiguration'][_0xca1e('0x52')]({'where':{'id':_0x312f77[_0xca1e('0x49')]['id']}})[_0xca1e('0x28')](handleEntityNotFound(_0x3c6f21,null))[_0xca1e('0x28')](function(_0x1bc9c7){if(_0x1bc9c7){return _0x1bc9c7['setTags'](_0x312f77[_0xca1e('0x4d')][_0xca1e('0x55')]||[]);}return null;})[_0xca1e('0x28')](respondWithResult(_0x3c6f21,null))[_0xca1e('0x4b')](handleError(_0x3c6f21,null));}; \ No newline at end of file +var _0x9588=['fieldName','type','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','include','rows','show','DeskConfiguration','keys','includeAll','catch','create','body','find','params','findOne','DeskField','getFields','length','getSubjects','getDescriptions','getTags','setTags','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','then','destroy','sendStatus','error','name','send','map','rawAttributes'];(function(_0x10a788,_0x55bfcb){var _0x59e32d=function(_0x4ec16d){while(--_0x4ec16d){_0x10a788['push'](_0x10a788['shift']());}};_0x59e32d(++_0x55bfcb);}(_0x9588,0x121));var _0x8958=function(_0x449dda,_0x500a2f){_0x449dda=_0x449dda-0x0;var _0xa079dd=_0x9588[_0x449dda];return _0xa079dd;};'use strict';var emlformat=require(_0x8958('0x0'));var rimraf=require(_0x8958('0x1'));var zipdir=require(_0x8958('0x2'));var jsonpatch=require(_0x8958('0x3'));var rp=require('request-promise');var moment=require(_0x8958('0x4'));var BPromise=require(_0x8958('0x5'));var Mustache=require(_0x8958('0x6'));var util=require(_0x8958('0x7'));var path=require('path');var sox=require(_0x8958('0x8'));var csv=require(_0x8958('0x9'));var ejs=require(_0x8958('0xa'));var fs=require('fs');var fs_extra=require(_0x8958('0xb'));var _=require(_0x8958('0xc'));var squel=require(_0x8958('0xd'));var crypto=require(_0x8958('0xe'));var jsforce=require(_0x8958('0xf'));var deskjs=require(_0x8958('0x10'));var toCsv=require(_0x8958('0x9'));var querystring=require(_0x8958('0x11'));var Papa=require(_0x8958('0x12'));var Redis=require(_0x8958('0x13'));var authService=require(_0x8958('0x14'));var qs=require(_0x8958('0x15'));var as=require(_0x8958('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x8958('0x17'));var config=require(_0x8958('0x18'));var licenseUtil=require(_0x8958('0x19'));var db=require(_0x8958('0x1a'))['db'];function respondWithStatusCode(_0x452eca,_0x5bb040){_0x5bb040=_0x5bb040||0xcc;return function(_0x13e374){if(_0x13e374){return _0x452eca['sendStatus'](_0x5bb040);}return _0x452eca[_0x8958('0x1b')](_0x5bb040)[_0x8958('0x1c')]();};}function respondWithResult(_0x1ef1bd,_0x4caaa5){_0x4caaa5=_0x4caaa5||0xc8;return function(_0x42ec17){if(_0x42ec17){return _0x1ef1bd[_0x8958('0x1b')](_0x4caaa5)['json'](_0x42ec17);}};}function respondWithFilteredResult(_0x31a28d,_0xb5ff15){return function(_0x190bc4){if(_0x190bc4){var _0x87c3d5=typeof _0xb5ff15[_0x8958('0x1d')]===_0x8958('0x1e')&&typeof _0xb5ff15[_0x8958('0x1f')]===_0x8958('0x1e');var _0x2a03ed=_0x190bc4[_0x8958('0x20')];var _0x55cbed=_0x87c3d5?0x0:_0xb5ff15[_0x8958('0x1d')];var _0x433acd=_0x87c3d5?_0x190bc4[_0x8958('0x20')]:_0xb5ff15['offset']+_0xb5ff15[_0x8958('0x1f')];var _0x769954;if(_0x433acd>=_0x2a03ed){_0x433acd=_0x2a03ed;_0x769954=0xc8;}else{_0x769954=0xce;}_0x31a28d[_0x8958('0x1b')](_0x769954);return _0x31a28d[_0x8958('0x21')](_0x8958('0x22'),_0x55cbed+'-'+_0x433acd+'/'+_0x2a03ed)[_0x8958('0x23')](_0x190bc4);}return null;};}function patchUpdates(_0x3c9ad3){return function(_0x191178){try{jsonpatch[_0x8958('0x24')](_0x191178,_0x3c9ad3,!![]);}catch(_0x496695){return BPromise[_0x8958('0x25')](_0x496695);}return _0x191178[_0x8958('0x26')]();};}function saveUpdates(_0x217a5c,_0x2f8f9f){return function(_0x1e3e9a){if(_0x1e3e9a){return _0x1e3e9a['update'](_0x217a5c)[_0x8958('0x27')](function(_0x1ad913){return _0x1ad913;});}return null;};}function removeEntity(_0x144cbe,_0xf54633){return function(_0x4c3132){if(_0x4c3132){return _0x4c3132[_0x8958('0x28')]()[_0x8958('0x27')](function(){_0x144cbe[_0x8958('0x1b')](0xcc)[_0x8958('0x1c')]();});}};}function handleEntityNotFound(_0x4fcdf7,_0x5da72a){return function(_0x14b708){if(!_0x14b708){_0x4fcdf7[_0x8958('0x29')](0x194);}return _0x14b708;};}function handleError(_0x3dbd19,_0x3bf10c){_0x3bf10c=_0x3bf10c||0x1f4;return function(_0x2498e8){logger[_0x8958('0x2a')](_0x2498e8['stack']);if(_0x2498e8[_0x8958('0x2b')]){delete _0x2498e8[_0x8958('0x2b')];}_0x3dbd19[_0x8958('0x1b')](_0x3bf10c)[_0x8958('0x2c')](_0x2498e8);};}exports['index']=function(_0x570f30,_0x5d12da){var _0x1530ee={},_0x34f2f1={},_0xfb599d={'count':0x0,'rows':[]};var _0x31ca8=_[_0x8958('0x2d')](db['DeskConfiguration'][_0x8958('0x2e')],function(_0x365f2f){return{'name':_0x365f2f[_0x8958('0x2f')],'type':_0x365f2f[_0x8958('0x30')]['key']};});_0x34f2f1[_0x8958('0x31')]=_['map'](_0x31ca8,_0x8958('0x2b'));_0x34f2f1[_0x8958('0x32')]=_['keys'](_0x570f30[_0x8958('0x32')]);_0x34f2f1['filters']=_[_0x8958('0x33')](_0x34f2f1[_0x8958('0x31')],_0x34f2f1[_0x8958('0x32')]);_0x1530ee[_0x8958('0x34')]=_[_0x8958('0x33')](_0x34f2f1[_0x8958('0x31')],qs[_0x8958('0x35')](_0x570f30[_0x8958('0x32')][_0x8958('0x35')]));_0x1530ee['attributes']=_0x1530ee[_0x8958('0x34')]['length']?_0x1530ee[_0x8958('0x34')]:_0x34f2f1['model'];if(!_0x570f30['query'][_0x8958('0x36')](_0x8958('0x37'))){_0x1530ee['limit']=qs[_0x8958('0x1f')](_0x570f30[_0x8958('0x32')]['limit']);_0x1530ee[_0x8958('0x1d')]=qs['offset'](_0x570f30[_0x8958('0x32')][_0x8958('0x1d')]);}_0x1530ee[_0x8958('0x38')]=qs[_0x8958('0x39')](_0x570f30[_0x8958('0x32')][_0x8958('0x39')]);_0x1530ee[_0x8958('0x3a')]=qs['filters'](_[_0x8958('0x3b')](_0x570f30[_0x8958('0x32')],_0x34f2f1[_0x8958('0x3c')]),_0x31ca8);if(_0x570f30[_0x8958('0x32')][_0x8958('0x3d')]){_0x1530ee[_0x8958('0x3a')]=_[_0x8958('0x3e')](_0x1530ee[_0x8958('0x3a')],{'$or':_['map'](_0x31ca8,function(_0x48a48e){if(_0x48a48e[_0x8958('0x30')]!==_0x8958('0x3f')){var _0xbc3909={};_0xbc3909[_0x48a48e[_0x8958('0x2b')]]={'$like':'%'+_0x570f30[_0x8958('0x32')][_0x8958('0x3d')]+'%'};return _0xbc3909;}})});}_0x1530ee=_[_0x8958('0x3e')]({},_0x1530ee,_0x570f30[_0x8958('0x40')]);var _0x27aa30={'where':_0x1530ee['where']};return db['DeskConfiguration'][_0x8958('0x20')](_0x27aa30)[_0x8958('0x27')](function(_0x445cbc){_0xfb599d[_0x8958('0x20')]=_0x445cbc;if(_0x570f30[_0x8958('0x32')]['includeAll']){_0x1530ee[_0x8958('0x41')]=[{'all':!![]}];}return db['DeskConfiguration']['findAll'](_0x1530ee);})['then'](function(_0x30d73f){_0xfb599d[_0x8958('0x42')]=_0x30d73f;return _0xfb599d;})['then'](respondWithFilteredResult(_0x5d12da,_0x1530ee))['catch'](handleError(_0x5d12da,null));};exports[_0x8958('0x43')]=function(_0x430164,_0x8c1aea){var _0x13c402={'raw':![],'where':{'id':_0x430164['params']['id']}},_0x3294b9={};_0x3294b9[_0x8958('0x31')]=_['keys'](db[_0x8958('0x44')]['rawAttributes']);_0x3294b9[_0x8958('0x32')]=_[_0x8958('0x45')](_0x430164[_0x8958('0x32')]);_0x3294b9['filters']=_[_0x8958('0x33')](_0x3294b9[_0x8958('0x31')],_0x3294b9['query']);_0x13c402[_0x8958('0x34')]=_['intersection'](_0x3294b9[_0x8958('0x31')],qs[_0x8958('0x35')](_0x430164[_0x8958('0x32')][_0x8958('0x35')]));_0x13c402[_0x8958('0x34')]=_0x13c402[_0x8958('0x34')]['length']?_0x13c402[_0x8958('0x34')]:_0x3294b9['model'];if(_0x430164[_0x8958('0x32')][_0x8958('0x46')]){_0x13c402['include']=[{'all':!![]}];}_0x13c402=_[_0x8958('0x3e')]({},_0x13c402,_0x430164[_0x8958('0x40')]);return db[_0x8958('0x44')]['find'](_0x13c402)[_0x8958('0x27')](handleEntityNotFound(_0x8c1aea,null))[_0x8958('0x27')](respondWithResult(_0x8c1aea,null))[_0x8958('0x47')](handleError(_0x8c1aea,null));};exports[_0x8958('0x48')]=function(_0x2ba34a,_0x2a80a3){return db[_0x8958('0x44')][_0x8958('0x48')](_0x2ba34a[_0x8958('0x49')],{})['then'](respondWithResult(_0x2a80a3,0xc9))[_0x8958('0x47')](handleError(_0x2a80a3,null));};exports['update']=function(_0x4d0979,_0x4e133d){if(_0x4d0979[_0x8958('0x49')]['id']){delete _0x4d0979[_0x8958('0x49')]['id'];}return db[_0x8958('0x44')][_0x8958('0x4a')]({'where':{'id':_0x4d0979[_0x8958('0x4b')]['id']}})[_0x8958('0x27')](handleEntityNotFound(_0x4e133d,null))[_0x8958('0x27')](saveUpdates(_0x4d0979[_0x8958('0x49')],null))['then'](respondWithResult(_0x4e133d,null))['catch'](handleError(_0x4e133d,null));};exports[_0x8958('0x28')]=function(_0x1d465c,_0x2392ee){return db['DeskConfiguration'][_0x8958('0x4a')]({'where':{'id':_0x1d465c[_0x8958('0x4b')]['id']}})[_0x8958('0x27')](handleEntityNotFound(_0x2392ee,null))[_0x8958('0x27')](removeEntity(_0x2392ee,null))[_0x8958('0x47')](handleError(_0x2392ee,null));};exports['getFields']=function(_0x1d1d81,_0x4eca2b,_0x15c3e2){var _0x2f22b5={};var _0x3b3ac1={};var _0x591c8f;var _0x452407;return db['DeskConfiguration'][_0x8958('0x4c')]({'where':{'id':_0x1d1d81[_0x8958('0x4b')]['id']}})[_0x8958('0x27')](handleEntityNotFound(_0x4eca2b,null))[_0x8958('0x27')](function(_0x44f3a6){if(_0x44f3a6){_0x591c8f=_0x44f3a6;_0x3b3ac1[_0x8958('0x31')]=_[_0x8958('0x45')](db[_0x8958('0x4d')]['rawAttributes']);_0x3b3ac1['query']=_['keys'](_0x1d1d81[_0x8958('0x32')]);_0x3b3ac1[_0x8958('0x3c')]=_[_0x8958('0x33')](_0x3b3ac1[_0x8958('0x31')],_0x3b3ac1[_0x8958('0x32')]);_0x2f22b5[_0x8958('0x34')]=_[_0x8958('0x33')](_0x3b3ac1[_0x8958('0x31')],qs[_0x8958('0x35')](_0x1d1d81[_0x8958('0x32')][_0x8958('0x35')]));_0x2f22b5[_0x8958('0x34')]=_0x2f22b5[_0x8958('0x34')]['length']?_0x2f22b5['attributes']:_0x3b3ac1[_0x8958('0x31')];_0x2f22b5['order']=qs['sort'](_0x1d1d81[_0x8958('0x32')][_0x8958('0x39')]);_0x2f22b5[_0x8958('0x3a')]=qs[_0x8958('0x3c')](_['pick'](_0x1d1d81['query'],_0x3b3ac1[_0x8958('0x3c')]));if(_0x1d1d81[_0x8958('0x32')][_0x8958('0x3d')]){_0x2f22b5[_0x8958('0x3a')]=_[_0x8958('0x3e')](_0x2f22b5[_0x8958('0x3a')],{'$or':_[_0x8958('0x2d')](_0x2f22b5['attributes'],function(_0x383791){var _0x306ad4={};_0x306ad4[_0x383791]={'$like':'%'+_0x1d1d81['query'][_0x8958('0x3d')]+'%'};return _0x306ad4;})});}_0x2f22b5=_[_0x8958('0x3e')]({},_0x2f22b5,_0x1d1d81[_0x8958('0x40')]);return _0x591c8f[_0x8958('0x4e')](_0x2f22b5);}})['then'](function(_0x333df5){if(_0x333df5){_0x452407=_0x333df5[_0x8958('0x4f')];if(!_0x1d1d81[_0x8958('0x32')]['hasOwnProperty']('nolimit')){_0x2f22b5[_0x8958('0x1f')]=qs['limit'](_0x1d1d81['query'][_0x8958('0x1f')]);_0x2f22b5[_0x8958('0x1d')]=qs[_0x8958('0x1d')](_0x1d1d81[_0x8958('0x32')]['offset']);}return _0x591c8f['getFields'](_0x2f22b5);}})[_0x8958('0x27')](function(_0x193543){if(_0x193543){return _0x193543?{'count':_0x452407,'rows':_0x193543}:null;}})[_0x8958('0x27')](respondWithResult(_0x4eca2b,null))['catch'](handleError(_0x4eca2b,null));};exports[_0x8958('0x50')]=function(_0x3967c9,_0x43d893,_0x16902d){var _0x5e9fb1={};var _0x1828b9={};var _0x78a47c;var _0x48073f;return db['DeskConfiguration'][_0x8958('0x4c')]({'where':{'id':_0x3967c9[_0x8958('0x4b')]['id']}})[_0x8958('0x27')](handleEntityNotFound(_0x43d893,null))[_0x8958('0x27')](function(_0x25a8e5){if(_0x25a8e5){_0x78a47c=_0x25a8e5;_0x1828b9[_0x8958('0x31')]=_['keys'](db['DeskField'][_0x8958('0x2e')]);_0x1828b9['query']=_[_0x8958('0x45')](_0x3967c9[_0x8958('0x32')]);_0x1828b9[_0x8958('0x3c')]=_[_0x8958('0x33')](_0x1828b9[_0x8958('0x31')],_0x1828b9[_0x8958('0x32')]);_0x5e9fb1[_0x8958('0x34')]=_[_0x8958('0x33')](_0x1828b9[_0x8958('0x31')],qs['fields'](_0x3967c9['query'][_0x8958('0x35')]));_0x5e9fb1[_0x8958('0x34')]=_0x5e9fb1[_0x8958('0x34')][_0x8958('0x4f')]?_0x5e9fb1['attributes']:_0x1828b9[_0x8958('0x31')];_0x5e9fb1[_0x8958('0x38')]=qs[_0x8958('0x39')](_0x3967c9[_0x8958('0x32')][_0x8958('0x39')]);_0x5e9fb1[_0x8958('0x3a')]=qs[_0x8958('0x3c')](_['pick'](_0x3967c9[_0x8958('0x32')],_0x1828b9[_0x8958('0x3c')]));if(_0x3967c9[_0x8958('0x32')]['filter']){_0x5e9fb1['where']=_[_0x8958('0x3e')](_0x5e9fb1[_0x8958('0x3a')],{'$or':_[_0x8958('0x2d')](_0x5e9fb1[_0x8958('0x34')],function(_0x3e5621){var _0x3276a1={};_0x3276a1[_0x3e5621]={'$like':'%'+_0x3967c9[_0x8958('0x32')][_0x8958('0x3d')]+'%'};return _0x3276a1;})});}_0x5e9fb1=_['merge']({},_0x5e9fb1,_0x3967c9[_0x8958('0x40')]);return _0x78a47c[_0x8958('0x50')](_0x5e9fb1);}})[_0x8958('0x27')](function(_0x53ad4f){if(_0x53ad4f){_0x48073f=_0x53ad4f[_0x8958('0x4f')];if(!_0x3967c9['query'][_0x8958('0x36')](_0x8958('0x37'))){_0x5e9fb1[_0x8958('0x1f')]=qs['limit'](_0x3967c9['query'][_0x8958('0x1f')]);_0x5e9fb1['offset']=qs['offset'](_0x3967c9[_0x8958('0x32')]['offset']);}return _0x78a47c[_0x8958('0x50')](_0x5e9fb1);}})['then'](function(_0x459df4){if(_0x459df4){return _0x459df4?{'count':_0x48073f,'rows':_0x459df4}:null;}})['then'](respondWithResult(_0x43d893,null))[_0x8958('0x47')](handleError(_0x43d893,null));};exports[_0x8958('0x51')]=function(_0x52b964,_0x2669b5,_0x4ea6c7){var _0x60f670={};var _0x3432cf={};var _0x193ace;var _0x197a7f;return db[_0x8958('0x44')][_0x8958('0x4c')]({'where':{'id':_0x52b964['params']['id']}})[_0x8958('0x27')](handleEntityNotFound(_0x2669b5,null))[_0x8958('0x27')](function(_0x1b2a43){if(_0x1b2a43){_0x193ace=_0x1b2a43;_0x3432cf[_0x8958('0x31')]=_[_0x8958('0x45')](db[_0x8958('0x4d')][_0x8958('0x2e')]);_0x3432cf[_0x8958('0x32')]=_[_0x8958('0x45')](_0x52b964[_0x8958('0x32')]);_0x3432cf[_0x8958('0x3c')]=_[_0x8958('0x33')](_0x3432cf[_0x8958('0x31')],_0x3432cf[_0x8958('0x32')]);_0x60f670[_0x8958('0x34')]=_[_0x8958('0x33')](_0x3432cf[_0x8958('0x31')],qs[_0x8958('0x35')](_0x52b964[_0x8958('0x32')][_0x8958('0x35')]));_0x60f670['attributes']=_0x60f670[_0x8958('0x34')][_0x8958('0x4f')]?_0x60f670[_0x8958('0x34')]:_0x3432cf[_0x8958('0x31')];_0x60f670[_0x8958('0x38')]=qs[_0x8958('0x39')](_0x52b964[_0x8958('0x32')][_0x8958('0x39')]);_0x60f670[_0x8958('0x3a')]=qs[_0x8958('0x3c')](_[_0x8958('0x3b')](_0x52b964['query'],_0x3432cf[_0x8958('0x3c')]));if(_0x52b964[_0x8958('0x32')][_0x8958('0x3d')]){_0x60f670[_0x8958('0x3a')]=_[_0x8958('0x3e')](_0x60f670[_0x8958('0x3a')],{'$or':_[_0x8958('0x2d')](_0x60f670[_0x8958('0x34')],function(_0x46284e){var _0x6d04db={};_0x6d04db[_0x46284e]={'$like':'%'+_0x52b964[_0x8958('0x32')][_0x8958('0x3d')]+'%'};return _0x6d04db;})});}_0x60f670=_[_0x8958('0x3e')]({},_0x60f670,_0x52b964[_0x8958('0x40')]);return _0x193ace['getDescriptions'](_0x60f670);}})['then'](function(_0x5e3791){if(_0x5e3791){_0x197a7f=_0x5e3791[_0x8958('0x4f')];if(!_0x52b964['query'][_0x8958('0x36')](_0x8958('0x37'))){_0x60f670[_0x8958('0x1f')]=qs['limit'](_0x52b964[_0x8958('0x32')][_0x8958('0x1f')]);_0x60f670[_0x8958('0x1d')]=qs[_0x8958('0x1d')](_0x52b964['query'][_0x8958('0x1d')]);}return _0x193ace['getDescriptions'](_0x60f670);}})['then'](function(_0x41e593){if(_0x41e593){return _0x41e593?{'count':_0x197a7f,'rows':_0x41e593}:null;}})[_0x8958('0x27')](respondWithResult(_0x2669b5,null))[_0x8958('0x47')](handleError(_0x2669b5,null));};exports[_0x8958('0x52')]=function(_0x33cc38,_0x4b93e4,_0x35b5aa){var _0x4927a1={};var _0x1a13bd={};var _0x2647e7;var _0x623306;return db[_0x8958('0x44')][_0x8958('0x4c')]({'where':{'id':_0x33cc38['params']['id']}})[_0x8958('0x27')](handleEntityNotFound(_0x4b93e4,null))[_0x8958('0x27')](function(_0xfa940e){if(_0xfa940e){_0x2647e7=_0xfa940e;_0x1a13bd[_0x8958('0x31')]=_[_0x8958('0x45')](db['Tag'][_0x8958('0x2e')]);_0x1a13bd[_0x8958('0x32')]=_['keys'](_0x33cc38[_0x8958('0x32')]);_0x1a13bd['filters']=_['intersection'](_0x1a13bd['model'],_0x1a13bd[_0x8958('0x32')]);_0x4927a1[_0x8958('0x34')]=_['intersection'](_0x1a13bd['model'],qs['fields'](_0x33cc38[_0x8958('0x32')][_0x8958('0x35')]));_0x4927a1['attributes']=_0x4927a1[_0x8958('0x34')][_0x8958('0x4f')]?_0x4927a1[_0x8958('0x34')]:_0x1a13bd['model'];_0x4927a1[_0x8958('0x38')]=qs[_0x8958('0x39')](_0x33cc38['query'][_0x8958('0x39')]);_0x4927a1[_0x8958('0x3a')]=qs[_0x8958('0x3c')](_[_0x8958('0x3b')](_0x33cc38[_0x8958('0x32')],_0x1a13bd[_0x8958('0x3c')]));if(_0x33cc38[_0x8958('0x32')][_0x8958('0x3d')]){_0x4927a1[_0x8958('0x3a')]=_[_0x8958('0x3e')](_0x4927a1[_0x8958('0x3a')],{'$or':_[_0x8958('0x2d')](_0x4927a1[_0x8958('0x34')],function(_0x279c37){var _0x1281d6={};_0x1281d6[_0x279c37]={'$like':'%'+_0x33cc38[_0x8958('0x32')]['filter']+'%'};return _0x1281d6;})});}_0x4927a1=_[_0x8958('0x3e')]({},_0x4927a1,_0x33cc38['options']);return _0x2647e7['getTags'](_0x4927a1);}})[_0x8958('0x27')](function(_0x29a9f4){if(_0x29a9f4){_0x623306=_0x29a9f4[_0x8958('0x4f')];if(!_0x33cc38['query'][_0x8958('0x36')]('nolimit')){_0x4927a1['limit']=qs['limit'](_0x33cc38[_0x8958('0x32')]['limit']);_0x4927a1[_0x8958('0x1d')]=qs[_0x8958('0x1d')](_0x33cc38['query'][_0x8958('0x1d')]);}return _0x2647e7[_0x8958('0x52')](_0x4927a1);}})[_0x8958('0x27')](function(_0x2902cf){if(_0x2902cf){return _0x2902cf?{'count':_0x623306,'rows':_0x2902cf}:null;}})[_0x8958('0x27')](respondWithResult(_0x4b93e4,null))[_0x8958('0x47')](handleError(_0x4b93e4,null));};exports[_0x8958('0x53')]=function(_0x346875,_0x27b742,_0xdfba61){if(_0x346875['body']['id']){delete _0x346875['body']['id'];}return db['DeskConfiguration'][_0x8958('0x4c')]({'where':{'id':_0x346875[_0x8958('0x4b')]['id']}})[_0x8958('0x27')](handleEntityNotFound(_0x27b742,null))[_0x8958('0x27')](function(_0x1f0af9){if(_0x1f0af9){return _0x1f0af9[_0x8958('0x53')](_0x346875['body']['ids']||[]);}return null;})[_0x8958('0x27')](respondWithResult(_0x27b742,null))[_0x8958('0x47')](handleError(_0x27b742,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index e07a9c0..783ee2e 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 _0xbe54=['../../config/environment','exports','DeskConfiguration','int_desk_configurations','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x3f2fc5,_0x1aaf24){var _0x697a68=function(_0x112b7f){while(--_0x112b7f){_0x3f2fc5['push'](_0x3f2fc5['shift']());}};_0x697a68(++_0x1aaf24);}(_0xbe54,0xe8));var _0x4be5=function(_0x537ef0,_0x1cba1c){_0x537ef0=_0x537ef0-0x0;var _0x30ad43=_0xbe54[_0x537ef0];return _0x30ad43;};'use strict';var _=require(_0x4be5('0x0'));var util=require(_0x4be5('0x1'));var logger=require(_0x4be5('0x2'))(_0x4be5('0x3'));var moment=require('moment');var BPromise=require(_0x4be5('0x4'));var rp=require(_0x4be5('0x5'));var fs=require('fs');var path=require(_0x4be5('0x6'));var rimraf=require(_0x4be5('0x7'));var config=require(_0x4be5('0x8'));var attributes=require('./intDeskConfiguration.attributes');module[_0x4be5('0x9')]=function(_0x4f8c72,_0x12b64c){return _0x4f8c72['define'](_0x4be5('0xa'),attributes,{'tableName':_0x4be5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc0c0=['DeskConfiguration','int_desk_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intDeskConfiguration.attributes','exports','define'];(function(_0x3ed7ff,_0x4be15f){var _0x455388=function(_0x322764){while(--_0x322764){_0x3ed7ff['push'](_0x3ed7ff['shift']());}};_0x455388(++_0x4be15f);}(_0xc0c0,0x136));var _0x0c0c=function(_0x1deb03,_0xd05ad8){_0x1deb03=_0x1deb03-0x0;var _0x189fe7=_0xc0c0[_0x1deb03];return _0x189fe7;};'use strict';var _=require(_0x0c0c('0x0'));var util=require(_0x0c0c('0x1'));var logger=require(_0x0c0c('0x2'))(_0x0c0c('0x3'));var moment=require(_0x0c0c('0x4'));var BPromise=require(_0x0c0c('0x5'));var rp=require(_0x0c0c('0x6'));var fs=require('fs');var path=require(_0x0c0c('0x7'));var rimraf=require('rimraf');var config=require(_0x0c0c('0x8'));var attributes=require(_0x0c0c('0x9'));module[_0x0c0c('0xa')]=function(_0x54280a,_0x1532d2){return _0x54280a[_0x0c0c('0xb')](_0x0c0c('0xc'),attributes,{'tableName':_0x0c0c('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 6196212..f3e61a2 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 _0xb1a4=['result','catch','lodash','util','moment','../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','info','DeskConfiguration,\x20%s,\x20%s','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent'];(function(_0x57bc95,_0x417bf6){var _0x16fc06=function(_0x24cace){while(--_0x24cace){_0x57bc95['push'](_0x57bc95['shift']());}};_0x16fc06(++_0x417bf6);}(_0xb1a4,0x16a));var _0x4b1a=function(_0x4e68b4,_0x1e2cae){_0x4e68b4=_0x4e68b4-0x0;var _0x1c62d6=_0xb1a4[_0x4e68b4];return _0x1c62d6;};'use strict';var _=require(_0x4b1a('0x0'));var util=require(_0x4b1a('0x1'));var moment=require(_0x4b1a('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4b1a('0x3'))['db'];var utils=require(_0x4b1a('0x4'));var logger=require('../../config/logger')(_0x4b1a('0x5'));var config=require('../../config/environment');var jayson=require(_0x4b1a('0x6'));var client=jayson[_0x4b1a('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x14411d,_0x469d47,_0x312e2f){return new BPromise(function(_0x371066,_0x1547d9){return client[_0x4b1a('0x8')](_0x14411d,_0x312e2f)['then'](function(_0x36f9ba){logger[_0x4b1a('0x9')](_0x4b1a('0xa'),_0x469d47,'request\x20sent');logger['debug'](_0x4b1a('0xb'),_0x469d47,'request\x20sent',JSON[_0x4b1a('0xc')](_0x36f9ba));if(_0x36f9ba[_0x4b1a('0xd')]){if(_0x36f9ba[_0x4b1a('0xd')]['code']===0x1f4){logger[_0x4b1a('0xd')]('DeskConfiguration,\x20%s,\x20%s',_0x469d47,_0x36f9ba['error']['message']);return _0x1547d9(_0x36f9ba['error']['message']);}logger[_0x4b1a('0xd')]('DeskConfiguration,\x20%s,\x20%s',_0x469d47,_0x36f9ba[_0x4b1a('0xd')][_0x4b1a('0xe')]);return _0x371066(_0x36f9ba['error']['message']);}else{logger['info'](_0x4b1a('0xa'),_0x469d47,_0x4b1a('0xf'));_0x371066(_0x36f9ba[_0x4b1a('0x10')][_0x4b1a('0xe')]);}})[_0x4b1a('0x11')](function(_0x5ce93b){logger['error'](_0x4b1a('0xa'),_0x469d47,_0x5ce93b);_0x1547d9(_0x5ce93b);});});} \ No newline at end of file +var _0xd185=['DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x213e16,_0x5f5165){var _0x334ab4=function(_0x23a6e2){while(--_0x23a6e2){_0x213e16['push'](_0x213e16['shift']());}};_0x334ab4(++_0x5f5165);}(_0xd185,0x92));var _0x5d18=function(_0x11ba48,_0x32e1a9){_0x11ba48=_0x11ba48-0x0;var _0x200918=_0xd185[_0x11ba48];return _0x200918;};'use strict';var _=require(_0x5d18('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x5d18('0x1'));var rs=require(_0x5d18('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5d18('0x3'))['db'];var utils=require(_0x5d18('0x4'));var logger=require(_0x5d18('0x5'))(_0x5d18('0x6'));var config=require(_0x5d18('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x5d18('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x30063d,_0x2f8b90,_0x1dcdd8){return new BPromise(function(_0x4660cc,_0x570e19){return client['request'](_0x30063d,_0x1dcdd8)[_0x5d18('0x9')](function(_0x57e272){logger[_0x5d18('0xa')](_0x5d18('0xb'),_0x2f8b90,_0x5d18('0xc'));logger[_0x5d18('0xd')](_0x5d18('0xe'),_0x2f8b90,_0x5d18('0xc'),JSON[_0x5d18('0xf')](_0x57e272));if(_0x57e272[_0x5d18('0x10')]){if(_0x57e272[_0x5d18('0x10')][_0x5d18('0x11')]===0x1f4){logger['error']('DeskConfiguration,\x20%s,\x20%s',_0x2f8b90,_0x57e272['error'][_0x5d18('0x12')]);return _0x570e19(_0x57e272[_0x5d18('0x10')][_0x5d18('0x12')]);}logger[_0x5d18('0x10')](_0x5d18('0xb'),_0x2f8b90,_0x57e272[_0x5d18('0x10')][_0x5d18('0x12')]);return _0x4660cc(_0x57e272['error'][_0x5d18('0x12')]);}else{logger[_0x5d18('0xa')]('DeskConfiguration,\x20%s,\x20%s',_0x2f8b90,_0x5d18('0xc'));_0x4660cc(_0x57e272[_0x5d18('0x13')][_0x5d18('0x12')]);}})['catch'](function(_0x1dde03){logger[_0x5d18('0x10')](_0x5d18('0xb'),_0x2f8b90,_0x1dde03);_0x570e19(_0x1dde03);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index ebe4f92..658663a 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 _0x19cb=['put','update','destroy','exports','util','path','express','fs-extra','./intDeskField.controller','get','/:id','isAuthenticated','show','create'];(function(_0x2c6810,_0x23c079){var _0x213881=function(_0x528021){while(--_0x528021){_0x2c6810['push'](_0x2c6810['shift']());}};_0x213881(++_0x23c079);}(_0x19cb,0x146));var _0xb19c=function(_0x5dcde1,_0x4e6063){_0x5dcde1=_0x5dcde1-0x0;var _0x2161e9=_0x19cb[_0x5dcde1];return _0x2161e9;};'use strict';var multer=require('multer');var util=require(_0xb19c('0x0'));var path=require(_0xb19c('0x1'));var timeout=require('connect-timeout');var express=require(_0xb19c('0x2'));var router=express['Router']();var fs_extra=require(_0xb19c('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xb19c('0x4'));router[_0xb19c('0x5')]('/',auth['isAuthenticated'](),controller['index']);router[_0xb19c('0x5')](_0xb19c('0x6'),auth[_0xb19c('0x7')](),controller[_0xb19c('0x8')]);router['post']('/',auth['isAuthenticated'](),controller[_0xb19c('0x9')]);router[_0xb19c('0xa')](_0xb19c('0x6'),auth[_0xb19c('0x7')](),controller[_0xb19c('0xb')]);router['delete'](_0xb19c('0x6'),auth[_0xb19c('0x7')](),controller[_0xb19c('0xc')]);module[_0xb19c('0xd')]=router; \ No newline at end of file +var _0xcf8f=['destroy','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/:id','show','post','create','put','update','delete'];(function(_0x26c1cc,_0x49e69a){var _0x457feb=function(_0x34d611){while(--_0x34d611){_0x26c1cc['push'](_0x26c1cc['shift']());}};_0x457feb(++_0x49e69a);}(_0xcf8f,0x78));var _0xfcf8=function(_0x397983,_0x3e649d){_0x397983=_0x397983-0x0;var _0x3621c2=_0xcf8f[_0x397983];return _0x3621c2;};'use strict';var multer=require(_0xfcf8('0x0'));var util=require(_0xfcf8('0x1'));var path=require(_0xfcf8('0x2'));var timeout=require('connect-timeout');var express=require(_0xfcf8('0x3'));var router=express[_0xfcf8('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xfcf8('0x5'));var interaction=require(_0xfcf8('0x6'));var config=require('../../config/environment');var controller=require('./intDeskField.controller');router[_0xfcf8('0x7')]('/',auth[_0xfcf8('0x8')](),controller['index']);router['get'](_0xfcf8('0x9'),auth[_0xfcf8('0x8')](),controller[_0xfcf8('0xa')]);router[_0xfcf8('0xb')]('/',auth[_0xfcf8('0x8')](),controller[_0xfcf8('0xc')]);router[_0xfcf8('0xd')]('/:id',auth['isAuthenticated'](),controller[_0xfcf8('0xe')]);router[_0xfcf8('0xf')]('/:id',auth[_0xfcf8('0x8')](),controller[_0xfcf8('0x10')]);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 6409386..a4d9405 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 _0x52b2=['string','variable','keyValue','picklist','STRING','customVariable','sequelize','exports'];(function(_0x3307d3,_0x4f68f5){var _0x164a8d=function(_0x6c1c5f){while(--_0x6c1c5f){_0x3307d3['push'](_0x3307d3['shift']());}};_0x164a8d(++_0x4f68f5);}(_0x52b2,0x196));var _0x252b=function(_0x4842e9,_0xb6ae05){_0x4842e9=_0x4842e9-0x0;var _0x546a5a=_0x52b2[_0x4842e9];return _0x546a5a;};'use strict';var Sequelize=require(_0x252b('0x0'));module[_0x252b('0x1')]={'type':{'type':Sequelize['ENUM'](_0x252b('0x2'),_0x252b('0x3'),'customVariable',_0x252b('0x4'),_0x252b('0x5')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x252b('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0x252b('0x2'),'variable',_0x252b('0x7'))},'keyContent':{'type':Sequelize[_0x252b('0x6')]},'idField':{'type':Sequelize[_0x252b('0x6')]},'nameField':{'type':Sequelize[_0x252b('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x252b('0x6')]}}; \ No newline at end of file +var _0xff53=['string','variable','customVariable','keyValue','STRING','BOOLEAN','sequelize','exports','ENUM'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xff53,0x189));var _0x3ff5=function(_0x2ce579,_0x34974){_0x2ce579=_0x2ce579-0x0;var _0x78ba30=_0xff53[_0x2ce579];return _0x78ba30;};'use strict';var Sequelize=require(_0x3ff5('0x0'));module[_0x3ff5('0x1')]={'type':{'type':Sequelize[_0x3ff5('0x2')](_0x3ff5('0x3'),_0x3ff5('0x4'),_0x3ff5('0x5'),_0x3ff5('0x6'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0x3ff5('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x3ff5('0x2')]('string',_0x3ff5('0x4'),_0x3ff5('0x5'))},'keyContent':{'type':Sequelize[_0x3ff5('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x3ff5('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 75072a4..2c297c6 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 _0xf603=['eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','limit','undefined','count','status','set','apply','reject','save','update','then','destroy','stack','name','send','index','map','DeskField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','options','include','findAll','rows','show','params','find','catch','body'];(function(_0x521c76,_0x469461){var _0x225012=function(_0x143dd4){while(--_0x143dd4){_0x521c76['push'](_0x521c76['shift']());}};_0x225012(++_0x469461);}(_0xf603,0x124));var _0x3f60=function(_0x1864f8,_0x2b03bb){_0x1864f8=_0x1864f8-0x0;var _0x49f630=_0xf603[_0x1864f8];return _0x49f630;};'use strict';var emlformat=require(_0x3f60('0x0'));var rimraf=require(_0x3f60('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3f60('0x2'));var rp=require(_0x3f60('0x3'));var moment=require(_0x3f60('0x4'));var BPromise=require(_0x3f60('0x5'));var Mustache=require(_0x3f60('0x6'));var util=require(_0x3f60('0x7'));var path=require(_0x3f60('0x8'));var sox=require(_0x3f60('0x9'));var csv=require(_0x3f60('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x3f60('0xb'));var crypto=require(_0x3f60('0xc'));var jsforce=require(_0x3f60('0xd'));var deskjs=require(_0x3f60('0xe'));var toCsv=require(_0x3f60('0xa'));var querystring=require(_0x3f60('0xf'));var Papa=require(_0x3f60('0x10'));var Redis=require(_0x3f60('0x11'));var authService=require(_0x3f60('0x12'));var qs=require(_0x3f60('0x13'));var as=require(_0x3f60('0x14'));var hardwareService=require(_0x3f60('0x15'));var logger=require(_0x3f60('0x16'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x3f60('0x17'));var db=require(_0x3f60('0x18'))['db'];function respondWithStatusCode(_0x2e79e8,_0x58e120){_0x58e120=_0x58e120||0xcc;return function(_0xeb6151){if(_0xeb6151){return _0x2e79e8[_0x3f60('0x19')](_0x58e120);}return _0x2e79e8['status'](_0x58e120)[_0x3f60('0x1a')]();};}function respondWithResult(_0x1b3e74,_0x53ec7a){_0x53ec7a=_0x53ec7a||0xc8;return function(_0x1ec7f4){if(_0x1ec7f4){return _0x1b3e74['status'](_0x53ec7a)[_0x3f60('0x1b')](_0x1ec7f4);}};}function respondWithFilteredResult(_0x2cd28f,_0x5e7718){return function(_0x3c0e9d){if(_0x3c0e9d){var _0x4e84b5=typeof _0x5e7718[_0x3f60('0x1c')]==='undefined'&&typeof _0x5e7718[_0x3f60('0x1d')]===_0x3f60('0x1e');var _0xbc26c=_0x3c0e9d[_0x3f60('0x1f')];var _0x3ae771=_0x4e84b5?0x0:_0x5e7718[_0x3f60('0x1c')];var _0x52aa44=_0x4e84b5?_0x3c0e9d[_0x3f60('0x1f')]:_0x5e7718[_0x3f60('0x1c')]+_0x5e7718[_0x3f60('0x1d')];var _0x9c845f;if(_0x52aa44>=_0xbc26c){_0x52aa44=_0xbc26c;_0x9c845f=0xc8;}else{_0x9c845f=0xce;}_0x2cd28f[_0x3f60('0x20')](_0x9c845f);return _0x2cd28f[_0x3f60('0x21')]('Content-Range',_0x3ae771+'-'+_0x52aa44+'/'+_0xbc26c)[_0x3f60('0x1b')](_0x3c0e9d);}return null;};}function patchUpdates(_0x2f1735){return function(_0x4dace9){try{jsonpatch[_0x3f60('0x22')](_0x4dace9,_0x2f1735,!![]);}catch(_0x2dba08){return BPromise[_0x3f60('0x23')](_0x2dba08);}return _0x4dace9[_0x3f60('0x24')]();};}function saveUpdates(_0x1d23bb,_0x1b161e){return function(_0x44b665){if(_0x44b665){return _0x44b665[_0x3f60('0x25')](_0x1d23bb)[_0x3f60('0x26')](function(_0x31847d){return _0x31847d;});}return null;};}function removeEntity(_0x3f6fa7,_0x35b8f6){return function(_0x1f9390){if(_0x1f9390){return _0x1f9390[_0x3f60('0x27')]()[_0x3f60('0x26')](function(){_0x3f6fa7['status'](0xcc)[_0x3f60('0x1a')]();});}};}function handleEntityNotFound(_0x3cdef4,_0x15315b){return function(_0x4581d6){if(!_0x4581d6){_0x3cdef4[_0x3f60('0x19')](0x194);}return _0x4581d6;};}function handleError(_0x36dfdb,_0xc106a9){_0xc106a9=_0xc106a9||0x1f4;return function(_0x23e265){logger['error'](_0x23e265[_0x3f60('0x28')]);if(_0x23e265[_0x3f60('0x29')]){delete _0x23e265[_0x3f60('0x29')];}_0x36dfdb[_0x3f60('0x20')](_0xc106a9)[_0x3f60('0x2a')](_0x23e265);};}exports[_0x3f60('0x2b')]=function(_0x39e14c,_0x4520a5){var _0x16b590={},_0x3cd0a7={},_0x2f1bc9={'count':0x0,'rows':[]};var _0x457e5b=_[_0x3f60('0x2c')](db[_0x3f60('0x2d')][_0x3f60('0x2e')],function(_0x14d83c){return{'name':_0x14d83c[_0x3f60('0x2f')],'type':_0x14d83c[_0x3f60('0x30')][_0x3f60('0x31')]};});_0x3cd0a7[_0x3f60('0x32')]=_[_0x3f60('0x2c')](_0x457e5b,_0x3f60('0x29'));_0x3cd0a7[_0x3f60('0x33')]=_[_0x3f60('0x34')](_0x39e14c[_0x3f60('0x33')]);_0x3cd0a7[_0x3f60('0x35')]=_[_0x3f60('0x36')](_0x3cd0a7[_0x3f60('0x32')],_0x3cd0a7[_0x3f60('0x33')]);_0x16b590[_0x3f60('0x37')]=_[_0x3f60('0x36')](_0x3cd0a7['model'],qs[_0x3f60('0x38')](_0x39e14c[_0x3f60('0x33')]['fields']));_0x16b590[_0x3f60('0x37')]=_0x16b590[_0x3f60('0x37')][_0x3f60('0x39')]?_0x16b590[_0x3f60('0x37')]:_0x3cd0a7['model'];if(!_0x39e14c[_0x3f60('0x33')][_0x3f60('0x3a')]('nolimit')){_0x16b590['limit']=qs[_0x3f60('0x1d')](_0x39e14c['query'][_0x3f60('0x1d')]);_0x16b590[_0x3f60('0x1c')]=qs[_0x3f60('0x1c')](_0x39e14c[_0x3f60('0x33')]['offset']);}_0x16b590['order']=qs[_0x3f60('0x3b')](_0x39e14c[_0x3f60('0x33')][_0x3f60('0x3b')]);_0x16b590[_0x3f60('0x3c')]=qs[_0x3f60('0x35')](_[_0x3f60('0x3d')](_0x39e14c['query'],_0x3cd0a7[_0x3f60('0x35')]),_0x457e5b);if(_0x39e14c['query'][_0x3f60('0x3e')]){_0x16b590['where']=_[_0x3f60('0x3f')](_0x16b590[_0x3f60('0x3c')],{'$or':_[_0x3f60('0x2c')](_0x457e5b,function(_0x466d05){if(_0x466d05[_0x3f60('0x30')]!=='VIRTUAL'){var _0x4fa98d={};_0x4fa98d[_0x466d05[_0x3f60('0x29')]]={'$like':'%'+_0x39e14c[_0x3f60('0x33')][_0x3f60('0x3e')]+'%'};return _0x4fa98d;}})});}_0x16b590=_['merge']({},_0x16b590,_0x39e14c[_0x3f60('0x40')]);var _0x42f82d={'where':_0x16b590['where']};return db['DeskField'][_0x3f60('0x1f')](_0x42f82d)[_0x3f60('0x26')](function(_0x3f2129){_0x2f1bc9[_0x3f60('0x1f')]=_0x3f2129;if(_0x39e14c[_0x3f60('0x33')]['includeAll']){_0x16b590[_0x3f60('0x41')]=[{'all':!![]}];}return db[_0x3f60('0x2d')][_0x3f60('0x42')](_0x16b590);})[_0x3f60('0x26')](function(_0x4c6346){_0x2f1bc9[_0x3f60('0x43')]=_0x4c6346;return _0x2f1bc9;})['then'](respondWithFilteredResult(_0x4520a5,_0x16b590))['catch'](handleError(_0x4520a5,null));};exports[_0x3f60('0x44')]=function(_0x20422a,_0x4ef8f2){var _0x5cfc2f={'raw':!![],'where':{'id':_0x20422a[_0x3f60('0x45')]['id']}},_0x4f0752={};_0x4f0752[_0x3f60('0x32')]=_['keys'](db['DeskField']['rawAttributes']);_0x4f0752[_0x3f60('0x33')]=_['keys'](_0x20422a['query']);_0x4f0752[_0x3f60('0x35')]=_[_0x3f60('0x36')](_0x4f0752['model'],_0x4f0752['query']);_0x5cfc2f[_0x3f60('0x37')]=_['intersection'](_0x4f0752[_0x3f60('0x32')],qs['fields'](_0x20422a[_0x3f60('0x33')][_0x3f60('0x38')]));_0x5cfc2f[_0x3f60('0x37')]=_0x5cfc2f[_0x3f60('0x37')][_0x3f60('0x39')]?_0x5cfc2f['attributes']:_0x4f0752[_0x3f60('0x32')];if(_0x20422a[_0x3f60('0x33')]['includeAll']){_0x5cfc2f['include']=[{'all':!![]}];}_0x5cfc2f=_[_0x3f60('0x3f')]({},_0x5cfc2f,_0x20422a[_0x3f60('0x40')]);return db[_0x3f60('0x2d')][_0x3f60('0x46')](_0x5cfc2f)[_0x3f60('0x26')](handleEntityNotFound(_0x4ef8f2,null))['then'](respondWithResult(_0x4ef8f2,null))[_0x3f60('0x47')](handleError(_0x4ef8f2,null));};exports['create']=function(_0xe5a2a6,_0x253d2f){return db[_0x3f60('0x2d')]['create'](_0xe5a2a6[_0x3f60('0x48')],{})[_0x3f60('0x26')](respondWithResult(_0x253d2f,0xc9))[_0x3f60('0x47')](handleError(_0x253d2f,null));};exports['update']=function(_0x217348,_0x55f75f){if(_0x217348[_0x3f60('0x48')]['id']){delete _0x217348[_0x3f60('0x48')]['id'];}return db[_0x3f60('0x2d')][_0x3f60('0x46')]({'where':{'id':_0x217348['params']['id']}})[_0x3f60('0x26')](handleEntityNotFound(_0x55f75f,null))[_0x3f60('0x26')](saveUpdates(_0x217348['body'],null))[_0x3f60('0x26')](respondWithResult(_0x55f75f,null))['catch'](handleError(_0x55f75f,null));};exports['destroy']=function(_0x4ce17d,_0x55dd97){return db['DeskField'][_0x3f60('0x46')]({'where':{'id':_0x4ce17d['params']['id']}})[_0x3f60('0x26')](handleEntityNotFound(_0x55dd97,null))[_0x3f60('0x26')](removeEntity(_0x55dd97,null))[_0x3f60('0x47')](handleError(_0x55dd97,null));}; \ No newline at end of file +var _0x5c0e=['../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','reject','update','destroy','then','error','stack','name','index','map','DeskField','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils'];(function(_0x25c59a,_0x458213){var _0x43e4b2=function(_0x1a6997){while(--_0x1a6997){_0x25c59a['push'](_0x25c59a['shift']());}};_0x43e4b2(++_0x458213);}(_0x5c0e,0x160));var _0xe5c0=function(_0xa5d9f9,_0x17c6bf){_0xa5d9f9=_0xa5d9f9-0x0;var _0x40e9f6=_0x5c0e[_0xa5d9f9];return _0x40e9f6;};'use strict';var emlformat=require(_0xe5c0('0x0'));var rimraf=require(_0xe5c0('0x1'));var zipdir=require(_0xe5c0('0x2'));var jsonpatch=require(_0xe5c0('0x3'));var rp=require(_0xe5c0('0x4'));var moment=require(_0xe5c0('0x5'));var BPromise=require(_0xe5c0('0x6'));var Mustache=require('mustache');var util=require(_0xe5c0('0x7'));var path=require('path');var sox=require(_0xe5c0('0x8'));var csv=require(_0xe5c0('0x9'));var ejs=require(_0xe5c0('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe5c0('0xb'));var squel=require(_0xe5c0('0xc'));var crypto=require(_0xe5c0('0xd'));var jsforce=require(_0xe5c0('0xe'));var deskjs=require(_0xe5c0('0xf'));var toCsv=require(_0xe5c0('0x9'));var querystring=require(_0xe5c0('0x10'));var Papa=require('papaparse');var Redis=require(_0xe5c0('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xe5c0('0x12'));var as=require(_0xe5c0('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe5c0('0x14'))(_0xe5c0('0x15'));var utils=require(_0xe5c0('0x16'));var config=require(_0xe5c0('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xe5c0('0x18'))['db'];function respondWithStatusCode(_0x5bedb7,_0x9afa6f){_0x9afa6f=_0x9afa6f||0xcc;return function(_0x25b01f){if(_0x25b01f){return _0x5bedb7[_0xe5c0('0x19')](_0x9afa6f);}return _0x5bedb7['status'](_0x9afa6f)[_0xe5c0('0x1a')]();};}function respondWithResult(_0x5e68de,_0x2548c){_0x2548c=_0x2548c||0xc8;return function(_0xf0c926){if(_0xf0c926){return _0x5e68de[_0xe5c0('0x1b')](_0x2548c)[_0xe5c0('0x1c')](_0xf0c926);}};}function respondWithFilteredResult(_0x2f5d74,_0x4aa82b){return function(_0x4aac0e){if(_0x4aac0e){var _0x128cea=typeof _0x4aa82b[_0xe5c0('0x1d')]===_0xe5c0('0x1e')&&typeof _0x4aa82b[_0xe5c0('0x1f')]===_0xe5c0('0x1e');var _0x453728=_0x4aac0e[_0xe5c0('0x20')];var _0x42e62a=_0x128cea?0x0:_0x4aa82b['offset'];var _0x340b65=_0x128cea?_0x4aac0e['count']:_0x4aa82b['offset']+_0x4aa82b['limit'];var _0x44f8b8;if(_0x340b65>=_0x453728){_0x340b65=_0x453728;_0x44f8b8=0xc8;}else{_0x44f8b8=0xce;}_0x2f5d74[_0xe5c0('0x1b')](_0x44f8b8);return _0x2f5d74[_0xe5c0('0x21')]('Content-Range',_0x42e62a+'-'+_0x340b65+'/'+_0x453728)[_0xe5c0('0x1c')](_0x4aac0e);}return null;};}function patchUpdates(_0x4d123e){return function(_0x88b8b4){try{jsonpatch[_0xe5c0('0x22')](_0x88b8b4,_0x4d123e,!![]);}catch(_0x2f54db){return BPromise[_0xe5c0('0x23')](_0x2f54db);}return _0x88b8b4['save']();};}function saveUpdates(_0x10e25c,_0x35458e){return function(_0x4b6c77){if(_0x4b6c77){return _0x4b6c77[_0xe5c0('0x24')](_0x10e25c)['then'](function(_0x435b28){return _0x435b28;});}return null;};}function removeEntity(_0x139513,_0x351dc2){return function(_0x3451af){if(_0x3451af){return _0x3451af[_0xe5c0('0x25')]()[_0xe5c0('0x26')](function(){_0x139513[_0xe5c0('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1d0f15,_0x41897b){return function(_0xdb579){if(!_0xdb579){_0x1d0f15['sendStatus'](0x194);}return _0xdb579;};}function handleError(_0x292239,_0x4de717){_0x4de717=_0x4de717||0x1f4;return function(_0x40109a){logger[_0xe5c0('0x27')](_0x40109a[_0xe5c0('0x28')]);if(_0x40109a[_0xe5c0('0x29')]){delete _0x40109a['name'];}_0x292239[_0xe5c0('0x1b')](_0x4de717)['send'](_0x40109a);};}exports[_0xe5c0('0x2a')]=function(_0x5accfa,_0x2c64bf){var _0x413705={},_0x20799a={},_0x3ab33d={'count':0x0,'rows':[]};var _0x57118c=_[_0xe5c0('0x2b')](db[_0xe5c0('0x2c')][_0xe5c0('0x2d')],function(_0x4d1262){return{'name':_0x4d1262['fieldName'],'type':_0x4d1262['type'][_0xe5c0('0x2e')]};});_0x20799a[_0xe5c0('0x2f')]=_[_0xe5c0('0x2b')](_0x57118c,_0xe5c0('0x29'));_0x20799a[_0xe5c0('0x30')]=_[_0xe5c0('0x31')](_0x5accfa[_0xe5c0('0x30')]);_0x20799a[_0xe5c0('0x32')]=_[_0xe5c0('0x33')](_0x20799a[_0xe5c0('0x2f')],_0x20799a[_0xe5c0('0x30')]);_0x413705[_0xe5c0('0x34')]=_['intersection'](_0x20799a[_0xe5c0('0x2f')],qs[_0xe5c0('0x35')](_0x5accfa[_0xe5c0('0x30')][_0xe5c0('0x35')]));_0x413705[_0xe5c0('0x34')]=_0x413705[_0xe5c0('0x34')][_0xe5c0('0x36')]?_0x413705['attributes']:_0x20799a[_0xe5c0('0x2f')];if(!_0x5accfa[_0xe5c0('0x30')][_0xe5c0('0x37')](_0xe5c0('0x38'))){_0x413705[_0xe5c0('0x1f')]=qs[_0xe5c0('0x1f')](_0x5accfa[_0xe5c0('0x30')][_0xe5c0('0x1f')]);_0x413705['offset']=qs[_0xe5c0('0x1d')](_0x5accfa['query'][_0xe5c0('0x1d')]);}_0x413705[_0xe5c0('0x39')]=qs[_0xe5c0('0x3a')](_0x5accfa[_0xe5c0('0x30')][_0xe5c0('0x3a')]);_0x413705['where']=qs[_0xe5c0('0x32')](_[_0xe5c0('0x3b')](_0x5accfa[_0xe5c0('0x30')],_0x20799a[_0xe5c0('0x32')]),_0x57118c);if(_0x5accfa[_0xe5c0('0x30')][_0xe5c0('0x3c')]){_0x413705[_0xe5c0('0x3d')]=_[_0xe5c0('0x3e')](_0x413705[_0xe5c0('0x3d')],{'$or':_[_0xe5c0('0x2b')](_0x57118c,function(_0x140190){if(_0x140190[_0xe5c0('0x3f')]!==_0xe5c0('0x40')){var _0x4241d4={};_0x4241d4[_0x140190[_0xe5c0('0x29')]]={'$like':'%'+_0x5accfa[_0xe5c0('0x30')][_0xe5c0('0x3c')]+'%'};return _0x4241d4;}})});}_0x413705=_[_0xe5c0('0x3e')]({},_0x413705,_0x5accfa[_0xe5c0('0x41')]);var _0x5b11c6={'where':_0x413705[_0xe5c0('0x3d')]};return db[_0xe5c0('0x2c')][_0xe5c0('0x20')](_0x5b11c6)['then'](function(_0x4db75e){_0x3ab33d[_0xe5c0('0x20')]=_0x4db75e;if(_0x5accfa['query'][_0xe5c0('0x42')]){_0x413705[_0xe5c0('0x43')]=[{'all':!![]}];}return db[_0xe5c0('0x2c')][_0xe5c0('0x44')](_0x413705);})['then'](function(_0x62965f){_0x3ab33d[_0xe5c0('0x45')]=_0x62965f;return _0x3ab33d;})[_0xe5c0('0x26')](respondWithFilteredResult(_0x2c64bf,_0x413705))[_0xe5c0('0x46')](handleError(_0x2c64bf,null));};exports['show']=function(_0x102485,_0x5ac1a4){var _0x4d0b79={'raw':!![],'where':{'id':_0x102485[_0xe5c0('0x47')]['id']}},_0x3d83fd={};_0x3d83fd[_0xe5c0('0x2f')]=_[_0xe5c0('0x31')](db[_0xe5c0('0x2c')][_0xe5c0('0x2d')]);_0x3d83fd[_0xe5c0('0x30')]=_['keys'](_0x102485['query']);_0x3d83fd[_0xe5c0('0x32')]=_[_0xe5c0('0x33')](_0x3d83fd['model'],_0x3d83fd[_0xe5c0('0x30')]);_0x4d0b79['attributes']=_[_0xe5c0('0x33')](_0x3d83fd[_0xe5c0('0x2f')],qs[_0xe5c0('0x35')](_0x102485[_0xe5c0('0x30')][_0xe5c0('0x35')]));_0x4d0b79['attributes']=_0x4d0b79[_0xe5c0('0x34')][_0xe5c0('0x36')]?_0x4d0b79['attributes']:_0x3d83fd[_0xe5c0('0x2f')];if(_0x102485['query'][_0xe5c0('0x42')]){_0x4d0b79[_0xe5c0('0x43')]=[{'all':!![]}];}_0x4d0b79=_[_0xe5c0('0x3e')]({},_0x4d0b79,_0x102485[_0xe5c0('0x41')]);return db[_0xe5c0('0x2c')]['find'](_0x4d0b79)['then'](handleEntityNotFound(_0x5ac1a4,null))['then'](respondWithResult(_0x5ac1a4,null))[_0xe5c0('0x46')](handleError(_0x5ac1a4,null));};exports[_0xe5c0('0x48')]=function(_0x16a9a5,_0xaa4d81){return db['DeskField']['create'](_0x16a9a5[_0xe5c0('0x49')],{})[_0xe5c0('0x26')](respondWithResult(_0xaa4d81,0xc9))[_0xe5c0('0x46')](handleError(_0xaa4d81,null));};exports[_0xe5c0('0x24')]=function(_0x1c85e5,_0x5db208){if(_0x1c85e5[_0xe5c0('0x49')]['id']){delete _0x1c85e5[_0xe5c0('0x49')]['id'];}return db[_0xe5c0('0x2c')][_0xe5c0('0x4a')]({'where':{'id':_0x1c85e5['params']['id']}})['then'](handleEntityNotFound(_0x5db208,null))[_0xe5c0('0x26')](saveUpdates(_0x1c85e5[_0xe5c0('0x49')],null))['then'](respondWithResult(_0x5db208,null))[_0xe5c0('0x46')](handleError(_0x5db208,null));};exports[_0xe5c0('0x25')]=function(_0x5f4f61,_0x3d8f12){return db[_0xe5c0('0x2c')][_0xe5c0('0x4a')]({'where':{'id':_0x5f4f61[_0xe5c0('0x47')]['id']}})[_0xe5c0('0x26')](handleEntityNotFound(_0x3d8f12,null))[_0xe5c0('0x26')](removeEntity(_0x3d8f12,null))[_0xe5c0('0x46')](handleError(_0x3d8f12,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index c5f57f6..169c691 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 _0x9ca7=['moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','DeskField','int_desk_fields','desk_unique_index','idField','FieldId','util','../../config/logger','api'];(function(_0x15b1ff,_0x128656){var _0x27dd2e=function(_0x3e54b9){while(--_0x3e54b9){_0x15b1ff['push'](_0x15b1ff['shift']());}};_0x27dd2e(++_0x128656);}(_0x9ca7,0x1bd));var _0x79ca=function(_0x16fe0c,_0x1143b5){_0x16fe0c=_0x16fe0c-0x0;var _0x20c315=_0x9ca7[_0x16fe0c];return _0x20c315;};'use strict';var _=require('lodash');var util=require(_0x79ca('0x0'));var logger=require(_0x79ca('0x1'))(_0x79ca('0x2'));var moment=require(_0x79ca('0x3'));var BPromise=require(_0x79ca('0x4'));var rp=require(_0x79ca('0x5'));var fs=require('fs');var path=require(_0x79ca('0x6'));var rimraf=require(_0x79ca('0x7'));var config=require(_0x79ca('0x8'));var attributes=require('./intDeskField.attributes');module[_0x79ca('0x9')]=function(_0x52f17b,_0x313d23){return _0x52f17b[_0x79ca('0xa')](_0x79ca('0xb'),attributes,{'tableName':_0x79ca('0xc'),'paranoid':![],'indexes':[{'name':_0x79ca('0xd'),'fields':[_0x79ca('0xe'),_0x79ca('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x749e=['define','DeskField','int_desk_fields','desk_unique_index','idField','FieldId','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./intDeskField.attributes','exports'];(function(_0x5614fb,_0x57e908){var _0x1bc73d=function(_0x1c4d0d){while(--_0x1c4d0d){_0x5614fb['push'](_0x5614fb['shift']());}};_0x1bc73d(++_0x57e908);}(_0x749e,0x8d));var _0xe749=function(_0x4a43af,_0x4fc360){_0x4a43af=_0x4a43af-0x0;var _0x3f9cb3=_0x749e[_0x4a43af];return _0x3f9cb3;};'use strict';var _=require('lodash');var util=require(_0xe749('0x0'));var logger=require(_0xe749('0x1'))(_0xe749('0x2'));var moment=require(_0xe749('0x3'));var BPromise=require(_0xe749('0x4'));var rp=require(_0xe749('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xe749('0x6'));var attributes=require(_0xe749('0x7'));module[_0xe749('0x8')]=function(_0x3fba17,_0x4e7f63){return _0x3fba17[_0xe749('0x9')](_0xe749('0xa'),attributes,{'tableName':_0xe749('0xb'),'paranoid':![],'indexes':[{'name':_0xe749('0xc'),'fields':[_0xe749('0xd'),_0xe749('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 f5251a0..0208a5d 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 _0x565c=['DeskField,\x20%s,\x20%s','request\x20sent','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','request','then'];(function(_0x8bf2e3,_0x32b29d){var _0x5e7352=function(_0x4a6733){while(--_0x4a6733){_0x8bf2e3['push'](_0x8bf2e3['shift']());}};_0x5e7352(++_0x32b29d);}(_0x565c,0x73));var _0xc565=function(_0x171108,_0x183b92){_0x171108=_0x171108-0x0;var _0x27e44d=_0x565c[_0x171108];return _0x27e44d;};'use strict';var _=require(_0xc565('0x0'));var util=require(_0xc565('0x1'));var moment=require(_0xc565('0x2'));var BPromise=require(_0xc565('0x3'));var rs=require(_0xc565('0x4'));var fs=require('fs');var Redis=require(_0xc565('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xc565('0x6'));var config=require(_0xc565('0x7'));var jayson=require(_0xc565('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x226477,_0x4959ff,_0x2d8278){return new BPromise(function(_0x228e36,_0x1c3147){return client[_0xc565('0x9')](_0x226477,_0x2d8278)[_0xc565('0xa')](function(_0x3841c7){logger['info'](_0xc565('0xb'),_0x4959ff,_0xc565('0xc'));logger['debug'](_0xc565('0xd'),_0x4959ff,_0xc565('0xc'),JSON[_0xc565('0xe')](_0x3841c7));if(_0x3841c7[_0xc565('0xf')]){if(_0x3841c7[_0xc565('0xf')][_0xc565('0x10')]===0x1f4){logger[_0xc565('0xf')](_0xc565('0xb'),_0x4959ff,_0x3841c7[_0xc565('0xf')]['message']);return _0x1c3147(_0x3841c7['error']['message']);}logger['error'](_0xc565('0xb'),_0x4959ff,_0x3841c7[_0xc565('0xf')]['message']);return _0x228e36(_0x3841c7[_0xc565('0xf')][_0xc565('0x11')]);}else{logger[_0xc565('0x12')](_0xc565('0xb'),_0x4959ff,_0xc565('0xc'));_0x228e36(_0x3841c7[_0xc565('0x13')][_0xc565('0x11')]);}})[_0xc565('0x14')](function(_0x2818bd){logger[_0xc565('0xf')](_0xc565('0xb'),_0x4959ff,_0x2818bd);_0x1c3147(_0x2818bd);});});} \ No newline at end of file +var _0x1953=['error','code','message','info','result','lodash','util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','client','http','request','DeskField,\x20%s,\x20%s','debug','request\x20sent','stringify'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x1953,0x9d));var _0x3195=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x1953[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x3195('0x0'));var util=require(_0x3195('0x1'));var moment=require('moment');var BPromise=require(_0x3195('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3195('0x3'));var db=require(_0x3195('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3195('0x5'))(_0x3195('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3195('0x7')][_0x3195('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x421ddd,_0x53afbe,_0x69f849){return new BPromise(function(_0x59896b,_0x448d57){return client[_0x3195('0x9')](_0x421ddd,_0x69f849)['then'](function(_0x6b29e9){logger['info'](_0x3195('0xa'),_0x53afbe,'request\x20sent');logger[_0x3195('0xb')]('DeskField,\x20%s,\x20%s,\x20%s',_0x53afbe,_0x3195('0xc'),JSON[_0x3195('0xd')](_0x6b29e9));if(_0x6b29e9['error']){if(_0x6b29e9[_0x3195('0xe')][_0x3195('0xf')]===0x1f4){logger[_0x3195('0xe')](_0x3195('0xa'),_0x53afbe,_0x6b29e9[_0x3195('0xe')][_0x3195('0x10')]);return _0x448d57(_0x6b29e9[_0x3195('0xe')]['message']);}logger[_0x3195('0xe')](_0x3195('0xa'),_0x53afbe,_0x6b29e9[_0x3195('0xe')][_0x3195('0x10')]);return _0x59896b(_0x6b29e9['error']['message']);}else{logger[_0x3195('0x11')](_0x3195('0xa'),_0x53afbe,_0x3195('0xc'));_0x59896b(_0x6b29e9[_0x3195('0x12')]['message']);}})['catch'](function(_0x33f3fd){logger[_0x3195('0xe')](_0x3195('0xa'),_0x53afbe,_0x33f3fd);_0x448d57(_0x33f3fd);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index e81ff2c..274f049 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 _0x40be=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','/:id/fields','post','/:id/configurations','addConfiguration','put','delete'];(function(_0x205330,_0x255a0d){var _0x2e671e=function(_0xaa4647){while(--_0xaa4647){_0x205330['push'](_0x205330['shift']());}};_0x2e671e(++_0x255a0d);}(_0x40be,0xe8));var _0xe40b=function(_0x14da25,_0x106d33){_0x14da25=_0x14da25-0x0;var _0x3f53c0=_0x40be[_0x14da25];return _0x3f53c0;};'use strict';var multer=require(_0xe40b('0x0'));var util=require(_0xe40b('0x1'));var path=require(_0xe40b('0x2'));var timeout=require(_0xe40b('0x3'));var express=require(_0xe40b('0x4'));var router=express[_0xe40b('0x5')]();var fs_extra=require(_0xe40b('0x6'));var auth=require(_0xe40b('0x7'));var interaction=require(_0xe40b('0x8'));var config=require(_0xe40b('0x9'));var controller=require('./intDynamics365Account.controller');router['get']('/',auth[_0xe40b('0xa')](),controller[_0xe40b('0xb')]);router[_0xe40b('0xc')](_0xe40b('0xd'),auth['isAuthenticated'](),controller[_0xe40b('0xe')]);router[_0xe40b('0xc')]('/:id/configurations',auth['isAuthenticated'](),controller['getConfigurations']);router[_0xe40b('0xc')](_0xe40b('0xf'),auth[_0xe40b('0xa')](),controller['getFields']);router[_0xe40b('0x10')]('/',auth[_0xe40b('0xa')](),controller['create']);router[_0xe40b('0x10')](_0xe40b('0x11'),auth[_0xe40b('0xa')](),controller[_0xe40b('0x12')]);router[_0xe40b('0x13')](_0xe40b('0xd'),auth[_0xe40b('0xa')](),controller['update']);router[_0xe40b('0x14')](_0xe40b('0xd'),auth['isAuthenticated'](),controller[_0xe40b('0x15')]);module[_0xe40b('0x16')]=router; \ No newline at end of file +var _0xb696=['getFields','post','create','put','/:id','delete','destroy','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','/:id/configurations','getConfigurations','/:id/fields'];(function(_0x4ed17b,_0x2b1745){var _0x24b248=function(_0x136ab1){while(--_0x136ab1){_0x4ed17b['push'](_0x4ed17b['shift']());}};_0x24b248(++_0x2b1745);}(_0xb696,0xd9));var _0x6b69=function(_0x1544c7,_0x52670b){_0x1544c7=_0x1544c7-0x0;var _0x1a350d=_0xb696[_0x1544c7];return _0x1a350d;};'use strict';var multer=require(_0x6b69('0x0'));var util=require('util');var path=require(_0x6b69('0x1'));var timeout=require(_0x6b69('0x2'));var express=require('express');var router=express[_0x6b69('0x3')]();var fs_extra=require(_0x6b69('0x4'));var auth=require(_0x6b69('0x5'));var interaction=require(_0x6b69('0x6'));var config=require(_0x6b69('0x7'));var controller=require('./intDynamics365Account.controller');router[_0x6b69('0x8')]('/',auth['isAuthenticated'](),controller[_0x6b69('0x9')]);router[_0x6b69('0x8')]('/:id',auth[_0x6b69('0xa')](),controller['show']);router['get'](_0x6b69('0xb'),auth[_0x6b69('0xa')](),controller[_0x6b69('0xc')]);router[_0x6b69('0x8')](_0x6b69('0xd'),auth[_0x6b69('0xa')](),controller[_0x6b69('0xe')]);router[_0x6b69('0xf')]('/',auth['isAuthenticated'](),controller[_0x6b69('0x10')]);router[_0x6b69('0xf')](_0x6b69('0xb'),auth[_0x6b69('0xa')](),controller['addConfiguration']);router[_0x6b69('0x11')](_0x6b69('0x12'),auth[_0x6b69('0xa')](),controller['update']);router[_0x6b69('0x13')](_0x6b69('0x12'),auth[_0x6b69('0xa')](),controller[_0x6b69('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index c5d1407..6d9f56d 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 _0xa261=['STRING','BOOLEAN','sequelize'];(function(_0x5e7ba9,_0xeae2ee){var _0x1161a4=function(_0x1c9be6){while(--_0x1c9be6){_0x5e7ba9['push'](_0x5e7ba9['shift']());}};_0x1161a4(++_0xeae2ee);}(_0xa261,0x1a3));var _0x1a26=function(_0x3c10f9,_0x34eba2){_0x3c10f9=_0x3c10f9-0x0;var _0x2a44a7=_0xa261[_0x3c10f9];return _0x2a44a7;};'use strict';var Sequelize=require(_0x1a26('0x0'));module['exports']={'name':{'type':Sequelize[_0x1a26('0x1')]},'username':{'type':Sequelize[_0x1a26('0x1')]},'password':{'type':Sequelize[_0x1a26('0x1')]},'remoteUri':{'type':Sequelize[_0x1a26('0x1')]},'tenantId':{'type':Sequelize[_0x1a26('0x1')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x1a26('0x1')]},'modernAuthentication':{'type':Sequelize[_0x1a26('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0xd493=['STRING','sequelize'];(function(_0x33af39,_0x42f371){var _0x2192bb=function(_0x94a3ea){while(--_0x94a3ea){_0x33af39['push'](_0x33af39['shift']());}};_0x2192bb(++_0x42f371);}(_0xd493,0x1bd));var _0x3d49=function(_0xbca777,_0x242a64){_0xbca777=_0xbca777-0x0;var _0x20c416=_0xd493[_0xbca777];return _0x20c416;};'use strict';var Sequelize=require(_0x3d49('0x0'));module['exports']={'name':{'type':Sequelize[_0x3d49('0x1')]},'username':{'type':Sequelize[_0x3d49('0x1')]},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x3d49('0x1')]},'tenantId':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0x3d49('0x1')]},'serverUrl':{'type':Sequelize[_0x3d49('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index 68e8220..c40a228 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 _0x0522=['offset','limit','status','Content-Range','update','then','end','error','stack','name','send','Dynamics365Account','rawAttributes','fieldName','model','map','query','filters','attributes','intersection','length','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','catch','params','keys','fields','find','body','destroy','getConfigurations','hasOwnProperty','nolimit','addConfiguration','findOne','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','Dynamics365Configuration','create','Dynamics365Field','substring','lastIndexOf','%s/api/data/v9.0/','getFields','incident','Incident','PhoneCall','title','description','customerid','ownerid','subject','phonenumber','regardingobjectid','directioncode','phonecall_activity_parties','accountidname','accountidyominame','actualserviceunits','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridtype','customeridyominame','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_iotalertname','onholdtime','overriddencreatedon','owneridname','owneridtype','owneridyominame','parentcaseidname','primarycontactidname','prioritycodename','productserialnumber','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','socialprofileidname','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','traversedpath','username','remoteUri','clientId','clientSecret','modernAuthentication','CloudProvider','data5','data7','access_token','https://login.microsoftonline.com/','tenantId','/oauth2/token','password','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','value','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','4.0','LogicalName','forEach','@odata.type','push','MetadataId','isNil','BooleanAttributeMetadata','all','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','concat','test','statusCode','Wrong\x20credentials',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','UserLocalizedLabel','Label','Value','DisplayName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','true','FalseOption','false',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','request-promise','lodash','../../components/parsers/qs','../../config/logger','api','../../mysqldb','../../components/integrations/configuration','json','count'];(function(_0x25fd34,_0x3ab768){var _0x3e83dc=function(_0x291aca){while(--_0x291aca){_0x25fd34['push'](_0x25fd34['shift']());}};_0x3e83dc(++_0x3ab768);}(_0x0522,0x171));var _0x2052=function(_0x2fedfa,_0x51fc4b){_0x2fedfa=_0x2fedfa-0x0;var _0x2bcc21=_0x0522[_0x2fedfa];return _0x2bcc21;};'use strict';var rp=require(_0x2052('0x0'));var util=require('util');var _=require(_0x2052('0x1'));var qs=require(_0x2052('0x2'));var logger=require(_0x2052('0x3'))(_0x2052('0x4'));var db=require(_0x2052('0x5'))['db'];var integrations=require(_0x2052('0x6'));function respondWithResult(_0x24224e,_0x1e2b96){_0x1e2b96=_0x1e2b96||0xc8;return function(_0x275836){if(_0x275836){return _0x24224e['status'](_0x1e2b96)[_0x2052('0x7')](_0x275836);}};}function respondWithFilteredResult(_0x3977b5,_0x47e90e){return function(_0x2c64f6){if(_0x2c64f6){var _0x431fb2=typeof _0x47e90e['offset']==='undefined'&&typeof _0x47e90e['limit']==='undefined';var _0x52d047=_0x2c64f6[_0x2052('0x8')];var _0x40d8b2=_0x431fb2?0x0:_0x47e90e[_0x2052('0x9')];var _0x51e9ce=_0x431fb2?_0x2c64f6[_0x2052('0x8')]:_0x47e90e['offset']+_0x47e90e[_0x2052('0xa')];var _0x398133;if(_0x51e9ce>=_0x52d047){_0x51e9ce=_0x52d047;_0x398133=0xc8;}else{_0x398133=0xce;}_0x3977b5[_0x2052('0xb')](_0x398133);return _0x3977b5['set'](_0x2052('0xc'),_0x40d8b2+'-'+_0x51e9ce+'/'+_0x52d047)[_0x2052('0x7')](_0x2c64f6);}return null;};}function saveUpdates(_0x8e72a0){return function(_0xdeb7d1){if(_0xdeb7d1){return _0xdeb7d1[_0x2052('0xd')](_0x8e72a0)[_0x2052('0xe')](function(_0x4ee2ac){return _0x4ee2ac;});}return null;};}function removeEntity(_0x53ca81){return function(_0x38f998){if(_0x38f998){return _0x38f998['destroy']()[_0x2052('0xe')](function(){_0x53ca81[_0x2052('0xb')](0xcc)[_0x2052('0xf')]();});}};}function handleEntityNotFound(_0x2b467c){return function(_0x5670aa){if(!_0x5670aa){_0x2b467c['sendStatus'](0x194);}return _0x5670aa;};}function handleError(_0x3f65c1,_0x4c4e60){_0x4c4e60=_0x4c4e60||0x1f4;return function(_0x30d5d3){logger[_0x2052('0x10')](_0x30d5d3[_0x2052('0x11')]);if(_0x30d5d3[_0x2052('0x12')]){delete _0x30d5d3[_0x2052('0x12')];}_0x3f65c1[_0x2052('0xb')](_0x4c4e60)[_0x2052('0x13')](_0x30d5d3);};}exports['index']=function(_0x127390,_0x1fba60){var _0xfcf302={},_0x1f92a3={},_0x25a014={'count':0x0,'rows':[]};var _0xf945a9=_['map'](db[_0x2052('0x14')][_0x2052('0x15')],function(_0xdb4039){return{'name':_0xdb4039[_0x2052('0x16')],'type':_0xdb4039['type']['key']};});_0x1f92a3[_0x2052('0x17')]=_[_0x2052('0x18')](_0xf945a9,_0x2052('0x12'));_0x1f92a3[_0x2052('0x19')]=_['keys'](_0x127390[_0x2052('0x19')]);_0x1f92a3[_0x2052('0x1a')]=_['intersection'](_0x1f92a3['model'],_0x1f92a3[_0x2052('0x19')]);_0xfcf302[_0x2052('0x1b')]=_[_0x2052('0x1c')](_0x1f92a3['model'],qs['fields'](_0x127390[_0x2052('0x19')]['fields']));_0xfcf302[_0x2052('0x1b')]=_0xfcf302[_0x2052('0x1b')][_0x2052('0x1d')]?_0xfcf302[_0x2052('0x1b')]:_0x1f92a3[_0x2052('0x17')];if(!_0x127390[_0x2052('0x19')]['hasOwnProperty']('nolimit')){_0xfcf302[_0x2052('0xa')]=qs['limit'](_0x127390[_0x2052('0x19')][_0x2052('0xa')]);_0xfcf302['offset']=qs['offset'](_0x127390[_0x2052('0x19')][_0x2052('0x9')]);}_0xfcf302[_0x2052('0x1e')]=qs['sort'](_0x127390[_0x2052('0x19')][_0x2052('0x1f')]);_0xfcf302[_0x2052('0x20')]=qs[_0x2052('0x1a')](_[_0x2052('0x21')](_0x127390['query'],_0x1f92a3[_0x2052('0x1a')]),_0xf945a9);if(_0x127390[_0x2052('0x19')][_0x2052('0x22')]){_0xfcf302[_0x2052('0x20')]=_[_0x2052('0x23')](_0xfcf302[_0x2052('0x20')],{'$or':_[_0x2052('0x18')](_0xf945a9,function(_0x32e855){if(_0x32e855[_0x2052('0x24')]!==_0x2052('0x25')){var _0x4ee4c1={};_0x4ee4c1[_0x32e855[_0x2052('0x12')]]={'$like':'%'+_0x127390[_0x2052('0x19')][_0x2052('0x22')]+'%'};return _0x4ee4c1;}})});}_0xfcf302=_[_0x2052('0x23')]({},_0xfcf302,_0x127390[_0x2052('0x26')]);var _0x578e1c={'where':_0xfcf302['where']};return db['Dynamics365Account'][_0x2052('0x8')](_0x578e1c)['then'](function(_0x495cdc){_0x25a014[_0x2052('0x8')]=_0x495cdc;if(_0x127390[_0x2052('0x19')][_0x2052('0x27')]){_0xfcf302[_0x2052('0x28')]=[{'all':!![]}];}return db[_0x2052('0x14')][_0x2052('0x29')](_0xfcf302);})[_0x2052('0xe')](function(_0x296cab){_0x25a014['rows']=_0x296cab;return _0x25a014;})[_0x2052('0xe')](respondWithFilteredResult(_0x1fba60,_0xfcf302))[_0x2052('0x2a')](handleError(_0x1fba60,null));};exports['show']=function(_0x8da61,_0x224e2c){var _0x10d6ce={'raw':![],'where':{'id':_0x8da61[_0x2052('0x2b')]['id']}},_0x1e7926={};_0x1e7926[_0x2052('0x17')]=_[_0x2052('0x2c')](db[_0x2052('0x14')][_0x2052('0x15')]);_0x1e7926['query']=_['keys'](_0x8da61[_0x2052('0x19')]);_0x1e7926[_0x2052('0x1a')]=_[_0x2052('0x1c')](_0x1e7926[_0x2052('0x17')],_0x1e7926[_0x2052('0x19')]);_0x10d6ce[_0x2052('0x1b')]=_[_0x2052('0x1c')](_0x1e7926[_0x2052('0x17')],qs[_0x2052('0x2d')](_0x8da61[_0x2052('0x19')][_0x2052('0x2d')]));_0x10d6ce[_0x2052('0x1b')]=_0x10d6ce[_0x2052('0x1b')][_0x2052('0x1d')]?_0x10d6ce['attributes']:_0x1e7926['model'];if(_0x8da61[_0x2052('0x19')][_0x2052('0x27')]){_0x10d6ce[_0x2052('0x28')]=[{'all':!![]}];}_0x10d6ce=_['merge']({},_0x10d6ce,_0x8da61[_0x2052('0x26')]);return db['Dynamics365Account'][_0x2052('0x2e')](_0x10d6ce)[_0x2052('0xe')](handleEntityNotFound(_0x224e2c,null))[_0x2052('0xe')](respondWithResult(_0x224e2c,null))[_0x2052('0x2a')](handleError(_0x224e2c,null));};exports['create']=function(_0x4f78f6,_0x42de46){return db[_0x2052('0x14')]['create'](_0x4f78f6['body'],{})['then'](respondWithResult(_0x42de46,0xc9))[_0x2052('0x2a')](handleError(_0x42de46,null));};exports[_0x2052('0xd')]=function(_0x1a0a6a,_0x275d92){if(_0x1a0a6a[_0x2052('0x2f')]['id']){delete _0x1a0a6a['body']['id'];}return db['Dynamics365Account'][_0x2052('0x2e')]({'where':{'id':_0x1a0a6a[_0x2052('0x2b')]['id']}})[_0x2052('0xe')](handleEntityNotFound(_0x275d92,null))['then'](saveUpdates(_0x1a0a6a[_0x2052('0x2f')],null))['then'](respondWithResult(_0x275d92,null))[_0x2052('0x2a')](handleError(_0x275d92,null));};exports[_0x2052('0x30')]=function(_0x140f81,_0x20d4c7){return db[_0x2052('0x14')][_0x2052('0x2e')]({'where':{'id':_0x140f81[_0x2052('0x2b')]['id']}})[_0x2052('0xe')](handleEntityNotFound(_0x20d4c7,null))['then'](removeEntity(_0x20d4c7,null))[_0x2052('0x2a')](handleError(_0x20d4c7,null));};exports['getConfigurations']=function(_0x1e63d5,_0x3bfb2b){var _0x53766b={};var _0x57b2c5={};var _0x426c07;var _0x4dca21;return db['Dynamics365Account']['findOne']({'where':{'id':_0x1e63d5[_0x2052('0x2b')]['id']}})['then'](handleEntityNotFound(_0x3bfb2b,null))[_0x2052('0xe')](function(_0x1781d5){if(_0x1781d5){_0x426c07=_0x1781d5;_0x57b2c5[_0x2052('0x17')]=_[_0x2052('0x2c')](db['Dynamics365Configuration'][_0x2052('0x15')]);_0x57b2c5[_0x2052('0x19')]=_['keys'](_0x1e63d5[_0x2052('0x19')]);_0x57b2c5[_0x2052('0x1a')]=_[_0x2052('0x1c')](_0x57b2c5[_0x2052('0x17')],_0x57b2c5[_0x2052('0x19')]);_0x53766b[_0x2052('0x1b')]=_['intersection'](_0x57b2c5[_0x2052('0x17')],qs[_0x2052('0x2d')](_0x1e63d5[_0x2052('0x19')][_0x2052('0x2d')]));_0x53766b[_0x2052('0x1b')]=_0x53766b[_0x2052('0x1b')][_0x2052('0x1d')]?_0x53766b[_0x2052('0x1b')]:_0x57b2c5[_0x2052('0x17')];_0x53766b[_0x2052('0x1e')]=qs[_0x2052('0x1f')](_0x1e63d5[_0x2052('0x19')]['sort']);_0x53766b['where']=qs[_0x2052('0x1a')](_[_0x2052('0x21')](_0x1e63d5[_0x2052('0x19')],_0x57b2c5[_0x2052('0x1a')]));if(_0x1e63d5[_0x2052('0x19')]['filter']){_0x53766b[_0x2052('0x20')]=_[_0x2052('0x23')](_0x53766b['where'],{'$or':_[_0x2052('0x18')](_0x53766b[_0x2052('0x1b')],function(_0x59e016){var _0x4a36e8={};_0x4a36e8[_0x59e016]={'$like':'%'+_0x1e63d5[_0x2052('0x19')]['filter']+'%'};return _0x4a36e8;})});}_0x53766b=_[_0x2052('0x23')]({},_0x53766b,_0x1e63d5[_0x2052('0x26')]);return _0x426c07[_0x2052('0x31')](_0x53766b);}})[_0x2052('0xe')](function(_0x1bdfac){if(_0x1bdfac){_0x4dca21=_0x1bdfac['length'];if(!_0x1e63d5[_0x2052('0x19')][_0x2052('0x32')](_0x2052('0x33'))){_0x53766b[_0x2052('0xa')]=qs[_0x2052('0xa')](_0x1e63d5[_0x2052('0x19')][_0x2052('0xa')]);_0x53766b['offset']=qs[_0x2052('0x9')](_0x1e63d5['query'][_0x2052('0x9')]);}return _0x426c07[_0x2052('0x31')](_0x53766b);}})[_0x2052('0xe')](function(_0x32716a){if(_0x32716a){return _0x32716a?{'count':_0x4dca21,'rows':_0x32716a}:null;}})[_0x2052('0xe')](respondWithResult(_0x3bfb2b,null))[_0x2052('0x2a')](handleError(_0x3bfb2b,null));};exports[_0x2052('0x34')]=function(_0x482d21,_0x4cc9d6){if(_0x482d21[_0x2052('0x2f')]['id']){delete _0x482d21[_0x2052('0x2f')]['id'];}return db[_0x2052('0x14')][_0x2052('0x35')]({'where':{'id':_0x482d21['params']['id']}})['then'](handleEntityNotFound(_0x4cc9d6,null))[_0x2052('0xe')](function(_0x1c11cd){if(_0x1c11cd){_0x482d21[_0x2052('0x2f')][_0x2052('0x36')]=_0x1c11cd['id'];_0x482d21[_0x2052('0x2f')][_0x2052('0x37')]=integrations[_0x2052('0x38')](_0x482d21[_0x2052('0x2f')]['channel'],_0x482d21[_0x2052('0x2f')]['type']);_0x482d21[_0x2052('0x2f')][_0x2052('0x39')]=integrations[_0x2052('0x3a')](_0x482d21[_0x2052('0x2f')][_0x2052('0x3b')],_0x482d21['body']['type']);return db[_0x2052('0x3c')][_0x2052('0x3d')](_0x482d21['body'],{'include':[{'model':db[_0x2052('0x3e')],'as':_0x2052('0x37')},{'model':db[_0x2052('0x3e')],'as':_0x2052('0x39')}]});}return null;})['then'](respondWithResult(_0x4cc9d6,null))[_0x2052('0x2a')](handleError(_0x4cc9d6,null));};function sanitizeRemoteUri(_0x474c8e){var _0x249647=_0x474c8e['slice'](-0x1);if(_0x249647==='/')return _0x474c8e[_0x2052('0x3f')](0x0,_0x474c8e[_0x2052('0x40')](_0x249647));return _0x474c8e;}function getWebApiUrl(_0x2dd33f){return util['format'](_0x2052('0x41'),_0x2dd33f);}exports[_0x2052('0x42')]=function(_0x24ad15,_0x421207){var _0x544619=_0x24ad15['query']['ticketType'];var _0x36cdcd=_0x544619===_0x2052('0x43')?_0x2052('0x44'):_0x2052('0x45');var _0xd82a79='';var _0x5842ab='';var _0x5a0821='';var _0x30a50c='';var _0x10f6e0='';var _0x8e717b='';var _0x2bad4d='';var _0x266d2e='';var _0x8338ae=[_0x2052('0x46'),_0x2052('0x47'),_0x2052('0x48'),_0x2052('0x49'),'caseorigincode',_0x2052('0x4a'),_0x2052('0x4b'),_0x2052('0x4c'),_0x2052('0x4d'),_0x2052('0x4e')];var _0x27ac9e=[_0x2052('0x4f'),_0x2052('0x50'),_0x2052('0x51'),'billedserviceunits','contactidname','contactidyominame',_0x2052('0x52'),_0x2052('0x53'),_0x2052('0x54'),_0x2052('0x55'),_0x2052('0x56'),_0x2052('0x57'),_0x2052('0x58'),_0x2052('0x59'),_0x2052('0x5a'),'customeridname',_0x2052('0x5b'),_0x2052('0x5c'),_0x2052('0x5d'),_0x2052('0x5e'),_0x2052('0x5f'),_0x2052('0x60'),'escalatedon',_0x2052('0x61'),_0x2052('0x62'),_0x2052('0x63'),_0x2052('0x64'),'influencescore',_0x2052('0x65'),_0x2052('0x66'),_0x2052('0x67'),_0x2052('0x68'),_0x2052('0x69'),'modifiedbyname',_0x2052('0x6a'),_0x2052('0x6b'),_0x2052('0x6c'),_0x2052('0x6d'),'msdyn_incidenttypename',_0x2052('0x6e'),'numberofchildincidents',_0x2052('0x6f'),_0x2052('0x70'),_0x2052('0x71'),_0x2052('0x72'),_0x2052('0x73'),_0x2052('0x74'),_0x2052('0x75'),'primarycontactidyominame',_0x2052('0x76'),'productidname',_0x2052('0x77'),'resolveby',_0x2052('0x78'),_0x2052('0x79'),_0x2052('0x7a'),_0x2052('0x7b'),_0x2052('0x7c'),_0x2052('0x7d'),_0x2052('0x7e'),_0x2052('0x7f'),'statecode',_0x2052('0x80'),_0x2052('0x81'),_0x2052('0x82'),_0x2052('0x83'),'transactioncurrencyidname',_0x2052('0x84'),'utcconversiontimezonecode','versionnumber'];var _0x56ee8c=_0x8338ae['concat'](_0x27ac9e);return db[_0x2052('0x14')][_0x2052('0x35')]({'where':{'id':_0x24ad15[_0x2052('0x2b')]['id']},'attributes':['id',_0x2052('0x85'),'password',_0x2052('0x86'),'tenantId',_0x2052('0x87'),_0x2052('0x88'),_0x2052('0x89')],'include':[{'model':db[_0x2052('0x8a')],'as':_0x2052('0x8a'),'attributes':['id',_0x2052('0x8b'),_0x2052('0x8c')]}]})['then'](handleEntityNotFound(_0x421207,null))[_0x2052('0xe')](function(_0x1e7a55){if(_0x1e7a55){if(_0x1e7a55[_0x2052('0x89')]){_0x1e7a55[_0x2052('0x8d')]=_0x1e7a55['CloudProvider'][_0x2052('0x8b')];_0x266d2e=sanitizeRemoteUri(_0x1e7a55['CloudProvider'][_0x2052('0x8c')]);_0x2bad4d=getWebApiUrl(_0x266d2e);return _0x1e7a55;}_0x266d2e=sanitizeRemoteUri(_0x1e7a55[_0x2052('0x86')]);_0x2bad4d=getWebApiUrl(_0x266d2e);var _0x33a9c1={'method':'POST','uri':_0x2052('0x8e')+_0x1e7a55[_0x2052('0x8f')]+_0x2052('0x90'),'form':{'client_id':_0x1e7a55[_0x2052('0x87')],'resource':_0x266d2e,'username':_0x1e7a55[_0x2052('0x85')],'password':_0x1e7a55[_0x2052('0x91')],'grant_type':_0x2052('0x91'),'client_secret':_0x1e7a55[_0x2052('0x88')]},'json':!![]};return rp(_0x33a9c1);}})[_0x2052('0xe')](function(_0xb36bf0){_0x8e717b=_0xb36bf0[_0x2052('0x8d')];var _0x524033={'method':_0x2052('0x92'),'uri':encodeURI(_0x2bad4d+_0x2052('0x93')+_0x36cdcd+'\x27'),'headers':{'Authorization':_0x2052('0x94')+_0x8e717b,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x524033);})[_0x2052('0xe')](function(_0x2dc9d6){var _0x3537fb=_0x2dc9d6[_0x2052('0x95')][0x0];var _0x2a7788=_0x3537fb['MetadataId'];var _0x5d0594={'method':_0x2052('0x92'),'uri':_0x2bad4d+_0x2052('0x96')+_0x2a7788+_0x2052('0x97'),'headers':{'Authorization':_0x2052('0x94')+_0x8e717b,'If-None-Match':null,'OData-Version':_0x2052('0x98')},'json':!![]};return rp(_0x5d0594);})['then'](function(_0x1ebfcb){_0xd82a79=_0x1ebfcb;_0x5842ab=_0xd82a79['Attributes'];_0x5842ab=_['remove'](_0x5842ab,function(_0x16baf1){return!_0x56ee8c['includes'](_0x16baf1[_0x2052('0x99')]);});var _0x3ef508=[];var _0xc4e418=[];_0x5842ab[_0x2052('0x9a')](function(_0x2257a4){if(_0x2257a4['@odata.type']){var _0x49fe9a=_0x2257a4[_0x2052('0x9b')][_0x2052('0x3f')](_0x2257a4[_0x2052('0x9b')][_0x2052('0x40')]('.')+0x1);if(_0x49fe9a==='PicklistAttributeMetadata'){_0x3ef508[_0x2052('0x9c')](getSelectList(_0x2bad4d,_0x544619,_0xc4e418,_0xd82a79[_0x2052('0x9d')],_0x2257a4['MetadataId'],_0x8e717b));}}});return Promise['all'](_0x3ef508);})[_0x2052('0xe')](function(_0x53f9ca){_0x5a0821=_0x53f9ca[0x0];var _0x30060f=[];var _0x387126=[];_0x5842ab['forEach'](function(_0x25144b){if(!_[_0x2052('0x9e')](_0x25144b[_0x2052('0x9b')])){var _0x2f6869=_0x25144b[_0x2052('0x9b')]['substring'](_0x25144b['@odata.type']['lastIndexOf']('.')+0x1);if(_0x2f6869===_0x2052('0x9f')){_0x30060f[_0x2052('0x9c')](getBooleanList(_0x2bad4d,_0x544619,_0x387126,_0xd82a79[_0x2052('0x9d')],_0x25144b[_0x2052('0x9d')],_0x8e717b));}}});return Promise[_0x2052('0xa0')](_0x30060f);})[_0x2052('0xe')](function(_0x520c1e){_0x30a50c=_0x520c1e[0x0];var _0x199d93=[];var _0x306ad3=[];_0x5842ab[_0x2052('0x9a')](function(_0x499290){if(_0x499290['@odata.type']){var _0x1a7ad3=_0x499290[_0x2052('0x9b')]['substring'](_0x499290[_0x2052('0x9b')][_0x2052('0x40')]('.')+0x1);if(_0x1a7ad3===_0x2052('0xa1')||_0x1a7ad3===_0x2052('0xa2')||_0x1a7ad3===_0x2052('0xa3')||_0x1a7ad3===_0x2052('0xa4')||_0x1a7ad3===_0x2052('0xa5')||_0x1a7ad3===_0x2052('0xa6')||_0x1a7ad3===_0x2052('0xa7')||_0x1a7ad3===_0x2052('0xa8')||_0x1a7ad3===_0x2052('0xa9')||_0x1a7ad3===_0x2052('0xaa')){_0x199d93[_0x2052('0x9c')](getInputList(_0x2bad4d,_0x544619,_0x1a7ad3,_0x306ad3,_0xd82a79['MetadataId'],_0x499290[_0x2052('0x9d')],_0x8e717b));}}});return Promise[_0x2052('0xa0')](_0x199d93);})[_0x2052('0xe')](function(_0x3f8f91){_0x10f6e0=_0x3f8f91[0x0];var _0x7eb949=_0x5a0821['concat'](_0x30a50c)[_0x2052('0xab')](_0x10f6e0);var _0x1a99aa={'count':_0x7eb949[_0x2052('0x1d')],'rows':_0x7eb949};return _0x1a99aa;})[_0x2052('0xe')](respondWithResult(_0x421207,null))[_0x2052('0x2a')](function(_0x52a67f){var _0x19baec=_0x24ad15[_0x2052('0x19')][_0x2052('0xac')]?0x1f4:_0x52a67f[_0x2052('0xad')]||0x1f4;logger[_0x2052('0x10')](_0x52a67f['stack']);delete _0x52a67f[_0x2052('0x12')];if(_0x19baec===0x191){_0x19baec=0x190;}_0x421207[_0x2052('0xb')](_0x19baec)['send'](_0x24ad15[_0x2052('0x19')][_0x2052('0xac')]?{'message':_0x2052('0xae'),'statusCode':_0x52a67f[_0x2052('0xad')]}:_0x52a67f);});};function getSelectList(_0x4efe6c,_0x5b0357,_0x13060e,_0x5bba60,_0xef03dc,_0x27f245){var _0x539abd={'method':'GET','uri':_0x4efe6c+_0x2052('0x96')+_0x5bba60+')/Attributes('+_0xef03dc+_0x2052('0xaf')+_0x2052('0xb0'),'headers':{'Authorization':'Bearer\x20'+_0x27f245,'If-None-Match':null,'OData-Version':_0x2052('0x98')},'json':!![]};return rp(_0x539abd)[_0x2052('0xe')](function(_0xe7e216){var _0x4ed9a5=[];var _0x1307fc=_0xe7e216[_0x2052('0xb1')][_0x2052('0xb2')];_0x1307fc['forEach'](function(_0x3b0336){_0x4ed9a5['push']({'name':_0x3b0336['Label'][_0x2052('0xb3')][_0x2052('0xb4')],'value':String(_0x3b0336[_0x2052('0xb5')])});});var _0x4b00ea={'id':_0x5b0357+'_'+_0xe7e216[_0x2052('0x99')],'name':_0xe7e216[_0x2052('0xb6')][_0x2052('0xb3')][_0x2052('0xb4')],'custom':![],'options':_0x4ed9a5};_0x13060e['push'](_0x4b00ea);return _0x13060e;});}function getBooleanList(_0xe5b4dc,_0x223f47,_0x18cee5,_0x74e1df,_0x35cba8,_0x24d194){var _0x3ff6f9={'method':'GET','uri':_0xe5b4dc+_0x2052('0x96')+_0x74e1df+')/Attributes('+_0x35cba8+_0x2052('0xb7'),'headers':{'Authorization':_0x2052('0x94')+_0x24d194,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x3ff6f9)[_0x2052('0xe')](function(_0x2c52d7){var _0xf84424=[];_0xf84424['push']({'name':_0x2c52d7[_0x2052('0xb1')]['TrueOption'][_0x2052('0xb4')][_0x2052('0xb3')]['Label'],'value':_0x2052('0xb8')},{'name':_0x2c52d7[_0x2052('0xb1')][_0x2052('0xb9')][_0x2052('0xb4')][_0x2052('0xb3')]['Label'],'value':_0x2052('0xba')});var _0x2f6886={'id':_0x223f47+'_'+_0x2c52d7['LogicalName'],'name':_0x2c52d7[_0x2052('0xb6')]['UserLocalizedLabel'][_0x2052('0xb4')],'custom':![],'options':_0xf84424};_0x18cee5[_0x2052('0x9c')](_0x2f6886);return _0x18cee5;});}function getInputList(_0x5882fb,_0x12b040,_0x4e9716,_0x4cbcae,_0x19e18f,_0x5618a9,_0x63c239){var _0x4c6fb0={'method':'GET','uri':_0x5882fb+_0x2052('0x96')+_0x19e18f+')/Attributes('+_0x5618a9+_0x2052('0xbb')+_0x4e9716+_0x2052('0xbc'),'headers':{'Authorization':'Bearer\x20'+_0x63c239,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x4c6fb0)[_0x2052('0xe')](function(_0x217b9b){var _0x5ba1f8={'id':_0x12b040+'_'+_0x217b9b[_0x2052('0x99')],'name':_0x217b9b[_0x2052('0xb6')][_0x2052('0xb3')]?_0x217b9b[_0x2052('0xb6')]['UserLocalizedLabel'][_0x2052('0xb4')]:_0x217b9b[_0x2052('0x99')],'custom':![],'options':[]};_0x4cbcae['push'](_0x5ba1f8);return _0x4cbcae;});} \ No newline at end of file +var _0x83e4=['addConfiguration','AccountId','Subjects','Dynamics365Field','Descriptions','substring','format','%s/api/data/v9.0/','getFields','ticketType','incident','Incident','PhoneCall','title','description','customerid','ownerid','subject','phonenumber','regardingobjectid','directioncode','phonecall_activity_parties','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contactidname','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdon','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','emailaddress','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','followupby','importsequencenumber','kbarticleidname','lastonholdtime','masteridname','modifiedbyexternalpartyname','modifiedbyname','modifiedbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','overriddencreatedon','owneridtype','owneridyominame','primarycontactidyominame','prioritycodename','productidname','productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slaname','statecode','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','utcconversiontimezonecode','username','password','tenantId','clientId','modernAuthentication','CloudProvider','data7','access_token','data5','remoteUri','POST','/oauth2/token','clientSecret','GET','Bearer\x20','value','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','includes','forEach','@odata.type','PicklistAttributeMetadata','push','BooleanAttributeMetadata','all','lastIndexOf','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','concat','statusCode','send',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','4.0','OptionSet','Label','Value','LogicalName','DisplayName','UserLocalizedLabel',')/Attributes(',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','FalseOption','false','?$select=DisplayName,LogicalName','request-promise','util','../../components/parsers/qs','../../config/logger','api','../../mysqldb','../../components/integrations/configuration','json','count','offset','limit','status','set','Content-Range','update','then','destroy','error','stack','name','map','Dynamics365Account','fieldName','type','model','keys','query','filters','attributes','intersection','fields','nolimit','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','findAll','rows','params','rawAttributes','length','options','catch','create','body','find','getConfigurations','findOne','Dynamics365Configuration','order','hasOwnProperty'];(function(_0x591cb8,_0x5085a6){var _0x412d33=function(_0x21925e){while(--_0x21925e){_0x591cb8['push'](_0x591cb8['shift']());}};_0x412d33(++_0x5085a6);}(_0x83e4,0x137));var _0x483e=function(_0x12bce2,_0x55a871){_0x12bce2=_0x12bce2-0x0;var _0x122727=_0x83e4[_0x12bce2];return _0x122727;};'use strict';var rp=require(_0x483e('0x0'));var util=require(_0x483e('0x1'));var _=require('lodash');var qs=require(_0x483e('0x2'));var logger=require(_0x483e('0x3'))(_0x483e('0x4'));var db=require(_0x483e('0x5'))['db'];var integrations=require(_0x483e('0x6'));function respondWithResult(_0x5d1fe3,_0x1a9eea){_0x1a9eea=_0x1a9eea||0xc8;return function(_0xee62a7){if(_0xee62a7){return _0x5d1fe3['status'](_0x1a9eea)[_0x483e('0x7')](_0xee62a7);}};}function respondWithFilteredResult(_0x68f59b,_0x1e0026){return function(_0x54dfc3){if(_0x54dfc3){var _0x5ef802=typeof _0x1e0026['offset']==='undefined'&&typeof _0x1e0026['limit']==='undefined';var _0x1c637=_0x54dfc3[_0x483e('0x8')];var _0x54ca57=_0x5ef802?0x0:_0x1e0026[_0x483e('0x9')];var _0x521844=_0x5ef802?_0x54dfc3[_0x483e('0x8')]:_0x1e0026[_0x483e('0x9')]+_0x1e0026[_0x483e('0xa')];var _0x17aa3c;if(_0x521844>=_0x1c637){_0x521844=_0x1c637;_0x17aa3c=0xc8;}else{_0x17aa3c=0xce;}_0x68f59b[_0x483e('0xb')](_0x17aa3c);return _0x68f59b[_0x483e('0xc')](_0x483e('0xd'),_0x54ca57+'-'+_0x521844+'/'+_0x1c637)[_0x483e('0x7')](_0x54dfc3);}return null;};}function saveUpdates(_0x27d143){return function(_0x1b0b22){if(_0x1b0b22){return _0x1b0b22[_0x483e('0xe')](_0x27d143)[_0x483e('0xf')](function(_0x2a41be){return _0x2a41be;});}return null;};}function removeEntity(_0x1b5dca){return function(_0x38858f){if(_0x38858f){return _0x38858f[_0x483e('0x10')]()[_0x483e('0xf')](function(){_0x1b5dca[_0x483e('0xb')](0xcc)['end']();});}};}function handleEntityNotFound(_0x594540){return function(_0x90e275){if(!_0x90e275){_0x594540['sendStatus'](0x194);}return _0x90e275;};}function handleError(_0x128c82,_0x40d81e){_0x40d81e=_0x40d81e||0x1f4;return function(_0x40633b){logger[_0x483e('0x11')](_0x40633b[_0x483e('0x12')]);if(_0x40633b[_0x483e('0x13')]){delete _0x40633b[_0x483e('0x13')];}_0x128c82['status'](_0x40d81e)['send'](_0x40633b);};}exports['index']=function(_0x4ccb2d,_0xc76848){var _0xb8d353={},_0x15fada={},_0x3c5684={'count':0x0,'rows':[]};var _0x467a8a=_[_0x483e('0x14')](db[_0x483e('0x15')]['rawAttributes'],function(_0x252edf){return{'name':_0x252edf[_0x483e('0x16')],'type':_0x252edf[_0x483e('0x17')]['key']};});_0x15fada[_0x483e('0x18')]=_[_0x483e('0x14')](_0x467a8a,_0x483e('0x13'));_0x15fada['query']=_[_0x483e('0x19')](_0x4ccb2d[_0x483e('0x1a')]);_0x15fada[_0x483e('0x1b')]=_['intersection'](_0x15fada[_0x483e('0x18')],_0x15fada['query']);_0xb8d353[_0x483e('0x1c')]=_[_0x483e('0x1d')](_0x15fada[_0x483e('0x18')],qs[_0x483e('0x1e')](_0x4ccb2d['query']['fields']));_0xb8d353['attributes']=_0xb8d353['attributes']['length']?_0xb8d353[_0x483e('0x1c')]:_0x15fada[_0x483e('0x18')];if(!_0x4ccb2d[_0x483e('0x1a')]['hasOwnProperty'](_0x483e('0x1f'))){_0xb8d353[_0x483e('0xa')]=qs['limit'](_0x4ccb2d[_0x483e('0x1a')]['limit']);_0xb8d353[_0x483e('0x9')]=qs[_0x483e('0x9')](_0x4ccb2d[_0x483e('0x1a')][_0x483e('0x9')]);}_0xb8d353['order']=qs[_0x483e('0x20')](_0x4ccb2d['query'][_0x483e('0x20')]);_0xb8d353[_0x483e('0x21')]=qs['filters'](_[_0x483e('0x22')](_0x4ccb2d[_0x483e('0x1a')],_0x15fada[_0x483e('0x1b')]),_0x467a8a);if(_0x4ccb2d[_0x483e('0x1a')]['filter']){_0xb8d353[_0x483e('0x21')]=_[_0x483e('0x23')](_0xb8d353[_0x483e('0x21')],{'$or':_[_0x483e('0x14')](_0x467a8a,function(_0xf482e0){if(_0xf482e0[_0x483e('0x17')]!==_0x483e('0x24')){var _0x515ca7={};_0x515ca7[_0xf482e0['name']]={'$like':'%'+_0x4ccb2d[_0x483e('0x1a')][_0x483e('0x25')]+'%'};return _0x515ca7;}})});}_0xb8d353=_['merge']({},_0xb8d353,_0x4ccb2d['options']);var _0x38a95a={'where':_0xb8d353['where']};return db['Dynamics365Account'][_0x483e('0x8')](_0x38a95a)[_0x483e('0xf')](function(_0x44dc1d){_0x3c5684[_0x483e('0x8')]=_0x44dc1d;if(_0x4ccb2d[_0x483e('0x1a')][_0x483e('0x26')]){_0xb8d353[_0x483e('0x27')]=[{'all':!![]}];}return db[_0x483e('0x15')][_0x483e('0x28')](_0xb8d353);})[_0x483e('0xf')](function(_0x59f54d){_0x3c5684[_0x483e('0x29')]=_0x59f54d;return _0x3c5684;})[_0x483e('0xf')](respondWithFilteredResult(_0xc76848,_0xb8d353))['catch'](handleError(_0xc76848,null));};exports['show']=function(_0x1ee499,_0x42b3e1){var _0x3bc4e2={'raw':![],'where':{'id':_0x1ee499[_0x483e('0x2a')]['id']}},_0x39b10b={};_0x39b10b[_0x483e('0x18')]=_[_0x483e('0x19')](db[_0x483e('0x15')][_0x483e('0x2b')]);_0x39b10b['query']=_['keys'](_0x1ee499[_0x483e('0x1a')]);_0x39b10b['filters']=_[_0x483e('0x1d')](_0x39b10b[_0x483e('0x18')],_0x39b10b[_0x483e('0x1a')]);_0x3bc4e2[_0x483e('0x1c')]=_[_0x483e('0x1d')](_0x39b10b['model'],qs[_0x483e('0x1e')](_0x1ee499['query'][_0x483e('0x1e')]));_0x3bc4e2['attributes']=_0x3bc4e2[_0x483e('0x1c')][_0x483e('0x2c')]?_0x3bc4e2['attributes']:_0x39b10b['model'];if(_0x1ee499[_0x483e('0x1a')]['includeAll']){_0x3bc4e2[_0x483e('0x27')]=[{'all':!![]}];}_0x3bc4e2=_['merge']({},_0x3bc4e2,_0x1ee499[_0x483e('0x2d')]);return db[_0x483e('0x15')]['find'](_0x3bc4e2)['then'](handleEntityNotFound(_0x42b3e1,null))[_0x483e('0xf')](respondWithResult(_0x42b3e1,null))[_0x483e('0x2e')](handleError(_0x42b3e1,null));};exports['create']=function(_0x42b5ed,_0x2d7d06){return db[_0x483e('0x15')][_0x483e('0x2f')](_0x42b5ed[_0x483e('0x30')],{})['then'](respondWithResult(_0x2d7d06,0xc9))[_0x483e('0x2e')](handleError(_0x2d7d06,null));};exports[_0x483e('0xe')]=function(_0x3c6d17,_0x430e41){if(_0x3c6d17[_0x483e('0x30')]['id']){delete _0x3c6d17[_0x483e('0x30')]['id'];}return db[_0x483e('0x15')][_0x483e('0x31')]({'where':{'id':_0x3c6d17[_0x483e('0x2a')]['id']}})[_0x483e('0xf')](handleEntityNotFound(_0x430e41,null))[_0x483e('0xf')](saveUpdates(_0x3c6d17[_0x483e('0x30')],null))[_0x483e('0xf')](respondWithResult(_0x430e41,null))[_0x483e('0x2e')](handleError(_0x430e41,null));};exports[_0x483e('0x10')]=function(_0x1bec5b,_0x15410b){return db['Dynamics365Account'][_0x483e('0x31')]({'where':{'id':_0x1bec5b[_0x483e('0x2a')]['id']}})[_0x483e('0xf')](handleEntityNotFound(_0x15410b,null))[_0x483e('0xf')](removeEntity(_0x15410b,null))[_0x483e('0x2e')](handleError(_0x15410b,null));};exports[_0x483e('0x32')]=function(_0x3418e6,_0x5a46cf){var _0x22595f={};var _0x4bab69={};var _0x18eaec;var _0x510f50;return db[_0x483e('0x15')][_0x483e('0x33')]({'where':{'id':_0x3418e6[_0x483e('0x2a')]['id']}})[_0x483e('0xf')](handleEntityNotFound(_0x5a46cf,null))[_0x483e('0xf')](function(_0xf6b80a){if(_0xf6b80a){_0x18eaec=_0xf6b80a;_0x4bab69['model']=_[_0x483e('0x19')](db[_0x483e('0x34')][_0x483e('0x2b')]);_0x4bab69[_0x483e('0x1a')]=_['keys'](_0x3418e6[_0x483e('0x1a')]);_0x4bab69['filters']=_['intersection'](_0x4bab69[_0x483e('0x18')],_0x4bab69[_0x483e('0x1a')]);_0x22595f[_0x483e('0x1c')]=_[_0x483e('0x1d')](_0x4bab69['model'],qs[_0x483e('0x1e')](_0x3418e6['query'][_0x483e('0x1e')]));_0x22595f[_0x483e('0x1c')]=_0x22595f[_0x483e('0x1c')][_0x483e('0x2c')]?_0x22595f[_0x483e('0x1c')]:_0x4bab69[_0x483e('0x18')];_0x22595f[_0x483e('0x35')]=qs[_0x483e('0x20')](_0x3418e6['query'][_0x483e('0x20')]);_0x22595f[_0x483e('0x21')]=qs[_0x483e('0x1b')](_['pick'](_0x3418e6['query'],_0x4bab69[_0x483e('0x1b')]));if(_0x3418e6[_0x483e('0x1a')]['filter']){_0x22595f[_0x483e('0x21')]=_[_0x483e('0x23')](_0x22595f['where'],{'$or':_['map'](_0x22595f[_0x483e('0x1c')],function(_0xd2fd1b){var _0x3e4a1c={};_0x3e4a1c[_0xd2fd1b]={'$like':'%'+_0x3418e6[_0x483e('0x1a')][_0x483e('0x25')]+'%'};return _0x3e4a1c;})});}_0x22595f=_[_0x483e('0x23')]({},_0x22595f,_0x3418e6['options']);return _0x18eaec['getConfigurations'](_0x22595f);}})[_0x483e('0xf')](function(_0x140c09){if(_0x140c09){_0x510f50=_0x140c09[_0x483e('0x2c')];if(!_0x3418e6[_0x483e('0x1a')][_0x483e('0x36')](_0x483e('0x1f'))){_0x22595f[_0x483e('0xa')]=qs[_0x483e('0xa')](_0x3418e6[_0x483e('0x1a')][_0x483e('0xa')]);_0x22595f[_0x483e('0x9')]=qs[_0x483e('0x9')](_0x3418e6[_0x483e('0x1a')][_0x483e('0x9')]);}return _0x18eaec[_0x483e('0x32')](_0x22595f);}})[_0x483e('0xf')](function(_0x3f464a){if(_0x3f464a){return _0x3f464a?{'count':_0x510f50,'rows':_0x3f464a}:null;}})[_0x483e('0xf')](respondWithResult(_0x5a46cf,null))[_0x483e('0x2e')](handleError(_0x5a46cf,null));};exports[_0x483e('0x37')]=function(_0x5f0d53,_0x1d0a4f){if(_0x5f0d53['body']['id']){delete _0x5f0d53[_0x483e('0x30')]['id'];}return db['Dynamics365Account'][_0x483e('0x33')]({'where':{'id':_0x5f0d53['params']['id']}})[_0x483e('0xf')](handleEntityNotFound(_0x1d0a4f,null))['then'](function(_0x2f52d8){if(_0x2f52d8){_0x5f0d53[_0x483e('0x30')][_0x483e('0x38')]=_0x2f52d8['id'];_0x5f0d53[_0x483e('0x30')][_0x483e('0x39')]=integrations['getSubjects'](_0x5f0d53[_0x483e('0x30')]['channel'],_0x5f0d53[_0x483e('0x30')]['type']);_0x5f0d53[_0x483e('0x30')]['Descriptions']=integrations['getDescriptions'](_0x5f0d53['body']['channel'],_0x5f0d53[_0x483e('0x30')]['type']);return db[_0x483e('0x34')][_0x483e('0x2f')](_0x5f0d53['body'],{'include':[{'model':db[_0x483e('0x3a')],'as':_0x483e('0x39')},{'model':db[_0x483e('0x3a')],'as':_0x483e('0x3b')}]});}return null;})[_0x483e('0xf')](respondWithResult(_0x1d0a4f,null))[_0x483e('0x2e')](handleError(_0x1d0a4f,null));};function sanitizeRemoteUri(_0x3ff81a){var _0x1ded2f=_0x3ff81a['slice'](-0x1);if(_0x1ded2f==='/')return _0x3ff81a[_0x483e('0x3c')](0x0,_0x3ff81a['lastIndexOf'](_0x1ded2f));return _0x3ff81a;}function getWebApiUrl(_0x326cc0){return util[_0x483e('0x3d')](_0x483e('0x3e'),_0x326cc0);}exports[_0x483e('0x3f')]=function(_0x529a39,_0x27a9c4){var _0x20687e=_0x529a39[_0x483e('0x1a')][_0x483e('0x40')];var _0xed169a=_0x20687e===_0x483e('0x41')?_0x483e('0x42'):_0x483e('0x43');var _0x52547e='';var _0x41e173='';var _0x7be30c='';var _0x43dbec='';var _0x517631='';var _0x5368a4='';var _0x25e55e='';var _0x11a125='';var _0x52e4cd=[_0x483e('0x44'),_0x483e('0x45'),_0x483e('0x46'),_0x483e('0x47'),'caseorigincode',_0x483e('0x48'),_0x483e('0x49'),_0x483e('0x4a'),_0x483e('0x4b'),_0x483e('0x4c')];var _0x5669b7=[_0x483e('0x4d'),_0x483e('0x4e'),_0x483e('0x4f'),_0x483e('0x50'),_0x483e('0x51'),_0x483e('0x52'),_0x483e('0x53'),_0x483e('0x54'),_0x483e('0x55'),_0x483e('0x56'),_0x483e('0x57'),'createdbyyominame',_0x483e('0x58'),'createdonbehalfbyname',_0x483e('0x59'),_0x483e('0x5a'),_0x483e('0x5b'),_0x483e('0x5c'),_0x483e('0x5d'),'entitlementidname',_0x483e('0x5e'),_0x483e('0x5f'),_0x483e('0x60'),_0x483e('0x61'),'firstresponsebykpiidname',_0x483e('0x62'),_0x483e('0x63'),'influencescore',_0x483e('0x64'),_0x483e('0x65'),_0x483e('0x66'),_0x483e('0x67'),'modifiedbyexternalpartyyominame',_0x483e('0x68'),_0x483e('0x69'),'modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame',_0x483e('0x6a'),_0x483e('0x6b'),_0x483e('0x6c'),'onholdtime',_0x483e('0x6d'),'owneridname',_0x483e('0x6e'),_0x483e('0x6f'),'parentcaseidname','primarycontactidname',_0x483e('0x70'),_0x483e('0x71'),_0x483e('0x72'),_0x483e('0x73'),_0x483e('0x74'),_0x483e('0x75'),_0x483e('0x76'),_0x483e('0x77'),_0x483e('0x78'),_0x483e('0x79'),'slainvokedidname',_0x483e('0x7a'),'socialprofileidname',_0x483e('0x7b'),_0x483e('0x7c'),_0x483e('0x7d'),_0x483e('0x7e'),_0x483e('0x7f'),_0x483e('0x80'),'traversedpath',_0x483e('0x81'),'versionnumber'];var _0xfd3aa7=_0x52e4cd['concat'](_0x5669b7);return db[_0x483e('0x15')][_0x483e('0x33')]({'where':{'id':_0x529a39[_0x483e('0x2a')]['id']},'attributes':['id',_0x483e('0x82'),_0x483e('0x83'),'remoteUri',_0x483e('0x84'),_0x483e('0x85'),'clientSecret',_0x483e('0x86')],'include':[{'model':db[_0x483e('0x87')],'as':'CloudProvider','attributes':['id','data5',_0x483e('0x88')]}]})[_0x483e('0xf')](handleEntityNotFound(_0x27a9c4,null))[_0x483e('0xf')](function(_0x31d6f5){if(_0x31d6f5){if(_0x31d6f5[_0x483e('0x86')]){_0x31d6f5[_0x483e('0x89')]=_0x31d6f5['CloudProvider'][_0x483e('0x8a')];_0x11a125=sanitizeRemoteUri(_0x31d6f5[_0x483e('0x87')][_0x483e('0x88')]);_0x25e55e=getWebApiUrl(_0x11a125);return _0x31d6f5;}_0x11a125=sanitizeRemoteUri(_0x31d6f5[_0x483e('0x8b')]);_0x25e55e=getWebApiUrl(_0x11a125);var _0x250fcc={'method':_0x483e('0x8c'),'uri':'https://login.microsoftonline.com/'+_0x31d6f5[_0x483e('0x84')]+_0x483e('0x8d'),'form':{'client_id':_0x31d6f5[_0x483e('0x85')],'resource':_0x11a125,'username':_0x31d6f5['username'],'password':_0x31d6f5[_0x483e('0x83')],'grant_type':_0x483e('0x83'),'client_secret':_0x31d6f5[_0x483e('0x8e')]},'json':!![]};return rp(_0x250fcc);}})[_0x483e('0xf')](function(_0x1da2c2){_0x5368a4=_0x1da2c2[_0x483e('0x89')];var _0x12d1d3={'method':_0x483e('0x8f'),'uri':encodeURI(_0x25e55e+'EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27'+_0xed169a+'\x27'),'headers':{'Authorization':_0x483e('0x90')+_0x5368a4,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x12d1d3);})['then'](function(_0x15aca8){var _0x68826d=_0x15aca8[_0x483e('0x91')][0x0];var _0x1a3386=_0x68826d[_0x483e('0x92')];var _0x5647a2={'method':_0x483e('0x8f'),'uri':_0x25e55e+_0x483e('0x93')+_0x1a3386+_0x483e('0x94'),'headers':{'Authorization':_0x483e('0x90')+_0x5368a4,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x5647a2);})['then'](function(_0x305e26){_0x52547e=_0x305e26;_0x41e173=_0x52547e[_0x483e('0x95')];_0x41e173=_['remove'](_0x41e173,function(_0x450eb1){return!_0xfd3aa7[_0x483e('0x96')](_0x450eb1['LogicalName']);});var _0x3346da=[];var _0x197199=[];_0x41e173[_0x483e('0x97')](function(_0x49d545){if(_0x49d545[_0x483e('0x98')]){var _0xa4313f=_0x49d545[_0x483e('0x98')][_0x483e('0x3c')](_0x49d545[_0x483e('0x98')]['lastIndexOf']('.')+0x1);if(_0xa4313f===_0x483e('0x99')){_0x3346da[_0x483e('0x9a')](getSelectList(_0x25e55e,_0x20687e,_0x197199,_0x52547e[_0x483e('0x92')],_0x49d545[_0x483e('0x92')],_0x5368a4));}}});return Promise['all'](_0x3346da);})['then'](function(_0xdb38f3){_0x7be30c=_0xdb38f3[0x0];var _0x525029=[];var _0x3aaf21=[];_0x41e173[_0x483e('0x97')](function(_0xe7d052){if(!_['isNil'](_0xe7d052[_0x483e('0x98')])){var _0x25218d=_0xe7d052['@odata.type'][_0x483e('0x3c')](_0xe7d052[_0x483e('0x98')]['lastIndexOf']('.')+0x1);if(_0x25218d===_0x483e('0x9b')){_0x525029[_0x483e('0x9a')](getBooleanList(_0x25e55e,_0x20687e,_0x3aaf21,_0x52547e[_0x483e('0x92')],_0xe7d052[_0x483e('0x92')],_0x5368a4));}}});return Promise[_0x483e('0x9c')](_0x525029);})[_0x483e('0xf')](function(_0x59ea94){_0x43dbec=_0x59ea94[0x0];var _0x380613=[];var _0x41c50b=[];_0x41e173[_0x483e('0x97')](function(_0x1e77d3){if(_0x1e77d3[_0x483e('0x98')]){var _0x573484=_0x1e77d3[_0x483e('0x98')][_0x483e('0x3c')](_0x1e77d3['@odata.type'][_0x483e('0x9d')]('.')+0x1);if(_0x573484==='StringAttributeMetadata'||_0x573484===_0x483e('0x9e')||_0x573484===_0x483e('0x9f')||_0x573484===_0x483e('0xa0')||_0x573484===_0x483e('0xa1')||_0x573484===_0x483e('0xa2')||_0x573484===_0x483e('0xa3')||_0x573484===_0x483e('0xa4')||_0x573484===_0x483e('0xa5')||_0x573484===_0x483e('0xa6')){_0x380613[_0x483e('0x9a')](getInputList(_0x25e55e,_0x20687e,_0x573484,_0x41c50b,_0x52547e[_0x483e('0x92')],_0x1e77d3[_0x483e('0x92')],_0x5368a4));}}});return Promise[_0x483e('0x9c')](_0x380613);})[_0x483e('0xf')](function(_0x15f25e){_0x517631=_0x15f25e[0x0];var _0x3cc7ac=_0x7be30c[_0x483e('0xa7')](_0x43dbec)[_0x483e('0xa7')](_0x517631);var _0x249cc2={'count':_0x3cc7ac[_0x483e('0x2c')],'rows':_0x3cc7ac};return _0x249cc2;})[_0x483e('0xf')](respondWithResult(_0x27a9c4,null))[_0x483e('0x2e')](function(_0xe7b943){var _0x3f1331=_0x529a39[_0x483e('0x1a')]['test']?0x1f4:_0xe7b943[_0x483e('0xa8')]||0x1f4;logger['error'](_0xe7b943['stack']);delete _0xe7b943[_0x483e('0x13')];if(_0x3f1331===0x191){_0x3f1331=0x190;}_0x27a9c4[_0x483e('0xb')](_0x3f1331)[_0x483e('0xa9')](_0x529a39[_0x483e('0x1a')]['test']?{'message':'Wrong\x20credentials','statusCode':_0xe7b943[_0x483e('0xa8')]}:_0xe7b943);});};function getSelectList(_0x4e8a30,_0x335fe8,_0x3b1bfa,_0x93692e,_0x454c9c,_0x949bb5){var _0x3f0167={'method':'GET','uri':_0x4e8a30+_0x483e('0x93')+_0x93692e+')/Attributes('+_0x454c9c+_0x483e('0xaa')+'$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','headers':{'Authorization':_0x483e('0x90')+_0x949bb5,'If-None-Match':null,'OData-Version':_0x483e('0xab')},'json':!![]};return rp(_0x3f0167)[_0x483e('0xf')](function(_0x3a6bf2){var _0x5f0c50=[];var _0x51a41a=_0x3a6bf2[_0x483e('0xac')]['Options'];_0x51a41a[_0x483e('0x97')](function(_0x48bbd8){_0x5f0c50['push']({'name':_0x48bbd8[_0x483e('0xad')]['UserLocalizedLabel']['Label'],'value':String(_0x48bbd8[_0x483e('0xae')])});});var _0x2cc23e={'id':_0x335fe8+'_'+_0x3a6bf2[_0x483e('0xaf')],'name':_0x3a6bf2[_0x483e('0xb0')][_0x483e('0xb1')][_0x483e('0xad')],'custom':![],'options':_0x5f0c50};_0x3b1bfa['push'](_0x2cc23e);return _0x3b1bfa;});}function getBooleanList(_0xce127e,_0x54ca42,_0x15b924,_0x5ca821,_0x9b2692,_0x2972be){var _0x34e23f={'method':_0x483e('0x8f'),'uri':_0xce127e+_0x483e('0x93')+_0x5ca821+_0x483e('0xb2')+_0x9b2692+_0x483e('0xb3'),'headers':{'Authorization':'Bearer\x20'+_0x2972be,'If-None-Match':null,'OData-Version':_0x483e('0xab')},'json':!![]};return rp(_0x34e23f)[_0x483e('0xf')](function(_0x1eb16a){var _0x15c126=[];_0x15c126[_0x483e('0x9a')]({'name':_0x1eb16a[_0x483e('0xac')]['TrueOption'][_0x483e('0xad')]['UserLocalizedLabel'][_0x483e('0xad')],'value':'true'},{'name':_0x1eb16a[_0x483e('0xac')][_0x483e('0xb4')][_0x483e('0xad')]['UserLocalizedLabel']['Label'],'value':_0x483e('0xb5')});var _0x16b78d={'id':_0x54ca42+'_'+_0x1eb16a[_0x483e('0xaf')],'name':_0x1eb16a[_0x483e('0xb0')][_0x483e('0xb1')][_0x483e('0xad')],'custom':![],'options':_0x15c126};_0x15b924[_0x483e('0x9a')](_0x16b78d);return _0x15b924;});}function getInputList(_0x18aaeb,_0xd79248,_0x302df2,_0x2325e6,_0x20df06,_0xec0276,_0x21d762){var _0x4697e9={'method':_0x483e('0x8f'),'uri':_0x18aaeb+'EntityDefinitions('+_0x20df06+_0x483e('0xb2')+_0xec0276+')/Microsoft.Dynamics.CRM.'+_0x302df2+_0x483e('0xb6'),'headers':{'Authorization':'Bearer\x20'+_0x21d762,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x4697e9)['then'](function(_0x5d5167){var _0x3bab98={'id':_0xd79248+'_'+_0x5d5167['LogicalName'],'name':_0x5d5167['DisplayName'][_0x483e('0xb1')]?_0x5d5167[_0x483e('0xb0')][_0x483e('0xb1')][_0x483e('0xad')]:_0x5d5167[_0x483e('0xaf')],'custom':![],'options':[]};_0x2325e6['push'](_0x3bab98);return _0x2325e6;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index a50ec3e..4c9f778 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 _0x0713=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','int_dynamics365_accounts'];(function(_0x163040,_0x38a58c){var _0x364667=function(_0x3b104f){while(--_0x3b104f){_0x163040['push'](_0x163040['shift']());}};_0x364667(++_0x38a58c);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var moment=require(_0x3071('0x2'));var BPromise=require(_0x3071('0x3'));var rp=require(_0x3071('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var attributes=require(_0x3071('0x7'));var integrations=require(_0x3071('0x8'));module[_0x3071('0x9')]=function(_0x41cf76,_0x1d3dd6){return _0x41cf76[_0x3071('0xa')](_0x3071('0xb'),attributes,{'tableName':_0x3071('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbaf0=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration','exports','define','Dynamics365Account','util'];(function(_0x404382,_0x3d4795){var _0x194f78=function(_0xd0f692){while(--_0xd0f692){_0x404382['push'](_0x404382['shift']());}};_0x194f78(++_0x3d4795);}(_0xbaf0,0x12a));var _0x0baf=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xbaf0[_0x6131cd];return _0x47e916;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var moment=require(_0x0baf('0x3'));var BPromise=require(_0x0baf('0x4'));var rp=require(_0x0baf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var attributes=require(_0x0baf('0x8'));var integrations=require(_0x0baf('0x9'));module[_0x0baf('0xa')]=function(_0x335e24,_0x1a10b1){return _0x335e24[_0x0baf('0xb')](_0x0baf('0xc'),attributes,{'tableName':'int_dynamics365_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.rpc.js b/server/api/intDynamics365Account/intDynamics365Account.rpc.js index ac7967f..4bff3b0 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 _0xecfb=['raw','where','include','map','model','attributes','GetDynamics365Account','stringify','ShowDynamics365Account','find','debug','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Dynamics365Account,\x20%s,\x20%s','request\x20sent','Dynamics365Account,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','Dynamics365Account','findAll','options'];(function(_0x374ada,_0x27b3a5){var _0x449ed8=function(_0x3efc46){while(--_0x3efc46){_0x374ada['push'](_0x374ada['shift']());}};_0x449ed8(++_0x27b3a5);}(_0xecfb,0x1d2));var _0xbecf=function(_0x37a5a7,_0x2bdad5){_0x37a5a7=_0x37a5a7-0x0;var _0x5981d2=_0xecfb[_0x37a5a7];return _0x5981d2;};'use strict';var _=require(_0xbecf('0x0'));var util=require(_0xbecf('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xbecf('0x2'));var fs=require('fs');var Redis=require(_0xbecf('0x3'));var db=require(_0xbecf('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xbecf('0x5'))(_0xbecf('0x6'));var config=require(_0xbecf('0x7'));var jayson=require(_0xbecf('0x8'));var client=jayson[_0xbecf('0x9')][_0xbecf('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xf17f2a,_0x4260ec,_0x26836f){return new BPromise(function(_0x580309,_0x12210e){return client[_0xbecf('0xb')](_0xf17f2a,_0x26836f)[_0xbecf('0xc')](function(_0x495532){logger['info'](_0xbecf('0xd'),_0x4260ec,_0xbecf('0xe'));logger['debug'](_0xbecf('0xf'),_0x4260ec,_0xbecf('0xe'),JSON['stringify'](_0x495532));if(_0x495532[_0xbecf('0x10')]){if(_0x495532[_0xbecf('0x10')][_0xbecf('0x11')]===0x1f4){logger[_0xbecf('0x10')](_0xbecf('0xd'),_0x4260ec,_0x495532[_0xbecf('0x10')][_0xbecf('0x12')]);return _0x12210e(_0x495532[_0xbecf('0x10')][_0xbecf('0x12')]);}logger['error']('Dynamics365Account,\x20%s,\x20%s',_0x4260ec,_0x495532['error']['message']);return _0x580309(_0x495532['error'][_0xbecf('0x12')]);}else{logger[_0xbecf('0x13')](_0xbecf('0xd'),_0x4260ec,_0xbecf('0xe'));_0x580309(_0x495532['result']['message']);}})[_0xbecf('0x14')](function(_0xd02931){logger[_0xbecf('0x10')](_0xbecf('0xd'),_0x4260ec,_0xd02931);_0x12210e(_0xd02931);});});}exports['GetDynamics365Account']=function(_0x12ad90){var _0xa2464=this;return new Promise(function(_0x3bb877,_0x174e92){return db[_0xbecf('0x15')][_0xbecf('0x16')]({'raw':_0x12ad90[_0xbecf('0x17')]?_0x12ad90[_0xbecf('0x17')][_0xbecf('0x18')]===undefined?!![]:![]:!![],'where':_0x12ad90[_0xbecf('0x17')]?_0x12ad90[_0xbecf('0x17')][_0xbecf('0x19')]||null:null,'attributes':_0x12ad90[_0xbecf('0x17')]?_0x12ad90[_0xbecf('0x17')]['attributes']||null:null,'limit':_0x12ad90[_0xbecf('0x17')]?_0x12ad90['options']['limit']||null:null,'include':_0x12ad90[_0xbecf('0x17')]?_0x12ad90[_0xbecf('0x17')][_0xbecf('0x1a')]?_[_0xbecf('0x1b')](_0x12ad90[_0xbecf('0x17')]['include'],function(_0x43f927){return{'model':db[_0x43f927[_0xbecf('0x1c')]],'as':_0x43f927['as'],'attributes':_0x43f927[_0xbecf('0x1d')],'include':_0x43f927[_0xbecf('0x1a')]?_[_0xbecf('0x1b')](_0x43f927[_0xbecf('0x1a')],function(_0x204ef9){return{'model':db[_0x204ef9[_0xbecf('0x1c')]],'as':_0x204ef9['as'],'attributes':_0x204ef9[_0xbecf('0x1d')],'include':_0x204ef9[_0xbecf('0x1a')]?_[_0xbecf('0x1b')](_0x204ef9['include'],function(_0x3b7fa5){return{'model':db[_0x3b7fa5['model']],'as':_0x3b7fa5['as'],'attributes':_0x3b7fa5[_0xbecf('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xbecf('0xc')](function(_0x58f3b9){logger[_0xbecf('0x13')](_0xbecf('0x1e'),_0x12ad90);logger['debug'](_0xbecf('0x1e'),_0x12ad90,JSON[_0xbecf('0x1f')](_0x58f3b9));_0x3bb877(_0x58f3b9);})['catch'](function(_0xbba93e){logger[_0xbecf('0x10')](_0xbecf('0x1e'),_0xbba93e[_0xbecf('0x12')],_0x12ad90);_0x174e92(_0xa2464[_0xbecf('0x10')](0x1f4,_0xbba93e[_0xbecf('0x12')]));});});};exports[_0xbecf('0x20')]=function(_0x3a846e){var _0x18cb3a=this;return new Promise(function(_0x5e24ad,_0x17cf56){return db[_0xbecf('0x15')][_0xbecf('0x21')]({'raw':_0x3a846e[_0xbecf('0x17')]?_0x3a846e[_0xbecf('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x3a846e[_0xbecf('0x17')]?_0x3a846e['options'][_0xbecf('0x19')]||null:null,'attributes':_0x3a846e['options']?_0x3a846e[_0xbecf('0x17')][_0xbecf('0x1d')]||null:null,'include':_0x3a846e[_0xbecf('0x17')]?_0x3a846e[_0xbecf('0x17')][_0xbecf('0x1a')]?_[_0xbecf('0x1b')](_0x3a846e[_0xbecf('0x17')][_0xbecf('0x1a')],function(_0x5f4bb9){return{'model':db[_0x5f4bb9[_0xbecf('0x1c')]],'as':_0x5f4bb9['as'],'attributes':_0x5f4bb9[_0xbecf('0x1d')],'include':_0x5f4bb9['include']?_[_0xbecf('0x1b')](_0x5f4bb9['include'],function(_0x49f781){return{'model':db[_0x49f781[_0xbecf('0x1c')]],'as':_0x49f781['as'],'attributes':_0x49f781[_0xbecf('0x1d')],'include':_0x49f781['include']?_[_0xbecf('0x1b')](_0x49f781[_0xbecf('0x1a')],function(_0x3baca5){return{'model':db[_0x3baca5[_0xbecf('0x1c')]],'as':_0x3baca5['as'],'attributes':_0x3baca5['attributes']};}):[]};}):[]};}):[]:[]})[_0xbecf('0xc')](function(_0x26e397){logger[_0xbecf('0x13')](_0xbecf('0x20'),_0x3a846e);logger[_0xbecf('0x22')]('ShowDynamics365Account',_0x3a846e,JSON[_0xbecf('0x1f')](_0x26e397));_0x5e24ad(_0x26e397);})[_0xbecf('0x14')](function(_0x52ee36){logger['error'](_0xbecf('0x20'),_0x52ee36[_0xbecf('0x12')],_0x3a846e);_0x17cf56(_0x18cb3a[_0xbecf('0x10')](0x1f4,_0x52ee36['message']));});});}; \ No newline at end of file +var _0xdd6f=['Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetDynamics365Account','Dynamics365Account','options','raw','limit','include','model','attributes','map','ShowDynamics365Account','where','then','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','info'];(function(_0x2291e8,_0x2286f1){var _0x418dd9=function(_0x2b7b9c){while(--_0x2b7b9c){_0x2291e8['push'](_0x2291e8['shift']());}};_0x418dd9(++_0x2286f1);}(_0xdd6f,0xfd));var _0xfdd6=function(_0x330890,_0x2fd8bd){_0x330890=_0x330890-0x0;var _0x82f602=_0xdd6f[_0x330890];return _0x82f602;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xfdd6('0x0'));var BPromise=require('bluebird');var rs=require(_0xfdd6('0x1'));var fs=require('fs');var Redis=require(_0xfdd6('0x2'));var db=require(_0xfdd6('0x3'))['db'];var utils=require(_0xfdd6('0x4'));var logger=require(_0xfdd6('0x5'))('rpc');var config=require(_0xfdd6('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xfdd6('0x7')][_0xfdd6('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x18c3c4,_0x3e0b22,_0x3e994e){return new BPromise(function(_0x10747a,_0x49f341){return client[_0xfdd6('0x9')](_0x18c3c4,_0x3e994e)['then'](function(_0x512815){logger[_0xfdd6('0xa')](_0xfdd6('0xb'),_0x3e0b22,_0xfdd6('0xc'));logger[_0xfdd6('0xd')](_0xfdd6('0xe'),_0x3e0b22,_0xfdd6('0xc'),JSON[_0xfdd6('0xf')](_0x512815));if(_0x512815[_0xfdd6('0x10')]){if(_0x512815[_0xfdd6('0x10')][_0xfdd6('0x11')]===0x1f4){logger['error'](_0xfdd6('0xb'),_0x3e0b22,_0x512815[_0xfdd6('0x10')]['message']);return _0x49f341(_0x512815[_0xfdd6('0x10')][_0xfdd6('0x12')]);}logger[_0xfdd6('0x10')](_0xfdd6('0xb'),_0x3e0b22,_0x512815[_0xfdd6('0x10')]['message']);return _0x10747a(_0x512815[_0xfdd6('0x10')][_0xfdd6('0x12')]);}else{logger[_0xfdd6('0xa')](_0xfdd6('0xb'),_0x3e0b22,_0xfdd6('0xc'));_0x10747a(_0x512815[_0xfdd6('0x13')][_0xfdd6('0x12')]);}})[_0xfdd6('0x14')](function(_0x51dab6){logger['error'](_0xfdd6('0xb'),_0x3e0b22,_0x51dab6);_0x49f341(_0x51dab6);});});}exports[_0xfdd6('0x15')]=function(_0x3f09b8){var _0x32b70d=this;return new Promise(function(_0xe4e909,_0x59e3de){return db[_0xfdd6('0x16')]['findAll']({'raw':_0x3f09b8[_0xfdd6('0x17')]?_0x3f09b8[_0xfdd6('0x17')][_0xfdd6('0x18')]===undefined?!![]:![]:!![],'where':_0x3f09b8[_0xfdd6('0x17')]?_0x3f09b8['options']['where']||null:null,'attributes':_0x3f09b8['options']?_0x3f09b8[_0xfdd6('0x17')]['attributes']||null:null,'limit':_0x3f09b8[_0xfdd6('0x17')]?_0x3f09b8['options'][_0xfdd6('0x19')]||null:null,'include':_0x3f09b8[_0xfdd6('0x17')]?_0x3f09b8['options'][_0xfdd6('0x1a')]?_['map'](_0x3f09b8[_0xfdd6('0x17')][_0xfdd6('0x1a')],function(_0x56b0ea){return{'model':db[_0x56b0ea[_0xfdd6('0x1b')]],'as':_0x56b0ea['as'],'attributes':_0x56b0ea[_0xfdd6('0x1c')],'include':_0x56b0ea['include']?_[_0xfdd6('0x1d')](_0x56b0ea['include'],function(_0x32ef11){return{'model':db[_0x32ef11['model']],'as':_0x32ef11['as'],'attributes':_0x32ef11[_0xfdd6('0x1c')],'include':_0x32ef11['include']?_[_0xfdd6('0x1d')](_0x32ef11[_0xfdd6('0x1a')],function(_0x1ebfcd){return{'model':db[_0x1ebfcd[_0xfdd6('0x1b')]],'as':_0x1ebfcd['as'],'attributes':_0x1ebfcd[_0xfdd6('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x411b5a){logger[_0xfdd6('0xa')](_0xfdd6('0x15'),_0x3f09b8);logger[_0xfdd6('0xd')](_0xfdd6('0x15'),_0x3f09b8,JSON[_0xfdd6('0xf')](_0x411b5a));_0xe4e909(_0x411b5a);})['catch'](function(_0x792d0d){logger[_0xfdd6('0x10')](_0xfdd6('0x15'),_0x792d0d['message'],_0x3f09b8);_0x59e3de(_0x32b70d[_0xfdd6('0x10')](0x1f4,_0x792d0d[_0xfdd6('0x12')]));});});};exports[_0xfdd6('0x1e')]=function(_0x3df74b){var _0x304ca3=this;return new Promise(function(_0x21671e,_0x4c7399){return db[_0xfdd6('0x16')]['find']({'raw':_0x3df74b[_0xfdd6('0x17')]?_0x3df74b[_0xfdd6('0x17')][_0xfdd6('0x18')]===undefined?!![]:![]:!![],'where':_0x3df74b[_0xfdd6('0x17')]?_0x3df74b[_0xfdd6('0x17')][_0xfdd6('0x1f')]||null:null,'attributes':_0x3df74b[_0xfdd6('0x17')]?_0x3df74b[_0xfdd6('0x17')][_0xfdd6('0x1c')]||null:null,'include':_0x3df74b[_0xfdd6('0x17')]?_0x3df74b[_0xfdd6('0x17')][_0xfdd6('0x1a')]?_[_0xfdd6('0x1d')](_0x3df74b[_0xfdd6('0x17')]['include'],function(_0xcb4b4e){return{'model':db[_0xcb4b4e['model']],'as':_0xcb4b4e['as'],'attributes':_0xcb4b4e['attributes'],'include':_0xcb4b4e[_0xfdd6('0x1a')]?_[_0xfdd6('0x1d')](_0xcb4b4e[_0xfdd6('0x1a')],function(_0x4ca0f9){return{'model':db[_0x4ca0f9[_0xfdd6('0x1b')]],'as':_0x4ca0f9['as'],'attributes':_0x4ca0f9[_0xfdd6('0x1c')],'include':_0x4ca0f9[_0xfdd6('0x1a')]?_[_0xfdd6('0x1d')](_0x4ca0f9[_0xfdd6('0x1a')],function(_0x1daf92){return{'model':db[_0x1daf92['model']],'as':_0x1daf92['as'],'attributes':_0x1daf92[_0xfdd6('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xfdd6('0x20')](function(_0x180ffe){logger[_0xfdd6('0xa')](_0xfdd6('0x1e'),_0x3df74b);logger['debug'](_0xfdd6('0x1e'),_0x3df74b,JSON[_0xfdd6('0xf')](_0x180ffe));_0x21671e(_0x180ffe);})[_0xfdd6('0x14')](function(_0x235860){logger[_0xfdd6('0x10')]('ShowDynamics365Account',_0x235860[_0xfdd6('0x12')],_0x3df74b);_0x4c7399(_0x304ca3[_0xfdd6('0x10')](0x1f4,_0x235860[_0xfdd6('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index f10a560..f7a28d7 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 _0xf47b=['getFields','/:id/descriptions','getDescriptions','post','create','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show'];(function(_0x5bcb11,_0x5b5d84){var _0x3daa19=function(_0x1e3715){while(--_0x1e3715){_0x5bcb11['push'](_0x5bcb11['shift']());}};_0x3daa19(++_0x5b5d84);}(_0xf47b,0x15d));var _0xbf47=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0xf47b[_0x173441];return _0x2423a8;};'use strict';var multer=require(_0xbf47('0x0'));var util=require(_0xbf47('0x1'));var path=require(_0xbf47('0x2'));var timeout=require('connect-timeout');var express=require(_0xbf47('0x3'));var router=express[_0xbf47('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xbf47('0x5'));var interaction=require(_0xbf47('0x6'));var config=require(_0xbf47('0x7'));var controller=require('./intDynamics365Configuration.controller');router[_0xbf47('0x8')]('/',auth[_0xbf47('0x9')](),controller['index']);router[_0xbf47('0x8')](_0xbf47('0xa'),auth[_0xbf47('0x9')](),controller[_0xbf47('0xb')]);router[_0xbf47('0x8')]('/:id/fields',auth[_0xbf47('0x9')](),controller[_0xbf47('0xc')]);router[_0xbf47('0x8')]('/:id/subjects',auth[_0xbf47('0x9')](),controller['getSubjects']);router[_0xbf47('0x8')](_0xbf47('0xd'),auth[_0xbf47('0x9')](),controller[_0xbf47('0xe')]);router[_0xbf47('0xf')]('/',auth[_0xbf47('0x9')](),controller[_0xbf47('0x10')]);router['put'](_0xbf47('0xa'),auth[_0xbf47('0x9')](),controller['update']);router['delete'](_0xbf47('0xa'),auth[_0xbf47('0x9')](),controller[_0xbf47('0x11')]);module[_0xbf47('0x12')]=router; \ No newline at end of file +var _0x1bfd=['/:id','/:id/fields','isAuthenticated','/:id/subjects','getSubjects','getDescriptions','create','put','update','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','get'];(function(_0x129fd6,_0x5ba647){var _0x511698=function(_0x27dea7){while(--_0x27dea7){_0x129fd6['push'](_0x129fd6['shift']());}};_0x511698(++_0x5ba647);}(_0x1bfd,0xbc));var _0xd1bf=function(_0x51d92a,_0x49d811){_0x51d92a=_0x51d92a-0x0;var _0x1236b0=_0x1bfd[_0x51d92a];return _0x1236b0;};'use strict';var multer=require(_0xd1bf('0x0'));var util=require(_0xd1bf('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xd1bf('0x2'));var router=express[_0xd1bf('0x3')]();var fs_extra=require(_0xd1bf('0x4'));var auth=require(_0xd1bf('0x5'));var interaction=require(_0xd1bf('0x6'));var config=require(_0xd1bf('0x7'));var controller=require(_0xd1bf('0x8'));router[_0xd1bf('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xd1bf('0x9')](_0xd1bf('0xa'),auth['isAuthenticated'](),controller['show']);router[_0xd1bf('0x9')](_0xd1bf('0xb'),auth[_0xd1bf('0xc')](),controller['getFields']);router[_0xd1bf('0x9')](_0xd1bf('0xd'),auth[_0xd1bf('0xc')](),controller[_0xd1bf('0xe')]);router[_0xd1bf('0x9')]('/:id/descriptions',auth[_0xd1bf('0xc')](),controller[_0xd1bf('0xf')]);router['post']('/',auth[_0xd1bf('0xc')](),controller[_0xd1bf('0x10')]);router[_0xd1bf('0x11')]('/:id',auth[_0xd1bf('0xc')](),controller[_0xd1bf('0x12')]);router[_0xd1bf('0x13')](_0xd1bf('0xa'),auth[_0xd1bf('0xc')](),controller[_0xd1bf('0x14')]);module[_0xd1bf('0x15')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index 0688dba..b511fda 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 _0xb73c=['nothing','BOOLEAN','sequelize','exports','STRING','incident','phonecall','ENUM','contact'];(function(_0x4a5842,_0x42a825){var _0x1251a2=function(_0x50f601){while(--_0x50f601){_0x4a5842['push'](_0x4a5842['shift']());}};_0x1251a2(++_0x42a825);}(_0xb73c,0x1f1));var _0xcb73=function(_0x123676,_0x4340ed){_0x123676=_0x123676-0x0;var _0x3c77d5=_0xb73c[_0x123676];return _0x3c77d5;};'use strict';var Sequelize=require(_0xcb73('0x0'));module[_0xcb73('0x1')]={'name':{'type':Sequelize[_0xcb73('0x2')]},'description':{'type':Sequelize[_0xcb73('0x2')]},'ticketType':{'type':Sequelize['ENUM'](_0xcb73('0x3'),_0xcb73('0x4')),'defaultValue':'incident'},'moduleCreate':{'type':Sequelize[_0xcb73('0x5')](_0xcb73('0x6'),_0xcb73('0x7')),'defaultValue':_0xcb73('0x6'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0xcb73('0x2')],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0xcb73('0x8')],'defaultValue':!![]}}; \ No newline at end of file +var _0x3648=['BOOLEAN','exports','STRING','ENUM','incident','contact'];(function(_0x2d8b78,_0x130677){var _0x1a0cfe=function(_0x286a10){while(--_0x286a10){_0x2d8b78['push'](_0x2d8b78['shift']());}};_0x1a0cfe(++_0x130677);}(_0x3648,0xaf));var _0x8364=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3648[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0x8364('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x8364('0x1')]},'ticketType':{'type':Sequelize[_0x8364('0x2')](_0x8364('0x3'),'phonecall'),'defaultValue':_0x8364('0x3')},'moduleCreate':{'type':Sequelize[_0x8364('0x2')](_0x8364('0x4'),'nothing'),'defaultValue':_0x8364('0x4'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0x8364('0x1')],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0x8364('0x5')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index dda679b..89c27da 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 _0x679c=['fieldName','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','options','includeAll','include','findAll','show','params','keys','merge','find','create','catch','update','body','findOne','Dynamics365Field','getFields','getSubjects','getDescriptions','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','map','Dynamics365Configuration','rawAttributes'];(function(_0x40635e,_0x5df898){var _0x41a30e=function(_0x2cdf2b){while(--_0x2cdf2b){_0x40635e['push'](_0x40635e['shift']());}};_0x41a30e(++_0x5df898);}(_0x679c,0xca));var _0xc679=function(_0x584953,_0x122a97){_0x584953=_0x584953-0x0;var _0x27a376=_0x679c[_0x584953];return _0x27a376;};'use strict';var emlformat=require(_0xc679('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc679('0x1'));var jsonpatch=require(_0xc679('0x2'));var rp=require('request-promise');var moment=require(_0xc679('0x3'));var BPromise=require(_0xc679('0x4'));var Mustache=require(_0xc679('0x5'));var util=require(_0xc679('0x6'));var path=require('path');var sox=require(_0xc679('0x7'));var csv=require(_0xc679('0x8'));var ejs=require(_0xc679('0x9'));var fs=require('fs');var fs_extra=require(_0xc679('0xa'));var _=require(_0xc679('0xb'));var squel=require(_0xc679('0xc'));var crypto=require(_0xc679('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xc679('0x8'));var querystring=require(_0xc679('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xc679('0xf'));var as=require(_0xc679('0x10'));var hardwareService=require(_0xc679('0x11'));var logger=require(_0xc679('0x12'))(_0xc679('0x13'));var utils=require(_0xc679('0x14'));var config=require(_0xc679('0x15'));var licenseUtil=require(_0xc679('0x16'));var db=require(_0xc679('0x17'))['db'];function respondWithStatusCode(_0x389374,_0xd89020){_0xd89020=_0xd89020||0xcc;return function(_0x42ae4b){if(_0x42ae4b){return _0x389374[_0xc679('0x18')](_0xd89020);}return _0x389374[_0xc679('0x19')](_0xd89020)[_0xc679('0x1a')]();};}function respondWithResult(_0x21004a,_0x2a67c3){_0x2a67c3=_0x2a67c3||0xc8;return function(_0x315c3d){if(_0x315c3d){return _0x21004a[_0xc679('0x19')](_0x2a67c3)[_0xc679('0x1b')](_0x315c3d);}};}function respondWithFilteredResult(_0x39bc17,_0x74e1d7){return function(_0x4a5cd1){if(_0x4a5cd1){var _0x5ec705=typeof _0x74e1d7[_0xc679('0x1c')]==='undefined'&&typeof _0x74e1d7[_0xc679('0x1d')]===_0xc679('0x1e');var _0x2c65c0=_0x4a5cd1[_0xc679('0x1f')];var _0x212fed=_0x5ec705?0x0:_0x74e1d7[_0xc679('0x1c')];var _0x589f2e=_0x5ec705?_0x4a5cd1[_0xc679('0x1f')]:_0x74e1d7['offset']+_0x74e1d7[_0xc679('0x1d')];var _0x5a30f4;if(_0x589f2e>=_0x2c65c0){_0x589f2e=_0x2c65c0;_0x5a30f4=0xc8;}else{_0x5a30f4=0xce;}_0x39bc17[_0xc679('0x19')](_0x5a30f4);return _0x39bc17[_0xc679('0x20')](_0xc679('0x21'),_0x212fed+'-'+_0x589f2e+'/'+_0x2c65c0)['json'](_0x4a5cd1);}return null;};}function patchUpdates(_0xf592){return function(_0x46a4e6){try{jsonpatch[_0xc679('0x22')](_0x46a4e6,_0xf592,!![]);}catch(_0x1ed025){return BPromise[_0xc679('0x23')](_0x1ed025);}return _0x46a4e6[_0xc679('0x24')]();};}function saveUpdates(_0x3e6608,_0x81f7d2){return function(_0x2023a5){if(_0x2023a5){return _0x2023a5['update'](_0x3e6608)[_0xc679('0x25')](function(_0x376944){return _0x376944;});}return null;};}function removeEntity(_0x37c842,_0x2245d2){return function(_0x55eca6){if(_0x55eca6){return _0x55eca6[_0xc679('0x26')]()['then'](function(){_0x37c842[_0xc679('0x19')](0xcc)[_0xc679('0x1a')]();});}};}function handleEntityNotFound(_0x1148ba,_0x39487d){return function(_0x3e4eb1){if(!_0x3e4eb1){_0x1148ba[_0xc679('0x18')](0x194);}return _0x3e4eb1;};}function handleError(_0x171ef6,_0x331583){_0x331583=_0x331583||0x1f4;return function(_0x3d1864){logger[_0xc679('0x27')](_0x3d1864[_0xc679('0x28')]);if(_0x3d1864['name']){delete _0x3d1864[_0xc679('0x29')];}_0x171ef6[_0xc679('0x19')](_0x331583)[_0xc679('0x2a')](_0x3d1864);};}exports[_0xc679('0x2b')]=function(_0x10d54f,_0x41ce70){var _0x360a73={},_0x36f92c={},_0x419f21={'count':0x0,'rows':[]};var _0x3c1898=_[_0xc679('0x2c')](db[_0xc679('0x2d')][_0xc679('0x2e')],function(_0x506cca){return{'name':_0x506cca[_0xc679('0x2f')],'type':_0x506cca['type'][_0xc679('0x30')]};});_0x36f92c[_0xc679('0x31')]=_[_0xc679('0x2c')](_0x3c1898,'name');_0x36f92c['query']=_['keys'](_0x10d54f[_0xc679('0x32')]);_0x36f92c[_0xc679('0x33')]=_['intersection'](_0x36f92c[_0xc679('0x31')],_0x36f92c[_0xc679('0x32')]);_0x360a73['attributes']=_[_0xc679('0x34')](_0x36f92c[_0xc679('0x31')],qs[_0xc679('0x35')](_0x10d54f[_0xc679('0x32')][_0xc679('0x35')]));_0x360a73[_0xc679('0x36')]=_0x360a73['attributes'][_0xc679('0x37')]?_0x360a73[_0xc679('0x36')]:_0x36f92c['model'];if(!_0x10d54f[_0xc679('0x32')][_0xc679('0x38')](_0xc679('0x39'))){_0x360a73[_0xc679('0x1d')]=qs[_0xc679('0x1d')](_0x10d54f['query']['limit']);_0x360a73[_0xc679('0x1c')]=qs[_0xc679('0x1c')](_0x10d54f[_0xc679('0x32')]['offset']);}_0x360a73[_0xc679('0x3a')]=qs[_0xc679('0x3b')](_0x10d54f[_0xc679('0x32')][_0xc679('0x3b')]);_0x360a73[_0xc679('0x3c')]=qs[_0xc679('0x33')](_[_0xc679('0x3d')](_0x10d54f[_0xc679('0x32')],_0x36f92c[_0xc679('0x33')]),_0x3c1898);if(_0x10d54f[_0xc679('0x32')][_0xc679('0x3e')]){_0x360a73[_0xc679('0x3c')]=_['merge'](_0x360a73[_0xc679('0x3c')],{'$or':_['map'](_0x3c1898,function(_0x5da217){if(_0x5da217[_0xc679('0x3f')]!==_0xc679('0x40')){var _0x59b127={};_0x59b127[_0x5da217[_0xc679('0x29')]]={'$like':'%'+_0x10d54f['query'][_0xc679('0x3e')]+'%'};return _0x59b127;}})});}_0x360a73=_['merge']({},_0x360a73,_0x10d54f[_0xc679('0x41')]);var _0x207d99={'where':_0x360a73['where']};return db[_0xc679('0x2d')][_0xc679('0x1f')](_0x207d99)[_0xc679('0x25')](function(_0x934933){_0x419f21[_0xc679('0x1f')]=_0x934933;if(_0x10d54f[_0xc679('0x32')][_0xc679('0x42')]){_0x360a73[_0xc679('0x43')]=[{'all':!![]}];}return db['Dynamics365Configuration'][_0xc679('0x44')](_0x360a73);})[_0xc679('0x25')](function(_0x4063ee){_0x419f21['rows']=_0x4063ee;return _0x419f21;})[_0xc679('0x25')](respondWithFilteredResult(_0x41ce70,_0x360a73))['catch'](handleError(_0x41ce70,null));};exports[_0xc679('0x45')]=function(_0x3f9974,_0x11b298){var _0x51a5b1={'raw':![],'where':{'id':_0x3f9974[_0xc679('0x46')]['id']}},_0x3157b9={};_0x3157b9['model']=_[_0xc679('0x47')](db[_0xc679('0x2d')][_0xc679('0x2e')]);_0x3157b9[_0xc679('0x32')]=_['keys'](_0x3f9974[_0xc679('0x32')]);_0x3157b9[_0xc679('0x33')]=_['intersection'](_0x3157b9[_0xc679('0x31')],_0x3157b9['query']);_0x51a5b1[_0xc679('0x36')]=_[_0xc679('0x34')](_0x3157b9[_0xc679('0x31')],qs[_0xc679('0x35')](_0x3f9974[_0xc679('0x32')][_0xc679('0x35')]));_0x51a5b1[_0xc679('0x36')]=_0x51a5b1[_0xc679('0x36')][_0xc679('0x37')]?_0x51a5b1[_0xc679('0x36')]:_0x3157b9[_0xc679('0x31')];if(_0x3f9974[_0xc679('0x32')]['includeAll']){_0x51a5b1[_0xc679('0x43')]=[{'all':!![]}];}_0x51a5b1=_[_0xc679('0x48')]({},_0x51a5b1,_0x3f9974[_0xc679('0x41')]);return db[_0xc679('0x2d')][_0xc679('0x49')](_0x51a5b1)['then'](handleEntityNotFound(_0x11b298,null))[_0xc679('0x25')](respondWithResult(_0x11b298,null))['catch'](handleError(_0x11b298,null));};exports[_0xc679('0x4a')]=function(_0x30887f,_0x510de6){return db['Dynamics365Configuration'][_0xc679('0x4a')](_0x30887f['body'],{})[_0xc679('0x25')](respondWithResult(_0x510de6,0xc9))[_0xc679('0x4b')](handleError(_0x510de6,null));};exports[_0xc679('0x4c')]=function(_0x3b283e,_0x59104b){if(_0x3b283e[_0xc679('0x4d')]['id']){delete _0x3b283e['body']['id'];}return db[_0xc679('0x2d')][_0xc679('0x49')]({'where':{'id':_0x3b283e[_0xc679('0x46')]['id']}})[_0xc679('0x25')](handleEntityNotFound(_0x59104b,null))[_0xc679('0x25')](saveUpdates(_0x3b283e[_0xc679('0x4d')],null))[_0xc679('0x25')](respondWithResult(_0x59104b,null))[_0xc679('0x4b')](handleError(_0x59104b,null));};exports[_0xc679('0x26')]=function(_0x26682f,_0x54c908){return db[_0xc679('0x2d')][_0xc679('0x49')]({'where':{'id':_0x26682f[_0xc679('0x46')]['id']}})['then'](handleEntityNotFound(_0x54c908,null))[_0xc679('0x25')](removeEntity(_0x54c908,null))[_0xc679('0x4b')](handleError(_0x54c908,null));};exports['getFields']=function(_0x371aa5,_0x46790d,_0x5f0051){var _0x31525e={};var _0x15ac74={};var _0x57de49;var _0x397c3e;return db[_0xc679('0x2d')][_0xc679('0x4e')]({'where':{'id':_0x371aa5[_0xc679('0x46')]['id']}})['then'](handleEntityNotFound(_0x46790d,null))['then'](function(_0x2531a8){if(_0x2531a8){_0x57de49=_0x2531a8;_0x15ac74['model']=_[_0xc679('0x47')](db[_0xc679('0x4f')]['rawAttributes']);_0x15ac74[_0xc679('0x32')]=_['keys'](_0x371aa5[_0xc679('0x32')]);_0x15ac74['filters']=_[_0xc679('0x34')](_0x15ac74[_0xc679('0x31')],_0x15ac74[_0xc679('0x32')]);_0x31525e[_0xc679('0x36')]=_[_0xc679('0x34')](_0x15ac74[_0xc679('0x31')],qs[_0xc679('0x35')](_0x371aa5[_0xc679('0x32')]['fields']));_0x31525e[_0xc679('0x36')]=_0x31525e[_0xc679('0x36')][_0xc679('0x37')]?_0x31525e[_0xc679('0x36')]:_0x15ac74[_0xc679('0x31')];_0x31525e[_0xc679('0x3a')]=qs['sort'](_0x371aa5[_0xc679('0x32')][_0xc679('0x3b')]);_0x31525e['where']=qs[_0xc679('0x33')](_[_0xc679('0x3d')](_0x371aa5['query'],_0x15ac74[_0xc679('0x33')]));if(_0x371aa5[_0xc679('0x32')][_0xc679('0x3e')]){_0x31525e[_0xc679('0x3c')]=_[_0xc679('0x48')](_0x31525e[_0xc679('0x3c')],{'$or':_[_0xc679('0x2c')](_0x31525e['attributes'],function(_0x2ab629){var _0x125e7f={};_0x125e7f[_0x2ab629]={'$like':'%'+_0x371aa5[_0xc679('0x32')][_0xc679('0x3e')]+'%'};return _0x125e7f;})});}_0x31525e=_[_0xc679('0x48')]({},_0x31525e,_0x371aa5[_0xc679('0x41')]);return _0x57de49[_0xc679('0x50')](_0x31525e);}})[_0xc679('0x25')](function(_0x51d0a5){if(_0x51d0a5){_0x397c3e=_0x51d0a5[_0xc679('0x37')];if(!_0x371aa5[_0xc679('0x32')][_0xc679('0x38')]('nolimit')){_0x31525e['limit']=qs[_0xc679('0x1d')](_0x371aa5[_0xc679('0x32')][_0xc679('0x1d')]);_0x31525e[_0xc679('0x1c')]=qs['offset'](_0x371aa5[_0xc679('0x32')][_0xc679('0x1c')]);}return _0x57de49['getFields'](_0x31525e);}})[_0xc679('0x25')](function(_0x20647e){if(_0x20647e){return _0x20647e?{'count':_0x397c3e,'rows':_0x20647e}:null;}})[_0xc679('0x25')](respondWithResult(_0x46790d,null))[_0xc679('0x4b')](handleError(_0x46790d,null));};exports[_0xc679('0x51')]=function(_0x1d2130,_0x49e630,_0x432934){var _0x242572={};var _0x438f4c={};var _0x485131;var _0x301f84;return db[_0xc679('0x2d')]['findOne']({'where':{'id':_0x1d2130[_0xc679('0x46')]['id']}})[_0xc679('0x25')](handleEntityNotFound(_0x49e630,null))[_0xc679('0x25')](function(_0x28a7c3){if(_0x28a7c3){_0x485131=_0x28a7c3;_0x438f4c[_0xc679('0x31')]=_['keys'](db[_0xc679('0x4f')][_0xc679('0x2e')]);_0x438f4c['query']=_[_0xc679('0x47')](_0x1d2130['query']);_0x438f4c[_0xc679('0x33')]=_[_0xc679('0x34')](_0x438f4c[_0xc679('0x31')],_0x438f4c[_0xc679('0x32')]);_0x242572[_0xc679('0x36')]=_[_0xc679('0x34')](_0x438f4c[_0xc679('0x31')],qs[_0xc679('0x35')](_0x1d2130[_0xc679('0x32')][_0xc679('0x35')]));_0x242572[_0xc679('0x36')]=_0x242572[_0xc679('0x36')][_0xc679('0x37')]?_0x242572[_0xc679('0x36')]:_0x438f4c['model'];_0x242572[_0xc679('0x3a')]=qs[_0xc679('0x3b')](_0x1d2130['query'][_0xc679('0x3b')]);_0x242572[_0xc679('0x3c')]=qs['filters'](_[_0xc679('0x3d')](_0x1d2130[_0xc679('0x32')],_0x438f4c[_0xc679('0x33')]));if(_0x1d2130[_0xc679('0x32')][_0xc679('0x3e')]){_0x242572[_0xc679('0x3c')]=_[_0xc679('0x48')](_0x242572[_0xc679('0x3c')],{'$or':_[_0xc679('0x2c')](_0x242572[_0xc679('0x36')],function(_0x4b0f2a){var _0x52ef03={};_0x52ef03[_0x4b0f2a]={'$like':'%'+_0x1d2130[_0xc679('0x32')][_0xc679('0x3e')]+'%'};return _0x52ef03;})});}_0x242572=_[_0xc679('0x48')]({},_0x242572,_0x1d2130[_0xc679('0x41')]);return _0x485131[_0xc679('0x51')](_0x242572);}})['then'](function(_0x23418b){if(_0x23418b){_0x301f84=_0x23418b[_0xc679('0x37')];if(!_0x1d2130[_0xc679('0x32')][_0xc679('0x38')](_0xc679('0x39'))){_0x242572['limit']=qs['limit'](_0x1d2130[_0xc679('0x32')][_0xc679('0x1d')]);_0x242572[_0xc679('0x1c')]=qs[_0xc679('0x1c')](_0x1d2130['query'][_0xc679('0x1c')]);}return _0x485131[_0xc679('0x51')](_0x242572);}})['then'](function(_0x4e6268){if(_0x4e6268){return _0x4e6268?{'count':_0x301f84,'rows':_0x4e6268}:null;}})[_0xc679('0x25')](respondWithResult(_0x49e630,null))[_0xc679('0x4b')](handleError(_0x49e630,null));};exports[_0xc679('0x52')]=function(_0x4c37e2,_0x3e007f,_0x2e2eaa){var _0x410e26={};var _0x19fa17={};var _0x248b08;var _0x51e840;return db[_0xc679('0x2d')][_0xc679('0x4e')]({'where':{'id':_0x4c37e2[_0xc679('0x46')]['id']}})['then'](handleEntityNotFound(_0x3e007f,null))[_0xc679('0x25')](function(_0x8e46df){if(_0x8e46df){_0x248b08=_0x8e46df;_0x19fa17[_0xc679('0x31')]=_['keys'](db['Dynamics365Field']['rawAttributes']);_0x19fa17[_0xc679('0x32')]=_[_0xc679('0x47')](_0x4c37e2[_0xc679('0x32')]);_0x19fa17[_0xc679('0x33')]=_[_0xc679('0x34')](_0x19fa17[_0xc679('0x31')],_0x19fa17[_0xc679('0x32')]);_0x410e26[_0xc679('0x36')]=_[_0xc679('0x34')](_0x19fa17['model'],qs[_0xc679('0x35')](_0x4c37e2['query'][_0xc679('0x35')]));_0x410e26[_0xc679('0x36')]=_0x410e26[_0xc679('0x36')][_0xc679('0x37')]?_0x410e26[_0xc679('0x36')]:_0x19fa17['model'];_0x410e26[_0xc679('0x3a')]=qs[_0xc679('0x3b')](_0x4c37e2[_0xc679('0x32')]['sort']);_0x410e26[_0xc679('0x3c')]=qs[_0xc679('0x33')](_[_0xc679('0x3d')](_0x4c37e2[_0xc679('0x32')],_0x19fa17[_0xc679('0x33')]));if(_0x4c37e2[_0xc679('0x32')]['filter']){_0x410e26[_0xc679('0x3c')]=_[_0xc679('0x48')](_0x410e26[_0xc679('0x3c')],{'$or':_[_0xc679('0x2c')](_0x410e26[_0xc679('0x36')],function(_0x4371fa){var _0x30eea9={};_0x30eea9[_0x4371fa]={'$like':'%'+_0x4c37e2['query'][_0xc679('0x3e')]+'%'};return _0x30eea9;})});}_0x410e26=_['merge']({},_0x410e26,_0x4c37e2[_0xc679('0x41')]);return _0x248b08['getDescriptions'](_0x410e26);}})['then'](function(_0x4cdf43){if(_0x4cdf43){_0x51e840=_0x4cdf43[_0xc679('0x37')];if(!_0x4c37e2[_0xc679('0x32')][_0xc679('0x38')]('nolimit')){_0x410e26['limit']=qs['limit'](_0x4c37e2['query']['limit']);_0x410e26[_0xc679('0x1c')]=qs[_0xc679('0x1c')](_0x4c37e2['query'][_0xc679('0x1c')]);}return _0x248b08['getDescriptions'](_0x410e26);}})['then'](function(_0x547d16){if(_0x547d16){return _0x547d16?{'count':_0x51e840,'rows':_0x547d16}:null;}})[_0xc679('0x25')](respondWithResult(_0x3e007f,null))['catch'](handleError(_0x3e007f,null));}; \ No newline at end of file +var _0xb4e1=['moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','reject','then','error','name','send','index','map','Dynamics365Configuration','rawAttributes','fieldName','type','query','keys','intersection','model','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','rows','catch','params','fields','find','create','body','update','destroy','getFields','findOne','Dynamics365Field','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0xae3a4b,_0x13fd27){var _0x43e241=function(_0x2e28e9){while(--_0x2e28e9){_0xae3a4b['push'](_0xae3a4b['shift']());}};_0x43e241(++_0x13fd27);}(_0xb4e1,0x181));var _0x1b4e=function(_0xb89381,_0x5406ab){_0xb89381=_0xb89381-0x0;var _0x1c64a9=_0xb4e1[_0xb89381];return _0x1c64a9;};'use strict';var emlformat=require(_0x1b4e('0x0'));var rimraf=require(_0x1b4e('0x1'));var zipdir=require(_0x1b4e('0x2'));var jsonpatch=require(_0x1b4e('0x3'));var rp=require(_0x1b4e('0x4'));var moment=require(_0x1b4e('0x5'));var BPromise=require(_0x1b4e('0x6'));var Mustache=require(_0x1b4e('0x7'));var util=require('util');var path=require(_0x1b4e('0x8'));var sox=require('sox');var csv=require(_0x1b4e('0x9'));var ejs=require(_0x1b4e('0xa'));var fs=require('fs');var fs_extra=require(_0x1b4e('0xb'));var _=require(_0x1b4e('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x1b4e('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x1b4e('0xe'));var Papa=require(_0x1b4e('0xf'));var Redis=require(_0x1b4e('0x10'));var authService=require(_0x1b4e('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x1b4e('0x12'));var hardwareService=require(_0x1b4e('0x13'));var logger=require('../../config/logger')(_0x1b4e('0x14'));var utils=require('../../config/utils');var config=require(_0x1b4e('0x15'));var licenseUtil=require(_0x1b4e('0x16'));var db=require(_0x1b4e('0x17'))['db'];function respondWithStatusCode(_0x4f697c,_0x3175d9){_0x3175d9=_0x3175d9||0xcc;return function(_0x113e68){if(_0x113e68){return _0x4f697c[_0x1b4e('0x18')](_0x3175d9);}return _0x4f697c[_0x1b4e('0x19')](_0x3175d9)[_0x1b4e('0x1a')]();};}function respondWithResult(_0x434631,_0x1c92b2){_0x1c92b2=_0x1c92b2||0xc8;return function(_0x1a1a1c){if(_0x1a1a1c){return _0x434631[_0x1b4e('0x19')](_0x1c92b2)[_0x1b4e('0x1b')](_0x1a1a1c);}};}function respondWithFilteredResult(_0x86d16d,_0x4f9d02){return function(_0x3a3a4e){if(_0x3a3a4e){var _0x25a9dd=typeof _0x4f9d02[_0x1b4e('0x1c')]==='undefined'&&typeof _0x4f9d02[_0x1b4e('0x1d')]==='undefined';var _0x1b6701=_0x3a3a4e[_0x1b4e('0x1e')];var _0x2409ad=_0x25a9dd?0x0:_0x4f9d02[_0x1b4e('0x1c')];var _0x5e364f=_0x25a9dd?_0x3a3a4e[_0x1b4e('0x1e')]:_0x4f9d02[_0x1b4e('0x1c')]+_0x4f9d02[_0x1b4e('0x1d')];var _0x568091;if(_0x5e364f>=_0x1b6701){_0x5e364f=_0x1b6701;_0x568091=0xc8;}else{_0x568091=0xce;}_0x86d16d[_0x1b4e('0x19')](_0x568091);return _0x86d16d[_0x1b4e('0x1f')](_0x1b4e('0x20'),_0x2409ad+'-'+_0x5e364f+'/'+_0x1b6701)[_0x1b4e('0x1b')](_0x3a3a4e);}return null;};}function patchUpdates(_0x1ec28f){return function(_0x10081b){try{jsonpatch[_0x1b4e('0x21')](_0x10081b,_0x1ec28f,!![]);}catch(_0x39f413){return BPromise[_0x1b4e('0x22')](_0x39f413);}return _0x10081b['save']();};}function saveUpdates(_0x1f5b91,_0x519c8b){return function(_0x3ee5b4){if(_0x3ee5b4){return _0x3ee5b4['update'](_0x1f5b91)[_0x1b4e('0x23')](function(_0x38ce58){return _0x38ce58;});}return null;};}function removeEntity(_0x405274,_0x356460){return function(_0x58684b){if(_0x58684b){return _0x58684b['destroy']()[_0x1b4e('0x23')](function(){_0x405274[_0x1b4e('0x19')](0xcc)[_0x1b4e('0x1a')]();});}};}function handleEntityNotFound(_0x1d7776,_0x192649){return function(_0x34e809){if(!_0x34e809){_0x1d7776[_0x1b4e('0x18')](0x194);}return _0x34e809;};}function handleError(_0x102471,_0x9e8f6c){_0x9e8f6c=_0x9e8f6c||0x1f4;return function(_0x1a9466){logger[_0x1b4e('0x24')](_0x1a9466['stack']);if(_0x1a9466[_0x1b4e('0x25')]){delete _0x1a9466[_0x1b4e('0x25')];}_0x102471[_0x1b4e('0x19')](_0x9e8f6c)[_0x1b4e('0x26')](_0x1a9466);};}exports[_0x1b4e('0x27')]=function(_0x9e1862,_0x2643e4){var _0x26fa00={},_0x36caaf={},_0x18cece={'count':0x0,'rows':[]};var _0x531680=_[_0x1b4e('0x28')](db[_0x1b4e('0x29')][_0x1b4e('0x2a')],function(_0x44742d){return{'name':_0x44742d[_0x1b4e('0x2b')],'type':_0x44742d[_0x1b4e('0x2c')]['key']};});_0x36caaf['model']=_[_0x1b4e('0x28')](_0x531680,_0x1b4e('0x25'));_0x36caaf[_0x1b4e('0x2d')]=_[_0x1b4e('0x2e')](_0x9e1862[_0x1b4e('0x2d')]);_0x36caaf['filters']=_[_0x1b4e('0x2f')](_0x36caaf[_0x1b4e('0x30')],_0x36caaf[_0x1b4e('0x2d')]);_0x26fa00[_0x1b4e('0x31')]=_[_0x1b4e('0x2f')](_0x36caaf[_0x1b4e('0x30')],qs['fields'](_0x9e1862[_0x1b4e('0x2d')]['fields']));_0x26fa00[_0x1b4e('0x31')]=_0x26fa00['attributes'][_0x1b4e('0x32')]?_0x26fa00[_0x1b4e('0x31')]:_0x36caaf[_0x1b4e('0x30')];if(!_0x9e1862[_0x1b4e('0x2d')][_0x1b4e('0x33')](_0x1b4e('0x34'))){_0x26fa00[_0x1b4e('0x1d')]=qs[_0x1b4e('0x1d')](_0x9e1862['query'][_0x1b4e('0x1d')]);_0x26fa00[_0x1b4e('0x1c')]=qs[_0x1b4e('0x1c')](_0x9e1862['query']['offset']);}_0x26fa00[_0x1b4e('0x35')]=qs[_0x1b4e('0x36')](_0x9e1862['query'][_0x1b4e('0x36')]);_0x26fa00[_0x1b4e('0x37')]=qs[_0x1b4e('0x38')](_[_0x1b4e('0x39')](_0x9e1862[_0x1b4e('0x2d')],_0x36caaf['filters']),_0x531680);if(_0x9e1862[_0x1b4e('0x2d')][_0x1b4e('0x3a')]){_0x26fa00[_0x1b4e('0x37')]=_[_0x1b4e('0x3b')](_0x26fa00[_0x1b4e('0x37')],{'$or':_[_0x1b4e('0x28')](_0x531680,function(_0x1cd545){if(_0x1cd545['type']!=='VIRTUAL'){var _0xea4e1={};_0xea4e1[_0x1cd545[_0x1b4e('0x25')]]={'$like':'%'+_0x9e1862[_0x1b4e('0x2d')][_0x1b4e('0x3a')]+'%'};return _0xea4e1;}})});}_0x26fa00=_[_0x1b4e('0x3b')]({},_0x26fa00,_0x9e1862[_0x1b4e('0x3c')]);var _0x26eb79={'where':_0x26fa00[_0x1b4e('0x37')]};return db[_0x1b4e('0x29')][_0x1b4e('0x1e')](_0x26eb79)[_0x1b4e('0x23')](function(_0x793aff){_0x18cece['count']=_0x793aff;if(_0x9e1862[_0x1b4e('0x2d')][_0x1b4e('0x3d')]){_0x26fa00[_0x1b4e('0x3e')]=[{'all':!![]}];}return db[_0x1b4e('0x29')][_0x1b4e('0x3f')](_0x26fa00);})[_0x1b4e('0x23')](function(_0x17aa5e){_0x18cece[_0x1b4e('0x40')]=_0x17aa5e;return _0x18cece;})[_0x1b4e('0x23')](respondWithFilteredResult(_0x2643e4,_0x26fa00))[_0x1b4e('0x41')](handleError(_0x2643e4,null));};exports['show']=function(_0x4bff50,_0x1d2e71){var _0x417ebc={'raw':![],'where':{'id':_0x4bff50[_0x1b4e('0x42')]['id']}},_0x27be64={};_0x27be64[_0x1b4e('0x30')]=_[_0x1b4e('0x2e')](db['Dynamics365Configuration'][_0x1b4e('0x2a')]);_0x27be64['query']=_[_0x1b4e('0x2e')](_0x4bff50[_0x1b4e('0x2d')]);_0x27be64[_0x1b4e('0x38')]=_[_0x1b4e('0x2f')](_0x27be64['model'],_0x27be64[_0x1b4e('0x2d')]);_0x417ebc[_0x1b4e('0x31')]=_[_0x1b4e('0x2f')](_0x27be64['model'],qs[_0x1b4e('0x43')](_0x4bff50[_0x1b4e('0x2d')]['fields']));_0x417ebc[_0x1b4e('0x31')]=_0x417ebc[_0x1b4e('0x31')][_0x1b4e('0x32')]?_0x417ebc[_0x1b4e('0x31')]:_0x27be64[_0x1b4e('0x30')];if(_0x4bff50[_0x1b4e('0x2d')][_0x1b4e('0x3d')]){_0x417ebc[_0x1b4e('0x3e')]=[{'all':!![]}];}_0x417ebc=_[_0x1b4e('0x3b')]({},_0x417ebc,_0x4bff50['options']);return db[_0x1b4e('0x29')][_0x1b4e('0x44')](_0x417ebc)[_0x1b4e('0x23')](handleEntityNotFound(_0x1d2e71,null))[_0x1b4e('0x23')](respondWithResult(_0x1d2e71,null))[_0x1b4e('0x41')](handleError(_0x1d2e71,null));};exports[_0x1b4e('0x45')]=function(_0x116457,_0x45f87f){return db[_0x1b4e('0x29')]['create'](_0x116457[_0x1b4e('0x46')],{})[_0x1b4e('0x23')](respondWithResult(_0x45f87f,0xc9))['catch'](handleError(_0x45f87f,null));};exports[_0x1b4e('0x47')]=function(_0x4934fd,_0x230aae){if(_0x4934fd[_0x1b4e('0x46')]['id']){delete _0x4934fd[_0x1b4e('0x46')]['id'];}return db[_0x1b4e('0x29')]['find']({'where':{'id':_0x4934fd['params']['id']}})[_0x1b4e('0x23')](handleEntityNotFound(_0x230aae,null))[_0x1b4e('0x23')](saveUpdates(_0x4934fd[_0x1b4e('0x46')],null))[_0x1b4e('0x23')](respondWithResult(_0x230aae,null))[_0x1b4e('0x41')](handleError(_0x230aae,null));};exports[_0x1b4e('0x48')]=function(_0x30a4db,_0xef9544){return db[_0x1b4e('0x29')][_0x1b4e('0x44')]({'where':{'id':_0x30a4db['params']['id']}})['then'](handleEntityNotFound(_0xef9544,null))[_0x1b4e('0x23')](removeEntity(_0xef9544,null))[_0x1b4e('0x41')](handleError(_0xef9544,null));};exports[_0x1b4e('0x49')]=function(_0x36bd62,_0x26b32c,_0x4b1a91){var _0x25e05e={};var _0x19874e={};var _0xb4b696;var _0x28745f;return db[_0x1b4e('0x29')][_0x1b4e('0x4a')]({'where':{'id':_0x36bd62['params']['id']}})[_0x1b4e('0x23')](handleEntityNotFound(_0x26b32c,null))['then'](function(_0x539ddd){if(_0x539ddd){_0xb4b696=_0x539ddd;_0x19874e['model']=_[_0x1b4e('0x2e')](db[_0x1b4e('0x4b')][_0x1b4e('0x2a')]);_0x19874e[_0x1b4e('0x2d')]=_[_0x1b4e('0x2e')](_0x36bd62['query']);_0x19874e[_0x1b4e('0x38')]=_[_0x1b4e('0x2f')](_0x19874e[_0x1b4e('0x30')],_0x19874e[_0x1b4e('0x2d')]);_0x25e05e[_0x1b4e('0x31')]=_[_0x1b4e('0x2f')](_0x19874e[_0x1b4e('0x30')],qs[_0x1b4e('0x43')](_0x36bd62['query'][_0x1b4e('0x43')]));_0x25e05e[_0x1b4e('0x31')]=_0x25e05e[_0x1b4e('0x31')][_0x1b4e('0x32')]?_0x25e05e[_0x1b4e('0x31')]:_0x19874e[_0x1b4e('0x30')];_0x25e05e[_0x1b4e('0x35')]=qs[_0x1b4e('0x36')](_0x36bd62['query']['sort']);_0x25e05e['where']=qs[_0x1b4e('0x38')](_[_0x1b4e('0x39')](_0x36bd62[_0x1b4e('0x2d')],_0x19874e[_0x1b4e('0x38')]));if(_0x36bd62['query'][_0x1b4e('0x3a')]){_0x25e05e[_0x1b4e('0x37')]=_[_0x1b4e('0x3b')](_0x25e05e['where'],{'$or':_[_0x1b4e('0x28')](_0x25e05e['attributes'],function(_0x46878a){var _0x41a0a8={};_0x41a0a8[_0x46878a]={'$like':'%'+_0x36bd62[_0x1b4e('0x2d')]['filter']+'%'};return _0x41a0a8;})});}_0x25e05e=_[_0x1b4e('0x3b')]({},_0x25e05e,_0x36bd62[_0x1b4e('0x3c')]);return _0xb4b696['getFields'](_0x25e05e);}})[_0x1b4e('0x23')](function(_0x251f94){if(_0x251f94){_0x28745f=_0x251f94[_0x1b4e('0x32')];if(!_0x36bd62[_0x1b4e('0x2d')][_0x1b4e('0x33')](_0x1b4e('0x34'))){_0x25e05e[_0x1b4e('0x1d')]=qs['limit'](_0x36bd62[_0x1b4e('0x2d')][_0x1b4e('0x1d')]);_0x25e05e[_0x1b4e('0x1c')]=qs[_0x1b4e('0x1c')](_0x36bd62[_0x1b4e('0x2d')][_0x1b4e('0x1c')]);}return _0xb4b696['getFields'](_0x25e05e);}})[_0x1b4e('0x23')](function(_0xd44906){if(_0xd44906){return _0xd44906?{'count':_0x28745f,'rows':_0xd44906}:null;}})[_0x1b4e('0x23')](respondWithResult(_0x26b32c,null))[_0x1b4e('0x41')](handleError(_0x26b32c,null));};exports[_0x1b4e('0x4c')]=function(_0x388893,_0x5adc43,_0x34e4eb){var _0x2f0132={};var _0x300899={};var _0x2463ec;var _0x3bf7d3;return db[_0x1b4e('0x29')][_0x1b4e('0x4a')]({'where':{'id':_0x388893[_0x1b4e('0x42')]['id']}})['then'](handleEntityNotFound(_0x5adc43,null))[_0x1b4e('0x23')](function(_0x4d0595){if(_0x4d0595){_0x2463ec=_0x4d0595;_0x300899[_0x1b4e('0x30')]=_['keys'](db['Dynamics365Field'][_0x1b4e('0x2a')]);_0x300899['query']=_[_0x1b4e('0x2e')](_0x388893[_0x1b4e('0x2d')]);_0x300899['filters']=_[_0x1b4e('0x2f')](_0x300899[_0x1b4e('0x30')],_0x300899[_0x1b4e('0x2d')]);_0x2f0132[_0x1b4e('0x31')]=_['intersection'](_0x300899[_0x1b4e('0x30')],qs[_0x1b4e('0x43')](_0x388893[_0x1b4e('0x2d')][_0x1b4e('0x43')]));_0x2f0132[_0x1b4e('0x31')]=_0x2f0132[_0x1b4e('0x31')][_0x1b4e('0x32')]?_0x2f0132[_0x1b4e('0x31')]:_0x300899[_0x1b4e('0x30')];_0x2f0132[_0x1b4e('0x35')]=qs['sort'](_0x388893[_0x1b4e('0x2d')][_0x1b4e('0x36')]);_0x2f0132[_0x1b4e('0x37')]=qs[_0x1b4e('0x38')](_[_0x1b4e('0x39')](_0x388893['query'],_0x300899[_0x1b4e('0x38')]));if(_0x388893[_0x1b4e('0x2d')]['filter']){_0x2f0132['where']=_[_0x1b4e('0x3b')](_0x2f0132[_0x1b4e('0x37')],{'$or':_[_0x1b4e('0x28')](_0x2f0132[_0x1b4e('0x31')],function(_0x22ee03){var _0x57569d={};_0x57569d[_0x22ee03]={'$like':'%'+_0x388893[_0x1b4e('0x2d')][_0x1b4e('0x3a')]+'%'};return _0x57569d;})});}_0x2f0132=_[_0x1b4e('0x3b')]({},_0x2f0132,_0x388893['options']);return _0x2463ec['getSubjects'](_0x2f0132);}})[_0x1b4e('0x23')](function(_0x3f3b31){if(_0x3f3b31){_0x3bf7d3=_0x3f3b31[_0x1b4e('0x32')];if(!_0x388893[_0x1b4e('0x2d')][_0x1b4e('0x33')](_0x1b4e('0x34'))){_0x2f0132['limit']=qs[_0x1b4e('0x1d')](_0x388893[_0x1b4e('0x2d')][_0x1b4e('0x1d')]);_0x2f0132[_0x1b4e('0x1c')]=qs[_0x1b4e('0x1c')](_0x388893['query'][_0x1b4e('0x1c')]);}return _0x2463ec['getSubjects'](_0x2f0132);}})['then'](function(_0x3f0369){if(_0x3f0369){return _0x3f0369?{'count':_0x3bf7d3,'rows':_0x3f0369}:null;}})[_0x1b4e('0x23')](respondWithResult(_0x5adc43,null))[_0x1b4e('0x41')](handleError(_0x5adc43,null));};exports['getDescriptions']=function(_0x996df8,_0x57e829,_0x3d9adc){var _0xe8ab82={};var _0x577dc2={};var _0x134431;var _0xcec021;return db[_0x1b4e('0x29')][_0x1b4e('0x4a')]({'where':{'id':_0x996df8[_0x1b4e('0x42')]['id']}})[_0x1b4e('0x23')](handleEntityNotFound(_0x57e829,null))[_0x1b4e('0x23')](function(_0x23ef10){if(_0x23ef10){_0x134431=_0x23ef10;_0x577dc2[_0x1b4e('0x30')]=_[_0x1b4e('0x2e')](db[_0x1b4e('0x4b')][_0x1b4e('0x2a')]);_0x577dc2[_0x1b4e('0x2d')]=_[_0x1b4e('0x2e')](_0x996df8['query']);_0x577dc2[_0x1b4e('0x38')]=_[_0x1b4e('0x2f')](_0x577dc2['model'],_0x577dc2[_0x1b4e('0x2d')]);_0xe8ab82['attributes']=_[_0x1b4e('0x2f')](_0x577dc2[_0x1b4e('0x30')],qs['fields'](_0x996df8['query']['fields']));_0xe8ab82[_0x1b4e('0x31')]=_0xe8ab82[_0x1b4e('0x31')][_0x1b4e('0x32')]?_0xe8ab82[_0x1b4e('0x31')]:_0x577dc2[_0x1b4e('0x30')];_0xe8ab82[_0x1b4e('0x35')]=qs[_0x1b4e('0x36')](_0x996df8['query'][_0x1b4e('0x36')]);_0xe8ab82[_0x1b4e('0x37')]=qs[_0x1b4e('0x38')](_['pick'](_0x996df8[_0x1b4e('0x2d')],_0x577dc2[_0x1b4e('0x38')]));if(_0x996df8[_0x1b4e('0x2d')]['filter']){_0xe8ab82[_0x1b4e('0x37')]=_['merge'](_0xe8ab82[_0x1b4e('0x37')],{'$or':_['map'](_0xe8ab82['attributes'],function(_0x43fa85){var _0x4524ae={};_0x4524ae[_0x43fa85]={'$like':'%'+_0x996df8['query'][_0x1b4e('0x3a')]+'%'};return _0x4524ae;})});}_0xe8ab82=_['merge']({},_0xe8ab82,_0x996df8[_0x1b4e('0x3c')]);return _0x134431['getDescriptions'](_0xe8ab82);}})['then'](function(_0x8695ed){if(_0x8695ed){_0xcec021=_0x8695ed['length'];if(!_0x996df8[_0x1b4e('0x2d')][_0x1b4e('0x33')](_0x1b4e('0x34'))){_0xe8ab82[_0x1b4e('0x1d')]=qs[_0x1b4e('0x1d')](_0x996df8['query'][_0x1b4e('0x1d')]);_0xe8ab82[_0x1b4e('0x1c')]=qs[_0x1b4e('0x1c')](_0x996df8['query'][_0x1b4e('0x1c')]);}return _0x134431[_0x1b4e('0x4d')](_0xe8ab82);}})[_0x1b4e('0x23')](function(_0x28e175){if(_0x28e175){return _0x28e175?{'count':_0xcec021,'rows':_0x28e175}:null;}})[_0x1b4e('0x23')](respondWithResult(_0x57e829,null))['catch'](handleError(_0x57e829,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index e547e02..ef41d13 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 _0xb821=['rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports','define','Dynamics365Configuration','int_dynamics365_configurations','util','../../config/logger','bluebird'];(function(_0x5761e4,_0x2f4895){var _0x490c68=function(_0x465a62){while(--_0x465a62){_0x5761e4['push'](_0x5761e4['shift']());}};_0x490c68(++_0x2f4895);}(_0xb821,0xa7));var _0x1b82=function(_0x5978f1,_0x1702cc){_0x5978f1=_0x5978f1-0x0;var _0x2fe6e1=_0xb821[_0x5978f1];return _0x2fe6e1;};'use strict';var _=require('lodash');var util=require(_0x1b82('0x0'));var logger=require(_0x1b82('0x1'))('api');var moment=require('moment');var BPromise=require(_0x1b82('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1b82('0x3'));var config=require(_0x1b82('0x4'));var attributes=require(_0x1b82('0x5'));module[_0x1b82('0x6')]=function(_0x597ca7,_0x3e27c4){return _0x597ca7[_0x1b82('0x7')](_0x1b82('0x8'),attributes,{'tableName':_0x1b82('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x54ef=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Configuration.attributes','define','Dynamics365Configuration','lodash','util'];(function(_0x19bdd2,_0x9612b6){var _0x5ceba8=function(_0x325a8b){while(--_0x325a8b){_0x19bdd2['push'](_0x19bdd2['shift']());}};_0x5ceba8(++_0x9612b6);}(_0x54ef,0x112));var _0xf54e=function(_0x72692a,_0x4cf197){_0x72692a=_0x72692a-0x0;var _0x31e4e9=_0x54ef[_0x72692a];return _0x31e4e9;};'use strict';var _=require(_0xf54e('0x0'));var util=require(_0xf54e('0x1'));var logger=require(_0xf54e('0x2'))('api');var moment=require(_0xf54e('0x3'));var BPromise=require(_0xf54e('0x4'));var rp=require(_0xf54e('0x5'));var fs=require('fs');var path=require(_0xf54e('0x6'));var rimraf=require(_0xf54e('0x7'));var config=require(_0xf54e('0x8'));var attributes=require(_0xf54e('0x9'));module['exports']=function(_0x55e611,_0x18e84e){return _0x55e611[_0xf54e('0xa')](_0xf54e('0xb'),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 5f02f65..54d1fd3 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 _0x00d7=['http','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','moment','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client'];(function(_0x188cc8,_0xd39746){var _0x4cb155=function(_0x2d2a6c){while(--_0x2d2a6c){_0x188cc8['push'](_0x188cc8['shift']());}};_0x4cb155(++_0xd39746);}(_0x00d7,0x7d));var _0x700d=function(_0xe532e3,_0x189ece){_0xe532e3=_0xe532e3-0x0;var _0x285483=_0x00d7[_0xe532e3];return _0x285483;};'use strict';var _=require('lodash');var util=require(_0x700d('0x0'));var moment=require(_0x700d('0x1'));var BPromise=require('bluebird');var rs=require(_0x700d('0x2'));var fs=require('fs');var Redis=require(_0x700d('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x700d('0x4'))(_0x700d('0x5'));var config=require('../../config/environment');var jayson=require(_0x700d('0x6'));var client=jayson[_0x700d('0x7')][_0x700d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2f3aed,_0x2ec80c,_0x14bd38){return new BPromise(function(_0x93e92e,_0x35b0ea){return client['request'](_0x2f3aed,_0x14bd38)[_0x700d('0x9')](function(_0xabef09){logger[_0x700d('0xa')](_0x700d('0xb'),_0x2ec80c,_0x700d('0xc'));logger['debug'](_0x700d('0xd'),_0x2ec80c,'request\x20sent',JSON['stringify'](_0xabef09));if(_0xabef09[_0x700d('0xe')]){if(_0xabef09[_0x700d('0xe')][_0x700d('0xf')]===0x1f4){logger[_0x700d('0xe')]('Dynamics365Configuration,\x20%s,\x20%s',_0x2ec80c,_0xabef09[_0x700d('0xe')]['message']);return _0x35b0ea(_0xabef09[_0x700d('0xe')]['message']);}logger[_0x700d('0xe')](_0x700d('0xb'),_0x2ec80c,_0xabef09[_0x700d('0xe')]['message']);return _0x93e92e(_0xabef09[_0x700d('0xe')][_0x700d('0x10')]);}else{logger[_0x700d('0xa')](_0x700d('0xb'),_0x2ec80c,_0x700d('0xc'));_0x93e92e(_0xabef09[_0x700d('0x11')]['message']);}})[_0x700d('0x12')](function(_0x45fb11){logger[_0x700d('0xe')](_0x700d('0xb'),_0x2ec80c,_0x45fb11);_0x35b0ea(_0x45fb11);});});} \ No newline at end of file +var _0x3130=['jayson/promise','http','request','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x324cd3,_0x8e9eb){var _0x42bc2b=function(_0x17a800){while(--_0x17a800){_0x324cd3['push'](_0x324cd3['shift']());}};_0x42bc2b(++_0x8e9eb);}(_0x3130,0x1be));var _0x0313=function(_0x12eb5d,_0x2187e2){_0x12eb5d=_0x12eb5d-0x0;var _0x41c9e4=_0x3130[_0x12eb5d];return _0x41c9e4;};'use strict';var _=require(_0x0313('0x0'));var util=require(_0x0313('0x1'));var moment=require(_0x0313('0x2'));var BPromise=require(_0x0313('0x3'));var rs=require(_0x0313('0x4'));var fs=require('fs');var Redis=require(_0x0313('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x0313('0x6'));var logger=require(_0x0313('0x7'))(_0x0313('0x8'));var config=require(_0x0313('0x9'));var jayson=require(_0x0313('0xa'));var client=jayson['client'][_0x0313('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x468f82,_0x236623,_0x902933){return new BPromise(function(_0x2b95b2,_0x259449){return client[_0x0313('0xc')](_0x468f82,_0x902933)[_0x0313('0xd')](function(_0x20fcfd){logger[_0x0313('0xe')](_0x0313('0xf'),_0x236623,_0x0313('0x10'));logger[_0x0313('0x11')](_0x0313('0x12'),_0x236623,'request\x20sent',JSON[_0x0313('0x13')](_0x20fcfd));if(_0x20fcfd[_0x0313('0x14')]){if(_0x20fcfd['error'][_0x0313('0x15')]===0x1f4){logger[_0x0313('0x14')](_0x0313('0xf'),_0x236623,_0x20fcfd[_0x0313('0x14')]['message']);return _0x259449(_0x20fcfd['error'][_0x0313('0x16')]);}logger[_0x0313('0x14')]('Dynamics365Configuration,\x20%s,\x20%s',_0x236623,_0x20fcfd[_0x0313('0x14')][_0x0313('0x16')]);return _0x2b95b2(_0x20fcfd[_0x0313('0x14')][_0x0313('0x16')]);}else{logger['info'](_0x0313('0xf'),_0x236623,_0x0313('0x10'));_0x2b95b2(_0x20fcfd['result'][_0x0313('0x16')]);}})[_0x0313('0x17')](function(_0x3bece0){logger[_0x0313('0x14')](_0x0313('0xf'),_0x236623,_0x3bece0);_0x259449(_0x3bece0);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index 191d894..2e721d6 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 _0xc520=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDynamics365Field.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','destroy','exports','multer','util','connect-timeout','express'];(function(_0x39fb6a,_0x8b07ae){var _0x1452a1=function(_0x391804){while(--_0x391804){_0x39fb6a['push'](_0x39fb6a['shift']());}};_0x1452a1(++_0x8b07ae);}(_0xc520,0x1f0));var _0x0c52=function(_0x473e96,_0x5855e8){_0x473e96=_0x473e96-0x0;var _0x2d8da5=_0xc520[_0x473e96];return _0x2d8da5;};'use strict';var multer=require(_0x0c52('0x0'));var util=require(_0x0c52('0x1'));var path=require('path');var timeout=require(_0x0c52('0x2'));var express=require(_0x0c52('0x3'));var router=express[_0x0c52('0x4')]();var fs_extra=require(_0x0c52('0x5'));var auth=require(_0x0c52('0x6'));var interaction=require(_0x0c52('0x7'));var config=require('../../config/environment');var controller=require(_0x0c52('0x8'));router[_0x0c52('0x9')]('/',auth[_0x0c52('0xa')](),controller[_0x0c52('0xb')]);router[_0x0c52('0x9')](_0x0c52('0xc'),auth['isAuthenticated'](),controller[_0x0c52('0xd')]);router[_0x0c52('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x0c52('0xf')](_0x0c52('0xc'),auth[_0x0c52('0xa')](),controller[_0x0c52('0x10')]);router[_0x0c52('0x11')](_0x0c52('0xc'),auth[_0x0c52('0xa')](),controller[_0x0c52('0x12')]);module[_0x0c52('0x13')]=router; \ No newline at end of file +var _0x694c=['exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','get','isAuthenticated','/:id','show','post','create','update','delete','destroy'];(function(_0x1177d5,_0x22b649){var _0xc3ddc2=function(_0x43ff95){while(--_0x43ff95){_0x1177d5['push'](_0x1177d5['shift']());}};_0xc3ddc2(++_0x22b649);}(_0x694c,0xf8));var _0xc694=function(_0x201e1b,_0x1ddea6){_0x201e1b=_0x201e1b-0x0;var _0x256eb0=_0x694c[_0x201e1b];return _0x256eb0;};'use strict';var multer=require(_0xc694('0x0'));var util=require(_0xc694('0x1'));var path=require('path');var timeout=require(_0xc694('0x2'));var express=require(_0xc694('0x3'));var router=express['Router']();var fs_extra=require(_0xc694('0x4'));var auth=require(_0xc694('0x5'));var interaction=require(_0xc694('0x6'));var config=require(_0xc694('0x7'));var controller=require(_0xc694('0x8'));router[_0xc694('0x9')]('/',auth[_0xc694('0xa')](),controller['index']);router['get'](_0xc694('0xb'),auth[_0xc694('0xa')](),controller[_0xc694('0xc')]);router[_0xc694('0xd')]('/',auth[_0xc694('0xa')](),controller[_0xc694('0xe')]);router['put'](_0xc694('0xb'),auth[_0xc694('0xa')](),controller[_0xc694('0xf')]);router[_0xc694('0x10')](_0xc694('0xb'),auth[_0xc694('0xa')](),controller[_0xc694('0x11')]);module[_0xc694('0x12')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index 12d9e2c..97ee06e 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 _0xbc1a=['STRING','customVariable','BOOLEAN','ENUM','string','variable','keyValue','picklist'];(function(_0x5e6c68,_0x5929eb){var _0x384213=function(_0x2e6a12){while(--_0x2e6a12){_0x5e6c68['push'](_0x5e6c68['shift']());}};_0x384213(++_0x5929eb);}(_0xbc1a,0x6b));var _0xabc1=function(_0x1b7368,_0x3286ed){_0x1b7368=_0x1b7368-0x0;var _0x25d54c=_0xbc1a[_0x1b7368];return _0x25d54c;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0xabc1('0x0')](_0xabc1('0x1'),_0xabc1('0x2'),'customVariable',_0xabc1('0x3'),_0xabc1('0x4')),'defaultValue':_0xabc1('0x1')},'content':{'type':Sequelize[_0xabc1('0x5')]},'key':{'type':Sequelize[_0xabc1('0x5')]},'keyType':{'type':Sequelize[_0xabc1('0x0')](_0xabc1('0x1'),_0xabc1('0x2'),_0xabc1('0x6'))},'keyContent':{'type':Sequelize[_0xabc1('0x5')]},'idField':{'type':Sequelize[_0xabc1('0x5')]},'nameField':{'type':Sequelize[_0xabc1('0x5')]},'customField':{'type':Sequelize[_0xabc1('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xabc1('0x5')]}}; \ No newline at end of file +var _0x423a=['ENUM','string','customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize','exports'];(function(_0x5b406e,_0xcd06bc){var _0xe7d242=function(_0x3fc6cc){while(--_0x3fc6cc){_0x5b406e['push'](_0x5b406e['shift']());}};_0xe7d242(++_0xcd06bc);}(_0x423a,0xdf));var _0xa423=function(_0x1439b6,_0x2552f8){_0x1439b6=_0x1439b6-0x0;var _0x539694=_0x423a[_0x1439b6];return _0x539694;};'use strict';var Sequelize=require(_0xa423('0x0'));module[_0xa423('0x1')]={'type':{'type':Sequelize[_0xa423('0x2')](_0xa423('0x3'),'variable',_0xa423('0x4'),_0xa423('0x5'),_0xa423('0x6')),'defaultValue':_0xa423('0x3')},'content':{'type':Sequelize[_0xa423('0x7')]},'key':{'type':Sequelize[_0xa423('0x7')]},'keyType':{'type':Sequelize[_0xa423('0x2')](_0xa423('0x3'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0xa423('0x7')]},'idField':{'type':Sequelize[_0xa423('0x7')]},'nameField':{'type':Sequelize[_0xa423('0x7')]},'customField':{'type':Sequelize[_0xa423('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index e0ce8c5..53ca6e9 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 _0x1026=['where','pick','merge','filter','includeAll','rows','catch','show','params','include','options','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','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','sendStatus','status','offset','undefined','limit','count','Content-Range','json','apply','reject','update','then','destroy','end','error','name','index','Dynamics365Field','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort'];(function(_0x1c197e,_0x2dd3a7){var _0x5e31b7=function(_0x84c36){while(--_0x84c36){_0x1c197e['push'](_0x1c197e['shift']());}};_0x5e31b7(++_0x2dd3a7);}(_0x1026,0xef));var _0x6102=function(_0x2b55b5,_0x78505e){_0x2b55b5=_0x2b55b5-0x0;var _0x103d28=_0x1026[_0x2b55b5];return _0x103d28;};'use strict';var emlformat=require(_0x6102('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6102('0x1'));var jsonpatch=require(_0x6102('0x2'));var rp=require(_0x6102('0x3'));var moment=require(_0x6102('0x4'));var BPromise=require(_0x6102('0x5'));var Mustache=require(_0x6102('0x6'));var util=require(_0x6102('0x7'));var path=require(_0x6102('0x8'));var sox=require(_0x6102('0x9'));var csv=require(_0x6102('0xa'));var ejs=require(_0x6102('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x6102('0xc'));var jsforce=require(_0x6102('0xd'));var deskjs=require(_0x6102('0xe'));var toCsv=require(_0x6102('0xa'));var querystring=require(_0x6102('0xf'));var Papa=require(_0x6102('0x10'));var Redis=require(_0x6102('0x11'));var authService=require(_0x6102('0x12'));var qs=require(_0x6102('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6102('0x14'));var logger=require(_0x6102('0x15'))(_0x6102('0x16'));var utils=require(_0x6102('0x17'));var config=require(_0x6102('0x18'));var licenseUtil=require(_0x6102('0x19'));var db=require(_0x6102('0x1a'))['db'];function respondWithStatusCode(_0x2148f8,_0x1b7461){_0x1b7461=_0x1b7461||0xcc;return function(_0x327c51){if(_0x327c51){return _0x2148f8[_0x6102('0x1b')](_0x1b7461);}return _0x2148f8[_0x6102('0x1c')](_0x1b7461)['end']();};}function respondWithResult(_0x1651ca,_0x1fcd25){_0x1fcd25=_0x1fcd25||0xc8;return function(_0x31e51c){if(_0x31e51c){return _0x1651ca['status'](_0x1fcd25)['json'](_0x31e51c);}};}function respondWithFilteredResult(_0x347df2,_0x373612){return function(_0x514739){if(_0x514739){var _0x1e3888=typeof _0x373612[_0x6102('0x1d')]===_0x6102('0x1e')&&typeof _0x373612[_0x6102('0x1f')]===_0x6102('0x1e');var _0x154fd3=_0x514739[_0x6102('0x20')];var _0x12bc4b=_0x1e3888?0x0:_0x373612[_0x6102('0x1d')];var _0x40d886=_0x1e3888?_0x514739[_0x6102('0x20')]:_0x373612['offset']+_0x373612[_0x6102('0x1f')];var _0x51a114;if(_0x40d886>=_0x154fd3){_0x40d886=_0x154fd3;_0x51a114=0xc8;}else{_0x51a114=0xce;}_0x347df2[_0x6102('0x1c')](_0x51a114);return _0x347df2['set'](_0x6102('0x21'),_0x12bc4b+'-'+_0x40d886+'/'+_0x154fd3)[_0x6102('0x22')](_0x514739);}return null;};}function patchUpdates(_0x20418e){return function(_0x256d29){try{jsonpatch[_0x6102('0x23')](_0x256d29,_0x20418e,!![]);}catch(_0x47731f){return BPromise[_0x6102('0x24')](_0x47731f);}return _0x256d29['save']();};}function saveUpdates(_0x19ccf2,_0x2a63da){return function(_0x8749bb){if(_0x8749bb){return _0x8749bb[_0x6102('0x25')](_0x19ccf2)[_0x6102('0x26')](function(_0x4eb461){return _0x4eb461;});}return null;};}function removeEntity(_0x5f3a9c,_0x54b8be){return function(_0x3853b3){if(_0x3853b3){return _0x3853b3[_0x6102('0x27')]()[_0x6102('0x26')](function(){_0x5f3a9c[_0x6102('0x1c')](0xcc)[_0x6102('0x28')]();});}};}function handleEntityNotFound(_0x557b51,_0x5860cf){return function(_0x596862){if(!_0x596862){_0x557b51['sendStatus'](0x194);}return _0x596862;};}function handleError(_0x52da6f,_0x27f93f){_0x27f93f=_0x27f93f||0x1f4;return function(_0x5810b9){logger[_0x6102('0x29')](_0x5810b9['stack']);if(_0x5810b9['name']){delete _0x5810b9[_0x6102('0x2a')];}_0x52da6f[_0x6102('0x1c')](_0x27f93f)['send'](_0x5810b9);};}exports[_0x6102('0x2b')]=function(_0x33161c,_0x152bb7){var _0x2e15eb={},_0x41f604={},_0x592ee9={'count':0x0,'rows':[]};var _0x516096=_['map'](db[_0x6102('0x2c')][_0x6102('0x2d')],function(_0x41a0cf){return{'name':_0x41a0cf[_0x6102('0x2e')],'type':_0x41a0cf[_0x6102('0x2f')]['key']};});_0x41f604[_0x6102('0x30')]=_[_0x6102('0x31')](_0x516096,_0x6102('0x2a'));_0x41f604[_0x6102('0x32')]=_[_0x6102('0x33')](_0x33161c[_0x6102('0x32')]);_0x41f604[_0x6102('0x34')]=_[_0x6102('0x35')](_0x41f604['model'],_0x41f604[_0x6102('0x32')]);_0x2e15eb['attributes']=_[_0x6102('0x35')](_0x41f604[_0x6102('0x30')],qs[_0x6102('0x36')](_0x33161c['query'][_0x6102('0x36')]));_0x2e15eb[_0x6102('0x37')]=_0x2e15eb['attributes'][_0x6102('0x38')]?_0x2e15eb['attributes']:_0x41f604[_0x6102('0x30')];if(!_0x33161c[_0x6102('0x32')][_0x6102('0x39')](_0x6102('0x3a'))){_0x2e15eb[_0x6102('0x1f')]=qs['limit'](_0x33161c[_0x6102('0x32')]['limit']);_0x2e15eb['offset']=qs[_0x6102('0x1d')](_0x33161c[_0x6102('0x32')][_0x6102('0x1d')]);}_0x2e15eb[_0x6102('0x3b')]=qs[_0x6102('0x3c')](_0x33161c[_0x6102('0x32')][_0x6102('0x3c')]);_0x2e15eb[_0x6102('0x3d')]=qs[_0x6102('0x34')](_[_0x6102('0x3e')](_0x33161c[_0x6102('0x32')],_0x41f604[_0x6102('0x34')]),_0x516096);if(_0x33161c[_0x6102('0x32')]['filter']){_0x2e15eb['where']=_[_0x6102('0x3f')](_0x2e15eb['where'],{'$or':_[_0x6102('0x31')](_0x516096,function(_0xebce71){if(_0xebce71[_0x6102('0x2f')]!=='VIRTUAL'){var _0x2e40a9={};_0x2e40a9[_0xebce71[_0x6102('0x2a')]]={'$like':'%'+_0x33161c[_0x6102('0x32')][_0x6102('0x40')]+'%'};return _0x2e40a9;}})});}_0x2e15eb=_[_0x6102('0x3f')]({},_0x2e15eb,_0x33161c['options']);var _0x3fae1b={'where':_0x2e15eb[_0x6102('0x3d')]};return db['Dynamics365Field'][_0x6102('0x20')](_0x3fae1b)['then'](function(_0x1db7ed){_0x592ee9['count']=_0x1db7ed;if(_0x33161c[_0x6102('0x32')][_0x6102('0x41')]){_0x2e15eb['include']=[{'all':!![]}];}return db[_0x6102('0x2c')]['findAll'](_0x2e15eb);})[_0x6102('0x26')](function(_0x37a2ec){_0x592ee9[_0x6102('0x42')]=_0x37a2ec;return _0x592ee9;})['then'](respondWithFilteredResult(_0x152bb7,_0x2e15eb))[_0x6102('0x43')](handleError(_0x152bb7,null));};exports[_0x6102('0x44')]=function(_0x538b56,_0xcb8094){var _0xf4ef78={'raw':!![],'where':{'id':_0x538b56[_0x6102('0x45')]['id']}},_0x15a4e7={};_0x15a4e7[_0x6102('0x30')]=_[_0x6102('0x33')](db['Dynamics365Field'][_0x6102('0x2d')]);_0x15a4e7['query']=_[_0x6102('0x33')](_0x538b56[_0x6102('0x32')]);_0x15a4e7[_0x6102('0x34')]=_[_0x6102('0x35')](_0x15a4e7[_0x6102('0x30')],_0x15a4e7[_0x6102('0x32')]);_0xf4ef78['attributes']=_[_0x6102('0x35')](_0x15a4e7['model'],qs[_0x6102('0x36')](_0x538b56[_0x6102('0x32')][_0x6102('0x36')]));_0xf4ef78['attributes']=_0xf4ef78[_0x6102('0x37')][_0x6102('0x38')]?_0xf4ef78['attributes']:_0x15a4e7[_0x6102('0x30')];if(_0x538b56['query'][_0x6102('0x41')]){_0xf4ef78[_0x6102('0x46')]=[{'all':!![]}];}_0xf4ef78=_[_0x6102('0x3f')]({},_0xf4ef78,_0x538b56[_0x6102('0x47')]);return db[_0x6102('0x2c')][_0x6102('0x48')](_0xf4ef78)[_0x6102('0x26')](handleEntityNotFound(_0xcb8094,null))[_0x6102('0x26')](respondWithResult(_0xcb8094,null))[_0x6102('0x43')](handleError(_0xcb8094,null));};exports[_0x6102('0x49')]=function(_0x58ef16,_0x18a56c){return db[_0x6102('0x2c')][_0x6102('0x49')](_0x58ef16[_0x6102('0x4a')],{})['then'](respondWithResult(_0x18a56c,0xc9))[_0x6102('0x43')](handleError(_0x18a56c,null));};exports[_0x6102('0x25')]=function(_0x412a30,_0x236bd5){if(_0x412a30[_0x6102('0x4a')]['id']){delete _0x412a30[_0x6102('0x4a')]['id'];}return db[_0x6102('0x2c')][_0x6102('0x48')]({'where':{'id':_0x412a30[_0x6102('0x45')]['id']}})[_0x6102('0x26')](handleEntityNotFound(_0x236bd5,null))[_0x6102('0x26')](saveUpdates(_0x412a30['body'],null))[_0x6102('0x26')](respondWithResult(_0x236bd5,null))['catch'](handleError(_0x236bd5,null));};exports['destroy']=function(_0x5aaf3f,_0xf035d4){return db[_0x6102('0x2c')][_0x6102('0x48')]({'where':{'id':_0x5aaf3f['params']['id']}})[_0x6102('0x26')](handleEntityNotFound(_0xf035d4,null))[_0x6102('0x26')](removeEntity(_0xf035d4,null))[_0x6102('0x43')](handleError(_0xf035d4,null));}; \ No newline at end of file +var _0xcfe0=['options','find','catch','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','end','sendStatus','error','stack','name','send','index','map','Dynamics365Field','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','include','findAll','rows','includeAll'];(function(_0xa03db6,_0x436e2c){var _0x1e7e80=function(_0x4d4747){while(--_0x4d4747){_0xa03db6['push'](_0xa03db6['shift']());}};_0x1e7e80(++_0x436e2c);}(_0xcfe0,0x17d));var _0x0cfe=function(_0x418663,_0x232a00){_0x418663=_0x418663-0x0;var _0x4d78cf=_0xcfe0[_0x418663];return _0x4d78cf;};'use strict';var emlformat=require(_0x0cfe('0x0'));var rimraf=require(_0x0cfe('0x1'));var zipdir=require(_0x0cfe('0x2'));var jsonpatch=require(_0x0cfe('0x3'));var rp=require(_0x0cfe('0x4'));var moment=require(_0x0cfe('0x5'));var BPromise=require(_0x0cfe('0x6'));var Mustache=require(_0x0cfe('0x7'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x0cfe('0x8'));var ejs=require(_0x0cfe('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0cfe('0xa'));var squel=require(_0x0cfe('0xb'));var crypto=require('crypto');var jsforce=require(_0x0cfe('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x0cfe('0x8'));var querystring=require(_0x0cfe('0xd'));var Papa=require(_0x0cfe('0xe'));var Redis=require(_0x0cfe('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x0cfe('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0cfe('0x11'));var logger=require(_0x0cfe('0x12'))(_0x0cfe('0x13'));var utils=require(_0x0cfe('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x0cfe('0x15'))['db'];function respondWithStatusCode(_0x2f1157,_0xe9d8b8){_0xe9d8b8=_0xe9d8b8||0xcc;return function(_0x19737e){if(_0x19737e){return _0x2f1157['sendStatus'](_0xe9d8b8);}return _0x2f1157[_0x0cfe('0x16')](_0xe9d8b8)['end']();};}function respondWithResult(_0x537555,_0x174efa){_0x174efa=_0x174efa||0xc8;return function(_0x3714bd){if(_0x3714bd){return _0x537555[_0x0cfe('0x16')](_0x174efa)[_0x0cfe('0x17')](_0x3714bd);}};}function respondWithFilteredResult(_0x207559,_0x171f19){return function(_0x213f14){if(_0x213f14){var _0x5b2794=typeof _0x171f19[_0x0cfe('0x18')]===_0x0cfe('0x19')&&typeof _0x171f19[_0x0cfe('0x1a')]===_0x0cfe('0x19');var _0x1581d3=_0x213f14[_0x0cfe('0x1b')];var _0x2521d7=_0x5b2794?0x0:_0x171f19['offset'];var _0x31a225=_0x5b2794?_0x213f14[_0x0cfe('0x1b')]:_0x171f19['offset']+_0x171f19[_0x0cfe('0x1a')];var _0x184172;if(_0x31a225>=_0x1581d3){_0x31a225=_0x1581d3;_0x184172=0xc8;}else{_0x184172=0xce;}_0x207559[_0x0cfe('0x16')](_0x184172);return _0x207559['set'](_0x0cfe('0x1c'),_0x2521d7+'-'+_0x31a225+'/'+_0x1581d3)[_0x0cfe('0x17')](_0x213f14);}return null;};}function patchUpdates(_0x352404){return function(_0x105a59){try{jsonpatch[_0x0cfe('0x1d')](_0x105a59,_0x352404,!![]);}catch(_0x3d75d9){return BPromise[_0x0cfe('0x1e')](_0x3d75d9);}return _0x105a59[_0x0cfe('0x1f')]();};}function saveUpdates(_0x7a6a31,_0x30dbbe){return function(_0x5c5515){if(_0x5c5515){return _0x5c5515[_0x0cfe('0x20')](_0x7a6a31)[_0x0cfe('0x21')](function(_0x36ff4a){return _0x36ff4a;});}return null;};}function removeEntity(_0x49654b,_0x3fa7a6){return function(_0x84ed3c){if(_0x84ed3c){return _0x84ed3c[_0x0cfe('0x22')]()[_0x0cfe('0x21')](function(){_0x49654b[_0x0cfe('0x16')](0xcc)[_0x0cfe('0x23')]();});}};}function handleEntityNotFound(_0x449bf9,_0x21f48f){return function(_0x35848b){if(!_0x35848b){_0x449bf9[_0x0cfe('0x24')](0x194);}return _0x35848b;};}function handleError(_0x3a1e97,_0x15fa7e){_0x15fa7e=_0x15fa7e||0x1f4;return function(_0x2105ec){logger[_0x0cfe('0x25')](_0x2105ec[_0x0cfe('0x26')]);if(_0x2105ec[_0x0cfe('0x27')]){delete _0x2105ec[_0x0cfe('0x27')];}_0x3a1e97['status'](_0x15fa7e)[_0x0cfe('0x28')](_0x2105ec);};}exports[_0x0cfe('0x29')]=function(_0x2031f7,_0x5e8a08){var _0x21d097={},_0x525bae={},_0x599624={'count':0x0,'rows':[]};var _0x1bd0cb=_[_0x0cfe('0x2a')](db[_0x0cfe('0x2b')][_0x0cfe('0x2c')],function(_0x4c0e0){return{'name':_0x4c0e0[_0x0cfe('0x2d')],'type':_0x4c0e0[_0x0cfe('0x2e')][_0x0cfe('0x2f')]};});_0x525bae[_0x0cfe('0x30')]=_['map'](_0x1bd0cb,_0x0cfe('0x27'));_0x525bae['query']=_[_0x0cfe('0x31')](_0x2031f7[_0x0cfe('0x32')]);_0x525bae[_0x0cfe('0x33')]=_[_0x0cfe('0x34')](_0x525bae['model'],_0x525bae['query']);_0x21d097[_0x0cfe('0x35')]=_[_0x0cfe('0x34')](_0x525bae[_0x0cfe('0x30')],qs[_0x0cfe('0x36')](_0x2031f7['query']['fields']));_0x21d097['attributes']=_0x21d097['attributes'][_0x0cfe('0x37')]?_0x21d097[_0x0cfe('0x35')]:_0x525bae[_0x0cfe('0x30')];if(!_0x2031f7[_0x0cfe('0x32')][_0x0cfe('0x38')](_0x0cfe('0x39'))){_0x21d097[_0x0cfe('0x1a')]=qs[_0x0cfe('0x1a')](_0x2031f7[_0x0cfe('0x32')][_0x0cfe('0x1a')]);_0x21d097[_0x0cfe('0x18')]=qs['offset'](_0x2031f7['query'][_0x0cfe('0x18')]);}_0x21d097[_0x0cfe('0x3a')]=qs[_0x0cfe('0x3b')](_0x2031f7[_0x0cfe('0x32')]['sort']);_0x21d097['where']=qs[_0x0cfe('0x33')](_[_0x0cfe('0x3c')](_0x2031f7['query'],_0x525bae[_0x0cfe('0x33')]),_0x1bd0cb);if(_0x2031f7[_0x0cfe('0x32')][_0x0cfe('0x3d')]){_0x21d097['where']=_[_0x0cfe('0x3e')](_0x21d097[_0x0cfe('0x3f')],{'$or':_[_0x0cfe('0x2a')](_0x1bd0cb,function(_0xf17528){if(_0xf17528[_0x0cfe('0x2e')]!==_0x0cfe('0x40')){var _0x4e47f9={};_0x4e47f9[_0xf17528['name']]={'$like':'%'+_0x2031f7['query'][_0x0cfe('0x3d')]+'%'};return _0x4e47f9;}})});}_0x21d097=_[_0x0cfe('0x3e')]({},_0x21d097,_0x2031f7['options']);var _0x18f4a5={'where':_0x21d097[_0x0cfe('0x3f')]};return db[_0x0cfe('0x2b')]['count'](_0x18f4a5)['then'](function(_0x4d753f){_0x599624[_0x0cfe('0x1b')]=_0x4d753f;if(_0x2031f7['query']['includeAll']){_0x21d097[_0x0cfe('0x41')]=[{'all':!![]}];}return db[_0x0cfe('0x2b')][_0x0cfe('0x42')](_0x21d097);})[_0x0cfe('0x21')](function(_0xc0c47d){_0x599624[_0x0cfe('0x43')]=_0xc0c47d;return _0x599624;})[_0x0cfe('0x21')](respondWithFilteredResult(_0x5e8a08,_0x21d097))['catch'](handleError(_0x5e8a08,null));};exports['show']=function(_0x2bcdf2,_0x212a75){var _0x48b29f={'raw':!![],'where':{'id':_0x2bcdf2['params']['id']}},_0x555987={};_0x555987[_0x0cfe('0x30')]=_[_0x0cfe('0x31')](db[_0x0cfe('0x2b')][_0x0cfe('0x2c')]);_0x555987[_0x0cfe('0x32')]=_[_0x0cfe('0x31')](_0x2bcdf2[_0x0cfe('0x32')]);_0x555987['filters']=_['intersection'](_0x555987[_0x0cfe('0x30')],_0x555987[_0x0cfe('0x32')]);_0x48b29f[_0x0cfe('0x35')]=_[_0x0cfe('0x34')](_0x555987[_0x0cfe('0x30')],qs['fields'](_0x2bcdf2[_0x0cfe('0x32')][_0x0cfe('0x36')]));_0x48b29f[_0x0cfe('0x35')]=_0x48b29f['attributes'][_0x0cfe('0x37')]?_0x48b29f[_0x0cfe('0x35')]:_0x555987['model'];if(_0x2bcdf2[_0x0cfe('0x32')][_0x0cfe('0x44')]){_0x48b29f[_0x0cfe('0x41')]=[{'all':!![]}];}_0x48b29f=_['merge']({},_0x48b29f,_0x2bcdf2[_0x0cfe('0x45')]);return db[_0x0cfe('0x2b')][_0x0cfe('0x46')](_0x48b29f)[_0x0cfe('0x21')](handleEntityNotFound(_0x212a75,null))[_0x0cfe('0x21')](respondWithResult(_0x212a75,null))[_0x0cfe('0x47')](handleError(_0x212a75,null));};exports[_0x0cfe('0x48')]=function(_0x2188b2,_0x5b71d0){return db[_0x0cfe('0x2b')][_0x0cfe('0x48')](_0x2188b2[_0x0cfe('0x49')],{})['then'](respondWithResult(_0x5b71d0,0xc9))['catch'](handleError(_0x5b71d0,null));};exports[_0x0cfe('0x20')]=function(_0x44a179,_0x8a13be){if(_0x44a179['body']['id']){delete _0x44a179[_0x0cfe('0x49')]['id'];}return db[_0x0cfe('0x2b')][_0x0cfe('0x46')]({'where':{'id':_0x44a179['params']['id']}})[_0x0cfe('0x21')](handleEntityNotFound(_0x8a13be,null))[_0x0cfe('0x21')](saveUpdates(_0x44a179[_0x0cfe('0x49')],null))[_0x0cfe('0x21')](respondWithResult(_0x8a13be,null))['catch'](handleError(_0x8a13be,null));};exports['destroy']=function(_0x4c21b6,_0x4a1f19){return db['Dynamics365Field'][_0x0cfe('0x46')]({'where':{'id':_0x4c21b6[_0x0cfe('0x4a')]['id']}})[_0x0cfe('0x21')](handleEntityNotFound(_0x4a1f19,null))['then'](removeEntity(_0x4a1f19,null))[_0x0cfe('0x47')](handleError(_0x4a1f19,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index 2723bad..792b7f8 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 _0x811c=['bluebird','request-promise','path','../../config/environment','exports','define','Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index','../../config/logger','api'];(function(_0xd9a3c2,_0x29d426){var _0x15df3b=function(_0x1507d8){while(--_0x1507d8){_0xd9a3c2['push'](_0xd9a3c2['shift']());}};_0x15df3b(++_0x29d426);}(_0x811c,0xae));var _0xc811=function(_0x13643e,_0x4a4efa){_0x13643e=_0x13643e-0x0;var _0x5d11dc=_0x811c[_0x13643e];return _0x5d11dc;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xc811('0x0'))(_0xc811('0x1'));var moment=require('moment');var BPromise=require(_0xc811('0x2'));var rp=require(_0xc811('0x3'));var fs=require('fs');var path=require(_0xc811('0x4'));var rimraf=require('rimraf');var config=require(_0xc811('0x5'));var attributes=require('./intDynamics365Field.attributes');module[_0xc811('0x6')]=function(_0x482d54,_0x354082){return _0x482d54[_0xc811('0x7')](_0xc811('0x8'),attributes,{'tableName':_0xc811('0x9'),'paranoid':![],'indexes':[{'name':_0xc811('0xa'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5a05=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','dynamics365_unique_index','idField'];(function(_0x194c31,_0x3db07c){var _0x5829a2=function(_0x5c4f3b){while(--_0x5c4f3b){_0x194c31['push'](_0x194c31['shift']());}};_0x5829a2(++_0x3db07c);}(_0x5a05,0x1ce));var _0x55a0=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x5a05[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x55a0('0x0'));var util=require(_0x55a0('0x1'));var logger=require(_0x55a0('0x2'))(_0x55a0('0x3'));var moment=require(_0x55a0('0x4'));var BPromise=require(_0x55a0('0x5'));var rp=require(_0x55a0('0x6'));var fs=require('fs');var path=require(_0x55a0('0x7'));var rimraf=require(_0x55a0('0x8'));var config=require(_0x55a0('0x9'));var attributes=require('./intDynamics365Field.attributes');module[_0x55a0('0xa')]=function(_0x58c104,_0x3a81ec){return _0x58c104[_0x55a0('0xb')]('Dynamics365Field',attributes,{'tableName':'int_dynamics365_fields','paranoid':![],'indexes':[{'name':_0x55a0('0xc'),'fields':[_0x55a0('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.rpc.js b/server/api/intDynamics365Field/intDynamics365Field.rpc.js index d631543..24ed680 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 _0xee80=['request','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','Dynamics365Field,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x1c2fc1,_0xe8cb37){var _0x29de42=function(_0x171303){while(--_0x171303){_0x1c2fc1['push'](_0x1c2fc1['shift']());}};_0x29de42(++_0xe8cb37);}(_0xee80,0x1d1));var _0x0ee8=function(_0x40a825,_0x3bac79){_0x40a825=_0x40a825-0x0;var _0x273a54=_0xee80[_0x40a825];return _0x273a54;};'use strict';var _=require(_0x0ee8('0x0'));var util=require(_0x0ee8('0x1'));var moment=require('moment');var BPromise=require(_0x0ee8('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0ee8('0x3'));var db=require(_0x0ee8('0x4'))['db'];var utils=require(_0x0ee8('0x5'));var logger=require(_0x0ee8('0x6'))(_0x0ee8('0x7'));var config=require(_0x0ee8('0x8'));var jayson=require(_0x0ee8('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x817e73,_0x4128a9,_0x192059){return new BPromise(function(_0x5c21c7,_0x2363e9){return client[_0x0ee8('0xa')](_0x817e73,_0x192059)['then'](function(_0x593720){logger[_0x0ee8('0xb')](_0x0ee8('0xc'),_0x4128a9,_0x0ee8('0xd'));logger['debug'](_0x0ee8('0xe'),_0x4128a9,_0x0ee8('0xd'),JSON['stringify'](_0x593720));if(_0x593720[_0x0ee8('0xf')]){if(_0x593720['error'][_0x0ee8('0x10')]===0x1f4){logger[_0x0ee8('0xf')]('Dynamics365Field,\x20%s,\x20%s',_0x4128a9,_0x593720[_0x0ee8('0xf')][_0x0ee8('0x11')]);return _0x2363e9(_0x593720[_0x0ee8('0xf')][_0x0ee8('0x11')]);}logger[_0x0ee8('0xf')]('Dynamics365Field,\x20%s,\x20%s',_0x4128a9,_0x593720[_0x0ee8('0xf')][_0x0ee8('0x11')]);return _0x5c21c7(_0x593720[_0x0ee8('0xf')][_0x0ee8('0x11')]);}else{logger[_0x0ee8('0xb')](_0x0ee8('0xc'),_0x4128a9,_0x0ee8('0xd'));_0x5c21c7(_0x593720['result'][_0x0ee8('0x11')]);}})[_0x0ee8('0x12')](function(_0x2ceb4e){logger[_0x0ee8('0xf')](_0x0ee8('0xc'),_0x4128a9,_0x2ceb4e);_0x2363e9(_0x2ceb4e);});});} \ No newline at end of file +var _0x5977=['randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','request','info','Dynamics365Field,\x20%s,\x20%s','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','moment'];(function(_0x14aaae,_0x1a261){var _0x5a1189=function(_0x7673ce){while(--_0x7673ce){_0x14aaae['push'](_0x14aaae['shift']());}};_0x5a1189(++_0x1a261);}(_0x5977,0x115));var _0x7597=function(_0x18af67,_0x411413){_0x18af67=_0x18af67-0x0;var _0x5d13c2=_0x5977[_0x18af67];return _0x5d13c2;};'use strict';var _=require(_0x7597('0x0'));var util=require(_0x7597('0x1'));var moment=require(_0x7597('0x2'));var BPromise=require('bluebird');var rs=require(_0x7597('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7597('0x4'))['db'];var utils=require(_0x7597('0x5'));var logger=require(_0x7597('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x7597('0x7'));var client=jayson[_0x7597('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0xb34041,_0x2ea92c,_0x3aec7f){return new BPromise(function(_0x42d85c,_0x295abb){return client[_0x7597('0x9')](_0xb34041,_0x3aec7f)['then'](function(_0x48a672){logger[_0x7597('0xa')](_0x7597('0xb'),_0x2ea92c,'request\x20sent');logger[_0x7597('0xc')](_0x7597('0xd'),_0x2ea92c,_0x7597('0xe'),JSON[_0x7597('0xf')](_0x48a672));if(_0x48a672[_0x7597('0x10')]){if(_0x48a672[_0x7597('0x10')]['code']===0x1f4){logger['error'](_0x7597('0xb'),_0x2ea92c,_0x48a672['error'][_0x7597('0x11')]);return _0x295abb(_0x48a672[_0x7597('0x10')]['message']);}logger[_0x7597('0x10')](_0x7597('0xb'),_0x2ea92c,_0x48a672[_0x7597('0x10')][_0x7597('0x11')]);return _0x42d85c(_0x48a672[_0x7597('0x10')][_0x7597('0x11')]);}else{logger[_0x7597('0xa')](_0x7597('0xb'),_0x2ea92c,_0x7597('0xe'));_0x42d85c(_0x48a672[_0x7597('0x12')][_0x7597('0x11')]);}})[_0x7597('0x13')](function(_0x2b0bdf){logger[_0x7597('0x10')](_0x7597('0xb'),_0x2ea92c,_0x2b0bdf);_0x295abb(_0x2b0bdf);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index 36da96e..420796b 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 _0x70b0=['../../config/environment','./intFreshdeskAccount.controller','get','index','/:id','isAuthenticated','show','getConfigurations','/:id/fields','getFields','post','/:id/configurations','addConfiguration','put','update','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x2dac44,_0x4d66ec){var _0x2e1c27=function(_0x464475){while(--_0x464475){_0x2dac44['push'](_0x2dac44['shift']());}};_0x2e1c27(++_0x4d66ec);}(_0x70b0,0x1a9));var _0x070b=function(_0x2050f7,_0x3833c6){_0x2050f7=_0x2050f7-0x0;var _0x219da1=_0x70b0[_0x2050f7];return _0x219da1;};'use strict';var multer=require('multer');var util=require(_0x070b('0x0'));var path=require(_0x070b('0x1'));var timeout=require(_0x070b('0x2'));var express=require(_0x070b('0x3'));var router=express[_0x070b('0x4')]();var fs_extra=require(_0x070b('0x5'));var auth=require(_0x070b('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x070b('0x7'));var controller=require(_0x070b('0x8'));router[_0x070b('0x9')]('/',auth['isAuthenticated'](),controller[_0x070b('0xa')]);router['get'](_0x070b('0xb'),auth[_0x070b('0xc')](),controller[_0x070b('0xd')]);router[_0x070b('0x9')]('/:id/configurations',auth[_0x070b('0xc')](),controller[_0x070b('0xe')]);router[_0x070b('0x9')](_0x070b('0xf'),auth['isAuthenticated'](),controller[_0x070b('0x10')]);router[_0x070b('0x11')]('/',auth[_0x070b('0xc')](),controller['create']);router[_0x070b('0x11')](_0x070b('0x12'),auth[_0x070b('0xc')](),controller[_0x070b('0x13')]);router[_0x070b('0x14')]('/:id',auth[_0x070b('0xc')](),controller[_0x070b('0x15')]);router['delete'](_0x070b('0xb'),auth[_0x070b('0xc')](),controller[_0x070b('0x16')]);module[_0x070b('0x17')]=router; \ No newline at end of file +var _0xa128=['get','isAuthenticated','index','/:id','/:id/configurations','getConfigurations','/:id/fields','post','create','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intFreshdeskAccount.controller'];(function(_0x324012,_0x23f45f){var _0x435cf2=function(_0x378a82){while(--_0x378a82){_0x324012['push'](_0x324012['shift']());}};_0x435cf2(++_0x23f45f);}(_0xa128,0x9e));var _0x8a12=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0xa128[_0x3054be];return _0x3df150;};'use strict';var multer=require(_0x8a12('0x0'));var util=require(_0x8a12('0x1'));var path=require(_0x8a12('0x2'));var timeout=require(_0x8a12('0x3'));var express=require(_0x8a12('0x4'));var router=express[_0x8a12('0x5')]();var fs_extra=require(_0x8a12('0x6'));var auth=require(_0x8a12('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x8a12('0x8'));var controller=require(_0x8a12('0x9'));router[_0x8a12('0xa')]('/',auth[_0x8a12('0xb')](),controller[_0x8a12('0xc')]);router[_0x8a12('0xa')](_0x8a12('0xd'),auth[_0x8a12('0xb')](),controller['show']);router['get'](_0x8a12('0xe'),auth[_0x8a12('0xb')](),controller[_0x8a12('0xf')]);router['get'](_0x8a12('0x10'),auth['isAuthenticated'](),controller['getFields']);router[_0x8a12('0x11')]('/',auth[_0x8a12('0xb')](),controller[_0x8a12('0x12')]);router[_0x8a12('0x11')](_0x8a12('0xe'),auth[_0x8a12('0xb')](),controller['addConfiguration']);router['put'](_0x8a12('0xd'),auth[_0x8a12('0xb')](),controller['update']);router['delete']('/:id',auth[_0x8a12('0xb')](),controller[_0x8a12('0x13')]);module[_0x8a12('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 57f093d..bd896bb 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 _0x5b12=['STRING','sequelize','exports'];(function(_0x125ff8,_0x41925f){var _0x2d9ef=function(_0x4ef34c){while(--_0x4ef34c){_0x125ff8['push'](_0x125ff8['shift']());}};_0x2d9ef(++_0x41925f);}(_0x5b12,0xa3));var _0x25b1=function(_0x558649,_0x483360){_0x558649=_0x558649-0x0;var _0x3f8cbd=_0x5b12[_0x558649];return _0x3f8cbd;};'use strict';var Sequelize=require(_0x25b1('0x0'));module[_0x25b1('0x1')]={'name':{'type':Sequelize[_0x25b1('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x25b1('0x2')],'unique':'username'},'apiKey':{'type':Sequelize[_0x25b1('0x2')]},'remoteUri':{'type':Sequelize[_0x25b1('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x25b1('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x9582=['exports','STRING','username','remoteUri','sequelize'];(function(_0x5c4e0e,_0x3062eb){var _0x54b7d4=function(_0x1a62c5){while(--_0x1a62c5){_0x5c4e0e['push'](_0x5c4e0e['shift']());}};_0x54b7d4(++_0x3062eb);}(_0x9582,0x95));var _0x2958=function(_0x2ba315,_0x31a01f){_0x2ba315=_0x2ba315-0x0;var _0x3e8580=_0x9582[_0x2ba315];return _0x3e8580;};'use strict';var Sequelize=require(_0x2958('0x0'));module[_0x2958('0x1')]={'name':{'type':Sequelize[_0x2958('0x2')]},'description':{'type':Sequelize[_0x2958('0x2')]},'username':{'type':Sequelize[_0x2958('0x2')],'unique':_0x2958('0x3')},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x2958('0x2')],'unique':_0x2958('0x4')},'serverUrl':{'type':Sequelize[_0x2958('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index 21a2eae..91cb43b 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 _0xcfac=['FreshdeskConfiguration','pick','hasOwnProperty','nolimit','addConfiguration','AccountId','Subjects','channel','Descriptions','FreshdeskField','getFields','remoteUri','apiKey','substring','lastIndexOf','GET','%s/%s','api/v2/ticket_fields','format','Basic\x20%s','%s:X','toString','requester','subject','description','group','source','ticket_type','remove','custom_dropdown','label','choices','capitalize','test','statusCode','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','json','undefined','offset','count','limit','update','destroy','then','error','name','send','index','map','FreshdeskAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','params','length','find','create','body','getConfigurations','findOne'];(function(_0x15ea09,_0x2f30ab){var _0x3e9c78=function(_0x15f8ba){while(--_0x15f8ba){_0x15ea09['push'](_0x15ea09['shift']());}};_0x3e9c78(++_0x2f30ab);}(_0xcfac,0x105));var _0xccfa=function(_0x4b6152,_0x4c68d3){_0x4b6152=_0x4b6152-0x0;var _0x16277d=_0xcfac[_0x4b6152];return _0x16277d;};'use strict';var emlformat=require(_0xccfa('0x0'));var rimraf=require(_0xccfa('0x1'));var zipdir=require(_0xccfa('0x2'));var jsonpatch=require(_0xccfa('0x3'));var rp=require(_0xccfa('0x4'));var moment=require(_0xccfa('0x5'));var BPromise=require(_0xccfa('0x6'));var Mustache=require(_0xccfa('0x7'));var util=require(_0xccfa('0x8'));var path=require('path');var sox=require(_0xccfa('0x9'));var csv=require(_0xccfa('0xa'));var ejs=require(_0xccfa('0xb'));var fs=require('fs');var fs_extra=require(_0xccfa('0xc'));var _=require(_0xccfa('0xd'));var squel=require(_0xccfa('0xe'));var crypto=require(_0xccfa('0xf'));var jsforce=require('jsforce');var deskjs=require(_0xccfa('0x10'));var toCsv=require(_0xccfa('0xa'));var querystring=require(_0xccfa('0x11'));var Papa=require(_0xccfa('0x12'));var Redis=require(_0xccfa('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xccfa('0x14'));var as=require(_0xccfa('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xccfa('0x16'))(_0xccfa('0x17'));var utils=require(_0xccfa('0x18'));var config=require(_0xccfa('0x19'));var licenseUtil=require(_0xccfa('0x1a'));var db=require('../../mysqldb')['db'];var integrations=require(_0xccfa('0x1b'));function respondWithStatusCode(_0x28d4e9,_0x73ab6d){_0x73ab6d=_0x73ab6d||0xcc;return function(_0x200af7){if(_0x200af7){return _0x28d4e9[_0xccfa('0x1c')](_0x73ab6d);}return _0x28d4e9[_0xccfa('0x1d')](_0x73ab6d)[_0xccfa('0x1e')]();};}function respondWithResult(_0xc43ebe,_0x411a73){_0x411a73=_0x411a73||0xc8;return function(_0x4d921){if(_0x4d921){return _0xc43ebe[_0xccfa('0x1d')](_0x411a73)[_0xccfa('0x1f')](_0x4d921);}};}function respondWithFilteredResult(_0x4e83d6,_0x89103f){return function(_0x258db6){if(_0x258db6){var _0x53416b=typeof _0x89103f['offset']===_0xccfa('0x20')&&typeof _0x89103f['limit']===_0xccfa('0x20');var _0x40c926=_0x258db6['count'];var _0x4adaab=_0x53416b?0x0:_0x89103f[_0xccfa('0x21')];var _0x26d90b=_0x53416b?_0x258db6[_0xccfa('0x22')]:_0x89103f[_0xccfa('0x21')]+_0x89103f[_0xccfa('0x23')];var _0x3f35a1;if(_0x26d90b>=_0x40c926){_0x26d90b=_0x40c926;_0x3f35a1=0xc8;}else{_0x3f35a1=0xce;}_0x4e83d6['status'](_0x3f35a1);return _0x4e83d6['set']('Content-Range',_0x4adaab+'-'+_0x26d90b+'/'+_0x40c926)[_0xccfa('0x1f')](_0x258db6);}return null;};}function patchUpdates(_0x4bdb04){return function(_0x5e0c63){try{jsonpatch['apply'](_0x5e0c63,_0x4bdb04,!![]);}catch(_0x29eb36){return BPromise['reject'](_0x29eb36);}return _0x5e0c63['save']();};}function saveUpdates(_0x471e59,_0x39b373){return function(_0x3ba121){if(_0x3ba121){return _0x3ba121[_0xccfa('0x24')](_0x471e59)['then'](function(_0xbedc9){return _0xbedc9;});}return null;};}function removeEntity(_0x485e6f,_0x58cc2c){return function(_0x4b8714){if(_0x4b8714){return _0x4b8714[_0xccfa('0x25')]()[_0xccfa('0x26')](function(){_0x485e6f[_0xccfa('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x30aeb0,_0x3fdf53){return function(_0x29a1fb){if(!_0x29a1fb){_0x30aeb0[_0xccfa('0x1c')](0x194);}return _0x29a1fb;};}function handleError(_0xc3925,_0x195450){_0x195450=_0x195450||0x1f4;return function(_0x218f6e){logger[_0xccfa('0x27')](_0x218f6e['stack']);if(_0x218f6e[_0xccfa('0x28')]){delete _0x218f6e[_0xccfa('0x28')];}_0xc3925[_0xccfa('0x1d')](_0x195450)[_0xccfa('0x29')](_0x218f6e);};}exports[_0xccfa('0x2a')]=function(_0xe94e90,_0x32c849){var _0x3e8a05={},_0x3a255d={},_0x51aa9b={'count':0x0,'rows':[]};var _0x19fd9d=_[_0xccfa('0x2b')](db[_0xccfa('0x2c')][_0xccfa('0x2d')],function(_0xfae349){return{'name':_0xfae349[_0xccfa('0x2e')],'type':_0xfae349[_0xccfa('0x2f')][_0xccfa('0x30')]};});_0x3a255d[_0xccfa('0x31')]=_[_0xccfa('0x2b')](_0x19fd9d,_0xccfa('0x28'));_0x3a255d[_0xccfa('0x32')]=_[_0xccfa('0x33')](_0xe94e90[_0xccfa('0x32')]);_0x3a255d[_0xccfa('0x34')]=_[_0xccfa('0x35')](_0x3a255d[_0xccfa('0x31')],_0x3a255d[_0xccfa('0x32')]);_0x3e8a05['attributes']=_['intersection'](_0x3a255d['model'],qs[_0xccfa('0x36')](_0xe94e90[_0xccfa('0x32')][_0xccfa('0x36')]));_0x3e8a05[_0xccfa('0x37')]=_0x3e8a05['attributes']['length']?_0x3e8a05[_0xccfa('0x37')]:_0x3a255d[_0xccfa('0x31')];if(!_0xe94e90['query']['hasOwnProperty']('nolimit')){_0x3e8a05[_0xccfa('0x23')]=qs['limit'](_0xe94e90['query'][_0xccfa('0x23')]);_0x3e8a05[_0xccfa('0x21')]=qs[_0xccfa('0x21')](_0xe94e90[_0xccfa('0x32')][_0xccfa('0x21')]);}_0x3e8a05[_0xccfa('0x38')]=qs[_0xccfa('0x39')](_0xe94e90[_0xccfa('0x32')][_0xccfa('0x39')]);_0x3e8a05[_0xccfa('0x3a')]=qs[_0xccfa('0x34')](_['pick'](_0xe94e90[_0xccfa('0x32')],_0x3a255d['filters']),_0x19fd9d);if(_0xe94e90['query']['filter']){_0x3e8a05[_0xccfa('0x3a')]=_[_0xccfa('0x3b')](_0x3e8a05[_0xccfa('0x3a')],{'$or':_['map'](_0x19fd9d,function(_0x49e083){if(_0x49e083['type']!==_0xccfa('0x3c')){var _0x2f7923={};_0x2f7923[_0x49e083[_0xccfa('0x28')]]={'$like':'%'+_0xe94e90[_0xccfa('0x32')][_0xccfa('0x3d')]+'%'};return _0x2f7923;}})});}_0x3e8a05=_[_0xccfa('0x3b')]({},_0x3e8a05,_0xe94e90[_0xccfa('0x3e')]);var _0x31bd6b={'where':_0x3e8a05[_0xccfa('0x3a')]};return db[_0xccfa('0x2c')][_0xccfa('0x22')](_0x31bd6b)['then'](function(_0x5db3d0){_0x51aa9b['count']=_0x5db3d0;if(_0xe94e90[_0xccfa('0x32')][_0xccfa('0x3f')]){_0x3e8a05[_0xccfa('0x40')]=[{'all':!![]}];}return db[_0xccfa('0x2c')][_0xccfa('0x41')](_0x3e8a05);})['then'](function(_0x20df08){_0x51aa9b[_0xccfa('0x42')]=_0x20df08;return _0x51aa9b;})[_0xccfa('0x26')](respondWithFilteredResult(_0x32c849,_0x3e8a05))[_0xccfa('0x43')](handleError(_0x32c849,null));};exports['show']=function(_0x540a3f,_0x9380ab){var _0x2d19fb={'raw':![],'where':{'id':_0x540a3f[_0xccfa('0x44')]['id']}},_0x666ec1={};_0x666ec1[_0xccfa('0x31')]=_['keys'](db[_0xccfa('0x2c')][_0xccfa('0x2d')]);_0x666ec1[_0xccfa('0x32')]=_['keys'](_0x540a3f[_0xccfa('0x32')]);_0x666ec1['filters']=_['intersection'](_0x666ec1[_0xccfa('0x31')],_0x666ec1[_0xccfa('0x32')]);_0x2d19fb[_0xccfa('0x37')]=_[_0xccfa('0x35')](_0x666ec1[_0xccfa('0x31')],qs[_0xccfa('0x36')](_0x540a3f['query'][_0xccfa('0x36')]));_0x2d19fb['attributes']=_0x2d19fb['attributes'][_0xccfa('0x45')]?_0x2d19fb[_0xccfa('0x37')]:_0x666ec1[_0xccfa('0x31')];if(_0x540a3f[_0xccfa('0x32')][_0xccfa('0x3f')]){_0x2d19fb[_0xccfa('0x40')]=[{'all':!![]}];}_0x2d19fb=_[_0xccfa('0x3b')]({},_0x2d19fb,_0x540a3f[_0xccfa('0x3e')]);return db[_0xccfa('0x2c')][_0xccfa('0x46')](_0x2d19fb)[_0xccfa('0x26')](handleEntityNotFound(_0x9380ab,null))[_0xccfa('0x26')](respondWithResult(_0x9380ab,null))[_0xccfa('0x43')](handleError(_0x9380ab,null));};exports[_0xccfa('0x47')]=function(_0x54e363,_0x3e4770){return db[_0xccfa('0x2c')][_0xccfa('0x47')](_0x54e363['body'],{})['then'](respondWithResult(_0x3e4770,0xc9))[_0xccfa('0x43')](handleError(_0x3e4770,null));};exports[_0xccfa('0x24')]=function(_0x3d9d85,_0x4a0aa5){if(_0x3d9d85['body']['id']){delete _0x3d9d85[_0xccfa('0x48')]['id'];}return db['FreshdeskAccount'][_0xccfa('0x46')]({'where':{'id':_0x3d9d85['params']['id']}})[_0xccfa('0x26')](handleEntityNotFound(_0x4a0aa5,null))[_0xccfa('0x26')](saveUpdates(_0x3d9d85[_0xccfa('0x48')],null))[_0xccfa('0x26')](respondWithResult(_0x4a0aa5,null))[_0xccfa('0x43')](handleError(_0x4a0aa5,null));};exports[_0xccfa('0x25')]=function(_0x43ce21,_0x24bc69){return db[_0xccfa('0x2c')][_0xccfa('0x46')]({'where':{'id':_0x43ce21['params']['id']}})[_0xccfa('0x26')](handleEntityNotFound(_0x24bc69,null))[_0xccfa('0x26')](removeEntity(_0x24bc69,null))['catch'](handleError(_0x24bc69,null));};exports[_0xccfa('0x49')]=function(_0x59b012,_0x208b04,_0x43e5da){var _0x154bce={};var _0x24aca9={};var _0x2c7c23;var _0x15e661;return db['FreshdeskAccount'][_0xccfa('0x4a')]({'where':{'id':_0x59b012[_0xccfa('0x44')]['id']}})['then'](handleEntityNotFound(_0x208b04,null))[_0xccfa('0x26')](function(_0x1099c7){if(_0x1099c7){_0x2c7c23=_0x1099c7;_0x24aca9[_0xccfa('0x31')]=_[_0xccfa('0x33')](db[_0xccfa('0x4b')]['rawAttributes']);_0x24aca9['query']=_[_0xccfa('0x33')](_0x59b012[_0xccfa('0x32')]);_0x24aca9[_0xccfa('0x34')]=_['intersection'](_0x24aca9[_0xccfa('0x31')],_0x24aca9[_0xccfa('0x32')]);_0x154bce['attributes']=_[_0xccfa('0x35')](_0x24aca9['model'],qs['fields'](_0x59b012[_0xccfa('0x32')]['fields']));_0x154bce[_0xccfa('0x37')]=_0x154bce[_0xccfa('0x37')][_0xccfa('0x45')]?_0x154bce[_0xccfa('0x37')]:_0x24aca9[_0xccfa('0x31')];_0x154bce[_0xccfa('0x38')]=qs['sort'](_0x59b012[_0xccfa('0x32')][_0xccfa('0x39')]);_0x154bce[_0xccfa('0x3a')]=qs['filters'](_[_0xccfa('0x4c')](_0x59b012[_0xccfa('0x32')],_0x24aca9[_0xccfa('0x34')]));if(_0x59b012[_0xccfa('0x32')][_0xccfa('0x3d')]){_0x154bce[_0xccfa('0x3a')]=_[_0xccfa('0x3b')](_0x154bce[_0xccfa('0x3a')],{'$or':_[_0xccfa('0x2b')](_0x154bce[_0xccfa('0x37')],function(_0x1db436){var _0x465bb8={};_0x465bb8[_0x1db436]={'$like':'%'+_0x59b012[_0xccfa('0x32')][_0xccfa('0x3d')]+'%'};return _0x465bb8;})});}_0x154bce=_[_0xccfa('0x3b')]({},_0x154bce,_0x59b012[_0xccfa('0x3e')]);return _0x2c7c23[_0xccfa('0x49')](_0x154bce);}})[_0xccfa('0x26')](function(_0x35ad8e){if(_0x35ad8e){_0x15e661=_0x35ad8e[_0xccfa('0x45')];if(!_0x59b012[_0xccfa('0x32')][_0xccfa('0x4d')](_0xccfa('0x4e'))){_0x154bce[_0xccfa('0x23')]=qs[_0xccfa('0x23')](_0x59b012[_0xccfa('0x32')]['limit']);_0x154bce[_0xccfa('0x21')]=qs[_0xccfa('0x21')](_0x59b012[_0xccfa('0x32')][_0xccfa('0x21')]);}return _0x2c7c23[_0xccfa('0x49')](_0x154bce);}})[_0xccfa('0x26')](function(_0x6193d7){if(_0x6193d7){return _0x6193d7?{'count':_0x15e661,'rows':_0x6193d7}:null;}})[_0xccfa('0x26')](respondWithResult(_0x208b04,null))[_0xccfa('0x43')](handleError(_0x208b04,null));};exports[_0xccfa('0x4f')]=function(_0x2a2fc7,_0x5b2eaa,_0x286de1){if(_0x2a2fc7[_0xccfa('0x48')]['id']){delete _0x2a2fc7[_0xccfa('0x48')]['id'];}return db[_0xccfa('0x2c')][_0xccfa('0x4a')]({'where':{'id':_0x2a2fc7[_0xccfa('0x44')]['id']}})[_0xccfa('0x26')](handleEntityNotFound(_0x5b2eaa,null))[_0xccfa('0x26')](function(_0x26ce49){if(_0x26ce49){_0x2a2fc7['body'][_0xccfa('0x50')]=_0x26ce49['id'];_0x2a2fc7[_0xccfa('0x48')][_0xccfa('0x51')]=integrations['getSubjects'](_0x2a2fc7['body'][_0xccfa('0x52')],_0x2a2fc7[_0xccfa('0x48')]['type']);_0x2a2fc7[_0xccfa('0x48')][_0xccfa('0x53')]=integrations['getDescriptions'](_0x2a2fc7[_0xccfa('0x48')][_0xccfa('0x52')],_0x2a2fc7[_0xccfa('0x48')][_0xccfa('0x2f')]);return db['FreshdeskConfiguration'][_0xccfa('0x47')](_0x2a2fc7[_0xccfa('0x48')],{'include':[{'model':db[_0xccfa('0x54')],'as':'Subjects'},{'model':db[_0xccfa('0x54')],'as':_0xccfa('0x53')}]});}return null;})['then'](respondWithResult(_0x5b2eaa,null))[_0xccfa('0x43')](handleError(_0x5b2eaa,null));};exports[_0xccfa('0x55')]=function(_0x12b204,_0x56bd4c,_0x3b7772){var _0x5445ba='';return db[_0xccfa('0x2c')][_0xccfa('0x4a')]({'where':{'id':_0x12b204[_0xccfa('0x44')]['id']},'attributes':['id',_0xccfa('0x56'),_0xccfa('0x57')]})[_0xccfa('0x26')](handleEntityNotFound(_0x56bd4c,null))[_0xccfa('0x26')](function(_0x36ac8e){if(_0x36ac8e){_0x5445ba=_0x36ac8e[_0xccfa('0x56')];var _0x658b82=_0x5445ba['slice'](-0x1);if(_0x658b82==='/'){_0x5445ba=_0x5445ba[_0xccfa('0x58')](0x0,_0x5445ba[_0xccfa('0x59')](_0x658b82));}return rp({'method':_0xccfa('0x5a'),'uri':util['format'](_0xccfa('0x5b'),_0x5445ba,_0xccfa('0x5c')),'headers':{'Authorization':util[_0xccfa('0x5d')](_0xccfa('0x5e'),new Buffer(util[_0xccfa('0x5d')](_0xccfa('0x5f'),_0x36ac8e[_0xccfa('0x57')]))[_0xccfa('0x60')]('base64'))},'json':!![]});}})['then'](function(_0x440542){if(_0x440542){var _0x73ae1e=[_0xccfa('0x61'),_0xccfa('0x62'),'agent',_0xccfa('0x63'),'status','priority',_0xccfa('0x64'),_0xccfa('0x65'),_0xccfa('0x66'),_0xccfa('0x64'),'company'];_[_0xccfa('0x67')](_0x440542,function(_0x216737){return _0x73ae1e['includes'](_0x216737['name'])||!_0x216737['default']&&_0x216737[_0xccfa('0x2f')]!=='custom_text'&&_0x216737['type']!==_0xccfa('0x68');});return{'count':_0x440542[_0xccfa('0x45')],'rows':_[_0xccfa('0x2b')](_0x440542,function(_0x1fd76d){return{'id':_0x1fd76d['name'],'name':_0x1fd76d[_0xccfa('0x69')],'custom':!_0x1fd76d['default'],'options':_0x1fd76d[_0xccfa('0x6a')]?_[_0xccfa('0x2b')](_0x1fd76d[_0xccfa('0x6a')],function(_0xf2264c){return{'name':_[_0xccfa('0x6b')](_0xf2264c),'value':_0xf2264c};}):[]};})};}})[_0xccfa('0x26')](respondWithResult(_0x56bd4c,null))[_0xccfa('0x43')](function(_0x5284a8){var _0x368c8e=_0x12b204[_0xccfa('0x32')][_0xccfa('0x6c')]?0x1f4:_0x5284a8[_0xccfa('0x6d')]||0x1f4;logger[_0xccfa('0x27')]('getFields,\x20%s,\x20%s,\x20%s',_0xccfa('0x55'),_0x368c8e,JSON[_0xccfa('0x6e')](_0x5284a8));delete _0x5284a8[_0xccfa('0x28')];if(_0x368c8e===0x191){_0x368c8e=0x190;}_0x56bd4c[_0xccfa('0x1d')](_0x368c8e)['send'](_0x12b204['query']['test']?{'message':_0xccfa('0x6f'),'statusCode':_0x5284a8[_0xccfa('0x6d')]}:_0x5284a8);});}; \ No newline at end of file +var _0xb677=['map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','findAll','catch','show','params','include','find','create','body','getConfigurations','findOne','addConfiguration','Subjects','channel','Descriptions','FreshdeskConfiguration','FreshdeskField','getFields','remoteUri','apiKey','slice','lastIndexOf','GET','format','api/v2/ticket_fields','%s:X','requester','subject','agent','priority','group','source','company','remove','includes','default','custom_text','custom_dropdown','label','choices','capitalize','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','destroy','end','error','name','FreshdeskAccount','fieldName','type','key','model'];(function(_0x1752e8,_0x2b4a5a){var _0x13e904=function(_0x35396b){while(--_0x35396b){_0x1752e8['push'](_0x1752e8['shift']());}};_0x13e904(++_0x2b4a5a);}(_0xb677,0x119));var _0x7b67=function(_0x680b97,_0x389363){_0x680b97=_0x680b97-0x0;var _0x4c1cfd=_0xb677[_0x680b97];return _0x4c1cfd;};'use strict';var emlformat=require(_0x7b67('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7b67('0x1'));var jsonpatch=require(_0x7b67('0x2'));var rp=require(_0x7b67('0x3'));var moment=require(_0x7b67('0x4'));var BPromise=require(_0x7b67('0x5'));var Mustache=require(_0x7b67('0x6'));var util=require(_0x7b67('0x7'));var path=require(_0x7b67('0x8'));var sox=require('sox');var csv=require(_0x7b67('0x9'));var ejs=require(_0x7b67('0xa'));var fs=require('fs');var fs_extra=require(_0x7b67('0xb'));var _=require(_0x7b67('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x7b67('0xd'));var toCsv=require('to-csv');var querystring=require(_0x7b67('0xe'));var Papa=require('papaparse');var Redis=require(_0x7b67('0xf'));var authService=require(_0x7b67('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x7b67('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7b67('0x12'))(_0x7b67('0x13'));var utils=require(_0x7b67('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require(_0x7b67('0x15'));function respondWithStatusCode(_0x454df4,_0x1e17fc){_0x1e17fc=_0x1e17fc||0xcc;return function(_0x963f60){if(_0x963f60){return _0x454df4[_0x7b67('0x16')](_0x1e17fc);}return _0x454df4[_0x7b67('0x17')](_0x1e17fc)['end']();};}function respondWithResult(_0x37eb7a,_0x473d10){_0x473d10=_0x473d10||0xc8;return function(_0x233388){if(_0x233388){return _0x37eb7a[_0x7b67('0x17')](_0x473d10)[_0x7b67('0x18')](_0x233388);}};}function respondWithFilteredResult(_0x309f1c,_0x1861d1){return function(_0xf99987){if(_0xf99987){var _0x52c21b=typeof _0x1861d1[_0x7b67('0x19')]===_0x7b67('0x1a')&&typeof _0x1861d1[_0x7b67('0x1b')]===_0x7b67('0x1a');var _0x241f1d=_0xf99987[_0x7b67('0x1c')];var _0x59fd3d=_0x52c21b?0x0:_0x1861d1[_0x7b67('0x19')];var _0x348f28=_0x52c21b?_0xf99987[_0x7b67('0x1c')]:_0x1861d1[_0x7b67('0x19')]+_0x1861d1[_0x7b67('0x1b')];var _0x4095e7;if(_0x348f28>=_0x241f1d){_0x348f28=_0x241f1d;_0x4095e7=0xc8;}else{_0x4095e7=0xce;}_0x309f1c[_0x7b67('0x17')](_0x4095e7);return _0x309f1c[_0x7b67('0x1d')](_0x7b67('0x1e'),_0x59fd3d+'-'+_0x348f28+'/'+_0x241f1d)[_0x7b67('0x18')](_0xf99987);}return null;};}function patchUpdates(_0x5ddb36){return function(_0x125924){try{jsonpatch[_0x7b67('0x1f')](_0x125924,_0x5ddb36,!![]);}catch(_0x55cab1){return BPromise['reject'](_0x55cab1);}return _0x125924['save']();};}function saveUpdates(_0x48944a,_0x44b951){return function(_0xeabc5c){if(_0xeabc5c){return _0xeabc5c[_0x7b67('0x20')](_0x48944a)[_0x7b67('0x21')](function(_0x2c3f11){return _0x2c3f11;});}return null;};}function removeEntity(_0x56b952,_0x3b4fea){return function(_0x12d848){if(_0x12d848){return _0x12d848[_0x7b67('0x22')]()[_0x7b67('0x21')](function(){_0x56b952[_0x7b67('0x17')](0xcc)[_0x7b67('0x23')]();});}};}function handleEntityNotFound(_0x2b6da7,_0x50e71c){return function(_0x463c41){if(!_0x463c41){_0x2b6da7['sendStatus'](0x194);}return _0x463c41;};}function handleError(_0x45da6b,_0x2f1e62){_0x2f1e62=_0x2f1e62||0x1f4;return function(_0x250fb0){logger[_0x7b67('0x24')](_0x250fb0['stack']);if(_0x250fb0[_0x7b67('0x25')]){delete _0x250fb0[_0x7b67('0x25')];}_0x45da6b[_0x7b67('0x17')](_0x2f1e62)['send'](_0x250fb0);};}exports['index']=function(_0x5ac43f,_0x8649ec){var _0x4bd8b7={},_0x5ee006={},_0x2cd200={'count':0x0,'rows':[]};var _0x3de320=_['map'](db[_0x7b67('0x26')]['rawAttributes'],function(_0x4815ab){return{'name':_0x4815ab[_0x7b67('0x27')],'type':_0x4815ab[_0x7b67('0x28')][_0x7b67('0x29')]};});_0x5ee006[_0x7b67('0x2a')]=_[_0x7b67('0x2b')](_0x3de320,_0x7b67('0x25'));_0x5ee006[_0x7b67('0x2c')]=_[_0x7b67('0x2d')](_0x5ac43f[_0x7b67('0x2c')]);_0x5ee006[_0x7b67('0x2e')]=_[_0x7b67('0x2f')](_0x5ee006[_0x7b67('0x2a')],_0x5ee006[_0x7b67('0x2c')]);_0x4bd8b7[_0x7b67('0x30')]=_[_0x7b67('0x2f')](_0x5ee006[_0x7b67('0x2a')],qs[_0x7b67('0x31')](_0x5ac43f['query'][_0x7b67('0x31')]));_0x4bd8b7[_0x7b67('0x30')]=_0x4bd8b7['attributes'][_0x7b67('0x32')]?_0x4bd8b7[_0x7b67('0x30')]:_0x5ee006[_0x7b67('0x2a')];if(!_0x5ac43f[_0x7b67('0x2c')][_0x7b67('0x33')](_0x7b67('0x34'))){_0x4bd8b7[_0x7b67('0x1b')]=qs[_0x7b67('0x1b')](_0x5ac43f[_0x7b67('0x2c')][_0x7b67('0x1b')]);_0x4bd8b7[_0x7b67('0x19')]=qs[_0x7b67('0x19')](_0x5ac43f[_0x7b67('0x2c')]['offset']);}_0x4bd8b7[_0x7b67('0x35')]=qs[_0x7b67('0x36')](_0x5ac43f[_0x7b67('0x2c')][_0x7b67('0x36')]);_0x4bd8b7['where']=qs[_0x7b67('0x2e')](_[_0x7b67('0x37')](_0x5ac43f[_0x7b67('0x2c')],_0x5ee006[_0x7b67('0x2e')]),_0x3de320);if(_0x5ac43f[_0x7b67('0x2c')]['filter']){_0x4bd8b7[_0x7b67('0x38')]=_[_0x7b67('0x39')](_0x4bd8b7[_0x7b67('0x38')],{'$or':_[_0x7b67('0x2b')](_0x3de320,function(_0x2f82ac){if(_0x2f82ac[_0x7b67('0x28')]!==_0x7b67('0x3a')){var _0x254eec={};_0x254eec[_0x2f82ac[_0x7b67('0x25')]]={'$like':'%'+_0x5ac43f[_0x7b67('0x2c')][_0x7b67('0x3b')]+'%'};return _0x254eec;}})});}_0x4bd8b7=_[_0x7b67('0x39')]({},_0x4bd8b7,_0x5ac43f[_0x7b67('0x3c')]);var _0x2ef44e={'where':_0x4bd8b7[_0x7b67('0x38')]};return db['FreshdeskAccount'][_0x7b67('0x1c')](_0x2ef44e)[_0x7b67('0x21')](function(_0x1d19c8){_0x2cd200[_0x7b67('0x1c')]=_0x1d19c8;if(_0x5ac43f[_0x7b67('0x2c')][_0x7b67('0x3d')]){_0x4bd8b7['include']=[{'all':!![]}];}return db['FreshdeskAccount'][_0x7b67('0x3e')](_0x4bd8b7);})[_0x7b67('0x21')](function(_0x571ac9){_0x2cd200['rows']=_0x571ac9;return _0x2cd200;})[_0x7b67('0x21')](respondWithFilteredResult(_0x8649ec,_0x4bd8b7))[_0x7b67('0x3f')](handleError(_0x8649ec,null));};exports[_0x7b67('0x40')]=function(_0x30da75,_0x3e6f37){var _0x46629b={'raw':![],'where':{'id':_0x30da75[_0x7b67('0x41')]['id']}},_0x4f39df={};_0x4f39df[_0x7b67('0x2a')]=_[_0x7b67('0x2d')](db[_0x7b67('0x26')]['rawAttributes']);_0x4f39df[_0x7b67('0x2c')]=_[_0x7b67('0x2d')](_0x30da75[_0x7b67('0x2c')]);_0x4f39df['filters']=_['intersection'](_0x4f39df[_0x7b67('0x2a')],_0x4f39df['query']);_0x46629b[_0x7b67('0x30')]=_['intersection'](_0x4f39df['model'],qs[_0x7b67('0x31')](_0x30da75['query'][_0x7b67('0x31')]));_0x46629b['attributes']=_0x46629b[_0x7b67('0x30')][_0x7b67('0x32')]?_0x46629b['attributes']:_0x4f39df[_0x7b67('0x2a')];if(_0x30da75[_0x7b67('0x2c')][_0x7b67('0x3d')]){_0x46629b[_0x7b67('0x42')]=[{'all':!![]}];}_0x46629b=_[_0x7b67('0x39')]({},_0x46629b,_0x30da75[_0x7b67('0x3c')]);return db[_0x7b67('0x26')][_0x7b67('0x43')](_0x46629b)[_0x7b67('0x21')](handleEntityNotFound(_0x3e6f37,null))[_0x7b67('0x21')](respondWithResult(_0x3e6f37,null))[_0x7b67('0x3f')](handleError(_0x3e6f37,null));};exports[_0x7b67('0x44')]=function(_0x3dd431,_0x3e7b0f){return db['FreshdeskAccount'][_0x7b67('0x44')](_0x3dd431[_0x7b67('0x45')],{})['then'](respondWithResult(_0x3e7b0f,0xc9))[_0x7b67('0x3f')](handleError(_0x3e7b0f,null));};exports['update']=function(_0x1c80e9,_0x3ae6d5){if(_0x1c80e9[_0x7b67('0x45')]['id']){delete _0x1c80e9[_0x7b67('0x45')]['id'];}return db['FreshdeskAccount'][_0x7b67('0x43')]({'where':{'id':_0x1c80e9[_0x7b67('0x41')]['id']}})[_0x7b67('0x21')](handleEntityNotFound(_0x3ae6d5,null))['then'](saveUpdates(_0x1c80e9['body'],null))[_0x7b67('0x21')](respondWithResult(_0x3ae6d5,null))[_0x7b67('0x3f')](handleError(_0x3ae6d5,null));};exports['destroy']=function(_0x501088,_0x3d35c3){return db[_0x7b67('0x26')][_0x7b67('0x43')]({'where':{'id':_0x501088[_0x7b67('0x41')]['id']}})[_0x7b67('0x21')](handleEntityNotFound(_0x3d35c3,null))['then'](removeEntity(_0x3d35c3,null))[_0x7b67('0x3f')](handleError(_0x3d35c3,null));};exports[_0x7b67('0x46')]=function(_0x3689e4,_0x439551,_0x5a6b5d){var _0x1a2b81={};var _0x5465db={};var _0x3510b6;var _0x1ea2b5;return db[_0x7b67('0x26')][_0x7b67('0x47')]({'where':{'id':_0x3689e4[_0x7b67('0x41')]['id']}})[_0x7b67('0x21')](handleEntityNotFound(_0x439551,null))[_0x7b67('0x21')](function(_0x2023da){if(_0x2023da){_0x3510b6=_0x2023da;_0x5465db['model']=_['keys'](db['FreshdeskConfiguration']['rawAttributes']);_0x5465db[_0x7b67('0x2c')]=_[_0x7b67('0x2d')](_0x3689e4[_0x7b67('0x2c')]);_0x5465db[_0x7b67('0x2e')]=_[_0x7b67('0x2f')](_0x5465db['model'],_0x5465db[_0x7b67('0x2c')]);_0x1a2b81['attributes']=_[_0x7b67('0x2f')](_0x5465db[_0x7b67('0x2a')],qs[_0x7b67('0x31')](_0x3689e4[_0x7b67('0x2c')][_0x7b67('0x31')]));_0x1a2b81['attributes']=_0x1a2b81[_0x7b67('0x30')][_0x7b67('0x32')]?_0x1a2b81[_0x7b67('0x30')]:_0x5465db[_0x7b67('0x2a')];_0x1a2b81['order']=qs[_0x7b67('0x36')](_0x3689e4[_0x7b67('0x2c')]['sort']);_0x1a2b81[_0x7b67('0x38')]=qs[_0x7b67('0x2e')](_[_0x7b67('0x37')](_0x3689e4['query'],_0x5465db[_0x7b67('0x2e')]));if(_0x3689e4[_0x7b67('0x2c')]['filter']){_0x1a2b81['where']=_[_0x7b67('0x39')](_0x1a2b81[_0x7b67('0x38')],{'$or':_[_0x7b67('0x2b')](_0x1a2b81['attributes'],function(_0x1048e9){var _0x1767f9={};_0x1767f9[_0x1048e9]={'$like':'%'+_0x3689e4[_0x7b67('0x2c')]['filter']+'%'};return _0x1767f9;})});}_0x1a2b81=_[_0x7b67('0x39')]({},_0x1a2b81,_0x3689e4[_0x7b67('0x3c')]);return _0x3510b6['getConfigurations'](_0x1a2b81);}})['then'](function(_0x4f9267){if(_0x4f9267){_0x1ea2b5=_0x4f9267[_0x7b67('0x32')];if(!_0x3689e4[_0x7b67('0x2c')][_0x7b67('0x33')]('nolimit')){_0x1a2b81['limit']=qs[_0x7b67('0x1b')](_0x3689e4['query'][_0x7b67('0x1b')]);_0x1a2b81[_0x7b67('0x19')]=qs[_0x7b67('0x19')](_0x3689e4['query'][_0x7b67('0x19')]);}return _0x3510b6[_0x7b67('0x46')](_0x1a2b81);}})[_0x7b67('0x21')](function(_0x44d54b){if(_0x44d54b){return _0x44d54b?{'count':_0x1ea2b5,'rows':_0x44d54b}:null;}})[_0x7b67('0x21')](respondWithResult(_0x439551,null))[_0x7b67('0x3f')](handleError(_0x439551,null));};exports[_0x7b67('0x48')]=function(_0x7c9f96,_0x1e4b7a,_0x16dd22){if(_0x7c9f96['body']['id']){delete _0x7c9f96[_0x7b67('0x45')]['id'];}return db[_0x7b67('0x26')]['findOne']({'where':{'id':_0x7c9f96['params']['id']}})[_0x7b67('0x21')](handleEntityNotFound(_0x1e4b7a,null))['then'](function(_0x5115bc){if(_0x5115bc){_0x7c9f96[_0x7b67('0x45')]['AccountId']=_0x5115bc['id'];_0x7c9f96['body'][_0x7b67('0x49')]=integrations['getSubjects'](_0x7c9f96[_0x7b67('0x45')][_0x7b67('0x4a')],_0x7c9f96[_0x7b67('0x45')][_0x7b67('0x28')]);_0x7c9f96[_0x7b67('0x45')][_0x7b67('0x4b')]=integrations['getDescriptions'](_0x7c9f96['body']['channel'],_0x7c9f96[_0x7b67('0x45')][_0x7b67('0x28')]);return db[_0x7b67('0x4c')][_0x7b67('0x44')](_0x7c9f96['body'],{'include':[{'model':db[_0x7b67('0x4d')],'as':_0x7b67('0x49')},{'model':db[_0x7b67('0x4d')],'as':_0x7b67('0x4b')}]});}return null;})[_0x7b67('0x21')](respondWithResult(_0x1e4b7a,null))[_0x7b67('0x3f')](handleError(_0x1e4b7a,null));};exports[_0x7b67('0x4e')]=function(_0x2c83e7,_0x498b04,_0x3b7d30){var _0xd8ced3='';return db['FreshdeskAccount'][_0x7b67('0x47')]({'where':{'id':_0x2c83e7[_0x7b67('0x41')]['id']},'attributes':['id',_0x7b67('0x4f'),_0x7b67('0x50')]})[_0x7b67('0x21')](handleEntityNotFound(_0x498b04,null))['then'](function(_0x1cdecd){if(_0x1cdecd){_0xd8ced3=_0x1cdecd['remoteUri'];var _0x2cbab9=_0xd8ced3[_0x7b67('0x51')](-0x1);if(_0x2cbab9==='/'){_0xd8ced3=_0xd8ced3['substring'](0x0,_0xd8ced3[_0x7b67('0x52')](_0x2cbab9));}return rp({'method':_0x7b67('0x53'),'uri':util[_0x7b67('0x54')]('%s/%s',_0xd8ced3,_0x7b67('0x55')),'headers':{'Authorization':util[_0x7b67('0x54')]('Basic\x20%s',new Buffer(util[_0x7b67('0x54')](_0x7b67('0x56'),_0x1cdecd['apiKey']))['toString']('base64'))},'json':!![]});}})[_0x7b67('0x21')](function(_0x3293a1){if(_0x3293a1){var _0xa13bd9=[_0x7b67('0x57'),_0x7b67('0x58'),_0x7b67('0x59'),'description','status',_0x7b67('0x5a'),_0x7b67('0x5b'),_0x7b67('0x5c'),'ticket_type','group',_0x7b67('0x5d')];_[_0x7b67('0x5e')](_0x3293a1,function(_0x510b1f){return _0xa13bd9[_0x7b67('0x5f')](_0x510b1f[_0x7b67('0x25')])||!_0x510b1f[_0x7b67('0x60')]&&_0x510b1f['type']!==_0x7b67('0x61')&&_0x510b1f[_0x7b67('0x28')]!==_0x7b67('0x62');});return{'count':_0x3293a1[_0x7b67('0x32')],'rows':_[_0x7b67('0x2b')](_0x3293a1,function(_0xc6314f){return{'id':_0xc6314f[_0x7b67('0x25')],'name':_0xc6314f[_0x7b67('0x63')],'custom':!_0xc6314f[_0x7b67('0x60')],'options':_0xc6314f[_0x7b67('0x64')]?_['map'](_0xc6314f['choices'],function(_0x225000){return{'name':_[_0x7b67('0x65')](_0x225000),'value':_0x225000};}):[]};})};}})[_0x7b67('0x21')](respondWithResult(_0x498b04,null))['catch'](function(_0x2a9bcd){var _0x33f21b=_0x2c83e7['query'][_0x7b67('0x66')]?0x1f4:_0x2a9bcd[_0x7b67('0x67')]||0x1f4;logger[_0x7b67('0x24')](_0x7b67('0x68'),_0x7b67('0x4e'),_0x33f21b,JSON[_0x7b67('0x69')](_0x2a9bcd));delete _0x2a9bcd[_0x7b67('0x25')];if(_0x33f21b===0x191){_0x33f21b=0x190;}_0x498b04['status'](_0x33f21b)[_0x7b67('0x6a')](_0x2c83e7['query']['test']?{'message':_0x7b67('0x6b'),'statusCode':_0x2a9bcd[_0x7b67('0x67')]}:_0x2a9bcd);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index 7733ebf..2f7e53f 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 _0x6644=['request-promise','rimraf','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports','define','FreshdeskAccount','int_freshdesk_accounts','lodash','util','api','moment','bluebird'];(function(_0x574bef,_0x2dc511){var _0x19e5e1=function(_0x49fd69){while(--_0x49fd69){_0x574bef['push'](_0x574bef['shift']());}};_0x19e5e1(++_0x2dc511);}(_0x6644,0x6b));var _0x4664=function(_0x9f2e07,_0x17abb4){_0x9f2e07=_0x9f2e07-0x0;var _0x3e5d33=_0x6644[_0x9f2e07];return _0x3e5d33;};'use strict';var _=require(_0x4664('0x0'));var util=require(_0x4664('0x1'));var logger=require('../../config/logger')(_0x4664('0x2'));var moment=require(_0x4664('0x3'));var BPromise=require(_0x4664('0x4'));var rp=require(_0x4664('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4664('0x6'));var config=require(_0x4664('0x7'));var attributes=require(_0x4664('0x8'));var integrations=require(_0x4664('0x9'));module[_0x4664('0xa')]=function(_0x26546f,_0x3c6867){return _0x26546f[_0x4664('0xb')](_0x4664('0xc'),attributes,{'tableName':_0x4664('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9b39=['bluebird','request-promise','path','../../config/environment','../../components/integrations/configuration','exports','define','FreshdeskAccount','lodash','util','../../config/logger','api','moment'];(function(_0x5d93e5,_0x45d1d7){var _0x388760=function(_0x37b0c8){while(--_0x37b0c8){_0x5d93e5['push'](_0x5d93e5['shift']());}};_0x388760(++_0x45d1d7);}(_0x9b39,0xb1));var _0x99b3=function(_0x33fac4,_0x334713){_0x33fac4=_0x33fac4-0x0;var _0x3f1a38=_0x9b39[_0x33fac4];return _0x3f1a38;};'use strict';var _=require(_0x99b3('0x0'));var util=require(_0x99b3('0x1'));var logger=require(_0x99b3('0x2'))(_0x99b3('0x3'));var moment=require(_0x99b3('0x4'));var BPromise=require(_0x99b3('0x5'));var rp=require(_0x99b3('0x6'));var fs=require('fs');var path=require(_0x99b3('0x7'));var rimraf=require('rimraf');var config=require(_0x99b3('0x8'));var attributes=require('./intFreshdeskAccount.attributes');var integrations=require(_0x99b3('0x9'));module[_0x99b3('0xa')]=function(_0x3a59fb,_0x561a09){return _0x3a59fb[_0x99b3('0xb')](_0x99b3('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 c5a207a..9913993 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 _0xf6c6=['stringify','error','code','FreshdeskAccount,\x20%s,\x20%s','message','result','GetFreshdeskAccount','findAll','options','raw','attributes','limit','include','model','map','then','catch','ShowFreshdeskAccount','FreshdeskAccount','find','where','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','info','debug','request\x20sent'];(function(_0x49020c,_0x55f5e8){var _0xc7dc3a=function(_0x51cb69){while(--_0x51cb69){_0x49020c['push'](_0x49020c['shift']());}};_0xc7dc3a(++_0x55f5e8);}(_0xf6c6,0xed));var _0x6f6c=function(_0x2e4e19,_0x493b50){_0x2e4e19=_0x2e4e19-0x0;var _0x9ba20b=_0xf6c6[_0x2e4e19];return _0x9ba20b;};'use strict';var _=require(_0x6f6c('0x0'));var util=require(_0x6f6c('0x1'));var moment=require(_0x6f6c('0x2'));var BPromise=require(_0x6f6c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6f6c('0x4'));var db=require(_0x6f6c('0x5'))['db'];var utils=require(_0x6f6c('0x6'));var logger=require(_0x6f6c('0x7'))('rpc');var config=require(_0x6f6c('0x8'));var jayson=require(_0x6f6c('0x9'));var client=jayson[_0x6f6c('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x158508,_0x10d84e,_0x4bb100){return new BPromise(function(_0x53f5c4,_0x4e57d1){return client[_0x6f6c('0xb')](_0x158508,_0x4bb100)['then'](function(_0x16c39d){logger[_0x6f6c('0xc')]('FreshdeskAccount,\x20%s,\x20%s',_0x10d84e,'request\x20sent');logger[_0x6f6c('0xd')]('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x10d84e,_0x6f6c('0xe'),JSON[_0x6f6c('0xf')](_0x16c39d));if(_0x16c39d[_0x6f6c('0x10')]){if(_0x16c39d[_0x6f6c('0x10')][_0x6f6c('0x11')]===0x1f4){logger[_0x6f6c('0x10')](_0x6f6c('0x12'),_0x10d84e,_0x16c39d[_0x6f6c('0x10')]['message']);return _0x4e57d1(_0x16c39d['error'][_0x6f6c('0x13')]);}logger['error']('FreshdeskAccount,\x20%s,\x20%s',_0x10d84e,_0x16c39d[_0x6f6c('0x10')][_0x6f6c('0x13')]);return _0x53f5c4(_0x16c39d[_0x6f6c('0x10')][_0x6f6c('0x13')]);}else{logger[_0x6f6c('0xc')](_0x6f6c('0x12'),_0x10d84e,_0x6f6c('0xe'));_0x53f5c4(_0x16c39d[_0x6f6c('0x14')][_0x6f6c('0x13')]);}})['catch'](function(_0xe76fe9){logger[_0x6f6c('0x10')](_0x6f6c('0x12'),_0x10d84e,_0xe76fe9);_0x4e57d1(_0xe76fe9);});});}exports[_0x6f6c('0x15')]=function(_0x106b98){var _0xb5b0f0=this;return new Promise(function(_0x12e900,_0x12e163){return db['FreshdeskAccount'][_0x6f6c('0x16')]({'raw':_0x106b98[_0x6f6c('0x17')]?_0x106b98[_0x6f6c('0x17')][_0x6f6c('0x18')]===undefined?!![]:![]:!![],'where':_0x106b98[_0x6f6c('0x17')]?_0x106b98[_0x6f6c('0x17')]['where']||null:null,'attributes':_0x106b98['options']?_0x106b98[_0x6f6c('0x17')][_0x6f6c('0x19')]||null:null,'limit':_0x106b98[_0x6f6c('0x17')]?_0x106b98['options'][_0x6f6c('0x1a')]||null:null,'include':_0x106b98[_0x6f6c('0x17')]?_0x106b98['options'][_0x6f6c('0x1b')]?_['map'](_0x106b98[_0x6f6c('0x17')]['include'],function(_0x25c98e){return{'model':db[_0x25c98e[_0x6f6c('0x1c')]],'as':_0x25c98e['as'],'attributes':_0x25c98e[_0x6f6c('0x19')],'include':_0x25c98e[_0x6f6c('0x1b')]?_[_0x6f6c('0x1d')](_0x25c98e[_0x6f6c('0x1b')],function(_0x2da358){return{'model':db[_0x2da358[_0x6f6c('0x1c')]],'as':_0x2da358['as'],'attributes':_0x2da358['attributes'],'include':_0x2da358[_0x6f6c('0x1b')]?_['map'](_0x2da358['include'],function(_0x2253e5){return{'model':db[_0x2253e5[_0x6f6c('0x1c')]],'as':_0x2253e5['as'],'attributes':_0x2253e5[_0x6f6c('0x19')]};}):[]};}):[]};}):[]:[]})[_0x6f6c('0x1e')](function(_0x51c05a){logger[_0x6f6c('0xc')](_0x6f6c('0x15'),_0x106b98);logger['debug'](_0x6f6c('0x15'),_0x106b98,JSON[_0x6f6c('0xf')](_0x51c05a));_0x12e900(_0x51c05a);})[_0x6f6c('0x1f')](function(_0x5c845e){logger[_0x6f6c('0x10')](_0x6f6c('0x15'),_0x5c845e['message'],_0x106b98);_0x12e163(_0xb5b0f0['error'](0x1f4,_0x5c845e['message']));});});};exports[_0x6f6c('0x20')]=function(_0x3214d7){var _0xb3e5cb=this;return new Promise(function(_0x1ea880,_0x776f36){return db[_0x6f6c('0x21')][_0x6f6c('0x22')]({'raw':_0x3214d7[_0x6f6c('0x17')]?_0x3214d7[_0x6f6c('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x3214d7['options']?_0x3214d7[_0x6f6c('0x17')][_0x6f6c('0x23')]||null:null,'attributes':_0x3214d7[_0x6f6c('0x17')]?_0x3214d7[_0x6f6c('0x17')]['attributes']||null:null,'include':_0x3214d7['options']?_0x3214d7[_0x6f6c('0x17')][_0x6f6c('0x1b')]?_[_0x6f6c('0x1d')](_0x3214d7['options']['include'],function(_0x4cbcec){return{'model':db[_0x4cbcec[_0x6f6c('0x1c')]],'as':_0x4cbcec['as'],'attributes':_0x4cbcec['attributes'],'include':_0x4cbcec[_0x6f6c('0x1b')]?_[_0x6f6c('0x1d')](_0x4cbcec['include'],function(_0x240a08){return{'model':db[_0x240a08[_0x6f6c('0x1c')]],'as':_0x240a08['as'],'attributes':_0x240a08['attributes'],'include':_0x240a08[_0x6f6c('0x1b')]?_[_0x6f6c('0x1d')](_0x240a08[_0x6f6c('0x1b')],function(_0x56e544){return{'model':db[_0x56e544[_0x6f6c('0x1c')]],'as':_0x56e544['as'],'attributes':_0x56e544[_0x6f6c('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1ee5cb){logger[_0x6f6c('0xc')](_0x6f6c('0x20'),_0x3214d7);logger['debug'](_0x6f6c('0x20'),_0x3214d7,JSON[_0x6f6c('0xf')](_0x1ee5cb));_0x1ea880(_0x1ee5cb);})['catch'](function(_0xb10ab7){logger[_0x6f6c('0x10')](_0x6f6c('0x20'),_0xb10ab7[_0x6f6c('0x13')],_0x3214d7);_0x776f36(_0xb3e5cb[_0x6f6c('0x10')](0x1f4,_0xb10ab7['message']));});});}; \ No newline at end of file +var _0xb97b=['moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','FreshdeskAccount','findAll','options','raw','limit','include','map','model','attributes','GetFreshdeskAccount','debug','ShowFreshdeskAccount','util'];(function(_0x5c049a,_0x2c1263){var _0x168e70=function(_0x49441e){while(--_0x49441e){_0x5c049a['push'](_0x5c049a['shift']());}};_0x168e70(++_0x2c1263);}(_0xb97b,0xd8));var _0xbb97=function(_0xc12d2e,_0x3e59fc){_0xc12d2e=_0xc12d2e-0x0;var _0x50cfc6=_0xb97b[_0xc12d2e];return _0x50cfc6;};'use strict';var _=require('lodash');var util=require(_0xbb97('0x0'));var moment=require(_0xbb97('0x1'));var BPromise=require(_0xbb97('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbb97('0x3'));var db=require(_0xbb97('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xbb97('0x5'))('rpc');var config=require(_0xbb97('0x6'));var jayson=require(_0xbb97('0x7'));var client=jayson['client'][_0xbb97('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x193014,_0x230430,_0x2a1ced){return new BPromise(function(_0x15665c,_0xb43746){return client[_0xbb97('0x9')](_0x193014,_0x2a1ced)[_0xbb97('0xa')](function(_0x4e4ad4){logger[_0xbb97('0xb')](_0xbb97('0xc'),_0x230430,_0xbb97('0xd'));logger['debug']('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x230430,_0xbb97('0xd'),JSON[_0xbb97('0xe')](_0x4e4ad4));if(_0x4e4ad4[_0xbb97('0xf')]){if(_0x4e4ad4['error']['code']===0x1f4){logger['error'](_0xbb97('0xc'),_0x230430,_0x4e4ad4[_0xbb97('0xf')]['message']);return _0xb43746(_0x4e4ad4[_0xbb97('0xf')][_0xbb97('0x10')]);}logger[_0xbb97('0xf')](_0xbb97('0xc'),_0x230430,_0x4e4ad4[_0xbb97('0xf')][_0xbb97('0x10')]);return _0x15665c(_0x4e4ad4[_0xbb97('0xf')][_0xbb97('0x10')]);}else{logger[_0xbb97('0xb')]('FreshdeskAccount,\x20%s,\x20%s',_0x230430,_0xbb97('0xd'));_0x15665c(_0x4e4ad4[_0xbb97('0x11')][_0xbb97('0x10')]);}})[_0xbb97('0x12')](function(_0x5cbe88){logger['error'](_0xbb97('0xc'),_0x230430,_0x5cbe88);_0xb43746(_0x5cbe88);});});}exports['GetFreshdeskAccount']=function(_0x47e43b){var _0x437005=this;return new Promise(function(_0x55e0b3,_0x2c2e15){return db[_0xbb97('0x13')][_0xbb97('0x14')]({'raw':_0x47e43b[_0xbb97('0x15')]?_0x47e43b[_0xbb97('0x15')][_0xbb97('0x16')]===undefined?!![]:![]:!![],'where':_0x47e43b['options']?_0x47e43b[_0xbb97('0x15')]['where']||null:null,'attributes':_0x47e43b['options']?_0x47e43b[_0xbb97('0x15')]['attributes']||null:null,'limit':_0x47e43b[_0xbb97('0x15')]?_0x47e43b[_0xbb97('0x15')][_0xbb97('0x17')]||null:null,'include':_0x47e43b[_0xbb97('0x15')]?_0x47e43b[_0xbb97('0x15')][_0xbb97('0x18')]?_[_0xbb97('0x19')](_0x47e43b[_0xbb97('0x15')][_0xbb97('0x18')],function(_0x20bc3c){return{'model':db[_0x20bc3c[_0xbb97('0x1a')]],'as':_0x20bc3c['as'],'attributes':_0x20bc3c[_0xbb97('0x1b')],'include':_0x20bc3c[_0xbb97('0x18')]?_[_0xbb97('0x19')](_0x20bc3c[_0xbb97('0x18')],function(_0x34697a){return{'model':db[_0x34697a[_0xbb97('0x1a')]],'as':_0x34697a['as'],'attributes':_0x34697a[_0xbb97('0x1b')],'include':_0x34697a[_0xbb97('0x18')]?_[_0xbb97('0x19')](_0x34697a['include'],function(_0x51829a){return{'model':db[_0x51829a[_0xbb97('0x1a')]],'as':_0x51829a['as'],'attributes':_0x51829a['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x592cbd){logger[_0xbb97('0xb')](_0xbb97('0x1c'),_0x47e43b);logger[_0xbb97('0x1d')](_0xbb97('0x1c'),_0x47e43b,JSON[_0xbb97('0xe')](_0x592cbd));_0x55e0b3(_0x592cbd);})[_0xbb97('0x12')](function(_0x2a8a97){logger[_0xbb97('0xf')](_0xbb97('0x1c'),_0x2a8a97[_0xbb97('0x10')],_0x47e43b);_0x2c2e15(_0x437005[_0xbb97('0xf')](0x1f4,_0x2a8a97[_0xbb97('0x10')]));});});};exports['ShowFreshdeskAccount']=function(_0x53c38a){var _0x5cd491=this;return new Promise(function(_0x2de799,_0xc6052c){return db[_0xbb97('0x13')]['find']({'raw':_0x53c38a[_0xbb97('0x15')]?_0x53c38a[_0xbb97('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x53c38a[_0xbb97('0x15')]?_0x53c38a[_0xbb97('0x15')]['where']||null:null,'attributes':_0x53c38a[_0xbb97('0x15')]?_0x53c38a[_0xbb97('0x15')][_0xbb97('0x1b')]||null:null,'include':_0x53c38a['options']?_0x53c38a[_0xbb97('0x15')][_0xbb97('0x18')]?_['map'](_0x53c38a[_0xbb97('0x15')]['include'],function(_0x481604){return{'model':db[_0x481604[_0xbb97('0x1a')]],'as':_0x481604['as'],'attributes':_0x481604['attributes'],'include':_0x481604[_0xbb97('0x18')]?_[_0xbb97('0x19')](_0x481604['include'],function(_0x3f64ba){return{'model':db[_0x3f64ba[_0xbb97('0x1a')]],'as':_0x3f64ba['as'],'attributes':_0x3f64ba[_0xbb97('0x1b')],'include':_0x3f64ba[_0xbb97('0x18')]?_[_0xbb97('0x19')](_0x3f64ba[_0xbb97('0x18')],function(_0x1187f8){return{'model':db[_0x1187f8[_0xbb97('0x1a')]],'as':_0x1187f8['as'],'attributes':_0x1187f8[_0xbb97('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xbb97('0xa')](function(_0x57ec91){logger[_0xbb97('0xb')]('ShowFreshdeskAccount',_0x53c38a);logger[_0xbb97('0x1d')](_0xbb97('0x1e'),_0x53c38a,JSON['stringify'](_0x57ec91));_0x2de799(_0x57ec91);})[_0xbb97('0x12')](function(_0x579227){logger['error'](_0xbb97('0x1e'),_0x579227['message'],_0x53c38a);_0xc6052c(_0x5cd491[_0xbb97('0xf')](0x1f4,_0x579227[_0xbb97('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 776ec62..b64d414 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 _0xe2f7=['fs-extra','../../components/auth/service','../../components/interaction/service','./intFreshdeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','/:id/tags','getTags','post','setTags','put','update','delete','destroy','exports','path','connect-timeout','express'];(function(_0x42e3d5,_0x5325f6){var _0x21cf13=function(_0x398fc8){while(--_0x398fc8){_0x42e3d5['push'](_0x42e3d5['shift']());}};_0x21cf13(++_0x5325f6);}(_0xe2f7,0x183));var _0x7e2f=function(_0x6681b1,_0xc0c1df){_0x6681b1=_0x6681b1-0x0;var _0x45a3f9=_0xe2f7[_0x6681b1];return _0x45a3f9;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x7e2f('0x0'));var timeout=require(_0x7e2f('0x1'));var express=require(_0x7e2f('0x2'));var router=express['Router']();var fs_extra=require(_0x7e2f('0x3'));var auth=require(_0x7e2f('0x4'));var interaction=require(_0x7e2f('0x5'));var config=require('../../config/environment');var controller=require(_0x7e2f('0x6'));router[_0x7e2f('0x7')]('/',auth[_0x7e2f('0x8')](),controller[_0x7e2f('0x9')]);router['get'](_0x7e2f('0xa'),auth[_0x7e2f('0x8')](),controller[_0x7e2f('0xb')]);router['get'](_0x7e2f('0xc'),auth[_0x7e2f('0x8')](),controller[_0x7e2f('0xd')]);router['get'](_0x7e2f('0xe'),auth[_0x7e2f('0x8')](),controller[_0x7e2f('0xf')]);router[_0x7e2f('0x7')](_0x7e2f('0x10'),auth[_0x7e2f('0x8')](),controller['getDescriptions']);router['get'](_0x7e2f('0x11'),auth[_0x7e2f('0x8')](),controller[_0x7e2f('0x12')]);router[_0x7e2f('0x13')]('/',auth[_0x7e2f('0x8')](),controller['create']);router[_0x7e2f('0x13')]('/:id/tags',auth[_0x7e2f('0x8')](),controller[_0x7e2f('0x14')]);router[_0x7e2f('0x15')](_0x7e2f('0xa'),auth['isAuthenticated'](),controller[_0x7e2f('0x16')]);router[_0x7e2f('0x17')]('/:id',auth[_0x7e2f('0x8')](),controller[_0x7e2f('0x18')]);module[_0x7e2f('0x19')]=router; \ No newline at end of file +var _0x4479=['destroy','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./intFreshdeskConfiguration.controller','get','isAuthenticated','index','/:id','show','getFields','/:id/subjects','getSubjects','getDescriptions','/:id/tags','getTags','post','create','put','update','delete'];(function(_0x701c5d,_0x47a566){var _0x617b08=function(_0x41409f){while(--_0x41409f){_0x701c5d['push'](_0x701c5d['shift']());}};_0x617b08(++_0x47a566);}(_0x4479,0xe2));var _0x9447=function(_0x494b87,_0x4e8d94){_0x494b87=_0x494b87-0x0;var _0x288748=_0x4479[_0x494b87];return _0x288748;};'use strict';var multer=require('multer');var util=require(_0x9447('0x0'));var path=require(_0x9447('0x1'));var timeout=require(_0x9447('0x2'));var express=require(_0x9447('0x3'));var router=express['Router']();var fs_extra=require(_0x9447('0x4'));var auth=require(_0x9447('0x5'));var interaction=require(_0x9447('0x6'));var config=require('../../config/environment');var controller=require(_0x9447('0x7'));router[_0x9447('0x8')]('/',auth[_0x9447('0x9')](),controller[_0x9447('0xa')]);router[_0x9447('0x8')](_0x9447('0xb'),auth[_0x9447('0x9')](),controller[_0x9447('0xc')]);router[_0x9447('0x8')]('/:id/fields',auth[_0x9447('0x9')](),controller[_0x9447('0xd')]);router[_0x9447('0x8')](_0x9447('0xe'),auth['isAuthenticated'](),controller[_0x9447('0xf')]);router['get']('/:id/descriptions',auth[_0x9447('0x9')](),controller[_0x9447('0x10')]);router[_0x9447('0x8')](_0x9447('0x11'),auth[_0x9447('0x9')](),controller[_0x9447('0x12')]);router[_0x9447('0x13')]('/',auth[_0x9447('0x9')](),controller[_0x9447('0x14')]);router[_0x9447('0x13')](_0x9447('0x11'),auth[_0x9447('0x9')](),controller['setTags']);router[_0x9447('0x15')](_0x9447('0xb'),auth[_0x9447('0x9')](),controller[_0x9447('0x16')]);router[_0x9447('0x17')](_0x9447('0xb'),auth[_0x9447('0x9')](),controller[_0x9447('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index 373cdc6..52d4faa 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 _0xa8d7=['sequelize','exports','STRING'];(function(_0xcc6ce4,_0x2979cf){var _0x29566e=function(_0x4811bd){while(--_0x4811bd){_0xcc6ce4['push'](_0xcc6ce4['shift']());}};_0x29566e(++_0x2979cf);}(_0xa8d7,0x87));var _0x7a8d=function(_0x420513,_0x30eae3){_0x420513=_0x420513-0x0;var _0x1b44ec=_0xa8d7[_0x420513];return _0x1b44ec;};'use strict';var Sequelize=require(_0x7a8d('0x0'));module[_0x7a8d('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x7a8d('0x2')]}}; \ No newline at end of file +var _0xc69c=['STRING','sequelize','exports'];(function(_0x2aecb2,_0x343312){var _0x3ebb80=function(_0x19fab3){while(--_0x19fab3){_0x2aecb2['push'](_0x2aecb2['shift']());}};_0x3ebb80(++_0x343312);}(_0xc69c,0x163));var _0xcc69=function(_0x2da8e3,_0x397415){_0x2da8e3=_0x2da8e3-0x0;var _0x281fd5=_0xc69c[_0x2da8e3];return _0x281fd5;};'use strict';var Sequelize=require(_0xcc69('0x0'));module[_0xcc69('0x1')]={'name':{'type':Sequelize[_0xcc69('0x2')]},'description':{'type':Sequelize[_0xcc69('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index 642ae06..896875e 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 _0x9c7c=['VIRTUAL','options','FreshdeskConfiguration','includeAll','rows','show','params','rawAttributes','include','find','create','body','catch','destroy','getFields','findOne','FreshdeskField','getSubjects','pick','getDescriptions','getTags','Tag','setTags','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','end','stack','name','send','index','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge'];(function(_0x202c57,_0x362b60){var _0x4faa61=function(_0x41e082){while(--_0x41e082){_0x202c57['push'](_0x202c57['shift']());}};_0x4faa61(++_0x362b60);}(_0x9c7c,0x119));var _0xc9c7=function(_0x2ea145,_0x459e23){_0x2ea145=_0x2ea145-0x0;var _0x2786d7=_0x9c7c[_0x2ea145];return _0x2786d7;};'use strict';var emlformat=require(_0xc9c7('0x0'));var rimraf=require(_0xc9c7('0x1'));var zipdir=require(_0xc9c7('0x2'));var jsonpatch=require(_0xc9c7('0x3'));var rp=require(_0xc9c7('0x4'));var moment=require('moment');var BPromise=require(_0xc9c7('0x5'));var Mustache=require(_0xc9c7('0x6'));var util=require(_0xc9c7('0x7'));var path=require(_0xc9c7('0x8'));var sox=require('sox');var csv=require(_0xc9c7('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc9c7('0xa'));var squel=require(_0xc9c7('0xb'));var crypto=require(_0xc9c7('0xc'));var jsforce=require(_0xc9c7('0xd'));var deskjs=require(_0xc9c7('0xe'));var toCsv=require(_0xc9c7('0x9'));var querystring=require(_0xc9c7('0xf'));var Papa=require('papaparse');var Redis=require(_0xc9c7('0x10'));var authService=require(_0xc9c7('0x11'));var qs=require(_0xc9c7('0x12'));var as=require(_0xc9c7('0x13'));var hardwareService=require(_0xc9c7('0x14'));var logger=require('../../config/logger')(_0xc9c7('0x15'));var utils=require(_0xc9c7('0x16'));var config=require(_0xc9c7('0x17'));var licenseUtil=require(_0xc9c7('0x18'));var db=require(_0xc9c7('0x19'))['db'];function respondWithStatusCode(_0x3d4cfb,_0x4aeb21){_0x4aeb21=_0x4aeb21||0xcc;return function(_0x16f075){if(_0x16f075){return _0x3d4cfb[_0xc9c7('0x1a')](_0x4aeb21);}return _0x3d4cfb[_0xc9c7('0x1b')](_0x4aeb21)['end']();};}function respondWithResult(_0x1bfd1b,_0x3402f8){_0x3402f8=_0x3402f8||0xc8;return function(_0x5e288e){if(_0x5e288e){return _0x1bfd1b[_0xc9c7('0x1b')](_0x3402f8)['json'](_0x5e288e);}};}function respondWithFilteredResult(_0x4e14ae,_0x47ef4c){return function(_0x3254df){if(_0x3254df){var _0x1a01d7=typeof _0x47ef4c[_0xc9c7('0x1c')]===_0xc9c7('0x1d')&&typeof _0x47ef4c[_0xc9c7('0x1e')]===_0xc9c7('0x1d');var _0x425706=_0x3254df[_0xc9c7('0x1f')];var _0x81209f=_0x1a01d7?0x0:_0x47ef4c[_0xc9c7('0x1c')];var _0x9a696a=_0x1a01d7?_0x3254df[_0xc9c7('0x1f')]:_0x47ef4c[_0xc9c7('0x1c')]+_0x47ef4c[_0xc9c7('0x1e')];var _0x1a9d25;if(_0x9a696a>=_0x425706){_0x9a696a=_0x425706;_0x1a9d25=0xc8;}else{_0x1a9d25=0xce;}_0x4e14ae['status'](_0x1a9d25);return _0x4e14ae[_0xc9c7('0x20')](_0xc9c7('0x21'),_0x81209f+'-'+_0x9a696a+'/'+_0x425706)[_0xc9c7('0x22')](_0x3254df);}return null;};}function patchUpdates(_0x376052){return function(_0x4f63a2){try{jsonpatch[_0xc9c7('0x23')](_0x4f63a2,_0x376052,!![]);}catch(_0x937785){return BPromise[_0xc9c7('0x24')](_0x937785);}return _0x4f63a2[_0xc9c7('0x25')]();};}function saveUpdates(_0xb20f17,_0x52589d){return function(_0x562a1e){if(_0x562a1e){return _0x562a1e[_0xc9c7('0x26')](_0xb20f17)[_0xc9c7('0x27')](function(_0x308723){return _0x308723;});}return null;};}function removeEntity(_0x4c0e14,_0x1659cf){return function(_0x129aaa){if(_0x129aaa){return _0x129aaa['destroy']()['then'](function(){_0x4c0e14['status'](0xcc)[_0xc9c7('0x28')]();});}};}function handleEntityNotFound(_0x2f3555,_0x1e78cb){return function(_0x49d11d){if(!_0x49d11d){_0x2f3555['sendStatus'](0x194);}return _0x49d11d;};}function handleError(_0x4c2e72,_0x3e6b0f){_0x3e6b0f=_0x3e6b0f||0x1f4;return function(_0x537ec6){logger['error'](_0x537ec6[_0xc9c7('0x29')]);if(_0x537ec6[_0xc9c7('0x2a')]){delete _0x537ec6[_0xc9c7('0x2a')];}_0x4c2e72[_0xc9c7('0x1b')](_0x3e6b0f)[_0xc9c7('0x2b')](_0x537ec6);};}exports[_0xc9c7('0x2c')]=function(_0x43e7ca,_0x4343b6){var _0x134e61={},_0x441c58={},_0x380b63={'count':0x0,'rows':[]};var _0x3b0f5b=_['map'](db['FreshdeskConfiguration']['rawAttributes'],function(_0x55f51a){return{'name':_0x55f51a[_0xc9c7('0x2d')],'type':_0x55f51a[_0xc9c7('0x2e')]['key']};});_0x441c58[_0xc9c7('0x2f')]=_[_0xc9c7('0x30')](_0x3b0f5b,'name');_0x441c58[_0xc9c7('0x31')]=_[_0xc9c7('0x32')](_0x43e7ca[_0xc9c7('0x31')]);_0x441c58[_0xc9c7('0x33')]=_[_0xc9c7('0x34')](_0x441c58[_0xc9c7('0x2f')],_0x441c58[_0xc9c7('0x31')]);_0x134e61[_0xc9c7('0x35')]=_[_0xc9c7('0x34')](_0x441c58[_0xc9c7('0x2f')],qs[_0xc9c7('0x36')](_0x43e7ca['query']['fields']));_0x134e61['attributes']=_0x134e61['attributes'][_0xc9c7('0x37')]?_0x134e61[_0xc9c7('0x35')]:_0x441c58[_0xc9c7('0x2f')];if(!_0x43e7ca[_0xc9c7('0x31')][_0xc9c7('0x38')](_0xc9c7('0x39'))){_0x134e61[_0xc9c7('0x1e')]=qs[_0xc9c7('0x1e')](_0x43e7ca[_0xc9c7('0x31')][_0xc9c7('0x1e')]);_0x134e61[_0xc9c7('0x1c')]=qs[_0xc9c7('0x1c')](_0x43e7ca[_0xc9c7('0x31')][_0xc9c7('0x1c')]);}_0x134e61[_0xc9c7('0x3a')]=qs[_0xc9c7('0x3b')](_0x43e7ca[_0xc9c7('0x31')][_0xc9c7('0x3b')]);_0x134e61['where']=qs[_0xc9c7('0x33')](_['pick'](_0x43e7ca[_0xc9c7('0x31')],_0x441c58[_0xc9c7('0x33')]),_0x3b0f5b);if(_0x43e7ca[_0xc9c7('0x31')][_0xc9c7('0x3c')]){_0x134e61[_0xc9c7('0x3d')]=_[_0xc9c7('0x3e')](_0x134e61['where'],{'$or':_[_0xc9c7('0x30')](_0x3b0f5b,function(_0x4c203e){if(_0x4c203e['type']!==_0xc9c7('0x3f')){var _0x52dc05={};_0x52dc05[_0x4c203e[_0xc9c7('0x2a')]]={'$like':'%'+_0x43e7ca['query'][_0xc9c7('0x3c')]+'%'};return _0x52dc05;}})});}_0x134e61=_[_0xc9c7('0x3e')]({},_0x134e61,_0x43e7ca[_0xc9c7('0x40')]);var _0x1bd177={'where':_0x134e61[_0xc9c7('0x3d')]};return db[_0xc9c7('0x41')][_0xc9c7('0x1f')](_0x1bd177)[_0xc9c7('0x27')](function(_0x58abcb){_0x380b63[_0xc9c7('0x1f')]=_0x58abcb;if(_0x43e7ca['query'][_0xc9c7('0x42')]){_0x134e61['include']=[{'all':!![]}];}return db[_0xc9c7('0x41')]['findAll'](_0x134e61);})[_0xc9c7('0x27')](function(_0x2d9e55){_0x380b63[_0xc9c7('0x43')]=_0x2d9e55;return _0x380b63;})[_0xc9c7('0x27')](respondWithFilteredResult(_0x4343b6,_0x134e61))['catch'](handleError(_0x4343b6,null));};exports[_0xc9c7('0x44')]=function(_0x1912d0,_0xb033b7){var _0x27690c={'raw':![],'where':{'id':_0x1912d0[_0xc9c7('0x45')]['id']}},_0x489f2b={};_0x489f2b['model']=_[_0xc9c7('0x32')](db[_0xc9c7('0x41')][_0xc9c7('0x46')]);_0x489f2b[_0xc9c7('0x31')]=_[_0xc9c7('0x32')](_0x1912d0[_0xc9c7('0x31')]);_0x489f2b[_0xc9c7('0x33')]=_[_0xc9c7('0x34')](_0x489f2b[_0xc9c7('0x2f')],_0x489f2b[_0xc9c7('0x31')]);_0x27690c['attributes']=_['intersection'](_0x489f2b['model'],qs[_0xc9c7('0x36')](_0x1912d0[_0xc9c7('0x31')][_0xc9c7('0x36')]));_0x27690c[_0xc9c7('0x35')]=_0x27690c[_0xc9c7('0x35')][_0xc9c7('0x37')]?_0x27690c[_0xc9c7('0x35')]:_0x489f2b[_0xc9c7('0x2f')];if(_0x1912d0['query']['includeAll']){_0x27690c[_0xc9c7('0x47')]=[{'all':!![]}];}_0x27690c=_[_0xc9c7('0x3e')]({},_0x27690c,_0x1912d0[_0xc9c7('0x40')]);return db[_0xc9c7('0x41')][_0xc9c7('0x48')](_0x27690c)[_0xc9c7('0x27')](handleEntityNotFound(_0xb033b7,null))[_0xc9c7('0x27')](respondWithResult(_0xb033b7,null))['catch'](handleError(_0xb033b7,null));};exports[_0xc9c7('0x49')]=function(_0x4cd0cf,_0x376add){return db[_0xc9c7('0x41')][_0xc9c7('0x49')](_0x4cd0cf['body'],{})[_0xc9c7('0x27')](respondWithResult(_0x376add,0xc9))['catch'](handleError(_0x376add,null));};exports[_0xc9c7('0x26')]=function(_0x16f7ed,_0x4ad94a){if(_0x16f7ed[_0xc9c7('0x4a')]['id']){delete _0x16f7ed[_0xc9c7('0x4a')]['id'];}return db[_0xc9c7('0x41')][_0xc9c7('0x48')]({'where':{'id':_0x16f7ed['params']['id']}})['then'](handleEntityNotFound(_0x4ad94a,null))[_0xc9c7('0x27')](saveUpdates(_0x16f7ed['body'],null))[_0xc9c7('0x27')](respondWithResult(_0x4ad94a,null))[_0xc9c7('0x4b')](handleError(_0x4ad94a,null));};exports[_0xc9c7('0x4c')]=function(_0x17390d,_0x591909){return db[_0xc9c7('0x41')]['find']({'where':{'id':_0x17390d[_0xc9c7('0x45')]['id']}})[_0xc9c7('0x27')](handleEntityNotFound(_0x591909,null))[_0xc9c7('0x27')](removeEntity(_0x591909,null))[_0xc9c7('0x4b')](handleError(_0x591909,null));};exports[_0xc9c7('0x4d')]=function(_0x1e893e,_0x143f72,_0x1a2304){var _0x11b00e={};var _0x1d0c7b={};var _0x29b4c8;var _0x12c483;return db[_0xc9c7('0x41')][_0xc9c7('0x4e')]({'where':{'id':_0x1e893e[_0xc9c7('0x45')]['id']}})[_0xc9c7('0x27')](handleEntityNotFound(_0x143f72,null))[_0xc9c7('0x27')](function(_0x508722){if(_0x508722){_0x29b4c8=_0x508722;_0x1d0c7b[_0xc9c7('0x2f')]=_['keys'](db[_0xc9c7('0x4f')][_0xc9c7('0x46')]);_0x1d0c7b[_0xc9c7('0x31')]=_[_0xc9c7('0x32')](_0x1e893e['query']);_0x1d0c7b[_0xc9c7('0x33')]=_[_0xc9c7('0x34')](_0x1d0c7b['model'],_0x1d0c7b[_0xc9c7('0x31')]);_0x11b00e[_0xc9c7('0x35')]=_[_0xc9c7('0x34')](_0x1d0c7b[_0xc9c7('0x2f')],qs[_0xc9c7('0x36')](_0x1e893e['query'][_0xc9c7('0x36')]));_0x11b00e[_0xc9c7('0x35')]=_0x11b00e[_0xc9c7('0x35')][_0xc9c7('0x37')]?_0x11b00e[_0xc9c7('0x35')]:_0x1d0c7b[_0xc9c7('0x2f')];_0x11b00e[_0xc9c7('0x3a')]=qs['sort'](_0x1e893e[_0xc9c7('0x31')][_0xc9c7('0x3b')]);_0x11b00e[_0xc9c7('0x3d')]=qs[_0xc9c7('0x33')](_['pick'](_0x1e893e[_0xc9c7('0x31')],_0x1d0c7b['filters']));if(_0x1e893e[_0xc9c7('0x31')]['filter']){_0x11b00e[_0xc9c7('0x3d')]=_[_0xc9c7('0x3e')](_0x11b00e['where'],{'$or':_[_0xc9c7('0x30')](_0x11b00e[_0xc9c7('0x35')],function(_0xe198a6){var _0x3fd99c={};_0x3fd99c[_0xe198a6]={'$like':'%'+_0x1e893e[_0xc9c7('0x31')][_0xc9c7('0x3c')]+'%'};return _0x3fd99c;})});}_0x11b00e=_[_0xc9c7('0x3e')]({},_0x11b00e,_0x1e893e[_0xc9c7('0x40')]);return _0x29b4c8[_0xc9c7('0x4d')](_0x11b00e);}})['then'](function(_0x1da839){if(_0x1da839){_0x12c483=_0x1da839['length'];if(!_0x1e893e[_0xc9c7('0x31')][_0xc9c7('0x38')](_0xc9c7('0x39'))){_0x11b00e[_0xc9c7('0x1e')]=qs['limit'](_0x1e893e[_0xc9c7('0x31')]['limit']);_0x11b00e[_0xc9c7('0x1c')]=qs[_0xc9c7('0x1c')](_0x1e893e[_0xc9c7('0x31')][_0xc9c7('0x1c')]);}return _0x29b4c8[_0xc9c7('0x4d')](_0x11b00e);}})[_0xc9c7('0x27')](function(_0x4b9506){if(_0x4b9506){return _0x4b9506?{'count':_0x12c483,'rows':_0x4b9506}:null;}})[_0xc9c7('0x27')](respondWithResult(_0x143f72,null))['catch'](handleError(_0x143f72,null));};exports[_0xc9c7('0x50')]=function(_0x46fc12,_0x532259,_0xe4af88){var _0x3a6118={};var _0x5392f8={};var _0x3f4f0b;var _0x34ab17;return db['FreshdeskConfiguration'][_0xc9c7('0x4e')]({'where':{'id':_0x46fc12['params']['id']}})['then'](handleEntityNotFound(_0x532259,null))[_0xc9c7('0x27')](function(_0x4a4104){if(_0x4a4104){_0x3f4f0b=_0x4a4104;_0x5392f8[_0xc9c7('0x2f')]=_[_0xc9c7('0x32')](db['FreshdeskField'][_0xc9c7('0x46')]);_0x5392f8['query']=_['keys'](_0x46fc12['query']);_0x5392f8[_0xc9c7('0x33')]=_[_0xc9c7('0x34')](_0x5392f8[_0xc9c7('0x2f')],_0x5392f8[_0xc9c7('0x31')]);_0x3a6118[_0xc9c7('0x35')]=_['intersection'](_0x5392f8['model'],qs['fields'](_0x46fc12['query'][_0xc9c7('0x36')]));_0x3a6118[_0xc9c7('0x35')]=_0x3a6118[_0xc9c7('0x35')]['length']?_0x3a6118[_0xc9c7('0x35')]:_0x5392f8[_0xc9c7('0x2f')];_0x3a6118[_0xc9c7('0x3a')]=qs[_0xc9c7('0x3b')](_0x46fc12[_0xc9c7('0x31')][_0xc9c7('0x3b')]);_0x3a6118[_0xc9c7('0x3d')]=qs[_0xc9c7('0x33')](_[_0xc9c7('0x51')](_0x46fc12[_0xc9c7('0x31')],_0x5392f8['filters']));if(_0x46fc12[_0xc9c7('0x31')][_0xc9c7('0x3c')]){_0x3a6118[_0xc9c7('0x3d')]=_[_0xc9c7('0x3e')](_0x3a6118[_0xc9c7('0x3d')],{'$or':_[_0xc9c7('0x30')](_0x3a6118[_0xc9c7('0x35')],function(_0x5b1ffa){var _0x2638b8={};_0x2638b8[_0x5b1ffa]={'$like':'%'+_0x46fc12[_0xc9c7('0x31')][_0xc9c7('0x3c')]+'%'};return _0x2638b8;})});}_0x3a6118=_[_0xc9c7('0x3e')]({},_0x3a6118,_0x46fc12[_0xc9c7('0x40')]);return _0x3f4f0b[_0xc9c7('0x50')](_0x3a6118);}})[_0xc9c7('0x27')](function(_0xed7bc){if(_0xed7bc){_0x34ab17=_0xed7bc['length'];if(!_0x46fc12[_0xc9c7('0x31')][_0xc9c7('0x38')](_0xc9c7('0x39'))){_0x3a6118[_0xc9c7('0x1e')]=qs['limit'](_0x46fc12[_0xc9c7('0x31')][_0xc9c7('0x1e')]);_0x3a6118[_0xc9c7('0x1c')]=qs[_0xc9c7('0x1c')](_0x46fc12['query'][_0xc9c7('0x1c')]);}return _0x3f4f0b['getSubjects'](_0x3a6118);}})['then'](function(_0x28deb1){if(_0x28deb1){return _0x28deb1?{'count':_0x34ab17,'rows':_0x28deb1}:null;}})[_0xc9c7('0x27')](respondWithResult(_0x532259,null))[_0xc9c7('0x4b')](handleError(_0x532259,null));};exports['getDescriptions']=function(_0x4d3fcd,_0xb178a7,_0x2012bd){var _0x4c7f90={};var _0x3e1d23={};var _0x48cb47;var _0x32c534;return db[_0xc9c7('0x41')][_0xc9c7('0x4e')]({'where':{'id':_0x4d3fcd[_0xc9c7('0x45')]['id']}})[_0xc9c7('0x27')](handleEntityNotFound(_0xb178a7,null))[_0xc9c7('0x27')](function(_0x2b1b9c){if(_0x2b1b9c){_0x48cb47=_0x2b1b9c;_0x3e1d23['model']=_[_0xc9c7('0x32')](db['FreshdeskField'][_0xc9c7('0x46')]);_0x3e1d23[_0xc9c7('0x31')]=_[_0xc9c7('0x32')](_0x4d3fcd[_0xc9c7('0x31')]);_0x3e1d23[_0xc9c7('0x33')]=_[_0xc9c7('0x34')](_0x3e1d23['model'],_0x3e1d23[_0xc9c7('0x31')]);_0x4c7f90['attributes']=_[_0xc9c7('0x34')](_0x3e1d23['model'],qs[_0xc9c7('0x36')](_0x4d3fcd[_0xc9c7('0x31')][_0xc9c7('0x36')]));_0x4c7f90[_0xc9c7('0x35')]=_0x4c7f90[_0xc9c7('0x35')][_0xc9c7('0x37')]?_0x4c7f90[_0xc9c7('0x35')]:_0x3e1d23['model'];_0x4c7f90[_0xc9c7('0x3a')]=qs[_0xc9c7('0x3b')](_0x4d3fcd[_0xc9c7('0x31')][_0xc9c7('0x3b')]);_0x4c7f90[_0xc9c7('0x3d')]=qs['filters'](_['pick'](_0x4d3fcd[_0xc9c7('0x31')],_0x3e1d23[_0xc9c7('0x33')]));if(_0x4d3fcd[_0xc9c7('0x31')][_0xc9c7('0x3c')]){_0x4c7f90[_0xc9c7('0x3d')]=_[_0xc9c7('0x3e')](_0x4c7f90[_0xc9c7('0x3d')],{'$or':_[_0xc9c7('0x30')](_0x4c7f90[_0xc9c7('0x35')],function(_0x36b6f7){var _0xdbdc8={};_0xdbdc8[_0x36b6f7]={'$like':'%'+_0x4d3fcd[_0xc9c7('0x31')][_0xc9c7('0x3c')]+'%'};return _0xdbdc8;})});}_0x4c7f90=_['merge']({},_0x4c7f90,_0x4d3fcd['options']);return _0x48cb47[_0xc9c7('0x52')](_0x4c7f90);}})[_0xc9c7('0x27')](function(_0x2bb42c){if(_0x2bb42c){_0x32c534=_0x2bb42c[_0xc9c7('0x37')];if(!_0x4d3fcd[_0xc9c7('0x31')][_0xc9c7('0x38')](_0xc9c7('0x39'))){_0x4c7f90[_0xc9c7('0x1e')]=qs[_0xc9c7('0x1e')](_0x4d3fcd[_0xc9c7('0x31')][_0xc9c7('0x1e')]);_0x4c7f90['offset']=qs[_0xc9c7('0x1c')](_0x4d3fcd[_0xc9c7('0x31')][_0xc9c7('0x1c')]);}return _0x48cb47[_0xc9c7('0x52')](_0x4c7f90);}})[_0xc9c7('0x27')](function(_0x2b3816){if(_0x2b3816){return _0x2b3816?{'count':_0x32c534,'rows':_0x2b3816}:null;}})[_0xc9c7('0x27')](respondWithResult(_0xb178a7,null))[_0xc9c7('0x4b')](handleError(_0xb178a7,null));};exports[_0xc9c7('0x53')]=function(_0x22292f,_0x498f4c,_0x3d3bd6){var _0x17dc2f={};var _0x1b878b={};var _0x4a4c5f;var _0x346035;return db['FreshdeskConfiguration'][_0xc9c7('0x4e')]({'where':{'id':_0x22292f['params']['id']}})[_0xc9c7('0x27')](handleEntityNotFound(_0x498f4c,null))[_0xc9c7('0x27')](function(_0xce4ebd){if(_0xce4ebd){_0x4a4c5f=_0xce4ebd;_0x1b878b[_0xc9c7('0x2f')]=_[_0xc9c7('0x32')](db[_0xc9c7('0x54')]['rawAttributes']);_0x1b878b[_0xc9c7('0x31')]=_['keys'](_0x22292f['query']);_0x1b878b['filters']=_[_0xc9c7('0x34')](_0x1b878b['model'],_0x1b878b['query']);_0x17dc2f[_0xc9c7('0x35')]=_[_0xc9c7('0x34')](_0x1b878b['model'],qs[_0xc9c7('0x36')](_0x22292f[_0xc9c7('0x31')]['fields']));_0x17dc2f[_0xc9c7('0x35')]=_0x17dc2f[_0xc9c7('0x35')][_0xc9c7('0x37')]?_0x17dc2f[_0xc9c7('0x35')]:_0x1b878b[_0xc9c7('0x2f')];_0x17dc2f['order']=qs[_0xc9c7('0x3b')](_0x22292f[_0xc9c7('0x31')][_0xc9c7('0x3b')]);_0x17dc2f[_0xc9c7('0x3d')]=qs[_0xc9c7('0x33')](_['pick'](_0x22292f[_0xc9c7('0x31')],_0x1b878b[_0xc9c7('0x33')]));if(_0x22292f[_0xc9c7('0x31')]['filter']){_0x17dc2f[_0xc9c7('0x3d')]=_[_0xc9c7('0x3e')](_0x17dc2f[_0xc9c7('0x3d')],{'$or':_[_0xc9c7('0x30')](_0x17dc2f['attributes'],function(_0x123bb8){var _0x10926d={};_0x10926d[_0x123bb8]={'$like':'%'+_0x22292f['query'][_0xc9c7('0x3c')]+'%'};return _0x10926d;})});}_0x17dc2f=_[_0xc9c7('0x3e')]({},_0x17dc2f,_0x22292f[_0xc9c7('0x40')]);return _0x4a4c5f[_0xc9c7('0x53')](_0x17dc2f);}})[_0xc9c7('0x27')](function(_0x2a0c8c){if(_0x2a0c8c){_0x346035=_0x2a0c8c[_0xc9c7('0x37')];if(!_0x22292f[_0xc9c7('0x31')][_0xc9c7('0x38')](_0xc9c7('0x39'))){_0x17dc2f[_0xc9c7('0x1e')]=qs[_0xc9c7('0x1e')](_0x22292f['query'][_0xc9c7('0x1e')]);_0x17dc2f['offset']=qs['offset'](_0x22292f[_0xc9c7('0x31')][_0xc9c7('0x1c')]);}return _0x4a4c5f[_0xc9c7('0x53')](_0x17dc2f);}})[_0xc9c7('0x27')](function(_0x25a630){if(_0x25a630){return _0x25a630?{'count':_0x346035,'rows':_0x25a630}:null;}})[_0xc9c7('0x27')](respondWithResult(_0x498f4c,null))[_0xc9c7('0x4b')](handleError(_0x498f4c,null));};exports[_0xc9c7('0x55')]=function(_0x1c9af3,_0x212dbb,_0x1cca1b){if(_0x1c9af3['body']['id']){delete _0x1c9af3[_0xc9c7('0x4a')]['id'];}return db[_0xc9c7('0x41')][_0xc9c7('0x4e')]({'where':{'id':_0x1c9af3[_0xc9c7('0x45')]['id']}})[_0xc9c7('0x27')](handleEntityNotFound(_0x212dbb,null))[_0xc9c7('0x27')](function(_0x4c37fd){if(_0x4c37fd){return _0x4c37fd[_0xc9c7('0x55')](_0x1c9af3['body']['ids']||[]);}return null;})['then'](respondWithResult(_0x212dbb,null))[_0xc9c7('0x4b')](handleError(_0x212dbb,null));}; \ No newline at end of file +var _0x1eaa=['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','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','save','then','destroy','error','name','send','index','rawAttributes','fieldName','type','key','model','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','FreshdeskConfiguration','includeAll','include','findAll','rows','catch','show','keys','create','body','update','find','params','findOne','FreshdeskField','map','getFields','getSubjects','getDescriptions','getTags','setTags','ids','eml-format','request-promise','util','path','ejs','fs-extra','lodash','crypto','jsforce','desk.js'];(function(_0x31058e,_0x59a639){var _0x384bf4=function(_0x2a352d){while(--_0x2a352d){_0x31058e['push'](_0x31058e['shift']());}};_0x384bf4(++_0x59a639);}(_0x1eaa,0x13e));var _0xa1ea=function(_0x2c8fc5,_0xad315e){_0x2c8fc5=_0x2c8fc5-0x0;var _0x1159b5=_0x1eaa[_0x2c8fc5];return _0x1159b5;};'use strict';var emlformat=require(_0xa1ea('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xa1ea('0x1'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xa1ea('0x2'));var path=require(_0xa1ea('0x3'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xa1ea('0x4'));var fs=require('fs');var fs_extra=require(_0xa1ea('0x5'));var _=require(_0xa1ea('0x6'));var squel=require('squel');var crypto=require(_0xa1ea('0x7'));var jsforce=require(_0xa1ea('0x8'));var deskjs=require(_0xa1ea('0x9'));var toCsv=require(_0xa1ea('0xa'));var querystring=require(_0xa1ea('0xb'));var Papa=require(_0xa1ea('0xc'));var Redis=require(_0xa1ea('0xd'));var authService=require(_0xa1ea('0xe'));var qs=require(_0xa1ea('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa1ea('0x10'));var logger=require(_0xa1ea('0x11'))(_0xa1ea('0x12'));var utils=require(_0xa1ea('0x13'));var config=require(_0xa1ea('0x14'));var licenseUtil=require(_0xa1ea('0x15'));var db=require(_0xa1ea('0x16'))['db'];function respondWithStatusCode(_0x4572e8,_0x320364){_0x320364=_0x320364||0xcc;return function(_0xc6c962){if(_0xc6c962){return _0x4572e8[_0xa1ea('0x17')](_0x320364);}return _0x4572e8['status'](_0x320364)[_0xa1ea('0x18')]();};}function respondWithResult(_0x6b286b,_0x404818){_0x404818=_0x404818||0xc8;return function(_0x225f38){if(_0x225f38){return _0x6b286b[_0xa1ea('0x19')](_0x404818)[_0xa1ea('0x1a')](_0x225f38);}};}function respondWithFilteredResult(_0x12de76,_0xd17c16){return function(_0x4c1273){if(_0x4c1273){var _0x2b6e38=typeof _0xd17c16[_0xa1ea('0x1b')]===_0xa1ea('0x1c')&&typeof _0xd17c16[_0xa1ea('0x1d')]==='undefined';var _0x58f73b=_0x4c1273[_0xa1ea('0x1e')];var _0x529668=_0x2b6e38?0x0:_0xd17c16['offset'];var _0xaf4513=_0x2b6e38?_0x4c1273[_0xa1ea('0x1e')]:_0xd17c16[_0xa1ea('0x1b')]+_0xd17c16[_0xa1ea('0x1d')];var _0x2ddbce;if(_0xaf4513>=_0x58f73b){_0xaf4513=_0x58f73b;_0x2ddbce=0xc8;}else{_0x2ddbce=0xce;}_0x12de76[_0xa1ea('0x19')](_0x2ddbce);return _0x12de76['set'](_0xa1ea('0x1f'),_0x529668+'-'+_0xaf4513+'/'+_0x58f73b)['json'](_0x4c1273);}return null;};}function patchUpdates(_0x4b7e0b){return function(_0x10ad7f){try{jsonpatch['apply'](_0x10ad7f,_0x4b7e0b,!![]);}catch(_0x5c4a51){return BPromise['reject'](_0x5c4a51);}return _0x10ad7f[_0xa1ea('0x20')]();};}function saveUpdates(_0x17dfce,_0x479ff0){return function(_0x4ca20e){if(_0x4ca20e){return _0x4ca20e['update'](_0x17dfce)[_0xa1ea('0x21')](function(_0x22aef6){return _0x22aef6;});}return null;};}function removeEntity(_0x1f4df6,_0x4d945d){return function(_0x5131a6){if(_0x5131a6){return _0x5131a6[_0xa1ea('0x22')]()[_0xa1ea('0x21')](function(){_0x1f4df6[_0xa1ea('0x19')](0xcc)[_0xa1ea('0x18')]();});}};}function handleEntityNotFound(_0x2d444e,_0x528546){return function(_0x59314a){if(!_0x59314a){_0x2d444e[_0xa1ea('0x17')](0x194);}return _0x59314a;};}function handleError(_0x25009e,_0x1af7d5){_0x1af7d5=_0x1af7d5||0x1f4;return function(_0x312790){logger[_0xa1ea('0x23')](_0x312790['stack']);if(_0x312790[_0xa1ea('0x24')]){delete _0x312790[_0xa1ea('0x24')];}_0x25009e[_0xa1ea('0x19')](_0x1af7d5)[_0xa1ea('0x25')](_0x312790);};}exports[_0xa1ea('0x26')]=function(_0x10bea1,_0x38af0d){var _0x5abf6b={},_0x484b20={},_0x2efb36={'count':0x0,'rows':[]};var _0x247b37=_['map'](db['FreshdeskConfiguration'][_0xa1ea('0x27')],function(_0x357e17){return{'name':_0x357e17[_0xa1ea('0x28')],'type':_0x357e17[_0xa1ea('0x29')][_0xa1ea('0x2a')]};});_0x484b20[_0xa1ea('0x2b')]=_['map'](_0x247b37,_0xa1ea('0x24'));_0x484b20['query']=_['keys'](_0x10bea1['query']);_0x484b20[_0xa1ea('0x2c')]=_[_0xa1ea('0x2d')](_0x484b20[_0xa1ea('0x2b')],_0x484b20[_0xa1ea('0x2e')]);_0x5abf6b[_0xa1ea('0x2f')]=_[_0xa1ea('0x2d')](_0x484b20[_0xa1ea('0x2b')],qs['fields'](_0x10bea1[_0xa1ea('0x2e')][_0xa1ea('0x30')]));_0x5abf6b[_0xa1ea('0x2f')]=_0x5abf6b[_0xa1ea('0x2f')][_0xa1ea('0x31')]?_0x5abf6b[_0xa1ea('0x2f')]:_0x484b20['model'];if(!_0x10bea1[_0xa1ea('0x2e')][_0xa1ea('0x32')](_0xa1ea('0x33'))){_0x5abf6b['limit']=qs['limit'](_0x10bea1['query'][_0xa1ea('0x1d')]);_0x5abf6b['offset']=qs[_0xa1ea('0x1b')](_0x10bea1[_0xa1ea('0x2e')]['offset']);}_0x5abf6b[_0xa1ea('0x34')]=qs[_0xa1ea('0x35')](_0x10bea1[_0xa1ea('0x2e')]['sort']);_0x5abf6b[_0xa1ea('0x36')]=qs[_0xa1ea('0x2c')](_[_0xa1ea('0x37')](_0x10bea1[_0xa1ea('0x2e')],_0x484b20[_0xa1ea('0x2c')]),_0x247b37);if(_0x10bea1[_0xa1ea('0x2e')]['filter']){_0x5abf6b[_0xa1ea('0x36')]=_[_0xa1ea('0x38')](_0x5abf6b[_0xa1ea('0x36')],{'$or':_['map'](_0x247b37,function(_0x2809c5){if(_0x2809c5[_0xa1ea('0x29')]!==_0xa1ea('0x39')){var _0x127be1={};_0x127be1[_0x2809c5[_0xa1ea('0x24')]]={'$like':'%'+_0x10bea1[_0xa1ea('0x2e')][_0xa1ea('0x3a')]+'%'};return _0x127be1;}})});}_0x5abf6b=_[_0xa1ea('0x38')]({},_0x5abf6b,_0x10bea1[_0xa1ea('0x3b')]);var _0x17ac91={'where':_0x5abf6b[_0xa1ea('0x36')]};return db[_0xa1ea('0x3c')]['count'](_0x17ac91)[_0xa1ea('0x21')](function(_0x585044){_0x2efb36[_0xa1ea('0x1e')]=_0x585044;if(_0x10bea1[_0xa1ea('0x2e')][_0xa1ea('0x3d')]){_0x5abf6b[_0xa1ea('0x3e')]=[{'all':!![]}];}return db[_0xa1ea('0x3c')][_0xa1ea('0x3f')](_0x5abf6b);})[_0xa1ea('0x21')](function(_0x4f19c1){_0x2efb36[_0xa1ea('0x40')]=_0x4f19c1;return _0x2efb36;})['then'](respondWithFilteredResult(_0x38af0d,_0x5abf6b))[_0xa1ea('0x41')](handleError(_0x38af0d,null));};exports[_0xa1ea('0x42')]=function(_0x133d7b,_0x25916b){var _0x5bc0d3={'raw':![],'where':{'id':_0x133d7b['params']['id']}},_0x390882={};_0x390882[_0xa1ea('0x2b')]=_[_0xa1ea('0x43')](db[_0xa1ea('0x3c')][_0xa1ea('0x27')]);_0x390882['query']=_[_0xa1ea('0x43')](_0x133d7b[_0xa1ea('0x2e')]);_0x390882[_0xa1ea('0x2c')]=_[_0xa1ea('0x2d')](_0x390882[_0xa1ea('0x2b')],_0x390882[_0xa1ea('0x2e')]);_0x5bc0d3[_0xa1ea('0x2f')]=_[_0xa1ea('0x2d')](_0x390882[_0xa1ea('0x2b')],qs[_0xa1ea('0x30')](_0x133d7b[_0xa1ea('0x2e')][_0xa1ea('0x30')]));_0x5bc0d3[_0xa1ea('0x2f')]=_0x5bc0d3[_0xa1ea('0x2f')][_0xa1ea('0x31')]?_0x5bc0d3[_0xa1ea('0x2f')]:_0x390882[_0xa1ea('0x2b')];if(_0x133d7b[_0xa1ea('0x2e')]['includeAll']){_0x5bc0d3[_0xa1ea('0x3e')]=[{'all':!![]}];}_0x5bc0d3=_['merge']({},_0x5bc0d3,_0x133d7b[_0xa1ea('0x3b')]);return db[_0xa1ea('0x3c')]['find'](_0x5bc0d3)['then'](handleEntityNotFound(_0x25916b,null))[_0xa1ea('0x21')](respondWithResult(_0x25916b,null))[_0xa1ea('0x41')](handleError(_0x25916b,null));};exports[_0xa1ea('0x44')]=function(_0x430ebf,_0xab71b0){return db[_0xa1ea('0x3c')][_0xa1ea('0x44')](_0x430ebf[_0xa1ea('0x45')],{})[_0xa1ea('0x21')](respondWithResult(_0xab71b0,0xc9))[_0xa1ea('0x41')](handleError(_0xab71b0,null));};exports[_0xa1ea('0x46')]=function(_0x531364,_0x2f294d){if(_0x531364[_0xa1ea('0x45')]['id']){delete _0x531364[_0xa1ea('0x45')]['id'];}return db[_0xa1ea('0x3c')][_0xa1ea('0x47')]({'where':{'id':_0x531364[_0xa1ea('0x48')]['id']}})['then'](handleEntityNotFound(_0x2f294d,null))['then'](saveUpdates(_0x531364[_0xa1ea('0x45')],null))['then'](respondWithResult(_0x2f294d,null))['catch'](handleError(_0x2f294d,null));};exports[_0xa1ea('0x22')]=function(_0x73e6f6,_0x260e4b){return db[_0xa1ea('0x3c')]['find']({'where':{'id':_0x73e6f6['params']['id']}})[_0xa1ea('0x21')](handleEntityNotFound(_0x260e4b,null))[_0xa1ea('0x21')](removeEntity(_0x260e4b,null))[_0xa1ea('0x41')](handleError(_0x260e4b,null));};exports['getFields']=function(_0x592b32,_0x3f94f5,_0x2c826b){var _0x47d591={};var _0x133406={};var _0xafbe9e;var _0x2e5d21;return db['FreshdeskConfiguration'][_0xa1ea('0x49')]({'where':{'id':_0x592b32[_0xa1ea('0x48')]['id']}})[_0xa1ea('0x21')](handleEntityNotFound(_0x3f94f5,null))['then'](function(_0x120868){if(_0x120868){_0xafbe9e=_0x120868;_0x133406[_0xa1ea('0x2b')]=_['keys'](db[_0xa1ea('0x4a')]['rawAttributes']);_0x133406[_0xa1ea('0x2e')]=_[_0xa1ea('0x43')](_0x592b32[_0xa1ea('0x2e')]);_0x133406[_0xa1ea('0x2c')]=_['intersection'](_0x133406[_0xa1ea('0x2b')],_0x133406['query']);_0x47d591[_0xa1ea('0x2f')]=_['intersection'](_0x133406[_0xa1ea('0x2b')],qs[_0xa1ea('0x30')](_0x592b32['query'][_0xa1ea('0x30')]));_0x47d591['attributes']=_0x47d591['attributes'][_0xa1ea('0x31')]?_0x47d591[_0xa1ea('0x2f')]:_0x133406[_0xa1ea('0x2b')];_0x47d591['order']=qs[_0xa1ea('0x35')](_0x592b32[_0xa1ea('0x2e')]['sort']);_0x47d591[_0xa1ea('0x36')]=qs['filters'](_['pick'](_0x592b32[_0xa1ea('0x2e')],_0x133406[_0xa1ea('0x2c')]));if(_0x592b32[_0xa1ea('0x2e')]['filter']){_0x47d591[_0xa1ea('0x36')]=_[_0xa1ea('0x38')](_0x47d591['where'],{'$or':_[_0xa1ea('0x4b')](_0x47d591[_0xa1ea('0x2f')],function(_0x362dc4){var _0x226c78={};_0x226c78[_0x362dc4]={'$like':'%'+_0x592b32[_0xa1ea('0x2e')][_0xa1ea('0x3a')]+'%'};return _0x226c78;})});}_0x47d591=_[_0xa1ea('0x38')]({},_0x47d591,_0x592b32[_0xa1ea('0x3b')]);return _0xafbe9e[_0xa1ea('0x4c')](_0x47d591);}})[_0xa1ea('0x21')](function(_0x1766d9){if(_0x1766d9){_0x2e5d21=_0x1766d9[_0xa1ea('0x31')];if(!_0x592b32['query'][_0xa1ea('0x32')]('nolimit')){_0x47d591[_0xa1ea('0x1d')]=qs[_0xa1ea('0x1d')](_0x592b32[_0xa1ea('0x2e')][_0xa1ea('0x1d')]);_0x47d591[_0xa1ea('0x1b')]=qs['offset'](_0x592b32[_0xa1ea('0x2e')]['offset']);}return _0xafbe9e['getFields'](_0x47d591);}})[_0xa1ea('0x21')](function(_0x372b6){if(_0x372b6){return _0x372b6?{'count':_0x2e5d21,'rows':_0x372b6}:null;}})[_0xa1ea('0x21')](respondWithResult(_0x3f94f5,null))[_0xa1ea('0x41')](handleError(_0x3f94f5,null));};exports[_0xa1ea('0x4d')]=function(_0x555116,_0x4c042d,_0x4d3288){var _0x25c642={};var _0x15f452={};var _0x2bc7d0;var _0x8abf3a;return db[_0xa1ea('0x3c')][_0xa1ea('0x49')]({'where':{'id':_0x555116[_0xa1ea('0x48')]['id']}})[_0xa1ea('0x21')](handleEntityNotFound(_0x4c042d,null))['then'](function(_0x264339){if(_0x264339){_0x2bc7d0=_0x264339;_0x15f452[_0xa1ea('0x2b')]=_[_0xa1ea('0x43')](db['FreshdeskField']['rawAttributes']);_0x15f452[_0xa1ea('0x2e')]=_[_0xa1ea('0x43')](_0x555116[_0xa1ea('0x2e')]);_0x15f452['filters']=_[_0xa1ea('0x2d')](_0x15f452[_0xa1ea('0x2b')],_0x15f452[_0xa1ea('0x2e')]);_0x25c642[_0xa1ea('0x2f')]=_[_0xa1ea('0x2d')](_0x15f452[_0xa1ea('0x2b')],qs[_0xa1ea('0x30')](_0x555116['query'][_0xa1ea('0x30')]));_0x25c642[_0xa1ea('0x2f')]=_0x25c642[_0xa1ea('0x2f')][_0xa1ea('0x31')]?_0x25c642[_0xa1ea('0x2f')]:_0x15f452[_0xa1ea('0x2b')];_0x25c642['order']=qs[_0xa1ea('0x35')](_0x555116[_0xa1ea('0x2e')]['sort']);_0x25c642[_0xa1ea('0x36')]=qs[_0xa1ea('0x2c')](_[_0xa1ea('0x37')](_0x555116[_0xa1ea('0x2e')],_0x15f452['filters']));if(_0x555116[_0xa1ea('0x2e')][_0xa1ea('0x3a')]){_0x25c642[_0xa1ea('0x36')]=_['merge'](_0x25c642[_0xa1ea('0x36')],{'$or':_[_0xa1ea('0x4b')](_0x25c642[_0xa1ea('0x2f')],function(_0x4de8c3){var _0x4426f5={};_0x4426f5[_0x4de8c3]={'$like':'%'+_0x555116[_0xa1ea('0x2e')]['filter']+'%'};return _0x4426f5;})});}_0x25c642=_['merge']({},_0x25c642,_0x555116[_0xa1ea('0x3b')]);return _0x2bc7d0[_0xa1ea('0x4d')](_0x25c642);}})['then'](function(_0x249497){if(_0x249497){_0x8abf3a=_0x249497['length'];if(!_0x555116[_0xa1ea('0x2e')][_0xa1ea('0x32')](_0xa1ea('0x33'))){_0x25c642[_0xa1ea('0x1d')]=qs[_0xa1ea('0x1d')](_0x555116['query'][_0xa1ea('0x1d')]);_0x25c642['offset']=qs[_0xa1ea('0x1b')](_0x555116[_0xa1ea('0x2e')][_0xa1ea('0x1b')]);}return _0x2bc7d0[_0xa1ea('0x4d')](_0x25c642);}})['then'](function(_0x12b350){if(_0x12b350){return _0x12b350?{'count':_0x8abf3a,'rows':_0x12b350}:null;}})[_0xa1ea('0x21')](respondWithResult(_0x4c042d,null))[_0xa1ea('0x41')](handleError(_0x4c042d,null));};exports[_0xa1ea('0x4e')]=function(_0x3f085c,_0x21c69e,_0x2eab3f){var _0x49d566={};var _0x226749={};var _0x2654b9;var _0x4f703c;return db[_0xa1ea('0x3c')][_0xa1ea('0x49')]({'where':{'id':_0x3f085c[_0xa1ea('0x48')]['id']}})[_0xa1ea('0x21')](handleEntityNotFound(_0x21c69e,null))[_0xa1ea('0x21')](function(_0x2aa7ec){if(_0x2aa7ec){_0x2654b9=_0x2aa7ec;_0x226749['model']=_[_0xa1ea('0x43')](db['FreshdeskField'][_0xa1ea('0x27')]);_0x226749[_0xa1ea('0x2e')]=_['keys'](_0x3f085c[_0xa1ea('0x2e')]);_0x226749[_0xa1ea('0x2c')]=_[_0xa1ea('0x2d')](_0x226749[_0xa1ea('0x2b')],_0x226749['query']);_0x49d566['attributes']=_[_0xa1ea('0x2d')](_0x226749[_0xa1ea('0x2b')],qs['fields'](_0x3f085c[_0xa1ea('0x2e')][_0xa1ea('0x30')]));_0x49d566[_0xa1ea('0x2f')]=_0x49d566[_0xa1ea('0x2f')][_0xa1ea('0x31')]?_0x49d566['attributes']:_0x226749[_0xa1ea('0x2b')];_0x49d566[_0xa1ea('0x34')]=qs[_0xa1ea('0x35')](_0x3f085c['query'][_0xa1ea('0x35')]);_0x49d566[_0xa1ea('0x36')]=qs['filters'](_['pick'](_0x3f085c[_0xa1ea('0x2e')],_0x226749[_0xa1ea('0x2c')]));if(_0x3f085c[_0xa1ea('0x2e')][_0xa1ea('0x3a')]){_0x49d566[_0xa1ea('0x36')]=_[_0xa1ea('0x38')](_0x49d566[_0xa1ea('0x36')],{'$or':_['map'](_0x49d566[_0xa1ea('0x2f')],function(_0x3ab716){var _0x24c03d={};_0x24c03d[_0x3ab716]={'$like':'%'+_0x3f085c[_0xa1ea('0x2e')][_0xa1ea('0x3a')]+'%'};return _0x24c03d;})});}_0x49d566=_[_0xa1ea('0x38')]({},_0x49d566,_0x3f085c[_0xa1ea('0x3b')]);return _0x2654b9['getDescriptions'](_0x49d566);}})[_0xa1ea('0x21')](function(_0x5ed1a5){if(_0x5ed1a5){_0x4f703c=_0x5ed1a5['length'];if(!_0x3f085c[_0xa1ea('0x2e')][_0xa1ea('0x32')](_0xa1ea('0x33'))){_0x49d566['limit']=qs[_0xa1ea('0x1d')](_0x3f085c[_0xa1ea('0x2e')]['limit']);_0x49d566['offset']=qs[_0xa1ea('0x1b')](_0x3f085c[_0xa1ea('0x2e')][_0xa1ea('0x1b')]);}return _0x2654b9[_0xa1ea('0x4e')](_0x49d566);}})[_0xa1ea('0x21')](function(_0xb0cf6){if(_0xb0cf6){return _0xb0cf6?{'count':_0x4f703c,'rows':_0xb0cf6}:null;}})['then'](respondWithResult(_0x21c69e,null))[_0xa1ea('0x41')](handleError(_0x21c69e,null));};exports[_0xa1ea('0x4f')]=function(_0xf5256d,_0xa442cd,_0x27133b){var _0x40834b={};var _0x3a464e={};var _0x4361ac;var _0x3b2c9a;return db[_0xa1ea('0x3c')][_0xa1ea('0x49')]({'where':{'id':_0xf5256d[_0xa1ea('0x48')]['id']}})['then'](handleEntityNotFound(_0xa442cd,null))[_0xa1ea('0x21')](function(_0x375200){if(_0x375200){_0x4361ac=_0x375200;_0x3a464e[_0xa1ea('0x2b')]=_[_0xa1ea('0x43')](db['Tag'][_0xa1ea('0x27')]);_0x3a464e['query']=_[_0xa1ea('0x43')](_0xf5256d['query']);_0x3a464e[_0xa1ea('0x2c')]=_['intersection'](_0x3a464e[_0xa1ea('0x2b')],_0x3a464e[_0xa1ea('0x2e')]);_0x40834b[_0xa1ea('0x2f')]=_[_0xa1ea('0x2d')](_0x3a464e['model'],qs[_0xa1ea('0x30')](_0xf5256d[_0xa1ea('0x2e')][_0xa1ea('0x30')]));_0x40834b[_0xa1ea('0x2f')]=_0x40834b[_0xa1ea('0x2f')][_0xa1ea('0x31')]?_0x40834b[_0xa1ea('0x2f')]:_0x3a464e['model'];_0x40834b[_0xa1ea('0x34')]=qs[_0xa1ea('0x35')](_0xf5256d['query'][_0xa1ea('0x35')]);_0x40834b[_0xa1ea('0x36')]=qs[_0xa1ea('0x2c')](_['pick'](_0xf5256d[_0xa1ea('0x2e')],_0x3a464e[_0xa1ea('0x2c')]));if(_0xf5256d[_0xa1ea('0x2e')][_0xa1ea('0x3a')]){_0x40834b[_0xa1ea('0x36')]=_['merge'](_0x40834b[_0xa1ea('0x36')],{'$or':_[_0xa1ea('0x4b')](_0x40834b[_0xa1ea('0x2f')],function(_0x195ca1){var _0x215eea={};_0x215eea[_0x195ca1]={'$like':'%'+_0xf5256d[_0xa1ea('0x2e')][_0xa1ea('0x3a')]+'%'};return _0x215eea;})});}_0x40834b=_[_0xa1ea('0x38')]({},_0x40834b,_0xf5256d['options']);return _0x4361ac[_0xa1ea('0x4f')](_0x40834b);}})[_0xa1ea('0x21')](function(_0x583969){if(_0x583969){_0x3b2c9a=_0x583969[_0xa1ea('0x31')];if(!_0xf5256d[_0xa1ea('0x2e')][_0xa1ea('0x32')](_0xa1ea('0x33'))){_0x40834b[_0xa1ea('0x1d')]=qs[_0xa1ea('0x1d')](_0xf5256d[_0xa1ea('0x2e')]['limit']);_0x40834b[_0xa1ea('0x1b')]=qs[_0xa1ea('0x1b')](_0xf5256d[_0xa1ea('0x2e')]['offset']);}return _0x4361ac[_0xa1ea('0x4f')](_0x40834b);}})[_0xa1ea('0x21')](function(_0xbb7915){if(_0xbb7915){return _0xbb7915?{'count':_0x3b2c9a,'rows':_0xbb7915}:null;}})[_0xa1ea('0x21')](respondWithResult(_0xa442cd,null))[_0xa1ea('0x41')](handleError(_0xa442cd,null));};exports[_0xa1ea('0x50')]=function(_0x3621b8,_0x58f571,_0x2a89c0){if(_0x3621b8[_0xa1ea('0x45')]['id']){delete _0x3621b8['body']['id'];}return db[_0xa1ea('0x3c')][_0xa1ea('0x49')]({'where':{'id':_0x3621b8[_0xa1ea('0x48')]['id']}})['then'](handleEntityNotFound(_0x58f571,null))['then'](function(_0x20d17c){if(_0x20d17c){return _0x20d17c[_0xa1ea('0x50')](_0x3621b8[_0xa1ea('0x45')][_0xa1ea('0x51')]||[]);}return null;})[_0xa1ea('0x21')](respondWithResult(_0x58f571,null))[_0xa1ea('0x41')](handleError(_0x58f571,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index f5992ab..251b4a1 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 _0x4dc3=['rimraf','exports','define','FreshdeskConfiguration','int_freshdesk_configurations','lodash','api','moment','bluebird','request-promise','path'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x4dc3,0x1a7));var _0x34dc=function(_0x3df223,_0x1740fc){_0x3df223=_0x3df223-0x0;var _0x562d11=_0x4dc3[_0x3df223];return _0x562d11;};'use strict';var _=require(_0x34dc('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x34dc('0x1'));var moment=require(_0x34dc('0x2'));var BPromise=require(_0x34dc('0x3'));var rp=require(_0x34dc('0x4'));var fs=require('fs');var path=require(_0x34dc('0x5'));var rimraf=require(_0x34dc('0x6'));var config=require('../../config/environment');var attributes=require('./intFreshdeskConfiguration.attributes');module[_0x34dc('0x7')]=function(_0x2336a5,_0x183824){return _0x2336a5[_0x34dc('0x8')](_0x34dc('0x9'),attributes,{'tableName':_0x34dc('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x375d=['lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','define','FreshdeskConfiguration'];(function(_0x51821c,_0x2e39c5){var _0x20bde8=function(_0x2d307a){while(--_0x2d307a){_0x51821c['push'](_0x51821c['shift']());}};_0x20bde8(++_0x2e39c5);}(_0x375d,0x134));var _0xd375=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x375d[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xd375('0x0'));var util=require(_0xd375('0x1'));var logger=require(_0xd375('0x2'))(_0xd375('0x3'));var moment=require('moment');var BPromise=require(_0xd375('0x4'));var rp=require(_0xd375('0x5'));var fs=require('fs');var path=require(_0xd375('0x6'));var rimraf=require(_0xd375('0x7'));var config=require(_0xd375('0x8'));var attributes=require('./intFreshdeskConfiguration.attributes');module['exports']=function(_0xcac04,_0x41641b){return _0xcac04[_0xd375('0x9')](_0xd375('0xa'),attributes,{'tableName':'int_freshdesk_configurations','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 5630469..abe841e 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 _0x93ab=['rpc','../../config/environment','jayson/promise','client','http','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x394aa8,_0x3dca8a){var _0x46850f=function(_0x3110f2){while(--_0x3110f2){_0x394aa8['push'](_0x394aa8['shift']());}};_0x46850f(++_0x3dca8a);}(_0x93ab,0xc7));var _0xb93a=function(_0x3a99f4,_0x2a81c1){_0x3a99f4=_0x3a99f4-0x0;var _0xea0b42=_0x93ab[_0x3a99f4];return _0xea0b42;};'use strict';var _=require(_0xb93a('0x0'));var util=require(_0xb93a('0x1'));var moment=require(_0xb93a('0x2'));var BPromise=require(_0xb93a('0x3'));var rs=require(_0xb93a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb93a('0x5'))['db'];var utils=require(_0xb93a('0x6'));var logger=require(_0xb93a('0x7'))(_0xb93a('0x8'));var config=require(_0xb93a('0x9'));var jayson=require(_0xb93a('0xa'));var client=jayson[_0xb93a('0xb')][_0xb93a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x393854,_0x58cfcc,_0x280bfa){return new BPromise(function(_0x51f16b,_0x2b83a5){return client['request'](_0x393854,_0x280bfa)[_0xb93a('0xd')](function(_0x5123d4){logger[_0xb93a('0xe')](_0xb93a('0xf'),_0x58cfcc,_0xb93a('0x10'));logger[_0xb93a('0x11')](_0xb93a('0x12'),_0x58cfcc,'request\x20sent',JSON['stringify'](_0x5123d4));if(_0x5123d4[_0xb93a('0x13')]){if(_0x5123d4[_0xb93a('0x13')][_0xb93a('0x14')]===0x1f4){logger[_0xb93a('0x13')](_0xb93a('0xf'),_0x58cfcc,_0x5123d4['error']['message']);return _0x2b83a5(_0x5123d4['error'][_0xb93a('0x15')]);}logger[_0xb93a('0x13')](_0xb93a('0xf'),_0x58cfcc,_0x5123d4[_0xb93a('0x13')][_0xb93a('0x15')]);return _0x51f16b(_0x5123d4[_0xb93a('0x13')][_0xb93a('0x15')]);}else{logger[_0xb93a('0xe')](_0xb93a('0xf'),_0x58cfcc,_0xb93a('0x10'));_0x51f16b(_0x5123d4['result'][_0xb93a('0x15')]);}})[_0xb93a('0x16')](function(_0x418147){logger['error'](_0xb93a('0xf'),_0x58cfcc,_0x418147);_0x2b83a5(_0x418147);});});} \ No newline at end of file +var _0x4217=['lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','http','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x386b1d,_0x1a4de0){var _0x34beeb=function(_0x239bd4){while(--_0x239bd4){_0x386b1d['push'](_0x386b1d['shift']());}};_0x34beeb(++_0x1a4de0);}(_0x4217,0xdc));var _0x7421=function(_0x12eca4,_0x48e265){_0x12eca4=_0x12eca4-0x0;var _0x2c9fcd=_0x4217[_0x12eca4];return _0x2c9fcd;};'use strict';var _=require(_0x7421('0x0'));var util=require(_0x7421('0x1'));var moment=require('moment');var BPromise=require(_0x7421('0x2'));var rs=require(_0x7421('0x3'));var fs=require('fs');var Redis=require(_0x7421('0x4'));var db=require(_0x7421('0x5'))['db'];var utils=require(_0x7421('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x7421('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7421('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x25f4b0,_0x7e2073,_0x56eba4){return new BPromise(function(_0x194de5,_0x1cdc1e){return client[_0x7421('0x9')](_0x25f4b0,_0x56eba4)[_0x7421('0xa')](function(_0x455c38){logger[_0x7421('0xb')](_0x7421('0xc'),_0x7e2073,_0x7421('0xd'));logger[_0x7421('0xe')](_0x7421('0xf'),_0x7e2073,_0x7421('0xd'),JSON[_0x7421('0x10')](_0x455c38));if(_0x455c38[_0x7421('0x11')]){if(_0x455c38[_0x7421('0x11')][_0x7421('0x12')]===0x1f4){logger[_0x7421('0x11')](_0x7421('0xc'),_0x7e2073,_0x455c38[_0x7421('0x11')]['message']);return _0x1cdc1e(_0x455c38[_0x7421('0x11')][_0x7421('0x13')]);}logger[_0x7421('0x11')](_0x7421('0xc'),_0x7e2073,_0x455c38[_0x7421('0x11')][_0x7421('0x13')]);return _0x194de5(_0x455c38[_0x7421('0x11')][_0x7421('0x13')]);}else{logger['info']('FreshdeskConfiguration,\x20%s,\x20%s',_0x7e2073,_0x7421('0xd'));_0x194de5(_0x455c38[_0x7421('0x14')][_0x7421('0x13')]);}})[_0x7421('0x15')](function(_0x414c0f){logger['error'](_0x7421('0xc'),_0x7e2073,_0x414c0f);_0x1cdc1e(_0x414c0f);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 6e2b1ea..057c9ae 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 _0xced2=['../../components/auth/service','get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','multer','util','connect-timeout','fs-extra'];(function(_0x2441b2,_0x55e94f){var _0x24ca0f=function(_0x4de21a){while(--_0x4de21a){_0x2441b2['push'](_0x2441b2['shift']());}};_0x24ca0f(++_0x55e94f);}(_0xced2,0xb0));var _0x2ced=function(_0x2af209,_0x21a41b){_0x2af209=_0x2af209-0x0;var _0x4e126e=_0xced2[_0x2af209];return _0x4e126e;};'use strict';var multer=require(_0x2ced('0x0'));var util=require(_0x2ced('0x1'));var path=require('path');var timeout=require(_0x2ced('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x2ced('0x3'));var auth=require(_0x2ced('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intFreshdeskField.controller');router[_0x2ced('0x5')]('/',auth[_0x2ced('0x6')](),controller['index']);router[_0x2ced('0x5')](_0x2ced('0x7'),auth[_0x2ced('0x6')](),controller[_0x2ced('0x8')]);router[_0x2ced('0x9')]('/',auth[_0x2ced('0x6')](),controller[_0x2ced('0xa')]);router[_0x2ced('0xb')](_0x2ced('0x7'),auth[_0x2ced('0x6')](),controller[_0x2ced('0xc')]);router[_0x2ced('0xd')]('/:id',auth[_0x2ced('0x6')](),controller[_0x2ced('0xe')]);module['exports']=router; \ No newline at end of file +var _0x8659=['util','connect-timeout','express','Router','fs-extra','../../components/auth/service','./intFreshdeskField.controller','get','isAuthenticated','index','/:id','show','post','create','update','delete','exports','multer'];(function(_0x343961,_0x2ada6f){var _0x5340f5=function(_0x4b2137){while(--_0x4b2137){_0x343961['push'](_0x343961['shift']());}};_0x5340f5(++_0x2ada6f);}(_0x8659,0x7d));var _0x9865=function(_0x34e716,_0x480ae1){_0x34e716=_0x34e716-0x0;var _0x303854=_0x8659[_0x34e716];return _0x303854;};'use strict';var multer=require(_0x9865('0x0'));var util=require(_0x9865('0x1'));var path=require('path');var timeout=require(_0x9865('0x2'));var express=require(_0x9865('0x3'));var router=express[_0x9865('0x4')]();var fs_extra=require(_0x9865('0x5'));var auth=require(_0x9865('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x9865('0x7'));router[_0x9865('0x8')]('/',auth[_0x9865('0x9')](),controller[_0x9865('0xa')]);router[_0x9865('0x8')](_0x9865('0xb'),auth[_0x9865('0x9')](),controller[_0x9865('0xc')]);router[_0x9865('0xd')]('/',auth['isAuthenticated'](),controller[_0x9865('0xe')]);router['put']('/:id',auth[_0x9865('0x9')](),controller[_0x9865('0xf')]);router[_0x9865('0x10')](_0x9865('0xb'),auth[_0x9865('0x9')](),controller['destroy']);module[_0x9865('0x11')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index 2266796..efb0235 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 _0x918f=['BOOLEAN','sequelize','exports','string','variable','keyValue','picklist','STRING','ENUM'];(function(_0x43874f,_0x495366){var _0x28eef8=function(_0x439c6a){while(--_0x439c6a){_0x43874f['push'](_0x43874f['shift']());}};_0x28eef8(++_0x495366);}(_0x918f,0x17b));var _0xf918=function(_0x585ee5,_0x1c9dba){_0x585ee5=_0x585ee5-0x0;var _0x470808=_0x918f[_0x585ee5];return _0x470808;};'use strict';var Sequelize=require(_0xf918('0x0'));module[_0xf918('0x1')]={'type':{'type':Sequelize['ENUM'](_0xf918('0x2'),_0xf918('0x3'),'customVariable',_0xf918('0x4'),_0xf918('0x5')),'defaultValue':_0xf918('0x2')},'content':{'type':Sequelize[_0xf918('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xf918('0x7')](_0xf918('0x2'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0xf918('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xf918('0x6')]},'customField':{'type':Sequelize[_0xf918('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x90f5=['STRING','ENUM','BOOLEAN','sequelize','string','variable','customVariable','keyValue','picklist'];(function(_0x1cb642,_0x3479a4){var _0x4df4b5=function(_0x4bbb2b){while(--_0x4bbb2b){_0x1cb642['push'](_0x1cb642['shift']());}};_0x4df4b5(++_0x3479a4);}(_0x90f5,0x1e9));var _0x590f=function(_0x32d565,_0x14910d){_0x32d565=_0x32d565-0x0;var _0x3f2942=_0x90f5[_0x32d565];return _0x3f2942;};'use strict';var Sequelize=require(_0x590f('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0x590f('0x1'),_0x590f('0x2'),_0x590f('0x3'),_0x590f('0x4'),_0x590f('0x5')),'defaultValue':_0x590f('0x1')},'content':{'type':Sequelize[_0x590f('0x6')]},'key':{'type':Sequelize[_0x590f('0x6')]},'keyType':{'type':Sequelize[_0x590f('0x7')](_0x590f('0x1'),_0x590f('0x2'),'customVariable')},'keyContent':{'type':Sequelize[_0x590f('0x6')]},'idField':{'type':Sequelize[_0x590f('0x6')]},'nameField':{'type':Sequelize[_0x590f('0x6')]},'customField':{'type':Sequelize[_0x590f('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 6be9ac9..d9913ad 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 _0x4227=['bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','apply','save','update','then','sendStatus','stack','name','index','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','filter','merge','options','FreshdeskField','includeAll','include','findAll','rows','show','params','length','find','catch','create','body','eml-format','fast-json-patch','moment'];(function(_0x170a33,_0x22cd64){var _0x3d5687=function(_0x4f7299){while(--_0x4f7299){_0x170a33['push'](_0x170a33['shift']());}};_0x3d5687(++_0x22cd64);}(_0x4227,0x89));var _0x7422=function(_0x5ca065,_0x2d2a06){_0x5ca065=_0x5ca065-0x0;var _0x233401=_0x4227[_0x5ca065];return _0x233401;};'use strict';var emlformat=require(_0x7422('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x7422('0x1'));var rp=require('request-promise');var moment=require(_0x7422('0x2'));var BPromise=require(_0x7422('0x3'));var Mustache=require(_0x7422('0x4'));var util=require('util');var path=require(_0x7422('0x5'));var sox=require(_0x7422('0x6'));var csv=require(_0x7422('0x7'));var ejs=require(_0x7422('0x8'));var fs=require('fs');var fs_extra=require(_0x7422('0x9'));var _=require(_0x7422('0xa'));var squel=require(_0x7422('0xb'));var crypto=require(_0x7422('0xc'));var jsforce=require(_0x7422('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x7422('0x7'));var querystring=require(_0x7422('0xe'));var Papa=require(_0x7422('0xf'));var Redis=require('ioredis');var authService=require(_0x7422('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x7422('0x11'));var hardwareService=require(_0x7422('0x12'));var logger=require(_0x7422('0x13'))(_0x7422('0x14'));var utils=require(_0x7422('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x7422('0x16'));var db=require(_0x7422('0x17'))['db'];function respondWithStatusCode(_0x575c47,_0xb06dc6){_0xb06dc6=_0xb06dc6||0xcc;return function(_0x2acd6c){if(_0x2acd6c){return _0x575c47['sendStatus'](_0xb06dc6);}return _0x575c47[_0x7422('0x18')](_0xb06dc6)[_0x7422('0x19')]();};}function respondWithResult(_0x555082,_0x4d3f91){_0x4d3f91=_0x4d3f91||0xc8;return function(_0xeafd58){if(_0xeafd58){return _0x555082['status'](_0x4d3f91)[_0x7422('0x1a')](_0xeafd58);}};}function respondWithFilteredResult(_0x788829,_0x487c93){return function(_0x149c50){if(_0x149c50){var _0x39c31c=typeof _0x487c93[_0x7422('0x1b')]===_0x7422('0x1c')&&typeof _0x487c93[_0x7422('0x1d')]===_0x7422('0x1c');var _0x4e2b60=_0x149c50[_0x7422('0x1e')];var _0xa7ff41=_0x39c31c?0x0:_0x487c93[_0x7422('0x1b')];var _0x30656d=_0x39c31c?_0x149c50['count']:_0x487c93[_0x7422('0x1b')]+_0x487c93['limit'];var _0x22a1c8;if(_0x30656d>=_0x4e2b60){_0x30656d=_0x4e2b60;_0x22a1c8=0xc8;}else{_0x22a1c8=0xce;}_0x788829[_0x7422('0x18')](_0x22a1c8);return _0x788829[_0x7422('0x1f')]('Content-Range',_0xa7ff41+'-'+_0x30656d+'/'+_0x4e2b60)[_0x7422('0x1a')](_0x149c50);}return null;};}function patchUpdates(_0xacaad1){return function(_0x368e96){try{jsonpatch[_0x7422('0x20')](_0x368e96,_0xacaad1,!![]);}catch(_0x55f98f){return BPromise['reject'](_0x55f98f);}return _0x368e96[_0x7422('0x21')]();};}function saveUpdates(_0x380ef7,_0x20c1e3){return function(_0x7d34f2){if(_0x7d34f2){return _0x7d34f2[_0x7422('0x22')](_0x380ef7)[_0x7422('0x23')](function(_0xe4f174){return _0xe4f174;});}return null;};}function removeEntity(_0x596b89,_0x24ce62){return function(_0x46b927){if(_0x46b927){return _0x46b927['destroy']()[_0x7422('0x23')](function(){_0x596b89[_0x7422('0x18')](0xcc)[_0x7422('0x19')]();});}};}function handleEntityNotFound(_0x3eeb9c,_0x5436a4){return function(_0x3f579a){if(!_0x3f579a){_0x3eeb9c[_0x7422('0x24')](0x194);}return _0x3f579a;};}function handleError(_0x3cdea0,_0x2dd10f){_0x2dd10f=_0x2dd10f||0x1f4;return function(_0x3438d1){logger['error'](_0x3438d1[_0x7422('0x25')]);if(_0x3438d1[_0x7422('0x26')]){delete _0x3438d1[_0x7422('0x26')];}_0x3cdea0[_0x7422('0x18')](_0x2dd10f)['send'](_0x3438d1);};}exports[_0x7422('0x27')]=function(_0x20f71e,_0x9b0144){var _0x702aef={},_0x59bc52={},_0x1cd623={'count':0x0,'rows':[]};var _0x41d4a1=_['map'](db['FreshdeskField'][_0x7422('0x28')],function(_0x2fb125){return{'name':_0x2fb125['fieldName'],'type':_0x2fb125[_0x7422('0x29')][_0x7422('0x2a')]};});_0x59bc52[_0x7422('0x2b')]=_[_0x7422('0x2c')](_0x41d4a1,_0x7422('0x26'));_0x59bc52[_0x7422('0x2d')]=_[_0x7422('0x2e')](_0x20f71e[_0x7422('0x2d')]);_0x59bc52[_0x7422('0x2f')]=_[_0x7422('0x30')](_0x59bc52[_0x7422('0x2b')],_0x59bc52['query']);_0x702aef[_0x7422('0x31')]=_[_0x7422('0x30')](_0x59bc52[_0x7422('0x2b')],qs[_0x7422('0x32')](_0x20f71e['query'][_0x7422('0x32')]));_0x702aef[_0x7422('0x31')]=_0x702aef[_0x7422('0x31')]['length']?_0x702aef['attributes']:_0x59bc52[_0x7422('0x2b')];if(!_0x20f71e['query'][_0x7422('0x33')]('nolimit')){_0x702aef[_0x7422('0x1d')]=qs['limit'](_0x20f71e[_0x7422('0x2d')]['limit']);_0x702aef['offset']=qs[_0x7422('0x1b')](_0x20f71e['query'][_0x7422('0x1b')]);}_0x702aef[_0x7422('0x34')]=qs[_0x7422('0x35')](_0x20f71e[_0x7422('0x2d')][_0x7422('0x35')]);_0x702aef[_0x7422('0x36')]=qs[_0x7422('0x2f')](_['pick'](_0x20f71e[_0x7422('0x2d')],_0x59bc52[_0x7422('0x2f')]),_0x41d4a1);if(_0x20f71e[_0x7422('0x2d')][_0x7422('0x37')]){_0x702aef[_0x7422('0x36')]=_['merge'](_0x702aef[_0x7422('0x36')],{'$or':_[_0x7422('0x2c')](_0x41d4a1,function(_0x5bfbf6){if(_0x5bfbf6[_0x7422('0x29')]!=='VIRTUAL'){var _0x47486b={};_0x47486b[_0x5bfbf6['name']]={'$like':'%'+_0x20f71e['query'][_0x7422('0x37')]+'%'};return _0x47486b;}})});}_0x702aef=_[_0x7422('0x38')]({},_0x702aef,_0x20f71e[_0x7422('0x39')]);var _0x57a500={'where':_0x702aef[_0x7422('0x36')]};return db[_0x7422('0x3a')]['count'](_0x57a500)[_0x7422('0x23')](function(_0x5df470){_0x1cd623[_0x7422('0x1e')]=_0x5df470;if(_0x20f71e[_0x7422('0x2d')][_0x7422('0x3b')]){_0x702aef[_0x7422('0x3c')]=[{'all':!![]}];}return db[_0x7422('0x3a')][_0x7422('0x3d')](_0x702aef);})[_0x7422('0x23')](function(_0x50b48f){_0x1cd623[_0x7422('0x3e')]=_0x50b48f;return _0x1cd623;})[_0x7422('0x23')](respondWithFilteredResult(_0x9b0144,_0x702aef))['catch'](handleError(_0x9b0144,null));};exports[_0x7422('0x3f')]=function(_0x98c659,_0x5719df){var _0xca1546={'raw':!![],'where':{'id':_0x98c659[_0x7422('0x40')]['id']}},_0x4e2cd4={};_0x4e2cd4['model']=_[_0x7422('0x2e')](db[_0x7422('0x3a')][_0x7422('0x28')]);_0x4e2cd4[_0x7422('0x2d')]=_[_0x7422('0x2e')](_0x98c659[_0x7422('0x2d')]);_0x4e2cd4[_0x7422('0x2f')]=_[_0x7422('0x30')](_0x4e2cd4[_0x7422('0x2b')],_0x4e2cd4[_0x7422('0x2d')]);_0xca1546['attributes']=_[_0x7422('0x30')](_0x4e2cd4['model'],qs['fields'](_0x98c659[_0x7422('0x2d')][_0x7422('0x32')]));_0xca1546['attributes']=_0xca1546[_0x7422('0x31')][_0x7422('0x41')]?_0xca1546[_0x7422('0x31')]:_0x4e2cd4[_0x7422('0x2b')];if(_0x98c659[_0x7422('0x2d')][_0x7422('0x3b')]){_0xca1546[_0x7422('0x3c')]=[{'all':!![]}];}_0xca1546=_['merge']({},_0xca1546,_0x98c659[_0x7422('0x39')]);return db[_0x7422('0x3a')][_0x7422('0x42')](_0xca1546)[_0x7422('0x23')](handleEntityNotFound(_0x5719df,null))['then'](respondWithResult(_0x5719df,null))[_0x7422('0x43')](handleError(_0x5719df,null));};exports[_0x7422('0x44')]=function(_0x41ce88,_0x4db98d){return db[_0x7422('0x3a')][_0x7422('0x44')](_0x41ce88['body'],{})['then'](respondWithResult(_0x4db98d,0xc9))['catch'](handleError(_0x4db98d,null));};exports[_0x7422('0x22')]=function(_0xbbc9ab,_0x5b4694){if(_0xbbc9ab[_0x7422('0x45')]['id']){delete _0xbbc9ab['body']['id'];}return db[_0x7422('0x3a')][_0x7422('0x42')]({'where':{'id':_0xbbc9ab[_0x7422('0x40')]['id']}})[_0x7422('0x23')](handleEntityNotFound(_0x5b4694,null))['then'](saveUpdates(_0xbbc9ab['body'],null))[_0x7422('0x23')](respondWithResult(_0x5b4694,null))[_0x7422('0x43')](handleError(_0x5b4694,null));};exports['destroy']=function(_0x121983,_0x2fbe91){return db['FreshdeskField'][_0x7422('0x42')]({'where':{'id':_0x121983[_0x7422('0x40')]['id']}})[_0x7422('0x23')](handleEntityNotFound(_0x2fbe91,null))[_0x7422('0x23')](removeEntity(_0x2fbe91,null))[_0x7422('0x43')](handleError(_0x2fbe91,null));}; \ No newline at end of file +var _0x74f0=['key','map','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','includeAll','findAll','rows','catch','show','find','create','body','params','rimraf','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','FreshdeskField','fieldName','type'];(function(_0x11df0e,_0x1721af){var _0x5d4b7b=function(_0x50db10){while(--_0x50db10){_0x11df0e['push'](_0x11df0e['shift']());}};_0x5d4b7b(++_0x1721af);}(_0x74f0,0xf3));var _0x074f=function(_0x53be66,_0x9ec3be){_0x53be66=_0x53be66-0x0;var _0x9e5520=_0x74f0[_0x53be66];return _0x9e5520;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x074f('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x074f('0x1'));var moment=require(_0x074f('0x2'));var BPromise=require(_0x074f('0x3'));var Mustache=require(_0x074f('0x4'));var util=require('util');var path=require('path');var sox=require(_0x074f('0x5'));var csv=require(_0x074f('0x6'));var ejs=require(_0x074f('0x7'));var fs=require('fs');var fs_extra=require(_0x074f('0x8'));var _=require(_0x074f('0x9'));var squel=require(_0x074f('0xa'));var crypto=require(_0x074f('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x074f('0xc'));var toCsv=require(_0x074f('0x6'));var querystring=require('querystring');var Papa=require(_0x074f('0xd'));var Redis=require(_0x074f('0xe'));var authService=require(_0x074f('0xf'));var qs=require(_0x074f('0x10'));var as=require(_0x074f('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x074f('0x12'));var utils=require(_0x074f('0x13'));var config=require(_0x074f('0x14'));var licenseUtil=require(_0x074f('0x15'));var db=require(_0x074f('0x16'))['db'];function respondWithStatusCode(_0x2416e0,_0x1d3304){_0x1d3304=_0x1d3304||0xcc;return function(_0x46cea0){if(_0x46cea0){return _0x2416e0[_0x074f('0x17')](_0x1d3304);}return _0x2416e0['status'](_0x1d3304)[_0x074f('0x18')]();};}function respondWithResult(_0x59f78a,_0x12ed92){_0x12ed92=_0x12ed92||0xc8;return function(_0x3bf07f){if(_0x3bf07f){return _0x59f78a[_0x074f('0x19')](_0x12ed92)[_0x074f('0x1a')](_0x3bf07f);}};}function respondWithFilteredResult(_0x2d7c55,_0x237960){return function(_0x7e19fe){if(_0x7e19fe){var _0x1edf9c=typeof _0x237960[_0x074f('0x1b')]===_0x074f('0x1c')&&typeof _0x237960[_0x074f('0x1d')]==='undefined';var _0x111e1f=_0x7e19fe[_0x074f('0x1e')];var _0x200e43=_0x1edf9c?0x0:_0x237960[_0x074f('0x1b')];var _0x315e7d=_0x1edf9c?_0x7e19fe[_0x074f('0x1e')]:_0x237960['offset']+_0x237960['limit'];var _0x1d241d;if(_0x315e7d>=_0x111e1f){_0x315e7d=_0x111e1f;_0x1d241d=0xc8;}else{_0x1d241d=0xce;}_0x2d7c55['status'](_0x1d241d);return _0x2d7c55['set'](_0x074f('0x1f'),_0x200e43+'-'+_0x315e7d+'/'+_0x111e1f)[_0x074f('0x1a')](_0x7e19fe);}return null;};}function patchUpdates(_0x1563f3){return function(_0x5feafd){try{jsonpatch[_0x074f('0x20')](_0x5feafd,_0x1563f3,!![]);}catch(_0x210221){return BPromise[_0x074f('0x21')](_0x210221);}return _0x5feafd[_0x074f('0x22')]();};}function saveUpdates(_0x1acf0a,_0x2c3b23){return function(_0x335170){if(_0x335170){return _0x335170[_0x074f('0x23')](_0x1acf0a)[_0x074f('0x24')](function(_0x2fc5b0){return _0x2fc5b0;});}return null;};}function removeEntity(_0x39e502,_0x1bd2c7){return function(_0xdfa2d8){if(_0xdfa2d8){return _0xdfa2d8[_0x074f('0x25')]()[_0x074f('0x24')](function(){_0x39e502[_0x074f('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4ee6ac,_0x4e35a3){return function(_0x1051ce){if(!_0x1051ce){_0x4ee6ac[_0x074f('0x17')](0x194);}return _0x1051ce;};}function handleError(_0x151977,_0x3eb67d){_0x3eb67d=_0x3eb67d||0x1f4;return function(_0x5aabea){logger[_0x074f('0x26')](_0x5aabea[_0x074f('0x27')]);if(_0x5aabea[_0x074f('0x28')]){delete _0x5aabea[_0x074f('0x28')];}_0x151977[_0x074f('0x19')](_0x3eb67d)[_0x074f('0x29')](_0x5aabea);};}exports['index']=function(_0x1bf574,_0x3246cf){var _0x2b98d7={},_0x53b76d={},_0x1ee652={'count':0x0,'rows':[]};var _0x5d6edd=_['map'](db[_0x074f('0x2a')]['rawAttributes'],function(_0x4aa96f){return{'name':_0x4aa96f[_0x074f('0x2b')],'type':_0x4aa96f[_0x074f('0x2c')][_0x074f('0x2d')]};});_0x53b76d['model']=_[_0x074f('0x2e')](_0x5d6edd,_0x074f('0x28'));_0x53b76d[_0x074f('0x2f')]=_['keys'](_0x1bf574[_0x074f('0x2f')]);_0x53b76d[_0x074f('0x30')]=_[_0x074f('0x31')](_0x53b76d[_0x074f('0x32')],_0x53b76d[_0x074f('0x2f')]);_0x2b98d7['attributes']=_[_0x074f('0x31')](_0x53b76d[_0x074f('0x32')],qs['fields'](_0x1bf574[_0x074f('0x2f')][_0x074f('0x33')]));_0x2b98d7[_0x074f('0x34')]=_0x2b98d7['attributes'][_0x074f('0x35')]?_0x2b98d7[_0x074f('0x34')]:_0x53b76d['model'];if(!_0x1bf574[_0x074f('0x2f')][_0x074f('0x36')](_0x074f('0x37'))){_0x2b98d7[_0x074f('0x1d')]=qs[_0x074f('0x1d')](_0x1bf574[_0x074f('0x2f')][_0x074f('0x1d')]);_0x2b98d7[_0x074f('0x1b')]=qs[_0x074f('0x1b')](_0x1bf574[_0x074f('0x2f')]['offset']);}_0x2b98d7[_0x074f('0x38')]=qs[_0x074f('0x39')](_0x1bf574['query'][_0x074f('0x39')]);_0x2b98d7[_0x074f('0x3a')]=qs[_0x074f('0x30')](_[_0x074f('0x3b')](_0x1bf574[_0x074f('0x2f')],_0x53b76d[_0x074f('0x30')]),_0x5d6edd);if(_0x1bf574[_0x074f('0x2f')]['filter']){_0x2b98d7[_0x074f('0x3a')]=_[_0x074f('0x3c')](_0x2b98d7[_0x074f('0x3a')],{'$or':_[_0x074f('0x2e')](_0x5d6edd,function(_0x363ec0){if(_0x363ec0[_0x074f('0x2c')]!=='VIRTUAL'){var _0x405f4c={};_0x405f4c[_0x363ec0[_0x074f('0x28')]]={'$like':'%'+_0x1bf574['query'][_0x074f('0x3d')]+'%'};return _0x405f4c;}})});}_0x2b98d7=_[_0x074f('0x3c')]({},_0x2b98d7,_0x1bf574[_0x074f('0x3e')]);var _0x4d386e={'where':_0x2b98d7['where']};return db['FreshdeskField'][_0x074f('0x1e')](_0x4d386e)[_0x074f('0x24')](function(_0xdd9c2e){_0x1ee652['count']=_0xdd9c2e;if(_0x1bf574[_0x074f('0x2f')][_0x074f('0x3f')]){_0x2b98d7['include']=[{'all':!![]}];}return db[_0x074f('0x2a')][_0x074f('0x40')](_0x2b98d7);})[_0x074f('0x24')](function(_0x46ca91){_0x1ee652[_0x074f('0x41')]=_0x46ca91;return _0x1ee652;})[_0x074f('0x24')](respondWithFilteredResult(_0x3246cf,_0x2b98d7))[_0x074f('0x42')](handleError(_0x3246cf,null));};exports[_0x074f('0x43')]=function(_0x4b7f50,_0x406d33){var _0x58ff4d={'raw':!![],'where':{'id':_0x4b7f50['params']['id']}},_0x1bee97={};_0x1bee97[_0x074f('0x32')]=_['keys'](db[_0x074f('0x2a')]['rawAttributes']);_0x1bee97[_0x074f('0x2f')]=_['keys'](_0x4b7f50[_0x074f('0x2f')]);_0x1bee97[_0x074f('0x30')]=_[_0x074f('0x31')](_0x1bee97[_0x074f('0x32')],_0x1bee97[_0x074f('0x2f')]);_0x58ff4d[_0x074f('0x34')]=_[_0x074f('0x31')](_0x1bee97['model'],qs[_0x074f('0x33')](_0x4b7f50[_0x074f('0x2f')][_0x074f('0x33')]));_0x58ff4d[_0x074f('0x34')]=_0x58ff4d['attributes'][_0x074f('0x35')]?_0x58ff4d['attributes']:_0x1bee97[_0x074f('0x32')];if(_0x4b7f50[_0x074f('0x2f')][_0x074f('0x3f')]){_0x58ff4d['include']=[{'all':!![]}];}_0x58ff4d=_[_0x074f('0x3c')]({},_0x58ff4d,_0x4b7f50['options']);return db[_0x074f('0x2a')][_0x074f('0x44')](_0x58ff4d)['then'](handleEntityNotFound(_0x406d33,null))[_0x074f('0x24')](respondWithResult(_0x406d33,null))['catch'](handleError(_0x406d33,null));};exports[_0x074f('0x45')]=function(_0x130448,_0x598fee){return db['FreshdeskField']['create'](_0x130448['body'],{})[_0x074f('0x24')](respondWithResult(_0x598fee,0xc9))[_0x074f('0x42')](handleError(_0x598fee,null));};exports[_0x074f('0x23')]=function(_0xdd3709,_0x53b1e5){if(_0xdd3709[_0x074f('0x46')]['id']){delete _0xdd3709[_0x074f('0x46')]['id'];}return db[_0x074f('0x2a')][_0x074f('0x44')]({'where':{'id':_0xdd3709[_0x074f('0x47')]['id']}})[_0x074f('0x24')](handleEntityNotFound(_0x53b1e5,null))[_0x074f('0x24')](saveUpdates(_0xdd3709[_0x074f('0x46')],null))['then'](respondWithResult(_0x53b1e5,null))[_0x074f('0x42')](handleError(_0x53b1e5,null));};exports[_0x074f('0x25')]=function(_0x2ff3ab,_0x306a17){return db['FreshdeskField'][_0x074f('0x44')]({'where':{'id':_0x2ff3ab[_0x074f('0x47')]['id']}})['then'](handleEntityNotFound(_0x306a17,null))['then'](removeEntity(_0x306a17,null))[_0x074f('0x42')](handleError(_0x306a17,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index c162463..433eb26 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 _0x303a=['lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intFreshdeskField.attributes','exports','define','FreshdeskField','FieldId'];(function(_0x409251,_0x40f525){var _0x216f47=function(_0x517895){while(--_0x517895){_0x409251['push'](_0x409251['shift']());}};_0x216f47(++_0x40f525);}(_0x303a,0x1a0));var _0xa303=function(_0x1ee35d,_0x56b6a8){_0x1ee35d=_0x1ee35d-0x0;var _0x1338d2=_0x303a[_0x1ee35d];return _0x1338d2;};'use strict';var _=require(_0xa303('0x0'));var util=require('util');var logger=require(_0xa303('0x1'))(_0xa303('0x2'));var moment=require(_0xa303('0x3'));var BPromise=require(_0xa303('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa303('0x5'));var rimraf=require(_0xa303('0x6'));var config=require(_0xa303('0x7'));var attributes=require(_0xa303('0x8'));module[_0xa303('0x9')]=function(_0x1c7ee9,_0x2bc3d7){return _0x1c7ee9[_0xa303('0xa')](_0xa303('0xb'),attributes,{'tableName':'int_freshdesk_fields','paranoid':![],'indexes':[{'name':'freshdesk_unique_index','fields':['idField',_0xa303('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x64b0=['util','../../config/logger','bluebird','request-promise','rimraf','../../config/environment','exports','define','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','FieldId','lodash'];(function(_0x530e35,_0x13a876){var _0x2f478e=function(_0x26cefe){while(--_0x26cefe){_0x530e35['push'](_0x530e35['shift']());}};_0x2f478e(++_0x13a876);}(_0x64b0,0x74));var _0x064b=function(_0x514cd2,_0x303dfd){_0x514cd2=_0x514cd2-0x0;var _0x4cae97=_0x64b0[_0x514cd2];return _0x4cae97;};'use strict';var _=require(_0x064b('0x0'));var util=require(_0x064b('0x1'));var logger=require(_0x064b('0x2'))('api');var moment=require('moment');var BPromise=require(_0x064b('0x3'));var rp=require(_0x064b('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x064b('0x5'));var config=require(_0x064b('0x6'));var attributes=require('./intFreshdeskField.attributes');module[_0x064b('0x7')]=function(_0xa895f8,_0x482d60){return _0xa895f8[_0x064b('0x8')](_0x064b('0x9'),attributes,{'tableName':_0x064b('0xa'),'paranoid':![],'indexes':[{'name':_0x064b('0xb'),'fields':['idField',_0x064b('0xc')],'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 00d0d7d..d77da21 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 _0xa7ae=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','FreshdeskField,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring'];(function(_0x3ae256,_0x5779dc){var _0x2ab0f3=function(_0x3edd6d){while(--_0x3edd6d){_0x3ae256['push'](_0x3ae256['shift']());}};_0x2ab0f3(++_0x5779dc);}(_0xa7ae,0x1f4));var _0xea7a=function(_0xd67cd7,_0x1814ee){_0xd67cd7=_0xd67cd7-0x0;var _0x17f3c2=_0xa7ae[_0xd67cd7];return _0x17f3c2;};'use strict';var _=require(_0xea7a('0x0'));var util=require('util');var moment=require(_0xea7a('0x1'));var BPromise=require(_0xea7a('0x2'));var rs=require(_0xea7a('0x3'));var fs=require('fs');var Redis=require(_0xea7a('0x4'));var db=require(_0xea7a('0x5'))['db'];var utils=require(_0xea7a('0x6'));var logger=require(_0xea7a('0x7'))(_0xea7a('0x8'));var config=require('../../config/environment');var jayson=require(_0xea7a('0x9'));var client=jayson['client'][_0xea7a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2aceaa,_0x28cfaf,_0x5a4fe1){return new BPromise(function(_0x30fb76,_0x21a58b){return client[_0xea7a('0xb')](_0x2aceaa,_0x5a4fe1)[_0xea7a('0xc')](function(_0x215ffd){logger[_0xea7a('0xd')](_0xea7a('0xe'),_0x28cfaf,_0xea7a('0xf'));logger['debug']('FreshdeskField,\x20%s,\x20%s,\x20%s',_0x28cfaf,_0xea7a('0xf'),JSON[_0xea7a('0x10')](_0x215ffd));if(_0x215ffd[_0xea7a('0x11')]){if(_0x215ffd[_0xea7a('0x11')]['code']===0x1f4){logger[_0xea7a('0x11')](_0xea7a('0xe'),_0x28cfaf,_0x215ffd[_0xea7a('0x11')][_0xea7a('0x12')]);return _0x21a58b(_0x215ffd['error'][_0xea7a('0x12')]);}logger[_0xea7a('0x11')]('FreshdeskField,\x20%s,\x20%s',_0x28cfaf,_0x215ffd['error']['message']);return _0x30fb76(_0x215ffd[_0xea7a('0x11')]['message']);}else{logger[_0xea7a('0xd')]('FreshdeskField,\x20%s,\x20%s',_0x28cfaf,_0xea7a('0xf'));_0x30fb76(_0x215ffd[_0xea7a('0x13')][_0xea7a('0x12')]);}})[_0xea7a('0x14')](function(_0x5c626){logger[_0xea7a('0x11')](_0xea7a('0xe'),_0x28cfaf,_0x5c626);_0x21a58b(_0x5c626);});});} \ No newline at end of file +var _0x97ba=['debug','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','bluebird','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','request','then','info','FreshdeskField,\x20%s,\x20%s','request\x20sent'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x97ba,0xc5));var _0xa97b=function(_0x4965a1,_0x7c2a91){_0x4965a1=_0x4965a1-0x0;var _0x2a0be2=_0x97ba[_0x4965a1];return _0x2a0be2;};'use strict';var _=require('lodash');var util=require(_0xa97b('0x0'));var moment=require('moment');var BPromise=require(_0xa97b('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa97b('0x2'));var db=require(_0xa97b('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xa97b('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0xa97b('0x5'));var client=jayson[_0xa97b('0x6')][_0xa97b('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x15b908,_0x181a09,_0x244415){return new BPromise(function(_0x385814,_0x44673b){return client[_0xa97b('0x8')](_0x15b908,_0x244415)[_0xa97b('0x9')](function(_0x3e4a16){logger[_0xa97b('0xa')](_0xa97b('0xb'),_0x181a09,_0xa97b('0xc'));logger[_0xa97b('0xd')](_0xa97b('0xe'),_0x181a09,_0xa97b('0xc'),JSON[_0xa97b('0xf')](_0x3e4a16));if(_0x3e4a16[_0xa97b('0x10')]){if(_0x3e4a16[_0xa97b('0x10')][_0xa97b('0x11')]===0x1f4){logger[_0xa97b('0x10')](_0xa97b('0xb'),_0x181a09,_0x3e4a16['error'][_0xa97b('0x12')]);return _0x44673b(_0x3e4a16['error']['message']);}logger[_0xa97b('0x10')](_0xa97b('0xb'),_0x181a09,_0x3e4a16[_0xa97b('0x10')][_0xa97b('0x12')]);return _0x385814(_0x3e4a16[_0xa97b('0x10')]['message']);}else{logger[_0xa97b('0xa')]('FreshdeskField,\x20%s,\x20%s',_0x181a09,'request\x20sent');_0x385814(_0x3e4a16[_0xa97b('0x13')][_0xa97b('0x12')]);}})[_0xa97b('0x14')](function(_0x26ec59){logger[_0xa97b('0x10')]('FreshdeskField,\x20%s,\x20%s',_0x181a09,_0x26ec59);_0x44673b(_0x26ec59);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index 7e4b699..81ef6bb 100644 --- a/server/api/intFreshsalesAccount/index.js +++ b/server/api/intFreshsalesAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa478=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','get','index','/:id','isAuthenticated','getConfigurations','getFields','post','/:id/configurations','update'];(function(_0x2e1589,_0x445f7c){var _0x5d0417=function(_0x198c0e){while(--_0x198c0e){_0x2e1589['push'](_0x2e1589['shift']());}};_0x5d0417(++_0x445f7c);}(_0xa478,0x136));var _0x8a47=function(_0x8c0bf5,_0x2456ab){_0x8c0bf5=_0x8c0bf5-0x0;var _0x447387=_0xa478[_0x8c0bf5];return _0x447387;};'use strict';var multer=require(_0x8a47('0x0'));var util=require(_0x8a47('0x1'));var path=require(_0x8a47('0x2'));var timeout=require(_0x8a47('0x3'));var express=require(_0x8a47('0x4'));var router=express[_0x8a47('0x5')]();var fs_extra=require(_0x8a47('0x6'));var auth=require(_0x8a47('0x7'));var interaction=require(_0x8a47('0x8'));var config=require(_0x8a47('0x9'));var controller=require(_0x8a47('0xa'));router[_0x8a47('0xb')]('/',auth['isAuthenticated'](),controller[_0x8a47('0xc')]);router[_0x8a47('0xb')](_0x8a47('0xd'),auth[_0x8a47('0xe')](),controller['show']);router[_0x8a47('0xb')]('/:id/configurations',auth[_0x8a47('0xe')](),controller[_0x8a47('0xf')]);router[_0x8a47('0xb')]('/:id/fields',auth[_0x8a47('0xe')](),controller[_0x8a47('0x10')]);router['post']('/',auth[_0x8a47('0xe')](),controller['create']);router[_0x8a47('0x11')](_0x8a47('0x12'),auth[_0x8a47('0xe')](),controller['addConfiguration']);router['put']('/:id',auth[_0x8a47('0xe')](),controller[_0x8a47('0x13')]);router['delete'](_0x8a47('0xd'),auth[_0x8a47('0xe')](),controller[_0x8a47('0x14')]);module[_0x8a47('0x15')]=router; \ No newline at end of file +var _0xbc9d=['express','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated','index','show','/:id/fields','getFields','post','create','/:id/configurations','addConfiguration','put','update','delete','/:id','destroy','multer','util','path','connect-timeout'];(function(_0xcd39b,_0x1fe1a7){var _0x23076f=function(_0x35eeb9){while(--_0x35eeb9){_0xcd39b['push'](_0xcd39b['shift']());}};_0x23076f(++_0x1fe1a7);}(_0xbc9d,0xb4));var _0xdbc9=function(_0x2595a6,_0x48fc45){_0x2595a6=_0x2595a6-0x0;var _0x460197=_0xbc9d[_0x2595a6];return _0x460197;};'use strict';var multer=require(_0xdbc9('0x0'));var util=require(_0xdbc9('0x1'));var path=require(_0xdbc9('0x2'));var timeout=require(_0xdbc9('0x3'));var express=require(_0xdbc9('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xdbc9('0x5'));var config=require(_0xdbc9('0x6'));var controller=require(_0xdbc9('0x7'));router[_0xdbc9('0x8')]('/',auth[_0xdbc9('0x9')](),controller[_0xdbc9('0xa')]);router[_0xdbc9('0x8')]('/:id',auth[_0xdbc9('0x9')](),controller[_0xdbc9('0xb')]);router[_0xdbc9('0x8')]('/:id/configurations',auth[_0xdbc9('0x9')](),controller['getConfigurations']);router['get'](_0xdbc9('0xc'),auth[_0xdbc9('0x9')](),controller[_0xdbc9('0xd')]);router[_0xdbc9('0xe')]('/',auth['isAuthenticated'](),controller[_0xdbc9('0xf')]);router[_0xdbc9('0xe')](_0xdbc9('0x10'),auth[_0xdbc9('0x9')](),controller[_0xdbc9('0x11')]);router[_0xdbc9('0x12')]('/:id',auth['isAuthenticated'](),controller[_0xdbc9('0x13')]);router[_0xdbc9('0x14')](_0xdbc9('0x15'),auth[_0xdbc9('0x9')](),controller[_0xdbc9('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index 41e80d0..9c56edf 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 _0x32b6=['remoteUri','sequelize','exports','STRING'];(function(_0x223b71,_0x597bfb){var _0x4131e4=function(_0x411d23){while(--_0x411d23){_0x223b71['push'](_0x223b71['shift']());}};_0x4131e4(++_0x597bfb);}(_0x32b6,0x1d1));var _0x632b=function(_0x3c4952,_0x5e1699){_0x3c4952=_0x3c4952-0x0;var _0x111266=_0x32b6[_0x3c4952];return _0x111266;};'use strict';var Sequelize=require(_0x632b('0x0'));module[_0x632b('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x632b('0x2')]},'username':{'type':Sequelize[_0x632b('0x2')],'unique':'username'},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x632b('0x2')],'unique':_0x632b('0x3')},'serverUrl':{'type':Sequelize[_0x632b('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x5b12=['STRING','sequelize','exports'];(function(_0x1969a7,_0x5a133a){var _0x3d665f=function(_0x39c64b){while(--_0x39c64b){_0x1969a7['push'](_0x1969a7['shift']());}};_0x3d665f(++_0x5a133a);}(_0x5b12,0xa3));var _0x25b1=function(_0xc89f07,_0x38d9fb){_0xc89f07=_0xc89f07-0x0;var _0x41533d=_0x5b12[_0xc89f07];return _0x41533d;};'use strict';var Sequelize=require(_0x25b1('0x0'));module[_0x25b1('0x1')]={'name':{'type':Sequelize[_0x25b1('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x25b1('0x2')],'unique':'username'},'apiKey':{'type':Sequelize[_0x25b1('0x2')]},'remoteUri':{'type':Sequelize[_0x25b1('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x25b1('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 4de1719..96e3afc 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 _0xa917=['Content-Range','apply','save','update','then','destroy','error','stack','name','map','FreshsalesAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','include','findAll','rows','catch','show','params','intersection','create','body','find','FreshsalesConfiguration','getConfigurations','addConfiguration','Subjects','getSubjects','Descriptions','getDescriptions','channel','FreshsalesField','getFields','username','remoteUri','apiKey','lastIndexOf','format','%s%s','/api/selector/owners','Token\x20token=','email','Requested\x20Resource\x20not\x20Found','test','getFields,\x20%s,\x20%s,\x20%s','stringify','statusCode','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','limit','undefined','count'];(function(_0x1267f9,_0xef5dda){var _0x18cce0=function(_0x136535){while(--_0x136535){_0x1267f9['push'](_0x1267f9['shift']());}};_0x18cce0(++_0xef5dda);}(_0xa917,0x168));var _0x7a91=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xa917[_0x59ee6f];return _0x4c0979;};'use strict';var emlformat=require(_0x7a91('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x7a91('0x1'));var rp=require(_0x7a91('0x2'));var moment=require(_0x7a91('0x3'));var BPromise=require(_0x7a91('0x4'));var Mustache=require(_0x7a91('0x5'));var util=require(_0x7a91('0x6'));var path=require('path');var sox=require(_0x7a91('0x7'));var csv=require(_0x7a91('0x8'));var ejs=require(_0x7a91('0x9'));var fs=require('fs');var fs_extra=require(_0x7a91('0xa'));var _=require(_0x7a91('0xb'));var squel=require(_0x7a91('0xc'));var crypto=require(_0x7a91('0xd'));var jsforce=require(_0x7a91('0xe'));var deskjs=require(_0x7a91('0xf'));var toCsv=require(_0x7a91('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x7a91('0x10'));var qs=require(_0x7a91('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x7a91('0x12'))(_0x7a91('0x13'));var utils=require(_0x7a91('0x14'));var config=require(_0x7a91('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x7a91('0x16'))['db'];var integrations=require(_0x7a91('0x17'));function respondWithStatusCode(_0x32a456,_0x5e2a2){_0x5e2a2=_0x5e2a2||0xcc;return function(_0x19b132){if(_0x19b132){return _0x32a456[_0x7a91('0x18')](_0x5e2a2);}return _0x32a456[_0x7a91('0x19')](_0x5e2a2)[_0x7a91('0x1a')]();};}function respondWithResult(_0x21a092,_0x3fe09d){_0x3fe09d=_0x3fe09d||0xc8;return function(_0x46e315){if(_0x46e315){return _0x21a092[_0x7a91('0x19')](_0x3fe09d)[_0x7a91('0x1b')](_0x46e315);}};}function respondWithFilteredResult(_0x51346f,_0x66f6ed){return function(_0x5a15b6){if(_0x5a15b6){var _0x8b1a33=typeof _0x66f6ed[_0x7a91('0x1c')]==='undefined'&&typeof _0x66f6ed[_0x7a91('0x1d')]===_0x7a91('0x1e');var _0x3b00c0=_0x5a15b6[_0x7a91('0x1f')];var _0x2a085b=_0x8b1a33?0x0:_0x66f6ed[_0x7a91('0x1c')];var _0x268fa6=_0x8b1a33?_0x5a15b6[_0x7a91('0x1f')]:_0x66f6ed[_0x7a91('0x1c')]+_0x66f6ed[_0x7a91('0x1d')];var _0xf5f071;if(_0x268fa6>=_0x3b00c0){_0x268fa6=_0x3b00c0;_0xf5f071=0xc8;}else{_0xf5f071=0xce;}_0x51346f[_0x7a91('0x19')](_0xf5f071);return _0x51346f['set'](_0x7a91('0x20'),_0x2a085b+'-'+_0x268fa6+'/'+_0x3b00c0)[_0x7a91('0x1b')](_0x5a15b6);}return null;};}function patchUpdates(_0x46add2){return function(_0x1e7fce){try{jsonpatch[_0x7a91('0x21')](_0x1e7fce,_0x46add2,!![]);}catch(_0x995bcc){return BPromise['reject'](_0x995bcc);}return _0x1e7fce[_0x7a91('0x22')]();};}function saveUpdates(_0x3b19b1,_0x4af7ce){return function(_0x502aa2){if(_0x502aa2){return _0x502aa2[_0x7a91('0x23')](_0x3b19b1)[_0x7a91('0x24')](function(_0x5aa1b8){return _0x5aa1b8;});}return null;};}function removeEntity(_0x1fd338,_0x592cb3){return function(_0x47d559){if(_0x47d559){return _0x47d559[_0x7a91('0x25')]()[_0x7a91('0x24')](function(){_0x1fd338['status'](0xcc)[_0x7a91('0x1a')]();});}};}function handleEntityNotFound(_0x24c33e,_0xa872b7){return function(_0x66f7e4){if(!_0x66f7e4){_0x24c33e['sendStatus'](0x194);}return _0x66f7e4;};}function handleError(_0x31cfda,_0x3d4476){_0x3d4476=_0x3d4476||0x1f4;return function(_0x43609f){logger[_0x7a91('0x26')](_0x43609f[_0x7a91('0x27')]);if(_0x43609f[_0x7a91('0x28')]){delete _0x43609f['name'];}_0x31cfda[_0x7a91('0x19')](_0x3d4476)['send'](_0x43609f);};}exports['index']=function(_0x98c656,_0x5e6a2b){var _0x471ae5={},_0x7176c0={},_0x5595b4={'count':0x0,'rows':[]};var _0x20c8b0=_[_0x7a91('0x29')](db[_0x7a91('0x2a')][_0x7a91('0x2b')],function(_0xf948af){return{'name':_0xf948af[_0x7a91('0x2c')],'type':_0xf948af[_0x7a91('0x2d')][_0x7a91('0x2e')]};});_0x7176c0[_0x7a91('0x2f')]=_[_0x7a91('0x29')](_0x20c8b0,'name');_0x7176c0[_0x7a91('0x30')]=_[_0x7a91('0x31')](_0x98c656[_0x7a91('0x30')]);_0x7176c0[_0x7a91('0x32')]=_['intersection'](_0x7176c0[_0x7a91('0x2f')],_0x7176c0['query']);_0x471ae5[_0x7a91('0x33')]=_['intersection'](_0x7176c0[_0x7a91('0x2f')],qs[_0x7a91('0x34')](_0x98c656[_0x7a91('0x30')][_0x7a91('0x34')]));_0x471ae5['attributes']=_0x471ae5[_0x7a91('0x33')][_0x7a91('0x35')]?_0x471ae5[_0x7a91('0x33')]:_0x7176c0[_0x7a91('0x2f')];if(!_0x98c656[_0x7a91('0x30')][_0x7a91('0x36')](_0x7a91('0x37'))){_0x471ae5[_0x7a91('0x1d')]=qs['limit'](_0x98c656[_0x7a91('0x30')][_0x7a91('0x1d')]);_0x471ae5[_0x7a91('0x1c')]=qs[_0x7a91('0x1c')](_0x98c656[_0x7a91('0x30')][_0x7a91('0x1c')]);}_0x471ae5[_0x7a91('0x38')]=qs['sort'](_0x98c656[_0x7a91('0x30')][_0x7a91('0x39')]);_0x471ae5[_0x7a91('0x3a')]=qs[_0x7a91('0x32')](_[_0x7a91('0x3b')](_0x98c656[_0x7a91('0x30')],_0x7176c0[_0x7a91('0x32')]),_0x20c8b0);if(_0x98c656['query']['filter']){_0x471ae5[_0x7a91('0x3a')]=_[_0x7a91('0x3c')](_0x471ae5['where'],{'$or':_[_0x7a91('0x29')](_0x20c8b0,function(_0x19cd68){if(_0x19cd68[_0x7a91('0x2d')]!==_0x7a91('0x3d')){var _0x4ac61a={};_0x4ac61a[_0x19cd68[_0x7a91('0x28')]]={'$like':'%'+_0x98c656[_0x7a91('0x30')][_0x7a91('0x3e')]+'%'};return _0x4ac61a;}})});}_0x471ae5=_[_0x7a91('0x3c')]({},_0x471ae5,_0x98c656[_0x7a91('0x3f')]);var _0x51cae3={'where':_0x471ae5[_0x7a91('0x3a')]};return db['FreshsalesAccount'][_0x7a91('0x1f')](_0x51cae3)['then'](function(_0x53d7c2){_0x5595b4['count']=_0x53d7c2;if(_0x98c656[_0x7a91('0x30')]['includeAll']){_0x471ae5[_0x7a91('0x40')]=[{'all':!![]}];}return db['FreshsalesAccount'][_0x7a91('0x41')](_0x471ae5);})[_0x7a91('0x24')](function(_0x9329f0){_0x5595b4[_0x7a91('0x42')]=_0x9329f0;return _0x5595b4;})[_0x7a91('0x24')](respondWithFilteredResult(_0x5e6a2b,_0x471ae5))[_0x7a91('0x43')](handleError(_0x5e6a2b,null));};exports[_0x7a91('0x44')]=function(_0x533278,_0x3a3323){var _0x298dfc={'raw':![],'where':{'id':_0x533278[_0x7a91('0x45')]['id']}},_0x3304e5={};_0x3304e5[_0x7a91('0x2f')]=_[_0x7a91('0x31')](db[_0x7a91('0x2a')]['rawAttributes']);_0x3304e5['query']=_[_0x7a91('0x31')](_0x533278[_0x7a91('0x30')]);_0x3304e5['filters']=_[_0x7a91('0x46')](_0x3304e5['model'],_0x3304e5['query']);_0x298dfc[_0x7a91('0x33')]=_[_0x7a91('0x46')](_0x3304e5[_0x7a91('0x2f')],qs[_0x7a91('0x34')](_0x533278[_0x7a91('0x30')]['fields']));_0x298dfc[_0x7a91('0x33')]=_0x298dfc['attributes']['length']?_0x298dfc[_0x7a91('0x33')]:_0x3304e5[_0x7a91('0x2f')];if(_0x533278[_0x7a91('0x30')]['includeAll']){_0x298dfc['include']=[{'all':!![]}];}_0x298dfc=_[_0x7a91('0x3c')]({},_0x298dfc,_0x533278[_0x7a91('0x3f')]);return db['FreshsalesAccount']['find'](_0x298dfc)[_0x7a91('0x24')](handleEntityNotFound(_0x3a3323,null))['then'](respondWithResult(_0x3a3323,null))[_0x7a91('0x43')](handleError(_0x3a3323,null));};exports[_0x7a91('0x47')]=function(_0x159dde,_0x58e29a){return db['FreshsalesAccount'][_0x7a91('0x47')](_0x159dde[_0x7a91('0x48')],{})['then'](respondWithResult(_0x58e29a,0xc9))[_0x7a91('0x43')](handleError(_0x58e29a,null));};exports[_0x7a91('0x23')]=function(_0xa2ddaa,_0x24454c){if(_0xa2ddaa['body']['id']){delete _0xa2ddaa[_0x7a91('0x48')]['id'];}return db[_0x7a91('0x2a')]['find']({'where':{'id':_0xa2ddaa['params']['id']}})[_0x7a91('0x24')](handleEntityNotFound(_0x24454c,null))[_0x7a91('0x24')](saveUpdates(_0xa2ddaa[_0x7a91('0x48')],null))[_0x7a91('0x24')](respondWithResult(_0x24454c,null))['catch'](handleError(_0x24454c,null));};exports[_0x7a91('0x25')]=function(_0xafe2ad,_0x3c9a09){return db['FreshsalesAccount'][_0x7a91('0x49')]({'where':{'id':_0xafe2ad[_0x7a91('0x45')]['id']}})['then'](handleEntityNotFound(_0x3c9a09,null))[_0x7a91('0x24')](removeEntity(_0x3c9a09,null))[_0x7a91('0x43')](handleError(_0x3c9a09,null));};exports['getConfigurations']=function(_0x161ec3,_0x2cca05,_0x1f75b2){var _0x45c175={};var _0x414bc0={};var _0x64de88;var _0x4e8cca;return db[_0x7a91('0x2a')]['findOne']({'where':{'id':_0x161ec3['params']['id']}})[_0x7a91('0x24')](handleEntityNotFound(_0x2cca05,null))[_0x7a91('0x24')](function(_0x16fb02){if(_0x16fb02){_0x64de88=_0x16fb02;_0x414bc0[_0x7a91('0x2f')]=_[_0x7a91('0x31')](db[_0x7a91('0x4a')][_0x7a91('0x2b')]);_0x414bc0['query']=_[_0x7a91('0x31')](_0x161ec3['query']);_0x414bc0[_0x7a91('0x32')]=_[_0x7a91('0x46')](_0x414bc0[_0x7a91('0x2f')],_0x414bc0[_0x7a91('0x30')]);_0x45c175['attributes']=_[_0x7a91('0x46')](_0x414bc0[_0x7a91('0x2f')],qs[_0x7a91('0x34')](_0x161ec3['query'][_0x7a91('0x34')]));_0x45c175[_0x7a91('0x33')]=_0x45c175[_0x7a91('0x33')][_0x7a91('0x35')]?_0x45c175[_0x7a91('0x33')]:_0x414bc0[_0x7a91('0x2f')];_0x45c175[_0x7a91('0x38')]=qs[_0x7a91('0x39')](_0x161ec3['query'][_0x7a91('0x39')]);_0x45c175[_0x7a91('0x3a')]=qs['filters'](_[_0x7a91('0x3b')](_0x161ec3[_0x7a91('0x30')],_0x414bc0[_0x7a91('0x32')]));if(_0x161ec3[_0x7a91('0x30')]['filter']){_0x45c175[_0x7a91('0x3a')]=_['merge'](_0x45c175['where'],{'$or':_['map'](_0x45c175[_0x7a91('0x33')],function(_0xdfa085){var _0x40c858={};_0x40c858[_0xdfa085]={'$like':'%'+_0x161ec3[_0x7a91('0x30')][_0x7a91('0x3e')]+'%'};return _0x40c858;})});}_0x45c175=_[_0x7a91('0x3c')]({},_0x45c175,_0x161ec3[_0x7a91('0x3f')]);return _0x64de88[_0x7a91('0x4b')](_0x45c175);}})['then'](function(_0x18bb75){if(_0x18bb75){_0x4e8cca=_0x18bb75[_0x7a91('0x35')];if(!_0x161ec3[_0x7a91('0x30')][_0x7a91('0x36')](_0x7a91('0x37'))){_0x45c175[_0x7a91('0x1d')]=qs[_0x7a91('0x1d')](_0x161ec3['query'][_0x7a91('0x1d')]);_0x45c175[_0x7a91('0x1c')]=qs[_0x7a91('0x1c')](_0x161ec3['query'][_0x7a91('0x1c')]);}return _0x64de88[_0x7a91('0x4b')](_0x45c175);}})['then'](function(_0x273319){if(_0x273319){return _0x273319?{'count':_0x4e8cca,'rows':_0x273319}:null;}})[_0x7a91('0x24')](respondWithResult(_0x2cca05,null))[_0x7a91('0x43')](handleError(_0x2cca05,null));};exports[_0x7a91('0x4c')]=function(_0xeb5c84,_0x28f0e5,_0x502b5f){if(_0xeb5c84[_0x7a91('0x48')]['id']){delete _0xeb5c84[_0x7a91('0x48')]['id'];}return db[_0x7a91('0x2a')]['findOne']({'where':{'id':_0xeb5c84[_0x7a91('0x45')]['id']}})[_0x7a91('0x24')](handleEntityNotFound(_0x28f0e5,null))['then'](function(_0x532664){if(_0x532664){_0xeb5c84[_0x7a91('0x48')]['AccountId']=_0x532664['id'];_0xeb5c84[_0x7a91('0x48')][_0x7a91('0x4d')]=integrations[_0x7a91('0x4e')](_0xeb5c84[_0x7a91('0x48')]['channel'],_0xeb5c84[_0x7a91('0x48')][_0x7a91('0x2d')]);_0xeb5c84['body'][_0x7a91('0x4f')]=integrations[_0x7a91('0x50')](_0xeb5c84['body'][_0x7a91('0x51')],_0xeb5c84['body']['type']);return db[_0x7a91('0x4a')][_0x7a91('0x47')](_0xeb5c84['body'],{'include':[{'model':db[_0x7a91('0x52')],'as':_0x7a91('0x4d')},{'model':db[_0x7a91('0x52')],'as':_0x7a91('0x4f')}]});}return null;})[_0x7a91('0x24')](respondWithResult(_0x28f0e5,null))[_0x7a91('0x43')](handleError(_0x28f0e5,null));};exports[_0x7a91('0x53')]=function(_0x161987,_0x1597fd,_0x1a26ee){var _0x46ce90='';var _0x4a21be='';return db[_0x7a91('0x2a')]['findOne']({'where':{'id':_0x161987[_0x7a91('0x45')]['id']},'attributes':['id',_0x7a91('0x54'),_0x7a91('0x55'),_0x7a91('0x56')]})[_0x7a91('0x24')](handleEntityNotFound(_0x1597fd,null))[_0x7a91('0x24')](function(_0x398e1d){if(_0x398e1d){_0x4a21be=_0x398e1d[_0x7a91('0x54')];_0x46ce90=_0x398e1d[_0x7a91('0x55')];var _0x56fbf3=_0x398e1d[_0x7a91('0x55')]['slice'](-0x1);if(_0x56fbf3==='/'){_0x46ce90=_0x46ce90['substring'](0x0,_0x46ce90[_0x7a91('0x57')](_0x56fbf3));}return rp({'method':'GET','uri':util[_0x7a91('0x58')](_0x7a91('0x59'),_0x46ce90,_0x7a91('0x5a')),'headers':{'Authorization':_0x7a91('0x5b')+_0x398e1d[_0x7a91('0x56')]},'json':!![]});}})[_0x7a91('0x24')](function(_0x1be3fe){if(_0x1be3fe){var _0x1cd6d1=_0x1be3fe['users'];var _0x20269a=![];var _0x26f169=null;for(_0x26f169=0x0;_0x26f169<_0x1cd6d1[_0x7a91('0x35')];_0x26f169++){if(_0x1cd6d1[_0x26f169][_0x7a91('0x5c')]===_0x4a21be){_0x20269a=!![];}}if(_0x20269a){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x7a91('0x5d')});}}})[_0x7a91('0x24')](respondWithResult(_0x1597fd,null))[_0x7a91('0x43')](function(_0x164e1b){var _0x3f32bd=_0x161987[_0x7a91('0x30')][_0x7a91('0x5e')]?0x1f4:_0x164e1b['statusCode']||0x1f4;logger[_0x7a91('0x26')](_0x7a91('0x5f'),_0x7a91('0x53'),_0x3f32bd,JSON[_0x7a91('0x60')](_0x164e1b));delete _0x164e1b[_0x7a91('0x28')];if(_0x3f32bd===0x191){_0x3f32bd=0x190;}_0x1597fd[_0x7a91('0x19')](_0x3f32bd)['send'](_0x161987[_0x7a91('0x30')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x164e1b[_0x7a91('0x61')]}:_0x164e1b);});}; \ No newline at end of file +var _0x962b=['pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','keys','rawAttributes','length','create','body','find','params','findOne','order','getConfigurations','addConfiguration','Subjects','channel','FreshsalesConfiguration','FreshsalesField','Descriptions','getFields','username','apiKey','remoteUri','slice','GET','format','%s%s','Token\x20token=','users','email','Requested\x20Resource\x20not\x20Found','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','apply','reject','save','update','then','end','error','stack','name','send','map','FreshsalesAccount','fieldName','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort'];(function(_0x1b4322,_0x2c19fe){var _0x91b322=function(_0x68bfb0){while(--_0x68bfb0){_0x1b4322['push'](_0x1b4322['shift']());}};_0x91b322(++_0x2c19fe);}(_0x962b,0xf0));var _0xb962=function(_0x22ac48,_0x48cd48){_0x22ac48=_0x22ac48-0x0;var _0x4d8e9e=_0x962b[_0x22ac48];return _0x4d8e9e;};'use strict';var emlformat=require(_0xb962('0x0'));var rimraf=require(_0xb962('0x1'));var zipdir=require(_0xb962('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb962('0x3'));var moment=require(_0xb962('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xb962('0x5'));var util=require(_0xb962('0x6'));var path=require(_0xb962('0x7'));var sox=require(_0xb962('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb962('0x9'));var _=require(_0xb962('0xa'));var squel=require('squel');var crypto=require(_0xb962('0xb'));var jsforce=require(_0xb962('0xc'));var deskjs=require(_0xb962('0xd'));var toCsv=require('to-csv');var querystring=require(_0xb962('0xe'));var Papa=require(_0xb962('0xf'));var Redis=require('ioredis');var authService=require(_0xb962('0x10'));var qs=require(_0xb962('0x11'));var as=require(_0xb962('0x12'));var hardwareService=require(_0xb962('0x13'));var logger=require(_0xb962('0x14'))(_0xb962('0x15'));var utils=require('../../config/utils');var config=require(_0xb962('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xb962('0x17'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0xe39456,_0x464b56){_0x464b56=_0x464b56||0xcc;return function(_0x965522){if(_0x965522){return _0xe39456[_0xb962('0x18')](_0x464b56);}return _0xe39456[_0xb962('0x19')](_0x464b56)['end']();};}function respondWithResult(_0x2548e4,_0x5ef143){_0x5ef143=_0x5ef143||0xc8;return function(_0x239428){if(_0x239428){return _0x2548e4[_0xb962('0x19')](_0x5ef143)[_0xb962('0x1a')](_0x239428);}};}function respondWithFilteredResult(_0x3ec277,_0x2ea848){return function(_0x1bbe30){if(_0x1bbe30){var _0x205323=typeof _0x2ea848[_0xb962('0x1b')]==='undefined'&&typeof _0x2ea848[_0xb962('0x1c')]===_0xb962('0x1d');var _0x4aa376=_0x1bbe30['count'];var _0x2aa09f=_0x205323?0x0:_0x2ea848['offset'];var _0x5325ea=_0x205323?_0x1bbe30[_0xb962('0x1e')]:_0x2ea848[_0xb962('0x1b')]+_0x2ea848[_0xb962('0x1c')];var _0x10fa0a;if(_0x5325ea>=_0x4aa376){_0x5325ea=_0x4aa376;_0x10fa0a=0xc8;}else{_0x10fa0a=0xce;}_0x3ec277['status'](_0x10fa0a);return _0x3ec277['set']('Content-Range',_0x2aa09f+'-'+_0x5325ea+'/'+_0x4aa376)[_0xb962('0x1a')](_0x1bbe30);}return null;};}function patchUpdates(_0x5759f6){return function(_0x16a0b8){try{jsonpatch[_0xb962('0x1f')](_0x16a0b8,_0x5759f6,!![]);}catch(_0x3872cf){return BPromise[_0xb962('0x20')](_0x3872cf);}return _0x16a0b8[_0xb962('0x21')]();};}function saveUpdates(_0x2e40d2,_0x8fb335){return function(_0x5c0aa0){if(_0x5c0aa0){return _0x5c0aa0[_0xb962('0x22')](_0x2e40d2)[_0xb962('0x23')](function(_0x40c8ec){return _0x40c8ec;});}return null;};}function removeEntity(_0x3d8c39,_0x102260){return function(_0x509734){if(_0x509734){return _0x509734['destroy']()['then'](function(){_0x3d8c39[_0xb962('0x19')](0xcc)[_0xb962('0x24')]();});}};}function handleEntityNotFound(_0x8c4965,_0x28e2de){return function(_0x11fe94){if(!_0x11fe94){_0x8c4965['sendStatus'](0x194);}return _0x11fe94;};}function handleError(_0x570f4f,_0x5524b2){_0x5524b2=_0x5524b2||0x1f4;return function(_0x2dfd91){logger[_0xb962('0x25')](_0x2dfd91[_0xb962('0x26')]);if(_0x2dfd91[_0xb962('0x27')]){delete _0x2dfd91[_0xb962('0x27')];}_0x570f4f[_0xb962('0x19')](_0x5524b2)[_0xb962('0x28')](_0x2dfd91);};}exports['index']=function(_0x2bdc4a,_0x86fb77){var _0x339d79={},_0x2e5775={},_0x6bf634={'count':0x0,'rows':[]};var _0x149ce1=_[_0xb962('0x29')](db[_0xb962('0x2a')]['rawAttributes'],function(_0x531740){return{'name':_0x531740[_0xb962('0x2b')],'type':_0x531740['type'][_0xb962('0x2c')]};});_0x2e5775[_0xb962('0x2d')]=_[_0xb962('0x29')](_0x149ce1,'name');_0x2e5775['query']=_['keys'](_0x2bdc4a[_0xb962('0x2e')]);_0x2e5775[_0xb962('0x2f')]=_[_0xb962('0x30')](_0x2e5775[_0xb962('0x2d')],_0x2e5775[_0xb962('0x2e')]);_0x339d79['attributes']=_[_0xb962('0x30')](_0x2e5775[_0xb962('0x2d')],qs[_0xb962('0x31')](_0x2bdc4a[_0xb962('0x2e')][_0xb962('0x31')]));_0x339d79['attributes']=_0x339d79[_0xb962('0x32')]['length']?_0x339d79['attributes']:_0x2e5775[_0xb962('0x2d')];if(!_0x2bdc4a[_0xb962('0x2e')][_0xb962('0x33')](_0xb962('0x34'))){_0x339d79['limit']=qs[_0xb962('0x1c')](_0x2bdc4a['query']['limit']);_0x339d79[_0xb962('0x1b')]=qs['offset'](_0x2bdc4a[_0xb962('0x2e')][_0xb962('0x1b')]);}_0x339d79['order']=qs[_0xb962('0x35')](_0x2bdc4a[_0xb962('0x2e')][_0xb962('0x35')]);_0x339d79['where']=qs[_0xb962('0x2f')](_[_0xb962('0x36')](_0x2bdc4a['query'],_0x2e5775[_0xb962('0x2f')]),_0x149ce1);if(_0x2bdc4a[_0xb962('0x2e')][_0xb962('0x37')]){_0x339d79[_0xb962('0x38')]=_[_0xb962('0x39')](_0x339d79[_0xb962('0x38')],{'$or':_[_0xb962('0x29')](_0x149ce1,function(_0x242556){if(_0x242556['type']!==_0xb962('0x3a')){var _0x3ad891={};_0x3ad891[_0x242556[_0xb962('0x27')]]={'$like':'%'+_0x2bdc4a[_0xb962('0x2e')][_0xb962('0x37')]+'%'};return _0x3ad891;}})});}_0x339d79=_[_0xb962('0x39')]({},_0x339d79,_0x2bdc4a[_0xb962('0x3b')]);var _0x50d45e={'where':_0x339d79['where']};return db[_0xb962('0x2a')]['count'](_0x50d45e)[_0xb962('0x23')](function(_0x192347){_0x6bf634['count']=_0x192347;if(_0x2bdc4a[_0xb962('0x2e')][_0xb962('0x3c')]){_0x339d79[_0xb962('0x3d')]=[{'all':!![]}];}return db[_0xb962('0x2a')][_0xb962('0x3e')](_0x339d79);})[_0xb962('0x23')](function(_0x303369){_0x6bf634[_0xb962('0x3f')]=_0x303369;return _0x6bf634;})['then'](respondWithFilteredResult(_0x86fb77,_0x339d79))[_0xb962('0x40')](handleError(_0x86fb77,null));};exports['show']=function(_0x3c72fb,_0x1979ae){var _0x21cca2={'raw':![],'where':{'id':_0x3c72fb['params']['id']}},_0x477065={};_0x477065[_0xb962('0x2d')]=_[_0xb962('0x41')](db['FreshsalesAccount'][_0xb962('0x42')]);_0x477065['query']=_['keys'](_0x3c72fb[_0xb962('0x2e')]);_0x477065[_0xb962('0x2f')]=_[_0xb962('0x30')](_0x477065[_0xb962('0x2d')],_0x477065[_0xb962('0x2e')]);_0x21cca2[_0xb962('0x32')]=_[_0xb962('0x30')](_0x477065[_0xb962('0x2d')],qs['fields'](_0x3c72fb[_0xb962('0x2e')][_0xb962('0x31')]));_0x21cca2['attributes']=_0x21cca2[_0xb962('0x32')][_0xb962('0x43')]?_0x21cca2[_0xb962('0x32')]:_0x477065['model'];if(_0x3c72fb[_0xb962('0x2e')][_0xb962('0x3c')]){_0x21cca2[_0xb962('0x3d')]=[{'all':!![]}];}_0x21cca2=_[_0xb962('0x39')]({},_0x21cca2,_0x3c72fb[_0xb962('0x3b')]);return db['FreshsalesAccount']['find'](_0x21cca2)[_0xb962('0x23')](handleEntityNotFound(_0x1979ae,null))[_0xb962('0x23')](respondWithResult(_0x1979ae,null))['catch'](handleError(_0x1979ae,null));};exports['create']=function(_0x301dfb,_0x1880c1){return db[_0xb962('0x2a')][_0xb962('0x44')](_0x301dfb[_0xb962('0x45')],{})[_0xb962('0x23')](respondWithResult(_0x1880c1,0xc9))['catch'](handleError(_0x1880c1,null));};exports['update']=function(_0x4134eb,_0x47c692){if(_0x4134eb[_0xb962('0x45')]['id']){delete _0x4134eb[_0xb962('0x45')]['id'];}return db[_0xb962('0x2a')][_0xb962('0x46')]({'where':{'id':_0x4134eb[_0xb962('0x47')]['id']}})[_0xb962('0x23')](handleEntityNotFound(_0x47c692,null))[_0xb962('0x23')](saveUpdates(_0x4134eb[_0xb962('0x45')],null))['then'](respondWithResult(_0x47c692,null))[_0xb962('0x40')](handleError(_0x47c692,null));};exports['destroy']=function(_0x418478,_0x19d475){return db[_0xb962('0x2a')][_0xb962('0x46')]({'where':{'id':_0x418478['params']['id']}})[_0xb962('0x23')](handleEntityNotFound(_0x19d475,null))[_0xb962('0x23')](removeEntity(_0x19d475,null))[_0xb962('0x40')](handleError(_0x19d475,null));};exports['getConfigurations']=function(_0x12ccf7,_0x16fa47,_0x3a5bc6){var _0x3d4ae9={};var _0x462d45={};var _0xd84f8d;var _0x25f8c7;return db['FreshsalesAccount'][_0xb962('0x48')]({'where':{'id':_0x12ccf7[_0xb962('0x47')]['id']}})['then'](handleEntityNotFound(_0x16fa47,null))[_0xb962('0x23')](function(_0x4fdc58){if(_0x4fdc58){_0xd84f8d=_0x4fdc58;_0x462d45[_0xb962('0x2d')]=_[_0xb962('0x41')](db['FreshsalesConfiguration'][_0xb962('0x42')]);_0x462d45[_0xb962('0x2e')]=_[_0xb962('0x41')](_0x12ccf7['query']);_0x462d45[_0xb962('0x2f')]=_[_0xb962('0x30')](_0x462d45[_0xb962('0x2d')],_0x462d45[_0xb962('0x2e')]);_0x3d4ae9['attributes']=_[_0xb962('0x30')](_0x462d45[_0xb962('0x2d')],qs[_0xb962('0x31')](_0x12ccf7[_0xb962('0x2e')][_0xb962('0x31')]));_0x3d4ae9[_0xb962('0x32')]=_0x3d4ae9[_0xb962('0x32')][_0xb962('0x43')]?_0x3d4ae9[_0xb962('0x32')]:_0x462d45[_0xb962('0x2d')];_0x3d4ae9[_0xb962('0x49')]=qs[_0xb962('0x35')](_0x12ccf7[_0xb962('0x2e')][_0xb962('0x35')]);_0x3d4ae9[_0xb962('0x38')]=qs[_0xb962('0x2f')](_[_0xb962('0x36')](_0x12ccf7['query'],_0x462d45[_0xb962('0x2f')]));if(_0x12ccf7[_0xb962('0x2e')][_0xb962('0x37')]){_0x3d4ae9[_0xb962('0x38')]=_[_0xb962('0x39')](_0x3d4ae9[_0xb962('0x38')],{'$or':_[_0xb962('0x29')](_0x3d4ae9[_0xb962('0x32')],function(_0x4ddc16){var _0x364011={};_0x364011[_0x4ddc16]={'$like':'%'+_0x12ccf7[_0xb962('0x2e')]['filter']+'%'};return _0x364011;})});}_0x3d4ae9=_[_0xb962('0x39')]({},_0x3d4ae9,_0x12ccf7[_0xb962('0x3b')]);return _0xd84f8d[_0xb962('0x4a')](_0x3d4ae9);}})[_0xb962('0x23')](function(_0x5e6ff4){if(_0x5e6ff4){_0x25f8c7=_0x5e6ff4['length'];if(!_0x12ccf7[_0xb962('0x2e')][_0xb962('0x33')](_0xb962('0x34'))){_0x3d4ae9[_0xb962('0x1c')]=qs[_0xb962('0x1c')](_0x12ccf7[_0xb962('0x2e')][_0xb962('0x1c')]);_0x3d4ae9[_0xb962('0x1b')]=qs[_0xb962('0x1b')](_0x12ccf7[_0xb962('0x2e')][_0xb962('0x1b')]);}return _0xd84f8d[_0xb962('0x4a')](_0x3d4ae9);}})[_0xb962('0x23')](function(_0x5afcc9){if(_0x5afcc9){return _0x5afcc9?{'count':_0x25f8c7,'rows':_0x5afcc9}:null;}})['then'](respondWithResult(_0x16fa47,null))[_0xb962('0x40')](handleError(_0x16fa47,null));};exports[_0xb962('0x4b')]=function(_0x2de685,_0x4a56b5,_0x22d804){if(_0x2de685[_0xb962('0x45')]['id']){delete _0x2de685[_0xb962('0x45')]['id'];}return db[_0xb962('0x2a')][_0xb962('0x48')]({'where':{'id':_0x2de685[_0xb962('0x47')]['id']}})['then'](handleEntityNotFound(_0x4a56b5,null))[_0xb962('0x23')](function(_0x264081){if(_0x264081){_0x2de685[_0xb962('0x45')]['AccountId']=_0x264081['id'];_0x2de685['body'][_0xb962('0x4c')]=integrations['getSubjects'](_0x2de685[_0xb962('0x45')][_0xb962('0x4d')],_0x2de685[_0xb962('0x45')]['type']);_0x2de685[_0xb962('0x45')]['Descriptions']=integrations['getDescriptions'](_0x2de685[_0xb962('0x45')][_0xb962('0x4d')],_0x2de685[_0xb962('0x45')]['type']);return db[_0xb962('0x4e')][_0xb962('0x44')](_0x2de685[_0xb962('0x45')],{'include':[{'model':db['FreshsalesField'],'as':_0xb962('0x4c')},{'model':db[_0xb962('0x4f')],'as':_0xb962('0x50')}]});}return null;})[_0xb962('0x23')](respondWithResult(_0x4a56b5,null))[_0xb962('0x40')](handleError(_0x4a56b5,null));};exports[_0xb962('0x51')]=function(_0x5b45a7,_0x22bb1b,_0x1b50e5){var _0x556ccf='';var _0x59d16f='';return db[_0xb962('0x2a')][_0xb962('0x48')]({'where':{'id':_0x5b45a7['params']['id']},'attributes':['id',_0xb962('0x52'),'remoteUri',_0xb962('0x53')]})[_0xb962('0x23')](handleEntityNotFound(_0x22bb1b,null))[_0xb962('0x23')](function(_0x12a5f6){if(_0x12a5f6){_0x59d16f=_0x12a5f6['username'];_0x556ccf=_0x12a5f6[_0xb962('0x54')];var _0x2b84b7=_0x12a5f6[_0xb962('0x54')][_0xb962('0x55')](-0x1);if(_0x2b84b7==='/'){_0x556ccf=_0x556ccf['substring'](0x0,_0x556ccf['lastIndexOf'](_0x2b84b7));}return rp({'method':_0xb962('0x56'),'uri':util[_0xb962('0x57')](_0xb962('0x58'),_0x556ccf,'/api/selector/owners'),'headers':{'Authorization':_0xb962('0x59')+_0x12a5f6['apiKey']},'json':!![]});}})[_0xb962('0x23')](function(_0x1aac31){if(_0x1aac31){var _0x134539=_0x1aac31[_0xb962('0x5a')];var _0x4b4174=![];var _0x4bbc49=null;for(_0x4bbc49=0x0;_0x4bbc49<_0x134539[_0xb962('0x43')];_0x4bbc49++){if(_0x134539[_0x4bbc49][_0xb962('0x5b')]===_0x59d16f){_0x4b4174=!![];}}if(_0x4b4174){return!![];}else{throw new Error({'statusCode':0x194,'message':_0xb962('0x5c')});}}})[_0xb962('0x23')](respondWithResult(_0x22bb1b,null))[_0xb962('0x40')](function(_0x7e55ff){var _0x46bb68=_0x5b45a7[_0xb962('0x2e')][_0xb962('0x5d')]?0x1f4:_0x7e55ff[_0xb962('0x5e')]||0x1f4;logger[_0xb962('0x25')](_0xb962('0x5f'),_0xb962('0x51'),_0x46bb68,JSON[_0xb962('0x60')](_0x7e55ff));delete _0x7e55ff['name'];if(_0x46bb68===0x191){_0x46bb68=0x190;}_0x22bb1b['status'](_0x46bb68)['send'](_0x5b45a7[_0xb962('0x2e')][_0xb962('0x5d')]?{'message':_0xb962('0x61'),'statusCode':_0x7e55ff[_0xb962('0x5e')]}:_0x7e55ff);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index 5b494cf..db17d5e 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 _0x4bd3=['define','int_freshsales_accounts','lodash','../../config/logger','api','path','rimraf','../../config/environment','../../components/integrations/configuration','exports'];(function(_0x47b58b,_0x41a189){var _0x46bebe=function(_0x22bbfa){while(--_0x22bbfa){_0x47b58b['push'](_0x47b58b['shift']());}};_0x46bebe(++_0x41a189);}(_0x4bd3,0x174));var _0x34bd=function(_0x167b48,_0x397525){_0x167b48=_0x167b48-0x0;var _0x15ee56=_0x4bd3[_0x167b48];return _0x15ee56;};'use strict';var _=require(_0x34bd('0x0'));var util=require('util');var logger=require(_0x34bd('0x1'))(_0x34bd('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x34bd('0x3'));var rimraf=require(_0x34bd('0x4'));var config=require(_0x34bd('0x5'));var attributes=require('./intFreshsalesAccount.attributes');var integrations=require(_0x34bd('0x6'));module[_0x34bd('0x7')]=function(_0x5c2a7a,_0x3e8744){return _0x5c2a7a[_0x34bd('0x8')]('FreshsalesAccount',attributes,{'tableName':_0x34bd('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4745=['path','rimraf','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration','FreshsalesAccount','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x40429e,_0x2c3fbf){var _0x3d07b0=function(_0x31f89b){while(--_0x31f89b){_0x40429e['push'](_0x40429e['shift']());}};_0x3d07b0(++_0x2c3fbf);}(_0x4745,0x1e7));var _0x5474=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0x4745[_0x297fd3];return _0x2af381;};'use strict';var _=require(_0x5474('0x0'));var util=require(_0x5474('0x1'));var logger=require(_0x5474('0x2'))(_0x5474('0x3'));var moment=require(_0x5474('0x4'));var BPromise=require(_0x5474('0x5'));var rp=require(_0x5474('0x6'));var fs=require('fs');var path=require(_0x5474('0x7'));var rimraf=require(_0x5474('0x8'));var config=require(_0x5474('0x9'));var attributes=require(_0x5474('0xa'));var integrations=require(_0x5474('0xb'));module['exports']=function(_0x3d1e1,_0x431f81){return _0x3d1e1['define'](_0x5474('0xc'),attributes,{'tableName':'int_freshsales_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.rpc.js index f4b63e4..63ea369 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 _0x3e24=['limit','map','include','model','debug','stringify','ShowFreshsalesAccount','find','raw','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','FreshsalesAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','GetFreshsalesAccount','FreshsalesAccount','options','where','attributes'];(function(_0x47d4c8,_0x4a7b98){var _0xe42fb6=function(_0x2b544b){while(--_0x2b544b){_0x47d4c8['push'](_0x47d4c8['shift']());}};_0xe42fb6(++_0x4a7b98);}(_0x3e24,0x167));var _0x43e2=function(_0x3a7257,_0x30b139){_0x3a7257=_0x3a7257-0x0;var _0x467d25=_0x3e24[_0x3a7257];return _0x467d25;};'use strict';var _=require(_0x43e2('0x0'));var util=require(_0x43e2('0x1'));var moment=require(_0x43e2('0x2'));var BPromise=require(_0x43e2('0x3'));var rs=require(_0x43e2('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x43e2('0x5'))['db'];var utils=require(_0x43e2('0x6'));var logger=require('../../config/logger')(_0x43e2('0x7'));var config=require(_0x43e2('0x8'));var jayson=require(_0x43e2('0x9'));var client=jayson[_0x43e2('0xa')][_0x43e2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x121e2e,_0x23b2d8,_0x59956d){return new BPromise(function(_0xb75b,_0x2357bc){return client['request'](_0x121e2e,_0x59956d)[_0x43e2('0xc')](function(_0x2fdf85){logger['info'](_0x43e2('0xd'),_0x23b2d8,_0x43e2('0xe'));logger['debug'](_0x43e2('0xf'),_0x23b2d8,'request\x20sent',JSON['stringify'](_0x2fdf85));if(_0x2fdf85['error']){if(_0x2fdf85[_0x43e2('0x10')][_0x43e2('0x11')]===0x1f4){logger[_0x43e2('0x10')](_0x43e2('0xd'),_0x23b2d8,_0x2fdf85[_0x43e2('0x10')][_0x43e2('0x12')]);return _0x2357bc(_0x2fdf85[_0x43e2('0x10')][_0x43e2('0x12')]);}logger[_0x43e2('0x10')](_0x43e2('0xd'),_0x23b2d8,_0x2fdf85[_0x43e2('0x10')][_0x43e2('0x12')]);return _0xb75b(_0x2fdf85['error'][_0x43e2('0x12')]);}else{logger[_0x43e2('0x13')](_0x43e2('0xd'),_0x23b2d8,_0x43e2('0xe'));_0xb75b(_0x2fdf85['result']['message']);}})[_0x43e2('0x14')](function(_0x417ce5){logger[_0x43e2('0x10')](_0x43e2('0xd'),_0x23b2d8,_0x417ce5);_0x2357bc(_0x417ce5);});});}exports[_0x43e2('0x15')]=function(_0x1b7cde){var _0x3ea010=this;return new Promise(function(_0x15ecb5,_0x3236b9){return db[_0x43e2('0x16')]['findAll']({'raw':_0x1b7cde[_0x43e2('0x17')]?_0x1b7cde[_0x43e2('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x1b7cde[_0x43e2('0x17')]?_0x1b7cde['options'][_0x43e2('0x18')]||null:null,'attributes':_0x1b7cde[_0x43e2('0x17')]?_0x1b7cde[_0x43e2('0x17')][_0x43e2('0x19')]||null:null,'limit':_0x1b7cde[_0x43e2('0x17')]?_0x1b7cde['options'][_0x43e2('0x1a')]||null:null,'include':_0x1b7cde[_0x43e2('0x17')]?_0x1b7cde[_0x43e2('0x17')]['include']?_[_0x43e2('0x1b')](_0x1b7cde[_0x43e2('0x17')][_0x43e2('0x1c')],function(_0x11b285){return{'model':db[_0x11b285['model']],'as':_0x11b285['as'],'attributes':_0x11b285[_0x43e2('0x19')],'include':_0x11b285[_0x43e2('0x1c')]?_[_0x43e2('0x1b')](_0x11b285[_0x43e2('0x1c')],function(_0x178223){return{'model':db[_0x178223[_0x43e2('0x1d')]],'as':_0x178223['as'],'attributes':_0x178223[_0x43e2('0x19')],'include':_0x178223[_0x43e2('0x1c')]?_[_0x43e2('0x1b')](_0x178223[_0x43e2('0x1c')],function(_0x1ea844){return{'model':db[_0x1ea844[_0x43e2('0x1d')]],'as':_0x1ea844['as'],'attributes':_0x1ea844['attributes']};}):[]};}):[]};}):[]:[]})[_0x43e2('0xc')](function(_0x2f2bd8){logger['info'](_0x43e2('0x15'),_0x1b7cde);logger[_0x43e2('0x1e')](_0x43e2('0x15'),_0x1b7cde,JSON[_0x43e2('0x1f')](_0x2f2bd8));_0x15ecb5(_0x2f2bd8);})[_0x43e2('0x14')](function(_0x5a896b){logger[_0x43e2('0x10')](_0x43e2('0x15'),_0x5a896b[_0x43e2('0x12')],_0x1b7cde);_0x3236b9(_0x3ea010[_0x43e2('0x10')](0x1f4,_0x5a896b[_0x43e2('0x12')]));});});};exports[_0x43e2('0x20')]=function(_0x53f797){var _0x51226b=this;return new Promise(function(_0xe09322,_0x1dcbc8){return db[_0x43e2('0x16')][_0x43e2('0x21')]({'raw':_0x53f797[_0x43e2('0x17')]?_0x53f797['options'][_0x43e2('0x22')]===undefined?!![]:![]:!![],'where':_0x53f797[_0x43e2('0x17')]?_0x53f797[_0x43e2('0x17')][_0x43e2('0x18')]||null:null,'attributes':_0x53f797[_0x43e2('0x17')]?_0x53f797[_0x43e2('0x17')][_0x43e2('0x19')]||null:null,'include':_0x53f797['options']?_0x53f797['options'][_0x43e2('0x1c')]?_[_0x43e2('0x1b')](_0x53f797['options'][_0x43e2('0x1c')],function(_0x34effb){return{'model':db[_0x34effb['model']],'as':_0x34effb['as'],'attributes':_0x34effb[_0x43e2('0x19')],'include':_0x34effb['include']?_['map'](_0x34effb['include'],function(_0x2bb489){return{'model':db[_0x2bb489['model']],'as':_0x2bb489['as'],'attributes':_0x2bb489[_0x43e2('0x19')],'include':_0x2bb489[_0x43e2('0x1c')]?_[_0x43e2('0x1b')](_0x2bb489[_0x43e2('0x1c')],function(_0x44670b){return{'model':db[_0x44670b[_0x43e2('0x1d')]],'as':_0x44670b['as'],'attributes':_0x44670b[_0x43e2('0x19')]};}):[]};}):[]};}):[]:[]})[_0x43e2('0xc')](function(_0x1e9be1){logger[_0x43e2('0x13')](_0x43e2('0x20'),_0x53f797);logger[_0x43e2('0x1e')](_0x43e2('0x20'),_0x53f797,JSON[_0x43e2('0x1f')](_0x1e9be1));_0xe09322(_0x1e9be1);})[_0x43e2('0x14')](function(_0x40b39b){logger[_0x43e2('0x10')]('ShowFreshsalesAccount',_0x40b39b['message'],_0x53f797);_0x1dcbc8(_0x51226b['error'](0x1f4,_0x40b39b[_0x43e2('0x12')]));});});}; \ No newline at end of file +var _0xc1c6=['then','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','findAll','options','raw','where','attributes','limit','include','map','model','GetFreshsalesAccount','FreshsalesAccount','find','ShowFreshsalesAccount','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http'];(function(_0x3d823b,_0x5283e2){var _0x28b015=function(_0x3c4660){while(--_0x3c4660){_0x3d823b['push'](_0x3d823b['shift']());}};_0x28b015(++_0x5283e2);}(_0xc1c6,0xf7));var _0x6c1c=function(_0xec3556,_0x285ddf){_0xec3556=_0xec3556-0x0;var _0x2cb336=_0xc1c6[_0xec3556];return _0x2cb336;};'use strict';var _=require(_0x6c1c('0x0'));var util=require(_0x6c1c('0x1'));var moment=require(_0x6c1c('0x2'));var BPromise=require('bluebird');var rs=require(_0x6c1c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6c1c('0x4'))['db'];var utils=require(_0x6c1c('0x5'));var logger=require(_0x6c1c('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x6c1c('0x7'));var client=jayson['client'][_0x6c1c('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x582bec,_0xe510ca,_0x2eb1ba){return new BPromise(function(_0x38369d,_0x2cec58){return client['request'](_0x582bec,_0x2eb1ba)[_0x6c1c('0x9')](function(_0x3ca985){logger['info'](_0x6c1c('0xa'),_0xe510ca,_0x6c1c('0xb'));logger[_0x6c1c('0xc')](_0x6c1c('0xd'),_0xe510ca,'request\x20sent',JSON[_0x6c1c('0xe')](_0x3ca985));if(_0x3ca985[_0x6c1c('0xf')]){if(_0x3ca985[_0x6c1c('0xf')]['code']===0x1f4){logger[_0x6c1c('0xf')](_0x6c1c('0xa'),_0xe510ca,_0x3ca985[_0x6c1c('0xf')]['message']);return _0x2cec58(_0x3ca985[_0x6c1c('0xf')]['message']);}logger[_0x6c1c('0xf')](_0x6c1c('0xa'),_0xe510ca,_0x3ca985[_0x6c1c('0xf')][_0x6c1c('0x10')]);return _0x38369d(_0x3ca985[_0x6c1c('0xf')][_0x6c1c('0x10')]);}else{logger[_0x6c1c('0x11')](_0x6c1c('0xa'),_0xe510ca,_0x6c1c('0xb'));_0x38369d(_0x3ca985['result'][_0x6c1c('0x10')]);}})[_0x6c1c('0x12')](function(_0x5214ee){logger[_0x6c1c('0xf')](_0x6c1c('0xa'),_0xe510ca,_0x5214ee);_0x2cec58(_0x5214ee);});});}exports['GetFreshsalesAccount']=function(_0x137770){var _0x4ede06=this;return new Promise(function(_0x338dc2,_0x1a0ab9){return db['FreshsalesAccount'][_0x6c1c('0x13')]({'raw':_0x137770['options']?_0x137770[_0x6c1c('0x14')][_0x6c1c('0x15')]===undefined?!![]:![]:!![],'where':_0x137770[_0x6c1c('0x14')]?_0x137770[_0x6c1c('0x14')][_0x6c1c('0x16')]||null:null,'attributes':_0x137770[_0x6c1c('0x14')]?_0x137770[_0x6c1c('0x14')][_0x6c1c('0x17')]||null:null,'limit':_0x137770[_0x6c1c('0x14')]?_0x137770[_0x6c1c('0x14')][_0x6c1c('0x18')]||null:null,'include':_0x137770[_0x6c1c('0x14')]?_0x137770[_0x6c1c('0x14')][_0x6c1c('0x19')]?_[_0x6c1c('0x1a')](_0x137770[_0x6c1c('0x14')][_0x6c1c('0x19')],function(_0x12c638){return{'model':db[_0x12c638[_0x6c1c('0x1b')]],'as':_0x12c638['as'],'attributes':_0x12c638[_0x6c1c('0x17')],'include':_0x12c638[_0x6c1c('0x19')]?_[_0x6c1c('0x1a')](_0x12c638[_0x6c1c('0x19')],function(_0x7ff10d){return{'model':db[_0x7ff10d[_0x6c1c('0x1b')]],'as':_0x7ff10d['as'],'attributes':_0x7ff10d[_0x6c1c('0x17')],'include':_0x7ff10d[_0x6c1c('0x19')]?_[_0x6c1c('0x1a')](_0x7ff10d[_0x6c1c('0x19')],function(_0x5f4568){return{'model':db[_0x5f4568[_0x6c1c('0x1b')]],'as':_0x5f4568['as'],'attributes':_0x5f4568['attributes']};}):[]};}):[]};}):[]:[]})[_0x6c1c('0x9')](function(_0x4c23f8){logger[_0x6c1c('0x11')]('GetFreshsalesAccount',_0x137770);logger[_0x6c1c('0xc')](_0x6c1c('0x1c'),_0x137770,JSON['stringify'](_0x4c23f8));_0x338dc2(_0x4c23f8);})[_0x6c1c('0x12')](function(_0x24da4c){logger['error'](_0x6c1c('0x1c'),_0x24da4c[_0x6c1c('0x10')],_0x137770);_0x1a0ab9(_0x4ede06[_0x6c1c('0xf')](0x1f4,_0x24da4c[_0x6c1c('0x10')]));});});};exports['ShowFreshsalesAccount']=function(_0x52c036){var _0x3cba17=this;return new Promise(function(_0x45128c,_0x21acef){return db[_0x6c1c('0x1d')][_0x6c1c('0x1e')]({'raw':_0x52c036[_0x6c1c('0x14')]?_0x52c036['options'][_0x6c1c('0x15')]===undefined?!![]:![]:!![],'where':_0x52c036[_0x6c1c('0x14')]?_0x52c036['options'][_0x6c1c('0x16')]||null:null,'attributes':_0x52c036[_0x6c1c('0x14')]?_0x52c036[_0x6c1c('0x14')][_0x6c1c('0x17')]||null:null,'include':_0x52c036['options']?_0x52c036[_0x6c1c('0x14')][_0x6c1c('0x19')]?_[_0x6c1c('0x1a')](_0x52c036['options'][_0x6c1c('0x19')],function(_0x4e5767){return{'model':db[_0x4e5767[_0x6c1c('0x1b')]],'as':_0x4e5767['as'],'attributes':_0x4e5767['attributes'],'include':_0x4e5767[_0x6c1c('0x19')]?_[_0x6c1c('0x1a')](_0x4e5767[_0x6c1c('0x19')],function(_0x54b8d3){return{'model':db[_0x54b8d3['model']],'as':_0x54b8d3['as'],'attributes':_0x54b8d3[_0x6c1c('0x17')],'include':_0x54b8d3[_0x6c1c('0x19')]?_[_0x6c1c('0x1a')](_0x54b8d3['include'],function(_0x1a9132){return{'model':db[_0x1a9132['model']],'as':_0x1a9132['as'],'attributes':_0x1a9132['attributes']};}):[]};}):[]};}):[]:[]})[_0x6c1c('0x9')](function(_0xbafcb3){logger[_0x6c1c('0x11')](_0x6c1c('0x1f'),_0x52c036);logger['debug'](_0x6c1c('0x1f'),_0x52c036,JSON[_0x6c1c('0xe')](_0xbafcb3));_0x45128c(_0xbafcb3);})[_0x6c1c('0x12')](function(_0x18da02){logger[_0x6c1c('0xf')](_0x6c1c('0x1f'),_0x18da02[_0x6c1c('0x10')],_0x52c036);_0x21acef(_0x3cba17[_0x6c1c('0xf')](0x1f4,_0x18da02[_0x6c1c('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 43ac580..4b8c483 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 _0x8b8a=['./intFreshsalesConfiguration.controller','get','index','/:id','show','isAuthenticated','getSubjects','/:id/descriptions','/:id/fields','getFields','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment'];(function(_0x246b8d,_0x2ae345){var _0x5d4ad5=function(_0xbec604){while(--_0xbec604){_0x246b8d['push'](_0x246b8d['shift']());}};_0x5d4ad5(++_0x2ae345);}(_0x8b8a,0x181));var _0xa8b8=function(_0x3e96f6,_0x55107a){_0x3e96f6=_0x3e96f6-0x0;var _0x25a073=_0x8b8a[_0x3e96f6];return _0x25a073;};'use strict';var multer=require('multer');var util=require(_0xa8b8('0x0'));var path=require(_0xa8b8('0x1'));var timeout=require(_0xa8b8('0x2'));var express=require('express');var router=express[_0xa8b8('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xa8b8('0x4'));var config=require(_0xa8b8('0x5'));var controller=require(_0xa8b8('0x6'));router[_0xa8b8('0x7')]('/',auth['isAuthenticated'](),controller[_0xa8b8('0x8')]);router[_0xa8b8('0x7')](_0xa8b8('0x9'),auth['isAuthenticated'](),controller[_0xa8b8('0xa')]);router['get']('/:id/subjects',auth[_0xa8b8('0xb')](),controller[_0xa8b8('0xc')]);router[_0xa8b8('0x7')](_0xa8b8('0xd'),auth['isAuthenticated'](),controller['getDescriptions']);router[_0xa8b8('0x7')](_0xa8b8('0xe'),auth['isAuthenticated'](),controller[_0xa8b8('0xf')]);router[_0xa8b8('0x10')]('/',auth['isAuthenticated'](),controller[_0xa8b8('0x11')]);router[_0xa8b8('0x12')](_0xa8b8('0x9'),auth[_0xa8b8('0xb')](),controller[_0xa8b8('0x13')]);router[_0xa8b8('0x14')]('/:id',auth[_0xa8b8('0xb')](),controller[_0xa8b8('0x15')]);module[_0xa8b8('0x16')]=router; \ No newline at end of file +var _0x25e2=['destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','index','get','/:id','isAuthenticated','/:id/subjects','/:id/descriptions','getDescriptions','getFields','post','create','update','delete'];(function(_0x3dca5f,_0x3bf609){var _0x2ad290=function(_0x35ca60){while(--_0x35ca60){_0x3dca5f['push'](_0x3dca5f['shift']());}};_0x2ad290(++_0x3bf609);}(_0x25e2,0xa3));var _0x225e=function(_0x36e7da,_0x3cda27){_0x36e7da=_0x36e7da-0x0;var _0x487eb8=_0x25e2[_0x36e7da];return _0x487eb8;};'use strict';var multer=require(_0x225e('0x0'));var util=require('util');var path=require(_0x225e('0x1'));var timeout=require(_0x225e('0x2'));var express=require(_0x225e('0x3'));var router=express[_0x225e('0x4')]();var fs_extra=require(_0x225e('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x225e('0x6'));var config=require(_0x225e('0x7'));var controller=require(_0x225e('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x225e('0x9')]);router[_0x225e('0xa')](_0x225e('0xb'),auth[_0x225e('0xc')](),controller['show']);router[_0x225e('0xa')](_0x225e('0xd'),auth[_0x225e('0xc')](),controller['getSubjects']);router[_0x225e('0xa')](_0x225e('0xe'),auth[_0x225e('0xc')](),controller[_0x225e('0xf')]);router[_0x225e('0xa')]('/:id/fields',auth[_0x225e('0xc')](),controller[_0x225e('0x10')]);router[_0x225e('0x11')]('/',auth[_0x225e('0xc')](),controller[_0x225e('0x12')]);router['put'](_0x225e('0xb'),auth[_0x225e('0xc')](),controller[_0x225e('0x13')]);router[_0x225e('0x14')]('/:id',auth[_0x225e('0xc')](),controller[_0x225e('0x15')]);module[_0x225e('0x16')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index 9b0ae0e..6884c3d 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 _0x90ce=['STRING','sequelize','exports'];(function(_0x1f8e33,_0x300371){var _0x37b939=function(_0x4d4fa4){while(--_0x4d4fa4){_0x1f8e33['push'](_0x1f8e33['shift']());}};_0x37b939(++_0x300371);}(_0x90ce,0x15a));var _0xe90c=function(_0x211fef,_0x4ab716){_0x211fef=_0x211fef-0x0;var _0x5447bf=_0x90ce[_0x211fef];return _0x5447bf;};'use strict';var Sequelize=require(_0xe90c('0x0'));module[_0xe90c('0x1')]={'name':{'type':Sequelize[_0xe90c('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x6c15=['exports','STRING'];(function(_0x475d8c,_0x326be6){var _0x2d58be=function(_0xdf90ba){while(--_0xdf90ba){_0x475d8c['push'](_0x475d8c['shift']());}};_0x2d58be(++_0x326be6);}(_0x6c15,0x7a));var _0x56c1=function(_0x4f613c,_0x425015){_0x4f613c=_0x4f613c-0x0;var _0x50cffd=_0x6c15[_0x4f613c];return _0x50cffd;};'use strict';var Sequelize=require('sequelize');module[_0x56c1('0x0')]={'name':{'type':Sequelize[_0x56c1('0x1')]},'description':{'type':Sequelize[_0x56c1('0x1')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index d19e64f..7572a35 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 _0x75ee=['options','FreshsalesConfiguration','includeAll','findAll','rows','catch','show','params','create','body','find','getSubjects','sort','nolimit','findOne','FreshsalesField','getDescriptions','getFields','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','map','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','where','pick','filter','merge','type'];(function(_0x35aade,_0x9b4cc0){var _0x1a9a28=function(_0x3d1ac6){while(--_0x3d1ac6){_0x35aade['push'](_0x35aade['shift']());}};_0x1a9a28(++_0x9b4cc0);}(_0x75ee,0x13e));var _0xe75e=function(_0x1d80be,_0x3a60ff){_0x1d80be=_0x1d80be-0x0;var _0xf9a4f3=_0x75ee[_0x1d80be];return _0xf9a4f3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe75e('0x0'));var zipdir=require(_0xe75e('0x1'));var jsonpatch=require(_0xe75e('0x2'));var rp=require('request-promise');var moment=require(_0xe75e('0x3'));var BPromise=require(_0xe75e('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xe75e('0x5'));var sox=require('sox');var csv=require(_0xe75e('0x6'));var ejs=require(_0xe75e('0x7'));var fs=require('fs');var fs_extra=require(_0xe75e('0x8'));var _=require(_0xe75e('0x9'));var squel=require(_0xe75e('0xa'));var crypto=require(_0xe75e('0xb'));var jsforce=require(_0xe75e('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xe75e('0x6'));var querystring=require(_0xe75e('0xd'));var Papa=require(_0xe75e('0xe'));var Redis=require('ioredis');var authService=require(_0xe75e('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe75e('0x10'));var logger=require(_0xe75e('0x11'))(_0xe75e('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xe75e('0x13'))['db'];function respondWithStatusCode(_0x1cfbf1,_0x5c6042){_0x5c6042=_0x5c6042||0xcc;return function(_0x15d060){if(_0x15d060){return _0x1cfbf1[_0xe75e('0x14')](_0x5c6042);}return _0x1cfbf1[_0xe75e('0x15')](_0x5c6042)[_0xe75e('0x16')]();};}function respondWithResult(_0x4b6962,_0x1e46fe){_0x1e46fe=_0x1e46fe||0xc8;return function(_0x4dfc0e){if(_0x4dfc0e){return _0x4b6962[_0xe75e('0x15')](_0x1e46fe)['json'](_0x4dfc0e);}};}function respondWithFilteredResult(_0x176fc3,_0x5567c5){return function(_0x4e7f1c){if(_0x4e7f1c){var _0x52c155=typeof _0x5567c5[_0xe75e('0x17')]===_0xe75e('0x18')&&typeof _0x5567c5[_0xe75e('0x19')]===_0xe75e('0x18');var _0x1b3be3=_0x4e7f1c[_0xe75e('0x1a')];var _0x15614a=_0x52c155?0x0:_0x5567c5[_0xe75e('0x17')];var _0x583072=_0x52c155?_0x4e7f1c[_0xe75e('0x1a')]:_0x5567c5[_0xe75e('0x17')]+_0x5567c5[_0xe75e('0x19')];var _0x4333af;if(_0x583072>=_0x1b3be3){_0x583072=_0x1b3be3;_0x4333af=0xc8;}else{_0x4333af=0xce;}_0x176fc3[_0xe75e('0x15')](_0x4333af);return _0x176fc3[_0xe75e('0x1b')](_0xe75e('0x1c'),_0x15614a+'-'+_0x583072+'/'+_0x1b3be3)['json'](_0x4e7f1c);}return null;};}function patchUpdates(_0x3e11f4){return function(_0x17c503){try{jsonpatch['apply'](_0x17c503,_0x3e11f4,!![]);}catch(_0x1afa77){return BPromise[_0xe75e('0x1d')](_0x1afa77);}return _0x17c503[_0xe75e('0x1e')]();};}function saveUpdates(_0x2e86a2,_0x3ab2de){return function(_0x21e6ef){if(_0x21e6ef){return _0x21e6ef[_0xe75e('0x1f')](_0x2e86a2)[_0xe75e('0x20')](function(_0xfecd3a){return _0xfecd3a;});}return null;};}function removeEntity(_0x20e643,_0x24957c){return function(_0x55e15e){if(_0x55e15e){return _0x55e15e[_0xe75e('0x21')]()[_0xe75e('0x20')](function(){_0x20e643[_0xe75e('0x15')](0xcc)[_0xe75e('0x16')]();});}};}function handleEntityNotFound(_0x143bfe,_0x565a60){return function(_0x20a9e3){if(!_0x20a9e3){_0x143bfe[_0xe75e('0x14')](0x194);}return _0x20a9e3;};}function handleError(_0x1d1e93,_0xe0a8e2){_0xe0a8e2=_0xe0a8e2||0x1f4;return function(_0x1886a9){logger[_0xe75e('0x22')](_0x1886a9[_0xe75e('0x23')]);if(_0x1886a9[_0xe75e('0x24')]){delete _0x1886a9['name'];}_0x1d1e93[_0xe75e('0x15')](_0xe0a8e2)[_0xe75e('0x25')](_0x1886a9);};}exports['index']=function(_0xed16bf,_0x5d1d2c){var _0x384aff={},_0x35591a={},_0x520bca={'count':0x0,'rows':[]};var _0x13b40=_[_0xe75e('0x26')](db['FreshsalesConfiguration'][_0xe75e('0x27')],function(_0x492b7a){return{'name':_0x492b7a[_0xe75e('0x28')],'type':_0x492b7a['type'][_0xe75e('0x29')]};});_0x35591a[_0xe75e('0x2a')]=_['map'](_0x13b40,_0xe75e('0x24'));_0x35591a['query']=_[_0xe75e('0x2b')](_0xed16bf[_0xe75e('0x2c')]);_0x35591a[_0xe75e('0x2d')]=_[_0xe75e('0x2e')](_0x35591a[_0xe75e('0x2a')],_0x35591a[_0xe75e('0x2c')]);_0x384aff[_0xe75e('0x2f')]=_['intersection'](_0x35591a[_0xe75e('0x2a')],qs[_0xe75e('0x30')](_0xed16bf[_0xe75e('0x2c')][_0xe75e('0x30')]));_0x384aff[_0xe75e('0x2f')]=_0x384aff['attributes'][_0xe75e('0x31')]?_0x384aff[_0xe75e('0x2f')]:_0x35591a[_0xe75e('0x2a')];if(!_0xed16bf[_0xe75e('0x2c')][_0xe75e('0x32')]('nolimit')){_0x384aff[_0xe75e('0x19')]=qs[_0xe75e('0x19')](_0xed16bf[_0xe75e('0x2c')][_0xe75e('0x19')]);_0x384aff['offset']=qs['offset'](_0xed16bf[_0xe75e('0x2c')][_0xe75e('0x17')]);}_0x384aff[_0xe75e('0x33')]=qs['sort'](_0xed16bf[_0xe75e('0x2c')]['sort']);_0x384aff[_0xe75e('0x34')]=qs[_0xe75e('0x2d')](_[_0xe75e('0x35')](_0xed16bf[_0xe75e('0x2c')],_0x35591a['filters']),_0x13b40);if(_0xed16bf[_0xe75e('0x2c')][_0xe75e('0x36')]){_0x384aff['where']=_[_0xe75e('0x37')](_0x384aff[_0xe75e('0x34')],{'$or':_[_0xe75e('0x26')](_0x13b40,function(_0x37bfca){if(_0x37bfca[_0xe75e('0x38')]!=='VIRTUAL'){var _0x3fc31f={};_0x3fc31f[_0x37bfca[_0xe75e('0x24')]]={'$like':'%'+_0xed16bf[_0xe75e('0x2c')][_0xe75e('0x36')]+'%'};return _0x3fc31f;}})});}_0x384aff=_[_0xe75e('0x37')]({},_0x384aff,_0xed16bf[_0xe75e('0x39')]);var _0x21bfc8={'where':_0x384aff[_0xe75e('0x34')]};return db[_0xe75e('0x3a')][_0xe75e('0x1a')](_0x21bfc8)['then'](function(_0x53574d){_0x520bca[_0xe75e('0x1a')]=_0x53574d;if(_0xed16bf[_0xe75e('0x2c')][_0xe75e('0x3b')]){_0x384aff['include']=[{'all':!![]}];}return db['FreshsalesConfiguration'][_0xe75e('0x3c')](_0x384aff);})['then'](function(_0x5b7b51){_0x520bca[_0xe75e('0x3d')]=_0x5b7b51;return _0x520bca;})[_0xe75e('0x20')](respondWithFilteredResult(_0x5d1d2c,_0x384aff))[_0xe75e('0x3e')](handleError(_0x5d1d2c,null));};exports[_0xe75e('0x3f')]=function(_0x49462e,_0x19e5d8){var _0x3f9085={'raw':![],'where':{'id':_0x49462e[_0xe75e('0x40')]['id']}},_0x463822={};_0x463822[_0xe75e('0x2a')]=_[_0xe75e('0x2b')](db[_0xe75e('0x3a')][_0xe75e('0x27')]);_0x463822[_0xe75e('0x2c')]=_[_0xe75e('0x2b')](_0x49462e[_0xe75e('0x2c')]);_0x463822['filters']=_[_0xe75e('0x2e')](_0x463822[_0xe75e('0x2a')],_0x463822[_0xe75e('0x2c')]);_0x3f9085[_0xe75e('0x2f')]=_[_0xe75e('0x2e')](_0x463822[_0xe75e('0x2a')],qs[_0xe75e('0x30')](_0x49462e[_0xe75e('0x2c')][_0xe75e('0x30')]));_0x3f9085['attributes']=_0x3f9085[_0xe75e('0x2f')][_0xe75e('0x31')]?_0x3f9085[_0xe75e('0x2f')]:_0x463822[_0xe75e('0x2a')];if(_0x49462e[_0xe75e('0x2c')][_0xe75e('0x3b')]){_0x3f9085['include']=[{'all':!![]}];}_0x3f9085=_[_0xe75e('0x37')]({},_0x3f9085,_0x49462e[_0xe75e('0x39')]);return db[_0xe75e('0x3a')]['find'](_0x3f9085)[_0xe75e('0x20')](handleEntityNotFound(_0x19e5d8,null))['then'](respondWithResult(_0x19e5d8,null))[_0xe75e('0x3e')](handleError(_0x19e5d8,null));};exports[_0xe75e('0x41')]=function(_0x1ddeb8,_0x58d67f){return db[_0xe75e('0x3a')][_0xe75e('0x41')](_0x1ddeb8[_0xe75e('0x42')],{})[_0xe75e('0x20')](respondWithResult(_0x58d67f,0xc9))[_0xe75e('0x3e')](handleError(_0x58d67f,null));};exports[_0xe75e('0x1f')]=function(_0x3eb377,_0x4d6c38){if(_0x3eb377[_0xe75e('0x42')]['id']){delete _0x3eb377[_0xe75e('0x42')]['id'];}return db[_0xe75e('0x3a')][_0xe75e('0x43')]({'where':{'id':_0x3eb377['params']['id']}})[_0xe75e('0x20')](handleEntityNotFound(_0x4d6c38,null))[_0xe75e('0x20')](saveUpdates(_0x3eb377['body'],null))[_0xe75e('0x20')](respondWithResult(_0x4d6c38,null))[_0xe75e('0x3e')](handleError(_0x4d6c38,null));};exports[_0xe75e('0x21')]=function(_0x3984d4,_0x14989f){return db['FreshsalesConfiguration'][_0xe75e('0x43')]({'where':{'id':_0x3984d4[_0xe75e('0x40')]['id']}})[_0xe75e('0x20')](handleEntityNotFound(_0x14989f,null))[_0xe75e('0x20')](removeEntity(_0x14989f,null))[_0xe75e('0x3e')](handleError(_0x14989f,null));};exports[_0xe75e('0x44')]=function(_0x5a923f,_0x5b0f7b,_0x3d6ea5){var _0x261020={};var _0x58c3c8={};var _0x3d828a;var _0x103c08;return db[_0xe75e('0x3a')]['findOne']({'where':{'id':_0x5a923f[_0xe75e('0x40')]['id']}})[_0xe75e('0x20')](handleEntityNotFound(_0x5b0f7b,null))['then'](function(_0x5b1d4f){if(_0x5b1d4f){_0x3d828a=_0x5b1d4f;_0x58c3c8['model']=_['keys'](db['FreshsalesField'][_0xe75e('0x27')]);_0x58c3c8[_0xe75e('0x2c')]=_[_0xe75e('0x2b')](_0x5a923f[_0xe75e('0x2c')]);_0x58c3c8[_0xe75e('0x2d')]=_[_0xe75e('0x2e')](_0x58c3c8[_0xe75e('0x2a')],_0x58c3c8[_0xe75e('0x2c')]);_0x261020['attributes']=_[_0xe75e('0x2e')](_0x58c3c8['model'],qs[_0xe75e('0x30')](_0x5a923f[_0xe75e('0x2c')][_0xe75e('0x30')]));_0x261020['attributes']=_0x261020[_0xe75e('0x2f')][_0xe75e('0x31')]?_0x261020[_0xe75e('0x2f')]:_0x58c3c8[_0xe75e('0x2a')];_0x261020[_0xe75e('0x33')]=qs[_0xe75e('0x45')](_0x5a923f[_0xe75e('0x2c')][_0xe75e('0x45')]);_0x261020[_0xe75e('0x34')]=qs[_0xe75e('0x2d')](_['pick'](_0x5a923f['query'],_0x58c3c8[_0xe75e('0x2d')]));if(_0x5a923f[_0xe75e('0x2c')][_0xe75e('0x36')]){_0x261020[_0xe75e('0x34')]=_[_0xe75e('0x37')](_0x261020['where'],{'$or':_[_0xe75e('0x26')](_0x261020['attributes'],function(_0x268979){var _0x40c07d={};_0x40c07d[_0x268979]={'$like':'%'+_0x5a923f[_0xe75e('0x2c')][_0xe75e('0x36')]+'%'};return _0x40c07d;})});}_0x261020=_[_0xe75e('0x37')]({},_0x261020,_0x5a923f[_0xe75e('0x39')]);return _0x3d828a[_0xe75e('0x44')](_0x261020);}})[_0xe75e('0x20')](function(_0x423d2b){if(_0x423d2b){_0x103c08=_0x423d2b[_0xe75e('0x31')];if(!_0x5a923f[_0xe75e('0x2c')][_0xe75e('0x32')](_0xe75e('0x46'))){_0x261020[_0xe75e('0x19')]=qs[_0xe75e('0x19')](_0x5a923f[_0xe75e('0x2c')][_0xe75e('0x19')]);_0x261020[_0xe75e('0x17')]=qs[_0xe75e('0x17')](_0x5a923f['query'][_0xe75e('0x17')]);}return _0x3d828a[_0xe75e('0x44')](_0x261020);}})[_0xe75e('0x20')](function(_0x5c5b8e){if(_0x5c5b8e){return _0x5c5b8e?{'count':_0x103c08,'rows':_0x5c5b8e}:null;}})[_0xe75e('0x20')](respondWithResult(_0x5b0f7b,null))[_0xe75e('0x3e')](handleError(_0x5b0f7b,null));};exports['getDescriptions']=function(_0x47af24,_0x2798dd,_0x499a77){var _0x222717={};var _0x3771bb={};var _0x1abe96;var _0xc42ed2;return db['FreshsalesConfiguration'][_0xe75e('0x47')]({'where':{'id':_0x47af24[_0xe75e('0x40')]['id']}})['then'](handleEntityNotFound(_0x2798dd,null))['then'](function(_0x291138){if(_0x291138){_0x1abe96=_0x291138;_0x3771bb[_0xe75e('0x2a')]=_[_0xe75e('0x2b')](db[_0xe75e('0x48')]['rawAttributes']);_0x3771bb[_0xe75e('0x2c')]=_[_0xe75e('0x2b')](_0x47af24[_0xe75e('0x2c')]);_0x3771bb[_0xe75e('0x2d')]=_[_0xe75e('0x2e')](_0x3771bb[_0xe75e('0x2a')],_0x3771bb[_0xe75e('0x2c')]);_0x222717[_0xe75e('0x2f')]=_[_0xe75e('0x2e')](_0x3771bb[_0xe75e('0x2a')],qs['fields'](_0x47af24['query'][_0xe75e('0x30')]));_0x222717[_0xe75e('0x2f')]=_0x222717[_0xe75e('0x2f')][_0xe75e('0x31')]?_0x222717[_0xe75e('0x2f')]:_0x3771bb['model'];_0x222717[_0xe75e('0x33')]=qs[_0xe75e('0x45')](_0x47af24[_0xe75e('0x2c')][_0xe75e('0x45')]);_0x222717['where']=qs['filters'](_['pick'](_0x47af24[_0xe75e('0x2c')],_0x3771bb[_0xe75e('0x2d')]));if(_0x47af24[_0xe75e('0x2c')][_0xe75e('0x36')]){_0x222717[_0xe75e('0x34')]=_[_0xe75e('0x37')](_0x222717[_0xe75e('0x34')],{'$or':_[_0xe75e('0x26')](_0x222717[_0xe75e('0x2f')],function(_0x6a21be){var _0xacc7ad={};_0xacc7ad[_0x6a21be]={'$like':'%'+_0x47af24[_0xe75e('0x2c')]['filter']+'%'};return _0xacc7ad;})});}_0x222717=_[_0xe75e('0x37')]({},_0x222717,_0x47af24[_0xe75e('0x39')]);return _0x1abe96[_0xe75e('0x49')](_0x222717);}})[_0xe75e('0x20')](function(_0x2fa086){if(_0x2fa086){_0xc42ed2=_0x2fa086[_0xe75e('0x31')];if(!_0x47af24[_0xe75e('0x2c')][_0xe75e('0x32')]('nolimit')){_0x222717['limit']=qs['limit'](_0x47af24[_0xe75e('0x2c')][_0xe75e('0x19')]);_0x222717['offset']=qs[_0xe75e('0x17')](_0x47af24[_0xe75e('0x2c')][_0xe75e('0x17')]);}return _0x1abe96[_0xe75e('0x49')](_0x222717);}})['then'](function(_0x2e1ee2){if(_0x2e1ee2){return _0x2e1ee2?{'count':_0xc42ed2,'rows':_0x2e1ee2}:null;}})[_0xe75e('0x20')](respondWithResult(_0x2798dd,null))[_0xe75e('0x3e')](handleError(_0x2798dd,null));};exports['getFields']=function(_0x33d010,_0x4259ac,_0x4f4e69){var _0x56c160={};var _0x3ea954={};var _0x65d115;var _0xe6f06b;return db['FreshsalesConfiguration'][_0xe75e('0x47')]({'where':{'id':_0x33d010[_0xe75e('0x40')]['id']}})[_0xe75e('0x20')](handleEntityNotFound(_0x4259ac,null))['then'](function(_0x6b9ecc){if(_0x6b9ecc){_0x65d115=_0x6b9ecc;_0x3ea954['model']=_[_0xe75e('0x2b')](db[_0xe75e('0x48')][_0xe75e('0x27')]);_0x3ea954[_0xe75e('0x2c')]=_[_0xe75e('0x2b')](_0x33d010['query']);_0x3ea954[_0xe75e('0x2d')]=_[_0xe75e('0x2e')](_0x3ea954[_0xe75e('0x2a')],_0x3ea954[_0xe75e('0x2c')]);_0x56c160[_0xe75e('0x2f')]=_[_0xe75e('0x2e')](_0x3ea954['model'],qs[_0xe75e('0x30')](_0x33d010[_0xe75e('0x2c')][_0xe75e('0x30')]));_0x56c160[_0xe75e('0x2f')]=_0x56c160[_0xe75e('0x2f')][_0xe75e('0x31')]?_0x56c160[_0xe75e('0x2f')]:_0x3ea954[_0xe75e('0x2a')];_0x56c160[_0xe75e('0x33')]=qs[_0xe75e('0x45')](_0x33d010[_0xe75e('0x2c')]['sort']);_0x56c160['where']=qs[_0xe75e('0x2d')](_[_0xe75e('0x35')](_0x33d010['query'],_0x3ea954[_0xe75e('0x2d')]));if(_0x33d010[_0xe75e('0x2c')][_0xe75e('0x36')]){_0x56c160[_0xe75e('0x34')]=_[_0xe75e('0x37')](_0x56c160['where'],{'$or':_['map'](_0x56c160[_0xe75e('0x2f')],function(_0x41e375){var _0x48bfcd={};_0x48bfcd[_0x41e375]={'$like':'%'+_0x33d010['query'][_0xe75e('0x36')]+'%'};return _0x48bfcd;})});}_0x56c160=_[_0xe75e('0x37')]({},_0x56c160,_0x33d010[_0xe75e('0x39')]);return _0x65d115[_0xe75e('0x4a')](_0x56c160);}})[_0xe75e('0x20')](function(_0x55b6b6){if(_0x55b6b6){_0xe6f06b=_0x55b6b6[_0xe75e('0x31')];if(!_0x33d010[_0xe75e('0x2c')][_0xe75e('0x32')](_0xe75e('0x46'))){_0x56c160[_0xe75e('0x19')]=qs[_0xe75e('0x19')](_0x33d010['query']['limit']);_0x56c160[_0xe75e('0x17')]=qs['offset'](_0x33d010[_0xe75e('0x2c')][_0xe75e('0x17')]);}return _0x65d115[_0xe75e('0x4a')](_0x56c160);}})[_0xe75e('0x20')](function(_0x449293){if(_0x449293){return _0x449293?{'count':_0xe6f06b,'rows':_0x449293}:null;}})['then'](respondWithResult(_0x4259ac,null))[_0xe75e('0x3e')](handleError(_0x4259ac,null));}; \ No newline at end of file +var _0x7313=['findAll','rows','catch','show','params','includeAll','include','find','create','body','destroy','getSubjects','FreshsalesField','nolimit','getDescriptions','findOne','getFields','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','reject','update','then','error','name','send','index','map','FreshsalesConfiguration','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options'];(function(_0x340bc6,_0x4622c4){var _0x40004e=function(_0x5794fc){while(--_0x5794fc){_0x340bc6['push'](_0x340bc6['shift']());}};_0x40004e(++_0x4622c4);}(_0x7313,0x1f1));var _0x3731=function(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0x7313[_0x4e1d03];return _0x362d4b;};'use strict';var emlformat=require(_0x3731('0x0'));var rimraf=require(_0x3731('0x1'));var zipdir=require(_0x3731('0x2'));var jsonpatch=require(_0x3731('0x3'));var rp=require(_0x3731('0x4'));var moment=require(_0x3731('0x5'));var BPromise=require(_0x3731('0x6'));var Mustache=require(_0x3731('0x7'));var util=require(_0x3731('0x8'));var path=require('path');var sox=require(_0x3731('0x9'));var csv=require(_0x3731('0xa'));var ejs=require(_0x3731('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x3731('0xc'));var crypto=require(_0x3731('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x3731('0xe'));var authService=require(_0x3731('0xf'));var qs=require(_0x3731('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3731('0x11'));var logger=require(_0x3731('0x12'))(_0x3731('0x13'));var utils=require(_0x3731('0x14'));var config=require(_0x3731('0x15'));var licenseUtil=require(_0x3731('0x16'));var db=require(_0x3731('0x17'))['db'];function respondWithStatusCode(_0x2eb27c,_0xb6da89){_0xb6da89=_0xb6da89||0xcc;return function(_0x4874ed){if(_0x4874ed){return _0x2eb27c[_0x3731('0x18')](_0xb6da89);}return _0x2eb27c[_0x3731('0x19')](_0xb6da89)[_0x3731('0x1a')]();};}function respondWithResult(_0x1e53ca,_0x171268){_0x171268=_0x171268||0xc8;return function(_0x1bbac3){if(_0x1bbac3){return _0x1e53ca[_0x3731('0x19')](_0x171268)[_0x3731('0x1b')](_0x1bbac3);}};}function respondWithFilteredResult(_0x365127,_0x233e97){return function(_0x4db6c2){if(_0x4db6c2){var _0xbc4942=typeof _0x233e97[_0x3731('0x1c')]==='undefined'&&typeof _0x233e97['limit']===_0x3731('0x1d');var _0x645f50=_0x4db6c2[_0x3731('0x1e')];var _0xf74768=_0xbc4942?0x0:_0x233e97[_0x3731('0x1c')];var _0x2a5dc3=_0xbc4942?_0x4db6c2[_0x3731('0x1e')]:_0x233e97[_0x3731('0x1c')]+_0x233e97[_0x3731('0x1f')];var _0x4392c8;if(_0x2a5dc3>=_0x645f50){_0x2a5dc3=_0x645f50;_0x4392c8=0xc8;}else{_0x4392c8=0xce;}_0x365127[_0x3731('0x19')](_0x4392c8);return _0x365127['set'](_0x3731('0x20'),_0xf74768+'-'+_0x2a5dc3+'/'+_0x645f50)[_0x3731('0x1b')](_0x4db6c2);}return null;};}function patchUpdates(_0x29ea30){return function(_0x135f37){try{jsonpatch['apply'](_0x135f37,_0x29ea30,!![]);}catch(_0x5e1d1d){return BPromise[_0x3731('0x21')](_0x5e1d1d);}return _0x135f37['save']();};}function saveUpdates(_0x5cc0db,_0x2c85df){return function(_0x5c6960){if(_0x5c6960){return _0x5c6960[_0x3731('0x22')](_0x5cc0db)[_0x3731('0x23')](function(_0x2f8620){return _0x2f8620;});}return null;};}function removeEntity(_0x56aa86,_0x4fa88d){return function(_0x14f652){if(_0x14f652){return _0x14f652['destroy']()['then'](function(){_0x56aa86[_0x3731('0x19')](0xcc)[_0x3731('0x1a')]();});}};}function handleEntityNotFound(_0x35e8e3,_0x3e83fd){return function(_0x20e05d){if(!_0x20e05d){_0x35e8e3[_0x3731('0x18')](0x194);}return _0x20e05d;};}function handleError(_0xa04331,_0x11738e){_0x11738e=_0x11738e||0x1f4;return function(_0x2d6d04){logger[_0x3731('0x24')](_0x2d6d04['stack']);if(_0x2d6d04[_0x3731('0x25')]){delete _0x2d6d04[_0x3731('0x25')];}_0xa04331['status'](_0x11738e)[_0x3731('0x26')](_0x2d6d04);};}exports[_0x3731('0x27')]=function(_0x4e2801,_0x1eb813){var _0x5f32d0={},_0x5a4d95={},_0x16b309={'count':0x0,'rows':[]};var _0x373d40=_[_0x3731('0x28')](db[_0x3731('0x29')][_0x3731('0x2a')],function(_0xbd03fd){return{'name':_0xbd03fd[_0x3731('0x2b')],'type':_0xbd03fd['type'][_0x3731('0x2c')]};});_0x5a4d95[_0x3731('0x2d')]=_['map'](_0x373d40,'name');_0x5a4d95['query']=_[_0x3731('0x2e')](_0x4e2801[_0x3731('0x2f')]);_0x5a4d95[_0x3731('0x30')]=_[_0x3731('0x31')](_0x5a4d95[_0x3731('0x2d')],_0x5a4d95[_0x3731('0x2f')]);_0x5f32d0[_0x3731('0x32')]=_[_0x3731('0x31')](_0x5a4d95[_0x3731('0x2d')],qs[_0x3731('0x33')](_0x4e2801[_0x3731('0x2f')][_0x3731('0x33')]));_0x5f32d0['attributes']=_0x5f32d0[_0x3731('0x32')][_0x3731('0x34')]?_0x5f32d0[_0x3731('0x32')]:_0x5a4d95[_0x3731('0x2d')];if(!_0x4e2801[_0x3731('0x2f')][_0x3731('0x35')]('nolimit')){_0x5f32d0['limit']=qs[_0x3731('0x1f')](_0x4e2801[_0x3731('0x2f')][_0x3731('0x1f')]);_0x5f32d0[_0x3731('0x1c')]=qs[_0x3731('0x1c')](_0x4e2801[_0x3731('0x2f')][_0x3731('0x1c')]);}_0x5f32d0[_0x3731('0x36')]=qs[_0x3731('0x37')](_0x4e2801[_0x3731('0x2f')]['sort']);_0x5f32d0[_0x3731('0x38')]=qs[_0x3731('0x30')](_[_0x3731('0x39')](_0x4e2801[_0x3731('0x2f')],_0x5a4d95[_0x3731('0x30')]),_0x373d40);if(_0x4e2801[_0x3731('0x2f')][_0x3731('0x3a')]){_0x5f32d0[_0x3731('0x38')]=_[_0x3731('0x3b')](_0x5f32d0['where'],{'$or':_[_0x3731('0x28')](_0x373d40,function(_0x2542ef){if(_0x2542ef[_0x3731('0x3c')]!==_0x3731('0x3d')){var _0xe446f1={};_0xe446f1[_0x2542ef[_0x3731('0x25')]]={'$like':'%'+_0x4e2801[_0x3731('0x2f')][_0x3731('0x3a')]+'%'};return _0xe446f1;}})});}_0x5f32d0=_[_0x3731('0x3b')]({},_0x5f32d0,_0x4e2801[_0x3731('0x3e')]);var _0x5c44f5={'where':_0x5f32d0[_0x3731('0x38')]};return db['FreshsalesConfiguration'][_0x3731('0x1e')](_0x5c44f5)['then'](function(_0x1dcaa3){_0x16b309[_0x3731('0x1e')]=_0x1dcaa3;if(_0x4e2801[_0x3731('0x2f')]['includeAll']){_0x5f32d0['include']=[{'all':!![]}];}return db[_0x3731('0x29')][_0x3731('0x3f')](_0x5f32d0);})[_0x3731('0x23')](function(_0xbc12a9){_0x16b309[_0x3731('0x40')]=_0xbc12a9;return _0x16b309;})[_0x3731('0x23')](respondWithFilteredResult(_0x1eb813,_0x5f32d0))[_0x3731('0x41')](handleError(_0x1eb813,null));};exports[_0x3731('0x42')]=function(_0x1b73e0,_0xe1eef0){var _0x41a262={'raw':![],'where':{'id':_0x1b73e0[_0x3731('0x43')]['id']}},_0x3492ff={};_0x3492ff[_0x3731('0x2d')]=_[_0x3731('0x2e')](db['FreshsalesConfiguration'][_0x3731('0x2a')]);_0x3492ff[_0x3731('0x2f')]=_[_0x3731('0x2e')](_0x1b73e0[_0x3731('0x2f')]);_0x3492ff[_0x3731('0x30')]=_['intersection'](_0x3492ff['model'],_0x3492ff[_0x3731('0x2f')]);_0x41a262[_0x3731('0x32')]=_['intersection'](_0x3492ff['model'],qs[_0x3731('0x33')](_0x1b73e0[_0x3731('0x2f')][_0x3731('0x33')]));_0x41a262[_0x3731('0x32')]=_0x41a262[_0x3731('0x32')][_0x3731('0x34')]?_0x41a262[_0x3731('0x32')]:_0x3492ff['model'];if(_0x1b73e0[_0x3731('0x2f')][_0x3731('0x44')]){_0x41a262[_0x3731('0x45')]=[{'all':!![]}];}_0x41a262=_[_0x3731('0x3b')]({},_0x41a262,_0x1b73e0['options']);return db[_0x3731('0x29')][_0x3731('0x46')](_0x41a262)[_0x3731('0x23')](handleEntityNotFound(_0xe1eef0,null))[_0x3731('0x23')](respondWithResult(_0xe1eef0,null))[_0x3731('0x41')](handleError(_0xe1eef0,null));};exports[_0x3731('0x47')]=function(_0x2ea372,_0x30c14d){return db[_0x3731('0x29')][_0x3731('0x47')](_0x2ea372[_0x3731('0x48')],{})['then'](respondWithResult(_0x30c14d,0xc9))[_0x3731('0x41')](handleError(_0x30c14d,null));};exports['update']=function(_0x5116a1,_0x2ed226){if(_0x5116a1[_0x3731('0x48')]['id']){delete _0x5116a1[_0x3731('0x48')]['id'];}return db['FreshsalesConfiguration'][_0x3731('0x46')]({'where':{'id':_0x5116a1[_0x3731('0x43')]['id']}})[_0x3731('0x23')](handleEntityNotFound(_0x2ed226,null))[_0x3731('0x23')](saveUpdates(_0x5116a1[_0x3731('0x48')],null))[_0x3731('0x23')](respondWithResult(_0x2ed226,null))[_0x3731('0x41')](handleError(_0x2ed226,null));};exports[_0x3731('0x49')]=function(_0x4e5197,_0x873ceb){return db['FreshsalesConfiguration'][_0x3731('0x46')]({'where':{'id':_0x4e5197[_0x3731('0x43')]['id']}})[_0x3731('0x23')](handleEntityNotFound(_0x873ceb,null))['then'](removeEntity(_0x873ceb,null))[_0x3731('0x41')](handleError(_0x873ceb,null));};exports[_0x3731('0x4a')]=function(_0x4d1e60,_0x5c273a,_0x3b4baf){var _0x1f0be6={};var _0x5a7e83={};var _0xe4d3c9;var _0x2e83e8;return db['FreshsalesConfiguration']['findOne']({'where':{'id':_0x4d1e60[_0x3731('0x43')]['id']}})['then'](handleEntityNotFound(_0x5c273a,null))[_0x3731('0x23')](function(_0x347674){if(_0x347674){_0xe4d3c9=_0x347674;_0x5a7e83[_0x3731('0x2d')]=_[_0x3731('0x2e')](db[_0x3731('0x4b')][_0x3731('0x2a')]);_0x5a7e83[_0x3731('0x2f')]=_[_0x3731('0x2e')](_0x4d1e60[_0x3731('0x2f')]);_0x5a7e83['filters']=_[_0x3731('0x31')](_0x5a7e83[_0x3731('0x2d')],_0x5a7e83[_0x3731('0x2f')]);_0x1f0be6[_0x3731('0x32')]=_[_0x3731('0x31')](_0x5a7e83[_0x3731('0x2d')],qs[_0x3731('0x33')](_0x4d1e60[_0x3731('0x2f')][_0x3731('0x33')]));_0x1f0be6[_0x3731('0x32')]=_0x1f0be6[_0x3731('0x32')][_0x3731('0x34')]?_0x1f0be6[_0x3731('0x32')]:_0x5a7e83[_0x3731('0x2d')];_0x1f0be6[_0x3731('0x36')]=qs[_0x3731('0x37')](_0x4d1e60[_0x3731('0x2f')][_0x3731('0x37')]);_0x1f0be6[_0x3731('0x38')]=qs['filters'](_[_0x3731('0x39')](_0x4d1e60['query'],_0x5a7e83[_0x3731('0x30')]));if(_0x4d1e60[_0x3731('0x2f')][_0x3731('0x3a')]){_0x1f0be6['where']=_[_0x3731('0x3b')](_0x1f0be6['where'],{'$or':_[_0x3731('0x28')](_0x1f0be6[_0x3731('0x32')],function(_0x406486){var _0x5d7052={};_0x5d7052[_0x406486]={'$like':'%'+_0x4d1e60[_0x3731('0x2f')][_0x3731('0x3a')]+'%'};return _0x5d7052;})});}_0x1f0be6=_[_0x3731('0x3b')]({},_0x1f0be6,_0x4d1e60[_0x3731('0x3e')]);return _0xe4d3c9['getSubjects'](_0x1f0be6);}})[_0x3731('0x23')](function(_0x245026){if(_0x245026){_0x2e83e8=_0x245026[_0x3731('0x34')];if(!_0x4d1e60[_0x3731('0x2f')][_0x3731('0x35')](_0x3731('0x4c'))){_0x1f0be6[_0x3731('0x1f')]=qs[_0x3731('0x1f')](_0x4d1e60[_0x3731('0x2f')]['limit']);_0x1f0be6[_0x3731('0x1c')]=qs[_0x3731('0x1c')](_0x4d1e60[_0x3731('0x2f')]['offset']);}return _0xe4d3c9[_0x3731('0x4a')](_0x1f0be6);}})[_0x3731('0x23')](function(_0xa60944){if(_0xa60944){return _0xa60944?{'count':_0x2e83e8,'rows':_0xa60944}:null;}})[_0x3731('0x23')](respondWithResult(_0x5c273a,null))[_0x3731('0x41')](handleError(_0x5c273a,null));};exports[_0x3731('0x4d')]=function(_0xd7e5c0,_0xa9d9ce,_0x2a9bc7){var _0x3d3f56={};var _0x5182d9={};var _0x2dfc70;var _0x300d4b;return db[_0x3731('0x29')][_0x3731('0x4e')]({'where':{'id':_0xd7e5c0[_0x3731('0x43')]['id']}})[_0x3731('0x23')](handleEntityNotFound(_0xa9d9ce,null))['then'](function(_0x17c289){if(_0x17c289){_0x2dfc70=_0x17c289;_0x5182d9[_0x3731('0x2d')]=_[_0x3731('0x2e')](db[_0x3731('0x4b')][_0x3731('0x2a')]);_0x5182d9[_0x3731('0x2f')]=_[_0x3731('0x2e')](_0xd7e5c0[_0x3731('0x2f')]);_0x5182d9[_0x3731('0x30')]=_[_0x3731('0x31')](_0x5182d9[_0x3731('0x2d')],_0x5182d9[_0x3731('0x2f')]);_0x3d3f56[_0x3731('0x32')]=_[_0x3731('0x31')](_0x5182d9['model'],qs[_0x3731('0x33')](_0xd7e5c0['query']['fields']));_0x3d3f56[_0x3731('0x32')]=_0x3d3f56[_0x3731('0x32')][_0x3731('0x34')]?_0x3d3f56['attributes']:_0x5182d9[_0x3731('0x2d')];_0x3d3f56[_0x3731('0x36')]=qs['sort'](_0xd7e5c0[_0x3731('0x2f')][_0x3731('0x37')]);_0x3d3f56[_0x3731('0x38')]=qs[_0x3731('0x30')](_[_0x3731('0x39')](_0xd7e5c0['query'],_0x5182d9[_0x3731('0x30')]));if(_0xd7e5c0[_0x3731('0x2f')][_0x3731('0x3a')]){_0x3d3f56[_0x3731('0x38')]=_[_0x3731('0x3b')](_0x3d3f56[_0x3731('0x38')],{'$or':_['map'](_0x3d3f56[_0x3731('0x32')],function(_0x319233){var _0x218f3d={};_0x218f3d[_0x319233]={'$like':'%'+_0xd7e5c0[_0x3731('0x2f')][_0x3731('0x3a')]+'%'};return _0x218f3d;})});}_0x3d3f56=_['merge']({},_0x3d3f56,_0xd7e5c0[_0x3731('0x3e')]);return _0x2dfc70[_0x3731('0x4d')](_0x3d3f56);}})[_0x3731('0x23')](function(_0x72848c){if(_0x72848c){_0x300d4b=_0x72848c[_0x3731('0x34')];if(!_0xd7e5c0[_0x3731('0x2f')][_0x3731('0x35')](_0x3731('0x4c'))){_0x3d3f56[_0x3731('0x1f')]=qs['limit'](_0xd7e5c0[_0x3731('0x2f')][_0x3731('0x1f')]);_0x3d3f56[_0x3731('0x1c')]=qs[_0x3731('0x1c')](_0xd7e5c0[_0x3731('0x2f')][_0x3731('0x1c')]);}return _0x2dfc70[_0x3731('0x4d')](_0x3d3f56);}})[_0x3731('0x23')](function(_0x5989a5){if(_0x5989a5){return _0x5989a5?{'count':_0x300d4b,'rows':_0x5989a5}:null;}})[_0x3731('0x23')](respondWithResult(_0xa9d9ce,null))['catch'](handleError(_0xa9d9ce,null));};exports[_0x3731('0x4f')]=function(_0x5e61f6,_0x464030,_0x355c50){var _0x3604f8={};var _0x2076d2={};var _0x4b09eb;var _0xc3e021;return db[_0x3731('0x29')][_0x3731('0x4e')]({'where':{'id':_0x5e61f6[_0x3731('0x43')]['id']}})['then'](handleEntityNotFound(_0x464030,null))[_0x3731('0x23')](function(_0x2d0fc7){if(_0x2d0fc7){_0x4b09eb=_0x2d0fc7;_0x2076d2[_0x3731('0x2d')]=_[_0x3731('0x2e')](db[_0x3731('0x4b')][_0x3731('0x2a')]);_0x2076d2['query']=_['keys'](_0x5e61f6['query']);_0x2076d2[_0x3731('0x30')]=_[_0x3731('0x31')](_0x2076d2[_0x3731('0x2d')],_0x2076d2['query']);_0x3604f8['attributes']=_[_0x3731('0x31')](_0x2076d2[_0x3731('0x2d')],qs[_0x3731('0x33')](_0x5e61f6[_0x3731('0x2f')][_0x3731('0x33')]));_0x3604f8[_0x3731('0x32')]=_0x3604f8[_0x3731('0x32')][_0x3731('0x34')]?_0x3604f8['attributes']:_0x2076d2['model'];_0x3604f8[_0x3731('0x36')]=qs[_0x3731('0x37')](_0x5e61f6[_0x3731('0x2f')]['sort']);_0x3604f8[_0x3731('0x38')]=qs['filters'](_['pick'](_0x5e61f6[_0x3731('0x2f')],_0x2076d2[_0x3731('0x30')]));if(_0x5e61f6[_0x3731('0x2f')][_0x3731('0x3a')]){_0x3604f8[_0x3731('0x38')]=_['merge'](_0x3604f8[_0x3731('0x38')],{'$or':_[_0x3731('0x28')](_0x3604f8['attributes'],function(_0x2171f6){var _0x5a8890={};_0x5a8890[_0x2171f6]={'$like':'%'+_0x5e61f6[_0x3731('0x2f')]['filter']+'%'};return _0x5a8890;})});}_0x3604f8=_['merge']({},_0x3604f8,_0x5e61f6[_0x3731('0x3e')]);return _0x4b09eb[_0x3731('0x4f')](_0x3604f8);}})[_0x3731('0x23')](function(_0x4d17e8){if(_0x4d17e8){_0xc3e021=_0x4d17e8[_0x3731('0x34')];if(!_0x5e61f6[_0x3731('0x2f')]['hasOwnProperty']('nolimit')){_0x3604f8[_0x3731('0x1f')]=qs[_0x3731('0x1f')](_0x5e61f6[_0x3731('0x2f')][_0x3731('0x1f')]);_0x3604f8['offset']=qs['offset'](_0x5e61f6[_0x3731('0x2f')][_0x3731('0x1c')]);}return _0x4b09eb[_0x3731('0x4f')](_0x3604f8);}})[_0x3731('0x23')](function(_0xbe0b1c){if(_0xbe0b1c){return _0xbe0b1c?{'count':_0xc3e021,'rows':_0xbe0b1c}:null;}})[_0x3731('0x23')](respondWithResult(_0x464030,null))['catch'](handleError(_0x464030,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 3efd633..2d89270 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 _0xf312=['lodash','util','moment','request-promise','path','rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','exports','define','FreshsalesConfiguration','int_freshsales_configurations'];(function(_0x12c56d,_0x1df8ae){var _0x5a32db=function(_0x1d90bf){while(--_0x1d90bf){_0x12c56d['push'](_0x12c56d['shift']());}};_0x5a32db(++_0x1df8ae);}(_0xf312,0x15c));var _0x2f31=function(_0x494408,_0x2ed5df){_0x494408=_0x494408-0x0;var _0x4d59b4=_0xf312[_0x494408];return _0x4d59b4;};'use strict';var _=require(_0x2f31('0x0'));var util=require(_0x2f31('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x2f31('0x2'));var BPromise=require('bluebird');var rp=require(_0x2f31('0x3'));var fs=require('fs');var path=require(_0x2f31('0x4'));var rimraf=require(_0x2f31('0x5'));var config=require(_0x2f31('0x6'));var attributes=require(_0x2f31('0x7'));module[_0x2f31('0x8')]=function(_0x5a69fb,_0x4780b7){return _0x5a69fb[_0x2f31('0x9')](_0x2f31('0xa'),attributes,{'tableName':_0x2f31('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x813e=['exports','define','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./intFreshsalesConfiguration.attributes'];(function(_0x97e815,_0x22ee8c){var _0x544a1b=function(_0x10eb59){while(--_0x10eb59){_0x97e815['push'](_0x97e815['shift']());}};_0x544a1b(++_0x22ee8c);}(_0x813e,0x110));var _0xe813=function(_0x2a6ab8,_0x5eb621){_0x2a6ab8=_0x2a6ab8-0x0;var _0x5752ab=_0x813e[_0x2a6ab8];return _0x5752ab;};'use strict';var _=require('lodash');var util=require(_0xe813('0x0'));var logger=require(_0xe813('0x1'))(_0xe813('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xe813('0x3'));var fs=require('fs');var path=require(_0xe813('0x4'));var rimraf=require(_0xe813('0x5'));var config=require(_0xe813('0x6'));var attributes=require(_0xe813('0x7'));module[_0xe813('0x8')]=function(_0x11ddac,_0x15dafc){return _0x11ddac[_0xe813('0x9')]('FreshsalesConfiguration',attributes,{'tableName':'int_freshsales_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.rpc.js index 51b4727..ed2400b 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 _0x95bb=['ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring'];(function(_0x2719cc,_0x2d0f25){var _0x32519a=function(_0x4c5345){while(--_0x4c5345){_0x2719cc['push'](_0x2719cc['shift']());}};_0x32519a(++_0x2d0f25);}(_0x95bb,0xc2));var _0xb95b=function(_0x1c779f,_0x25e56b){_0x1c779f=_0x1c779f-0x0;var _0x58c4b6=_0x95bb[_0x1c779f];return _0x58c4b6;};'use strict';var _=require(_0xb95b('0x0'));var util=require('util');var moment=require(_0xb95b('0x1'));var BPromise=require(_0xb95b('0x2'));var rs=require(_0xb95b('0x3'));var fs=require('fs');var Redis=require(_0xb95b('0x4'));var db=require(_0xb95b('0x5'))['db'];var utils=require(_0xb95b('0x6'));var logger=require('../../config/logger')(_0xb95b('0x7'));var config=require('../../config/environment');var jayson=require(_0xb95b('0x8'));var client=jayson[_0xb95b('0x9')][_0xb95b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x32b07e,_0x2e89f1,_0x110555){return new BPromise(function(_0x57c176,_0x11cc4e){return client[_0xb95b('0xb')](_0x32b07e,_0x110555)[_0xb95b('0xc')](function(_0x4ff9aa){logger[_0xb95b('0xd')](_0xb95b('0xe'),_0x2e89f1,_0xb95b('0xf'));logger[_0xb95b('0x10')]('FreshsalesConfiguration,\x20%s,\x20%s,\x20%s',_0x2e89f1,'request\x20sent',JSON[_0xb95b('0x11')](_0x4ff9aa));if(_0x4ff9aa[_0xb95b('0x12')]){if(_0x4ff9aa[_0xb95b('0x12')]['code']===0x1f4){logger['error'](_0xb95b('0xe'),_0x2e89f1,_0x4ff9aa[_0xb95b('0x12')][_0xb95b('0x13')]);return _0x11cc4e(_0x4ff9aa['error'][_0xb95b('0x13')]);}logger[_0xb95b('0x12')](_0xb95b('0xe'),_0x2e89f1,_0x4ff9aa[_0xb95b('0x12')][_0xb95b('0x13')]);return _0x57c176(_0x4ff9aa[_0xb95b('0x12')][_0xb95b('0x13')]);}else{logger[_0xb95b('0xd')](_0xb95b('0xe'),_0x2e89f1,_0xb95b('0xf'));_0x57c176(_0x4ff9aa[_0xb95b('0x14')]['message']);}})[_0xb95b('0x15')](function(_0x2f6888){logger['error'](_0xb95b('0xe'),_0x2e89f1,_0x2f6888);_0x11cc4e(_0x2f6888);});});} \ No newline at end of file +var _0x45d2=['FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','code','error','message','FreshsalesConfiguration,\x20%s,\x20%s','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug'];(function(_0x4e0658,_0x240e5c){var _0x5c9855=function(_0x3aea13){while(--_0x3aea13){_0x4e0658['push'](_0x4e0658['shift']());}};_0x5c9855(++_0x240e5c);}(_0x45d2,0x84));var _0x245d=function(_0x59f638,_0x45a5d0){_0x59f638=_0x59f638-0x0;var _0x348cfc=_0x45d2[_0x59f638];return _0x348cfc;};'use strict';var _=require('lodash');var util=require(_0x245d('0x0'));var moment=require(_0x245d('0x1'));var BPromise=require(_0x245d('0x2'));var rs=require(_0x245d('0x3'));var fs=require('fs');var Redis=require(_0x245d('0x4'));var db=require(_0x245d('0x5'))['db'];var utils=require(_0x245d('0x6'));var logger=require(_0x245d('0x7'))(_0x245d('0x8'));var config=require(_0x245d('0x9'));var jayson=require(_0x245d('0xa'));var client=jayson[_0x245d('0xb')][_0x245d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x34d9c8,_0x1babee,_0xe4fbf7){return new BPromise(function(_0x358791,_0x211d2d){return client[_0x245d('0xd')](_0x34d9c8,_0xe4fbf7)[_0x245d('0xe')](function(_0x339378){logger[_0x245d('0xf')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x1babee,_0x245d('0x10'));logger[_0x245d('0x11')](_0x245d('0x12'),_0x1babee,_0x245d('0x10'),JSON[_0x245d('0x13')](_0x339378));if(_0x339378['error']){if(_0x339378['error'][_0x245d('0x14')]===0x1f4){logger[_0x245d('0x15')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x1babee,_0x339378[_0x245d('0x15')][_0x245d('0x16')]);return _0x211d2d(_0x339378[_0x245d('0x15')][_0x245d('0x16')]);}logger[_0x245d('0x15')](_0x245d('0x17'),_0x1babee,_0x339378[_0x245d('0x15')][_0x245d('0x16')]);return _0x358791(_0x339378['error'][_0x245d('0x16')]);}else{logger[_0x245d('0xf')](_0x245d('0x17'),_0x1babee,_0x245d('0x10'));_0x358791(_0x339378['result'][_0x245d('0x16')]);}})[_0x245d('0x18')](function(_0x224dff){logger[_0x245d('0x15')](_0x245d('0x17'),_0x1babee,_0x224dff);_0x211d2d(_0x224dff);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index 504fbfa..7fb362c 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 _0xa1e8=['path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','get','index','/:id','isAuthenticated','post','create','update','delete','destroy','exports','multer'];(function(_0x1941e2,_0x315032){var _0x337de1=function(_0x19bd92){while(--_0x19bd92){_0x1941e2['push'](_0x1941e2['shift']());}};_0x337de1(++_0x315032);}(_0xa1e8,0x1af));var _0x8a1e=function(_0x376f2d,_0x53f57d){_0x376f2d=_0x376f2d-0x0;var _0x44b918=_0xa1e8[_0x376f2d];return _0x44b918;};'use strict';var multer=require(_0x8a1e('0x0'));var util=require('util');var path=require(_0x8a1e('0x1'));var timeout=require(_0x8a1e('0x2'));var express=require(_0x8a1e('0x3'));var router=express['Router']();var fs_extra=require(_0x8a1e('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x8a1e('0x5'));var config=require(_0x8a1e('0x6'));var controller=require(_0x8a1e('0x7'));router[_0x8a1e('0x8')]('/',auth['isAuthenticated'](),controller[_0x8a1e('0x9')]);router[_0x8a1e('0x8')](_0x8a1e('0xa'),auth[_0x8a1e('0xb')](),controller['show']);router[_0x8a1e('0xc')]('/',auth[_0x8a1e('0xb')](),controller[_0x8a1e('0xd')]);router['put'](_0x8a1e('0xa'),auth['isAuthenticated'](),controller[_0x8a1e('0xe')]);router[_0x8a1e('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x8a1e('0x10')]);module[_0x8a1e('0x11')]=router; \ No newline at end of file +var _0x2121=['put','update','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intFreshsalesField.controller','isAuthenticated','index','get','/:id','show','create'];(function(_0xcda789,_0x3c177d){var _0x1960b4=function(_0x5e2e70){while(--_0x5e2e70){_0xcda789['push'](_0xcda789['shift']());}};_0x1960b4(++_0x3c177d);}(_0x2121,0x1b4));var _0x1212=function(_0x4708f8,_0x2a20c2){_0x4708f8=_0x4708f8-0x0;var _0x433648=_0x2121[_0x4708f8];return _0x433648;};'use strict';var multer=require(_0x1212('0x0'));var util=require(_0x1212('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x1212('0x2'));var router=express[_0x1212('0x3')]();var fs_extra=require(_0x1212('0x4'));var auth=require(_0x1212('0x5'));var interaction=require(_0x1212('0x6'));var config=require('../../config/environment');var controller=require(_0x1212('0x7'));router['get']('/',auth[_0x1212('0x8')](),controller[_0x1212('0x9')]);router[_0x1212('0xa')](_0x1212('0xb'),auth[_0x1212('0x8')](),controller[_0x1212('0xc')]);router['post']('/',auth[_0x1212('0x8')](),controller[_0x1212('0xd')]);router[_0x1212('0xe')](_0x1212('0xb'),auth[_0x1212('0x8')](),controller[_0x1212('0xf')]);router['delete']('/:id',auth[_0x1212('0x8')](),controller[_0x1212('0x10')]);module[_0x1212('0x11')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index c148339..f8af3a0 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 _0x5f8c=['STRING','BOOLEAN','exports','ENUM','string','variable','picklist'];(function(_0x239ccb,_0xddfdc5){var _0x3d3668=function(_0x5e6212){while(--_0x5e6212){_0x239ccb['push'](_0x239ccb['shift']());}};_0x3d3668(++_0xddfdc5);}(_0x5f8c,0x80));var _0xc5f8=function(_0x432169,_0x7ffbe9){_0x432169=_0x432169-0x0;var _0x28e745=_0x5f8c[_0x432169];return _0x28e745;};'use strict';var Sequelize=require('sequelize');module[_0xc5f8('0x0')]={'type':{'type':Sequelize[_0xc5f8('0x1')](_0xc5f8('0x2'),_0xc5f8('0x3'),'customVariable','keyValue',_0xc5f8('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0xc5f8('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xc5f8('0x1')](_0xc5f8('0x2'),_0xc5f8('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0xc5f8('0x5')]},'idField':{'type':Sequelize[_0xc5f8('0x5')]},'nameField':{'type':Sequelize[_0xc5f8('0x5')]},'customField':{'type':Sequelize[_0xc5f8('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xc5f8('0x5')]}}; \ No newline at end of file +var _0x89a1=['ENUM','string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize','exports'];(function(_0x2d309f,_0x574054){var _0x1ce123=function(_0xa3ab25){while(--_0xa3ab25){_0x2d309f['push'](_0x2d309f['shift']());}};_0x1ce123(++_0x574054);}(_0x89a1,0x10c));var _0x189a=function(_0x3b064c,_0x43669d){_0x3b064c=_0x3b064c-0x0;var _0x3e147a=_0x89a1[_0x3b064c];return _0x3e147a;};'use strict';var Sequelize=require(_0x189a('0x0'));module[_0x189a('0x1')]={'type':{'type':Sequelize[_0x189a('0x2')](_0x189a('0x3'),_0x189a('0x4'),_0x189a('0x5'),_0x189a('0x6'),_0x189a('0x7')),'defaultValue':_0x189a('0x3')},'content':{'type':Sequelize[_0x189a('0x8')]},'key':{'type':Sequelize[_0x189a('0x8')]},'keyType':{'type':Sequelize['ENUM'](_0x189a('0x3'),_0x189a('0x4'),_0x189a('0x5'))},'keyContent':{'type':Sequelize[_0x189a('0x8')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x189a('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x189a('0x8')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index dede8c5..402db47 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 _0x75f8=['filter','VIRTUAL','merge','options','includeAll','findAll','catch','show','params','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','mustache','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','FreshsalesField','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick'];(function(_0xb70791,_0x1d91d6){var _0x48f939=function(_0x591c48){while(--_0x591c48){_0xb70791['push'](_0xb70791['shift']());}};_0x48f939(++_0x1d91d6);}(_0x75f8,0x1c2));var _0x875f=function(_0x3e23fd,_0x324cb8){_0x3e23fd=_0x3e23fd-0x0;var _0x23e70d=_0x75f8[_0x3e23fd];return _0x23e70d;};'use strict';var emlformat=require(_0x875f('0x0'));var rimraf=require(_0x875f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x875f('0x2'));var rp=require(_0x875f('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x875f('0x4'));var util=require('util');var path=require('path');var sox=require(_0x875f('0x5'));var csv=require(_0x875f('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x875f('0x7'));var _=require(_0x875f('0x8'));var squel=require(_0x875f('0x9'));var crypto=require(_0x875f('0xa'));var jsforce=require(_0x875f('0xb'));var deskjs=require(_0x875f('0xc'));var toCsv=require(_0x875f('0x6'));var querystring=require('querystring');var Papa=require(_0x875f('0xd'));var Redis=require(_0x875f('0xe'));var authService=require(_0x875f('0xf'));var qs=require(_0x875f('0x10'));var as=require(_0x875f('0x11'));var hardwareService=require(_0x875f('0x12'));var logger=require('../../config/logger')(_0x875f('0x13'));var utils=require(_0x875f('0x14'));var config=require(_0x875f('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x875f('0x16'))['db'];function respondWithStatusCode(_0x4b74b5,_0x529bc5){_0x529bc5=_0x529bc5||0xcc;return function(_0x3a4a20){if(_0x3a4a20){return _0x4b74b5[_0x875f('0x17')](_0x529bc5);}return _0x4b74b5[_0x875f('0x18')](_0x529bc5)[_0x875f('0x19')]();};}function respondWithResult(_0xd30829,_0x341acf){_0x341acf=_0x341acf||0xc8;return function(_0x1c96e8){if(_0x1c96e8){return _0xd30829[_0x875f('0x18')](_0x341acf)[_0x875f('0x1a')](_0x1c96e8);}};}function respondWithFilteredResult(_0x227019,_0x52c8b8){return function(_0x535f5e){if(_0x535f5e){var _0x1ce288=typeof _0x52c8b8[_0x875f('0x1b')]===_0x875f('0x1c')&&typeof _0x52c8b8[_0x875f('0x1d')]===_0x875f('0x1c');var _0x275db1=_0x535f5e[_0x875f('0x1e')];var _0x5dafbf=_0x1ce288?0x0:_0x52c8b8[_0x875f('0x1b')];var _0x4a2c7b=_0x1ce288?_0x535f5e['count']:_0x52c8b8[_0x875f('0x1b')]+_0x52c8b8['limit'];var _0x5c3c5f;if(_0x4a2c7b>=_0x275db1){_0x4a2c7b=_0x275db1;_0x5c3c5f=0xc8;}else{_0x5c3c5f=0xce;}_0x227019[_0x875f('0x18')](_0x5c3c5f);return _0x227019[_0x875f('0x1f')](_0x875f('0x20'),_0x5dafbf+'-'+_0x4a2c7b+'/'+_0x275db1)[_0x875f('0x1a')](_0x535f5e);}return null;};}function patchUpdates(_0x2e564a){return function(_0x14620a){try{jsonpatch[_0x875f('0x21')](_0x14620a,_0x2e564a,!![]);}catch(_0x45da69){return BPromise[_0x875f('0x22')](_0x45da69);}return _0x14620a[_0x875f('0x23')]();};}function saveUpdates(_0x1e7b83,_0x31b964){return function(_0x78c48c){if(_0x78c48c){return _0x78c48c[_0x875f('0x24')](_0x1e7b83)[_0x875f('0x25')](function(_0xb2678f){return _0xb2678f;});}return null;};}function removeEntity(_0x10620a,_0x14e609){return function(_0x200466){if(_0x200466){return _0x200466[_0x875f('0x26')]()[_0x875f('0x25')](function(){_0x10620a[_0x875f('0x18')](0xcc)[_0x875f('0x19')]();});}};}function handleEntityNotFound(_0x4547cd,_0x53b39c){return function(_0x490242){if(!_0x490242){_0x4547cd[_0x875f('0x17')](0x194);}return _0x490242;};}function handleError(_0x4b900d,_0x1a02f4){_0x1a02f4=_0x1a02f4||0x1f4;return function(_0x7e4f96){logger['error'](_0x7e4f96[_0x875f('0x27')]);if(_0x7e4f96['name']){delete _0x7e4f96[_0x875f('0x28')];}_0x4b900d[_0x875f('0x18')](_0x1a02f4)[_0x875f('0x29')](_0x7e4f96);};}exports['index']=function(_0x41d301,_0xd8635){var _0x339e66={},_0x24b3e6={},_0x5c942a={'count':0x0,'rows':[]};var _0x33708c=_['map'](db[_0x875f('0x2a')][_0x875f('0x2b')],function(_0x1e3378){return{'name':_0x1e3378[_0x875f('0x2c')],'type':_0x1e3378[_0x875f('0x2d')][_0x875f('0x2e')]};});_0x24b3e6[_0x875f('0x2f')]=_[_0x875f('0x30')](_0x33708c,_0x875f('0x28'));_0x24b3e6[_0x875f('0x31')]=_[_0x875f('0x32')](_0x41d301[_0x875f('0x31')]);_0x24b3e6[_0x875f('0x33')]=_[_0x875f('0x34')](_0x24b3e6[_0x875f('0x2f')],_0x24b3e6[_0x875f('0x31')]);_0x339e66[_0x875f('0x35')]=_[_0x875f('0x34')](_0x24b3e6[_0x875f('0x2f')],qs[_0x875f('0x36')](_0x41d301[_0x875f('0x31')][_0x875f('0x36')]));_0x339e66[_0x875f('0x35')]=_0x339e66[_0x875f('0x35')][_0x875f('0x37')]?_0x339e66[_0x875f('0x35')]:_0x24b3e6[_0x875f('0x2f')];if(!_0x41d301[_0x875f('0x31')][_0x875f('0x38')](_0x875f('0x39'))){_0x339e66[_0x875f('0x1d')]=qs['limit'](_0x41d301['query'][_0x875f('0x1d')]);_0x339e66[_0x875f('0x1b')]=qs[_0x875f('0x1b')](_0x41d301['query']['offset']);}_0x339e66['order']=qs['sort'](_0x41d301[_0x875f('0x31')][_0x875f('0x3a')]);_0x339e66[_0x875f('0x3b')]=qs[_0x875f('0x33')](_[_0x875f('0x3c')](_0x41d301[_0x875f('0x31')],_0x24b3e6[_0x875f('0x33')]),_0x33708c);if(_0x41d301[_0x875f('0x31')][_0x875f('0x3d')]){_0x339e66[_0x875f('0x3b')]=_['merge'](_0x339e66['where'],{'$or':_[_0x875f('0x30')](_0x33708c,function(_0x4e2bf9){if(_0x4e2bf9[_0x875f('0x2d')]!==_0x875f('0x3e')){var _0x2804da={};_0x2804da[_0x4e2bf9[_0x875f('0x28')]]={'$like':'%'+_0x41d301[_0x875f('0x31')][_0x875f('0x3d')]+'%'};return _0x2804da;}})});}_0x339e66=_[_0x875f('0x3f')]({},_0x339e66,_0x41d301[_0x875f('0x40')]);var _0x3aa10d={'where':_0x339e66[_0x875f('0x3b')]};return db[_0x875f('0x2a')][_0x875f('0x1e')](_0x3aa10d)[_0x875f('0x25')](function(_0x4af674){_0x5c942a[_0x875f('0x1e')]=_0x4af674;if(_0x41d301[_0x875f('0x31')][_0x875f('0x41')]){_0x339e66['include']=[{'all':!![]}];}return db[_0x875f('0x2a')][_0x875f('0x42')](_0x339e66);})[_0x875f('0x25')](function(_0x5023d3){_0x5c942a['rows']=_0x5023d3;return _0x5c942a;})['then'](respondWithFilteredResult(_0xd8635,_0x339e66))[_0x875f('0x43')](handleError(_0xd8635,null));};exports[_0x875f('0x44')]=function(_0x145af0,_0x563954){var _0x5534b9={'raw':!![],'where':{'id':_0x145af0[_0x875f('0x45')]['id']}},_0x3c40e4={};_0x3c40e4[_0x875f('0x2f')]=_['keys'](db[_0x875f('0x2a')][_0x875f('0x2b')]);_0x3c40e4[_0x875f('0x31')]=_['keys'](_0x145af0['query']);_0x3c40e4['filters']=_[_0x875f('0x34')](_0x3c40e4['model'],_0x3c40e4[_0x875f('0x31')]);_0x5534b9[_0x875f('0x35')]=_[_0x875f('0x34')](_0x3c40e4[_0x875f('0x2f')],qs['fields'](_0x145af0['query'][_0x875f('0x36')]));_0x5534b9[_0x875f('0x35')]=_0x5534b9['attributes'][_0x875f('0x37')]?_0x5534b9[_0x875f('0x35')]:_0x3c40e4[_0x875f('0x2f')];if(_0x145af0[_0x875f('0x31')]['includeAll']){_0x5534b9['include']=[{'all':!![]}];}_0x5534b9=_[_0x875f('0x3f')]({},_0x5534b9,_0x145af0[_0x875f('0x40')]);return db[_0x875f('0x2a')][_0x875f('0x46')](_0x5534b9)['then'](handleEntityNotFound(_0x563954,null))[_0x875f('0x25')](respondWithResult(_0x563954,null))[_0x875f('0x43')](handleError(_0x563954,null));};exports['create']=function(_0x3a44d0,_0x57fe13){return db[_0x875f('0x2a')][_0x875f('0x47')](_0x3a44d0[_0x875f('0x48')],{})['then'](respondWithResult(_0x57fe13,0xc9))[_0x875f('0x43')](handleError(_0x57fe13,null));};exports[_0x875f('0x24')]=function(_0x9ddf61,_0x488dc4){if(_0x9ddf61['body']['id']){delete _0x9ddf61[_0x875f('0x48')]['id'];}return db[_0x875f('0x2a')][_0x875f('0x46')]({'where':{'id':_0x9ddf61[_0x875f('0x45')]['id']}})[_0x875f('0x25')](handleEntityNotFound(_0x488dc4,null))[_0x875f('0x25')](saveUpdates(_0x9ddf61[_0x875f('0x48')],null))[_0x875f('0x25')](respondWithResult(_0x488dc4,null))[_0x875f('0x43')](handleError(_0x488dc4,null));};exports[_0x875f('0x26')]=function(_0x19ca71,_0x2dc71f){return db[_0x875f('0x2a')][_0x875f('0x46')]({'where':{'id':_0x19ca71[_0x875f('0x45')]['id']}})[_0x875f('0x25')](handleEntityNotFound(_0x2dc71f,null))['then'](removeEntity(_0x2dc71f,null))['catch'](handleError(_0x2dc71f,null));}; \ No newline at end of file +var _0xd1b5=['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','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','destroy','then','error','stack','name','send','index','map','FreshsalesField','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','find','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','ejs','fs-extra'];(function(_0x4f3e52,_0x3325b5){var _0x3c0716=function(_0x40d910){while(--_0x40d910){_0x4f3e52['push'](_0x4f3e52['shift']());}};_0x3c0716(++_0x3325b5);}(_0xd1b5,0xd9));var _0x5d1b=function(_0x3cdd07,_0xf97735){_0x3cdd07=_0x3cdd07-0x0;var _0xaff9ca=_0xd1b5[_0x3cdd07];return _0xaff9ca;};'use strict';var emlformat=require(_0x5d1b('0x0'));var rimraf=require(_0x5d1b('0x1'));var zipdir=require(_0x5d1b('0x2'));var jsonpatch=require(_0x5d1b('0x3'));var rp=require(_0x5d1b('0x4'));var moment=require('moment');var BPromise=require(_0x5d1b('0x5'));var Mustache=require(_0x5d1b('0x6'));var util=require('util');var path=require('path');var sox=require(_0x5d1b('0x7'));var csv=require(_0x5d1b('0x8'));var ejs=require(_0x5d1b('0x9'));var fs=require('fs');var fs_extra=require(_0x5d1b('0xa'));var _=require(_0x5d1b('0xb'));var squel=require('squel');var crypto=require(_0x5d1b('0xc'));var jsforce=require(_0x5d1b('0xd'));var deskjs=require(_0x5d1b('0xe'));var toCsv=require(_0x5d1b('0x8'));var querystring=require(_0x5d1b('0xf'));var Papa=require(_0x5d1b('0x10'));var Redis=require(_0x5d1b('0x11'));var authService=require(_0x5d1b('0x12'));var qs=require(_0x5d1b('0x13'));var as=require(_0x5d1b('0x14'));var hardwareService=require(_0x5d1b('0x15'));var logger=require(_0x5d1b('0x16'))(_0x5d1b('0x17'));var utils=require(_0x5d1b('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x5d1b('0x19'))['db'];function respondWithStatusCode(_0x192297,_0x310e47){_0x310e47=_0x310e47||0xcc;return function(_0x1f18b7){if(_0x1f18b7){return _0x192297[_0x5d1b('0x1a')](_0x310e47);}return _0x192297[_0x5d1b('0x1b')](_0x310e47)[_0x5d1b('0x1c')]();};}function respondWithResult(_0x5acd03,_0x243d76){_0x243d76=_0x243d76||0xc8;return function(_0x5cbb3c){if(_0x5cbb3c){return _0x5acd03[_0x5d1b('0x1b')](_0x243d76)[_0x5d1b('0x1d')](_0x5cbb3c);}};}function respondWithFilteredResult(_0x261f28,_0x5a7014){return function(_0x12c678){if(_0x12c678){var _0x21366a=typeof _0x5a7014[_0x5d1b('0x1e')]==='undefined'&&typeof _0x5a7014['limit']===_0x5d1b('0x1f');var _0x1c90ae=_0x12c678['count'];var _0x18ef6b=_0x21366a?0x0:_0x5a7014[_0x5d1b('0x1e')];var _0x4b49c1=_0x21366a?_0x12c678[_0x5d1b('0x20')]:_0x5a7014[_0x5d1b('0x1e')]+_0x5a7014[_0x5d1b('0x21')];var _0x285171;if(_0x4b49c1>=_0x1c90ae){_0x4b49c1=_0x1c90ae;_0x285171=0xc8;}else{_0x285171=0xce;}_0x261f28[_0x5d1b('0x1b')](_0x285171);return _0x261f28[_0x5d1b('0x22')](_0x5d1b('0x23'),_0x18ef6b+'-'+_0x4b49c1+'/'+_0x1c90ae)[_0x5d1b('0x1d')](_0x12c678);}return null;};}function patchUpdates(_0x1e4c7c){return function(_0xf20f49){try{jsonpatch[_0x5d1b('0x24')](_0xf20f49,_0x1e4c7c,!![]);}catch(_0x2a8432){return BPromise['reject'](_0x2a8432);}return _0xf20f49[_0x5d1b('0x25')]();};}function saveUpdates(_0x4da042,_0x3a24ea){return function(_0x22796f){if(_0x22796f){return _0x22796f[_0x5d1b('0x26')](_0x4da042)['then'](function(_0x3eecae){return _0x3eecae;});}return null;};}function removeEntity(_0x3a5ce7,_0x9cf3cc){return function(_0x3163c3){if(_0x3163c3){return _0x3163c3[_0x5d1b('0x27')]()[_0x5d1b('0x28')](function(){_0x3a5ce7['status'](0xcc)[_0x5d1b('0x1c')]();});}};}function handleEntityNotFound(_0x289aa3,_0x308664){return function(_0x4bb4d2){if(!_0x4bb4d2){_0x289aa3['sendStatus'](0x194);}return _0x4bb4d2;};}function handleError(_0x5197fd,_0xe34e10){_0xe34e10=_0xe34e10||0x1f4;return function(_0x11486d){logger[_0x5d1b('0x29')](_0x11486d[_0x5d1b('0x2a')]);if(_0x11486d[_0x5d1b('0x2b')]){delete _0x11486d[_0x5d1b('0x2b')];}_0x5197fd[_0x5d1b('0x1b')](_0xe34e10)[_0x5d1b('0x2c')](_0x11486d);};}exports[_0x5d1b('0x2d')]=function(_0x480c19,_0x54f520){var _0x413d5d={},_0x3e8c59={},_0x26c587={'count':0x0,'rows':[]};var _0xaf1f0d=_[_0x5d1b('0x2e')](db[_0x5d1b('0x2f')]['rawAttributes'],function(_0x3ddb76){return{'name':_0x3ddb76[_0x5d1b('0x30')],'type':_0x3ddb76[_0x5d1b('0x31')][_0x5d1b('0x32')]};});_0x3e8c59[_0x5d1b('0x33')]=_[_0x5d1b('0x2e')](_0xaf1f0d,_0x5d1b('0x2b'));_0x3e8c59[_0x5d1b('0x34')]=_[_0x5d1b('0x35')](_0x480c19['query']);_0x3e8c59[_0x5d1b('0x36')]=_[_0x5d1b('0x37')](_0x3e8c59[_0x5d1b('0x33')],_0x3e8c59['query']);_0x413d5d['attributes']=_[_0x5d1b('0x37')](_0x3e8c59[_0x5d1b('0x33')],qs[_0x5d1b('0x38')](_0x480c19[_0x5d1b('0x34')]['fields']));_0x413d5d[_0x5d1b('0x39')]=_0x413d5d[_0x5d1b('0x39')]['length']?_0x413d5d[_0x5d1b('0x39')]:_0x3e8c59[_0x5d1b('0x33')];if(!_0x480c19[_0x5d1b('0x34')][_0x5d1b('0x3a')]('nolimit')){_0x413d5d[_0x5d1b('0x21')]=qs[_0x5d1b('0x21')](_0x480c19[_0x5d1b('0x34')][_0x5d1b('0x21')]);_0x413d5d[_0x5d1b('0x1e')]=qs[_0x5d1b('0x1e')](_0x480c19[_0x5d1b('0x34')]['offset']);}_0x413d5d[_0x5d1b('0x3b')]=qs['sort'](_0x480c19[_0x5d1b('0x34')][_0x5d1b('0x3c')]);_0x413d5d[_0x5d1b('0x3d')]=qs[_0x5d1b('0x36')](_[_0x5d1b('0x3e')](_0x480c19['query'],_0x3e8c59[_0x5d1b('0x36')]),_0xaf1f0d);if(_0x480c19[_0x5d1b('0x34')]['filter']){_0x413d5d[_0x5d1b('0x3d')]=_[_0x5d1b('0x3f')](_0x413d5d[_0x5d1b('0x3d')],{'$or':_[_0x5d1b('0x2e')](_0xaf1f0d,function(_0x85f408){if(_0x85f408[_0x5d1b('0x31')]!==_0x5d1b('0x40')){var _0x39b4e5={};_0x39b4e5[_0x85f408[_0x5d1b('0x2b')]]={'$like':'%'+_0x480c19[_0x5d1b('0x34')]['filter']+'%'};return _0x39b4e5;}})});}_0x413d5d=_['merge']({},_0x413d5d,_0x480c19[_0x5d1b('0x41')]);var _0x5166b8={'where':_0x413d5d[_0x5d1b('0x3d')]};return db['FreshsalesField'][_0x5d1b('0x20')](_0x5166b8)[_0x5d1b('0x28')](function(_0x3f615c){_0x26c587[_0x5d1b('0x20')]=_0x3f615c;if(_0x480c19[_0x5d1b('0x34')][_0x5d1b('0x42')]){_0x413d5d[_0x5d1b('0x43')]=[{'all':!![]}];}return db['FreshsalesField'][_0x5d1b('0x44')](_0x413d5d);})[_0x5d1b('0x28')](function(_0x32f12c){_0x26c587[_0x5d1b('0x45')]=_0x32f12c;return _0x26c587;})[_0x5d1b('0x28')](respondWithFilteredResult(_0x54f520,_0x413d5d))[_0x5d1b('0x46')](handleError(_0x54f520,null));};exports[_0x5d1b('0x47')]=function(_0x3967e2,_0x4fd6c3){var _0x31f329={'raw':!![],'where':{'id':_0x3967e2[_0x5d1b('0x48')]['id']}},_0x147434={};_0x147434[_0x5d1b('0x33')]=_['keys'](db['FreshsalesField']['rawAttributes']);_0x147434[_0x5d1b('0x34')]=_[_0x5d1b('0x35')](_0x3967e2['query']);_0x147434[_0x5d1b('0x36')]=_[_0x5d1b('0x37')](_0x147434[_0x5d1b('0x33')],_0x147434[_0x5d1b('0x34')]);_0x31f329[_0x5d1b('0x39')]=_['intersection'](_0x147434[_0x5d1b('0x33')],qs['fields'](_0x3967e2[_0x5d1b('0x34')]['fields']));_0x31f329[_0x5d1b('0x39')]=_0x31f329['attributes'][_0x5d1b('0x49')]?_0x31f329[_0x5d1b('0x39')]:_0x147434['model'];if(_0x3967e2['query'][_0x5d1b('0x42')]){_0x31f329['include']=[{'all':!![]}];}_0x31f329=_[_0x5d1b('0x3f')]({},_0x31f329,_0x3967e2[_0x5d1b('0x41')]);return db['FreshsalesField'][_0x5d1b('0x4a')](_0x31f329)[_0x5d1b('0x28')](handleEntityNotFound(_0x4fd6c3,null))[_0x5d1b('0x28')](respondWithResult(_0x4fd6c3,null))[_0x5d1b('0x46')](handleError(_0x4fd6c3,null));};exports['create']=function(_0x1ed0b2,_0x1fa0d5){return db['FreshsalesField']['create'](_0x1ed0b2[_0x5d1b('0x4b')],{})[_0x5d1b('0x28')](respondWithResult(_0x1fa0d5,0xc9))[_0x5d1b('0x46')](handleError(_0x1fa0d5,null));};exports[_0x5d1b('0x26')]=function(_0x35495c,_0xfef343){if(_0x35495c[_0x5d1b('0x4b')]['id']){delete _0x35495c[_0x5d1b('0x4b')]['id'];}return db[_0x5d1b('0x2f')]['find']({'where':{'id':_0x35495c[_0x5d1b('0x48')]['id']}})[_0x5d1b('0x28')](handleEntityNotFound(_0xfef343,null))[_0x5d1b('0x28')](saveUpdates(_0x35495c[_0x5d1b('0x4b')],null))['then'](respondWithResult(_0xfef343,null))[_0x5d1b('0x46')](handleError(_0xfef343,null));};exports[_0x5d1b('0x27')]=function(_0x5cf1b3,_0x4ab490){return db[_0x5d1b('0x2f')][_0x5d1b('0x4a')]({'where':{'id':_0x5cf1b3[_0x5d1b('0x48')]['id']}})[_0x5d1b('0x28')](handleEntityNotFound(_0x4ab490,null))[_0x5d1b('0x28')](removeEntity(_0x4ab490,null))['catch'](handleError(_0x4ab490,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index bea4875..56c7ea3 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 _0xb10d=['../../config/environment','./intFreshsalesField.attributes','exports','define','FreshsalesField','int_freshsales_fields','freshsales_unique_index','idField','FieldId','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x131160,_0x1dc2ca){var _0x10e3e2=function(_0x1bd0b2){while(--_0x1bd0b2){_0x131160['push'](_0x131160['shift']());}};_0x10e3e2(++_0x1dc2ca);}(_0xb10d,0x17f));var _0xdb10=function(_0x2fdeeb,_0xf0064f){_0x2fdeeb=_0x2fdeeb-0x0;var _0x1fc84d=_0xb10d[_0x2fdeeb];return _0x1fc84d;};'use strict';var _=require(_0xdb10('0x0'));var util=require('util');var logger=require(_0xdb10('0x1'))(_0xdb10('0x2'));var moment=require(_0xdb10('0x3'));var BPromise=require(_0xdb10('0x4'));var rp=require(_0xdb10('0x5'));var fs=require('fs');var path=require(_0xdb10('0x6'));var rimraf=require(_0xdb10('0x7'));var config=require(_0xdb10('0x8'));var attributes=require(_0xdb10('0x9'));module[_0xdb10('0xa')]=function(_0x348cff,_0x4d75f1){return _0x348cff[_0xdb10('0xb')](_0xdb10('0xc'),attributes,{'tableName':_0xdb10('0xd'),'paranoid':![],'indexes':[{'name':_0xdb10('0xe'),'fields':[_0xdb10('0xf'),_0xdb10('0x10')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa064=['path','../../config/environment','./intFreshsalesField.attributes','FreshsalesField','int_freshsales_fields','FieldId','lodash','util','../../config/logger','api','moment'];(function(_0x4ea297,_0x6f0979){var _0x21846c=function(_0x1a69d8){while(--_0x1a69d8){_0x4ea297['push'](_0x4ea297['shift']());}};_0x21846c(++_0x6f0979);}(_0xa064,0x192));var _0x4a06=function(_0x1b129f,_0x6d1483){_0x1b129f=_0x1b129f-0x0;var _0x117f95=_0xa064[_0x1b129f];return _0x117f95;};'use strict';var _=require(_0x4a06('0x0'));var util=require(_0x4a06('0x1'));var logger=require(_0x4a06('0x2'))(_0x4a06('0x3'));var moment=require(_0x4a06('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4a06('0x5'));var rimraf=require('rimraf');var config=require(_0x4a06('0x6'));var attributes=require(_0x4a06('0x7'));module['exports']=function(_0x3f2099,_0x54c9ed){return _0x3f2099['define'](_0x4a06('0x8'),attributes,{'tableName':_0x4a06('0x9'),'paranoid':![],'indexes':[{'name':'freshsales_unique_index','fields':['idField',_0x4a06('0xa')],'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 a52aa04..466085d 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 _0x687b=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils'];(function(_0x2ff4bd,_0x4780a6){var _0x28edc6=function(_0x792380){while(--_0x792380){_0x2ff4bd['push'](_0x2ff4bd['shift']());}};_0x28edc6(++_0x4780a6);}(_0x687b,0x14a));var _0xb687=function(_0x2b1bb9,_0x3f85cc){_0x2b1bb9=_0x2b1bb9-0x0;var _0x59f401=_0x687b[_0x2b1bb9];return _0x59f401;};'use strict';var _=require(_0xb687('0x0'));var util=require(_0xb687('0x1'));var moment=require(_0xb687('0x2'));var BPromise=require(_0xb687('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb687('0x4'))['db'];var utils=require(_0xb687('0x5'));var logger=require(_0xb687('0x6'))(_0xb687('0x7'));var config=require(_0xb687('0x8'));var jayson=require(_0xb687('0x9'));var client=jayson[_0xb687('0xa')][_0xb687('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x47ffea,_0x27b750,_0x48942b){return new BPromise(function(_0x2aea59,_0xd40346){return client['request'](_0x47ffea,_0x48942b)[_0xb687('0xc')](function(_0x21e3ab){logger[_0xb687('0xd')](_0xb687('0xe'),_0x27b750,_0xb687('0xf'));logger[_0xb687('0x10')](_0xb687('0x11'),_0x27b750,_0xb687('0xf'),JSON[_0xb687('0x12')](_0x21e3ab));if(_0x21e3ab['error']){if(_0x21e3ab[_0xb687('0x13')][_0xb687('0x14')]===0x1f4){logger[_0xb687('0x13')](_0xb687('0xe'),_0x27b750,_0x21e3ab['error']['message']);return _0xd40346(_0x21e3ab[_0xb687('0x13')][_0xb687('0x15')]);}logger['error'](_0xb687('0xe'),_0x27b750,_0x21e3ab[_0xb687('0x13')][_0xb687('0x15')]);return _0x2aea59(_0x21e3ab[_0xb687('0x13')][_0xb687('0x15')]);}else{logger[_0xb687('0xd')](_0xb687('0xe'),_0x27b750,_0xb687('0xf'));_0x2aea59(_0x21e3ab[_0xb687('0x16')][_0xb687('0x15')]);}})[_0xb687('0x17')](function(_0x19bb29){logger['error'](_0xb687('0xe'),_0x27b750,_0x19bb29);_0xd40346(_0x19bb29);});});} \ No newline at end of file +var _0x814b=['info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then'];(function(_0x411add,_0x1aed38){var _0x238242=function(_0x4a1cd5){while(--_0x4a1cd5){_0x411add['push'](_0x411add['shift']());}};_0x238242(++_0x1aed38);}(_0x814b,0x1a2));var _0xb814=function(_0x3cbe3a,_0x78bfce){_0x3cbe3a=_0x3cbe3a-0x0;var _0x24ffc1=_0x814b[_0x3cbe3a];return _0x24ffc1;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var moment=require(_0xb814('0x2'));var BPromise=require(_0xb814('0x3'));var rs=require(_0xb814('0x4'));var fs=require('fs');var Redis=require(_0xb814('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xb814('0x6'));var logger=require(_0xb814('0x7'))(_0xb814('0x8'));var config=require(_0xb814('0x9'));var jayson=require(_0xb814('0xa'));var client=jayson[_0xb814('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b0829,_0x2e6272,_0x5c8539){return new BPromise(function(_0x271af9,_0x2913a6){return client[_0xb814('0xc')](_0x3b0829,_0x5c8539)[_0xb814('0xd')](function(_0x1fea33){logger[_0xb814('0xe')](_0xb814('0xf'),_0x2e6272,_0xb814('0x10'));logger[_0xb814('0x11')](_0xb814('0x12'),_0x2e6272,_0xb814('0x10'),JSON['stringify'](_0x1fea33));if(_0x1fea33[_0xb814('0x13')]){if(_0x1fea33['error'][_0xb814('0x14')]===0x1f4){logger[_0xb814('0x13')](_0xb814('0xf'),_0x2e6272,_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);return _0x2913a6(_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);}logger[_0xb814('0x13')](_0xb814('0xf'),_0x2e6272,_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);return _0x271af9(_0x1fea33[_0xb814('0x13')][_0xb814('0x15')]);}else{logger[_0xb814('0xe')](_0xb814('0xf'),_0x2e6272,_0xb814('0x10'));_0x271af9(_0x1fea33[_0xb814('0x16')][_0xb814('0x15')]);}})[_0xb814('0x17')](function(_0x21b73f){logger[_0xb814('0x13')]('FreshsalesField,\x20%s,\x20%s',_0x2e6272,_0x21b73f);_0x2913a6(_0x21b73f);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index 38f584e..0276e7c 100644 --- a/server/api/intSalesforceAccount/index.js +++ b/server/api/intSalesforceAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSalesforceAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x17f7ed,_0x384ff9){var _0x333655=function(_0x4812f2){while(--_0x4812f2){_0x17f7ed['push'](_0x17f7ed['shift']());}};_0x333655(++_0x384ff9);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file +var _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(_0x10310a,_0x3293eb){var _0xc062b5=function(_0x7241d2){while(--_0x7241d2){_0x10310a['push'](_0x10310a['shift']());}};_0xc062b5(++_0x3293eb);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'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 17532f6..ab2b2db 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 _0x508a=['sequelize','STRING','username','ENUM','integrationTab','newTab'];(function(_0x1d4c12,_0x27c5d7){var _0x1c8c5f=function(_0x28fff6){while(--_0x28fff6){_0x1d4c12['push'](_0x1d4c12['shift']());}};_0x1c8c5f(++_0x27c5d7);}(_0x508a,0x1aa));var _0xa508=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x508a[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xa508('0x0'));module['exports']={'name':{'type':Sequelize[_0xa508('0x1')]},'description':{'type':Sequelize[_0xa508('0x1')]},'username':{'type':Sequelize[_0xa508('0x1')],'unique':_0xa508('0x2')},'remoteUri':{'type':Sequelize[_0xa508('0x1')]},'password':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0xa508('0x1')]},'clientSecret':{'type':Sequelize[_0xa508('0x1')]},'securityToken':{'type':Sequelize[_0xa508('0x1')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xa508('0x3')](_0xa508('0x4'),_0xa508('0x5')),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0x07fa=['exports','STRING','username','ENUM','integrationTab'];(function(_0x2ff739,_0x1c8e0f){var _0x12dc13=function(_0x26fc97){while(--_0x26fc97){_0x2ff739['push'](_0x2ff739['shift']());}};_0x12dc13(++_0x1c8e0f);}(_0x07fa,0x177));var _0xa07f=function(_0x35da42,_0x5c2610){_0x35da42=_0x35da42-0x0;var _0x370035=_0x07fa[_0x35da42];return _0x370035;};'use strict';var Sequelize=require('sequelize');module[_0xa07f('0x0')]={'name':{'type':Sequelize[_0xa07f('0x1')]},'description':{'type':Sequelize[_0xa07f('0x1')]},'username':{'type':Sequelize[_0xa07f('0x1')],'unique':_0xa07f('0x2')},'remoteUri':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xa07f('0x1')]},'clientId':{'type':Sequelize[_0xa07f('0x1')]},'clientSecret':{'type':Sequelize['STRING']},'securityToken':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xa07f('0x3')](_0xa07f('0x4'),'newTab'),'defaultValue':_0xa07f('0x4')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index fdc683a..0c95ffa 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 _0x42ef=['papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','limit','undefined','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','stack','name','index','map','SalesforceAccount','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','catch','params','create','body','find','getConfigurations','findOne','SalesforceConfiguration','addConfiguration','AccountId','getSubjects','channel','Descriptions','SalesforceField','Subjects','Task','clientId','clientSecret','username','password','securityToken','remoteUri','substring','lastIndexOf','Connection','login','concat','isNil','ticketType','describe','ActivityDate','IsReminderSet','Subject','Description','string','email','phone','remove','includes','picklistValues','boolean','true','False','false','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring'];(function(_0x29bfa2,_0x45368c){var _0x5ef78d=function(_0x390933){while(--_0x390933){_0x29bfa2['push'](_0x29bfa2['shift']());}};_0x5ef78d(++_0x45368c);}(_0x42ef,0x1ce));var _0xf42e=function(_0x1f1573,_0x3e23ea){_0x1f1573=_0x1f1573-0x0;var _0x22b817=_0x42ef[_0x1f1573];return _0x22b817;};'use strict';var emlformat=require(_0xf42e('0x0'));var rimraf=require(_0xf42e('0x1'));var zipdir=require(_0xf42e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf42e('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xf42e('0x4'));var util=require(_0xf42e('0x5'));var path=require('path');var sox=require(_0xf42e('0x6'));var csv=require(_0xf42e('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf42e('0x8'));var _=require(_0xf42e('0x9'));var squel=require(_0xf42e('0xa'));var crypto=require(_0xf42e('0xb'));var jsforce=require(_0xf42e('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xf42e('0x7'));var querystring=require(_0xf42e('0xd'));var Papa=require(_0xf42e('0xe'));var Redis=require('ioredis');var authService=require(_0xf42e('0xf'));var qs=require(_0xf42e('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf42e('0x11'));var logger=require('../../config/logger')(_0xf42e('0x12'));var utils=require(_0xf42e('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xf42e('0x14'));var db=require(_0xf42e('0x15'))['db'];var integrations=require(_0xf42e('0x16'));function respondWithStatusCode(_0x5eb502,_0xd1bad){_0xd1bad=_0xd1bad||0xcc;return function(_0x29d8ff){if(_0x29d8ff){return _0x5eb502[_0xf42e('0x17')](_0xd1bad);}return _0x5eb502[_0xf42e('0x18')](_0xd1bad)[_0xf42e('0x19')]();};}function respondWithResult(_0x3ee590,_0x56ad97){_0x56ad97=_0x56ad97||0xc8;return function(_0x2bb535){if(_0x2bb535){return _0x3ee590[_0xf42e('0x18')](_0x56ad97)['json'](_0x2bb535);}};}function respondWithFilteredResult(_0xc9b19d,_0x2c670c){return function(_0xd95991){if(_0xd95991){var _0x1cf1cb=typeof _0x2c670c['offset']==='undefined'&&typeof _0x2c670c[_0xf42e('0x1a')]===_0xf42e('0x1b');var _0x20d2d7=_0xd95991[_0xf42e('0x1c')];var _0x1fbf47=_0x1cf1cb?0x0:_0x2c670c[_0xf42e('0x1d')];var _0x1df284=_0x1cf1cb?_0xd95991[_0xf42e('0x1c')]:_0x2c670c['offset']+_0x2c670c[_0xf42e('0x1a')];var _0x3b0919;if(_0x1df284>=_0x20d2d7){_0x1df284=_0x20d2d7;_0x3b0919=0xc8;}else{_0x3b0919=0xce;}_0xc9b19d['status'](_0x3b0919);return _0xc9b19d[_0xf42e('0x1e')](_0xf42e('0x1f'),_0x1fbf47+'-'+_0x1df284+'/'+_0x20d2d7)[_0xf42e('0x20')](_0xd95991);}return null;};}function patchUpdates(_0x59adb0){return function(_0x224f2a){try{jsonpatch[_0xf42e('0x21')](_0x224f2a,_0x59adb0,!![]);}catch(_0xacc127){return BPromise[_0xf42e('0x22')](_0xacc127);}return _0x224f2a[_0xf42e('0x23')]();};}function saveUpdates(_0x3c10ec,_0x23a9b7){return function(_0x1d6fac){if(_0x1d6fac){return _0x1d6fac[_0xf42e('0x24')](_0x3c10ec)[_0xf42e('0x25')](function(_0x34902c){return _0x34902c;});}return null;};}function removeEntity(_0x570668,_0x24f80b){return function(_0x4644ed){if(_0x4644ed){return _0x4644ed[_0xf42e('0x26')]()[_0xf42e('0x25')](function(){_0x570668[_0xf42e('0x18')](0xcc)[_0xf42e('0x19')]();});}};}function handleEntityNotFound(_0x5d087a,_0x5af824){return function(_0x57dc3d){if(!_0x57dc3d){_0x5d087a[_0xf42e('0x17')](0x194);}return _0x57dc3d;};}function handleError(_0x20dfc7,_0x8b33c8){_0x8b33c8=_0x8b33c8||0x1f4;return function(_0x139bec){logger['error'](_0x139bec[_0xf42e('0x27')]);if(_0x139bec['name']){delete _0x139bec[_0xf42e('0x28')];}_0x20dfc7[_0xf42e('0x18')](_0x8b33c8)['send'](_0x139bec);};}exports[_0xf42e('0x29')]=function(_0x1d07ec,_0x247102){var _0x4d5896={},_0x555196={},_0x16bdda={'count':0x0,'rows':[]};var _0x4dfb33=_[_0xf42e('0x2a')](db[_0xf42e('0x2b')][_0xf42e('0x2c')],function(_0x18d6af){return{'name':_0x18d6af['fieldName'],'type':_0x18d6af['type'][_0xf42e('0x2d')]};});_0x555196[_0xf42e('0x2e')]=_['map'](_0x4dfb33,_0xf42e('0x28'));_0x555196[_0xf42e('0x2f')]=_[_0xf42e('0x30')](_0x1d07ec[_0xf42e('0x2f')]);_0x555196[_0xf42e('0x31')]=_[_0xf42e('0x32')](_0x555196[_0xf42e('0x2e')],_0x555196[_0xf42e('0x2f')]);_0x4d5896[_0xf42e('0x33')]=_[_0xf42e('0x32')](_0x555196[_0xf42e('0x2e')],qs[_0xf42e('0x34')](_0x1d07ec[_0xf42e('0x2f')]['fields']));_0x4d5896['attributes']=_0x4d5896['attributes'][_0xf42e('0x35')]?_0x4d5896[_0xf42e('0x33')]:_0x555196[_0xf42e('0x2e')];if(!_0x1d07ec[_0xf42e('0x2f')][_0xf42e('0x36')](_0xf42e('0x37'))){_0x4d5896['limit']=qs['limit'](_0x1d07ec[_0xf42e('0x2f')][_0xf42e('0x1a')]);_0x4d5896[_0xf42e('0x1d')]=qs[_0xf42e('0x1d')](_0x1d07ec[_0xf42e('0x2f')][_0xf42e('0x1d')]);}_0x4d5896[_0xf42e('0x38')]=qs[_0xf42e('0x39')](_0x1d07ec['query'][_0xf42e('0x39')]);_0x4d5896[_0xf42e('0x3a')]=qs['filters'](_[_0xf42e('0x3b')](_0x1d07ec[_0xf42e('0x2f')],_0x555196[_0xf42e('0x31')]),_0x4dfb33);if(_0x1d07ec[_0xf42e('0x2f')][_0xf42e('0x3c')]){_0x4d5896[_0xf42e('0x3a')]=_['merge'](_0x4d5896[_0xf42e('0x3a')],{'$or':_[_0xf42e('0x2a')](_0x4dfb33,function(_0x17ecb7){if(_0x17ecb7[_0xf42e('0x3d')]!==_0xf42e('0x3e')){var _0x52d99e={};_0x52d99e[_0x17ecb7[_0xf42e('0x28')]]={'$like':'%'+_0x1d07ec[_0xf42e('0x2f')][_0xf42e('0x3c')]+'%'};return _0x52d99e;}})});}_0x4d5896=_[_0xf42e('0x3f')]({},_0x4d5896,_0x1d07ec[_0xf42e('0x40')]);var _0x5f0ed9={'where':_0x4d5896['where']};return db['SalesforceAccount'][_0xf42e('0x1c')](_0x5f0ed9)[_0xf42e('0x25')](function(_0x29b593){_0x16bdda['count']=_0x29b593;if(_0x1d07ec['query'][_0xf42e('0x41')]){_0x4d5896[_0xf42e('0x42')]=[{'all':!![]}];}return db[_0xf42e('0x2b')][_0xf42e('0x43')](_0x4d5896);})[_0xf42e('0x25')](function(_0x4d4066){_0x16bdda['rows']=_0x4d4066;return _0x16bdda;})[_0xf42e('0x25')](respondWithFilteredResult(_0x247102,_0x4d5896))[_0xf42e('0x44')](handleError(_0x247102,null));};exports['show']=function(_0x931088,_0x4144ee){var _0x2db507={'raw':![],'where':{'id':_0x931088[_0xf42e('0x45')]['id']}},_0x21e618={};_0x21e618[_0xf42e('0x2e')]=_['keys'](db[_0xf42e('0x2b')][_0xf42e('0x2c')]);_0x21e618[_0xf42e('0x2f')]=_[_0xf42e('0x30')](_0x931088['query']);_0x21e618['filters']=_[_0xf42e('0x32')](_0x21e618[_0xf42e('0x2e')],_0x21e618[_0xf42e('0x2f')]);_0x2db507['attributes']=_[_0xf42e('0x32')](_0x21e618[_0xf42e('0x2e')],qs['fields'](_0x931088[_0xf42e('0x2f')][_0xf42e('0x34')]));_0x2db507[_0xf42e('0x33')]=_0x2db507[_0xf42e('0x33')][_0xf42e('0x35')]?_0x2db507[_0xf42e('0x33')]:_0x21e618[_0xf42e('0x2e')];if(_0x931088['query'][_0xf42e('0x41')]){_0x2db507['include']=[{'all':!![]}];}_0x2db507=_[_0xf42e('0x3f')]({},_0x2db507,_0x931088[_0xf42e('0x40')]);return db[_0xf42e('0x2b')]['find'](_0x2db507)['then'](handleEntityNotFound(_0x4144ee,null))[_0xf42e('0x25')](respondWithResult(_0x4144ee,null))[_0xf42e('0x44')](handleError(_0x4144ee,null));};exports[_0xf42e('0x46')]=function(_0x3d7b7e,_0x3c2822){return db['SalesforceAccount'][_0xf42e('0x46')](_0x3d7b7e[_0xf42e('0x47')],{})[_0xf42e('0x25')](respondWithResult(_0x3c2822,0xc9))[_0xf42e('0x44')](handleError(_0x3c2822,null));};exports['update']=function(_0x5c0f50,_0x5d0717){if(_0x5c0f50[_0xf42e('0x47')]['id']){delete _0x5c0f50[_0xf42e('0x47')]['id'];}return db[_0xf42e('0x2b')][_0xf42e('0x48')]({'where':{'id':_0x5c0f50[_0xf42e('0x45')]['id']}})['then'](handleEntityNotFound(_0x5d0717,null))[_0xf42e('0x25')](saveUpdates(_0x5c0f50[_0xf42e('0x47')],null))[_0xf42e('0x25')](respondWithResult(_0x5d0717,null))['catch'](handleError(_0x5d0717,null));};exports['destroy']=function(_0x55cc1b,_0x364a3d){return db[_0xf42e('0x2b')][_0xf42e('0x48')]({'where':{'id':_0x55cc1b[_0xf42e('0x45')]['id']}})['then'](handleEntityNotFound(_0x364a3d,null))['then'](removeEntity(_0x364a3d,null))[_0xf42e('0x44')](handleError(_0x364a3d,null));};exports[_0xf42e('0x49')]=function(_0x3ad965,_0x10a2ee,_0x142f06){var _0x2caff0={};var _0x55ee98={};var _0x3b449e;var _0x2fbddd;return db[_0xf42e('0x2b')][_0xf42e('0x4a')]({'where':{'id':_0x3ad965['params']['id']}})[_0xf42e('0x25')](handleEntityNotFound(_0x10a2ee,null))[_0xf42e('0x25')](function(_0x47039e){if(_0x47039e){_0x3b449e=_0x47039e;_0x55ee98[_0xf42e('0x2e')]=_[_0xf42e('0x30')](db[_0xf42e('0x4b')][_0xf42e('0x2c')]);_0x55ee98['query']=_['keys'](_0x3ad965['query']);_0x55ee98['filters']=_[_0xf42e('0x32')](_0x55ee98[_0xf42e('0x2e')],_0x55ee98[_0xf42e('0x2f')]);_0x2caff0[_0xf42e('0x33')]=_['intersection'](_0x55ee98[_0xf42e('0x2e')],qs[_0xf42e('0x34')](_0x3ad965[_0xf42e('0x2f')]['fields']));_0x2caff0[_0xf42e('0x33')]=_0x2caff0[_0xf42e('0x33')][_0xf42e('0x35')]?_0x2caff0[_0xf42e('0x33')]:_0x55ee98[_0xf42e('0x2e')];_0x2caff0[_0xf42e('0x38')]=qs[_0xf42e('0x39')](_0x3ad965[_0xf42e('0x2f')][_0xf42e('0x39')]);_0x2caff0[_0xf42e('0x3a')]=qs[_0xf42e('0x31')](_[_0xf42e('0x3b')](_0x3ad965[_0xf42e('0x2f')],_0x55ee98[_0xf42e('0x31')]));if(_0x3ad965[_0xf42e('0x2f')][_0xf42e('0x3c')]){_0x2caff0[_0xf42e('0x3a')]=_[_0xf42e('0x3f')](_0x2caff0[_0xf42e('0x3a')],{'$or':_[_0xf42e('0x2a')](_0x2caff0[_0xf42e('0x33')],function(_0x523a64){var _0x2d3820={};_0x2d3820[_0x523a64]={'$like':'%'+_0x3ad965[_0xf42e('0x2f')][_0xf42e('0x3c')]+'%'};return _0x2d3820;})});}_0x2caff0=_['merge']({},_0x2caff0,_0x3ad965[_0xf42e('0x40')]);return _0x3b449e['getConfigurations'](_0x2caff0);}})[_0xf42e('0x25')](function(_0x20f97a){if(_0x20f97a){_0x2fbddd=_0x20f97a['length'];if(!_0x3ad965['query'][_0xf42e('0x36')]('nolimit')){_0x2caff0[_0xf42e('0x1a')]=qs[_0xf42e('0x1a')](_0x3ad965[_0xf42e('0x2f')][_0xf42e('0x1a')]);_0x2caff0[_0xf42e('0x1d')]=qs[_0xf42e('0x1d')](_0x3ad965[_0xf42e('0x2f')][_0xf42e('0x1d')]);}return _0x3b449e[_0xf42e('0x49')](_0x2caff0);}})['then'](function(_0x31cc95){if(_0x31cc95){return _0x31cc95?{'count':_0x2fbddd,'rows':_0x31cc95}:null;}})[_0xf42e('0x25')](respondWithResult(_0x10a2ee,null))[_0xf42e('0x44')](handleError(_0x10a2ee,null));};exports[_0xf42e('0x4c')]=function(_0x32a728,_0x4ea75e,_0x7f1078){if(_0x32a728['body']['id']){delete _0x32a728[_0xf42e('0x47')]['id'];}return db['SalesforceAccount'][_0xf42e('0x4a')]({'where':{'id':_0x32a728['params']['id']}})[_0xf42e('0x25')](handleEntityNotFound(_0x4ea75e,null))[_0xf42e('0x25')](function(_0x48bf95){if(_0x48bf95){_0x32a728[_0xf42e('0x47')][_0xf42e('0x4d')]=_0x48bf95['id'];_0x32a728[_0xf42e('0x47')]['Subjects']=integrations[_0xf42e('0x4e')](_0x32a728[_0xf42e('0x47')][_0xf42e('0x4f')],_0x32a728['body']['type']);_0x32a728['body'][_0xf42e('0x50')]=integrations['getDescriptions'](_0x32a728['body'][_0xf42e('0x4f')],_0x32a728[_0xf42e('0x47')]['type']);return db[_0xf42e('0x4b')][_0xf42e('0x46')](_0x32a728[_0xf42e('0x47')],{'include':[{'model':db[_0xf42e('0x51')],'as':_0xf42e('0x52')},{'model':db[_0xf42e('0x51')],'as':_0xf42e('0x50')}]});}return null;})['then'](respondWithResult(_0x4ea75e,null))[_0xf42e('0x44')](handleError(_0x4ea75e,null));};exports['getFields']=function(_0x47fd3f,_0x2a5da8,_0x3d9849){var _0x2527b9;var _0x27b1ca='';var _0x3e520e=_0xf42e('0x53');return db[_0xf42e('0x2b')][_0xf42e('0x4a')]({'where':{'id':_0x47fd3f[_0xf42e('0x45')]['id']},'attributes':['id','remoteUri',_0xf42e('0x54'),_0xf42e('0x55'),_0xf42e('0x56'),_0xf42e('0x57'),_0xf42e('0x58')]})[_0xf42e('0x25')](handleEntityNotFound(_0x2a5da8,null))[_0xf42e('0x25')](function(_0x55aa2f){if(_0x55aa2f){_0x27b1ca=_0x55aa2f[_0xf42e('0x59')];var _0x5a797b=_0x27b1ca['slice'](-0x1);if(_0x5a797b==='/'){_0x27b1ca=_0x27b1ca[_0xf42e('0x5a')](0x0,_0x27b1ca[_0xf42e('0x5b')](_0x5a797b));}_0x2527b9=new jsforce[(_0xf42e('0x5c'))]({'oauth2':{'loginUrl':_0x27b1ca,'clientId':_0x55aa2f[_0xf42e('0x54')],'clientSecret':_0x55aa2f[_0xf42e('0x55')]}});return _0x2527b9[_0xf42e('0x5d')](_0x55aa2f[_0xf42e('0x56')],_0x55aa2f[_0xf42e('0x57')][_0xf42e('0x5e')](_0x55aa2f[_0xf42e('0x58')]));}})[_0xf42e('0x25')](function(_0x12002f){if(_0x12002f){if(!_[_0xf42e('0x5f')](_0x47fd3f[_0xf42e('0x2f')][_0xf42e('0x60')])){_0x3e520e=_0x47fd3f[_0xf42e('0x2f')][_0xf42e('0x60')];}return _0x2527b9['sobject'](_0x3e520e)[_0xf42e('0x61')]();}})[_0xf42e('0x25')](function(_0x5a7131){var _0x21e8d0=['OwnerId',_0xf42e('0x62'),_0xf42e('0x63'),'IsRecurrence',_0xf42e('0x64'),_0xf42e('0x65')];var _0x556279=[_0xf42e('0x66'),'int','picklist','boolean',_0xf42e('0x67'),'textarea',_0xf42e('0x68')];if(_0x5a7131){_[_0xf42e('0x69')](_0x5a7131['fields'],function(_0x22bd39){return _0x21e8d0['includes'](_0x22bd39[_0xf42e('0x28')])||!_0x556279[_0xf42e('0x6a')](_0x22bd39[_0xf42e('0x3d')]);});return{'count':_0x5a7131['fields'][_0xf42e('0x35')],'rows':_[_0xf42e('0x2a')](_0x5a7131[_0xf42e('0x34')],function(_0x319760){return{'id':_0x319760[_0xf42e('0x28')],'name':_0x319760['label'],'custom':_0x319760['custom'],'options':_0x319760[_0xf42e('0x6b')][_0xf42e('0x35')]>0x0?_['map'](_0x319760['picklistValues'],function(_0x28605a){return{'name':_0x28605a['label'],'value':_0x28605a['value']};}):_0x319760['type']==_0xf42e('0x6c')?[{'name':'True','value':_0xf42e('0x6d')},{'name':_0xf42e('0x6e'),'value':_0xf42e('0x6f')}]:[]};})};}})['then'](respondWithResult(_0x2a5da8,null))['catch'](function(_0x34b825){var _0x5e85da=_0x47fd3f['query'][_0xf42e('0x70')]?0x1f4:_0x34b825[_0xf42e('0x71')]||0x1f4;logger[_0xf42e('0x72')](_0xf42e('0x73'),'getFields',_0x5e85da,JSON[_0xf42e('0x74')](_0x34b825));delete _0x34b825['name'];if(_0x5e85da===0x191){_0x5e85da=0x190;}_0x2a5da8['status'](_0x5e85da)[_0xf42e('0x75')](_0x47fd3f['query']['test']?{'message':_0xf42e('0x76'),'statusCode':_0x34b825['statusCode']}:_0x34b825);});}; \ No newline at end of file +var _0xceac=['ActivityDate','IsReminderSet','IsRecurrence','Subject','int','picklist','boolean','email','textarea','phone','includes','custom','picklistValues','value','True','true','false','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','send','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','limit','undefined','count','offset','set','Content-Range','reject','save','update','then','destroy','error','name','index','SalesforceAccount','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','options','rows','catch','show','includeAll','include','find','create','body','params','getConfigurations','SalesforceConfiguration','filter','nolimit','addConfiguration','findOne','AccountId','Subjects','channel','getDescriptions','SalesforceField','Descriptions','Task','remoteUri','clientId','clientSecret','password','securityToken','substring','lastIndexOf','Connection','login','username','concat','isNil','sobject','describe','OwnerId'];(function(_0x4a2c9c,_0x23ab21){var _0x40d7b5=function(_0x4043c1){while(--_0x4043c1){_0x4a2c9c['push'](_0x4a2c9c['shift']());}};_0x40d7b5(++_0x23ab21);}(_0xceac,0x92));var _0xccea=function(_0x271d78,_0x1815a8){_0x271d78=_0x271d78-0x0;var _0x5f39c1=_0xceac[_0x271d78];return _0x5f39c1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xccea('0x0'));var zipdir=require(_0xccea('0x1'));var jsonpatch=require(_0xccea('0x2'));var rp=require(_0xccea('0x3'));var moment=require(_0xccea('0x4'));var BPromise=require(_0xccea('0x5'));var Mustache=require(_0xccea('0x6'));var util=require(_0xccea('0x7'));var path=require('path');var sox=require(_0xccea('0x8'));var csv=require(_0xccea('0x9'));var ejs=require(_0xccea('0xa'));var fs=require('fs');var fs_extra=require(_0xccea('0xb'));var _=require(_0xccea('0xc'));var squel=require('squel');var crypto=require(_0xccea('0xd'));var jsforce=require(_0xccea('0xe'));var deskjs=require(_0xccea('0xf'));var toCsv=require(_0xccea('0x9'));var querystring=require(_0xccea('0x10'));var Papa=require(_0xccea('0x11'));var Redis=require('ioredis');var authService=require(_0xccea('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xccea('0x13'))(_0xccea('0x14'));var utils=require(_0xccea('0x15'));var config=require(_0xccea('0x16'));var licenseUtil=require(_0xccea('0x17'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x4098be,_0x5c5517){_0x5c5517=_0x5c5517||0xcc;return function(_0x219dfe){if(_0x219dfe){return _0x4098be[_0xccea('0x18')](_0x5c5517);}return _0x4098be[_0xccea('0x19')](_0x5c5517)['end']();};}function respondWithResult(_0xd24745,_0x4ae7a9){_0x4ae7a9=_0x4ae7a9||0xc8;return function(_0xb30898){if(_0xb30898){return _0xd24745[_0xccea('0x19')](_0x4ae7a9)[_0xccea('0x1a')](_0xb30898);}};}function respondWithFilteredResult(_0x348af0,_0x19b34e){return function(_0x371d94){if(_0x371d94){var _0x325001=typeof _0x19b34e['offset']==='undefined'&&typeof _0x19b34e[_0xccea('0x1b')]===_0xccea('0x1c');var _0x429881=_0x371d94[_0xccea('0x1d')];var _0x25bb6d=_0x325001?0x0:_0x19b34e[_0xccea('0x1e')];var _0x4042b8=_0x325001?_0x371d94[_0xccea('0x1d')]:_0x19b34e[_0xccea('0x1e')]+_0x19b34e[_0xccea('0x1b')];var _0x1b1656;if(_0x4042b8>=_0x429881){_0x4042b8=_0x429881;_0x1b1656=0xc8;}else{_0x1b1656=0xce;}_0x348af0[_0xccea('0x19')](_0x1b1656);return _0x348af0[_0xccea('0x1f')](_0xccea('0x20'),_0x25bb6d+'-'+_0x4042b8+'/'+_0x429881)[_0xccea('0x1a')](_0x371d94);}return null;};}function patchUpdates(_0x7f5bb4){return function(_0x248774){try{jsonpatch['apply'](_0x248774,_0x7f5bb4,!![]);}catch(_0x2b168d){return BPromise[_0xccea('0x21')](_0x2b168d);}return _0x248774[_0xccea('0x22')]();};}function saveUpdates(_0xd931c9,_0x506436){return function(_0x1363cc){if(_0x1363cc){return _0x1363cc[_0xccea('0x23')](_0xd931c9)[_0xccea('0x24')](function(_0x34742a){return _0x34742a;});}return null;};}function removeEntity(_0x5a5f04,_0x540b9a){return function(_0x584dcc){if(_0x584dcc){return _0x584dcc[_0xccea('0x25')]()[_0xccea('0x24')](function(){_0x5a5f04[_0xccea('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x25dc03,_0x1a5b3e){return function(_0x509f00){if(!_0x509f00){_0x25dc03[_0xccea('0x18')](0x194);}return _0x509f00;};}function handleError(_0x35aea0,_0x2c65c6){_0x2c65c6=_0x2c65c6||0x1f4;return function(_0x45bf6f){logger[_0xccea('0x26')](_0x45bf6f['stack']);if(_0x45bf6f['name']){delete _0x45bf6f[_0xccea('0x27')];}_0x35aea0[_0xccea('0x19')](_0x2c65c6)['send'](_0x45bf6f);};}exports[_0xccea('0x28')]=function(_0x10fadd,_0x3aa636){var _0xfa3f14={},_0x148b06={},_0x3d1d13={'count':0x0,'rows':[]};var _0x81bc5e=_['map'](db[_0xccea('0x29')][_0xccea('0x2a')],function(_0x5361c1){return{'name':_0x5361c1[_0xccea('0x2b')],'type':_0x5361c1[_0xccea('0x2c')][_0xccea('0x2d')]};});_0x148b06[_0xccea('0x2e')]=_[_0xccea('0x2f')](_0x81bc5e,_0xccea('0x27'));_0x148b06['query']=_[_0xccea('0x30')](_0x10fadd[_0xccea('0x31')]);_0x148b06[_0xccea('0x32')]=_[_0xccea('0x33')](_0x148b06[_0xccea('0x2e')],_0x148b06[_0xccea('0x31')]);_0xfa3f14[_0xccea('0x34')]=_[_0xccea('0x33')](_0x148b06[_0xccea('0x2e')],qs['fields'](_0x10fadd[_0xccea('0x31')][_0xccea('0x35')]));_0xfa3f14['attributes']=_0xfa3f14[_0xccea('0x34')][_0xccea('0x36')]?_0xfa3f14[_0xccea('0x34')]:_0x148b06[_0xccea('0x2e')];if(!_0x10fadd['query'][_0xccea('0x37')]('nolimit')){_0xfa3f14['limit']=qs[_0xccea('0x1b')](_0x10fadd['query'][_0xccea('0x1b')]);_0xfa3f14[_0xccea('0x1e')]=qs['offset'](_0x10fadd[_0xccea('0x31')][_0xccea('0x1e')]);}_0xfa3f14[_0xccea('0x38')]=qs[_0xccea('0x39')](_0x10fadd[_0xccea('0x31')][_0xccea('0x39')]);_0xfa3f14[_0xccea('0x3a')]=qs[_0xccea('0x32')](_[_0xccea('0x3b')](_0x10fadd[_0xccea('0x31')],_0x148b06[_0xccea('0x32')]),_0x81bc5e);if(_0x10fadd[_0xccea('0x31')]['filter']){_0xfa3f14[_0xccea('0x3a')]=_[_0xccea('0x3c')](_0xfa3f14[_0xccea('0x3a')],{'$or':_['map'](_0x81bc5e,function(_0x4aa4f7){if(_0x4aa4f7['type']!==_0xccea('0x3d')){var _0x4d3ad7={};_0x4d3ad7[_0x4aa4f7['name']]={'$like':'%'+_0x10fadd[_0xccea('0x31')]['filter']+'%'};return _0x4d3ad7;}})});}_0xfa3f14=_['merge']({},_0xfa3f14,_0x10fadd[_0xccea('0x3e')]);var _0x467f9e={'where':_0xfa3f14[_0xccea('0x3a')]};return db[_0xccea('0x29')][_0xccea('0x1d')](_0x467f9e)[_0xccea('0x24')](function(_0x6cc355){_0x3d1d13[_0xccea('0x1d')]=_0x6cc355;if(_0x10fadd[_0xccea('0x31')]['includeAll']){_0xfa3f14['include']=[{'all':!![]}];}return db[_0xccea('0x29')]['findAll'](_0xfa3f14);})[_0xccea('0x24')](function(_0x5d3cf8){_0x3d1d13[_0xccea('0x3f')]=_0x5d3cf8;return _0x3d1d13;})[_0xccea('0x24')](respondWithFilteredResult(_0x3aa636,_0xfa3f14))[_0xccea('0x40')](handleError(_0x3aa636,null));};exports[_0xccea('0x41')]=function(_0x54b098,_0x344c16){var _0x36cf5c={'raw':![],'where':{'id':_0x54b098['params']['id']}},_0x471c7a={};_0x471c7a[_0xccea('0x2e')]=_['keys'](db[_0xccea('0x29')][_0xccea('0x2a')]);_0x471c7a['query']=_[_0xccea('0x30')](_0x54b098[_0xccea('0x31')]);_0x471c7a[_0xccea('0x32')]=_['intersection'](_0x471c7a[_0xccea('0x2e')],_0x471c7a[_0xccea('0x31')]);_0x36cf5c[_0xccea('0x34')]=_[_0xccea('0x33')](_0x471c7a['model'],qs['fields'](_0x54b098[_0xccea('0x31')][_0xccea('0x35')]));_0x36cf5c[_0xccea('0x34')]=_0x36cf5c[_0xccea('0x34')][_0xccea('0x36')]?_0x36cf5c['attributes']:_0x471c7a[_0xccea('0x2e')];if(_0x54b098[_0xccea('0x31')][_0xccea('0x42')]){_0x36cf5c[_0xccea('0x43')]=[{'all':!![]}];}_0x36cf5c=_[_0xccea('0x3c')]({},_0x36cf5c,_0x54b098[_0xccea('0x3e')]);return db[_0xccea('0x29')][_0xccea('0x44')](_0x36cf5c)[_0xccea('0x24')](handleEntityNotFound(_0x344c16,null))[_0xccea('0x24')](respondWithResult(_0x344c16,null))['catch'](handleError(_0x344c16,null));};exports[_0xccea('0x45')]=function(_0x2e5cff,_0x13eae9){return db[_0xccea('0x29')][_0xccea('0x45')](_0x2e5cff[_0xccea('0x46')],{})[_0xccea('0x24')](respondWithResult(_0x13eae9,0xc9))[_0xccea('0x40')](handleError(_0x13eae9,null));};exports[_0xccea('0x23')]=function(_0x1e5cfd,_0x3f1dc8){if(_0x1e5cfd['body']['id']){delete _0x1e5cfd[_0xccea('0x46')]['id'];}return db[_0xccea('0x29')][_0xccea('0x44')]({'where':{'id':_0x1e5cfd[_0xccea('0x47')]['id']}})[_0xccea('0x24')](handleEntityNotFound(_0x3f1dc8,null))['then'](saveUpdates(_0x1e5cfd['body'],null))[_0xccea('0x24')](respondWithResult(_0x3f1dc8,null))[_0xccea('0x40')](handleError(_0x3f1dc8,null));};exports[_0xccea('0x25')]=function(_0x18cd37,_0x18a4f9){return db[_0xccea('0x29')]['find']({'where':{'id':_0x18cd37['params']['id']}})[_0xccea('0x24')](handleEntityNotFound(_0x18a4f9,null))[_0xccea('0x24')](removeEntity(_0x18a4f9,null))[_0xccea('0x40')](handleError(_0x18a4f9,null));};exports[_0xccea('0x48')]=function(_0x3ccea0,_0x548040,_0x35d705){var _0x4b19d0={};var _0x56fdf3={};var _0x4dd2fe;var _0x2e26c5;return db['SalesforceAccount']['findOne']({'where':{'id':_0x3ccea0['params']['id']}})[_0xccea('0x24')](handleEntityNotFound(_0x548040,null))[_0xccea('0x24')](function(_0x32b1d9){if(_0x32b1d9){_0x4dd2fe=_0x32b1d9;_0x56fdf3['model']=_['keys'](db[_0xccea('0x49')][_0xccea('0x2a')]);_0x56fdf3[_0xccea('0x31')]=_[_0xccea('0x30')](_0x3ccea0[_0xccea('0x31')]);_0x56fdf3['filters']=_['intersection'](_0x56fdf3[_0xccea('0x2e')],_0x56fdf3['query']);_0x4b19d0[_0xccea('0x34')]=_[_0xccea('0x33')](_0x56fdf3[_0xccea('0x2e')],qs[_0xccea('0x35')](_0x3ccea0['query'][_0xccea('0x35')]));_0x4b19d0[_0xccea('0x34')]=_0x4b19d0['attributes'][_0xccea('0x36')]?_0x4b19d0[_0xccea('0x34')]:_0x56fdf3['model'];_0x4b19d0['order']=qs[_0xccea('0x39')](_0x3ccea0[_0xccea('0x31')]['sort']);_0x4b19d0[_0xccea('0x3a')]=qs[_0xccea('0x32')](_[_0xccea('0x3b')](_0x3ccea0[_0xccea('0x31')],_0x56fdf3[_0xccea('0x32')]));if(_0x3ccea0[_0xccea('0x31')][_0xccea('0x4a')]){_0x4b19d0['where']=_[_0xccea('0x3c')](_0x4b19d0['where'],{'$or':_[_0xccea('0x2f')](_0x4b19d0['attributes'],function(_0x3e907d){var _0x26dc5f={};_0x26dc5f[_0x3e907d]={'$like':'%'+_0x3ccea0[_0xccea('0x31')][_0xccea('0x4a')]+'%'};return _0x26dc5f;})});}_0x4b19d0=_[_0xccea('0x3c')]({},_0x4b19d0,_0x3ccea0['options']);return _0x4dd2fe[_0xccea('0x48')](_0x4b19d0);}})[_0xccea('0x24')](function(_0x489d15){if(_0x489d15){_0x2e26c5=_0x489d15[_0xccea('0x36')];if(!_0x3ccea0['query'][_0xccea('0x37')](_0xccea('0x4b'))){_0x4b19d0[_0xccea('0x1b')]=qs['limit'](_0x3ccea0[_0xccea('0x31')][_0xccea('0x1b')]);_0x4b19d0[_0xccea('0x1e')]=qs[_0xccea('0x1e')](_0x3ccea0[_0xccea('0x31')][_0xccea('0x1e')]);}return _0x4dd2fe[_0xccea('0x48')](_0x4b19d0);}})[_0xccea('0x24')](function(_0x14abed){if(_0x14abed){return _0x14abed?{'count':_0x2e26c5,'rows':_0x14abed}:null;}})['then'](respondWithResult(_0x548040,null))[_0xccea('0x40')](handleError(_0x548040,null));};exports[_0xccea('0x4c')]=function(_0x9b5fa2,_0x40d9b6,_0x11368c){if(_0x9b5fa2['body']['id']){delete _0x9b5fa2[_0xccea('0x46')]['id'];}return db['SalesforceAccount'][_0xccea('0x4d')]({'where':{'id':_0x9b5fa2[_0xccea('0x47')]['id']}})[_0xccea('0x24')](handleEntityNotFound(_0x40d9b6,null))[_0xccea('0x24')](function(_0x4f7071){if(_0x4f7071){_0x9b5fa2['body'][_0xccea('0x4e')]=_0x4f7071['id'];_0x9b5fa2['body'][_0xccea('0x4f')]=integrations['getSubjects'](_0x9b5fa2[_0xccea('0x46')][_0xccea('0x50')],_0x9b5fa2[_0xccea('0x46')][_0xccea('0x2c')]);_0x9b5fa2[_0xccea('0x46')]['Descriptions']=integrations[_0xccea('0x51')](_0x9b5fa2[_0xccea('0x46')]['channel'],_0x9b5fa2[_0xccea('0x46')][_0xccea('0x2c')]);return db['SalesforceConfiguration'][_0xccea('0x45')](_0x9b5fa2['body'],{'include':[{'model':db[_0xccea('0x52')],'as':_0xccea('0x4f')},{'model':db['SalesforceField'],'as':_0xccea('0x53')}]});}return null;})[_0xccea('0x24')](respondWithResult(_0x40d9b6,null))['catch'](handleError(_0x40d9b6,null));};exports['getFields']=function(_0x4cbf83,_0x2045f8,_0x3a67b1){var _0x554e54;var _0x12322d='';var _0x4d7c02=_0xccea('0x54');return db[_0xccea('0x29')][_0xccea('0x4d')]({'where':{'id':_0x4cbf83[_0xccea('0x47')]['id']},'attributes':['id',_0xccea('0x55'),_0xccea('0x56'),_0xccea('0x57'),'username',_0xccea('0x58'),_0xccea('0x59')]})[_0xccea('0x24')](handleEntityNotFound(_0x2045f8,null))[_0xccea('0x24')](function(_0x419c97){if(_0x419c97){_0x12322d=_0x419c97[_0xccea('0x55')];var _0x22683d=_0x12322d['slice'](-0x1);if(_0x22683d==='/'){_0x12322d=_0x12322d[_0xccea('0x5a')](0x0,_0x12322d[_0xccea('0x5b')](_0x22683d));}_0x554e54=new jsforce[(_0xccea('0x5c'))]({'oauth2':{'loginUrl':_0x12322d,'clientId':_0x419c97[_0xccea('0x56')],'clientSecret':_0x419c97[_0xccea('0x57')]}});return _0x554e54[_0xccea('0x5d')](_0x419c97[_0xccea('0x5e')],_0x419c97[_0xccea('0x58')][_0xccea('0x5f')](_0x419c97[_0xccea('0x59')]));}})[_0xccea('0x24')](function(_0x9281be){if(_0x9281be){if(!_[_0xccea('0x60')](_0x4cbf83[_0xccea('0x31')]['ticketType'])){_0x4d7c02=_0x4cbf83[_0xccea('0x31')]['ticketType'];}return _0x554e54[_0xccea('0x61')](_0x4d7c02)[_0xccea('0x62')]();}})[_0xccea('0x24')](function(_0xc41d90){var _0x26d3fc=[_0xccea('0x63'),_0xccea('0x64'),_0xccea('0x65'),_0xccea('0x66'),_0xccea('0x67'),'Description'];var _0x8126c0=['string',_0xccea('0x68'),_0xccea('0x69'),_0xccea('0x6a'),_0xccea('0x6b'),_0xccea('0x6c'),_0xccea('0x6d')];if(_0xc41d90){_['remove'](_0xc41d90[_0xccea('0x35')],function(_0x17690c){return _0x26d3fc[_0xccea('0x6e')](_0x17690c[_0xccea('0x27')])||!_0x8126c0[_0xccea('0x6e')](_0x17690c['type']);});return{'count':_0xc41d90[_0xccea('0x35')][_0xccea('0x36')],'rows':_['map'](_0xc41d90['fields'],function(_0x22abcb){return{'id':_0x22abcb[_0xccea('0x27')],'name':_0x22abcb['label'],'custom':_0x22abcb[_0xccea('0x6f')],'options':_0x22abcb['picklistValues'][_0xccea('0x36')]>0x0?_[_0xccea('0x2f')](_0x22abcb[_0xccea('0x70')],function(_0x292b35){return{'name':_0x292b35['label'],'value':_0x292b35[_0xccea('0x71')]};}):_0x22abcb[_0xccea('0x2c')]=='boolean'?[{'name':_0xccea('0x72'),'value':_0xccea('0x73')},{'name':'False','value':_0xccea('0x74')}]:[]};})};}})[_0xccea('0x24')](respondWithResult(_0x2045f8,null))[_0xccea('0x40')](function(_0x36623e){var _0x5879a0=_0x4cbf83['query'][_0xccea('0x75')]?0x1f4:_0x36623e[_0xccea('0x76')]||0x1f4;logger[_0xccea('0x26')](_0xccea('0x77'),_0xccea('0x78'),_0x5879a0,JSON['stringify'](_0x36623e));delete _0x36623e['name'];if(_0x5879a0===0x191){_0x5879a0=0x190;}_0x2045f8[_0xccea('0x19')](_0x5879a0)[_0xccea('0x79')](_0x4cbf83[_0xccea('0x31')][_0xccea('0x75')]?{'message':_0xccea('0x7a'),'statusCode':_0x36623e[_0xccea('0x76')]}:_0x36623e);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index fec6aa8..41b67d9 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 _0xed26=['int_salesforce_accounts','lodash','api','moment','bluebird','request-promise','path','./intSalesforceAccount.attributes','exports','define','SalesforceAccount'];(function(_0xae7c2f,_0xf31e04){var _0x5d7001=function(_0x4eeadb){while(--_0x4eeadb){_0xae7c2f['push'](_0xae7c2f['shift']());}};_0x5d7001(++_0xf31e04);}(_0xed26,0x64));var _0x6ed2=function(_0x46a372,_0x19c179){_0x46a372=_0x46a372-0x0;var _0x5a7f7d=_0xed26[_0x46a372];return _0x5a7f7d;};'use strict';var _=require(_0x6ed2('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x6ed2('0x1'));var moment=require(_0x6ed2('0x2'));var BPromise=require(_0x6ed2('0x3'));var rp=require(_0x6ed2('0x4'));var fs=require('fs');var path=require(_0x6ed2('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x6ed2('0x6'));var integrations=require('../../components/integrations/configuration');module[_0x6ed2('0x7')]=function(_0x55189f,_0x5202d3){return _0x55189f[_0x6ed2('0x8')](_0x6ed2('0x9'),attributes,{'tableName':_0x6ed2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd0b1=['./intSalesforceAccount.attributes','../../components/integrations/configuration','define','int_salesforce_accounts','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x926d0d,_0x5ab0e5){var _0x67b215=function(_0x25eec8){while(--_0x25eec8){_0x926d0d['push'](_0x926d0d['shift']());}};_0x67b215(++_0x5ab0e5);}(_0xd0b1,0x64));var _0x1d0b=function(_0x29fa2f,_0x4d265f){_0x29fa2f=_0x29fa2f-0x0;var _0xb4d67e=_0xd0b1[_0x29fa2f];return _0xb4d67e;};'use strict';var _=require(_0x1d0b('0x0'));var util=require(_0x1d0b('0x1'));var logger=require(_0x1d0b('0x2'))('api');var moment=require(_0x1d0b('0x3'));var BPromise=require(_0x1d0b('0x4'));var rp=require(_0x1d0b('0x5'));var fs=require('fs');var path=require(_0x1d0b('0x6'));var rimraf=require(_0x1d0b('0x7'));var config=require('../../config/environment');var attributes=require(_0x1d0b('0x8'));var integrations=require(_0x1d0b('0x9'));module['exports']=function(_0x2efd61,_0x44db5f){return _0x2efd61[_0x1d0b('0xa')]('SalesforceAccount',attributes,{'tableName':_0x1d0b('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 183203d..6cd9037 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 _0xcd19=['model','ShowSalesforceAccount','find','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','SalesforceAccount,\x20%s,\x20%s','message','result','catch','GetSalesforceAccount','SalesforceAccount','findAll','options','where','attributes','limit','include','map'];(function(_0x53b53e,_0x498437){var _0xbb6179=function(_0x3975eb){while(--_0x3975eb){_0x53b53e['push'](_0x53b53e['shift']());}};_0xbb6179(++_0x498437);}(_0xcd19,0x98));var _0x9cd1=function(_0x5538d5,_0x190032){_0x5538d5=_0x5538d5-0x0;var _0x323b1a=_0xcd19[_0x5538d5];return _0x323b1a;};'use strict';var _=require(_0x9cd1('0x0'));var util=require(_0x9cd1('0x1'));var moment=require(_0x9cd1('0x2'));var BPromise=require(_0x9cd1('0x3'));var rs=require(_0x9cd1('0x4'));var fs=require('fs');var Redis=require(_0x9cd1('0x5'));var db=require(_0x9cd1('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x9cd1('0x7'))(_0x9cd1('0x8'));var config=require(_0x9cd1('0x9'));var jayson=require(_0x9cd1('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4cb594,_0x405c85,_0x408ad4){return new BPromise(function(_0x4b5acd,_0x47544c){return client[_0x9cd1('0xb')](_0x4cb594,_0x408ad4)[_0x9cd1('0xc')](function(_0x38790b){logger[_0x9cd1('0xd')]('SalesforceAccount,\x20%s,\x20%s',_0x405c85,_0x9cd1('0xe'));logger[_0x9cd1('0xf')](_0x9cd1('0x10'),_0x405c85,_0x9cd1('0xe'),JSON[_0x9cd1('0x11')](_0x38790b));if(_0x38790b[_0x9cd1('0x12')]){if(_0x38790b[_0x9cd1('0x12')][_0x9cd1('0x13')]===0x1f4){logger['error'](_0x9cd1('0x14'),_0x405c85,_0x38790b['error'][_0x9cd1('0x15')]);return _0x47544c(_0x38790b[_0x9cd1('0x12')][_0x9cd1('0x15')]);}logger[_0x9cd1('0x12')](_0x9cd1('0x14'),_0x405c85,_0x38790b[_0x9cd1('0x12')][_0x9cd1('0x15')]);return _0x4b5acd(_0x38790b[_0x9cd1('0x12')][_0x9cd1('0x15')]);}else{logger[_0x9cd1('0xd')]('SalesforceAccount,\x20%s,\x20%s',_0x405c85,'request\x20sent');_0x4b5acd(_0x38790b[_0x9cd1('0x16')][_0x9cd1('0x15')]);}})[_0x9cd1('0x17')](function(_0x27e8a0){logger['error']('SalesforceAccount,\x20%s,\x20%s',_0x405c85,_0x27e8a0);_0x47544c(_0x27e8a0);});});}exports[_0x9cd1('0x18')]=function(_0x2821b1){var _0x1ebd4d=this;return new Promise(function(_0x5ea152,_0x22b359){return db[_0x9cd1('0x19')][_0x9cd1('0x1a')]({'raw':_0x2821b1[_0x9cd1('0x1b')]?_0x2821b1['options']['raw']===undefined?!![]:![]:!![],'where':_0x2821b1[_0x9cd1('0x1b')]?_0x2821b1[_0x9cd1('0x1b')][_0x9cd1('0x1c')]||null:null,'attributes':_0x2821b1['options']?_0x2821b1['options'][_0x9cd1('0x1d')]||null:null,'limit':_0x2821b1['options']?_0x2821b1['options'][_0x9cd1('0x1e')]||null:null,'include':_0x2821b1['options']?_0x2821b1[_0x9cd1('0x1b')][_0x9cd1('0x1f')]?_['map'](_0x2821b1[_0x9cd1('0x1b')][_0x9cd1('0x1f')],function(_0x1aafbb){return{'model':db[_0x1aafbb['model']],'as':_0x1aafbb['as'],'attributes':_0x1aafbb[_0x9cd1('0x1d')],'include':_0x1aafbb['include']?_['map'](_0x1aafbb['include'],function(_0x3972d1){return{'model':db[_0x3972d1['model']],'as':_0x3972d1['as'],'attributes':_0x3972d1['attributes'],'include':_0x3972d1[_0x9cd1('0x1f')]?_[_0x9cd1('0x20')](_0x3972d1[_0x9cd1('0x1f')],function(_0x3162ad){return{'model':db[_0x3162ad[_0x9cd1('0x21')]],'as':_0x3162ad['as'],'attributes':_0x3162ad[_0x9cd1('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x9cd1('0xc')](function(_0x40337d){logger[_0x9cd1('0xd')](_0x9cd1('0x18'),_0x2821b1);logger['debug'](_0x9cd1('0x18'),_0x2821b1,JSON['stringify'](_0x40337d));_0x5ea152(_0x40337d);})['catch'](function(_0x195b56){logger[_0x9cd1('0x12')](_0x9cd1('0x18'),_0x195b56['message'],_0x2821b1);_0x22b359(_0x1ebd4d['error'](0x1f4,_0x195b56[_0x9cd1('0x15')]));});});};exports[_0x9cd1('0x22')]=function(_0x237e32){var _0x5dc55b=this;return new Promise(function(_0x451531,_0x114c00){return db[_0x9cd1('0x19')][_0x9cd1('0x23')]({'raw':_0x237e32[_0x9cd1('0x1b')]?_0x237e32[_0x9cd1('0x1b')][_0x9cd1('0x24')]===undefined?!![]:![]:!![],'where':_0x237e32[_0x9cd1('0x1b')]?_0x237e32[_0x9cd1('0x1b')][_0x9cd1('0x1c')]||null:null,'attributes':_0x237e32[_0x9cd1('0x1b')]?_0x237e32[_0x9cd1('0x1b')][_0x9cd1('0x1d')]||null:null,'include':_0x237e32[_0x9cd1('0x1b')]?_0x237e32[_0x9cd1('0x1b')][_0x9cd1('0x1f')]?_[_0x9cd1('0x20')](_0x237e32[_0x9cd1('0x1b')][_0x9cd1('0x1f')],function(_0x40a857){return{'model':db[_0x40a857['model']],'as':_0x40a857['as'],'attributes':_0x40a857['attributes'],'include':_0x40a857['include']?_[_0x9cd1('0x20')](_0x40a857['include'],function(_0x2972af){return{'model':db[_0x2972af[_0x9cd1('0x21')]],'as':_0x2972af['as'],'attributes':_0x2972af[_0x9cd1('0x1d')],'include':_0x2972af[_0x9cd1('0x1f')]?_[_0x9cd1('0x20')](_0x2972af['include'],function(_0x40ed21){return{'model':db[_0x40ed21[_0x9cd1('0x21')]],'as':_0x40ed21['as'],'attributes':_0x40ed21[_0x9cd1('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x9cd1('0xc')](function(_0x5423f1){logger[_0x9cd1('0xd')]('ShowSalesforceAccount',_0x237e32);logger[_0x9cd1('0xf')]('ShowSalesforceAccount',_0x237e32,JSON[_0x9cd1('0x11')](_0x5423f1));_0x451531(_0x5423f1);})[_0x9cd1('0x17')](function(_0x57c48a){logger[_0x9cd1('0x12')](_0x9cd1('0x22'),_0x57c48a[_0x9cd1('0x15')],_0x237e32);_0x114c00(_0x5dc55b[_0x9cd1('0x12')](0x1f4,_0x57c48a[_0x9cd1('0x15')]));});});}; \ No newline at end of file +var _0x6403=['SalesforceAccount','find','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','request\x20sent','debug','stringify','error','code','SalesforceAccount,\x20%s,\x20%s','message','result','catch','GetSalesforceAccount','findAll','options','raw','where','attributes','include','map','model','ShowSalesforceAccount'];(function(_0x4e9628,_0x250573){var _0x27bc8c=function(_0xb3b7ae){while(--_0xb3b7ae){_0x4e9628['push'](_0x4e9628['shift']());}};_0x27bc8c(++_0x250573);}(_0x6403,0xf0));var _0x3640=function(_0x26dd56,_0x2d5949){_0x26dd56=_0x26dd56-0x0;var _0x7ee697=_0x6403[_0x26dd56];return _0x7ee697;};'use strict';var _=require('lodash');var util=require(_0x3640('0x0'));var moment=require(_0x3640('0x1'));var BPromise=require(_0x3640('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3640('0x3'));var db=require(_0x3640('0x4'))['db'];var utils=require(_0x3640('0x5'));var logger=require(_0x3640('0x6'))(_0x3640('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3640('0x8')][_0x3640('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x122f59,_0x34e256,_0x5db612){return new BPromise(function(_0x5a9aa2,_0x234c8a){return client[_0x3640('0xa')](_0x122f59,_0x5db612)[_0x3640('0xb')](function(_0x531fd4){logger[_0x3640('0xc')]('SalesforceAccount,\x20%s,\x20%s',_0x34e256,_0x3640('0xd'));logger[_0x3640('0xe')]('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0x34e256,_0x3640('0xd'),JSON[_0x3640('0xf')](_0x531fd4));if(_0x531fd4[_0x3640('0x10')]){if(_0x531fd4[_0x3640('0x10')][_0x3640('0x11')]===0x1f4){logger[_0x3640('0x10')](_0x3640('0x12'),_0x34e256,_0x531fd4[_0x3640('0x10')][_0x3640('0x13')]);return _0x234c8a(_0x531fd4[_0x3640('0x10')]['message']);}logger[_0x3640('0x10')](_0x3640('0x12'),_0x34e256,_0x531fd4[_0x3640('0x10')]['message']);return _0x5a9aa2(_0x531fd4['error'][_0x3640('0x13')]);}else{logger['info'](_0x3640('0x12'),_0x34e256,_0x3640('0xd'));_0x5a9aa2(_0x531fd4[_0x3640('0x14')][_0x3640('0x13')]);}})[_0x3640('0x15')](function(_0x26a48e){logger['error'](_0x3640('0x12'),_0x34e256,_0x26a48e);_0x234c8a(_0x26a48e);});});}exports[_0x3640('0x16')]=function(_0x3dc6a3){var _0x48d46b=this;return new Promise(function(_0x4b2669,_0x3c5a41){return db['SalesforceAccount'][_0x3640('0x17')]({'raw':_0x3dc6a3[_0x3640('0x18')]?_0x3dc6a3['options'][_0x3640('0x19')]===undefined?!![]:![]:!![],'where':_0x3dc6a3[_0x3640('0x18')]?_0x3dc6a3['options'][_0x3640('0x1a')]||null:null,'attributes':_0x3dc6a3[_0x3640('0x18')]?_0x3dc6a3[_0x3640('0x18')][_0x3640('0x1b')]||null:null,'limit':_0x3dc6a3[_0x3640('0x18')]?_0x3dc6a3[_0x3640('0x18')]['limit']||null:null,'include':_0x3dc6a3[_0x3640('0x18')]?_0x3dc6a3[_0x3640('0x18')][_0x3640('0x1c')]?_[_0x3640('0x1d')](_0x3dc6a3['options'][_0x3640('0x1c')],function(_0x29b85c){return{'model':db[_0x29b85c[_0x3640('0x1e')]],'as':_0x29b85c['as'],'attributes':_0x29b85c[_0x3640('0x1b')],'include':_0x29b85c['include']?_[_0x3640('0x1d')](_0x29b85c[_0x3640('0x1c')],function(_0x1d8804){return{'model':db[_0x1d8804['model']],'as':_0x1d8804['as'],'attributes':_0x1d8804[_0x3640('0x1b')],'include':_0x1d8804[_0x3640('0x1c')]?_[_0x3640('0x1d')](_0x1d8804[_0x3640('0x1c')],function(_0xd5b975){return{'model':db[_0xd5b975[_0x3640('0x1e')]],'as':_0xd5b975['as'],'attributes':_0xd5b975[_0x3640('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x3640('0xb')](function(_0x6f7fcf){logger['info'](_0x3640('0x16'),_0x3dc6a3);logger['debug'](_0x3640('0x16'),_0x3dc6a3,JSON[_0x3640('0xf')](_0x6f7fcf));_0x4b2669(_0x6f7fcf);})['catch'](function(_0x8f9049){logger[_0x3640('0x10')](_0x3640('0x16'),_0x8f9049[_0x3640('0x13')],_0x3dc6a3);_0x3c5a41(_0x48d46b['error'](0x1f4,_0x8f9049[_0x3640('0x13')]));});});};exports[_0x3640('0x1f')]=function(_0x40af93){var _0x478764=this;return new Promise(function(_0x319fce,_0x18afac){return db[_0x3640('0x20')][_0x3640('0x21')]({'raw':_0x40af93[_0x3640('0x18')]?_0x40af93[_0x3640('0x18')][_0x3640('0x19')]===undefined?!![]:![]:!![],'where':_0x40af93[_0x3640('0x18')]?_0x40af93[_0x3640('0x18')][_0x3640('0x1a')]||null:null,'attributes':_0x40af93[_0x3640('0x18')]?_0x40af93[_0x3640('0x18')][_0x3640('0x1b')]||null:null,'include':_0x40af93[_0x3640('0x18')]?_0x40af93['options'][_0x3640('0x1c')]?_[_0x3640('0x1d')](_0x40af93['options']['include'],function(_0xc5a3e8){return{'model':db[_0xc5a3e8[_0x3640('0x1e')]],'as':_0xc5a3e8['as'],'attributes':_0xc5a3e8[_0x3640('0x1b')],'include':_0xc5a3e8[_0x3640('0x1c')]?_[_0x3640('0x1d')](_0xc5a3e8[_0x3640('0x1c')],function(_0x558dd0){return{'model':db[_0x558dd0['model']],'as':_0x558dd0['as'],'attributes':_0x558dd0[_0x3640('0x1b')],'include':_0x558dd0[_0x3640('0x1c')]?_[_0x3640('0x1d')](_0x558dd0[_0x3640('0x1c')],function(_0xf3d2af){return{'model':db[_0xf3d2af[_0x3640('0x1e')]],'as':_0xf3d2af['as'],'attributes':_0xf3d2af[_0x3640('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5a501d){logger[_0x3640('0xc')]('ShowSalesforceAccount',_0x40af93);logger[_0x3640('0xe')](_0x3640('0x1f'),_0x40af93,JSON[_0x3640('0xf')](_0x5a501d));_0x319fce(_0x5a501d);})[_0x3640('0x15')](function(_0x11126a){logger[_0x3640('0x10')](_0x3640('0x1f'),_0x11126a[_0x3640('0x13')],_0x40af93);_0x18afac(_0x478764['error'](0x1f4,_0x11126a[_0x3640('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 81fce02..c3156b0 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 _0x2ef3=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intSalesforceConfiguration.controller','get','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','put','update','exports','multer','util','path'];(function(_0x1e96be,_0x488ce5){var _0x23f755=function(_0x12bffd){while(--_0x12bffd){_0x1e96be['push'](_0x1e96be['shift']());}};_0x23f755(++_0x488ce5);}(_0x2ef3,0xba));var _0x32ef=function(_0x513796,_0x4bb1b3){_0x513796=_0x513796-0x0;var _0x1b47fe=_0x2ef3[_0x513796];return _0x1b47fe;};'use strict';var multer=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var path=require(_0x32ef('0x2'));var timeout=require(_0x32ef('0x3'));var express=require(_0x32ef('0x4'));var router=express[_0x32ef('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x32ef('0x6'));var interaction=require(_0x32ef('0x7'));var config=require('../../config/environment');var controller=require(_0x32ef('0x8'));router[_0x32ef('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x32ef('0x9')](_0x32ef('0xa'),auth[_0x32ef('0xb')](),controller[_0x32ef('0xc')]);router[_0x32ef('0x9')](_0x32ef('0xd'),auth[_0x32ef('0xb')](),controller[_0x32ef('0xe')]);router[_0x32ef('0x9')](_0x32ef('0xf'),auth['isAuthenticated'](),controller['getSubjects']);router[_0x32ef('0x9')](_0x32ef('0x10'),auth[_0x32ef('0xb')](),controller[_0x32ef('0x11')]);router['post']('/',auth[_0x32ef('0xb')](),controller['create']);router[_0x32ef('0x12')]('/:id',auth[_0x32ef('0xb')](),controller[_0x32ef('0x13')]);router['delete']('/:id',auth[_0x32ef('0xb')](),controller['destroy']);module[_0x32ef('0x14')]=router; \ No newline at end of file +var _0x5f66=['express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/fields','/:id/subjects','getSubjects','put','update','delete','destroy','exports','util','connect-timeout'];(function(_0x517579,_0x37a202){var _0x534a99=function(_0x1ad243){while(--_0x1ad243){_0x517579['push'](_0x517579['shift']());}};_0x534a99(++_0x37a202);}(_0x5f66,0x1a0));var _0x65f6=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0x5f66[_0x580576];return _0x3f55a0;};'use strict';var multer=require('multer');var util=require(_0x65f6('0x0'));var path=require('path');var timeout=require(_0x65f6('0x1'));var express=require(_0x65f6('0x2'));var router=express[_0x65f6('0x3')]();var fs_extra=require(_0x65f6('0x4'));var auth=require(_0x65f6('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x65f6('0x6'));var controller=require('./intSalesforceConfiguration.controller');router[_0x65f6('0x7')]('/',auth[_0x65f6('0x8')](),controller['index']);router['get'](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xa')]);router[_0x65f6('0x7')](_0x65f6('0xb'),auth[_0x65f6('0x8')](),controller['getFields']);router['get'](_0x65f6('0xc'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xd')]);router[_0x65f6('0x7')]('/:id/descriptions',auth[_0x65f6('0x8')](),controller['getDescriptions']);router['post']('/',auth[_0x65f6('0x8')](),controller['create']);router[_0x65f6('0xe')]('/:id',auth[_0x65f6('0x8')](),controller[_0x65f6('0xf')]);router[_0x65f6('0x10')](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0x11')]);module[_0x65f6('0x12')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index d6e7e9b..b008cd8 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 _0xf619=['Task','contact','lead','account_contact_lead','account','contact_lead','nothing','exports','STRING','ENUM'];(function(_0x9b5bb2,_0x5db315){var _0x2e1e92=function(_0x5621c9){while(--_0x5621c9){_0x9b5bb2['push'](_0x9b5bb2['shift']());}};_0x2e1e92(++_0x5db315);}(_0xf619,0x7f));var _0x9f61=function(_0x33e233,_0x31495f){_0x33e233=_0x33e233-0x0;var _0x689d90=_0xf619[_0x33e233];return _0x689d90;};'use strict';var Sequelize=require('sequelize');module[_0x9f61('0x0')]={'name':{'type':Sequelize[_0x9f61('0x1')]},'description':{'type':Sequelize[_0x9f61('0x1')]},'ticketType':{'type':Sequelize[_0x9f61('0x2')](_0x9f61('0x3'),'Case'),'defaultValue':'Task'},'moduleSearch':{'type':Sequelize['ENUM']('contact_lead',_0x9f61('0x4'),_0x9f61('0x5'),_0x9f61('0x6'),_0x9f61('0x7')),'defaultValue':_0x9f61('0x8')},'moduleCreate':{'type':Sequelize['ENUM'](_0x9f61('0x9'),'contact',_0x9f61('0x5'),_0x9f61('0x7')),'defaultValue':_0x9f61('0x5')},'leadId':{'type':Sequelize[_0x9f61('0x1')]},'additionalSearchAccount':{'type':Sequelize[_0x9f61('0x1')]},'additionalSearchContact':{'type':Sequelize['STRING']},'additionalSearchLead':{'type':Sequelize[_0x9f61('0x1')]}}; \ No newline at end of file +var _0xe698=['contact_lead','contact','lead','account_contact_lead','account','STRING','sequelize','exports','ENUM','Task','Case'];(function(_0x53b9a4,_0x2df66d){var _0x508b83=function(_0x2549b1){while(--_0x2549b1){_0x53b9a4['push'](_0x53b9a4['shift']());}};_0x508b83(++_0x2df66d);}(_0xe698,0x69));var _0x8e69=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xe698[_0x2641f9];return _0x585741;};'use strict';var Sequelize=require(_0x8e69('0x0'));module[_0x8e69('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0x8e69('0x2')](_0x8e69('0x3'),_0x8e69('0x4')),'defaultValue':_0x8e69('0x3')},'moduleSearch':{'type':Sequelize[_0x8e69('0x2')](_0x8e69('0x5'),_0x8e69('0x6'),_0x8e69('0x7'),_0x8e69('0x8'),_0x8e69('0x9')),'defaultValue':_0x8e69('0x5')},'moduleCreate':{'type':Sequelize['ENUM']('nothing',_0x8e69('0x6'),_0x8e69('0x7'),_0x8e69('0x9')),'defaultValue':_0x8e69('0x7')},'leadId':{'type':Sequelize[_0x8e69('0xa')]},'additionalSearchAccount':{'type':Sequelize[_0x8e69('0xa')]},'additionalSearchContact':{'type':Sequelize['STRING']},'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 2bca9c9..3682ad4 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 _0xcd16=['lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','status','end','offset','limit','undefined','count','Content-Range','apply','reject','update','then','destroy','sendStatus','stack','name','send','index','map','SalesforceConfiguration','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','sort','pick','filter','where','VIRTUAL','merge','options','include','findAll','catch','show','keys','includeAll','create','body','find','params','findOne','order','hasOwnProperty','getFields','getSubjects','SalesforceField','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra'];(function(_0x3a4f18,_0x1af741){var _0x4c20fc=function(_0x27115f){while(--_0x27115f){_0x3a4f18['push'](_0x3a4f18['shift']());}};_0x4c20fc(++_0x1af741);}(_0xcd16,0x13e));var _0x6cd1=function(_0x195029,_0xd5564f){_0x195029=_0x195029-0x0;var _0x154cbe=_0xcd16[_0x195029];return _0x154cbe;};'use strict';var emlformat=require(_0x6cd1('0x0'));var rimraf=require(_0x6cd1('0x1'));var zipdir=require(_0x6cd1('0x2'));var jsonpatch=require(_0x6cd1('0x3'));var rp=require(_0x6cd1('0x4'));var moment=require(_0x6cd1('0x5'));var BPromise=require(_0x6cd1('0x6'));var Mustache=require(_0x6cd1('0x7'));var util=require(_0x6cd1('0x8'));var path=require(_0x6cd1('0x9'));var sox=require(_0x6cd1('0xa'));var csv=require(_0x6cd1('0xb'));var ejs=require(_0x6cd1('0xc'));var fs=require('fs');var fs_extra=require(_0x6cd1('0xd'));var _=require(_0x6cd1('0xe'));var squel=require(_0x6cd1('0xf'));var crypto=require(_0x6cd1('0x10'));var jsforce=require(_0x6cd1('0x11'));var deskjs=require(_0x6cd1('0x12'));var toCsv=require('to-csv');var querystring=require(_0x6cd1('0x13'));var Papa=require(_0x6cd1('0x14'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x6cd1('0x15'));var as=require(_0x6cd1('0x16'));var hardwareService=require(_0x6cd1('0x17'));var logger=require(_0x6cd1('0x18'))(_0x6cd1('0x19'));var utils=require('../../config/utils');var config=require(_0x6cd1('0x1a'));var licenseUtil=require(_0x6cd1('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1651c3,_0x1b328f){_0x1b328f=_0x1b328f||0xcc;return function(_0x429562){if(_0x429562){return _0x1651c3['sendStatus'](_0x1b328f);}return _0x1651c3[_0x6cd1('0x1c')](_0x1b328f)[_0x6cd1('0x1d')]();};}function respondWithResult(_0x221831,_0x34b401){_0x34b401=_0x34b401||0xc8;return function(_0x459dfc){if(_0x459dfc){return _0x221831[_0x6cd1('0x1c')](_0x34b401)['json'](_0x459dfc);}};}function respondWithFilteredResult(_0x4c50dd,_0x59b4bb){return function(_0x228153){if(_0x228153){var _0x414262=typeof _0x59b4bb[_0x6cd1('0x1e')]==='undefined'&&typeof _0x59b4bb[_0x6cd1('0x1f')]===_0x6cd1('0x20');var _0x54e264=_0x228153[_0x6cd1('0x21')];var _0x25c06a=_0x414262?0x0:_0x59b4bb['offset'];var _0x10ac0d=_0x414262?_0x228153[_0x6cd1('0x21')]:_0x59b4bb[_0x6cd1('0x1e')]+_0x59b4bb[_0x6cd1('0x1f')];var _0x46867f;if(_0x10ac0d>=_0x54e264){_0x10ac0d=_0x54e264;_0x46867f=0xc8;}else{_0x46867f=0xce;}_0x4c50dd[_0x6cd1('0x1c')](_0x46867f);return _0x4c50dd['set'](_0x6cd1('0x22'),_0x25c06a+'-'+_0x10ac0d+'/'+_0x54e264)['json'](_0x228153);}return null;};}function patchUpdates(_0x2017df){return function(_0x36aa39){try{jsonpatch[_0x6cd1('0x23')](_0x36aa39,_0x2017df,!![]);}catch(_0x278c20){return BPromise[_0x6cd1('0x24')](_0x278c20);}return _0x36aa39['save']();};}function saveUpdates(_0x41ce38,_0x3c6416){return function(_0x4abb20){if(_0x4abb20){return _0x4abb20[_0x6cd1('0x25')](_0x41ce38)[_0x6cd1('0x26')](function(_0xc59c44){return _0xc59c44;});}return null;};}function removeEntity(_0x1c34e2,_0x2c4825){return function(_0x3b11d1){if(_0x3b11d1){return _0x3b11d1[_0x6cd1('0x27')]()[_0x6cd1('0x26')](function(){_0x1c34e2[_0x6cd1('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x368723,_0x432c38){return function(_0x2ea9f2){if(!_0x2ea9f2){_0x368723[_0x6cd1('0x28')](0x194);}return _0x2ea9f2;};}function handleError(_0x30b523,_0x42919a){_0x42919a=_0x42919a||0x1f4;return function(_0x4e431a){logger['error'](_0x4e431a[_0x6cd1('0x29')]);if(_0x4e431a[_0x6cd1('0x2a')]){delete _0x4e431a[_0x6cd1('0x2a')];}_0x30b523[_0x6cd1('0x1c')](_0x42919a)[_0x6cd1('0x2b')](_0x4e431a);};}exports[_0x6cd1('0x2c')]=function(_0x46b06c,_0x24e5a5){var _0x5e2956={},_0x3129ad={},_0x516bb8={'count':0x0,'rows':[]};var _0xb790f=_[_0x6cd1('0x2d')](db[_0x6cd1('0x2e')][_0x6cd1('0x2f')],function(_0x4dae60){return{'name':_0x4dae60[_0x6cd1('0x30')],'type':_0x4dae60[_0x6cd1('0x31')][_0x6cd1('0x32')]};});_0x3129ad[_0x6cd1('0x33')]=_[_0x6cd1('0x2d')](_0xb790f,_0x6cd1('0x2a'));_0x3129ad[_0x6cd1('0x34')]=_['keys'](_0x46b06c[_0x6cd1('0x34')]);_0x3129ad[_0x6cd1('0x35')]=_[_0x6cd1('0x36')](_0x3129ad['model'],_0x3129ad[_0x6cd1('0x34')]);_0x5e2956[_0x6cd1('0x37')]=_[_0x6cd1('0x36')](_0x3129ad[_0x6cd1('0x33')],qs[_0x6cd1('0x38')](_0x46b06c[_0x6cd1('0x34')][_0x6cd1('0x38')]));_0x5e2956['attributes']=_0x5e2956[_0x6cd1('0x37')][_0x6cd1('0x39')]?_0x5e2956[_0x6cd1('0x37')]:_0x3129ad[_0x6cd1('0x33')];if(!_0x46b06c[_0x6cd1('0x34')]['hasOwnProperty'](_0x6cd1('0x3a'))){_0x5e2956[_0x6cd1('0x1f')]=qs[_0x6cd1('0x1f')](_0x46b06c[_0x6cd1('0x34')][_0x6cd1('0x1f')]);_0x5e2956['offset']=qs[_0x6cd1('0x1e')](_0x46b06c[_0x6cd1('0x34')][_0x6cd1('0x1e')]);}_0x5e2956['order']=qs[_0x6cd1('0x3b')](_0x46b06c['query']['sort']);_0x5e2956['where']=qs['filters'](_[_0x6cd1('0x3c')](_0x46b06c['query'],_0x3129ad[_0x6cd1('0x35')]),_0xb790f);if(_0x46b06c[_0x6cd1('0x34')][_0x6cd1('0x3d')]){_0x5e2956['where']=_['merge'](_0x5e2956[_0x6cd1('0x3e')],{'$or':_[_0x6cd1('0x2d')](_0xb790f,function(_0x864911){if(_0x864911[_0x6cd1('0x31')]!==_0x6cd1('0x3f')){var _0x492014={};_0x492014[_0x864911[_0x6cd1('0x2a')]]={'$like':'%'+_0x46b06c[_0x6cd1('0x34')][_0x6cd1('0x3d')]+'%'};return _0x492014;}})});}_0x5e2956=_[_0x6cd1('0x40')]({},_0x5e2956,_0x46b06c[_0x6cd1('0x41')]);var _0x2b2f6b={'where':_0x5e2956[_0x6cd1('0x3e')]};return db[_0x6cd1('0x2e')][_0x6cd1('0x21')](_0x2b2f6b)[_0x6cd1('0x26')](function(_0x5e91fb){_0x516bb8[_0x6cd1('0x21')]=_0x5e91fb;if(_0x46b06c[_0x6cd1('0x34')]['includeAll']){_0x5e2956[_0x6cd1('0x42')]=[{'all':!![]}];}return db[_0x6cd1('0x2e')][_0x6cd1('0x43')](_0x5e2956);})['then'](function(_0x1bfdd0){_0x516bb8['rows']=_0x1bfdd0;return _0x516bb8;})[_0x6cd1('0x26')](respondWithFilteredResult(_0x24e5a5,_0x5e2956))[_0x6cd1('0x44')](handleError(_0x24e5a5,null));};exports[_0x6cd1('0x45')]=function(_0x509dd3,_0x45342b){var _0x4004fb={'raw':![],'where':{'id':_0x509dd3['params']['id']}},_0x1e9e78={};_0x1e9e78[_0x6cd1('0x33')]=_[_0x6cd1('0x46')](db[_0x6cd1('0x2e')]['rawAttributes']);_0x1e9e78['query']=_[_0x6cd1('0x46')](_0x509dd3[_0x6cd1('0x34')]);_0x1e9e78[_0x6cd1('0x35')]=_[_0x6cd1('0x36')](_0x1e9e78['model'],_0x1e9e78[_0x6cd1('0x34')]);_0x4004fb[_0x6cd1('0x37')]=_['intersection'](_0x1e9e78[_0x6cd1('0x33')],qs[_0x6cd1('0x38')](_0x509dd3[_0x6cd1('0x34')][_0x6cd1('0x38')]));_0x4004fb[_0x6cd1('0x37')]=_0x4004fb[_0x6cd1('0x37')][_0x6cd1('0x39')]?_0x4004fb[_0x6cd1('0x37')]:_0x1e9e78[_0x6cd1('0x33')];if(_0x509dd3['query'][_0x6cd1('0x47')]){_0x4004fb[_0x6cd1('0x42')]=[{'all':!![]}];}_0x4004fb=_[_0x6cd1('0x40')]({},_0x4004fb,_0x509dd3['options']);return db['SalesforceConfiguration']['find'](_0x4004fb)[_0x6cd1('0x26')](handleEntityNotFound(_0x45342b,null))['then'](respondWithResult(_0x45342b,null))[_0x6cd1('0x44')](handleError(_0x45342b,null));};exports[_0x6cd1('0x48')]=function(_0x5e53f7,_0x59067c){return db[_0x6cd1('0x2e')][_0x6cd1('0x48')](_0x5e53f7[_0x6cd1('0x49')],{})[_0x6cd1('0x26')](respondWithResult(_0x59067c,0xc9))['catch'](handleError(_0x59067c,null));};exports['update']=function(_0x2f57d6,_0x6a0a59){if(_0x2f57d6['body']['id']){delete _0x2f57d6['body']['id'];}return db['SalesforceConfiguration'][_0x6cd1('0x4a')]({'where':{'id':_0x2f57d6[_0x6cd1('0x4b')]['id']}})[_0x6cd1('0x26')](handleEntityNotFound(_0x6a0a59,null))[_0x6cd1('0x26')](saveUpdates(_0x2f57d6[_0x6cd1('0x49')],null))['then'](respondWithResult(_0x6a0a59,null))[_0x6cd1('0x44')](handleError(_0x6a0a59,null));};exports[_0x6cd1('0x27')]=function(_0x3081ad,_0x28267c){return db[_0x6cd1('0x2e')][_0x6cd1('0x4a')]({'where':{'id':_0x3081ad[_0x6cd1('0x4b')]['id']}})[_0x6cd1('0x26')](handleEntityNotFound(_0x28267c,null))['then'](removeEntity(_0x28267c,null))[_0x6cd1('0x44')](handleError(_0x28267c,null));};exports['getFields']=function(_0x46f905,_0xb10a4f,_0x45b2cb){var _0x520f75={};var _0x10ed04={};var _0x4dff6c;var _0x372cdb;return db['SalesforceConfiguration'][_0x6cd1('0x4c')]({'where':{'id':_0x46f905[_0x6cd1('0x4b')]['id']}})[_0x6cd1('0x26')](handleEntityNotFound(_0xb10a4f,null))[_0x6cd1('0x26')](function(_0xf930e){if(_0xf930e){_0x4dff6c=_0xf930e;_0x10ed04[_0x6cd1('0x33')]=_['keys'](db['SalesforceField'][_0x6cd1('0x2f')]);_0x10ed04[_0x6cd1('0x34')]=_[_0x6cd1('0x46')](_0x46f905[_0x6cd1('0x34')]);_0x10ed04[_0x6cd1('0x35')]=_[_0x6cd1('0x36')](_0x10ed04[_0x6cd1('0x33')],_0x10ed04[_0x6cd1('0x34')]);_0x520f75[_0x6cd1('0x37')]=_['intersection'](_0x10ed04[_0x6cd1('0x33')],qs[_0x6cd1('0x38')](_0x46f905[_0x6cd1('0x34')][_0x6cd1('0x38')]));_0x520f75[_0x6cd1('0x37')]=_0x520f75[_0x6cd1('0x37')][_0x6cd1('0x39')]?_0x520f75[_0x6cd1('0x37')]:_0x10ed04['model'];_0x520f75[_0x6cd1('0x4d')]=qs['sort'](_0x46f905[_0x6cd1('0x34')][_0x6cd1('0x3b')]);_0x520f75[_0x6cd1('0x3e')]=qs[_0x6cd1('0x35')](_[_0x6cd1('0x3c')](_0x46f905[_0x6cd1('0x34')],_0x10ed04[_0x6cd1('0x35')]));if(_0x46f905[_0x6cd1('0x34')][_0x6cd1('0x3d')]){_0x520f75[_0x6cd1('0x3e')]=_[_0x6cd1('0x40')](_0x520f75[_0x6cd1('0x3e')],{'$or':_[_0x6cd1('0x2d')](_0x520f75['attributes'],function(_0x585202){var _0x2e02ee={};_0x2e02ee[_0x585202]={'$like':'%'+_0x46f905[_0x6cd1('0x34')]['filter']+'%'};return _0x2e02ee;})});}_0x520f75=_['merge']({},_0x520f75,_0x46f905[_0x6cd1('0x41')]);return _0x4dff6c['getFields'](_0x520f75);}})['then'](function(_0x3ab239){if(_0x3ab239){_0x372cdb=_0x3ab239[_0x6cd1('0x39')];if(!_0x46f905[_0x6cd1('0x34')][_0x6cd1('0x4e')]('nolimit')){_0x520f75['limit']=qs[_0x6cd1('0x1f')](_0x46f905[_0x6cd1('0x34')][_0x6cd1('0x1f')]);_0x520f75['offset']=qs[_0x6cd1('0x1e')](_0x46f905[_0x6cd1('0x34')][_0x6cd1('0x1e')]);}return _0x4dff6c[_0x6cd1('0x4f')](_0x520f75);}})[_0x6cd1('0x26')](function(_0x58311b){if(_0x58311b){return _0x58311b?{'count':_0x372cdb,'rows':_0x58311b}:null;}})[_0x6cd1('0x26')](respondWithResult(_0xb10a4f,null))['catch'](handleError(_0xb10a4f,null));};exports[_0x6cd1('0x50')]=function(_0x7df3e8,_0x97bd68,_0x43cd60){var _0x56181={};var _0x1bfc7b={};var _0x4b2366;var _0x229ac8;return db[_0x6cd1('0x2e')][_0x6cd1('0x4c')]({'where':{'id':_0x7df3e8[_0x6cd1('0x4b')]['id']}})[_0x6cd1('0x26')](handleEntityNotFound(_0x97bd68,null))[_0x6cd1('0x26')](function(_0x1a1b7f){if(_0x1a1b7f){_0x4b2366=_0x1a1b7f;_0x1bfc7b[_0x6cd1('0x33')]=_[_0x6cd1('0x46')](db[_0x6cd1('0x51')][_0x6cd1('0x2f')]);_0x1bfc7b['query']=_[_0x6cd1('0x46')](_0x7df3e8['query']);_0x1bfc7b['filters']=_[_0x6cd1('0x36')](_0x1bfc7b[_0x6cd1('0x33')],_0x1bfc7b[_0x6cd1('0x34')]);_0x56181['attributes']=_[_0x6cd1('0x36')](_0x1bfc7b['model'],qs[_0x6cd1('0x38')](_0x7df3e8[_0x6cd1('0x34')][_0x6cd1('0x38')]));_0x56181[_0x6cd1('0x37')]=_0x56181[_0x6cd1('0x37')]['length']?_0x56181['attributes']:_0x1bfc7b['model'];_0x56181[_0x6cd1('0x4d')]=qs[_0x6cd1('0x3b')](_0x7df3e8[_0x6cd1('0x34')][_0x6cd1('0x3b')]);_0x56181['where']=qs[_0x6cd1('0x35')](_[_0x6cd1('0x3c')](_0x7df3e8[_0x6cd1('0x34')],_0x1bfc7b['filters']));if(_0x7df3e8[_0x6cd1('0x34')][_0x6cd1('0x3d')]){_0x56181[_0x6cd1('0x3e')]=_[_0x6cd1('0x40')](_0x56181[_0x6cd1('0x3e')],{'$or':_['map'](_0x56181['attributes'],function(_0x5b2d57){var _0xb03af4={};_0xb03af4[_0x5b2d57]={'$like':'%'+_0x7df3e8[_0x6cd1('0x34')]['filter']+'%'};return _0xb03af4;})});}_0x56181=_[_0x6cd1('0x40')]({},_0x56181,_0x7df3e8['options']);return _0x4b2366[_0x6cd1('0x50')](_0x56181);}})[_0x6cd1('0x26')](function(_0x3e205b){if(_0x3e205b){_0x229ac8=_0x3e205b[_0x6cd1('0x39')];if(!_0x7df3e8[_0x6cd1('0x34')]['hasOwnProperty'](_0x6cd1('0x3a'))){_0x56181[_0x6cd1('0x1f')]=qs[_0x6cd1('0x1f')](_0x7df3e8[_0x6cd1('0x34')][_0x6cd1('0x1f')]);_0x56181[_0x6cd1('0x1e')]=qs['offset'](_0x7df3e8['query'][_0x6cd1('0x1e')]);}return _0x4b2366[_0x6cd1('0x50')](_0x56181);}})['then'](function(_0x58d8b2){if(_0x58d8b2){return _0x58d8b2?{'count':_0x229ac8,'rows':_0x58d8b2}:null;}})['then'](respondWithResult(_0x97bd68,null))[_0x6cd1('0x44')](handleError(_0x97bd68,null));};exports[_0x6cd1('0x52')]=function(_0x34c122,_0xc58347,_0x28d7ea){var _0x474aff={};var _0x34e6a9={};var _0x37fb37;var _0x5c9e84;return db[_0x6cd1('0x2e')][_0x6cd1('0x4c')]({'where':{'id':_0x34c122['params']['id']}})[_0x6cd1('0x26')](handleEntityNotFound(_0xc58347,null))[_0x6cd1('0x26')](function(_0x13a1be){if(_0x13a1be){_0x37fb37=_0x13a1be;_0x34e6a9[_0x6cd1('0x33')]=_['keys'](db['SalesforceField'][_0x6cd1('0x2f')]);_0x34e6a9[_0x6cd1('0x34')]=_[_0x6cd1('0x46')](_0x34c122[_0x6cd1('0x34')]);_0x34e6a9[_0x6cd1('0x35')]=_[_0x6cd1('0x36')](_0x34e6a9[_0x6cd1('0x33')],_0x34e6a9[_0x6cd1('0x34')]);_0x474aff[_0x6cd1('0x37')]=_[_0x6cd1('0x36')](_0x34e6a9[_0x6cd1('0x33')],qs[_0x6cd1('0x38')](_0x34c122[_0x6cd1('0x34')][_0x6cd1('0x38')]));_0x474aff[_0x6cd1('0x37')]=_0x474aff[_0x6cd1('0x37')]['length']?_0x474aff[_0x6cd1('0x37')]:_0x34e6a9[_0x6cd1('0x33')];_0x474aff[_0x6cd1('0x4d')]=qs[_0x6cd1('0x3b')](_0x34c122['query'][_0x6cd1('0x3b')]);_0x474aff['where']=qs[_0x6cd1('0x35')](_[_0x6cd1('0x3c')](_0x34c122[_0x6cd1('0x34')],_0x34e6a9[_0x6cd1('0x35')]));if(_0x34c122['query'][_0x6cd1('0x3d')]){_0x474aff[_0x6cd1('0x3e')]=_['merge'](_0x474aff[_0x6cd1('0x3e')],{'$or':_[_0x6cd1('0x2d')](_0x474aff['attributes'],function(_0x3dfc60){var _0x2f013a={};_0x2f013a[_0x3dfc60]={'$like':'%'+_0x34c122[_0x6cd1('0x34')][_0x6cd1('0x3d')]+'%'};return _0x2f013a;})});}_0x474aff=_['merge']({},_0x474aff,_0x34c122[_0x6cd1('0x41')]);return _0x37fb37[_0x6cd1('0x52')](_0x474aff);}})[_0x6cd1('0x26')](function(_0xba136b){if(_0xba136b){_0x5c9e84=_0xba136b[_0x6cd1('0x39')];if(!_0x34c122[_0x6cd1('0x34')][_0x6cd1('0x4e')](_0x6cd1('0x3a'))){_0x474aff[_0x6cd1('0x1f')]=qs['limit'](_0x34c122[_0x6cd1('0x34')][_0x6cd1('0x1f')]);_0x474aff[_0x6cd1('0x1e')]=qs['offset'](_0x34c122[_0x6cd1('0x34')][_0x6cd1('0x1e')]);}return _0x37fb37[_0x6cd1('0x52')](_0x474aff);}})[_0x6cd1('0x26')](function(_0x5ed972){if(_0x5ed972){return _0x5ed972?{'count':_0x5c9e84,'rows':_0x5ed972}:null;}})[_0x6cd1('0x26')](respondWithResult(_0xc58347,null))[_0x6cd1('0x44')](handleError(_0xc58347,null));}; \ No newline at end of file +var _0x362a=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','limit','undefined','count','offset','Content-Range','json','apply','reject','save','then','destroy','error','stack','name','send','index','map','SalesforceConfiguration','rawAttributes','fieldName','type','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','intersection','options','find','update','body','getFields','findOne','getSubjects','SalesforceField','getDescriptions'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x362a,0x102));var _0xa362=function(_0xac6fdf,_0x315296){_0xac6fdf=_0xac6fdf-0x0;var _0x56d02f=_0x362a[_0xac6fdf];return _0x56d02f;};'use strict';var emlformat=require(_0xa362('0x0'));var rimraf=require(_0xa362('0x1'));var zipdir=require(_0xa362('0x2'));var jsonpatch=require(_0xa362('0x3'));var rp=require(_0xa362('0x4'));var moment=require(_0xa362('0x5'));var BPromise=require(_0xa362('0x6'));var Mustache=require(_0xa362('0x7'));var util=require(_0xa362('0x8'));var path=require(_0xa362('0x9'));var sox=require(_0xa362('0xa'));var csv=require(_0xa362('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa362('0xc'));var _=require(_0xa362('0xd'));var squel=require(_0xa362('0xe'));var crypto=require(_0xa362('0xf'));var jsforce=require(_0xa362('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xa362('0xb'));var querystring=require(_0xa362('0x11'));var Papa=require(_0xa362('0x12'));var Redis=require(_0xa362('0x13'));var authService=require(_0xa362('0x14'));var qs=require(_0xa362('0x15'));var as=require(_0xa362('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa362('0x17'))(_0xa362('0x18'));var utils=require(_0xa362('0x19'));var config=require(_0xa362('0x1a'));var licenseUtil=require(_0xa362('0x1b'));var db=require(_0xa362('0x1c'))['db'];function respondWithStatusCode(_0xab1593,_0x4d5552){_0x4d5552=_0x4d5552||0xcc;return function(_0x5c8c3c){if(_0x5c8c3c){return _0xab1593[_0xa362('0x1d')](_0x4d5552);}return _0xab1593[_0xa362('0x1e')](_0x4d5552)[_0xa362('0x1f')]();};}function respondWithResult(_0x158b6f,_0x5700fc){_0x5700fc=_0x5700fc||0xc8;return function(_0x4c5c50){if(_0x4c5c50){return _0x158b6f[_0xa362('0x1e')](_0x5700fc)['json'](_0x4c5c50);}};}function respondWithFilteredResult(_0x2dbba4,_0xf13eca){return function(_0x14007a){if(_0x14007a){var _0x1ba90a=typeof _0xf13eca['offset']==='undefined'&&typeof _0xf13eca[_0xa362('0x20')]===_0xa362('0x21');var _0x19227d=_0x14007a[_0xa362('0x22')];var _0x5bf01a=_0x1ba90a?0x0:_0xf13eca[_0xa362('0x23')];var _0x9c4479=_0x1ba90a?_0x14007a[_0xa362('0x22')]:_0xf13eca[_0xa362('0x23')]+_0xf13eca[_0xa362('0x20')];var _0x507577;if(_0x9c4479>=_0x19227d){_0x9c4479=_0x19227d;_0x507577=0xc8;}else{_0x507577=0xce;}_0x2dbba4['status'](_0x507577);return _0x2dbba4['set'](_0xa362('0x24'),_0x5bf01a+'-'+_0x9c4479+'/'+_0x19227d)[_0xa362('0x25')](_0x14007a);}return null;};}function patchUpdates(_0x124369){return function(_0x3ff101){try{jsonpatch[_0xa362('0x26')](_0x3ff101,_0x124369,!![]);}catch(_0x3e7ec3){return BPromise[_0xa362('0x27')](_0x3e7ec3);}return _0x3ff101[_0xa362('0x28')]();};}function saveUpdates(_0x1ffa78,_0xdaf202){return function(_0xeee5a5){if(_0xeee5a5){return _0xeee5a5['update'](_0x1ffa78)[_0xa362('0x29')](function(_0x5af6e3){return _0x5af6e3;});}return null;};}function removeEntity(_0x2384b6,_0x3f5449){return function(_0x545157){if(_0x545157){return _0x545157[_0xa362('0x2a')]()['then'](function(){_0x2384b6['status'](0xcc)[_0xa362('0x1f')]();});}};}function handleEntityNotFound(_0x53c9a7,_0x3f5bc2){return function(_0x26164c){if(!_0x26164c){_0x53c9a7[_0xa362('0x1d')](0x194);}return _0x26164c;};}function handleError(_0x54a496,_0x275a52){_0x275a52=_0x275a52||0x1f4;return function(_0x32ceb1){logger[_0xa362('0x2b')](_0x32ceb1[_0xa362('0x2c')]);if(_0x32ceb1[_0xa362('0x2d')]){delete _0x32ceb1[_0xa362('0x2d')];}_0x54a496[_0xa362('0x1e')](_0x275a52)[_0xa362('0x2e')](_0x32ceb1);};}exports[_0xa362('0x2f')]=function(_0x3018df,_0x5de0f3){var _0x136e20={},_0x31d2bf={},_0x5e0f66={'count':0x0,'rows':[]};var _0x167fd5=_[_0xa362('0x30')](db[_0xa362('0x31')][_0xa362('0x32')],function(_0x3af38c){return{'name':_0x3af38c[_0xa362('0x33')],'type':_0x3af38c[_0xa362('0x34')]['key']};});_0x31d2bf[_0xa362('0x35')]=_['map'](_0x167fd5,_0xa362('0x2d'));_0x31d2bf[_0xa362('0x36')]=_[_0xa362('0x37')](_0x3018df[_0xa362('0x36')]);_0x31d2bf[_0xa362('0x38')]=_['intersection'](_0x31d2bf[_0xa362('0x35')],_0x31d2bf[_0xa362('0x36')]);_0x136e20[_0xa362('0x39')]=_['intersection'](_0x31d2bf[_0xa362('0x35')],qs[_0xa362('0x3a')](_0x3018df[_0xa362('0x36')][_0xa362('0x3a')]));_0x136e20['attributes']=_0x136e20[_0xa362('0x39')][_0xa362('0x3b')]?_0x136e20[_0xa362('0x39')]:_0x31d2bf['model'];if(!_0x3018df[_0xa362('0x36')][_0xa362('0x3c')](_0xa362('0x3d'))){_0x136e20[_0xa362('0x20')]=qs[_0xa362('0x20')](_0x3018df[_0xa362('0x36')][_0xa362('0x20')]);_0x136e20[_0xa362('0x23')]=qs['offset'](_0x3018df['query'][_0xa362('0x23')]);}_0x136e20[_0xa362('0x3e')]=qs[_0xa362('0x3f')](_0x3018df['query']['sort']);_0x136e20[_0xa362('0x40')]=qs[_0xa362('0x38')](_[_0xa362('0x41')](_0x3018df[_0xa362('0x36')],_0x31d2bf[_0xa362('0x38')]),_0x167fd5);if(_0x3018df[_0xa362('0x36')][_0xa362('0x42')]){_0x136e20[_0xa362('0x40')]=_[_0xa362('0x43')](_0x136e20[_0xa362('0x40')],{'$or':_['map'](_0x167fd5,function(_0x9d7be3){if(_0x9d7be3['type']!==_0xa362('0x44')){var _0x33ce9e={};_0x33ce9e[_0x9d7be3['name']]={'$like':'%'+_0x3018df[_0xa362('0x36')][_0xa362('0x42')]+'%'};return _0x33ce9e;}})});}_0x136e20=_[_0xa362('0x43')]({},_0x136e20,_0x3018df['options']);var _0x51111a={'where':_0x136e20[_0xa362('0x40')]};return db[_0xa362('0x31')]['count'](_0x51111a)[_0xa362('0x29')](function(_0x50156f){_0x5e0f66[_0xa362('0x22')]=_0x50156f;if(_0x3018df[_0xa362('0x36')][_0xa362('0x45')]){_0x136e20[_0xa362('0x46')]=[{'all':!![]}];}return db['SalesforceConfiguration'][_0xa362('0x47')](_0x136e20);})[_0xa362('0x29')](function(_0x551171){_0x5e0f66[_0xa362('0x48')]=_0x551171;return _0x5e0f66;})[_0xa362('0x29')](respondWithFilteredResult(_0x5de0f3,_0x136e20))[_0xa362('0x49')](handleError(_0x5de0f3,null));};exports[_0xa362('0x4a')]=function(_0x455e4c,_0x34f952){var _0x4b35b4={'raw':![],'where':{'id':_0x455e4c[_0xa362('0x4b')]['id']}},_0x937ea8={};_0x937ea8['model']=_[_0xa362('0x37')](db[_0xa362('0x31')][_0xa362('0x32')]);_0x937ea8[_0xa362('0x36')]=_[_0xa362('0x37')](_0x455e4c[_0xa362('0x36')]);_0x937ea8[_0xa362('0x38')]=_[_0xa362('0x4c')](_0x937ea8[_0xa362('0x35')],_0x937ea8[_0xa362('0x36')]);_0x4b35b4[_0xa362('0x39')]=_[_0xa362('0x4c')](_0x937ea8[_0xa362('0x35')],qs[_0xa362('0x3a')](_0x455e4c[_0xa362('0x36')][_0xa362('0x3a')]));_0x4b35b4[_0xa362('0x39')]=_0x4b35b4[_0xa362('0x39')][_0xa362('0x3b')]?_0x4b35b4['attributes']:_0x937ea8[_0xa362('0x35')];if(_0x455e4c[_0xa362('0x36')][_0xa362('0x45')]){_0x4b35b4[_0xa362('0x46')]=[{'all':!![]}];}_0x4b35b4=_['merge']({},_0x4b35b4,_0x455e4c[_0xa362('0x4d')]);return db[_0xa362('0x31')][_0xa362('0x4e')](_0x4b35b4)['then'](handleEntityNotFound(_0x34f952,null))[_0xa362('0x29')](respondWithResult(_0x34f952,null))[_0xa362('0x49')](handleError(_0x34f952,null));};exports['create']=function(_0x1484b0,_0x58e4dd){return db[_0xa362('0x31')]['create'](_0x1484b0['body'],{})[_0xa362('0x29')](respondWithResult(_0x58e4dd,0xc9))['catch'](handleError(_0x58e4dd,null));};exports[_0xa362('0x4f')]=function(_0x118472,_0xcbd59d){if(_0x118472[_0xa362('0x50')]['id']){delete _0x118472[_0xa362('0x50')]['id'];}return db[_0xa362('0x31')][_0xa362('0x4e')]({'where':{'id':_0x118472[_0xa362('0x4b')]['id']}})['then'](handleEntityNotFound(_0xcbd59d,null))[_0xa362('0x29')](saveUpdates(_0x118472[_0xa362('0x50')],null))['then'](respondWithResult(_0xcbd59d,null))[_0xa362('0x49')](handleError(_0xcbd59d,null));};exports['destroy']=function(_0x3ad9db,_0x561814){return db[_0xa362('0x31')]['find']({'where':{'id':_0x3ad9db[_0xa362('0x4b')]['id']}})[_0xa362('0x29')](handleEntityNotFound(_0x561814,null))[_0xa362('0x29')](removeEntity(_0x561814,null))['catch'](handleError(_0x561814,null));};exports[_0xa362('0x51')]=function(_0x4c8ba1,_0x4442e4,_0x537ddb){var _0x54502e={};var _0x5256c9={};var _0x23729b;var _0x53b82d;return db['SalesforceConfiguration'][_0xa362('0x52')]({'where':{'id':_0x4c8ba1[_0xa362('0x4b')]['id']}})['then'](handleEntityNotFound(_0x4442e4,null))[_0xa362('0x29')](function(_0x502665){if(_0x502665){_0x23729b=_0x502665;_0x5256c9[_0xa362('0x35')]=_[_0xa362('0x37')](db['SalesforceField'][_0xa362('0x32')]);_0x5256c9['query']=_[_0xa362('0x37')](_0x4c8ba1[_0xa362('0x36')]);_0x5256c9['filters']=_[_0xa362('0x4c')](_0x5256c9[_0xa362('0x35')],_0x5256c9[_0xa362('0x36')]);_0x54502e['attributes']=_[_0xa362('0x4c')](_0x5256c9[_0xa362('0x35')],qs[_0xa362('0x3a')](_0x4c8ba1[_0xa362('0x36')][_0xa362('0x3a')]));_0x54502e[_0xa362('0x39')]=_0x54502e[_0xa362('0x39')][_0xa362('0x3b')]?_0x54502e[_0xa362('0x39')]:_0x5256c9[_0xa362('0x35')];_0x54502e[_0xa362('0x3e')]=qs['sort'](_0x4c8ba1[_0xa362('0x36')][_0xa362('0x3f')]);_0x54502e[_0xa362('0x40')]=qs['filters'](_[_0xa362('0x41')](_0x4c8ba1['query'],_0x5256c9[_0xa362('0x38')]));if(_0x4c8ba1[_0xa362('0x36')]['filter']){_0x54502e[_0xa362('0x40')]=_[_0xa362('0x43')](_0x54502e[_0xa362('0x40')],{'$or':_['map'](_0x54502e[_0xa362('0x39')],function(_0x590f8c){var _0xf1f4c4={};_0xf1f4c4[_0x590f8c]={'$like':'%'+_0x4c8ba1[_0xa362('0x36')][_0xa362('0x42')]+'%'};return _0xf1f4c4;})});}_0x54502e=_['merge']({},_0x54502e,_0x4c8ba1['options']);return _0x23729b[_0xa362('0x51')](_0x54502e);}})['then'](function(_0xf2c7bd){if(_0xf2c7bd){_0x53b82d=_0xf2c7bd[_0xa362('0x3b')];if(!_0x4c8ba1[_0xa362('0x36')]['hasOwnProperty']('nolimit')){_0x54502e[_0xa362('0x20')]=qs[_0xa362('0x20')](_0x4c8ba1[_0xa362('0x36')][_0xa362('0x20')]);_0x54502e[_0xa362('0x23')]=qs[_0xa362('0x23')](_0x4c8ba1[_0xa362('0x36')][_0xa362('0x23')]);}return _0x23729b['getFields'](_0x54502e);}})[_0xa362('0x29')](function(_0x35b7f7){if(_0x35b7f7){return _0x35b7f7?{'count':_0x53b82d,'rows':_0x35b7f7}:null;}})['then'](respondWithResult(_0x4442e4,null))[_0xa362('0x49')](handleError(_0x4442e4,null));};exports[_0xa362('0x53')]=function(_0x44c38d,_0x1583d2,_0x40f2f2){var _0x43f452={};var _0xc9f4f1={};var _0x13cf7b;var _0x4ae2ec;return db['SalesforceConfiguration']['findOne']({'where':{'id':_0x44c38d[_0xa362('0x4b')]['id']}})[_0xa362('0x29')](handleEntityNotFound(_0x1583d2,null))['then'](function(_0x7672f5){if(_0x7672f5){_0x13cf7b=_0x7672f5;_0xc9f4f1[_0xa362('0x35')]=_[_0xa362('0x37')](db[_0xa362('0x54')][_0xa362('0x32')]);_0xc9f4f1[_0xa362('0x36')]=_['keys'](_0x44c38d['query']);_0xc9f4f1[_0xa362('0x38')]=_[_0xa362('0x4c')](_0xc9f4f1[_0xa362('0x35')],_0xc9f4f1[_0xa362('0x36')]);_0x43f452[_0xa362('0x39')]=_[_0xa362('0x4c')](_0xc9f4f1[_0xa362('0x35')],qs['fields'](_0x44c38d[_0xa362('0x36')][_0xa362('0x3a')]));_0x43f452['attributes']=_0x43f452[_0xa362('0x39')][_0xa362('0x3b')]?_0x43f452['attributes']:_0xc9f4f1[_0xa362('0x35')];_0x43f452[_0xa362('0x3e')]=qs[_0xa362('0x3f')](_0x44c38d['query'][_0xa362('0x3f')]);_0x43f452[_0xa362('0x40')]=qs[_0xa362('0x38')](_[_0xa362('0x41')](_0x44c38d['query'],_0xc9f4f1[_0xa362('0x38')]));if(_0x44c38d['query'][_0xa362('0x42')]){_0x43f452[_0xa362('0x40')]=_[_0xa362('0x43')](_0x43f452[_0xa362('0x40')],{'$or':_[_0xa362('0x30')](_0x43f452['attributes'],function(_0x2bd6f6){var _0x2c6fd7={};_0x2c6fd7[_0x2bd6f6]={'$like':'%'+_0x44c38d[_0xa362('0x36')][_0xa362('0x42')]+'%'};return _0x2c6fd7;})});}_0x43f452=_[_0xa362('0x43')]({},_0x43f452,_0x44c38d['options']);return _0x13cf7b['getSubjects'](_0x43f452);}})[_0xa362('0x29')](function(_0x18cd64){if(_0x18cd64){_0x4ae2ec=_0x18cd64[_0xa362('0x3b')];if(!_0x44c38d[_0xa362('0x36')][_0xa362('0x3c')](_0xa362('0x3d'))){_0x43f452['limit']=qs[_0xa362('0x20')](_0x44c38d['query'][_0xa362('0x20')]);_0x43f452[_0xa362('0x23')]=qs['offset'](_0x44c38d['query'][_0xa362('0x23')]);}return _0x13cf7b[_0xa362('0x53')](_0x43f452);}})['then'](function(_0x1f4414){if(_0x1f4414){return _0x1f4414?{'count':_0x4ae2ec,'rows':_0x1f4414}:null;}})[_0xa362('0x29')](respondWithResult(_0x1583d2,null))['catch'](handleError(_0x1583d2,null));};exports[_0xa362('0x55')]=function(_0x2cc845,_0x4b27f7,_0x2f8925){var _0x56b4ae={};var _0x108d45={};var _0x4215a7;var _0x169281;return db[_0xa362('0x31')][_0xa362('0x52')]({'where':{'id':_0x2cc845[_0xa362('0x4b')]['id']}})['then'](handleEntityNotFound(_0x4b27f7,null))[_0xa362('0x29')](function(_0x4aa708){if(_0x4aa708){_0x4215a7=_0x4aa708;_0x108d45[_0xa362('0x35')]=_[_0xa362('0x37')](db['SalesforceField']['rawAttributes']);_0x108d45[_0xa362('0x36')]=_[_0xa362('0x37')](_0x2cc845[_0xa362('0x36')]);_0x108d45[_0xa362('0x38')]=_[_0xa362('0x4c')](_0x108d45[_0xa362('0x35')],_0x108d45[_0xa362('0x36')]);_0x56b4ae[_0xa362('0x39')]=_['intersection'](_0x108d45[_0xa362('0x35')],qs[_0xa362('0x3a')](_0x2cc845[_0xa362('0x36')][_0xa362('0x3a')]));_0x56b4ae['attributes']=_0x56b4ae[_0xa362('0x39')][_0xa362('0x3b')]?_0x56b4ae[_0xa362('0x39')]:_0x108d45['model'];_0x56b4ae[_0xa362('0x3e')]=qs[_0xa362('0x3f')](_0x2cc845['query'][_0xa362('0x3f')]);_0x56b4ae[_0xa362('0x40')]=qs['filters'](_[_0xa362('0x41')](_0x2cc845[_0xa362('0x36')],_0x108d45[_0xa362('0x38')]));if(_0x2cc845['query'][_0xa362('0x42')]){_0x56b4ae[_0xa362('0x40')]=_[_0xa362('0x43')](_0x56b4ae[_0xa362('0x40')],{'$or':_['map'](_0x56b4ae[_0xa362('0x39')],function(_0x361417){var _0x3f1077={};_0x3f1077[_0x361417]={'$like':'%'+_0x2cc845[_0xa362('0x36')][_0xa362('0x42')]+'%'};return _0x3f1077;})});}_0x56b4ae=_[_0xa362('0x43')]({},_0x56b4ae,_0x2cc845[_0xa362('0x4d')]);return _0x4215a7['getDescriptions'](_0x56b4ae);}})[_0xa362('0x29')](function(_0x502b5c){if(_0x502b5c){_0x169281=_0x502b5c[_0xa362('0x3b')];if(!_0x2cc845[_0xa362('0x36')]['hasOwnProperty'](_0xa362('0x3d'))){_0x56b4ae[_0xa362('0x20')]=qs[_0xa362('0x20')](_0x2cc845['query'][_0xa362('0x20')]);_0x56b4ae[_0xa362('0x23')]=qs[_0xa362('0x23')](_0x2cc845[_0xa362('0x36')][_0xa362('0x23')]);}return _0x4215a7[_0xa362('0x55')](_0x56b4ae);}})[_0xa362('0x29')](function(_0x27867f){if(_0x27867f){return _0x27867f?{'count':_0x169281,'rows':_0x27867f}:null;}})[_0xa362('0x29')](respondWithResult(_0x4b27f7,null))['catch'](handleError(_0x4b27f7,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index ec2f149..f005cc1 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 _0xeab4=['int_salesforce_configurations','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','./intSalesforceConfiguration.attributes','exports'];(function(_0x2ba104,_0x2f5851){var _0x36ccd3=function(_0x4d0779){while(--_0x4d0779){_0x2ba104['push'](_0x2ba104['shift']());}};_0x36ccd3(++_0x2f5851);}(_0xeab4,0x1da));var _0x4eab=function(_0x41cb38,_0x448564){_0x41cb38=_0x41cb38-0x0;var _0x27efe2=_0xeab4[_0x41cb38];return _0x27efe2;};'use strict';var _=require(_0x4eab('0x0'));var util=require(_0x4eab('0x1'));var logger=require(_0x4eab('0x2'))(_0x4eab('0x3'));var moment=require(_0x4eab('0x4'));var BPromise=require('bluebird');var rp=require(_0x4eab('0x5'));var fs=require('fs');var path=require(_0x4eab('0x6'));var rimraf=require(_0x4eab('0x7'));var config=require('../../config/environment');var attributes=require(_0x4eab('0x8'));module[_0x4eab('0x9')]=function(_0x962e01,_0x41d2f8){return _0x962e01['define']('SalesforceConfiguration',attributes,{'tableName':_0x4eab('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x213b=['define','SalesforceConfiguration','lodash','util','api','moment','bluebird','rimraf','../../config/environment','./intSalesforceConfiguration.attributes','exports'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x213b,0xd3));var _0xb213=function(_0xcb3eb3,_0x4b2bed){_0xcb3eb3=_0xcb3eb3-0x0;var _0x7bbcb6=_0x213b[_0xcb3eb3];return _0x7bbcb6;};'use strict';var _=require(_0xb213('0x0'));var util=require(_0xb213('0x1'));var logger=require('../../config/logger')(_0xb213('0x2'));var moment=require(_0xb213('0x3'));var BPromise=require(_0xb213('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xb213('0x5'));var config=require(_0xb213('0x6'));var attributes=require(_0xb213('0x7'));module[_0xb213('0x8')]=function(_0xf4cf3d,_0x50a20f){return _0xf4cf3d[_0xb213('0x9')](_0xb213('0xa'),attributes,{'tableName':'int_salesforce_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js index fef1c2c..9296ce2 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 _0x5941=['code','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','error'];(function(_0x349ad5,_0x104a5f){var _0x5e9212=function(_0x5e9d34){while(--_0x5e9d34){_0x349ad5['push'](_0x349ad5['shift']());}};_0x5e9212(++_0x104a5f);}(_0x5941,0x88));var _0x1594=function(_0x212599,_0x5b59af){_0x212599=_0x212599-0x0;var _0x429f2d=_0x5941[_0x212599];return _0x429f2d;};'use strict';var _=require('lodash');var util=require(_0x1594('0x0'));var moment=require('moment');var BPromise=require(_0x1594('0x1'));var rs=require(_0x1594('0x2'));var fs=require('fs');var Redis=require(_0x1594('0x3'));var db=require(_0x1594('0x4'))['db'];var utils=require(_0x1594('0x5'));var logger=require(_0x1594('0x6'))(_0x1594('0x7'));var config=require('../../config/environment');var jayson=require(_0x1594('0x8'));var client=jayson[_0x1594('0x9')][_0x1594('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x54dcf0,_0x2ac416,_0x5e168f){return new BPromise(function(_0x3e9a27,_0x3873e2){return client['request'](_0x54dcf0,_0x5e168f)[_0x1594('0xb')](function(_0x26fa23){logger[_0x1594('0xc')](_0x1594('0xd'),_0x2ac416,_0x1594('0xe'));logger[_0x1594('0xf')](_0x1594('0x10'),_0x2ac416,'request\x20sent',JSON['stringify'](_0x26fa23));if(_0x26fa23[_0x1594('0x11')]){if(_0x26fa23[_0x1594('0x11')][_0x1594('0x12')]===0x1f4){logger[_0x1594('0x11')](_0x1594('0xd'),_0x2ac416,_0x26fa23[_0x1594('0x11')][_0x1594('0x13')]);return _0x3873e2(_0x26fa23[_0x1594('0x11')][_0x1594('0x13')]);}logger[_0x1594('0x11')](_0x1594('0xd'),_0x2ac416,_0x26fa23[_0x1594('0x11')][_0x1594('0x13')]);return _0x3e9a27(_0x26fa23[_0x1594('0x11')][_0x1594('0x13')]);}else{logger[_0x1594('0xc')](_0x1594('0xd'),_0x2ac416,'request\x20sent');_0x3e9a27(_0x26fa23[_0x1594('0x14')][_0x1594('0x13')]);}})[_0x1594('0x15')](function(_0x4343f9){logger[_0x1594('0x11')](_0x1594('0xd'),_0x2ac416,_0x4343f9);_0x3873e2(_0x4343f9);});});} \ No newline at end of file +var _0xfa6b=['moment','bluebird','randomstring','rpc','../../config/environment','jayson/promise','client','http','SalesforceConfiguration,\x20%s,\x20%s','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','util'];(function(_0x2f73fa,_0xd02104){var _0x346688=function(_0x25ed69){while(--_0x25ed69){_0x2f73fa['push'](_0x2f73fa['shift']());}};_0x346688(++_0xd02104);}(_0xfa6b,0x166));var _0xbfa6=function(_0xed7958,_0x1e138a){_0xed7958=_0xed7958-0x0;var _0x3069b1=_0xfa6b[_0xed7958];return _0x3069b1;};'use strict';var _=require(_0xbfa6('0x0'));var util=require(_0xbfa6('0x1'));var moment=require(_0xbfa6('0x2'));var BPromise=require(_0xbfa6('0x3'));var rs=require(_0xbfa6('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xbfa6('0x5'));var config=require(_0xbfa6('0x6'));var jayson=require(_0xbfa6('0x7'));var client=jayson[_0xbfa6('0x8')][_0xbfa6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x112331,_0x5d5cd7,_0x4f09c0){return new BPromise(function(_0x1c365d,_0x410d27){return client['request'](_0x112331,_0x4f09c0)['then'](function(_0x4d08a2){logger['info'](_0xbfa6('0xa'),_0x5d5cd7,'request\x20sent');logger['debug'](_0xbfa6('0xb'),_0x5d5cd7,_0xbfa6('0xc'),JSON[_0xbfa6('0xd')](_0x4d08a2));if(_0x4d08a2[_0xbfa6('0xe')]){if(_0x4d08a2[_0xbfa6('0xe')][_0xbfa6('0xf')]===0x1f4){logger[_0xbfa6('0xe')](_0xbfa6('0xa'),_0x5d5cd7,_0x4d08a2[_0xbfa6('0xe')][_0xbfa6('0x10')]);return _0x410d27(_0x4d08a2[_0xbfa6('0xe')][_0xbfa6('0x10')]);}logger[_0xbfa6('0xe')](_0xbfa6('0xa'),_0x5d5cd7,_0x4d08a2[_0xbfa6('0xe')][_0xbfa6('0x10')]);return _0x1c365d(_0x4d08a2[_0xbfa6('0xe')][_0xbfa6('0x10')]);}else{logger[_0xbfa6('0x11')](_0xbfa6('0xa'),_0x5d5cd7,_0xbfa6('0xc'));_0x1c365d(_0x4d08a2[_0xbfa6('0x12')]['message']);}})[_0xbfa6('0x13')](function(_0x4e7bf5){logger[_0xbfa6('0xe')](_0xbfa6('0xa'),_0x5d5cd7,_0x4e7bf5);_0x410d27(_0x4e7bf5);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index e04b729..116ab62 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 _0xe6a9=['../../config/environment','./intSalesforceField.controller','get','/:id','isAuthenticated','create','update','delete','destroy','exports','util','Router','fs-extra','../../components/auth/service'];(function(_0x383ebb,_0x210f23){var _0x207a70=function(_0x29f8a9){while(--_0x29f8a9){_0x383ebb['push'](_0x383ebb['shift']());}};_0x207a70(++_0x210f23);}(_0xe6a9,0x184));var _0x9e6a=function(_0x20cca4,_0x5f456f){_0x20cca4=_0x20cca4-0x0;var _0x100fa4=_0xe6a9[_0x20cca4];return _0x100fa4;};'use strict';var multer=require('multer');var util=require(_0x9e6a('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x9e6a('0x1')]();var fs_extra=require(_0x9e6a('0x2'));var auth=require(_0x9e6a('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x9e6a('0x4'));var controller=require(_0x9e6a('0x5'));router[_0x9e6a('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0x9e6a('0x6')](_0x9e6a('0x7'),auth[_0x9e6a('0x8')](),controller['show']);router['post']('/',auth[_0x9e6a('0x8')](),controller[_0x9e6a('0x9')]);router['put'](_0x9e6a('0x7'),auth[_0x9e6a('0x8')](),controller[_0x9e6a('0xa')]);router[_0x9e6a('0xb')](_0x9e6a('0x7'),auth[_0x9e6a('0x8')](),controller[_0x9e6a('0xc')]);module[_0x9e6a('0xd')]=router; \ No newline at end of file +var _0x41ef=['put','/:id','isAuthenticated','update','destroy','multer','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','get','index','post'];(function(_0x2ee6d1,_0xfad422){var _0x4752c1=function(_0x1e748f){while(--_0x1e748f){_0x2ee6d1['push'](_0x2ee6d1['shift']());}};_0x4752c1(++_0xfad422);}(_0x41ef,0xc5));var _0xf41e=function(_0x3351bf,_0x1acad8){_0x3351bf=_0x3351bf-0x0;var _0x535d15=_0x41ef[_0x3351bf];return _0x535d15;};'use strict';var multer=require(_0xf41e('0x0'));var util=require('util');var path=require(_0xf41e('0x1'));var timeout=require(_0xf41e('0x2'));var express=require('express');var router=express[_0xf41e('0x3')]();var fs_extra=require(_0xf41e('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xf41e('0x5'));var config=require(_0xf41e('0x6'));var controller=require(_0xf41e('0x7'));router[_0xf41e('0x8')]('/',auth['isAuthenticated'](),controller[_0xf41e('0x9')]);router[_0xf41e('0x8')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xf41e('0xa')]('/',auth['isAuthenticated'](),controller['create']);router[_0xf41e('0xb')](_0xf41e('0xc'),auth[_0xf41e('0xd')](),controller[_0xf41e('0xe')]);router['delete'](_0xf41e('0xc'),auth[_0xf41e('0xd')](),controller[_0xf41e('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index 3f7d29a..aef7bc2 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 _0x214b=['sequelize','exports','ENUM','string','variable','customVariable','keyValue','STRING'];(function(_0x566bdf,_0x1f4861){var _0x331215=function(_0x524d0d){while(--_0x524d0d){_0x566bdf['push'](_0x566bdf['shift']());}};_0x331215(++_0x1f4861);}(_0x214b,0x170));var _0xb214=function(_0x9ba722,_0xec716c){_0x9ba722=_0x9ba722-0x0;var _0x6a5e79=_0x214b[_0x9ba722];return _0x6a5e79;};'use strict';var Sequelize=require(_0xb214('0x0'));module[_0xb214('0x1')]={'type':{'type':Sequelize[_0xb214('0x2')](_0xb214('0x3'),_0xb214('0x4'),_0xb214('0x5'),_0xb214('0x6'),'picklist'),'defaultValue':_0xb214('0x3')},'content':{'type':Sequelize[_0xb214('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xb214('0x2')](_0xb214('0x3'),_0xb214('0x4'),_0xb214('0x5'))},'keyContent':{'type':Sequelize[_0xb214('0x7')]},'idField':{'type':Sequelize[_0xb214('0x7')]},'variableName':{'type':Sequelize[_0xb214('0x7')]}}; \ No newline at end of file +var _0x6d38=['STRING','sequelize','exports','ENUM','string','variable','customVariable','keyValue','picklist'];(function(_0x4e7dd7,_0x3e7134){var _0x4f4461=function(_0x17aabb){while(--_0x17aabb){_0x4e7dd7['push'](_0x4e7dd7['shift']());}};_0x4f4461(++_0x3e7134);}(_0x6d38,0xbe));var _0x86d3=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x6d38[_0x21a9d9];return _0x46adce;};'use strict';var Sequelize=require(_0x86d3('0x0'));module[_0x86d3('0x1')]={'type':{'type':Sequelize[_0x86d3('0x2')](_0x86d3('0x3'),_0x86d3('0x4'),_0x86d3('0x5'),_0x86d3('0x6'),_0x86d3('0x7')),'defaultValue':_0x86d3('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x86d3('0x8')]},'keyType':{'type':Sequelize['ENUM'](_0x86d3('0x3'),'variable',_0x86d3('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x86d3('0x8')]},'variableName':{'type':Sequelize[_0x86d3('0x8')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index 435f362..cc9ad36 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 _0x7384=['save','update','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','hasOwnProperty','sort','pick','filter','merge','VIRTUAL','options','where','SalesforceField','findAll','rows','catch','show','params','keys','length','includeAll','include','create','body','find','eml-format','zip-dir','request-promise','bluebird','mustache','path','sox','fs-extra','crypto','jsforce','to-csv','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','json','apply','reject'];(function(_0x46d78e,_0x29e9c5){var _0x557a79=function(_0x26caf7){while(--_0x26caf7){_0x46d78e['push'](_0x46d78e['shift']());}};_0x557a79(++_0x29e9c5);}(_0x7384,0x133));var _0x4738=function(_0x1c0e5f,_0xe7aca0){_0x1c0e5f=_0x1c0e5f-0x0;var _0x3b9b87=_0x7384[_0x1c0e5f];return _0x3b9b87;};'use strict';var emlformat=require(_0x4738('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4738('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4738('0x2'));var moment=require('moment');var BPromise=require(_0x4738('0x3'));var Mustache=require(_0x4738('0x4'));var util=require('util');var path=require(_0x4738('0x5'));var sox=require(_0x4738('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4738('0x7'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x4738('0x8'));var jsforce=require(_0x4738('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x4738('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x4738('0xb'));var authService=require(_0x4738('0xc'));var qs=require(_0x4738('0xd'));var as=require(_0x4738('0xe'));var hardwareService=require(_0x4738('0xf'));var logger=require(_0x4738('0x10'))('api');var utils=require(_0x4738('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0x4738('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1b7fd1,_0xa55342){_0xa55342=_0xa55342||0xcc;return function(_0x3fc5dc){if(_0x3fc5dc){return _0x1b7fd1['sendStatus'](_0xa55342);}return _0x1b7fd1[_0x4738('0x13')](_0xa55342)['end']();};}function respondWithResult(_0x1ff4e6,_0x2afbc2){_0x2afbc2=_0x2afbc2||0xc8;return function(_0x9b58f9){if(_0x9b58f9){return _0x1ff4e6[_0x4738('0x13')](_0x2afbc2)['json'](_0x9b58f9);}};}function respondWithFilteredResult(_0x1fb496,_0x1f90ea){return function(_0x5c0c78){if(_0x5c0c78){var _0x2b71c7=typeof _0x1f90ea[_0x4738('0x14')]===_0x4738('0x15')&&typeof _0x1f90ea[_0x4738('0x16')]===_0x4738('0x15');var _0xa0a98c=_0x5c0c78['count'];var _0x4f7515=_0x2b71c7?0x0:_0x1f90ea[_0x4738('0x14')];var _0x4e5dc6=_0x2b71c7?_0x5c0c78[_0x4738('0x17')]:_0x1f90ea[_0x4738('0x14')]+_0x1f90ea[_0x4738('0x16')];var _0x167249;if(_0x4e5dc6>=_0xa0a98c){_0x4e5dc6=_0xa0a98c;_0x167249=0xc8;}else{_0x167249=0xce;}_0x1fb496['status'](_0x167249);return _0x1fb496[_0x4738('0x18')]('Content-Range',_0x4f7515+'-'+_0x4e5dc6+'/'+_0xa0a98c)[_0x4738('0x19')](_0x5c0c78);}return null;};}function patchUpdates(_0x18981a){return function(_0x1f2560){try{jsonpatch[_0x4738('0x1a')](_0x1f2560,_0x18981a,!![]);}catch(_0x59fcd5){return BPromise[_0x4738('0x1b')](_0x59fcd5);}return _0x1f2560[_0x4738('0x1c')]();};}function saveUpdates(_0x212b29,_0x1644ad){return function(_0x1d5568){if(_0x1d5568){return _0x1d5568[_0x4738('0x1d')](_0x212b29)[_0x4738('0x1e')](function(_0x1f5324){return _0x1f5324;});}return null;};}function removeEntity(_0x4fc7cb,_0x55bf2a){return function(_0x111673){if(_0x111673){return _0x111673['destroy']()[_0x4738('0x1e')](function(){_0x4fc7cb['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x652de5,_0x426d78){return function(_0x2c0bc5){if(!_0x2c0bc5){_0x652de5['sendStatus'](0x194);}return _0x2c0bc5;};}function handleError(_0x80d863,_0x318c65){_0x318c65=_0x318c65||0x1f4;return function(_0x2f9b7c){logger[_0x4738('0x1f')](_0x2f9b7c[_0x4738('0x20')]);if(_0x2f9b7c['name']){delete _0x2f9b7c[_0x4738('0x21')];}_0x80d863[_0x4738('0x13')](_0x318c65)[_0x4738('0x22')](_0x2f9b7c);};}exports[_0x4738('0x23')]=function(_0x8c0e2e,_0x39119f){var _0x1f2b3d={},_0x5e0bbd={},_0x134976={'count':0x0,'rows':[]};var _0x516ff2=_[_0x4738('0x24')](db['SalesforceField'][_0x4738('0x25')],function(_0x138b24){return{'name':_0x138b24[_0x4738('0x26')],'type':_0x138b24[_0x4738('0x27')]['key']};});_0x5e0bbd[_0x4738('0x28')]=_['map'](_0x516ff2,_0x4738('0x21'));_0x5e0bbd['query']=_['keys'](_0x8c0e2e[_0x4738('0x29')]);_0x5e0bbd[_0x4738('0x2a')]=_[_0x4738('0x2b')](_0x5e0bbd[_0x4738('0x28')],_0x5e0bbd[_0x4738('0x29')]);_0x1f2b3d[_0x4738('0x2c')]=_[_0x4738('0x2b')](_0x5e0bbd['model'],qs['fields'](_0x8c0e2e[_0x4738('0x29')][_0x4738('0x2d')]));_0x1f2b3d[_0x4738('0x2c')]=_0x1f2b3d[_0x4738('0x2c')]['length']?_0x1f2b3d[_0x4738('0x2c')]:_0x5e0bbd['model'];if(!_0x8c0e2e[_0x4738('0x29')][_0x4738('0x2e')]('nolimit')){_0x1f2b3d[_0x4738('0x16')]=qs[_0x4738('0x16')](_0x8c0e2e[_0x4738('0x29')]['limit']);_0x1f2b3d[_0x4738('0x14')]=qs[_0x4738('0x14')](_0x8c0e2e[_0x4738('0x29')]['offset']);}_0x1f2b3d['order']=qs[_0x4738('0x2f')](_0x8c0e2e['query']['sort']);_0x1f2b3d['where']=qs[_0x4738('0x2a')](_[_0x4738('0x30')](_0x8c0e2e[_0x4738('0x29')],_0x5e0bbd[_0x4738('0x2a')]),_0x516ff2);if(_0x8c0e2e['query'][_0x4738('0x31')]){_0x1f2b3d['where']=_[_0x4738('0x32')](_0x1f2b3d['where'],{'$or':_[_0x4738('0x24')](_0x516ff2,function(_0x85d344){if(_0x85d344[_0x4738('0x27')]!==_0x4738('0x33')){var _0x52bcd8={};_0x52bcd8[_0x85d344[_0x4738('0x21')]]={'$like':'%'+_0x8c0e2e[_0x4738('0x29')][_0x4738('0x31')]+'%'};return _0x52bcd8;}})});}_0x1f2b3d=_[_0x4738('0x32')]({},_0x1f2b3d,_0x8c0e2e[_0x4738('0x34')]);var _0x441864={'where':_0x1f2b3d[_0x4738('0x35')]};return db[_0x4738('0x36')][_0x4738('0x17')](_0x441864)['then'](function(_0x4ec973){_0x134976[_0x4738('0x17')]=_0x4ec973;if(_0x8c0e2e[_0x4738('0x29')]['includeAll']){_0x1f2b3d['include']=[{'all':!![]}];}return db[_0x4738('0x36')][_0x4738('0x37')](_0x1f2b3d);})['then'](function(_0x3e626a){_0x134976[_0x4738('0x38')]=_0x3e626a;return _0x134976;})[_0x4738('0x1e')](respondWithFilteredResult(_0x39119f,_0x1f2b3d))[_0x4738('0x39')](handleError(_0x39119f,null));};exports[_0x4738('0x3a')]=function(_0x1a9947,_0x5283c6){var _0x52260d={'raw':!![],'where':{'id':_0x1a9947[_0x4738('0x3b')]['id']}},_0x42144f={};_0x42144f[_0x4738('0x28')]=_[_0x4738('0x3c')](db[_0x4738('0x36')][_0x4738('0x25')]);_0x42144f[_0x4738('0x29')]=_[_0x4738('0x3c')](_0x1a9947[_0x4738('0x29')]);_0x42144f[_0x4738('0x2a')]=_[_0x4738('0x2b')](_0x42144f[_0x4738('0x28')],_0x42144f[_0x4738('0x29')]);_0x52260d[_0x4738('0x2c')]=_['intersection'](_0x42144f[_0x4738('0x28')],qs[_0x4738('0x2d')](_0x1a9947[_0x4738('0x29')][_0x4738('0x2d')]));_0x52260d['attributes']=_0x52260d['attributes'][_0x4738('0x3d')]?_0x52260d[_0x4738('0x2c')]:_0x42144f[_0x4738('0x28')];if(_0x1a9947[_0x4738('0x29')][_0x4738('0x3e')]){_0x52260d[_0x4738('0x3f')]=[{'all':!![]}];}_0x52260d=_[_0x4738('0x32')]({},_0x52260d,_0x1a9947[_0x4738('0x34')]);return db['SalesforceField']['find'](_0x52260d)[_0x4738('0x1e')](handleEntityNotFound(_0x5283c6,null))[_0x4738('0x1e')](respondWithResult(_0x5283c6,null))[_0x4738('0x39')](handleError(_0x5283c6,null));};exports[_0x4738('0x40')]=function(_0x4ae5c9,_0x5c6830){return db['SalesforceField'][_0x4738('0x40')](_0x4ae5c9[_0x4738('0x41')],{})[_0x4738('0x1e')](respondWithResult(_0x5c6830,0xc9))[_0x4738('0x39')](handleError(_0x5c6830,null));};exports[_0x4738('0x1d')]=function(_0x1a7a60,_0x31415c){if(_0x1a7a60['body']['id']){delete _0x1a7a60[_0x4738('0x41')]['id'];}return db['SalesforceField'][_0x4738('0x42')]({'where':{'id':_0x1a7a60[_0x4738('0x3b')]['id']}})[_0x4738('0x1e')](handleEntityNotFound(_0x31415c,null))['then'](saveUpdates(_0x1a7a60[_0x4738('0x41')],null))[_0x4738('0x1e')](respondWithResult(_0x31415c,null))[_0x4738('0x39')](handleError(_0x31415c,null));};exports['destroy']=function(_0x3259dd,_0x4bb142){return db['SalesforceField'][_0x4738('0x42')]({'where':{'id':_0x3259dd[_0x4738('0x3b')]['id']}})[_0x4738('0x1e')](handleEntityNotFound(_0x4bb142,null))['then'](removeEntity(_0x4bb142,null))[_0x4738('0x39')](handleError(_0x4bb142,null));}; \ No newline at end of file +var _0xaa47=['includeAll','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','error','stack','name','send','map','SalesforceField','rawAttributes','type','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','order','sort','pick','filter','where','VIRTUAL','merge','options','include','findAll','rows','catch','params','keys','length'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xaa47,0x9a));var _0x7aa4=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xaa47[_0x1facfa];return _0x9ec701;};'use strict';var emlformat=require(_0x7aa4('0x0'));var rimraf=require(_0x7aa4('0x1'));var zipdir=require(_0x7aa4('0x2'));var jsonpatch=require(_0x7aa4('0x3'));var rp=require(_0x7aa4('0x4'));var moment=require('moment');var BPromise=require(_0x7aa4('0x5'));var Mustache=require(_0x7aa4('0x6'));var util=require(_0x7aa4('0x7'));var path=require(_0x7aa4('0x8'));var sox=require('sox');var csv=require(_0x7aa4('0x9'));var ejs=require(_0x7aa4('0xa'));var fs=require('fs');var fs_extra=require(_0x7aa4('0xb'));var _=require(_0x7aa4('0xc'));var squel=require(_0x7aa4('0xd'));var crypto=require(_0x7aa4('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x7aa4('0xf'));var toCsv=require(_0x7aa4('0x9'));var querystring=require('querystring');var Papa=require(_0x7aa4('0x10'));var Redis=require(_0x7aa4('0x11'));var authService=require(_0x7aa4('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x7aa4('0x13'));var hardwareService=require(_0x7aa4('0x14'));var logger=require(_0x7aa4('0x15'))(_0x7aa4('0x16'));var utils=require(_0x7aa4('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x7aa4('0x18'));var db=require(_0x7aa4('0x19'))['db'];function respondWithStatusCode(_0x9c0b61,_0x2c2548){_0x2c2548=_0x2c2548||0xcc;return function(_0xd60c74){if(_0xd60c74){return _0x9c0b61[_0x7aa4('0x1a')](_0x2c2548);}return _0x9c0b61['status'](_0x2c2548)[_0x7aa4('0x1b')]();};}function respondWithResult(_0x4b80ce,_0x40c3c8){_0x40c3c8=_0x40c3c8||0xc8;return function(_0x5423b3){if(_0x5423b3){return _0x4b80ce[_0x7aa4('0x1c')](_0x40c3c8)[_0x7aa4('0x1d')](_0x5423b3);}};}function respondWithFilteredResult(_0x33e3bf,_0x1bc15d){return function(_0x2dbab1){if(_0x2dbab1){var _0x1092b8=typeof _0x1bc15d[_0x7aa4('0x1e')]===_0x7aa4('0x1f')&&typeof _0x1bc15d[_0x7aa4('0x20')]===_0x7aa4('0x1f');var _0x107502=_0x2dbab1[_0x7aa4('0x21')];var _0x450920=_0x1092b8?0x0:_0x1bc15d[_0x7aa4('0x1e')];var _0x17e8b2=_0x1092b8?_0x2dbab1[_0x7aa4('0x21')]:_0x1bc15d['offset']+_0x1bc15d['limit'];var _0x18e170;if(_0x17e8b2>=_0x107502){_0x17e8b2=_0x107502;_0x18e170=0xc8;}else{_0x18e170=0xce;}_0x33e3bf[_0x7aa4('0x1c')](_0x18e170);return _0x33e3bf[_0x7aa4('0x22')](_0x7aa4('0x23'),_0x450920+'-'+_0x17e8b2+'/'+_0x107502)['json'](_0x2dbab1);}return null;};}function patchUpdates(_0x2b281b){return function(_0x1cc300){try{jsonpatch[_0x7aa4('0x24')](_0x1cc300,_0x2b281b,!![]);}catch(_0x2b03e7){return BPromise['reject'](_0x2b03e7);}return _0x1cc300[_0x7aa4('0x25')]();};}function saveUpdates(_0x140ab1,_0x4cc409){return function(_0x5b8c1e){if(_0x5b8c1e){return _0x5b8c1e['update'](_0x140ab1)[_0x7aa4('0x26')](function(_0x24f966){return _0x24f966;});}return null;};}function removeEntity(_0x52d943,_0x3f5e86){return function(_0x17c8ed){if(_0x17c8ed){return _0x17c8ed[_0x7aa4('0x27')]()[_0x7aa4('0x26')](function(){_0x52d943['status'](0xcc)[_0x7aa4('0x1b')]();});}};}function handleEntityNotFound(_0x3709b5,_0x3719a4){return function(_0x4aad08){if(!_0x4aad08){_0x3709b5[_0x7aa4('0x1a')](0x194);}return _0x4aad08;};}function handleError(_0x4b965e,_0x48e50c){_0x48e50c=_0x48e50c||0x1f4;return function(_0x35e146){logger[_0x7aa4('0x28')](_0x35e146[_0x7aa4('0x29')]);if(_0x35e146[_0x7aa4('0x2a')]){delete _0x35e146[_0x7aa4('0x2a')];}_0x4b965e[_0x7aa4('0x1c')](_0x48e50c)[_0x7aa4('0x2b')](_0x35e146);};}exports['index']=function(_0x499053,_0xf60fd4){var _0x598d9f={},_0x23eaf9={},_0x3054c2={'count':0x0,'rows':[]};var _0x42332c=_[_0x7aa4('0x2c')](db[_0x7aa4('0x2d')][_0x7aa4('0x2e')],function(_0x157aac){return{'name':_0x157aac['fieldName'],'type':_0x157aac[_0x7aa4('0x2f')][_0x7aa4('0x30')]};});_0x23eaf9[_0x7aa4('0x31')]=_[_0x7aa4('0x2c')](_0x42332c,_0x7aa4('0x2a'));_0x23eaf9['query']=_['keys'](_0x499053[_0x7aa4('0x32')]);_0x23eaf9[_0x7aa4('0x33')]=_[_0x7aa4('0x34')](_0x23eaf9[_0x7aa4('0x31')],_0x23eaf9[_0x7aa4('0x32')]);_0x598d9f['attributes']=_[_0x7aa4('0x34')](_0x23eaf9[_0x7aa4('0x31')],qs[_0x7aa4('0x35')](_0x499053[_0x7aa4('0x32')][_0x7aa4('0x35')]));_0x598d9f[_0x7aa4('0x36')]=_0x598d9f[_0x7aa4('0x36')]['length']?_0x598d9f[_0x7aa4('0x36')]:_0x23eaf9[_0x7aa4('0x31')];if(!_0x499053[_0x7aa4('0x32')][_0x7aa4('0x37')]('nolimit')){_0x598d9f['limit']=qs[_0x7aa4('0x20')](_0x499053[_0x7aa4('0x32')][_0x7aa4('0x20')]);_0x598d9f['offset']=qs[_0x7aa4('0x1e')](_0x499053[_0x7aa4('0x32')][_0x7aa4('0x1e')]);}_0x598d9f[_0x7aa4('0x38')]=qs[_0x7aa4('0x39')](_0x499053[_0x7aa4('0x32')][_0x7aa4('0x39')]);_0x598d9f['where']=qs[_0x7aa4('0x33')](_[_0x7aa4('0x3a')](_0x499053[_0x7aa4('0x32')],_0x23eaf9[_0x7aa4('0x33')]),_0x42332c);if(_0x499053[_0x7aa4('0x32')][_0x7aa4('0x3b')]){_0x598d9f[_0x7aa4('0x3c')]=_['merge'](_0x598d9f[_0x7aa4('0x3c')],{'$or':_['map'](_0x42332c,function(_0xa88fc2){if(_0xa88fc2['type']!==_0x7aa4('0x3d')){var _0x37fa14={};_0x37fa14[_0xa88fc2[_0x7aa4('0x2a')]]={'$like':'%'+_0x499053[_0x7aa4('0x32')][_0x7aa4('0x3b')]+'%'};return _0x37fa14;}})});}_0x598d9f=_[_0x7aa4('0x3e')]({},_0x598d9f,_0x499053[_0x7aa4('0x3f')]);var _0x106dcf={'where':_0x598d9f[_0x7aa4('0x3c')]};return db['SalesforceField']['count'](_0x106dcf)[_0x7aa4('0x26')](function(_0x1b2a5d){_0x3054c2[_0x7aa4('0x21')]=_0x1b2a5d;if(_0x499053[_0x7aa4('0x32')]['includeAll']){_0x598d9f[_0x7aa4('0x40')]=[{'all':!![]}];}return db['SalesforceField'][_0x7aa4('0x41')](_0x598d9f);})[_0x7aa4('0x26')](function(_0x271b92){_0x3054c2[_0x7aa4('0x42')]=_0x271b92;return _0x3054c2;})[_0x7aa4('0x26')](respondWithFilteredResult(_0xf60fd4,_0x598d9f))[_0x7aa4('0x43')](handleError(_0xf60fd4,null));};exports['show']=function(_0x2d2f25,_0x3f20b5){var _0x3bd343={'raw':!![],'where':{'id':_0x2d2f25[_0x7aa4('0x44')]['id']}},_0x5d4b92={};_0x5d4b92['model']=_[_0x7aa4('0x45')](db[_0x7aa4('0x2d')][_0x7aa4('0x2e')]);_0x5d4b92[_0x7aa4('0x32')]=_[_0x7aa4('0x45')](_0x2d2f25[_0x7aa4('0x32')]);_0x5d4b92[_0x7aa4('0x33')]=_[_0x7aa4('0x34')](_0x5d4b92[_0x7aa4('0x31')],_0x5d4b92[_0x7aa4('0x32')]);_0x3bd343[_0x7aa4('0x36')]=_['intersection'](_0x5d4b92[_0x7aa4('0x31')],qs[_0x7aa4('0x35')](_0x2d2f25[_0x7aa4('0x32')][_0x7aa4('0x35')]));_0x3bd343[_0x7aa4('0x36')]=_0x3bd343[_0x7aa4('0x36')][_0x7aa4('0x46')]?_0x3bd343['attributes']:_0x5d4b92[_0x7aa4('0x31')];if(_0x2d2f25['query'][_0x7aa4('0x47')]){_0x3bd343[_0x7aa4('0x40')]=[{'all':!![]}];}_0x3bd343=_[_0x7aa4('0x3e')]({},_0x3bd343,_0x2d2f25['options']);return db[_0x7aa4('0x2d')][_0x7aa4('0x48')](_0x3bd343)[_0x7aa4('0x26')](handleEntityNotFound(_0x3f20b5,null))[_0x7aa4('0x26')](respondWithResult(_0x3f20b5,null))[_0x7aa4('0x43')](handleError(_0x3f20b5,null));};exports['create']=function(_0x319ab3,_0x4815d0){return db['SalesforceField'][_0x7aa4('0x49')](_0x319ab3[_0x7aa4('0x4a')],{})[_0x7aa4('0x26')](respondWithResult(_0x4815d0,0xc9))['catch'](handleError(_0x4815d0,null));};exports['update']=function(_0x15f491,_0xf04aa7){if(_0x15f491[_0x7aa4('0x4a')]['id']){delete _0x15f491[_0x7aa4('0x4a')]['id'];}return db[_0x7aa4('0x2d')][_0x7aa4('0x48')]({'where':{'id':_0x15f491[_0x7aa4('0x44')]['id']}})[_0x7aa4('0x26')](handleEntityNotFound(_0xf04aa7,null))['then'](saveUpdates(_0x15f491[_0x7aa4('0x4a')],null))[_0x7aa4('0x26')](respondWithResult(_0xf04aa7,null))[_0x7aa4('0x43')](handleError(_0xf04aa7,null));};exports['destroy']=function(_0x59a94b,_0x575f73){return db['SalesforceField']['find']({'where':{'id':_0x59a94b[_0x7aa4('0x44')]['id']}})['then'](handleEntityNotFound(_0x575f73,null))[_0x7aa4('0x26')](removeEntity(_0x575f73,null))[_0x7aa4('0x43')](handleError(_0x575f73,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 534f6d4..1a3be15 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 _0x2308=['../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','SalesforceField','int_salesforce_fields','lodash','util'];(function(_0x2cc0b3,_0x120bf1){var _0x1667ef=function(_0x3abcb4){while(--_0x3abcb4){_0x2cc0b3['push'](_0x2cc0b3['shift']());}};_0x1667ef(++_0x120bf1);}(_0x2308,0x76));var _0x8230=function(_0x15bc81,_0x4d4f77){_0x15bc81=_0x15bc81-0x0;var _0x59440e=_0x2308[_0x15bc81];return _0x59440e;};'use strict';var _=require(_0x8230('0x0'));var util=require(_0x8230('0x1'));var logger=require(_0x8230('0x2'))('api');var moment=require('moment');var BPromise=require(_0x8230('0x3'));var rp=require(_0x8230('0x4'));var fs=require('fs');var path=require(_0x8230('0x5'));var rimraf=require(_0x8230('0x6'));var config=require(_0x8230('0x7'));var attributes=require('./intSalesforceField.attributes');module[_0x8230('0x8')]=function(_0x355f6b,_0x560068){return _0x355f6b[_0x8230('0x9')](_0x8230('0xa'),attributes,{'tableName':_0x8230('0xb'),'paranoid':![],'indexes':[{'name':'salesforce_unique_index','fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf419=['exports','define','SalesforceField','salesforce_unique_index','idField','FieldId','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intSalesforceField.attributes'];(function(_0x2aefa3,_0x45f6c4){var _0x13394f=function(_0x27471d){while(--_0x27471d){_0x2aefa3['push'](_0x2aefa3['shift']());}};_0x13394f(++_0x45f6c4);}(_0xf419,0xf6));var _0x9f41=function(_0x4f45b9,_0x53ed88){_0x4f45b9=_0x4f45b9-0x0;var _0x50313=_0xf419[_0x4f45b9];return _0x50313;};'use strict';var _=require('lodash');var util=require(_0x9f41('0x0'));var logger=require(_0x9f41('0x1'))(_0x9f41('0x2'));var moment=require(_0x9f41('0x3'));var BPromise=require('bluebird');var rp=require(_0x9f41('0x4'));var fs=require('fs');var path=require(_0x9f41('0x5'));var rimraf=require(_0x9f41('0x6'));var config=require(_0x9f41('0x7'));var attributes=require(_0x9f41('0x8'));module[_0x9f41('0x9')]=function(_0x4eeade,_0xf51293){return _0x4eeade[_0x9f41('0xa')](_0x9f41('0xb'),attributes,{'tableName':'int_salesforce_fields','paranoid':![],'indexes':[{'name':_0x9f41('0xc'),'fields':[_0x9f41('0xd'),_0x9f41('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.rpc.js b/server/api/intSalesforceField/intSalesforceField.rpc.js index 479a728..b36cb27 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 _0xb20a=['request\x20sent','error','code','message','result','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','then','SalesforceField,\x20%s,\x20%s','debug','SalesforceField,\x20%s,\x20%s,\x20%s'];(function(_0x1ebe9a,_0x2ae134){var _0x2f2ed2=function(_0x4857be){while(--_0x4857be){_0x1ebe9a['push'](_0x1ebe9a['shift']());}};_0x2f2ed2(++_0x2ae134);}(_0xb20a,0x1e0));var _0xab20=function(_0x7e2eb0,_0x17cd58){_0x7e2eb0=_0x7e2eb0-0x0;var _0xd92de4=_0xb20a[_0x7e2eb0];return _0xd92de4;};'use strict';var _=require(_0xab20('0x0'));var util=require(_0xab20('0x1'));var moment=require('moment');var BPromise=require(_0xab20('0x2'));var rs=require(_0xab20('0x3'));var fs=require('fs');var Redis=require(_0xab20('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xab20('0x5'));var logger=require(_0xab20('0x6'))(_0xab20('0x7'));var config=require(_0xab20('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xab20('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x34cd06,_0x45290c,_0x5bb600){return new BPromise(function(_0x374ee7,_0x9605c2){return client['request'](_0x34cd06,_0x5bb600)[_0xab20('0xa')](function(_0x36966b){logger['info'](_0xab20('0xb'),_0x45290c,'request\x20sent');logger[_0xab20('0xc')](_0xab20('0xd'),_0x45290c,_0xab20('0xe'),JSON['stringify'](_0x36966b));if(_0x36966b['error']){if(_0x36966b[_0xab20('0xf')][_0xab20('0x10')]===0x1f4){logger[_0xab20('0xf')]('SalesforceField,\x20%s,\x20%s',_0x45290c,_0x36966b[_0xab20('0xf')][_0xab20('0x11')]);return _0x9605c2(_0x36966b[_0xab20('0xf')][_0xab20('0x11')]);}logger[_0xab20('0xf')](_0xab20('0xb'),_0x45290c,_0x36966b[_0xab20('0xf')]['message']);return _0x374ee7(_0x36966b[_0xab20('0xf')]['message']);}else{logger['info']('SalesforceField,\x20%s,\x20%s',_0x45290c,_0xab20('0xe'));_0x374ee7(_0x36966b[_0xab20('0x12')][_0xab20('0x11')]);}})['catch'](function(_0x2040e4){logger[_0xab20('0xf')](_0xab20('0xb'),_0x45290c,_0x2040e4);_0x9605c2(_0x2040e4);});});} \ No newline at end of file +var _0x427a=['jayson/promise','client','http','then','info','request\x20sent','SalesforceField,\x20%s,\x20%s,\x20%s','error','SalesforceField,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x243b43,_0x2fbd2f){var _0x408b66=function(_0x174f6e){while(--_0x174f6e){_0x243b43['push'](_0x243b43['shift']());}};_0x408b66(++_0x2fbd2f);}(_0x427a,0x9e));var _0xa427=function(_0x319676,_0x1ad06a){_0x319676=_0x319676-0x0;var _0x143d3a=_0x427a[_0x319676];return _0x143d3a;};'use strict';var _=require(_0xa427('0x0'));var util=require(_0xa427('0x1'));var moment=require(_0xa427('0x2'));var BPromise=require(_0xa427('0x3'));var rs=require(_0xa427('0x4'));var fs=require('fs');var Redis=require(_0xa427('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xa427('0x6'));var logger=require(_0xa427('0x7'))(_0xa427('0x8'));var config=require(_0xa427('0x9'));var jayson=require(_0xa427('0xa'));var client=jayson[_0xa427('0xb')][_0xa427('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5a2ea7,_0x2f2cd4,_0x30a56a){return new BPromise(function(_0x48ab3a,_0x5a7975){return client['request'](_0x5a2ea7,_0x30a56a)[_0xa427('0xd')](function(_0x38e600){logger[_0xa427('0xe')]('SalesforceField,\x20%s,\x20%s',_0x2f2cd4,_0xa427('0xf'));logger['debug'](_0xa427('0x10'),_0x2f2cd4,_0xa427('0xf'),JSON['stringify'](_0x38e600));if(_0x38e600[_0xa427('0x11')]){if(_0x38e600['error']['code']===0x1f4){logger[_0xa427('0x11')](_0xa427('0x12'),_0x2f2cd4,_0x38e600[_0xa427('0x11')][_0xa427('0x13')]);return _0x5a7975(_0x38e600[_0xa427('0x11')][_0xa427('0x13')]);}logger['error'](_0xa427('0x12'),_0x2f2cd4,_0x38e600[_0xa427('0x11')][_0xa427('0x13')]);return _0x48ab3a(_0x38e600[_0xa427('0x11')][_0xa427('0x13')]);}else{logger[_0xa427('0xe')]('SalesforceField,\x20%s,\x20%s',_0x2f2cd4,_0xa427('0xf'));_0x48ab3a(_0x38e600[_0xa427('0x14')][_0xa427('0x13')]);}})['catch'](function(_0x1020de){logger[_0xa427('0x11')]('SalesforceField,\x20%s,\x20%s',_0x2f2cd4,_0x1020de);_0x5a7975(_0x1020de);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 6f0eb5f..794c827 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 _0x2bdb=['post','create','addConfiguration','put','/:id','delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','get','isAuthenticated','index','/:id/configurations','getConfigurations','/:id/fields','getFields'];(function(_0x5bd151,_0x4d80e9){var _0x57b703=function(_0x9d3ed6){while(--_0x9d3ed6){_0x5bd151['push'](_0x5bd151['shift']());}};_0x57b703(++_0x4d80e9);}(_0x2bdb,0x105));var _0xb2bd=function(_0x5ae040,_0x22a074){_0x5ae040=_0x5ae040-0x0;var _0xd5a656=_0x2bdb[_0x5ae040];return _0xd5a656;};'use strict';var multer=require(_0xb2bd('0x0'));var util=require('util');var path=require(_0xb2bd('0x1'));var timeout=require('connect-timeout');var express=require(_0xb2bd('0x2'));var router=express[_0xb2bd('0x3')]();var fs_extra=require(_0xb2bd('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xb2bd('0x5'));var config=require(_0xb2bd('0x6'));var controller=require(_0xb2bd('0x7'));router[_0xb2bd('0x8')]('/',auth[_0xb2bd('0x9')](),controller[_0xb2bd('0xa')]);router[_0xb2bd('0x8')]('/:id',auth[_0xb2bd('0x9')](),controller['show']);router[_0xb2bd('0x8')](_0xb2bd('0xb'),auth[_0xb2bd('0x9')](),controller[_0xb2bd('0xc')]);router[_0xb2bd('0x8')](_0xb2bd('0xd'),auth[_0xb2bd('0x9')](),controller[_0xb2bd('0xe')]);router[_0xb2bd('0xf')]('/',auth['isAuthenticated'](),controller[_0xb2bd('0x10')]);router[_0xb2bd('0xf')](_0xb2bd('0xb'),auth[_0xb2bd('0x9')](),controller[_0xb2bd('0x11')]);router[_0xb2bd('0x12')](_0xb2bd('0x13'),auth[_0xb2bd('0x9')](),controller['update']);router[_0xb2bd('0x14')]('/:id',auth[_0xb2bd('0x9')](),controller[_0xb2bd('0x15')]);module[_0xb2bd('0x16')]=router; \ No newline at end of file +var _0x0662=['getFields','create','post','addConfiguration','put','update','delete','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields'];(function(_0x4d28e0,_0x497df7){var _0x469f28=function(_0x3a75c0){while(--_0x3a75c0){_0x4d28e0['push'](_0x4d28e0['shift']());}};_0x469f28(++_0x497df7);}(_0x0662,0x175));var _0x2066=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x0662[_0x6131cd];return _0x47e916;};'use strict';var multer=require('multer');var util=require(_0x2066('0x0'));var path=require(_0x2066('0x1'));var timeout=require(_0x2066('0x2'));var express=require(_0x2066('0x3'));var router=express['Router']();var fs_extra=require(_0x2066('0x4'));var auth=require(_0x2066('0x5'));var interaction=require(_0x2066('0x6'));var config=require(_0x2066('0x7'));var controller=require(_0x2066('0x8'));router[_0x2066('0x9')]('/',auth[_0x2066('0xa')](),controller[_0x2066('0xb')]);router[_0x2066('0x9')](_0x2066('0xc'),auth[_0x2066('0xa')](),controller[_0x2066('0xd')]);router[_0x2066('0x9')](_0x2066('0xe'),auth[_0x2066('0xa')](),controller[_0x2066('0xf')]);router[_0x2066('0x9')](_0x2066('0x10'),auth[_0x2066('0xa')](),controller[_0x2066('0x11')]);router['post']('/',auth[_0x2066('0xa')](),controller[_0x2066('0x12')]);router[_0x2066('0x13')](_0x2066('0xe'),auth[_0x2066('0xa')](),controller[_0x2066('0x14')]);router[_0x2066('0x15')](_0x2066('0xc'),auth[_0x2066('0xa')](),controller[_0x2066('0x16')]);router[_0x2066('0x17')](_0x2066('0xc'),auth[_0x2066('0xa')](),controller[_0x2066('0x18')]);module[_0x2066('0x19')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index 79b5b9f..85d49e3 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 _0x5c00=['sequelize','STRING'];(function(_0xfad241,_0x30e2e0){var _0x5686d2=function(_0x4267be){while(--_0x4267be){_0xfad241['push'](_0xfad241['shift']());}};_0x5686d2(++_0x30e2e0);}(_0x5c00,0x15c));var _0x05c0=function(_0xd4636c,_0x34dbf6){_0xd4636c=_0xd4636c-0x0;var _0x5ee17d=_0x5c00[_0xd4636c];return _0x5ee17d;};'use strict';var Sequelize=require(_0x05c0('0x0'));module['exports']={'name':{'type':Sequelize[_0x05c0('0x1')]},'description':{'type':Sequelize[_0x05c0('0x1')]},'username':{'type':Sequelize[_0x05c0('0x1')],'unique':'username'},'password':{'type':Sequelize[_0x05c0('0x1')]},'email':{'type':Sequelize[_0x05c0('0x1')]},'remoteUri':{'type':Sequelize[_0x05c0('0x1')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x05c0('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x5f5f=['STRING','remoteUri','sequelize'];(function(_0x1250b1,_0x1d1b40){var _0x2fb96f=function(_0x51a85f){while(--_0x51a85f){_0x1250b1['push'](_0x1250b1['shift']());}};_0x2fb96f(++_0x1d1b40);}(_0x5f5f,0xd4));var _0xf5f5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5f5f[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xf5f5('0x0'));module['exports']={'name':{'type':Sequelize[_0xf5f5('0x1')]},'description':{'type':Sequelize[_0xf5f5('0x1')]},'username':{'type':Sequelize[_0xf5f5('0x1')],'unique':'username'},'password':{'type':Sequelize[_0xf5f5('0x1')]},'email':{'type':Sequelize[_0xf5f5('0x1')]},'remoteUri':{'type':Sequelize[_0xf5f5('0x1')],'unique':_0xf5f5('0x2')},'serverUrl':{'type':Sequelize[_0xf5f5('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 4d67aaa..61dc4a2 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 _0x1354=['name','send','index','map','ServicenowAccount','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','where','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','merge','create','body','find','destroy','findOne','keys','order','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','ServicenowConfiguration','ServicenowField','getFields','made_sla','hold_reason','knowledge','notify','incident_state','category','parent','watch_list','sys_updated_on','child_incidents','number','resolved_by','sys_updated_by','user_input','sys_created_on','sys_domain','state','sys_created_by','cmdb_ci','work_notes_list','business_service','priority','sys_domain_path','rfc','time_worked','expected_start','business_duration','group_list','work_end','reopened_time','resolved_at','caller_id','approval_set','subcategory','short_description','close_code','correlation_display','delivery_task','work_start','assignment_group','business_stc','additional_assignee_list','description','calendar_duration','close_notes','closed_by','follow_up','parent_incident','sys_id','contact_type','urgency','problem_id','company','reassignment_count','activity_due','assigned_to','severity','comments','sla_due','approval','comments_and_work_notes','due_date','sys_mod_count','escalation','upon_approval','correlation_id','location','username','password','email','remoteUri','serverUrl','slice','substring','lastIndexOf','format','%s/api/now/doc/table/schema/','%s/api/now/table/','GET','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','assign','remove','includes','internalType','label','push','all','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','forEach','concat','ServiceNow\x20error:\x20','test','statusCode','Wrong\x20credentials','boolean','True','true','False','false','value','rimraf','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','fs-extra','squel','crypto','jsforce','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','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','end','error','stack'];(function(_0x192174,_0x471548){var _0x22afe5=function(_0x215a3f){while(--_0x215a3f){_0x192174['push'](_0x192174['shift']());}};_0x22afe5(++_0x471548);}(_0x1354,0x99));var _0x4135=function(_0x16765f,_0x3dd736){_0x16765f=_0x16765f-0x0;var _0x1326d4=_0x1354[_0x16765f];return _0x1326d4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4135('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4135('0x1'));var rp=require(_0x4135('0x2'));var moment=require(_0x4135('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x4135('0x4'));var util=require(_0x4135('0x5'));var path=require('path');var sox=require(_0x4135('0x6'));var csv=require(_0x4135('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4135('0x8'));var _=require('lodash');var squel=require(_0x4135('0x9'));var crypto=require(_0x4135('0xa'));var jsforce=require(_0x4135('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x4135('0xc'));var Papa=require(_0x4135('0xd'));var Redis=require('ioredis');var authService=require(_0x4135('0xe'));var qs=require(_0x4135('0xf'));var as=require(_0x4135('0x10'));var hardwareService=require(_0x4135('0x11'));var logger=require(_0x4135('0x12'))(_0x4135('0x13'));var utils=require(_0x4135('0x14'));var config=require(_0x4135('0x15'));var licenseUtil=require(_0x4135('0x16'));var db=require(_0x4135('0x17'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x41464e,_0x4e8eb5){_0x4e8eb5=_0x4e8eb5||0xcc;return function(_0x208120){if(_0x208120){return _0x41464e[_0x4135('0x18')](_0x4e8eb5);}return _0x41464e[_0x4135('0x19')](_0x4e8eb5)['end']();};}function respondWithResult(_0x28d713,_0x234625){_0x234625=_0x234625||0xc8;return function(_0xb1e948){if(_0xb1e948){return _0x28d713[_0x4135('0x19')](_0x234625)['json'](_0xb1e948);}};}function respondWithFilteredResult(_0x840bd3,_0x34455a){return function(_0x543019){if(_0x543019){var _0x1569ec=typeof _0x34455a[_0x4135('0x1a')]===_0x4135('0x1b')&&typeof _0x34455a[_0x4135('0x1c')]===_0x4135('0x1b');var _0x567397=_0x543019[_0x4135('0x1d')];var _0x5c9dec=_0x1569ec?0x0:_0x34455a['offset'];var _0x12b751=_0x1569ec?_0x543019['count']:_0x34455a['offset']+_0x34455a[_0x4135('0x1c')];var _0x5d4c2f;if(_0x12b751>=_0x567397){_0x12b751=_0x567397;_0x5d4c2f=0xc8;}else{_0x5d4c2f=0xce;}_0x840bd3['status'](_0x5d4c2f);return _0x840bd3['set'](_0x4135('0x1e'),_0x5c9dec+'-'+_0x12b751+'/'+_0x567397)['json'](_0x543019);}return null;};}function patchUpdates(_0x463b38){return function(_0x43c5c8){try{jsonpatch[_0x4135('0x1f')](_0x43c5c8,_0x463b38,!![]);}catch(_0x44c167){return BPromise[_0x4135('0x20')](_0x44c167);}return _0x43c5c8[_0x4135('0x21')]();};}function saveUpdates(_0x70e97c,_0x1c237e){return function(_0x48f735){if(_0x48f735){return _0x48f735[_0x4135('0x22')](_0x70e97c)[_0x4135('0x23')](function(_0x329814){return _0x329814;});}return null;};}function removeEntity(_0x1087f9,_0x124c65){return function(_0x31af93){if(_0x31af93){return _0x31af93['destroy']()[_0x4135('0x23')](function(){_0x1087f9[_0x4135('0x19')](0xcc)[_0x4135('0x24')]();});}};}function handleEntityNotFound(_0x4bf0df,_0x2eb590){return function(_0x5c58da){if(!_0x5c58da){_0x4bf0df[_0x4135('0x18')](0x194);}return _0x5c58da;};}function handleError(_0x2b1230,_0x332a9f){_0x332a9f=_0x332a9f||0x1f4;return function(_0x9da506){logger[_0x4135('0x25')](_0x9da506[_0x4135('0x26')]);if(_0x9da506[_0x4135('0x27')]){delete _0x9da506['name'];}_0x2b1230[_0x4135('0x19')](_0x332a9f)[_0x4135('0x28')](_0x9da506);};}exports[_0x4135('0x29')]=function(_0x4820f3,_0x3dae37){var _0x1371cd={},_0x338099={},_0x570449={'count':0x0,'rows':[]};var _0x1690f3=_[_0x4135('0x2a')](db[_0x4135('0x2b')][_0x4135('0x2c')],function(_0x41d3ca){return{'name':_0x41d3ca[_0x4135('0x2d')],'type':_0x41d3ca[_0x4135('0x2e')][_0x4135('0x2f')]};});_0x338099[_0x4135('0x30')]=_[_0x4135('0x2a')](_0x1690f3,_0x4135('0x27'));_0x338099[_0x4135('0x31')]=_['keys'](_0x4820f3[_0x4135('0x31')]);_0x338099[_0x4135('0x32')]=_[_0x4135('0x33')](_0x338099[_0x4135('0x30')],_0x338099['query']);_0x1371cd[_0x4135('0x34')]=_[_0x4135('0x33')](_0x338099['model'],qs[_0x4135('0x35')](_0x4820f3[_0x4135('0x31')][_0x4135('0x35')]));_0x1371cd[_0x4135('0x34')]=_0x1371cd[_0x4135('0x34')][_0x4135('0x36')]?_0x1371cd['attributes']:_0x338099[_0x4135('0x30')];if(!_0x4820f3['query'][_0x4135('0x37')](_0x4135('0x38'))){_0x1371cd[_0x4135('0x1c')]=qs['limit'](_0x4820f3['query'][_0x4135('0x1c')]);_0x1371cd[_0x4135('0x1a')]=qs[_0x4135('0x1a')](_0x4820f3[_0x4135('0x31')][_0x4135('0x1a')]);}_0x1371cd['order']=qs['sort'](_0x4820f3[_0x4135('0x31')][_0x4135('0x39')]);_0x1371cd['where']=qs['filters'](_[_0x4135('0x3a')](_0x4820f3['query'],_0x338099['filters']),_0x1690f3);if(_0x4820f3[_0x4135('0x31')]['filter']){_0x1371cd[_0x4135('0x3b')]=_['merge'](_0x1371cd[_0x4135('0x3b')],{'$or':_['map'](_0x1690f3,function(_0x8d2ecc){if(_0x8d2ecc['type']!==_0x4135('0x3c')){var _0x5d21a4={};_0x5d21a4[_0x8d2ecc[_0x4135('0x27')]]={'$like':'%'+_0x4820f3[_0x4135('0x31')][_0x4135('0x3d')]+'%'};return _0x5d21a4;}})});}_0x1371cd=_['merge']({},_0x1371cd,_0x4820f3[_0x4135('0x3e')]);var _0x48dadd={'where':_0x1371cd[_0x4135('0x3b')]};return db[_0x4135('0x2b')][_0x4135('0x1d')](_0x48dadd)[_0x4135('0x23')](function(_0x175847){_0x570449[_0x4135('0x1d')]=_0x175847;if(_0x4820f3[_0x4135('0x31')][_0x4135('0x3f')]){_0x1371cd[_0x4135('0x40')]=[{'all':!![]}];}return db[_0x4135('0x2b')][_0x4135('0x41')](_0x1371cd);})[_0x4135('0x23')](function(_0x223096){_0x570449[_0x4135('0x42')]=_0x223096;return _0x570449;})[_0x4135('0x23')](respondWithFilteredResult(_0x3dae37,_0x1371cd))[_0x4135('0x43')](handleError(_0x3dae37,null));};exports[_0x4135('0x44')]=function(_0x5d86f7,_0x57e53a){var _0x1be999={'raw':![],'where':{'id':_0x5d86f7[_0x4135('0x45')]['id']}},_0x3170a4={};_0x3170a4[_0x4135('0x30')]=_['keys'](db[_0x4135('0x2b')][_0x4135('0x2c')]);_0x3170a4[_0x4135('0x31')]=_['keys'](_0x5d86f7[_0x4135('0x31')]);_0x3170a4['filters']=_[_0x4135('0x33')](_0x3170a4[_0x4135('0x30')],_0x3170a4['query']);_0x1be999[_0x4135('0x34')]=_[_0x4135('0x33')](_0x3170a4[_0x4135('0x30')],qs[_0x4135('0x35')](_0x5d86f7[_0x4135('0x31')][_0x4135('0x35')]));_0x1be999[_0x4135('0x34')]=_0x1be999['attributes'][_0x4135('0x36')]?_0x1be999['attributes']:_0x3170a4[_0x4135('0x30')];if(_0x5d86f7['query'][_0x4135('0x3f')]){_0x1be999[_0x4135('0x40')]=[{'all':!![]}];}_0x1be999=_[_0x4135('0x46')]({},_0x1be999,_0x5d86f7[_0x4135('0x3e')]);return db[_0x4135('0x2b')]['find'](_0x1be999)[_0x4135('0x23')](handleEntityNotFound(_0x57e53a,null))[_0x4135('0x23')](respondWithResult(_0x57e53a,null))[_0x4135('0x43')](handleError(_0x57e53a,null));};exports[_0x4135('0x47')]=function(_0x1a7048,_0x6bd80b){return db['ServicenowAccount'][_0x4135('0x47')](_0x1a7048[_0x4135('0x48')],{})[_0x4135('0x23')](respondWithResult(_0x6bd80b,0xc9))[_0x4135('0x43')](handleError(_0x6bd80b,null));};exports[_0x4135('0x22')]=function(_0x363907,_0x3da225){if(_0x363907['body']['id']){delete _0x363907[_0x4135('0x48')]['id'];}return db['ServicenowAccount'][_0x4135('0x49')]({'where':{'id':_0x363907[_0x4135('0x45')]['id']}})[_0x4135('0x23')](handleEntityNotFound(_0x3da225,null))[_0x4135('0x23')](saveUpdates(_0x363907[_0x4135('0x48')],null))[_0x4135('0x23')](respondWithResult(_0x3da225,null))[_0x4135('0x43')](handleError(_0x3da225,null));};exports[_0x4135('0x4a')]=function(_0x39a366,_0x5cdead){return db[_0x4135('0x2b')]['find']({'where':{'id':_0x39a366[_0x4135('0x45')]['id']}})[_0x4135('0x23')](handleEntityNotFound(_0x5cdead,null))[_0x4135('0x23')](removeEntity(_0x5cdead,null))[_0x4135('0x43')](handleError(_0x5cdead,null));};exports['getConfigurations']=function(_0x565a3d,_0x8919e,_0x2258dd){var _0x4f5e85={};var _0x3fcf34={};var _0x25c683;var _0x144b7b;return db['ServicenowAccount'][_0x4135('0x4b')]({'where':{'id':_0x565a3d[_0x4135('0x45')]['id']}})[_0x4135('0x23')](handleEntityNotFound(_0x8919e,null))['then'](function(_0x4d4df4){if(_0x4d4df4){_0x25c683=_0x4d4df4;_0x3fcf34[_0x4135('0x30')]=_[_0x4135('0x4c')](db['ServicenowConfiguration']['rawAttributes']);_0x3fcf34['query']=_[_0x4135('0x4c')](_0x565a3d[_0x4135('0x31')]);_0x3fcf34['filters']=_[_0x4135('0x33')](_0x3fcf34[_0x4135('0x30')],_0x3fcf34['query']);_0x4f5e85['attributes']=_[_0x4135('0x33')](_0x3fcf34[_0x4135('0x30')],qs[_0x4135('0x35')](_0x565a3d[_0x4135('0x31')][_0x4135('0x35')]));_0x4f5e85['attributes']=_0x4f5e85['attributes'][_0x4135('0x36')]?_0x4f5e85[_0x4135('0x34')]:_0x3fcf34[_0x4135('0x30')];_0x4f5e85[_0x4135('0x4d')]=qs['sort'](_0x565a3d[_0x4135('0x31')]['sort']);_0x4f5e85[_0x4135('0x3b')]=qs[_0x4135('0x32')](_['pick'](_0x565a3d['query'],_0x3fcf34[_0x4135('0x32')]));if(_0x565a3d[_0x4135('0x31')][_0x4135('0x3d')]){_0x4f5e85[_0x4135('0x3b')]=_[_0x4135('0x46')](_0x4f5e85[_0x4135('0x3b')],{'$or':_['map'](_0x4f5e85['attributes'],function(_0x293f63){var _0x4e2fe7={};_0x4e2fe7[_0x293f63]={'$like':'%'+_0x565a3d[_0x4135('0x31')][_0x4135('0x3d')]+'%'};return _0x4e2fe7;})});}_0x4f5e85=_['merge']({},_0x4f5e85,_0x565a3d[_0x4135('0x3e')]);return _0x25c683[_0x4135('0x4e')](_0x4f5e85);}})[_0x4135('0x23')](function(_0x1a8225){if(_0x1a8225){_0x144b7b=_0x1a8225[_0x4135('0x36')];if(!_0x565a3d[_0x4135('0x31')][_0x4135('0x37')](_0x4135('0x38'))){_0x4f5e85['limit']=qs[_0x4135('0x1c')](_0x565a3d['query'][_0x4135('0x1c')]);_0x4f5e85['offset']=qs[_0x4135('0x1a')](_0x565a3d['query']['offset']);}return _0x25c683[_0x4135('0x4e')](_0x4f5e85);}})['then'](function(_0x10f465){if(_0x10f465){return _0x10f465?{'count':_0x144b7b,'rows':_0x10f465}:null;}})[_0x4135('0x23')](respondWithResult(_0x8919e,null))['catch'](handleError(_0x8919e,null));};exports[_0x4135('0x4f')]=function(_0x18198a,_0x13ead7,_0x2063fb){if(_0x18198a[_0x4135('0x48')]['id']){delete _0x18198a['body']['id'];}return db[_0x4135('0x2b')][_0x4135('0x4b')]({'where':{'id':_0x18198a[_0x4135('0x45')]['id']}})['then'](handleEntityNotFound(_0x13ead7,null))['then'](function(_0x5e6c71){if(_0x5e6c71){_0x18198a['body'][_0x4135('0x50')]=_0x5e6c71['id'];_0x18198a[_0x4135('0x48')][_0x4135('0x51')]=integrations[_0x4135('0x52')](_0x18198a[_0x4135('0x48')]['channel'],_0x18198a[_0x4135('0x48')]['type']);_0x18198a[_0x4135('0x48')][_0x4135('0x53')]=integrations[_0x4135('0x54')](_0x18198a[_0x4135('0x48')][_0x4135('0x55')],_0x18198a[_0x4135('0x48')]['type']);return db[_0x4135('0x56')][_0x4135('0x47')](_0x18198a[_0x4135('0x48')],{'include':[{'model':db[_0x4135('0x57')],'as':'Subjects'},{'model':db[_0x4135('0x57')],'as':_0x4135('0x53')}]});}return null;})[_0x4135('0x23')](respondWithResult(_0x13ead7,null))['catch'](handleError(_0x13ead7,null));};exports[_0x4135('0x58')]=function(_0x295109,_0x269aad,_0x3a8b5f){var _0x237dc8=[_0x4135('0x59'),_0x4135('0x5a'),_0x4135('0x5b'),'subcategory','close_code',_0x4135('0x5c'),_0x4135('0x5d'),'severity',_0x4135('0x5e')];var _0x4d8fc5=[_0x4135('0x5f'),_0x4135('0x59'),'caused_by',_0x4135('0x60'),'upon_reject',_0x4135('0x61'),_0x4135('0x62'),_0x4135('0x5a'),'approval_history',_0x4135('0x63'),_0x4135('0x64'),_0x4135('0x65'),'opened_by',_0x4135('0x66'),_0x4135('0x67'),_0x4135('0x68'),_0x4135('0x69'),_0x4135('0x6a'),_0x4135('0x5b'),_0x4135('0x4d'),'calendar_stc','closed_at',_0x4135('0x6b'),'delivery_plan','impact','active',_0x4135('0x6c'),_0x4135('0x6d'),_0x4135('0x6e'),_0x4135('0x6f'),_0x4135('0x70'),_0x4135('0x71'),_0x4135('0x72'),'opened_at',_0x4135('0x73'),_0x4135('0x74'),_0x4135('0x75'),_0x4135('0x76'),_0x4135('0x77'),_0x4135('0x78'),_0x4135('0x79'),_0x4135('0x7a'),'work_notes',_0x4135('0x7b'),_0x4135('0x7c'),_0x4135('0x7d'),_0x4135('0x7e'),_0x4135('0x7f'),_0x4135('0x80'),_0x4135('0x81'),_0x4135('0x82'),_0x4135('0x83'),_0x4135('0x84'),_0x4135('0x5c'),'sys_class_name',_0x4135('0x85'),_0x4135('0x86'),_0x4135('0x87'),_0x4135('0x88'),_0x4135('0x89'),_0x4135('0x8a'),'reopened_by',_0x4135('0x5d'),_0x4135('0x8b'),_0x4135('0x8c'),_0x4135('0x8d'),_0x4135('0x8e'),_0x4135('0x8f'),_0x4135('0x90'),_0x4135('0x91'),_0x4135('0x92'),_0x4135('0x93'),_0x4135('0x94'),_0x4135('0x95'),_0x4135('0x96'),_0x4135('0x97'),'reopen_count','sys_tags',_0x4135('0x98'),_0x4135('0x99'),_0x4135('0x9a'),_0x4135('0x9b'),'category'];var _0x37d924='';var _0x1b5533='';var _0xdd7fee=[];var _0x17fef8='';var _0x4e46f1='';var _0x15d44e=[];var _0x5c2971='';var _0x71536d='';var _0x2f0b71={};var _0x2725bf='';return db[_0x4135('0x2b')][_0x4135('0x4b')]({'where':{'id':_0x295109['params']['id']},'attributes':['id',_0x4135('0x9c'),_0x4135('0x9d'),_0x4135('0x9e'),_0x4135('0x9f'),_0x4135('0xa0')]})[_0x4135('0x23')](handleEntityNotFound(_0x269aad,null))[_0x4135('0x23')](function(_0x38d246){if(_0x38d246){_0x2725bf=_0x38d246['remoteUri'];var _0x5e2cb0=_0x2725bf[_0x4135('0xa1')](-0x1);if(_0x5e2cb0==='/'){_0x2725bf=_0x2725bf[_0x4135('0xa2')](0x0,_0x2725bf[_0x4135('0xa3')](_0x5e2cb0));}_0x71536d=util[_0x4135('0xa4')](_0x4135('0xa5'),_0x2725bf);_0x5c2971=util['format'](_0x4135('0xa6'),_0x2725bf);_0x2f0b71={'user':_0x38d246[_0x4135('0x9c')],'pass':_0x38d246['password']};var _0x304138={'method':_0x4135('0xa7'),'uri':_0x71536d+_0x4135('0xa8'),'auth':_0x2f0b71,'json':!![]};return rp(_0x304138);}})[_0x4135('0x23')](function(_0x15c2af){if(_0x15c2af['result'][_0x4135('0x36')]>0x0){_0x37d924=_0x15c2af[_0x4135('0xa9')];}console[_0x4135('0xaa')](_0x4135('0xab'),_0x37d924);_0x15d44e=[];_0x1b5533=Object[_0x4135('0xac')]([],_0x37d924);_[_0x4135('0xad')](_0x1b5533,function(_0x2d2874){return!_0x237dc8[_0x4135('0xae')](_0x2d2874[_0x4135('0x27')]);});_0x1b5533['forEach'](function(_0x3e91be){var _0xf03e14=createFieldObject(_0x5c2971,_0x2f0b71,_0x3e91be[_0x4135('0xaf')],_0x3e91be[_0x4135('0x27')],_0x3e91be[_0x4135('0xb0')],![]);_0x15d44e[_0x4135('0xb1')](_0xf03e14);});return Promise[_0x4135('0xb2')](_0x15d44e);})[_0x4135('0x23')](function(_0x5922aa){_0xdd7fee=_0x5922aa;_0x17fef8=Object[_0x4135('0xac')]([],_0x37d924);console[_0x4135('0xaa')]('TCL:\x20_object',_0x37d924);_[_0x4135('0xad')](_0x17fef8,function(_0x2668f8){return _0x4d8fc5[_0x4135('0xae')](_0x2668f8[_0x4135('0x27')]);});console[_0x4135('0xaa')](_0x4135('0xb3'),_0x17fef8);_0x15d44e=[];_0x17fef8[_0x4135('0xb4')](function(_0x287496){var _0x562347=createFieldObject(_0x5c2971,_0x2f0b71,_0x287496['internalType'],_0x287496[_0x4135('0x27')],_0x287496['label'],!![]);_0x15d44e['push'](_0x562347);});return Promise['all'](_0x15d44e);})['then'](function(_0x1c1daa){_0x4e46f1=_0x1c1daa;var _0x1fa282=_0xdd7fee[_0x4135('0xb5')](_0x4e46f1);return{'count':_0x1fa282[_0x4135('0x36')],'rows':_0x1fa282};})['then'](respondWithResult(_0x269aad,null))['catch'](function(_0x5f544a){console[_0x4135('0xaa')](_0x4135('0xb6')+_0x5f544a);var _0x2c44d1=_0x295109[_0x4135('0x31')][_0x4135('0xb7')]?0x1f4:_0x5f544a[_0x4135('0xb8')]||0x1f4;logger[_0x4135('0x25')](_0x5f544a[_0x4135('0x26')]);delete _0x5f544a[_0x4135('0x27')];if(_0x2c44d1===0x191){_0x2c44d1=0x190;}_0x269aad[_0x4135('0x19')](_0x2c44d1)['send'](_0x295109[_0x4135('0x31')][_0x4135('0xb7')]?{'message':_0x4135('0xb9'),'statusCode':_0x5f544a[_0x4135('0xb8')]}:_0x5f544a);});};function createFieldObject(_0x1ef1f6,_0x4cf7d9,_0x4e544b,_0x48e55c,_0x436e2c,_0x51c54a){return new Promise(function(_0x444e83,_0x5b5a66){var _0x4e19aa={'id':_0x48e55c,'name':_0x436e2c,'custom':_0x51c54a};if(_0x4e544b===_0x4135('0xba')){_0x4e19aa[_0x4135('0x3e')]=[{'name':_0x4135('0xbb'),'value':_0x4135('0xbc')},{'name':_0x4135('0xbd'),'value':_0x4135('0xbe')}];_0x444e83(_0x4e19aa);}else{var _0xe269d7={'method':_0x4135('0xa7'),'uri':_0x1ef1f6+'sys_choice?sysparm_query=name=incident^element='+_0x48e55c,'auth':_0x4cf7d9,'json':!![]};return rp(_0xe269d7)[_0x4135('0x23')](function(_0x3bc495){var _0x30290d=[];if(_0x3bc495[_0x4135('0xa9')][_0x4135('0x36')]>0x0){_0x3bc495[_0x4135('0xa9')][_0x4135('0xb4')](function(_0x436fa9){if(_0x436fa9['inactive']===_0x4135('0xbe')){var _0x202c0a={'name':_0x436fa9[_0x4135('0xb0')],'value':_0x436fa9[_0x4135('0xbf')]};_0x30290d['push'](_0x202c0a);}});}_0x4e19aa['options']=_0x30290d;if(_0x4e19aa['options'][_0x4135('0x36')]>0x0){_0x444e83(_0x4e19aa);}else{if(_0x51c54a==![]){_0x444e83();}else{_0x444e83(_0x4e19aa);}}});}});} \ No newline at end of file +var _0x4e87=['work_notes','short_description','correlation_display','delivery_task','assignment_group','business_stc','additional_assignee_list','description','closed_by','follow_up','parent_incident','sys_id','contact_type','reopened_by','urgency','problem_id','company','assigned_to','comments','comments_and_work_notes','due_date','sys_mod_count','reopen_count','sys_tags','escalation','upon_approval','correlation_id','location','username','password','remoteUri','serverUrl','substring','lastIndexOf','format','%s/api/now/doc/table/schema/','%s/api/now/table/','GET','incident?sysparm_display_value=all','log','assign','remove','includes','forEach','internalType','label','push','all','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','concat','ServiceNow\x20error:\x20','statusCode','stack','test','Wrong\x20credentials','True','true','false','result','inactive','value','eml-format','rimraf','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','save','then','destroy','error','name','send','index','rawAttributes','fieldName','type','model','map','keys','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','include','ServicenowAccount','findAll','rows','catch','show','params','includeAll','create','body','update','find','getConfigurations','findOne','ServicenowConfiguration','hasOwnProperty','AccountId','Subjects','getSubjects','channel','getDescriptions','ServicenowField','getFields','hold_reason','knowledge','subcategory','close_code','notify','incident_state','severity','category','parent','made_sla','caused_by','watch_list','sys_updated_on','child_incidents','number','resolved_by','sys_updated_by','opened_by','user_input','state','calendar_stc','closed_at','impact','work_notes_list','business_service','sys_domain_path','rfc','time_worked','expected_start','work_end','caller_id','approval_set'];(function(_0x3a3525,_0x5bee02){var _0x56e306=function(_0x3b21fc){while(--_0x3b21fc){_0x3a3525['push'](_0x3a3525['shift']());}};_0x56e306(++_0x5bee02);}(_0x4e87,0xee));var _0x74e8=function(_0xe49225,_0x1417d1){_0xe49225=_0xe49225-0x0;var _0x99a018=_0x4e87[_0xe49225];return _0x99a018;};'use strict';var emlformat=require(_0x74e8('0x0'));var rimraf=require(_0x74e8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x74e8('0x2'));var moment=require('moment');var BPromise=require(_0x74e8('0x3'));var Mustache=require(_0x74e8('0x4'));var util=require(_0x74e8('0x5'));var path=require(_0x74e8('0x6'));var sox=require(_0x74e8('0x7'));var csv=require('to-csv');var ejs=require(_0x74e8('0x8'));var fs=require('fs');var fs_extra=require(_0x74e8('0x9'));var _=require('lodash');var squel=require(_0x74e8('0xa'));var crypto=require(_0x74e8('0xb'));var jsforce=require(_0x74e8('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x74e8('0xd'));var querystring=require(_0x74e8('0xe'));var Papa=require('papaparse');var Redis=require(_0x74e8('0xf'));var authService=require(_0x74e8('0x10'));var qs=require(_0x74e8('0x11'));var as=require(_0x74e8('0x12'));var hardwareService=require(_0x74e8('0x13'));var logger=require('../../config/logger')(_0x74e8('0x14'));var utils=require(_0x74e8('0x15'));var config=require(_0x74e8('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x491357,_0x353a0c){_0x353a0c=_0x353a0c||0xcc;return function(_0x5069fc){if(_0x5069fc){return _0x491357[_0x74e8('0x17')](_0x353a0c);}return _0x491357[_0x74e8('0x18')](_0x353a0c)[_0x74e8('0x19')]();};}function respondWithResult(_0x4faa5c,_0x5508bb){_0x5508bb=_0x5508bb||0xc8;return function(_0x42291e){if(_0x42291e){return _0x4faa5c[_0x74e8('0x18')](_0x5508bb)[_0x74e8('0x1a')](_0x42291e);}};}function respondWithFilteredResult(_0x3e3c68,_0x1cd002){return function(_0x332e20){if(_0x332e20){var _0x2980cd=typeof _0x1cd002['offset']===_0x74e8('0x1b')&&typeof _0x1cd002[_0x74e8('0x1c')]===_0x74e8('0x1b');var _0x3a838a=_0x332e20[_0x74e8('0x1d')];var _0xe1e8b1=_0x2980cd?0x0:_0x1cd002[_0x74e8('0x1e')];var _0x4e8a93=_0x2980cd?_0x332e20[_0x74e8('0x1d')]:_0x1cd002['offset']+_0x1cd002[_0x74e8('0x1c')];var _0x2ce1db;if(_0x4e8a93>=_0x3a838a){_0x4e8a93=_0x3a838a;_0x2ce1db=0xc8;}else{_0x2ce1db=0xce;}_0x3e3c68['status'](_0x2ce1db);return _0x3e3c68[_0x74e8('0x1f')](_0x74e8('0x20'),_0xe1e8b1+'-'+_0x4e8a93+'/'+_0x3a838a)[_0x74e8('0x1a')](_0x332e20);}return null;};}function patchUpdates(_0x4ad960){return function(_0x186f7e){try{jsonpatch[_0x74e8('0x21')](_0x186f7e,_0x4ad960,!![]);}catch(_0x553ea1){return BPromise['reject'](_0x553ea1);}return _0x186f7e[_0x74e8('0x22')]();};}function saveUpdates(_0x14e1a0,_0x30c803){return function(_0x14ad8b){if(_0x14ad8b){return _0x14ad8b['update'](_0x14e1a0)[_0x74e8('0x23')](function(_0x275e60){return _0x275e60;});}return null;};}function removeEntity(_0x1b7b53,_0xe55758){return function(_0x52380b){if(_0x52380b){return _0x52380b[_0x74e8('0x24')]()['then'](function(){_0x1b7b53[_0x74e8('0x18')](0xcc)[_0x74e8('0x19')]();});}};}function handleEntityNotFound(_0x26af9a,_0x4279a7){return function(_0x3c5fb5){if(!_0x3c5fb5){_0x26af9a['sendStatus'](0x194);}return _0x3c5fb5;};}function handleError(_0x1bf2f1,_0x235e6b){_0x235e6b=_0x235e6b||0x1f4;return function(_0x1ccd5b){logger[_0x74e8('0x25')](_0x1ccd5b['stack']);if(_0x1ccd5b['name']){delete _0x1ccd5b[_0x74e8('0x26')];}_0x1bf2f1['status'](_0x235e6b)[_0x74e8('0x27')](_0x1ccd5b);};}exports[_0x74e8('0x28')]=function(_0xaf8273,_0x5859e6){var _0x4b62c2={},_0x9bd889={},_0x196bce={'count':0x0,'rows':[]};var _0x3713a7=_['map'](db['ServicenowAccount'][_0x74e8('0x29')],function(_0x953fdb){return{'name':_0x953fdb[_0x74e8('0x2a')],'type':_0x953fdb[_0x74e8('0x2b')]['key']};});_0x9bd889[_0x74e8('0x2c')]=_[_0x74e8('0x2d')](_0x3713a7,_0x74e8('0x26'));_0x9bd889['query']=_[_0x74e8('0x2e')](_0xaf8273[_0x74e8('0x2f')]);_0x9bd889[_0x74e8('0x30')]=_[_0x74e8('0x31')](_0x9bd889[_0x74e8('0x2c')],_0x9bd889['query']);_0x4b62c2['attributes']=_[_0x74e8('0x31')](_0x9bd889[_0x74e8('0x2c')],qs[_0x74e8('0x32')](_0xaf8273[_0x74e8('0x2f')][_0x74e8('0x32')]));_0x4b62c2[_0x74e8('0x33')]=_0x4b62c2['attributes'][_0x74e8('0x34')]?_0x4b62c2[_0x74e8('0x33')]:_0x9bd889[_0x74e8('0x2c')];if(!_0xaf8273[_0x74e8('0x2f')]['hasOwnProperty'](_0x74e8('0x35'))){_0x4b62c2[_0x74e8('0x1c')]=qs[_0x74e8('0x1c')](_0xaf8273[_0x74e8('0x2f')][_0x74e8('0x1c')]);_0x4b62c2[_0x74e8('0x1e')]=qs[_0x74e8('0x1e')](_0xaf8273[_0x74e8('0x2f')][_0x74e8('0x1e')]);}_0x4b62c2[_0x74e8('0x36')]=qs[_0x74e8('0x37')](_0xaf8273[_0x74e8('0x2f')][_0x74e8('0x37')]);_0x4b62c2[_0x74e8('0x38')]=qs[_0x74e8('0x30')](_['pick'](_0xaf8273[_0x74e8('0x2f')],_0x9bd889[_0x74e8('0x30')]),_0x3713a7);if(_0xaf8273[_0x74e8('0x2f')][_0x74e8('0x39')]){_0x4b62c2[_0x74e8('0x38')]=_[_0x74e8('0x3a')](_0x4b62c2[_0x74e8('0x38')],{'$or':_[_0x74e8('0x2d')](_0x3713a7,function(_0x34015c){if(_0x34015c[_0x74e8('0x2b')]!==_0x74e8('0x3b')){var _0x59aa90={};_0x59aa90[_0x34015c[_0x74e8('0x26')]]={'$like':'%'+_0xaf8273['query']['filter']+'%'};return _0x59aa90;}})});}_0x4b62c2=_[_0x74e8('0x3a')]({},_0x4b62c2,_0xaf8273[_0x74e8('0x3c')]);var _0x248599={'where':_0x4b62c2[_0x74e8('0x38')]};return db['ServicenowAccount'][_0x74e8('0x1d')](_0x248599)[_0x74e8('0x23')](function(_0x396196){_0x196bce[_0x74e8('0x1d')]=_0x396196;if(_0xaf8273[_0x74e8('0x2f')]['includeAll']){_0x4b62c2[_0x74e8('0x3d')]=[{'all':!![]}];}return db[_0x74e8('0x3e')][_0x74e8('0x3f')](_0x4b62c2);})[_0x74e8('0x23')](function(_0x29d640){_0x196bce[_0x74e8('0x40')]=_0x29d640;return _0x196bce;})[_0x74e8('0x23')](respondWithFilteredResult(_0x5859e6,_0x4b62c2))[_0x74e8('0x41')](handleError(_0x5859e6,null));};exports[_0x74e8('0x42')]=function(_0x414faf,_0x1422bd){var _0xf54b0a={'raw':![],'where':{'id':_0x414faf[_0x74e8('0x43')]['id']}},_0x11e563={};_0x11e563['model']=_[_0x74e8('0x2e')](db[_0x74e8('0x3e')][_0x74e8('0x29')]);_0x11e563['query']=_[_0x74e8('0x2e')](_0x414faf['query']);_0x11e563[_0x74e8('0x30')]=_[_0x74e8('0x31')](_0x11e563['model'],_0x11e563['query']);_0xf54b0a['attributes']=_[_0x74e8('0x31')](_0x11e563['model'],qs[_0x74e8('0x32')](_0x414faf['query'][_0x74e8('0x32')]));_0xf54b0a['attributes']=_0xf54b0a[_0x74e8('0x33')][_0x74e8('0x34')]?_0xf54b0a[_0x74e8('0x33')]:_0x11e563[_0x74e8('0x2c')];if(_0x414faf[_0x74e8('0x2f')][_0x74e8('0x44')]){_0xf54b0a[_0x74e8('0x3d')]=[{'all':!![]}];}_0xf54b0a=_[_0x74e8('0x3a')]({},_0xf54b0a,_0x414faf[_0x74e8('0x3c')]);return db[_0x74e8('0x3e')]['find'](_0xf54b0a)[_0x74e8('0x23')](handleEntityNotFound(_0x1422bd,null))[_0x74e8('0x23')](respondWithResult(_0x1422bd,null))['catch'](handleError(_0x1422bd,null));};exports['create']=function(_0x3686c2,_0x31bcfe){return db[_0x74e8('0x3e')][_0x74e8('0x45')](_0x3686c2[_0x74e8('0x46')],{})[_0x74e8('0x23')](respondWithResult(_0x31bcfe,0xc9))[_0x74e8('0x41')](handleError(_0x31bcfe,null));};exports[_0x74e8('0x47')]=function(_0x57cc4f,_0x27a017){if(_0x57cc4f[_0x74e8('0x46')]['id']){delete _0x57cc4f[_0x74e8('0x46')]['id'];}return db[_0x74e8('0x3e')][_0x74e8('0x48')]({'where':{'id':_0x57cc4f[_0x74e8('0x43')]['id']}})['then'](handleEntityNotFound(_0x27a017,null))[_0x74e8('0x23')](saveUpdates(_0x57cc4f[_0x74e8('0x46')],null))[_0x74e8('0x23')](respondWithResult(_0x27a017,null))[_0x74e8('0x41')](handleError(_0x27a017,null));};exports[_0x74e8('0x24')]=function(_0x22b800,_0x360212){return db[_0x74e8('0x3e')][_0x74e8('0x48')]({'where':{'id':_0x22b800[_0x74e8('0x43')]['id']}})[_0x74e8('0x23')](handleEntityNotFound(_0x360212,null))[_0x74e8('0x23')](removeEntity(_0x360212,null))[_0x74e8('0x41')](handleError(_0x360212,null));};exports[_0x74e8('0x49')]=function(_0x378328,_0x2e907e,_0x213b35){var _0x183b4d={};var _0x2e35c8={};var _0x21aa56;var _0x2a5218;return db['ServicenowAccount'][_0x74e8('0x4a')]({'where':{'id':_0x378328[_0x74e8('0x43')]['id']}})[_0x74e8('0x23')](handleEntityNotFound(_0x2e907e,null))[_0x74e8('0x23')](function(_0x98e6cb){if(_0x98e6cb){_0x21aa56=_0x98e6cb;_0x2e35c8[_0x74e8('0x2c')]=_[_0x74e8('0x2e')](db[_0x74e8('0x4b')][_0x74e8('0x29')]);_0x2e35c8[_0x74e8('0x2f')]=_[_0x74e8('0x2e')](_0x378328['query']);_0x2e35c8['filters']=_['intersection'](_0x2e35c8['model'],_0x2e35c8[_0x74e8('0x2f')]);_0x183b4d[_0x74e8('0x33')]=_['intersection'](_0x2e35c8['model'],qs[_0x74e8('0x32')](_0x378328[_0x74e8('0x2f')][_0x74e8('0x32')]));_0x183b4d['attributes']=_0x183b4d[_0x74e8('0x33')][_0x74e8('0x34')]?_0x183b4d[_0x74e8('0x33')]:_0x2e35c8[_0x74e8('0x2c')];_0x183b4d['order']=qs[_0x74e8('0x37')](_0x378328[_0x74e8('0x2f')][_0x74e8('0x37')]);_0x183b4d[_0x74e8('0x38')]=qs[_0x74e8('0x30')](_['pick'](_0x378328['query'],_0x2e35c8[_0x74e8('0x30')]));if(_0x378328[_0x74e8('0x2f')][_0x74e8('0x39')]){_0x183b4d[_0x74e8('0x38')]=_[_0x74e8('0x3a')](_0x183b4d[_0x74e8('0x38')],{'$or':_[_0x74e8('0x2d')](_0x183b4d['attributes'],function(_0x6b0de4){var _0x5c4493={};_0x5c4493[_0x6b0de4]={'$like':'%'+_0x378328[_0x74e8('0x2f')][_0x74e8('0x39')]+'%'};return _0x5c4493;})});}_0x183b4d=_['merge']({},_0x183b4d,_0x378328[_0x74e8('0x3c')]);return _0x21aa56[_0x74e8('0x49')](_0x183b4d);}})[_0x74e8('0x23')](function(_0x1051ca){if(_0x1051ca){_0x2a5218=_0x1051ca[_0x74e8('0x34')];if(!_0x378328['query'][_0x74e8('0x4c')](_0x74e8('0x35'))){_0x183b4d[_0x74e8('0x1c')]=qs[_0x74e8('0x1c')](_0x378328[_0x74e8('0x2f')][_0x74e8('0x1c')]);_0x183b4d[_0x74e8('0x1e')]=qs[_0x74e8('0x1e')](_0x378328[_0x74e8('0x2f')][_0x74e8('0x1e')]);}return _0x21aa56['getConfigurations'](_0x183b4d);}})[_0x74e8('0x23')](function(_0x404096){if(_0x404096){return _0x404096?{'count':_0x2a5218,'rows':_0x404096}:null;}})[_0x74e8('0x23')](respondWithResult(_0x2e907e,null))[_0x74e8('0x41')](handleError(_0x2e907e,null));};exports['addConfiguration']=function(_0x385fda,_0x463f95,_0xcfeeb1){if(_0x385fda[_0x74e8('0x46')]['id']){delete _0x385fda['body']['id'];}return db['ServicenowAccount'][_0x74e8('0x4a')]({'where':{'id':_0x385fda['params']['id']}})['then'](handleEntityNotFound(_0x463f95,null))[_0x74e8('0x23')](function(_0x58c38d){if(_0x58c38d){_0x385fda['body'][_0x74e8('0x4d')]=_0x58c38d['id'];_0x385fda[_0x74e8('0x46')][_0x74e8('0x4e')]=integrations[_0x74e8('0x4f')](_0x385fda[_0x74e8('0x46')][_0x74e8('0x50')],_0x385fda[_0x74e8('0x46')]['type']);_0x385fda['body']['Descriptions']=integrations[_0x74e8('0x51')](_0x385fda[_0x74e8('0x46')][_0x74e8('0x50')],_0x385fda[_0x74e8('0x46')][_0x74e8('0x2b')]);return db['ServicenowConfiguration'][_0x74e8('0x45')](_0x385fda[_0x74e8('0x46')],{'include':[{'model':db[_0x74e8('0x52')],'as':'Subjects'},{'model':db[_0x74e8('0x52')],'as':'Descriptions'}]});}return null;})[_0x74e8('0x23')](respondWithResult(_0x463f95,null))['catch'](handleError(_0x463f95,null));};exports[_0x74e8('0x53')]=function(_0x447294,_0x1b0047,_0x442583){var _0x305835=['made_sla',_0x74e8('0x54'),_0x74e8('0x55'),_0x74e8('0x56'),_0x74e8('0x57'),_0x74e8('0x58'),_0x74e8('0x59'),_0x74e8('0x5a'),_0x74e8('0x5b')];var _0xa1dcc3=[_0x74e8('0x5c'),_0x74e8('0x5d'),_0x74e8('0x5e'),_0x74e8('0x5f'),'upon_reject',_0x74e8('0x60'),_0x74e8('0x61'),'hold_reason','approval_history',_0x74e8('0x62'),_0x74e8('0x63'),_0x74e8('0x64'),_0x74e8('0x65'),_0x74e8('0x66'),'sys_created_on','sys_domain',_0x74e8('0x67'),'sys_created_by',_0x74e8('0x55'),_0x74e8('0x36'),_0x74e8('0x68'),_0x74e8('0x69'),'cmdb_ci','delivery_plan',_0x74e8('0x6a'),'active',_0x74e8('0x6b'),_0x74e8('0x6c'),'priority',_0x74e8('0x6d'),_0x74e8('0x6e'),_0x74e8('0x6f'),_0x74e8('0x70'),'opened_at','business_duration','group_list',_0x74e8('0x71'),'reopened_time','resolved_at',_0x74e8('0x72'),_0x74e8('0x73'),_0x74e8('0x56'),_0x74e8('0x74'),_0x74e8('0x75'),_0x74e8('0x57'),_0x74e8('0x76'),_0x74e8('0x77'),'work_start',_0x74e8('0x78'),_0x74e8('0x79'),_0x74e8('0x7a'),_0x74e8('0x7b'),'calendar_duration',_0x74e8('0x58'),'sys_class_name','close_notes',_0x74e8('0x7c'),_0x74e8('0x7d'),_0x74e8('0x7e'),_0x74e8('0x7f'),_0x74e8('0x80'),_0x74e8('0x81'),_0x74e8('0x59'),_0x74e8('0x82'),_0x74e8('0x83'),_0x74e8('0x84'),'reassignment_count','activity_due',_0x74e8('0x85'),'severity',_0x74e8('0x86'),'sla_due','approval',_0x74e8('0x87'),_0x74e8('0x88'),_0x74e8('0x89'),_0x74e8('0x8a'),_0x74e8('0x8b'),_0x74e8('0x8c'),_0x74e8('0x8d'),_0x74e8('0x8e'),_0x74e8('0x8f'),_0x74e8('0x5b')];var _0x1a959f='';var _0x515a66='';var _0x387151=[];var _0x3947b1='';var _0x289e41='';var _0xfedcad=[];var _0x36ef79='';var _0x5b58af='';var _0x212e40={};var _0x346cd9='';return db[_0x74e8('0x3e')][_0x74e8('0x4a')]({'where':{'id':_0x447294[_0x74e8('0x43')]['id']},'attributes':['id',_0x74e8('0x90'),_0x74e8('0x91'),'email',_0x74e8('0x92'),_0x74e8('0x93')]})[_0x74e8('0x23')](handleEntityNotFound(_0x1b0047,null))[_0x74e8('0x23')](function(_0x4539f8){if(_0x4539f8){_0x346cd9=_0x4539f8[_0x74e8('0x92')];var _0x4e4b16=_0x346cd9['slice'](-0x1);if(_0x4e4b16==='/'){_0x346cd9=_0x346cd9[_0x74e8('0x94')](0x0,_0x346cd9[_0x74e8('0x95')](_0x4e4b16));}_0x5b58af=util[_0x74e8('0x96')](_0x74e8('0x97'),_0x346cd9);_0x36ef79=util[_0x74e8('0x96')](_0x74e8('0x98'),_0x346cd9);_0x212e40={'user':_0x4539f8[_0x74e8('0x90')],'pass':_0x4539f8[_0x74e8('0x91')]};var _0x156c9d={'method':_0x74e8('0x99'),'uri':_0x5b58af+_0x74e8('0x9a'),'auth':_0x212e40,'json':!![]};return rp(_0x156c9d);}})[_0x74e8('0x23')](function(_0x4201c2){if(_0x4201c2['result'][_0x74e8('0x34')]>0x0){_0x1a959f=_0x4201c2['result'];}console[_0x74e8('0x9b')]('incident\x20table\x20objects',_0x1a959f);_0xfedcad=[];_0x515a66=Object[_0x74e8('0x9c')]([],_0x1a959f);_[_0x74e8('0x9d')](_0x515a66,function(_0x450d5e){return!_0x305835[_0x74e8('0x9e')](_0x450d5e[_0x74e8('0x26')]);});_0x515a66[_0x74e8('0x9f')](function(_0x1aac7b){var _0x2fa526=createFieldObject(_0x36ef79,_0x212e40,_0x1aac7b[_0x74e8('0xa0')],_0x1aac7b[_0x74e8('0x26')],_0x1aac7b[_0x74e8('0xa1')],![]);_0xfedcad[_0x74e8('0xa2')](_0x2fa526);});return Promise[_0x74e8('0xa3')](_0xfedcad);})[_0x74e8('0x23')](function(_0x2db456){_0x387151=_0x2db456;_0x3947b1=Object[_0x74e8('0x9c')]([],_0x1a959f);console[_0x74e8('0x9b')]('TCL:\x20_object',_0x1a959f);_[_0x74e8('0x9d')](_0x3947b1,function(_0x30980b){return _0xa1dcc3[_0x74e8('0x9e')](_0x30980b['name']);});console[_0x74e8('0x9b')](_0x74e8('0xa4'),_0x3947b1);_0xfedcad=[];_0x3947b1[_0x74e8('0x9f')](function(_0x2bc294){var _0x57f13d=createFieldObject(_0x36ef79,_0x212e40,_0x2bc294[_0x74e8('0xa0')],_0x2bc294[_0x74e8('0x26')],_0x2bc294[_0x74e8('0xa1')],!![]);_0xfedcad[_0x74e8('0xa2')](_0x57f13d);});return Promise[_0x74e8('0xa3')](_0xfedcad);})['then'](function(_0xea96ce){_0x289e41=_0xea96ce;var _0x1dec1b=_0x387151[_0x74e8('0xa5')](_0x289e41);return{'count':_0x1dec1b[_0x74e8('0x34')],'rows':_0x1dec1b};})[_0x74e8('0x23')](respondWithResult(_0x1b0047,null))['catch'](function(_0x29b92f){console[_0x74e8('0x9b')](_0x74e8('0xa6')+_0x29b92f);var _0x55e3f1=_0x447294[_0x74e8('0x2f')]['test']?0x1f4:_0x29b92f[_0x74e8('0xa7')]||0x1f4;logger[_0x74e8('0x25')](_0x29b92f[_0x74e8('0xa8')]);delete _0x29b92f['name'];if(_0x55e3f1===0x191){_0x55e3f1=0x190;}_0x1b0047['status'](_0x55e3f1)[_0x74e8('0x27')](_0x447294['query'][_0x74e8('0xa9')]?{'message':_0x74e8('0xaa'),'statusCode':_0x29b92f[_0x74e8('0xa7')]}:_0x29b92f);});};function createFieldObject(_0x3f7262,_0x419c48,_0xc684cf,_0x789499,_0x332fd7,_0x501c6c){return new Promise(function(_0x28f83e,_0x39a20b){var _0x15de17={'id':_0x789499,'name':_0x332fd7,'custom':_0x501c6c};if(_0xc684cf==='boolean'){_0x15de17[_0x74e8('0x3c')]=[{'name':_0x74e8('0xab'),'value':_0x74e8('0xac')},{'name':'False','value':_0x74e8('0xad')}];_0x28f83e(_0x15de17);}else{var _0x2cad4b={'method':_0x74e8('0x99'),'uri':_0x3f7262+'sys_choice?sysparm_query=name=incident^element='+_0x789499,'auth':_0x419c48,'json':!![]};return rp(_0x2cad4b)[_0x74e8('0x23')](function(_0x52c89e){var _0x3b56c6=[];if(_0x52c89e[_0x74e8('0xae')][_0x74e8('0x34')]>0x0){_0x52c89e[_0x74e8('0xae')][_0x74e8('0x9f')](function(_0x4134d5){if(_0x4134d5[_0x74e8('0xaf')]===_0x74e8('0xad')){var _0x1c3743={'name':_0x4134d5[_0x74e8('0xa1')],'value':_0x4134d5[_0x74e8('0xb0')]};_0x3b56c6[_0x74e8('0xa2')](_0x1c3743);}});}_0x15de17[_0x74e8('0x3c')]=_0x3b56c6;if(_0x15de17[_0x74e8('0x3c')][_0x74e8('0x34')]>0x0){_0x28f83e(_0x15de17);}else{if(_0x501c6c==![]){_0x28f83e();}else{_0x28f83e(_0x15de17);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index 5ecffd8..fabba68 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 _0xdc97=['request-promise','path','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','int_servicenow_accounts','lodash','util','../../config/logger','moment'];(function(_0x4b94aa,_0x48c0ac){var _0x42b1ff=function(_0x31f42d){while(--_0x31f42d){_0x4b94aa['push'](_0x4b94aa['shift']());}};_0x42b1ff(++_0x48c0ac);}(_0xdc97,0x13b));var _0x7dc9=function(_0x29b4fe,_0x15e092){_0x29b4fe=_0x29b4fe-0x0;var _0x10a930=_0xdc97[_0x29b4fe];return _0x10a930;};'use strict';var _=require(_0x7dc9('0x0'));var util=require(_0x7dc9('0x1'));var logger=require(_0x7dc9('0x2'))('api');var moment=require(_0x7dc9('0x3'));var BPromise=require('bluebird');var rp=require(_0x7dc9('0x4'));var fs=require('fs');var path=require(_0x7dc9('0x5'));var rimraf=require('rimraf');var config=require(_0x7dc9('0x6'));var attributes=require(_0x7dc9('0x7'));var integrations=require(_0x7dc9('0x8'));module[_0x7dc9('0x9')]=function(_0x589f02,_0x2636ef){return _0x589f02['define']('ServicenowAccount',attributes,{'tableName':_0x7dc9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4819=['request-promise','path','rimraf','../../config/environment','./intServicenowAccount.attributes','exports','define','ServicenowAccount','int_servicenow_accounts','util','../../config/logger','api','moment','bluebird'];(function(_0x3e744d,_0x161dcb){var _0x4a05b5=function(_0x18b3c6){while(--_0x18b3c6){_0x3e744d['push'](_0x3e744d['shift']());}};_0x4a05b5(++_0x161dcb);}(_0x4819,0xcd));var _0x9481=function(_0x5b5af1,_0x1db01b){_0x5b5af1=_0x5b5af1-0x0;var _0x45ab7b=_0x4819[_0x5b5af1];return _0x45ab7b;};'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'));var integrations=require('../../components/integrations/configuration');module[_0x9481('0xa')]=function(_0x5def07,_0x54cc78){return _0x5def07[_0x9481('0xb')](_0x9481('0xc'),attributes,{'tableName':_0x9481('0xd'),'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 b2088cc..4585c66 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 _0xb495=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetServicenowAccount','ServicenowAccount','options','raw','attributes','limit','include','map','model','catch','ShowServicenowAccount','where','lodash'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xb495,0x93));var _0x5b49=function(_0x15133b,_0x23f799){_0x15133b=_0x15133b-0x0;var _0x4b5b08=_0xb495[_0x15133b];return _0x4b5b08;};'use strict';var _=require(_0x5b49('0x0'));var util=require(_0x5b49('0x1'));var moment=require(_0x5b49('0x2'));var BPromise=require(_0x5b49('0x3'));var rs=require(_0x5b49('0x4'));var fs=require('fs');var Redis=require(_0x5b49('0x5'));var db=require(_0x5b49('0x6'))['db'];var utils=require(_0x5b49('0x7'));var logger=require(_0x5b49('0x8'))(_0x5b49('0x9'));var config=require('../../config/environment');var jayson=require(_0x5b49('0xa'));var client=jayson[_0x5b49('0xb')][_0x5b49('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x457649,_0x760ed5,_0x4eec8a){return new BPromise(function(_0x29f843,_0x1d2d1b){return client[_0x5b49('0xd')](_0x457649,_0x4eec8a)[_0x5b49('0xe')](function(_0x3b20ea){logger[_0x5b49('0xf')](_0x5b49('0x10'),_0x760ed5,_0x5b49('0x11'));logger[_0x5b49('0x12')](_0x5b49('0x13'),_0x760ed5,'request\x20sent',JSON[_0x5b49('0x14')](_0x3b20ea));if(_0x3b20ea[_0x5b49('0x15')]){if(_0x3b20ea[_0x5b49('0x15')][_0x5b49('0x16')]===0x1f4){logger[_0x5b49('0x15')](_0x5b49('0x10'),_0x760ed5,_0x3b20ea[_0x5b49('0x15')][_0x5b49('0x17')]);return _0x1d2d1b(_0x3b20ea['error']['message']);}logger[_0x5b49('0x15')](_0x5b49('0x10'),_0x760ed5,_0x3b20ea[_0x5b49('0x15')][_0x5b49('0x17')]);return _0x29f843(_0x3b20ea['error'][_0x5b49('0x17')]);}else{logger['info'](_0x5b49('0x10'),_0x760ed5,_0x5b49('0x11'));_0x29f843(_0x3b20ea[_0x5b49('0x18')]['message']);}})['catch'](function(_0x2931c1){logger[_0x5b49('0x15')](_0x5b49('0x10'),_0x760ed5,_0x2931c1);_0x1d2d1b(_0x2931c1);});});}exports[_0x5b49('0x19')]=function(_0x17b594){var _0x2a30be=this;return new Promise(function(_0x23d76b,_0x89377e){return db[_0x5b49('0x1a')]['findAll']({'raw':_0x17b594[_0x5b49('0x1b')]?_0x17b594[_0x5b49('0x1b')][_0x5b49('0x1c')]===undefined?!![]:![]:!![],'where':_0x17b594[_0x5b49('0x1b')]?_0x17b594[_0x5b49('0x1b')]['where']||null:null,'attributes':_0x17b594[_0x5b49('0x1b')]?_0x17b594[_0x5b49('0x1b')][_0x5b49('0x1d')]||null:null,'limit':_0x17b594['options']?_0x17b594[_0x5b49('0x1b')][_0x5b49('0x1e')]||null:null,'include':_0x17b594[_0x5b49('0x1b')]?_0x17b594[_0x5b49('0x1b')][_0x5b49('0x1f')]?_[_0x5b49('0x20')](_0x17b594[_0x5b49('0x1b')]['include'],function(_0x335f99){return{'model':db[_0x335f99[_0x5b49('0x21')]],'as':_0x335f99['as'],'attributes':_0x335f99[_0x5b49('0x1d')],'include':_0x335f99[_0x5b49('0x1f')]?_['map'](_0x335f99['include'],function(_0x16bf27){return{'model':db[_0x16bf27[_0x5b49('0x21')]],'as':_0x16bf27['as'],'attributes':_0x16bf27[_0x5b49('0x1d')],'include':_0x16bf27['include']?_['map'](_0x16bf27[_0x5b49('0x1f')],function(_0x4771b1){return{'model':db[_0x4771b1[_0x5b49('0x21')]],'as':_0x4771b1['as'],'attributes':_0x4771b1[_0x5b49('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x5b49('0xe')](function(_0x5cdabe){logger[_0x5b49('0xf')](_0x5b49('0x19'),_0x17b594);logger[_0x5b49('0x12')](_0x5b49('0x19'),_0x17b594,JSON[_0x5b49('0x14')](_0x5cdabe));_0x23d76b(_0x5cdabe);})[_0x5b49('0x22')](function(_0x5cdc44){logger[_0x5b49('0x15')](_0x5b49('0x19'),_0x5cdc44[_0x5b49('0x17')],_0x17b594);_0x89377e(_0x2a30be[_0x5b49('0x15')](0x1f4,_0x5cdc44['message']));});});};exports[_0x5b49('0x23')]=function(_0x5e9462){var _0x2b064a=this;return new Promise(function(_0x4fef75,_0x26cf9){return db['ServicenowAccount']['find']({'raw':_0x5e9462['options']?_0x5e9462['options'][_0x5b49('0x1c')]===undefined?!![]:![]:!![],'where':_0x5e9462['options']?_0x5e9462[_0x5b49('0x1b')][_0x5b49('0x24')]||null:null,'attributes':_0x5e9462['options']?_0x5e9462['options'][_0x5b49('0x1d')]||null:null,'include':_0x5e9462[_0x5b49('0x1b')]?_0x5e9462['options']['include']?_[_0x5b49('0x20')](_0x5e9462[_0x5b49('0x1b')]['include'],function(_0x531fec){return{'model':db[_0x531fec[_0x5b49('0x21')]],'as':_0x531fec['as'],'attributes':_0x531fec['attributes'],'include':_0x531fec[_0x5b49('0x1f')]?_[_0x5b49('0x20')](_0x531fec[_0x5b49('0x1f')],function(_0x20b820){return{'model':db[_0x20b820['model']],'as':_0x20b820['as'],'attributes':_0x20b820[_0x5b49('0x1d')],'include':_0x20b820[_0x5b49('0x1f')]?_['map'](_0x20b820[_0x5b49('0x1f')],function(_0x5505c1){return{'model':db[_0x5505c1[_0x5b49('0x21')]],'as':_0x5505c1['as'],'attributes':_0x5505c1[_0x5b49('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x5b49('0xe')](function(_0x562d75){logger[_0x5b49('0xf')](_0x5b49('0x23'),_0x5e9462);logger['debug'](_0x5b49('0x23'),_0x5e9462,JSON['stringify'](_0x562d75));_0x4fef75(_0x562d75);})['catch'](function(_0x4bee6f){logger[_0x5b49('0x15')](_0x5b49('0x23'),_0x4bee6f[_0x5b49('0x17')],_0x5e9462);_0x26cf9(_0x2b064a['error'](0x1f4,_0x4bee6f[_0x5b49('0x17')]));});});}; \ No newline at end of file +var _0x27a4=['stringify','error','message','info','result','GetServicenowAccount','ServicenowAccount','findAll','options','raw','attributes','limit','include','map','model','ShowServicenowAccount','find','where','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','request','then','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s'];(function(_0x17d189,_0xc9a80d){var _0x224c93=function(_0x1b68d7){while(--_0x1b68d7){_0x17d189['push'](_0x17d189['shift']());}};_0x224c93(++_0xc9a80d);}(_0x27a4,0x1bf));var _0x427a=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x27a4[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0x427a('0x0'));var util=require(_0x427a('0x1'));var moment=require(_0x427a('0x2'));var BPromise=require(_0x427a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x427a('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x427a('0x5'))('rpc');var config=require(_0x427a('0x6'));var jayson=require(_0x427a('0x7'));var client=jayson[_0x427a('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x260ce9,_0x600ba3,_0x1c2885){return new BPromise(function(_0x2e4e95,_0x3f3db2){return client[_0x427a('0x9')](_0x260ce9,_0x1c2885)[_0x427a('0xa')](function(_0x24c1a7){logger['info'](_0x427a('0xb'),_0x600ba3,_0x427a('0xc'));logger[_0x427a('0xd')](_0x427a('0xe'),_0x600ba3,'request\x20sent',JSON[_0x427a('0xf')](_0x24c1a7));if(_0x24c1a7[_0x427a('0x10')]){if(_0x24c1a7['error']['code']===0x1f4){logger[_0x427a('0x10')](_0x427a('0xb'),_0x600ba3,_0x24c1a7[_0x427a('0x10')][_0x427a('0x11')]);return _0x3f3db2(_0x24c1a7[_0x427a('0x10')]['message']);}logger[_0x427a('0x10')](_0x427a('0xb'),_0x600ba3,_0x24c1a7[_0x427a('0x10')][_0x427a('0x11')]);return _0x2e4e95(_0x24c1a7[_0x427a('0x10')]['message']);}else{logger[_0x427a('0x12')](_0x427a('0xb'),_0x600ba3,_0x427a('0xc'));_0x2e4e95(_0x24c1a7[_0x427a('0x13')][_0x427a('0x11')]);}})['catch'](function(_0x3990f2){logger[_0x427a('0x10')](_0x427a('0xb'),_0x600ba3,_0x3990f2);_0x3f3db2(_0x3990f2);});});}exports[_0x427a('0x14')]=function(_0x4611a8){var _0x418125=this;return new Promise(function(_0x76bff7,_0x3fc642){return db[_0x427a('0x15')][_0x427a('0x16')]({'raw':_0x4611a8[_0x427a('0x17')]?_0x4611a8['options'][_0x427a('0x18')]===undefined?!![]:![]:!![],'where':_0x4611a8[_0x427a('0x17')]?_0x4611a8['options']['where']||null:null,'attributes':_0x4611a8['options']?_0x4611a8[_0x427a('0x17')][_0x427a('0x19')]||null:null,'limit':_0x4611a8[_0x427a('0x17')]?_0x4611a8[_0x427a('0x17')][_0x427a('0x1a')]||null:null,'include':_0x4611a8[_0x427a('0x17')]?_0x4611a8[_0x427a('0x17')][_0x427a('0x1b')]?_[_0x427a('0x1c')](_0x4611a8[_0x427a('0x17')]['include'],function(_0x4962e8){return{'model':db[_0x4962e8[_0x427a('0x1d')]],'as':_0x4962e8['as'],'attributes':_0x4962e8[_0x427a('0x19')],'include':_0x4962e8['include']?_['map'](_0x4962e8[_0x427a('0x1b')],function(_0x57810f){return{'model':db[_0x57810f[_0x427a('0x1d')]],'as':_0x57810f['as'],'attributes':_0x57810f[_0x427a('0x19')],'include':_0x57810f[_0x427a('0x1b')]?_['map'](_0x57810f[_0x427a('0x1b')],function(_0x38d0be){return{'model':db[_0x38d0be['model']],'as':_0x38d0be['as'],'attributes':_0x38d0be[_0x427a('0x19')]};}):[]};}):[]};}):[]:[]})[_0x427a('0xa')](function(_0x25369a){logger[_0x427a('0x12')]('GetServicenowAccount',_0x4611a8);logger[_0x427a('0xd')]('GetServicenowAccount',_0x4611a8,JSON[_0x427a('0xf')](_0x25369a));_0x76bff7(_0x25369a);})['catch'](function(_0x41c982){logger[_0x427a('0x10')]('GetServicenowAccount',_0x41c982[_0x427a('0x11')],_0x4611a8);_0x3fc642(_0x418125[_0x427a('0x10')](0x1f4,_0x41c982[_0x427a('0x11')]));});});};exports[_0x427a('0x1e')]=function(_0x1693a6){var _0x5afbc8=this;return new Promise(function(_0x297981,_0x397e33){return db['ServicenowAccount'][_0x427a('0x1f')]({'raw':_0x1693a6[_0x427a('0x17')]?_0x1693a6[_0x427a('0x17')][_0x427a('0x18')]===undefined?!![]:![]:!![],'where':_0x1693a6[_0x427a('0x17')]?_0x1693a6[_0x427a('0x17')][_0x427a('0x20')]||null:null,'attributes':_0x1693a6[_0x427a('0x17')]?_0x1693a6[_0x427a('0x17')][_0x427a('0x19')]||null:null,'include':_0x1693a6['options']?_0x1693a6[_0x427a('0x17')][_0x427a('0x1b')]?_['map'](_0x1693a6[_0x427a('0x17')]['include'],function(_0x408615){return{'model':db[_0x408615[_0x427a('0x1d')]],'as':_0x408615['as'],'attributes':_0x408615[_0x427a('0x19')],'include':_0x408615['include']?_[_0x427a('0x1c')](_0x408615[_0x427a('0x1b')],function(_0x7a40c8){return{'model':db[_0x7a40c8[_0x427a('0x1d')]],'as':_0x7a40c8['as'],'attributes':_0x7a40c8[_0x427a('0x19')],'include':_0x7a40c8[_0x427a('0x1b')]?_['map'](_0x7a40c8[_0x427a('0x1b')],function(_0x52fe27){return{'model':db[_0x52fe27[_0x427a('0x1d')]],'as':_0x52fe27['as'],'attributes':_0x52fe27[_0x427a('0x19')]};}):[]};}):[]};}):[]:[]})[_0x427a('0xa')](function(_0x33f4db){logger['info']('ShowServicenowAccount',_0x1693a6);logger['debug']('ShowServicenowAccount',_0x1693a6,JSON[_0x427a('0xf')](_0x33f4db));_0x297981(_0x33f4db);})['catch'](function(_0x1a3219){logger[_0x427a('0x10')](_0x427a('0x1e'),_0x1a3219[_0x427a('0x11')],_0x1693a6);_0x397e33(_0x5afbc8[_0x427a('0x10')](0x1f4,_0x1a3219[_0x427a('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index 84dafa2..0fe516c 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 _0x2871=['/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','post','put','update','delete','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x3e14ac,_0x16ce05){var _0xe778ee=function(_0x21f1cd){while(--_0x21f1cd){_0x3e14ac['push'](_0x3e14ac['shift']());}};_0xe778ee(++_0x16ce05);}(_0x2871,0x1c4));var _0x1287=function(_0x4d3c17,_0x317c47){_0x4d3c17=_0x4d3c17-0x0;var _0xe81017=_0x2871[_0x4d3c17];return _0xe81017;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x1287('0x0'));var express=require(_0x1287('0x1'));var router=express[_0x1287('0x2')]();var fs_extra=require(_0x1287('0x3'));var auth=require(_0x1287('0x4'));var interaction=require(_0x1287('0x5'));var config=require(_0x1287('0x6'));var controller=require('./intServicenowConfiguration.controller');router[_0x1287('0x7')]('/',auth[_0x1287('0x8')](),controller[_0x1287('0x9')]);router[_0x1287('0x7')](_0x1287('0xa'),auth[_0x1287('0x8')](),controller[_0x1287('0xb')]);router[_0x1287('0x7')](_0x1287('0xc'),auth[_0x1287('0x8')](),controller[_0x1287('0xd')]);router[_0x1287('0x7')](_0x1287('0xe'),auth['isAuthenticated'](),controller[_0x1287('0xf')]);router[_0x1287('0x7')]('/:id/descriptions',auth[_0x1287('0x8')](),controller[_0x1287('0x10')]);router[_0x1287('0x11')]('/',auth[_0x1287('0x8')](),controller['create']);router[_0x1287('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x1287('0x13')]);router[_0x1287('0x14')](_0x1287('0xa'),auth[_0x1287('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x1279=['update','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../config/environment','get','index','isAuthenticated','show','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','create','put','/:id'];(function(_0x466af7,_0x2f7551){var _0x348c96=function(_0x2d7477){while(--_0x2d7477){_0x466af7['push'](_0x466af7['shift']());}};_0x348c96(++_0x2f7551);}(_0x1279,0x17f));var _0x9127=function(_0x55867c,_0x476e39){_0x55867c=_0x55867c-0x0;var _0x314503=_0x1279[_0x55867c];return _0x314503;};'use strict';var multer=require(_0x9127('0x0'));var util=require(_0x9127('0x1'));var path=require(_0x9127('0x2'));var timeout=require(_0x9127('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x9127('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x9127('0x5'));var controller=require('./intServicenowConfiguration.controller');router[_0x9127('0x6')]('/',auth['isAuthenticated'](),controller[_0x9127('0x7')]);router['get']('/:id',auth[_0x9127('0x8')](),controller[_0x9127('0x9')]);router[_0x9127('0x6')]('/:id/fields',auth['isAuthenticated'](),controller['getFields']);router['get'](_0x9127('0xa'),auth['isAuthenticated'](),controller[_0x9127('0xb')]);router[_0x9127('0x6')](_0x9127('0xc'),auth[_0x9127('0x8')](),controller[_0x9127('0xd')]);router['post']('/',auth[_0x9127('0x8')](),controller[_0x9127('0xe')]);router[_0x9127('0xf')](_0x9127('0x10'),auth[_0x9127('0x8')](),controller[_0x9127('0x11')]);router['delete'](_0x9127('0x10'),auth[_0x9127('0x8')](),controller[_0x9127('0x12')]);module[_0x9127('0x13')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index d70690b..ad046a0 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 _0xbc0b=['STRING','sequelize','exports'];(function(_0x987090,_0x25995d){var _0x49df8b=function(_0xf9a370){while(--_0xf9a370){_0x987090['push'](_0x987090['shift']());}};_0x49df8b(++_0x25995d);}(_0xbc0b,0x106));var _0xbbc0=function(_0x8a969d,_0x339d9f){_0x8a969d=_0x8a969d-0x0;var _0x1d8dc7=_0xbc0b[_0x8a969d];return _0x1d8dc7;};'use strict';var Sequelize=require(_0xbbc0('0x0'));module[_0xbbc0('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xbbc0('0x2')]}}; \ No newline at end of file +var _0x4cee=['exports','STRING'];(function(_0xb6400a,_0x279066){var _0x5ee797=function(_0x5133ab){while(--_0x5133ab){_0xb6400a['push'](_0xb6400a['shift']());}};_0x5ee797(++_0x279066);}(_0x4cee,0xe0));var _0xe4ce=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x4cee[_0x59ee6f];return _0x4c0979;};'use strict';var Sequelize=require('sequelize');module[_0xe4ce('0x0')]={'name':{'type':Sequelize[_0xe4ce('0x1')]},'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 0759c3d..6861a92 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 _0x69e9=['intersection','attributes','fields','length','nolimit','order','sort','filter','where','VIRTUAL','merge','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','getFields','findOne','ServicenowField','pick','hasOwnProperty','getSubjects','getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise','moment','util','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','../../config/environment','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','reject','save','update','then','destroy','error','stack','name','send','index','map','ServicenowConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters'];(function(_0x467565,_0x4bc0fd){var _0xeda33f=function(_0x5db390){while(--_0x5db390){_0x467565['push'](_0x467565['shift']());}};_0xeda33f(++_0x4bc0fd);}(_0x69e9,0xbf));var _0x969e=function(_0x46605b,_0x2e9da8){_0x46605b=_0x46605b-0x0;var _0x56c96f=_0x69e9[_0x46605b];return _0x56c96f;};'use strict';var emlformat=require(_0x969e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x969e('0x1'));var jsonpatch=require(_0x969e('0x2'));var rp=require(_0x969e('0x3'));var moment=require(_0x969e('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x969e('0x5'));var path=require('path');var sox=require(_0x969e('0x6'));var csv=require(_0x969e('0x7'));var ejs=require(_0x969e('0x8'));var fs=require('fs');var fs_extra=require(_0x969e('0x9'));var _=require(_0x969e('0xa'));var squel=require(_0x969e('0xb'));var crypto=require(_0x969e('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x969e('0xd'));var toCsv=require('to-csv');var querystring=require(_0x969e('0xe'));var Papa=require(_0x969e('0xf'));var Redis=require(_0x969e('0x10'));var authService=require(_0x969e('0x11'));var qs=require(_0x969e('0x12'));var as=require(_0x969e('0x13'));var hardwareService=require(_0x969e('0x14'));var logger=require(_0x969e('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x969e('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x969e('0x17'))['db'];function respondWithStatusCode(_0x5f2193,_0x20d3b0){_0x20d3b0=_0x20d3b0||0xcc;return function(_0x2d135c){if(_0x2d135c){return _0x5f2193[_0x969e('0x18')](_0x20d3b0);}return _0x5f2193[_0x969e('0x19')](_0x20d3b0)[_0x969e('0x1a')]();};}function respondWithResult(_0x2f1d87,_0x4daedc){_0x4daedc=_0x4daedc||0xc8;return function(_0x4ea63a){if(_0x4ea63a){return _0x2f1d87[_0x969e('0x19')](_0x4daedc)['json'](_0x4ea63a);}};}function respondWithFilteredResult(_0x53072f,_0x63a9ac){return function(_0x3c3714){if(_0x3c3714){var _0x34ba53=typeof _0x63a9ac[_0x969e('0x1b')]==='undefined'&&typeof _0x63a9ac[_0x969e('0x1c')]===_0x969e('0x1d');var _0x1c58c1=_0x3c3714[_0x969e('0x1e')];var _0xe39663=_0x34ba53?0x0:_0x63a9ac[_0x969e('0x1b')];var _0x31b7aa=_0x34ba53?_0x3c3714[_0x969e('0x1e')]:_0x63a9ac[_0x969e('0x1b')]+_0x63a9ac[_0x969e('0x1c')];var _0x200ad0;if(_0x31b7aa>=_0x1c58c1){_0x31b7aa=_0x1c58c1;_0x200ad0=0xc8;}else{_0x200ad0=0xce;}_0x53072f[_0x969e('0x19')](_0x200ad0);return _0x53072f[_0x969e('0x1f')]('Content-Range',_0xe39663+'-'+_0x31b7aa+'/'+_0x1c58c1)['json'](_0x3c3714);}return null;};}function patchUpdates(_0x4707fb){return function(_0x5cdfa1){try{jsonpatch['apply'](_0x5cdfa1,_0x4707fb,!![]);}catch(_0x121be6){return BPromise[_0x969e('0x20')](_0x121be6);}return _0x5cdfa1[_0x969e('0x21')]();};}function saveUpdates(_0x2e2781,_0x2cfe6b){return function(_0x419e85){if(_0x419e85){return _0x419e85[_0x969e('0x22')](_0x2e2781)[_0x969e('0x23')](function(_0x1860c9){return _0x1860c9;});}return null;};}function removeEntity(_0x265f55,_0x33039c){return function(_0xed79a2){if(_0xed79a2){return _0xed79a2[_0x969e('0x24')]()[_0x969e('0x23')](function(){_0x265f55[_0x969e('0x19')](0xcc)[_0x969e('0x1a')]();});}};}function handleEntityNotFound(_0x2e27aa,_0x115503){return function(_0x4dd90d){if(!_0x4dd90d){_0x2e27aa[_0x969e('0x18')](0x194);}return _0x4dd90d;};}function handleError(_0x72c9be,_0x338f4b){_0x338f4b=_0x338f4b||0x1f4;return function(_0x57c18c){logger[_0x969e('0x25')](_0x57c18c[_0x969e('0x26')]);if(_0x57c18c[_0x969e('0x27')]){delete _0x57c18c[_0x969e('0x27')];}_0x72c9be[_0x969e('0x19')](_0x338f4b)[_0x969e('0x28')](_0x57c18c);};}exports[_0x969e('0x29')]=function(_0x3fd136,_0x290c6f){var _0x28e7bb={},_0x1c35a1={},_0x3aea95={'count':0x0,'rows':[]};var _0x178b61=_[_0x969e('0x2a')](db[_0x969e('0x2b')][_0x969e('0x2c')],function(_0x5f5362){return{'name':_0x5f5362[_0x969e('0x2d')],'type':_0x5f5362[_0x969e('0x2e')][_0x969e('0x2f')]};});_0x1c35a1[_0x969e('0x30')]=_[_0x969e('0x2a')](_0x178b61,_0x969e('0x27'));_0x1c35a1[_0x969e('0x31')]=_[_0x969e('0x32')](_0x3fd136[_0x969e('0x31')]);_0x1c35a1[_0x969e('0x33')]=_[_0x969e('0x34')](_0x1c35a1[_0x969e('0x30')],_0x1c35a1[_0x969e('0x31')]);_0x28e7bb[_0x969e('0x35')]=_[_0x969e('0x34')](_0x1c35a1['model'],qs[_0x969e('0x36')](_0x3fd136[_0x969e('0x31')][_0x969e('0x36')]));_0x28e7bb['attributes']=_0x28e7bb[_0x969e('0x35')][_0x969e('0x37')]?_0x28e7bb[_0x969e('0x35')]:_0x1c35a1['model'];if(!_0x3fd136[_0x969e('0x31')]['hasOwnProperty'](_0x969e('0x38'))){_0x28e7bb[_0x969e('0x1c')]=qs[_0x969e('0x1c')](_0x3fd136[_0x969e('0x31')][_0x969e('0x1c')]);_0x28e7bb[_0x969e('0x1b')]=qs['offset'](_0x3fd136['query'][_0x969e('0x1b')]);}_0x28e7bb[_0x969e('0x39')]=qs['sort'](_0x3fd136['query'][_0x969e('0x3a')]);_0x28e7bb['where']=qs['filters'](_['pick'](_0x3fd136['query'],_0x1c35a1[_0x969e('0x33')]),_0x178b61);if(_0x3fd136[_0x969e('0x31')][_0x969e('0x3b')]){_0x28e7bb['where']=_['merge'](_0x28e7bb[_0x969e('0x3c')],{'$or':_[_0x969e('0x2a')](_0x178b61,function(_0x2467e3){if(_0x2467e3[_0x969e('0x2e')]!==_0x969e('0x3d')){var _0x4c713c={};_0x4c713c[_0x2467e3[_0x969e('0x27')]]={'$like':'%'+_0x3fd136['query'][_0x969e('0x3b')]+'%'};return _0x4c713c;}})});}_0x28e7bb=_[_0x969e('0x3e')]({},_0x28e7bb,_0x3fd136[_0x969e('0x3f')]);var _0x369c7f={'where':_0x28e7bb[_0x969e('0x3c')]};return db[_0x969e('0x2b')][_0x969e('0x1e')](_0x369c7f)['then'](function(_0x444f21){_0x3aea95['count']=_0x444f21;if(_0x3fd136[_0x969e('0x31')]['includeAll']){_0x28e7bb[_0x969e('0x40')]=[{'all':!![]}];}return db[_0x969e('0x2b')][_0x969e('0x41')](_0x28e7bb);})[_0x969e('0x23')](function(_0x255019){_0x3aea95[_0x969e('0x42')]=_0x255019;return _0x3aea95;})[_0x969e('0x23')](respondWithFilteredResult(_0x290c6f,_0x28e7bb))[_0x969e('0x43')](handleError(_0x290c6f,null));};exports[_0x969e('0x44')]=function(_0x5bc8b3,_0x20e8e4){var _0x24dd7a={'raw':![],'where':{'id':_0x5bc8b3[_0x969e('0x45')]['id']}},_0x35e1a1={};_0x35e1a1[_0x969e('0x30')]=_[_0x969e('0x32')](db['ServicenowConfiguration'][_0x969e('0x2c')]);_0x35e1a1['query']=_[_0x969e('0x32')](_0x5bc8b3['query']);_0x35e1a1[_0x969e('0x33')]=_['intersection'](_0x35e1a1[_0x969e('0x30')],_0x35e1a1[_0x969e('0x31')]);_0x24dd7a['attributes']=_[_0x969e('0x34')](_0x35e1a1[_0x969e('0x30')],qs[_0x969e('0x36')](_0x5bc8b3['query'][_0x969e('0x36')]));_0x24dd7a[_0x969e('0x35')]=_0x24dd7a[_0x969e('0x35')][_0x969e('0x37')]?_0x24dd7a['attributes']:_0x35e1a1[_0x969e('0x30')];if(_0x5bc8b3[_0x969e('0x31')][_0x969e('0x46')]){_0x24dd7a[_0x969e('0x40')]=[{'all':!![]}];}_0x24dd7a=_[_0x969e('0x3e')]({},_0x24dd7a,_0x5bc8b3['options']);return db['ServicenowConfiguration'][_0x969e('0x47')](_0x24dd7a)[_0x969e('0x23')](handleEntityNotFound(_0x20e8e4,null))[_0x969e('0x23')](respondWithResult(_0x20e8e4,null))[_0x969e('0x43')](handleError(_0x20e8e4,null));};exports[_0x969e('0x48')]=function(_0x156b50,_0x28483a){return db[_0x969e('0x2b')][_0x969e('0x48')](_0x156b50['body'],{})[_0x969e('0x23')](respondWithResult(_0x28483a,0xc9))[_0x969e('0x43')](handleError(_0x28483a,null));};exports[_0x969e('0x22')]=function(_0x5f29bf,_0xdfbd29){if(_0x5f29bf[_0x969e('0x49')]['id']){delete _0x5f29bf[_0x969e('0x49')]['id'];}return db[_0x969e('0x2b')]['find']({'where':{'id':_0x5f29bf[_0x969e('0x45')]['id']}})[_0x969e('0x23')](handleEntityNotFound(_0xdfbd29,null))[_0x969e('0x23')](saveUpdates(_0x5f29bf[_0x969e('0x49')],null))[_0x969e('0x23')](respondWithResult(_0xdfbd29,null))[_0x969e('0x43')](handleError(_0xdfbd29,null));};exports[_0x969e('0x24')]=function(_0x50145d,_0x1fd34a){return db[_0x969e('0x2b')][_0x969e('0x47')]({'where':{'id':_0x50145d[_0x969e('0x45')]['id']}})[_0x969e('0x23')](handleEntityNotFound(_0x1fd34a,null))[_0x969e('0x23')](removeEntity(_0x1fd34a,null))[_0x969e('0x43')](handleError(_0x1fd34a,null));};exports[_0x969e('0x4a')]=function(_0x2c6268,_0x2e7a23,_0x3c715e){var _0x1677e2={};var _0x3d2fe8={};var _0x1e1f66;var _0x3abeea;return db['ServicenowConfiguration'][_0x969e('0x4b')]({'where':{'id':_0x2c6268[_0x969e('0x45')]['id']}})['then'](handleEntityNotFound(_0x2e7a23,null))['then'](function(_0x4fe886){if(_0x4fe886){_0x1e1f66=_0x4fe886;_0x3d2fe8[_0x969e('0x30')]=_[_0x969e('0x32')](db[_0x969e('0x4c')][_0x969e('0x2c')]);_0x3d2fe8[_0x969e('0x31')]=_['keys'](_0x2c6268[_0x969e('0x31')]);_0x3d2fe8[_0x969e('0x33')]=_[_0x969e('0x34')](_0x3d2fe8[_0x969e('0x30')],_0x3d2fe8[_0x969e('0x31')]);_0x1677e2[_0x969e('0x35')]=_[_0x969e('0x34')](_0x3d2fe8[_0x969e('0x30')],qs['fields'](_0x2c6268[_0x969e('0x31')][_0x969e('0x36')]));_0x1677e2['attributes']=_0x1677e2[_0x969e('0x35')][_0x969e('0x37')]?_0x1677e2[_0x969e('0x35')]:_0x3d2fe8['model'];_0x1677e2[_0x969e('0x39')]=qs[_0x969e('0x3a')](_0x2c6268[_0x969e('0x31')]['sort']);_0x1677e2[_0x969e('0x3c')]=qs[_0x969e('0x33')](_[_0x969e('0x4d')](_0x2c6268['query'],_0x3d2fe8['filters']));if(_0x2c6268[_0x969e('0x31')][_0x969e('0x3b')]){_0x1677e2['where']=_[_0x969e('0x3e')](_0x1677e2['where'],{'$or':_[_0x969e('0x2a')](_0x1677e2[_0x969e('0x35')],function(_0x4d7717){var _0x519217={};_0x519217[_0x4d7717]={'$like':'%'+_0x2c6268[_0x969e('0x31')][_0x969e('0x3b')]+'%'};return _0x519217;})});}_0x1677e2=_['merge']({},_0x1677e2,_0x2c6268[_0x969e('0x3f')]);return _0x1e1f66[_0x969e('0x4a')](_0x1677e2);}})[_0x969e('0x23')](function(_0x4a2683){if(_0x4a2683){_0x3abeea=_0x4a2683[_0x969e('0x37')];if(!_0x2c6268[_0x969e('0x31')][_0x969e('0x4e')](_0x969e('0x38'))){_0x1677e2[_0x969e('0x1c')]=qs['limit'](_0x2c6268[_0x969e('0x31')][_0x969e('0x1c')]);_0x1677e2['offset']=qs[_0x969e('0x1b')](_0x2c6268[_0x969e('0x31')][_0x969e('0x1b')]);}return _0x1e1f66['getFields'](_0x1677e2);}})['then'](function(_0x1991ef){if(_0x1991ef){return _0x1991ef?{'count':_0x3abeea,'rows':_0x1991ef}:null;}})[_0x969e('0x23')](respondWithResult(_0x2e7a23,null))['catch'](handleError(_0x2e7a23,null));};exports[_0x969e('0x4f')]=function(_0x2bde8f,_0x530d5e,_0x4c5ac1){var _0x3beea3={};var _0x43b944={};var _0x2aaaba;var _0x104514;return db[_0x969e('0x2b')]['findOne']({'where':{'id':_0x2bde8f[_0x969e('0x45')]['id']}})['then'](handleEntityNotFound(_0x530d5e,null))[_0x969e('0x23')](function(_0x2b4ff4){if(_0x2b4ff4){_0x2aaaba=_0x2b4ff4;_0x43b944[_0x969e('0x30')]=_[_0x969e('0x32')](db['ServicenowField'][_0x969e('0x2c')]);_0x43b944[_0x969e('0x31')]=_[_0x969e('0x32')](_0x2bde8f['query']);_0x43b944['filters']=_['intersection'](_0x43b944[_0x969e('0x30')],_0x43b944[_0x969e('0x31')]);_0x3beea3[_0x969e('0x35')]=_[_0x969e('0x34')](_0x43b944[_0x969e('0x30')],qs[_0x969e('0x36')](_0x2bde8f[_0x969e('0x31')][_0x969e('0x36')]));_0x3beea3[_0x969e('0x35')]=_0x3beea3[_0x969e('0x35')]['length']?_0x3beea3['attributes']:_0x43b944[_0x969e('0x30')];_0x3beea3[_0x969e('0x39')]=qs[_0x969e('0x3a')](_0x2bde8f[_0x969e('0x31')]['sort']);_0x3beea3['where']=qs[_0x969e('0x33')](_['pick'](_0x2bde8f[_0x969e('0x31')],_0x43b944[_0x969e('0x33')]));if(_0x2bde8f[_0x969e('0x31')]['filter']){_0x3beea3[_0x969e('0x3c')]=_[_0x969e('0x3e')](_0x3beea3[_0x969e('0x3c')],{'$or':_[_0x969e('0x2a')](_0x3beea3[_0x969e('0x35')],function(_0x3954f7){var _0x105968={};_0x105968[_0x3954f7]={'$like':'%'+_0x2bde8f['query']['filter']+'%'};return _0x105968;})});}_0x3beea3=_[_0x969e('0x3e')]({},_0x3beea3,_0x2bde8f[_0x969e('0x3f')]);return _0x2aaaba[_0x969e('0x4f')](_0x3beea3);}})[_0x969e('0x23')](function(_0x41902f){if(_0x41902f){_0x104514=_0x41902f['length'];if(!_0x2bde8f[_0x969e('0x31')][_0x969e('0x4e')](_0x969e('0x38'))){_0x3beea3['limit']=qs['limit'](_0x2bde8f['query']['limit']);_0x3beea3['offset']=qs[_0x969e('0x1b')](_0x2bde8f['query']['offset']);}return _0x2aaaba[_0x969e('0x4f')](_0x3beea3);}})[_0x969e('0x23')](function(_0x2a35f2){if(_0x2a35f2){return _0x2a35f2?{'count':_0x104514,'rows':_0x2a35f2}:null;}})['then'](respondWithResult(_0x530d5e,null))['catch'](handleError(_0x530d5e,null));};exports['getDescriptions']=function(_0x95db3b,_0x3be030,_0xce3c28){var _0x47aef2={};var _0x3a2d86={};var _0x11f74b;var _0x4f31b1;return db[_0x969e('0x2b')]['findOne']({'where':{'id':_0x95db3b['params']['id']}})[_0x969e('0x23')](handleEntityNotFound(_0x3be030,null))[_0x969e('0x23')](function(_0xdda65){if(_0xdda65){_0x11f74b=_0xdda65;_0x3a2d86[_0x969e('0x30')]=_['keys'](db[_0x969e('0x4c')][_0x969e('0x2c')]);_0x3a2d86[_0x969e('0x31')]=_[_0x969e('0x32')](_0x95db3b[_0x969e('0x31')]);_0x3a2d86[_0x969e('0x33')]=_[_0x969e('0x34')](_0x3a2d86[_0x969e('0x30')],_0x3a2d86['query']);_0x47aef2[_0x969e('0x35')]=_['intersection'](_0x3a2d86[_0x969e('0x30')],qs[_0x969e('0x36')](_0x95db3b[_0x969e('0x31')][_0x969e('0x36')]));_0x47aef2[_0x969e('0x35')]=_0x47aef2[_0x969e('0x35')]['length']?_0x47aef2[_0x969e('0x35')]:_0x3a2d86[_0x969e('0x30')];_0x47aef2[_0x969e('0x39')]=qs[_0x969e('0x3a')](_0x95db3b[_0x969e('0x31')]['sort']);_0x47aef2[_0x969e('0x3c')]=qs[_0x969e('0x33')](_[_0x969e('0x4d')](_0x95db3b[_0x969e('0x31')],_0x3a2d86[_0x969e('0x33')]));if(_0x95db3b[_0x969e('0x31')][_0x969e('0x3b')]){_0x47aef2['where']=_[_0x969e('0x3e')](_0x47aef2[_0x969e('0x3c')],{'$or':_['map'](_0x47aef2[_0x969e('0x35')],function(_0x76c086){var _0x19cf86={};_0x19cf86[_0x76c086]={'$like':'%'+_0x95db3b['query'][_0x969e('0x3b')]+'%'};return _0x19cf86;})});}_0x47aef2=_[_0x969e('0x3e')]({},_0x47aef2,_0x95db3b[_0x969e('0x3f')]);return _0x11f74b[_0x969e('0x50')](_0x47aef2);}})[_0x969e('0x23')](function(_0x343657){if(_0x343657){_0x4f31b1=_0x343657[_0x969e('0x37')];if(!_0x95db3b[_0x969e('0x31')][_0x969e('0x4e')]('nolimit')){_0x47aef2[_0x969e('0x1c')]=qs[_0x969e('0x1c')](_0x95db3b[_0x969e('0x31')]['limit']);_0x47aef2[_0x969e('0x1b')]=qs['offset'](_0x95db3b[_0x969e('0x31')]['offset']);}return _0x11f74b[_0x969e('0x50')](_0x47aef2);}})[_0x969e('0x23')](function(_0x367049){if(_0x367049){return _0x367049?{'count':_0x4f31b1,'rows':_0x367049}:null;}})[_0x969e('0x23')](respondWithResult(_0x3be030,null))['catch'](handleError(_0x3be030,null));}; \ No newline at end of file +var _0xfd27=['findAll','catch','show','params','include','find','create','body','ServicenowField','getFields','hasOwnProperty','getSubjects','findOne','getDescriptions','eml-format','rimraf','request-promise','moment','bluebird','util','fs-extra','lodash','squel','crypto','jsforce','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','status','json','offset','undefined','limit','count','Content-Range','apply','save','update','destroy','error','stack','name','send','map','ServicenowConfiguration','rawAttributes','type','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','then','includeAll'];(function(_0x457f54,_0xa50f00){var _0x21c4b=function(_0x205263){while(--_0x205263){_0x457f54['push'](_0x457f54['shift']());}};_0x21c4b(++_0xa50f00);}(_0xfd27,0xf2));var _0x7fd2=function(_0x23e01f,_0x262805){_0x23e01f=_0x23e01f-0x0;var _0x57e10d=_0xfd27[_0x23e01f];return _0x57e10d;};'use strict';var emlformat=require(_0x7fd2('0x0'));var rimraf=require(_0x7fd2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x7fd2('0x2'));var moment=require(_0x7fd2('0x3'));var BPromise=require(_0x7fd2('0x4'));var Mustache=require('mustache');var util=require(_0x7fd2('0x5'));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(_0x7fd2('0x6'));var _=require(_0x7fd2('0x7'));var squel=require(_0x7fd2('0x8'));var crypto=require(_0x7fd2('0x9'));var jsforce=require(_0x7fd2('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x7fd2('0xb'));var querystring=require(_0x7fd2('0xc'));var Papa=require(_0x7fd2('0xd'));var Redis=require('ioredis');var authService=require(_0x7fd2('0xe'));var qs=require(_0x7fd2('0xf'));var as=require(_0x7fd2('0x10'));var hardwareService=require(_0x7fd2('0x11'));var logger=require(_0x7fd2('0x12'))(_0x7fd2('0x13'));var utils=require(_0x7fd2('0x14'));var config=require(_0x7fd2('0x15'));var licenseUtil=require(_0x7fd2('0x16'));var db=require(_0x7fd2('0x17'))['db'];function respondWithStatusCode(_0x1b188a,_0x28144f){_0x28144f=_0x28144f||0xcc;return function(_0x215833){if(_0x215833){return _0x1b188a['sendStatus'](_0x28144f);}return _0x1b188a[_0x7fd2('0x18')](_0x28144f)['end']();};}function respondWithResult(_0x20dd03,_0x1b7317){_0x1b7317=_0x1b7317||0xc8;return function(_0x5c00a9){if(_0x5c00a9){return _0x20dd03[_0x7fd2('0x18')](_0x1b7317)[_0x7fd2('0x19')](_0x5c00a9);}};}function respondWithFilteredResult(_0x445047,_0x5e98a4){return function(_0x5a7031){if(_0x5a7031){var _0x36899f=typeof _0x5e98a4[_0x7fd2('0x1a')]===_0x7fd2('0x1b')&&typeof _0x5e98a4[_0x7fd2('0x1c')]===_0x7fd2('0x1b');var _0xac5b42=_0x5a7031[_0x7fd2('0x1d')];var _0x231df4=_0x36899f?0x0:_0x5e98a4['offset'];var _0x3a17e3=_0x36899f?_0x5a7031[_0x7fd2('0x1d')]:_0x5e98a4[_0x7fd2('0x1a')]+_0x5e98a4['limit'];var _0x1cfef7;if(_0x3a17e3>=_0xac5b42){_0x3a17e3=_0xac5b42;_0x1cfef7=0xc8;}else{_0x1cfef7=0xce;}_0x445047[_0x7fd2('0x18')](_0x1cfef7);return _0x445047['set'](_0x7fd2('0x1e'),_0x231df4+'-'+_0x3a17e3+'/'+_0xac5b42)['json'](_0x5a7031);}return null;};}function patchUpdates(_0x1b7c76){return function(_0x748868){try{jsonpatch[_0x7fd2('0x1f')](_0x748868,_0x1b7c76,!![]);}catch(_0x540d1d){return BPromise['reject'](_0x540d1d);}return _0x748868[_0x7fd2('0x20')]();};}function saveUpdates(_0x1c525b,_0x164811){return function(_0x2bde16){if(_0x2bde16){return _0x2bde16[_0x7fd2('0x21')](_0x1c525b)['then'](function(_0x547559){return _0x547559;});}return null;};}function removeEntity(_0x192281,_0x91d8f6){return function(_0x5ceea3){if(_0x5ceea3){return _0x5ceea3[_0x7fd2('0x22')]()['then'](function(){_0x192281[_0x7fd2('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x762ff6,_0x321658){return function(_0x49eb26){if(!_0x49eb26){_0x762ff6['sendStatus'](0x194);}return _0x49eb26;};}function handleError(_0x3b657a,_0x27a10a){_0x27a10a=_0x27a10a||0x1f4;return function(_0x499ff1){logger[_0x7fd2('0x23')](_0x499ff1[_0x7fd2('0x24')]);if(_0x499ff1[_0x7fd2('0x25')]){delete _0x499ff1[_0x7fd2('0x25')];}_0x3b657a[_0x7fd2('0x18')](_0x27a10a)[_0x7fd2('0x26')](_0x499ff1);};}exports['index']=function(_0x366590,_0x220eae){var _0x11dc93={},_0x4df016={},_0x5ada4c={'count':0x0,'rows':[]};var _0x59d555=_[_0x7fd2('0x27')](db[_0x7fd2('0x28')][_0x7fd2('0x29')],function(_0x24feec){return{'name':_0x24feec['fieldName'],'type':_0x24feec[_0x7fd2('0x2a')]['key']};});_0x4df016[_0x7fd2('0x2b')]=_['map'](_0x59d555,_0x7fd2('0x25'));_0x4df016[_0x7fd2('0x2c')]=_[_0x7fd2('0x2d')](_0x366590[_0x7fd2('0x2c')]);_0x4df016[_0x7fd2('0x2e')]=_[_0x7fd2('0x2f')](_0x4df016[_0x7fd2('0x2b')],_0x4df016[_0x7fd2('0x2c')]);_0x11dc93['attributes']=_[_0x7fd2('0x2f')](_0x4df016[_0x7fd2('0x2b')],qs[_0x7fd2('0x30')](_0x366590[_0x7fd2('0x2c')][_0x7fd2('0x30')]));_0x11dc93[_0x7fd2('0x31')]=_0x11dc93[_0x7fd2('0x31')][_0x7fd2('0x32')]?_0x11dc93[_0x7fd2('0x31')]:_0x4df016['model'];if(!_0x366590[_0x7fd2('0x2c')]['hasOwnProperty'](_0x7fd2('0x33'))){_0x11dc93[_0x7fd2('0x1c')]=qs[_0x7fd2('0x1c')](_0x366590[_0x7fd2('0x2c')][_0x7fd2('0x1c')]);_0x11dc93[_0x7fd2('0x1a')]=qs[_0x7fd2('0x1a')](_0x366590['query'][_0x7fd2('0x1a')]);}_0x11dc93[_0x7fd2('0x34')]=qs[_0x7fd2('0x35')](_0x366590[_0x7fd2('0x2c')][_0x7fd2('0x35')]);_0x11dc93[_0x7fd2('0x36')]=qs[_0x7fd2('0x2e')](_[_0x7fd2('0x37')](_0x366590['query'],_0x4df016[_0x7fd2('0x2e')]),_0x59d555);if(_0x366590[_0x7fd2('0x2c')][_0x7fd2('0x38')]){_0x11dc93[_0x7fd2('0x36')]=_['merge'](_0x11dc93[_0x7fd2('0x36')],{'$or':_['map'](_0x59d555,function(_0x22114e){if(_0x22114e['type']!==_0x7fd2('0x39')){var _0x364b1e={};_0x364b1e[_0x22114e[_0x7fd2('0x25')]]={'$like':'%'+_0x366590[_0x7fd2('0x2c')][_0x7fd2('0x38')]+'%'};return _0x364b1e;}})});}_0x11dc93=_[_0x7fd2('0x3a')]({},_0x11dc93,_0x366590[_0x7fd2('0x3b')]);var _0x392677={'where':_0x11dc93[_0x7fd2('0x36')]};return db[_0x7fd2('0x28')][_0x7fd2('0x1d')](_0x392677)[_0x7fd2('0x3c')](function(_0xed0f92){_0x5ada4c[_0x7fd2('0x1d')]=_0xed0f92;if(_0x366590['query'][_0x7fd2('0x3d')]){_0x11dc93['include']=[{'all':!![]}];}return db[_0x7fd2('0x28')][_0x7fd2('0x3e')](_0x11dc93);})[_0x7fd2('0x3c')](function(_0x376e91){_0x5ada4c['rows']=_0x376e91;return _0x5ada4c;})['then'](respondWithFilteredResult(_0x220eae,_0x11dc93))[_0x7fd2('0x3f')](handleError(_0x220eae,null));};exports[_0x7fd2('0x40')]=function(_0x20c15e,_0x3e605f){var _0x5ca4f7={'raw':![],'where':{'id':_0x20c15e[_0x7fd2('0x41')]['id']}},_0x297807={};_0x297807[_0x7fd2('0x2b')]=_[_0x7fd2('0x2d')](db[_0x7fd2('0x28')][_0x7fd2('0x29')]);_0x297807[_0x7fd2('0x2c')]=_[_0x7fd2('0x2d')](_0x20c15e[_0x7fd2('0x2c')]);_0x297807[_0x7fd2('0x2e')]=_[_0x7fd2('0x2f')](_0x297807[_0x7fd2('0x2b')],_0x297807[_0x7fd2('0x2c')]);_0x5ca4f7[_0x7fd2('0x31')]=_[_0x7fd2('0x2f')](_0x297807[_0x7fd2('0x2b')],qs['fields'](_0x20c15e[_0x7fd2('0x2c')][_0x7fd2('0x30')]));_0x5ca4f7[_0x7fd2('0x31')]=_0x5ca4f7[_0x7fd2('0x31')][_0x7fd2('0x32')]?_0x5ca4f7[_0x7fd2('0x31')]:_0x297807['model'];if(_0x20c15e['query'][_0x7fd2('0x3d')]){_0x5ca4f7[_0x7fd2('0x42')]=[{'all':!![]}];}_0x5ca4f7=_[_0x7fd2('0x3a')]({},_0x5ca4f7,_0x20c15e['options']);return db[_0x7fd2('0x28')][_0x7fd2('0x43')](_0x5ca4f7)[_0x7fd2('0x3c')](handleEntityNotFound(_0x3e605f,null))[_0x7fd2('0x3c')](respondWithResult(_0x3e605f,null))[_0x7fd2('0x3f')](handleError(_0x3e605f,null));};exports[_0x7fd2('0x44')]=function(_0x459669,_0xf41b1a){return db[_0x7fd2('0x28')][_0x7fd2('0x44')](_0x459669['body'],{})['then'](respondWithResult(_0xf41b1a,0xc9))[_0x7fd2('0x3f')](handleError(_0xf41b1a,null));};exports['update']=function(_0x52b1f5,_0x4c4a8a){if(_0x52b1f5[_0x7fd2('0x45')]['id']){delete _0x52b1f5[_0x7fd2('0x45')]['id'];}return db[_0x7fd2('0x28')]['find']({'where':{'id':_0x52b1f5[_0x7fd2('0x41')]['id']}})[_0x7fd2('0x3c')](handleEntityNotFound(_0x4c4a8a,null))[_0x7fd2('0x3c')](saveUpdates(_0x52b1f5[_0x7fd2('0x45')],null))[_0x7fd2('0x3c')](respondWithResult(_0x4c4a8a,null))[_0x7fd2('0x3f')](handleError(_0x4c4a8a,null));};exports[_0x7fd2('0x22')]=function(_0x55f658,_0x3cbdce){return db[_0x7fd2('0x28')]['find']({'where':{'id':_0x55f658['params']['id']}})[_0x7fd2('0x3c')](handleEntityNotFound(_0x3cbdce,null))['then'](removeEntity(_0x3cbdce,null))[_0x7fd2('0x3f')](handleError(_0x3cbdce,null));};exports['getFields']=function(_0x71b34,_0x41e205,_0x388433){var _0x35d26={};var _0x1b2247={};var _0x519065;var _0x1d5a14;return db[_0x7fd2('0x28')]['findOne']({'where':{'id':_0x71b34[_0x7fd2('0x41')]['id']}})[_0x7fd2('0x3c')](handleEntityNotFound(_0x41e205,null))['then'](function(_0x334ebc){if(_0x334ebc){_0x519065=_0x334ebc;_0x1b2247[_0x7fd2('0x2b')]=_[_0x7fd2('0x2d')](db[_0x7fd2('0x46')][_0x7fd2('0x29')]);_0x1b2247[_0x7fd2('0x2c')]=_[_0x7fd2('0x2d')](_0x71b34[_0x7fd2('0x2c')]);_0x1b2247[_0x7fd2('0x2e')]=_[_0x7fd2('0x2f')](_0x1b2247['model'],_0x1b2247[_0x7fd2('0x2c')]);_0x35d26[_0x7fd2('0x31')]=_[_0x7fd2('0x2f')](_0x1b2247[_0x7fd2('0x2b')],qs[_0x7fd2('0x30')](_0x71b34['query']['fields']));_0x35d26['attributes']=_0x35d26[_0x7fd2('0x31')][_0x7fd2('0x32')]?_0x35d26[_0x7fd2('0x31')]:_0x1b2247[_0x7fd2('0x2b')];_0x35d26[_0x7fd2('0x34')]=qs['sort'](_0x71b34[_0x7fd2('0x2c')]['sort']);_0x35d26[_0x7fd2('0x36')]=qs['filters'](_[_0x7fd2('0x37')](_0x71b34['query'],_0x1b2247[_0x7fd2('0x2e')]));if(_0x71b34[_0x7fd2('0x2c')][_0x7fd2('0x38')]){_0x35d26['where']=_[_0x7fd2('0x3a')](_0x35d26[_0x7fd2('0x36')],{'$or':_[_0x7fd2('0x27')](_0x35d26[_0x7fd2('0x31')],function(_0x3b9dff){var _0x1aca67={};_0x1aca67[_0x3b9dff]={'$like':'%'+_0x71b34[_0x7fd2('0x2c')][_0x7fd2('0x38')]+'%'};return _0x1aca67;})});}_0x35d26=_[_0x7fd2('0x3a')]({},_0x35d26,_0x71b34['options']);return _0x519065[_0x7fd2('0x47')](_0x35d26);}})[_0x7fd2('0x3c')](function(_0x1a8709){if(_0x1a8709){_0x1d5a14=_0x1a8709[_0x7fd2('0x32')];if(!_0x71b34['query'][_0x7fd2('0x48')](_0x7fd2('0x33'))){_0x35d26['limit']=qs[_0x7fd2('0x1c')](_0x71b34[_0x7fd2('0x2c')][_0x7fd2('0x1c')]);_0x35d26['offset']=qs[_0x7fd2('0x1a')](_0x71b34[_0x7fd2('0x2c')][_0x7fd2('0x1a')]);}return _0x519065[_0x7fd2('0x47')](_0x35d26);}})['then'](function(_0x1aad04){if(_0x1aad04){return _0x1aad04?{'count':_0x1d5a14,'rows':_0x1aad04}:null;}})[_0x7fd2('0x3c')](respondWithResult(_0x41e205,null))[_0x7fd2('0x3f')](handleError(_0x41e205,null));};exports[_0x7fd2('0x49')]=function(_0x4d42d8,_0x47db7e,_0x37a7fb){var _0x5e79c6={};var _0x5d6fff={};var _0x232e58;var _0x2154dd;return db[_0x7fd2('0x28')][_0x7fd2('0x4a')]({'where':{'id':_0x4d42d8[_0x7fd2('0x41')]['id']}})[_0x7fd2('0x3c')](handleEntityNotFound(_0x47db7e,null))[_0x7fd2('0x3c')](function(_0x547fad){if(_0x547fad){_0x232e58=_0x547fad;_0x5d6fff['model']=_[_0x7fd2('0x2d')](db[_0x7fd2('0x46')][_0x7fd2('0x29')]);_0x5d6fff[_0x7fd2('0x2c')]=_[_0x7fd2('0x2d')](_0x4d42d8['query']);_0x5d6fff[_0x7fd2('0x2e')]=_['intersection'](_0x5d6fff[_0x7fd2('0x2b')],_0x5d6fff[_0x7fd2('0x2c')]);_0x5e79c6[_0x7fd2('0x31')]=_[_0x7fd2('0x2f')](_0x5d6fff[_0x7fd2('0x2b')],qs['fields'](_0x4d42d8[_0x7fd2('0x2c')][_0x7fd2('0x30')]));_0x5e79c6[_0x7fd2('0x31')]=_0x5e79c6[_0x7fd2('0x31')][_0x7fd2('0x32')]?_0x5e79c6[_0x7fd2('0x31')]:_0x5d6fff[_0x7fd2('0x2b')];_0x5e79c6['order']=qs[_0x7fd2('0x35')](_0x4d42d8[_0x7fd2('0x2c')][_0x7fd2('0x35')]);_0x5e79c6[_0x7fd2('0x36')]=qs['filters'](_[_0x7fd2('0x37')](_0x4d42d8[_0x7fd2('0x2c')],_0x5d6fff['filters']));if(_0x4d42d8['query']['filter']){_0x5e79c6[_0x7fd2('0x36')]=_[_0x7fd2('0x3a')](_0x5e79c6[_0x7fd2('0x36')],{'$or':_['map'](_0x5e79c6['attributes'],function(_0xb8480a){var _0x15aab7={};_0x15aab7[_0xb8480a]={'$like':'%'+_0x4d42d8[_0x7fd2('0x2c')]['filter']+'%'};return _0x15aab7;})});}_0x5e79c6=_['merge']({},_0x5e79c6,_0x4d42d8[_0x7fd2('0x3b')]);return _0x232e58['getSubjects'](_0x5e79c6);}})['then'](function(_0x1ae8de){if(_0x1ae8de){_0x2154dd=_0x1ae8de[_0x7fd2('0x32')];if(!_0x4d42d8[_0x7fd2('0x2c')][_0x7fd2('0x48')](_0x7fd2('0x33'))){_0x5e79c6[_0x7fd2('0x1c')]=qs[_0x7fd2('0x1c')](_0x4d42d8[_0x7fd2('0x2c')]['limit']);_0x5e79c6[_0x7fd2('0x1a')]=qs[_0x7fd2('0x1a')](_0x4d42d8[_0x7fd2('0x2c')]['offset']);}return _0x232e58['getSubjects'](_0x5e79c6);}})['then'](function(_0x411b89){if(_0x411b89){return _0x411b89?{'count':_0x2154dd,'rows':_0x411b89}:null;}})[_0x7fd2('0x3c')](respondWithResult(_0x47db7e,null))[_0x7fd2('0x3f')](handleError(_0x47db7e,null));};exports[_0x7fd2('0x4b')]=function(_0xaa70fd,_0x1daf8f,_0x5c5384){var _0x57d519={};var _0xd9971={};var _0x551964;var _0xf27ce;return db[_0x7fd2('0x28')][_0x7fd2('0x4a')]({'where':{'id':_0xaa70fd[_0x7fd2('0x41')]['id']}})['then'](handleEntityNotFound(_0x1daf8f,null))[_0x7fd2('0x3c')](function(_0x576f31){if(_0x576f31){_0x551964=_0x576f31;_0xd9971['model']=_[_0x7fd2('0x2d')](db[_0x7fd2('0x46')][_0x7fd2('0x29')]);_0xd9971['query']=_[_0x7fd2('0x2d')](_0xaa70fd[_0x7fd2('0x2c')]);_0xd9971[_0x7fd2('0x2e')]=_[_0x7fd2('0x2f')](_0xd9971[_0x7fd2('0x2b')],_0xd9971[_0x7fd2('0x2c')]);_0x57d519['attributes']=_[_0x7fd2('0x2f')](_0xd9971[_0x7fd2('0x2b')],qs[_0x7fd2('0x30')](_0xaa70fd[_0x7fd2('0x2c')][_0x7fd2('0x30')]));_0x57d519[_0x7fd2('0x31')]=_0x57d519[_0x7fd2('0x31')][_0x7fd2('0x32')]?_0x57d519[_0x7fd2('0x31')]:_0xd9971['model'];_0x57d519[_0x7fd2('0x34')]=qs[_0x7fd2('0x35')](_0xaa70fd[_0x7fd2('0x2c')][_0x7fd2('0x35')]);_0x57d519[_0x7fd2('0x36')]=qs[_0x7fd2('0x2e')](_[_0x7fd2('0x37')](_0xaa70fd[_0x7fd2('0x2c')],_0xd9971[_0x7fd2('0x2e')]));if(_0xaa70fd['query']['filter']){_0x57d519[_0x7fd2('0x36')]=_[_0x7fd2('0x3a')](_0x57d519['where'],{'$or':_[_0x7fd2('0x27')](_0x57d519[_0x7fd2('0x31')],function(_0x5a1616){var _0x4f3e73={};_0x4f3e73[_0x5a1616]={'$like':'%'+_0xaa70fd[_0x7fd2('0x2c')][_0x7fd2('0x38')]+'%'};return _0x4f3e73;})});}_0x57d519=_['merge']({},_0x57d519,_0xaa70fd[_0x7fd2('0x3b')]);return _0x551964['getDescriptions'](_0x57d519);}})[_0x7fd2('0x3c')](function(_0x5d0bd9){if(_0x5d0bd9){_0xf27ce=_0x5d0bd9['length'];if(!_0xaa70fd['query'][_0x7fd2('0x48')](_0x7fd2('0x33'))){_0x57d519['limit']=qs[_0x7fd2('0x1c')](_0xaa70fd[_0x7fd2('0x2c')][_0x7fd2('0x1c')]);_0x57d519[_0x7fd2('0x1a')]=qs[_0x7fd2('0x1a')](_0xaa70fd['query']['offset']);}return _0x551964['getDescriptions'](_0x57d519);}})[_0x7fd2('0x3c')](function(_0x9d5e1b){if(_0x9d5e1b){return _0x9d5e1b?{'count':_0xf27ce,'rows':_0x9d5e1b}:null;}})[_0x7fd2('0x3c')](respondWithResult(_0x1daf8f,null))[_0x7fd2('0x3f')](handleError(_0x1daf8f,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index d93580d..d7e36f2 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 _0x2dd8=['../../config/environment','./intServicenowConfiguration.attributes','define','ServicenowConfiguration','lodash','util','moment','bluebird','request-promise','path','rimraf'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x2dd8,0x143));var _0x82dd=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x2dd8[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x82dd('0x0'));var util=require(_0x82dd('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x82dd('0x2'));var BPromise=require(_0x82dd('0x3'));var rp=require(_0x82dd('0x4'));var fs=require('fs');var path=require(_0x82dd('0x5'));var rimraf=require(_0x82dd('0x6'));var config=require(_0x82dd('0x7'));var attributes=require(_0x82dd('0x8'));module['exports']=function(_0x4026c3,_0x1cfdce){return _0x4026c3[_0x82dd('0x9')](_0x82dd('0xa'),attributes,{'tableName':'int_servicenow_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9672=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./intServicenowConfiguration.attributes','define','ServicenowConfiguration','int_servicenow_configurations','lodash','util'];(function(_0x566124,_0x2b7e7e){var _0x558346=function(_0x40056a){while(--_0x40056a){_0x566124['push'](_0x566124['shift']());}};_0x558346(++_0x2b7e7e);}(_0x9672,0xee));var _0x2967=function(_0x22ba6a,_0x4ee04d){_0x22ba6a=_0x22ba6a-0x0;var _0x3029e1=_0x9672[_0x22ba6a];return _0x3029e1;};'use strict';var _=require(_0x2967('0x0'));var util=require(_0x2967('0x1'));var logger=require('../../config/logger')(_0x2967('0x2'));var moment=require(_0x2967('0x3'));var BPromise=require(_0x2967('0x4'));var rp=require(_0x2967('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2967('0x6'));var config=require(_0x2967('0x7'));var attributes=require(_0x2967('0x8'));module['exports']=function(_0x4baad7,_0x24424d){return _0x4baad7[_0x2967('0x9')](_0x2967('0xa'),attributes,{'tableName':_0x2967('0xb'),'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 8a45128..c748970 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 _0x6a88=['http','request','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x4cc1e4,_0x37b9f7){var _0x25cbcc=function(_0x2f617e){while(--_0x2f617e){_0x4cc1e4['push'](_0x4cc1e4['shift']());}};_0x25cbcc(++_0x37b9f7);}(_0x6a88,0x66));var _0x86a8=function(_0x4e0b8c,_0x443f31){_0x4e0b8c=_0x4e0b8c-0x0;var _0x633ecc=_0x6a88[_0x4e0b8c];return _0x633ecc;};'use strict';var _=require(_0x86a8('0x0'));var util=require(_0x86a8('0x1'));var moment=require(_0x86a8('0x2'));var BPromise=require(_0x86a8('0x3'));var rs=require(_0x86a8('0x4'));var fs=require('fs');var Redis=require(_0x86a8('0x5'));var db=require(_0x86a8('0x6'))['db'];var utils=require(_0x86a8('0x7'));var logger=require(_0x86a8('0x8'))(_0x86a8('0x9'));var config=require(_0x86a8('0xa'));var jayson=require(_0x86a8('0xb'));var client=jayson[_0x86a8('0xc')][_0x86a8('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x3ad7f4,_0x180a0d,_0x5ab20a){return new BPromise(function(_0x11d890,_0x5c7204){return client[_0x86a8('0xe')](_0x3ad7f4,_0x5ab20a)['then'](function(_0xa5e0ad){logger['info'](_0x86a8('0xf'),_0x180a0d,_0x86a8('0x10'));logger[_0x86a8('0x11')]('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0x180a0d,_0x86a8('0x10'),JSON[_0x86a8('0x12')](_0xa5e0ad));if(_0xa5e0ad[_0x86a8('0x13')]){if(_0xa5e0ad[_0x86a8('0x13')][_0x86a8('0x14')]===0x1f4){logger['error'](_0x86a8('0xf'),_0x180a0d,_0xa5e0ad['error'][_0x86a8('0x15')]);return _0x5c7204(_0xa5e0ad[_0x86a8('0x13')]['message']);}logger['error'](_0x86a8('0xf'),_0x180a0d,_0xa5e0ad[_0x86a8('0x13')][_0x86a8('0x15')]);return _0x11d890(_0xa5e0ad['error'][_0x86a8('0x15')]);}else{logger['info']('ServicenowConfiguration,\x20%s,\x20%s',_0x180a0d,_0x86a8('0x10'));_0x11d890(_0xa5e0ad['result'][_0x86a8('0x15')]);}})[_0x86a8('0x16')](function(_0xcc74a4){logger[_0x86a8('0x13')](_0x86a8('0xf'),_0x180a0d,_0xcc74a4);_0x5c7204(_0xcc74a4);});});} \ No newline at end of file +var _0xa12e=['info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then'];(function(_0x36625f,_0x727bd6){var _0x135981=function(_0x1d8f24){while(--_0x1d8f24){_0x36625f['push'](_0x36625f['shift']());}};_0x135981(++_0x727bd6);}(_0xa12e,0x6f));var _0xea12=function(_0x11e2b0,_0x386c82){_0x11e2b0=_0x11e2b0-0x0;var _0x1b9672=_0xa12e[_0x11e2b0];return _0x1b9672;};'use strict';var _=require(_0xea12('0x0'));var util=require(_0xea12('0x1'));var moment=require(_0xea12('0x2'));var BPromise=require('bluebird');var rs=require(_0xea12('0x3'));var fs=require('fs');var Redis=require(_0xea12('0x4'));var db=require(_0xea12('0x5'))['db'];var utils=require(_0xea12('0x6'));var logger=require(_0xea12('0x7'))(_0xea12('0x8'));var config=require('../../config/environment');var jayson=require(_0xea12('0x9'));var client=jayson[_0xea12('0xa')][_0xea12('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x575474,_0x433842,_0x203238){return new BPromise(function(_0x7c3cad,_0x3616a4){return client[_0xea12('0xc')](_0x575474,_0x203238)[_0xea12('0xd')](function(_0x1cd1a8){logger[_0xea12('0xe')](_0xea12('0xf'),_0x433842,_0xea12('0x10'));logger[_0xea12('0x11')](_0xea12('0x12'),_0x433842,_0xea12('0x10'),JSON[_0xea12('0x13')](_0x1cd1a8));if(_0x1cd1a8[_0xea12('0x14')]){if(_0x1cd1a8[_0xea12('0x14')][_0xea12('0x15')]===0x1f4){logger[_0xea12('0x14')](_0xea12('0xf'),_0x433842,_0x1cd1a8['error'][_0xea12('0x16')]);return _0x3616a4(_0x1cd1a8[_0xea12('0x14')][_0xea12('0x16')]);}logger[_0xea12('0x14')](_0xea12('0xf'),_0x433842,_0x1cd1a8[_0xea12('0x14')][_0xea12('0x16')]);return _0x7c3cad(_0x1cd1a8['error'][_0xea12('0x16')]);}else{logger[_0xea12('0xe')](_0xea12('0xf'),_0x433842,'request\x20sent');_0x7c3cad(_0x1cd1a8[_0xea12('0x17')][_0xea12('0x16')]);}})[_0xea12('0x18')](function(_0x24bf9e){logger['error'](_0xea12('0xf'),_0x433842,_0x24bf9e);_0x3616a4(_0x24bf9e);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 357ae06..067c592 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 _0x55a0=['index','/:id','isAuthenticated','show','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intServicenowField.controller','get'];(function(_0xa462fc,_0x307e1d){var _0xa850d9=function(_0x202193){while(--_0x202193){_0xa462fc['push'](_0xa462fc['shift']());}};_0xa850d9(++_0x307e1d);}(_0x55a0,0x14b));var _0x055a=function(_0x1cadce,_0xa2642){_0x1cadce=_0x1cadce-0x0;var _0x4e9be9=_0x55a0[_0x1cadce];return _0x4e9be9;};'use strict';var multer=require(_0x055a('0x0'));var util=require(_0x055a('0x1'));var path=require(_0x055a('0x2'));var timeout=require(_0x055a('0x3'));var express=require(_0x055a('0x4'));var router=express[_0x055a('0x5')]();var fs_extra=require(_0x055a('0x6'));var auth=require(_0x055a('0x7'));var interaction=require(_0x055a('0x8'));var config=require('../../config/environment');var controller=require(_0x055a('0x9'));router[_0x055a('0xa')]('/',auth['isAuthenticated'](),controller[_0x055a('0xb')]);router[_0x055a('0xa')](_0x055a('0xc'),auth[_0x055a('0xd')](),controller[_0x055a('0xe')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x055a('0xf')](_0x055a('0xc'),auth[_0x055a('0xd')](),controller[_0x055a('0x10')]);router[_0x055a('0x11')](_0x055a('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x055a('0x12')]=router; \ No newline at end of file +var _0xad01=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intServicenowField.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer','util'];(function(_0x544bde,_0xc4ad39){var _0x53f06e=function(_0x4e3750){while(--_0x4e3750){_0x544bde['push'](_0x544bde['shift']());}};_0x53f06e(++_0xc4ad39);}(_0xad01,0x18a));var _0x1ad0=function(_0x55fe82,_0x329b56){_0x55fe82=_0x55fe82-0x0;var _0xc3b698=_0xad01[_0x55fe82];return _0xc3b698;};'use strict';var multer=require(_0x1ad0('0x0'));var util=require(_0x1ad0('0x1'));var path=require(_0x1ad0('0x2'));var timeout=require(_0x1ad0('0x3'));var express=require(_0x1ad0('0x4'));var router=express[_0x1ad0('0x5')]();var fs_extra=require(_0x1ad0('0x6'));var auth=require(_0x1ad0('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x1ad0('0x8'));var controller=require(_0x1ad0('0x9'));router[_0x1ad0('0xa')]('/',auth[_0x1ad0('0xb')](),controller[_0x1ad0('0xc')]);router[_0x1ad0('0xa')](_0x1ad0('0xd'),auth[_0x1ad0('0xb')](),controller[_0x1ad0('0xe')]);router[_0x1ad0('0xf')]('/',auth[_0x1ad0('0xb')](),controller[_0x1ad0('0x10')]);router[_0x1ad0('0x11')]('/:id',auth[_0x1ad0('0xb')](),controller[_0x1ad0('0x12')]);router[_0x1ad0('0x13')](_0x1ad0('0xd'),auth[_0x1ad0('0xb')](),controller[_0x1ad0('0x14')]);module[_0x1ad0('0x15')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index 2616b84..a393af7 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 _0x61cf=['sequelize','ENUM','string','customVariable','keyValue','picklist','STRING','variable','BOOLEAN'];(function(_0x3feca4,_0xda09bc){var _0x4a8f83=function(_0x39ca42){while(--_0x39ca42){_0x3feca4['push'](_0x3feca4['shift']());}};_0x4a8f83(++_0xda09bc);}(_0x61cf,0xb4));var _0xf61c=function(_0x247e3e,_0x51411e){_0x247e3e=_0x247e3e-0x0;var _0x46085e=_0x61cf[_0x247e3e];return _0x46085e;};'use strict';var Sequelize=require(_0xf61c('0x0'));module['exports']={'type':{'type':Sequelize[_0xf61c('0x1')](_0xf61c('0x2'),'variable',_0xf61c('0x3'),_0xf61c('0x4'),_0xf61c('0x5')),'defaultValue':_0xf61c('0x2')},'content':{'type':Sequelize[_0xf61c('0x6')]},'key':{'type':Sequelize[_0xf61c('0x6')]},'keyType':{'type':Sequelize['ENUM']('string',_0xf61c('0x7'),_0xf61c('0x3'))},'keyContent':{'type':Sequelize[_0xf61c('0x6')]},'idField':{'type':Sequelize[_0xf61c('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xf61c('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xf61c('0x6')]}}; \ No newline at end of file +var _0x48b4=['picklist','string','STRING','sequelize','ENUM','variable','customVariable','keyValue'];(function(_0x504764,_0x2488e9){var _0x4f68d7=function(_0xc4328e){while(--_0xc4328e){_0x504764['push'](_0x504764['shift']());}};_0x4f68d7(++_0x2488e9);}(_0x48b4,0x12b));var _0x448b=function(_0x3aa1ef,_0x1a0f5c){_0x3aa1ef=_0x3aa1ef-0x0;var _0x3bcd84=_0x48b4[_0x3aa1ef];return _0x3bcd84;};'use strict';var Sequelize=require(_0x448b('0x0'));module['exports']={'type':{'type':Sequelize[_0x448b('0x1')]('string',_0x448b('0x2'),_0x448b('0x3'),_0x448b('0x4'),_0x448b('0x5')),'defaultValue':_0x448b('0x6')},'content':{'type':Sequelize[_0x448b('0x7')]},'key':{'type':Sequelize[_0x448b('0x7')]},'keyType':{'type':Sequelize[_0x448b('0x1')](_0x448b('0x6'),'variable',_0x448b('0x3'))},'keyContent':{'type':Sequelize[_0x448b('0x7')]},'idField':{'type':Sequelize[_0x448b('0x7')]},'nameField':{'type':Sequelize[_0x448b('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x448b('0x7')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index dcec455..a86b5d5 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 _0xa482=['params','rawAttributes','attributes','find','create','body','update','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','json','undefined','limit','offset','set','Content-Range','reject','save','then','destroy','end','error','stack','name','status','send','index','map','ServicenowField','type','model','query','keys','filters','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch'];(function(_0x3c3ec7,_0x321114){var _0x535807=function(_0x3bc510){while(--_0x3bc510){_0x3c3ec7['push'](_0x3c3ec7['shift']());}};_0x535807(++_0x321114);}(_0xa482,0x127));var _0x2a48=function(_0x1f01ba,_0x5c456f){_0x1f01ba=_0x1f01ba-0x0;var _0x27598f=_0xa482[_0x1f01ba];return _0x27598f;};'use strict';var emlformat=require(_0x2a48('0x0'));var rimraf=require(_0x2a48('0x1'));var zipdir=require(_0x2a48('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2a48('0x3'));var moment=require('moment');var BPromise=require(_0x2a48('0x4'));var Mustache=require(_0x2a48('0x5'));var util=require(_0x2a48('0x6'));var path=require(_0x2a48('0x7'));var sox=require(_0x2a48('0x8'));var csv=require(_0x2a48('0x9'));var ejs=require(_0x2a48('0xa'));var fs=require('fs');var fs_extra=require(_0x2a48('0xb'));var _=require(_0x2a48('0xc'));var squel=require(_0x2a48('0xd'));var crypto=require(_0x2a48('0xe'));var jsforce=require(_0x2a48('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x2a48('0x9'));var querystring=require(_0x2a48('0x10'));var Papa=require(_0x2a48('0x11'));var Redis=require(_0x2a48('0x12'));var authService=require(_0x2a48('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2a48('0x14'));var logger=require(_0x2a48('0x15'))(_0x2a48('0x16'));var utils=require(_0x2a48('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x2a48('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x45580e,_0x3743e8){_0x3743e8=_0x3743e8||0xcc;return function(_0x44be98){if(_0x44be98){return _0x45580e[_0x2a48('0x19')](_0x3743e8);}return _0x45580e['status'](_0x3743e8)['end']();};}function respondWithResult(_0x36e3ba,_0x23a042){_0x23a042=_0x23a042||0xc8;return function(_0x2b6d00){if(_0x2b6d00){return _0x36e3ba['status'](_0x23a042)[_0x2a48('0x1a')](_0x2b6d00);}};}function respondWithFilteredResult(_0xb0b885,_0x58f690){return function(_0x264d04){if(_0x264d04){var _0x5b035f=typeof _0x58f690['offset']===_0x2a48('0x1b')&&typeof _0x58f690[_0x2a48('0x1c')]===_0x2a48('0x1b');var _0x94551c=_0x264d04['count'];var _0x1952be=_0x5b035f?0x0:_0x58f690['offset'];var _0x52536b=_0x5b035f?_0x264d04['count']:_0x58f690[_0x2a48('0x1d')]+_0x58f690['limit'];var _0x3cae81;if(_0x52536b>=_0x94551c){_0x52536b=_0x94551c;_0x3cae81=0xc8;}else{_0x3cae81=0xce;}_0xb0b885['status'](_0x3cae81);return _0xb0b885[_0x2a48('0x1e')](_0x2a48('0x1f'),_0x1952be+'-'+_0x52536b+'/'+_0x94551c)[_0x2a48('0x1a')](_0x264d04);}return null;};}function patchUpdates(_0x95a80c){return function(_0x2d9ed4){try{jsonpatch['apply'](_0x2d9ed4,_0x95a80c,!![]);}catch(_0x453ecb){return BPromise[_0x2a48('0x20')](_0x453ecb);}return _0x2d9ed4[_0x2a48('0x21')]();};}function saveUpdates(_0x15ce63,_0x5642bf){return function(_0x1b966d){if(_0x1b966d){return _0x1b966d['update'](_0x15ce63)[_0x2a48('0x22')](function(_0x2e2944){return _0x2e2944;});}return null;};}function removeEntity(_0x3dc3d8,_0xb77164){return function(_0x31d528){if(_0x31d528){return _0x31d528[_0x2a48('0x23')]()[_0x2a48('0x22')](function(){_0x3dc3d8['status'](0xcc)[_0x2a48('0x24')]();});}};}function handleEntityNotFound(_0x1222bd,_0x522d51){return function(_0xf22631){if(!_0xf22631){_0x1222bd[_0x2a48('0x19')](0x194);}return _0xf22631;};}function handleError(_0x293a9a,_0x39a5ec){_0x39a5ec=_0x39a5ec||0x1f4;return function(_0x168caf){logger[_0x2a48('0x25')](_0x168caf[_0x2a48('0x26')]);if(_0x168caf[_0x2a48('0x27')]){delete _0x168caf[_0x2a48('0x27')];}_0x293a9a[_0x2a48('0x28')](_0x39a5ec)[_0x2a48('0x29')](_0x168caf);};}exports[_0x2a48('0x2a')]=function(_0x120283,_0x53c625){var _0xecd6cb={},_0x2e15b8={},_0xcb2340={'count':0x0,'rows':[]};var _0x5805ac=_[_0x2a48('0x2b')](db[_0x2a48('0x2c')]['rawAttributes'],function(_0x3855cf){return{'name':_0x3855cf['fieldName'],'type':_0x3855cf[_0x2a48('0x2d')]['key']};});_0x2e15b8[_0x2a48('0x2e')]=_[_0x2a48('0x2b')](_0x5805ac,'name');_0x2e15b8[_0x2a48('0x2f')]=_[_0x2a48('0x30')](_0x120283[_0x2a48('0x2f')]);_0x2e15b8[_0x2a48('0x31')]=_['intersection'](_0x2e15b8['model'],_0x2e15b8[_0x2a48('0x2f')]);_0xecd6cb['attributes']=_[_0x2a48('0x32')](_0x2e15b8[_0x2a48('0x2e')],qs[_0x2a48('0x33')](_0x120283[_0x2a48('0x2f')][_0x2a48('0x33')]));_0xecd6cb['attributes']=_0xecd6cb['attributes'][_0x2a48('0x34')]?_0xecd6cb['attributes']:_0x2e15b8[_0x2a48('0x2e')];if(!_0x120283[_0x2a48('0x2f')][_0x2a48('0x35')](_0x2a48('0x36'))){_0xecd6cb[_0x2a48('0x1c')]=qs['limit'](_0x120283[_0x2a48('0x2f')][_0x2a48('0x1c')]);_0xecd6cb[_0x2a48('0x1d')]=qs[_0x2a48('0x1d')](_0x120283[_0x2a48('0x2f')][_0x2a48('0x1d')]);}_0xecd6cb['order']=qs[_0x2a48('0x37')](_0x120283[_0x2a48('0x2f')][_0x2a48('0x37')]);_0xecd6cb[_0x2a48('0x38')]=qs[_0x2a48('0x31')](_['pick'](_0x120283['query'],_0x2e15b8[_0x2a48('0x31')]),_0x5805ac);if(_0x120283[_0x2a48('0x2f')][_0x2a48('0x39')]){_0xecd6cb[_0x2a48('0x38')]=_[_0x2a48('0x3a')](_0xecd6cb['where'],{'$or':_[_0x2a48('0x2b')](_0x5805ac,function(_0x5956dd){if(_0x5956dd[_0x2a48('0x2d')]!==_0x2a48('0x3b')){var _0x25d206={};_0x25d206[_0x5956dd[_0x2a48('0x27')]]={'$like':'%'+_0x120283[_0x2a48('0x2f')][_0x2a48('0x39')]+'%'};return _0x25d206;}})});}_0xecd6cb=_[_0x2a48('0x3a')]({},_0xecd6cb,_0x120283['options']);var _0x104106={'where':_0xecd6cb['where']};return db[_0x2a48('0x2c')]['count'](_0x104106)[_0x2a48('0x22')](function(_0x57027b){_0xcb2340['count']=_0x57027b;if(_0x120283[_0x2a48('0x2f')][_0x2a48('0x3c')]){_0xecd6cb[_0x2a48('0x3d')]=[{'all':!![]}];}return db['ServicenowField'][_0x2a48('0x3e')](_0xecd6cb);})[_0x2a48('0x22')](function(_0x5ec578){_0xcb2340[_0x2a48('0x3f')]=_0x5ec578;return _0xcb2340;})[_0x2a48('0x22')](respondWithFilteredResult(_0x53c625,_0xecd6cb))[_0x2a48('0x40')](handleError(_0x53c625,null));};exports['show']=function(_0x4e60eb,_0x5d629f){var _0x4885a0={'raw':!![],'where':{'id':_0x4e60eb[_0x2a48('0x41')]['id']}},_0x1142df={};_0x1142df[_0x2a48('0x2e')]=_[_0x2a48('0x30')](db[_0x2a48('0x2c')][_0x2a48('0x42')]);_0x1142df[_0x2a48('0x2f')]=_[_0x2a48('0x30')](_0x4e60eb[_0x2a48('0x2f')]);_0x1142df[_0x2a48('0x31')]=_[_0x2a48('0x32')](_0x1142df[_0x2a48('0x2e')],_0x1142df[_0x2a48('0x2f')]);_0x4885a0[_0x2a48('0x43')]=_[_0x2a48('0x32')](_0x1142df[_0x2a48('0x2e')],qs[_0x2a48('0x33')](_0x4e60eb[_0x2a48('0x2f')]['fields']));_0x4885a0[_0x2a48('0x43')]=_0x4885a0['attributes'][_0x2a48('0x34')]?_0x4885a0['attributes']:_0x1142df['model'];if(_0x4e60eb['query'][_0x2a48('0x3c')]){_0x4885a0[_0x2a48('0x3d')]=[{'all':!![]}];}_0x4885a0=_[_0x2a48('0x3a')]({},_0x4885a0,_0x4e60eb['options']);return db[_0x2a48('0x2c')][_0x2a48('0x44')](_0x4885a0)[_0x2a48('0x22')](handleEntityNotFound(_0x5d629f,null))['then'](respondWithResult(_0x5d629f,null))[_0x2a48('0x40')](handleError(_0x5d629f,null));};exports[_0x2a48('0x45')]=function(_0x1d40d9,_0x7e455){return db[_0x2a48('0x2c')][_0x2a48('0x45')](_0x1d40d9[_0x2a48('0x46')],{})[_0x2a48('0x22')](respondWithResult(_0x7e455,0xc9))[_0x2a48('0x40')](handleError(_0x7e455,null));};exports[_0x2a48('0x47')]=function(_0x568751,_0x58d391){if(_0x568751[_0x2a48('0x46')]['id']){delete _0x568751[_0x2a48('0x46')]['id'];}return db['ServicenowField'][_0x2a48('0x44')]({'where':{'id':_0x568751[_0x2a48('0x41')]['id']}})[_0x2a48('0x22')](handleEntityNotFound(_0x58d391,null))[_0x2a48('0x22')](saveUpdates(_0x568751[_0x2a48('0x46')],null))[_0x2a48('0x22')](respondWithResult(_0x58d391,null))[_0x2a48('0x40')](handleError(_0x58d391,null));};exports[_0x2a48('0x23')]=function(_0x1ec279,_0x56cc6c){return db[_0x2a48('0x2c')][_0x2a48('0x44')]({'where':{'id':_0x1ec279['params']['id']}})[_0x2a48('0x22')](handleEntityNotFound(_0x56cc6c,null))[_0x2a48('0x22')](removeEntity(_0x56cc6c,null))[_0x2a48('0x40')](handleError(_0x56cc6c,null));}; \ No newline at end of file +var _0xf71d=['stack','name','send','index','ServicenowField','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','nolimit','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','findAll','catch','show','params','rawAttributes','include','find','create','body','eml-format','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','apply','save','update','destroy','then','error'];(function(_0x3f6ffe,_0xf64c5){var _0x7dd7ce=function(_0x5399cf){while(--_0x5399cf){_0x3f6ffe['push'](_0x3f6ffe['shift']());}};_0x7dd7ce(++_0xf64c5);}(_0xf71d,0x17b));var _0xdf71=function(_0x382e89,_0x4768c0){_0x382e89=_0x382e89-0x0;var _0x3a1318=_0xf71d[_0x382e89];return _0x3a1318;};'use strict';var emlformat=require(_0xdf71('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xdf71('0x1'));var moment=require(_0xdf71('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xdf71('0x3'));var util=require(_0xdf71('0x4'));var path=require(_0xdf71('0x5'));var sox=require(_0xdf71('0x6'));var csv=require(_0xdf71('0x7'));var ejs=require(_0xdf71('0x8'));var fs=require('fs');var fs_extra=require(_0xdf71('0x9'));var _=require(_0xdf71('0xa'));var squel=require('squel');var crypto=require(_0xdf71('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xdf71('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xdf71('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0xdf71('0xd'));var hardwareService=require(_0xdf71('0xe'));var logger=require(_0xdf71('0xf'))(_0xdf71('0x10'));var utils=require(_0xdf71('0x11'));var config=require(_0xdf71('0x12'));var licenseUtil=require(_0xdf71('0x13'));var db=require(_0xdf71('0x14'))['db'];function respondWithStatusCode(_0x4a64ef,_0x2c778d){_0x2c778d=_0x2c778d||0xcc;return function(_0x448a50){if(_0x448a50){return _0x4a64ef[_0xdf71('0x15')](_0x2c778d);}return _0x4a64ef[_0xdf71('0x16')](_0x2c778d)[_0xdf71('0x17')]();};}function respondWithResult(_0x540594,_0x37c61d){_0x37c61d=_0x37c61d||0xc8;return function(_0xd14835){if(_0xd14835){return _0x540594['status'](_0x37c61d)[_0xdf71('0x18')](_0xd14835);}};}function respondWithFilteredResult(_0x4d37f4,_0x7ce16a){return function(_0x50abaa){if(_0x50abaa){var _0x4a68ae=typeof _0x7ce16a[_0xdf71('0x19')]===_0xdf71('0x1a')&&typeof _0x7ce16a[_0xdf71('0x1b')]==='undefined';var _0x3ea525=_0x50abaa[_0xdf71('0x1c')];var _0x1337f6=_0x4a68ae?0x0:_0x7ce16a['offset'];var _0x5da194=_0x4a68ae?_0x50abaa[_0xdf71('0x1c')]:_0x7ce16a['offset']+_0x7ce16a['limit'];var _0xe57702;if(_0x5da194>=_0x3ea525){_0x5da194=_0x3ea525;_0xe57702=0xc8;}else{_0xe57702=0xce;}_0x4d37f4[_0xdf71('0x16')](_0xe57702);return _0x4d37f4['set']('Content-Range',_0x1337f6+'-'+_0x5da194+'/'+_0x3ea525)[_0xdf71('0x18')](_0x50abaa);}return null;};}function patchUpdates(_0x366847){return function(_0x42c396){try{jsonpatch[_0xdf71('0x1d')](_0x42c396,_0x366847,!![]);}catch(_0x5ec7b3){return BPromise['reject'](_0x5ec7b3);}return _0x42c396[_0xdf71('0x1e')]();};}function saveUpdates(_0x100a7d,_0x10caef){return function(_0x1cee9d){if(_0x1cee9d){return _0x1cee9d[_0xdf71('0x1f')](_0x100a7d)['then'](function(_0xd32318){return _0xd32318;});}return null;};}function removeEntity(_0x2dd630,_0x3ff7c6){return function(_0x34b7af){if(_0x34b7af){return _0x34b7af[_0xdf71('0x20')]()[_0xdf71('0x21')](function(){_0x2dd630[_0xdf71('0x16')](0xcc)[_0xdf71('0x17')]();});}};}function handleEntityNotFound(_0xa9d6ed,_0x24438f){return function(_0x252be3){if(!_0x252be3){_0xa9d6ed[_0xdf71('0x15')](0x194);}return _0x252be3;};}function handleError(_0x1ccc3d,_0x4c79b7){_0x4c79b7=_0x4c79b7||0x1f4;return function(_0x1c38a6){logger[_0xdf71('0x22')](_0x1c38a6[_0xdf71('0x23')]);if(_0x1c38a6['name']){delete _0x1c38a6[_0xdf71('0x24')];}_0x1ccc3d['status'](_0x4c79b7)[_0xdf71('0x25')](_0x1c38a6);};}exports[_0xdf71('0x26')]=function(_0x40c85b,_0x46336d){var _0x1ff8a8={},_0x338670={},_0x38b646={'count':0x0,'rows':[]};var _0x375b2b=_['map'](db[_0xdf71('0x27')]['rawAttributes'],function(_0x4fe2cb){return{'name':_0x4fe2cb['fieldName'],'type':_0x4fe2cb[_0xdf71('0x28')][_0xdf71('0x29')]};});_0x338670[_0xdf71('0x2a')]=_[_0xdf71('0x2b')](_0x375b2b,'name');_0x338670[_0xdf71('0x2c')]=_[_0xdf71('0x2d')](_0x40c85b[_0xdf71('0x2c')]);_0x338670[_0xdf71('0x2e')]=_['intersection'](_0x338670['model'],_0x338670[_0xdf71('0x2c')]);_0x1ff8a8[_0xdf71('0x2f')]=_[_0xdf71('0x30')](_0x338670[_0xdf71('0x2a')],qs[_0xdf71('0x31')](_0x40c85b[_0xdf71('0x2c')][_0xdf71('0x31')]));_0x1ff8a8[_0xdf71('0x2f')]=_0x1ff8a8['attributes'][_0xdf71('0x32')]?_0x1ff8a8[_0xdf71('0x2f')]:_0x338670['model'];if(!_0x40c85b[_0xdf71('0x2c')]['hasOwnProperty'](_0xdf71('0x33'))){_0x1ff8a8['limit']=qs['limit'](_0x40c85b['query'][_0xdf71('0x1b')]);_0x1ff8a8[_0xdf71('0x19')]=qs[_0xdf71('0x19')](_0x40c85b[_0xdf71('0x2c')][_0xdf71('0x19')]);}_0x1ff8a8['order']=qs[_0xdf71('0x34')](_0x40c85b[_0xdf71('0x2c')][_0xdf71('0x34')]);_0x1ff8a8['where']=qs[_0xdf71('0x2e')](_[_0xdf71('0x35')](_0x40c85b[_0xdf71('0x2c')],_0x338670[_0xdf71('0x2e')]),_0x375b2b);if(_0x40c85b['query']['filter']){_0x1ff8a8[_0xdf71('0x36')]=_[_0xdf71('0x37')](_0x1ff8a8[_0xdf71('0x36')],{'$or':_[_0xdf71('0x2b')](_0x375b2b,function(_0xe218c1){if(_0xe218c1[_0xdf71('0x28')]!==_0xdf71('0x38')){var _0x533ed1={};_0x533ed1[_0xe218c1[_0xdf71('0x24')]]={'$like':'%'+_0x40c85b['query'][_0xdf71('0x39')]+'%'};return _0x533ed1;}})});}_0x1ff8a8=_['merge']({},_0x1ff8a8,_0x40c85b[_0xdf71('0x3a')]);var _0x34c37c={'where':_0x1ff8a8[_0xdf71('0x36')]};return db[_0xdf71('0x27')][_0xdf71('0x1c')](_0x34c37c)['then'](function(_0x4a6b27){_0x38b646[_0xdf71('0x1c')]=_0x4a6b27;if(_0x40c85b[_0xdf71('0x2c')][_0xdf71('0x3b')]){_0x1ff8a8['include']=[{'all':!![]}];}return db['ServicenowField'][_0xdf71('0x3c')](_0x1ff8a8);})[_0xdf71('0x21')](function(_0x12ebb9){_0x38b646['rows']=_0x12ebb9;return _0x38b646;})['then'](respondWithFilteredResult(_0x46336d,_0x1ff8a8))[_0xdf71('0x3d')](handleError(_0x46336d,null));};exports[_0xdf71('0x3e')]=function(_0x518763,_0xdd8791){var _0xcf1193={'raw':!![],'where':{'id':_0x518763[_0xdf71('0x3f')]['id']}},_0x1686b7={};_0x1686b7[_0xdf71('0x2a')]=_[_0xdf71('0x2d')](db[_0xdf71('0x27')][_0xdf71('0x40')]);_0x1686b7[_0xdf71('0x2c')]=_['keys'](_0x518763[_0xdf71('0x2c')]);_0x1686b7['filters']=_['intersection'](_0x1686b7[_0xdf71('0x2a')],_0x1686b7[_0xdf71('0x2c')]);_0xcf1193[_0xdf71('0x2f')]=_[_0xdf71('0x30')](_0x1686b7[_0xdf71('0x2a')],qs[_0xdf71('0x31')](_0x518763[_0xdf71('0x2c')][_0xdf71('0x31')]));_0xcf1193[_0xdf71('0x2f')]=_0xcf1193['attributes']['length']?_0xcf1193['attributes']:_0x1686b7[_0xdf71('0x2a')];if(_0x518763['query'][_0xdf71('0x3b')]){_0xcf1193[_0xdf71('0x41')]=[{'all':!![]}];}_0xcf1193=_[_0xdf71('0x37')]({},_0xcf1193,_0x518763[_0xdf71('0x3a')]);return db[_0xdf71('0x27')][_0xdf71('0x42')](_0xcf1193)['then'](handleEntityNotFound(_0xdd8791,null))[_0xdf71('0x21')](respondWithResult(_0xdd8791,null))[_0xdf71('0x3d')](handleError(_0xdd8791,null));};exports[_0xdf71('0x43')]=function(_0x38bfcb,_0x74d1a){return db[_0xdf71('0x27')][_0xdf71('0x43')](_0x38bfcb[_0xdf71('0x44')],{})['then'](respondWithResult(_0x74d1a,0xc9))[_0xdf71('0x3d')](handleError(_0x74d1a,null));};exports[_0xdf71('0x1f')]=function(_0x41a3f0,_0x58f986){if(_0x41a3f0[_0xdf71('0x44')]['id']){delete _0x41a3f0[_0xdf71('0x44')]['id'];}return db[_0xdf71('0x27')]['find']({'where':{'id':_0x41a3f0[_0xdf71('0x3f')]['id']}})[_0xdf71('0x21')](handleEntityNotFound(_0x58f986,null))[_0xdf71('0x21')](saveUpdates(_0x41a3f0['body'],null))[_0xdf71('0x21')](respondWithResult(_0x58f986,null))['catch'](handleError(_0x58f986,null));};exports[_0xdf71('0x20')]=function(_0x537c8e,_0x144a80){return db[_0xdf71('0x27')][_0xdf71('0x42')]({'where':{'id':_0x537c8e['params']['id']}})[_0xdf71('0x21')](handleEntityNotFound(_0x144a80,null))[_0xdf71('0x21')](removeEntity(_0x144a80,null))[_0xdf71('0x3d')](handleError(_0x144a80,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 009c84b..af35a87 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 _0xb708=['idField','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./intServicenowField.attributes','exports','define','ServicenowField','int_servicenow_fields'];(function(_0x3304a0,_0x200247){var _0x33378e=function(_0x216754){while(--_0x216754){_0x3304a0['push'](_0x3304a0['shift']());}};_0x33378e(++_0x200247);}(_0xb708,0x7f));var _0x8b70=function(_0x292f93,_0x2c6e8e){_0x292f93=_0x292f93-0x0;var _0x5a94b1=_0xb708[_0x292f93];return _0x5a94b1;};'use strict';var _=require(_0x8b70('0x0'));var util=require(_0x8b70('0x1'));var logger=require(_0x8b70('0x2'))(_0x8b70('0x3'));var moment=require(_0x8b70('0x4'));var BPromise=require(_0x8b70('0x5'));var rp=require(_0x8b70('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8b70('0x7'));var config=require('../../config/environment');var attributes=require(_0x8b70('0x8'));module[_0x8b70('0x9')]=function(_0x3cb929,_0x2563a3){return _0x3cb929[_0x8b70('0xa')](_0x8b70('0xb'),attributes,{'tableName':_0x8b70('0xc'),'paranoid':![],'indexes':[{'name':'servicenow_unique_index','fields':[_0x8b70('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1a04=['lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','./intServicenowField.attributes','define','ServicenowField','int_servicenow_fields','servicenow_unique_index','idField','FieldId'];(function(_0x195c2c,_0x157ee4){var _0x35dbee=function(_0x467658){while(--_0x467658){_0x195c2c['push'](_0x195c2c['shift']());}};_0x35dbee(++_0x157ee4);}(_0x1a04,0xb6));var _0x41a0=function(_0x53f0ff,_0x4ec960){_0x53f0ff=_0x53f0ff-0x0;var _0x2a6eb5=_0x1a04[_0x53f0ff];return _0x2a6eb5;};'use strict';var _=require(_0x41a0('0x0'));var util=require('util');var logger=require(_0x41a0('0x1'))(_0x41a0('0x2'));var moment=require(_0x41a0('0x3'));var BPromise=require(_0x41a0('0x4'));var rp=require(_0x41a0('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x41a0('0x6'));var config=require('../../config/environment');var attributes=require(_0x41a0('0x7'));module['exports']=function(_0x424a8c,_0x39cbb8){return _0x424a8c[_0x41a0('0x8')](_0x41a0('0x9'),attributes,{'tableName':_0x41a0('0xa'),'paranoid':![],'indexes':[{'name':_0x41a0('0xb'),'fields':[_0x41a0('0xc'),_0x41a0('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 e1147cb..188b03d 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(_0x4eede4,_0x6a1071){var _0xabe8aa=function(_0x3d6200){while(--_0x3d6200){_0x4eede4['push'](_0x4eede4['shift']());}};_0xabe8aa(++_0x6a1071);}(_0xaa88,0x137));var _0x8aa8=function(_0x2fbd0e,_0x3460a9){_0x2fbd0e=_0x2fbd0e-0x0;var _0x481c9f=_0xaa88[_0x2fbd0e];return _0x481c9f;};'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 _0xd8b0=['../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','ioredis'];(function(_0x11e05d,_0x3a4491){var _0x335588=function(_0x35ec3f){while(--_0x35ec3f){_0x11e05d['push'](_0x11e05d['shift']());}};_0x335588(++_0x3a4491);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0d8b('0x2'));var db=require(_0x0d8b('0x3'))['db'];var utils=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0d8b('0x7')][_0x0d8b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x39f43a,_0x4a4470,_0x413284){return new BPromise(function(_0x284169,_0x58e4e2){return client[_0x0d8b('0x9')](_0x39f43a,_0x413284)[_0x0d8b('0xa')](function(_0x3b027f){logger[_0x0d8b('0xb')](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));logger[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x4a4470,'request\x20sent',JSON[_0x0d8b('0x10')](_0x3b027f));if(_0x3b027f['error']){if(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x12')]===0x1f4){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x58e4e2(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x284169(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}else{logger['info'](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));_0x284169(_0x3b027f[_0x0d8b('0x14')][_0x0d8b('0x13')]);}})[_0x0d8b('0x15')](function(_0x5cd485){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x5cd485);_0x58e4e2(_0x5cd485);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index 88ec521..20490e8 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(_0x4a153d,_0x2393b6){var _0xfceb84=function(_0x39a805){while(--_0x39a805){_0x4a153d['push'](_0x4a153d['shift']());}};_0xfceb84(++_0x2393b6);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file +var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSugarcrmAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x4f4b45,_0x5cf911){var _0x2c0136=function(_0x1bbb28){while(--_0x1bbb28){_0x4f4b45['push'](_0x4f4b45['shift']());}};_0x2c0136(++_0x5cf911);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index 4e8708e..05035ae 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(_0x44128f,_0x5ad1de){var _0x3e82bf=function(_0x3c3feb){while(--_0x3c3feb){_0x44128f['push'](_0x44128f['shift']());}};_0x3e82bf(++_0x5ad1de);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0xa9e0[_0x4fc9e6];return _0x551d28;};'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(_0x57d094,_0x289836){var _0x89b280=function(_0x1e4eb2){while(--_0x1e4eb2){_0x57d094['push'](_0x57d094['shift']());}};_0x89b280(++_0x289836);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4c7fb5,_0x2548ef){_0x4c7fb5=_0x4c7fb5-0x0;var _0x2e10ac=_0xa9e0[_0x4c7fb5];return _0x2e10ac;};'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 6f207f7..f66cbba 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 _0xc535=['addConfiguration','AccountId','getSubjects','channel','Descriptions','getDescriptions','SugarcrmConfiguration','Subjects','assigned_user_id','created_by','duration_hours','duration_minutes','parent_id','parent_type','parent_name','password','remoteUri','substring','format','%s%s','/service/v4_1/rest.php','JSON','username','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','POST','get_module_fields','stringify','values','module_fields','remove','label','endsWith','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','send','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','path','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','limit','offset','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','index','map','SugarcrmAccount','rawAttributes','fieldName','type','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','find','catch','create','body','getConfigurations','findOne'];(function(_0x33c637,_0x597c26){var _0x14aa20=function(_0x32a8b5){while(--_0x32a8b5){_0x33c637['push'](_0x33c637['shift']());}};_0x14aa20(++_0x597c26);}(_0xc535,0x106));var _0x5c53=function(_0x40952f,_0x291cd8){_0x40952f=_0x40952f-0x0;var _0x3be96c=_0xc535[_0x40952f];return _0x3be96c;};'use strict';var emlformat=require(_0x5c53('0x0'));var rimraf=require(_0x5c53('0x1'));var zipdir=require(_0x5c53('0x2'));var jsonpatch=require(_0x5c53('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x5c53('0x4'));var sox=require('sox');var csv=require(_0x5c53('0x5'));var ejs=require(_0x5c53('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x5c53('0x7'));var crypto=require(_0x5c53('0x8'));var jsforce=require(_0x5c53('0x9'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x5c53('0xa'));var Papa=require(_0x5c53('0xb'));var Redis=require('ioredis');var authService=require(_0x5c53('0xc'));var qs=require(_0x5c53('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5c53('0xe'));var logger=require(_0x5c53('0xf'))(_0x5c53('0x10'));var utils=require(_0x5c53('0x11'));var config=require(_0x5c53('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x5c53('0x13'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x5c6a25,_0x10ccbd){_0x10ccbd=_0x10ccbd||0xcc;return function(_0x349683){if(_0x349683){return _0x5c6a25['sendStatus'](_0x10ccbd);}return _0x5c6a25[_0x5c53('0x14')](_0x10ccbd)[_0x5c53('0x15')]();};}function respondWithResult(_0x45010e,_0x54ab9a){_0x54ab9a=_0x54ab9a||0xc8;return function(_0x4a0802){if(_0x4a0802){return _0x45010e[_0x5c53('0x14')](_0x54ab9a)['json'](_0x4a0802);}};}function respondWithFilteredResult(_0x584e52,_0x1bc811){return function(_0x528e78){if(_0x528e78){var _0x59d6f7=typeof _0x1bc811['offset']==='undefined'&&typeof _0x1bc811[_0x5c53('0x16')]==='undefined';var _0x3401e3=_0x528e78['count'];var _0x4bd31f=_0x59d6f7?0x0:_0x1bc811[_0x5c53('0x17')];var _0x1f778a=_0x59d6f7?_0x528e78[_0x5c53('0x18')]:_0x1bc811[_0x5c53('0x17')]+_0x1bc811[_0x5c53('0x16')];var _0x1bd8a6;if(_0x1f778a>=_0x3401e3){_0x1f778a=_0x3401e3;_0x1bd8a6=0xc8;}else{_0x1bd8a6=0xce;}_0x584e52[_0x5c53('0x14')](_0x1bd8a6);return _0x584e52[_0x5c53('0x19')](_0x5c53('0x1a'),_0x4bd31f+'-'+_0x1f778a+'/'+_0x3401e3)['json'](_0x528e78);}return null;};}function patchUpdates(_0xdfcae7){return function(_0x1002bc){try{jsonpatch[_0x5c53('0x1b')](_0x1002bc,_0xdfcae7,!![]);}catch(_0x44a46c){return BPromise[_0x5c53('0x1c')](_0x44a46c);}return _0x1002bc[_0x5c53('0x1d')]();};}function saveUpdates(_0x1b69f3,_0x4a498f){return function(_0x3eae6d){if(_0x3eae6d){return _0x3eae6d[_0x5c53('0x1e')](_0x1b69f3)[_0x5c53('0x1f')](function(_0x45a9af){return _0x45a9af;});}return null;};}function removeEntity(_0x3d43f5,_0x24a1a1){return function(_0x2cedbf){if(_0x2cedbf){return _0x2cedbf[_0x5c53('0x20')]()['then'](function(){_0x3d43f5['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x381e85,_0x288a0c){return function(_0x1bcef4){if(!_0x1bcef4){_0x381e85[_0x5c53('0x21')](0x194);}return _0x1bcef4;};}function handleError(_0x37953d,_0x5843d4){_0x5843d4=_0x5843d4||0x1f4;return function(_0x4adca6){logger[_0x5c53('0x22')](_0x4adca6[_0x5c53('0x23')]);if(_0x4adca6['name']){delete _0x4adca6[_0x5c53('0x24')];}_0x37953d['status'](_0x5843d4)['send'](_0x4adca6);};}exports[_0x5c53('0x25')]=function(_0x30ad64,_0x248952){var _0xf24837={},_0x4c95b8={},_0x37e1f2={'count':0x0,'rows':[]};var _0x122aa1=_[_0x5c53('0x26')](db[_0x5c53('0x27')][_0x5c53('0x28')],function(_0x257f25){return{'name':_0x257f25[_0x5c53('0x29')],'type':_0x257f25[_0x5c53('0x2a')]['key']};});_0x4c95b8['model']=_[_0x5c53('0x26')](_0x122aa1,_0x5c53('0x24'));_0x4c95b8[_0x5c53('0x2b')]=_[_0x5c53('0x2c')](_0x30ad64[_0x5c53('0x2b')]);_0x4c95b8['filters']=_[_0x5c53('0x2d')](_0x4c95b8[_0x5c53('0x2e')],_0x4c95b8['query']);_0xf24837[_0x5c53('0x2f')]=_['intersection'](_0x4c95b8[_0x5c53('0x2e')],qs[_0x5c53('0x30')](_0x30ad64[_0x5c53('0x2b')][_0x5c53('0x30')]));_0xf24837[_0x5c53('0x2f')]=_0xf24837[_0x5c53('0x2f')][_0x5c53('0x31')]?_0xf24837[_0x5c53('0x2f')]:_0x4c95b8[_0x5c53('0x2e')];if(!_0x30ad64[_0x5c53('0x2b')][_0x5c53('0x32')](_0x5c53('0x33'))){_0xf24837['limit']=qs[_0x5c53('0x16')](_0x30ad64[_0x5c53('0x2b')][_0x5c53('0x16')]);_0xf24837[_0x5c53('0x17')]=qs[_0x5c53('0x17')](_0x30ad64['query'][_0x5c53('0x17')]);}_0xf24837['order']=qs[_0x5c53('0x34')](_0x30ad64[_0x5c53('0x2b')][_0x5c53('0x34')]);_0xf24837[_0x5c53('0x35')]=qs['filters'](_[_0x5c53('0x36')](_0x30ad64[_0x5c53('0x2b')],_0x4c95b8[_0x5c53('0x37')]),_0x122aa1);if(_0x30ad64['query'][_0x5c53('0x38')]){_0xf24837[_0x5c53('0x35')]=_[_0x5c53('0x39')](_0xf24837['where'],{'$or':_[_0x5c53('0x26')](_0x122aa1,function(_0x279617){if(_0x279617[_0x5c53('0x2a')]!==_0x5c53('0x3a')){var _0xf679e3={};_0xf679e3[_0x279617[_0x5c53('0x24')]]={'$like':'%'+_0x30ad64[_0x5c53('0x2b')][_0x5c53('0x38')]+'%'};return _0xf679e3;}})});}_0xf24837=_[_0x5c53('0x39')]({},_0xf24837,_0x30ad64[_0x5c53('0x3b')]);var _0x473323={'where':_0xf24837[_0x5c53('0x35')]};return db['SugarcrmAccount'][_0x5c53('0x18')](_0x473323)[_0x5c53('0x1f')](function(_0x1bde11){_0x37e1f2[_0x5c53('0x18')]=_0x1bde11;if(_0x30ad64[_0x5c53('0x2b')][_0x5c53('0x3c')]){_0xf24837[_0x5c53('0x3d')]=[{'all':!![]}];}return db[_0x5c53('0x27')][_0x5c53('0x3e')](_0xf24837);})['then'](function(_0x42eb57){_0x37e1f2[_0x5c53('0x3f')]=_0x42eb57;return _0x37e1f2;})[_0x5c53('0x1f')](respondWithFilteredResult(_0x248952,_0xf24837))['catch'](handleError(_0x248952,null));};exports['show']=function(_0x51c5dd,_0x160d1c){var _0x43293a={'raw':![],'where':{'id':_0x51c5dd[_0x5c53('0x40')]['id']}},_0x15a19d={};_0x15a19d[_0x5c53('0x2e')]=_[_0x5c53('0x2c')](db[_0x5c53('0x27')][_0x5c53('0x28')]);_0x15a19d[_0x5c53('0x2b')]=_['keys'](_0x51c5dd[_0x5c53('0x2b')]);_0x15a19d[_0x5c53('0x37')]=_['intersection'](_0x15a19d[_0x5c53('0x2e')],_0x15a19d[_0x5c53('0x2b')]);_0x43293a[_0x5c53('0x2f')]=_[_0x5c53('0x2d')](_0x15a19d['model'],qs[_0x5c53('0x30')](_0x51c5dd['query'][_0x5c53('0x30')]));_0x43293a[_0x5c53('0x2f')]=_0x43293a[_0x5c53('0x2f')][_0x5c53('0x31')]?_0x43293a['attributes']:_0x15a19d[_0x5c53('0x2e')];if(_0x51c5dd[_0x5c53('0x2b')][_0x5c53('0x3c')]){_0x43293a['include']=[{'all':!![]}];}_0x43293a=_[_0x5c53('0x39')]({},_0x43293a,_0x51c5dd[_0x5c53('0x3b')]);return db[_0x5c53('0x27')][_0x5c53('0x41')](_0x43293a)[_0x5c53('0x1f')](handleEntityNotFound(_0x160d1c,null))[_0x5c53('0x1f')](respondWithResult(_0x160d1c,null))[_0x5c53('0x42')](handleError(_0x160d1c,null));};exports[_0x5c53('0x43')]=function(_0x3e973a,_0x46d524){return db['SugarcrmAccount'][_0x5c53('0x43')](_0x3e973a[_0x5c53('0x44')],{})['then'](respondWithResult(_0x46d524,0xc9))[_0x5c53('0x42')](handleError(_0x46d524,null));};exports[_0x5c53('0x1e')]=function(_0x9adc46,_0xe985eb){if(_0x9adc46[_0x5c53('0x44')]['id']){delete _0x9adc46[_0x5c53('0x44')]['id'];}return db[_0x5c53('0x27')][_0x5c53('0x41')]({'where':{'id':_0x9adc46[_0x5c53('0x40')]['id']}})['then'](handleEntityNotFound(_0xe985eb,null))[_0x5c53('0x1f')](saveUpdates(_0x9adc46[_0x5c53('0x44')],null))['then'](respondWithResult(_0xe985eb,null))[_0x5c53('0x42')](handleError(_0xe985eb,null));};exports[_0x5c53('0x20')]=function(_0x2fcca2,_0x5763d3){return db[_0x5c53('0x27')]['find']({'where':{'id':_0x2fcca2['params']['id']}})[_0x5c53('0x1f')](handleEntityNotFound(_0x5763d3,null))[_0x5c53('0x1f')](removeEntity(_0x5763d3,null))[_0x5c53('0x42')](handleError(_0x5763d3,null));};exports[_0x5c53('0x45')]=function(_0x2cfae2,_0x4846b6,_0x2976c6){var _0x1b4c75={};var _0x4b6da0={};var _0x2ea696;var _0x11632f;return db['SugarcrmAccount'][_0x5c53('0x46')]({'where':{'id':_0x2cfae2['params']['id']}})[_0x5c53('0x1f')](handleEntityNotFound(_0x4846b6,null))[_0x5c53('0x1f')](function(_0x25bff4){if(_0x25bff4){_0x2ea696=_0x25bff4;_0x4b6da0[_0x5c53('0x2e')]=_['keys'](db['SugarcrmConfiguration'][_0x5c53('0x28')]);_0x4b6da0[_0x5c53('0x2b')]=_[_0x5c53('0x2c')](_0x2cfae2[_0x5c53('0x2b')]);_0x4b6da0[_0x5c53('0x37')]=_[_0x5c53('0x2d')](_0x4b6da0[_0x5c53('0x2e')],_0x4b6da0['query']);_0x1b4c75[_0x5c53('0x2f')]=_[_0x5c53('0x2d')](_0x4b6da0['model'],qs[_0x5c53('0x30')](_0x2cfae2['query'][_0x5c53('0x30')]));_0x1b4c75[_0x5c53('0x2f')]=_0x1b4c75[_0x5c53('0x2f')][_0x5c53('0x31')]?_0x1b4c75[_0x5c53('0x2f')]:_0x4b6da0['model'];_0x1b4c75['order']=qs[_0x5c53('0x34')](_0x2cfae2[_0x5c53('0x2b')][_0x5c53('0x34')]);_0x1b4c75[_0x5c53('0x35')]=qs[_0x5c53('0x37')](_[_0x5c53('0x36')](_0x2cfae2[_0x5c53('0x2b')],_0x4b6da0[_0x5c53('0x37')]));if(_0x2cfae2[_0x5c53('0x2b')][_0x5c53('0x38')]){_0x1b4c75['where']=_['merge'](_0x1b4c75[_0x5c53('0x35')],{'$or':_[_0x5c53('0x26')](_0x1b4c75['attributes'],function(_0x1477bb){var _0x3f2f63={};_0x3f2f63[_0x1477bb]={'$like':'%'+_0x2cfae2[_0x5c53('0x2b')]['filter']+'%'};return _0x3f2f63;})});}_0x1b4c75=_[_0x5c53('0x39')]({},_0x1b4c75,_0x2cfae2[_0x5c53('0x3b')]);return _0x2ea696[_0x5c53('0x45')](_0x1b4c75);}})[_0x5c53('0x1f')](function(_0xb2377d){if(_0xb2377d){_0x11632f=_0xb2377d[_0x5c53('0x31')];if(!_0x2cfae2[_0x5c53('0x2b')][_0x5c53('0x32')](_0x5c53('0x33'))){_0x1b4c75[_0x5c53('0x16')]=qs[_0x5c53('0x16')](_0x2cfae2[_0x5c53('0x2b')]['limit']);_0x1b4c75['offset']=qs[_0x5c53('0x17')](_0x2cfae2[_0x5c53('0x2b')]['offset']);}return _0x2ea696['getConfigurations'](_0x1b4c75);}})[_0x5c53('0x1f')](function(_0x232647){if(_0x232647){return _0x232647?{'count':_0x11632f,'rows':_0x232647}:null;}})['then'](respondWithResult(_0x4846b6,null))[_0x5c53('0x42')](handleError(_0x4846b6,null));};exports[_0x5c53('0x47')]=function(_0x239161,_0x42a970,_0x251737){if(_0x239161['body']['id']){delete _0x239161[_0x5c53('0x44')]['id'];}return db['SugarcrmAccount'][_0x5c53('0x46')]({'where':{'id':_0x239161[_0x5c53('0x40')]['id']}})['then'](handleEntityNotFound(_0x42a970,null))['then'](function(_0x3a84c1){if(_0x3a84c1){_0x239161[_0x5c53('0x44')][_0x5c53('0x48')]=_0x3a84c1['id'];_0x239161[_0x5c53('0x44')]['Subjects']=integrations[_0x5c53('0x49')](_0x239161['body'][_0x5c53('0x4a')],_0x239161['body'][_0x5c53('0x2a')]);_0x239161[_0x5c53('0x44')][_0x5c53('0x4b')]=integrations[_0x5c53('0x4c')](_0x239161[_0x5c53('0x44')]['channel'],_0x239161[_0x5c53('0x44')]['type']);return db[_0x5c53('0x4d')]['create'](_0x239161['body'],{'include':[{'model':db['SugarcrmField'],'as':_0x5c53('0x4e')},{'model':db['SugarcrmField'],'as':_0x5c53('0x4b')}]});}return null;})[_0x5c53('0x1f')](respondWithResult(_0x42a970,null))[_0x5c53('0x42')](handleError(_0x42a970,null));};exports['getFields']=function(_0x40d3d5,_0x2672bd,_0x2d0150){var _0x4ad88a='';var _0xb05ae4=['id',_0x5c53('0x24'),_0x5c53('0x4f'),_0x5c53('0x50'),'description','date_start',_0x5c53('0x51'),_0x5c53('0x52'),_0x5c53('0x53'),_0x5c53('0x54'),_0x5c53('0x55'),'direction'];return db[_0x5c53('0x27')][_0x5c53('0x46')]({'where':{'id':_0x40d3d5['params']['id']},'attributes':['id','username',_0x5c53('0x56'),_0x5c53('0x57')]})[_0x5c53('0x1f')](handleEntityNotFound(_0x2672bd,null))[_0x5c53('0x1f')](function(_0x22b7c2){if(_0x22b7c2){_0x4ad88a=_0x22b7c2[_0x5c53('0x57')];var _0xc1847b=_0x4ad88a['slice'](-0x1);if(_0xc1847b==='/'){_0x4ad88a=_0x4ad88a[_0x5c53('0x58')](0x0,_0x4ad88a['lastIndexOf'](_0xc1847b));}return rp({'method':'POST','uri':util[_0x5c53('0x59')](_0x5c53('0x5a'),_0x4ad88a,_0x5c53('0x5b')),'json':!![],'form':{'method':'login','input_type':_0x5c53('0x5c'),'response_type':_0x5c53('0x5c'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x22b7c2[_0x5c53('0x5d')],'password':_0x22b7c2[_0x5c53('0x56')],'encryption':_0x5c53('0x5e')},'application':_0x5c53('0x5f')})}});}})[_0x5c53('0x1f')](function(_0x325b05){if(_0x325b05&&_0x325b05[_0x5c53('0x24')]!==_0x5c53('0x60')&&_0x325b05[_0x5c53('0x24')]!==_0x5c53('0x61')){return rp({'method':_0x5c53('0x62'),'uri':util[_0x5c53('0x59')](_0x5c53('0x5a'),_0x4ad88a,_0x5c53('0x5b')),'json':!![],'form':{'method':_0x5c53('0x63'),'input_type':_0x5c53('0x5c'),'response_type':_0x5c53('0x5c'),'rest_data':JSON[_0x5c53('0x64')]({'session':_0x325b05['id'],'module_name':'Calls'})}})[_0x5c53('0x1f')](function(_0x569c6e){if(_0x569c6e){var _0x152d5b=_[_0x5c53('0x65')](_0x569c6e[_0x5c53('0x66')]);_[_0x5c53('0x67')](_0x152d5b,function(_0x21a671){return _0xb05ae4['includes'](_0x21a671[_0x5c53('0x24')]);});return{'count':_0x152d5b[_0x5c53('0x31')],'rows':_[_0x5c53('0x26')](_0x152d5b,function(_0x2ddb5c){return{'id':_0x2ddb5c[_0x5c53('0x24')],'name':_0x2ddb5c[_0x5c53('0x68')],'custom':_[_0x5c53('0x69')](_0x2ddb5c['name'],'_c')?!![]:![],'options':_0x2ddb5c[_0x5c53('0x3b')]?_['map'](_[_0x5c53('0x65')](_0x2ddb5c[_0x5c53('0x3b')]),function(_0x564269){return{'name':_0x564269['value'],'value':_0x564269[_0x5c53('0x24')]};}):[]};})};}})[_0x5c53('0x1f')](respondWithResult(_0x2672bd,null))[_0x5c53('0x42')](function(_0x2903ca){var _0x533693=_0x40d3d5[_0x5c53('0x2b')][_0x5c53('0x6a')]?0x1f4:_0x2903ca[_0x5c53('0x6b')]||0x1f4;logger[_0x5c53('0x22')](_0x5c53('0x6c'),'getFields',_0x533693,JSON['stringify'](_0x2903ca));delete _0x2903ca[_0x5c53('0x24')];if(_0x533693===0x191){_0x533693=0x190;}_0x2672bd[_0x5c53('0x14')](_0x533693)[_0x5c53('0x6d')](_0x40d3d5[_0x5c53('0x2b')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x2903ca['statusCode']}:_0x2903ca);});}else{var _0x1e9d6d=0x1f4;_0x2672bd[_0x5c53('0x14')](_0x1e9d6d)[_0x5c53('0x6d')]({'message':_0x5c53('0x6e'),'statusCode':0x190});}});}; \ No newline at end of file +var _0xae4a=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','limit','set','Content-Range','apply','save','update','then','destroy','stack','name','send','index','map','SugarcrmAccount','rawAttributes','fieldName','type','model','query','intersection','fields','attributes','length','nolimit','order','sort','filters','pick','where','merge','filter','count','includeAll','include','findAll','rows','catch','params','keys','options','create','body','find','getConfigurations','findOne','SugarcrmConfiguration','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','SugarcrmField','created_by','description','date_start','duration_minutes','parent_id','parent_type','password','remoteUri','slice','substring','lastIndexOf','POST','format','%s%s','/service/v4_1/rest.php','login','JSON','stringify','username','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','get_module_fields','values','module_fields','includes','label','endsWith','value','test','getFields,\x20%s,\x20%s,\x20%s','getFields','statusCode','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis'];(function(_0xb12394,_0x3d76c8){var _0x40b14e=function(_0x2f3bcf){while(--_0x2f3bcf){_0xb12394['push'](_0xb12394['shift']());}};_0x40b14e(++_0x3d76c8);}(_0xae4a,0x68));var _0xaae4=function(_0x363433,_0x592a7b){_0x363433=_0x363433-0x0;var _0x255409=_0xae4a[_0x363433];return _0x255409;};'use strict';var emlformat=require(_0xaae4('0x0'));var rimraf=require(_0xaae4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xaae4('0x2'));var rp=require(_0xaae4('0x3'));var moment=require('moment');var BPromise=require(_0xaae4('0x4'));var Mustache=require(_0xaae4('0x5'));var util=require(_0xaae4('0x6'));var path=require(_0xaae4('0x7'));var sox=require(_0xaae4('0x8'));var csv=require(_0xaae4('0x9'));var ejs=require(_0xaae4('0xa'));var fs=require('fs');var fs_extra=require(_0xaae4('0xb'));var _=require(_0xaae4('0xc'));var squel=require(_0xaae4('0xd'));var crypto=require(_0xaae4('0xe'));var jsforce=require(_0xaae4('0xf'));var deskjs=require(_0xaae4('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xaae4('0x11'));var Redis=require(_0xaae4('0x12'));var authService=require(_0xaae4('0x13'));var qs=require(_0xaae4('0x14'));var as=require(_0xaae4('0x15'));var hardwareService=require(_0xaae4('0x16'));var logger=require(_0xaae4('0x17'))(_0xaae4('0x18'));var utils=require(_0xaae4('0x19'));var config=require(_0xaae4('0x1a'));var licenseUtil=require(_0xaae4('0x1b'));var db=require(_0xaae4('0x1c'))['db'];var integrations=require(_0xaae4('0x1d'));function respondWithStatusCode(_0x440a47,_0x3d831c){_0x3d831c=_0x3d831c||0xcc;return function(_0x443efa){if(_0x443efa){return _0x440a47[_0xaae4('0x1e')](_0x3d831c);}return _0x440a47[_0xaae4('0x1f')](_0x3d831c)['end']();};}function respondWithResult(_0x3bf4ed,_0x31a7d9){_0x31a7d9=_0x31a7d9||0xc8;return function(_0x235218){if(_0x235218){return _0x3bf4ed[_0xaae4('0x1f')](_0x31a7d9)[_0xaae4('0x20')](_0x235218);}};}function respondWithFilteredResult(_0x56bbab,_0xe8c9e0){return function(_0x590d43){if(_0x590d43){var _0x433051=typeof _0xe8c9e0[_0xaae4('0x21')]===_0xaae4('0x22')&&typeof _0xe8c9e0[_0xaae4('0x23')]===_0xaae4('0x22');var _0x46e67b=_0x590d43['count'];var _0x3b96af=_0x433051?0x0:_0xe8c9e0[_0xaae4('0x21')];var _0x3061c1=_0x433051?_0x590d43['count']:_0xe8c9e0[_0xaae4('0x21')]+_0xe8c9e0['limit'];var _0x1a2145;if(_0x3061c1>=_0x46e67b){_0x3061c1=_0x46e67b;_0x1a2145=0xc8;}else{_0x1a2145=0xce;}_0x56bbab[_0xaae4('0x1f')](_0x1a2145);return _0x56bbab[_0xaae4('0x24')](_0xaae4('0x25'),_0x3b96af+'-'+_0x3061c1+'/'+_0x46e67b)[_0xaae4('0x20')](_0x590d43);}return null;};}function patchUpdates(_0x277d50){return function(_0x52dee4){try{jsonpatch[_0xaae4('0x26')](_0x52dee4,_0x277d50,!![]);}catch(_0x54b133){return BPromise['reject'](_0x54b133);}return _0x52dee4[_0xaae4('0x27')]();};}function saveUpdates(_0x104351,_0x22f95c){return function(_0x339f1b){if(_0x339f1b){return _0x339f1b[_0xaae4('0x28')](_0x104351)[_0xaae4('0x29')](function(_0x5849d7){return _0x5849d7;});}return null;};}function removeEntity(_0x244a7f,_0x39240b){return function(_0x2f6624){if(_0x2f6624){return _0x2f6624[_0xaae4('0x2a')]()[_0xaae4('0x29')](function(){_0x244a7f[_0xaae4('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x38a26c,_0x2a5cf4){return function(_0x4b66bb){if(!_0x4b66bb){_0x38a26c[_0xaae4('0x1e')](0x194);}return _0x4b66bb;};}function handleError(_0x125a00,_0x46e767){_0x46e767=_0x46e767||0x1f4;return function(_0x3aa41c){logger['error'](_0x3aa41c[_0xaae4('0x2b')]);if(_0x3aa41c[_0xaae4('0x2c')]){delete _0x3aa41c[_0xaae4('0x2c')];}_0x125a00['status'](_0x46e767)[_0xaae4('0x2d')](_0x3aa41c);};}exports[_0xaae4('0x2e')]=function(_0xaf5469,_0x43f336){var _0x36a4a8={},_0x5610f1={},_0x27231a={'count':0x0,'rows':[]};var _0x3141ed=_[_0xaae4('0x2f')](db[_0xaae4('0x30')][_0xaae4('0x31')],function(_0x33a8b7){return{'name':_0x33a8b7[_0xaae4('0x32')],'type':_0x33a8b7[_0xaae4('0x33')]['key']};});_0x5610f1[_0xaae4('0x34')]=_[_0xaae4('0x2f')](_0x3141ed,_0xaae4('0x2c'));_0x5610f1[_0xaae4('0x35')]=_['keys'](_0xaf5469[_0xaae4('0x35')]);_0x5610f1['filters']=_[_0xaae4('0x36')](_0x5610f1[_0xaae4('0x34')],_0x5610f1['query']);_0x36a4a8['attributes']=_['intersection'](_0x5610f1['model'],qs[_0xaae4('0x37')](_0xaf5469[_0xaae4('0x35')]['fields']));_0x36a4a8[_0xaae4('0x38')]=_0x36a4a8['attributes'][_0xaae4('0x39')]?_0x36a4a8[_0xaae4('0x38')]:_0x5610f1[_0xaae4('0x34')];if(!_0xaf5469[_0xaae4('0x35')]['hasOwnProperty'](_0xaae4('0x3a'))){_0x36a4a8['limit']=qs[_0xaae4('0x23')](_0xaf5469['query'][_0xaae4('0x23')]);_0x36a4a8[_0xaae4('0x21')]=qs[_0xaae4('0x21')](_0xaf5469[_0xaae4('0x35')][_0xaae4('0x21')]);}_0x36a4a8[_0xaae4('0x3b')]=qs[_0xaae4('0x3c')](_0xaf5469['query'][_0xaae4('0x3c')]);_0x36a4a8['where']=qs[_0xaae4('0x3d')](_[_0xaae4('0x3e')](_0xaf5469[_0xaae4('0x35')],_0x5610f1[_0xaae4('0x3d')]),_0x3141ed);if(_0xaf5469['query']['filter']){_0x36a4a8[_0xaae4('0x3f')]=_[_0xaae4('0x40')](_0x36a4a8[_0xaae4('0x3f')],{'$or':_[_0xaae4('0x2f')](_0x3141ed,function(_0x7fc993){if(_0x7fc993['type']!=='VIRTUAL'){var _0x5d20be={};_0x5d20be[_0x7fc993['name']]={'$like':'%'+_0xaf5469[_0xaae4('0x35')][_0xaae4('0x41')]+'%'};return _0x5d20be;}})});}_0x36a4a8=_['merge']({},_0x36a4a8,_0xaf5469['options']);var _0x5cb8ec={'where':_0x36a4a8[_0xaae4('0x3f')]};return db[_0xaae4('0x30')][_0xaae4('0x42')](_0x5cb8ec)['then'](function(_0x298b20){_0x27231a[_0xaae4('0x42')]=_0x298b20;if(_0xaf5469[_0xaae4('0x35')][_0xaae4('0x43')]){_0x36a4a8[_0xaae4('0x44')]=[{'all':!![]}];}return db['SugarcrmAccount'][_0xaae4('0x45')](_0x36a4a8);})[_0xaae4('0x29')](function(_0x425c45){_0x27231a[_0xaae4('0x46')]=_0x425c45;return _0x27231a;})[_0xaae4('0x29')](respondWithFilteredResult(_0x43f336,_0x36a4a8))[_0xaae4('0x47')](handleError(_0x43f336,null));};exports['show']=function(_0x54c487,_0xe9b324){var _0x85f4f7={'raw':![],'where':{'id':_0x54c487[_0xaae4('0x48')]['id']}},_0x3ae656={};_0x3ae656[_0xaae4('0x34')]=_[_0xaae4('0x49')](db[_0xaae4('0x30')][_0xaae4('0x31')]);_0x3ae656[_0xaae4('0x35')]=_[_0xaae4('0x49')](_0x54c487[_0xaae4('0x35')]);_0x3ae656['filters']=_[_0xaae4('0x36')](_0x3ae656[_0xaae4('0x34')],_0x3ae656[_0xaae4('0x35')]);_0x85f4f7[_0xaae4('0x38')]=_['intersection'](_0x3ae656[_0xaae4('0x34')],qs[_0xaae4('0x37')](_0x54c487['query'][_0xaae4('0x37')]));_0x85f4f7[_0xaae4('0x38')]=_0x85f4f7['attributes']['length']?_0x85f4f7['attributes']:_0x3ae656[_0xaae4('0x34')];if(_0x54c487[_0xaae4('0x35')][_0xaae4('0x43')]){_0x85f4f7[_0xaae4('0x44')]=[{'all':!![]}];}_0x85f4f7=_['merge']({},_0x85f4f7,_0x54c487[_0xaae4('0x4a')]);return db[_0xaae4('0x30')]['find'](_0x85f4f7)[_0xaae4('0x29')](handleEntityNotFound(_0xe9b324,null))[_0xaae4('0x29')](respondWithResult(_0xe9b324,null))['catch'](handleError(_0xe9b324,null));};exports[_0xaae4('0x4b')]=function(_0x3598ca,_0x52a427){return db[_0xaae4('0x30')][_0xaae4('0x4b')](_0x3598ca[_0xaae4('0x4c')],{})[_0xaae4('0x29')](respondWithResult(_0x52a427,0xc9))[_0xaae4('0x47')](handleError(_0x52a427,null));};exports['update']=function(_0x23a110,_0x829d86){if(_0x23a110[_0xaae4('0x4c')]['id']){delete _0x23a110[_0xaae4('0x4c')]['id'];}return db[_0xaae4('0x30')][_0xaae4('0x4d')]({'where':{'id':_0x23a110[_0xaae4('0x48')]['id']}})[_0xaae4('0x29')](handleEntityNotFound(_0x829d86,null))['then'](saveUpdates(_0x23a110[_0xaae4('0x4c')],null))['then'](respondWithResult(_0x829d86,null))[_0xaae4('0x47')](handleError(_0x829d86,null));};exports[_0xaae4('0x2a')]=function(_0xe67c71,_0x217f86){return db['SugarcrmAccount'][_0xaae4('0x4d')]({'where':{'id':_0xe67c71[_0xaae4('0x48')]['id']}})[_0xaae4('0x29')](handleEntityNotFound(_0x217f86,null))[_0xaae4('0x29')](removeEntity(_0x217f86,null))['catch'](handleError(_0x217f86,null));};exports[_0xaae4('0x4e')]=function(_0x3a3c94,_0x188d6e,_0x5b3518){var _0x276f61={};var _0x14860c={};var _0x51e90e;var _0x19cdcf;return db[_0xaae4('0x30')][_0xaae4('0x4f')]({'where':{'id':_0x3a3c94[_0xaae4('0x48')]['id']}})[_0xaae4('0x29')](handleEntityNotFound(_0x188d6e,null))[_0xaae4('0x29')](function(_0x43047c){if(_0x43047c){_0x51e90e=_0x43047c;_0x14860c[_0xaae4('0x34')]=_['keys'](db[_0xaae4('0x50')][_0xaae4('0x31')]);_0x14860c[_0xaae4('0x35')]=_[_0xaae4('0x49')](_0x3a3c94[_0xaae4('0x35')]);_0x14860c[_0xaae4('0x3d')]=_[_0xaae4('0x36')](_0x14860c['model'],_0x14860c[_0xaae4('0x35')]);_0x276f61[_0xaae4('0x38')]=_[_0xaae4('0x36')](_0x14860c[_0xaae4('0x34')],qs[_0xaae4('0x37')](_0x3a3c94[_0xaae4('0x35')][_0xaae4('0x37')]));_0x276f61[_0xaae4('0x38')]=_0x276f61[_0xaae4('0x38')][_0xaae4('0x39')]?_0x276f61[_0xaae4('0x38')]:_0x14860c['model'];_0x276f61[_0xaae4('0x3b')]=qs['sort'](_0x3a3c94[_0xaae4('0x35')][_0xaae4('0x3c')]);_0x276f61[_0xaae4('0x3f')]=qs[_0xaae4('0x3d')](_['pick'](_0x3a3c94[_0xaae4('0x35')],_0x14860c[_0xaae4('0x3d')]));if(_0x3a3c94[_0xaae4('0x35')][_0xaae4('0x41')]){_0x276f61['where']=_[_0xaae4('0x40')](_0x276f61[_0xaae4('0x3f')],{'$or':_[_0xaae4('0x2f')](_0x276f61['attributes'],function(_0x1595b2){var _0x177a10={};_0x177a10[_0x1595b2]={'$like':'%'+_0x3a3c94[_0xaae4('0x35')][_0xaae4('0x41')]+'%'};return _0x177a10;})});}_0x276f61=_[_0xaae4('0x40')]({},_0x276f61,_0x3a3c94['options']);return _0x51e90e['getConfigurations'](_0x276f61);}})[_0xaae4('0x29')](function(_0x42fe4e){if(_0x42fe4e){_0x19cdcf=_0x42fe4e[_0xaae4('0x39')];if(!_0x3a3c94[_0xaae4('0x35')][_0xaae4('0x51')](_0xaae4('0x3a'))){_0x276f61['limit']=qs[_0xaae4('0x23')](_0x3a3c94[_0xaae4('0x35')][_0xaae4('0x23')]);_0x276f61[_0xaae4('0x21')]=qs[_0xaae4('0x21')](_0x3a3c94[_0xaae4('0x35')][_0xaae4('0x21')]);}return _0x51e90e['getConfigurations'](_0x276f61);}})[_0xaae4('0x29')](function(_0xe7571d){if(_0xe7571d){return _0xe7571d?{'count':_0x19cdcf,'rows':_0xe7571d}:null;}})['then'](respondWithResult(_0x188d6e,null))[_0xaae4('0x47')](handleError(_0x188d6e,null));};exports[_0xaae4('0x52')]=function(_0x499348,_0x47b3e3,_0x5b3a82){if(_0x499348[_0xaae4('0x4c')]['id']){delete _0x499348[_0xaae4('0x4c')]['id'];}return db[_0xaae4('0x30')][_0xaae4('0x4f')]({'where':{'id':_0x499348['params']['id']}})[_0xaae4('0x29')](handleEntityNotFound(_0x47b3e3,null))[_0xaae4('0x29')](function(_0x448c4d){if(_0x448c4d){_0x499348[_0xaae4('0x4c')][_0xaae4('0x53')]=_0x448c4d['id'];_0x499348[_0xaae4('0x4c')][_0xaae4('0x54')]=integrations[_0xaae4('0x55')](_0x499348[_0xaae4('0x4c')][_0xaae4('0x56')],_0x499348[_0xaae4('0x4c')][_0xaae4('0x33')]);_0x499348[_0xaae4('0x4c')][_0xaae4('0x57')]=integrations['getDescriptions'](_0x499348[_0xaae4('0x4c')][_0xaae4('0x56')],_0x499348[_0xaae4('0x4c')][_0xaae4('0x33')]);return db[_0xaae4('0x50')][_0xaae4('0x4b')](_0x499348['body'],{'include':[{'model':db[_0xaae4('0x58')],'as':_0xaae4('0x54')},{'model':db[_0xaae4('0x58')],'as':_0xaae4('0x57')}]});}return null;})[_0xaae4('0x29')](respondWithResult(_0x47b3e3,null))[_0xaae4('0x47')](handleError(_0x47b3e3,null));};exports['getFields']=function(_0xc47e1a,_0x547590,_0x2b20ac){var _0x19ff99='';var _0x5438be=['id',_0xaae4('0x2c'),'assigned_user_id',_0xaae4('0x59'),_0xaae4('0x5a'),_0xaae4('0x5b'),'duration_hours',_0xaae4('0x5c'),_0xaae4('0x5d'),_0xaae4('0x5e'),'parent_name','direction'];return db[_0xaae4('0x30')]['findOne']({'where':{'id':_0xc47e1a['params']['id']},'attributes':['id','username',_0xaae4('0x5f'),_0xaae4('0x60')]})[_0xaae4('0x29')](handleEntityNotFound(_0x547590,null))[_0xaae4('0x29')](function(_0x371148){if(_0x371148){_0x19ff99=_0x371148[_0xaae4('0x60')];var _0x3aed45=_0x19ff99[_0xaae4('0x61')](-0x1);if(_0x3aed45==='/'){_0x19ff99=_0x19ff99[_0xaae4('0x62')](0x0,_0x19ff99[_0xaae4('0x63')](_0x3aed45));}return rp({'method':_0xaae4('0x64'),'uri':util[_0xaae4('0x65')](_0xaae4('0x66'),_0x19ff99,_0xaae4('0x67')),'json':!![],'form':{'method':_0xaae4('0x68'),'input_type':_0xaae4('0x69'),'response_type':'JSON','rest_data':JSON[_0xaae4('0x6a')]({'user_auth':{'user_name':_0x371148[_0xaae4('0x6b')],'password':_0x371148['password'],'encryption':_0xaae4('0x6c')},'application':_0xaae4('0x6d')})}});}})[_0xaae4('0x29')](function(_0x440c6f){if(_0x440c6f&&_0x440c6f[_0xaae4('0x2c')]!==_0xaae4('0x6e')&&_0x440c6f[_0xaae4('0x2c')]!=='Password\x20Expired'){return rp({'method':_0xaae4('0x64'),'uri':util[_0xaae4('0x65')](_0xaae4('0x66'),_0x19ff99,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0xaae4('0x6f'),'input_type':'JSON','response_type':_0xaae4('0x69'),'rest_data':JSON[_0xaae4('0x6a')]({'session':_0x440c6f['id'],'module_name':'Calls'})}})['then'](function(_0xeaf8f9){if(_0xeaf8f9){var _0x131945=_[_0xaae4('0x70')](_0xeaf8f9[_0xaae4('0x71')]);_['remove'](_0x131945,function(_0x269fe9){return _0x5438be[_0xaae4('0x72')](_0x269fe9['name']);});return{'count':_0x131945['length'],'rows':_['map'](_0x131945,function(_0x9944c1){return{'id':_0x9944c1[_0xaae4('0x2c')],'name':_0x9944c1[_0xaae4('0x73')],'custom':_[_0xaae4('0x74')](_0x9944c1[_0xaae4('0x2c')],'_c')?!![]:![],'options':_0x9944c1[_0xaae4('0x4a')]?_[_0xaae4('0x2f')](_[_0xaae4('0x70')](_0x9944c1[_0xaae4('0x4a')]),function(_0xbff0bc){return{'name':_0xbff0bc[_0xaae4('0x75')],'value':_0xbff0bc[_0xaae4('0x2c')]};}):[]};})};}})[_0xaae4('0x29')](respondWithResult(_0x547590,null))['catch'](function(_0x516049){var _0x4ac2ad=_0xc47e1a['query'][_0xaae4('0x76')]?0x1f4:_0x516049['statusCode']||0x1f4;logger['error'](_0xaae4('0x77'),_0xaae4('0x78'),_0x4ac2ad,JSON[_0xaae4('0x6a')](_0x516049));delete _0x516049[_0xaae4('0x2c')];if(_0x4ac2ad===0x191){_0x4ac2ad=0x190;}_0x547590[_0xaae4('0x1f')](_0x4ac2ad)[_0xaae4('0x2d')](_0xc47e1a[_0xaae4('0x35')][_0xaae4('0x76')]?{'message':'Wrong\x20credentials','statusCode':_0x516049[_0xaae4('0x79')]}:_0x516049);});}else{var _0x71d2e4=0x1f4;_0x547590['status'](_0x71d2e4)[_0xaae4('0x2d')]({'message':_0xaae4('0x7a'),'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 34f9919..aaef9e4 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 _0x8f4c=['util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','../../components/integrations/configuration','define','int_sugarcrm_accounts','lodash'];(function(_0x2eeae4,_0x348201){var _0x362004=function(_0x1f2a6a){while(--_0x1f2a6a){_0x2eeae4['push'](_0x2eeae4['shift']());}};_0x362004(++_0x348201);}(_0x8f4c,0x113));var _0xc8f4=function(_0x39157f,_0x3d8c1e){_0x39157f=_0x39157f-0x0;var _0x1ae4e2=_0x8f4c[_0x39157f];return _0x1ae4e2;};'use strict';var _=require(_0xc8f4('0x0'));var util=require(_0xc8f4('0x1'));var logger=require(_0xc8f4('0x2'))(_0xc8f4('0x3'));var moment=require(_0xc8f4('0x4'));var BPromise=require(_0xc8f4('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc8f4('0x6'));var rimraf=require(_0xc8f4('0x7'));var config=require(_0xc8f4('0x8'));var attributes=require('./intSugarcrmAccount.attributes');var integrations=require(_0xc8f4('0x9'));module['exports']=function(_0x4c86f8,_0x520063){return _0x4c86f8[_0xc8f4('0xa')]('SugarcrmAccount',attributes,{'tableName':_0xc8f4('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9fb6=['request-promise','path','rimraf','../../config/environment','./intSugarcrmAccount.attributes','define','SugarcrmAccount','int_sugarcrm_accounts','util','../../config/logger','api','moment'];(function(_0x3aacd,_0x26af81){var _0x4806a2=function(_0x3cc248){while(--_0x3cc248){_0x3aacd['push'](_0x3aacd['shift']());}};_0x4806a2(++_0x26af81);}(_0x9fb6,0x17c));var _0x69fb=function(_0x5f04e6,_0x4c54b4){_0x5f04e6=_0x5f04e6-0x0;var _0x383322=_0x9fb6[_0x5f04e6];return _0x383322;};'use strict';var _=require('lodash');var util=require(_0x69fb('0x0'));var logger=require(_0x69fb('0x1'))(_0x69fb('0x2'));var moment=require(_0x69fb('0x3'));var BPromise=require('bluebird');var rp=require(_0x69fb('0x4'));var fs=require('fs');var path=require(_0x69fb('0x5'));var rimraf=require(_0x69fb('0x6'));var config=require(_0x69fb('0x7'));var attributes=require(_0x69fb('0x8'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x2ba777,_0x1ac5e4){return _0x2ba777[_0x69fb('0x9')](_0x69fb('0xa'),attributes,{'tableName':_0x69fb('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.rpc.js index 29b9896..065bcff 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 _0xb9fa=['model','map','debug','catch','ShowSugarcrmAccount','find','where','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','then','request\x20sent','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','SugarcrmAccount,\x20%s,\x20%s','message','info','result','GetSugarcrmAccount','options','raw','attributes','limit','include'];(function(_0x2f2dcc,_0x4bb632){var _0x4ff30f=function(_0x794949){while(--_0x794949){_0x2f2dcc['push'](_0x2f2dcc['shift']());}};_0x4ff30f(++_0x4bb632);}(_0xb9fa,0x1a7));var _0xab9f=function(_0xe2e82b,_0x3b5d0c){_0xe2e82b=_0xe2e82b-0x0;var _0x1f9ba9=_0xb9fa[_0xe2e82b];return _0x1f9ba9;};'use strict';var _=require(_0xab9f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xab9f('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xab9f('0x2'));var db=require(_0xab9f('0x3'))['db'];var utils=require(_0xab9f('0x4'));var logger=require(_0xab9f('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xab9f('0x6'));var client=jayson[_0xab9f('0x7')][_0xab9f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x14ed65,_0x14f02f,_0x33f1d0){return new BPromise(function(_0x43b977,_0x466a47){return client['request'](_0x14ed65,_0x33f1d0)[_0xab9f('0x9')](function(_0x3f5e5e){logger['info']('SugarcrmAccount,\x20%s,\x20%s',_0x14f02f,_0xab9f('0xa'));logger['debug'](_0xab9f('0xb'),_0x14f02f,'request\x20sent',JSON[_0xab9f('0xc')](_0x3f5e5e));if(_0x3f5e5e['error']){if(_0x3f5e5e[_0xab9f('0xd')][_0xab9f('0xe')]===0x1f4){logger['error'](_0xab9f('0xf'),_0x14f02f,_0x3f5e5e['error'][_0xab9f('0x10')]);return _0x466a47(_0x3f5e5e[_0xab9f('0xd')][_0xab9f('0x10')]);}logger[_0xab9f('0xd')](_0xab9f('0xf'),_0x14f02f,_0x3f5e5e[_0xab9f('0xd')][_0xab9f('0x10')]);return _0x43b977(_0x3f5e5e['error'][_0xab9f('0x10')]);}else{logger[_0xab9f('0x11')](_0xab9f('0xf'),_0x14f02f,_0xab9f('0xa'));_0x43b977(_0x3f5e5e[_0xab9f('0x12')][_0xab9f('0x10')]);}})['catch'](function(_0x379298){logger[_0xab9f('0xd')](_0xab9f('0xf'),_0x14f02f,_0x379298);_0x466a47(_0x379298);});});}exports[_0xab9f('0x13')]=function(_0x9f36a3){var _0x2a5621=this;return new Promise(function(_0x2b600f,_0x1b55e7){return db['SugarcrmAccount']['findAll']({'raw':_0x9f36a3[_0xab9f('0x14')]?_0x9f36a3[_0xab9f('0x14')][_0xab9f('0x15')]===undefined?!![]:![]:!![],'where':_0x9f36a3[_0xab9f('0x14')]?_0x9f36a3[_0xab9f('0x14')]['where']||null:null,'attributes':_0x9f36a3[_0xab9f('0x14')]?_0x9f36a3[_0xab9f('0x14')][_0xab9f('0x16')]||null:null,'limit':_0x9f36a3[_0xab9f('0x14')]?_0x9f36a3[_0xab9f('0x14')][_0xab9f('0x17')]||null:null,'include':_0x9f36a3['options']?_0x9f36a3[_0xab9f('0x14')][_0xab9f('0x18')]?_['map'](_0x9f36a3[_0xab9f('0x14')][_0xab9f('0x18')],function(_0x13d032){return{'model':db[_0x13d032[_0xab9f('0x19')]],'as':_0x13d032['as'],'attributes':_0x13d032[_0xab9f('0x16')],'include':_0x13d032[_0xab9f('0x18')]?_[_0xab9f('0x1a')](_0x13d032['include'],function(_0x5be722){return{'model':db[_0x5be722[_0xab9f('0x19')]],'as':_0x5be722['as'],'attributes':_0x5be722[_0xab9f('0x16')],'include':_0x5be722[_0xab9f('0x18')]?_['map'](_0x5be722[_0xab9f('0x18')],function(_0x2ff842){return{'model':db[_0x2ff842[_0xab9f('0x19')]],'as':_0x2ff842['as'],'attributes':_0x2ff842[_0xab9f('0x16')]};}):[]};}):[]};}):[]:[]})[_0xab9f('0x9')](function(_0x102308){logger[_0xab9f('0x11')](_0xab9f('0x13'),_0x9f36a3);logger[_0xab9f('0x1b')]('GetSugarcrmAccount',_0x9f36a3,JSON[_0xab9f('0xc')](_0x102308));_0x2b600f(_0x102308);})[_0xab9f('0x1c')](function(_0x1da9e9){logger[_0xab9f('0xd')]('GetSugarcrmAccount',_0x1da9e9[_0xab9f('0x10')],_0x9f36a3);_0x1b55e7(_0x2a5621['error'](0x1f4,_0x1da9e9[_0xab9f('0x10')]));});});};exports[_0xab9f('0x1d')]=function(_0x42359a){var _0xeb9d9b=this;return new Promise(function(_0x13fd1b,_0x1a6e4c){return db['SugarcrmAccount'][_0xab9f('0x1e')]({'raw':_0x42359a[_0xab9f('0x14')]?_0x42359a[_0xab9f('0x14')]['raw']===undefined?!![]:![]:!![],'where':_0x42359a[_0xab9f('0x14')]?_0x42359a[_0xab9f('0x14')][_0xab9f('0x1f')]||null:null,'attributes':_0x42359a['options']?_0x42359a[_0xab9f('0x14')][_0xab9f('0x16')]||null:null,'include':_0x42359a[_0xab9f('0x14')]?_0x42359a[_0xab9f('0x14')][_0xab9f('0x18')]?_[_0xab9f('0x1a')](_0x42359a[_0xab9f('0x14')]['include'],function(_0x8f06c7){return{'model':db[_0x8f06c7['model']],'as':_0x8f06c7['as'],'attributes':_0x8f06c7[_0xab9f('0x16')],'include':_0x8f06c7['include']?_[_0xab9f('0x1a')](_0x8f06c7[_0xab9f('0x18')],function(_0x44c618){return{'model':db[_0x44c618[_0xab9f('0x19')]],'as':_0x44c618['as'],'attributes':_0x44c618[_0xab9f('0x16')],'include':_0x44c618[_0xab9f('0x18')]?_[_0xab9f('0x1a')](_0x44c618['include'],function(_0x5a11dd){return{'model':db[_0x5a11dd[_0xab9f('0x19')]],'as':_0x5a11dd['as'],'attributes':_0x5a11dd['attributes']};}):[]};}):[]};}):[]:[]})[_0xab9f('0x9')](function(_0x4276ad){logger['info'](_0xab9f('0x1d'),_0x42359a);logger['debug'](_0xab9f('0x1d'),_0x42359a,JSON['stringify'](_0x4276ad));_0x13fd1b(_0x4276ad);})[_0xab9f('0x1c')](function(_0x5f283b){logger[_0xab9f('0xd')](_0xab9f('0x1d'),_0x5f283b[_0xab9f('0x10')],_0x42359a);_0x1a6e4c(_0xeb9d9b[_0xab9f('0xd')](0x1f4,_0x5f283b['message']));});});}; \ No newline at end of file +var _0x1863=['request','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','GetSugarcrmAccount','SugarcrmAccount','options','attributes','include','map','model','then','stringify','ShowSugarcrmAccount','where','debug','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x2e04b7,_0x502ea0){var _0x1808ef=function(_0x21ab4b){while(--_0x21ab4b){_0x2e04b7['push'](_0x2e04b7['shift']());}};_0x1808ef(++_0x502ea0);}(_0x1863,0xb0));var _0x3186=function(_0x29d623,_0x1a5c9c){_0x29d623=_0x29d623-0x0;var _0x242e59=_0x1863[_0x29d623];return _0x242e59;};'use strict';var _=require(_0x3186('0x0'));var util=require(_0x3186('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x3186('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3186('0x3'))['db'];var utils=require(_0x3186('0x4'));var logger=require(_0x3186('0x5'))(_0x3186('0x6'));var config=require(_0x3186('0x7'));var jayson=require(_0x3186('0x8'));var client=jayson['client'][_0x3186('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1417b3,_0xb5a343,_0x2be59f){return new BPromise(function(_0x346ea0,_0x29e2b2){return client[_0x3186('0xa')](_0x1417b3,_0x2be59f)['then'](function(_0x43a575){logger[_0x3186('0xb')](_0x3186('0xc'),_0xb5a343,_0x3186('0xd'));logger['debug']('SugarcrmAccount,\x20%s,\x20%s,\x20%s',_0xb5a343,'request\x20sent',JSON['stringify'](_0x43a575));if(_0x43a575[_0x3186('0xe')]){if(_0x43a575[_0x3186('0xe')][_0x3186('0xf')]===0x1f4){logger[_0x3186('0xe')](_0x3186('0xc'),_0xb5a343,_0x43a575[_0x3186('0xe')]['message']);return _0x29e2b2(_0x43a575[_0x3186('0xe')][_0x3186('0x10')]);}logger[_0x3186('0xe')]('SugarcrmAccount,\x20%s,\x20%s',_0xb5a343,_0x43a575['error'][_0x3186('0x10')]);return _0x346ea0(_0x43a575[_0x3186('0xe')][_0x3186('0x10')]);}else{logger[_0x3186('0xb')]('SugarcrmAccount,\x20%s,\x20%s',_0xb5a343,_0x3186('0xd'));_0x346ea0(_0x43a575[_0x3186('0x11')]['message']);}})[_0x3186('0x12')](function(_0x2c52ac){logger['error']('SugarcrmAccount,\x20%s,\x20%s',_0xb5a343,_0x2c52ac);_0x29e2b2(_0x2c52ac);});});}exports[_0x3186('0x13')]=function(_0x150cf2){var _0xb0d51b=this;return new Promise(function(_0xc64749,_0x15a06c){return db[_0x3186('0x14')]['findAll']({'raw':_0x150cf2[_0x3186('0x15')]?_0x150cf2[_0x3186('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x150cf2[_0x3186('0x15')]?_0x150cf2['options']['where']||null:null,'attributes':_0x150cf2['options']?_0x150cf2['options'][_0x3186('0x16')]||null:null,'limit':_0x150cf2[_0x3186('0x15')]?_0x150cf2[_0x3186('0x15')]['limit']||null:null,'include':_0x150cf2['options']?_0x150cf2[_0x3186('0x15')][_0x3186('0x17')]?_['map'](_0x150cf2[_0x3186('0x15')]['include'],function(_0x19bccb){return{'model':db[_0x19bccb['model']],'as':_0x19bccb['as'],'attributes':_0x19bccb['attributes'],'include':_0x19bccb[_0x3186('0x17')]?_[_0x3186('0x18')](_0x19bccb[_0x3186('0x17')],function(_0x2f709b){return{'model':db[_0x2f709b[_0x3186('0x19')]],'as':_0x2f709b['as'],'attributes':_0x2f709b['attributes'],'include':_0x2f709b['include']?_['map'](_0x2f709b[_0x3186('0x17')],function(_0xd7e54d){return{'model':db[_0xd7e54d[_0x3186('0x19')]],'as':_0xd7e54d['as'],'attributes':_0xd7e54d['attributes']};}):[]};}):[]};}):[]:[]})[_0x3186('0x1a')](function(_0x242371){logger[_0x3186('0xb')](_0x3186('0x13'),_0x150cf2);logger['debug'](_0x3186('0x13'),_0x150cf2,JSON[_0x3186('0x1b')](_0x242371));_0xc64749(_0x242371);})[_0x3186('0x12')](function(_0x1e0072){logger[_0x3186('0xe')](_0x3186('0x13'),_0x1e0072[_0x3186('0x10')],_0x150cf2);_0x15a06c(_0xb0d51b[_0x3186('0xe')](0x1f4,_0x1e0072[_0x3186('0x10')]));});});};exports[_0x3186('0x1c')]=function(_0x2a3ab6){var _0x532c83=this;return new Promise(function(_0x211a20,_0x4addbd){return db['SugarcrmAccount']['find']({'raw':_0x2a3ab6['options']?_0x2a3ab6[_0x3186('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x2a3ab6[_0x3186('0x15')]?_0x2a3ab6['options'][_0x3186('0x1d')]||null:null,'attributes':_0x2a3ab6[_0x3186('0x15')]?_0x2a3ab6[_0x3186('0x15')][_0x3186('0x16')]||null:null,'include':_0x2a3ab6[_0x3186('0x15')]?_0x2a3ab6[_0x3186('0x15')][_0x3186('0x17')]?_[_0x3186('0x18')](_0x2a3ab6[_0x3186('0x15')][_0x3186('0x17')],function(_0x5b2d88){return{'model':db[_0x5b2d88['model']],'as':_0x5b2d88['as'],'attributes':_0x5b2d88['attributes'],'include':_0x5b2d88[_0x3186('0x17')]?_[_0x3186('0x18')](_0x5b2d88[_0x3186('0x17')],function(_0x38becf){return{'model':db[_0x38becf['model']],'as':_0x38becf['as'],'attributes':_0x38becf[_0x3186('0x16')],'include':_0x38becf[_0x3186('0x17')]?_['map'](_0x38becf['include'],function(_0x53d9c9){return{'model':db[_0x53d9c9[_0x3186('0x19')]],'as':_0x53d9c9['as'],'attributes':_0x53d9c9[_0x3186('0x16')]};}):[]};}):[]};}):[]:[]})[_0x3186('0x1a')](function(_0x5a4b9c){logger['info'](_0x3186('0x1c'),_0x2a3ab6);logger[_0x3186('0x1e')](_0x3186('0x1c'),_0x2a3ab6,JSON[_0x3186('0x1b')](_0x5a4b9c));_0x211a20(_0x5a4b9c);})[_0x3186('0x12')](function(_0x4cdbfd){logger[_0x3186('0xe')](_0x3186('0x1c'),_0x4cdbfd['message'],_0x2a3ab6);_0x4addbd(_0x532c83[_0x3186('0xe')](0x1f4,_0x4cdbfd[_0x3186('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 98948fe..fff67f8 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 _0x21a6=['isAuthenticated','index','/:id','show','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','get'];(function(_0x3d43cb,_0x3d7050){var _0x3f7599=function(_0xd85ade){while(--_0xd85ade){_0x3d43cb['push'](_0x3d43cb['shift']());}};_0x3f7599(++_0x3d7050);}(_0x21a6,0x1e9));var _0x621a=function(_0xa98302,_0x844f27){_0xa98302=_0xa98302-0x0;var _0x1ad8e3=_0x21a6[_0xa98302];return _0x1ad8e3;};'use strict';var multer=require(_0x621a('0x0'));var util=require(_0x621a('0x1'));var path=require(_0x621a('0x2'));var timeout=require(_0x621a('0x3'));var express=require('express');var router=express[_0x621a('0x4')]();var fs_extra=require(_0x621a('0x5'));var auth=require(_0x621a('0x6'));var interaction=require(_0x621a('0x7'));var config=require(_0x621a('0x8'));var controller=require(_0x621a('0x9'));router[_0x621a('0xa')]('/',auth[_0x621a('0xb')](),controller[_0x621a('0xc')]);router[_0x621a('0xa')](_0x621a('0xd'),auth[_0x621a('0xb')](),controller[_0x621a('0xe')]);router[_0x621a('0xa')]('/:id/fields',auth[_0x621a('0xb')](),controller[_0x621a('0xf')]);router['get'](_0x621a('0x10'),auth[_0x621a('0xb')](),controller[_0x621a('0x11')]);router[_0x621a('0xa')](_0x621a('0x12'),auth[_0x621a('0xb')](),controller[_0x621a('0x13')]);router[_0x621a('0x14')]('/',auth[_0x621a('0xb')](),controller[_0x621a('0x15')]);router[_0x621a('0x16')](_0x621a('0xd'),auth[_0x621a('0xb')](),controller['update']);router[_0x621a('0x17')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x621a('0x18')]=router; \ No newline at end of file +var _0x931a=['post','create','update','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','get','isAuthenticated','/:id','show','/:id/fields','/:id/subjects','getDescriptions'];(function(_0x4ea955,_0x1eda76){var _0x558561=function(_0x5b20f4){while(--_0x5b20f4){_0x4ea955['push'](_0x4ea955['shift']());}};_0x558561(++_0x1eda76);}(_0x931a,0xad));var _0xa931=function(_0x3287a6,_0x35e598){_0x3287a6=_0x3287a6-0x0;var _0x9c6449=_0x931a[_0x3287a6];return _0x9c6449;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xa931('0x0'));var timeout=require(_0xa931('0x1'));var express=require(_0xa931('0x2'));var router=express[_0xa931('0x3')]();var fs_extra=require(_0xa931('0x4'));var auth=require(_0xa931('0x5'));var interaction=require(_0xa931('0x6'));var config=require(_0xa931('0x7'));var controller=require(_0xa931('0x8'));router[_0xa931('0x9')]('/',auth[_0xa931('0xa')](),controller['index']);router[_0xa931('0x9')](_0xa931('0xb'),auth[_0xa931('0xa')](),controller[_0xa931('0xc')]);router['get'](_0xa931('0xd'),auth[_0xa931('0xa')](),controller['getFields']);router[_0xa931('0x9')](_0xa931('0xe'),auth['isAuthenticated'](),controller['getSubjects']);router[_0xa931('0x9')]('/:id/descriptions',auth['isAuthenticated'](),controller[_0xa931('0xf')]);router[_0xa931('0x10')]('/',auth[_0xa931('0xa')](),controller[_0xa931('0x11')]);router['put']('/:id',auth[_0xa931('0xa')](),controller[_0xa931('0x12')]);router['delete'](_0xa931('0xb'),auth[_0xa931('0xa')](),controller[_0xa931('0x13')]);module[_0xa931('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index df15596..95cca34 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 _0x5124=['exports','STRING','sequelize'];(function(_0x1aea09,_0x5f23ec){var _0x96740a=function(_0x1487a8){while(--_0x1487a8){_0x1aea09['push'](_0x1aea09['shift']());}};_0x96740a(++_0x5f23ec);}(_0x5124,0x176));var _0x4512=function(_0x315e13,_0x2e1a64){_0x315e13=_0x315e13-0x0;var _0x2fe19c=_0x5124[_0x315e13];return _0x2fe19c;};'use strict';var Sequelize=require(_0x4512('0x0'));module[_0x4512('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x4512('0x2')]}}; \ No newline at end of file +var _0xe286=['STRING','sequelize'];(function(_0x1ea4f9,_0x1e4c68){var _0x13f394=function(_0x447727){while(--_0x447727){_0x1ea4f9['push'](_0x1ea4f9['shift']());}};_0x13f394(++_0x1e4c68);}(_0xe286,0x151));var _0x6e28=function(_0x459e77,_0x2d8fbd){_0x459e77=_0x459e77-0x0;var _0x421cbf=_0xe286[_0x459e77];return _0x421cbf;};'use strict';var Sequelize=require(_0x6e28('0x0'));module['exports']={'name':{'type':Sequelize[_0x6e28('0x1')]},'description':{'type':Sequelize[_0x6e28('0x1')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index 9617a8f..4315498 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 _0xddf2=['crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','error','stack','send','index','SugarcrmConfiguration','fieldName','type','key','map','name','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','includeAll','include','findAll','rows','catch','show','params','rawAttributes','keys','options','create','body','find','destroy','getFields','findOne','pick','getSubjects','SugarcrmField','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash'];(function(_0x5ea065,_0x4087fc){var _0x26669a=function(_0x55b69b){while(--_0x55b69b){_0x5ea065['push'](_0x5ea065['shift']());}};_0x26669a(++_0x4087fc);}(_0xddf2,0x99));var _0x2ddf=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xddf2[_0x42cae2];return _0x5f256f;};'use strict';var emlformat=require(_0x2ddf('0x0'));var rimraf=require(_0x2ddf('0x1'));var zipdir=require(_0x2ddf('0x2'));var jsonpatch=require(_0x2ddf('0x3'));var rp=require(_0x2ddf('0x4'));var moment=require(_0x2ddf('0x5'));var BPromise=require(_0x2ddf('0x6'));var Mustache=require(_0x2ddf('0x7'));var util=require(_0x2ddf('0x8'));var path=require('path');var sox=require(_0x2ddf('0x9'));var csv=require('to-csv');var ejs=require(_0x2ddf('0xa'));var fs=require('fs');var fs_extra=require(_0x2ddf('0xb'));var _=require(_0x2ddf('0xc'));var squel=require('squel');var crypto=require(_0x2ddf('0xd'));var jsforce=require(_0x2ddf('0xe'));var deskjs=require(_0x2ddf('0xf'));var toCsv=require(_0x2ddf('0x10'));var querystring=require(_0x2ddf('0x11'));var Papa=require(_0x2ddf('0x12'));var Redis=require(_0x2ddf('0x13'));var authService=require(_0x2ddf('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2ddf('0x15'));var logger=require(_0x2ddf('0x16'))(_0x2ddf('0x17'));var utils=require(_0x2ddf('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x2ddf('0x19'))['db'];function respondWithStatusCode(_0x9f92e0,_0x5a87b8){_0x5a87b8=_0x5a87b8||0xcc;return function(_0x328f9c){if(_0x328f9c){return _0x9f92e0[_0x2ddf('0x1a')](_0x5a87b8);}return _0x9f92e0['status'](_0x5a87b8)['end']();};}function respondWithResult(_0x233efd,_0x2cdbf0){_0x2cdbf0=_0x2cdbf0||0xc8;return function(_0x500343){if(_0x500343){return _0x233efd[_0x2ddf('0x1b')](_0x2cdbf0)[_0x2ddf('0x1c')](_0x500343);}};}function respondWithFilteredResult(_0xb8f1fb,_0x2ca96b){return function(_0x3ff727){if(_0x3ff727){var _0x1654f2=typeof _0x2ca96b[_0x2ddf('0x1d')]===_0x2ddf('0x1e')&&typeof _0x2ca96b[_0x2ddf('0x1f')]===_0x2ddf('0x1e');var _0x385405=_0x3ff727[_0x2ddf('0x20')];var _0x195b54=_0x1654f2?0x0:_0x2ca96b[_0x2ddf('0x1d')];var _0x3381d0=_0x1654f2?_0x3ff727[_0x2ddf('0x20')]:_0x2ca96b[_0x2ddf('0x1d')]+_0x2ca96b['limit'];var _0x52450c;if(_0x3381d0>=_0x385405){_0x3381d0=_0x385405;_0x52450c=0xc8;}else{_0x52450c=0xce;}_0xb8f1fb[_0x2ddf('0x1b')](_0x52450c);return _0xb8f1fb[_0x2ddf('0x21')](_0x2ddf('0x22'),_0x195b54+'-'+_0x3381d0+'/'+_0x385405)[_0x2ddf('0x1c')](_0x3ff727);}return null;};}function patchUpdates(_0x25f315){return function(_0x270be3){try{jsonpatch[_0x2ddf('0x23')](_0x270be3,_0x25f315,!![]);}catch(_0x3b6de1){return BPromise['reject'](_0x3b6de1);}return _0x270be3[_0x2ddf('0x24')]();};}function saveUpdates(_0x374e66,_0x4ef134){return function(_0x2090a9){if(_0x2090a9){return _0x2090a9[_0x2ddf('0x25')](_0x374e66)[_0x2ddf('0x26')](function(_0x2000fa){return _0x2000fa;});}return null;};}function removeEntity(_0x5a38f6,_0x6132d3){return function(_0x5354be){if(_0x5354be){return _0x5354be['destroy']()[_0x2ddf('0x26')](function(){_0x5a38f6[_0x2ddf('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1f1315,_0x4e57c1){return function(_0x1d01c2){if(!_0x1d01c2){_0x1f1315[_0x2ddf('0x1a')](0x194);}return _0x1d01c2;};}function handleError(_0x79f004,_0xbed069){_0xbed069=_0xbed069||0x1f4;return function(_0x2cadca){logger[_0x2ddf('0x27')](_0x2cadca[_0x2ddf('0x28')]);if(_0x2cadca['name']){delete _0x2cadca['name'];}_0x79f004[_0x2ddf('0x1b')](_0xbed069)[_0x2ddf('0x29')](_0x2cadca);};}exports[_0x2ddf('0x2a')]=function(_0x440f8a,_0x132df6){var _0x444427={},_0x3d2ca0={},_0x2f2db4={'count':0x0,'rows':[]};var _0x275bbd=_['map'](db[_0x2ddf('0x2b')]['rawAttributes'],function(_0x24e442){return{'name':_0x24e442[_0x2ddf('0x2c')],'type':_0x24e442[_0x2ddf('0x2d')][_0x2ddf('0x2e')]};});_0x3d2ca0['model']=_[_0x2ddf('0x2f')](_0x275bbd,_0x2ddf('0x30'));_0x3d2ca0['query']=_['keys'](_0x440f8a['query']);_0x3d2ca0['filters']=_['intersection'](_0x3d2ca0[_0x2ddf('0x31')],_0x3d2ca0[_0x2ddf('0x32')]);_0x444427['attributes']=_[_0x2ddf('0x33')](_0x3d2ca0[_0x2ddf('0x31')],qs[_0x2ddf('0x34')](_0x440f8a[_0x2ddf('0x32')][_0x2ddf('0x34')]));_0x444427[_0x2ddf('0x35')]=_0x444427[_0x2ddf('0x35')][_0x2ddf('0x36')]?_0x444427['attributes']:_0x3d2ca0[_0x2ddf('0x31')];if(!_0x440f8a[_0x2ddf('0x32')][_0x2ddf('0x37')](_0x2ddf('0x38'))){_0x444427[_0x2ddf('0x1f')]=qs[_0x2ddf('0x1f')](_0x440f8a[_0x2ddf('0x32')][_0x2ddf('0x1f')]);_0x444427[_0x2ddf('0x1d')]=qs[_0x2ddf('0x1d')](_0x440f8a['query'][_0x2ddf('0x1d')]);}_0x444427[_0x2ddf('0x39')]=qs[_0x2ddf('0x3a')](_0x440f8a[_0x2ddf('0x32')]['sort']);_0x444427[_0x2ddf('0x3b')]=qs[_0x2ddf('0x3c')](_['pick'](_0x440f8a[_0x2ddf('0x32')],_0x3d2ca0['filters']),_0x275bbd);if(_0x440f8a[_0x2ddf('0x32')][_0x2ddf('0x3d')]){_0x444427[_0x2ddf('0x3b')]=_[_0x2ddf('0x3e')](_0x444427[_0x2ddf('0x3b')],{'$or':_[_0x2ddf('0x2f')](_0x275bbd,function(_0x2d8383){if(_0x2d8383['type']!=='VIRTUAL'){var _0x43ecbd={};_0x43ecbd[_0x2d8383[_0x2ddf('0x30')]]={'$like':'%'+_0x440f8a['query'][_0x2ddf('0x3d')]+'%'};return _0x43ecbd;}})});}_0x444427=_[_0x2ddf('0x3e')]({},_0x444427,_0x440f8a['options']);var _0x5ef254={'where':_0x444427[_0x2ddf('0x3b')]};return db['SugarcrmConfiguration'][_0x2ddf('0x20')](_0x5ef254)[_0x2ddf('0x26')](function(_0x41357b){_0x2f2db4['count']=_0x41357b;if(_0x440f8a['query'][_0x2ddf('0x3f')]){_0x444427[_0x2ddf('0x40')]=[{'all':!![]}];}return db[_0x2ddf('0x2b')][_0x2ddf('0x41')](_0x444427);})[_0x2ddf('0x26')](function(_0x5d1140){_0x2f2db4[_0x2ddf('0x42')]=_0x5d1140;return _0x2f2db4;})['then'](respondWithFilteredResult(_0x132df6,_0x444427))[_0x2ddf('0x43')](handleError(_0x132df6,null));};exports[_0x2ddf('0x44')]=function(_0x103e06,_0x30feeb){var _0x48c639={'raw':![],'where':{'id':_0x103e06[_0x2ddf('0x45')]['id']}},_0x2a5302={};_0x2a5302[_0x2ddf('0x31')]=_['keys'](db[_0x2ddf('0x2b')][_0x2ddf('0x46')]);_0x2a5302['query']=_[_0x2ddf('0x47')](_0x103e06[_0x2ddf('0x32')]);_0x2a5302[_0x2ddf('0x3c')]=_[_0x2ddf('0x33')](_0x2a5302[_0x2ddf('0x31')],_0x2a5302[_0x2ddf('0x32')]);_0x48c639['attributes']=_['intersection'](_0x2a5302['model'],qs[_0x2ddf('0x34')](_0x103e06['query']['fields']));_0x48c639[_0x2ddf('0x35')]=_0x48c639[_0x2ddf('0x35')][_0x2ddf('0x36')]?_0x48c639[_0x2ddf('0x35')]:_0x2a5302[_0x2ddf('0x31')];if(_0x103e06[_0x2ddf('0x32')]['includeAll']){_0x48c639[_0x2ddf('0x40')]=[{'all':!![]}];}_0x48c639=_['merge']({},_0x48c639,_0x103e06[_0x2ddf('0x48')]);return db[_0x2ddf('0x2b')]['find'](_0x48c639)[_0x2ddf('0x26')](handleEntityNotFound(_0x30feeb,null))[_0x2ddf('0x26')](respondWithResult(_0x30feeb,null))[_0x2ddf('0x43')](handleError(_0x30feeb,null));};exports['create']=function(_0x5f41b6,_0x3f09f){return db[_0x2ddf('0x2b')][_0x2ddf('0x49')](_0x5f41b6[_0x2ddf('0x4a')],{})['then'](respondWithResult(_0x3f09f,0xc9))[_0x2ddf('0x43')](handleError(_0x3f09f,null));};exports['update']=function(_0x3ee505,_0x4d40ab){if(_0x3ee505[_0x2ddf('0x4a')]['id']){delete _0x3ee505[_0x2ddf('0x4a')]['id'];}return db[_0x2ddf('0x2b')][_0x2ddf('0x4b')]({'where':{'id':_0x3ee505[_0x2ddf('0x45')]['id']}})[_0x2ddf('0x26')](handleEntityNotFound(_0x4d40ab,null))['then'](saveUpdates(_0x3ee505['body'],null))[_0x2ddf('0x26')](respondWithResult(_0x4d40ab,null))[_0x2ddf('0x43')](handleError(_0x4d40ab,null));};exports[_0x2ddf('0x4c')]=function(_0xc538eb,_0x572e2d){return db['SugarcrmConfiguration'][_0x2ddf('0x4b')]({'where':{'id':_0xc538eb[_0x2ddf('0x45')]['id']}})[_0x2ddf('0x26')](handleEntityNotFound(_0x572e2d,null))[_0x2ddf('0x26')](removeEntity(_0x572e2d,null))[_0x2ddf('0x43')](handleError(_0x572e2d,null));};exports[_0x2ddf('0x4d')]=function(_0x28ddc7,_0x1007fc,_0x2be68a){var _0x396e0a={};var _0x22912f={};var _0xae4e3f;var _0x1275a4;return db[_0x2ddf('0x2b')][_0x2ddf('0x4e')]({'where':{'id':_0x28ddc7[_0x2ddf('0x45')]['id']}})['then'](handleEntityNotFound(_0x1007fc,null))['then'](function(_0x18b287){if(_0x18b287){_0xae4e3f=_0x18b287;_0x22912f[_0x2ddf('0x31')]=_[_0x2ddf('0x47')](db['SugarcrmField']['rawAttributes']);_0x22912f[_0x2ddf('0x32')]=_['keys'](_0x28ddc7[_0x2ddf('0x32')]);_0x22912f[_0x2ddf('0x3c')]=_[_0x2ddf('0x33')](_0x22912f[_0x2ddf('0x31')],_0x22912f[_0x2ddf('0x32')]);_0x396e0a['attributes']=_[_0x2ddf('0x33')](_0x22912f[_0x2ddf('0x31')],qs[_0x2ddf('0x34')](_0x28ddc7['query']['fields']));_0x396e0a[_0x2ddf('0x35')]=_0x396e0a['attributes']['length']?_0x396e0a[_0x2ddf('0x35')]:_0x22912f[_0x2ddf('0x31')];_0x396e0a['order']=qs[_0x2ddf('0x3a')](_0x28ddc7[_0x2ddf('0x32')][_0x2ddf('0x3a')]);_0x396e0a[_0x2ddf('0x3b')]=qs[_0x2ddf('0x3c')](_[_0x2ddf('0x4f')](_0x28ddc7[_0x2ddf('0x32')],_0x22912f[_0x2ddf('0x3c')]));if(_0x28ddc7[_0x2ddf('0x32')][_0x2ddf('0x3d')]){_0x396e0a['where']=_[_0x2ddf('0x3e')](_0x396e0a['where'],{'$or':_[_0x2ddf('0x2f')](_0x396e0a[_0x2ddf('0x35')],function(_0x4e04f7){var _0x17f882={};_0x17f882[_0x4e04f7]={'$like':'%'+_0x28ddc7['query'][_0x2ddf('0x3d')]+'%'};return _0x17f882;})});}_0x396e0a=_['merge']({},_0x396e0a,_0x28ddc7[_0x2ddf('0x48')]);return _0xae4e3f['getFields'](_0x396e0a);}})[_0x2ddf('0x26')](function(_0x74573a){if(_0x74573a){_0x1275a4=_0x74573a[_0x2ddf('0x36')];if(!_0x28ddc7[_0x2ddf('0x32')][_0x2ddf('0x37')](_0x2ddf('0x38'))){_0x396e0a[_0x2ddf('0x1f')]=qs['limit'](_0x28ddc7[_0x2ddf('0x32')][_0x2ddf('0x1f')]);_0x396e0a[_0x2ddf('0x1d')]=qs[_0x2ddf('0x1d')](_0x28ddc7[_0x2ddf('0x32')][_0x2ddf('0x1d')]);}return _0xae4e3f[_0x2ddf('0x4d')](_0x396e0a);}})[_0x2ddf('0x26')](function(_0x1d0e97){if(_0x1d0e97){return _0x1d0e97?{'count':_0x1275a4,'rows':_0x1d0e97}:null;}})['then'](respondWithResult(_0x1007fc,null))[_0x2ddf('0x43')](handleError(_0x1007fc,null));};exports[_0x2ddf('0x50')]=function(_0x526ec5,_0x3c27e7,_0x16762b){var _0xf51aa5={};var _0x2fecf6={};var _0x4efe42;var _0x2d21e6;return db[_0x2ddf('0x2b')]['findOne']({'where':{'id':_0x526ec5[_0x2ddf('0x45')]['id']}})[_0x2ddf('0x26')](handleEntityNotFound(_0x3c27e7,null))[_0x2ddf('0x26')](function(_0x12dfca){if(_0x12dfca){_0x4efe42=_0x12dfca;_0x2fecf6[_0x2ddf('0x31')]=_[_0x2ddf('0x47')](db[_0x2ddf('0x51')]['rawAttributes']);_0x2fecf6[_0x2ddf('0x32')]=_[_0x2ddf('0x47')](_0x526ec5[_0x2ddf('0x32')]);_0x2fecf6['filters']=_[_0x2ddf('0x33')](_0x2fecf6[_0x2ddf('0x31')],_0x2fecf6[_0x2ddf('0x32')]);_0xf51aa5[_0x2ddf('0x35')]=_[_0x2ddf('0x33')](_0x2fecf6['model'],qs['fields'](_0x526ec5[_0x2ddf('0x32')][_0x2ddf('0x34')]));_0xf51aa5[_0x2ddf('0x35')]=_0xf51aa5['attributes'][_0x2ddf('0x36')]?_0xf51aa5['attributes']:_0x2fecf6['model'];_0xf51aa5[_0x2ddf('0x39')]=qs['sort'](_0x526ec5['query']['sort']);_0xf51aa5[_0x2ddf('0x3b')]=qs[_0x2ddf('0x3c')](_[_0x2ddf('0x4f')](_0x526ec5['query'],_0x2fecf6['filters']));if(_0x526ec5['query'][_0x2ddf('0x3d')]){_0xf51aa5[_0x2ddf('0x3b')]=_[_0x2ddf('0x3e')](_0xf51aa5[_0x2ddf('0x3b')],{'$or':_[_0x2ddf('0x2f')](_0xf51aa5[_0x2ddf('0x35')],function(_0x40bc0a){var _0x1609ad={};_0x1609ad[_0x40bc0a]={'$like':'%'+_0x526ec5['query'][_0x2ddf('0x3d')]+'%'};return _0x1609ad;})});}_0xf51aa5=_[_0x2ddf('0x3e')]({},_0xf51aa5,_0x526ec5[_0x2ddf('0x48')]);return _0x4efe42[_0x2ddf('0x50')](_0xf51aa5);}})[_0x2ddf('0x26')](function(_0x1b0c39){if(_0x1b0c39){_0x2d21e6=_0x1b0c39['length'];if(!_0x526ec5[_0x2ddf('0x32')][_0x2ddf('0x37')](_0x2ddf('0x38'))){_0xf51aa5['limit']=qs[_0x2ddf('0x1f')](_0x526ec5[_0x2ddf('0x32')][_0x2ddf('0x1f')]);_0xf51aa5[_0x2ddf('0x1d')]=qs[_0x2ddf('0x1d')](_0x526ec5['query'][_0x2ddf('0x1d')]);}return _0x4efe42['getSubjects'](_0xf51aa5);}})['then'](function(_0x26f166){if(_0x26f166){return _0x26f166?{'count':_0x2d21e6,'rows':_0x26f166}:null;}})[_0x2ddf('0x26')](respondWithResult(_0x3c27e7,null))[_0x2ddf('0x43')](handleError(_0x3c27e7,null));};exports[_0x2ddf('0x52')]=function(_0x44fdd4,_0x17b115,_0x190cd5){var _0x56eddc={};var _0x2478f5={};var _0x2f186c;var _0x2272af;return db['SugarcrmConfiguration'][_0x2ddf('0x4e')]({'where':{'id':_0x44fdd4['params']['id']}})['then'](handleEntityNotFound(_0x17b115,null))[_0x2ddf('0x26')](function(_0xd81db5){if(_0xd81db5){_0x2f186c=_0xd81db5;_0x2478f5['model']=_[_0x2ddf('0x47')](db[_0x2ddf('0x51')][_0x2ddf('0x46')]);_0x2478f5[_0x2ddf('0x32')]=_[_0x2ddf('0x47')](_0x44fdd4[_0x2ddf('0x32')]);_0x2478f5[_0x2ddf('0x3c')]=_[_0x2ddf('0x33')](_0x2478f5['model'],_0x2478f5[_0x2ddf('0x32')]);_0x56eddc[_0x2ddf('0x35')]=_[_0x2ddf('0x33')](_0x2478f5[_0x2ddf('0x31')],qs[_0x2ddf('0x34')](_0x44fdd4['query'][_0x2ddf('0x34')]));_0x56eddc[_0x2ddf('0x35')]=_0x56eddc[_0x2ddf('0x35')][_0x2ddf('0x36')]?_0x56eddc[_0x2ddf('0x35')]:_0x2478f5[_0x2ddf('0x31')];_0x56eddc['order']=qs[_0x2ddf('0x3a')](_0x44fdd4[_0x2ddf('0x32')][_0x2ddf('0x3a')]);_0x56eddc[_0x2ddf('0x3b')]=qs['filters'](_[_0x2ddf('0x4f')](_0x44fdd4[_0x2ddf('0x32')],_0x2478f5['filters']));if(_0x44fdd4[_0x2ddf('0x32')][_0x2ddf('0x3d')]){_0x56eddc['where']=_[_0x2ddf('0x3e')](_0x56eddc[_0x2ddf('0x3b')],{'$or':_[_0x2ddf('0x2f')](_0x56eddc[_0x2ddf('0x35')],function(_0x1cf109){var _0x2dab10={};_0x2dab10[_0x1cf109]={'$like':'%'+_0x44fdd4['query'][_0x2ddf('0x3d')]+'%'};return _0x2dab10;})});}_0x56eddc=_[_0x2ddf('0x3e')]({},_0x56eddc,_0x44fdd4[_0x2ddf('0x48')]);return _0x2f186c[_0x2ddf('0x52')](_0x56eddc);}})[_0x2ddf('0x26')](function(_0x46ff32){if(_0x46ff32){_0x2272af=_0x46ff32[_0x2ddf('0x36')];if(!_0x44fdd4[_0x2ddf('0x32')][_0x2ddf('0x37')](_0x2ddf('0x38'))){_0x56eddc[_0x2ddf('0x1f')]=qs[_0x2ddf('0x1f')](_0x44fdd4[_0x2ddf('0x32')][_0x2ddf('0x1f')]);_0x56eddc[_0x2ddf('0x1d')]=qs[_0x2ddf('0x1d')](_0x44fdd4['query'][_0x2ddf('0x1d')]);}return _0x2f186c[_0x2ddf('0x52')](_0x56eddc);}})[_0x2ddf('0x26')](function(_0x44fd79){if(_0x44fd79){return _0x44fd79?{'count':_0x2272af,'rows':_0x44fd79}:null;}})[_0x2ddf('0x26')](respondWithResult(_0x17b115,null))[_0x2ddf('0x43')](handleError(_0x17b115,null));}; \ No newline at end of file +var _0x16ac=['options','includeAll','include','findAll','rows','catch','find','create','params','destroy','SugarcrmField','getFields','getSubjects','findOne','getDescriptions','order','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','sendStatus','error','stack','name','send','index','SugarcrmConfiguration','rawAttributes','model','map','keys','filters','intersection','query','fields','length','attributes','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL'];(function(_0x56562d,_0x578183){var _0xdafef9=function(_0x27453e){while(--_0x27453e){_0x56562d['push'](_0x56562d['shift']());}};_0xdafef9(++_0x578183);}(_0x16ac,0x1f0));var _0xc16a=function(_0x2a1f5c,_0x49b13f){_0x2a1f5c=_0x2a1f5c-0x0;var _0x43ce3d=_0x16ac[_0x2a1f5c];return _0x43ce3d;};'use strict';var emlformat=require(_0xc16a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc16a('0x1'));var jsonpatch=require(_0xc16a('0x2'));var rp=require(_0xc16a('0x3'));var moment=require(_0xc16a('0x4'));var BPromise=require(_0xc16a('0x5'));var Mustache=require(_0xc16a('0x6'));var util=require('util');var path=require(_0xc16a('0x7'));var sox=require('sox');var csv=require(_0xc16a('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc16a('0x9'));var _=require(_0xc16a('0xa'));var squel=require(_0xc16a('0xb'));var crypto=require(_0xc16a('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xc16a('0xd'));var toCsv=require('to-csv');var querystring=require(_0xc16a('0xe'));var Papa=require(_0xc16a('0xf'));var Redis=require(_0xc16a('0x10'));var authService=require(_0xc16a('0x11'));var qs=require(_0xc16a('0x12'));var as=require(_0xc16a('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc16a('0x14'))(_0xc16a('0x15'));var utils=require(_0xc16a('0x16'));var config=require(_0xc16a('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xc16a('0x18'))['db'];function respondWithStatusCode(_0x5a716f,_0x2c9687){_0x2c9687=_0x2c9687||0xcc;return function(_0x424fda){if(_0x424fda){return _0x5a716f['sendStatus'](_0x2c9687);}return _0x5a716f[_0xc16a('0x19')](_0x2c9687)[_0xc16a('0x1a')]();};}function respondWithResult(_0x22a97b,_0x31fb0e){_0x31fb0e=_0x31fb0e||0xc8;return function(_0xd2119a){if(_0xd2119a){return _0x22a97b[_0xc16a('0x19')](_0x31fb0e)[_0xc16a('0x1b')](_0xd2119a);}};}function respondWithFilteredResult(_0xb1db0f,_0x47f254){return function(_0x439a01){if(_0x439a01){var _0x36324c=typeof _0x47f254[_0xc16a('0x1c')]===_0xc16a('0x1d')&&typeof _0x47f254[_0xc16a('0x1e')]==='undefined';var _0xe7aa41=_0x439a01['count'];var _0x3ee9e3=_0x36324c?0x0:_0x47f254['offset'];var _0x35d6a6=_0x36324c?_0x439a01[_0xc16a('0x1f')]:_0x47f254[_0xc16a('0x1c')]+_0x47f254['limit'];var _0x145f73;if(_0x35d6a6>=_0xe7aa41){_0x35d6a6=_0xe7aa41;_0x145f73=0xc8;}else{_0x145f73=0xce;}_0xb1db0f[_0xc16a('0x19')](_0x145f73);return _0xb1db0f[_0xc16a('0x20')](_0xc16a('0x21'),_0x3ee9e3+'-'+_0x35d6a6+'/'+_0xe7aa41)[_0xc16a('0x1b')](_0x439a01);}return null;};}function patchUpdates(_0x352f10){return function(_0x541cfd){try{jsonpatch[_0xc16a('0x22')](_0x541cfd,_0x352f10,!![]);}catch(_0xa03987){return BPromise[_0xc16a('0x23')](_0xa03987);}return _0x541cfd[_0xc16a('0x24')]();};}function saveUpdates(_0x283fbe,_0x14fe0c){return function(_0x44d676){if(_0x44d676){return _0x44d676[_0xc16a('0x25')](_0x283fbe)[_0xc16a('0x26')](function(_0xfc0ef8){return _0xfc0ef8;});}return null;};}function removeEntity(_0x3bbb61,_0x3fef0c){return function(_0x3e6c57){if(_0x3e6c57){return _0x3e6c57['destroy']()[_0xc16a('0x26')](function(){_0x3bbb61[_0xc16a('0x19')](0xcc)[_0xc16a('0x1a')]();});}};}function handleEntityNotFound(_0x322868,_0xef1236){return function(_0x5a8fa9){if(!_0x5a8fa9){_0x322868[_0xc16a('0x27')](0x194);}return _0x5a8fa9;};}function handleError(_0x352dcd,_0x2e0100){_0x2e0100=_0x2e0100||0x1f4;return function(_0x5a814b){logger[_0xc16a('0x28')](_0x5a814b[_0xc16a('0x29')]);if(_0x5a814b[_0xc16a('0x2a')]){delete _0x5a814b['name'];}_0x352dcd[_0xc16a('0x19')](_0x2e0100)[_0xc16a('0x2b')](_0x5a814b);};}exports[_0xc16a('0x2c')]=function(_0xabe6e1,_0x466fa2){var _0x4eb4ab={},_0x19a428={},_0x25b3ac={'count':0x0,'rows':[]};var _0x4a5475=_['map'](db[_0xc16a('0x2d')][_0xc16a('0x2e')],function(_0x2fa405){return{'name':_0x2fa405['fieldName'],'type':_0x2fa405['type']['key']};});_0x19a428[_0xc16a('0x2f')]=_[_0xc16a('0x30')](_0x4a5475,'name');_0x19a428['query']=_[_0xc16a('0x31')](_0xabe6e1['query']);_0x19a428[_0xc16a('0x32')]=_[_0xc16a('0x33')](_0x19a428[_0xc16a('0x2f')],_0x19a428[_0xc16a('0x34')]);_0x4eb4ab['attributes']=_['intersection'](_0x19a428['model'],qs['fields'](_0xabe6e1[_0xc16a('0x34')][_0xc16a('0x35')]));_0x4eb4ab['attributes']=_0x4eb4ab['attributes'][_0xc16a('0x36')]?_0x4eb4ab[_0xc16a('0x37')]:_0x19a428['model'];if(!_0xabe6e1[_0xc16a('0x34')][_0xc16a('0x38')](_0xc16a('0x39'))){_0x4eb4ab[_0xc16a('0x1e')]=qs[_0xc16a('0x1e')](_0xabe6e1[_0xc16a('0x34')][_0xc16a('0x1e')]);_0x4eb4ab[_0xc16a('0x1c')]=qs[_0xc16a('0x1c')](_0xabe6e1[_0xc16a('0x34')][_0xc16a('0x1c')]);}_0x4eb4ab['order']=qs[_0xc16a('0x3a')](_0xabe6e1[_0xc16a('0x34')][_0xc16a('0x3a')]);_0x4eb4ab[_0xc16a('0x3b')]=qs[_0xc16a('0x32')](_[_0xc16a('0x3c')](_0xabe6e1[_0xc16a('0x34')],_0x19a428['filters']),_0x4a5475);if(_0xabe6e1[_0xc16a('0x34')][_0xc16a('0x3d')]){_0x4eb4ab[_0xc16a('0x3b')]=_[_0xc16a('0x3e')](_0x4eb4ab['where'],{'$or':_['map'](_0x4a5475,function(_0x4b0c45){if(_0x4b0c45['type']!==_0xc16a('0x3f')){var _0x3b2ffc={};_0x3b2ffc[_0x4b0c45[_0xc16a('0x2a')]]={'$like':'%'+_0xabe6e1[_0xc16a('0x34')][_0xc16a('0x3d')]+'%'};return _0x3b2ffc;}})});}_0x4eb4ab=_['merge']({},_0x4eb4ab,_0xabe6e1[_0xc16a('0x40')]);var _0x2a264f={'where':_0x4eb4ab[_0xc16a('0x3b')]};return db[_0xc16a('0x2d')][_0xc16a('0x1f')](_0x2a264f)[_0xc16a('0x26')](function(_0x429b3e){_0x25b3ac[_0xc16a('0x1f')]=_0x429b3e;if(_0xabe6e1[_0xc16a('0x34')][_0xc16a('0x41')]){_0x4eb4ab[_0xc16a('0x42')]=[{'all':!![]}];}return db[_0xc16a('0x2d')][_0xc16a('0x43')](_0x4eb4ab);})[_0xc16a('0x26')](function(_0x2da184){_0x25b3ac[_0xc16a('0x44')]=_0x2da184;return _0x25b3ac;})[_0xc16a('0x26')](respondWithFilteredResult(_0x466fa2,_0x4eb4ab))[_0xc16a('0x45')](handleError(_0x466fa2,null));};exports['show']=function(_0x22444e,_0x5ac231){var _0x42b983={'raw':![],'where':{'id':_0x22444e['params']['id']}},_0x50c360={};_0x50c360['model']=_['keys'](db[_0xc16a('0x2d')][_0xc16a('0x2e')]);_0x50c360[_0xc16a('0x34')]=_[_0xc16a('0x31')](_0x22444e[_0xc16a('0x34')]);_0x50c360[_0xc16a('0x32')]=_['intersection'](_0x50c360[_0xc16a('0x2f')],_0x50c360[_0xc16a('0x34')]);_0x42b983['attributes']=_['intersection'](_0x50c360[_0xc16a('0x2f')],qs['fields'](_0x22444e[_0xc16a('0x34')]['fields']));_0x42b983[_0xc16a('0x37')]=_0x42b983[_0xc16a('0x37')][_0xc16a('0x36')]?_0x42b983['attributes']:_0x50c360['model'];if(_0x22444e[_0xc16a('0x34')][_0xc16a('0x41')]){_0x42b983['include']=[{'all':!![]}];}_0x42b983=_[_0xc16a('0x3e')]({},_0x42b983,_0x22444e[_0xc16a('0x40')]);return db[_0xc16a('0x2d')][_0xc16a('0x46')](_0x42b983)[_0xc16a('0x26')](handleEntityNotFound(_0x5ac231,null))[_0xc16a('0x26')](respondWithResult(_0x5ac231,null))[_0xc16a('0x45')](handleError(_0x5ac231,null));};exports[_0xc16a('0x47')]=function(_0x14fa01,_0x634899){return db[_0xc16a('0x2d')]['create'](_0x14fa01['body'],{})[_0xc16a('0x26')](respondWithResult(_0x634899,0xc9))[_0xc16a('0x45')](handleError(_0x634899,null));};exports[_0xc16a('0x25')]=function(_0xe639fe,_0x3a2fe4){if(_0xe639fe['body']['id']){delete _0xe639fe['body']['id'];}return db[_0xc16a('0x2d')][_0xc16a('0x46')]({'where':{'id':_0xe639fe[_0xc16a('0x48')]['id']}})['then'](handleEntityNotFound(_0x3a2fe4,null))['then'](saveUpdates(_0xe639fe['body'],null))[_0xc16a('0x26')](respondWithResult(_0x3a2fe4,null))[_0xc16a('0x45')](handleError(_0x3a2fe4,null));};exports[_0xc16a('0x49')]=function(_0x1fb21d,_0x414f07){return db[_0xc16a('0x2d')]['find']({'where':{'id':_0x1fb21d[_0xc16a('0x48')]['id']}})['then'](handleEntityNotFound(_0x414f07,null))['then'](removeEntity(_0x414f07,null))[_0xc16a('0x45')](handleError(_0x414f07,null));};exports['getFields']=function(_0x4b3d1c,_0x142ee7,_0x51d7c2){var _0x3cf108={};var _0x543ccd={};var _0x1cc6be;var _0x6f0dc4;return db[_0xc16a('0x2d')]['findOne']({'where':{'id':_0x4b3d1c['params']['id']}})[_0xc16a('0x26')](handleEntityNotFound(_0x142ee7,null))[_0xc16a('0x26')](function(_0x2d2201){if(_0x2d2201){_0x1cc6be=_0x2d2201;_0x543ccd[_0xc16a('0x2f')]=_[_0xc16a('0x31')](db[_0xc16a('0x4a')][_0xc16a('0x2e')]);_0x543ccd[_0xc16a('0x34')]=_[_0xc16a('0x31')](_0x4b3d1c['query']);_0x543ccd[_0xc16a('0x32')]=_[_0xc16a('0x33')](_0x543ccd[_0xc16a('0x2f')],_0x543ccd['query']);_0x3cf108[_0xc16a('0x37')]=_[_0xc16a('0x33')](_0x543ccd['model'],qs[_0xc16a('0x35')](_0x4b3d1c[_0xc16a('0x34')][_0xc16a('0x35')]));_0x3cf108[_0xc16a('0x37')]=_0x3cf108['attributes'][_0xc16a('0x36')]?_0x3cf108[_0xc16a('0x37')]:_0x543ccd[_0xc16a('0x2f')];_0x3cf108['order']=qs[_0xc16a('0x3a')](_0x4b3d1c[_0xc16a('0x34')][_0xc16a('0x3a')]);_0x3cf108[_0xc16a('0x3b')]=qs[_0xc16a('0x32')](_[_0xc16a('0x3c')](_0x4b3d1c[_0xc16a('0x34')],_0x543ccd[_0xc16a('0x32')]));if(_0x4b3d1c[_0xc16a('0x34')][_0xc16a('0x3d')]){_0x3cf108[_0xc16a('0x3b')]=_[_0xc16a('0x3e')](_0x3cf108[_0xc16a('0x3b')],{'$or':_[_0xc16a('0x30')](_0x3cf108['attributes'],function(_0x14a2fc){var _0x23ed5d={};_0x23ed5d[_0x14a2fc]={'$like':'%'+_0x4b3d1c[_0xc16a('0x34')][_0xc16a('0x3d')]+'%'};return _0x23ed5d;})});}_0x3cf108=_[_0xc16a('0x3e')]({},_0x3cf108,_0x4b3d1c[_0xc16a('0x40')]);return _0x1cc6be[_0xc16a('0x4b')](_0x3cf108);}})[_0xc16a('0x26')](function(_0x376fbe){if(_0x376fbe){_0x6f0dc4=_0x376fbe[_0xc16a('0x36')];if(!_0x4b3d1c['query']['hasOwnProperty']('nolimit')){_0x3cf108['limit']=qs['limit'](_0x4b3d1c[_0xc16a('0x34')][_0xc16a('0x1e')]);_0x3cf108[_0xc16a('0x1c')]=qs[_0xc16a('0x1c')](_0x4b3d1c[_0xc16a('0x34')][_0xc16a('0x1c')]);}return _0x1cc6be[_0xc16a('0x4b')](_0x3cf108);}})[_0xc16a('0x26')](function(_0x23a286){if(_0x23a286){return _0x23a286?{'count':_0x6f0dc4,'rows':_0x23a286}:null;}})[_0xc16a('0x26')](respondWithResult(_0x142ee7,null))[_0xc16a('0x45')](handleError(_0x142ee7,null));};exports[_0xc16a('0x4c')]=function(_0x514c86,_0x31fc74,_0x343825){var _0x149e27={};var _0x10d2bf={};var _0x1e450f;var _0x5e56b5;return db[_0xc16a('0x2d')][_0xc16a('0x4d')]({'where':{'id':_0x514c86[_0xc16a('0x48')]['id']}})[_0xc16a('0x26')](handleEntityNotFound(_0x31fc74,null))[_0xc16a('0x26')](function(_0x5e7ff1){if(_0x5e7ff1){_0x1e450f=_0x5e7ff1;_0x10d2bf[_0xc16a('0x2f')]=_[_0xc16a('0x31')](db[_0xc16a('0x4a')]['rawAttributes']);_0x10d2bf[_0xc16a('0x34')]=_[_0xc16a('0x31')](_0x514c86[_0xc16a('0x34')]);_0x10d2bf['filters']=_[_0xc16a('0x33')](_0x10d2bf['model'],_0x10d2bf['query']);_0x149e27[_0xc16a('0x37')]=_[_0xc16a('0x33')](_0x10d2bf[_0xc16a('0x2f')],qs[_0xc16a('0x35')](_0x514c86[_0xc16a('0x34')][_0xc16a('0x35')]));_0x149e27[_0xc16a('0x37')]=_0x149e27[_0xc16a('0x37')]['length']?_0x149e27[_0xc16a('0x37')]:_0x10d2bf[_0xc16a('0x2f')];_0x149e27['order']=qs[_0xc16a('0x3a')](_0x514c86['query'][_0xc16a('0x3a')]);_0x149e27[_0xc16a('0x3b')]=qs[_0xc16a('0x32')](_[_0xc16a('0x3c')](_0x514c86[_0xc16a('0x34')],_0x10d2bf['filters']));if(_0x514c86[_0xc16a('0x34')][_0xc16a('0x3d')]){_0x149e27['where']=_['merge'](_0x149e27['where'],{'$or':_[_0xc16a('0x30')](_0x149e27[_0xc16a('0x37')],function(_0x2ae2e1){var _0x1c711b={};_0x1c711b[_0x2ae2e1]={'$like':'%'+_0x514c86[_0xc16a('0x34')][_0xc16a('0x3d')]+'%'};return _0x1c711b;})});}_0x149e27=_['merge']({},_0x149e27,_0x514c86[_0xc16a('0x40')]);return _0x1e450f['getSubjects'](_0x149e27);}})[_0xc16a('0x26')](function(_0x5d53f6){if(_0x5d53f6){_0x5e56b5=_0x5d53f6[_0xc16a('0x36')];if(!_0x514c86[_0xc16a('0x34')][_0xc16a('0x38')](_0xc16a('0x39'))){_0x149e27[_0xc16a('0x1e')]=qs[_0xc16a('0x1e')](_0x514c86[_0xc16a('0x34')]['limit']);_0x149e27[_0xc16a('0x1c')]=qs[_0xc16a('0x1c')](_0x514c86['query'][_0xc16a('0x1c')]);}return _0x1e450f[_0xc16a('0x4c')](_0x149e27);}})[_0xc16a('0x26')](function(_0x5a8d86){if(_0x5a8d86){return _0x5a8d86?{'count':_0x5e56b5,'rows':_0x5a8d86}:null;}})['then'](respondWithResult(_0x31fc74,null))['catch'](handleError(_0x31fc74,null));};exports[_0xc16a('0x4e')]=function(_0xf2854f,_0x27eda0,_0x5e5b11){var _0x4e0e79={};var _0x3b4f42={};var _0x2c8da3;var _0x1e0341;return db[_0xc16a('0x2d')][_0xc16a('0x4d')]({'where':{'id':_0xf2854f[_0xc16a('0x48')]['id']}})['then'](handleEntityNotFound(_0x27eda0,null))['then'](function(_0xb8daeb){if(_0xb8daeb){_0x2c8da3=_0xb8daeb;_0x3b4f42['model']=_['keys'](db[_0xc16a('0x4a')][_0xc16a('0x2e')]);_0x3b4f42[_0xc16a('0x34')]=_['keys'](_0xf2854f[_0xc16a('0x34')]);_0x3b4f42[_0xc16a('0x32')]=_[_0xc16a('0x33')](_0x3b4f42[_0xc16a('0x2f')],_0x3b4f42[_0xc16a('0x34')]);_0x4e0e79[_0xc16a('0x37')]=_[_0xc16a('0x33')](_0x3b4f42[_0xc16a('0x2f')],qs[_0xc16a('0x35')](_0xf2854f[_0xc16a('0x34')][_0xc16a('0x35')]));_0x4e0e79[_0xc16a('0x37')]=_0x4e0e79[_0xc16a('0x37')]['length']?_0x4e0e79[_0xc16a('0x37')]:_0x3b4f42['model'];_0x4e0e79[_0xc16a('0x4f')]=qs[_0xc16a('0x3a')](_0xf2854f[_0xc16a('0x34')]['sort']);_0x4e0e79[_0xc16a('0x3b')]=qs['filters'](_[_0xc16a('0x3c')](_0xf2854f['query'],_0x3b4f42[_0xc16a('0x32')]));if(_0xf2854f[_0xc16a('0x34')][_0xc16a('0x3d')]){_0x4e0e79[_0xc16a('0x3b')]=_[_0xc16a('0x3e')](_0x4e0e79[_0xc16a('0x3b')],{'$or':_[_0xc16a('0x30')](_0x4e0e79[_0xc16a('0x37')],function(_0x4444d4){var _0x1095d6={};_0x1095d6[_0x4444d4]={'$like':'%'+_0xf2854f[_0xc16a('0x34')]['filter']+'%'};return _0x1095d6;})});}_0x4e0e79=_[_0xc16a('0x3e')]({},_0x4e0e79,_0xf2854f[_0xc16a('0x40')]);return _0x2c8da3[_0xc16a('0x4e')](_0x4e0e79);}})[_0xc16a('0x26')](function(_0x53baf2){if(_0x53baf2){_0x1e0341=_0x53baf2[_0xc16a('0x36')];if(!_0xf2854f[_0xc16a('0x34')][_0xc16a('0x38')](_0xc16a('0x39'))){_0x4e0e79['limit']=qs['limit'](_0xf2854f[_0xc16a('0x34')][_0xc16a('0x1e')]);_0x4e0e79[_0xc16a('0x1c')]=qs[_0xc16a('0x1c')](_0xf2854f[_0xc16a('0x34')][_0xc16a('0x1c')]);}return _0x2c8da3[_0xc16a('0x4e')](_0x4e0e79);}})[_0xc16a('0x26')](function(_0x14149b){if(_0x14149b){return _0x14149b?{'count':_0x1e0341,'rows':_0x14149b}:null;}})['then'](respondWithResult(_0x27eda0,null))[_0xc16a('0x45')](handleError(_0x27eda0,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 292a7a0..4c2358c 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 _0x5160=['bluebird','request-promise','../../config/environment','./intSugarcrmConfiguration.attributes','define','SugarcrmConfiguration','int_sugarcrm_configurations','lodash','util','../../config/logger','api','moment'];(function(_0x3950e1,_0x57ea4a){var _0x519a2c=function(_0x549547){while(--_0x549547){_0x3950e1['push'](_0x3950e1['shift']());}};_0x519a2c(++_0x57ea4a);}(_0x5160,0x1db));var _0x0516=function(_0x30661b,_0x4fd6b0){_0x30661b=_0x30661b-0x0;var _0x3b19e8=_0x5160[_0x30661b];return _0x3b19e8;};'use strict';var _=require(_0x0516('0x0'));var util=require(_0x0516('0x1'));var logger=require(_0x0516('0x2'))(_0x0516('0x3'));var moment=require(_0x0516('0x4'));var BPromise=require(_0x0516('0x5'));var rp=require(_0x0516('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x0516('0x7'));var attributes=require(_0x0516('0x8'));module['exports']=function(_0x5a6783,_0x5a8cbf){return _0x5a6783[_0x0516('0x9')](_0x0516('0xa'),attributes,{'tableName':_0x0516('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x53b9=['util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes','exports','define','lodash'];(function(_0x5734a7,_0x536526){var _0x2df47b=function(_0x34e304){while(--_0x34e304){_0x5734a7['push'](_0x5734a7['shift']());}};_0x2df47b(++_0x536526);}(_0x53b9,0x13e));var _0x953b=function(_0x6b42c1,_0x4e0640){_0x6b42c1=_0x6b42c1-0x0;var _0x11e88a=_0x53b9[_0x6b42c1];return _0x11e88a;};'use strict';var _=require(_0x953b('0x0'));var util=require(_0x953b('0x1'));var logger=require(_0x953b('0x2'))(_0x953b('0x3'));var moment=require('moment');var BPromise=require(_0x953b('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x953b('0x5'));var rimraf=require(_0x953b('0x6'));var config=require(_0x953b('0x7'));var attributes=require(_0x953b('0x8'));module[_0x953b('0x9')]=function(_0x4ee0a6,_0x24d9da){return _0x4ee0a6[_0x953b('0xa')]('SugarcrmConfiguration',attributes,{'tableName':'int_sugarcrm_configurations','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 78a4704..7aa8660 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 _0xbeef=['SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','info'];(function(_0x23e7c1,_0x35110c){var _0x1add43=function(_0x238918){while(--_0x238918){_0x23e7c1['push'](_0x23e7c1['shift']());}};_0x1add43(++_0x35110c);}(_0xbeef,0xdb));var _0xfbee=function(_0x5e47dc,_0x4ee776){_0x5e47dc=_0x5e47dc-0x0;var _0x9e8c3f=_0xbeef[_0x5e47dc];return _0x9e8c3f;};'use strict';var _=require(_0xfbee('0x0'));var util=require(_0xfbee('0x1'));var moment=require(_0xfbee('0x2'));var BPromise=require(_0xfbee('0x3'));var rs=require(_0xfbee('0x4'));var fs=require('fs');var Redis=require(_0xfbee('0x5'));var db=require(_0xfbee('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xfbee('0x7'))(_0xfbee('0x8'));var config=require('../../config/environment');var jayson=require(_0xfbee('0x9'));var client=jayson['client'][_0xfbee('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x349422,_0x28bbbd,_0x596049){return new BPromise(function(_0x3069a5,_0x3cbf10){return client['request'](_0x349422,_0x596049)['then'](function(_0x490ba7){logger[_0xfbee('0xb')](_0xfbee('0xc'),_0x28bbbd,_0xfbee('0xd'));logger[_0xfbee('0xe')]('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x28bbbd,_0xfbee('0xd'),JSON[_0xfbee('0xf')](_0x490ba7));if(_0x490ba7['error']){if(_0x490ba7[_0xfbee('0x10')][_0xfbee('0x11')]===0x1f4){logger[_0xfbee('0x10')](_0xfbee('0xc'),_0x28bbbd,_0x490ba7[_0xfbee('0x10')]['message']);return _0x3cbf10(_0x490ba7[_0xfbee('0x10')]['message']);}logger['error']('SugarcrmConfiguration,\x20%s,\x20%s',_0x28bbbd,_0x490ba7['error'][_0xfbee('0x12')]);return _0x3069a5(_0x490ba7[_0xfbee('0x10')]['message']);}else{logger[_0xfbee('0xb')](_0xfbee('0xc'),_0x28bbbd,_0xfbee('0xd'));_0x3069a5(_0x490ba7[_0xfbee('0x13')][_0xfbee('0x12')]);}})[_0xfbee('0x14')](function(_0x155b51){logger[_0xfbee('0x10')](_0xfbee('0xc'),_0x28bbbd,_0x155b51);_0x3cbf10(_0x155b51);});});} \ No newline at end of file +var _0x5bcf=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','lodash','util'];(function(_0x58bba8,_0x2fe7fa){var _0x502a12=function(_0x40e7c2){while(--_0x40e7c2){_0x58bba8['push'](_0x58bba8['shift']());}};_0x502a12(++_0x2fe7fa);}(_0x5bcf,0x1c6));var _0xf5bc=function(_0x233eab,_0x5c910f){_0x233eab=_0x233eab-0x0;var _0x288cc3=_0x5bcf[_0x233eab];return _0x288cc3;};'use strict';var _=require(_0xf5bc('0x0'));var util=require(_0xf5bc('0x1'));var moment=require(_0xf5bc('0x2'));var BPromise=require(_0xf5bc('0x3'));var rs=require(_0xf5bc('0x4'));var fs=require('fs');var Redis=require(_0xf5bc('0x5'));var db=require(_0xf5bc('0x6'))['db'];var utils=require(_0xf5bc('0x7'));var logger=require(_0xf5bc('0x8'))('rpc');var config=require(_0xf5bc('0x9'));var jayson=require(_0xf5bc('0xa'));var client=jayson[_0xf5bc('0xb')][_0xf5bc('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3c0586,_0x5c818c,_0x573f13){return new BPromise(function(_0x35b3ac,_0x292aa1){return client[_0xf5bc('0xd')](_0x3c0586,_0x573f13)[_0xf5bc('0xe')](function(_0x390117){logger[_0xf5bc('0xf')](_0xf5bc('0x10'),_0x5c818c,'request\x20sent');logger[_0xf5bc('0x11')](_0xf5bc('0x12'),_0x5c818c,_0xf5bc('0x13'),JSON[_0xf5bc('0x14')](_0x390117));if(_0x390117[_0xf5bc('0x15')]){if(_0x390117[_0xf5bc('0x15')]['code']===0x1f4){logger[_0xf5bc('0x15')](_0xf5bc('0x10'),_0x5c818c,_0x390117[_0xf5bc('0x15')][_0xf5bc('0x16')]);return _0x292aa1(_0x390117[_0xf5bc('0x15')][_0xf5bc('0x16')]);}logger['error'](_0xf5bc('0x10'),_0x5c818c,_0x390117[_0xf5bc('0x15')][_0xf5bc('0x16')]);return _0x35b3ac(_0x390117[_0xf5bc('0x15')]['message']);}else{logger['info'](_0xf5bc('0x10'),_0x5c818c,_0xf5bc('0x13'));_0x35b3ac(_0x390117[_0xf5bc('0x17')][_0xf5bc('0x16')]);}})['catch'](function(_0x4a592b){logger[_0xf5bc('0x15')](_0xf5bc('0x10'),_0x5c818c,_0x4a592b);_0x292aa1(_0x4a592b);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 4c3610e..91c637c 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 _0xe275=['index','get','/:id','post','create','put','isAuthenticated','update','delete','destroy','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x535591,_0x50a974){var _0xb45690=function(_0x30ec11){while(--_0x30ec11){_0x535591['push'](_0x535591['shift']());}};_0xb45690(++_0x50a974);}(_0xe275,0x8a));var _0x5e27=function(_0x510395,_0x4c17af){_0x510395=_0x510395-0x0;var _0xebc830=_0xe275[_0x510395];return _0xebc830;};'use strict';var multer=require('multer');var util=require(_0x5e27('0x0'));var path=require('path');var timeout=require(_0x5e27('0x1'));var express=require(_0x5e27('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x5e27('0x3'));var interaction=require(_0x5e27('0x4'));var config=require(_0x5e27('0x5'));var controller=require('./intSugarcrmField.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x5e27('0x6')]);router[_0x5e27('0x7')](_0x5e27('0x8'),auth['isAuthenticated'](),controller['show']);router[_0x5e27('0x9')]('/',auth['isAuthenticated'](),controller[_0x5e27('0xa')]);router[_0x5e27('0xb')](_0x5e27('0x8'),auth[_0x5e27('0xc')](),controller[_0x5e27('0xd')]);router[_0x5e27('0xe')](_0x5e27('0x8'),auth[_0x5e27('0xc')](),controller[_0x5e27('0xf')]);module['exports']=router; \ No newline at end of file +var _0x28cd=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','post','create','put'];(function(_0x4ed035,_0xe4c26e){var _0x2bbc95=function(_0x1eb9f9){while(--_0x1eb9f9){_0x4ed035['push'](_0x4ed035['shift']());}};_0x2bbc95(++_0xe4c26e);}(_0x28cd,0x1a6));var _0xd28c=function(_0x41d857,_0x281aa3){_0x41d857=_0x41d857-0x0;var _0x4bac24=_0x28cd[_0x41d857];return _0x4bac24;};'use strict';var multer=require(_0xd28c('0x0'));var util=require(_0xd28c('0x1'));var path=require(_0xd28c('0x2'));var timeout=require(_0xd28c('0x3'));var express=require(_0xd28c('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xd28c('0x5'));var interaction=require(_0xd28c('0x6'));var config=require(_0xd28c('0x7'));var controller=require('./intSugarcrmField.controller');router[_0xd28c('0x8')]('/',auth[_0xd28c('0x9')](),controller['index']);router['get'](_0xd28c('0xa'),auth[_0xd28c('0x9')](),controller[_0xd28c('0xb')]);router[_0xd28c('0xc')]('/',auth[_0xd28c('0x9')](),controller[_0xd28c('0xd')]);router[_0xd28c('0xe')](_0xd28c('0xa'),auth[_0xd28c('0x9')](),controller[_0xd28c('0xf')]);router[_0xd28c('0x10')](_0xd28c('0xa'),auth[_0xd28c('0x9')](),controller[_0xd28c('0x11')]);module[_0xd28c('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 ba624d5..9bf6e69 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 _0x19a0=['sequelize','exports','ENUM','string','variable','picklist','STRING','customVariable'];(function(_0x98011a,_0x1a7b4d){var _0x39f9ed=function(_0x4327bf){while(--_0x4327bf){_0x98011a['push'](_0x98011a['shift']());}};_0x39f9ed(++_0x1a7b4d);}(_0x19a0,0x1d8));var _0x019a=function(_0x532e30,_0x208c8d){_0x532e30=_0x532e30-0x0;var _0x386309=_0x19a0[_0x532e30];return _0x386309;};'use strict';var Sequelize=require(_0x019a('0x0'));module[_0x019a('0x1')]={'type':{'type':Sequelize[_0x019a('0x2')](_0x019a('0x3'),_0x019a('0x4'),'customVariable','keyValue',_0x019a('0x5')),'defaultValue':_0x019a('0x3')},'content':{'type':Sequelize[_0x019a('0x6')]},'key':{'type':Sequelize[_0x019a('0x6')]},'keyType':{'type':Sequelize[_0x019a('0x2')](_0x019a('0x3'),'variable',_0x019a('0x7'))},'keyContent':{'type':Sequelize[_0x019a('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x019a('0x6')]}}; \ No newline at end of file +var _0x86ea=['sequelize','exports','ENUM','variable','customVariable','picklist','string','STRING','BOOLEAN'];(function(_0xefba96,_0x143d22){var _0x4f547f=function(_0x754e6f){while(--_0x754e6f){_0xefba96['push'](_0xefba96['shift']());}};_0x4f547f(++_0x143d22);}(_0x86ea,0x144));var _0xa86e=function(_0x5e6f1c,_0x360063){_0x5e6f1c=_0x5e6f1c-0x0;var _0x47ed8f=_0x86ea[_0x5e6f1c];return _0x47ed8f;};'use strict';var Sequelize=require(_0xa86e('0x0'));module[_0xa86e('0x1')]={'type':{'type':Sequelize[_0xa86e('0x2')]('string',_0xa86e('0x3'),_0xa86e('0x4'),'keyValue',_0xa86e('0x5')),'defaultValue':_0xa86e('0x6')},'content':{'type':Sequelize[_0xa86e('0x7')]},'key':{'type':Sequelize[_0xa86e('0x7')]},'keyType':{'type':Sequelize[_0xa86e('0x2')](_0xa86e('0x6'),_0xa86e('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0xa86e('0x7')]},'idField':{'type':Sequelize[_0xa86e('0x7')]},'nameField':{'type':Sequelize[_0xa86e('0x7')]},'customField':{'type':Sequelize[_0xa86e('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xa86e('0x7')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index e93cc10..a6a2652 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 _0x6167=['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/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','SugarcrmField','includeAll','findAll','rows','catch','show','keys','include','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util'];(function(_0x2b135b,_0x4c1515){var _0x2bf9c6=function(_0x5954e9){while(--_0x5954e9){_0x2b135b['push'](_0x2b135b['shift']());}};_0x2bf9c6(++_0x4c1515);}(_0x6167,0x96));var _0x7616=function(_0x141390,_0x4a5d90){_0x141390=_0x141390-0x0;var _0x397597=_0x6167[_0x141390];return _0x397597;};'use strict';var emlformat=require(_0x7616('0x0'));var rimraf=require(_0x7616('0x1'));var zipdir=require(_0x7616('0x2'));var jsonpatch=require(_0x7616('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x7616('0x4'));var util=require(_0x7616('0x5'));var path=require(_0x7616('0x6'));var sox=require(_0x7616('0x7'));var csv=require(_0x7616('0x8'));var ejs=require(_0x7616('0x9'));var fs=require('fs');var fs_extra=require(_0x7616('0xa'));var _=require(_0x7616('0xb'));var squel=require(_0x7616('0xc'));var crypto=require(_0x7616('0xd'));var jsforce=require(_0x7616('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x7616('0xf'));var Papa=require(_0x7616('0x10'));var Redis=require(_0x7616('0x11'));var authService=require(_0x7616('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x7616('0x13'));var hardwareService=require(_0x7616('0x14'));var logger=require(_0x7616('0x15'))(_0x7616('0x16'));var utils=require('../../config/utils');var config=require(_0x7616('0x17'));var licenseUtil=require(_0x7616('0x18'));var db=require(_0x7616('0x19'))['db'];function respondWithStatusCode(_0x28d921,_0x14dc00){_0x14dc00=_0x14dc00||0xcc;return function(_0x4ea2cf){if(_0x4ea2cf){return _0x28d921[_0x7616('0x1a')](_0x14dc00);}return _0x28d921[_0x7616('0x1b')](_0x14dc00)[_0x7616('0x1c')]();};}function respondWithResult(_0x391f32,_0x37d332){_0x37d332=_0x37d332||0xc8;return function(_0xdcbc71){if(_0xdcbc71){return _0x391f32[_0x7616('0x1b')](_0x37d332)[_0x7616('0x1d')](_0xdcbc71);}};}function respondWithFilteredResult(_0x38914b,_0x32810c){return function(_0x3e9b12){if(_0x3e9b12){var _0x4ce01a=typeof _0x32810c[_0x7616('0x1e')]===_0x7616('0x1f')&&typeof _0x32810c[_0x7616('0x20')]===_0x7616('0x1f');var _0x557c3b=_0x3e9b12[_0x7616('0x21')];var _0x3d09f7=_0x4ce01a?0x0:_0x32810c['offset'];var _0x1be275=_0x4ce01a?_0x3e9b12['count']:_0x32810c[_0x7616('0x1e')]+_0x32810c['limit'];var _0x1cc446;if(_0x1be275>=_0x557c3b){_0x1be275=_0x557c3b;_0x1cc446=0xc8;}else{_0x1cc446=0xce;}_0x38914b[_0x7616('0x1b')](_0x1cc446);return _0x38914b['set'](_0x7616('0x22'),_0x3d09f7+'-'+_0x1be275+'/'+_0x557c3b)[_0x7616('0x1d')](_0x3e9b12);}return null;};}function patchUpdates(_0x1d6dd7){return function(_0x27a61a){try{jsonpatch['apply'](_0x27a61a,_0x1d6dd7,!![]);}catch(_0x8bffc7){return BPromise[_0x7616('0x23')](_0x8bffc7);}return _0x27a61a[_0x7616('0x24')]();};}function saveUpdates(_0x54b59f,_0x3ea462){return function(_0x2ef72f){if(_0x2ef72f){return _0x2ef72f[_0x7616('0x25')](_0x54b59f)[_0x7616('0x26')](function(_0xf93728){return _0xf93728;});}return null;};}function removeEntity(_0x700338,_0x40238b){return function(_0x2f12aa){if(_0x2f12aa){return _0x2f12aa[_0x7616('0x27')]()['then'](function(){_0x700338['status'](0xcc)[_0x7616('0x1c')]();});}};}function handleEntityNotFound(_0x2e1a3f,_0x40dcb7){return function(_0xd9cc5c){if(!_0xd9cc5c){_0x2e1a3f[_0x7616('0x1a')](0x194);}return _0xd9cc5c;};}function handleError(_0xf5742e,_0x4e9ec5){_0x4e9ec5=_0x4e9ec5||0x1f4;return function(_0xdd4ffb){logger[_0x7616('0x28')](_0xdd4ffb[_0x7616('0x29')]);if(_0xdd4ffb[_0x7616('0x2a')]){delete _0xdd4ffb[_0x7616('0x2a')];}_0xf5742e[_0x7616('0x1b')](_0x4e9ec5)[_0x7616('0x2b')](_0xdd4ffb);};}exports[_0x7616('0x2c')]=function(_0x4e0890,_0x22d1bf){var _0x78ef9={},_0x21e608={},_0x55b1c9={'count':0x0,'rows':[]};var _0x23ddff=_[_0x7616('0x2d')](db['SugarcrmField'][_0x7616('0x2e')],function(_0x33c0fb){return{'name':_0x33c0fb['fieldName'],'type':_0x33c0fb[_0x7616('0x2f')][_0x7616('0x30')]};});_0x21e608[_0x7616('0x31')]=_['map'](_0x23ddff,_0x7616('0x2a'));_0x21e608[_0x7616('0x32')]=_['keys'](_0x4e0890['query']);_0x21e608[_0x7616('0x33')]=_['intersection'](_0x21e608['model'],_0x21e608[_0x7616('0x32')]);_0x78ef9[_0x7616('0x34')]=_[_0x7616('0x35')](_0x21e608[_0x7616('0x31')],qs['fields'](_0x4e0890['query'][_0x7616('0x36')]));_0x78ef9[_0x7616('0x34')]=_0x78ef9[_0x7616('0x34')][_0x7616('0x37')]?_0x78ef9['attributes']:_0x21e608[_0x7616('0x31')];if(!_0x4e0890[_0x7616('0x32')][_0x7616('0x38')](_0x7616('0x39'))){_0x78ef9['limit']=qs[_0x7616('0x20')](_0x4e0890[_0x7616('0x32')][_0x7616('0x20')]);_0x78ef9[_0x7616('0x1e')]=qs[_0x7616('0x1e')](_0x4e0890[_0x7616('0x32')]['offset']);}_0x78ef9[_0x7616('0x3a')]=qs[_0x7616('0x3b')](_0x4e0890['query']['sort']);_0x78ef9['where']=qs[_0x7616('0x33')](_[_0x7616('0x3c')](_0x4e0890['query'],_0x21e608['filters']),_0x23ddff);if(_0x4e0890[_0x7616('0x32')][_0x7616('0x3d')]){_0x78ef9[_0x7616('0x3e')]=_[_0x7616('0x3f')](_0x78ef9[_0x7616('0x3e')],{'$or':_[_0x7616('0x2d')](_0x23ddff,function(_0x1e87a6){if(_0x1e87a6[_0x7616('0x2f')]!==_0x7616('0x40')){var _0x4438f8={};_0x4438f8[_0x1e87a6[_0x7616('0x2a')]]={'$like':'%'+_0x4e0890[_0x7616('0x32')][_0x7616('0x3d')]+'%'};return _0x4438f8;}})});}_0x78ef9=_[_0x7616('0x3f')]({},_0x78ef9,_0x4e0890[_0x7616('0x41')]);var _0x4050de={'where':_0x78ef9[_0x7616('0x3e')]};return db[_0x7616('0x42')][_0x7616('0x21')](_0x4050de)[_0x7616('0x26')](function(_0x4ca8dd){_0x55b1c9['count']=_0x4ca8dd;if(_0x4e0890['query'][_0x7616('0x43')]){_0x78ef9['include']=[{'all':!![]}];}return db['SugarcrmField'][_0x7616('0x44')](_0x78ef9);})[_0x7616('0x26')](function(_0x939eb5){_0x55b1c9[_0x7616('0x45')]=_0x939eb5;return _0x55b1c9;})[_0x7616('0x26')](respondWithFilteredResult(_0x22d1bf,_0x78ef9))[_0x7616('0x46')](handleError(_0x22d1bf,null));};exports[_0x7616('0x47')]=function(_0x4d8416,_0x42a531){var _0x52c45c={'raw':!![],'where':{'id':_0x4d8416['params']['id']}},_0x3f2f00={};_0x3f2f00[_0x7616('0x31')]=_[_0x7616('0x48')](db[_0x7616('0x42')][_0x7616('0x2e')]);_0x3f2f00[_0x7616('0x32')]=_['keys'](_0x4d8416[_0x7616('0x32')]);_0x3f2f00[_0x7616('0x33')]=_['intersection'](_0x3f2f00['model'],_0x3f2f00[_0x7616('0x32')]);_0x52c45c[_0x7616('0x34')]=_[_0x7616('0x35')](_0x3f2f00[_0x7616('0x31')],qs[_0x7616('0x36')](_0x4d8416[_0x7616('0x32')]['fields']));_0x52c45c[_0x7616('0x34')]=_0x52c45c[_0x7616('0x34')][_0x7616('0x37')]?_0x52c45c[_0x7616('0x34')]:_0x3f2f00[_0x7616('0x31')];if(_0x4d8416[_0x7616('0x32')]['includeAll']){_0x52c45c[_0x7616('0x49')]=[{'all':!![]}];}_0x52c45c=_['merge']({},_0x52c45c,_0x4d8416['options']);return db['SugarcrmField'][_0x7616('0x4a')](_0x52c45c)[_0x7616('0x26')](handleEntityNotFound(_0x42a531,null))['then'](respondWithResult(_0x42a531,null))['catch'](handleError(_0x42a531,null));};exports[_0x7616('0x4b')]=function(_0x528f84,_0x2cd51a){return db[_0x7616('0x42')][_0x7616('0x4b')](_0x528f84['body'],{})[_0x7616('0x26')](respondWithResult(_0x2cd51a,0xc9))['catch'](handleError(_0x2cd51a,null));};exports[_0x7616('0x25')]=function(_0x3a39fe,_0x1e2575){if(_0x3a39fe['body']['id']){delete _0x3a39fe[_0x7616('0x4c')]['id'];}return db[_0x7616('0x42')][_0x7616('0x4a')]({'where':{'id':_0x3a39fe[_0x7616('0x4d')]['id']}})[_0x7616('0x26')](handleEntityNotFound(_0x1e2575,null))['then'](saveUpdates(_0x3a39fe[_0x7616('0x4c')],null))[_0x7616('0x26')](respondWithResult(_0x1e2575,null))[_0x7616('0x46')](handleError(_0x1e2575,null));};exports['destroy']=function(_0x3b59a1,_0x5e7225){return db[_0x7616('0x42')][_0x7616('0x4a')]({'where':{'id':_0x3b59a1[_0x7616('0x4d')]['id']}})[_0x7616('0x26')](handleEntityNotFound(_0x5e7225,null))[_0x7616('0x26')](removeEntity(_0x5e7225,null))[_0x7616('0x46')](handleError(_0x5e7225,null));}; \ No newline at end of file +var _0x05b4=['limit','count','offset','set','Content-Range','apply','reject','save','then','error','stack','name','send','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','SugarcrmField','includeAll','include','rows','catch','params','length','find','create','body','destroy','zip-dir','fast-json-patch','bluebird','util','sox','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined'];(function(_0x45b1ba,_0x5a6a21){var _0x145ddb=function(_0x650d42){while(--_0x650d42){_0x45b1ba['push'](_0x45b1ba['shift']());}};_0x145ddb(++_0x5a6a21);}(_0x05b4,0x1bf));var _0x405b=function(_0x1e5bbb,_0x1905c0){_0x1e5bbb=_0x1e5bbb-0x0;var _0x152fe9=_0x05b4[_0x1e5bbb];return _0x152fe9;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x405b('0x0'));var jsonpatch=require(_0x405b('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x405b('0x2'));var Mustache=require('mustache');var util=require(_0x405b('0x3'));var path=require('path');var sox=require(_0x405b('0x4'));var csv=require(_0x405b('0x5'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x405b('0x6'));var squel=require(_0x405b('0x7'));var crypto=require('crypto');var jsforce=require(_0x405b('0x8'));var deskjs=require(_0x405b('0x9'));var toCsv=require(_0x405b('0x5'));var querystring=require(_0x405b('0xa'));var Papa=require(_0x405b('0xb'));var Redis=require(_0x405b('0xc'));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('../../config/logger')(_0x405b('0xd'));var utils=require(_0x405b('0xe'));var config=require('../../config/environment');var licenseUtil=require(_0x405b('0xf'));var db=require(_0x405b('0x10'))['db'];function respondWithStatusCode(_0x3bfa8a,_0x3dcad2){_0x3dcad2=_0x3dcad2||0xcc;return function(_0x2cf5ad){if(_0x2cf5ad){return _0x3bfa8a[_0x405b('0x11')](_0x3dcad2);}return _0x3bfa8a[_0x405b('0x12')](_0x3dcad2)[_0x405b('0x13')]();};}function respondWithResult(_0x363e6b,_0x47b82a){_0x47b82a=_0x47b82a||0xc8;return function(_0x559ee0){if(_0x559ee0){return _0x363e6b[_0x405b('0x12')](_0x47b82a)[_0x405b('0x14')](_0x559ee0);}};}function respondWithFilteredResult(_0x9ff053,_0x458a63){return function(_0x4b02ec){if(_0x4b02ec){var _0xa9a768=typeof _0x458a63['offset']===_0x405b('0x15')&&typeof _0x458a63[_0x405b('0x16')]===_0x405b('0x15');var _0x52049d=_0x4b02ec[_0x405b('0x17')];var _0x16d3a5=_0xa9a768?0x0:_0x458a63[_0x405b('0x18')];var _0x21a1fd=_0xa9a768?_0x4b02ec['count']:_0x458a63['offset']+_0x458a63[_0x405b('0x16')];var _0x18e18b;if(_0x21a1fd>=_0x52049d){_0x21a1fd=_0x52049d;_0x18e18b=0xc8;}else{_0x18e18b=0xce;}_0x9ff053[_0x405b('0x12')](_0x18e18b);return _0x9ff053[_0x405b('0x19')](_0x405b('0x1a'),_0x16d3a5+'-'+_0x21a1fd+'/'+_0x52049d)[_0x405b('0x14')](_0x4b02ec);}return null;};}function patchUpdates(_0x9c853f){return function(_0x4ee198){try{jsonpatch[_0x405b('0x1b')](_0x4ee198,_0x9c853f,!![]);}catch(_0x3a35bc){return BPromise[_0x405b('0x1c')](_0x3a35bc);}return _0x4ee198[_0x405b('0x1d')]();};}function saveUpdates(_0x2cce53,_0x29913b){return function(_0x244c6a){if(_0x244c6a){return _0x244c6a['update'](_0x2cce53)[_0x405b('0x1e')](function(_0x329c05){return _0x329c05;});}return null;};}function removeEntity(_0x7e9198,_0x34168f){return function(_0x1f60de){if(_0x1f60de){return _0x1f60de['destroy']()[_0x405b('0x1e')](function(){_0x7e9198['status'](0xcc)[_0x405b('0x13')]();});}};}function handleEntityNotFound(_0x521aa2,_0x42f0e2){return function(_0x314158){if(!_0x314158){_0x521aa2[_0x405b('0x11')](0x194);}return _0x314158;};}function handleError(_0x417d35,_0x5a2a28){_0x5a2a28=_0x5a2a28||0x1f4;return function(_0x377262){logger[_0x405b('0x1f')](_0x377262[_0x405b('0x20')]);if(_0x377262[_0x405b('0x21')]){delete _0x377262[_0x405b('0x21')];}_0x417d35[_0x405b('0x12')](_0x5a2a28)[_0x405b('0x22')](_0x377262);};}exports['index']=function(_0x2f409d,_0xeabd2e){var _0x302dc4={},_0x7ad7b2={},_0x2c05bb={'count':0x0,'rows':[]};var _0x56fa44=_['map'](db['SugarcrmField'][_0x405b('0x23')],function(_0x4c3fa6){return{'name':_0x4c3fa6[_0x405b('0x24')],'type':_0x4c3fa6[_0x405b('0x25')][_0x405b('0x26')]};});_0x7ad7b2[_0x405b('0x27')]=_[_0x405b('0x28')](_0x56fa44,_0x405b('0x21'));_0x7ad7b2[_0x405b('0x29')]=_[_0x405b('0x2a')](_0x2f409d[_0x405b('0x29')]);_0x7ad7b2[_0x405b('0x2b')]=_[_0x405b('0x2c')](_0x7ad7b2[_0x405b('0x27')],_0x7ad7b2[_0x405b('0x29')]);_0x302dc4[_0x405b('0x2d')]=_[_0x405b('0x2c')](_0x7ad7b2[_0x405b('0x27')],qs[_0x405b('0x2e')](_0x2f409d[_0x405b('0x29')][_0x405b('0x2e')]));_0x302dc4[_0x405b('0x2d')]=_0x302dc4[_0x405b('0x2d')]['length']?_0x302dc4[_0x405b('0x2d')]:_0x7ad7b2[_0x405b('0x27')];if(!_0x2f409d['query'][_0x405b('0x2f')](_0x405b('0x30'))){_0x302dc4[_0x405b('0x16')]=qs['limit'](_0x2f409d['query'][_0x405b('0x16')]);_0x302dc4[_0x405b('0x18')]=qs[_0x405b('0x18')](_0x2f409d[_0x405b('0x29')][_0x405b('0x18')]);}_0x302dc4[_0x405b('0x31')]=qs[_0x405b('0x32')](_0x2f409d[_0x405b('0x29')][_0x405b('0x32')]);_0x302dc4[_0x405b('0x33')]=qs[_0x405b('0x2b')](_['pick'](_0x2f409d[_0x405b('0x29')],_0x7ad7b2[_0x405b('0x2b')]),_0x56fa44);if(_0x2f409d[_0x405b('0x29')][_0x405b('0x34')]){_0x302dc4[_0x405b('0x33')]=_[_0x405b('0x35')](_0x302dc4[_0x405b('0x33')],{'$or':_[_0x405b('0x28')](_0x56fa44,function(_0x32c88c){if(_0x32c88c['type']!==_0x405b('0x36')){var _0x69999b={};_0x69999b[_0x32c88c[_0x405b('0x21')]]={'$like':'%'+_0x2f409d['query'][_0x405b('0x34')]+'%'};return _0x69999b;}})});}_0x302dc4=_[_0x405b('0x35')]({},_0x302dc4,_0x2f409d[_0x405b('0x37')]);var _0x1c917d={'where':_0x302dc4[_0x405b('0x33')]};return db[_0x405b('0x38')]['count'](_0x1c917d)['then'](function(_0x1ff9f7){_0x2c05bb[_0x405b('0x17')]=_0x1ff9f7;if(_0x2f409d[_0x405b('0x29')][_0x405b('0x39')]){_0x302dc4[_0x405b('0x3a')]=[{'all':!![]}];}return db[_0x405b('0x38')]['findAll'](_0x302dc4);})[_0x405b('0x1e')](function(_0x5333ba){_0x2c05bb[_0x405b('0x3b')]=_0x5333ba;return _0x2c05bb;})[_0x405b('0x1e')](respondWithFilteredResult(_0xeabd2e,_0x302dc4))[_0x405b('0x3c')](handleError(_0xeabd2e,null));};exports['show']=function(_0x59605b,_0x170ebd){var _0xcc530a={'raw':!![],'where':{'id':_0x59605b[_0x405b('0x3d')]['id']}},_0x455e43={};_0x455e43[_0x405b('0x27')]=_[_0x405b('0x2a')](db[_0x405b('0x38')][_0x405b('0x23')]);_0x455e43[_0x405b('0x29')]=_['keys'](_0x59605b[_0x405b('0x29')]);_0x455e43[_0x405b('0x2b')]=_[_0x405b('0x2c')](_0x455e43[_0x405b('0x27')],_0x455e43['query']);_0xcc530a[_0x405b('0x2d')]=_[_0x405b('0x2c')](_0x455e43[_0x405b('0x27')],qs[_0x405b('0x2e')](_0x59605b[_0x405b('0x29')]['fields']));_0xcc530a['attributes']=_0xcc530a[_0x405b('0x2d')][_0x405b('0x3e')]?_0xcc530a['attributes']:_0x455e43['model'];if(_0x59605b[_0x405b('0x29')][_0x405b('0x39')]){_0xcc530a[_0x405b('0x3a')]=[{'all':!![]}];}_0xcc530a=_[_0x405b('0x35')]({},_0xcc530a,_0x59605b['options']);return db[_0x405b('0x38')][_0x405b('0x3f')](_0xcc530a)[_0x405b('0x1e')](handleEntityNotFound(_0x170ebd,null))[_0x405b('0x1e')](respondWithResult(_0x170ebd,null))[_0x405b('0x3c')](handleError(_0x170ebd,null));};exports[_0x405b('0x40')]=function(_0xf19342,_0x2e8887){return db[_0x405b('0x38')][_0x405b('0x40')](_0xf19342[_0x405b('0x41')],{})[_0x405b('0x1e')](respondWithResult(_0x2e8887,0xc9))['catch'](handleError(_0x2e8887,null));};exports['update']=function(_0x59c5c3,_0x30778b){if(_0x59c5c3[_0x405b('0x41')]['id']){delete _0x59c5c3[_0x405b('0x41')]['id'];}return db[_0x405b('0x38')][_0x405b('0x3f')]({'where':{'id':_0x59c5c3[_0x405b('0x3d')]['id']}})['then'](handleEntityNotFound(_0x30778b,null))[_0x405b('0x1e')](saveUpdates(_0x59c5c3[_0x405b('0x41')],null))[_0x405b('0x1e')](respondWithResult(_0x30778b,null))['catch'](handleError(_0x30778b,null));};exports[_0x405b('0x42')]=function(_0x5ab46c,_0x403e3b){return db[_0x405b('0x38')][_0x405b('0x3f')]({'where':{'id':_0x5ab46c['params']['id']}})[_0x405b('0x1e')](handleEntityNotFound(_0x403e3b,null))['then'](removeEntity(_0x403e3b,null))[_0x405b('0x3c')](handleError(_0x403e3b,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index babd80d..c8de67d 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 _0xb1c2=['FieldId','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmField.attributes','exports','SugarcrmField','sugarcrm_unique_index','idField'];(function(_0x350343,_0x256f69){var _0x9afc1c=function(_0x47ab32){while(--_0x47ab32){_0x350343['push'](_0x350343['shift']());}};_0x9afc1c(++_0x256f69);}(_0xb1c2,0x97));var _0x2b1c=function(_0x1162f9,_0x35f87c){_0x1162f9=_0x1162f9-0x0;var _0x75257c=_0xb1c2[_0x1162f9];return _0x75257c;};'use strict';var _=require(_0x2b1c('0x0'));var util=require(_0x2b1c('0x1'));var logger=require('../../config/logger')(_0x2b1c('0x2'));var moment=require(_0x2b1c('0x3'));var BPromise=require(_0x2b1c('0x4'));var rp=require(_0x2b1c('0x5'));var fs=require('fs');var path=require(_0x2b1c('0x6'));var rimraf=require(_0x2b1c('0x7'));var config=require(_0x2b1c('0x8'));var attributes=require(_0x2b1c('0x9'));module[_0x2b1c('0xa')]=function(_0x3dd1e4,_0x5c7f87){return _0x3dd1e4['define'](_0x2b1c('0xb'),attributes,{'tableName':'int_sugarcrm_fields','paranoid':![],'indexes':[{'name':_0x2b1c('0xc'),'fields':[_0x2b1c('0xd'),_0x2b1c('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8927=['int_sugarcrm_fields','sugarcrm_unique_index','idField','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','SugarcrmField'];(function(_0x46d0c9,_0x526bfa){var _0x174506=function(_0x654bc6){while(--_0x654bc6){_0x46d0c9['push'](_0x46d0c9['shift']());}};_0x174506(++_0x526bfa);}(_0x8927,0x85));var _0x7892=function(_0x2fe91b,_0x233a48){_0x2fe91b=_0x2fe91b-0x0;var _0x5b422c=_0x8927[_0x2fe91b];return _0x5b422c;};'use strict';var _=require(_0x7892('0x0'));var util=require(_0x7892('0x1'));var logger=require(_0x7892('0x2'))('api');var moment=require(_0x7892('0x3'));var BPromise=require(_0x7892('0x4'));var rp=require(_0x7892('0x5'));var fs=require('fs');var path=require(_0x7892('0x6'));var rimraf=require(_0x7892('0x7'));var config=require(_0x7892('0x8'));var attributes=require('./intSugarcrmField.attributes');module['exports']=function(_0x3c3006,_0x5b9a96){return _0x3c3006['define'](_0x7892('0x9'),attributes,{'tableName':_0x7892('0xa'),'paranoid':![],'indexes':[{'name':_0x7892('0xb'),'fields':[_0x7892('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.rpc.js b/server/api/intSugarcrmField/intSugarcrmField.rpc.js index 3005bd4..47a063a 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 _0xe27f=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash'];(function(_0x1c2546,_0x2a23fe){var _0x90ab17=function(_0x172dbf){while(--_0x172dbf){_0x1c2546['push'](_0x1c2546['shift']());}};_0x90ab17(++_0x2a23fe);}(_0xe27f,0xe6));var _0xfe27=function(_0x2f20f0,_0x348fec){_0x2f20f0=_0x2f20f0-0x0;var _0x22c7cf=_0xe27f[_0x2f20f0];return _0x22c7cf;};'use strict';var _=require(_0xfe27('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xfe27('0x1'));var rs=require(_0xfe27('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfe27('0x3'))['db'];var utils=require(_0xfe27('0x4'));var logger=require(_0xfe27('0x5'))('rpc');var config=require(_0xfe27('0x6'));var jayson=require(_0xfe27('0x7'));var client=jayson[_0xfe27('0x8')][_0xfe27('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3788b1,_0x20a238,_0x56d2b4){return new BPromise(function(_0x1148d3,_0x5cb6cb){return client[_0xfe27('0xa')](_0x3788b1,_0x56d2b4)['then'](function(_0x4c6d43){logger[_0xfe27('0xb')](_0xfe27('0xc'),_0x20a238,_0xfe27('0xd'));logger[_0xfe27('0xe')](_0xfe27('0xf'),_0x20a238,'request\x20sent',JSON['stringify'](_0x4c6d43));if(_0x4c6d43[_0xfe27('0x10')]){if(_0x4c6d43[_0xfe27('0x10')][_0xfe27('0x11')]===0x1f4){logger[_0xfe27('0x10')]('SugarcrmField,\x20%s,\x20%s',_0x20a238,_0x4c6d43[_0xfe27('0x10')][_0xfe27('0x12')]);return _0x5cb6cb(_0x4c6d43[_0xfe27('0x10')][_0xfe27('0x12')]);}logger[_0xfe27('0x10')](_0xfe27('0xc'),_0x20a238,_0x4c6d43[_0xfe27('0x10')]['message']);return _0x1148d3(_0x4c6d43[_0xfe27('0x10')][_0xfe27('0x12')]);}else{logger[_0xfe27('0xb')](_0xfe27('0xc'),_0x20a238,_0xfe27('0xd'));_0x1148d3(_0x4c6d43[_0xfe27('0x13')][_0xfe27('0x12')]);}})[_0xfe27('0x14')](function(_0x37c754){logger[_0xfe27('0x10')]('SugarcrmField,\x20%s,\x20%s',_0x20a238,_0x37c754);_0x5cb6cb(_0x37c754);});});} \ No newline at end of file +var _0x195f=['../../config/environment','jayson/promise','client','request','then','info','SugarcrmField,\x20%s,\x20%s','debug','code','error','message','request\x20sent','lodash','util','moment','bluebird','ioredis','../../config/utils','rpc'];(function(_0x10cb38,_0x24d1d2){var _0x87de99=function(_0x2be34b){while(--_0x2be34b){_0x10cb38['push'](_0x10cb38['shift']());}};_0x87de99(++_0x24d1d2);}(_0x195f,0x116));var _0xf195=function(_0x1bfe2b,_0x34856e){_0x1bfe2b=_0x1bfe2b-0x0;var _0x1477d4=_0x195f[_0x1bfe2b];return _0x1477d4;};'use strict';var _=require(_0xf195('0x0'));var util=require(_0xf195('0x1'));var moment=require(_0xf195('0x2'));var BPromise=require(_0xf195('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf195('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xf195('0x5'));var logger=require('../../config/logger')(_0xf195('0x6'));var config=require(_0xf195('0x7'));var jayson=require(_0xf195('0x8'));var client=jayson[_0xf195('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5417ce,_0x40a911,_0x27f362){return new BPromise(function(_0x38ab27,_0x4cfd94){return client[_0xf195('0xa')](_0x5417ce,_0x27f362)[_0xf195('0xb')](function(_0x517c2f){logger[_0xf195('0xc')](_0xf195('0xd'),_0x40a911,'request\x20sent');logger[_0xf195('0xe')]('SugarcrmField,\x20%s,\x20%s,\x20%s',_0x40a911,'request\x20sent',JSON['stringify'](_0x517c2f));if(_0x517c2f['error']){if(_0x517c2f['error'][_0xf195('0xf')]===0x1f4){logger[_0xf195('0x10')](_0xf195('0xd'),_0x40a911,_0x517c2f[_0xf195('0x10')]['message']);return _0x4cfd94(_0x517c2f['error'][_0xf195('0x11')]);}logger[_0xf195('0x10')]('SugarcrmField,\x20%s,\x20%s',_0x40a911,_0x517c2f[_0xf195('0x10')][_0xf195('0x11')]);return _0x38ab27(_0x517c2f[_0xf195('0x10')][_0xf195('0x11')]);}else{logger[_0xf195('0xc')](_0xf195('0xd'),_0x40a911,_0xf195('0x12'));_0x38ab27(_0x517c2f['result']['message']);}})['catch'](function(_0x14a2a2){logger['error'](_0xf195('0xd'),_0x40a911,_0x14a2a2);_0x4cfd94(_0x14a2a2);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 7696587..69e964b 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 _0xe739=['/:id','show','/:id/configurations','isAuthenticated','getConfigurations','post','put','update','destroy','multer','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','get','index'];(function(_0x3b6fa9,_0x91a3b1){var _0x26621c=function(_0x4e19c7){while(--_0x4e19c7){_0x3b6fa9['push'](_0x3b6fa9['shift']());}};_0x26621c(++_0x91a3b1);}(_0xe739,0x105));var _0x9e73=function(_0x536cb8,_0x27997f){_0x536cb8=_0x536cb8-0x0;var _0x733a0d=_0xe739[_0x536cb8];return _0x733a0d;};'use strict';var multer=require(_0x9e73('0x0'));var util=require('util');var path=require(_0x9e73('0x1'));var timeout=require(_0x9e73('0x2'));var express=require(_0x9e73('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x9e73('0x4'));var config=require(_0x9e73('0x5'));var controller=require(_0x9e73('0x6'));router[_0x9e73('0x7')]('/',auth['isAuthenticated'](),controller[_0x9e73('0x8')]);router[_0x9e73('0x7')](_0x9e73('0x9'),auth['isAuthenticated'](),controller[_0x9e73('0xa')]);router[_0x9e73('0x7')](_0x9e73('0xb'),auth[_0x9e73('0xc')](),controller[_0x9e73('0xd')]);router[_0x9e73('0x7')]('/:id/fields',auth[_0x9e73('0xc')](),controller['getFields']);router['post']('/',auth[_0x9e73('0xc')](),controller['create']);router[_0x9e73('0xe')](_0x9e73('0xb'),auth[_0x9e73('0xc')](),controller['addConfiguration']);router[_0x9e73('0xf')](_0x9e73('0x9'),auth[_0x9e73('0xc')](),controller[_0x9e73('0x10')]);router['delete'](_0x9e73('0x9'),auth[_0x9e73('0xc')](),controller[_0x9e73('0x11')]);module['exports']=router; \ No newline at end of file +var _0x7793=['addConfiguration','update','delete','util','path','express','../../components/auth/service','../../components/interaction/service','./intVtigerAccount.controller','get','index','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields','create','post'];(function(_0x9b2b13,_0x2e82a1){var _0x1d5335=function(_0x51f27d){while(--_0x51f27d){_0x9b2b13['push'](_0x9b2b13['shift']());}};_0x1d5335(++_0x2e82a1);}(_0x7793,0x120));var _0x3779=function(_0x5924b3,_0x378237){_0x5924b3=_0x5924b3-0x0;var _0x10e67=_0x7793[_0x5924b3];return _0x10e67;};'use strict';var multer=require('multer');var util=require(_0x3779('0x0'));var path=require(_0x3779('0x1'));var timeout=require('connect-timeout');var express=require(_0x3779('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x3779('0x3'));var interaction=require(_0x3779('0x4'));var config=require('../../config/environment');var controller=require(_0x3779('0x5'));router[_0x3779('0x6')]('/',auth['isAuthenticated'](),controller[_0x3779('0x7')]);router[_0x3779('0x6')]('/:id',auth[_0x3779('0x8')](),controller[_0x3779('0x9')]);router['get'](_0x3779('0xa'),auth[_0x3779('0x8')](),controller[_0x3779('0xb')]);router[_0x3779('0x6')](_0x3779('0xc'),auth[_0x3779('0x8')](),controller[_0x3779('0xd')]);router['post']('/',auth[_0x3779('0x8')](),controller[_0x3779('0xe')]);router[_0x3779('0xf')](_0x3779('0xa'),auth['isAuthenticated'](),controller[_0x3779('0x10')]);router['put']('/:id',auth[_0x3779('0x8')](),controller[_0x3779('0x11')]);router[_0x3779('0x12')]('/:id',auth[_0x3779('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index 104b5ca..93843df 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 _0xd9e9=['HelpDesk','sequelize','exports','STRING'];(function(_0x8999f1,_0x2bef0a){var _0x574ced=function(_0x52d3b7){while(--_0x52d3b7){_0x8999f1['push'](_0x8999f1['shift']());}};_0x574ced(++_0x2bef0a);}(_0xd9e9,0x131));var _0x9d9e=function(_0x578056,_0x171bc3){_0x578056=_0x578056-0x0;var _0x5ae470=_0xd9e9[_0x578056];return _0x5ae470;};'use strict';var Sequelize=require(_0x9d9e('0x0'));module[_0x9d9e('0x1')]={'name':{'type':Sequelize[_0x9d9e('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x9d9e('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x9d9e('0x2')],'allowNull':![],'defaultValue':_0x9d9e('0x3')},'remoteUri':{'type':Sequelize[_0x9d9e('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x9d9e('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x9d9e('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x460d=['STRING','sequelize','exports'];(function(_0x531d15,_0x599af5){var _0x271a18=function(_0x31284d){while(--_0x31284d){_0x531d15['push'](_0x531d15['shift']());}};_0x271a18(++_0x599af5);}(_0x460d,0x1db));var _0xd460=function(_0x4bc65f,_0x39ec43){_0x4bc65f=_0x4bc65f-0x0;var _0x44f85f=_0x460d[_0x4bc65f];return _0x44f85f;};'use strict';var Sequelize=require(_0xd460('0x0'));module[_0xd460('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xd460('0x2')]},'username':{'type':Sequelize[_0xd460('0x2')],'allowNull':![]},'moduleName':{'type':Sequelize[_0xd460('0x2')],'allowNull':![],'defaultValue':'HelpDesk'},'remoteUri':{'type':Sequelize[_0xd460('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0xd460('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize[_0xd460('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 e44f069..13461d2 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 _0x6c83=['undefined','count','limit','set','Content-Range','apply','reject','save','then','destroy','stack','name','send','index','map','VtigerAccount','fieldName','type','key','model','keys','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','pick','merge','where','VIRTUAL','filter','include','findAll','rows','catch','show','params','rawAttributes','fields','includeAll','create','body','update','find','VtigerConfiguration','getConfigurations','addConfiguration','findOne','channel','Descriptions','getDescriptions','VtigerField','md5','getFields','username','description','remoteUri','serverUrl','accessKey','moduleName','substring','%s/webservice.php','GET','getchallenge','login','result','sessionName','success','autogenerated','reference','owner','remove','includes','editable','false','label','cf_','picklistValues','value','log','vTiger\x20error:\x20','test','statusCode','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset'];(function(_0x4ccde3,_0x38ca57){var _0x3348ac=function(_0x5433f0){while(--_0x5433f0){_0x4ccde3['push'](_0x4ccde3['shift']());}};_0x3348ac(++_0x38ca57);}(_0x6c83,0x13f));var _0x36c8=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6c83[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0x36c8('0x0'));var rimraf=require(_0x36c8('0x1'));var zipdir=require(_0x36c8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x36c8('0x3'));var moment=require(_0x36c8('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x36c8('0x5'));var util=require(_0x36c8('0x6'));var path=require(_0x36c8('0x7'));var sox=require(_0x36c8('0x8'));var csv=require(_0x36c8('0x9'));var ejs=require(_0x36c8('0xa'));var fs=require('fs');var fs_extra=require(_0x36c8('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x36c8('0xc'));var deskjs=require(_0x36c8('0xd'));var toCsv=require(_0x36c8('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x36c8('0xe'));var qs=require(_0x36c8('0xf'));var as=require(_0x36c8('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x36c8('0x11'))(_0x36c8('0x12'));var utils=require(_0x36c8('0x13'));var config=require(_0x36c8('0x14'));var licenseUtil=require(_0x36c8('0x15'));var db=require(_0x36c8('0x16'))['db'];var integrations=require(_0x36c8('0x17'));function respondWithStatusCode(_0x51b0d6,_0xa3f25b){_0xa3f25b=_0xa3f25b||0xcc;return function(_0x5529c3){if(_0x5529c3){return _0x51b0d6[_0x36c8('0x18')](_0xa3f25b);}return _0x51b0d6[_0x36c8('0x19')](_0xa3f25b)[_0x36c8('0x1a')]();};}function respondWithResult(_0x1491fe,_0x274c0c){_0x274c0c=_0x274c0c||0xc8;return function(_0x3b158b){if(_0x3b158b){return _0x1491fe['status'](_0x274c0c)[_0x36c8('0x1b')](_0x3b158b);}};}function respondWithFilteredResult(_0x3ac85e,_0x33c7bb){return function(_0xb37d88){if(_0xb37d88){var _0x1377f9=typeof _0x33c7bb[_0x36c8('0x1c')]===_0x36c8('0x1d')&&typeof _0x33c7bb['limit']===_0x36c8('0x1d');var _0x5bc988=_0xb37d88[_0x36c8('0x1e')];var _0x1f2197=_0x1377f9?0x0:_0x33c7bb['offset'];var _0x4af6ee=_0x1377f9?_0xb37d88[_0x36c8('0x1e')]:_0x33c7bb[_0x36c8('0x1c')]+_0x33c7bb[_0x36c8('0x1f')];var _0x5b5c4e;if(_0x4af6ee>=_0x5bc988){_0x4af6ee=_0x5bc988;_0x5b5c4e=0xc8;}else{_0x5b5c4e=0xce;}_0x3ac85e[_0x36c8('0x19')](_0x5b5c4e);return _0x3ac85e[_0x36c8('0x20')](_0x36c8('0x21'),_0x1f2197+'-'+_0x4af6ee+'/'+_0x5bc988)[_0x36c8('0x1b')](_0xb37d88);}return null;};}function patchUpdates(_0x5c3828){return function(_0x41059e){try{jsonpatch[_0x36c8('0x22')](_0x41059e,_0x5c3828,!![]);}catch(_0x4abb4a){return BPromise[_0x36c8('0x23')](_0x4abb4a);}return _0x41059e[_0x36c8('0x24')]();};}function saveUpdates(_0x35476d,_0x3e9c7f){return function(_0x3d3e39){if(_0x3d3e39){return _0x3d3e39['update'](_0x35476d)[_0x36c8('0x25')](function(_0x1744b9){return _0x1744b9;});}return null;};}function removeEntity(_0x4f7cf8,_0xbd79d3){return function(_0x3b3929){if(_0x3b3929){return _0x3b3929[_0x36c8('0x26')]()[_0x36c8('0x25')](function(){_0x4f7cf8[_0x36c8('0x19')](0xcc)[_0x36c8('0x1a')]();});}};}function handleEntityNotFound(_0x2497df,_0x36f7c1){return function(_0x3768b3){if(!_0x3768b3){_0x2497df[_0x36c8('0x18')](0x194);}return _0x3768b3;};}function handleError(_0x2670db,_0x331c4e){_0x331c4e=_0x331c4e||0x1f4;return function(_0x35520e){logger['error'](_0x35520e[_0x36c8('0x27')]);if(_0x35520e[_0x36c8('0x28')]){delete _0x35520e['name'];}_0x2670db['status'](_0x331c4e)[_0x36c8('0x29')](_0x35520e);};}exports[_0x36c8('0x2a')]=function(_0xa82363,_0x34e944){var _0x2b7368={},_0x158b13={},_0x57a156={'count':0x0,'rows':[]};var _0x4e21b3=_[_0x36c8('0x2b')](db[_0x36c8('0x2c')]['rawAttributes'],function(_0x143b40){return{'name':_0x143b40[_0x36c8('0x2d')],'type':_0x143b40[_0x36c8('0x2e')][_0x36c8('0x2f')]};});_0x158b13[_0x36c8('0x30')]=_[_0x36c8('0x2b')](_0x4e21b3,_0x36c8('0x28'));_0x158b13['query']=_[_0x36c8('0x31')](_0xa82363[_0x36c8('0x32')]);_0x158b13[_0x36c8('0x33')]=_[_0x36c8('0x34')](_0x158b13[_0x36c8('0x30')],_0x158b13[_0x36c8('0x32')]);_0x2b7368['attributes']=_['intersection'](_0x158b13[_0x36c8('0x30')],qs['fields'](_0xa82363[_0x36c8('0x32')]['fields']));_0x2b7368['attributes']=_0x2b7368[_0x36c8('0x35')][_0x36c8('0x36')]?_0x2b7368[_0x36c8('0x35')]:_0x158b13[_0x36c8('0x30')];if(!_0xa82363[_0x36c8('0x32')][_0x36c8('0x37')](_0x36c8('0x38'))){_0x2b7368['limit']=qs['limit'](_0xa82363[_0x36c8('0x32')][_0x36c8('0x1f')]);_0x2b7368[_0x36c8('0x1c')]=qs[_0x36c8('0x1c')](_0xa82363[_0x36c8('0x32')]['offset']);}_0x2b7368[_0x36c8('0x39')]=qs[_0x36c8('0x3a')](_0xa82363[_0x36c8('0x32')][_0x36c8('0x3a')]);_0x2b7368['where']=qs[_0x36c8('0x33')](_[_0x36c8('0x3b')](_0xa82363['query'],_0x158b13[_0x36c8('0x33')]),_0x4e21b3);if(_0xa82363['query']['filter']){_0x2b7368['where']=_[_0x36c8('0x3c')](_0x2b7368[_0x36c8('0x3d')],{'$or':_[_0x36c8('0x2b')](_0x4e21b3,function(_0x1ef01a){if(_0x1ef01a['type']!==_0x36c8('0x3e')){var _0x3b7525={};_0x3b7525[_0x1ef01a['name']]={'$like':'%'+_0xa82363[_0x36c8('0x32')][_0x36c8('0x3f')]+'%'};return _0x3b7525;}})});}_0x2b7368=_['merge']({},_0x2b7368,_0xa82363['options']);var _0x120a2f={'where':_0x2b7368[_0x36c8('0x3d')]};return db[_0x36c8('0x2c')][_0x36c8('0x1e')](_0x120a2f)[_0x36c8('0x25')](function(_0x429d0f){_0x57a156[_0x36c8('0x1e')]=_0x429d0f;if(_0xa82363[_0x36c8('0x32')]['includeAll']){_0x2b7368[_0x36c8('0x40')]=[{'all':!![]}];}return db[_0x36c8('0x2c')][_0x36c8('0x41')](_0x2b7368);})[_0x36c8('0x25')](function(_0x49eb74){_0x57a156[_0x36c8('0x42')]=_0x49eb74;return _0x57a156;})[_0x36c8('0x25')](respondWithFilteredResult(_0x34e944,_0x2b7368))[_0x36c8('0x43')](handleError(_0x34e944,null));};exports[_0x36c8('0x44')]=function(_0x20ab3a,_0x196fc5){var _0x3f24a0={'raw':![],'where':{'id':_0x20ab3a[_0x36c8('0x45')]['id']}},_0x1e2447={};_0x1e2447[_0x36c8('0x30')]=_['keys'](db[_0x36c8('0x2c')][_0x36c8('0x46')]);_0x1e2447[_0x36c8('0x32')]=_[_0x36c8('0x31')](_0x20ab3a['query']);_0x1e2447[_0x36c8('0x33')]=_[_0x36c8('0x34')](_0x1e2447[_0x36c8('0x30')],_0x1e2447[_0x36c8('0x32')]);_0x3f24a0[_0x36c8('0x35')]=_['intersection'](_0x1e2447[_0x36c8('0x30')],qs[_0x36c8('0x47')](_0x20ab3a[_0x36c8('0x32')][_0x36c8('0x47')]));_0x3f24a0[_0x36c8('0x35')]=_0x3f24a0[_0x36c8('0x35')][_0x36c8('0x36')]?_0x3f24a0['attributes']:_0x1e2447[_0x36c8('0x30')];if(_0x20ab3a[_0x36c8('0x32')][_0x36c8('0x48')]){_0x3f24a0[_0x36c8('0x40')]=[{'all':!![]}];}_0x3f24a0=_[_0x36c8('0x3c')]({},_0x3f24a0,_0x20ab3a['options']);return db[_0x36c8('0x2c')]['find'](_0x3f24a0)[_0x36c8('0x25')](handleEntityNotFound(_0x196fc5,null))[_0x36c8('0x25')](respondWithResult(_0x196fc5,null))[_0x36c8('0x43')](handleError(_0x196fc5,null));};exports[_0x36c8('0x49')]=function(_0xae5838,_0x1931fd){return db[_0x36c8('0x2c')][_0x36c8('0x49')](_0xae5838[_0x36c8('0x4a')],{})[_0x36c8('0x25')](respondWithResult(_0x1931fd,0xc9))[_0x36c8('0x43')](handleError(_0x1931fd,null));};exports[_0x36c8('0x4b')]=function(_0x570190,_0x555181){if(_0x570190[_0x36c8('0x4a')]['id']){delete _0x570190[_0x36c8('0x4a')]['id'];}return db[_0x36c8('0x2c')]['find']({'where':{'id':_0x570190[_0x36c8('0x45')]['id']}})[_0x36c8('0x25')](handleEntityNotFound(_0x555181,null))[_0x36c8('0x25')](saveUpdates(_0x570190['body'],null))[_0x36c8('0x25')](respondWithResult(_0x555181,null))['catch'](handleError(_0x555181,null));};exports[_0x36c8('0x26')]=function(_0x3ff298,_0x523cd4){return db['VtigerAccount'][_0x36c8('0x4c')]({'where':{'id':_0x3ff298[_0x36c8('0x45')]['id']}})[_0x36c8('0x25')](handleEntityNotFound(_0x523cd4,null))[_0x36c8('0x25')](removeEntity(_0x523cd4,null))[_0x36c8('0x43')](handleError(_0x523cd4,null));};exports['getConfigurations']=function(_0x772fa7,_0x5c04da,_0x78a286){var _0x1d578f={};var _0xe28265={};var _0x5765a8;var _0x1aae8f;return db['VtigerAccount']['findOne']({'where':{'id':_0x772fa7[_0x36c8('0x45')]['id']}})[_0x36c8('0x25')](handleEntityNotFound(_0x5c04da,null))[_0x36c8('0x25')](function(_0x5a2f9f){if(_0x5a2f9f){_0x5765a8=_0x5a2f9f;_0xe28265['model']=_[_0x36c8('0x31')](db[_0x36c8('0x4d')][_0x36c8('0x46')]);_0xe28265['query']=_['keys'](_0x772fa7[_0x36c8('0x32')]);_0xe28265[_0x36c8('0x33')]=_['intersection'](_0xe28265['model'],_0xe28265[_0x36c8('0x32')]);_0x1d578f['attributes']=_[_0x36c8('0x34')](_0xe28265[_0x36c8('0x30')],qs[_0x36c8('0x47')](_0x772fa7[_0x36c8('0x32')][_0x36c8('0x47')]));_0x1d578f['attributes']=_0x1d578f[_0x36c8('0x35')][_0x36c8('0x36')]?_0x1d578f['attributes']:_0xe28265[_0x36c8('0x30')];_0x1d578f['order']=qs[_0x36c8('0x3a')](_0x772fa7['query']['sort']);_0x1d578f['where']=qs[_0x36c8('0x33')](_[_0x36c8('0x3b')](_0x772fa7[_0x36c8('0x32')],_0xe28265[_0x36c8('0x33')]));if(_0x772fa7[_0x36c8('0x32')][_0x36c8('0x3f')]){_0x1d578f[_0x36c8('0x3d')]=_['merge'](_0x1d578f['where'],{'$or':_[_0x36c8('0x2b')](_0x1d578f['attributes'],function(_0x364b59){var _0x3bf7fa={};_0x3bf7fa[_0x364b59]={'$like':'%'+_0x772fa7[_0x36c8('0x32')][_0x36c8('0x3f')]+'%'};return _0x3bf7fa;})});}_0x1d578f=_[_0x36c8('0x3c')]({},_0x1d578f,_0x772fa7['options']);return _0x5765a8[_0x36c8('0x4e')](_0x1d578f);}})[_0x36c8('0x25')](function(_0x59a8de){if(_0x59a8de){_0x1aae8f=_0x59a8de['length'];if(!_0x772fa7[_0x36c8('0x32')][_0x36c8('0x37')]('nolimit')){_0x1d578f[_0x36c8('0x1f')]=qs[_0x36c8('0x1f')](_0x772fa7[_0x36c8('0x32')][_0x36c8('0x1f')]);_0x1d578f[_0x36c8('0x1c')]=qs[_0x36c8('0x1c')](_0x772fa7[_0x36c8('0x32')][_0x36c8('0x1c')]);}return _0x5765a8[_0x36c8('0x4e')](_0x1d578f);}})[_0x36c8('0x25')](function(_0x24a934){if(_0x24a934){return _0x24a934?{'count':_0x1aae8f,'rows':_0x24a934}:null;}})[_0x36c8('0x25')](respondWithResult(_0x5c04da,null))[_0x36c8('0x43')](handleError(_0x5c04da,null));};exports[_0x36c8('0x4f')]=function(_0x5c5bab,_0x4767b6,_0x274e84){if(_0x5c5bab['body']['id']){delete _0x5c5bab[_0x36c8('0x4a')]['id'];}return db[_0x36c8('0x2c')][_0x36c8('0x50')]({'where':{'id':_0x5c5bab[_0x36c8('0x45')]['id']}})[_0x36c8('0x25')](handleEntityNotFound(_0x4767b6,null))[_0x36c8('0x25')](function(_0x1ddb37){if(_0x1ddb37){_0x5c5bab['body']['AccountId']=_0x1ddb37['id'];_0x5c5bab[_0x36c8('0x4a')]['Subjects']=integrations['getSubjects'](_0x5c5bab['body'][_0x36c8('0x51')],_0x5c5bab[_0x36c8('0x4a')][_0x36c8('0x2e')]);_0x5c5bab[_0x36c8('0x4a')][_0x36c8('0x52')]=integrations[_0x36c8('0x53')](_0x5c5bab['body'][_0x36c8('0x51')],_0x5c5bab[_0x36c8('0x4a')][_0x36c8('0x2e')]);return db['VtigerConfiguration'][_0x36c8('0x49')](_0x5c5bab['body'],{'include':[{'model':db[_0x36c8('0x54')],'as':'Subjects'},{'model':db['VtigerField'],'as':_0x36c8('0x52')}]});}return null;})[_0x36c8('0x25')](respondWithResult(_0x4767b6,null))['catch'](handleError(_0x4767b6,null));};var md5=require(_0x36c8('0x55'));exports[_0x36c8('0x56')]=function(_0xa40c06,_0x4495e7,_0x172b0e){var _0x2dd090=null;var _0x3ff7f9=null;var _0x23fdd2=null;var _0xdc061f=null;var _0x582b97='';return db['VtigerAccount'][_0x36c8('0x50')]({'where':{'id':_0xa40c06['params']['id']},'attributes':['id',_0x36c8('0x28'),_0x36c8('0x57'),_0x36c8('0x58'),'moduleName',_0x36c8('0x59'),_0x36c8('0x5a'),_0x36c8('0x5b')]})['then'](handleEntityNotFound(_0x4495e7,null))[_0x36c8('0x25')](function(_0x3a041e){if(_0x3a041e){_0x2dd090=_0x3a041e[_0x36c8('0x57')];_0x3ff7f9=_0x3a041e[_0x36c8('0x5b')];_0x23fdd2=_0x3a041e[_0x36c8('0x5c')];_0x582b97=_0x3a041e[_0x36c8('0x59')];var _0x56a18e=_0x582b97['slice'](-0x1);if(_0x56a18e==='/'){_0x582b97=_0x582b97[_0x36c8('0x5d')](0x0,_0x582b97['lastIndexOf'](_0x56a18e));}_0xdc061f=util['format'](_0x36c8('0x5e'),_0x582b97);var _0x259950={'method':_0x36c8('0x5f'),'uri':_0xdc061f,'qs':{'operation':_0x36c8('0x60'),'username':_0x3a041e[_0x36c8('0x57')]},'json':!![]};return rp(_0x259950);}})['then'](function(_0x1be25f){if(_0x1be25f['success']){var _0x3ef63c={'method':'POST','uri':_0xdc061f,'form':{'operation':_0x36c8('0x61'),'username':_0x2dd090,'accessKey':md5(_0x1be25f[_0x36c8('0x62')]['token']+_0x3ff7f9)},'json':!![]};return rp(_0x3ef63c);}})[_0x36c8('0x25')](function(_0x248887){if(_0x248887['success']){var _0x384cb7={'method':_0x36c8('0x5f'),'uri':_0xdc061f,'qs':{'operation':'describe','username':_0x2dd090,'sessionName':_0x248887[_0x36c8('0x62')][_0x36c8('0x63')],'elementType':_0x23fdd2},'json':!![]};return rp(_0x384cb7);}})['then'](function(_0xfb2972){if(_0xfb2972[_0x36c8('0x64')]){var _0x44dc02=[_0x36c8('0x65'),_0x36c8('0x66'),_0x36c8('0x67')];_[_0x36c8('0x68')](_0xfb2972[_0x36c8('0x62')]['fields'],function(_0x1814cf){return _0x44dc02[_0x36c8('0x69')](_0x1814cf[_0x36c8('0x2e')][_0x36c8('0x28')]);});_[_0x36c8('0x68')](_0xfb2972[_0x36c8('0x62')][_0x36c8('0x47')],function(_0x1926b9){return _0x1926b9[_0x36c8('0x6a')]===_0x36c8('0x6b');});return{'count':_0xfb2972[_0x36c8('0x62')]['fields']['length'],'rows':_[_0x36c8('0x2b')](_0xfb2972['result'][_0x36c8('0x47')],function(_0x4dfc83){return{'id':_0x4dfc83[_0x36c8('0x28')],'name':_0x4dfc83[_0x36c8('0x6c')],'custom':_['startsWith'](_0x4dfc83[_0x36c8('0x28')],_0x36c8('0x6d'))?!![]:![],'options':_0x4dfc83[_0x36c8('0x2e')][_0x36c8('0x28')]==='picklist'&&_0x4dfc83[_0x36c8('0x2e')][_0x36c8('0x6e')]['length']>0x0?_[_0x36c8('0x2b')](_0x4dfc83[_0x36c8('0x2e')][_0x36c8('0x6e')],function(_0x1fe898){return{'name':_0x1fe898['label'],'value':_0x1fe898[_0x36c8('0x6f')]};}):[]};})};}})['then'](respondWithResult(_0x4495e7,null))['catch'](function(_0x177055){console[_0x36c8('0x70')](_0x36c8('0x71')+_0x177055);var _0x46e4a2=_0xa40c06[_0x36c8('0x32')][_0x36c8('0x72')]?0x1f4:_0x177055['statusCode']||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x46e4a2,JSON['stringify'](_0x177055));delete _0x177055['name'];if(_0x46e4a2===0x191){_0x46e4a2=0x190;}_0x4495e7[_0x36c8('0x19')](_0x46e4a2)[_0x36c8('0x29')](_0xa40c06[_0x36c8('0x32')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x177055[_0x36c8('0x73')]}:_0x177055);});}; \ No newline at end of file +var _0xb75c=['sox','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','sendStatus','offset','undefined','count','limit','set','Content-Range','json','save','then','destroy','status','end','error','stack','name','send','index','map','VtigerAccount','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','options','includeAll','include','findAll','catch','find','create','body','params','getConfigurations','findOne','VtigerConfiguration','rawAttributes','pick','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','VtigerField','md5','getFields','description','moduleName','remoteUri','username','accessKey','slice','substring','format','GET','getchallenge','success','POST','login','token','describe','result','autogenerated','reference','owner','remove','editable','label','startsWith','picklist','picklistValues','log','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','zip-dir','request-promise','moment','bluebird','mustache','path'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xb75c,0x6a));var _0xcb75=function(_0x254f6c,_0x88adfb){_0x254f6c=_0x254f6c-0x0;var _0xffcf88=_0xb75c[_0x254f6c];return _0xffcf88;};'use strict';var emlformat=require(_0xcb75('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xcb75('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xcb75('0x2'));var moment=require(_0xcb75('0x3'));var BPromise=require(_0xcb75('0x4'));var Mustache=require(_0xcb75('0x5'));var util=require('util');var path=require(_0xcb75('0x6'));var sox=require(_0xcb75('0x7'));var csv=require(_0xcb75('0x8'));var ejs=require(_0xcb75('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcb75('0xa'));var squel=require(_0xcb75('0xb'));var crypto=require('crypto');var jsforce=require(_0xcb75('0xc'));var deskjs=require(_0xcb75('0xd'));var toCsv=require(_0xcb75('0x8'));var querystring=require('querystring');var Papa=require(_0xcb75('0xe'));var Redis=require(_0xcb75('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xcb75('0x10'));var hardwareService=require(_0xcb75('0x11'));var logger=require('../../config/logger')(_0xcb75('0x12'));var utils=require(_0xcb75('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xcb75('0x14'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x425324,_0x22dedd){_0x22dedd=_0x22dedd||0xcc;return function(_0x5a2249){if(_0x5a2249){return _0x425324[_0xcb75('0x15')](_0x22dedd);}return _0x425324['status'](_0x22dedd)['end']();};}function respondWithResult(_0x38999e,_0x583ae5){_0x583ae5=_0x583ae5||0xc8;return function(_0x5c4f84){if(_0x5c4f84){return _0x38999e['status'](_0x583ae5)['json'](_0x5c4f84);}};}function respondWithFilteredResult(_0x58125e,_0x34bb9e){return function(_0x2ee223){if(_0x2ee223){var _0x3ea4c5=typeof _0x34bb9e[_0xcb75('0x16')]===_0xcb75('0x17')&&typeof _0x34bb9e['limit']==='undefined';var _0xe6caa7=_0x2ee223[_0xcb75('0x18')];var _0xb50f9d=_0x3ea4c5?0x0:_0x34bb9e['offset'];var _0x16119a=_0x3ea4c5?_0x2ee223['count']:_0x34bb9e[_0xcb75('0x16')]+_0x34bb9e[_0xcb75('0x19')];var _0x4950da;if(_0x16119a>=_0xe6caa7){_0x16119a=_0xe6caa7;_0x4950da=0xc8;}else{_0x4950da=0xce;}_0x58125e['status'](_0x4950da);return _0x58125e[_0xcb75('0x1a')](_0xcb75('0x1b'),_0xb50f9d+'-'+_0x16119a+'/'+_0xe6caa7)[_0xcb75('0x1c')](_0x2ee223);}return null;};}function patchUpdates(_0x26858c){return function(_0x373764){try{jsonpatch['apply'](_0x373764,_0x26858c,!![]);}catch(_0x31d25a){return BPromise['reject'](_0x31d25a);}return _0x373764[_0xcb75('0x1d')]();};}function saveUpdates(_0xd7a92a,_0x4feea1){return function(_0x4ef4c1){if(_0x4ef4c1){return _0x4ef4c1['update'](_0xd7a92a)[_0xcb75('0x1e')](function(_0x5db49e){return _0x5db49e;});}return null;};}function removeEntity(_0x588f38,_0xa0506f){return function(_0x308f8f){if(_0x308f8f){return _0x308f8f[_0xcb75('0x1f')]()[_0xcb75('0x1e')](function(){_0x588f38[_0xcb75('0x20')](0xcc)[_0xcb75('0x21')]();});}};}function handleEntityNotFound(_0x4bca61,_0x5367dc){return function(_0x3f4c6a){if(!_0x3f4c6a){_0x4bca61[_0xcb75('0x15')](0x194);}return _0x3f4c6a;};}function handleError(_0x51b815,_0x4c4944){_0x4c4944=_0x4c4944||0x1f4;return function(_0x1e6aea){logger[_0xcb75('0x22')](_0x1e6aea[_0xcb75('0x23')]);if(_0x1e6aea[_0xcb75('0x24')]){delete _0x1e6aea[_0xcb75('0x24')];}_0x51b815['status'](_0x4c4944)[_0xcb75('0x25')](_0x1e6aea);};}exports[_0xcb75('0x26')]=function(_0x1e751f,_0x5c6ba5){var _0x16a94d={},_0x217b68={},_0x22d6ac={'count':0x0,'rows':[]};var _0x271163=_[_0xcb75('0x27')](db[_0xcb75('0x28')]['rawAttributes'],function(_0x4208c7){return{'name':_0x4208c7[_0xcb75('0x29')],'type':_0x4208c7[_0xcb75('0x2a')][_0xcb75('0x2b')]};});_0x217b68[_0xcb75('0x2c')]=_[_0xcb75('0x27')](_0x271163,_0xcb75('0x24'));_0x217b68[_0xcb75('0x2d')]=_[_0xcb75('0x2e')](_0x1e751f[_0xcb75('0x2d')]);_0x217b68[_0xcb75('0x2f')]=_[_0xcb75('0x30')](_0x217b68[_0xcb75('0x2c')],_0x217b68['query']);_0x16a94d[_0xcb75('0x31')]=_[_0xcb75('0x30')](_0x217b68[_0xcb75('0x2c')],qs[_0xcb75('0x32')](_0x1e751f[_0xcb75('0x2d')][_0xcb75('0x32')]));_0x16a94d['attributes']=_0x16a94d[_0xcb75('0x31')][_0xcb75('0x33')]?_0x16a94d[_0xcb75('0x31')]:_0x217b68[_0xcb75('0x2c')];if(!_0x1e751f['query'][_0xcb75('0x34')](_0xcb75('0x35'))){_0x16a94d[_0xcb75('0x19')]=qs['limit'](_0x1e751f[_0xcb75('0x2d')][_0xcb75('0x19')]);_0x16a94d[_0xcb75('0x16')]=qs[_0xcb75('0x16')](_0x1e751f[_0xcb75('0x2d')]['offset']);}_0x16a94d[_0xcb75('0x36')]=qs[_0xcb75('0x37')](_0x1e751f[_0xcb75('0x2d')][_0xcb75('0x37')]);_0x16a94d['where']=qs[_0xcb75('0x2f')](_['pick'](_0x1e751f[_0xcb75('0x2d')],_0x217b68[_0xcb75('0x2f')]),_0x271163);if(_0x1e751f[_0xcb75('0x2d')][_0xcb75('0x38')]){_0x16a94d[_0xcb75('0x39')]=_[_0xcb75('0x3a')](_0x16a94d[_0xcb75('0x39')],{'$or':_[_0xcb75('0x27')](_0x271163,function(_0x42d8ae){if(_0x42d8ae[_0xcb75('0x2a')]!=='VIRTUAL'){var _0x29743e={};_0x29743e[_0x42d8ae[_0xcb75('0x24')]]={'$like':'%'+_0x1e751f[_0xcb75('0x2d')]['filter']+'%'};return _0x29743e;}})});}_0x16a94d=_[_0xcb75('0x3a')]({},_0x16a94d,_0x1e751f[_0xcb75('0x3b')]);var _0x490cf6={'where':_0x16a94d[_0xcb75('0x39')]};return db[_0xcb75('0x28')]['count'](_0x490cf6)['then'](function(_0x18c452){_0x22d6ac[_0xcb75('0x18')]=_0x18c452;if(_0x1e751f[_0xcb75('0x2d')][_0xcb75('0x3c')]){_0x16a94d[_0xcb75('0x3d')]=[{'all':!![]}];}return db['VtigerAccount'][_0xcb75('0x3e')](_0x16a94d);})[_0xcb75('0x1e')](function(_0x1704ea){_0x22d6ac['rows']=_0x1704ea;return _0x22d6ac;})[_0xcb75('0x1e')](respondWithFilteredResult(_0x5c6ba5,_0x16a94d))[_0xcb75('0x3f')](handleError(_0x5c6ba5,null));};exports['show']=function(_0x2b6e1b,_0x47ef31){var _0x305d9a={'raw':![],'where':{'id':_0x2b6e1b['params']['id']}},_0xdfe1a5={};_0xdfe1a5['model']=_['keys'](db['VtigerAccount']['rawAttributes']);_0xdfe1a5[_0xcb75('0x2d')]=_[_0xcb75('0x2e')](_0x2b6e1b['query']);_0xdfe1a5[_0xcb75('0x2f')]=_[_0xcb75('0x30')](_0xdfe1a5['model'],_0xdfe1a5[_0xcb75('0x2d')]);_0x305d9a[_0xcb75('0x31')]=_['intersection'](_0xdfe1a5[_0xcb75('0x2c')],qs[_0xcb75('0x32')](_0x2b6e1b[_0xcb75('0x2d')][_0xcb75('0x32')]));_0x305d9a[_0xcb75('0x31')]=_0x305d9a[_0xcb75('0x31')][_0xcb75('0x33')]?_0x305d9a['attributes']:_0xdfe1a5['model'];if(_0x2b6e1b[_0xcb75('0x2d')]['includeAll']){_0x305d9a[_0xcb75('0x3d')]=[{'all':!![]}];}_0x305d9a=_[_0xcb75('0x3a')]({},_0x305d9a,_0x2b6e1b[_0xcb75('0x3b')]);return db[_0xcb75('0x28')][_0xcb75('0x40')](_0x305d9a)[_0xcb75('0x1e')](handleEntityNotFound(_0x47ef31,null))[_0xcb75('0x1e')](respondWithResult(_0x47ef31,null))[_0xcb75('0x3f')](handleError(_0x47ef31,null));};exports[_0xcb75('0x41')]=function(_0x3d8949,_0x9a67a7){return db[_0xcb75('0x28')]['create'](_0x3d8949['body'],{})[_0xcb75('0x1e')](respondWithResult(_0x9a67a7,0xc9))[_0xcb75('0x3f')](handleError(_0x9a67a7,null));};exports['update']=function(_0x35a8fc,_0x2d491a){if(_0x35a8fc[_0xcb75('0x42')]['id']){delete _0x35a8fc[_0xcb75('0x42')]['id'];}return db[_0xcb75('0x28')][_0xcb75('0x40')]({'where':{'id':_0x35a8fc[_0xcb75('0x43')]['id']}})[_0xcb75('0x1e')](handleEntityNotFound(_0x2d491a,null))[_0xcb75('0x1e')](saveUpdates(_0x35a8fc[_0xcb75('0x42')],null))[_0xcb75('0x1e')](respondWithResult(_0x2d491a,null))[_0xcb75('0x3f')](handleError(_0x2d491a,null));};exports[_0xcb75('0x1f')]=function(_0x31c5e2,_0x36a791){return db[_0xcb75('0x28')][_0xcb75('0x40')]({'where':{'id':_0x31c5e2[_0xcb75('0x43')]['id']}})[_0xcb75('0x1e')](handleEntityNotFound(_0x36a791,null))['then'](removeEntity(_0x36a791,null))[_0xcb75('0x3f')](handleError(_0x36a791,null));};exports[_0xcb75('0x44')]=function(_0x56e854,_0x5cfbb4,_0x4395d7){var _0x4a1ca8={};var _0x2d2da4={};var _0x270c05;var _0x44b416;return db['VtigerAccount'][_0xcb75('0x45')]({'where':{'id':_0x56e854[_0xcb75('0x43')]['id']}})[_0xcb75('0x1e')](handleEntityNotFound(_0x5cfbb4,null))[_0xcb75('0x1e')](function(_0x4ba700){if(_0x4ba700){_0x270c05=_0x4ba700;_0x2d2da4[_0xcb75('0x2c')]=_[_0xcb75('0x2e')](db[_0xcb75('0x46')][_0xcb75('0x47')]);_0x2d2da4[_0xcb75('0x2d')]=_[_0xcb75('0x2e')](_0x56e854['query']);_0x2d2da4[_0xcb75('0x2f')]=_[_0xcb75('0x30')](_0x2d2da4[_0xcb75('0x2c')],_0x2d2da4[_0xcb75('0x2d')]);_0x4a1ca8[_0xcb75('0x31')]=_['intersection'](_0x2d2da4[_0xcb75('0x2c')],qs[_0xcb75('0x32')](_0x56e854[_0xcb75('0x2d')]['fields']));_0x4a1ca8[_0xcb75('0x31')]=_0x4a1ca8[_0xcb75('0x31')][_0xcb75('0x33')]?_0x4a1ca8['attributes']:_0x2d2da4[_0xcb75('0x2c')];_0x4a1ca8[_0xcb75('0x36')]=qs[_0xcb75('0x37')](_0x56e854[_0xcb75('0x2d')][_0xcb75('0x37')]);_0x4a1ca8['where']=qs[_0xcb75('0x2f')](_[_0xcb75('0x48')](_0x56e854[_0xcb75('0x2d')],_0x2d2da4[_0xcb75('0x2f')]));if(_0x56e854[_0xcb75('0x2d')][_0xcb75('0x38')]){_0x4a1ca8[_0xcb75('0x39')]=_['merge'](_0x4a1ca8[_0xcb75('0x39')],{'$or':_[_0xcb75('0x27')](_0x4a1ca8[_0xcb75('0x31')],function(_0x453803){var _0x717fa2={};_0x717fa2[_0x453803]={'$like':'%'+_0x56e854['query']['filter']+'%'};return _0x717fa2;})});}_0x4a1ca8=_[_0xcb75('0x3a')]({},_0x4a1ca8,_0x56e854[_0xcb75('0x3b')]);return _0x270c05['getConfigurations'](_0x4a1ca8);}})['then'](function(_0x413eee){if(_0x413eee){_0x44b416=_0x413eee[_0xcb75('0x33')];if(!_0x56e854[_0xcb75('0x2d')][_0xcb75('0x34')]('nolimit')){_0x4a1ca8[_0xcb75('0x19')]=qs[_0xcb75('0x19')](_0x56e854[_0xcb75('0x2d')]['limit']);_0x4a1ca8['offset']=qs['offset'](_0x56e854[_0xcb75('0x2d')][_0xcb75('0x16')]);}return _0x270c05[_0xcb75('0x44')](_0x4a1ca8);}})['then'](function(_0x2e2ab2){if(_0x2e2ab2){return _0x2e2ab2?{'count':_0x44b416,'rows':_0x2e2ab2}:null;}})[_0xcb75('0x1e')](respondWithResult(_0x5cfbb4,null))['catch'](handleError(_0x5cfbb4,null));};exports[_0xcb75('0x49')]=function(_0x53c6ba,_0x270371,_0x5d8f7a){if(_0x53c6ba[_0xcb75('0x42')]['id']){delete _0x53c6ba['body']['id'];}return db[_0xcb75('0x28')][_0xcb75('0x45')]({'where':{'id':_0x53c6ba[_0xcb75('0x43')]['id']}})[_0xcb75('0x1e')](handleEntityNotFound(_0x270371,null))[_0xcb75('0x1e')](function(_0x56d596){if(_0x56d596){_0x53c6ba[_0xcb75('0x42')][_0xcb75('0x4a')]=_0x56d596['id'];_0x53c6ba[_0xcb75('0x42')][_0xcb75('0x4b')]=integrations['getSubjects'](_0x53c6ba[_0xcb75('0x42')][_0xcb75('0x4c')],_0x53c6ba[_0xcb75('0x42')][_0xcb75('0x2a')]);_0x53c6ba[_0xcb75('0x42')][_0xcb75('0x4d')]=integrations[_0xcb75('0x4e')](_0x53c6ba['body']['channel'],_0x53c6ba[_0xcb75('0x42')]['type']);return db[_0xcb75('0x46')][_0xcb75('0x41')](_0x53c6ba['body'],{'include':[{'model':db['VtigerField'],'as':'Subjects'},{'model':db[_0xcb75('0x4f')],'as':_0xcb75('0x4d')}]});}return null;})[_0xcb75('0x1e')](respondWithResult(_0x270371,null))[_0xcb75('0x3f')](handleError(_0x270371,null));};var md5=require(_0xcb75('0x50'));exports[_0xcb75('0x51')]=function(_0x46ee0b,_0x1dba55,_0x5bd52){var _0x214aa0=null;var _0x40e21f=null;var _0x4c34e8=null;var _0xa4f8e2=null;var _0x5e37f3='';return db[_0xcb75('0x28')][_0xcb75('0x45')]({'where':{'id':_0x46ee0b[_0xcb75('0x43')]['id']},'attributes':['id',_0xcb75('0x24'),'username',_0xcb75('0x52'),_0xcb75('0x53'),_0xcb75('0x54'),'serverUrl','accessKey']})[_0xcb75('0x1e')](handleEntityNotFound(_0x1dba55,null))['then'](function(_0x26e17d){if(_0x26e17d){_0x214aa0=_0x26e17d[_0xcb75('0x55')];_0x40e21f=_0x26e17d[_0xcb75('0x56')];_0x4c34e8=_0x26e17d[_0xcb75('0x53')];_0x5e37f3=_0x26e17d['remoteUri'];var _0x15f842=_0x5e37f3[_0xcb75('0x57')](-0x1);if(_0x15f842==='/'){_0x5e37f3=_0x5e37f3[_0xcb75('0x58')](0x0,_0x5e37f3['lastIndexOf'](_0x15f842));}_0xa4f8e2=util[_0xcb75('0x59')]('%s/webservice.php',_0x5e37f3);var _0x2391cb={'method':_0xcb75('0x5a'),'uri':_0xa4f8e2,'qs':{'operation':_0xcb75('0x5b'),'username':_0x26e17d[_0xcb75('0x55')]},'json':!![]};return rp(_0x2391cb);}})[_0xcb75('0x1e')](function(_0x145ca7){if(_0x145ca7[_0xcb75('0x5c')]){var _0x6464fa={'method':_0xcb75('0x5d'),'uri':_0xa4f8e2,'form':{'operation':_0xcb75('0x5e'),'username':_0x214aa0,'accessKey':md5(_0x145ca7['result'][_0xcb75('0x5f')]+_0x40e21f)},'json':!![]};return rp(_0x6464fa);}})[_0xcb75('0x1e')](function(_0x2f171f){if(_0x2f171f[_0xcb75('0x5c')]){var _0x4e6294={'method':_0xcb75('0x5a'),'uri':_0xa4f8e2,'qs':{'operation':_0xcb75('0x60'),'username':_0x214aa0,'sessionName':_0x2f171f[_0xcb75('0x61')]['sessionName'],'elementType':_0x4c34e8},'json':!![]};return rp(_0x4e6294);}})[_0xcb75('0x1e')](function(_0x575fca){if(_0x575fca[_0xcb75('0x5c')]){var _0x1b1f99=[_0xcb75('0x62'),_0xcb75('0x63'),_0xcb75('0x64')];_[_0xcb75('0x65')](_0x575fca[_0xcb75('0x61')]['fields'],function(_0x1bdc44){return _0x1b1f99['includes'](_0x1bdc44[_0xcb75('0x2a')]['name']);});_['remove'](_0x575fca[_0xcb75('0x61')]['fields'],function(_0x2c8c56){return _0x2c8c56[_0xcb75('0x66')]==='false';});return{'count':_0x575fca[_0xcb75('0x61')][_0xcb75('0x32')][_0xcb75('0x33')],'rows':_[_0xcb75('0x27')](_0x575fca[_0xcb75('0x61')][_0xcb75('0x32')],function(_0x281e45){return{'id':_0x281e45['name'],'name':_0x281e45[_0xcb75('0x67')],'custom':_[_0xcb75('0x68')](_0x281e45[_0xcb75('0x24')],'cf_')?!![]:![],'options':_0x281e45[_0xcb75('0x2a')]['name']===_0xcb75('0x69')&&_0x281e45[_0xcb75('0x2a')][_0xcb75('0x6a')]['length']>0x0?_[_0xcb75('0x27')](_0x281e45['type'][_0xcb75('0x6a')],function(_0x1e78b3){return{'name':_0x1e78b3[_0xcb75('0x67')],'value':_0x1e78b3['value']};}):[]};})};}})[_0xcb75('0x1e')](respondWithResult(_0x1dba55,null))[_0xcb75('0x3f')](function(_0x38788f){console[_0xcb75('0x6b')]('vTiger\x20error:\x20'+_0x38788f);var _0x48d1d8=_0x46ee0b[_0xcb75('0x2d')][_0xcb75('0x6c')]?0x1f4:_0x38788f[_0xcb75('0x6d')]||0x1f4;logger[_0xcb75('0x22')](_0xcb75('0x6e'),'getFields',_0x48d1d8,JSON[_0xcb75('0x6f')](_0x38788f));delete _0x38788f[_0xcb75('0x24')];if(_0x48d1d8===0x191){_0x48d1d8=0x190;}_0x1dba55['status'](_0x48d1d8)[_0xcb75('0x25')](_0x46ee0b['query']['test']?{'message':_0xcb75('0x70'),'statusCode':_0x38788f['statusCode']}:_0x38788f);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index 66d7b61..69b1875 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 _0x5995=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','exports','define','VtigerAccount','int_vtiger_accounts','../../config/logger'];(function(_0x571809,_0x5cd967){var _0xc22642=function(_0x367b52){while(--_0x367b52){_0x571809['push'](_0x571809['shift']());}};_0xc22642(++_0x5cd967);}(_0x5995,0xf6));var _0x5599=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0x5995[_0x46698a];return _0x356db0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x5599('0x0'))('api');var moment=require(_0x5599('0x1'));var BPromise=require(_0x5599('0x2'));var rp=require(_0x5599('0x3'));var fs=require('fs');var path=require(_0x5599('0x4'));var rimraf=require(_0x5599('0x5'));var config=require(_0x5599('0x6'));var attributes=require(_0x5599('0x7'));var integrations=require(_0x5599('0x8'));module[_0x5599('0x9')]=function(_0x115dea,_0x4d6544){return _0x115dea[_0x5599('0xa')](_0x5599('0xb'),attributes,{'tableName':_0x5599('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3b65=['define','VtigerAccount','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','exports'];(function(_0x2b8564,_0x152df4){var _0x1d9d58=function(_0x5d9b98){while(--_0x5d9b98){_0x2b8564['push'](_0x2b8564['shift']());}};_0x1d9d58(++_0x152df4);}(_0x3b65,0x152));var _0x53b6=function(_0x2246e0,_0x2403df){_0x2246e0=_0x2246e0-0x0;var _0x5325a3=_0x3b65[_0x2246e0];return _0x5325a3;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x53b6('0x0'))(_0x53b6('0x1'));var moment=require(_0x53b6('0x2'));var BPromise=require(_0x53b6('0x3'));var rp=require(_0x53b6('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x53b6('0x5'));var config=require(_0x53b6('0x6'));var attributes=require(_0x53b6('0x7'));var integrations=require(_0x53b6('0x8'));module[_0x53b6('0x9')]=function(_0x4a2fcd,_0x2d8009){return _0x4a2fcd[_0x53b6('0xa')](_0x53b6('0xb'),attributes,{'tableName':'int_vtiger_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.rpc.js b/server/api/intVtigerAccount/intVtigerAccount.rpc.js index 00a9468..892906c 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 _0x757a=['stringify','error','message','result','catch','GetVtigerAccount','VtigerAccount','findAll','options','where','attributes','limit','include','map','model','ShowVtigerAccount','find','raw','util','moment','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s'];(function(_0x59ef36,_0x101ce4){var _0x24d871=function(_0x1f8887){while(--_0x1f8887){_0x59ef36['push'](_0x59ef36['shift']());}};_0x24d871(++_0x101ce4);}(_0x757a,0xde));var _0xa757=function(_0x1a5baa,_0x55456c){_0x1a5baa=_0x1a5baa-0x0;var _0x379df1=_0x757a[_0x1a5baa];return _0x379df1;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var moment=require(_0xa757('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa757('0x2'))['db'];var utils=require(_0xa757('0x3'));var logger=require(_0xa757('0x4'))(_0xa757('0x5'));var config=require(_0xa757('0x6'));var jayson=require(_0xa757('0x7'));var client=jayson['client'][_0xa757('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4343b6,_0x53be0e,_0x2930fa){return new BPromise(function(_0x2f7793,_0x447344){return client[_0xa757('0x9')](_0x4343b6,_0x2930fa)[_0xa757('0xa')](function(_0x5aef8a){logger[_0xa757('0xb')](_0xa757('0xc'),_0x53be0e,_0xa757('0xd'));logger[_0xa757('0xe')](_0xa757('0xf'),_0x53be0e,_0xa757('0xd'),JSON[_0xa757('0x10')](_0x5aef8a));if(_0x5aef8a['error']){if(_0x5aef8a['error']['code']===0x1f4){logger['error']('VtigerAccount,\x20%s,\x20%s',_0x53be0e,_0x5aef8a[_0xa757('0x11')]['message']);return _0x447344(_0x5aef8a['error'][_0xa757('0x12')]);}logger['error']('VtigerAccount,\x20%s,\x20%s',_0x53be0e,_0x5aef8a[_0xa757('0x11')][_0xa757('0x12')]);return _0x2f7793(_0x5aef8a[_0xa757('0x11')][_0xa757('0x12')]);}else{logger[_0xa757('0xb')](_0xa757('0xc'),_0x53be0e,_0xa757('0xd'));_0x2f7793(_0x5aef8a[_0xa757('0x13')][_0xa757('0x12')]);}})[_0xa757('0x14')](function(_0x50aac1){logger[_0xa757('0x11')](_0xa757('0xc'),_0x53be0e,_0x50aac1);_0x447344(_0x50aac1);});});}exports[_0xa757('0x15')]=function(_0x4d9f58){var _0x54b305=this;return new Promise(function(_0x151c04,_0x468d45){return db[_0xa757('0x16')][_0xa757('0x17')]({'raw':_0x4d9f58[_0xa757('0x18')]?_0x4d9f58[_0xa757('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x4d9f58[_0xa757('0x18')]?_0x4d9f58['options'][_0xa757('0x19')]||null:null,'attributes':_0x4d9f58[_0xa757('0x18')]?_0x4d9f58[_0xa757('0x18')][_0xa757('0x1a')]||null:null,'limit':_0x4d9f58['options']?_0x4d9f58['options'][_0xa757('0x1b')]||null:null,'include':_0x4d9f58[_0xa757('0x18')]?_0x4d9f58[_0xa757('0x18')][_0xa757('0x1c')]?_[_0xa757('0x1d')](_0x4d9f58[_0xa757('0x18')][_0xa757('0x1c')],function(_0x21f1af){return{'model':db[_0x21f1af[_0xa757('0x1e')]],'as':_0x21f1af['as'],'attributes':_0x21f1af['attributes'],'include':_0x21f1af[_0xa757('0x1c')]?_['map'](_0x21f1af[_0xa757('0x1c')],function(_0x47903b){return{'model':db[_0x47903b[_0xa757('0x1e')]],'as':_0x47903b['as'],'attributes':_0x47903b[_0xa757('0x1a')],'include':_0x47903b[_0xa757('0x1c')]?_['map'](_0x47903b[_0xa757('0x1c')],function(_0xcd98bd){return{'model':db[_0xcd98bd[_0xa757('0x1e')]],'as':_0xcd98bd['as'],'attributes':_0xcd98bd[_0xa757('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x449a7d){logger['info']('GetVtigerAccount',_0x4d9f58);logger['debug']('GetVtigerAccount',_0x4d9f58,JSON[_0xa757('0x10')](_0x449a7d));_0x151c04(_0x449a7d);})['catch'](function(_0x2208f9){logger[_0xa757('0x11')]('GetVtigerAccount',_0x2208f9[_0xa757('0x12')],_0x4d9f58);_0x468d45(_0x54b305['error'](0x1f4,_0x2208f9[_0xa757('0x12')]));});});};exports[_0xa757('0x1f')]=function(_0x5307c3){var _0x235e54=this;return new Promise(function(_0x5ade7b,_0x3a4a66){return db[_0xa757('0x16')][_0xa757('0x20')]({'raw':_0x5307c3[_0xa757('0x18')]?_0x5307c3[_0xa757('0x18')][_0xa757('0x21')]===undefined?!![]:![]:!![],'where':_0x5307c3[_0xa757('0x18')]?_0x5307c3[_0xa757('0x18')][_0xa757('0x19')]||null:null,'attributes':_0x5307c3[_0xa757('0x18')]?_0x5307c3[_0xa757('0x18')][_0xa757('0x1a')]||null:null,'include':_0x5307c3[_0xa757('0x18')]?_0x5307c3[_0xa757('0x18')][_0xa757('0x1c')]?_[_0xa757('0x1d')](_0x5307c3[_0xa757('0x18')][_0xa757('0x1c')],function(_0x1eacde){return{'model':db[_0x1eacde[_0xa757('0x1e')]],'as':_0x1eacde['as'],'attributes':_0x1eacde[_0xa757('0x1a')],'include':_0x1eacde[_0xa757('0x1c')]?_[_0xa757('0x1d')](_0x1eacde[_0xa757('0x1c')],function(_0x59700d){return{'model':db[_0x59700d[_0xa757('0x1e')]],'as':_0x59700d['as'],'attributes':_0x59700d[_0xa757('0x1a')],'include':_0x59700d[_0xa757('0x1c')]?_[_0xa757('0x1d')](_0x59700d[_0xa757('0x1c')],function(_0x51e2aa){return{'model':db[_0x51e2aa[_0xa757('0x1e')]],'as':_0x51e2aa['as'],'attributes':_0x51e2aa[_0xa757('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xa757('0xa')](function(_0x2c34b1){logger[_0xa757('0xb')](_0xa757('0x1f'),_0x5307c3);logger['debug'](_0xa757('0x1f'),_0x5307c3,JSON[_0xa757('0x10')](_0x2c34b1));_0x5ade7b(_0x2c34b1);})[_0xa757('0x14')](function(_0xc34409){logger[_0xa757('0x11')](_0xa757('0x1f'),_0xc34409[_0xa757('0x12')],_0x5307c3);_0x3a4a66(_0x235e54[_0xa757('0x11')](0x1f4,_0xc34409[_0xa757('0x12')]));});});}; \ No newline at end of file +var _0xb574=['where','attributes','include','map','model','ShowVtigerAccount','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','GetVtigerAccount','VtigerAccount','findAll','options','raw'];(function(_0x180ac2,_0x219d65){var _0xfcaede=function(_0x728ebe){while(--_0x728ebe){_0x180ac2['push'](_0x180ac2['shift']());}};_0xfcaede(++_0x219d65);}(_0xb574,0x106));var _0x4b57=function(_0x4a09c5,_0x42364f){_0x4a09c5=_0x4a09c5-0x0;var _0x3b7736=_0xb574[_0x4a09c5];return _0x3b7736;};'use strict';var _=require(_0x4b57('0x0'));var util=require(_0x4b57('0x1'));var moment=require('moment');var BPromise=require(_0x4b57('0x2'));var rs=require(_0x4b57('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4b57('0x4'))['db'];var utils=require(_0x4b57('0x5'));var logger=require(_0x4b57('0x6'))(_0x4b57('0x7'));var config=require(_0x4b57('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x4b57('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4a4a0f,_0x585d86,_0x4b2d65){return new BPromise(function(_0x548ee8,_0x291e54){return client[_0x4b57('0xa')](_0x4a4a0f,_0x4b2d65)[_0x4b57('0xb')](function(_0x3b112d){logger[_0x4b57('0xc')](_0x4b57('0xd'),_0x585d86,_0x4b57('0xe'));logger[_0x4b57('0xf')]('VtigerAccount,\x20%s,\x20%s,\x20%s',_0x585d86,_0x4b57('0xe'),JSON[_0x4b57('0x10')](_0x3b112d));if(_0x3b112d[_0x4b57('0x11')]){if(_0x3b112d['error']['code']===0x1f4){logger[_0x4b57('0x11')](_0x4b57('0xd'),_0x585d86,_0x3b112d[_0x4b57('0x11')][_0x4b57('0x12')]);return _0x291e54(_0x3b112d[_0x4b57('0x11')][_0x4b57('0x12')]);}logger[_0x4b57('0x11')](_0x4b57('0xd'),_0x585d86,_0x3b112d[_0x4b57('0x11')]['message']);return _0x548ee8(_0x3b112d['error'][_0x4b57('0x12')]);}else{logger[_0x4b57('0xc')](_0x4b57('0xd'),_0x585d86,'request\x20sent');_0x548ee8(_0x3b112d[_0x4b57('0x13')]['message']);}})[_0x4b57('0x14')](function(_0x42aff4){logger[_0x4b57('0x11')](_0x4b57('0xd'),_0x585d86,_0x42aff4);_0x291e54(_0x42aff4);});});}exports[_0x4b57('0x15')]=function(_0xfb71cc){var _0x4ede42=this;return new Promise(function(_0x1b35ff,_0x1a0b72){return db[_0x4b57('0x16')][_0x4b57('0x17')]({'raw':_0xfb71cc['options']?_0xfb71cc[_0x4b57('0x18')][_0x4b57('0x19')]===undefined?!![]:![]:!![],'where':_0xfb71cc[_0x4b57('0x18')]?_0xfb71cc[_0x4b57('0x18')][_0x4b57('0x1a')]||null:null,'attributes':_0xfb71cc[_0x4b57('0x18')]?_0xfb71cc['options'][_0x4b57('0x1b')]||null:null,'limit':_0xfb71cc[_0x4b57('0x18')]?_0xfb71cc[_0x4b57('0x18')]['limit']||null:null,'include':_0xfb71cc[_0x4b57('0x18')]?_0xfb71cc[_0x4b57('0x18')][_0x4b57('0x1c')]?_[_0x4b57('0x1d')](_0xfb71cc['options'][_0x4b57('0x1c')],function(_0x368c5f){return{'model':db[_0x368c5f['model']],'as':_0x368c5f['as'],'attributes':_0x368c5f[_0x4b57('0x1b')],'include':_0x368c5f[_0x4b57('0x1c')]?_[_0x4b57('0x1d')](_0x368c5f[_0x4b57('0x1c')],function(_0x540eff){return{'model':db[_0x540eff[_0x4b57('0x1e')]],'as':_0x540eff['as'],'attributes':_0x540eff['attributes'],'include':_0x540eff[_0x4b57('0x1c')]?_['map'](_0x540eff[_0x4b57('0x1c')],function(_0x2dc9d8){return{'model':db[_0x2dc9d8[_0x4b57('0x1e')]],'as':_0x2dc9d8['as'],'attributes':_0x2dc9d8[_0x4b57('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x4b57('0xb')](function(_0x392e37){logger['info']('GetVtigerAccount',_0xfb71cc);logger[_0x4b57('0xf')]('GetVtigerAccount',_0xfb71cc,JSON[_0x4b57('0x10')](_0x392e37));_0x1b35ff(_0x392e37);})[_0x4b57('0x14')](function(_0x874cf7){logger[_0x4b57('0x11')](_0x4b57('0x15'),_0x874cf7[_0x4b57('0x12')],_0xfb71cc);_0x1a0b72(_0x4ede42['error'](0x1f4,_0x874cf7[_0x4b57('0x12')]));});});};exports[_0x4b57('0x1f')]=function(_0x68be27){var _0x3cd331=this;return new Promise(function(_0x4ccf89,_0xa91ba){return db[_0x4b57('0x16')]['find']({'raw':_0x68be27[_0x4b57('0x18')]?_0x68be27[_0x4b57('0x18')][_0x4b57('0x19')]===undefined?!![]:![]:!![],'where':_0x68be27[_0x4b57('0x18')]?_0x68be27['options']['where']||null:null,'attributes':_0x68be27['options']?_0x68be27[_0x4b57('0x18')][_0x4b57('0x1b')]||null:null,'include':_0x68be27[_0x4b57('0x18')]?_0x68be27[_0x4b57('0x18')][_0x4b57('0x1c')]?_['map'](_0x68be27[_0x4b57('0x18')][_0x4b57('0x1c')],function(_0x1fd3f7){return{'model':db[_0x1fd3f7['model']],'as':_0x1fd3f7['as'],'attributes':_0x1fd3f7[_0x4b57('0x1b')],'include':_0x1fd3f7[_0x4b57('0x1c')]?_[_0x4b57('0x1d')](_0x1fd3f7['include'],function(_0x28a0ee){return{'model':db[_0x28a0ee[_0x4b57('0x1e')]],'as':_0x28a0ee['as'],'attributes':_0x28a0ee['attributes'],'include':_0x28a0ee[_0x4b57('0x1c')]?_[_0x4b57('0x1d')](_0x28a0ee[_0x4b57('0x1c')],function(_0x91f32e){return{'model':db[_0x91f32e[_0x4b57('0x1e')]],'as':_0x91f32e['as'],'attributes':_0x91f32e[_0x4b57('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1f9f76){logger[_0x4b57('0xc')](_0x4b57('0x1f'),_0x68be27);logger[_0x4b57('0xf')](_0x4b57('0x1f'),_0x68be27,JSON[_0x4b57('0x10')](_0x1f9f76));_0x4ccf89(_0x1f9f76);})[_0x4b57('0x14')](function(_0x4c5b82){logger['error'](_0x4b57('0x1f'),_0x4c5b82[_0x4b57('0x12')],_0x68be27);_0xa91ba(_0x3cd331[_0x4b57('0x11')](0x1f4,_0x4c5b82['message']));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index b2e4ea4..8edd212 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 _0x87c7=['util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./intVtigerConfiguration.controller','get','index','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','put','update','delete','destroy','exports','multer'];(function(_0x329fbf,_0x1e1088){var _0x445278=function(_0x5c4a4d){while(--_0x5c4a4d){_0x329fbf['push'](_0x329fbf['shift']());}};_0x445278(++_0x1e1088);}(_0x87c7,0xc7));var _0x787c=function(_0x5a688b,_0x15223c){_0x5a688b=_0x5a688b-0x0;var _0x68c560=_0x87c7[_0x5a688b];return _0x68c560;};'use strict';var multer=require(_0x787c('0x0'));var util=require(_0x787c('0x1'));var path=require(_0x787c('0x2'));var timeout=require(_0x787c('0x3'));var express=require(_0x787c('0x4'));var router=express['Router']();var fs_extra=require(_0x787c('0x5'));var auth=require(_0x787c('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x787c('0x7'));var controller=require(_0x787c('0x8'));router[_0x787c('0x9')]('/',auth['isAuthenticated'](),controller[_0x787c('0xa')]);router['get'](_0x787c('0xb'),auth[_0x787c('0xc')](),controller[_0x787c('0xd')]);router[_0x787c('0x9')](_0x787c('0xe'),auth[_0x787c('0xc')](),controller[_0x787c('0xf')]);router[_0x787c('0x9')](_0x787c('0x10'),auth[_0x787c('0xc')](),controller[_0x787c('0x11')]);router[_0x787c('0x9')](_0x787c('0x12'),auth[_0x787c('0xc')](),controller['getDescriptions']);router[_0x787c('0x13')]('/',auth[_0x787c('0xc')](),controller['create']);router[_0x787c('0x14')](_0x787c('0xb'),auth[_0x787c('0xc')](),controller[_0x787c('0x15')]);router[_0x787c('0x16')](_0x787c('0xb'),auth['isAuthenticated'](),controller[_0x787c('0x17')]);module[_0x787c('0x18')]=router; \ No newline at end of file +var _0x54c7=['../../config/environment','./intVtigerConfiguration.controller','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','create','update','exports','multer','util','path','express','Router','../../components/auth/service'];(function(_0x27340d,_0x2813a9){var _0x4b73bf=function(_0x2f2459){while(--_0x2f2459){_0x27340d['push'](_0x27340d['shift']());}};_0x4b73bf(++_0x2813a9);}(_0x54c7,0x9a));var _0x754c=function(_0x3d4f47,_0x4833e1){_0x3d4f47=_0x3d4f47-0x0;var _0x5b3559=_0x54c7[_0x3d4f47];return _0x5b3559;};'use strict';var multer=require(_0x754c('0x0'));var util=require(_0x754c('0x1'));var path=require(_0x754c('0x2'));var timeout=require('connect-timeout');var express=require(_0x754c('0x3'));var router=express[_0x754c('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x754c('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x754c('0x6'));var controller=require(_0x754c('0x7'));router[_0x754c('0x8')]('/',auth[_0x754c('0x9')](),controller['index']);router[_0x754c('0x8')](_0x754c('0xa'),auth[_0x754c('0x9')](),controller[_0x754c('0xb')]);router[_0x754c('0x8')](_0x754c('0xc'),auth[_0x754c('0x9')](),controller[_0x754c('0xd')]);router[_0x754c('0x8')](_0x754c('0xe'),auth[_0x754c('0x9')](),controller['getSubjects']);router['get'](_0x754c('0xf'),auth[_0x754c('0x9')](),controller[_0x754c('0x10')]);router['post']('/',auth[_0x754c('0x9')](),controller[_0x754c('0x11')]);router['put'](_0x754c('0xa'),auth[_0x754c('0x9')](),controller[_0x754c('0x12')]);router['delete'](_0x754c('0xa'),auth[_0x754c('0x9')](),controller['destroy']);module[_0x754c('0x13')]=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index 9ca9c67..9d105e8 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 _0xaeb5=['exports','STRING','sequelize'];(function(_0x2c6147,_0x2fb7c1){var _0x2908a7=function(_0x137c2a){while(--_0x137c2a){_0x2c6147['push'](_0x2c6147['shift']());}};_0x2908a7(++_0x2fb7c1);}(_0xaeb5,0x1b8));var _0x5aeb=function(_0x3de80e,_0x5cabca){_0x3de80e=_0x3de80e-0x0;var _0x5629fd=_0xaeb5[_0x3de80e];return _0x5629fd;};'use strict';var Sequelize=require(_0x5aeb('0x0'));module[_0x5aeb('0x1')]={'name':{'type':Sequelize[_0x5aeb('0x2')]},'description':{'type':Sequelize[_0x5aeb('0x2')]}}; \ No newline at end of file +var _0xcafe=['sequelize','exports','STRING'];(function(_0x2c8710,_0x3ae40f){var _0x40f935=function(_0x5f2679){while(--_0x5f2679){_0x2c8710['push'](_0x2c8710['shift']());}};_0x40f935(++_0x3ae40f);}(_0xcafe,0x159));var _0xecaf=function(_0x5ee485,_0x1e8a00){_0x5ee485=_0x5ee485-0x0;var _0x3994e7=_0xcafe[_0x5ee485];return _0x3994e7;};'use strict';var Sequelize=require(_0xecaf('0x0'));module[_0xecaf('0x1')]={'name':{'type':Sequelize[_0xecaf('0x2')]},'description':{'type':Sequelize[_0xecaf('0x2')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index fa9fbc2..bc038c5 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 _0x64f6=['stack','name','index','map','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','VtigerConfiguration','findAll','catch','show','params','keys','fields','length','options','find','create','body','getFields','findOne','VtigerField','getSubjects','hasOwnProperty','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','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','sendStatus','status','end','offset','undefined','count','limit','set','json','apply','reject','save','update','destroy','then','error'];(function(_0x3fb56f,_0x5f99f2){var _0x287e44=function(_0x660622){while(--_0x660622){_0x3fb56f['push'](_0x3fb56f['shift']());}};_0x287e44(++_0x5f99f2);}(_0x64f6,0x17d));var _0x664f=function(_0x251f85,_0x2be404){_0x251f85=_0x251f85-0x0;var _0x307b74=_0x64f6[_0x251f85];return _0x307b74;};'use strict';var emlformat=require(_0x664f('0x0'));var rimraf=require(_0x664f('0x1'));var zipdir=require(_0x664f('0x2'));var jsonpatch=require(_0x664f('0x3'));var rp=require(_0x664f('0x4'));var moment=require('moment');var BPromise=require(_0x664f('0x5'));var Mustache=require(_0x664f('0x6'));var util=require(_0x664f('0x7'));var path=require(_0x664f('0x8'));var sox=require(_0x664f('0x9'));var csv=require('to-csv');var ejs=require(_0x664f('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x664f('0xb'));var squel=require(_0x664f('0xc'));var crypto=require(_0x664f('0xd'));var jsforce=require(_0x664f('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x664f('0xf'));var querystring=require(_0x664f('0x10'));var Papa=require(_0x664f('0x11'));var Redis=require(_0x664f('0x12'));var authService=require(_0x664f('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x664f('0x14'));var hardwareService=require(_0x664f('0x15'));var logger=require(_0x664f('0x16'))(_0x664f('0x17'));var utils=require(_0x664f('0x18'));var config=require(_0x664f('0x19'));var licenseUtil=require(_0x664f('0x1a'));var db=require(_0x664f('0x1b'))['db'];function respondWithStatusCode(_0x372c81,_0x2d2f07){_0x2d2f07=_0x2d2f07||0xcc;return function(_0xe850e3){if(_0xe850e3){return _0x372c81[_0x664f('0x1c')](_0x2d2f07);}return _0x372c81[_0x664f('0x1d')](_0x2d2f07)[_0x664f('0x1e')]();};}function respondWithResult(_0x180583,_0x2f027e){_0x2f027e=_0x2f027e||0xc8;return function(_0x32cef9){if(_0x32cef9){return _0x180583[_0x664f('0x1d')](_0x2f027e)['json'](_0x32cef9);}};}function respondWithFilteredResult(_0x1d031e,_0x4f21eb){return function(_0x5ceabe){if(_0x5ceabe){var _0x129813=typeof _0x4f21eb[_0x664f('0x1f')]===_0x664f('0x20')&&typeof _0x4f21eb['limit']===_0x664f('0x20');var _0x514d18=_0x5ceabe[_0x664f('0x21')];var _0x439891=_0x129813?0x0:_0x4f21eb[_0x664f('0x1f')];var _0x2e339b=_0x129813?_0x5ceabe[_0x664f('0x21')]:_0x4f21eb[_0x664f('0x1f')]+_0x4f21eb[_0x664f('0x22')];var _0x380c1b;if(_0x2e339b>=_0x514d18){_0x2e339b=_0x514d18;_0x380c1b=0xc8;}else{_0x380c1b=0xce;}_0x1d031e['status'](_0x380c1b);return _0x1d031e[_0x664f('0x23')]('Content-Range',_0x439891+'-'+_0x2e339b+'/'+_0x514d18)[_0x664f('0x24')](_0x5ceabe);}return null;};}function patchUpdates(_0x484db0){return function(_0x36b5f4){try{jsonpatch[_0x664f('0x25')](_0x36b5f4,_0x484db0,!![]);}catch(_0x2adb00){return BPromise[_0x664f('0x26')](_0x2adb00);}return _0x36b5f4[_0x664f('0x27')]();};}function saveUpdates(_0x5474bf,_0x1240c1){return function(_0x12ae69){if(_0x12ae69){return _0x12ae69[_0x664f('0x28')](_0x5474bf)['then'](function(_0x4f95cd){return _0x4f95cd;});}return null;};}function removeEntity(_0x1620a7,_0x50d2cb){return function(_0x17c56a){if(_0x17c56a){return _0x17c56a[_0x664f('0x29')]()[_0x664f('0x2a')](function(){_0x1620a7[_0x664f('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2d1b9c,_0x27b4b8){return function(_0x55f384){if(!_0x55f384){_0x2d1b9c[_0x664f('0x1c')](0x194);}return _0x55f384;};}function handleError(_0x3dc443,_0x3fe5b9){_0x3fe5b9=_0x3fe5b9||0x1f4;return function(_0x1b3e2c){logger[_0x664f('0x2b')](_0x1b3e2c[_0x664f('0x2c')]);if(_0x1b3e2c[_0x664f('0x2d')]){delete _0x1b3e2c[_0x664f('0x2d')];}_0x3dc443['status'](_0x3fe5b9)['send'](_0x1b3e2c);};}exports[_0x664f('0x2e')]=function(_0x46a8b0,_0x32b11b){var _0x550123={},_0x4522c3={},_0x3f9390={'count':0x0,'rows':[]};var _0x5a1654=_[_0x664f('0x2f')](db['VtigerConfiguration'][_0x664f('0x30')],function(_0x201945){return{'name':_0x201945[_0x664f('0x31')],'type':_0x201945['type'][_0x664f('0x32')]};});_0x4522c3[_0x664f('0x33')]=_['map'](_0x5a1654,_0x664f('0x2d'));_0x4522c3[_0x664f('0x34')]=_['keys'](_0x46a8b0['query']);_0x4522c3[_0x664f('0x35')]=_[_0x664f('0x36')](_0x4522c3['model'],_0x4522c3[_0x664f('0x34')]);_0x550123[_0x664f('0x37')]=_['intersection'](_0x4522c3[_0x664f('0x33')],qs['fields'](_0x46a8b0[_0x664f('0x34')]['fields']));_0x550123['attributes']=_0x550123[_0x664f('0x37')]['length']?_0x550123[_0x664f('0x37')]:_0x4522c3['model'];if(!_0x46a8b0[_0x664f('0x34')]['hasOwnProperty'](_0x664f('0x38'))){_0x550123['limit']=qs[_0x664f('0x22')](_0x46a8b0[_0x664f('0x34')][_0x664f('0x22')]);_0x550123[_0x664f('0x1f')]=qs[_0x664f('0x1f')](_0x46a8b0[_0x664f('0x34')][_0x664f('0x1f')]);}_0x550123[_0x664f('0x39')]=qs[_0x664f('0x3a')](_0x46a8b0[_0x664f('0x34')]['sort']);_0x550123[_0x664f('0x3b')]=qs['filters'](_[_0x664f('0x3c')](_0x46a8b0[_0x664f('0x34')],_0x4522c3[_0x664f('0x35')]),_0x5a1654);if(_0x46a8b0[_0x664f('0x34')][_0x664f('0x3d')]){_0x550123[_0x664f('0x3b')]=_[_0x664f('0x3e')](_0x550123[_0x664f('0x3b')],{'$or':_[_0x664f('0x2f')](_0x5a1654,function(_0x420e9d){if(_0x420e9d[_0x664f('0x3f')]!==_0x664f('0x40')){var _0x107707={};_0x107707[_0x420e9d[_0x664f('0x2d')]]={'$like':'%'+_0x46a8b0[_0x664f('0x34')][_0x664f('0x3d')]+'%'};return _0x107707;}})});}_0x550123=_[_0x664f('0x3e')]({},_0x550123,_0x46a8b0['options']);var _0x2b743f={'where':_0x550123[_0x664f('0x3b')]};return db['VtigerConfiguration'][_0x664f('0x21')](_0x2b743f)[_0x664f('0x2a')](function(_0x1356d3){_0x3f9390[_0x664f('0x21')]=_0x1356d3;if(_0x46a8b0['query'][_0x664f('0x41')]){_0x550123[_0x664f('0x42')]=[{'all':!![]}];}return db[_0x664f('0x43')][_0x664f('0x44')](_0x550123);})[_0x664f('0x2a')](function(_0x2619a1){_0x3f9390['rows']=_0x2619a1;return _0x3f9390;})[_0x664f('0x2a')](respondWithFilteredResult(_0x32b11b,_0x550123))[_0x664f('0x45')](handleError(_0x32b11b,null));};exports[_0x664f('0x46')]=function(_0x1f4e83,_0x2db1ca){var _0x17392e={'raw':![],'where':{'id':_0x1f4e83[_0x664f('0x47')]['id']}},_0xbedd31={};_0xbedd31[_0x664f('0x33')]=_[_0x664f('0x48')](db[_0x664f('0x43')]['rawAttributes']);_0xbedd31[_0x664f('0x34')]=_[_0x664f('0x48')](_0x1f4e83[_0x664f('0x34')]);_0xbedd31[_0x664f('0x35')]=_[_0x664f('0x36')](_0xbedd31[_0x664f('0x33')],_0xbedd31[_0x664f('0x34')]);_0x17392e[_0x664f('0x37')]=_[_0x664f('0x36')](_0xbedd31[_0x664f('0x33')],qs[_0x664f('0x49')](_0x1f4e83[_0x664f('0x34')][_0x664f('0x49')]));_0x17392e['attributes']=_0x17392e[_0x664f('0x37')][_0x664f('0x4a')]?_0x17392e['attributes']:_0xbedd31[_0x664f('0x33')];if(_0x1f4e83[_0x664f('0x34')][_0x664f('0x41')]){_0x17392e[_0x664f('0x42')]=[{'all':!![]}];}_0x17392e=_[_0x664f('0x3e')]({},_0x17392e,_0x1f4e83[_0x664f('0x4b')]);return db[_0x664f('0x43')][_0x664f('0x4c')](_0x17392e)[_0x664f('0x2a')](handleEntityNotFound(_0x2db1ca,null))[_0x664f('0x2a')](respondWithResult(_0x2db1ca,null))[_0x664f('0x45')](handleError(_0x2db1ca,null));};exports['create']=function(_0x2177ad,_0x47ea5f){return db[_0x664f('0x43')][_0x664f('0x4d')](_0x2177ad['body'],{})['then'](respondWithResult(_0x47ea5f,0xc9))[_0x664f('0x45')](handleError(_0x47ea5f,null));};exports[_0x664f('0x28')]=function(_0x7e288c,_0x382fb7){if(_0x7e288c[_0x664f('0x4e')]['id']){delete _0x7e288c['body']['id'];}return db['VtigerConfiguration']['find']({'where':{'id':_0x7e288c['params']['id']}})[_0x664f('0x2a')](handleEntityNotFound(_0x382fb7,null))['then'](saveUpdates(_0x7e288c[_0x664f('0x4e')],null))[_0x664f('0x2a')](respondWithResult(_0x382fb7,null))['catch'](handleError(_0x382fb7,null));};exports['destroy']=function(_0x22dde9,_0x95bb18){return db[_0x664f('0x43')]['find']({'where':{'id':_0x22dde9['params']['id']}})[_0x664f('0x2a')](handleEntityNotFound(_0x95bb18,null))[_0x664f('0x2a')](removeEntity(_0x95bb18,null))[_0x664f('0x45')](handleError(_0x95bb18,null));};exports[_0x664f('0x4f')]=function(_0x1194c7,_0x3e47fd,_0x101158){var _0x40d4de={};var _0x2f9e8b={};var _0x756195;var _0x402ccc;return db[_0x664f('0x43')][_0x664f('0x50')]({'where':{'id':_0x1194c7['params']['id']}})[_0x664f('0x2a')](handleEntityNotFound(_0x3e47fd,null))[_0x664f('0x2a')](function(_0x22209c){if(_0x22209c){_0x756195=_0x22209c;_0x2f9e8b[_0x664f('0x33')]=_[_0x664f('0x48')](db[_0x664f('0x51')][_0x664f('0x30')]);_0x2f9e8b[_0x664f('0x34')]=_[_0x664f('0x48')](_0x1194c7[_0x664f('0x34')]);_0x2f9e8b[_0x664f('0x35')]=_['intersection'](_0x2f9e8b['model'],_0x2f9e8b[_0x664f('0x34')]);_0x40d4de[_0x664f('0x37')]=_['intersection'](_0x2f9e8b['model'],qs[_0x664f('0x49')](_0x1194c7[_0x664f('0x34')][_0x664f('0x49')]));_0x40d4de['attributes']=_0x40d4de[_0x664f('0x37')][_0x664f('0x4a')]?_0x40d4de[_0x664f('0x37')]:_0x2f9e8b[_0x664f('0x33')];_0x40d4de[_0x664f('0x39')]=qs[_0x664f('0x3a')](_0x1194c7[_0x664f('0x34')][_0x664f('0x3a')]);_0x40d4de[_0x664f('0x3b')]=qs[_0x664f('0x35')](_['pick'](_0x1194c7[_0x664f('0x34')],_0x2f9e8b[_0x664f('0x35')]));if(_0x1194c7[_0x664f('0x34')]['filter']){_0x40d4de['where']=_[_0x664f('0x3e')](_0x40d4de['where'],{'$or':_[_0x664f('0x2f')](_0x40d4de['attributes'],function(_0x3e07c0){var _0x17c8fa={};_0x17c8fa[_0x3e07c0]={'$like':'%'+_0x1194c7['query'][_0x664f('0x3d')]+'%'};return _0x17c8fa;})});}_0x40d4de=_[_0x664f('0x3e')]({},_0x40d4de,_0x1194c7[_0x664f('0x4b')]);return _0x756195[_0x664f('0x4f')](_0x40d4de);}})['then'](function(_0x4587d9){if(_0x4587d9){_0x402ccc=_0x4587d9[_0x664f('0x4a')];if(!_0x1194c7[_0x664f('0x34')]['hasOwnProperty'](_0x664f('0x38'))){_0x40d4de['limit']=qs[_0x664f('0x22')](_0x1194c7['query'][_0x664f('0x22')]);_0x40d4de[_0x664f('0x1f')]=qs[_0x664f('0x1f')](_0x1194c7[_0x664f('0x34')]['offset']);}return _0x756195['getFields'](_0x40d4de);}})[_0x664f('0x2a')](function(_0x41946c){if(_0x41946c){return _0x41946c?{'count':_0x402ccc,'rows':_0x41946c}:null;}})[_0x664f('0x2a')](respondWithResult(_0x3e47fd,null))[_0x664f('0x45')](handleError(_0x3e47fd,null));};exports[_0x664f('0x52')]=function(_0x488a22,_0x4ddff2,_0x545e75){var _0x1391b5={};var _0xcf7368={};var _0x21766b;var _0x1f9668;return db['VtigerConfiguration'][_0x664f('0x50')]({'where':{'id':_0x488a22[_0x664f('0x47')]['id']}})[_0x664f('0x2a')](handleEntityNotFound(_0x4ddff2,null))['then'](function(_0x1677b4){if(_0x1677b4){_0x21766b=_0x1677b4;_0xcf7368[_0x664f('0x33')]=_[_0x664f('0x48')](db['VtigerField']['rawAttributes']);_0xcf7368[_0x664f('0x34')]=_[_0x664f('0x48')](_0x488a22[_0x664f('0x34')]);_0xcf7368[_0x664f('0x35')]=_[_0x664f('0x36')](_0xcf7368[_0x664f('0x33')],_0xcf7368[_0x664f('0x34')]);_0x1391b5[_0x664f('0x37')]=_[_0x664f('0x36')](_0xcf7368[_0x664f('0x33')],qs[_0x664f('0x49')](_0x488a22[_0x664f('0x34')]['fields']));_0x1391b5['attributes']=_0x1391b5[_0x664f('0x37')]['length']?_0x1391b5[_0x664f('0x37')]:_0xcf7368[_0x664f('0x33')];_0x1391b5[_0x664f('0x39')]=qs[_0x664f('0x3a')](_0x488a22[_0x664f('0x34')][_0x664f('0x3a')]);_0x1391b5[_0x664f('0x3b')]=qs['filters'](_[_0x664f('0x3c')](_0x488a22[_0x664f('0x34')],_0xcf7368[_0x664f('0x35')]));if(_0x488a22[_0x664f('0x34')][_0x664f('0x3d')]){_0x1391b5['where']=_[_0x664f('0x3e')](_0x1391b5[_0x664f('0x3b')],{'$or':_[_0x664f('0x2f')](_0x1391b5[_0x664f('0x37')],function(_0x329106){var _0x410fd6={};_0x410fd6[_0x329106]={'$like':'%'+_0x488a22[_0x664f('0x34')][_0x664f('0x3d')]+'%'};return _0x410fd6;})});}_0x1391b5=_[_0x664f('0x3e')]({},_0x1391b5,_0x488a22['options']);return _0x21766b[_0x664f('0x52')](_0x1391b5);}})[_0x664f('0x2a')](function(_0xd293e){if(_0xd293e){_0x1f9668=_0xd293e[_0x664f('0x4a')];if(!_0x488a22[_0x664f('0x34')][_0x664f('0x53')]('nolimit')){_0x1391b5[_0x664f('0x22')]=qs[_0x664f('0x22')](_0x488a22[_0x664f('0x34')][_0x664f('0x22')]);_0x1391b5[_0x664f('0x1f')]=qs[_0x664f('0x1f')](_0x488a22[_0x664f('0x34')][_0x664f('0x1f')]);}return _0x21766b['getSubjects'](_0x1391b5);}})['then'](function(_0x21e658){if(_0x21e658){return _0x21e658?{'count':_0x1f9668,'rows':_0x21e658}:null;}})[_0x664f('0x2a')](respondWithResult(_0x4ddff2,null))['catch'](handleError(_0x4ddff2,null));};exports[_0x664f('0x54')]=function(_0x303e83,_0x3ccd61,_0x40f838){var _0x4fbc4d={};var _0x58f3b3={};var _0x5a63cf;var _0x5aaa4e;return db['VtigerConfiguration'][_0x664f('0x50')]({'where':{'id':_0x303e83[_0x664f('0x47')]['id']}})[_0x664f('0x2a')](handleEntityNotFound(_0x3ccd61,null))[_0x664f('0x2a')](function(_0x3bf8b0){if(_0x3bf8b0){_0x5a63cf=_0x3bf8b0;_0x58f3b3[_0x664f('0x33')]=_[_0x664f('0x48')](db['VtigerField'][_0x664f('0x30')]);_0x58f3b3[_0x664f('0x34')]=_[_0x664f('0x48')](_0x303e83[_0x664f('0x34')]);_0x58f3b3['filters']=_[_0x664f('0x36')](_0x58f3b3['model'],_0x58f3b3['query']);_0x4fbc4d[_0x664f('0x37')]=_['intersection'](_0x58f3b3[_0x664f('0x33')],qs['fields'](_0x303e83[_0x664f('0x34')][_0x664f('0x49')]));_0x4fbc4d[_0x664f('0x37')]=_0x4fbc4d[_0x664f('0x37')][_0x664f('0x4a')]?_0x4fbc4d[_0x664f('0x37')]:_0x58f3b3[_0x664f('0x33')];_0x4fbc4d['order']=qs[_0x664f('0x3a')](_0x303e83[_0x664f('0x34')]['sort']);_0x4fbc4d[_0x664f('0x3b')]=qs['filters'](_[_0x664f('0x3c')](_0x303e83[_0x664f('0x34')],_0x58f3b3[_0x664f('0x35')]));if(_0x303e83['query'][_0x664f('0x3d')]){_0x4fbc4d[_0x664f('0x3b')]=_['merge'](_0x4fbc4d['where'],{'$or':_[_0x664f('0x2f')](_0x4fbc4d[_0x664f('0x37')],function(_0x26cc04){var _0x433461={};_0x433461[_0x26cc04]={'$like':'%'+_0x303e83[_0x664f('0x34')][_0x664f('0x3d')]+'%'};return _0x433461;})});}_0x4fbc4d=_[_0x664f('0x3e')]({},_0x4fbc4d,_0x303e83[_0x664f('0x4b')]);return _0x5a63cf[_0x664f('0x54')](_0x4fbc4d);}})[_0x664f('0x2a')](function(_0x2a7f6d){if(_0x2a7f6d){_0x5aaa4e=_0x2a7f6d['length'];if(!_0x303e83['query'][_0x664f('0x53')](_0x664f('0x38'))){_0x4fbc4d[_0x664f('0x22')]=qs[_0x664f('0x22')](_0x303e83[_0x664f('0x34')][_0x664f('0x22')]);_0x4fbc4d[_0x664f('0x1f')]=qs[_0x664f('0x1f')](_0x303e83[_0x664f('0x34')][_0x664f('0x1f')]);}return _0x5a63cf[_0x664f('0x54')](_0x4fbc4d);}})[_0x664f('0x2a')](function(_0xc5caf2){if(_0xc5caf2){return _0xc5caf2?{'count':_0x5aaa4e,'rows':_0xc5caf2}:null;}})[_0x664f('0x2a')](respondWithResult(_0x3ccd61,null))[_0x664f('0x45')](handleError(_0x3ccd61,null));}; \ No newline at end of file +var _0x6eaf=['zip-dir','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','then','stack','name','index','map','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','where','merge','options','VtigerConfiguration','includeAll','include','params','keys','rawAttributes','find','create','body','catch','destroy','getFields','findOne','VtigerField','order','pick','getSubjects','getDescriptions','eml-format','rimraf'];(function(_0x156b05,_0x534472){var _0xa3565e=function(_0x1dc171){while(--_0x1dc171){_0x156b05['push'](_0x156b05['shift']());}};_0xa3565e(++_0x534472);}(_0x6eaf,0xe5));var _0xf6ea=function(_0x45b4ff,_0x36c077){_0x45b4ff=_0x45b4ff-0x0;var _0x2036b5=_0x6eaf[_0x45b4ff];return _0x2036b5;};'use strict';var emlformat=require(_0xf6ea('0x0'));var rimraf=require(_0xf6ea('0x1'));var zipdir=require(_0xf6ea('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xf6ea('0x3'));var Mustache=require('mustache');var util=require(_0xf6ea('0x4'));var path=require(_0xf6ea('0x5'));var sox=require(_0xf6ea('0x6'));var csv=require(_0xf6ea('0x7'));var ejs=require(_0xf6ea('0x8'));var fs=require('fs');var fs_extra=require(_0xf6ea('0x9'));var _=require(_0xf6ea('0xa'));var squel=require(_0xf6ea('0xb'));var crypto=require(_0xf6ea('0xc'));var jsforce=require(_0xf6ea('0xd'));var deskjs=require(_0xf6ea('0xe'));var toCsv=require(_0xf6ea('0x7'));var querystring=require(_0xf6ea('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xf6ea('0x10'));var qs=require(_0xf6ea('0x11'));var as=require(_0xf6ea('0x12'));var hardwareService=require(_0xf6ea('0x13'));var logger=require(_0xf6ea('0x14'))(_0xf6ea('0x15'));var utils=require(_0xf6ea('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xf6ea('0x17'));var db=require(_0xf6ea('0x18'))['db'];function respondWithStatusCode(_0x123067,_0x5a2506){_0x5a2506=_0x5a2506||0xcc;return function(_0x290192){if(_0x290192){return _0x123067[_0xf6ea('0x19')](_0x5a2506);}return _0x123067['status'](_0x5a2506)['end']();};}function respondWithResult(_0x542b21,_0x3ab176){_0x3ab176=_0x3ab176||0xc8;return function(_0x106803){if(_0x106803){return _0x542b21[_0xf6ea('0x1a')](_0x3ab176)['json'](_0x106803);}};}function respondWithFilteredResult(_0x33d723,_0x320b4c){return function(_0x5beeec){if(_0x5beeec){var _0x2a2101=typeof _0x320b4c[_0xf6ea('0x1b')]===_0xf6ea('0x1c')&&typeof _0x320b4c[_0xf6ea('0x1d')]===_0xf6ea('0x1c');var _0x18ea67=_0x5beeec[_0xf6ea('0x1e')];var _0x20bafc=_0x2a2101?0x0:_0x320b4c[_0xf6ea('0x1b')];var _0x14a947=_0x2a2101?_0x5beeec['count']:_0x320b4c[_0xf6ea('0x1b')]+_0x320b4c['limit'];var _0x383c12;if(_0x14a947>=_0x18ea67){_0x14a947=_0x18ea67;_0x383c12=0xc8;}else{_0x383c12=0xce;}_0x33d723[_0xf6ea('0x1a')](_0x383c12);return _0x33d723[_0xf6ea('0x1f')](_0xf6ea('0x20'),_0x20bafc+'-'+_0x14a947+'/'+_0x18ea67)[_0xf6ea('0x21')](_0x5beeec);}return null;};}function patchUpdates(_0x4e65d1){return function(_0x628d05){try{jsonpatch[_0xf6ea('0x22')](_0x628d05,_0x4e65d1,!![]);}catch(_0x22296c){return BPromise['reject'](_0x22296c);}return _0x628d05[_0xf6ea('0x23')]();};}function saveUpdates(_0x4087c7,_0x325c1d){return function(_0x43f27d){if(_0x43f27d){return _0x43f27d[_0xf6ea('0x24')](_0x4087c7)[_0xf6ea('0x25')](function(_0x44875b){return _0x44875b;});}return null;};}function removeEntity(_0x55a79a,_0x435563){return function(_0x289380){if(_0x289380){return _0x289380['destroy']()[_0xf6ea('0x25')](function(){_0x55a79a[_0xf6ea('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x50c9ce,_0x4c56a){return function(_0x541514){if(!_0x541514){_0x50c9ce[_0xf6ea('0x19')](0x194);}return _0x541514;};}function handleError(_0x1fd21a,_0x3c59db){_0x3c59db=_0x3c59db||0x1f4;return function(_0xa058fd){logger['error'](_0xa058fd[_0xf6ea('0x26')]);if(_0xa058fd[_0xf6ea('0x27')]){delete _0xa058fd[_0xf6ea('0x27')];}_0x1fd21a[_0xf6ea('0x1a')](_0x3c59db)['send'](_0xa058fd);};}exports[_0xf6ea('0x28')]=function(_0x681c95,_0x287059){var _0x402f79={},_0x3124ed={},_0xebd4ea={'count':0x0,'rows':[]};var _0x1d23ad=_[_0xf6ea('0x29')](db['VtigerConfiguration']['rawAttributes'],function(_0x17840d){return{'name':_0x17840d[_0xf6ea('0x2a')],'type':_0x17840d[_0xf6ea('0x2b')][_0xf6ea('0x2c')]};});_0x3124ed[_0xf6ea('0x2d')]=_[_0xf6ea('0x29')](_0x1d23ad,_0xf6ea('0x27'));_0x3124ed[_0xf6ea('0x2e')]=_['keys'](_0x681c95[_0xf6ea('0x2e')]);_0x3124ed[_0xf6ea('0x2f')]=_[_0xf6ea('0x30')](_0x3124ed[_0xf6ea('0x2d')],_0x3124ed[_0xf6ea('0x2e')]);_0x402f79[_0xf6ea('0x31')]=_['intersection'](_0x3124ed['model'],qs[_0xf6ea('0x32')](_0x681c95[_0xf6ea('0x2e')][_0xf6ea('0x32')]));_0x402f79[_0xf6ea('0x31')]=_0x402f79[_0xf6ea('0x31')][_0xf6ea('0x33')]?_0x402f79[_0xf6ea('0x31')]:_0x3124ed[_0xf6ea('0x2d')];if(!_0x681c95[_0xf6ea('0x2e')][_0xf6ea('0x34')](_0xf6ea('0x35'))){_0x402f79[_0xf6ea('0x1d')]=qs[_0xf6ea('0x1d')](_0x681c95[_0xf6ea('0x2e')][_0xf6ea('0x1d')]);_0x402f79[_0xf6ea('0x1b')]=qs['offset'](_0x681c95['query'][_0xf6ea('0x1b')]);}_0x402f79['order']=qs[_0xf6ea('0x36')](_0x681c95[_0xf6ea('0x2e')]['sort']);_0x402f79['where']=qs[_0xf6ea('0x2f')](_['pick'](_0x681c95['query'],_0x3124ed[_0xf6ea('0x2f')]),_0x1d23ad);if(_0x681c95[_0xf6ea('0x2e')][_0xf6ea('0x37')]){_0x402f79[_0xf6ea('0x38')]=_[_0xf6ea('0x39')](_0x402f79[_0xf6ea('0x38')],{'$or':_[_0xf6ea('0x29')](_0x1d23ad,function(_0x140d00){if(_0x140d00['type']!=='VIRTUAL'){var _0x244f06={};_0x244f06[_0x140d00['name']]={'$like':'%'+_0x681c95[_0xf6ea('0x2e')][_0xf6ea('0x37')]+'%'};return _0x244f06;}})});}_0x402f79=_['merge']({},_0x402f79,_0x681c95[_0xf6ea('0x3a')]);var _0x10f344={'where':_0x402f79['where']};return db[_0xf6ea('0x3b')]['count'](_0x10f344)[_0xf6ea('0x25')](function(_0x484ff3){_0xebd4ea[_0xf6ea('0x1e')]=_0x484ff3;if(_0x681c95[_0xf6ea('0x2e')][_0xf6ea('0x3c')]){_0x402f79[_0xf6ea('0x3d')]=[{'all':!![]}];}return db['VtigerConfiguration']['findAll'](_0x402f79);})['then'](function(_0x56bec8){_0xebd4ea['rows']=_0x56bec8;return _0xebd4ea;})[_0xf6ea('0x25')](respondWithFilteredResult(_0x287059,_0x402f79))['catch'](handleError(_0x287059,null));};exports['show']=function(_0x6c068d,_0x12eea8){var _0x581a48={'raw':![],'where':{'id':_0x6c068d[_0xf6ea('0x3e')]['id']}},_0x308c14={};_0x308c14[_0xf6ea('0x2d')]=_[_0xf6ea('0x3f')](db['VtigerConfiguration'][_0xf6ea('0x40')]);_0x308c14[_0xf6ea('0x2e')]=_[_0xf6ea('0x3f')](_0x6c068d[_0xf6ea('0x2e')]);_0x308c14[_0xf6ea('0x2f')]=_[_0xf6ea('0x30')](_0x308c14[_0xf6ea('0x2d')],_0x308c14[_0xf6ea('0x2e')]);_0x581a48[_0xf6ea('0x31')]=_['intersection'](_0x308c14[_0xf6ea('0x2d')],qs[_0xf6ea('0x32')](_0x6c068d[_0xf6ea('0x2e')][_0xf6ea('0x32')]));_0x581a48[_0xf6ea('0x31')]=_0x581a48[_0xf6ea('0x31')]['length']?_0x581a48['attributes']:_0x308c14[_0xf6ea('0x2d')];if(_0x6c068d['query'][_0xf6ea('0x3c')]){_0x581a48['include']=[{'all':!![]}];}_0x581a48=_[_0xf6ea('0x39')]({},_0x581a48,_0x6c068d[_0xf6ea('0x3a')]);return db[_0xf6ea('0x3b')][_0xf6ea('0x41')](_0x581a48)[_0xf6ea('0x25')](handleEntityNotFound(_0x12eea8,null))[_0xf6ea('0x25')](respondWithResult(_0x12eea8,null))['catch'](handleError(_0x12eea8,null));};exports[_0xf6ea('0x42')]=function(_0x50d78b,_0xab15a){return db[_0xf6ea('0x3b')][_0xf6ea('0x42')](_0x50d78b[_0xf6ea('0x43')],{})[_0xf6ea('0x25')](respondWithResult(_0xab15a,0xc9))[_0xf6ea('0x44')](handleError(_0xab15a,null));};exports['update']=function(_0x1e183f,_0x3d2964){if(_0x1e183f[_0xf6ea('0x43')]['id']){delete _0x1e183f[_0xf6ea('0x43')]['id'];}return db[_0xf6ea('0x3b')][_0xf6ea('0x41')]({'where':{'id':_0x1e183f[_0xf6ea('0x3e')]['id']}})[_0xf6ea('0x25')](handleEntityNotFound(_0x3d2964,null))[_0xf6ea('0x25')](saveUpdates(_0x1e183f[_0xf6ea('0x43')],null))[_0xf6ea('0x25')](respondWithResult(_0x3d2964,null))['catch'](handleError(_0x3d2964,null));};exports[_0xf6ea('0x45')]=function(_0x5913d3,_0x463e70){return db[_0xf6ea('0x3b')][_0xf6ea('0x41')]({'where':{'id':_0x5913d3[_0xf6ea('0x3e')]['id']}})['then'](handleEntityNotFound(_0x463e70,null))[_0xf6ea('0x25')](removeEntity(_0x463e70,null))['catch'](handleError(_0x463e70,null));};exports[_0xf6ea('0x46')]=function(_0x5141b5,_0x38fea2,_0x2c07eb){var _0x4138d4={};var _0x17a19a={};var _0x17644f;var _0x3308b3;return db['VtigerConfiguration'][_0xf6ea('0x47')]({'where':{'id':_0x5141b5['params']['id']}})[_0xf6ea('0x25')](handleEntityNotFound(_0x38fea2,null))[_0xf6ea('0x25')](function(_0x14f64e){if(_0x14f64e){_0x17644f=_0x14f64e;_0x17a19a[_0xf6ea('0x2d')]=_[_0xf6ea('0x3f')](db[_0xf6ea('0x48')][_0xf6ea('0x40')]);_0x17a19a['query']=_[_0xf6ea('0x3f')](_0x5141b5[_0xf6ea('0x2e')]);_0x17a19a['filters']=_[_0xf6ea('0x30')](_0x17a19a[_0xf6ea('0x2d')],_0x17a19a[_0xf6ea('0x2e')]);_0x4138d4['attributes']=_['intersection'](_0x17a19a[_0xf6ea('0x2d')],qs['fields'](_0x5141b5[_0xf6ea('0x2e')][_0xf6ea('0x32')]));_0x4138d4['attributes']=_0x4138d4[_0xf6ea('0x31')][_0xf6ea('0x33')]?_0x4138d4[_0xf6ea('0x31')]:_0x17a19a['model'];_0x4138d4[_0xf6ea('0x49')]=qs[_0xf6ea('0x36')](_0x5141b5[_0xf6ea('0x2e')][_0xf6ea('0x36')]);_0x4138d4[_0xf6ea('0x38')]=qs['filters'](_[_0xf6ea('0x4a')](_0x5141b5['query'],_0x17a19a[_0xf6ea('0x2f')]));if(_0x5141b5[_0xf6ea('0x2e')][_0xf6ea('0x37')]){_0x4138d4[_0xf6ea('0x38')]=_[_0xf6ea('0x39')](_0x4138d4[_0xf6ea('0x38')],{'$or':_[_0xf6ea('0x29')](_0x4138d4['attributes'],function(_0x12ae5a){var _0x8683da={};_0x8683da[_0x12ae5a]={'$like':'%'+_0x5141b5[_0xf6ea('0x2e')]['filter']+'%'};return _0x8683da;})});}_0x4138d4=_['merge']({},_0x4138d4,_0x5141b5['options']);return _0x17644f[_0xf6ea('0x46')](_0x4138d4);}})[_0xf6ea('0x25')](function(_0x45e3f1){if(_0x45e3f1){_0x3308b3=_0x45e3f1[_0xf6ea('0x33')];if(!_0x5141b5['query'][_0xf6ea('0x34')](_0xf6ea('0x35'))){_0x4138d4[_0xf6ea('0x1d')]=qs[_0xf6ea('0x1d')](_0x5141b5[_0xf6ea('0x2e')]['limit']);_0x4138d4[_0xf6ea('0x1b')]=qs[_0xf6ea('0x1b')](_0x5141b5['query'][_0xf6ea('0x1b')]);}return _0x17644f[_0xf6ea('0x46')](_0x4138d4);}})['then'](function(_0x388643){if(_0x388643){return _0x388643?{'count':_0x3308b3,'rows':_0x388643}:null;}})[_0xf6ea('0x25')](respondWithResult(_0x38fea2,null))[_0xf6ea('0x44')](handleError(_0x38fea2,null));};exports[_0xf6ea('0x4b')]=function(_0x305b23,_0x2b4ac8,_0x29fb12){var _0x3afbc8={};var _0x53c8ca={};var _0x446ea0;var _0x136f2b;return db['VtigerConfiguration']['findOne']({'where':{'id':_0x305b23[_0xf6ea('0x3e')]['id']}})[_0xf6ea('0x25')](handleEntityNotFound(_0x2b4ac8,null))[_0xf6ea('0x25')](function(_0x8853d8){if(_0x8853d8){_0x446ea0=_0x8853d8;_0x53c8ca['model']=_[_0xf6ea('0x3f')](db[_0xf6ea('0x48')][_0xf6ea('0x40')]);_0x53c8ca['query']=_[_0xf6ea('0x3f')](_0x305b23['query']);_0x53c8ca['filters']=_['intersection'](_0x53c8ca['model'],_0x53c8ca[_0xf6ea('0x2e')]);_0x3afbc8['attributes']=_[_0xf6ea('0x30')](_0x53c8ca[_0xf6ea('0x2d')],qs[_0xf6ea('0x32')](_0x305b23[_0xf6ea('0x2e')][_0xf6ea('0x32')]));_0x3afbc8[_0xf6ea('0x31')]=_0x3afbc8[_0xf6ea('0x31')]['length']?_0x3afbc8[_0xf6ea('0x31')]:_0x53c8ca[_0xf6ea('0x2d')];_0x3afbc8[_0xf6ea('0x49')]=qs[_0xf6ea('0x36')](_0x305b23['query'][_0xf6ea('0x36')]);_0x3afbc8[_0xf6ea('0x38')]=qs['filters'](_[_0xf6ea('0x4a')](_0x305b23[_0xf6ea('0x2e')],_0x53c8ca[_0xf6ea('0x2f')]));if(_0x305b23[_0xf6ea('0x2e')]['filter']){_0x3afbc8['where']=_[_0xf6ea('0x39')](_0x3afbc8[_0xf6ea('0x38')],{'$or':_[_0xf6ea('0x29')](_0x3afbc8[_0xf6ea('0x31')],function(_0x3d5c58){var _0x19e833={};_0x19e833[_0x3d5c58]={'$like':'%'+_0x305b23[_0xf6ea('0x2e')][_0xf6ea('0x37')]+'%'};return _0x19e833;})});}_0x3afbc8=_[_0xf6ea('0x39')]({},_0x3afbc8,_0x305b23['options']);return _0x446ea0[_0xf6ea('0x4b')](_0x3afbc8);}})['then'](function(_0x1760a7){if(_0x1760a7){_0x136f2b=_0x1760a7[_0xf6ea('0x33')];if(!_0x305b23[_0xf6ea('0x2e')][_0xf6ea('0x34')](_0xf6ea('0x35'))){_0x3afbc8[_0xf6ea('0x1d')]=qs[_0xf6ea('0x1d')](_0x305b23[_0xf6ea('0x2e')][_0xf6ea('0x1d')]);_0x3afbc8[_0xf6ea('0x1b')]=qs[_0xf6ea('0x1b')](_0x305b23[_0xf6ea('0x2e')][_0xf6ea('0x1b')]);}return _0x446ea0[_0xf6ea('0x4b')](_0x3afbc8);}})['then'](function(_0x103683){if(_0x103683){return _0x103683?{'count':_0x136f2b,'rows':_0x103683}:null;}})[_0xf6ea('0x25')](respondWithResult(_0x2b4ac8,null))['catch'](handleError(_0x2b4ac8,null));};exports[_0xf6ea('0x4c')]=function(_0x5b1ce6,_0x45d494,_0x9902ae){var _0xc05429={};var _0x32ee01={};var _0x3fa292;var _0x370d64;return db[_0xf6ea('0x3b')][_0xf6ea('0x47')]({'where':{'id':_0x5b1ce6[_0xf6ea('0x3e')]['id']}})[_0xf6ea('0x25')](handleEntityNotFound(_0x45d494,null))[_0xf6ea('0x25')](function(_0x2ab4f5){if(_0x2ab4f5){_0x3fa292=_0x2ab4f5;_0x32ee01['model']=_['keys'](db[_0xf6ea('0x48')]['rawAttributes']);_0x32ee01[_0xf6ea('0x2e')]=_[_0xf6ea('0x3f')](_0x5b1ce6[_0xf6ea('0x2e')]);_0x32ee01['filters']=_[_0xf6ea('0x30')](_0x32ee01[_0xf6ea('0x2d')],_0x32ee01['query']);_0xc05429['attributes']=_[_0xf6ea('0x30')](_0x32ee01[_0xf6ea('0x2d')],qs[_0xf6ea('0x32')](_0x5b1ce6[_0xf6ea('0x2e')][_0xf6ea('0x32')]));_0xc05429['attributes']=_0xc05429[_0xf6ea('0x31')]['length']?_0xc05429[_0xf6ea('0x31')]:_0x32ee01[_0xf6ea('0x2d')];_0xc05429[_0xf6ea('0x49')]=qs[_0xf6ea('0x36')](_0x5b1ce6[_0xf6ea('0x2e')][_0xf6ea('0x36')]);_0xc05429[_0xf6ea('0x38')]=qs[_0xf6ea('0x2f')](_[_0xf6ea('0x4a')](_0x5b1ce6[_0xf6ea('0x2e')],_0x32ee01['filters']));if(_0x5b1ce6['query']['filter']){_0xc05429[_0xf6ea('0x38')]=_['merge'](_0xc05429[_0xf6ea('0x38')],{'$or':_[_0xf6ea('0x29')](_0xc05429[_0xf6ea('0x31')],function(_0x24ce7a){var _0x5f9eb6={};_0x5f9eb6[_0x24ce7a]={'$like':'%'+_0x5b1ce6[_0xf6ea('0x2e')]['filter']+'%'};return _0x5f9eb6;})});}_0xc05429=_[_0xf6ea('0x39')]({},_0xc05429,_0x5b1ce6[_0xf6ea('0x3a')]);return _0x3fa292[_0xf6ea('0x4c')](_0xc05429);}})['then'](function(_0xb47935){if(_0xb47935){_0x370d64=_0xb47935['length'];if(!_0x5b1ce6['query']['hasOwnProperty'](_0xf6ea('0x35'))){_0xc05429[_0xf6ea('0x1d')]=qs['limit'](_0x5b1ce6[_0xf6ea('0x2e')][_0xf6ea('0x1d')]);_0xc05429[_0xf6ea('0x1b')]=qs[_0xf6ea('0x1b')](_0x5b1ce6['query'][_0xf6ea('0x1b')]);}return _0x3fa292[_0xf6ea('0x4c')](_0xc05429);}})[_0xf6ea('0x25')](function(_0x1846e4){if(_0x1846e4){return _0x1846e4?{'count':_0x370d64,'rows':_0x1846e4}:null;}})[_0xf6ea('0x25')](respondWithResult(_0x45d494,null))[_0xf6ea('0x44')](handleError(_0x45d494,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index b325eb0..9c8a738 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 _0xd695=['api','moment','bluebird','request-promise','rimraf','../../config/environment','define','int_vtiger_configurations','lodash','util','../../config/logger'];(function(_0x5ee504,_0x4487fc){var _0x81b927=function(_0x442b76){while(--_0x442b76){_0x5ee504['push'](_0x5ee504['shift']());}};_0x81b927(++_0x4487fc);}(_0xd695,0x1ec));var _0x5d69=function(_0x3b3f4f,_0x403216){_0x3b3f4f=_0x3b3f4f-0x0;var _0x174dbe=_0xd695[_0x3b3f4f];return _0x174dbe;};'use strict';var _=require(_0x5d69('0x0'));var util=require(_0x5d69('0x1'));var logger=require(_0x5d69('0x2'))(_0x5d69('0x3'));var moment=require(_0x5d69('0x4'));var BPromise=require(_0x5d69('0x5'));var rp=require(_0x5d69('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5d69('0x7'));var config=require(_0x5d69('0x8'));var attributes=require('./intVtigerConfiguration.attributes');module['exports']=function(_0x2f7a9c,_0x52d0d9){return _0x2f7a9c[_0x5d69('0x9')]('VtigerConfiguration',attributes,{'tableName':_0x5d69('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x842e=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./intVtigerConfiguration.attributes','exports','VtigerConfiguration','lodash','util'];(function(_0x313e3d,_0x2d149f){var _0x3989d0=function(_0x91af6a){while(--_0x91af6a){_0x313e3d['push'](_0x313e3d['shift']());}};_0x3989d0(++_0x2d149f);}(_0x842e,0x111));var _0xe842=function(_0x874a49,_0x5b07bc){_0x874a49=_0x874a49-0x0;var _0x343d2f=_0x842e[_0x874a49];return _0x343d2f;};'use strict';var _=require(_0xe842('0x0'));var util=require(_0xe842('0x1'));var logger=require('../../config/logger')(_0xe842('0x2'));var moment=require(_0xe842('0x3'));var BPromise=require(_0xe842('0x4'));var rp=require(_0xe842('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe842('0x6'));var config=require(_0xe842('0x7'));var attributes=require(_0xe842('0x8'));module[_0xe842('0x9')]=function(_0x2ab5a4,_0x15abf0){return _0x2ab5a4['define'](_0xe842('0xa'),attributes,{'tableName':'int_vtiger_configurations','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 77ed567..ee07a46 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 _0x5cef=['../../config/logger','rpc','client','http','then','info','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','VtigerConfiguration,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x47071d,_0x337966){var _0x16ee20=function(_0x3c4075){while(--_0x3c4075){_0x47071d['push'](_0x47071d['shift']());}};_0x16ee20(++_0x337966);}(_0x5cef,0x1dc));var _0xf5ce=function(_0x595c38,_0x36d27a){_0x595c38=_0x595c38-0x0;var _0x22725f=_0x5cef[_0x595c38];return _0x22725f;};'use strict';var _=require(_0xf5ce('0x0'));var util=require(_0xf5ce('0x1'));var moment=require(_0xf5ce('0x2'));var BPromise=require(_0xf5ce('0x3'));var rs=require(_0xf5ce('0x4'));var fs=require('fs');var Redis=require(_0xf5ce('0x5'));var db=require(_0xf5ce('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xf5ce('0x7'))(_0xf5ce('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xf5ce('0x9')][_0xf5ce('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x488484,_0xb061c8,_0x2e020b){return new BPromise(function(_0x21211f,_0x2b7b32){return client['request'](_0x488484,_0x2e020b)[_0xf5ce('0xb')](function(_0x1ea863){logger[_0xf5ce('0xc')]('VtigerConfiguration,\x20%s,\x20%s',_0xb061c8,_0xf5ce('0xd'));logger[_0xf5ce('0xe')](_0xf5ce('0xf'),_0xb061c8,_0xf5ce('0xd'),JSON[_0xf5ce('0x10')](_0x1ea863));if(_0x1ea863[_0xf5ce('0x11')]){if(_0x1ea863[_0xf5ce('0x11')]['code']===0x1f4){logger['error'](_0xf5ce('0x12'),_0xb061c8,_0x1ea863['error'][_0xf5ce('0x13')]);return _0x2b7b32(_0x1ea863['error'][_0xf5ce('0x13')]);}logger['error']('VtigerConfiguration,\x20%s,\x20%s',_0xb061c8,_0x1ea863[_0xf5ce('0x11')][_0xf5ce('0x13')]);return _0x21211f(_0x1ea863[_0xf5ce('0x11')][_0xf5ce('0x13')]);}else{logger[_0xf5ce('0xc')](_0xf5ce('0x12'),_0xb061c8,_0xf5ce('0xd'));_0x21211f(_0x1ea863['result']['message']);}})[_0xf5ce('0x14')](function(_0x1af59f){logger[_0xf5ce('0x11')]('VtigerConfiguration,\x20%s,\x20%s',_0xb061c8,_0x1af59f);_0x2b7b32(_0x1af59f);});});} \ No newline at end of file +var _0xb98d=['lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','VtigerConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','VtigerConfiguration,\x20%s,\x20%s','message','info','result','catch'];(function(_0x34644e,_0x2d92d0){var _0x2e5698=function(_0x4c900f){while(--_0x4c900f){_0x34644e['push'](_0x34644e['shift']());}};_0x2e5698(++_0x2d92d0);}(_0xb98d,0xc6));var _0xdb98=function(_0xf008da,_0x395d94){_0xf008da=_0xf008da-0x0;var _0x2e0b55=_0xb98d[_0xf008da];return _0x2e0b55;};'use strict';var _=require(_0xdb98('0x0'));var util=require(_0xdb98('0x1'));var moment=require(_0xdb98('0x2'));var BPromise=require('bluebird');var rs=require(_0xdb98('0x3'));var fs=require('fs');var Redis=require(_0xdb98('0x4'));var db=require(_0xdb98('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xdb98('0x6'))(_0xdb98('0x7'));var config=require(_0xdb98('0x8'));var jayson=require(_0xdb98('0x9'));var client=jayson['client'][_0xdb98('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2a8a96,_0x3b8c9f,_0x294531){return new BPromise(function(_0x27c2f7,_0xf6f5fe){return client[_0xdb98('0xb')](_0x2a8a96,_0x294531)[_0xdb98('0xc')](function(_0x5a5b5a){logger['info']('VtigerConfiguration,\x20%s,\x20%s',_0x3b8c9f,'request\x20sent');logger['debug'](_0xdb98('0xd'),_0x3b8c9f,_0xdb98('0xe'),JSON[_0xdb98('0xf')](_0x5a5b5a));if(_0x5a5b5a[_0xdb98('0x10')]){if(_0x5a5b5a[_0xdb98('0x10')]['code']===0x1f4){logger[_0xdb98('0x10')](_0xdb98('0x11'),_0x3b8c9f,_0x5a5b5a['error'][_0xdb98('0x12')]);return _0xf6f5fe(_0x5a5b5a[_0xdb98('0x10')][_0xdb98('0x12')]);}logger[_0xdb98('0x10')](_0xdb98('0x11'),_0x3b8c9f,_0x5a5b5a[_0xdb98('0x10')][_0xdb98('0x12')]);return _0x27c2f7(_0x5a5b5a[_0xdb98('0x10')]['message']);}else{logger[_0xdb98('0x13')](_0xdb98('0x11'),_0x3b8c9f,_0xdb98('0xe'));_0x27c2f7(_0x5a5b5a[_0xdb98('0x14')]['message']);}})[_0xdb98('0x15')](function(_0x1c5472){logger[_0xdb98('0x10')]('VtigerConfiguration,\x20%s,\x20%s',_0x3b8c9f,_0x1c5472);_0xf6f5fe(_0x1c5472);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index ed5e376..61607df 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 _0x6085=['update','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intVtigerField.controller','get','/:id','isAuthenticated','show','post','create','put'];(function(_0x22173e,_0x4732dd){var _0x1a0b7a=function(_0x5a6447){while(--_0x5a6447){_0x22173e['push'](_0x22173e['shift']());}};_0x1a0b7a(++_0x4732dd);}(_0x6085,0xd4));var _0x5608=function(_0x78b208,_0x24aa3c){_0x78b208=_0x78b208-0x0;var _0x2faab0=_0x6085[_0x78b208];return _0x2faab0;};'use strict';var multer=require(_0x5608('0x0'));var util=require(_0x5608('0x1'));var path=require('path');var timeout=require(_0x5608('0x2'));var express=require(_0x5608('0x3'));var router=express[_0x5608('0x4')]();var fs_extra=require(_0x5608('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x5608('0x6'));var config=require(_0x5608('0x7'));var controller=require(_0x5608('0x8'));router[_0x5608('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x5608('0x9')](_0x5608('0xa'),auth[_0x5608('0xb')](),controller[_0x5608('0xc')]);router[_0x5608('0xd')]('/',auth[_0x5608('0xb')](),controller[_0x5608('0xe')]);router[_0x5608('0xf')](_0x5608('0xa'),auth[_0x5608('0xb')](),controller[_0x5608('0x10')]);router['delete'](_0x5608('0xa'),auth[_0x5608('0xb')](),controller[_0x5608('0x11')]);module[_0x5608('0x12')]=router; \ No newline at end of file +var _0x46e0=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerField.controller','get','index','/:id','isAuthenticated','create','put','update','delete','destroy','exports','util'];(function(_0x58375b,_0x58fdf){var _0x3656c0=function(_0x11a1a5){while(--_0x11a1a5){_0x58375b['push'](_0x58375b['shift']());}};_0x3656c0(++_0x58fdf);}(_0x46e0,0xc5));var _0x046e=function(_0x5f400d,_0x46a384){_0x5f400d=_0x5f400d-0x0;var _0x540b1b=_0x46e0[_0x5f400d];return _0x540b1b;};'use strict';var multer=require('multer');var util=require(_0x046e('0x0'));var path=require('path');var timeout=require(_0x046e('0x1'));var express=require('express');var router=express[_0x046e('0x2')]();var fs_extra=require(_0x046e('0x3'));var auth=require(_0x046e('0x4'));var interaction=require(_0x046e('0x5'));var config=require(_0x046e('0x6'));var controller=require(_0x046e('0x7'));router[_0x046e('0x8')]('/',auth['isAuthenticated'](),controller[_0x046e('0x9')]);router[_0x046e('0x8')](_0x046e('0xa'),auth[_0x046e('0xb')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x046e('0xc')]);router[_0x046e('0xd')](_0x046e('0xa'),auth[_0x046e('0xb')](),controller[_0x046e('0xe')]);router[_0x046e('0xf')](_0x046e('0xa'),auth['isAuthenticated'](),controller[_0x046e('0x10')]);module[_0x046e('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 7102a4b..3eddf17 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 _0x133a=['customVariable','keyValue','STRING','BOOLEAN','sequelize','exports','ENUM','string','variable'];(function(_0x3226aa,_0x10e43e){var _0x16a6cb=function(_0x58c87c){while(--_0x58c87c){_0x3226aa['push'](_0x3226aa['shift']());}};_0x16a6cb(++_0x10e43e);}(_0x133a,0xb8));var _0xa133=function(_0x90f34f,_0x404021){_0x90f34f=_0x90f34f-0x0;var _0x4b18cf=_0x133a[_0x90f34f];return _0x4b18cf;};'use strict';var Sequelize=require(_0xa133('0x0'));module[_0xa133('0x1')]={'type':{'type':Sequelize[_0xa133('0x2')](_0xa133('0x3'),_0xa133('0x4'),_0xa133('0x5'),_0xa133('0x6'),'picklist'),'defaultValue':_0xa133('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0xa133('0x3'),_0xa133('0x4'),_0xa133('0x5'))},'keyContent':{'type':Sequelize[_0xa133('0x7')]},'idField':{'type':Sequelize[_0xa133('0x7')]},'nameField':{'type':Sequelize[_0xa133('0x7')]},'customField':{'type':Sequelize[_0xa133('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xa133('0x7')]}}; \ No newline at end of file +var _0xc731=['variable','keyValue','picklist','STRING','customVariable','sequelize','exports','ENUM','string'];(function(_0x2ac530,_0xd035a9){var _0x4ee546=function(_0x3fa318){while(--_0x3fa318){_0x2ac530['push'](_0x2ac530['shift']());}};_0x4ee546(++_0xd035a9);}(_0xc731,0x191));var _0x1c73=function(_0x5451dd,_0x2a2710){_0x5451dd=_0x5451dd-0x0;var _0x3158b6=_0xc731[_0x5451dd];return _0x3158b6;};'use strict';var Sequelize=require(_0x1c73('0x0'));module[_0x1c73('0x1')]={'type':{'type':Sequelize[_0x1c73('0x2')](_0x1c73('0x3'),_0x1c73('0x4'),'customVariable',_0x1c73('0x5'),_0x1c73('0x6')),'defaultValue':_0x1c73('0x3')},'content':{'type':Sequelize[_0x1c73('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x1c73('0x2')](_0x1c73('0x3'),'variable',_0x1c73('0x8'))},'keyContent':{'type':Sequelize[_0x1c73('0x7')]},'idField':{'type':Sequelize[_0x1c73('0x7')]},'nameField':{'type':Sequelize[_0x1c73('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x1c73('0x7')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 5c168e6..bef43c5 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 _0xcd56=['limit','count','set','apply','reject','update','then','destroy','error','name','index','map','VtigerField','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','VIRTUAL','merge','includeAll','include','rows','catch','show','rawAttributes','options','create','body','find','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined'];(function(_0x45da62,_0x4ef271){var _0x58f420=function(_0x2b0483){while(--_0x2b0483){_0x45da62['push'](_0x45da62['shift']());}};_0x58f420(++_0x4ef271);}(_0xcd56,0x70));var _0x6cd5=function(_0x58837f,_0x3ff290){_0x58837f=_0x58837f-0x0;var _0x46a870=_0xcd56[_0x58837f];return _0x46a870;};'use strict';var emlformat=require(_0x6cd5('0x0'));var rimraf=require(_0x6cd5('0x1'));var zipdir=require(_0x6cd5('0x2'));var jsonpatch=require(_0x6cd5('0x3'));var rp=require(_0x6cd5('0x4'));var moment=require(_0x6cd5('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x6cd5('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x6cd5('0x7'));var ejs=require(_0x6cd5('0x8'));var fs=require('fs');var fs_extra=require(_0x6cd5('0x9'));var _=require(_0x6cd5('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x6cd5('0xb'));var deskjs=require(_0x6cd5('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x6cd5('0xd'));var Redis=require(_0x6cd5('0xe'));var authService=require(_0x6cd5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x6cd5('0x10'));var hardwareService=require(_0x6cd5('0x11'));var logger=require('../../config/logger')(_0x6cd5('0x12'));var utils=require('../../config/utils');var config=require(_0x6cd5('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x6cd5('0x14'))['db'];function respondWithStatusCode(_0x2e9c58,_0x2c2944){_0x2c2944=_0x2c2944||0xcc;return function(_0x5b5fa6){if(_0x5b5fa6){return _0x2e9c58[_0x6cd5('0x15')](_0x2c2944);}return _0x2e9c58[_0x6cd5('0x16')](_0x2c2944)[_0x6cd5('0x17')]();};}function respondWithResult(_0x2315bc,_0x5c3644){_0x5c3644=_0x5c3644||0xc8;return function(_0x1094b2){if(_0x1094b2){return _0x2315bc[_0x6cd5('0x16')](_0x5c3644)['json'](_0x1094b2);}};}function respondWithFilteredResult(_0x2da6d3,_0x401efa){return function(_0x1149da){if(_0x1149da){var _0x360bb0=typeof _0x401efa[_0x6cd5('0x18')]===_0x6cd5('0x19')&&typeof _0x401efa[_0x6cd5('0x1a')]===_0x6cd5('0x19');var _0x7dedfb=_0x1149da[_0x6cd5('0x1b')];var _0x3437a1=_0x360bb0?0x0:_0x401efa[_0x6cd5('0x18')];var _0xfc36d2=_0x360bb0?_0x1149da[_0x6cd5('0x1b')]:_0x401efa[_0x6cd5('0x18')]+_0x401efa[_0x6cd5('0x1a')];var _0x438b62;if(_0xfc36d2>=_0x7dedfb){_0xfc36d2=_0x7dedfb;_0x438b62=0xc8;}else{_0x438b62=0xce;}_0x2da6d3['status'](_0x438b62);return _0x2da6d3[_0x6cd5('0x1c')]('Content-Range',_0x3437a1+'-'+_0xfc36d2+'/'+_0x7dedfb)['json'](_0x1149da);}return null;};}function patchUpdates(_0x486978){return function(_0x1804ba){try{jsonpatch[_0x6cd5('0x1d')](_0x1804ba,_0x486978,!![]);}catch(_0x156250){return BPromise[_0x6cd5('0x1e')](_0x156250);}return _0x1804ba['save']();};}function saveUpdates(_0x5aca29,_0xb06159){return function(_0x484cf8){if(_0x484cf8){return _0x484cf8[_0x6cd5('0x1f')](_0x5aca29)[_0x6cd5('0x20')](function(_0x42a81f){return _0x42a81f;});}return null;};}function removeEntity(_0x1169c8,_0x4a106d){return function(_0x1b9d02){if(_0x1b9d02){return _0x1b9d02[_0x6cd5('0x21')]()[_0x6cd5('0x20')](function(){_0x1169c8[_0x6cd5('0x16')](0xcc)[_0x6cd5('0x17')]();});}};}function handleEntityNotFound(_0x37511e,_0x5a35ee){return function(_0x3e8513){if(!_0x3e8513){_0x37511e[_0x6cd5('0x15')](0x194);}return _0x3e8513;};}function handleError(_0x52e812,_0x4d1a0d){_0x4d1a0d=_0x4d1a0d||0x1f4;return function(_0x4630c8){logger[_0x6cd5('0x22')](_0x4630c8['stack']);if(_0x4630c8[_0x6cd5('0x23')]){delete _0x4630c8['name'];}_0x52e812[_0x6cd5('0x16')](_0x4d1a0d)['send'](_0x4630c8);};}exports[_0x6cd5('0x24')]=function(_0x52344c,_0x32ff66){var _0x6b8273={},_0x3209bb={},_0x4e2469={'count':0x0,'rows':[]};var _0x4138a4=_[_0x6cd5('0x25')](db[_0x6cd5('0x26')]['rawAttributes'],function(_0x2cff30){return{'name':_0x2cff30[_0x6cd5('0x27')],'type':_0x2cff30[_0x6cd5('0x28')][_0x6cd5('0x29')]};});_0x3209bb['model']=_[_0x6cd5('0x25')](_0x4138a4,_0x6cd5('0x23'));_0x3209bb['query']=_[_0x6cd5('0x2a')](_0x52344c[_0x6cd5('0x2b')]);_0x3209bb[_0x6cd5('0x2c')]=_[_0x6cd5('0x2d')](_0x3209bb[_0x6cd5('0x2e')],_0x3209bb['query']);_0x6b8273[_0x6cd5('0x2f')]=_[_0x6cd5('0x2d')](_0x3209bb[_0x6cd5('0x2e')],qs[_0x6cd5('0x30')](_0x52344c[_0x6cd5('0x2b')][_0x6cd5('0x30')]));_0x6b8273[_0x6cd5('0x2f')]=_0x6b8273[_0x6cd5('0x2f')][_0x6cd5('0x31')]?_0x6b8273[_0x6cd5('0x2f')]:_0x3209bb[_0x6cd5('0x2e')];if(!_0x52344c[_0x6cd5('0x2b')][_0x6cd5('0x32')](_0x6cd5('0x33'))){_0x6b8273[_0x6cd5('0x1a')]=qs[_0x6cd5('0x1a')](_0x52344c[_0x6cd5('0x2b')][_0x6cd5('0x1a')]);_0x6b8273[_0x6cd5('0x18')]=qs[_0x6cd5('0x18')](_0x52344c[_0x6cd5('0x2b')][_0x6cd5('0x18')]);}_0x6b8273[_0x6cd5('0x34')]=qs['sort'](_0x52344c['query'][_0x6cd5('0x35')]);_0x6b8273['where']=qs[_0x6cd5('0x2c')](_['pick'](_0x52344c[_0x6cd5('0x2b')],_0x3209bb['filters']),_0x4138a4);if(_0x52344c[_0x6cd5('0x2b')][_0x6cd5('0x36')]){_0x6b8273[_0x6cd5('0x37')]=_['merge'](_0x6b8273[_0x6cd5('0x37')],{'$or':_[_0x6cd5('0x25')](_0x4138a4,function(_0x1f9751){if(_0x1f9751[_0x6cd5('0x28')]!==_0x6cd5('0x38')){var _0x46176f={};_0x46176f[_0x1f9751[_0x6cd5('0x23')]]={'$like':'%'+_0x52344c['query'][_0x6cd5('0x36')]+'%'};return _0x46176f;}})});}_0x6b8273=_[_0x6cd5('0x39')]({},_0x6b8273,_0x52344c['options']);var _0x1cf668={'where':_0x6b8273[_0x6cd5('0x37')]};return db['VtigerField']['count'](_0x1cf668)[_0x6cd5('0x20')](function(_0x319355){_0x4e2469[_0x6cd5('0x1b')]=_0x319355;if(_0x52344c['query'][_0x6cd5('0x3a')]){_0x6b8273[_0x6cd5('0x3b')]=[{'all':!![]}];}return db['VtigerField']['findAll'](_0x6b8273);})['then'](function(_0x344e71){_0x4e2469[_0x6cd5('0x3c')]=_0x344e71;return _0x4e2469;})[_0x6cd5('0x20')](respondWithFilteredResult(_0x32ff66,_0x6b8273))[_0x6cd5('0x3d')](handleError(_0x32ff66,null));};exports[_0x6cd5('0x3e')]=function(_0x165aa6,_0x42d0af){var _0x4bc58e={'raw':!![],'where':{'id':_0x165aa6['params']['id']}},_0x40fd4d={};_0x40fd4d[_0x6cd5('0x2e')]=_[_0x6cd5('0x2a')](db[_0x6cd5('0x26')][_0x6cd5('0x3f')]);_0x40fd4d[_0x6cd5('0x2b')]=_[_0x6cd5('0x2a')](_0x165aa6[_0x6cd5('0x2b')]);_0x40fd4d[_0x6cd5('0x2c')]=_[_0x6cd5('0x2d')](_0x40fd4d['model'],_0x40fd4d[_0x6cd5('0x2b')]);_0x4bc58e['attributes']=_[_0x6cd5('0x2d')](_0x40fd4d[_0x6cd5('0x2e')],qs['fields'](_0x165aa6[_0x6cd5('0x2b')][_0x6cd5('0x30')]));_0x4bc58e[_0x6cd5('0x2f')]=_0x4bc58e[_0x6cd5('0x2f')][_0x6cd5('0x31')]?_0x4bc58e[_0x6cd5('0x2f')]:_0x40fd4d['model'];if(_0x165aa6['query']['includeAll']){_0x4bc58e['include']=[{'all':!![]}];}_0x4bc58e=_[_0x6cd5('0x39')]({},_0x4bc58e,_0x165aa6[_0x6cd5('0x40')]);return db[_0x6cd5('0x26')]['find'](_0x4bc58e)[_0x6cd5('0x20')](handleEntityNotFound(_0x42d0af,null))['then'](respondWithResult(_0x42d0af,null))[_0x6cd5('0x3d')](handleError(_0x42d0af,null));};exports[_0x6cd5('0x41')]=function(_0x2f8618,_0x4c6138){return db['VtigerField']['create'](_0x2f8618[_0x6cd5('0x42')],{})[_0x6cd5('0x20')](respondWithResult(_0x4c6138,0xc9))['catch'](handleError(_0x4c6138,null));};exports[_0x6cd5('0x1f')]=function(_0x627df8,_0x3e92ed){if(_0x627df8[_0x6cd5('0x42')]['id']){delete _0x627df8[_0x6cd5('0x42')]['id'];}return db['VtigerField'][_0x6cd5('0x43')]({'where':{'id':_0x627df8[_0x6cd5('0x44')]['id']}})['then'](handleEntityNotFound(_0x3e92ed,null))['then'](saveUpdates(_0x627df8['body'],null))[_0x6cd5('0x20')](respondWithResult(_0x3e92ed,null))[_0x6cd5('0x3d')](handleError(_0x3e92ed,null));};exports[_0x6cd5('0x21')]=function(_0x7b588f,_0x355aba){return db[_0x6cd5('0x26')][_0x6cd5('0x43')]({'where':{'id':_0x7b588f[_0x6cd5('0x44')]['id']}})[_0x6cd5('0x20')](handleEntityNotFound(_0x355aba,null))[_0x6cd5('0x20')](removeEntity(_0x355aba,null))[_0x6cd5('0x3d')](handleError(_0x355aba,null));}; \ No newline at end of file +var _0xa91d=['apply','reject','update','destroy','error','stack','name','send','index','map','VtigerField','rawAttributes','type','key','model','keys','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','then','rows','catch','show','params','include','find','create','body','eml-format','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','sendStatus','status','end','json','offset','undefined','count','limit','set'];(function(_0x940220,_0x4824b8){var _0x20a601=function(_0x16526e){while(--_0x16526e){_0x940220['push'](_0x940220['shift']());}};_0x20a601(++_0x4824b8);}(_0xa91d,0x149));var _0xda91=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xa91d[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0xda91('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xda91('0x1'));var rp=require('request-promise');var moment=require(_0xda91('0x2'));var BPromise=require(_0xda91('0x3'));var Mustache=require(_0xda91('0x4'));var util=require(_0xda91('0x5'));var path=require(_0xda91('0x6'));var sox=require(_0xda91('0x7'));var csv=require(_0xda91('0x8'));var ejs=require(_0xda91('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xda91('0xa'));var squel=require(_0xda91('0xb'));var crypto=require(_0xda91('0xc'));var jsforce=require(_0xda91('0xd'));var deskjs=require(_0xda91('0xe'));var toCsv=require(_0xda91('0x8'));var querystring=require(_0xda91('0xf'));var Papa=require('papaparse');var Redis=require(_0xda91('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xda91('0x11'));var as=require(_0xda91('0x12'));var hardwareService=require(_0xda91('0x13'));var logger=require('../../config/logger')(_0xda91('0x14'));var utils=require('../../config/utils');var config=require(_0xda91('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x356fa0,_0x3021fc){_0x3021fc=_0x3021fc||0xcc;return function(_0xebad84){if(_0xebad84){return _0x356fa0[_0xda91('0x16')](_0x3021fc);}return _0x356fa0[_0xda91('0x17')](_0x3021fc)[_0xda91('0x18')]();};}function respondWithResult(_0x532508,_0x7f49ad){_0x7f49ad=_0x7f49ad||0xc8;return function(_0x17eac2){if(_0x17eac2){return _0x532508[_0xda91('0x17')](_0x7f49ad)[_0xda91('0x19')](_0x17eac2);}};}function respondWithFilteredResult(_0x216683,_0x4e220d){return function(_0x215a22){if(_0x215a22){var _0xe453de=typeof _0x4e220d[_0xda91('0x1a')]===_0xda91('0x1b')&&typeof _0x4e220d['limit']===_0xda91('0x1b');var _0x2316c8=_0x215a22[_0xda91('0x1c')];var _0x2c3569=_0xe453de?0x0:_0x4e220d[_0xda91('0x1a')];var _0x190e3b=_0xe453de?_0x215a22[_0xda91('0x1c')]:_0x4e220d[_0xda91('0x1a')]+_0x4e220d[_0xda91('0x1d')];var _0x49a82a;if(_0x190e3b>=_0x2316c8){_0x190e3b=_0x2316c8;_0x49a82a=0xc8;}else{_0x49a82a=0xce;}_0x216683[_0xda91('0x17')](_0x49a82a);return _0x216683[_0xda91('0x1e')]('Content-Range',_0x2c3569+'-'+_0x190e3b+'/'+_0x2316c8)[_0xda91('0x19')](_0x215a22);}return null;};}function patchUpdates(_0x1076bd){return function(_0x10b339){try{jsonpatch[_0xda91('0x1f')](_0x10b339,_0x1076bd,!![]);}catch(_0x5bfbd3){return BPromise[_0xda91('0x20')](_0x5bfbd3);}return _0x10b339['save']();};}function saveUpdates(_0x2856e5,_0x3ed96b){return function(_0x55324f){if(_0x55324f){return _0x55324f[_0xda91('0x21')](_0x2856e5)['then'](function(_0x2427f8){return _0x2427f8;});}return null;};}function removeEntity(_0x277ec9,_0x23178e){return function(_0xb4ae93){if(_0xb4ae93){return _0xb4ae93[_0xda91('0x22')]()['then'](function(){_0x277ec9[_0xda91('0x17')](0xcc)[_0xda91('0x18')]();});}};}function handleEntityNotFound(_0x3ed0d2,_0x57533e){return function(_0x993667){if(!_0x993667){_0x3ed0d2['sendStatus'](0x194);}return _0x993667;};}function handleError(_0x3b712b,_0x637ee9){_0x637ee9=_0x637ee9||0x1f4;return function(_0x4cf4f1){logger[_0xda91('0x23')](_0x4cf4f1[_0xda91('0x24')]);if(_0x4cf4f1[_0xda91('0x25')]){delete _0x4cf4f1['name'];}_0x3b712b['status'](_0x637ee9)[_0xda91('0x26')](_0x4cf4f1);};}exports[_0xda91('0x27')]=function(_0x279782,_0x260391){var _0x1d8d6c={},_0x29e6f6={},_0x7b8d86={'count':0x0,'rows':[]};var _0x465303=_[_0xda91('0x28')](db[_0xda91('0x29')][_0xda91('0x2a')],function(_0x9bc469){return{'name':_0x9bc469['fieldName'],'type':_0x9bc469[_0xda91('0x2b')][_0xda91('0x2c')]};});_0x29e6f6[_0xda91('0x2d')]=_[_0xda91('0x28')](_0x465303,_0xda91('0x25'));_0x29e6f6['query']=_[_0xda91('0x2e')](_0x279782[_0xda91('0x2f')]);_0x29e6f6['filters']=_['intersection'](_0x29e6f6[_0xda91('0x2d')],_0x29e6f6['query']);_0x1d8d6c[_0xda91('0x30')]=_[_0xda91('0x31')](_0x29e6f6[_0xda91('0x2d')],qs['fields'](_0x279782['query'][_0xda91('0x32')]));_0x1d8d6c[_0xda91('0x30')]=_0x1d8d6c[_0xda91('0x30')][_0xda91('0x33')]?_0x1d8d6c['attributes']:_0x29e6f6['model'];if(!_0x279782[_0xda91('0x2f')][_0xda91('0x34')](_0xda91('0x35'))){_0x1d8d6c['limit']=qs[_0xda91('0x1d')](_0x279782[_0xda91('0x2f')][_0xda91('0x1d')]);_0x1d8d6c[_0xda91('0x1a')]=qs[_0xda91('0x1a')](_0x279782['query']['offset']);}_0x1d8d6c[_0xda91('0x36')]=qs['sort'](_0x279782['query'][_0xda91('0x37')]);_0x1d8d6c[_0xda91('0x38')]=qs[_0xda91('0x39')](_[_0xda91('0x3a')](_0x279782[_0xda91('0x2f')],_0x29e6f6[_0xda91('0x39')]),_0x465303);if(_0x279782[_0xda91('0x2f')][_0xda91('0x3b')]){_0x1d8d6c['where']=_[_0xda91('0x3c')](_0x1d8d6c['where'],{'$or':_[_0xda91('0x28')](_0x465303,function(_0xc14512){if(_0xc14512['type']!==_0xda91('0x3d')){var _0x1c0fed={};_0x1c0fed[_0xc14512[_0xda91('0x25')]]={'$like':'%'+_0x279782[_0xda91('0x2f')][_0xda91('0x3b')]+'%'};return _0x1c0fed;}})});}_0x1d8d6c=_[_0xda91('0x3c')]({},_0x1d8d6c,_0x279782['options']);var _0xa600c9={'where':_0x1d8d6c['where']};return db[_0xda91('0x29')][_0xda91('0x1c')](_0xa600c9)['then'](function(_0x327ca6){_0x7b8d86[_0xda91('0x1c')]=_0x327ca6;if(_0x279782[_0xda91('0x2f')][_0xda91('0x3e')]){_0x1d8d6c['include']=[{'all':!![]}];}return db['VtigerField']['findAll'](_0x1d8d6c);})[_0xda91('0x3f')](function(_0x2dce09){_0x7b8d86[_0xda91('0x40')]=_0x2dce09;return _0x7b8d86;})[_0xda91('0x3f')](respondWithFilteredResult(_0x260391,_0x1d8d6c))[_0xda91('0x41')](handleError(_0x260391,null));};exports[_0xda91('0x42')]=function(_0x473e36,_0x386aff){var _0x42cc47={'raw':!![],'where':{'id':_0x473e36[_0xda91('0x43')]['id']}},_0x529e77={};_0x529e77[_0xda91('0x2d')]=_['keys'](db[_0xda91('0x29')]['rawAttributes']);_0x529e77['query']=_[_0xda91('0x2e')](_0x473e36[_0xda91('0x2f')]);_0x529e77['filters']=_[_0xda91('0x31')](_0x529e77[_0xda91('0x2d')],_0x529e77[_0xda91('0x2f')]);_0x42cc47[_0xda91('0x30')]=_[_0xda91('0x31')](_0x529e77[_0xda91('0x2d')],qs[_0xda91('0x32')](_0x473e36[_0xda91('0x2f')][_0xda91('0x32')]));_0x42cc47['attributes']=_0x42cc47[_0xda91('0x30')][_0xda91('0x33')]?_0x42cc47[_0xda91('0x30')]:_0x529e77['model'];if(_0x473e36[_0xda91('0x2f')][_0xda91('0x3e')]){_0x42cc47[_0xda91('0x44')]=[{'all':!![]}];}_0x42cc47=_[_0xda91('0x3c')]({},_0x42cc47,_0x473e36['options']);return db[_0xda91('0x29')][_0xda91('0x45')](_0x42cc47)['then'](handleEntityNotFound(_0x386aff,null))[_0xda91('0x3f')](respondWithResult(_0x386aff,null))['catch'](handleError(_0x386aff,null));};exports[_0xda91('0x46')]=function(_0x416cc0,_0x16b95a){return db[_0xda91('0x29')][_0xda91('0x46')](_0x416cc0[_0xda91('0x47')],{})[_0xda91('0x3f')](respondWithResult(_0x16b95a,0xc9))[_0xda91('0x41')](handleError(_0x16b95a,null));};exports[_0xda91('0x21')]=function(_0x55a425,_0x243e3b){if(_0x55a425[_0xda91('0x47')]['id']){delete _0x55a425[_0xda91('0x47')]['id'];}return db[_0xda91('0x29')]['find']({'where':{'id':_0x55a425[_0xda91('0x43')]['id']}})['then'](handleEntityNotFound(_0x243e3b,null))[_0xda91('0x3f')](saveUpdates(_0x55a425[_0xda91('0x47')],null))[_0xda91('0x3f')](respondWithResult(_0x243e3b,null))['catch'](handleError(_0x243e3b,null));};exports['destroy']=function(_0x1ae5d6,_0x5a9833){return db[_0xda91('0x29')][_0xda91('0x45')]({'where':{'id':_0x1ae5d6[_0xda91('0x43')]['id']}})[_0xda91('0x3f')](handleEntityNotFound(_0x5a9833,null))['then'](removeEntity(_0x5a9833,null))[_0xda91('0x41')](handleError(_0x5a9833,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index 249084a..8614176 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 _0x8179=['int_vtiger_fields','vtiger_unique_index','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x547456,_0x1de17e){var _0xc1fd7b=function(_0x12be35){while(--_0x12be35){_0x547456['push'](_0x547456['shift']());}};_0xc1fd7b(++_0x1de17e);}(_0x8179,0x9c));var _0x9817=function(_0x3f963c,_0x8f0b80){_0x3f963c=_0x3f963c-0x0;var _0x53753b=_0x8179[_0x3f963c];return _0x53753b;};'use strict';var _=require(_0x9817('0x0'));var util=require(_0x9817('0x1'));var logger=require(_0x9817('0x2'))(_0x9817('0x3'));var moment=require(_0x9817('0x4'));var BPromise=require(_0x9817('0x5'));var rp=require(_0x9817('0x6'));var fs=require('fs');var path=require(_0x9817('0x7'));var rimraf=require(_0x9817('0x8'));var config=require(_0x9817('0x9'));var attributes=require('./intVtigerField.attributes');module[_0x9817('0xa')]=function(_0x32e1c0,_0x26752f){return _0x32e1c0[_0x9817('0xb')]('VtigerField',attributes,{'tableName':_0x9817('0xc'),'paranoid':![],'indexes':[{'name':_0x9817('0xd'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xae19=['path','rimraf','../../config/environment','./intVtigerField.attributes','exports','VtigerField','int_vtiger_fields','FieldId','util','api','moment','bluebird','request-promise'];(function(_0x484e36,_0x4482d8){var _0xafc85d=function(_0xaba9c8){while(--_0xaba9c8){_0x484e36['push'](_0x484e36['shift']());}};_0xafc85d(++_0x4482d8);}(_0xae19,0xff));var _0x9ae1=function(_0x3a9635,_0x1ab817){_0x3a9635=_0x3a9635-0x0;var _0x10d08c=_0xae19[_0x3a9635];return _0x10d08c;};'use strict';var _=require('lodash');var util=require(_0x9ae1('0x0'));var logger=require('../../config/logger')(_0x9ae1('0x1'));var moment=require(_0x9ae1('0x2'));var BPromise=require(_0x9ae1('0x3'));var rp=require(_0x9ae1('0x4'));var fs=require('fs');var path=require(_0x9ae1('0x5'));var rimraf=require(_0x9ae1('0x6'));var config=require(_0x9ae1('0x7'));var attributes=require(_0x9ae1('0x8'));module[_0x9ae1('0x9')]=function(_0x17c05a,_0x3333c5){return _0x17c05a['define'](_0x9ae1('0xa'),attributes,{'tableName':_0x9ae1('0xb'),'paranoid':![],'indexes':[{'name':'vtiger_unique_index','fields':['idField',_0x9ae1('0xc')],'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 9dab528..bee1852 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 _0x6eaf=['util','moment','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','VtigerField,\x20%s,\x20%s','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash'];(function(_0x2d8fc2,_0x1c461d){var _0x3a9e53=function(_0x18941c){while(--_0x18941c){_0x2d8fc2['push'](_0x2d8fc2['shift']());}};_0x3a9e53(++_0x1c461d);}(_0x6eaf,0xe5));var _0xf6ea=function(_0x18bf88,_0x4b490e){_0x18bf88=_0x18bf88-0x0;var _0x2bfb07=_0x6eaf[_0x18bf88];return _0x2bfb07;};'use strict';var _=require(_0xf6ea('0x0'));var util=require(_0xf6ea('0x1'));var moment=require(_0xf6ea('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf6ea('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xf6ea('0x4'))(_0xf6ea('0x5'));var config=require(_0xf6ea('0x6'));var jayson=require(_0xf6ea('0x7'));var client=jayson[_0xf6ea('0x8')][_0xf6ea('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x26aba6,_0x142f30,_0x86aaac){return new BPromise(function(_0x38b9d6,_0x312f69){return client[_0xf6ea('0xa')](_0x26aba6,_0x86aaac)[_0xf6ea('0xb')](function(_0x5df9e1){logger['info'](_0xf6ea('0xc'),_0x142f30,_0xf6ea('0xd'));logger[_0xf6ea('0xe')](_0xf6ea('0xf'),_0x142f30,_0xf6ea('0xd'),JSON[_0xf6ea('0x10')](_0x5df9e1));if(_0x5df9e1[_0xf6ea('0x11')]){if(_0x5df9e1['error'][_0xf6ea('0x12')]===0x1f4){logger[_0xf6ea('0x11')](_0xf6ea('0xc'),_0x142f30,_0x5df9e1['error'][_0xf6ea('0x13')]);return _0x312f69(_0x5df9e1[_0xf6ea('0x11')]['message']);}logger['error']('VtigerField,\x20%s,\x20%s',_0x142f30,_0x5df9e1[_0xf6ea('0x11')][_0xf6ea('0x13')]);return _0x38b9d6(_0x5df9e1[_0xf6ea('0x11')]['message']);}else{logger[_0xf6ea('0x14')](_0xf6ea('0xc'),_0x142f30,'request\x20sent');_0x38b9d6(_0x5df9e1[_0xf6ea('0x15')][_0xf6ea('0x13')]);}})[_0xf6ea('0x16')](function(_0x8cd237){logger[_0xf6ea('0x11')](_0xf6ea('0xc'),_0x142f30,_0x8cd237);_0x312f69(_0x8cd237);});});} \ No newline at end of file +var _0x0b1f=['ioredis','rpc','../../config/environment','jayson/promise','client','request','then','info','VtigerField,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','util','moment','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0b1f,0x82));var _0xf0b1=function(_0x30b665,_0x159d04){_0x30b665=_0x30b665-0x0;var _0xd3d4e6=_0x0b1f[_0x30b665];return _0xd3d4e6;};'use strict';var _=require('lodash');var util=require(_0xf0b1('0x0'));var moment=require(_0xf0b1('0x1'));var BPromise=require(_0xf0b1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf0b1('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xf0b1('0x4'));var config=require(_0xf0b1('0x5'));var jayson=require(_0xf0b1('0x6'));var client=jayson[_0xf0b1('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5abf2a,_0x4282e6,_0x2473f0){return new BPromise(function(_0x12bc80,_0x544cac){return client[_0xf0b1('0x8')](_0x5abf2a,_0x2473f0)[_0xf0b1('0x9')](function(_0x6c58f0){logger[_0xf0b1('0xa')](_0xf0b1('0xb'),_0x4282e6,_0xf0b1('0xc'));logger[_0xf0b1('0xd')]('VtigerField,\x20%s,\x20%s,\x20%s',_0x4282e6,_0xf0b1('0xc'),JSON['stringify'](_0x6c58f0));if(_0x6c58f0[_0xf0b1('0xe')]){if(_0x6c58f0[_0xf0b1('0xe')][_0xf0b1('0xf')]===0x1f4){logger[_0xf0b1('0xe')](_0xf0b1('0xb'),_0x4282e6,_0x6c58f0[_0xf0b1('0xe')][_0xf0b1('0x10')]);return _0x544cac(_0x6c58f0[_0xf0b1('0xe')][_0xf0b1('0x10')]);}logger[_0xf0b1('0xe')](_0xf0b1('0xb'),_0x4282e6,_0x6c58f0[_0xf0b1('0xe')][_0xf0b1('0x10')]);return _0x12bc80(_0x6c58f0['error'][_0xf0b1('0x10')]);}else{logger['info'](_0xf0b1('0xb'),_0x4282e6,_0xf0b1('0xc'));_0x12bc80(_0x6c58f0[_0xf0b1('0x11')]['message']);}})[_0xf0b1('0x12')](function(_0x599e01){logger['error']('VtigerField,\x20%s,\x20%s',_0x4282e6,_0x599e01);_0x544cac(_0x599e01);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 0de54c8..94fc849 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 _0x6aba=['index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','post','create','addConfiguration','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','get','isAuthenticated'];(function(_0x21095,_0x15034d){var _0x47a0d9=function(_0x97a490){while(--_0x97a490){_0x21095['push'](_0x21095['shift']());}};_0x47a0d9(++_0x15034d);}(_0x6aba,0x152));var _0xa6ab=function(_0x333b10,_0x4adc45){_0x333b10=_0x333b10-0x0;var _0x13773b=_0x6aba[_0x333b10];return _0x13773b;};'use strict';var multer=require(_0xa6ab('0x0'));var util=require(_0xa6ab('0x1'));var path=require(_0xa6ab('0x2'));var timeout=require(_0xa6ab('0x3'));var express=require(_0xa6ab('0x4'));var router=express[_0xa6ab('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xa6ab('0x6'));var interaction=require(_0xa6ab('0x7'));var config=require(_0xa6ab('0x8'));var controller=require(_0xa6ab('0x9'));router[_0xa6ab('0xa')]('/',auth[_0xa6ab('0xb')](),controller[_0xa6ab('0xc')]);router[_0xa6ab('0xa')](_0xa6ab('0xd'),auth['isAuthenticated'](),controller[_0xa6ab('0xe')]);router['get'](_0xa6ab('0xf'),auth['isAuthenticated'](),controller[_0xa6ab('0x10')]);router[_0xa6ab('0xa')](_0xa6ab('0x11'),auth[_0xa6ab('0xb')](),controller['getFields']);router[_0xa6ab('0x12')]('/',auth[_0xa6ab('0xb')](),controller[_0xa6ab('0x13')]);router['post'](_0xa6ab('0xf'),auth[_0xa6ab('0xb')](),controller[_0xa6ab('0x14')]);router['put']('/:id',auth[_0xa6ab('0xb')](),controller[_0xa6ab('0x15')]);router[_0xa6ab('0x16')](_0xa6ab('0xd'),auth[_0xa6ab('0xb')](),controller[_0xa6ab('0x17')]);module[_0xa6ab('0x18')]=router; \ No newline at end of file +var _0x81d4=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskAccount.controller','isAuthenticated','index','get','/:id','show','getConfigurations','post','create','/:id/configurations','addConfiguration','put','update','delete','destroy','multer','path'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x81d4,0x1ca));var _0x481d=function(_0x378ef0,_0x3607bb){_0x378ef0=_0x378ef0-0x0;var _0x30708a=_0x81d4[_0x378ef0];return _0x30708a;};'use strict';var multer=require(_0x481d('0x0'));var util=require('util');var path=require(_0x481d('0x1'));var timeout=require(_0x481d('0x2'));var express=require(_0x481d('0x3'));var router=express[_0x481d('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x481d('0x5'));var interaction=require(_0x481d('0x6'));var config=require(_0x481d('0x7'));var controller=require(_0x481d('0x8'));router['get']('/',auth[_0x481d('0x9')](),controller[_0x481d('0xa')]);router[_0x481d('0xb')](_0x481d('0xc'),auth[_0x481d('0x9')](),controller[_0x481d('0xd')]);router[_0x481d('0xb')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x481d('0xe')]);router[_0x481d('0xb')]('/:id/fields',auth[_0x481d('0x9')](),controller['getFields']);router[_0x481d('0xf')]('/',auth[_0x481d('0x9')](),controller[_0x481d('0x10')]);router[_0x481d('0xf')](_0x481d('0x11'),auth[_0x481d('0x9')](),controller[_0x481d('0x12')]);router[_0x481d('0x13')](_0x481d('0xc'),auth[_0x481d('0x9')](),controller[_0x481d('0x14')]);router[_0x481d('0x15')](_0x481d('0xc'),auth[_0x481d('0x9')](),controller[_0x481d('0x16')]);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 0433473..754f47c 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 _0x9af6=['token','integrationTab','newTab','sequelize','exports','STRING','username','remoteUri','ENUM'];(function(_0x556927,_0x34b53f){var _0x5f1235=function(_0x4f4e44){while(--_0x4f4e44){_0x556927['push'](_0x556927['shift']());}};_0x5f1235(++_0x34b53f);}(_0x9af6,0x1d7));var _0x69af=function(_0x19e687,_0x495e0d){_0x19e687=_0x19e687-0x0;var _0x2b0474=_0x9af6[_0x19e687];return _0x2b0474;};'use strict';var Sequelize=require(_0x69af('0x0'));module[_0x69af('0x1')]={'name':{'type':Sequelize[_0x69af('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0x69af('0x3')},'password':{'type':Sequelize['STRING']},'token':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x69af('0x2')],'unique':_0x69af('0x4')},'authType':{'type':Sequelize[_0x69af('0x5')]('password',_0x69af('0x6')),'defaultValue':'password'},'serverUrl':{'type':Sequelize[_0x69af('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x69af('0x5')](_0x69af('0x7'),_0x69af('0x8')),'defaultValue':_0x69af('0x7')}}; \ No newline at end of file +var _0xc61d=['exports','STRING','username','ENUM','password','token','integrationTab','newTab','sequelize'];(function(_0x4df6e3,_0x122209){var _0x314432=function(_0x590113){while(--_0x590113){_0x4df6e3['push'](_0x4df6e3['shift']());}};_0x314432(++_0x122209);}(_0xc61d,0xfb));var _0xdc61=function(_0x226cad,_0x262e18){_0x226cad=_0x226cad-0x0;var _0x2f73a1=_0xc61d[_0x226cad];return _0x2f73a1;};'use strict';var Sequelize=require(_0xdc61('0x0'));module[_0xdc61('0x1')]={'name':{'type':Sequelize[_0xdc61('0x2')]},'description':{'type':Sequelize[_0xdc61('0x2')]},'username':{'type':Sequelize[_0xdc61('0x2')],'unique':_0xdc61('0x3')},'password':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0xdc61('0x2')]},'remoteUri':{'type':Sequelize[_0xdc61('0x2')],'unique':'remoteUri'},'authType':{'type':Sequelize[_0xdc61('0x4')](_0xdc61('0x5'),_0xdc61('0x6')),'defaultValue':_0xdc61('0x5')},'serverUrl':{'type':Sequelize[_0xdc61('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xdc61('0x4')](_0xdc61('0x7'),_0xdc61('0x8')),'defaultValue':_0xdc61('0x7')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index f5eb539..f801fc3 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 _0x80ed=['rawAttributes','sort','pick','filter','addConfiguration','AccountId','channel','Descriptions','getDescriptions','ZendeskConfiguration','ZendeskField','getFields','username','password','authType','remoteUri','substring','lastIndexOf','GET','%s/%s','ticket_fields','headers','format','Basic\x20%s','%s:%s','toString','%s/token:%s','token','Sequelize','ValidationError','Unknown\x20authentication\x20type','subject','group','assignee','includes','position','system_field_options','custom_field_options','test','statusCode','error','stringify','send','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','end','status','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','then','sendStatus','stack','name','index','map','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','merge','VIRTUAL','options','ZendeskAccount','findAll','rows','catch','show','params','includeAll','create','body','find','getConfigurations','findOne'];(function(_0x1ca56e,_0x5b2d81){var _0x212f8f=function(_0x2e467b){while(--_0x2e467b){_0x1ca56e['push'](_0x1ca56e['shift']());}};_0x212f8f(++_0x5b2d81);}(_0x80ed,0x11c));var _0xd80e=function(_0x1b4179,_0x362f1c){_0x1b4179=_0x1b4179-0x0;var _0x123116=_0x80ed[_0x1b4179];return _0x123116;};'use strict';var emlformat=require(_0xd80e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd80e('0x1'));var jsonpatch=require(_0xd80e('0x2'));var rp=require(_0xd80e('0x3'));var moment=require('moment');var BPromise=require(_0xd80e('0x4'));var Mustache=require(_0xd80e('0x5'));var util=require(_0xd80e('0x6'));var path=require(_0xd80e('0x7'));var sox=require('sox');var csv=require(_0xd80e('0x8'));var ejs=require(_0xd80e('0x9'));var fs=require('fs');var fs_extra=require(_0xd80e('0xa'));var _=require('lodash');var squel=require(_0xd80e('0xb'));var crypto=require(_0xd80e('0xc'));var jsforce=require(_0xd80e('0xd'));var deskjs=require(_0xd80e('0xe'));var toCsv=require(_0xd80e('0x8'));var querystring=require(_0xd80e('0xf'));var Papa=require(_0xd80e('0x10'));var Redis=require(_0xd80e('0x11'));var authService=require(_0xd80e('0x12'));var qs=require(_0xd80e('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd80e('0x14'));var logger=require(_0xd80e('0x15'))(_0xd80e('0x16'));var utils=require(_0xd80e('0x17'));var config=require(_0xd80e('0x18'));var licenseUtil=require(_0xd80e('0x19'));var db=require(_0xd80e('0x1a'))['db'];var integrations=require(_0xd80e('0x1b'));function respondWithStatusCode(_0x1d3fcf,_0x4fb01c){_0x4fb01c=_0x4fb01c||0xcc;return function(_0x5691a1){if(_0x5691a1){return _0x1d3fcf['sendStatus'](_0x4fb01c);}return _0x1d3fcf['status'](_0x4fb01c)[_0xd80e('0x1c')]();};}function respondWithResult(_0x3d233b,_0x3096ae){_0x3096ae=_0x3096ae||0xc8;return function(_0x1e8b63){if(_0x1e8b63){return _0x3d233b[_0xd80e('0x1d')](_0x3096ae)['json'](_0x1e8b63);}};}function respondWithFilteredResult(_0x595683,_0x2c8c61){return function(_0x3124e8){if(_0x3124e8){var _0x3b48ae=typeof _0x2c8c61[_0xd80e('0x1e')]===_0xd80e('0x1f')&&typeof _0x2c8c61[_0xd80e('0x20')]===_0xd80e('0x1f');var _0x49e3e5=_0x3124e8[_0xd80e('0x21')];var _0x1cc576=_0x3b48ae?0x0:_0x2c8c61[_0xd80e('0x1e')];var _0x34e239=_0x3b48ae?_0x3124e8['count']:_0x2c8c61[_0xd80e('0x1e')]+_0x2c8c61[_0xd80e('0x20')];var _0xecfe74;if(_0x34e239>=_0x49e3e5){_0x34e239=_0x49e3e5;_0xecfe74=0xc8;}else{_0xecfe74=0xce;}_0x595683['status'](_0xecfe74);return _0x595683[_0xd80e('0x22')](_0xd80e('0x23'),_0x1cc576+'-'+_0x34e239+'/'+_0x49e3e5)[_0xd80e('0x24')](_0x3124e8);}return null;};}function patchUpdates(_0x147134){return function(_0x46b6eb){try{jsonpatch['apply'](_0x46b6eb,_0x147134,!![]);}catch(_0x4b6b8a){return BPromise[_0xd80e('0x25')](_0x4b6b8a);}return _0x46b6eb[_0xd80e('0x26')]();};}function saveUpdates(_0x3b39bf,_0x2d46e7){return function(_0x3eb3ca){if(_0x3eb3ca){return _0x3eb3ca[_0xd80e('0x27')](_0x3b39bf)[_0xd80e('0x28')](function(_0x5430b6){return _0x5430b6;});}return null;};}function removeEntity(_0x1fbf8a,_0x57d70){return function(_0x170109){if(_0x170109){return _0x170109['destroy']()[_0xd80e('0x28')](function(){_0x1fbf8a[_0xd80e('0x1d')](0xcc)[_0xd80e('0x1c')]();});}};}function handleEntityNotFound(_0x482779,_0x521aa4){return function(_0x5420e7){if(!_0x5420e7){_0x482779[_0xd80e('0x29')](0x194);}return _0x5420e7;};}function handleError(_0x4b8291,_0x9f9287){_0x9f9287=_0x9f9287||0x1f4;return function(_0x1044cc){logger['error'](_0x1044cc[_0xd80e('0x2a')]);if(_0x1044cc[_0xd80e('0x2b')]){delete _0x1044cc[_0xd80e('0x2b')];}_0x4b8291[_0xd80e('0x1d')](_0x9f9287)['send'](_0x1044cc);};}exports[_0xd80e('0x2c')]=function(_0x1ad3bc,_0x845451){var _0x39088b={},_0x2b1aaf={},_0x361946={'count':0x0,'rows':[]};var _0x289685=_[_0xd80e('0x2d')](db['ZendeskAccount']['rawAttributes'],function(_0x30f9bd){return{'name':_0x30f9bd[_0xd80e('0x2e')],'type':_0x30f9bd[_0xd80e('0x2f')][_0xd80e('0x30')]};});_0x2b1aaf[_0xd80e('0x31')]=_[_0xd80e('0x2d')](_0x289685,'name');_0x2b1aaf['query']=_[_0xd80e('0x32')](_0x1ad3bc[_0xd80e('0x33')]);_0x2b1aaf[_0xd80e('0x34')]=_[_0xd80e('0x35')](_0x2b1aaf[_0xd80e('0x31')],_0x2b1aaf[_0xd80e('0x33')]);_0x39088b[_0xd80e('0x36')]=_[_0xd80e('0x35')](_0x2b1aaf['model'],qs['fields'](_0x1ad3bc[_0xd80e('0x33')][_0xd80e('0x37')]));_0x39088b[_0xd80e('0x36')]=_0x39088b[_0xd80e('0x36')][_0xd80e('0x38')]?_0x39088b[_0xd80e('0x36')]:_0x2b1aaf[_0xd80e('0x31')];if(!_0x1ad3bc[_0xd80e('0x33')][_0xd80e('0x39')](_0xd80e('0x3a'))){_0x39088b['limit']=qs[_0xd80e('0x20')](_0x1ad3bc['query'][_0xd80e('0x20')]);_0x39088b[_0xd80e('0x1e')]=qs[_0xd80e('0x1e')](_0x1ad3bc[_0xd80e('0x33')]['offset']);}_0x39088b[_0xd80e('0x3b')]=qs['sort'](_0x1ad3bc[_0xd80e('0x33')]['sort']);_0x39088b[_0xd80e('0x3c')]=qs[_0xd80e('0x34')](_['pick'](_0x1ad3bc[_0xd80e('0x33')],_0x2b1aaf[_0xd80e('0x34')]),_0x289685);if(_0x1ad3bc[_0xd80e('0x33')]['filter']){_0x39088b[_0xd80e('0x3c')]=_[_0xd80e('0x3d')](_0x39088b[_0xd80e('0x3c')],{'$or':_[_0xd80e('0x2d')](_0x289685,function(_0x3c6f5f){if(_0x3c6f5f[_0xd80e('0x2f')]!==_0xd80e('0x3e')){var _0x137552={};_0x137552[_0x3c6f5f[_0xd80e('0x2b')]]={'$like':'%'+_0x1ad3bc['query']['filter']+'%'};return _0x137552;}})});}_0x39088b=_['merge']({},_0x39088b,_0x1ad3bc[_0xd80e('0x3f')]);var _0x3ff4b4={'where':_0x39088b['where']};return db[_0xd80e('0x40')]['count'](_0x3ff4b4)[_0xd80e('0x28')](function(_0x5ade19){_0x361946[_0xd80e('0x21')]=_0x5ade19;if(_0x1ad3bc[_0xd80e('0x33')]['includeAll']){_0x39088b['include']=[{'all':!![]}];}return db[_0xd80e('0x40')][_0xd80e('0x41')](_0x39088b);})[_0xd80e('0x28')](function(_0x3e65a7){_0x361946[_0xd80e('0x42')]=_0x3e65a7;return _0x361946;})[_0xd80e('0x28')](respondWithFilteredResult(_0x845451,_0x39088b))[_0xd80e('0x43')](handleError(_0x845451,null));};exports[_0xd80e('0x44')]=function(_0x91c6ed,_0x2da5f5){var _0x1bbb36={'raw':![],'where':{'id':_0x91c6ed[_0xd80e('0x45')]['id']}},_0x2e257e={};_0x2e257e[_0xd80e('0x31')]=_[_0xd80e('0x32')](db[_0xd80e('0x40')]['rawAttributes']);_0x2e257e['query']=_['keys'](_0x91c6ed[_0xd80e('0x33')]);_0x2e257e['filters']=_[_0xd80e('0x35')](_0x2e257e[_0xd80e('0x31')],_0x2e257e[_0xd80e('0x33')]);_0x1bbb36[_0xd80e('0x36')]=_[_0xd80e('0x35')](_0x2e257e[_0xd80e('0x31')],qs['fields'](_0x91c6ed['query']['fields']));_0x1bbb36[_0xd80e('0x36')]=_0x1bbb36['attributes'][_0xd80e('0x38')]?_0x1bbb36[_0xd80e('0x36')]:_0x2e257e[_0xd80e('0x31')];if(_0x91c6ed[_0xd80e('0x33')][_0xd80e('0x46')]){_0x1bbb36['include']=[{'all':!![]}];}_0x1bbb36=_[_0xd80e('0x3d')]({},_0x1bbb36,_0x91c6ed[_0xd80e('0x3f')]);return db[_0xd80e('0x40')]['find'](_0x1bbb36)[_0xd80e('0x28')](handleEntityNotFound(_0x2da5f5,null))[_0xd80e('0x28')](respondWithResult(_0x2da5f5,null))[_0xd80e('0x43')](handleError(_0x2da5f5,null));};exports['create']=function(_0x8d5cb8,_0x29aaa0){return db[_0xd80e('0x40')][_0xd80e('0x47')](_0x8d5cb8[_0xd80e('0x48')],{})[_0xd80e('0x28')](respondWithResult(_0x29aaa0,0xc9))['catch'](handleError(_0x29aaa0,null));};exports['update']=function(_0x275985,_0x27134e){if(_0x275985[_0xd80e('0x48')]['id']){delete _0x275985['body']['id'];}return db['ZendeskAccount'][_0xd80e('0x49')]({'where':{'id':_0x275985[_0xd80e('0x45')]['id']}})[_0xd80e('0x28')](handleEntityNotFound(_0x27134e,null))[_0xd80e('0x28')](saveUpdates(_0x275985[_0xd80e('0x48')],null))['then'](respondWithResult(_0x27134e,null))[_0xd80e('0x43')](handleError(_0x27134e,null));};exports['destroy']=function(_0x46c781,_0x31107b){return db['ZendeskAccount'][_0xd80e('0x49')]({'where':{'id':_0x46c781[_0xd80e('0x45')]['id']}})[_0xd80e('0x28')](handleEntityNotFound(_0x31107b,null))[_0xd80e('0x28')](removeEntity(_0x31107b,null))[_0xd80e('0x43')](handleError(_0x31107b,null));};exports[_0xd80e('0x4a')]=function(_0x18dbb0,_0x50be26,_0x178c51){var _0x377e68={};var _0x419df7={};var _0x4a66ca;var _0x52ab04;return db[_0xd80e('0x40')][_0xd80e('0x4b')]({'where':{'id':_0x18dbb0[_0xd80e('0x45')]['id']}})[_0xd80e('0x28')](handleEntityNotFound(_0x50be26,null))[_0xd80e('0x28')](function(_0x8b7a70){if(_0x8b7a70){_0x4a66ca=_0x8b7a70;_0x419df7[_0xd80e('0x31')]=_[_0xd80e('0x32')](db['ZendeskConfiguration'][_0xd80e('0x4c')]);_0x419df7['query']=_[_0xd80e('0x32')](_0x18dbb0[_0xd80e('0x33')]);_0x419df7[_0xd80e('0x34')]=_[_0xd80e('0x35')](_0x419df7[_0xd80e('0x31')],_0x419df7[_0xd80e('0x33')]);_0x377e68['attributes']=_[_0xd80e('0x35')](_0x419df7['model'],qs[_0xd80e('0x37')](_0x18dbb0[_0xd80e('0x33')]['fields']));_0x377e68['attributes']=_0x377e68[_0xd80e('0x36')][_0xd80e('0x38')]?_0x377e68[_0xd80e('0x36')]:_0x419df7['model'];_0x377e68['order']=qs[_0xd80e('0x4d')](_0x18dbb0[_0xd80e('0x33')]['sort']);_0x377e68[_0xd80e('0x3c')]=qs[_0xd80e('0x34')](_[_0xd80e('0x4e')](_0x18dbb0['query'],_0x419df7[_0xd80e('0x34')]));if(_0x18dbb0['query'][_0xd80e('0x4f')]){_0x377e68[_0xd80e('0x3c')]=_[_0xd80e('0x3d')](_0x377e68[_0xd80e('0x3c')],{'$or':_['map'](_0x377e68[_0xd80e('0x36')],function(_0x564475){var _0x53b784={};_0x53b784[_0x564475]={'$like':'%'+_0x18dbb0['query'][_0xd80e('0x4f')]+'%'};return _0x53b784;})});}_0x377e68=_[_0xd80e('0x3d')]({},_0x377e68,_0x18dbb0[_0xd80e('0x3f')]);return _0x4a66ca[_0xd80e('0x4a')](_0x377e68);}})['then'](function(_0x1738ff){if(_0x1738ff){_0x52ab04=_0x1738ff[_0xd80e('0x38')];if(!_0x18dbb0['query'][_0xd80e('0x39')](_0xd80e('0x3a'))){_0x377e68[_0xd80e('0x20')]=qs[_0xd80e('0x20')](_0x18dbb0['query'][_0xd80e('0x20')]);_0x377e68[_0xd80e('0x1e')]=qs['offset'](_0x18dbb0[_0xd80e('0x33')][_0xd80e('0x1e')]);}return _0x4a66ca[_0xd80e('0x4a')](_0x377e68);}})['then'](function(_0x562ed7){if(_0x562ed7){return _0x562ed7?{'count':_0x52ab04,'rows':_0x562ed7}:null;}})['then'](respondWithResult(_0x50be26,null))['catch'](handleError(_0x50be26,null));};exports[_0xd80e('0x50')]=function(_0x4f283c,_0x3c8ad1,_0x1b0ad4){if(_0x4f283c[_0xd80e('0x48')]['id']){delete _0x4f283c['body']['id'];}return db[_0xd80e('0x40')][_0xd80e('0x4b')]({'where':{'id':_0x4f283c[_0xd80e('0x45')]['id']}})[_0xd80e('0x28')](handleEntityNotFound(_0x3c8ad1,null))[_0xd80e('0x28')](function(_0x2a34cd){if(_0x2a34cd){_0x4f283c[_0xd80e('0x48')][_0xd80e('0x51')]=_0x2a34cd['id'];_0x4f283c[_0xd80e('0x48')]['Subjects']=integrations['getSubjects'](_0x4f283c[_0xd80e('0x48')][_0xd80e('0x52')],_0x4f283c[_0xd80e('0x48')][_0xd80e('0x2f')]);_0x4f283c['body'][_0xd80e('0x53')]=integrations[_0xd80e('0x54')](_0x4f283c[_0xd80e('0x48')][_0xd80e('0x52')],_0x4f283c[_0xd80e('0x48')]['type']);return db[_0xd80e('0x55')][_0xd80e('0x47')](_0x4f283c[_0xd80e('0x48')],{'include':[{'model':db[_0xd80e('0x56')],'as':'Subjects'},{'model':db[_0xd80e('0x56')],'as':_0xd80e('0x53')}]});}return null;})[_0xd80e('0x28')](respondWithResult(_0x3c8ad1,null))[_0xd80e('0x43')](handleError(_0x3c8ad1,null));};exports[_0xd80e('0x57')]=function(_0x1edcf4,_0x5cb11c,_0x3e3176){var _0x393fb6='';return db['ZendeskAccount'][_0xd80e('0x4b')]({'where':{'id':_0x1edcf4[_0xd80e('0x45')]['id']},'attributes':['id',_0xd80e('0x58'),_0xd80e('0x59'),'token',_0xd80e('0x5a'),'remoteUri']})[_0xd80e('0x28')](handleEntityNotFound(_0x5cb11c,null))[_0xd80e('0x28')](function(_0x194743){if(_0x194743){_0x393fb6=_0x194743[_0xd80e('0x5b')];var _0x4186bd=_0x393fb6['slice'](-0x1);if(_0x4186bd==='/'){_0x393fb6=_0x393fb6[_0xd80e('0x5c')](0x0,_0x393fb6[_0xd80e('0x5d')](_0x4186bd));}var _0x25e86d={'method':_0xd80e('0x5e'),'uri':util['format'](_0xd80e('0x5f'),_0x393fb6,_0xd80e('0x60')),'json':!![]};switch(_0x194743['authType']){case _0xd80e('0x59'):_0x25e86d[_0xd80e('0x61')]={'Authorization':util[_0xd80e('0x62')](_0xd80e('0x63'),new Buffer(util[_0xd80e('0x62')](_0xd80e('0x64'),_0x194743['username'],_0x194743['password']))[_0xd80e('0x65')]('base64'))};break;case'token':_0x25e86d[_0xd80e('0x61')]={'Authorization':util[_0xd80e('0x62')](_0xd80e('0x63'),new Buffer(util[_0xd80e('0x62')](_0xd80e('0x66'),_0x194743[_0xd80e('0x58')],_0x194743[_0xd80e('0x67')]))[_0xd80e('0x65')]('base64'))};break;default:throw new db[(_0xd80e('0x68'))][(_0xd80e('0x69'))](_0xd80e('0x6a'));}return rp(_0x25e86d);}})[_0xd80e('0x28')](function(_0x575bf6){if(_0x575bf6){var _0x192178=[_0xd80e('0x6b'),'description',_0xd80e('0x6c'),_0xd80e('0x6d')];_['remove'](_0x575bf6[_0xd80e('0x60')],function(_0x160dc4){return _0x192178[_0xd80e('0x6e')](_0x160dc4[_0xd80e('0x2f')]);});return{'count':_0x575bf6[_0xd80e('0x60')][_0xd80e('0x38')],'rows':_[_0xd80e('0x2d')](_0x575bf6[_0xd80e('0x60')],function(_0x392a8b){return{'id':_0x392a8b['id'],'name':_0x392a8b[_0xd80e('0x6f')]>0x7?_0x392a8b['title']:_0x392a8b[_0xd80e('0x2f')],'custom':_0x392a8b[_0xd80e('0x6f')]>0x7?!![]:![],'options':_0x392a8b['system_field_options']?_0x392a8b[_0xd80e('0x70')]:_0x392a8b[_0xd80e('0x71')]?_0x392a8b[_0xd80e('0x71')]:[]};})};}})['then'](respondWithResult(_0x5cb11c,null))[_0xd80e('0x43')](function(_0x5277a2){var _0x30fc66=_0x1edcf4[_0xd80e('0x33')][_0xd80e('0x72')]?0x1f4:_0x5277a2[_0xd80e('0x73')]||0x1f4;logger[_0xd80e('0x74')]('getFields,\x20%s,\x20%s,\x20%s',_0xd80e('0x57'),_0x30fc66,JSON[_0xd80e('0x75')](_0x5277a2));delete _0x5277a2[_0xd80e('0x2b')];if(_0x30fc66===0x191){_0x30fc66=0x190;}_0x5cb11c[_0xd80e('0x1d')](_0x30fc66)[_0xd80e('0x76')](_0x1edcf4[_0xd80e('0x33')][_0xd80e('0x72')]?{'message':_0xd80e('0x77'),'statusCode':_0x5277a2[_0xd80e('0x73')]}:_0x5277a2);});}; \ No newline at end of file +var _0x2f68=['find','create','body','catch','getConfigurations','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZendeskConfiguration','ZendeskField','getFields','password','token','authType','remoteUri','substring','lastIndexOf','GET','format','%s/%s','Basic\x20%s','%s:%s','username','toString','Sequelize','Unknown\x20authentication\x20type','subject','description','group','ticket_fields','includes','position','title','system_field_options','custom_field_options','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','send','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','to-csv','ejs','squel','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','save','destroy','then','stack','name','index','map','ZendeskAccount','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','keys'];(function(_0x15963c,_0x46fcc8){var _0x3c7a46=function(_0x14c8c1){while(--_0x14c8c1){_0x15963c['push'](_0x15963c['shift']());}};_0x3c7a46(++_0x46fcc8);}(_0x2f68,0x9a));var _0x82f6=function(_0x33c527,_0x5be107){_0x33c527=_0x33c527-0x0;var _0x132efa=_0x2f68[_0x33c527];return _0x132efa;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x82f6('0x0'));var zipdir=require(_0x82f6('0x1'));var jsonpatch=require(_0x82f6('0x2'));var rp=require(_0x82f6('0x3'));var moment=require('moment');var BPromise=require(_0x82f6('0x4'));var Mustache=require('mustache');var util=require(_0x82f6('0x5'));var path=require(_0x82f6('0x6'));var sox=require('sox');var csv=require(_0x82f6('0x7'));var ejs=require(_0x82f6('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x82f6('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x82f6('0xa'));var toCsv=require(_0x82f6('0x7'));var querystring=require(_0x82f6('0xb'));var Papa=require('papaparse');var Redis=require(_0x82f6('0xc'));var authService=require(_0x82f6('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x82f6('0xe'));var hardwareService=require(_0x82f6('0xf'));var logger=require(_0x82f6('0x10'))(_0x82f6('0x11'));var utils=require(_0x82f6('0x12'));var config=require(_0x82f6('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x82f6('0x14'))['db'];var integrations=require(_0x82f6('0x15'));function respondWithStatusCode(_0x4cc967,_0x194da7){_0x194da7=_0x194da7||0xcc;return function(_0x1f8bf5){if(_0x1f8bf5){return _0x4cc967[_0x82f6('0x16')](_0x194da7);}return _0x4cc967[_0x82f6('0x17')](_0x194da7)[_0x82f6('0x18')]();};}function respondWithResult(_0xa00275,_0x115c7b){_0x115c7b=_0x115c7b||0xc8;return function(_0x171815){if(_0x171815){return _0xa00275[_0x82f6('0x17')](_0x115c7b)['json'](_0x171815);}};}function respondWithFilteredResult(_0x389949,_0x5d0827){return function(_0x249222){if(_0x249222){var _0x1d0263=typeof _0x5d0827[_0x82f6('0x19')]===_0x82f6('0x1a')&&typeof _0x5d0827[_0x82f6('0x1b')]===_0x82f6('0x1a');var _0x326378=_0x249222[_0x82f6('0x1c')];var _0x4072f0=_0x1d0263?0x0:_0x5d0827[_0x82f6('0x19')];var _0x1c79f9=_0x1d0263?_0x249222[_0x82f6('0x1c')]:_0x5d0827[_0x82f6('0x19')]+_0x5d0827[_0x82f6('0x1b')];var _0x3a8269;if(_0x1c79f9>=_0x326378){_0x1c79f9=_0x326378;_0x3a8269=0xc8;}else{_0x3a8269=0xce;}_0x389949['status'](_0x3a8269);return _0x389949[_0x82f6('0x1d')](_0x82f6('0x1e'),_0x4072f0+'-'+_0x1c79f9+'/'+_0x326378)['json'](_0x249222);}return null;};}function patchUpdates(_0x2b03ad){return function(_0x4b9f0){try{jsonpatch[_0x82f6('0x1f')](_0x4b9f0,_0x2b03ad,!![]);}catch(_0x25cae6){return BPromise['reject'](_0x25cae6);}return _0x4b9f0[_0x82f6('0x20')]();};}function saveUpdates(_0x4beccf,_0x8668bb){return function(_0x2a0ce6){if(_0x2a0ce6){return _0x2a0ce6['update'](_0x4beccf)['then'](function(_0x3af5f7){return _0x3af5f7;});}return null;};}function removeEntity(_0x1d96d5,_0x4c57c5){return function(_0x5a5059){if(_0x5a5059){return _0x5a5059[_0x82f6('0x21')]()[_0x82f6('0x22')](function(){_0x1d96d5['status'](0xcc)[_0x82f6('0x18')]();});}};}function handleEntityNotFound(_0x304e83,_0x5037f8){return function(_0x57ac0d){if(!_0x57ac0d){_0x304e83[_0x82f6('0x16')](0x194);}return _0x57ac0d;};}function handleError(_0x5187d0,_0x469b6b){_0x469b6b=_0x469b6b||0x1f4;return function(_0x5a6d69){logger['error'](_0x5a6d69[_0x82f6('0x23')]);if(_0x5a6d69[_0x82f6('0x24')]){delete _0x5a6d69[_0x82f6('0x24')];}_0x5187d0[_0x82f6('0x17')](_0x469b6b)['send'](_0x5a6d69);};}exports[_0x82f6('0x25')]=function(_0x1fb461,_0x14a309){var _0x400137={},_0x271c28={},_0x328707={'count':0x0,'rows':[]};var _0x27e473=_[_0x82f6('0x26')](db[_0x82f6('0x27')][_0x82f6('0x28')],function(_0x3c9419){return{'name':_0x3c9419[_0x82f6('0x29')],'type':_0x3c9419[_0x82f6('0x2a')][_0x82f6('0x2b')]};});_0x271c28['model']=_[_0x82f6('0x26')](_0x27e473,_0x82f6('0x24'));_0x271c28[_0x82f6('0x2c')]=_['keys'](_0x1fb461[_0x82f6('0x2c')]);_0x271c28[_0x82f6('0x2d')]=_[_0x82f6('0x2e')](_0x271c28[_0x82f6('0x2f')],_0x271c28[_0x82f6('0x2c')]);_0x400137[_0x82f6('0x30')]=_[_0x82f6('0x2e')](_0x271c28[_0x82f6('0x2f')],qs[_0x82f6('0x31')](_0x1fb461[_0x82f6('0x2c')][_0x82f6('0x31')]));_0x400137[_0x82f6('0x30')]=_0x400137[_0x82f6('0x30')][_0x82f6('0x32')]?_0x400137['attributes']:_0x271c28[_0x82f6('0x2f')];if(!_0x1fb461[_0x82f6('0x2c')][_0x82f6('0x33')](_0x82f6('0x34'))){_0x400137[_0x82f6('0x1b')]=qs[_0x82f6('0x1b')](_0x1fb461[_0x82f6('0x2c')][_0x82f6('0x1b')]);_0x400137[_0x82f6('0x19')]=qs[_0x82f6('0x19')](_0x1fb461[_0x82f6('0x2c')][_0x82f6('0x19')]);}_0x400137[_0x82f6('0x35')]=qs[_0x82f6('0x36')](_0x1fb461['query'][_0x82f6('0x36')]);_0x400137['where']=qs['filters'](_[_0x82f6('0x37')](_0x1fb461[_0x82f6('0x2c')],_0x271c28['filters']),_0x27e473);if(_0x1fb461[_0x82f6('0x2c')][_0x82f6('0x38')]){_0x400137[_0x82f6('0x39')]=_['merge'](_0x400137[_0x82f6('0x39')],{'$or':_['map'](_0x27e473,function(_0x2be8cf){if(_0x2be8cf['type']!==_0x82f6('0x3a')){var _0x47ef9e={};_0x47ef9e[_0x2be8cf[_0x82f6('0x24')]]={'$like':'%'+_0x1fb461[_0x82f6('0x2c')]['filter']+'%'};return _0x47ef9e;}})});}_0x400137=_[_0x82f6('0x3b')]({},_0x400137,_0x1fb461[_0x82f6('0x3c')]);var _0x3e7c53={'where':_0x400137[_0x82f6('0x39')]};return db['ZendeskAccount'][_0x82f6('0x1c')](_0x3e7c53)[_0x82f6('0x22')](function(_0x23ea04){_0x328707[_0x82f6('0x1c')]=_0x23ea04;if(_0x1fb461['query'][_0x82f6('0x3d')]){_0x400137[_0x82f6('0x3e')]=[{'all':!![]}];}return db['ZendeskAccount'][_0x82f6('0x3f')](_0x400137);})[_0x82f6('0x22')](function(_0x2d7509){_0x328707[_0x82f6('0x40')]=_0x2d7509;return _0x328707;})[_0x82f6('0x22')](respondWithFilteredResult(_0x14a309,_0x400137))['catch'](handleError(_0x14a309,null));};exports[_0x82f6('0x41')]=function(_0x5786ce,_0x139614){var _0x38e82d={'raw':![],'where':{'id':_0x5786ce[_0x82f6('0x42')]['id']}},_0x32d6b5={};_0x32d6b5[_0x82f6('0x2f')]=_[_0x82f6('0x43')](db[_0x82f6('0x27')]['rawAttributes']);_0x32d6b5[_0x82f6('0x2c')]=_[_0x82f6('0x43')](_0x5786ce[_0x82f6('0x2c')]);_0x32d6b5[_0x82f6('0x2d')]=_['intersection'](_0x32d6b5[_0x82f6('0x2f')],_0x32d6b5['query']);_0x38e82d[_0x82f6('0x30')]=_[_0x82f6('0x2e')](_0x32d6b5[_0x82f6('0x2f')],qs[_0x82f6('0x31')](_0x5786ce[_0x82f6('0x2c')][_0x82f6('0x31')]));_0x38e82d['attributes']=_0x38e82d[_0x82f6('0x30')][_0x82f6('0x32')]?_0x38e82d[_0x82f6('0x30')]:_0x32d6b5[_0x82f6('0x2f')];if(_0x5786ce[_0x82f6('0x2c')][_0x82f6('0x3d')]){_0x38e82d[_0x82f6('0x3e')]=[{'all':!![]}];}_0x38e82d=_[_0x82f6('0x3b')]({},_0x38e82d,_0x5786ce['options']);return db[_0x82f6('0x27')][_0x82f6('0x44')](_0x38e82d)['then'](handleEntityNotFound(_0x139614,null))[_0x82f6('0x22')](respondWithResult(_0x139614,null))['catch'](handleError(_0x139614,null));};exports[_0x82f6('0x45')]=function(_0x5e3321,_0x227ab8){return db[_0x82f6('0x27')][_0x82f6('0x45')](_0x5e3321[_0x82f6('0x46')],{})[_0x82f6('0x22')](respondWithResult(_0x227ab8,0xc9))[_0x82f6('0x47')](handleError(_0x227ab8,null));};exports['update']=function(_0x3cb1f0,_0xdc77ca){if(_0x3cb1f0['body']['id']){delete _0x3cb1f0['body']['id'];}return db[_0x82f6('0x27')][_0x82f6('0x44')]({'where':{'id':_0x3cb1f0[_0x82f6('0x42')]['id']}})['then'](handleEntityNotFound(_0xdc77ca,null))[_0x82f6('0x22')](saveUpdates(_0x3cb1f0[_0x82f6('0x46')],null))[_0x82f6('0x22')](respondWithResult(_0xdc77ca,null))[_0x82f6('0x47')](handleError(_0xdc77ca,null));};exports['destroy']=function(_0x495400,_0x1695ea){return db[_0x82f6('0x27')][_0x82f6('0x44')]({'where':{'id':_0x495400['params']['id']}})[_0x82f6('0x22')](handleEntityNotFound(_0x1695ea,null))[_0x82f6('0x22')](removeEntity(_0x1695ea,null))['catch'](handleError(_0x1695ea,null));};exports['getConfigurations']=function(_0x4fa2ca,_0x2e6b03,_0x4a63a6){var _0x259d83={};var _0x57c023={};var _0x33c359;var _0x4f69de;return db[_0x82f6('0x27')]['findOne']({'where':{'id':_0x4fa2ca[_0x82f6('0x42')]['id']}})[_0x82f6('0x22')](handleEntityNotFound(_0x2e6b03,null))[_0x82f6('0x22')](function(_0x1633cf){if(_0x1633cf){_0x33c359=_0x1633cf;_0x57c023[_0x82f6('0x2f')]=_[_0x82f6('0x43')](db['ZendeskConfiguration'][_0x82f6('0x28')]);_0x57c023[_0x82f6('0x2c')]=_[_0x82f6('0x43')](_0x4fa2ca['query']);_0x57c023['filters']=_[_0x82f6('0x2e')](_0x57c023[_0x82f6('0x2f')],_0x57c023[_0x82f6('0x2c')]);_0x259d83[_0x82f6('0x30')]=_['intersection'](_0x57c023[_0x82f6('0x2f')],qs[_0x82f6('0x31')](_0x4fa2ca[_0x82f6('0x2c')]['fields']));_0x259d83['attributes']=_0x259d83['attributes'][_0x82f6('0x32')]?_0x259d83[_0x82f6('0x30')]:_0x57c023[_0x82f6('0x2f')];_0x259d83[_0x82f6('0x35')]=qs[_0x82f6('0x36')](_0x4fa2ca[_0x82f6('0x2c')][_0x82f6('0x36')]);_0x259d83[_0x82f6('0x39')]=qs['filters'](_[_0x82f6('0x37')](_0x4fa2ca[_0x82f6('0x2c')],_0x57c023[_0x82f6('0x2d')]));if(_0x4fa2ca[_0x82f6('0x2c')]['filter']){_0x259d83['where']=_[_0x82f6('0x3b')](_0x259d83[_0x82f6('0x39')],{'$or':_['map'](_0x259d83[_0x82f6('0x30')],function(_0xa12f6e){var _0x404d09={};_0x404d09[_0xa12f6e]={'$like':'%'+_0x4fa2ca['query'][_0x82f6('0x38')]+'%'};return _0x404d09;})});}_0x259d83=_[_0x82f6('0x3b')]({},_0x259d83,_0x4fa2ca[_0x82f6('0x3c')]);return _0x33c359[_0x82f6('0x48')](_0x259d83);}})[_0x82f6('0x22')](function(_0x41da7f){if(_0x41da7f){_0x4f69de=_0x41da7f['length'];if(!_0x4fa2ca[_0x82f6('0x2c')][_0x82f6('0x33')](_0x82f6('0x34'))){_0x259d83[_0x82f6('0x1b')]=qs[_0x82f6('0x1b')](_0x4fa2ca['query'][_0x82f6('0x1b')]);_0x259d83[_0x82f6('0x19')]=qs[_0x82f6('0x19')](_0x4fa2ca[_0x82f6('0x2c')][_0x82f6('0x19')]);}return _0x33c359[_0x82f6('0x48')](_0x259d83);}})[_0x82f6('0x22')](function(_0x17389a){if(_0x17389a){return _0x17389a?{'count':_0x4f69de,'rows':_0x17389a}:null;}})['then'](respondWithResult(_0x2e6b03,null))[_0x82f6('0x47')](handleError(_0x2e6b03,null));};exports['addConfiguration']=function(_0x3f0337,_0x85ea2e,_0x4e51a6){if(_0x3f0337[_0x82f6('0x46')]['id']){delete _0x3f0337[_0x82f6('0x46')]['id'];}return db[_0x82f6('0x27')]['findOne']({'where':{'id':_0x3f0337['params']['id']}})[_0x82f6('0x22')](handleEntityNotFound(_0x85ea2e,null))[_0x82f6('0x22')](function(_0x58b96b){if(_0x58b96b){_0x3f0337['body'][_0x82f6('0x49')]=_0x58b96b['id'];_0x3f0337[_0x82f6('0x46')][_0x82f6('0x4a')]=integrations[_0x82f6('0x4b')](_0x3f0337[_0x82f6('0x46')][_0x82f6('0x4c')],_0x3f0337[_0x82f6('0x46')][_0x82f6('0x2a')]);_0x3f0337[_0x82f6('0x46')][_0x82f6('0x4d')]=integrations[_0x82f6('0x4e')](_0x3f0337[_0x82f6('0x46')]['channel'],_0x3f0337[_0x82f6('0x46')][_0x82f6('0x2a')]);return db[_0x82f6('0x4f')][_0x82f6('0x45')](_0x3f0337[_0x82f6('0x46')],{'include':[{'model':db['ZendeskField'],'as':_0x82f6('0x4a')},{'model':db[_0x82f6('0x50')],'as':_0x82f6('0x4d')}]});}return null;})['then'](respondWithResult(_0x85ea2e,null))[_0x82f6('0x47')](handleError(_0x85ea2e,null));};exports[_0x82f6('0x51')]=function(_0x17924d,_0x27a79c,_0xeec407){var _0x39a4b3='';return db[_0x82f6('0x27')]['findOne']({'where':{'id':_0x17924d[_0x82f6('0x42')]['id']},'attributes':['id','username',_0x82f6('0x52'),_0x82f6('0x53'),_0x82f6('0x54'),_0x82f6('0x55')]})[_0x82f6('0x22')](handleEntityNotFound(_0x27a79c,null))[_0x82f6('0x22')](function(_0x2d8721){if(_0x2d8721){_0x39a4b3=_0x2d8721[_0x82f6('0x55')];var _0x30b903=_0x39a4b3['slice'](-0x1);if(_0x30b903==='/'){_0x39a4b3=_0x39a4b3[_0x82f6('0x56')](0x0,_0x39a4b3[_0x82f6('0x57')](_0x30b903));}var _0x33cc55={'method':_0x82f6('0x58'),'uri':util[_0x82f6('0x59')](_0x82f6('0x5a'),_0x39a4b3,'ticket_fields'),'json':!![]};switch(_0x2d8721[_0x82f6('0x54')]){case _0x82f6('0x52'):_0x33cc55['headers']={'Authorization':util['format'](_0x82f6('0x5b'),new Buffer(util[_0x82f6('0x59')](_0x82f6('0x5c'),_0x2d8721[_0x82f6('0x5d')],_0x2d8721[_0x82f6('0x52')]))[_0x82f6('0x5e')]('base64'))};break;case _0x82f6('0x53'):_0x33cc55['headers']={'Authorization':util[_0x82f6('0x59')]('Basic\x20%s',new Buffer(util[_0x82f6('0x59')]('%s/token:%s',_0x2d8721[_0x82f6('0x5d')],_0x2d8721[_0x82f6('0x53')]))[_0x82f6('0x5e')]('base64'))};break;default:throw new db[(_0x82f6('0x5f'))]['ValidationError'](_0x82f6('0x60'));}return rp(_0x33cc55);}})[_0x82f6('0x22')](function(_0x3e69f6){if(_0x3e69f6){var _0x4d1bfd=[_0x82f6('0x61'),_0x82f6('0x62'),_0x82f6('0x63'),'assignee'];_['remove'](_0x3e69f6[_0x82f6('0x64')],function(_0x30327a){return _0x4d1bfd[_0x82f6('0x65')](_0x30327a[_0x82f6('0x2a')]);});return{'count':_0x3e69f6[_0x82f6('0x64')][_0x82f6('0x32')],'rows':_[_0x82f6('0x26')](_0x3e69f6[_0x82f6('0x64')],function(_0x4df767){return{'id':_0x4df767['id'],'name':_0x4df767[_0x82f6('0x66')]>0x7?_0x4df767[_0x82f6('0x67')]:_0x4df767['type'],'custom':_0x4df767[_0x82f6('0x66')]>0x7?!![]:![],'options':_0x4df767[_0x82f6('0x68')]?_0x4df767[_0x82f6('0x68')]:_0x4df767['custom_field_options']?_0x4df767[_0x82f6('0x69')]:[]};})};}})[_0x82f6('0x22')](respondWithResult(_0x27a79c,null))[_0x82f6('0x47')](function(_0x2cc906){var _0x50ab5c=_0x17924d[_0x82f6('0x2c')][_0x82f6('0x6a')]?0x1f4:_0x2cc906[_0x82f6('0x6b')]||0x1f4;logger[_0x82f6('0x6c')](_0x82f6('0x6d'),_0x82f6('0x51'),_0x50ab5c,JSON['stringify'](_0x2cc906));delete _0x2cc906[_0x82f6('0x24')];if(_0x50ab5c===0x191){_0x50ab5c=0x190;}_0x27a79c[_0x82f6('0x17')](_0x50ab5c)[_0x82f6('0x6e')](_0x17924d[_0x82f6('0x2c')][_0x82f6('0x6a')]?{'message':'Wrong\x20credentials','statusCode':_0x2cc906[_0x82f6('0x6b')]}:_0x2cc906);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 179c716..a07c306 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 _0xa219=['rimraf','../../config/environment','./intZendeskAccount.attributes','define','ZendeskAccount','int_zendesk_accounts','lodash','util','api','moment','bluebird','request-promise'];(function(_0x1ac77b,_0x10ee7a){var _0x161584=function(_0x5a810d){while(--_0x5a810d){_0x1ac77b['push'](_0x1ac77b['shift']());}};_0x161584(++_0x10ee7a);}(_0xa219,0x14a));var _0x9a21=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0xa219[_0x209941];return _0x1e8729;};'use strict';var _=require(_0x9a21('0x0'));var util=require(_0x9a21('0x1'));var logger=require('../../config/logger')(_0x9a21('0x2'));var moment=require(_0x9a21('0x3'));var BPromise=require(_0x9a21('0x4'));var rp=require(_0x9a21('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9a21('0x6'));var config=require(_0x9a21('0x7'));var attributes=require(_0x9a21('0x8'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x190c7a,_0x18fc96){return _0x190c7a[_0x9a21('0x9')](_0x9a21('0xa'),attributes,{'tableName':_0x9a21('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf71e=['bluebird','request-promise','rimraf','../../config/environment','../../components/integrations/configuration','define','ZendeskAccount','int_zendesk_accounts','lodash','util','../../config/logger','api','moment'];(function(_0x18175f,_0x459e62){var _0xa43fa9=function(_0x5e9ce4){while(--_0x5e9ce4){_0x18175f['push'](_0x18175f['shift']());}};_0xa43fa9(++_0x459e62);}(_0xf71e,0x18e));var _0xef71=function(_0x18a436,_0x1dbe06){_0x18a436=_0x18a436-0x0;var _0x5c2cf8=_0xf71e[_0x18a436];return _0x5c2cf8;};'use strict';var _=require(_0xef71('0x0'));var util=require(_0xef71('0x1'));var logger=require(_0xef71('0x2'))(_0xef71('0x3'));var moment=require(_0xef71('0x4'));var BPromise=require(_0xef71('0x5'));var rp=require(_0xef71('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xef71('0x7'));var config=require(_0xef71('0x8'));var attributes=require('./intZendeskAccount.attributes');var integrations=require(_0xef71('0x9'));module['exports']=function(_0x3da44b,_0x2627c1){return _0x3da44b[_0xef71('0xa')](_0xef71('0xb'),attributes,{'tableName':_0xef71('0xc'),'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 1dbf7ac..07241c8 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 _0xef64=['ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','catch','GetZendeskAccount','ZendeskAccount','findAll','options','raw','where','attributes','limit','include','model','map','stringify','ShowZendeskAccount','find','then','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info'];(function(_0x681da9,_0x3e6cad){var _0x3dc903=function(_0x450f49){while(--_0x450f49){_0x681da9['push'](_0x681da9['shift']());}};_0x3dc903(++_0x3e6cad);}(_0xef64,0x137));var _0x4ef6=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0xef64[_0x4a53d];return _0x27410e;};'use strict';var _=require('lodash');var util=require(_0x4ef6('0x0'));var moment=require('moment');var BPromise=require(_0x4ef6('0x1'));var rs=require(_0x4ef6('0x2'));var fs=require('fs');var Redis=require(_0x4ef6('0x3'));var db=require(_0x4ef6('0x4'))['db'];var utils=require(_0x4ef6('0x5'));var logger=require('../../config/logger')(_0x4ef6('0x6'));var config=require(_0x4ef6('0x7'));var jayson=require(_0x4ef6('0x8'));var client=jayson[_0x4ef6('0x9')][_0x4ef6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5a9859,_0x48638a,_0x2597ba){return new BPromise(function(_0x5bf9f5,_0x15db51){return client[_0x4ef6('0xb')](_0x5a9859,_0x2597ba)['then'](function(_0x3f3655){logger[_0x4ef6('0xc')](_0x4ef6('0xd'),_0x48638a,_0x4ef6('0xe'));logger[_0x4ef6('0xf')](_0x4ef6('0x10'),_0x48638a,'request\x20sent',JSON['stringify'](_0x3f3655));if(_0x3f3655['error']){if(_0x3f3655[_0x4ef6('0x11')][_0x4ef6('0x12')]===0x1f4){logger[_0x4ef6('0x11')](_0x4ef6('0xd'),_0x48638a,_0x3f3655[_0x4ef6('0x11')][_0x4ef6('0x13')]);return _0x15db51(_0x3f3655[_0x4ef6('0x11')]['message']);}logger[_0x4ef6('0x11')](_0x4ef6('0xd'),_0x48638a,_0x3f3655['error'][_0x4ef6('0x13')]);return _0x5bf9f5(_0x3f3655[_0x4ef6('0x11')][_0x4ef6('0x13')]);}else{logger['info'](_0x4ef6('0xd'),_0x48638a,'request\x20sent');_0x5bf9f5(_0x3f3655['result'][_0x4ef6('0x13')]);}})[_0x4ef6('0x14')](function(_0x37f995){logger[_0x4ef6('0x11')]('ZendeskAccount,\x20%s,\x20%s',_0x48638a,_0x37f995);_0x15db51(_0x37f995);});});}exports[_0x4ef6('0x15')]=function(_0x27c432){var _0x27e17b=this;return new Promise(function(_0x4463cd,_0xcc9437){return db[_0x4ef6('0x16')][_0x4ef6('0x17')]({'raw':_0x27c432[_0x4ef6('0x18')]?_0x27c432[_0x4ef6('0x18')][_0x4ef6('0x19')]===undefined?!![]:![]:!![],'where':_0x27c432[_0x4ef6('0x18')]?_0x27c432[_0x4ef6('0x18')][_0x4ef6('0x1a')]||null:null,'attributes':_0x27c432[_0x4ef6('0x18')]?_0x27c432[_0x4ef6('0x18')][_0x4ef6('0x1b')]||null:null,'limit':_0x27c432[_0x4ef6('0x18')]?_0x27c432['options'][_0x4ef6('0x1c')]||null:null,'include':_0x27c432[_0x4ef6('0x18')]?_0x27c432[_0x4ef6('0x18')][_0x4ef6('0x1d')]?_['map'](_0x27c432[_0x4ef6('0x18')]['include'],function(_0x48e5eb){return{'model':db[_0x48e5eb[_0x4ef6('0x1e')]],'as':_0x48e5eb['as'],'attributes':_0x48e5eb[_0x4ef6('0x1b')],'include':_0x48e5eb[_0x4ef6('0x1d')]?_[_0x4ef6('0x1f')](_0x48e5eb[_0x4ef6('0x1d')],function(_0x4c8ab7){return{'model':db[_0x4c8ab7[_0x4ef6('0x1e')]],'as':_0x4c8ab7['as'],'attributes':_0x4c8ab7[_0x4ef6('0x1b')],'include':_0x4c8ab7[_0x4ef6('0x1d')]?_[_0x4ef6('0x1f')](_0x4c8ab7[_0x4ef6('0x1d')],function(_0x5a5737){return{'model':db[_0x5a5737[_0x4ef6('0x1e')]],'as':_0x5a5737['as'],'attributes':_0x5a5737['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x31f652){logger['info'](_0x4ef6('0x15'),_0x27c432);logger[_0x4ef6('0xf')](_0x4ef6('0x15'),_0x27c432,JSON[_0x4ef6('0x20')](_0x31f652));_0x4463cd(_0x31f652);})['catch'](function(_0x300863){logger[_0x4ef6('0x11')](_0x4ef6('0x15'),_0x300863[_0x4ef6('0x13')],_0x27c432);_0xcc9437(_0x27e17b[_0x4ef6('0x11')](0x1f4,_0x300863[_0x4ef6('0x13')]));});});};exports[_0x4ef6('0x21')]=function(_0x36f9da){var _0x23396b=this;return new Promise(function(_0x4bca1b,_0x4a1656){return db[_0x4ef6('0x16')][_0x4ef6('0x22')]({'raw':_0x36f9da['options']?_0x36f9da[_0x4ef6('0x18')][_0x4ef6('0x19')]===undefined?!![]:![]:!![],'where':_0x36f9da[_0x4ef6('0x18')]?_0x36f9da[_0x4ef6('0x18')]['where']||null:null,'attributes':_0x36f9da[_0x4ef6('0x18')]?_0x36f9da[_0x4ef6('0x18')][_0x4ef6('0x1b')]||null:null,'include':_0x36f9da[_0x4ef6('0x18')]?_0x36f9da[_0x4ef6('0x18')][_0x4ef6('0x1d')]?_[_0x4ef6('0x1f')](_0x36f9da['options']['include'],function(_0x264579){return{'model':db[_0x264579[_0x4ef6('0x1e')]],'as':_0x264579['as'],'attributes':_0x264579[_0x4ef6('0x1b')],'include':_0x264579[_0x4ef6('0x1d')]?_[_0x4ef6('0x1f')](_0x264579[_0x4ef6('0x1d')],function(_0x20ca86){return{'model':db[_0x20ca86['model']],'as':_0x20ca86['as'],'attributes':_0x20ca86[_0x4ef6('0x1b')],'include':_0x20ca86[_0x4ef6('0x1d')]?_['map'](_0x20ca86['include'],function(_0x3c3b1e){return{'model':db[_0x3c3b1e[_0x4ef6('0x1e')]],'as':_0x3c3b1e['as'],'attributes':_0x3c3b1e[_0x4ef6('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x4ef6('0x23')](function(_0x5c70ad){logger[_0x4ef6('0xc')](_0x4ef6('0x21'),_0x36f9da);logger[_0x4ef6('0xf')](_0x4ef6('0x21'),_0x36f9da,JSON[_0x4ef6('0x20')](_0x5c70ad));_0x4bca1b(_0x5c70ad);})[_0x4ef6('0x14')](function(_0x2458e7){logger['error']('ShowZendeskAccount',_0x2458e7[_0x4ef6('0x13')],_0x36f9da);_0x4a1656(_0x23396b[_0x4ef6('0x11')](0x1f4,_0x2458e7[_0x4ef6('0x13')]));});});}; \ No newline at end of file +var _0x00b3=['options','raw','where','limit','include','map','model','attributes','ShowZendeskAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','ZendeskAccount,\x20%s,\x20%s','message','request\x20sent','result','catch','GetZendeskAccount','ZendeskAccount','findAll'];(function(_0x4b7895,_0x3c4f5d){var _0x264180=function(_0xe0e861){while(--_0xe0e861){_0x4b7895['push'](_0x4b7895['shift']());}};_0x264180(++_0x3c4f5d);}(_0x00b3,0x157));var _0x300b=function(_0x2e3c98,_0x5519e9){_0x2e3c98=_0x2e3c98-0x0;var _0xf81b0c=_0x00b3[_0x2e3c98];return _0xf81b0c;};'use strict';var _=require(_0x300b('0x0'));var util=require(_0x300b('0x1'));var moment=require(_0x300b('0x2'));var BPromise=require(_0x300b('0x3'));var rs=require(_0x300b('0x4'));var fs=require('fs');var Redis=require(_0x300b('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x300b('0x6'));var logger=require(_0x300b('0x7'))('rpc');var config=require(_0x300b('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x300b('0x9')][_0x300b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2533d3,_0x2caa7c,_0x291829){return new BPromise(function(_0x5501f7,_0x3aa555){return client[_0x300b('0xb')](_0x2533d3,_0x291829)[_0x300b('0xc')](function(_0xe6e730){logger[_0x300b('0xd')]('ZendeskAccount,\x20%s,\x20%s',_0x2caa7c,'request\x20sent');logger[_0x300b('0xe')](_0x300b('0xf'),_0x2caa7c,'request\x20sent',JSON[_0x300b('0x10')](_0xe6e730));if(_0xe6e730[_0x300b('0x11')]){if(_0xe6e730['error'][_0x300b('0x12')]===0x1f4){logger[_0x300b('0x11')](_0x300b('0x13'),_0x2caa7c,_0xe6e730[_0x300b('0x11')][_0x300b('0x14')]);return _0x3aa555(_0xe6e730[_0x300b('0x11')][_0x300b('0x14')]);}logger[_0x300b('0x11')](_0x300b('0x13'),_0x2caa7c,_0xe6e730['error']['message']);return _0x5501f7(_0xe6e730[_0x300b('0x11')][_0x300b('0x14')]);}else{logger['info']('ZendeskAccount,\x20%s,\x20%s',_0x2caa7c,_0x300b('0x15'));_0x5501f7(_0xe6e730[_0x300b('0x16')][_0x300b('0x14')]);}})[_0x300b('0x17')](function(_0x438bf4){logger[_0x300b('0x11')](_0x300b('0x13'),_0x2caa7c,_0x438bf4);_0x3aa555(_0x438bf4);});});}exports[_0x300b('0x18')]=function(_0x5be041){var _0x3909a3=this;return new Promise(function(_0x3860ab,_0x1a0224){return db[_0x300b('0x19')][_0x300b('0x1a')]({'raw':_0x5be041[_0x300b('0x1b')]?_0x5be041['options'][_0x300b('0x1c')]===undefined?!![]:![]:!![],'where':_0x5be041['options']?_0x5be041[_0x300b('0x1b')][_0x300b('0x1d')]||null:null,'attributes':_0x5be041['options']?_0x5be041[_0x300b('0x1b')]['attributes']||null:null,'limit':_0x5be041[_0x300b('0x1b')]?_0x5be041['options'][_0x300b('0x1e')]||null:null,'include':_0x5be041[_0x300b('0x1b')]?_0x5be041['options'][_0x300b('0x1f')]?_[_0x300b('0x20')](_0x5be041['options'][_0x300b('0x1f')],function(_0x516c25){return{'model':db[_0x516c25[_0x300b('0x21')]],'as':_0x516c25['as'],'attributes':_0x516c25[_0x300b('0x22')],'include':_0x516c25[_0x300b('0x1f')]?_[_0x300b('0x20')](_0x516c25[_0x300b('0x1f')],function(_0x29ba9e){return{'model':db[_0x29ba9e[_0x300b('0x21')]],'as':_0x29ba9e['as'],'attributes':_0x29ba9e['attributes'],'include':_0x29ba9e[_0x300b('0x1f')]?_[_0x300b('0x20')](_0x29ba9e['include'],function(_0x42913a){return{'model':db[_0x42913a['model']],'as':_0x42913a['as'],'attributes':_0x42913a[_0x300b('0x22')]};}):[]};}):[]};}):[]:[]})[_0x300b('0xc')](function(_0x3b4b5b){logger[_0x300b('0xd')](_0x300b('0x18'),_0x5be041);logger[_0x300b('0xe')](_0x300b('0x18'),_0x5be041,JSON['stringify'](_0x3b4b5b));_0x3860ab(_0x3b4b5b);})[_0x300b('0x17')](function(_0x395066){logger[_0x300b('0x11')](_0x300b('0x18'),_0x395066[_0x300b('0x14')],_0x5be041);_0x1a0224(_0x3909a3[_0x300b('0x11')](0x1f4,_0x395066['message']));});});};exports[_0x300b('0x23')]=function(_0x3c0d46){var _0x363261=this;return new Promise(function(_0x2390b5,_0x3e37a1){return db['ZendeskAccount'][_0x300b('0x24')]({'raw':_0x3c0d46[_0x300b('0x1b')]?_0x3c0d46[_0x300b('0x1b')][_0x300b('0x1c')]===undefined?!![]:![]:!![],'where':_0x3c0d46[_0x300b('0x1b')]?_0x3c0d46['options'][_0x300b('0x1d')]||null:null,'attributes':_0x3c0d46[_0x300b('0x1b')]?_0x3c0d46[_0x300b('0x1b')][_0x300b('0x22')]||null:null,'include':_0x3c0d46[_0x300b('0x1b')]?_0x3c0d46[_0x300b('0x1b')][_0x300b('0x1f')]?_['map'](_0x3c0d46['options'][_0x300b('0x1f')],function(_0x54978c){return{'model':db[_0x54978c[_0x300b('0x21')]],'as':_0x54978c['as'],'attributes':_0x54978c['attributes'],'include':_0x54978c['include']?_[_0x300b('0x20')](_0x54978c[_0x300b('0x1f')],function(_0x4c5832){return{'model':db[_0x4c5832[_0x300b('0x21')]],'as':_0x4c5832['as'],'attributes':_0x4c5832['attributes'],'include':_0x4c5832[_0x300b('0x1f')]?_[_0x300b('0x20')](_0x4c5832['include'],function(_0xc5a0af){return{'model':db[_0xc5a0af['model']],'as':_0xc5a0af['as'],'attributes':_0xc5a0af['attributes']};}):[]};}):[]};}):[]:[]})[_0x300b('0xc')](function(_0x4bd4e6){logger[_0x300b('0xd')](_0x300b('0x23'),_0x3c0d46);logger[_0x300b('0xe')](_0x300b('0x23'),_0x3c0d46,JSON[_0x300b('0x10')](_0x4bd4e6));_0x2390b5(_0x4bd4e6);})['catch'](function(_0x34b42e){logger['error'](_0x300b('0x23'),_0x34b42e['message'],_0x3c0d46);_0x3e37a1(_0x363261[_0x300b('0x11')](0x1f4,_0x34b42e[_0x300b('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 3883f44..74f783d 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 _0x9ffd=['update','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intZendeskConfiguration.controller','isAuthenticated','index','get','/:id','show','/:id/fields','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','create','post','put'];(function(_0x2dd976,_0x1b5dc4){var _0x2265fd=function(_0x270d24){while(--_0x270d24){_0x2dd976['push'](_0x2dd976['shift']());}};_0x2265fd(++_0x1b5dc4);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x253714,_0x476a20){_0x253714=_0x253714-0x0;var _0x381e2f=_0x9ffd[_0x253714];return _0x381e2f;};'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['getFields']);router['get']('/:id/subjects',auth['isAuthenticated'](),controller[_0xd9ff('0xf')]);router[_0xd9ff('0xb')](_0xd9ff('0x10'),auth[_0xd9ff('0x9')](),controller[_0xd9ff('0x11')]);router[_0xd9ff('0xb')](_0xd9ff('0x12'),auth[_0xd9ff('0x9')](),controller['getTags']);router['post']('/',auth[_0xd9ff('0x9')](),controller[_0xd9ff('0x13')]);router[_0xd9ff('0x14')](_0xd9ff('0x12'),auth[_0xd9ff('0x9')](),controller['setTags']);router[_0xd9ff('0x15')](_0xd9ff('0xc'),auth['isAuthenticated'](),controller[_0xd9ff('0x16')]);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xd9ff('0x17')]=router; \ No newline at end of file +var _0x7916=['getDescriptions','get','/:id/tags','getTags','post','create','setTags','update','delete','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intZendeskConfiguration.controller','isAuthenticated','index','/:id','show','getFields','/:id/subjects','getSubjects','/:id/descriptions'];(function(_0x162c89,_0x3bfbe9){var _0x42cf58=function(_0x3bd0ae){while(--_0x3bd0ae){_0x162c89['push'](_0x162c89['shift']());}};_0x42cf58(++_0x3bfbe9);}(_0x7916,0x128));var _0x6791=function(_0x23d42c,_0x274123){_0x23d42c=_0x23d42c-0x0;var _0x4054d9=_0x7916[_0x23d42c];return _0x4054d9;};'use strict';var multer=require(_0x6791('0x0'));var util=require('util');var path=require(_0x6791('0x1'));var timeout=require(_0x6791('0x2'));var express=require('express');var router=express[_0x6791('0x3')]();var fs_extra=require(_0x6791('0x4'));var auth=require(_0x6791('0x5'));var interaction=require(_0x6791('0x6'));var config=require('../../config/environment');var controller=require(_0x6791('0x7'));router['get']('/',auth[_0x6791('0x8')](),controller[_0x6791('0x9')]);router['get'](_0x6791('0xa'),auth['isAuthenticated'](),controller[_0x6791('0xb')]);router['get']('/:id/fields',auth[_0x6791('0x8')](),controller[_0x6791('0xc')]);router['get'](_0x6791('0xd'),auth[_0x6791('0x8')](),controller[_0x6791('0xe')]);router['get'](_0x6791('0xf'),auth[_0x6791('0x8')](),controller[_0x6791('0x10')]);router[_0x6791('0x11')](_0x6791('0x12'),auth[_0x6791('0x8')](),controller[_0x6791('0x13')]);router[_0x6791('0x14')]('/',auth[_0x6791('0x8')](),controller[_0x6791('0x15')]);router[_0x6791('0x14')]('/:id/tags',auth['isAuthenticated'](),controller[_0x6791('0x16')]);router['put'](_0x6791('0xa'),auth['isAuthenticated'](),controller[_0x6791('0x17')]);router[_0x6791('0x18')]('/:id',auth[_0x6791('0x8')](),controller['destroy']);module[_0x6791('0x19')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index e5074f7..e795622 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 _0xeff9=['exports','STRING','sequelize'];(function(_0x3995c9,_0x5d95f1){var _0xdfa9cf=function(_0x300805){while(--_0x300805){_0x3995c9['push'](_0x3995c9['shift']());}};_0xdfa9cf(++_0x5d95f1);}(_0xeff9,0x110));var _0x9eff=function(_0x5d2588,_0x2153ca){_0x5d2588=_0x5d2588-0x0;var _0x5ca50e=_0xeff9[_0x5d2588];return _0x5ca50e;};'use strict';var Sequelize=require(_0x9eff('0x0'));module[_0x9eff('0x1')]={'name':{'type':Sequelize[_0x9eff('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x9aa2=['sequelize','exports','STRING'];(function(_0x252d3d,_0x3f1b43){var _0x1e0db3=function(_0x29fde7){while(--_0x29fde7){_0x252d3d['push'](_0x252d3d['shift']());}};_0x1e0db3(++_0x3f1b43);}(_0x9aa2,0x141));var _0x29aa=function(_0x414252,_0x323788){_0x414252=_0x414252-0x0;var _0x23b94b=_0x9aa2[_0x414252];return _0x23b94b;};'use strict';var Sequelize=require(_0x29aa('0x0'));module[_0x29aa('0x1')]={'name':{'type':Sequelize[_0x29aa('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 d705ac3..02178af 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 _0x548a=['map','rawAttributes','fieldName','type','key','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','merge','filter','options','includeAll','include','ZendeskConfiguration','findAll','catch','show','params','find','create','update','body','destroy','getFields','findOne','ZendeskField','getSubjects','pick','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','then','end','error','stack','name','send','index'];(function(_0x4480b9,_0x5c2949){var _0x3f0f02=function(_0x43502f){while(--_0x43502f){_0x4480b9['push'](_0x4480b9['shift']());}};_0x3f0f02(++_0x5c2949);}(_0x548a,0x81));var _0xa548=function(_0x2a96b6,_0x51e78c){_0x2a96b6=_0x2a96b6-0x0;var _0x59c0de=_0x548a[_0x2a96b6];return _0x59c0de;};'use strict';var emlformat=require(_0xa548('0x0'));var rimraf=require(_0xa548('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa548('0x2'));var rp=require(_0xa548('0x3'));var moment=require(_0xa548('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xa548('0x5'));var util=require(_0xa548('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xa548('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa548('0x8'));var _=require(_0xa548('0x9'));var squel=require(_0xa548('0xa'));var crypto=require(_0xa548('0xb'));var jsforce=require(_0xa548('0xc'));var deskjs=require(_0xa548('0xd'));var toCsv=require(_0xa548('0x7'));var querystring=require(_0xa548('0xe'));var Papa=require(_0xa548('0xf'));var Redis=require(_0xa548('0x10'));var authService=require(_0xa548('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xa548('0x12'));var hardwareService=require(_0xa548('0x13'));var logger=require(_0xa548('0x14'))(_0xa548('0x15'));var utils=require('../../config/utils');var config=require(_0xa548('0x16'));var licenseUtil=require(_0xa548('0x17'));var db=require(_0xa548('0x18'))['db'];function respondWithStatusCode(_0x5dbc03,_0x524921){_0x524921=_0x524921||0xcc;return function(_0xe642ed){if(_0xe642ed){return _0x5dbc03[_0xa548('0x19')](_0x524921);}return _0x5dbc03[_0xa548('0x1a')](_0x524921)['end']();};}function respondWithResult(_0x1486f6,_0x3479d4){_0x3479d4=_0x3479d4||0xc8;return function(_0x567263){if(_0x567263){return _0x1486f6[_0xa548('0x1a')](_0x3479d4)[_0xa548('0x1b')](_0x567263);}};}function respondWithFilteredResult(_0x3a6010,_0x331bc5){return function(_0x1a9542){if(_0x1a9542){var _0x2f5459=typeof _0x331bc5[_0xa548('0x1c')]===_0xa548('0x1d')&&typeof _0x331bc5[_0xa548('0x1e')]==='undefined';var _0x20d7a2=_0x1a9542[_0xa548('0x1f')];var _0xa4d627=_0x2f5459?0x0:_0x331bc5[_0xa548('0x1c')];var _0x507b99=_0x2f5459?_0x1a9542[_0xa548('0x1f')]:_0x331bc5[_0xa548('0x1c')]+_0x331bc5[_0xa548('0x1e')];var _0x2853be;if(_0x507b99>=_0x20d7a2){_0x507b99=_0x20d7a2;_0x2853be=0xc8;}else{_0x2853be=0xce;}_0x3a6010[_0xa548('0x1a')](_0x2853be);return _0x3a6010[_0xa548('0x20')]('Content-Range',_0xa4d627+'-'+_0x507b99+'/'+_0x20d7a2)[_0xa548('0x1b')](_0x1a9542);}return null;};}function patchUpdates(_0x198473){return function(_0xa47e60){try{jsonpatch[_0xa548('0x21')](_0xa47e60,_0x198473,!![]);}catch(_0x370078){return BPromise[_0xa548('0x22')](_0x370078);}return _0xa47e60[_0xa548('0x23')]();};}function saveUpdates(_0xe74f91,_0xd9df3b){return function(_0x10c5fb){if(_0x10c5fb){return _0x10c5fb['update'](_0xe74f91)['then'](function(_0x226dde){return _0x226dde;});}return null;};}function removeEntity(_0x24bfba,_0x1cf248){return function(_0x2367d4){if(_0x2367d4){return _0x2367d4['destroy']()[_0xa548('0x24')](function(){_0x24bfba[_0xa548('0x1a')](0xcc)[_0xa548('0x25')]();});}};}function handleEntityNotFound(_0x2cceba,_0x328d47){return function(_0xbc6f00){if(!_0xbc6f00){_0x2cceba[_0xa548('0x19')](0x194);}return _0xbc6f00;};}function handleError(_0x34be20,_0x4bd87d){_0x4bd87d=_0x4bd87d||0x1f4;return function(_0x36a391){logger[_0xa548('0x26')](_0x36a391[_0xa548('0x27')]);if(_0x36a391[_0xa548('0x28')]){delete _0x36a391[_0xa548('0x28')];}_0x34be20[_0xa548('0x1a')](_0x4bd87d)[_0xa548('0x29')](_0x36a391);};}exports[_0xa548('0x2a')]=function(_0x1254dd,_0x25be58){var _0x16c8e9={},_0x108811={},_0x3cfb31={'count':0x0,'rows':[]};var _0x1db6bf=_[_0xa548('0x2b')](db['ZendeskConfiguration'][_0xa548('0x2c')],function(_0x2d0c90){return{'name':_0x2d0c90[_0xa548('0x2d')],'type':_0x2d0c90[_0xa548('0x2e')][_0xa548('0x2f')]};});_0x108811['model']=_[_0xa548('0x2b')](_0x1db6bf,_0xa548('0x28'));_0x108811[_0xa548('0x30')]=_[_0xa548('0x31')](_0x1254dd['query']);_0x108811['filters']=_[_0xa548('0x32')](_0x108811[_0xa548('0x33')],_0x108811['query']);_0x16c8e9['attributes']=_['intersection'](_0x108811[_0xa548('0x33')],qs[_0xa548('0x34')](_0x1254dd['query']['fields']));_0x16c8e9[_0xa548('0x35')]=_0x16c8e9[_0xa548('0x35')][_0xa548('0x36')]?_0x16c8e9['attributes']:_0x108811[_0xa548('0x33')];if(!_0x1254dd[_0xa548('0x30')][_0xa548('0x37')](_0xa548('0x38'))){_0x16c8e9['limit']=qs['limit'](_0x1254dd[_0xa548('0x30')]['limit']);_0x16c8e9[_0xa548('0x1c')]=qs['offset'](_0x1254dd[_0xa548('0x30')][_0xa548('0x1c')]);}_0x16c8e9[_0xa548('0x39')]=qs[_0xa548('0x3a')](_0x1254dd['query'][_0xa548('0x3a')]);_0x16c8e9[_0xa548('0x3b')]=qs[_0xa548('0x3c')](_['pick'](_0x1254dd[_0xa548('0x30')],_0x108811[_0xa548('0x3c')]),_0x1db6bf);if(_0x1254dd[_0xa548('0x30')]['filter']){_0x16c8e9[_0xa548('0x3b')]=_[_0xa548('0x3d')](_0x16c8e9[_0xa548('0x3b')],{'$or':_['map'](_0x1db6bf,function(_0x2a7645){if(_0x2a7645['type']!=='VIRTUAL'){var _0x112fef={};_0x112fef[_0x2a7645['name']]={'$like':'%'+_0x1254dd['query'][_0xa548('0x3e')]+'%'};return _0x112fef;}})});}_0x16c8e9=_[_0xa548('0x3d')]({},_0x16c8e9,_0x1254dd[_0xa548('0x3f')]);var _0x414e94={'where':_0x16c8e9[_0xa548('0x3b')]};return db['ZendeskConfiguration'][_0xa548('0x1f')](_0x414e94)['then'](function(_0x1314ce){_0x3cfb31[_0xa548('0x1f')]=_0x1314ce;if(_0x1254dd['query'][_0xa548('0x40')]){_0x16c8e9[_0xa548('0x41')]=[{'all':!![]}];}return db[_0xa548('0x42')][_0xa548('0x43')](_0x16c8e9);})[_0xa548('0x24')](function(_0x42270c){_0x3cfb31['rows']=_0x42270c;return _0x3cfb31;})[_0xa548('0x24')](respondWithFilteredResult(_0x25be58,_0x16c8e9))[_0xa548('0x44')](handleError(_0x25be58,null));};exports[_0xa548('0x45')]=function(_0x2519a4,_0x22a4c7){var _0x590d47={'raw':![],'where':{'id':_0x2519a4[_0xa548('0x46')]['id']}},_0x85fc05={};_0x85fc05[_0xa548('0x33')]=_[_0xa548('0x31')](db['ZendeskConfiguration']['rawAttributes']);_0x85fc05[_0xa548('0x30')]=_[_0xa548('0x31')](_0x2519a4[_0xa548('0x30')]);_0x85fc05[_0xa548('0x3c')]=_['intersection'](_0x85fc05[_0xa548('0x33')],_0x85fc05[_0xa548('0x30')]);_0x590d47[_0xa548('0x35')]=_[_0xa548('0x32')](_0x85fc05[_0xa548('0x33')],qs[_0xa548('0x34')](_0x2519a4[_0xa548('0x30')]['fields']));_0x590d47['attributes']=_0x590d47['attributes'][_0xa548('0x36')]?_0x590d47[_0xa548('0x35')]:_0x85fc05[_0xa548('0x33')];if(_0x2519a4[_0xa548('0x30')][_0xa548('0x40')]){_0x590d47[_0xa548('0x41')]=[{'all':!![]}];}_0x590d47=_['merge']({},_0x590d47,_0x2519a4[_0xa548('0x3f')]);return db[_0xa548('0x42')][_0xa548('0x47')](_0x590d47)[_0xa548('0x24')](handleEntityNotFound(_0x22a4c7,null))['then'](respondWithResult(_0x22a4c7,null))[_0xa548('0x44')](handleError(_0x22a4c7,null));};exports[_0xa548('0x48')]=function(_0x4bdfd1,_0x2a8c25){return db[_0xa548('0x42')]['create'](_0x4bdfd1['body'],{})[_0xa548('0x24')](respondWithResult(_0x2a8c25,0xc9))[_0xa548('0x44')](handleError(_0x2a8c25,null));};exports[_0xa548('0x49')]=function(_0x51b71f,_0x189eda){if(_0x51b71f[_0xa548('0x4a')]['id']){delete _0x51b71f[_0xa548('0x4a')]['id'];}return db['ZendeskConfiguration'][_0xa548('0x47')]({'where':{'id':_0x51b71f[_0xa548('0x46')]['id']}})[_0xa548('0x24')](handleEntityNotFound(_0x189eda,null))[_0xa548('0x24')](saveUpdates(_0x51b71f['body'],null))[_0xa548('0x24')](respondWithResult(_0x189eda,null))[_0xa548('0x44')](handleError(_0x189eda,null));};exports[_0xa548('0x4b')]=function(_0x1c6721,_0x4101d7){return db[_0xa548('0x42')][_0xa548('0x47')]({'where':{'id':_0x1c6721['params']['id']}})[_0xa548('0x24')](handleEntityNotFound(_0x4101d7,null))[_0xa548('0x24')](removeEntity(_0x4101d7,null))['catch'](handleError(_0x4101d7,null));};exports[_0xa548('0x4c')]=function(_0x2d7cdc,_0x1343a0,_0x53fe63){var _0x3d7f26={};var _0x21bfb5={};var _0x59479b;var _0x488d43;return db[_0xa548('0x42')][_0xa548('0x4d')]({'where':{'id':_0x2d7cdc[_0xa548('0x46')]['id']}})[_0xa548('0x24')](handleEntityNotFound(_0x1343a0,null))[_0xa548('0x24')](function(_0x31c3a8){if(_0x31c3a8){_0x59479b=_0x31c3a8;_0x21bfb5[_0xa548('0x33')]=_[_0xa548('0x31')](db[_0xa548('0x4e')]['rawAttributes']);_0x21bfb5['query']=_['keys'](_0x2d7cdc[_0xa548('0x30')]);_0x21bfb5['filters']=_['intersection'](_0x21bfb5[_0xa548('0x33')],_0x21bfb5[_0xa548('0x30')]);_0x3d7f26[_0xa548('0x35')]=_['intersection'](_0x21bfb5[_0xa548('0x33')],qs[_0xa548('0x34')](_0x2d7cdc[_0xa548('0x30')][_0xa548('0x34')]));_0x3d7f26[_0xa548('0x35')]=_0x3d7f26[_0xa548('0x35')]['length']?_0x3d7f26['attributes']:_0x21bfb5[_0xa548('0x33')];_0x3d7f26[_0xa548('0x39')]=qs[_0xa548('0x3a')](_0x2d7cdc[_0xa548('0x30')]['sort']);_0x3d7f26[_0xa548('0x3b')]=qs[_0xa548('0x3c')](_['pick'](_0x2d7cdc[_0xa548('0x30')],_0x21bfb5[_0xa548('0x3c')]));if(_0x2d7cdc['query'][_0xa548('0x3e')]){_0x3d7f26[_0xa548('0x3b')]=_[_0xa548('0x3d')](_0x3d7f26[_0xa548('0x3b')],{'$or':_[_0xa548('0x2b')](_0x3d7f26['attributes'],function(_0x47721d){var _0x302ddc={};_0x302ddc[_0x47721d]={'$like':'%'+_0x2d7cdc[_0xa548('0x30')][_0xa548('0x3e')]+'%'};return _0x302ddc;})});}_0x3d7f26=_[_0xa548('0x3d')]({},_0x3d7f26,_0x2d7cdc[_0xa548('0x3f')]);return _0x59479b[_0xa548('0x4c')](_0x3d7f26);}})[_0xa548('0x24')](function(_0x4cfea2){if(_0x4cfea2){_0x488d43=_0x4cfea2['length'];if(!_0x2d7cdc[_0xa548('0x30')]['hasOwnProperty'](_0xa548('0x38'))){_0x3d7f26[_0xa548('0x1e')]=qs[_0xa548('0x1e')](_0x2d7cdc[_0xa548('0x30')][_0xa548('0x1e')]);_0x3d7f26[_0xa548('0x1c')]=qs[_0xa548('0x1c')](_0x2d7cdc[_0xa548('0x30')][_0xa548('0x1c')]);}return _0x59479b['getFields'](_0x3d7f26);}})[_0xa548('0x24')](function(_0x5d4292){if(_0x5d4292){return _0x5d4292?{'count':_0x488d43,'rows':_0x5d4292}:null;}})['then'](respondWithResult(_0x1343a0,null))[_0xa548('0x44')](handleError(_0x1343a0,null));};exports[_0xa548('0x4f')]=function(_0x12cf69,_0x436bf9,_0x26f8d9){var _0x5df31e={};var _0x4c9a93={};var _0x332bbc;var _0x57cb5e;return db[_0xa548('0x42')][_0xa548('0x4d')]({'where':{'id':_0x12cf69[_0xa548('0x46')]['id']}})[_0xa548('0x24')](handleEntityNotFound(_0x436bf9,null))[_0xa548('0x24')](function(_0x46f9c3){if(_0x46f9c3){_0x332bbc=_0x46f9c3;_0x4c9a93['model']=_['keys'](db[_0xa548('0x4e')][_0xa548('0x2c')]);_0x4c9a93['query']=_['keys'](_0x12cf69[_0xa548('0x30')]);_0x4c9a93[_0xa548('0x3c')]=_[_0xa548('0x32')](_0x4c9a93[_0xa548('0x33')],_0x4c9a93[_0xa548('0x30')]);_0x5df31e['attributes']=_[_0xa548('0x32')](_0x4c9a93[_0xa548('0x33')],qs[_0xa548('0x34')](_0x12cf69['query']['fields']));_0x5df31e[_0xa548('0x35')]=_0x5df31e[_0xa548('0x35')][_0xa548('0x36')]?_0x5df31e['attributes']:_0x4c9a93[_0xa548('0x33')];_0x5df31e[_0xa548('0x39')]=qs[_0xa548('0x3a')](_0x12cf69[_0xa548('0x30')][_0xa548('0x3a')]);_0x5df31e[_0xa548('0x3b')]=qs[_0xa548('0x3c')](_[_0xa548('0x50')](_0x12cf69['query'],_0x4c9a93[_0xa548('0x3c')]));if(_0x12cf69[_0xa548('0x30')][_0xa548('0x3e')]){_0x5df31e[_0xa548('0x3b')]=_[_0xa548('0x3d')](_0x5df31e[_0xa548('0x3b')],{'$or':_[_0xa548('0x2b')](_0x5df31e[_0xa548('0x35')],function(_0x1c1987){var _0x2b121b={};_0x2b121b[_0x1c1987]={'$like':'%'+_0x12cf69[_0xa548('0x30')][_0xa548('0x3e')]+'%'};return _0x2b121b;})});}_0x5df31e=_['merge']({},_0x5df31e,_0x12cf69['options']);return _0x332bbc[_0xa548('0x4f')](_0x5df31e);}})['then'](function(_0xa49ce0){if(_0xa49ce0){_0x57cb5e=_0xa49ce0[_0xa548('0x36')];if(!_0x12cf69[_0xa548('0x30')][_0xa548('0x37')]('nolimit')){_0x5df31e[_0xa548('0x1e')]=qs[_0xa548('0x1e')](_0x12cf69[_0xa548('0x30')]['limit']);_0x5df31e[_0xa548('0x1c')]=qs['offset'](_0x12cf69[_0xa548('0x30')][_0xa548('0x1c')]);}return _0x332bbc[_0xa548('0x4f')](_0x5df31e);}})[_0xa548('0x24')](function(_0x748e61){if(_0x748e61){return _0x748e61?{'count':_0x57cb5e,'rows':_0x748e61}:null;}})[_0xa548('0x24')](respondWithResult(_0x436bf9,null))[_0xa548('0x44')](handleError(_0x436bf9,null));};exports[_0xa548('0x51')]=function(_0x2f59e7,_0x387bdd,_0x353008){var _0xd2eafc={};var _0x2319ff={};var _0x20de44;var _0x5ad823;return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x2f59e7[_0xa548('0x46')]['id']}})[_0xa548('0x24')](handleEntityNotFound(_0x387bdd,null))[_0xa548('0x24')](function(_0x577585){if(_0x577585){_0x20de44=_0x577585;_0x2319ff['model']=_['keys'](db[_0xa548('0x4e')][_0xa548('0x2c')]);_0x2319ff['query']=_[_0xa548('0x31')](_0x2f59e7['query']);_0x2319ff[_0xa548('0x3c')]=_[_0xa548('0x32')](_0x2319ff[_0xa548('0x33')],_0x2319ff[_0xa548('0x30')]);_0xd2eafc[_0xa548('0x35')]=_[_0xa548('0x32')](_0x2319ff[_0xa548('0x33')],qs[_0xa548('0x34')](_0x2f59e7[_0xa548('0x30')][_0xa548('0x34')]));_0xd2eafc[_0xa548('0x35')]=_0xd2eafc[_0xa548('0x35')][_0xa548('0x36')]?_0xd2eafc['attributes']:_0x2319ff[_0xa548('0x33')];_0xd2eafc['order']=qs[_0xa548('0x3a')](_0x2f59e7[_0xa548('0x30')][_0xa548('0x3a')]);_0xd2eafc[_0xa548('0x3b')]=qs['filters'](_[_0xa548('0x50')](_0x2f59e7[_0xa548('0x30')],_0x2319ff[_0xa548('0x3c')]));if(_0x2f59e7[_0xa548('0x30')][_0xa548('0x3e')]){_0xd2eafc[_0xa548('0x3b')]=_[_0xa548('0x3d')](_0xd2eafc[_0xa548('0x3b')],{'$or':_[_0xa548('0x2b')](_0xd2eafc[_0xa548('0x35')],function(_0x310dc1){var _0xca21c2={};_0xca21c2[_0x310dc1]={'$like':'%'+_0x2f59e7[_0xa548('0x30')][_0xa548('0x3e')]+'%'};return _0xca21c2;})});}_0xd2eafc=_[_0xa548('0x3d')]({},_0xd2eafc,_0x2f59e7[_0xa548('0x3f')]);return _0x20de44[_0xa548('0x51')](_0xd2eafc);}})[_0xa548('0x24')](function(_0x624140){if(_0x624140){_0x5ad823=_0x624140[_0xa548('0x36')];if(!_0x2f59e7[_0xa548('0x30')][_0xa548('0x37')]('nolimit')){_0xd2eafc[_0xa548('0x1e')]=qs[_0xa548('0x1e')](_0x2f59e7[_0xa548('0x30')][_0xa548('0x1e')]);_0xd2eafc[_0xa548('0x1c')]=qs['offset'](_0x2f59e7[_0xa548('0x30')][_0xa548('0x1c')]);}return _0x20de44['getDescriptions'](_0xd2eafc);}})[_0xa548('0x24')](function(_0x20c9ab){if(_0x20c9ab){return _0x20c9ab?{'count':_0x5ad823,'rows':_0x20c9ab}:null;}})['then'](respondWithResult(_0x387bdd,null))[_0xa548('0x44')](handleError(_0x387bdd,null));};exports[_0xa548('0x52')]=function(_0x306d0e,_0x4a0abc,_0x42cb9c){var _0x4a90e6={};var _0x5555ee={};var _0x541879;var _0x173989;return db[_0xa548('0x42')][_0xa548('0x4d')]({'where':{'id':_0x306d0e[_0xa548('0x46')]['id']}})[_0xa548('0x24')](handleEntityNotFound(_0x4a0abc,null))['then'](function(_0x482965){if(_0x482965){_0x541879=_0x482965;_0x5555ee[_0xa548('0x33')]=_[_0xa548('0x31')](db[_0xa548('0x53')][_0xa548('0x2c')]);_0x5555ee[_0xa548('0x30')]=_[_0xa548('0x31')](_0x306d0e[_0xa548('0x30')]);_0x5555ee['filters']=_[_0xa548('0x32')](_0x5555ee['model'],_0x5555ee[_0xa548('0x30')]);_0x4a90e6[_0xa548('0x35')]=_[_0xa548('0x32')](_0x5555ee[_0xa548('0x33')],qs[_0xa548('0x34')](_0x306d0e[_0xa548('0x30')][_0xa548('0x34')]));_0x4a90e6[_0xa548('0x35')]=_0x4a90e6[_0xa548('0x35')]['length']?_0x4a90e6[_0xa548('0x35')]:_0x5555ee[_0xa548('0x33')];_0x4a90e6['order']=qs['sort'](_0x306d0e[_0xa548('0x30')][_0xa548('0x3a')]);_0x4a90e6[_0xa548('0x3b')]=qs[_0xa548('0x3c')](_[_0xa548('0x50')](_0x306d0e[_0xa548('0x30')],_0x5555ee[_0xa548('0x3c')]));if(_0x306d0e[_0xa548('0x30')][_0xa548('0x3e')]){_0x4a90e6['where']=_[_0xa548('0x3d')](_0x4a90e6[_0xa548('0x3b')],{'$or':_[_0xa548('0x2b')](_0x4a90e6[_0xa548('0x35')],function(_0x3c3f7a){var _0x1ee54d={};_0x1ee54d[_0x3c3f7a]={'$like':'%'+_0x306d0e[_0xa548('0x30')][_0xa548('0x3e')]+'%'};return _0x1ee54d;})});}_0x4a90e6=_[_0xa548('0x3d')]({},_0x4a90e6,_0x306d0e[_0xa548('0x3f')]);return _0x541879[_0xa548('0x52')](_0x4a90e6);}})['then'](function(_0x252583){if(_0x252583){_0x173989=_0x252583['length'];if(!_0x306d0e['query']['hasOwnProperty']('nolimit')){_0x4a90e6[_0xa548('0x1e')]=qs[_0xa548('0x1e')](_0x306d0e['query'][_0xa548('0x1e')]);_0x4a90e6[_0xa548('0x1c')]=qs[_0xa548('0x1c')](_0x306d0e[_0xa548('0x30')][_0xa548('0x1c')]);}return _0x541879['getTags'](_0x4a90e6);}})[_0xa548('0x24')](function(_0x5d5061){if(_0x5d5061){return _0x5d5061?{'count':_0x173989,'rows':_0x5d5061}:null;}})[_0xa548('0x24')](respondWithResult(_0x4a0abc,null))['catch'](handleError(_0x4a0abc,null));};exports[_0xa548('0x54')]=function(_0x23f745,_0x57d1a8,_0xbfb94f){if(_0x23f745['body']['id']){delete _0x23f745[_0xa548('0x4a')]['id'];}return db[_0xa548('0x42')][_0xa548('0x4d')]({'where':{'id':_0x23f745[_0xa548('0x46')]['id']}})[_0xa548('0x24')](handleEntityNotFound(_0x57d1a8,null))[_0xa548('0x24')](function(_0x42c5eb){if(_0x42c5eb){return _0x42c5eb['setTags'](_0x23f745['body'][_0xa548('0x55')]||[]);}return null;})[_0xa548('0x24')](respondWithResult(_0x57d1a8,null))[_0xa548('0x44')](handleError(_0x57d1a8,null));}; \ No newline at end of file +var _0x435b=['index','map','ZendeskConfiguration','type','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','includeAll','include','findAll','rows','catch','show','params','rawAttributes','options','find','create','body','findOne','ZendeskField','getFields','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','destroy','then','error','stack','name','send'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x435b,0x174));var _0xb435=function(_0x1e04b6,_0x8e1cad){_0x1e04b6=_0x1e04b6-0x0;var _0x3f74d2=_0x435b[_0x1e04b6];return _0x3f74d2;};'use strict';var emlformat=require(_0xb435('0x0'));var rimraf=require(_0xb435('0x1'));var zipdir=require(_0xb435('0x2'));var jsonpatch=require(_0xb435('0x3'));var rp=require('request-promise');var moment=require(_0xb435('0x4'));var BPromise=require(_0xb435('0x5'));var Mustache=require(_0xb435('0x6'));var util=require(_0xb435('0x7'));var path=require(_0xb435('0x8'));var sox=require('sox');var csv=require(_0xb435('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb435('0xa'));var _=require('lodash');var squel=require(_0xb435('0xb'));var crypto=require('crypto');var jsforce=require(_0xb435('0xc'));var deskjs=require(_0xb435('0xd'));var toCsv=require('to-csv');var querystring=require(_0xb435('0xe'));var Papa=require('papaparse');var Redis=require(_0xb435('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xb435('0x10'));var as=require(_0xb435('0x11'));var hardwareService=require(_0xb435('0x12'));var logger=require(_0xb435('0x13'))(_0xb435('0x14'));var utils=require('../../config/utils');var config=require(_0xb435('0x15'));var licenseUtil=require(_0xb435('0x16'));var db=require(_0xb435('0x17'))['db'];function respondWithStatusCode(_0x38f883,_0x844ba6){_0x844ba6=_0x844ba6||0xcc;return function(_0x119f94){if(_0x119f94){return _0x38f883[_0xb435('0x18')](_0x844ba6);}return _0x38f883[_0xb435('0x19')](_0x844ba6)[_0xb435('0x1a')]();};}function respondWithResult(_0x47e282,_0x2a89d1){_0x2a89d1=_0x2a89d1||0xc8;return function(_0x349844){if(_0x349844){return _0x47e282['status'](_0x2a89d1)[_0xb435('0x1b')](_0x349844);}};}function respondWithFilteredResult(_0x5125fe,_0x788a42){return function(_0x97493a){if(_0x97493a){var _0x2ff1aa=typeof _0x788a42[_0xb435('0x1c')]===_0xb435('0x1d')&&typeof _0x788a42['limit']===_0xb435('0x1d');var _0x4fbaae=_0x97493a[_0xb435('0x1e')];var _0xcecf4e=_0x2ff1aa?0x0:_0x788a42[_0xb435('0x1c')];var _0x32bb10=_0x2ff1aa?_0x97493a[_0xb435('0x1e')]:_0x788a42[_0xb435('0x1c')]+_0x788a42[_0xb435('0x1f')];var _0x2106d0;if(_0x32bb10>=_0x4fbaae){_0x32bb10=_0x4fbaae;_0x2106d0=0xc8;}else{_0x2106d0=0xce;}_0x5125fe[_0xb435('0x19')](_0x2106d0);return _0x5125fe[_0xb435('0x20')](_0xb435('0x21'),_0xcecf4e+'-'+_0x32bb10+'/'+_0x4fbaae)[_0xb435('0x1b')](_0x97493a);}return null;};}function patchUpdates(_0x31cd7c){return function(_0x1bb73c){try{jsonpatch['apply'](_0x1bb73c,_0x31cd7c,!![]);}catch(_0x2fde4d){return BPromise[_0xb435('0x22')](_0x2fde4d);}return _0x1bb73c[_0xb435('0x23')]();};}function saveUpdates(_0x54ec09,_0x16e4d2){return function(_0x382d8f){if(_0x382d8f){return _0x382d8f[_0xb435('0x24')](_0x54ec09)['then'](function(_0x13b12f){return _0x13b12f;});}return null;};}function removeEntity(_0x3f4258,_0x393817){return function(_0x1173c9){if(_0x1173c9){return _0x1173c9[_0xb435('0x25')]()[_0xb435('0x26')](function(){_0x3f4258[_0xb435('0x19')](0xcc)[_0xb435('0x1a')]();});}};}function handleEntityNotFound(_0x3ab8c2,_0x2b764e){return function(_0x847f9f){if(!_0x847f9f){_0x3ab8c2[_0xb435('0x18')](0x194);}return _0x847f9f;};}function handleError(_0x446238,_0x49203a){_0x49203a=_0x49203a||0x1f4;return function(_0x387d25){logger[_0xb435('0x27')](_0x387d25[_0xb435('0x28')]);if(_0x387d25[_0xb435('0x29')]){delete _0x387d25['name'];}_0x446238[_0xb435('0x19')](_0x49203a)[_0xb435('0x2a')](_0x387d25);};}exports[_0xb435('0x2b')]=function(_0x1e34ad,_0x78085e){var _0x375553={},_0x1fada3={},_0x26d718={'count':0x0,'rows':[]};var _0x145399=_[_0xb435('0x2c')](db[_0xb435('0x2d')]['rawAttributes'],function(_0x21a0ec){return{'name':_0x21a0ec['fieldName'],'type':_0x21a0ec[_0xb435('0x2e')]['key']};});_0x1fada3[_0xb435('0x2f')]=_[_0xb435('0x2c')](_0x145399,_0xb435('0x29'));_0x1fada3['query']=_[_0xb435('0x30')](_0x1e34ad[_0xb435('0x31')]);_0x1fada3[_0xb435('0x32')]=_['intersection'](_0x1fada3[_0xb435('0x2f')],_0x1fada3['query']);_0x375553[_0xb435('0x33')]=_[_0xb435('0x34')](_0x1fada3[_0xb435('0x2f')],qs[_0xb435('0x35')](_0x1e34ad[_0xb435('0x31')]['fields']));_0x375553[_0xb435('0x33')]=_0x375553['attributes'][_0xb435('0x36')]?_0x375553['attributes']:_0x1fada3[_0xb435('0x2f')];if(!_0x1e34ad[_0xb435('0x31')][_0xb435('0x37')](_0xb435('0x38'))){_0x375553[_0xb435('0x1f')]=qs[_0xb435('0x1f')](_0x1e34ad[_0xb435('0x31')][_0xb435('0x1f')]);_0x375553[_0xb435('0x1c')]=qs['offset'](_0x1e34ad['query'][_0xb435('0x1c')]);}_0x375553[_0xb435('0x39')]=qs[_0xb435('0x3a')](_0x1e34ad[_0xb435('0x31')][_0xb435('0x3a')]);_0x375553['where']=qs[_0xb435('0x32')](_[_0xb435('0x3b')](_0x1e34ad[_0xb435('0x31')],_0x1fada3['filters']),_0x145399);if(_0x1e34ad['query'][_0xb435('0x3c')]){_0x375553[_0xb435('0x3d')]=_['merge'](_0x375553[_0xb435('0x3d')],{'$or':_[_0xb435('0x2c')](_0x145399,function(_0x1a4162){if(_0x1a4162[_0xb435('0x2e')]!=='VIRTUAL'){var _0x443154={};_0x443154[_0x1a4162[_0xb435('0x29')]]={'$like':'%'+_0x1e34ad[_0xb435('0x31')][_0xb435('0x3c')]+'%'};return _0x443154;}})});}_0x375553=_[_0xb435('0x3e')]({},_0x375553,_0x1e34ad['options']);var _0xbd7624={'where':_0x375553['where']};return db[_0xb435('0x2d')][_0xb435('0x1e')](_0xbd7624)['then'](function(_0x2f082b){_0x26d718[_0xb435('0x1e')]=_0x2f082b;if(_0x1e34ad[_0xb435('0x31')][_0xb435('0x3f')]){_0x375553[_0xb435('0x40')]=[{'all':!![]}];}return db[_0xb435('0x2d')][_0xb435('0x41')](_0x375553);})[_0xb435('0x26')](function(_0x46c569){_0x26d718[_0xb435('0x42')]=_0x46c569;return _0x26d718;})['then'](respondWithFilteredResult(_0x78085e,_0x375553))[_0xb435('0x43')](handleError(_0x78085e,null));};exports[_0xb435('0x44')]=function(_0x31e567,_0x15bade){var _0x19b4b6={'raw':![],'where':{'id':_0x31e567[_0xb435('0x45')]['id']}},_0x50a8b9={};_0x50a8b9[_0xb435('0x2f')]=_['keys'](db[_0xb435('0x2d')][_0xb435('0x46')]);_0x50a8b9['query']=_['keys'](_0x31e567[_0xb435('0x31')]);_0x50a8b9[_0xb435('0x32')]=_['intersection'](_0x50a8b9[_0xb435('0x2f')],_0x50a8b9['query']);_0x19b4b6[_0xb435('0x33')]=_[_0xb435('0x34')](_0x50a8b9['model'],qs[_0xb435('0x35')](_0x31e567['query']['fields']));_0x19b4b6[_0xb435('0x33')]=_0x19b4b6[_0xb435('0x33')][_0xb435('0x36')]?_0x19b4b6[_0xb435('0x33')]:_0x50a8b9[_0xb435('0x2f')];if(_0x31e567[_0xb435('0x31')][_0xb435('0x3f')]){_0x19b4b6[_0xb435('0x40')]=[{'all':!![]}];}_0x19b4b6=_['merge']({},_0x19b4b6,_0x31e567[_0xb435('0x47')]);return db['ZendeskConfiguration'][_0xb435('0x48')](_0x19b4b6)[_0xb435('0x26')](handleEntityNotFound(_0x15bade,null))[_0xb435('0x26')](respondWithResult(_0x15bade,null))[_0xb435('0x43')](handleError(_0x15bade,null));};exports['create']=function(_0x208f03,_0x45a6e6){return db[_0xb435('0x2d')][_0xb435('0x49')](_0x208f03['body'],{})['then'](respondWithResult(_0x45a6e6,0xc9))[_0xb435('0x43')](handleError(_0x45a6e6,null));};exports[_0xb435('0x24')]=function(_0x47670a,_0x130cda){if(_0x47670a[_0xb435('0x4a')]['id']){delete _0x47670a[_0xb435('0x4a')]['id'];}return db['ZendeskConfiguration'][_0xb435('0x48')]({'where':{'id':_0x47670a[_0xb435('0x45')]['id']}})['then'](handleEntityNotFound(_0x130cda,null))[_0xb435('0x26')](saveUpdates(_0x47670a[_0xb435('0x4a')],null))[_0xb435('0x26')](respondWithResult(_0x130cda,null))[_0xb435('0x43')](handleError(_0x130cda,null));};exports['destroy']=function(_0x42386,_0x1f639a){return db[_0xb435('0x2d')][_0xb435('0x48')]({'where':{'id':_0x42386['params']['id']}})[_0xb435('0x26')](handleEntityNotFound(_0x1f639a,null))[_0xb435('0x26')](removeEntity(_0x1f639a,null))[_0xb435('0x43')](handleError(_0x1f639a,null));};exports['getFields']=function(_0x23bb55,_0x12b200,_0x9f1fbc){var _0x108dee={};var _0x38e2e2={};var _0x318351;var _0x1812ed;return db['ZendeskConfiguration'][_0xb435('0x4b')]({'where':{'id':_0x23bb55[_0xb435('0x45')]['id']}})['then'](handleEntityNotFound(_0x12b200,null))[_0xb435('0x26')](function(_0x3ce25a){if(_0x3ce25a){_0x318351=_0x3ce25a;_0x38e2e2[_0xb435('0x2f')]=_[_0xb435('0x30')](db[_0xb435('0x4c')]['rawAttributes']);_0x38e2e2[_0xb435('0x31')]=_['keys'](_0x23bb55[_0xb435('0x31')]);_0x38e2e2[_0xb435('0x32')]=_[_0xb435('0x34')](_0x38e2e2[_0xb435('0x2f')],_0x38e2e2['query']);_0x108dee[_0xb435('0x33')]=_['intersection'](_0x38e2e2['model'],qs[_0xb435('0x35')](_0x23bb55['query'][_0xb435('0x35')]));_0x108dee[_0xb435('0x33')]=_0x108dee[_0xb435('0x33')][_0xb435('0x36')]?_0x108dee[_0xb435('0x33')]:_0x38e2e2[_0xb435('0x2f')];_0x108dee[_0xb435('0x39')]=qs[_0xb435('0x3a')](_0x23bb55['query'][_0xb435('0x3a')]);_0x108dee[_0xb435('0x3d')]=qs['filters'](_[_0xb435('0x3b')](_0x23bb55['query'],_0x38e2e2[_0xb435('0x32')]));if(_0x23bb55[_0xb435('0x31')][_0xb435('0x3c')]){_0x108dee[_0xb435('0x3d')]=_['merge'](_0x108dee[_0xb435('0x3d')],{'$or':_[_0xb435('0x2c')](_0x108dee['attributes'],function(_0x95ef8){var _0x585941={};_0x585941[_0x95ef8]={'$like':'%'+_0x23bb55['query'][_0xb435('0x3c')]+'%'};return _0x585941;})});}_0x108dee=_[_0xb435('0x3e')]({},_0x108dee,_0x23bb55[_0xb435('0x47')]);return _0x318351[_0xb435('0x4d')](_0x108dee);}})[_0xb435('0x26')](function(_0x1dba42){if(_0x1dba42){_0x1812ed=_0x1dba42[_0xb435('0x36')];if(!_0x23bb55[_0xb435('0x31')][_0xb435('0x37')]('nolimit')){_0x108dee[_0xb435('0x1f')]=qs[_0xb435('0x1f')](_0x23bb55[_0xb435('0x31')][_0xb435('0x1f')]);_0x108dee[_0xb435('0x1c')]=qs['offset'](_0x23bb55['query'][_0xb435('0x1c')]);}return _0x318351[_0xb435('0x4d')](_0x108dee);}})[_0xb435('0x26')](function(_0x504276){if(_0x504276){return _0x504276?{'count':_0x1812ed,'rows':_0x504276}:null;}})[_0xb435('0x26')](respondWithResult(_0x12b200,null))[_0xb435('0x43')](handleError(_0x12b200,null));};exports['getSubjects']=function(_0x5eb747,_0x1d9825,_0xf074c4){var _0x50c14c={};var _0x58ee22={};var _0x218a48;var _0x8e2bba;return db[_0xb435('0x2d')][_0xb435('0x4b')]({'where':{'id':_0x5eb747[_0xb435('0x45')]['id']}})[_0xb435('0x26')](handleEntityNotFound(_0x1d9825,null))[_0xb435('0x26')](function(_0x1271c0){if(_0x1271c0){_0x218a48=_0x1271c0;_0x58ee22[_0xb435('0x2f')]=_[_0xb435('0x30')](db[_0xb435('0x4c')]['rawAttributes']);_0x58ee22['query']=_[_0xb435('0x30')](_0x5eb747[_0xb435('0x31')]);_0x58ee22[_0xb435('0x32')]=_[_0xb435('0x34')](_0x58ee22[_0xb435('0x2f')],_0x58ee22[_0xb435('0x31')]);_0x50c14c[_0xb435('0x33')]=_[_0xb435('0x34')](_0x58ee22[_0xb435('0x2f')],qs['fields'](_0x5eb747[_0xb435('0x31')][_0xb435('0x35')]));_0x50c14c[_0xb435('0x33')]=_0x50c14c[_0xb435('0x33')]['length']?_0x50c14c[_0xb435('0x33')]:_0x58ee22[_0xb435('0x2f')];_0x50c14c[_0xb435('0x39')]=qs[_0xb435('0x3a')](_0x5eb747[_0xb435('0x31')][_0xb435('0x3a')]);_0x50c14c[_0xb435('0x3d')]=qs['filters'](_[_0xb435('0x3b')](_0x5eb747[_0xb435('0x31')],_0x58ee22['filters']));if(_0x5eb747[_0xb435('0x31')][_0xb435('0x3c')]){_0x50c14c['where']=_[_0xb435('0x3e')](_0x50c14c[_0xb435('0x3d')],{'$or':_['map'](_0x50c14c[_0xb435('0x33')],function(_0x4aa075){var _0x2a6766={};_0x2a6766[_0x4aa075]={'$like':'%'+_0x5eb747[_0xb435('0x31')][_0xb435('0x3c')]+'%'};return _0x2a6766;})});}_0x50c14c=_['merge']({},_0x50c14c,_0x5eb747['options']);return _0x218a48['getSubjects'](_0x50c14c);}})[_0xb435('0x26')](function(_0xd86ea8){if(_0xd86ea8){_0x8e2bba=_0xd86ea8[_0xb435('0x36')];if(!_0x5eb747['query'][_0xb435('0x37')](_0xb435('0x38'))){_0x50c14c[_0xb435('0x1f')]=qs['limit'](_0x5eb747['query'][_0xb435('0x1f')]);_0x50c14c[_0xb435('0x1c')]=qs['offset'](_0x5eb747[_0xb435('0x31')][_0xb435('0x1c')]);}return _0x218a48['getSubjects'](_0x50c14c);}})[_0xb435('0x26')](function(_0x5b54e3){if(_0x5b54e3){return _0x5b54e3?{'count':_0x8e2bba,'rows':_0x5b54e3}:null;}})[_0xb435('0x26')](respondWithResult(_0x1d9825,null))[_0xb435('0x43')](handleError(_0x1d9825,null));};exports[_0xb435('0x4e')]=function(_0x1d2bed,_0x481f83,_0xaccfb5){var _0x23869d={};var _0x351a6c={};var _0x1badab;var _0x235686;return db[_0xb435('0x2d')][_0xb435('0x4b')]({'where':{'id':_0x1d2bed['params']['id']}})[_0xb435('0x26')](handleEntityNotFound(_0x481f83,null))['then'](function(_0x3c0176){if(_0x3c0176){_0x1badab=_0x3c0176;_0x351a6c[_0xb435('0x2f')]=_[_0xb435('0x30')](db['ZendeskField'][_0xb435('0x46')]);_0x351a6c['query']=_[_0xb435('0x30')](_0x1d2bed['query']);_0x351a6c[_0xb435('0x32')]=_[_0xb435('0x34')](_0x351a6c[_0xb435('0x2f')],_0x351a6c[_0xb435('0x31')]);_0x23869d[_0xb435('0x33')]=_[_0xb435('0x34')](_0x351a6c['model'],qs[_0xb435('0x35')](_0x1d2bed[_0xb435('0x31')]['fields']));_0x23869d['attributes']=_0x23869d[_0xb435('0x33')][_0xb435('0x36')]?_0x23869d[_0xb435('0x33')]:_0x351a6c[_0xb435('0x2f')];_0x23869d[_0xb435('0x39')]=qs['sort'](_0x1d2bed[_0xb435('0x31')]['sort']);_0x23869d[_0xb435('0x3d')]=qs[_0xb435('0x32')](_[_0xb435('0x3b')](_0x1d2bed['query'],_0x351a6c[_0xb435('0x32')]));if(_0x1d2bed[_0xb435('0x31')]['filter']){_0x23869d[_0xb435('0x3d')]=_[_0xb435('0x3e')](_0x23869d[_0xb435('0x3d')],{'$or':_[_0xb435('0x2c')](_0x23869d['attributes'],function(_0x20d567){var _0x2908cf={};_0x2908cf[_0x20d567]={'$like':'%'+_0x1d2bed[_0xb435('0x31')][_0xb435('0x3c')]+'%'};return _0x2908cf;})});}_0x23869d=_[_0xb435('0x3e')]({},_0x23869d,_0x1d2bed[_0xb435('0x47')]);return _0x1badab[_0xb435('0x4e')](_0x23869d);}})[_0xb435('0x26')](function(_0x528832){if(_0x528832){_0x235686=_0x528832[_0xb435('0x36')];if(!_0x1d2bed[_0xb435('0x31')]['hasOwnProperty'](_0xb435('0x38'))){_0x23869d[_0xb435('0x1f')]=qs[_0xb435('0x1f')](_0x1d2bed[_0xb435('0x31')][_0xb435('0x1f')]);_0x23869d[_0xb435('0x1c')]=qs['offset'](_0x1d2bed[_0xb435('0x31')][_0xb435('0x1c')]);}return _0x1badab[_0xb435('0x4e')](_0x23869d);}})[_0xb435('0x26')](function(_0x5905e4){if(_0x5905e4){return _0x5905e4?{'count':_0x235686,'rows':_0x5905e4}:null;}})[_0xb435('0x26')](respondWithResult(_0x481f83,null))[_0xb435('0x43')](handleError(_0x481f83,null));};exports[_0xb435('0x4f')]=function(_0x4a8352,_0x2d4bd4,_0xf55544){var _0x1c485a={};var _0x122cb4={};var _0x516544;var _0x139a93;return db[_0xb435('0x2d')][_0xb435('0x4b')]({'where':{'id':_0x4a8352['params']['id']}})[_0xb435('0x26')](handleEntityNotFound(_0x2d4bd4,null))[_0xb435('0x26')](function(_0x348fc5){if(_0x348fc5){_0x516544=_0x348fc5;_0x122cb4[_0xb435('0x2f')]=_[_0xb435('0x30')](db[_0xb435('0x50')][_0xb435('0x46')]);_0x122cb4['query']=_[_0xb435('0x30')](_0x4a8352[_0xb435('0x31')]);_0x122cb4[_0xb435('0x32')]=_['intersection'](_0x122cb4[_0xb435('0x2f')],_0x122cb4[_0xb435('0x31')]);_0x1c485a['attributes']=_[_0xb435('0x34')](_0x122cb4[_0xb435('0x2f')],qs['fields'](_0x4a8352[_0xb435('0x31')][_0xb435('0x35')]));_0x1c485a[_0xb435('0x33')]=_0x1c485a[_0xb435('0x33')]['length']?_0x1c485a['attributes']:_0x122cb4[_0xb435('0x2f')];_0x1c485a[_0xb435('0x39')]=qs['sort'](_0x4a8352['query'][_0xb435('0x3a')]);_0x1c485a[_0xb435('0x3d')]=qs['filters'](_[_0xb435('0x3b')](_0x4a8352[_0xb435('0x31')],_0x122cb4['filters']));if(_0x4a8352[_0xb435('0x31')][_0xb435('0x3c')]){_0x1c485a[_0xb435('0x3d')]=_['merge'](_0x1c485a[_0xb435('0x3d')],{'$or':_['map'](_0x1c485a[_0xb435('0x33')],function(_0x606231){var _0x10149a={};_0x10149a[_0x606231]={'$like':'%'+_0x4a8352[_0xb435('0x31')][_0xb435('0x3c')]+'%'};return _0x10149a;})});}_0x1c485a=_[_0xb435('0x3e')]({},_0x1c485a,_0x4a8352[_0xb435('0x47')]);return _0x516544[_0xb435('0x4f')](_0x1c485a);}})[_0xb435('0x26')](function(_0x1458d6){if(_0x1458d6){_0x139a93=_0x1458d6[_0xb435('0x36')];if(!_0x4a8352[_0xb435('0x31')][_0xb435('0x37')](_0xb435('0x38'))){_0x1c485a[_0xb435('0x1f')]=qs['limit'](_0x4a8352[_0xb435('0x31')]['limit']);_0x1c485a[_0xb435('0x1c')]=qs[_0xb435('0x1c')](_0x4a8352[_0xb435('0x31')][_0xb435('0x1c')]);}return _0x516544[_0xb435('0x4f')](_0x1c485a);}})[_0xb435('0x26')](function(_0x20648f){if(_0x20648f){return _0x20648f?{'count':_0x139a93,'rows':_0x20648f}:null;}})[_0xb435('0x26')](respondWithResult(_0x2d4bd4,null))[_0xb435('0x43')](handleError(_0x2d4bd4,null));};exports[_0xb435('0x51')]=function(_0x575448,_0x53c8cb,_0x13d5f4){if(_0x575448['body']['id']){delete _0x575448[_0xb435('0x4a')]['id'];}return db['ZendeskConfiguration'][_0xb435('0x4b')]({'where':{'id':_0x575448[_0xb435('0x45')]['id']}})[_0xb435('0x26')](handleEntityNotFound(_0x53c8cb,null))[_0xb435('0x26')](function(_0x1020d6){if(_0x1020d6){return _0x1020d6['setTags'](_0x575448[_0xb435('0x4a')][_0xb435('0x52')]||[]);}return null;})['then'](respondWithResult(_0x53c8cb,null))['catch'](handleError(_0x53c8cb,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 0fd2e7f..240d997 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 _0xe2cf=['request-promise','path','rimraf','./intZendeskConfiguration.attributes','exports','define','ZendeskConfiguration','util','api','bluebird'];(function(_0x1be26e,_0xf87fe7){var _0x12e661=function(_0x312317){while(--_0x312317){_0x1be26e['push'](_0x1be26e['shift']());}};_0x12e661(++_0xf87fe7);}(_0xe2cf,0x1a1));var _0xfe2c=function(_0x4e7d4a,_0x35cdc8){_0x4e7d4a=_0x4e7d4a-0x0;var _0x235800=_0xe2cf[_0x4e7d4a];return _0x235800;};'use strict';var _=require('lodash');var util=require(_0xfe2c('0x0'));var logger=require('../../config/logger')(_0xfe2c('0x1'));var moment=require('moment');var BPromise=require(_0xfe2c('0x2'));var rp=require(_0xfe2c('0x3'));var fs=require('fs');var path=require(_0xfe2c('0x4'));var rimraf=require(_0xfe2c('0x5'));var config=require('../../config/environment');var attributes=require(_0xfe2c('0x6'));module[_0xfe2c('0x7')]=function(_0x55bb12,_0x4fa079){return _0x55bb12[_0xfe2c('0x8')](_0xfe2c('0x9'),attributes,{'tableName':'int_zendesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x065e=['moment','bluebird','request-promise','../../config/environment','./intZendeskConfiguration.attributes','define','int_zendesk_configurations','lodash'];(function(_0x22a73c,_0x3e791f){var _0x2fe9e8=function(_0x16579c){while(--_0x16579c){_0x22a73c['push'](_0x22a73c['shift']());}};_0x2fe9e8(++_0x3e791f);}(_0x065e,0x1a7));var _0xe065=function(_0x4777f6,_0x429478){_0x4777f6=_0x4777f6-0x0;var _0x56c2de=_0x065e[_0x4777f6];return _0x56c2de;};'use strict';var _=require(_0xe065('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xe065('0x1'));var BPromise=require(_0xe065('0x2'));var rp=require(_0xe065('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xe065('0x4'));var attributes=require(_0xe065('0x5'));module['exports']=function(_0x10b45f,_0x1e7e69){return _0x10b45f[_0xe065('0x6')]('ZendeskConfiguration',attributes,{'tableName':_0xe065('0x7'),'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 e51aa16..5066706 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 _0xeef3=['code','message','info','result','catch','lodash','util','moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','http','ZendeskConfiguration,\x20%s,\x20%s','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x2903d4,_0x35d7c1){var _0x2d966f=function(_0x2a10c5){while(--_0x2a10c5){_0x2903d4['push'](_0x2903d4['shift']());}};_0x2d966f(++_0x35d7c1);}(_0xeef3,0x1be));var _0x3eef=function(_0x49052b,_0x3ba709){_0x49052b=_0x49052b-0x0;var _0x48c045=_0xeef3[_0x49052b];return _0x48c045;};'use strict';var _=require(_0x3eef('0x0'));var util=require(_0x3eef('0x1'));var moment=require(_0x3eef('0x2'));var BPromise=require('bluebird');var rs=require(_0x3eef('0x3'));var fs=require('fs');var Redis=require(_0x3eef('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x3eef('0x5'))(_0x3eef('0x6'));var config=require(_0x3eef('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x3eef('0x8')][_0x3eef('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x360493,_0x1d788a,_0x16a277){return new BPromise(function(_0x14fcf6,_0x37c4f7){return client['request'](_0x360493,_0x16a277)['then'](function(_0x4f4493){logger['info'](_0x3eef('0xa'),_0x1d788a,'request\x20sent');logger[_0x3eef('0xb')](_0x3eef('0xc'),_0x1d788a,_0x3eef('0xd'),JSON[_0x3eef('0xe')](_0x4f4493));if(_0x4f4493['error']){if(_0x4f4493[_0x3eef('0xf')][_0x3eef('0x10')]===0x1f4){logger[_0x3eef('0xf')](_0x3eef('0xa'),_0x1d788a,_0x4f4493[_0x3eef('0xf')][_0x3eef('0x11')]);return _0x37c4f7(_0x4f4493[_0x3eef('0xf')][_0x3eef('0x11')]);}logger[_0x3eef('0xf')](_0x3eef('0xa'),_0x1d788a,_0x4f4493[_0x3eef('0xf')][_0x3eef('0x11')]);return _0x14fcf6(_0x4f4493[_0x3eef('0xf')]['message']);}else{logger[_0x3eef('0x12')](_0x3eef('0xa'),_0x1d788a,_0x3eef('0xd'));_0x14fcf6(_0x4f4493[_0x3eef('0x13')]['message']);}})[_0x3eef('0x14')](function(_0x45a7fa){logger[_0x3eef('0xf')](_0x3eef('0xa'),_0x1d788a,_0x45a7fa);_0x37c4f7(_0x45a7fa);});});} \ No newline at end of file +var _0xc8e8=['message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','ZendeskConfiguration,\x20%s,\x20%s'];(function(_0x28bf5d,_0x4d2cfb){var _0x39a35c=function(_0x311186){while(--_0x311186){_0x28bf5d['push'](_0x28bf5d['shift']());}};_0x39a35c(++_0x4d2cfb);}(_0xc8e8,0xf5));var _0x8c8e=function(_0x597484,_0x199340){_0x597484=_0x597484-0x0;var _0x218e64=_0xc8e8[_0x597484];return _0x218e64;};'use strict';var _=require('lodash');var util=require(_0x8c8e('0x0'));var moment=require(_0x8c8e('0x1'));var BPromise=require(_0x8c8e('0x2'));var rs=require(_0x8c8e('0x3'));var fs=require('fs');var Redis=require(_0x8c8e('0x4'));var db=require(_0x8c8e('0x5'))['db'];var utils=require(_0x8c8e('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x8c8e('0x7'));var jayson=require(_0x8c8e('0x8'));var client=jayson['client'][_0x8c8e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4a4a11,_0x32d4bf,_0x45ca51){return new BPromise(function(_0x56a61a,_0x1776c4){return client[_0x8c8e('0xa')](_0x4a4a11,_0x45ca51)[_0x8c8e('0xb')](function(_0x5e8204){logger[_0x8c8e('0xc')]('ZendeskConfiguration,\x20%s,\x20%s',_0x32d4bf,_0x8c8e('0xd'));logger[_0x8c8e('0xe')](_0x8c8e('0xf'),_0x32d4bf,_0x8c8e('0xd'),JSON[_0x8c8e('0x10')](_0x5e8204));if(_0x5e8204[_0x8c8e('0x11')]){if(_0x5e8204[_0x8c8e('0x11')]['code']===0x1f4){logger[_0x8c8e('0x11')](_0x8c8e('0x12'),_0x32d4bf,_0x5e8204[_0x8c8e('0x11')]['message']);return _0x1776c4(_0x5e8204['error']['message']);}logger['error']('ZendeskConfiguration,\x20%s,\x20%s',_0x32d4bf,_0x5e8204[_0x8c8e('0x11')]['message']);return _0x56a61a(_0x5e8204[_0x8c8e('0x11')][_0x8c8e('0x13')]);}else{logger['info'](_0x8c8e('0x12'),_0x32d4bf,_0x8c8e('0xd'));_0x56a61a(_0x5e8204[_0x8c8e('0x14')][_0x8c8e('0x13')]);}})[_0x8c8e('0x15')](function(_0x5a4a33){logger['error'](_0x8c8e('0x12'),_0x32d4bf,_0x5a4a33);_0x1776c4(_0x5a4a33);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index d6cf81b..8f23e87 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 _0x4670=['destroy','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./intZendeskField.controller','get','isAuthenticated','index','/:id','create','put','delete'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x4670,0x1c1));var _0x0467=function(_0x2984bb,_0x2ac711){_0x2984bb=_0x2984bb-0x0;var _0x1dcc12=_0x4670[_0x2984bb];return _0x1dcc12;};'use strict';var multer=require(_0x0467('0x0'));var util=require('util');var path=require(_0x0467('0x1'));var timeout=require(_0x0467('0x2'));var express=require(_0x0467('0x3'));var router=express['Router']();var fs_extra=require(_0x0467('0x4'));var auth=require(_0x0467('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0467('0x6'));var controller=require(_0x0467('0x7'));router[_0x0467('0x8')]('/',auth[_0x0467('0x9')](),controller[_0x0467('0xa')]);router[_0x0467('0x8')](_0x0467('0xb'),auth[_0x0467('0x9')](),controller['show']);router['post']('/',auth[_0x0467('0x9')](),controller[_0x0467('0xc')]);router[_0x0467('0xd')](_0x0467('0xb'),auth[_0x0467('0x9')](),controller['update']);router[_0x0467('0xe')](_0x0467('0xb'),auth[_0x0467('0x9')](),controller[_0x0467('0xf')]);module['exports']=router; \ No newline at end of file +var _0xf7c6=['isAuthenticated','index','get','/:id','create','put','update','delete','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intZendeskField.controller'];(function(_0xdd5d38,_0x188f00){var _0x567c38=function(_0x37216d){while(--_0x37216d){_0xdd5d38['push'](_0xdd5d38['shift']());}};_0x567c38(++_0x188f00);}(_0xf7c6,0x139));var _0x6f7c=function(_0x290781,_0x53d542){_0x290781=_0x290781-0x0;var _0x1ef41f=_0xf7c6[_0x290781];return _0x1ef41f;};'use strict';var multer=require(_0x6f7c('0x0'));var util=require(_0x6f7c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x6f7c('0x2')]();var fs_extra=require(_0x6f7c('0x3'));var auth=require(_0x6f7c('0x4'));var interaction=require(_0x6f7c('0x5'));var config=require('../../config/environment');var controller=require(_0x6f7c('0x6'));router['get']('/',auth[_0x6f7c('0x7')](),controller[_0x6f7c('0x8')]);router[_0x6f7c('0x9')](_0x6f7c('0xa'),auth[_0x6f7c('0x7')](),controller['show']);router['post']('/',auth[_0x6f7c('0x7')](),controller[_0x6f7c('0xb')]);router[_0x6f7c('0xc')](_0x6f7c('0xa'),auth[_0x6f7c('0x7')](),controller[_0x6f7c('0xd')]);router[_0x6f7c('0xe')](_0x6f7c('0xa'),auth[_0x6f7c('0x7')](),controller['destroy']);module[_0x6f7c('0xf')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index 4a24c7f..0689a34 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 _0x8a06=['keyValue','STRING','sequelize','exports','ENUM','string','variable','customVariable'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x8a06,0x11a));var _0x68a0=function(_0x4fb6b6,_0x5eb1c7){_0x4fb6b6=_0x4fb6b6-0x0;var _0x3ea470=_0x8a06[_0x4fb6b6];return _0x3ea470;};'use strict';var Sequelize=require(_0x68a0('0x0'));module[_0x68a0('0x1')]={'type':{'type':Sequelize[_0x68a0('0x2')](_0x68a0('0x3'),_0x68a0('0x4'),_0x68a0('0x5'),_0x68a0('0x6'),'picklist'),'defaultValue':_0x68a0('0x3')},'content':{'type':Sequelize[_0x68a0('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x68a0('0x2')]('string',_0x68a0('0x4'),_0x68a0('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x68a0('0x7')]},'nameField':{'type':Sequelize[_0x68a0('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x68a0('0x7')]}}; \ No newline at end of file +var _0xc0a9=['string','variable','customVariable','picklist','STRING','sequelize','exports','ENUM'];(function(_0x4da099,_0x46a007){var _0x470d8f=function(_0x4b5d92){while(--_0x4b5d92){_0x4da099['push'](_0x4da099['shift']());}};_0x470d8f(++_0x46a007);}(_0xc0a9,0xbd));var _0x9c0a=function(_0x86b219,_0x43038f){_0x86b219=_0x86b219-0x0;var _0x1f320c=_0xc0a9[_0x86b219];return _0x1f320c;};'use strict';var Sequelize=require(_0x9c0a('0x0'));module[_0x9c0a('0x1')]={'type':{'type':Sequelize[_0x9c0a('0x2')](_0x9c0a('0x3'),_0x9c0a('0x4'),_0x9c0a('0x5'),'keyValue',_0x9c0a('0x6')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x9c0a('0x7')]},'keyType':{'type':Sequelize['ENUM']('string','variable','customVariable')},'keyContent':{'type':Sequelize[_0x9c0a('0x7')]},'idField':{'type':Sequelize[_0x9c0a('0x7')]},'nameField':{'type':Sequelize[_0x9c0a('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index 48f107c..82d0062 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 _0xbde8=['to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','set','apply','reject','then','error','stack','name','index','map','ZendeskField','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','count','includeAll','findAll','rows','catch','params','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbde8,0x155));var _0x8bde=function(_0x7729b1,_0x468322){_0x7729b1=_0x7729b1-0x0;var _0x349504=_0xbde8[_0x7729b1];return _0x349504;};'use strict';var emlformat=require(_0x8bde('0x0'));var rimraf=require(_0x8bde('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8bde('0x2'));var rp=require(_0x8bde('0x3'));var moment=require(_0x8bde('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x8bde('0x5'));var util=require(_0x8bde('0x6'));var path=require(_0x8bde('0x7'));var sox=require(_0x8bde('0x8'));var csv=require(_0x8bde('0x9'));var ejs=require(_0x8bde('0xa'));var fs=require('fs');var fs_extra=require(_0x8bde('0xb'));var _=require(_0x8bde('0xc'));var squel=require(_0x8bde('0xd'));var crypto=require('crypto');var jsforce=require(_0x8bde('0xe'));var deskjs=require(_0x8bde('0xf'));var toCsv=require(_0x8bde('0x9'));var querystring=require(_0x8bde('0x10'));var Papa=require('papaparse');var Redis=require(_0x8bde('0x11'));var authService=require(_0x8bde('0x12'));var qs=require(_0x8bde('0x13'));var as=require(_0x8bde('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8bde('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x8bde('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2b8024,_0x5d62d7){_0x5d62d7=_0x5d62d7||0xcc;return function(_0x46eef9){if(_0x46eef9){return _0x2b8024[_0x8bde('0x17')](_0x5d62d7);}return _0x2b8024[_0x8bde('0x18')](_0x5d62d7)[_0x8bde('0x19')]();};}function respondWithResult(_0x536df9,_0x25946c){_0x25946c=_0x25946c||0xc8;return function(_0x6ae7b9){if(_0x6ae7b9){return _0x536df9[_0x8bde('0x18')](_0x25946c)[_0x8bde('0x1a')](_0x6ae7b9);}};}function respondWithFilteredResult(_0x408ac5,_0x3b089b){return function(_0x19356d){if(_0x19356d){var _0x3c76fe=typeof _0x3b089b[_0x8bde('0x1b')]===_0x8bde('0x1c')&&typeof _0x3b089b['limit']===_0x8bde('0x1c');var _0x4e8a1a=_0x19356d['count'];var _0x32d88e=_0x3c76fe?0x0:_0x3b089b[_0x8bde('0x1b')];var _0x119481=_0x3c76fe?_0x19356d['count']:_0x3b089b['offset']+_0x3b089b[_0x8bde('0x1d')];var _0x3eda85;if(_0x119481>=_0x4e8a1a){_0x119481=_0x4e8a1a;_0x3eda85=0xc8;}else{_0x3eda85=0xce;}_0x408ac5[_0x8bde('0x18')](_0x3eda85);return _0x408ac5[_0x8bde('0x1e')]('Content-Range',_0x32d88e+'-'+_0x119481+'/'+_0x4e8a1a)[_0x8bde('0x1a')](_0x19356d);}return null;};}function patchUpdates(_0x469336){return function(_0x42797e){try{jsonpatch[_0x8bde('0x1f')](_0x42797e,_0x469336,!![]);}catch(_0x15f6c9){return BPromise[_0x8bde('0x20')](_0x15f6c9);}return _0x42797e['save']();};}function saveUpdates(_0x4bb436,_0x4c3dc8){return function(_0x109704){if(_0x109704){return _0x109704['update'](_0x4bb436)[_0x8bde('0x21')](function(_0x18f75b){return _0x18f75b;});}return null;};}function removeEntity(_0x478d04,_0x3a679e){return function(_0x29c6d4){if(_0x29c6d4){return _0x29c6d4['destroy']()[_0x8bde('0x21')](function(){_0x478d04['status'](0xcc)[_0x8bde('0x19')]();});}};}function handleEntityNotFound(_0x290b03,_0x2f6381){return function(_0x4fcea1){if(!_0x4fcea1){_0x290b03[_0x8bde('0x17')](0x194);}return _0x4fcea1;};}function handleError(_0x5cef0d,_0x3bbd21){_0x3bbd21=_0x3bbd21||0x1f4;return function(_0x1d98a8){logger[_0x8bde('0x22')](_0x1d98a8[_0x8bde('0x23')]);if(_0x1d98a8['name']){delete _0x1d98a8[_0x8bde('0x24')];}_0x5cef0d[_0x8bde('0x18')](_0x3bbd21)['send'](_0x1d98a8);};}exports[_0x8bde('0x25')]=function(_0x39ceaf,_0x5d4070){var _0x3ad020={},_0x25fd09={},_0x4bdbdb={'count':0x0,'rows':[]};var _0x23d92e=_[_0x8bde('0x26')](db[_0x8bde('0x27')][_0x8bde('0x28')],function(_0x40d188){return{'name':_0x40d188[_0x8bde('0x29')],'type':_0x40d188[_0x8bde('0x2a')][_0x8bde('0x2b')]};});_0x25fd09[_0x8bde('0x2c')]=_[_0x8bde('0x26')](_0x23d92e,_0x8bde('0x24'));_0x25fd09[_0x8bde('0x2d')]=_['keys'](_0x39ceaf[_0x8bde('0x2d')]);_0x25fd09['filters']=_[_0x8bde('0x2e')](_0x25fd09[_0x8bde('0x2c')],_0x25fd09[_0x8bde('0x2d')]);_0x3ad020[_0x8bde('0x2f')]=_['intersection'](_0x25fd09[_0x8bde('0x2c')],qs[_0x8bde('0x30')](_0x39ceaf[_0x8bde('0x2d')][_0x8bde('0x30')]));_0x3ad020['attributes']=_0x3ad020['attributes'][_0x8bde('0x31')]?_0x3ad020[_0x8bde('0x2f')]:_0x25fd09[_0x8bde('0x2c')];if(!_0x39ceaf[_0x8bde('0x2d')][_0x8bde('0x32')](_0x8bde('0x33'))){_0x3ad020[_0x8bde('0x1d')]=qs['limit'](_0x39ceaf['query']['limit']);_0x3ad020[_0x8bde('0x1b')]=qs[_0x8bde('0x1b')](_0x39ceaf[_0x8bde('0x2d')][_0x8bde('0x1b')]);}_0x3ad020[_0x8bde('0x34')]=qs[_0x8bde('0x35')](_0x39ceaf[_0x8bde('0x2d')][_0x8bde('0x35')]);_0x3ad020[_0x8bde('0x36')]=qs[_0x8bde('0x37')](_[_0x8bde('0x38')](_0x39ceaf[_0x8bde('0x2d')],_0x25fd09[_0x8bde('0x37')]),_0x23d92e);if(_0x39ceaf[_0x8bde('0x2d')][_0x8bde('0x39')]){_0x3ad020[_0x8bde('0x36')]=_[_0x8bde('0x3a')](_0x3ad020['where'],{'$or':_['map'](_0x23d92e,function(_0x21b77a){if(_0x21b77a[_0x8bde('0x2a')]!==_0x8bde('0x3b')){var _0x49dfc6={};_0x49dfc6[_0x21b77a[_0x8bde('0x24')]]={'$like':'%'+_0x39ceaf[_0x8bde('0x2d')][_0x8bde('0x39')]+'%'};return _0x49dfc6;}})});}_0x3ad020=_[_0x8bde('0x3a')]({},_0x3ad020,_0x39ceaf[_0x8bde('0x3c')]);var _0x1c828b={'where':_0x3ad020['where']};return db[_0x8bde('0x27')][_0x8bde('0x3d')](_0x1c828b)['then'](function(_0x2db657){_0x4bdbdb[_0x8bde('0x3d')]=_0x2db657;if(_0x39ceaf[_0x8bde('0x2d')][_0x8bde('0x3e')]){_0x3ad020['include']=[{'all':!![]}];}return db[_0x8bde('0x27')][_0x8bde('0x3f')](_0x3ad020);})[_0x8bde('0x21')](function(_0x484daf){_0x4bdbdb[_0x8bde('0x40')]=_0x484daf;return _0x4bdbdb;})['then'](respondWithFilteredResult(_0x5d4070,_0x3ad020))[_0x8bde('0x41')](handleError(_0x5d4070,null));};exports['show']=function(_0x35e7d5,_0x40a297){var _0x5c4189={'raw':!![],'where':{'id':_0x35e7d5[_0x8bde('0x42')]['id']}},_0x134345={};_0x134345['model']=_['keys'](db[_0x8bde('0x27')][_0x8bde('0x28')]);_0x134345[_0x8bde('0x2d')]=_['keys'](_0x35e7d5[_0x8bde('0x2d')]);_0x134345[_0x8bde('0x37')]=_[_0x8bde('0x2e')](_0x134345[_0x8bde('0x2c')],_0x134345[_0x8bde('0x2d')]);_0x5c4189['attributes']=_[_0x8bde('0x2e')](_0x134345[_0x8bde('0x2c')],qs[_0x8bde('0x30')](_0x35e7d5['query']['fields']));_0x5c4189[_0x8bde('0x2f')]=_0x5c4189[_0x8bde('0x2f')][_0x8bde('0x31')]?_0x5c4189['attributes']:_0x134345['model'];if(_0x35e7d5['query'][_0x8bde('0x3e')]){_0x5c4189['include']=[{'all':!![]}];}_0x5c4189=_[_0x8bde('0x3a')]({},_0x5c4189,_0x35e7d5[_0x8bde('0x3c')]);return db[_0x8bde('0x27')][_0x8bde('0x43')](_0x5c4189)[_0x8bde('0x21')](handleEntityNotFound(_0x40a297,null))[_0x8bde('0x21')](respondWithResult(_0x40a297,null))['catch'](handleError(_0x40a297,null));};exports[_0x8bde('0x44')]=function(_0x58bf37,_0x9dee8c){return db[_0x8bde('0x27')][_0x8bde('0x44')](_0x58bf37['body'],{})[_0x8bde('0x21')](respondWithResult(_0x9dee8c,0xc9))[_0x8bde('0x41')](handleError(_0x9dee8c,null));};exports['update']=function(_0x5710e9,_0x10df7d){if(_0x5710e9[_0x8bde('0x45')]['id']){delete _0x5710e9[_0x8bde('0x45')]['id'];}return db[_0x8bde('0x27')][_0x8bde('0x43')]({'where':{'id':_0x5710e9[_0x8bde('0x42')]['id']}})['then'](handleEntityNotFound(_0x10df7d,null))['then'](saveUpdates(_0x5710e9[_0x8bde('0x45')],null))[_0x8bde('0x21')](respondWithResult(_0x10df7d,null))['catch'](handleError(_0x10df7d,null));};exports['destroy']=function(_0xea86ab,_0x1709fa){return db[_0x8bde('0x27')][_0x8bde('0x43')]({'where':{'id':_0xea86ab['params']['id']}})[_0x8bde('0x21')](handleEntityNotFound(_0x1709fa,null))['then'](removeEntity(_0x1709fa,null))[_0x8bde('0x41')](handleError(_0x1709fa,null));}; \ No newline at end of file +var _0x01f8=['../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','ZendeskField','rawAttributes','type','key','map','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','count','findAll','rows','show','includeAll','include','options','catch','create','body','find','params','eml-format','rimraf','zip-dir','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','ioredis'];(function(_0x391800,_0x454aa8){var _0x1468b2=function(_0x156aef){while(--_0x156aef){_0x391800['push'](_0x391800['shift']());}};_0x1468b2(++_0x454aa8);}(_0x01f8,0x1a7));var _0x801f=function(_0x13cfe4,_0x43242a){_0x13cfe4=_0x13cfe4-0x0;var _0x2f1907=_0x01f8[_0x13cfe4];return _0x2f1907;};'use strict';var emlformat=require(_0x801f('0x0'));var rimraf=require(_0x801f('0x1'));var zipdir=require(_0x801f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x801f('0x3'));var Mustache=require(_0x801f('0x4'));var util=require(_0x801f('0x5'));var path=require(_0x801f('0x6'));var sox=require(_0x801f('0x7'));var csv=require(_0x801f('0x8'));var ejs=require(_0x801f('0x9'));var fs=require('fs');var fs_extra=require(_0x801f('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x801f('0xb'));var jsforce=require(_0x801f('0xc'));var deskjs=require(_0x801f('0xd'));var toCsv=require(_0x801f('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x801f('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x801f('0xf'));var logger=require('../../config/logger')(_0x801f('0x10'));var utils=require('../../config/utils');var config=require(_0x801f('0x11'));var licenseUtil=require(_0x801f('0x12'));var db=require(_0x801f('0x13'))['db'];function respondWithStatusCode(_0x4567d8,_0xcf2a4b){_0xcf2a4b=_0xcf2a4b||0xcc;return function(_0x1367db){if(_0x1367db){return _0x4567d8[_0x801f('0x14')](_0xcf2a4b);}return _0x4567d8[_0x801f('0x15')](_0xcf2a4b)[_0x801f('0x16')]();};}function respondWithResult(_0x4f86c6,_0x12dae5){_0x12dae5=_0x12dae5||0xc8;return function(_0x94952){if(_0x94952){return _0x4f86c6['status'](_0x12dae5)[_0x801f('0x17')](_0x94952);}};}function respondWithFilteredResult(_0x382540,_0x470d48){return function(_0x265284){if(_0x265284){var _0x47d4fa=typeof _0x470d48[_0x801f('0x18')]==='undefined'&&typeof _0x470d48['limit']===_0x801f('0x19');var _0xfe490=_0x265284['count'];var _0x34886b=_0x47d4fa?0x0:_0x470d48[_0x801f('0x18')];var _0x938df=_0x47d4fa?_0x265284['count']:_0x470d48[_0x801f('0x18')]+_0x470d48[_0x801f('0x1a')];var _0x1d142c;if(_0x938df>=_0xfe490){_0x938df=_0xfe490;_0x1d142c=0xc8;}else{_0x1d142c=0xce;}_0x382540['status'](_0x1d142c);return _0x382540[_0x801f('0x1b')](_0x801f('0x1c'),_0x34886b+'-'+_0x938df+'/'+_0xfe490)[_0x801f('0x17')](_0x265284);}return null;};}function patchUpdates(_0xbf0d6d){return function(_0x3d6f85){try{jsonpatch[_0x801f('0x1d')](_0x3d6f85,_0xbf0d6d,!![]);}catch(_0x17d2b1){return BPromise[_0x801f('0x1e')](_0x17d2b1);}return _0x3d6f85[_0x801f('0x1f')]();};}function saveUpdates(_0x45283c,_0x49f35b){return function(_0x262bed){if(_0x262bed){return _0x262bed[_0x801f('0x20')](_0x45283c)[_0x801f('0x21')](function(_0xf13a71){return _0xf13a71;});}return null;};}function removeEntity(_0x4c5d8f,_0x1f31a9){return function(_0x246630){if(_0x246630){return _0x246630[_0x801f('0x22')]()[_0x801f('0x21')](function(){_0x4c5d8f[_0x801f('0x15')](0xcc)[_0x801f('0x16')]();});}};}function handleEntityNotFound(_0x26bae5,_0x584112){return function(_0x1f4451){if(!_0x1f4451){_0x26bae5[_0x801f('0x14')](0x194);}return _0x1f4451;};}function handleError(_0x1e27ca,_0x5b19a1){_0x5b19a1=_0x5b19a1||0x1f4;return function(_0xdeb2a5){logger[_0x801f('0x23')](_0xdeb2a5[_0x801f('0x24')]);if(_0xdeb2a5[_0x801f('0x25')]){delete _0xdeb2a5[_0x801f('0x25')];}_0x1e27ca[_0x801f('0x15')](_0x5b19a1)[_0x801f('0x26')](_0xdeb2a5);};}exports[_0x801f('0x27')]=function(_0x53b9b2,_0x2875e6){var _0x21049e={},_0x71854b={},_0x541529={'count':0x0,'rows':[]};var _0x5464ee=_['map'](db[_0x801f('0x28')][_0x801f('0x29')],function(_0x3a017c){return{'name':_0x3a017c['fieldName'],'type':_0x3a017c[_0x801f('0x2a')][_0x801f('0x2b')]};});_0x71854b['model']=_[_0x801f('0x2c')](_0x5464ee,_0x801f('0x25'));_0x71854b['query']=_[_0x801f('0x2d')](_0x53b9b2[_0x801f('0x2e')]);_0x71854b[_0x801f('0x2f')]=_[_0x801f('0x30')](_0x71854b[_0x801f('0x31')],_0x71854b[_0x801f('0x2e')]);_0x21049e[_0x801f('0x32')]=_[_0x801f('0x30')](_0x71854b[_0x801f('0x31')],qs['fields'](_0x53b9b2[_0x801f('0x2e')][_0x801f('0x33')]));_0x21049e[_0x801f('0x32')]=_0x21049e[_0x801f('0x32')][_0x801f('0x34')]?_0x21049e[_0x801f('0x32')]:_0x71854b[_0x801f('0x31')];if(!_0x53b9b2[_0x801f('0x2e')][_0x801f('0x35')](_0x801f('0x36'))){_0x21049e[_0x801f('0x1a')]=qs['limit'](_0x53b9b2['query'][_0x801f('0x1a')]);_0x21049e[_0x801f('0x18')]=qs['offset'](_0x53b9b2['query'][_0x801f('0x18')]);}_0x21049e[_0x801f('0x37')]=qs[_0x801f('0x38')](_0x53b9b2[_0x801f('0x2e')][_0x801f('0x38')]);_0x21049e[_0x801f('0x39')]=qs['filters'](_['pick'](_0x53b9b2[_0x801f('0x2e')],_0x71854b[_0x801f('0x2f')]),_0x5464ee);if(_0x53b9b2[_0x801f('0x2e')][_0x801f('0x3a')]){_0x21049e[_0x801f('0x39')]=_[_0x801f('0x3b')](_0x21049e['where'],{'$or':_[_0x801f('0x2c')](_0x5464ee,function(_0x46526d){if(_0x46526d[_0x801f('0x2a')]!==_0x801f('0x3c')){var _0x10127e={};_0x10127e[_0x46526d[_0x801f('0x25')]]={'$like':'%'+_0x53b9b2[_0x801f('0x2e')][_0x801f('0x3a')]+'%'};return _0x10127e;}})});}_0x21049e=_[_0x801f('0x3b')]({},_0x21049e,_0x53b9b2['options']);var _0xd6b71a={'where':_0x21049e[_0x801f('0x39')]};return db[_0x801f('0x28')][_0x801f('0x3d')](_0xd6b71a)[_0x801f('0x21')](function(_0xa66d46){_0x541529[_0x801f('0x3d')]=_0xa66d46;if(_0x53b9b2[_0x801f('0x2e')]['includeAll']){_0x21049e['include']=[{'all':!![]}];}return db[_0x801f('0x28')][_0x801f('0x3e')](_0x21049e);})[_0x801f('0x21')](function(_0x546221){_0x541529[_0x801f('0x3f')]=_0x546221;return _0x541529;})['then'](respondWithFilteredResult(_0x2875e6,_0x21049e))['catch'](handleError(_0x2875e6,null));};exports[_0x801f('0x40')]=function(_0x33111c,_0x42b0c5){var _0xad77e6={'raw':!![],'where':{'id':_0x33111c['params']['id']}},_0x531e32={};_0x531e32[_0x801f('0x31')]=_['keys'](db[_0x801f('0x28')][_0x801f('0x29')]);_0x531e32[_0x801f('0x2e')]=_[_0x801f('0x2d')](_0x33111c[_0x801f('0x2e')]);_0x531e32['filters']=_[_0x801f('0x30')](_0x531e32[_0x801f('0x31')],_0x531e32['query']);_0xad77e6[_0x801f('0x32')]=_[_0x801f('0x30')](_0x531e32[_0x801f('0x31')],qs[_0x801f('0x33')](_0x33111c[_0x801f('0x2e')][_0x801f('0x33')]));_0xad77e6[_0x801f('0x32')]=_0xad77e6[_0x801f('0x32')][_0x801f('0x34')]?_0xad77e6[_0x801f('0x32')]:_0x531e32[_0x801f('0x31')];if(_0x33111c[_0x801f('0x2e')][_0x801f('0x41')]){_0xad77e6[_0x801f('0x42')]=[{'all':!![]}];}_0xad77e6=_['merge']({},_0xad77e6,_0x33111c[_0x801f('0x43')]);return db[_0x801f('0x28')]['find'](_0xad77e6)[_0x801f('0x21')](handleEntityNotFound(_0x42b0c5,null))[_0x801f('0x21')](respondWithResult(_0x42b0c5,null))[_0x801f('0x44')](handleError(_0x42b0c5,null));};exports[_0x801f('0x45')]=function(_0x156725,_0x31e9bc){return db[_0x801f('0x28')][_0x801f('0x45')](_0x156725[_0x801f('0x46')],{})[_0x801f('0x21')](respondWithResult(_0x31e9bc,0xc9))[_0x801f('0x44')](handleError(_0x31e9bc,null));};exports['update']=function(_0x4fff8e,_0x11a136){if(_0x4fff8e['body']['id']){delete _0x4fff8e['body']['id'];}return db[_0x801f('0x28')][_0x801f('0x47')]({'where':{'id':_0x4fff8e[_0x801f('0x48')]['id']}})[_0x801f('0x21')](handleEntityNotFound(_0x11a136,null))[_0x801f('0x21')](saveUpdates(_0x4fff8e[_0x801f('0x46')],null))[_0x801f('0x21')](respondWithResult(_0x11a136,null))[_0x801f('0x44')](handleError(_0x11a136,null));};exports['destroy']=function(_0x4f42bf,_0x170978){return db[_0x801f('0x28')][_0x801f('0x47')]({'where':{'id':_0x4f42bf[_0x801f('0x48')]['id']}})[_0x801f('0x21')](handleEntityNotFound(_0x170978,null))[_0x801f('0x21')](removeEntity(_0x170978,null))[_0x801f('0x44')](handleError(_0x170978,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index e50ce78..c214954 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 _0x1fab=['moment','path','rimraf','../../config/environment','define','int_zendesk_fields','idField','FieldId','lodash','../../config/logger','api'];(function(_0x5ad220,_0x27407e){var _0xdec77d=function(_0x58d736){while(--_0x58d736){_0x5ad220['push'](_0x5ad220['shift']());}};_0xdec77d(++_0x27407e);}(_0x1fab,0x1aa));var _0xb1fa=function(_0xfb14d8,_0x494226){_0xfb14d8=_0xfb14d8-0x0;var _0x3d66c6=_0x1fab[_0xfb14d8];return _0x3d66c6;};'use strict';var _=require(_0xb1fa('0x0'));var util=require('util');var logger=require(_0xb1fa('0x1'))(_0xb1fa('0x2'));var moment=require(_0xb1fa('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xb1fa('0x4'));var rimraf=require(_0xb1fa('0x5'));var config=require(_0xb1fa('0x6'));var attributes=require('./intZendeskField.attributes');module['exports']=function(_0x158514,_0x238d19){return _0x158514[_0xb1fa('0x7')]('ZendeskField',attributes,{'tableName':_0xb1fa('0x8'),'paranoid':![],'indexes':[{'name':'zendesk_unique_index','fields':[_0xb1fa('0x9'),_0xb1fa('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xbf19=['rimraf','./intZendeskField.attributes','exports','ZendeskField','int_zendesk_fields','zendesk_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x1459f4,_0x19cb3c){var _0x2bf6b8=function(_0x5b102f){while(--_0x5b102f){_0x1459f4['push'](_0x1459f4['shift']());}};_0x2bf6b8(++_0x19cb3c);}(_0xbf19,0x178));var _0x9bf1=function(_0x345d8f,_0x19e1e9){_0x345d8f=_0x345d8f-0x0;var _0x584779=_0xbf19[_0x345d8f];return _0x584779;};'use strict';var _=require(_0x9bf1('0x0'));var util=require(_0x9bf1('0x1'));var logger=require(_0x9bf1('0x2'))(_0x9bf1('0x3'));var moment=require(_0x9bf1('0x4'));var BPromise=require(_0x9bf1('0x5'));var rp=require(_0x9bf1('0x6'));var fs=require('fs');var path=require(_0x9bf1('0x7'));var rimraf=require(_0x9bf1('0x8'));var config=require('../../config/environment');var attributes=require(_0x9bf1('0x9'));module[_0x9bf1('0xa')]=function(_0x465806,_0x4fb068){return _0x465806['define'](_0x9bf1('0xb'),attributes,{'tableName':_0x9bf1('0xc'),'paranoid':![],'indexes':[{'name':_0x9bf1('0xd'),'fields':[_0x9bf1('0xe'),_0x9bf1('0xf')],'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 50100ad..d7ec0a4 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 _0x22d9=['request','then','ZendeskField,\x20%s,\x20%s','debug','ZendeskField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x5c54a8,_0x5273ff){var _0x4a159a=function(_0x480421){while(--_0x480421){_0x5c54a8['push'](_0x5c54a8['shift']());}};_0x4a159a(++_0x5273ff);}(_0x22d9,0x179));var _0x922d=function(_0x2a34aa,_0x542900){_0x2a34aa=_0x2a34aa-0x0;var _0x3e1050=_0x22d9[_0x2a34aa];return _0x3e1050;};'use strict';var _=require(_0x922d('0x0'));var util=require(_0x922d('0x1'));var moment=require(_0x922d('0x2'));var BPromise=require(_0x922d('0x3'));var rs=require(_0x922d('0x4'));var fs=require('fs');var Redis=require(_0x922d('0x5'));var db=require(_0x922d('0x6'))['db'];var utils=require(_0x922d('0x7'));var logger=require(_0x922d('0x8'))(_0x922d('0x9'));var config=require(_0x922d('0xa'));var jayson=require(_0x922d('0xb'));var client=jayson[_0x922d('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x30fcce,_0x7795f5,_0x1bd88){return new BPromise(function(_0x2f2db1,_0x227a37){return client[_0x922d('0xd')](_0x30fcce,_0x1bd88)[_0x922d('0xe')](function(_0x2c306f){logger['info'](_0x922d('0xf'),_0x7795f5,'request\x20sent');logger[_0x922d('0x10')](_0x922d('0x11'),_0x7795f5,_0x922d('0x12'),JSON[_0x922d('0x13')](_0x2c306f));if(_0x2c306f[_0x922d('0x14')]){if(_0x2c306f[_0x922d('0x14')][_0x922d('0x15')]===0x1f4){logger[_0x922d('0x14')](_0x922d('0xf'),_0x7795f5,_0x2c306f[_0x922d('0x14')]['message']);return _0x227a37(_0x2c306f[_0x922d('0x14')]['message']);}logger[_0x922d('0x14')](_0x922d('0xf'),_0x7795f5,_0x2c306f['error'][_0x922d('0x16')]);return _0x2f2db1(_0x2c306f[_0x922d('0x14')][_0x922d('0x16')]);}else{logger[_0x922d('0x17')]('ZendeskField,\x20%s,\x20%s',_0x7795f5,_0x922d('0x12'));_0x2f2db1(_0x2c306f[_0x922d('0x18')][_0x922d('0x16')]);}})[_0x922d('0x19')](function(_0x5bfd48){logger['error'](_0x922d('0xf'),_0x7795f5,_0x5bfd48);_0x227a37(_0x5bfd48);});});} \ No newline at end of file +var _0x558c=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','stringify','error','code','ZendeskField,\x20%s,\x20%s','message','request\x20sent','result','catch','lodash','moment'];(function(_0x1d8409,_0x3ed12e){var _0x16374c=function(_0xdedbf0){while(--_0xdedbf0){_0x1d8409['push'](_0x1d8409['shift']());}};_0x16374c(++_0x3ed12e);}(_0x558c,0x88));var _0xc558=function(_0x2d1352,_0x13946d){_0x2d1352=_0x2d1352-0x0;var _0x51aaa6=_0x558c[_0x2d1352];return _0x51aaa6;};'use strict';var _=require(_0xc558('0x0'));var util=require('util');var moment=require(_0xc558('0x1'));var BPromise=require(_0xc558('0x2'));var rs=require(_0xc558('0x3'));var fs=require('fs');var Redis=require(_0xc558('0x4'));var db=require(_0xc558('0x5'))['db'];var utils=require(_0xc558('0x6'));var logger=require(_0xc558('0x7'))(_0xc558('0x8'));var config=require(_0xc558('0x9'));var jayson=require(_0xc558('0xa'));var client=jayson[_0xc558('0xb')][_0xc558('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x14d307,_0x3407a2,_0x598714){return new BPromise(function(_0x473749,_0x40c97e){return client['request'](_0x14d307,_0x598714)[_0xc558('0xd')](function(_0x43a34a){logger[_0xc558('0xe')]('ZendeskField,\x20%s,\x20%s',_0x3407a2,'request\x20sent');logger['debug']('ZendeskField,\x20%s,\x20%s,\x20%s',_0x3407a2,'request\x20sent',JSON[_0xc558('0xf')](_0x43a34a));if(_0x43a34a[_0xc558('0x10')]){if(_0x43a34a[_0xc558('0x10')][_0xc558('0x11')]===0x1f4){logger['error'](_0xc558('0x12'),_0x3407a2,_0x43a34a[_0xc558('0x10')][_0xc558('0x13')]);return _0x40c97e(_0x43a34a[_0xc558('0x10')]['message']);}logger['error'](_0xc558('0x12'),_0x3407a2,_0x43a34a[_0xc558('0x10')]['message']);return _0x473749(_0x43a34a['error'][_0xc558('0x13')]);}else{logger[_0xc558('0xe')](_0xc558('0x12'),_0x3407a2,_0xc558('0x14'));_0x473749(_0x43a34a[_0xc558('0x15')][_0xc558('0x13')]);}})[_0xc558('0x16')](function(_0x53e1fc){logger['error']('ZendeskField,\x20%s,\x20%s',_0x3407a2,_0x53e1fc);_0x40c97e(_0x53e1fc);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index 761c596..1d97e9a 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 _0xb624=['get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','getFields','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment'];(function(_0x393b51,_0x233cc8){var _0x38e58b=function(_0x3422e0){while(--_0x3422e0){_0x393b51['push'](_0x393b51['shift']());}};_0x38e58b(++_0x233cc8);}(_0xb624,0x1c6));var _0x4b62=function(_0x42bd43,_0x59fb77){_0x42bd43=_0x42bd43-0x0;var _0x421e88=_0xb624[_0x42bd43];return _0x421e88;};'use strict';var multer=require(_0x4b62('0x0'));var util=require(_0x4b62('0x1'));var path=require(_0x4b62('0x2'));var timeout=require(_0x4b62('0x3'));var express=require(_0x4b62('0x4'));var router=express[_0x4b62('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x4b62('0x6'));var config=require(_0x4b62('0x7'));var controller=require('./intZohoAccount.controller');router[_0x4b62('0x8')]('/',auth[_0x4b62('0x9')](),controller[_0x4b62('0xa')]);router[_0x4b62('0x8')](_0x4b62('0xb'),auth['isAuthenticated'](),controller[_0x4b62('0xc')]);router[_0x4b62('0x8')](_0x4b62('0xd'),auth['isAuthenticated'](),controller[_0x4b62('0xe')]);router[_0x4b62('0x8')]('/:id/fields',auth['isAuthenticated'](),controller[_0x4b62('0xf')]);router[_0x4b62('0x10')]('/',auth[_0x4b62('0x9')](),controller[_0x4b62('0x11')]);router[_0x4b62('0x10')](_0x4b62('0xd'),auth[_0x4b62('0x9')](),controller['addConfiguration']);router[_0x4b62('0x12')]('/:id',auth[_0x4b62('0x9')](),controller[_0x4b62('0x13')]);router['delete']('/:id',auth[_0x4b62('0x9')](),controller[_0x4b62('0x14')]);module[_0x4b62('0x15')]=router; \ No newline at end of file +var _0x2c3c=['getFields','post','create','addConfiguration','put','/:id','update','delete','multer','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','get','isAuthenticated','index','show','/:id/configurations','/:id/fields'];(function(_0x65678f,_0x5983f5){var _0x19dc10=function(_0x80f9ec){while(--_0x80f9ec){_0x65678f['push'](_0x65678f['shift']());}};_0x19dc10(++_0x5983f5);}(_0x2c3c,0x1aa));var _0xc2c3=function(_0x4aeb44,_0x419730){_0x4aeb44=_0x4aeb44-0x0;var _0x1aa240=_0x2c3c[_0x4aeb44];return _0x1aa240;};'use strict';var multer=require(_0xc2c3('0x0'));var util=require('util');var path=require(_0xc2c3('0x1'));var timeout=require(_0xc2c3('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xc2c3('0x3'));var auth=require(_0xc2c3('0x4'));var interaction=require(_0xc2c3('0x5'));var config=require(_0xc2c3('0x6'));var controller=require(_0xc2c3('0x7'));router[_0xc2c3('0x8')]('/',auth[_0xc2c3('0x9')](),controller[_0xc2c3('0xa')]);router[_0xc2c3('0x8')]('/:id',auth[_0xc2c3('0x9')](),controller[_0xc2c3('0xb')]);router[_0xc2c3('0x8')](_0xc2c3('0xc'),auth[_0xc2c3('0x9')](),controller['getConfigurations']);router[_0xc2c3('0x8')](_0xc2c3('0xd'),auth[_0xc2c3('0x9')](),controller[_0xc2c3('0xe')]);router[_0xc2c3('0xf')]('/',auth[_0xc2c3('0x9')](),controller[_0xc2c3('0x10')]);router[_0xc2c3('0xf')]('/:id/configurations',auth['isAuthenticated'](),controller[_0xc2c3('0x11')]);router[_0xc2c3('0x12')](_0xc2c3('0x13'),auth[_0xc2c3('0x9')](),controller[_0xc2c3('0x14')]);router[_0xc2c3('0x15')](_0xc2c3('0x13'),auth[_0xc2c3('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index e4c3a01..d39d058 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 _0x2dae=['STRING','sequelize'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x2dae,0xc3));var _0xe2da=function(_0x4c9380,_0x2fefc0){_0x4c9380=_0x4c9380-0x0;var _0x49a523=_0x2dae[_0x4c9380];return _0x49a523;};'use strict';var Sequelize=require(_0xe2da('0x0'));module['exports']={'name':{'type':Sequelize[_0xe2da('0x1')]},'description':{'type':Sequelize[_0xe2da('0x1')]},'host':{'type':Sequelize[_0xe2da('0x1')]},'zone':{'type':Sequelize[_0xe2da('0x1')]},'clientId':{'type':Sequelize[_0xe2da('0x1')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xe2da('0x1')],'allowNull':![]},'code':{'type':Sequelize[_0xe2da('0x1')]},'refreshToken':{'type':Sequelize[_0xe2da('0x1')]}}; \ No newline at end of file +var _0x668b=['exports','STRING','sequelize'];(function(_0x56740a,_0x568894){var _0x257144=function(_0x2b8cc5){while(--_0x2b8cc5){_0x56740a['push'](_0x56740a['shift']());}};_0x257144(++_0x568894);}(_0x668b,0x140));var _0xb668=function(_0x1abb09,_0x18ee91){_0x1abb09=_0x1abb09-0x0;var _0xea1c07=_0x668b[_0x1abb09];return _0xea1c07;};'use strict';var Sequelize=require(_0xb668('0x0'));module[_0xb668('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xb668('0x2')]},'host':{'type':Sequelize[_0xb668('0x2')]},'zone':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0xb668('0x2')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xb668('0x2')],'allowNull':![]},'code':{'type':Sequelize[_0xb668('0x2')]},'refreshToken':{'type':Sequelize[_0xb668('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index 3772e52..c381d6a 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 _0x990c=['display_label','custom_field','data_type','picklist','pick_list_values','statusCode','getFields','stringify','test','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','to-csv','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/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','stack','name','send','map','ZohoAccount','rawAttributes','fieldName','key','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','options','find','create','body','getConfigurations','ZohoConfiguration','pick','addConfiguration','findOne','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','clientSecret','access_token','host','clientId','serverUrl','code','com','slice','substring','lastIndexOf','refreshToken','GET','format','Calls','Zoho-oauthtoken\x20','response','error','message','Owner','Subject','Description','WhoId','Call_Duration','Call_Type','remove','api_name','system_mandatory','push'];(function(_0x547a0f,_0x4fe37c){var _0x79bf93=function(_0x360cd3){while(--_0x360cd3){_0x547a0f['push'](_0x547a0f['shift']());}};_0x79bf93(++_0x4fe37c);}(_0x990c,0x110));var _0xc990=function(_0x199549,_0x54cceb){_0x199549=_0x199549-0x0;var _0x85550b=_0x990c[_0x199549];return _0x85550b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc990('0x0'));var zipdir=require(_0xc990('0x1'));var jsonpatch=require(_0xc990('0x2'));var rp=require('request-promise');var moment=require(_0xc990('0x3'));var BPromise=require(_0xc990('0x4'));var Mustache=require('mustache');var util=require(_0xc990('0x5'));var path=require(_0xc990('0x6'));var sox=require('sox');var csv=require(_0xc990('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc990('0x8'));var _=require(_0xc990('0x9'));var squel=require(_0xc990('0xa'));var crypto=require(_0xc990('0xb'));var jsforce=require(_0xc990('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xc990('0x7'));var querystring=require(_0xc990('0xd'));var Papa=require(_0xc990('0xe'));var Redis=require(_0xc990('0xf'));var authService=require(_0xc990('0x10'));var qs=require(_0xc990('0x11'));var as=require(_0xc990('0x12'));var hardwareService=require(_0xc990('0x13'));var logger=require(_0xc990('0x14'))(_0xc990('0x15'));var utils=require('../../config/utils');var config=require(_0xc990('0x16'));var licenseUtil=require(_0xc990('0x17'));var db=require(_0xc990('0x18'))['db'];var integrations=require(_0xc990('0x19'));function respondWithStatusCode(_0x5eda77,_0x272ab8){_0x272ab8=_0x272ab8||0xcc;return function(_0x49e140){if(_0x49e140){return _0x5eda77[_0xc990('0x1a')](_0x272ab8);}return _0x5eda77[_0xc990('0x1b')](_0x272ab8)[_0xc990('0x1c')]();};}function respondWithResult(_0x5e1983,_0x57bef2){_0x57bef2=_0x57bef2||0xc8;return function(_0x1d5000){if(_0x1d5000){return _0x5e1983[_0xc990('0x1b')](_0x57bef2)['json'](_0x1d5000);}};}function respondWithFilteredResult(_0x2ad4ff,_0x20c72c){return function(_0x235159){if(_0x235159){var _0x2fa123=typeof _0x20c72c[_0xc990('0x1d')]===_0xc990('0x1e')&&typeof _0x20c72c[_0xc990('0x1f')]===_0xc990('0x1e');var _0x20c325=_0x235159[_0xc990('0x20')];var _0x34ef53=_0x2fa123?0x0:_0x20c72c[_0xc990('0x1d')];var _0x1b3812=_0x2fa123?_0x235159[_0xc990('0x20')]:_0x20c72c[_0xc990('0x1d')]+_0x20c72c[_0xc990('0x1f')];var _0x34cca9;if(_0x1b3812>=_0x20c325){_0x1b3812=_0x20c325;_0x34cca9=0xc8;}else{_0x34cca9=0xce;}_0x2ad4ff[_0xc990('0x1b')](_0x34cca9);return _0x2ad4ff[_0xc990('0x21')](_0xc990('0x22'),_0x34ef53+'-'+_0x1b3812+'/'+_0x20c325)['json'](_0x235159);}return null;};}function patchUpdates(_0x15b00e){return function(_0x47bf95){try{jsonpatch[_0xc990('0x23')](_0x47bf95,_0x15b00e,!![]);}catch(_0x51de9f){return BPromise['reject'](_0x51de9f);}return _0x47bf95[_0xc990('0x24')]();};}function saveUpdates(_0x45cba9,_0x5be455){return function(_0x38bdb6){if(_0x38bdb6){return _0x38bdb6[_0xc990('0x25')](_0x45cba9)[_0xc990('0x26')](function(_0x3c79ca){return _0x3c79ca;});}return null;};}function removeEntity(_0x1809ca,_0x4d1bfd){return function(_0x3f37c2){if(_0x3f37c2){return _0x3f37c2[_0xc990('0x27')]()[_0xc990('0x26')](function(){_0x1809ca[_0xc990('0x1b')](0xcc)[_0xc990('0x1c')]();});}};}function handleEntityNotFound(_0x2b9442,_0x4bcb18){return function(_0x17da22){if(!_0x17da22){_0x2b9442[_0xc990('0x1a')](0x194);}return _0x17da22;};}function handleError(_0x2c035b,_0x9f8b5b){_0x9f8b5b=_0x9f8b5b||0x1f4;return function(_0x223f0d){logger['error'](_0x223f0d[_0xc990('0x28')]);if(_0x223f0d[_0xc990('0x29')]){delete _0x223f0d[_0xc990('0x29')];}_0x2c035b[_0xc990('0x1b')](_0x9f8b5b)[_0xc990('0x2a')](_0x223f0d);};}exports['index']=function(_0x1199dc,_0x405648){var _0x494b88={},_0x2d22ba={},_0x3d1125={'count':0x0,'rows':[]};var _0x4a2723=_[_0xc990('0x2b')](db[_0xc990('0x2c')][_0xc990('0x2d')],function(_0x215b4a){return{'name':_0x215b4a[_0xc990('0x2e')],'type':_0x215b4a['type'][_0xc990('0x2f')]};});_0x2d22ba['model']=_['map'](_0x4a2723,_0xc990('0x29'));_0x2d22ba['query']=_['keys'](_0x1199dc[_0xc990('0x30')]);_0x2d22ba[_0xc990('0x31')]=_[_0xc990('0x32')](_0x2d22ba[_0xc990('0x33')],_0x2d22ba[_0xc990('0x30')]);_0x494b88['attributes']=_[_0xc990('0x32')](_0x2d22ba[_0xc990('0x33')],qs['fields'](_0x1199dc[_0xc990('0x30')][_0xc990('0x34')]));_0x494b88[_0xc990('0x35')]=_0x494b88[_0xc990('0x35')][_0xc990('0x36')]?_0x494b88[_0xc990('0x35')]:_0x2d22ba[_0xc990('0x33')];if(!_0x1199dc[_0xc990('0x30')][_0xc990('0x37')](_0xc990('0x38'))){_0x494b88[_0xc990('0x1f')]=qs[_0xc990('0x1f')](_0x1199dc['query'][_0xc990('0x1f')]);_0x494b88[_0xc990('0x1d')]=qs[_0xc990('0x1d')](_0x1199dc[_0xc990('0x30')][_0xc990('0x1d')]);}_0x494b88['order']=qs[_0xc990('0x39')](_0x1199dc[_0xc990('0x30')][_0xc990('0x39')]);_0x494b88[_0xc990('0x3a')]=qs['filters'](_['pick'](_0x1199dc[_0xc990('0x30')],_0x2d22ba[_0xc990('0x31')]),_0x4a2723);if(_0x1199dc[_0xc990('0x30')][_0xc990('0x3b')]){_0x494b88[_0xc990('0x3a')]=_[_0xc990('0x3c')](_0x494b88[_0xc990('0x3a')],{'$or':_[_0xc990('0x2b')](_0x4a2723,function(_0x41189f){if(_0x41189f[_0xc990('0x3d')]!==_0xc990('0x3e')){var _0x535d62={};_0x535d62[_0x41189f[_0xc990('0x29')]]={'$like':'%'+_0x1199dc[_0xc990('0x30')][_0xc990('0x3b')]+'%'};return _0x535d62;}})});}_0x494b88=_[_0xc990('0x3c')]({},_0x494b88,_0x1199dc['options']);var _0x215542={'where':_0x494b88[_0xc990('0x3a')]};return db[_0xc990('0x2c')]['count'](_0x215542)[_0xc990('0x26')](function(_0x5083fa){_0x3d1125[_0xc990('0x20')]=_0x5083fa;if(_0x1199dc['query'][_0xc990('0x3f')]){_0x494b88[_0xc990('0x40')]=[{'all':!![]}];}return db[_0xc990('0x2c')][_0xc990('0x41')](_0x494b88);})[_0xc990('0x26')](function(_0x5080d8){_0x3d1125[_0xc990('0x42')]=_0x5080d8;return _0x3d1125;})[_0xc990('0x26')](respondWithFilteredResult(_0x405648,_0x494b88))[_0xc990('0x43')](handleError(_0x405648,null));};exports[_0xc990('0x44')]=function(_0x148042,_0x193d38){var _0x82c892={'raw':![],'where':{'id':_0x148042[_0xc990('0x45')]['id']}},_0x27d842={};_0x27d842[_0xc990('0x33')]=_[_0xc990('0x46')](db[_0xc990('0x2c')][_0xc990('0x2d')]);_0x27d842[_0xc990('0x30')]=_[_0xc990('0x46')](_0x148042['query']);_0x27d842[_0xc990('0x31')]=_[_0xc990('0x32')](_0x27d842['model'],_0x27d842[_0xc990('0x30')]);_0x82c892[_0xc990('0x35')]=_['intersection'](_0x27d842[_0xc990('0x33')],qs[_0xc990('0x34')](_0x148042['query'][_0xc990('0x34')]));_0x82c892[_0xc990('0x35')]=_0x82c892[_0xc990('0x35')][_0xc990('0x36')]?_0x82c892[_0xc990('0x35')]:_0x27d842['model'];if(_0x148042[_0xc990('0x30')][_0xc990('0x3f')]){_0x82c892['include']=[{'all':!![]}];}_0x82c892=_['merge']({},_0x82c892,_0x148042[_0xc990('0x47')]);return db['ZohoAccount'][_0xc990('0x48')](_0x82c892)[_0xc990('0x26')](handleEntityNotFound(_0x193d38,null))['then'](respondWithResult(_0x193d38,null))[_0xc990('0x43')](handleError(_0x193d38,null));};exports[_0xc990('0x49')]=function(_0x5b8d84,_0x14a69f){return db[_0xc990('0x2c')][_0xc990('0x49')](_0x5b8d84[_0xc990('0x4a')],{})['then'](respondWithResult(_0x14a69f,0xc9))[_0xc990('0x43')](handleError(_0x14a69f,null));};exports[_0xc990('0x25')]=function(_0x2be4b7,_0x8feedd){if(_0x2be4b7['body']['id']){delete _0x2be4b7[_0xc990('0x4a')]['id'];}return db['ZohoAccount'][_0xc990('0x48')]({'where':{'id':_0x2be4b7[_0xc990('0x45')]['id']}})[_0xc990('0x26')](handleEntityNotFound(_0x8feedd,null))['then'](saveUpdates(_0x2be4b7['body'],null))[_0xc990('0x26')](respondWithResult(_0x8feedd,null))['catch'](handleError(_0x8feedd,null));};exports[_0xc990('0x27')]=function(_0xa4fa1d,_0x19e373){return db[_0xc990('0x2c')][_0xc990('0x48')]({'where':{'id':_0xa4fa1d['params']['id']}})[_0xc990('0x26')](handleEntityNotFound(_0x19e373,null))[_0xc990('0x26')](removeEntity(_0x19e373,null))[_0xc990('0x43')](handleError(_0x19e373,null));};exports[_0xc990('0x4b')]=function(_0x324415,_0xf366b7,_0x33e894){var _0x28b267={};var _0x525044={};var _0x3ae3e0;var _0x2ab128;return db[_0xc990('0x2c')]['findOne']({'where':{'id':_0x324415[_0xc990('0x45')]['id']}})[_0xc990('0x26')](handleEntityNotFound(_0xf366b7,null))['then'](function(_0x49cf09){if(_0x49cf09){_0x3ae3e0=_0x49cf09;_0x525044[_0xc990('0x33')]=_[_0xc990('0x46')](db[_0xc990('0x4c')][_0xc990('0x2d')]);_0x525044[_0xc990('0x30')]=_[_0xc990('0x46')](_0x324415[_0xc990('0x30')]);_0x525044[_0xc990('0x31')]=_[_0xc990('0x32')](_0x525044['model'],_0x525044['query']);_0x28b267[_0xc990('0x35')]=_[_0xc990('0x32')](_0x525044['model'],qs[_0xc990('0x34')](_0x324415['query']['fields']));_0x28b267[_0xc990('0x35')]=_0x28b267[_0xc990('0x35')][_0xc990('0x36')]?_0x28b267[_0xc990('0x35')]:_0x525044['model'];_0x28b267['order']=qs[_0xc990('0x39')](_0x324415[_0xc990('0x30')][_0xc990('0x39')]);_0x28b267[_0xc990('0x3a')]=qs['filters'](_[_0xc990('0x4d')](_0x324415['query'],_0x525044[_0xc990('0x31')]));if(_0x324415['query'][_0xc990('0x3b')]){_0x28b267[_0xc990('0x3a')]=_[_0xc990('0x3c')](_0x28b267[_0xc990('0x3a')],{'$or':_['map'](_0x28b267[_0xc990('0x35')],function(_0x39c002){var _0x3e1aa9={};_0x3e1aa9[_0x39c002]={'$like':'%'+_0x324415[_0xc990('0x30')][_0xc990('0x3b')]+'%'};return _0x3e1aa9;})});}_0x28b267=_['merge']({},_0x28b267,_0x324415[_0xc990('0x47')]);return _0x3ae3e0[_0xc990('0x4b')](_0x28b267);}})['then'](function(_0x1ad82f){if(_0x1ad82f){_0x2ab128=_0x1ad82f['length'];if(!_0x324415[_0xc990('0x30')][_0xc990('0x37')](_0xc990('0x38'))){_0x28b267['limit']=qs[_0xc990('0x1f')](_0x324415[_0xc990('0x30')][_0xc990('0x1f')]);_0x28b267[_0xc990('0x1d')]=qs[_0xc990('0x1d')](_0x324415[_0xc990('0x30')][_0xc990('0x1d')]);}return _0x3ae3e0[_0xc990('0x4b')](_0x28b267);}})[_0xc990('0x26')](function(_0x32a58a){if(_0x32a58a){return _0x32a58a?{'count':_0x2ab128,'rows':_0x32a58a}:null;}})[_0xc990('0x26')](respondWithResult(_0xf366b7,null))[_0xc990('0x43')](handleError(_0xf366b7,null));};exports[_0xc990('0x4e')]=function(_0x59db7b,_0x110bc6,_0x32bdb6){if(_0x59db7b[_0xc990('0x4a')]['id']){delete _0x59db7b['body']['id'];}return db[_0xc990('0x2c')][_0xc990('0x4f')]({'where':{'id':_0x59db7b[_0xc990('0x45')]['id']}})[_0xc990('0x26')](handleEntityNotFound(_0x110bc6,null))[_0xc990('0x26')](function(_0x1816e0){if(_0x1816e0){_0x59db7b[_0xc990('0x4a')][_0xc990('0x50')]=_0x1816e0['id'];_0x59db7b[_0xc990('0x4a')][_0xc990('0x51')]=integrations[_0xc990('0x52')](_0x59db7b[_0xc990('0x4a')]['channel'],_0x59db7b[_0xc990('0x4a')][_0xc990('0x3d')]);_0x59db7b[_0xc990('0x4a')][_0xc990('0x53')]=integrations[_0xc990('0x54')](_0x59db7b[_0xc990('0x4a')]['channel'],_0x59db7b[_0xc990('0x4a')][_0xc990('0x3d')]);return db['ZohoConfiguration'][_0xc990('0x49')](_0x59db7b[_0xc990('0x4a')],{'include':[{'model':db[_0xc990('0x55')],'as':'Subjects'},{'model':db[_0xc990('0x55')],'as':_0xc990('0x53')}]});}return null;})['then'](respondWithResult(_0x110bc6,null))['catch'](handleError(_0x110bc6,null));};function getAccessToken(_0x587c4b){return new Promise(function(_0x1dc7c0,_0x528ec1){var _0x2b5d22;switch(_0x587c4b[_0xc990('0x56')]){case'US':_0x2b5d22=_0xc990('0x57');break;case'AU':_0x2b5d22=_0xc990('0x58');break;case'EU':_0x2b5d22='https://accounts.zoho.eu';break;case'IN':_0x2b5d22=_0xc990('0x59');break;case'CN':_0x2b5d22=_0xc990('0x5a');break;default:_0x2b5d22=_0xc990('0x5b');break;}var _0x3839c6={'method':_0xc990('0x5c'),'uri':_0x2b5d22+'/oauth/v2/token','qs':{'refresh_token':_0x587c4b['refreshToken'],'client_id':_0x587c4b['clientId'],'client_secret':_0x587c4b[_0xc990('0x5d')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x3839c6)[_0xc990('0x26')](function(_0x3dfc2a){if(_0x3dfc2a[_0xc990('0x5e')]){_0x1dc7c0(_0x3dfc2a[_0xc990('0x5e')]);}else{_0x528ec1('Unable\x20to\x20retrieve\x20the\x20access\x20token');}})[_0xc990('0x43')](function(_0x3f1a42){_0x528ec1(_0x3f1a42);});});}exports['getFields']=function(_0x252b24,_0x5eef51,_0x51db1b){var _0x4e2dc7,_0xfd73f1,_0x322c5e,_0x1b2053,_0x43a1ef;return db[_0xc990('0x2c')][_0xc990('0x4f')]({'where':{'id':_0x252b24['params']['id']},'attributes':['id',_0xc990('0x5f'),_0xc990('0x56'),_0xc990('0x60'),_0xc990('0x5d'),_0xc990('0x61'),_0xc990('0x62'),'refreshToken']})[_0xc990('0x26')](handleEntityNotFound(_0x5eef51,null))[_0xc990('0x26')](function(_0x1e16cd){_0x43a1ef=_0x1e16cd;_0x4e2dc7=_0x43a1ef[_0xc990('0x5f')];_0xfd73f1=_0x4e2dc7==='zoho.eu'?'eu':_0xc990('0x63');_0x322c5e=_0x43a1ef[_0xc990('0x61')];var _0x233e72=_0x322c5e[_0xc990('0x64')](-0x1);if(_0x233e72==='/'||_0x233e72==='\x5c'||_0x233e72===':'){_0x322c5e=_0x322c5e[_0xc990('0x65')](0x0,_0x322c5e[_0xc990('0x66')](_0x233e72));}if(!_0x43a1ef[_0xc990('0x67')]){throw new Error('Refresh\x20Token\x20not\x20available\x20for\x20the\x20account');}return getAccessToken(_0x43a1ef);})['then'](function(_0x555e2f){if(_0x555e2f){return rp({'method':_0xc990('0x68'),'uri':util[_0xc990('0x69')]('https://www.zohoapis.%s/crm/v2/settings/fields',_0xfd73f1),'qs':{'module':_0xc990('0x6a')},'headers':{'Authorization':_0xc990('0x6b')+_0x555e2f},'json':!![]});}})[_0xc990('0x26')](function(_0x46b3c7){if(_0x46b3c7){if(_0x46b3c7['response']&&_0x46b3c7[_0xc990('0x6c')][_0xc990('0x6d')]){throw new Error(_0x46b3c7[_0xc990('0x6c')][_0xc990('0x6d')][_0xc990('0x6e')]);}var _0xe89f5d=[];var _0x2ed01b=[];var _0x3b95b9=[_0xc990('0x6f'),_0xc990('0x70'),_0xc990('0x71'),_0xc990('0x72'),_0xc990('0x73'),'Call_Result','Call_Start_Time',_0xc990('0x74')];_0x2ed01b=_[_0xc990('0x75')](_0x46b3c7[_0xc990('0x34')],function(_0x3fc5d8){return _0x3b95b9['includes'](_0x3fc5d8[_0xc990('0x76')]);});for(var _0x194023=0x0;_0x194023<_0x2ed01b[_0xc990('0x36')];_0x194023++){if(_0x2ed01b[_0x194023][_0xc990('0x77')]===![]){_0xe89f5d[_0xc990('0x78')]({'id':_0x2ed01b[_0x194023]['id'],'name':_0x2ed01b[_0x194023][_0xc990('0x79')],'custom':_0x2ed01b[_0x194023][_0xc990('0x7a')],'options':_0x2ed01b[_0x194023][_0xc990('0x7b')]===_0xc990('0x7c')&&_0x2ed01b[_0x194023][_0xc990('0x7d')][_0xc990('0x36')]>-0x1?_[_0xc990('0x2b')](_0x2ed01b[_0x194023][_0xc990('0x7d')],function(_0x490d00){return{'name':_0x490d00,'value':_0x490d00};}):[]});}}return{'count':_0xe89f5d[_0xc990('0x36')],'rows':_0xe89f5d};}else{return{'count':0x0,'rows':[]};}})[_0xc990('0x26')](respondWithResult(_0x5eef51,null))[_0xc990('0x43')](function(_0x27913f){var _0x2c14f1=_0x252b24[_0xc990('0x30')]['test']?0x1f4:_0x27913f[_0xc990('0x7e')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0xc990('0x7f'),_0x2c14f1,JSON[_0xc990('0x80')](_0x27913f));delete _0x27913f[_0xc990('0x29')];if(_0x2c14f1===0x191){_0x2c14f1=0x190;}_0x5eef51[_0xc990('0x1b')](_0x2c14f1)[_0xc990('0x2a')](_0x252b24[_0xc990('0x30')][_0xc990('0x81')]?{'message':_0xc990('0x82'),'statusCode':_0x27913f[_0xc990('0x7e')]}:_0x27913f);});}; \ No newline at end of file +var _0x8945=['/oauth/v2/token','clientId','clientSecret','refresh_token','access_token','serverUrl','code','refreshToken','host','com','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','https://www.zohoapis.%s/crm/v2/settings/fields','Calls','response','message','Owner','Subject','Call_Duration','Call_Result','Call_Start_Time','Call_Type','remove','includes','push','display_label','custom_field','data_type','picklist','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','ZohoAccount','includeAll','include','rows','catch','show','params','find','create','body','destroy','findOne','ZohoConfiguration','order','getConfigurations','getSubjects','channel','Descriptions','getDescriptions','ZohoField','Subjects','zone','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST'];(function(_0x1da3dd,_0x1f428b){var _0x37ef5e=function(_0x2e937b){while(--_0x2e937b){_0x1da3dd['push'](_0x1da3dd['shift']());}};_0x37ef5e(++_0x1f428b);}(_0x8945,0x19a));var _0x5894=function(_0x3e311c,_0x4f70ac){_0x3e311c=_0x3e311c-0x0;var _0x3f8627=_0x8945[_0x3e311c];return _0x3f8627;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5894('0x0'));var zipdir=require(_0x5894('0x1'));var jsonpatch=require(_0x5894('0x2'));var rp=require(_0x5894('0x3'));var moment=require('moment');var BPromise=require(_0x5894('0x4'));var Mustache=require(_0x5894('0x5'));var util=require('util');var path=require('path');var sox=require(_0x5894('0x6'));var csv=require(_0x5894('0x7'));var ejs=require(_0x5894('0x8'));var fs=require('fs');var fs_extra=require(_0x5894('0x9'));var _=require(_0x5894('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5894('0xb'));var toCsv=require('to-csv');var querystring=require(_0x5894('0xc'));var Papa=require(_0x5894('0xd'));var Redis=require(_0x5894('0xe'));var authService=require(_0x5894('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5894('0x10'))(_0x5894('0x11'));var utils=require(_0x5894('0x12'));var config=require(_0x5894('0x13'));var licenseUtil=require(_0x5894('0x14'));var db=require(_0x5894('0x15'))['db'];var integrations=require(_0x5894('0x16'));function respondWithStatusCode(_0x472eb3,_0x3e7382){_0x3e7382=_0x3e7382||0xcc;return function(_0x5c0eac){if(_0x5c0eac){return _0x472eb3[_0x5894('0x17')](_0x3e7382);}return _0x472eb3[_0x5894('0x18')](_0x3e7382)[_0x5894('0x19')]();};}function respondWithResult(_0x48dad3,_0x132db2){_0x132db2=_0x132db2||0xc8;return function(_0x348f9c){if(_0x348f9c){return _0x48dad3[_0x5894('0x18')](_0x132db2)[_0x5894('0x1a')](_0x348f9c);}};}function respondWithFilteredResult(_0x1031dd,_0x441bf0){return function(_0xaa5977){if(_0xaa5977){var _0x4661cb=typeof _0x441bf0[_0x5894('0x1b')]===_0x5894('0x1c')&&typeof _0x441bf0[_0x5894('0x1d')]===_0x5894('0x1c');var _0x1ded32=_0xaa5977[_0x5894('0x1e')];var _0x3f2b33=_0x4661cb?0x0:_0x441bf0['offset'];var _0x3409b9=_0x4661cb?_0xaa5977[_0x5894('0x1e')]:_0x441bf0[_0x5894('0x1b')]+_0x441bf0[_0x5894('0x1d')];var _0xb418f4;if(_0x3409b9>=_0x1ded32){_0x3409b9=_0x1ded32;_0xb418f4=0xc8;}else{_0xb418f4=0xce;}_0x1031dd[_0x5894('0x18')](_0xb418f4);return _0x1031dd[_0x5894('0x1f')](_0x5894('0x20'),_0x3f2b33+'-'+_0x3409b9+'/'+_0x1ded32)[_0x5894('0x1a')](_0xaa5977);}return null;};}function patchUpdates(_0x3321a3){return function(_0x11ac9e){try{jsonpatch[_0x5894('0x21')](_0x11ac9e,_0x3321a3,!![]);}catch(_0x2bb524){return BPromise[_0x5894('0x22')](_0x2bb524);}return _0x11ac9e[_0x5894('0x23')]();};}function saveUpdates(_0x4e1d8d,_0x4abae4){return function(_0x12353b){if(_0x12353b){return _0x12353b[_0x5894('0x24')](_0x4e1d8d)[_0x5894('0x25')](function(_0x2ca2a7){return _0x2ca2a7;});}return null;};}function removeEntity(_0x16c7e8,_0x479bb4){return function(_0x38c209){if(_0x38c209){return _0x38c209['destroy']()[_0x5894('0x25')](function(){_0x16c7e8[_0x5894('0x18')](0xcc)[_0x5894('0x19')]();});}};}function handleEntityNotFound(_0x12147d,_0x502e1c){return function(_0xb3d43){if(!_0xb3d43){_0x12147d[_0x5894('0x17')](0x194);}return _0xb3d43;};}function handleError(_0x14253e,_0x5c86d2){_0x5c86d2=_0x5c86d2||0x1f4;return function(_0x57ae76){logger[_0x5894('0x26')](_0x57ae76['stack']);if(_0x57ae76[_0x5894('0x27')]){delete _0x57ae76[_0x5894('0x27')];}_0x14253e[_0x5894('0x18')](_0x5c86d2)[_0x5894('0x28')](_0x57ae76);};}exports['index']=function(_0x57a42d,_0x50c96f){var _0x16f303={},_0x492055={},_0x26f8c9={'count':0x0,'rows':[]};var _0x37c732=_[_0x5894('0x29')](db['ZohoAccount'][_0x5894('0x2a')],function(_0x55c23c){return{'name':_0x55c23c[_0x5894('0x2b')],'type':_0x55c23c[_0x5894('0x2c')][_0x5894('0x2d')]};});_0x492055[_0x5894('0x2e')]=_['map'](_0x37c732,_0x5894('0x27'));_0x492055[_0x5894('0x2f')]=_[_0x5894('0x30')](_0x57a42d[_0x5894('0x2f')]);_0x492055[_0x5894('0x31')]=_[_0x5894('0x32')](_0x492055['model'],_0x492055[_0x5894('0x2f')]);_0x16f303[_0x5894('0x33')]=_[_0x5894('0x32')](_0x492055[_0x5894('0x2e')],qs[_0x5894('0x34')](_0x57a42d[_0x5894('0x2f')][_0x5894('0x34')]));_0x16f303[_0x5894('0x33')]=_0x16f303[_0x5894('0x33')][_0x5894('0x35')]?_0x16f303[_0x5894('0x33')]:_0x492055[_0x5894('0x2e')];if(!_0x57a42d[_0x5894('0x2f')][_0x5894('0x36')](_0x5894('0x37'))){_0x16f303[_0x5894('0x1d')]=qs['limit'](_0x57a42d[_0x5894('0x2f')][_0x5894('0x1d')]);_0x16f303[_0x5894('0x1b')]=qs[_0x5894('0x1b')](_0x57a42d['query'][_0x5894('0x1b')]);}_0x16f303['order']=qs[_0x5894('0x38')](_0x57a42d[_0x5894('0x2f')]['sort']);_0x16f303[_0x5894('0x39')]=qs[_0x5894('0x31')](_[_0x5894('0x3a')](_0x57a42d[_0x5894('0x2f')],_0x492055[_0x5894('0x31')]),_0x37c732);if(_0x57a42d[_0x5894('0x2f')][_0x5894('0x3b')]){_0x16f303[_0x5894('0x39')]=_[_0x5894('0x3c')](_0x16f303[_0x5894('0x39')],{'$or':_[_0x5894('0x29')](_0x37c732,function(_0x5c7b85){if(_0x5c7b85[_0x5894('0x2c')]!==_0x5894('0x3d')){var _0x92d22c={};_0x92d22c[_0x5c7b85[_0x5894('0x27')]]={'$like':'%'+_0x57a42d[_0x5894('0x2f')][_0x5894('0x3b')]+'%'};return _0x92d22c;}})});}_0x16f303=_['merge']({},_0x16f303,_0x57a42d[_0x5894('0x3e')]);var _0x1724bb={'where':_0x16f303['where']};return db[_0x5894('0x3f')][_0x5894('0x1e')](_0x1724bb)[_0x5894('0x25')](function(_0x4cd45c){_0x26f8c9[_0x5894('0x1e')]=_0x4cd45c;if(_0x57a42d[_0x5894('0x2f')][_0x5894('0x40')]){_0x16f303[_0x5894('0x41')]=[{'all':!![]}];}return db[_0x5894('0x3f')]['findAll'](_0x16f303);})['then'](function(_0x34ff2c){_0x26f8c9[_0x5894('0x42')]=_0x34ff2c;return _0x26f8c9;})[_0x5894('0x25')](respondWithFilteredResult(_0x50c96f,_0x16f303))[_0x5894('0x43')](handleError(_0x50c96f,null));};exports[_0x5894('0x44')]=function(_0x325cad,_0x4f63ba){var _0x3f243e={'raw':![],'where':{'id':_0x325cad[_0x5894('0x45')]['id']}},_0xe173fe={};_0xe173fe[_0x5894('0x2e')]=_[_0x5894('0x30')](db[_0x5894('0x3f')][_0x5894('0x2a')]);_0xe173fe[_0x5894('0x2f')]=_[_0x5894('0x30')](_0x325cad[_0x5894('0x2f')]);_0xe173fe[_0x5894('0x31')]=_['intersection'](_0xe173fe[_0x5894('0x2e')],_0xe173fe[_0x5894('0x2f')]);_0x3f243e[_0x5894('0x33')]=_['intersection'](_0xe173fe[_0x5894('0x2e')],qs[_0x5894('0x34')](_0x325cad['query'][_0x5894('0x34')]));_0x3f243e['attributes']=_0x3f243e['attributes'][_0x5894('0x35')]?_0x3f243e[_0x5894('0x33')]:_0xe173fe[_0x5894('0x2e')];if(_0x325cad[_0x5894('0x2f')][_0x5894('0x40')]){_0x3f243e['include']=[{'all':!![]}];}_0x3f243e=_[_0x5894('0x3c')]({},_0x3f243e,_0x325cad[_0x5894('0x3e')]);return db[_0x5894('0x3f')][_0x5894('0x46')](_0x3f243e)[_0x5894('0x25')](handleEntityNotFound(_0x4f63ba,null))['then'](respondWithResult(_0x4f63ba,null))[_0x5894('0x43')](handleError(_0x4f63ba,null));};exports[_0x5894('0x47')]=function(_0x28816c,_0x3b8210){return db[_0x5894('0x3f')][_0x5894('0x47')](_0x28816c[_0x5894('0x48')],{})[_0x5894('0x25')](respondWithResult(_0x3b8210,0xc9))[_0x5894('0x43')](handleError(_0x3b8210,null));};exports[_0x5894('0x24')]=function(_0x2c03b5,_0x3550e4){if(_0x2c03b5[_0x5894('0x48')]['id']){delete _0x2c03b5[_0x5894('0x48')]['id'];}return db['ZohoAccount'][_0x5894('0x46')]({'where':{'id':_0x2c03b5[_0x5894('0x45')]['id']}})['then'](handleEntityNotFound(_0x3550e4,null))['then'](saveUpdates(_0x2c03b5[_0x5894('0x48')],null))[_0x5894('0x25')](respondWithResult(_0x3550e4,null))[_0x5894('0x43')](handleError(_0x3550e4,null));};exports[_0x5894('0x49')]=function(_0x51ab6d,_0x220753){return db[_0x5894('0x3f')][_0x5894('0x46')]({'where':{'id':_0x51ab6d[_0x5894('0x45')]['id']}})[_0x5894('0x25')](handleEntityNotFound(_0x220753,null))[_0x5894('0x25')](removeEntity(_0x220753,null))[_0x5894('0x43')](handleError(_0x220753,null));};exports['getConfigurations']=function(_0x359423,_0x161853,_0x32e5fb){var _0xa22d89={};var _0x19501e={};var _0x248208;var _0x4e6022;return db[_0x5894('0x3f')][_0x5894('0x4a')]({'where':{'id':_0x359423[_0x5894('0x45')]['id']}})[_0x5894('0x25')](handleEntityNotFound(_0x161853,null))[_0x5894('0x25')](function(_0x324077){if(_0x324077){_0x248208=_0x324077;_0x19501e['model']=_[_0x5894('0x30')](db[_0x5894('0x4b')][_0x5894('0x2a')]);_0x19501e['query']=_['keys'](_0x359423[_0x5894('0x2f')]);_0x19501e[_0x5894('0x31')]=_[_0x5894('0x32')](_0x19501e[_0x5894('0x2e')],_0x19501e['query']);_0xa22d89[_0x5894('0x33')]=_[_0x5894('0x32')](_0x19501e['model'],qs[_0x5894('0x34')](_0x359423['query'][_0x5894('0x34')]));_0xa22d89['attributes']=_0xa22d89[_0x5894('0x33')][_0x5894('0x35')]?_0xa22d89[_0x5894('0x33')]:_0x19501e[_0x5894('0x2e')];_0xa22d89[_0x5894('0x4c')]=qs[_0x5894('0x38')](_0x359423['query']['sort']);_0xa22d89[_0x5894('0x39')]=qs['filters'](_[_0x5894('0x3a')](_0x359423['query'],_0x19501e[_0x5894('0x31')]));if(_0x359423[_0x5894('0x2f')]['filter']){_0xa22d89[_0x5894('0x39')]=_['merge'](_0xa22d89[_0x5894('0x39')],{'$or':_[_0x5894('0x29')](_0xa22d89['attributes'],function(_0xb3aecd){var _0x89bde={};_0x89bde[_0xb3aecd]={'$like':'%'+_0x359423[_0x5894('0x2f')][_0x5894('0x3b')]+'%'};return _0x89bde;})});}_0xa22d89=_[_0x5894('0x3c')]({},_0xa22d89,_0x359423['options']);return _0x248208['getConfigurations'](_0xa22d89);}})['then'](function(_0x1313f7){if(_0x1313f7){_0x4e6022=_0x1313f7[_0x5894('0x35')];if(!_0x359423[_0x5894('0x2f')][_0x5894('0x36')](_0x5894('0x37'))){_0xa22d89[_0x5894('0x1d')]=qs[_0x5894('0x1d')](_0x359423[_0x5894('0x2f')]['limit']);_0xa22d89[_0x5894('0x1b')]=qs[_0x5894('0x1b')](_0x359423[_0x5894('0x2f')][_0x5894('0x1b')]);}return _0x248208[_0x5894('0x4d')](_0xa22d89);}})[_0x5894('0x25')](function(_0x59ef35){if(_0x59ef35){return _0x59ef35?{'count':_0x4e6022,'rows':_0x59ef35}:null;}})[_0x5894('0x25')](respondWithResult(_0x161853,null))[_0x5894('0x43')](handleError(_0x161853,null));};exports['addConfiguration']=function(_0xeaacf6,_0x36fca5,_0xbb49cb){if(_0xeaacf6['body']['id']){delete _0xeaacf6[_0x5894('0x48')]['id'];}return db[_0x5894('0x3f')][_0x5894('0x4a')]({'where':{'id':_0xeaacf6[_0x5894('0x45')]['id']}})[_0x5894('0x25')](handleEntityNotFound(_0x36fca5,null))[_0x5894('0x25')](function(_0x1b50a4){if(_0x1b50a4){_0xeaacf6[_0x5894('0x48')]['AccountId']=_0x1b50a4['id'];_0xeaacf6['body']['Subjects']=integrations[_0x5894('0x4e')](_0xeaacf6[_0x5894('0x48')][_0x5894('0x4f')],_0xeaacf6['body']['type']);_0xeaacf6['body'][_0x5894('0x50')]=integrations[_0x5894('0x51')](_0xeaacf6['body'][_0x5894('0x4f')],_0xeaacf6[_0x5894('0x48')][_0x5894('0x2c')]);return db[_0x5894('0x4b')][_0x5894('0x47')](_0xeaacf6[_0x5894('0x48')],{'include':[{'model':db[_0x5894('0x52')],'as':_0x5894('0x53')},{'model':db['ZohoField'],'as':_0x5894('0x50')}]});}return null;})['then'](respondWithResult(_0x36fca5,null))[_0x5894('0x43')](handleError(_0x36fca5,null));};function getAccessToken(_0x1ca3f8){return new Promise(function(_0x4e4718,_0xa3a557){var _0x3e1216;switch(_0x1ca3f8[_0x5894('0x54')]){case'US':_0x3e1216='https://accounts.zoho.com';break;case'AU':_0x3e1216=_0x5894('0x55');break;case'EU':_0x3e1216=_0x5894('0x56');break;case'IN':_0x3e1216=_0x5894('0x57');break;case'CN':_0x3e1216=_0x5894('0x58');break;default:_0x3e1216=_0x5894('0x56');break;}var _0x8e198e={'method':_0x5894('0x59'),'uri':_0x3e1216+_0x5894('0x5a'),'qs':{'refresh_token':_0x1ca3f8['refreshToken'],'client_id':_0x1ca3f8[_0x5894('0x5b')],'client_secret':_0x1ca3f8[_0x5894('0x5c')],'grant_type':_0x5894('0x5d')},'json':!![]};return rp(_0x8e198e)[_0x5894('0x25')](function(_0x4e823f){if(_0x4e823f['access_token']){_0x4e4718(_0x4e823f[_0x5894('0x5e')]);}else{_0xa3a557('Unable\x20to\x20retrieve\x20the\x20access\x20token');}})[_0x5894('0x43')](function(_0x1ec69){_0xa3a557(_0x1ec69);});});}exports['getFields']=function(_0x5ea7e4,_0x4bc722,_0x370a71){var _0x36f487,_0x24c29b,_0x3d2370,_0x4d6519,_0x1b5a1c;return db['ZohoAccount'][_0x5894('0x4a')]({'where':{'id':_0x5ea7e4['params']['id']},'attributes':['id','host',_0x5894('0x54'),_0x5894('0x5b'),_0x5894('0x5c'),_0x5894('0x5f'),_0x5894('0x60'),_0x5894('0x61')]})['then'](handleEntityNotFound(_0x4bc722,null))['then'](function(_0x297c36){_0x1b5a1c=_0x297c36;_0x36f487=_0x1b5a1c[_0x5894('0x62')];_0x24c29b=_0x36f487==='zoho.eu'?'eu':_0x5894('0x63');_0x3d2370=_0x1b5a1c[_0x5894('0x5f')];var _0x161710=_0x3d2370['slice'](-0x1);if(_0x161710==='/'||_0x161710==='\x5c'||_0x161710===':'){_0x3d2370=_0x3d2370['substring'](0x0,_0x3d2370['lastIndexOf'](_0x161710));}if(!_0x1b5a1c[_0x5894('0x61')]){throw new Error(_0x5894('0x64'));}return getAccessToken(_0x1b5a1c);})['then'](function(_0x5d9727){if(_0x5d9727){return rp({'method':_0x5894('0x65'),'uri':util['format'](_0x5894('0x66'),_0x24c29b),'qs':{'module':_0x5894('0x67')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x5d9727},'json':!![]});}})['then'](function(_0x46c8dc){if(_0x46c8dc){if(_0x46c8dc[_0x5894('0x68')]&&_0x46c8dc['response'][_0x5894('0x26')]){throw new Error(_0x46c8dc[_0x5894('0x68')][_0x5894('0x26')][_0x5894('0x69')]);}var _0x20aafa=[];var _0x471dd4=[];var _0x15bcc7=[_0x5894('0x6a'),_0x5894('0x6b'),'Description','WhoId',_0x5894('0x6c'),_0x5894('0x6d'),_0x5894('0x6e'),_0x5894('0x6f')];_0x471dd4=_[_0x5894('0x70')](_0x46c8dc[_0x5894('0x34')],function(_0xbe8cb3){return _0x15bcc7[_0x5894('0x71')](_0xbe8cb3['api_name']);});for(var _0x2eecde=0x0;_0x2eecde<_0x471dd4[_0x5894('0x35')];_0x2eecde++){if(_0x471dd4[_0x2eecde]['system_mandatory']===![]){_0x20aafa[_0x5894('0x72')]({'id':_0x471dd4[_0x2eecde]['id'],'name':_0x471dd4[_0x2eecde][_0x5894('0x73')],'custom':_0x471dd4[_0x2eecde][_0x5894('0x74')],'options':_0x471dd4[_0x2eecde][_0x5894('0x75')]===_0x5894('0x76')&&_0x471dd4[_0x2eecde][_0x5894('0x77')][_0x5894('0x35')]>-0x1?_[_0x5894('0x29')](_0x471dd4[_0x2eecde][_0x5894('0x77')],function(_0x549837){return{'name':_0x549837,'value':_0x549837};}):[]});}}return{'count':_0x20aafa[_0x5894('0x35')],'rows':_0x20aafa};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithResult(_0x4bc722,null))[_0x5894('0x43')](function(_0xa79f13){var _0x3f5a78=_0x5ea7e4[_0x5894('0x2f')][_0x5894('0x78')]?0x1f4:_0xa79f13[_0x5894('0x79')]||0x1f4;logger['error'](_0x5894('0x7a'),_0x5894('0x7b'),_0x3f5a78,JSON[_0x5894('0x7c')](_0xa79f13));delete _0xa79f13[_0x5894('0x27')];if(_0x3f5a78===0x191){_0x3f5a78=0x190;}_0x4bc722[_0x5894('0x18')](_0x3f5a78)[_0x5894('0x28')](_0x5ea7e4[_0x5894('0x2f')]['test']?{'message':'Wrong\x20credentials','statusCode':_0xa79f13[_0x5894('0x79')]}:_0xa79f13);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index 6807dde..be61dc7 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 _0x9597=['ZohoAccount','int_zoho_accounts','changed','zone','serverUrl','clientSecret','host','substring','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.com.cn','https://accounts.zoho.eu','authorization_code','clientId','code','then','parse','refreshToken','refresh_token','info','format','name','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','catch','slice','https://accounts.zoho.in','POST','/oauth/v2/token','application/x-www-form-urlencoded','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define'];(function(_0x45f951,_0x2750c8){var _0x24756c=function(_0x31c931){while(--_0x31c931){_0x45f951['push'](_0x45f951['shift']());}};_0x24756c(++_0x2750c8);}(_0x9597,0x14d));var _0x7959=function(_0x2cf73a,_0x2852a6){_0x2cf73a=_0x2cf73a-0x0;var _0x2e088c=_0x9597[_0x2cf73a];return _0x2e088c;};'use strict';var _=require('lodash');var util=require(_0x7959('0x0'));var logger=require(_0x7959('0x1'))(_0x7959('0x2'));var moment=require(_0x7959('0x3'));var BPromise=require(_0x7959('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7959('0x5'));var rimraf=require('rimraf');var config=require(_0x7959('0x6'));var attributes=require(_0x7959('0x7'));var integrations=require(_0x7959('0x8'));module[_0x7959('0x9')]=function(_0x38b027,_0x28830b){return _0x38b027[_0x7959('0xa')](_0x7959('0xb'),attributes,{'tableName':_0x7959('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x36b12e,_0x127418,_0x5b787e){if(_0x36b12e[_0x7959('0xd')](_0x7959('0xe'))||_0x36b12e[_0x7959('0xd')](_0x7959('0xf'))||_0x36b12e[_0x7959('0xd')]('clientId')||_0x36b12e['changed'](_0x7959('0x10'))||_0x36b12e['changed']('code')||_0x36b12e[_0x7959('0xd')](_0x7959('0x11'))){var _0x28bc5a,_0x438c92;_0x28bc5a=_0x36b12e['serverUrl'];var _0x23bfbf=_0x28bc5a['slice'](-0x1);if(_0x23bfbf==='/'||_0x23bfbf==='\x5c'||_0x23bfbf===':'){_0x28bc5a=_0x28bc5a[_0x7959('0x12')](0x0,_0x28bc5a['lastIndexOf'](_0x23bfbf));}switch(_0x36b12e[_0x7959('0xe')]){case'US':_0x438c92=_0x7959('0x13');break;case'AU':_0x438c92=_0x7959('0x14');break;case'IN':_0x438c92='https://accounts.zoho.in';break;case'CN':_0x438c92=_0x7959('0x15');break;default:_0x438c92=_0x7959('0x16');break;}var _0x25cf67={'method':'POST','uri':_0x438c92+'/oauth/v2/token','form':{'grant_type':_0x7959('0x17'),'client_id':_0x36b12e[_0x7959('0x18')],'client_secret':_0x36b12e[_0x7959('0x10')],'redirect_uri':_0x36b12e[_0x7959('0xf')],'code':_0x36b12e[_0x7959('0x19')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x25cf67)[_0x7959('0x1a')](function(_0xe7c3c0){var _0x4e2793=JSON[_0x7959('0x1b')](_0xe7c3c0);if(_0x4e2793['refresh_token']){_0x36b12e[_0x7959('0x1c')]=_0x4e2793[_0x7959('0x1d')];logger[_0x7959('0x1e')](util[_0x7959('0x1f')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x36b12e[_0x7959('0x20')],_0x36b12e['id']));}else{logger[_0x7959('0x21')](util[_0x7959('0x1f')](_0x7959('0x22'),_0x36b12e[_0x7959('0x20')],_0x36b12e['id']),util[_0x7959('0x23')](_0x4e2793,{'showHidden':![],'depth':null}));}return _0x5b787e(null,_0x127418);})[_0x7959('0x24')](function(_0x17e031){logger[_0x7959('0x21')](util[_0x7959('0x1f')](_0x7959('0x22'),_0x36b12e['name'],_0x36b12e['id']),util[_0x7959('0x23')](parsedResult,{'showHidden':![],'depth':null}));return _0x5b787e(_0x17e031);});}else{return _0x5b787e(null,_0x127418);}},'beforeUpdate':function(_0x7c4258,_0x337cf8,_0x270d7d){if(_0x7c4258['changed'](_0x7959('0xe'))||_0x7c4258[_0x7959('0xd')](_0x7959('0xf'))||_0x7c4258['changed']('clientId')||_0x7c4258[_0x7959('0xd')](_0x7959('0x10'))||_0x7c4258[_0x7959('0xd')](_0x7959('0x19'))||_0x7c4258['changed'](_0x7959('0x11'))){var _0x4d6f54,_0x19f50;_0x4d6f54=_0x7c4258[_0x7959('0xf')];var _0x7390af=_0x4d6f54[_0x7959('0x25')](-0x1);if(_0x7390af==='/'||_0x7390af==='\x5c'||_0x7390af===':'){_0x4d6f54=_0x4d6f54[_0x7959('0x12')](0x0,_0x4d6f54['lastIndexOf'](_0x7390af));}switch(_0x7c4258[_0x7959('0xe')]){case'US':_0x19f50=_0x7959('0x13');break;case'AU':_0x19f50=_0x7959('0x14');break;case'IN':_0x19f50=_0x7959('0x26');break;case'CN':_0x19f50=_0x7959('0x15');break;default:_0x19f50=_0x7959('0x16');break;}var _0x144b9e={'method':_0x7959('0x27'),'uri':_0x19f50+_0x7959('0x28'),'form':{'grant_type':_0x7959('0x17'),'client_id':_0x7c4258[_0x7959('0x18')],'client_secret':_0x7c4258[_0x7959('0x10')],'redirect_uri':_0x7c4258[_0x7959('0xf')],'code':_0x7c4258[_0x7959('0x19')]},'headers':{'Content-Type':_0x7959('0x29')}};return rp(_0x144b9e)['then'](function(_0x39f87e){var _0x215a7e=JSON['parse'](_0x39f87e);if(_0x215a7e[_0x7959('0x1d')]){_0x7c4258[_0x7959('0x1c')]=_0x215a7e['refresh_token'];logger[_0x7959('0x1e')](util[_0x7959('0x1f')](_0x7959('0x2a'),_0x7c4258[_0x7959('0x20')],_0x7c4258['id']));}else{logger[_0x7959('0x21')](util[_0x7959('0x1f')](_0x7959('0x22'),_0x7c4258[_0x7959('0x20')],_0x7c4258['id']),util[_0x7959('0x23')](_0x215a7e,{'showHidden':![],'depth':null}));}return _0x270d7d(null,_0x337cf8);})[_0x7959('0x24')](function(_0x303bb2){logger[_0x7959('0x21')](util['format']('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x7c4258['name'],_0x7c4258['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x270d7d(_0x303bb2);});}else{return _0x270d7d(null,_0x337cf8);}}}});}; \ No newline at end of file +var _0x1cf5=['util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','define','ZohoAccount','int_zoho_accounts','changed','zone','serverUrl','clientId','slice','substring','lastIndexOf','https://accounts.zoho.com.au','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','authorization_code','clientSecret','code','application/x-www-form-urlencoded','then','parse','refreshToken','refresh_token','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','catch','host','https://accounts.zoho.in','lodash'];(function(_0xba09b8,_0x3de50d){var _0x30e6a4=function(_0x1a9117){while(--_0x1a9117){_0xba09b8['push'](_0xba09b8['shift']());}};_0x30e6a4(++_0x3de50d);}(_0x1cf5,0xaf));var _0x51cf=function(_0x16dfb3,_0x1613fc){_0x16dfb3=_0x16dfb3-0x0;var _0x1d8030=_0x1cf5[_0x16dfb3];return _0x1d8030;};'use strict';var _=require(_0x51cf('0x0'));var util=require(_0x51cf('0x1'));var logger=require(_0x51cf('0x2'))(_0x51cf('0x3'));var moment=require(_0x51cf('0x4'));var BPromise=require('bluebird');var rp=require(_0x51cf('0x5'));var fs=require('fs');var path=require(_0x51cf('0x6'));var rimraf=require(_0x51cf('0x7'));var config=require(_0x51cf('0x8'));var attributes=require(_0x51cf('0x9'));var integrations=require(_0x51cf('0xa'));module['exports']=function(_0x5de4d8,_0xb456c9){return _0x5de4d8[_0x51cf('0xb')](_0x51cf('0xc'),attributes,{'tableName':_0x51cf('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0xb8a71a,_0x20cfc5,_0x25c432){if(_0xb8a71a[_0x51cf('0xe')](_0x51cf('0xf'))||_0xb8a71a['changed'](_0x51cf('0x10'))||_0xb8a71a['changed'](_0x51cf('0x11'))||_0xb8a71a['changed']('clientSecret')||_0xb8a71a['changed']('code')||_0xb8a71a[_0x51cf('0xe')]('host')){var _0x3dd817,_0x1bb4ba;_0x3dd817=_0xb8a71a['serverUrl'];var _0x342f3d=_0x3dd817[_0x51cf('0x12')](-0x1);if(_0x342f3d==='/'||_0x342f3d==='\x5c'||_0x342f3d===':'){_0x3dd817=_0x3dd817[_0x51cf('0x13')](0x0,_0x3dd817[_0x51cf('0x14')](_0x342f3d));}switch(_0xb8a71a[_0x51cf('0xf')]){case'US':_0x1bb4ba='https://accounts.zoho.com';break;case'AU':_0x1bb4ba=_0x51cf('0x15');break;case'IN':_0x1bb4ba='https://accounts.zoho.in';break;case'CN':_0x1bb4ba=_0x51cf('0x16');break;default:_0x1bb4ba=_0x51cf('0x17');break;}var _0xbaad31={'method':_0x51cf('0x18'),'uri':_0x1bb4ba+_0x51cf('0x19'),'form':{'grant_type':_0x51cf('0x1a'),'client_id':_0xb8a71a[_0x51cf('0x11')],'client_secret':_0xb8a71a[_0x51cf('0x1b')],'redirect_uri':_0xb8a71a[_0x51cf('0x10')],'code':_0xb8a71a[_0x51cf('0x1c')]},'headers':{'Content-Type':_0x51cf('0x1d')}};return rp(_0xbaad31)[_0x51cf('0x1e')](function(_0x2eaf21){var _0x585a01=JSON[_0x51cf('0x1f')](_0x2eaf21);if(_0x585a01['refresh_token']){_0xb8a71a[_0x51cf('0x20')]=_0x585a01[_0x51cf('0x21')];logger[_0x51cf('0x22')](util[_0x51cf('0x23')](_0x51cf('0x24'),_0xb8a71a[_0x51cf('0x25')],_0xb8a71a['id']));}else{logger[_0x51cf('0x26')](util[_0x51cf('0x23')](_0x51cf('0x27'),_0xb8a71a['name'],_0xb8a71a['id']),util[_0x51cf('0x28')](_0x585a01,{'showHidden':![],'depth':null}));}return _0x25c432(null,_0x20cfc5);})[_0x51cf('0x29')](function(_0x3f212a){logger['error'](util[_0x51cf('0x23')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0xb8a71a[_0x51cf('0x25')],_0xb8a71a['id']),util[_0x51cf('0x28')](parsedResult,{'showHidden':![],'depth':null}));return _0x25c432(_0x3f212a);});}else{return _0x25c432(null,_0x20cfc5);}},'beforeUpdate':function(_0x21b32f,_0x509e41,_0x17afdb){if(_0x21b32f[_0x51cf('0xe')](_0x51cf('0xf'))||_0x21b32f[_0x51cf('0xe')](_0x51cf('0x10'))||_0x21b32f[_0x51cf('0xe')](_0x51cf('0x11'))||_0x21b32f[_0x51cf('0xe')]('clientSecret')||_0x21b32f[_0x51cf('0xe')]('code')||_0x21b32f['changed'](_0x51cf('0x2a'))){var _0x594c7d,_0x4802c7;_0x594c7d=_0x21b32f[_0x51cf('0x10')];var _0x4fafd4=_0x594c7d[_0x51cf('0x12')](-0x1);if(_0x4fafd4==='/'||_0x4fafd4==='\x5c'||_0x4fafd4===':'){_0x594c7d=_0x594c7d['substring'](0x0,_0x594c7d[_0x51cf('0x14')](_0x4fafd4));}switch(_0x21b32f[_0x51cf('0xf')]){case'US':_0x4802c7='https://accounts.zoho.com';break;case'AU':_0x4802c7=_0x51cf('0x15');break;case'IN':_0x4802c7=_0x51cf('0x2b');break;case'CN':_0x4802c7='https://accounts.zoho.com.cn';break;default:_0x4802c7=_0x51cf('0x17');break;}var _0x14094d={'method':_0x51cf('0x18'),'uri':_0x4802c7+_0x51cf('0x19'),'form':{'grant_type':_0x51cf('0x1a'),'client_id':_0x21b32f[_0x51cf('0x11')],'client_secret':_0x21b32f[_0x51cf('0x1b')],'redirect_uri':_0x21b32f['serverUrl'],'code':_0x21b32f[_0x51cf('0x1c')]},'headers':{'Content-Type':_0x51cf('0x1d')}};return rp(_0x14094d)[_0x51cf('0x1e')](function(_0x56d26d){var _0x3bcc9b=JSON[_0x51cf('0x1f')](_0x56d26d);if(_0x3bcc9b[_0x51cf('0x21')]){_0x21b32f[_0x51cf('0x20')]=_0x3bcc9b['refresh_token'];logger['info'](util[_0x51cf('0x23')](_0x51cf('0x24'),_0x21b32f[_0x51cf('0x25')],_0x21b32f['id']));}else{logger[_0x51cf('0x26')](util[_0x51cf('0x23')](_0x51cf('0x27'),_0x21b32f[_0x51cf('0x25')],_0x21b32f['id']),util['inspect'](_0x3bcc9b,{'showHidden':![],'depth':null}));}return _0x17afdb(null,_0x509e41);})[_0x51cf('0x29')](function(_0x5bbc4f){logger['error'](util[_0x51cf('0x23')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x21b32f[_0x51cf('0x25')],_0x21b32f['id']),util[_0x51cf('0x28')](parsedResult,{'showHidden':![],'depth':null}));return _0x17afdb(_0x5bbc4f);});}else{return _0x17afdb(null,_0x509e41);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 54c6114..c668586 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 _0xef4d=['request','then','info','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','ZohoAccount,\x20%s,\x20%s','result','catch','ZohoAccount','options','raw','where','attributes','limit','include','model','map','GetZohoAccount','ShowZohoAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x5f09c5,_0x2bfca0){var _0x426ad9=function(_0x18fe5f){while(--_0x18fe5f){_0x5f09c5['push'](_0x5f09c5['shift']());}};_0x426ad9(++_0x2bfca0);}(_0xef4d,0x165));var _0xdef4=function(_0x1abb09,_0x18ee91){_0x1abb09=_0x1abb09-0x0;var _0xea1c07=_0xef4d[_0x1abb09];return _0xea1c07;};'use strict';var _=require(_0xdef4('0x0'));var util=require(_0xdef4('0x1'));var moment=require(_0xdef4('0x2'));var BPromise=require(_0xdef4('0x3'));var rs=require(_0xdef4('0x4'));var fs=require('fs');var Redis=require(_0xdef4('0x5'));var db=require(_0xdef4('0x6'))['db'];var utils=require(_0xdef4('0x7'));var logger=require(_0xdef4('0x8'))(_0xdef4('0x9'));var config=require(_0xdef4('0xa'));var jayson=require(_0xdef4('0xb'));var client=jayson[_0xdef4('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x468dcd,_0x3b875f,_0x2cebfd){return new BPromise(function(_0x1dc5c9,_0x525707){return client[_0xdef4('0xd')](_0x468dcd,_0x2cebfd)[_0xdef4('0xe')](function(_0x87d8a3){logger[_0xdef4('0xf')]('ZohoAccount,\x20%s,\x20%s',_0x3b875f,_0xdef4('0x10'));logger[_0xdef4('0x11')](_0xdef4('0x12'),_0x3b875f,_0xdef4('0x10'),JSON[_0xdef4('0x13')](_0x87d8a3));if(_0x87d8a3[_0xdef4('0x14')]){if(_0x87d8a3[_0xdef4('0x14')]['code']===0x1f4){logger[_0xdef4('0x14')]('ZohoAccount,\x20%s,\x20%s',_0x3b875f,_0x87d8a3['error'][_0xdef4('0x15')]);return _0x525707(_0x87d8a3['error'][_0xdef4('0x15')]);}logger['error'](_0xdef4('0x16'),_0x3b875f,_0x87d8a3[_0xdef4('0x14')][_0xdef4('0x15')]);return _0x1dc5c9(_0x87d8a3[_0xdef4('0x14')]['message']);}else{logger[_0xdef4('0xf')]('ZohoAccount,\x20%s,\x20%s',_0x3b875f,_0xdef4('0x10'));_0x1dc5c9(_0x87d8a3[_0xdef4('0x17')]['message']);}})[_0xdef4('0x18')](function(_0x27463d){logger[_0xdef4('0x14')](_0xdef4('0x16'),_0x3b875f,_0x27463d);_0x525707(_0x27463d);});});}exports['GetZohoAccount']=function(_0x377beb){var _0x3b3a4=this;return new Promise(function(_0x469178,_0x18d3a0){return db[_0xdef4('0x19')]['findAll']({'raw':_0x377beb[_0xdef4('0x1a')]?_0x377beb[_0xdef4('0x1a')][_0xdef4('0x1b')]===undefined?!![]:![]:!![],'where':_0x377beb[_0xdef4('0x1a')]?_0x377beb[_0xdef4('0x1a')][_0xdef4('0x1c')]||null:null,'attributes':_0x377beb['options']?_0x377beb[_0xdef4('0x1a')][_0xdef4('0x1d')]||null:null,'limit':_0x377beb[_0xdef4('0x1a')]?_0x377beb[_0xdef4('0x1a')][_0xdef4('0x1e')]||null:null,'include':_0x377beb[_0xdef4('0x1a')]?_0x377beb['options'][_0xdef4('0x1f')]?_['map'](_0x377beb[_0xdef4('0x1a')][_0xdef4('0x1f')],function(_0x35c401){return{'model':db[_0x35c401[_0xdef4('0x20')]],'as':_0x35c401['as'],'attributes':_0x35c401['attributes'],'include':_0x35c401[_0xdef4('0x1f')]?_[_0xdef4('0x21')](_0x35c401[_0xdef4('0x1f')],function(_0xf43627){return{'model':db[_0xf43627[_0xdef4('0x20')]],'as':_0xf43627['as'],'attributes':_0xf43627[_0xdef4('0x1d')],'include':_0xf43627[_0xdef4('0x1f')]?_[_0xdef4('0x21')](_0xf43627['include'],function(_0x3e770f){return{'model':db[_0x3e770f[_0xdef4('0x20')]],'as':_0x3e770f['as'],'attributes':_0x3e770f['attributes']};}):[]};}):[]};}):[]:[]})[_0xdef4('0xe')](function(_0x26718b){logger[_0xdef4('0xf')](_0xdef4('0x22'),_0x377beb);logger[_0xdef4('0x11')](_0xdef4('0x22'),_0x377beb,JSON['stringify'](_0x26718b));_0x469178(_0x26718b);})[_0xdef4('0x18')](function(_0x256165){logger['error'](_0xdef4('0x22'),_0x256165[_0xdef4('0x15')],_0x377beb);_0x18d3a0(_0x3b3a4[_0xdef4('0x14')](0x1f4,_0x256165[_0xdef4('0x15')]));});});};exports[_0xdef4('0x23')]=function(_0x2cadc4){var _0x2f0f33=this;return new Promise(function(_0x25fc2c,_0xe92978){return db[_0xdef4('0x19')][_0xdef4('0x24')]({'raw':_0x2cadc4['options']?_0x2cadc4['options'][_0xdef4('0x1b')]===undefined?!![]:![]:!![],'where':_0x2cadc4[_0xdef4('0x1a')]?_0x2cadc4[_0xdef4('0x1a')]['where']||null:null,'attributes':_0x2cadc4[_0xdef4('0x1a')]?_0x2cadc4[_0xdef4('0x1a')][_0xdef4('0x1d')]||null:null,'include':_0x2cadc4[_0xdef4('0x1a')]?_0x2cadc4['options']['include']?_['map'](_0x2cadc4[_0xdef4('0x1a')][_0xdef4('0x1f')],function(_0x46d84a){return{'model':db[_0x46d84a[_0xdef4('0x20')]],'as':_0x46d84a['as'],'attributes':_0x46d84a[_0xdef4('0x1d')],'include':_0x46d84a['include']?_[_0xdef4('0x21')](_0x46d84a[_0xdef4('0x1f')],function(_0x46f3b2){return{'model':db[_0x46f3b2[_0xdef4('0x20')]],'as':_0x46f3b2['as'],'attributes':_0x46f3b2[_0xdef4('0x1d')],'include':_0x46f3b2['include']?_[_0xdef4('0x21')](_0x46f3b2[_0xdef4('0x1f')],function(_0x3c2028){return{'model':db[_0x3c2028['model']],'as':_0x3c2028['as'],'attributes':_0x3c2028[_0xdef4('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5822fe){logger[_0xdef4('0xf')]('ShowZohoAccount',_0x2cadc4);logger[_0xdef4('0x11')](_0xdef4('0x23'),_0x2cadc4,JSON[_0xdef4('0x13')](_0x5822fe));_0x25fc2c(_0x5822fe);})[_0xdef4('0x18')](function(_0x133e0d){logger[_0xdef4('0x14')](_0xdef4('0x23'),_0x133e0d[_0xdef4('0x15')],_0x2cadc4);_0xe92978(_0x2f0f33['error'](0x1f4,_0x133e0d['message']));});});}; \ No newline at end of file +var _0xccef=['http','request','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetZohoAccount','ZohoAccount','findAll','options','raw','include','map','model','attributes','find','where','then','ShowZohoAccount','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise'];(function(_0x5a5690,_0x29d886){var _0x5e95bd=function(_0x33f58c){while(--_0x33f58c){_0x5a5690['push'](_0x5a5690['shift']());}};_0x5e95bd(++_0x29d886);}(_0xccef,0x1d4));var _0xfcce=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xccef[_0x17d9e3];return _0x14192d;};'use strict';var _=require('lodash');var util=require(_0xfcce('0x0'));var moment=require('moment');var BPromise=require(_0xfcce('0x1'));var rs=require(_0xfcce('0x2'));var fs=require('fs');var Redis=require(_0xfcce('0x3'));var db=require(_0xfcce('0x4'))['db'];var utils=require(_0xfcce('0x5'));var logger=require(_0xfcce('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xfcce('0x7'));var client=jayson['client'][_0xfcce('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xd71971,_0x12d091,_0x4598c1){return new BPromise(function(_0x117bc3,_0x380c2c){return client[_0xfcce('0x9')](_0xd71971,_0x4598c1)['then'](function(_0x382ea5){logger[_0xfcce('0xa')](_0xfcce('0xb'),_0x12d091,_0xfcce('0xc'));logger[_0xfcce('0xd')](_0xfcce('0xe'),_0x12d091,_0xfcce('0xc'),JSON[_0xfcce('0xf')](_0x382ea5));if(_0x382ea5[_0xfcce('0x10')]){if(_0x382ea5[_0xfcce('0x10')][_0xfcce('0x11')]===0x1f4){logger['error'](_0xfcce('0xb'),_0x12d091,_0x382ea5[_0xfcce('0x10')][_0xfcce('0x12')]);return _0x380c2c(_0x382ea5[_0xfcce('0x10')]['message']);}logger[_0xfcce('0x10')](_0xfcce('0xb'),_0x12d091,_0x382ea5['error']['message']);return _0x117bc3(_0x382ea5[_0xfcce('0x10')][_0xfcce('0x12')]);}else{logger[_0xfcce('0xa')](_0xfcce('0xb'),_0x12d091,_0xfcce('0xc'));_0x117bc3(_0x382ea5[_0xfcce('0x13')][_0xfcce('0x12')]);}})[_0xfcce('0x14')](function(_0x2d7611){logger[_0xfcce('0x10')](_0xfcce('0xb'),_0x12d091,_0x2d7611);_0x380c2c(_0x2d7611);});});}exports[_0xfcce('0x15')]=function(_0x40f6e4){var _0x60cee0=this;return new Promise(function(_0x3a8854,_0x33f5e2){return db[_0xfcce('0x16')][_0xfcce('0x17')]({'raw':_0x40f6e4[_0xfcce('0x18')]?_0x40f6e4[_0xfcce('0x18')][_0xfcce('0x19')]===undefined?!![]:![]:!![],'where':_0x40f6e4[_0xfcce('0x18')]?_0x40f6e4[_0xfcce('0x18')]['where']||null:null,'attributes':_0x40f6e4['options']?_0x40f6e4[_0xfcce('0x18')]['attributes']||null:null,'limit':_0x40f6e4[_0xfcce('0x18')]?_0x40f6e4[_0xfcce('0x18')]['limit']||null:null,'include':_0x40f6e4[_0xfcce('0x18')]?_0x40f6e4[_0xfcce('0x18')][_0xfcce('0x1a')]?_[_0xfcce('0x1b')](_0x40f6e4[_0xfcce('0x18')][_0xfcce('0x1a')],function(_0x52f3c8){return{'model':db[_0x52f3c8[_0xfcce('0x1c')]],'as':_0x52f3c8['as'],'attributes':_0x52f3c8[_0xfcce('0x1d')],'include':_0x52f3c8[_0xfcce('0x1a')]?_[_0xfcce('0x1b')](_0x52f3c8['include'],function(_0x4ca849){return{'model':db[_0x4ca849[_0xfcce('0x1c')]],'as':_0x4ca849['as'],'attributes':_0x4ca849[_0xfcce('0x1d')],'include':_0x4ca849[_0xfcce('0x1a')]?_[_0xfcce('0x1b')](_0x4ca849['include'],function(_0x428a4e){return{'model':db[_0x428a4e[_0xfcce('0x1c')]],'as':_0x428a4e['as'],'attributes':_0x428a4e['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x413adf){logger[_0xfcce('0xa')](_0xfcce('0x15'),_0x40f6e4);logger[_0xfcce('0xd')](_0xfcce('0x15'),_0x40f6e4,JSON[_0xfcce('0xf')](_0x413adf));_0x3a8854(_0x413adf);})[_0xfcce('0x14')](function(_0x3b7592){logger[_0xfcce('0x10')](_0xfcce('0x15'),_0x3b7592['message'],_0x40f6e4);_0x33f5e2(_0x60cee0[_0xfcce('0x10')](0x1f4,_0x3b7592['message']));});});};exports['ShowZohoAccount']=function(_0x1aaddd){var _0x46d99c=this;return new Promise(function(_0x43dc0a,_0x40c460){return db[_0xfcce('0x16')][_0xfcce('0x1e')]({'raw':_0x1aaddd[_0xfcce('0x18')]?_0x1aaddd[_0xfcce('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x1aaddd[_0xfcce('0x18')]?_0x1aaddd[_0xfcce('0x18')][_0xfcce('0x1f')]||null:null,'attributes':_0x1aaddd[_0xfcce('0x18')]?_0x1aaddd[_0xfcce('0x18')][_0xfcce('0x1d')]||null:null,'include':_0x1aaddd[_0xfcce('0x18')]?_0x1aaddd[_0xfcce('0x18')][_0xfcce('0x1a')]?_[_0xfcce('0x1b')](_0x1aaddd[_0xfcce('0x18')][_0xfcce('0x1a')],function(_0xb6015b){return{'model':db[_0xb6015b[_0xfcce('0x1c')]],'as':_0xb6015b['as'],'attributes':_0xb6015b['attributes'],'include':_0xb6015b[_0xfcce('0x1a')]?_['map'](_0xb6015b[_0xfcce('0x1a')],function(_0x278411){return{'model':db[_0x278411[_0xfcce('0x1c')]],'as':_0x278411['as'],'attributes':_0x278411[_0xfcce('0x1d')],'include':_0x278411[_0xfcce('0x1a')]?_[_0xfcce('0x1b')](_0x278411[_0xfcce('0x1a')],function(_0x3b4efd){return{'model':db[_0x3b4efd[_0xfcce('0x1c')]],'as':_0x3b4efd['as'],'attributes':_0x3b4efd[_0xfcce('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xfcce('0x20')](function(_0x12e4fc){logger[_0xfcce('0xa')](_0xfcce('0x21'),_0x1aaddd);logger[_0xfcce('0xd')](_0xfcce('0x21'),_0x1aaddd,JSON['stringify'](_0x12e4fc));_0x43dc0a(_0x12e4fc);})[_0xfcce('0x14')](function(_0x1edf08){logger['error'](_0xfcce('0x21'),_0x1edf08['message'],_0x1aaddd);_0x40c460(_0x46d99c[_0xfcce('0x10')](0x1f4,_0x1edf08[_0xfcce('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 14d988b..a16cc98 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 _0x37c4=['isAuthenticated','show','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','put','delete','exports','multer','util','path','express','../../components/interaction/service','get','index','/:id'];(function(_0x5a8c9b,_0x400c54){var _0x40d8b9=function(_0x295c62){while(--_0x295c62){_0x5a8c9b['push'](_0x5a8c9b['shift']());}};_0x40d8b9(++_0x400c54);}(_0x37c4,0x14e));var _0x437c=function(_0x18e459,_0x327ad9){_0x18e459=_0x18e459-0x0;var _0x25321e=_0x37c4[_0x18e459];return _0x25321e;};'use strict';var multer=require(_0x437c('0x0'));var util=require(_0x437c('0x1'));var path=require(_0x437c('0x2'));var timeout=require('connect-timeout');var express=require(_0x437c('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x437c('0x4'));var config=require('../../config/environment');var controller=require('./intZohoConfiguration.controller');router[_0x437c('0x5')]('/',auth['isAuthenticated'](),controller[_0x437c('0x6')]);router['get'](_0x437c('0x7'),auth[_0x437c('0x8')](),controller[_0x437c('0x9')]);router[_0x437c('0x5')]('/:id/fields',auth['isAuthenticated'](),controller['getFields']);router['get'](_0x437c('0xa'),auth['isAuthenticated'](),controller[_0x437c('0xb')]);router['get'](_0x437c('0xc'),auth['isAuthenticated'](),controller[_0x437c('0xd')]);router[_0x437c('0xe')]('/',auth[_0x437c('0x8')](),controller['create']);router[_0x437c('0xf')](_0x437c('0x7'),auth['isAuthenticated'](),controller['update']);router[_0x437c('0x10')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x437c('0x11')]=router; \ No newline at end of file +var _0xfc74=['/:id','getFields','/:id/subjects','/:id/descriptions','getDescriptions','post','create','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x118afa,_0x4bf0c1){var _0x167d76=function(_0x2c529b){while(--_0x2c529b){_0x118afa['push'](_0x118afa['shift']());}};_0x167d76(++_0x4bf0c1);}(_0xfc74,0x89));var _0x4fc7=function(_0x2f70c0,_0x22ece7){_0x2f70c0=_0x2f70c0-0x0;var _0x4d835b=_0xfc74[_0x2f70c0];return _0x4d835b;};'use strict';var multer=require(_0x4fc7('0x0'));var util=require(_0x4fc7('0x1'));var path=require(_0x4fc7('0x2'));var timeout=require('connect-timeout');var express=require(_0x4fc7('0x3'));var router=express[_0x4fc7('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x4fc7('0x5'));var interaction=require(_0x4fc7('0x6'));var config=require(_0x4fc7('0x7'));var controller=require('./intZohoConfiguration.controller');router[_0x4fc7('0x8')]('/',auth[_0x4fc7('0x9')](),controller['index']);router[_0x4fc7('0x8')](_0x4fc7('0xa'),auth[_0x4fc7('0x9')](),controller['show']);router[_0x4fc7('0x8')]('/:id/fields',auth[_0x4fc7('0x9')](),controller[_0x4fc7('0xb')]);router[_0x4fc7('0x8')](_0x4fc7('0xc'),auth[_0x4fc7('0x9')](),controller['getSubjects']);router[_0x4fc7('0x8')](_0x4fc7('0xd'),auth[_0x4fc7('0x9')](),controller[_0x4fc7('0xe')]);router[_0x4fc7('0xf')]('/',auth['isAuthenticated'](),controller[_0x4fc7('0x10')]);router['put'](_0x4fc7('0xa'),auth[_0x4fc7('0x9')](),controller[_0x4fc7('0x11')]);router[_0x4fc7('0x12')](_0x4fc7('0xa'),auth[_0x4fc7('0x9')](),controller[_0x4fc7('0x13')]);module[_0x4fc7('0x14')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index e96596d..34c7552 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 _0xb412=['exports','STRING','ENUM','lead','contact','contact_lead'];(function(_0xbf8ebe,_0x3b69a5){var _0x1e25e8=function(_0x40c390){while(--_0x40c390){_0xbf8ebe['push'](_0xbf8ebe['shift']());}};_0x1e25e8(++_0x3b69a5);}(_0xb412,0x7e));var _0x2b41=function(_0x1d478d,_0x41aaec){_0x1d478d=_0x1d478d-0x0;var _0xedb6c7=_0xb412[_0x1d478d];return _0xedb6c7;};'use strict';var Sequelize=require('sequelize');module[_0x2b41('0x0')]={'name':{'type':Sequelize[_0x2b41('0x1')]},'moduleCreate':{'type':Sequelize[_0x2b41('0x2')](_0x2b41('0x3'),_0x2b41('0x4'),'nothing'),'defaultValue':_0x2b41('0x3')},'moduleSearch':{'type':Sequelize[_0x2b41('0x2')]('contact_lead',_0x2b41('0x4'),'lead'),'defaultValue':_0x2b41('0x5')},'description':{'type':Sequelize[_0x2b41('0x1')]}}; \ No newline at end of file +var _0xffc3=['contact_lead','contact','lead','exports','STRING','ENUM','nothing'];(function(_0x328740,_0x26e1b2){var _0x30e10c=function(_0x1763d5){while(--_0x1763d5){_0x328740['push'](_0x328740['shift']());}};_0x30e10c(++_0x26e1b2);}(_0xffc3,0x129));var _0x3ffc=function(_0x36de8f,_0x1a400d){_0x36de8f=_0x36de8f-0x0;var _0x4961e9=_0xffc3[_0x36de8f];return _0x4961e9;};'use strict';var Sequelize=require('sequelize');module[_0x3ffc('0x0')]={'name':{'type':Sequelize[_0x3ffc('0x1')]},'moduleCreate':{'type':Sequelize[_0x3ffc('0x2')]('lead','contact',_0x3ffc('0x3')),'defaultValue':'lead'},'moduleSearch':{'type':Sequelize[_0x3ffc('0x2')](_0x3ffc('0x4'),_0x3ffc('0x5'),_0x3ffc('0x6')),'defaultValue':_0x3ffc('0x4')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index 830bfda..4a969e3 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 _0x857a=['jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','save','update','then','destroy','end','error','stack','send','index','map','ZohoConfiguration','rawAttributes','key','model','name','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','create','body','getFields','ZohoField','nolimit','getSubjects','findOne','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','util','sox','to-csv','ejs','fs-extra'];(function(_0x414872,_0x5d5bda){var _0x50b261=function(_0x4849d8){while(--_0x4849d8){_0x414872['push'](_0x414872['shift']());}};_0x50b261(++_0x5d5bda);}(_0x857a,0x12f));var _0xa857=function(_0x3149a9,_0x4ca7f6){_0x3149a9=_0x3149a9-0x0;var _0x5a37ca=_0x857a[_0x3149a9];return _0x5a37ca;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa857('0x0'));var zipdir=require(_0xa857('0x1'));var jsonpatch=require(_0xa857('0x2'));var rp=require(_0xa857('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xa857('0x4'));var path=require('path');var sox=require(_0xa857('0x5'));var csv=require(_0xa857('0x6'));var ejs=require(_0xa857('0x7'));var fs=require('fs');var fs_extra=require(_0xa857('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xa857('0x9'));var deskjs=require(_0xa857('0xa'));var toCsv=require('to-csv');var querystring=require(_0xa857('0xb'));var Papa=require(_0xa857('0xc'));var Redis=require('ioredis');var authService=require(_0xa857('0xd'));var qs=require(_0xa857('0xe'));var as=require(_0xa857('0xf'));var hardwareService=require(_0xa857('0x10'));var logger=require(_0xa857('0x11'))(_0xa857('0x12'));var utils=require(_0xa857('0x13'));var config=require(_0xa857('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xa857('0x15'))['db'];function respondWithStatusCode(_0x2e9d87,_0xc412a9){_0xc412a9=_0xc412a9||0xcc;return function(_0x91f4fa){if(_0x91f4fa){return _0x2e9d87[_0xa857('0x16')](_0xc412a9);}return _0x2e9d87[_0xa857('0x17')](_0xc412a9)['end']();};}function respondWithResult(_0x2a5de8,_0x248ec7){_0x248ec7=_0x248ec7||0xc8;return function(_0x17f8e2){if(_0x17f8e2){return _0x2a5de8['status'](_0x248ec7)[_0xa857('0x18')](_0x17f8e2);}};}function respondWithFilteredResult(_0x51c4b6,_0x5b3b4f){return function(_0x17088c){if(_0x17088c){var _0x31400c=typeof _0x5b3b4f['offset']===_0xa857('0x19')&&typeof _0x5b3b4f[_0xa857('0x1a')]===_0xa857('0x19');var _0x45b6a2=_0x17088c[_0xa857('0x1b')];var _0x3cc7cb=_0x31400c?0x0:_0x5b3b4f[_0xa857('0x1c')];var _0x4a73fc=_0x31400c?_0x17088c[_0xa857('0x1b')]:_0x5b3b4f['offset']+_0x5b3b4f['limit'];var _0x3482bf;if(_0x4a73fc>=_0x45b6a2){_0x4a73fc=_0x45b6a2;_0x3482bf=0xc8;}else{_0x3482bf=0xce;}_0x51c4b6[_0xa857('0x17')](_0x3482bf);return _0x51c4b6[_0xa857('0x1d')](_0xa857('0x1e'),_0x3cc7cb+'-'+_0x4a73fc+'/'+_0x45b6a2)[_0xa857('0x18')](_0x17088c);}return null;};}function patchUpdates(_0x49149d){return function(_0x5e1f91){try{jsonpatch[_0xa857('0x1f')](_0x5e1f91,_0x49149d,!![]);}catch(_0x35a565){return BPromise['reject'](_0x35a565);}return _0x5e1f91[_0xa857('0x20')]();};}function saveUpdates(_0x396a34,_0x3c56ff){return function(_0x4dd8c9){if(_0x4dd8c9){return _0x4dd8c9[_0xa857('0x21')](_0x396a34)[_0xa857('0x22')](function(_0x391261){return _0x391261;});}return null;};}function removeEntity(_0x25b4db,_0x8f48a2){return function(_0x321f91){if(_0x321f91){return _0x321f91[_0xa857('0x23')]()[_0xa857('0x22')](function(){_0x25b4db[_0xa857('0x17')](0xcc)[_0xa857('0x24')]();});}};}function handleEntityNotFound(_0x220bb3,_0x352f2e){return function(_0x3474ec){if(!_0x3474ec){_0x220bb3[_0xa857('0x16')](0x194);}return _0x3474ec;};}function handleError(_0x3af545,_0x2c8bb2){_0x2c8bb2=_0x2c8bb2||0x1f4;return function(_0x5902df){logger[_0xa857('0x25')](_0x5902df[_0xa857('0x26')]);if(_0x5902df['name']){delete _0x5902df['name'];}_0x3af545[_0xa857('0x17')](_0x2c8bb2)[_0xa857('0x27')](_0x5902df);};}exports[_0xa857('0x28')]=function(_0x25ae2c,_0x1d2358){var _0x3a88cd={},_0x390c72={},_0x47f870={'count':0x0,'rows':[]};var _0x1c0153=_[_0xa857('0x29')](db[_0xa857('0x2a')][_0xa857('0x2b')],function(_0x2d0733){return{'name':_0x2d0733['fieldName'],'type':_0x2d0733['type'][_0xa857('0x2c')]};});_0x390c72[_0xa857('0x2d')]=_[_0xa857('0x29')](_0x1c0153,_0xa857('0x2e'));_0x390c72[_0xa857('0x2f')]=_[_0xa857('0x30')](_0x25ae2c['query']);_0x390c72[_0xa857('0x31')]=_[_0xa857('0x32')](_0x390c72[_0xa857('0x2d')],_0x390c72[_0xa857('0x2f')]);_0x3a88cd['attributes']=_[_0xa857('0x32')](_0x390c72[_0xa857('0x2d')],qs[_0xa857('0x33')](_0x25ae2c['query'][_0xa857('0x33')]));_0x3a88cd[_0xa857('0x34')]=_0x3a88cd[_0xa857('0x34')][_0xa857('0x35')]?_0x3a88cd[_0xa857('0x34')]:_0x390c72[_0xa857('0x2d')];if(!_0x25ae2c[_0xa857('0x2f')][_0xa857('0x36')]('nolimit')){_0x3a88cd[_0xa857('0x1a')]=qs['limit'](_0x25ae2c[_0xa857('0x2f')][_0xa857('0x1a')]);_0x3a88cd[_0xa857('0x1c')]=qs[_0xa857('0x1c')](_0x25ae2c[_0xa857('0x2f')][_0xa857('0x1c')]);}_0x3a88cd[_0xa857('0x37')]=qs[_0xa857('0x38')](_0x25ae2c[_0xa857('0x2f')][_0xa857('0x38')]);_0x3a88cd[_0xa857('0x39')]=qs[_0xa857('0x31')](_[_0xa857('0x3a')](_0x25ae2c[_0xa857('0x2f')],_0x390c72[_0xa857('0x31')]),_0x1c0153);if(_0x25ae2c[_0xa857('0x2f')][_0xa857('0x3b')]){_0x3a88cd[_0xa857('0x39')]=_[_0xa857('0x3c')](_0x3a88cd[_0xa857('0x39')],{'$or':_[_0xa857('0x29')](_0x1c0153,function(_0x47e17e){if(_0x47e17e['type']!==_0xa857('0x3d')){var _0x2ef976={};_0x2ef976[_0x47e17e[_0xa857('0x2e')]]={'$like':'%'+_0x25ae2c[_0xa857('0x2f')]['filter']+'%'};return _0x2ef976;}})});}_0x3a88cd=_[_0xa857('0x3c')]({},_0x3a88cd,_0x25ae2c[_0xa857('0x3e')]);var _0x2260ee={'where':_0x3a88cd[_0xa857('0x39')]};return db[_0xa857('0x2a')][_0xa857('0x1b')](_0x2260ee)[_0xa857('0x22')](function(_0x45f782){_0x47f870['count']=_0x45f782;if(_0x25ae2c[_0xa857('0x2f')][_0xa857('0x3f')]){_0x3a88cd[_0xa857('0x40')]=[{'all':!![]}];}return db[_0xa857('0x2a')]['findAll'](_0x3a88cd);})[_0xa857('0x22')](function(_0x3b048f){_0x47f870[_0xa857('0x41')]=_0x3b048f;return _0x47f870;})[_0xa857('0x22')](respondWithFilteredResult(_0x1d2358,_0x3a88cd))[_0xa857('0x42')](handleError(_0x1d2358,null));};exports[_0xa857('0x43')]=function(_0x45035a,_0x2e3a07){var _0x2dd988={'raw':![],'where':{'id':_0x45035a[_0xa857('0x44')]['id']}},_0x1fcb57={};_0x1fcb57['model']=_[_0xa857('0x30')](db[_0xa857('0x2a')][_0xa857('0x2b')]);_0x1fcb57[_0xa857('0x2f')]=_['keys'](_0x45035a['query']);_0x1fcb57[_0xa857('0x31')]=_[_0xa857('0x32')](_0x1fcb57[_0xa857('0x2d')],_0x1fcb57['query']);_0x2dd988[_0xa857('0x34')]=_['intersection'](_0x1fcb57['model'],qs[_0xa857('0x33')](_0x45035a[_0xa857('0x2f')][_0xa857('0x33')]));_0x2dd988[_0xa857('0x34')]=_0x2dd988[_0xa857('0x34')][_0xa857('0x35')]?_0x2dd988['attributes']:_0x1fcb57[_0xa857('0x2d')];if(_0x45035a['query'][_0xa857('0x3f')]){_0x2dd988[_0xa857('0x40')]=[{'all':!![]}];}_0x2dd988=_[_0xa857('0x3c')]({},_0x2dd988,_0x45035a['options']);return db['ZohoConfiguration'][_0xa857('0x45')](_0x2dd988)[_0xa857('0x22')](handleEntityNotFound(_0x2e3a07,null))['then'](respondWithResult(_0x2e3a07,null))[_0xa857('0x42')](handleError(_0x2e3a07,null));};exports['create']=function(_0x2b64d8,_0x986f93){return db['ZohoConfiguration'][_0xa857('0x46')](_0x2b64d8['body'],{})[_0xa857('0x22')](respondWithResult(_0x986f93,0xc9))[_0xa857('0x42')](handleError(_0x986f93,null));};exports[_0xa857('0x21')]=function(_0x2bdf24,_0x1ab22a){if(_0x2bdf24['body']['id']){delete _0x2bdf24[_0xa857('0x47')]['id'];}return db['ZohoConfiguration'][_0xa857('0x45')]({'where':{'id':_0x2bdf24[_0xa857('0x44')]['id']}})[_0xa857('0x22')](handleEntityNotFound(_0x1ab22a,null))[_0xa857('0x22')](saveUpdates(_0x2bdf24[_0xa857('0x47')],null))[_0xa857('0x22')](respondWithResult(_0x1ab22a,null))[_0xa857('0x42')](handleError(_0x1ab22a,null));};exports['destroy']=function(_0x33e667,_0x3bfe75){return db[_0xa857('0x2a')]['find']({'where':{'id':_0x33e667[_0xa857('0x44')]['id']}})[_0xa857('0x22')](handleEntityNotFound(_0x3bfe75,null))[_0xa857('0x22')](removeEntity(_0x3bfe75,null))['catch'](handleError(_0x3bfe75,null));};exports[_0xa857('0x48')]=function(_0x42ca7f,_0x48ff10,_0xb8a55d){var _0x1ac7a1={};var _0x53b8fc={};var _0x538ee8;var _0x67a0e5;return db[_0xa857('0x2a')]['findOne']({'where':{'id':_0x42ca7f[_0xa857('0x44')]['id']}})[_0xa857('0x22')](handleEntityNotFound(_0x48ff10,null))[_0xa857('0x22')](function(_0x1455fc){if(_0x1455fc){_0x538ee8=_0x1455fc;_0x53b8fc[_0xa857('0x2d')]=_[_0xa857('0x30')](db[_0xa857('0x49')]['rawAttributes']);_0x53b8fc[_0xa857('0x2f')]=_['keys'](_0x42ca7f['query']);_0x53b8fc[_0xa857('0x31')]=_[_0xa857('0x32')](_0x53b8fc[_0xa857('0x2d')],_0x53b8fc[_0xa857('0x2f')]);_0x1ac7a1[_0xa857('0x34')]=_[_0xa857('0x32')](_0x53b8fc[_0xa857('0x2d')],qs['fields'](_0x42ca7f[_0xa857('0x2f')][_0xa857('0x33')]));_0x1ac7a1[_0xa857('0x34')]=_0x1ac7a1['attributes'][_0xa857('0x35')]?_0x1ac7a1[_0xa857('0x34')]:_0x53b8fc[_0xa857('0x2d')];_0x1ac7a1[_0xa857('0x37')]=qs['sort'](_0x42ca7f[_0xa857('0x2f')][_0xa857('0x38')]);_0x1ac7a1[_0xa857('0x39')]=qs['filters'](_[_0xa857('0x3a')](_0x42ca7f['query'],_0x53b8fc[_0xa857('0x31')]));if(_0x42ca7f['query'][_0xa857('0x3b')]){_0x1ac7a1[_0xa857('0x39')]=_['merge'](_0x1ac7a1[_0xa857('0x39')],{'$or':_[_0xa857('0x29')](_0x1ac7a1[_0xa857('0x34')],function(_0x12921e){var _0x97e98b={};_0x97e98b[_0x12921e]={'$like':'%'+_0x42ca7f['query'][_0xa857('0x3b')]+'%'};return _0x97e98b;})});}_0x1ac7a1=_['merge']({},_0x1ac7a1,_0x42ca7f['options']);return _0x538ee8[_0xa857('0x48')](_0x1ac7a1);}})[_0xa857('0x22')](function(_0x506b85){if(_0x506b85){_0x67a0e5=_0x506b85[_0xa857('0x35')];if(!_0x42ca7f['query']['hasOwnProperty'](_0xa857('0x4a'))){_0x1ac7a1[_0xa857('0x1a')]=qs[_0xa857('0x1a')](_0x42ca7f['query'][_0xa857('0x1a')]);_0x1ac7a1[_0xa857('0x1c')]=qs[_0xa857('0x1c')](_0x42ca7f['query'][_0xa857('0x1c')]);}return _0x538ee8[_0xa857('0x48')](_0x1ac7a1);}})['then'](function(_0x290e20){if(_0x290e20){return _0x290e20?{'count':_0x67a0e5,'rows':_0x290e20}:null;}})['then'](respondWithResult(_0x48ff10,null))[_0xa857('0x42')](handleError(_0x48ff10,null));};exports[_0xa857('0x4b')]=function(_0x5d5dcb,_0x43353e,_0x3bfabc){var _0x60e7f6={};var _0x39fa3e={};var _0x5c517e;var _0x4da12b;return db[_0xa857('0x2a')][_0xa857('0x4c')]({'where':{'id':_0x5d5dcb[_0xa857('0x44')]['id']}})[_0xa857('0x22')](handleEntityNotFound(_0x43353e,null))['then'](function(_0xdd2d31){if(_0xdd2d31){_0x5c517e=_0xdd2d31;_0x39fa3e[_0xa857('0x2d')]=_[_0xa857('0x30')](db['ZohoField'][_0xa857('0x2b')]);_0x39fa3e['query']=_['keys'](_0x5d5dcb[_0xa857('0x2f')]);_0x39fa3e[_0xa857('0x31')]=_[_0xa857('0x32')](_0x39fa3e[_0xa857('0x2d')],_0x39fa3e[_0xa857('0x2f')]);_0x60e7f6[_0xa857('0x34')]=_[_0xa857('0x32')](_0x39fa3e[_0xa857('0x2d')],qs[_0xa857('0x33')](_0x5d5dcb['query']['fields']));_0x60e7f6[_0xa857('0x34')]=_0x60e7f6[_0xa857('0x34')][_0xa857('0x35')]?_0x60e7f6[_0xa857('0x34')]:_0x39fa3e['model'];_0x60e7f6['order']=qs[_0xa857('0x38')](_0x5d5dcb[_0xa857('0x2f')][_0xa857('0x38')]);_0x60e7f6[_0xa857('0x39')]=qs[_0xa857('0x31')](_[_0xa857('0x3a')](_0x5d5dcb[_0xa857('0x2f')],_0x39fa3e[_0xa857('0x31')]));if(_0x5d5dcb[_0xa857('0x2f')][_0xa857('0x3b')]){_0x60e7f6[_0xa857('0x39')]=_['merge'](_0x60e7f6[_0xa857('0x39')],{'$or':_[_0xa857('0x29')](_0x60e7f6['attributes'],function(_0x3f2cad){var _0x6dcc3c={};_0x6dcc3c[_0x3f2cad]={'$like':'%'+_0x5d5dcb[_0xa857('0x2f')][_0xa857('0x3b')]+'%'};return _0x6dcc3c;})});}_0x60e7f6=_[_0xa857('0x3c')]({},_0x60e7f6,_0x5d5dcb[_0xa857('0x3e')]);return _0x5c517e[_0xa857('0x4b')](_0x60e7f6);}})[_0xa857('0x22')](function(_0x4e89b9){if(_0x4e89b9){_0x4da12b=_0x4e89b9['length'];if(!_0x5d5dcb[_0xa857('0x2f')][_0xa857('0x36')]('nolimit')){_0x60e7f6['limit']=qs[_0xa857('0x1a')](_0x5d5dcb[_0xa857('0x2f')][_0xa857('0x1a')]);_0x60e7f6['offset']=qs[_0xa857('0x1c')](_0x5d5dcb[_0xa857('0x2f')][_0xa857('0x1c')]);}return _0x5c517e[_0xa857('0x4b')](_0x60e7f6);}})['then'](function(_0x3bafb5){if(_0x3bafb5){return _0x3bafb5?{'count':_0x4da12b,'rows':_0x3bafb5}:null;}})[_0xa857('0x22')](respondWithResult(_0x43353e,null))['catch'](handleError(_0x43353e,null));};exports['getDescriptions']=function(_0x14626e,_0x24d9a9,_0x55184c){var _0x34d297={};var _0xd0a071={};var _0x556619;var _0x49327f;return db[_0xa857('0x2a')][_0xa857('0x4c')]({'where':{'id':_0x14626e[_0xa857('0x44')]['id']}})['then'](handleEntityNotFound(_0x24d9a9,null))[_0xa857('0x22')](function(_0x377552){if(_0x377552){_0x556619=_0x377552;_0xd0a071[_0xa857('0x2d')]=_['keys'](db[_0xa857('0x49')][_0xa857('0x2b')]);_0xd0a071[_0xa857('0x2f')]=_[_0xa857('0x30')](_0x14626e[_0xa857('0x2f')]);_0xd0a071[_0xa857('0x31')]=_[_0xa857('0x32')](_0xd0a071['model'],_0xd0a071['query']);_0x34d297[_0xa857('0x34')]=_[_0xa857('0x32')](_0xd0a071[_0xa857('0x2d')],qs[_0xa857('0x33')](_0x14626e[_0xa857('0x2f')][_0xa857('0x33')]));_0x34d297[_0xa857('0x34')]=_0x34d297[_0xa857('0x34')]['length']?_0x34d297['attributes']:_0xd0a071[_0xa857('0x2d')];_0x34d297[_0xa857('0x37')]=qs[_0xa857('0x38')](_0x14626e['query'][_0xa857('0x38')]);_0x34d297[_0xa857('0x39')]=qs[_0xa857('0x31')](_[_0xa857('0x3a')](_0x14626e[_0xa857('0x2f')],_0xd0a071[_0xa857('0x31')]));if(_0x14626e[_0xa857('0x2f')][_0xa857('0x3b')]){_0x34d297[_0xa857('0x39')]=_['merge'](_0x34d297['where'],{'$or':_[_0xa857('0x29')](_0x34d297['attributes'],function(_0xf9b360){var _0x19e00c={};_0x19e00c[_0xf9b360]={'$like':'%'+_0x14626e[_0xa857('0x2f')]['filter']+'%'};return _0x19e00c;})});}_0x34d297=_[_0xa857('0x3c')]({},_0x34d297,_0x14626e[_0xa857('0x3e')]);return _0x556619[_0xa857('0x4d')](_0x34d297);}})[_0xa857('0x22')](function(_0x538aeb){if(_0x538aeb){_0x49327f=_0x538aeb[_0xa857('0x35')];if(!_0x14626e['query'][_0xa857('0x36')](_0xa857('0x4a'))){_0x34d297[_0xa857('0x1a')]=qs[_0xa857('0x1a')](_0x14626e[_0xa857('0x2f')][_0xa857('0x1a')]);_0x34d297[_0xa857('0x1c')]=qs[_0xa857('0x1c')](_0x14626e[_0xa857('0x2f')]['offset']);}return _0x556619[_0xa857('0x4d')](_0x34d297);}})['then'](function(_0x345582){if(_0x345582){return _0x345582?{'count':_0x49327f,'rows':_0x345582}:null;}})[_0xa857('0x22')](respondWithResult(_0x24d9a9,null))['catch'](handleError(_0x24d9a9,null));}; \ No newline at end of file +var _0xc64c=['where','filters','pick','filter','merge','VIRTUAL','options','ZohoConfiguration','includeAll','findAll','rows','show','params','rawAttributes','intersection','include','find','catch','body','findOne','getFields','nolimit','getSubjects','getDescriptions','ZohoField','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','save','update','then','destroy','error','stack','name','send','map','fieldName','type','key','model','query','keys','fields','attributes','length','hasOwnProperty','order','sort'];(function(_0x4104a7,_0x3aa908){var _0x555c96=function(_0x5d6111){while(--_0x5d6111){_0x4104a7['push'](_0x4104a7['shift']());}};_0x555c96(++_0x3aa908);}(_0xc64c,0x67));var _0xcc64=function(_0x263f9d,_0x3d854e){_0x263f9d=_0x263f9d-0x0;var _0x4c4efa=_0xc64c[_0x263f9d];return _0x4c4efa;};'use strict';var emlformat=require(_0xcc64('0x0'));var rimraf=require(_0xcc64('0x1'));var zipdir=require(_0xcc64('0x2'));var jsonpatch=require(_0xcc64('0x3'));var rp=require(_0xcc64('0x4'));var moment=require(_0xcc64('0x5'));var BPromise=require(_0xcc64('0x6'));var Mustache=require(_0xcc64('0x7'));var util=require(_0xcc64('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0xcc64('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xcc64('0xa'));var crypto=require(_0xcc64('0xb'));var jsforce=require(_0xcc64('0xc'));var deskjs=require(_0xcc64('0xd'));var toCsv=require(_0xcc64('0x9'));var querystring=require('querystring');var Papa=require(_0xcc64('0xe'));var Redis=require(_0xcc64('0xf'));var authService=require(_0xcc64('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcc64('0x11'));var logger=require('../../config/logger')(_0xcc64('0x12'));var utils=require('../../config/utils');var config=require(_0xcc64('0x13'));var licenseUtil=require(_0xcc64('0x14'));var db=require(_0xcc64('0x15'))['db'];function respondWithStatusCode(_0x2c89f4,_0x361eb3){_0x361eb3=_0x361eb3||0xcc;return function(_0x1f229c){if(_0x1f229c){return _0x2c89f4[_0xcc64('0x16')](_0x361eb3);}return _0x2c89f4[_0xcc64('0x17')](_0x361eb3)[_0xcc64('0x18')]();};}function respondWithResult(_0x276c99,_0xe05541){_0xe05541=_0xe05541||0xc8;return function(_0x1f6e3e){if(_0x1f6e3e){return _0x276c99[_0xcc64('0x17')](_0xe05541)[_0xcc64('0x19')](_0x1f6e3e);}};}function respondWithFilteredResult(_0x5424bb,_0x59d033){return function(_0x13cb0a){if(_0x13cb0a){var _0x3c107d=typeof _0x59d033[_0xcc64('0x1a')]===_0xcc64('0x1b')&&typeof _0x59d033['limit']===_0xcc64('0x1b');var _0x41bba8=_0x13cb0a[_0xcc64('0x1c')];var _0x56a3c7=_0x3c107d?0x0:_0x59d033[_0xcc64('0x1a')];var _0x406a69=_0x3c107d?_0x13cb0a['count']:_0x59d033[_0xcc64('0x1a')]+_0x59d033[_0xcc64('0x1d')];var _0x10856e;if(_0x406a69>=_0x41bba8){_0x406a69=_0x41bba8;_0x10856e=0xc8;}else{_0x10856e=0xce;}_0x5424bb[_0xcc64('0x17')](_0x10856e);return _0x5424bb[_0xcc64('0x1e')](_0xcc64('0x1f'),_0x56a3c7+'-'+_0x406a69+'/'+_0x41bba8)[_0xcc64('0x19')](_0x13cb0a);}return null;};}function patchUpdates(_0x288b7e){return function(_0x164459){try{jsonpatch['apply'](_0x164459,_0x288b7e,!![]);}catch(_0x3410f7){return BPromise['reject'](_0x3410f7);}return _0x164459[_0xcc64('0x20')]();};}function saveUpdates(_0x188353,_0x1aaa2f){return function(_0x21bd54){if(_0x21bd54){return _0x21bd54[_0xcc64('0x21')](_0x188353)[_0xcc64('0x22')](function(_0x3c7bdd){return _0x3c7bdd;});}return null;};}function removeEntity(_0x5bc116,_0x3c5a01){return function(_0x4a9157){if(_0x4a9157){return _0x4a9157[_0xcc64('0x23')]()[_0xcc64('0x22')](function(){_0x5bc116['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x20196a,_0x341129){return function(_0x4577b3){if(!_0x4577b3){_0x20196a['sendStatus'](0x194);}return _0x4577b3;};}function handleError(_0x25a3f2,_0x1f5608){_0x1f5608=_0x1f5608||0x1f4;return function(_0x5462a7){logger[_0xcc64('0x24')](_0x5462a7[_0xcc64('0x25')]);if(_0x5462a7['name']){delete _0x5462a7[_0xcc64('0x26')];}_0x25a3f2[_0xcc64('0x17')](_0x1f5608)[_0xcc64('0x27')](_0x5462a7);};}exports['index']=function(_0x3aadf0,_0x401ebd){var _0x13fcbf={},_0x4c523c={},_0x494a66={'count':0x0,'rows':[]};var _0x5aaaf4=_[_0xcc64('0x28')](db['ZohoConfiguration']['rawAttributes'],function(_0x14a0f0){return{'name':_0x14a0f0[_0xcc64('0x29')],'type':_0x14a0f0[_0xcc64('0x2a')][_0xcc64('0x2b')]};});_0x4c523c[_0xcc64('0x2c')]=_['map'](_0x5aaaf4,_0xcc64('0x26'));_0x4c523c[_0xcc64('0x2d')]=_[_0xcc64('0x2e')](_0x3aadf0[_0xcc64('0x2d')]);_0x4c523c['filters']=_['intersection'](_0x4c523c[_0xcc64('0x2c')],_0x4c523c[_0xcc64('0x2d')]);_0x13fcbf['attributes']=_['intersection'](_0x4c523c[_0xcc64('0x2c')],qs[_0xcc64('0x2f')](_0x3aadf0[_0xcc64('0x2d')][_0xcc64('0x2f')]));_0x13fcbf['attributes']=_0x13fcbf[_0xcc64('0x30')][_0xcc64('0x31')]?_0x13fcbf[_0xcc64('0x30')]:_0x4c523c[_0xcc64('0x2c')];if(!_0x3aadf0[_0xcc64('0x2d')][_0xcc64('0x32')]('nolimit')){_0x13fcbf['limit']=qs[_0xcc64('0x1d')](_0x3aadf0[_0xcc64('0x2d')][_0xcc64('0x1d')]);_0x13fcbf[_0xcc64('0x1a')]=qs[_0xcc64('0x1a')](_0x3aadf0[_0xcc64('0x2d')]['offset']);}_0x13fcbf[_0xcc64('0x33')]=qs[_0xcc64('0x34')](_0x3aadf0['query'][_0xcc64('0x34')]);_0x13fcbf[_0xcc64('0x35')]=qs[_0xcc64('0x36')](_[_0xcc64('0x37')](_0x3aadf0[_0xcc64('0x2d')],_0x4c523c[_0xcc64('0x36')]),_0x5aaaf4);if(_0x3aadf0[_0xcc64('0x2d')][_0xcc64('0x38')]){_0x13fcbf[_0xcc64('0x35')]=_[_0xcc64('0x39')](_0x13fcbf[_0xcc64('0x35')],{'$or':_['map'](_0x5aaaf4,function(_0x486a0a){if(_0x486a0a[_0xcc64('0x2a')]!==_0xcc64('0x3a')){var _0x5096={};_0x5096[_0x486a0a[_0xcc64('0x26')]]={'$like':'%'+_0x3aadf0[_0xcc64('0x2d')][_0xcc64('0x38')]+'%'};return _0x5096;}})});}_0x13fcbf=_[_0xcc64('0x39')]({},_0x13fcbf,_0x3aadf0[_0xcc64('0x3b')]);var _0x44e8ae={'where':_0x13fcbf[_0xcc64('0x35')]};return db[_0xcc64('0x3c')][_0xcc64('0x1c')](_0x44e8ae)[_0xcc64('0x22')](function(_0x5a2f10){_0x494a66[_0xcc64('0x1c')]=_0x5a2f10;if(_0x3aadf0[_0xcc64('0x2d')][_0xcc64('0x3d')]){_0x13fcbf['include']=[{'all':!![]}];}return db[_0xcc64('0x3c')][_0xcc64('0x3e')](_0x13fcbf);})[_0xcc64('0x22')](function(_0x22c25b){_0x494a66[_0xcc64('0x3f')]=_0x22c25b;return _0x494a66;})[_0xcc64('0x22')](respondWithFilteredResult(_0x401ebd,_0x13fcbf))['catch'](handleError(_0x401ebd,null));};exports[_0xcc64('0x40')]=function(_0x3266d1,_0x5f0942){var _0x5ed394={'raw':![],'where':{'id':_0x3266d1[_0xcc64('0x41')]['id']}},_0x1fc6e1={};_0x1fc6e1[_0xcc64('0x2c')]=_[_0xcc64('0x2e')](db[_0xcc64('0x3c')][_0xcc64('0x42')]);_0x1fc6e1['query']=_['keys'](_0x3266d1[_0xcc64('0x2d')]);_0x1fc6e1[_0xcc64('0x36')]=_[_0xcc64('0x43')](_0x1fc6e1['model'],_0x1fc6e1['query']);_0x5ed394['attributes']=_[_0xcc64('0x43')](_0x1fc6e1[_0xcc64('0x2c')],qs[_0xcc64('0x2f')](_0x3266d1[_0xcc64('0x2d')][_0xcc64('0x2f')]));_0x5ed394['attributes']=_0x5ed394['attributes'][_0xcc64('0x31')]?_0x5ed394[_0xcc64('0x30')]:_0x1fc6e1[_0xcc64('0x2c')];if(_0x3266d1['query'][_0xcc64('0x3d')]){_0x5ed394[_0xcc64('0x44')]=[{'all':!![]}];}_0x5ed394=_[_0xcc64('0x39')]({},_0x5ed394,_0x3266d1[_0xcc64('0x3b')]);return db[_0xcc64('0x3c')][_0xcc64('0x45')](_0x5ed394)['then'](handleEntityNotFound(_0x5f0942,null))[_0xcc64('0x22')](respondWithResult(_0x5f0942,null))[_0xcc64('0x46')](handleError(_0x5f0942,null));};exports['create']=function(_0x3c711a,_0x317e18){return db['ZohoConfiguration']['create'](_0x3c711a[_0xcc64('0x47')],{})['then'](respondWithResult(_0x317e18,0xc9))[_0xcc64('0x46')](handleError(_0x317e18,null));};exports['update']=function(_0xd9039e,_0x161182){if(_0xd9039e[_0xcc64('0x47')]['id']){delete _0xd9039e['body']['id'];}return db[_0xcc64('0x3c')][_0xcc64('0x45')]({'where':{'id':_0xd9039e[_0xcc64('0x41')]['id']}})[_0xcc64('0x22')](handleEntityNotFound(_0x161182,null))[_0xcc64('0x22')](saveUpdates(_0xd9039e['body'],null))[_0xcc64('0x22')](respondWithResult(_0x161182,null))['catch'](handleError(_0x161182,null));};exports['destroy']=function(_0x44f748,_0x4fecde){return db[_0xcc64('0x3c')][_0xcc64('0x45')]({'where':{'id':_0x44f748[_0xcc64('0x41')]['id']}})[_0xcc64('0x22')](handleEntityNotFound(_0x4fecde,null))[_0xcc64('0x22')](removeEntity(_0x4fecde,null))[_0xcc64('0x46')](handleError(_0x4fecde,null));};exports['getFields']=function(_0xe15758,_0x135eb3,_0x2c35d9){var _0x4144de={};var _0x1ccb20={};var _0x418be3;var _0x4a9f12;return db[_0xcc64('0x3c')][_0xcc64('0x48')]({'where':{'id':_0xe15758[_0xcc64('0x41')]['id']}})[_0xcc64('0x22')](handleEntityNotFound(_0x135eb3,null))['then'](function(_0x163339){if(_0x163339){_0x418be3=_0x163339;_0x1ccb20[_0xcc64('0x2c')]=_[_0xcc64('0x2e')](db['ZohoField'][_0xcc64('0x42')]);_0x1ccb20[_0xcc64('0x2d')]=_[_0xcc64('0x2e')](_0xe15758[_0xcc64('0x2d')]);_0x1ccb20[_0xcc64('0x36')]=_['intersection'](_0x1ccb20[_0xcc64('0x2c')],_0x1ccb20['query']);_0x4144de['attributes']=_[_0xcc64('0x43')](_0x1ccb20[_0xcc64('0x2c')],qs[_0xcc64('0x2f')](_0xe15758[_0xcc64('0x2d')]['fields']));_0x4144de[_0xcc64('0x30')]=_0x4144de[_0xcc64('0x30')][_0xcc64('0x31')]?_0x4144de['attributes']:_0x1ccb20[_0xcc64('0x2c')];_0x4144de[_0xcc64('0x33')]=qs[_0xcc64('0x34')](_0xe15758[_0xcc64('0x2d')]['sort']);_0x4144de['where']=qs[_0xcc64('0x36')](_[_0xcc64('0x37')](_0xe15758[_0xcc64('0x2d')],_0x1ccb20[_0xcc64('0x36')]));if(_0xe15758['query'][_0xcc64('0x38')]){_0x4144de[_0xcc64('0x35')]=_[_0xcc64('0x39')](_0x4144de[_0xcc64('0x35')],{'$or':_[_0xcc64('0x28')](_0x4144de[_0xcc64('0x30')],function(_0x4da533){var _0x3a3e42={};_0x3a3e42[_0x4da533]={'$like':'%'+_0xe15758[_0xcc64('0x2d')][_0xcc64('0x38')]+'%'};return _0x3a3e42;})});}_0x4144de=_['merge']({},_0x4144de,_0xe15758[_0xcc64('0x3b')]);return _0x418be3[_0xcc64('0x49')](_0x4144de);}})['then'](function(_0x1ea1d3){if(_0x1ea1d3){_0x4a9f12=_0x1ea1d3[_0xcc64('0x31')];if(!_0xe15758[_0xcc64('0x2d')]['hasOwnProperty'](_0xcc64('0x4a'))){_0x4144de[_0xcc64('0x1d')]=qs[_0xcc64('0x1d')](_0xe15758[_0xcc64('0x2d')][_0xcc64('0x1d')]);_0x4144de['offset']=qs[_0xcc64('0x1a')](_0xe15758[_0xcc64('0x2d')]['offset']);}return _0x418be3[_0xcc64('0x49')](_0x4144de);}})[_0xcc64('0x22')](function(_0x2e7d59){if(_0x2e7d59){return _0x2e7d59?{'count':_0x4a9f12,'rows':_0x2e7d59}:null;}})['then'](respondWithResult(_0x135eb3,null))['catch'](handleError(_0x135eb3,null));};exports[_0xcc64('0x4b')]=function(_0x685a68,_0xff4e91,_0x4029db){var _0x5d38a7={};var _0xa5b929={};var _0x4059cc;var _0x453917;return db[_0xcc64('0x3c')][_0xcc64('0x48')]({'where':{'id':_0x685a68['params']['id']}})['then'](handleEntityNotFound(_0xff4e91,null))['then'](function(_0x382f3e){if(_0x382f3e){_0x4059cc=_0x382f3e;_0xa5b929[_0xcc64('0x2c')]=_[_0xcc64('0x2e')](db['ZohoField'][_0xcc64('0x42')]);_0xa5b929[_0xcc64('0x2d')]=_['keys'](_0x685a68[_0xcc64('0x2d')]);_0xa5b929['filters']=_[_0xcc64('0x43')](_0xa5b929[_0xcc64('0x2c')],_0xa5b929['query']);_0x5d38a7[_0xcc64('0x30')]=_[_0xcc64('0x43')](_0xa5b929[_0xcc64('0x2c')],qs[_0xcc64('0x2f')](_0x685a68[_0xcc64('0x2d')][_0xcc64('0x2f')]));_0x5d38a7[_0xcc64('0x30')]=_0x5d38a7[_0xcc64('0x30')]['length']?_0x5d38a7[_0xcc64('0x30')]:_0xa5b929[_0xcc64('0x2c')];_0x5d38a7[_0xcc64('0x33')]=qs['sort'](_0x685a68[_0xcc64('0x2d')]['sort']);_0x5d38a7['where']=qs[_0xcc64('0x36')](_['pick'](_0x685a68['query'],_0xa5b929[_0xcc64('0x36')]));if(_0x685a68['query'][_0xcc64('0x38')]){_0x5d38a7[_0xcc64('0x35')]=_['merge'](_0x5d38a7[_0xcc64('0x35')],{'$or':_['map'](_0x5d38a7[_0xcc64('0x30')],function(_0xb2ad20){var _0x12ec9e={};_0x12ec9e[_0xb2ad20]={'$like':'%'+_0x685a68['query'][_0xcc64('0x38')]+'%'};return _0x12ec9e;})});}_0x5d38a7=_['merge']({},_0x5d38a7,_0x685a68[_0xcc64('0x3b')]);return _0x4059cc[_0xcc64('0x4b')](_0x5d38a7);}})[_0xcc64('0x22')](function(_0x1f9ffe){if(_0x1f9ffe){_0x453917=_0x1f9ffe['length'];if(!_0x685a68[_0xcc64('0x2d')][_0xcc64('0x32')](_0xcc64('0x4a'))){_0x5d38a7[_0xcc64('0x1d')]=qs[_0xcc64('0x1d')](_0x685a68[_0xcc64('0x2d')][_0xcc64('0x1d')]);_0x5d38a7[_0xcc64('0x1a')]=qs['offset'](_0x685a68[_0xcc64('0x2d')][_0xcc64('0x1a')]);}return _0x4059cc[_0xcc64('0x4b')](_0x5d38a7);}})[_0xcc64('0x22')](function(_0x4847b4){if(_0x4847b4){return _0x4847b4?{'count':_0x453917,'rows':_0x4847b4}:null;}})[_0xcc64('0x22')](respondWithResult(_0xff4e91,null))[_0xcc64('0x46')](handleError(_0xff4e91,null));};exports[_0xcc64('0x4c')]=function(_0x2d7e36,_0x347b94,_0x38bcd8){var _0x181166={};var _0x1e5a96={};var _0x444708;var _0x1c7bd5;return db[_0xcc64('0x3c')][_0xcc64('0x48')]({'where':{'id':_0x2d7e36[_0xcc64('0x41')]['id']}})[_0xcc64('0x22')](handleEntityNotFound(_0x347b94,null))[_0xcc64('0x22')](function(_0x59d436){if(_0x59d436){_0x444708=_0x59d436;_0x1e5a96['model']=_[_0xcc64('0x2e')](db[_0xcc64('0x4d')][_0xcc64('0x42')]);_0x1e5a96[_0xcc64('0x2d')]=_['keys'](_0x2d7e36[_0xcc64('0x2d')]);_0x1e5a96[_0xcc64('0x36')]=_['intersection'](_0x1e5a96[_0xcc64('0x2c')],_0x1e5a96['query']);_0x181166['attributes']=_[_0xcc64('0x43')](_0x1e5a96[_0xcc64('0x2c')],qs[_0xcc64('0x2f')](_0x2d7e36[_0xcc64('0x2d')][_0xcc64('0x2f')]));_0x181166[_0xcc64('0x30')]=_0x181166[_0xcc64('0x30')][_0xcc64('0x31')]?_0x181166[_0xcc64('0x30')]:_0x1e5a96['model'];_0x181166[_0xcc64('0x33')]=qs[_0xcc64('0x34')](_0x2d7e36[_0xcc64('0x2d')][_0xcc64('0x34')]);_0x181166[_0xcc64('0x35')]=qs[_0xcc64('0x36')](_[_0xcc64('0x37')](_0x2d7e36[_0xcc64('0x2d')],_0x1e5a96[_0xcc64('0x36')]));if(_0x2d7e36[_0xcc64('0x2d')]['filter']){_0x181166[_0xcc64('0x35')]=_[_0xcc64('0x39')](_0x181166[_0xcc64('0x35')],{'$or':_['map'](_0x181166[_0xcc64('0x30')],function(_0x4c63a3){var _0x49cd61={};_0x49cd61[_0x4c63a3]={'$like':'%'+_0x2d7e36[_0xcc64('0x2d')][_0xcc64('0x38')]+'%'};return _0x49cd61;})});}_0x181166=_[_0xcc64('0x39')]({},_0x181166,_0x2d7e36['options']);return _0x444708['getDescriptions'](_0x181166);}})[_0xcc64('0x22')](function(_0x732f63){if(_0x732f63){_0x1c7bd5=_0x732f63[_0xcc64('0x31')];if(!_0x2d7e36[_0xcc64('0x2d')][_0xcc64('0x32')](_0xcc64('0x4a'))){_0x181166['limit']=qs[_0xcc64('0x1d')](_0x2d7e36['query'][_0xcc64('0x1d')]);_0x181166['offset']=qs[_0xcc64('0x1a')](_0x2d7e36[_0xcc64('0x2d')][_0xcc64('0x1a')]);}return _0x444708[_0xcc64('0x4c')](_0x181166);}})[_0xcc64('0x22')](function(_0x2f8b16){if(_0x2f8b16){return _0x2f8b16?{'count':_0x1c7bd5,'rows':_0x2f8b16}:null;}})[_0xcc64('0x22')](respondWithResult(_0x347b94,null))['catch'](handleError(_0x347b94,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index 3aaec77..2b68a93 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 _0x0126=['bluebird','request-promise','path','rimraf','../../config/environment','ZohoConfiguration','int_zoho_configurations','lodash','util','api','moment'];(function(_0x57f9b9,_0x53b5f9){var _0x17b065=function(_0x2fac09){while(--_0x2fac09){_0x57f9b9['push'](_0x57f9b9['shift']());}};_0x17b065(++_0x53b5f9);}(_0x0126,0xe3));var _0x6012=function(_0x141cf5,_0x4e8720){_0x141cf5=_0x141cf5-0x0;var _0x19ec69=_0x0126[_0x141cf5];return _0x19ec69;};'use strict';var _=require(_0x6012('0x0'));var util=require(_0x6012('0x1'));var logger=require('../../config/logger')(_0x6012('0x2'));var moment=require(_0x6012('0x3'));var BPromise=require(_0x6012('0x4'));var rp=require(_0x6012('0x5'));var fs=require('fs');var path=require(_0x6012('0x6'));var rimraf=require(_0x6012('0x7'));var config=require(_0x6012('0x8'));var attributes=require('./intZohoConfiguration.attributes');module['exports']=function(_0x3460df,_0x464b1f){return _0x3460df['define'](_0x6012('0x9'),attributes,{'tableName':_0x6012('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb608=['ZohoConfiguration','int_zoho_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports','define'];(function(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0xb608,0xd2));var _0x8b60=function(_0x2966fd,_0x6d0df1){_0x2966fd=_0x2966fd-0x0;var _0x178b11=_0xb608[_0x2966fd];return _0x178b11;};'use strict';var _=require(_0x8b60('0x0'));var util=require(_0x8b60('0x1'));var logger=require(_0x8b60('0x2'))(_0x8b60('0x3'));var moment=require(_0x8b60('0x4'));var BPromise=require(_0x8b60('0x5'));var rp=require(_0x8b60('0x6'));var fs=require('fs');var path=require(_0x8b60('0x7'));var rimraf=require('rimraf');var config=require(_0x8b60('0x8'));var attributes=require('./intZohoConfiguration.attributes');module[_0x8b60('0x9')]=function(_0x9b53a4,_0x554b9c){return _0x9b53a4[_0x8b60('0xa')](_0x8b60('0xb'),attributes,{'tableName':_0x8b60('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js b/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js index b799f23..e972b4f 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 _0xd9d1=['ZohoConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','then','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x113a6c,_0x10df30){var _0x1ac632=function(_0xbd4fb9){while(--_0xbd4fb9){_0x113a6c['push'](_0x113a6c['shift']());}};_0x1ac632(++_0x10df30);}(_0xd9d1,0x132));var _0x1d9d=function(_0x4e9c15,_0x16bd10){_0x4e9c15=_0x4e9c15-0x0;var _0x1dfab8=_0xd9d1[_0x4e9c15];return _0x1dfab8;};'use strict';var _=require(_0x1d9d('0x0'));var util=require(_0x1d9d('0x1'));var moment=require(_0x1d9d('0x2'));var BPromise=require(_0x1d9d('0x3'));var rs=require(_0x1d9d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1d9d('0x5'))['db'];var utils=require(_0x1d9d('0x6'));var logger=require(_0x1d9d('0x7'))(_0x1d9d('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x1d9d('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x33fc95,_0x54f508,_0x25b2af){return new BPromise(function(_0x4bdf76,_0x98ed74){return client['request'](_0x33fc95,_0x25b2af)[_0x1d9d('0xa')](function(_0x35034f){logger['info'](_0x1d9d('0xb'),_0x54f508,_0x1d9d('0xc'));logger[_0x1d9d('0xd')](_0x1d9d('0xe'),_0x54f508,_0x1d9d('0xc'),JSON['stringify'](_0x35034f));if(_0x35034f[_0x1d9d('0xf')]){if(_0x35034f[_0x1d9d('0xf')][_0x1d9d('0x10')]===0x1f4){logger[_0x1d9d('0xf')](_0x1d9d('0xb'),_0x54f508,_0x35034f[_0x1d9d('0xf')][_0x1d9d('0x11')]);return _0x98ed74(_0x35034f[_0x1d9d('0xf')][_0x1d9d('0x11')]);}logger['error'](_0x1d9d('0xb'),_0x54f508,_0x35034f['error'][_0x1d9d('0x11')]);return _0x4bdf76(_0x35034f[_0x1d9d('0xf')][_0x1d9d('0x11')]);}else{logger['info'](_0x1d9d('0xb'),_0x54f508,_0x1d9d('0xc'));_0x4bdf76(_0x35034f[_0x1d9d('0x12')]['message']);}})[_0x1d9d('0x13')](function(_0x233065){logger['error'](_0x1d9d('0xb'),_0x54f508,_0x233065);_0x98ed74(_0x233065);});});} \ No newline at end of file +var _0xe4fc=['then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request'];(function(_0x3e0eb3,_0x140cf1){var _0x302eb0=function(_0x5d2ad6){while(--_0x5d2ad6){_0x3e0eb3['push'](_0x3e0eb3['shift']());}};_0x302eb0(++_0x140cf1);}(_0xe4fc,0xba));var _0xce4f=function(_0x5932c4,_0x1b58ab){_0x5932c4=_0x5932c4-0x0;var _0x53acee=_0xe4fc[_0x5932c4];return _0x53acee;};'use strict';var _=require(_0xce4f('0x0'));var util=require(_0xce4f('0x1'));var moment=require(_0xce4f('0x2'));var BPromise=require('bluebird');var rs=require(_0xce4f('0x3'));var fs=require('fs');var Redis=require(_0xce4f('0x4'));var db=require(_0xce4f('0x5'))['db'];var utils=require(_0xce4f('0x6'));var logger=require('../../config/logger')(_0xce4f('0x7'));var config=require(_0xce4f('0x8'));var jayson=require(_0xce4f('0x9'));var client=jayson['client'][_0xce4f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x13b5a4,_0x491c08,_0x4af959){return new BPromise(function(_0x2f41c1,_0x668676){return client[_0xce4f('0xb')](_0x13b5a4,_0x4af959)[_0xce4f('0xc')](function(_0x4fd9f5){logger[_0xce4f('0xd')](_0xce4f('0xe'),_0x491c08,_0xce4f('0xf'));logger[_0xce4f('0x10')](_0xce4f('0x11'),_0x491c08,'request\x20sent',JSON['stringify'](_0x4fd9f5));if(_0x4fd9f5['error']){if(_0x4fd9f5[_0xce4f('0x12')]['code']===0x1f4){logger[_0xce4f('0x12')](_0xce4f('0xe'),_0x491c08,_0x4fd9f5[_0xce4f('0x12')]['message']);return _0x668676(_0x4fd9f5[_0xce4f('0x12')][_0xce4f('0x13')]);}logger[_0xce4f('0x12')](_0xce4f('0xe'),_0x491c08,_0x4fd9f5[_0xce4f('0x12')][_0xce4f('0x13')]);return _0x2f41c1(_0x4fd9f5['error'][_0xce4f('0x13')]);}else{logger[_0xce4f('0xd')](_0xce4f('0xe'),_0x491c08,_0xce4f('0xf'));_0x2f41c1(_0x4fd9f5[_0xce4f('0x14')][_0xce4f('0x13')]);}})[_0xce4f('0x15')](function(_0x5622fc){logger[_0xce4f('0x12')](_0xce4f('0xe'),_0x491c08,_0x5622fc);_0x668676(_0x5622fc);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index e8c9704..b2df072 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 _0x8eb6=['update','delete','destroy','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intZohoField.controller','isAuthenticated','index','/:id','show','post','create','put'];(function(_0x2843f1,_0x433cd8){var _0x3efff0=function(_0x25419c){while(--_0x25419c){_0x2843f1['push'](_0x2843f1['shift']());}};_0x3efff0(++_0x433cd8);}(_0x8eb6,0x192));var _0x68eb=function(_0x577f6e,_0x27cbfa){_0x577f6e=_0x577f6e-0x0;var _0x154b20=_0x8eb6[_0x577f6e];return _0x154b20;};'use strict';var multer=require(_0x68eb('0x0'));var util=require(_0x68eb('0x1'));var path=require(_0x68eb('0x2'));var timeout=require('connect-timeout');var express=require(_0x68eb('0x3'));var router=express[_0x68eb('0x4')]();var fs_extra=require(_0x68eb('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x68eb('0x6'));var config=require(_0x68eb('0x7'));var controller=require(_0x68eb('0x8'));router['get']('/',auth[_0x68eb('0x9')](),controller[_0x68eb('0xa')]);router['get'](_0x68eb('0xb'),auth[_0x68eb('0x9')](),controller[_0x68eb('0xc')]);router[_0x68eb('0xd')]('/',auth[_0x68eb('0x9')](),controller[_0x68eb('0xe')]);router[_0x68eb('0xf')](_0x68eb('0xb'),auth[_0x68eb('0x9')](),controller[_0x68eb('0x10')]);router[_0x68eb('0x11')]('/:id',auth[_0x68eb('0x9')](),controller[_0x68eb('0x12')]);module['exports']=router; \ No newline at end of file +var _0x3821=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoField.controller','isAuthenticated','index','get','show','create','put','/:id','update','delete','destroy','exports'];(function(_0x164133,_0x2dfc05){var _0x5bb5ec=function(_0x1d02af){while(--_0x1d02af){_0x164133['push'](_0x164133['shift']());}};_0x5bb5ec(++_0x2dfc05);}(_0x3821,0x1ce));var _0x1382=function(_0x521176,_0xa9d376){_0x521176=_0x521176-0x0;var _0x133a1f=_0x3821[_0x521176];return _0x133a1f;};'use strict';var multer=require(_0x1382('0x0'));var util=require(_0x1382('0x1'));var path=require(_0x1382('0x2'));var timeout=require(_0x1382('0x3'));var express=require(_0x1382('0x4'));var router=express[_0x1382('0x5')]();var fs_extra=require(_0x1382('0x6'));var auth=require(_0x1382('0x7'));var interaction=require(_0x1382('0x8'));var config=require(_0x1382('0x9'));var controller=require(_0x1382('0xa'));router['get']('/',auth[_0x1382('0xb')](),controller[_0x1382('0xc')]);router[_0x1382('0xd')]('/:id',auth[_0x1382('0xb')](),controller[_0x1382('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x1382('0xf')]);router[_0x1382('0x10')](_0x1382('0x11'),auth[_0x1382('0xb')](),controller[_0x1382('0x12')]);router[_0x1382('0x13')](_0x1382('0x11'),auth['isAuthenticated'](),controller[_0x1382('0x14')]);module[_0x1382('0x15')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index 150f1a8..3109520 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 _0xd48c=['STRING','ENUM','BOOLEAN','sequelize','exports','string','variable','customVariable','keyValue','picklist'];(function(_0x6fffaf,_0x35d1de){var _0x46f344=function(_0x313cec){while(--_0x313cec){_0x6fffaf['push'](_0x6fffaf['shift']());}};_0x46f344(++_0x35d1de);}(_0xd48c,0x14d));var _0xcd48=function(_0x424501,_0x42096d){_0x424501=_0x424501-0x0;var _0xb719af=_0xd48c[_0x424501];return _0xb719af;};'use strict';var Sequelize=require(_0xcd48('0x0'));module[_0xcd48('0x1')]={'type':{'type':Sequelize['ENUM'](_0xcd48('0x2'),_0xcd48('0x3'),_0xcd48('0x4'),_0xcd48('0x5'),_0xcd48('0x6')),'defaultValue':_0xcd48('0x2')},'content':{'type':Sequelize[_0xcd48('0x7')]},'key':{'type':Sequelize[_0xcd48('0x7')]},'keyType':{'type':Sequelize[_0xcd48('0x8')](_0xcd48('0x2'),_0xcd48('0x3'),_0xcd48('0x4'))},'keyContent':{'type':Sequelize[_0xcd48('0x7')]},'idField':{'type':Sequelize[_0xcd48('0x7')]},'nameField':{'type':Sequelize[_0xcd48('0x7')]},'customField':{'type':Sequelize[_0xcd48('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xcd48('0x7')]}}; \ No newline at end of file +var _0x28e3=['sequelize','exports','ENUM','string','variable','customVariable','picklist','STRING','BOOLEAN'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x28e3,0x129));var _0x328e=function(_0x2d61b2,_0x142947){_0x2d61b2=_0x2d61b2-0x0;var _0x12df89=_0x28e3[_0x2d61b2];return _0x12df89;};'use strict';var Sequelize=require(_0x328e('0x0'));module[_0x328e('0x1')]={'type':{'type':Sequelize[_0x328e('0x2')](_0x328e('0x3'),_0x328e('0x4'),_0x328e('0x5'),'keyValue',_0x328e('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0x328e('0x7')]},'key':{'type':Sequelize[_0x328e('0x7')]},'keyType':{'type':Sequelize[_0x328e('0x2')](_0x328e('0x3'),'variable','customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x328e('0x7')]},'nameField':{'type':Sequelize[_0x328e('0x7')]},'customField':{'type':Sequelize[_0x328e('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x328e('0x7')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 2c4f1fa..cedfaac 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 _0xe288=['fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','map','type','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','find','create','body','params','destroy','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','limit','undefined','set','Content-Range','apply','save','update','then','error','stack','name','index','ZohoField','rawAttributes'];(function(_0x46be78,_0x5a4ee7){var _0x105199=function(_0x37e2b0){while(--_0x37e2b0){_0x46be78['push'](_0x46be78['shift']());}};_0x105199(++_0x5a4ee7);}(_0xe288,0xbc));var _0x8e28=function(_0x51ffc3,_0x5f03b2){_0x51ffc3=_0x51ffc3-0x0;var _0x14da54=_0xe288[_0x51ffc3];return _0x14da54;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8e28('0x0'));var zipdir=require(_0x8e28('0x1'));var jsonpatch=require(_0x8e28('0x2'));var rp=require(_0x8e28('0x3'));var moment=require('moment');var BPromise=require(_0x8e28('0x4'));var Mustache=require(_0x8e28('0x5'));var util=require(_0x8e28('0x6'));var path=require(_0x8e28('0x7'));var sox=require(_0x8e28('0x8'));var csv=require(_0x8e28('0x9'));var ejs=require(_0x8e28('0xa'));var fs=require('fs');var fs_extra=require(_0x8e28('0xb'));var _=require(_0x8e28('0xc'));var squel=require(_0x8e28('0xd'));var crypto=require(_0x8e28('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x8e28('0xf'));var toCsv=require(_0x8e28('0x9'));var querystring=require(_0x8e28('0x10'));var Papa=require(_0x8e28('0x11'));var Redis=require(_0x8e28('0x12'));var authService=require(_0x8e28('0x13'));var qs=require(_0x8e28('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8e28('0x15'));var logger=require(_0x8e28('0x16'))(_0x8e28('0x17'));var utils=require(_0x8e28('0x18'));var config=require(_0x8e28('0x19'));var licenseUtil=require(_0x8e28('0x1a'));var db=require(_0x8e28('0x1b'))['db'];function respondWithStatusCode(_0x1d75d6,_0x5d0d91){_0x5d0d91=_0x5d0d91||0xcc;return function(_0x173161){if(_0x173161){return _0x1d75d6['sendStatus'](_0x5d0d91);}return _0x1d75d6['status'](_0x5d0d91)[_0x8e28('0x1c')]();};}function respondWithResult(_0x335cbc,_0x32fedb){_0x32fedb=_0x32fedb||0xc8;return function(_0x50905d){if(_0x50905d){return _0x335cbc[_0x8e28('0x1d')](_0x32fedb)[_0x8e28('0x1e')](_0x50905d);}};}function respondWithFilteredResult(_0x4bb5d7,_0x438a20){return function(_0x3fb57a){if(_0x3fb57a){var _0xcba67e=typeof _0x438a20[_0x8e28('0x1f')]==='undefined'&&typeof _0x438a20[_0x8e28('0x20')]===_0x8e28('0x21');var _0x1a3218=_0x3fb57a['count'];var _0x27b278=_0xcba67e?0x0:_0x438a20['offset'];var _0x562797=_0xcba67e?_0x3fb57a['count']:_0x438a20[_0x8e28('0x1f')]+_0x438a20[_0x8e28('0x20')];var _0x1fce61;if(_0x562797>=_0x1a3218){_0x562797=_0x1a3218;_0x1fce61=0xc8;}else{_0x1fce61=0xce;}_0x4bb5d7['status'](_0x1fce61);return _0x4bb5d7[_0x8e28('0x22')](_0x8e28('0x23'),_0x27b278+'-'+_0x562797+'/'+_0x1a3218)[_0x8e28('0x1e')](_0x3fb57a);}return null;};}function patchUpdates(_0x7e0b0b){return function(_0x6f9270){try{jsonpatch[_0x8e28('0x24')](_0x6f9270,_0x7e0b0b,!![]);}catch(_0x2abee7){return BPromise['reject'](_0x2abee7);}return _0x6f9270[_0x8e28('0x25')]();};}function saveUpdates(_0x270011,_0xc4ef24){return function(_0x355e89){if(_0x355e89){return _0x355e89[_0x8e28('0x26')](_0x270011)[_0x8e28('0x27')](function(_0x133be9){return _0x133be9;});}return null;};}function removeEntity(_0x22bedc,_0x4f44ed){return function(_0x3f61fe){if(_0x3f61fe){return _0x3f61fe['destroy']()[_0x8e28('0x27')](function(){_0x22bedc[_0x8e28('0x1d')](0xcc)[_0x8e28('0x1c')]();});}};}function handleEntityNotFound(_0x363ca8,_0x3d1c8d){return function(_0x231d2a){if(!_0x231d2a){_0x363ca8['sendStatus'](0x194);}return _0x231d2a;};}function handleError(_0x18931e,_0x2953c3){_0x2953c3=_0x2953c3||0x1f4;return function(_0x428639){logger[_0x8e28('0x28')](_0x428639[_0x8e28('0x29')]);if(_0x428639[_0x8e28('0x2a')]){delete _0x428639[_0x8e28('0x2a')];}_0x18931e[_0x8e28('0x1d')](_0x2953c3)['send'](_0x428639);};}exports[_0x8e28('0x2b')]=function(_0xf9dfdd,_0x1a21a5){var _0x410699={},_0x3056d9={},_0x586912={'count':0x0,'rows':[]};var _0x36c562=_['map'](db[_0x8e28('0x2c')][_0x8e28('0x2d')],function(_0x89fbbd){return{'name':_0x89fbbd[_0x8e28('0x2e')],'type':_0x89fbbd['type'][_0x8e28('0x2f')]};});_0x3056d9[_0x8e28('0x30')]=_['map'](_0x36c562,_0x8e28('0x2a'));_0x3056d9[_0x8e28('0x31')]=_[_0x8e28('0x32')](_0xf9dfdd[_0x8e28('0x31')]);_0x3056d9[_0x8e28('0x33')]=_[_0x8e28('0x34')](_0x3056d9[_0x8e28('0x30')],_0x3056d9[_0x8e28('0x31')]);_0x410699[_0x8e28('0x35')]=_[_0x8e28('0x34')](_0x3056d9[_0x8e28('0x30')],qs['fields'](_0xf9dfdd[_0x8e28('0x31')][_0x8e28('0x36')]));_0x410699['attributes']=_0x410699[_0x8e28('0x35')][_0x8e28('0x37')]?_0x410699[_0x8e28('0x35')]:_0x3056d9[_0x8e28('0x30')];if(!_0xf9dfdd[_0x8e28('0x31')]['hasOwnProperty'](_0x8e28('0x38'))){_0x410699[_0x8e28('0x20')]=qs['limit'](_0xf9dfdd[_0x8e28('0x31')][_0x8e28('0x20')]);_0x410699[_0x8e28('0x1f')]=qs[_0x8e28('0x1f')](_0xf9dfdd[_0x8e28('0x31')][_0x8e28('0x1f')]);}_0x410699[_0x8e28('0x39')]=qs[_0x8e28('0x3a')](_0xf9dfdd[_0x8e28('0x31')][_0x8e28('0x3a')]);_0x410699[_0x8e28('0x3b')]=qs['filters'](_[_0x8e28('0x3c')](_0xf9dfdd[_0x8e28('0x31')],_0x3056d9[_0x8e28('0x33')]),_0x36c562);if(_0xf9dfdd['query'][_0x8e28('0x3d')]){_0x410699[_0x8e28('0x3b')]=_[_0x8e28('0x3e')](_0x410699[_0x8e28('0x3b')],{'$or':_[_0x8e28('0x3f')](_0x36c562,function(_0x428dd4){if(_0x428dd4[_0x8e28('0x40')]!==_0x8e28('0x41')){var _0x5f5091={};_0x5f5091[_0x428dd4[_0x8e28('0x2a')]]={'$like':'%'+_0xf9dfdd[_0x8e28('0x31')][_0x8e28('0x3d')]+'%'};return _0x5f5091;}})});}_0x410699=_[_0x8e28('0x3e')]({},_0x410699,_0xf9dfdd[_0x8e28('0x42')]);var _0xe190c5={'where':_0x410699[_0x8e28('0x3b')]};return db[_0x8e28('0x2c')]['count'](_0xe190c5)[_0x8e28('0x27')](function(_0x4e824b){_0x586912[_0x8e28('0x43')]=_0x4e824b;if(_0xf9dfdd[_0x8e28('0x31')][_0x8e28('0x44')]){_0x410699[_0x8e28('0x45')]=[{'all':!![]}];}return db[_0x8e28('0x2c')][_0x8e28('0x46')](_0x410699);})['then'](function(_0x74937e){_0x586912[_0x8e28('0x47')]=_0x74937e;return _0x586912;})[_0x8e28('0x27')](respondWithFilteredResult(_0x1a21a5,_0x410699))[_0x8e28('0x48')](handleError(_0x1a21a5,null));};exports['show']=function(_0x2ce39e,_0x1a2c79){var _0x45229c={'raw':!![],'where':{'id':_0x2ce39e['params']['id']}},_0x5b38c1={};_0x5b38c1['model']=_[_0x8e28('0x32')](db['ZohoField']['rawAttributes']);_0x5b38c1[_0x8e28('0x31')]=_[_0x8e28('0x32')](_0x2ce39e[_0x8e28('0x31')]);_0x5b38c1[_0x8e28('0x33')]=_[_0x8e28('0x34')](_0x5b38c1[_0x8e28('0x30')],_0x5b38c1[_0x8e28('0x31')]);_0x45229c[_0x8e28('0x35')]=_[_0x8e28('0x34')](_0x5b38c1[_0x8e28('0x30')],qs[_0x8e28('0x36')](_0x2ce39e[_0x8e28('0x31')][_0x8e28('0x36')]));_0x45229c[_0x8e28('0x35')]=_0x45229c[_0x8e28('0x35')][_0x8e28('0x37')]?_0x45229c['attributes']:_0x5b38c1[_0x8e28('0x30')];if(_0x2ce39e[_0x8e28('0x31')][_0x8e28('0x44')]){_0x45229c['include']=[{'all':!![]}];}_0x45229c=_[_0x8e28('0x3e')]({},_0x45229c,_0x2ce39e[_0x8e28('0x42')]);return db[_0x8e28('0x2c')][_0x8e28('0x49')](_0x45229c)[_0x8e28('0x27')](handleEntityNotFound(_0x1a2c79,null))[_0x8e28('0x27')](respondWithResult(_0x1a2c79,null))[_0x8e28('0x48')](handleError(_0x1a2c79,null));};exports['create']=function(_0x2fb6bb,_0x555001){return db[_0x8e28('0x2c')][_0x8e28('0x4a')](_0x2fb6bb[_0x8e28('0x4b')],{})[_0x8e28('0x27')](respondWithResult(_0x555001,0xc9))[_0x8e28('0x48')](handleError(_0x555001,null));};exports[_0x8e28('0x26')]=function(_0xc2b8c3,_0x5da858){if(_0xc2b8c3[_0x8e28('0x4b')]['id']){delete _0xc2b8c3['body']['id'];}return db['ZohoField'][_0x8e28('0x49')]({'where':{'id':_0xc2b8c3[_0x8e28('0x4c')]['id']}})[_0x8e28('0x27')](handleEntityNotFound(_0x5da858,null))['then'](saveUpdates(_0xc2b8c3['body'],null))[_0x8e28('0x27')](respondWithResult(_0x5da858,null))[_0x8e28('0x48')](handleError(_0x5da858,null));};exports[_0x8e28('0x4d')]=function(_0x4bd2f2,_0xcfe5e6){return db[_0x8e28('0x2c')][_0x8e28('0x49')]({'where':{'id':_0x4bd2f2[_0x8e28('0x4c')]['id']}})[_0x8e28('0x27')](handleEntityNotFound(_0xcfe5e6,null))[_0x8e28('0x27')](removeEntity(_0xcfe5e6,null))['catch'](handleError(_0xcfe5e6,null));}; \ No newline at end of file +var _0xd17f=['query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','options','includeAll','include','rows','catch','show','params','length','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','ZohoField','rawAttributes','key','model','map'];(function(_0x2f42b0,_0x4e46e7){var _0x3f5df6=function(_0x2e7e9e){while(--_0x2e7e9e){_0x2f42b0['push'](_0x2f42b0['shift']());}};_0x3f5df6(++_0x4e46e7);}(_0xd17f,0xb1));var _0xfd17=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xd17f[_0x2dafbe];return _0x58a45a;};'use strict';var emlformat=require(_0xfd17('0x0'));var rimraf=require(_0xfd17('0x1'));var zipdir=require(_0xfd17('0x2'));var jsonpatch=require(_0xfd17('0x3'));var rp=require(_0xfd17('0x4'));var moment=require('moment');var BPromise=require(_0xfd17('0x5'));var Mustache=require(_0xfd17('0x6'));var util=require('util');var path=require(_0xfd17('0x7'));var sox=require('sox');var csv=require(_0xfd17('0x8'));var ejs=require(_0xfd17('0x9'));var fs=require('fs');var fs_extra=require(_0xfd17('0xa'));var _=require(_0xfd17('0xb'));var squel=require(_0xfd17('0xc'));var crypto=require(_0xfd17('0xd'));var jsforce=require(_0xfd17('0xe'));var deskjs=require(_0xfd17('0xf'));var toCsv=require(_0xfd17('0x8'));var querystring=require(_0xfd17('0x10'));var Papa=require(_0xfd17('0x11'));var Redis=require(_0xfd17('0x12'));var authService=require(_0xfd17('0x13'));var qs=require(_0xfd17('0x14'));var as=require(_0xfd17('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xfd17('0x16'));var utils=require(_0xfd17('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xfd17('0x18'));var db=require(_0xfd17('0x19'))['db'];function respondWithStatusCode(_0x4dc573,_0x2517a1){_0x2517a1=_0x2517a1||0xcc;return function(_0x44a986){if(_0x44a986){return _0x4dc573[_0xfd17('0x1a')](_0x2517a1);}return _0x4dc573['status'](_0x2517a1)[_0xfd17('0x1b')]();};}function respondWithResult(_0x4d08fa,_0x462aee){_0x462aee=_0x462aee||0xc8;return function(_0x24636f){if(_0x24636f){return _0x4d08fa[_0xfd17('0x1c')](_0x462aee)[_0xfd17('0x1d')](_0x24636f);}};}function respondWithFilteredResult(_0x37328a,_0x428f8f){return function(_0x46ed90){if(_0x46ed90){var _0x1e1f29=typeof _0x428f8f[_0xfd17('0x1e')]===_0xfd17('0x1f')&&typeof _0x428f8f[_0xfd17('0x20')]==='undefined';var _0x12ac50=_0x46ed90[_0xfd17('0x21')];var _0x33bbf9=_0x1e1f29?0x0:_0x428f8f[_0xfd17('0x1e')];var _0x4f4cde=_0x1e1f29?_0x46ed90[_0xfd17('0x21')]:_0x428f8f[_0xfd17('0x1e')]+_0x428f8f[_0xfd17('0x20')];var _0x29307a;if(_0x4f4cde>=_0x12ac50){_0x4f4cde=_0x12ac50;_0x29307a=0xc8;}else{_0x29307a=0xce;}_0x37328a[_0xfd17('0x1c')](_0x29307a);return _0x37328a['set'](_0xfd17('0x22'),_0x33bbf9+'-'+_0x4f4cde+'/'+_0x12ac50)[_0xfd17('0x1d')](_0x46ed90);}return null;};}function patchUpdates(_0x55e86c){return function(_0x2f4fb1){try{jsonpatch[_0xfd17('0x23')](_0x2f4fb1,_0x55e86c,!![]);}catch(_0x4a3028){return BPromise[_0xfd17('0x24')](_0x4a3028);}return _0x2f4fb1[_0xfd17('0x25')]();};}function saveUpdates(_0x2c375e,_0x4a5158){return function(_0x4d7785){if(_0x4d7785){return _0x4d7785[_0xfd17('0x26')](_0x2c375e)[_0xfd17('0x27')](function(_0x10e40e){return _0x10e40e;});}return null;};}function removeEntity(_0x596f97,_0x56f5fb){return function(_0x44053a){if(_0x44053a){return _0x44053a[_0xfd17('0x28')]()['then'](function(){_0x596f97['status'](0xcc)[_0xfd17('0x1b')]();});}};}function handleEntityNotFound(_0x318814,_0xa405c8){return function(_0x4043d9){if(!_0x4043d9){_0x318814[_0xfd17('0x1a')](0x194);}return _0x4043d9;};}function handleError(_0x1bb298,_0x24ac3b){_0x24ac3b=_0x24ac3b||0x1f4;return function(_0xfeb40){logger[_0xfd17('0x29')](_0xfeb40[_0xfd17('0x2a')]);if(_0xfeb40[_0xfd17('0x2b')]){delete _0xfeb40['name'];}_0x1bb298[_0xfd17('0x1c')](_0x24ac3b)[_0xfd17('0x2c')](_0xfeb40);};}exports[_0xfd17('0x2d')]=function(_0x5b513c,_0xaa7277){var _0x4114f2={},_0x273008={},_0x48699d={'count':0x0,'rows':[]};var _0x57b44a=_['map'](db[_0xfd17('0x2e')][_0xfd17('0x2f')],function(_0x52f57d){return{'name':_0x52f57d['fieldName'],'type':_0x52f57d['type'][_0xfd17('0x30')]};});_0x273008[_0xfd17('0x31')]=_[_0xfd17('0x32')](_0x57b44a,_0xfd17('0x2b'));_0x273008[_0xfd17('0x33')]=_[_0xfd17('0x34')](_0x5b513c['query']);_0x273008[_0xfd17('0x35')]=_[_0xfd17('0x36')](_0x273008[_0xfd17('0x31')],_0x273008[_0xfd17('0x33')]);_0x4114f2[_0xfd17('0x37')]=_[_0xfd17('0x36')](_0x273008[_0xfd17('0x31')],qs[_0xfd17('0x38')](_0x5b513c[_0xfd17('0x33')][_0xfd17('0x38')]));_0x4114f2['attributes']=_0x4114f2['attributes']['length']?_0x4114f2['attributes']:_0x273008['model'];if(!_0x5b513c[_0xfd17('0x33')][_0xfd17('0x39')](_0xfd17('0x3a'))){_0x4114f2[_0xfd17('0x20')]=qs[_0xfd17('0x20')](_0x5b513c['query'][_0xfd17('0x20')]);_0x4114f2[_0xfd17('0x1e')]=qs['offset'](_0x5b513c[_0xfd17('0x33')][_0xfd17('0x1e')]);}_0x4114f2[_0xfd17('0x3b')]=qs[_0xfd17('0x3c')](_0x5b513c[_0xfd17('0x33')][_0xfd17('0x3c')]);_0x4114f2[_0xfd17('0x3d')]=qs[_0xfd17('0x35')](_['pick'](_0x5b513c[_0xfd17('0x33')],_0x273008[_0xfd17('0x35')]),_0x57b44a);if(_0x5b513c[_0xfd17('0x33')][_0xfd17('0x3e')]){_0x4114f2[_0xfd17('0x3d')]=_[_0xfd17('0x3f')](_0x4114f2['where'],{'$or':_[_0xfd17('0x32')](_0x57b44a,function(_0x11818b){if(_0x11818b[_0xfd17('0x40')]!=='VIRTUAL'){var _0x2cfb63={};_0x2cfb63[_0x11818b['name']]={'$like':'%'+_0x5b513c[_0xfd17('0x33')][_0xfd17('0x3e')]+'%'};return _0x2cfb63;}})});}_0x4114f2=_[_0xfd17('0x3f')]({},_0x4114f2,_0x5b513c[_0xfd17('0x41')]);var _0xad06f={'where':_0x4114f2[_0xfd17('0x3d')]};return db[_0xfd17('0x2e')][_0xfd17('0x21')](_0xad06f)[_0xfd17('0x27')](function(_0x3bca29){_0x48699d[_0xfd17('0x21')]=_0x3bca29;if(_0x5b513c['query'][_0xfd17('0x42')]){_0x4114f2[_0xfd17('0x43')]=[{'all':!![]}];}return db[_0xfd17('0x2e')]['findAll'](_0x4114f2);})[_0xfd17('0x27')](function(_0x11b0a8){_0x48699d[_0xfd17('0x44')]=_0x11b0a8;return _0x48699d;})[_0xfd17('0x27')](respondWithFilteredResult(_0xaa7277,_0x4114f2))[_0xfd17('0x45')](handleError(_0xaa7277,null));};exports[_0xfd17('0x46')]=function(_0x198d9f,_0x44e016){var _0x2e75fb={'raw':!![],'where':{'id':_0x198d9f[_0xfd17('0x47')]['id']}},_0x424dc2={};_0x424dc2[_0xfd17('0x31')]=_[_0xfd17('0x34')](db[_0xfd17('0x2e')][_0xfd17('0x2f')]);_0x424dc2['query']=_[_0xfd17('0x34')](_0x198d9f[_0xfd17('0x33')]);_0x424dc2[_0xfd17('0x35')]=_[_0xfd17('0x36')](_0x424dc2[_0xfd17('0x31')],_0x424dc2[_0xfd17('0x33')]);_0x2e75fb[_0xfd17('0x37')]=_[_0xfd17('0x36')](_0x424dc2['model'],qs[_0xfd17('0x38')](_0x198d9f['query']['fields']));_0x2e75fb[_0xfd17('0x37')]=_0x2e75fb['attributes'][_0xfd17('0x48')]?_0x2e75fb[_0xfd17('0x37')]:_0x424dc2['model'];if(_0x198d9f['query'][_0xfd17('0x42')]){_0x2e75fb[_0xfd17('0x43')]=[{'all':!![]}];}_0x2e75fb=_[_0xfd17('0x3f')]({},_0x2e75fb,_0x198d9f[_0xfd17('0x41')]);return db[_0xfd17('0x2e')][_0xfd17('0x49')](_0x2e75fb)['then'](handleEntityNotFound(_0x44e016,null))['then'](respondWithResult(_0x44e016,null))[_0xfd17('0x45')](handleError(_0x44e016,null));};exports[_0xfd17('0x4a')]=function(_0x50944c,_0x546c66){return db[_0xfd17('0x2e')][_0xfd17('0x4a')](_0x50944c['body'],{})[_0xfd17('0x27')](respondWithResult(_0x546c66,0xc9))[_0xfd17('0x45')](handleError(_0x546c66,null));};exports[_0xfd17('0x26')]=function(_0x48aa7f,_0x11c0ad){if(_0x48aa7f[_0xfd17('0x4b')]['id']){delete _0x48aa7f['body']['id'];}return db[_0xfd17('0x2e')][_0xfd17('0x49')]({'where':{'id':_0x48aa7f[_0xfd17('0x47')]['id']}})['then'](handleEntityNotFound(_0x11c0ad,null))[_0xfd17('0x27')](saveUpdates(_0x48aa7f[_0xfd17('0x4b')],null))['then'](respondWithResult(_0x11c0ad,null))[_0xfd17('0x45')](handleError(_0x11c0ad,null));};exports[_0xfd17('0x28')]=function(_0x21e90f,_0x287ef9){return db[_0xfd17('0x2e')]['find']({'where':{'id':_0x21e90f[_0xfd17('0x47')]['id']}})[_0xfd17('0x27')](handleEntityNotFound(_0x287ef9,null))[_0xfd17('0x27')](removeEntity(_0x287ef9,null))['catch'](handleError(_0x287ef9,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index 7403d0a..7bcd400 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 _0x90b1=['FieldId','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','define','ZohoField','int_zoho_fields','zoho_unique_index','idField'];(function(_0x21f4f5,_0xd74958){var _0x11c320=function(_0x5a85f6){while(--_0x5a85f6){_0x21f4f5['push'](_0x21f4f5['shift']());}};_0x11c320(++_0xd74958);}(_0x90b1,0x1bb));var _0x190b=function(_0x43d457,_0x1ab41a){_0x43d457=_0x43d457-0x0;var _0x5e24d5=_0x90b1[_0x43d457];return _0x5e24d5;};'use strict';var _=require(_0x190b('0x0'));var util=require(_0x190b('0x1'));var logger=require(_0x190b('0x2'))('api');var moment=require('moment');var BPromise=require(_0x190b('0x3'));var rp=require(_0x190b('0x4'));var fs=require('fs');var path=require(_0x190b('0x5'));var rimraf=require(_0x190b('0x6'));var config=require('../../config/environment');var attributes=require('./intZohoField.attributes');module['exports']=function(_0x5da9c1,_0x27ff8c){return _0x5da9c1[_0x190b('0x7')](_0x190b('0x8'),attributes,{'tableName':_0x190b('0x9'),'paranoid':![],'indexes':[{'name':_0x190b('0xa'),'fields':[_0x190b('0xb'),_0x190b('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7278=['idField','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./intZohoField.attributes','exports','define','ZohoField','int_zoho_fields','zoho_unique_index'];(function(_0x366e78,_0x25d5bb){var _0x51bef1=function(_0x53bde8){while(--_0x53bde8){_0x366e78['push'](_0x366e78['shift']());}};_0x51bef1(++_0x25d5bb);}(_0x7278,0x161));var _0x8727=function(_0x3898e6,_0x1c5c88){_0x3898e6=_0x3898e6-0x0;var _0x492ae7=_0x7278[_0x3898e6];return _0x492ae7;};'use strict';var _=require(_0x8727('0x0'));var util=require(_0x8727('0x1'));var logger=require(_0x8727('0x2'))(_0x8727('0x3'));var moment=require(_0x8727('0x4'));var BPromise=require('bluebird');var rp=require(_0x8727('0x5'));var fs=require('fs');var path=require(_0x8727('0x6'));var rimraf=require(_0x8727('0x7'));var config=require(_0x8727('0x8'));var attributes=require(_0x8727('0x9'));module[_0x8727('0xa')]=function(_0x180b71,_0x5549d5){return _0x180b71[_0x8727('0xb')](_0x8727('0xc'),attributes,{'tableName':_0x8727('0xd'),'paranoid':![],'indexes':[{'name':_0x8727('0xe'),'fields':[_0x8727('0xf'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.rpc.js b/server/api/intZohoField/intZohoField.rpc.js index 84c7558..1a5e90c 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 _0x791d=['lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','ZohoField,\x20%s,\x20%s','request\x20sent','ZohoField,\x20%s,\x20%s,\x20%s','error','code','message','result'];(function(_0x98f6c3,_0x28639f){var _0x29238c=function(_0x585647){while(--_0x585647){_0x98f6c3['push'](_0x98f6c3['shift']());}};_0x29238c(++_0x28639f);}(_0x791d,0x1ee));var _0xd791=function(_0x5ed95e,_0x59ee6a){_0x5ed95e=_0x5ed95e-0x0;var _0x5d82be=_0x791d[_0x5ed95e];return _0x5d82be;};'use strict';var _=require(_0xd791('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xd791('0x1'));var rs=require(_0xd791('0x2'));var fs=require('fs');var Redis=require(_0xd791('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xd791('0x4'));var logger=require(_0xd791('0x5'))(_0xd791('0x6'));var config=require(_0xd791('0x7'));var jayson=require(_0xd791('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1d16fc,_0x2122af,_0x2acbf9){return new BPromise(function(_0xbce1d,_0x1c1821){return client[_0xd791('0x9')](_0x1d16fc,_0x2acbf9)[_0xd791('0xa')](function(_0xf2daaa){logger[_0xd791('0xb')](_0xd791('0xc'),_0x2122af,_0xd791('0xd'));logger['debug'](_0xd791('0xe'),_0x2122af,_0xd791('0xd'),JSON['stringify'](_0xf2daaa));if(_0xf2daaa[_0xd791('0xf')]){if(_0xf2daaa[_0xd791('0xf')][_0xd791('0x10')]===0x1f4){logger['error'](_0xd791('0xc'),_0x2122af,_0xf2daaa['error']['message']);return _0x1c1821(_0xf2daaa[_0xd791('0xf')][_0xd791('0x11')]);}logger[_0xd791('0xf')]('ZohoField,\x20%s,\x20%s',_0x2122af,_0xf2daaa[_0xd791('0xf')][_0xd791('0x11')]);return _0xbce1d(_0xf2daaa[_0xd791('0xf')]['message']);}else{logger['info'](_0xd791('0xc'),_0x2122af,'request\x20sent');_0xbce1d(_0xf2daaa[_0xd791('0x12')]['message']);}})['catch'](function(_0x3116f6){logger[_0xd791('0xf')](_0xd791('0xc'),_0x2122af,_0x3116f6);_0x1c1821(_0x3116f6);});});} \ No newline at end of file +var _0x4056=['../../config/environment','jayson/promise','client','request','then','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','randomstring','../../mysqldb','../../config/logger'];(function(_0x2ab94e,_0x3a0a4f){var _0x1c268e=function(_0x4dc2d7){while(--_0x4dc2d7){_0x2ab94e['push'](_0x2ab94e['shift']());}};_0x1c268e(++_0x3a0a4f);}(_0x4056,0x12c));var _0x6405=function(_0x451e96,_0x2c8989){_0x451e96=_0x451e96-0x0;var _0x227c95=_0x4056[_0x451e96];return _0x227c95;};'use strict';var _=require(_0x6405('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x6405('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6405('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x6405('0x3'))('rpc');var config=require(_0x6405('0x4'));var jayson=require(_0x6405('0x5'));var client=jayson[_0x6405('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x32b76d,_0xb09679,_0xbfbcba){return new BPromise(function(_0x3572ef,_0x204d49){return client[_0x6405('0x7')](_0x32b76d,_0xbfbcba)[_0x6405('0x8')](function(_0x5964b9){logger[_0x6405('0x9')](_0x6405('0xa'),_0xb09679,_0x6405('0xb'));logger[_0x6405('0xc')](_0x6405('0xd'),_0xb09679,_0x6405('0xb'),JSON[_0x6405('0xe')](_0x5964b9));if(_0x5964b9[_0x6405('0xf')]){if(_0x5964b9[_0x6405('0xf')]['code']===0x1f4){logger[_0x6405('0xf')](_0x6405('0xa'),_0xb09679,_0x5964b9['error'][_0x6405('0x10')]);return _0x204d49(_0x5964b9[_0x6405('0xf')][_0x6405('0x10')]);}logger[_0x6405('0xf')](_0x6405('0xa'),_0xb09679,_0x5964b9[_0x6405('0xf')][_0x6405('0x10')]);return _0x3572ef(_0x5964b9[_0x6405('0xf')]['message']);}else{logger['info']('ZohoField,\x20%s,\x20%s',_0xb09679,_0x6405('0xb'));_0x3572ef(_0x5964b9[_0x6405('0x11')][_0x6405('0x10')]);}})[_0x6405('0x12')](function(_0x3b5886){logger[_0x6405('0xf')]('ZohoField,\x20%s,\x20%s',_0xb09679,_0x3b5886);_0x204d49(_0x3b5886);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index fce8315..8972966 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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x1cd2c9,_0x257e0e){var _0x254036=function(_0x1dabb5){while(--_0x1dabb5){_0x1cd2c9['push'](_0x1cd2c9['shift']());}};_0x254036(++_0x257e0e);}(_0xe706,0xa3));var _0x6e70=function(_0x19b56f,_0x4cbbd9){_0x19b56f=_0x19b56f-0x0;var _0x1e69f9=_0xe706[_0x19b56f];return _0x1e69f9;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x4a93e9,_0x5b569f){var _0x4b3ba7=function(_0x483c02){while(--_0x483c02){_0x4a93e9['push'](_0x4a93e9['shift']());}};_0x4b3ba7(++_0x5b569f);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index 3819cb2..2c0530d 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 _0x4600=['BOOLEAN','state','sequelize','exports','STRING','unique_name_and_version','app.js'];(function(_0x2ca540,_0x46d034){var _0x1d632c=function(_0x1f07b7){while(--_0x1f07b7){_0x2ca540['push'](_0x2ca540['shift']());}};_0x1d632c(++_0x46d034);}(_0x4600,0x191));var _0x0460=function(_0x4e0a01,_0x7d15ff){_0x4e0a01=_0x4e0a01-0x0;var _0x1aa533=_0x4600[_0x4e0a01];return _0x1aa533;};'use strict';var Sequelize=require(_0x0460('0x0'));module[_0x0460('0x1')]={'name':{'type':Sequelize[_0x0460('0x2')],'allowNull':![],'unique':_0x0460('0x3')},'version':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x0460('0x3')},'main':{'type':Sequelize[_0x0460('0x2')],'defaultValue':_0x0460('0x4')},'filename':{'type':Sequelize[_0x0460('0x2')]},'path':{'type':Sequelize[_0x0460('0x2')]},'type':{'type':Sequelize[_0x0460('0x2')]},'size':{'type':Sequelize['INTEGER']},'active':{'type':Sequelize[_0x0460('0x5')],'defaultValue':![]},'author':{'type':Sequelize['STRING']},'logo':{'type':Sequelize['STRING']},'state':{'type':Sequelize[_0x0460('0x2')],'unique':_0x0460('0x6')},'description':{'type':Sequelize[_0x0460('0x2')]},'title':{'type':Sequelize[_0x0460('0x2')]},'remoteUri':{'type':Sequelize[_0x0460('0x2')]},'link':{'type':Sequelize[_0x0460('0x2')],'defaultValue':'#'}}; \ No newline at end of file +var _0xefe2=['sequelize','exports','unique_name_and_version','STRING','INTEGER','BOOLEAN','state'];(function(_0x522ae8,_0x3b637e){var _0x3189b9=function(_0x3115d4){while(--_0x3115d4){_0x522ae8['push'](_0x522ae8['shift']());}};_0x3189b9(++_0x3b637e);}(_0xefe2,0xd9));var _0x2efe=function(_0x24a26b,_0x1af122){_0x24a26b=_0x24a26b-0x0;var _0x58edcb=_0xefe2[_0x24a26b];return _0x58edcb;};'use strict';var Sequelize=require(_0x2efe('0x0'));module[_0x2efe('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x2efe('0x2')},'version':{'type':Sequelize[_0x2efe('0x3')],'allowNull':![],'unique':'unique_name_and_version'},'main':{'type':Sequelize[_0x2efe('0x3')],'defaultValue':'app.js'},'filename':{'type':Sequelize[_0x2efe('0x3')]},'path':{'type':Sequelize[_0x2efe('0x3')]},'type':{'type':Sequelize[_0x2efe('0x3')]},'size':{'type':Sequelize[_0x2efe('0x4')]},'active':{'type':Sequelize[_0x2efe('0x5')],'defaultValue':![]},'author':{'type':Sequelize['STRING']},'logo':{'type':Sequelize[_0x2efe('0x3')]},'state':{'type':Sequelize[_0x2efe('0x3')],'unique':_0x2efe('0x6')},'description':{'type':Sequelize[_0x2efe('0x3')]},'title':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x2efe('0x3')]},'link':{'type':Sequelize[_0x2efe('0x3')],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index 16b97de..20e3961 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 _0x9f0e=['querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','update','then','destroy','end','error','name','send','index','map','Integration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','catch','options','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','lodash','squel','crypto','desk.js'];(function(_0x5d0f4b,_0x34ef4b){var _0x4266c8=function(_0x25acc4){while(--_0x25acc4){_0x5d0f4b['push'](_0x5d0f4b['shift']());}};_0x4266c8(++_0x34ef4b);}(_0x9f0e,0x116));var _0xe9f0=function(_0x2d99ca,_0x4e277e){_0x2d99ca=_0x2d99ca-0x0;var _0x40e8c5=_0x9f0e[_0x2d99ca];return _0x40e8c5;};'use strict';var emlformat=require(_0xe9f0('0x0'));var rimraf=require(_0xe9f0('0x1'));var zipdir=require(_0xe9f0('0x2'));var jsonpatch=require(_0xe9f0('0x3'));var rp=require(_0xe9f0('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xe9f0('0x5'));var util=require(_0xe9f0('0x6'));var path=require(_0xe9f0('0x7'));var sox=require(_0xe9f0('0x8'));var csv=require(_0xe9f0('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe9f0('0xa'));var squel=require(_0xe9f0('0xb'));var crypto=require(_0xe9f0('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xe9f0('0xd'));var toCsv=require(_0xe9f0('0x9'));var querystring=require(_0xe9f0('0xe'));var Papa=require(_0xe9f0('0xf'));var Redis=require(_0xe9f0('0x10'));var authService=require(_0xe9f0('0x11'));var qs=require(_0xe9f0('0x12'));var as=require(_0xe9f0('0x13'));var hardwareService=require(_0xe9f0('0x14'));var logger=require('../../config/logger')(_0xe9f0('0x15'));var utils=require(_0xe9f0('0x16'));var config=require(_0xe9f0('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xe9f0('0x18'))['db'];function respondWithStatusCode(_0x586763,_0x367545){_0x367545=_0x367545||0xcc;return function(_0xd82420){if(_0xd82420){return _0x586763[_0xe9f0('0x19')](_0x367545);}return _0x586763[_0xe9f0('0x1a')](_0x367545)['end']();};}function respondWithResult(_0x2cf75d,_0x5a10c6){_0x5a10c6=_0x5a10c6||0xc8;return function(_0x1e3ba8){if(_0x1e3ba8){return _0x2cf75d[_0xe9f0('0x1a')](_0x5a10c6)[_0xe9f0('0x1b')](_0x1e3ba8);}};}function respondWithFilteredResult(_0x59320d,_0x28bfac){return function(_0x33e9e4){if(_0x33e9e4){var _0x2e68ef=typeof _0x28bfac['offset']===_0xe9f0('0x1c')&&typeof _0x28bfac[_0xe9f0('0x1d')]===_0xe9f0('0x1c');var _0xd71ac8=_0x33e9e4[_0xe9f0('0x1e')];var _0x2ab12b=_0x2e68ef?0x0:_0x28bfac[_0xe9f0('0x1f')];var _0x59bf5a=_0x2e68ef?_0x33e9e4[_0xe9f0('0x1e')]:_0x28bfac[_0xe9f0('0x1f')]+_0x28bfac[_0xe9f0('0x1d')];var _0x5c4182;if(_0x59bf5a>=_0xd71ac8){_0x59bf5a=_0xd71ac8;_0x5c4182=0xc8;}else{_0x5c4182=0xce;}_0x59320d[_0xe9f0('0x1a')](_0x5c4182);return _0x59320d[_0xe9f0('0x20')](_0xe9f0('0x21'),_0x2ab12b+'-'+_0x59bf5a+'/'+_0xd71ac8)[_0xe9f0('0x1b')](_0x33e9e4);}return null;};}function patchUpdates(_0x5ba788){return function(_0x33f143){try{jsonpatch[_0xe9f0('0x22')](_0x33f143,_0x5ba788,!![]);}catch(_0x583687){return BPromise['reject'](_0x583687);}return _0x33f143['save']();};}function saveUpdates(_0x12fe9f,_0xa1ddc){return function(_0x1211ae){if(_0x1211ae){return _0x1211ae[_0xe9f0('0x23')](_0x12fe9f)[_0xe9f0('0x24')](function(_0x4a5c27){return _0x4a5c27;});}return null;};}function removeEntity(_0x229fe0,_0x38b7ee){return function(_0x437d43){if(_0x437d43){return _0x437d43[_0xe9f0('0x25')]()[_0xe9f0('0x24')](function(){_0x229fe0[_0xe9f0('0x1a')](0xcc)[_0xe9f0('0x26')]();});}};}function handleEntityNotFound(_0x1321bb,_0x3c4ba9){return function(_0x3fce54){if(!_0x3fce54){_0x1321bb['sendStatus'](0x194);}return _0x3fce54;};}function handleError(_0x371095,_0x27541f){_0x27541f=_0x27541f||0x1f4;return function(_0x2ddfba){logger[_0xe9f0('0x27')](_0x2ddfba['stack']);if(_0x2ddfba[_0xe9f0('0x28')]){delete _0x2ddfba[_0xe9f0('0x28')];}_0x371095[_0xe9f0('0x1a')](_0x27541f)[_0xe9f0('0x29')](_0x2ddfba);};}exports[_0xe9f0('0x2a')]=function(_0x5457f6,_0x130f96){var _0xdc16bc={},_0x44fb5b={},_0xab3d81={'count':0x0,'rows':[]};var _0xa27c84=_[_0xe9f0('0x2b')](db[_0xe9f0('0x2c')][_0xe9f0('0x2d')],function(_0x2b6503){return{'name':_0x2b6503[_0xe9f0('0x2e')],'type':_0x2b6503[_0xe9f0('0x2f')][_0xe9f0('0x30')]};});_0x44fb5b[_0xe9f0('0x31')]=_[_0xe9f0('0x2b')](_0xa27c84,_0xe9f0('0x28'));_0x44fb5b[_0xe9f0('0x32')]=_[_0xe9f0('0x33')](_0x5457f6[_0xe9f0('0x32')]);_0x44fb5b[_0xe9f0('0x34')]=_[_0xe9f0('0x35')](_0x44fb5b[_0xe9f0('0x31')],_0x44fb5b[_0xe9f0('0x32')]);_0xdc16bc[_0xe9f0('0x36')]=_[_0xe9f0('0x35')](_0x44fb5b['model'],qs['fields'](_0x5457f6['query'][_0xe9f0('0x37')]));_0xdc16bc['attributes']=_0xdc16bc[_0xe9f0('0x36')][_0xe9f0('0x38')]?_0xdc16bc['attributes']:_0x44fb5b[_0xe9f0('0x31')];if(!_0x5457f6['query']['hasOwnProperty']('nolimit')){_0xdc16bc[_0xe9f0('0x1d')]=qs[_0xe9f0('0x1d')](_0x5457f6['query'][_0xe9f0('0x1d')]);_0xdc16bc[_0xe9f0('0x1f')]=qs[_0xe9f0('0x1f')](_0x5457f6['query']['offset']);}_0xdc16bc[_0xe9f0('0x39')]=qs[_0xe9f0('0x3a')](_0x5457f6[_0xe9f0('0x32')]['sort']);_0xdc16bc[_0xe9f0('0x3b')]=qs[_0xe9f0('0x34')](_[_0xe9f0('0x3c')](_0x5457f6[_0xe9f0('0x32')],_0x44fb5b[_0xe9f0('0x34')]),_0xa27c84);if(_0x5457f6['query'][_0xe9f0('0x3d')]){_0xdc16bc[_0xe9f0('0x3b')]=_[_0xe9f0('0x3e')](_0xdc16bc['where'],{'$or':_[_0xe9f0('0x2b')](_0xa27c84,function(_0xbec11f){if(_0xbec11f['type']!==_0xe9f0('0x3f')){var _0x5154c3={};_0x5154c3[_0xbec11f[_0xe9f0('0x28')]]={'$like':'%'+_0x5457f6['query']['filter']+'%'};return _0x5154c3;}})});}_0xdc16bc=_['merge']({},_0xdc16bc,_0x5457f6['options']);var _0x5165f7={'where':_0xdc16bc[_0xe9f0('0x3b')]};return db[_0xe9f0('0x2c')][_0xe9f0('0x1e')](_0x5165f7)[_0xe9f0('0x24')](function(_0x2560c6){_0xab3d81[_0xe9f0('0x1e')]=_0x2560c6;if(_0x5457f6[_0xe9f0('0x32')][_0xe9f0('0x40')]){_0xdc16bc[_0xe9f0('0x41')]=[{'all':!![]}];}return db['Integration'][_0xe9f0('0x42')](_0xdc16bc);})[_0xe9f0('0x24')](function(_0x36b00a){_0xab3d81['rows']=_0x36b00a;return _0xab3d81;})['then'](respondWithFilteredResult(_0x130f96,_0xdc16bc))[_0xe9f0('0x43')](handleError(_0x130f96,null));};exports['show']=function(_0x297689,_0x52613a){var _0x314f0e={'raw':![],'where':{'id':_0x297689['params']['id']}},_0x42d9d2={};_0x42d9d2[_0xe9f0('0x31')]=_[_0xe9f0('0x33')](db[_0xe9f0('0x2c')][_0xe9f0('0x2d')]);_0x42d9d2[_0xe9f0('0x32')]=_['keys'](_0x297689[_0xe9f0('0x32')]);_0x42d9d2[_0xe9f0('0x34')]=_[_0xe9f0('0x35')](_0x42d9d2[_0xe9f0('0x31')],_0x42d9d2[_0xe9f0('0x32')]);_0x314f0e['attributes']=_[_0xe9f0('0x35')](_0x42d9d2['model'],qs['fields'](_0x297689[_0xe9f0('0x32')][_0xe9f0('0x37')]));_0x314f0e['attributes']=_0x314f0e[_0xe9f0('0x36')][_0xe9f0('0x38')]?_0x314f0e[_0xe9f0('0x36')]:_0x42d9d2[_0xe9f0('0x31')];if(_0x297689[_0xe9f0('0x32')][_0xe9f0('0x40')]){_0x314f0e[_0xe9f0('0x41')]=[{'all':!![]}];}_0x314f0e=_['merge']({},_0x314f0e,_0x297689[_0xe9f0('0x44')]);return db['Integration'][_0xe9f0('0x45')](_0x314f0e)['then'](handleEntityNotFound(_0x52613a,null))[_0xe9f0('0x24')](respondWithResult(_0x52613a,null))['catch'](handleError(_0x52613a,null));};exports[_0xe9f0('0x46')]=function(_0x2023b4,_0x422324){return db['Integration'][_0xe9f0('0x46')](_0x2023b4[_0xe9f0('0x47')],{})[_0xe9f0('0x24')](respondWithResult(_0x422324,0xc9))[_0xe9f0('0x43')](handleError(_0x422324,null));};exports[_0xe9f0('0x23')]=function(_0x135175,_0x6ece3f){if(_0x135175[_0xe9f0('0x47')]['id']){delete _0x135175[_0xe9f0('0x47')]['id'];}return db[_0xe9f0('0x2c')][_0xe9f0('0x45')]({'where':{'id':_0x135175[_0xe9f0('0x48')]['id']}})['then'](handleEntityNotFound(_0x6ece3f,null))['then'](saveUpdates(_0x135175[_0xe9f0('0x47')],null))[_0xe9f0('0x24')](respondWithResult(_0x6ece3f,null))[_0xe9f0('0x43')](handleError(_0x6ece3f,null));};exports['destroy']=function(_0x1ac381,_0x4d8b2e){return db[_0xe9f0('0x2c')][_0xe9f0('0x45')]({'where':{'id':_0x1ac381[_0xe9f0('0x48')]['id']}})[_0xe9f0('0x24')](handleEntityNotFound(_0x4d8b2e,null))['then'](removeEntity(_0x4d8b2e,null))[_0xe9f0('0x43')](handleError(_0x4d8b2e,null));}; \ No newline at end of file +var _0xc4aa=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','Integration','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','VIRTUAL','merge','options','includeAll','include','rows','catch','show','params','keys','rawAttributes','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/auth/service'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x4a747d,_0x3b747f){_0x4a747d=_0x4a747d-0x0;var _0x3a5b5c=_0xc4aa[_0x4a747d];return _0x3a5b5c;};'use strict';var emlformat=require(_0xac4a('0x0'));var rimraf=require(_0xac4a('0x1'));var zipdir=require(_0xac4a('0x2'));var jsonpatch=require(_0xac4a('0x3'));var rp=require(_0xac4a('0x4'));var moment=require(_0xac4a('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xac4a('0x6'));var sox=require(_0xac4a('0x7'));var csv=require(_0xac4a('0x8'));var ejs=require(_0xac4a('0x9'));var fs=require('fs');var fs_extra=require(_0xac4a('0xa'));var _=require(_0xac4a('0xb'));var squel=require(_0xac4a('0xc'));var crypto=require(_0xac4a('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xac4a('0x8'));var querystring=require(_0xac4a('0xe'));var Papa=require(_0xac4a('0xf'));var Redis=require('ioredis');var authService=require(_0xac4a('0x10'));var qs=require(_0xac4a('0x11'));var as=require(_0xac4a('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xac4a('0x13'))('api');var utils=require(_0xac4a('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xac4a('0x15'));var db=require(_0xac4a('0x16'))['db'];function respondWithStatusCode(_0x24291d,_0x5e16aa){_0x5e16aa=_0x5e16aa||0xcc;return function(_0x21a79){if(_0x21a79){return _0x24291d[_0xac4a('0x17')](_0x5e16aa);}return _0x24291d[_0xac4a('0x18')](_0x5e16aa)[_0xac4a('0x19')]();};}function respondWithResult(_0x1b4313,_0x3b71c0){_0x3b71c0=_0x3b71c0||0xc8;return function(_0x34bc01){if(_0x34bc01){return _0x1b4313[_0xac4a('0x18')](_0x3b71c0)[_0xac4a('0x1a')](_0x34bc01);}};}function respondWithFilteredResult(_0x42c7fc,_0x11e101){return function(_0x26dbb8){if(_0x26dbb8){var _0x4a2119=typeof _0x11e101[_0xac4a('0x1b')]===_0xac4a('0x1c')&&typeof _0x11e101[_0xac4a('0x1d')]===_0xac4a('0x1c');var _0x3e88e3=_0x26dbb8[_0xac4a('0x1e')];var _0x28e304=_0x4a2119?0x0:_0x11e101[_0xac4a('0x1b')];var _0x546c5d=_0x4a2119?_0x26dbb8['count']:_0x11e101[_0xac4a('0x1b')]+_0x11e101[_0xac4a('0x1d')];var _0x39b691;if(_0x546c5d>=_0x3e88e3){_0x546c5d=_0x3e88e3;_0x39b691=0xc8;}else{_0x39b691=0xce;}_0x42c7fc['status'](_0x39b691);return _0x42c7fc[_0xac4a('0x1f')](_0xac4a('0x20'),_0x28e304+'-'+_0x546c5d+'/'+_0x3e88e3)[_0xac4a('0x1a')](_0x26dbb8);}return null;};}function patchUpdates(_0x3a3cdb){return function(_0x123694){try{jsonpatch[_0xac4a('0x21')](_0x123694,_0x3a3cdb,!![]);}catch(_0xe38996){return BPromise[_0xac4a('0x22')](_0xe38996);}return _0x123694['save']();};}function saveUpdates(_0x3d8f0a,_0x3204ad){return function(_0x599787){if(_0x599787){return _0x599787[_0xac4a('0x23')](_0x3d8f0a)[_0xac4a('0x24')](function(_0x3eacd3){return _0x3eacd3;});}return null;};}function removeEntity(_0x947d8e,_0x4d2d6c){return function(_0x1b7998){if(_0x1b7998){return _0x1b7998[_0xac4a('0x25')]()[_0xac4a('0x24')](function(){_0x947d8e[_0xac4a('0x18')](0xcc)[_0xac4a('0x19')]();});}};}function handleEntityNotFound(_0x2b0dc2,_0x222507){return function(_0x36054a){if(!_0x36054a){_0x2b0dc2[_0xac4a('0x17')](0x194);}return _0x36054a;};}function handleError(_0x3bc318,_0x1d0539){_0x1d0539=_0x1d0539||0x1f4;return function(_0x215a31){logger[_0xac4a('0x26')](_0x215a31[_0xac4a('0x27')]);if(_0x215a31[_0xac4a('0x28')]){delete _0x215a31[_0xac4a('0x28')];}_0x3bc318['status'](_0x1d0539)[_0xac4a('0x29')](_0x215a31);};}exports[_0xac4a('0x2a')]=function(_0x42a33c,_0x2772fe){var _0x116700={},_0x4a5a9e={},_0x47f49c={'count':0x0,'rows':[]};var _0xdb7e=_[_0xac4a('0x2b')](db[_0xac4a('0x2c')]['rawAttributes'],function(_0x4bda1f){return{'name':_0x4bda1f[_0xac4a('0x2d')],'type':_0x4bda1f[_0xac4a('0x2e')][_0xac4a('0x2f')]};});_0x4a5a9e[_0xac4a('0x30')]=_[_0xac4a('0x2b')](_0xdb7e,'name');_0x4a5a9e[_0xac4a('0x31')]=_['keys'](_0x42a33c[_0xac4a('0x31')]);_0x4a5a9e['filters']=_[_0xac4a('0x32')](_0x4a5a9e[_0xac4a('0x30')],_0x4a5a9e[_0xac4a('0x31')]);_0x116700[_0xac4a('0x33')]=_[_0xac4a('0x32')](_0x4a5a9e[_0xac4a('0x30')],qs[_0xac4a('0x34')](_0x42a33c[_0xac4a('0x31')][_0xac4a('0x34')]));_0x116700[_0xac4a('0x33')]=_0x116700[_0xac4a('0x33')][_0xac4a('0x35')]?_0x116700[_0xac4a('0x33')]:_0x4a5a9e[_0xac4a('0x30')];if(!_0x42a33c['query'][_0xac4a('0x36')](_0xac4a('0x37'))){_0x116700['limit']=qs[_0xac4a('0x1d')](_0x42a33c[_0xac4a('0x31')]['limit']);_0x116700['offset']=qs[_0xac4a('0x1b')](_0x42a33c[_0xac4a('0x31')][_0xac4a('0x1b')]);}_0x116700[_0xac4a('0x38')]=qs['sort'](_0x42a33c[_0xac4a('0x31')][_0xac4a('0x39')]);_0x116700['where']=qs[_0xac4a('0x3a')](_[_0xac4a('0x3b')](_0x42a33c[_0xac4a('0x31')],_0x4a5a9e['filters']),_0xdb7e);if(_0x42a33c[_0xac4a('0x31')][_0xac4a('0x3c')]){_0x116700[_0xac4a('0x3d')]=_['merge'](_0x116700[_0xac4a('0x3d')],{'$or':_[_0xac4a('0x2b')](_0xdb7e,function(_0x4b9faf){if(_0x4b9faf['type']!==_0xac4a('0x3e')){var _0x5e0926={};_0x5e0926[_0x4b9faf['name']]={'$like':'%'+_0x42a33c['query']['filter']+'%'};return _0x5e0926;}})});}_0x116700=_[_0xac4a('0x3f')]({},_0x116700,_0x42a33c[_0xac4a('0x40')]);var _0x37834b={'where':_0x116700[_0xac4a('0x3d')]};return db[_0xac4a('0x2c')][_0xac4a('0x1e')](_0x37834b)[_0xac4a('0x24')](function(_0x2b16f0){_0x47f49c[_0xac4a('0x1e')]=_0x2b16f0;if(_0x42a33c[_0xac4a('0x31')][_0xac4a('0x41')]){_0x116700[_0xac4a('0x42')]=[{'all':!![]}];}return db['Integration']['findAll'](_0x116700);})['then'](function(_0x1e1cc5){_0x47f49c[_0xac4a('0x43')]=_0x1e1cc5;return _0x47f49c;})[_0xac4a('0x24')](respondWithFilteredResult(_0x2772fe,_0x116700))[_0xac4a('0x44')](handleError(_0x2772fe,null));};exports[_0xac4a('0x45')]=function(_0x411543,_0x8febf0){var _0x3441f2={'raw':![],'where':{'id':_0x411543[_0xac4a('0x46')]['id']}},_0x3e9973={};_0x3e9973['model']=_[_0xac4a('0x47')](db[_0xac4a('0x2c')][_0xac4a('0x48')]);_0x3e9973[_0xac4a('0x31')]=_[_0xac4a('0x47')](_0x411543['query']);_0x3e9973[_0xac4a('0x3a')]=_[_0xac4a('0x32')](_0x3e9973['model'],_0x3e9973[_0xac4a('0x31')]);_0x3441f2['attributes']=_[_0xac4a('0x32')](_0x3e9973[_0xac4a('0x30')],qs[_0xac4a('0x34')](_0x411543[_0xac4a('0x31')][_0xac4a('0x34')]));_0x3441f2[_0xac4a('0x33')]=_0x3441f2[_0xac4a('0x33')][_0xac4a('0x35')]?_0x3441f2[_0xac4a('0x33')]:_0x3e9973[_0xac4a('0x30')];if(_0x411543[_0xac4a('0x31')][_0xac4a('0x41')]){_0x3441f2['include']=[{'all':!![]}];}_0x3441f2=_[_0xac4a('0x3f')]({},_0x3441f2,_0x411543[_0xac4a('0x40')]);return db[_0xac4a('0x2c')]['find'](_0x3441f2)[_0xac4a('0x24')](handleEntityNotFound(_0x8febf0,null))[_0xac4a('0x24')](respondWithResult(_0x8febf0,null))['catch'](handleError(_0x8febf0,null));};exports[_0xac4a('0x49')]=function(_0x5a7f6e,_0x244950){return db[_0xac4a('0x2c')][_0xac4a('0x49')](_0x5a7f6e['body'],{})['then'](respondWithResult(_0x244950,0xc9))[_0xac4a('0x44')](handleError(_0x244950,null));};exports['update']=function(_0x18ae96,_0x566258){if(_0x18ae96[_0xac4a('0x4a')]['id']){delete _0x18ae96['body']['id'];}return db[_0xac4a('0x2c')][_0xac4a('0x4b')]({'where':{'id':_0x18ae96[_0xac4a('0x46')]['id']}})[_0xac4a('0x24')](handleEntityNotFound(_0x566258,null))['then'](saveUpdates(_0x18ae96[_0xac4a('0x4a')],null))[_0xac4a('0x24')](respondWithResult(_0x566258,null))[_0xac4a('0x44')](handleError(_0x566258,null));};exports[_0xac4a('0x25')]=function(_0x2f30e2,_0x138876){return db[_0xac4a('0x2c')]['find']({'where':{'id':_0x2f30e2[_0xac4a('0x46')]['id']}})[_0xac4a('0x24')](handleEntityNotFound(_0x138876,null))['then'](removeEntity(_0x138876,null))[_0xac4a('0x44')](handleError(_0x138876,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 432fe7b..ab16c02 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 _0xa945=['../../config/environment','./integration.attributes','exports','define','integrations','lodash','util','../../config/logger','api','moment','path','rimraf'];(function(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_0xa945,0xb9));var _0x5a94=function(_0x42e7ce,_0x375d2e){_0x42e7ce=_0x42e7ce-0x0;var _0x3d5428=_0xa945[_0x42e7ce];return _0x3d5428;};'use strict';var _=require(_0x5a94('0x0'));var util=require(_0x5a94('0x1'));var logger=require(_0x5a94('0x2'))(_0x5a94('0x3'));var moment=require(_0x5a94('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x5a94('0x5'));var rimraf=require(_0x5a94('0x6'));var config=require(_0x5a94('0x7'));var attributes=require(_0x5a94('0x8'));module[_0x5a94('0x9')]=function(_0x5a743c,_0x53df87){return _0x5a743c[_0x5a94('0xa')]('Integration',attributes,{'tableName':_0x5a94('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3166=['rimraf','../../config/environment','./integration.attributes','exports','define','Integration','integrations','lodash','util','../../config/logger','moment'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x3166,0x8b));var _0x6316=function(_0x5e0ac5,_0x5b696a){_0x5e0ac5=_0x5e0ac5-0x0;var _0x4362d8=_0x3166[_0x5e0ac5];return _0x4362d8;};'use strict';var _=require(_0x6316('0x0'));var util=require(_0x6316('0x1'));var logger=require(_0x6316('0x2'))('api');var moment=require(_0x6316('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x6316('0x4'));var config=require(_0x6316('0x5'));var attributes=require(_0x6316('0x6'));module[_0x6316('0x7')]=function(_0x4b6a90,_0x5169d6){return _0x4b6a90[_0x6316('0x8')](_0x6316('0x9'),attributes,{'tableName':_0x6316('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integration/integration.rpc.js b/server/api/integration/integration.rpc.js index ecf5fbe..1ad472d 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 _0x896e=['Integration,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then'];(function(_0x46f4f5,_0x5dc62f){var _0x39458d=function(_0x30fd49){while(--_0x30fd49){_0x46f4f5['push'](_0x46f4f5['shift']());}};_0x39458d(++_0x5dc62f);}(_0x896e,0x1e9));var _0xe896=function(_0x140af8,_0x53830f){_0x140af8=_0x140af8-0x0;var _0x33cfeb=_0x896e[_0x140af8];return _0x33cfeb;};'use strict';var _=require(_0xe896('0x0'));var util=require(_0xe896('0x1'));var moment=require(_0xe896('0x2'));var BPromise=require(_0xe896('0x3'));var rs=require(_0xe896('0x4'));var fs=require('fs');var Redis=require(_0xe896('0x5'));var db=require(_0xe896('0x6'))['db'];var utils=require(_0xe896('0x7'));var logger=require(_0xe896('0x8'))(_0xe896('0x9'));var config=require(_0xe896('0xa'));var jayson=require(_0xe896('0xb'));var client=jayson['client'][_0xe896('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x7a0721,_0x3b902c,_0x264eeb){return new BPromise(function(_0x43c619,_0x5a1909){return client[_0xe896('0xd')](_0x7a0721,_0x264eeb)[_0xe896('0xe')](function(_0x37a90d){logger['info'](_0xe896('0xf'),_0x3b902c,'request\x20sent');logger[_0xe896('0x10')]('Integration,\x20%s,\x20%s,\x20%s',_0x3b902c,_0xe896('0x11'),JSON[_0xe896('0x12')](_0x37a90d));if(_0x37a90d[_0xe896('0x13')]){if(_0x37a90d['error'][_0xe896('0x14')]===0x1f4){logger[_0xe896('0x13')](_0xe896('0xf'),_0x3b902c,_0x37a90d['error'][_0xe896('0x15')]);return _0x5a1909(_0x37a90d[_0xe896('0x13')][_0xe896('0x15')]);}logger['error'](_0xe896('0xf'),_0x3b902c,_0x37a90d[_0xe896('0x13')][_0xe896('0x15')]);return _0x43c619(_0x37a90d['error']['message']);}else{logger[_0xe896('0x16')](_0xe896('0xf'),_0x3b902c,'request\x20sent');_0x43c619(_0x37a90d['result'][_0xe896('0x15')]);}})[_0xe896('0x17')](function(_0x57f04b){logger[_0xe896('0x13')]('Integration,\x20%s,\x20%s',_0x3b902c,_0x57f04b);_0x5a1909(_0x57f04b);});});} \ No newline at end of file +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(_0x3e95c9,_0x1cd9a8){var _0x1653a0=function(_0xffdaa7){while(--_0xffdaa7){_0x3e95c9['push'](_0x3e95c9['shift']());}};_0x1653a0(++_0x1cd9a8);}(_0x7880,0x1f4));var _0x0788=function(_0x53d2d4,_0x1f63eb){_0x53d2d4=_0x53d2d4-0x0;var _0x2128d2=_0x7880[_0x53d2d4];return _0x2128d2;};'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 diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index f63ec7c..81b9871 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 _0x6d38=['path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./integrationReport.controller','isAuthenticated','index','get','/describe','/:id','create','update','destroy','exports','util'];(function(_0x350269,_0x1f80b8){var _0x35c9e7=function(_0x5e2eb7){while(--_0x5e2eb7){_0x350269['push'](_0x350269['shift']());}};_0x35c9e7(++_0x1f80b8);}(_0x6d38,0x1ef));var _0x86d3=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0x6d38[_0x36eaaa];return _0x461349;};'use strict';var multer=require('multer');var util=require(_0x86d3('0x0'));var path=require(_0x86d3('0x1'));var timeout=require(_0x86d3('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x86d3('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x86d3('0x4'));var config=require(_0x86d3('0x5'));var controller=require(_0x86d3('0x6'));router['get']('/',auth[_0x86d3('0x7')](),controller[_0x86d3('0x8')]);router[_0x86d3('0x9')](_0x86d3('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x86d3('0x9')](_0x86d3('0xb'),auth[_0x86d3('0x7')](),controller['show']);router['post']('/',auth[_0x86d3('0x7')](),controller[_0x86d3('0xc')]);router['put']('/:id',auth[_0x86d3('0x7')](),controller[_0x86d3('0xd')]);router['delete'](_0x86d3('0xb'),auth['isAuthenticated'](),controller[_0x86d3('0xe')]);module[_0x86d3('0xf')]=router; \ No newline at end of file +var _0x955f=['post','create','update','delete','destroy','multer','util','path','connect-timeout','express','fs-extra','../../config/environment','get','isAuthenticated','index','/describe','/:id','show'];(function(_0x1ab483,_0x1bdb39){var _0x468642=function(_0x1e1459){while(--_0x1e1459){_0x1ab483['push'](_0x1ab483['shift']());}};_0x468642(++_0x1bdb39);}(_0x955f,0x1eb));var _0xf955=function(_0x4ade24,_0x388024){_0x4ade24=_0x4ade24-0x0;var _0x17f48f=_0x955f[_0x4ade24];return _0x17f48f;};'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 diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index 583c2c5..309a1f6 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 _0xf0a3=['TEXT','ENUM','SENDING','RECEIVED','FAILED','sequelize','exports','STRING','INTEGER','DATE','BOOLEAN'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf0a3,0xe1));var _0x3f0a=function(_0x31e0a7,_0x231fee){_0x31e0a7=_0x31e0a7-0x0;var _0xc60e40=_0xf0a3[_0x31e0a7];return _0xc60e40;};'use strict';var Sequelize=require(_0x3f0a('0x0'));module[_0x3f0a('0x1')]={'integration':{'type':Sequelize[_0x3f0a('0x2')]},'eventChannel':{'type':Sequelize[_0x3f0a('0x2')]},'exitStatus':{'type':Sequelize[_0x3f0a('0x2')]},'ticketId':{'type':Sequelize[_0x3f0a('0x2')]},'integrationId':{'type':Sequelize[_0x3f0a('0x3')]},'contacts':{'type':Sequelize[_0x3f0a('0x2')]},'uniqueid':{'type':Sequelize[_0x3f0a('0x2')]},'calleridnum':{'type':Sequelize[_0x3f0a('0x2')]},'calleridname':{'type':Sequelize[_0x3f0a('0x2')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x3f0a('0x2')]},'membername':{'type':Sequelize[_0x3f0a('0x2')]},'agentcalledAt':{'type':Sequelize[_0x3f0a('0x4')]},'agentconnectAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0x3f0a('0x3')]},'agentcomplete':{'type':Sequelize[_0x3f0a('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x3f0a('0x4')]},'talktime':{'type':Sequelize[_0x3f0a('0x3')]},'agentacw':{'type':Sequelize[_0x3f0a('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x3f0a('0x3')]},'reason':{'type':Sequelize[_0x3f0a('0x2')]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x3f0a('0x4')]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x3f0a('0x4')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x3f0a('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x3f0a('0x2')]},'connectedlinenum':{'type':Sequelize[_0x3f0a('0x2')]},'connectedlinename':{'type':Sequelize[_0x3f0a('0x2')]},'language':{'type':Sequelize[_0x3f0a('0x2')]},'accountcode':{'type':Sequelize[_0x3f0a('0x2')]},'context':{'type':Sequelize[_0x3f0a('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x3f0a('0x2')]},'destchannel':{'type':Sequelize[_0x3f0a('0x2')]},'destchannelstate':{'type':Sequelize[_0x3f0a('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x3f0a('0x2')]},'destcalleridnum':{'type':Sequelize[_0x3f0a('0x2')]},'destcalleridname':{'type':Sequelize[_0x3f0a('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x3f0a('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x3f0a('0x2')]},'destlanguage':{'type':Sequelize[_0x3f0a('0x2')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0x3f0a('0x2')]},'destexten':{'type':Sequelize[_0x3f0a('0x2')]},'destpriority':{'type':Sequelize[_0x3f0a('0x2')]},'destuniqueid':{'type':Sequelize[_0x3f0a('0x2')]},'messageId':{'type':Sequelize[_0x3f0a('0x2')]},'inReplyTo':{'type':Sequelize[_0x3f0a('0x2')]},'subject':{'type':Sequelize['STRING']},'from':{'type':Sequelize[_0x3f0a('0x2')]},'to':{'type':Sequelize[_0x3f0a('0x2')]},'cc':{'type':Sequelize[_0x3f0a('0x2')]},'attachment':{'type':Sequelize[_0x3f0a('0x6')]},'html':{'type':Sequelize[_0x3f0a('0x6')]},'text':{'type':Sequelize[_0x3f0a('0x6')]},'status':{'type':Sequelize[_0x3f0a('0x7')]('SENT',_0x3f0a('0x8'),_0x3f0a('0x9'),_0x3f0a('0xa'))},'url':{'type':Sequelize['STRING']},'app':{'type':Sequelize[_0x3f0a('0x2')]},'appdata':{'type':Sequelize['STRING']},'projectId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x5a09=['ENUM','SENT','SENDING','RECEIVED','FAILED','exports','STRING','INTEGER','DATE','BOOLEAN','TEXT'];(function(_0xd76ccc,_0x305d55){var _0x130073=function(_0x2dc2ce){while(--_0x2dc2ce){_0xd76ccc['push'](_0xd76ccc['shift']());}};_0x130073(++_0x305d55);}(_0x5a09,0xd6));var _0x95a0=function(_0x3ccdf8,_0x584ceb){_0x3ccdf8=_0x3ccdf8-0x0;var _0x243dab=_0x5a09[_0x3ccdf8];return _0x243dab;};'use strict';var Sequelize=require('sequelize');module[_0x95a0('0x0')]={'integration':{'type':Sequelize[_0x95a0('0x1')]},'eventChannel':{'type':Sequelize[_0x95a0('0x1')]},'exitStatus':{'type':Sequelize[_0x95a0('0x1')]},'ticketId':{'type':Sequelize[_0x95a0('0x1')]},'integrationId':{'type':Sequelize[_0x95a0('0x2')]},'contacts':{'type':Sequelize[_0x95a0('0x1')]},'uniqueid':{'type':Sequelize[_0x95a0('0x1')]},'calleridnum':{'type':Sequelize[_0x95a0('0x1')]},'calleridname':{'type':Sequelize[_0x95a0('0x1')]},'queue':{'type':Sequelize[_0x95a0('0x1')]},'interface':{'type':Sequelize[_0x95a0('0x1')]},'membername':{'type':Sequelize[_0x95a0('0x1')]},'agentcalledAt':{'type':Sequelize[_0x95a0('0x3')]},'agentconnectAt':{'type':Sequelize[_0x95a0('0x3')]},'holdtime':{'type':Sequelize[_0x95a0('0x2')]},'agentcomplete':{'type':Sequelize[_0x95a0('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x95a0('0x3')]},'talktime':{'type':Sequelize[_0x95a0('0x2')]},'agentacw':{'type':Sequelize[_0x95a0('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x95a0('0x2')]},'reason':{'type':Sequelize[_0x95a0('0x1')]},'agentringnoanswer':{'type':Sequelize[_0x95a0('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdump':{'type':Sequelize[_0x95a0('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x95a0('0x3')]},'lastevent':{'type':Sequelize[_0x95a0('0x1')]},'channel':{'type':Sequelize[_0x95a0('0x1')]},'channelstate':{'type':Sequelize[_0x95a0('0x2')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x95a0('0x1')]},'connectedlinename':{'type':Sequelize[_0x95a0('0x1')]},'language':{'type':Sequelize[_0x95a0('0x1')]},'accountcode':{'type':Sequelize[_0x95a0('0x1')]},'context':{'type':Sequelize[_0x95a0('0x1')]},'exten':{'type':Sequelize[_0x95a0('0x1')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0x95a0('0x1')]},'destchannelstate':{'type':Sequelize[_0x95a0('0x2')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0x95a0('0x1')]},'destcalleridname':{'type':Sequelize[_0x95a0('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0x95a0('0x1')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x95a0('0x1')]},'destaccountcode':{'type':Sequelize[_0x95a0('0x1')]},'destcontext':{'type':Sequelize[_0x95a0('0x1')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0x95a0('0x1')]},'messageId':{'type':Sequelize[_0x95a0('0x1')]},'inReplyTo':{'type':Sequelize[_0x95a0('0x1')]},'subject':{'type':Sequelize[_0x95a0('0x1')]},'from':{'type':Sequelize[_0x95a0('0x1')]},'to':{'type':Sequelize[_0x95a0('0x1')]},'cc':{'type':Sequelize[_0x95a0('0x1')]},'attachment':{'type':Sequelize['TEXT']},'html':{'type':Sequelize[_0x95a0('0x5')]},'text':{'type':Sequelize[_0x95a0('0x5')]},'status':{'type':Sequelize[_0x95a0('0x6')](_0x95a0('0x7'),_0x95a0('0x8'),_0x95a0('0x9'),_0x95a0('0xa'))},'url':{'type':Sequelize[_0x95a0('0x1')]},'app':{'type':Sequelize[_0x95a0('0x1')]},'appdata':{'type':Sequelize[_0x95a0('0x1')]},'projectId':{'type':Sequelize[_0x95a0('0x2')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index f568fa0..57aad00 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 _0x0e4c=['destroy','end','error','stack','send','index','IntegrationReport','rawAttributes','type','key','model','map','keys','intersection','attributes','length','query','hasOwnProperty','nolimit','sort','where','filters','pick','merge','VIRTUAL','name','filter','include','findAll','then','rows','show','includeAll','find','catch','create','body','params','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','count','limit','set','apply','reject','save','update'];(function(_0x5ed780,_0x2f1dd3){var _0x10e34a=function(_0x516e1a){while(--_0x516e1a){_0x5ed780['push'](_0x5ed780['shift']());}};_0x10e34a(++_0x2f1dd3);}(_0x0e4c,0xb6));var _0xc0e4=function(_0x16f1a4,_0x4fcbed){_0x16f1a4=_0x16f1a4-0x0;var _0x34844a=_0x0e4c[_0x16f1a4];return _0x34844a;};'use strict';var emlformat=require(_0xc0e4('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc0e4('0x1'));var jsonpatch=require(_0xc0e4('0x2'));var rp=require('request-promise');var moment=require(_0xc0e4('0x3'));var BPromise=require(_0xc0e4('0x4'));var Mustache=require(_0xc0e4('0x5'));var util=require(_0xc0e4('0x6'));var path=require(_0xc0e4('0x7'));var sox=require(_0xc0e4('0x8'));var csv=require(_0xc0e4('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc0e4('0xa'));var _=require(_0xc0e4('0xb'));var squel=require(_0xc0e4('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xc0e4('0xd'));var toCsv=require(_0xc0e4('0x9'));var querystring=require(_0xc0e4('0xe'));var Papa=require(_0xc0e4('0xf'));var Redis=require(_0xc0e4('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xc0e4('0x11'));var as=require(_0xc0e4('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xc0e4('0x13'));var config=require(_0xc0e4('0x14'));var licenseUtil=require(_0xc0e4('0x15'));var db=require(_0xc0e4('0x16'))['db'];function respondWithStatusCode(_0x30be09,_0x828e49){_0x828e49=_0x828e49||0xcc;return function(_0xdc8bbb){if(_0xdc8bbb){return _0x30be09[_0xc0e4('0x17')](_0x828e49);}return _0x30be09[_0xc0e4('0x18')](_0x828e49)['end']();};}function respondWithResult(_0x109466,_0x8e40b5){_0x8e40b5=_0x8e40b5||0xc8;return function(_0x4e39de){if(_0x4e39de){return _0x109466['status'](_0x8e40b5)['json'](_0x4e39de);}};}function respondWithFilteredResult(_0x54548d,_0x477609){return function(_0x11286b){if(_0x11286b){var _0x44e858=typeof _0x477609[_0xc0e4('0x19')]===_0xc0e4('0x1a')&&typeof _0x477609['limit']===_0xc0e4('0x1a');var _0x2b497c=_0x11286b[_0xc0e4('0x1b')];var _0x24ca56=_0x44e858?0x0:_0x477609[_0xc0e4('0x19')];var _0x24b023=_0x44e858?_0x11286b['count']:_0x477609[_0xc0e4('0x19')]+_0x477609[_0xc0e4('0x1c')];var _0x4b89a2;if(_0x24b023>=_0x2b497c){_0x24b023=_0x2b497c;_0x4b89a2=0xc8;}else{_0x4b89a2=0xce;}_0x54548d[_0xc0e4('0x18')](_0x4b89a2);return _0x54548d[_0xc0e4('0x1d')]('Content-Range',_0x24ca56+'-'+_0x24b023+'/'+_0x2b497c)['json'](_0x11286b);}return null;};}function patchUpdates(_0x381920){return function(_0x31248f){try{jsonpatch[_0xc0e4('0x1e')](_0x31248f,_0x381920,!![]);}catch(_0x2e0a90){return BPromise[_0xc0e4('0x1f')](_0x2e0a90);}return _0x31248f[_0xc0e4('0x20')]();};}function saveUpdates(_0x45eaf9,_0x3a9e5c){return function(_0x2a217f){if(_0x2a217f){return _0x2a217f[_0xc0e4('0x21')](_0x45eaf9)['then'](function(_0x48b75c){return _0x48b75c;});}return null;};}function removeEntity(_0x581a38,_0x254ba0){return function(_0x132de5){if(_0x132de5){return _0x132de5[_0xc0e4('0x22')]()['then'](function(){_0x581a38['status'](0xcc)[_0xc0e4('0x23')]();});}};}function handleEntityNotFound(_0x1fb6a1,_0x14ee76){return function(_0x389f70){if(!_0x389f70){_0x1fb6a1[_0xc0e4('0x17')](0x194);}return _0x389f70;};}function handleError(_0x4f1755,_0x30391c){_0x30391c=_0x30391c||0x1f4;return function(_0x567a0f){logger[_0xc0e4('0x24')](_0x567a0f[_0xc0e4('0x25')]);if(_0x567a0f['name']){delete _0x567a0f['name'];}_0x4f1755[_0xc0e4('0x18')](_0x30391c)[_0xc0e4('0x26')](_0x567a0f);};}exports[_0xc0e4('0x27')]=function(_0x14a637,_0x3ae9e3){var _0x1e71bf={},_0x30e60d={},_0x5a8d5c={'count':0x0,'rows':[]};var _0x5f70e1=_['map'](db[_0xc0e4('0x28')][_0xc0e4('0x29')],function(_0x2c22b0){return{'name':_0x2c22b0['fieldName'],'type':_0x2c22b0[_0xc0e4('0x2a')][_0xc0e4('0x2b')]};});_0x30e60d[_0xc0e4('0x2c')]=_[_0xc0e4('0x2d')](_0x5f70e1,'name');_0x30e60d['query']=_[_0xc0e4('0x2e')](_0x14a637['query']);_0x30e60d['filters']=_[_0xc0e4('0x2f')](_0x30e60d[_0xc0e4('0x2c')],_0x30e60d['query']);_0x1e71bf[_0xc0e4('0x30')]=_['intersection'](_0x30e60d[_0xc0e4('0x2c')],qs['fields'](_0x14a637['query']['fields']));_0x1e71bf[_0xc0e4('0x30')]=_0x1e71bf[_0xc0e4('0x30')][_0xc0e4('0x31')]?_0x1e71bf[_0xc0e4('0x30')]:_0x30e60d[_0xc0e4('0x2c')];if(!_0x14a637[_0xc0e4('0x32')][_0xc0e4('0x33')](_0xc0e4('0x34'))){_0x1e71bf[_0xc0e4('0x1c')]=qs[_0xc0e4('0x1c')](_0x14a637[_0xc0e4('0x32')][_0xc0e4('0x1c')]);_0x1e71bf[_0xc0e4('0x19')]=qs[_0xc0e4('0x19')](_0x14a637[_0xc0e4('0x32')][_0xc0e4('0x19')]);}_0x1e71bf['order']=qs[_0xc0e4('0x35')](_0x14a637[_0xc0e4('0x32')]['sort']);_0x1e71bf[_0xc0e4('0x36')]=qs[_0xc0e4('0x37')](_[_0xc0e4('0x38')](_0x14a637['query'],_0x30e60d[_0xc0e4('0x37')]),_0x5f70e1);if(_0x14a637['query']['filter']){_0x1e71bf[_0xc0e4('0x36')]=_[_0xc0e4('0x39')](_0x1e71bf['where'],{'$or':_[_0xc0e4('0x2d')](_0x5f70e1,function(_0x4c6f5c){if(_0x4c6f5c[_0xc0e4('0x2a')]!==_0xc0e4('0x3a')){var _0x20effe={};_0x20effe[_0x4c6f5c[_0xc0e4('0x3b')]]={'$like':'%'+_0x14a637['query'][_0xc0e4('0x3c')]+'%'};return _0x20effe;}})});}_0x1e71bf=_[_0xc0e4('0x39')]({},_0x1e71bf,_0x14a637['options']);var _0x30e6ae={'where':_0x1e71bf[_0xc0e4('0x36')]};return db[_0xc0e4('0x28')]['count'](_0x30e6ae)['then'](function(_0x2e3949){_0x5a8d5c[_0xc0e4('0x1b')]=_0x2e3949;if(_0x14a637[_0xc0e4('0x32')]['includeAll']){_0x1e71bf[_0xc0e4('0x3d')]=[{'all':!![]}];}return db[_0xc0e4('0x28')][_0xc0e4('0x3e')](_0x1e71bf);})[_0xc0e4('0x3f')](function(_0x253421){_0x5a8d5c[_0xc0e4('0x40')]=_0x253421;return _0x5a8d5c;})[_0xc0e4('0x3f')](respondWithFilteredResult(_0x3ae9e3,_0x1e71bf))['catch'](handleError(_0x3ae9e3,null));};exports[_0xc0e4('0x41')]=function(_0x534026,_0x12615a){var _0x36b202={'raw':![],'where':{'id':_0x534026['params']['id']}},_0x132b51={};_0x132b51[_0xc0e4('0x2c')]=_[_0xc0e4('0x2e')](db[_0xc0e4('0x28')]['rawAttributes']);_0x132b51[_0xc0e4('0x32')]=_[_0xc0e4('0x2e')](_0x534026[_0xc0e4('0x32')]);_0x132b51[_0xc0e4('0x37')]=_[_0xc0e4('0x2f')](_0x132b51['model'],_0x132b51[_0xc0e4('0x32')]);_0x36b202[_0xc0e4('0x30')]=_[_0xc0e4('0x2f')](_0x132b51[_0xc0e4('0x2c')],qs['fields'](_0x534026['query']['fields']));_0x36b202[_0xc0e4('0x30')]=_0x36b202['attributes'][_0xc0e4('0x31')]?_0x36b202[_0xc0e4('0x30')]:_0x132b51[_0xc0e4('0x2c')];if(_0x534026[_0xc0e4('0x32')][_0xc0e4('0x42')]){_0x36b202[_0xc0e4('0x3d')]=[{'all':!![]}];}_0x36b202=_[_0xc0e4('0x39')]({},_0x36b202,_0x534026['options']);return db[_0xc0e4('0x28')][_0xc0e4('0x43')](_0x36b202)['then'](handleEntityNotFound(_0x12615a,null))['then'](respondWithResult(_0x12615a,null))[_0xc0e4('0x44')](handleError(_0x12615a,null));};exports[_0xc0e4('0x45')]=function(_0x38446f,_0x3e5e90){return db[_0xc0e4('0x28')]['create'](_0x38446f['body'],{})['then'](respondWithResult(_0x3e5e90,0xc9))[_0xc0e4('0x44')](handleError(_0x3e5e90,null));};exports[_0xc0e4('0x21')]=function(_0x3d7e4c,_0x2ad989){if(_0x3d7e4c[_0xc0e4('0x46')]['id']){delete _0x3d7e4c[_0xc0e4('0x46')]['id'];}return db['IntegrationReport']['find']({'where':{'id':_0x3d7e4c['params']['id']}})['then'](handleEntityNotFound(_0x2ad989,null))['then'](saveUpdates(_0x3d7e4c[_0xc0e4('0x46')],null))[_0xc0e4('0x3f')](respondWithResult(_0x2ad989,null))['catch'](handleError(_0x2ad989,null));};exports[_0xc0e4('0x22')]=function(_0x2eeb31,_0x2b350e){return db[_0xc0e4('0x28')][_0xc0e4('0x43')]({'where':{'id':_0x2eeb31[_0xc0e4('0x47')]['id']}})[_0xc0e4('0x3f')](handleEntityNotFound(_0x2b350e,null))[_0xc0e4('0x3f')](removeEntity(_0x2b350e,null))[_0xc0e4('0x44')](handleError(_0x2b350e,null));};exports['describe']=function(_0x21a570,_0x1c4eb6){return db[_0xc0e4('0x28')]['describe']()[_0xc0e4('0x3f')](respondWithResult(_0x1c4eb6,null))[_0xc0e4('0x44')](handleError(_0x1c4eb6,null));}; \ No newline at end of file +var _0x94e9=['status','end','offset','undefined','count','json','save','then','destroy','stack','name','index','IntegrationReport','rawAttributes','type','key','model','map','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','show','params','keys','find','catch','create','body','update','describe','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','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus'];(function(_0x3d1521,_0x12ac8b){var _0x201f12=function(_0x484e8c){while(--_0x484e8c){_0x3d1521['push'](_0x3d1521['shift']());}};_0x201f12(++_0x12ac8b);}(_0x94e9,0x7a));var _0x994e=function(_0x5a99db,_0x1cece5){_0x5a99db=_0x5a99db-0x0;var _0x3aad62=_0x94e9[_0x5a99db];return _0x3aad62;};'use strict';var emlformat=require(_0x994e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x994e('0x1'));var jsonpatch=require(_0x994e('0x2'));var rp=require(_0x994e('0x3'));var moment=require(_0x994e('0x4'));var BPromise=require(_0x994e('0x5'));var Mustache=require(_0x994e('0x6'));var util=require(_0x994e('0x7'));var path=require(_0x994e('0x8'));var sox=require(_0x994e('0x9'));var csv=require(_0x994e('0xa'));var ejs=require(_0x994e('0xb'));var fs=require('fs');var fs_extra=require(_0x994e('0xc'));var _=require('lodash');var squel=require(_0x994e('0xd'));var crypto=require(_0x994e('0xe'));var jsforce=require(_0x994e('0xf'));var deskjs=require(_0x994e('0x10'));var toCsv=require('to-csv');var querystring=require(_0x994e('0x11'));var Papa=require(_0x994e('0x12'));var Redis=require(_0x994e('0x13'));var authService=require(_0x994e('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x994e('0x15'));var hardwareService=require(_0x994e('0x16'));var logger=require(_0x994e('0x17'))(_0x994e('0x18'));var utils=require('../../config/utils');var config=require(_0x994e('0x19'));var licenseUtil=require(_0x994e('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3b6984,_0x713320){_0x713320=_0x713320||0xcc;return function(_0x38905c){if(_0x38905c){return _0x3b6984[_0x994e('0x1b')](_0x713320);}return _0x3b6984[_0x994e('0x1c')](_0x713320)[_0x994e('0x1d')]();};}function respondWithResult(_0xec97b3,_0x575113){_0x575113=_0x575113||0xc8;return function(_0x1ac3c8){if(_0x1ac3c8){return _0xec97b3[_0x994e('0x1c')](_0x575113)['json'](_0x1ac3c8);}};}function respondWithFilteredResult(_0x4f788d,_0x5aca50){return function(_0x4f667d){if(_0x4f667d){var _0xcb8012=typeof _0x5aca50[_0x994e('0x1e')]===_0x994e('0x1f')&&typeof _0x5aca50['limit']===_0x994e('0x1f');var _0x387a48=_0x4f667d[_0x994e('0x20')];var _0x31370f=_0xcb8012?0x0:_0x5aca50['offset'];var _0x523123=_0xcb8012?_0x4f667d['count']:_0x5aca50['offset']+_0x5aca50['limit'];var _0x4b07f0;if(_0x523123>=_0x387a48){_0x523123=_0x387a48;_0x4b07f0=0xc8;}else{_0x4b07f0=0xce;}_0x4f788d[_0x994e('0x1c')](_0x4b07f0);return _0x4f788d['set']('Content-Range',_0x31370f+'-'+_0x523123+'/'+_0x387a48)[_0x994e('0x21')](_0x4f667d);}return null;};}function patchUpdates(_0x304515){return function(_0x44985b){try{jsonpatch['apply'](_0x44985b,_0x304515,!![]);}catch(_0x5cabd9){return BPromise['reject'](_0x5cabd9);}return _0x44985b[_0x994e('0x22')]();};}function saveUpdates(_0x235ed8,_0x2a6622){return function(_0x2eea8a){if(_0x2eea8a){return _0x2eea8a['update'](_0x235ed8)[_0x994e('0x23')](function(_0x2997d3){return _0x2997d3;});}return null;};}function removeEntity(_0x4638a8,_0xda6ab6){return function(_0x46771b){if(_0x46771b){return _0x46771b[_0x994e('0x24')]()[_0x994e('0x23')](function(){_0x4638a8[_0x994e('0x1c')](0xcc)[_0x994e('0x1d')]();});}};}function handleEntityNotFound(_0x120b47,_0xed456e){return function(_0x30a873){if(!_0x30a873){_0x120b47[_0x994e('0x1b')](0x194);}return _0x30a873;};}function handleError(_0x55006e,_0x5bae4b){_0x5bae4b=_0x5bae4b||0x1f4;return function(_0x5931f8){logger['error'](_0x5931f8[_0x994e('0x25')]);if(_0x5931f8['name']){delete _0x5931f8[_0x994e('0x26')];}_0x55006e[_0x994e('0x1c')](_0x5bae4b)['send'](_0x5931f8);};}exports[_0x994e('0x27')]=function(_0x3b4aa6,_0x9f717){var _0x7fdce8={},_0x221021={},_0x496b39={'count':0x0,'rows':[]};var _0x11bba8=_['map'](db[_0x994e('0x28')][_0x994e('0x29')],function(_0x2a94e1){return{'name':_0x2a94e1['fieldName'],'type':_0x2a94e1[_0x994e('0x2a')][_0x994e('0x2b')]};});_0x221021[_0x994e('0x2c')]=_[_0x994e('0x2d')](_0x11bba8,'name');_0x221021[_0x994e('0x2e')]=_['keys'](_0x3b4aa6['query']);_0x221021[_0x994e('0x2f')]=_['intersection'](_0x221021[_0x994e('0x2c')],_0x221021['query']);_0x7fdce8['attributes']=_[_0x994e('0x30')](_0x221021[_0x994e('0x2c')],qs[_0x994e('0x31')](_0x3b4aa6[_0x994e('0x2e')][_0x994e('0x31')]));_0x7fdce8[_0x994e('0x32')]=_0x7fdce8[_0x994e('0x32')][_0x994e('0x33')]?_0x7fdce8[_0x994e('0x32')]:_0x221021[_0x994e('0x2c')];if(!_0x3b4aa6[_0x994e('0x2e')][_0x994e('0x34')](_0x994e('0x35'))){_0x7fdce8[_0x994e('0x36')]=qs[_0x994e('0x36')](_0x3b4aa6[_0x994e('0x2e')]['limit']);_0x7fdce8[_0x994e('0x1e')]=qs[_0x994e('0x1e')](_0x3b4aa6[_0x994e('0x2e')][_0x994e('0x1e')]);}_0x7fdce8[_0x994e('0x37')]=qs[_0x994e('0x38')](_0x3b4aa6[_0x994e('0x2e')]['sort']);_0x7fdce8[_0x994e('0x39')]=qs['filters'](_[_0x994e('0x3a')](_0x3b4aa6[_0x994e('0x2e')],_0x221021[_0x994e('0x2f')]),_0x11bba8);if(_0x3b4aa6[_0x994e('0x2e')][_0x994e('0x3b')]){_0x7fdce8[_0x994e('0x39')]=_[_0x994e('0x3c')](_0x7fdce8[_0x994e('0x39')],{'$or':_[_0x994e('0x2d')](_0x11bba8,function(_0x3ac205){if(_0x3ac205['type']!==_0x994e('0x3d')){var _0x544e6b={};_0x544e6b[_0x3ac205[_0x994e('0x26')]]={'$like':'%'+_0x3b4aa6[_0x994e('0x2e')]['filter']+'%'};return _0x544e6b;}})});}_0x7fdce8=_['merge']({},_0x7fdce8,_0x3b4aa6[_0x994e('0x3e')]);var _0x252e90={'where':_0x7fdce8['where']};return db['IntegrationReport'][_0x994e('0x20')](_0x252e90)[_0x994e('0x23')](function(_0x546174){_0x496b39[_0x994e('0x20')]=_0x546174;if(_0x3b4aa6[_0x994e('0x2e')][_0x994e('0x3f')]){_0x7fdce8[_0x994e('0x40')]=[{'all':!![]}];}return db[_0x994e('0x28')]['findAll'](_0x7fdce8);})[_0x994e('0x23')](function(_0xb93cb4){_0x496b39[_0x994e('0x41')]=_0xb93cb4;return _0x496b39;})[_0x994e('0x23')](respondWithFilteredResult(_0x9f717,_0x7fdce8))['catch'](handleError(_0x9f717,null));};exports[_0x994e('0x42')]=function(_0x44cff2,_0x2cc408){var _0x5f0acb={'raw':![],'where':{'id':_0x44cff2[_0x994e('0x43')]['id']}},_0x3e9e95={};_0x3e9e95[_0x994e('0x2c')]=_[_0x994e('0x44')](db[_0x994e('0x28')][_0x994e('0x29')]);_0x3e9e95[_0x994e('0x2e')]=_[_0x994e('0x44')](_0x44cff2[_0x994e('0x2e')]);_0x3e9e95[_0x994e('0x2f')]=_['intersection'](_0x3e9e95['model'],_0x3e9e95[_0x994e('0x2e')]);_0x5f0acb[_0x994e('0x32')]=_[_0x994e('0x30')](_0x3e9e95[_0x994e('0x2c')],qs[_0x994e('0x31')](_0x44cff2[_0x994e('0x2e')]['fields']));_0x5f0acb[_0x994e('0x32')]=_0x5f0acb[_0x994e('0x32')]['length']?_0x5f0acb[_0x994e('0x32')]:_0x3e9e95[_0x994e('0x2c')];if(_0x44cff2[_0x994e('0x2e')]['includeAll']){_0x5f0acb[_0x994e('0x40')]=[{'all':!![]}];}_0x5f0acb=_[_0x994e('0x3c')]({},_0x5f0acb,_0x44cff2['options']);return db[_0x994e('0x28')][_0x994e('0x45')](_0x5f0acb)['then'](handleEntityNotFound(_0x2cc408,null))[_0x994e('0x23')](respondWithResult(_0x2cc408,null))[_0x994e('0x46')](handleError(_0x2cc408,null));};exports['create']=function(_0x1bad47,_0x2029ef){return db[_0x994e('0x28')][_0x994e('0x47')](_0x1bad47[_0x994e('0x48')],{})[_0x994e('0x23')](respondWithResult(_0x2029ef,0xc9))[_0x994e('0x46')](handleError(_0x2029ef,null));};exports[_0x994e('0x49')]=function(_0x20980c,_0x183e76){if(_0x20980c[_0x994e('0x48')]['id']){delete _0x20980c['body']['id'];}return db['IntegrationReport'][_0x994e('0x45')]({'where':{'id':_0x20980c['params']['id']}})[_0x994e('0x23')](handleEntityNotFound(_0x183e76,null))[_0x994e('0x23')](saveUpdates(_0x20980c[_0x994e('0x48')],null))[_0x994e('0x23')](respondWithResult(_0x183e76,null))[_0x994e('0x46')](handleError(_0x183e76,null));};exports[_0x994e('0x24')]=function(_0x414812,_0x308e07){return db[_0x994e('0x28')][_0x994e('0x45')]({'where':{'id':_0x414812[_0x994e('0x43')]['id']}})['then'](handleEntityNotFound(_0x308e07,null))['then'](removeEntity(_0x308e07,null))[_0x994e('0x46')](handleError(_0x308e07,null));};exports[_0x994e('0x4a')]=function(_0xea74fa,_0x3901da){return db[_0x994e('0x28')][_0x994e('0x4a')]()[_0x994e('0x23')](respondWithResult(_0x3901da,null))[_0x994e('0x46')](handleError(_0x3901da,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index cca2ed7..3111ddc 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 _0xaafd=['util','api','bluebird','rimraf','../../config/environment','./integrationReport.attributes','define','IntegrationReport'];(function(_0x20ece0,_0x4bafa5){var _0x1db99b=function(_0x513aaf){while(--_0x513aaf){_0x20ece0['push'](_0x20ece0['shift']());}};_0x1db99b(++_0x4bafa5);}(_0xaafd,0x198));var _0xdaaf=function(_0x9d1971,_0x50b82e){_0x9d1971=_0x9d1971-0x0;var _0x203469=_0xaafd[_0x9d1971];return _0x203469;};'use strict';var _=require('lodash');var util=require(_0xdaaf('0x0'));var logger=require('../../config/logger')(_0xdaaf('0x1'));var moment=require('moment');var BPromise=require(_0xdaaf('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xdaaf('0x3'));var config=require(_0xdaaf('0x4'));var attributes=require(_0xdaaf('0x5'));module['exports']=function(_0x870261,_0x26f672){return _0x870261[_0xdaaf('0x6')](_0xdaaf('0x7'),attributes,{'tableName':'report_integration','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x80bd=['moment','bluebird','request-promise','path','rimraf','./integrationReport.attributes','exports','define','IntegrationReport','report_integration','lodash','util','api'];(function(_0x373897,_0x4cf258){var _0x156bc4=function(_0x2ea659){while(--_0x2ea659){_0x373897['push'](_0x373897['shift']());}};_0x156bc4(++_0x4cf258);}(_0x80bd,0x65));var _0xd80b=function(_0xb3a58e,_0x3bff9c){_0xb3a58e=_0xb3a58e-0x0;var _0x59a523=_0x80bd[_0xb3a58e];return _0x59a523;};'use strict';var _=require(_0xd80b('0x0'));var util=require(_0xd80b('0x1'));var logger=require('../../config/logger')(_0xd80b('0x2'));var moment=require(_0xd80b('0x3'));var BPromise=require(_0xd80b('0x4'));var rp=require(_0xd80b('0x5'));var fs=require('fs');var path=require(_0xd80b('0x6'));var rimraf=require(_0xd80b('0x7'));var config=require('../../config/environment');var attributes=require(_0xd80b('0x8'));module[_0xd80b('0x9')]=function(_0x3ac68d,_0x459fdd){return _0x3ac68d[_0xd80b('0xa')](_0xd80b('0xb'),attributes,{'tableName':_0xd80b('0xc'),'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 f8a1889..8ad09c4 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 _0x7a54=['info','IntegrationReport,\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(_0x5e401c,_0x1f80e2){_0x5e401c=_0x5e401c-0x0;var _0x1cde29=_0x7a54[_0x5e401c];return _0x1cde29;};'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')]('IntegrationReport,\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 _0x1967=['then','info','IntegrationReport,\x20%s,\x20%s','IntegrationReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request'];(function(_0x5d7227,_0x12aebe){var _0x15ac55=function(_0x58d13e){while(--_0x58d13e){_0x5d7227['push'](_0x5d7227['shift']());}};_0x15ac55(++_0x12aebe);}(_0x1967,0x173));var _0x7196=function(_0xdf0e97,_0x30ea6c){_0xdf0e97=_0xdf0e97-0x0;var _0x45858e=_0x1967[_0xdf0e97];return _0x45858e;};'use strict';var _=require('lodash');var util=require(_0x7196('0x0'));var moment=require(_0x7196('0x1'));var BPromise=require(_0x7196('0x2'));var rs=require(_0x7196('0x3'));var fs=require('fs');var Redis=require(_0x7196('0x4'));var db=require(_0x7196('0x5'))['db'];var utils=require(_0x7196('0x6'));var logger=require(_0x7196('0x7'))(_0x7196('0x8'));var config=require(_0x7196('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x7196('0xa')][_0x7196('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x194746,_0x40e0af,_0x266a6e){return new BPromise(function(_0xad78a,_0x510c72){return client[_0x7196('0xc')](_0x194746,_0x266a6e)[_0x7196('0xd')](function(_0x3f846e){logger[_0x7196('0xe')](_0x7196('0xf'),_0x40e0af,'request\x20sent');logger['debug'](_0x7196('0x10'),_0x40e0af,_0x7196('0x11'),JSON[_0x7196('0x12')](_0x3f846e));if(_0x3f846e[_0x7196('0x13')]){if(_0x3f846e[_0x7196('0x13')][_0x7196('0x14')]===0x1f4){logger[_0x7196('0x13')](_0x7196('0xf'),_0x40e0af,_0x3f846e[_0x7196('0x13')][_0x7196('0x15')]);return _0x510c72(_0x3f846e[_0x7196('0x13')]['message']);}logger[_0x7196('0x13')](_0x7196('0xf'),_0x40e0af,_0x3f846e[_0x7196('0x13')][_0x7196('0x15')]);return _0xad78a(_0x3f846e['error'][_0x7196('0x15')]);}else{logger['info'](_0x7196('0xf'),_0x40e0af,_0x7196('0x11'));_0xad78a(_0x3f846e[_0x7196('0x16')][_0x7196('0x15')]);}})[_0x7196('0x17')](function(_0x2e3e0e){logger[_0x7196('0x13')](_0x7196('0xf'),_0x40e0af,_0x2e3e0e);_0x510c72(_0x2e3e0e);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index 4357dc2..d5870e5 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 _0xaf3e=['getIntervals','create','post','addInterval','/:id/sub_intervals/create_many','addIntervals','put','delete','destroy','multer','util','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./interval.controller','get','isAuthenticated','/:id','show','/:id/sub_intervals'];(function(_0x40b69c,_0x40448f){var _0x32bd22=function(_0x3d6a9b){while(--_0x3d6a9b){_0x40b69c['push'](_0x40b69c['shift']());}};_0x32bd22(++_0x40448f);}(_0xaf3e,0xcf));var _0xeaf3=function(_0x5ce8b9,_0x5cded8){_0x5ce8b9=_0x5ce8b9-0x0;var _0xe34be0=_0xaf3e[_0x5ce8b9];return _0xe34be0;};'use strict';var multer=require(_0xeaf3('0x0'));var util=require(_0xeaf3('0x1'));var path=require('path');var timeout=require(_0xeaf3('0x2'));var express=require('express');var router=express[_0xeaf3('0x3')]();var fs_extra=require(_0xeaf3('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xeaf3('0x5'));var config=require(_0xeaf3('0x6'));var controller=require(_0xeaf3('0x7'));router[_0xeaf3('0x8')]('/',auth[_0xeaf3('0x9')](),controller['index']);router[_0xeaf3('0x8')](_0xeaf3('0xa'),auth[_0xeaf3('0x9')](),controller[_0xeaf3('0xb')]);router[_0xeaf3('0x8')](_0xeaf3('0xc'),auth['isAuthenticated'](),controller[_0xeaf3('0xd')]);router['post']('/',auth[_0xeaf3('0x9')](),controller[_0xeaf3('0xe')]);router[_0xeaf3('0xf')]('/:id/sub_intervals',auth[_0xeaf3('0x9')](),controller[_0xeaf3('0x10')]);router['post'](_0xeaf3('0x11'),auth['isAuthenticated'](),controller[_0xeaf3('0x12')]);router[_0xeaf3('0x13')](_0xeaf3('0xa'),auth[_0xeaf3('0x9')](),controller['update']);router[_0xeaf3('0x14')](_0xeaf3('0xa'),auth[_0xeaf3('0x9')](),controller[_0xeaf3('0x15')]);module['exports']=router; \ No newline at end of file +var _0xdced=['/:id/sub_intervals/create_many','addIntervals','update','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./interval.controller','get','index','/:id','isAuthenticated','show','getIntervals','post','/:id/sub_intervals','addInterval'];(function(_0xe3bb46,_0x4ba544){var _0x45001c=function(_0x28afa0){while(--_0x28afa0){_0xe3bb46['push'](_0xe3bb46['shift']());}};_0x45001c(++_0x4ba544);}(_0xdced,0xcb));var _0xddce=function(_0x1afeb1,_0x4ef5e7){_0x1afeb1=_0x1afeb1-0x0;var _0x397155=_0xdced[_0x1afeb1];return _0x397155;};'use strict';var multer=require('multer');var util=require(_0xddce('0x0'));var path=require(_0xddce('0x1'));var timeout=require(_0xddce('0x2'));var express=require(_0xddce('0x3'));var router=express[_0xddce('0x4')]();var fs_extra=require(_0xddce('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xddce('0x6'));var config=require('../../config/environment');var controller=require(_0xddce('0x7'));router[_0xddce('0x8')]('/',auth['isAuthenticated'](),controller[_0xddce('0x9')]);router['get'](_0xddce('0xa'),auth[_0xddce('0xb')](),controller[_0xddce('0xc')]);router[_0xddce('0x8')]('/:id/sub_intervals',auth[_0xddce('0xb')](),controller[_0xddce('0xd')]);router[_0xddce('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0xddce('0xe')](_0xddce('0xf'),auth['isAuthenticated'](),controller[_0xddce('0x10')]);router[_0xddce('0xe')](_0xddce('0x11'),auth['isAuthenticated'](),controller[_0xddce('0x12')]);router['put'](_0xddce('0xa'),auth[_0xddce('0xb')](),controller[_0xddce('0x13')]);router[_0xddce('0x14')](_0xddce('0xa'),auth[_0xddce('0xb')](),controller[_0xddce('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index 9c34b4f..d465eaf 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 _0xb7cc=['exports','STRING','sequelize'];(function(_0x458363,_0x1675db){var _0x4d0290=function(_0x22960f){while(--_0x22960f){_0x458363['push'](_0x458363['shift']());}};_0x4d0290(++_0x1675db);}(_0xb7cc,0x1df));var _0xcb7c=function(_0x342baa,_0x4a110f){_0x342baa=_0x342baa-0x0;var _0x1208f3=_0xb7cc[_0x342baa];return _0x1208f3;};'use strict';var Sequelize=require(_0xcb7c('0x0'));module[_0xcb7c('0x1')]={'name':{'type':Sequelize[_0xcb7c('0x2')]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xcb7c('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0x46e3=['STRING','sequelize'];(function(_0x2b80a0,_0x49eaa2){var _0x1d2d3a=function(_0x3c9180){while(--_0x3c9180){_0x2b80a0['push'](_0x2b80a0['shift']());}};_0x1d2d3a(++_0x49eaa2);}(_0x46e3,0x121));var _0x346e=function(_0x4fd4b3,_0xa87ffd){_0x4fd4b3=_0x4fd4b3-0x0;var _0x19ad88=_0x46e3[_0x4fd4b3];return _0x19ad88;};'use strict';var Sequelize=require(_0x346e('0x0'));module['exports']={'name':{'type':Sequelize[_0x346e('0x1')]},'description':{'type':Sequelize[_0x346e('0x1')]},'interval':{'type':Sequelize[_0x346e('0x1')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index 6182123..7dff082 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 _0x3b99=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','get','then','end','stack','name','index','map','Interval','rawAttributes','type','model','query','keys','filters','intersection','fields','attributes','length','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','find','create','role','Intervals','UserProfileSection','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','addInterval','IntervalId','getIntervals','findOne','hasOwnProperty','nolimit','transaction','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','ejs','fs-extra','squel','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x5f47b6,_0xdfe79d){var _0x31bb2d=function(_0x32e3ca){while(--_0x32e3ca){_0x5f47b6['push'](_0x5f47b6['shift']());}};_0x31bb2d(++_0xdfe79d);}(_0x3b99,0x9b));var _0x93b9=function(_0x93b863,_0x2bbe3b){_0x93b863=_0x93b863-0x0;var _0x1dff77=_0x3b99[_0x93b863];return _0x1dff77;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x93b9('0x0'));var zipdir=require(_0x93b9('0x1'));var jsonpatch=require(_0x93b9('0x2'));var rp=require(_0x93b9('0x3'));var moment=require(_0x93b9('0x4'));var BPromise=require(_0x93b9('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x93b9('0x6'));var sox=require(_0x93b9('0x7'));var csv=require('to-csv');var ejs=require(_0x93b9('0x8'));var fs=require('fs');var fs_extra=require(_0x93b9('0x9'));var _=require('lodash');var squel=require(_0x93b9('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x93b9('0xb'));var toCsv=require(_0x93b9('0xc'));var querystring=require(_0x93b9('0xd'));var Papa=require(_0x93b9('0xe'));var Redis=require(_0x93b9('0xf'));var authService=require(_0x93b9('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x93b9('0x11'));var hardwareService=require(_0x93b9('0x12'));var logger=require(_0x93b9('0x13'))(_0x93b9('0x14'));var utils=require('../../config/utils');var config=require(_0x93b9('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x93b9('0x16'))['db'];var extensions=require(_0x93b9('0x17'));function respondWithStatusCode(_0x21e937,_0x5e29a9){_0x5e29a9=_0x5e29a9||0xcc;return function(_0x3556b5){if(_0x3556b5){return _0x21e937[_0x93b9('0x18')](_0x5e29a9);}return _0x21e937[_0x93b9('0x19')](_0x5e29a9)['end']();};}function respondWithResult(_0x8cb426,_0x3cdf1d){_0x3cdf1d=_0x3cdf1d||0xc8;return function(_0x45decb){if(_0x45decb){return _0x8cb426['status'](_0x3cdf1d)[_0x93b9('0x1a')](_0x45decb);}};}function respondWithFilteredResult(_0x205afd,_0x1789cf){return function(_0x1941fa){if(_0x1941fa){var _0x32609b=typeof _0x1789cf[_0x93b9('0x1b')]===_0x93b9('0x1c')&&typeof _0x1789cf[_0x93b9('0x1d')]===_0x93b9('0x1c');var _0x2fbca3=_0x1941fa[_0x93b9('0x1e')];var _0x8cd9d6=_0x32609b?0x0:_0x1789cf[_0x93b9('0x1b')];var _0xfb5300=_0x32609b?_0x1941fa[_0x93b9('0x1e')]:_0x1789cf['offset']+_0x1789cf[_0x93b9('0x1d')];var _0x11e1d1;if(_0xfb5300>=_0x2fbca3){_0xfb5300=_0x2fbca3;_0x11e1d1=0xc8;}else{_0x11e1d1=0xce;}_0x205afd[_0x93b9('0x19')](_0x11e1d1);return _0x205afd[_0x93b9('0x1f')](_0x93b9('0x20'),_0x8cd9d6+'-'+_0xfb5300+'/'+_0x2fbca3)[_0x93b9('0x1a')](_0x1941fa);}return null;};}function patchUpdates(_0xcb2739){return function(_0x336237){try{jsonpatch[_0x93b9('0x21')](_0x336237,_0xcb2739,!![]);}catch(_0x5329f3){return BPromise[_0x93b9('0x22')](_0x5329f3);}return _0x336237['save']();};}function saveUpdates(_0xb73d22,_0x14342c){return function(_0x375208){if(_0x375208){return _0x375208[_0x93b9('0x23')](_0xb73d22)['then'](function(_0x4775bd){return _0x4775bd;});}return null;};}function removeEntity(_0x35c2a2,_0x30f5b2){return function(_0xe43b34){if(_0xe43b34){return _0xe43b34[_0x93b9('0x24')]()['then'](function(){var _0x1863ce=_0xe43b34[_0x93b9('0x25')]({'plain':!![]});var _0xbb454e='Intervals';return db['UserProfileResource'][_0x93b9('0x24')]({'where':{'type':_0xbb454e,'resourceId':_0x1863ce['id']}})[_0x93b9('0x26')](function(){return _0xe43b34;});})[_0x93b9('0x26')](function(){_0x35c2a2[_0x93b9('0x19')](0xcc)[_0x93b9('0x27')]();});}};}function handleEntityNotFound(_0x197ba9,_0x3d5005){return function(_0x570ef9){if(!_0x570ef9){_0x197ba9[_0x93b9('0x18')](0x194);}return _0x570ef9;};}function handleError(_0x279047,_0x457546){_0x457546=_0x457546||0x1f4;return function(_0x2946ed){logger['error'](_0x2946ed[_0x93b9('0x28')]);if(_0x2946ed[_0x93b9('0x29')]){delete _0x2946ed[_0x93b9('0x29')];}_0x279047[_0x93b9('0x19')](_0x457546)['send'](_0x2946ed);};}exports[_0x93b9('0x2a')]=function(_0x4228b4,_0x36a7f8){var _0x940293={},_0x1b0eb6={},_0x2d9b1e={'count':0x0,'rows':[]};var _0x282e47=_[_0x93b9('0x2b')](db[_0x93b9('0x2c')][_0x93b9('0x2d')],function(_0x24e70c){return{'name':_0x24e70c['fieldName'],'type':_0x24e70c[_0x93b9('0x2e')]['key']};});_0x1b0eb6[_0x93b9('0x2f')]=_[_0x93b9('0x2b')](_0x282e47,_0x93b9('0x29'));_0x1b0eb6[_0x93b9('0x30')]=_[_0x93b9('0x31')](_0x4228b4[_0x93b9('0x30')]);_0x1b0eb6[_0x93b9('0x32')]=_[_0x93b9('0x33')](_0x1b0eb6[_0x93b9('0x2f')],_0x1b0eb6[_0x93b9('0x30')]);_0x940293['attributes']=_[_0x93b9('0x33')](_0x1b0eb6[_0x93b9('0x2f')],qs['fields'](_0x4228b4[_0x93b9('0x30')][_0x93b9('0x34')]));_0x940293[_0x93b9('0x35')]=_0x940293['attributes'][_0x93b9('0x36')]?_0x940293[_0x93b9('0x35')]:_0x1b0eb6[_0x93b9('0x2f')];if(!_0x4228b4[_0x93b9('0x30')]['hasOwnProperty']('nolimit')){_0x940293[_0x93b9('0x1d')]=qs[_0x93b9('0x1d')](_0x4228b4['query'][_0x93b9('0x1d')]);_0x940293['offset']=qs[_0x93b9('0x1b')](_0x4228b4[_0x93b9('0x30')][_0x93b9('0x1b')]);}_0x940293[_0x93b9('0x37')]=qs[_0x93b9('0x38')](_0x4228b4[_0x93b9('0x30')][_0x93b9('0x38')]);_0x940293[_0x93b9('0x39')]=qs[_0x93b9('0x32')](_[_0x93b9('0x3a')](_0x4228b4[_0x93b9('0x30')],_0x1b0eb6['filters']),_0x282e47);if(_0x4228b4[_0x93b9('0x30')][_0x93b9('0x3b')]){_0x940293[_0x93b9('0x39')]=_[_0x93b9('0x3c')](_0x940293[_0x93b9('0x39')],{'$or':_[_0x93b9('0x2b')](_0x282e47,function(_0x252974){if(_0x252974[_0x93b9('0x2e')]!==_0x93b9('0x3d')){var _0x823cdd={};_0x823cdd[_0x252974['name']]={'$like':'%'+_0x4228b4[_0x93b9('0x30')][_0x93b9('0x3b')]+'%'};return _0x823cdd;}})});}_0x940293=_['merge']({},_0x940293,_0x4228b4[_0x93b9('0x3e')]);var _0x1d3508={'where':_0x940293[_0x93b9('0x39')]};return db['Interval'][_0x93b9('0x1e')](_0x1d3508)[_0x93b9('0x26')](function(_0x4ffe00){_0x2d9b1e['count']=_0x4ffe00;if(_0x4228b4[_0x93b9('0x30')]['includeAll']){_0x940293[_0x93b9('0x3f')]=[{'all':!![]}];}return db[_0x93b9('0x2c')][_0x93b9('0x40')](_0x940293);})[_0x93b9('0x26')](function(_0x11fc63){_0x2d9b1e[_0x93b9('0x41')]=_0x11fc63;return _0x2d9b1e;})[_0x93b9('0x26')](respondWithFilteredResult(_0x36a7f8,_0x940293))[_0x93b9('0x42')](handleError(_0x36a7f8,null));};exports[_0x93b9('0x43')]=function(_0x24b740,_0x5676fc){var _0x589ba4={'raw':!![],'where':{'id':_0x24b740[_0x93b9('0x44')]['id']}},_0x3356a1={};_0x3356a1[_0x93b9('0x2f')]=_['keys'](db['Interval']['rawAttributes']);_0x3356a1[_0x93b9('0x30')]=_[_0x93b9('0x31')](_0x24b740[_0x93b9('0x30')]);_0x3356a1[_0x93b9('0x32')]=_['intersection'](_0x3356a1[_0x93b9('0x2f')],_0x3356a1[_0x93b9('0x30')]);_0x589ba4['attributes']=_[_0x93b9('0x33')](_0x3356a1[_0x93b9('0x2f')],qs[_0x93b9('0x34')](_0x24b740[_0x93b9('0x30')][_0x93b9('0x34')]));_0x589ba4[_0x93b9('0x35')]=_0x589ba4[_0x93b9('0x35')][_0x93b9('0x36')]?_0x589ba4['attributes']:_0x3356a1[_0x93b9('0x2f')];if(_0x24b740[_0x93b9('0x30')]['includeAll']){_0x589ba4[_0x93b9('0x3f')]=[{'all':!![]}];}_0x589ba4=_[_0x93b9('0x3c')]({},_0x589ba4,_0x24b740[_0x93b9('0x3e')]);return db[_0x93b9('0x2c')][_0x93b9('0x45')](_0x589ba4)[_0x93b9('0x26')](handleEntityNotFound(_0x5676fc,null))[_0x93b9('0x26')](respondWithResult(_0x5676fc,null))[_0x93b9('0x42')](handleError(_0x5676fc,null));};exports[_0x93b9('0x46')]=function(_0x508137,_0x31d17c){return db['Interval'][_0x93b9('0x46')](_0x508137['body'],{})['then'](function(_0x133ff6){var _0x81966c=_0x508137['user'][_0x93b9('0x25')]({'plain':!![]});if(!_0x81966c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x81966c[_0x93b9('0x47')]==='user'){var _0x14e879=_0x133ff6[_0x93b9('0x25')]({'plain':!![]});var _0x2912d3=_0x93b9('0x48');return db[_0x93b9('0x49')]['find']({'where':{'name':_0x2912d3,'userProfileId':_0x81966c['userProfileId']},'raw':!![]})[_0x93b9('0x26')](function(_0x41c330){if(_0x41c330&&_0x41c330[_0x93b9('0x4a')]===0x0){return db[_0x93b9('0x4b')]['create']({'name':_0x14e879[_0x93b9('0x29')],'resourceId':_0x14e879['id'],'type':_0x41c330[_0x93b9('0x29')],'sectionId':_0x41c330['id']},{})[_0x93b9('0x26')](function(){return _0x133ff6;});}else{return _0x133ff6;}})[_0x93b9('0x42')](function(_0x4ab6ea){logger[_0x93b9('0x4c')](_0x93b9('0x4d'),_0x4ab6ea);throw _0x4ab6ea;});}return _0x133ff6;})[_0x93b9('0x26')](respondWithResult(_0x31d17c,0xc9))[_0x93b9('0x42')](handleError(_0x31d17c,null));};exports[_0x93b9('0x23')]=function(_0x2029ef,_0x20b2f2){if(_0x2029ef[_0x93b9('0x4e')]['id']){delete _0x2029ef[_0x93b9('0x4e')]['id'];}return db['Interval'][_0x93b9('0x45')]({'where':{'id':_0x2029ef[_0x93b9('0x44')]['id']}})[_0x93b9('0x26')](handleEntityNotFound(_0x20b2f2,null))['then'](saveUpdates(_0x2029ef['body'],null))['then'](respondWithResult(_0x20b2f2,null))[_0x93b9('0x42')](handleError(_0x20b2f2,null));};exports[_0x93b9('0x24')]=function(_0xe64dca,_0x42b5d8){return db['Interval'][_0x93b9('0x45')]({'where':{'id':_0xe64dca[_0x93b9('0x44')]['id']}})['then'](handleEntityNotFound(_0x42b5d8,null))[_0x93b9('0x26')](removeEntity(_0x42b5d8,null))[_0x93b9('0x42')](handleError(_0x42b5d8,null));};exports[_0x93b9('0x4f')]=function(_0x350c8e,_0x450b7f,_0x5d5d04){if(_0x350c8e[_0x93b9('0x4e')]['id']){delete _0x350c8e[_0x93b9('0x4e')]['id'];}return db[_0x93b9('0x2c')][_0x93b9('0x45')]({'where':{'id':_0x350c8e['params']['id']}})[_0x93b9('0x26')](handleEntityNotFound(_0x450b7f,null))[_0x93b9('0x26')](function(_0x4bc9af){if(_0x4bc9af){_0x350c8e[_0x93b9('0x4e')][_0x93b9('0x50')]=_0x4bc9af['id'];return db[_0x93b9('0x2c')][_0x93b9('0x46')](_0x350c8e[_0x93b9('0x4e')]);}})[_0x93b9('0x26')](respondWithResult(_0x450b7f,null))['catch'](handleError(_0x450b7f,null));};exports[_0x93b9('0x51')]=function(_0x3d4941,_0x466440,_0x5a1870){var _0x386fe7={};var _0x3d69a5={};var _0x1b5484;var _0x30ad11;return db[_0x93b9('0x2c')][_0x93b9('0x52')]({'where':{'id':_0x3d4941[_0x93b9('0x44')]['id']}})[_0x93b9('0x26')](handleEntityNotFound(_0x466440,null))[_0x93b9('0x26')](function(_0x519ea8){if(_0x519ea8){_0x1b5484=_0x519ea8;_0x3d69a5[_0x93b9('0x2f')]=_[_0x93b9('0x31')](db[_0x93b9('0x2c')][_0x93b9('0x2d')]);_0x3d69a5[_0x93b9('0x30')]=_[_0x93b9('0x31')](_0x3d4941[_0x93b9('0x30')]);_0x3d69a5[_0x93b9('0x32')]=_[_0x93b9('0x33')](_0x3d69a5[_0x93b9('0x2f')],_0x3d69a5[_0x93b9('0x30')]);_0x386fe7[_0x93b9('0x35')]=_['intersection'](_0x3d69a5['model'],qs[_0x93b9('0x34')](_0x3d4941[_0x93b9('0x30')][_0x93b9('0x34')]));_0x386fe7[_0x93b9('0x35')]=_0x386fe7[_0x93b9('0x35')][_0x93b9('0x36')]?_0x386fe7[_0x93b9('0x35')]:_0x3d69a5['model'];_0x386fe7['order']=qs['sort'](_0x3d4941[_0x93b9('0x30')][_0x93b9('0x38')]);_0x386fe7[_0x93b9('0x39')]=qs[_0x93b9('0x32')](_['pick'](_0x3d4941[_0x93b9('0x30')],_0x3d69a5[_0x93b9('0x32')]));if(_0x3d4941[_0x93b9('0x30')]['filter']){_0x386fe7[_0x93b9('0x39')]=_[_0x93b9('0x3c')](_0x386fe7[_0x93b9('0x39')],{'$or':_[_0x93b9('0x2b')](_0x386fe7['attributes'],function(_0x1fec3f){var _0x21ae2d={};_0x21ae2d[_0x1fec3f]={'$like':'%'+_0x3d4941[_0x93b9('0x30')][_0x93b9('0x3b')]+'%'};return _0x21ae2d;})});}_0x386fe7=_[_0x93b9('0x3c')]({},_0x386fe7,_0x3d4941['options']);return _0x1b5484[_0x93b9('0x51')](_0x386fe7);}})[_0x93b9('0x26')](function(_0x7e15fa){if(_0x7e15fa){_0x30ad11=_0x7e15fa[_0x93b9('0x36')];if(!_0x3d4941[_0x93b9('0x30')][_0x93b9('0x53')](_0x93b9('0x54'))){_0x386fe7['limit']=qs[_0x93b9('0x1d')](_0x3d4941[_0x93b9('0x30')][_0x93b9('0x1d')]);_0x386fe7[_0x93b9('0x1b')]=qs[_0x93b9('0x1b')](_0x3d4941[_0x93b9('0x30')][_0x93b9('0x1b')]);}return _0x1b5484['getIntervals'](_0x386fe7);}})['then'](function(_0x4f350c){if(_0x4f350c){return _0x4f350c?{'count':_0x30ad11,'rows':_0x4f350c}:null;}})['then'](respondWithResult(_0x466440,null))[_0x93b9('0x42')](handleError(_0x466440,null));};exports['addIntervals']=function(_0x1e7bd1,_0x476da5,_0x39e84b){return db[_0x93b9('0x2c')]['findOne']({'where':{'id':_0x1e7bd1['params']['id']}})[_0x93b9('0x26')](handleEntityNotFound(_0x476da5,null))[_0x93b9('0x26')](function(_0x2c9555){if(_0x2c9555){return db['sequelize'][_0x93b9('0x55')](function(_0x1e7d30){return db[_0x93b9('0x2c')][_0x93b9('0x24')]({'where':{'IntervalId':_0x1e7bd1['params']['id']},'transaction':_0x1e7d30})[_0x93b9('0x26')](function(_0x2d2c5b){var _0x1acc39=_[_0x93b9('0x2b')](_0x1e7bd1['body'],function(_0x916576){delete _0x916576['id'];_0x916576[_0x93b9('0x50')]=_0x1e7bd1[_0x93b9('0x44')]['id'];return _0x916576;});return db[_0x93b9('0x2c')]['bulkCreate'](_0x1acc39,{'transaction':_0x1e7d30});});})['then'](function(){return db[_0x93b9('0x2c')][_0x93b9('0x40')]({'where':{'IntervalId':_0x1e7bd1[_0x93b9('0x44')]['id']}});});}})['then'](respondWithResult(_0x476da5,null))[_0x93b9('0x42')](handleError(_0x476da5,null));}; \ No newline at end of file +var _0x7baa=['api','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','status','json','offset','undefined','limit','count','set','apply','reject','then','destroy','get','Intervals','end','sendStatus','stack','send','map','Interval','rawAttributes','fieldName','type','key','name','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filters','filter','where','merge','options','includeAll','findAll','rows','catch','show','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','IntervalId','findOne','getIntervals','addIntervals','sequelize','bulkCreate','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x7baa,0x1ab));var _0xa7ba=function(_0x48b5e0,_0xb3826){_0x48b5e0=_0x48b5e0-0x0;var _0x4287ea=_0x7baa[_0x48b5e0];return _0x4287ea;};'use strict';var emlformat=require(_0xa7ba('0x0'));var rimraf=require(_0xa7ba('0x1'));var zipdir=require(_0xa7ba('0x2'));var jsonpatch=require(_0xa7ba('0x3'));var rp=require(_0xa7ba('0x4'));var moment=require(_0xa7ba('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xa7ba('0x6'));var util=require('util');var path=require(_0xa7ba('0x7'));var sox=require(_0xa7ba('0x8'));var csv=require(_0xa7ba('0x9'));var ejs=require(_0xa7ba('0xa'));var fs=require('fs');var fs_extra=require(_0xa7ba('0xb'));var _=require(_0xa7ba('0xc'));var squel=require(_0xa7ba('0xd'));var crypto=require(_0xa7ba('0xe'));var jsforce=require(_0xa7ba('0xf'));var deskjs=require(_0xa7ba('0x10'));var toCsv=require(_0xa7ba('0x9'));var querystring=require('querystring');var Papa=require(_0xa7ba('0x11'));var Redis=require(_0xa7ba('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xa7ba('0x13'));var as=require(_0xa7ba('0x14'));var hardwareService=require(_0xa7ba('0x15'));var logger=require(_0xa7ba('0x16'))(_0xa7ba('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xa7ba('0x18'));var db=require(_0xa7ba('0x19'))['db'];var extensions=require(_0xa7ba('0x1a'));function respondWithStatusCode(_0x47ac44,_0x4adfa6){_0x4adfa6=_0x4adfa6||0xcc;return function(_0x48702a){if(_0x48702a){return _0x47ac44['sendStatus'](_0x4adfa6);}return _0x47ac44[_0xa7ba('0x1b')](_0x4adfa6)['end']();};}function respondWithResult(_0x12b7bb,_0x384ea0){_0x384ea0=_0x384ea0||0xc8;return function(_0x2922da){if(_0x2922da){return _0x12b7bb[_0xa7ba('0x1b')](_0x384ea0)[_0xa7ba('0x1c')](_0x2922da);}};}function respondWithFilteredResult(_0x160d74,_0x444ba0){return function(_0x5770f9){if(_0x5770f9){var _0x4d4049=typeof _0x444ba0[_0xa7ba('0x1d')]===_0xa7ba('0x1e')&&typeof _0x444ba0[_0xa7ba('0x1f')]===_0xa7ba('0x1e');var _0x4c078c=_0x5770f9[_0xa7ba('0x20')];var _0x4df30f=_0x4d4049?0x0:_0x444ba0[_0xa7ba('0x1d')];var _0x9422c3=_0x4d4049?_0x5770f9['count']:_0x444ba0[_0xa7ba('0x1d')]+_0x444ba0[_0xa7ba('0x1f')];var _0x2c40e1;if(_0x9422c3>=_0x4c078c){_0x9422c3=_0x4c078c;_0x2c40e1=0xc8;}else{_0x2c40e1=0xce;}_0x160d74[_0xa7ba('0x1b')](_0x2c40e1);return _0x160d74[_0xa7ba('0x21')]('Content-Range',_0x4df30f+'-'+_0x9422c3+'/'+_0x4c078c)[_0xa7ba('0x1c')](_0x5770f9);}return null;};}function patchUpdates(_0x26049d){return function(_0x3c968c){try{jsonpatch[_0xa7ba('0x22')](_0x3c968c,_0x26049d,!![]);}catch(_0x35033d){return BPromise[_0xa7ba('0x23')](_0x35033d);}return _0x3c968c['save']();};}function saveUpdates(_0x42bc67,_0x414f50){return function(_0x2a983d){if(_0x2a983d){return _0x2a983d['update'](_0x42bc67)[_0xa7ba('0x24')](function(_0x2ad83c){return _0x2ad83c;});}return null;};}function removeEntity(_0x4cafa7,_0x1fcfaa){return function(_0x15f7e0){if(_0x15f7e0){return _0x15f7e0[_0xa7ba('0x25')]()[_0xa7ba('0x24')](function(){var _0x580eb1=_0x15f7e0[_0xa7ba('0x26')]({'plain':!![]});var _0x2beb2b=_0xa7ba('0x27');return db['UserProfileResource']['destroy']({'where':{'type':_0x2beb2b,'resourceId':_0x580eb1['id']}})[_0xa7ba('0x24')](function(){return _0x15f7e0;});})[_0xa7ba('0x24')](function(){_0x4cafa7['status'](0xcc)[_0xa7ba('0x28')]();});}};}function handleEntityNotFound(_0x6211d9,_0x569efc){return function(_0x33b3b4){if(!_0x33b3b4){_0x6211d9[_0xa7ba('0x29')](0x194);}return _0x33b3b4;};}function handleError(_0x5e395c,_0x2e7d4e){_0x2e7d4e=_0x2e7d4e||0x1f4;return function(_0x38132d){logger['error'](_0x38132d[_0xa7ba('0x2a')]);if(_0x38132d['name']){delete _0x38132d['name'];}_0x5e395c[_0xa7ba('0x1b')](_0x2e7d4e)[_0xa7ba('0x2b')](_0x38132d);};}exports['index']=function(_0x40cbb0,_0xe8ffb1){var _0x151650={},_0xd27a9f={},_0x4cd29e={'count':0x0,'rows':[]};var _0x4f7901=_[_0xa7ba('0x2c')](db[_0xa7ba('0x2d')][_0xa7ba('0x2e')],function(_0x2ff921){return{'name':_0x2ff921[_0xa7ba('0x2f')],'type':_0x2ff921[_0xa7ba('0x30')][_0xa7ba('0x31')]};});_0xd27a9f['model']=_['map'](_0x4f7901,_0xa7ba('0x32'));_0xd27a9f[_0xa7ba('0x33')]=_[_0xa7ba('0x34')](_0x40cbb0[_0xa7ba('0x33')]);_0xd27a9f['filters']=_[_0xa7ba('0x35')](_0xd27a9f[_0xa7ba('0x36')],_0xd27a9f[_0xa7ba('0x33')]);_0x151650[_0xa7ba('0x37')]=_['intersection'](_0xd27a9f[_0xa7ba('0x36')],qs[_0xa7ba('0x38')](_0x40cbb0[_0xa7ba('0x33')][_0xa7ba('0x38')]));_0x151650[_0xa7ba('0x37')]=_0x151650[_0xa7ba('0x37')][_0xa7ba('0x39')]?_0x151650[_0xa7ba('0x37')]:_0xd27a9f['model'];if(!_0x40cbb0['query'][_0xa7ba('0x3a')](_0xa7ba('0x3b'))){_0x151650['limit']=qs[_0xa7ba('0x1f')](_0x40cbb0[_0xa7ba('0x33')][_0xa7ba('0x1f')]);_0x151650['offset']=qs['offset'](_0x40cbb0[_0xa7ba('0x33')]['offset']);}_0x151650[_0xa7ba('0x3c')]=qs['sort'](_0x40cbb0[_0xa7ba('0x33')][_0xa7ba('0x3d')]);_0x151650['where']=qs['filters'](_[_0xa7ba('0x3e')](_0x40cbb0[_0xa7ba('0x33')],_0xd27a9f[_0xa7ba('0x3f')]),_0x4f7901);if(_0x40cbb0['query'][_0xa7ba('0x40')]){_0x151650[_0xa7ba('0x41')]=_[_0xa7ba('0x42')](_0x151650[_0xa7ba('0x41')],{'$or':_['map'](_0x4f7901,function(_0x19fa4d){if(_0x19fa4d['type']!=='VIRTUAL'){var _0xf142f={};_0xf142f[_0x19fa4d['name']]={'$like':'%'+_0x40cbb0['query']['filter']+'%'};return _0xf142f;}})});}_0x151650=_[_0xa7ba('0x42')]({},_0x151650,_0x40cbb0[_0xa7ba('0x43')]);var _0x4ff643={'where':_0x151650['where']};return db[_0xa7ba('0x2d')]['count'](_0x4ff643)[_0xa7ba('0x24')](function(_0x53456d){_0x4cd29e[_0xa7ba('0x20')]=_0x53456d;if(_0x40cbb0[_0xa7ba('0x33')][_0xa7ba('0x44')]){_0x151650['include']=[{'all':!![]}];}return db[_0xa7ba('0x2d')][_0xa7ba('0x45')](_0x151650);})[_0xa7ba('0x24')](function(_0x4145ce){_0x4cd29e[_0xa7ba('0x46')]=_0x4145ce;return _0x4cd29e;})[_0xa7ba('0x24')](respondWithFilteredResult(_0xe8ffb1,_0x151650))[_0xa7ba('0x47')](handleError(_0xe8ffb1,null));};exports[_0xa7ba('0x48')]=function(_0x1e5b52,_0x1bb752){var _0x1fb946={'raw':!![],'where':{'id':_0x1e5b52[_0xa7ba('0x49')]['id']}},_0x5f34b3={};_0x5f34b3[_0xa7ba('0x36')]=_[_0xa7ba('0x34')](db[_0xa7ba('0x2d')]['rawAttributes']);_0x5f34b3[_0xa7ba('0x33')]=_[_0xa7ba('0x34')](_0x1e5b52[_0xa7ba('0x33')]);_0x5f34b3[_0xa7ba('0x3f')]=_[_0xa7ba('0x35')](_0x5f34b3[_0xa7ba('0x36')],_0x5f34b3[_0xa7ba('0x33')]);_0x1fb946['attributes']=_[_0xa7ba('0x35')](_0x5f34b3[_0xa7ba('0x36')],qs[_0xa7ba('0x38')](_0x1e5b52[_0xa7ba('0x33')][_0xa7ba('0x38')]));_0x1fb946[_0xa7ba('0x37')]=_0x1fb946[_0xa7ba('0x37')][_0xa7ba('0x39')]?_0x1fb946['attributes']:_0x5f34b3[_0xa7ba('0x36')];if(_0x1e5b52[_0xa7ba('0x33')]['includeAll']){_0x1fb946['include']=[{'all':!![]}];}_0x1fb946=_[_0xa7ba('0x42')]({},_0x1fb946,_0x1e5b52[_0xa7ba('0x43')]);return db[_0xa7ba('0x2d')]['find'](_0x1fb946)[_0xa7ba('0x24')](handleEntityNotFound(_0x1bb752,null))[_0xa7ba('0x24')](respondWithResult(_0x1bb752,null))['catch'](handleError(_0x1bb752,null));};exports[_0xa7ba('0x4a')]=function(_0x4f7010,_0x2d6b62){return db[_0xa7ba('0x2d')][_0xa7ba('0x4a')](_0x4f7010[_0xa7ba('0x4b')],{})[_0xa7ba('0x24')](function(_0x6471a5){var _0x53bfe3=_0x4f7010[_0xa7ba('0x4c')][_0xa7ba('0x26')]({'plain':!![]});if(!_0x53bfe3)throw new Error(_0xa7ba('0x4d'));if(_0x53bfe3[_0xa7ba('0x4e')]==='user'){var _0x56da24=_0x6471a5[_0xa7ba('0x26')]({'plain':!![]});var _0x59a286=_0xa7ba('0x27');return db[_0xa7ba('0x4f')][_0xa7ba('0x50')]({'where':{'name':_0x59a286,'userProfileId':_0x53bfe3[_0xa7ba('0x51')]},'raw':!![]})[_0xa7ba('0x24')](function(_0x5d6f22){if(_0x5d6f22&&_0x5d6f22['autoAssociation']===0x0){return db['UserProfileResource'][_0xa7ba('0x4a')]({'name':_0x56da24[_0xa7ba('0x32')],'resourceId':_0x56da24['id'],'type':_0x5d6f22[_0xa7ba('0x32')],'sectionId':_0x5d6f22['id']},{})[_0xa7ba('0x24')](function(){return _0x6471a5;});}else{return _0x6471a5;}})[_0xa7ba('0x47')](function(_0x4eb53d){logger[_0xa7ba('0x52')](_0xa7ba('0x53'),_0x4eb53d);throw _0x4eb53d;});}return _0x6471a5;})[_0xa7ba('0x24')](respondWithResult(_0x2d6b62,0xc9))['catch'](handleError(_0x2d6b62,null));};exports['update']=function(_0x51db10,_0x5405ab){if(_0x51db10['body']['id']){delete _0x51db10[_0xa7ba('0x4b')]['id'];}return db['Interval'][_0xa7ba('0x50')]({'where':{'id':_0x51db10['params']['id']}})[_0xa7ba('0x24')](handleEntityNotFound(_0x5405ab,null))[_0xa7ba('0x24')](saveUpdates(_0x51db10[_0xa7ba('0x4b')],null))['then'](respondWithResult(_0x5405ab,null))[_0xa7ba('0x47')](handleError(_0x5405ab,null));};exports[_0xa7ba('0x25')]=function(_0x14c86b,_0x36a56f){return db[_0xa7ba('0x2d')][_0xa7ba('0x50')]({'where':{'id':_0x14c86b[_0xa7ba('0x49')]['id']}})[_0xa7ba('0x24')](handleEntityNotFound(_0x36a56f,null))[_0xa7ba('0x24')](removeEntity(_0x36a56f,null))[_0xa7ba('0x47')](handleError(_0x36a56f,null));};exports['addInterval']=function(_0x32ff76,_0xab02c0,_0x5f3576){if(_0x32ff76['body']['id']){delete _0x32ff76['body']['id'];}return db['Interval']['find']({'where':{'id':_0x32ff76['params']['id']}})[_0xa7ba('0x24')](handleEntityNotFound(_0xab02c0,null))[_0xa7ba('0x24')](function(_0x5a74c9){if(_0x5a74c9){_0x32ff76[_0xa7ba('0x4b')][_0xa7ba('0x54')]=_0x5a74c9['id'];return db[_0xa7ba('0x2d')][_0xa7ba('0x4a')](_0x32ff76[_0xa7ba('0x4b')]);}})[_0xa7ba('0x24')](respondWithResult(_0xab02c0,null))[_0xa7ba('0x47')](handleError(_0xab02c0,null));};exports['getIntervals']=function(_0x2389f3,_0xe7618f,_0x4dab28){var _0x1c883d={};var _0x8fe573={};var _0x540d69;var _0x4ebb3f;return db['Interval'][_0xa7ba('0x55')]({'where':{'id':_0x2389f3[_0xa7ba('0x49')]['id']}})[_0xa7ba('0x24')](handleEntityNotFound(_0xe7618f,null))[_0xa7ba('0x24')](function(_0x411d13){if(_0x411d13){_0x540d69=_0x411d13;_0x8fe573[_0xa7ba('0x36')]=_[_0xa7ba('0x34')](db[_0xa7ba('0x2d')][_0xa7ba('0x2e')]);_0x8fe573['query']=_[_0xa7ba('0x34')](_0x2389f3[_0xa7ba('0x33')]);_0x8fe573[_0xa7ba('0x3f')]=_['intersection'](_0x8fe573[_0xa7ba('0x36')],_0x8fe573['query']);_0x1c883d[_0xa7ba('0x37')]=_[_0xa7ba('0x35')](_0x8fe573[_0xa7ba('0x36')],qs[_0xa7ba('0x38')](_0x2389f3['query'][_0xa7ba('0x38')]));_0x1c883d['attributes']=_0x1c883d[_0xa7ba('0x37')][_0xa7ba('0x39')]?_0x1c883d[_0xa7ba('0x37')]:_0x8fe573[_0xa7ba('0x36')];_0x1c883d[_0xa7ba('0x3c')]=qs[_0xa7ba('0x3d')](_0x2389f3['query'][_0xa7ba('0x3d')]);_0x1c883d['where']=qs[_0xa7ba('0x3f')](_['pick'](_0x2389f3[_0xa7ba('0x33')],_0x8fe573['filters']));if(_0x2389f3['query'][_0xa7ba('0x40')]){_0x1c883d[_0xa7ba('0x41')]=_['merge'](_0x1c883d[_0xa7ba('0x41')],{'$or':_[_0xa7ba('0x2c')](_0x1c883d['attributes'],function(_0x48558e){var _0x4f8985={};_0x4f8985[_0x48558e]={'$like':'%'+_0x2389f3[_0xa7ba('0x33')][_0xa7ba('0x40')]+'%'};return _0x4f8985;})});}_0x1c883d=_[_0xa7ba('0x42')]({},_0x1c883d,_0x2389f3[_0xa7ba('0x43')]);return _0x540d69['getIntervals'](_0x1c883d);}})[_0xa7ba('0x24')](function(_0x4d4030){if(_0x4d4030){_0x4ebb3f=_0x4d4030[_0xa7ba('0x39')];if(!_0x2389f3[_0xa7ba('0x33')][_0xa7ba('0x3a')](_0xa7ba('0x3b'))){_0x1c883d['limit']=qs['limit'](_0x2389f3['query'][_0xa7ba('0x1f')]);_0x1c883d[_0xa7ba('0x1d')]=qs[_0xa7ba('0x1d')](_0x2389f3[_0xa7ba('0x33')][_0xa7ba('0x1d')]);}return _0x540d69[_0xa7ba('0x56')](_0x1c883d);}})[_0xa7ba('0x24')](function(_0x19e50b){if(_0x19e50b){return _0x19e50b?{'count':_0x4ebb3f,'rows':_0x19e50b}:null;}})['then'](respondWithResult(_0xe7618f,null))[_0xa7ba('0x47')](handleError(_0xe7618f,null));};exports[_0xa7ba('0x57')]=function(_0x449738,_0x1189cf,_0x5c2c53){return db[_0xa7ba('0x2d')][_0xa7ba('0x55')]({'where':{'id':_0x449738[_0xa7ba('0x49')]['id']}})[_0xa7ba('0x24')](handleEntityNotFound(_0x1189cf,null))[_0xa7ba('0x24')](function(_0x4ae710){if(_0x4ae710){return db[_0xa7ba('0x58')]['transaction'](function(_0x4946e9){return db[_0xa7ba('0x2d')][_0xa7ba('0x25')]({'where':{'IntervalId':_0x449738[_0xa7ba('0x49')]['id']},'transaction':_0x4946e9})['then'](function(_0x1e281c){var _0x695ef5=_['map'](_0x449738[_0xa7ba('0x4b')],function(_0x58ea78){delete _0x58ea78['id'];_0x58ea78[_0xa7ba('0x54')]=_0x449738[_0xa7ba('0x49')]['id'];return _0x58ea78;});return db[_0xa7ba('0x2d')][_0xa7ba('0x59')](_0x695ef5,{'transaction':_0x4946e9});});})['then'](function(){return db['Interval'][_0xa7ba('0x45')]({'where':{'IntervalId':_0x449738[_0xa7ba('0x49')]['id']}});});}})[_0xa7ba('0x24')](respondWithResult(_0x1189cf,null))[_0xa7ba('0x47')](handleError(_0x1189cf,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index d8e5963..51a118d 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 _0xc729=['string','getIntervals','all','map','then','reduce','./interval.attributes','../../components/extensions/rewrite','../../utils/iftime','iftime','exports','define','Interval','tools_intervals','rewrite','interval'];(function(_0x143682,_0x22cfa8){var _0x5712c3=function(_0x11cec6){while(--_0x11cec6){_0x143682['push'](_0x143682['shift']());}};_0x5712c3(++_0x22cfa8);}(_0xc729,0x186));var _0x9c72=function(_0x4a7a50,_0xccc04b){_0x4a7a50=_0x4a7a50-0x0;var _0x341a9a=_0xc729[_0x4a7a50];return _0x341a9a;};'use strict';var attributes=require(_0x9c72('0x0'));var extensions=require(_0x9c72('0x1'));var iftime=require(_0x9c72('0x2'))[_0x9c72('0x3')];module[_0x9c72('0x4')]=function(_0x18693c){return _0x18693c[_0x9c72('0x5')](_0x9c72('0x6'),attributes,{'tableName':_0x9c72('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x5754f3){extensions[_0x9c72('0x8')](_0x18693c,_0x5754f3);},'afterBulkCreate':function(_0x2b04ed,_0x39e643,_0x5f0d9f){_0x5f0d9f();extensions[_0x9c72('0x8')](_0x18693c,_0x2b04ed[0x0]);},'afterUpdate':function(_0x231513){extensions[_0x9c72('0x8')](_0x18693c,_0x231513);},'afterDestroy':function(_0x557035){extensions[_0x9c72('0x8')](_0x18693c,_0x557035);}},'instanceMethods':{'ifTime':function(_0x15687b=undefined,_0x30d3ec=new Date()){if(typeof this[_0x9c72('0x9')]===_0x9c72('0xa')){return iftime(this['interval'],_0x15687b,_0x30d3ec);}else{return this[_0x9c72('0xb')]()['then'](function(_0x48bb95){return Promise[_0x9c72('0xc')](_0x48bb95[_0x9c72('0xd')](function(_0x515625){return _0x515625['ifTime'](_0x15687b,_0x30d3ec);}));})[_0x9c72('0xe')](function(_0x39e177){return _0x39e177[_0x9c72('0xf')](function(_0x1833c7,_0x3fc3ef){return _0x1833c7||_0x3fc3ef;},![]);});}}}});}; \ No newline at end of file +var _0xe89a=['map','ifTime','reduce','./interval.attributes','../../utils/iftime','define','Interval','tools_intervals','rewrite','interval','string','then','all'];(function(_0x4ae829,_0x2c842c){var _0x256b31=function(_0x34f104){while(--_0x34f104){_0x4ae829['push'](_0x4ae829['shift']());}};_0x256b31(++_0x2c842c);}(_0xe89a,0x1e4));var _0xae89=function(_0x255d5b,_0x4f6f35){_0x255d5b=_0x255d5b-0x0;var _0x3e141a=_0xe89a[_0x255d5b];return _0x3e141a;};'use strict';var attributes=require(_0xae89('0x0'));var extensions=require('../../components/extensions/rewrite');var iftime=require(_0xae89('0x1'))['iftime'];module['exports']=function(_0x6bed7c){return _0x6bed7c[_0xae89('0x2')](_0xae89('0x3'),attributes,{'tableName':_0xae89('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x15c756){extensions[_0xae89('0x5')](_0x6bed7c,_0x15c756);},'afterBulkCreate':function(_0x5158cb,_0x164a1c,_0x11fcad){_0x11fcad();extensions[_0xae89('0x5')](_0x6bed7c,_0x5158cb[0x0]);},'afterUpdate':function(_0x25bcf4){extensions[_0xae89('0x5')](_0x6bed7c,_0x25bcf4);},'afterDestroy':function(_0x5c45a1){extensions[_0xae89('0x5')](_0x6bed7c,_0x5c45a1);}},'instanceMethods':{'ifTime':function(_0x3f7338=undefined,_0x3658f1=new Date()){if(typeof this[_0xae89('0x6')]===_0xae89('0x7')){return iftime(this[_0xae89('0x6')],_0x3f7338,_0x3658f1);}else{return this['getIntervals']()[_0xae89('0x8')](function(_0x197c35){return Promise[_0xae89('0x9')](_0x197c35[_0xae89('0xa')](function(_0x2ee879){return _0x2ee879[_0xae89('0xb')](_0x3f7338,_0x3658f1);}));})[_0xae89('0x8')](function(_0x4d3c18){return _0x4d3c18[_0xae89('0xc')](function(_0x20d7bc,_0x517601){return _0x20d7bc||_0x517601;},![]);});}}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 9edeba9..7551d08 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 _0x1e48=['find','where','info','debug','findAll','all','reduce','format','name','join','IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)','ifTime','IntervalIftime','isArray','intervals','string','timezone','length','IntervalIftime:\x20interval\x20strings\x20=\x20%s','IntervalIftime:\x20timezone\x20=\x20%s','Iftime','resolve','../../mysqldb','iftime','../../config/logger','rpc','GetInterval','Interval','options','raw','include','map','model','attributes','then','stringify','catch','message','error','ShowInterval'];(function(_0x4e1584,_0xa77fc7){var _0x558c0a=function(_0x599d6f){while(--_0x599d6f){_0x4e1584['push'](_0x4e1584['shift']());}};_0x558c0a(++_0xa77fc7);}(_0x1e48,0xb6));var _0x81e4=function(_0x1fcddb,_0x304947){_0x1fcddb=_0x1fcddb-0x0;var _0x5a6b79=_0x1e48[_0x1fcddb];return _0x5a6b79;};'use strict';var _=require('lodash');var util=require('util');var db=require(_0x81e4('0x0'))['db'];var iftime=require('../../utils/iftime')[_0x81e4('0x1')];var logger=require(_0x81e4('0x2'))(_0x81e4('0x3'));exports[_0x81e4('0x4')]=function(_0x802459){var _0x3ab8f8=this;return new Promise(function(_0x593f51,_0x9426c6){return db[_0x81e4('0x5')]['findAll']({'raw':_0x802459[_0x81e4('0x6')]?_0x802459['options'][_0x81e4('0x7')]===undefined?!![]:![]:!![],'where':_0x802459['options']?_0x802459[_0x81e4('0x6')]['where']||null:null,'attributes':_0x802459[_0x81e4('0x6')]?_0x802459[_0x81e4('0x6')]['attributes']||null:null,'limit':_0x802459['options']?_0x802459[_0x81e4('0x6')]['limit']||null:null,'include':_0x802459[_0x81e4('0x6')]?_0x802459['options'][_0x81e4('0x8')]?_[_0x81e4('0x9')](_0x802459[_0x81e4('0x6')]['include'],function(_0x1b6ed0){return{'model':db[_0x1b6ed0[_0x81e4('0xa')]],'as':_0x1b6ed0['as'],'attributes':_0x1b6ed0[_0x81e4('0xb')],'include':_0x1b6ed0[_0x81e4('0x8')]?_[_0x81e4('0x9')](_0x1b6ed0['include'],function(_0x34df16){return{'model':db[_0x34df16[_0x81e4('0xa')]],'as':_0x34df16['as'],'attributes':_0x34df16[_0x81e4('0xb')],'include':_0x34df16['include']?_[_0x81e4('0x9')](_0x34df16[_0x81e4('0x8')],function(_0x18c90a){return{'model':db[_0x18c90a[_0x81e4('0xa')]],'as':_0x18c90a['as'],'attributes':_0x18c90a['attributes']};}):[]};}):[]};}):[]:[]})[_0x81e4('0xc')](function(_0x34b712){logger['info']('GetInterval',_0x802459);logger['debug']('GetInterval',_0x802459,JSON[_0x81e4('0xd')](_0x34b712));_0x593f51(_0x34b712);})[_0x81e4('0xe')](function(_0x1fb8cb){logger['error'](_0x81e4('0x4'),_0x1fb8cb[_0x81e4('0xf')],_0x802459);_0x9426c6(_0x3ab8f8[_0x81e4('0x10')](0x1f4,_0x1fb8cb[_0x81e4('0xf')]));});});};exports[_0x81e4('0x11')]=function(_0xddfb60){var _0x462884=this;return new Promise(function(_0x588b59,_0x59fdc1){return db[_0x81e4('0x5')][_0x81e4('0x12')]({'raw':_0xddfb60[_0x81e4('0x6')]?_0xddfb60[_0x81e4('0x6')][_0x81e4('0x7')]===undefined?!![]:![]:!![],'where':_0xddfb60[_0x81e4('0x6')]?_0xddfb60[_0x81e4('0x6')][_0x81e4('0x13')]||null:null,'attributes':_0xddfb60[_0x81e4('0x6')]?_0xddfb60[_0x81e4('0x6')][_0x81e4('0xb')]||null:null,'include':_0xddfb60[_0x81e4('0x6')]?_0xddfb60[_0x81e4('0x6')][_0x81e4('0x8')]?_['map'](_0xddfb60[_0x81e4('0x6')][_0x81e4('0x8')],function(_0x1d9d6a){return{'model':db[_0x1d9d6a['model']],'as':_0x1d9d6a['as'],'attributes':_0x1d9d6a[_0x81e4('0xb')],'include':_0x1d9d6a[_0x81e4('0x8')]?_[_0x81e4('0x9')](_0x1d9d6a['include'],function(_0x2fed56){return{'model':db[_0x2fed56['model']],'as':_0x2fed56['as'],'attributes':_0x2fed56[_0x81e4('0xb')],'include':_0x2fed56[_0x81e4('0x8')]?_[_0x81e4('0x9')](_0x2fed56[_0x81e4('0x8')],function(_0xe739b0){return{'model':db[_0xe739b0[_0x81e4('0xa')]],'as':_0xe739b0['as'],'attributes':_0xe739b0['attributes']};}):[]};}):[]};}):[]:[]})[_0x81e4('0xc')](function(_0x36b6df){logger[_0x81e4('0x14')](_0x81e4('0x11'),_0xddfb60);logger[_0x81e4('0x15')](_0x81e4('0x11'),_0xddfb60,JSON[_0x81e4('0xd')](_0x36b6df));_0x588b59(_0x36b6df);})['catch'](function(_0x4cc5d1){logger[_0x81e4('0x10')](_0x81e4('0x11'),_0x4cc5d1[_0x81e4('0xf')],_0xddfb60);_0x59fdc1(_0x462884['error'](0x1f4,_0x4cc5d1[_0x81e4('0xf')]));});});};function checkArrayOfIntervals(_0x3883b,_0x8a1cbb){var _0x42fd7d=[];return db[_0x81e4('0x5')][_0x81e4('0x16')]({'where':{'id':_0x3883b}})[_0x81e4('0xc')](function(_0x53c0bc){_0x42fd7d=_0x53c0bc;return Promise[_0x81e4('0x17')](_0x42fd7d[_0x81e4('0x9')](function(_0x5d1693){return _0x5d1693['ifTime'](_0x8a1cbb);}));})['then'](function(_0x2a2207){var _0x2518a0=_0x2a2207[_0x81e4('0x18')](function(_0x3f4090,_0x8c54e9){return _0x3f4090||_0x8c54e9;},![]);logger[_0x81e4('0x14')](util[_0x81e4('0x19')]('IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)',_0x42fd7d['map'](function(_0x49a3b6){return _0x49a3b6[_0x81e4('0x1a')];})[_0x81e4('0x1b')](',\x20'),_0x42fd7d['map'](function(_0x5abc76){return _0x5abc76['id'];})[_0x81e4('0x1b')](',\x20')));return _0x2518a0;});}function checkSingleInterval(_0xef462f,_0xdfd263){return db['Interval']['findById'](_0xef462f)[_0x81e4('0xc')](function(_0x133fbc){if(_0x133fbc){logger['info'](util['format'](_0x81e4('0x1c'),_0x133fbc[_0x81e4('0x1a')],_0x133fbc['id']));return _0x133fbc[_0x81e4('0x1d')](_0xdfd263);}});}exports[_0x81e4('0x1e')]=function(_0x517481){var _0x3aaee4=_0x517481['intervalIds'];var _0x46f9af=Array[_0x81e4('0x1f')](_0x517481[_0x81e4('0x20')])?_0x517481[_0x81e4('0x20')]:typeof _0x517481[_0x81e4('0x20')]===_0x81e4('0x21')?[_0x517481['intervals']]:[];var _0x3f5752=_0x517481[_0x81e4('0x22')]||undefined;var _0xc696a0=![];if(_0x46f9af[_0x81e4('0x23')]){logger['info'](util['format'](_0x81e4('0x24'),_0x46f9af[_0x81e4('0x1b')](';\x20')));}if(_0x3f5752){logger[_0x81e4('0x14')](util[_0x81e4('0x19')](_0x81e4('0x25'),_0x3f5752));}logger['debug'](_0x81e4('0x26'),_0xc696a0);logger['silly'](_0x81e4('0x1e'),_0x517481);return Promise[_0x81e4('0x27')]()[_0x81e4('0xc')](function(){if(Array[_0x81e4('0x1f')](_0x3aaee4)){return checkArrayOfIntervals(_0x3aaee4,_0x3f5752);}else if(_0x3aaee4){return checkSingleInterval(_0x3aaee4,_0x3f5752);}})['then'](function(_0x13b079){var _0x1be846=_0x46f9af[_0x81e4('0x18')](function(_0x4f7463,_0x5c184d){return _0x4f7463||iftime(_0x5c184d,_0x3f5752);},![]);_0xc696a0=_0x13b079||_0x1be846;return _0xc696a0;})[_0x81e4('0xe')](function(_0x3fc107){logger[_0x81e4('0x10')](_0x81e4('0x1e'),_0x517481,_0x3fc107);throw this[_0x81e4('0x10')](0x1f4,_0x3fc107[_0x81e4('0xf')]);});}; \ No newline at end of file +var _0x4500=['raw','where','attributes','include','map','model','then','GetInterval','debug','catch','error','ShowInterval','info','stringify','message','ifTime','format','IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)','join','findById','name','intervalIds','isArray','intervals','timezone','length','IntervalIftime:\x20timezone\x20=\x20%s','Iftime','IntervalIftime','resolve','reduce','lodash','../../mysqldb','../../utils/iftime','Interval','findAll','options'];(function(_0x34808c,_0xb761ac){var _0x46cb5e=function(_0x5d0a8d){while(--_0x5d0a8d){_0x34808c['push'](_0x34808c['shift']());}};_0x46cb5e(++_0xb761ac);}(_0x4500,0x147));var _0x0450=function(_0x20b29c,_0xe22528){_0x20b29c=_0x20b29c-0x0;var _0x20d81b=_0x4500[_0x20b29c];return _0x20d81b;};'use strict';var _=require(_0x0450('0x0'));var util=require('util');var db=require(_0x0450('0x1'))['db'];var iftime=require(_0x0450('0x2'))['iftime'];var logger=require('../../config/logger')('rpc');exports['GetInterval']=function(_0x512332){var _0x1e3f1c=this;return new Promise(function(_0x59db0f,_0x169baa){return db[_0x0450('0x3')][_0x0450('0x4')]({'raw':_0x512332[_0x0450('0x5')]?_0x512332[_0x0450('0x5')][_0x0450('0x6')]===undefined?!![]:![]:!![],'where':_0x512332['options']?_0x512332[_0x0450('0x5')][_0x0450('0x7')]||null:null,'attributes':_0x512332[_0x0450('0x5')]?_0x512332[_0x0450('0x5')][_0x0450('0x8')]||null:null,'limit':_0x512332['options']?_0x512332['options']['limit']||null:null,'include':_0x512332[_0x0450('0x5')]?_0x512332[_0x0450('0x5')][_0x0450('0x9')]?_[_0x0450('0xa')](_0x512332['options']['include'],function(_0x151f69){return{'model':db[_0x151f69[_0x0450('0xb')]],'as':_0x151f69['as'],'attributes':_0x151f69[_0x0450('0x8')],'include':_0x151f69[_0x0450('0x9')]?_[_0x0450('0xa')](_0x151f69[_0x0450('0x9')],function(_0x1562e6){return{'model':db[_0x1562e6[_0x0450('0xb')]],'as':_0x1562e6['as'],'attributes':_0x1562e6[_0x0450('0x8')],'include':_0x1562e6[_0x0450('0x9')]?_[_0x0450('0xa')](_0x1562e6[_0x0450('0x9')],function(_0x497c92){return{'model':db[_0x497c92[_0x0450('0xb')]],'as':_0x497c92['as'],'attributes':_0x497c92['attributes']};}):[]};}):[]};}):[]:[]})[_0x0450('0xc')](function(_0x47babe){logger['info'](_0x0450('0xd'),_0x512332);logger[_0x0450('0xe')](_0x0450('0xd'),_0x512332,JSON['stringify'](_0x47babe));_0x59db0f(_0x47babe);})[_0x0450('0xf')](function(_0x15fbcb){logger[_0x0450('0x10')](_0x0450('0xd'),_0x15fbcb['message'],_0x512332);_0x169baa(_0x1e3f1c[_0x0450('0x10')](0x1f4,_0x15fbcb['message']));});});};exports[_0x0450('0x11')]=function(_0x264281){var _0x4cf90c=this;return new Promise(function(_0x335992,_0x243c6a){return db[_0x0450('0x3')]['find']({'raw':_0x264281[_0x0450('0x5')]?_0x264281[_0x0450('0x5')][_0x0450('0x6')]===undefined?!![]:![]:!![],'where':_0x264281[_0x0450('0x5')]?_0x264281['options'][_0x0450('0x7')]||null:null,'attributes':_0x264281['options']?_0x264281[_0x0450('0x5')][_0x0450('0x8')]||null:null,'include':_0x264281[_0x0450('0x5')]?_0x264281[_0x0450('0x5')][_0x0450('0x9')]?_[_0x0450('0xa')](_0x264281[_0x0450('0x5')][_0x0450('0x9')],function(_0xb500c2){return{'model':db[_0xb500c2[_0x0450('0xb')]],'as':_0xb500c2['as'],'attributes':_0xb500c2[_0x0450('0x8')],'include':_0xb500c2[_0x0450('0x9')]?_['map'](_0xb500c2[_0x0450('0x9')],function(_0xabe0bf){return{'model':db[_0xabe0bf[_0x0450('0xb')]],'as':_0xabe0bf['as'],'attributes':_0xabe0bf['attributes'],'include':_0xabe0bf[_0x0450('0x9')]?_['map'](_0xabe0bf[_0x0450('0x9')],function(_0xa14704){return{'model':db[_0xa14704[_0x0450('0xb')]],'as':_0xa14704['as'],'attributes':_0xa14704[_0x0450('0x8')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xe2ea12){logger[_0x0450('0x12')](_0x0450('0x11'),_0x264281);logger[_0x0450('0xe')]('ShowInterval',_0x264281,JSON[_0x0450('0x13')](_0xe2ea12));_0x335992(_0xe2ea12);})[_0x0450('0xf')](function(_0x12ec24){logger['error'](_0x0450('0x11'),_0x12ec24[_0x0450('0x14')],_0x264281);_0x243c6a(_0x4cf90c[_0x0450('0x10')](0x1f4,_0x12ec24[_0x0450('0x14')]));});});};function checkArrayOfIntervals(_0x1fb5e3,_0x43c750){var _0x3c63c1=[];return db[_0x0450('0x3')]['findAll']({'where':{'id':_0x1fb5e3}})[_0x0450('0xc')](function(_0xe29827){_0x3c63c1=_0xe29827;return Promise['all'](_0x3c63c1[_0x0450('0xa')](function(_0x2345b2){return _0x2345b2[_0x0450('0x15')](_0x43c750);}));})[_0x0450('0xc')](function(_0x10432a){var _0x3bd8f8=_0x10432a['reduce'](function(_0x4d146a,_0x24ea74){return _0x4d146a||_0x24ea74;},![]);logger[_0x0450('0x12')](util[_0x0450('0x16')](_0x0450('0x17'),_0x3c63c1[_0x0450('0xa')](function(_0x366c86){return _0x366c86['name'];})[_0x0450('0x18')](',\x20'),_0x3c63c1[_0x0450('0xa')](function(_0x1c8d7a){return _0x1c8d7a['id'];})[_0x0450('0x18')](',\x20')));return _0x3bd8f8;});}function checkSingleInterval(_0x11186a,_0x36d026){return db[_0x0450('0x3')][_0x0450('0x19')](_0x11186a)[_0x0450('0xc')](function(_0x4ef005){if(_0x4ef005){logger[_0x0450('0x12')](util[_0x0450('0x16')]('IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)',_0x4ef005[_0x0450('0x1a')],_0x4ef005['id']));return _0x4ef005['ifTime'](_0x36d026);}});}exports['IntervalIftime']=function(_0x226b18){var _0x362770=_0x226b18[_0x0450('0x1b')];var _0x1169bd=Array[_0x0450('0x1c')](_0x226b18[_0x0450('0x1d')])?_0x226b18['intervals']:typeof _0x226b18[_0x0450('0x1d')]==='string'?[_0x226b18[_0x0450('0x1d')]]:[];var _0x396792=_0x226b18[_0x0450('0x1e')]||undefined;var _0x2369e4=![];if(_0x1169bd[_0x0450('0x1f')]){logger['info'](util[_0x0450('0x16')]('IntervalIftime:\x20interval\x20strings\x20=\x20%s',_0x1169bd[_0x0450('0x18')](';\x20')));}if(_0x396792){logger[_0x0450('0x12')](util[_0x0450('0x16')](_0x0450('0x20'),_0x396792));}logger[_0x0450('0xe')](_0x0450('0x21'),_0x2369e4);logger['silly'](_0x0450('0x22'),_0x226b18);return Promise[_0x0450('0x23')]()[_0x0450('0xc')](function(){if(Array[_0x0450('0x1c')](_0x362770)){return checkArrayOfIntervals(_0x362770,_0x396792);}else if(_0x362770){return checkSingleInterval(_0x362770,_0x396792);}})[_0x0450('0xc')](function(_0x3dbaa4){var _0x4be3bb=_0x1169bd[_0x0450('0x24')](function(_0x190b00,_0x3a93ac){return _0x190b00||iftime(_0x3a93ac,_0x396792);},![]);_0x2369e4=_0x3dbaa4||_0x4be3bb;return _0x2369e4;})[_0x0450('0xf')](function(_0x32cd14){logger[_0x0450('0x10')](_0x0450('0x22'),_0x226b18,_0x32cd14);throw this['error'](0x1f4,_0x32cd14[_0x0450('0x14')]);});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index 73fed77..c0d4fe1 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 _0x0b0e=['exports','express','../../components/auth/service','post','isAuthenticated','send'];(function(_0x4e7d25,_0x58285f){var _0x526fe6=function(_0x4f0aec){while(--_0x4f0aec){_0x4e7d25['push'](_0x4e7d25['shift']());}};_0x526fe6(++_0x58285f);}(_0x0b0e,0x187));var _0xe0b0=function(_0x454bd3,_0x3e4d94){_0x454bd3=_0x454bd3-0x0;var _0x4eb066=_0x0b0e[_0x454bd3];return _0x4eb066;};'use strict';var express=require(_0xe0b0('0x0'));var router=express['Router']();var auth=require(_0xe0b0('0x1'));var controller=require('./jira.controller');router[_0xe0b0('0x2')]('/',auth[_0xe0b0('0x3')](),controller[_0xe0b0('0x4')]);module[_0xe0b0('0x5')]=router; \ No newline at end of file +var _0x5f2f=['isAuthenticated','send','exports','express','Router','../../components/auth/service','./jira.controller','post'];(function(_0x747227,_0x347936){var _0x452f92=function(_0x3ecd10){while(--_0x3ecd10){_0x747227['push'](_0x747227['shift']());}};_0x452f92(++_0x347936);}(_0x5f2f,0x73));var _0xf5f2=function(_0x26b717,_0xa41077){_0x26b717=_0x26b717-0x0;var _0x12928d=_0x5f2f[_0x26b717];return _0x12928d;};'use strict';var express=require(_0xf5f2('0x0'));var router=express[_0xf5f2('0x1')]();var auth=require(_0xf5f2('0x2'));var controller=require(_0xf5f2('0x3'));router[_0xf5f2('0x4')]('/',auth[_0xf5f2('0x5')](),controller[_0xf5f2('0x6')]);module[_0xf5f2('0x7')]=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index 43a4aae..6870459 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 _0x9979=['newToken','name','reason','customfield_10102','/rest/api/2/issue','POST','Basic\x20','base64','stringify','utf8','data','status','parse','json','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','end','openIssue','body','connection','remoteAddress','socket','https','api','3eAmWpBVP0','key','MOTGUI','summary','Report','description','issuetype','Bug','customfield_11500','email','oldToken','fields','customfield_11502'];(function(_0x101b4b,_0x2eb8e){var _0x12de0e=function(_0x477b73){while(--_0x477b73){_0x101b4b['push'](_0x101b4b['shift']());}};_0x12de0e(++_0x2eb8e);}(_0x9979,0xd5));var _0x9997=function(_0x288478,_0x23303e){_0x288478=_0x288478-0x0;var _0x234c05=_0x9979[_0x288478];return _0x234c05;};'use strict';var BPromise=require('bluebird');var https=require(_0x9997('0x0'));var logger=require('../../config/logger')(_0x9997('0x1'));var USERNAME='support';var PASSWORD=_0x9997('0x2');function openIssue(_0x15c12e,_0x2babd5){var _0x16b954={'fields':{'project':{'key':_0x15c12e[_0x9997('0x3')]||_0x9997('0x4')},'summary':(_0x15c12e[_0x9997('0x5')]||_0x9997('0x6'))+'\x20from\x20'+_0x15c12e['ip'],'description':_0x15c12e[_0x9997('0x7')]||JSON['stringify'](_0x15c12e),'issuetype':{'name':_0x15c12e[_0x9997('0x8')]||_0x9997('0x9')}}};_0x16b954['fields'][_0x9997('0xa')]=_0x15c12e[_0x9997('0xb')];_0x16b954['fields']['customfield_11501']=_0x15c12e[_0x9997('0xc')];_0x16b954[_0x9997('0xd')][_0x9997('0xe')]=_0x15c12e[_0x9997('0xf')];_0x16b954['fields']['customfield_11503']=_0x15c12e[_0x9997('0x10')];_0x16b954[_0x9997('0xd')]['customfield_11504']=_0x15c12e[_0x9997('0x11')];_0x16b954['fields'][_0x9997('0x12')]=_0x15c12e['ip'];var _0x3600b9={'host':'track.xcallymotion.com','port':0x1bb,'path':_0x9997('0x13'),'method':_0x9997('0x14'),'timeout':0x4e20,'headers':{'Content-Type':'application/json','Authorization':_0x9997('0x15')+new Buffer(USERNAME+':'+PASSWORD)['toString'](_0x9997('0x16'))}};var _0x4f0aa1=JSON[_0x9997('0x17')](_0x16b954);var _0x13ceb=https['request'](_0x3600b9,function(_0x58f0a6){_0x58f0a6['setEncoding'](_0x9997('0x18'));var _0x446793='';_0x58f0a6['on'](_0x9997('0x19'),function(_0x5caf94){_0x446793+=_0x5caf94;});_0x58f0a6['on']('end',function(){if(_0x2babd5){return _0x2babd5[_0x9997('0x1a')](_0x58f0a6['statusCode'])['json'](JSON[_0x9997('0x1b')](_0x446793));}});});_0x13ceb['on']('error',function(_0x215d5a){if(_0x2babd5){return _0x2babd5[_0x9997('0x1a')](0x1f4)[_0x9997('0x1c')]({'errors':[{'message':_0x9997('0x1d'),'type':_0x9997('0x1e')}]});}});_0x13ceb[_0x9997('0x1f')](_0x4f0aa1);_0x13ceb[_0x9997('0x20')]();}exports[_0x9997('0x21')]=openIssue;exports['send']=function(_0x46296e,_0x1a2410){_0x46296e[_0x9997('0x22')]['ip']=_0x46296e['headers']['x-forwarded-for']||_0x46296e[_0x9997('0x23')][_0x9997('0x24')]||_0x46296e[_0x9997('0x25')][_0x9997('0x24')]||_0x46296e['connection'][_0x9997('0x25')][_0x9997('0x24')];return openIssue(_0x46296e[_0x9997('0x22')],_0x1a2410);}; \ No newline at end of file +var _0xb73d=['base64','request','setEncoding','utf8','data','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','body','x-forwarded-for','remoteAddress','socket','connection','bluebird','https','api','3eAmWpBVP0','key','MOTGUI','Report','\x20from\x20','description','stringify','issuetype','Bug','fields','customfield_11500','email','customfield_11501','oldToken','customfield_11502','newToken','customfield_11503','name','customfield_11504','reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','POST','Basic\x20','toString'];(function(_0x3fe280,_0x1d8260){var _0x2e833f=function(_0x2fc4e2){while(--_0x2fc4e2){_0x3fe280['push'](_0x3fe280['shift']());}};_0x2e833f(++_0x1d8260);}(_0xb73d,0x1cd));var _0xdb73=function(_0x35af12,_0x56bb01){_0x35af12=_0x35af12-0x0;var _0x16bdf6=_0xb73d[_0x35af12];return _0x16bdf6;};'use strict';var BPromise=require(_0xdb73('0x0'));var https=require(_0xdb73('0x1'));var logger=require('../../config/logger')(_0xdb73('0x2'));var USERNAME='support';var PASSWORD=_0xdb73('0x3');function openIssue(_0x5af0b1,_0x523158){var _0x44c4c8={'fields':{'project':{'key':_0x5af0b1[_0xdb73('0x4')]||_0xdb73('0x5')},'summary':(_0x5af0b1['summary']||_0xdb73('0x6'))+_0xdb73('0x7')+_0x5af0b1['ip'],'description':_0x5af0b1[_0xdb73('0x8')]||JSON[_0xdb73('0x9')](_0x5af0b1),'issuetype':{'name':_0x5af0b1[_0xdb73('0xa')]||_0xdb73('0xb')}}};_0x44c4c8[_0xdb73('0xc')][_0xdb73('0xd')]=_0x5af0b1[_0xdb73('0xe')];_0x44c4c8[_0xdb73('0xc')][_0xdb73('0xf')]=_0x5af0b1[_0xdb73('0x10')];_0x44c4c8[_0xdb73('0xc')][_0xdb73('0x11')]=_0x5af0b1[_0xdb73('0x12')];_0x44c4c8[_0xdb73('0xc')][_0xdb73('0x13')]=_0x5af0b1[_0xdb73('0x14')];_0x44c4c8[_0xdb73('0xc')][_0xdb73('0x15')]=_0x5af0b1[_0xdb73('0x16')];_0x44c4c8[_0xdb73('0xc')][_0xdb73('0x17')]=_0x5af0b1['ip'];var _0x54b7a8={'host':_0xdb73('0x18'),'port':0x1bb,'path':_0xdb73('0x19'),'method':_0xdb73('0x1a'),'timeout':0x4e20,'headers':{'Content-Type':'application/json','Authorization':_0xdb73('0x1b')+new Buffer(USERNAME+':'+PASSWORD)[_0xdb73('0x1c')](_0xdb73('0x1d'))}};var _0x1ebb36=JSON[_0xdb73('0x9')](_0x44c4c8);var _0xfe552a=https[_0xdb73('0x1e')](_0x54b7a8,function(_0x57ef76){_0x57ef76[_0xdb73('0x1f')](_0xdb73('0x20'));var _0x5468bd='';_0x57ef76['on'](_0xdb73('0x21'),function(_0x24c966){_0x5468bd+=_0x24c966;});_0x57ef76['on'](_0xdb73('0x22'),function(){if(_0x523158){return _0x523158['status'](_0x57ef76[_0xdb73('0x23')])[_0xdb73('0x24')](JSON[_0xdb73('0x25')](_0x5468bd));}});});_0xfe552a['on'](_0xdb73('0x26'),function(_0x2d4953){if(_0x523158){return _0x523158[_0xdb73('0x27')](0x1f4)[_0xdb73('0x24')]({'errors':[{'message':_0xdb73('0x28'),'type':_0xdb73('0x29')}]});}});_0xfe552a['write'](_0x1ebb36);_0xfe552a[_0xdb73('0x22')]();}exports[_0xdb73('0x2a')]=openIssue;exports[_0xdb73('0x2b')]=function(_0x1a753e,_0x15c67a){_0x1a753e[_0xdb73('0x2c')]['ip']=_0x1a753e['headers'][_0xdb73('0x2d')]||_0x1a753e['connection'][_0xdb73('0x2e')]||_0x1a753e[_0xdb73('0x2f')][_0xdb73('0x2e')]||_0x1a753e[_0xdb73('0x30')][_0xdb73('0x2f')][_0xdb73('0x2e')];return openIssue(_0x1a753e[_0xdb73('0x2c')],_0x15c67a);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index d2ab70c..7379677 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 _0x4483=['exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptyAnswerReport.controller','get','isAuthenticated','index','/describe','describe','show','post','create','put','/:id','update','delete'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0x4483,0x1a3));var _0x3448=function(_0x3a407b,_0x25ac68){_0x3a407b=_0x3a407b-0x0;var _0x1da087=_0x4483[_0x3a407b];return _0x1da087;};'use strict';var multer=require(_0x3448('0x0'));var util=require(_0x3448('0x1'));var path=require(_0x3448('0x2'));var timeout=require('connect-timeout');var express=require(_0x3448('0x3'));var router=express[_0x3448('0x4')]();var fs_extra=require(_0x3448('0x5'));var auth=require(_0x3448('0x6'));var interaction=require(_0x3448('0x7'));var config=require('../../config/environment');var controller=require(_0x3448('0x8'));router[_0x3448('0x9')]('/',auth[_0x3448('0xa')](),controller[_0x3448('0xb')]);router[_0x3448('0x9')](_0x3448('0xc'),auth[_0x3448('0xa')](),controller[_0x3448('0xd')]);router['get']('/:id',auth[_0x3448('0xa')](),controller[_0x3448('0xe')]);router[_0x3448('0xf')]('/',auth[_0x3448('0xa')](),controller[_0x3448('0x10')]);router[_0x3448('0x11')](_0x3448('0x12'),auth[_0x3448('0xa')](),controller[_0x3448('0x13')]);router[_0x3448('0x14')](_0x3448('0x12'),auth['isAuthenticated'](),controller['destroy']);module[_0x3448('0x15')]=router; \ No newline at end of file +var _0xa75b=['isAuthenticated','index','/describe','show','create','put','/:id','update','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','get'];(function(_0x4dd1c4,_0x1b1053){var _0x3cf969=function(_0x40406b){while(--_0x40406b){_0x4dd1c4['push'](_0x4dd1c4['shift']());}};_0x3cf969(++_0x1b1053);}(_0xa75b,0x170));var _0xba75=function(_0x564ecc,_0x579ee7){_0x564ecc=_0x564ecc-0x0;var _0x55a4ca=_0xa75b[_0x564ecc];return _0x55a4ca;};'use strict';var multer=require(_0xba75('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xba75('0x1'));var express=require(_0xba75('0x2'));var router=express[_0xba75('0x3')]();var fs_extra=require(_0xba75('0x4'));var auth=require(_0xba75('0x5'));var interaction=require(_0xba75('0x6'));var config=require(_0xba75('0x7'));var controller=require(_0xba75('0x8'));router[_0xba75('0x9')]('/',auth[_0xba75('0xa')](),controller[_0xba75('0xb')]);router[_0xba75('0x9')](_0xba75('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0xba75('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xba75('0xd')]);router['post']('/',auth[_0xba75('0xa')](),controller[_0xba75('0xe')]);router[_0xba75('0xf')](_0xba75('0x10'),auth[_0xba75('0xa')](),controller[_0xba75('0x11')]);router[_0xba75('0x12')](_0xba75('0x10'),auth[_0xba75('0xa')](),controller[_0xba75('0x13')]);module[_0xba75('0x14')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index 7336a0d..cd5aac4 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(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x7a54,0x106));var _0x47a5=function(_0x262277,_0x71492b){_0x262277=_0x262277-0x0;var _0x45d853=_0x7a54[_0x262277];return _0x45d853;};'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(_0x17b6e3,_0x4522ed){var _0x3906f3=function(_0x430f87){while(--_0x430f87){_0x17b6e3['push'](_0x17b6e3['shift']());}};_0x3906f3(++_0x4522ed);}(_0x7a54,0x106));var _0x47a5=function(_0x4e7e38,_0x49feb0){_0x4e7e38=_0x4e7e38-0x0;var _0x40ae35=_0x7a54[_0x4e7e38];return _0x40ae35;};'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 8fca47d..7286f84 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 _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(_0x56af36,_0x54dcb4){var _0x514be6=function(_0x155b75){while(--_0x155b75){_0x56af36['push'](_0x56af36['shift']());}};_0x514be6(++_0x54dcb4);}(_0xff2a,0x93));var _0xaff2=function(_0xb0975b,_0x93b0d6){_0xb0975b=_0xb0975b-0x0;var _0x320d30=_0xff2a[_0xb0975b];return _0x320d30;};'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 +var _0x2c8f=['then','destroy','error','stack','name','send','index','JscriptyAnswerReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','options','includeAll','include','show','params','length','find','catch','create','body','describe','rimraf','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','update'];(function(_0x44ad5d,_0x4341b2){var _0x41bebd=function(_0xc64a03){while(--_0xc64a03){_0x44ad5d['push'](_0x44ad5d['shift']());}};_0x41bebd(++_0x4341b2);}(_0x2c8f,0x192));var _0xf2c8=function(_0x34f8b3,_0xa4189e){_0x34f8b3=_0x34f8b3-0x0;var _0x187030=_0x2c8f[_0x34f8b3];return _0x187030;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf2c8('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xf2c8('0x1'));var BPromise=require(_0xf2c8('0x2'));var Mustache=require(_0xf2c8('0x3'));var util=require('util');var path=require('path');var sox=require(_0xf2c8('0x4'));var csv=require(_0xf2c8('0x5'));var ejs=require(_0xf2c8('0x6'));var fs=require('fs');var fs_extra=require(_0xf2c8('0x7'));var _=require(_0xf2c8('0x8'));var squel=require('squel');var crypto=require(_0xf2c8('0x9'));var jsforce=require(_0xf2c8('0xa'));var deskjs=require(_0xf2c8('0xb'));var toCsv=require(_0xf2c8('0x5'));var querystring=require(_0xf2c8('0xc'));var Papa=require(_0xf2c8('0xd'));var Redis=require('ioredis');var authService=require(_0xf2c8('0xe'));var qs=require(_0xf2c8('0xf'));var as=require(_0xf2c8('0x10'));var hardwareService=require(_0xf2c8('0x11'));var logger=require(_0xf2c8('0x12'))(_0xf2c8('0x13'));var utils=require(_0xf2c8('0x14'));var config=require(_0xf2c8('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xf2c8('0x16'))['db'];function respondWithStatusCode(_0x5ce572,_0x10bc2c){_0x10bc2c=_0x10bc2c||0xcc;return function(_0x16b7a4){if(_0x16b7a4){return _0x5ce572[_0xf2c8('0x17')](_0x10bc2c);}return _0x5ce572[_0xf2c8('0x18')](_0x10bc2c)[_0xf2c8('0x19')]();};}function respondWithResult(_0x40849c,_0x54dd36){_0x54dd36=_0x54dd36||0xc8;return function(_0x3b86f0){if(_0x3b86f0){return _0x40849c[_0xf2c8('0x18')](_0x54dd36)[_0xf2c8('0x1a')](_0x3b86f0);}};}function respondWithFilteredResult(_0x34f9b1,_0x3ed09e){return function(_0x383af2){if(_0x383af2){var _0x1b8c5b=typeof _0x3ed09e['offset']===_0xf2c8('0x1b')&&typeof _0x3ed09e[_0xf2c8('0x1c')]===_0xf2c8('0x1b');var _0x31b8e0=_0x383af2[_0xf2c8('0x1d')];var _0x52e9d0=_0x1b8c5b?0x0:_0x3ed09e['offset'];var _0x104d9d=_0x1b8c5b?_0x383af2[_0xf2c8('0x1d')]:_0x3ed09e[_0xf2c8('0x1e')]+_0x3ed09e[_0xf2c8('0x1c')];var _0x516d99;if(_0x104d9d>=_0x31b8e0){_0x104d9d=_0x31b8e0;_0x516d99=0xc8;}else{_0x516d99=0xce;}_0x34f9b1[_0xf2c8('0x18')](_0x516d99);return _0x34f9b1[_0xf2c8('0x1f')](_0xf2c8('0x20'),_0x52e9d0+'-'+_0x104d9d+'/'+_0x31b8e0)['json'](_0x383af2);}return null;};}function patchUpdates(_0x4442f9){return function(_0x31008e){try{jsonpatch['apply'](_0x31008e,_0x4442f9,!![]);}catch(_0x5b1e44){return BPromise[_0xf2c8('0x21')](_0x5b1e44);}return _0x31008e[_0xf2c8('0x22')]();};}function saveUpdates(_0x98f9cb,_0x57affa){return function(_0xd2e728){if(_0xd2e728){return _0xd2e728[_0xf2c8('0x23')](_0x98f9cb)[_0xf2c8('0x24')](function(_0x239350){return _0x239350;});}return null;};}function removeEntity(_0x4ba1e0,_0x17956f){return function(_0xe5ff6c){if(_0xe5ff6c){return _0xe5ff6c[_0xf2c8('0x25')]()[_0xf2c8('0x24')](function(){_0x4ba1e0[_0xf2c8('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x93707c,_0x54bbcb){return function(_0x3cd344){if(!_0x3cd344){_0x93707c[_0xf2c8('0x17')](0x194);}return _0x3cd344;};}function handleError(_0x27dc4f,_0x3bb777){_0x3bb777=_0x3bb777||0x1f4;return function(_0x1d2e74){logger[_0xf2c8('0x26')](_0x1d2e74[_0xf2c8('0x27')]);if(_0x1d2e74[_0xf2c8('0x28')]){delete _0x1d2e74[_0xf2c8('0x28')];}_0x27dc4f[_0xf2c8('0x18')](_0x3bb777)[_0xf2c8('0x29')](_0x1d2e74);};}exports[_0xf2c8('0x2a')]=function(_0x311349,_0x4e12a2){var _0x1cb979={},_0x5146e4={},_0x584587={'count':0x0,'rows':[]};var _0x3df45d=_['map'](db[_0xf2c8('0x2b')][_0xf2c8('0x2c')],function(_0x23de17){return{'name':_0x23de17[_0xf2c8('0x2d')],'type':_0x23de17[_0xf2c8('0x2e')][_0xf2c8('0x2f')]};});_0x5146e4[_0xf2c8('0x30')]=_['map'](_0x3df45d,_0xf2c8('0x28'));_0x5146e4[_0xf2c8('0x31')]=_[_0xf2c8('0x32')](_0x311349[_0xf2c8('0x31')]);_0x5146e4[_0xf2c8('0x33')]=_[_0xf2c8('0x34')](_0x5146e4['model'],_0x5146e4[_0xf2c8('0x31')]);_0x1cb979['attributes']=_[_0xf2c8('0x34')](_0x5146e4['model'],qs[_0xf2c8('0x35')](_0x311349[_0xf2c8('0x31')][_0xf2c8('0x35')]));_0x1cb979[_0xf2c8('0x36')]=_0x1cb979[_0xf2c8('0x36')]['length']?_0x1cb979[_0xf2c8('0x36')]:_0x5146e4[_0xf2c8('0x30')];if(!_0x311349['query'][_0xf2c8('0x37')](_0xf2c8('0x38'))){_0x1cb979['limit']=qs[_0xf2c8('0x1c')](_0x311349[_0xf2c8('0x31')][_0xf2c8('0x1c')]);_0x1cb979[_0xf2c8('0x1e')]=qs[_0xf2c8('0x1e')](_0x311349['query']['offset']);}_0x1cb979[_0xf2c8('0x39')]=qs[_0xf2c8('0x3a')](_0x311349[_0xf2c8('0x31')][_0xf2c8('0x3a')]);_0x1cb979[_0xf2c8('0x3b')]=qs[_0xf2c8('0x33')](_[_0xf2c8('0x3c')](_0x311349[_0xf2c8('0x31')],_0x5146e4['filters']),_0x3df45d);if(_0x311349[_0xf2c8('0x31')][_0xf2c8('0x3d')]){_0x1cb979[_0xf2c8('0x3b')]=_['merge'](_0x1cb979['where'],{'$or':_['map'](_0x3df45d,function(_0x5e646e){if(_0x5e646e[_0xf2c8('0x2e')]!=='VIRTUAL'){var _0x219318={};_0x219318[_0x5e646e['name']]={'$like':'%'+_0x311349[_0xf2c8('0x31')]['filter']+'%'};return _0x219318;}})});}_0x1cb979=_['merge']({},_0x1cb979,_0x311349[_0xf2c8('0x3e')]);var _0x523f92={'where':_0x1cb979['where']};return db[_0xf2c8('0x2b')][_0xf2c8('0x1d')](_0x523f92)['then'](function(_0x1f4115){_0x584587[_0xf2c8('0x1d')]=_0x1f4115;if(_0x311349[_0xf2c8('0x31')][_0xf2c8('0x3f')]){_0x1cb979[_0xf2c8('0x40')]=[{'all':!![]}];}return db[_0xf2c8('0x2b')]['findAll'](_0x1cb979);})['then'](function(_0x200920){_0x584587['rows']=_0x200920;return _0x584587;})[_0xf2c8('0x24')](respondWithFilteredResult(_0x4e12a2,_0x1cb979))['catch'](handleError(_0x4e12a2,null));};exports[_0xf2c8('0x41')]=function(_0x580def,_0x3e70eb){var _0x295910={'raw':!![],'where':{'id':_0x580def[_0xf2c8('0x42')]['id']}},_0x251e4c={};_0x251e4c['model']=_[_0xf2c8('0x32')](db[_0xf2c8('0x2b')]['rawAttributes']);_0x251e4c[_0xf2c8('0x31')]=_[_0xf2c8('0x32')](_0x580def[_0xf2c8('0x31')]);_0x251e4c[_0xf2c8('0x33')]=_[_0xf2c8('0x34')](_0x251e4c[_0xf2c8('0x30')],_0x251e4c[_0xf2c8('0x31')]);_0x295910['attributes']=_[_0xf2c8('0x34')](_0x251e4c[_0xf2c8('0x30')],qs[_0xf2c8('0x35')](_0x580def[_0xf2c8('0x31')]['fields']));_0x295910['attributes']=_0x295910[_0xf2c8('0x36')][_0xf2c8('0x43')]?_0x295910[_0xf2c8('0x36')]:_0x251e4c['model'];if(_0x580def[_0xf2c8('0x31')][_0xf2c8('0x3f')]){_0x295910['include']=[{'all':!![]}];}_0x295910=_['merge']({},_0x295910,_0x580def[_0xf2c8('0x3e')]);return db[_0xf2c8('0x2b')][_0xf2c8('0x44')](_0x295910)[_0xf2c8('0x24')](handleEntityNotFound(_0x3e70eb,null))['then'](respondWithResult(_0x3e70eb,null))[_0xf2c8('0x45')](handleError(_0x3e70eb,null));};exports[_0xf2c8('0x46')]=function(_0x18bbd9,_0x598997){return db[_0xf2c8('0x2b')][_0xf2c8('0x46')](_0x18bbd9[_0xf2c8('0x47')],{})['then'](respondWithResult(_0x598997,0xc9))[_0xf2c8('0x45')](handleError(_0x598997,null));};exports[_0xf2c8('0x23')]=function(_0x24d4a2,_0x3d90f5){if(_0x24d4a2[_0xf2c8('0x47')]['id']){delete _0x24d4a2['body']['id'];}return db[_0xf2c8('0x2b')]['find']({'where':{'id':_0x24d4a2['params']['id']}})[_0xf2c8('0x24')](handleEntityNotFound(_0x3d90f5,null))[_0xf2c8('0x24')](saveUpdates(_0x24d4a2[_0xf2c8('0x47')],null))[_0xf2c8('0x24')](respondWithResult(_0x3d90f5,null))[_0xf2c8('0x45')](handleError(_0x3d90f5,null));};exports['destroy']=function(_0x1c7fa5,_0x134077){return db[_0xf2c8('0x2b')][_0xf2c8('0x44')]({'where':{'id':_0x1c7fa5[_0xf2c8('0x42')]['id']}})[_0xf2c8('0x24')](handleEntityNotFound(_0x134077,null))['then'](removeEntity(_0x134077,null))['catch'](handleError(_0x134077,null));};exports[_0xf2c8('0x48')]=function(_0x334285,_0x372296){return db[_0xf2c8('0x2b')][_0xf2c8('0x48')]()[_0xf2c8('0x24')](respondWithResult(_0x372296,null))[_0xf2c8('0x45')](handleError(_0x372296,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index dd0291a..3a09b46 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 _0xa1f1=['bluebird','request-promise','path','rimraf','./jscriptyAnswerReport.attributes','exports','define','JscriptyAnswerReport','report_jscripty_answers','lodash','util','../../config/logger','api','moment'];(function(_0x3cc9d9,_0x69ed38){var _0x1a425d=function(_0x44d109){while(--_0x44d109){_0x3cc9d9['push'](_0x3cc9d9['shift']());}};_0x1a425d(++_0x69ed38);}(_0xa1f1,0x121));var _0x1a1f=function(_0x3a3b9e,_0xc59037){_0x3a3b9e=_0x3a3b9e-0x0;var _0x148103=_0xa1f1[_0x3a3b9e];return _0x148103;};'use strict';var _=require(_0x1a1f('0x0'));var util=require(_0x1a1f('0x1'));var logger=require(_0x1a1f('0x2'))(_0x1a1f('0x3'));var moment=require(_0x1a1f('0x4'));var BPromise=require(_0x1a1f('0x5'));var rp=require(_0x1a1f('0x6'));var fs=require('fs');var path=require(_0x1a1f('0x7'));var rimraf=require(_0x1a1f('0x8'));var config=require('../../config/environment');var attributes=require(_0x1a1f('0x9'));module[_0x1a1f('0xa')]=function(_0x5214fc,_0x3ec912){return _0x5214fc[_0x1a1f('0xb')](_0x1a1f('0xc'),attributes,{'tableName':_0x1a1f('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe85c=['exports','define','report_jscripty_answers','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./jscriptyAnswerReport.attributes'];(function(_0x23a907,_0x4e534d){var _0x33d002=function(_0x4c37bb){while(--_0x4c37bb){_0x23a907['push'](_0x23a907['shift']());}};_0x33d002(++_0x4e534d);}(_0xe85c,0x117));var _0xce85=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe85c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xce85('0x0'));var util=require(_0xce85('0x1'));var logger=require(_0xce85('0x2'))(_0xce85('0x3'));var moment=require(_0xce85('0x4'));var BPromise=require(_0xce85('0x5'));var rp=require(_0xce85('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xce85('0x7'));var config=require('../../config/environment');var attributes=require(_0xce85('0x8'));module[_0xce85('0x9')]=function(_0x35c83f,_0x6738f0){return _0x35c83f[_0xce85('0xa')]('JscriptyAnswerReport',attributes,{'tableName':_0xce85('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 593983b..51710e0 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 _0xb92a=['request','then','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http'];(function(_0x375e6,_0x2648f7){var _0xa290d8=function(_0x1fe89e){while(--_0x1fe89e){_0x375e6['push'](_0x375e6['shift']());}};_0xa290d8(++_0x2648f7);}(_0xb92a,0xc5));var _0xab92=function(_0x5e42ca,_0x5a84c1){_0x5e42ca=_0x5e42ca-0x0;var _0x36cec6=_0xb92a[_0x5e42ca];return _0x36cec6;};'use strict';var _=require(_0xab92('0x0'));var util=require(_0xab92('0x1'));var moment=require(_0xab92('0x2'));var BPromise=require(_0xab92('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xab92('0x4'))['db'];var utils=require(_0xab92('0x5'));var logger=require('../../config/logger')(_0xab92('0x6'));var config=require('../../config/environment');var jayson=require(_0xab92('0x7'));var client=jayson[_0xab92('0x8')][_0xab92('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x482120,_0x1b7343,_0x530605){return new BPromise(function(_0x539ce5,_0x4af618){return client[_0xab92('0xa')](_0x482120,_0x530605)[_0xab92('0xb')](function(_0x4bd998){logger[_0xab92('0xc')](_0xab92('0xd'),_0x1b7343,_0xab92('0xe'));logger[_0xab92('0xf')](_0xab92('0x10'),_0x1b7343,_0xab92('0xe'),JSON[_0xab92('0x11')](_0x4bd998));if(_0x4bd998[_0xab92('0x12')]){if(_0x4bd998['error'][_0xab92('0x13')]===0x1f4){logger[_0xab92('0x12')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x1b7343,_0x4bd998[_0xab92('0x12')][_0xab92('0x14')]);return _0x4af618(_0x4bd998['error']['message']);}logger['error']('JscriptyAnswerReport,\x20%s,\x20%s',_0x1b7343,_0x4bd998[_0xab92('0x12')]['message']);return _0x539ce5(_0x4bd998[_0xab92('0x12')][_0xab92('0x14')]);}else{logger[_0xab92('0xc')](_0xab92('0xd'),_0x1b7343,_0xab92('0xe'));_0x539ce5(_0x4bd998[_0xab92('0x15')][_0xab92('0x14')]);}})[_0xab92('0x16')](function(_0x27d90d){logger[_0xab92('0x12')](_0xab92('0xd'),_0x1b7343,_0x27d90d);_0x4af618(_0x27d90d);});});} \ No newline at end of file +var _0x2372=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','code','JscriptyAnswerReport,\x20%s,\x20%s','message','info','request\x20sent','result','catch','lodash','util'];(function(_0x3b2f18,_0xca1ba4){var _0x468266=function(_0x2a8ace){while(--_0x2a8ace){_0x3b2f18['push'](_0x3b2f18['shift']());}};_0x468266(++_0xca1ba4);}(_0x2372,0x11c));var _0x2237=function(_0x5223bf,_0x109da4){_0x5223bf=_0x5223bf-0x0;var _0x181da4=_0x2372[_0x5223bf];return _0x181da4;};'use strict';var _=require(_0x2237('0x0'));var util=require(_0x2237('0x1'));var moment=require(_0x2237('0x2'));var BPromise=require('bluebird');var rs=require(_0x2237('0x3'));var fs=require('fs');var Redis=require(_0x2237('0x4'));var db=require(_0x2237('0x5'))['db'];var utils=require(_0x2237('0x6'));var logger=require(_0x2237('0x7'))(_0x2237('0x8'));var config=require(_0x2237('0x9'));var jayson=require(_0x2237('0xa'));var client=jayson[_0x2237('0xb')][_0x2237('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x20de01,_0x401ba7,_0x477b8e){return new BPromise(function(_0x390902,_0x3e9671){return client[_0x2237('0xd')](_0x20de01,_0x477b8e)[_0x2237('0xe')](function(_0x125c93){logger['info']('JscriptyAnswerReport,\x20%s,\x20%s',_0x401ba7,'request\x20sent');logger[_0x2237('0xf')](_0x2237('0x10'),_0x401ba7,'request\x20sent',JSON[_0x2237('0x11')](_0x125c93));if(_0x125c93[_0x2237('0x12')]){if(_0x125c93['error'][_0x2237('0x13')]===0x1f4){logger[_0x2237('0x12')](_0x2237('0x14'),_0x401ba7,_0x125c93[_0x2237('0x12')][_0x2237('0x15')]);return _0x3e9671(_0x125c93[_0x2237('0x12')][_0x2237('0x15')]);}logger[_0x2237('0x12')](_0x2237('0x14'),_0x401ba7,_0x125c93['error'][_0x2237('0x15')]);return _0x390902(_0x125c93[_0x2237('0x12')][_0x2237('0x15')]);}else{logger[_0x2237('0x16')](_0x2237('0x14'),_0x401ba7,_0x2237('0x17'));_0x390902(_0x125c93[_0x2237('0x18')][_0x2237('0x15')]);}})[_0x2237('0x19')](function(_0x797924){logger['error'](_0x2237('0x14'),_0x401ba7,_0x797924);_0x3e9671(_0x797924);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index afa49dc..ab132f1 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 _0x0cb7=['/:id/summary','getSummary','create','post','/:id/clone','clone','put','update','delete','destroy','exports','util','connect-timeout','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','get','isAuthenticated','index','/:id','show','/:id/sessions','getSessions','/:id/answers','getAnswers'];(function(_0x9688a3,_0x2ff591){var _0x49de24=function(_0x1778d5){while(--_0x1778d5){_0x9688a3['push'](_0x9688a3['shift']());}};_0x49de24(++_0x2ff591);}(_0x0cb7,0x150));var _0x70cb=function(_0x47cd3a,_0x2390d8){_0x47cd3a=_0x47cd3a-0x0;var _0x2acf91=_0x0cb7[_0x47cd3a];return _0x2acf91;};'use strict';var multer=require('multer');var util=require(_0x70cb('0x0'));var path=require('path');var timeout=require(_0x70cb('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x70cb('0x2'));var config=require(_0x70cb('0x3'));var controller=require(_0x70cb('0x4'));router[_0x70cb('0x5')]('/',auth[_0x70cb('0x6')](),controller[_0x70cb('0x7')]);router[_0x70cb('0x5')](_0x70cb('0x8'),auth['isAuthenticated'](),controller[_0x70cb('0x9')]);router[_0x70cb('0x5')](_0x70cb('0xa'),auth[_0x70cb('0x6')](),controller[_0x70cb('0xb')]);router[_0x70cb('0x5')](_0x70cb('0xc'),auth[_0x70cb('0x6')](),controller[_0x70cb('0xd')]);router[_0x70cb('0x5')](_0x70cb('0xe'),auth[_0x70cb('0x6')](),timeout('30s'),controller[_0x70cb('0xf')]);router['post']('/',auth[_0x70cb('0x6')](),controller[_0x70cb('0x10')]);router[_0x70cb('0x11')](_0x70cb('0x12'),auth[_0x70cb('0x6')](),controller[_0x70cb('0x13')]);router[_0x70cb('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x70cb('0x15')]);router[_0x70cb('0x16')](_0x70cb('0x8'),auth[_0x70cb('0x6')](),controller[_0x70cb('0x17')]);module[_0x70cb('0x18')]=router; \ No newline at end of file +var _0x229e=['multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/sessions','getSessions','/:id/answers','getAnswers','30s','getSummary','post','/:id/clone','clone','put','delete'];(function(_0x722360,_0x217e4f){var _0x39590f=function(_0x1aa9f8){while(--_0x1aa9f8){_0x722360['push'](_0x722360['shift']());}};_0x39590f(++_0x217e4f);}(_0x229e,0x159));var _0xe229=function(_0x4fcbe7,_0x527130){_0x4fcbe7=_0x4fcbe7-0x0;var _0x14d0eb=_0x229e[_0x4fcbe7];return _0x14d0eb;};'use strict';var multer=require(_0xe229('0x0'));var util=require(_0xe229('0x1'));var path=require(_0xe229('0x2'));var timeout=require(_0xe229('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xe229('0x4'));var auth=require(_0xe229('0x5'));var interaction=require(_0xe229('0x6'));var config=require(_0xe229('0x7'));var controller=require('./jscriptyProject.controller');router[_0xe229('0x8')]('/',auth[_0xe229('0x9')](),controller['index']);router[_0xe229('0x8')](_0xe229('0xa'),auth[_0xe229('0x9')](),controller[_0xe229('0xb')]);router['get'](_0xe229('0xc'),auth['isAuthenticated'](),controller[_0xe229('0xd')]);router[_0xe229('0x8')](_0xe229('0xe'),auth[_0xe229('0x9')](),controller[_0xe229('0xf')]);router[_0xe229('0x8')]('/:id/summary',auth[_0xe229('0x9')](),timeout(_0xe229('0x10')),controller[_0xe229('0x11')]);router[_0xe229('0x12')]('/',auth['isAuthenticated'](),controller['create']);router[_0xe229('0x12')](_0xe229('0x13'),auth[_0xe229('0x9')](),controller[_0xe229('0x14')]);router[_0xe229('0x15')]('/:id',auth[_0xe229('0x9')](),controller['update']);router[_0xe229('0x16')](_0xe229('0xa'),auth[_0xe229('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index ab3bf01..5b7c2c7 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 _0x2b55=['stringify','isString','format','getDataValue','description','BOOLEAN','util','name','STRING','long','setDataValue','formData'];(function(_0x5288f9,_0x1320eb){var _0x4b17ae=function(_0x194dbd){while(--_0x194dbd){_0x5288f9['push'](_0x5288f9['shift']());}};_0x4b17ae(++_0x1320eb);}(_0x2b55,0x96));var _0x52b5=function(_0x1a684c,_0x49a9f4){_0x1a684c=_0x1a684c-0x0;var _0x3d9657=_0x2b55[_0x1a684c];return _0x3d9657;};'use strict';var Sequelize=require('sequelize');var _=require('lodash');var util=require(_0x52b5('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x52b5('0x1')},'description':{'type':Sequelize[_0x52b5('0x2')]},'formData':{'type':Sequelize['TEXT'](_0x52b5('0x3')),'set':function(_0x2f2d81){if(_['isObjectLike'](_0x2f2d81)){this[_0x52b5('0x4')](_0x52b5('0x5'),JSON[_0x52b5('0x6')](_0x2f2d81));}else if(_[_0x52b5('0x7')](_0x2f2d81)){this[_0x52b5('0x4')](_0x52b5('0x5'),_0x2f2d81);}else{this[_0x52b5('0x4')](_0x52b5('0x5'),util[_0x52b5('0x8')]('{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}',this[_0x52b5('0x9')](_0x52b5('0x1'))||'',this['getDataValue'](_0x52b5('0xa'))||''));}}},'enableUncompleteSave':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x52b5('0xb')],'defaultValue':![]}}; \ No newline at end of file +var _0x0ddb=['STRING','name','TEXT','isObjectLike','setDataValue','formData','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','BOOLEAN','sequelize','util','exports'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x0ddb,0x101));var _0xb0dd=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x0ddb[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0xb0dd('0x0'));var _=require('lodash');var util=require(_0xb0dd('0x1'));module[_0xb0dd('0x2')]={'name':{'type':Sequelize[_0xb0dd('0x3')],'unique':_0xb0dd('0x4')},'description':{'type':Sequelize[_0xb0dd('0x3')]},'formData':{'type':Sequelize[_0xb0dd('0x5')]('long'),'set':function(_0x2a1a39){if(_[_0xb0dd('0x6')](_0x2a1a39)){this[_0xb0dd('0x7')](_0xb0dd('0x8'),JSON['stringify'](_0x2a1a39));}else if(_['isString'](_0x2a1a39)){this[_0xb0dd('0x7')]('formData',_0x2a1a39);}else{this[_0xb0dd('0x7')](_0xb0dd('0x8'),util['format'](_0xb0dd('0x9'),this[_0xb0dd('0xa')](_0xb0dd('0x4'))||'',this[_0xb0dd('0xa')](_0xb0dd('0xb'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0xb0dd('0xc')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index 7a0679b..dc4f566 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 _0xe54c=['now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','Content-disposition','Jscripty_Project_%d_Summary_%s.csv','Content-type','text/csv','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','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','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','then','destroy','Projects','error','name','index','map','JscriptyProject','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','keys','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','omit','createdAt','updatedAt','JscriptySessionReport','hasOwnProperty','ProjectId','findOne','number','fromCharCode','toString','indexOf','getSummary','startTime','starttime','parse','JscriptyQuestionReport','-createdAt','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','isEmpty'];(function(_0x64a51,_0x1c61b7){var _0x1eba45=function(_0x230cf8){while(--_0x230cf8){_0x64a51['push'](_0x64a51['shift']());}};_0x1eba45(++_0x1c61b7);}(_0xe54c,0x79));var _0xce54=function(_0x25acfe,_0x3797bc){_0x25acfe=_0x25acfe-0x0;var _0x547928=_0xe54c[_0x25acfe];return _0x547928;};'use strict';var emlformat=require(_0xce54('0x0'));var rimraf=require(_0xce54('0x1'));var zipdir=require(_0xce54('0x2'));var jsonpatch=require(_0xce54('0x3'));var rp=require(_0xce54('0x4'));var moment=require(_0xce54('0x5'));var BPromise=require(_0xce54('0x6'));var Mustache=require(_0xce54('0x7'));var util=require('util');var path=require(_0xce54('0x8'));var sox=require('sox');var csv=require(_0xce54('0x9'));var ejs=require(_0xce54('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xce54('0xb'));var squel=require('squel');var crypto=require(_0xce54('0xc'));var jsforce=require(_0xce54('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xce54('0x9'));var querystring=require(_0xce54('0xe'));var Papa=require(_0xce54('0xf'));var Redis=require(_0xce54('0x10'));var authService=require(_0xce54('0x11'));var qs=require(_0xce54('0x12'));var as=require(_0xce54('0x13'));var hardwareService=require(_0xce54('0x14'));var logger=require(_0xce54('0x15'))(_0xce54('0x16'));var utils=require(_0xce54('0x17'));var config=require(_0xce54('0x18'));var licenseUtil=require(_0xce54('0x19'));var db=require(_0xce54('0x1a'))['db'];function respondWithStatusCode(_0x5a0590,_0x50f922){_0x50f922=_0x50f922||0xcc;return function(_0x5a0562){if(_0x5a0562){return _0x5a0590[_0xce54('0x1b')](_0x50f922);}return _0x5a0590['status'](_0x50f922)[_0xce54('0x1c')]();};}function respondWithResult(_0x1f7a09,_0x57e827){_0x57e827=_0x57e827||0xc8;return function(_0x586520){if(_0x586520){return _0x1f7a09[_0xce54('0x1d')](_0x57e827)[_0xce54('0x1e')](_0x586520);}};}function respondWithFilteredResult(_0x14b863,_0x19724c){return function(_0x3c8569){if(_0x3c8569){var _0x57effb=typeof _0x19724c['offset']===_0xce54('0x1f')&&typeof _0x19724c[_0xce54('0x20')]===_0xce54('0x1f');var _0x4ed7f3=_0x3c8569[_0xce54('0x21')];var _0x4a670a=_0x57effb?0x0:_0x19724c[_0xce54('0x22')];var _0x523dc3=_0x57effb?_0x3c8569[_0xce54('0x21')]:_0x19724c['offset']+_0x19724c[_0xce54('0x20')];var _0x6c7d2;if(_0x523dc3>=_0x4ed7f3){_0x523dc3=_0x4ed7f3;_0x6c7d2=0xc8;}else{_0x6c7d2=0xce;}_0x14b863[_0xce54('0x1d')](_0x6c7d2);return _0x14b863[_0xce54('0x23')](_0xce54('0x24'),_0x4a670a+'-'+_0x523dc3+'/'+_0x4ed7f3)['json'](_0x3c8569);}return null;};}function patchUpdates(_0x50fe8c){return function(_0x375ae4){try{jsonpatch[_0xce54('0x25')](_0x375ae4,_0x50fe8c,!![]);}catch(_0x217877){return BPromise[_0xce54('0x26')](_0x217877);}return _0x375ae4[_0xce54('0x27')]();};}function saveUpdates(_0x23caa8,_0x35c3a8){return function(_0x486d35){if(_0x486d35){return _0x486d35['update'](_0x23caa8)[_0xce54('0x28')](function(_0x58ee98){return _0x58ee98;});}return null;};}function removeEntity(_0x3a6649,_0x3c41c3){return function(_0x3a96e6){if(_0x3a96e6){return _0x3a96e6[_0xce54('0x29')]()[_0xce54('0x28')](function(){var _0x2d83be=_0x3a96e6['get']({'plain':!![]});var _0xacd220=_0xce54('0x2a');return db['UserProfileResource'][_0xce54('0x29')]({'where':{'type':_0xacd220,'resourceId':_0x2d83be['id']}})[_0xce54('0x28')](function(){return _0x3a96e6;});})[_0xce54('0x28')](function(){_0x3a6649[_0xce54('0x1d')](0xcc)[_0xce54('0x1c')]();});}};}function handleEntityNotFound(_0x1cb75f,_0x4d3495){return function(_0x3e1a28){if(!_0x3e1a28){_0x1cb75f['sendStatus'](0x194);}return _0x3e1a28;};}function handleError(_0x585ef3,_0x1461c7){_0x1461c7=_0x1461c7||0x1f4;return function(_0x243aff){logger[_0xce54('0x2b')](_0x243aff['stack']);if(_0x243aff[_0xce54('0x2c')]){delete _0x243aff[_0xce54('0x2c')];}_0x585ef3['status'](_0x1461c7)['send'](_0x243aff);};}exports[_0xce54('0x2d')]=function(_0x1bb48d,_0x620627){var _0x526b90={},_0xe660d2={},_0x27a65e={'count':0x0,'rows':[]};var _0x3cbdab=_[_0xce54('0x2e')](db[_0xce54('0x2f')][_0xce54('0x30')],function(_0x8ac4d3){return{'name':_0x8ac4d3[_0xce54('0x31')],'type':_0x8ac4d3[_0xce54('0x32')][_0xce54('0x33')]};});_0xe660d2[_0xce54('0x34')]=_[_0xce54('0x2e')](_0x3cbdab,'name');_0xe660d2['query']=_['keys'](_0x1bb48d[_0xce54('0x35')]);_0xe660d2[_0xce54('0x36')]=_['intersection'](_0xe660d2['model'],_0xe660d2[_0xce54('0x35')]);_0x526b90[_0xce54('0x37')]=_[_0xce54('0x38')](_0xe660d2[_0xce54('0x34')],qs[_0xce54('0x39')](_0x1bb48d[_0xce54('0x35')][_0xce54('0x39')]));_0x526b90[_0xce54('0x37')]=_0x526b90[_0xce54('0x37')][_0xce54('0x3a')]?_0x526b90['attributes']:_0xe660d2['model'];if(!_0x1bb48d['query']['hasOwnProperty'](_0xce54('0x3b'))){_0x526b90[_0xce54('0x20')]=qs[_0xce54('0x20')](_0x1bb48d[_0xce54('0x35')]['limit']);_0x526b90[_0xce54('0x22')]=qs['offset'](_0x1bb48d[_0xce54('0x35')][_0xce54('0x22')]);}_0x526b90[_0xce54('0x3c')]=qs['sort'](_0x1bb48d['query'][_0xce54('0x3d')]);_0x526b90['where']=qs['filters'](_[_0xce54('0x3e')](_0x1bb48d[_0xce54('0x35')],_0xe660d2[_0xce54('0x36')]),_0x3cbdab);if(_0x1bb48d[_0xce54('0x35')][_0xce54('0x3f')]){_0x526b90[_0xce54('0x40')]=_[_0xce54('0x41')](_0x526b90[_0xce54('0x40')],{'$or':_[_0xce54('0x2e')](_0x3cbdab,function(_0x2aefb9){if(_0x2aefb9[_0xce54('0x32')]!==_0xce54('0x42')){var _0x324f24={};_0x324f24[_0x2aefb9[_0xce54('0x2c')]]={'$like':'%'+_0x1bb48d[_0xce54('0x35')][_0xce54('0x3f')]+'%'};return _0x324f24;}})});}_0x526b90=_['merge']({},_0x526b90,_0x1bb48d[_0xce54('0x43')]);var _0x59232c={'where':_0x526b90['where']};return db['JscriptyProject'][_0xce54('0x21')](_0x59232c)['then'](function(_0x5b76a6){_0x27a65e[_0xce54('0x21')]=_0x5b76a6;if(_0x1bb48d[_0xce54('0x35')][_0xce54('0x44')]){_0x526b90['include']=[{'all':!![]}];}return db[_0xce54('0x2f')][_0xce54('0x45')](_0x526b90);})['then'](function(_0x34ba65){_0x27a65e[_0xce54('0x46')]=_0x34ba65;return _0x27a65e;})[_0xce54('0x28')](respondWithFilteredResult(_0x620627,_0x526b90))[_0xce54('0x47')](handleError(_0x620627,null));};exports['show']=function(_0x413473,_0x5a40be){var _0x48a9c3={'raw':![],'where':{'id':_0x413473[_0xce54('0x48')]['id']}},_0x171669={};_0x171669['model']=_['keys'](db['JscriptyProject'][_0xce54('0x30')]);_0x171669[_0xce54('0x35')]=_[_0xce54('0x49')](_0x413473[_0xce54('0x35')]);_0x171669[_0xce54('0x36')]=_[_0xce54('0x38')](_0x171669[_0xce54('0x34')],_0x171669[_0xce54('0x35')]);_0x48a9c3[_0xce54('0x37')]=_[_0xce54('0x38')](_0x171669[_0xce54('0x34')],qs[_0xce54('0x39')](_0x413473['query'][_0xce54('0x39')]));_0x48a9c3[_0xce54('0x37')]=_0x48a9c3[_0xce54('0x37')]['length']?_0x48a9c3[_0xce54('0x37')]:_0x171669[_0xce54('0x34')];if(_0x413473[_0xce54('0x35')][_0xce54('0x44')]){_0x48a9c3[_0xce54('0x4a')]=[{'all':!![]}];}_0x48a9c3=_[_0xce54('0x41')]({},_0x48a9c3,_0x413473[_0xce54('0x43')]);return db[_0xce54('0x2f')][_0xce54('0x4b')](_0x48a9c3)[_0xce54('0x28')](handleEntityNotFound(_0x5a40be,null))[_0xce54('0x28')](respondWithResult(_0x5a40be,null))[_0xce54('0x47')](handleError(_0x5a40be,null));};exports['create']=function(_0x4ec949,_0x4c47e6){return db['JscriptyProject'][_0xce54('0x4c')](_0x4ec949[_0xce54('0x4d')],{})[_0xce54('0x28')](function(_0x2ce1fc){var _0x441919=_0x4ec949[_0xce54('0x4e')]['get']({'plain':!![]});if(!_0x441919)throw new Error(_0xce54('0x4f'));if(_0x441919[_0xce54('0x50')]===_0xce54('0x4e')){var _0x1e6360=_0x2ce1fc[_0xce54('0x51')]({'plain':!![]});var _0x324ab1='Projects';return db['UserProfileSection'][_0xce54('0x4b')]({'where':{'name':_0x324ab1,'userProfileId':_0x441919[_0xce54('0x52')]},'raw':!![]})['then'](function(_0x1ecdd0){if(_0x1ecdd0&&_0x1ecdd0['autoAssociation']===0x0){return db[_0xce54('0x53')][_0xce54('0x4c')]({'name':_0x1e6360[_0xce54('0x2c')],'resourceId':_0x1e6360['id'],'type':_0x1ecdd0['name'],'sectionId':_0x1ecdd0['id']},{})[_0xce54('0x28')](function(){return _0x2ce1fc;});}else{return _0x2ce1fc;}})[_0xce54('0x47')](function(_0x322dc4){logger[_0xce54('0x2b')](_0xce54('0x54'),_0x322dc4);throw _0x322dc4;});}return _0x2ce1fc;})[_0xce54('0x28')](respondWithResult(_0x4c47e6,0xc9))[_0xce54('0x47')](handleError(_0x4c47e6,null));};exports['clone']=function(_0x31c0df,_0x8f0279){var _0x1517d4={'where':{'id':_0x31c0df[_0xce54('0x48')]['id']}},_0x432afb={};_0x432afb[_0xce54('0x34')]=_['keys'](db[_0xce54('0x2f')][_0xce54('0x30')]);_0x1517d4['attributes']=_[_0xce54('0x38')](_0x432afb[_0xce54('0x34')],qs[_0xce54('0x39')](_0x31c0df[_0xce54('0x35')][_0xce54('0x39')]));_0x1517d4[_0xce54('0x37')]=_0x1517d4[_0xce54('0x37')]['length']?_0x1517d4[_0xce54('0x37')]:_0x432afb[_0xce54('0x34')];if(_0x31c0df[_0xce54('0x35')]['includeAll']){_0x1517d4['include']=[{'all':!![]}];}_0x1517d4=_[_0xce54('0x41')]({},_0x1517d4,_0x31c0df['options']);return db[_0xce54('0x2f')][_0xce54('0x4b')](_0x1517d4)[_0xce54('0x28')](handleEntityNotFound(_0x8f0279,null))['then'](function(_0x537a47){if(_0x537a47){var _0x2c3c7=_0x537a47[_0xce54('0x51')]({'plain':!![]});_0x2c3c7=qs[_0xce54('0x55')](_0x2c3c7,['id',_0xce54('0x56'),_0xce54('0x57')]);_0x31c0df[_0xce54('0x4d')]=_[_0xce54('0x55')](_0x31c0df['body'],['id',_0xce54('0x56'),_0xce54('0x57')]);return db[_0xce54('0x2f')][_0xce54('0x4c')](_['merge'](_0x2c3c7,_0x31c0df['body']),{'include':_0x31c0df['query'][_0xce54('0x44')]?[{'all':!![]}]:undefined})[_0xce54('0x28')](function(_0x42fb15){var _0x24ecb5=_0x31c0df[_0xce54('0x4e')]['get']({'plain':!![]});if(!_0x24ecb5)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x24ecb5[_0xce54('0x50')]==='user'){var _0x43931e=_0x42fb15[_0xce54('0x51')]({'plain':!![]});var _0x4621a5='Projects';return db['UserProfileSection'][_0xce54('0x4b')]({'where':{'name':_0x4621a5,'userProfileId':_0x24ecb5[_0xce54('0x52')]},'raw':!![]})[_0xce54('0x28')](function(_0x3e2def){if(_0x3e2def&&_0x3e2def['autoAssociation']===0x0){return db['UserProfileResource'][_0xce54('0x4c')]({'name':_0x43931e['name'],'resourceId':_0x43931e['id'],'type':_0x3e2def[_0xce54('0x2c')],'sectionId':_0x3e2def['id']},{})[_0xce54('0x28')](function(){return _0x42fb15;});}else{return _0x42fb15;}})[_0xce54('0x47')](function(_0x18996c){logger[_0xce54('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x18996c);throw _0x18996c;});}return _0x42fb15;});}})[_0xce54('0x28')](respondWithResult(_0x8f0279,0xc9))[_0xce54('0x47')](handleError(_0x8f0279,null));};exports['update']=function(_0x396e25,_0x146df4){if(_0x396e25[_0xce54('0x4d')]['id']){delete _0x396e25[_0xce54('0x4d')]['id'];}return db[_0xce54('0x2f')][_0xce54('0x4b')]({'where':{'id':_0x396e25[_0xce54('0x48')]['id']}})[_0xce54('0x28')](handleEntityNotFound(_0x146df4,null))[_0xce54('0x28')](saveUpdates(_0x396e25[_0xce54('0x4d')],null))[_0xce54('0x28')](respondWithResult(_0x146df4,null))[_0xce54('0x47')](handleError(_0x146df4,null));};exports[_0xce54('0x29')]=function(_0x4d74e3,_0xf01211){return db[_0xce54('0x2f')][_0xce54('0x4b')]({'where':{'id':_0x4d74e3['params']['id']}})['then'](handleEntityNotFound(_0xf01211,null))[_0xce54('0x28')](removeEntity(_0xf01211,null))[_0xce54('0x47')](handleError(_0xf01211,null));};exports['getSessions']=function(_0x3c25ed,_0x1ca193,_0x67afb9){var _0x56023d={'raw':!![],'where':{}};var _0x4e15af={};var _0x5a1c15={'count':0x0,'rows':[]};return db[_0xce54('0x2f')]['findOne']({'where':{'id':_0x3c25ed[_0xce54('0x48')]['id']}})[_0xce54('0x28')](handleEntityNotFound(_0x1ca193,null))[_0xce54('0x28')](function(_0x403053){if(_0x403053){_0x4e15af[_0xce54('0x34')]=_[_0xce54('0x49')](db[_0xce54('0x58')][_0xce54('0x30')]);_0x4e15af[_0xce54('0x35')]=_[_0xce54('0x49')](_0x3c25ed[_0xce54('0x35')]);_0x4e15af[_0xce54('0x36')]=_[_0xce54('0x38')](_0x4e15af['model'],_0x4e15af['query']);_0x56023d['attributes']=_[_0xce54('0x38')](_0x4e15af[_0xce54('0x34')],qs[_0xce54('0x39')](_0x3c25ed[_0xce54('0x35')][_0xce54('0x39')]));_0x56023d[_0xce54('0x37')]=_0x56023d[_0xce54('0x37')][_0xce54('0x3a')]?_0x56023d[_0xce54('0x37')]:_0x4e15af[_0xce54('0x34')];if(!_0x3c25ed[_0xce54('0x35')][_0xce54('0x59')](_0xce54('0x3b'))){_0x56023d[_0xce54('0x20')]=qs['limit'](_0x3c25ed[_0xce54('0x35')][_0xce54('0x20')]);_0x56023d['offset']=qs['offset'](_0x3c25ed[_0xce54('0x35')][_0xce54('0x22')]);}_0x56023d[_0xce54('0x3c')]=qs[_0xce54('0x3d')](_0x3c25ed[_0xce54('0x35')]['sort']);_0x56023d['where']=qs['filters'](_[_0xce54('0x3e')](_0x3c25ed[_0xce54('0x35')],_0x4e15af[_0xce54('0x36')]));_0x56023d[_0xce54('0x40')][_0xce54('0x5a')]=_0x403053['id'];if(_0x3c25ed[_0xce54('0x35')][_0xce54('0x3f')]){_0x56023d[_0xce54('0x40')]=_[_0xce54('0x41')](_0x56023d['where'],{'$or':_[_0xce54('0x2e')](_0x56023d[_0xce54('0x37')],function(_0x570432){var _0x3b3f95={};_0x3b3f95[_0x570432]={'$like':'%'+_0x3c25ed[_0xce54('0x35')][_0xce54('0x3f')]+'%'};return _0x3b3f95;})});}_0x56023d=_[_0xce54('0x41')]({},_0x56023d,_0x3c25ed[_0xce54('0x43')]);return db[_0xce54('0x58')][_0xce54('0x21')]({'where':_0x56023d[_0xce54('0x40')]})[_0xce54('0x28')](function(_0xaa583a){_0x5a1c15[_0xce54('0x21')]=_0xaa583a;if(_0x3c25ed[_0xce54('0x35')][_0xce54('0x44')]){_0x56023d[_0xce54('0x4a')]=[{'all':!![]}];}return db[_0xce54('0x58')]['findAll'](_0x56023d);})[_0xce54('0x28')](function(_0x4a8bea){_0x5a1c15[_0xce54('0x46')]=_0x4a8bea;return _0x5a1c15;});}})['then'](respondWithFilteredResult(_0x1ca193,_0x56023d))[_0xce54('0x47')](handleError(_0x1ca193,null));};exports['getAnswers']=function(_0x14e5f6,_0x5884cf,_0x1c6372){var _0x39b06f={'raw':!![],'where':{}};var _0x62c7c1={};var _0x1dc888={'count':0x0,'rows':[]};return db[_0xce54('0x2f')][_0xce54('0x5b')]({'where':{'id':_0x14e5f6[_0xce54('0x48')]['id']}})[_0xce54('0x28')](handleEntityNotFound(_0x5884cf,null))['then'](function(_0x6eb4c8){if(_0x6eb4c8){_0x62c7c1[_0xce54('0x34')]=_[_0xce54('0x49')](db['JscriptyAnswerReport']['rawAttributes']);_0x62c7c1['query']=_[_0xce54('0x49')](_0x14e5f6[_0xce54('0x35')]);_0x62c7c1[_0xce54('0x36')]=_[_0xce54('0x38')](_0x62c7c1[_0xce54('0x34')],_0x62c7c1['query']);_0x39b06f['attributes']=_[_0xce54('0x38')](_0x62c7c1[_0xce54('0x34')],qs[_0xce54('0x39')](_0x14e5f6[_0xce54('0x35')][_0xce54('0x39')]));_0x39b06f[_0xce54('0x37')]=_0x39b06f[_0xce54('0x37')][_0xce54('0x3a')]?_0x39b06f['attributes']:_0x62c7c1[_0xce54('0x34')];if(!_0x14e5f6[_0xce54('0x35')][_0xce54('0x59')](_0xce54('0x3b'))){_0x39b06f['limit']=qs[_0xce54('0x20')](_0x14e5f6[_0xce54('0x35')][_0xce54('0x20')]);_0x39b06f[_0xce54('0x22')]=qs[_0xce54('0x22')](_0x14e5f6[_0xce54('0x35')]['offset']);}_0x39b06f[_0xce54('0x3c')]=qs[_0xce54('0x3d')](_0x14e5f6[_0xce54('0x35')]['sort']);_0x39b06f[_0xce54('0x40')]=qs[_0xce54('0x36')](_[_0xce54('0x3e')](_0x14e5f6['query'],_0x62c7c1['filters']));_0x39b06f[_0xce54('0x40')][_0xce54('0x5a')]=_0x6eb4c8['id'];if(_0x14e5f6[_0xce54('0x35')][_0xce54('0x3f')]){_0x39b06f[_0xce54('0x40')]=_[_0xce54('0x41')](_0x39b06f[_0xce54('0x40')],{'$or':_[_0xce54('0x2e')](_0x39b06f['attributes'],function(_0x5bbc9c){var _0x5c9bf1={};_0x5c9bf1[_0x5bbc9c]={'$like':'%'+_0x14e5f6[_0xce54('0x35')][_0xce54('0x3f')]+'%'};return _0x5c9bf1;})});}_0x39b06f=_[_0xce54('0x41')]({},_0x39b06f,_0x14e5f6[_0xce54('0x43')]);return db['JscriptyAnswerReport'][_0xce54('0x21')]({'where':_0x39b06f['where']})[_0xce54('0x28')](function(_0x1427e9){_0x1dc888[_0xce54('0x21')]=_0x1427e9;if(_0x14e5f6['query'][_0xce54('0x44')]){_0x39b06f['include']=[{'all':!![]}];}return db['JscriptyAnswerReport']['findAll'](_0x39b06f);})[_0xce54('0x28')](function(_0x15a40d){_0x1dc888['rows']=_0x15a40d;return _0x1dc888;});}})[_0xce54('0x28')](respondWithFilteredResult(_0x5884cf,_0x39b06f))[_0xce54('0x47')](handleError(_0x5884cf,null));};function char(_0x39dbb1){return _0xce54('0x5c')===typeof _0x39dbb1?String[_0xce54('0x5d')][_0xce54('0x25')](null,arguments):_0x39dbb1;}function needsEncapsulation(_0x30668b){return!!_0x30668b&&(_0x30668b[_0xce54('0x5e')]()[_0xce54('0x5f')](char(0xd))>=0x0||_0x30668b[_0xce54('0x5e')]()[_0xce54('0x5f')](char(0xa))>=0x0||_0x30668b['toString']()[_0xce54('0x5f')](char(0x2c))>=0x0||_0x30668b[_0xce54('0x5e')]()[_0xce54('0x5f')](char(0x22))>=0x0);}function encapsulate(_0xfd8861){var _0x44baaa=char(0x22),_0x580700='\x5c'+char(0x22),_0x19f346=_0xfd8861[_0xce54('0x5e')]()['replace'](new RegExp(_0x44baaa,'g'),_0x580700);return _0x44baaa+_0x19f346+_0x44baaa;}exports[_0xce54('0x60')]=function(_0x32154b,_0x249297,_0x350010){var _0x2bea25,_0x491491;var _0x48970f={'where':{'ProjectId':_0x32154b['params']['id']}};if(_0x32154b[_0xce54('0x35')][_0xce54('0x61')]){_0x48970f[_0xce54('0x40')][_0xce54('0x62')]=JSON[_0xce54('0x63')](_0x32154b[_0xce54('0x35')][_0xce54('0x61')]);}return db[_0xce54('0x58')]['findAll'](_0x48970f)[_0xce54('0x28')](handleEntityNotFound(_0x249297,null))[_0xce54('0x28')](function(_0x5cc9f1){if(_0x5cc9f1){_0x2bea25=_0x5cc9f1;return db[_0xce54('0x64')][_0xce54('0x45')]({'where':{'SessionId':{'$in':_[_0xce54('0x2e')](_0x2bea25,'id')},'ProjectId':_0x32154b['params']['id']},'order':_0xce54('0x65')});}})[_0xce54('0x28')](handleEntityNotFound(_0x249297,null))[_0xce54('0x28')](function(_0x39428b){if(_0x39428b){_0x491491=_0x39428b;var _0xca45={};for(var _0x48b65a=0x0,_0x256d63=_0x491491[_0xce54('0x3a')];_0x48b65a<_0x256d63;_0x48b65a++){if(!_0xca45['hasOwnProperty'](_0x491491[_0x48b65a][_0xce54('0x66')])){_0xca45[_0x491491[_0x48b65a]['questionId']]=needsEncapsulation(_0x491491[_0x48b65a]['question'])?encapsulate(_0x491491[_0x48b65a][_0xce54('0x67')]):_0x491491[_0x48b65a][_0xce54('0x67')];}}var _0x3903cd=[],_0x263149={};for(var _0x2c5e0a=0x0,_0x686d23=_0x2bea25['length'];_0x2c5e0a<_0x686d23;_0x2c5e0a++){_0x263149={'ProjectId':_0x32154b[_0xce54('0x48')]['id'],'SessionId':_0x2bea25[_0x2c5e0a]['id'],'StartTime':moment(_0x2bea25[_0x2c5e0a][_0xce54('0x62')])[_0xce54('0x68')](_0xce54('0x69'))};for(var _0x15197d=0x0,_0x20a83f=_0x491491[_0xce54('0x3a')];_0x15197d<_0x20a83f;_0x15197d++){if(_0x491491[_0x15197d]['SessionId']==_0x2bea25[_0x2c5e0a]['id']&&_0xca45[_0xce54('0x59')](_0x491491[_0x15197d][_0xce54('0x66')])){_0x263149[_0xca45[_0x491491[_0x15197d]['questionId']]]=_0x491491[_0x15197d]['answer'];}}for(var _0x19bd08 in _0xca45){if(!_0x263149[_0xce54('0x59')](_0xca45[_0x19bd08])){_0x263149[_0xca45[_0x19bd08]]=null;}}_0x3903cd['push'](_0x263149);}return _0x3903cd;}})[_0xce54('0x28')](function(_0x310034){if(!_[_0xce54('0x6a')](_0x310034)){var _0x2d4580=toCsv(_0x310034);var _0x4b6c54=Date[_0xce54('0x6b')]();fs[_0xce54('0x6c')](util['format'](_0xce54('0x6d'),_0x32154b[_0xce54('0x48')]['id'],_0x4b6c54),_0x2d4580);_0x249297['setHeader'](_0xce54('0x6e'),'attachment;\x20filename='+util[_0xce54('0x68')](_0xce54('0x6f'),_0x32154b[_0xce54('0x48')]['id'],_0x4b6c54));_0x249297['setHeader'](_0xce54('0x70'),_0xce54('0x71'));return _0x249297['download'](util[_0xce54('0x68')](_0xce54('0x6d'),_0x32154b['params']['id'],_0x4b6c54));}else{return _0x249297['sendStatus'](0xcc);}})['catch'](handleError(_0x249297,null));}; \ No newline at end of file +var _0x2d93=['/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','text/csv','download','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','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','apply','then','get','UserProfileResource','destroy','name','send','map','JscriptyProject','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','rawAttributes','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','updatedAt','omit','role','error','update','JscriptySessionReport','nolimit','pick','getAnswers','JscriptyAnswerReport','ProjectId','number','fromCharCode','indexOf','toString','replace','getSummary','startTime','-createdAt','questionId','question','starttime','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','push','isEmpty','now'];(function(_0x36d7e7,_0xc983da){var _0x4d1f32=function(_0x1d02c4){while(--_0x1d02c4){_0x36d7e7['push'](_0x36d7e7['shift']());}};_0x4d1f32(++_0xc983da);}(_0x2d93,0xf3));var _0x32d9=function(_0x541ea6,_0x51cab6){_0x541ea6=_0x541ea6-0x0;var _0x3c3e84=_0x2d93[_0x541ea6];return _0x3c3e84;};'use strict';var emlformat=require(_0x32d9('0x0'));var rimraf=require(_0x32d9('0x1'));var zipdir=require(_0x32d9('0x2'));var jsonpatch=require(_0x32d9('0x3'));var rp=require(_0x32d9('0x4'));var moment=require(_0x32d9('0x5'));var BPromise=require(_0x32d9('0x6'));var Mustache=require(_0x32d9('0x7'));var util=require(_0x32d9('0x8'));var path=require(_0x32d9('0x9'));var sox=require(_0x32d9('0xa'));var csv=require(_0x32d9('0xb'));var ejs=require(_0x32d9('0xc'));var fs=require('fs');var fs_extra=require(_0x32d9('0xd'));var _=require('lodash');var squel=require(_0x32d9('0xe'));var crypto=require(_0x32d9('0xf'));var jsforce=require(_0x32d9('0x10'));var deskjs=require(_0x32d9('0x11'));var toCsv=require(_0x32d9('0xb'));var querystring=require('querystring');var Papa=require(_0x32d9('0x12'));var Redis=require(_0x32d9('0x13'));var authService=require(_0x32d9('0x14'));var qs=require(_0x32d9('0x15'));var as=require(_0x32d9('0x16'));var hardwareService=require(_0x32d9('0x17'));var logger=require(_0x32d9('0x18'))(_0x32d9('0x19'));var utils=require(_0x32d9('0x1a'));var config=require(_0x32d9('0x1b'));var licenseUtil=require(_0x32d9('0x1c'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5afced,_0x16e983){_0x16e983=_0x16e983||0xcc;return function(_0x3ae057){if(_0x3ae057){return _0x5afced[_0x32d9('0x1d')](_0x16e983);}return _0x5afced[_0x32d9('0x1e')](_0x16e983)[_0x32d9('0x1f')]();};}function respondWithResult(_0x3b1d99,_0x9a0f21){_0x9a0f21=_0x9a0f21||0xc8;return function(_0x209a5c){if(_0x209a5c){return _0x3b1d99[_0x32d9('0x1e')](_0x9a0f21)[_0x32d9('0x20')](_0x209a5c);}};}function respondWithFilteredResult(_0x427433,_0x428821){return function(_0x5ebcab){if(_0x5ebcab){var _0x251b58=typeof _0x428821[_0x32d9('0x21')]==='undefined'&&typeof _0x428821[_0x32d9('0x22')]===_0x32d9('0x23');var _0x25fe2c=_0x5ebcab[_0x32d9('0x24')];var _0xd3e7a3=_0x251b58?0x0:_0x428821[_0x32d9('0x21')];var _0x33bb0b=_0x251b58?_0x5ebcab[_0x32d9('0x24')]:_0x428821[_0x32d9('0x21')]+_0x428821[_0x32d9('0x22')];var _0x543607;if(_0x33bb0b>=_0x25fe2c){_0x33bb0b=_0x25fe2c;_0x543607=0xc8;}else{_0x543607=0xce;}_0x427433['status'](_0x543607);return _0x427433[_0x32d9('0x25')](_0x32d9('0x26'),_0xd3e7a3+'-'+_0x33bb0b+'/'+_0x25fe2c)['json'](_0x5ebcab);}return null;};}function patchUpdates(_0x13f8b0){return function(_0x55b7a8){try{jsonpatch[_0x32d9('0x27')](_0x55b7a8,_0x13f8b0,!![]);}catch(_0x298cb6){return BPromise['reject'](_0x298cb6);}return _0x55b7a8['save']();};}function saveUpdates(_0x3e2ef3,_0xcd2cec){return function(_0x56b703){if(_0x56b703){return _0x56b703['update'](_0x3e2ef3)[_0x32d9('0x28')](function(_0x4162bc){return _0x4162bc;});}return null;};}function removeEntity(_0x339697,_0x37a0ce){return function(_0x3cb824){if(_0x3cb824){return _0x3cb824['destroy']()[_0x32d9('0x28')](function(){var _0x1c51a8=_0x3cb824[_0x32d9('0x29')]({'plain':!![]});var _0x215440='Projects';return db[_0x32d9('0x2a')][_0x32d9('0x2b')]({'where':{'type':_0x215440,'resourceId':_0x1c51a8['id']}})[_0x32d9('0x28')](function(){return _0x3cb824;});})['then'](function(){_0x339697[_0x32d9('0x1e')](0xcc)[_0x32d9('0x1f')]();});}};}function handleEntityNotFound(_0x2dbc8c,_0xca2f14){return function(_0x5bd3f3){if(!_0x5bd3f3){_0x2dbc8c[_0x32d9('0x1d')](0x194);}return _0x5bd3f3;};}function handleError(_0x3cf5f2,_0x3d4258){_0x3d4258=_0x3d4258||0x1f4;return function(_0x7e7582){logger['error'](_0x7e7582['stack']);if(_0x7e7582['name']){delete _0x7e7582[_0x32d9('0x2c')];}_0x3cf5f2[_0x32d9('0x1e')](_0x3d4258)[_0x32d9('0x2d')](_0x7e7582);};}exports['index']=function(_0x272449,_0xda0f8f){var _0x56a7ab={},_0x28dc4={},_0x11909b={'count':0x0,'rows':[]};var _0x1b0dfb=_[_0x32d9('0x2e')](db[_0x32d9('0x2f')]['rawAttributes'],function(_0x28165e){return{'name':_0x28165e[_0x32d9('0x30')],'type':_0x28165e[_0x32d9('0x31')][_0x32d9('0x32')]};});_0x28dc4['model']=_[_0x32d9('0x2e')](_0x1b0dfb,'name');_0x28dc4[_0x32d9('0x33')]=_[_0x32d9('0x34')](_0x272449[_0x32d9('0x33')]);_0x28dc4[_0x32d9('0x35')]=_[_0x32d9('0x36')](_0x28dc4[_0x32d9('0x37')],_0x28dc4[_0x32d9('0x33')]);_0x56a7ab[_0x32d9('0x38')]=_[_0x32d9('0x36')](_0x28dc4['model'],qs[_0x32d9('0x39')](_0x272449[_0x32d9('0x33')][_0x32d9('0x39')]));_0x56a7ab[_0x32d9('0x38')]=_0x56a7ab[_0x32d9('0x38')][_0x32d9('0x3a')]?_0x56a7ab[_0x32d9('0x38')]:_0x28dc4[_0x32d9('0x37')];if(!_0x272449[_0x32d9('0x33')][_0x32d9('0x3b')]('nolimit')){_0x56a7ab['limit']=qs[_0x32d9('0x22')](_0x272449[_0x32d9('0x33')][_0x32d9('0x22')]);_0x56a7ab[_0x32d9('0x21')]=qs[_0x32d9('0x21')](_0x272449[_0x32d9('0x33')][_0x32d9('0x21')]);}_0x56a7ab[_0x32d9('0x3c')]=qs[_0x32d9('0x3d')](_0x272449[_0x32d9('0x33')]['sort']);_0x56a7ab[_0x32d9('0x3e')]=qs['filters'](_['pick'](_0x272449[_0x32d9('0x33')],_0x28dc4[_0x32d9('0x35')]),_0x1b0dfb);if(_0x272449['query'][_0x32d9('0x3f')]){_0x56a7ab['where']=_[_0x32d9('0x40')](_0x56a7ab[_0x32d9('0x3e')],{'$or':_[_0x32d9('0x2e')](_0x1b0dfb,function(_0x4a15af){if(_0x4a15af[_0x32d9('0x31')]!==_0x32d9('0x41')){var _0x2649d8={};_0x2649d8[_0x4a15af[_0x32d9('0x2c')]]={'$like':'%'+_0x272449[_0x32d9('0x33')][_0x32d9('0x3f')]+'%'};return _0x2649d8;}})});}_0x56a7ab=_[_0x32d9('0x40')]({},_0x56a7ab,_0x272449[_0x32d9('0x42')]);var _0x5eabdb={'where':_0x56a7ab['where']};return db[_0x32d9('0x2f')][_0x32d9('0x24')](_0x5eabdb)['then'](function(_0x2eeb32){_0x11909b[_0x32d9('0x24')]=_0x2eeb32;if(_0x272449[_0x32d9('0x33')][_0x32d9('0x43')]){_0x56a7ab['include']=[{'all':!![]}];}return db['JscriptyProject'][_0x32d9('0x44')](_0x56a7ab);})[_0x32d9('0x28')](function(_0x12c469){_0x11909b[_0x32d9('0x45')]=_0x12c469;return _0x11909b;})[_0x32d9('0x28')](respondWithFilteredResult(_0xda0f8f,_0x56a7ab))[_0x32d9('0x46')](handleError(_0xda0f8f,null));};exports[_0x32d9('0x47')]=function(_0x15f42f,_0x2edc21){var _0x4344dc={'raw':![],'where':{'id':_0x15f42f[_0x32d9('0x48')]['id']}},_0x56c419={};_0x56c419['model']=_[_0x32d9('0x34')](db[_0x32d9('0x2f')][_0x32d9('0x49')]);_0x56c419['query']=_['keys'](_0x15f42f['query']);_0x56c419[_0x32d9('0x35')]=_[_0x32d9('0x36')](_0x56c419['model'],_0x56c419[_0x32d9('0x33')]);_0x4344dc['attributes']=_[_0x32d9('0x36')](_0x56c419['model'],qs[_0x32d9('0x39')](_0x15f42f[_0x32d9('0x33')][_0x32d9('0x39')]));_0x4344dc[_0x32d9('0x38')]=_0x4344dc[_0x32d9('0x38')]['length']?_0x4344dc[_0x32d9('0x38')]:_0x56c419[_0x32d9('0x37')];if(_0x15f42f[_0x32d9('0x33')]['includeAll']){_0x4344dc[_0x32d9('0x4a')]=[{'all':!![]}];}_0x4344dc=_[_0x32d9('0x40')]({},_0x4344dc,_0x15f42f[_0x32d9('0x42')]);return db[_0x32d9('0x2f')][_0x32d9('0x4b')](_0x4344dc)['then'](handleEntityNotFound(_0x2edc21,null))[_0x32d9('0x28')](respondWithResult(_0x2edc21,null))[_0x32d9('0x46')](handleError(_0x2edc21,null));};exports[_0x32d9('0x4c')]=function(_0x433d90,_0x4f0df5){return db['JscriptyProject'][_0x32d9('0x4c')](_0x433d90[_0x32d9('0x4d')],{})[_0x32d9('0x28')](function(_0x39eee9){var _0x26959d=_0x433d90[_0x32d9('0x4e')][_0x32d9('0x29')]({'plain':!![]});if(!_0x26959d)throw new Error(_0x32d9('0x4f'));if(_0x26959d['role']===_0x32d9('0x4e')){var _0x1d7425=_0x39eee9[_0x32d9('0x29')]({'plain':!![]});var _0x4d1197='Projects';return db[_0x32d9('0x50')][_0x32d9('0x4b')]({'where':{'name':_0x4d1197,'userProfileId':_0x26959d[_0x32d9('0x51')]},'raw':!![]})[_0x32d9('0x28')](function(_0x144dac){if(_0x144dac&&_0x144dac[_0x32d9('0x52')]===0x0){return db['UserProfileResource']['create']({'name':_0x1d7425[_0x32d9('0x2c')],'resourceId':_0x1d7425['id'],'type':_0x144dac[_0x32d9('0x2c')],'sectionId':_0x144dac['id']},{})['then'](function(){return _0x39eee9;});}else{return _0x39eee9;}})[_0x32d9('0x46')](function(_0x284127){logger['error'](_0x32d9('0x53'),_0x284127);throw _0x284127;});}return _0x39eee9;})[_0x32d9('0x28')](respondWithResult(_0x4f0df5,0xc9))[_0x32d9('0x46')](handleError(_0x4f0df5,null));};exports[_0x32d9('0x54')]=function(_0x1900da,_0xc3b38d){var _0x5a88a2={'where':{'id':_0x1900da[_0x32d9('0x48')]['id']}},_0x25d06b={};_0x25d06b[_0x32d9('0x37')]=_[_0x32d9('0x34')](db[_0x32d9('0x2f')]['rawAttributes']);_0x5a88a2[_0x32d9('0x38')]=_[_0x32d9('0x36')](_0x25d06b[_0x32d9('0x37')],qs[_0x32d9('0x39')](_0x1900da[_0x32d9('0x33')][_0x32d9('0x39')]));_0x5a88a2[_0x32d9('0x38')]=_0x5a88a2['attributes'][_0x32d9('0x3a')]?_0x5a88a2[_0x32d9('0x38')]:_0x25d06b[_0x32d9('0x37')];if(_0x1900da[_0x32d9('0x33')]['includeAll']){_0x5a88a2['include']=[{'all':!![]}];}_0x5a88a2=_[_0x32d9('0x40')]({},_0x5a88a2,_0x1900da[_0x32d9('0x42')]);return db[_0x32d9('0x2f')][_0x32d9('0x4b')](_0x5a88a2)['then'](handleEntityNotFound(_0xc3b38d,null))[_0x32d9('0x28')](function(_0x26e5bb){if(_0x26e5bb){var _0x5930dd=_0x26e5bb[_0x32d9('0x29')]({'plain':!![]});_0x5930dd=qs['omit'](_0x5930dd,['id','createdAt',_0x32d9('0x55')]);_0x1900da[_0x32d9('0x4d')]=_[_0x32d9('0x56')](_0x1900da[_0x32d9('0x4d')],['id','createdAt',_0x32d9('0x55')]);return db[_0x32d9('0x2f')]['create'](_['merge'](_0x5930dd,_0x1900da[_0x32d9('0x4d')]),{'include':_0x1900da[_0x32d9('0x33')][_0x32d9('0x43')]?[{'all':!![]}]:undefined})['then'](function(_0x29f194){var _0x144d16=_0x1900da[_0x32d9('0x4e')][_0x32d9('0x29')]({'plain':!![]});if(!_0x144d16)throw new Error(_0x32d9('0x4f'));if(_0x144d16[_0x32d9('0x57')]==='user'){var _0x371922=_0x29f194[_0x32d9('0x29')]({'plain':!![]});var _0x5127d8='Projects';return db[_0x32d9('0x50')][_0x32d9('0x4b')]({'where':{'name':_0x5127d8,'userProfileId':_0x144d16[_0x32d9('0x51')]},'raw':!![]})[_0x32d9('0x28')](function(_0x2f3f19){if(_0x2f3f19&&_0x2f3f19[_0x32d9('0x52')]===0x0){return db['UserProfileResource'][_0x32d9('0x4c')]({'name':_0x371922[_0x32d9('0x2c')],'resourceId':_0x371922['id'],'type':_0x2f3f19[_0x32d9('0x2c')],'sectionId':_0x2f3f19['id']},{})[_0x32d9('0x28')](function(){return _0x29f194;});}else{return _0x29f194;}})['catch'](function(_0x38a176){logger[_0x32d9('0x58')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x38a176);throw _0x38a176;});}return _0x29f194;});}})['then'](respondWithResult(_0xc3b38d,0xc9))[_0x32d9('0x46')](handleError(_0xc3b38d,null));};exports[_0x32d9('0x59')]=function(_0x2e0601,_0x17f450){if(_0x2e0601['body']['id']){delete _0x2e0601['body']['id'];}return db[_0x32d9('0x2f')][_0x32d9('0x4b')]({'where':{'id':_0x2e0601[_0x32d9('0x48')]['id']}})[_0x32d9('0x28')](handleEntityNotFound(_0x17f450,null))[_0x32d9('0x28')](saveUpdates(_0x2e0601[_0x32d9('0x4d')],null))[_0x32d9('0x28')](respondWithResult(_0x17f450,null))['catch'](handleError(_0x17f450,null));};exports[_0x32d9('0x2b')]=function(_0x4a2dfe,_0x1aab0d){return db[_0x32d9('0x2f')][_0x32d9('0x4b')]({'where':{'id':_0x4a2dfe['params']['id']}})['then'](handleEntityNotFound(_0x1aab0d,null))[_0x32d9('0x28')](removeEntity(_0x1aab0d,null))[_0x32d9('0x46')](handleError(_0x1aab0d,null));};exports['getSessions']=function(_0x12fbc3,_0x5331c7,_0x17e95e){var _0x4d854d={'raw':!![],'where':{}};var _0x12bd39={};var _0x50f93f={'count':0x0,'rows':[]};return db[_0x32d9('0x2f')]['findOne']({'where':{'id':_0x12fbc3[_0x32d9('0x48')]['id']}})[_0x32d9('0x28')](handleEntityNotFound(_0x5331c7,null))['then'](function(_0x510ffc){if(_0x510ffc){_0x12bd39[_0x32d9('0x37')]=_[_0x32d9('0x34')](db[_0x32d9('0x5a')][_0x32d9('0x49')]);_0x12bd39[_0x32d9('0x33')]=_[_0x32d9('0x34')](_0x12fbc3[_0x32d9('0x33')]);_0x12bd39[_0x32d9('0x35')]=_[_0x32d9('0x36')](_0x12bd39['model'],_0x12bd39['query']);_0x4d854d[_0x32d9('0x38')]=_[_0x32d9('0x36')](_0x12bd39[_0x32d9('0x37')],qs[_0x32d9('0x39')](_0x12fbc3[_0x32d9('0x33')][_0x32d9('0x39')]));_0x4d854d[_0x32d9('0x38')]=_0x4d854d['attributes'][_0x32d9('0x3a')]?_0x4d854d[_0x32d9('0x38')]:_0x12bd39[_0x32d9('0x37')];if(!_0x12fbc3[_0x32d9('0x33')][_0x32d9('0x3b')](_0x32d9('0x5b'))){_0x4d854d[_0x32d9('0x22')]=qs[_0x32d9('0x22')](_0x12fbc3['query'][_0x32d9('0x22')]);_0x4d854d['offset']=qs['offset'](_0x12fbc3[_0x32d9('0x33')]['offset']);}_0x4d854d[_0x32d9('0x3c')]=qs[_0x32d9('0x3d')](_0x12fbc3[_0x32d9('0x33')][_0x32d9('0x3d')]);_0x4d854d[_0x32d9('0x3e')]=qs[_0x32d9('0x35')](_[_0x32d9('0x5c')](_0x12fbc3[_0x32d9('0x33')],_0x12bd39['filters']));_0x4d854d[_0x32d9('0x3e')]['ProjectId']=_0x510ffc['id'];if(_0x12fbc3[_0x32d9('0x33')][_0x32d9('0x3f')]){_0x4d854d['where']=_['merge'](_0x4d854d['where'],{'$or':_[_0x32d9('0x2e')](_0x4d854d['attributes'],function(_0x41bc2b){var _0x554a36={};_0x554a36[_0x41bc2b]={'$like':'%'+_0x12fbc3[_0x32d9('0x33')]['filter']+'%'};return _0x554a36;})});}_0x4d854d=_['merge']({},_0x4d854d,_0x12fbc3['options']);return db[_0x32d9('0x5a')][_0x32d9('0x24')]({'where':_0x4d854d['where']})[_0x32d9('0x28')](function(_0xd3fd19){_0x50f93f['count']=_0xd3fd19;if(_0x12fbc3[_0x32d9('0x33')][_0x32d9('0x43')]){_0x4d854d[_0x32d9('0x4a')]=[{'all':!![]}];}return db[_0x32d9('0x5a')]['findAll'](_0x4d854d);})[_0x32d9('0x28')](function(_0x874bb0){_0x50f93f[_0x32d9('0x45')]=_0x874bb0;return _0x50f93f;});}})[_0x32d9('0x28')](respondWithFilteredResult(_0x5331c7,_0x4d854d))[_0x32d9('0x46')](handleError(_0x5331c7,null));};exports[_0x32d9('0x5d')]=function(_0x13aff0,_0x157cbf,_0x4d916e){var _0x72cdce={'raw':!![],'where':{}};var _0x4bdb42={};var _0x5d6ddf={'count':0x0,'rows':[]};return db['JscriptyProject']['findOne']({'where':{'id':_0x13aff0[_0x32d9('0x48')]['id']}})['then'](handleEntityNotFound(_0x157cbf,null))[_0x32d9('0x28')](function(_0x12b96a){if(_0x12b96a){_0x4bdb42[_0x32d9('0x37')]=_[_0x32d9('0x34')](db[_0x32d9('0x5e')][_0x32d9('0x49')]);_0x4bdb42[_0x32d9('0x33')]=_[_0x32d9('0x34')](_0x13aff0['query']);_0x4bdb42[_0x32d9('0x35')]=_['intersection'](_0x4bdb42[_0x32d9('0x37')],_0x4bdb42[_0x32d9('0x33')]);_0x72cdce[_0x32d9('0x38')]=_[_0x32d9('0x36')](_0x4bdb42[_0x32d9('0x37')],qs['fields'](_0x13aff0[_0x32d9('0x33')][_0x32d9('0x39')]));_0x72cdce[_0x32d9('0x38')]=_0x72cdce[_0x32d9('0x38')][_0x32d9('0x3a')]?_0x72cdce[_0x32d9('0x38')]:_0x4bdb42[_0x32d9('0x37')];if(!_0x13aff0['query'][_0x32d9('0x3b')](_0x32d9('0x5b'))){_0x72cdce[_0x32d9('0x22')]=qs[_0x32d9('0x22')](_0x13aff0[_0x32d9('0x33')][_0x32d9('0x22')]);_0x72cdce[_0x32d9('0x21')]=qs[_0x32d9('0x21')](_0x13aff0[_0x32d9('0x33')][_0x32d9('0x21')]);}_0x72cdce[_0x32d9('0x3c')]=qs[_0x32d9('0x3d')](_0x13aff0[_0x32d9('0x33')][_0x32d9('0x3d')]);_0x72cdce[_0x32d9('0x3e')]=qs[_0x32d9('0x35')](_[_0x32d9('0x5c')](_0x13aff0['query'],_0x4bdb42[_0x32d9('0x35')]));_0x72cdce[_0x32d9('0x3e')][_0x32d9('0x5f')]=_0x12b96a['id'];if(_0x13aff0[_0x32d9('0x33')][_0x32d9('0x3f')]){_0x72cdce[_0x32d9('0x3e')]=_[_0x32d9('0x40')](_0x72cdce['where'],{'$or':_[_0x32d9('0x2e')](_0x72cdce['attributes'],function(_0x28dffd){var _0x78fcbf={};_0x78fcbf[_0x28dffd]={'$like':'%'+_0x13aff0[_0x32d9('0x33')]['filter']+'%'};return _0x78fcbf;})});}_0x72cdce=_[_0x32d9('0x40')]({},_0x72cdce,_0x13aff0[_0x32d9('0x42')]);return db['JscriptyAnswerReport'][_0x32d9('0x24')]({'where':_0x72cdce[_0x32d9('0x3e')]})[_0x32d9('0x28')](function(_0x38ac3e){_0x5d6ddf[_0x32d9('0x24')]=_0x38ac3e;if(_0x13aff0[_0x32d9('0x33')][_0x32d9('0x43')]){_0x72cdce[_0x32d9('0x4a')]=[{'all':!![]}];}return db[_0x32d9('0x5e')][_0x32d9('0x44')](_0x72cdce);})[_0x32d9('0x28')](function(_0x44ef70){_0x5d6ddf[_0x32d9('0x45')]=_0x44ef70;return _0x5d6ddf;});}})[_0x32d9('0x28')](respondWithFilteredResult(_0x157cbf,_0x72cdce))[_0x32d9('0x46')](handleError(_0x157cbf,null));};function char(_0x529c1a){return _0x32d9('0x60')===typeof _0x529c1a?String[_0x32d9('0x61')][_0x32d9('0x27')](null,arguments):_0x529c1a;}function needsEncapsulation(_0x3c4d00){return!!_0x3c4d00&&(_0x3c4d00['toString']()[_0x32d9('0x62')](char(0xd))>=0x0||_0x3c4d00[_0x32d9('0x63')]()[_0x32d9('0x62')](char(0xa))>=0x0||_0x3c4d00[_0x32d9('0x63')]()[_0x32d9('0x62')](char(0x2c))>=0x0||_0x3c4d00[_0x32d9('0x63')]()['indexOf'](char(0x22))>=0x0);}function encapsulate(_0x11dbab){var _0x15ef59=char(0x22),_0x5bdb90='\x5c'+char(0x22),_0x4df99d=_0x11dbab[_0x32d9('0x63')]()[_0x32d9('0x64')](new RegExp(_0x15ef59,'g'),_0x5bdb90);return _0x15ef59+_0x4df99d+_0x15ef59;}exports[_0x32d9('0x65')]=function(_0x4c9fc1,_0x2cc671,_0xc40116){var _0xaaf11b,_0x3d38e1;var _0x1e2483={'where':{'ProjectId':_0x4c9fc1[_0x32d9('0x48')]['id']}};if(_0x4c9fc1[_0x32d9('0x33')]['startTime']){_0x1e2483[_0x32d9('0x3e')]['starttime']=JSON['parse'](_0x4c9fc1[_0x32d9('0x33')][_0x32d9('0x66')]);}return db['JscriptySessionReport']['findAll'](_0x1e2483)[_0x32d9('0x28')](handleEntityNotFound(_0x2cc671,null))[_0x32d9('0x28')](function(_0x77a931){if(_0x77a931){_0xaaf11b=_0x77a931;return db['JscriptyQuestionReport'][_0x32d9('0x44')]({'where':{'SessionId':{'$in':_[_0x32d9('0x2e')](_0xaaf11b,'id')},'ProjectId':_0x4c9fc1[_0x32d9('0x48')]['id']},'order':_0x32d9('0x67')});}})[_0x32d9('0x28')](handleEntityNotFound(_0x2cc671,null))[_0x32d9('0x28')](function(_0x4bb137){if(_0x4bb137){_0x3d38e1=_0x4bb137;var _0xaa266f={};for(var _0x443a16=0x0,_0x1fa63b=_0x3d38e1['length'];_0x443a16<_0x1fa63b;_0x443a16++){if(!_0xaa266f[_0x32d9('0x3b')](_0x3d38e1[_0x443a16][_0x32d9('0x68')])){_0xaa266f[_0x3d38e1[_0x443a16]['questionId']]=needsEncapsulation(_0x3d38e1[_0x443a16]['question'])?encapsulate(_0x3d38e1[_0x443a16][_0x32d9('0x69')]):_0x3d38e1[_0x443a16][_0x32d9('0x69')];}}var _0x2940bf=[],_0x2a1de0={};for(var _0x3e9f50=0x0,_0x461071=_0xaaf11b[_0x32d9('0x3a')];_0x3e9f50<_0x461071;_0x3e9f50++){_0x2a1de0={'ProjectId':_0x4c9fc1[_0x32d9('0x48')]['id'],'SessionId':_0xaaf11b[_0x3e9f50]['id'],'StartTime':moment(_0xaaf11b[_0x3e9f50][_0x32d9('0x6a')])[_0x32d9('0x6b')](_0x32d9('0x6c'))};for(var _0x1f5b62=0x0,_0x19720a=_0x3d38e1[_0x32d9('0x3a')];_0x1f5b62<_0x19720a;_0x1f5b62++){if(_0x3d38e1[_0x1f5b62][_0x32d9('0x6d')]==_0xaaf11b[_0x3e9f50]['id']&&_0xaa266f[_0x32d9('0x3b')](_0x3d38e1[_0x1f5b62][_0x32d9('0x68')])){_0x2a1de0[_0xaa266f[_0x3d38e1[_0x1f5b62][_0x32d9('0x68')]]]=_0x3d38e1[_0x1f5b62][_0x32d9('0x6e')];}}for(var _0x3add4b in _0xaa266f){if(!_0x2a1de0[_0x32d9('0x3b')](_0xaa266f[_0x3add4b])){_0x2a1de0[_0xaa266f[_0x3add4b]]=null;}}_0x2940bf[_0x32d9('0x6f')](_0x2a1de0);}return _0x2940bf;}})['then'](function(_0x460e82){if(!_[_0x32d9('0x70')](_0x460e82)){var _0x560e62=toCsv(_0x460e82);var _0x29dc11=Date[_0x32d9('0x71')]();fs['writeFileSync'](util['format'](_0x32d9('0x72'),_0x4c9fc1[_0x32d9('0x48')]['id'],_0x29dc11),_0x560e62);_0x2cc671[_0x32d9('0x73')](_0x32d9('0x74'),'attachment;\x20filename='+util['format']('Jscripty_Project_%d_Summary_%s.csv',_0x4c9fc1[_0x32d9('0x48')]['id'],_0x29dc11));_0x2cc671[_0x32d9('0x73')]('Content-type',_0x32d9('0x75'));return _0x2cc671[_0x32d9('0x76')](util[_0x32d9('0x6b')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x4c9fc1[_0x32d9('0x48')]['id'],_0x29dc11));}else{return _0x2cc671['sendStatus'](0xcc);}})[_0x32d9('0x46')](handleError(_0x2cc671,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index bae15da..6c5093e 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 _0xfd20=['bluebird','path','../../config/environment','./jscriptyProject.attributes','exports','jscripty_projects','util','moment'];(function(_0x1a333d,_0x483830){var _0x147e89=function(_0x23fa35){while(--_0x23fa35){_0x1a333d['push'](_0x1a333d['shift']());}};_0x147e89(++_0x483830);}(_0xfd20,0x66));var _0x0fd2=function(_0x10e627,_0x26b1a7){_0x10e627=_0x10e627-0x0;var _0x12153a=_0xfd20[_0x10e627];return _0x12153a;};'use strict';var _=require('lodash');var util=require(_0x0fd2('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x0fd2('0x1'));var BPromise=require(_0x0fd2('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0fd2('0x3'));var rimraf=require('rimraf');var config=require(_0x0fd2('0x4'));var attributes=require(_0x0fd2('0x5'));module[_0x0fd2('0x6')]=function(_0xf25991,_0x247d6e){return _0xf25991['define']('JscriptyProject',attributes,{'tableName':_0x0fd2('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xde64=['bluebird','path','rimraf','exports','JscriptyProject','jscripty_projects','lodash','util','../../config/logger','api','moment'];(function(_0x5b4c4e,_0x1abfb8){var _0x4fcdf6=function(_0x2b0636){while(--_0x2b0636){_0x5b4c4e['push'](_0x5b4c4e['shift']());}};_0x4fcdf6(++_0x1abfb8);}(_0xde64,0x17c));var _0x4de6=function(_0x3261b1,_0x20a005){_0x3261b1=_0x3261b1-0x0;var _0x1a9d75=_0xde64[_0x3261b1];return _0x1a9d75;};'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('./jscriptyProject.attributes');module[_0x4de6('0x8')]=function(_0x45867b,_0x4da17f){return _0x45867b['define'](_0x4de6('0x9'),attributes,{'tableName':_0x4de6('0xa'),'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 741e783..8c7b5df 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 _0x9bde=['code','message','JscriptyProject,\x20%s,\x20%s','result','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','request\x20sent','error'];(function(_0xdc8801,_0x3a3be4){var _0x56009d=function(_0x3287e6){while(--_0x3287e6){_0xdc8801['push'](_0xdc8801['shift']());}};_0x56009d(++_0x3a3be4);}(_0x9bde,0xe1));var _0xe9bd=function(_0x1f1a76,_0x550022){_0x1f1a76=_0x1f1a76-0x0;var _0x397a61=_0x9bde[_0x1f1a76];return _0x397a61;};'use strict';var _=require('lodash');var util=require(_0xe9bd('0x0'));var moment=require('moment');var BPromise=require(_0xe9bd('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe9bd('0x2'));var db=require(_0xe9bd('0x3'))['db'];var utils=require(_0xe9bd('0x4'));var logger=require(_0xe9bd('0x5'))(_0xe9bd('0x6'));var config=require(_0xe9bd('0x7'));var jayson=require(_0xe9bd('0x8'));var client=jayson['client'][_0xe9bd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5f18fe,_0x22a438,_0xa66ae2){return new BPromise(function(_0x2d5c75,_0x3ef9e3){return client[_0xe9bd('0xa')](_0x5f18fe,_0xa66ae2)[_0xe9bd('0xb')](function(_0x439abc){logger[_0xe9bd('0xc')]('JscriptyProject,\x20%s,\x20%s',_0x22a438,'request\x20sent');logger[_0xe9bd('0xd')](_0xe9bd('0xe'),_0x22a438,_0xe9bd('0xf'),JSON['stringify'](_0x439abc));if(_0x439abc[_0xe9bd('0x10')]){if(_0x439abc[_0xe9bd('0x10')][_0xe9bd('0x11')]===0x1f4){logger[_0xe9bd('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x22a438,_0x439abc[_0xe9bd('0x10')]['message']);return _0x3ef9e3(_0x439abc[_0xe9bd('0x10')][_0xe9bd('0x12')]);}logger[_0xe9bd('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x22a438,_0x439abc['error'][_0xe9bd('0x12')]);return _0x2d5c75(_0x439abc[_0xe9bd('0x10')][_0xe9bd('0x12')]);}else{logger[_0xe9bd('0xc')](_0xe9bd('0x13'),_0x22a438,_0xe9bd('0xf'));_0x2d5c75(_0x439abc[_0xe9bd('0x14')]['message']);}})[_0xe9bd('0x15')](function(_0x464a1b){logger[_0xe9bd('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x22a438,_0x464a1b);_0x3ef9e3(_0x464a1b);});});} \ No newline at end of file +var _0xcb91=['stringify','error','code','message','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s'];(function(_0x5a957f,_0x4ab101){var _0x5986d3=function(_0x298bc7){while(--_0x298bc7){_0x5a957f['push'](_0x5a957f['shift']());}};_0x5986d3(++_0x4ab101);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x2e58c7,_0x23d092){_0x2e58c7=_0x2e58c7-0x0;var _0x26eb00=_0xcb91[_0x2e58c7];return _0x26eb00;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1cb9('0x0'));var BPromise=require(_0x1cb9('0x1'));var rs=require(_0x1cb9('0x2'));var fs=require('fs');var Redis=require(_0x1cb9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1cb9('0x4'));var logger=require(_0x1cb9('0x5'))('rpc');var config=require(_0x1cb9('0x6'));var jayson=require(_0x1cb9('0x7'));var client=jayson['client'][_0x1cb9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3f7deb,_0x4ffe20,_0x38737d){return new BPromise(function(_0x12567c,_0x59d1be){return client[_0x1cb9('0x9')](_0x3f7deb,_0x38737d)['then'](function(_0x567139){logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,_0x1cb9('0xc'));logger[_0x1cb9('0xd')](_0x1cb9('0xe'),_0x4ffe20,'request\x20sent',JSON[_0x1cb9('0xf')](_0x567139));if(_0x567139[_0x1cb9('0x10')]){if(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x11')]===0x1f4){logger[_0x1cb9('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x4ffe20,_0x567139['error']['message']);return _0x59d1be(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x567139['error'][_0x1cb9('0x12')]);return _0x12567c(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}else{logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,'request\x20sent');_0x12567c(_0x567139['result'][_0x1cb9('0x12')]);}})[_0x1cb9('0x13')](function(_0x3904b7){logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x3904b7);_0x59d1be(_0x3904b7);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index b08bf6a..9c2d110 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 _0x6b9e=['put','update','delete','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptyQuestionReport.controller','get','index','/describe','describe','/:id','isAuthenticated','show','post','create'];(function(_0x54b8ac,_0xb1c00c){var _0x123211=function(_0x209f1d){while(--_0x209f1d){_0x54b8ac['push'](_0x54b8ac['shift']());}};_0x123211(++_0xb1c00c);}(_0x6b9e,0x190));var _0xe6b9=function(_0x559355,_0x7e03c7){_0x559355=_0x559355-0x0;var _0x5d3fdc=_0x6b9e[_0x559355];return _0x5d3fdc;};'use strict';var multer=require(_0xe6b9('0x0'));var util=require(_0xe6b9('0x1'));var path=require('path');var timeout=require(_0xe6b9('0x2'));var express=require(_0xe6b9('0x3'));var router=express[_0xe6b9('0x4')]();var fs_extra=require(_0xe6b9('0x5'));var auth=require(_0xe6b9('0x6'));var interaction=require(_0xe6b9('0x7'));var config=require('../../config/environment');var controller=require(_0xe6b9('0x8'));router[_0xe6b9('0x9')]('/',auth['isAuthenticated'](),controller[_0xe6b9('0xa')]);router[_0xe6b9('0x9')](_0xe6b9('0xb'),auth['isAuthenticated'](),controller[_0xe6b9('0xc')]);router[_0xe6b9('0x9')](_0xe6b9('0xd'),auth[_0xe6b9('0xe')](),controller[_0xe6b9('0xf')]);router[_0xe6b9('0x10')]('/',auth['isAuthenticated'](),controller[_0xe6b9('0x11')]);router[_0xe6b9('0x12')](_0xe6b9('0xd'),auth['isAuthenticated'](),controller[_0xe6b9('0x13')]);router[_0xe6b9('0x14')](_0xe6b9('0xd'),auth['isAuthenticated'](),controller[_0xe6b9('0x15')]);module['exports']=router; \ No newline at end of file +var _0xf37c=['path','express','Router','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','isAuthenticated','index','/describe','describe','get','show','post','create','/:id','update','delete','destroy','exports','util'];(function(_0xbdb6,_0x3c6047){var _0x422e4a=function(_0x3048c9){while(--_0x3048c9){_0xbdb6['push'](_0xbdb6['shift']());}};_0x422e4a(++_0x3c6047);}(_0xf37c,0x103));var _0xcf37=function(_0x5d7005,_0x41f35a){_0x5d7005=_0x5d7005-0x0;var _0x31ed20=_0xf37c[_0x5d7005];return _0x31ed20;};'use strict';var multer=require('multer');var util=require(_0xcf37('0x0'));var path=require(_0xcf37('0x1'));var timeout=require('connect-timeout');var express=require(_0xcf37('0x2'));var router=express[_0xcf37('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xcf37('0x4'));var config=require(_0xcf37('0x5'));var controller=require(_0xcf37('0x6'));router['get']('/',auth[_0xcf37('0x7')](),controller[_0xcf37('0x8')]);router['get'](_0xcf37('0x9'),auth[_0xcf37('0x7')](),controller[_0xcf37('0xa')]);router[_0xcf37('0xb')]('/:id',auth[_0xcf37('0x7')](),controller[_0xcf37('0xc')]);router[_0xcf37('0xd')]('/',auth[_0xcf37('0x7')](),controller[_0xcf37('0xe')]);router['put'](_0xcf37('0xf'),auth[_0xcf37('0x7')](),controller[_0xcf37('0x10')]);router[_0xcf37('0x11')](_0xcf37('0xf'),auth['isAuthenticated'](),controller[_0xcf37('0x12')]);module[_0xcf37('0x13')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index 961f1e3..1463ead 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(_0x346737,_0x3e6081){var _0x1ade2e=function(_0x15e50e){while(--_0x15e50e){_0x346737['push'](_0x346737['shift']());}};_0x1ade2e(++_0x3e6081);}(_0x7a54,0x106));var _0x47a5=function(_0x13c922,_0x2bb352){_0x13c922=_0x13c922-0x0;var _0x5200a3=_0x7a54[_0x13c922];return _0x5200a3;};'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(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x7a54,0x106));var _0x47a5=function(_0x221086,_0x1742ce){_0x221086=_0x221086-0x0;var _0x8dc2e3=_0x7a54[_0x221086];return _0x8dc2e3;};'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 d02d732..8164ec0 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 _0xef50=['apply','reject','save','update','then','error','stack','name','map','JscriptyQuestionReport','rawAttributes','type','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','VIRTUAL','merge','options','includeAll','include','rows','catch','show','params','length','find','create','body','destroy','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','to-csv','ejs','lodash','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count'];(function(_0x52df16,_0x11b2a7){var _0x5eeb6a=function(_0x1c77f2){while(--_0x1c77f2){_0x52df16['push'](_0x52df16['shift']());}};_0x5eeb6a(++_0x11b2a7);}(_0xef50,0x6f));var _0x0ef5=function(_0x5b2434,_0x3d9c71){_0x5b2434=_0x5b2434-0x0;var _0x28bd00=_0xef50[_0x5b2434];return _0x28bd00;};'use strict';var emlformat=require(_0x0ef5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0ef5('0x1'));var jsonpatch=require(_0x0ef5('0x2'));var rp=require(_0x0ef5('0x3'));var moment=require(_0x0ef5('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x0ef5('0x5'));var ejs=require(_0x0ef5('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0ef5('0x7'));var squel=require(_0x0ef5('0x8'));var crypto=require(_0x0ef5('0x9'));var jsforce=require(_0x0ef5('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x0ef5('0xb'));var authService=require(_0x0ef5('0xc'));var qs=require(_0x0ef5('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x0ef5('0xe'))(_0x0ef5('0xf'));var utils=require(_0x0ef5('0x10'));var config=require(_0x0ef5('0x11'));var licenseUtil=require(_0x0ef5('0x12'));var db=require(_0x0ef5('0x13'))['db'];function respondWithStatusCode(_0x5c8fef,_0x4003de){_0x4003de=_0x4003de||0xcc;return function(_0x5309ca){if(_0x5309ca){return _0x5c8fef['sendStatus'](_0x4003de);}return _0x5c8fef[_0x0ef5('0x14')](_0x4003de)[_0x0ef5('0x15')]();};}function respondWithResult(_0x5225ae,_0xf3a107){_0xf3a107=_0xf3a107||0xc8;return function(_0x1e46b9){if(_0x1e46b9){return _0x5225ae['status'](_0xf3a107)[_0x0ef5('0x16')](_0x1e46b9);}};}function respondWithFilteredResult(_0x422f2b,_0x14d8cd){return function(_0x4f404f){if(_0x4f404f){var _0x183cc0=typeof _0x14d8cd[_0x0ef5('0x17')]===_0x0ef5('0x18')&&typeof _0x14d8cd[_0x0ef5('0x19')]===_0x0ef5('0x18');var _0x28e356=_0x4f404f[_0x0ef5('0x1a')];var _0x48ad2f=_0x183cc0?0x0:_0x14d8cd[_0x0ef5('0x17')];var _0x319825=_0x183cc0?_0x4f404f['count']:_0x14d8cd['offset']+_0x14d8cd[_0x0ef5('0x19')];var _0x478ecd;if(_0x319825>=_0x28e356){_0x319825=_0x28e356;_0x478ecd=0xc8;}else{_0x478ecd=0xce;}_0x422f2b['status'](_0x478ecd);return _0x422f2b['set']('Content-Range',_0x48ad2f+'-'+_0x319825+'/'+_0x28e356)[_0x0ef5('0x16')](_0x4f404f);}return null;};}function patchUpdates(_0x3959c8){return function(_0x1495f7){try{jsonpatch[_0x0ef5('0x1b')](_0x1495f7,_0x3959c8,!![]);}catch(_0x15f957){return BPromise[_0x0ef5('0x1c')](_0x15f957);}return _0x1495f7[_0x0ef5('0x1d')]();};}function saveUpdates(_0xf130e8,_0x45f678){return function(_0x1084df){if(_0x1084df){return _0x1084df[_0x0ef5('0x1e')](_0xf130e8)[_0x0ef5('0x1f')](function(_0x5b7026){return _0x5b7026;});}return null;};}function removeEntity(_0x2f50e0,_0x2cf461){return function(_0x50a9aa){if(_0x50a9aa){return _0x50a9aa['destroy']()[_0x0ef5('0x1f')](function(){_0x2f50e0['status'](0xcc)[_0x0ef5('0x15')]();});}};}function handleEntityNotFound(_0x5b017c,_0x490b48){return function(_0x57117c){if(!_0x57117c){_0x5b017c['sendStatus'](0x194);}return _0x57117c;};}function handleError(_0x3c165b,_0x4714de){_0x4714de=_0x4714de||0x1f4;return function(_0xeccdff){logger[_0x0ef5('0x20')](_0xeccdff[_0x0ef5('0x21')]);if(_0xeccdff[_0x0ef5('0x22')]){delete _0xeccdff[_0x0ef5('0x22')];}_0x3c165b[_0x0ef5('0x14')](_0x4714de)['send'](_0xeccdff);};}exports['index']=function(_0x31cf7d,_0x4cf914){var _0x595b3d={},_0x2ed3b8={},_0xbdc507={'count':0x0,'rows':[]};var _0x136ab5=_[_0x0ef5('0x23')](db[_0x0ef5('0x24')][_0x0ef5('0x25')],function(_0xf74a42){return{'name':_0xf74a42['fieldName'],'type':_0xf74a42[_0x0ef5('0x26')][_0x0ef5('0x27')]};});_0x2ed3b8[_0x0ef5('0x28')]=_[_0x0ef5('0x23')](_0x136ab5,'name');_0x2ed3b8[_0x0ef5('0x29')]=_[_0x0ef5('0x2a')](_0x31cf7d['query']);_0x2ed3b8['filters']=_[_0x0ef5('0x2b')](_0x2ed3b8[_0x0ef5('0x28')],_0x2ed3b8['query']);_0x595b3d['attributes']=_[_0x0ef5('0x2b')](_0x2ed3b8[_0x0ef5('0x28')],qs[_0x0ef5('0x2c')](_0x31cf7d[_0x0ef5('0x29')][_0x0ef5('0x2c')]));_0x595b3d[_0x0ef5('0x2d')]=_0x595b3d[_0x0ef5('0x2d')]['length']?_0x595b3d[_0x0ef5('0x2d')]:_0x2ed3b8['model'];if(!_0x31cf7d[_0x0ef5('0x29')][_0x0ef5('0x2e')](_0x0ef5('0x2f'))){_0x595b3d[_0x0ef5('0x19')]=qs[_0x0ef5('0x19')](_0x31cf7d[_0x0ef5('0x29')][_0x0ef5('0x19')]);_0x595b3d['offset']=qs[_0x0ef5('0x17')](_0x31cf7d[_0x0ef5('0x29')][_0x0ef5('0x17')]);}_0x595b3d[_0x0ef5('0x30')]=qs[_0x0ef5('0x31')](_0x31cf7d[_0x0ef5('0x29')][_0x0ef5('0x31')]);_0x595b3d[_0x0ef5('0x32')]=qs['filters'](_[_0x0ef5('0x33')](_0x31cf7d[_0x0ef5('0x29')],_0x2ed3b8[_0x0ef5('0x34')]),_0x136ab5);if(_0x31cf7d[_0x0ef5('0x29')][_0x0ef5('0x35')]){_0x595b3d[_0x0ef5('0x32')]=_['merge'](_0x595b3d[_0x0ef5('0x32')],{'$or':_[_0x0ef5('0x23')](_0x136ab5,function(_0xf60355){if(_0xf60355['type']!==_0x0ef5('0x36')){var _0x4278b9={};_0x4278b9[_0xf60355[_0x0ef5('0x22')]]={'$like':'%'+_0x31cf7d[_0x0ef5('0x29')]['filter']+'%'};return _0x4278b9;}})});}_0x595b3d=_[_0x0ef5('0x37')]({},_0x595b3d,_0x31cf7d[_0x0ef5('0x38')]);var _0x4e797e={'where':_0x595b3d['where']};return db['JscriptyQuestionReport'][_0x0ef5('0x1a')](_0x4e797e)[_0x0ef5('0x1f')](function(_0xd1e493){_0xbdc507[_0x0ef5('0x1a')]=_0xd1e493;if(_0x31cf7d[_0x0ef5('0x29')][_0x0ef5('0x39')]){_0x595b3d[_0x0ef5('0x3a')]=[{'all':!![]}];}return db[_0x0ef5('0x24')]['findAll'](_0x595b3d);})['then'](function(_0x1337ca){_0xbdc507[_0x0ef5('0x3b')]=_0x1337ca;return _0xbdc507;})[_0x0ef5('0x1f')](respondWithFilteredResult(_0x4cf914,_0x595b3d))[_0x0ef5('0x3c')](handleError(_0x4cf914,null));};exports[_0x0ef5('0x3d')]=function(_0x52432d,_0x4cd8d6){var _0x3e3d24={'raw':!![],'where':{'id':_0x52432d[_0x0ef5('0x3e')]['id']}},_0x1cfaf9={};_0x1cfaf9[_0x0ef5('0x28')]=_[_0x0ef5('0x2a')](db[_0x0ef5('0x24')]['rawAttributes']);_0x1cfaf9['query']=_[_0x0ef5('0x2a')](_0x52432d[_0x0ef5('0x29')]);_0x1cfaf9[_0x0ef5('0x34')]=_[_0x0ef5('0x2b')](_0x1cfaf9[_0x0ef5('0x28')],_0x1cfaf9[_0x0ef5('0x29')]);_0x3e3d24[_0x0ef5('0x2d')]=_['intersection'](_0x1cfaf9[_0x0ef5('0x28')],qs[_0x0ef5('0x2c')](_0x52432d[_0x0ef5('0x29')][_0x0ef5('0x2c')]));_0x3e3d24['attributes']=_0x3e3d24[_0x0ef5('0x2d')][_0x0ef5('0x3f')]?_0x3e3d24[_0x0ef5('0x2d')]:_0x1cfaf9['model'];if(_0x52432d[_0x0ef5('0x29')][_0x0ef5('0x39')]){_0x3e3d24['include']=[{'all':!![]}];}_0x3e3d24=_[_0x0ef5('0x37')]({},_0x3e3d24,_0x52432d['options']);return db[_0x0ef5('0x24')][_0x0ef5('0x40')](_0x3e3d24)[_0x0ef5('0x1f')](handleEntityNotFound(_0x4cd8d6,null))['then'](respondWithResult(_0x4cd8d6,null))[_0x0ef5('0x3c')](handleError(_0x4cd8d6,null));};exports['create']=function(_0x2e6eb6,_0xbec55f){return db[_0x0ef5('0x24')][_0x0ef5('0x41')](_0x2e6eb6['body'],{})[_0x0ef5('0x1f')](respondWithResult(_0xbec55f,0xc9))[_0x0ef5('0x3c')](handleError(_0xbec55f,null));};exports['update']=function(_0x45c0f9,_0x15be45){if(_0x45c0f9[_0x0ef5('0x42')]['id']){delete _0x45c0f9[_0x0ef5('0x42')]['id'];}return db[_0x0ef5('0x24')]['find']({'where':{'id':_0x45c0f9['params']['id']}})[_0x0ef5('0x1f')](handleEntityNotFound(_0x15be45,null))[_0x0ef5('0x1f')](saveUpdates(_0x45c0f9[_0x0ef5('0x42')],null))['then'](respondWithResult(_0x15be45,null))[_0x0ef5('0x3c')](handleError(_0x15be45,null));};exports[_0x0ef5('0x43')]=function(_0x251e12,_0x53c92f){return db[_0x0ef5('0x24')][_0x0ef5('0x40')]({'where':{'id':_0x251e12[_0x0ef5('0x3e')]['id']}})[_0x0ef5('0x1f')](handleEntityNotFound(_0x53c92f,null))[_0x0ef5('0x1f')](removeEntity(_0x53c92f,null))[_0x0ef5('0x3c')](handleError(_0x53c92f,null));};exports[_0x0ef5('0x44')]=function(_0x7a6285,_0x193d93){return db['JscriptyQuestionReport'][_0x0ef5('0x44')]()[_0x0ef5('0x1f')](respondWithResult(_0x193d93,null))[_0x0ef5('0x3c')](handleError(_0x193d93,null));}; \ No newline at end of file +var _0xddc5=['send','index','map','JscriptyQuestionReport','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','order','sort','where','filter','VIRTUAL','merge','then','includeAll','include','findAll','rows','catch','show','params','rawAttributes','intersection','options','create','body','find','describe','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','fs-extra','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','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','destroy','error','stack','name'];(function(_0x525c7b,_0x488fcc){var _0x27b33e=function(_0x56d43b){while(--_0x56d43b){_0x525c7b['push'](_0x525c7b['shift']());}};_0x27b33e(++_0x488fcc);}(_0xddc5,0xb7));var _0x5ddc=function(_0x454579,_0x5a9480){_0x454579=_0x454579-0x0;var _0x134c25=_0xddc5[_0x454579];return _0x134c25;};'use strict';var emlformat=require(_0x5ddc('0x0'));var rimraf=require(_0x5ddc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5ddc('0x2'));var rp=require('request-promise');var moment=require(_0x5ddc('0x3'));var BPromise=require(_0x5ddc('0x4'));var Mustache=require(_0x5ddc('0x5'));var util=require(_0x5ddc('0x6'));var path=require('path');var sox=require(_0x5ddc('0x7'));var csv=require('to-csv');var ejs=require(_0x5ddc('0x8'));var fs=require('fs');var fs_extra=require(_0x5ddc('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x5ddc('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x5ddc('0xb'));var Redis=require(_0x5ddc('0xc'));var authService=require(_0x5ddc('0xd'));var qs=require(_0x5ddc('0xe'));var as=require(_0x5ddc('0xf'));var hardwareService=require(_0x5ddc('0x10'));var logger=require(_0x5ddc('0x11'))(_0x5ddc('0x12'));var utils=require(_0x5ddc('0x13'));var config=require(_0x5ddc('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x5ddc('0x15'))['db'];function respondWithStatusCode(_0x268489,_0x2efde8){_0x2efde8=_0x2efde8||0xcc;return function(_0x2d94f1){if(_0x2d94f1){return _0x268489[_0x5ddc('0x16')](_0x2efde8);}return _0x268489[_0x5ddc('0x17')](_0x2efde8)[_0x5ddc('0x18')]();};}function respondWithResult(_0xf2e85a,_0x1c3bcc){_0x1c3bcc=_0x1c3bcc||0xc8;return function(_0x5bbef9){if(_0x5bbef9){return _0xf2e85a['status'](_0x1c3bcc)[_0x5ddc('0x19')](_0x5bbef9);}};}function respondWithFilteredResult(_0x9eea45,_0x57d36d){return function(_0x28dea5){if(_0x28dea5){var _0x16cec0=typeof _0x57d36d[_0x5ddc('0x1a')]===_0x5ddc('0x1b')&&typeof _0x57d36d[_0x5ddc('0x1c')]==='undefined';var _0x2e880e=_0x28dea5[_0x5ddc('0x1d')];var _0x4da704=_0x16cec0?0x0:_0x57d36d[_0x5ddc('0x1a')];var _0x33861f=_0x16cec0?_0x28dea5['count']:_0x57d36d['offset']+_0x57d36d[_0x5ddc('0x1c')];var _0x13613e;if(_0x33861f>=_0x2e880e){_0x33861f=_0x2e880e;_0x13613e=0xc8;}else{_0x13613e=0xce;}_0x9eea45[_0x5ddc('0x17')](_0x13613e);return _0x9eea45[_0x5ddc('0x1e')](_0x5ddc('0x1f'),_0x4da704+'-'+_0x33861f+'/'+_0x2e880e)[_0x5ddc('0x19')](_0x28dea5);}return null;};}function patchUpdates(_0x18445f){return function(_0x46596f){try{jsonpatch[_0x5ddc('0x20')](_0x46596f,_0x18445f,!![]);}catch(_0x289e7e){return BPromise['reject'](_0x289e7e);}return _0x46596f[_0x5ddc('0x21')]();};}function saveUpdates(_0x417b38,_0x50ead8){return function(_0x259643){if(_0x259643){return _0x259643[_0x5ddc('0x22')](_0x417b38)['then'](function(_0x4e2dc9){return _0x4e2dc9;});}return null;};}function removeEntity(_0x218c1b,_0xf59d5f){return function(_0x4153bc){if(_0x4153bc){return _0x4153bc[_0x5ddc('0x23')]()['then'](function(){_0x218c1b[_0x5ddc('0x17')](0xcc)[_0x5ddc('0x18')]();});}};}function handleEntityNotFound(_0x5a9b56,_0xad05a0){return function(_0x5125c5){if(!_0x5125c5){_0x5a9b56['sendStatus'](0x194);}return _0x5125c5;};}function handleError(_0x443a17,_0x1212f8){_0x1212f8=_0x1212f8||0x1f4;return function(_0x7672b3){logger[_0x5ddc('0x24')](_0x7672b3[_0x5ddc('0x25')]);if(_0x7672b3[_0x5ddc('0x26')]){delete _0x7672b3[_0x5ddc('0x26')];}_0x443a17[_0x5ddc('0x17')](_0x1212f8)[_0x5ddc('0x27')](_0x7672b3);};}exports[_0x5ddc('0x28')]=function(_0x34e26b,_0x908d12){var _0x3c865d={},_0x326661={},_0x5783e9={'count':0x0,'rows':[]};var _0x1d244a=_[_0x5ddc('0x29')](db[_0x5ddc('0x2a')]['rawAttributes'],function(_0x5b2105){return{'name':_0x5b2105['fieldName'],'type':_0x5b2105[_0x5ddc('0x2b')][_0x5ddc('0x2c')]};});_0x326661[_0x5ddc('0x2d')]=_[_0x5ddc('0x29')](_0x1d244a,'name');_0x326661[_0x5ddc('0x2e')]=_[_0x5ddc('0x2f')](_0x34e26b['query']);_0x326661[_0x5ddc('0x30')]=_['intersection'](_0x326661[_0x5ddc('0x2d')],_0x326661[_0x5ddc('0x2e')]);_0x3c865d[_0x5ddc('0x31')]=_['intersection'](_0x326661[_0x5ddc('0x2d')],qs[_0x5ddc('0x32')](_0x34e26b[_0x5ddc('0x2e')][_0x5ddc('0x32')]));_0x3c865d['attributes']=_0x3c865d[_0x5ddc('0x31')][_0x5ddc('0x33')]?_0x3c865d[_0x5ddc('0x31')]:_0x326661[_0x5ddc('0x2d')];if(!_0x34e26b[_0x5ddc('0x2e')][_0x5ddc('0x34')]('nolimit')){_0x3c865d[_0x5ddc('0x1c')]=qs[_0x5ddc('0x1c')](_0x34e26b[_0x5ddc('0x2e')][_0x5ddc('0x1c')]);_0x3c865d[_0x5ddc('0x1a')]=qs[_0x5ddc('0x1a')](_0x34e26b[_0x5ddc('0x2e')][_0x5ddc('0x1a')]);}_0x3c865d[_0x5ddc('0x35')]=qs[_0x5ddc('0x36')](_0x34e26b[_0x5ddc('0x2e')]['sort']);_0x3c865d[_0x5ddc('0x37')]=qs[_0x5ddc('0x30')](_['pick'](_0x34e26b[_0x5ddc('0x2e')],_0x326661['filters']),_0x1d244a);if(_0x34e26b[_0x5ddc('0x2e')][_0x5ddc('0x38')]){_0x3c865d[_0x5ddc('0x37')]=_['merge'](_0x3c865d[_0x5ddc('0x37')],{'$or':_[_0x5ddc('0x29')](_0x1d244a,function(_0x26321e){if(_0x26321e[_0x5ddc('0x2b')]!==_0x5ddc('0x39')){var _0x1e2d6c={};_0x1e2d6c[_0x26321e[_0x5ddc('0x26')]]={'$like':'%'+_0x34e26b['query'][_0x5ddc('0x38')]+'%'};return _0x1e2d6c;}})});}_0x3c865d=_[_0x5ddc('0x3a')]({},_0x3c865d,_0x34e26b['options']);var _0x4ca212={'where':_0x3c865d[_0x5ddc('0x37')]};return db[_0x5ddc('0x2a')][_0x5ddc('0x1d')](_0x4ca212)[_0x5ddc('0x3b')](function(_0x34a621){_0x5783e9[_0x5ddc('0x1d')]=_0x34a621;if(_0x34e26b[_0x5ddc('0x2e')][_0x5ddc('0x3c')]){_0x3c865d[_0x5ddc('0x3d')]=[{'all':!![]}];}return db[_0x5ddc('0x2a')][_0x5ddc('0x3e')](_0x3c865d);})[_0x5ddc('0x3b')](function(_0x40f106){_0x5783e9[_0x5ddc('0x3f')]=_0x40f106;return _0x5783e9;})['then'](respondWithFilteredResult(_0x908d12,_0x3c865d))[_0x5ddc('0x40')](handleError(_0x908d12,null));};exports[_0x5ddc('0x41')]=function(_0x11a511,_0x1dcf03){var _0x45387a={'raw':!![],'where':{'id':_0x11a511[_0x5ddc('0x42')]['id']}},_0x581631={};_0x581631[_0x5ddc('0x2d')]=_[_0x5ddc('0x2f')](db[_0x5ddc('0x2a')][_0x5ddc('0x43')]);_0x581631[_0x5ddc('0x2e')]=_[_0x5ddc('0x2f')](_0x11a511['query']);_0x581631[_0x5ddc('0x30')]=_[_0x5ddc('0x44')](_0x581631[_0x5ddc('0x2d')],_0x581631['query']);_0x45387a[_0x5ddc('0x31')]=_['intersection'](_0x581631['model'],qs[_0x5ddc('0x32')](_0x11a511[_0x5ddc('0x2e')]['fields']));_0x45387a[_0x5ddc('0x31')]=_0x45387a[_0x5ddc('0x31')]['length']?_0x45387a[_0x5ddc('0x31')]:_0x581631[_0x5ddc('0x2d')];if(_0x11a511[_0x5ddc('0x2e')]['includeAll']){_0x45387a['include']=[{'all':!![]}];}_0x45387a=_[_0x5ddc('0x3a')]({},_0x45387a,_0x11a511[_0x5ddc('0x45')]);return db[_0x5ddc('0x2a')]['find'](_0x45387a)[_0x5ddc('0x3b')](handleEntityNotFound(_0x1dcf03,null))[_0x5ddc('0x3b')](respondWithResult(_0x1dcf03,null))[_0x5ddc('0x40')](handleError(_0x1dcf03,null));};exports[_0x5ddc('0x46')]=function(_0x4607d4,_0x4dc007){return db[_0x5ddc('0x2a')]['create'](_0x4607d4['body'],{})[_0x5ddc('0x3b')](respondWithResult(_0x4dc007,0xc9))[_0x5ddc('0x40')](handleError(_0x4dc007,null));};exports[_0x5ddc('0x22')]=function(_0x5ac4d1,_0xcc12fc){if(_0x5ac4d1['body']['id']){delete _0x5ac4d1[_0x5ddc('0x47')]['id'];}return db[_0x5ddc('0x2a')]['find']({'where':{'id':_0x5ac4d1[_0x5ddc('0x42')]['id']}})[_0x5ddc('0x3b')](handleEntityNotFound(_0xcc12fc,null))[_0x5ddc('0x3b')](saveUpdates(_0x5ac4d1[_0x5ddc('0x47')],null))['then'](respondWithResult(_0xcc12fc,null))[_0x5ddc('0x40')](handleError(_0xcc12fc,null));};exports[_0x5ddc('0x23')]=function(_0x1b19e7,_0x11e6e8){return db[_0x5ddc('0x2a')][_0x5ddc('0x48')]({'where':{'id':_0x1b19e7[_0x5ddc('0x42')]['id']}})[_0x5ddc('0x3b')](handleEntityNotFound(_0x11e6e8,null))['then'](removeEntity(_0x11e6e8,null))['catch'](handleError(_0x11e6e8,null));};exports[_0x5ddc('0x49')]=function(_0x37ccaf,_0x4a278d){return db['JscriptyQuestionReport'][_0x5ddc('0x49')]()[_0x5ddc('0x3b')](respondWithResult(_0x4a278d,null))['catch'](handleError(_0x4a278d,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index e1107d8..bb53214 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 _0x2cd1=['bluebird','../../config/environment','./jscriptyQuestionReport.attributes','exports','define','JscriptyQuestionReport','report_jscripty_questions','lodash','util','moment'];(function(_0x1554e2,_0x4efeec){var _0x51aa70=function(_0x33cad5){while(--_0x33cad5){_0x1554e2['push'](_0x1554e2['shift']());}};_0x51aa70(++_0x4efeec);}(_0x2cd1,0x1a1));var _0x12cd=function(_0x19674e,_0xcfb13c){_0x19674e=_0x19674e-0x0;var _0x121d16=_0x2cd1[_0x19674e];return _0x121d16;};'use strict';var _=require(_0x12cd('0x0'));var util=require(_0x12cd('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x12cd('0x2'));var BPromise=require(_0x12cd('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x12cd('0x4'));var attributes=require(_0x12cd('0x5'));module[_0x12cd('0x6')]=function(_0x1e2297,_0x192463){return _0x1e2297[_0x12cd('0x7')](_0x12cd('0x8'),attributes,{'tableName':_0x12cd('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2ebe=['api','path','rimraf','./jscriptyQuestionReport.attributes','exports','define','JscriptyQuestionReport','lodash'];(function(_0x1a193a,_0xca4f48){var _0x2d5806=function(_0x5750e5){while(--_0x5750e5){_0x1a193a['push'](_0x1a193a['shift']());}};_0x2d5806(++_0xca4f48);}(_0x2ebe,0x16f));var _0xe2eb=function(_0x1ae484,_0xef3a1){_0x1ae484=_0x1ae484-0x0;var _0x2f64ec=_0x2ebe[_0x1ae484];return _0x2f64ec;};'use strict';var _=require(_0xe2eb('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xe2eb('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xe2eb('0x2'));var rimraf=require(_0xe2eb('0x3'));var config=require('../../config/environment');var attributes=require(_0xe2eb('0x4'));module[_0xe2eb('0x5')]=function(_0x48433c,_0x52dead){return _0x48433c[_0xe2eb('0x6')](_0xe2eb('0x7'),attributes,{'tableName':'report_jscripty_questions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js index 24e22b4..767b73d 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 _0xc995=['http','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client'];(function(_0x54fc80,_0x45d643){var _0x2e672d=function(_0x2946ba){while(--_0x2946ba){_0x54fc80['push'](_0x54fc80['shift']());}};_0x2e672d(++_0x45d643);}(_0xc995,0xbe));var _0x5c99=function(_0x3fc0ce,_0x403e20){_0x3fc0ce=_0x3fc0ce-0x0;var _0x5329f6=_0xc995[_0x3fc0ce];return _0x5329f6;};'use strict';var _=require(_0x5c99('0x0'));var util=require(_0x5c99('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5c99('0x2'));var fs=require('fs');var Redis=require(_0x5c99('0x3'));var db=require(_0x5c99('0x4'))['db'];var utils=require(_0x5c99('0x5'));var logger=require(_0x5c99('0x6'))('rpc');var config=require(_0x5c99('0x7'));var jayson=require(_0x5c99('0x8'));var client=jayson[_0x5c99('0x9')][_0x5c99('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4a7b72,_0x3aab77,_0x3a45cc){return new BPromise(function(_0x2e6b87,_0x4b3304){return client['request'](_0x4a7b72,_0x3a45cc)['then'](function(_0x112004){logger[_0x5c99('0xb')](_0x5c99('0xc'),_0x3aab77,_0x5c99('0xd'));logger[_0x5c99('0xe')](_0x5c99('0xf'),_0x3aab77,_0x5c99('0xd'),JSON[_0x5c99('0x10')](_0x112004));if(_0x112004[_0x5c99('0x11')]){if(_0x112004['error']['code']===0x1f4){logger[_0x5c99('0x11')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x3aab77,_0x112004[_0x5c99('0x11')][_0x5c99('0x12')]);return _0x4b3304(_0x112004[_0x5c99('0x11')][_0x5c99('0x12')]);}logger[_0x5c99('0x11')](_0x5c99('0xc'),_0x3aab77,_0x112004[_0x5c99('0x11')][_0x5c99('0x12')]);return _0x2e6b87(_0x112004[_0x5c99('0x11')][_0x5c99('0x12')]);}else{logger[_0x5c99('0xb')](_0x5c99('0xc'),_0x3aab77,_0x5c99('0xd'));_0x2e6b87(_0x112004['result'][_0x5c99('0x12')]);}})[_0x5c99('0x13')](function(_0x32c455){logger[_0x5c99('0x11')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x3aab77,_0x32c455);_0x4b3304(_0x32c455);});});} \ No newline at end of file +var _0xc8ae=['client','http','request','then','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0xc8ae,0x6e));var _0xec8a=function(_0x1cae16,_0x13e382){_0x1cae16=_0x1cae16-0x0;var _0x31d693=_0xc8ae[_0x1cae16];return _0x31d693;};'use strict';var _=require(_0xec8a('0x0'));var util=require(_0xec8a('0x1'));var moment=require(_0xec8a('0x2'));var BPromise=require(_0xec8a('0x3'));var rs=require(_0xec8a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xec8a('0x5'));var logger=require(_0xec8a('0x6'))(_0xec8a('0x7'));var config=require(_0xec8a('0x8'));var jayson=require(_0xec8a('0x9'));var client=jayson[_0xec8a('0xa')][_0xec8a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x401a3e,_0x31c631,_0x47600a){return new BPromise(function(_0x46354b,_0x1cd8e0){return client[_0xec8a('0xc')](_0x401a3e,_0x47600a)[_0xec8a('0xd')](function(_0x4eb9f6){logger['info'](_0xec8a('0xe'),_0x31c631,_0xec8a('0xf'));logger['debug'](_0xec8a('0x10'),_0x31c631,_0xec8a('0xf'),JSON[_0xec8a('0x11')](_0x4eb9f6));if(_0x4eb9f6['error']){if(_0x4eb9f6[_0xec8a('0x12')][_0xec8a('0x13')]===0x1f4){logger[_0xec8a('0x12')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x31c631,_0x4eb9f6[_0xec8a('0x12')][_0xec8a('0x14')]);return _0x1cd8e0(_0x4eb9f6[_0xec8a('0x12')][_0xec8a('0x14')]);}logger[_0xec8a('0x12')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x31c631,_0x4eb9f6[_0xec8a('0x12')][_0xec8a('0x14')]);return _0x46354b(_0x4eb9f6[_0xec8a('0x12')]['message']);}else{logger[_0xec8a('0x15')](_0xec8a('0xe'),_0x31c631,_0xec8a('0xf'));_0x46354b(_0x4eb9f6[_0xec8a('0x16')]['message']);}})[_0xec8a('0x17')](function(_0x5d1b51){logger[_0xec8a('0x12')](_0xec8a('0xe'),_0x31c631,_0x5d1b51);_0x1cd8e0(_0x5d1b51);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 6b41aa7..1772d6c 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 _0x897d=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','isAuthenticated','index','get','/describe','describe','/:id/questions','getQuestions','post','put','update','delete','destroy','exports','path','connect-timeout','express','Router'];(function(_0x448eaf,_0x36a4c8){var _0x268530=function(_0x4371f7){while(--_0x4371f7){_0x448eaf['push'](_0x448eaf['shift']());}};_0x268530(++_0x36a4c8);}(_0x897d,0x1ca));var _0xd897=function(_0x3aba1a,_0x3d3635){_0x3aba1a=_0x3aba1a-0x0;var _0x347693=_0x897d[_0x3aba1a];return _0x347693;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xd897('0x0'));var timeout=require(_0xd897('0x1'));var express=require(_0xd897('0x2'));var router=express[_0xd897('0x3')]();var fs_extra=require(_0xd897('0x4'));var auth=require(_0xd897('0x5'));var interaction=require(_0xd897('0x6'));var config=require(_0xd897('0x7'));var controller=require(_0xd897('0x8'));router['get']('/',auth[_0xd897('0x9')](),controller[_0xd897('0xa')]);router[_0xd897('0xb')](_0xd897('0xc'),auth[_0xd897('0x9')](),controller[_0xd897('0xd')]);router[_0xd897('0xb')]('/:id',auth['isAuthenticated'](),controller['show']);router['get'](_0xd897('0xe'),auth[_0xd897('0x9')](),controller[_0xd897('0xf')]);router[_0xd897('0x10')]('/',auth[_0xd897('0x9')](),controller['create']);router[_0xd897('0x11')]('/:id',auth[_0xd897('0x9')](),controller[_0xd897('0x12')]);router[_0xd897('0x13')]('/:id',auth[_0xd897('0x9')](),controller[_0xd897('0x14')]);module[_0xd897('0x15')]=router; \ No newline at end of file +var _0x8afb=['post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','/:id/questions'];(function(_0x26d6d9,_0x431cb8){var _0x1b4875=function(_0x41111f){while(--_0x41111f){_0x26d6d9['push'](_0x26d6d9['shift']());}};_0x1b4875(++_0x431cb8);}(_0x8afb,0x16b));var _0xb8af=function(_0x7a5226,_0x3fe3a0){_0x7a5226=_0x7a5226-0x0;var _0x2cfb8f=_0x8afb[_0x7a5226];return _0x2cfb8f;};'use strict';var multer=require(_0xb8af('0x0'));var util=require(_0xb8af('0x1'));var path=require(_0xb8af('0x2'));var timeout=require(_0xb8af('0x3'));var express=require(_0xb8af('0x4'));var router=express[_0xb8af('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xb8af('0x6'));var interaction=require(_0xb8af('0x7'));var config=require(_0xb8af('0x8'));var controller=require('./jscriptySessionReport.controller');router[_0xb8af('0x9')]('/',auth[_0xb8af('0xa')](),controller['index']);router[_0xb8af('0x9')](_0xb8af('0xb'),auth['isAuthenticated'](),controller[_0xb8af('0xc')]);router['get'](_0xb8af('0xd'),auth['isAuthenticated'](),controller['show']);router[_0xb8af('0x9')](_0xb8af('0xe'),auth[_0xb8af('0xa')](),controller['getQuestions']);router[_0xb8af('0xf')]('/',auth[_0xb8af('0xa')](),controller[_0xb8af('0x10')]);router[_0xb8af('0x11')](_0xb8af('0xd'),auth[_0xb8af('0xa')](),controller[_0xb8af('0x12')]);router['delete'](_0xb8af('0xd'),auth[_0xb8af('0xa')](),controller[_0xb8af('0x13')]);module[_0xb8af('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 23ebfee..56c6dfb 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 _0x8e8f=['starttime','endtime','YYYY-MM-DD\x20HH:mm:ss','DATE','STRING','BOOLEAN','moment','exports','setDataValue'];(function(_0xe25ee9,_0x1f6d98){var _0x56c669=function(_0x32e81a){while(--_0x32e81a){_0xe25ee9['push'](_0xe25ee9['shift']());}};_0x56c669(++_0x1f6d98);}(_0x8e8f,0x96));var _0xf8e8=function(_0x2bd8e5,_0x113d99){_0x2bd8e5=_0x2bd8e5-0x0;var _0x5b0230=_0x8e8f[_0x2bd8e5];return _0x5b0230;};'use strict';var moment=require(_0xf8e8('0x0'));var Sequelize=require('sequelize');module[_0xf8e8('0x1')]={'starttime':{'type':Sequelize['DATE'],'set':function(_0x5ee4ba){this[_0xf8e8('0x2')](_0xf8e8('0x3'),_0x5ee4ba);this['setDataValue'](_0xf8e8('0x4'),moment()['format'](_0xf8e8('0x5')));}},'endtime':{'type':Sequelize[_0xf8e8('0x6')]},'membername':{'type':Sequelize[_0xf8e8('0x7')]},'projectname':{'type':Sequelize[_0xf8e8('0x7')]},'queue':{'type':Sequelize[_0xf8e8('0x7')]},'uniqueid':{'type':Sequelize[_0xf8e8('0x7')]},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xf8e8('0x7')]},'completed':{'type':Sequelize[_0xf8e8('0x8')],'defaultValue':![]}}; \ No newline at end of file +var _0x2137=['exports','DATE','setDataValue','starttime','format','STRING','BOOLEAN','moment','sequelize'];(function(_0x236288,_0x32b339){var _0x3ebd35=function(_0x4082c7){while(--_0x4082c7){_0x236288['push'](_0x236288['shift']());}};_0x3ebd35(++_0x32b339);}(_0x2137,0x1a5));var _0x7213=function(_0xd0255a,_0x5ba91a){_0xd0255a=_0xd0255a-0x0;var _0x265f2d=_0x2137[_0xd0255a];return _0x265f2d;};'use strict';var moment=require(_0x7213('0x0'));var Sequelize=require(_0x7213('0x1'));module[_0x7213('0x2')]={'starttime':{'type':Sequelize[_0x7213('0x3')],'set':function(_0x4dfd68){this[_0x7213('0x4')](_0x7213('0x5'),_0x4dfd68);this['setDataValue']('endtime',moment()[_0x7213('0x6')]('YYYY-MM-DD\x20HH:mm:ss'));}},'endtime':{'type':Sequelize[_0x7213('0x3')]},'membername':{'type':Sequelize[_0x7213('0x7')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x7213('0x7')]},'uniqueid':{'type':Sequelize[_0x7213('0x7')]},'calleridname':{'type':Sequelize[_0x7213('0x7')]},'calleridnum':{'type':Sequelize[_0x7213('0x7')]},'completed':{'type':Sequelize[_0x7213('0x8')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index a2c6f08..20a991c 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 _0x2ac3=['include','findAll','then','catch','show','params','find','create','body','getQuestions','findOne','pick','JscriptyQuestionReport','rows','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','offset','undefined','limit','count','Content-Range','json','apply','save','update','destroy','end','error','stack','name','send','index','JscriptySessionReport','rawAttributes','fieldName','type','key','map','keys','query','intersection','fields','attributes','length','model','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll'];(function(_0x189944,_0x52bf5e){var _0x36117a=function(_0x92f6c){while(--_0x92f6c){_0x189944['push'](_0x189944['shift']());}};_0x36117a(++_0x52bf5e);}(_0x2ac3,0x1e8));var _0x32ac=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x2ac3[_0x413feb];return _0x40ee88;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x32ac('0x0'));var jsonpatch=require(_0x32ac('0x1'));var rp=require(_0x32ac('0x2'));var moment=require('moment');var BPromise=require(_0x32ac('0x3'));var Mustache=require('mustache');var util=require(_0x32ac('0x4'));var path=require(_0x32ac('0x5'));var sox=require(_0x32ac('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x32ac('0x7'));var _=require('lodash');var squel=require(_0x32ac('0x8'));var crypto=require(_0x32ac('0x9'));var jsforce=require(_0x32ac('0xa'));var deskjs=require(_0x32ac('0xb'));var toCsv=require(_0x32ac('0xc'));var querystring=require(_0x32ac('0xd'));var Papa=require('papaparse');var Redis=require(_0x32ac('0xe'));var authService=require(_0x32ac('0xf'));var qs=require(_0x32ac('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x32ac('0x11'));var logger=require(_0x32ac('0x12'))(_0x32ac('0x13'));var utils=require(_0x32ac('0x14'));var config=require(_0x32ac('0x15'));var licenseUtil=require(_0x32ac('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2b0e0f,_0x37915e){_0x37915e=_0x37915e||0xcc;return function(_0x5025e8){if(_0x5025e8){return _0x2b0e0f[_0x32ac('0x17')](_0x37915e);}return _0x2b0e0f[_0x32ac('0x18')](_0x37915e)['end']();};}function respondWithResult(_0xb2af34,_0x858538){_0x858538=_0x858538||0xc8;return function(_0x30f687){if(_0x30f687){return _0xb2af34[_0x32ac('0x18')](_0x858538)['json'](_0x30f687);}};}function respondWithFilteredResult(_0x1cb002,_0x5b623f){return function(_0x417c6b){if(_0x417c6b){var _0x19898a=typeof _0x5b623f[_0x32ac('0x19')]===_0x32ac('0x1a')&&typeof _0x5b623f[_0x32ac('0x1b')]==='undefined';var _0x207fe9=_0x417c6b[_0x32ac('0x1c')];var _0x6919ae=_0x19898a?0x0:_0x5b623f['offset'];var _0x2084d7=_0x19898a?_0x417c6b['count']:_0x5b623f[_0x32ac('0x19')]+_0x5b623f['limit'];var _0x2a89c3;if(_0x2084d7>=_0x207fe9){_0x2084d7=_0x207fe9;_0x2a89c3=0xc8;}else{_0x2a89c3=0xce;}_0x1cb002['status'](_0x2a89c3);return _0x1cb002['set'](_0x32ac('0x1d'),_0x6919ae+'-'+_0x2084d7+'/'+_0x207fe9)[_0x32ac('0x1e')](_0x417c6b);}return null;};}function patchUpdates(_0x405fce){return function(_0x31000d){try{jsonpatch[_0x32ac('0x1f')](_0x31000d,_0x405fce,!![]);}catch(_0x3e867d){return BPromise['reject'](_0x3e867d);}return _0x31000d[_0x32ac('0x20')]();};}function saveUpdates(_0x5b5c68,_0x275c13){return function(_0x3081d9){if(_0x3081d9){return _0x3081d9[_0x32ac('0x21')](_0x5b5c68)['then'](function(_0x4ce689){return _0x4ce689;});}return null;};}function removeEntity(_0x342986,_0x5b1d1f){return function(_0x2dd141){if(_0x2dd141){return _0x2dd141[_0x32ac('0x22')]()['then'](function(){_0x342986[_0x32ac('0x18')](0xcc)[_0x32ac('0x23')]();});}};}function handleEntityNotFound(_0x4cc908,_0x534776){return function(_0x5096b8){if(!_0x5096b8){_0x4cc908[_0x32ac('0x17')](0x194);}return _0x5096b8;};}function handleError(_0x10ed91,_0x4fd02f){_0x4fd02f=_0x4fd02f||0x1f4;return function(_0x5d9bcc){logger[_0x32ac('0x24')](_0x5d9bcc[_0x32ac('0x25')]);if(_0x5d9bcc[_0x32ac('0x26')]){delete _0x5d9bcc['name'];}_0x10ed91[_0x32ac('0x18')](_0x4fd02f)[_0x32ac('0x27')](_0x5d9bcc);};}exports[_0x32ac('0x28')]=function(_0x552aaa,_0x9aca10){var _0x311cf8={},_0x3b762b={},_0x2bcb1e={'count':0x0,'rows':[]};var _0x48aa9b=_['map'](db[_0x32ac('0x29')][_0x32ac('0x2a')],function(_0x30f34b){return{'name':_0x30f34b[_0x32ac('0x2b')],'type':_0x30f34b[_0x32ac('0x2c')][_0x32ac('0x2d')]};});_0x3b762b['model']=_[_0x32ac('0x2e')](_0x48aa9b,'name');_0x3b762b['query']=_[_0x32ac('0x2f')](_0x552aaa[_0x32ac('0x30')]);_0x3b762b['filters']=_['intersection'](_0x3b762b['model'],_0x3b762b['query']);_0x311cf8['attributes']=_[_0x32ac('0x31')](_0x3b762b['model'],qs[_0x32ac('0x32')](_0x552aaa[_0x32ac('0x30')][_0x32ac('0x32')]));_0x311cf8[_0x32ac('0x33')]=_0x311cf8[_0x32ac('0x33')][_0x32ac('0x34')]?_0x311cf8['attributes']:_0x3b762b[_0x32ac('0x35')];if(!_0x552aaa['query'][_0x32ac('0x36')](_0x32ac('0x37'))){_0x311cf8['limit']=qs[_0x32ac('0x1b')](_0x552aaa[_0x32ac('0x30')][_0x32ac('0x1b')]);_0x311cf8[_0x32ac('0x19')]=qs[_0x32ac('0x19')](_0x552aaa['query'][_0x32ac('0x19')]);}_0x311cf8[_0x32ac('0x38')]=qs[_0x32ac('0x39')](_0x552aaa['query'][_0x32ac('0x39')]);_0x311cf8[_0x32ac('0x3a')]=qs[_0x32ac('0x3b')](_['pick'](_0x552aaa[_0x32ac('0x30')],_0x3b762b['filters']),_0x48aa9b);if(_0x552aaa[_0x32ac('0x30')][_0x32ac('0x3c')]){_0x311cf8[_0x32ac('0x3a')]=_[_0x32ac('0x3d')](_0x311cf8[_0x32ac('0x3a')],{'$or':_['map'](_0x48aa9b,function(_0x43bd7d){if(_0x43bd7d[_0x32ac('0x2c')]!==_0x32ac('0x3e')){var _0x50f5fa={};_0x50f5fa[_0x43bd7d[_0x32ac('0x26')]]={'$like':'%'+_0x552aaa[_0x32ac('0x30')][_0x32ac('0x3c')]+'%'};return _0x50f5fa;}})});}_0x311cf8=_[_0x32ac('0x3d')]({},_0x311cf8,_0x552aaa[_0x32ac('0x3f')]);var _0x277d3a={'where':_0x311cf8[_0x32ac('0x3a')]};return db[_0x32ac('0x29')][_0x32ac('0x1c')](_0x277d3a)['then'](function(_0x1576c7){_0x2bcb1e['count']=_0x1576c7;if(_0x552aaa['query'][_0x32ac('0x40')]){_0x311cf8[_0x32ac('0x41')]=[{'all':!![]}];}return db[_0x32ac('0x29')][_0x32ac('0x42')](_0x311cf8);})[_0x32ac('0x43')](function(_0x1df797){_0x2bcb1e['rows']=_0x1df797;return _0x2bcb1e;})[_0x32ac('0x43')](respondWithFilteredResult(_0x9aca10,_0x311cf8))[_0x32ac('0x44')](handleError(_0x9aca10,null));};exports[_0x32ac('0x45')]=function(_0x27d1d6,_0x3c429b){var _0x27c6ce={'raw':!![],'where':{'id':_0x27d1d6[_0x32ac('0x46')]['id']}},_0x495fcb={};_0x495fcb[_0x32ac('0x35')]=_['keys'](db[_0x32ac('0x29')]['rawAttributes']);_0x495fcb['query']=_[_0x32ac('0x2f')](_0x27d1d6[_0x32ac('0x30')]);_0x495fcb[_0x32ac('0x3b')]=_[_0x32ac('0x31')](_0x495fcb['model'],_0x495fcb[_0x32ac('0x30')]);_0x27c6ce[_0x32ac('0x33')]=_[_0x32ac('0x31')](_0x495fcb[_0x32ac('0x35')],qs['fields'](_0x27d1d6['query'][_0x32ac('0x32')]));_0x27c6ce[_0x32ac('0x33')]=_0x27c6ce[_0x32ac('0x33')][_0x32ac('0x34')]?_0x27c6ce['attributes']:_0x495fcb[_0x32ac('0x35')];if(_0x27d1d6['query'][_0x32ac('0x40')]){_0x27c6ce[_0x32ac('0x41')]=[{'all':!![]}];}_0x27c6ce=_[_0x32ac('0x3d')]({},_0x27c6ce,_0x27d1d6['options']);return db['JscriptySessionReport'][_0x32ac('0x47')](_0x27c6ce)[_0x32ac('0x43')](handleEntityNotFound(_0x3c429b,null))[_0x32ac('0x43')](respondWithResult(_0x3c429b,null))[_0x32ac('0x44')](handleError(_0x3c429b,null));};exports[_0x32ac('0x48')]=function(_0x485aa0,_0x270996){return db[_0x32ac('0x29')][_0x32ac('0x48')](_0x485aa0[_0x32ac('0x49')],{})['then'](respondWithResult(_0x270996,0xc9))['catch'](handleError(_0x270996,null));};exports['update']=function(_0x2f19ac,_0x5f349b){if(_0x2f19ac[_0x32ac('0x49')]['id']){delete _0x2f19ac[_0x32ac('0x49')]['id'];}return db[_0x32ac('0x29')]['find']({'where':{'id':_0x2f19ac['params']['id']}})[_0x32ac('0x43')](handleEntityNotFound(_0x5f349b,null))[_0x32ac('0x43')](saveUpdates(_0x2f19ac['body'],null))[_0x32ac('0x43')](respondWithResult(_0x5f349b,null))[_0x32ac('0x44')](handleError(_0x5f349b,null));};exports[_0x32ac('0x22')]=function(_0x2a18ab,_0x160eaa){return db[_0x32ac('0x29')][_0x32ac('0x47')]({'where':{'id':_0x2a18ab[_0x32ac('0x46')]['id']}})[_0x32ac('0x43')](handleEntityNotFound(_0x160eaa,null))['then'](removeEntity(_0x160eaa,null))[_0x32ac('0x44')](handleError(_0x160eaa,null));};exports['describe']=function(_0x44fe83,_0x45c182){return db[_0x32ac('0x29')]['describe']()['then'](respondWithResult(_0x45c182,null))['catch'](handleError(_0x45c182,null));};exports[_0x32ac('0x4a')]=function(_0x47e68a,_0x569c20,_0x8035d0){var _0x152b3b={'raw':!![],'where':{}};var _0x53972c={};var _0x185829={'count':0x0,'rows':[]};return db[_0x32ac('0x29')][_0x32ac('0x4b')]({'where':{'id':_0x47e68a['params']['id']}})[_0x32ac('0x43')](handleEntityNotFound(_0x569c20,null))[_0x32ac('0x43')](function(_0x3e5706){if(_0x3e5706){_0x53972c[_0x32ac('0x35')]=_['keys'](db['JscriptyQuestionReport'][_0x32ac('0x2a')]);_0x53972c[_0x32ac('0x30')]=_['keys'](_0x47e68a['query']);_0x53972c['filters']=_[_0x32ac('0x31')](_0x53972c[_0x32ac('0x35')],_0x53972c[_0x32ac('0x30')]);_0x152b3b[_0x32ac('0x33')]=_[_0x32ac('0x31')](_0x53972c[_0x32ac('0x35')],qs[_0x32ac('0x32')](_0x47e68a['query']['fields']));_0x152b3b[_0x32ac('0x33')]=_0x152b3b[_0x32ac('0x33')][_0x32ac('0x34')]?_0x152b3b[_0x32ac('0x33')]:_0x53972c[_0x32ac('0x35')];if(!_0x47e68a[_0x32ac('0x30')][_0x32ac('0x36')](_0x32ac('0x37'))){_0x152b3b[_0x32ac('0x1b')]=qs['limit'](_0x47e68a['query']['limit']);_0x152b3b[_0x32ac('0x19')]=qs[_0x32ac('0x19')](_0x47e68a['query']['offset']);}_0x152b3b[_0x32ac('0x38')]=qs[_0x32ac('0x39')](_0x47e68a[_0x32ac('0x30')][_0x32ac('0x39')]);_0x152b3b[_0x32ac('0x3a')]=qs[_0x32ac('0x3b')](_[_0x32ac('0x4c')](_0x47e68a['query'],_0x53972c[_0x32ac('0x3b')]));_0x152b3b['where']['SessionId']=_0x3e5706['id'];if(_0x47e68a['query'][_0x32ac('0x3c')]){_0x152b3b['where']=_[_0x32ac('0x3d')](_0x152b3b['where'],{'$or':_[_0x32ac('0x2e')](_0x152b3b[_0x32ac('0x33')],function(_0x2e3e6a){var _0x204dc3={};_0x204dc3[_0x2e3e6a]={'$like':'%'+_0x47e68a[_0x32ac('0x30')][_0x32ac('0x3c')]+'%'};return _0x204dc3;})});}_0x152b3b=_[_0x32ac('0x3d')]({},_0x152b3b,_0x47e68a[_0x32ac('0x3f')]);return db[_0x32ac('0x4d')][_0x32ac('0x1c')]({'where':_0x152b3b[_0x32ac('0x3a')]})['then'](function(_0x4f608c){_0x185829['count']=_0x4f608c;if(_0x47e68a[_0x32ac('0x30')][_0x32ac('0x40')]){_0x152b3b[_0x32ac('0x41')]=[{'all':!![]}];}return db[_0x32ac('0x4d')][_0x32ac('0x42')](_0x152b3b);})['then'](function(_0x22bc17){_0x185829[_0x32ac('0x4e')]=_0x22bc17;return _0x185829;});}})[_0x32ac('0x43')](respondWithFilteredResult(_0x569c20,_0x152b3b))[_0x32ac('0x44')](handleError(_0x569c20,null));}; \ No newline at end of file +var _0xbd9d=['findOne','JscriptyQuestionReport','hasOwnProperty','zip-dir','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','then','destroy','error','name','send','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','JscriptySessionReport','includeAll','include','findAll','rows','catch','params','length','options','create','body','update','find','describe','getQuestions'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xbd9d,0x184));var _0xdbd9=function(_0x4959f4,_0x206175){_0x4959f4=_0x4959f4-0x0;var _0x2293c5=_0xbd9d[_0x4959f4];return _0x2293c5;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xdbd9('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0xdbd9('0x1'));var moment=require('moment');var BPromise=require(_0xdbd9('0x2'));var Mustache=require(_0xdbd9('0x3'));var util=require(_0xdbd9('0x4'));var path=require('path');var sox=require(_0xdbd9('0x5'));var csv=require(_0xdbd9('0x6'));var ejs=require(_0xdbd9('0x7'));var fs=require('fs');var fs_extra=require(_0xdbd9('0x8'));var _=require(_0xdbd9('0x9'));var squel=require(_0xdbd9('0xa'));var crypto=require(_0xdbd9('0xb'));var jsforce=require(_0xdbd9('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xdbd9('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xdbd9('0xd'));var authService=require(_0xdbd9('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xdbd9('0xf'));var hardwareService=require(_0xdbd9('0x10'));var logger=require(_0xdbd9('0x11'))(_0xdbd9('0x12'));var utils=require(_0xdbd9('0x13'));var config=require(_0xdbd9('0x14'));var licenseUtil=require(_0xdbd9('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x39577a,_0x1018b1){_0x1018b1=_0x1018b1||0xcc;return function(_0xb57278){if(_0xb57278){return _0x39577a[_0xdbd9('0x16')](_0x1018b1);}return _0x39577a[_0xdbd9('0x17')](_0x1018b1)[_0xdbd9('0x18')]();};}function respondWithResult(_0x247ec5,_0x3376f9){_0x3376f9=_0x3376f9||0xc8;return function(_0x5d55c4){if(_0x5d55c4){return _0x247ec5['status'](_0x3376f9)[_0xdbd9('0x19')](_0x5d55c4);}};}function respondWithFilteredResult(_0x4e8d42,_0x3a380f){return function(_0x481e2e){if(_0x481e2e){var _0x1f85a2=typeof _0x3a380f['offset']===_0xdbd9('0x1a')&&typeof _0x3a380f[_0xdbd9('0x1b')]===_0xdbd9('0x1a');var _0x3d95a6=_0x481e2e[_0xdbd9('0x1c')];var _0x503e05=_0x1f85a2?0x0:_0x3a380f[_0xdbd9('0x1d')];var _0x508698=_0x1f85a2?_0x481e2e[_0xdbd9('0x1c')]:_0x3a380f[_0xdbd9('0x1d')]+_0x3a380f[_0xdbd9('0x1b')];var _0xfdba63;if(_0x508698>=_0x3d95a6){_0x508698=_0x3d95a6;_0xfdba63=0xc8;}else{_0xfdba63=0xce;}_0x4e8d42[_0xdbd9('0x17')](_0xfdba63);return _0x4e8d42['set'](_0xdbd9('0x1e'),_0x503e05+'-'+_0x508698+'/'+_0x3d95a6)[_0xdbd9('0x19')](_0x481e2e);}return null;};}function patchUpdates(_0x1e8a10){return function(_0x1e75ad){try{jsonpatch[_0xdbd9('0x1f')](_0x1e75ad,_0x1e8a10,!![]);}catch(_0x3f1297){return BPromise[_0xdbd9('0x20')](_0x3f1297);}return _0x1e75ad[_0xdbd9('0x21')]();};}function saveUpdates(_0x432f07,_0x8d3c20){return function(_0x1ff57b){if(_0x1ff57b){return _0x1ff57b['update'](_0x432f07)[_0xdbd9('0x22')](function(_0x10ab34){return _0x10ab34;});}return null;};}function removeEntity(_0x45a916,_0x38216d){return function(_0x4c5024){if(_0x4c5024){return _0x4c5024[_0xdbd9('0x23')]()[_0xdbd9('0x22')](function(){_0x45a916[_0xdbd9('0x17')](0xcc)[_0xdbd9('0x18')]();});}};}function handleEntityNotFound(_0x33012e,_0x54aa67){return function(_0x3d6108){if(!_0x3d6108){_0x33012e[_0xdbd9('0x16')](0x194);}return _0x3d6108;};}function handleError(_0x491167,_0x48a753){_0x48a753=_0x48a753||0x1f4;return function(_0x12d1a7){logger[_0xdbd9('0x24')](_0x12d1a7['stack']);if(_0x12d1a7[_0xdbd9('0x25')]){delete _0x12d1a7['name'];}_0x491167['status'](_0x48a753)[_0xdbd9('0x26')](_0x12d1a7);};}exports['index']=function(_0xa01c58,_0x146494){var _0x22b991={},_0x122234={},_0x66e402={'count':0x0,'rows':[]};var _0x12fd0c=_[_0xdbd9('0x27')](db['JscriptySessionReport'][_0xdbd9('0x28')],function(_0x193d81){return{'name':_0x193d81[_0xdbd9('0x29')],'type':_0x193d81[_0xdbd9('0x2a')][_0xdbd9('0x2b')]};});_0x122234[_0xdbd9('0x2c')]=_[_0xdbd9('0x27')](_0x12fd0c,'name');_0x122234['query']=_[_0xdbd9('0x2d')](_0xa01c58[_0xdbd9('0x2e')]);_0x122234[_0xdbd9('0x2f')]=_[_0xdbd9('0x30')](_0x122234[_0xdbd9('0x2c')],_0x122234[_0xdbd9('0x2e')]);_0x22b991[_0xdbd9('0x31')]=_[_0xdbd9('0x30')](_0x122234['model'],qs[_0xdbd9('0x32')](_0xa01c58['query']['fields']));_0x22b991[_0xdbd9('0x31')]=_0x22b991[_0xdbd9('0x31')]['length']?_0x22b991[_0xdbd9('0x31')]:_0x122234[_0xdbd9('0x2c')];if(!_0xa01c58[_0xdbd9('0x2e')]['hasOwnProperty'](_0xdbd9('0x33'))){_0x22b991[_0xdbd9('0x1b')]=qs[_0xdbd9('0x1b')](_0xa01c58['query'][_0xdbd9('0x1b')]);_0x22b991[_0xdbd9('0x1d')]=qs[_0xdbd9('0x1d')](_0xa01c58[_0xdbd9('0x2e')][_0xdbd9('0x1d')]);}_0x22b991[_0xdbd9('0x34')]=qs[_0xdbd9('0x35')](_0xa01c58[_0xdbd9('0x2e')][_0xdbd9('0x35')]);_0x22b991[_0xdbd9('0x36')]=qs[_0xdbd9('0x2f')](_[_0xdbd9('0x37')](_0xa01c58['query'],_0x122234[_0xdbd9('0x2f')]),_0x12fd0c);if(_0xa01c58[_0xdbd9('0x2e')][_0xdbd9('0x38')]){_0x22b991[_0xdbd9('0x36')]=_[_0xdbd9('0x39')](_0x22b991['where'],{'$or':_[_0xdbd9('0x27')](_0x12fd0c,function(_0x540cf8){if(_0x540cf8[_0xdbd9('0x2a')]!==_0xdbd9('0x3a')){var _0x3756f0={};_0x3756f0[_0x540cf8[_0xdbd9('0x25')]]={'$like':'%'+_0xa01c58[_0xdbd9('0x2e')][_0xdbd9('0x38')]+'%'};return _0x3756f0;}})});}_0x22b991=_[_0xdbd9('0x39')]({},_0x22b991,_0xa01c58['options']);var _0x15db4d={'where':_0x22b991[_0xdbd9('0x36')]};return db[_0xdbd9('0x3b')][_0xdbd9('0x1c')](_0x15db4d)[_0xdbd9('0x22')](function(_0xbbeb43){_0x66e402[_0xdbd9('0x1c')]=_0xbbeb43;if(_0xa01c58['query'][_0xdbd9('0x3c')]){_0x22b991[_0xdbd9('0x3d')]=[{'all':!![]}];}return db['JscriptySessionReport'][_0xdbd9('0x3e')](_0x22b991);})['then'](function(_0x53b055){_0x66e402[_0xdbd9('0x3f')]=_0x53b055;return _0x66e402;})[_0xdbd9('0x22')](respondWithFilteredResult(_0x146494,_0x22b991))[_0xdbd9('0x40')](handleError(_0x146494,null));};exports['show']=function(_0x4dc22b,_0x43adc4){var _0x4208d3={'raw':!![],'where':{'id':_0x4dc22b[_0xdbd9('0x41')]['id']}},_0x386ad3={};_0x386ad3[_0xdbd9('0x2c')]=_[_0xdbd9('0x2d')](db['JscriptySessionReport']['rawAttributes']);_0x386ad3['query']=_['keys'](_0x4dc22b[_0xdbd9('0x2e')]);_0x386ad3[_0xdbd9('0x2f')]=_[_0xdbd9('0x30')](_0x386ad3['model'],_0x386ad3['query']);_0x4208d3[_0xdbd9('0x31')]=_[_0xdbd9('0x30')](_0x386ad3[_0xdbd9('0x2c')],qs[_0xdbd9('0x32')](_0x4dc22b[_0xdbd9('0x2e')][_0xdbd9('0x32')]));_0x4208d3['attributes']=_0x4208d3[_0xdbd9('0x31')][_0xdbd9('0x42')]?_0x4208d3[_0xdbd9('0x31')]:_0x386ad3[_0xdbd9('0x2c')];if(_0x4dc22b[_0xdbd9('0x2e')][_0xdbd9('0x3c')]){_0x4208d3[_0xdbd9('0x3d')]=[{'all':!![]}];}_0x4208d3=_[_0xdbd9('0x39')]({},_0x4208d3,_0x4dc22b[_0xdbd9('0x43')]);return db[_0xdbd9('0x3b')]['find'](_0x4208d3)['then'](handleEntityNotFound(_0x43adc4,null))[_0xdbd9('0x22')](respondWithResult(_0x43adc4,null))['catch'](handleError(_0x43adc4,null));};exports[_0xdbd9('0x44')]=function(_0x2d99d3,_0x294a52){return db[_0xdbd9('0x3b')][_0xdbd9('0x44')](_0x2d99d3[_0xdbd9('0x45')],{})[_0xdbd9('0x22')](respondWithResult(_0x294a52,0xc9))[_0xdbd9('0x40')](handleError(_0x294a52,null));};exports[_0xdbd9('0x46')]=function(_0xb35b29,_0x587370){if(_0xb35b29[_0xdbd9('0x45')]['id']){delete _0xb35b29[_0xdbd9('0x45')]['id'];}return db[_0xdbd9('0x3b')][_0xdbd9('0x47')]({'where':{'id':_0xb35b29['params']['id']}})[_0xdbd9('0x22')](handleEntityNotFound(_0x587370,null))[_0xdbd9('0x22')](saveUpdates(_0xb35b29['body'],null))[_0xdbd9('0x22')](respondWithResult(_0x587370,null))['catch'](handleError(_0x587370,null));};exports['destroy']=function(_0x5eabdc,_0x381e0b){return db[_0xdbd9('0x3b')][_0xdbd9('0x47')]({'where':{'id':_0x5eabdc[_0xdbd9('0x41')]['id']}})[_0xdbd9('0x22')](handleEntityNotFound(_0x381e0b,null))[_0xdbd9('0x22')](removeEntity(_0x381e0b,null))[_0xdbd9('0x40')](handleError(_0x381e0b,null));};exports[_0xdbd9('0x48')]=function(_0x450919,_0x1ff91c){return db['JscriptySessionReport'][_0xdbd9('0x48')]()[_0xdbd9('0x22')](respondWithResult(_0x1ff91c,null))[_0xdbd9('0x40')](handleError(_0x1ff91c,null));};exports[_0xdbd9('0x49')]=function(_0x4b0a25,_0x16fc3e,_0x4068f6){var _0x3091c0={'raw':!![],'where':{}};var _0x4efc7c={};var _0x1ba9b2={'count':0x0,'rows':[]};return db[_0xdbd9('0x3b')][_0xdbd9('0x4a')]({'where':{'id':_0x4b0a25['params']['id']}})['then'](handleEntityNotFound(_0x16fc3e,null))[_0xdbd9('0x22')](function(_0x44d09e){if(_0x44d09e){_0x4efc7c[_0xdbd9('0x2c')]=_[_0xdbd9('0x2d')](db[_0xdbd9('0x4b')][_0xdbd9('0x28')]);_0x4efc7c[_0xdbd9('0x2e')]=_[_0xdbd9('0x2d')](_0x4b0a25['query']);_0x4efc7c[_0xdbd9('0x2f')]=_[_0xdbd9('0x30')](_0x4efc7c['model'],_0x4efc7c[_0xdbd9('0x2e')]);_0x3091c0['attributes']=_[_0xdbd9('0x30')](_0x4efc7c[_0xdbd9('0x2c')],qs['fields'](_0x4b0a25[_0xdbd9('0x2e')][_0xdbd9('0x32')]));_0x3091c0['attributes']=_0x3091c0['attributes'][_0xdbd9('0x42')]?_0x3091c0[_0xdbd9('0x31')]:_0x4efc7c['model'];if(!_0x4b0a25[_0xdbd9('0x2e')][_0xdbd9('0x4c')]('nolimit')){_0x3091c0[_0xdbd9('0x1b')]=qs[_0xdbd9('0x1b')](_0x4b0a25[_0xdbd9('0x2e')][_0xdbd9('0x1b')]);_0x3091c0[_0xdbd9('0x1d')]=qs[_0xdbd9('0x1d')](_0x4b0a25[_0xdbd9('0x2e')][_0xdbd9('0x1d')]);}_0x3091c0[_0xdbd9('0x34')]=qs[_0xdbd9('0x35')](_0x4b0a25[_0xdbd9('0x2e')][_0xdbd9('0x35')]);_0x3091c0[_0xdbd9('0x36')]=qs[_0xdbd9('0x2f')](_['pick'](_0x4b0a25[_0xdbd9('0x2e')],_0x4efc7c[_0xdbd9('0x2f')]));_0x3091c0[_0xdbd9('0x36')]['SessionId']=_0x44d09e['id'];if(_0x4b0a25['query'][_0xdbd9('0x38')]){_0x3091c0[_0xdbd9('0x36')]=_[_0xdbd9('0x39')](_0x3091c0[_0xdbd9('0x36')],{'$or':_['map'](_0x3091c0[_0xdbd9('0x31')],function(_0x5700ba){var _0x6a219c={};_0x6a219c[_0x5700ba]={'$like':'%'+_0x4b0a25[_0xdbd9('0x2e')][_0xdbd9('0x38')]+'%'};return _0x6a219c;})});}_0x3091c0=_['merge']({},_0x3091c0,_0x4b0a25[_0xdbd9('0x43')]);return db[_0xdbd9('0x4b')][_0xdbd9('0x1c')]({'where':_0x3091c0[_0xdbd9('0x36')]})[_0xdbd9('0x22')](function(_0x45103f){_0x1ba9b2['count']=_0x45103f;if(_0x4b0a25['query'][_0xdbd9('0x3c')]){_0x3091c0[_0xdbd9('0x3d')]=[{'all':!![]}];}return db[_0xdbd9('0x4b')]['findAll'](_0x3091c0);})[_0xdbd9('0x22')](function(_0x1844ea){_0x1ba9b2['rows']=_0x1844ea;return _0x1ba9b2;});}})['then'](respondWithFilteredResult(_0x16fc3e,_0x3091c0))[_0xdbd9('0x40')](handleError(_0x16fc3e,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index f2181e2..abad47e 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 _0x9fd4=['rimraf','exports','define','report_jscripty_sessions','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x9fd4,0x16c));var _0x49fd=function(_0x1f36bb,_0x8af718){_0x1f36bb=_0x1f36bb-0x0;var _0xaf97fa=_0x9fd4[_0x1f36bb];return _0xaf97fa;};'use strict';var _=require(_0x49fd('0x0'));var util=require(_0x49fd('0x1'));var logger=require(_0x49fd('0x2'))(_0x49fd('0x3'));var moment=require(_0x49fd('0x4'));var BPromise=require(_0x49fd('0x5'));var rp=require(_0x49fd('0x6'));var fs=require('fs');var path=require(_0x49fd('0x7'));var rimraf=require(_0x49fd('0x8'));var config=require('../../config/environment');var attributes=require('./jscriptySessionReport.attributes');module[_0x49fd('0x9')]=function(_0x42fdc7,_0x1bc16e){return _0x42fdc7[_0x49fd('0xa')]('JscriptySessionReport',attributes,{'tableName':_0x49fd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xeff8=['rimraf','../../config/environment','./jscriptySessionReport.attributes','define','JscriptySessionReport','lodash','util','api','moment','bluebird','path'];(function(_0x30df88,_0x2a1ad2){var _0x28bbb6=function(_0x4d3775){while(--_0x4d3775){_0x30df88['push'](_0x30df88['shift']());}};_0x28bbb6(++_0x2a1ad2);}(_0xeff8,0x186));var _0x8eff=function(_0x19b84f,_0x48765e){_0x19b84f=_0x19b84f-0x0;var _0x18067b=_0xeff8[_0x19b84f];return _0x18067b;};'use strict';var _=require(_0x8eff('0x0'));var util=require(_0x8eff('0x1'));var logger=require('../../config/logger')(_0x8eff('0x2'));var moment=require(_0x8eff('0x3'));var BPromise=require(_0x8eff('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8eff('0x5'));var rimraf=require(_0x8eff('0x6'));var config=require(_0x8eff('0x7'));var attributes=require(_0x8eff('0x8'));module['exports']=function(_0x469641,_0xb54063){return _0x469641[_0x8eff('0x9')](_0x8eff('0xa'),attributes,{'tableName':'report_jscripty_sessions','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 a479bd9..1c4b88e 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 _0xc2c7=['../../config/logger','jayson/promise','client','http','request','then','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0xc2c7,0x134));var _0x7c2c=function(_0x543fc5,_0x268be3){_0x543fc5=_0x543fc5-0x0;var _0x438a94=_0xc2c7[_0x543fc5];return _0x438a94;};'use strict';var _=require('lodash');var util=require(_0x7c2c('0x0'));var moment=require(_0x7c2c('0x1'));var BPromise=require(_0x7c2c('0x2'));var rs=require(_0x7c2c('0x3'));var fs=require('fs');var Redis=require(_0x7c2c('0x4'));var db=require(_0x7c2c('0x5'))['db'];var utils=require(_0x7c2c('0x6'));var logger=require(_0x7c2c('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x7c2c('0x8'));var client=jayson[_0x7c2c('0x9')][_0x7c2c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x54f027,_0x4abe93,_0x5a1027){return new BPromise(function(_0x2274cd,_0x29638d){return client[_0x7c2c('0xb')](_0x54f027,_0x5a1027)[_0x7c2c('0xc')](function(_0x279cff){logger['info'](_0x7c2c('0xd'),_0x4abe93,_0x7c2c('0xe'));logger[_0x7c2c('0xf')](_0x7c2c('0x10'),_0x4abe93,_0x7c2c('0xe'),JSON[_0x7c2c('0x11')](_0x279cff));if(_0x279cff[_0x7c2c('0x12')]){if(_0x279cff[_0x7c2c('0x12')][_0x7c2c('0x13')]===0x1f4){logger[_0x7c2c('0x12')](_0x7c2c('0xd'),_0x4abe93,_0x279cff[_0x7c2c('0x12')][_0x7c2c('0x14')]);return _0x29638d(_0x279cff[_0x7c2c('0x12')][_0x7c2c('0x14')]);}logger[_0x7c2c('0x12')]('JscriptySessionReport,\x20%s,\x20%s',_0x4abe93,_0x279cff['error'][_0x7c2c('0x14')]);return _0x2274cd(_0x279cff[_0x7c2c('0x12')][_0x7c2c('0x14')]);}else{logger['info'](_0x7c2c('0xd'),_0x4abe93,_0x7c2c('0xe'));_0x2274cd(_0x279cff['result'][_0x7c2c('0x14')]);}})['catch'](function(_0x1aa355){logger['error'](_0x7c2c('0xd'),_0x4abe93,_0x1aa355);_0x29638d(_0x1aa355);});});} \ No newline at end of file +var _0x1893=['../../config/logger','../../config/environment','jayson/promise','client','http','request','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x51beba,_0x202d19){var _0x167ee0=function(_0x2d5b21){while(--_0x2d5b21){_0x51beba['push'](_0x51beba['shift']());}};_0x167ee0(++_0x202d19);}(_0x1893,0xa2));var _0x3189=function(_0x407b00,_0x3868c1){_0x407b00=_0x407b00-0x0;var _0x2450aa=_0x1893[_0x407b00];return _0x2450aa;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3189('0x0'));var BPromise=require(_0x3189('0x1'));var rs=require(_0x3189('0x2'));var fs=require('fs');var Redis=require(_0x3189('0x3'));var db=require(_0x3189('0x4'))['db'];var utils=require(_0x3189('0x5'));var logger=require(_0x3189('0x6'))('rpc');var config=require(_0x3189('0x7'));var jayson=require(_0x3189('0x8'));var client=jayson[_0x3189('0x9')][_0x3189('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x77c566,_0x118970,_0x14d84b){return new BPromise(function(_0x1f6764,_0x5312a3){return client[_0x3189('0xb')](_0x77c566,_0x14d84b)['then'](function(_0x127449){logger['info'](_0x3189('0xc'),_0x118970,_0x3189('0xd'));logger[_0x3189('0xe')](_0x3189('0xf'),_0x118970,'request\x20sent',JSON[_0x3189('0x10')](_0x127449));if(_0x127449[_0x3189('0x11')]){if(_0x127449[_0x3189('0x11')][_0x3189('0x12')]===0x1f4){logger[_0x3189('0x11')]('JscriptySessionReport,\x20%s,\x20%s',_0x118970,_0x127449[_0x3189('0x11')][_0x3189('0x13')]);return _0x5312a3(_0x127449[_0x3189('0x11')][_0x3189('0x13')]);}logger[_0x3189('0x11')](_0x3189('0xc'),_0x118970,_0x127449[_0x3189('0x11')][_0x3189('0x13')]);return _0x1f6764(_0x127449['error'][_0x3189('0x13')]);}else{logger[_0x3189('0x14')](_0x3189('0xc'),_0x118970,_0x3189('0xd'));_0x1f6764(_0x127449['result'][_0x3189('0x13')]);}})['catch'](function(_0x55f432){logger[_0x3189('0x11')]('JscriptySessionReport,\x20%s,\x20%s',_0x118970,_0x55f432);_0x5312a3(_0x55f432);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index 28c3cbd..f409398 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 _0xae86=['./license.controller','get','index','/:id','isAuthenticated','/download_log_file','downloadLogFile','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x34ac60,_0x4cd52a){var _0x40c3ce=function(_0x32fc67){while(--_0x32fc67){_0x34ac60['push'](_0x34ac60['shift']());}};_0x40c3ce(++_0x4cd52a);}(_0xae86,0x107));var _0x6ae8=function(_0x33b59b,_0x20fb08){_0x33b59b=_0x33b59b-0x0;var _0xc188d5=_0xae86[_0x33b59b];return _0xc188d5;};'use strict';var multer=require(_0x6ae8('0x0'));var util=require('util');var path=require(_0x6ae8('0x1'));var timeout=require(_0x6ae8('0x2'));var express=require(_0x6ae8('0x3'));var router=express[_0x6ae8('0x4')]();var fs_extra=require(_0x6ae8('0x5'));var auth=require(_0x6ae8('0x6'));var interaction=require(_0x6ae8('0x7'));var config=require(_0x6ae8('0x8'));var controller=require(_0x6ae8('0x9'));router[_0x6ae8('0xa')]('/',controller[_0x6ae8('0xb')]);router['put'](_0x6ae8('0xc'),auth[_0x6ae8('0xd')](),controller['update']);router['get'](_0x6ae8('0xe'),auth[_0x6ae8('0xd')](),controller[_0x6ae8('0xf')]);module[_0x6ae8('0x10')]=router; \ No newline at end of file +var _0x59be=['downloadLogFile','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./license.controller','get','index','/:id','update','isAuthenticated'];(function(_0x58105c,_0x1af7f4){var _0x558747=function(_0x2b0ddd){while(--_0x2b0ddd){_0x58105c['push'](_0x58105c['shift']());}};_0x558747(++_0x1af7f4);}(_0x59be,0xbd));var _0xe59b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x59be[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xe59b('0x0'));var util=require(_0xe59b('0x1'));var path=require(_0xe59b('0x2'));var timeout=require('connect-timeout');var express=require(_0xe59b('0x3'));var router=express[_0xe59b('0x4')]();var fs_extra=require(_0xe59b('0x5'));var auth=require(_0xe59b('0x6'));var interaction=require(_0xe59b('0x7'));var config=require(_0xe59b('0x8'));var controller=require(_0xe59b('0x9'));router[_0xe59b('0xa')]('/',controller[_0xe59b('0xb')]);router['put'](_0xe59b('0xc'),auth['isAuthenticated'](),controller[_0xe59b('0xd')]);router['get']('/download_log_file',auth[_0xe59b('0xe')](),controller[_0xe59b('0xf')]);module[_0xe59b('0x10')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index c7d2dd0..add6bf6 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 _0x110e=['sequelize','TEXT','STRING','INTEGER'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x110e,0x140));var _0xe110=function(_0x5c2e3e,_0x26ecd3){_0x5c2e3e=_0x5c2e3e-0x0;var _0x53f64a=_0x110e[_0x5c2e3e];return _0x53f64a;};'use strict';var Sequelize=require(_0xe110('0x0'));module['exports']={'license':{'type':Sequelize[_0xe110('0x1')]},'data1':{'type':Sequelize[_0xe110('0x2')]},'data2':{'type':Sequelize[_0xe110('0x2')]},'chatLicenseExceeded':{'type':Sequelize[_0xe110('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0xe742=['STRING','INTEGER','exports','TEXT'];(function(_0x53007,_0x529efa){var _0x426b89=function(_0x51a9ae){while(--_0x51a9ae){_0x53007['push'](_0x53007['shift']());}};_0x426b89(++_0x529efa);}(_0xe742,0x116));var _0x2e74=function(_0xe37b,_0x40477e){_0xe37b=_0xe37b-0x0;var _0x4710e6=_0xe742[_0xe37b];return _0x4710e6;};'use strict';var Sequelize=require('sequelize');module[_0x2e74('0x0')]={'license':{'type':Sequelize[_0x2e74('0x1')]},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize[_0x2e74('0x2')]},'chatLicenseExceeded':{'type':Sequelize[_0x2e74('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 1fd5897..36d6f1e 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 _0x8829=['options','getLicense','catch','body','License','find','params','demo','downloadLogFile','/var','setHeader','attachment;\x20filename=','Content-Type','text/plain','download','eml-format','rimraf','fast-json-patch','request-promise','moment','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','limit','count','set','json','apply','reject','save','update','then','error','stack','name','send','index','model','rawAttributes','query','keys','filters','intersection','attributes','fields','length','merge'];(function(_0x21192c,_0x2c531a){var _0x2c5cfa=function(_0x34fa8c){while(--_0x34fa8c){_0x21192c['push'](_0x21192c['shift']());}};_0x2c5cfa(++_0x2c531a);}(_0x8829,0xde));var _0x9882=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8829[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x9882('0x0'));var rimraf=require(_0x9882('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9882('0x2'));var rp=require(_0x9882('0x3'));var moment=require(_0x9882('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x9882('0x5'));var path=require(_0x9882('0x6'));var sox=require(_0x9882('0x7'));var csv=require('to-csv');var ejs=require(_0x9882('0x8'));var fs=require('fs');var fs_extra=require(_0x9882('0x9'));var _=require(_0x9882('0xa'));var squel=require(_0x9882('0xb'));var crypto=require(_0x9882('0xc'));var jsforce=require(_0x9882('0xd'));var deskjs=require(_0x9882('0xe'));var toCsv=require(_0x9882('0xf'));var querystring=require(_0x9882('0x10'));var Papa=require(_0x9882('0x11'));var Redis=require('ioredis');var authService=require(_0x9882('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x9882('0x13'));var hardwareService=require(_0x9882('0x14'));var logger=require('../../config/logger')(_0x9882('0x15'));var utils=require(_0x9882('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x9882('0x17'));var db=require(_0x9882('0x18'))['db'];function respondWithStatusCode(_0x5d4035,_0x5ca199){_0x5ca199=_0x5ca199||0xcc;return function(_0x223583){if(_0x223583){return _0x5d4035[_0x9882('0x19')](_0x5ca199);}return _0x5d4035['status'](_0x5ca199)[_0x9882('0x1a')]();};}function respondWithResult(_0x283898,_0x58eaa1){_0x58eaa1=_0x58eaa1||0xc8;return function(_0x9777f){if(_0x9777f){return _0x283898[_0x9882('0x1b')](_0x58eaa1)['json'](_0x9777f);}};}function respondWithFilteredResult(_0xe33fdf,_0x6ba68a){return function(_0x576284){if(_0x576284){var _0x512d8d=typeof _0x6ba68a[_0x9882('0x1c')]===_0x9882('0x1d')&&typeof _0x6ba68a[_0x9882('0x1e')]===_0x9882('0x1d');var _0x1ca13c=_0x576284[_0x9882('0x1f')];var _0x442644=_0x512d8d?0x0:_0x6ba68a[_0x9882('0x1c')];var _0x5235bb=_0x512d8d?_0x576284[_0x9882('0x1f')]:_0x6ba68a[_0x9882('0x1c')]+_0x6ba68a[_0x9882('0x1e')];var _0x1d0d06;if(_0x5235bb>=_0x1ca13c){_0x5235bb=_0x1ca13c;_0x1d0d06=0xc8;}else{_0x1d0d06=0xce;}_0xe33fdf[_0x9882('0x1b')](_0x1d0d06);return _0xe33fdf[_0x9882('0x20')]('Content-Range',_0x442644+'-'+_0x5235bb+'/'+_0x1ca13c)[_0x9882('0x21')](_0x576284);}return null;};}function patchUpdates(_0x43a799){return function(_0x2506b1){try{jsonpatch[_0x9882('0x22')](_0x2506b1,_0x43a799,!![]);}catch(_0xa4f9fa){return BPromise[_0x9882('0x23')](_0xa4f9fa);}return _0x2506b1[_0x9882('0x24')]();};}function saveUpdates(_0x46c19e,_0x1e3488){return function(_0x5227f1){if(_0x5227f1){return _0x5227f1[_0x9882('0x25')](_0x46c19e)[_0x9882('0x26')](function(_0x42deac){return _0x42deac;});}return null;};}function removeEntity(_0x5aa6ab,_0xff5ee0){return function(_0x3beb81){if(_0x3beb81){return _0x3beb81['destroy']()[_0x9882('0x26')](function(){_0x5aa6ab[_0x9882('0x1b')](0xcc)[_0x9882('0x1a')]();});}};}function handleEntityNotFound(_0x2e5685,_0x319350){return function(_0xe10a8b){if(!_0xe10a8b){_0x2e5685[_0x9882('0x19')](0x194);}return _0xe10a8b;};}function handleError(_0x7c7d88,_0x1820e4){_0x1820e4=_0x1820e4||0x1f4;return function(_0xbb310c){logger[_0x9882('0x27')](_0xbb310c[_0x9882('0x28')]);if(_0xbb310c[_0x9882('0x29')]){delete _0xbb310c[_0x9882('0x29')];}_0x7c7d88['status'](_0x1820e4)[_0x9882('0x2a')](_0xbb310c);};}var utilLicense=require('../../config/license/util');exports[_0x9882('0x2b')]=function(_0x2f36f0,_0x2d55f5){var _0xe919fe={'raw':!![],'where':{'id':0x1}},_0x1fa609={};_0x1fa609[_0x9882('0x2c')]=_['keys'](db['License'][_0x9882('0x2d')]);_0x1fa609[_0x9882('0x2e')]=_[_0x9882('0x2f')](_0x2f36f0[_0x9882('0x2e')]);_0x1fa609[_0x9882('0x30')]=_[_0x9882('0x31')](_0x1fa609['model'],_0x1fa609['query']);_0xe919fe[_0x9882('0x32')]=_['intersection'](_0x1fa609[_0x9882('0x2c')],qs['fields'](_0x2f36f0[_0x9882('0x2e')][_0x9882('0x33')]));_0xe919fe['attributes']=_0xe919fe['attributes'][_0x9882('0x34')]?_0xe919fe['attributes']:_0x1fa609[_0x9882('0x2c')];_0xe919fe=_[_0x9882('0x35')]({},_0xe919fe,_0x2f36f0[_0x9882('0x36')]);return utilLicense[_0x9882('0x37')](_0xe919fe)[_0x9882('0x26')](respondWithResult(_0x2d55f5,null))[_0x9882('0x38')](handleError(_0x2d55f5,null));};exports[_0x9882('0x25')]=function(_0x5c56f6,_0x1b4aaa){if(_0x5c56f6[_0x9882('0x39')]['id']){delete _0x5c56f6[_0x9882('0x39')]['id'];}return db[_0x9882('0x3a')][_0x9882('0x3b')]({'where':{'id':_0x5c56f6[_0x9882('0x3c')]['id']}})[_0x9882('0x26')](handleEntityNotFound(_0x1b4aaa,null))[_0x9882('0x26')](function(_0x135105){var _0x17f0f7=_0x135105['get']({'plain':!![]});return utilLicense['checkLicense'](_0x17f0f7,_0x5c56f6[_0x9882('0x39')]['key']);})[_0x9882('0x26')](function(_0x3f61e1){if(!_0x3f61e1[_0x9882('0x3d')]){return saveUpdates(_0x5c56f6[_0x9882('0x39')],null);}return _0x3f61e1;})[_0x9882('0x26')](respondWithResult(_0x1b4aaa,null))[_0x9882('0x38')](handleError(_0x1b4aaa,null));};exports[_0x9882('0x3e')]=function(_0x3114b7,_0x29d21b){var _0x51daea='license-info.log';var _0x392eb0=path['join'](_0x9882('0x3f'),'log','xcally',_0x51daea);_0x29d21b[_0x9882('0x40')]('Content-disposition',_0x9882('0x41')+_0x51daea);_0x29d21b[_0x9882('0x20')](_0x9882('0x42'),_0x9882('0x43'));_0x29d21b[_0x9882('0x44')](_0x392eb0);}; \ No newline at end of file +var _0xae55=['json','offset','undefined','limit','count','apply','reject','save','update','then','destroy','stack','name','index','License','rawAttributes','query','keys','filters','intersection','attributes','model','fields','length','merge','options','getLicense','catch','find','params','get','checkLicense','key','demo','body','downloadLogFile','join','xcally','Content-disposition','attachment;\x20filename=','set','Content-Type','download','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end'];(function(_0x3b1413,_0x21dace){var _0x83e68a=function(_0x4f781a){while(--_0x4f781a){_0x3b1413['push'](_0x3b1413['shift']());}};_0x83e68a(++_0x21dace);}(_0xae55,0xbf));var _0x5ae5=function(_0x344205,_0x371953){_0x344205=_0x344205-0x0;var _0x1daaeb=_0xae55[_0x344205];return _0x1daaeb;};'use strict';var emlformat=require(_0x5ae5('0x0'));var rimraf=require(_0x5ae5('0x1'));var zipdir=require(_0x5ae5('0x2'));var jsonpatch=require(_0x5ae5('0x3'));var rp=require(_0x5ae5('0x4'));var moment=require(_0x5ae5('0x5'));var BPromise=require(_0x5ae5('0x6'));var Mustache=require(_0x5ae5('0x7'));var util=require('util');var path=require(_0x5ae5('0x8'));var sox=require(_0x5ae5('0x9'));var csv=require(_0x5ae5('0xa'));var ejs=require(_0x5ae5('0xb'));var fs=require('fs');var fs_extra=require(_0x5ae5('0xc'));var _=require(_0x5ae5('0xd'));var squel=require(_0x5ae5('0xe'));var crypto=require('crypto');var jsforce=require(_0x5ae5('0xf'));var deskjs=require(_0x5ae5('0x10'));var toCsv=require(_0x5ae5('0xa'));var querystring=require(_0x5ae5('0x11'));var Papa=require(_0x5ae5('0x12'));var Redis=require(_0x5ae5('0x13'));var authService=require(_0x5ae5('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x5ae5('0x15'));var hardwareService=require(_0x5ae5('0x16'));var logger=require(_0x5ae5('0x17'))(_0x5ae5('0x18'));var utils=require('../../config/utils');var config=require(_0x5ae5('0x19'));var licenseUtil=require(_0x5ae5('0x1a'));var db=require(_0x5ae5('0x1b'))['db'];function respondWithStatusCode(_0x36510b,_0x3b4c20){_0x3b4c20=_0x3b4c20||0xcc;return function(_0x3881c1){if(_0x3881c1){return _0x36510b[_0x5ae5('0x1c')](_0x3b4c20);}return _0x36510b[_0x5ae5('0x1d')](_0x3b4c20)[_0x5ae5('0x1e')]();};}function respondWithResult(_0x22c91d,_0x34caac){_0x34caac=_0x34caac||0xc8;return function(_0x1e84b1){if(_0x1e84b1){return _0x22c91d[_0x5ae5('0x1d')](_0x34caac)[_0x5ae5('0x1f')](_0x1e84b1);}};}function respondWithFilteredResult(_0x412521,_0x4210e5){return function(_0x3d0f71){if(_0x3d0f71){var _0x1a3ef3=typeof _0x4210e5[_0x5ae5('0x20')]===_0x5ae5('0x21')&&typeof _0x4210e5[_0x5ae5('0x22')]===_0x5ae5('0x21');var _0x3e81a3=_0x3d0f71[_0x5ae5('0x23')];var _0x16212e=_0x1a3ef3?0x0:_0x4210e5[_0x5ae5('0x20')];var _0x3a2f05=_0x1a3ef3?_0x3d0f71['count']:_0x4210e5[_0x5ae5('0x20')]+_0x4210e5[_0x5ae5('0x22')];var _0x1523c5;if(_0x3a2f05>=_0x3e81a3){_0x3a2f05=_0x3e81a3;_0x1523c5=0xc8;}else{_0x1523c5=0xce;}_0x412521['status'](_0x1523c5);return _0x412521['set']('Content-Range',_0x16212e+'-'+_0x3a2f05+'/'+_0x3e81a3)[_0x5ae5('0x1f')](_0x3d0f71);}return null;};}function patchUpdates(_0x49a362){return function(_0x4631a0){try{jsonpatch[_0x5ae5('0x24')](_0x4631a0,_0x49a362,!![]);}catch(_0x41bf50){return BPromise[_0x5ae5('0x25')](_0x41bf50);}return _0x4631a0[_0x5ae5('0x26')]();};}function saveUpdates(_0x3dcbd5,_0x475f7f){return function(_0x432eab){if(_0x432eab){return _0x432eab[_0x5ae5('0x27')](_0x3dcbd5)[_0x5ae5('0x28')](function(_0xef81f4){return _0xef81f4;});}return null;};}function removeEntity(_0x13c511,_0x5d3aaa){return function(_0x14aada){if(_0x14aada){return _0x14aada[_0x5ae5('0x29')]()[_0x5ae5('0x28')](function(){_0x13c511[_0x5ae5('0x1d')](0xcc)[_0x5ae5('0x1e')]();});}};}function handleEntityNotFound(_0x1d6d14,_0x1aff98){return function(_0x548414){if(!_0x548414){_0x1d6d14[_0x5ae5('0x1c')](0x194);}return _0x548414;};}function handleError(_0x337659,_0x3d5daf){_0x3d5daf=_0x3d5daf||0x1f4;return function(_0xdc0696){logger['error'](_0xdc0696[_0x5ae5('0x2a')]);if(_0xdc0696[_0x5ae5('0x2b')]){delete _0xdc0696[_0x5ae5('0x2b')];}_0x337659[_0x5ae5('0x1d')](_0x3d5daf)['send'](_0xdc0696);};}var utilLicense=require(_0x5ae5('0x1a'));exports[_0x5ae5('0x2c')]=function(_0xaaacd6,_0x418872){var _0x501dd9={'raw':!![],'where':{'id':0x1}},_0x23d972={};_0x23d972['model']=_['keys'](db[_0x5ae5('0x2d')][_0x5ae5('0x2e')]);_0x23d972[_0x5ae5('0x2f')]=_[_0x5ae5('0x30')](_0xaaacd6[_0x5ae5('0x2f')]);_0x23d972[_0x5ae5('0x31')]=_[_0x5ae5('0x32')](_0x23d972['model'],_0x23d972[_0x5ae5('0x2f')]);_0x501dd9[_0x5ae5('0x33')]=_[_0x5ae5('0x32')](_0x23d972[_0x5ae5('0x34')],qs[_0x5ae5('0x35')](_0xaaacd6[_0x5ae5('0x2f')][_0x5ae5('0x35')]));_0x501dd9[_0x5ae5('0x33')]=_0x501dd9['attributes'][_0x5ae5('0x36')]?_0x501dd9[_0x5ae5('0x33')]:_0x23d972[_0x5ae5('0x34')];_0x501dd9=_[_0x5ae5('0x37')]({},_0x501dd9,_0xaaacd6[_0x5ae5('0x38')]);return utilLicense[_0x5ae5('0x39')](_0x501dd9)[_0x5ae5('0x28')](respondWithResult(_0x418872,null))[_0x5ae5('0x3a')](handleError(_0x418872,null));};exports[_0x5ae5('0x27')]=function(_0x263c1d,_0x2d90be){if(_0x263c1d['body']['id']){delete _0x263c1d['body']['id'];}return db[_0x5ae5('0x2d')][_0x5ae5('0x3b')]({'where':{'id':_0x263c1d[_0x5ae5('0x3c')]['id']}})['then'](handleEntityNotFound(_0x2d90be,null))[_0x5ae5('0x28')](function(_0x4f21e4){var _0x55e44d=_0x4f21e4[_0x5ae5('0x3d')]({'plain':!![]});return utilLicense[_0x5ae5('0x3e')](_0x55e44d,_0x263c1d['body'][_0x5ae5('0x3f')]);})[_0x5ae5('0x28')](function(_0x4c68ff){if(!_0x4c68ff[_0x5ae5('0x40')]){return saveUpdates(_0x263c1d[_0x5ae5('0x41')],null);}return _0x4c68ff;})[_0x5ae5('0x28')](respondWithResult(_0x2d90be,null))[_0x5ae5('0x3a')](handleError(_0x2d90be,null));};exports[_0x5ae5('0x42')]=function(_0x5796cd,_0x1cfb91){var _0x55fda1='license-info.log';var _0x55e073=path[_0x5ae5('0x43')]('/var','log',_0x5ae5('0x44'),_0x55fda1);_0x1cfb91['setHeader'](_0x5ae5('0x45'),_0x5ae5('0x46')+_0x55fda1);_0x1cfb91[_0x5ae5('0x47')](_0x5ae5('0x48'),'text/plain');_0x1cfb91[_0x5ae5('0x49')](_0x55e073);}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index c18577e..f3f188c 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 _0x7a6f=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./license.attributes','exports','define','License','license','lodash'];(function(_0x306bbe,_0x3b846f){var _0x871a9c=function(_0x1568ff){while(--_0x1568ff){_0x306bbe['push'](_0x306bbe['shift']());}};_0x871a9c(++_0x3b846f);}(_0x7a6f,0x1e0));var _0xf7a6=function(_0x1bde82,_0x38452e){_0x1bde82=_0x1bde82-0x0;var _0x4ca54d=_0x7a6f[_0x1bde82];return _0x4ca54d;};'use strict';var _=require(_0xf7a6('0x0'));var util=require('util');var logger=require(_0xf7a6('0x1'))(_0xf7a6('0x2'));var moment=require(_0xf7a6('0x3'));var BPromise=require('bluebird');var rp=require(_0xf7a6('0x4'));var fs=require('fs');var path=require(_0xf7a6('0x5'));var rimraf=require(_0xf7a6('0x6'));var config=require(_0xf7a6('0x7'));var attributes=require(_0xf7a6('0x8'));module[_0xf7a6('0x9')]=function(_0x5a7ff1,_0x2d6bca){return _0x5a7ff1[_0xf7a6('0xa')](_0xf7a6('0xb'),attributes,{'tableName':_0xf7a6('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2faa=['moment','bluebird','../../config/environment','./license.attributes','exports','define','License','license','../../config/logger'];(function(_0x4c17e4,_0x1e084b){var _0xf53abe=function(_0x399fb6){while(--_0x399fb6){_0x4c17e4['push'](_0x4c17e4['shift']());}};_0xf53abe(++_0x1e084b);}(_0x2faa,0xfb));var _0xa2fa=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x2faa[_0x3ab51d];return _0x29a04e;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xa2fa('0x0'))('api');var moment=require(_0xa2fa('0x1'));var BPromise=require(_0xa2fa('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xa2fa('0x3'));var attributes=require(_0xa2fa('0x4'));module[_0xa2fa('0x5')]=function(_0x13f773,_0x2b1671){return _0x13f773[_0xa2fa('0x6')](_0xa2fa('0x7'),attributes,{'tableName':_0xa2fa('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/license/license.rpc.js b/server/api/license/license.rpc.js index 02daa9b..9467e59 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 _0x06ef=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','License,\x20%s,\x20%s','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util'];(function(_0x74745d,_0x177606){var _0x174ab3=function(_0x1c94e9){while(--_0x1c94e9){_0x74745d['push'](_0x74745d['shift']());}};_0x174ab3(++_0x177606);}(_0x06ef,0x12a));var _0xf06e=function(_0x52a073,_0x225c33){_0x52a073=_0x52a073-0x0;var _0x14c817=_0x06ef[_0x52a073];return _0x14c817;};'use strict';var _=require(_0xf06e('0x0'));var util=require(_0xf06e('0x1'));var moment=require(_0xf06e('0x2'));var BPromise=require(_0xf06e('0x3'));var rs=require(_0xf06e('0x4'));var fs=require('fs');var Redis=require(_0xf06e('0x5'));var db=require(_0xf06e('0x6'))['db'];var utils=require(_0xf06e('0x7'));var logger=require(_0xf06e('0x8'))(_0xf06e('0x9'));var config=require('../../config/environment');var jayson=require(_0xf06e('0xa'));var client=jayson[_0xf06e('0xb')][_0xf06e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3407d1,_0x509fda,_0x416ab0){return new BPromise(function(_0xbf87ae,_0x4f7f54){return client['request'](_0x3407d1,_0x416ab0)[_0xf06e('0xd')](function(_0x1ab5d4){logger[_0xf06e('0xe')](_0xf06e('0xf'),_0x509fda,_0xf06e('0x10'));logger[_0xf06e('0x11')](_0xf06e('0x12'),_0x509fda,_0xf06e('0x10'),JSON[_0xf06e('0x13')](_0x1ab5d4));if(_0x1ab5d4[_0xf06e('0x14')]){if(_0x1ab5d4[_0xf06e('0x14')][_0xf06e('0x15')]===0x1f4){logger[_0xf06e('0x14')](_0xf06e('0xf'),_0x509fda,_0x1ab5d4['error'][_0xf06e('0x16')]);return _0x4f7f54(_0x1ab5d4[_0xf06e('0x14')]['message']);}logger[_0xf06e('0x14')](_0xf06e('0xf'),_0x509fda,_0x1ab5d4[_0xf06e('0x14')][_0xf06e('0x16')]);return _0xbf87ae(_0x1ab5d4[_0xf06e('0x14')][_0xf06e('0x16')]);}else{logger[_0xf06e('0xe')](_0xf06e('0xf'),_0x509fda,_0xf06e('0x10'));_0xbf87ae(_0x1ab5d4[_0xf06e('0x17')][_0xf06e('0x16')]);}})[_0xf06e('0x18')](function(_0x13c0d5){logger[_0xf06e('0x14')](_0xf06e('0xf'),_0x509fda,_0x13c0d5);_0x4f7f54(_0x13c0d5);});});} \ No newline at end of file +var _0xf26c=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','info','License,\x20%s,\x20%s','request\x20sent','License,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util'];(function(_0x418504,_0x39fdd6){var _0x150f05=function(_0x391f9a){while(--_0x391f9a){_0x418504['push'](_0x418504['shift']());}};_0x150f05(++_0x39fdd6);}(_0xf26c,0x14e));var _0xcf26=function(_0x2d90ac,_0x2bf19c){_0x2d90ac=_0x2d90ac-0x0;var _0x4a2f53=_0xf26c[_0x2d90ac];return _0x4a2f53;};'use strict';var _=require(_0xcf26('0x0'));var util=require(_0xcf26('0x1'));var moment=require(_0xcf26('0x2'));var BPromise=require(_0xcf26('0x3'));var rs=require(_0xcf26('0x4'));var fs=require('fs');var Redis=require(_0xcf26('0x5'));var db=require(_0xcf26('0x6'))['db'];var utils=require(_0xcf26('0x7'));var logger=require(_0xcf26('0x8'))(_0xcf26('0x9'));var config=require('../../config/environment');var jayson=require(_0xcf26('0xa'));var client=jayson[_0xcf26('0xb')][_0xcf26('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x15b149,_0x3344a0,_0x5424a8){return new BPromise(function(_0xb1c36d,_0x3b9bca){return client['request'](_0x15b149,_0x5424a8)['then'](function(_0x26ea93){logger[_0xcf26('0xd')](_0xcf26('0xe'),_0x3344a0,_0xcf26('0xf'));logger['debug'](_0xcf26('0x10'),_0x3344a0,_0xcf26('0xf'),JSON[_0xcf26('0x11')](_0x26ea93));if(_0x26ea93[_0xcf26('0x12')]){if(_0x26ea93['error'][_0xcf26('0x13')]===0x1f4){logger[_0xcf26('0x12')](_0xcf26('0xe'),_0x3344a0,_0x26ea93['error']['message']);return _0x3b9bca(_0x26ea93[_0xcf26('0x12')][_0xcf26('0x14')]);}logger[_0xcf26('0x12')](_0xcf26('0xe'),_0x3344a0,_0x26ea93[_0xcf26('0x12')][_0xcf26('0x14')]);return _0xb1c36d(_0x26ea93[_0xcf26('0x12')][_0xcf26('0x14')]);}else{logger[_0xcf26('0xd')](_0xcf26('0xe'),_0x3344a0,'request\x20sent');_0xb1c36d(_0x26ea93['result']['message']);}})['catch'](function(_0x22b69f){logger[_0xcf26('0x12')](_0xcf26('0xe'),_0x3344a0,_0x22b69f);_0x3b9bca(_0x22b69f);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 355263c..6eb7283 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 _0xf007=['/:id/messages','getMessages','/:id/verify','/:id/users','getAgents','post','addDisposition','addAnswer','create','addSmtp','/:id/interactions','addInteraction','addApplications','addAgents','put','/:id','update','delete','removeDispositions','removeAnswers','removeSmtp','destroy','removeAgents','multer','connect-timeout','express','Router','../../config/environment','get','isAuthenticated','index','/describe','describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getImap','/:id/out_servers','getSmtp','getInteractions','/:id/applications','getApplications'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xf007,0x1d9));var _0x7f00=function(_0x4bb94b,_0x50628a){_0x4bb94b=_0x4bb94b-0x0;var _0x36dcc6=_0xf007[_0x4bb94b];return _0x36dcc6;};'use strict';var multer=require(_0x7f00('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x7f00('0x1'));var express=require(_0x7f00('0x2'));var router=express[_0x7f00('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7f00('0x4'));var controller=require('./mailAccount.controller');router[_0x7f00('0x5')]('/',auth[_0x7f00('0x6')](),controller[_0x7f00('0x7')]);router[_0x7f00('0x5')](_0x7f00('0x8'),auth[_0x7f00('0x6')](),controller[_0x7f00('0x9')]);router[_0x7f00('0x5')]('/:id',auth['isAuthenticated'](),controller[_0x7f00('0xa')]);router[_0x7f00('0x5')](_0x7f00('0xb'),auth[_0x7f00('0x6')](),controller[_0x7f00('0xc')]);router['get'](_0x7f00('0xd'),auth[_0x7f00('0x6')](),controller[_0x7f00('0xe')]);router[_0x7f00('0x5')](_0x7f00('0xf'),auth[_0x7f00('0x6')](),controller[_0x7f00('0x10')]);router[_0x7f00('0x5')](_0x7f00('0x11'),auth[_0x7f00('0x6')](),controller[_0x7f00('0x12')]);router['get']('/:id/interactions',auth['isAuthenticated'](),controller[_0x7f00('0x13')]);router[_0x7f00('0x5')](_0x7f00('0x14'),auth[_0x7f00('0x6')](),controller[_0x7f00('0x15')]);router['get'](_0x7f00('0x16'),auth['isAuthenticated'](),controller[_0x7f00('0x17')]);router[_0x7f00('0x5')](_0x7f00('0x18'),auth['isAuthenticated'](),controller['verifySmtp']);router['get'](_0x7f00('0x19'),auth[_0x7f00('0x6')](),controller[_0x7f00('0x1a')]);router[_0x7f00('0x1b')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x7f00('0x1c')]);router[_0x7f00('0x1b')](_0x7f00('0xd'),auth[_0x7f00('0x6')](),controller[_0x7f00('0x1d')]);router[_0x7f00('0x1b')]('/',auth[_0x7f00('0x6')](),controller[_0x7f00('0x1e')]);router[_0x7f00('0x1b')]('/:id/in_servers',auth[_0x7f00('0x6')](),controller['addImap']);router[_0x7f00('0x1b')](_0x7f00('0x11'),auth[_0x7f00('0x6')](),controller[_0x7f00('0x1f')]);router['post'](_0x7f00('0x20'),auth[_0x7f00('0x6')](),controller[_0x7f00('0x21')]);router[_0x7f00('0x1b')](_0x7f00('0x14'),auth[_0x7f00('0x6')](),controller[_0x7f00('0x22')]);router['post']('/:id/send',auth['isAuthenticated'](),controller['send']);router[_0x7f00('0x1b')]('/:id/users',auth[_0x7f00('0x6')](),controller[_0x7f00('0x23')]);router[_0x7f00('0x24')](_0x7f00('0x25'),auth[_0x7f00('0x6')](),controller[_0x7f00('0x26')]);router[_0x7f00('0x27')](_0x7f00('0xb'),auth[_0x7f00('0x6')](),controller[_0x7f00('0x28')]);router['delete'](_0x7f00('0xd'),auth[_0x7f00('0x6')](),controller[_0x7f00('0x29')]);router['delete'](_0x7f00('0xf'),auth[_0x7f00('0x6')](),controller['removeImap']);router[_0x7f00('0x27')]('/:id/out_servers',auth[_0x7f00('0x6')](),controller[_0x7f00('0x2a')]);router[_0x7f00('0x27')](_0x7f00('0x25'),auth[_0x7f00('0x6')](),controller[_0x7f00('0x2b')]);router[_0x7f00('0x27')](_0x7f00('0x19'),auth[_0x7f00('0x6')](),controller[_0x7f00('0x2c')]);module['exports']=router; \ No newline at end of file +var _0x44f9=['getAgents','post','addDisposition','/:id/canned_answers','addAnswer','create','addSmtp','addInteraction','/:id/applications','/:id/send','addAgents','update','delete','removeDispositions','removeAnswers','removeSmtp','destroy','removeAgents','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','describe','/:id','isAuthenticated','/:id/dispositions','getDispositions','getAnswers','/:id/in_servers','getImap','/:id/out_servers','getInteractions','getApplications','/:id/messages','getMessages','verifySmtp','/:id/users'];(function(_0x2353fe,_0x4b0bca){var _0x4d43f6=function(_0x5d0bd9){while(--_0x5d0bd9){_0x2353fe['push'](_0x2353fe['shift']());}};_0x4d43f6(++_0x4b0bca);}(_0x44f9,0x6b));var _0x944f=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0x44f9[_0x3a6efd];return _0x487b9a;};'use strict';var multer=require(_0x944f('0x0'));var util=require('util');var path=require(_0x944f('0x1'));var timeout=require(_0x944f('0x2'));var express=require(_0x944f('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x944f('0x4'));var interaction=require(_0x944f('0x5'));var config=require(_0x944f('0x6'));var controller=require('./mailAccount.controller');router[_0x944f('0x7')]('/',auth['isAuthenticated'](),controller[_0x944f('0x8')]);router[_0x944f('0x7')](_0x944f('0x9'),auth['isAuthenticated'](),controller[_0x944f('0xa')]);router[_0x944f('0x7')](_0x944f('0xb'),auth[_0x944f('0xc')](),controller['show']);router[_0x944f('0x7')](_0x944f('0xd'),auth[_0x944f('0xc')](),controller[_0x944f('0xe')]);router[_0x944f('0x7')]('/:id/canned_answers',auth[_0x944f('0xc')](),controller[_0x944f('0xf')]);router[_0x944f('0x7')](_0x944f('0x10'),auth['isAuthenticated'](),controller[_0x944f('0x11')]);router[_0x944f('0x7')](_0x944f('0x12'),auth[_0x944f('0xc')](),controller['getSmtp']);router['get']('/:id/interactions',auth[_0x944f('0xc')](),controller[_0x944f('0x13')]);router[_0x944f('0x7')]('/:id/applications',auth[_0x944f('0xc')](),controller[_0x944f('0x14')]);router[_0x944f('0x7')](_0x944f('0x15'),auth['isAuthenticated'](),controller[_0x944f('0x16')]);router['get']('/:id/verify',auth['isAuthenticated'](),controller[_0x944f('0x17')]);router[_0x944f('0x7')](_0x944f('0x18'),auth[_0x944f('0xc')](),controller[_0x944f('0x19')]);router[_0x944f('0x1a')](_0x944f('0xd'),auth['isAuthenticated'](),controller[_0x944f('0x1b')]);router[_0x944f('0x1a')](_0x944f('0x1c'),auth[_0x944f('0xc')](),controller[_0x944f('0x1d')]);router['post']('/',auth[_0x944f('0xc')](),controller[_0x944f('0x1e')]);router[_0x944f('0x1a')]('/:id/in_servers',auth[_0x944f('0xc')](),controller['addImap']);router['post'](_0x944f('0x12'),auth[_0x944f('0xc')](),controller[_0x944f('0x1f')]);router['post']('/:id/interactions',auth[_0x944f('0xc')](),controller[_0x944f('0x20')]);router[_0x944f('0x1a')](_0x944f('0x21'),auth[_0x944f('0xc')](),controller['addApplications']);router[_0x944f('0x1a')](_0x944f('0x22'),auth[_0x944f('0xc')](),controller['send']);router['post'](_0x944f('0x18'),auth[_0x944f('0xc')](),controller[_0x944f('0x23')]);router['put'](_0x944f('0xb'),auth[_0x944f('0xc')](),controller[_0x944f('0x24')]);router[_0x944f('0x25')](_0x944f('0xd'),auth[_0x944f('0xc')](),controller[_0x944f('0x26')]);router[_0x944f('0x25')]('/:id/canned_answers',auth[_0x944f('0xc')](),controller[_0x944f('0x27')]);router[_0x944f('0x25')](_0x944f('0x10'),auth['isAuthenticated'](),controller['removeImap']);router[_0x944f('0x25')](_0x944f('0x12'),auth['isAuthenticated'](),controller[_0x944f('0x28')]);router[_0x944f('0x25')](_0x944f('0xb'),auth[_0x944f('0xc')](),controller[_0x944f('0x29')]);router[_0x944f('0x25')](_0x944f('0x18'),auth[_0x944f('0xc')](),controller[_0x944f('0x2a')]);module[_0x944f('0x2b')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index 4d9fb8a..0266051 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 _0xb3e7=['sequelize','exports','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','ENUM','hotmail','yahoo','outlook365','getDataValue','provider','custom'];(function(_0x4ed1d4,_0x512d9a){var _0x28e363=function(_0x2bdfb7){while(--_0x2bdfb7){_0x4ed1d4['push'](_0x4ed1d4['shift']());}};_0x28e363(++_0x512d9a);}(_0xb3e7,0x165));var _0x7b3e=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0xb3e7[_0xdea41a];return _0x15d0d8;};'use strict';var Sequelize=require(_0x7b3e('0x0'));module[_0x7b3e('0x1')]={'description':{'type':Sequelize[_0x7b3e('0x2')]},'name':{'type':Sequelize['STRING'],'allowNull':![]},'service':{'type':Sequelize[_0x7b3e('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x7b3e('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x7b3e('0x3')],'defaultValue':!![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'template':{'type':Sequelize[_0x7b3e('0x4')]},'markAsUnread':{'type':Sequelize[_0x7b3e('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x7b3e('0x2')],'allowNull':![],'defaultValue':_0x7b3e('0x5')},'fontSize':{'type':Sequelize[_0x7b3e('0x6')](0x2)[_0x7b3e('0x7')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x7b3e('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[_0x7b3e('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x7b3e('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x7b3e('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x7b3e('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x7b3e('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x7b3e('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x7b3e('0x6')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x7b3e('0x3')],'defaultValue':![],'comment':_0x7b3e('0x8'),'set':function(_0x2d902b){if(!_0x2d902b)this[_0x7b3e('0x9')]('mandatoryDispositionPauseId',null);this[_0x7b3e('0x9')]('mandatoryDisposition',_0x2d902b);}},'provider':{'type':Sequelize[_0x7b3e('0xa')]('gmail',_0x7b3e('0xb'),_0x7b3e('0xc'),_0x7b3e('0xd')),'defaultValue':null,'get':function(){var _0x5dbc8c=this[_0x7b3e('0xe')](_0x7b3e('0xf'));return _0x5dbc8c||_0x7b3e('0x10');},'set':function(_0x4b9229){if(_0x4b9229===_0x7b3e('0x10')){_0x4b9229=null;}return this[_0x7b3e('0x9')](_0x7b3e('0xf'),_0x4b9229);}}}; \ No newline at end of file +var _0xab15=['setDataValue','mandatoryDispositionPauseId','ENUM','gmail','hotmail','outlook365','provider','custom','sequelize','exports','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue'];(function(_0x3f9e5e,_0x3149e1){var _0x4ef4fa=function(_0x2f8e59){while(--_0x2f8e59){_0x3f9e5e['push'](_0x3f9e5e['shift']());}};_0x4ef4fa(++_0x3149e1);}(_0xab15,0xbc));var _0x5ab1=function(_0x3409aa,_0x2f06f7){_0x3409aa=_0x3409aa-0x0;var _0x4ad1a3=_0xab15[_0x3409aa];return _0x4ad1a3;};'use strict';var Sequelize=require(_0x5ab1('0x0'));module[_0x5ab1('0x1')]={'description':{'type':Sequelize[_0x5ab1('0x2')]},'name':{'type':Sequelize[_0x5ab1('0x2')],'allowNull':![]},'service':{'type':Sequelize[_0x5ab1('0x3')],'defaultValue':![]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x5ab1('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0x5ab1('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0x5ab1('0x4')]},'markAsUnread':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fontFamily':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x5ab1('0x5')},'fontSize':{'type':Sequelize[_0x5ab1('0x6')](0x2)[_0x5ab1('0x7')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x5ab1('0x4')],'defaultValue':function(){return _0x5ab1('0x8');}},'notificationSound':{'type':Sequelize[_0x5ab1('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x5ab1('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x5ab1('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x5ab1('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x5ab1('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x5ab1('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x5ab1('0x6')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x5ab1('0x9'),'set':function(_0x68502f){if(!_0x68502f)this[_0x5ab1('0xa')](_0x5ab1('0xb'),null);this['setDataValue']('mandatoryDisposition',_0x68502f);}},'provider':{'type':Sequelize[_0x5ab1('0xc')](_0x5ab1('0xd'),_0x5ab1('0xe'),'yahoo',_0x5ab1('0xf')),'defaultValue':null,'get':function(){var _0x2038d4=this['getDataValue'](_0x5ab1('0x10'));return _0x2038d4||'custom';},'set':function(_0x1e0b41){if(_0x1e0b41===_0x5ab1('0x11')){_0x1e0b41=null;}return this['setDataValue'](_0x5ab1('0x10'),_0x1e0b41);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index ae30eab..9812610 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 _0xe733=['getSmtp','addSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','Contact','User','Owner','fullname','internal','Tag','Tags','color','tag','addApplications','sequelize','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','findAndCountAll','priority','finally','getApplications','getMessages','MailMessage','$gte','format','YYYY-MM-DD\x20HH:mm:ss','CmList','CmContact','Contacts','updatedAt','DESC','CloudProvider','Smtp\x20configuration\x20not\x20found','%s\x20<%s>','email','attachments','join','root','server/files/attachments','getSmtpOptions','SendMail','List','List\x20not\x20found','messageId','from','subject','out','Interaction','Messages','verifySmtp','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','omit','spread','emit','isArray','getAgents','moment','bluebird','path','lodash','juice','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','defaults','redis','localhost','socket.io-emitter','./mailAccount.socket','register','http','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','update','destroy','MailAccounts','UserProfileResource','stack','name','send','imap.gmail.com','yahoo','imap.mail.yahoo.com','imap-mail.outlook.com','outlook365','Unknown\x20email\x20service\x20provider','gmail','smtp.gmail.com','smtp.mail.yahoo.com','hotmail','user','password','pass','CloudProviderId','host','port','service','authentication','Imap','Smtp','MailServerIn','MailServerOut','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','filter','VIRTUAL','merge','options','MailAccount','includeAll','include','findAll','rows','params','find','body','provider','secure','Mail\x20Account\x20not\x20found','describe','addDisposition','MailAccountId','create','getDispositions','findOne','nolimit','pick','Disposition','removeDispositions','ids','CannedAnswer','removeAnswers','custom','ListId','isNil','active','description','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','setImap'];(function(_0x344539,_0x564660){var _0x268ad8=function(_0x57aafa){while(--_0x57aafa){_0x344539['push'](_0x344539['shift']());}};_0x268ad8(++_0x564660);}(_0xe733,0x1b7));var _0x3e73=function(_0x4fc4c5,_0x58cefa){_0x4fc4c5=_0x4fc4c5-0x0;var _0x35873c=_0xe733[_0x4fc4c5];return _0x35873c;};'use strict';var moment=require(_0x3e73('0x0'));var BPromise=require(_0x3e73('0x1'));var util=require('util');var path=require(_0x3e73('0x2'));var _=require(_0x3e73('0x3'));var juice=require(_0x3e73('0x4'));var Redis=require(_0x3e73('0x5'));var qs=require(_0x3e73('0x6'));var logger=require(_0x3e73('0x7'))('api');var config=require(_0x3e73('0x8'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x3e73('0x9')](config[_0x3e73('0xa')],{'host':_0x3e73('0xb'),'port':0x18eb});var socket=require(_0x3e73('0xc'))(new Redis(config[_0x3e73('0xa')]));require(_0x3e73('0xd'))[_0x3e73('0xe')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x3e73('0xf')]({'port':0x232b});function respondWithRpcPromise(_0x4da14f,_0x283069,_0x2f5a11,_0x4f6d6f){return new BPromise(function(_0x18d3b2,_0x339ec6){var _0x4bcb61=_0x4f6d6f||client;return _0x4bcb61[_0x3e73('0x10')](_0x4da14f,_0x2f5a11)[_0x3e73('0x11')](function(_0x2e02bc){logger[_0x3e73('0x12')](_0x3e73('0x13'),_0x283069,_0x3e73('0x14'));logger[_0x3e73('0x15')](_0x3e73('0x16'),_0x283069,_0x3e73('0x14'),JSON[_0x3e73('0x17')](_0x2e02bc));if(_0x2e02bc[_0x3e73('0x18')]){if(_0x2e02bc[_0x3e73('0x18')][_0x3e73('0x19')]===0x1f4){logger[_0x3e73('0x18')](_0x3e73('0x13'),_0x283069,_0x2e02bc['error'][_0x3e73('0x1a')]);return _0x339ec6(_0x2e02bc['error'][_0x3e73('0x1a')]);}logger[_0x3e73('0x18')](_0x3e73('0x13'),_0x283069,_0x2e02bc['error']['message']);return _0x18d3b2(_0x2e02bc[_0x3e73('0x18')][_0x3e73('0x1a')]);}else{logger[_0x3e73('0x12')]('MailAccount,\x20%s,\x20%s',_0x283069,_0x3e73('0x14'));_0x18d3b2(_0x2e02bc['result'][_0x3e73('0x1a')]);}})[_0x3e73('0x1b')](function(_0x1bd384){logger[_0x3e73('0x18')]('MailAccount,\x20%s,\x20%s',_0x283069,_0x1bd384);_0x339ec6(_0x1bd384);});});}function respondWithStatusCode(_0x24b9e3,_0x30bbff){_0x30bbff=_0x30bbff||0xcc;return function(_0x3cbe62){if(_0x3cbe62){return _0x24b9e3[_0x3e73('0x1c')](_0x30bbff);}return _0x24b9e3[_0x3e73('0x1d')](_0x30bbff)[_0x3e73('0x1e')]();};}function respondWithResult(_0x39122e,_0x302ce8){_0x302ce8=_0x302ce8||0xc8;return function(_0x3581cc){if(_0x3581cc){return _0x39122e[_0x3e73('0x1d')](_0x302ce8)[_0x3e73('0x1f')](_0x3581cc);}};}function respondWithFilteredResult(_0x2a8763,_0x37acd8){return function(_0x15069a){if(_0x15069a){var _0xe8aa95=typeof _0x37acd8[_0x3e73('0x20')]===_0x3e73('0x21')&&typeof _0x37acd8[_0x3e73('0x22')]===_0x3e73('0x21');var _0x14593a=_0x15069a['count'];var _0x10be35=_0xe8aa95?0x0:_0x37acd8[_0x3e73('0x20')];var _0x5493c5=_0xe8aa95?_0x15069a[_0x3e73('0x23')]:_0x37acd8[_0x3e73('0x20')]+_0x37acd8['limit'];var _0x3ad559;if(_0x5493c5>=_0x14593a){_0x5493c5=_0x14593a;_0x3ad559=0xc8;}else{_0x3ad559=0xce;}_0x2a8763[_0x3e73('0x1d')](_0x3ad559);return _0x2a8763[_0x3e73('0x24')]('Content-Range',_0x10be35+'-'+_0x5493c5+'/'+_0x14593a)[_0x3e73('0x1f')](_0x15069a);}return null;};}function saveUpdates(_0x4736){return function(_0x235ec3){if(_0x235ec3){return _0x235ec3[_0x3e73('0x25')](_0x4736)['then'](function(_0x6ef1da){return _0x6ef1da;});}return null;};}function removeEntity(_0x123a2e){return function(_0x126a2c){if(_0x126a2c){return _0x126a2c[_0x3e73('0x26')]()['then'](function(){var _0x2431bc=_0x126a2c['get']({'plain':!![]});var _0x4a8670=_0x3e73('0x27');return db[_0x3e73('0x28')][_0x3e73('0x26')]({'where':{'type':_0x4a8670,'resourceId':_0x2431bc['id']}})[_0x3e73('0x11')](function(){return _0x126a2c;});})[_0x3e73('0x11')](function(){_0x123a2e[_0x3e73('0x1d')](0xcc)[_0x3e73('0x1e')]();});}};}function handleEntityNotFound(_0x53c1a4){return function(_0x1db2f4){if(!_0x1db2f4){_0x53c1a4[_0x3e73('0x1c')](0x194);}return _0x1db2f4;};}function handleError(_0x34caed,_0x3a820f){_0x3a820f=_0x3a820f||0x1f4;return function(_0x38993c){logger[_0x3e73('0x18')](_0x38993c[_0x3e73('0x29')]);if(_0x38993c['name']){delete _0x38993c[_0x3e73('0x2a')];}_0x34caed[_0x3e73('0x1d')](_0x3a820f)[_0x3e73('0x2b')](_0x38993c);};}function getImapHost(_0x273438){switch(_0x273438){case'gmail':return _0x3e73('0x2c');case _0x3e73('0x2d'):return _0x3e73('0x2e');case'hotmail':return _0x3e73('0x2f');case _0x3e73('0x30'):return'outlook.office365.com';}throw new Error(_0x3e73('0x31'),_0x273438);}function getSmtpHost(_0x11a210){switch(_0x11a210){case _0x3e73('0x32'):return _0x3e73('0x33');case _0x3e73('0x2d'):return _0x3e73('0x34');case _0x3e73('0x35'):return'smtp-mail.outlook.com';case'outlook365':return'smtp.office365.com';}throw new Error(_0x3e73('0x31'),_0x11a210);}function getAuthenticationOptions(_0x4e540c,_0x253576){var _0x52f163={};var _0x3569ad={};if(_0x4e540c){_0x52f163['user']=_0x3569ad[_0x3e73('0x36')]=_0x253576['username'];_0x52f163[_0x3e73('0x37')]=_0x3569ad[_0x3e73('0x38')]=_0x253576['password'];if(_0x253576['modernAuthentication']){_0x52f163['modernAuthentication']=_0x3569ad['modernAuthentication']=!![];_0x52f163[_0x3e73('0x39')]=_0x3569ad['CloudProviderId']=_0x253576[_0x3e73('0x39')];_0x52f163[_0x3e73('0x37')]=_0x3569ad[_0x3e73('0x38')]=null;}else{_0x52f163[_0x3e73('0x39')]=_0x3569ad[_0x3e73('0x39')]=null;}_0x52f163[_0x3e73('0x3a')]=getImapHost(_0x4e540c);_0x52f163['port']=0x3e1;_0x3569ad[_0x3e73('0x3a')]=getSmtpHost(_0x4e540c);_0x3569ad[_0x3e73('0x3b')]=0x24b;_0x3569ad['secure']=![];_0x52f163[_0x3e73('0x3c')]=_0x3569ad['service']=null;}else{if(_0x253576[_0x3e73('0x3d')]){_0x52f163[_0x3e73('0x36')]=_0x3569ad[_0x3e73('0x36')]=_0x253576['username'];_0x52f163[_0x3e73('0x37')]=_0x3569ad[_0x3e73('0x38')]=_0x253576[_0x3e73('0x37')];}else{_0x52f163[_0x3e73('0x3d')]=_0x3569ad['authentication']=![];_0x52f163['user']=_0x3569ad[_0x3e73('0x36')]=null;_0x52f163[_0x3e73('0x37')]=_0x3569ad[_0x3e73('0x38')]=null;}_0x52f163[_0x3e73('0x3a')]=_0x253576[_0x3e73('0x3e')]['host'];_0x52f163[_0x3e73('0x3b')]=_0x253576['Imap'][_0x3e73('0x3b')];_0x3569ad[_0x3e73('0x3a')]=_0x253576[_0x3e73('0x3f')]['host'];_0x3569ad['port']=_0x253576[_0x3e73('0x3f')]['port'];}return{'Imap':_0x52f163,'Smtp':_0x3569ad};}exports['index']=function(_0x2f2267,_0x347dde){var _0x2b8e3d={'include':[{'model':db[_0x3e73('0x40')],'as':_0x3e73('0x3e')},{'model':db[_0x3e73('0x41')],'as':_0x3e73('0x3f')},{'model':db[_0x3e73('0x42')],'as':_0x3e73('0x43')}]},_0x50cb43={},_0x5b0479={'count':0x0,'rows':[]};var _0x306fb4=_[_0x3e73('0x44')](db['MailAccount'][_0x3e73('0x45')],function(_0x131b1d){return{'name':_0x131b1d[_0x3e73('0x46')],'type':_0x131b1d[_0x3e73('0x47')][_0x3e73('0x48')]};});_0x50cb43[_0x3e73('0x49')]=_[_0x3e73('0x44')](_0x306fb4,'name');_0x50cb43[_0x3e73('0x4a')]=_[_0x3e73('0x4b')](_0x2f2267['query']);_0x50cb43['filters']=_[_0x3e73('0x4c')](_0x50cb43[_0x3e73('0x49')],_0x50cb43[_0x3e73('0x4a')]);_0x2b8e3d[_0x3e73('0x4d')]=_['intersection'](_0x50cb43[_0x3e73('0x49')],qs[_0x3e73('0x4e')](_0x2f2267[_0x3e73('0x4a')][_0x3e73('0x4e')]));_0x2b8e3d['attributes']=_0x2b8e3d[_0x3e73('0x4d')][_0x3e73('0x4f')]?_0x2b8e3d[_0x3e73('0x4d')]:_0x50cb43[_0x3e73('0x49')];if(!_0x2f2267[_0x3e73('0x4a')][_0x3e73('0x50')]('nolimit')){_0x2b8e3d[_0x3e73('0x22')]=qs[_0x3e73('0x22')](_0x2f2267['query'][_0x3e73('0x22')]);_0x2b8e3d[_0x3e73('0x20')]=qs[_0x3e73('0x20')](_0x2f2267[_0x3e73('0x4a')]['offset']);}_0x2b8e3d[_0x3e73('0x51')]=qs[_0x3e73('0x52')](_0x2f2267[_0x3e73('0x4a')]['sort']);_0x2b8e3d[_0x3e73('0x53')]=qs['filters'](_['pick'](_0x2f2267[_0x3e73('0x4a')],_0x50cb43[_0x3e73('0x54')]),_0x306fb4);if(_0x2f2267[_0x3e73('0x4a')][_0x3e73('0x55')]){_0x2b8e3d[_0x3e73('0x53')]=_['merge'](_0x2b8e3d['where'],{'$or':_[_0x3e73('0x44')](_0x306fb4,function(_0x412bf2){if(_0x412bf2[_0x3e73('0x47')]!==_0x3e73('0x56')){var _0x963612={};_0x963612[_0x412bf2[_0x3e73('0x2a')]]={'$like':'%'+_0x2f2267['query'][_0x3e73('0x55')]+'%'};return _0x963612;}})});}_0x2b8e3d=_[_0x3e73('0x57')]({},_0x2b8e3d,_0x2f2267[_0x3e73('0x58')]);var _0x52f9c9={'where':_0x2b8e3d[_0x3e73('0x53')]};return db[_0x3e73('0x59')]['count'](_0x52f9c9)[_0x3e73('0x11')](function(_0x2a843e){_0x5b0479[_0x3e73('0x23')]=_0x2a843e;if(_0x2f2267[_0x3e73('0x4a')][_0x3e73('0x5a')]){_0x2b8e3d[_0x3e73('0x5b')]=[{'all':!![]}];}return db[_0x3e73('0x59')][_0x3e73('0x5c')](_0x2b8e3d);})[_0x3e73('0x11')](function(_0x2a3324){_0x5b0479[_0x3e73('0x5d')]=_0x2a3324;return _0x5b0479;})[_0x3e73('0x11')](respondWithFilteredResult(_0x347dde,_0x2b8e3d))[_0x3e73('0x1b')](handleError(_0x347dde,null));};exports['show']=function(_0xee1ea9,_0x45068a){var _0x140109={'raw':![],'where':{'id':_0xee1ea9[_0x3e73('0x5e')]['id']},'include':[{'model':db['MailServerIn'],'as':_0x3e73('0x3e')},{'model':db[_0x3e73('0x41')],'as':_0x3e73('0x3f')},{'model':db[_0x3e73('0x42')],'as':'mandatoryDispositionPause'}]},_0x22e5fd={};_0x22e5fd[_0x3e73('0x49')]=_['keys'](db['MailAccount'][_0x3e73('0x45')]);_0x22e5fd[_0x3e73('0x4a')]=_[_0x3e73('0x4b')](_0xee1ea9[_0x3e73('0x4a')]);_0x22e5fd['filters']=_[_0x3e73('0x4c')](_0x22e5fd[_0x3e73('0x49')],_0x22e5fd['query']);_0x140109[_0x3e73('0x4d')]=_[_0x3e73('0x4c')](_0x22e5fd[_0x3e73('0x49')],qs[_0x3e73('0x4e')](_0xee1ea9[_0x3e73('0x4a')]['fields']));_0x140109[_0x3e73('0x4d')]=_0x140109['attributes'][_0x3e73('0x4f')]?_0x140109[_0x3e73('0x4d')]:_0x22e5fd[_0x3e73('0x49')];if(_0xee1ea9[_0x3e73('0x4a')]['includeAll']){_0x140109['include']=[{'all':!![]}];}_0x140109=_[_0x3e73('0x57')]({},_0x140109,_0xee1ea9['options']);return db['MailAccount'][_0x3e73('0x5f')](_0x140109)[_0x3e73('0x11')](handleEntityNotFound(_0x45068a,null))[_0x3e73('0x11')](respondWithResult(_0x45068a,null))[_0x3e73('0x1b')](handleError(_0x45068a,null));};exports['update']=function(_0x4807bc,_0x5252d9){if(_0x4807bc[_0x3e73('0x60')]['id']){delete _0x4807bc[_0x3e73('0x60')]['id'];}var _0xa577af=_0x4807bc[_0x3e73('0x60')]['provider']==='custom'?null:_0x4807bc['body'][_0x3e73('0x61')];var _0x18b384=_0x4807bc[_0x3e73('0x60')][_0x3e73('0x3e')]||{};var _0x1b34e5=_0x4807bc['body'][_0x3e73('0x3f')]||{};if(_0xa577af){_0x18b384[_0x3e73('0x3a')]=getImapHost(_0xa577af);_0x18b384[_0x3e73('0x3b')]=0x3e1;_0x1b34e5[_0x3e73('0x3a')]=getSmtpHost(_0xa577af);_0x1b34e5[_0x3e73('0x3b')]=0x24b;_0x1b34e5[_0x3e73('0x62')]=![];}if(_0x1b34e5['modernAuthentication']){_0x1b34e5['secure']=![];}else{_0x1b34e5[_0x3e73('0x39')]=null;}if(!_0x18b384['modernAuthentication'])_0x18b384['CloudProviderId']=null;_0x4807bc[_0x3e73('0x60')][_0x3e73('0x3e')]=_0x18b384;_0x4807bc[_0x3e73('0x60')][_0x3e73('0x3f')]=_0x1b34e5;return db['MailAccount'][_0x3e73('0x5f')]({'where':{'id':_0x4807bc[_0x3e73('0x5e')]['id']},'include':[{'model':db['MailServerIn'],'as':_0x3e73('0x3e')},{'model':db[_0x3e73('0x41')],'as':_0x3e73('0x3f')},{'model':db[_0x3e73('0x42')],'as':_0x3e73('0x43')}]})[_0x3e73('0x11')](handleEntityNotFound(_0x5252d9,null))[_0x3e73('0x11')](function(_0x2077eb){if(!_0x2077eb)throw new Error(_0x3e73('0x63'));if(_0x2077eb[_0x3e73('0x3c')])delete _0x4807bc[_0x3e73('0x60')]['Imap'];return _0x2077eb;})[_0x3e73('0x11')](saveUpdates(_0x4807bc[_0x3e73('0x60')],null))[_0x3e73('0x11')](function(_0x408f17){if(!_0x4807bc['body'][_0x3e73('0x3e')])return _0x408f17;return db[_0x3e73('0x40')][_0x3e73('0x25')](_0x4807bc['body'][_0x3e73('0x3e')],{'where':{'MailAccountId':_0x408f17['id']}})[_0x3e73('0x11')](function(){return _0x408f17;});})['then'](function(_0x42ef03){if(!_0x4807bc['body']['Smtp'])return _0x42ef03;return db[_0x3e73('0x41')][_0x3e73('0x25')](_0x4807bc['body']['Smtp'],{'where':{'MailAccountId':_0x42ef03['id']}})[_0x3e73('0x11')](function(){return _0x42ef03;});})[_0x3e73('0x11')](respondWithResult(_0x5252d9,null))[_0x3e73('0x1b')](handleError(_0x5252d9,null));};exports[_0x3e73('0x64')]=function(_0x2e6463,_0xdb1c7d){return db[_0x3e73('0x59')]['describe']()['then'](respondWithResult(_0xdb1c7d,null))['catch'](handleError(_0xdb1c7d,null));};exports[_0x3e73('0x65')]=function(_0x23f85e,_0x3ebcc9){if(_0x23f85e['body']['id']){delete _0x23f85e['body']['id'];}return db['MailAccount'][_0x3e73('0x5f')]({'where':{'id':_0x23f85e['params']['id']}})[_0x3e73('0x11')](handleEntityNotFound(_0x3ebcc9,null))[_0x3e73('0x11')](function(_0x47e3a2){if(_0x47e3a2){_0x23f85e[_0x3e73('0x60')][_0x3e73('0x66')]=_0x47e3a2['id'];return db['Disposition'][_0x3e73('0x67')](_0x23f85e[_0x3e73('0x60')]);}})[_0x3e73('0x11')](respondWithResult(_0x3ebcc9,null))['catch'](handleError(_0x3ebcc9,null));};exports[_0x3e73('0x68')]=function(_0x5cf7c5,_0x17c1d1){var _0x3cf2bf={'raw':![],'where':{}};var _0x259e55={};var _0x30c23d={'count':0x0,'rows':[]};return db['MailAccount'][_0x3e73('0x69')]({'where':{'id':_0x5cf7c5['params']['id']}})[_0x3e73('0x11')](handleEntityNotFound(_0x17c1d1,null))[_0x3e73('0x11')](function(_0x39af16){if(_0x39af16){_0x259e55[_0x3e73('0x49')]=_[_0x3e73('0x4b')](db['Disposition'][_0x3e73('0x45')]);_0x259e55[_0x3e73('0x4a')]=_[_0x3e73('0x4b')](_0x5cf7c5[_0x3e73('0x4a')]);_0x259e55[_0x3e73('0x54')]=_['intersection'](_0x259e55[_0x3e73('0x49')],_0x259e55[_0x3e73('0x4a')]);_0x3cf2bf['attributes']=_['intersection'](_0x259e55['model'],qs['fields'](_0x5cf7c5[_0x3e73('0x4a')][_0x3e73('0x4e')]));_0x3cf2bf[_0x3e73('0x4d')]=_0x3cf2bf[_0x3e73('0x4d')][_0x3e73('0x4f')]?_0x3cf2bf[_0x3e73('0x4d')]:_0x259e55['model'];if(!_0x5cf7c5[_0x3e73('0x4a')]['hasOwnProperty'](_0x3e73('0x6a'))){_0x3cf2bf[_0x3e73('0x22')]=qs[_0x3e73('0x22')](_0x5cf7c5['query'][_0x3e73('0x22')]);_0x3cf2bf[_0x3e73('0x20')]=qs[_0x3e73('0x20')](_0x5cf7c5[_0x3e73('0x4a')][_0x3e73('0x20')]);}_0x3cf2bf[_0x3e73('0x51')]=qs[_0x3e73('0x52')](_0x5cf7c5[_0x3e73('0x4a')]['sort']);_0x3cf2bf['where']=qs[_0x3e73('0x54')](_[_0x3e73('0x6b')](_0x5cf7c5[_0x3e73('0x4a')],_0x259e55['filters']));_0x3cf2bf[_0x3e73('0x53')][_0x3e73('0x66')]=_0x39af16['id'];if(_0x5cf7c5['query']['filter']){_0x3cf2bf[_0x3e73('0x53')]=_[_0x3e73('0x57')](_0x3cf2bf[_0x3e73('0x53')],{'$or':_[_0x3e73('0x44')](_0x3cf2bf['attributes'],function(_0x11b9b0){var _0xc552d9={};_0xc552d9[_0x11b9b0]={'$like':'%'+_0x5cf7c5[_0x3e73('0x4a')]['filter']+'%'};return _0xc552d9;})});}_0x3cf2bf=_[_0x3e73('0x57')]({},_0x3cf2bf,_0x5cf7c5[_0x3e73('0x58')]);return db['Disposition']['count']({'where':_0x3cf2bf[_0x3e73('0x53')]})[_0x3e73('0x11')](function(_0x1b475f){_0x30c23d[_0x3e73('0x23')]=_0x1b475f;if(_0x5cf7c5[_0x3e73('0x4a')][_0x3e73('0x5a')]){_0x3cf2bf[_0x3e73('0x5b')]=[{'all':!![]}];}return db[_0x3e73('0x6c')][_0x3e73('0x5c')](_0x3cf2bf);})['then'](function(_0x49f53d){_0x30c23d[_0x3e73('0x5d')]=_0x49f53d;return _0x30c23d;});}})[_0x3e73('0x11')](respondWithFilteredResult(_0x17c1d1,_0x3cf2bf))['catch'](handleError(_0x17c1d1,null));};exports[_0x3e73('0x6d')]=function(_0x4237d3,_0x218679){return db[_0x3e73('0x59')][_0x3e73('0x5f')]({'where':{'id':_0x4237d3[_0x3e73('0x5e')]['id']}})[_0x3e73('0x11')](handleEntityNotFound(_0x218679,null))[_0x3e73('0x11')](function(_0x1bde27){if(_0x1bde27){return _0x1bde27[_0x3e73('0x6d')](_0x4237d3[_0x3e73('0x4a')][_0x3e73('0x6e')]);}})[_0x3e73('0x11')](respondWithStatusCode(_0x218679,null))[_0x3e73('0x1b')](handleError(_0x218679,null));};exports['addAnswer']=function(_0x487d0c,_0x5c0e0f){if(_0x487d0c[_0x3e73('0x60')]['id']){delete _0x487d0c[_0x3e73('0x60')]['id'];}return db[_0x3e73('0x59')][_0x3e73('0x5f')]({'where':{'id':_0x487d0c[_0x3e73('0x5e')]['id']}})['then'](handleEntityNotFound(_0x5c0e0f,null))[_0x3e73('0x11')](function(_0x2e389f){if(_0x2e389f){_0x487d0c[_0x3e73('0x60')][_0x3e73('0x66')]=_0x2e389f['id'];return db['CannedAnswer']['create'](_0x487d0c[_0x3e73('0x60')]);}})[_0x3e73('0x11')](respondWithResult(_0x5c0e0f,null))[_0x3e73('0x1b')](handleError(_0x5c0e0f,null));};exports['getAnswers']=function(_0xbe96b6,_0x525c67){var _0x2b885c={'raw':![],'where':{}};var _0x6e6d85={};var _0x1c71a7={'count':0x0,'rows':[]};return db[_0x3e73('0x59')][_0x3e73('0x69')]({'where':{'id':_0xbe96b6[_0x3e73('0x5e')]['id']}})['then'](handleEntityNotFound(_0x525c67,null))[_0x3e73('0x11')](function(_0x36a5ac){if(_0x36a5ac){_0x6e6d85['model']=_['keys'](db['CannedAnswer']['rawAttributes']);_0x6e6d85[_0x3e73('0x4a')]=_[_0x3e73('0x4b')](_0xbe96b6[_0x3e73('0x4a')]);_0x6e6d85['filters']=_[_0x3e73('0x4c')](_0x6e6d85[_0x3e73('0x49')],_0x6e6d85['query']);_0x2b885c[_0x3e73('0x4d')]=_[_0x3e73('0x4c')](_0x6e6d85[_0x3e73('0x49')],qs['fields'](_0xbe96b6['query'][_0x3e73('0x4e')]));_0x2b885c[_0x3e73('0x4d')]=_0x2b885c[_0x3e73('0x4d')]['length']?_0x2b885c[_0x3e73('0x4d')]:_0x6e6d85['model'];if(!_0xbe96b6['query'][_0x3e73('0x50')](_0x3e73('0x6a'))){_0x2b885c[_0x3e73('0x22')]=qs['limit'](_0xbe96b6['query'][_0x3e73('0x22')]);_0x2b885c[_0x3e73('0x20')]=qs[_0x3e73('0x20')](_0xbe96b6[_0x3e73('0x4a')][_0x3e73('0x20')]);}_0x2b885c['order']=qs[_0x3e73('0x52')](_0xbe96b6[_0x3e73('0x4a')]['sort']);_0x2b885c['where']=qs[_0x3e73('0x54')](_['pick'](_0xbe96b6['query'],_0x6e6d85[_0x3e73('0x54')]));_0x2b885c['where'][_0x3e73('0x66')]=_0x36a5ac['id'];if(_0xbe96b6[_0x3e73('0x4a')]['filter']){_0x2b885c[_0x3e73('0x53')]=_[_0x3e73('0x57')](_0x2b885c[_0x3e73('0x53')],{'$or':_[_0x3e73('0x44')](_0x2b885c['attributes'],function(_0x410f58){var _0x37c1bd={};_0x37c1bd[_0x410f58]={'$like':'%'+_0xbe96b6[_0x3e73('0x4a')]['filter']+'%'};return _0x37c1bd;})});}_0x2b885c=_[_0x3e73('0x57')]({},_0x2b885c,_0xbe96b6[_0x3e73('0x58')]);return db['CannedAnswer'][_0x3e73('0x23')]({'where':_0x2b885c[_0x3e73('0x53')]})[_0x3e73('0x11')](function(_0x3b1e9a){_0x1c71a7[_0x3e73('0x23')]=_0x3b1e9a;if(_0xbe96b6[_0x3e73('0x4a')][_0x3e73('0x5a')]){_0x2b885c['include']=[{'all':!![]}];}return db[_0x3e73('0x6f')][_0x3e73('0x5c')](_0x2b885c);})[_0x3e73('0x11')](function(_0x232e05){_0x1c71a7[_0x3e73('0x5d')]=_0x232e05;return _0x1c71a7;});}})[_0x3e73('0x11')](respondWithFilteredResult(_0x525c67,_0x2b885c))[_0x3e73('0x1b')](handleError(_0x525c67,null));};exports['removeAnswers']=function(_0x4f55cc,_0x48dd20){return db['MailAccount']['find']({'where':{'id':_0x4f55cc[_0x3e73('0x5e')]['id']}})[_0x3e73('0x11')](handleEntityNotFound(_0x48dd20,null))[_0x3e73('0x11')](function(_0xa979f6){if(_0xa979f6){return _0xa979f6[_0x3e73('0x70')](_0x4f55cc[_0x3e73('0x4a')]['ids']);}})[_0x3e73('0x11')](respondWithStatusCode(_0x48dd20,null))['catch'](handleError(_0x48dd20,null));};exports[_0x3e73('0x67')]=function(_0x266ca8,_0x366a98){var _0x4e9744={'name':_0x266ca8[_0x3e73('0x60')]['name'],'key':_0x266ca8['body']['key'],'provider':_0x266ca8[_0x3e73('0x60')]['provider']===_0x3e73('0x71')?null:_0x266ca8[_0x3e73('0x60')][_0x3e73('0x61')],'email':_0x266ca8[_0x3e73('0x60')]['email'],'ListId':_0x266ca8[_0x3e73('0x60')][_0x3e73('0x72')],'active':!_[_0x3e73('0x73')](_0x266ca8[_0x3e73('0x60')]['active'])?_0x266ca8[_0x3e73('0x60')][_0x3e73('0x74')]:!![],'description':_0x266ca8[_0x3e73('0x60')][_0x3e73('0x75')]||null};var _0x34fb20=getAuthenticationOptions(_0x4e9744[_0x3e73('0x61')],_0x266ca8[_0x3e73('0x60')]);_0x4e9744[_0x3e73('0x3e')]=_0x34fb20[_0x3e73('0x3e')];_0x4e9744[_0x3e73('0x3f')]=_0x34fb20[_0x3e73('0x3f')];return db[_0x3e73('0x59')][_0x3e73('0x67')](_0x4e9744,{'include':[{'model':db['MailServerOut'],'as':_0x3e73('0x3f')},{'model':db['MailServerIn'],'as':'Imap'}]})[_0x3e73('0x11')](function(_0x4fc2fc){var _0x2327b2=_0x266ca8[_0x3e73('0x36')][_0x3e73('0x76')]({'plain':!![]});if(!_0x2327b2)throw new Error(_0x3e73('0x77'));if(_0x2327b2[_0x3e73('0x78')]==='user'){var _0x2806ba=_0x4fc2fc[_0x3e73('0x76')]({'plain':!![]});return db[_0x3e73('0x79')][_0x3e73('0x5f')]({'where':{'name':_0x3e73('0x27'),'userProfileId':_0x2327b2[_0x3e73('0x7a')]},'raw':!![]})[_0x3e73('0x11')](function(_0x1e67c0){if(_0x1e67c0&&_0x1e67c0['autoAssociation']===0x0){return db[_0x3e73('0x28')]['create']({'name':_0x2806ba[_0x3e73('0x2a')],'resourceId':_0x2806ba['id'],'type':_0x1e67c0[_0x3e73('0x2a')],'sectionId':_0x1e67c0['id']},{})[_0x3e73('0x11')](function(){return _0x4fc2fc;});}else{return _0x4fc2fc;}})[_0x3e73('0x1b')](function(_0x28d74b){logger[_0x3e73('0x18')](_0x3e73('0x7b'),_0x28d74b);throw _0x28d74b;});}return _0x4fc2fc;})[_0x3e73('0x11')](respondWithResult(_0x366a98,0xc9))['catch'](handleError(_0x366a98,null));};exports[_0x3e73('0x7c')]=function(_0x3a700c,_0x5e19d8){return db[_0x3e73('0x59')]['findOne']({'where':{'id':_0x3a700c['params']['id']}})['then'](handleEntityNotFound(_0x5e19d8,null))['then'](function(_0x12b707){if(_0x12b707){return _0x12b707['getImap']();}return null;})[_0x3e73('0x11')](respondWithResult(_0x5e19d8,null))[_0x3e73('0x1b')](handleError(_0x5e19d8,null));};exports[_0x3e73('0x7d')]=function(_0x584ee3,_0x4845a8){if(_0x584ee3[_0x3e73('0x60')]['id']){delete _0x584ee3[_0x3e73('0x60')]['id'];}return db[_0x3e73('0x59')]['find']({'where':{'id':_0x584ee3[_0x3e73('0x5e')]['id']}})[_0x3e73('0x11')](handleEntityNotFound(_0x4845a8,null))[_0x3e73('0x11')](function(_0x5dc000){if(_0x5dc000){_0x584ee3[_0x3e73('0x60')]['MailAccountId']=_0x5dc000['id'];return db[_0x3e73('0x40')][_0x3e73('0x67')](_0x584ee3[_0x3e73('0x60')]);}})[_0x3e73('0x11')](respondWithResult(_0x4845a8,null))[_0x3e73('0x1b')](handleError(_0x4845a8,null));};exports[_0x3e73('0x7e')]=function(_0x46893b,_0x573458){return db[_0x3e73('0x59')][_0x3e73('0x69')]({'where':{'id':_0x46893b[_0x3e73('0x5e')]['id']}})['then'](handleEntityNotFound(_0x573458,null))[_0x3e73('0x11')](function(_0x1a218c){if(_0x1a218c){return _0x1a218c[_0x3e73('0x7f')](null);}return null;})[_0x3e73('0x11')](respondWithStatusCode(_0x573458,null))[_0x3e73('0x1b')](handleError(_0x573458,null));};exports[_0x3e73('0x80')]=function(_0x455307,_0x26d015){return db[_0x3e73('0x59')][_0x3e73('0x69')]({'where':{'id':_0x455307[_0x3e73('0x5e')]['id']}})[_0x3e73('0x11')](handleEntityNotFound(_0x26d015,null))['then'](function(_0x449067){if(_0x449067){return _0x449067['getSmtp']();}return null;})['then'](respondWithResult(_0x26d015,null))['catch'](handleError(_0x26d015,null));};exports[_0x3e73('0x81')]=function(_0xb6eeef,_0x142342){if(_0xb6eeef[_0x3e73('0x60')]['id']){delete _0xb6eeef[_0x3e73('0x60')]['id'];}return db[_0x3e73('0x59')][_0x3e73('0x5f')]({'where':{'id':_0xb6eeef[_0x3e73('0x5e')]['id']}})[_0x3e73('0x11')](handleEntityNotFound(_0x142342,null))[_0x3e73('0x11')](function(_0x444545){if(_0x444545){_0xb6eeef[_0x3e73('0x60')][_0x3e73('0x66')]=_0x444545['id'];return db['MailServerOut'][_0x3e73('0x67')](_0xb6eeef[_0x3e73('0x60')]);}})['then'](respondWithResult(_0x142342,null))[_0x3e73('0x1b')](handleError(_0x142342,null));};exports[_0x3e73('0x82')]=function(_0x359d65,_0x41fe03){return db[_0x3e73('0x59')]['findOne']({'where':{'id':_0x359d65[_0x3e73('0x5e')]['id']}})[_0x3e73('0x11')](handleEntityNotFound(_0x41fe03,null))[_0x3e73('0x11')](function(_0x41510a){if(_0x41510a){return _0x41510a[_0x3e73('0x83')](null);}return null;})[_0x3e73('0x11')](respondWithStatusCode(_0x41fe03,null))[_0x3e73('0x1b')](handleError(_0x41fe03,null));};exports[_0x3e73('0x84')]=function(_0x4912f5,_0x223d5c){return db[_0x3e73('0x85')]['find']({'where':{'id':_0x4912f5[_0x3e73('0x5e')]['id']}})[_0x3e73('0x11')](handleEntityNotFound(_0x223d5c,null))[_0x3e73('0x11')](function(_0xe932d4){if(_0xe932d4){return _0xe932d4['addInteraction'](_0x4912f5[_0x3e73('0x60')][_0x3e73('0x6e')],_['omit'](_0x4912f5[_0x3e73('0x60')],[_0x3e73('0x6e'),'id'])||{});}})['then'](respondWithResult(_0x223d5c,null))[_0x3e73('0x1b')](handleError(_0x223d5c,null));};exports['getInteractions']=function(_0x21642b,_0x132e2d){var _0x42d951={'raw':![],'where':{}};var _0x1c17f9={};var _0xda4306={'count':0x0,'rows':[]};return db[_0x3e73('0x59')][_0x3e73('0x69')]({'where':{'id':_0x21642b['params']['id']}})[_0x3e73('0x11')](handleEntityNotFound(_0x132e2d,null))['then'](function(_0x956c72){if(_0x956c72){_0x1c17f9['model']=_['keys'](db[_0x3e73('0x85')][_0x3e73('0x45')]);_0x1c17f9[_0x3e73('0x4a')]=_['keys'](_0x21642b[_0x3e73('0x4a')]);_0x1c17f9[_0x3e73('0x54')]=_['intersection'](_0x1c17f9[_0x3e73('0x49')],_0x1c17f9[_0x3e73('0x4a')]);_0x42d951[_0x3e73('0x4d')]=_[_0x3e73('0x4c')](_0x1c17f9[_0x3e73('0x49')],qs[_0x3e73('0x4e')](_0x21642b[_0x3e73('0x4a')][_0x3e73('0x4e')]));_0x42d951['attributes']=_0x42d951[_0x3e73('0x4d')][_0x3e73('0x4f')]?_0x42d951[_0x3e73('0x4d')]:_0x1c17f9[_0x3e73('0x49')];if(!_0x21642b['query']['hasOwnProperty'](_0x3e73('0x6a'))){_0x42d951[_0x3e73('0x22')]=qs['limit'](_0x21642b[_0x3e73('0x4a')][_0x3e73('0x22')]);_0x42d951[_0x3e73('0x20')]=qs['offset'](_0x21642b[_0x3e73('0x4a')][_0x3e73('0x20')]);}_0x42d951[_0x3e73('0x51')]=qs[_0x3e73('0x52')](_0x21642b[_0x3e73('0x4a')][_0x3e73('0x52')]);_0x42d951[_0x3e73('0x53')]=qs[_0x3e73('0x54')](_['pick'](_0x21642b[_0x3e73('0x4a')],_0x1c17f9['filters']));_0x42d951[_0x3e73('0x53')][_0x3e73('0x66')]=_0x956c72['id'];if(_0x21642b[_0x3e73('0x4a')][_0x3e73('0x55')]){_0x42d951[_0x3e73('0x53')]=_[_0x3e73('0x57')](_0x42d951[_0x3e73('0x53')],{'$or':_[_0x3e73('0x44')](_0x42d951[_0x3e73('0x4d')],function(_0x27c46a){var _0x737559={};_0x737559[_0x27c46a]={'$like':'%'+_0x21642b[_0x3e73('0x4a')][_0x3e73('0x55')]+'%'};return _0x737559;})});}_0x42d951=_[_0x3e73('0x57')]({},_0x42d951,_0x21642b[_0x3e73('0x58')]);return db['MailInteraction'][_0x3e73('0x23')]({'where':_0x42d951['where']})['then'](function(_0x92ff9a){_0xda4306[_0x3e73('0x23')]=_0x92ff9a;if(_0x21642b[_0x3e73('0x4a')][_0x3e73('0x5a')]){_0x42d951['include']=[{'model':db['CmContact'],'as':_0x3e73('0x86'),'required':![]},{'model':db[_0x3e73('0x87')],'as':_0x3e73('0x88'),'attributes':[_0x3e73('0x2a'),_0x3e73('0x89'),_0x3e73('0x8a')],'required':![]},{'model':db[_0x3e73('0x8b')],'as':_0x3e73('0x8c'),'attributes':['id',_0x3e73('0x2a'),_0x3e73('0x8d')],'where':_0x21642b[_0x3e73('0x4a')][_0x3e73('0x8e')]?{'id':_0x21642b[_0x3e73('0x4a')][_0x3e73('0x8e')]}:undefined,'required':_0x21642b[_0x3e73('0x4a')]['tag']?!![]:![]}];}return db[_0x3e73('0x85')][_0x3e73('0x5c')](_0x42d951);})[_0x3e73('0x11')](function(_0x1b4f04){_0xda4306[_0x3e73('0x5d')]=_0x1b4f04;return _0xda4306;});}})[_0x3e73('0x11')](respondWithFilteredResult(_0x132e2d,_0x42d951))[_0x3e73('0x1b')](handleError(_0x132e2d,null));};exports[_0x3e73('0x8f')]=function addApplications(_0x709f0e,_0x161c6d){var _0x108903=_0x709f0e[_0x3e73('0x5e')]['id'];var _0x433dd5=_0x709f0e['body'];var _0x3d05e5=0xc8;var _0x45f79e=null;return db['sequelize']['transaction']({'isolationLevel':db[_0x3e73('0x90')]['Transaction'][_0x3e73('0x91')][_0x3e73('0x92')]},function(_0x573a0e){return db[_0x3e73('0x59')][_0x3e73('0x69')]({'where':{'id':_0x108903},'transaction':_0x573a0e})[_0x3e73('0x11')](function(_0x4b98c5){if(_0x4b98c5){return db[_0x3e73('0x93')]['destroy']({'where':{'MailAccountId':_0x108903},'transaction':_0x573a0e})[_0x3e73('0x11')](function(){var _0xe2fa18=_[_0x3e73('0x44')](_0x433dd5,function(_0x5b5b20){_0x5b5b20['MailAccountId']=_0x108903;return _0x5b5b20;});return db[_0x3e73('0x93')]['bulkCreate'](_0xe2fa18,{'transaction':_0x573a0e});});}else{_0x3d05e5=0x194;_0x45f79e=[];}});})[_0x3e73('0x11')](function(){if(_0x3d05e5!==0x194){return db['MailApplication'][_0x3e73('0x94')]({'where':{'MailAccountId':_0x108903},'order':_0x3e73('0x95')})[_0x3e73('0x11')](function(_0x39df95){_0x45f79e=_0x39df95;});}})['catch'](function(_0x4f5abe){_0x3d05e5=0x1f4;logger[_0x3e73('0x18')](_0x4f5abe[_0x3e73('0x29')]);if(_0x4f5abe[_0x3e73('0x2a')]){delete _0x4f5abe[_0x3e73('0x2a')];}_0x45f79e=_0x4f5abe;})[_0x3e73('0x96')](function(){if(_0x45f79e===null){_0x161c6d[_0x3e73('0x1c')](_0x3d05e5);}else{if(_0x3d05e5===0x1f4){_0x161c6d[_0x3e73('0x1d')](_0x3d05e5)['send'](_0x45f79e);}else{_0x161c6d['status'](_0x3d05e5)[_0x3e73('0x1f')](_0x45f79e);}}});};exports[_0x3e73('0x97')]=function(_0x30b9ae,_0x520bf7){var _0x53c07c={};var _0x7db7a9={};var _0x55a015;var _0x3d6d11;return db[_0x3e73('0x59')][_0x3e73('0x69')]({'where':{'id':_0x30b9ae[_0x3e73('0x5e')]['id']}})[_0x3e73('0x11')](handleEntityNotFound(_0x520bf7,null))['then'](function(_0xe2f0d){if(_0xe2f0d){_0x55a015=_0xe2f0d;_0x7db7a9[_0x3e73('0x49')]=_['keys'](db[_0x3e73('0x93')][_0x3e73('0x45')]);_0x7db7a9[_0x3e73('0x4a')]=_[_0x3e73('0x4b')](_0x30b9ae['query']);_0x7db7a9[_0x3e73('0x54')]=_[_0x3e73('0x4c')](_0x7db7a9[_0x3e73('0x49')],_0x7db7a9[_0x3e73('0x4a')]);_0x53c07c[_0x3e73('0x4d')]=_['intersection'](_0x7db7a9['model'],qs[_0x3e73('0x4e')](_0x30b9ae[_0x3e73('0x4a')][_0x3e73('0x4e')]));_0x53c07c[_0x3e73('0x4d')]=_0x53c07c[_0x3e73('0x4d')]['length']?_0x53c07c[_0x3e73('0x4d')]:_0x7db7a9[_0x3e73('0x49')];_0x53c07c['order']=qs[_0x3e73('0x52')](_0x30b9ae[_0x3e73('0x4a')][_0x3e73('0x52')]);_0x53c07c[_0x3e73('0x53')]=qs[_0x3e73('0x54')](_[_0x3e73('0x6b')](_0x30b9ae[_0x3e73('0x4a')],_0x7db7a9[_0x3e73('0x54')]));if(_0x30b9ae['query'][_0x3e73('0x55')]){_0x53c07c[_0x3e73('0x53')]=_[_0x3e73('0x57')](_0x53c07c[_0x3e73('0x53')],{'$or':_[_0x3e73('0x44')](_0x53c07c[_0x3e73('0x4d')],function(_0x55a6aa){var _0x4e7dbb={};_0x4e7dbb[_0x55a6aa]={'$like':'%'+_0x30b9ae[_0x3e73('0x4a')]['filter']+'%'};return _0x4e7dbb;})});}_0x53c07c=_[_0x3e73('0x57')]({},_0x53c07c,_0x30b9ae[_0x3e73('0x58')]);return _0x55a015[_0x3e73('0x97')](_0x53c07c);}})['then'](function(_0x2b3786){if(_0x2b3786){_0x3d6d11=_0x2b3786[_0x3e73('0x4f')];if(!_0x30b9ae[_0x3e73('0x4a')][_0x3e73('0x50')](_0x3e73('0x6a'))){_0x53c07c[_0x3e73('0x22')]=qs[_0x3e73('0x22')](_0x30b9ae[_0x3e73('0x4a')][_0x3e73('0x22')]);_0x53c07c['offset']=qs['offset'](_0x30b9ae[_0x3e73('0x4a')][_0x3e73('0x20')]);}return _0x55a015['getApplications'](_0x53c07c);}})[_0x3e73('0x11')](function(_0x3cf102){if(_0x3cf102){return _0x3cf102?{'count':_0x3d6d11,'rows':_0x3cf102}:null;}})['then'](respondWithResult(_0x520bf7,null))['catch'](handleError(_0x520bf7,null));};exports[_0x3e73('0x98')]=function(_0x2d41a6,_0x2eeaea){var _0x5d15da={'raw':!![],'where':{}};var _0x4287b8={};var _0x3517a4={'count':0x0,'rows':[]};return db[_0x3e73('0x59')][_0x3e73('0x69')]({'where':{'id':_0x2d41a6[_0x3e73('0x5e')]['id']}})[_0x3e73('0x11')](handleEntityNotFound(_0x2eeaea,null))[_0x3e73('0x11')](function(_0x1fc556){if(_0x1fc556){_0x4287b8[_0x3e73('0x49')]=_[_0x3e73('0x4b')](db[_0x3e73('0x99')][_0x3e73('0x45')]);_0x4287b8[_0x3e73('0x4a')]=_[_0x3e73('0x4b')](_0x2d41a6['query']);_0x4287b8[_0x3e73('0x54')]=_[_0x3e73('0x4c')](_0x4287b8[_0x3e73('0x49')],_0x4287b8[_0x3e73('0x4a')]);_0x5d15da[_0x3e73('0x4d')]=_['intersection'](_0x4287b8[_0x3e73('0x49')],qs[_0x3e73('0x4e')](_0x2d41a6['query']['fields']));_0x5d15da[_0x3e73('0x4d')]=_0x5d15da['attributes'][_0x3e73('0x4f')]?_0x5d15da[_0x3e73('0x4d')]:_0x4287b8[_0x3e73('0x49')];if(!_0x2d41a6[_0x3e73('0x4a')][_0x3e73('0x50')](_0x3e73('0x6a'))){_0x5d15da['limit']=qs[_0x3e73('0x22')](_0x2d41a6[_0x3e73('0x4a')][_0x3e73('0x22')]);_0x5d15da[_0x3e73('0x20')]=qs[_0x3e73('0x20')](_0x2d41a6[_0x3e73('0x4a')][_0x3e73('0x20')]);}_0x5d15da[_0x3e73('0x51')]=qs[_0x3e73('0x52')](_0x2d41a6[_0x3e73('0x4a')][_0x3e73('0x52')]);_0x5d15da[_0x3e73('0x53')]=qs[_0x3e73('0x54')](_[_0x3e73('0x6b')](_0x2d41a6[_0x3e73('0x4a')],_0x4287b8[_0x3e73('0x54')]));_0x5d15da[_0x3e73('0x53')][_0x3e73('0x66')]=_0x1fc556['id'];if(_0x2d41a6[_0x3e73('0x4a')][_0x3e73('0x55')]){_0x5d15da[_0x3e73('0x53')]=_[_0x3e73('0x57')](_0x5d15da['where'],{'$or':_[_0x3e73('0x44')](_0x5d15da['attributes'],function(_0x22833a){var _0x49d536={};_0x49d536[_0x22833a]={'$like':'%'+_0x2d41a6[_0x3e73('0x4a')]['filter']+'%'};return _0x49d536;})});}if(_0x2d41a6['query']['$gte']){var _0x1569c8=_0x2d41a6[_0x3e73('0x4a')][_0x3e73('0x9a')]['split'](',');var _0x459879={};_0x459879[_0x1569c8[0x0]]={'$gte':moment(_0x1569c8[0x1])[_0x3e73('0x9b')](_0x3e73('0x9c'))};_0x5d15da[_0x3e73('0x53')]=_[_0x3e73('0x57')](_0x5d15da[_0x3e73('0x53')],_0x459879);}_0x5d15da=_[_0x3e73('0x57')]({},_0x5d15da,_0x2d41a6[_0x3e73('0x58')]);return db[_0x3e73('0x99')][_0x3e73('0x23')]({'where':_0x5d15da[_0x3e73('0x53')]})['then'](function(_0x3deade){_0x3517a4[_0x3e73('0x23')]=_0x3deade;if(_0x2d41a6[_0x3e73('0x4a')][_0x3e73('0x5a')]){_0x5d15da[_0x3e73('0x5b')]=[{'all':!![]}];}return db['MailMessage'][_0x3e73('0x5c')](_0x5d15da);})[_0x3e73('0x11')](function(_0x56587d){if(_0x2d41a6[_0x3e73('0x4a')]['inlineCss']==='true'){for(var _0x5acf2b=0x0;_0x5acf2b<_0x56587d[_0x3e73('0x4f')];_0x5acf2b++){_0x56587d[_0x5acf2b][_0x3e73('0x60')]=juice(_0x56587d[_0x5acf2b][_0x3e73('0x60')]);}}_0x3517a4[_0x3e73('0x5d')]=_0x56587d;return _0x3517a4;});}})['then'](respondWithFilteredResult(_0x2eeaea,_0x5d15da))[_0x3e73('0x1b')](handleError(_0x2eeaea,null));};exports['send']=function(_0x5d2f58,_0x119d07){var _0x1b700e,_0xdc81bd={},_0x17af55;if(_0x5d2f58[_0x3e73('0x60')]['to']){_0x17af55=_0x5d2f58[_0x3e73('0x60')]['to']['split'](',')[0x0];}return db['MailAccount']['find']({'where':{'id':_0x5d2f58[_0x3e73('0x5e')]['id']},'include':[{'model':db[_0x3e73('0x9d')],'as':'List','include':[{'model':db[_0x3e73('0x9e')],'as':_0x3e73('0x9f'),'where':{'email':_0x17af55},'limit':0x1,'order':[[_0x3e73('0xa0'),_0x3e73('0xa1')]]}]},{'model':db[_0x3e73('0x41')],'as':_0x3e73('0x3f'),'raw':!![],'include':[{'model':db[_0x3e73('0xa2')],'as':_0x3e73('0xa2'),'raw':!![]}]}]})[_0x3e73('0x11')](handleEntityNotFound(_0x119d07,null))[_0x3e73('0x11')](function(_0x7e13ea){if(!_0x7e13ea)return;_0x1b700e=_0x7e13ea;if(!_0x7e13ea['Smtp'])throw new Error(_0x3e73('0xa3'));if(_[_0x3e73('0x73')](_0x5d2f58[_0x3e73('0x60')]['from'])){_0x5d2f58[_0x3e73('0x60')]['from']=util['format'](_0x3e73('0xa4'),_0x7e13ea[_0x3e73('0x2a')],_0x7e13ea[_0x3e73('0xa5')]||_0x7e13ea[_0x3e73('0x3f')]['user']);}if(_0x5d2f58[_0x3e73('0x60')][_0x3e73('0xa6')]&&_0x5d2f58[_0x3e73('0x60')]['attachments'][_0x3e73('0x4f')]){for(var _0x596e21=0x0;_0x596e21<_0x5d2f58[_0x3e73('0x60')]['attachments']['length'];_0x596e21+=0x1){_0x5d2f58[_0x3e73('0x60')][_0x3e73('0xa6')][_0x596e21]={'filename':_0x5d2f58['body'][_0x3e73('0xa6')][_0x596e21][_0x3e73('0x2a')],'path':path[_0x3e73('0xa7')](config[_0x3e73('0xa8')],_0x3e73('0xa9'),_0x5d2f58['body']['attachments'][_0x596e21]['basename'])};}}var _0x15f4dc=_0x7e13ea[_0x3e73('0xaa')]();return respondWithRpcPromise(_0x3e73('0xab'),'sendMail',{'account':_0x15f4dc,'message':_0x5d2f58[_0x3e73('0x60')]});})[_0x3e73('0x11')](function(_0x59d920){if(!_0x59d920)return;_0xdc81bd=_0x59d920;if(!_0x1b700e[_0x3e73('0xac')])throw new Error(_0x3e73('0xad'));if(_0x1b700e[_0x3e73('0xac')][_0x3e73('0x9f')]['length'])return _0x1b700e[_0x3e73('0xac')][_0x3e73('0x9f')][0x0];return db['CmContact']['create'](_[_0x3e73('0x9')](_0x5d2f58[_0x3e73('0x60')],{'firstName':_0x5d2f58[_0x3e73('0x60')]['to'],'email':_0x5d2f58[_0x3e73('0x60')]['to'],'phone':_0x5d2f58[_0x3e73('0x60')]['to'],'ListId':_0x1b700e[_0x3e73('0x72')]}));})[_0x3e73('0x11')](function(_0x281efc){if(!_0x281efc)return;var _0x44570b={'UserId':_0x5d2f58['user']['id'],'ContactId':_0x281efc['id'],'MailAccountId':_0x1b700e['id'],'inReplyTo':_0xdc81bd[_0x3e73('0xae')],'to':_0x5d2f58[_0x3e73('0x60')][_0x3e73('0xaf')],'cc':_0x5d2f58[_0x3e73('0x60')]['cc'],'subject':_0x5d2f58[_0x3e73('0x60')][_0x3e73('0xb0')],'attach':_0x5d2f58[_0x3e73('0x60')]['attach'],'firstMsgDirection':_0x3e73('0xb1'),'lastMsgAt':moment()[_0x3e73('0x9b')](_0x3e73('0x9c')),'lastMsgDirection':_0x3e73('0xb1'),'Messages':[_[_0x3e73('0x57')](_0x5d2f58[_0x3e73('0x60')],{'messageId':_0xdc81bd[_0x3e73('0xae')],'sentAt':moment()[_0x3e73('0x9b')]('YYYY-MM-DD\x20HH:mm:ss'),'read':!![],'MailAccountId':_0x1b700e['id'],'UserId':_0x5d2f58[_0x3e73('0x36')]['id'],'ContactId':_0x281efc['id']})]};if(_0x5d2f58['body'][_0x3e73('0xb2')]){_0x44570b=_[_0x3e73('0x57')](_0x44570b,_0x5d2f58[_0x3e73('0x60')][_0x3e73('0xb2')]);}return db[_0x3e73('0x85')][_0x3e73('0x67')](_0x44570b,{'include':[{'model':db[_0x3e73('0x99')],'as':_0x3e73('0xb3')}]});})[_0x3e73('0x11')](respondWithResult(_0x119d07,null))[_0x3e73('0x1b')](handleError(_0x119d07,null));};exports[_0x3e73('0xb4')]=function(_0x4fba78,_0x2e2dc5){return db['MailAccount']['find']({'where':{'id':_0x4fba78[_0x3e73('0x5e')]['id']},'include':[{'model':db[_0x3e73('0x41')],'as':_0x3e73('0x3f'),'raw':!![],'include':[{'model':db[_0x3e73('0xa2')],'as':'CloudProvider','raw':!![]}]}]})[_0x3e73('0x11')](handleEntityNotFound(_0x2e2dc5,null))['then'](function(_0x15a08f){if(!_0x15a08f['Smtp'])return;var _0x1300f4=_0x15a08f['getSmtpOptions']();return respondWithRpcPromise('VerifySmtp',_0x3e73('0xb4'),{'account':_0x1300f4});})['then'](respondWithResult(_0x2e2dc5,null))[_0x3e73('0x1b')](handleError(_0x2e2dc5,null));};exports[_0x3e73('0x26')]=function(_0x4409f4,_0x233a75){return db[_0x3e73('0x59')][_0x3e73('0x5f')]({'where':{'id':_0x4409f4['params']['id']}})['then'](handleEntityNotFound(_0x233a75,null))[_0x3e73('0x11')](function(_0x1d9ce0){if(_0x1d9ce0&&_0x1d9ce0['service']){throw new db['Sequelize'][(_0x3e73('0xb5'))](_0x3e73('0xb6'));}return _0x1d9ce0;})[_0x3e73('0x11')](removeEntity(_0x233a75,null))[_0x3e73('0x1b')](handleError(_0x233a75,null));};exports[_0x3e73('0xb7')]=function(_0xd498a2,_0x416f2b){return db[_0x3e73('0x59')]['find']({'where':{'id':_0xd498a2[_0x3e73('0x5e')]['id']}})['then'](handleEntityNotFound(_0x416f2b,null))[_0x3e73('0x11')](function(_0x15c883){if(_0x15c883){return _0x15c883['addAgents'](_0xd498a2[_0x3e73('0x60')][_0x3e73('0x6e')],_[_0x3e73('0xb8')](_0xd498a2['body'],['ids','id'])||{})[_0x3e73('0xb9')](function(_0x144e5f){for(var _0xbd9377=0x0;_0xbd9377<_0xd498a2[_0x3e73('0x60')][_0x3e73('0x6e')][_0x3e73('0x4f')];_0xbd9377+=0x1){socket[_0x3e73('0xba')]('userMailAccount:save',{'UserId':Number(_0xd498a2[_0x3e73('0x60')]['ids'][_0xbd9377]),'MailAccountId':Number(_0xd498a2[_0x3e73('0x5e')]['id'])});}return _0x144e5f;});}})[_0x3e73('0x11')](respondWithResult(_0x416f2b,null))['catch'](handleError(_0x416f2b,null));};exports['removeAgents']=function(_0x2c56cf,_0x200570){return db[_0x3e73('0x59')]['find']({'where':{'id':_0x2c56cf[_0x3e73('0x5e')]['id']}})['then'](handleEntityNotFound(_0x200570,null))[_0x3e73('0x11')](function(_0x4c233d){if(_0x4c233d){return _0x4c233d['removeAgents'](_0x2c56cf['query'][_0x3e73('0x6e')])['then'](function(){if(_[_0x3e73('0xbb')](_0x2c56cf[_0x3e73('0x4a')][_0x3e73('0x6e')])){for(var _0x4c5f35=0x0;_0x4c5f35<_0x2c56cf[_0x3e73('0x4a')]['ids'][_0x3e73('0x4f')];_0x4c5f35+=0x1){socket['emit']('userMailAccount:remove',{'UserId':Number(_0x2c56cf[_0x3e73('0x4a')]['ids'][_0x4c5f35]),'MailAccountId':Number(_0x2c56cf[_0x3e73('0x5e')]['id'])});}}else{socket[_0x3e73('0xba')]('userMailAccount:remove',{'UserId':Number(_0x2c56cf[_0x3e73('0x4a')][_0x3e73('0x6e')]),'MailAccountId':Number(_0x2c56cf[_0x3e73('0x5e')]['id'])});}});}})[_0x3e73('0x11')](respondWithStatusCode(_0x200570,null))['catch'](handleError(_0x200570,null));};exports[_0x3e73('0xbc')]=function(_0x169807,_0x4e547c){var _0x290adc={};var _0x2ed991={};var _0x15bb8c;var _0x44d188;return db[_0x3e73('0x59')]['findOne']({'where':{'id':_0x169807[_0x3e73('0x5e')]['id']}})[_0x3e73('0x11')](handleEntityNotFound(_0x4e547c,null))[_0x3e73('0x11')](function(_0x321d8a){if(_0x321d8a){_0x15bb8c=_0x321d8a;_0x2ed991[_0x3e73('0x49')]=_['keys'](db[_0x3e73('0x87')]['rawAttributes']);_0x2ed991[_0x3e73('0x4a')]=_[_0x3e73('0x4b')](_0x169807['query']);_0x2ed991['filters']=_['intersection'](_0x2ed991[_0x3e73('0x49')],_0x2ed991['query']);_0x290adc[_0x3e73('0x4d')]=_[_0x3e73('0x4c')](_0x2ed991[_0x3e73('0x49')],qs['fields'](_0x169807[_0x3e73('0x4a')][_0x3e73('0x4e')]));_0x290adc[_0x3e73('0x4d')]=_0x290adc[_0x3e73('0x4d')][_0x3e73('0x4f')]?_0x290adc[_0x3e73('0x4d')]:_0x2ed991[_0x3e73('0x49')];_0x290adc['order']=qs[_0x3e73('0x52')](_0x169807['query']['sort']);_0x290adc[_0x3e73('0x53')]=qs[_0x3e73('0x54')](_[_0x3e73('0x6b')](_0x169807[_0x3e73('0x4a')],_0x2ed991['filters']));if(_0x169807['query'][_0x3e73('0x55')]){_0x290adc[_0x3e73('0x53')]=_[_0x3e73('0x57')](_0x290adc[_0x3e73('0x53')],{'$or':_[_0x3e73('0x44')](_0x290adc[_0x3e73('0x4d')],function(_0x11e035){var _0x3609a2={};_0x3609a2[_0x11e035]={'$like':'%'+_0x169807['query']['filter']+'%'};return _0x3609a2;})});}_0x290adc=_['merge']({},_0x290adc,_0x169807[_0x3e73('0x58')]);return _0x15bb8c[_0x3e73('0xbc')](_0x290adc);}})[_0x3e73('0x11')](function(_0x2d459c){if(_0x2d459c){_0x44d188=_0x2d459c[_0x3e73('0x4f')];if(!_0x169807['query'][_0x3e73('0x50')]('nolimit')){_0x290adc[_0x3e73('0x22')]=qs[_0x3e73('0x22')](_0x169807[_0x3e73('0x4a')][_0x3e73('0x22')]);_0x290adc[_0x3e73('0x20')]=qs[_0x3e73('0x20')](_0x169807[_0x3e73('0x4a')][_0x3e73('0x20')]);}return _0x15bb8c[_0x3e73('0xbc')](_0x290adc);}})['then'](function(_0x20af80){if(_0x20af80){return _0x20af80?{'count':_0x44d188,'rows':_0x20af80}:null;}})[_0x3e73('0x11')](respondWithResult(_0x4e547c,null))[_0x3e73('0x1b')](handleError(_0x4e547c,null));}; \ No newline at end of file +var _0x94b6=['pass','password','modernAuthentication','CloudProviderId','port','host','secure','service','authentication','username','Imap','Smtp','index','MailServerIn','MailServerOut','Pause','mandatoryDispositionPause','MailAccount','rawAttributes','fieldName','type','key','map','keys','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','query','sort','where','filter','merge','VIRTUAL','include','findAll','rows','show','params','includeAll','options','body','provider','custom','find','MailAccountId','Disposition','findOne','order','pick','removeDispositions','ids','addAnswer','CannedAnswer','create','getAnswers','removeAnswers','email','ListId','isNil','active','description','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','setImap','getSmtp','addSmtp','removeSmtp','setSmtp','addInteraction','omit','MailInteraction','CmContact','Contact','User','Owner','Tag','Tags','color','tag','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','bulkCreate','findAndCountAll','priority','send','getApplications','getMessages','MailMessage','$gte','format','YYYY-MM-DD\x20HH:mm:ss','true','split','CmList','List','Contacts','CloudProvider','Smtp\x20configuration\x20not\x20found','%s\x20<%s>','attachments','join','root','server/files/attachments','sendMail','List\x20not\x20found','messageId','subject','attach','out','Interaction','Messages','verifySmtp','VerifySmtp','Sequelize','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','userMailAccount:save','removeAgents','userMailAccount:remove','getAgents','moment','path','lodash','juice','ioredis','../../components/parsers/qs','api','../../config/environment','redis','register','client','http','request','then','info','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','error','code','MailAccount,\x20%s,\x20%s','message','catch','status','end','json','undefined','limit','count','offset','Content-Range','update','destroy','MailAccounts','UserProfileResource','sendStatus','stack','name','gmail','yahoo','imap.mail.yahoo.com','hotmail','outlook365','outlook.office365.com','smtp.gmail.com','smtp.mail.yahoo.com','smtp-mail.outlook.com','smtp.office365.com','Unknown\x20email\x20service\x20provider','user'];(function(_0x3afabb,_0x405500){var _0xf50ee1=function(_0x5c5d55){while(--_0x5c5d55){_0x3afabb['push'](_0x3afabb['shift']());}};_0xf50ee1(++_0x405500);}(_0x94b6,0x8b));var _0x694b=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x94b6[_0x1ac595];return _0x455fff;};'use strict';var moment=require(_0x694b('0x0'));var BPromise=require('bluebird');var util=require('util');var path=require(_0x694b('0x1'));var _=require(_0x694b('0x2'));var juice=require(_0x694b('0x3'));var Redis=require(_0x694b('0x4'));var qs=require(_0x694b('0x5'));var logger=require('../../config/logger')(_0x694b('0x6'));var config=require(_0x694b('0x7'));var db=require('../../mysqldb')['db'];config[_0x694b('0x8')]=_['defaults'](config[_0x694b('0x8')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./mailAccount.socket')[_0x694b('0x9')](socket);var jayson=require('jayson/promise');var client=jayson[_0x694b('0xa')][_0x694b('0xb')]({'port':0x232b});function respondWithRpcPromise(_0x308f7f,_0x370cbf,_0x4c4b65,_0x51de60){return new BPromise(function(_0x4f0aff,_0x32a3d8){var _0x434348=_0x51de60||client;return _0x434348[_0x694b('0xc')](_0x308f7f,_0x4c4b65)[_0x694b('0xd')](function(_0xd20c25){logger[_0x694b('0xe')]('MailAccount,\x20%s,\x20%s',_0x370cbf,_0x694b('0xf'));logger[_0x694b('0x10')](_0x694b('0x11'),_0x370cbf,_0x694b('0xf'),JSON['stringify'](_0xd20c25));if(_0xd20c25[_0x694b('0x12')]){if(_0xd20c25['error'][_0x694b('0x13')]===0x1f4){logger[_0x694b('0x12')](_0x694b('0x14'),_0x370cbf,_0xd20c25[_0x694b('0x12')]['message']);return _0x32a3d8(_0xd20c25[_0x694b('0x12')]['message']);}logger[_0x694b('0x12')](_0x694b('0x14'),_0x370cbf,_0xd20c25['error'][_0x694b('0x15')]);return _0x4f0aff(_0xd20c25['error']['message']);}else{logger['info'](_0x694b('0x14'),_0x370cbf,_0x694b('0xf'));_0x4f0aff(_0xd20c25['result'][_0x694b('0x15')]);}})[_0x694b('0x16')](function(_0x4e9636){logger[_0x694b('0x12')]('MailAccount,\x20%s,\x20%s',_0x370cbf,_0x4e9636);_0x32a3d8(_0x4e9636);});});}function respondWithStatusCode(_0xdf1b66,_0x59fc31){_0x59fc31=_0x59fc31||0xcc;return function(_0x5015af){if(_0x5015af){return _0xdf1b66['sendStatus'](_0x59fc31);}return _0xdf1b66[_0x694b('0x17')](_0x59fc31)[_0x694b('0x18')]();};}function respondWithResult(_0x36aeb2,_0x2a2f31){_0x2a2f31=_0x2a2f31||0xc8;return function(_0x53f2bf){if(_0x53f2bf){return _0x36aeb2[_0x694b('0x17')](_0x2a2f31)[_0x694b('0x19')](_0x53f2bf);}};}function respondWithFilteredResult(_0x4e9f8e,_0x33b924){return function(_0x5986de){if(_0x5986de){var _0x348a3d=typeof _0x33b924['offset']===_0x694b('0x1a')&&typeof _0x33b924[_0x694b('0x1b')]===_0x694b('0x1a');var _0x2bc69b=_0x5986de[_0x694b('0x1c')];var _0x16e5f7=_0x348a3d?0x0:_0x33b924[_0x694b('0x1d')];var _0xd5c9de=_0x348a3d?_0x5986de[_0x694b('0x1c')]:_0x33b924[_0x694b('0x1d')]+_0x33b924[_0x694b('0x1b')];var _0x1c1cef;if(_0xd5c9de>=_0x2bc69b){_0xd5c9de=_0x2bc69b;_0x1c1cef=0xc8;}else{_0x1c1cef=0xce;}_0x4e9f8e[_0x694b('0x17')](_0x1c1cef);return _0x4e9f8e['set'](_0x694b('0x1e'),_0x16e5f7+'-'+_0xd5c9de+'/'+_0x2bc69b)[_0x694b('0x19')](_0x5986de);}return null;};}function saveUpdates(_0x5040c0){return function(_0x5ae700){if(_0x5ae700){return _0x5ae700[_0x694b('0x1f')](_0x5040c0)[_0x694b('0xd')](function(_0x3ea74b){return _0x3ea74b;});}return null;};}function removeEntity(_0x5c8a48){return function(_0x21eef8){if(_0x21eef8){return _0x21eef8[_0x694b('0x20')]()[_0x694b('0xd')](function(){var _0x309c8c=_0x21eef8['get']({'plain':!![]});var _0x3c4c5c=_0x694b('0x21');return db[_0x694b('0x22')]['destroy']({'where':{'type':_0x3c4c5c,'resourceId':_0x309c8c['id']}})[_0x694b('0xd')](function(){return _0x21eef8;});})['then'](function(){_0x5c8a48[_0x694b('0x17')](0xcc)[_0x694b('0x18')]();});}};}function handleEntityNotFound(_0x1f934b){return function(_0x43a3c1){if(!_0x43a3c1){_0x1f934b[_0x694b('0x23')](0x194);}return _0x43a3c1;};}function handleError(_0x53bfc9,_0x17272d){_0x17272d=_0x17272d||0x1f4;return function(_0x5d7b53){logger[_0x694b('0x12')](_0x5d7b53[_0x694b('0x24')]);if(_0x5d7b53[_0x694b('0x25')]){delete _0x5d7b53[_0x694b('0x25')];}_0x53bfc9[_0x694b('0x17')](_0x17272d)['send'](_0x5d7b53);};}function getImapHost(_0x3b0275){switch(_0x3b0275){case _0x694b('0x26'):return'imap.gmail.com';case _0x694b('0x27'):return _0x694b('0x28');case _0x694b('0x29'):return'imap-mail.outlook.com';case _0x694b('0x2a'):return _0x694b('0x2b');}throw new Error('Unknown\x20email\x20service\x20provider',_0x3b0275);}function getSmtpHost(_0x1e7b55){switch(_0x1e7b55){case _0x694b('0x26'):return _0x694b('0x2c');case _0x694b('0x27'):return _0x694b('0x2d');case _0x694b('0x29'):return _0x694b('0x2e');case'outlook365':return _0x694b('0x2f');}throw new Error(_0x694b('0x30'),_0x1e7b55);}function getAuthenticationOptions(_0x503bb7,_0x4af167){var _0x52c5fa={};var _0x59e540={};if(_0x503bb7){_0x52c5fa['user']=_0x59e540[_0x694b('0x31')]=_0x4af167['username'];_0x52c5fa['password']=_0x59e540[_0x694b('0x32')]=_0x4af167[_0x694b('0x33')];if(_0x4af167[_0x694b('0x34')]){_0x52c5fa[_0x694b('0x34')]=_0x59e540[_0x694b('0x34')]=!![];_0x52c5fa[_0x694b('0x35')]=_0x59e540['CloudProviderId']=_0x4af167[_0x694b('0x35')];_0x52c5fa[_0x694b('0x33')]=_0x59e540[_0x694b('0x32')]=null;}else{_0x52c5fa[_0x694b('0x35')]=_0x59e540[_0x694b('0x35')]=null;}_0x52c5fa['host']=getImapHost(_0x503bb7);_0x52c5fa[_0x694b('0x36')]=0x3e1;_0x59e540[_0x694b('0x37')]=getSmtpHost(_0x503bb7);_0x59e540[_0x694b('0x36')]=0x24b;_0x59e540[_0x694b('0x38')]=![];_0x52c5fa[_0x694b('0x39')]=_0x59e540[_0x694b('0x39')]=null;}else{if(_0x4af167[_0x694b('0x3a')]){_0x52c5fa[_0x694b('0x31')]=_0x59e540['user']=_0x4af167[_0x694b('0x3b')];_0x52c5fa[_0x694b('0x33')]=_0x59e540[_0x694b('0x32')]=_0x4af167[_0x694b('0x33')];}else{_0x52c5fa['authentication']=_0x59e540[_0x694b('0x3a')]=![];_0x52c5fa[_0x694b('0x31')]=_0x59e540[_0x694b('0x31')]=null;_0x52c5fa[_0x694b('0x33')]=_0x59e540['pass']=null;}_0x52c5fa[_0x694b('0x37')]=_0x4af167[_0x694b('0x3c')]['host'];_0x52c5fa[_0x694b('0x36')]=_0x4af167[_0x694b('0x3c')][_0x694b('0x36')];_0x59e540[_0x694b('0x37')]=_0x4af167[_0x694b('0x3d')][_0x694b('0x37')];_0x59e540[_0x694b('0x36')]=_0x4af167['Smtp'][_0x694b('0x36')];}return{'Imap':_0x52c5fa,'Smtp':_0x59e540};}exports[_0x694b('0x3e')]=function(_0x22fd90,_0x2ebe31){var _0x48126c={'include':[{'model':db[_0x694b('0x3f')],'as':_0x694b('0x3c')},{'model':db[_0x694b('0x40')],'as':_0x694b('0x3d')},{'model':db[_0x694b('0x41')],'as':_0x694b('0x42')}]},_0x3824db={},_0x56a44a={'count':0x0,'rows':[]};var _0x4fd7f3=_['map'](db[_0x694b('0x43')][_0x694b('0x44')],function(_0x33ed90){return{'name':_0x33ed90[_0x694b('0x45')],'type':_0x33ed90[_0x694b('0x46')][_0x694b('0x47')]};});_0x3824db['model']=_[_0x694b('0x48')](_0x4fd7f3,_0x694b('0x25'));_0x3824db['query']=_[_0x694b('0x49')](_0x22fd90['query']);_0x3824db[_0x694b('0x4a')]=_['intersection'](_0x3824db[_0x694b('0x4b')],_0x3824db['query']);_0x48126c['attributes']=_[_0x694b('0x4c')](_0x3824db[_0x694b('0x4b')],qs[_0x694b('0x4d')](_0x22fd90['query'][_0x694b('0x4d')]));_0x48126c[_0x694b('0x4e')]=_0x48126c[_0x694b('0x4e')][_0x694b('0x4f')]?_0x48126c[_0x694b('0x4e')]:_0x3824db[_0x694b('0x4b')];if(!_0x22fd90['query'][_0x694b('0x50')](_0x694b('0x51'))){_0x48126c['limit']=qs['limit'](_0x22fd90[_0x694b('0x52')]['limit']);_0x48126c['offset']=qs['offset'](_0x22fd90['query'][_0x694b('0x1d')]);}_0x48126c['order']=qs[_0x694b('0x53')](_0x22fd90['query']['sort']);_0x48126c[_0x694b('0x54')]=qs[_0x694b('0x4a')](_['pick'](_0x22fd90[_0x694b('0x52')],_0x3824db['filters']),_0x4fd7f3);if(_0x22fd90[_0x694b('0x52')][_0x694b('0x55')]){_0x48126c['where']=_[_0x694b('0x56')](_0x48126c[_0x694b('0x54')],{'$or':_['map'](_0x4fd7f3,function(_0x101156){if(_0x101156[_0x694b('0x46')]!==_0x694b('0x57')){var _0x15bdf9={};_0x15bdf9[_0x101156[_0x694b('0x25')]]={'$like':'%'+_0x22fd90[_0x694b('0x52')][_0x694b('0x55')]+'%'};return _0x15bdf9;}})});}_0x48126c=_[_0x694b('0x56')]({},_0x48126c,_0x22fd90['options']);var _0x4f8217={'where':_0x48126c[_0x694b('0x54')]};return db[_0x694b('0x43')][_0x694b('0x1c')](_0x4f8217)[_0x694b('0xd')](function(_0x41a729){_0x56a44a[_0x694b('0x1c')]=_0x41a729;if(_0x22fd90[_0x694b('0x52')]['includeAll']){_0x48126c[_0x694b('0x58')]=[{'all':!![]}];}return db[_0x694b('0x43')][_0x694b('0x59')](_0x48126c);})['then'](function(_0x4c553a){_0x56a44a[_0x694b('0x5a')]=_0x4c553a;return _0x56a44a;})[_0x694b('0xd')](respondWithFilteredResult(_0x2ebe31,_0x48126c))[_0x694b('0x16')](handleError(_0x2ebe31,null));};exports[_0x694b('0x5b')]=function(_0x2824e7,_0xcebcac){var _0x54a97b={'raw':![],'where':{'id':_0x2824e7[_0x694b('0x5c')]['id']},'include':[{'model':db[_0x694b('0x3f')],'as':_0x694b('0x3c')},{'model':db['MailServerOut'],'as':_0x694b('0x3d')},{'model':db[_0x694b('0x41')],'as':_0x694b('0x42')}]},_0x5b6ac3={};_0x5b6ac3['model']=_[_0x694b('0x49')](db['MailAccount'][_0x694b('0x44')]);_0x5b6ac3[_0x694b('0x52')]=_[_0x694b('0x49')](_0x2824e7[_0x694b('0x52')]);_0x5b6ac3[_0x694b('0x4a')]=_[_0x694b('0x4c')](_0x5b6ac3['model'],_0x5b6ac3[_0x694b('0x52')]);_0x54a97b['attributes']=_[_0x694b('0x4c')](_0x5b6ac3[_0x694b('0x4b')],qs[_0x694b('0x4d')](_0x2824e7[_0x694b('0x52')][_0x694b('0x4d')]));_0x54a97b[_0x694b('0x4e')]=_0x54a97b[_0x694b('0x4e')][_0x694b('0x4f')]?_0x54a97b[_0x694b('0x4e')]:_0x5b6ac3[_0x694b('0x4b')];if(_0x2824e7['query'][_0x694b('0x5d')]){_0x54a97b['include']=[{'all':!![]}];}_0x54a97b=_[_0x694b('0x56')]({},_0x54a97b,_0x2824e7[_0x694b('0x5e')]);return db[_0x694b('0x43')]['find'](_0x54a97b)['then'](handleEntityNotFound(_0xcebcac,null))[_0x694b('0xd')](respondWithResult(_0xcebcac,null))[_0x694b('0x16')](handleError(_0xcebcac,null));};exports[_0x694b('0x1f')]=function(_0x1f5706,_0x80e2a9){if(_0x1f5706['body']['id']){delete _0x1f5706[_0x694b('0x5f')]['id'];}var _0x3de872=_0x1f5706[_0x694b('0x5f')][_0x694b('0x60')]===_0x694b('0x61')?null:_0x1f5706[_0x694b('0x5f')]['provider'];var _0x21aa45=_0x1f5706[_0x694b('0x5f')][_0x694b('0x3c')]||{};var _0x26a065=_0x1f5706['body'][_0x694b('0x3d')]||{};if(_0x3de872){_0x21aa45['host']=getImapHost(_0x3de872);_0x21aa45[_0x694b('0x36')]=0x3e1;_0x26a065[_0x694b('0x37')]=getSmtpHost(_0x3de872);_0x26a065[_0x694b('0x36')]=0x24b;_0x26a065['secure']=![];}if(_0x26a065[_0x694b('0x34')]){_0x26a065['secure']=![];}else{_0x26a065[_0x694b('0x35')]=null;}if(!_0x21aa45[_0x694b('0x34')])_0x21aa45['CloudProviderId']=null;_0x1f5706[_0x694b('0x5f')][_0x694b('0x3c')]=_0x21aa45;_0x1f5706['body'][_0x694b('0x3d')]=_0x26a065;return db[_0x694b('0x43')]['find']({'where':{'id':_0x1f5706[_0x694b('0x5c')]['id']},'include':[{'model':db[_0x694b('0x3f')],'as':_0x694b('0x3c')},{'model':db['MailServerOut'],'as':_0x694b('0x3d')},{'model':db[_0x694b('0x41')],'as':_0x694b('0x42')}]})[_0x694b('0xd')](handleEntityNotFound(_0x80e2a9,null))[_0x694b('0xd')](function(_0x4000c4){if(!_0x4000c4)throw new Error('Mail\x20Account\x20not\x20found');if(_0x4000c4[_0x694b('0x39')])delete _0x1f5706[_0x694b('0x5f')]['Imap'];return _0x4000c4;})[_0x694b('0xd')](saveUpdates(_0x1f5706['body'],null))['then'](function(_0x43fc3c){if(!_0x1f5706[_0x694b('0x5f')]['Imap'])return _0x43fc3c;return db[_0x694b('0x3f')][_0x694b('0x1f')](_0x1f5706[_0x694b('0x5f')][_0x694b('0x3c')],{'where':{'MailAccountId':_0x43fc3c['id']}})[_0x694b('0xd')](function(){return _0x43fc3c;});})[_0x694b('0xd')](function(_0x5b2add){if(!_0x1f5706[_0x694b('0x5f')][_0x694b('0x3d')])return _0x5b2add;return db[_0x694b('0x40')]['update'](_0x1f5706[_0x694b('0x5f')][_0x694b('0x3d')],{'where':{'MailAccountId':_0x5b2add['id']}})[_0x694b('0xd')](function(){return _0x5b2add;});})[_0x694b('0xd')](respondWithResult(_0x80e2a9,null))[_0x694b('0x16')](handleError(_0x80e2a9,null));};exports['describe']=function(_0x2049ba,_0x568046){return db[_0x694b('0x43')]['describe']()[_0x694b('0xd')](respondWithResult(_0x568046,null))[_0x694b('0x16')](handleError(_0x568046,null));};exports['addDisposition']=function(_0x12f636,_0x125838){if(_0x12f636['body']['id']){delete _0x12f636['body']['id'];}return db[_0x694b('0x43')][_0x694b('0x62')]({'where':{'id':_0x12f636['params']['id']}})[_0x694b('0xd')](handleEntityNotFound(_0x125838,null))['then'](function(_0x5a62fe){if(_0x5a62fe){_0x12f636['body'][_0x694b('0x63')]=_0x5a62fe['id'];return db[_0x694b('0x64')]['create'](_0x12f636['body']);}})[_0x694b('0xd')](respondWithResult(_0x125838,null))[_0x694b('0x16')](handleError(_0x125838,null));};exports['getDispositions']=function(_0x8717f,_0x273032){var _0x395410={'raw':![],'where':{}};var _0x3ef8c4={};var _0x3c2699={'count':0x0,'rows':[]};return db[_0x694b('0x43')][_0x694b('0x65')]({'where':{'id':_0x8717f[_0x694b('0x5c')]['id']}})[_0x694b('0xd')](handleEntityNotFound(_0x273032,null))[_0x694b('0xd')](function(_0x4360db){if(_0x4360db){_0x3ef8c4[_0x694b('0x4b')]=_[_0x694b('0x49')](db[_0x694b('0x64')][_0x694b('0x44')]);_0x3ef8c4['query']=_['keys'](_0x8717f[_0x694b('0x52')]);_0x3ef8c4[_0x694b('0x4a')]=_[_0x694b('0x4c')](_0x3ef8c4[_0x694b('0x4b')],_0x3ef8c4[_0x694b('0x52')]);_0x395410[_0x694b('0x4e')]=_[_0x694b('0x4c')](_0x3ef8c4[_0x694b('0x4b')],qs['fields'](_0x8717f[_0x694b('0x52')][_0x694b('0x4d')]));_0x395410[_0x694b('0x4e')]=_0x395410[_0x694b('0x4e')]['length']?_0x395410[_0x694b('0x4e')]:_0x3ef8c4[_0x694b('0x4b')];if(!_0x8717f['query']['hasOwnProperty'](_0x694b('0x51'))){_0x395410[_0x694b('0x1b')]=qs[_0x694b('0x1b')](_0x8717f['query'][_0x694b('0x1b')]);_0x395410[_0x694b('0x1d')]=qs[_0x694b('0x1d')](_0x8717f[_0x694b('0x52')][_0x694b('0x1d')]);}_0x395410[_0x694b('0x66')]=qs[_0x694b('0x53')](_0x8717f['query'][_0x694b('0x53')]);_0x395410[_0x694b('0x54')]=qs[_0x694b('0x4a')](_[_0x694b('0x67')](_0x8717f[_0x694b('0x52')],_0x3ef8c4['filters']));_0x395410[_0x694b('0x54')][_0x694b('0x63')]=_0x4360db['id'];if(_0x8717f['query']['filter']){_0x395410[_0x694b('0x54')]=_[_0x694b('0x56')](_0x395410[_0x694b('0x54')],{'$or':_['map'](_0x395410[_0x694b('0x4e')],function(_0x205f74){var _0x2a03b0={};_0x2a03b0[_0x205f74]={'$like':'%'+_0x8717f[_0x694b('0x52')]['filter']+'%'};return _0x2a03b0;})});}_0x395410=_[_0x694b('0x56')]({},_0x395410,_0x8717f[_0x694b('0x5e')]);return db[_0x694b('0x64')][_0x694b('0x1c')]({'where':_0x395410[_0x694b('0x54')]})['then'](function(_0x218298){_0x3c2699[_0x694b('0x1c')]=_0x218298;if(_0x8717f[_0x694b('0x52')]['includeAll']){_0x395410[_0x694b('0x58')]=[{'all':!![]}];}return db['Disposition'][_0x694b('0x59')](_0x395410);})[_0x694b('0xd')](function(_0x42d6c3){_0x3c2699[_0x694b('0x5a')]=_0x42d6c3;return _0x3c2699;});}})[_0x694b('0xd')](respondWithFilteredResult(_0x273032,_0x395410))[_0x694b('0x16')](handleError(_0x273032,null));};exports[_0x694b('0x68')]=function(_0x1ccdef,_0x374e70){return db['MailAccount']['find']({'where':{'id':_0x1ccdef[_0x694b('0x5c')]['id']}})['then'](handleEntityNotFound(_0x374e70,null))[_0x694b('0xd')](function(_0x40844e){if(_0x40844e){return _0x40844e['removeDispositions'](_0x1ccdef[_0x694b('0x52')][_0x694b('0x69')]);}})[_0x694b('0xd')](respondWithStatusCode(_0x374e70,null))[_0x694b('0x16')](handleError(_0x374e70,null));};exports[_0x694b('0x6a')]=function(_0x5aa6ab,_0xec138f){if(_0x5aa6ab[_0x694b('0x5f')]['id']){delete _0x5aa6ab[_0x694b('0x5f')]['id'];}return db[_0x694b('0x43')]['find']({'where':{'id':_0x5aa6ab[_0x694b('0x5c')]['id']}})['then'](handleEntityNotFound(_0xec138f,null))[_0x694b('0xd')](function(_0x4dcdf5){if(_0x4dcdf5){_0x5aa6ab[_0x694b('0x5f')][_0x694b('0x63')]=_0x4dcdf5['id'];return db[_0x694b('0x6b')][_0x694b('0x6c')](_0x5aa6ab[_0x694b('0x5f')]);}})[_0x694b('0xd')](respondWithResult(_0xec138f,null))[_0x694b('0x16')](handleError(_0xec138f,null));};exports[_0x694b('0x6d')]=function(_0x423e1f,_0x363334){var _0x3e0e52={'raw':![],'where':{}};var _0x127d7b={};var _0x2ae0f4={'count':0x0,'rows':[]};return db['MailAccount'][_0x694b('0x65')]({'where':{'id':_0x423e1f[_0x694b('0x5c')]['id']}})[_0x694b('0xd')](handleEntityNotFound(_0x363334,null))['then'](function(_0x158f7b){if(_0x158f7b){_0x127d7b[_0x694b('0x4b')]=_[_0x694b('0x49')](db[_0x694b('0x6b')][_0x694b('0x44')]);_0x127d7b[_0x694b('0x52')]=_[_0x694b('0x49')](_0x423e1f[_0x694b('0x52')]);_0x127d7b['filters']=_['intersection'](_0x127d7b[_0x694b('0x4b')],_0x127d7b[_0x694b('0x52')]);_0x3e0e52[_0x694b('0x4e')]=_[_0x694b('0x4c')](_0x127d7b[_0x694b('0x4b')],qs[_0x694b('0x4d')](_0x423e1f[_0x694b('0x52')][_0x694b('0x4d')]));_0x3e0e52[_0x694b('0x4e')]=_0x3e0e52['attributes'][_0x694b('0x4f')]?_0x3e0e52[_0x694b('0x4e')]:_0x127d7b['model'];if(!_0x423e1f['query'][_0x694b('0x50')](_0x694b('0x51'))){_0x3e0e52['limit']=qs[_0x694b('0x1b')](_0x423e1f[_0x694b('0x52')][_0x694b('0x1b')]);_0x3e0e52['offset']=qs[_0x694b('0x1d')](_0x423e1f[_0x694b('0x52')]['offset']);}_0x3e0e52[_0x694b('0x66')]=qs[_0x694b('0x53')](_0x423e1f[_0x694b('0x52')]['sort']);_0x3e0e52[_0x694b('0x54')]=qs['filters'](_[_0x694b('0x67')](_0x423e1f[_0x694b('0x52')],_0x127d7b[_0x694b('0x4a')]));_0x3e0e52[_0x694b('0x54')][_0x694b('0x63')]=_0x158f7b['id'];if(_0x423e1f[_0x694b('0x52')][_0x694b('0x55')]){_0x3e0e52['where']=_['merge'](_0x3e0e52[_0x694b('0x54')],{'$or':_[_0x694b('0x48')](_0x3e0e52[_0x694b('0x4e')],function(_0x5b9f8b){var _0x1b6b92={};_0x1b6b92[_0x5b9f8b]={'$like':'%'+_0x423e1f[_0x694b('0x52')][_0x694b('0x55')]+'%'};return _0x1b6b92;})});}_0x3e0e52=_[_0x694b('0x56')]({},_0x3e0e52,_0x423e1f[_0x694b('0x5e')]);return db['CannedAnswer'][_0x694b('0x1c')]({'where':_0x3e0e52[_0x694b('0x54')]})[_0x694b('0xd')](function(_0x25290e){_0x2ae0f4['count']=_0x25290e;if(_0x423e1f[_0x694b('0x52')][_0x694b('0x5d')]){_0x3e0e52['include']=[{'all':!![]}];}return db[_0x694b('0x6b')][_0x694b('0x59')](_0x3e0e52);})[_0x694b('0xd')](function(_0x5038dc){_0x2ae0f4[_0x694b('0x5a')]=_0x5038dc;return _0x2ae0f4;});}})[_0x694b('0xd')](respondWithFilteredResult(_0x363334,_0x3e0e52))[_0x694b('0x16')](handleError(_0x363334,null));};exports[_0x694b('0x6e')]=function(_0x427d05,_0x2e058f){return db[_0x694b('0x43')][_0x694b('0x62')]({'where':{'id':_0x427d05['params']['id']}})[_0x694b('0xd')](handleEntityNotFound(_0x2e058f,null))[_0x694b('0xd')](function(_0x3165d9){if(_0x3165d9){return _0x3165d9[_0x694b('0x6e')](_0x427d05[_0x694b('0x52')]['ids']);}})['then'](respondWithStatusCode(_0x2e058f,null))[_0x694b('0x16')](handleError(_0x2e058f,null));};exports['create']=function(_0x5889f1,_0x367522){var _0x3d8a86={'name':_0x5889f1[_0x694b('0x5f')]['name'],'key':_0x5889f1[_0x694b('0x5f')][_0x694b('0x47')],'provider':_0x5889f1['body'][_0x694b('0x60')]==='custom'?null:_0x5889f1['body']['provider'],'email':_0x5889f1[_0x694b('0x5f')][_0x694b('0x6f')],'ListId':_0x5889f1[_0x694b('0x5f')][_0x694b('0x70')],'active':!_[_0x694b('0x71')](_0x5889f1[_0x694b('0x5f')][_0x694b('0x72')])?_0x5889f1[_0x694b('0x5f')][_0x694b('0x72')]:!![],'description':_0x5889f1['body'][_0x694b('0x73')]||null};var _0x1c312b=getAuthenticationOptions(_0x3d8a86['provider'],_0x5889f1[_0x694b('0x5f')]);_0x3d8a86[_0x694b('0x3c')]=_0x1c312b[_0x694b('0x3c')];_0x3d8a86[_0x694b('0x3d')]=_0x1c312b[_0x694b('0x3d')];return db[_0x694b('0x43')][_0x694b('0x6c')](_0x3d8a86,{'include':[{'model':db[_0x694b('0x40')],'as':_0x694b('0x3d')},{'model':db[_0x694b('0x3f')],'as':'Imap'}]})['then'](function(_0x84b41d){var _0x5b9147=_0x5889f1['user'][_0x694b('0x74')]({'plain':!![]});if(!_0x5b9147)throw new Error(_0x694b('0x75'));if(_0x5b9147[_0x694b('0x76')]===_0x694b('0x31')){var _0x5c47a6=_0x84b41d[_0x694b('0x74')]({'plain':!![]});return db[_0x694b('0x77')]['find']({'where':{'name':_0x694b('0x21'),'userProfileId':_0x5b9147[_0x694b('0x78')]},'raw':!![]})['then'](function(_0x47a5e7){if(_0x47a5e7&&_0x47a5e7[_0x694b('0x79')]===0x0){return db[_0x694b('0x22')]['create']({'name':_0x5c47a6[_0x694b('0x25')],'resourceId':_0x5c47a6['id'],'type':_0x47a5e7['name'],'sectionId':_0x47a5e7['id']},{})[_0x694b('0xd')](function(){return _0x84b41d;});}else{return _0x84b41d;}})[_0x694b('0x16')](function(_0x3cf612){logger[_0x694b('0x12')](_0x694b('0x7a'),_0x3cf612);throw _0x3cf612;});}return _0x84b41d;})[_0x694b('0xd')](respondWithResult(_0x367522,0xc9))[_0x694b('0x16')](handleError(_0x367522,null));};exports['getImap']=function(_0x48eee9,_0x2df03b){return db[_0x694b('0x43')]['findOne']({'where':{'id':_0x48eee9[_0x694b('0x5c')]['id']}})[_0x694b('0xd')](handleEntityNotFound(_0x2df03b,null))[_0x694b('0xd')](function(_0x466c0a){if(_0x466c0a){return _0x466c0a[_0x694b('0x7b')]();}return null;})[_0x694b('0xd')](respondWithResult(_0x2df03b,null))['catch'](handleError(_0x2df03b,null));};exports[_0x694b('0x7c')]=function(_0x467c46,_0x21f08e){if(_0x467c46['body']['id']){delete _0x467c46['body']['id'];}return db[_0x694b('0x43')][_0x694b('0x62')]({'where':{'id':_0x467c46[_0x694b('0x5c')]['id']}})[_0x694b('0xd')](handleEntityNotFound(_0x21f08e,null))[_0x694b('0xd')](function(_0x2f9a84){if(_0x2f9a84){_0x467c46[_0x694b('0x5f')][_0x694b('0x63')]=_0x2f9a84['id'];return db[_0x694b('0x3f')][_0x694b('0x6c')](_0x467c46[_0x694b('0x5f')]);}})[_0x694b('0xd')](respondWithResult(_0x21f08e,null))[_0x694b('0x16')](handleError(_0x21f08e,null));};exports[_0x694b('0x7d')]=function(_0xfb9bc5,_0x2c4fc2){return db[_0x694b('0x43')][_0x694b('0x65')]({'where':{'id':_0xfb9bc5['params']['id']}})['then'](handleEntityNotFound(_0x2c4fc2,null))['then'](function(_0x7ff03a){if(_0x7ff03a){return _0x7ff03a[_0x694b('0x7e')](null);}return null;})[_0x694b('0xd')](respondWithStatusCode(_0x2c4fc2,null))[_0x694b('0x16')](handleError(_0x2c4fc2,null));};exports[_0x694b('0x7f')]=function(_0x44b335,_0x33485a){return db[_0x694b('0x43')][_0x694b('0x65')]({'where':{'id':_0x44b335[_0x694b('0x5c')]['id']}})[_0x694b('0xd')](handleEntityNotFound(_0x33485a,null))[_0x694b('0xd')](function(_0x52fb0f){if(_0x52fb0f){return _0x52fb0f[_0x694b('0x7f')]();}return null;})[_0x694b('0xd')](respondWithResult(_0x33485a,null))['catch'](handleError(_0x33485a,null));};exports[_0x694b('0x80')]=function(_0x412c20,_0x6e0f90){if(_0x412c20[_0x694b('0x5f')]['id']){delete _0x412c20[_0x694b('0x5f')]['id'];}return db[_0x694b('0x43')]['find']({'where':{'id':_0x412c20[_0x694b('0x5c')]['id']}})[_0x694b('0xd')](handleEntityNotFound(_0x6e0f90,null))[_0x694b('0xd')](function(_0x346a18){if(_0x346a18){_0x412c20[_0x694b('0x5f')][_0x694b('0x63')]=_0x346a18['id'];return db[_0x694b('0x40')][_0x694b('0x6c')](_0x412c20['body']);}})[_0x694b('0xd')](respondWithResult(_0x6e0f90,null))[_0x694b('0x16')](handleError(_0x6e0f90,null));};exports[_0x694b('0x81')]=function(_0x407084,_0x30b2ef){return db[_0x694b('0x43')][_0x694b('0x65')]({'where':{'id':_0x407084[_0x694b('0x5c')]['id']}})['then'](handleEntityNotFound(_0x30b2ef,null))['then'](function(_0x1da77d){if(_0x1da77d){return _0x1da77d[_0x694b('0x82')](null);}return null;})[_0x694b('0xd')](respondWithStatusCode(_0x30b2ef,null))[_0x694b('0x16')](handleError(_0x30b2ef,null));};exports[_0x694b('0x83')]=function(_0x49ed7b,_0x49d57d){return db['MailInteraction'][_0x694b('0x62')]({'where':{'id':_0x49ed7b['params']['id']}})[_0x694b('0xd')](handleEntityNotFound(_0x49d57d,null))[_0x694b('0xd')](function(_0x27b5b4){if(_0x27b5b4){return _0x27b5b4[_0x694b('0x83')](_0x49ed7b[_0x694b('0x5f')]['ids'],_[_0x694b('0x84')](_0x49ed7b[_0x694b('0x5f')],[_0x694b('0x69'),'id'])||{});}})['then'](respondWithResult(_0x49d57d,null))[_0x694b('0x16')](handleError(_0x49d57d,null));};exports['getInteractions']=function(_0x26dc47,_0x4e1649){var _0x5d0e81={'raw':![],'where':{}};var _0x34b6a6={};var _0x3653e5={'count':0x0,'rows':[]};return db[_0x694b('0x43')][_0x694b('0x65')]({'where':{'id':_0x26dc47[_0x694b('0x5c')]['id']}})[_0x694b('0xd')](handleEntityNotFound(_0x4e1649,null))['then'](function(_0x4d235d){if(_0x4d235d){_0x34b6a6[_0x694b('0x4b')]=_[_0x694b('0x49')](db[_0x694b('0x85')][_0x694b('0x44')]);_0x34b6a6['query']=_[_0x694b('0x49')](_0x26dc47[_0x694b('0x52')]);_0x34b6a6[_0x694b('0x4a')]=_[_0x694b('0x4c')](_0x34b6a6[_0x694b('0x4b')],_0x34b6a6[_0x694b('0x52')]);_0x5d0e81[_0x694b('0x4e')]=_['intersection'](_0x34b6a6[_0x694b('0x4b')],qs[_0x694b('0x4d')](_0x26dc47[_0x694b('0x52')][_0x694b('0x4d')]));_0x5d0e81[_0x694b('0x4e')]=_0x5d0e81['attributes'][_0x694b('0x4f')]?_0x5d0e81[_0x694b('0x4e')]:_0x34b6a6[_0x694b('0x4b')];if(!_0x26dc47['query']['hasOwnProperty'](_0x694b('0x51'))){_0x5d0e81[_0x694b('0x1b')]=qs[_0x694b('0x1b')](_0x26dc47[_0x694b('0x52')]['limit']);_0x5d0e81['offset']=qs['offset'](_0x26dc47[_0x694b('0x52')]['offset']);}_0x5d0e81[_0x694b('0x66')]=qs[_0x694b('0x53')](_0x26dc47[_0x694b('0x52')][_0x694b('0x53')]);_0x5d0e81[_0x694b('0x54')]=qs[_0x694b('0x4a')](_[_0x694b('0x67')](_0x26dc47[_0x694b('0x52')],_0x34b6a6[_0x694b('0x4a')]));_0x5d0e81[_0x694b('0x54')][_0x694b('0x63')]=_0x4d235d['id'];if(_0x26dc47[_0x694b('0x52')]['filter']){_0x5d0e81['where']=_[_0x694b('0x56')](_0x5d0e81[_0x694b('0x54')],{'$or':_[_0x694b('0x48')](_0x5d0e81[_0x694b('0x4e')],function(_0x5b035f){var _0x29b828={};_0x29b828[_0x5b035f]={'$like':'%'+_0x26dc47[_0x694b('0x52')][_0x694b('0x55')]+'%'};return _0x29b828;})});}_0x5d0e81=_['merge']({},_0x5d0e81,_0x26dc47[_0x694b('0x5e')]);return db['MailInteraction']['count']({'where':_0x5d0e81[_0x694b('0x54')]})[_0x694b('0xd')](function(_0x2b8ceb){_0x3653e5[_0x694b('0x1c')]=_0x2b8ceb;if(_0x26dc47[_0x694b('0x52')]['includeAll']){_0x5d0e81[_0x694b('0x58')]=[{'model':db[_0x694b('0x86')],'as':_0x694b('0x87'),'required':![]},{'model':db[_0x694b('0x88')],'as':_0x694b('0x89'),'attributes':[_0x694b('0x25'),'fullname','internal'],'required':![]},{'model':db[_0x694b('0x8a')],'as':_0x694b('0x8b'),'attributes':['id','name',_0x694b('0x8c')],'where':_0x26dc47['query']['tag']?{'id':_0x26dc47[_0x694b('0x52')][_0x694b('0x8d')]}:undefined,'required':_0x26dc47[_0x694b('0x52')][_0x694b('0x8d')]?!![]:![]}];}return db[_0x694b('0x85')]['findAll'](_0x5d0e81);})[_0x694b('0xd')](function(_0x316635){_0x3653e5[_0x694b('0x5a')]=_0x316635;return _0x3653e5;});}})[_0x694b('0xd')](respondWithFilteredResult(_0x4e1649,_0x5d0e81))[_0x694b('0x16')](handleError(_0x4e1649,null));};exports['addApplications']=function addApplications(_0x3cee8b,_0x3a079c){var _0x1b6390=_0x3cee8b[_0x694b('0x5c')]['id'];var _0x2f22c3=_0x3cee8b[_0x694b('0x5f')];var _0x28f1a2=0xc8;var _0x22bec0=null;return db[_0x694b('0x8e')][_0x694b('0x8f')]({'isolationLevel':db[_0x694b('0x8e')][_0x694b('0x90')][_0x694b('0x91')][_0x694b('0x92')]},function(_0x20336b){return db[_0x694b('0x43')][_0x694b('0x65')]({'where':{'id':_0x1b6390},'transaction':_0x20336b})[_0x694b('0xd')](function(_0x156fb9){if(_0x156fb9){return db[_0x694b('0x93')][_0x694b('0x20')]({'where':{'MailAccountId':_0x1b6390},'transaction':_0x20336b})['then'](function(){var _0x3a7114=_['map'](_0x2f22c3,function(_0x3daa57){_0x3daa57[_0x694b('0x63')]=_0x1b6390;return _0x3daa57;});return db[_0x694b('0x93')][_0x694b('0x94')](_0x3a7114,{'transaction':_0x20336b});});}else{_0x28f1a2=0x194;_0x22bec0=[];}});})['then'](function(){if(_0x28f1a2!==0x194){return db[_0x694b('0x93')][_0x694b('0x95')]({'where':{'MailAccountId':_0x1b6390},'order':_0x694b('0x96')})[_0x694b('0xd')](function(_0x3de8a1){_0x22bec0=_0x3de8a1;});}})[_0x694b('0x16')](function(_0xbb3c96){_0x28f1a2=0x1f4;logger[_0x694b('0x12')](_0xbb3c96['stack']);if(_0xbb3c96[_0x694b('0x25')]){delete _0xbb3c96[_0x694b('0x25')];}_0x22bec0=_0xbb3c96;})['finally'](function(){if(_0x22bec0===null){_0x3a079c['sendStatus'](_0x28f1a2);}else{if(_0x28f1a2===0x1f4){_0x3a079c[_0x694b('0x17')](_0x28f1a2)[_0x694b('0x97')](_0x22bec0);}else{_0x3a079c[_0x694b('0x17')](_0x28f1a2)['json'](_0x22bec0);}}});};exports[_0x694b('0x98')]=function(_0x5586a8,_0x36cf5f){var _0xaa21cd={};var _0x102061={};var _0x4f205c;var _0x1c931f;return db[_0x694b('0x43')][_0x694b('0x65')]({'where':{'id':_0x5586a8[_0x694b('0x5c')]['id']}})['then'](handleEntityNotFound(_0x36cf5f,null))[_0x694b('0xd')](function(_0x3da7f4){if(_0x3da7f4){_0x4f205c=_0x3da7f4;_0x102061['model']=_[_0x694b('0x49')](db[_0x694b('0x93')][_0x694b('0x44')]);_0x102061['query']=_[_0x694b('0x49')](_0x5586a8[_0x694b('0x52')]);_0x102061['filters']=_[_0x694b('0x4c')](_0x102061[_0x694b('0x4b')],_0x102061[_0x694b('0x52')]);_0xaa21cd[_0x694b('0x4e')]=_[_0x694b('0x4c')](_0x102061[_0x694b('0x4b')],qs[_0x694b('0x4d')](_0x5586a8[_0x694b('0x52')][_0x694b('0x4d')]));_0xaa21cd[_0x694b('0x4e')]=_0xaa21cd[_0x694b('0x4e')][_0x694b('0x4f')]?_0xaa21cd[_0x694b('0x4e')]:_0x102061['model'];_0xaa21cd[_0x694b('0x66')]=qs[_0x694b('0x53')](_0x5586a8[_0x694b('0x52')][_0x694b('0x53')]);_0xaa21cd[_0x694b('0x54')]=qs[_0x694b('0x4a')](_[_0x694b('0x67')](_0x5586a8[_0x694b('0x52')],_0x102061[_0x694b('0x4a')]));if(_0x5586a8['query'][_0x694b('0x55')]){_0xaa21cd['where']=_[_0x694b('0x56')](_0xaa21cd[_0x694b('0x54')],{'$or':_['map'](_0xaa21cd[_0x694b('0x4e')],function(_0x1f4d50){var _0x136048={};_0x136048[_0x1f4d50]={'$like':'%'+_0x5586a8[_0x694b('0x52')]['filter']+'%'};return _0x136048;})});}_0xaa21cd=_[_0x694b('0x56')]({},_0xaa21cd,_0x5586a8[_0x694b('0x5e')]);return _0x4f205c[_0x694b('0x98')](_0xaa21cd);}})['then'](function(_0x26cd26){if(_0x26cd26){_0x1c931f=_0x26cd26[_0x694b('0x4f')];if(!_0x5586a8[_0x694b('0x52')][_0x694b('0x50')]('nolimit')){_0xaa21cd[_0x694b('0x1b')]=qs[_0x694b('0x1b')](_0x5586a8[_0x694b('0x52')][_0x694b('0x1b')]);_0xaa21cd[_0x694b('0x1d')]=qs[_0x694b('0x1d')](_0x5586a8['query']['offset']);}return _0x4f205c[_0x694b('0x98')](_0xaa21cd);}})[_0x694b('0xd')](function(_0x538b32){if(_0x538b32){return _0x538b32?{'count':_0x1c931f,'rows':_0x538b32}:null;}})[_0x694b('0xd')](respondWithResult(_0x36cf5f,null))['catch'](handleError(_0x36cf5f,null));};exports[_0x694b('0x99')]=function(_0x3ac796,_0x31d4f4){var _0x2ad427={'raw':!![],'where':{}};var _0x310f05={};var _0x18e816={'count':0x0,'rows':[]};return db[_0x694b('0x43')][_0x694b('0x65')]({'where':{'id':_0x3ac796[_0x694b('0x5c')]['id']}})['then'](handleEntityNotFound(_0x31d4f4,null))[_0x694b('0xd')](function(_0x234dca){if(_0x234dca){_0x310f05[_0x694b('0x4b')]=_['keys'](db[_0x694b('0x9a')][_0x694b('0x44')]);_0x310f05[_0x694b('0x52')]=_[_0x694b('0x49')](_0x3ac796['query']);_0x310f05[_0x694b('0x4a')]=_[_0x694b('0x4c')](_0x310f05[_0x694b('0x4b')],_0x310f05[_0x694b('0x52')]);_0x2ad427[_0x694b('0x4e')]=_[_0x694b('0x4c')](_0x310f05[_0x694b('0x4b')],qs['fields'](_0x3ac796[_0x694b('0x52')][_0x694b('0x4d')]));_0x2ad427[_0x694b('0x4e')]=_0x2ad427[_0x694b('0x4e')][_0x694b('0x4f')]?_0x2ad427[_0x694b('0x4e')]:_0x310f05[_0x694b('0x4b')];if(!_0x3ac796['query'][_0x694b('0x50')](_0x694b('0x51'))){_0x2ad427['limit']=qs[_0x694b('0x1b')](_0x3ac796[_0x694b('0x52')][_0x694b('0x1b')]);_0x2ad427['offset']=qs[_0x694b('0x1d')](_0x3ac796['query']['offset']);}_0x2ad427[_0x694b('0x66')]=qs[_0x694b('0x53')](_0x3ac796[_0x694b('0x52')]['sort']);_0x2ad427[_0x694b('0x54')]=qs['filters'](_['pick'](_0x3ac796[_0x694b('0x52')],_0x310f05[_0x694b('0x4a')]));_0x2ad427[_0x694b('0x54')][_0x694b('0x63')]=_0x234dca['id'];if(_0x3ac796['query']['filter']){_0x2ad427[_0x694b('0x54')]=_['merge'](_0x2ad427[_0x694b('0x54')],{'$or':_[_0x694b('0x48')](_0x2ad427[_0x694b('0x4e')],function(_0x46164b){var _0x5288de={};_0x5288de[_0x46164b]={'$like':'%'+_0x3ac796['query'][_0x694b('0x55')]+'%'};return _0x5288de;})});}if(_0x3ac796[_0x694b('0x52')][_0x694b('0x9b')]){var _0x396941=_0x3ac796[_0x694b('0x52')]['$gte']['split'](',');var _0x5994a4={};_0x5994a4[_0x396941[0x0]]={'$gte':moment(_0x396941[0x1])[_0x694b('0x9c')](_0x694b('0x9d'))};_0x2ad427['where']=_[_0x694b('0x56')](_0x2ad427['where'],_0x5994a4);}_0x2ad427=_[_0x694b('0x56')]({},_0x2ad427,_0x3ac796[_0x694b('0x5e')]);return db[_0x694b('0x9a')][_0x694b('0x1c')]({'where':_0x2ad427[_0x694b('0x54')]})[_0x694b('0xd')](function(_0x343da0){_0x18e816[_0x694b('0x1c')]=_0x343da0;if(_0x3ac796[_0x694b('0x52')]['includeAll']){_0x2ad427[_0x694b('0x58')]=[{'all':!![]}];}return db[_0x694b('0x9a')][_0x694b('0x59')](_0x2ad427);})[_0x694b('0xd')](function(_0x2aefcc){if(_0x3ac796['query']['inlineCss']===_0x694b('0x9e')){for(var _0x429da1=0x0;_0x429da1<_0x2aefcc['length'];_0x429da1++){_0x2aefcc[_0x429da1][_0x694b('0x5f')]=juice(_0x2aefcc[_0x429da1][_0x694b('0x5f')]);}}_0x18e816[_0x694b('0x5a')]=_0x2aefcc;return _0x18e816;});}})[_0x694b('0xd')](respondWithFilteredResult(_0x31d4f4,_0x2ad427))[_0x694b('0x16')](handleError(_0x31d4f4,null));};exports[_0x694b('0x97')]=function(_0x2c2878,_0x37ab4a){var _0x1dc859,_0x34f3d0={},_0x2731a1;if(_0x2c2878[_0x694b('0x5f')]['to']){_0x2731a1=_0x2c2878[_0x694b('0x5f')]['to'][_0x694b('0x9f')](',')[0x0];}return db[_0x694b('0x43')][_0x694b('0x62')]({'where':{'id':_0x2c2878['params']['id']},'include':[{'model':db[_0x694b('0xa0')],'as':_0x694b('0xa1'),'include':[{'model':db[_0x694b('0x86')],'as':_0x694b('0xa2'),'where':{'email':_0x2731a1},'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db[_0x694b('0x40')],'as':_0x694b('0x3d'),'raw':!![],'include':[{'model':db[_0x694b('0xa3')],'as':'CloudProvider','raw':!![]}]}]})[_0x694b('0xd')](handleEntityNotFound(_0x37ab4a,null))['then'](function(_0x235208){if(!_0x235208)return;_0x1dc859=_0x235208;if(!_0x235208['Smtp'])throw new Error(_0x694b('0xa4'));if(_[_0x694b('0x71')](_0x2c2878[_0x694b('0x5f')]['from'])){_0x2c2878[_0x694b('0x5f')]['from']=util[_0x694b('0x9c')](_0x694b('0xa5'),_0x235208[_0x694b('0x25')],_0x235208[_0x694b('0x6f')]||_0x235208[_0x694b('0x3d')]['user']);}if(_0x2c2878[_0x694b('0x5f')][_0x694b('0xa6')]&&_0x2c2878[_0x694b('0x5f')][_0x694b('0xa6')][_0x694b('0x4f')]){for(var _0x3d00e9=0x0;_0x3d00e9<_0x2c2878[_0x694b('0x5f')]['attachments']['length'];_0x3d00e9+=0x1){_0x2c2878['body'][_0x694b('0xa6')][_0x3d00e9]={'filename':_0x2c2878['body'][_0x694b('0xa6')][_0x3d00e9][_0x694b('0x25')],'path':path[_0x694b('0xa7')](config[_0x694b('0xa8')],_0x694b('0xa9'),_0x2c2878[_0x694b('0x5f')][_0x694b('0xa6')][_0x3d00e9]['basename'])};}}var _0x5eb6bc=_0x235208['getSmtpOptions']();return respondWithRpcPromise('SendMail',_0x694b('0xaa'),{'account':_0x5eb6bc,'message':_0x2c2878['body']});})['then'](function(_0x2116e4){if(!_0x2116e4)return;_0x34f3d0=_0x2116e4;if(!_0x1dc859[_0x694b('0xa1')])throw new Error(_0x694b('0xab'));if(_0x1dc859[_0x694b('0xa1')][_0x694b('0xa2')][_0x694b('0x4f')])return _0x1dc859[_0x694b('0xa1')][_0x694b('0xa2')][0x0];return db[_0x694b('0x86')][_0x694b('0x6c')](_['defaults'](_0x2c2878[_0x694b('0x5f')],{'firstName':_0x2c2878[_0x694b('0x5f')]['to'],'email':_0x2c2878[_0x694b('0x5f')]['to'],'phone':_0x2c2878[_0x694b('0x5f')]['to'],'ListId':_0x1dc859[_0x694b('0x70')]}));})['then'](function(_0x17d1bd){if(!_0x17d1bd)return;var _0x4e8744={'UserId':_0x2c2878[_0x694b('0x31')]['id'],'ContactId':_0x17d1bd['id'],'MailAccountId':_0x1dc859['id'],'inReplyTo':_0x34f3d0[_0x694b('0xac')],'to':_0x2c2878[_0x694b('0x5f')]['from'],'cc':_0x2c2878[_0x694b('0x5f')]['cc'],'subject':_0x2c2878['body'][_0x694b('0xad')],'attach':_0x2c2878[_0x694b('0x5f')][_0x694b('0xae')],'firstMsgDirection':_0x694b('0xaf'),'lastMsgAt':moment()[_0x694b('0x9c')](_0x694b('0x9d')),'lastMsgDirection':_0x694b('0xaf'),'Messages':[_['merge'](_0x2c2878[_0x694b('0x5f')],{'messageId':_0x34f3d0[_0x694b('0xac')],'sentAt':moment()[_0x694b('0x9c')]('YYYY-MM-DD\x20HH:mm:ss'),'read':!![],'MailAccountId':_0x1dc859['id'],'UserId':_0x2c2878['user']['id'],'ContactId':_0x17d1bd['id']})]};if(_0x2c2878[_0x694b('0x5f')]['Interaction']){_0x4e8744=_[_0x694b('0x56')](_0x4e8744,_0x2c2878[_0x694b('0x5f')][_0x694b('0xb0')]);}return db[_0x694b('0x85')][_0x694b('0x6c')](_0x4e8744,{'include':[{'model':db[_0x694b('0x9a')],'as':_0x694b('0xb1')}]});})[_0x694b('0xd')](respondWithResult(_0x37ab4a,null))[_0x694b('0x16')](handleError(_0x37ab4a,null));};exports[_0x694b('0xb2')]=function(_0x3a5370,_0x3ab1e4){return db[_0x694b('0x43')]['find']({'where':{'id':_0x3a5370[_0x694b('0x5c')]['id']},'include':[{'model':db['MailServerOut'],'as':_0x694b('0x3d'),'raw':!![],'include':[{'model':db[_0x694b('0xa3')],'as':_0x694b('0xa3'),'raw':!![]}]}]})[_0x694b('0xd')](handleEntityNotFound(_0x3ab1e4,null))[_0x694b('0xd')](function(_0x5b5d1f){if(!_0x5b5d1f[_0x694b('0x3d')])return;var _0x7132b6=_0x5b5d1f['getSmtpOptions']();return respondWithRpcPromise(_0x694b('0xb3'),'verifySmtp',{'account':_0x7132b6});})[_0x694b('0xd')](respondWithResult(_0x3ab1e4,null))['catch'](handleError(_0x3ab1e4,null));};exports[_0x694b('0x20')]=function(_0xa2e2e,_0x5b3168){return db['MailAccount'][_0x694b('0x62')]({'where':{'id':_0xa2e2e[_0x694b('0x5c')]['id']}})['then'](handleEntityNotFound(_0x5b3168,null))['then'](function(_0x1025dd){if(_0x1025dd&&_0x1025dd['service']){throw new db[(_0x694b('0xb4'))]['ValidationError'](_0x694b('0xb5'));}return _0x1025dd;})[_0x694b('0xd')](removeEntity(_0x5b3168,null))[_0x694b('0x16')](handleError(_0x5b3168,null));};exports[_0x694b('0xb6')]=function(_0x1ab1c8,_0x5efe84){return db['MailAccount'][_0x694b('0x62')]({'where':{'id':_0x1ab1c8[_0x694b('0x5c')]['id']}})['then'](handleEntityNotFound(_0x5efe84,null))[_0x694b('0xd')](function(_0x228afc){if(_0x228afc){return _0x228afc['addAgents'](_0x1ab1c8['body']['ids'],_[_0x694b('0x84')](_0x1ab1c8['body'],['ids','id'])||{})[_0x694b('0xb7')](function(_0x5bf832){for(var _0x5f4969=0x0;_0x5f4969<_0x1ab1c8['body']['ids'][_0x694b('0x4f')];_0x5f4969+=0x1){socket[_0x694b('0xb8')](_0x694b('0xb9'),{'UserId':Number(_0x1ab1c8['body'][_0x694b('0x69')][_0x5f4969]),'MailAccountId':Number(_0x1ab1c8['params']['id'])});}return _0x5bf832;});}})['then'](respondWithResult(_0x5efe84,null))['catch'](handleError(_0x5efe84,null));};exports[_0x694b('0xba')]=function(_0x4578f5,_0x42fc0d){return db[_0x694b('0x43')][_0x694b('0x62')]({'where':{'id':_0x4578f5[_0x694b('0x5c')]['id']}})[_0x694b('0xd')](handleEntityNotFound(_0x42fc0d,null))[_0x694b('0xd')](function(_0x3d31ed){if(_0x3d31ed){return _0x3d31ed[_0x694b('0xba')](_0x4578f5[_0x694b('0x52')][_0x694b('0x69')])[_0x694b('0xd')](function(){if(_['isArray'](_0x4578f5['query'][_0x694b('0x69')])){for(var _0x5f3a15=0x0;_0x5f3a15<_0x4578f5[_0x694b('0x52')]['ids'][_0x694b('0x4f')];_0x5f3a15+=0x1){socket[_0x694b('0xb8')](_0x694b('0xbb'),{'UserId':Number(_0x4578f5[_0x694b('0x52')][_0x694b('0x69')][_0x5f3a15]),'MailAccountId':Number(_0x4578f5['params']['id'])});}}else{socket[_0x694b('0xb8')]('userMailAccount:remove',{'UserId':Number(_0x4578f5[_0x694b('0x52')][_0x694b('0x69')]),'MailAccountId':Number(_0x4578f5['params']['id'])});}});}})[_0x694b('0xd')](respondWithStatusCode(_0x42fc0d,null))[_0x694b('0x16')](handleError(_0x42fc0d,null));};exports[_0x694b('0xbc')]=function(_0x25036e,_0x2b6aac){var _0x2f448f={};var _0x144532={};var _0x53bd85;var _0x4f146f;return db[_0x694b('0x43')]['findOne']({'where':{'id':_0x25036e[_0x694b('0x5c')]['id']}})[_0x694b('0xd')](handleEntityNotFound(_0x2b6aac,null))['then'](function(_0x20d826){if(_0x20d826){_0x53bd85=_0x20d826;_0x144532[_0x694b('0x4b')]=_[_0x694b('0x49')](db[_0x694b('0x88')][_0x694b('0x44')]);_0x144532['query']=_['keys'](_0x25036e['query']);_0x144532[_0x694b('0x4a')]=_['intersection'](_0x144532[_0x694b('0x4b')],_0x144532[_0x694b('0x52')]);_0x2f448f[_0x694b('0x4e')]=_['intersection'](_0x144532[_0x694b('0x4b')],qs[_0x694b('0x4d')](_0x25036e['query'][_0x694b('0x4d')]));_0x2f448f[_0x694b('0x4e')]=_0x2f448f[_0x694b('0x4e')]['length']?_0x2f448f[_0x694b('0x4e')]:_0x144532['model'];_0x2f448f['order']=qs[_0x694b('0x53')](_0x25036e[_0x694b('0x52')][_0x694b('0x53')]);_0x2f448f[_0x694b('0x54')]=qs[_0x694b('0x4a')](_[_0x694b('0x67')](_0x25036e['query'],_0x144532[_0x694b('0x4a')]));if(_0x25036e['query'][_0x694b('0x55')]){_0x2f448f[_0x694b('0x54')]=_[_0x694b('0x56')](_0x2f448f[_0x694b('0x54')],{'$or':_['map'](_0x2f448f[_0x694b('0x4e')],function(_0x21b767){var _0x734314={};_0x734314[_0x21b767]={'$like':'%'+_0x25036e['query'][_0x694b('0x55')]+'%'};return _0x734314;})});}_0x2f448f=_[_0x694b('0x56')]({},_0x2f448f,_0x25036e[_0x694b('0x5e')]);return _0x53bd85['getAgents'](_0x2f448f);}})[_0x694b('0xd')](function(_0x3a0310){if(_0x3a0310){_0x4f146f=_0x3a0310[_0x694b('0x4f')];if(!_0x25036e['query']['hasOwnProperty'](_0x694b('0x51'))){_0x2f448f[_0x694b('0x1b')]=qs['limit'](_0x25036e['query']['limit']);_0x2f448f[_0x694b('0x1d')]=qs[_0x694b('0x1d')](_0x25036e[_0x694b('0x52')][_0x694b('0x1d')]);}return _0x53bd85[_0x694b('0xbc')](_0x2f448f);}})['then'](function(_0x24477e){if(_0x24477e){return _0x24477e?{'count':_0x4f146f,'rows':_0x24477e}:null;}})[_0x694b('0xd')](respondWithResult(_0x2b6aac,null))[_0x694b('0x16')](handleError(_0x2b6aac,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 72c7999..5f5c14d 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 _0xd43e=['events','MailAccount','setMaxListeners','save','update','emit','hasOwnProperty','hook'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xd43e,0x88));var _0xed43=function(_0x5e11e6,_0x18584e){_0x5e11e6=_0x5e11e6-0x0;var _0x3f5cbe=_0xd43e[_0x5e11e6];return _0x3f5cbe;};'use strict';var EventEmitter=require(_0xed43('0x0'));var MailAccount=require('../../mysqldb')['db'][_0xed43('0x1')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0xed43('0x2')](0x0);var events={'afterCreate':_0xed43('0x3'),'afterUpdate':_0xed43('0x4'),'afterDestroy':'remove'};function emitEvent(_0x5749a9){return function(_0x2c4a41,_0x2c6a4b,_0x269f36){MailAccountEvents[_0xed43('0x5')](_0x5749a9+':'+_0x2c4a41['id'],_0x2c4a41);MailAccountEvents['emit'](_0x5749a9,_0x2c4a41);_0x269f36(null);};}for(var e in events){if(events[_0xed43('0x6')](e)){var event=events[e];MailAccount[_0xed43('0x7')](e,emitEvent(event));}}module['exports']=MailAccountEvents; \ No newline at end of file +var _0xef7e=['emit','hasOwnProperty','hook','exports','events','MailAccount','setMaxListeners','update'];(function(_0x57014b,_0x360c0f){var _0x2b258a=function(_0x52c4a3){while(--_0x52c4a3){_0x57014b['push'](_0x57014b['shift']());}};_0x2b258a(++_0x360c0f);}(_0xef7e,0x194));var _0xeef7=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xef7e[_0xa464c9];return _0x3d73c4;};'use strict';var EventEmitter=require(_0xeef7('0x0'));var MailAccount=require('../../mysqldb')['db'][_0xeef7('0x1')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0xeef7('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xeef7('0x3'),'afterDestroy':'remove'};function emitEvent(_0x38f950){return function(_0x285e1a,_0x69891e,_0x3f8f09){MailAccountEvents[_0xeef7('0x4')](_0x38f950+':'+_0x285e1a['id'],_0x285e1a);MailAccountEvents[_0xeef7('0x4')](_0x38f950,_0x285e1a);_0x3f8f09(null);};}for(var e in events){if(events[_0xeef7('0x5')](e)){var event=events[e];MailAccount[_0xeef7('0x6')](e,emitEvent(event));}}module[_0xeef7('0x7')]=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index 6861b4f..d98dfc4 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 _0x879a=['secure','authentication','modernAuthentication','CloudProvider','OAuth2','user','data5','auth','pass','./mailAccount.attributes','define','MailAccount','mail_accounts','provider','custom','service','Smtp','host','port'];(function(_0x5820ff,_0x344938){var _0x5f50e1=function(_0x3934fc){while(--_0x3934fc){_0x5820ff['push'](_0x5820ff['shift']());}};_0x5f50e1(++_0x344938);}(_0x879a,0xa1));var _0xa879=function(_0x8c8995,_0x2a31ca){_0x8c8995=_0x8c8995-0x0;var _0x4777cf=_0x879a[_0x8c8995];return _0x4777cf;};'use strict';var attributes=require(_0xa879('0x0'));module['exports']=function(_0x39698e){return _0x39698e[_0xa879('0x1')](_0xa879('0x2'),attributes,{'tableName':_0xa879('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x3b37b3=this;var _0x22d556={'id':_0x3b37b3['id'],'tls':{'rejectUnauthorized':![]}};if(_0x3b37b3[_0xa879('0x4')]!==_0xa879('0x5')){_0x22d556[_0xa879('0x6')]=_0x3b37b3[_0xa879('0x4')];}else{_0x22d556['host']=_0x3b37b3[_0xa879('0x7')][_0xa879('0x8')];_0x22d556[_0xa879('0x9')]=_0x3b37b3[_0xa879('0x7')][_0xa879('0x9')];_0x22d556[_0xa879('0xa')]=_0x3b37b3['Smtp'][_0xa879('0xa')];}if(_0x3b37b3[_0xa879('0x7')][_0xa879('0xb')]){if(_0x3b37b3[_0xa879('0x7')][_0xa879('0xc')]){if(!_0x3b37b3[_0xa879('0x7')][_0xa879('0xd')])throw new Error('Cloud\x20Provider\x20configuration\x20not\x20found');_0x22d556['auth']={'type':_0xa879('0xe'),'user':_0x3b37b3[_0xa879('0x7')][_0xa879('0xf')],'accessToken':_0x3b37b3[_0xa879('0x7')]['CloudProvider'][_0xa879('0x10')]};}else{_0x22d556[_0xa879('0x11')]={'user':_0x3b37b3[_0xa879('0x7')][_0xa879('0xf')],'pass':_0x3b37b3[_0xa879('0x7')][_0xa879('0x12')]};}}return _0x22d556;}}});}; \ No newline at end of file +var _0x56f8=['host','port','Smtp','secure','authentication','modernAuthentication','CloudProvider','Cloud\x20Provider\x20configuration\x20not\x20found','OAuth2','user','pass','exports','define','MailAccount','mail_accounts','provider'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x56f8,0x10b));var _0x856f=function(_0x5df42a,_0xa1ee9c){_0x5df42a=_0x5df42a-0x0;var _0x45d88d=_0x56f8[_0x5df42a];return _0x45d88d;};'use strict';var attributes=require('./mailAccount.attributes');module[_0x856f('0x0')]=function(_0x46abb6){return _0x46abb6[_0x856f('0x1')](_0x856f('0x2'),attributes,{'tableName':_0x856f('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x11b300=this;var _0x3410e7={'id':_0x11b300['id'],'tls':{'rejectUnauthorized':![]}};if(_0x11b300['provider']!=='custom'){_0x3410e7['service']=_0x11b300[_0x856f('0x4')];}else{_0x3410e7[_0x856f('0x5')]=_0x11b300['Smtp'][_0x856f('0x5')];_0x3410e7[_0x856f('0x6')]=_0x11b300[_0x856f('0x7')][_0x856f('0x6')];_0x3410e7[_0x856f('0x8')]=_0x11b300['Smtp'][_0x856f('0x8')];}if(_0x11b300[_0x856f('0x7')][_0x856f('0x9')]){if(_0x11b300[_0x856f('0x7')][_0x856f('0xa')]){if(!_0x11b300['Smtp'][_0x856f('0xb')])throw new Error(_0x856f('0xc'));_0x3410e7['auth']={'type':_0x856f('0xd'),'user':_0x11b300['Smtp']['user'],'accessToken':_0x11b300[_0x856f('0x7')]['CloudProvider']['data5']};}else{_0x3410e7['auth']={'user':_0x11b300['Smtp'][_0x856f('0xe')],'pass':_0x11b300[_0x856f('0x7')][_0x856f('0xf')]};}}return _0x3410e7;}}});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index 163e95e..1b8ab5d 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 _0x7d9f=['ChatOfflineMessageId','UserId','User','name','waitForTheAssignedAgent','queueId','unshift','queue','startRouting','lodash','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','redis','socket.io-emitter','register','request','then','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','error','code','message','MailAccount,\x20%s,\x20%s','info','catch','GetMailAccount','MailAccount','findAll','options','raw','attributes','limit','map','include','model','stringify','ShowMailAccount','find','where','smtp','setDataValue','smtpOptions','NotifyMailAccount','body','difference','keys','CmContact','rawAttributes','createdAt','updatedAt','CompanyId','ListId','from','body\x20is\x20mandatory\x20and\x20not\x20empty','isNil','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','account','CmList','List','Contacts','DESC','MailApplication','Applications','MailServerOut','Smtp','CloudProvider','omit','getSmtpOptions','applications','list','orderBy','priority','asc','autoclose','push','close','*,*,*,*','length','create','List\x20not\x20found','contact','messageId','generate','subject','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailMessage','inReplyTo','MailInteraction','Contact\x20not\x20found','update','interaction','created','attachments','originTo','originCc','bcc','ChatWebsiteId','originChannel','Email'];(function(_0x53fd23,_0xbdb442){var _0x97d025=function(_0x465372){while(--_0x465372){_0x53fd23['push'](_0x53fd23['shift']());}};_0x97d025(++_0xbdb442);}(_0x7d9f,0x15c));var _0xf7d9=function(_0x4d579b,_0x2327f3){_0x4d579b=_0x4d579b-0x0;var _0x288145=_0x7d9f[_0x4d579b];return _0x288145;};'use strict';var _=require(_0xf7d9('0x0'));var moment=require(_0xf7d9('0x1'));var BPromise=require(_0xf7d9('0x2'));var rs=require(_0xf7d9('0x3'));var Redis=require(_0xf7d9('0x4'));var db=require('../../mysqldb')['db'];var logger=require(_0xf7d9('0x5'))(_0xf7d9('0x6'));var config=require(_0xf7d9('0x7'));var jayson=require(_0xf7d9('0x8'));var client=jayson[_0xf7d9('0x9')]['http']({'port':0x232c});config['redis']=_[_0xf7d9('0xa')](config[_0xf7d9('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xf7d9('0xc'))(new Redis(config[_0xf7d9('0xb')]));require('./mailAccount.socket')[_0xf7d9('0xd')](socket);function respondWithRpcPromise(_0x4cd620,_0x265548,_0x33360a){return new BPromise(function(_0x5d2735,_0x560a34){return client[_0xf7d9('0xe')](_0x4cd620,_0x33360a)[_0xf7d9('0xf')](function(_0x2a14e2){logger['info']('MailAccount,\x20%s,\x20%s',_0x265548,_0xf7d9('0x10'));logger[_0xf7d9('0x11')](_0xf7d9('0x12'),_0x265548,_0xf7d9('0x10'),JSON['stringify'](_0x2a14e2));if(_0x2a14e2[_0xf7d9('0x13')]){if(_0x2a14e2[_0xf7d9('0x13')][_0xf7d9('0x14')]===0x1f4){logger[_0xf7d9('0x13')]('MailAccount,\x20%s,\x20%s',_0x265548,_0x2a14e2[_0xf7d9('0x13')][_0xf7d9('0x15')]);return _0x560a34(_0x2a14e2[_0xf7d9('0x13')][_0xf7d9('0x15')]);}logger['error'](_0xf7d9('0x16'),_0x265548,_0x2a14e2[_0xf7d9('0x13')][_0xf7d9('0x15')]);return _0x5d2735(_0x2a14e2['error']['message']);}else{logger[_0xf7d9('0x17')](_0xf7d9('0x16'),_0x265548,_0xf7d9('0x10'));_0x5d2735(_0x2a14e2['result'][_0xf7d9('0x15')]);}})[_0xf7d9('0x18')](function(_0x5eb7c9){logger[_0xf7d9('0x13')]('MailAccount,\x20%s,\x20%s',_0x265548,_0x5eb7c9);_0x560a34(_0x5eb7c9);});});}exports[_0xf7d9('0x19')]=function(_0x1bbc77){var _0x5e0b9e=this;return new Promise(function(_0x34acd2,_0x43dcff){return db[_0xf7d9('0x1a')][_0xf7d9('0x1b')]({'raw':_0x1bbc77[_0xf7d9('0x1c')]?_0x1bbc77[_0xf7d9('0x1c')][_0xf7d9('0x1d')]===undefined?!![]:![]:!![],'where':_0x1bbc77[_0xf7d9('0x1c')]?_0x1bbc77['options']['where']||null:null,'attributes':_0x1bbc77[_0xf7d9('0x1c')]?_0x1bbc77['options'][_0xf7d9('0x1e')]||null:null,'limit':_0x1bbc77[_0xf7d9('0x1c')]?_0x1bbc77['options'][_0xf7d9('0x1f')]||null:null,'include':_0x1bbc77[_0xf7d9('0x1c')]?_0x1bbc77['options']['include']?_[_0xf7d9('0x20')](_0x1bbc77[_0xf7d9('0x1c')][_0xf7d9('0x21')],function(_0x595556){return{'model':db[_0x595556[_0xf7d9('0x22')]],'as':_0x595556['as'],'attributes':_0x595556['attributes'],'include':_0x595556[_0xf7d9('0x21')]?_[_0xf7d9('0x20')](_0x595556[_0xf7d9('0x21')],function(_0x5b1ea5){return{'model':db[_0x5b1ea5[_0xf7d9('0x22')]],'as':_0x5b1ea5['as'],'attributes':_0x5b1ea5[_0xf7d9('0x1e')],'include':_0x5b1ea5[_0xf7d9('0x21')]?_[_0xf7d9('0x20')](_0x5b1ea5[_0xf7d9('0x21')],function(_0x540086){return{'model':db[_0x540086[_0xf7d9('0x22')]],'as':_0x540086['as'],'attributes':_0x540086[_0xf7d9('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xf7d9('0xf')](function(_0x2c04c3){logger['info'](_0xf7d9('0x19'),_0x1bbc77);logger[_0xf7d9('0x11')](_0xf7d9('0x19'),_0x1bbc77,JSON[_0xf7d9('0x23')](_0x2c04c3));_0x34acd2(_0x2c04c3);})[_0xf7d9('0x18')](function(_0x16318f){logger['error']('GetMailAccount',_0x16318f['message'],_0x1bbc77);_0x43dcff(_0x5e0b9e[_0xf7d9('0x13')](0x1f4,_0x16318f['message']));});});};exports[_0xf7d9('0x24')]=function(_0x48c13c){var _0x3ecbb9=this;return new Promise(function(_0x59c246,_0x4ecfbd){return db['MailAccount'][_0xf7d9('0x25')]({'raw':_0x48c13c['options']?_0x48c13c[_0xf7d9('0x1c')][_0xf7d9('0x1d')]===undefined?!![]:![]:!![],'where':_0x48c13c[_0xf7d9('0x1c')]?_0x48c13c[_0xf7d9('0x1c')][_0xf7d9('0x26')]||null:null,'attributes':_0x48c13c[_0xf7d9('0x1c')]?_0x48c13c[_0xf7d9('0x1c')][_0xf7d9('0x1e')]||null:null,'include':_0x48c13c['options']?_0x48c13c[_0xf7d9('0x1c')][_0xf7d9('0x21')]?_['map'](_0x48c13c['options'][_0xf7d9('0x21')],function(_0x1fd532){return{'model':db[_0x1fd532[_0xf7d9('0x22')]],'as':_0x1fd532['as'],'attributes':_0x1fd532['attributes'],'include':_0x1fd532[_0xf7d9('0x21')]?_[_0xf7d9('0x20')](_0x1fd532[_0xf7d9('0x21')],function(_0x1be610){return{'model':db[_0x1be610[_0xf7d9('0x22')]],'as':_0x1be610['as'],'attributes':_0x1be610[_0xf7d9('0x1e')],'include':_0x1be610[_0xf7d9('0x21')]?_[_0xf7d9('0x20')](_0x1be610[_0xf7d9('0x21')],function(_0x1c42bb){return{'model':db[_0x1c42bb[_0xf7d9('0x22')]],'as':_0x1c42bb['as'],'attributes':_0x1c42bb['attributes']};}):[]};}):[]};}):[]:[]})[_0xf7d9('0xf')](function(_0x4ce081){if(_0x48c13c[_0xf7d9('0x1c')][_0xf7d9('0x27')]===!![])_0x4ce081[_0xf7d9('0x28')](_0xf7d9('0x29'),_0x4ce081['getSmtpOptions']());logger['info'](_0xf7d9('0x24'),_0x48c13c);logger['debug'](_0xf7d9('0x24'),_0x48c13c,JSON[_0xf7d9('0x23')](_0x4ce081));_0x59c246(_0x4ce081);})[_0xf7d9('0x18')](function(_0x1e412b){logger['error']('ShowMailAccount',_0x1e412b[_0xf7d9('0x15')],_0x48c13c);_0x4ecfbd(_0x3ecbb9[_0xf7d9('0x13')](0x1f4,_0x1e412b[_0xf7d9('0x15')]));});});};exports[_0xf7d9('0x2a')]=function(_0x4b4389){var _0x17731b=this;return new Promise(function(_0xd6d84f,_0xd7f316){var _0x33e692={'body':_0x4b4389[_0xf7d9('0x2b')],'channel':'mail'};var _0x28c932=_[_0xf7d9('0x2c')](_[_0xf7d9('0x2d')](db[_0xf7d9('0x2e')][_0xf7d9('0x2f')]),[_0xf7d9('0x30'),_0xf7d9('0x31'),_0xf7d9('0x32'),_0xf7d9('0x33')]);var _0x3d056f=![];if(_0x4b4389[_0xf7d9('0x2b')]['id']){delete _0x4b4389[_0xf7d9('0x2b')]['id'];}if(_['isNil'](_0x4b4389[_0xf7d9('0x2b')][_0xf7d9('0x34')])){return _0xd7f316(_0x17731b['error'](0x1f4,'from\x20is\x20mandatory'));}if(_['isNil'](_0x4b4389[_0xf7d9('0x2b')]['body'])||_0x4b4389[_0xf7d9('0x2b')][_0xf7d9('0x2b')]===''){return _0xd7f316(_0x17731b[_0xf7d9('0x13')](0x1f4,_0xf7d9('0x35')));}if(_[_0xf7d9('0x36')](_0x4b4389['body'][_0xf7d9('0x37')])){return _0xd7f316(_0x17731b[_0xf7d9('0x13')](0x1f4,_0xf7d9('0x38')+_0x28c932));}if(!_[_0xf7d9('0x39')](_0x28c932,_0x4b4389[_0xf7d9('0x2b')]['mapKey'])){return _0xd7f316(_0x17731b['error'](0x1f4,_0xf7d9('0x3a')+_0x28c932));}var _0x113a2b={};_0x113a2b[_0x4b4389[_0xf7d9('0x2b')][_0xf7d9('0x37')]]=_0x4b4389[_0xf7d9('0x2b')]['from'];return db[_0xf7d9('0x1a')]['find']({'where':{'id':_0x4b4389[_0xf7d9('0x3b')]['id']},'include':[{'model':db[_0xf7d9('0x3c')],'as':_0xf7d9('0x3d'),'include':[{'model':db[_0xf7d9('0x2e')],'as':_0xf7d9('0x3e'),'where':_0x113a2b,'limit':0x1,'order':[[_0xf7d9('0x31'),_0xf7d9('0x3f')]]}]},{'model':db[_0xf7d9('0x40')],'as':_0xf7d9('0x41')},{'model':db[_0xf7d9('0x42')],'as':_0xf7d9('0x43'),'include':[{'model':db[_0xf7d9('0x44')],'as':_0xf7d9('0x44')}]}]})[_0xf7d9('0xf')](function(_0x50731a){if(_0x50731a&&_0x50731a[_0xf7d9('0x3d')]){var _0x1f1ee5=_0x50731a['get']({'plain':!![]});_0x33e692['account']=_[_0xf7d9('0x45')](_0x1f1ee5,['Applications','List']);_0x33e692[_0xf7d9('0x3b')][_0xf7d9('0x29')]=_0x50731a[_0xf7d9('0x46')]();_0x33e692[_0xf7d9('0x47')]=_0x1f1ee5[_0xf7d9('0x41')];_0x33e692[_0xf7d9('0x48')]=_0x1f1ee5[_0xf7d9('0x3d')];_0x33e692[_0xf7d9('0x47')]=_[_0xf7d9('0x49')](_0x33e692[_0xf7d9('0x47')],[_0xf7d9('0x4a')],[_0xf7d9('0x4b')]);if(_0x33e692['account']&&_0x33e692['account'][_0xf7d9('0x4c')]){_0x33e692[_0xf7d9('0x47')][_0xf7d9('0x4d')]({'id':0x0,'priority':_0x33e692[_0xf7d9('0x47')]['length']+0x1,'app':_0xf7d9('0x4e'),'appdata':_0xf7d9('0x4c'),'interval':_0xf7d9('0x4f')});}if(_0x33e692[_0xf7d9('0x3b')][_0xf7d9('0x41')]){delete _0x33e692[_0xf7d9('0x3b')][_0xf7d9('0x41')];}if(_0x33e692[_0xf7d9('0x3b')][_0xf7d9('0x3d')]){delete _0x33e692[_0xf7d9('0x3b')][_0xf7d9('0x3d')];}if(_0x1f1ee5['List'][_0xf7d9('0x3e')][_0xf7d9('0x50')]){return _0x1f1ee5[_0xf7d9('0x3d')][_0xf7d9('0x3e')][0x0];}var _0x3c3bd3=_[_0xf7d9('0xa')](_0x4b4389['body'],{'firstName':_0x4b4389[_0xf7d9('0x2b')][_0xf7d9('0x34')],'ListId':_0x1f1ee5[_0xf7d9('0x33')]});_0x3c3bd3[_0x4b4389[_0xf7d9('0x2b')][_0xf7d9('0x37')]]=_0x4b4389['body'][_0xf7d9('0x34')];return db[_0xf7d9('0x2e')][_0xf7d9('0x51')](_0x3c3bd3);}else{throw new Error(_0xf7d9('0x52'));}})[_0xf7d9('0xf')](function(_0x379f88){_0x33e692[_0xf7d9('0x53')]=_0x379f88;if(_0x379f88){if(!_0x4b4389[_0xf7d9('0x2b')][_0xf7d9('0x15')][_0xf7d9('0x54')]){_0x4b4389[_0xf7d9('0x2b')][_0xf7d9('0x15')][_0xf7d9('0x54')]=rs[_0xf7d9('0x55')]()+'\x20'+_0x4b4389[_0xf7d9('0x2b')][_0xf7d9('0x15')]['from'];}var _0x310c05={'ContactId':_0x379f88['id'],'MailAccountId':_0x4b4389[_0xf7d9('0x3b')]['id'],'inReplyTo':_0x4b4389['body'][_0xf7d9('0x15')][_0xf7d9('0x54')],'to':_0x4b4389[_0xf7d9('0x2b')][_0xf7d9('0x15')][_0xf7d9('0x34')],'cc':_0x4b4389['body'][_0xf7d9('0x15')]['cc'],'subject':_0x4b4389[_0xf7d9('0x2b')]['message'][_0xf7d9('0x56')],'attach':_0x4b4389[_0xf7d9('0x2b')]['message'][_0xf7d9('0x57')],'lastMsgAt':moment()[_0xf7d9('0x58')](_0xf7d9('0x59')),'lastMsgDirection':'in'};return db['MailInteraction']['find']({'where':{'closed':![],'MailAccountId':_0x4b4389['account']['id']},'include':[{'model':db[_0xf7d9('0x5a')],'as':'Messages','attributes':[_0xf7d9('0x54')],'where':{'messageId':_0x4b4389['body']['message'][_0xf7d9('0x5b')]}}]})[_0xf7d9('0xf')](function(_0x2f469c){if(_0x2f469c){return[_0x2f469c,![]];}return db[_0xf7d9('0x5c')][_0xf7d9('0x51')](_0x310c05)[_0xf7d9('0xf')](function(_0x56feae){return[_0x56feae,!![]];});});}else{throw new Error(_0xf7d9('0x5d'));}})['spread'](function(_0x2ca4e5,_0x3d33f2){if(_0x2ca4e5){_0x3d056f=_0x3d33f2;if(!_0x3d33f2){return _0x2ca4e5[_0xf7d9('0x5e')]({'inReplyTo':_0x4b4389[_0xf7d9('0x2b')][_0xf7d9('0x15')][_0xf7d9('0x54')],'to':_0x4b4389[_0xf7d9('0x2b')]['message']['from'],'cc':_0x4b4389[_0xf7d9('0x2b')][_0xf7d9('0x15')]['cc'],'subject':_0x4b4389['body'][_0xf7d9('0x15')][_0xf7d9('0x56')],'attach':_0x2ca4e5['attach']?_0x2ca4e5[_0xf7d9('0x57')]:_0x4b4389[_0xf7d9('0x2b')][_0xf7d9('0x15')][_0xf7d9('0x57')],'substatus':null,'substatusAt':moment()[_0xf7d9('0x58')](_0xf7d9('0x59')),'lastMsgAt':moment()['format'](_0xf7d9('0x59')),'lastMsgDirection':'in'});}else{return _0x2ca4e5;}}})[_0xf7d9('0xf')](function(_0x5c25d6){_0x33e692[_0xf7d9('0x5f')]=_0x5c25d6['get']({'plain':!![]});_0x33e692[_0xf7d9('0x5f')][_0xf7d9('0x60')]=_0x3d056f;return db['MailMessage']['create']({'body':_0x4b4389[_0xf7d9('0x2b')][_0xf7d9('0x2b')],'MailAccountId':_0x4b4389[_0xf7d9('0x3b')]['id'],'MailInteractionId':_0x5c25d6['id'],'direction':'in','ContactId':_0x33e692[_0xf7d9('0x53')]['id'],'messageId':_0x4b4389['body'][_0xf7d9('0x15')][_0xf7d9('0x54')],'from':_0x4b4389[_0xf7d9('0x2b')][_0xf7d9('0x15')][_0xf7d9('0x34')],'to':_0x4b4389[_0xf7d9('0x2b')][_0xf7d9('0x15')]['to'],'cc':_0x4b4389[_0xf7d9('0x2b')][_0xf7d9('0x15')]['cc'],'subject':_0x4b4389[_0xf7d9('0x2b')][_0xf7d9('0x15')][_0xf7d9('0x56')],'attach':_0x4b4389['body'][_0xf7d9('0x15')][_0xf7d9('0x57')],'Attachments':_0x4b4389[_0xf7d9('0x2b')]['message'][_0xf7d9('0x61')],'originTo':_0x4b4389[_0xf7d9('0x2b')][_0xf7d9('0x15')][_0xf7d9('0x62')],'originCc':_0x4b4389[_0xf7d9('0x2b')][_0xf7d9('0x15')][_0xf7d9('0x63')],'bcc':_0x4b4389[_0xf7d9('0x2b')][_0xf7d9('0x15')][_0xf7d9('0x64')],'ChatWebsiteId':_0x4b4389['body'][_0xf7d9('0x15')][_0xf7d9('0x65')]||null,'originChannel':_0x4b4389[_0xf7d9('0x2b')][_0xf7d9('0x15')][_0xf7d9('0x66')]||_0xf7d9('0x67'),'ChatOfflineMessageId':_0x4b4389[_0xf7d9('0x2b')]['message'][_0xf7d9('0x68')]||null},{'include':[{'model':db['Attachment'],'as':'Attachments'}]});})[_0xf7d9('0xf')](function(_0x437240){_0x33e692[_0xf7d9('0x15')]=_0x437240;if(!_0x33e692[_0xf7d9('0x5f')][_0xf7d9('0x69')]){return;}return db[_0xf7d9('0x6a')][_0xf7d9('0x25')]({'attributes':['id',_0xf7d9('0x6b')],'where':{'id':_0x33e692[_0xf7d9('0x5f')]['UserId']}});})[_0xf7d9('0xf')](function(_0x424774){if(_0x424774){_0x33e692['applications']['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x424774['name']+','+(_0x33e692[_0xf7d9('0x3b')][_0xf7d9('0x6c')]||0xa),'interval':_0xf7d9('0x4f')});}if(!_0x33e692['interaction'][_0xf7d9('0x6d')]){return;}return db['MailQueue'][_0xf7d9('0x25')]({'attributes':['id','name'],'where':{'id':_0x33e692[_0xf7d9('0x5f')]['queueId']}});})[_0xf7d9('0xf')](function(_0x4abd04){if(_0x4abd04){_0x33e692[_0xf7d9('0x47')][_0xf7d9('0x6e')]({'id':0x0,'priority':0x1,'app':_0xf7d9('0x6f'),'appdata':_0x4abd04[_0xf7d9('0x6b')]+','+(_0x33e692[_0xf7d9('0x3b')]['waitForTheAssignedQueue']||0x12c),'interval':_0xf7d9('0x4f')});}return respondWithRpcPromise('Start',_0xf7d9('0x70'),_0x33e692);})[_0xf7d9('0xf')](function(_0x52673b){_0xd6d84f(_0x52673b);})[_0xf7d9('0x18')](function(_0x50ec3c){_0xd7f316(_0x17731b[_0xf7d9('0x13')](0x1f4,_0x50ec3c[_0xf7d9('0x15')]));});});}; \ No newline at end of file +var _0x3c6c=['MailQueue','queue','waitForTheAssignedQueue','Start','startRouting','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','register','request','info','MailAccount,\x20%s,\x20%s','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetMailAccount','MailAccount','findAll','options','raw','where','attributes','limit','include','map','model','then','debug','ShowMailAccount','find','setDataValue','smtpOptions','getSmtpOptions','NotifyMailAccount','mail','difference','keys','CmContact','rawAttributes','createdAt','updatedAt','CompanyId','ListId','body','isNil','from','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','account','CmList','List','Contacts','DESC','MailApplication','Applications','MailServerOut','Smtp','CloudProvider','get','omit','applications','list','orderBy','priority','asc','autoclose','length','*,*,*,*','create','List\x20not\x20found','contact','messageId','generate','subject','attach','MailInteraction','MailMessage','Messages','inReplyTo','Contact\x20not\x20found','spread','update','format','YYYY-MM-DD\x20HH:mm:ss','created','attachments','originTo','originCc','bcc','originChannel','Email','ChatOfflineMessageId','Attachment','Attachments','interaction','UserId','User','name','unshift','agent','waitForTheAssignedAgent','queueId'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x3c6c,0x7b));var _0xc3c6=function(_0x11ae92,_0x4742bb){_0x11ae92=_0x11ae92-0x0;var _0x1b9342=_0x3c6c[_0x11ae92];return _0x1b9342;};'use strict';var _=require(_0xc3c6('0x0'));var moment=require('moment');var BPromise=require(_0xc3c6('0x1'));var rs=require(_0xc3c6('0x2'));var Redis=require(_0xc3c6('0x3'));var db=require(_0xc3c6('0x4'))['db'];var logger=require(_0xc3c6('0x5'))(_0xc3c6('0x6'));var config=require(_0xc3c6('0x7'));var jayson=require(_0xc3c6('0x8'));var client=jayson['client'][_0xc3c6('0x9')]({'port':0x232c});config['redis']=_[_0xc3c6('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./mailAccount.socket')[_0xc3c6('0xb')](socket);function respondWithRpcPromise(_0x1c04d4,_0x5bc1c1,_0x168fdc){return new BPromise(function(_0x1ba453,_0x44b9c9){return client[_0xc3c6('0xc')](_0x1c04d4,_0x168fdc)['then'](function(_0x115b59){logger[_0xc3c6('0xd')](_0xc3c6('0xe'),_0x5bc1c1,'request\x20sent');logger['debug'](_0xc3c6('0xf'),_0x5bc1c1,_0xc3c6('0x10'),JSON[_0xc3c6('0x11')](_0x115b59));if(_0x115b59[_0xc3c6('0x12')]){if(_0x115b59[_0xc3c6('0x12')][_0xc3c6('0x13')]===0x1f4){logger[_0xc3c6('0x12')](_0xc3c6('0xe'),_0x5bc1c1,_0x115b59[_0xc3c6('0x12')][_0xc3c6('0x14')]);return _0x44b9c9(_0x115b59[_0xc3c6('0x12')][_0xc3c6('0x14')]);}logger[_0xc3c6('0x12')](_0xc3c6('0xe'),_0x5bc1c1,_0x115b59[_0xc3c6('0x12')][_0xc3c6('0x14')]);return _0x1ba453(_0x115b59[_0xc3c6('0x12')][_0xc3c6('0x14')]);}else{logger[_0xc3c6('0xd')](_0xc3c6('0xe'),_0x5bc1c1,_0xc3c6('0x10'));_0x1ba453(_0x115b59[_0xc3c6('0x15')][_0xc3c6('0x14')]);}})[_0xc3c6('0x16')](function(_0x3003e1){logger[_0xc3c6('0x12')]('MailAccount,\x20%s,\x20%s',_0x5bc1c1,_0x3003e1);_0x44b9c9(_0x3003e1);});});}exports[_0xc3c6('0x17')]=function(_0x5a2456){var _0x2150e0=this;return new Promise(function(_0x248bfe,_0x3893c4){return db[_0xc3c6('0x18')][_0xc3c6('0x19')]({'raw':_0x5a2456[_0xc3c6('0x1a')]?_0x5a2456[_0xc3c6('0x1a')][_0xc3c6('0x1b')]===undefined?!![]:![]:!![],'where':_0x5a2456[_0xc3c6('0x1a')]?_0x5a2456[_0xc3c6('0x1a')][_0xc3c6('0x1c')]||null:null,'attributes':_0x5a2456[_0xc3c6('0x1a')]?_0x5a2456[_0xc3c6('0x1a')][_0xc3c6('0x1d')]||null:null,'limit':_0x5a2456['options']?_0x5a2456[_0xc3c6('0x1a')][_0xc3c6('0x1e')]||null:null,'include':_0x5a2456[_0xc3c6('0x1a')]?_0x5a2456['options'][_0xc3c6('0x1f')]?_[_0xc3c6('0x20')](_0x5a2456[_0xc3c6('0x1a')][_0xc3c6('0x1f')],function(_0x2bc9bf){return{'model':db[_0x2bc9bf[_0xc3c6('0x21')]],'as':_0x2bc9bf['as'],'attributes':_0x2bc9bf[_0xc3c6('0x1d')],'include':_0x2bc9bf['include']?_[_0xc3c6('0x20')](_0x2bc9bf[_0xc3c6('0x1f')],function(_0x4ca76f){return{'model':db[_0x4ca76f[_0xc3c6('0x21')]],'as':_0x4ca76f['as'],'attributes':_0x4ca76f[_0xc3c6('0x1d')],'include':_0x4ca76f[_0xc3c6('0x1f')]?_[_0xc3c6('0x20')](_0x4ca76f[_0xc3c6('0x1f')],function(_0x420723){return{'model':db[_0x420723[_0xc3c6('0x21')]],'as':_0x420723['as'],'attributes':_0x420723[_0xc3c6('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xc3c6('0x22')](function(_0x478a4b){logger[_0xc3c6('0xd')](_0xc3c6('0x17'),_0x5a2456);logger[_0xc3c6('0x23')](_0xc3c6('0x17'),_0x5a2456,JSON['stringify'](_0x478a4b));_0x248bfe(_0x478a4b);})[_0xc3c6('0x16')](function(_0x1bcc34){logger[_0xc3c6('0x12')](_0xc3c6('0x17'),_0x1bcc34[_0xc3c6('0x14')],_0x5a2456);_0x3893c4(_0x2150e0[_0xc3c6('0x12')](0x1f4,_0x1bcc34['message']));});});};exports[_0xc3c6('0x24')]=function(_0x249bad){var _0x2220ca=this;return new Promise(function(_0x2b715c,_0x380345){return db['MailAccount'][_0xc3c6('0x25')]({'raw':_0x249bad[_0xc3c6('0x1a')]?_0x249bad[_0xc3c6('0x1a')][_0xc3c6('0x1b')]===undefined?!![]:![]:!![],'where':_0x249bad[_0xc3c6('0x1a')]?_0x249bad[_0xc3c6('0x1a')][_0xc3c6('0x1c')]||null:null,'attributes':_0x249bad['options']?_0x249bad[_0xc3c6('0x1a')]['attributes']||null:null,'include':_0x249bad[_0xc3c6('0x1a')]?_0x249bad[_0xc3c6('0x1a')][_0xc3c6('0x1f')]?_[_0xc3c6('0x20')](_0x249bad[_0xc3c6('0x1a')][_0xc3c6('0x1f')],function(_0x4ba1ae){return{'model':db[_0x4ba1ae[_0xc3c6('0x21')]],'as':_0x4ba1ae['as'],'attributes':_0x4ba1ae[_0xc3c6('0x1d')],'include':_0x4ba1ae['include']?_[_0xc3c6('0x20')](_0x4ba1ae[_0xc3c6('0x1f')],function(_0x139944){return{'model':db[_0x139944[_0xc3c6('0x21')]],'as':_0x139944['as'],'attributes':_0x139944[_0xc3c6('0x1d')],'include':_0x139944[_0xc3c6('0x1f')]?_[_0xc3c6('0x20')](_0x139944['include'],function(_0x5daaf2){return{'model':db[_0x5daaf2[_0xc3c6('0x21')]],'as':_0x5daaf2['as'],'attributes':_0x5daaf2[_0xc3c6('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xc3c6('0x22')](function(_0xfe1489){if(_0x249bad[_0xc3c6('0x1a')]['smtp']===!![])_0xfe1489[_0xc3c6('0x26')](_0xc3c6('0x27'),_0xfe1489[_0xc3c6('0x28')]());logger[_0xc3c6('0xd')](_0xc3c6('0x24'),_0x249bad);logger[_0xc3c6('0x23')](_0xc3c6('0x24'),_0x249bad,JSON[_0xc3c6('0x11')](_0xfe1489));_0x2b715c(_0xfe1489);})[_0xc3c6('0x16')](function(_0x52ef62){logger[_0xc3c6('0x12')](_0xc3c6('0x24'),_0x52ef62[_0xc3c6('0x14')],_0x249bad);_0x380345(_0x2220ca[_0xc3c6('0x12')](0x1f4,_0x52ef62[_0xc3c6('0x14')]));});});};exports[_0xc3c6('0x29')]=function(_0x3e839e){var _0x376e90=this;return new Promise(function(_0x59b2d9,_0x30692f){var _0x242e2b={'body':_0x3e839e['body'],'channel':_0xc3c6('0x2a')};var _0x5ea389=_[_0xc3c6('0x2b')](_[_0xc3c6('0x2c')](db[_0xc3c6('0x2d')][_0xc3c6('0x2e')]),[_0xc3c6('0x2f'),_0xc3c6('0x30'),_0xc3c6('0x31'),_0xc3c6('0x32')]);var _0x572339=![];if(_0x3e839e[_0xc3c6('0x33')]['id']){delete _0x3e839e['body']['id'];}if(_[_0xc3c6('0x34')](_0x3e839e[_0xc3c6('0x33')][_0xc3c6('0x35')])){return _0x30692f(_0x376e90[_0xc3c6('0x12')](0x1f4,'from\x20is\x20mandatory'));}if(_['isNil'](_0x3e839e[_0xc3c6('0x33')][_0xc3c6('0x33')])||_0x3e839e[_0xc3c6('0x33')][_0xc3c6('0x33')]===''){return _0x30692f(_0x376e90['error'](0x1f4,_0xc3c6('0x36')));}if(_[_0xc3c6('0x34')](_0x3e839e[_0xc3c6('0x33')][_0xc3c6('0x37')])){return _0x30692f(_0x376e90[_0xc3c6('0x12')](0x1f4,_0xc3c6('0x38')+_0x5ea389));}if(!_[_0xc3c6('0x39')](_0x5ea389,_0x3e839e['body']['mapKey'])){return _0x30692f(_0x376e90[_0xc3c6('0x12')](0x1f4,_0xc3c6('0x3a')+_0x5ea389));}var _0x490bbf={};_0x490bbf[_0x3e839e[_0xc3c6('0x33')][_0xc3c6('0x37')]]=_0x3e839e['body'][_0xc3c6('0x35')];return db[_0xc3c6('0x18')]['find']({'where':{'id':_0x3e839e[_0xc3c6('0x3b')]['id']},'include':[{'model':db[_0xc3c6('0x3c')],'as':_0xc3c6('0x3d'),'include':[{'model':db[_0xc3c6('0x2d')],'as':_0xc3c6('0x3e'),'where':_0x490bbf,'limit':0x1,'order':[[_0xc3c6('0x30'),_0xc3c6('0x3f')]]}]},{'model':db[_0xc3c6('0x40')],'as':_0xc3c6('0x41')},{'model':db[_0xc3c6('0x42')],'as':_0xc3c6('0x43'),'include':[{'model':db[_0xc3c6('0x44')],'as':_0xc3c6('0x44')}]}]})[_0xc3c6('0x22')](function(_0x55b8bc){if(_0x55b8bc&&_0x55b8bc['List']){var _0x387a41=_0x55b8bc[_0xc3c6('0x45')]({'plain':!![]});_0x242e2b[_0xc3c6('0x3b')]=_[_0xc3c6('0x46')](_0x387a41,['Applications','List']);_0x242e2b[_0xc3c6('0x3b')][_0xc3c6('0x27')]=_0x55b8bc[_0xc3c6('0x28')]();_0x242e2b[_0xc3c6('0x47')]=_0x387a41[_0xc3c6('0x41')];_0x242e2b[_0xc3c6('0x48')]=_0x387a41[_0xc3c6('0x3d')];_0x242e2b[_0xc3c6('0x47')]=_[_0xc3c6('0x49')](_0x242e2b[_0xc3c6('0x47')],[_0xc3c6('0x4a')],[_0xc3c6('0x4b')]);if(_0x242e2b[_0xc3c6('0x3b')]&&_0x242e2b[_0xc3c6('0x3b')][_0xc3c6('0x4c')]){_0x242e2b[_0xc3c6('0x47')]['push']({'id':0x0,'priority':_0x242e2b[_0xc3c6('0x47')][_0xc3c6('0x4d')]+0x1,'app':'close','appdata':'autoclose','interval':_0xc3c6('0x4e')});}if(_0x242e2b[_0xc3c6('0x3b')][_0xc3c6('0x41')]){delete _0x242e2b[_0xc3c6('0x3b')][_0xc3c6('0x41')];}if(_0x242e2b[_0xc3c6('0x3b')][_0xc3c6('0x3d')]){delete _0x242e2b['account']['List'];}if(_0x387a41[_0xc3c6('0x3d')][_0xc3c6('0x3e')][_0xc3c6('0x4d')]){return _0x387a41[_0xc3c6('0x3d')][_0xc3c6('0x3e')][0x0];}var _0x2e9314=_[_0xc3c6('0xa')](_0x3e839e[_0xc3c6('0x33')],{'firstName':_0x3e839e[_0xc3c6('0x33')]['from'],'ListId':_0x387a41[_0xc3c6('0x32')]});_0x2e9314[_0x3e839e['body']['mapKey']]=_0x3e839e[_0xc3c6('0x33')][_0xc3c6('0x35')];return db[_0xc3c6('0x2d')][_0xc3c6('0x4f')](_0x2e9314);}else{throw new Error(_0xc3c6('0x50'));}})[_0xc3c6('0x22')](function(_0x330cfc){_0x242e2b[_0xc3c6('0x51')]=_0x330cfc;if(_0x330cfc){if(!_0x3e839e[_0xc3c6('0x33')][_0xc3c6('0x14')]['messageId']){_0x3e839e[_0xc3c6('0x33')]['message'][_0xc3c6('0x52')]=rs[_0xc3c6('0x53')]()+'\x20'+_0x3e839e[_0xc3c6('0x33')]['message'][_0xc3c6('0x35')];}var _0x528383={'ContactId':_0x330cfc['id'],'MailAccountId':_0x3e839e['account']['id'],'inReplyTo':_0x3e839e['body'][_0xc3c6('0x14')][_0xc3c6('0x52')],'to':_0x3e839e[_0xc3c6('0x33')][_0xc3c6('0x14')][_0xc3c6('0x35')],'cc':_0x3e839e[_0xc3c6('0x33')][_0xc3c6('0x14')]['cc'],'subject':_0x3e839e[_0xc3c6('0x33')][_0xc3c6('0x14')][_0xc3c6('0x54')],'attach':_0x3e839e[_0xc3c6('0x33')][_0xc3c6('0x14')][_0xc3c6('0x55')],'lastMsgAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'};return db[_0xc3c6('0x56')][_0xc3c6('0x25')]({'where':{'closed':![],'MailAccountId':_0x3e839e[_0xc3c6('0x3b')]['id']},'include':[{'model':db[_0xc3c6('0x57')],'as':_0xc3c6('0x58'),'attributes':[_0xc3c6('0x52')],'where':{'messageId':_0x3e839e[_0xc3c6('0x33')]['message'][_0xc3c6('0x59')]}}]})['then'](function(_0x1709a8){if(_0x1709a8){return[_0x1709a8,![]];}return db['MailInteraction'][_0xc3c6('0x4f')](_0x528383)[_0xc3c6('0x22')](function(_0x5cc468){return[_0x5cc468,!![]];});});}else{throw new Error(_0xc3c6('0x5a'));}})[_0xc3c6('0x5b')](function(_0x333d8f,_0x501847){if(_0x333d8f){_0x572339=_0x501847;if(!_0x501847){return _0x333d8f[_0xc3c6('0x5c')]({'inReplyTo':_0x3e839e[_0xc3c6('0x33')][_0xc3c6('0x14')][_0xc3c6('0x52')],'to':_0x3e839e[_0xc3c6('0x33')]['message']['from'],'cc':_0x3e839e[_0xc3c6('0x33')]['message']['cc'],'subject':_0x3e839e[_0xc3c6('0x33')][_0xc3c6('0x14')]['subject'],'attach':_0x333d8f[_0xc3c6('0x55')]?_0x333d8f[_0xc3c6('0x55')]:_0x3e839e['body']['message'][_0xc3c6('0x55')],'substatus':null,'substatusAt':moment()[_0xc3c6('0x5d')](_0xc3c6('0x5e')),'lastMsgAt':moment()['format'](_0xc3c6('0x5e')),'lastMsgDirection':'in'});}else{return _0x333d8f;}}})['then'](function(_0x3dd6d2){_0x242e2b['interaction']=_0x3dd6d2['get']({'plain':!![]});_0x242e2b['interaction'][_0xc3c6('0x5f')]=_0x572339;return db['MailMessage'][_0xc3c6('0x4f')]({'body':_0x3e839e[_0xc3c6('0x33')][_0xc3c6('0x33')],'MailAccountId':_0x3e839e[_0xc3c6('0x3b')]['id'],'MailInteractionId':_0x3dd6d2['id'],'direction':'in','ContactId':_0x242e2b['contact']['id'],'messageId':_0x3e839e['body']['message']['messageId'],'from':_0x3e839e[_0xc3c6('0x33')][_0xc3c6('0x14')][_0xc3c6('0x35')],'to':_0x3e839e['body'][_0xc3c6('0x14')]['to'],'cc':_0x3e839e[_0xc3c6('0x33')][_0xc3c6('0x14')]['cc'],'subject':_0x3e839e[_0xc3c6('0x33')]['message']['subject'],'attach':_0x3e839e[_0xc3c6('0x33')][_0xc3c6('0x14')][_0xc3c6('0x55')],'Attachments':_0x3e839e[_0xc3c6('0x33')][_0xc3c6('0x14')][_0xc3c6('0x60')],'originTo':_0x3e839e[_0xc3c6('0x33')][_0xc3c6('0x14')][_0xc3c6('0x61')],'originCc':_0x3e839e[_0xc3c6('0x33')][_0xc3c6('0x14')][_0xc3c6('0x62')],'bcc':_0x3e839e[_0xc3c6('0x33')][_0xc3c6('0x14')][_0xc3c6('0x63')],'ChatWebsiteId':_0x3e839e[_0xc3c6('0x33')][_0xc3c6('0x14')]['ChatWebsiteId']||null,'originChannel':_0x3e839e[_0xc3c6('0x33')]['message'][_0xc3c6('0x64')]||_0xc3c6('0x65'),'ChatOfflineMessageId':_0x3e839e['body'][_0xc3c6('0x14')][_0xc3c6('0x66')]||null},{'include':[{'model':db[_0xc3c6('0x67')],'as':_0xc3c6('0x68')}]});})[_0xc3c6('0x22')](function(_0x408544){_0x242e2b[_0xc3c6('0x14')]=_0x408544;if(!_0x242e2b[_0xc3c6('0x69')][_0xc3c6('0x6a')]){return;}return db[_0xc3c6('0x6b')][_0xc3c6('0x25')]({'attributes':['id',_0xc3c6('0x6c')],'where':{'id':_0x242e2b['interaction'][_0xc3c6('0x6a')]}});})[_0xc3c6('0x22')](function(_0x25c747){if(_0x25c747){_0x242e2b[_0xc3c6('0x47')][_0xc3c6('0x6d')]({'id':0x0,'priority':0x0,'app':_0xc3c6('0x6e'),'appdata':_0x25c747[_0xc3c6('0x6c')]+','+(_0x242e2b['account'][_0xc3c6('0x6f')]||0xa),'interval':_0xc3c6('0x4e')});}if(!_0x242e2b[_0xc3c6('0x69')][_0xc3c6('0x70')]){return;}return db[_0xc3c6('0x71')]['find']({'attributes':['id',_0xc3c6('0x6c')],'where':{'id':_0x242e2b[_0xc3c6('0x69')]['queueId']}});})[_0xc3c6('0x22')](function(_0x104038){if(_0x104038){_0x242e2b[_0xc3c6('0x47')][_0xc3c6('0x6d')]({'id':0x0,'priority':0x1,'app':_0xc3c6('0x72'),'appdata':_0x104038[_0xc3c6('0x6c')]+','+(_0x242e2b[_0xc3c6('0x3b')][_0xc3c6('0x73')]||0x12c),'interval':_0xc3c6('0x4e')});}return respondWithRpcPromise(_0xc3c6('0x74'),_0xc3c6('0x75'),_0x242e2b);})[_0xc3c6('0x22')](function(_0x2ec1b5){_0x59b2d9(_0x2ec1b5);})['catch'](function(_0x2e7a09){_0x30692f(_0x376e90[_0xc3c6('0x12')](0x1f4,_0x2e7a09[_0xc3c6('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 47c3442..ad5bffc 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 _0x9672=['update','removeListener','length','mailAccount:','./mailAccount.events','save'];(function(_0x17809c,_0xa6ceb9){var _0x144a29=function(_0x44b044){while(--_0x44b044){_0x17809c['push'](_0x17809c['shift']());}};_0x144a29(++_0xa6ceb9);}(_0x9672,0xee));var _0x2967=function(_0x32cfc0,_0x44debf){_0x32cfc0=_0x32cfc0-0x0;var _0x4855b9=_0x9672[_0x32cfc0];return _0x4855b9;};'use strict';var MailAccountEvents=require(_0x2967('0x0'));var events=[_0x2967('0x1'),'remove',_0x2967('0x2')];function createListener(_0xcaaf25,_0x1228b8){return function(_0xb323a5){_0x1228b8['emit'](_0xcaaf25,_0xb323a5);};}function removeListener(_0x264152,_0xa53659){return function(){MailAccountEvents[_0x2967('0x3')](_0x264152,_0xa53659);};}exports['register']=function(_0x4baad7){for(var _0x24424d=0x0,_0x355e82=events[_0x2967('0x4')];_0x24424d<_0x355e82;_0x24424d++){var _0x77f846=events[_0x24424d];var _0x3bcd7e=createListener(_0x2967('0x5')+_0x77f846,_0x4baad7);MailAccountEvents['on'](_0x77f846,_0x3bcd7e);}}; \ No newline at end of file +var _0xa3c3=['mailAccount:','./mailAccount.events','remove','emit','removeListener','register','length'];(function(_0x1d6a2a,_0x51fd31){var _0x5e4b08=function(_0x5e2483){while(--_0x5e2483){_0x1d6a2a['push'](_0x1d6a2a['shift']());}};_0x5e4b08(++_0x51fd31);}(_0xa3c3,0xcc));var _0x3a3c=function(_0x14c147,_0xcd1b95){_0x14c147=_0x14c147-0x0;var _0x1ff78e=_0xa3c3[_0x14c147];return _0x1ff78e;};'use strict';var MailAccountEvents=require(_0x3a3c('0x0'));var events=['save',_0x3a3c('0x1'),'update'];function createListener(_0x265303,_0x50df75){return function(_0x13e0cd){_0x50df75[_0x3a3c('0x2')](_0x265303,_0x13e0cd);};}function removeListener(_0x4f143e,_0x44527e){return function(){MailAccountEvents[_0x3a3c('0x3')](_0x4f143e,_0x44527e);};}exports[_0x3a3c('0x4')]=function(_0x1b4fc1){for(var _0x5600b3=0x0,_0x5557ec=events[_0x3a3c('0x5')];_0x5600b3<_0x5557ec;_0x5600b3++){var _0x41a760=events[_0x5600b3];var _0x32f0f3=createListener(_0x3a3c('0x6')+_0x41a760,_0x1b4fc1);MailAccountEvents['on'](_0x41a760,_0x32f0f3);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 84d4862..f35af82 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 _0x34ac=['get','/:id','isAuthenticated','update','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailApplication.controller'];(function(_0x5ddc42,_0x5615ea){var _0x36bc75=function(_0x578150){while(--_0x578150){_0x5ddc42['push'](_0x5ddc42['shift']());}};_0x36bc75(++_0x5615ea);}(_0x34ac,0xe7));var _0xc34a=function(_0x348e31,_0x5713f4){_0x348e31=_0x348e31-0x0;var _0xd3fd8e=_0x34ac[_0x348e31];return _0xd3fd8e;};'use strict';var multer=require(_0xc34a('0x0'));var util=require(_0xc34a('0x1'));var path=require(_0xc34a('0x2'));var timeout=require(_0xc34a('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xc34a('0x4'));var auth=require(_0xc34a('0x5'));var interaction=require(_0xc34a('0x6'));var config=require(_0xc34a('0x7'));var controller=require(_0xc34a('0x8'));router[_0xc34a('0x9')](_0xc34a('0xa'),auth[_0xc34a('0xb')](),controller['show']);router['put']('/:id',auth[_0xc34a('0xb')](),controller[_0xc34a('0xc')]);router['delete']('/:id',auth[_0xc34a('0xb')](),controller[_0xc34a('0xd')]);module[_0xc34a('0xe')]=router; \ No newline at end of file +var _0xd37c=['exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailApplication.controller','get','/:id','isAuthenticated','show','put','delete','destroy'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xd37c,0x91));var _0xcd37=function(_0x35c772,_0xd85ffb){_0x35c772=_0x35c772-0x0;var _0x130bb7=_0xd37c[_0x35c772];return _0x130bb7;};'use strict';var multer=require(_0xcd37('0x0'));var util=require(_0xcd37('0x1'));var path=require('path');var timeout=require(_0xcd37('0x2'));var express=require(_0xcd37('0x3'));var router=express[_0xcd37('0x4')]();var fs_extra=require(_0xcd37('0x5'));var auth=require(_0xcd37('0x6'));var interaction=require(_0xcd37('0x7'));var config=require(_0xcd37('0x8'));var controller=require(_0xcd37('0x9'));router[_0xcd37('0xa')](_0xcd37('0xb'),auth[_0xcd37('0xc')](),controller[_0xcd37('0xd')]);router[_0xcd37('0xe')](_0xcd37('0xb'),auth[_0xcd37('0xc')](),controller['update']);router[_0xcd37('0xf')](_0xcd37('0xb'),auth[_0xcd37('0xc')](),controller[_0xcd37('0x10')]);module[_0xcd37('0x11')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index 0f14780..8e263ac 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 _0x25a5=['TEXT','*,*,*,*','sequelize','INTEGER','STRING'];(function(_0x3a18f3,_0xa6b079){var _0x431120=function(_0x3ce96e){while(--_0x3ce96e){_0x3a18f3['push'](_0x3a18f3['shift']());}};_0x431120(++_0xa6b079);}(_0x25a5,0xa2));var _0x525a=function(_0x4e5c44,_0x4865ee){_0x4e5c44=_0x4e5c44-0x0;var _0x50f8a3=_0x25a5[_0x4e5c44];return _0x50f8a3;};'use strict';var Sequelize=require(_0x525a('0x0'));module['exports']={'priority':{'type':Sequelize[_0x525a('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x525a('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x525a('0x3')]()},'description':{'type':Sequelize[_0x525a('0x2')]},'interval':{'type':Sequelize[_0x525a('0x2')],'defaultValue':_0x525a('0x4')}}; \ No newline at end of file +var _0xdabc=['sequelize','INTEGER','noop','TEXT','STRING','*,*,*,*'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdabc,0x1ce));var _0xcdab=function(_0x5ef35e,_0x329db7){_0x5ef35e=_0x5ef35e-0x0;var _0x4cdc0c=_0xdabc[_0x5ef35e];return _0x4cdc0c;};'use strict';var Sequelize=require(_0xcdab('0x0'));module['exports']={'priority':{'type':Sequelize[_0xcdab('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xcdab('0x2')},'appdata':{'type':Sequelize[_0xcdab('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xcdab('0x4')],'defaultValue':_0xcdab('0x5')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 4d67dfc..a3559fb 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 _0x70e0=['util','sox','ejs','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','count','limit','set','apply','save','update','then','error','stack','name','send','show','model','keys','MailApplication','query','filters','attributes','intersection','length','includeAll','include','find','catch','body','params','eml-format','rimraf','zip-dir','moment','bluebird','mustache'];(function(_0x38622b,_0x3cfdf7){var _0x2c1a7a=function(_0x5de9cc){while(--_0x5de9cc){_0x38622b['push'](_0x38622b['shift']());}};_0x2c1a7a(++_0x3cfdf7);}(_0x70e0,0x17b));var _0x070e=function(_0x17a462,_0x16fdef){_0x17a462=_0x17a462-0x0;var _0x46398a=_0x70e0[_0x17a462];return _0x46398a;};'use strict';var emlformat=require(_0x070e('0x0'));var rimraf=require(_0x070e('0x1'));var zipdir=require(_0x070e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x070e('0x3'));var BPromise=require(_0x070e('0x4'));var Mustache=require(_0x070e('0x5'));var util=require(_0x070e('0x6'));var path=require('path');var sox=require(_0x070e('0x7'));var csv=require('to-csv');var ejs=require(_0x070e('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x070e('0x9'));var jsforce=require(_0x070e('0xa'));var deskjs=require(_0x070e('0xb'));var toCsv=require(_0x070e('0xc'));var querystring=require(_0x070e('0xd'));var Papa=require(_0x070e('0xe'));var Redis=require(_0x070e('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x070e('0x10'));var hardwareService=require(_0x070e('0x11'));var logger=require(_0x070e('0x12'))(_0x070e('0x13'));var utils=require(_0x070e('0x14'));var config=require(_0x070e('0x15'));var licenseUtil=require(_0x070e('0x16'));var db=require(_0x070e('0x17'))['db'];function respondWithStatusCode(_0x39d2b9,_0x5bf079){_0x5bf079=_0x5bf079||0xcc;return function(_0x2930b8){if(_0x2930b8){return _0x39d2b9['sendStatus'](_0x5bf079);}return _0x39d2b9['status'](_0x5bf079)[_0x070e('0x18')]();};}function respondWithResult(_0x56c7ba,_0x4a33d2){_0x4a33d2=_0x4a33d2||0xc8;return function(_0x5bae0f){if(_0x5bae0f){return _0x56c7ba[_0x070e('0x19')](_0x4a33d2)[_0x070e('0x1a')](_0x5bae0f);}};}function respondWithFilteredResult(_0x51d14d,_0x5d3a38){return function(_0x373d86){if(_0x373d86){var _0xeae1a5=typeof _0x5d3a38[_0x070e('0x1b')]===_0x070e('0x1c')&&typeof _0x5d3a38['limit']==='undefined';var _0x17e2e4=_0x373d86[_0x070e('0x1d')];var _0x38f6e6=_0xeae1a5?0x0:_0x5d3a38[_0x070e('0x1b')];var _0x364b3f=_0xeae1a5?_0x373d86['count']:_0x5d3a38[_0x070e('0x1b')]+_0x5d3a38[_0x070e('0x1e')];var _0x1ad3de;if(_0x364b3f>=_0x17e2e4){_0x364b3f=_0x17e2e4;_0x1ad3de=0xc8;}else{_0x1ad3de=0xce;}_0x51d14d[_0x070e('0x19')](_0x1ad3de);return _0x51d14d[_0x070e('0x1f')]('Content-Range',_0x38f6e6+'-'+_0x364b3f+'/'+_0x17e2e4)['json'](_0x373d86);}return null;};}function patchUpdates(_0x4e958f){return function(_0x9907cf){try{jsonpatch[_0x070e('0x20')](_0x9907cf,_0x4e958f,!![]);}catch(_0x20dc60){return BPromise['reject'](_0x20dc60);}return _0x9907cf[_0x070e('0x21')]();};}function saveUpdates(_0x5dc5d2,_0xf8dd5d){return function(_0x3f6985){if(_0x3f6985){return _0x3f6985[_0x070e('0x22')](_0x5dc5d2)[_0x070e('0x23')](function(_0x28a1c3){return _0x28a1c3;});}return null;};}function removeEntity(_0xa86797,_0xe405e){return function(_0x164cdf){if(_0x164cdf){return _0x164cdf['destroy']()[_0x070e('0x23')](function(){_0xa86797[_0x070e('0x19')](0xcc)[_0x070e('0x18')]();});}};}function handleEntityNotFound(_0x503f4d,_0xf17c56){return function(_0x5f3e9d){if(!_0x5f3e9d){_0x503f4d['sendStatus'](0x194);}return _0x5f3e9d;};}function handleError(_0x2ccbd7,_0x25f6e){_0x25f6e=_0x25f6e||0x1f4;return function(_0x41deb1){logger[_0x070e('0x24')](_0x41deb1[_0x070e('0x25')]);if(_0x41deb1['name']){delete _0x41deb1[_0x070e('0x26')];}_0x2ccbd7[_0x070e('0x19')](_0x25f6e)[_0x070e('0x27')](_0x41deb1);};}exports[_0x070e('0x28')]=function(_0x43dd96,_0x28d7f2){var _0x1a1892={'raw':!![],'where':{'id':_0x43dd96['params']['id']}},_0x26373b={};_0x26373b[_0x070e('0x29')]=_[_0x070e('0x2a')](db[_0x070e('0x2b')]['rawAttributes']);_0x26373b['query']=_[_0x070e('0x2a')](_0x43dd96[_0x070e('0x2c')]);_0x26373b[_0x070e('0x2d')]=_['intersection'](_0x26373b[_0x070e('0x29')],_0x26373b[_0x070e('0x2c')]);_0x1a1892[_0x070e('0x2e')]=_[_0x070e('0x2f')](_0x26373b['model'],qs['fields'](_0x43dd96['query']['fields']));_0x1a1892[_0x070e('0x2e')]=_0x1a1892['attributes'][_0x070e('0x30')]?_0x1a1892[_0x070e('0x2e')]:_0x26373b['model'];if(_0x43dd96['query'][_0x070e('0x31')]){_0x1a1892[_0x070e('0x32')]=[{'all':!![]}];}_0x1a1892=_['merge']({},_0x1a1892,_0x43dd96['options']);return db[_0x070e('0x2b')][_0x070e('0x33')](_0x1a1892)[_0x070e('0x23')](handleEntityNotFound(_0x28d7f2,null))[_0x070e('0x23')](respondWithResult(_0x28d7f2,null))[_0x070e('0x34')](handleError(_0x28d7f2,null));};exports['update']=function(_0x482cc2,_0x24d17d){if(_0x482cc2[_0x070e('0x35')]['id']){delete _0x482cc2[_0x070e('0x35')]['id'];}return db[_0x070e('0x2b')][_0x070e('0x33')]({'where':{'id':_0x482cc2['params']['id']}})[_0x070e('0x23')](handleEntityNotFound(_0x24d17d,null))[_0x070e('0x23')](saveUpdates(_0x482cc2['body'],null))[_0x070e('0x23')](respondWithResult(_0x24d17d,null))[_0x070e('0x34')](handleError(_0x24d17d,null));};exports['destroy']=function(_0x4d4ee8,_0x5ddbe9){return db[_0x070e('0x2b')][_0x070e('0x33')]({'where':{'id':_0x4d4ee8[_0x070e('0x36')]['id']}})[_0x070e('0x23')](handleEntityNotFound(_0x5ddbe9,null))[_0x070e('0x23')](removeEntity(_0x5ddbe9,null))['catch'](handleError(_0x5ddbe9,null));}; \ No newline at end of file +var _0xa9e0=['includeAll','merge','options','find','catch','body','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','show','params','model','MailApplication','rawAttributes','query','keys','filters','intersection','attributes','fields','length'];(function(_0x5da43a,_0x13b558){var _0x110446=function(_0x16ef90){while(--_0x16ef90){_0x5da43a['push'](_0x5da43a['shift']());}};_0x110446(++_0x13b558);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0xa9e0[_0x47e7cb];return _0x2a8874;};'use strict';var emlformat=require(_0x0a9e('0x0'));var rimraf=require(_0x0a9e('0x1'));var zipdir=require(_0x0a9e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0a9e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0a9e('0x4'));var util=require(_0x0a9e('0x5'));var path=require(_0x0a9e('0x6'));var sox=require(_0x0a9e('0x7'));var csv=require(_0x0a9e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0a9e('0x9'));var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];function respondWithStatusCode(_0xd5b662,_0x26d672){_0x26d672=_0x26d672||0xcc;return function(_0x32d742){if(_0x32d742){return _0xd5b662[_0x0a9e('0x15')](_0x26d672);}return _0xd5b662['status'](_0x26d672)[_0x0a9e('0x16')]();};}function respondWithResult(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0xc8;return function(_0x281129){if(_0x281129){return _0x239b12[_0x0a9e('0x17')](_0x2b4227)[_0x0a9e('0x18')](_0x281129);}};}function respondWithFilteredResult(_0x52a03d,_0x22dccb){return function(_0x5d0880){if(_0x5d0880){var _0x1985b6=typeof _0x22dccb['offset']===_0x0a9e('0x19')&&typeof _0x22dccb[_0x0a9e('0x1a')]==='undefined';var _0x225616=_0x5d0880['count'];var _0x459eb1=_0x1985b6?0x0:_0x22dccb[_0x0a9e('0x1b')];var _0x106033=_0x1985b6?_0x5d0880[_0x0a9e('0x1c')]:_0x22dccb[_0x0a9e('0x1b')]+_0x22dccb[_0x0a9e('0x1a')];var _0x530eb7;if(_0x106033>=_0x225616){_0x106033=_0x225616;_0x530eb7=0xc8;}else{_0x530eb7=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x530eb7);return _0x52a03d[_0x0a9e('0x1d')](_0x0a9e('0x1e'),_0x459eb1+'-'+_0x106033+'/'+_0x225616)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x105080){return function(_0x4bb1e3){try{jsonpatch[_0x0a9e('0x1f')](_0x4bb1e3,_0x105080,!![]);}catch(_0x155cce){return BPromise['reject'](_0x155cce);}return _0x4bb1e3[_0x0a9e('0x20')]();};}function saveUpdates(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')](_0x5a09ef)[_0x0a9e('0x22')](function(_0x30bae6){return _0x30bae6;});}return null;};}function removeEntity(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(_0x2fb0e4){return _0x2fb0e4[_0x0a9e('0x23')]()[_0x0a9e('0x22')](function(){_0x4abc77[_0x0a9e('0x17')](0xcc)[_0x0a9e('0x16')]();});}};}function handleEntityNotFound(_0x16b1ca,_0x5ea472){return function(_0x59181e){if(!_0x59181e){_0x16b1ca[_0x0a9e('0x15')](0x194);}return _0x59181e;};}function handleError(_0x3a8e58,_0x40c424){_0x40c424=_0x40c424||0x1f4;return function(_0x33161b){logger['error'](_0x33161b[_0x0a9e('0x24')]);if(_0x33161b['name']){delete _0x33161b[_0x0a9e('0x25')];}_0x3a8e58['status'](_0x40c424)[_0x0a9e('0x26')](_0x33161b);};}exports[_0x0a9e('0x27')]=function(_0x25fba9,_0x14433c){var _0x140511={'raw':!![],'where':{'id':_0x25fba9[_0x0a9e('0x28')]['id']}},_0x1538a4={};_0x1538a4[_0x0a9e('0x29')]=_['keys'](db[_0x0a9e('0x2a')][_0x0a9e('0x2b')]);_0x1538a4[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x25fba9['query']);_0x1538a4[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x1538a4[_0x0a9e('0x29')],_0x1538a4[_0x0a9e('0x2c')]);_0x140511[_0x0a9e('0x30')]=_[_0x0a9e('0x2f')](_0x1538a4[_0x0a9e('0x29')],qs[_0x0a9e('0x31')](_0x25fba9[_0x0a9e('0x2c')]['fields']));_0x140511[_0x0a9e('0x30')]=_0x140511['attributes'][_0x0a9e('0x32')]?_0x140511[_0x0a9e('0x30')]:_0x1538a4[_0x0a9e('0x29')];if(_0x25fba9[_0x0a9e('0x2c')][_0x0a9e('0x33')]){_0x140511['include']=[{'all':!![]}];}_0x140511=_[_0x0a9e('0x34')]({},_0x140511,_0x25fba9[_0x0a9e('0x35')]);return db[_0x0a9e('0x2a')][_0x0a9e('0x36')](_0x140511)[_0x0a9e('0x22')](handleEntityNotFound(_0x14433c,null))[_0x0a9e('0x22')](respondWithResult(_0x14433c,null))[_0x0a9e('0x37')](handleError(_0x14433c,null));};exports[_0x0a9e('0x21')]=function(_0x5583a4,_0x44295a){if(_0x5583a4['body']['id']){delete _0x5583a4[_0x0a9e('0x38')]['id'];}return db[_0x0a9e('0x2a')][_0x0a9e('0x36')]({'where':{'id':_0x5583a4[_0x0a9e('0x28')]['id']}})['then'](handleEntityNotFound(_0x44295a,null))[_0x0a9e('0x22')](saveUpdates(_0x5583a4[_0x0a9e('0x38')],null))[_0x0a9e('0x22')](respondWithResult(_0x44295a,null))[_0x0a9e('0x37')](handleError(_0x44295a,null));};exports['destroy']=function(_0x54135e,_0x1e8694){return db['MailApplication'][_0x0a9e('0x36')]({'where':{'id':_0x54135e[_0x0a9e('0x28')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x1e8694,null))[_0x0a9e('0x22')](removeEntity(_0x1e8694,null))['catch'](handleError(_0x1e8694,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index 2215bea..877d389 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 _0x3da7=['lodash','util','api','moment','bluebird','request-promise','define','MailApplication','mail_applications'];(function(_0x317374,_0x16f47c){var _0x4db57a=function(_0x3a732){while(--_0x3a732){_0x317374['push'](_0x317374['shift']());}};_0x4db57a(++_0x16f47c);}(_0x3da7,0x90));var _0x73da=function(_0xda464c,_0x26e47d){_0xda464c=_0xda464c-0x0;var _0x19e222=_0x3da7[_0xda464c];return _0x19e222;};'use strict';var _=require(_0x73da('0x0'));var util=require(_0x73da('0x1'));var logger=require('../../config/logger')(_0x73da('0x2'));var moment=require(_0x73da('0x3'));var BPromise=require(_0x73da('0x4'));var rp=require(_0x73da('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./mailApplication.attributes');module['exports']=function(_0x8d07f2,_0x11a231){return _0x8d07f2[_0x73da('0x6')](_0x73da('0x7'),attributes,{'tableName':_0x73da('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x7c59=['define','MailApplication','mail_applications','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','bluebird','request-promise','path','../../config/environment','./mailApplication.attributes'];(function(_0x24de3e,_0x1ed115){var _0x3c063a=function(_0x6eb287){while(--_0x6eb287){_0x24de3e['push'](_0x24de3e['shift']());}};_0x3c063a(++_0x1ed115);}(_0x7c59,0x19d));var _0x97c5=function(_0x47b1b2,_0x144e92){_0x47b1b2=_0x47b1b2-0x0;var _0x14dcc3=_0x7c59[_0x47b1b2];return _0x14dcc3;};'use strict';var _=require(_0x97c5('0x0'));var util=require('util');var logger=require(_0x97c5('0x1'))('api');var moment=require('moment');var BPromise=require(_0x97c5('0x2'));var rp=require(_0x97c5('0x3'));var fs=require('fs');var path=require(_0x97c5('0x4'));var rimraf=require('rimraf');var config=require(_0x97c5('0x5'));var attributes=require(_0x97c5('0x6'));module['exports']=function(_0x146a62,_0x5b33bb){return _0x146a62[_0x97c5('0x7')](_0x97c5('0x8'),attributes,{'tableName':_0x97c5('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x97c5('0xa'),'collate':_0x97c5('0xb')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index ba1dc58..7cac845 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 _0x6a77=['options','where','attributes','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','client','http','then','MailApplication,\x20%s,\x20%s','request\x20sent','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','UpdateMailApplication','body','raw'];(function(_0x306afa,_0x50b923){var _0x1b6d81=function(_0x499530){while(--_0x499530){_0x306afa['push'](_0x306afa['shift']());}};_0x1b6d81(++_0x50b923);}(_0x6a77,0xc1));var _0x76a7=function(_0x23df0a,_0x3aa851){_0x23df0a=_0x23df0a-0x0;var _0xa54d98=_0x6a77[_0x23df0a];return _0xa54d98;};'use strict';var _=require(_0x76a7('0x0'));var util=require(_0x76a7('0x1'));var moment=require(_0x76a7('0x2'));var BPromise=require(_0x76a7('0x3'));var rs=require(_0x76a7('0x4'));var fs=require('fs');var Redis=require(_0x76a7('0x5'));var db=require(_0x76a7('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x76a7('0x7'));var config=require('../../config/environment');var jayson=require(_0x76a7('0x8'));var client=jayson[_0x76a7('0x9')][_0x76a7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5b3545,_0x4370f7,_0x20dbe5){return new BPromise(function(_0x1e42f3,_0x314ee3){return client['request'](_0x5b3545,_0x20dbe5)[_0x76a7('0xb')](function(_0x34204c){logger['info'](_0x76a7('0xc'),_0x4370f7,_0x76a7('0xd'));logger['debug'](_0x76a7('0xe'),_0x4370f7,_0x76a7('0xd'),JSON[_0x76a7('0xf')](_0x34204c));if(_0x34204c[_0x76a7('0x10')]){if(_0x34204c[_0x76a7('0x10')]['code']===0x1f4){logger[_0x76a7('0x10')]('MailApplication,\x20%s,\x20%s',_0x4370f7,_0x34204c[_0x76a7('0x10')]['message']);return _0x314ee3(_0x34204c['error'][_0x76a7('0x11')]);}logger[_0x76a7('0x10')](_0x76a7('0xc'),_0x4370f7,_0x34204c['error']['message']);return _0x1e42f3(_0x34204c[_0x76a7('0x10')][_0x76a7('0x11')]);}else{logger[_0x76a7('0x12')](_0x76a7('0xc'),_0x4370f7,'request\x20sent');_0x1e42f3(_0x34204c['result'][_0x76a7('0x11')]);}})[_0x76a7('0x13')](function(_0x1944db){logger[_0x76a7('0x10')]('MailApplication,\x20%s,\x20%s',_0x4370f7,_0x1944db);_0x314ee3(_0x1944db);});});}exports[_0x76a7('0x14')]=function(_0x35e648){var _0x9cabcb=this;return new Promise(function(_0x5cc0de,_0x35e52e){return db['MailApplication']['update'](_0x35e648[_0x76a7('0x15')],{'raw':_0x35e648['options']?_0x35e648['options'][_0x76a7('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x35e648[_0x76a7('0x17')]?_0x35e648[_0x76a7('0x17')][_0x76a7('0x18')]||null:null,'attributes':_0x35e648[_0x76a7('0x17')]?_0x35e648['options'][_0x76a7('0x19')]||null:null,'limit':_0x35e648[_0x76a7('0x17')]?_0x35e648[_0x76a7('0x17')]['limit']||null:null})[_0x76a7('0xb')](function(_0x5e02bf){logger[_0x76a7('0x12')](_0x76a7('0x14'),_0x35e648);logger[_0x76a7('0x1a')](_0x76a7('0x14'),_0x35e648,JSON[_0x76a7('0xf')](_0x5e02bf));_0x5cc0de(_0x5e02bf);})[_0x76a7('0x13')](function(_0x10dc12){logger['error'](_0x76a7('0x14'),_0x10dc12[_0x76a7('0x11')],_0x35e648);_0x35e52e(_0x9cabcb[_0x76a7('0x10')](0x1f4,_0x10dc12[_0x76a7('0x11')]));});});}; \ No newline at end of file +var _0x6e9b=['MailApplication,\x20%s,\x20%s','request\x20sent','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','update','body','options','raw','attributes','limit','then','UpdateMailApplication','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info'];(function(_0x5da4d0,_0x260910){var _0x486eb5=function(_0xa508ae){while(--_0xa508ae){_0x5da4d0['push'](_0x5da4d0['shift']());}};_0x486eb5(++_0x260910);}(_0x6e9b,0x11f));var _0xb6e9=function(_0x28a2d4,_0xc5e0d0){_0x28a2d4=_0x28a2d4-0x0;var _0x369677=_0x6e9b[_0x28a2d4];return _0x369677;};'use strict';var _=require(_0xb6e9('0x0'));var util=require('util');var moment=require(_0xb6e9('0x1'));var BPromise=require(_0xb6e9('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb6e9('0x3'));var db=require(_0xb6e9('0x4'))['db'];var utils=require(_0xb6e9('0x5'));var logger=require(_0xb6e9('0x6'))(_0xb6e9('0x7'));var config=require(_0xb6e9('0x8'));var jayson=require(_0xb6e9('0x9'));var client=jayson[_0xb6e9('0xa')][_0xb6e9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5bb8b5,_0x406896,_0x31ec2a){return new BPromise(function(_0x4e6d75,_0x5b58a7){return client['request'](_0x5bb8b5,_0x31ec2a)['then'](function(_0x21bcdb){logger[_0xb6e9('0xc')](_0xb6e9('0xd'),_0x406896,_0xb6e9('0xe'));logger['debug'](_0xb6e9('0xf'),_0x406896,_0xb6e9('0xe'),JSON[_0xb6e9('0x10')](_0x21bcdb));if(_0x21bcdb[_0xb6e9('0x11')]){if(_0x21bcdb[_0xb6e9('0x11')][_0xb6e9('0x12')]===0x1f4){logger[_0xb6e9('0x11')](_0xb6e9('0xd'),_0x406896,_0x21bcdb[_0xb6e9('0x11')]['message']);return _0x5b58a7(_0x21bcdb[_0xb6e9('0x11')][_0xb6e9('0x13')]);}logger[_0xb6e9('0x11')](_0xb6e9('0xd'),_0x406896,_0x21bcdb[_0xb6e9('0x11')][_0xb6e9('0x13')]);return _0x4e6d75(_0x21bcdb['error'][_0xb6e9('0x13')]);}else{logger[_0xb6e9('0xc')](_0xb6e9('0xd'),_0x406896,_0xb6e9('0xe'));_0x4e6d75(_0x21bcdb[_0xb6e9('0x14')][_0xb6e9('0x13')]);}})[_0xb6e9('0x15')](function(_0x448c9a){logger['error'](_0xb6e9('0xd'),_0x406896,_0x448c9a);_0x5b58a7(_0x448c9a);});});}exports['UpdateMailApplication']=function(_0x2b2a76){var _0x1d0137=this;return new Promise(function(_0x105d0e,_0x241b8a){return db['MailApplication'][_0xb6e9('0x16')](_0x2b2a76[_0xb6e9('0x17')],{'raw':_0x2b2a76[_0xb6e9('0x18')]?_0x2b2a76['options'][_0xb6e9('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2b2a76[_0xb6e9('0x18')]?_0x2b2a76[_0xb6e9('0x18')]['where']||null:null,'attributes':_0x2b2a76[_0xb6e9('0x18')]?_0x2b2a76['options'][_0xb6e9('0x1a')]||null:null,'limit':_0x2b2a76[_0xb6e9('0x18')]?_0x2b2a76[_0xb6e9('0x18')][_0xb6e9('0x1b')]||null:null})[_0xb6e9('0x1c')](function(_0x565953){logger[_0xb6e9('0xc')]('UpdateMailApplication',_0x2b2a76);logger['debug'](_0xb6e9('0x1d'),_0x2b2a76,JSON['stringify'](_0x565953));_0x105d0e(_0x565953);})[_0xb6e9('0x15')](function(_0x3e29bb){logger[_0xb6e9('0x11')]('UpdateMailApplication',_0x3e29bb[_0xb6e9('0x13')],_0x2b2a76);_0x241b8a(_0x1d0137['error'](0x1f4,_0x3e29bb[_0xb6e9('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index e3fe129..e6fd120 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 _0xccb0=['express','../../components/interaction/service','./mailInteraction.controller','get','isAuthenticated','/describe','describe','/:id','/:id/messages','getMessages','/:id/download','download','post','create','/:id/tags','tracked','mail','mailinteraction:addtags','addTags','mailinteraction:update','update','delete','mailinteraction:destroy','destroy','removeTags'];(function(_0x1ca0ed,_0x445d81){var _0x19e17c=function(_0x25c357){while(--_0x25c357){_0x1ca0ed['push'](_0x1ca0ed['shift']());}};_0x19e17c(++_0x445d81);}(_0xccb0,0x177));var _0x0ccb=function(_0x50b315,_0x471db5){_0x50b315=_0x50b315-0x0;var _0x3d342a=_0xccb0[_0x50b315];return _0x3d342a;};'use strict';var express=require(_0x0ccb('0x0'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x0ccb('0x1'));var controller=require(_0x0ccb('0x2'));router[_0x0ccb('0x3')]('/',auth[_0x0ccb('0x4')](),controller['index']);router[_0x0ccb('0x3')](_0x0ccb('0x5'),auth['isAuthenticated'](),controller[_0x0ccb('0x6')]);router['get'](_0x0ccb('0x7'),auth[_0x0ccb('0x4')](),controller['show']);router[_0x0ccb('0x3')](_0x0ccb('0x8'),auth['isAuthenticated'](),controller[_0x0ccb('0x9')]);router['get'](_0x0ccb('0xa'),auth['isAuthenticated'](),controller[_0x0ccb('0xb')]);router[_0x0ccb('0xc')]('/',auth[_0x0ccb('0x4')](),controller[_0x0ccb('0xd')]);router[_0x0ccb('0xc')](_0x0ccb('0x8'),auth[_0x0ccb('0x4')](),controller['addMessage']);router['post'](_0x0ccb('0xe'),auth[_0x0ccb('0x4')](),interaction[_0x0ccb('0xf')](_0x0ccb('0x10'),_0x0ccb('0x11')),controller[_0x0ccb('0x12')]);router['put']('/:id',auth[_0x0ccb('0x4')](),interaction[_0x0ccb('0xf')](_0x0ccb('0x10'),_0x0ccb('0x13')),controller[_0x0ccb('0x14')]);router[_0x0ccb('0x15')]('/:id',auth[_0x0ccb('0x4')](),interaction[_0x0ccb('0xf')]('mail',_0x0ccb('0x16')),controller[_0x0ccb('0x17')]);router['delete'](_0x0ccb('0xe'),auth[_0x0ccb('0x4')](),controller[_0x0ccb('0x18')]);module['exports']=router; \ No newline at end of file +var _0x480d=['../../components/interaction/service','./mailInteraction.controller','get','isAuthenticated','index','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','mailinteraction:addtags','addTags','/:id','mail','update','delete','mailinteraction:destroy','destroy','removeTags','exports','Router','../../components/auth/service'];(function(_0x2682fe,_0x680d56){var _0x21f523=function(_0xcabc1e){while(--_0xcabc1e){_0x2682fe['push'](_0x2682fe['shift']());}};_0x21f523(++_0x680d56);}(_0x480d,0xd6));var _0xd480=function(_0xb9493,_0x19a7d9){_0xb9493=_0xb9493-0x0;var _0x50d593=_0x480d[_0xb9493];return _0x50d593;};'use strict';var express=require('express');var router=express[_0xd480('0x0')]();var auth=require(_0xd480('0x1'));var interaction=require(_0xd480('0x2'));var controller=require(_0xd480('0x3'));router[_0xd480('0x4')]('/',auth[_0xd480('0x5')](),controller[_0xd480('0x6')]);router['get']('/describe',auth[_0xd480('0x5')](),controller['describe']);router[_0xd480('0x4')]('/:id',auth[_0xd480('0x5')](),controller[_0xd480('0x7')]);router[_0xd480('0x4')](_0xd480('0x8'),auth[_0xd480('0x5')](),controller[_0xd480('0x9')]);router[_0xd480('0x4')](_0xd480('0xa'),auth[_0xd480('0x5')](),controller[_0xd480('0xb')]);router[_0xd480('0xc')]('/',auth['isAuthenticated'](),controller[_0xd480('0xd')]);router[_0xd480('0xc')]('/:id/messages',auth[_0xd480('0x5')](),controller[_0xd480('0xe')]);router[_0xd480('0xc')](_0xd480('0xf'),auth[_0xd480('0x5')](),interaction[_0xd480('0x10')]('mail',_0xd480('0x11')),controller[_0xd480('0x12')]);router['put'](_0xd480('0x13'),auth['isAuthenticated'](),interaction[_0xd480('0x10')](_0xd480('0x14'),'mailinteraction:update'),controller[_0xd480('0x15')]);router[_0xd480('0x16')]('/:id',auth[_0xd480('0x5')](),interaction[_0xd480('0x10')](_0xd480('0x14'),_0xd480('0x17')),controller[_0xd480('0x18')]);router[_0xd480('0x16')](_0xd480('0xf'),auth['isAuthenticated'](),controller[_0xd480('0x19')]);module[_0xd480('0x1a')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index 8459e5e..d0c508b 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 _0x8aac=['out','ENUM','INTEGER','sequelize','iconv','BOOLEAN','DATE','STRING','TEXT','long'];(function(_0x485a43,_0xea4833){var _0x5797c2=function(_0x57af0a){while(--_0x57af0a){_0x485a43['push'](_0x485a43['shift']());}};_0x5797c2(++_0xea4833);}(_0x8aac,0x71));var _0xc8aa=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8aac[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xc8aa('0x0'));var iconv=require(_0xc8aa('0x1'));module['exports']={'closed':{'type':Sequelize[_0xc8aa('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xc8aa('0x3')]},'disposition':{'type':Sequelize[_0xc8aa('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xc8aa('0x4')]},'note':{'type':Sequelize[_0xc8aa('0x4')]},'inReplyTo':{'type':Sequelize[_0xc8aa('0x4')](0x1fe)},'to':{'type':Sequelize[_0xc8aa('0x4')]},'cc':{'type':Sequelize[_0xc8aa('0x5')](_0xc8aa('0x6'))},'subject':{'type':Sequelize[_0xc8aa('0x5')]()},'attach':{'type':Sequelize[_0xc8aa('0x2')],'defaultValue':![]},'read1stAt':{'type':Sequelize['DATE']},'substatus':{'type':Sequelize[_0xc8aa('0x4')](0x3c)},'substatusAt':{'type':Sequelize[_0xc8aa('0x3')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0xc8aa('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xc8aa('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xc8aa('0x8')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xc8aa('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize[_0xc8aa('0x9')]}}; \ No newline at end of file +var _0xe35e=['ENUM','out','INTEGER','sequelize','iconv','exports','DATE','STRING','TEXT','BOOLEAN'];(function(_0x4a714b,_0x392400){var _0x5a84e9=function(_0x20ac6d){while(--_0x20ac6d){_0x4a714b['push'](_0x4a714b['shift']());}};_0x5a84e9(++_0x392400);}(_0xe35e,0xc1));var _0xee35=function(_0x3cb6dc,_0x120dd3){_0x3cb6dc=_0x3cb6dc-0x0;var _0x47ec89=_0xe35e[_0x3cb6dc];return _0x47ec89;};'use strict';var Sequelize=require(_0xee35('0x0'));var iconv=require(_0xee35('0x1'));module[_0xee35('0x2')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xee35('0x3')]},'disposition':{'type':Sequelize[_0xee35('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xee35('0x4')]},'note':{'type':Sequelize[_0xee35('0x4')]},'inReplyTo':{'type':Sequelize[_0xee35('0x4')](0x1fe)},'to':{'type':Sequelize[_0xee35('0x4')]},'cc':{'type':Sequelize[_0xee35('0x5')]('long')},'subject':{'type':Sequelize[_0xee35('0x5')]()},'attach':{'type':Sequelize[_0xee35('0x6')],'defaultValue':![]},'read1stAt':{'type':Sequelize['DATE']},'substatus':{'type':Sequelize[_0xee35('0x4')](0x3c)},'substatusAt':{'type':Sequelize[_0xee35('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xee35('0x7')]('in',_0xee35('0x8')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xee35('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xee35('0x8')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xee35('0x6')],'defaultValue':![]},'queueId':{'type':Sequelize[_0xee35('0x9')]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index 7c3469e..ebd10fd 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 _0xedec=['juice','ioredis','../../components/interaction/service','../../config/logger','../../mysqldb','html-entities','redis','localhost','./mailInteraction.socket','register','status','json','offset','undefined','limit','count','Content-Range','update','destroy','then','end','sendStatus','error','stack','name','send','index','map','MailInteraction','rawAttributes','fieldName','type','key','mail','query','user','catch','show','params','keys','intersection','model','attributes','fields','length','includeAll','include','merge','options','create','body','find','describe','addMessage','ids','findOne','filters','hasOwnProperty','nolimit','order','sort','where','pick','MailInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','MailMessage','findAll','inlineCss','true','rows','addTags','setTags','omit','spread','Tag','emit','mailInteractionTags:save','removeTags','download','unix','toString','join','root','files','attachments','transcript-%d-%s.zip','push','Attachments','from','bcc','createdAt','Messages','get','each','missing.recipient@your.company.com','subject','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','existsSync','build','message%d.eml','unlinkSync','eml-format','rimraf','zip-dir','bluebird','util','lodash'];(function(_0x11e30d,_0x5584aa){var _0x2d4e29=function(_0x2486ce){while(--_0x2486ce){_0x11e30d['push'](_0x11e30d['shift']());}};_0x2d4e29(++_0x5584aa);}(_0xedec,0x1be));var _0xcede=function(_0x4ae2fb,_0x1c1c67){_0x4ae2fb=_0x4ae2fb-0x0;var _0x4f5268=_0xedec[_0x4ae2fb];return _0x4f5268;};'use strict';var emlformat=require(_0xcede('0x0'));var rimraf=require(_0xcede('0x1'));var zipdir=require(_0xcede('0x2'));var moment=require('moment');var BPromise=require(_0xcede('0x3'));var util=require(_0xcede('0x4'));var path=require('path');var fs=require('fs');var _=require(_0xcede('0x5'));var juice=require(_0xcede('0x6'));var Redis=require(_0xcede('0x7'));var interaction=require(_0xcede('0x8'));var qs=require('../../components/parsers/qs');var logger=require(_0xcede('0x9'))('api');var config=require('../../config/environment');var db=require(_0xcede('0xa'))['db'];var htmlEntities=require(_0xcede('0xb'));config[_0xcede('0xc')]=_['defaults'](config[_0xcede('0xc')],{'host':_0xcede('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xcede('0xe'))[_0xcede('0xf')](socket);function respondWithStatusCode(_0x265658,_0x53c86a){_0x53c86a=_0x53c86a||0xcc;return function(_0x4d5905){if(_0x4d5905){return _0x265658['sendStatus'](_0x53c86a);}return _0x265658[_0xcede('0x10')](_0x53c86a)['end']();};}function respondWithResult(_0x81919b,_0x5a5c4c){_0x5a5c4c=_0x5a5c4c||0xc8;return function(_0x46d5b0){if(_0x46d5b0){return _0x81919b[_0xcede('0x10')](_0x5a5c4c)[_0xcede('0x11')](_0x46d5b0);}};}function respondWithFilteredResult(_0x46e428,_0x485e28){return function(_0x7e5ac1){if(_0x7e5ac1){var _0xbae630=typeof _0x485e28[_0xcede('0x12')]===_0xcede('0x13')&&typeof _0x485e28[_0xcede('0x14')]===_0xcede('0x13');var _0x4093d6=_0x7e5ac1[_0xcede('0x15')];var _0xaf41b6=_0xbae630?0x0:_0x485e28['offset'];var _0x2adf4f=_0xbae630?_0x7e5ac1[_0xcede('0x15')]:_0x485e28[_0xcede('0x12')]+_0x485e28['limit'];var _0x62b594;if(_0x2adf4f>=_0x4093d6){_0x2adf4f=_0x4093d6;_0x62b594=0xc8;}else{_0x62b594=0xce;}_0x46e428[_0xcede('0x10')](_0x62b594);return _0x46e428['set'](_0xcede('0x16'),_0xaf41b6+'-'+_0x2adf4f+'/'+_0x4093d6)[_0xcede('0x11')](_0x7e5ac1);}return null;};}function saveUpdates(_0x138338){return function(_0x27e91e){if(_0x27e91e){return _0x27e91e[_0xcede('0x17')](_0x138338)['then'](function(_0x102afa){return _0x102afa;});}return null;};}function removeEntity(_0x1d62d4){return function(_0x1db290){if(_0x1db290){return _0x1db290[_0xcede('0x18')]()[_0xcede('0x19')](function(){_0x1d62d4[_0xcede('0x10')](0xcc)[_0xcede('0x1a')]();});}};}function handleEntityNotFound(_0x304d05){return function(_0x38f009){if(!_0x38f009){_0x304d05[_0xcede('0x1b')](0x194);}return _0x38f009;};}function handleError(_0xdfe74a,_0x3dccce){_0x3dccce=_0x3dccce||0x1f4;return function(_0x16963c){logger[_0xcede('0x1c')](_0x16963c[_0xcede('0x1d')]);if(_0x16963c[_0xcede('0x1e')]){delete _0x16963c[_0xcede('0x1e')];}_0xdfe74a[_0xcede('0x10')](_0x3dccce)[_0xcede('0x1f')](_0x16963c);};}exports[_0xcede('0x20')]=function(_0x4ecc21,_0x30c393){var _0x5e3f8c={};var _0x32ba36=_[_0xcede('0x21')](db[_0xcede('0x22')][_0xcede('0x23')],function(_0x592cf6){return{'name':_0x592cf6[_0xcede('0x24')],'type':_0x592cf6[_0xcede('0x25')][_0xcede('0x26')]};});_0x5e3f8c=qs['getOptions'](_0x32ba36,_0x4ecc21);return interaction['findAll'](_0xcede('0x27'),_0x4ecc21[_0xcede('0x28')],_0x4ecc21[_0xcede('0x29')],_0x5e3f8c,_0x32ba36)[_0xcede('0x19')](respondWithFilteredResult(_0x30c393,_0x5e3f8c))[_0xcede('0x2a')](handleError(_0x30c393,null));};exports[_0xcede('0x2b')]=function(_0x41d9b7,_0x3d1435){var _0x19ffc1={'raw':![],'where':{'id':_0x41d9b7[_0xcede('0x2c')]['id']}},_0x1058f5={};_0x1058f5['model']=_[_0xcede('0x2d')](db['MailInteraction'][_0xcede('0x23')]);_0x1058f5['query']=_[_0xcede('0x2d')](_0x41d9b7['query']);_0x1058f5['filters']=_[_0xcede('0x2e')](_0x1058f5[_0xcede('0x2f')],_0x1058f5[_0xcede('0x28')]);_0x19ffc1[_0xcede('0x30')]=_[_0xcede('0x2e')](_0x1058f5[_0xcede('0x2f')],qs[_0xcede('0x31')](_0x41d9b7[_0xcede('0x28')][_0xcede('0x31')]));_0x19ffc1[_0xcede('0x30')]=_0x19ffc1[_0xcede('0x30')][_0xcede('0x32')]?_0x19ffc1[_0xcede('0x30')]:_0x1058f5[_0xcede('0x2f')];if(_0x41d9b7['query'][_0xcede('0x33')]){_0x19ffc1[_0xcede('0x34')]=[{'all':!![]}];}_0x19ffc1=_[_0xcede('0x35')]({},_0x19ffc1,_0x41d9b7[_0xcede('0x36')]);return db[_0xcede('0x22')]['find'](_0x19ffc1)[_0xcede('0x19')](handleEntityNotFound(_0x3d1435,null))[_0xcede('0x19')](respondWithResult(_0x3d1435,null))[_0xcede('0x2a')](handleError(_0x3d1435,null));};exports[_0xcede('0x37')]=function(_0x1eea63,_0x3f4239){return db[_0xcede('0x22')][_0xcede('0x37')](_0x1eea63[_0xcede('0x38')],{})['then'](respondWithResult(_0x3f4239,0xc9))['catch'](handleError(_0x3f4239,null));};exports['update']=function(_0xa16bcf,_0x37e220){if(_0xa16bcf[_0xcede('0x38')]['id']){delete _0xa16bcf[_0xcede('0x38')]['id'];}return db[_0xcede('0x22')]['find']({'where':{'id':_0xa16bcf[_0xcede('0x2c')]['id']}})[_0xcede('0x19')](handleEntityNotFound(_0x37e220,null))[_0xcede('0x19')](saveUpdates(_0xa16bcf[_0xcede('0x38')],null))[_0xcede('0x19')](respondWithResult(_0x37e220,null))[_0xcede('0x2a')](handleError(_0x37e220,null));};exports['destroy']=function(_0x765baf,_0x3d08d1){return db[_0xcede('0x22')][_0xcede('0x39')]({'where':{'id':_0x765baf['params']['id']}})[_0xcede('0x19')](handleEntityNotFound(_0x3d08d1,null))[_0xcede('0x19')](removeEntity(_0x3d08d1,null))[_0xcede('0x2a')](handleError(_0x3d08d1,null));};exports[_0xcede('0x3a')]=function(_0x3ad16c,_0x142c70){return db[_0xcede('0x22')]['describe']()[_0xcede('0x19')](respondWithResult(_0x142c70,null))[_0xcede('0x2a')](handleError(_0x142c70,null));};exports[_0xcede('0x3b')]=function(_0x451a47,_0x245188){return db['MailMessage'][_0xcede('0x39')]({'where':{'id':_0x451a47[_0xcede('0x2c')]['id']}})['then'](handleEntityNotFound(_0x245188,null))['then'](function(_0x4427ae){if(_0x4427ae){return _0x4427ae[_0xcede('0x3b')](_0x451a47['body'][_0xcede('0x3c')],_['omit'](_0x451a47[_0xcede('0x38')],[_0xcede('0x3c'),'id'])||{});}})[_0xcede('0x19')](respondWithResult(_0x245188,null))[_0xcede('0x2a')](handleError(_0x245188,null));};exports['getMessages']=function(_0x2df002,_0x105d56){var _0x27cee1={'raw':![],'where':{}};var _0x1e78e8={};var _0x2495b8={'count':0x0,'rows':[]};return db[_0xcede('0x22')][_0xcede('0x3d')]({'where':{'id':_0x2df002[_0xcede('0x2c')]['id']}})['then'](handleEntityNotFound(_0x105d56,null))[_0xcede('0x19')](function(_0x3f4be3){if(_0x3f4be3){_0x1e78e8['model']=_['keys'](db['MailMessage'][_0xcede('0x23')]);_0x1e78e8['query']=_[_0xcede('0x2d')](_0x2df002[_0xcede('0x28')]);_0x1e78e8[_0xcede('0x3e')]=_[_0xcede('0x2e')](_0x1e78e8[_0xcede('0x2f')],_0x1e78e8[_0xcede('0x28')]);_0x27cee1[_0xcede('0x30')]=_[_0xcede('0x2e')](_0x1e78e8[_0xcede('0x2f')],qs[_0xcede('0x31')](_0x2df002[_0xcede('0x28')][_0xcede('0x31')]));_0x27cee1[_0xcede('0x30')]=_0x27cee1[_0xcede('0x30')][_0xcede('0x32')]?_0x27cee1['attributes']:_0x1e78e8[_0xcede('0x2f')];if(!_0x2df002[_0xcede('0x28')][_0xcede('0x3f')](_0xcede('0x40'))){_0x27cee1[_0xcede('0x14')]=qs[_0xcede('0x14')](_0x2df002[_0xcede('0x28')][_0xcede('0x14')]);_0x27cee1[_0xcede('0x12')]=qs[_0xcede('0x12')](_0x2df002[_0xcede('0x28')][_0xcede('0x12')]);}_0x27cee1[_0xcede('0x41')]=qs[_0xcede('0x42')](_0x2df002[_0xcede('0x28')][_0xcede('0x42')]);_0x27cee1[_0xcede('0x43')]=qs[_0xcede('0x3e')](_[_0xcede('0x44')](_0x2df002[_0xcede('0x28')],_0x1e78e8['filters']));_0x27cee1[_0xcede('0x43')][_0xcede('0x45')]=_0x3f4be3['id'];if(_0x2df002[_0xcede('0x28')][_0xcede('0x46')]){_0x27cee1['where']=_[_0xcede('0x35')](_0x27cee1[_0xcede('0x43')],{'$or':_[_0xcede('0x21')](_0x27cee1[_0xcede('0x30')],function(_0x5418a7){var _0x5dc400={};_0x5dc400[_0x5418a7]={'$like':'%'+_0x2df002[_0xcede('0x28')][_0xcede('0x46')]+'%'};return _0x5dc400;})});}if(_0x2df002['query'][_0xcede('0x47')]){var _0x46573c=_0x2df002[_0xcede('0x28')][_0xcede('0x47')][_0xcede('0x48')](',');var _0x1ef56c={};_0x1ef56c[_0x46573c[0x0]]={'$gte':moment(_0x46573c[0x1])[_0xcede('0x49')](_0xcede('0x4a'))};_0x27cee1[_0xcede('0x43')]=_[_0xcede('0x35')](_0x27cee1[_0xcede('0x43')],_0x1ef56c);}_0x27cee1=_[_0xcede('0x35')]({},_0x27cee1,_0x2df002['options']);return db[_0xcede('0x4b')][_0xcede('0x15')]({'where':_0x27cee1[_0xcede('0x43')]})[_0xcede('0x19')](function(_0x145a1d){_0x2495b8[_0xcede('0x15')]=_0x145a1d;if(_0x2df002[_0xcede('0x28')]['includeAll']){_0x27cee1[_0xcede('0x34')]=[{'all':!![]}];}return db['MailMessage'][_0xcede('0x4c')](_0x27cee1);})[_0xcede('0x19')](function(_0x92b6b){if(_0x2df002[_0xcede('0x28')][_0xcede('0x4d')]===_0xcede('0x4e')){for(var _0x3d901b=0x0;_0x3d901b<_0x92b6b[_0xcede('0x32')];_0x3d901b++){_0x92b6b[_0x3d901b][_0xcede('0x38')]=juice(_0x92b6b[_0x3d901b][_0xcede('0x38')]);}}_0x2495b8[_0xcede('0x4f')]=_0x92b6b;return _0x2495b8;});}})[_0xcede('0x19')](respondWithFilteredResult(_0x105d56,_0x27cee1))[_0xcede('0x2a')](handleError(_0x105d56,null));};exports[_0xcede('0x50')]=function(_0x4d9a4e,_0x3c626e){return db['MailInteraction']['find']({'where':{'id':_0x4d9a4e[_0xcede('0x2c')]['id']}})['then'](handleEntityNotFound(_0x3c626e,null))[_0xcede('0x19')](function(_0x2e4212){if(_0x2e4212){return _0x2e4212[_0xcede('0x51')](_0x4d9a4e[_0xcede('0x38')]['ids'],_[_0xcede('0x52')](_0x4d9a4e[_0xcede('0x38')],[_0xcede('0x3c'),'id'])||{})[_0xcede('0x53')](function(){return db[_0xcede('0x54')][_0xcede('0x4c')]({'attributes':['id',_0xcede('0x1e'),'color'],'where':{'id':_0x4d9a4e[_0xcede('0x38')][_0xcede('0x3c')]}});})[_0xcede('0x19')](function(_0x13e760){socket[_0xcede('0x55')](_0xcede('0x56'),{'id':Number(_0x4d9a4e['params']['id']),'tags':_0x13e760||[]});return{'id':Number(_0x4d9a4e[_0xcede('0x2c')]['id']),'tags':_0x13e760||[]};});}})['then'](respondWithResult(_0x3c626e,null))[_0xcede('0x2a')](handleError(_0x3c626e,null));};exports['removeTags']=function(_0x241dfc,_0x1e84cd){return db[_0xcede('0x22')]['find']({'where':{'id':_0x241dfc[_0xcede('0x2c')]['id']}})[_0xcede('0x19')](handleEntityNotFound(_0x1e84cd,null))[_0xcede('0x19')](function(_0x22e3d7){if(_0x22e3d7){return _0x22e3d7[_0xcede('0x57')](_0x241dfc[_0xcede('0x28')][_0xcede('0x3c')]);}})[_0xcede('0x19')](respondWithStatusCode(_0x1e84cd,null))['catch'](handleError(_0x1e84cd,null));};exports[_0xcede('0x58')]=function(_0x13e489,_0x275361){var _0x3a88d2=moment()[_0xcede('0x59')]()[_0xcede('0x5a')]();var _0x4ddb16=path[_0xcede('0x5b')](config[_0xcede('0x5c')],'server',_0xcede('0x5d'),'tmp');var _0x4ea74e=path[_0xcede('0x5b')](config[_0xcede('0x5c')],'server',_0xcede('0x5d'),_0xcede('0x5e'));var _0x2d1cd3=path[_0xcede('0x5b')](_0x4ddb16,_0x3a88d2);var _0x13876d=util[_0xcede('0x49')](_0xcede('0x5f'),_0x13e489[_0xcede('0x2c')]['id'],_0x3a88d2);var _0x1a2811=path[_0xcede('0x5b')](_0x4ddb16,_0x13876d);var _0x1e49f3=[];if(_0x13e489[_0xcede('0x28')][_0xcede('0x5e')]){_0x1e49f3[_0xcede('0x60')]({'model':db['Attachment'],'as':_0xcede('0x61'),'raw':!![]});}var _0x2bc888=[{'model':db[_0xcede('0x4b')],'as':'Messages','attributes':['id','body',_0xcede('0x62'),'to','cc',_0xcede('0x63'),'subject',_0xcede('0x64')],'where':{'secret':![]},'order':qs[_0xcede('0x42')]('id'),'include':_0x1e49f3}];return db[_0xcede('0x22')]['find']({'where':{'id':_0x13e489[_0xcede('0x2c')]['id']},'include':_0x2bc888})[_0xcede('0x19')](handleEntityNotFound(_0x275361,null))[_0xcede('0x19')](function(_0x20d8eb){if(_0x20d8eb&&_0x20d8eb[_0xcede('0x65')]){var _0x343315=_0x20d8eb[_0xcede('0x66')]({'plain':!![]});fs['mkdirSync'](_0x2d1cd3);return BPromise[_0xcede('0x67')](_0x343315[_0xcede('0x65')],function(_0x596c57,_0x410e97){var _0x30dcbc={'from':_0x596c57[_0xcede('0x62')],'to':_0x596c57['to']||_0xcede('0x68'),'subject':_0x596c57[_0xcede('0x69')],'html':htmlEntities['decode'](_0x596c57[_0xcede('0x38')]),'headers':{'Date':moment(_0x596c57[_0xcede('0x64')])['format'](_0xcede('0x6a'))},'attachments':[]};if(_0x596c57['cc']){_0x30dcbc[_0xcede('0x6b')]['Cc']=_0x596c57['cc'];}if(_0x596c57[_0xcede('0x63')]){_0x30dcbc[_0xcede('0x6b')][_0xcede('0x6c')]=_0x596c57['bcc'];}return new BPromise(function(_0x3b142d,_0x44f9cf){if(_0x596c57[_0xcede('0x61')]){for(var _0x36fda8=0x0;_0x36fda8<_0x596c57[_0xcede('0x61')][_0xcede('0x32')];_0x36fda8++){var _0x3f4934=_0x596c57[_0xcede('0x61')][_0x36fda8];var _0x422a86=path['join'](_0x4ea74e,_0x3f4934['basename']);if(fs[_0xcede('0x6d')](_0x422a86)){_0x30dcbc[_0xcede('0x5e')][_0xcede('0x60')]({'name':_0x3f4934[_0xcede('0x1e')],'contentType':_0x3f4934[_0xcede('0x25')],'data':fs['readFileSync'](_0x422a86)});}}}emlformat[_0xcede('0x6e')](_0x30dcbc,function(_0x1fc644,_0x736907){if(_0x1fc644)return _0x44f9cf(_0x1fc644);fs['writeFileSync'](path[_0xcede('0x5b')](_0x2d1cd3,util[_0xcede('0x49')](_0xcede('0x6f'),_0x410e97)),_0x736907);return _0x3b142d(_0x736907);});});})[_0xcede('0x19')](function(){return new BPromise(function(_0x34974e,_0x45acee){zipdir(_0x2d1cd3,{'saveTo':_0x1a2811},function(_0x19ac25,_0x444085){if(_0x19ac25)return _0x45acee(_0x19ac25);return _0x34974e(_0x444085);});})[_0xcede('0x19')](function(){return new BPromise(function(_0x2f83f4,_0x28f861){rimraf(_0x2d1cd3,function(_0x35fa2a){if(_0x35fa2a)_0x28f861(_0x35fa2a);return _0x2f83f4();});});})[_0xcede('0x19')](function(){return _0x275361[_0xcede('0x58')](_0x1a2811,_0x13876d,function(_0x2df9b3){if(!_0x2df9b3)fs[_0xcede('0x70')](_0x1a2811);});});});}else{return _0x275361[_0xcede('0x1b')](0xc8);}})['catch'](handleError(_0x275361,null));}; \ No newline at end of file +var _0xc3d2=['subject','mkdirSync','each','missing.recipient@your.company.com','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','Attachments','basename','existsSync','readFileSync','build','writeFileSync','message%d.eml','unlinkSync','eml-format','rimraf','zip-dir','moment','bluebird','util','path','lodash','juice','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','redis','defaults','socket.io-emitter','register','status','end','json','undefined','limit','count','offset','set','Content-Range','update','then','destroy','sendStatus','error','stack','name','send','index','map','MailInteraction','rawAttributes','fieldName','type','mail','query','user','catch','show','params','model','keys','filters','intersection','attributes','fields','length','includeAll','merge','options','find','create','body','describe','addMessage','omit','getMessages','findOne','MailMessage','sort','where','pick','MailInteractionId','filter','$gte','split','format','include','findAll','inlineCss','rows','addTags','setTags','ids','Tag','color','emit','mailInteractionTags:save','removeTags','download','unix','toString','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','push','Attachment','Messages','from','bcc'];(function(_0x2ca0d5,_0xe746c3){var _0x59092c=function(_0x108044){while(--_0x108044){_0x2ca0d5['push'](_0x2ca0d5['shift']());}};_0x59092c(++_0xe746c3);}(_0xc3d2,0x16c));var _0x2c3d=function(_0x176f43,_0x1d688b){_0x176f43=_0x176f43-0x0;var _0x1bd2ea=_0xc3d2[_0x176f43];return _0x1bd2ea;};'use strict';var emlformat=require(_0x2c3d('0x0'));var rimraf=require(_0x2c3d('0x1'));var zipdir=require(_0x2c3d('0x2'));var moment=require(_0x2c3d('0x3'));var BPromise=require(_0x2c3d('0x4'));var util=require(_0x2c3d('0x5'));var path=require(_0x2c3d('0x6'));var fs=require('fs');var _=require(_0x2c3d('0x7'));var juice=require(_0x2c3d('0x8'));var Redis=require(_0x2c3d('0x9'));var interaction=require(_0x2c3d('0xa'));var qs=require(_0x2c3d('0xb'));var logger=require(_0x2c3d('0xc'))('api');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var htmlEntities=require('html-entities');config[_0x2c3d('0xd')]=_[_0x2c3d('0xe')](config[_0x2c3d('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x2c3d('0xf'))(new Redis(config[_0x2c3d('0xd')]));require('./mailInteraction.socket')[_0x2c3d('0x10')](socket);function respondWithStatusCode(_0x5ba470,_0x837c81){_0x837c81=_0x837c81||0xcc;return function(_0x903383){if(_0x903383){return _0x5ba470['sendStatus'](_0x837c81);}return _0x5ba470[_0x2c3d('0x11')](_0x837c81)[_0x2c3d('0x12')]();};}function respondWithResult(_0x4da348,_0x5e69fe){_0x5e69fe=_0x5e69fe||0xc8;return function(_0x2ca649){if(_0x2ca649){return _0x4da348[_0x2c3d('0x11')](_0x5e69fe)[_0x2c3d('0x13')](_0x2ca649);}};}function respondWithFilteredResult(_0x38853a,_0x2b0cd9){return function(_0x2bde80){if(_0x2bde80){var _0x25ccb7=typeof _0x2b0cd9['offset']===_0x2c3d('0x14')&&typeof _0x2b0cd9[_0x2c3d('0x15')]==='undefined';var _0xb8c68b=_0x2bde80[_0x2c3d('0x16')];var _0x3a1914=_0x25ccb7?0x0:_0x2b0cd9['offset'];var _0x517b80=_0x25ccb7?_0x2bde80[_0x2c3d('0x16')]:_0x2b0cd9[_0x2c3d('0x17')]+_0x2b0cd9[_0x2c3d('0x15')];var _0x1a36ae;if(_0x517b80>=_0xb8c68b){_0x517b80=_0xb8c68b;_0x1a36ae=0xc8;}else{_0x1a36ae=0xce;}_0x38853a['status'](_0x1a36ae);return _0x38853a[_0x2c3d('0x18')](_0x2c3d('0x19'),_0x3a1914+'-'+_0x517b80+'/'+_0xb8c68b)[_0x2c3d('0x13')](_0x2bde80);}return null;};}function saveUpdates(_0x1521f5){return function(_0x483c42){if(_0x483c42){return _0x483c42[_0x2c3d('0x1a')](_0x1521f5)[_0x2c3d('0x1b')](function(_0x1a5f89){return _0x1a5f89;});}return null;};}function removeEntity(_0xb3548){return function(_0x25fbd2){if(_0x25fbd2){return _0x25fbd2[_0x2c3d('0x1c')]()[_0x2c3d('0x1b')](function(){_0xb3548[_0x2c3d('0x11')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4a6504){return function(_0x2e6afe){if(!_0x2e6afe){_0x4a6504[_0x2c3d('0x1d')](0x194);}return _0x2e6afe;};}function handleError(_0x409d47,_0x2c2560){_0x2c2560=_0x2c2560||0x1f4;return function(_0x50f834){logger[_0x2c3d('0x1e')](_0x50f834[_0x2c3d('0x1f')]);if(_0x50f834[_0x2c3d('0x20')]){delete _0x50f834[_0x2c3d('0x20')];}_0x409d47[_0x2c3d('0x11')](_0x2c2560)[_0x2c3d('0x21')](_0x50f834);};}exports[_0x2c3d('0x22')]=function(_0x23a124,_0x42bf14){var _0x697c7f={};var _0x2a60f9=_[_0x2c3d('0x23')](db[_0x2c3d('0x24')][_0x2c3d('0x25')],function(_0x272c83){return{'name':_0x272c83[_0x2c3d('0x26')],'type':_0x272c83[_0x2c3d('0x27')]['key']};});_0x697c7f=qs['getOptions'](_0x2a60f9,_0x23a124);return interaction['findAll'](_0x2c3d('0x28'),_0x23a124[_0x2c3d('0x29')],_0x23a124[_0x2c3d('0x2a')],_0x697c7f,_0x2a60f9)[_0x2c3d('0x1b')](respondWithFilteredResult(_0x42bf14,_0x697c7f))[_0x2c3d('0x2b')](handleError(_0x42bf14,null));};exports[_0x2c3d('0x2c')]=function(_0x5259ba,_0x11cb7f){var _0x4f3960={'raw':![],'where':{'id':_0x5259ba[_0x2c3d('0x2d')]['id']}},_0xf100e0={};_0xf100e0[_0x2c3d('0x2e')]=_[_0x2c3d('0x2f')](db['MailInteraction'][_0x2c3d('0x25')]);_0xf100e0[_0x2c3d('0x29')]=_['keys'](_0x5259ba[_0x2c3d('0x29')]);_0xf100e0[_0x2c3d('0x30')]=_[_0x2c3d('0x31')](_0xf100e0['model'],_0xf100e0[_0x2c3d('0x29')]);_0x4f3960[_0x2c3d('0x32')]=_[_0x2c3d('0x31')](_0xf100e0[_0x2c3d('0x2e')],qs[_0x2c3d('0x33')](_0x5259ba['query'][_0x2c3d('0x33')]));_0x4f3960[_0x2c3d('0x32')]=_0x4f3960['attributes'][_0x2c3d('0x34')]?_0x4f3960['attributes']:_0xf100e0[_0x2c3d('0x2e')];if(_0x5259ba['query'][_0x2c3d('0x35')]){_0x4f3960['include']=[{'all':!![]}];}_0x4f3960=_[_0x2c3d('0x36')]({},_0x4f3960,_0x5259ba[_0x2c3d('0x37')]);return db[_0x2c3d('0x24')][_0x2c3d('0x38')](_0x4f3960)['then'](handleEntityNotFound(_0x11cb7f,null))[_0x2c3d('0x1b')](respondWithResult(_0x11cb7f,null))['catch'](handleError(_0x11cb7f,null));};exports[_0x2c3d('0x39')]=function(_0x2c8931,_0x20cec0){return db['MailInteraction'][_0x2c3d('0x39')](_0x2c8931[_0x2c3d('0x3a')],{})[_0x2c3d('0x1b')](respondWithResult(_0x20cec0,0xc9))[_0x2c3d('0x2b')](handleError(_0x20cec0,null));};exports[_0x2c3d('0x1a')]=function(_0x290416,_0x4b3166){if(_0x290416[_0x2c3d('0x3a')]['id']){delete _0x290416['body']['id'];}return db['MailInteraction'][_0x2c3d('0x38')]({'where':{'id':_0x290416[_0x2c3d('0x2d')]['id']}})[_0x2c3d('0x1b')](handleEntityNotFound(_0x4b3166,null))['then'](saveUpdates(_0x290416[_0x2c3d('0x3a')],null))[_0x2c3d('0x1b')](respondWithResult(_0x4b3166,null))[_0x2c3d('0x2b')](handleError(_0x4b3166,null));};exports[_0x2c3d('0x1c')]=function(_0x25156a,_0x246b84){return db[_0x2c3d('0x24')][_0x2c3d('0x38')]({'where':{'id':_0x25156a[_0x2c3d('0x2d')]['id']}})['then'](handleEntityNotFound(_0x246b84,null))[_0x2c3d('0x1b')](removeEntity(_0x246b84,null))[_0x2c3d('0x2b')](handleError(_0x246b84,null));};exports[_0x2c3d('0x3b')]=function(_0x236fad,_0x4ef081){return db[_0x2c3d('0x24')]['describe']()[_0x2c3d('0x1b')](respondWithResult(_0x4ef081,null))[_0x2c3d('0x2b')](handleError(_0x4ef081,null));};exports[_0x2c3d('0x3c')]=function(_0x1ee487,_0x14734a){return db['MailMessage'][_0x2c3d('0x38')]({'where':{'id':_0x1ee487['params']['id']}})[_0x2c3d('0x1b')](handleEntityNotFound(_0x14734a,null))[_0x2c3d('0x1b')](function(_0x430aef){if(_0x430aef){return _0x430aef[_0x2c3d('0x3c')](_0x1ee487['body']['ids'],_[_0x2c3d('0x3d')](_0x1ee487[_0x2c3d('0x3a')],['ids','id'])||{});}})[_0x2c3d('0x1b')](respondWithResult(_0x14734a,null))['catch'](handleError(_0x14734a,null));};exports[_0x2c3d('0x3e')]=function(_0x141478,_0x3c5d36){var _0xfa4100={'raw':![],'where':{}};var _0x43089d={};var _0x401f53={'count':0x0,'rows':[]};return db[_0x2c3d('0x24')][_0x2c3d('0x3f')]({'where':{'id':_0x141478[_0x2c3d('0x2d')]['id']}})[_0x2c3d('0x1b')](handleEntityNotFound(_0x3c5d36,null))['then'](function(_0x4ba039){if(_0x4ba039){_0x43089d[_0x2c3d('0x2e')]=_[_0x2c3d('0x2f')](db[_0x2c3d('0x40')][_0x2c3d('0x25')]);_0x43089d[_0x2c3d('0x29')]=_[_0x2c3d('0x2f')](_0x141478[_0x2c3d('0x29')]);_0x43089d[_0x2c3d('0x30')]=_['intersection'](_0x43089d[_0x2c3d('0x2e')],_0x43089d[_0x2c3d('0x29')]);_0xfa4100['attributes']=_[_0x2c3d('0x31')](_0x43089d[_0x2c3d('0x2e')],qs[_0x2c3d('0x33')](_0x141478[_0x2c3d('0x29')][_0x2c3d('0x33')]));_0xfa4100['attributes']=_0xfa4100[_0x2c3d('0x32')][_0x2c3d('0x34')]?_0xfa4100[_0x2c3d('0x32')]:_0x43089d[_0x2c3d('0x2e')];if(!_0x141478['query']['hasOwnProperty']('nolimit')){_0xfa4100[_0x2c3d('0x15')]=qs[_0x2c3d('0x15')](_0x141478[_0x2c3d('0x29')][_0x2c3d('0x15')]);_0xfa4100[_0x2c3d('0x17')]=qs[_0x2c3d('0x17')](_0x141478[_0x2c3d('0x29')][_0x2c3d('0x17')]);}_0xfa4100['order']=qs[_0x2c3d('0x41')](_0x141478['query'][_0x2c3d('0x41')]);_0xfa4100[_0x2c3d('0x42')]=qs[_0x2c3d('0x30')](_[_0x2c3d('0x43')](_0x141478[_0x2c3d('0x29')],_0x43089d['filters']));_0xfa4100['where'][_0x2c3d('0x44')]=_0x4ba039['id'];if(_0x141478[_0x2c3d('0x29')]['filter']){_0xfa4100[_0x2c3d('0x42')]=_[_0x2c3d('0x36')](_0xfa4100[_0x2c3d('0x42')],{'$or':_[_0x2c3d('0x23')](_0xfa4100[_0x2c3d('0x32')],function(_0x344286){var _0x3f86ec={};_0x3f86ec[_0x344286]={'$like':'%'+_0x141478[_0x2c3d('0x29')][_0x2c3d('0x45')]+'%'};return _0x3f86ec;})});}if(_0x141478[_0x2c3d('0x29')][_0x2c3d('0x46')]){var _0x5ef1dc=_0x141478[_0x2c3d('0x29')][_0x2c3d('0x46')][_0x2c3d('0x47')](',');var _0x2cba0d={};_0x2cba0d[_0x5ef1dc[0x0]]={'$gte':moment(_0x5ef1dc[0x1])[_0x2c3d('0x48')]('YYYY-MM-DD\x20HH:mm:ss')};_0xfa4100['where']=_[_0x2c3d('0x36')](_0xfa4100['where'],_0x2cba0d);}_0xfa4100=_[_0x2c3d('0x36')]({},_0xfa4100,_0x141478[_0x2c3d('0x37')]);return db[_0x2c3d('0x40')][_0x2c3d('0x16')]({'where':_0xfa4100['where']})[_0x2c3d('0x1b')](function(_0x220155){_0x401f53[_0x2c3d('0x16')]=_0x220155;if(_0x141478[_0x2c3d('0x29')][_0x2c3d('0x35')]){_0xfa4100[_0x2c3d('0x49')]=[{'all':!![]}];}return db[_0x2c3d('0x40')][_0x2c3d('0x4a')](_0xfa4100);})[_0x2c3d('0x1b')](function(_0x312299){if(_0x141478['query'][_0x2c3d('0x4b')]==='true'){for(var _0x52b725=0x0;_0x52b725<_0x312299[_0x2c3d('0x34')];_0x52b725++){_0x312299[_0x52b725]['body']=juice(_0x312299[_0x52b725][_0x2c3d('0x3a')]);}}_0x401f53[_0x2c3d('0x4c')]=_0x312299;return _0x401f53;});}})['then'](respondWithFilteredResult(_0x3c5d36,_0xfa4100))[_0x2c3d('0x2b')](handleError(_0x3c5d36,null));};exports[_0x2c3d('0x4d')]=function(_0x2f73ef,_0x1f56d4){return db[_0x2c3d('0x24')]['find']({'where':{'id':_0x2f73ef[_0x2c3d('0x2d')]['id']}})['then'](handleEntityNotFound(_0x1f56d4,null))[_0x2c3d('0x1b')](function(_0x2a3c1a){if(_0x2a3c1a){return _0x2a3c1a[_0x2c3d('0x4e')](_0x2f73ef['body'][_0x2c3d('0x4f')],_[_0x2c3d('0x3d')](_0x2f73ef[_0x2c3d('0x3a')],[_0x2c3d('0x4f'),'id'])||{})['spread'](function(){return db[_0x2c3d('0x50')][_0x2c3d('0x4a')]({'attributes':['id',_0x2c3d('0x20'),_0x2c3d('0x51')],'where':{'id':_0x2f73ef[_0x2c3d('0x3a')][_0x2c3d('0x4f')]}});})['then'](function(_0x13a76b){socket[_0x2c3d('0x52')](_0x2c3d('0x53'),{'id':Number(_0x2f73ef[_0x2c3d('0x2d')]['id']),'tags':_0x13a76b||[]});return{'id':Number(_0x2f73ef['params']['id']),'tags':_0x13a76b||[]};});}})[_0x2c3d('0x1b')](respondWithResult(_0x1f56d4,null))[_0x2c3d('0x2b')](handleError(_0x1f56d4,null));};exports[_0x2c3d('0x54')]=function(_0x2ecf2f,_0xa45094){return db[_0x2c3d('0x24')]['find']({'where':{'id':_0x2ecf2f[_0x2c3d('0x2d')]['id']}})[_0x2c3d('0x1b')](handleEntityNotFound(_0xa45094,null))[_0x2c3d('0x1b')](function(_0x23255a){if(_0x23255a){return _0x23255a[_0x2c3d('0x54')](_0x2ecf2f['query'][_0x2c3d('0x4f')]);}})[_0x2c3d('0x1b')](respondWithStatusCode(_0xa45094,null))[_0x2c3d('0x2b')](handleError(_0xa45094,null));};exports[_0x2c3d('0x55')]=function(_0x3bcda3,_0x272e8d){var _0x253a8a=moment()[_0x2c3d('0x56')]()[_0x2c3d('0x57')]();var _0x37439e=path[_0x2c3d('0x58')](config[_0x2c3d('0x59')],_0x2c3d('0x5a'),_0x2c3d('0x5b'),_0x2c3d('0x5c'));var _0x253883=path['join'](config[_0x2c3d('0x59')],_0x2c3d('0x5a'),_0x2c3d('0x5b'),_0x2c3d('0x5d'));var _0x121a70=path[_0x2c3d('0x58')](_0x37439e,_0x253a8a);var _0xdefa50=util[_0x2c3d('0x48')](_0x2c3d('0x5e'),_0x3bcda3[_0x2c3d('0x2d')]['id'],_0x253a8a);var _0x485d14=path['join'](_0x37439e,_0xdefa50);var _0x5038d4=[];if(_0x3bcda3[_0x2c3d('0x29')][_0x2c3d('0x5d')]){_0x5038d4[_0x2c3d('0x5f')]({'model':db[_0x2c3d('0x60')],'as':'Attachments','raw':!![]});}var _0x12a6e2=[{'model':db[_0x2c3d('0x40')],'as':_0x2c3d('0x61'),'attributes':['id','body',_0x2c3d('0x62'),'to','cc',_0x2c3d('0x63'),_0x2c3d('0x64'),'createdAt'],'where':{'secret':![]},'order':qs[_0x2c3d('0x41')]('id'),'include':_0x5038d4}];return db[_0x2c3d('0x24')][_0x2c3d('0x38')]({'where':{'id':_0x3bcda3[_0x2c3d('0x2d')]['id']},'include':_0x12a6e2})[_0x2c3d('0x1b')](handleEntityNotFound(_0x272e8d,null))[_0x2c3d('0x1b')](function(_0x264044){if(_0x264044&&_0x264044[_0x2c3d('0x61')]){var _0x545fb8=_0x264044['get']({'plain':!![]});fs[_0x2c3d('0x65')](_0x121a70);return BPromise[_0x2c3d('0x66')](_0x545fb8[_0x2c3d('0x61')],function(_0x1f71ea,_0x33825f){var _0x4b4c9b={'from':_0x1f71ea[_0x2c3d('0x62')],'to':_0x1f71ea['to']||_0x2c3d('0x67'),'subject':_0x1f71ea[_0x2c3d('0x64')],'html':htmlEntities[_0x2c3d('0x68')](_0x1f71ea['body']),'headers':{'Date':moment(_0x1f71ea['createdAt'])['format'](_0x2c3d('0x69'))},'attachments':[]};if(_0x1f71ea['cc']){_0x4b4c9b[_0x2c3d('0x6a')]['Cc']=_0x1f71ea['cc'];}if(_0x1f71ea['bcc']){_0x4b4c9b[_0x2c3d('0x6a')][_0x2c3d('0x6b')]=_0x1f71ea[_0x2c3d('0x63')];}return new BPromise(function(_0x238161,_0x25aab7){if(_0x1f71ea['Attachments']){for(var _0xf2aa6d=0x0;_0xf2aa6d<_0x1f71ea[_0x2c3d('0x6c')][_0x2c3d('0x34')];_0xf2aa6d++){var _0x41be30=_0x1f71ea[_0x2c3d('0x6c')][_0xf2aa6d];var _0x41dab1=path[_0x2c3d('0x58')](_0x253883,_0x41be30[_0x2c3d('0x6d')]);if(fs[_0x2c3d('0x6e')](_0x41dab1)){_0x4b4c9b[_0x2c3d('0x5d')][_0x2c3d('0x5f')]({'name':_0x41be30[_0x2c3d('0x20')],'contentType':_0x41be30[_0x2c3d('0x27')],'data':fs[_0x2c3d('0x6f')](_0x41dab1)});}}}emlformat[_0x2c3d('0x70')](_0x4b4c9b,function(_0x44ebfd,_0x4ade97){if(_0x44ebfd)return _0x25aab7(_0x44ebfd);fs[_0x2c3d('0x71')](path[_0x2c3d('0x58')](_0x121a70,util[_0x2c3d('0x48')](_0x2c3d('0x72'),_0x33825f)),_0x4ade97);return _0x238161(_0x4ade97);});});})['then'](function(){return new BPromise(function(_0x1084e6,_0x3cd110){zipdir(_0x121a70,{'saveTo':_0x485d14},function(_0x475c4f,_0xa18b1a){if(_0x475c4f)return _0x3cd110(_0x475c4f);return _0x1084e6(_0xa18b1a);});})['then'](function(){return new BPromise(function(_0x5384d1,_0x1b03b3){rimraf(_0x121a70,function(_0xc3c443){if(_0xc3c443)_0x1b03b3(_0xc3c443);return _0x5384d1();});});})[_0x2c3d('0x1b')](function(){return _0x272e8d[_0x2c3d('0x55')](_0x485d14,_0xdefa50,function(_0x283ede){if(!_0x283ede)fs[_0x2c3d('0x73')](_0x485d14);});});});}else{return _0x272e8d[_0x2c3d('0x1d')](0xc8);}})[_0x2c3d('0x2b')](handleError(_0x272e8d,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index c381a91..c65ee3a 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 _0x335f=['../../mysqldb','MailInteraction','setMaxListeners','update','remove','getUsers','setDataValue','Users','map','findAll','then','length','emit','catch','hasOwnProperty','hook','exports','events'];(function(_0x1d1f4d,_0x8583d2){var _0x472ffa=function(_0x1aa8fe){while(--_0x1aa8fe){_0x1d1f4d['push'](_0x1d1f4d['shift']());}};_0x472ffa(++_0x8583d2);}(_0x335f,0xfb));var _0xf335=function(_0x289b42,_0x43db5){_0x289b42=_0x289b42-0x0;var _0x3171e8=_0x335f[_0x289b42];return _0x3171e8;};'use strict';var EventEmitter=require(_0xf335('0x0'));var MailInteraction=require(_0xf335('0x1'))['db'][_0xf335('0x2')];var MailMessage=require(_0xf335('0x1'))['db']['MailMessage'];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0xf335('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xf335('0x4'),'afterDestroy':_0xf335('0x5')};function emitEvent(_0x3dd964){return function(_0x3a7c6e,_0x18971f,_0x386c51){_0x3a7c6e[_0xf335('0x6')]({'attributes':['id'],'raw':!![]})['then'](function(_0x563afe){_0x3a7c6e[_0xf335('0x7')](_0xf335('0x8'),_0x563afe[_0xf335('0x9')](function(_0xa11d5a){return{'id':_0xa11d5a['id']};}));return MailMessage[_0xf335('0xa')]({'where':{'MailInteractionId':_0x3a7c6e['id'],'direction':'in','read':![]},'raw':!![]});})[_0xf335('0xb')](function(_0x3e349b){_0x3a7c6e[_0xf335('0x7')]('unreadMessages',_0x3e349b[_0xf335('0xc')]);MailInteractionEvents[_0xf335('0xd')](_0x3dd964+':'+_0x3a7c6e['id'],_0x3a7c6e);MailInteractionEvents['emit'](_0x3dd964,_0x3a7c6e);_0x386c51(null);})[_0xf335('0xe')](_0x386c51(null));};}for(var e in events){if(events[_0xf335('0xf')](e)){var event=events[e];MailInteraction[_0xf335('0x10')](e,emitEvent(event));}}module[_0xf335('0x11')]=MailInteractionEvents; \ No newline at end of file +var _0xb77d=['emit','exports','events','../../mysqldb','MailMessage','setMaxListeners','save','remove','getUsers','setDataValue','map','findAll','then','length'];(function(_0x3b91da,_0x3c2d52){var _0x1fe6e9=function(_0xdf42f5){while(--_0xdf42f5){_0x3b91da['push'](_0x3b91da['shift']());}};_0x1fe6e9(++_0x3c2d52);}(_0xb77d,0x16e));var _0xdb77=function(_0x414e73,_0x57569f){_0x414e73=_0x414e73-0x0;var _0x5c3cba=_0xb77d[_0x414e73];return _0x5c3cba;};'use strict';var EventEmitter=require(_0xdb77('0x0'));var MailInteraction=require(_0xdb77('0x1'))['db']['MailInteraction'];var MailMessage=require(_0xdb77('0x1'))['db'][_0xdb77('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0xdb77('0x3')](0x0);var events={'afterCreate':_0xdb77('0x4'),'afterUpdate':'update','afterDestroy':_0xdb77('0x5')};function emitEvent(_0x273474){return function(_0x4dfd74,_0x5bfd06,_0x4c9697){_0x4dfd74[_0xdb77('0x6')]({'attributes':['id'],'raw':!![]})['then'](function(_0x25e4fa){_0x4dfd74[_0xdb77('0x7')]('Users',_0x25e4fa[_0xdb77('0x8')](function(_0x5e822e){return{'id':_0x5e822e['id']};}));return MailMessage[_0xdb77('0x9')]({'where':{'MailInteractionId':_0x4dfd74['id'],'direction':'in','read':![]},'raw':!![]});})[_0xdb77('0xa')](function(_0x2499f7){_0x4dfd74['setDataValue']('unreadMessages',_0x2499f7[_0xdb77('0xb')]);MailInteractionEvents[_0xdb77('0xc')](_0x273474+':'+_0x4dfd74['id'],_0x4dfd74);MailInteractionEvents[_0xdb77('0xc')](_0x273474,_0x4dfd74);_0x4c9697(null);})['catch'](_0x4c9697(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailInteraction['hook'](e,emitEvent(event));}}module[_0xdb77('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 ebe9f23..6979832 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 _0x6740=['utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./mailInteraction.attributes','exports','define','MailInteraction','mail_interactions','subject','FULLTEXT','substatus','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed','changed','closedAt','models','get','update','then'];(function(_0x13ea00,_0x12f610){var _0x1f7347=function(_0x34ae63){while(--_0x34ae63){_0x13ea00['push'](_0x13ea00['shift']());}};_0x1f7347(++_0x12f610);}(_0x6740,0x16e));var _0x0674=function(_0x3a3add,_0x5589b3){_0x3a3add=_0x3a3add-0x0;var _0x532b6a=_0x6740[_0x3a3add];return _0x532b6a;};'use strict';var _=require(_0x0674('0x0'));var util=require(_0x0674('0x1'));var logger=require('../../config/logger')(_0x0674('0x2'));var moment=require(_0x0674('0x3'));var BPromise=require(_0x0674('0x4'));var rp=require(_0x0674('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0674('0x6'));var config=require(_0x0674('0x7'));var attributes=require(_0x0674('0x8'));module[_0x0674('0x9')]=function(_0xbc288e,_0x338ce2){return _0xbc288e[_0x0674('0xa')](_0x0674('0xb'),attributes,{'tableName':_0x0674('0xc'),'paranoid':![],'indexes':[{'name':'fti_mail_interactions','fields':[_0x0674('0xd'),'to'],'type':_0x0674('0xe')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x3775d9,_0x1e2ca7,_0x4c5c8c){if(_0x3775d9[_0x0674('0xf')]){_0x3775d9[_0x0674('0x10')]=moment()[_0x0674('0x11')](_0x0674('0x12'));}if(_0x3775d9[_0x0674('0x13')]){_0x3775d9['closedAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x4c5c8c(null,_0x1e2ca7);},'beforeUpdate':function(_0x1a315f,_0x4632d8,_0x5db373){if(_0x1a315f[_0x0674('0x14')](_0x0674('0xf'))){_0x1a315f['substatusAt']=_0x1a315f['substatus']?moment()[_0x0674('0x11')](_0x0674('0x12')):null;}if(_0x1a315f[_0x0674('0x14')](_0x0674('0x13'))){_0x1a315f[_0x0674('0x15')]=moment()['format'](_0x0674('0x12'));_0x1a315f[_0x0674('0xf')]=null;_0x1a315f[_0x0674('0x10')]=null;}_0x5db373(null,_0x1a315f);},'afterUpdate':function(_0x4f41d2,_0x272b86,_0x42471e){var _0x4b3a88=_0xbc288e[_0x0674('0x16')];var _0x3b008e=_0x4f41d2[_0x0674('0x17')]({'plain':!![]});if(_0x3b008e[_0x0674('0x13')]){return _0x4b3a88['MailMessage'][_0x0674('0x18')]({'read':!![]},{'where':{'MailInteractionId':_0x3b008e['id']}})[_0x0674('0x19')](function(){_0x42471e();})['catch'](function(_0x42f786){_0x42471e(_0x42f786);});}else{_0x42471e();}}},'charset':_0x0674('0x1a'),'collate':_0x0674('0x1b')});}; \ No newline at end of file +var _0x41c1=['models','get','MailMessage','update','then','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./mailInteraction.attributes','exports','define','MailInteraction','fti_mail_interactions','FULLTEXT','substatus','substatusAt','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','changed'];(function(_0x57d6c3,_0x5ac8b8){var _0x4c101c=function(_0x445ef6){while(--_0x445ef6){_0x57d6c3['push'](_0x57d6c3['shift']());}};_0x4c101c(++_0x5ac8b8);}(_0x41c1,0x152));var _0x141c=function(_0x2fa8b5,_0x2b4ca8){_0x2fa8b5=_0x2fa8b5-0x0;var _0x3007c4=_0x41c1[_0x2fa8b5];return _0x3007c4;};'use strict';var _=require(_0x141c('0x0'));var util=require(_0x141c('0x1'));var logger=require(_0x141c('0x2'))(_0x141c('0x3'));var moment=require('moment');var BPromise=require(_0x141c('0x4'));var rp=require(_0x141c('0x5'));var fs=require('fs');var path=require(_0x141c('0x6'));var rimraf=require(_0x141c('0x7'));var config=require(_0x141c('0x8'));var attributes=require(_0x141c('0x9'));module[_0x141c('0xa')]=function(_0x13de22,_0x121561){return _0x13de22[_0x141c('0xb')](_0x141c('0xc'),attributes,{'tableName':'mail_interactions','paranoid':![],'indexes':[{'name':_0x141c('0xd'),'fields':['subject','to'],'type':_0x141c('0xe')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x4adac2,_0x487315,_0x3b6f36){if(_0x4adac2[_0x141c('0xf')]){_0x4adac2[_0x141c('0x10')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}if(_0x4adac2[_0x141c('0x11')]){_0x4adac2[_0x141c('0x12')]=moment()[_0x141c('0x13')](_0x141c('0x14'));}_0x3b6f36(null,_0x487315);},'beforeUpdate':function(_0x52ffcb,_0x270635,_0x58cd78){if(_0x52ffcb[_0x141c('0x15')](_0x141c('0xf'))){_0x52ffcb[_0x141c('0x10')]=_0x52ffcb[_0x141c('0xf')]?moment()[_0x141c('0x13')]('YYYY-MM-DD\x20HH:mm:ss'):null;}if(_0x52ffcb[_0x141c('0x15')](_0x141c('0x11'))){_0x52ffcb[_0x141c('0x12')]=moment()['format'](_0x141c('0x14'));_0x52ffcb[_0x141c('0xf')]=null;_0x52ffcb[_0x141c('0x10')]=null;}_0x58cd78(null,_0x52ffcb);},'afterUpdate':function(_0x3698fc,_0x34b1a6,_0x3517eb){var _0x55da=_0x13de22[_0x141c('0x16')];var _0x5af587=_0x3698fc[_0x141c('0x17')]({'plain':!![]});if(_0x5af587['closed']){return _0x55da[_0x141c('0x18')][_0x141c('0x19')]({'read':!![]},{'where':{'MailInteractionId':_0x5af587['id']}})[_0x141c('0x1a')](function(){_0x3517eb();})[_0x141c('0x1b')](function(_0x4c0032){_0x3517eb(_0x4c0032);});}else{_0x3517eb();}}},'charset':_0x141c('0x1c'),'collate':_0x141c('0x1d')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index 9972b30..74efc53 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 _0x5557=['error','code','message','info','result','catch','MailInteraction','update','options','where','attributes','limit','UpdateMailInteraction','debug','stringify','AddTagsToMailInteraction','find','addTags','body','omit','spread','AddTags','lodash','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','register','then','MailInteraction,\x20%s,\x20%s','request\x20sent','MailInteraction,\x20%s,\x20%s,\x20%s'];(function(_0x438fe1,_0x3308d5){var _0x3c8e1b=function(_0x2f8d41){while(--_0x2f8d41){_0x438fe1['push'](_0x438fe1['shift']());}};_0x3c8e1b(++_0x3308d5);}(_0x5557,0x1ba));var _0x7555=function(_0x48d5da,_0x2c85e4){_0x48d5da=_0x48d5da-0x0;var _0x5ab43b=_0x5557[_0x48d5da];return _0x5ab43b;};'use strict';var _=require(_0x7555('0x0'));var util=require('util');var moment=require(_0x7555('0x1'));var BPromise=require('bluebird');var rs=require(_0x7555('0x2'));var fs=require('fs');var Redis=require(_0x7555('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x7555('0x4'));var logger=require('../../config/logger')(_0x7555('0x5'));var config=require(_0x7555('0x6'));var jayson=require(_0x7555('0x7'));var client=jayson[_0x7555('0x8')][_0x7555('0x9')]({'port':0x232a});config[_0x7555('0xa')]=_[_0x7555('0xb')](config[_0x7555('0xa')],{'host':_0x7555('0xc'),'port':0x18eb});var socket=require(_0x7555('0xd'))(new Redis(config[_0x7555('0xa')]));require(_0x7555('0xe'))[_0x7555('0xf')](socket);function respondWithRpcPromise(_0x4eacd6,_0x121ad7,_0x3d3487){return new BPromise(function(_0x2a6a51,_0x5ddd00){return client['request'](_0x4eacd6,_0x3d3487)[_0x7555('0x10')](function(_0x5baec9){logger['info'](_0x7555('0x11'),_0x121ad7,_0x7555('0x12'));logger['debug'](_0x7555('0x13'),_0x121ad7,_0x7555('0x12'),JSON['stringify'](_0x5baec9));if(_0x5baec9[_0x7555('0x14')]){if(_0x5baec9[_0x7555('0x14')][_0x7555('0x15')]===0x1f4){logger[_0x7555('0x14')](_0x7555('0x11'),_0x121ad7,_0x5baec9[_0x7555('0x14')]['message']);return _0x5ddd00(_0x5baec9[_0x7555('0x14')][_0x7555('0x16')]);}logger[_0x7555('0x14')]('MailInteraction,\x20%s,\x20%s',_0x121ad7,_0x5baec9['error']['message']);return _0x2a6a51(_0x5baec9[_0x7555('0x14')]['message']);}else{logger[_0x7555('0x17')](_0x7555('0x11'),_0x121ad7,_0x7555('0x12'));_0x2a6a51(_0x5baec9[_0x7555('0x18')]['message']);}})[_0x7555('0x19')](function(_0x295a9f){logger[_0x7555('0x14')](_0x7555('0x11'),_0x121ad7,_0x295a9f);_0x5ddd00(_0x295a9f);});});}exports['UpdateMailInteraction']=function(_0x59d32a){var _0xa6b572=this;return new Promise(function(_0x46a5b2,_0x54725c){return db[_0x7555('0x1a')][_0x7555('0x1b')](_0x59d32a['body'],{'raw':_0x59d32a[_0x7555('0x1c')]?_0x59d32a['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x59d32a[_0x7555('0x1c')]?_0x59d32a[_0x7555('0x1c')][_0x7555('0x1d')]||null:null,'attributes':_0x59d32a[_0x7555('0x1c')]?_0x59d32a['options'][_0x7555('0x1e')]||null:null,'limit':_0x59d32a[_0x7555('0x1c')]?_0x59d32a[_0x7555('0x1c')][_0x7555('0x1f')]||null:null})[_0x7555('0x10')](function(_0x4d9517){logger[_0x7555('0x17')](_0x7555('0x20'),_0x59d32a);logger[_0x7555('0x21')]('UpdateMailInteraction',_0x59d32a,JSON[_0x7555('0x22')](_0x4d9517));_0x46a5b2(_0x4d9517);})[_0x7555('0x19')](function(_0x24eba1){logger[_0x7555('0x14')]('UpdateMailInteraction',_0x24eba1[_0x7555('0x16')],_0x59d32a);_0x54725c(_0xa6b572['error'](0x1f4,_0x24eba1['message']));});});};exports[_0x7555('0x23')]=function(_0xcfbf24){return new Promise(function(_0x1330cc,_0x212da6){return db[_0x7555('0x1a')][_0x7555('0x24')]({'where':_0xcfbf24[_0x7555('0x1c')]?_0xcfbf24[_0x7555('0x1c')][_0x7555('0x1d')]||null:null})[_0x7555('0x10')](function(_0x473072){if(_0x473072){return _0x473072[_0x7555('0x25')](_0xcfbf24[_0x7555('0x26')]['ids'],_[_0x7555('0x27')](_0xcfbf24[_0x7555('0x26')],['ids','id'])||{});}})[_0x7555('0x28')](function(_0x24d66d){logger[_0x7555('0x17')](_0x7555('0x29'),_0xcfbf24);logger['debug'](_0x7555('0x29'),_0xcfbf24,JSON[_0x7555('0x22')](_0x24d66d));_0x1330cc(_0x24d66d);})[_0x7555('0x19')](function(_0x2da43d){logger['error']('AddTags',_0x2da43d[_0x7555('0x16')],_0xcfbf24);_0x212da6(_this[_0x7555('0x14')](0x1f4,_0x2da43d['message']));});});}; \ No newline at end of file +var _0x53b5=['raw','where','attributes','limit','then','AddTagsToMailInteraction','ids','omit','AddTags','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./mailInteraction.socket','register','info','MailInteraction,\x20%s,\x20%s','debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','UpdateMailInteraction','MailInteraction','update','body','options'];(function(_0x2d49d9,_0x1443e5){var _0x10af12=function(_0x3794f4){while(--_0x3794f4){_0x2d49d9['push'](_0x2d49d9['shift']());}};_0x10af12(++_0x1443e5);}(_0x53b5,0x161));var _0x553b=function(_0x5deb51,_0x59c7e4){_0x5deb51=_0x5deb51-0x0;var _0x176f87=_0x53b5[_0x5deb51];return _0x176f87;};'use strict';var _=require(_0x553b('0x0'));var util=require(_0x553b('0x1'));var moment=require(_0x553b('0x2'));var BPromise=require(_0x553b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x553b('0x4'));var db=require(_0x553b('0x5'))['db'];var utils=require(_0x553b('0x6'));var logger=require(_0x553b('0x7'))(_0x553b('0x8'));var config=require(_0x553b('0x9'));var jayson=require(_0x553b('0xa'));var client=jayson[_0x553b('0xb')][_0x553b('0xc')]({'port':0x232a});config['redis']=_[_0x553b('0xd')](config[_0x553b('0xe')],{'host':_0x553b('0xf'),'port':0x18eb});var socket=require(_0x553b('0x10'))(new Redis(config[_0x553b('0xe')]));require(_0x553b('0x11'))[_0x553b('0x12')](socket);function respondWithRpcPromise(_0x216551,_0x3a5a2c,_0x4d769a){return new BPromise(function(_0x5b053e,_0x43fdfe){return client['request'](_0x216551,_0x4d769a)['then'](function(_0x391698){logger[_0x553b('0x13')](_0x553b('0x14'),_0x3a5a2c,'request\x20sent');logger[_0x553b('0x15')](_0x553b('0x16'),_0x3a5a2c,'request\x20sent',JSON[_0x553b('0x17')](_0x391698));if(_0x391698[_0x553b('0x18')]){if(_0x391698[_0x553b('0x18')]['code']===0x1f4){logger[_0x553b('0x18')](_0x553b('0x14'),_0x3a5a2c,_0x391698[_0x553b('0x18')]['message']);return _0x43fdfe(_0x391698[_0x553b('0x18')]['message']);}logger[_0x553b('0x18')]('MailInteraction,\x20%s,\x20%s',_0x3a5a2c,_0x391698['error'][_0x553b('0x19')]);return _0x5b053e(_0x391698[_0x553b('0x18')][_0x553b('0x19')]);}else{logger[_0x553b('0x13')](_0x553b('0x14'),_0x3a5a2c,_0x553b('0x1a'));_0x5b053e(_0x391698[_0x553b('0x1b')][_0x553b('0x19')]);}})[_0x553b('0x1c')](function(_0x2486c5){logger[_0x553b('0x18')](_0x553b('0x14'),_0x3a5a2c,_0x2486c5);_0x43fdfe(_0x2486c5);});});}exports[_0x553b('0x1d')]=function(_0x597531){var _0x40032c=this;return new Promise(function(_0x39601c,_0x118eb5){return db[_0x553b('0x1e')][_0x553b('0x1f')](_0x597531[_0x553b('0x20')],{'raw':_0x597531[_0x553b('0x21')]?_0x597531[_0x553b('0x21')][_0x553b('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x597531[_0x553b('0x21')]?_0x597531[_0x553b('0x21')][_0x553b('0x23')]||null:null,'attributes':_0x597531[_0x553b('0x21')]?_0x597531[_0x553b('0x21')][_0x553b('0x24')]||null:null,'limit':_0x597531['options']?_0x597531[_0x553b('0x21')][_0x553b('0x25')]||null:null})[_0x553b('0x26')](function(_0xd9dc4b){logger[_0x553b('0x13')](_0x553b('0x1d'),_0x597531);logger['debug'](_0x553b('0x1d'),_0x597531,JSON['stringify'](_0xd9dc4b));_0x39601c(_0xd9dc4b);})[_0x553b('0x1c')](function(_0x318832){logger[_0x553b('0x18')](_0x553b('0x1d'),_0x318832[_0x553b('0x19')],_0x597531);_0x118eb5(_0x40032c['error'](0x1f4,_0x318832[_0x553b('0x19')]));});});};exports[_0x553b('0x27')]=function(_0x1b90d6){return new Promise(function(_0x182ce4,_0x391f36){return db[_0x553b('0x1e')]['find']({'where':_0x1b90d6[_0x553b('0x21')]?_0x1b90d6['options']['where']||null:null})[_0x553b('0x26')](function(_0x300474){if(_0x300474){return _0x300474['addTags'](_0x1b90d6[_0x553b('0x20')][_0x553b('0x28')],_[_0x553b('0x29')](_0x1b90d6[_0x553b('0x20')],['ids','id'])||{});}})['spread'](function(_0x2521a0){logger[_0x553b('0x13')](_0x553b('0x2a'),_0x1b90d6);logger['debug']('AddTags',_0x1b90d6,JSON[_0x553b('0x17')](_0x2521a0));_0x182ce4(_0x2521a0);})[_0x553b('0x1c')](function(_0x3a9b0e){logger[_0x553b('0x18')](_0x553b('0x2a'),_0x3a9b0e[_0x553b('0x19')],_0x1b90d6);_0x391f36(_this[_0x553b('0x18')](0x1f4,_0x3a9b0e[_0x553b('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index c9b070c..0128e8b 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 _0x4ac1=['register','length','mailInteraction:','./mailInteraction.events','save','remove','update','emit','removeListener'];(function(_0x74f919,_0x183d33){var _0x2225aa=function(_0x5beec7){while(--_0x5beec7){_0x74f919['push'](_0x74f919['shift']());}};_0x2225aa(++_0x183d33);}(_0x4ac1,0xc0));var _0x14ac=function(_0x4d9a84,_0x47ee97){_0x4d9a84=_0x4d9a84-0x0;var _0x49af09=_0x4ac1[_0x4d9a84];return _0x49af09;};'use strict';var MailInteractionEvents=require(_0x14ac('0x0'));var events=[_0x14ac('0x1'),_0x14ac('0x2'),_0x14ac('0x3')];function createListener(_0x19187c,_0x5021ef){return function(_0x168641){_0x5021ef[_0x14ac('0x4')](_0x19187c,_0x168641);};}function removeListener(_0x5a30e1,_0x4d2ffd){return function(){MailInteractionEvents[_0x14ac('0x5')](_0x5a30e1,_0x4d2ffd);};}exports[_0x14ac('0x6')]=function(_0x2d3cff){for(var _0x350e87=0x0,_0x5b26cd=events[_0x14ac('0x7')];_0x350e87<_0x5b26cd;_0x350e87++){var _0x41205c=events[_0x350e87];var _0x284d32=createListener(_0x14ac('0x8')+_0x41205c,_0x2d3cff);MailInteractionEvents['on'](_0x41205c,_0x284d32);}}; \ No newline at end of file +var _0x973e=['mailInteraction:','./mailInteraction.events','save','remove','update','emit','register','length'];(function(_0x18d790,_0x106c3e){var _0x377e80=function(_0x4662fd){while(--_0x4662fd){_0x18d790['push'](_0x18d790['shift']());}};_0x377e80(++_0x106c3e);}(_0x973e,0xb1));var _0xe973=function(_0x2d0b0b,_0x1b0097){_0x2d0b0b=_0x2d0b0b-0x0;var _0xd6f2d7=_0x973e[_0x2d0b0b];return _0xd6f2d7;};'use strict';var MailInteractionEvents=require(_0xe973('0x0'));var events=[_0xe973('0x1'),_0xe973('0x2'),_0xe973('0x3')];function createListener(_0x5bd054,_0x4c6294){return function(_0x4f6c97){_0x4c6294[_0xe973('0x4')](_0x5bd054,_0x4f6c97);};}function removeListener(_0x50b62f,_0xe39b9f){return function(){MailInteractionEvents['removeListener'](_0x50b62f,_0xe39b9f);};}exports[_0xe973('0x5')]=function(_0x8a549){for(var _0x16af94=0x0,_0x329656=events[_0xe973('0x6')];_0x16af94<_0x329656;_0x16af94++){var _0x524bd0=events[_0x16af94];var _0x5d8d6a=createListener(_0xe973('0x7')+_0x524bd0,_0x8a549);MailInteractionEvents['on'](_0x524bd0,_0x5d8d6a);}}; \ No newline at end of file diff --git a/server/api/mailInteractionHasTag/index.js b/server/api/mailInteractionHasTag/index.js index e0c30ee..e00900b 100644 --- a/server/api/mailInteractionHasTag/index.js +++ b/server/api/mailInteractionHasTag/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x61f1=['./mailInteractionHasTag.controller','get','/describe','exports','Router'];(function(_0x593564,_0x43583f){var _0x211a89=function(_0x40afd6){while(--_0x40afd6){_0x593564['push'](_0x593564['shift']());}};_0x211a89(++_0x43583f);}(_0x61f1,0x18a));var _0x161f=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x61f1[_0xa464c9];return _0x3d73c4;};'use strict';var express=require('express');var router=express[_0x161f('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x161f('0x1'));router[_0x161f('0x2')](_0x161f('0x3'),auth['isAuthenticated'](),controller['describe']);module[_0x161f('0x4')]=router; \ No newline at end of file +var _0xed1f=['get','isAuthenticated','exports','express','Router'];(function(_0x3744b2,_0xacb7bc){var _0x5e59a8=function(_0x58b937){while(--_0x58b937){_0x3744b2['push'](_0x3744b2['shift']());}};_0x5e59a8(++_0xacb7bc);}(_0xed1f,0x170));var _0xfed1=function(_0x4dc7b9,_0x319d5a){_0x4dc7b9=_0x4dc7b9-0x0;var _0x3ab114=_0xed1f[_0x4dc7b9];return _0x3ab114;};'use strict';var express=require(_0xfed1('0x0'));var router=express[_0xfed1('0x1')]();var auth=require('../../components/auth/service');var controller=require('./mailInteractionHasTag.controller');router[_0xfed1('0x2')]('/describe',auth[_0xfed1('0x3')](),controller['describe']);module[_0xfed1('0x4')]=router; \ No newline at end of file diff --git a/server/api/mailInteractionHasTag/mailInteractionHasTag.controller.js b/server/api/mailInteractionHasTag/mailInteractionHasTag.controller.js index c097a7b..4877db5 100644 --- a/server/api/mailInteractionHasTag/mailInteractionHasTag.controller.js +++ b/server/api/mailInteractionHasTag/mailInteractionHasTag.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['catch','../../config/logger','api','../../mysqldb','json','error','name','status','describe','then'];(function(_0x1c3d91,_0x5f5cdd){var _0x1e7d3e=function(_0x498322){while(--_0x498322){_0x1c3d91['push'](_0x1c3d91['shift']());}};_0x1e7d3e(++_0x5f5cdd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0xa9e0[_0x47e7cb];return _0x2a8874;};'use strict';var logger=require(_0x0a9e('0x0'))(_0x0a9e('0x1'));var db=require(_0x0a9e('0x2'))['db'];function respondWithResult(_0x5dd881,_0x550fbc){_0x550fbc=_0x550fbc||0xc8;return function(_0x18d5c9){if(_0x18d5c9){return _0x5dd881['status'](_0x550fbc)[_0x0a9e('0x3')](_0x18d5c9);}};}function handleError(_0x432180,_0x2ab90b){_0x2ab90b=_0x2ab90b||0x1f4;return function(_0x991246){logger[_0x0a9e('0x4')](_0x991246['stack']);if(_0x991246[_0x0a9e('0x5')]){delete _0x991246[_0x0a9e('0x5')];}_0x432180[_0x0a9e('0x6')](_0x2ab90b)['send'](_0x991246);};}exports['describe']=function(_0xe42b77,_0x56465b){return db['MailInteractionHasTag'][_0x0a9e('0x7')]()[_0x0a9e('0x8')](respondWithResult(_0x56465b,null))[_0x0a9e('0x9')](handleError(_0x56465b,null));}; \ No newline at end of file +var _0xa9e0=['catch','../../config/logger','api','../../mysqldb','json','error','name','status','describe','then'];(function(_0x16a1ec,_0x419fb0){var _0x396907=function(_0x3f9843){while(--_0x3f9843){_0x16a1ec['push'](_0x16a1ec['shift']());}};_0x396907(++_0x419fb0);}(_0xa9e0,0x123));var _0x0a9e=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0xa9e0[_0xc6be3a];return _0x56a310;};'use strict';var logger=require(_0x0a9e('0x0'))(_0x0a9e('0x1'));var db=require(_0x0a9e('0x2'))['db'];function respondWithResult(_0x5dd881,_0x550fbc){_0x550fbc=_0x550fbc||0xc8;return function(_0x18d5c9){if(_0x18d5c9){return _0x5dd881['status'](_0x550fbc)[_0x0a9e('0x3')](_0x18d5c9);}};}function handleError(_0x432180,_0x2ab90b){_0x2ab90b=_0x2ab90b||0x1f4;return function(_0x991246){logger[_0x0a9e('0x4')](_0x991246['stack']);if(_0x991246[_0x0a9e('0x5')]){delete _0x991246[_0x0a9e('0x5')];}_0x432180[_0x0a9e('0x6')](_0x2ab90b)['send'](_0x991246);};}exports['describe']=function(_0xe42b77,_0x56465b){return db['MailInteractionHasTag'][_0x0a9e('0x7')]()[_0x0a9e('0x8')](respondWithResult(_0x56465b,null))[_0x0a9e('0x9')](handleError(_0x56465b,null));}; \ No newline at end of file diff --git a/server/api/mailInteractionHasTag/mailInteractionHasTag.js b/server/api/mailInteractionHasTag/mailInteractionHasTag.js index a25a179..0cf3cac 100644 --- a/server/api/mailInteractionHasTag/mailInteractionHasTag.js +++ b/server/api/mailInteractionHasTag/mailInteractionHasTag.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa618=['exports','INTEGER','sequelize'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0xa618,0xb9));var _0x8a61=function(_0x585f10,_0x32ae99){_0x585f10=_0x585f10-0x0;var _0x337f2a=_0xa618[_0x585f10];return _0x337f2a;};'use strict';var Sequelize=require(_0x8a61('0x0'));module[_0x8a61('0x1')]={'MailInteractionId':{'type':Sequelize[_0x8a61('0x2')],'primaryKey':!![]},'TagId':{'type':Sequelize['INTEGER'],'defaultValue':null}}; \ No newline at end of file +var _0x8a41=['INTEGER','sequelize'];(function(_0x539ddd,_0x50eadf){var _0x68140d=function(_0x5e3d60){while(--_0x5e3d60){_0x539ddd['push'](_0x539ddd['shift']());}};_0x68140d(++_0x50eadf);}(_0x8a41,0xff));var _0x18a4=function(_0x9f8da1,_0x5943a3){_0x9f8da1=_0x9f8da1-0x0;var _0x3f9c9a=_0x8a41[_0x9f8da1];return _0x3f9c9a;};'use strict';var Sequelize=require(_0x18a4('0x0'));module['exports']={'MailInteractionId':{'type':Sequelize[_0x18a4('0x1')],'primaryKey':!![]},'TagId':{'type':Sequelize['INTEGER'],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/mailInteractionHasTag/mailInteractionHasTag.model.js b/server/api/mailInteractionHasTag/mailInteractionHasTag.model.js index f657a82..02a3039 100644 --- a/server/api/mailInteractionHasTag/mailInteractionHasTag.model.js +++ b/server/api/mailInteractionHasTag/mailInteractionHasTag.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1371=['MailInteractionHasTag','exports','define'];(function(_0x2603dd,_0x1b5477){var _0x493b9e=function(_0x182e13){while(--_0x182e13){_0x2603dd['push'](_0x2603dd['shift']());}};_0x493b9e(++_0x1b5477);}(_0x1371,0x106));var _0x1137=function(_0x25a0cc,_0x928e71){_0x25a0cc=_0x25a0cc-0x0;var _0x125770=_0x1371[_0x25a0cc];return _0x125770;};'use strict';var attributes=require('./mailInteractionHasTag');module[_0x1137('0x0')]=function(_0x538d0d){return _0x538d0d[_0x1137('0x1')](_0x1137('0x2'),attributes,{'tableName':'mail_interaction_has_tags','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd0a7=['mail_interaction_has_tags','./mailInteractionHasTag','exports','define','MailInteractionHasTag'];(function(_0x539363,_0x21ed58){var _0x99527b=function(_0xde7e7){while(--_0xde7e7){_0x539363['push'](_0x539363['shift']());}};_0x99527b(++_0x21ed58);}(_0xd0a7,0x1e6));var _0x7d0a=function(_0x39bac1,_0x57bb0e){_0x39bac1=_0x39bac1-0x0;var _0xe591c0=_0xd0a7[_0x39bac1];return _0xe591c0;};'use strict';var attributes=require(_0x7d0a('0x0'));module[_0x7d0a('0x1')]=function(_0x29f793){return _0x29f793[_0x7d0a('0x2')](_0x7d0a('0x3'),attributes,{'tableName':_0x7d0a('0x4'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index 49bcecb..71b02af 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 _0x0712=['destroy','exports','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','describe','get','/:id','show','/:id/download','post','tracked','mail','mailmessage:create','create','put','update','accept','reject','delete'];(function(_0x198644,_0x10b68f){var _0x5deaf1=function(_0x2c7b4d){while(--_0x2c7b4d){_0x198644['push'](_0x198644['shift']());}};_0x5deaf1(++_0x10b68f);}(_0x0712,0x147));var _0x2071=function(_0x27664a,_0x245e64){_0x27664a=_0x27664a-0x0;var _0x476c9b=_0x0712[_0x27664a];return _0x476c9b;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x2071('0x0'));var timeout=require(_0x2071('0x1'));var express=require('express');var router=express[_0x2071('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x2071('0x3'));var interaction=require(_0x2071('0x4'));var config=require(_0x2071('0x5'));var controller=require('./mailMessage.controller');router['get']('/',auth[_0x2071('0x6')](),controller[_0x2071('0x7')]);router['get']('/describe',auth[_0x2071('0x6')](),controller[_0x2071('0x8')]);router[_0x2071('0x9')](_0x2071('0xa'),auth[_0x2071('0x6')](),controller[_0x2071('0xb')]);router[_0x2071('0x9')](_0x2071('0xc'),auth[_0x2071('0x6')](),controller['download']);router[_0x2071('0xd')]('/',auth[_0x2071('0x6')](),interaction[_0x2071('0xe')](_0x2071('0xf'),_0x2071('0x10')),controller[_0x2071('0x11')]);router[_0x2071('0x12')](_0x2071('0xa'),auth[_0x2071('0x6')](),controller[_0x2071('0x13')]);router[_0x2071('0x12')]('/:id/accept',auth[_0x2071('0x6')](),controller[_0x2071('0x14')]);router[_0x2071('0x12')]('/:id/reject',auth[_0x2071('0x6')](),controller[_0x2071('0x15')]);router[_0x2071('0x16')](_0x2071('0xa'),auth[_0x2071('0x6')](),controller[_0x2071('0x17')]);module[_0x2071('0x18')]=router; \ No newline at end of file +var _0x7f48=['/:id/accept','/:id/reject','reject','destroy','multer','util','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','./mailMessage.controller','get','/describe','describe','/:id','isAuthenticated','show','/:id/download','download','post','tracked','mail','create','update'];(function(_0x46e3a3,_0x514ea2){var _0x117beb=function(_0xfecc1a){while(--_0xfecc1a){_0x46e3a3['push'](_0x46e3a3['shift']());}};_0x117beb(++_0x514ea2);}(_0x7f48,0xac));var _0x87f4=function(_0x16d10f,_0x2ba2d5){_0x16d10f=_0x16d10f-0x0;var _0x50c823=_0x7f48[_0x16d10f];return _0x50c823;};'use strict';var multer=require(_0x87f4('0x0'));var util=require(_0x87f4('0x1'));var path=require('path');var timeout=require(_0x87f4('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x87f4('0x3'));var auth=require(_0x87f4('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x87f4('0x5'));var controller=require(_0x87f4('0x6'));router[_0x87f4('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x87f4('0x7')](_0x87f4('0x8'),auth['isAuthenticated'](),controller[_0x87f4('0x9')]);router[_0x87f4('0x7')](_0x87f4('0xa'),auth[_0x87f4('0xb')](),controller[_0x87f4('0xc')]);router[_0x87f4('0x7')](_0x87f4('0xd'),auth[_0x87f4('0xb')](),controller[_0x87f4('0xe')]);router[_0x87f4('0xf')]('/',auth['isAuthenticated'](),interaction[_0x87f4('0x10')](_0x87f4('0x11'),'mailmessage:create'),controller[_0x87f4('0x12')]);router['put'](_0x87f4('0xa'),auth[_0x87f4('0xb')](),controller[_0x87f4('0x13')]);router['put'](_0x87f4('0x14'),auth[_0x87f4('0xb')](),controller['accept']);router['put'](_0x87f4('0x15'),auth[_0x87f4('0xb')](),controller[_0x87f4('0x16')]);router['delete'](_0x87f4('0xa'),auth[_0x87f4('0xb')](),controller[_0x87f4('0x17')]);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 3822975..a5ff0b0 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 _0xa24a=['INTEGER','ENUM','Email','Chat','sequelize','TEXT','long','BOOLEAN','out','STRING','DATE'];(function(_0xde2209,_0x119f0d){var _0x358ecb=function(_0x1a5104){while(--_0x1a5104){_0xde2209['push'](_0xde2209['shift']());}};_0x358ecb(++_0x119f0d);}(_0xa24a,0x159));var _0xaa24=function(_0x4425c2,_0x21744c){_0x4425c2=_0x4425c2-0x0;var _0x8826c=_0xa24a[_0x4425c2];return _0x8826c;};'use strict';var Sequelize=require(_0xaa24('0x0'));var _=require('lodash');module['exports']={'body':{'type':Sequelize[_0xaa24('0x1')](_0xaa24('0x2')),'allowNull':![]},'plainBody':{'type':Sequelize[_0xaa24('0x1')]('medium')},'read':{'type':Sequelize[_0xaa24('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xaa24('0x4')),'defaultValue':_0xaa24('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0xaa24('0x5')](0x1fe)},'from':{'type':Sequelize[_0xaa24('0x5')]},'to':{'type':Sequelize[_0xaa24('0x1')](_0xaa24('0x2'))},'cc':{'type':Sequelize[_0xaa24('0x1')]('long')},'bcc':{'type':Sequelize[_0xaa24('0x1')](_0xaa24('0x2'))},'subject':{'type':Sequelize[_0xaa24('0x1')]},'sentAt':{'type':Sequelize[_0xaa24('0x6')]},'attach':{'type':Sequelize[_0xaa24('0x7')],'defaultValue':0x0},'secret':{'type':Sequelize[_0xaa24('0x3')],'defaultValue':![]},'readAt':{'type':Sequelize[_0xaa24('0x6')]},'originTo':{'type':Sequelize['TEXT'](_0xaa24('0x2'))},'originCc':{'type':Sequelize[_0xaa24('0x1')](_0xaa24('0x2'))},'originChannel':{'type':Sequelize[_0xaa24('0x8')](_0xaa24('0x9'),_0xaa24('0xa')),'defaultValue':_0xaa24('0x9'),'allowNull':![]}}; \ No newline at end of file +var _0x601a=['lodash','exports','TEXT','long','medium','BOOLEAN','out','STRING','ENUM','Email','sequelize'];(function(_0x99ceac,_0x2f7cb6){var _0x472fbb=function(_0x597a09){while(--_0x597a09){_0x99ceac['push'](_0x99ceac['shift']());}};_0x472fbb(++_0x2f7cb6);}(_0x601a,0x112));var _0xa601=function(_0x4b664e,_0x3786d7){_0x4b664e=_0x4b664e-0x0;var _0x39ec4a=_0x601a[_0x4b664e];return _0x39ec4a;};'use strict';var Sequelize=require(_0xa601('0x0'));var _=require(_0xa601('0x1'));module[_0xa601('0x2')]={'body':{'type':Sequelize[_0xa601('0x3')](_0xa601('0x4')),'allowNull':![]},'plainBody':{'type':Sequelize[_0xa601('0x3')](_0xa601('0x5'))},'read':{'type':Sequelize[_0xa601('0x6')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0xa601('0x7'),'allowNull':![]},'messageId':{'type':Sequelize[_0xa601('0x8')](0x1fe)},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0xa601('0x3')](_0xa601('0x4'))},'cc':{'type':Sequelize[_0xa601('0x3')]('long')},'bcc':{'type':Sequelize[_0xa601('0x3')](_0xa601('0x4'))},'subject':{'type':Sequelize['TEXT']},'sentAt':{'type':Sequelize['DATE']},'attach':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'secret':{'type':Sequelize[_0xa601('0x6')],'defaultValue':![]},'readAt':{'type':Sequelize['DATE']},'originTo':{'type':Sequelize[_0xa601('0x3')](_0xa601('0x4'))},'originCc':{'type':Sequelize[_0xa601('0x3')](_0xa601('0x4'))},'originChannel':{'type':Sequelize[_0xa601('0x9')](_0xa601('0xa'),'Chat'),'defaultValue':_0xa601('0xa'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index 53751d5..340afc2 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 _0xb2fc=['accept','fromString','EventManager','acceptmessage','reject','mail','MailInteraction','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','SELECT','contact','internal','SIP/%s','rejectmessage','download','files','tmp','root','server','message-%s.eml','from','bcc','subject','createdAt','Attachment','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','Attachments','existsSync','push','readFileSync','writeFileSync','unlinkSync','moment','bluebird','path','lodash','ioredis','../../config/logger','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','html-entities','./mailMessage.socket','register','jayson/promise','client','http','request','then','info','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','MailMessage,\x20%s,\x20%s','message','result','status','json','offset','limit','undefined','count','set','update','destroy','end','sendStatus','stack','name','send','map','MailMessage','rawAttributes','type','model','query','filters','intersection','attributes','fields','nolimit','order','sort','merge','where','VIRTUAL','include','findAll','rows','catch','show','params','keys','length','includeAll','options','find','body','describe','create','direction','out','secret','findOne','MailAccountId','CmList','List','CmContact','Contacts','MailServerOut','Smtp','CloudProvider','attachments','join','server/files/attachments','basename','defaults','List\x20not\x20found','SendMail','sendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','read','readAt','UserId','agent','get','MailInteractionId','isNil','read1stAt','interaction','user','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','User','fullname','email','manual','interface','channel','event'];(function(_0x2d616c,_0x417478){var _0x323f2=function(_0x304ef5){while(--_0x304ef5){_0x2d616c['push'](_0x2d616c['shift']());}};_0x323f2(++_0x417478);}(_0xb2fc,0xbd));var _0xcb2f=function(_0x26b2a2,_0x3afb26){_0x26b2a2=_0x26b2a2-0x0;var _0x342d7b=_0xb2fc[_0x26b2a2];return _0x342d7b;};'use strict';var emlformat=require('eml-format');var moment=require(_0xcb2f('0x0'));var BPromise=require(_0xcb2f('0x1'));var util=require('util');var path=require(_0xcb2f('0x2'));var fs=require('fs');var _=require(_0xcb2f('0x3'));var Redis=require(_0xcb2f('0x4'));var htmlToText=require('html-to-text');var qs=require('../../components/parsers/qs');var logger=require(_0xcb2f('0x5'))('api');var interaction_log=require(_0xcb2f('0x5'))('mail-interactions');var config=require(_0xcb2f('0x6'));var db=require(_0xcb2f('0x7'))['db'];config[_0xcb2f('0x8')]=_['defaults'](config['redis'],{'host':_0xcb2f('0x9'),'port':0x18eb});var socket=require(_0xcb2f('0xa'))(new Redis(config[_0xcb2f('0x8')]));var htmlEntities=require(_0xcb2f('0xb'));require(_0xcb2f('0xc'))[_0xcb2f('0xd')](socket);var jayson=require(_0xcb2f('0xe'));var client=jayson[_0xcb2f('0xf')][_0xcb2f('0x10')]({'port':0x232c});var client9003=jayson['client']['http']({'port':0x232b});var client9002=jayson[_0xcb2f('0xf')]['http']({'port':0x232a});function respondWithRpcPromise(_0x30fb9b,_0x5cb387,_0x1b1391,_0x404bf3){return new BPromise(function(_0x323969,_0x205306){var _0x1af828=_0x404bf3||client;return _0x1af828[_0xcb2f('0x11')](_0x30fb9b,_0x1b1391)[_0xcb2f('0x12')](function(_0x125eff){logger[_0xcb2f('0x13')]('MailMessage,\x20%s,\x20%s',_0x5cb387,_0xcb2f('0x14'));logger[_0xcb2f('0x15')](_0xcb2f('0x16'),_0x5cb387,_0xcb2f('0x14'),JSON[_0xcb2f('0x17')](_0x125eff));if(_0x125eff[_0xcb2f('0x18')]){if(_0x125eff[_0xcb2f('0x18')]['code']===0x1f4){logger[_0xcb2f('0x18')](_0xcb2f('0x19'),_0x5cb387,_0x125eff[_0xcb2f('0x18')][_0xcb2f('0x1a')]);return _0x205306(_0x125eff[_0xcb2f('0x18')][_0xcb2f('0x1a')]);}logger['error'](_0xcb2f('0x19'),_0x5cb387,_0x125eff[_0xcb2f('0x18')]['message']);return _0x323969(_0x125eff[_0xcb2f('0x18')][_0xcb2f('0x1a')]);}else{logger[_0xcb2f('0x13')](_0xcb2f('0x19'),_0x5cb387,_0xcb2f('0x14'));_0x323969(_0x125eff[_0xcb2f('0x1b')]['message']);}})['catch'](function(_0x543339){logger[_0xcb2f('0x18')](_0xcb2f('0x19'),_0x5cb387,_0x543339);_0x205306(_0x543339);});});}function respondWithResult(_0x238c25,_0x3248c2){_0x3248c2=_0x3248c2||0xc8;return function(_0x3b136f){if(_0x3b136f){return _0x238c25[_0xcb2f('0x1c')](_0x3248c2)[_0xcb2f('0x1d')](_0x3b136f);}};}function respondWithFilteredResult(_0x3d7a04,_0x3967f9){return function(_0x360bbc){if(_0x360bbc){var _0x22ac4b=typeof _0x3967f9[_0xcb2f('0x1e')]==='undefined'&&typeof _0x3967f9[_0xcb2f('0x1f')]===_0xcb2f('0x20');var _0x25fefe=_0x360bbc[_0xcb2f('0x21')];var _0x389762=_0x22ac4b?0x0:_0x3967f9[_0xcb2f('0x1e')];var _0x3eab4f=_0x22ac4b?_0x360bbc[_0xcb2f('0x21')]:_0x3967f9[_0xcb2f('0x1e')]+_0x3967f9[_0xcb2f('0x1f')];var _0x173e18;if(_0x3eab4f>=_0x25fefe){_0x3eab4f=_0x25fefe;_0x173e18=0xc8;}else{_0x173e18=0xce;}_0x3d7a04[_0xcb2f('0x1c')](_0x173e18);return _0x3d7a04[_0xcb2f('0x22')]('Content-Range',_0x389762+'-'+_0x3eab4f+'/'+_0x25fefe)[_0xcb2f('0x1d')](_0x360bbc);}return null;};}function saveUpdates(_0x3539ad){return function(_0x578544){if(_0x578544){return _0x578544[_0xcb2f('0x23')](_0x3539ad)[_0xcb2f('0x12')](function(_0x5d4eda){return _0x5d4eda;});}return null;};}function removeEntity(_0x149327){return function(_0x2268e8){if(_0x2268e8){return _0x2268e8[_0xcb2f('0x24')]()['then'](function(){_0x149327[_0xcb2f('0x1c')](0xcc)[_0xcb2f('0x25')]();});}};}function handleEntityNotFound(_0xd836bd){return function(_0x56c12e){if(!_0x56c12e){_0xd836bd[_0xcb2f('0x26')](0x194);}return _0x56c12e;};}function handleError(_0x13850d,_0x405232){_0x405232=_0x405232||0x1f4;return function(_0x1021cb){logger['error'](_0x1021cb[_0xcb2f('0x27')]);if(_0x1021cb['name']){delete _0x1021cb[_0xcb2f('0x28')];}_0x13850d[_0xcb2f('0x1c')](_0x405232)[_0xcb2f('0x29')](_0x1021cb);};}exports['index']=function(_0x2d69d4,_0x46612a){var _0x389dee={},_0x540e5a={},_0x5044f6={'count':0x0,'rows':[]};var _0x396942=_[_0xcb2f('0x2a')](db[_0xcb2f('0x2b')][_0xcb2f('0x2c')],function(_0x37f8fc){return{'name':_0x37f8fc['fieldName'],'type':_0x37f8fc[_0xcb2f('0x2d')]['key']};});_0x540e5a[_0xcb2f('0x2e')]=_[_0xcb2f('0x2a')](_0x396942,'name');_0x540e5a['query']=_['keys'](_0x2d69d4[_0xcb2f('0x2f')]);_0x540e5a[_0xcb2f('0x30')]=_[_0xcb2f('0x31')](_0x540e5a['model'],_0x540e5a[_0xcb2f('0x2f')]);_0x389dee[_0xcb2f('0x32')]=_[_0xcb2f('0x31')](_0x540e5a['model'],qs[_0xcb2f('0x33')](_0x2d69d4[_0xcb2f('0x2f')][_0xcb2f('0x33')]));_0x389dee['attributes']=_0x389dee[_0xcb2f('0x32')]['length']?_0x389dee[_0xcb2f('0x32')]:_0x540e5a[_0xcb2f('0x2e')];if(!_0x2d69d4[_0xcb2f('0x2f')]['hasOwnProperty'](_0xcb2f('0x34'))){_0x389dee[_0xcb2f('0x1f')]=qs[_0xcb2f('0x1f')](_0x2d69d4[_0xcb2f('0x2f')]['limit']);_0x389dee[_0xcb2f('0x1e')]=qs[_0xcb2f('0x1e')](_0x2d69d4[_0xcb2f('0x2f')]['offset']);}_0x389dee[_0xcb2f('0x35')]=qs[_0xcb2f('0x36')](_0x2d69d4['query']['sort']);_0x389dee['where']=qs[_0xcb2f('0x30')](_['pick'](_0x2d69d4[_0xcb2f('0x2f')],_0x540e5a['filters']),_0x396942);if(_0x2d69d4[_0xcb2f('0x2f')]['filter']){_0x389dee['where']=_[_0xcb2f('0x37')](_0x389dee[_0xcb2f('0x38')],{'$or':_[_0xcb2f('0x2a')](_0x396942,function(_0x2c3a2e){if(_0x2c3a2e[_0xcb2f('0x2d')]!==_0xcb2f('0x39')){var _0x36016b={};_0x36016b[_0x2c3a2e['name']]={'$like':'%'+_0x2d69d4[_0xcb2f('0x2f')]['filter']+'%'};return _0x36016b;}})});}_0x389dee=_[_0xcb2f('0x37')]({},_0x389dee,_0x2d69d4['options']);var _0x212c66={'where':_0x389dee['where']};return db['MailMessage'][_0xcb2f('0x21')](_0x212c66)[_0xcb2f('0x12')](function(_0xce3c89){_0x5044f6[_0xcb2f('0x21')]=_0xce3c89;if(_0x2d69d4[_0xcb2f('0x2f')]['includeAll']){_0x389dee[_0xcb2f('0x3a')]=[{'all':!![]}];}return db[_0xcb2f('0x2b')][_0xcb2f('0x3b')](_0x389dee);})['then'](function(_0x36ff79){_0x5044f6[_0xcb2f('0x3c')]=_0x36ff79;return _0x5044f6;})['then'](respondWithFilteredResult(_0x46612a,_0x389dee))[_0xcb2f('0x3d')](handleError(_0x46612a,null));};exports[_0xcb2f('0x3e')]=function(_0x22a3d2,_0x516471){var _0x285055={'raw':!![],'where':{'id':_0x22a3d2[_0xcb2f('0x3f')]['id']}},_0x3f5392={};_0x3f5392[_0xcb2f('0x2e')]=_[_0xcb2f('0x40')](db['MailMessage'][_0xcb2f('0x2c')]);_0x3f5392[_0xcb2f('0x2f')]=_[_0xcb2f('0x40')](_0x22a3d2[_0xcb2f('0x2f')]);_0x3f5392['filters']=_[_0xcb2f('0x31')](_0x3f5392[_0xcb2f('0x2e')],_0x3f5392['query']);_0x285055[_0xcb2f('0x32')]=_[_0xcb2f('0x31')](_0x3f5392['model'],qs['fields'](_0x22a3d2['query']['fields']));_0x285055[_0xcb2f('0x32')]=_0x285055[_0xcb2f('0x32')][_0xcb2f('0x41')]?_0x285055[_0xcb2f('0x32')]:_0x3f5392[_0xcb2f('0x2e')];if(_0x22a3d2[_0xcb2f('0x2f')][_0xcb2f('0x42')]){_0x285055[_0xcb2f('0x3a')]=[{'all':!![]}];}_0x285055=_['merge']({},_0x285055,_0x22a3d2[_0xcb2f('0x43')]);return db[_0xcb2f('0x2b')][_0xcb2f('0x44')](_0x285055)[_0xcb2f('0x12')](handleEntityNotFound(_0x516471,null))[_0xcb2f('0x12')](respondWithResult(_0x516471,null))[_0xcb2f('0x3d')](handleError(_0x516471,null));};exports[_0xcb2f('0x23')]=function(_0x3f38ba,_0x1d6c78){if(_0x3f38ba[_0xcb2f('0x45')]['id']){delete _0x3f38ba[_0xcb2f('0x45')]['id'];}return db[_0xcb2f('0x2b')][_0xcb2f('0x44')]({'where':{'id':_0x3f38ba[_0xcb2f('0x3f')]['id']}})[_0xcb2f('0x12')](handleEntityNotFound(_0x1d6c78,null))[_0xcb2f('0x12')](saveUpdates(_0x3f38ba[_0xcb2f('0x45')],null))[_0xcb2f('0x12')](respondWithResult(_0x1d6c78,null))[_0xcb2f('0x3d')](handleError(_0x1d6c78,null));};exports[_0xcb2f('0x24')]=function(_0x2fc69e,_0x3c8718){return db['MailMessage'][_0xcb2f('0x44')]({'where':{'id':_0x2fc69e[_0xcb2f('0x3f')]['id']}})['then'](handleEntityNotFound(_0x3c8718,null))['then'](removeEntity(_0x3c8718,null))['catch'](handleError(_0x3c8718,null));};exports[_0xcb2f('0x46')]=function(_0x43e305,_0x152e3e){return db[_0xcb2f('0x2b')][_0xcb2f('0x46')]()[_0xcb2f('0x12')](respondWithResult(_0x152e3e,null))['catch'](handleError(_0x152e3e,null));};exports['create']=function(_0x3e4933,_0x4c6edc){return db[_0xcb2f('0x2b')][_0xcb2f('0x47')](_0x3e4933['body'])[_0xcb2f('0x12')](function(_0x3575f9){if(_0x3575f9){if(_0x3575f9[_0xcb2f('0x48')]===_0xcb2f('0x49')&&!_0x3575f9[_0xcb2f('0x4a')]){var _0x10bdab,_0x511e94,_0x202a3c;if(_0x3e4933['body']['to']){_0x511e94=_0x3e4933[_0xcb2f('0x45')]['to']['split'](',')[0x0];}return db['MailAccount'][_0xcb2f('0x4b')]({'where':{'id':_0x3575f9[_0xcb2f('0x4c')]},'include':[{'model':db[_0xcb2f('0x4d')],'as':_0xcb2f('0x4e'),'include':[{'model':db[_0xcb2f('0x4f')],'as':_0xcb2f('0x50'),'where':{'email':_0x511e94},'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db[_0xcb2f('0x51')],'as':_0xcb2f('0x52'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0xcb2f('0x53'),'raw':!![]}]}]})[_0xcb2f('0x12')](function(_0xde468a){_0x10bdab=_0xde468a;if(!_0x10bdab||!_0x10bdab[_0xcb2f('0x52')])return;var _0xe4f134=_0x10bdab['getSmtpOptions']();if(_0x3e4933['body'][_0xcb2f('0x54')]&&_0x3e4933[_0xcb2f('0x45')][_0xcb2f('0x54')][_0xcb2f('0x41')]){for(var _0x30038e=0x0;_0x30038e<_0x3e4933[_0xcb2f('0x45')][_0xcb2f('0x54')]['length'];_0x30038e+=0x1){_0x3e4933['body'][_0xcb2f('0x54')][_0x30038e]={'filename':_0x3e4933[_0xcb2f('0x45')][_0xcb2f('0x54')][_0x30038e][_0xcb2f('0x28')],'path':path[_0xcb2f('0x55')](config['root'],_0xcb2f('0x56'),_0x3e4933['body']['attachments'][_0x30038e][_0xcb2f('0x57')])};}}_0x202a3c={'account':_0xe4f134,'message':_0x3e4933[_0xcb2f('0x45')]};return;})['then'](function(){if(_0x10bdab['List']){if(_0x10bdab['List'][_0xcb2f('0x50')][_0xcb2f('0x41')]){return _0x10bdab[_0xcb2f('0x4e')][_0xcb2f('0x50')][0x0];}else{return db[_0xcb2f('0x4f')][_0xcb2f('0x47')](_[_0xcb2f('0x58')](_0x3e4933[_0xcb2f('0x45')],{'firstName':_0x3e4933[_0xcb2f('0x45')]['to'],'email':_0x3e4933[_0xcb2f('0x45')]['to'],'phone':_0x3e4933[_0xcb2f('0x45')]['to'],'ListId':_0x10bdab['ListId']}));}}else{throw new Error(_0xcb2f('0x59'));}})[_0xcb2f('0x12')](function(){if(_0x202a3c){return respondWithRpcPromise(_0xcb2f('0x5a'),_0xcb2f('0x5b'),_0x202a3c,client9003)[_0xcb2f('0x12')](function(_0x3b0107){return _0x3575f9[_0xcb2f('0x23')]({'read':!![],'messageId':_0x3b0107[_0xcb2f('0x5c')],'sentAt':moment()[_0xcb2f('0x5d')](_0xcb2f('0x5e'))});})[_0xcb2f('0x3d')](function(_0x207620){logger[_0xcb2f('0x18')]('%s',JSON[_0xcb2f('0x17')](_0x207620));return _0x3575f9;});}return _0x3575f9;});}return _0x3575f9;}})['then'](respondWithResult(_0x4c6edc,0xc9))[_0xcb2f('0x3d')](handleError(_0x4c6edc,null));};exports['accept']=function(_0x27f7d6,_0x452546){var _0x1aa9f9={'agent':{},'channel':'mail'};if(_0x27f7d6[_0xcb2f('0x45')]['id']){delete _0x27f7d6[_0xcb2f('0x45')]['id'];}_0x27f7d6[_0xcb2f('0x45')][_0xcb2f('0x5f')]=!![];_0x27f7d6[_0xcb2f('0x45')][_0xcb2f('0x60')]=moment()['format'](_0xcb2f('0x5e'));_0x27f7d6['body'][_0xcb2f('0x61')]=_0x27f7d6[_0xcb2f('0x45')][_0xcb2f('0x61')]||_0x27f7d6['user']['id'];_0x1aa9f9[_0xcb2f('0x62')]['id']=_0x27f7d6[_0xcb2f('0x45')][_0xcb2f('0x61')];return db[_0xcb2f('0x2b')]['find']({'where':{'id':_0x27f7d6[_0xcb2f('0x3f')]['id'],'UserId':null}})[_0xcb2f('0x12')](handleEntityNotFound(_0x452546,null))[_0xcb2f('0x12')](saveUpdates(_0x27f7d6[_0xcb2f('0x45')],null))[_0xcb2f('0x12')](function(_0x524f55){if(_0x524f55){_0x1aa9f9['message']=_0x524f55[_0xcb2f('0x63')]({'plain':!![]});return db['MailInteraction']['find']({'where':{'id':_0x524f55[_0xcb2f('0x64')]}});}return null;})[_0xcb2f('0x12')](handleEntityNotFound(_0x452546,null))['then'](function(_0x160d52){if(_0x160d52){return _0x160d52[_0xcb2f('0x23')]({'UserId':_0x27f7d6[_0xcb2f('0x45')][_0xcb2f('0x61')],'read1stAt':_[_0xcb2f('0x65')](_0x160d52[_0xcb2f('0x66')])?moment()[_0xcb2f('0x5d')](_0xcb2f('0x5e')):undefined});}return null;})[_0xcb2f('0x12')](function(_0xc91abe){if(_0xc91abe){_0x1aa9f9[_0xcb2f('0x67')]=_0xc91abe[_0xcb2f('0x63')]({'plain':!![]});interaction_log[_0xcb2f('0x13')]('[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x27f7d6[_0xcb2f('0x68')]['id'],_0x27f7d6[_0xcb2f('0x68')]['name'],_0x27f7d6['user'][_0xcb2f('0x69')],_0x1aa9f9[_0xcb2f('0x67')]['id'],_0x27f7d6[_0xcb2f('0x45')]?JSON['stringify'](_0x27f7d6['body']):_0xcb2f('0x6a'));return respondWithRpcPromise(_0xcb2f('0x6b'),_0xcb2f('0x6c'),_0x1aa9f9);}return null;})[_0xcb2f('0x12')](function(_0x3ccead){var _0x30e11e=_0xcb2f('0x6d')+_0x3ccead[_0xcb2f('0x1a')][_0xcb2f('0x6e')];return db[_0xcb2f('0x6f')][_0xcb2f('0x2f')](_0x30e11e,{'type':db[_0xcb2f('0x70')][_0xcb2f('0x71')]['SELECT'],'raw':!![]})[_0xcb2f('0x12')](function(_0x389f49){return _0x389f49;});})[_0xcb2f('0x12')](function(_0x51faab){if(_0x51faab){_0x1aa9f9[_0xcb2f('0x1a')]['contact']=_0x51faab[0x0];if(!_0x27f7d6['body'][_0xcb2f('0x61')])return;return db[_0xcb2f('0x72')][_0xcb2f('0x44')]({'where':{'id':_0x27f7d6[_0xcb2f('0x45')][_0xcb2f('0x61')],'role':_0xcb2f('0x62')},'attributes':['id',_0xcb2f('0x28'),_0xcb2f('0x73'),_0xcb2f('0x74'),'internal'],'raw':!![]});}return null;})[_0xcb2f('0x12')](function(_0x4441ba){if(!_0x4441ba)return null;_0x1aa9f9['message'][_0xcb2f('0x62')]=_0x4441ba;return _0x1aa9f9;})[_0xcb2f('0x12')](function(_0x2134b9){if(_0x2134b9){if(_0x27f7d6['body'][_0xcb2f('0x75')]){_0x1aa9f9[_0xcb2f('0x1a')][_0xcb2f('0x76')]=util['format']('SIP/%s',_0x27f7d6[_0xcb2f('0x68')][_0xcb2f('0x28')]);_0x1aa9f9[_0xcb2f('0x1a')][_0xcb2f('0x77')]=_0x1aa9f9[_0xcb2f('0x77')];_0x1aa9f9[_0xcb2f('0x1a')]['motionChannel']=_0x1aa9f9[_0xcb2f('0x77')];_0x1aa9f9[_0xcb2f('0x1a')][_0xcb2f('0x78')]=_0xcb2f('0x79');_0x1aa9f9[_0xcb2f('0x1a')]['body']=htmlToText[_0xcb2f('0x7a')](_0x1aa9f9[_0xcb2f('0x1a')][_0xcb2f('0x45')]);return respondWithRpcPromise(_0xcb2f('0x7b'),_0xcb2f('0x7b'),{'event':_0xcb2f('0x7c'),'message':_0x1aa9f9[_0xcb2f('0x1a')]},client9002)[_0xcb2f('0x12')](function(){return _0x1aa9f9;});}return _0x1aa9f9;}return null;})['then'](respondWithResult(_0x452546,null))[_0xcb2f('0x3d')](handleError(_0x452546,null));};exports[_0xcb2f('0x7d')]=function(_0xc74d5f,_0x3aaf2f){var _0x858367={'agent':{},'channel':_0xcb2f('0x7e')};if(_0xc74d5f[_0xcb2f('0x45')]['id']){delete _0xc74d5f[_0xcb2f('0x45')]['id'];}_0xc74d5f[_0xcb2f('0x45')][_0xcb2f('0x61')]=_0xc74d5f['body']['UserId']||_0xc74d5f[_0xcb2f('0x68')]['id'];_0x858367['agent']['id']=_0xc74d5f[_0xcb2f('0x45')]['UserId'];return db['MailMessage'][_0xcb2f('0x44')]({'where':{'id':_0xc74d5f[_0xcb2f('0x3f')]['id'],'UserId':null}})[_0xcb2f('0x12')](handleEntityNotFound(_0x3aaf2f,null))['then'](function(_0x3f3917){if(_0x3f3917){_0x858367['message']=_0x3f3917['get']({'plain':!![]});return db[_0xcb2f('0x7f')][_0xcb2f('0x44')]({'where':{'id':_0x3f3917[_0xcb2f('0x64')]}});}return null;})['then'](handleEntityNotFound(_0x3aaf2f,null))[_0xcb2f('0x12')](function(_0x1f8c6e){if(_0x1f8c6e){_0x858367['interaction']=_0x1f8c6e[_0xcb2f('0x63')]({'plain':!![]});interaction_log[_0xcb2f('0x13')](_0xcb2f('0x80'),_0xc74d5f[_0xcb2f('0x68')]['id'],_0xc74d5f[_0xcb2f('0x68')][_0xcb2f('0x28')],_0xc74d5f[_0xcb2f('0x68')][_0xcb2f('0x69')],_0x858367[_0xcb2f('0x67')]['id'],_0xc74d5f['body']?JSON[_0xcb2f('0x17')](_0xc74d5f[_0xcb2f('0x45')]):_0xcb2f('0x6a'));return respondWithRpcPromise('RejectMessage',_0xcb2f('0x81'),_0x858367);}return null;})[_0xcb2f('0x12')](function(_0x39a18f){var _0x220c95='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x39a18f[_0xcb2f('0x1a')][_0xcb2f('0x6e')];return db[_0xcb2f('0x6f')][_0xcb2f('0x2f')](_0x220c95,{'type':db['Sequelize'][_0xcb2f('0x71')][_0xcb2f('0x82')],'raw':!![]})['then'](function(_0x145248){return _0x145248;});})[_0xcb2f('0x12')](function(_0x351bdb){if(_0x351bdb){_0x858367[_0xcb2f('0x1a')][_0xcb2f('0x83')]=_0x351bdb[0x0];if(!_0xc74d5f[_0xcb2f('0x45')]['UserId'])return;return db[_0xcb2f('0x72')][_0xcb2f('0x44')]({'where':{'id':_0xc74d5f[_0xcb2f('0x45')][_0xcb2f('0x61')],'role':_0xcb2f('0x62')},'attributes':['id',_0xcb2f('0x28'),'fullname','email',_0xcb2f('0x84')],'raw':!![]});}return null;})[_0xcb2f('0x12')](function(_0x6d90a3){if(!_0x6d90a3)return null;_0x858367['message'][_0xcb2f('0x62')]=_0x6d90a3;return _0x858367;})[_0xcb2f('0x12')](function(_0x1640c5){if(_0x1640c5){_0x1640c5[_0xcb2f('0x1a')][_0xcb2f('0x76')]=util[_0xcb2f('0x5d')](_0xcb2f('0x85'),_0xc74d5f[_0xcb2f('0x68')]['name']);_0x1640c5[_0xcb2f('0x1a')][_0xcb2f('0x77')]=_0x858367[_0xcb2f('0x77')];_0x1640c5[_0xcb2f('0x1a')]['motionChannel']=_0x858367[_0xcb2f('0x77')];_0x1640c5[_0xcb2f('0x1a')][_0xcb2f('0x78')]=_0xcb2f('0x7d');_0x1640c5[_0xcb2f('0x1a')]['body']=htmlToText['fromString'](_0x858367['message'][_0xcb2f('0x45')]);respondWithRpcPromise(_0xcb2f('0x7b'),_0xcb2f('0x7b'),{'event':_0xcb2f('0x86'),'message':_0x1640c5['message']},client9002);return _0x858367;}return null;})[_0xcb2f('0x12')](respondWithResult(_0x3aaf2f,null))[_0xcb2f('0x3d')](handleError(_0x3aaf2f,null));};exports[_0xcb2f('0x87')]=function(_0x32acb6,_0x322781){var _0x17cf8b=moment()['unix']()['toString']();var _0x366d2e=path['join'](config['root'],'server',_0xcb2f('0x88'),_0xcb2f('0x89'));var _0x24140e=path[_0xcb2f('0x55')](config[_0xcb2f('0x8a')],_0xcb2f('0x8b'),_0xcb2f('0x88'),_0xcb2f('0x54'));var _0x46beb4=util[_0xcb2f('0x5d')](_0xcb2f('0x8c'),_0x17cf8b);return db['MailMessage']['find']({'where':{'id':_0x32acb6['params']['id']},'attributes':['id',_0xcb2f('0x45'),_0xcb2f('0x8d'),'to','cc',_0xcb2f('0x8e'),_0xcb2f('0x8f'),_0xcb2f('0x90')],'include':_0x32acb6['query'][_0xcb2f('0x54')]?[{'model':db[_0xcb2f('0x91')],'as':'Attachments'}]:undefined})[_0xcb2f('0x12')](handleEntityNotFound(_0x322781,null))[_0xcb2f('0x12')](function(_0x196210){if(_0x196210){var _0x22b769=_0x196210;var _0x15ec78={'from':_0x22b769['from'],'to':_0x22b769['to'],'subject':_0x22b769[_0xcb2f('0x8f')],'html':htmlEntities['decode'](_0x22b769[_0xcb2f('0x45')]),'headers':{'Date':moment(_0x22b769['createdAt'])[_0xcb2f('0x5d')](_0xcb2f('0x92'))},'attachments':[]};if(_0x196210['cc']){_0x15ec78['headers']['Cc']=_0x196210['cc'];}if(_0x196210[_0xcb2f('0x8e')]){_0x15ec78[_0xcb2f('0x93')][_0xcb2f('0x94')]=_0x196210[_0xcb2f('0x8e')];}return new BPromise(function(_0x32373f,_0x1552c9){if(_0x196210[_0xcb2f('0x95')]){for(var _0x4b3aaf=0x0;_0x4b3aaf<_0x196210[_0xcb2f('0x95')][_0xcb2f('0x41')];_0x4b3aaf++){var _0x25ba15=_0x196210[_0xcb2f('0x95')][_0x4b3aaf];var _0x2b3393=path[_0xcb2f('0x55')](_0x24140e,_0x25ba15['basename']);if(fs[_0xcb2f('0x96')](_0x2b3393)){_0x15ec78[_0xcb2f('0x54')][_0xcb2f('0x97')]({'name':_0x25ba15['name'],'contentType':_0x25ba15[_0xcb2f('0x2d')],'data':fs[_0xcb2f('0x98')](_0x2b3393)});}}}emlformat['build'](_0x15ec78,function(_0x251d14,_0x41684a){if(_0x251d14)return _0x1552c9(_0x251d14);fs[_0xcb2f('0x99')](path['join'](_0x366d2e,_0x46beb4),_0x41684a);return _0x32373f(_0x41684a);});});}})[_0xcb2f('0x12')](function(_0x50f9ba){if(_0x50f9ba){return _0x322781[_0xcb2f('0x87')](path['join'](_0x366d2e,_0x46beb4),_0x46beb4,function(_0x1cd278){if(!_0x1cd278)fs[_0xcb2f('0x9a')](path['join'](_0x366d2e,_0x46beb4));});}})[_0xcb2f('0x3d')](handleError(_0x322781,null));}; \ No newline at end of file +var _0x03c0=['server','files','from','bcc','createdAt','Attachment','subject','decode','headers','Bcc','Attachments','existsSync','push','readFileSync','build','unlinkSync','eml-format','moment','bluebird','path','ioredis','html-to-text','../../components/parsers/qs','../../config/logger','mail-interactions','../../config/environment','../../mysqldb','redis','defaults','html-entities','./mailMessage.socket','register','jayson/promise','http','client','request','then','info','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','MailMessage,\x20%s,\x20%s','result','catch','json','offset','undefined','count','limit','status','set','Content-Range','update','end','name','send','map','MailMessage','type','key','model','keys','query','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','show','params','rawAttributes','body','find','describe','direction','out','MailAccount','findOne','MailAccountId','CmList','List','Contacts','updatedAt','DESC','MailServerOut','Smtp','CloudProvider','getSmtpOptions','attachments','join','root','server/files/attachments','basename','create','ListId','List\x20not\x20found','SendMail','sendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','accept','mail','readAt','UserId','get','MailInteraction','MailInteractionId','isNil','read1stAt','user','null','AcceptMessage','acceptMessage','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','agent','fullname','email','manual','interface','SIP/%s','channel','motionChannel','event','fromString','EventManager','role','RejectMessage','internal','reject','rejectmessage','download','unix','toString'];(function(_0x2eb7a1,_0x11e5c8){var _0x29852b=function(_0x1273cf){while(--_0x1273cf){_0x2eb7a1['push'](_0x2eb7a1['shift']());}};_0x29852b(++_0x11e5c8);}(_0x03c0,0x144));var _0x003c=function(_0x5a010c,_0x36754a){_0x5a010c=_0x5a010c-0x0;var _0x330d54=_0x03c0[_0x5a010c];return _0x330d54;};'use strict';var emlformat=require(_0x003c('0x0'));var moment=require(_0x003c('0x1'));var BPromise=require(_0x003c('0x2'));var util=require('util');var path=require(_0x003c('0x3'));var fs=require('fs');var _=require('lodash');var Redis=require(_0x003c('0x4'));var htmlToText=require(_0x003c('0x5'));var qs=require(_0x003c('0x6'));var logger=require(_0x003c('0x7'))('api');var interaction_log=require('../../config/logger')(_0x003c('0x8'));var config=require(_0x003c('0x9'));var db=require(_0x003c('0xa'))['db'];config[_0x003c('0xb')]=_[_0x003c('0xc')](config[_0x003c('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x003c('0xb')]));var htmlEntities=require(_0x003c('0xd'));require(_0x003c('0xe'))[_0x003c('0xf')](socket);var jayson=require(_0x003c('0x10'));var client=jayson['client'][_0x003c('0x11')]({'port':0x232c});var client9003=jayson[_0x003c('0x12')]['http']({'port':0x232b});var client9002=jayson[_0x003c('0x12')][_0x003c('0x11')]({'port':0x232a});function respondWithRpcPromise(_0x10fdc0,_0x26a0ae,_0x5c0a1c,_0x3a3fc1){return new BPromise(function(_0x357aae,_0x113bdb){var _0xcbdeb6=_0x3a3fc1||client;return _0xcbdeb6[_0x003c('0x13')](_0x10fdc0,_0x5c0a1c)[_0x003c('0x14')](function(_0x4ee3dd){logger[_0x003c('0x15')]('MailMessage,\x20%s,\x20%s',_0x26a0ae,_0x003c('0x16'));logger[_0x003c('0x17')](_0x003c('0x18'),_0x26a0ae,'request\x20sent',JSON[_0x003c('0x19')](_0x4ee3dd));if(_0x4ee3dd[_0x003c('0x1a')]){if(_0x4ee3dd['error'][_0x003c('0x1b')]===0x1f4){logger[_0x003c('0x1a')]('MailMessage,\x20%s,\x20%s',_0x26a0ae,_0x4ee3dd[_0x003c('0x1a')][_0x003c('0x1c')]);return _0x113bdb(_0x4ee3dd['error']['message']);}logger[_0x003c('0x1a')](_0x003c('0x1d'),_0x26a0ae,_0x4ee3dd['error'][_0x003c('0x1c')]);return _0x357aae(_0x4ee3dd[_0x003c('0x1a')][_0x003c('0x1c')]);}else{logger[_0x003c('0x15')]('MailMessage,\x20%s,\x20%s',_0x26a0ae,_0x003c('0x16'));_0x357aae(_0x4ee3dd[_0x003c('0x1e')][_0x003c('0x1c')]);}})[_0x003c('0x1f')](function(_0x17464b){logger[_0x003c('0x1a')](_0x003c('0x1d'),_0x26a0ae,_0x17464b);_0x113bdb(_0x17464b);});});}function respondWithResult(_0x2d9661,_0x30b1b0){_0x30b1b0=_0x30b1b0||0xc8;return function(_0x5ee9bb){if(_0x5ee9bb){return _0x2d9661['status'](_0x30b1b0)[_0x003c('0x20')](_0x5ee9bb);}};}function respondWithFilteredResult(_0x21c3fe,_0x3afd7b){return function(_0x196a72){if(_0x196a72){var _0x5adae0=typeof _0x3afd7b[_0x003c('0x21')]===_0x003c('0x22')&&typeof _0x3afd7b['limit']===_0x003c('0x22');var _0x2872d2=_0x196a72[_0x003c('0x23')];var _0x561be3=_0x5adae0?0x0:_0x3afd7b[_0x003c('0x21')];var _0xc9685d=_0x5adae0?_0x196a72[_0x003c('0x23')]:_0x3afd7b[_0x003c('0x21')]+_0x3afd7b[_0x003c('0x24')];var _0x2ac1f1;if(_0xc9685d>=_0x2872d2){_0xc9685d=_0x2872d2;_0x2ac1f1=0xc8;}else{_0x2ac1f1=0xce;}_0x21c3fe[_0x003c('0x25')](_0x2ac1f1);return _0x21c3fe[_0x003c('0x26')](_0x003c('0x27'),_0x561be3+'-'+_0xc9685d+'/'+_0x2872d2)[_0x003c('0x20')](_0x196a72);}return null;};}function saveUpdates(_0x5b7d53){return function(_0x2a147b){if(_0x2a147b){return _0x2a147b[_0x003c('0x28')](_0x5b7d53)[_0x003c('0x14')](function(_0x59f511){return _0x59f511;});}return null;};}function removeEntity(_0xbc5d6e){return function(_0x1d8627){if(_0x1d8627){return _0x1d8627['destroy']()[_0x003c('0x14')](function(){_0xbc5d6e['status'](0xcc)[_0x003c('0x29')]();});}};}function handleEntityNotFound(_0x70a05a){return function(_0x2e6aa9){if(!_0x2e6aa9){_0x70a05a['sendStatus'](0x194);}return _0x2e6aa9;};}function handleError(_0x5a63b9,_0x4d6eb8){_0x4d6eb8=_0x4d6eb8||0x1f4;return function(_0x253ebb){logger[_0x003c('0x1a')](_0x253ebb['stack']);if(_0x253ebb[_0x003c('0x2a')]){delete _0x253ebb[_0x003c('0x2a')];}_0x5a63b9[_0x003c('0x25')](_0x4d6eb8)[_0x003c('0x2b')](_0x253ebb);};}exports['index']=function(_0x7390e3,_0x424253){var _0x406f09={},_0x1a7e83={},_0x3c311f={'count':0x0,'rows':[]};var _0x1c4322=_[_0x003c('0x2c')](db[_0x003c('0x2d')]['rawAttributes'],function(_0x534ec3){return{'name':_0x534ec3['fieldName'],'type':_0x534ec3[_0x003c('0x2e')][_0x003c('0x2f')]};});_0x1a7e83[_0x003c('0x30')]=_['map'](_0x1c4322,_0x003c('0x2a'));_0x1a7e83['query']=_[_0x003c('0x31')](_0x7390e3[_0x003c('0x32')]);_0x1a7e83[_0x003c('0x33')]=_[_0x003c('0x34')](_0x1a7e83[_0x003c('0x30')],_0x1a7e83['query']);_0x406f09[_0x003c('0x35')]=_[_0x003c('0x34')](_0x1a7e83['model'],qs[_0x003c('0x36')](_0x7390e3['query']['fields']));_0x406f09[_0x003c('0x35')]=_0x406f09[_0x003c('0x35')][_0x003c('0x37')]?_0x406f09[_0x003c('0x35')]:_0x1a7e83[_0x003c('0x30')];if(!_0x7390e3[_0x003c('0x32')]['hasOwnProperty']('nolimit')){_0x406f09[_0x003c('0x24')]=qs['limit'](_0x7390e3['query']['limit']);_0x406f09[_0x003c('0x21')]=qs[_0x003c('0x21')](_0x7390e3[_0x003c('0x32')][_0x003c('0x21')]);}_0x406f09[_0x003c('0x38')]=qs[_0x003c('0x39')](_0x7390e3[_0x003c('0x32')]['sort']);_0x406f09[_0x003c('0x3a')]=qs[_0x003c('0x33')](_[_0x003c('0x3b')](_0x7390e3[_0x003c('0x32')],_0x1a7e83[_0x003c('0x33')]),_0x1c4322);if(_0x7390e3[_0x003c('0x32')][_0x003c('0x3c')]){_0x406f09[_0x003c('0x3a')]=_[_0x003c('0x3d')](_0x406f09[_0x003c('0x3a')],{'$or':_['map'](_0x1c4322,function(_0x49109f){if(_0x49109f[_0x003c('0x2e')]!=='VIRTUAL'){var _0x558f1f={};_0x558f1f[_0x49109f['name']]={'$like':'%'+_0x7390e3[_0x003c('0x32')][_0x003c('0x3c')]+'%'};return _0x558f1f;}})});}_0x406f09=_[_0x003c('0x3d')]({},_0x406f09,_0x7390e3[_0x003c('0x3e')]);var _0x34e35b={'where':_0x406f09['where']};return db[_0x003c('0x2d')]['count'](_0x34e35b)[_0x003c('0x14')](function(_0x56b184){_0x3c311f[_0x003c('0x23')]=_0x56b184;if(_0x7390e3[_0x003c('0x32')][_0x003c('0x3f')]){_0x406f09[_0x003c('0x40')]=[{'all':!![]}];}return db[_0x003c('0x2d')][_0x003c('0x41')](_0x406f09);})[_0x003c('0x14')](function(_0x721a13){_0x3c311f[_0x003c('0x42')]=_0x721a13;return _0x3c311f;})[_0x003c('0x14')](respondWithFilteredResult(_0x424253,_0x406f09))[_0x003c('0x1f')](handleError(_0x424253,null));};exports[_0x003c('0x43')]=function(_0x323a89,_0xc1a83f){var _0x4d1939={'raw':!![],'where':{'id':_0x323a89[_0x003c('0x44')]['id']}},_0x4eb6cd={};_0x4eb6cd['model']=_[_0x003c('0x31')](db[_0x003c('0x2d')][_0x003c('0x45')]);_0x4eb6cd[_0x003c('0x32')]=_[_0x003c('0x31')](_0x323a89[_0x003c('0x32')]);_0x4eb6cd[_0x003c('0x33')]=_[_0x003c('0x34')](_0x4eb6cd[_0x003c('0x30')],_0x4eb6cd[_0x003c('0x32')]);_0x4d1939[_0x003c('0x35')]=_[_0x003c('0x34')](_0x4eb6cd[_0x003c('0x30')],qs[_0x003c('0x36')](_0x323a89[_0x003c('0x32')][_0x003c('0x36')]));_0x4d1939[_0x003c('0x35')]=_0x4d1939[_0x003c('0x35')][_0x003c('0x37')]?_0x4d1939[_0x003c('0x35')]:_0x4eb6cd[_0x003c('0x30')];if(_0x323a89[_0x003c('0x32')]['includeAll']){_0x4d1939['include']=[{'all':!![]}];}_0x4d1939=_[_0x003c('0x3d')]({},_0x4d1939,_0x323a89[_0x003c('0x3e')]);return db[_0x003c('0x2d')]['find'](_0x4d1939)['then'](handleEntityNotFound(_0xc1a83f,null))['then'](respondWithResult(_0xc1a83f,null))['catch'](handleError(_0xc1a83f,null));};exports[_0x003c('0x28')]=function(_0x417497,_0x4989d5){if(_0x417497[_0x003c('0x46')]['id']){delete _0x417497['body']['id'];}return db[_0x003c('0x2d')][_0x003c('0x47')]({'where':{'id':_0x417497['params']['id']}})['then'](handleEntityNotFound(_0x4989d5,null))[_0x003c('0x14')](saveUpdates(_0x417497['body'],null))['then'](respondWithResult(_0x4989d5,null))['catch'](handleError(_0x4989d5,null));};exports['destroy']=function(_0x206d6b,_0x444f48){return db['MailMessage'][_0x003c('0x47')]({'where':{'id':_0x206d6b[_0x003c('0x44')]['id']}})[_0x003c('0x14')](handleEntityNotFound(_0x444f48,null))[_0x003c('0x14')](removeEntity(_0x444f48,null))[_0x003c('0x1f')](handleError(_0x444f48,null));};exports[_0x003c('0x48')]=function(_0xd49d7a,_0x59ed05){return db[_0x003c('0x2d')][_0x003c('0x48')]()[_0x003c('0x14')](respondWithResult(_0x59ed05,null))[_0x003c('0x1f')](handleError(_0x59ed05,null));};exports['create']=function(_0x5d2d0a,_0x1cf6c1){return db[_0x003c('0x2d')]['create'](_0x5d2d0a[_0x003c('0x46')])[_0x003c('0x14')](function(_0x510bfd){if(_0x510bfd){if(_0x510bfd[_0x003c('0x49')]===_0x003c('0x4a')&&!_0x510bfd['secret']){var _0x4bd0fb,_0x128ac4,_0x232968;if(_0x5d2d0a[_0x003c('0x46')]['to']){_0x128ac4=_0x5d2d0a[_0x003c('0x46')]['to']['split'](',')[0x0];}return db[_0x003c('0x4b')][_0x003c('0x4c')]({'where':{'id':_0x510bfd[_0x003c('0x4d')]},'include':[{'model':db[_0x003c('0x4e')],'as':_0x003c('0x4f'),'include':[{'model':db['CmContact'],'as':_0x003c('0x50'),'where':{'email':_0x128ac4},'limit':0x1,'order':[[_0x003c('0x51'),_0x003c('0x52')]]}]},{'model':db[_0x003c('0x53')],'as':_0x003c('0x54'),'raw':!![],'include':[{'model':db[_0x003c('0x55')],'as':_0x003c('0x55'),'raw':!![]}]}]})[_0x003c('0x14')](function(_0x33279a){_0x4bd0fb=_0x33279a;if(!_0x4bd0fb||!_0x4bd0fb[_0x003c('0x54')])return;var _0x497df3=_0x4bd0fb[_0x003c('0x56')]();if(_0x5d2d0a[_0x003c('0x46')][_0x003c('0x57')]&&_0x5d2d0a[_0x003c('0x46')][_0x003c('0x57')][_0x003c('0x37')]){for(var _0x219941=0x0;_0x219941<_0x5d2d0a['body']['attachments'][_0x003c('0x37')];_0x219941+=0x1){_0x5d2d0a[_0x003c('0x46')][_0x003c('0x57')][_0x219941]={'filename':_0x5d2d0a['body']['attachments'][_0x219941][_0x003c('0x2a')],'path':path[_0x003c('0x58')](config[_0x003c('0x59')],_0x003c('0x5a'),_0x5d2d0a['body'][_0x003c('0x57')][_0x219941][_0x003c('0x5b')])};}}_0x232968={'account':_0x497df3,'message':_0x5d2d0a['body']};return;})[_0x003c('0x14')](function(){if(_0x4bd0fb[_0x003c('0x4f')]){if(_0x4bd0fb['List']['Contacts'][_0x003c('0x37')]){return _0x4bd0fb[_0x003c('0x4f')][_0x003c('0x50')][0x0];}else{return db['CmContact'][_0x003c('0x5c')](_[_0x003c('0xc')](_0x5d2d0a['body'],{'firstName':_0x5d2d0a[_0x003c('0x46')]['to'],'email':_0x5d2d0a[_0x003c('0x46')]['to'],'phone':_0x5d2d0a[_0x003c('0x46')]['to'],'ListId':_0x4bd0fb[_0x003c('0x5d')]}));}}else{throw new Error(_0x003c('0x5e'));}})[_0x003c('0x14')](function(){if(_0x232968){return respondWithRpcPromise(_0x003c('0x5f'),_0x003c('0x60'),_0x232968,client9003)[_0x003c('0x14')](function(_0x1233ac){return _0x510bfd[_0x003c('0x28')]({'read':!![],'messageId':_0x1233ac[_0x003c('0x61')],'sentAt':moment()[_0x003c('0x62')](_0x003c('0x63'))});})[_0x003c('0x1f')](function(_0x3364be){logger[_0x003c('0x1a')]('%s',JSON[_0x003c('0x19')](_0x3364be));return _0x510bfd;});}return _0x510bfd;});}return _0x510bfd;}})['then'](respondWithResult(_0x1cf6c1,0xc9))[_0x003c('0x1f')](handleError(_0x1cf6c1,null));};exports[_0x003c('0x64')]=function(_0x3d6b06,_0x2b7e3e){var _0xcbde45={'agent':{},'channel':_0x003c('0x65')};if(_0x3d6b06[_0x003c('0x46')]['id']){delete _0x3d6b06['body']['id'];}_0x3d6b06['body']['read']=!![];_0x3d6b06[_0x003c('0x46')][_0x003c('0x66')]=moment()['format'](_0x003c('0x63'));_0x3d6b06[_0x003c('0x46')]['UserId']=_0x3d6b06[_0x003c('0x46')]['UserId']||_0x3d6b06['user']['id'];_0xcbde45['agent']['id']=_0x3d6b06['body'][_0x003c('0x67')];return db[_0x003c('0x2d')][_0x003c('0x47')]({'where':{'id':_0x3d6b06['params']['id'],'UserId':null}})[_0x003c('0x14')](handleEntityNotFound(_0x2b7e3e,null))[_0x003c('0x14')](saveUpdates(_0x3d6b06[_0x003c('0x46')],null))[_0x003c('0x14')](function(_0xb04e32){if(_0xb04e32){_0xcbde45['message']=_0xb04e32[_0x003c('0x68')]({'plain':!![]});return db[_0x003c('0x69')][_0x003c('0x47')]({'where':{'id':_0xb04e32[_0x003c('0x6a')]}});}return null;})['then'](handleEntityNotFound(_0x2b7e3e,null))['then'](function(_0x4aa426){if(_0x4aa426){return _0x4aa426['update']({'UserId':_0x3d6b06[_0x003c('0x46')]['UserId'],'read1stAt':_[_0x003c('0x6b')](_0x4aa426[_0x003c('0x6c')])?moment()[_0x003c('0x62')](_0x003c('0x63')):undefined});}return null;})[_0x003c('0x14')](function(_0x1d9924){if(_0x1d9924){_0xcbde45['interaction']=_0x1d9924[_0x003c('0x68')]({'plain':!![]});interaction_log[_0x003c('0x15')]('[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x3d6b06[_0x003c('0x6d')]['id'],_0x3d6b06[_0x003c('0x6d')]['name'],_0x3d6b06['user']['role'],_0xcbde45['interaction']['id'],_0x3d6b06[_0x003c('0x46')]?JSON[_0x003c('0x19')](_0x3d6b06[_0x003c('0x46')]):_0x003c('0x6e'));return respondWithRpcPromise(_0x003c('0x6f'),_0x003c('0x70'),_0xcbde45);}return null;})[_0x003c('0x14')](function(_0x2ddca4){var _0x64e927='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x2ddca4[_0x003c('0x1c')][_0x003c('0x71')];return db[_0x003c('0x72')][_0x003c('0x32')](_0x64e927,{'type':db[_0x003c('0x73')][_0x003c('0x74')][_0x003c('0x75')],'raw':!![]})['then'](function(_0x2fc21d){return _0x2fc21d;});})[_0x003c('0x14')](function(_0x2b5ef3){if(_0x2b5ef3){_0xcbde45[_0x003c('0x1c')][_0x003c('0x76')]=_0x2b5ef3[0x0];if(!_0x3d6b06[_0x003c('0x46')][_0x003c('0x67')])return;return db['User']['find']({'where':{'id':_0x3d6b06[_0x003c('0x46')]['UserId'],'role':_0x003c('0x77')},'attributes':['id',_0x003c('0x2a'),_0x003c('0x78'),_0x003c('0x79'),'internal'],'raw':!![]});}return null;})['then'](function(_0x4ca53d){if(!_0x4ca53d)return null;_0xcbde45[_0x003c('0x1c')]['agent']=_0x4ca53d;return _0xcbde45;})[_0x003c('0x14')](function(_0x3a920c){if(_0x3a920c){if(_0x3d6b06[_0x003c('0x46')][_0x003c('0x7a')]){_0xcbde45[_0x003c('0x1c')][_0x003c('0x7b')]=util[_0x003c('0x62')](_0x003c('0x7c'),_0x3d6b06[_0x003c('0x6d')][_0x003c('0x2a')]);_0xcbde45['message'][_0x003c('0x7d')]=_0xcbde45['channel'];_0xcbde45['message'][_0x003c('0x7e')]=_0xcbde45[_0x003c('0x7d')];_0xcbde45['message'][_0x003c('0x7f')]='accept';_0xcbde45[_0x003c('0x1c')]['body']=htmlToText[_0x003c('0x80')](_0xcbde45[_0x003c('0x1c')][_0x003c('0x46')]);return respondWithRpcPromise('EventManager',_0x003c('0x81'),{'event':'acceptmessage','message':_0xcbde45[_0x003c('0x1c')]},client9002)[_0x003c('0x14')](function(){return _0xcbde45;});}return _0xcbde45;}return null;})[_0x003c('0x14')](respondWithResult(_0x2b7e3e,null))[_0x003c('0x1f')](handleError(_0x2b7e3e,null));};exports['reject']=function(_0x161bfd,_0x2c3226){var _0x45d3c3={'agent':{},'channel':_0x003c('0x65')};if(_0x161bfd['body']['id']){delete _0x161bfd[_0x003c('0x46')]['id'];}_0x161bfd[_0x003c('0x46')][_0x003c('0x67')]=_0x161bfd[_0x003c('0x46')][_0x003c('0x67')]||_0x161bfd[_0x003c('0x6d')]['id'];_0x45d3c3[_0x003c('0x77')]['id']=_0x161bfd[_0x003c('0x46')][_0x003c('0x67')];return db[_0x003c('0x2d')]['find']({'where':{'id':_0x161bfd['params']['id'],'UserId':null}})[_0x003c('0x14')](handleEntityNotFound(_0x2c3226,null))[_0x003c('0x14')](function(_0x3bfdd6){if(_0x3bfdd6){_0x45d3c3[_0x003c('0x1c')]=_0x3bfdd6[_0x003c('0x68')]({'plain':!![]});return db[_0x003c('0x69')][_0x003c('0x47')]({'where':{'id':_0x3bfdd6[_0x003c('0x6a')]}});}return null;})['then'](handleEntityNotFound(_0x2c3226,null))[_0x003c('0x14')](function(_0x498586){if(_0x498586){_0x45d3c3['interaction']=_0x498586[_0x003c('0x68')]({'plain':!![]});interaction_log[_0x003c('0x15')]('[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x161bfd[_0x003c('0x6d')]['id'],_0x161bfd[_0x003c('0x6d')]['name'],_0x161bfd['user'][_0x003c('0x82')],_0x45d3c3['interaction']['id'],_0x161bfd[_0x003c('0x46')]?JSON[_0x003c('0x19')](_0x161bfd['body']):'null');return respondWithRpcPromise(_0x003c('0x83'),'rejectMessage',_0x45d3c3);}return null;})[_0x003c('0x14')](function(_0x6c6752){var _0x3310fe='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x6c6752[_0x003c('0x1c')][_0x003c('0x71')];return db[_0x003c('0x72')]['query'](_0x3310fe,{'type':db['Sequelize'][_0x003c('0x74')]['SELECT'],'raw':!![]})[_0x003c('0x14')](function(_0x31d81d){return _0x31d81d;});})[_0x003c('0x14')](function(_0x52ad2a){if(_0x52ad2a){_0x45d3c3[_0x003c('0x1c')]['contact']=_0x52ad2a[0x0];if(!_0x161bfd[_0x003c('0x46')][_0x003c('0x67')])return;return db['User'][_0x003c('0x47')]({'where':{'id':_0x161bfd[_0x003c('0x46')][_0x003c('0x67')],'role':'agent'},'attributes':['id','name',_0x003c('0x78'),_0x003c('0x79'),_0x003c('0x84')],'raw':!![]});}return null;})[_0x003c('0x14')](function(_0x38687c){if(!_0x38687c)return null;_0x45d3c3[_0x003c('0x1c')][_0x003c('0x77')]=_0x38687c;return _0x45d3c3;})['then'](function(_0x1bb1d2){if(_0x1bb1d2){_0x1bb1d2[_0x003c('0x1c')][_0x003c('0x7b')]=util['format']('SIP/%s',_0x161bfd[_0x003c('0x6d')][_0x003c('0x2a')]);_0x1bb1d2[_0x003c('0x1c')][_0x003c('0x7d')]=_0x45d3c3[_0x003c('0x7d')];_0x1bb1d2[_0x003c('0x1c')]['motionChannel']=_0x45d3c3[_0x003c('0x7d')];_0x1bb1d2[_0x003c('0x1c')][_0x003c('0x7f')]=_0x003c('0x85');_0x1bb1d2[_0x003c('0x1c')][_0x003c('0x46')]=htmlToText[_0x003c('0x80')](_0x45d3c3[_0x003c('0x1c')][_0x003c('0x46')]);respondWithRpcPromise('EventManager',_0x003c('0x81'),{'event':_0x003c('0x86'),'message':_0x1bb1d2[_0x003c('0x1c')]},client9002);return _0x45d3c3;}return null;})[_0x003c('0x14')](respondWithResult(_0x2c3226,null))[_0x003c('0x1f')](handleError(_0x2c3226,null));};exports[_0x003c('0x87')]=function(_0xc29cd9,_0xf62b89){var _0x16d23a=moment()[_0x003c('0x88')]()[_0x003c('0x89')]();var _0x431932=path[_0x003c('0x58')](config['root'],_0x003c('0x8a'),_0x003c('0x8b'),'tmp');var _0x28fa3e=path['join'](config['root'],_0x003c('0x8a'),'files',_0x003c('0x57'));var _0x48c243=util[_0x003c('0x62')]('message-%s.eml',_0x16d23a);return db[_0x003c('0x2d')][_0x003c('0x47')]({'where':{'id':_0xc29cd9[_0x003c('0x44')]['id']},'attributes':['id',_0x003c('0x46'),_0x003c('0x8c'),'to','cc',_0x003c('0x8d'),'subject',_0x003c('0x8e')],'include':_0xc29cd9['query'][_0x003c('0x57')]?[{'model':db[_0x003c('0x8f')],'as':'Attachments'}]:undefined})[_0x003c('0x14')](handleEntityNotFound(_0xf62b89,null))['then'](function(_0x1213c1){if(_0x1213c1){var _0x237f38=_0x1213c1;var _0x47f5fa={'from':_0x237f38[_0x003c('0x8c')],'to':_0x237f38['to'],'subject':_0x237f38[_0x003c('0x90')],'html':htmlEntities[_0x003c('0x91')](_0x237f38[_0x003c('0x46')]),'headers':{'Date':moment(_0x237f38[_0x003c('0x8e')])[_0x003c('0x62')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x1213c1['cc']){_0x47f5fa[_0x003c('0x92')]['Cc']=_0x1213c1['cc'];}if(_0x1213c1[_0x003c('0x8d')]){_0x47f5fa[_0x003c('0x92')][_0x003c('0x93')]=_0x1213c1['bcc'];}return new BPromise(function(_0x468b20,_0x1f998b){if(_0x1213c1['Attachments']){for(var _0x542c0f=0x0;_0x542c0f<_0x1213c1[_0x003c('0x94')]['length'];_0x542c0f++){var _0x5630f8=_0x1213c1[_0x003c('0x94')][_0x542c0f];var _0x151b42=path[_0x003c('0x58')](_0x28fa3e,_0x5630f8[_0x003c('0x5b')]);if(fs[_0x003c('0x95')](_0x151b42)){_0x47f5fa['attachments'][_0x003c('0x96')]({'name':_0x5630f8['name'],'contentType':_0x5630f8[_0x003c('0x2e')],'data':fs[_0x003c('0x97')](_0x151b42)});}}}emlformat[_0x003c('0x98')](_0x47f5fa,function(_0x5b1277,_0x9a747e){if(_0x5b1277)return _0x1f998b(_0x5b1277);fs['writeFileSync'](path['join'](_0x431932,_0x48c243),_0x9a747e);return _0x468b20(_0x9a747e);});});}})[_0x003c('0x14')](function(_0x27fac9){if(_0x27fac9){return _0xf62b89[_0x003c('0x87')](path['join'](_0x431932,_0x48c243),_0x48c243,function(_0x56ddfc){if(!_0x56ddfc)fs[_0x003c('0x99')](path[_0x003c('0x58')](_0x431932,_0x48c243));});}})[_0x003c('0x1f')](handleError(_0xf62b89,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index c5c73aa..0434d7d 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 _0x7678=['../../mysqldb','MailMessage','save','remove','hook','events'];(function(_0x3c6c44,_0x3aae67){var _0x1ecffd=function(_0x46a5f8){while(--_0x46a5f8){_0x3c6c44['push'](_0x3c6c44['shift']());}};_0x1ecffd(++_0x3aae67);}(_0x7678,0xc5));var _0x8767=function(_0x253c6c,_0x5226a9){_0x253c6c=_0x253c6c-0x0;var _0x1a7f8d=_0x7678[_0x253c6c];return _0x1a7f8d;};'use strict';var EventEmitter=require(_0x8767('0x0'));var MailMessage=require(_0x8767('0x1'))['db'][_0x8767('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x8767('0x3'),'afterUpdate':'update','afterDestroy':_0x8767('0x4')};function emitEvent(_0x1b2f89){return function(_0x57c167,_0x30d799,_0xd08a2c){MailMessageEvents['emit'](_0x1b2f89+':'+_0x57c167['id'],_0x57c167);MailMessageEvents['emit'](_0x1b2f89,_0x57c167);_0xd08a2c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailMessage[_0x8767('0x5')](e,emitEvent(event));}}module['exports']=MailMessageEvents; \ No newline at end of file +var _0xdf7b=['setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0xdf7b,0x167));var _0xbdf7=function(_0x15bc81,_0x4d4f77){_0x15bc81=_0x15bc81-0x0;var _0x59440e=_0xdf7b[_0x15bc81];return _0x59440e;};'use strict';var EventEmitter=require('events');var MailMessage=require(_0xbdf7('0x0'))['db']['MailMessage'];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0xbdf7('0x1')](0x0);var events={'afterCreate':_0xbdf7('0x2'),'afterUpdate':_0xbdf7('0x3'),'afterDestroy':'remove'};function emitEvent(_0x1d02ae){return function(_0x3959f4,_0x4020c8,_0x11d57a){MailMessageEvents[_0xbdf7('0x4')](_0x1d02ae+':'+_0x3959f4['id'],_0x3959f4);MailMessageEvents[_0xbdf7('0x4')](_0x1d02ae,_0x3959f4);_0x11d57a(null);};}for(var e in events){if(events[_0xbdf7('0x5')](e)){var event=events[e];MailMessage[_0xbdf7('0x6')](e,emitEvent(event));}}module[_0xbdf7('0x7')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index 11a0e3d..0005537 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 _0x7c5a=['isNil','MailInteraction','MailInteractionId','then','createdAt','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','moment','bluebird','../../config/environment','./mailMessage.attributes','exports','define','MailMessage','mail_messages','messageId','fti_mail_messages','plainBody','subject','FULLTEXT','body','models','get','direction','toLowerCase','out','secret'];(function(_0x4e73d8,_0x3ffb7d){var _0x974f0a=function(_0x34d9bc){while(--_0x34d9bc){_0x4e73d8['push'](_0x4e73d8['shift']());}};_0x974f0a(++_0x3ffb7d);}(_0x7c5a,0x163));var _0xa7c5=function(_0x4854fb,_0x5e654d){_0x4854fb=_0x4854fb-0x0;var _0x2d787d=_0x7c5a[_0x4854fb];return _0x2d787d;};'use strict';var _=require('lodash');var util=require(_0xa7c5('0x0'));var logger=require(_0xa7c5('0x1'))('api');var moment=require(_0xa7c5('0x2'));var BPromise=require(_0xa7c5('0x3'));var rp=require('request-promise');var htmlToText=require('html-to-text');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xa7c5('0x4'));var attributes=require(_0xa7c5('0x5'));module[_0xa7c5('0x6')]=function(_0x844982,_0x5f5565){return _0x844982[_0xa7c5('0x7')](_0xa7c5('0x8'),attributes,{'tableName':_0xa7c5('0x9'),'paranoid':![],'indexes':[{'name':_0xa7c5('0xa'),'fields':[_0xa7c5('0xa')]},{'name':_0xa7c5('0xb'),'fields':[_0xa7c5('0xc'),_0xa7c5('0xd')],'type':_0xa7c5('0xe')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x5641a1,_0x4c0d2d,_0x3831a5){if(_0x5641a1[_0xa7c5('0xf')]){_0x5641a1['plainBody']=htmlToText['fromString'](_0x5641a1[_0xa7c5('0xf')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x3831a5(null,_0x4c0d2d);},'afterCreate':function(_0x50cda3,_0x419667,_0x190526){var _0x361d6d=_0x844982[_0xa7c5('0x10')];var _0x1c458a=_0x50cda3[_0xa7c5('0x11')]({'plain':!![]});if(_0x1c458a[_0xa7c5('0x12')][_0xa7c5('0x13')]()==='in'||_0x1c458a[_0xa7c5('0x12')][_0xa7c5('0x13')]()===_0xa7c5('0x14')&&!_0x1c458a[_0xa7c5('0x15')]&&!_[_0xa7c5('0x16')](_0x1c458a['UserId'])){_0x361d6d[_0xa7c5('0x17')]['findOne']({'where':{'id':_0x1c458a[_0xa7c5('0x18')]}})[_0xa7c5('0x19')](function(_0x235ab8){if(_0x235ab8){_0x235ab8['update']({'lastMsgAt':_0x1c458a[_0xa7c5('0x1a')],'lastMsgDirection':_0x1c458a[_0xa7c5('0x12')][_0xa7c5('0x13')]()});}})['catch'](function(_0xa2b255){console['error'](_0xa2b255);});}_0x190526();}},'charset':_0xa7c5('0x1b'),'collate':_0xa7c5('0x1c')});}; \ No newline at end of file +var _0xa20f=['./mailMessage.attributes','define','MailMessage','mail_messages','messageId','fti_mail_messages','plainBody','subject','FULLTEXT','body','fromString','get','direction','toLowerCase','out','secret','isNil','UserId','MailInteraction','MailInteractionId','then','update','createdAt','error','utf8mb4','utf8mb4_unicode_ci','../../config/logger','moment','bluebird','html-to-text','path','rimraf'];(function(_0x423af4,_0xb533be){var _0x45293b=function(_0x25a848){while(--_0x25a848){_0x423af4['push'](_0x423af4['shift']());}};_0x45293b(++_0xb533be);}(_0xa20f,0x11a));var _0xfa20=function(_0x5d9a79,_0x5e7dbe){_0x5d9a79=_0x5d9a79-0x0;var _0x33b88f=_0xa20f[_0x5d9a79];return _0x33b88f;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xfa20('0x0'))('api');var moment=require(_0xfa20('0x1'));var BPromise=require(_0xfa20('0x2'));var rp=require('request-promise');var htmlToText=require(_0xfa20('0x3'));var fs=require('fs');var path=require(_0xfa20('0x4'));var rimraf=require(_0xfa20('0x5'));var config=require('../../config/environment');var attributes=require(_0xfa20('0x6'));module['exports']=function(_0x3d1e0e,_0x286ef1){return _0x3d1e0e[_0xfa20('0x7')](_0xfa20('0x8'),attributes,{'tableName':_0xfa20('0x9'),'paranoid':![],'indexes':[{'name':_0xfa20('0xa'),'fields':['messageId']},{'name':_0xfa20('0xb'),'fields':[_0xfa20('0xc'),_0xfa20('0xd')],'type':_0xfa20('0xe')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x19c075,_0x10e60e,_0x59dea3){if(_0x19c075[_0xfa20('0xf')]){_0x19c075[_0xfa20('0xc')]=htmlToText[_0xfa20('0x10')](_0x19c075[_0xfa20('0xf')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x59dea3(null,_0x10e60e);},'afterCreate':function(_0x59a68a,_0x436fdc,_0x27d973){var _0x57ccad=_0x3d1e0e['models'];var _0x51dcbf=_0x59a68a[_0xfa20('0x11')]({'plain':!![]});if(_0x51dcbf[_0xfa20('0x12')]['toLowerCase']()==='in'||_0x51dcbf[_0xfa20('0x12')][_0xfa20('0x13')]()===_0xfa20('0x14')&&!_0x51dcbf[_0xfa20('0x15')]&&!_[_0xfa20('0x16')](_0x51dcbf[_0xfa20('0x17')])){_0x57ccad[_0xfa20('0x18')]['findOne']({'where':{'id':_0x51dcbf[_0xfa20('0x19')]}})[_0xfa20('0x1a')](function(_0xcf748d){if(_0xcf748d){_0xcf748d[_0xfa20('0x1b')]({'lastMsgAt':_0x51dcbf[_0xfa20('0x1c')],'lastMsgDirection':_0x51dcbf[_0xfa20('0x12')][_0xfa20('0x13')]()});}})['catch'](function(_0x37e70a){console[_0xfa20('0x1d')](_0x37e70a);});}_0x27d973();}},'charset':_0xfa20('0x1e'),'collate':_0xfa20('0x1f')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index b928650..8aa72b1 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 _0x1399=['catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','defaults','localhost','./mailMessage.socket','register','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','error','code','message','result','CreateMailMessage','MailMessage','create','body','options','raw','debug','stringify'];(function(_0x119e7a,_0x3949d3){var _0x1fb90a=function(_0x57eb3f){while(--_0x57eb3f){_0x119e7a['push'](_0x119e7a['shift']());}};_0x1fb90a(++_0x3949d3);}(_0x1399,0x16c));var _0x9139=function(_0x5f013e,_0x138a7b){_0x5f013e=_0x5f013e-0x0;var _0x247274=_0x1399[_0x5f013e];return _0x247274;};'use strict';var _=require(_0x9139('0x0'));var util=require(_0x9139('0x1'));var moment=require('moment');var BPromise=require(_0x9139('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9139('0x3'));var db=require(_0x9139('0x4'))['db'];var utils=require(_0x9139('0x5'));var logger=require(_0x9139('0x6'))(_0x9139('0x7'));var config=require(_0x9139('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x9139('0x9')]({'port':0x232a});config[_0x9139('0xa')]=_[_0x9139('0xb')](config['redis'],{'host':_0x9139('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x9139('0xd'))[_0x9139('0xe')](socket);function respondWithRpcPromise(_0x4830cd,_0x315de8,_0x1bfa6b){return new BPromise(function(_0x5c90eb,_0x4f7f3a){return client[_0x9139('0xf')](_0x4830cd,_0x1bfa6b)[_0x9139('0x10')](function(_0x23357c){logger[_0x9139('0x11')](_0x9139('0x12'),_0x315de8,'request\x20sent');logger['debug']('MailMessage,\x20%s,\x20%s,\x20%s',_0x315de8,_0x9139('0x13'),JSON['stringify'](_0x23357c));if(_0x23357c[_0x9139('0x14')]){if(_0x23357c[_0x9139('0x14')][_0x9139('0x15')]===0x1f4){logger[_0x9139('0x14')]('MailMessage,\x20%s,\x20%s',_0x315de8,_0x23357c[_0x9139('0x14')]['message']);return _0x4f7f3a(_0x23357c['error']['message']);}logger[_0x9139('0x14')](_0x9139('0x12'),_0x315de8,_0x23357c[_0x9139('0x14')][_0x9139('0x16')]);return _0x5c90eb(_0x23357c[_0x9139('0x14')][_0x9139('0x16')]);}else{logger['info']('MailMessage,\x20%s,\x20%s',_0x315de8,_0x9139('0x13'));_0x5c90eb(_0x23357c[_0x9139('0x17')]['message']);}})['catch'](function(_0x30a363){logger[_0x9139('0x14')]('MailMessage,\x20%s,\x20%s',_0x315de8,_0x30a363);_0x4f7f3a(_0x30a363);});});}exports[_0x9139('0x18')]=function(_0x1ef57b){var _0x1a592e=this;return new Promise(function(_0x3c8296,_0xd2eb33){return db[_0x9139('0x19')][_0x9139('0x1a')](_0x1ef57b[_0x9139('0x1b')],{'raw':_0x1ef57b[_0x9139('0x1c')]?_0x1ef57b[_0x9139('0x1c')][_0x9139('0x1d')]===undefined?!![]:![]:!![]})[_0x9139('0x10')](function(_0x5a3e2e){logger[_0x9139('0x11')](_0x9139('0x18'),_0x1ef57b);logger[_0x9139('0x1e')](_0x9139('0x18'),_0x1ef57b,JSON[_0x9139('0x1f')](_0x5a3e2e));_0x3c8296(_0x5a3e2e);})[_0x9139('0x20')](function(_0x4b7fe0){logger[_0x9139('0x14')](_0x9139('0x18'),_0x4b7fe0['message'],_0x1ef57b);_0xd2eb33(_0x1a592e[_0x9139('0x14')](0x1f4,_0x4b7fe0[_0x9139('0x16')]));});});}; \ No newline at end of file +var _0xc900=['jayson/promise','client','http','redis','localhost','socket.io-emitter','./mailMessage.socket','register','request','then','info','request\x20sent','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','MailMessage,\x20%s,\x20%s','message','catch','CreateMailMessage','MailMessage','body','options','raw','debug','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0xc900,0xb3));var _0x0c90=function(_0x43c870,_0x58aa30){_0x43c870=_0x43c870-0x0;var _0x33afa1=_0xc900[_0x43c870];return _0x33afa1;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x0c90('0x0'));var BPromise=require(_0x0c90('0x1'));var rs=require(_0x0c90('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0c90('0x3'))['db'];var utils=require(_0x0c90('0x4'));var logger=require('../../config/logger')(_0x0c90('0x5'));var config=require(_0x0c90('0x6'));var jayson=require(_0x0c90('0x7'));var client=jayson[_0x0c90('0x8')][_0x0c90('0x9')]({'port':0x232a});config[_0x0c90('0xa')]=_['defaults'](config[_0x0c90('0xa')],{'host':_0x0c90('0xb'),'port':0x18eb});var socket=require(_0x0c90('0xc'))(new Redis(config[_0x0c90('0xa')]));require(_0x0c90('0xd'))[_0x0c90('0xe')](socket);function respondWithRpcPromise(_0x313ce9,_0x18d9fd,_0x3e0df6){return new BPromise(function(_0x34456e,_0x10daeb){return client[_0x0c90('0xf')](_0x313ce9,_0x3e0df6)[_0x0c90('0x10')](function(_0x57917b){logger[_0x0c90('0x11')]('MailMessage,\x20%s,\x20%s',_0x18d9fd,_0x0c90('0x12'));logger['debug'](_0x0c90('0x13'),_0x18d9fd,_0x0c90('0x12'),JSON[_0x0c90('0x14')](_0x57917b));if(_0x57917b[_0x0c90('0x15')]){if(_0x57917b[_0x0c90('0x15')]['code']===0x1f4){logger[_0x0c90('0x15')](_0x0c90('0x16'),_0x18d9fd,_0x57917b['error'][_0x0c90('0x17')]);return _0x10daeb(_0x57917b[_0x0c90('0x15')][_0x0c90('0x17')]);}logger['error']('MailMessage,\x20%s,\x20%s',_0x18d9fd,_0x57917b[_0x0c90('0x15')][_0x0c90('0x17')]);return _0x34456e(_0x57917b[_0x0c90('0x15')][_0x0c90('0x17')]);}else{logger[_0x0c90('0x11')](_0x0c90('0x16'),_0x18d9fd,_0x0c90('0x12'));_0x34456e(_0x57917b['result'][_0x0c90('0x17')]);}})[_0x0c90('0x18')](function(_0x462d49){logger[_0x0c90('0x15')]('MailMessage,\x20%s,\x20%s',_0x18d9fd,_0x462d49);_0x10daeb(_0x462d49);});});}exports[_0x0c90('0x19')]=function(_0xd129ca){var _0x143047=this;return new Promise(function(_0x1241a9,_0x315932){return db[_0x0c90('0x1a')]['create'](_0xd129ca[_0x0c90('0x1b')],{'raw':_0xd129ca['options']?_0xd129ca[_0x0c90('0x1c')][_0x0c90('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x2a053a){logger[_0x0c90('0x11')](_0x0c90('0x19'),_0xd129ca);logger[_0x0c90('0x1e')](_0x0c90('0x19'),_0xd129ca,JSON[_0x0c90('0x14')](_0x2a053a));_0x1241a9(_0x2a053a);})['catch'](function(_0x26f0a3){logger[_0x0c90('0x15')]('CreateMailMessage',_0x26f0a3['message'],_0xd129ca);_0x315932(_0x143047[_0x0c90('0x15')](0x1f4,_0x26f0a3[_0x0c90('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 79eb241..fa2ae0d 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 _0x74a1=['save','remove','emit','removeListener','register','mailMessage:','./mailMessage.events'];(function(_0x4c7ecf,_0x31a471){var _0x411b1e=function(_0x5b5404){while(--_0x5b5404){_0x4c7ecf['push'](_0x4c7ecf['shift']());}};_0x411b1e(++_0x31a471);}(_0x74a1,0x7d));var _0x174a=function(_0x31f8aa,_0x1d1aa1){_0x31f8aa=_0x31f8aa-0x0;var _0x5ef007=_0x74a1[_0x31f8aa];return _0x5ef007;};'use strict';var MailMessageEvents=require(_0x174a('0x0'));var events=[_0x174a('0x1'),_0x174a('0x2'),'update'];function createListener(_0x1f349d,_0x245cd4){return function(_0x304b85){_0x245cd4[_0x174a('0x3')](_0x1f349d,_0x304b85);};}function removeListener(_0x511332,_0x4843c2){return function(){MailMessageEvents[_0x174a('0x4')](_0x511332,_0x4843c2);};}exports[_0x174a('0x5')]=function(_0x2e951e){for(var _0x76fd51=0x0,_0x29bef3=events['length'];_0x76fd51<_0x29bef3;_0x76fd51++){var _0x1761e4=events[_0x76fd51];var _0x40cbc2=createListener(_0x174a('0x6')+_0x1761e4,_0x2e951e);MailMessageEvents['on'](_0x1761e4,_0x40cbc2);}}; \ No newline at end of file +var _0xf4d2=['save','remove','update','removeListener','register','length','./mailMessage.events'];(function(_0x49c68e,_0x1c1673){var _0x33032b=function(_0x42ac31){while(--_0x42ac31){_0x49c68e['push'](_0x49c68e['shift']());}};_0x33032b(++_0x1c1673);}(_0xf4d2,0x1a3));var _0x2f4d=function(_0x330fc3,_0x312c1c){_0x330fc3=_0x330fc3-0x0;var _0x31acd7=_0xf4d2[_0x330fc3];return _0x31acd7;};'use strict';var MailMessageEvents=require(_0x2f4d('0x0'));var events=[_0x2f4d('0x1'),_0x2f4d('0x2'),_0x2f4d('0x3')];function createListener(_0x3f8b29,_0x351b78){return function(_0x41f492){_0x351b78['emit'](_0x3f8b29,_0x41f492);};}function removeListener(_0x3ddb16,_0x4d9dfb){return function(){MailMessageEvents[_0x2f4d('0x4')](_0x3ddb16,_0x4d9dfb);};}exports[_0x2f4d('0x5')]=function(_0x20b2d7){for(var _0x70aaf8=0x0,_0x5513d3=events[_0x2f4d('0x6')];_0x70aaf8<_0x5513d3;_0x70aaf8++){var _0xe1a84e=events[_0x70aaf8];var _0xf967e6=createListener('mailMessage:'+_0xe1a84e,_0x20b2d7);MailMessageEvents['on'](_0xe1a84e,_0xf967e6);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index a734d54..a5ef451 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 _0x85c6=['/:id/teams','getTeams','/:id/users','post','create','addTeams','addAgents','update','destroy','delete','removeTeams','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./mailQueue.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/members','getMembers'];(function(_0x410654,_0x261af9){var _0x514041=function(_0x4638a9){while(--_0x4638a9){_0x410654['push'](_0x410654['shift']());}};_0x514041(++_0x261af9);}(_0x85c6,0x98));var _0x685c=function(_0x15c124,_0x15bc08){_0x15c124=_0x15c124-0x0;var _0x27f3f0=_0x85c6[_0x15c124];return _0x27f3f0;};'use strict';var multer=require('multer');var util=require(_0x685c('0x0'));var path=require(_0x685c('0x1'));var timeout=require(_0x685c('0x2'));var express=require(_0x685c('0x3'));var router=express[_0x685c('0x4')]();var fs_extra=require(_0x685c('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x685c('0x6'));var config=require('../../config/environment');var controller=require(_0x685c('0x7'));router[_0x685c('0x8')]('/',auth[_0x685c('0x9')](),controller['index']);router['get'](_0x685c('0xa'),auth[_0x685c('0x9')](),controller[_0x685c('0xb')]);router[_0x685c('0x8')](_0x685c('0xc'),auth[_0x685c('0x9')](),controller[_0x685c('0xd')]);router['get'](_0x685c('0xe'),auth[_0x685c('0x9')](),controller[_0x685c('0xf')]);router['get'](_0x685c('0x10'),auth[_0x685c('0x9')](),controller[_0x685c('0x11')]);router[_0x685c('0x8')](_0x685c('0x12'),auth['isAuthenticated'](),controller['getAgents']);router[_0x685c('0x13')]('/',auth[_0x685c('0x9')](),controller[_0x685c('0x14')]);router[_0x685c('0x13')](_0x685c('0x10'),auth[_0x685c('0x9')](),controller[_0x685c('0x15')]);router[_0x685c('0x13')](_0x685c('0x12'),auth[_0x685c('0x9')](),controller[_0x685c('0x16')]);router['put'](_0x685c('0xc'),auth[_0x685c('0x9')](),controller[_0x685c('0x17')]);router['delete'](_0x685c('0xc'),auth[_0x685c('0x9')](),controller[_0x685c('0x18')]);router[_0x685c('0x19')]('/:id/teams',auth[_0x685c('0x9')](),controller[_0x685c('0x1a')]);router[_0x685c('0x19')]('/:id/users',auth[_0x685c('0x9')](),controller['removeAgents']);module[_0x685c('0x1b')]=router; \ No newline at end of file +var _0xf2fc=['multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailQueue.controller','get','isAuthenticated','index','/describe','/:id','show','getMembers','/:id/teams','getTeams','getAgents','post','addTeams','/:id/users','addAgents','put','delete','destroy','removeTeams','removeAgents','exports'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0xf2fc,0xae));var _0xcf2f=function(_0x31f6d2,_0x49129c){_0x31f6d2=_0x31f6d2-0x0;var _0xd9d2ba=_0xf2fc[_0x31f6d2];return _0xd9d2ba;};'use strict';var multer=require(_0xcf2f('0x0'));var util=require(_0xcf2f('0x1'));var path=require(_0xcf2f('0x2'));var timeout=require('connect-timeout');var express=require(_0xcf2f('0x3'));var router=express[_0xcf2f('0x4')]();var fs_extra=require(_0xcf2f('0x5'));var auth=require(_0xcf2f('0x6'));var interaction=require(_0xcf2f('0x7'));var config=require('../../config/environment');var controller=require(_0xcf2f('0x8'));router[_0xcf2f('0x9')]('/',auth[_0xcf2f('0xa')](),controller[_0xcf2f('0xb')]);router['get'](_0xcf2f('0xc'),auth[_0xcf2f('0xa')](),controller['describe']);router[_0xcf2f('0x9')](_0xcf2f('0xd'),auth[_0xcf2f('0xa')](),controller[_0xcf2f('0xe')]);router[_0xcf2f('0x9')]('/:id/members',auth['isAuthenticated'](),controller[_0xcf2f('0xf')]);router['get'](_0xcf2f('0x10'),auth[_0xcf2f('0xa')](),controller[_0xcf2f('0x11')]);router[_0xcf2f('0x9')]('/:id/users',auth[_0xcf2f('0xa')](),controller[_0xcf2f('0x12')]);router['post']('/',auth[_0xcf2f('0xa')](),controller['create']);router[_0xcf2f('0x13')](_0xcf2f('0x10'),auth['isAuthenticated'](),controller[_0xcf2f('0x14')]);router[_0xcf2f('0x13')](_0xcf2f('0x15'),auth[_0xcf2f('0xa')](),controller[_0xcf2f('0x16')]);router[_0xcf2f('0x17')](_0xcf2f('0xd'),auth[_0xcf2f('0xa')](),controller['update']);router[_0xcf2f('0x18')](_0xcf2f('0xd'),auth['isAuthenticated'](),controller[_0xcf2f('0x19')]);router[_0xcf2f('0x18')]('/:id/teams',auth[_0xcf2f('0xa')](),controller[_0xcf2f('0x1a')]);router['delete'](_0xcf2f('0x15'),auth[_0xcf2f('0xa')](),controller[_0xcf2f('0x1b')]);module[_0xcf2f('0x1c')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index b0e30d6..c53b7a9 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 _0x0d78=['exports','STRING','name','rrmemory','roundrobin'];(function(_0x4bcff9,_0x11806a){var _0x5b42e5=function(_0x37c2ed){while(--_0x37c2ed){_0x4bcff9['push'](_0x4bcff9['shift']());}};_0x5b42e5(++_0x11806a);}(_0x0d78,0xc3));var _0x80d7=function(_0xe4d35a,_0x4bd94d){_0xe4d35a=_0xe4d35a-0x0;var _0x249363=_0x0d78[_0xe4d35a];return _0x249363;};'use strict';var Sequelize=require('sequelize');module[_0x80d7('0x0')]={'name':{'type':Sequelize[_0x80d7('0x1')],'unique':_0x80d7('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x80d7('0x3'),'beepall',_0x80d7('0x4'))}}; \ No newline at end of file +var _0xe88e=['beepall','roundrobin','sequelize','exports','STRING','name','ENUM','rrmemory'];(function(_0x27413d,_0x1b480a){var _0x5e8108=function(_0x3f8a48){while(--_0x3f8a48){_0x27413d['push'](_0x27413d['shift']());}};_0x5e8108(++_0x1b480a);}(_0xe88e,0x1da));var _0xee88=function(_0x56ce7d,_0x57d050){_0x56ce7d=_0x56ce7d-0x0;var _0x72a880=_0xe88e[_0x56ce7d];return _0x72a880;};'use strict';var Sequelize=require(_0xee88('0x0'));module[_0xee88('0x1')]={'name':{'type':Sequelize[_0xee88('0x2')],'unique':_0xee88('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xee88('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xee88('0x4')](_0xee88('0x5'),_0xee88('0x6'),_0xee88('0x7'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 5aa7509..c0c5e08 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 _0x4f11=['mailPause','format','%s/%s','SIP','createdAt','updatedAt','getTeams','Team','hasOwnProperty','addTeams','ids','Agents','online','interface','flatMap','sequelize','transaction','findOrCreate','forEach','emit','removeTeams','User','select','field','tq.TeamId','from','team_has_mail_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','removeAgents','addAgents','omit','userMailQueue:save','isArray','userMailQueue:remove','getAgents','bluebird','util','lodash','squel','../../components/parsers/qs','../../config/logger','../../config/environment','redis','defaults','socket.io-emitter','./mailQueue.socket','register','sendStatus','status','end','json','offset','undefined','count','Content-Range','then','destroy','get','UserProfileResource','error','stack','name','send','index','map','MailQueue','rawAttributes','type','key','getOptions','where','include','findAll','rows','catch','show','params','model','query','keys','attributes','intersection','fields','length','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','MailQueues','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','describe','getMembers','findOne','filters','nolimit','limit','order','sort','pick','MailQueueId','filter','merge','UserMailQueue','findAndCountAll','UserId','agent'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4f11,0x1a7));var _0x14f1=function(_0x4c5279,_0x21aeb8){_0x4c5279=_0x4c5279-0x0;var _0x455832=_0x4f11[_0x4c5279];return _0x455832;};'use strict';var BPromise=require(_0x14f1('0x0'));var util=require(_0x14f1('0x1'));var _=require(_0x14f1('0x2'));var squel=require(_0x14f1('0x3'));var Redis=require('ioredis');var qs=require(_0x14f1('0x4'));var logger=require(_0x14f1('0x5'))('api');var config=require(_0x14f1('0x6'));var db=require('../../mysqldb')['db'];config[_0x14f1('0x7')]=_[_0x14f1('0x8')](config[_0x14f1('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0x14f1('0x9'))(new Redis(config[_0x14f1('0x7')]));require(_0x14f1('0xa'))[_0x14f1('0xb')](socket);function respondWithStatusCode(_0x39a31b,_0x2768a0){_0x2768a0=_0x2768a0||0xcc;return function(_0xf19e5d){if(_0xf19e5d){return _0x39a31b[_0x14f1('0xc')](_0x2768a0);}return _0x39a31b[_0x14f1('0xd')](_0x2768a0)[_0x14f1('0xe')]();};}function respondWithResult(_0x116bc3,_0x4b0055){_0x4b0055=_0x4b0055||0xc8;return function(_0x335776){if(_0x335776){return _0x116bc3['status'](_0x4b0055)[_0x14f1('0xf')](_0x335776);}};}function respondWithFilteredResult(_0x3131d0,_0x313b83){return function(_0x98651d){if(_0x98651d){var _0x22eddf=typeof _0x313b83[_0x14f1('0x10')]===_0x14f1('0x11')&&typeof _0x313b83['limit']===_0x14f1('0x11');var _0x53e6e0=_0x98651d[_0x14f1('0x12')];var _0x322fd1=_0x22eddf?0x0:_0x313b83['offset'];var _0x183597=_0x22eddf?_0x98651d[_0x14f1('0x12')]:_0x313b83['offset']+_0x313b83['limit'];var _0x531042;if(_0x183597>=_0x53e6e0){_0x183597=_0x53e6e0;_0x531042=0xc8;}else{_0x531042=0xce;}_0x3131d0[_0x14f1('0xd')](_0x531042);return _0x3131d0['set'](_0x14f1('0x13'),_0x322fd1+'-'+_0x183597+'/'+_0x53e6e0)[_0x14f1('0xf')](_0x98651d);}return null;};}function saveUpdates(_0x2c9b81){return function(_0x27ff18){if(_0x27ff18){return _0x27ff18['update'](_0x2c9b81)[_0x14f1('0x14')](function(_0x38f018){return _0x38f018;});}return null;};}function removeEntity(_0x164325){return function(_0x30e371){if(_0x30e371){return _0x30e371[_0x14f1('0x15')]()['then'](function(){var _0x1a667e=_0x30e371[_0x14f1('0x16')]({'plain':!![]});var _0x1f5df7='MailQueues';return db[_0x14f1('0x17')][_0x14f1('0x15')]({'where':{'type':_0x1f5df7,'resourceId':_0x1a667e['id']}})['then'](function(){return _0x30e371;});})[_0x14f1('0x14')](function(){_0x164325['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3f838d){return function(_0x238543){if(!_0x238543){_0x3f838d['sendStatus'](0x194);}return _0x238543;};}function handleError(_0x1f54a2,_0x134237){_0x134237=_0x134237||0x1f4;return function(_0x582c86){logger[_0x14f1('0x18')](_0x582c86[_0x14f1('0x19')]);if(_0x582c86[_0x14f1('0x1a')]){delete _0x582c86[_0x14f1('0x1a')];}_0x1f54a2[_0x14f1('0xd')](_0x134237)[_0x14f1('0x1b')](_0x582c86);};}exports[_0x14f1('0x1c')]=function(_0x1f45b0,_0x56992d){var _0x2cbba7={};var _0x321c64={'count':0x0,'rows':[]};var _0x3021ed=_[_0x14f1('0x1d')](db[_0x14f1('0x1e')][_0x14f1('0x1f')],function(_0x1898c4){return{'name':_0x1898c4['fieldName'],'type':_0x1898c4[_0x14f1('0x20')][_0x14f1('0x21')]};});_0x2cbba7=qs[_0x14f1('0x22')](_0x3021ed,_0x1f45b0);var _0x524829={'where':_0x2cbba7[_0x14f1('0x23')]};return db[_0x14f1('0x1e')][_0x14f1('0x12')](_0x524829)[_0x14f1('0x14')](function(_0x4520ae){_0x321c64[_0x14f1('0x12')]=_0x4520ae;_0x2cbba7[_0x14f1('0x24')]=qs['include'](_0x1f45b0['query']);return db['MailQueue'][_0x14f1('0x25')](_0x2cbba7);})['then'](function(_0x704b1){_0x321c64[_0x14f1('0x26')]=_0x704b1;return _0x321c64;})[_0x14f1('0x14')](respondWithFilteredResult(_0x56992d,_0x2cbba7))[_0x14f1('0x27')](handleError(_0x56992d,null));};exports[_0x14f1('0x28')]=function(_0x21ab42,_0x3510d5){var _0x21a4a3={'raw':!![],'where':{'id':_0x21ab42[_0x14f1('0x29')]['id']}},_0x40a829={};_0x40a829[_0x14f1('0x2a')]=_['keys'](db[_0x14f1('0x1e')][_0x14f1('0x1f')]);_0x40a829[_0x14f1('0x2b')]=_[_0x14f1('0x2c')](_0x21ab42[_0x14f1('0x2b')]);_0x40a829['filters']=_['intersection'](_0x40a829[_0x14f1('0x2a')],_0x40a829[_0x14f1('0x2b')]);_0x21a4a3[_0x14f1('0x2d')]=_[_0x14f1('0x2e')](_0x40a829['model'],qs[_0x14f1('0x2f')](_0x21ab42['query'][_0x14f1('0x2f')]));_0x21a4a3[_0x14f1('0x2d')]=_0x21a4a3[_0x14f1('0x2d')][_0x14f1('0x30')]?_0x21a4a3[_0x14f1('0x2d')]:_0x40a829[_0x14f1('0x2a')];if(_0x21ab42[_0x14f1('0x2b')]['includeAll']){_0x21a4a3['include']=[{'all':!![]}];}_0x21a4a3=_['merge']({},_0x21a4a3,_0x21ab42[_0x14f1('0x31')]);return db[_0x14f1('0x1e')][_0x14f1('0x32')](_0x21a4a3)[_0x14f1('0x14')](handleEntityNotFound(_0x3510d5,null))['then'](respondWithResult(_0x3510d5,null))[_0x14f1('0x27')](handleError(_0x3510d5,null));};exports['create']=function(_0x294165,_0x1b28b9){return db[_0x14f1('0x1e')][_0x14f1('0x33')](_0x294165['body'],{})[_0x14f1('0x14')](function(_0x407980){var _0x4b6fc6=_0x294165[_0x14f1('0x34')][_0x14f1('0x16')]({'plain':!![]});if(!_0x4b6fc6)throw new Error(_0x14f1('0x35'));if(_0x4b6fc6[_0x14f1('0x36')]===_0x14f1('0x34')){var _0x5a5bad=_0x407980[_0x14f1('0x16')]({'plain':!![]});var _0x5ddda1=_0x14f1('0x37');return db[_0x14f1('0x38')][_0x14f1('0x32')]({'where':{'name':_0x5ddda1,'userProfileId':_0x4b6fc6['userProfileId']},'raw':!![]})[_0x14f1('0x14')](function(_0x338a14){if(_0x338a14&&_0x338a14[_0x14f1('0x39')]===0x0){return db[_0x14f1('0x17')]['create']({'name':_0x5a5bad[_0x14f1('0x1a')],'resourceId':_0x5a5bad['id'],'type':_0x338a14[_0x14f1('0x1a')],'sectionId':_0x338a14['id']},{})[_0x14f1('0x14')](function(){return _0x407980;});}else{return _0x407980;}})[_0x14f1('0x27')](function(_0x2221d6){logger[_0x14f1('0x18')](_0x14f1('0x3a'),_0x2221d6);throw _0x2221d6;});}return _0x407980;})[_0x14f1('0x14')](respondWithResult(_0x1b28b9,0xc9))['catch'](handleError(_0x1b28b9,null));};exports[_0x14f1('0x3b')]=function(_0x276053,_0x58e42e){if(_0x276053['body']['id']){delete _0x276053[_0x14f1('0x3c')]['id'];}return db[_0x14f1('0x1e')][_0x14f1('0x32')]({'where':{'id':_0x276053['params']['id']}})[_0x14f1('0x14')](handleEntityNotFound(_0x58e42e,null))[_0x14f1('0x14')](saveUpdates(_0x276053[_0x14f1('0x3c')],null))[_0x14f1('0x14')](respondWithResult(_0x58e42e,null))[_0x14f1('0x27')](handleError(_0x58e42e,null));};exports[_0x14f1('0x15')]=function(_0x3b1ae9,_0x5fa62f){return db[_0x14f1('0x1e')][_0x14f1('0x32')]({'where':{'id':_0x3b1ae9['params']['id']}})[_0x14f1('0x14')](handleEntityNotFound(_0x5fa62f,null))['then'](removeEntity(_0x5fa62f,null))[_0x14f1('0x27')](handleError(_0x5fa62f,null));};exports[_0x14f1('0x3d')]=function(_0x32d842,_0x5a7894){return db[_0x14f1('0x1e')][_0x14f1('0x3d')]()[_0x14f1('0x14')](respondWithResult(_0x5a7894,null))[_0x14f1('0x27')](handleError(_0x5a7894,null));};exports[_0x14f1('0x3e')]=function(_0x1400f8,_0x14ba3d){var _0x5d7fe2={'raw':!![],'where':{}},_0x358af5={},_0x2f4f0b;return db[_0x14f1('0x1e')][_0x14f1('0x3f')]({'where':{'id':_0x1400f8['params']['id']}})[_0x14f1('0x14')](handleEntityNotFound(_0x14ba3d,null))[_0x14f1('0x14')](function(_0x28d023){if(_0x28d023){_0x2f4f0b=_0x28d023[_0x14f1('0x16')]({'plain':!![]});_0x358af5[_0x14f1('0x2a')]=_[_0x14f1('0x2c')](db['UserMailQueue']['rawAttributes']);_0x358af5[_0x14f1('0x2b')]=_[_0x14f1('0x2c')](_0x1400f8['query']);_0x358af5[_0x14f1('0x40')]=_[_0x14f1('0x2e')](_0x358af5[_0x14f1('0x2a')],_0x358af5[_0x14f1('0x2b')]);_0x5d7fe2[_0x14f1('0x2d')]=_[_0x14f1('0x2e')](_0x358af5['model'],qs[_0x14f1('0x2f')](_0x1400f8[_0x14f1('0x2b')]['fields']));_0x5d7fe2[_0x14f1('0x2d')]=_0x5d7fe2[_0x14f1('0x2d')][_0x14f1('0x30')]?_0x5d7fe2['attributes']:_0x358af5['model'];if(!_0x1400f8[_0x14f1('0x2b')]['hasOwnProperty'](_0x14f1('0x41'))){_0x5d7fe2[_0x14f1('0x42')]=qs[_0x14f1('0x42')](_0x1400f8[_0x14f1('0x2b')][_0x14f1('0x42')]);_0x5d7fe2[_0x14f1('0x10')]=qs['offset'](_0x1400f8[_0x14f1('0x2b')][_0x14f1('0x10')]);}_0x5d7fe2[_0x14f1('0x43')]=qs[_0x14f1('0x44')](_0x1400f8[_0x14f1('0x2b')][_0x14f1('0x44')]);_0x5d7fe2[_0x14f1('0x23')]=qs[_0x14f1('0x40')](_[_0x14f1('0x45')](_0x1400f8[_0x14f1('0x2b')],_0x358af5[_0x14f1('0x40')]));_0x5d7fe2[_0x14f1('0x23')][_0x14f1('0x46')]=_0x28d023['id'];if(_0x1400f8[_0x14f1('0x2b')][_0x14f1('0x47')]){_0x5d7fe2[_0x14f1('0x23')]=_['merge'](_0x5d7fe2['where'],{'$or':_[_0x14f1('0x1d')](_0x5d7fe2['attributes'],function(_0x337822){var _0x2b05ca={};_0x2b05ca[_0x337822]={'$like':'%'+_0x1400f8[_0x14f1('0x2b')]['filter']+'%'};return _0x2b05ca;})});}_0x5d7fe2=_[_0x14f1('0x48')]({},_0x5d7fe2,_0x1400f8[_0x14f1('0x31')]);return db[_0x14f1('0x49')][_0x14f1('0x25')](_0x5d7fe2);}})[_0x14f1('0x14')](function(_0x3a7d72){if(_0x3a7d72){return db['User'][_0x14f1('0x4a')]({'where':{'id':_[_0x14f1('0x1d')](_0x3a7d72,_0x14f1('0x4b')),'role':_0x14f1('0x4c')},'attributes':['id',_0x14f1('0x1a'),_0x14f1('0x4d'),'updatedAt','createdAt']});}})[_0x14f1('0x14')](function(_0x2adfc2){if(_0x2adfc2){return{'count':_0x2adfc2[_0x14f1('0x12')],'rows':_[_0x14f1('0x1d')](_0x2adfc2[_0x14f1('0x26')],function(_0x3196a9){return{'membername':_0x3196a9[_0x14f1('0x1a')],'UserId':_0x3196a9['id'],'queue_name':_0x2f4f0b[_0x14f1('0x1a')],'MailQueueId':_0x2f4f0b['id'],'interface':util[_0x14f1('0x4e')](_0x14f1('0x4f'),_0x14f1('0x50'),_0x3196a9['name']),'penalty':0x0,'paused':_0x3196a9[_0x14f1('0x4d')],'createdAt':_0x3196a9[_0x14f1('0x51')],'updatedAt':_0x3196a9[_0x14f1('0x52')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x14f1('0x14')](respondWithFilteredResult(_0x14ba3d,_0x5d7fe2))[_0x14f1('0x27')](handleError(_0x14ba3d,null));};exports[_0x14f1('0x53')]=function(_0x302d28,_0xb3dfcb){var _0x2e88a0={};var _0x4d3159={};var _0x13dc70;var _0x4aa762;return db['MailQueue'][_0x14f1('0x3f')]({'where':{'id':_0x302d28[_0x14f1('0x29')]['id']}})[_0x14f1('0x14')](handleEntityNotFound(_0xb3dfcb,null))[_0x14f1('0x14')](function(_0x2a7a60){if(_0x2a7a60){_0x13dc70=_0x2a7a60;_0x4d3159[_0x14f1('0x2a')]=_['keys'](db[_0x14f1('0x54')][_0x14f1('0x1f')]);_0x4d3159['query']=_['keys'](_0x302d28[_0x14f1('0x2b')]);_0x4d3159[_0x14f1('0x40')]=_[_0x14f1('0x2e')](_0x4d3159['model'],_0x4d3159[_0x14f1('0x2b')]);_0x2e88a0[_0x14f1('0x2d')]=_[_0x14f1('0x2e')](_0x4d3159[_0x14f1('0x2a')],qs[_0x14f1('0x2f')](_0x302d28[_0x14f1('0x2b')][_0x14f1('0x2f')]));_0x2e88a0[_0x14f1('0x2d')]=_0x2e88a0[_0x14f1('0x2d')][_0x14f1('0x30')]?_0x2e88a0[_0x14f1('0x2d')]:_0x4d3159[_0x14f1('0x2a')];_0x2e88a0[_0x14f1('0x43')]=qs[_0x14f1('0x44')](_0x302d28[_0x14f1('0x2b')][_0x14f1('0x44')]);_0x2e88a0[_0x14f1('0x23')]=qs[_0x14f1('0x40')](_['pick'](_0x302d28['query'],_0x4d3159[_0x14f1('0x40')]));if(_0x302d28[_0x14f1('0x2b')]['filter']){_0x2e88a0['where']=_[_0x14f1('0x48')](_0x2e88a0[_0x14f1('0x23')],{'$or':_[_0x14f1('0x1d')](_0x2e88a0['attributes'],function(_0x1b88ea){var _0x4d1b4d={};_0x4d1b4d[_0x1b88ea]={'$like':'%'+_0x302d28['query'][_0x14f1('0x47')]+'%'};return _0x4d1b4d;})});}_0x2e88a0=_[_0x14f1('0x48')]({},_0x2e88a0,_0x302d28[_0x14f1('0x31')]);return _0x13dc70['getTeams'](_0x2e88a0);}})['then'](function(_0x239fa1){if(_0x239fa1){_0x4aa762=_0x239fa1[_0x14f1('0x30')];if(!_0x302d28[_0x14f1('0x2b')][_0x14f1('0x55')]('nolimit')){_0x2e88a0[_0x14f1('0x42')]=qs['limit'](_0x302d28[_0x14f1('0x2b')]['limit']);_0x2e88a0[_0x14f1('0x10')]=qs[_0x14f1('0x10')](_0x302d28[_0x14f1('0x2b')][_0x14f1('0x10')]);}return _0x13dc70[_0x14f1('0x53')](_0x2e88a0);}})[_0x14f1('0x14')](function(_0x2fd510){if(_0x2fd510){return _0x2fd510?{'count':_0x4aa762,'rows':_0x2fd510}:null;}})[_0x14f1('0x14')](respondWithResult(_0xb3dfcb,null))['catch'](handleError(_0xb3dfcb,null));};exports[_0x14f1('0x56')]=function(_0x4c6f6a,_0x3eec03){var _0x53bdd4=_0x4c6f6a[_0x14f1('0x3c')][_0x14f1('0x57')];return db[_0x14f1('0x54')]['findAll']({'where':{'id':_0x53bdd4},'attributes':['id'],'include':[{'model':db['User'],'as':_0x14f1('0x58'),'attributes':['id',_0x14f1('0x1a'),_0x14f1('0x59'),'voicePause',_0x14f1('0x5a')],'raw':!![]}]})[_0x14f1('0x14')](function(_0x3e07e0){if(_0x3e07e0){var _0x4e52f7=_[_0x14f1('0x5b')](_0x3e07e0,function(_0x29ab26){var _0x2518f9=_0x29ab26[_0x14f1('0x16')]({'plain':!![]});return _0x2518f9['Agents'];});return db[_0x14f1('0x1e')]['find']({'where':{'id':_0x4c6f6a['params']['id']}})['then'](function(_0x5288f6){return db[_0x14f1('0x5c')][_0x14f1('0x5d')](function(_0x5e2799){return _0x5288f6[_0x14f1('0x56')](_0x53bdd4,{'transaction':_0x5e2799})[_0x14f1('0x14')](function(){return BPromise['each'](_0x4e52f7,function(_0x1fcc67){return db['UserMailQueue'][_0x14f1('0x5e')]({'where':{'UserId':_0x1fcc67['id'],'MailQueueId':_0x4c6f6a[_0x14f1('0x29')]['id']},'transaction':_0x5e2799});});})[_0x14f1('0x14')](function(){_0x4e52f7[_0x14f1('0x5f')](function(_0x451e1a){socket[_0x14f1('0x60')]('userMailQueue:save',{'UserId':_0x451e1a['id'],'MailQueueId':_0x5288f6['id']});});});});});}})[_0x14f1('0x14')](respondWithStatusCode(_0x3eec03,null))[_0x14f1('0x27')](handleError(_0x3eec03,null));};exports[_0x14f1('0x61')]=function(_0x1e82d2,_0x43ca8){return db[_0x14f1('0x54')][_0x14f1('0x25')]({'where':{'id':_0x1e82d2[_0x14f1('0x2b')]['ids']},'attributes':['id'],'include':[{'model':db[_0x14f1('0x62')],'as':_0x14f1('0x58'),'attributes':['id'],'raw':!![]}]})[_0x14f1('0x14')](handleEntityNotFound(_0x43ca8,null))[_0x14f1('0x14')](function(_0x3ccc14){var _0x4e34ba=_['map'](_0x3ccc14,'id');var _0x445d57=[];var _0x5c7930=[];var _0x279fb2=squel[_0x14f1('0x63')]();_0x279fb2[_0x14f1('0x64')](_0x14f1('0x65'))[_0x14f1('0x66')](_0x14f1('0x67'),'tq')[_0x14f1('0x68')](_0x14f1('0x69'),'ut',_0x14f1('0x6a'))['where']('MailQueueId\x20=\x20?',_0x1e82d2[_0x14f1('0x29')]['id']);for(var _0x211055=0x0;_0x211055<_0x3ccc14[_0x14f1('0x30')];_0x211055+=0x1){let _0xe92124=_0x3ccc14[_0x211055];for(var _0x1c1999=0x0;_0x1c1999<_0xe92124['Agents'][_0x14f1('0x30')];_0x1c1999+=0x1){let _0xa7dcc7=_0xe92124[_0x14f1('0x58')][_0x1c1999];var _0x5c67bb=_0x279fb2[_0x14f1('0x6b')]();_0x5c67bb[_0x14f1('0x23')](_0x14f1('0x6c'),_0xa7dcc7['id']);_0x5c7930[_0x14f1('0x6d')](db[_0x14f1('0x5c')]['query'](_0x5c67bb[_0x14f1('0x6e')](),{'type':db['sequelize'][_0x14f1('0x6f')][_0x14f1('0x70')]})[_0x14f1('0x14')](function(_0x4efeda){if(_0x4efeda['length']===0x1){return _0xa7dcc7['id'];}else{var _0x2b1730=_[_0x14f1('0x71')](_[_0x14f1('0x1d')](_0x4efeda,_0x14f1('0x72')),function(_0x2ffee1){return _[_0x14f1('0x73')](_0x4e34ba,_0x2ffee1);});if(_0x2b1730){return _0xa7dcc7['id'];}}}));}}return BPromise[_0x14f1('0x74')](_0x5c7930)[_0x14f1('0x14')](function(_0xa04450){_0x445d57=_(_0x445d57)[_0x14f1('0x75')](_0xa04450)['compact']()['value']();return db[_0x14f1('0x1e')][_0x14f1('0x32')]({'where':{'id':_0x1e82d2['params']['id']}})[_0x14f1('0x14')](function(_0x45717f){return db[_0x14f1('0x5c')][_0x14f1('0x5d')](function(_0x4a5520){return _0x45717f[_0x14f1('0x61')](_0x1e82d2[_0x14f1('0x2b')]['ids'],{'transaction':_0x4a5520})[_0x14f1('0x14')](function(){if(!_['isEmpty'](_0x445d57)){return _0x45717f[_0x14f1('0x76')](_0x445d57,{'transaction':_0x4a5520});}})[_0x14f1('0x14')](function(){_0x445d57[_0x14f1('0x5f')](function(_0x2b95cf){socket[_0x14f1('0x60')]('userMailQueue:remove',{'UserId':_0x2b95cf,'MailQueueId':_0x45717f['id']});});});});});});})['then'](respondWithStatusCode(_0x43ca8,null))[_0x14f1('0x27')](handleError(_0x43ca8,null));};exports[_0x14f1('0x77')]=function(_0xeb48b2,_0x2e395e){return db[_0x14f1('0x1e')][_0x14f1('0x32')]({'where':{'id':_0xeb48b2['params']['id']}})[_0x14f1('0x14')](handleEntityNotFound(_0x2e395e,null))[_0x14f1('0x14')](function(_0x5d74a1){if(_0x5d74a1){return _0x5d74a1[_0x14f1('0x77')](_0xeb48b2[_0x14f1('0x3c')][_0x14f1('0x57')],_[_0x14f1('0x78')](_0xeb48b2[_0x14f1('0x3c')],[_0x14f1('0x57'),'id'])||{})['spread'](function(_0x29f479){for(var _0x539ae2=0x0;_0x539ae2<_0xeb48b2[_0x14f1('0x3c')][_0x14f1('0x57')][_0x14f1('0x30')];_0x539ae2+=0x1){socket[_0x14f1('0x60')](_0x14f1('0x79'),{'UserId':Number(_0xeb48b2[_0x14f1('0x3c')][_0x14f1('0x57')][_0x539ae2]),'MailQueueId':Number(_0xeb48b2['params']['id'])});}return _0x29f479;});}})['then'](respondWithResult(_0x2e395e,null))[_0x14f1('0x27')](handleError(_0x2e395e,null));};exports[_0x14f1('0x76')]=function(_0x131e7d,_0x562e0c){return db['MailQueue'][_0x14f1('0x32')]({'where':{'id':_0x131e7d[_0x14f1('0x29')]['id']}})[_0x14f1('0x14')](handleEntityNotFound(_0x562e0c,null))['then'](function(_0x11f865){if(_0x11f865){return _0x11f865[_0x14f1('0x76')](_0x131e7d[_0x14f1('0x2b')][_0x14f1('0x57')])[_0x14f1('0x14')](function(){if(_[_0x14f1('0x7a')](_0x131e7d[_0x14f1('0x2b')]['ids'])){for(var _0x5ab809=0x0;_0x5ab809<_0x131e7d[_0x14f1('0x2b')][_0x14f1('0x57')]['length'];_0x5ab809+=0x1){socket[_0x14f1('0x60')](_0x14f1('0x7b'),{'UserId':Number(_0x131e7d[_0x14f1('0x2b')][_0x14f1('0x57')][_0x5ab809]),'MailQueueId':Number(_0x131e7d[_0x14f1('0x29')]['id'])});}}else{socket[_0x14f1('0x60')](_0x14f1('0x7b'),{'UserId':Number(_0x131e7d[_0x14f1('0x2b')][_0x14f1('0x57')]),'MailQueueId':Number(_0x131e7d[_0x14f1('0x29')]['id'])});}});}})[_0x14f1('0x14')](respondWithStatusCode(_0x562e0c,null))[_0x14f1('0x27')](handleError(_0x562e0c,null));};exports['getAgents']=function(_0x266f96,_0x10273c){var _0x321ac5={};var _0x4b9041={};var _0x3c9002;var _0x33de7d;return db['MailQueue'][_0x14f1('0x3f')]({'where':{'id':_0x266f96[_0x14f1('0x29')]['id']}})[_0x14f1('0x14')](handleEntityNotFound(_0x10273c,null))[_0x14f1('0x14')](function(_0x5c159b){if(_0x5c159b){_0x3c9002=_0x5c159b;_0x4b9041[_0x14f1('0x2a')]=_[_0x14f1('0x2c')](db[_0x14f1('0x62')][_0x14f1('0x1f')]);_0x4b9041[_0x14f1('0x2b')]=_[_0x14f1('0x2c')](_0x266f96[_0x14f1('0x2b')]);_0x4b9041['filters']=_['intersection'](_0x4b9041[_0x14f1('0x2a')],_0x4b9041[_0x14f1('0x2b')]);_0x321ac5['attributes']=_[_0x14f1('0x2e')](_0x4b9041[_0x14f1('0x2a')],qs[_0x14f1('0x2f')](_0x266f96['query'][_0x14f1('0x2f')]));_0x321ac5[_0x14f1('0x2d')]=_0x321ac5[_0x14f1('0x2d')][_0x14f1('0x30')]?_0x321ac5[_0x14f1('0x2d')]:_0x4b9041['model'];_0x321ac5[_0x14f1('0x43')]=qs[_0x14f1('0x44')](_0x266f96[_0x14f1('0x2b')][_0x14f1('0x44')]);_0x321ac5[_0x14f1('0x23')]=qs['filters'](_[_0x14f1('0x45')](_0x266f96['query'],_0x4b9041[_0x14f1('0x40')]));if(_0x266f96[_0x14f1('0x2b')][_0x14f1('0x47')]){_0x321ac5[_0x14f1('0x23')]=_[_0x14f1('0x48')](_0x321ac5['where'],{'$or':_[_0x14f1('0x1d')](_0x321ac5[_0x14f1('0x2d')],function(_0x4ed7f0){var _0x49fa35={};_0x49fa35[_0x4ed7f0]={'$like':'%'+_0x266f96[_0x14f1('0x2b')][_0x14f1('0x47')]+'%'};return _0x49fa35;})});}_0x321ac5=_[_0x14f1('0x48')]({},_0x321ac5,_0x266f96[_0x14f1('0x31')]);return _0x3c9002[_0x14f1('0x7c')](_0x321ac5);}})['then'](function(_0x5629a2){if(_0x5629a2){_0x33de7d=_0x5629a2[_0x14f1('0x30')];if(!_0x266f96['query'][_0x14f1('0x55')](_0x14f1('0x41'))){_0x321ac5['limit']=qs[_0x14f1('0x42')](_0x266f96['query'][_0x14f1('0x42')]);_0x321ac5[_0x14f1('0x10')]=qs[_0x14f1('0x10')](_0x266f96[_0x14f1('0x2b')][_0x14f1('0x10')]);}return _0x3c9002[_0x14f1('0x7c')](_0x321ac5);}})['then'](function(_0x272cc7){if(_0x272cc7){return _0x272cc7?{'count':_0x33de7d,'rows':_0x272cc7}:null;}})['then'](respondWithResult(_0x10273c,null))[_0x14f1('0x27')](handleError(_0x10273c,null));}; \ No newline at end of file +var _0x8429=['nolimit','limit','order','sort','MailQueueId','filter','User','agent','mailPause','updatedAt','createdAt','rows','format','%s/%s','SIP','getTeams','findOne','Team','pick','addTeams','ids','Agents','online','voicePause','each','findOrCreate','forEach','userMailQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_mail_queues','join','user_has_teams','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','sequelize','toString','SELECT','every','TeamId','includes','compact','value','transaction','removeAgents','emit','addAgents','omit','spread','isArray','userMailQueue:remove','getAgents','util','lodash','ioredis','../../components/parsers/qs','../../config/logger','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','update','then','destroy','get','error','stack','name','send','index','map','rawAttributes','fieldName','getOptions','where','include','query','MailQueue','findAll','catch','show','params','model','keys','intersection','fields','attributes','length','merge','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','UserMailQueue','filters','hasOwnProperty'];(function(_0x2a9197,_0x5225eb){var _0x588c8a=function(_0x4698ee){while(--_0x4698ee){_0x2a9197['push'](_0x2a9197['shift']());}};_0x588c8a(++_0x5225eb);}(_0x8429,0x19b));var _0x9842=function(_0x5d0a9f,_0x7fc835){_0x5d0a9f=_0x5d0a9f-0x0;var _0x898cc6=_0x8429[_0x5d0a9f];return _0x898cc6;};'use strict';var BPromise=require('bluebird');var util=require(_0x9842('0x0'));var _=require(_0x9842('0x1'));var squel=require('squel');var Redis=require(_0x9842('0x2'));var qs=require(_0x9842('0x3'));var logger=require(_0x9842('0x4'))('api');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x9842('0x5')]=_[_0x9842('0x6')](config['redis'],{'host':_0x9842('0x7'),'port':0x18eb});var socket=require(_0x9842('0x8'))(new Redis(config[_0x9842('0x5')]));require(_0x9842('0x9'))['register'](socket);function respondWithStatusCode(_0x14fbdc,_0x1b8fcf){_0x1b8fcf=_0x1b8fcf||0xcc;return function(_0x1b0718){if(_0x1b0718){return _0x14fbdc[_0x9842('0xa')](_0x1b8fcf);}return _0x14fbdc[_0x9842('0xb')](_0x1b8fcf)[_0x9842('0xc')]();};}function respondWithResult(_0x3c5028,_0x29d715){_0x29d715=_0x29d715||0xc8;return function(_0x505eb7){if(_0x505eb7){return _0x3c5028[_0x9842('0xb')](_0x29d715)[_0x9842('0xd')](_0x505eb7);}};}function respondWithFilteredResult(_0x4f8968,_0x2186bf){return function(_0x86a78d){if(_0x86a78d){var _0x530376=typeof _0x2186bf[_0x9842('0xe')]===_0x9842('0xf')&&typeof _0x2186bf['limit']===_0x9842('0xf');var _0x218ec2=_0x86a78d[_0x9842('0x10')];var _0x4d4124=_0x530376?0x0:_0x2186bf[_0x9842('0xe')];var _0x660053=_0x530376?_0x86a78d[_0x9842('0x10')]:_0x2186bf['offset']+_0x2186bf['limit'];var _0x1ba22e;if(_0x660053>=_0x218ec2){_0x660053=_0x218ec2;_0x1ba22e=0xc8;}else{_0x1ba22e=0xce;}_0x4f8968[_0x9842('0xb')](_0x1ba22e);return _0x4f8968[_0x9842('0x11')](_0x9842('0x12'),_0x4d4124+'-'+_0x660053+'/'+_0x218ec2)[_0x9842('0xd')](_0x86a78d);}return null;};}function saveUpdates(_0x368c3c){return function(_0x4f5421){if(_0x4f5421){return _0x4f5421[_0x9842('0x13')](_0x368c3c)[_0x9842('0x14')](function(_0x5c3f3c){return _0x5c3f3c;});}return null;};}function removeEntity(_0x5cbd12){return function(_0x301a13){if(_0x301a13){return _0x301a13[_0x9842('0x15')]()['then'](function(){var _0x1437a1=_0x301a13[_0x9842('0x16')]({'plain':!![]});var _0x1c3522='MailQueues';return db['UserProfileResource'][_0x9842('0x15')]({'where':{'type':_0x1c3522,'resourceId':_0x1437a1['id']}})[_0x9842('0x14')](function(){return _0x301a13;});})[_0x9842('0x14')](function(){_0x5cbd12[_0x9842('0xb')](0xcc)['end']();});}};}function handleEntityNotFound(_0x17e6f7){return function(_0x41ee17){if(!_0x41ee17){_0x17e6f7[_0x9842('0xa')](0x194);}return _0x41ee17;};}function handleError(_0x1d3784,_0x55ceef){_0x55ceef=_0x55ceef||0x1f4;return function(_0x536e48){logger[_0x9842('0x17')](_0x536e48[_0x9842('0x18')]);if(_0x536e48['name']){delete _0x536e48[_0x9842('0x19')];}_0x1d3784[_0x9842('0xb')](_0x55ceef)[_0x9842('0x1a')](_0x536e48);};}exports[_0x9842('0x1b')]=function(_0x231add,_0x8f56b6){var _0x33c0c5={};var _0x26131d={'count':0x0,'rows':[]};var _0x4bc3ac=_[_0x9842('0x1c')](db['MailQueue'][_0x9842('0x1d')],function(_0x69f1a8){return{'name':_0x69f1a8[_0x9842('0x1e')],'type':_0x69f1a8['type']['key']};});_0x33c0c5=qs[_0x9842('0x1f')](_0x4bc3ac,_0x231add);var _0x56f47f={'where':_0x33c0c5[_0x9842('0x20')]};return db['MailQueue'][_0x9842('0x10')](_0x56f47f)[_0x9842('0x14')](function(_0x59d17e){_0x26131d[_0x9842('0x10')]=_0x59d17e;_0x33c0c5[_0x9842('0x21')]=qs[_0x9842('0x21')](_0x231add[_0x9842('0x22')]);return db[_0x9842('0x23')][_0x9842('0x24')](_0x33c0c5);})[_0x9842('0x14')](function(_0xf142c7){_0x26131d['rows']=_0xf142c7;return _0x26131d;})['then'](respondWithFilteredResult(_0x8f56b6,_0x33c0c5))[_0x9842('0x25')](handleError(_0x8f56b6,null));};exports[_0x9842('0x26')]=function(_0x170eea,_0x46b0a1){var _0x5b08bd={'raw':!![],'where':{'id':_0x170eea[_0x9842('0x27')]['id']}},_0x54fea8={};_0x54fea8[_0x9842('0x28')]=_[_0x9842('0x29')](db[_0x9842('0x23')][_0x9842('0x1d')]);_0x54fea8[_0x9842('0x22')]=_['keys'](_0x170eea[_0x9842('0x22')]);_0x54fea8['filters']=_['intersection'](_0x54fea8[_0x9842('0x28')],_0x54fea8[_0x9842('0x22')]);_0x5b08bd['attributes']=_[_0x9842('0x2a')](_0x54fea8[_0x9842('0x28')],qs[_0x9842('0x2b')](_0x170eea[_0x9842('0x22')]['fields']));_0x5b08bd[_0x9842('0x2c')]=_0x5b08bd[_0x9842('0x2c')][_0x9842('0x2d')]?_0x5b08bd[_0x9842('0x2c')]:_0x54fea8['model'];if(_0x170eea['query']['includeAll']){_0x5b08bd[_0x9842('0x21')]=[{'all':!![]}];}_0x5b08bd=_[_0x9842('0x2e')]({},_0x5b08bd,_0x170eea[_0x9842('0x2f')]);return db[_0x9842('0x23')][_0x9842('0x30')](_0x5b08bd)[_0x9842('0x14')](handleEntityNotFound(_0x46b0a1,null))[_0x9842('0x14')](respondWithResult(_0x46b0a1,null))[_0x9842('0x25')](handleError(_0x46b0a1,null));};exports[_0x9842('0x31')]=function(_0x4fcaf6,_0x1eab7f){return db['MailQueue']['create'](_0x4fcaf6[_0x9842('0x32')],{})[_0x9842('0x14')](function(_0x1f9d63){var _0x3f4a95=_0x4fcaf6[_0x9842('0x33')][_0x9842('0x16')]({'plain':!![]});if(!_0x3f4a95)throw new Error(_0x9842('0x34'));if(_0x3f4a95[_0x9842('0x35')]===_0x9842('0x33')){var _0x30270e=_0x1f9d63['get']({'plain':!![]});var _0x4be62d='MailQueues';return db['UserProfileSection'][_0x9842('0x30')]({'where':{'name':_0x4be62d,'userProfileId':_0x3f4a95['userProfileId']},'raw':!![]})[_0x9842('0x14')](function(_0x3a075a){if(_0x3a075a&&_0x3a075a[_0x9842('0x36')]===0x0){return db[_0x9842('0x37')][_0x9842('0x31')]({'name':_0x30270e[_0x9842('0x19')],'resourceId':_0x30270e['id'],'type':_0x3a075a['name'],'sectionId':_0x3a075a['id']},{})[_0x9842('0x14')](function(){return _0x1f9d63;});}else{return _0x1f9d63;}})[_0x9842('0x25')](function(_0xc848b6){logger[_0x9842('0x17')](_0x9842('0x38'),_0xc848b6);throw _0xc848b6;});}return _0x1f9d63;})['then'](respondWithResult(_0x1eab7f,0xc9))['catch'](handleError(_0x1eab7f,null));};exports[_0x9842('0x13')]=function(_0x2a3d26,_0x57c818){if(_0x2a3d26[_0x9842('0x32')]['id']){delete _0x2a3d26[_0x9842('0x32')]['id'];}return db[_0x9842('0x23')]['find']({'where':{'id':_0x2a3d26[_0x9842('0x27')]['id']}})[_0x9842('0x14')](handleEntityNotFound(_0x57c818,null))[_0x9842('0x14')](saveUpdates(_0x2a3d26[_0x9842('0x32')],null))['then'](respondWithResult(_0x57c818,null))[_0x9842('0x25')](handleError(_0x57c818,null));};exports[_0x9842('0x15')]=function(_0x2bad06,_0x3d528b){return db[_0x9842('0x23')][_0x9842('0x30')]({'where':{'id':_0x2bad06[_0x9842('0x27')]['id']}})[_0x9842('0x14')](handleEntityNotFound(_0x3d528b,null))[_0x9842('0x14')](removeEntity(_0x3d528b,null))[_0x9842('0x25')](handleError(_0x3d528b,null));};exports[_0x9842('0x39')]=function(_0x129a37,_0x1c0e14){return db['MailQueue'][_0x9842('0x39')]()[_0x9842('0x14')](respondWithResult(_0x1c0e14,null))['catch'](handleError(_0x1c0e14,null));};exports['getMembers']=function(_0x4fdac2,_0x276324){var _0x5f3e3f={'raw':!![],'where':{}},_0x2e11b0={},_0x4dd8eb;return db[_0x9842('0x23')]['findOne']({'where':{'id':_0x4fdac2[_0x9842('0x27')]['id']}})['then'](handleEntityNotFound(_0x276324,null))[_0x9842('0x14')](function(_0x500527){if(_0x500527){_0x4dd8eb=_0x500527[_0x9842('0x16')]({'plain':!![]});_0x2e11b0['model']=_['keys'](db[_0x9842('0x3a')][_0x9842('0x1d')]);_0x2e11b0['query']=_[_0x9842('0x29')](_0x4fdac2[_0x9842('0x22')]);_0x2e11b0[_0x9842('0x3b')]=_[_0x9842('0x2a')](_0x2e11b0[_0x9842('0x28')],_0x2e11b0[_0x9842('0x22')]);_0x5f3e3f[_0x9842('0x2c')]=_['intersection'](_0x2e11b0[_0x9842('0x28')],qs[_0x9842('0x2b')](_0x4fdac2[_0x9842('0x22')][_0x9842('0x2b')]));_0x5f3e3f[_0x9842('0x2c')]=_0x5f3e3f[_0x9842('0x2c')][_0x9842('0x2d')]?_0x5f3e3f[_0x9842('0x2c')]:_0x2e11b0[_0x9842('0x28')];if(!_0x4fdac2[_0x9842('0x22')][_0x9842('0x3c')](_0x9842('0x3d'))){_0x5f3e3f[_0x9842('0x3e')]=qs[_0x9842('0x3e')](_0x4fdac2[_0x9842('0x22')]['limit']);_0x5f3e3f[_0x9842('0xe')]=qs['offset'](_0x4fdac2[_0x9842('0x22')][_0x9842('0xe')]);}_0x5f3e3f[_0x9842('0x3f')]=qs[_0x9842('0x40')](_0x4fdac2[_0x9842('0x22')][_0x9842('0x40')]);_0x5f3e3f[_0x9842('0x20')]=qs[_0x9842('0x3b')](_['pick'](_0x4fdac2[_0x9842('0x22')],_0x2e11b0[_0x9842('0x3b')]));_0x5f3e3f[_0x9842('0x20')][_0x9842('0x41')]=_0x500527['id'];if(_0x4fdac2[_0x9842('0x22')][_0x9842('0x42')]){_0x5f3e3f['where']=_[_0x9842('0x2e')](_0x5f3e3f[_0x9842('0x20')],{'$or':_[_0x9842('0x1c')](_0x5f3e3f['attributes'],function(_0x31ef57){var _0x33fd71={};_0x33fd71[_0x31ef57]={'$like':'%'+_0x4fdac2[_0x9842('0x22')][_0x9842('0x42')]+'%'};return _0x33fd71;})});}_0x5f3e3f=_['merge']({},_0x5f3e3f,_0x4fdac2[_0x9842('0x2f')]);return db[_0x9842('0x3a')][_0x9842('0x24')](_0x5f3e3f);}})[_0x9842('0x14')](function(_0x144c82){if(_0x144c82){return db[_0x9842('0x43')]['findAndCountAll']({'where':{'id':_[_0x9842('0x1c')](_0x144c82,'UserId'),'role':_0x9842('0x44')},'attributes':['id',_0x9842('0x19'),_0x9842('0x45'),_0x9842('0x46'),_0x9842('0x47')]});}})[_0x9842('0x14')](function(_0x12334d){if(_0x12334d){return{'count':_0x12334d[_0x9842('0x10')],'rows':_[_0x9842('0x1c')](_0x12334d[_0x9842('0x48')],function(_0xb46b49){return{'membername':_0xb46b49[_0x9842('0x19')],'UserId':_0xb46b49['id'],'queue_name':_0x4dd8eb[_0x9842('0x19')],'MailQueueId':_0x4dd8eb['id'],'interface':util[_0x9842('0x49')](_0x9842('0x4a'),_0x9842('0x4b'),_0xb46b49[_0x9842('0x19')]),'penalty':0x0,'paused':_0xb46b49[_0x9842('0x45')],'createdAt':_0xb46b49[_0x9842('0x47')],'updatedAt':_0xb46b49[_0x9842('0x46')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x276324,_0x5f3e3f))[_0x9842('0x25')](handleError(_0x276324,null));};exports[_0x9842('0x4c')]=function(_0x4885e8,_0x100e3f){var _0x8ba376={};var _0x95c99d={};var _0x2e704b;var _0x3b3059;return db[_0x9842('0x23')][_0x9842('0x4d')]({'where':{'id':_0x4885e8[_0x9842('0x27')]['id']}})[_0x9842('0x14')](handleEntityNotFound(_0x100e3f,null))[_0x9842('0x14')](function(_0x29db3b){if(_0x29db3b){_0x2e704b=_0x29db3b;_0x95c99d[_0x9842('0x28')]=_[_0x9842('0x29')](db[_0x9842('0x4e')][_0x9842('0x1d')]);_0x95c99d['query']=_[_0x9842('0x29')](_0x4885e8[_0x9842('0x22')]);_0x95c99d[_0x9842('0x3b')]=_[_0x9842('0x2a')](_0x95c99d[_0x9842('0x28')],_0x95c99d['query']);_0x8ba376['attributes']=_[_0x9842('0x2a')](_0x95c99d['model'],qs[_0x9842('0x2b')](_0x4885e8[_0x9842('0x22')]['fields']));_0x8ba376['attributes']=_0x8ba376[_0x9842('0x2c')][_0x9842('0x2d')]?_0x8ba376[_0x9842('0x2c')]:_0x95c99d['model'];_0x8ba376['order']=qs[_0x9842('0x40')](_0x4885e8[_0x9842('0x22')][_0x9842('0x40')]);_0x8ba376[_0x9842('0x20')]=qs[_0x9842('0x3b')](_[_0x9842('0x4f')](_0x4885e8['query'],_0x95c99d['filters']));if(_0x4885e8['query'][_0x9842('0x42')]){_0x8ba376[_0x9842('0x20')]=_['merge'](_0x8ba376['where'],{'$or':_[_0x9842('0x1c')](_0x8ba376[_0x9842('0x2c')],function(_0x5d51a3){var _0x5aa7ff={};_0x5aa7ff[_0x5d51a3]={'$like':'%'+_0x4885e8['query'][_0x9842('0x42')]+'%'};return _0x5aa7ff;})});}_0x8ba376=_[_0x9842('0x2e')]({},_0x8ba376,_0x4885e8[_0x9842('0x2f')]);return _0x2e704b[_0x9842('0x4c')](_0x8ba376);}})[_0x9842('0x14')](function(_0x526698){if(_0x526698){_0x3b3059=_0x526698[_0x9842('0x2d')];if(!_0x4885e8[_0x9842('0x22')][_0x9842('0x3c')](_0x9842('0x3d'))){_0x8ba376[_0x9842('0x3e')]=qs['limit'](_0x4885e8[_0x9842('0x22')][_0x9842('0x3e')]);_0x8ba376[_0x9842('0xe')]=qs['offset'](_0x4885e8[_0x9842('0x22')][_0x9842('0xe')]);}return _0x2e704b[_0x9842('0x4c')](_0x8ba376);}})[_0x9842('0x14')](function(_0x5323f9){if(_0x5323f9){return _0x5323f9?{'count':_0x3b3059,'rows':_0x5323f9}:null;}})[_0x9842('0x14')](respondWithResult(_0x100e3f,null))[_0x9842('0x25')](handleError(_0x100e3f,null));};exports[_0x9842('0x50')]=function(_0x576c74,_0x4bf0bf){var _0x515975=_0x576c74[_0x9842('0x32')][_0x9842('0x51')];return db[_0x9842('0x4e')][_0x9842('0x24')]({'where':{'id':_0x515975},'attributes':['id'],'include':[{'model':db[_0x9842('0x43')],'as':_0x9842('0x52'),'attributes':['id','name',_0x9842('0x53'),_0x9842('0x54'),'interface'],'raw':!![]}]})['then'](function(_0x4151e4){if(_0x4151e4){var _0x500ebc=_['flatMap'](_0x4151e4,function(_0x159e9c){var _0x5f83bc=_0x159e9c[_0x9842('0x16')]({'plain':!![]});return _0x5f83bc[_0x9842('0x52')];});return db[_0x9842('0x23')]['find']({'where':{'id':_0x576c74[_0x9842('0x27')]['id']}})[_0x9842('0x14')](function(_0x10770e){return db['sequelize']['transaction'](function(_0x4111d4){return _0x10770e['addTeams'](_0x515975,{'transaction':_0x4111d4})[_0x9842('0x14')](function(){return BPromise[_0x9842('0x55')](_0x500ebc,function(_0x302bef){return db[_0x9842('0x3a')][_0x9842('0x56')]({'where':{'UserId':_0x302bef['id'],'MailQueueId':_0x576c74[_0x9842('0x27')]['id']},'transaction':_0x4111d4});});})[_0x9842('0x14')](function(){_0x500ebc[_0x9842('0x57')](function(_0x5e49db){socket['emit'](_0x9842('0x58'),{'UserId':_0x5e49db['id'],'MailQueueId':_0x10770e['id']});});});});});}})['then'](respondWithStatusCode(_0x4bf0bf,null))[_0x9842('0x25')](handleError(_0x4bf0bf,null));};exports[_0x9842('0x59')]=function(_0x3c1e73,_0x489e52){return db['Team'][_0x9842('0x24')]({'where':{'id':_0x3c1e73[_0x9842('0x22')][_0x9842('0x51')]},'attributes':['id'],'include':[{'model':db[_0x9842('0x43')],'as':_0x9842('0x52'),'attributes':['id'],'raw':!![]}]})[_0x9842('0x14')](handleEntityNotFound(_0x489e52,null))['then'](function(_0x47e86e){var _0x281d0a=_[_0x9842('0x1c')](_0x47e86e,'id');var _0x38706a=[];var _0x3be2c0=[];var _0x1e172d=squel[_0x9842('0x5a')]();_0x1e172d[_0x9842('0x5b')](_0x9842('0x5c'))[_0x9842('0x5d')](_0x9842('0x5e'),'tq')[_0x9842('0x5f')](_0x9842('0x60'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x9842('0x20')](_0x9842('0x61'),_0x3c1e73[_0x9842('0x27')]['id']);for(var _0x39cd78=0x0;_0x39cd78<_0x47e86e[_0x9842('0x2d')];_0x39cd78+=0x1){let _0x1194ba=_0x47e86e[_0x39cd78];for(var _0x4f99e8=0x0;_0x4f99e8<_0x1194ba[_0x9842('0x52')][_0x9842('0x2d')];_0x4f99e8+=0x1){let _0x4c51ec=_0x1194ba[_0x9842('0x52')][_0x4f99e8];var _0x21487b=_0x1e172d[_0x9842('0x62')]();_0x21487b[_0x9842('0x20')](_0x9842('0x63'),_0x4c51ec['id']);_0x3be2c0[_0x9842('0x64')](db[_0x9842('0x65')]['query'](_0x21487b[_0x9842('0x66')](),{'type':db['sequelize']['QueryTypes'][_0x9842('0x67')]})[_0x9842('0x14')](function(_0x158403){if(_0x158403[_0x9842('0x2d')]===0x1){return _0x4c51ec['id'];}else{var _0x26857c=_[_0x9842('0x68')](_[_0x9842('0x1c')](_0x158403,_0x9842('0x69')),function(_0x16f0ce){return _[_0x9842('0x6a')](_0x281d0a,_0x16f0ce);});if(_0x26857c){return _0x4c51ec['id'];}}}));}}return BPromise['all'](_0x3be2c0)[_0x9842('0x14')](function(_0x9654aa){_0x38706a=_(_0x38706a)['union'](_0x9654aa)[_0x9842('0x6b')]()[_0x9842('0x6c')]();return db[_0x9842('0x23')][_0x9842('0x30')]({'where':{'id':_0x3c1e73[_0x9842('0x27')]['id']}})[_0x9842('0x14')](function(_0x5a9732){return db['sequelize'][_0x9842('0x6d')](function(_0x314a9d){return _0x5a9732[_0x9842('0x59')](_0x3c1e73[_0x9842('0x22')][_0x9842('0x51')],{'transaction':_0x314a9d})[_0x9842('0x14')](function(){if(!_['isEmpty'](_0x38706a)){return _0x5a9732[_0x9842('0x6e')](_0x38706a,{'transaction':_0x314a9d});}})['then'](function(){_0x38706a['forEach'](function(_0x31cc6c){socket[_0x9842('0x6f')]('userMailQueue:remove',{'UserId':_0x31cc6c,'MailQueueId':_0x5a9732['id']});});});});});});})[_0x9842('0x14')](respondWithStatusCode(_0x489e52,null))[_0x9842('0x25')](handleError(_0x489e52,null));};exports[_0x9842('0x70')]=function(_0x2f43d4,_0x5e9516){return db[_0x9842('0x23')][_0x9842('0x30')]({'where':{'id':_0x2f43d4[_0x9842('0x27')]['id']}})['then'](handleEntityNotFound(_0x5e9516,null))['then'](function(_0xffc1b3){if(_0xffc1b3){return _0xffc1b3[_0x9842('0x70')](_0x2f43d4[_0x9842('0x32')][_0x9842('0x51')],_[_0x9842('0x71')](_0x2f43d4[_0x9842('0x32')],[_0x9842('0x51'),'id'])||{})[_0x9842('0x72')](function(_0x50d932){for(var _0x585b68=0x0;_0x585b68<_0x2f43d4['body'][_0x9842('0x51')]['length'];_0x585b68+=0x1){socket[_0x9842('0x6f')]('userMailQueue:save',{'UserId':Number(_0x2f43d4[_0x9842('0x32')][_0x9842('0x51')][_0x585b68]),'MailQueueId':Number(_0x2f43d4[_0x9842('0x27')]['id'])});}return _0x50d932;});}})[_0x9842('0x14')](respondWithResult(_0x5e9516,null))[_0x9842('0x25')](handleError(_0x5e9516,null));};exports[_0x9842('0x6e')]=function(_0x2725f9,_0x3e12e3){return db[_0x9842('0x23')][_0x9842('0x30')]({'where':{'id':_0x2725f9[_0x9842('0x27')]['id']}})['then'](handleEntityNotFound(_0x3e12e3,null))['then'](function(_0x2f4f22){if(_0x2f4f22){return _0x2f4f22[_0x9842('0x6e')](_0x2725f9[_0x9842('0x22')][_0x9842('0x51')])['then'](function(){if(_[_0x9842('0x73')](_0x2725f9[_0x9842('0x22')][_0x9842('0x51')])){for(var _0x431af6=0x0;_0x431af6<_0x2725f9[_0x9842('0x22')][_0x9842('0x51')]['length'];_0x431af6+=0x1){socket[_0x9842('0x6f')](_0x9842('0x74'),{'UserId':Number(_0x2725f9[_0x9842('0x22')][_0x9842('0x51')][_0x431af6]),'MailQueueId':Number(_0x2725f9[_0x9842('0x27')]['id'])});}}else{socket['emit']('userMailQueue:remove',{'UserId':Number(_0x2725f9['query'][_0x9842('0x51')]),'MailQueueId':Number(_0x2725f9[_0x9842('0x27')]['id'])});}});}})['then'](respondWithStatusCode(_0x3e12e3,null))[_0x9842('0x25')](handleError(_0x3e12e3,null));};exports[_0x9842('0x75')]=function(_0x5c49b6,_0x8ab624){var _0x31156f={};var _0x3f9ff0={};var _0xddf9e1;var _0x25c38c;return db[_0x9842('0x23')][_0x9842('0x4d')]({'where':{'id':_0x5c49b6[_0x9842('0x27')]['id']}})['then'](handleEntityNotFound(_0x8ab624,null))[_0x9842('0x14')](function(_0x306bee){if(_0x306bee){_0xddf9e1=_0x306bee;_0x3f9ff0[_0x9842('0x28')]=_[_0x9842('0x29')](db[_0x9842('0x43')][_0x9842('0x1d')]);_0x3f9ff0[_0x9842('0x22')]=_['keys'](_0x5c49b6[_0x9842('0x22')]);_0x3f9ff0[_0x9842('0x3b')]=_[_0x9842('0x2a')](_0x3f9ff0[_0x9842('0x28')],_0x3f9ff0[_0x9842('0x22')]);_0x31156f[_0x9842('0x2c')]=_[_0x9842('0x2a')](_0x3f9ff0[_0x9842('0x28')],qs[_0x9842('0x2b')](_0x5c49b6['query']['fields']));_0x31156f[_0x9842('0x2c')]=_0x31156f[_0x9842('0x2c')][_0x9842('0x2d')]?_0x31156f['attributes']:_0x3f9ff0[_0x9842('0x28')];_0x31156f[_0x9842('0x3f')]=qs['sort'](_0x5c49b6[_0x9842('0x22')]['sort']);_0x31156f[_0x9842('0x20')]=qs[_0x9842('0x3b')](_['pick'](_0x5c49b6[_0x9842('0x22')],_0x3f9ff0[_0x9842('0x3b')]));if(_0x5c49b6[_0x9842('0x22')][_0x9842('0x42')]){_0x31156f[_0x9842('0x20')]=_[_0x9842('0x2e')](_0x31156f[_0x9842('0x20')],{'$or':_[_0x9842('0x1c')](_0x31156f['attributes'],function(_0x4948ba){var _0x97e0d9={};_0x97e0d9[_0x4948ba]={'$like':'%'+_0x5c49b6[_0x9842('0x22')][_0x9842('0x42')]+'%'};return _0x97e0d9;})});}_0x31156f=_[_0x9842('0x2e')]({},_0x31156f,_0x5c49b6[_0x9842('0x2f')]);return _0xddf9e1[_0x9842('0x75')](_0x31156f);}})[_0x9842('0x14')](function(_0x3b603a){if(_0x3b603a){_0x25c38c=_0x3b603a[_0x9842('0x2d')];if(!_0x5c49b6[_0x9842('0x22')][_0x9842('0x3c')](_0x9842('0x3d'))){_0x31156f[_0x9842('0x3e')]=qs[_0x9842('0x3e')](_0x5c49b6[_0x9842('0x22')][_0x9842('0x3e')]);_0x31156f[_0x9842('0xe')]=qs[_0x9842('0xe')](_0x5c49b6['query'][_0x9842('0xe')]);}return _0xddf9e1['getAgents'](_0x31156f);}})['then'](function(_0x56fa50){if(_0x56fa50){return _0x56fa50?{'count':_0x25c38c,'rows':_0x56fa50}:null;}})[_0x9842('0x14')](respondWithResult(_0x8ab624,null))['catch'](handleError(_0x8ab624,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index 7b2bac5..00fe533 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 _0x5fb2=['emit','hasOwnProperty','hook','events','../../mysqldb','MailQueue','save','update','remove'];(function(_0x529b9a,_0x3ddafe){var _0x15b1f2=function(_0x584921){while(--_0x584921){_0x529b9a['push'](_0x529b9a['shift']());}};_0x15b1f2(++_0x3ddafe);}(_0x5fb2,0x159));var _0x25fb=function(_0x1418a5,_0x19c106){_0x1418a5=_0x1418a5-0x0;var _0x22c849=_0x5fb2[_0x1418a5];return _0x22c849;};'use strict';var EventEmitter=require(_0x25fb('0x0'));var MailQueue=require(_0x25fb('0x1'))['db'][_0x25fb('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x25fb('0x3'),'afterUpdate':_0x25fb('0x4'),'afterDestroy':_0x25fb('0x5')};function emitEvent(_0x1b40a2){return function(_0x1997b7,_0x471f9e,_0x434cbf){MailQueueEvents['emit'](_0x1b40a2+':'+_0x1997b7['id'],_0x1997b7);MailQueueEvents[_0x25fb('0x6')](_0x1b40a2,_0x1997b7);_0x434cbf(null);};}for(var e in events){if(events[_0x25fb('0x7')](e)){var event=events[e];MailQueue[_0x25fb('0x8')](e,emitEvent(event));}}module['exports']=MailQueueEvents; \ No newline at end of file +var _0x9dd1=['../../mysqldb','MailQueue','setMaxListeners','update','emit','hasOwnProperty','exports','events'];(function(_0x4bc852,_0x4cfaea){var _0x327a65=function(_0x2d2c00){while(--_0x2d2c00){_0x4bc852['push'](_0x4bc852['shift']());}};_0x327a65(++_0x4cfaea);}(_0x9dd1,0xff));var _0x19dd=function(_0x3e3bee,_0x4f91fe){_0x3e3bee=_0x3e3bee-0x0;var _0x3ae14c=_0x9dd1[_0x3e3bee];return _0x3ae14c;};'use strict';var EventEmitter=require(_0x19dd('0x0'));var MailQueue=require(_0x19dd('0x1'))['db'][_0x19dd('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x19dd('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x19dd('0x4'),'afterDestroy':'remove'};function emitEvent(_0x541656){return function(_0x66cd6b,_0x5e66f4,_0x555664){MailQueueEvents['emit'](_0x541656+':'+_0x66cd6b['id'],_0x66cd6b);MailQueueEvents[_0x19dd('0x5')](_0x541656,_0x66cd6b);_0x555664(null);};}for(var e in events){if(events[_0x19dd('0x6')](e)){var event=events[e];MailQueue['hook'](e,emitEvent(event));}}module[_0x19dd('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 5ad090d..bbd33a4 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 _0x73ab=['../../config/environment','exports','define','mail_queues','lodash','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x2c16a8,_0x14d2de){var _0x4f09bb=function(_0x5cde39){while(--_0x5cde39){_0x2c16a8['push'](_0x2c16a8['shift']());}};_0x4f09bb(++_0x14d2de);}(_0x73ab,0xd5));var _0xb73a=function(_0x2730da,_0x1098bd){_0x2730da=_0x2730da-0x0;var _0xfe9991=_0x73ab[_0x2730da];return _0xfe9991;};'use strict';var _=require(_0xb73a('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xb73a('0x1'));var moment=require(_0xb73a('0x2'));var BPromise=require(_0xb73a('0x3'));var rp=require(_0xb73a('0x4'));var fs=require('fs');var path=require(_0xb73a('0x5'));var rimraf=require(_0xb73a('0x6'));var config=require(_0xb73a('0x7'));var attributes=require('./mailQueue.attributes');module[_0xb73a('0x8')]=function(_0x3dc075,_0xf315c){return _0x3dc075[_0xb73a('0x9')]('MailQueue',attributes,{'tableName':_0xb73a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3a60=['util','../../config/logger','api','bluebird','request-promise','../../config/environment','exports','define','MailQueue','mail_queues'];(function(_0x4dfbff,_0x299cfd){var _0x11cd09=function(_0x47c07b){while(--_0x47c07b){_0x4dfbff['push'](_0x4dfbff['shift']());}};_0x11cd09(++_0x299cfd);}(_0x3a60,0x1b8));var _0x03a6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3a60[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x03a6('0x0'));var logger=require(_0x03a6('0x1'))(_0x03a6('0x2'));var moment=require('moment');var BPromise=require(_0x03a6('0x3'));var rp=require(_0x03a6('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x03a6('0x5'));var attributes=require('./mailQueue.attributes');module[_0x03a6('0x6')]=function(_0x3827b9,_0x52a2a5){return _0x3827b9[_0x03a6('0x7')](_0x03a6('0x8'),attributes,{'tableName':_0x03a6('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.rpc.js b/server/api/mailQueue/mailQueue.rpc.js index 1e1223a..063e9dc 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 _0x7084=['./mailQueue.socket','register','request','then','info','MailQueue,\x20%s,\x20%s','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','MailQueue','findAll','options','raw','attributes','limit','include','map','model','GetMailQueue','find','where','ShowMailQueue','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter'];(function(_0x69a451,_0x49fd37){var _0x3d6ef5=function(_0x27ebf4){while(--_0x27ebf4){_0x69a451['push'](_0x69a451['shift']());}};_0x3d6ef5(++_0x49fd37);}(_0x7084,0x118));var _0x4708=function(_0x539bde,_0x14b7db){_0x539bde=_0x539bde-0x0;var _0x1718d4=_0x7084[_0x539bde];return _0x1718d4;};'use strict';var _=require(_0x4708('0x0'));var util=require('util');var moment=require(_0x4708('0x1'));var BPromise=require(_0x4708('0x2'));var rs=require(_0x4708('0x3'));var fs=require('fs');var Redis=require(_0x4708('0x4'));var db=require(_0x4708('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x4708('0x6'))('rpc');var config=require(_0x4708('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x4708('0x8')][_0x4708('0x9')]({'port':0x232a});config[_0x4708('0xa')]=_[_0x4708('0xb')](config[_0x4708('0xa')],{'host':_0x4708('0xc'),'port':0x18eb});var socket=require(_0x4708('0xd'))(new Redis(config[_0x4708('0xa')]));require(_0x4708('0xe'))[_0x4708('0xf')](socket);function respondWithRpcPromise(_0x1c3f3d,_0x1029d8,_0x3a66e5){return new BPromise(function(_0x41df0b,_0x456aba){return client[_0x4708('0x10')](_0x1c3f3d,_0x3a66e5)[_0x4708('0x11')](function(_0x3bb353){logger[_0x4708('0x12')](_0x4708('0x13'),_0x1029d8,_0x4708('0x14'));logger[_0x4708('0x15')](_0x4708('0x16'),_0x1029d8,_0x4708('0x14'),JSON[_0x4708('0x17')](_0x3bb353));if(_0x3bb353[_0x4708('0x18')]){if(_0x3bb353['error'][_0x4708('0x19')]===0x1f4){logger[_0x4708('0x18')](_0x4708('0x13'),_0x1029d8,_0x3bb353[_0x4708('0x18')][_0x4708('0x1a')]);return _0x456aba(_0x3bb353[_0x4708('0x18')][_0x4708('0x1a')]);}logger[_0x4708('0x18')](_0x4708('0x13'),_0x1029d8,_0x3bb353['error'][_0x4708('0x1a')]);return _0x41df0b(_0x3bb353[_0x4708('0x18')][_0x4708('0x1a')]);}else{logger[_0x4708('0x12')](_0x4708('0x13'),_0x1029d8,'request\x20sent');_0x41df0b(_0x3bb353[_0x4708('0x1b')][_0x4708('0x1a')]);}})[_0x4708('0x1c')](function(_0x45d9c9){logger[_0x4708('0x18')](_0x4708('0x13'),_0x1029d8,_0x45d9c9);_0x456aba(_0x45d9c9);});});}exports['GetMailQueue']=function(_0x4ccd16){var _0x29dc02=this;return new Promise(function(_0x27de08,_0x40e9f4){return db[_0x4708('0x1d')][_0x4708('0x1e')]({'raw':_0x4ccd16[_0x4708('0x1f')]?_0x4ccd16[_0x4708('0x1f')][_0x4708('0x20')]===undefined?!![]:![]:!![],'where':_0x4ccd16[_0x4708('0x1f')]?_0x4ccd16['options']['where']||null:null,'attributes':_0x4ccd16[_0x4708('0x1f')]?_0x4ccd16[_0x4708('0x1f')][_0x4708('0x21')]||null:null,'limit':_0x4ccd16['options']?_0x4ccd16[_0x4708('0x1f')][_0x4708('0x22')]||null:null,'include':_0x4ccd16[_0x4708('0x1f')]?_0x4ccd16[_0x4708('0x1f')][_0x4708('0x23')]?_[_0x4708('0x24')](_0x4ccd16[_0x4708('0x1f')]['include'],function(_0x3db434){return{'model':db[_0x3db434[_0x4708('0x25')]],'as':_0x3db434['as'],'attributes':_0x3db434[_0x4708('0x21')],'include':_0x3db434['include']?_[_0x4708('0x24')](_0x3db434['include'],function(_0x4049d3){return{'model':db[_0x4049d3[_0x4708('0x25')]],'as':_0x4049d3['as'],'attributes':_0x4049d3[_0x4708('0x21')],'include':_0x4049d3[_0x4708('0x23')]?_[_0x4708('0x24')](_0x4049d3[_0x4708('0x23')],function(_0x467ea5){return{'model':db[_0x467ea5[_0x4708('0x25')]],'as':_0x467ea5['as'],'attributes':_0x467ea5[_0x4708('0x21')]};}):[]};}):[]};}):[]:[]})[_0x4708('0x11')](function(_0x48ee67){logger[_0x4708('0x12')]('GetMailQueue',_0x4ccd16);logger[_0x4708('0x15')](_0x4708('0x26'),_0x4ccd16,JSON['stringify'](_0x48ee67));_0x27de08(_0x48ee67);})[_0x4708('0x1c')](function(_0x2c601d){logger[_0x4708('0x18')](_0x4708('0x26'),_0x2c601d[_0x4708('0x1a')],_0x4ccd16);_0x40e9f4(_0x29dc02[_0x4708('0x18')](0x1f4,_0x2c601d[_0x4708('0x1a')]));});});};exports['ShowMailQueue']=function(_0x3fcfb6){var _0x158669=this;return new Promise(function(_0x302e5e,_0x2f6d2c){return db[_0x4708('0x1d')][_0x4708('0x27')]({'raw':_0x3fcfb6[_0x4708('0x1f')]?_0x3fcfb6['options']['raw']===undefined?!![]:![]:!![],'where':_0x3fcfb6[_0x4708('0x1f')]?_0x3fcfb6[_0x4708('0x1f')][_0x4708('0x28')]||null:null,'attributes':_0x3fcfb6[_0x4708('0x1f')]?_0x3fcfb6[_0x4708('0x1f')][_0x4708('0x21')]||null:null,'include':_0x3fcfb6[_0x4708('0x1f')]?_0x3fcfb6[_0x4708('0x1f')][_0x4708('0x23')]?_[_0x4708('0x24')](_0x3fcfb6[_0x4708('0x1f')][_0x4708('0x23')],function(_0x1608e5){return{'model':db[_0x1608e5[_0x4708('0x25')]],'as':_0x1608e5['as'],'attributes':_0x1608e5[_0x4708('0x21')],'include':_0x1608e5['include']?_[_0x4708('0x24')](_0x1608e5['include'],function(_0x3edc39){return{'model':db[_0x3edc39[_0x4708('0x25')]],'as':_0x3edc39['as'],'attributes':_0x3edc39[_0x4708('0x21')],'include':_0x3edc39[_0x4708('0x23')]?_[_0x4708('0x24')](_0x3edc39[_0x4708('0x23')],function(_0x1048b0){return{'model':db[_0x1048b0[_0x4708('0x25')]],'as':_0x1048b0['as'],'attributes':_0x1048b0[_0x4708('0x21')]};}):[]};}):[]};}):[]:[]})[_0x4708('0x11')](function(_0x2b78d4){logger[_0x4708('0x12')](_0x4708('0x29'),_0x3fcfb6);logger['debug'](_0x4708('0x29'),_0x3fcfb6,JSON[_0x4708('0x17')](_0x2b78d4));_0x302e5e(_0x2b78d4);})[_0x4708('0x1c')](function(_0x261195){logger[_0x4708('0x18')](_0x4708('0x29'),_0x261195['message'],_0x3fcfb6);_0x2f6d2c(_0x158669['error'](0x1f4,_0x261195[_0x4708('0x1a')]));});});}; \ No newline at end of file +var _0x6459=['http','redis','defaults','socket.io-emitter','./mailQueue.socket','register','request','then','info','MailQueue,\x20%s,\x20%s','debug','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','GetMailQueue','options','raw','where','attributes','limit','include','map','model','catch','ShowMailQueue','find','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x4b9cb4,_0x1f18a8){var _0x335d39=function(_0x5d6de6){while(--_0x5d6de6){_0x4b9cb4['push'](_0x4b9cb4['shift']());}};_0x335d39(++_0x1f18a8);}(_0x6459,0x6e));var _0x9645=function(_0x35838c,_0x2142d3){_0x35838c=_0x35838c-0x0;var _0x553b43=_0x6459[_0x35838c];return _0x553b43;};'use strict';var _=require('lodash');var util=require(_0x9645('0x0'));var moment=require('moment');var BPromise=require(_0x9645('0x1'));var rs=require(_0x9645('0x2'));var fs=require('fs');var Redis=require(_0x9645('0x3'));var db=require(_0x9645('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x9645('0x5'))(_0x9645('0x6'));var config=require(_0x9645('0x7'));var jayson=require(_0x9645('0x8'));var client=jayson[_0x9645('0x9')][_0x9645('0xa')]({'port':0x232a});config[_0x9645('0xb')]=_[_0x9645('0xc')](config[_0x9645('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x9645('0xd'))(new Redis(config[_0x9645('0xb')]));require(_0x9645('0xe'))[_0x9645('0xf')](socket);function respondWithRpcPromise(_0x2b9d53,_0x55e758,_0x22fb20){return new BPromise(function(_0x2c674d,_0x15c177){return client[_0x9645('0x10')](_0x2b9d53,_0x22fb20)[_0x9645('0x11')](function(_0x282590){logger[_0x9645('0x12')](_0x9645('0x13'),_0x55e758,'request\x20sent');logger[_0x9645('0x14')](_0x9645('0x15'),_0x55e758,'request\x20sent',JSON[_0x9645('0x16')](_0x282590));if(_0x282590[_0x9645('0x17')]){if(_0x282590['error'][_0x9645('0x18')]===0x1f4){logger[_0x9645('0x17')]('MailQueue,\x20%s,\x20%s',_0x55e758,_0x282590[_0x9645('0x17')][_0x9645('0x19')]);return _0x15c177(_0x282590['error']['message']);}logger[_0x9645('0x17')]('MailQueue,\x20%s,\x20%s',_0x55e758,_0x282590[_0x9645('0x17')][_0x9645('0x19')]);return _0x2c674d(_0x282590[_0x9645('0x17')][_0x9645('0x19')]);}else{logger['info'](_0x9645('0x13'),_0x55e758,_0x9645('0x1a'));_0x2c674d(_0x282590[_0x9645('0x1b')]['message']);}})['catch'](function(_0x1b4d98){logger[_0x9645('0x17')]('MailQueue,\x20%s,\x20%s',_0x55e758,_0x1b4d98);_0x15c177(_0x1b4d98);});});}exports[_0x9645('0x1c')]=function(_0x4de7c0){var _0x3d0b62=this;return new Promise(function(_0x3714a1,_0x17cfa6){return db['MailQueue']['findAll']({'raw':_0x4de7c0[_0x9645('0x1d')]?_0x4de7c0['options'][_0x9645('0x1e')]===undefined?!![]:![]:!![],'where':_0x4de7c0[_0x9645('0x1d')]?_0x4de7c0[_0x9645('0x1d')][_0x9645('0x1f')]||null:null,'attributes':_0x4de7c0[_0x9645('0x1d')]?_0x4de7c0[_0x9645('0x1d')][_0x9645('0x20')]||null:null,'limit':_0x4de7c0['options']?_0x4de7c0[_0x9645('0x1d')][_0x9645('0x21')]||null:null,'include':_0x4de7c0[_0x9645('0x1d')]?_0x4de7c0[_0x9645('0x1d')][_0x9645('0x22')]?_[_0x9645('0x23')](_0x4de7c0[_0x9645('0x1d')]['include'],function(_0x466d96){return{'model':db[_0x466d96[_0x9645('0x24')]],'as':_0x466d96['as'],'attributes':_0x466d96[_0x9645('0x20')],'include':_0x466d96['include']?_[_0x9645('0x23')](_0x466d96['include'],function(_0x124c30){return{'model':db[_0x124c30[_0x9645('0x24')]],'as':_0x124c30['as'],'attributes':_0x124c30[_0x9645('0x20')],'include':_0x124c30[_0x9645('0x22')]?_[_0x9645('0x23')](_0x124c30[_0x9645('0x22')],function(_0x39c962){return{'model':db[_0x39c962[_0x9645('0x24')]],'as':_0x39c962['as'],'attributes':_0x39c962['attributes']};}):[]};}):[]};}):[]:[]})[_0x9645('0x11')](function(_0x405264){logger['info'](_0x9645('0x1c'),_0x4de7c0);logger[_0x9645('0x14')](_0x9645('0x1c'),_0x4de7c0,JSON[_0x9645('0x16')](_0x405264));_0x3714a1(_0x405264);})[_0x9645('0x25')](function(_0x2f07ae){logger[_0x9645('0x17')](_0x9645('0x1c'),_0x2f07ae['message'],_0x4de7c0);_0x17cfa6(_0x3d0b62['error'](0x1f4,_0x2f07ae[_0x9645('0x19')]));});});};exports[_0x9645('0x26')]=function(_0xad0a71){var _0x3e75a8=this;return new Promise(function(_0x5bf027,_0x5537e0){return db['MailQueue'][_0x9645('0x27')]({'raw':_0xad0a71[_0x9645('0x1d')]?_0xad0a71[_0x9645('0x1d')][_0x9645('0x1e')]===undefined?!![]:![]:!![],'where':_0xad0a71[_0x9645('0x1d')]?_0xad0a71[_0x9645('0x1d')][_0x9645('0x1f')]||null:null,'attributes':_0xad0a71['options']?_0xad0a71[_0x9645('0x1d')][_0x9645('0x20')]||null:null,'include':_0xad0a71[_0x9645('0x1d')]?_0xad0a71[_0x9645('0x1d')][_0x9645('0x22')]?_[_0x9645('0x23')](_0xad0a71[_0x9645('0x1d')][_0x9645('0x22')],function(_0xad9ac1){return{'model':db[_0xad9ac1['model']],'as':_0xad9ac1['as'],'attributes':_0xad9ac1[_0x9645('0x20')],'include':_0xad9ac1['include']?_[_0x9645('0x23')](_0xad9ac1[_0x9645('0x22')],function(_0x1750b9){return{'model':db[_0x1750b9[_0x9645('0x24')]],'as':_0x1750b9['as'],'attributes':_0x1750b9[_0x9645('0x20')],'include':_0x1750b9[_0x9645('0x22')]?_[_0x9645('0x23')](_0x1750b9[_0x9645('0x22')],function(_0x467b2d){return{'model':db[_0x467b2d[_0x9645('0x24')]],'as':_0x467b2d['as'],'attributes':_0x467b2d[_0x9645('0x20')]};}):[]};}):[]};}):[]:[]})[_0x9645('0x11')](function(_0x24b20d){logger[_0x9645('0x12')](_0x9645('0x26'),_0xad0a71);logger[_0x9645('0x14')](_0x9645('0x26'),_0xad0a71,JSON[_0x9645('0x16')](_0x24b20d));_0x5bf027(_0x24b20d);})[_0x9645('0x25')](function(_0x1334c4){logger[_0x9645('0x17')](_0x9645('0x26'),_0x1334c4[_0x9645('0x19')],_0xad0a71);_0x5537e0(_0x3e75a8[_0x9645('0x17')](0x1f4,_0x1334c4['message']));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index fccf371..0fa3886 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 _0x051f=['removeListener','register','length','mailQueue:','save','remove','update'];(function(_0x2a5585,_0x41e3c1){var _0x1c5f9b=function(_0x354c11){while(--_0x354c11){_0x2a5585['push'](_0x2a5585['shift']());}};_0x1c5f9b(++_0x41e3c1);}(_0x051f,0x177));var _0xf051=function(_0x5221a0,_0x6a9b30){_0x5221a0=_0x5221a0-0x0;var _0xb7f453=_0x051f[_0x5221a0];return _0xb7f453;};'use strict';var MailQueueEvents=require('./mailQueue.events');var events=[_0xf051('0x0'),_0xf051('0x1'),_0xf051('0x2')];function createListener(_0x349894,_0x105ae8){return function(_0x3133ab){_0x105ae8['emit'](_0x349894,_0x3133ab);};}function removeListener(_0x6caa73,_0x1dca27){return function(){MailQueueEvents[_0xf051('0x3')](_0x6caa73,_0x1dca27);};}exports[_0xf051('0x4')]=function(_0x4cc8a1){for(var _0x166be3=0x0,_0x3da4cd=events[_0xf051('0x5')];_0x166be3<_0x3da4cd;_0x166be3++){var _0x5ae688=events[_0x166be3];var _0x31942c=createListener(_0xf051('0x6')+_0x5ae688,_0x4cc8a1);MailQueueEvents['on'](_0x5ae688,_0x31942c);}}; \ No newline at end of file +var _0x1c19=['./mailQueue.events','save','remove','removeListener','register','length'];(function(_0x4f88bd,_0x22ce6b){var _0x4df5df=function(_0x588dfb){while(--_0x588dfb){_0x4f88bd['push'](_0x4f88bd['shift']());}};_0x4df5df(++_0x22ce6b);}(_0x1c19,0x1f2));var _0x91c1=function(_0x2bc8e0,_0x38204a){_0x2bc8e0=_0x2bc8e0-0x0;var _0xca8f97=_0x1c19[_0x2bc8e0];return _0xca8f97;};'use strict';var MailQueueEvents=require(_0x91c1('0x0'));var events=[_0x91c1('0x1'),_0x91c1('0x2'),'update'];function createListener(_0x3d2df6,_0x44a264){return function(_0x546ff1){_0x44a264['emit'](_0x3d2df6,_0x546ff1);};}function removeListener(_0x31f1da,_0x5a8654){return function(){MailQueueEvents[_0x91c1('0x3')](_0x31f1da,_0x5a8654);};}exports[_0x91c1('0x4')]=function(_0x105260){for(var _0xc05b49=0x0,_0x1a2ff5=events[_0x91c1('0x5')];_0xc05b49<_0x1a2ff5;_0xc05b49++){var _0x2a60b1=events[_0xc05b49];var _0x5ca804=createListener('mailQueue:'+_0x2a60b1,_0x105260);MailQueueEvents['on'](_0x2a60b1,_0x5ca804);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index e68d5a3..787cc76 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 _0x7f73=['../../components/interaction/service','../../config/environment','./mailQueueReport.controller','isAuthenticated','index','get','/describe','describe','/:id','post','put','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x7f73,0x9a));var _0x37f7=function(_0x24b798,_0x477b4d){_0x24b798=_0x24b798-0x0;var _0x3454ed=_0x7f73[_0x24b798];return _0x3454ed;};'use strict';var multer=require(_0x37f7('0x0'));var util=require(_0x37f7('0x1'));var path=require(_0x37f7('0x2'));var timeout=require(_0x37f7('0x3'));var express=require('express');var router=express[_0x37f7('0x4')]();var fs_extra=require(_0x37f7('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x37f7('0x6'));var config=require(_0x37f7('0x7'));var controller=require(_0x37f7('0x8'));router['get']('/',auth[_0x37f7('0x9')](),controller[_0x37f7('0xa')]);router[_0x37f7('0xb')](_0x37f7('0xc'),auth[_0x37f7('0x9')](),controller[_0x37f7('0xd')]);router[_0x37f7('0xb')](_0x37f7('0xe'),auth[_0x37f7('0x9')](),controller['show']);router[_0x37f7('0xf')]('/',auth[_0x37f7('0x9')](),controller['create']);router[_0x37f7('0x10')](_0x37f7('0xe'),auth['isAuthenticated'](),controller['update']);router[_0x37f7('0x11')](_0x37f7('0xe'),auth['isAuthenticated'](),controller[_0x37f7('0x12')]);module[_0x37f7('0x13')]=router; \ No newline at end of file +var _0x25f2=['./mailQueueReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post','update','destroy','exports','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x25f2,0x13d));var _0x225f=function(_0x2dda48,_0x15c4ff){_0x2dda48=_0x2dda48-0x0;var _0x99d56b=_0x25f2[_0x2dda48];return _0x99d56b;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x225f('0x0'));var router=express[_0x225f('0x1')]();var fs_extra=require(_0x225f('0x2'));var auth=require(_0x225f('0x3'));var interaction=require(_0x225f('0x4'));var config=require(_0x225f('0x5'));var controller=require(_0x225f('0x6'));router[_0x225f('0x7')]('/',auth[_0x225f('0x8')](),controller['index']);router[_0x225f('0x7')](_0x225f('0x9'),auth[_0x225f('0x8')](),controller[_0x225f('0xa')]);router[_0x225f('0x7')](_0x225f('0xb'),auth[_0x225f('0x8')](),controller[_0x225f('0xc')]);router[_0x225f('0xd')]('/',auth[_0x225f('0x8')](),controller['create']);router['put'](_0x225f('0xb'),auth['isAuthenticated'](),controller[_0x225f('0xe')]);router['delete']('/:id',auth[_0x225f('0x8')](),controller[_0x225f('0xf')]);module[_0x225f('0x10')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index eecb184..041212b 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 _0x1572=['DATE','moment','STRING'];(function(_0x57a5d0,_0x3dbe9e){var _0xd7f06c=function(_0x5729b4){while(--_0x5729b4){_0x57a5d0['push'](_0x57a5d0['shift']());}};_0xd7f06c(++_0x3dbe9e);}(_0x1572,0xf7));var _0x2157=function(_0x14469b,_0x42637d){_0x14469b=_0x14469b-0x0;var _0x583683=_0x1572[_0x14469b];return _0x583683;};'use strict';var moment=require(_0x2157('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x2157('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0x2157('0x1')]},'joinAt':{'type':Sequelize[_0x2157('0x2')]},'leaveAt':{'type':Sequelize[_0x2157('0x2')]},'acceptAt':{'type':Sequelize[_0x2157('0x2')]},'exitAt':{'type':Sequelize[_0x2157('0x2')]},'reason':{'type':Sequelize[_0x2157('0x1')]}}; \ No newline at end of file +var _0xd3f3=['DATE','moment','exports','STRING'];(function(_0x526944,_0x2a2c50){var _0x3fa769=function(_0x22e302){while(--_0x22e302){_0x526944['push'](_0x526944['shift']());}};_0x3fa769(++_0x2a2c50);}(_0xd3f3,0x81));var _0x3d3f=function(_0x3dc856,_0x594de6){_0x3dc856=_0x3dc856-0x0;var _0x355b51=_0xd3f3[_0x3dc856];return _0x355b51;};'use strict';var moment=require(_0x3d3f('0x0'));var Sequelize=require('sequelize');module[_0x3d3f('0x1')]={'uniqueid':{'type':Sequelize[_0x3d3f('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x3d3f('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x3d3f('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x3d3f('0x3')]},'reason':{'type':Sequelize[_0x3d3f('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index c997d1a..d3c62f6 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 _0x524e=['end','json','offset','limit','count','set','apply','reject','save','update','destroy','name','send','index','map','rawAttributes','key','model','keys','filters','intersection','attributes','fields','query','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','options','MailQueueReport','then','includeAll','include','findAll','rows','catch','show','length','find','create','body','params','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','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','sendStatus','status'];(function(_0x5a5cc6,_0x28ea26){var _0x58876d=function(_0x33737e){while(--_0x33737e){_0x5a5cc6['push'](_0x5a5cc6['shift']());}};_0x58876d(++_0x28ea26);}(_0x524e,0x15e));var _0xe524=function(_0x279409,_0xd61f0a){_0x279409=_0x279409-0x0;var _0x13c710=_0x524e[_0x279409];return _0x13c710;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe524('0x0'));var jsonpatch=require(_0xe524('0x1'));var rp=require(_0xe524('0x2'));var moment=require(_0xe524('0x3'));var BPromise=require(_0xe524('0x4'));var Mustache=require(_0xe524('0x5'));var util=require(_0xe524('0x6'));var path=require(_0xe524('0x7'));var sox=require(_0xe524('0x8'));var csv=require(_0xe524('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe524('0xa'));var _=require(_0xe524('0xb'));var squel=require(_0xe524('0xc'));var crypto=require('crypto');var jsforce=require(_0xe524('0xd'));var deskjs=require(_0xe524('0xe'));var toCsv=require(_0xe524('0x9'));var querystring=require(_0xe524('0xf'));var Papa=require(_0xe524('0x10'));var Redis=require(_0xe524('0x11'));var authService=require(_0xe524('0x12'));var qs=require(_0xe524('0x13'));var as=require(_0xe524('0x14'));var hardwareService=require(_0xe524('0x15'));var logger=require(_0xe524('0x16'))(_0xe524('0x17'));var utils=require(_0xe524('0x18'));var config=require(_0xe524('0x19'));var licenseUtil=require(_0xe524('0x1a'));var db=require(_0xe524('0x1b'))['db'];function respondWithStatusCode(_0x5077c1,_0x4b0f51){_0x4b0f51=_0x4b0f51||0xcc;return function(_0xfdc2a5){if(_0xfdc2a5){return _0x5077c1[_0xe524('0x1c')](_0x4b0f51);}return _0x5077c1[_0xe524('0x1d')](_0x4b0f51)[_0xe524('0x1e')]();};}function respondWithResult(_0x20a852,_0x57c1b6){_0x57c1b6=_0x57c1b6||0xc8;return function(_0x12ff75){if(_0x12ff75){return _0x20a852['status'](_0x57c1b6)[_0xe524('0x1f')](_0x12ff75);}};}function respondWithFilteredResult(_0x1b0af6,_0x48165e){return function(_0x569660){if(_0x569660){var _0x488fce=typeof _0x48165e[_0xe524('0x20')]==='undefined'&&typeof _0x48165e[_0xe524('0x21')]==='undefined';var _0x5c8736=_0x569660['count'];var _0x3a4027=_0x488fce?0x0:_0x48165e['offset'];var _0x11b2a1=_0x488fce?_0x569660[_0xe524('0x22')]:_0x48165e[_0xe524('0x20')]+_0x48165e[_0xe524('0x21')];var _0x5d7b17;if(_0x11b2a1>=_0x5c8736){_0x11b2a1=_0x5c8736;_0x5d7b17=0xc8;}else{_0x5d7b17=0xce;}_0x1b0af6[_0xe524('0x1d')](_0x5d7b17);return _0x1b0af6[_0xe524('0x23')]('Content-Range',_0x3a4027+'-'+_0x11b2a1+'/'+_0x5c8736)[_0xe524('0x1f')](_0x569660);}return null;};}function patchUpdates(_0x309f85){return function(_0x43a4f9){try{jsonpatch[_0xe524('0x24')](_0x43a4f9,_0x309f85,!![]);}catch(_0x1c4194){return BPromise[_0xe524('0x25')](_0x1c4194);}return _0x43a4f9[_0xe524('0x26')]();};}function saveUpdates(_0x375219,_0x7dfe97){return function(_0x5c4d21){if(_0x5c4d21){return _0x5c4d21[_0xe524('0x27')](_0x375219)['then'](function(_0x577d1f){return _0x577d1f;});}return null;};}function removeEntity(_0x2d2f83,_0x23df5e){return function(_0x1ad106){if(_0x1ad106){return _0x1ad106[_0xe524('0x28')]()['then'](function(){_0x2d2f83[_0xe524('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x17e245,_0xcf5db){return function(_0xd62772){if(!_0xd62772){_0x17e245[_0xe524('0x1c')](0x194);}return _0xd62772;};}function handleError(_0x4102d9,_0xfd5965){_0xfd5965=_0xfd5965||0x1f4;return function(_0x2141db){logger['error'](_0x2141db['stack']);if(_0x2141db[_0xe524('0x29')]){delete _0x2141db[_0xe524('0x29')];}_0x4102d9[_0xe524('0x1d')](_0xfd5965)[_0xe524('0x2a')](_0x2141db);};}exports[_0xe524('0x2b')]=function(_0x5405e4,_0x52f140){var _0x4b1ff={},_0x25e7a7={},_0x3aedd9={'count':0x0,'rows':[]};var _0x8070e4=_[_0xe524('0x2c')](db['MailQueueReport'][_0xe524('0x2d')],function(_0x9a7e98){return{'name':_0x9a7e98['fieldName'],'type':_0x9a7e98['type'][_0xe524('0x2e')]};});_0x25e7a7[_0xe524('0x2f')]=_['map'](_0x8070e4,_0xe524('0x29'));_0x25e7a7['query']=_[_0xe524('0x30')](_0x5405e4['query']);_0x25e7a7[_0xe524('0x31')]=_[_0xe524('0x32')](_0x25e7a7[_0xe524('0x2f')],_0x25e7a7['query']);_0x4b1ff[_0xe524('0x33')]=_['intersection'](_0x25e7a7[_0xe524('0x2f')],qs[_0xe524('0x34')](_0x5405e4[_0xe524('0x35')]['fields']));_0x4b1ff[_0xe524('0x33')]=_0x4b1ff[_0xe524('0x33')]['length']?_0x4b1ff[_0xe524('0x33')]:_0x25e7a7[_0xe524('0x2f')];if(!_0x5405e4[_0xe524('0x35')][_0xe524('0x36')]('nolimit')){_0x4b1ff[_0xe524('0x21')]=qs[_0xe524('0x21')](_0x5405e4[_0xe524('0x35')][_0xe524('0x21')]);_0x4b1ff[_0xe524('0x20')]=qs[_0xe524('0x20')](_0x5405e4[_0xe524('0x35')][_0xe524('0x20')]);}_0x4b1ff['order']=qs[_0xe524('0x37')](_0x5405e4['query'][_0xe524('0x37')]);_0x4b1ff[_0xe524('0x38')]=qs['filters'](_[_0xe524('0x39')](_0x5405e4['query'],_0x25e7a7[_0xe524('0x31')]),_0x8070e4);if(_0x5405e4[_0xe524('0x35')][_0xe524('0x3a')]){_0x4b1ff[_0xe524('0x38')]=_[_0xe524('0x3b')](_0x4b1ff[_0xe524('0x38')],{'$or':_[_0xe524('0x2c')](_0x8070e4,function(_0x13762c){if(_0x13762c['type']!==_0xe524('0x3c')){var _0x940c05={};_0x940c05[_0x13762c[_0xe524('0x29')]]={'$like':'%'+_0x5405e4[_0xe524('0x35')][_0xe524('0x3a')]+'%'};return _0x940c05;}})});}_0x4b1ff=_[_0xe524('0x3b')]({},_0x4b1ff,_0x5405e4[_0xe524('0x3d')]);var _0x158d45={'where':_0x4b1ff['where']};return db[_0xe524('0x3e')][_0xe524('0x22')](_0x158d45)[_0xe524('0x3f')](function(_0x59781b){_0x3aedd9[_0xe524('0x22')]=_0x59781b;if(_0x5405e4['query'][_0xe524('0x40')]){_0x4b1ff[_0xe524('0x41')]=[{'all':!![]}];}return db[_0xe524('0x3e')][_0xe524('0x42')](_0x4b1ff);})[_0xe524('0x3f')](function(_0x4746cd){_0x3aedd9[_0xe524('0x43')]=_0x4746cd;return _0x3aedd9;})['then'](respondWithFilteredResult(_0x52f140,_0x4b1ff))[_0xe524('0x44')](handleError(_0x52f140,null));};exports[_0xe524('0x45')]=function(_0x13c54c,_0x376505){var _0x438962={'raw':!![],'where':{'id':_0x13c54c['params']['id']}},_0x1ae283={};_0x1ae283[_0xe524('0x2f')]=_[_0xe524('0x30')](db[_0xe524('0x3e')]['rawAttributes']);_0x1ae283[_0xe524('0x35')]=_['keys'](_0x13c54c['query']);_0x1ae283[_0xe524('0x31')]=_[_0xe524('0x32')](_0x1ae283['model'],_0x1ae283[_0xe524('0x35')]);_0x438962[_0xe524('0x33')]=_[_0xe524('0x32')](_0x1ae283[_0xe524('0x2f')],qs['fields'](_0x13c54c['query'][_0xe524('0x34')]));_0x438962[_0xe524('0x33')]=_0x438962['attributes'][_0xe524('0x46')]?_0x438962['attributes']:_0x1ae283[_0xe524('0x2f')];if(_0x13c54c[_0xe524('0x35')][_0xe524('0x40')]){_0x438962[_0xe524('0x41')]=[{'all':!![]}];}_0x438962=_[_0xe524('0x3b')]({},_0x438962,_0x13c54c[_0xe524('0x3d')]);return db[_0xe524('0x3e')][_0xe524('0x47')](_0x438962)[_0xe524('0x3f')](handleEntityNotFound(_0x376505,null))[_0xe524('0x3f')](respondWithResult(_0x376505,null))[_0xe524('0x44')](handleError(_0x376505,null));};exports[_0xe524('0x48')]=function(_0x3d7ab7,_0x33b1c8){return db[_0xe524('0x3e')]['create'](_0x3d7ab7[_0xe524('0x49')],{})['then'](respondWithResult(_0x33b1c8,0xc9))['catch'](handleError(_0x33b1c8,null));};exports[_0xe524('0x27')]=function(_0x59fe6b,_0x232cf0){if(_0x59fe6b[_0xe524('0x49')]['id']){delete _0x59fe6b['body']['id'];}return db[_0xe524('0x3e')]['find']({'where':{'id':_0x59fe6b['params']['id']}})[_0xe524('0x3f')](handleEntityNotFound(_0x232cf0,null))[_0xe524('0x3f')](saveUpdates(_0x59fe6b[_0xe524('0x49')],null))['then'](respondWithResult(_0x232cf0,null))['catch'](handleError(_0x232cf0,null));};exports['destroy']=function(_0x4e9c3b,_0x4f7a64){return db['MailQueueReport'][_0xe524('0x47')]({'where':{'id':_0x4e9c3b[_0xe524('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4f7a64,null))[_0xe524('0x3f')](removeEntity(_0x4f7a64,null))[_0xe524('0x44')](handleError(_0x4f7a64,null));};exports[_0xe524('0x4b')]=function(_0x208aa8,_0x2fa143){return db['MailQueueReport'][_0xe524('0x4b')]()[_0xe524('0x3f')](respondWithResult(_0x2fa143,null))[_0xe524('0x44')](handleError(_0x2fa143,null));}; \ No newline at end of file +var _0x14a0=['mustache','sox','to-csv','ejs','squel','crypto','jsforce','querystring','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','reject','save','update','destroy','then','stack','name','send','index','map','MailQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x422905,_0x3bce3a){var _0x33dc6c=function(_0x4852c9){while(--_0x4852c9){_0x422905['push'](_0x422905['shift']());}};_0x33dc6c(++_0x3bce3a);}(_0x14a0,0x8e));var _0x014a=function(_0x1f41ac,_0x443aa4){_0x1f41ac=_0x1f41ac-0x0;var _0x3c98a5=_0x14a0[_0x1f41ac];return _0x3c98a5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x014a('0x0'));var zipdir=require(_0x014a('0x1'));var jsonpatch=require(_0x014a('0x2'));var rp=require(_0x014a('0x3'));var moment=require(_0x014a('0x4'));var BPromise=require(_0x014a('0x5'));var Mustache=require(_0x014a('0x6'));var util=require('util');var path=require('path');var sox=require(_0x014a('0x7'));var csv=require(_0x014a('0x8'));var ejs=require(_0x014a('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x014a('0xa'));var crypto=require(_0x014a('0xb'));var jsforce=require(_0x014a('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x014a('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x014a('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x014a('0xf'))(_0x014a('0x10'));var utils=require('../../config/utils');var config=require(_0x014a('0x11'));var licenseUtil=require(_0x014a('0x12'));var db=require(_0x014a('0x13'))['db'];function respondWithStatusCode(_0x43bfeb,_0x1bcd1){_0x1bcd1=_0x1bcd1||0xcc;return function(_0x20cb56){if(_0x20cb56){return _0x43bfeb[_0x014a('0x14')](_0x1bcd1);}return _0x43bfeb[_0x014a('0x15')](_0x1bcd1)[_0x014a('0x16')]();};}function respondWithResult(_0x71535d,_0x45cd80){_0x45cd80=_0x45cd80||0xc8;return function(_0x3c54c8){if(_0x3c54c8){return _0x71535d['status'](_0x45cd80)[_0x014a('0x17')](_0x3c54c8);}};}function respondWithFilteredResult(_0x3cf92f,_0x59f207){return function(_0x3a836f){if(_0x3a836f){var _0x128c46=typeof _0x59f207['offset']===_0x014a('0x18')&&typeof _0x59f207[_0x014a('0x19')]===_0x014a('0x18');var _0x12da95=_0x3a836f[_0x014a('0x1a')];var _0x12d339=_0x128c46?0x0:_0x59f207[_0x014a('0x1b')];var _0x263b07=_0x128c46?_0x3a836f[_0x014a('0x1a')]:_0x59f207[_0x014a('0x1b')]+_0x59f207[_0x014a('0x19')];var _0x89e132;if(_0x263b07>=_0x12da95){_0x263b07=_0x12da95;_0x89e132=0xc8;}else{_0x89e132=0xce;}_0x3cf92f[_0x014a('0x15')](_0x89e132);return _0x3cf92f[_0x014a('0x1c')]('Content-Range',_0x12d339+'-'+_0x263b07+'/'+_0x12da95)[_0x014a('0x17')](_0x3a836f);}return null;};}function patchUpdates(_0x109a9c){return function(_0x11065f){try{jsonpatch[_0x014a('0x1d')](_0x11065f,_0x109a9c,!![]);}catch(_0xc9a563){return BPromise[_0x014a('0x1e')](_0xc9a563);}return _0x11065f[_0x014a('0x1f')]();};}function saveUpdates(_0x3dd2d0,_0x290b86){return function(_0x486e66){if(_0x486e66){return _0x486e66[_0x014a('0x20')](_0x3dd2d0)['then'](function(_0x1a1318){return _0x1a1318;});}return null;};}function removeEntity(_0x26718b,_0x44d921){return function(_0x36d52b){if(_0x36d52b){return _0x36d52b[_0x014a('0x21')]()[_0x014a('0x22')](function(){_0x26718b[_0x014a('0x15')](0xcc)[_0x014a('0x16')]();});}};}function handleEntityNotFound(_0x165a42,_0x4c2627){return function(_0x3b4b92){if(!_0x3b4b92){_0x165a42['sendStatus'](0x194);}return _0x3b4b92;};}function handleError(_0x39a432,_0x28701e){_0x28701e=_0x28701e||0x1f4;return function(_0x4f1c44){logger['error'](_0x4f1c44[_0x014a('0x23')]);if(_0x4f1c44[_0x014a('0x24')]){delete _0x4f1c44[_0x014a('0x24')];}_0x39a432['status'](_0x28701e)[_0x014a('0x25')](_0x4f1c44);};}exports[_0x014a('0x26')]=function(_0x598179,_0x31dc95){var _0x2560a6={},_0x496040={},_0x4f9c1c={'count':0x0,'rows':[]};var _0x397850=_[_0x014a('0x27')](db[_0x014a('0x28')][_0x014a('0x29')],function(_0x4ea00c){return{'name':_0x4ea00c[_0x014a('0x2a')],'type':_0x4ea00c[_0x014a('0x2b')][_0x014a('0x2c')]};});_0x496040[_0x014a('0x2d')]=_[_0x014a('0x27')](_0x397850,_0x014a('0x24'));_0x496040[_0x014a('0x2e')]=_[_0x014a('0x2f')](_0x598179[_0x014a('0x2e')]);_0x496040[_0x014a('0x30')]=_[_0x014a('0x31')](_0x496040['model'],_0x496040[_0x014a('0x2e')]);_0x2560a6[_0x014a('0x32')]=_[_0x014a('0x31')](_0x496040[_0x014a('0x2d')],qs[_0x014a('0x33')](_0x598179[_0x014a('0x2e')][_0x014a('0x33')]));_0x2560a6['attributes']=_0x2560a6[_0x014a('0x32')][_0x014a('0x34')]?_0x2560a6['attributes']:_0x496040[_0x014a('0x2d')];if(!_0x598179[_0x014a('0x2e')][_0x014a('0x35')](_0x014a('0x36'))){_0x2560a6[_0x014a('0x19')]=qs[_0x014a('0x19')](_0x598179[_0x014a('0x2e')][_0x014a('0x19')]);_0x2560a6['offset']=qs[_0x014a('0x1b')](_0x598179[_0x014a('0x2e')][_0x014a('0x1b')]);}_0x2560a6[_0x014a('0x37')]=qs['sort'](_0x598179[_0x014a('0x2e')][_0x014a('0x38')]);_0x2560a6[_0x014a('0x39')]=qs[_0x014a('0x30')](_[_0x014a('0x3a')](_0x598179[_0x014a('0x2e')],_0x496040[_0x014a('0x30')]),_0x397850);if(_0x598179[_0x014a('0x2e')][_0x014a('0x3b')]){_0x2560a6['where']=_[_0x014a('0x3c')](_0x2560a6['where'],{'$or':_[_0x014a('0x27')](_0x397850,function(_0xc11492){if(_0xc11492[_0x014a('0x2b')]!==_0x014a('0x3d')){var _0x43376c={};_0x43376c[_0xc11492['name']]={'$like':'%'+_0x598179[_0x014a('0x2e')][_0x014a('0x3b')]+'%'};return _0x43376c;}})});}_0x2560a6=_['merge']({},_0x2560a6,_0x598179[_0x014a('0x3e')]);var _0x2990df={'where':_0x2560a6[_0x014a('0x39')]};return db[_0x014a('0x28')][_0x014a('0x1a')](_0x2990df)[_0x014a('0x22')](function(_0x17b1b6){_0x4f9c1c[_0x014a('0x1a')]=_0x17b1b6;if(_0x598179[_0x014a('0x2e')]['includeAll']){_0x2560a6[_0x014a('0x3f')]=[{'all':!![]}];}return db[_0x014a('0x28')][_0x014a('0x40')](_0x2560a6);})[_0x014a('0x22')](function(_0x5f1a91){_0x4f9c1c[_0x014a('0x41')]=_0x5f1a91;return _0x4f9c1c;})[_0x014a('0x22')](respondWithFilteredResult(_0x31dc95,_0x2560a6))[_0x014a('0x42')](handleError(_0x31dc95,null));};exports[_0x014a('0x43')]=function(_0x1dc647,_0x430a56){var _0x5f2969={'raw':!![],'where':{'id':_0x1dc647[_0x014a('0x44')]['id']}},_0x361866={};_0x361866['model']=_[_0x014a('0x2f')](db[_0x014a('0x28')][_0x014a('0x29')]);_0x361866['query']=_[_0x014a('0x2f')](_0x1dc647['query']);_0x361866['filters']=_[_0x014a('0x31')](_0x361866[_0x014a('0x2d')],_0x361866['query']);_0x5f2969[_0x014a('0x32')]=_[_0x014a('0x31')](_0x361866[_0x014a('0x2d')],qs[_0x014a('0x33')](_0x1dc647[_0x014a('0x2e')][_0x014a('0x33')]));_0x5f2969['attributes']=_0x5f2969[_0x014a('0x32')][_0x014a('0x34')]?_0x5f2969[_0x014a('0x32')]:_0x361866['model'];if(_0x1dc647['query'][_0x014a('0x45')]){_0x5f2969['include']=[{'all':!![]}];}_0x5f2969=_['merge']({},_0x5f2969,_0x1dc647[_0x014a('0x3e')]);return db['MailQueueReport'][_0x014a('0x46')](_0x5f2969)[_0x014a('0x22')](handleEntityNotFound(_0x430a56,null))[_0x014a('0x22')](respondWithResult(_0x430a56,null))['catch'](handleError(_0x430a56,null));};exports[_0x014a('0x47')]=function(_0x23be18,_0x12cd9b){return db[_0x014a('0x28')][_0x014a('0x47')](_0x23be18[_0x014a('0x48')],{})['then'](respondWithResult(_0x12cd9b,0xc9))[_0x014a('0x42')](handleError(_0x12cd9b,null));};exports[_0x014a('0x20')]=function(_0x5a861c,_0x1a4df9){if(_0x5a861c[_0x014a('0x48')]['id']){delete _0x5a861c[_0x014a('0x48')]['id'];}return db[_0x014a('0x28')][_0x014a('0x46')]({'where':{'id':_0x5a861c[_0x014a('0x44')]['id']}})[_0x014a('0x22')](handleEntityNotFound(_0x1a4df9,null))[_0x014a('0x22')](saveUpdates(_0x5a861c['body'],null))[_0x014a('0x22')](respondWithResult(_0x1a4df9,null))[_0x014a('0x42')](handleError(_0x1a4df9,null));};exports[_0x014a('0x21')]=function(_0x135e7e,_0x312c7a){return db['MailQueueReport'][_0x014a('0x46')]({'where':{'id':_0x135e7e['params']['id']}})[_0x014a('0x22')](handleEntityNotFound(_0x312c7a,null))[_0x014a('0x22')](removeEntity(_0x312c7a,null))[_0x014a('0x42')](handleError(_0x312c7a,null));};exports[_0x014a('0x49')]=function(_0x3caa6e,_0x4f8547){return db['MailQueueReport']['describe']()['then'](respondWithResult(_0x4f8547,null))[_0x014a('0x42')](handleError(_0x4f8547,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index dec26c6..39577cb 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 _0x8597=['moment','bluebird','path','rimraf','../../config/environment','./mailQueueReport.attributes','exports','report_mail_queue','uniqueid','lodash','../../config/logger','api'];(function(_0x5aeaa8,_0x903aac){var _0x12a7e6=function(_0x125c97){while(--_0x125c97){_0x5aeaa8['push'](_0x5aeaa8['shift']());}};_0x12a7e6(++_0x903aac);}(_0x8597,0xe1));var _0x7859=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x8597[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x7859('0x0'));var util=require('util');var logger=require(_0x7859('0x1'))(_0x7859('0x2'));var moment=require(_0x7859('0x3'));var BPromise=require(_0x7859('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7859('0x5'));var rimraf=require(_0x7859('0x6'));var config=require(_0x7859('0x7'));var attributes=require(_0x7859('0x8'));module[_0x7859('0x9')]=function(_0x5b3e77,_0x14fd59){return _0x5b3e77['define']('MailQueueReport',attributes,{'tableName':_0x7859('0xa'),'paranoid':![],'indexes':[{'name':_0x7859('0xb'),'fields':[_0x7859('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x278f=['exports','define','MailQueueReport','report_mail_queue','uniqueid','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./mailQueueReport.attributes'];(function(_0x1ba404,_0x3d038c){var _0x44a9e8=function(_0x17cd7c){while(--_0x17cd7c){_0x1ba404['push'](_0x1ba404['shift']());}};_0x44a9e8(++_0x3d038c);}(_0x278f,0x12b));var _0xf278=function(_0x301ecc,_0x56a2fa){_0x301ecc=_0x301ecc-0x0;var _0x20f51d=_0x278f[_0x301ecc];return _0x20f51d;};'use strict';var _=require(_0xf278('0x0'));var util=require(_0xf278('0x1'));var logger=require('../../config/logger')(_0xf278('0x2'));var moment=require('moment');var BPromise=require(_0xf278('0x3'));var rp=require(_0xf278('0x4'));var fs=require('fs');var path=require(_0xf278('0x5'));var rimraf=require(_0xf278('0x6'));var config=require(_0xf278('0x7'));var attributes=require(_0xf278('0x8'));module[_0xf278('0x9')]=function(_0x4dfe3f,_0x27c658){return _0x4dfe3f[_0xf278('0xa')](_0xf278('0xb'),attributes,{'tableName':_0xf278('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xf278('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index 70d17e6..ab70948 100644 --- a/server/api/mailQueueReport/mailQueueReport.rpc.js +++ b/server/api/mailQueueReport/mailQueueReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc4aa=['create','body','options','raw','update','where','attributes','limit','UpdateMailQueueReport','stringify','lodash','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','CreateMailQueueReport','MailQueueReport'];(function(_0xf3d8f2,_0x3a04c3){var _0x4b9e0d=function(_0xbf511f){while(--_0xbf511f){_0xf3d8f2['push'](_0xf3d8f2['shift']());}};_0x4b9e0d(++_0x3a04c3);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0xc4aa[_0x4b055c];return _0x4b62bb;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var moment=require(_0xac4a('0x2'));var BPromise=require(_0xac4a('0x3'));var rs=require(_0xac4a('0x4'));var fs=require('fs');var Redis=require(_0xac4a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xac4a('0x6'));var config=require(_0xac4a('0x7'));var jayson=require(_0xac4a('0x8'));var client=jayson[_0xac4a('0x9')][_0xac4a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15cd34,_0x3ef77c,_0x10525b){return new BPromise(function(_0x5c6179,_0x5b8339){return client[_0xac4a('0xb')](_0x15cd34,_0x10525b)[_0xac4a('0xc')](function(_0x26ec84){logger['info'](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));logger[_0xac4a('0xf')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x3ef77c,_0xac4a('0xe'),JSON['stringify'](_0x26ec84));if(_0x26ec84[_0xac4a('0x10')]){if(_0x26ec84['error'][_0xac4a('0x11')]===0x1f4){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84['error'][_0xac4a('0x12')]);return _0x5b8339(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);return _0x5c6179(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}else{logger[_0xac4a('0x13')](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));_0x5c6179(_0x26ec84['result'][_0xac4a('0x12')]);}})[_0xac4a('0x14')](function(_0x23eb66){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x23eb66);_0x5b8339(_0x23eb66);});});}exports[_0xac4a('0x15')]=function(_0x28e304){var _0x44ec59=this;return new Promise(function(_0x546c5d,_0x5ac21e){return db[_0xac4a('0x16')][_0xac4a('0x17')](_0x28e304[_0xac4a('0x18')],{'raw':_0x28e304['options']?_0x28e304[_0xac4a('0x19')][_0xac4a('0x1a')]===undefined?!![]:![]:!![]})[_0xac4a('0xc')](function(_0x3a3cdb){logger[_0xac4a('0x13')](_0xac4a('0x15'),_0x28e304);logger[_0xac4a('0xf')](_0xac4a('0x15'),_0x28e304,JSON['stringify'](_0x3a3cdb));_0x546c5d(_0x3a3cdb);})[_0xac4a('0x14')](function(_0x3204ad){logger['error'](_0xac4a('0x15'),_0x3204ad[_0xac4a('0x12')],_0x28e304);_0x5ac21e(_0x44ec59[_0xac4a('0x10')](0x1f4,_0x3204ad[_0xac4a('0x12')]));});});};exports['UpdateMailQueueReport']=function(_0x1b7998){var _0x2503d8=this;return new Promise(function(_0x15435c,_0x412494){return db[_0xac4a('0x16')][_0xac4a('0x1b')](_0x1b7998[_0xac4a('0x18')],{'raw':_0x1b7998[_0xac4a('0x19')]?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1b7998[_0xac4a('0x19')]?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1c')]||null:null,'attributes':_0x1b7998[_0xac4a('0x19')]?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1d')]||null:null,'limit':_0x1b7998['options']?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1e')]||null:null})[_0xac4a('0xc')](function(_0x2772fe){logger[_0xac4a('0x13')]('UpdateMailQueueReport',_0x1b7998);logger['debug'](_0xac4a('0x1f'),_0x1b7998,JSON[_0xac4a('0x20')](_0x2772fe));_0x15435c(_0x2772fe);})[_0xac4a('0x14')](function(_0x546b65){logger['error'](_0xac4a('0x1f'),_0x546b65[_0xac4a('0x12')],_0x1b7998);_0x412494(_0x2503d8[_0xac4a('0x10')](0x1f4,_0x546b65[_0xac4a('0x12')]));});});}; \ No newline at end of file +var _0x326f=['error','code','message','result','catch','CreateMailQueueReport','MailQueueReport','options','raw','stringify','UpdateMailQueueReport','body','attributes','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','info','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x3e0874,_0x9aa862){var _0xd8cccf=function(_0x2305ed){while(--_0x2305ed){_0x3e0874['push'](_0x3e0874['shift']());}};_0xd8cccf(++_0x9aa862);}(_0x326f,0xd1));var _0xf326=function(_0x554353,_0x2d5ca5){_0x554353=_0x554353-0x0;var _0x10276a=_0x326f[_0x554353];return _0x10276a;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xf326('0x1'));var rs=require(_0xf326('0x2'));var fs=require('fs');var Redis=require(_0xf326('0x3'));var db=require(_0xf326('0x4'))['db'];var utils=require(_0xf326('0x5'));var logger=require(_0xf326('0x6'))(_0xf326('0x7'));var config=require(_0xf326('0x8'));var jayson=require(_0xf326('0x9'));var client=jayson[_0xf326('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3c254d,_0x3851eb,_0x165f95){return new BPromise(function(_0x1e7b8a,_0x515bfa){return client['request'](_0x3c254d,_0x165f95)['then'](function(_0x3bacf2){logger[_0xf326('0xb')](_0xf326('0xc'),_0x3851eb,_0xf326('0xd'));logger[_0xf326('0xe')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x3851eb,_0xf326('0xd'),JSON['stringify'](_0x3bacf2));if(_0x3bacf2[_0xf326('0xf')]){if(_0x3bacf2['error'][_0xf326('0x10')]===0x1f4){logger['error'](_0xf326('0xc'),_0x3851eb,_0x3bacf2[_0xf326('0xf')]['message']);return _0x515bfa(_0x3bacf2[_0xf326('0xf')][_0xf326('0x11')]);}logger[_0xf326('0xf')](_0xf326('0xc'),_0x3851eb,_0x3bacf2['error'][_0xf326('0x11')]);return _0x1e7b8a(_0x3bacf2['error']['message']);}else{logger[_0xf326('0xb')](_0xf326('0xc'),_0x3851eb,_0xf326('0xd'));_0x1e7b8a(_0x3bacf2[_0xf326('0x12')][_0xf326('0x11')]);}})[_0xf326('0x13')](function(_0x34128e){logger[_0xf326('0xf')]('MailQueueReport,\x20%s,\x20%s',_0x3851eb,_0x34128e);_0x515bfa(_0x34128e);});});}exports[_0xf326('0x14')]=function(_0x453100){var _0x18bee3=this;return new Promise(function(_0x31ffb9,_0xcef2b5){return db[_0xf326('0x15')]['create'](_0x453100['body'],{'raw':_0x453100['options']?_0x453100[_0xf326('0x16')][_0xf326('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x4cabce){logger[_0xf326('0xb')]('CreateMailQueueReport',_0x453100);logger['debug'](_0xf326('0x14'),_0x453100,JSON[_0xf326('0x18')](_0x4cabce));_0x31ffb9(_0x4cabce);})['catch'](function(_0x5aa184){logger[_0xf326('0xf')](_0xf326('0x14'),_0x5aa184['message'],_0x453100);_0xcef2b5(_0x18bee3[_0xf326('0xf')](0x1f4,_0x5aa184[_0xf326('0x11')]));});});};exports[_0xf326('0x19')]=function(_0x295752){var _0x17c157=this;return new Promise(function(_0x2049ec,_0x5ce532){return db['MailQueueReport']['update'](_0x295752[_0xf326('0x1a')],{'raw':_0x295752[_0xf326('0x16')]?_0x295752[_0xf326('0x16')][_0xf326('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x295752[_0xf326('0x16')]?_0x295752[_0xf326('0x16')]['where']||null:null,'attributes':_0x295752[_0xf326('0x16')]?_0x295752[_0xf326('0x16')][_0xf326('0x1b')]||null:null,'limit':_0x295752['options']?_0x295752[_0xf326('0x16')]['limit']||null:null})['then'](function(_0x6a8e89){logger[_0xf326('0xb')](_0xf326('0x19'),_0x295752);logger['debug'](_0xf326('0x19'),_0x295752,JSON[_0xf326('0x18')](_0x6a8e89));_0x2049ec(_0x6a8e89);})['catch'](function(_0x225776){logger[_0xf326('0xf')](_0xf326('0x19'),_0x225776[_0xf326('0x11')],_0x295752);_0x5ce532(_0x17c157[_0xf326('0xf')](0x1f4,_0x225776[_0xf326('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index 2d63586..e7a2744 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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x66af94,_0x3b8b55){var _0x3572c9=function(_0x2e98a3){while(--_0x2e98a3){_0x66af94['push'](_0x66af94['shift']());}};_0x3572c9(++_0x3b8b55);}(_0xe706,0xa3));var _0x6e70=function(_0x3b1caf,_0x8a35c5){_0x3b1caf=_0x3b1caf-0x0;var _0x416b17=_0xe706[_0x3b1caf];return _0x416b17;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file +var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x4a0f60,_0x298c30){var _0x59b579=function(_0x28e479){while(--_0x28e479){_0x4a0f60['push'](_0x4a0f60['shift']());}};_0x59b579(++_0x298c30);}(_0xa9e0,0x123));var _0x0a9e=function(_0x934425,_0x5af72f){_0x934425=_0x934425-0x0;var _0x31d596=_0xa9e0[_0x934425];return _0x31d596;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index ea1f0e0..977a772 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 _0xced6=['INTEGER','sequelize','STRING','BOOLEAN'];(function(_0x41ec10,_0x4c3698){var _0xbf245=function(_0x212f2f){while(--_0x212f2f){_0x41ec10['push'](_0x41ec10['shift']());}};_0xbf245(++_0x4c3698);}(_0xced6,0x1b5));var _0x6ced=function(_0x1f10e0,_0x37b402){_0x1f10e0=_0x1f10e0-0x0;var _0x39b7e1=_0xced6[_0x1f10e0];return _0x39b7e1;};'use strict';var Sequelize=require(_0x6ced('0x0'));module['exports']={'description':{'type':Sequelize[_0x6ced('0x1')]},'host':{'type':Sequelize[_0x6ced('0x1')]},'authentication':{'type':Sequelize[_0x6ced('0x2')],'defaultValue':!![]},'user':{'type':Sequelize[_0x6ced('0x1')]},'password':{'type':Sequelize[_0x6ced('0x1')]},'port':{'type':Sequelize[_0x6ced('0x3')]},'tls':{'type':Sequelize[_0x6ced('0x2')],'defaultValue':!![]},'mailbox':{'type':Sequelize['STRING'],'defaultValue':'INBOX'},'connTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'authTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'service':{'type':Sequelize[_0x6ced('0x1')]},'modernAuthentication':{'type':Sequelize[_0x6ced('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x6d62=['BOOLEAN','INTEGER','INBOX','STRING'];(function(_0x472b35,_0x2e2d72){var _0x312980=function(_0x818d58){while(--_0x818d58){_0x472b35['push'](_0x472b35['shift']());}};_0x312980(++_0x2e2d72);}(_0x6d62,0xab));var _0x26d6=function(_0x532b64,_0x19811f){_0x532b64=_0x532b64-0x0;var _0x27a875=_0x6d62[_0x532b64];return _0x27a875;};'use strict';var Sequelize=require('sequelize');module['exports']={'description':{'type':Sequelize[_0x26d6('0x0')]},'host':{'type':Sequelize[_0x26d6('0x0')]},'authentication':{'type':Sequelize[_0x26d6('0x1')],'defaultValue':!![]},'user':{'type':Sequelize[_0x26d6('0x0')]},'password':{'type':Sequelize[_0x26d6('0x0')]},'port':{'type':Sequelize[_0x26d6('0x2')]},'tls':{'type':Sequelize[_0x26d6('0x1')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x26d6('0x0')],'defaultValue':_0x26d6('0x3')},'connTimeout':{'type':Sequelize[_0x26d6('0x2')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0x26d6('0x2')],'defaultValue':0x5},'service':{'type':Sequelize[_0x26d6('0x0')]},'modernAuthentication':{'type':Sequelize[_0x26d6('0x1')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index 6e43347..6c30afc 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 _0x4245=['path','rimraf','./mailServerIn.attributes','exports','define','mail_servers_in','lodash','../../config/logger','api','moment','request-promise'];(function(_0x50f598,_0x488f2f){var _0x1ae639=function(_0x1d4f93){while(--_0x1d4f93){_0x50f598['push'](_0x50f598['shift']());}};_0x1ae639(++_0x488f2f);}(_0x4245,0xb6));var _0x5424=function(_0x42d842,_0x1683ca){_0x42d842=_0x42d842-0x0;var _0x4c5036=_0x4245[_0x42d842];return _0x4c5036;};'use strict';var _=require(_0x5424('0x0'));var util=require('util');var logger=require(_0x5424('0x1'))(_0x5424('0x2'));var moment=require(_0x5424('0x3'));var BPromise=require('bluebird');var rp=require(_0x5424('0x4'));var fs=require('fs');var path=require(_0x5424('0x5'));var rimraf=require(_0x5424('0x6'));var config=require('../../config/environment');var attributes=require(_0x5424('0x7'));module[_0x5424('0x8')]=function(_0x5df7bf,_0x51f52a){return _0x5df7bf[_0x5424('0x9')]('MailServerIn',attributes,{'tableName':_0x5424('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc4ff=['util','../../config/logger','api','moment','path','../../config/environment','./mailServerIn.attributes','define','MailServerIn','mail_servers_in','lodash'];(function(_0x49dddc,_0x34ab3c){var _0x47d097=function(_0x40ea2f){while(--_0x40ea2f){_0x49dddc['push'](_0x49dddc['shift']());}};_0x47d097(++_0x34ab3c);}(_0xc4ff,0xaf));var _0xfc4f=function(_0x3d3dfd,_0x4bc7fc){_0x3d3dfd=_0x3d3dfd-0x0;var _0x4c54f8=_0xc4ff[_0x3d3dfd];return _0x4c54f8;};'use strict';var _=require(_0xfc4f('0x0'));var util=require(_0xfc4f('0x1'));var logger=require(_0xfc4f('0x2'))(_0xfc4f('0x3'));var moment=require(_0xfc4f('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xfc4f('0x5'));var rimraf=require('rimraf');var config=require(_0xfc4f('0x6'));var attributes=require(_0xfc4f('0x7'));module['exports']=function(_0x41bb49,_0x35bca7){return _0x41bb49[_0xfc4f('0x8')](_0xfc4f('0x9'),attributes,{'tableName':_0xfc4f('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 bea561c..236fcba 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 _0x4cdd=['stringify','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','request','then','info','MailServerIn,\x20%s,\x20%s','debug','MailServerIn,\x20%s,\x20%s,\x20%s','request\x20sent','code','error','message','catch','MailServerIn','options','raw','attributes','limit','include','map','model','GetMailServerIn'];(function(_0x2398b8,_0x4acb6c){var _0x3b2af1=function(_0x57512a){while(--_0x57512a){_0x2398b8['push'](_0x2398b8['shift']());}};_0x3b2af1(++_0x4acb6c);}(_0x4cdd,0x1a5));var _0xd4cd=function(_0x4db703,_0x2715fc){_0x4db703=_0x4db703-0x0;var _0x4b9eaa=_0x4cdd[_0x4db703];return _0x4b9eaa;};'use strict';var _=require(_0xd4cd('0x0'));var util=require(_0xd4cd('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd4cd('0x2'));var fs=require('fs');var Redis=require(_0xd4cd('0x3'));var db=require(_0xd4cd('0x4'))['db'];var utils=require(_0xd4cd('0x5'));var logger=require(_0xd4cd('0x6'))(_0xd4cd('0x7'));var config=require(_0xd4cd('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3c3065,_0x4f4739,_0x24db75){return new BPromise(function(_0x4a0e74,_0x168dc1){return client[_0xd4cd('0x9')](_0x3c3065,_0x24db75)[_0xd4cd('0xa')](function(_0x456c40){logger[_0xd4cd('0xb')](_0xd4cd('0xc'),_0x4f4739,'request\x20sent');logger[_0xd4cd('0xd')](_0xd4cd('0xe'),_0x4f4739,_0xd4cd('0xf'),JSON['stringify'](_0x456c40));if(_0x456c40['error']){if(_0x456c40['error'][_0xd4cd('0x10')]===0x1f4){logger[_0xd4cd('0x11')]('MailServerIn,\x20%s,\x20%s',_0x4f4739,_0x456c40['error'][_0xd4cd('0x12')]);return _0x168dc1(_0x456c40[_0xd4cd('0x11')]['message']);}logger['error']('MailServerIn,\x20%s,\x20%s',_0x4f4739,_0x456c40[_0xd4cd('0x11')][_0xd4cd('0x12')]);return _0x4a0e74(_0x456c40['error']['message']);}else{logger['info'](_0xd4cd('0xc'),_0x4f4739,'request\x20sent');_0x4a0e74(_0x456c40['result'][_0xd4cd('0x12')]);}})[_0xd4cd('0x13')](function(_0x346760){logger[_0xd4cd('0x11')](_0xd4cd('0xc'),_0x4f4739,_0x346760);_0x168dc1(_0x346760);});});}exports['GetMailServerIn']=function(_0x3062e6){var _0x3888fe=this;return new Promise(function(_0x4eea06,_0x3e0a87){return db[_0xd4cd('0x14')]['findAll']({'raw':_0x3062e6[_0xd4cd('0x15')]?_0x3062e6[_0xd4cd('0x15')][_0xd4cd('0x16')]===undefined?!![]:![]:!![],'where':_0x3062e6[_0xd4cd('0x15')]?_0x3062e6[_0xd4cd('0x15')]['where']||null:null,'attributes':_0x3062e6['options']?_0x3062e6[_0xd4cd('0x15')][_0xd4cd('0x17')]||null:null,'limit':_0x3062e6[_0xd4cd('0x15')]?_0x3062e6[_0xd4cd('0x15')][_0xd4cd('0x18')]||null:null,'include':_0x3062e6[_0xd4cd('0x15')]?_0x3062e6['options'][_0xd4cd('0x19')]?_[_0xd4cd('0x1a')](_0x3062e6['options'][_0xd4cd('0x19')],function(_0x2e2dbf){return{'model':db[_0x2e2dbf['model']],'as':_0x2e2dbf['as'],'attributes':_0x2e2dbf[_0xd4cd('0x17')],'include':_0x2e2dbf['include']?_['map'](_0x2e2dbf[_0xd4cd('0x19')],function(_0x27bbe8){return{'model':db[_0x27bbe8[_0xd4cd('0x1b')]],'as':_0x27bbe8['as'],'attributes':_0x27bbe8[_0xd4cd('0x17')],'include':_0x27bbe8[_0xd4cd('0x19')]?_[_0xd4cd('0x1a')](_0x27bbe8[_0xd4cd('0x19')],function(_0x443f9e){return{'model':db[_0x443f9e[_0xd4cd('0x1b')]],'as':_0x443f9e['as'],'attributes':_0x443f9e[_0xd4cd('0x17')]};}):[]};}):[]};}):[]:[]})[_0xd4cd('0xa')](function(_0x43f459){logger[_0xd4cd('0xb')](_0xd4cd('0x1c'),_0x3062e6);logger['debug'](_0xd4cd('0x1c'),_0x3062e6,JSON[_0xd4cd('0x1d')](_0x43f459));_0x4eea06(_0x43f459);})['catch'](function(_0xe245f3){logger[_0xd4cd('0x11')]('GetMailServerIn',_0xe245f3[_0xd4cd('0x12')],_0x3062e6);_0x3e0a87(_0x3888fe[_0xd4cd('0x11')](0x1f4,_0xe245f3[_0xd4cd('0x12')]));});});}; \ No newline at end of file +var _0xac7a=['client','http','request','then','info','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetMailServerIn','MailServerIn','findAll','options','raw','where','include','model','map','attributes','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise'];(function(_0x1132ad,_0xf82add){var _0x8a712b=function(_0xe52257){while(--_0xe52257){_0x1132ad['push'](_0x1132ad['shift']());}};_0x8a712b(++_0xf82add);}(_0xac7a,0x128));var _0xaac7=function(_0x2bcf35,_0x123a98){_0x2bcf35=_0x2bcf35-0x0;var _0x10707e=_0xac7a[_0x2bcf35];return _0x10707e;};'use strict';var _=require(_0xaac7('0x0'));var util=require(_0xaac7('0x1'));var moment=require(_0xaac7('0x2'));var BPromise=require(_0xaac7('0x3'));var rs=require(_0xaac7('0x4'));var fs=require('fs');var Redis=require(_0xaac7('0x5'));var db=require(_0xaac7('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xaac7('0x7'))('rpc');var config=require(_0xaac7('0x8'));var jayson=require(_0xaac7('0x9'));var client=jayson[_0xaac7('0xa')][_0xaac7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2239bc,_0x381323,_0x8399ad){return new BPromise(function(_0xfd2437,_0x3910d5){return client[_0xaac7('0xc')](_0x2239bc,_0x8399ad)[_0xaac7('0xd')](function(_0x6d294e){logger[_0xaac7('0xe')](_0xaac7('0xf'),_0x381323,_0xaac7('0x10'));logger[_0xaac7('0x11')](_0xaac7('0x12'),_0x381323,_0xaac7('0x10'),JSON[_0xaac7('0x13')](_0x6d294e));if(_0x6d294e[_0xaac7('0x14')]){if(_0x6d294e[_0xaac7('0x14')]['code']===0x1f4){logger[_0xaac7('0x14')](_0xaac7('0xf'),_0x381323,_0x6d294e[_0xaac7('0x14')][_0xaac7('0x15')]);return _0x3910d5(_0x6d294e['error']['message']);}logger[_0xaac7('0x14')](_0xaac7('0xf'),_0x381323,_0x6d294e[_0xaac7('0x14')][_0xaac7('0x15')]);return _0xfd2437(_0x6d294e[_0xaac7('0x14')][_0xaac7('0x15')]);}else{logger[_0xaac7('0xe')](_0xaac7('0xf'),_0x381323,'request\x20sent');_0xfd2437(_0x6d294e[_0xaac7('0x16')]['message']);}})[_0xaac7('0x17')](function(_0x5637c8){logger[_0xaac7('0x14')](_0xaac7('0xf'),_0x381323,_0x5637c8);_0x3910d5(_0x5637c8);});});}exports[_0xaac7('0x18')]=function(_0x1b7569){var _0x47e9b0=this;return new Promise(function(_0x323bc5,_0x21ad07){return db[_0xaac7('0x19')][_0xaac7('0x1a')]({'raw':_0x1b7569['options']?_0x1b7569[_0xaac7('0x1b')][_0xaac7('0x1c')]===undefined?!![]:![]:!![],'where':_0x1b7569[_0xaac7('0x1b')]?_0x1b7569[_0xaac7('0x1b')][_0xaac7('0x1d')]||null:null,'attributes':_0x1b7569[_0xaac7('0x1b')]?_0x1b7569[_0xaac7('0x1b')]['attributes']||null:null,'limit':_0x1b7569[_0xaac7('0x1b')]?_0x1b7569[_0xaac7('0x1b')]['limit']||null:null,'include':_0x1b7569[_0xaac7('0x1b')]?_0x1b7569[_0xaac7('0x1b')][_0xaac7('0x1e')]?_['map'](_0x1b7569[_0xaac7('0x1b')][_0xaac7('0x1e')],function(_0x4b3dff){return{'model':db[_0x4b3dff[_0xaac7('0x1f')]],'as':_0x4b3dff['as'],'attributes':_0x4b3dff['attributes'],'include':_0x4b3dff[_0xaac7('0x1e')]?_[_0xaac7('0x20')](_0x4b3dff[_0xaac7('0x1e')],function(_0x33d2a1){return{'model':db[_0x33d2a1[_0xaac7('0x1f')]],'as':_0x33d2a1['as'],'attributes':_0x33d2a1['attributes'],'include':_0x33d2a1[_0xaac7('0x1e')]?_['map'](_0x33d2a1[_0xaac7('0x1e')],function(_0x1f2529){return{'model':db[_0x1f2529[_0xaac7('0x1f')]],'as':_0x1f2529['as'],'attributes':_0x1f2529[_0xaac7('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4547cf){logger['info'](_0xaac7('0x18'),_0x1b7569);logger[_0xaac7('0x11')]('GetMailServerIn',_0x1b7569,JSON[_0xaac7('0x13')](_0x4547cf));_0x323bc5(_0x4547cf);})[_0xaac7('0x17')](function(_0x5e28f0){logger['error'](_0xaac7('0x18'),_0x5e28f0[_0xaac7('0x15')],_0x1b7569);_0x21ad07(_0x47e9b0[_0xaac7('0x14')](0x1f4,_0x5e28f0[_0xaac7('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 236f8b6..ee40d19 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 _0x9957=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailServerOut.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x2160a9,_0x3cbd9e){var _0xa88cf7=function(_0x51ab6f){while(--_0x51ab6f){_0x2160a9['push'](_0x2160a9['shift']());}};_0xa88cf7(++_0x3cbd9e);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0xe')]('/',auth['isAuthenticated'](),controller[_0x7995('0xf')]);router[_0x7995('0x10')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router[_0x7995('0x12')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0x13')]);module[_0x7995('0x14')]=router; \ No newline at end of file +var _0x9957=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailServerOut.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x1ddedd,_0x485606){var _0xa3e1ac=function(_0x580444){while(--_0x580444){_0x1ddedd['push'](_0x1ddedd['shift']());}};_0xa3e1ac(++_0x485606);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0xe')]('/',auth['isAuthenticated'](),controller[_0x7995('0xf')]);router[_0x7995('0x10')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router[_0x7995('0x12')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0x13')]);module[_0x7995('0x14')]=router; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index b70fd30..58d7ac1 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 _0x282b=['sequelize','exports','STRING','BOOLEAN'];(function(_0x3a09ba,_0x5c5f5b){var _0x408d8c=function(_0x47b0f7){while(--_0x47b0f7){_0x3a09ba['push'](_0x3a09ba['shift']());}};_0x408d8c(++_0x5c5f5b);}(_0x282b,0xec));var _0xb282=function(_0x5a22b4,_0x2860af){_0x5a22b4=_0x5a22b4-0x0;var _0x34bf57=_0x282b[_0x5a22b4];return _0x34bf57;};'use strict';var Sequelize=require(_0xb282('0x0'));module[_0xb282('0x1')]={'description':{'type':Sequelize[_0xb282('0x2')]},'host':{'type':Sequelize[_0xb282('0x2')]},'user':{'type':Sequelize[_0xb282('0x2')]},'pass':{'type':Sequelize['STRING']},'port':{'type':Sequelize['INTEGER']},'secure':{'type':Sequelize[_0xb282('0x3')],'defaultValue':![]},'service':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0xb282('0x3')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0xb282('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x3266=['BOOLEAN','sequelize','exports','STRING','INTEGER'];(function(_0x496966,_0x579932){var _0x4c4b9a=function(_0x94f275){while(--_0x94f275){_0x496966['push'](_0x496966['shift']());}};_0x4c4b9a(++_0x579932);}(_0x3266,0x6a));var _0x6326=function(_0x609988,_0x507944){_0x609988=_0x609988-0x0;var _0x159984=_0x3266[_0x609988];return _0x159984;};'use strict';var Sequelize=require(_0x6326('0x0'));module[_0x6326('0x1')]={'description':{'type':Sequelize[_0x6326('0x2')]},'host':{'type':Sequelize[_0x6326('0x2')]},'user':{'type':Sequelize[_0x6326('0x2')]},'pass':{'type':Sequelize[_0x6326('0x2')]},'port':{'type':Sequelize[_0x6326('0x3')]},'secure':{'type':Sequelize[_0x6326('0x4')],'defaultValue':![]},'service':{'type':Sequelize[_0x6326('0x2')]},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0x6326('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index b8b979f..95dc0ee 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 _0x4519=['sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','reject','update','then','destroy','error','stack','name','index','map','MailServerOut','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','fields','attributes','length','nolimit','order','sort','filter','where','VIRTUAL','merge','include','findAll','rows','catch','show','includeAll','find','create','body','params','eml-format','rimraf','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/environment','../../config/license/util'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x4519,0x1db));var _0x9451=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x4519[_0x3ab51d];return _0x29a04e;};'use strict';var emlformat=require(_0x9451('0x0'));var rimraf=require(_0x9451('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x9451('0x2'));var BPromise=require(_0x9451('0x3'));var Mustache=require(_0x9451('0x4'));var util=require(_0x9451('0x5'));var path=require(_0x9451('0x6'));var sox=require(_0x9451('0x7'));var csv=require(_0x9451('0x8'));var ejs=require(_0x9451('0x9'));var fs=require('fs');var fs_extra=require(_0x9451('0xa'));var _=require(_0x9451('0xb'));var squel=require(_0x9451('0xc'));var crypto=require(_0x9451('0xd'));var jsforce=require(_0x9451('0xe'));var deskjs=require(_0x9451('0xf'));var toCsv=require('to-csv');var querystring=require(_0x9451('0x10'));var Papa=require(_0x9451('0x11'));var Redis=require(_0x9451('0x12'));var authService=require(_0x9451('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x9451('0x14'));var licenseUtil=require(_0x9451('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x32e7f7,_0x39fa43){_0x39fa43=_0x39fa43||0xcc;return function(_0x528517){if(_0x528517){return _0x32e7f7[_0x9451('0x16')](_0x39fa43);}return _0x32e7f7[_0x9451('0x17')](_0x39fa43)[_0x9451('0x18')]();};}function respondWithResult(_0x586704,_0x413b7c){_0x413b7c=_0x413b7c||0xc8;return function(_0xa78f7){if(_0xa78f7){return _0x586704[_0x9451('0x17')](_0x413b7c)[_0x9451('0x19')](_0xa78f7);}};}function respondWithFilteredResult(_0xb25c0f,_0x4e2530){return function(_0x1c77f7){if(_0x1c77f7){var _0x464aa7=typeof _0x4e2530['offset']===_0x9451('0x1a')&&typeof _0x4e2530['limit']===_0x9451('0x1a');var _0x240eba=_0x1c77f7[_0x9451('0x1b')];var _0x3578f9=_0x464aa7?0x0:_0x4e2530[_0x9451('0x1c')];var _0xe3b99f=_0x464aa7?_0x1c77f7['count']:_0x4e2530[_0x9451('0x1c')]+_0x4e2530[_0x9451('0x1d')];var _0x4ba263;if(_0xe3b99f>=_0x240eba){_0xe3b99f=_0x240eba;_0x4ba263=0xc8;}else{_0x4ba263=0xce;}_0xb25c0f['status'](_0x4ba263);return _0xb25c0f[_0x9451('0x1e')](_0x9451('0x1f'),_0x3578f9+'-'+_0xe3b99f+'/'+_0x240eba)[_0x9451('0x19')](_0x1c77f7);}return null;};}function patchUpdates(_0x22b718){return function(_0x3781a4){try{jsonpatch['apply'](_0x3781a4,_0x22b718,!![]);}catch(_0x1f7ee4){return BPromise[_0x9451('0x20')](_0x1f7ee4);}return _0x3781a4['save']();};}function saveUpdates(_0x25f02c,_0x55e05c){return function(_0x49dd82){if(_0x49dd82){return _0x49dd82[_0x9451('0x21')](_0x25f02c)[_0x9451('0x22')](function(_0x113f38){return _0x113f38;});}return null;};}function removeEntity(_0x82459,_0x2d6069){return function(_0x2c6700){if(_0x2c6700){return _0x2c6700[_0x9451('0x23')]()[_0x9451('0x22')](function(){_0x82459[_0x9451('0x17')](0xcc)[_0x9451('0x18')]();});}};}function handleEntityNotFound(_0x1946a7,_0x5bab48){return function(_0x117957){if(!_0x117957){_0x1946a7[_0x9451('0x16')](0x194);}return _0x117957;};}function handleError(_0x52ae4d,_0x4bb28b){_0x4bb28b=_0x4bb28b||0x1f4;return function(_0x36fcd5){logger[_0x9451('0x24')](_0x36fcd5[_0x9451('0x25')]);if(_0x36fcd5[_0x9451('0x26')]){delete _0x36fcd5[_0x9451('0x26')];}_0x52ae4d['status'](_0x4bb28b)['send'](_0x36fcd5);};}exports[_0x9451('0x27')]=function(_0x34397d,_0x18e3a6){var _0x3461a6={},_0x4437bc={},_0xb18706={'count':0x0,'rows':[]};var _0x21e518=_[_0x9451('0x28')](db[_0x9451('0x29')][_0x9451('0x2a')],function(_0x3a05fc){return{'name':_0x3a05fc[_0x9451('0x2b')],'type':_0x3a05fc[_0x9451('0x2c')][_0x9451('0x2d')]};});_0x4437bc['model']=_['map'](_0x21e518,_0x9451('0x26'));_0x4437bc['query']=_[_0x9451('0x2e')](_0x34397d[_0x9451('0x2f')]);_0x4437bc[_0x9451('0x30')]=_[_0x9451('0x31')](_0x4437bc[_0x9451('0x32')],_0x4437bc['query']);_0x3461a6['attributes']=_[_0x9451('0x31')](_0x4437bc['model'],qs[_0x9451('0x33')](_0x34397d['query'][_0x9451('0x33')]));_0x3461a6[_0x9451('0x34')]=_0x3461a6['attributes'][_0x9451('0x35')]?_0x3461a6[_0x9451('0x34')]:_0x4437bc['model'];if(!_0x34397d[_0x9451('0x2f')]['hasOwnProperty'](_0x9451('0x36'))){_0x3461a6[_0x9451('0x1d')]=qs[_0x9451('0x1d')](_0x34397d[_0x9451('0x2f')]['limit']);_0x3461a6['offset']=qs['offset'](_0x34397d[_0x9451('0x2f')][_0x9451('0x1c')]);}_0x3461a6[_0x9451('0x37')]=qs[_0x9451('0x38')](_0x34397d[_0x9451('0x2f')][_0x9451('0x38')]);_0x3461a6['where']=qs[_0x9451('0x30')](_['pick'](_0x34397d[_0x9451('0x2f')],_0x4437bc[_0x9451('0x30')]),_0x21e518);if(_0x34397d['query'][_0x9451('0x39')]){_0x3461a6[_0x9451('0x3a')]=_['merge'](_0x3461a6[_0x9451('0x3a')],{'$or':_[_0x9451('0x28')](_0x21e518,function(_0x4eb5a8){if(_0x4eb5a8[_0x9451('0x2c')]!==_0x9451('0x3b')){var _0x21d25e={};_0x21d25e[_0x4eb5a8['name']]={'$like':'%'+_0x34397d[_0x9451('0x2f')][_0x9451('0x39')]+'%'};return _0x21d25e;}})});}_0x3461a6=_[_0x9451('0x3c')]({},_0x3461a6,_0x34397d['options']);var _0x7faca9={'where':_0x3461a6[_0x9451('0x3a')]};return db[_0x9451('0x29')][_0x9451('0x1b')](_0x7faca9)[_0x9451('0x22')](function(_0x384052){_0xb18706[_0x9451('0x1b')]=_0x384052;if(_0x34397d[_0x9451('0x2f')]['includeAll']){_0x3461a6[_0x9451('0x3d')]=[{'all':!![]}];}return db[_0x9451('0x29')][_0x9451('0x3e')](_0x3461a6);})[_0x9451('0x22')](function(_0x26d4b0){_0xb18706[_0x9451('0x3f')]=_0x26d4b0;return _0xb18706;})[_0x9451('0x22')](respondWithFilteredResult(_0x18e3a6,_0x3461a6))[_0x9451('0x40')](handleError(_0x18e3a6,null));};exports[_0x9451('0x41')]=function(_0x45eee4,_0x39068b){var _0x195947={'raw':!![],'where':{'id':_0x45eee4['params']['id']}},_0x110129={};_0x110129['model']=_[_0x9451('0x2e')](db['MailServerOut'][_0x9451('0x2a')]);_0x110129[_0x9451('0x2f')]=_[_0x9451('0x2e')](_0x45eee4['query']);_0x110129[_0x9451('0x30')]=_[_0x9451('0x31')](_0x110129['model'],_0x110129[_0x9451('0x2f')]);_0x195947[_0x9451('0x34')]=_[_0x9451('0x31')](_0x110129[_0x9451('0x32')],qs[_0x9451('0x33')](_0x45eee4[_0x9451('0x2f')][_0x9451('0x33')]));_0x195947[_0x9451('0x34')]=_0x195947[_0x9451('0x34')][_0x9451('0x35')]?_0x195947[_0x9451('0x34')]:_0x110129[_0x9451('0x32')];if(_0x45eee4[_0x9451('0x2f')][_0x9451('0x42')]){_0x195947['include']=[{'all':!![]}];}_0x195947=_[_0x9451('0x3c')]({},_0x195947,_0x45eee4['options']);return db[_0x9451('0x29')][_0x9451('0x43')](_0x195947)['then'](handleEntityNotFound(_0x39068b,null))['then'](respondWithResult(_0x39068b,null))[_0x9451('0x40')](handleError(_0x39068b,null));};exports['create']=function(_0x1aaa81,_0x57ced8){return db[_0x9451('0x29')][_0x9451('0x44')](_0x1aaa81[_0x9451('0x45')],{})[_0x9451('0x22')](respondWithResult(_0x57ced8,0xc9))['catch'](handleError(_0x57ced8,null));};exports['update']=function(_0x2a491f,_0x45af50){if(_0x2a491f['body']['id']){delete _0x2a491f['body']['id'];}return db['MailServerOut']['find']({'where':{'id':_0x2a491f['params']['id']}})[_0x9451('0x22')](handleEntityNotFound(_0x45af50,null))['then'](saveUpdates(_0x2a491f[_0x9451('0x45')],null))[_0x9451('0x22')](respondWithResult(_0x45af50,null))['catch'](handleError(_0x45af50,null));};exports[_0x9451('0x23')]=function(_0x1624c6,_0x5b63b9){return db[_0x9451('0x29')]['find']({'where':{'id':_0x1624c6[_0x9451('0x46')]['id']}})[_0x9451('0x22')](handleEntityNotFound(_0x5b63b9,null))[_0x9451('0x22')](removeEntity(_0x5b63b9,null))[_0x9451('0x40')](handleError(_0x5b63b9,null));}; \ No newline at end of file +var _0xf07e=['status','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','map','MailServerOut','rawAttributes','fieldName','key','model','query','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','findAll','catch','show','params','keys','include','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','fs-extra','lodash','squel','crypto','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','offset','undefined','limit','count'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xf07e,0x101));var _0xef07=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf07e[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xef07('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xef07('0x1'));var jsonpatch=require(_0xef07('0x2'));var rp=require(_0xef07('0x3'));var moment=require(_0xef07('0x4'));var BPromise=require(_0xef07('0x5'));var Mustache=require('mustache');var util=require(_0xef07('0x6'));var path=require(_0xef07('0x7'));var sox=require(_0xef07('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xef07('0x9'));var _=require(_0xef07('0xa'));var squel=require(_0xef07('0xb'));var crypto=require(_0xef07('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xef07('0xd'));var toCsv=require('to-csv');var querystring=require(_0xef07('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xef07('0xf'));var as=require(_0xef07('0x10'));var hardwareService=require(_0xef07('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0xef07('0x12'));var config=require(_0xef07('0x13'));var licenseUtil=require(_0xef07('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1d0059,_0x164285){_0x164285=_0x164285||0xcc;return function(_0x314fcd){if(_0x314fcd){return _0x1d0059[_0xef07('0x15')](_0x164285);}return _0x1d0059['status'](_0x164285)[_0xef07('0x16')]();};}function respondWithResult(_0x58609a,_0x395916){_0x395916=_0x395916||0xc8;return function(_0x5b8380){if(_0x5b8380){return _0x58609a['status'](_0x395916)['json'](_0x5b8380);}};}function respondWithFilteredResult(_0x58f6b1,_0x4c458f){return function(_0x42247e){if(_0x42247e){var _0x13156e=typeof _0x4c458f[_0xef07('0x17')]===_0xef07('0x18')&&typeof _0x4c458f[_0xef07('0x19')]===_0xef07('0x18');var _0x560c4b=_0x42247e[_0xef07('0x1a')];var _0x9216d4=_0x13156e?0x0:_0x4c458f['offset'];var _0x2d0683=_0x13156e?_0x42247e[_0xef07('0x1a')]:_0x4c458f[_0xef07('0x17')]+_0x4c458f['limit'];var _0x381054;if(_0x2d0683>=_0x560c4b){_0x2d0683=_0x560c4b;_0x381054=0xc8;}else{_0x381054=0xce;}_0x58f6b1[_0xef07('0x1b')](_0x381054);return _0x58f6b1[_0xef07('0x1c')](_0xef07('0x1d'),_0x9216d4+'-'+_0x2d0683+'/'+_0x560c4b)['json'](_0x42247e);}return null;};}function patchUpdates(_0x4ad8fe){return function(_0x541345){try{jsonpatch['apply'](_0x541345,_0x4ad8fe,!![]);}catch(_0x2c3ad2){return BPromise[_0xef07('0x1e')](_0x2c3ad2);}return _0x541345[_0xef07('0x1f')]();};}function saveUpdates(_0x533c30,_0x25c1ad){return function(_0x5d62c1){if(_0x5d62c1){return _0x5d62c1[_0xef07('0x20')](_0x533c30)[_0xef07('0x21')](function(_0x5d14fe){return _0x5d14fe;});}return null;};}function removeEntity(_0x36f50c,_0x2dafb2){return function(_0x296ea4){if(_0x296ea4){return _0x296ea4[_0xef07('0x22')]()[_0xef07('0x21')](function(){_0x36f50c[_0xef07('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x21dcfc,_0x45ac50){return function(_0x477538){if(!_0x477538){_0x21dcfc[_0xef07('0x15')](0x194);}return _0x477538;};}function handleError(_0xe8ff76,_0x553ea2){_0x553ea2=_0x553ea2||0x1f4;return function(_0x5f2fda){logger[_0xef07('0x23')](_0x5f2fda[_0xef07('0x24')]);if(_0x5f2fda[_0xef07('0x25')]){delete _0x5f2fda[_0xef07('0x25')];}_0xe8ff76[_0xef07('0x1b')](_0x553ea2)[_0xef07('0x26')](_0x5f2fda);};}exports[_0xef07('0x27')]=function(_0x57985a,_0x542370){var _0x1e070a={},_0x3ca6be={},_0x54d0e8={'count':0x0,'rows':[]};var _0x47adbc=_[_0xef07('0x28')](db[_0xef07('0x29')][_0xef07('0x2a')],function(_0x55fa2d){return{'name':_0x55fa2d[_0xef07('0x2b')],'type':_0x55fa2d['type'][_0xef07('0x2c')]};});_0x3ca6be[_0xef07('0x2d')]=_[_0xef07('0x28')](_0x47adbc,_0xef07('0x25'));_0x3ca6be[_0xef07('0x2e')]=_['keys'](_0x57985a['query']);_0x3ca6be['filters']=_[_0xef07('0x2f')](_0x3ca6be[_0xef07('0x2d')],_0x3ca6be[_0xef07('0x2e')]);_0x1e070a['attributes']=_[_0xef07('0x2f')](_0x3ca6be[_0xef07('0x2d')],qs[_0xef07('0x30')](_0x57985a[_0xef07('0x2e')][_0xef07('0x30')]));_0x1e070a['attributes']=_0x1e070a[_0xef07('0x31')][_0xef07('0x32')]?_0x1e070a['attributes']:_0x3ca6be[_0xef07('0x2d')];if(!_0x57985a[_0xef07('0x2e')][_0xef07('0x33')]('nolimit')){_0x1e070a[_0xef07('0x19')]=qs[_0xef07('0x19')](_0x57985a[_0xef07('0x2e')][_0xef07('0x19')]);_0x1e070a[_0xef07('0x17')]=qs[_0xef07('0x17')](_0x57985a['query'][_0xef07('0x17')]);}_0x1e070a[_0xef07('0x34')]=qs['sort'](_0x57985a[_0xef07('0x2e')][_0xef07('0x35')]);_0x1e070a[_0xef07('0x36')]=qs['filters'](_[_0xef07('0x37')](_0x57985a[_0xef07('0x2e')],_0x3ca6be[_0xef07('0x38')]),_0x47adbc);if(_0x57985a[_0xef07('0x2e')][_0xef07('0x39')]){_0x1e070a[_0xef07('0x36')]=_[_0xef07('0x3a')](_0x1e070a[_0xef07('0x36')],{'$or':_['map'](_0x47adbc,function(_0xb77bc2){if(_0xb77bc2['type']!==_0xef07('0x3b')){var _0x7f6cc1={};_0x7f6cc1[_0xb77bc2[_0xef07('0x25')]]={'$like':'%'+_0x57985a['query']['filter']+'%'};return _0x7f6cc1;}})});}_0x1e070a=_['merge']({},_0x1e070a,_0x57985a[_0xef07('0x3c')]);var _0x5161d3={'where':_0x1e070a[_0xef07('0x36')]};return db[_0xef07('0x29')]['count'](_0x5161d3)[_0xef07('0x21')](function(_0x63b025){_0x54d0e8[_0xef07('0x1a')]=_0x63b025;if(_0x57985a[_0xef07('0x2e')][_0xef07('0x3d')]){_0x1e070a['include']=[{'all':!![]}];}return db['MailServerOut'][_0xef07('0x3e')](_0x1e070a);})[_0xef07('0x21')](function(_0x231647){_0x54d0e8['rows']=_0x231647;return _0x54d0e8;})[_0xef07('0x21')](respondWithFilteredResult(_0x542370,_0x1e070a))[_0xef07('0x3f')](handleError(_0x542370,null));};exports[_0xef07('0x40')]=function(_0x131d64,_0x244636){var _0x1e2be5={'raw':!![],'where':{'id':_0x131d64[_0xef07('0x41')]['id']}},_0x24a8ae={};_0x24a8ae[_0xef07('0x2d')]=_[_0xef07('0x42')](db[_0xef07('0x29')][_0xef07('0x2a')]);_0x24a8ae[_0xef07('0x2e')]=_[_0xef07('0x42')](_0x131d64[_0xef07('0x2e')]);_0x24a8ae[_0xef07('0x38')]=_[_0xef07('0x2f')](_0x24a8ae[_0xef07('0x2d')],_0x24a8ae[_0xef07('0x2e')]);_0x1e2be5['attributes']=_[_0xef07('0x2f')](_0x24a8ae[_0xef07('0x2d')],qs[_0xef07('0x30')](_0x131d64[_0xef07('0x2e')]['fields']));_0x1e2be5['attributes']=_0x1e2be5[_0xef07('0x31')][_0xef07('0x32')]?_0x1e2be5['attributes']:_0x24a8ae[_0xef07('0x2d')];if(_0x131d64[_0xef07('0x2e')][_0xef07('0x3d')]){_0x1e2be5[_0xef07('0x43')]=[{'all':!![]}];}_0x1e2be5=_[_0xef07('0x3a')]({},_0x1e2be5,_0x131d64[_0xef07('0x3c')]);return db[_0xef07('0x29')][_0xef07('0x44')](_0x1e2be5)['then'](handleEntityNotFound(_0x244636,null))['then'](respondWithResult(_0x244636,null))[_0xef07('0x3f')](handleError(_0x244636,null));};exports[_0xef07('0x45')]=function(_0x18a81e,_0x30debc){return db[_0xef07('0x29')][_0xef07('0x45')](_0x18a81e[_0xef07('0x46')],{})[_0xef07('0x21')](respondWithResult(_0x30debc,0xc9))[_0xef07('0x3f')](handleError(_0x30debc,null));};exports[_0xef07('0x20')]=function(_0x379714,_0x5ad369){if(_0x379714['body']['id']){delete _0x379714[_0xef07('0x46')]['id'];}return db['MailServerOut'][_0xef07('0x44')]({'where':{'id':_0x379714[_0xef07('0x41')]['id']}})['then'](handleEntityNotFound(_0x5ad369,null))[_0xef07('0x21')](saveUpdates(_0x379714[_0xef07('0x46')],null))[_0xef07('0x21')](respondWithResult(_0x5ad369,null))[_0xef07('0x3f')](handleError(_0x5ad369,null));};exports['destroy']=function(_0x4b537c,_0x57cfde){return db[_0xef07('0x29')][_0xef07('0x44')]({'where':{'id':_0x4b537c[_0xef07('0x41')]['id']}})[_0xef07('0x21')](handleEntityNotFound(_0x57cfde,null))[_0xef07('0x21')](removeEntity(_0x57cfde,null))[_0xef07('0x3f')](handleError(_0x57cfde,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index d70a4cc..22e97eb 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 _0xf875=['path','rimraf','./mailServerOut.attributes','exports','define','mail_servers_out','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x4dfe12,_0x14adb1){var _0x1b778c=function(_0xf133d3){while(--_0xf133d3){_0x4dfe12['push'](_0x4dfe12['shift']());}};_0x1b778c(++_0x14adb1);}(_0xf875,0x66));var _0x5f87=function(_0x2dc0d9,_0x535d73){_0x2dc0d9=_0x2dc0d9-0x0;var _0x16e1da=_0xf875[_0x2dc0d9];return _0x16e1da;};'use strict';var _=require(_0x5f87('0x0'));var util=require('util');var logger=require(_0x5f87('0x1'))(_0x5f87('0x2'));var moment=require(_0x5f87('0x3'));var BPromise=require(_0x5f87('0x4'));var rp=require(_0x5f87('0x5'));var fs=require('fs');var path=require(_0x5f87('0x6'));var rimraf=require(_0x5f87('0x7'));var config=require('../../config/environment');var attributes=require(_0x5f87('0x8'));module[_0x5f87('0x9')]=function(_0x10cddd,_0x540179){return _0x10cddd[_0x5f87('0xa')]('MailServerOut',attributes,{'tableName':_0x5f87('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x175d=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./mailServerOut.attributes','exports','mail_servers_out','lodash'];(function(_0x379bb1,_0x2d7478){var _0x465a34=function(_0x28ca57){while(--_0x28ca57){_0x379bb1['push'](_0x379bb1['shift']());}};_0x465a34(++_0x2d7478);}(_0x175d,0xaf));var _0xd175=function(_0x49daf0,_0x4bd4ea){_0x49daf0=_0x49daf0-0x0;var _0x1e6819=_0x175d[_0x49daf0];return _0x1e6819;};'use strict';var _=require(_0xd175('0x0'));var util=require('util');var logger=require(_0xd175('0x1'))(_0xd175('0x2'));var moment=require(_0xd175('0x3'));var BPromise=require(_0xd175('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd175('0x5'));var rimraf=require(_0xd175('0x6'));var config=require(_0xd175('0x7'));var attributes=require(_0xd175('0x8'));module[_0xd175('0x9')]=function(_0x5df525,_0x1fd5fb){return _0x5df525['define']('MailServerOut',attributes,{'tableName':_0xd175('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.rpc.js b/server/api/mailServerOut/mailServerOut.rpc.js index 30b4012..0c376cf 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 _0x5f66=['../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','MailServerOut,\x20%s,\x20%s','request\x20sent','debug','MailServerOut,\x20%s,\x20%s,\x20%s','stringify','code','message','error','info','catch','util','bluebird','randomstring','ioredis'];(function(_0x414d01,_0x8d6d24){var _0x2c525c=function(_0x363740){while(--_0x363740){_0x414d01['push'](_0x414d01['shift']());}};_0x2c525c(++_0x8d6d24);}(_0x5f66,0x1a0));var _0x65f6=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x5f66[_0x3e5086];return _0xfeb102;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var moment=require('moment');var BPromise=require(_0x65f6('0x1'));var rs=require(_0x65f6('0x2'));var fs=require('fs');var Redis=require(_0x65f6('0x3'));var db=require(_0x65f6('0x4'))['db'];var utils=require(_0x65f6('0x5'));var logger=require('../../config/logger')(_0x65f6('0x6'));var config=require('../../config/environment');var jayson=require(_0x65f6('0x7'));var client=jayson[_0x65f6('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4ed98f,_0x1c0e12,_0x2c6571){return new BPromise(function(_0x112079,_0x8f6451){return client[_0x65f6('0x9')](_0x4ed98f,_0x2c6571)[_0x65f6('0xa')](function(_0x48d85c){logger['info'](_0x65f6('0xb'),_0x1c0e12,_0x65f6('0xc'));logger[_0x65f6('0xd')](_0x65f6('0xe'),_0x1c0e12,'request\x20sent',JSON[_0x65f6('0xf')](_0x48d85c));if(_0x48d85c['error']){if(_0x48d85c['error'][_0x65f6('0x10')]===0x1f4){logger['error'](_0x65f6('0xb'),_0x1c0e12,_0x48d85c['error'][_0x65f6('0x11')]);return _0x8f6451(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);return _0x112079(_0x48d85c[_0x65f6('0x12')][_0x65f6('0x11')]);}else{logger[_0x65f6('0x13')]('MailServerOut,\x20%s,\x20%s',_0x1c0e12,_0x65f6('0xc'));_0x112079(_0x48d85c['result']['message']);}})[_0x65f6('0x14')](function(_0x5c69f8){logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x5c69f8);_0x8f6451(_0x5c69f8);});});} \ No newline at end of file +var _0xdb28=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','MailServerOut,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','lodash','util'];(function(_0x1129ea,_0x58f5b1){var _0x3335de=function(_0x4f86b6){while(--_0x4f86b6){_0x1129ea['push'](_0x1129ea['shift']());}};_0x3335de(++_0x58f5b1);}(_0xdb28,0x106));var _0x8db2=function(_0x557487,_0x1d14cb){_0x557487=_0x557487-0x0;var _0x333a14=_0xdb28[_0x557487];return _0x333a14;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var moment=require(_0x8db2('0x2'));var BPromise=require(_0x8db2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8db2('0x4'));var db=require(_0x8db2('0x5'))['db'];var utils=require(_0x8db2('0x6'));var logger=require(_0x8db2('0x7'))(_0x8db2('0x8'));var config=require('../../config/environment');var jayson=require(_0x8db2('0x9'));var client=jayson[_0x8db2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x494b40,_0x477f50,_0x46932f){return new BPromise(function(_0x131537,_0x29f698){return client[_0x8db2('0xb')](_0x494b40,_0x46932f)[_0x8db2('0xc')](function(_0x126c78){logger['info'](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));logger[_0x8db2('0xf')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x477f50,_0x8db2('0xe'),JSON[_0x8db2('0x10')](_0x126c78));if(_0x126c78['error']){if(_0x126c78[_0x8db2('0x11')][_0x8db2('0x12')]===0x1f4){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')]['message']);return _0x29f698(_0x126c78['error'][_0x8db2('0x13')]);}logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);return _0x131537(_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);}else{logger[_0x8db2('0x14')](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));_0x131537(_0x126c78['result'][_0x8db2('0x13')]);}})[_0x8db2('0x15')](function(_0x48101e){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x48101e);_0x29f698(_0x48101e);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index 18e869a..1d4f35e 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 _0x85fb=['delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./mailSubstatus.controller','get','isAuthenticated','describe','/:id','show','post','put','update'];(function(_0x2bf7ce,_0x1ea138){var _0xa026b9=function(_0xa38980){while(--_0xa38980){_0x2bf7ce['push'](_0x2bf7ce['shift']());}};_0xa026b9(++_0x1ea138);}(_0x85fb,0x146));var _0xb85f=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x85fb[_0x57b54c];return _0x59cc19;};'use strict';var multer=require('multer');var util=require(_0xb85f('0x0'));var path=require(_0xb85f('0x1'));var timeout=require(_0xb85f('0x2'));var express=require(_0xb85f('0x3'));var router=express[_0xb85f('0x4')]();var fs_extra=require(_0xb85f('0x5'));var auth=require(_0xb85f('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xb85f('0x7'));router[_0xb85f('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xb85f('0x8')]('/describe',auth[_0xb85f('0x9')](),controller[_0xb85f('0xa')]);router[_0xb85f('0x8')](_0xb85f('0xb'),auth[_0xb85f('0x9')](),controller[_0xb85f('0xc')]);router[_0xb85f('0xd')]('/',auth[_0xb85f('0x9')](),controller['create']);router[_0xb85f('0xe')](_0xb85f('0xb'),auth[_0xb85f('0x9')](),controller[_0xb85f('0xf')]);router[_0xb85f('0x10')](_0xb85f('0xb'),auth[_0xb85f('0x9')](),controller[_0xb85f('0x11')]);module[_0xb85f('0x12')]=router; \ No newline at end of file +var _0x3b70=['describe','show','post','create','put','/:id','update','delete','exports','util','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','get','isAuthenticated','index','/describe'];(function(_0x435fa1,_0x58550a){var _0x845f9f=function(_0x89867e){while(--_0x89867e){_0x435fa1['push'](_0x435fa1['shift']());}};_0x845f9f(++_0x58550a);}(_0x3b70,0x135));var _0x03b7=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x3b70[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require('multer');var util=require(_0x03b7('0x0'));var path=require(_0x03b7('0x1'));var timeout=require(_0x03b7('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x03b7('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x03b7('0x4'));var config=require(_0x03b7('0x5'));var controller=require(_0x03b7('0x6'));router[_0x03b7('0x7')]('/',auth[_0x03b7('0x8')](),controller[_0x03b7('0x9')]);router['get'](_0x03b7('0xa'),auth['isAuthenticated'](),controller[_0x03b7('0xb')]);router['get']('/:id',auth[_0x03b7('0x8')](),controller[_0x03b7('0xc')]);router[_0x03b7('0xd')]('/',auth[_0x03b7('0x8')](),controller[_0x03b7('0xe')]);router[_0x03b7('0xf')](_0x03b7('0x10'),auth['isAuthenticated'](),controller[_0x03b7('0x11')]);router[_0x03b7('0x12')]('/:id',auth[_0x03b7('0x8')](),controller['destroy']);module[_0x03b7('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 bddd2cc..f5748b8 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 _0x1db9=['STRING','name','sequelize','exports'];(function(_0xf25afa,_0x1c11aa){var _0x246934=function(_0x38daae){while(--_0x38daae){_0xf25afa['push'](_0xf25afa['shift']());}};_0x246934(++_0x1c11aa);}(_0x1db9,0x176));var _0x91db=function(_0x32e170,_0xce274f){_0x32e170=_0x32e170-0x0;var _0x25bf24=_0x1db9[_0x32e170];return _0x25bf24;};'use strict';var Sequelize=require(_0x91db('0x0'));module[_0x91db('0x1')]={'name':{'type':Sequelize[_0x91db('0x2')],'unique':_0x91db('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x91db('0x2')]}}; \ No newline at end of file +var _0x9fe7=['exports','name','sequelize'];(function(_0x3bd497,_0x37d7a8){var _0x32f967=function(_0x1b84ba){while(--_0x1b84ba){_0x3bd497['push'](_0x3bd497['shift']());}};_0x32f967(++_0x37d7a8);}(_0x9fe7,0x1df));var _0x79fe=function(_0x5b1120,_0x4c6c53){_0x5b1120=_0x5b1120-0x0;var _0x34e1a1=_0x9fe7[_0x5b1120];return _0x34e1a1;};'use strict';var Sequelize=require(_0x79fe('0x0'));module[_0x79fe('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x79fe('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index 35370a3..ec0b322 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 _0x8a28=['type','query','keys','filters','intersection','model','attributes','fields','length','sort','where','filter','merge','VIRTUAL','includeAll','rows','show','params','include','catch','create','body','find','describe','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','sendStatus','end','status','json','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','MailSubstatus','rawAttributes'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x8a28,0xe7));var _0x88a2=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0x8a28[_0x3a6efd];return _0x487b9a;};'use strict';var emlformat=require(_0x88a2('0x0'));var rimraf=require(_0x88a2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x88a2('0x2'));var rp=require(_0x88a2('0x3'));var moment=require('moment');var BPromise=require(_0x88a2('0x4'));var Mustache=require('mustache');var util=require(_0x88a2('0x5'));var path=require('path');var sox=require(_0x88a2('0x6'));var csv=require(_0x88a2('0x7'));var ejs=require(_0x88a2('0x8'));var fs=require('fs');var fs_extra=require(_0x88a2('0x9'));var _=require(_0x88a2('0xa'));var squel=require(_0x88a2('0xb'));var crypto=require(_0x88a2('0xc'));var jsforce=require(_0x88a2('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x88a2('0x7'));var querystring=require(_0x88a2('0xe'));var Papa=require(_0x88a2('0xf'));var Redis=require(_0x88a2('0x10'));var authService=require(_0x88a2('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x88a2('0x12'));var hardwareService=require(_0x88a2('0x13'));var logger=require('../../config/logger')(_0x88a2('0x14'));var utils=require(_0x88a2('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x88a2('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x48715f,_0x33daf3){_0x33daf3=_0x33daf3||0xcc;return function(_0x4664b5){if(_0x4664b5){return _0x48715f[_0x88a2('0x17')](_0x33daf3);}return _0x48715f['status'](_0x33daf3)[_0x88a2('0x18')]();};}function respondWithResult(_0x650cf3,_0x5efecb){_0x5efecb=_0x5efecb||0xc8;return function(_0x26d42d){if(_0x26d42d){return _0x650cf3[_0x88a2('0x19')](_0x5efecb)[_0x88a2('0x1a')](_0x26d42d);}};}function respondWithFilteredResult(_0x1ca3fd,_0x59b860){return function(_0x127744){if(_0x127744){var _0x53bef4=typeof _0x59b860['offset']==='undefined'&&typeof _0x59b860[_0x88a2('0x1b')]==='undefined';var _0x530588=_0x127744[_0x88a2('0x1c')];var _0x3d5dae=_0x53bef4?0x0:_0x59b860[_0x88a2('0x1d')];var _0x437ce5=_0x53bef4?_0x127744[_0x88a2('0x1c')]:_0x59b860['offset']+_0x59b860[_0x88a2('0x1b')];var _0x7ee5ec;if(_0x437ce5>=_0x530588){_0x437ce5=_0x530588;_0x7ee5ec=0xc8;}else{_0x7ee5ec=0xce;}_0x1ca3fd[_0x88a2('0x19')](_0x7ee5ec);return _0x1ca3fd[_0x88a2('0x1e')](_0x88a2('0x1f'),_0x3d5dae+'-'+_0x437ce5+'/'+_0x530588)[_0x88a2('0x1a')](_0x127744);}return null;};}function patchUpdates(_0x3403ab){return function(_0x5b88bf){try{jsonpatch[_0x88a2('0x20')](_0x5b88bf,_0x3403ab,!![]);}catch(_0x2a5d27){return BPromise[_0x88a2('0x21')](_0x2a5d27);}return _0x5b88bf[_0x88a2('0x22')]();};}function saveUpdates(_0x488bc8,_0x36fbdf){return function(_0x43ee56){if(_0x43ee56){return _0x43ee56[_0x88a2('0x23')](_0x488bc8)[_0x88a2('0x24')](function(_0x4d98c9){return _0x4d98c9;});}return null;};}function removeEntity(_0x192a67,_0x2e7abf){return function(_0x57c10c){if(_0x57c10c){return _0x57c10c[_0x88a2('0x25')]()['then'](function(){_0x192a67[_0x88a2('0x19')](0xcc)[_0x88a2('0x18')]();});}};}function handleEntityNotFound(_0x20702f,_0x4660b1){return function(_0x3a3ea1){if(!_0x3a3ea1){_0x20702f['sendStatus'](0x194);}return _0x3a3ea1;};}function handleError(_0x4e5b43,_0x3eecf2){_0x3eecf2=_0x3eecf2||0x1f4;return function(_0x3d7e4d){logger[_0x88a2('0x26')](_0x3d7e4d['stack']);if(_0x3d7e4d[_0x88a2('0x27')]){delete _0x3d7e4d['name'];}_0x4e5b43[_0x88a2('0x19')](_0x3eecf2)[_0x88a2('0x28')](_0x3d7e4d);};}exports[_0x88a2('0x29')]=function(_0xf9f4c5,_0x32c9b3){var _0x2ca93b={},_0x52dc58={},_0x22f071={'count':0x0,'rows':[]};var _0x4e28fb=_[_0x88a2('0x2a')](db[_0x88a2('0x2b')][_0x88a2('0x2c')],function(_0x172ee1){return{'name':_0x172ee1['fieldName'],'type':_0x172ee1[_0x88a2('0x2d')]['key']};});_0x52dc58['model']=_[_0x88a2('0x2a')](_0x4e28fb,_0x88a2('0x27'));_0x52dc58[_0x88a2('0x2e')]=_[_0x88a2('0x2f')](_0xf9f4c5[_0x88a2('0x2e')]);_0x52dc58[_0x88a2('0x30')]=_[_0x88a2('0x31')](_0x52dc58[_0x88a2('0x32')],_0x52dc58[_0x88a2('0x2e')]);_0x2ca93b[_0x88a2('0x33')]=_[_0x88a2('0x31')](_0x52dc58[_0x88a2('0x32')],qs[_0x88a2('0x34')](_0xf9f4c5[_0x88a2('0x2e')][_0x88a2('0x34')]));_0x2ca93b['attributes']=_0x2ca93b['attributes'][_0x88a2('0x35')]?_0x2ca93b[_0x88a2('0x33')]:_0x52dc58['model'];if(!_0xf9f4c5[_0x88a2('0x2e')]['hasOwnProperty']('nolimit')){_0x2ca93b[_0x88a2('0x1b')]=qs[_0x88a2('0x1b')](_0xf9f4c5[_0x88a2('0x2e')][_0x88a2('0x1b')]);_0x2ca93b[_0x88a2('0x1d')]=qs[_0x88a2('0x1d')](_0xf9f4c5[_0x88a2('0x2e')][_0x88a2('0x1d')]);}_0x2ca93b['order']=qs[_0x88a2('0x36')](_0xf9f4c5[_0x88a2('0x2e')][_0x88a2('0x36')]);_0x2ca93b[_0x88a2('0x37')]=qs[_0x88a2('0x30')](_['pick'](_0xf9f4c5[_0x88a2('0x2e')],_0x52dc58['filters']),_0x4e28fb);if(_0xf9f4c5[_0x88a2('0x2e')][_0x88a2('0x38')]){_0x2ca93b[_0x88a2('0x37')]=_[_0x88a2('0x39')](_0x2ca93b[_0x88a2('0x37')],{'$or':_[_0x88a2('0x2a')](_0x4e28fb,function(_0x9267b1){if(_0x9267b1[_0x88a2('0x2d')]!==_0x88a2('0x3a')){var _0x3fe10c={};_0x3fe10c[_0x9267b1[_0x88a2('0x27')]]={'$like':'%'+_0xf9f4c5[_0x88a2('0x2e')][_0x88a2('0x38')]+'%'};return _0x3fe10c;}})});}_0x2ca93b=_[_0x88a2('0x39')]({},_0x2ca93b,_0xf9f4c5['options']);var _0x7d92fa={'where':_0x2ca93b[_0x88a2('0x37')]};return db[_0x88a2('0x2b')][_0x88a2('0x1c')](_0x7d92fa)[_0x88a2('0x24')](function(_0xfdb7e2){_0x22f071['count']=_0xfdb7e2;if(_0xf9f4c5[_0x88a2('0x2e')][_0x88a2('0x3b')]){_0x2ca93b['include']=[{'all':!![]}];}return db['MailSubstatus']['findAll'](_0x2ca93b);})[_0x88a2('0x24')](function(_0x5f2587){_0x22f071[_0x88a2('0x3c')]=_0x5f2587;return _0x22f071;})[_0x88a2('0x24')](respondWithFilteredResult(_0x32c9b3,_0x2ca93b))['catch'](handleError(_0x32c9b3,null));};exports[_0x88a2('0x3d')]=function(_0x24de4d,_0x2258bb){var _0x1add4a={'raw':!![],'where':{'id':_0x24de4d[_0x88a2('0x3e')]['id']}},_0x526a13={};_0x526a13[_0x88a2('0x32')]=_[_0x88a2('0x2f')](db[_0x88a2('0x2b')][_0x88a2('0x2c')]);_0x526a13[_0x88a2('0x2e')]=_[_0x88a2('0x2f')](_0x24de4d['query']);_0x526a13[_0x88a2('0x30')]=_[_0x88a2('0x31')](_0x526a13[_0x88a2('0x32')],_0x526a13[_0x88a2('0x2e')]);_0x1add4a[_0x88a2('0x33')]=_[_0x88a2('0x31')](_0x526a13['model'],qs[_0x88a2('0x34')](_0x24de4d[_0x88a2('0x2e')][_0x88a2('0x34')]));_0x1add4a[_0x88a2('0x33')]=_0x1add4a[_0x88a2('0x33')][_0x88a2('0x35')]?_0x1add4a[_0x88a2('0x33')]:_0x526a13[_0x88a2('0x32')];if(_0x24de4d[_0x88a2('0x2e')][_0x88a2('0x3b')]){_0x1add4a[_0x88a2('0x3f')]=[{'all':!![]}];}_0x1add4a=_['merge']({},_0x1add4a,_0x24de4d['options']);return db[_0x88a2('0x2b')]['find'](_0x1add4a)[_0x88a2('0x24')](handleEntityNotFound(_0x2258bb,null))[_0x88a2('0x24')](respondWithResult(_0x2258bb,null))[_0x88a2('0x40')](handleError(_0x2258bb,null));};exports[_0x88a2('0x41')]=function(_0x5616e6,_0x8cb91c){return db[_0x88a2('0x2b')]['create'](_0x5616e6[_0x88a2('0x42')],{})[_0x88a2('0x24')](respondWithResult(_0x8cb91c,0xc9))[_0x88a2('0x40')](handleError(_0x8cb91c,null));};exports['update']=function(_0xb3853b,_0x288ba1){if(_0xb3853b['body']['id']){delete _0xb3853b['body']['id'];}return db['MailSubstatus'][_0x88a2('0x43')]({'where':{'id':_0xb3853b[_0x88a2('0x3e')]['id']}})[_0x88a2('0x24')](handleEntityNotFound(_0x288ba1,null))[_0x88a2('0x24')](saveUpdates(_0xb3853b[_0x88a2('0x42')],null))['then'](respondWithResult(_0x288ba1,null))[_0x88a2('0x40')](handleError(_0x288ba1,null));};exports[_0x88a2('0x25')]=function(_0x5f32d5,_0x5adfee){return db['MailSubstatus'][_0x88a2('0x43')]({'where':{'id':_0x5f32d5['params']['id']}})[_0x88a2('0x24')](handleEntityNotFound(_0x5adfee,null))['then'](removeEntity(_0x5adfee,null))[_0x88a2('0x40')](handleError(_0x5adfee,null));};exports[_0x88a2('0x44')]=function(_0x17a9fe,_0x557e50){return db[_0x88a2('0x2b')][_0x88a2('0x44')]()['then'](respondWithResult(_0x557e50,null))[_0x88a2('0x40')](handleError(_0x557e50,null));}; \ No newline at end of file +var _0xc649=['json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','error','stack','name','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','MailSubstatus','then','includeAll','include','findAll','rows','catch','show','params','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','lodash','squel','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status'];(function(_0x208c3d,_0x98456e){var _0x465437=function(_0x1f6cf3){while(--_0x1f6cf3){_0x208c3d['push'](_0x208c3d['shift']());}};_0x465437(++_0x98456e);}(_0xc649,0x10e));var _0x9c64=function(_0x4ea8b8,_0x1dbf97){_0x4ea8b8=_0x4ea8b8-0x0;var _0x57de70=_0xc649[_0x4ea8b8];return _0x57de70;};'use strict';var emlformat=require(_0x9c64('0x0'));var rimraf=require(_0x9c64('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9c64('0x2'));var rp=require(_0x9c64('0x3'));var moment=require('moment');var BPromise=require(_0x9c64('0x4'));var Mustache=require(_0x9c64('0x5'));var util=require(_0x9c64('0x6'));var path=require(_0x9c64('0x7'));var sox=require(_0x9c64('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9c64('0x9'));var squel=require(_0x9c64('0xa'));var crypto=require('crypto');var jsforce=require(_0x9c64('0xb'));var deskjs=require(_0x9c64('0xc'));var toCsv=require(_0x9c64('0xd'));var querystring=require('querystring');var Papa=require(_0x9c64('0xe'));var Redis=require(_0x9c64('0xf'));var authService=require(_0x9c64('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9c64('0x11'));var logger=require(_0x9c64('0x12'))('api');var utils=require(_0x9c64('0x13'));var config=require(_0x9c64('0x14'));var licenseUtil=require(_0x9c64('0x15'));var db=require(_0x9c64('0x16'))['db'];function respondWithStatusCode(_0x1b0239,_0x4424e2){_0x4424e2=_0x4424e2||0xcc;return function(_0x28d41d){if(_0x28d41d){return _0x1b0239[_0x9c64('0x17')](_0x4424e2);}return _0x1b0239['status'](_0x4424e2)[_0x9c64('0x18')]();};}function respondWithResult(_0x54acd8,_0x5d91e8){_0x5d91e8=_0x5d91e8||0xc8;return function(_0x125b4e){if(_0x125b4e){return _0x54acd8[_0x9c64('0x19')](_0x5d91e8)[_0x9c64('0x1a')](_0x125b4e);}};}function respondWithFilteredResult(_0x2e2b77,_0x1e8e9e){return function(_0x1c2ce3){if(_0x1c2ce3){var _0x4dfcd7=typeof _0x1e8e9e[_0x9c64('0x1b')]===_0x9c64('0x1c')&&typeof _0x1e8e9e[_0x9c64('0x1d')]===_0x9c64('0x1c');var _0x5e0dd3=_0x1c2ce3[_0x9c64('0x1e')];var _0x2e813a=_0x4dfcd7?0x0:_0x1e8e9e[_0x9c64('0x1b')];var _0x26b422=_0x4dfcd7?_0x1c2ce3[_0x9c64('0x1e')]:_0x1e8e9e['offset']+_0x1e8e9e['limit'];var _0x2e5937;if(_0x26b422>=_0x5e0dd3){_0x26b422=_0x5e0dd3;_0x2e5937=0xc8;}else{_0x2e5937=0xce;}_0x2e2b77[_0x9c64('0x19')](_0x2e5937);return _0x2e2b77[_0x9c64('0x1f')](_0x9c64('0x20'),_0x2e813a+'-'+_0x26b422+'/'+_0x5e0dd3)[_0x9c64('0x1a')](_0x1c2ce3);}return null;};}function patchUpdates(_0x575360){return function(_0xcb5b3d){try{jsonpatch[_0x9c64('0x21')](_0xcb5b3d,_0x575360,!![]);}catch(_0x1f3402){return BPromise[_0x9c64('0x22')](_0x1f3402);}return _0xcb5b3d[_0x9c64('0x23')]();};}function saveUpdates(_0x487e43,_0x2d1266){return function(_0x1e7a9f){if(_0x1e7a9f){return _0x1e7a9f[_0x9c64('0x24')](_0x487e43)['then'](function(_0x333a89){return _0x333a89;});}return null;};}function removeEntity(_0x49bf20,_0x3ecf74){return function(_0x93ff68){if(_0x93ff68){return _0x93ff68[_0x9c64('0x25')]()['then'](function(){_0x49bf20['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x448f13,_0x1d4b6a){return function(_0x4c28b6){if(!_0x4c28b6){_0x448f13[_0x9c64('0x17')](0x194);}return _0x4c28b6;};}function handleError(_0x56bc56,_0x38480a){_0x38480a=_0x38480a||0x1f4;return function(_0xe38523){logger[_0x9c64('0x26')](_0xe38523[_0x9c64('0x27')]);if(_0xe38523[_0x9c64('0x28')]){delete _0xe38523[_0x9c64('0x28')];}_0x56bc56[_0x9c64('0x19')](_0x38480a)['send'](_0xe38523);};}exports['index']=function(_0xf9e763,_0x14f0b2){var _0x12df4f={},_0x52c522={},_0x231a77={'count':0x0,'rows':[]};var _0x283a32=_[_0x9c64('0x29')](db['MailSubstatus'][_0x9c64('0x2a')],function(_0x2c580c){return{'name':_0x2c580c[_0x9c64('0x2b')],'type':_0x2c580c[_0x9c64('0x2c')][_0x9c64('0x2d')]};});_0x52c522[_0x9c64('0x2e')]=_[_0x9c64('0x29')](_0x283a32,'name');_0x52c522['query']=_[_0x9c64('0x2f')](_0xf9e763[_0x9c64('0x30')]);_0x52c522[_0x9c64('0x31')]=_[_0x9c64('0x32')](_0x52c522[_0x9c64('0x2e')],_0x52c522['query']);_0x12df4f[_0x9c64('0x33')]=_[_0x9c64('0x32')](_0x52c522[_0x9c64('0x2e')],qs[_0x9c64('0x34')](_0xf9e763['query'][_0x9c64('0x34')]));_0x12df4f[_0x9c64('0x33')]=_0x12df4f[_0x9c64('0x33')][_0x9c64('0x35')]?_0x12df4f[_0x9c64('0x33')]:_0x52c522['model'];if(!_0xf9e763[_0x9c64('0x30')][_0x9c64('0x36')](_0x9c64('0x37'))){_0x12df4f['limit']=qs[_0x9c64('0x1d')](_0xf9e763['query'][_0x9c64('0x1d')]);_0x12df4f[_0x9c64('0x1b')]=qs[_0x9c64('0x1b')](_0xf9e763['query']['offset']);}_0x12df4f['order']=qs[_0x9c64('0x38')](_0xf9e763[_0x9c64('0x30')]['sort']);_0x12df4f[_0x9c64('0x39')]=qs[_0x9c64('0x31')](_[_0x9c64('0x3a')](_0xf9e763['query'],_0x52c522[_0x9c64('0x31')]),_0x283a32);if(_0xf9e763[_0x9c64('0x30')][_0x9c64('0x3b')]){_0x12df4f[_0x9c64('0x39')]=_[_0x9c64('0x3c')](_0x12df4f[_0x9c64('0x39')],{'$or':_[_0x9c64('0x29')](_0x283a32,function(_0x3027d5){if(_0x3027d5[_0x9c64('0x2c')]!=='VIRTUAL'){var _0x26499a={};_0x26499a[_0x3027d5[_0x9c64('0x28')]]={'$like':'%'+_0xf9e763[_0x9c64('0x30')][_0x9c64('0x3b')]+'%'};return _0x26499a;}})});}_0x12df4f=_[_0x9c64('0x3c')]({},_0x12df4f,_0xf9e763[_0x9c64('0x3d')]);var _0xf0594d={'where':_0x12df4f[_0x9c64('0x39')]};return db[_0x9c64('0x3e')][_0x9c64('0x1e')](_0xf0594d)[_0x9c64('0x3f')](function(_0x43f4da){_0x231a77[_0x9c64('0x1e')]=_0x43f4da;if(_0xf9e763[_0x9c64('0x30')][_0x9c64('0x40')]){_0x12df4f[_0x9c64('0x41')]=[{'all':!![]}];}return db['MailSubstatus'][_0x9c64('0x42')](_0x12df4f);})[_0x9c64('0x3f')](function(_0x360bd8){_0x231a77[_0x9c64('0x43')]=_0x360bd8;return _0x231a77;})['then'](respondWithFilteredResult(_0x14f0b2,_0x12df4f))[_0x9c64('0x44')](handleError(_0x14f0b2,null));};exports[_0x9c64('0x45')]=function(_0x25cbdf,_0x5b860a){var _0x449310={'raw':!![],'where':{'id':_0x25cbdf[_0x9c64('0x46')]['id']}},_0x1e9660={};_0x1e9660[_0x9c64('0x2e')]=_[_0x9c64('0x2f')](db[_0x9c64('0x3e')][_0x9c64('0x2a')]);_0x1e9660[_0x9c64('0x30')]=_['keys'](_0x25cbdf['query']);_0x1e9660[_0x9c64('0x31')]=_[_0x9c64('0x32')](_0x1e9660[_0x9c64('0x2e')],_0x1e9660[_0x9c64('0x30')]);_0x449310[_0x9c64('0x33')]=_[_0x9c64('0x32')](_0x1e9660[_0x9c64('0x2e')],qs['fields'](_0x25cbdf[_0x9c64('0x30')][_0x9c64('0x34')]));_0x449310['attributes']=_0x449310[_0x9c64('0x33')][_0x9c64('0x35')]?_0x449310['attributes']:_0x1e9660[_0x9c64('0x2e')];if(_0x25cbdf['query'][_0x9c64('0x40')]){_0x449310[_0x9c64('0x41')]=[{'all':!![]}];}_0x449310=_[_0x9c64('0x3c')]({},_0x449310,_0x25cbdf[_0x9c64('0x3d')]);return db['MailSubstatus'][_0x9c64('0x47')](_0x449310)['then'](handleEntityNotFound(_0x5b860a,null))[_0x9c64('0x3f')](respondWithResult(_0x5b860a,null))[_0x9c64('0x44')](handleError(_0x5b860a,null));};exports[_0x9c64('0x48')]=function(_0x257383,_0x4cd26a){return db['MailSubstatus'][_0x9c64('0x48')](_0x257383[_0x9c64('0x49')],{})['then'](respondWithResult(_0x4cd26a,0xc9))[_0x9c64('0x44')](handleError(_0x4cd26a,null));};exports['update']=function(_0x5dd6db,_0xae3023){if(_0x5dd6db[_0x9c64('0x49')]['id']){delete _0x5dd6db[_0x9c64('0x49')]['id'];}return db[_0x9c64('0x3e')][_0x9c64('0x47')]({'where':{'id':_0x5dd6db[_0x9c64('0x46')]['id']}})[_0x9c64('0x3f')](handleEntityNotFound(_0xae3023,null))[_0x9c64('0x3f')](saveUpdates(_0x5dd6db[_0x9c64('0x49')],null))[_0x9c64('0x3f')](respondWithResult(_0xae3023,null))[_0x9c64('0x44')](handleError(_0xae3023,null));};exports[_0x9c64('0x25')]=function(_0x369be2,_0x252ecb){return db['MailSubstatus']['find']({'where':{'id':_0x369be2['params']['id']}})[_0x9c64('0x3f')](handleEntityNotFound(_0x252ecb,null))[_0x9c64('0x3f')](removeEntity(_0x252ecb,null))['catch'](handleError(_0x252ecb,null));};exports['describe']=function(_0x53c794,_0xf2e6ed){return db[_0x9c64('0x3e')]['describe']()[_0x9c64('0x3f')](respondWithResult(_0xf2e6ed,null))[_0x9c64('0x44')](handleError(_0xf2e6ed,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.events.js b/server/api/mailSubstatus/mailSubstatus.events.js index 59a4728..c768aa1 100644 --- a/server/api/mailSubstatus/mailSubstatus.events.js +++ b/server/api/mailSubstatus/mailSubstatus.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb4a8=['events','setMaxListeners','update','emit','hasOwnProperty','hook','exports'];(function(_0x5f12fd,_0x33c70d){var _0x58bd80=function(_0x515f56){while(--_0x515f56){_0x5f12fd['push'](_0x5f12fd['shift']());}};_0x58bd80(++_0x33c70d);}(_0xb4a8,0x1ab));var _0x8b4a=function(_0x211fef,_0x4ab716){_0x211fef=_0x211fef-0x0;var _0x5447bf=_0xb4a8[_0x211fef];return _0x5447bf;};'use strict';var EventEmitter=require(_0x8b4a('0x0'));var MailSubstatus=require('../../mysqldb')['db']['MailSubstatus'];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x8b4a('0x1')](0x0);var events={'afterUpdate':_0x8b4a('0x2')};function emitEvent(_0x589a55){return function(_0x150e5e,_0x23ac8f,_0x5e38d0){MailSubstatusEvents[_0x8b4a('0x3')](_0x589a55+':'+_0x150e5e['id'],_0x150e5e);MailSubstatusEvents[_0x8b4a('0x3')](_0x589a55,_0x150e5e);_0x5e38d0(null);};}for(var e in events){if(events[_0x8b4a('0x4')](e)){var event=events[e];MailSubstatus[_0x8b4a('0x5')](e,emitEvent(event));}}module[_0x8b4a('0x6')]=MailSubstatusEvents; \ No newline at end of file +var _0x5085=['setMaxListeners','update','emit','hasOwnProperty','events','../../mysqldb'];(function(_0x52aa78,_0xcb760){var _0x135b45=function(_0x31da4a){while(--_0x31da4a){_0x52aa78['push'](_0x52aa78['shift']());}};_0x135b45(++_0xcb760);}(_0x5085,0x1e4));var _0x5508=function(_0xfb627b,_0xf64036){_0xfb627b=_0xfb627b-0x0;var _0x178281=_0x5085[_0xfb627b];return _0x178281;};'use strict';var EventEmitter=require(_0x5508('0x0'));var MailSubstatus=require(_0x5508('0x1'))['db']['MailSubstatus'];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x5508('0x2')](0x0);var events={'afterUpdate':_0x5508('0x3')};function emitEvent(_0x18bb7c){return function(_0x214ab6,_0x1b52df,_0x437fe3){MailSubstatusEvents[_0x5508('0x4')](_0x18bb7c+':'+_0x214ab6['id'],_0x214ab6);MailSubstatusEvents[_0x5508('0x4')](_0x18bb7c,_0x214ab6);_0x437fe3(null);};}for(var e in events){if(events[_0x5508('0x5')](e)){var event=events[e];MailSubstatus['hook'](e,emitEvent(event));}}module['exports']=MailSubstatusEvents; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index e2bea90..98ba1e9 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 _0xab86=['MailSubstatus','Condition','update','name','_previousDataValues','catch','exports','define'];(function(_0x9df060,_0x253d33){var _0x338dfe=function(_0x17d9a5){while(--_0x17d9a5){_0x9df060['push'](_0x9df060['shift']());}};_0x338dfe(++_0x253d33);}(_0xab86,0xce));var _0x6ab8=function(_0x1a93a5,_0x13f256){_0x1a93a5=_0x1a93a5-0x0;var _0x4893a2=_0xab86[_0x1a93a5];return _0x4893a2;};'use strict';var attributes=require('./mailSubstatus.attributes');module[_0x6ab8('0x0')]=function(_0x58cfab){var _0x3267a3=_0x58cfab['models'];return _0x58cfab[_0x6ab8('0x1')](_0x6ab8('0x2'),attributes,{'tableName':'mail_substatuses','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0xbcdb96,_0x4e805a,_0x2b55b4){return _0x3267a3[_0x6ab8('0x3')][_0x6ab8('0x4')]({'value':_0xbcdb96[_0x6ab8('0x5')]},{'where':{'field':'mailSubstatus','value':_0xbcdb96[_0x6ab8('0x6')][_0x6ab8('0x5')]}})['then'](function(){_0x2b55b4();})[_0x6ab8('0x7')](function(_0x4256d2){_0x2b55b4(_0x4256d2);});}}});}; \ No newline at end of file +var _0x0ab7=['Condition','update','name','mailSubstatus','_previousDataValues','then','./mailSubstatus.attributes','MailSubstatus'];(function(_0x41c911,_0x464097){var _0xdeb77b=function(_0x3b17a4){while(--_0x3b17a4){_0x41c911['push'](_0x41c911['shift']());}};_0xdeb77b(++_0x464097);}(_0x0ab7,0x136));var _0x70ab=function(_0x385b04,_0x2ce85e){_0x385b04=_0x385b04-0x0;var _0x21ec67=_0x0ab7[_0x385b04];return _0x21ec67;};'use strict';var attributes=require(_0x70ab('0x0'));module['exports']=function(_0x4fde9c){var _0x403c30=_0x4fde9c['models'];return _0x4fde9c['define'](_0x70ab('0x1'),attributes,{'tableName':'mail_substatuses','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x23ce9e,_0x49cd43,_0x47079f){return _0x403c30[_0x70ab('0x2')][_0x70ab('0x3')]({'value':_0x23ce9e[_0x70ab('0x4')]},{'where':{'field':_0x70ab('0x5'),'value':_0x23ce9e[_0x70ab('0x6')][_0x70ab('0x4')]}})[_0x70ab('0x7')](function(){_0x47079f();})['catch'](function(_0x21242d){_0x47079f(_0x21242d);});}}});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index eb68f0a..75128b8 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 _0x0c5b=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','MailSubstatus,\x20%s,\x20%s,\x20%s','error','MailSubstatus,\x20%s,\x20%s','message','request\x20sent','catch','lodash','util'];(function(_0x1ca090,_0x1890ba){var _0x495cbb=function(_0x533836){while(--_0x533836){_0x1ca090['push'](_0x1ca090['shift']());}};_0x495cbb(++_0x1890ba);}(_0x0c5b,0x9e));var _0xb0c5=function(_0x545c58,_0x3bff18){_0x545c58=_0x545c58-0x0;var _0xe42d93=_0x0c5b[_0x545c58];return _0xe42d93;};'use strict';var _=require(_0xb0c5('0x0'));var util=require(_0xb0c5('0x1'));var moment=require('moment');var BPromise=require(_0xb0c5('0x2'));var rs=require(_0xb0c5('0x3'));var fs=require('fs');var Redis=require(_0xb0c5('0x4'));var db=require(_0xb0c5('0x5'))['db'];var utils=require(_0xb0c5('0x6'));var logger=require(_0xb0c5('0x7'))(_0xb0c5('0x8'));var config=require(_0xb0c5('0x9'));var jayson=require(_0xb0c5('0xa'));var client=jayson[_0xb0c5('0xb')][_0xb0c5('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1c35cc,_0x3011e1,_0x5c4fab){return new BPromise(function(_0x3ce140,_0x31e18a){return client['request'](_0x1c35cc,_0x5c4fab)['then'](function(_0x22e340){logger[_0xb0c5('0xd')]('MailSubstatus,\x20%s,\x20%s',_0x3011e1,'request\x20sent');logger['debug'](_0xb0c5('0xe'),_0x3011e1,'request\x20sent',JSON['stringify'](_0x22e340));if(_0x22e340['error']){if(_0x22e340[_0xb0c5('0xf')]['code']===0x1f4){logger['error'](_0xb0c5('0x10'),_0x3011e1,_0x22e340[_0xb0c5('0xf')][_0xb0c5('0x11')]);return _0x31e18a(_0x22e340[_0xb0c5('0xf')][_0xb0c5('0x11')]);}logger[_0xb0c5('0xf')]('MailSubstatus,\x20%s,\x20%s',_0x3011e1,_0x22e340[_0xb0c5('0xf')][_0xb0c5('0x11')]);return _0x3ce140(_0x22e340[_0xb0c5('0xf')][_0xb0c5('0x11')]);}else{logger[_0xb0c5('0xd')](_0xb0c5('0x10'),_0x3011e1,_0xb0c5('0x12'));_0x3ce140(_0x22e340['result'][_0xb0c5('0x11')]);}})[_0xb0c5('0x13')](function(_0x16cae6){logger[_0xb0c5('0xf')](_0xb0c5('0x10'),_0x3011e1,_0x16cae6);_0x31e18a(_0x16cae6);});});} \ No newline at end of file +var _0x63e5=['debug','MailSubstatus,\x20%s,\x20%s,\x20%s','error','MailSubstatus,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent'];(function(_0x21282e,_0x3452c7){var _0x68330a=function(_0x4a38dd){while(--_0x4a38dd){_0x21282e['push'](_0x21282e['shift']());}};_0x68330a(++_0x3452c7);}(_0x63e5,0x74));var _0x563e=function(_0xe73080,_0x24c56d){_0xe73080=_0xe73080-0x0;var _0x12cbc4=_0x63e5[_0xe73080];return _0x12cbc4;};'use strict';var _=require(_0x563e('0x0'));var util=require(_0x563e('0x1'));var moment=require(_0x563e('0x2'));var BPromise=require(_0x563e('0x3'));var rs=require(_0x563e('0x4'));var fs=require('fs');var Redis=require(_0x563e('0x5'));var db=require(_0x563e('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x563e('0x7'))(_0x563e('0x8'));var config=require(_0x563e('0x9'));var jayson=require(_0x563e('0xa'));var client=jayson[_0x563e('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5971fe,_0x5b1d30,_0x342336){return new BPromise(function(_0x284da1,_0x938ac3){return client[_0x563e('0xc')](_0x5971fe,_0x342336)[_0x563e('0xd')](function(_0x694bd0){logger[_0x563e('0xe')]('MailSubstatus,\x20%s,\x20%s',_0x5b1d30,_0x563e('0xf'));logger[_0x563e('0x10')](_0x563e('0x11'),_0x5b1d30,_0x563e('0xf'),JSON['stringify'](_0x694bd0));if(_0x694bd0[_0x563e('0x12')]){if(_0x694bd0[_0x563e('0x12')]['code']===0x1f4){logger[_0x563e('0x12')](_0x563e('0x13'),_0x5b1d30,_0x694bd0[_0x563e('0x12')][_0x563e('0x14')]);return _0x938ac3(_0x694bd0[_0x563e('0x12')][_0x563e('0x14')]);}logger[_0x563e('0x12')](_0x563e('0x13'),_0x5b1d30,_0x694bd0[_0x563e('0x12')][_0x563e('0x14')]);return _0x284da1(_0x694bd0[_0x563e('0x12')][_0x563e('0x14')]);}else{logger[_0x563e('0xe')](_0x563e('0x13'),_0x5b1d30,_0x563e('0xf'));_0x284da1(_0x694bd0['result'][_0x563e('0x14')]);}})[_0x563e('0x15')](function(_0x51bd52){logger[_0x563e('0x12')]('MailSubstatus,\x20%s,\x20%s',_0x5b1d30,_0x51bd52);_0x938ac3(_0x51bd52);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index ff088a1..a143edf 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 _0xbf4d=['get','isAuthenticated','/describe','describe','post','create','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailTransferReport.controller'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbf4d,0x1d9));var _0xdbf4=function(_0x22a1e0,_0x279d8b){_0x22a1e0=_0x22a1e0-0x0;var _0x5d0dc7=_0xbf4d[_0x22a1e0];return _0x5d0dc7;};'use strict';var multer=require(_0xdbf4('0x0'));var util=require(_0xdbf4('0x1'));var path=require(_0xdbf4('0x2'));var timeout=require(_0xdbf4('0x3'));var express=require(_0xdbf4('0x4'));var router=express['Router']();var fs_extra=require(_0xdbf4('0x5'));var auth=require(_0xdbf4('0x6'));var interaction=require(_0xdbf4('0x7'));var config=require(_0xdbf4('0x8'));var controller=require(_0xdbf4('0x9'));router[_0xdbf4('0xa')]('/',auth[_0xdbf4('0xb')](),controller['index']);router[_0xdbf4('0xa')](_0xdbf4('0xc'),auth[_0xdbf4('0xb')](),controller[_0xdbf4('0xd')]);router[_0xdbf4('0xa')]('/:id',auth[_0xdbf4('0xb')](),controller['show']);router[_0xdbf4('0xe')]('/',auth[_0xdbf4('0xb')](),controller[_0xdbf4('0xf')]);router[_0xdbf4('0x10')](_0xdbf4('0x11'),auth[_0xdbf4('0xb')](),controller[_0xdbf4('0x12')]);router['delete'](_0xdbf4('0x11'),auth[_0xdbf4('0xb')](),controller[_0xdbf4('0x13')]);module[_0xdbf4('0x14')]=router; \ No newline at end of file +var _0x03f6=['/:id','show','create','put','delete','destroy','exports','multer','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./mailTransferReport.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x8afdd0,_0x548ad1){var _0x3de7ac=function(_0x2dc2c4){while(--_0x2dc2c4){_0x8afdd0['push'](_0x8afdd0['shift']());}};_0x3de7ac(++_0x548ad1);}(_0x03f6,0x79));var _0x603f=function(_0x6b9e17,_0x202581){_0x6b9e17=_0x6b9e17-0x0;var _0x1e738e=_0x03f6[_0x6b9e17];return _0x1e738e;};'use strict';var multer=require(_0x603f('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x603f('0x1'));var router=express[_0x603f('0x2')]();var fs_extra=require(_0x603f('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x603f('0x4'));var config=require(_0x603f('0x5'));var controller=require(_0x603f('0x6'));router[_0x603f('0x7')]('/',auth[_0x603f('0x8')](),controller[_0x603f('0x9')]);router[_0x603f('0x7')](_0x603f('0xa'),auth['isAuthenticated'](),controller[_0x603f('0xb')]);router[_0x603f('0x7')](_0x603f('0xc'),auth[_0x603f('0x8')](),controller[_0x603f('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x603f('0xe')]);router[_0x603f('0xf')](_0x603f('0xc'),auth[_0x603f('0x8')](),controller['update']);router[_0x603f('0x10')](_0x603f('0xc'),auth['isAuthenticated'](),controller[_0x603f('0x11')]);module[_0x603f('0x12')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index 07fb770..567ccf3 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(_0x468c76,_0x32065b){var _0x4d991d=function(_0x26b413){while(--_0x26b413){_0x468c76['push'](_0x468c76['shift']());}};_0x4d991d(++_0x32065b);}(_0xaa88,0x137));var _0x8aa8=function(_0x30cc1a,_0x162bbc){_0x30cc1a=_0x30cc1a-0x0;var _0xb3f18f=_0xaa88[_0x30cc1a];return _0xb3f18f;};'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 _0x70e0=['NOW','moment','sequelize','exports','account','agent','queue'];(function(_0x404dec,_0xca9750){var _0x1421b3=function(_0x1b3baa){while(--_0x1b3baa){_0x404dec['push'](_0x404dec['shift']());}};_0x1421b3(++_0xca9750);}(_0x70e0,0x17b));var _0x070e=function(_0x3b3ca3,_0xfb1389){_0x3b3ca3=_0x3b3ca3-0x0;var _0x2a7cd9=_0x70e0[_0x3b3ca3];return _0x2a7cd9;};'use strict';var moment=require(_0x070e('0x0'));var Sequelize=require(_0x070e('0x1'));module[_0x070e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x070e('0x3'),_0x070e('0x4'),_0x070e('0x5')),'allowNull':![],'defaultValue':_0x070e('0x5')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x070e('0x6')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 9d83dec..2f54cf0 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 _0x7a3b=['fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','catch','rawAttributes','include','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','ejs','fs-extra','squel','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','end','error','name','send','map','MailTransferReport'];(function(_0x19e39c,_0x1e2c7e){var _0xce0070=function(_0xe47a84){while(--_0xe47a84){_0x19e39c['push'](_0x19e39c['shift']());}};_0xce0070(++_0x1e2c7e);}(_0x7a3b,0x18f));var _0xb7a3=function(_0x201d73,_0x531e70){_0x201d73=_0x201d73-0x0;var _0x2e93b0=_0x7a3b[_0x201d73];return _0x2e93b0;};'use strict';var emlformat=require(_0xb7a3('0x0'));var rimraf=require(_0xb7a3('0x1'));var zipdir=require(_0xb7a3('0x2'));var jsonpatch=require(_0xb7a3('0x3'));var rp=require(_0xb7a3('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xb7a3('0x5'));var util=require(_0xb7a3('0x6'));var path=require(_0xb7a3('0x7'));var sox=require(_0xb7a3('0x8'));var csv=require('to-csv');var ejs=require(_0xb7a3('0x9'));var fs=require('fs');var fs_extra=require(_0xb7a3('0xa'));var _=require('lodash');var squel=require(_0xb7a3('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xb7a3('0xc'));var toCsv=require(_0xb7a3('0xd'));var querystring=require(_0xb7a3('0xe'));var Papa=require('papaparse');var Redis=require(_0xb7a3('0xf'));var authService=require(_0xb7a3('0x10'));var qs=require(_0xb7a3('0x11'));var as=require(_0xb7a3('0x12'));var hardwareService=require(_0xb7a3('0x13'));var logger=require('../../config/logger')(_0xb7a3('0x14'));var utils=require(_0xb7a3('0x15'));var config=require(_0xb7a3('0x16'));var licenseUtil=require(_0xb7a3('0x17'));var db=require(_0xb7a3('0x18'))['db'];function respondWithStatusCode(_0x5a31b5,_0xa21f38){_0xa21f38=_0xa21f38||0xcc;return function(_0x506bc5){if(_0x506bc5){return _0x5a31b5[_0xb7a3('0x19')](_0xa21f38);}return _0x5a31b5[_0xb7a3('0x1a')](_0xa21f38)['end']();};}function respondWithResult(_0x99ccce,_0x6176f){_0x6176f=_0x6176f||0xc8;return function(_0x34f023){if(_0x34f023){return _0x99ccce[_0xb7a3('0x1a')](_0x6176f)[_0xb7a3('0x1b')](_0x34f023);}};}function respondWithFilteredResult(_0x1c78dc,_0x58c709){return function(_0x4c0727){if(_0x4c0727){var _0x1af29e=typeof _0x58c709[_0xb7a3('0x1c')]===_0xb7a3('0x1d')&&typeof _0x58c709[_0xb7a3('0x1e')]===_0xb7a3('0x1d');var _0x26765a=_0x4c0727[_0xb7a3('0x1f')];var _0x3a8df0=_0x1af29e?0x0:_0x58c709[_0xb7a3('0x1c')];var _0x41779d=_0x1af29e?_0x4c0727['count']:_0x58c709['offset']+_0x58c709[_0xb7a3('0x1e')];var _0x4893c4;if(_0x41779d>=_0x26765a){_0x41779d=_0x26765a;_0x4893c4=0xc8;}else{_0x4893c4=0xce;}_0x1c78dc[_0xb7a3('0x1a')](_0x4893c4);return _0x1c78dc[_0xb7a3('0x20')](_0xb7a3('0x21'),_0x3a8df0+'-'+_0x41779d+'/'+_0x26765a)[_0xb7a3('0x1b')](_0x4c0727);}return null;};}function patchUpdates(_0x536201){return function(_0x4d8708){try{jsonpatch[_0xb7a3('0x22')](_0x4d8708,_0x536201,!![]);}catch(_0x17c4ae){return BPromise['reject'](_0x17c4ae);}return _0x4d8708[_0xb7a3('0x23')]();};}function saveUpdates(_0x5e1ffc,_0x1e4f44){return function(_0x3da09f){if(_0x3da09f){return _0x3da09f[_0xb7a3('0x24')](_0x5e1ffc)[_0xb7a3('0x25')](function(_0x5cf42d){return _0x5cf42d;});}return null;};}function removeEntity(_0x27b1da,_0x8b8b8){return function(_0x2c4c91){if(_0x2c4c91){return _0x2c4c91[_0xb7a3('0x26')]()['then'](function(){_0x27b1da[_0xb7a3('0x1a')](0xcc)[_0xb7a3('0x27')]();});}};}function handleEntityNotFound(_0x7de82,_0x532f7d){return function(_0x4d39e3){if(!_0x4d39e3){_0x7de82[_0xb7a3('0x19')](0x194);}return _0x4d39e3;};}function handleError(_0xae4c56,_0xf81ce2){_0xf81ce2=_0xf81ce2||0x1f4;return function(_0x5dcb33){logger[_0xb7a3('0x28')](_0x5dcb33['stack']);if(_0x5dcb33['name']){delete _0x5dcb33[_0xb7a3('0x29')];}_0xae4c56[_0xb7a3('0x1a')](_0xf81ce2)[_0xb7a3('0x2a')](_0x5dcb33);};}exports['index']=function(_0x4b1e67,_0x304262){var _0x3d5197={},_0x245364={},_0x6ebb8c={'count':0x0,'rows':[]};var _0x5891f3=_[_0xb7a3('0x2b')](db[_0xb7a3('0x2c')]['rawAttributes'],function(_0x204292){return{'name':_0x204292[_0xb7a3('0x2d')],'type':_0x204292[_0xb7a3('0x2e')][_0xb7a3('0x2f')]};});_0x245364[_0xb7a3('0x30')]=_[_0xb7a3('0x2b')](_0x5891f3,_0xb7a3('0x29'));_0x245364[_0xb7a3('0x31')]=_[_0xb7a3('0x32')](_0x4b1e67[_0xb7a3('0x31')]);_0x245364[_0xb7a3('0x33')]=_[_0xb7a3('0x34')](_0x245364[_0xb7a3('0x30')],_0x245364['query']);_0x3d5197['attributes']=_['intersection'](_0x245364[_0xb7a3('0x30')],qs[_0xb7a3('0x35')](_0x4b1e67[_0xb7a3('0x31')][_0xb7a3('0x35')]));_0x3d5197[_0xb7a3('0x36')]=_0x3d5197[_0xb7a3('0x36')][_0xb7a3('0x37')]?_0x3d5197[_0xb7a3('0x36')]:_0x245364[_0xb7a3('0x30')];if(!_0x4b1e67[_0xb7a3('0x31')][_0xb7a3('0x38')]('nolimit')){_0x3d5197['limit']=qs[_0xb7a3('0x1e')](_0x4b1e67[_0xb7a3('0x31')][_0xb7a3('0x1e')]);_0x3d5197[_0xb7a3('0x1c')]=qs[_0xb7a3('0x1c')](_0x4b1e67['query'][_0xb7a3('0x1c')]);}_0x3d5197[_0xb7a3('0x39')]=qs[_0xb7a3('0x3a')](_0x4b1e67[_0xb7a3('0x31')][_0xb7a3('0x3a')]);_0x3d5197[_0xb7a3('0x3b')]=qs['filters'](_[_0xb7a3('0x3c')](_0x4b1e67['query'],_0x245364[_0xb7a3('0x33')]),_0x5891f3);if(_0x4b1e67[_0xb7a3('0x31')][_0xb7a3('0x3d')]){_0x3d5197[_0xb7a3('0x3b')]=_[_0xb7a3('0x3e')](_0x3d5197[_0xb7a3('0x3b')],{'$or':_['map'](_0x5891f3,function(_0x165452){if(_0x165452[_0xb7a3('0x2e')]!==_0xb7a3('0x3f')){var _0x49a6c3={};_0x49a6c3[_0x165452['name']]={'$like':'%'+_0x4b1e67[_0xb7a3('0x31')][_0xb7a3('0x3d')]+'%'};return _0x49a6c3;}})});}_0x3d5197=_['merge']({},_0x3d5197,_0x4b1e67[_0xb7a3('0x40')]);var _0x14ac7b={'where':_0x3d5197[_0xb7a3('0x3b')]};return db[_0xb7a3('0x2c')][_0xb7a3('0x1f')](_0x14ac7b)[_0xb7a3('0x25')](function(_0x51f68d){_0x6ebb8c['count']=_0x51f68d;if(_0x4b1e67[_0xb7a3('0x31')][_0xb7a3('0x41')]){_0x3d5197['include']=[{'all':!![]}];}return db[_0xb7a3('0x2c')][_0xb7a3('0x42')](_0x3d5197);})[_0xb7a3('0x25')](function(_0x48d63f){_0x6ebb8c['rows']=_0x48d63f;return _0x6ebb8c;})[_0xb7a3('0x25')](respondWithFilteredResult(_0x304262,_0x3d5197))[_0xb7a3('0x43')](handleError(_0x304262,null));};exports['show']=function(_0x35de65,_0x1a476e){var _0x4a4db9={'raw':!![],'where':{'id':_0x35de65['params']['id']}},_0x67dcb3={};_0x67dcb3[_0xb7a3('0x30')]=_[_0xb7a3('0x32')](db['MailTransferReport'][_0xb7a3('0x44')]);_0x67dcb3[_0xb7a3('0x31')]=_[_0xb7a3('0x32')](_0x35de65[_0xb7a3('0x31')]);_0x67dcb3['filters']=_['intersection'](_0x67dcb3[_0xb7a3('0x30')],_0x67dcb3[_0xb7a3('0x31')]);_0x4a4db9[_0xb7a3('0x36')]=_['intersection'](_0x67dcb3[_0xb7a3('0x30')],qs[_0xb7a3('0x35')](_0x35de65[_0xb7a3('0x31')][_0xb7a3('0x35')]));_0x4a4db9[_0xb7a3('0x36')]=_0x4a4db9[_0xb7a3('0x36')][_0xb7a3('0x37')]?_0x4a4db9[_0xb7a3('0x36')]:_0x67dcb3[_0xb7a3('0x30')];if(_0x35de65[_0xb7a3('0x31')][_0xb7a3('0x41')]){_0x4a4db9[_0xb7a3('0x45')]=[{'all':!![]}];}_0x4a4db9=_[_0xb7a3('0x3e')]({},_0x4a4db9,_0x35de65[_0xb7a3('0x40')]);return db[_0xb7a3('0x2c')]['find'](_0x4a4db9)[_0xb7a3('0x25')](handleEntityNotFound(_0x1a476e,null))[_0xb7a3('0x25')](respondWithResult(_0x1a476e,null))[_0xb7a3('0x43')](handleError(_0x1a476e,null));};exports[_0xb7a3('0x46')]=function(_0x54f30d,_0x2710bc){return db[_0xb7a3('0x2c')]['create'](_0x54f30d['body'],{})[_0xb7a3('0x25')](respondWithResult(_0x2710bc,0xc9))[_0xb7a3('0x43')](handleError(_0x2710bc,null));};exports['update']=function(_0x4d32b9,_0x5143f1){if(_0x4d32b9[_0xb7a3('0x47')]['id']){delete _0x4d32b9['body']['id'];}return db[_0xb7a3('0x2c')][_0xb7a3('0x48')]({'where':{'id':_0x4d32b9['params']['id']}})[_0xb7a3('0x25')](handleEntityNotFound(_0x5143f1,null))['then'](saveUpdates(_0x4d32b9[_0xb7a3('0x47')],null))[_0xb7a3('0x25')](respondWithResult(_0x5143f1,null))[_0xb7a3('0x43')](handleError(_0x5143f1,null));};exports[_0xb7a3('0x26')]=function(_0x2ba32e,_0x3b4e52){return db[_0xb7a3('0x2c')][_0xb7a3('0x48')]({'where':{'id':_0x2ba32e['params']['id']}})['then'](handleEntityNotFound(_0x3b4e52,null))[_0xb7a3('0x25')](removeEntity(_0x3b4e52,null))[_0xb7a3('0x43')](handleError(_0x3b4e52,null));};exports[_0xb7a3('0x49')]=function(_0x1e6a04,_0x4949a9){return db[_0xb7a3('0x2c')][_0xb7a3('0x49')]()[_0xb7a3('0x25')](respondWithResult(_0x4949a9,null))['catch'](handleError(_0x4949a9,null));}; \ No newline at end of file +var _0xc3b1=['crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','update','then','error','stack','name','send','index','rawAttributes','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','MailTransferReport','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','eml-format','rimraf','fast-json-patch','moment','mustache','util','path','sox','to-csv','lodash','squel'];(function(_0x510ee9,_0xfd8b59){var _0xc4e23=function(_0x1d19c8){while(--_0x1d19c8){_0x510ee9['push'](_0x510ee9['shift']());}};_0xc4e23(++_0xfd8b59);}(_0xc3b1,0x115));var _0x1c3b=function(_0x463cc3,_0x447c19){_0x463cc3=_0x463cc3-0x0;var _0x109c08=_0xc3b1[_0x463cc3];return _0x109c08;};'use strict';var emlformat=require(_0x1c3b('0x0'));var rimraf=require(_0x1c3b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1c3b('0x2'));var rp=require('request-promise');var moment=require(_0x1c3b('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x1c3b('0x4'));var util=require(_0x1c3b('0x5'));var path=require(_0x1c3b('0x6'));var sox=require(_0x1c3b('0x7'));var csv=require(_0x1c3b('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1c3b('0x9'));var squel=require(_0x1c3b('0xa'));var crypto=require(_0x1c3b('0xb'));var jsforce=require(_0x1c3b('0xc'));var deskjs=require(_0x1c3b('0xd'));var toCsv=require(_0x1c3b('0x8'));var querystring=require(_0x1c3b('0xe'));var Papa=require(_0x1c3b('0xf'));var Redis=require(_0x1c3b('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x1c3b('0x11'));var as=require(_0x1c3b('0x12'));var hardwareService=require(_0x1c3b('0x13'));var logger=require(_0x1c3b('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x1c3b('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4c2a91,_0x52172f){_0x52172f=_0x52172f||0xcc;return function(_0x36e5f2){if(_0x36e5f2){return _0x4c2a91[_0x1c3b('0x16')](_0x52172f);}return _0x4c2a91[_0x1c3b('0x17')](_0x52172f)[_0x1c3b('0x18')]();};}function respondWithResult(_0x362292,_0x61722c){_0x61722c=_0x61722c||0xc8;return function(_0x1c606c){if(_0x1c606c){return _0x362292[_0x1c3b('0x17')](_0x61722c)[_0x1c3b('0x19')](_0x1c606c);}};}function respondWithFilteredResult(_0x48f6e1,_0x21a9fe){return function(_0x4cd7cc){if(_0x4cd7cc){var _0x303e41=typeof _0x21a9fe['offset']===_0x1c3b('0x1a')&&typeof _0x21a9fe[_0x1c3b('0x1b')]===_0x1c3b('0x1a');var _0x146c22=_0x4cd7cc[_0x1c3b('0x1c')];var _0x266aac=_0x303e41?0x0:_0x21a9fe[_0x1c3b('0x1d')];var _0x3c1f8c=_0x303e41?_0x4cd7cc['count']:_0x21a9fe['offset']+_0x21a9fe['limit'];var _0x26576c;if(_0x3c1f8c>=_0x146c22){_0x3c1f8c=_0x146c22;_0x26576c=0xc8;}else{_0x26576c=0xce;}_0x48f6e1['status'](_0x26576c);return _0x48f6e1[_0x1c3b('0x1e')](_0x1c3b('0x1f'),_0x266aac+'-'+_0x3c1f8c+'/'+_0x146c22)['json'](_0x4cd7cc);}return null;};}function patchUpdates(_0xb772dc){return function(_0x1b715a){try{jsonpatch['apply'](_0x1b715a,_0xb772dc,!![]);}catch(_0x229a8e){return BPromise['reject'](_0x229a8e);}return _0x1b715a['save']();};}function saveUpdates(_0x372313,_0x49bff1){return function(_0x246aa7){if(_0x246aa7){return _0x246aa7[_0x1c3b('0x20')](_0x372313)['then'](function(_0x237c4a){return _0x237c4a;});}return null;};}function removeEntity(_0x5efc53,_0x5e751b){return function(_0x3fd419){if(_0x3fd419){return _0x3fd419['destroy']()[_0x1c3b('0x21')](function(){_0x5efc53[_0x1c3b('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x424a2d,_0x4ec1be){return function(_0x1809cf){if(!_0x1809cf){_0x424a2d[_0x1c3b('0x16')](0x194);}return _0x1809cf;};}function handleError(_0x1dd4d2,_0x35022d){_0x35022d=_0x35022d||0x1f4;return function(_0x1626b7){logger[_0x1c3b('0x22')](_0x1626b7[_0x1c3b('0x23')]);if(_0x1626b7['name']){delete _0x1626b7[_0x1c3b('0x24')];}_0x1dd4d2[_0x1c3b('0x17')](_0x35022d)[_0x1c3b('0x25')](_0x1626b7);};}exports[_0x1c3b('0x26')]=function(_0x25d413,_0x1661fa){var _0xea2c8c={},_0x2c36ab={},_0xca5b3a={'count':0x0,'rows':[]};var _0x11331f=_['map'](db['MailTransferReport'][_0x1c3b('0x27')],function(_0x1efdcf){return{'name':_0x1efdcf['fieldName'],'type':_0x1efdcf[_0x1c3b('0x28')][_0x1c3b('0x29')]};});_0x2c36ab[_0x1c3b('0x2a')]=_[_0x1c3b('0x2b')](_0x11331f,_0x1c3b('0x24'));_0x2c36ab[_0x1c3b('0x2c')]=_[_0x1c3b('0x2d')](_0x25d413[_0x1c3b('0x2c')]);_0x2c36ab[_0x1c3b('0x2e')]=_['intersection'](_0x2c36ab[_0x1c3b('0x2a')],_0x2c36ab[_0x1c3b('0x2c')]);_0xea2c8c[_0x1c3b('0x2f')]=_[_0x1c3b('0x30')](_0x2c36ab[_0x1c3b('0x2a')],qs[_0x1c3b('0x31')](_0x25d413[_0x1c3b('0x2c')][_0x1c3b('0x31')]));_0xea2c8c[_0x1c3b('0x2f')]=_0xea2c8c[_0x1c3b('0x2f')][_0x1c3b('0x32')]?_0xea2c8c['attributes']:_0x2c36ab['model'];if(!_0x25d413[_0x1c3b('0x2c')][_0x1c3b('0x33')](_0x1c3b('0x34'))){_0xea2c8c[_0x1c3b('0x1b')]=qs[_0x1c3b('0x1b')](_0x25d413[_0x1c3b('0x2c')][_0x1c3b('0x1b')]);_0xea2c8c['offset']=qs[_0x1c3b('0x1d')](_0x25d413[_0x1c3b('0x2c')][_0x1c3b('0x1d')]);}_0xea2c8c[_0x1c3b('0x35')]=qs[_0x1c3b('0x36')](_0x25d413[_0x1c3b('0x2c')][_0x1c3b('0x36')]);_0xea2c8c[_0x1c3b('0x37')]=qs[_0x1c3b('0x2e')](_[_0x1c3b('0x38')](_0x25d413['query'],_0x2c36ab[_0x1c3b('0x2e')]),_0x11331f);if(_0x25d413['query']['filter']){_0xea2c8c[_0x1c3b('0x37')]=_[_0x1c3b('0x39')](_0xea2c8c['where'],{'$or':_[_0x1c3b('0x2b')](_0x11331f,function(_0x1c7a2e){if(_0x1c7a2e['type']!==_0x1c3b('0x3a')){var _0x4e92b8={};_0x4e92b8[_0x1c7a2e['name']]={'$like':'%'+_0x25d413[_0x1c3b('0x2c')]['filter']+'%'};return _0x4e92b8;}})});}_0xea2c8c=_['merge']({},_0xea2c8c,_0x25d413[_0x1c3b('0x3b')]);var _0x3e631={'where':_0xea2c8c['where']};return db[_0x1c3b('0x3c')]['count'](_0x3e631)['then'](function(_0xa25d52){_0xca5b3a[_0x1c3b('0x1c')]=_0xa25d52;if(_0x25d413[_0x1c3b('0x2c')][_0x1c3b('0x3d')]){_0xea2c8c[_0x1c3b('0x3e')]=[{'all':!![]}];}return db[_0x1c3b('0x3c')][_0x1c3b('0x3f')](_0xea2c8c);})[_0x1c3b('0x21')](function(_0x17e14e){_0xca5b3a[_0x1c3b('0x40')]=_0x17e14e;return _0xca5b3a;})['then'](respondWithFilteredResult(_0x1661fa,_0xea2c8c))[_0x1c3b('0x41')](handleError(_0x1661fa,null));};exports[_0x1c3b('0x42')]=function(_0xad2b9b,_0x26e3f2){var _0x39439e={'raw':!![],'where':{'id':_0xad2b9b[_0x1c3b('0x43')]['id']}},_0x54e96f={};_0x54e96f[_0x1c3b('0x2a')]=_[_0x1c3b('0x2d')](db['MailTransferReport']['rawAttributes']);_0x54e96f[_0x1c3b('0x2c')]=_[_0x1c3b('0x2d')](_0xad2b9b['query']);_0x54e96f[_0x1c3b('0x2e')]=_[_0x1c3b('0x30')](_0x54e96f[_0x1c3b('0x2a')],_0x54e96f[_0x1c3b('0x2c')]);_0x39439e[_0x1c3b('0x2f')]=_['intersection'](_0x54e96f['model'],qs[_0x1c3b('0x31')](_0xad2b9b[_0x1c3b('0x2c')][_0x1c3b('0x31')]));_0x39439e[_0x1c3b('0x2f')]=_0x39439e[_0x1c3b('0x2f')]['length']?_0x39439e[_0x1c3b('0x2f')]:_0x54e96f['model'];if(_0xad2b9b[_0x1c3b('0x2c')]['includeAll']){_0x39439e[_0x1c3b('0x3e')]=[{'all':!![]}];}_0x39439e=_[_0x1c3b('0x39')]({},_0x39439e,_0xad2b9b['options']);return db[_0x1c3b('0x3c')][_0x1c3b('0x44')](_0x39439e)['then'](handleEntityNotFound(_0x26e3f2,null))[_0x1c3b('0x21')](respondWithResult(_0x26e3f2,null))[_0x1c3b('0x41')](handleError(_0x26e3f2,null));};exports[_0x1c3b('0x45')]=function(_0x5bec68,_0x509503){return db['MailTransferReport'][_0x1c3b('0x45')](_0x5bec68[_0x1c3b('0x46')],{})[_0x1c3b('0x21')](respondWithResult(_0x509503,0xc9))['catch'](handleError(_0x509503,null));};exports[_0x1c3b('0x20')]=function(_0xe84b14,_0x52e029){if(_0xe84b14[_0x1c3b('0x46')]['id']){delete _0xe84b14['body']['id'];}return db[_0x1c3b('0x3c')][_0x1c3b('0x44')]({'where':{'id':_0xe84b14['params']['id']}})[_0x1c3b('0x21')](handleEntityNotFound(_0x52e029,null))[_0x1c3b('0x21')](saveUpdates(_0xe84b14[_0x1c3b('0x46')],null))[_0x1c3b('0x21')](respondWithResult(_0x52e029,null))[_0x1c3b('0x41')](handleError(_0x52e029,null));};exports['destroy']=function(_0x16a4f9,_0x3aa22a){return db[_0x1c3b('0x3c')][_0x1c3b('0x44')]({'where':{'id':_0x16a4f9['params']['id']}})[_0x1c3b('0x21')](handleEntityNotFound(_0x3aa22a,null))['then'](removeEntity(_0x3aa22a,null))[_0x1c3b('0x41')](handleError(_0x3aa22a,null));};exports[_0x1c3b('0x47')]=function(_0x3d1661,_0x524d73){return db[_0x1c3b('0x3c')][_0x1c3b('0x47')]()[_0x1c3b('0x21')](respondWithResult(_0x524d73,null))[_0x1c3b('0x41')](handleError(_0x524d73,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index 11c2faf..554011b 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 _0xad68=['path','rimraf','../../config/environment','./mailTransferReport.attributes','exports','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x76a371,_0x532f13){var _0x3284ae=function(_0x5d08d7){while(--_0x5d08d7){_0x76a371['push'](_0x76a371['shift']());}};_0x3284ae(++_0x532f13);}(_0xad68,0x102));var _0x8ad6=function(_0x590deb,_0x249ee5){_0x590deb=_0x590deb-0x0;var _0x1b0022=_0xad68[_0x590deb];return _0x1b0022;};'use strict';var _=require(_0x8ad6('0x0'));var util=require(_0x8ad6('0x1'));var logger=require(_0x8ad6('0x2'))(_0x8ad6('0x3'));var moment=require('moment');var BPromise=require(_0x8ad6('0x4'));var rp=require(_0x8ad6('0x5'));var fs=require('fs');var path=require(_0x8ad6('0x6'));var rimraf=require(_0x8ad6('0x7'));var config=require(_0x8ad6('0x8'));var attributes=require(_0x8ad6('0x9'));module[_0x8ad6('0xa')]=function(_0x4cc20e,_0x2ac999){return _0x4cc20e['define']('MailTransferReport',attributes,{'tableName':'report_mail_transfer','paranoid':![],'indexes':[{'name':_0x8ad6('0xb'),'fields':[_0x8ad6('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3de9=['request-promise','rimraf','../../config/environment','./mailTransferReport.attributes','define','MailTransferReport','report_mail_transfer','uniqueid','lodash','util','api'];(function(_0x173969,_0x412f62){var _0x5124ea=function(_0x39a3ec){while(--_0x39a3ec){_0x173969['push'](_0x173969['shift']());}};_0x5124ea(++_0x412f62);}(_0x3de9,0x147));var _0x93de=function(_0x434242,_0x2d48e7){_0x434242=_0x434242-0x0;var _0x1bfb36=_0x3de9[_0x434242];return _0x1bfb36;};'use strict';var _=require(_0x93de('0x0'));var util=require(_0x93de('0x1'));var logger=require('../../config/logger')(_0x93de('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x93de('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x93de('0x4'));var config=require(_0x93de('0x5'));var attributes=require(_0x93de('0x6'));module['exports']=function(_0x4e3fad,_0x190be1){return _0x4e3fad[_0x93de('0x7')](_0x93de('0x8'),attributes,{'tableName':_0x93de('0x9'),'paranoid':![],'indexes':[{'name':_0x93de('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index 28bd561..de56016 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 _0x1684=['message','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','client','http','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x3c169a,_0x321e59){var _0x57394e=function(_0x228203){while(--_0x228203){_0x3c169a['push'](_0x3c169a['shift']());}};_0x57394e(++_0x321e59);}(_0x1684,0x1b1));var _0x4168=function(_0x5d487a,_0x5f5157){_0x5d487a=_0x5d487a-0x0;var _0x5c8087=_0x1684[_0x5d487a];return _0x5c8087;};'use strict';var _=require(_0x4168('0x0'));var util=require(_0x4168('0x1'));var moment=require(_0x4168('0x2'));var BPromise=require(_0x4168('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4168('0x4'))['db'];var utils=require(_0x4168('0x5'));var logger=require(_0x4168('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4168('0x7')][_0x4168('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2000bd,_0x182895,_0x59a0a0){return new BPromise(function(_0x19d62e,_0x521eb2){return client['request'](_0x2000bd,_0x59a0a0)['then'](function(_0xe52395){logger[_0x4168('0x9')](_0x4168('0xa'),_0x182895,_0x4168('0xb'));logger[_0x4168('0xc')](_0x4168('0xd'),_0x182895,_0x4168('0xb'),JSON[_0x4168('0xe')](_0xe52395));if(_0xe52395['error']){if(_0xe52395[_0x4168('0xf')][_0x4168('0x10')]===0x1f4){logger['error'](_0x4168('0xa'),_0x182895,_0xe52395['error'][_0x4168('0x11')]);return _0x521eb2(_0xe52395[_0x4168('0xf')][_0x4168('0x11')]);}logger[_0x4168('0xf')](_0x4168('0xa'),_0x182895,_0xe52395[_0x4168('0xf')]['message']);return _0x19d62e(_0xe52395[_0x4168('0xf')][_0x4168('0x11')]);}else{logger[_0x4168('0x9')](_0x4168('0xa'),_0x182895,_0x4168('0xb'));_0x19d62e(_0xe52395['result'][_0x4168('0x11')]);}})['catch'](function(_0x16dcbf){logger['error'](_0x4168('0xa'),_0x182895,_0x16dcbf);_0x521eb2(_0x16dcbf);});});} \ No newline at end of file +var _0xb8fc=['request','then','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http'];(function(_0xa86244,_0x36b25a){var _0x4c02bb=function(_0x5b5657){while(--_0x5b5657){_0xa86244['push'](_0xa86244['shift']());}};_0x4c02bb(++_0x36b25a);}(_0xb8fc,0xac));var _0xcb8f=function(_0x2eb18b,_0x4c8a68){_0x2eb18b=_0x2eb18b-0x0;var _0x627f86=_0xb8fc[_0x2eb18b];return _0x627f86;};'use strict';var _=require(_0xcb8f('0x0'));var util=require(_0xcb8f('0x1'));var moment=require(_0xcb8f('0x2'));var BPromise=require(_0xcb8f('0x3'));var rs=require(_0xcb8f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcb8f('0x5'))['db'];var utils=require(_0xcb8f('0x6'));var logger=require(_0xcb8f('0x7'))(_0xcb8f('0x8'));var config=require(_0xcb8f('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xcb8f('0xa')][_0xcb8f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xd71b88,_0xb0a2da,_0x4abd2d){return new BPromise(function(_0x2a54e0,_0x59cc82){return client[_0xcb8f('0xc')](_0xd71b88,_0x4abd2d)[_0xcb8f('0xd')](function(_0x41c9a6){logger[_0xcb8f('0xe')](_0xcb8f('0xf'),_0xb0a2da,_0xcb8f('0x10'));logger['debug'](_0xcb8f('0x11'),_0xb0a2da,_0xcb8f('0x10'),JSON[_0xcb8f('0x12')](_0x41c9a6));if(_0x41c9a6[_0xcb8f('0x13')]){if(_0x41c9a6[_0xcb8f('0x13')][_0xcb8f('0x14')]===0x1f4){logger['error'](_0xcb8f('0xf'),_0xb0a2da,_0x41c9a6[_0xcb8f('0x13')][_0xcb8f('0x15')]);return _0x59cc82(_0x41c9a6[_0xcb8f('0x13')][_0xcb8f('0x15')]);}logger['error']('MailTransferReport,\x20%s,\x20%s',_0xb0a2da,_0x41c9a6[_0xcb8f('0x13')][_0xcb8f('0x15')]);return _0x2a54e0(_0x41c9a6[_0xcb8f('0x13')]['message']);}else{logger[_0xcb8f('0xe')](_0xcb8f('0xf'),_0xb0a2da,'request\x20sent');_0x2a54e0(_0x41c9a6[_0xcb8f('0x16')][_0xcb8f('0x15')]);}})['catch'](function(_0x18500b){logger[_0xcb8f('0x13')](_0xcb8f('0xf'),_0xb0a2da,_0x18500b);_0x59cc82(_0x18500b);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index e9e7cc5..a09bd0d 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 _0x4696=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./memberReport.controller','get','isAuthenticated','/describe','/:id','show','post','create','put','delete','destroy','exports','multer','connect-timeout','express'];(function(_0x26b827,_0xe40c59){var _0x584752=function(_0x214a86){while(--_0x214a86){_0x26b827['push'](_0x26b827['shift']());}};_0x584752(++_0xe40c59);}(_0x4696,0xa8));var _0x6469=function(_0x36ed4b,_0x3269d5){_0x36ed4b=_0x36ed4b-0x0;var _0x391dc4=_0x4696[_0x36ed4b];return _0x391dc4;};'use strict';var multer=require(_0x6469('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x6469('0x1'));var express=require(_0x6469('0x2'));var router=express['Router']();var fs_extra=require(_0x6469('0x3'));var auth=require(_0x6469('0x4'));var interaction=require(_0x6469('0x5'));var config=require(_0x6469('0x6'));var controller=require(_0x6469('0x7'));router[_0x6469('0x8')]('/',auth[_0x6469('0x9')](),controller['index']);router[_0x6469('0x8')](_0x6469('0xa'),auth[_0x6469('0x9')](),controller['describe']);router['get'](_0x6469('0xb'),auth['isAuthenticated'](),controller[_0x6469('0xc')]);router[_0x6469('0xd')]('/',auth[_0x6469('0x9')](),controller[_0x6469('0xe')]);router[_0x6469('0xf')](_0x6469('0xb'),auth[_0x6469('0x9')](),controller['update']);router[_0x6469('0x10')](_0x6469('0xb'),auth[_0x6469('0x9')](),controller[_0x6469('0x11')]);module[_0x6469('0x12')]=router; \ No newline at end of file +var _0xd314=['create','put','/:id','update','delete','destroy','exports','multer','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./memberReport.controller','get','isAuthenticated','index','describe','show','post'];(function(_0x18443a,_0x2d863e){var _0x42f69f=function(_0x434c98){while(--_0x434c98){_0x18443a['push'](_0x18443a['shift']());}};_0x42f69f(++_0x2d863e);}(_0xd314,0xc4));var _0x4d31=function(_0x4be375,_0x5afa5f){_0x4be375=_0x4be375-0x0;var _0x348d40=_0xd314[_0x4be375];return _0x348d40;};'use strict';var multer=require(_0x4d31('0x0'));var util=require(_0x4d31('0x1'));var path=require(_0x4d31('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x4d31('0x3'));var auth=require(_0x4d31('0x4'));var interaction=require(_0x4d31('0x5'));var config=require(_0x4d31('0x6'));var controller=require(_0x4d31('0x7'));router[_0x4d31('0x8')]('/',auth[_0x4d31('0x9')](),controller[_0x4d31('0xa')]);router['get']('/describe',auth[_0x4d31('0x9')](),controller[_0x4d31('0xb')]);router['get']('/:id',auth[_0x4d31('0x9')](),controller[_0x4d31('0xc')]);router[_0x4d31('0xd')]('/',auth['isAuthenticated'](),controller[_0x4d31('0xe')]);router[_0x4d31('0xf')](_0x4d31('0x10'),auth[_0x4d31('0x9')](),controller[_0x4d31('0x11')]);router[_0x4d31('0x12')](_0x4d31('0x10'),auth[_0x4d31('0x9')](),controller[_0x4d31('0x13')]);module[_0x4d31('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 056bade..c7ce438 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 _0x201e=['seconds','setDataValue','exitAt','duration','talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','sequelize','moment','STRING','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','enterAt'];(function(_0x44bf54,_0x5be3d6){var _0x2c4a96=function(_0x2bd0ee){while(--_0x2bd0ee){_0x44bf54['push'](_0x44bf54['shift']());}};_0x2c4a96(++_0x5be3d6);}(_0x201e,0xd8));var _0xe201=function(_0x609988,_0x507944){_0x609988=_0x609988-0x0;var _0x159984=_0x201e[_0x609988];return _0x159984;};'use strict';var Sequelize=require(_0xe201('0x0'));var moment=require(_0xe201('0x1'));module['exports']={'channel':{'type':Sequelize[_0xe201('0x2')]},'membername':{'type':Sequelize[_0xe201('0x2')]},'interface':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING'],'defaultValue':'DEFAULT\x20PAUSE','comment':_0xe201('0x3')},'duration':{'type':Sequelize[_0xe201('0x4')]},'enterAt':{'type':Sequelize[_0xe201('0x5')]},'exitAt':{'type':Sequelize[_0xe201('0x5')],'set':function(_0x3a73b6){var _0x36f0a3=moment(_0x3a73b6);var _0x12ae9e=moment(this[_0xe201('0x6')](_0xe201('0x7')));var _0x545f84=_0x36f0a3['diff'](_0x12ae9e,_0xe201('0x8'));this[_0xe201('0x9')](_0xe201('0xa'),_0x3a73b6);this[_0xe201('0x9')](_0xe201('0xb'),_0x545f84>=0x0?_0x545f84:null);}},'data1':{'type':Sequelize[_0xe201('0x2')],'comment':'talk:[inbound,\x20outbound],\x20pause:[reason]'},'data2':{'type':Sequelize[_0xe201('0x2')],'comment':_0xe201('0xc')},'data3':{'type':Sequelize[_0xe201('0x2')],'comment':_0xe201('0xd')},'data4':{'type':Sequelize[_0xe201('0x2')],'comment':_0xe201('0xe')},'data5':{'type':Sequelize['STRING'],'comment':_0xe201('0xf')},'role':{'type':Sequelize[_0xe201('0x2')]},'internal':{'type':Sequelize[_0xe201('0x4')]},'uniqueid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xa8c4=['talk:[dial\x20string]','sequelize','moment','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','enterAt','seconds','exitAt','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]'];(function(_0x3b1f07,_0x2b3cbe){var _0xc89787=function(_0x40a13f){while(--_0x40a13f){_0x3b1f07['push'](_0x3b1f07['shift']());}};_0xc89787(++_0x2b3cbe);}(_0xa8c4,0x91));var _0x4a8c=function(_0x283d09,_0x5be1bd){_0x283d09=_0x283d09-0x0;var _0x2cb198=_0xa8c4[_0x283d09];return _0x2cb198;};'use strict';var Sequelize=require(_0x4a8c('0x0'));var moment=require(_0x4a8c('0x1'));module[_0x4a8c('0x2')]={'channel':{'type':Sequelize[_0x4a8c('0x3')]},'membername':{'type':Sequelize[_0x4a8c('0x3')]},'interface':{'type':Sequelize[_0x4a8c('0x3')]},'type':{'type':Sequelize[_0x4a8c('0x3')],'defaultValue':_0x4a8c('0x4'),'comment':_0x4a8c('0x5')},'duration':{'type':Sequelize[_0x4a8c('0x6')]},'enterAt':{'type':Sequelize[_0x4a8c('0x7')]},'exitAt':{'type':Sequelize[_0x4a8c('0x7')],'set':function(_0x13d11d){var _0x390c37=moment(_0x13d11d);var _0x187ba2=moment(this['getDataValue'](_0x4a8c('0x8')));var _0x3d8453=_0x390c37['diff'](_0x187ba2,_0x4a8c('0x9'));this['setDataValue'](_0x4a8c('0xa'),_0x13d11d);this['setDataValue'](_0x4a8c('0xb'),_0x3d8453>=0x0?_0x3d8453:null);}},'data1':{'type':Sequelize[_0x4a8c('0x3')],'comment':_0x4a8c('0xc')},'data2':{'type':Sequelize[_0x4a8c('0x3')],'comment':_0x4a8c('0xd')},'data3':{'type':Sequelize[_0x4a8c('0x3')],'comment':_0x4a8c('0xe')},'data4':{'type':Sequelize[_0x4a8c('0x3')],'comment':_0x4a8c('0xf')},'data5':{'type':Sequelize[_0x4a8c('0x3')],'comment':'talk:[queue]'},'role':{'type':Sequelize['STRING']},'internal':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0x4a8c('0x3')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 83a60e8..289ea78 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 _0x9957=['util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','index','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','MemberReport','findAll','rows','show','rawAttributes','includeAll','include','find','create','catch','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache'];(function(_0x2f653f,_0x1cef4e){var _0x479836=function(_0x4182c2){while(--_0x4182c2){_0x2f653f['push'](_0x2f653f['shift']());}};_0x479836(++_0x1cef4e);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){var _0x514445={},_0x456a28={},_0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['MemberReport']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x2c')],'type':_0x3573be[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x456a28[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x4253e5,'name');_0x456a28['query']=_[_0x7995('0x31')](_0x4b6f99['query']);_0x456a28[_0x7995('0x32')]=_[_0x7995('0x33')](_0x456a28[_0x7995('0x2f')],_0x456a28[_0x7995('0x34')]);_0x514445[_0x7995('0x35')]=_['intersection'](_0x456a28[_0x7995('0x2f')],qs[_0x7995('0x36')](_0x4b6f99['query']['fields']));_0x514445['attributes']=_0x514445[_0x7995('0x35')][_0x7995('0x37')]?_0x514445['attributes']:_0x456a28[_0x7995('0x2f')];if(!_0x4b6f99['query'][_0x7995('0x38')](_0x7995('0x39'))){_0x514445[_0x7995('0x21')]=qs['limit'](_0x4b6f99['query'][_0x7995('0x21')]);_0x514445['offset']=qs['offset'](_0x4b6f99[_0x7995('0x34')][_0x7995('0x20')]);}_0x514445['order']=qs[_0x7995('0x3a')](_0x4b6f99[_0x7995('0x34')][_0x7995('0x3a')]);_0x514445[_0x7995('0x3b')]=qs[_0x7995('0x32')](_['pick'](_0x4b6f99[_0x7995('0x34')],_0x456a28[_0x7995('0x32')]),_0x4253e5);if(_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]){_0x514445['where']=_[_0x7995('0x3d')](_0x514445[_0x7995('0x3b')],{'$or':_[_0x7995('0x30')](_0x4253e5,function(_0xe5ea43){if(_0xe5ea43[_0x7995('0x2d')]!==_0x7995('0x3e')){var _0x5688a1={};_0x5688a1[_0xe5ea43[_0x7995('0x29')]]={'$like':'%'+_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]+'%'};return _0x5688a1;}})});}_0x514445=_[_0x7995('0x3d')]({},_0x514445,_0x4b6f99[_0x7995('0x3f')]);var _0x298fc2={'where':_0x514445[_0x7995('0x3b')]};return db[_0x7995('0x40')][_0x7995('0x1f')](_0x298fc2)[_0x7995('0x26')](function(_0x6fe77b){_0x3250e0[_0x7995('0x1f')]=_0x6fe77b;if(_0x4b6f99[_0x7995('0x34')]['includeAll']){_0x514445['include']=[{'all':!![]}];}return db[_0x7995('0x40')][_0x7995('0x41')](_0x514445);})['then'](function(_0x4b0855){_0x3250e0[_0x7995('0x42')]=_0x4b0855;return _0x3250e0;})['then'](respondWithFilteredResult(_0x9b2a15,_0x514445))['catch'](handleError(_0x9b2a15,null));};exports[_0x7995('0x43')]=function(_0x36e28b,_0x35c8ff){var _0x576b96={'raw':!![],'where':{'id':_0x36e28b['params']['id']}},_0x46ac4f={};_0x46ac4f[_0x7995('0x2f')]=_['keys'](db['MemberReport'][_0x7995('0x44')]);_0x46ac4f[_0x7995('0x34')]=_[_0x7995('0x31')](_0x36e28b[_0x7995('0x34')]);_0x46ac4f['filters']=_[_0x7995('0x33')](_0x46ac4f[_0x7995('0x2f')],_0x46ac4f[_0x7995('0x34')]);_0x576b96[_0x7995('0x35')]=_['intersection'](_0x46ac4f['model'],qs[_0x7995('0x36')](_0x36e28b['query'][_0x7995('0x36')]));_0x576b96['attributes']=_0x576b96[_0x7995('0x35')]['length']?_0x576b96[_0x7995('0x35')]:_0x46ac4f[_0x7995('0x2f')];if(_0x36e28b['query'][_0x7995('0x45')]){_0x576b96[_0x7995('0x46')]=[{'all':!![]}];}_0x576b96=_[_0x7995('0x3d')]({},_0x576b96,_0x36e28b[_0x7995('0x3f')]);return db['MemberReport'][_0x7995('0x47')](_0x576b96)[_0x7995('0x26')](handleEntityNotFound(_0x35c8ff,null))[_0x7995('0x26')](respondWithResult(_0x35c8ff,null))['catch'](handleError(_0x35c8ff,null));};exports[_0x7995('0x48')]=function(_0x44f516,_0x511567){return db[_0x7995('0x40')][_0x7995('0x48')](_0x44f516['body'],{})[_0x7995('0x26')](respondWithResult(_0x511567,0xc9))[_0x7995('0x49')](handleError(_0x511567,null));};exports['update']=function(_0x3d1dbb,_0x5843ba){if(_0x3d1dbb[_0x7995('0x4a')]['id']){delete _0x3d1dbb[_0x7995('0x4a')]['id'];}return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x3d1dbb[_0x7995('0x4b')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x5843ba,null))[_0x7995('0x26')](saveUpdates(_0x3d1dbb['body'],null))[_0x7995('0x26')](respondWithResult(_0x5843ba,null))[_0x7995('0x49')](handleError(_0x5843ba,null));};exports[_0x7995('0x27')]=function(_0x4ffc8a,_0x19da63){return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x4ffc8a['params']['id']}})['then'](handleEntityNotFound(_0x19da63,null))['then'](removeEntity(_0x19da63,null))[_0x7995('0x49')](handleError(_0x19da63,null));};exports[_0x7995('0x4c')]=function(_0x4cf5db,_0x1cd85){return db[_0x7995('0x40')][_0x7995('0x4c')]()[_0x7995('0x26')](respondWithResult(_0x1cd85,null))[_0x7995('0x49')](handleError(_0x1cd85,null));}; \ No newline at end of file +var _0x55ca=['merge','filter','includeAll','include','findAll','rawAttributes','options','create','body','find','params','catch','destroy','describe','eml-format','rimraf','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','reject','update','then','end','sendStatus','error','stack','name','send','index','map','MemberReport','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x55ca,0x126));var _0xa55c=function(_0x45dfde,_0x597ea9){_0x45dfde=_0x45dfde-0x0;var _0x26ca3b=_0x55ca[_0x45dfde];return _0x26ca3b;};'use strict';var emlformat=require(_0xa55c('0x0'));var rimraf=require(_0xa55c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa55c('0x2'));var BPromise=require(_0xa55c('0x3'));var Mustache=require('mustache');var util=require(_0xa55c('0x4'));var path=require(_0xa55c('0x5'));var sox=require(_0xa55c('0x6'));var csv=require(_0xa55c('0x7'));var ejs=require(_0xa55c('0x8'));var fs=require('fs');var fs_extra=require(_0xa55c('0x9'));var _=require(_0xa55c('0xa'));var squel=require('squel');var crypto=require(_0xa55c('0xb'));var jsforce=require(_0xa55c('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xa55c('0x7'));var querystring=require(_0xa55c('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa55c('0xe'));var qs=require(_0xa55c('0xf'));var as=require(_0xa55c('0x10'));var hardwareService=require(_0xa55c('0x11'));var logger=require(_0xa55c('0x12'))(_0xa55c('0x13'));var utils=require(_0xa55c('0x14'));var config=require(_0xa55c('0x15'));var licenseUtil=require(_0xa55c('0x16'));var db=require(_0xa55c('0x17'))['db'];function respondWithStatusCode(_0x5d47ff,_0x59d84a){_0x59d84a=_0x59d84a||0xcc;return function(_0x2a35be){if(_0x2a35be){return _0x5d47ff['sendStatus'](_0x59d84a);}return _0x5d47ff['status'](_0x59d84a)['end']();};}function respondWithResult(_0x18ee85,_0x3930e4){_0x3930e4=_0x3930e4||0xc8;return function(_0x462cd6){if(_0x462cd6){return _0x18ee85[_0xa55c('0x18')](_0x3930e4)[_0xa55c('0x19')](_0x462cd6);}};}function respondWithFilteredResult(_0x247e77,_0x4e0b2f){return function(_0x3ccf65){if(_0x3ccf65){var _0x3dcf4f=typeof _0x4e0b2f[_0xa55c('0x1a')]===_0xa55c('0x1b')&&typeof _0x4e0b2f[_0xa55c('0x1c')]===_0xa55c('0x1b');var _0x51590e=_0x3ccf65[_0xa55c('0x1d')];var _0x24783b=_0x3dcf4f?0x0:_0x4e0b2f['offset'];var _0x3d4c9e=_0x3dcf4f?_0x3ccf65[_0xa55c('0x1d')]:_0x4e0b2f[_0xa55c('0x1a')]+_0x4e0b2f[_0xa55c('0x1c')];var _0x23a1ae;if(_0x3d4c9e>=_0x51590e){_0x3d4c9e=_0x51590e;_0x23a1ae=0xc8;}else{_0x23a1ae=0xce;}_0x247e77[_0xa55c('0x18')](_0x23a1ae);return _0x247e77['set']('Content-Range',_0x24783b+'-'+_0x3d4c9e+'/'+_0x51590e)[_0xa55c('0x19')](_0x3ccf65);}return null;};}function patchUpdates(_0x3776ac){return function(_0xade4c4){try{jsonpatch['apply'](_0xade4c4,_0x3776ac,!![]);}catch(_0x383d92){return BPromise[_0xa55c('0x1e')](_0x383d92);}return _0xade4c4['save']();};}function saveUpdates(_0x187a87,_0x133096){return function(_0x940f28){if(_0x940f28){return _0x940f28[_0xa55c('0x1f')](_0x187a87)[_0xa55c('0x20')](function(_0x49ed04){return _0x49ed04;});}return null;};}function removeEntity(_0x1fc828,_0x504c24){return function(_0x5ba836){if(_0x5ba836){return _0x5ba836['destroy']()[_0xa55c('0x20')](function(){_0x1fc828['status'](0xcc)[_0xa55c('0x21')]();});}};}function handleEntityNotFound(_0x190757,_0x3f64de){return function(_0xf0e574){if(!_0xf0e574){_0x190757[_0xa55c('0x22')](0x194);}return _0xf0e574;};}function handleError(_0x170ba4,_0x1da633){_0x1da633=_0x1da633||0x1f4;return function(_0x11e7f7){logger[_0xa55c('0x23')](_0x11e7f7[_0xa55c('0x24')]);if(_0x11e7f7[_0xa55c('0x25')]){delete _0x11e7f7['name'];}_0x170ba4[_0xa55c('0x18')](_0x1da633)[_0xa55c('0x26')](_0x11e7f7);};}exports[_0xa55c('0x27')]=function(_0x906caa,_0x5d940d){var _0x1377b0={},_0x22f6b6={},_0x1b8388={'count':0x0,'rows':[]};var _0x201941=_[_0xa55c('0x28')](db[_0xa55c('0x29')]['rawAttributes'],function(_0x23e698){return{'name':_0x23e698['fieldName'],'type':_0x23e698[_0xa55c('0x2a')][_0xa55c('0x2b')]};});_0x22f6b6[_0xa55c('0x2c')]=_[_0xa55c('0x28')](_0x201941,'name');_0x22f6b6[_0xa55c('0x2d')]=_[_0xa55c('0x2e')](_0x906caa[_0xa55c('0x2d')]);_0x22f6b6[_0xa55c('0x2f')]=_[_0xa55c('0x30')](_0x22f6b6[_0xa55c('0x2c')],_0x22f6b6[_0xa55c('0x2d')]);_0x1377b0[_0xa55c('0x31')]=_[_0xa55c('0x30')](_0x22f6b6[_0xa55c('0x2c')],qs[_0xa55c('0x32')](_0x906caa['query']['fields']));_0x1377b0[_0xa55c('0x31')]=_0x1377b0[_0xa55c('0x31')]['length']?_0x1377b0[_0xa55c('0x31')]:_0x22f6b6[_0xa55c('0x2c')];if(!_0x906caa[_0xa55c('0x2d')][_0xa55c('0x33')](_0xa55c('0x34'))){_0x1377b0[_0xa55c('0x1c')]=qs[_0xa55c('0x1c')](_0x906caa[_0xa55c('0x2d')][_0xa55c('0x1c')]);_0x1377b0['offset']=qs['offset'](_0x906caa['query'][_0xa55c('0x1a')]);}_0x1377b0[_0xa55c('0x35')]=qs[_0xa55c('0x36')](_0x906caa['query'][_0xa55c('0x36')]);_0x1377b0['where']=qs[_0xa55c('0x2f')](_['pick'](_0x906caa[_0xa55c('0x2d')],_0x22f6b6[_0xa55c('0x2f')]),_0x201941);if(_0x906caa[_0xa55c('0x2d')]['filter']){_0x1377b0[_0xa55c('0x37')]=_[_0xa55c('0x38')](_0x1377b0['where'],{'$or':_[_0xa55c('0x28')](_0x201941,function(_0x194e78){if(_0x194e78['type']!=='VIRTUAL'){var _0x235f6b={};_0x235f6b[_0x194e78['name']]={'$like':'%'+_0x906caa[_0xa55c('0x2d')][_0xa55c('0x39')]+'%'};return _0x235f6b;}})});}_0x1377b0=_['merge']({},_0x1377b0,_0x906caa['options']);var _0x5e50b6={'where':_0x1377b0['where']};return db[_0xa55c('0x29')][_0xa55c('0x1d')](_0x5e50b6)[_0xa55c('0x20')](function(_0x99c4f8){_0x1b8388[_0xa55c('0x1d')]=_0x99c4f8;if(_0x906caa['query'][_0xa55c('0x3a')]){_0x1377b0[_0xa55c('0x3b')]=[{'all':!![]}];}return db[_0xa55c('0x29')][_0xa55c('0x3c')](_0x1377b0);})[_0xa55c('0x20')](function(_0x23cef5){_0x1b8388['rows']=_0x23cef5;return _0x1b8388;})[_0xa55c('0x20')](respondWithFilteredResult(_0x5d940d,_0x1377b0))['catch'](handleError(_0x5d940d,null));};exports['show']=function(_0x404e7f,_0x1f63d8){var _0x496920={'raw':!![],'where':{'id':_0x404e7f['params']['id']}},_0x2bd98b={};_0x2bd98b['model']=_[_0xa55c('0x2e')](db[_0xa55c('0x29')][_0xa55c('0x3d')]);_0x2bd98b['query']=_[_0xa55c('0x2e')](_0x404e7f[_0xa55c('0x2d')]);_0x2bd98b['filters']=_[_0xa55c('0x30')](_0x2bd98b['model'],_0x2bd98b[_0xa55c('0x2d')]);_0x496920[_0xa55c('0x31')]=_['intersection'](_0x2bd98b[_0xa55c('0x2c')],qs[_0xa55c('0x32')](_0x404e7f['query'][_0xa55c('0x32')]));_0x496920[_0xa55c('0x31')]=_0x496920[_0xa55c('0x31')]['length']?_0x496920[_0xa55c('0x31')]:_0x2bd98b['model'];if(_0x404e7f[_0xa55c('0x2d')][_0xa55c('0x3a')]){_0x496920[_0xa55c('0x3b')]=[{'all':!![]}];}_0x496920=_['merge']({},_0x496920,_0x404e7f[_0xa55c('0x3e')]);return db[_0xa55c('0x29')]['find'](_0x496920)[_0xa55c('0x20')](handleEntityNotFound(_0x1f63d8,null))[_0xa55c('0x20')](respondWithResult(_0x1f63d8,null))['catch'](handleError(_0x1f63d8,null));};exports[_0xa55c('0x3f')]=function(_0xd3fe78,_0x52f9a7){return db[_0xa55c('0x29')][_0xa55c('0x3f')](_0xd3fe78[_0xa55c('0x40')],{})[_0xa55c('0x20')](respondWithResult(_0x52f9a7,0xc9))['catch'](handleError(_0x52f9a7,null));};exports[_0xa55c('0x1f')]=function(_0x58a7ea,_0x2157d6){if(_0x58a7ea[_0xa55c('0x40')]['id']){delete _0x58a7ea[_0xa55c('0x40')]['id'];}return db['MemberReport'][_0xa55c('0x41')]({'where':{'id':_0x58a7ea[_0xa55c('0x42')]['id']}})['then'](handleEntityNotFound(_0x2157d6,null))[_0xa55c('0x20')](saveUpdates(_0x58a7ea[_0xa55c('0x40')],null))[_0xa55c('0x20')](respondWithResult(_0x2157d6,null))[_0xa55c('0x43')](handleError(_0x2157d6,null));};exports[_0xa55c('0x44')]=function(_0x1c84d9,_0x1e1293){return db[_0xa55c('0x29')][_0xa55c('0x41')]({'where':{'id':_0x1c84d9[_0xa55c('0x42')]['id']}})['then'](handleEntityNotFound(_0x1e1293,null))[_0xa55c('0x20')](removeEntity(_0x1e1293,null))[_0xa55c('0x43')](handleError(_0x1e1293,null));};exports[_0xa55c('0x45')]=function(_0x4f73b6,_0x4c3095){return db[_0xa55c('0x29')]['describe']()[_0xa55c('0x20')](respondWithResult(_0x4c3095,null))['catch'](handleError(_0x4c3095,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index ce8f3fb..591396b 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 _0x67bc=['define','membername_interface','interface','lodash','moment','bluebird','request-promise','rimraf','./memberReport.attributes'];(function(_0x1f60a5,_0x287639){var _0x93fb38=function(_0x190ce1){while(--_0x190ce1){_0x1f60a5['push'](_0x1f60a5['shift']());}};_0x93fb38(++_0x287639);}(_0x67bc,0x1d7));var _0xc67b=function(_0x28fe94,_0x120b9b){_0x28fe94=_0x28fe94-0x0;var _0x3560da=_0x67bc[_0x28fe94];return _0x3560da;};'use strict';var _=require(_0xc67b('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xc67b('0x1'));var BPromise=require(_0xc67b('0x2'));var rp=require(_0xc67b('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc67b('0x4'));var config=require('../../config/environment');var attributes=require(_0xc67b('0x5'));module['exports']=function(_0x326ef7,_0x4efed4){return _0x326ef7[_0xc67b('0x6')]('MemberReport',attributes,{'tableName':'report_member','paranoid':![],'indexes':[{'name':_0xc67b('0x7'),'fields':['membername',_0xc67b('0x8')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb2b2=['bluebird','request-promise','path','../../config/environment','./memberReport.attributes','exports','define','MemberReport','report_member','membername','interface','lodash','../../config/logger','moment'];(function(_0x6cd3b8,_0x12122e){var _0x41d929=function(_0x383a5f){while(--_0x383a5f){_0x6cd3b8['push'](_0x6cd3b8['shift']());}};_0x41d929(++_0x12122e);}(_0xb2b2,0x7b));var _0x2b2b=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0xb2b2[_0x4a53d];return _0x27410e;};'use strict';var _=require(_0x2b2b('0x0'));var util=require('util');var logger=require(_0x2b2b('0x1'))('api');var moment=require(_0x2b2b('0x2'));var BPromise=require(_0x2b2b('0x3'));var rp=require(_0x2b2b('0x4'));var fs=require('fs');var path=require(_0x2b2b('0x5'));var rimraf=require('rimraf');var config=require(_0x2b2b('0x6'));var attributes=require(_0x2b2b('0x7'));module[_0x2b2b('0x8')]=function(_0x28af7a,_0x2d696f){return _0x28af7a[_0x2b2b('0x9')](_0x2b2b('0xa'),attributes,{'tableName':_0x2b2b('0xb'),'paranoid':![],'indexes':[{'name':'membername_interface','fields':[_0x2b2b('0xc'),_0x2b2b('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index a61ce10..22ac670 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 _0x980e=['options','raw','where','attributes','map','include','model','CreateMemberReport','create','body','then','UpdateMemberReport','update','limit','lodash','bluebird','ioredis','../../config/utils','../../config/logger','jayson/promise','request','info','MemberReport,\x20%s,\x20%s','debug','MemberReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','GetMemberReport','MemberReport','findAll'];(function(_0x14ae95,_0x4b6519){var _0xe2b584=function(_0x4514c5){while(--_0x4514c5){_0x14ae95['push'](_0x14ae95['shift']());}};_0xe2b584(++_0x4b6519);}(_0x980e,0x1a6));var _0xe980=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x980e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xe980('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xe980('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe980('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xe980('0x3'));var logger=require(_0xe980('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0xe980('0x5'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5825c1,_0xc47bdf,_0x27cc8c){return new BPromise(function(_0x3683df,_0x2d76d0){return client[_0xe980('0x6')](_0x5825c1,_0x27cc8c)['then'](function(_0xf9f019){logger[_0xe980('0x7')](_0xe980('0x8'),_0xc47bdf,'request\x20sent');logger[_0xe980('0x9')](_0xe980('0xa'),_0xc47bdf,_0xe980('0xb'),JSON[_0xe980('0xc')](_0xf9f019));if(_0xf9f019[_0xe980('0xd')]){if(_0xf9f019['error']['code']===0x1f4){logger['error'](_0xe980('0x8'),_0xc47bdf,_0xf9f019[_0xe980('0xd')]['message']);return _0x2d76d0(_0xf9f019['error'][_0xe980('0xe')]);}logger[_0xe980('0xd')](_0xe980('0x8'),_0xc47bdf,_0xf9f019[_0xe980('0xd')][_0xe980('0xe')]);return _0x3683df(_0xf9f019[_0xe980('0xd')][_0xe980('0xe')]);}else{logger['info']('MemberReport,\x20%s,\x20%s',_0xc47bdf,'request\x20sent');_0x3683df(_0xf9f019[_0xe980('0xf')][_0xe980('0xe')]);}})[_0xe980('0x10')](function(_0x406418){logger[_0xe980('0xd')]('MemberReport,\x20%s,\x20%s',_0xc47bdf,_0x406418);_0x2d76d0(_0x406418);});});}exports[_0xe980('0x11')]=function(_0x1c6354){var _0x1ddb12=this;return new Promise(function(_0x538d32,_0x5aa2c1){return db[_0xe980('0x12')][_0xe980('0x13')]({'raw':_0x1c6354[_0xe980('0x14')]?_0x1c6354[_0xe980('0x14')][_0xe980('0x15')]===undefined?!![]:![]:!![],'where':_0x1c6354[_0xe980('0x14')]?_0x1c6354[_0xe980('0x14')][_0xe980('0x16')]||null:null,'attributes':_0x1c6354['options']?_0x1c6354['options'][_0xe980('0x17')]||null:null,'limit':_0x1c6354[_0xe980('0x14')]?_0x1c6354[_0xe980('0x14')]['limit']||null:null,'include':_0x1c6354[_0xe980('0x14')]?_0x1c6354[_0xe980('0x14')]['include']?_[_0xe980('0x18')](_0x1c6354[_0xe980('0x14')][_0xe980('0x19')],function(_0x4b7888){return{'model':db[_0x4b7888[_0xe980('0x1a')]],'as':_0x4b7888['as'],'attributes':_0x4b7888['attributes'],'include':_0x4b7888[_0xe980('0x19')]?_[_0xe980('0x18')](_0x4b7888[_0xe980('0x19')],function(_0x40a34e){return{'model':db[_0x40a34e['model']],'as':_0x40a34e['as'],'attributes':_0x40a34e[_0xe980('0x17')],'include':_0x40a34e[_0xe980('0x19')]?_[_0xe980('0x18')](_0x40a34e['include'],function(_0x54e755){return{'model':db[_0x54e755[_0xe980('0x1a')]],'as':_0x54e755['as'],'attributes':_0x54e755[_0xe980('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x16f2fe){logger['info'](_0xe980('0x11'),_0x1c6354);logger[_0xe980('0x9')](_0xe980('0x11'),_0x1c6354,JSON[_0xe980('0xc')](_0x16f2fe));_0x538d32(_0x16f2fe);})[_0xe980('0x10')](function(_0x43a7c2){logger['error'](_0xe980('0x11'),_0x43a7c2['message'],_0x1c6354);_0x5aa2c1(_0x1ddb12[_0xe980('0xd')](0x1f4,_0x43a7c2[_0xe980('0xe')]));});});};exports[_0xe980('0x1b')]=function(_0x38ab6d){var _0x2a9ea2=this;return new Promise(function(_0x56fbf7,_0x4bf013){return db[_0xe980('0x12')][_0xe980('0x1c')](_0x38ab6d[_0xe980('0x1d')],{'raw':_0x38ab6d[_0xe980('0x14')]?_0x38ab6d[_0xe980('0x14')][_0xe980('0x15')]===undefined?!![]:![]:!![]})[_0xe980('0x1e')](function(_0x369c3a){logger[_0xe980('0x7')](_0xe980('0x1b'),_0x38ab6d);logger[_0xe980('0x9')]('CreateMemberReport',_0x38ab6d,JSON['stringify'](_0x369c3a));_0x56fbf7(_0x369c3a);})[_0xe980('0x10')](function(_0x4702e0){logger[_0xe980('0xd')]('CreateMemberReport',_0x4702e0[_0xe980('0xe')],_0x38ab6d);_0x4bf013(_0x2a9ea2[_0xe980('0xd')](0x1f4,_0x4702e0[_0xe980('0xe')]));});});};exports[_0xe980('0x1f')]=function(_0x163db9){var _0x44686a=this;return new Promise(function(_0x1811b3,_0x36ab72){return db[_0xe980('0x12')][_0xe980('0x20')](_0x163db9['body'],{'raw':_0x163db9['options']?_0x163db9[_0xe980('0x14')][_0xe980('0x15')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x163db9['options']?_0x163db9[_0xe980('0x14')]['where']||null:null,'attributes':_0x163db9[_0xe980('0x14')]?_0x163db9[_0xe980('0x14')][_0xe980('0x17')]||null:null,'limit':_0x163db9[_0xe980('0x14')]?_0x163db9[_0xe980('0x14')][_0xe980('0x21')]||null:null})['then'](function(_0x11fb5b){logger[_0xe980('0x7')](_0xe980('0x1f'),_0x163db9);logger[_0xe980('0x9')](_0xe980('0x1f'),_0x163db9,JSON['stringify'](_0x11fb5b));_0x1811b3(_0x11fb5b);})[_0xe980('0x10')](function(_0x1f35ed){logger[_0xe980('0xd')]('UpdateMemberReport',_0x1f35ed[_0xe980('0xe')],_0x163db9);_0x36ab72(_0x44686a['error'](0x1f4,_0x1f35ed[_0xe980('0xe')]));});});}; \ No newline at end of file +var _0xfd2e=['../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','MemberReport,\x20%s,\x20%s','request\x20sent','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetMemberReport','findAll','options','raw','where','limit','include','map','model','attributes','CreateMemberReport','MemberReport','create','body','debug','UpdateMemberReport','update','lodash','moment','randomstring','../../mysqldb'];(function(_0x259987,_0x56bead){var _0x5036e9=function(_0x5a5098){while(--_0x5a5098){_0x259987['push'](_0x259987['shift']());}};_0x5036e9(++_0x56bead);}(_0xfd2e,0x6e));var _0xefd2=function(_0x3c9b3f,_0x4e5ef6){_0x3c9b3f=_0x3c9b3f-0x0;var _0x20248a=_0xfd2e[_0x3c9b3f];return _0x20248a;};'use strict';var _=require(_0xefd2('0x0'));var util=require('util');var moment=require(_0xefd2('0x1'));var BPromise=require('bluebird');var rs=require(_0xefd2('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xefd2('0x3'))['db'];var utils=require(_0xefd2('0x4'));var logger=require(_0xefd2('0x5'))(_0xefd2('0x6'));var config=require(_0xefd2('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xefd2('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x516aab,_0x51fab0,_0x43d90b){return new BPromise(function(_0x50dd63,_0x440d11){return client[_0xefd2('0x9')](_0x516aab,_0x43d90b)[_0xefd2('0xa')](function(_0xded765){logger[_0xefd2('0xb')](_0xefd2('0xc'),_0x51fab0,_0xefd2('0xd'));logger['debug'](_0xefd2('0xe'),_0x51fab0,_0xefd2('0xd'),JSON[_0xefd2('0xf')](_0xded765));if(_0xded765[_0xefd2('0x10')]){if(_0xded765[_0xefd2('0x10')][_0xefd2('0x11')]===0x1f4){logger[_0xefd2('0x10')](_0xefd2('0xc'),_0x51fab0,_0xded765['error']['message']);return _0x440d11(_0xded765[_0xefd2('0x10')]['message']);}logger['error'](_0xefd2('0xc'),_0x51fab0,_0xded765[_0xefd2('0x10')][_0xefd2('0x12')]);return _0x50dd63(_0xded765[_0xefd2('0x10')][_0xefd2('0x12')]);}else{logger['info'](_0xefd2('0xc'),_0x51fab0,_0xefd2('0xd'));_0x50dd63(_0xded765[_0xefd2('0x13')][_0xefd2('0x12')]);}})[_0xefd2('0x14')](function(_0x471e3b){logger['error']('MemberReport,\x20%s,\x20%s',_0x51fab0,_0x471e3b);_0x440d11(_0x471e3b);});});}exports[_0xefd2('0x15')]=function(_0x111d7b){var _0x1d7240=this;return new Promise(function(_0x471175,_0x3602d1){return db['MemberReport'][_0xefd2('0x16')]({'raw':_0x111d7b[_0xefd2('0x17')]?_0x111d7b[_0xefd2('0x17')][_0xefd2('0x18')]===undefined?!![]:![]:!![],'where':_0x111d7b['options']?_0x111d7b[_0xefd2('0x17')][_0xefd2('0x19')]||null:null,'attributes':_0x111d7b[_0xefd2('0x17')]?_0x111d7b[_0xefd2('0x17')]['attributes']||null:null,'limit':_0x111d7b[_0xefd2('0x17')]?_0x111d7b[_0xefd2('0x17')][_0xefd2('0x1a')]||null:null,'include':_0x111d7b[_0xefd2('0x17')]?_0x111d7b[_0xefd2('0x17')][_0xefd2('0x1b')]?_[_0xefd2('0x1c')](_0x111d7b['options']['include'],function(_0x31180b){return{'model':db[_0x31180b[_0xefd2('0x1d')]],'as':_0x31180b['as'],'attributes':_0x31180b[_0xefd2('0x1e')],'include':_0x31180b[_0xefd2('0x1b')]?_[_0xefd2('0x1c')](_0x31180b[_0xefd2('0x1b')],function(_0x42e4e6){return{'model':db[_0x42e4e6[_0xefd2('0x1d')]],'as':_0x42e4e6['as'],'attributes':_0x42e4e6[_0xefd2('0x1e')],'include':_0x42e4e6[_0xefd2('0x1b')]?_[_0xefd2('0x1c')](_0x42e4e6['include'],function(_0x348019){return{'model':db[_0x348019[_0xefd2('0x1d')]],'as':_0x348019['as'],'attributes':_0x348019[_0xefd2('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xefd2('0xa')](function(_0x10ec88){logger[_0xefd2('0xb')](_0xefd2('0x15'),_0x111d7b);logger['debug'](_0xefd2('0x15'),_0x111d7b,JSON[_0xefd2('0xf')](_0x10ec88));_0x471175(_0x10ec88);})[_0xefd2('0x14')](function(_0x46e68d){logger[_0xefd2('0x10')]('GetMemberReport',_0x46e68d[_0xefd2('0x12')],_0x111d7b);_0x3602d1(_0x1d7240[_0xefd2('0x10')](0x1f4,_0x46e68d['message']));});});};exports[_0xefd2('0x1f')]=function(_0xaccd28){var _0x1f16a1=this;return new Promise(function(_0x22326f,_0x15d7b7){return db[_0xefd2('0x20')][_0xefd2('0x21')](_0xaccd28[_0xefd2('0x22')],{'raw':_0xaccd28[_0xefd2('0x17')]?_0xaccd28[_0xefd2('0x17')][_0xefd2('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x25644c){logger[_0xefd2('0xb')](_0xefd2('0x1f'),_0xaccd28);logger[_0xefd2('0x23')](_0xefd2('0x1f'),_0xaccd28,JSON[_0xefd2('0xf')](_0x25644c));_0x22326f(_0x25644c);})[_0xefd2('0x14')](function(_0x3ce0c6){logger[_0xefd2('0x10')](_0xefd2('0x1f'),_0x3ce0c6[_0xefd2('0x12')],_0xaccd28);_0x15d7b7(_0x1f16a1['error'](0x1f4,_0x3ce0c6[_0xefd2('0x12')]));});});};exports[_0xefd2('0x24')]=function(_0x4fdba9){var _0x38ed70=this;return new Promise(function(_0xd54536,_0x4aab97){return db['MemberReport'][_0xefd2('0x25')](_0x4fdba9['body'],{'raw':_0x4fdba9[_0xefd2('0x17')]?_0x4fdba9[_0xefd2('0x17')][_0xefd2('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4fdba9[_0xefd2('0x17')]?_0x4fdba9[_0xefd2('0x17')]['where']||null:null,'attributes':_0x4fdba9[_0xefd2('0x17')]?_0x4fdba9[_0xefd2('0x17')][_0xefd2('0x1e')]||null:null,'limit':_0x4fdba9[_0xefd2('0x17')]?_0x4fdba9[_0xefd2('0x17')][_0xefd2('0x1a')]||null:null})[_0xefd2('0xa')](function(_0x284594){logger[_0xefd2('0xb')](_0xefd2('0x24'),_0x4fdba9);logger[_0xefd2('0x23')](_0xefd2('0x24'),_0x4fdba9,JSON[_0xefd2('0xf')](_0x284594));_0xd54536(_0x284594);})[_0xefd2('0x14')](function(_0x21eebd){logger[_0xefd2('0x10')](_0xefd2('0x24'),_0x21eebd[_0xefd2('0x12')],_0x4fdba9);_0x4aab97(_0x38ed70[_0xefd2('0x10')](0x1f4,_0x21eebd[_0xefd2('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 7800091..cc993d3 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 _0x8f18=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','exports','multer','util'];(function(_0x1969a7,_0x5a133a){var _0x3d665f=function(_0x39c64b){while(--_0x39c64b){_0x1969a7['push'](_0x1969a7['shift']());}};_0x3d665f(++_0x5a133a);}(_0x8f18,0x1ea));var _0x88f1=function(_0x4ff4b1,_0x167bad){_0x4ff4b1=_0x4ff4b1-0x0;var _0x4b6552=_0x8f18[_0x4ff4b1];return _0x4b6552;};'use strict';var multer=require(_0x88f1('0x0'));var util=require(_0x88f1('0x1'));var path=require(_0x88f1('0x2'));var timeout=require(_0x88f1('0x3'));var express=require(_0x88f1('0x4'));var router=express[_0x88f1('0x5')]();var fs_extra=require(_0x88f1('0x6'));var auth=require(_0x88f1('0x7'));var interaction=require(_0x88f1('0x8'));var config=require(_0x88f1('0x9'));var controller=require('./migration.controller');router[_0x88f1('0xa')]('/',controller['index']);module[_0x88f1('0xb')]=router; \ No newline at end of file +var _0xef4b=['exports','util','fs-extra','../../components/auth/service','../../components/interaction/service','./migration.controller','index'];(function(_0x2e85d3,_0x14e2af){var _0x438657=function(_0x2a3c5d){while(--_0x2a3c5d){_0x2e85d3['push'](_0x2e85d3['shift']());}};_0x438657(++_0x14e2af);}(_0xef4b,0x86));var _0xbef4=function(_0x1c208e,_0x2a0a5b){_0x1c208e=_0x1c208e-0x0;var _0x5104ff=_0xef4b[_0x1c208e];return _0x5104ff;};'use strict';var multer=require('multer');var util=require(_0xbef4('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xbef4('0x1'));var auth=require(_0xbef4('0x2'));var interaction=require(_0xbef4('0x3'));var config=require('../../config/environment');var controller=require(_0xbef4('0x4'));router['get']('/',controller[_0xbef4('0x5')]);module[_0xbef4('0x6')]=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index 09a1634..67570fe 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 _0x94c3=['version','sequelize','exports','STRING'];(function(_0x495f46,_0x4e98fb){var _0x5e999d=function(_0x502e53){while(--_0x502e53){_0x495f46['push'](_0x495f46['shift']());}};_0x5e999d(++_0x4e98fb);}(_0x94c3,0x1c5));var _0x394c=function(_0x35b9af,_0x2d6211){_0x35b9af=_0x35b9af-0x0;var _0x1fb437=_0x94c3[_0x35b9af];return _0x1fb437;};'use strict';var Sequelize=require(_0x394c('0x0'));module[_0x394c('0x1')]={'version':{'type':Sequelize[_0x394c('0x2')],'unique':_0x394c('0x3')}}; \ No newline at end of file +var _0xab98=['sequelize','STRING'];(function(_0x19e2be,_0x4a4e56){var _0x33510a=function(_0x5272fa){while(--_0x5272fa){_0x19e2be['push'](_0x19e2be['shift']());}};_0x33510a(++_0x4a4e56);}(_0xab98,0x108));var _0x8ab9=function(_0xcb6396,_0x2ca5b9){_0xcb6396=_0xcb6396-0x0;var _0x53a130=_0xab98[_0xcb6396];return _0x53a130;};'use strict';var Sequelize=require(_0x8ab9('0x0'));module['exports']={'version':{'type':Sequelize[_0x8ab9('0x1')],'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 c778ba3..50a54b9 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 _0x7089=['where','pick','filter','merge','type','VIRTUAL','options','then','includeAll','findAll','rows','catch','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','error','name','send','index','map','Migration','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort'];(function(_0x504e47,_0x14833d){var _0x286028=function(_0x1460d3){while(--_0x1460d3){_0x504e47['push'](_0x504e47['shift']());}};_0x286028(++_0x14833d);}(_0x7089,0xd8));var _0x9708=function(_0x1c83b7,_0x1e1ce1){_0x1c83b7=_0x1c83b7-0x0;var _0x3a7eef=_0x7089[_0x1c83b7];return _0x3a7eef;};'use strict';var emlformat=require(_0x9708('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9708('0x1'));var jsonpatch=require(_0x9708('0x2'));var rp=require('request-promise');var moment=require(_0x9708('0x3'));var BPromise=require(_0x9708('0x4'));var Mustache=require(_0x9708('0x5'));var util=require('util');var path=require(_0x9708('0x6'));var sox=require(_0x9708('0x7'));var csv=require('to-csv');var ejs=require(_0x9708('0x8'));var fs=require('fs');var fs_extra=require(_0x9708('0x9'));var _=require(_0x9708('0xa'));var squel=require('squel');var crypto=require(_0x9708('0xb'));var jsforce=require(_0x9708('0xc'));var deskjs=require(_0x9708('0xd'));var toCsv=require(_0x9708('0xe'));var querystring=require('querystring');var Papa=require(_0x9708('0xf'));var Redis=require(_0x9708('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9708('0x11'));var logger=require(_0x9708('0x12'))(_0x9708('0x13'));var utils=require(_0x9708('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x9708('0x15'))['db'];function respondWithStatusCode(_0xa548fa,_0x3f6bab){_0x3f6bab=_0x3f6bab||0xcc;return function(_0x577fb7){if(_0x577fb7){return _0xa548fa[_0x9708('0x16')](_0x3f6bab);}return _0xa548fa['status'](_0x3f6bab)[_0x9708('0x17')]();};}function respondWithResult(_0x31397f,_0x138a65){_0x138a65=_0x138a65||0xc8;return function(_0x1c5d95){if(_0x1c5d95){return _0x31397f[_0x9708('0x18')](_0x138a65)[_0x9708('0x19')](_0x1c5d95);}};}function respondWithFilteredResult(_0x1eddc0,_0x3bcae4){return function(_0x980735){if(_0x980735){var _0x154a6a=typeof _0x3bcae4[_0x9708('0x1a')]===_0x9708('0x1b')&&typeof _0x3bcae4[_0x9708('0x1c')]===_0x9708('0x1b');var _0xbe3004=_0x980735[_0x9708('0x1d')];var _0x453835=_0x154a6a?0x0:_0x3bcae4[_0x9708('0x1a')];var _0x5935fd=_0x154a6a?_0x980735[_0x9708('0x1d')]:_0x3bcae4['offset']+_0x3bcae4[_0x9708('0x1c')];var _0x5e41d7;if(_0x5935fd>=_0xbe3004){_0x5935fd=_0xbe3004;_0x5e41d7=0xc8;}else{_0x5e41d7=0xce;}_0x1eddc0[_0x9708('0x18')](_0x5e41d7);return _0x1eddc0[_0x9708('0x1e')](_0x9708('0x1f'),_0x453835+'-'+_0x5935fd+'/'+_0xbe3004)[_0x9708('0x19')](_0x980735);}return null;};}function patchUpdates(_0x2ee0b1){return function(_0x3cd803){try{jsonpatch[_0x9708('0x20')](_0x3cd803,_0x2ee0b1,!![]);}catch(_0x117ce2){return BPromise[_0x9708('0x21')](_0x117ce2);}return _0x3cd803[_0x9708('0x22')]();};}function saveUpdates(_0x3bea52,_0x5055ba){return function(_0x2186c8){if(_0x2186c8){return _0x2186c8[_0x9708('0x23')](_0x3bea52)['then'](function(_0x59a10c){return _0x59a10c;});}return null;};}function removeEntity(_0x152c6e,_0x554af6){return function(_0x2eb3eb){if(_0x2eb3eb){return _0x2eb3eb['destroy']()['then'](function(){_0x152c6e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x29bbbf,_0x4bc5c5){return function(_0x51145e){if(!_0x51145e){_0x29bbbf[_0x9708('0x16')](0x194);}return _0x51145e;};}function handleError(_0x22f944,_0x224eb7){_0x224eb7=_0x224eb7||0x1f4;return function(_0x4fd3cd){logger[_0x9708('0x24')](_0x4fd3cd['stack']);if(_0x4fd3cd[_0x9708('0x25')]){delete _0x4fd3cd[_0x9708('0x25')];}_0x22f944[_0x9708('0x18')](_0x224eb7)[_0x9708('0x26')](_0x4fd3cd);};}exports[_0x9708('0x27')]=function(_0x4c079d,_0x59398b){var _0x4643cb={},_0x193c84={},_0x361fd2={'count':0x0,'rows':[]};var _0x227fe5=_[_0x9708('0x28')](db[_0x9708('0x29')][_0x9708('0x2a')],function(_0x2a77a7){return{'name':_0x2a77a7[_0x9708('0x2b')],'type':_0x2a77a7['type'][_0x9708('0x2c')]};});_0x193c84[_0x9708('0x2d')]=_['map'](_0x227fe5,_0x9708('0x25'));_0x193c84[_0x9708('0x2e')]=_[_0x9708('0x2f')](_0x4c079d[_0x9708('0x2e')]);_0x193c84[_0x9708('0x30')]=_[_0x9708('0x31')](_0x193c84['model'],_0x193c84[_0x9708('0x2e')]);_0x4643cb[_0x9708('0x32')]=_[_0x9708('0x31')](_0x193c84[_0x9708('0x2d')],qs[_0x9708('0x33')](_0x4c079d[_0x9708('0x2e')][_0x9708('0x33')]));_0x4643cb['attributes']=_0x4643cb[_0x9708('0x32')][_0x9708('0x34')]?_0x4643cb['attributes']:_0x193c84['model'];if(!_0x4c079d[_0x9708('0x2e')][_0x9708('0x35')](_0x9708('0x36'))){_0x4643cb[_0x9708('0x1c')]=qs['limit'](_0x4c079d[_0x9708('0x2e')]['limit']);_0x4643cb[_0x9708('0x1a')]=qs['offset'](_0x4c079d[_0x9708('0x2e')][_0x9708('0x1a')]);}_0x4643cb['order']=qs[_0x9708('0x37')](_0x4c079d[_0x9708('0x2e')]['sort']);_0x4643cb[_0x9708('0x38')]=qs[_0x9708('0x30')](_[_0x9708('0x39')](_0x4c079d[_0x9708('0x2e')],_0x193c84['filters']),_0x227fe5);if(_0x4c079d[_0x9708('0x2e')][_0x9708('0x3a')]){_0x4643cb['where']=_[_0x9708('0x3b')](_0x4643cb[_0x9708('0x38')],{'$or':_[_0x9708('0x28')](_0x227fe5,function(_0x304bd2){if(_0x304bd2[_0x9708('0x3c')]!==_0x9708('0x3d')){var _0x42f2d0={};_0x42f2d0[_0x304bd2['name']]={'$like':'%'+_0x4c079d[_0x9708('0x2e')][_0x9708('0x3a')]+'%'};return _0x42f2d0;}})});}_0x4643cb=_[_0x9708('0x3b')]({},_0x4643cb,_0x4c079d[_0x9708('0x3e')]);var _0x50b3f3={'where':_0x4643cb[_0x9708('0x38')]};return db['Migration'][_0x9708('0x1d')](_0x50b3f3)[_0x9708('0x3f')](function(_0x2b6175){_0x361fd2[_0x9708('0x1d')]=_0x2b6175;if(_0x4c079d[_0x9708('0x2e')][_0x9708('0x40')]){_0x4643cb['include']=[{'all':!![]}];}return db[_0x9708('0x29')][_0x9708('0x41')](_0x4643cb);})[_0x9708('0x3f')](function(_0x11f406){_0x361fd2[_0x9708('0x42')]=_0x11f406;return _0x361fd2;})[_0x9708('0x3f')](respondWithFilteredResult(_0x59398b,_0x4643cb))[_0x9708('0x43')](handleError(_0x59398b,null));}; \ No newline at end of file +var _0x475c=['name','send','index','map','Migration','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','findAll','rows','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','error','stack'];(function(_0x3c8e9a,_0x384306){var _0x2d4c57=function(_0x43d408){while(--_0x43d408){_0x3c8e9a['push'](_0x3c8e9a['shift']());}};_0x2d4c57(++_0x384306);}(_0x475c,0x1c1));var _0xc475=function(_0x44a5c0,_0x3a12bb){_0x44a5c0=_0x44a5c0-0x0;var _0x1f5334=_0x475c[_0x44a5c0];return _0x1f5334;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc475('0x0'));var zipdir=require(_0xc475('0x1'));var jsonpatch=require(_0xc475('0x2'));var rp=require(_0xc475('0x3'));var moment=require(_0xc475('0x4'));var BPromise=require(_0xc475('0x5'));var Mustache=require(_0xc475('0x6'));var util=require(_0xc475('0x7'));var path=require('path');var sox=require(_0xc475('0x8'));var csv=require(_0xc475('0x9'));var ejs=require(_0xc475('0xa'));var fs=require('fs');var fs_extra=require(_0xc475('0xb'));var _=require('lodash');var squel=require(_0xc475('0xc'));var crypto=require(_0xc475('0xd'));var jsforce=require(_0xc475('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xc475('0x9'));var querystring=require(_0xc475('0xf'));var Papa=require(_0xc475('0x10'));var Redis=require(_0xc475('0x11'));var authService=require(_0xc475('0x12'));var qs=require(_0xc475('0x13'));var as=require(_0xc475('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xc475('0x15'));var utils=require('../../config/utils');var config=require(_0xc475('0x16'));var licenseUtil=require(_0xc475('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x30963a,_0x4f6958){_0x4f6958=_0x4f6958||0xcc;return function(_0x35cedf){if(_0x35cedf){return _0x30963a[_0xc475('0x18')](_0x4f6958);}return _0x30963a[_0xc475('0x19')](_0x4f6958)[_0xc475('0x1a')]();};}function respondWithResult(_0x2bd768,_0x3cb9f8){_0x3cb9f8=_0x3cb9f8||0xc8;return function(_0x3c5ab8){if(_0x3c5ab8){return _0x2bd768[_0xc475('0x19')](_0x3cb9f8)[_0xc475('0x1b')](_0x3c5ab8);}};}function respondWithFilteredResult(_0x9b4c70,_0x4b8733){return function(_0x4c316b){if(_0x4c316b){var _0x4beffe=typeof _0x4b8733[_0xc475('0x1c')]===_0xc475('0x1d')&&typeof _0x4b8733[_0xc475('0x1e')]==='undefined';var _0x1e3267=_0x4c316b['count'];var _0x1e4ad2=_0x4beffe?0x0:_0x4b8733['offset'];var _0x3ffbb0=_0x4beffe?_0x4c316b[_0xc475('0x1f')]:_0x4b8733[_0xc475('0x1c')]+_0x4b8733[_0xc475('0x1e')];var _0x43de19;if(_0x3ffbb0>=_0x1e3267){_0x3ffbb0=_0x1e3267;_0x43de19=0xc8;}else{_0x43de19=0xce;}_0x9b4c70[_0xc475('0x19')](_0x43de19);return _0x9b4c70[_0xc475('0x20')](_0xc475('0x21'),_0x1e4ad2+'-'+_0x3ffbb0+'/'+_0x1e3267)[_0xc475('0x1b')](_0x4c316b);}return null;};}function patchUpdates(_0x32ce34){return function(_0x9205e5){try{jsonpatch['apply'](_0x9205e5,_0x32ce34,!![]);}catch(_0x41c3da){return BPromise[_0xc475('0x22')](_0x41c3da);}return _0x9205e5[_0xc475('0x23')]();};}function saveUpdates(_0x5d5adc,_0x3057eb){return function(_0x22b677){if(_0x22b677){return _0x22b677[_0xc475('0x24')](_0x5d5adc)[_0xc475('0x25')](function(_0x4eead3){return _0x4eead3;});}return null;};}function removeEntity(_0x3f4bf6,_0x16f456){return function(_0x4ca52a){if(_0x4ca52a){return _0x4ca52a[_0xc475('0x26')]()['then'](function(){_0x3f4bf6[_0xc475('0x19')](0xcc)[_0xc475('0x1a')]();});}};}function handleEntityNotFound(_0x454be3,_0x2a20fb){return function(_0x1af69c){if(!_0x1af69c){_0x454be3[_0xc475('0x18')](0x194);}return _0x1af69c;};}function handleError(_0x28a470,_0x2ba55d){_0x2ba55d=_0x2ba55d||0x1f4;return function(_0x501d28){logger[_0xc475('0x27')](_0x501d28[_0xc475('0x28')]);if(_0x501d28['name']){delete _0x501d28[_0xc475('0x29')];}_0x28a470['status'](_0x2ba55d)[_0xc475('0x2a')](_0x501d28);};}exports[_0xc475('0x2b')]=function(_0x50943b,_0x29b487){var _0x3d0979={},_0x108f29={},_0x4d0b27={'count':0x0,'rows':[]};var _0x246dcd=_[_0xc475('0x2c')](db[_0xc475('0x2d')][_0xc475('0x2e')],function(_0x26be98){return{'name':_0x26be98[_0xc475('0x2f')],'type':_0x26be98['type'][_0xc475('0x30')]};});_0x108f29[_0xc475('0x31')]=_[_0xc475('0x2c')](_0x246dcd,'name');_0x108f29[_0xc475('0x32')]=_[_0xc475('0x33')](_0x50943b[_0xc475('0x32')]);_0x108f29[_0xc475('0x34')]=_[_0xc475('0x35')](_0x108f29[_0xc475('0x31')],_0x108f29[_0xc475('0x32')]);_0x3d0979[_0xc475('0x36')]=_[_0xc475('0x35')](_0x108f29[_0xc475('0x31')],qs[_0xc475('0x37')](_0x50943b[_0xc475('0x32')]['fields']));_0x3d0979[_0xc475('0x36')]=_0x3d0979[_0xc475('0x36')][_0xc475('0x38')]?_0x3d0979[_0xc475('0x36')]:_0x108f29[_0xc475('0x31')];if(!_0x50943b[_0xc475('0x32')]['hasOwnProperty'](_0xc475('0x39'))){_0x3d0979[_0xc475('0x1e')]=qs['limit'](_0x50943b[_0xc475('0x32')][_0xc475('0x1e')]);_0x3d0979[_0xc475('0x1c')]=qs[_0xc475('0x1c')](_0x50943b['query'][_0xc475('0x1c')]);}_0x3d0979[_0xc475('0x3a')]=qs[_0xc475('0x3b')](_0x50943b[_0xc475('0x32')][_0xc475('0x3b')]);_0x3d0979[_0xc475('0x3c')]=qs['filters'](_[_0xc475('0x3d')](_0x50943b[_0xc475('0x32')],_0x108f29[_0xc475('0x34')]),_0x246dcd);if(_0x50943b[_0xc475('0x32')][_0xc475('0x3e')]){_0x3d0979[_0xc475('0x3c')]=_[_0xc475('0x3f')](_0x3d0979[_0xc475('0x3c')],{'$or':_[_0xc475('0x2c')](_0x246dcd,function(_0x1ef081){if(_0x1ef081[_0xc475('0x40')]!==_0xc475('0x41')){var _0x9e4f62={};_0x9e4f62[_0x1ef081[_0xc475('0x29')]]={'$like':'%'+_0x50943b[_0xc475('0x32')]['filter']+'%'};return _0x9e4f62;}})});}_0x3d0979=_[_0xc475('0x3f')]({},_0x3d0979,_0x50943b[_0xc475('0x42')]);var _0x426e30={'where':_0x3d0979['where']};return db[_0xc475('0x2d')][_0xc475('0x1f')](_0x426e30)[_0xc475('0x25')](function(_0x3fb954){_0x4d0b27[_0xc475('0x1f')]=_0x3fb954;if(_0x50943b['query'][_0xc475('0x43')]){_0x3d0979['include']=[{'all':!![]}];}return db['Migration'][_0xc475('0x44')](_0x3d0979);})[_0xc475('0x25')](function(_0x21ed8b){_0x4d0b27[_0xc475('0x45')]=_0x21ed8b;return _0x4d0b27;})[_0xc475('0x25')](respondWithFilteredResult(_0x29b487,_0x3d0979))['catch'](handleError(_0x29b487,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index 86df717..72ca3c2 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 _0x4bfd=['./migration.attributes','exports','Migration','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x3da7ed,_0x38c5f2){var _0x1bdd8e=function(_0x4fe142){while(--_0x4fe142){_0x3da7ed['push'](_0x3da7ed['shift']());}};_0x1bdd8e(++_0x38c5f2);}(_0x4bfd,0x1b3));var _0xd4bf=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4bfd[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd4bf('0x0'));var util=require(_0xd4bf('0x1'));var logger=require(_0xd4bf('0x2'))('api');var moment=require(_0xd4bf('0x3'));var BPromise=require(_0xd4bf('0x4'));var rp=require(_0xd4bf('0x5'));var fs=require('fs');var path=require(_0xd4bf('0x6'));var rimraf=require(_0xd4bf('0x7'));var config=require(_0xd4bf('0x8'));var attributes=require(_0xd4bf('0x9'));module[_0xd4bf('0xa')]=function(_0x4ffe28,_0x4994c5){return _0x4ffe28['define'](_0xd4bf('0xb'),attributes,{'tableName':'migrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfecb=['rimraf','../../config/environment','exports','define','Migration','lodash','util','api','moment','request-promise'];(function(_0x388d1d,_0x1a045e){var _0x4ea0c0=function(_0x3a5355){while(--_0x3a5355){_0x388d1d['push'](_0x388d1d['shift']());}};_0x4ea0c0(++_0x1a045e);}(_0xfecb,0x181));var _0xbfec=function(_0x50182e,_0x5bce86){_0x50182e=_0x50182e-0x0;var _0x47c614=_0xfecb[_0x50182e];return _0x47c614;};'use strict';var _=require(_0xbfec('0x0'));var util=require(_0xbfec('0x1'));var logger=require('../../config/logger')(_0xbfec('0x2'));var moment=require(_0xbfec('0x3'));var BPromise=require('bluebird');var rp=require(_0xbfec('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbfec('0x5'));var config=require(_0xbfec('0x6'));var attributes=require('./migration.attributes');module[_0xbfec('0x7')]=function(_0x410d46,_0x8569df){return _0x410d46[_0xbfec('0x8')](_0xbfec('0x9'),attributes,{'tableName':'migrations','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 df01e5e..229af5a 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 _0x153f=['message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','Migration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x20d2c1,_0x5ce7b3){var _0x57948a=function(_0x10cd89){while(--_0x10cd89){_0x20d2c1['push'](_0x20d2c1['shift']());}};_0x57948a(++_0x5ce7b3);}(_0x153f,0x15b));var _0xf153=function(_0x31b491,_0x59026d){_0x31b491=_0x31b491-0x0;var _0x31a751=_0x153f[_0x31b491];return _0x31a751;};'use strict';var _=require(_0xf153('0x0'));var util=require(_0xf153('0x1'));var moment=require(_0xf153('0x2'));var BPromise=require(_0xf153('0x3'));var rs=require(_0xf153('0x4'));var fs=require('fs');var Redis=require(_0xf153('0x5'));var db=require(_0xf153('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xf153('0x7'))('rpc');var config=require(_0xf153('0x8'));var jayson=require(_0xf153('0x9'));var client=jayson[_0xf153('0xa')][_0xf153('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x21f432,_0x4c8ae5,_0x17ba96){return new BPromise(function(_0x143497,_0x224f88){return client[_0xf153('0xc')](_0x21f432,_0x17ba96)[_0xf153('0xd')](function(_0x3e7a82){logger[_0xf153('0xe')](_0xf153('0xf'),_0x4c8ae5,_0xf153('0x10'));logger[_0xf153('0x11')]('Migration,\x20%s,\x20%s,\x20%s',_0x4c8ae5,_0xf153('0x10'),JSON[_0xf153('0x12')](_0x3e7a82));if(_0x3e7a82[_0xf153('0x13')]){if(_0x3e7a82['error'][_0xf153('0x14')]===0x1f4){logger[_0xf153('0x13')](_0xf153('0xf'),_0x4c8ae5,_0x3e7a82[_0xf153('0x13')][_0xf153('0x15')]);return _0x224f88(_0x3e7a82[_0xf153('0x13')][_0xf153('0x15')]);}logger[_0xf153('0x13')](_0xf153('0xf'),_0x4c8ae5,_0x3e7a82['error'][_0xf153('0x15')]);return _0x143497(_0x3e7a82[_0xf153('0x13')][_0xf153('0x15')]);}else{logger[_0xf153('0xe')](_0xf153('0xf'),_0x4c8ae5,_0xf153('0x10'));_0x143497(_0x3e7a82[_0xf153('0x16')][_0xf153('0x15')]);}})['catch'](function(_0x35f4e8){logger['error'](_0xf153('0xf'),_0x4c8ae5,_0x35f4e8);_0x224f88(_0x35f4e8);});});} \ No newline at end of file +var _0x9181=['message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x19cf44,_0x2819e9){var _0x44643b=function(_0x556c79){while(--_0x556c79){_0x19cf44['push'](_0x19cf44['shift']());}};_0x44643b(++_0x2819e9);}(_0x9181,0x182));var _0x1918=function(_0x282f2c,_0x18d326){_0x282f2c=_0x282f2c-0x0;var _0x215bf7=_0x9181[_0x282f2c];return _0x215bf7;};'use strict';var _=require(_0x1918('0x0'));var util=require(_0x1918('0x1'));var moment=require(_0x1918('0x2'));var BPromise=require(_0x1918('0x3'));var rs=require(_0x1918('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1918('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x1918('0x6'))(_0x1918('0x7'));var config=require(_0x1918('0x8'));var jayson=require(_0x1918('0x9'));var client=jayson[_0x1918('0xa')][_0x1918('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4cf696,_0xdafd69,_0x54a715){return new BPromise(function(_0x434acb,_0x53c498){return client[_0x1918('0xc')](_0x4cf696,_0x54a715)[_0x1918('0xd')](function(_0x24c807){logger[_0x1918('0xe')](_0x1918('0xf'),_0xdafd69,_0x1918('0x10'));logger[_0x1918('0x11')](_0x1918('0x12'),_0xdafd69,_0x1918('0x10'),JSON[_0x1918('0x13')](_0x24c807));if(_0x24c807[_0x1918('0x14')]){if(_0x24c807[_0x1918('0x14')][_0x1918('0x15')]===0x1f4){logger['error'](_0x1918('0xf'),_0xdafd69,_0x24c807[_0x1918('0x14')][_0x1918('0x16')]);return _0x53c498(_0x24c807[_0x1918('0x14')][_0x1918('0x16')]);}logger[_0x1918('0x14')](_0x1918('0xf'),_0xdafd69,_0x24c807['error'][_0x1918('0x16')]);return _0x434acb(_0x24c807[_0x1918('0x14')][_0x1918('0x16')]);}else{logger[_0x1918('0xe')]('Migration,\x20%s,\x20%s',_0xdafd69,'request\x20sent');_0x434acb(_0x24c807['result'][_0x1918('0x16')]);}})[_0x1918('0x17')](function(_0x303245){logger['error']('Migration,\x20%s,\x20%s',_0xdafd69,_0x303245);_0x53c498(_0x303245);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index feade04..dcb0818 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 _0xbd9e=['index','get','/:id','show','create','put','delete','exports','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./network.controller','isAuthenticated'];(function(_0x1f9f37,_0x18776e){var _0x21c080=function(_0x4acb93){while(--_0x4acb93){_0x1f9f37['push'](_0x1f9f37['shift']());}};_0x21c080(++_0x18776e);}(_0xbd9e,0x108));var _0xebd9=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xbd9e[_0x4bfac3];return _0x15f0f2;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xebd9('0x0'));var timeout=require('connect-timeout');var express=require(_0xebd9('0x1'));var router=express[_0xebd9('0x2')]();var fs_extra=require(_0xebd9('0x3'));var auth=require(_0xebd9('0x4'));var interaction=require(_0xebd9('0x5'));var config=require('../../config/environment');var controller=require(_0xebd9('0x6'));router['get']('/',auth[_0xebd9('0x7')](),controller[_0xebd9('0x8')]);router[_0xebd9('0x9')](_0xebd9('0xa'),auth[_0xebd9('0x7')](),controller[_0xebd9('0xb')]);router['post']('/',auth[_0xebd9('0x7')](),controller[_0xebd9('0xc')]);router[_0xebd9('0xd')](_0xebd9('0xa'),auth[_0xebd9('0x7')](),controller['update']);router[_0xebd9('0xe')]('/:id',auth[_0xebd9('0x7')](),controller['destroy']);module[_0xebd9('0xf')]=router; \ No newline at end of file +var _0xa3e8=['show','post','create','put','/:id','update','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get'];(function(_0x168928,_0x2d3e54){var _0x5c64a0=function(_0x581b50){while(--_0x581b50){_0x168928['push'](_0x168928['shift']());}};_0x5c64a0(++_0x2d3e54);}(_0xa3e8,0x127));var _0x8a3e=function(_0x2bde9d,_0x555c16){_0x2bde9d=_0x2bde9d-0x0;var _0x4d0657=_0xa3e8[_0x2bde9d];return _0x4d0657;};'use strict';var multer=require(_0x8a3e('0x0'));var util=require(_0x8a3e('0x1'));var path=require(_0x8a3e('0x2'));var timeout=require('connect-timeout');var express=require(_0x8a3e('0x3'));var router=express[_0x8a3e('0x4')]();var fs_extra=require(_0x8a3e('0x5'));var auth=require(_0x8a3e('0x6'));var interaction=require(_0x8a3e('0x7'));var config=require('../../config/environment');var controller=require('./network.controller');router['get']('/',auth[_0x8a3e('0x8')](),controller[_0x8a3e('0x9')]);router[_0x8a3e('0xa')]('/:id',auth[_0x8a3e('0x8')](),controller[_0x8a3e('0xb')]);router[_0x8a3e('0xc')]('/',auth[_0x8a3e('0x8')](),controller[_0x8a3e('0xd')]);router[_0x8a3e('0xe')](_0x8a3e('0xf'),auth[_0x8a3e('0x8')](),controller[_0x8a3e('0x10')]);router['delete'](_0x8a3e('0xf'),auth[_0x8a3e('0x8')](),controller[_0x8a3e('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index e3392ac..7b37ac1 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 _0x9047=['turn','STRING','sequelize','exports','ENUM','localnet','externip'];(function(_0x109c0a,_0x287604){var _0x2e2aa5=function(_0x10e4ed){while(--_0x10e4ed){_0x109c0a['push'](_0x109c0a['shift']());}};_0x2e2aa5(++_0x287604);}(_0x9047,0xdb));var _0x7904=function(_0x3e1465,_0x214d66){_0x3e1465=_0x3e1465-0x0;var _0x34e42d=_0x9047[_0x3e1465];return _0x34e42d;};'use strict';var Sequelize=require(_0x7904('0x0'));module[_0x7904('0x1')]={'type':{'type':Sequelize[_0x7904('0x2')](_0x7904('0x3'),_0x7904('0x4'),'stun',_0x7904('0x5'))},'value':{'type':Sequelize[_0x7904('0x6')]},'username':{'type':Sequelize[_0x7904('0x6')]},'password':{'type':Sequelize[_0x7904('0x6')]}}; \ No newline at end of file +var _0x17c1=['localnet','stun','STRING','exports','ENUM'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x17c1,0x161));var _0x117c=function(_0x23c4ec,_0x37bc0f){_0x23c4ec=_0x23c4ec-0x0;var _0x75de5c=_0x17c1[_0x23c4ec];return _0x75de5c;};'use strict';var Sequelize=require('sequelize');module[_0x117c('0x0')]={'type':{'type':Sequelize[_0x117c('0x1')](_0x117c('0x2'),'externip',_0x117c('0x3'),'turn')},'value':{'type':Sequelize[_0x117c('0x4')]},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x117c('0x4')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index accaf0c..9219398 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 _0xa171=['jayson/promise','http','then','info','Network,\x20%s,\x20%s','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','status','offset','undefined','limit','count','Content-Range','json','update','destroy','sendStatus','send','index','map','rawAttributes','fieldName','key','model','name','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','Network','include','findAll','rows','show','params','includeAll','find','create','body','type','toUpperCase','STUN','join','server/files/templates/stun_multiple.ejs','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','TURN','readFileSync','root','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','server/files/templates/turn_multiple.ejs','path','ejs','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb'];(function(_0x213c34,_0x5ada0d){var _0x3c7bec=function(_0x362b8e){while(--_0x362b8e){_0x213c34['push'](_0x213c34['shift']());}};_0x3c7bec(++_0x5ada0d);}(_0xa171,0xfd));var _0x1a17=function(_0x417ea3,_0x156e87){_0x417ea3=_0x417ea3-0x0;var _0x18c29d=_0xa171[_0x417ea3];return _0x18c29d;};'use strict';var util=require('util');var path=require(_0x1a17('0x0'));var ejs=require(_0x1a17('0x1'));var fs=require('fs');var _=require(_0x1a17('0x2'));var qs=require(_0x1a17('0x3'));var logger=require(_0x1a17('0x4'))(_0x1a17('0x5'));var config=require(_0x1a17('0x6'));var db=require(_0x1a17('0x7'))['db'];var jayson=require(_0x1a17('0x8'));var client=jayson['client'][_0x1a17('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3d63b2,_0x5d50e6,_0x2be9df,_0x3b4d85){return new Promise(function(_0x5760ad,_0x3f8b3e){var _0x130b85=_0x3b4d85||client;return _0x130b85['request'](_0x3d63b2,_0x2be9df)[_0x1a17('0xa')](function(_0x254c8c){logger[_0x1a17('0xb')](_0x1a17('0xc'),_0x5d50e6,'request\x20sent');logger['debug'](_0x1a17('0xd'),_0x5d50e6,'request\x20sent',JSON[_0x1a17('0xe')](_0x254c8c));if(_0x254c8c[_0x1a17('0xf')]){if(_0x254c8c[_0x1a17('0xf')][_0x1a17('0x10')]===0x1f4){logger['error'](_0x1a17('0xc'),_0x5d50e6,_0x254c8c[_0x1a17('0xf')]['message']);return _0x3f8b3e(_0x254c8c['error'][_0x1a17('0x11')]);}logger[_0x1a17('0xf')](_0x1a17('0xc'),_0x5d50e6,_0x254c8c['error'][_0x1a17('0x11')]);return _0x5760ad(_0x254c8c[_0x1a17('0xf')][_0x1a17('0x11')]);}else{logger['info'](_0x1a17('0xc'),_0x5d50e6,_0x1a17('0x12'));_0x5760ad(_0x254c8c[_0x1a17('0x13')][_0x1a17('0x11')]);}})[_0x1a17('0x14')](function(_0xb01899){logger[_0x1a17('0xf')](_0x1a17('0xc'),_0x5d50e6,_0xb01899);_0x3f8b3e(_0xb01899);});});}function respondWithResult(_0x15e368,_0x3786ad){_0x3786ad=_0x3786ad||0xc8;return function(_0x28a5a0){if(_0x28a5a0){return _0x15e368[_0x1a17('0x15')](_0x3786ad)['json'](_0x28a5a0);}};}function respondWithFilteredResult(_0xf0e9f8,_0x33aca4){return function(_0xbf1182){if(_0xbf1182){var _0x5c175c=typeof _0x33aca4[_0x1a17('0x16')]===_0x1a17('0x17')&&typeof _0x33aca4[_0x1a17('0x18')]===_0x1a17('0x17');var _0x2b0068=_0xbf1182[_0x1a17('0x19')];var _0x3eef26=_0x5c175c?0x0:_0x33aca4[_0x1a17('0x16')];var _0x369dc0=_0x5c175c?_0xbf1182[_0x1a17('0x19')]:_0x33aca4[_0x1a17('0x16')]+_0x33aca4[_0x1a17('0x18')];var _0x20d9b2;if(_0x369dc0>=_0x2b0068){_0x369dc0=_0x2b0068;_0x20d9b2=0xc8;}else{_0x20d9b2=0xce;}_0xf0e9f8[_0x1a17('0x15')](_0x20d9b2);return _0xf0e9f8['set'](_0x1a17('0x1a'),_0x3eef26+'-'+_0x369dc0+'/'+_0x2b0068)[_0x1a17('0x1b')](_0xbf1182);}return null;};}function saveUpdates(_0x4929e9){return function(_0x407adb){if(_0x407adb){return _0x407adb[_0x1a17('0x1c')](_0x4929e9)[_0x1a17('0xa')](function(_0x90269d){return _0x90269d;});}return null;};}function removeEntity(_0x21df70){return function(_0x359160){if(_0x359160){return _0x359160[_0x1a17('0x1d')]()[_0x1a17('0xa')](function(){_0x21df70['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5cddc7){return function(_0x1adced){if(!_0x1adced){_0x5cddc7[_0x1a17('0x1e')](0x194);}return _0x1adced;};}function handleError(_0x108264,_0x598954){_0x598954=_0x598954||0x1f4;return function(_0x4dc6c0){logger[_0x1a17('0xf')](_0x4dc6c0['stack']);if(_0x4dc6c0['name']){delete _0x4dc6c0['name'];}_0x108264['status'](_0x598954)[_0x1a17('0x1f')](_0x4dc6c0);};}exports[_0x1a17('0x20')]=function(_0x1be694,_0x47afeb){var _0x34642b={},_0x4d48f4={},_0xc89a2a={'count':0x0,'rows':[]};var _0x57486a=_[_0x1a17('0x21')](db['Network'][_0x1a17('0x22')],function(_0x5167e2){return{'name':_0x5167e2[_0x1a17('0x23')],'type':_0x5167e2['type'][_0x1a17('0x24')]};});_0x4d48f4[_0x1a17('0x25')]=_[_0x1a17('0x21')](_0x57486a,_0x1a17('0x26'));_0x4d48f4['query']=_[_0x1a17('0x27')](_0x1be694['query']);_0x4d48f4[_0x1a17('0x28')]=_[_0x1a17('0x29')](_0x4d48f4[_0x1a17('0x25')],_0x4d48f4[_0x1a17('0x2a')]);_0x34642b[_0x1a17('0x2b')]=_[_0x1a17('0x29')](_0x4d48f4[_0x1a17('0x25')],qs[_0x1a17('0x2c')](_0x1be694['query'][_0x1a17('0x2c')]));_0x34642b[_0x1a17('0x2b')]=_0x34642b[_0x1a17('0x2b')][_0x1a17('0x2d')]?_0x34642b['attributes']:_0x4d48f4['model'];if(!_0x1be694['query'][_0x1a17('0x2e')](_0x1a17('0x2f'))){_0x34642b[_0x1a17('0x18')]=qs['limit'](_0x1be694[_0x1a17('0x2a')]['limit']);_0x34642b[_0x1a17('0x16')]=qs[_0x1a17('0x16')](_0x1be694[_0x1a17('0x2a')][_0x1a17('0x16')]);}_0x34642b[_0x1a17('0x30')]=qs[_0x1a17('0x31')](_0x1be694[_0x1a17('0x2a')][_0x1a17('0x31')]);_0x34642b[_0x1a17('0x32')]=qs[_0x1a17('0x28')](_[_0x1a17('0x33')](_0x1be694[_0x1a17('0x2a')],_0x4d48f4[_0x1a17('0x28')]),_0x57486a);if(_0x1be694[_0x1a17('0x2a')][_0x1a17('0x34')]){_0x34642b[_0x1a17('0x32')]=_[_0x1a17('0x35')](_0x34642b['where'],{'$or':_[_0x1a17('0x21')](_0x57486a,function(_0x241f2a){if(_0x241f2a['type']!==_0x1a17('0x36')){var _0x1d517f={};_0x1d517f[_0x241f2a['name']]={'$like':'%'+_0x1be694['query'][_0x1a17('0x34')]+'%'};return _0x1d517f;}})});}_0x34642b=_[_0x1a17('0x35')]({},_0x34642b,_0x1be694[_0x1a17('0x37')]);var _0x465f22={'where':_0x34642b[_0x1a17('0x32')]};return db[_0x1a17('0x38')]['count'](_0x465f22)[_0x1a17('0xa')](function(_0x61f472){_0xc89a2a[_0x1a17('0x19')]=_0x61f472;if(_0x1be694[_0x1a17('0x2a')]['includeAll']){_0x34642b[_0x1a17('0x39')]=[{'all':!![]}];}return db[_0x1a17('0x38')][_0x1a17('0x3a')](_0x34642b);})[_0x1a17('0xa')](function(_0x415f26){_0xc89a2a[_0x1a17('0x3b')]=_0x415f26;return _0xc89a2a;})[_0x1a17('0xa')](respondWithFilteredResult(_0x47afeb,_0x34642b))[_0x1a17('0x14')](handleError(_0x47afeb,null));};exports[_0x1a17('0x3c')]=function(_0x1eee42,_0x20ad75){var _0x8a678e={'raw':!![],'where':{'id':_0x1eee42[_0x1a17('0x3d')]['id']}},_0x1af51a={};_0x1af51a[_0x1a17('0x25')]=_[_0x1a17('0x27')](db['Network'][_0x1a17('0x22')]);_0x1af51a[_0x1a17('0x2a')]=_[_0x1a17('0x27')](_0x1eee42['query']);_0x1af51a[_0x1a17('0x28')]=_['intersection'](_0x1af51a[_0x1a17('0x25')],_0x1af51a[_0x1a17('0x2a')]);_0x8a678e[_0x1a17('0x2b')]=_[_0x1a17('0x29')](_0x1af51a['model'],qs[_0x1a17('0x2c')](_0x1eee42['query'][_0x1a17('0x2c')]));_0x8a678e[_0x1a17('0x2b')]=_0x8a678e[_0x1a17('0x2b')][_0x1a17('0x2d')]?_0x8a678e['attributes']:_0x1af51a['model'];if(_0x1eee42[_0x1a17('0x2a')][_0x1a17('0x3e')]){_0x8a678e[_0x1a17('0x39')]=[{'all':!![]}];}_0x8a678e=_[_0x1a17('0x35')]({},_0x8a678e,_0x1eee42['options']);return db[_0x1a17('0x38')][_0x1a17('0x3f')](_0x8a678e)[_0x1a17('0xa')](handleEntityNotFound(_0x20ad75,null))[_0x1a17('0xa')](respondWithResult(_0x20ad75,null))['catch'](handleError(_0x20ad75,null));};exports[_0x1a17('0x40')]=function(_0xf1e364,_0x20e596){var _0x4ef9e7;return db[_0x1a17('0x38')][_0x1a17('0x40')](_0xf1e364[_0x1a17('0x41')],{'raw':!![]})['then'](function(_0x4bd6a0){_0x4ef9e7=_0x4bd6a0;return db['Network'][_0x1a17('0x3a')]({'where':{'type':_0xf1e364[_0x1a17('0x41')][_0x1a17('0x42')]},'raw':!![]});})['then'](function(_0x4c4857){if(_0x4ef9e7[_0x1a17('0x42')][_0x1a17('0x43')]()==_0x1a17('0x44')){var _0x1b7e0b=fs['readFileSync'](path[_0x1a17('0x45')](config['root'],_0x1a17('0x46')),_0x1a17('0x47'));var _0x8e1871=ejs[_0x1a17('0x48')](_0x1b7e0b,{'networks':_0x4c4857||[]});fs[_0x1a17('0x49')](_0x1a17('0x4a'),_0x8e1871);return respondWithRpcPromise(_0x1a17('0x4b'),_0x1a17('0x40'),{'module':_0x1a17('0x4c')});}else if(_0x4ef9e7['type'][_0x1a17('0x43')]()==_0x1a17('0x4d')){var _0x384dbb=fs[_0x1a17('0x4e')](path[_0x1a17('0x45')](config[_0x1a17('0x4f')],'server/files/templates/turn_multiple.ejs'),_0x1a17('0x47'));var _0x290a8d=ejs['render'](_0x384dbb,{'networks':_0x4c4857||[]});fs[_0x1a17('0x49')](_0x1a17('0x50'),_0x290a8d);return respondWithRpcPromise(_0x1a17('0x4b'),_0x1a17('0x40'),{'module':_0x1a17('0x4c')});}else{var _0x8fb6fc=fs[_0x1a17('0x4e')](path[_0x1a17('0x45')](config[_0x1a17('0x4f')],_0x1a17('0x51')),_0x1a17('0x47'));var _0x4a223f=ejs[_0x1a17('0x48')](_0x8fb6fc,{'networks':_0x4c4857||[]});fs['writeFileSync'](util[_0x1a17('0x52')](_0x1a17('0x53'),_0xf1e364[_0x1a17('0x41')][_0x1a17('0x42')][_0x1a17('0x54')]()),_0x4a223f);return respondWithRpcPromise(_0x1a17('0x4b'),_0x1a17('0x40'),{'module':_0x1a17('0x55')});}})[_0x1a17('0xa')](function(){return _0x4ef9e7;})[_0x1a17('0xa')](respondWithResult(_0x20e596,0xc9))['catch'](handleError(_0x20e596,null));};exports['update']=function(_0x446524,_0x32da89){var _0xa4eb25;return db[_0x1a17('0x38')][_0x1a17('0x3f')]({'where':{'id':_0x446524[_0x1a17('0x3d')]['id']}})['then'](handleEntityNotFound(_0x32da89,null))[_0x1a17('0xa')](saveUpdates(_0x446524['body'],null))['then'](function(_0x4dc3d6){if(_0x4dc3d6){_0xa4eb25=_0x4dc3d6;return db[_0x1a17('0x38')][_0x1a17('0x3a')]({'where':{'type':_0xa4eb25[_0x1a17('0x42')]},'raw':!![]});}return null;})[_0x1a17('0xa')](function(_0x24b914){if(_0xa4eb25[_0x1a17('0x42')][_0x1a17('0x43')]()==_0x1a17('0x44')){var _0x149f1c=fs[_0x1a17('0x4e')](path[_0x1a17('0x45')](config[_0x1a17('0x4f')],_0x1a17('0x46')),_0x1a17('0x47'));var _0x2c98cc=ejs['render'](_0x149f1c,{'networks':_0x24b914||[]});fs[_0x1a17('0x49')](_0x1a17('0x4a'),_0x2c98cc);return respondWithRpcPromise(_0x1a17('0x4b'),_0x1a17('0x1c'),{'module':_0x1a17('0x4c')});}else if(_0xa4eb25[_0x1a17('0x42')][_0x1a17('0x43')]()=='TURN'){var _0x393c4e=fs[_0x1a17('0x4e')](path[_0x1a17('0x45')](config[_0x1a17('0x4f')],_0x1a17('0x56')),_0x1a17('0x47'));var _0x1aa7a3=ejs[_0x1a17('0x48')](_0x393c4e,{'networks':_0x24b914||[]});fs[_0x1a17('0x49')](_0x1a17('0x50'),_0x1aa7a3);return respondWithRpcPromise(_0x1a17('0x4b'),_0x1a17('0x1c'),{'module':_0x1a17('0x4c')});}else{var _0x37db63=fs[_0x1a17('0x4e')](path[_0x1a17('0x45')](config[_0x1a17('0x4f')],_0x1a17('0x51')),_0x1a17('0x47'));var _0x5ba381=ejs[_0x1a17('0x48')](_0x37db63,{'networks':_0x24b914||[]});fs['writeFileSync'](util[_0x1a17('0x52')](_0x1a17('0x53'),_0x446524[_0x1a17('0x41')][_0x1a17('0x42')][_0x1a17('0x54')]()),_0x5ba381);return respondWithRpcPromise(_0x1a17('0x4b'),'update',{'module':_0x1a17('0x55')});}})[_0x1a17('0xa')](function(_0x414208){if(_0x414208){return _0xa4eb25;}return null;})[_0x1a17('0xa')](respondWithResult(_0x32da89,null))[_0x1a17('0x14')](handleError(_0x32da89,null));};exports[_0x1a17('0x1d')]=function(_0x55f5b5,_0x2b029d){var _0x43e9be;return db['Network'][_0x1a17('0x3f')]({'where':{'id':_0x55f5b5[_0x1a17('0x3d')]['id']}})['then'](function(_0x516d7b){_0x43e9be=_0x516d7b;return _0x516d7b;})[_0x1a17('0xa')](handleEntityNotFound(_0x2b029d,null))[_0x1a17('0xa')](removeEntity(_0x2b029d,null))['then'](function(){if(_0x43e9be){return db[_0x1a17('0x38')][_0x1a17('0x3a')]({'where':{'type':_0x43e9be[_0x1a17('0x42')]},'raw':!![]});}})[_0x1a17('0xa')](function(_0x272cae){if(_0x43e9be['type'][_0x1a17('0x43')]()=='STUN'){var _0x472cba=fs[_0x1a17('0x4e')](path[_0x1a17('0x45')](config[_0x1a17('0x4f')],_0x1a17('0x46')),'utf8');var _0x207b8e=ejs[_0x1a17('0x48')](_0x472cba,{'networks':_0x272cae||[]});fs[_0x1a17('0x49')](_0x1a17('0x4a'),_0x207b8e);return respondWithRpcPromise('Reload',_0x1a17('0x1d'),{'module':_0x1a17('0x4c')});}else if(_0x43e9be[_0x1a17('0x42')][_0x1a17('0x43')]()==_0x1a17('0x4d')){var _0x11e45d=fs[_0x1a17('0x4e')](path['join'](config['root'],'server/files/templates/turn_multiple.ejs'),_0x1a17('0x47'));var _0x33609d=ejs['render'](_0x11e45d,{'networks':_0x272cae||[]});fs['writeFileSync'](_0x1a17('0x50'),_0x33609d);return respondWithRpcPromise('Reload',_0x1a17('0x1d'),{'module':'res_stun_monitor.so'});}else{var _0x4dfbe8=fs[_0x1a17('0x4e')](path[_0x1a17('0x45')](config[_0x1a17('0x4f')],_0x1a17('0x51')),_0x1a17('0x47'));var _0x40520e=ejs[_0x1a17('0x48')](_0x4dfbe8,{'networks':_0x272cae||[]});fs['writeFileSync'](util[_0x1a17('0x52')](_0x1a17('0x53'),_0x43e9be[_0x1a17('0x42')]['toLowerCase']()),_0x40520e);return respondWithRpcPromise(_0x1a17('0x4b'),_0x1a17('0x1d'),{'module':_0x1a17('0x55')});}})['catch'](handleError(_0x2b029d,null));}; \ No newline at end of file +var _0x9baf=['/etc/asterisk/turn_xcally.conf','update','util','path','ejs','../../components/parsers/qs','../../config/logger','api','../../mysqldb','jayson/promise','client','http','request','then','request\x20sent','stringify','error','code','Network,\x20%s,\x20%s','message','info','result','catch','status','json','offset','undefined','limit','count','set','Content-Range','destroy','end','sendStatus','stack','name','send','rawAttributes','fieldName','type','key','model','map','keys','filters','intersection','attributes','fields','query','hasOwnProperty','nolimit','sort','where','pick','filter','merge','Network','includeAll','include','findAll','rows','show','params','length','options','create','body','toUpperCase','root','server/files/templates/stun_multiple.ejs','utf8','/etc/asterisk/stun_xcally.conf','TURN','readFileSync','join','writeFileSync','Reload','res_stun_monitor.so','server/files/templates/network.ejs','render','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','find','STUN','server/files/templates/turn_multiple.ejs'];(function(_0x23099a,_0x2b5805){var _0x37d69c=function(_0xd2830e){while(--_0xd2830e){_0x23099a['push'](_0x23099a['shift']());}};_0x37d69c(++_0x2b5805);}(_0x9baf,0xb0));var _0xf9ba=function(_0x4c1be0,_0x4e97c8){_0x4c1be0=_0x4c1be0-0x0;var _0x425752=_0x9baf[_0x4c1be0];return _0x425752;};'use strict';var util=require(_0xf9ba('0x0'));var path=require(_0xf9ba('0x1'));var ejs=require(_0xf9ba('0x2'));var fs=require('fs');var _=require('lodash');var qs=require(_0xf9ba('0x3'));var logger=require(_0xf9ba('0x4'))(_0xf9ba('0x5'));var config=require('../../config/environment');var db=require(_0xf9ba('0x6'))['db'];var jayson=require(_0xf9ba('0x7'));var client=jayson[_0xf9ba('0x8')][_0xf9ba('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x44b5db,_0x373b40,_0x59e76d,_0x5aa6d3){return new Promise(function(_0x420d16,_0x1af71c){var _0x93dda5=_0x5aa6d3||client;return _0x93dda5[_0xf9ba('0xa')](_0x44b5db,_0x59e76d)[_0xf9ba('0xb')](function(_0x3a8d1f){logger['info']('Network,\x20%s,\x20%s',_0x373b40,_0xf9ba('0xc'));logger['debug']('Network,\x20%s,\x20%s,\x20%s',_0x373b40,'request\x20sent',JSON[_0xf9ba('0xd')](_0x3a8d1f));if(_0x3a8d1f[_0xf9ba('0xe')]){if(_0x3a8d1f[_0xf9ba('0xe')][_0xf9ba('0xf')]===0x1f4){logger[_0xf9ba('0xe')](_0xf9ba('0x10'),_0x373b40,_0x3a8d1f[_0xf9ba('0xe')][_0xf9ba('0x11')]);return _0x1af71c(_0x3a8d1f['error'][_0xf9ba('0x11')]);}logger['error'](_0xf9ba('0x10'),_0x373b40,_0x3a8d1f[_0xf9ba('0xe')][_0xf9ba('0x11')]);return _0x420d16(_0x3a8d1f[_0xf9ba('0xe')][_0xf9ba('0x11')]);}else{logger[_0xf9ba('0x12')](_0xf9ba('0x10'),_0x373b40,_0xf9ba('0xc'));_0x420d16(_0x3a8d1f[_0xf9ba('0x13')][_0xf9ba('0x11')]);}})[_0xf9ba('0x14')](function(_0x50f0df){logger[_0xf9ba('0xe')](_0xf9ba('0x10'),_0x373b40,_0x50f0df);_0x1af71c(_0x50f0df);});});}function respondWithResult(_0x356b0f,_0x53001a){_0x53001a=_0x53001a||0xc8;return function(_0x114c13){if(_0x114c13){return _0x356b0f[_0xf9ba('0x15')](_0x53001a)[_0xf9ba('0x16')](_0x114c13);}};}function respondWithFilteredResult(_0x17d3c2,_0x1cdff0){return function(_0x100679){if(_0x100679){var _0x1f96b3=typeof _0x1cdff0[_0xf9ba('0x17')]===_0xf9ba('0x18')&&typeof _0x1cdff0[_0xf9ba('0x19')]===_0xf9ba('0x18');var _0x253e7c=_0x100679[_0xf9ba('0x1a')];var _0x41cf59=_0x1f96b3?0x0:_0x1cdff0[_0xf9ba('0x17')];var _0x892ee8=_0x1f96b3?_0x100679[_0xf9ba('0x1a')]:_0x1cdff0[_0xf9ba('0x17')]+_0x1cdff0[_0xf9ba('0x19')];var _0x2c47d7;if(_0x892ee8>=_0x253e7c){_0x892ee8=_0x253e7c;_0x2c47d7=0xc8;}else{_0x2c47d7=0xce;}_0x17d3c2['status'](_0x2c47d7);return _0x17d3c2[_0xf9ba('0x1b')](_0xf9ba('0x1c'),_0x41cf59+'-'+_0x892ee8+'/'+_0x253e7c)['json'](_0x100679);}return null;};}function saveUpdates(_0xc26d0f){return function(_0x1823d4){if(_0x1823d4){return _0x1823d4['update'](_0xc26d0f)['then'](function(_0x1c25cf){return _0x1c25cf;});}return null;};}function removeEntity(_0x1960e7){return function(_0x293734){if(_0x293734){return _0x293734[_0xf9ba('0x1d')]()['then'](function(){_0x1960e7[_0xf9ba('0x15')](0xcc)[_0xf9ba('0x1e')]();});}};}function handleEntityNotFound(_0x1c93eb){return function(_0xcbe5ca){if(!_0xcbe5ca){_0x1c93eb[_0xf9ba('0x1f')](0x194);}return _0xcbe5ca;};}function handleError(_0x287707,_0x420993){_0x420993=_0x420993||0x1f4;return function(_0xa7e19){logger[_0xf9ba('0xe')](_0xa7e19[_0xf9ba('0x20')]);if(_0xa7e19[_0xf9ba('0x21')]){delete _0xa7e19[_0xf9ba('0x21')];}_0x287707[_0xf9ba('0x15')](_0x420993)[_0xf9ba('0x22')](_0xa7e19);};}exports['index']=function(_0x2de962,_0x5e7096){var _0x5cff9b={},_0x1cc43a={},_0x4649fe={'count':0x0,'rows':[]};var _0x36c54a=_['map'](db['Network'][_0xf9ba('0x23')],function(_0x1bd62d){return{'name':_0x1bd62d[_0xf9ba('0x24')],'type':_0x1bd62d[_0xf9ba('0x25')][_0xf9ba('0x26')]};});_0x1cc43a[_0xf9ba('0x27')]=_[_0xf9ba('0x28')](_0x36c54a,'name');_0x1cc43a['query']=_[_0xf9ba('0x29')](_0x2de962['query']);_0x1cc43a[_0xf9ba('0x2a')]=_[_0xf9ba('0x2b')](_0x1cc43a[_0xf9ba('0x27')],_0x1cc43a['query']);_0x5cff9b[_0xf9ba('0x2c')]=_[_0xf9ba('0x2b')](_0x1cc43a[_0xf9ba('0x27')],qs[_0xf9ba('0x2d')](_0x2de962['query'][_0xf9ba('0x2d')]));_0x5cff9b[_0xf9ba('0x2c')]=_0x5cff9b[_0xf9ba('0x2c')]['length']?_0x5cff9b[_0xf9ba('0x2c')]:_0x1cc43a[_0xf9ba('0x27')];if(!_0x2de962[_0xf9ba('0x2e')][_0xf9ba('0x2f')](_0xf9ba('0x30'))){_0x5cff9b[_0xf9ba('0x19')]=qs[_0xf9ba('0x19')](_0x2de962[_0xf9ba('0x2e')][_0xf9ba('0x19')]);_0x5cff9b[_0xf9ba('0x17')]=qs[_0xf9ba('0x17')](_0x2de962[_0xf9ba('0x2e')][_0xf9ba('0x17')]);}_0x5cff9b['order']=qs[_0xf9ba('0x31')](_0x2de962[_0xf9ba('0x2e')]['sort']);_0x5cff9b[_0xf9ba('0x32')]=qs[_0xf9ba('0x2a')](_[_0xf9ba('0x33')](_0x2de962[_0xf9ba('0x2e')],_0x1cc43a['filters']),_0x36c54a);if(_0x2de962[_0xf9ba('0x2e')][_0xf9ba('0x34')]){_0x5cff9b[_0xf9ba('0x32')]=_[_0xf9ba('0x35')](_0x5cff9b[_0xf9ba('0x32')],{'$or':_['map'](_0x36c54a,function(_0x4456a0){if(_0x4456a0['type']!=='VIRTUAL'){var _0x27a4c7={};_0x27a4c7[_0x4456a0[_0xf9ba('0x21')]]={'$like':'%'+_0x2de962[_0xf9ba('0x2e')][_0xf9ba('0x34')]+'%'};return _0x27a4c7;}})});}_0x5cff9b=_[_0xf9ba('0x35')]({},_0x5cff9b,_0x2de962['options']);var _0x263c5e={'where':_0x5cff9b['where']};return db[_0xf9ba('0x36')]['count'](_0x263c5e)[_0xf9ba('0xb')](function(_0xdac458){_0x4649fe[_0xf9ba('0x1a')]=_0xdac458;if(_0x2de962['query'][_0xf9ba('0x37')]){_0x5cff9b[_0xf9ba('0x38')]=[{'all':!![]}];}return db[_0xf9ba('0x36')][_0xf9ba('0x39')](_0x5cff9b);})[_0xf9ba('0xb')](function(_0x215fc3){_0x4649fe[_0xf9ba('0x3a')]=_0x215fc3;return _0x4649fe;})[_0xf9ba('0xb')](respondWithFilteredResult(_0x5e7096,_0x5cff9b))['catch'](handleError(_0x5e7096,null));};exports[_0xf9ba('0x3b')]=function(_0x164fe3,_0x507750){var _0x3d0acd={'raw':!![],'where':{'id':_0x164fe3[_0xf9ba('0x3c')]['id']}},_0xe08691={};_0xe08691[_0xf9ba('0x27')]=_['keys'](db[_0xf9ba('0x36')][_0xf9ba('0x23')]);_0xe08691[_0xf9ba('0x2e')]=_[_0xf9ba('0x29')](_0x164fe3[_0xf9ba('0x2e')]);_0xe08691[_0xf9ba('0x2a')]=_['intersection'](_0xe08691['model'],_0xe08691[_0xf9ba('0x2e')]);_0x3d0acd[_0xf9ba('0x2c')]=_[_0xf9ba('0x2b')](_0xe08691[_0xf9ba('0x27')],qs[_0xf9ba('0x2d')](_0x164fe3[_0xf9ba('0x2e')][_0xf9ba('0x2d')]));_0x3d0acd[_0xf9ba('0x2c')]=_0x3d0acd[_0xf9ba('0x2c')][_0xf9ba('0x3d')]?_0x3d0acd[_0xf9ba('0x2c')]:_0xe08691[_0xf9ba('0x27')];if(_0x164fe3[_0xf9ba('0x2e')][_0xf9ba('0x37')]){_0x3d0acd[_0xf9ba('0x38')]=[{'all':!![]}];}_0x3d0acd=_['merge']({},_0x3d0acd,_0x164fe3[_0xf9ba('0x3e')]);return db[_0xf9ba('0x36')]['find'](_0x3d0acd)['then'](handleEntityNotFound(_0x507750,null))[_0xf9ba('0xb')](respondWithResult(_0x507750,null))[_0xf9ba('0x14')](handleError(_0x507750,null));};exports[_0xf9ba('0x3f')]=function(_0x9f9e1b,_0x318b13){var _0x487364;return db[_0xf9ba('0x36')][_0xf9ba('0x3f')](_0x9f9e1b['body'],{'raw':!![]})[_0xf9ba('0xb')](function(_0x4d85e4){_0x487364=_0x4d85e4;return db[_0xf9ba('0x36')][_0xf9ba('0x39')]({'where':{'type':_0x9f9e1b[_0xf9ba('0x40')][_0xf9ba('0x25')]},'raw':!![]});})[_0xf9ba('0xb')](function(_0x148b0d){if(_0x487364[_0xf9ba('0x25')][_0xf9ba('0x41')]()=='STUN'){var _0x53b2cc=fs['readFileSync'](path['join'](config[_0xf9ba('0x42')],_0xf9ba('0x43')),_0xf9ba('0x44'));var _0x5aa8d6=ejs['render'](_0x53b2cc,{'networks':_0x148b0d||[]});fs['writeFileSync'](_0xf9ba('0x45'),_0x5aa8d6);return respondWithRpcPromise('Reload',_0xf9ba('0x3f'),{'module':'res_stun_monitor.so'});}else if(_0x487364[_0xf9ba('0x25')][_0xf9ba('0x41')]()==_0xf9ba('0x46')){var _0x1cb727=fs[_0xf9ba('0x47')](path[_0xf9ba('0x48')](config[_0xf9ba('0x42')],'server/files/templates/turn_multiple.ejs'),_0xf9ba('0x44'));var _0x265de0=ejs['render'](_0x1cb727,{'networks':_0x148b0d||[]});fs[_0xf9ba('0x49')]('/etc/asterisk/turn_xcally.conf',_0x265de0);return respondWithRpcPromise(_0xf9ba('0x4a'),_0xf9ba('0x3f'),{'module':_0xf9ba('0x4b')});}else{var _0x3b65c2=fs['readFileSync'](path[_0xf9ba('0x48')](config[_0xf9ba('0x42')],_0xf9ba('0x4c')),_0xf9ba('0x44'));var _0x335ba0=ejs[_0xf9ba('0x4d')](_0x3b65c2,{'networks':_0x148b0d||[]});fs[_0xf9ba('0x49')](util[_0xf9ba('0x4e')](_0xf9ba('0x4f'),_0x9f9e1b[_0xf9ba('0x40')]['type'][_0xf9ba('0x50')]()),_0x335ba0);return respondWithRpcPromise('Reload','create',{'module':_0xf9ba('0x51')});}})[_0xf9ba('0xb')](function(){return _0x487364;})[_0xf9ba('0xb')](respondWithResult(_0x318b13,0xc9))[_0xf9ba('0x14')](handleError(_0x318b13,null));};exports['update']=function(_0x3a2788,_0x34caab){var _0x57dfd1;return db['Network'][_0xf9ba('0x52')]({'where':{'id':_0x3a2788['params']['id']}})[_0xf9ba('0xb')](handleEntityNotFound(_0x34caab,null))['then'](saveUpdates(_0x3a2788[_0xf9ba('0x40')],null))[_0xf9ba('0xb')](function(_0x397ccc){if(_0x397ccc){_0x57dfd1=_0x397ccc;return db[_0xf9ba('0x36')][_0xf9ba('0x39')]({'where':{'type':_0x57dfd1['type']},'raw':!![]});}return null;})['then'](function(_0x283612){if(_0x57dfd1[_0xf9ba('0x25')][_0xf9ba('0x41')]()==_0xf9ba('0x53')){var _0x251ded=fs[_0xf9ba('0x47')](path[_0xf9ba('0x48')](config['root'],_0xf9ba('0x43')),_0xf9ba('0x44'));var _0x4e4274=ejs['render'](_0x251ded,{'networks':_0x283612||[]});fs['writeFileSync']('/etc/asterisk/stun_xcally.conf',_0x4e4274);return respondWithRpcPromise(_0xf9ba('0x4a'),'update',{'module':'res_stun_monitor.so'});}else if(_0x57dfd1[_0xf9ba('0x25')][_0xf9ba('0x41')]()==_0xf9ba('0x46')){var _0x55d86b=fs['readFileSync'](path[_0xf9ba('0x48')](config[_0xf9ba('0x42')],_0xf9ba('0x54')),_0xf9ba('0x44'));var _0x1d2435=ejs['render'](_0x55d86b,{'networks':_0x283612||[]});fs['writeFileSync'](_0xf9ba('0x55'),_0x1d2435);return respondWithRpcPromise(_0xf9ba('0x4a'),_0xf9ba('0x56'),{'module':_0xf9ba('0x4b')});}else{var _0x53f4b5=fs['readFileSync'](path['join'](config[_0xf9ba('0x42')],_0xf9ba('0x4c')),'utf8');var _0x478a54=ejs['render'](_0x53f4b5,{'networks':_0x283612||[]});fs[_0xf9ba('0x49')](util[_0xf9ba('0x4e')](_0xf9ba('0x4f'),_0x3a2788['body'][_0xf9ba('0x25')][_0xf9ba('0x50')]()),_0x478a54);return respondWithRpcPromise(_0xf9ba('0x4a'),_0xf9ba('0x56'),{'module':_0xf9ba('0x51')});}})[_0xf9ba('0xb')](function(_0x2a2c2f){if(_0x2a2c2f){return _0x57dfd1;}return null;})[_0xf9ba('0xb')](respondWithResult(_0x34caab,null))[_0xf9ba('0x14')](handleError(_0x34caab,null));};exports['destroy']=function(_0x5b2e63,_0x52e547){var _0x3ab69c;return db[_0xf9ba('0x36')]['find']({'where':{'id':_0x5b2e63['params']['id']}})[_0xf9ba('0xb')](function(_0x1f2092){_0x3ab69c=_0x1f2092;return _0x1f2092;})[_0xf9ba('0xb')](handleEntityNotFound(_0x52e547,null))['then'](removeEntity(_0x52e547,null))['then'](function(){if(_0x3ab69c){return db[_0xf9ba('0x36')]['findAll']({'where':{'type':_0x3ab69c['type']},'raw':!![]});}})[_0xf9ba('0xb')](function(_0x39ec7d){if(_0x3ab69c[_0xf9ba('0x25')][_0xf9ba('0x41')]()=='STUN'){var _0x5b575d=fs[_0xf9ba('0x47')](path['join'](config[_0xf9ba('0x42')],_0xf9ba('0x43')),_0xf9ba('0x44'));var _0x272671=ejs['render'](_0x5b575d,{'networks':_0x39ec7d||[]});fs['writeFileSync'](_0xf9ba('0x45'),_0x272671);return respondWithRpcPromise('Reload',_0xf9ba('0x1d'),{'module':_0xf9ba('0x4b')});}else if(_0x3ab69c[_0xf9ba('0x25')][_0xf9ba('0x41')]()==_0xf9ba('0x46')){var _0x27f196=fs[_0xf9ba('0x47')](path['join'](config[_0xf9ba('0x42')],_0xf9ba('0x54')),_0xf9ba('0x44'));var _0xba6c45=ejs['render'](_0x27f196,{'networks':_0x39ec7d||[]});fs['writeFileSync']('/etc/asterisk/turn_xcally.conf',_0xba6c45);return respondWithRpcPromise('Reload',_0xf9ba('0x1d'),{'module':_0xf9ba('0x4b')});}else{var _0x42bb19=fs[_0xf9ba('0x47')](path[_0xf9ba('0x48')](config[_0xf9ba('0x42')],_0xf9ba('0x4c')),_0xf9ba('0x44'));var _0x38f18f=ejs[_0xf9ba('0x4d')](_0x42bb19,{'networks':_0x39ec7d||[]});fs[_0xf9ba('0x49')](util[_0xf9ba('0x4e')]('/etc/asterisk/sip_xcally_%s.conf',_0x3ab69c['type'][_0xf9ba('0x50')]()),_0x38f18f);return respondWithRpcPromise('Reload',_0xf9ba('0x1d'),{'module':_0xf9ba('0x51')});}})['catch'](handleError(_0x52e547,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index f6f3129..14084d7 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 _0xd547=['define','../../config/logger','api','moment','bluebird','rimraf','./network.attributes'];(function(_0x4c7fb5,_0x2548ef){var _0x2e10ac=function(_0xf7e27c){while(--_0xf7e27c){_0x4c7fb5['push'](_0x4c7fb5['shift']());}};_0x2e10ac(++_0x2548ef);}(_0xd547,0x1c1));var _0x7d54=function(_0x3c4322,_0x145a37){_0x3c4322=_0x3c4322-0x0;var _0x225310=_0xd547[_0x3c4322];return _0x225310;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x7d54('0x0'))(_0x7d54('0x1'));var moment=require(_0x7d54('0x2'));var BPromise=require(_0x7d54('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x7d54('0x4'));var config=require('../../config/environment');var attributes=require(_0x7d54('0x5'));module['exports']=function(_0x296dd6,_0x37defc){return _0x296dd6[_0x7d54('0x6')]('Network',attributes,{'tableName':'network','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x41bb=['bluebird','request-promise','path','rimraf','./network.attributes','exports','network','lodash','util','api'];(function(_0x348bfe,_0x438f43){var _0x2e3234=function(_0x1ced28){while(--_0x1ced28){_0x348bfe['push'](_0x348bfe['shift']());}};_0x2e3234(++_0x438f43);}(_0x41bb,0xc5));var _0xb41b=function(_0xdacef5,_0x23f164){_0xdacef5=_0xdacef5-0x0;var _0xb8a02a=_0x41bb[_0xdacef5];return _0xb8a02a;};'use strict';var _=require(_0xb41b('0x0'));var util=require(_0xb41b('0x1'));var logger=require('../../config/logger')(_0xb41b('0x2'));var moment=require('moment');var BPromise=require(_0xb41b('0x3'));var rp=require(_0xb41b('0x4'));var fs=require('fs');var path=require(_0xb41b('0x5'));var rimraf=require(_0xb41b('0x6'));var config=require('../../config/environment');var attributes=require(_0xb41b('0x7'));module[_0xb41b('0x8')]=function(_0x2dbaa3,_0x50bc62){return _0x2dbaa3['define']('Network',attributes,{'tableName':_0xb41b('0x9'),'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 eb219a0..8a16acb 100644 --- a/server/api/network/network.rpc.js +++ b/server/api/network/network.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['info','Network,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x7a54,0x106));var _0x47a5=function(_0x508984,_0x35201b){_0x508984=_0x508984-0x0;var _0x2d0a3f=_0x7a54[_0x508984];return _0x2d0a3f;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Network,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file +var _0x9957=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x283410,_0x923902){var _0x28e117=function(_0xc4c58){while(--_0xc4c58){_0x283410['push'](_0x283410['shift']());}};_0x28e117(++_0x923902);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('Network,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index cf09d85..d146221 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 _0xb10b=['show','/:id/dispositions','/:id/canned_answers','getApplications','/:id/interactions','getInteractions','/:id/users','getAgents','post','create','addDisposition','addAnswer','/:id/notify','notify','/:id/applications','addApplications','addAgents','/:id/send','put','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','get','index','isAuthenticated','describe','/:id'];(function(_0x2f9b52,_0x124e9c){var _0x42706a=function(_0x50711a){while(--_0x50711a){_0x2f9b52['push'](_0x2f9b52['shift']());}};_0x42706a(++_0x124e9c);}(_0xb10b,0x12a));var _0xbb10=function(_0x41c381,_0x1176bd){_0x41c381=_0x41c381-0x0;var _0x427981=_0xb10b[_0x41c381];return _0x427981;};'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('0x9')](_0xbb10('0xf'),auth['isAuthenticated'](),controller['getDispositions']);router[_0xbb10('0x9')](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller['getAnswers']);router[_0xbb10('0x9')]('/:id/applications',auth[_0xbb10('0xb')](),controller[_0xbb10('0x11')]);router[_0xbb10('0x9')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x13')]);router['get'](_0xbb10('0x14'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x15')]);router[_0xbb10('0x16')]('/',auth[_0xbb10('0xb')](),controller[_0xbb10('0x17')]);router[_0xbb10('0x16')](_0xbb10('0xf'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x18')]);router['post'](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x19')]);router[_0xbb10('0x16')](_0xbb10('0x1a'),controller[_0xbb10('0x1b')]);router[_0xbb10('0x16')](_0xbb10('0x1c'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1d')]);router['post'](_0xbb10('0x14'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1e')]);router[_0xbb10('0x16')](_0xbb10('0x1f'),auth[_0xbb10('0xb')](),controller['send']);router[_0xbb10('0x20')](_0xbb10('0xd'),auth['isAuthenticated'](),controller['update']);router[_0xbb10('0x21')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x22')]);router[_0xbb10('0x21')](_0xbb10('0xf'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x23')]);router[_0xbb10('0x21')](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x24')]);router['delete']('/:id/users',auth['isAuthenticated'](),controller[_0xbb10('0x25')]);module[_0xbb10('0x26')]=router; \ No newline at end of file +var _0x065e=['isAuthenticated','index','get','/:id','show','getDispositions','/:id/canned_answers','getAnswers','getApplications','getInteractions','/:id/users','post','create','/:id/dispositions','addDisposition','/:id/notify','notify','/:id/applications','addApplications','addAgents','put','update','delete','destroy','removeDispositions','removeAgents','exports','multer','express','Router','fs-extra','../../config/environment','./openchannelAccount.controller'];(function(_0x17e274,_0xe30486){var _0x42bafd=function(_0x307911){while(--_0x307911){_0x17e274['push'](_0x17e274['shift']());}};_0x42bafd(++_0xe30486);}(_0x065e,0x1a7));var _0xe065=function(_0x28d60f,_0x33ee75){_0x28d60f=_0x28d60f-0x0;var _0x360841=_0x065e[_0x28d60f];return _0x360841;};'use strict';var multer=require(_0xe065('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xe065('0x1'));var router=express[_0xe065('0x2')]();var fs_extra=require(_0xe065('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xe065('0x4'));var controller=require(_0xe065('0x5'));router['get']('/',auth[_0xe065('0x6')](),controller[_0xe065('0x7')]);router[_0xe065('0x8')]('/describe',auth[_0xe065('0x6')](),controller['describe']);router[_0xe065('0x8')](_0xe065('0x9'),auth[_0xe065('0x6')](),controller[_0xe065('0xa')]);router[_0xe065('0x8')]('/:id/dispositions',auth[_0xe065('0x6')](),controller[_0xe065('0xb')]);router[_0xe065('0x8')](_0xe065('0xc'),auth[_0xe065('0x6')](),controller[_0xe065('0xd')]);router['get']('/:id/applications',auth[_0xe065('0x6')](),controller[_0xe065('0xe')]);router[_0xe065('0x8')]('/:id/interactions',auth[_0xe065('0x6')](),controller[_0xe065('0xf')]);router[_0xe065('0x8')](_0xe065('0x10'),auth[_0xe065('0x6')](),controller['getAgents']);router[_0xe065('0x11')]('/',auth[_0xe065('0x6')](),controller[_0xe065('0x12')]);router[_0xe065('0x11')](_0xe065('0x13'),auth[_0xe065('0x6')](),controller[_0xe065('0x14')]);router['post'](_0xe065('0xc'),auth[_0xe065('0x6')](),controller['addAnswer']);router[_0xe065('0x11')](_0xe065('0x15'),controller[_0xe065('0x16')]);router[_0xe065('0x11')](_0xe065('0x17'),auth[_0xe065('0x6')](),controller[_0xe065('0x18')]);router['post'](_0xe065('0x10'),auth['isAuthenticated'](),controller[_0xe065('0x19')]);router[_0xe065('0x11')]('/:id/send',auth[_0xe065('0x6')](),controller['send']);router[_0xe065('0x1a')](_0xe065('0x9'),auth[_0xe065('0x6')](),controller[_0xe065('0x1b')]);router[_0xe065('0x1c')](_0xe065('0x9'),auth[_0xe065('0x6')](),controller[_0xe065('0x1d')]);router[_0xe065('0x1c')]('/:id/dispositions',auth[_0xe065('0x6')](),controller[_0xe065('0x1e')]);router[_0xe065('0x1c')](_0xe065('0xc'),auth['isAuthenticated'](),controller['removeAnswers']);router[_0xe065('0x1c')]('/:id/users',auth[_0xe065('0x6')](),controller[_0xe065('0x1f')]);module[_0xe065('0x20')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index cff486a..bde991c 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 _0xa5a1=['name','TEXT','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDispositionPauseId','exports','STRING'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0xa5a1,0x154));var _0x1a5a=function(_0x1ca8dd,_0x2b2f46){_0x1ca8dd=_0x1ca8dd-0x0;var _0x26e5bf=_0xa5a1[_0x1ca8dd];return _0x26e5bf;};'use strict';var Sequelize=require('sequelize');var rs=require('randomstring');module[_0x1a5a('0x0')]={'name':{'type':Sequelize[_0x1a5a('0x1')],'unique':_0x1a5a('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x1a5a('0x1')]},'token':{'type':Sequelize[_0x1a5a('0x1')],'defaultValue':function(){return rs['generate']();}},'replyUri':{'type':Sequelize['STRING'],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x1a5a('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x1a5a('0x3')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x1a5a('0x4')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x1a5a('0x4')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x1a5a('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x1a5a('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize['STRING']},'queueTransfer':{'type':Sequelize[_0x1a5a('0x4')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x1a5a('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x1a5a('0x4')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x1a5a('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x1a5a('0x6')},'mandatoryDisposition':{'type':Sequelize[_0x1a5a('0x4')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x78f673){if(!_0x78f673)this[_0x1a5a('0x7')](_0x1a5a('0x8'),null);this[_0x1a5a('0x7')]('mandatoryDisposition',_0x78f673);}}}; \ No newline at end of file +var _0x831b=['sequelize','randomstring','exports','STRING','name','generate','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','setDataValue','mandatoryDisposition'];(function(_0x287737,_0x2953a1){var _0x17c343=function(_0x35cc2f){while(--_0x35cc2f){_0x287737['push'](_0x287737['shift']());}};_0x17c343(++_0x2953a1);}(_0x831b,0x1b0));var _0xb831=function(_0x2ce61a,_0x9140f7){_0x2ce61a=_0x2ce61a-0x0;var _0x4b16ef=_0x831b[_0x2ce61a];return _0x4b16ef;};'use strict';var Sequelize=require(_0xb831('0x0'));var rs=require(_0xb831('0x1'));module[_0xb831('0x2')]={'name':{'type':Sequelize[_0xb831('0x3')],'unique':_0xb831('0x4'),'allowNull':![]},'description':{'type':Sequelize[_0xb831('0x3')]},'token':{'type':Sequelize[_0xb831('0x3')],'defaultValue':function(){return rs[_0xb831('0x5')]();}},'replyUri':{'type':Sequelize['STRING'],'validate':{'isUrl':!![]}},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xb831('0x6');}},'notificationSound':{'type':Sequelize[_0xb831('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xb831('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xb831('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xb831('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize['STRING']},'queueTransfer':{'type':Sequelize[_0xb831('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xb831('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xb831('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xb831('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0xb831('0x9')},'mandatoryDisposition':{'type':Sequelize[_0xb831('0x7')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x57c0eb){if(!_0x57c0eb)this[_0xb831('0xa')]('mandatoryDispositionPauseId',null);this[_0xb831('0xa')](_0xb831('0xb'),_0x57c0eb);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index 784bfa8..c328855 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 _0x7e4b=['UserProfileResource','stack','name','index','mandatoryDispositionPause','map','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','OpenchannelAccount','include','findAll','rows','show','params','Pause','keys','includeAll','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','OpenchannelAccounts','UserProfileSection','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','OpenchannelAccountId','Disposition','getDispositions','findOne','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','ids','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','updatedAt','createdAt','CompanyId','ListId','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','CmList','List','Contacts','DESC','Applications','account','applications','orderBy','contact','firstName','threadId','OpenchannelInteraction','externalUrl','lastName','messageId','interaction','created','autoclose','push','close','*,*,*,*','OpenchannelMessage','AttachmentId','User','unshift','agent','waitForTheAssignedAgent','queueId','OpenchannelQueue','waitForTheAssignedQueue','Start','startRouting','EventManager','notify','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','OpenchannelApplication','findAndCountAll','getApplications','Contact','Owner','fullname','internal','Tag','Tags','color','tag','addAgents','omit','spread','emit','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','out','Messages','dataValues','eml-format','rimraf','fast-json-patch','request-promise','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','api','../../config/utils','../../config/environment','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','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','save','update','destroy','get'];(function(_0x7a531a,_0x41dd70){var _0x4d8d90=function(_0x3d2648){while(--_0x3d2648){_0x7a531a['push'](_0x7a531a['shift']());}};_0x4d8d90(++_0x41dd70);}(_0x7e4b,0x84));var _0xb7e4=function(_0x4f15f,_0x4f80cd){_0x4f15f=_0x4f15f-0x0;var _0x31a7ff=_0x7e4b[_0x4f15f];return _0x31a7ff;};'use strict';var emlformat=require(_0xb7e4('0x0'));var rimraf=require(_0xb7e4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb7e4('0x2'));var rp=require(_0xb7e4('0x3'));var moment=require('moment');var BPromise=require(_0xb7e4('0x4'));var Mustache=require(_0xb7e4('0x5'));var util=require(_0xb7e4('0x6'));var path=require(_0xb7e4('0x7'));var sox=require(_0xb7e4('0x8'));var csv=require(_0xb7e4('0x9'));var ejs=require(_0xb7e4('0xa'));var fs=require('fs');var fs_extra=require(_0xb7e4('0xb'));var _=require(_0xb7e4('0xc'));var squel=require('squel');var crypto=require(_0xb7e4('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xb7e4('0xe'));var toCsv=require(_0xb7e4('0x9'));var querystring=require(_0xb7e4('0xf'));var Papa=require(_0xb7e4('0x10'));var Redis=require(_0xb7e4('0x11'));var authService=require(_0xb7e4('0x12'));var qs=require(_0xb7e4('0x13'));var as=require(_0xb7e4('0x14'));var hardwareService=require(_0xb7e4('0x15'));var logger=require(_0xb7e4('0x16'))(_0xb7e4('0x17'));var utils=require(_0xb7e4('0x18'));var config=require(_0xb7e4('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xb7e4('0x1a')]=_[_0xb7e4('0x1b')](config['redis'],{'host':_0xb7e4('0x1c'),'port':0x18eb});var socket=require(_0xb7e4('0x1d'))(new Redis(config[_0xb7e4('0x1a')]));require(_0xb7e4('0x1e'))[_0xb7e4('0x1f')](socket);var jayson=require(_0xb7e4('0x20'));var client=jayson[_0xb7e4('0x21')][_0xb7e4('0x22')]({'port':0x232c});var client9002=jayson[_0xb7e4('0x21')][_0xb7e4('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x15653d,_0x983d60,_0x70481a,_0x3a08f1){return new BPromise(function(_0x4d4220,_0x1a6999){var _0x170e17=_0x3a08f1||client;return _0x170e17[_0xb7e4('0x23')](_0x15653d,_0x70481a)[_0xb7e4('0x24')](function(_0x44a6c9){logger[_0xb7e4('0x25')](_0xb7e4('0x26'),_0x983d60,_0xb7e4('0x27'));logger[_0xb7e4('0x28')](_0xb7e4('0x29'),_0x983d60,'request\x20sent',JSON[_0xb7e4('0x2a')](_0x44a6c9));if(_0x44a6c9[_0xb7e4('0x2b')]){if(_0x44a6c9[_0xb7e4('0x2b')][_0xb7e4('0x2c')]===0x1f4){logger[_0xb7e4('0x2b')]('OpenchannelAccount,\x20%s,\x20%s',_0x983d60,_0x44a6c9[_0xb7e4('0x2b')][_0xb7e4('0x2d')]);return _0x1a6999(_0x44a6c9[_0xb7e4('0x2b')][_0xb7e4('0x2d')]);}logger[_0xb7e4('0x2b')](_0xb7e4('0x26'),_0x983d60,_0x44a6c9['error'][_0xb7e4('0x2d')]);return _0x4d4220(_0x44a6c9[_0xb7e4('0x2b')][_0xb7e4('0x2d')]);}else{logger[_0xb7e4('0x25')]('OpenchannelAccount,\x20%s,\x20%s',_0x983d60,_0xb7e4('0x27'));_0x4d4220(_0x44a6c9[_0xb7e4('0x2e')]['message']);}})[_0xb7e4('0x2f')](function(_0xedb514){logger[_0xb7e4('0x2b')]('OpenchannelAccount,\x20%s,\x20%s',_0x983d60,_0xedb514);_0x1a6999(_0xedb514);});});}function respondWithStatusCode(_0x3d5198,_0x457d9e){_0x457d9e=_0x457d9e||0xcc;return function(_0x4cff42){if(_0x4cff42){return _0x3d5198[_0xb7e4('0x30')](_0x457d9e);}return _0x3d5198[_0xb7e4('0x31')](_0x457d9e)['end']();};}function respondWithResult(_0x1a9d1c,_0xd0b54c){_0xd0b54c=_0xd0b54c||0xc8;return function(_0x33a80e){if(_0x33a80e){return _0x1a9d1c['status'](_0xd0b54c)[_0xb7e4('0x32')](_0x33a80e);}};}function respondWithFilteredResult(_0x1e2b8f,_0x248cc0){return function(_0x4e6a2b){if(_0x4e6a2b){var _0x41011d=typeof _0x248cc0[_0xb7e4('0x33')]===_0xb7e4('0x34')&&typeof _0x248cc0[_0xb7e4('0x35')]===_0xb7e4('0x34');var _0x1f7436=_0x4e6a2b[_0xb7e4('0x36')];var _0x601559=_0x41011d?0x0:_0x248cc0[_0xb7e4('0x33')];var _0x52ec18=_0x41011d?_0x4e6a2b[_0xb7e4('0x36')]:_0x248cc0[_0xb7e4('0x33')]+_0x248cc0[_0xb7e4('0x35')];var _0x222529;if(_0x52ec18>=_0x1f7436){_0x52ec18=_0x1f7436;_0x222529=0xc8;}else{_0x222529=0xce;}_0x1e2b8f['status'](_0x222529);return _0x1e2b8f[_0xb7e4('0x37')](_0xb7e4('0x38'),_0x601559+'-'+_0x52ec18+'/'+_0x1f7436)[_0xb7e4('0x32')](_0x4e6a2b);}return null;};}function patchUpdates(_0x2287fc){return function(_0x7404b3){try{jsonpatch['apply'](_0x7404b3,_0x2287fc,!![]);}catch(_0x1fe213){return BPromise['reject'](_0x1fe213);}return _0x7404b3[_0xb7e4('0x39')]();};}function saveUpdates(_0xffa6b4,_0x3c003e){return function(_0x2245a1){if(_0x2245a1){return _0x2245a1[_0xb7e4('0x3a')](_0xffa6b4)[_0xb7e4('0x24')](function(_0x399891){return _0x399891;});}return null;};}function removeEntity(_0x38d510,_0x132c01){return function(_0x5ea49f){if(_0x5ea49f){return _0x5ea49f[_0xb7e4('0x3b')]()[_0xb7e4('0x24')](function(){var _0x1ebf15=_0x5ea49f[_0xb7e4('0x3c')]({'plain':!![]});var _0x1c9608='OpenchannelAccounts';return db[_0xb7e4('0x3d')][_0xb7e4('0x3b')]({'where':{'type':_0x1c9608,'resourceId':_0x1ebf15['id']}})['then'](function(){return _0x5ea49f;});})[_0xb7e4('0x24')](function(){_0x38d510['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xcc84c,_0x21e749){return function(_0x53d097){if(!_0x53d097){_0xcc84c[_0xb7e4('0x30')](0x194);}return _0x53d097;};}function handleError(_0x56b7e8,_0x1b4cd2){_0x1b4cd2=_0x1b4cd2||0x1f4;return function(_0x2365f1){logger[_0xb7e4('0x2b')](_0x2365f1[_0xb7e4('0x3e')]);if(_0x2365f1[_0xb7e4('0x3f')]){delete _0x2365f1[_0xb7e4('0x3f')];}_0x56b7e8['status'](_0x1b4cd2)['send'](_0x2365f1);};}exports[_0xb7e4('0x40')]=function(_0x359bc4,_0x2b2514){var _0x4cf4ea={'include':[{'model':db['Pause'],'as':_0xb7e4('0x41')}]},_0x10dc8e={},_0x438028={'count':0x0,'rows':[]};var _0x5efa7e=_[_0xb7e4('0x42')](db['OpenchannelAccount'][_0xb7e4('0x43')],function(_0x1af4e6){return{'name':_0x1af4e6[_0xb7e4('0x44')],'type':_0x1af4e6[_0xb7e4('0x45')]['key']};});_0x10dc8e[_0xb7e4('0x46')]=_['map'](_0x5efa7e,_0xb7e4('0x3f'));_0x10dc8e[_0xb7e4('0x47')]=_['keys'](_0x359bc4[_0xb7e4('0x47')]);_0x10dc8e[_0xb7e4('0x48')]=_[_0xb7e4('0x49')](_0x10dc8e['model'],_0x10dc8e[_0xb7e4('0x47')]);_0x4cf4ea[_0xb7e4('0x4a')]=_['intersection'](_0x10dc8e[_0xb7e4('0x46')],qs[_0xb7e4('0x4b')](_0x359bc4['query'][_0xb7e4('0x4b')]));_0x4cf4ea['attributes']=_0x4cf4ea['attributes'][_0xb7e4('0x4c')]?_0x4cf4ea[_0xb7e4('0x4a')]:_0x10dc8e['model'];if(!_0x359bc4[_0xb7e4('0x47')][_0xb7e4('0x4d')](_0xb7e4('0x4e'))){_0x4cf4ea[_0xb7e4('0x35')]=qs[_0xb7e4('0x35')](_0x359bc4[_0xb7e4('0x47')][_0xb7e4('0x35')]);_0x4cf4ea['offset']=qs[_0xb7e4('0x33')](_0x359bc4[_0xb7e4('0x47')][_0xb7e4('0x33')]);}_0x4cf4ea[_0xb7e4('0x4f')]=qs['sort'](_0x359bc4[_0xb7e4('0x47')][_0xb7e4('0x50')]);_0x4cf4ea[_0xb7e4('0x51')]=qs[_0xb7e4('0x48')](_[_0xb7e4('0x52')](_0x359bc4[_0xb7e4('0x47')],_0x10dc8e[_0xb7e4('0x48')]),_0x5efa7e);if(_0x359bc4[_0xb7e4('0x47')][_0xb7e4('0x53')]){_0x4cf4ea[_0xb7e4('0x51')]=_[_0xb7e4('0x54')](_0x4cf4ea[_0xb7e4('0x51')],{'$or':_[_0xb7e4('0x42')](_0x5efa7e,function(_0x1b27e0){if(_0x1b27e0[_0xb7e4('0x45')]!=='VIRTUAL'){var _0x10b657={};_0x10b657[_0x1b27e0[_0xb7e4('0x3f')]]={'$like':'%'+_0x359bc4[_0xb7e4('0x47')][_0xb7e4('0x53')]+'%'};return _0x10b657;}})});}_0x4cf4ea=_[_0xb7e4('0x54')]({},_0x4cf4ea,_0x359bc4[_0xb7e4('0x55')]);var _0x962201={'where':_0x4cf4ea['where']};return db[_0xb7e4('0x56')]['count'](_0x962201)[_0xb7e4('0x24')](function(_0x270577){_0x438028[_0xb7e4('0x36')]=_0x270577;if(_0x359bc4[_0xb7e4('0x47')]['includeAll']){_0x4cf4ea[_0xb7e4('0x57')]=[{'all':!![]}];}return db[_0xb7e4('0x56')][_0xb7e4('0x58')](_0x4cf4ea);})[_0xb7e4('0x24')](function(_0x35b549){_0x438028[_0xb7e4('0x59')]=_0x35b549;return _0x438028;})['then'](respondWithFilteredResult(_0x2b2514,_0x4cf4ea))[_0xb7e4('0x2f')](handleError(_0x2b2514,null));};exports[_0xb7e4('0x5a')]=function(_0x20f030,_0xe3c060){var _0x2e136e={'raw':![],'where':{'id':_0x20f030[_0xb7e4('0x5b')]['id']},'include':[{'model':db[_0xb7e4('0x5c')],'as':'mandatoryDispositionPause'}]},_0x3c6d0c={};_0x3c6d0c[_0xb7e4('0x46')]=_[_0xb7e4('0x5d')](db['OpenchannelAccount'][_0xb7e4('0x43')]);_0x3c6d0c['query']=_[_0xb7e4('0x5d')](_0x20f030[_0xb7e4('0x47')]);_0x3c6d0c[_0xb7e4('0x48')]=_[_0xb7e4('0x49')](_0x3c6d0c[_0xb7e4('0x46')],_0x3c6d0c['query']);_0x2e136e[_0xb7e4('0x4a')]=_[_0xb7e4('0x49')](_0x3c6d0c[_0xb7e4('0x46')],qs[_0xb7e4('0x4b')](_0x20f030['query'][_0xb7e4('0x4b')]));_0x2e136e[_0xb7e4('0x4a')]=_0x2e136e[_0xb7e4('0x4a')][_0xb7e4('0x4c')]?_0x2e136e[_0xb7e4('0x4a')]:_0x3c6d0c[_0xb7e4('0x46')];if(_0x20f030[_0xb7e4('0x47')][_0xb7e4('0x5e')]){_0x2e136e[_0xb7e4('0x57')]=[{'all':!![]}];}_0x2e136e=_[_0xb7e4('0x54')]({},_0x2e136e,_0x20f030['options']);return db['OpenchannelAccount'][_0xb7e4('0x5f')](_0x2e136e)[_0xb7e4('0x24')](handleEntityNotFound(_0xe3c060,null))[_0xb7e4('0x24')](respondWithResult(_0xe3c060,null))[_0xb7e4('0x2f')](handleError(_0xe3c060,null));};exports['create']=function(_0x4859f9,_0x50af79){return db[_0xb7e4('0x56')]['create'](_0x4859f9[_0xb7e4('0x60')],{})[_0xb7e4('0x24')](function(_0x2f6d40){var _0x75bbd0=_0x4859f9[_0xb7e4('0x61')][_0xb7e4('0x3c')]({'plain':!![]});if(!_0x75bbd0)throw new Error(_0xb7e4('0x62'));if(_0x75bbd0['role']===_0xb7e4('0x61')){var _0x37b2cc=_0x2f6d40[_0xb7e4('0x3c')]({'plain':!![]});var _0x5ec77e=_0xb7e4('0x63');return db[_0xb7e4('0x64')][_0xb7e4('0x5f')]({'where':{'name':_0x5ec77e,'userProfileId':_0x75bbd0['userProfileId']},'raw':!![]})['then'](function(_0x234f78){if(_0x234f78&&_0x234f78[_0xb7e4('0x65')]===0x0){return db[_0xb7e4('0x3d')][_0xb7e4('0x66')]({'name':_0x37b2cc[_0xb7e4('0x3f')],'resourceId':_0x37b2cc['id'],'type':_0x234f78['name'],'sectionId':_0x234f78['id']},{})[_0xb7e4('0x24')](function(){return _0x2f6d40;});}else{return _0x2f6d40;}})['catch'](function(_0x359101){logger['error'](_0xb7e4('0x67'),_0x359101);throw _0x359101;});}return _0x2f6d40;})[_0xb7e4('0x24')](respondWithResult(_0x50af79,0xc9))[_0xb7e4('0x2f')](handleError(_0x50af79,null));};exports[_0xb7e4('0x3a')]=function(_0x1eaf8d,_0x276395){if(_0x1eaf8d[_0xb7e4('0x60')]['id']){delete _0x1eaf8d[_0xb7e4('0x60')]['id'];}return db[_0xb7e4('0x56')][_0xb7e4('0x5f')]({'where':{'id':_0x1eaf8d[_0xb7e4('0x5b')]['id']},'include':[{'model':db['Pause'],'as':_0xb7e4('0x41')}]})[_0xb7e4('0x24')](handleEntityNotFound(_0x276395,null))[_0xb7e4('0x24')](saveUpdates(_0x1eaf8d[_0xb7e4('0x60')],null))[_0xb7e4('0x24')](respondWithResult(_0x276395,null))['catch'](handleError(_0x276395,null));};exports[_0xb7e4('0x3b')]=function(_0x16fb3a,_0x4817df){return db[_0xb7e4('0x56')][_0xb7e4('0x5f')]({'where':{'id':_0x16fb3a[_0xb7e4('0x5b')]['id']}})[_0xb7e4('0x24')](handleEntityNotFound(_0x4817df,null))[_0xb7e4('0x24')](removeEntity(_0x4817df,null))['catch'](handleError(_0x4817df,null));};exports[_0xb7e4('0x68')]=function(_0x2acb96,_0x48ee64){return db[_0xb7e4('0x56')][_0xb7e4('0x68')]()[_0xb7e4('0x24')](respondWithResult(_0x48ee64,null))[_0xb7e4('0x2f')](handleError(_0x48ee64,null));};exports[_0xb7e4('0x69')]=function(_0x3a13b4,_0x561423,_0x2b0f46){if(_0x3a13b4[_0xb7e4('0x60')]['id']){delete _0x3a13b4[_0xb7e4('0x60')]['id'];}return db[_0xb7e4('0x56')][_0xb7e4('0x5f')]({'where':{'id':_0x3a13b4[_0xb7e4('0x5b')]['id']}})['then'](handleEntityNotFound(_0x561423,null))[_0xb7e4('0x24')](function(_0x468090){if(_0x468090){_0x3a13b4['body'][_0xb7e4('0x6a')]=_0x468090['id'];return db[_0xb7e4('0x6b')][_0xb7e4('0x66')](_0x3a13b4[_0xb7e4('0x60')]);}})['then'](respondWithResult(_0x561423,null))[_0xb7e4('0x2f')](handleError(_0x561423,null));};exports[_0xb7e4('0x6c')]=function(_0x172521,_0x12854e,_0x1d39a3){var _0x2f8388={'raw':![],'where':{}};var _0x202490={};var _0x4b5f6d={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0xb7e4('0x6d')]({'where':{'id':_0x172521[_0xb7e4('0x5b')]['id']}})['then'](handleEntityNotFound(_0x12854e,null))[_0xb7e4('0x24')](function(_0x233f9c){if(_0x233f9c){_0x202490[_0xb7e4('0x46')]=_[_0xb7e4('0x5d')](db[_0xb7e4('0x6b')]['rawAttributes']);_0x202490[_0xb7e4('0x47')]=_[_0xb7e4('0x5d')](_0x172521['query']);_0x202490['filters']=_[_0xb7e4('0x49')](_0x202490[_0xb7e4('0x46')],_0x202490['query']);_0x2f8388[_0xb7e4('0x4a')]=_[_0xb7e4('0x49')](_0x202490['model'],qs[_0xb7e4('0x4b')](_0x172521[_0xb7e4('0x47')][_0xb7e4('0x4b')]));_0x2f8388['attributes']=_0x2f8388[_0xb7e4('0x4a')][_0xb7e4('0x4c')]?_0x2f8388[_0xb7e4('0x4a')]:_0x202490[_0xb7e4('0x46')];if(!_0x172521[_0xb7e4('0x47')][_0xb7e4('0x4d')](_0xb7e4('0x4e'))){_0x2f8388['limit']=qs['limit'](_0x172521[_0xb7e4('0x47')][_0xb7e4('0x35')]);_0x2f8388['offset']=qs[_0xb7e4('0x33')](_0x172521[_0xb7e4('0x47')][_0xb7e4('0x33')]);}_0x2f8388[_0xb7e4('0x4f')]=qs[_0xb7e4('0x50')](_0x172521[_0xb7e4('0x47')][_0xb7e4('0x50')]);_0x2f8388['where']=qs['filters'](_['pick'](_0x172521[_0xb7e4('0x47')],_0x202490[_0xb7e4('0x48')]));_0x2f8388[_0xb7e4('0x51')][_0xb7e4('0x6a')]=_0x233f9c['id'];if(_0x172521[_0xb7e4('0x47')][_0xb7e4('0x53')]){_0x2f8388[_0xb7e4('0x51')]=_[_0xb7e4('0x54')](_0x2f8388['where'],{'$or':_[_0xb7e4('0x42')](_0x2f8388[_0xb7e4('0x4a')],function(_0x2ddf5e){var _0x1b172b={};_0x1b172b[_0x2ddf5e]={'$like':'%'+_0x172521[_0xb7e4('0x47')][_0xb7e4('0x53')]+'%'};return _0x1b172b;})});}_0x2f8388=_[_0xb7e4('0x54')]({},_0x2f8388,_0x172521['options']);return db[_0xb7e4('0x6b')][_0xb7e4('0x36')]({'where':_0x2f8388['where']})[_0xb7e4('0x24')](function(_0x4d8cc8){_0x4b5f6d[_0xb7e4('0x36')]=_0x4d8cc8;if(_0x172521[_0xb7e4('0x47')][_0xb7e4('0x5e')]){_0x2f8388[_0xb7e4('0x57')]=[{'all':!![]}];}return db[_0xb7e4('0x6b')][_0xb7e4('0x58')](_0x2f8388);})['then'](function(_0x37a27c){_0x4b5f6d[_0xb7e4('0x59')]=_0x37a27c;return _0x4b5f6d;});}})[_0xb7e4('0x24')](respondWithFilteredResult(_0x12854e,_0x2f8388))[_0xb7e4('0x2f')](handleError(_0x12854e,null));};exports[_0xb7e4('0x6e')]=function(_0x8f020d,_0x29fb08,_0x138672){return db['OpenchannelAccount'][_0xb7e4('0x5f')]({'where':{'id':_0x8f020d['params']['id']}})[_0xb7e4('0x24')](handleEntityNotFound(_0x29fb08,null))[_0xb7e4('0x24')](function(_0x272b8d){if(_0x272b8d){return _0x272b8d['removeDispositions'](_0x8f020d[_0xb7e4('0x47')]['ids']);}})[_0xb7e4('0x24')](respondWithStatusCode(_0x29fb08,null))[_0xb7e4('0x2f')](handleError(_0x29fb08,null));};exports[_0xb7e4('0x6f')]=function(_0x83a245,_0x451877,_0x424932){if(_0x83a245[_0xb7e4('0x60')]['id']){delete _0x83a245['body']['id'];}return db[_0xb7e4('0x56')][_0xb7e4('0x5f')]({'where':{'id':_0x83a245['params']['id']}})[_0xb7e4('0x24')](handleEntityNotFound(_0x451877,null))[_0xb7e4('0x24')](function(_0x4fffbe){if(_0x4fffbe){_0x83a245['body'][_0xb7e4('0x6a')]=_0x4fffbe['id'];return db[_0xb7e4('0x70')]['create'](_0x83a245[_0xb7e4('0x60')]);}})['then'](respondWithResult(_0x451877,null))[_0xb7e4('0x2f')](handleError(_0x451877,null));};exports[_0xb7e4('0x71')]=function(_0x51f372,_0x476ed2,_0x1f8336){var _0x10a1fe={'raw':![],'where':{}};var _0x37ba22={};var _0x15e84f={'count':0x0,'rows':[]};return db[_0xb7e4('0x56')][_0xb7e4('0x6d')]({'where':{'id':_0x51f372['params']['id']}})['then'](handleEntityNotFound(_0x476ed2,null))[_0xb7e4('0x24')](function(_0x544954){if(_0x544954){_0x37ba22[_0xb7e4('0x46')]=_[_0xb7e4('0x5d')](db[_0xb7e4('0x70')][_0xb7e4('0x43')]);_0x37ba22[_0xb7e4('0x47')]=_[_0xb7e4('0x5d')](_0x51f372[_0xb7e4('0x47')]);_0x37ba22[_0xb7e4('0x48')]=_[_0xb7e4('0x49')](_0x37ba22[_0xb7e4('0x46')],_0x37ba22[_0xb7e4('0x47')]);_0x10a1fe['attributes']=_['intersection'](_0x37ba22[_0xb7e4('0x46')],qs[_0xb7e4('0x4b')](_0x51f372[_0xb7e4('0x47')][_0xb7e4('0x4b')]));_0x10a1fe[_0xb7e4('0x4a')]=_0x10a1fe['attributes']['length']?_0x10a1fe[_0xb7e4('0x4a')]:_0x37ba22['model'];if(!_0x51f372[_0xb7e4('0x47')][_0xb7e4('0x4d')]('nolimit')){_0x10a1fe[_0xb7e4('0x35')]=qs['limit'](_0x51f372[_0xb7e4('0x47')][_0xb7e4('0x35')]);_0x10a1fe['offset']=qs[_0xb7e4('0x33')](_0x51f372[_0xb7e4('0x47')][_0xb7e4('0x33')]);}_0x10a1fe[_0xb7e4('0x4f')]=qs[_0xb7e4('0x50')](_0x51f372[_0xb7e4('0x47')][_0xb7e4('0x50')]);_0x10a1fe['where']=qs[_0xb7e4('0x48')](_[_0xb7e4('0x52')](_0x51f372['query'],_0x37ba22[_0xb7e4('0x48')]));_0x10a1fe['where'][_0xb7e4('0x6a')]=_0x544954['id'];if(_0x51f372[_0xb7e4('0x47')][_0xb7e4('0x53')]){_0x10a1fe[_0xb7e4('0x51')]=_['merge'](_0x10a1fe[_0xb7e4('0x51')],{'$or':_[_0xb7e4('0x42')](_0x10a1fe[_0xb7e4('0x4a')],function(_0x1f9bfc){var _0xfccc80={};_0xfccc80[_0x1f9bfc]={'$like':'%'+_0x51f372[_0xb7e4('0x47')]['filter']+'%'};return _0xfccc80;})});}_0x10a1fe=_[_0xb7e4('0x54')]({},_0x10a1fe,_0x51f372[_0xb7e4('0x55')]);return db[_0xb7e4('0x70')][_0xb7e4('0x36')]({'where':_0x10a1fe[_0xb7e4('0x51')]})['then'](function(_0x4060d9){_0x15e84f['count']=_0x4060d9;if(_0x51f372[_0xb7e4('0x47')][_0xb7e4('0x5e')]){_0x10a1fe[_0xb7e4('0x57')]=[{'all':!![]}];}return db[_0xb7e4('0x70')]['findAll'](_0x10a1fe);})[_0xb7e4('0x24')](function(_0x37d9fc){_0x15e84f['rows']=_0x37d9fc;return _0x15e84f;});}})[_0xb7e4('0x24')](respondWithFilteredResult(_0x476ed2,_0x10a1fe))['catch'](handleError(_0x476ed2,null));};exports[_0xb7e4('0x72')]=function(_0x40ac45,_0x4b2433,_0x38649f){return db[_0xb7e4('0x56')][_0xb7e4('0x5f')]({'where':{'id':_0x40ac45['params']['id']}})[_0xb7e4('0x24')](handleEntityNotFound(_0x4b2433,null))[_0xb7e4('0x24')](function(_0x553880){if(_0x553880){return _0x553880[_0xb7e4('0x72')](_0x40ac45['query'][_0xb7e4('0x73')]);}})[_0xb7e4('0x24')](respondWithStatusCode(_0x4b2433,null))[_0xb7e4('0x2f')](handleError(_0x4b2433,null));};exports['notify']=function(_0x5f4fe2,_0x3e9dcc,_0x1107d8){var _0x52328b={'body':_0x5f4fe2[_0xb7e4('0x60')],'channel':'openchannel'};var _0x5cad96=[];var _0x209503=[];var _0x3d7716={};var _0x34ea13=![];return db[_0xb7e4('0x74')][_0xb7e4('0x68')]()[_0xb7e4('0x24')](function(_0x5bd5e1){if(!_0x5bd5e1){throw new db[(_0xb7e4('0x75'))][(_0xb7e4('0x76'))](_0xb7e4('0x77'));}_0x5cad96=_['difference'](_[_0xb7e4('0x5d')](_0x5bd5e1),['createdAt',_0xb7e4('0x78')]);_0x209503=_['difference'](_[_0xb7e4('0x5d')](_0x5bd5e1),[_0xb7e4('0x79'),_0xb7e4('0x78'),_0xb7e4('0x7a'),_0xb7e4('0x7b')]);if(_0x5f4fe2[_0xb7e4('0x60')]['id']){delete _0x5f4fe2[_0xb7e4('0x60')]['id'];}if(_[_0xb7e4('0x7c')](_0x5f4fe2[_0xb7e4('0x60')]['from'])){throw new db['Sequelize'][(_0xb7e4('0x76'))](_0xb7e4('0x7d'));}if(_['isNil'](_0x5f4fe2[_0xb7e4('0x60')][_0xb7e4('0x60')])||_0x5f4fe2[_0xb7e4('0x60')][_0xb7e4('0x60')]===''){throw new db[(_0xb7e4('0x75'))][(_0xb7e4('0x76'))](_0xb7e4('0x7e'));}if(_[_0xb7e4('0x7c')](_0x5f4fe2[_0xb7e4('0x60')][_0xb7e4('0x7f')])){throw new db['Sequelize']['ValidationError'](_0xb7e4('0x80')+_0x209503);}if(!_['includes'](_0x209503,_0x5f4fe2[_0xb7e4('0x60')]['mapKey'])){throw new db[(_0xb7e4('0x75'))][(_0xb7e4('0x76'))](_0xb7e4('0x81')+_0x209503);}_0x3d7716[_0x5f4fe2['body']['mapKey']]=_0x5f4fe2[_0xb7e4('0x60')][_0xb7e4('0x82')];})[_0xb7e4('0x24')](function(){return db[_0xb7e4('0x56')][_0xb7e4('0x5f')]({'where':{'id':_0x5f4fe2[_0xb7e4('0x5b')]['id']},'include':[{'model':db[_0xb7e4('0x83')],'as':_0xb7e4('0x84'),'include':[{'model':db[_0xb7e4('0x74')],'as':_0xb7e4('0x85'),'where':_0x3d7716,'limit':0x1,'order':[['updatedAt',_0xb7e4('0x86')]]}]},{'model':db['OpenchannelApplication'],'as':_0xb7e4('0x87')}]});})[_0xb7e4('0x24')](handleEntityNotFound(_0x3e9dcc,null))[_0xb7e4('0x24')](function(_0x32e12a){if(_0x32e12a&&_0x32e12a[_0xb7e4('0x84')]){_0x52328b[_0xb7e4('0x88')]=_0x32e12a;_0x52328b[_0xb7e4('0x89')]=_0x32e12a[_0xb7e4('0x87')];_0x52328b['list']=_0x32e12a[_0xb7e4('0x84')];_0x52328b[_0xb7e4('0x89')]=_[_0xb7e4('0x8a')](_0x52328b[_0xb7e4('0x89')],['priority'],['asc']);if(_0x52328b[_0xb7e4('0x88')][_0xb7e4('0x87')]){delete _0x52328b['account']['Applications'];}if(_0x52328b[_0xb7e4('0x88')][_0xb7e4('0x84')]&&_0x52328b['account']['List'][_0xb7e4('0x85')][_0xb7e4('0x4c')]){return _0x52328b[_0xb7e4('0x88')]['List'][_0xb7e4('0x85')][0x0];}var _0x295cd9=_[_0xb7e4('0x1b')](_0x5f4fe2[_0xb7e4('0x60')],{'firstName':_0x5f4fe2['body'][_0xb7e4('0x82')],'ListId':_0x32e12a[_0xb7e4('0x7b')]});_0x295cd9[_0x5f4fe2[_0xb7e4('0x60')][_0xb7e4('0x7f')]]=_0x5f4fe2[_0xb7e4('0x60')][_0xb7e4('0x82')];return db['CmContact'][_0xb7e4('0x66')](_0x295cd9,{'fields':_0x5cad96,'raw':!![]});}})['then'](handleEntityNotFound(_0x3e9dcc,null))[_0xb7e4('0x24')](function(_0x17982f){_0x52328b[_0xb7e4('0x8b')]=_0x17982f;if(_0x17982f){var _0x5aa5f9={'ContactId':_0x17982f['id'],'OpenchannelAccountId':_0x5f4fe2[_0xb7e4('0x5b')]['id'],'from':(_0x17982f[_0xb7e4('0x8c')]||'')+'\x20'+(_0x17982f['lastName']||'')};var _0x173d6a={'OpenchannelAccountId':_0x5f4fe2['params']['id'],'closed':![]};if(_0x5f4fe2[_0xb7e4('0x60')][_0xb7e4('0x8d')]){_0x173d6a[_0xb7e4('0x8d')]=_0x5f4fe2[_0xb7e4('0x60')][_0xb7e4('0x8d')];return db[_0xb7e4('0x8e')][_0xb7e4('0x5f')]({'where':_0x173d6a})['then'](function(_0x5269c4){if(_0x5269c4){return[_0x5269c4,![]];}_0x5aa5f9[_0xb7e4('0x8d')]=_0x5f4fe2[_0xb7e4('0x60')][_0xb7e4('0x8d')];_0x5aa5f9[_0xb7e4('0x8f')]=_0x5f4fe2[_0xb7e4('0x60')][_0xb7e4('0x8f')];return db[_0xb7e4('0x8e')][_0xb7e4('0x66')](_0x5aa5f9)[_0xb7e4('0x24')](function(_0x5f1984){return[_0x5f1984,!![]];});});}else{_0x173d6a['threadId']=null;}_0x173d6a['ContactId']=_0x17982f['id'];return db[_0xb7e4('0x8e')][_0xb7e4('0x5f')]({'where':_0x173d6a})[_0xb7e4('0x24')](function(_0x93582a){if(_0x93582a){return[_0x93582a,![]];}return db[_0xb7e4('0x8e')][_0xb7e4('0x66')](_0x5aa5f9)[_0xb7e4('0x24')](function(_0x47c982){return[_0x47c982,!![]];});});}})['spread'](function(_0x24f8f4,_0x53f148){if(_0x24f8f4){_0x34ea13=_0x53f148;if(!_0x53f148){var _0x2da8aa={'from':(_0x52328b[_0xb7e4('0x8b')][_0xb7e4('0x8c')]||'')+'\x20'+(_0x52328b['contact'][_0xb7e4('0x90')]||'')};if(_0x5f4fe2['body']['threadId']&&_0x5f4fe2[_0xb7e4('0x60')][_0xb7e4('0x91')]&&_0x5f4fe2[_0xb7e4('0x60')][_0xb7e4('0x8d')]!=_0x5f4fe2[_0xb7e4('0x60')]['messageId']){_0x2da8aa['threadId']=_0x5f4fe2[_0xb7e4('0x60')][_0xb7e4('0x91')];}return _0x24f8f4[_0xb7e4('0x3a')](_0x2da8aa);}else{return _0x24f8f4;}}})['then'](function(_0x328b61){_0x52328b[_0xb7e4('0x92')]=_0x328b61[_0xb7e4('0x3c')]({'plain':!![]});_0x52328b['interaction'][_0xb7e4('0x93')]=_0x34ea13;if(_0x52328b[_0xb7e4('0x92')][_0xb7e4('0x93')]){if(_0x52328b[_0xb7e4('0x88')][_0xb7e4('0x94')]){_0x52328b['applications'][_0xb7e4('0x95')]({'id':0x0,'priority':_0x52328b[_0xb7e4('0x89')][_0xb7e4('0x4c')]+0x1,'app':_0xb7e4('0x96'),'appdata':'unmanaged','interval':_0xb7e4('0x97')});}}return db[_0xb7e4('0x98')][_0xb7e4('0x66')]({'body':_0x5f4fe2[_0xb7e4('0x60')]['body'],'OpenchannelAccountId':_0x5f4fe2[_0xb7e4('0x5b')]['id'],'OpenchannelInteractionId':_0x328b61['id'],'direction':'in','ContactId':_0x52328b[_0xb7e4('0x8b')]['id'],'AttachmentId':_0x5f4fe2[_0xb7e4('0x60')][_0xb7e4('0x99')]});})['then'](function(_0x41f4c0){_0x52328b['message']=_0x41f4c0;if(!_0x52328b[_0xb7e4('0x92')]['UserId'])return;return db[_0xb7e4('0x9a')]['find']({'attributes':['id','name'],'where':{'id':_0x52328b[_0xb7e4('0x92')]['UserId']}});})[_0xb7e4('0x24')](function(_0x5a0d66){if(_0x5a0d66){_0x52328b[_0xb7e4('0x89')][_0xb7e4('0x9b')]({'id':0x0,'priority':0x0,'app':_0xb7e4('0x9c'),'appdata':_0x5a0d66[_0xb7e4('0x3f')]+','+(_0x52328b['account'][_0xb7e4('0x9d')]||0xa),'interval':'*,*,*,*'});}if(!_0x52328b[_0xb7e4('0x92')][_0xb7e4('0x9e')])return;return db[_0xb7e4('0x9f')][_0xb7e4('0x5f')]({'attributes':['id','name'],'where':{'id':_0x52328b[_0xb7e4('0x92')][_0xb7e4('0x9e')]}});})['then'](function(_0x4d84bb){if(_0x4d84bb){_0x52328b['applications'][_0xb7e4('0x9b')]({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x4d84bb[_0xb7e4('0x3f')]+','+(_0x52328b['account'][_0xb7e4('0xa0')]||0x12c),'interval':_0xb7e4('0x97')});}return respondWithRpcPromise(_0xb7e4('0xa1'),_0xb7e4('0xa2'),_0x52328b);})['then'](function(_0x324d9f){respondWithRpcPromise(_0xb7e4('0xa3'),'EventManager',{'event':_0xb7e4('0xa4'),'message':_0x324d9f},client9002);return _0x324d9f;})[_0xb7e4('0x24')](respondWithResult(_0x3e9dcc,null))[_0xb7e4('0x2f')](handleError(_0x3e9dcc,null));};exports[_0xb7e4('0xa5')]=function(_0x28b3b1,_0x5a74ba){var _0x143f0f=_0x28b3b1[_0xb7e4('0x5b')]['id'];var _0x51f921=_0x28b3b1[_0xb7e4('0x60')];var _0x503a66=0xc8;var _0x1110fe=null;return db[_0xb7e4('0xa6')][_0xb7e4('0xa7')]({'isolationLevel':db[_0xb7e4('0xa6')][_0xb7e4('0xa8')][_0xb7e4('0xa9')][_0xb7e4('0xaa')]},function(_0x323861){return db[_0xb7e4('0x56')]['findOne']({'where':{'id':_0x143f0f},'transaction':_0x323861})[_0xb7e4('0x24')](function(_0xf09e77){if(_0xf09e77){return db[_0xb7e4('0xab')][_0xb7e4('0x3b')]({'where':{'OpenchannelAccountId':_0x143f0f},'transaction':_0x323861})[_0xb7e4('0x24')](function(){var _0x5b9c23=_[_0xb7e4('0x42')](_0x51f921,function(_0x14bced){_0x14bced[_0xb7e4('0x6a')]=_0x143f0f;return _0x14bced;});return db[_0xb7e4('0xab')]['bulkCreate'](_0x5b9c23,{'transaction':_0x323861});});}else{_0x503a66=0x194;_0x1110fe=[];}});})['then'](function(){if(_0x503a66!==0x194){return db[_0xb7e4('0xab')][_0xb7e4('0xac')]({'where':{'OpenchannelAccountId':_0x143f0f},'order':'priority'})[_0xb7e4('0x24')](function(_0x4cf9aa){_0x1110fe=_0x4cf9aa;});}})[_0xb7e4('0x2f')](function(_0x3d8933){_0x503a66=0x1f4;logger[_0xb7e4('0x2b')](_0x3d8933[_0xb7e4('0x3e')]);if(_0x3d8933[_0xb7e4('0x3f')]){delete _0x3d8933['name'];}_0x1110fe=_0x3d8933;})['finally'](function(){if(_0x1110fe===null){_0x5a74ba[_0xb7e4('0x30')](_0x503a66);}else{if(_0x503a66===0x1f4){_0x5a74ba[_0xb7e4('0x31')](_0x503a66)['send'](_0x1110fe);}else{_0x5a74ba['status'](_0x503a66)[_0xb7e4('0x32')](_0x1110fe);}}});};exports[_0xb7e4('0xad')]=function(_0xc94235,_0x53bb2c,_0x1d0d9f){var _0x34f152={};var _0x304d49={};var _0x1b1100;var _0x539440;return db[_0xb7e4('0x56')][_0xb7e4('0x6d')]({'where':{'id':_0xc94235[_0xb7e4('0x5b')]['id']}})[_0xb7e4('0x24')](handleEntityNotFound(_0x53bb2c,null))[_0xb7e4('0x24')](function(_0x34acaa){if(_0x34acaa){_0x1b1100=_0x34acaa;_0x304d49[_0xb7e4('0x46')]=_[_0xb7e4('0x5d')](db['OpenchannelApplication'][_0xb7e4('0x43')]);_0x304d49['query']=_['keys'](_0xc94235[_0xb7e4('0x47')]);_0x304d49[_0xb7e4('0x48')]=_[_0xb7e4('0x49')](_0x304d49[_0xb7e4('0x46')],_0x304d49[_0xb7e4('0x47')]);_0x34f152[_0xb7e4('0x4a')]=_[_0xb7e4('0x49')](_0x304d49[_0xb7e4('0x46')],qs[_0xb7e4('0x4b')](_0xc94235[_0xb7e4('0x47')][_0xb7e4('0x4b')]));_0x34f152[_0xb7e4('0x4a')]=_0x34f152[_0xb7e4('0x4a')][_0xb7e4('0x4c')]?_0x34f152[_0xb7e4('0x4a')]:_0x304d49['model'];_0x34f152[_0xb7e4('0x4f')]=qs[_0xb7e4('0x50')](_0xc94235[_0xb7e4('0x47')][_0xb7e4('0x50')]);_0x34f152[_0xb7e4('0x51')]=qs[_0xb7e4('0x48')](_[_0xb7e4('0x52')](_0xc94235[_0xb7e4('0x47')],_0x304d49[_0xb7e4('0x48')]));if(_0xc94235[_0xb7e4('0x47')][_0xb7e4('0x53')]){_0x34f152[_0xb7e4('0x51')]=_[_0xb7e4('0x54')](_0x34f152[_0xb7e4('0x51')],{'$or':_[_0xb7e4('0x42')](_0x34f152['attributes'],function(_0x501329){var _0x1d1c70={};_0x1d1c70[_0x501329]={'$like':'%'+_0xc94235[_0xb7e4('0x47')][_0xb7e4('0x53')]+'%'};return _0x1d1c70;})});}_0x34f152=_[_0xb7e4('0x54')]({},_0x34f152,_0xc94235[_0xb7e4('0x55')]);return _0x1b1100[_0xb7e4('0xad')](_0x34f152);}})[_0xb7e4('0x24')](function(_0x5e23b5){if(_0x5e23b5){_0x539440=_0x5e23b5['length'];if(!_0xc94235[_0xb7e4('0x47')][_0xb7e4('0x4d')]('nolimit')){_0x34f152[_0xb7e4('0x35')]=qs[_0xb7e4('0x35')](_0xc94235[_0xb7e4('0x47')]['limit']);_0x34f152[_0xb7e4('0x33')]=qs[_0xb7e4('0x33')](_0xc94235[_0xb7e4('0x47')][_0xb7e4('0x33')]);}return _0x1b1100[_0xb7e4('0xad')](_0x34f152);}})[_0xb7e4('0x24')](function(_0x4e9fb0){if(_0x4e9fb0){return _0x4e9fb0?{'count':_0x539440,'rows':_0x4e9fb0}:null;}})[_0xb7e4('0x24')](respondWithResult(_0x53bb2c,null))[_0xb7e4('0x2f')](handleError(_0x53bb2c,null));};exports['getInteractions']=function(_0x166a6e,_0xd30902,_0x396e54){var _0x43a609={'raw':![],'where':{}};var _0x39bc5e={};var _0x3f873d={'count':0x0,'rows':[]};return db[_0xb7e4('0x56')][_0xb7e4('0x6d')]({'where':{'id':_0x166a6e['params']['id']}})['then'](handleEntityNotFound(_0xd30902,null))[_0xb7e4('0x24')](function(_0x2a8020){if(_0x2a8020){_0x39bc5e['model']=_[_0xb7e4('0x5d')](db[_0xb7e4('0x8e')][_0xb7e4('0x43')]);_0x39bc5e[_0xb7e4('0x47')]=_[_0xb7e4('0x5d')](_0x166a6e[_0xb7e4('0x47')]);_0x39bc5e[_0xb7e4('0x48')]=_['intersection'](_0x39bc5e[_0xb7e4('0x46')],_0x39bc5e[_0xb7e4('0x47')]);_0x43a609[_0xb7e4('0x4a')]=_[_0xb7e4('0x49')](_0x39bc5e[_0xb7e4('0x46')],qs['fields'](_0x166a6e[_0xb7e4('0x47')][_0xb7e4('0x4b')]));_0x43a609[_0xb7e4('0x4a')]=_0x43a609[_0xb7e4('0x4a')][_0xb7e4('0x4c')]?_0x43a609[_0xb7e4('0x4a')]:_0x39bc5e[_0xb7e4('0x46')];if(!_0x166a6e['query'][_0xb7e4('0x4d')](_0xb7e4('0x4e'))){_0x43a609[_0xb7e4('0x35')]=qs[_0xb7e4('0x35')](_0x166a6e[_0xb7e4('0x47')][_0xb7e4('0x35')]);_0x43a609[_0xb7e4('0x33')]=qs['offset'](_0x166a6e[_0xb7e4('0x47')][_0xb7e4('0x33')]);}_0x43a609[_0xb7e4('0x4f')]=qs[_0xb7e4('0x50')](_0x166a6e[_0xb7e4('0x47')][_0xb7e4('0x50')]);_0x43a609[_0xb7e4('0x51')]=qs[_0xb7e4('0x48')](_[_0xb7e4('0x52')](_0x166a6e[_0xb7e4('0x47')],_0x39bc5e[_0xb7e4('0x48')]));_0x43a609[_0xb7e4('0x51')][_0xb7e4('0x6a')]=_0x2a8020['id'];if(_0x166a6e['query'][_0xb7e4('0x53')]){_0x43a609['where']=_[_0xb7e4('0x54')](_0x43a609[_0xb7e4('0x51')],{'$or':_['map'](_0x43a609[_0xb7e4('0x4a')],function(_0x569854){var _0x4298fa={};_0x4298fa[_0x569854]={'$like':'%'+_0x166a6e[_0xb7e4('0x47')]['filter']+'%'};return _0x4298fa;})});}_0x43a609=_[_0xb7e4('0x54')]({},_0x43a609,_0x166a6e[_0xb7e4('0x55')]);return db[_0xb7e4('0x8e')][_0xb7e4('0x36')]({'where':_0x43a609[_0xb7e4('0x51')]})['then'](function(_0x5d315f){_0x3f873d[_0xb7e4('0x36')]=_0x5d315f;if(_0x166a6e[_0xb7e4('0x47')][_0xb7e4('0x5e')]){_0x43a609['include']=[{'model':db['CmContact'],'as':_0xb7e4('0xae'),'required':![]},{'model':db[_0xb7e4('0x9a')],'as':_0xb7e4('0xaf'),'attributes':[_0xb7e4('0x3f'),_0xb7e4('0xb0'),_0xb7e4('0xb1')],'required':![]},{'model':db[_0xb7e4('0xb2')],'as':_0xb7e4('0xb3'),'attributes':['id',_0xb7e4('0x3f'),_0xb7e4('0xb4')],'where':_0x166a6e[_0xb7e4('0x47')][_0xb7e4('0xb5')]?{'id':_0x166a6e['query']['tag']}:undefined,'required':_0x166a6e[_0xb7e4('0x47')]['tag']?!![]:![]}];}return db['OpenchannelInteraction'][_0xb7e4('0x58')](_0x43a609);})[_0xb7e4('0x24')](function(_0x5b5de7){_0x3f873d[_0xb7e4('0x59')]=_0x5b5de7;return _0x3f873d;});}})[_0xb7e4('0x24')](respondWithFilteredResult(_0xd30902,_0x43a609))[_0xb7e4('0x2f')](handleError(_0xd30902,null));};exports[_0xb7e4('0xb6')]=function(_0x180380,_0x4efcf9,_0x167bc6){return db['OpenchannelAccount']['find']({'where':{'id':_0x180380[_0xb7e4('0x5b')]['id']}})[_0xb7e4('0x24')](handleEntityNotFound(_0x4efcf9,null))['then'](function(_0x12445c){if(_0x12445c){return _0x12445c[_0xb7e4('0xb6')](_0x180380[_0xb7e4('0x60')][_0xb7e4('0x73')],_[_0xb7e4('0xb7')](_0x180380[_0xb7e4('0x60')],[_0xb7e4('0x73'),'id'])||{})[_0xb7e4('0xb8')](function(_0x214a26){for(var _0x3407c4=0x0;_0x3407c4<_0x180380['body']['ids'][_0xb7e4('0x4c')];_0x3407c4+=0x1){socket[_0xb7e4('0xb9')]('userOpenchannelAccount:save',{'UserId':Number(_0x180380[_0xb7e4('0x60')]['ids'][_0x3407c4]),'OpenchannelAccountId':Number(_0x180380['params']['id'])});}return _0x214a26;});}})[_0xb7e4('0x24')](respondWithResult(_0x4efcf9,null))['catch'](handleError(_0x4efcf9,null));};exports[_0xb7e4('0xba')]=function(_0x2c62c1,_0x4524a4,_0x161c60){return db['OpenchannelAccount'][_0xb7e4('0x5f')]({'where':{'id':_0x2c62c1[_0xb7e4('0x5b')]['id']}})['then'](handleEntityNotFound(_0x4524a4,null))[_0xb7e4('0x24')](function(_0x44c332){if(_0x44c332){return _0x44c332[_0xb7e4('0xba')](_0x2c62c1[_0xb7e4('0x47')][_0xb7e4('0x73')])[_0xb7e4('0x24')](function(){if(_[_0xb7e4('0xbb')](_0x2c62c1[_0xb7e4('0x47')]['ids'])){for(var _0x3ed7db=0x0;_0x3ed7db<_0x2c62c1[_0xb7e4('0x47')][_0xb7e4('0x73')][_0xb7e4('0x4c')];_0x3ed7db+=0x1){socket[_0xb7e4('0xb9')]('userOpenchannelAccount:remove',{'UserId':Number(_0x2c62c1[_0xb7e4('0x47')][_0xb7e4('0x73')][_0x3ed7db]),'OpenchannelAccountId':Number(_0x2c62c1['params']['id'])});}}else{socket['emit'](_0xb7e4('0xbc'),{'UserId':Number(_0x2c62c1[_0xb7e4('0x47')]['ids']),'OpenchannelAccountId':Number(_0x2c62c1['params']['id'])});}});}})[_0xb7e4('0x24')](respondWithStatusCode(_0x4524a4,null))[_0xb7e4('0x2f')](handleError(_0x4524a4,null));};exports[_0xb7e4('0xbd')]=function(_0x39e5e4,_0x587b97,_0x297a24){var _0x172fa6={};var _0x409d74={};var _0x3049b5;var _0x4bbeba;return db['OpenchannelAccount']['findOne']({'where':{'id':_0x39e5e4[_0xb7e4('0x5b')]['id']}})['then'](handleEntityNotFound(_0x587b97,null))['then'](function(_0x3018a1){if(_0x3018a1){_0x3049b5=_0x3018a1;_0x409d74['model']=_[_0xb7e4('0x5d')](db['User'][_0xb7e4('0x43')]);_0x409d74[_0xb7e4('0x47')]=_['keys'](_0x39e5e4[_0xb7e4('0x47')]);_0x409d74['filters']=_[_0xb7e4('0x49')](_0x409d74[_0xb7e4('0x46')],_0x409d74['query']);_0x172fa6[_0xb7e4('0x4a')]=_['intersection'](_0x409d74[_0xb7e4('0x46')],qs['fields'](_0x39e5e4[_0xb7e4('0x47')][_0xb7e4('0x4b')]));_0x172fa6[_0xb7e4('0x4a')]=_0x172fa6[_0xb7e4('0x4a')]['length']?_0x172fa6[_0xb7e4('0x4a')]:_0x409d74[_0xb7e4('0x46')];_0x172fa6[_0xb7e4('0x4f')]=qs[_0xb7e4('0x50')](_0x39e5e4['query'][_0xb7e4('0x50')]);_0x172fa6[_0xb7e4('0x51')]=qs[_0xb7e4('0x48')](_[_0xb7e4('0x52')](_0x39e5e4[_0xb7e4('0x47')],_0x409d74[_0xb7e4('0x48')]));if(_0x39e5e4[_0xb7e4('0x47')]['filter']){_0x172fa6[_0xb7e4('0x51')]=_[_0xb7e4('0x54')](_0x172fa6[_0xb7e4('0x51')],{'$or':_[_0xb7e4('0x42')](_0x172fa6[_0xb7e4('0x4a')],function(_0x35d759){var _0x440f89={};_0x440f89[_0x35d759]={'$like':'%'+_0x39e5e4[_0xb7e4('0x47')][_0xb7e4('0x53')]+'%'};return _0x440f89;})});}_0x172fa6=_[_0xb7e4('0x54')]({},_0x172fa6,_0x39e5e4[_0xb7e4('0x55')]);return _0x3049b5[_0xb7e4('0xbd')](_0x172fa6);}})[_0xb7e4('0x24')](function(_0x50b7cf){if(_0x50b7cf){_0x4bbeba=_0x50b7cf[_0xb7e4('0x4c')];if(!_0x39e5e4[_0xb7e4('0x47')][_0xb7e4('0x4d')](_0xb7e4('0x4e'))){_0x172fa6['limit']=qs['limit'](_0x39e5e4[_0xb7e4('0x47')][_0xb7e4('0x35')]);_0x172fa6[_0xb7e4('0x33')]=qs[_0xb7e4('0x33')](_0x39e5e4[_0xb7e4('0x47')][_0xb7e4('0x33')]);}return _0x3049b5[_0xb7e4('0xbd')](_0x172fa6);}})[_0xb7e4('0x24')](function(_0x5310cb){if(_0x5310cb){return _0x5310cb?{'count':_0x4bbeba,'rows':_0x5310cb}:null;}})[_0xb7e4('0x24')](respondWithResult(_0x587b97,null))[_0xb7e4('0x2f')](handleError(_0x587b97,null));};exports['send']=function(_0x283cd6,_0x1097e8,_0x26d7d0){var _0x369e29,_0x3e89c7,_0x827cba;if(_['isNil'](_0x283cd6[_0xb7e4('0x60')][_0xb7e4('0x60')])||_0x283cd6['body'][_0xb7e4('0x60')]===''){throw new db[(_0xb7e4('0x75'))][(_0xb7e4('0x76'))](_0xb7e4('0x7e'));}if(_[_0xb7e4('0x7c')](_0x283cd6[_0xb7e4('0x60')]['to'])){}_0x369e29=_0x283cd6[_0xb7e4('0x60')]['to'];return db[_0xb7e4('0x56')][_0xb7e4('0x6d')]({'where':{'id':_0x283cd6[_0xb7e4('0x5b')]['id']}})[_0xb7e4('0x24')](handleEntityNotFound(_0x1097e8,null))[_0xb7e4('0x24')](function(_0xc22249){if(_0xc22249){return db[_0xb7e4('0x56')][_0xb7e4('0x5f')]({'where':{'id':_0xc22249['id']},'include':[{'model':db[_0xb7e4('0x83')],'as':_0xb7e4('0x84'),'include':[{'model':db[_0xb7e4('0x74')],'as':'Contacts','where':{[_0xc22249['mapKey']]:_0x369e29},'limit':0x1,'order':[[_0xb7e4('0x78'),_0xb7e4('0x86')]]}]}]})[_0xb7e4('0x24')](handleEntityNotFound(_0x1097e8,null))[_0xb7e4('0x24')](function(_0x3a20b4){if(_0x3a20b4&&_0x3a20b4['List']){_0x3e89c7=_0x3a20b4[_0xb7e4('0x3c')]({'plain':!![]});if(_0x3e89c7[_0xb7e4('0x84')]&&_0x3e89c7[_0xb7e4('0x84')][_0xb7e4('0x85')]['length']){return _0x3e89c7[_0xb7e4('0x84')]['Contacts'][0x0];}return db[_0xb7e4('0x74')][_0xb7e4('0x66')](_[_0xb7e4('0x1b')](_0x283cd6['body'],{'firstName':_0x369e29,[_0x3a20b4[_0xb7e4('0x7f')]]:_0x369e29,'phone':_0x369e29,'ListId':_0x3e89c7[_0xb7e4('0x7b')]}));}})[_0xb7e4('0x24')](handleEntityNotFound(_0x1097e8,null))[_0xb7e4('0x24')](function(_0x5ab583){if(_0x5ab583){_0x827cba=_0x5ab583;return db[_0xb7e4('0x8e')]['find']({'where':{'ContactId':_0x827cba['id'],'closed':![],'OpenchannelAccountId':_0x3e89c7['id']}})[_0xb7e4('0x24')](function(_0xfb09a4){if(_0xfb09a4){return[_0xfb09a4,![]];}return db['OpenchannelInteraction'][_0xb7e4('0x66')]({'UserId':_0x283cd6[_0xb7e4('0x61')]['id'],'ContactId':_0x827cba['id'],'OpenchannelAccountId':_0x3e89c7['id'],'lastMsgDirection':_0xb7e4('0xbe'),'firstMsgDirection':_0xb7e4('0xbe'),'Messages':[_[_0xb7e4('0x54')](_0x283cd6[_0xb7e4('0x60')],{'read':![],'body':_0x283cd6[_0xb7e4('0x60')]['body'],'OpenchannelAccountId':_0x3e89c7['id'],'UserId':_0x283cd6[_0xb7e4('0x61')]['id'],'ContactId':_0x827cba['id']})]},{'include':[{'model':db[_0xb7e4('0x98')],'as':_0xb7e4('0xbf')}]})['then'](function(_0x20aa28){return[_0x20aa28,!![]];});});}})[_0xb7e4('0xb8')](function(_0x21c265,_0x5bf841){if(_0x5bf841){return _0x21c265;}return db[_0xb7e4('0x98')][_0xb7e4('0x66')](_['merge'](_0x283cd6[_0xb7e4('0x60')],{'read':![],'body':_0x283cd6[_0xb7e4('0x60')][_0xb7e4('0x60')],'OpenchannelAccountId':_0x3e89c7['id'],'OpenchannelInteractionId':_0x21c265['id'],'UserId':_0x283cd6[_0xb7e4('0x61')]['id'],'ContactId':_0x827cba['id']}))[_0xb7e4('0x24')](function(_0x5b8d8d){_0x21c265['dataValues'][_0xb7e4('0xbf')]=[];_0x21c265[_0xb7e4('0xc0')]['Messages'][_0xb7e4('0x95')](_0x5b8d8d[_0xb7e4('0xc0')]);return _0x21c265;});});}})[_0xb7e4('0x24')](respondWithResult(_0x1097e8,null))[_0xb7e4('0x2f')](handleError(_0x1097e8,null));}; \ No newline at end of file +var _0xc14a=['../../config/license/util','redis','defaults','localhost','./openchannelAccount.socket','register','http','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','sendStatus','status','end','count','offset','set','Content-Range','apply','reject','save','update','destroy','get','stack','name','index','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','pick','filter','where','merge','VIRTUAL','options','OpenchannelAccount','includeAll','findAll','rows','show','params','keys','include','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','OpenchannelAccounts','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','OpenchannelAccountId','Disposition','findOne','hasOwnProperty','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','notify','openchannel','CmContact','Sequelize','ValidationError','difference','createdAt','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','OpenchannelApplication','Applications','account','applications','list','orderBy','priority','contact','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','spread','messageId','interaction','created','autoclose','push','unmanaged','*,*,*,*','OpenchannelMessage','UserId','User','unshift','agent','waitForTheAssignedAgent','queueId','OpenchannelQueue','queue','waitForTheAssignedQueue','Start','EventManager','addApplications','sequelize','transaction','ISOLATION_LEVELS','READ_COMMITTED','findAndCountAll','finally','send','json','getApplications','Contact','Owner','fullname','internal','Tag','Tags','color','tag','addAgents','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','out','user','Messages','dataValues','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment'];(function(_0x3adb8e,_0x247ca2){var _0x3eacdb=function(_0x127ddf){while(--_0x127ddf){_0x3adb8e['push'](_0x3adb8e['shift']());}};_0x3eacdb(++_0x247ca2);}(_0xc14a,0xa9));var _0xac14=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xc14a[_0x5b644e];return _0x49c6bf;};'use strict';var emlformat=require(_0xac14('0x0'));var rimraf=require(_0xac14('0x1'));var zipdir=require(_0xac14('0x2'));var jsonpatch=require(_0xac14('0x3'));var rp=require(_0xac14('0x4'));var moment=require('moment');var BPromise=require(_0xac14('0x5'));var Mustache=require(_0xac14('0x6'));var util=require('util');var path=require(_0xac14('0x7'));var sox=require('sox');var csv=require(_0xac14('0x8'));var ejs=require(_0xac14('0x9'));var fs=require('fs');var fs_extra=require(_0xac14('0xa'));var _=require('lodash');var squel=require(_0xac14('0xb'));var crypto=require(_0xac14('0xc'));var jsforce=require(_0xac14('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xac14('0x8'));var querystring=require(_0xac14('0xe'));var Papa=require(_0xac14('0xf'));var Redis=require(_0xac14('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xac14('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xac14('0x12'));var logger=require(_0xac14('0x13'))('api');var utils=require('../../config/utils');var config=require(_0xac14('0x14'));var licenseUtil=require(_0xac14('0x15'));var db=require('../../mysqldb')['db'];config[_0xac14('0x16')]=_[_0xac14('0x17')](config['redis'],{'host':_0xac14('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xac14('0x16')]));require(_0xac14('0x19'))[_0xac14('0x1a')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0xac14('0x1b')]({'port':0x232c});var client9002=jayson['client'][_0xac14('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x497be2,_0x270284,_0x19edc6,_0x1023e2){return new BPromise(function(_0x22cb60,_0x3b4e6a){var _0x4d7f22=_0x1023e2||client;return _0x4d7f22[_0xac14('0x1c')](_0x497be2,_0x19edc6)[_0xac14('0x1d')](function(_0x39a6e8){logger[_0xac14('0x1e')](_0xac14('0x1f'),_0x270284,_0xac14('0x20'));logger[_0xac14('0x21')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x270284,_0xac14('0x20'),JSON[_0xac14('0x22')](_0x39a6e8));if(_0x39a6e8[_0xac14('0x23')]){if(_0x39a6e8[_0xac14('0x23')][_0xac14('0x24')]===0x1f4){logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x270284,_0x39a6e8[_0xac14('0x23')][_0xac14('0x25')]);return _0x3b4e6a(_0x39a6e8['error'][_0xac14('0x25')]);}logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x270284,_0x39a6e8['error'][_0xac14('0x25')]);return _0x22cb60(_0x39a6e8['error'][_0xac14('0x25')]);}else{logger[_0xac14('0x1e')](_0xac14('0x1f'),_0x270284,_0xac14('0x20'));_0x22cb60(_0x39a6e8['result'][_0xac14('0x25')]);}})['catch'](function(_0x186a10){logger[_0xac14('0x23')]('OpenchannelAccount,\x20%s,\x20%s',_0x270284,_0x186a10);_0x3b4e6a(_0x186a10);});});}function respondWithStatusCode(_0xeb26c2,_0x34f641){_0x34f641=_0x34f641||0xcc;return function(_0x3d2eeb){if(_0x3d2eeb){return _0xeb26c2[_0xac14('0x26')](_0x34f641);}return _0xeb26c2[_0xac14('0x27')](_0x34f641)[_0xac14('0x28')]();};}function respondWithResult(_0x5d033d,_0xc7dd39){_0xc7dd39=_0xc7dd39||0xc8;return function(_0x5de6e5){if(_0x5de6e5){return _0x5d033d['status'](_0xc7dd39)['json'](_0x5de6e5);}};}function respondWithFilteredResult(_0x23a5b3,_0x25b07e){return function(_0x2f6914){if(_0x2f6914){var _0x53584e=typeof _0x25b07e['offset']==='undefined'&&typeof _0x25b07e['limit']==='undefined';var _0x47621c=_0x2f6914[_0xac14('0x29')];var _0x169066=_0x53584e?0x0:_0x25b07e[_0xac14('0x2a')];var _0xe563ec=_0x53584e?_0x2f6914['count']:_0x25b07e[_0xac14('0x2a')]+_0x25b07e['limit'];var _0x30dc81;if(_0xe563ec>=_0x47621c){_0xe563ec=_0x47621c;_0x30dc81=0xc8;}else{_0x30dc81=0xce;}_0x23a5b3[_0xac14('0x27')](_0x30dc81);return _0x23a5b3[_0xac14('0x2b')](_0xac14('0x2c'),_0x169066+'-'+_0xe563ec+'/'+_0x47621c)['json'](_0x2f6914);}return null;};}function patchUpdates(_0x1f491a){return function(_0x1f2cb1){try{jsonpatch[_0xac14('0x2d')](_0x1f2cb1,_0x1f491a,!![]);}catch(_0x3ee381){return BPromise[_0xac14('0x2e')](_0x3ee381);}return _0x1f2cb1[_0xac14('0x2f')]();};}function saveUpdates(_0x507ded,_0x4ceb76){return function(_0x4958c8){if(_0x4958c8){return _0x4958c8[_0xac14('0x30')](_0x507ded)[_0xac14('0x1d')](function(_0x12f601){return _0x12f601;});}return null;};}function removeEntity(_0x1335c3,_0x58389f){return function(_0x410731){if(_0x410731){return _0x410731[_0xac14('0x31')]()[_0xac14('0x1d')](function(){var _0x580cf8=_0x410731[_0xac14('0x32')]({'plain':!![]});var _0x3fe422='OpenchannelAccounts';return db['UserProfileResource']['destroy']({'where':{'type':_0x3fe422,'resourceId':_0x580cf8['id']}})[_0xac14('0x1d')](function(){return _0x410731;});})[_0xac14('0x1d')](function(){_0x1335c3[_0xac14('0x27')](0xcc)[_0xac14('0x28')]();});}};}function handleEntityNotFound(_0x3e7edb,_0x191ad8){return function(_0xc99555){if(!_0xc99555){_0x3e7edb[_0xac14('0x26')](0x194);}return _0xc99555;};}function handleError(_0x4ce01e,_0x323cea){_0x323cea=_0x323cea||0x1f4;return function(_0x215381){logger['error'](_0x215381[_0xac14('0x33')]);if(_0x215381[_0xac14('0x34')]){delete _0x215381[_0xac14('0x34')];}_0x4ce01e[_0xac14('0x27')](_0x323cea)['send'](_0x215381);};}exports[_0xac14('0x35')]=function(_0x33b5bf,_0x296644){var _0x2a6f54={'include':[{'model':db[_0xac14('0x36')],'as':_0xac14('0x37')}]},_0x21f16a={},_0x48c29a={'count':0x0,'rows':[]};var _0x116a5a=_[_0xac14('0x38')](db['OpenchannelAccount'][_0xac14('0x39')],function(_0x5e031b){return{'name':_0x5e031b[_0xac14('0x3a')],'type':_0x5e031b[_0xac14('0x3b')][_0xac14('0x3c')]};});_0x21f16a[_0xac14('0x3d')]=_[_0xac14('0x38')](_0x116a5a,_0xac14('0x34'));_0x21f16a[_0xac14('0x3e')]=_['keys'](_0x33b5bf[_0xac14('0x3e')]);_0x21f16a[_0xac14('0x3f')]=_[_0xac14('0x40')](_0x21f16a['model'],_0x21f16a[_0xac14('0x3e')]);_0x2a6f54[_0xac14('0x41')]=_[_0xac14('0x40')](_0x21f16a[_0xac14('0x3d')],qs[_0xac14('0x42')](_0x33b5bf[_0xac14('0x3e')][_0xac14('0x42')]));_0x2a6f54['attributes']=_0x2a6f54[_0xac14('0x41')][_0xac14('0x43')]?_0x2a6f54[_0xac14('0x41')]:_0x21f16a[_0xac14('0x3d')];if(!_0x33b5bf['query']['hasOwnProperty'](_0xac14('0x44'))){_0x2a6f54[_0xac14('0x45')]=qs[_0xac14('0x45')](_0x33b5bf[_0xac14('0x3e')][_0xac14('0x45')]);_0x2a6f54['offset']=qs[_0xac14('0x2a')](_0x33b5bf[_0xac14('0x3e')]['offset']);}_0x2a6f54[_0xac14('0x46')]=qs[_0xac14('0x47')](_0x33b5bf['query'][_0xac14('0x47')]);_0x2a6f54['where']=qs[_0xac14('0x3f')](_[_0xac14('0x48')](_0x33b5bf[_0xac14('0x3e')],_0x21f16a[_0xac14('0x3f')]),_0x116a5a);if(_0x33b5bf[_0xac14('0x3e')][_0xac14('0x49')]){_0x2a6f54[_0xac14('0x4a')]=_[_0xac14('0x4b')](_0x2a6f54[_0xac14('0x4a')],{'$or':_[_0xac14('0x38')](_0x116a5a,function(_0x1f28ad){if(_0x1f28ad[_0xac14('0x3b')]!==_0xac14('0x4c')){var _0x513406={};_0x513406[_0x1f28ad[_0xac14('0x34')]]={'$like':'%'+_0x33b5bf[_0xac14('0x3e')][_0xac14('0x49')]+'%'};return _0x513406;}})});}_0x2a6f54=_[_0xac14('0x4b')]({},_0x2a6f54,_0x33b5bf[_0xac14('0x4d')]);var _0x19b9a2={'where':_0x2a6f54[_0xac14('0x4a')]};return db[_0xac14('0x4e')][_0xac14('0x29')](_0x19b9a2)['then'](function(_0x5e7c4e){_0x48c29a[_0xac14('0x29')]=_0x5e7c4e;if(_0x33b5bf[_0xac14('0x3e')][_0xac14('0x4f')]){_0x2a6f54['include']=[{'all':!![]}];}return db[_0xac14('0x4e')][_0xac14('0x50')](_0x2a6f54);})[_0xac14('0x1d')](function(_0x5d817a){_0x48c29a[_0xac14('0x51')]=_0x5d817a;return _0x48c29a;})[_0xac14('0x1d')](respondWithFilteredResult(_0x296644,_0x2a6f54))['catch'](handleError(_0x296644,null));};exports[_0xac14('0x52')]=function(_0x1329d9,_0x39f600){var _0x520d37={'raw':![],'where':{'id':_0x1329d9[_0xac14('0x53')]['id']},'include':[{'model':db[_0xac14('0x36')],'as':_0xac14('0x37')}]},_0x19d330={};_0x19d330[_0xac14('0x3d')]=_[_0xac14('0x54')](db[_0xac14('0x4e')][_0xac14('0x39')]);_0x19d330[_0xac14('0x3e')]=_[_0xac14('0x54')](_0x1329d9[_0xac14('0x3e')]);_0x19d330[_0xac14('0x3f')]=_[_0xac14('0x40')](_0x19d330[_0xac14('0x3d')],_0x19d330[_0xac14('0x3e')]);_0x520d37[_0xac14('0x41')]=_[_0xac14('0x40')](_0x19d330[_0xac14('0x3d')],qs[_0xac14('0x42')](_0x1329d9[_0xac14('0x3e')][_0xac14('0x42')]));_0x520d37[_0xac14('0x41')]=_0x520d37[_0xac14('0x41')][_0xac14('0x43')]?_0x520d37[_0xac14('0x41')]:_0x19d330[_0xac14('0x3d')];if(_0x1329d9[_0xac14('0x3e')][_0xac14('0x4f')]){_0x520d37[_0xac14('0x55')]=[{'all':!![]}];}_0x520d37=_['merge']({},_0x520d37,_0x1329d9[_0xac14('0x4d')]);return db['OpenchannelAccount'][_0xac14('0x56')](_0x520d37)[_0xac14('0x1d')](handleEntityNotFound(_0x39f600,null))['then'](respondWithResult(_0x39f600,null))[_0xac14('0x57')](handleError(_0x39f600,null));};exports[_0xac14('0x58')]=function(_0x489d22,_0xf729fe){return db[_0xac14('0x4e')][_0xac14('0x58')](_0x489d22[_0xac14('0x59')],{})[_0xac14('0x1d')](function(_0x8dfae6){var _0x58e222=_0x489d22['user'][_0xac14('0x32')]({'plain':!![]});if(!_0x58e222)throw new Error(_0xac14('0x5a'));if(_0x58e222['role']==='user'){var _0xea4ae8=_0x8dfae6[_0xac14('0x32')]({'plain':!![]});var _0x51bc3c=_0xac14('0x5b');return db[_0xac14('0x5c')][_0xac14('0x56')]({'where':{'name':_0x51bc3c,'userProfileId':_0x58e222[_0xac14('0x5d')]},'raw':!![]})[_0xac14('0x1d')](function(_0x53f08d){if(_0x53f08d&&_0x53f08d[_0xac14('0x5e')]===0x0){return db['UserProfileResource'][_0xac14('0x58')]({'name':_0xea4ae8[_0xac14('0x34')],'resourceId':_0xea4ae8['id'],'type':_0x53f08d[_0xac14('0x34')],'sectionId':_0x53f08d['id']},{})[_0xac14('0x1d')](function(){return _0x8dfae6;});}else{return _0x8dfae6;}})[_0xac14('0x57')](function(_0x44d75d){logger[_0xac14('0x23')](_0xac14('0x5f'),_0x44d75d);throw _0x44d75d;});}return _0x8dfae6;})['then'](respondWithResult(_0xf729fe,0xc9))[_0xac14('0x57')](handleError(_0xf729fe,null));};exports['update']=function(_0x1aa2ad,_0x2b50e4){if(_0x1aa2ad['body']['id']){delete _0x1aa2ad['body']['id'];}return db[_0xac14('0x4e')][_0xac14('0x56')]({'where':{'id':_0x1aa2ad['params']['id']},'include':[{'model':db[_0xac14('0x36')],'as':_0xac14('0x37')}]})[_0xac14('0x1d')](handleEntityNotFound(_0x2b50e4,null))['then'](saveUpdates(_0x1aa2ad[_0xac14('0x59')],null))[_0xac14('0x1d')](respondWithResult(_0x2b50e4,null))[_0xac14('0x57')](handleError(_0x2b50e4,null));};exports[_0xac14('0x31')]=function(_0x50deae,_0x5ef94a){return db['OpenchannelAccount'][_0xac14('0x56')]({'where':{'id':_0x50deae[_0xac14('0x53')]['id']}})[_0xac14('0x1d')](handleEntityNotFound(_0x5ef94a,null))[_0xac14('0x1d')](removeEntity(_0x5ef94a,null))[_0xac14('0x57')](handleError(_0x5ef94a,null));};exports[_0xac14('0x60')]=function(_0x3e3ebc,_0x53b94a){return db[_0xac14('0x4e')][_0xac14('0x60')]()[_0xac14('0x1d')](respondWithResult(_0x53b94a,null))[_0xac14('0x57')](handleError(_0x53b94a,null));};exports['addDisposition']=function(_0x43064a,_0x4e20b5,_0x49e61c){if(_0x43064a[_0xac14('0x59')]['id']){delete _0x43064a[_0xac14('0x59')]['id'];}return db['OpenchannelAccount'][_0xac14('0x56')]({'where':{'id':_0x43064a[_0xac14('0x53')]['id']}})[_0xac14('0x1d')](handleEntityNotFound(_0x4e20b5,null))['then'](function(_0x4c431d){if(_0x4c431d){_0x43064a['body'][_0xac14('0x61')]=_0x4c431d['id'];return db[_0xac14('0x62')][_0xac14('0x58')](_0x43064a[_0xac14('0x59')]);}})[_0xac14('0x1d')](respondWithResult(_0x4e20b5,null))[_0xac14('0x57')](handleError(_0x4e20b5,null));};exports['getDispositions']=function(_0x49a715,_0x510ef2,_0x30664e){var _0x3eaad3={'raw':![],'where':{}};var _0xb5df87={};var _0x118b19={'count':0x0,'rows':[]};return db[_0xac14('0x4e')][_0xac14('0x63')]({'where':{'id':_0x49a715[_0xac14('0x53')]['id']}})[_0xac14('0x1d')](handleEntityNotFound(_0x510ef2,null))[_0xac14('0x1d')](function(_0x3e5c63){if(_0x3e5c63){_0xb5df87[_0xac14('0x3d')]=_[_0xac14('0x54')](db[_0xac14('0x62')][_0xac14('0x39')]);_0xb5df87['query']=_['keys'](_0x49a715[_0xac14('0x3e')]);_0xb5df87['filters']=_[_0xac14('0x40')](_0xb5df87[_0xac14('0x3d')],_0xb5df87[_0xac14('0x3e')]);_0x3eaad3[_0xac14('0x41')]=_['intersection'](_0xb5df87[_0xac14('0x3d')],qs['fields'](_0x49a715[_0xac14('0x3e')]['fields']));_0x3eaad3[_0xac14('0x41')]=_0x3eaad3[_0xac14('0x41')]['length']?_0x3eaad3[_0xac14('0x41')]:_0xb5df87[_0xac14('0x3d')];if(!_0x49a715[_0xac14('0x3e')][_0xac14('0x64')]('nolimit')){_0x3eaad3[_0xac14('0x45')]=qs['limit'](_0x49a715[_0xac14('0x3e')][_0xac14('0x45')]);_0x3eaad3[_0xac14('0x2a')]=qs[_0xac14('0x2a')](_0x49a715[_0xac14('0x3e')][_0xac14('0x2a')]);}_0x3eaad3[_0xac14('0x46')]=qs[_0xac14('0x47')](_0x49a715[_0xac14('0x3e')][_0xac14('0x47')]);_0x3eaad3[_0xac14('0x4a')]=qs[_0xac14('0x3f')](_[_0xac14('0x48')](_0x49a715[_0xac14('0x3e')],_0xb5df87[_0xac14('0x3f')]));_0x3eaad3[_0xac14('0x4a')][_0xac14('0x61')]=_0x3e5c63['id'];if(_0x49a715[_0xac14('0x3e')]['filter']){_0x3eaad3['where']=_['merge'](_0x3eaad3['where'],{'$or':_[_0xac14('0x38')](_0x3eaad3[_0xac14('0x41')],function(_0x4a079f){var _0x2897c1={};_0x2897c1[_0x4a079f]={'$like':'%'+_0x49a715[_0xac14('0x3e')]['filter']+'%'};return _0x2897c1;})});}_0x3eaad3=_['merge']({},_0x3eaad3,_0x49a715[_0xac14('0x4d')]);return db['Disposition'][_0xac14('0x29')]({'where':_0x3eaad3[_0xac14('0x4a')]})[_0xac14('0x1d')](function(_0x29bbce){_0x118b19['count']=_0x29bbce;if(_0x49a715['query']['includeAll']){_0x3eaad3[_0xac14('0x55')]=[{'all':!![]}];}return db[_0xac14('0x62')]['findAll'](_0x3eaad3);})[_0xac14('0x1d')](function(_0x4838c7){_0x118b19[_0xac14('0x51')]=_0x4838c7;return _0x118b19;});}})['then'](respondWithFilteredResult(_0x510ef2,_0x3eaad3))[_0xac14('0x57')](handleError(_0x510ef2,null));};exports[_0xac14('0x65')]=function(_0xea50d9,_0x7b795f,_0x2b06dc){return db[_0xac14('0x4e')]['find']({'where':{'id':_0xea50d9[_0xac14('0x53')]['id']}})['then'](handleEntityNotFound(_0x7b795f,null))[_0xac14('0x1d')](function(_0x468e88){if(_0x468e88){return _0x468e88[_0xac14('0x65')](_0xea50d9[_0xac14('0x3e')][_0xac14('0x66')]);}})[_0xac14('0x1d')](respondWithStatusCode(_0x7b795f,null))[_0xac14('0x57')](handleError(_0x7b795f,null));};exports[_0xac14('0x67')]=function(_0x42765e,_0x51972d,_0x847f2){if(_0x42765e[_0xac14('0x59')]['id']){delete _0x42765e[_0xac14('0x59')]['id'];}return db[_0xac14('0x4e')][_0xac14('0x56')]({'where':{'id':_0x42765e[_0xac14('0x53')]['id']}})[_0xac14('0x1d')](handleEntityNotFound(_0x51972d,null))[_0xac14('0x1d')](function(_0xc7a4c1){if(_0xc7a4c1){_0x42765e[_0xac14('0x59')][_0xac14('0x61')]=_0xc7a4c1['id'];return db[_0xac14('0x68')][_0xac14('0x58')](_0x42765e['body']);}})[_0xac14('0x1d')](respondWithResult(_0x51972d,null))[_0xac14('0x57')](handleError(_0x51972d,null));};exports[_0xac14('0x69')]=function(_0x597509,_0x12fbf5,_0x58b356){var _0x3c908f={'raw':![],'where':{}};var _0xd4dc64={};var _0x1289f4={'count':0x0,'rows':[]};return db[_0xac14('0x4e')][_0xac14('0x63')]({'where':{'id':_0x597509[_0xac14('0x53')]['id']}})[_0xac14('0x1d')](handleEntityNotFound(_0x12fbf5,null))[_0xac14('0x1d')](function(_0x2a09f9){if(_0x2a09f9){_0xd4dc64[_0xac14('0x3d')]=_[_0xac14('0x54')](db['CannedAnswer'][_0xac14('0x39')]);_0xd4dc64[_0xac14('0x3e')]=_['keys'](_0x597509[_0xac14('0x3e')]);_0xd4dc64[_0xac14('0x3f')]=_[_0xac14('0x40')](_0xd4dc64[_0xac14('0x3d')],_0xd4dc64['query']);_0x3c908f[_0xac14('0x41')]=_[_0xac14('0x40')](_0xd4dc64[_0xac14('0x3d')],qs[_0xac14('0x42')](_0x597509[_0xac14('0x3e')]['fields']));_0x3c908f['attributes']=_0x3c908f[_0xac14('0x41')][_0xac14('0x43')]?_0x3c908f[_0xac14('0x41')]:_0xd4dc64[_0xac14('0x3d')];if(!_0x597509[_0xac14('0x3e')][_0xac14('0x64')]('nolimit')){_0x3c908f['limit']=qs[_0xac14('0x45')](_0x597509[_0xac14('0x3e')][_0xac14('0x45')]);_0x3c908f[_0xac14('0x2a')]=qs['offset'](_0x597509[_0xac14('0x3e')][_0xac14('0x2a')]);}_0x3c908f[_0xac14('0x46')]=qs[_0xac14('0x47')](_0x597509[_0xac14('0x3e')][_0xac14('0x47')]);_0x3c908f[_0xac14('0x4a')]=qs[_0xac14('0x3f')](_[_0xac14('0x48')](_0x597509[_0xac14('0x3e')],_0xd4dc64['filters']));_0x3c908f[_0xac14('0x4a')]['OpenchannelAccountId']=_0x2a09f9['id'];if(_0x597509[_0xac14('0x3e')]['filter']){_0x3c908f[_0xac14('0x4a')]=_[_0xac14('0x4b')](_0x3c908f['where'],{'$or':_[_0xac14('0x38')](_0x3c908f[_0xac14('0x41')],function(_0x1e05de){var _0x4d0fd9={};_0x4d0fd9[_0x1e05de]={'$like':'%'+_0x597509[_0xac14('0x3e')]['filter']+'%'};return _0x4d0fd9;})});}_0x3c908f=_['merge']({},_0x3c908f,_0x597509[_0xac14('0x4d')]);return db[_0xac14('0x68')][_0xac14('0x29')]({'where':_0x3c908f['where']})[_0xac14('0x1d')](function(_0x1dd9bc){_0x1289f4[_0xac14('0x29')]=_0x1dd9bc;if(_0x597509[_0xac14('0x3e')][_0xac14('0x4f')]){_0x3c908f[_0xac14('0x55')]=[{'all':!![]}];}return db[_0xac14('0x68')][_0xac14('0x50')](_0x3c908f);})[_0xac14('0x1d')](function(_0x421197){_0x1289f4[_0xac14('0x51')]=_0x421197;return _0x1289f4;});}})[_0xac14('0x1d')](respondWithFilteredResult(_0x12fbf5,_0x3c908f))[_0xac14('0x57')](handleError(_0x12fbf5,null));};exports[_0xac14('0x6a')]=function(_0xeeeedf,_0x548936,_0x39e199){return db[_0xac14('0x4e')][_0xac14('0x56')]({'where':{'id':_0xeeeedf[_0xac14('0x53')]['id']}})[_0xac14('0x1d')](handleEntityNotFound(_0x548936,null))[_0xac14('0x1d')](function(_0x556883){if(_0x556883){return _0x556883[_0xac14('0x6a')](_0xeeeedf[_0xac14('0x3e')]['ids']);}})[_0xac14('0x1d')](respondWithStatusCode(_0x548936,null))[_0xac14('0x57')](handleError(_0x548936,null));};exports[_0xac14('0x6b')]=function(_0x474b4b,_0x3dbdf5,_0x2efe3d){var _0x19b4eb={'body':_0x474b4b[_0xac14('0x59')],'channel':_0xac14('0x6c')};var _0x27e338=[];var _0x54e166=[];var _0x29b622={};var _0x191dc7=![];return db[_0xac14('0x6d')]['describe']()['then'](function(_0x40153d){if(!_0x40153d){throw new db[(_0xac14('0x6e'))][(_0xac14('0x6f'))]('no\x20available\x20attributes');}_0x27e338=_[_0xac14('0x70')](_[_0xac14('0x54')](_0x40153d),[_0xac14('0x71'),_0xac14('0x72')]);_0x54e166=_[_0xac14('0x70')](_['keys'](_0x40153d),[_0xac14('0x71'),_0xac14('0x72'),_0xac14('0x73'),_0xac14('0x74')]);if(_0x474b4b[_0xac14('0x59')]['id']){delete _0x474b4b[_0xac14('0x59')]['id'];}if(_[_0xac14('0x75')](_0x474b4b[_0xac14('0x59')][_0xac14('0x76')])){throw new db[(_0xac14('0x6e'))][(_0xac14('0x6f'))](_0xac14('0x77'));}if(_[_0xac14('0x75')](_0x474b4b[_0xac14('0x59')][_0xac14('0x59')])||_0x474b4b[_0xac14('0x59')][_0xac14('0x59')]===''){throw new db[(_0xac14('0x6e'))][(_0xac14('0x6f'))](_0xac14('0x78'));}if(_['isNil'](_0x474b4b[_0xac14('0x59')][_0xac14('0x79')])){throw new db[(_0xac14('0x6e'))][(_0xac14('0x6f'))](_0xac14('0x7a')+_0x54e166);}if(!_[_0xac14('0x7b')](_0x54e166,_0x474b4b['body']['mapKey'])){throw new db[(_0xac14('0x6e'))][(_0xac14('0x6f'))](_0xac14('0x7c')+_0x54e166);}_0x29b622[_0x474b4b[_0xac14('0x59')][_0xac14('0x79')]]=_0x474b4b['body'][_0xac14('0x76')];})['then'](function(){return db['OpenchannelAccount']['find']({'where':{'id':_0x474b4b[_0xac14('0x53')]['id']},'include':[{'model':db[_0xac14('0x7d')],'as':_0xac14('0x7e'),'include':[{'model':db[_0xac14('0x6d')],'as':_0xac14('0x7f'),'where':_0x29b622,'limit':0x1,'order':[[_0xac14('0x72'),'DESC']]}]},{'model':db[_0xac14('0x80')],'as':_0xac14('0x81')}]});})[_0xac14('0x1d')](handleEntityNotFound(_0x3dbdf5,null))[_0xac14('0x1d')](function(_0x38aa49){if(_0x38aa49&&_0x38aa49[_0xac14('0x7e')]){_0x19b4eb[_0xac14('0x82')]=_0x38aa49;_0x19b4eb[_0xac14('0x83')]=_0x38aa49[_0xac14('0x81')];_0x19b4eb[_0xac14('0x84')]=_0x38aa49[_0xac14('0x7e')];_0x19b4eb[_0xac14('0x83')]=_[_0xac14('0x85')](_0x19b4eb[_0xac14('0x83')],[_0xac14('0x86')],['asc']);if(_0x19b4eb[_0xac14('0x82')]['Applications']){delete _0x19b4eb['account'][_0xac14('0x81')];}if(_0x19b4eb[_0xac14('0x82')][_0xac14('0x7e')]&&_0x19b4eb[_0xac14('0x82')][_0xac14('0x7e')]['Contacts'][_0xac14('0x43')]){return _0x19b4eb['account'][_0xac14('0x7e')][_0xac14('0x7f')][0x0];}var _0x4833ef=_[_0xac14('0x17')](_0x474b4b['body'],{'firstName':_0x474b4b['body']['from'],'ListId':_0x38aa49[_0xac14('0x74')]});_0x4833ef[_0x474b4b['body'][_0xac14('0x79')]]=_0x474b4b[_0xac14('0x59')]['from'];return db['CmContact'][_0xac14('0x58')](_0x4833ef,{'fields':_0x27e338,'raw':!![]});}})['then'](handleEntityNotFound(_0x3dbdf5,null))[_0xac14('0x1d')](function(_0x5a4af9){_0x19b4eb[_0xac14('0x87')]=_0x5a4af9;if(_0x5a4af9){var _0x2aff7f={'ContactId':_0x5a4af9['id'],'OpenchannelAccountId':_0x474b4b[_0xac14('0x53')]['id'],'from':(_0x5a4af9[_0xac14('0x88')]||'')+'\x20'+(_0x5a4af9[_0xac14('0x89')]||'')};var _0x2fe4b1={'OpenchannelAccountId':_0x474b4b[_0xac14('0x53')]['id'],'closed':![]};if(_0x474b4b[_0xac14('0x59')][_0xac14('0x8a')]){_0x2fe4b1['threadId']=_0x474b4b[_0xac14('0x59')]['threadId'];return db[_0xac14('0x8b')][_0xac14('0x56')]({'where':_0x2fe4b1})[_0xac14('0x1d')](function(_0x3e1d87){if(_0x3e1d87){return[_0x3e1d87,![]];}_0x2aff7f[_0xac14('0x8a')]=_0x474b4b[_0xac14('0x59')][_0xac14('0x8a')];_0x2aff7f['externalUrl']=_0x474b4b['body'][_0xac14('0x8c')];return db['OpenchannelInteraction']['create'](_0x2aff7f)['then'](function(_0x316905){return[_0x316905,!![]];});});}else{_0x2fe4b1['threadId']=null;}_0x2fe4b1['ContactId']=_0x5a4af9['id'];return db[_0xac14('0x8b')][_0xac14('0x56')]({'where':_0x2fe4b1})[_0xac14('0x1d')](function(_0x5d30f6){if(_0x5d30f6){return[_0x5d30f6,![]];}return db['OpenchannelInteraction']['create'](_0x2aff7f)[_0xac14('0x1d')](function(_0x4f71d2){return[_0x4f71d2,!![]];});});}})[_0xac14('0x8d')](function(_0x2f2761,_0x4821c9){if(_0x2f2761){_0x191dc7=_0x4821c9;if(!_0x4821c9){var _0x586c6f={'from':(_0x19b4eb[_0xac14('0x87')][_0xac14('0x88')]||'')+'\x20'+(_0x19b4eb[_0xac14('0x87')][_0xac14('0x89')]||'')};if(_0x474b4b[_0xac14('0x59')]['threadId']&&_0x474b4b[_0xac14('0x59')][_0xac14('0x8e')]&&_0x474b4b[_0xac14('0x59')][_0xac14('0x8a')]!=_0x474b4b[_0xac14('0x59')][_0xac14('0x8e')]){_0x586c6f[_0xac14('0x8a')]=_0x474b4b[_0xac14('0x59')][_0xac14('0x8e')];}return _0x2f2761[_0xac14('0x30')](_0x586c6f);}else{return _0x2f2761;}}})['then'](function(_0x17baa5){_0x19b4eb['interaction']=_0x17baa5['get']({'plain':!![]});_0x19b4eb[_0xac14('0x8f')][_0xac14('0x90')]=_0x191dc7;if(_0x19b4eb['interaction']['created']){if(_0x19b4eb[_0xac14('0x82')][_0xac14('0x91')]){_0x19b4eb['applications'][_0xac14('0x92')]({'id':0x0,'priority':_0x19b4eb[_0xac14('0x83')][_0xac14('0x43')]+0x1,'app':'close','appdata':_0xac14('0x93'),'interval':_0xac14('0x94')});}}return db[_0xac14('0x95')][_0xac14('0x58')]({'body':_0x474b4b['body'][_0xac14('0x59')],'OpenchannelAccountId':_0x474b4b['params']['id'],'OpenchannelInteractionId':_0x17baa5['id'],'direction':'in','ContactId':_0x19b4eb[_0xac14('0x87')]['id'],'AttachmentId':_0x474b4b[_0xac14('0x59')]['AttachmentId']});})[_0xac14('0x1d')](function(_0x33325b){_0x19b4eb[_0xac14('0x25')]=_0x33325b;if(!_0x19b4eb[_0xac14('0x8f')][_0xac14('0x96')])return;return db[_0xac14('0x97')][_0xac14('0x56')]({'attributes':['id',_0xac14('0x34')],'where':{'id':_0x19b4eb[_0xac14('0x8f')][_0xac14('0x96')]}});})[_0xac14('0x1d')](function(_0x50a182){if(_0x50a182){_0x19b4eb[_0xac14('0x83')][_0xac14('0x98')]({'id':0x0,'priority':0x0,'app':_0xac14('0x99'),'appdata':_0x50a182['name']+','+(_0x19b4eb['account'][_0xac14('0x9a')]||0xa),'interval':_0xac14('0x94')});}if(!_0x19b4eb[_0xac14('0x8f')][_0xac14('0x9b')])return;return db[_0xac14('0x9c')][_0xac14('0x56')]({'attributes':['id',_0xac14('0x34')],'where':{'id':_0x19b4eb[_0xac14('0x8f')][_0xac14('0x9b')]}});})[_0xac14('0x1d')](function(_0x43d55c){if(_0x43d55c){_0x19b4eb[_0xac14('0x83')][_0xac14('0x98')]({'id':0x0,'priority':0x1,'app':_0xac14('0x9d'),'appdata':_0x43d55c[_0xac14('0x34')]+','+(_0x19b4eb['account'][_0xac14('0x9e')]||0x12c),'interval':_0xac14('0x94')});}return respondWithRpcPromise(_0xac14('0x9f'),'startRouting',_0x19b4eb);})[_0xac14('0x1d')](function(_0x5be1c9){respondWithRpcPromise(_0xac14('0xa0'),_0xac14('0xa0'),{'event':_0xac14('0x6b'),'message':_0x5be1c9},client9002);return _0x5be1c9;})['then'](respondWithResult(_0x3dbdf5,null))[_0xac14('0x57')](handleError(_0x3dbdf5,null));};exports[_0xac14('0xa1')]=function(_0xa5f73d,_0x51acc5){var _0xb7ffbb=_0xa5f73d[_0xac14('0x53')]['id'];var _0x9fefdf=_0xa5f73d[_0xac14('0x59')];var _0x29bc35=0xc8;var _0x4b72ff=null;return db[_0xac14('0xa2')][_0xac14('0xa3')]({'isolationLevel':db['sequelize']['Transaction'][_0xac14('0xa4')][_0xac14('0xa5')]},function(_0x5ba423){return db[_0xac14('0x4e')][_0xac14('0x63')]({'where':{'id':_0xb7ffbb},'transaction':_0x5ba423})['then'](function(_0x251ee1){if(_0x251ee1){return db['OpenchannelApplication'][_0xac14('0x31')]({'where':{'OpenchannelAccountId':_0xb7ffbb},'transaction':_0x5ba423})['then'](function(){var _0x1fbaa5=_['map'](_0x9fefdf,function(_0x27cf63){_0x27cf63[_0xac14('0x61')]=_0xb7ffbb;return _0x27cf63;});return db[_0xac14('0x80')]['bulkCreate'](_0x1fbaa5,{'transaction':_0x5ba423});});}else{_0x29bc35=0x194;_0x4b72ff=[];}});})[_0xac14('0x1d')](function(){if(_0x29bc35!==0x194){return db[_0xac14('0x80')][_0xac14('0xa6')]({'where':{'OpenchannelAccountId':_0xb7ffbb},'order':_0xac14('0x86')})[_0xac14('0x1d')](function(_0x57a253){_0x4b72ff=_0x57a253;});}})[_0xac14('0x57')](function(_0x298dd8){_0x29bc35=0x1f4;logger[_0xac14('0x23')](_0x298dd8['stack']);if(_0x298dd8[_0xac14('0x34')]){delete _0x298dd8[_0xac14('0x34')];}_0x4b72ff=_0x298dd8;})[_0xac14('0xa7')](function(){if(_0x4b72ff===null){_0x51acc5[_0xac14('0x26')](_0x29bc35);}else{if(_0x29bc35===0x1f4){_0x51acc5[_0xac14('0x27')](_0x29bc35)[_0xac14('0xa8')](_0x4b72ff);}else{_0x51acc5['status'](_0x29bc35)[_0xac14('0xa9')](_0x4b72ff);}}});};exports[_0xac14('0xaa')]=function(_0x28d564,_0x317efc,_0x4c8239){var _0x3eed7a={};var _0x4ce697={};var _0x5ea004;var _0x53a932;return db['OpenchannelAccount'][_0xac14('0x63')]({'where':{'id':_0x28d564[_0xac14('0x53')]['id']}})[_0xac14('0x1d')](handleEntityNotFound(_0x317efc,null))[_0xac14('0x1d')](function(_0x1d4820){if(_0x1d4820){_0x5ea004=_0x1d4820;_0x4ce697[_0xac14('0x3d')]=_['keys'](db[_0xac14('0x80')]['rawAttributes']);_0x4ce697[_0xac14('0x3e')]=_[_0xac14('0x54')](_0x28d564[_0xac14('0x3e')]);_0x4ce697[_0xac14('0x3f')]=_[_0xac14('0x40')](_0x4ce697[_0xac14('0x3d')],_0x4ce697['query']);_0x3eed7a['attributes']=_['intersection'](_0x4ce697[_0xac14('0x3d')],qs['fields'](_0x28d564[_0xac14('0x3e')]['fields']));_0x3eed7a[_0xac14('0x41')]=_0x3eed7a[_0xac14('0x41')][_0xac14('0x43')]?_0x3eed7a[_0xac14('0x41')]:_0x4ce697[_0xac14('0x3d')];_0x3eed7a[_0xac14('0x46')]=qs[_0xac14('0x47')](_0x28d564[_0xac14('0x3e')]['sort']);_0x3eed7a[_0xac14('0x4a')]=qs[_0xac14('0x3f')](_['pick'](_0x28d564['query'],_0x4ce697[_0xac14('0x3f')]));if(_0x28d564[_0xac14('0x3e')][_0xac14('0x49')]){_0x3eed7a[_0xac14('0x4a')]=_[_0xac14('0x4b')](_0x3eed7a['where'],{'$or':_[_0xac14('0x38')](_0x3eed7a[_0xac14('0x41')],function(_0x227b1a){var _0x42017d={};_0x42017d[_0x227b1a]={'$like':'%'+_0x28d564['query']['filter']+'%'};return _0x42017d;})});}_0x3eed7a=_[_0xac14('0x4b')]({},_0x3eed7a,_0x28d564[_0xac14('0x4d')]);return _0x5ea004[_0xac14('0xaa')](_0x3eed7a);}})[_0xac14('0x1d')](function(_0x400daa){if(_0x400daa){_0x53a932=_0x400daa[_0xac14('0x43')];if(!_0x28d564[_0xac14('0x3e')][_0xac14('0x64')](_0xac14('0x44'))){_0x3eed7a[_0xac14('0x45')]=qs[_0xac14('0x45')](_0x28d564[_0xac14('0x3e')][_0xac14('0x45')]);_0x3eed7a['offset']=qs[_0xac14('0x2a')](_0x28d564['query'][_0xac14('0x2a')]);}return _0x5ea004['getApplications'](_0x3eed7a);}})[_0xac14('0x1d')](function(_0x43fc35){if(_0x43fc35){return _0x43fc35?{'count':_0x53a932,'rows':_0x43fc35}:null;}})[_0xac14('0x1d')](respondWithResult(_0x317efc,null))[_0xac14('0x57')](handleError(_0x317efc,null));};exports['getInteractions']=function(_0x48c238,_0x3b5923,_0x493163){var _0x365cca={'raw':![],'where':{}};var _0x8e0c4f={};var _0x49fe68={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0xac14('0x63')]({'where':{'id':_0x48c238['params']['id']}})[_0xac14('0x1d')](handleEntityNotFound(_0x3b5923,null))[_0xac14('0x1d')](function(_0x3d0667){if(_0x3d0667){_0x8e0c4f['model']=_['keys'](db[_0xac14('0x8b')][_0xac14('0x39')]);_0x8e0c4f['query']=_['keys'](_0x48c238['query']);_0x8e0c4f[_0xac14('0x3f')]=_[_0xac14('0x40')](_0x8e0c4f[_0xac14('0x3d')],_0x8e0c4f[_0xac14('0x3e')]);_0x365cca['attributes']=_[_0xac14('0x40')](_0x8e0c4f[_0xac14('0x3d')],qs['fields'](_0x48c238['query'][_0xac14('0x42')]));_0x365cca[_0xac14('0x41')]=_0x365cca['attributes'][_0xac14('0x43')]?_0x365cca[_0xac14('0x41')]:_0x8e0c4f['model'];if(!_0x48c238[_0xac14('0x3e')][_0xac14('0x64')](_0xac14('0x44'))){_0x365cca['limit']=qs[_0xac14('0x45')](_0x48c238[_0xac14('0x3e')][_0xac14('0x45')]);_0x365cca[_0xac14('0x2a')]=qs[_0xac14('0x2a')](_0x48c238[_0xac14('0x3e')][_0xac14('0x2a')]);}_0x365cca[_0xac14('0x46')]=qs[_0xac14('0x47')](_0x48c238[_0xac14('0x3e')][_0xac14('0x47')]);_0x365cca['where']=qs[_0xac14('0x3f')](_[_0xac14('0x48')](_0x48c238['query'],_0x8e0c4f[_0xac14('0x3f')]));_0x365cca[_0xac14('0x4a')][_0xac14('0x61')]=_0x3d0667['id'];if(_0x48c238['query'][_0xac14('0x49')]){_0x365cca[_0xac14('0x4a')]=_[_0xac14('0x4b')](_0x365cca[_0xac14('0x4a')],{'$or':_[_0xac14('0x38')](_0x365cca['attributes'],function(_0x16bb52){var _0xb1289c={};_0xb1289c[_0x16bb52]={'$like':'%'+_0x48c238[_0xac14('0x3e')][_0xac14('0x49')]+'%'};return _0xb1289c;})});}_0x365cca=_[_0xac14('0x4b')]({},_0x365cca,_0x48c238[_0xac14('0x4d')]);return db[_0xac14('0x8b')][_0xac14('0x29')]({'where':_0x365cca['where']})['then'](function(_0x2e3262){_0x49fe68[_0xac14('0x29')]=_0x2e3262;if(_0x48c238[_0xac14('0x3e')][_0xac14('0x4f')]){_0x365cca[_0xac14('0x55')]=[{'model':db['CmContact'],'as':_0xac14('0xab'),'required':![]},{'model':db[_0xac14('0x97')],'as':_0xac14('0xac'),'attributes':[_0xac14('0x34'),_0xac14('0xad'),_0xac14('0xae')],'required':![]},{'model':db[_0xac14('0xaf')],'as':_0xac14('0xb0'),'attributes':['id',_0xac14('0x34'),_0xac14('0xb1')],'where':_0x48c238[_0xac14('0x3e')]['tag']?{'id':_0x48c238[_0xac14('0x3e')][_0xac14('0xb2')]}:undefined,'required':_0x48c238['query'][_0xac14('0xb2')]?!![]:![]}];}return db[_0xac14('0x8b')][_0xac14('0x50')](_0x365cca);})['then'](function(_0x238e65){_0x49fe68[_0xac14('0x51')]=_0x238e65;return _0x49fe68;});}})['then'](respondWithFilteredResult(_0x3b5923,_0x365cca))[_0xac14('0x57')](handleError(_0x3b5923,null));};exports[_0xac14('0xb3')]=function(_0x1cd0ab,_0x2d9cab,_0x42d252){return db[_0xac14('0x4e')][_0xac14('0x56')]({'where':{'id':_0x1cd0ab['params']['id']}})[_0xac14('0x1d')](handleEntityNotFound(_0x2d9cab,null))[_0xac14('0x1d')](function(_0x3bacbd){if(_0x3bacbd){return _0x3bacbd['addAgents'](_0x1cd0ab[_0xac14('0x59')][_0xac14('0x66')],_['omit'](_0x1cd0ab[_0xac14('0x59')],[_0xac14('0x66'),'id'])||{})[_0xac14('0x8d')](function(_0x5375d3){for(var _0x9fe6c1=0x0;_0x9fe6c1<_0x1cd0ab[_0xac14('0x59')][_0xac14('0x66')][_0xac14('0x43')];_0x9fe6c1+=0x1){socket[_0xac14('0xb4')](_0xac14('0xb5'),{'UserId':Number(_0x1cd0ab['body']['ids'][_0x9fe6c1]),'OpenchannelAccountId':Number(_0x1cd0ab[_0xac14('0x53')]['id'])});}return _0x5375d3;});}})[_0xac14('0x1d')](respondWithResult(_0x2d9cab,null))['catch'](handleError(_0x2d9cab,null));};exports[_0xac14('0xb6')]=function(_0x334d01,_0xddff0b,_0x56f162){return db['OpenchannelAccount']['find']({'where':{'id':_0x334d01['params']['id']}})[_0xac14('0x1d')](handleEntityNotFound(_0xddff0b,null))[_0xac14('0x1d')](function(_0xd16ba7){if(_0xd16ba7){return _0xd16ba7[_0xac14('0xb6')](_0x334d01[_0xac14('0x3e')]['ids'])[_0xac14('0x1d')](function(){if(_[_0xac14('0xb7')](_0x334d01[_0xac14('0x3e')]['ids'])){for(var _0x53ef8d=0x0;_0x53ef8d<_0x334d01[_0xac14('0x3e')]['ids'][_0xac14('0x43')];_0x53ef8d+=0x1){socket[_0xac14('0xb4')](_0xac14('0xb8'),{'UserId':Number(_0x334d01[_0xac14('0x3e')]['ids'][_0x53ef8d]),'OpenchannelAccountId':Number(_0x334d01[_0xac14('0x53')]['id'])});}}else{socket[_0xac14('0xb4')](_0xac14('0xb8'),{'UserId':Number(_0x334d01['query'][_0xac14('0x66')]),'OpenchannelAccountId':Number(_0x334d01[_0xac14('0x53')]['id'])});}});}})[_0xac14('0x1d')](respondWithStatusCode(_0xddff0b,null))[_0xac14('0x57')](handleError(_0xddff0b,null));};exports['getAgents']=function(_0x591694,_0x4551ea,_0xc62481){var _0x5c6321={};var _0xa24309={};var _0x220721;var _0x53246e;return db['OpenchannelAccount'][_0xac14('0x63')]({'where':{'id':_0x591694[_0xac14('0x53')]['id']}})[_0xac14('0x1d')](handleEntityNotFound(_0x4551ea,null))[_0xac14('0x1d')](function(_0x56166f){if(_0x56166f){_0x220721=_0x56166f;_0xa24309[_0xac14('0x3d')]=_[_0xac14('0x54')](db['User'][_0xac14('0x39')]);_0xa24309[_0xac14('0x3e')]=_[_0xac14('0x54')](_0x591694[_0xac14('0x3e')]);_0xa24309[_0xac14('0x3f')]=_[_0xac14('0x40')](_0xa24309[_0xac14('0x3d')],_0xa24309[_0xac14('0x3e')]);_0x5c6321[_0xac14('0x41')]=_['intersection'](_0xa24309[_0xac14('0x3d')],qs[_0xac14('0x42')](_0x591694[_0xac14('0x3e')][_0xac14('0x42')]));_0x5c6321['attributes']=_0x5c6321[_0xac14('0x41')][_0xac14('0x43')]?_0x5c6321[_0xac14('0x41')]:_0xa24309[_0xac14('0x3d')];_0x5c6321[_0xac14('0x46')]=qs[_0xac14('0x47')](_0x591694['query'][_0xac14('0x47')]);_0x5c6321[_0xac14('0x4a')]=qs['filters'](_[_0xac14('0x48')](_0x591694['query'],_0xa24309[_0xac14('0x3f')]));if(_0x591694[_0xac14('0x3e')][_0xac14('0x49')]){_0x5c6321[_0xac14('0x4a')]=_[_0xac14('0x4b')](_0x5c6321[_0xac14('0x4a')],{'$or':_[_0xac14('0x38')](_0x5c6321['attributes'],function(_0x1450c6){var _0x46e3c2={};_0x46e3c2[_0x1450c6]={'$like':'%'+_0x591694[_0xac14('0x3e')][_0xac14('0x49')]+'%'};return _0x46e3c2;})});}_0x5c6321=_[_0xac14('0x4b')]({},_0x5c6321,_0x591694[_0xac14('0x4d')]);return _0x220721['getAgents'](_0x5c6321);}})[_0xac14('0x1d')](function(_0x4fc522){if(_0x4fc522){_0x53246e=_0x4fc522[_0xac14('0x43')];if(!_0x591694['query'][_0xac14('0x64')](_0xac14('0x44'))){_0x5c6321[_0xac14('0x45')]=qs[_0xac14('0x45')](_0x591694[_0xac14('0x3e')][_0xac14('0x45')]);_0x5c6321[_0xac14('0x2a')]=qs[_0xac14('0x2a')](_0x591694[_0xac14('0x3e')][_0xac14('0x2a')]);}return _0x220721[_0xac14('0xb9')](_0x5c6321);}})[_0xac14('0x1d')](function(_0x5e539f){if(_0x5e539f){return _0x5e539f?{'count':_0x53246e,'rows':_0x5e539f}:null;}})[_0xac14('0x1d')](respondWithResult(_0x4551ea,null))[_0xac14('0x57')](handleError(_0x4551ea,null));};exports['send']=function(_0xa2d389,_0x3240b5,_0x5132b0){var _0x22471b,_0x146588,_0x400498;if(_[_0xac14('0x75')](_0xa2d389['body'][_0xac14('0x59')])||_0xa2d389[_0xac14('0x59')][_0xac14('0x59')]===''){throw new db['Sequelize']['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xac14('0x75')](_0xa2d389[_0xac14('0x59')]['to'])){}_0x22471b=_0xa2d389[_0xac14('0x59')]['to'];return db[_0xac14('0x4e')][_0xac14('0x63')]({'where':{'id':_0xa2d389[_0xac14('0x53')]['id']}})[_0xac14('0x1d')](handleEntityNotFound(_0x3240b5,null))[_0xac14('0x1d')](function(_0x1c6024){if(_0x1c6024){return db[_0xac14('0x4e')][_0xac14('0x56')]({'where':{'id':_0x1c6024['id']},'include':[{'model':db[_0xac14('0x7d')],'as':'List','include':[{'model':db['CmContact'],'as':_0xac14('0x7f'),'where':{[_0x1c6024[_0xac14('0x79')]]:_0x22471b},'limit':0x1,'order':[['updatedAt','DESC']]}]}]})[_0xac14('0x1d')](handleEntityNotFound(_0x3240b5,null))[_0xac14('0x1d')](function(_0x11df0e){if(_0x11df0e&&_0x11df0e['List']){_0x146588=_0x11df0e['get']({'plain':!![]});if(_0x146588[_0xac14('0x7e')]&&_0x146588['List']['Contacts']['length']){return _0x146588['List'][_0xac14('0x7f')][0x0];}return db[_0xac14('0x6d')]['create'](_[_0xac14('0x17')](_0xa2d389[_0xac14('0x59')],{'firstName':_0x22471b,[_0x11df0e[_0xac14('0x79')]]:_0x22471b,'phone':_0x22471b,'ListId':_0x146588[_0xac14('0x74')]}));}})[_0xac14('0x1d')](handleEntityNotFound(_0x3240b5,null))[_0xac14('0x1d')](function(_0x4cb880){if(_0x4cb880){_0x400498=_0x4cb880;return db[_0xac14('0x8b')][_0xac14('0x56')]({'where':{'ContactId':_0x400498['id'],'closed':![],'OpenchannelAccountId':_0x146588['id']}})['then'](function(_0x2a8fb4){if(_0x2a8fb4){return[_0x2a8fb4,![]];}return db[_0xac14('0x8b')]['create']({'UserId':_0xa2d389['user']['id'],'ContactId':_0x400498['id'],'OpenchannelAccountId':_0x146588['id'],'lastMsgDirection':_0xac14('0xba'),'firstMsgDirection':'out','Messages':[_[_0xac14('0x4b')](_0xa2d389[_0xac14('0x59')],{'read':![],'body':_0xa2d389[_0xac14('0x59')][_0xac14('0x59')],'OpenchannelAccountId':_0x146588['id'],'UserId':_0xa2d389[_0xac14('0xbb')]['id'],'ContactId':_0x400498['id']})]},{'include':[{'model':db[_0xac14('0x95')],'as':_0xac14('0xbc')}]})['then'](function(_0x1870c1){return[_0x1870c1,!![]];});});}})[_0xac14('0x8d')](function(_0x2489ac,_0x371fe2){if(_0x371fe2){return _0x2489ac;}return db[_0xac14('0x95')][_0xac14('0x58')](_['merge'](_0xa2d389[_0xac14('0x59')],{'read':![],'body':_0xa2d389[_0xac14('0x59')][_0xac14('0x59')],'OpenchannelAccountId':_0x146588['id'],'OpenchannelInteractionId':_0x2489ac['id'],'UserId':_0xa2d389[_0xac14('0xbb')]['id'],'ContactId':_0x400498['id']}))[_0xac14('0x1d')](function(_0x31ecb2){_0x2489ac[_0xac14('0xbd')][_0xac14('0xbc')]=[];_0x2489ac['dataValues']['Messages'][_0xac14('0x92')](_0x31ecb2[_0xac14('0xbd')]);return _0x2489ac;});});}})['then'](respondWithResult(_0x3240b5,null))['catch'](handleError(_0x3240b5,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index e475d7f..6c76009 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 _0x4522=['OpenchannelAccount','setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports'];(function(_0x344c09,_0x210de4){var _0x270e15=function(_0x26f910){while(--_0x26f910){_0x344c09['push'](_0x344c09['shift']());}};_0x270e15(++_0x210de4);}(_0x4522,0x1a0));var _0x2452=function(_0x168a88,_0x3cc193){_0x168a88=_0x168a88-0x0;var _0x40943b=_0x4522[_0x168a88];return _0x40943b;};'use strict';var EventEmitter=require('events');var OpenchannelAccount=require('../../mysqldb')['db'][_0x2452('0x0')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x2452('0x1')](0x0);var events={'afterCreate':_0x2452('0x2'),'afterUpdate':'update','afterDestroy':_0x2452('0x3')};function emitEvent(_0x1fdf5b){return function(_0x35e30a,_0x2f21dc,_0x34ff44){OpenchannelAccountEvents[_0x2452('0x4')](_0x1fdf5b+':'+_0x35e30a['id'],_0x35e30a);OpenchannelAccountEvents[_0x2452('0x4')](_0x1fdf5b,_0x35e30a);_0x34ff44(null);};}for(var e in events){if(events[_0x2452('0x5')](e)){var event=events[e];OpenchannelAccount[_0x2452('0x6')](e,emitEvent(event));}}module[_0x2452('0x7')]=OpenchannelAccountEvents; \ No newline at end of file +var _0x702d=['setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelAccount'];(function(_0x20bf68,_0x1e6a1f){var _0x5e407f=function(_0x1ab16b){while(--_0x1ab16b){_0x20bf68['push'](_0x20bf68['shift']());}};_0x5e407f(++_0x1e6a1f);}(_0x702d,0x147));var _0xd702=function(_0x145333,_0x324e72){_0x145333=_0x145333-0x0;var _0x82046a=_0x702d[_0x145333];return _0x82046a;};'use strict';var EventEmitter=require(_0xd702('0x0'));var OpenchannelAccount=require(_0xd702('0x1'))['db'][_0xd702('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0xd702('0x3')](0x0);var events={'afterCreate':_0xd702('0x4'),'afterUpdate':'update','afterDestroy':_0xd702('0x5')};function emitEvent(_0xebbd7c){return function(_0x27b260,_0x1c5a32,_0x481ee0){OpenchannelAccountEvents[_0xd702('0x6')](_0xebbd7c+':'+_0x27b260['id'],_0x27b260);OpenchannelAccountEvents['emit'](_0xebbd7c,_0x27b260);_0x481ee0(null);};}for(var e in events){if(events[_0xd702('0x7')](e)){var event=events[e];OpenchannelAccount[_0xd702('0x8')](e,emitEvent(event));}}module[_0xd702('0x9')]=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index ab521d5..e68d6a1 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(_0x55d654,_0x56f88e){var _0x26e7d8=function(_0x1bc1d6){while(--_0x1bc1d6){_0x55d654['push'](_0x55d654['shift']());}};_0x26e7d8(++_0x56f88e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xa9e0[_0x30ae5e];return _0x1f2e93;};'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(_0x5e8e14,_0x371ff8){var _0x58b966=function(_0x4c1823){while(--_0x4c1823){_0x5e8e14['push'](_0x5e8e14['shift']());}};_0x58b966(++_0x371ff8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0xa9e0[_0x47e7cb];return _0x2a8874;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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 7cd43cc..c3f4d29 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 _0x5ec6=['stringify','error','code','message','info','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','../../config/environment','client','http','defaults','redis','socket.io-emitter','./openchannelAccount.socket','then','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','OpenchannelAccount,\x20%s,\x20%s,\x20%s'];(function(_0x38aeea,_0x57522a){var _0x5e8d2c=function(_0xff08ce){while(--_0xff08ce){_0x38aeea['push'](_0x38aeea['shift']());}};_0x5e8d2c(++_0x57522a);}(_0x5ec6,0x7f));var _0x65ec=function(_0x5ea7c6,_0xdfb668){_0x5ea7c6=_0x5ea7c6-0x0;var _0x1eac37=_0x5ec6[_0x5ea7c6];return _0x1eac37;};'use strict';var _=require(_0x65ec('0x0'));var util=require(_0x65ec('0x1'));var moment=require(_0x65ec('0x2'));var BPromise=require('bluebird');var rs=require(_0x65ec('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x65ec('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x65ec('0x5'))('rpc');var config=require(_0x65ec('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x65ec('0x7')][_0x65ec('0x8')]({'port':0x232a});config['redis']=_[_0x65ec('0x9')](config[_0x65ec('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x65ec('0xb'))(new Redis(config[_0x65ec('0xa')]));require(_0x65ec('0xc'))['register'](socket);function respondWithRpcPromise(_0x49aacd,_0x3cf126,_0x5e78f8){return new BPromise(function(_0x136928,_0x28fe68){return client['request'](_0x49aacd,_0x5e78f8)[_0x65ec('0xd')](function(_0xd7cf80){logger['info'](_0x65ec('0xe'),_0x3cf126,_0x65ec('0xf'));logger['debug'](_0x65ec('0x10'),_0x3cf126,_0x65ec('0xf'),JSON[_0x65ec('0x11')](_0xd7cf80));if(_0xd7cf80[_0x65ec('0x12')]){if(_0xd7cf80[_0x65ec('0x12')][_0x65ec('0x13')]===0x1f4){logger[_0x65ec('0x12')](_0x65ec('0xe'),_0x3cf126,_0xd7cf80['error'][_0x65ec('0x14')]);return _0x28fe68(_0xd7cf80[_0x65ec('0x12')][_0x65ec('0x14')]);}logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x3cf126,_0xd7cf80[_0x65ec('0x12')][_0x65ec('0x14')]);return _0x136928(_0xd7cf80[_0x65ec('0x12')]['message']);}else{logger[_0x65ec('0x15')](_0x65ec('0xe'),_0x3cf126,_0x65ec('0xf'));_0x136928(_0xd7cf80[_0x65ec('0x16')][_0x65ec('0x14')]);}})[_0x65ec('0x17')](function(_0x37c494){logger[_0x65ec('0x12')](_0x65ec('0xe'),_0x3cf126,_0x37c494);_0x28fe68(_0x37c494);});});} \ No newline at end of file +var _0xed3c=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','localhost','register','request','then','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','util','moment'];(function(_0x44623,_0x156b21){var _0xbe3392=function(_0x49ad7f){while(--_0x49ad7f){_0x44623['push'](_0x44623['shift']());}};_0xbe3392(++_0x156b21);}(_0xed3c,0x1a6));var _0xced3=function(_0xa25342,_0x24522b){_0xa25342=_0xa25342-0x0;var _0x52be43=_0xed3c[_0xa25342];return _0x52be43;};'use strict';var _=require(_0xced3('0x0'));var util=require(_0xced3('0x1'));var moment=require(_0xced3('0x2'));var BPromise=require(_0xced3('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xced3('0x4'));var db=require(_0xced3('0x5'))['db'];var utils=require(_0xced3('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xced3('0x7'));var jayson=require(_0xced3('0x8'));var client=jayson[_0xced3('0x9')][_0xced3('0xa')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0xced3('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./openchannelAccount.socket')[_0xced3('0xc')](socket);function respondWithRpcPromise(_0x321c42,_0x3e5a04,_0x12612f){return new BPromise(function(_0x1cb639,_0x5934b2){return client[_0xced3('0xd')](_0x321c42,_0x12612f)[_0xced3('0xe')](function(_0x3da0ff){logger['info'](_0xced3('0xf'),_0x3e5a04,_0xced3('0x10'));logger[_0xced3('0x11')](_0xced3('0x12'),_0x3e5a04,_0xced3('0x10'),JSON[_0xced3('0x13')](_0x3da0ff));if(_0x3da0ff[_0xced3('0x14')]){if(_0x3da0ff['error'][_0xced3('0x15')]===0x1f4){logger['error'](_0xced3('0xf'),_0x3e5a04,_0x3da0ff[_0xced3('0x14')][_0xced3('0x16')]);return _0x5934b2(_0x3da0ff[_0xced3('0x14')]['message']);}logger[_0xced3('0x14')](_0xced3('0xf'),_0x3e5a04,_0x3da0ff['error'][_0xced3('0x16')]);return _0x1cb639(_0x3da0ff[_0xced3('0x14')][_0xced3('0x16')]);}else{logger[_0xced3('0x17')]('OpenchannelAccount,\x20%s,\x20%s',_0x3e5a04,_0xced3('0x10'));_0x1cb639(_0x3da0ff['result'][_0xced3('0x16')]);}})[_0xced3('0x18')](function(_0x32c402){logger[_0xced3('0x14')](_0xced3('0xf'),_0x3e5a04,_0x32c402);_0x5934b2(_0x32c402);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index ab4892a..1d54f85 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 _0x9bde=['openchannelAccount:','save','update','emit','removeListener','register','length'];(function(_0x5b26cb,_0x527ab0){var _0x563d12=function(_0x472b38){while(--_0x472b38){_0x5b26cb['push'](_0x5b26cb['shift']());}};_0x563d12(++_0x527ab0);}(_0x9bde,0xe1));var _0xe9bd=function(_0x4f698e,_0x9ad3e8){_0x4f698e=_0x4f698e-0x0;var _0x57f818=_0x9bde[_0x4f698e];return _0x57f818;};'use strict';var OpenchannelAccountEvents=require('./openchannelAccount.events');var events=[_0xe9bd('0x0'),'remove',_0xe9bd('0x1')];function createListener(_0x4c63ca,_0x51786f){return function(_0x3005aa){_0x51786f[_0xe9bd('0x2')](_0x4c63ca,_0x3005aa);};}function removeListener(_0x1c1b34,_0x10822d){return function(){OpenchannelAccountEvents[_0xe9bd('0x3')](_0x1c1b34,_0x10822d);};}exports[_0xe9bd('0x4')]=function(_0x4fd7b8){for(var _0x4763e9=0x0,_0x5f18fe=events[_0xe9bd('0x5')];_0x4763e9<_0x5f18fe;_0x4763e9++){var _0xa66ae2=events[_0x4763e9];var _0x2d5c75=createListener(_0xe9bd('0x6')+_0xa66ae2,_0x4fd7b8);OpenchannelAccountEvents['on'](_0xa66ae2,_0x2d5c75);}}; \ No newline at end of file +var _0x00b3=['update','removeListener','register','save','remove'];(function(_0x1d855f,_0x230996){var _0x357098=function(_0x4591a9){while(--_0x4591a9){_0x1d855f['push'](_0x1d855f['shift']());}};_0x357098(++_0x230996);}(_0x00b3,0x17a));var _0x300b=function(_0x2ca1c4,_0x22186a){_0x2ca1c4=_0x2ca1c4-0x0;var _0x53077b=_0x00b3[_0x2ca1c4];return _0x53077b;};'use strict';var OpenchannelAccountEvents=require('./openchannelAccount.events');var events=[_0x300b('0x0'),_0x300b('0x1'),_0x300b('0x2')];function createListener(_0x2562dd,_0x59cc42){return function(_0x2fbccc){_0x59cc42['emit'](_0x2562dd,_0x2fbccc);};}function removeListener(_0x245c32,_0x524b8d){return function(){OpenchannelAccountEvents[_0x300b('0x3')](_0x245c32,_0x524b8d);};}exports[_0x300b('0x4')]=function(_0x3a8c64){for(var _0x10b0a2=0x0,_0x5af470=events['length'];_0x10b0a2<_0x5af470;_0x10b0a2++){var _0x30b3fe=events[_0x10b0a2];var _0x590c4d=createListener('openchannelAccount:'+_0x30b3fe,_0x3a8c64);OpenchannelAccountEvents['on'](_0x30b3fe,_0x590c4d);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index c108707..cda6758 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 _0x7e13=['connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','get','/:id','show','post','isAuthenticated','create','put','update','delete','destroy','exports','util'];(function(_0x243b59,_0x3f9495){var _0x3e1676=function(_0x354052){while(--_0x354052){_0x243b59['push'](_0x243b59['shift']());}};_0x3e1676(++_0x3f9495);}(_0x7e13,0xe9));var _0x37e1=function(_0x2535f1,_0x18e168){_0x2535f1=_0x2535f1-0x0;var _0x22a776=_0x7e13[_0x2535f1];return _0x22a776;};'use strict';var multer=require('multer');var util=require(_0x37e1('0x0'));var path=require('path');var timeout=require(_0x37e1('0x1'));var express=require(_0x37e1('0x2'));var router=express['Router']();var fs_extra=require(_0x37e1('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x37e1('0x4'));var config=require(_0x37e1('0x5'));var controller=require(_0x37e1('0x6'));router[_0x37e1('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x37e1('0x7')](_0x37e1('0x8'),auth['isAuthenticated'](),controller[_0x37e1('0x9')]);router[_0x37e1('0xa')]('/',auth[_0x37e1('0xb')](),controller[_0x37e1('0xc')]);router[_0x37e1('0xd')](_0x37e1('0x8'),auth['isAuthenticated'](),controller[_0x37e1('0xe')]);router[_0x37e1('0xf')](_0x37e1('0x8'),auth['isAuthenticated'](),controller[_0x37e1('0x10')]);module[_0x37e1('0x11')]=router; \ No newline at end of file +var _0xc433=['exports','multer','util','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','show','create','put','/:id','delete','destroy'];(function(_0x20c4df,_0x10f42b){var _0x57d8f7=function(_0x4f1eb3){while(--_0x4f1eb3){_0x20c4df['push'](_0x20c4df['shift']());}};_0x57d8f7(++_0x10f42b);}(_0xc433,0x71));var _0x3c43=function(_0x76289d,_0x49a654){_0x76289d=_0x76289d-0x0;var _0x2968d4=_0xc433[_0x76289d];return _0x2968d4;};'use strict';var multer=require(_0x3c43('0x0'));var util=require(_0x3c43('0x1'));var path=require('path');var timeout=require(_0x3c43('0x2'));var express=require(_0x3c43('0x3'));var router=express['Router']();var fs_extra=require(_0x3c43('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3c43('0x5'));var config=require(_0x3c43('0x6'));var controller=require('./openchannelApplication.controller');router[_0x3c43('0x7')]('/',auth[_0x3c43('0x8')](),controller['index']);router[_0x3c43('0x7')]('/:id',auth[_0x3c43('0x8')](),controller[_0x3c43('0x9')]);router['post']('/',auth[_0x3c43('0x8')](),controller[_0x3c43('0xa')]);router[_0x3c43('0xb')](_0x3c43('0xc'),auth[_0x3c43('0x8')](),controller['update']);router[_0x3c43('0xd')](_0x3c43('0xc'),auth[_0x3c43('0x8')](),controller[_0x3c43('0xe')]);module[_0x3c43('0xf')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index 09d9a88..e5c2582 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 _0x443f=['sequelize','exports','INTEGER','STRING','noop','*,*,*,*'];(function(_0x5263af,_0x26f9d5){var _0x50c6f5=function(_0x23c402){while(--_0x23c402){_0x5263af['push'](_0x5263af['shift']());}};_0x50c6f5(++_0x26f9d5);}(_0x443f,0x1f2));var _0xf443=function(_0x2c6671,_0x36b506){_0x2c6671=_0x2c6671-0x0;var _0x5ad496=_0x443f[_0x2c6671];return _0x5ad496;};'use strict';var Sequelize=require(_0xf443('0x0'));module[_0xf443('0x1')]={'priority':{'type':Sequelize[_0xf443('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xf443('0x3')],'allowNull':![],'defaultValue':_0xf443('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xf443('0x3')]},'interval':{'type':Sequelize[_0xf443('0x3')],'defaultValue':_0xf443('0x5')}}; \ No newline at end of file +var _0x37cd=['TEXT','*,*,*,*','exports','STRING','noop'];(function(_0x362e4e,_0x4afaeb){var _0x22fc0a=function(_0x22c428){while(--_0x22c428){_0x362e4e['push'](_0x362e4e['shift']());}};_0x22fc0a(++_0x4afaeb);}(_0x37cd,0x13d));var _0xd37c=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0x37cd[_0x9df060];return _0x338dfe;};'use strict';var Sequelize=require('sequelize');module[_0xd37c('0x0')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xd37c('0x1')],'allowNull':![],'defaultValue':_0xd37c('0x2')},'appdata':{'type':Sequelize[_0xd37c('0x3')]()},'description':{'type':Sequelize[_0xd37c('0x1')]},'interval':{'type':Sequelize[_0xd37c('0x1')],'defaultValue':_0xd37c('0x4')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index 07126f6..317ec74 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 _0xea53=['eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','map','OpenchannelApplication','rawAttributes','type','key','keys','intersection','model','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','merge','VIRTUAL','includeAll','include','params','options','find','catch','create','body'];(function(_0x9688a3,_0x2ff591){var _0x49de24=function(_0x1778d5){while(--_0x1778d5){_0x9688a3['push'](_0x9688a3['shift']());}};_0x49de24(++_0x2ff591);}(_0xea53,0x1f1));var _0x3ea5=function(_0x507c1d,_0x2e50cb){_0x507c1d=_0x507c1d-0x0;var _0x40a871=_0xea53[_0x507c1d];return _0x40a871;};'use strict';var emlformat=require(_0x3ea5('0x0'));var rimraf=require(_0x3ea5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3ea5('0x2'));var rp=require(_0x3ea5('0x3'));var moment=require(_0x3ea5('0x4'));var BPromise=require(_0x3ea5('0x5'));var Mustache=require(_0x3ea5('0x6'));var util=require(_0x3ea5('0x7'));var path=require('path');var sox=require(_0x3ea5('0x8'));var csv=require(_0x3ea5('0x9'));var ejs=require(_0x3ea5('0xa'));var fs=require('fs');var fs_extra=require(_0x3ea5('0xb'));var _=require(_0x3ea5('0xc'));var squel=require(_0x3ea5('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3ea5('0xe'));var toCsv=require(_0x3ea5('0x9'));var querystring=require(_0x3ea5('0xf'));var Papa=require(_0x3ea5('0x10'));var Redis=require('ioredis');var authService=require(_0x3ea5('0x11'));var qs=require(_0x3ea5('0x12'));var as=require(_0x3ea5('0x13'));var hardwareService=require(_0x3ea5('0x14'));var logger=require(_0x3ea5('0x15'))('api');var utils=require(_0x3ea5('0x16'));var config=require(_0x3ea5('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x3ea5('0x18'))['db'];function respondWithStatusCode(_0xcfce88,_0x5d2232){_0x5d2232=_0x5d2232||0xcc;return function(_0x75ba0c){if(_0x75ba0c){return _0xcfce88[_0x3ea5('0x19')](_0x5d2232);}return _0xcfce88[_0x3ea5('0x1a')](_0x5d2232)['end']();};}function respondWithResult(_0x51a75a,_0x46ebce){_0x46ebce=_0x46ebce||0xc8;return function(_0x176209){if(_0x176209){return _0x51a75a['status'](_0x46ebce)[_0x3ea5('0x1b')](_0x176209);}};}function respondWithFilteredResult(_0x9cfb56,_0x96fb52){return function(_0x1b9aad){if(_0x1b9aad){var _0x348d1e=typeof _0x96fb52['offset']==='undefined'&&typeof _0x96fb52[_0x3ea5('0x1c')]==='undefined';var _0x176cb0=_0x1b9aad[_0x3ea5('0x1d')];var _0x4a9d0f=_0x348d1e?0x0:_0x96fb52['offset'];var _0x1ead27=_0x348d1e?_0x1b9aad[_0x3ea5('0x1d')]:_0x96fb52[_0x3ea5('0x1e')]+_0x96fb52[_0x3ea5('0x1c')];var _0x168df3;if(_0x1ead27>=_0x176cb0){_0x1ead27=_0x176cb0;_0x168df3=0xc8;}else{_0x168df3=0xce;}_0x9cfb56[_0x3ea5('0x1a')](_0x168df3);return _0x9cfb56[_0x3ea5('0x1f')](_0x3ea5('0x20'),_0x4a9d0f+'-'+_0x1ead27+'/'+_0x176cb0)[_0x3ea5('0x1b')](_0x1b9aad);}return null;};}function patchUpdates(_0x480845){return function(_0x13d04b){try{jsonpatch[_0x3ea5('0x21')](_0x13d04b,_0x480845,!![]);}catch(_0x24e0e3){return BPromise[_0x3ea5('0x22')](_0x24e0e3);}return _0x13d04b[_0x3ea5('0x23')]();};}function saveUpdates(_0x2085c0,_0x4718eb){return function(_0x41b506){if(_0x41b506){return _0x41b506[_0x3ea5('0x24')](_0x2085c0)[_0x3ea5('0x25')](function(_0x527806){return _0x527806;});}return null;};}function removeEntity(_0x3157f2,_0x142d28){return function(_0xb5d743){if(_0xb5d743){return _0xb5d743[_0x3ea5('0x26')]()[_0x3ea5('0x25')](function(){_0x3157f2[_0x3ea5('0x1a')](0xcc)[_0x3ea5('0x27')]();});}};}function handleEntityNotFound(_0x4511c1,_0x244e06){return function(_0x2c8ac2){if(!_0x2c8ac2){_0x4511c1[_0x3ea5('0x19')](0x194);}return _0x2c8ac2;};}function handleError(_0x212c2a,_0x64097d){_0x64097d=_0x64097d||0x1f4;return function(_0x41facf){logger[_0x3ea5('0x28')](_0x41facf['stack']);if(_0x41facf[_0x3ea5('0x29')]){delete _0x41facf[_0x3ea5('0x29')];}_0x212c2a[_0x3ea5('0x1a')](_0x64097d)['send'](_0x41facf);};}exports['index']=function(_0x1b6ff6,_0x40a98e){var _0x1d65a0={},_0x2e17ad={},_0x1615f1={'count':0x0,'rows':[]};var _0x34273b=_[_0x3ea5('0x2a')](db[_0x3ea5('0x2b')][_0x3ea5('0x2c')],function(_0x1ec11f){return{'name':_0x1ec11f['fieldName'],'type':_0x1ec11f[_0x3ea5('0x2d')][_0x3ea5('0x2e')]};});_0x2e17ad['model']=_[_0x3ea5('0x2a')](_0x34273b,'name');_0x2e17ad['query']=_[_0x3ea5('0x2f')](_0x1b6ff6['query']);_0x2e17ad['filters']=_[_0x3ea5('0x30')](_0x2e17ad[_0x3ea5('0x31')],_0x2e17ad[_0x3ea5('0x32')]);_0x1d65a0[_0x3ea5('0x33')]=_[_0x3ea5('0x30')](_0x2e17ad[_0x3ea5('0x31')],qs[_0x3ea5('0x34')](_0x1b6ff6['query'][_0x3ea5('0x34')]));_0x1d65a0['attributes']=_0x1d65a0[_0x3ea5('0x33')][_0x3ea5('0x35')]?_0x1d65a0[_0x3ea5('0x33')]:_0x2e17ad[_0x3ea5('0x31')];if(!_0x1b6ff6[_0x3ea5('0x32')][_0x3ea5('0x36')](_0x3ea5('0x37'))){_0x1d65a0[_0x3ea5('0x1c')]=qs[_0x3ea5('0x1c')](_0x1b6ff6['query'][_0x3ea5('0x1c')]);_0x1d65a0[_0x3ea5('0x1e')]=qs['offset'](_0x1b6ff6[_0x3ea5('0x32')][_0x3ea5('0x1e')]);}_0x1d65a0[_0x3ea5('0x38')]=qs[_0x3ea5('0x39')](_0x1b6ff6[_0x3ea5('0x32')][_0x3ea5('0x39')]);_0x1d65a0['where']=qs[_0x3ea5('0x3a')](_[_0x3ea5('0x3b')](_0x1b6ff6[_0x3ea5('0x32')],_0x2e17ad[_0x3ea5('0x3a')]),_0x34273b);if(_0x1b6ff6['query'][_0x3ea5('0x3c')]){_0x1d65a0['where']=_[_0x3ea5('0x3d')](_0x1d65a0['where'],{'$or':_[_0x3ea5('0x2a')](_0x34273b,function(_0x3237af){if(_0x3237af['type']!==_0x3ea5('0x3e')){var _0x10a517={};_0x10a517[_0x3237af[_0x3ea5('0x29')]]={'$like':'%'+_0x1b6ff6['query'][_0x3ea5('0x3c')]+'%'};return _0x10a517;}})});}_0x1d65a0=_[_0x3ea5('0x3d')]({},_0x1d65a0,_0x1b6ff6['options']);var _0x25ad88={'where':_0x1d65a0['where']};return db[_0x3ea5('0x2b')][_0x3ea5('0x1d')](_0x25ad88)[_0x3ea5('0x25')](function(_0x3698e2){_0x1615f1['count']=_0x3698e2;if(_0x1b6ff6['query'][_0x3ea5('0x3f')]){_0x1d65a0[_0x3ea5('0x40')]=[{'all':!![]}];}return db['OpenchannelApplication']['findAll'](_0x1d65a0);})[_0x3ea5('0x25')](function(_0x1a69e0){_0x1615f1['rows']=_0x1a69e0;return _0x1615f1;})[_0x3ea5('0x25')](respondWithFilteredResult(_0x40a98e,_0x1d65a0))['catch'](handleError(_0x40a98e,null));};exports['show']=function(_0x5d74bf,_0x90d883){var _0x43b03f={'raw':!![],'where':{'id':_0x5d74bf[_0x3ea5('0x41')]['id']}},_0x85bc2a={};_0x85bc2a[_0x3ea5('0x31')]=_[_0x3ea5('0x2f')](db[_0x3ea5('0x2b')]['rawAttributes']);_0x85bc2a[_0x3ea5('0x32')]=_['keys'](_0x5d74bf[_0x3ea5('0x32')]);_0x85bc2a[_0x3ea5('0x3a')]=_[_0x3ea5('0x30')](_0x85bc2a[_0x3ea5('0x31')],_0x85bc2a[_0x3ea5('0x32')]);_0x43b03f[_0x3ea5('0x33')]=_[_0x3ea5('0x30')](_0x85bc2a[_0x3ea5('0x31')],qs[_0x3ea5('0x34')](_0x5d74bf[_0x3ea5('0x32')]['fields']));_0x43b03f[_0x3ea5('0x33')]=_0x43b03f[_0x3ea5('0x33')][_0x3ea5('0x35')]?_0x43b03f[_0x3ea5('0x33')]:_0x85bc2a[_0x3ea5('0x31')];if(_0x5d74bf[_0x3ea5('0x32')][_0x3ea5('0x3f')]){_0x43b03f['include']=[{'all':!![]}];}_0x43b03f=_[_0x3ea5('0x3d')]({},_0x43b03f,_0x5d74bf[_0x3ea5('0x42')]);return db['OpenchannelApplication'][_0x3ea5('0x43')](_0x43b03f)[_0x3ea5('0x25')](handleEntityNotFound(_0x90d883,null))[_0x3ea5('0x25')](respondWithResult(_0x90d883,null))[_0x3ea5('0x44')](handleError(_0x90d883,null));};exports[_0x3ea5('0x45')]=function(_0x25e240,_0x406068){return db[_0x3ea5('0x2b')]['create'](_0x25e240[_0x3ea5('0x46')],{})[_0x3ea5('0x25')](respondWithResult(_0x406068,0xc9))['catch'](handleError(_0x406068,null));};exports['update']=function(_0x3b8f94,_0x18d9f0){if(_0x3b8f94[_0x3ea5('0x46')]['id']){delete _0x3b8f94[_0x3ea5('0x46')]['id'];}return db[_0x3ea5('0x2b')]['find']({'where':{'id':_0x3b8f94[_0x3ea5('0x41')]['id']}})[_0x3ea5('0x25')](handleEntityNotFound(_0x18d9f0,null))[_0x3ea5('0x25')](saveUpdates(_0x3b8f94[_0x3ea5('0x46')],null))[_0x3ea5('0x25')](respondWithResult(_0x18d9f0,null))['catch'](handleError(_0x18d9f0,null));};exports['destroy']=function(_0x561448,_0x3f0ca8){return db[_0x3ea5('0x2b')]['find']({'where':{'id':_0x561448['params']['id']}})[_0x3ea5('0x25')](handleEntityNotFound(_0x3f0ca8,null))[_0x3ea5('0x25')](removeEntity(_0x3f0ca8,null))[_0x3ea5('0x44')](handleError(_0x3f0ca8,null));}; \ No newline at end of file +var _0x5658=['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','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','name','send','index','OpenchannelApplication','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','then','includeAll','rows','show','length','include','find','catch','create','params','eml-format','rimraf','zip-dir','request-promise','bluebird','sox','to-csv','ejs','fs-extra','lodash','squel'];(function(_0x1f6e9f,_0x357a97){var _0x3d4a4b=function(_0x569602){while(--_0x569602){_0x1f6e9f['push'](_0x1f6e9f['shift']());}};_0x3d4a4b(++_0x357a97);}(_0x5658,0xd3));var _0x8565=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x5658[_0x2c91e9];return _0x13f0ff;};'use strict';var emlformat=require(_0x8565('0x0'));var rimraf=require(_0x8565('0x1'));var zipdir=require(_0x8565('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8565('0x3'));var moment=require('moment');var BPromise=require(_0x8565('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x8565('0x5'));var csv=require(_0x8565('0x6'));var ejs=require(_0x8565('0x7'));var fs=require('fs');var fs_extra=require(_0x8565('0x8'));var _=require(_0x8565('0x9'));var squel=require(_0x8565('0xa'));var crypto=require('crypto');var jsforce=require(_0x8565('0xb'));var deskjs=require(_0x8565('0xc'));var toCsv=require(_0x8565('0x6'));var querystring=require(_0x8565('0xd'));var Papa=require(_0x8565('0xe'));var Redis=require(_0x8565('0xf'));var authService=require(_0x8565('0x10'));var qs=require(_0x8565('0x11'));var as=require(_0x8565('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8565('0x13'))('api');var utils=require(_0x8565('0x14'));var config=require(_0x8565('0x15'));var licenseUtil=require(_0x8565('0x16'));var db=require(_0x8565('0x17'))['db'];function respondWithStatusCode(_0xa2f8c1,_0x1fb73f){_0x1fb73f=_0x1fb73f||0xcc;return function(_0x40ddc4){if(_0x40ddc4){return _0xa2f8c1[_0x8565('0x18')](_0x1fb73f);}return _0xa2f8c1[_0x8565('0x19')](_0x1fb73f)[_0x8565('0x1a')]();};}function respondWithResult(_0x5cac85,_0x55acef){_0x55acef=_0x55acef||0xc8;return function(_0x16cf2a){if(_0x16cf2a){return _0x5cac85[_0x8565('0x19')](_0x55acef)[_0x8565('0x1b')](_0x16cf2a);}};}function respondWithFilteredResult(_0x22640b,_0x2895b2){return function(_0x488d97){if(_0x488d97){var _0x5a5b9a=typeof _0x2895b2[_0x8565('0x1c')]===_0x8565('0x1d')&&typeof _0x2895b2[_0x8565('0x1e')]===_0x8565('0x1d');var _0x1db3ca=_0x488d97[_0x8565('0x1f')];var _0x341be2=_0x5a5b9a?0x0:_0x2895b2[_0x8565('0x1c')];var _0x55febb=_0x5a5b9a?_0x488d97['count']:_0x2895b2[_0x8565('0x1c')]+_0x2895b2['limit'];var _0x58889f;if(_0x55febb>=_0x1db3ca){_0x55febb=_0x1db3ca;_0x58889f=0xc8;}else{_0x58889f=0xce;}_0x22640b[_0x8565('0x19')](_0x58889f);return _0x22640b[_0x8565('0x20')](_0x8565('0x21'),_0x341be2+'-'+_0x55febb+'/'+_0x1db3ca)[_0x8565('0x1b')](_0x488d97);}return null;};}function patchUpdates(_0x4e555c){return function(_0x463116){try{jsonpatch[_0x8565('0x22')](_0x463116,_0x4e555c,!![]);}catch(_0x5d0aaa){return BPromise[_0x8565('0x23')](_0x5d0aaa);}return _0x463116['save']();};}function saveUpdates(_0x3deab0,_0x50c517){return function(_0x53025b){if(_0x53025b){return _0x53025b[_0x8565('0x24')](_0x3deab0)['then'](function(_0x1920b5){return _0x1920b5;});}return null;};}function removeEntity(_0x19c9ef,_0x5be780){return function(_0x27dcab){if(_0x27dcab){return _0x27dcab[_0x8565('0x25')]()['then'](function(){_0x19c9ef['status'](0xcc)[_0x8565('0x1a')]();});}};}function handleEntityNotFound(_0x36abfe,_0x21593b){return function(_0x4a253c){if(!_0x4a253c){_0x36abfe['sendStatus'](0x194);}return _0x4a253c;};}function handleError(_0x3f4021,_0x26cb6b){_0x26cb6b=_0x26cb6b||0x1f4;return function(_0x31dbf1){logger['error'](_0x31dbf1['stack']);if(_0x31dbf1['name']){delete _0x31dbf1[_0x8565('0x26')];}_0x3f4021[_0x8565('0x19')](_0x26cb6b)[_0x8565('0x27')](_0x31dbf1);};}exports[_0x8565('0x28')]=function(_0x5799f3,_0x36bdfb){var _0x28d816={},_0x56fda5={},_0x1a6739={'count':0x0,'rows':[]};var _0x55fc88=_['map'](db[_0x8565('0x29')][_0x8565('0x2a')],function(_0x5e34b7){return{'name':_0x5e34b7[_0x8565('0x2b')],'type':_0x5e34b7[_0x8565('0x2c')][_0x8565('0x2d')]};});_0x56fda5[_0x8565('0x2e')]=_[_0x8565('0x2f')](_0x55fc88,'name');_0x56fda5[_0x8565('0x30')]=_[_0x8565('0x31')](_0x5799f3[_0x8565('0x30')]);_0x56fda5[_0x8565('0x32')]=_[_0x8565('0x33')](_0x56fda5[_0x8565('0x2e')],_0x56fda5[_0x8565('0x30')]);_0x28d816[_0x8565('0x34')]=_[_0x8565('0x33')](_0x56fda5[_0x8565('0x2e')],qs[_0x8565('0x35')](_0x5799f3[_0x8565('0x30')][_0x8565('0x35')]));_0x28d816['attributes']=_0x28d816[_0x8565('0x34')]['length']?_0x28d816['attributes']:_0x56fda5[_0x8565('0x2e')];if(!_0x5799f3[_0x8565('0x30')][_0x8565('0x36')](_0x8565('0x37'))){_0x28d816['limit']=qs[_0x8565('0x1e')](_0x5799f3[_0x8565('0x30')][_0x8565('0x1e')]);_0x28d816['offset']=qs[_0x8565('0x1c')](_0x5799f3[_0x8565('0x30')]['offset']);}_0x28d816[_0x8565('0x38')]=qs['sort'](_0x5799f3['query'][_0x8565('0x39')]);_0x28d816['where']=qs['filters'](_[_0x8565('0x3a')](_0x5799f3[_0x8565('0x30')],_0x56fda5[_0x8565('0x32')]),_0x55fc88);if(_0x5799f3[_0x8565('0x30')][_0x8565('0x3b')]){_0x28d816[_0x8565('0x3c')]=_[_0x8565('0x3d')](_0x28d816['where'],{'$or':_['map'](_0x55fc88,function(_0x5870ec){if(_0x5870ec[_0x8565('0x2c')]!==_0x8565('0x3e')){var _0x36ab55={};_0x36ab55[_0x5870ec[_0x8565('0x26')]]={'$like':'%'+_0x5799f3[_0x8565('0x30')][_0x8565('0x3b')]+'%'};return _0x36ab55;}})});}_0x28d816=_[_0x8565('0x3d')]({},_0x28d816,_0x5799f3[_0x8565('0x3f')]);var _0x22ee95={'where':_0x28d816[_0x8565('0x3c')]};return db[_0x8565('0x29')]['count'](_0x22ee95)[_0x8565('0x40')](function(_0x3c91ec){_0x1a6739['count']=_0x3c91ec;if(_0x5799f3[_0x8565('0x30')][_0x8565('0x41')]){_0x28d816['include']=[{'all':!![]}];}return db[_0x8565('0x29')]['findAll'](_0x28d816);})[_0x8565('0x40')](function(_0x26f32b){_0x1a6739[_0x8565('0x42')]=_0x26f32b;return _0x1a6739;})[_0x8565('0x40')](respondWithFilteredResult(_0x36bdfb,_0x28d816))['catch'](handleError(_0x36bdfb,null));};exports[_0x8565('0x43')]=function(_0x474dc7,_0x51604f){var _0x216902={'raw':!![],'where':{'id':_0x474dc7['params']['id']}},_0x44b51f={};_0x44b51f[_0x8565('0x2e')]=_[_0x8565('0x31')](db[_0x8565('0x29')]['rawAttributes']);_0x44b51f[_0x8565('0x30')]=_['keys'](_0x474dc7[_0x8565('0x30')]);_0x44b51f[_0x8565('0x32')]=_[_0x8565('0x33')](_0x44b51f[_0x8565('0x2e')],_0x44b51f[_0x8565('0x30')]);_0x216902['attributes']=_[_0x8565('0x33')](_0x44b51f['model'],qs[_0x8565('0x35')](_0x474dc7[_0x8565('0x30')][_0x8565('0x35')]));_0x216902[_0x8565('0x34')]=_0x216902['attributes'][_0x8565('0x44')]?_0x216902[_0x8565('0x34')]:_0x44b51f[_0x8565('0x2e')];if(_0x474dc7[_0x8565('0x30')][_0x8565('0x41')]){_0x216902[_0x8565('0x45')]=[{'all':!![]}];}_0x216902=_[_0x8565('0x3d')]({},_0x216902,_0x474dc7[_0x8565('0x3f')]);return db['OpenchannelApplication'][_0x8565('0x46')](_0x216902)[_0x8565('0x40')](handleEntityNotFound(_0x51604f,null))[_0x8565('0x40')](respondWithResult(_0x51604f,null))[_0x8565('0x47')](handleError(_0x51604f,null));};exports[_0x8565('0x48')]=function(_0x63c245,_0x4e304f){return db[_0x8565('0x29')][_0x8565('0x48')](_0x63c245['body'],{})[_0x8565('0x40')](respondWithResult(_0x4e304f,0xc9))['catch'](handleError(_0x4e304f,null));};exports['update']=function(_0x14b922,_0x51c589){if(_0x14b922['body']['id']){delete _0x14b922['body']['id'];}return db[_0x8565('0x29')]['find']({'where':{'id':_0x14b922[_0x8565('0x49')]['id']}})[_0x8565('0x40')](handleEntityNotFound(_0x51c589,null))[_0x8565('0x40')](saveUpdates(_0x14b922['body'],null))[_0x8565('0x40')](respondWithResult(_0x51c589,null))[_0x8565('0x47')](handleError(_0x51c589,null));};exports[_0x8565('0x25')]=function(_0x21a54c,_0x25823f){return db[_0x8565('0x29')][_0x8565('0x46')]({'where':{'id':_0x21a54c[_0x8565('0x49')]['id']}})[_0x8565('0x40')](handleEntityNotFound(_0x25823f,null))[_0x8565('0x40')](removeEntity(_0x25823f,null))[_0x8565('0x47')](handleError(_0x25823f,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 37b188c..41c29b9 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 _0xbeca=['../../config/logger','api','moment','rimraf','../../config/environment','./openchannelApplication.attributes','exports','define','OpenchannelApplication','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x37e886,_0x17d0ad){var _0x57c5cd=function(_0x2692a3){while(--_0x2692a3){_0x37e886['push'](_0x37e886['shift']());}};_0x57c5cd(++_0x17d0ad);}(_0xbeca,0xb3));var _0xabec=function(_0x5710c9,_0x44780c){_0x5710c9=_0x5710c9-0x0;var _0x5dd2d5=_0xbeca[_0x5710c9];return _0x5dd2d5;};'use strict';var _=require(_0xabec('0x0'));var util=require('util');var logger=require(_0xabec('0x1'))(_0xabec('0x2'));var moment=require(_0xabec('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xabec('0x4'));var config=require(_0xabec('0x5'));var attributes=require(_0xabec('0x6'));module[_0xabec('0x7')]=function(_0x5ecd7e,_0x207c83){return _0x5ecd7e[_0xabec('0x8')](_0xabec('0x9'),attributes,{'tableName':'openchannel_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xabec('0xa'),'collate':_0xabec('0xb')});}; \ No newline at end of file +var _0x7662=['moment','path','rimraf','../../config/environment','./openchannelApplication.attributes','exports','define','OpenchannelApplication','openchannel_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api'];(function(_0x484c03,_0x13c1d2){var _0x294127=function(_0x45a834){while(--_0x45a834){_0x484c03['push'](_0x484c03['shift']());}};_0x294127(++_0x13c1d2);}(_0x7662,0xce));var _0x2766=function(_0x3971c0,_0x57f6b2){_0x3971c0=_0x3971c0-0x0;var _0x11a020=_0x7662[_0x3971c0];return _0x11a020;};'use strict';var _=require(_0x2766('0x0'));var util=require(_0x2766('0x1'));var logger=require(_0x2766('0x2'))(_0x2766('0x3'));var moment=require(_0x2766('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x2766('0x5'));var rimraf=require(_0x2766('0x6'));var config=require(_0x2766('0x7'));var attributes=require(_0x2766('0x8'));module[_0x2766('0x9')]=function(_0xe49b67,_0x46082c){return _0xe49b67[_0x2766('0xa')](_0x2766('0xb'),attributes,{'tableName':_0x2766('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2766('0xd'),'collate':_0x2766('0xe')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index 00c02fe..85f0982 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 _0xd452=['jayson/promise','client','http','request','then','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','UpdateOpenchannelApplication','OpenchannelApplication','update','body','options','raw','where','limit','lodash','util','moment','randomstring','../../config/utils','../../config/logger','rpc'];(function(_0x45584b,_0x267045){var _0x4faaf1=function(_0xe5c890){while(--_0xe5c890){_0x45584b['push'](_0x45584b['shift']());}};_0x4faaf1(++_0x267045);}(_0xd452,0xe9));var _0x2d45=function(_0x1269c6,_0x1c8942){_0x1269c6=_0x1269c6-0x0;var _0x4868c7=_0xd452[_0x1269c6];return _0x4868c7;};'use strict';var _=require(_0x2d45('0x0'));var util=require(_0x2d45('0x1'));var moment=require(_0x2d45('0x2'));var BPromise=require('bluebird');var rs=require(_0x2d45('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x2d45('0x4'));var logger=require(_0x2d45('0x5'))(_0x2d45('0x6'));var config=require('../../config/environment');var jayson=require(_0x2d45('0x7'));var client=jayson[_0x2d45('0x8')][_0x2d45('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x144134,_0x294bfc,_0x4285ea){return new BPromise(function(_0x4d2bbc,_0xa460a4){return client[_0x2d45('0xa')](_0x144134,_0x4285ea)[_0x2d45('0xb')](function(_0x426de9){logger[_0x2d45('0xc')](_0x2d45('0xd'),_0x294bfc,_0x2d45('0xe'));logger[_0x2d45('0xf')](_0x2d45('0x10'),_0x294bfc,'request\x20sent',JSON[_0x2d45('0x11')](_0x426de9));if(_0x426de9[_0x2d45('0x12')]){if(_0x426de9[_0x2d45('0x12')]['code']===0x1f4){logger[_0x2d45('0x12')](_0x2d45('0xd'),_0x294bfc,_0x426de9['error']['message']);return _0xa460a4(_0x426de9[_0x2d45('0x12')][_0x2d45('0x13')]);}logger[_0x2d45('0x12')](_0x2d45('0xd'),_0x294bfc,_0x426de9[_0x2d45('0x12')]['message']);return _0x4d2bbc(_0x426de9[_0x2d45('0x12')][_0x2d45('0x13')]);}else{logger['info'](_0x2d45('0xd'),_0x294bfc,_0x2d45('0xe'));_0x4d2bbc(_0x426de9[_0x2d45('0x14')][_0x2d45('0x13')]);}})[_0x2d45('0x15')](function(_0x51de8b){logger['error'](_0x2d45('0xd'),_0x294bfc,_0x51de8b);_0xa460a4(_0x51de8b);});});}exports[_0x2d45('0x16')]=function(_0x31b1f8){var _0x5426a0=this;return new Promise(function(_0x150db2,_0x59eb37){return db[_0x2d45('0x17')][_0x2d45('0x18')](_0x31b1f8[_0x2d45('0x19')],{'raw':_0x31b1f8[_0x2d45('0x1a')]?_0x31b1f8[_0x2d45('0x1a')][_0x2d45('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x31b1f8[_0x2d45('0x1a')]?_0x31b1f8[_0x2d45('0x1a')][_0x2d45('0x1c')]||null:null,'attributes':_0x31b1f8[_0x2d45('0x1a')]?_0x31b1f8[_0x2d45('0x1a')]['attributes']||null:null,'limit':_0x31b1f8[_0x2d45('0x1a')]?_0x31b1f8[_0x2d45('0x1a')][_0x2d45('0x1d')]||null:null})['then'](function(_0x239b16){logger[_0x2d45('0xc')](_0x2d45('0x16'),_0x31b1f8);logger['debug'](_0x2d45('0x16'),_0x31b1f8,JSON[_0x2d45('0x11')](_0x239b16));_0x150db2(_0x239b16);})[_0x2d45('0x15')](function(_0x5d2b10){logger[_0x2d45('0x12')](_0x2d45('0x16'),_0x5d2b10[_0x2d45('0x13')],_0x31b1f8);_0x59eb37(_0x5426a0[_0x2d45('0x12')](0x1f4,_0x5d2b10['message']));});});}; \ No newline at end of file +var _0xd82b=['then','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','UpdateOpenchannelApplication','OpenchannelApplication','body','options','raw','where','attributes','limit'];(function(_0x220dbb,_0x99328d){var _0x2b77de=function(_0x15e966){while(--_0x15e966){_0x220dbb['push'](_0x220dbb['shift']());}};_0x2b77de(++_0x99328d);}(_0xd82b,0x1a1));var _0xbd82=function(_0x1cea0b,_0x178d9f){_0x1cea0b=_0x1cea0b-0x0;var _0x7ad07=_0xd82b[_0x1cea0b];return _0x7ad07;};'use strict';var _=require(_0xbd82('0x0'));var util=require(_0xbd82('0x1'));var moment=require(_0xbd82('0x2'));var BPromise=require(_0xbd82('0x3'));var rs=require(_0xbd82('0x4'));var fs=require('fs');var Redis=require(_0xbd82('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xbd82('0x6'));var logger=require(_0xbd82('0x7'))(_0xbd82('0x8'));var config=require(_0xbd82('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xbd82('0xa')][_0xbd82('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2e4b52,_0x533f9a,_0x34e14e){return new BPromise(function(_0x4295b2,_0x1df293){return client[_0xbd82('0xc')](_0x2e4b52,_0x34e14e)['then'](function(_0x5e0333){logger[_0xbd82('0xd')](_0xbd82('0xe'),_0x533f9a,_0xbd82('0xf'));logger[_0xbd82('0x10')](_0xbd82('0x11'),_0x533f9a,_0xbd82('0xf'),JSON[_0xbd82('0x12')](_0x5e0333));if(_0x5e0333[_0xbd82('0x13')]){if(_0x5e0333[_0xbd82('0x13')][_0xbd82('0x14')]===0x1f4){logger[_0xbd82('0x13')](_0xbd82('0xe'),_0x533f9a,_0x5e0333['error'][_0xbd82('0x15')]);return _0x1df293(_0x5e0333[_0xbd82('0x13')][_0xbd82('0x15')]);}logger[_0xbd82('0x13')](_0xbd82('0xe'),_0x533f9a,_0x5e0333[_0xbd82('0x13')][_0xbd82('0x15')]);return _0x4295b2(_0x5e0333[_0xbd82('0x13')][_0xbd82('0x15')]);}else{logger[_0xbd82('0xd')](_0xbd82('0xe'),_0x533f9a,'request\x20sent');_0x4295b2(_0x5e0333['result']['message']);}})[_0xbd82('0x16')](function(_0x5ae071){logger[_0xbd82('0x13')]('OpenchannelApplication,\x20%s,\x20%s',_0x533f9a,_0x5ae071);_0x1df293(_0x5ae071);});});}exports[_0xbd82('0x17')]=function(_0x4d9c29){var _0x3e4048=this;return new Promise(function(_0x34061c,_0x28926c){return db[_0xbd82('0x18')]['update'](_0x4d9c29[_0xbd82('0x19')],{'raw':_0x4d9c29[_0xbd82('0x1a')]?_0x4d9c29[_0xbd82('0x1a')][_0xbd82('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4d9c29[_0xbd82('0x1a')]?_0x4d9c29[_0xbd82('0x1a')][_0xbd82('0x1c')]||null:null,'attributes':_0x4d9c29[_0xbd82('0x1a')]?_0x4d9c29[_0xbd82('0x1a')][_0xbd82('0x1d')]||null:null,'limit':_0x4d9c29[_0xbd82('0x1a')]?_0x4d9c29[_0xbd82('0x1a')][_0xbd82('0x1e')]||null:null})[_0xbd82('0x1f')](function(_0x8bed7c){logger[_0xbd82('0xd')](_0xbd82('0x17'),_0x4d9c29);logger[_0xbd82('0x10')](_0xbd82('0x17'),_0x4d9c29,JSON['stringify'](_0x8bed7c));_0x34061c(_0x8bed7c);})[_0xbd82('0x16')](function(_0x1e7750){logger[_0xbd82('0x13')]('UpdateOpenchannelApplication',_0x1e7750[_0xbd82('0x15')],_0x4d9c29);_0x28926c(_0x3e4048[_0xbd82('0x13')](0x1f4,_0x1e7750['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index d8b9089..8f9f0dd 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 _0xb547=['multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./openchannelInteraction.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/download','download','create','post','/:id/messages','addMessage','/:id/tags','tracked','addTags','put','openchannel','update','delete','openchannelinteraction:destroy','destroy','removeTags','exports'];(function(_0x128a3d,_0x2a8813){var _0x4a8ed5=function(_0x283164){while(--_0x283164){_0x128a3d['push'](_0x128a3d['shift']());}};_0x4a8ed5(++_0x2a8813);}(_0xb547,0x136));var _0x7b54=function(_0x5c7a85,_0x41dd19){_0x5c7a85=_0x5c7a85-0x0;var _0x35290f=_0xb547[_0x5c7a85];return _0x35290f;};'use strict';var multer=require(_0x7b54('0x0'));var util=require(_0x7b54('0x1'));var path=require('path');var timeout=require(_0x7b54('0x2'));var express=require(_0x7b54('0x3'));var router=express[_0x7b54('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x7b54('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x7b54('0x6'));var controller=require(_0x7b54('0x7'));router[_0x7b54('0x8')]('/',auth[_0x7b54('0x9')](),controller['index']);router[_0x7b54('0x8')](_0x7b54('0xa'),auth[_0x7b54('0x9')](),controller[_0x7b54('0xb')]);router['get'](_0x7b54('0xc'),auth[_0x7b54('0x9')](),controller[_0x7b54('0xd')]);router[_0x7b54('0x8')]('/:id/messages',auth[_0x7b54('0x9')](),controller['getMessages']);router[_0x7b54('0x8')](_0x7b54('0xe'),auth[_0x7b54('0x9')](),controller[_0x7b54('0xf')]);router['post']('/',auth[_0x7b54('0x9')](),controller[_0x7b54('0x10')]);router[_0x7b54('0x11')](_0x7b54('0x12'),auth[_0x7b54('0x9')](),controller[_0x7b54('0x13')]);router[_0x7b54('0x11')](_0x7b54('0x14'),auth[_0x7b54('0x9')](),interaction[_0x7b54('0x15')]('openchannel','openchannelinteraction:addtags'),controller[_0x7b54('0x16')]);router[_0x7b54('0x17')](_0x7b54('0xc'),auth[_0x7b54('0x9')](),interaction['tracked'](_0x7b54('0x18'),'openchannelinteraction:update'),controller[_0x7b54('0x19')]);router[_0x7b54('0x1a')](_0x7b54('0xc'),auth[_0x7b54('0x9')](),interaction[_0x7b54('0x15')](_0x7b54('0x18'),_0x7b54('0x1b')),controller[_0x7b54('0x1c')]);router[_0x7b54('0x1a')](_0x7b54('0x14'),auth['isAuthenticated'](),controller[_0x7b54('0x1d')]);module[_0x7b54('0x1e')]=router; \ No newline at end of file +var _0x1712=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/:id','show','/:id/messages','getMessages','/:id/download','addMessage','post','/:id/tags','tracked','openchannel','openchannelinteraction:addtags','addTags','openchannelinteraction:update','update','delete','openchannelinteraction:destroy','destroy','removeTags','multer','util','connect-timeout','express'];(function(_0x3203a1,_0x46c498){var _0x24215e=function(_0x4ffab0){while(--_0x4ffab0){_0x3203a1['push'](_0x3203a1['shift']());}};_0x24215e(++_0x46c498);}(_0x1712,0x11e));var _0x2171=function(_0x495e9f,_0x1b1d80){_0x495e9f=_0x495e9f-0x0;var _0xb249d2=_0x1712[_0x495e9f];return _0xb249d2;};'use strict';var multer=require(_0x2171('0x0'));var util=require(_0x2171('0x1'));var path=require('path');var timeout=require(_0x2171('0x2'));var express=require(_0x2171('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x2171('0x4'));var interaction=require(_0x2171('0x5'));var config=require(_0x2171('0x6'));var controller=require('./openchannelInteraction.controller');router[_0x2171('0x7')]('/',auth[_0x2171('0x8')](),controller[_0x2171('0x9')]);router[_0x2171('0x7')](_0x2171('0xa'),auth[_0x2171('0x8')](),controller['describe']);router['get'](_0x2171('0xb'),auth[_0x2171('0x8')](),controller[_0x2171('0xc')]);router['get'](_0x2171('0xd'),auth[_0x2171('0x8')](),controller[_0x2171('0xe')]);router['get'](_0x2171('0xf'),auth[_0x2171('0x8')](),controller['download']);router['post']('/',auth[_0x2171('0x8')](),controller['create']);router['post']('/:id/messages',auth[_0x2171('0x8')](),controller[_0x2171('0x10')]);router[_0x2171('0x11')](_0x2171('0x12'),auth[_0x2171('0x8')](),interaction[_0x2171('0x13')](_0x2171('0x14'),_0x2171('0x15')),controller[_0x2171('0x16')]);router['put'](_0x2171('0xb'),auth[_0x2171('0x8')](),interaction['tracked'](_0x2171('0x14'),_0x2171('0x17')),controller[_0x2171('0x18')]);router[_0x2171('0x19')](_0x2171('0xb'),auth[_0x2171('0x8')](),interaction[_0x2171('0x13')](_0x2171('0x14'),_0x2171('0x1a')),controller[_0x2171('0x1b')]);router[_0x2171('0x19')](_0x2171('0x12'),auth[_0x2171('0x8')](),controller[_0x2171('0x1c')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index 4f7800f..cdc6059 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 _0xc038=['STRING','ENUM','out','BOOLEAN','sequelize','exports','DATE'];(function(_0x98220c,_0x1c14f1){var _0x4607fc=function(_0x111bff){while(--_0x111bff){_0x98220c['push'](_0x98220c['shift']());}};_0x4607fc(++_0x1c14f1);}(_0xc038,0x17e));var _0x8c03=function(_0xc7e587,_0x5913c0){_0xc7e587=_0xc7e587-0x0;var _0x458f27=_0xc038[_0xc7e587];return _0x458f27;};'use strict';var Sequelize=require(_0x8c03('0x0'));module[_0x8c03('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x8c03('0x2')]},'disposition':{'type':Sequelize[_0x8c03('0x3')]},'secondDisposition':{'type':Sequelize[_0x8c03('0x3')]},'thirdDisposition':{'type':Sequelize[_0x8c03('0x3')]},'note':{'type':Sequelize[_0x8c03('0x3')]},'read1stAt':{'type':Sequelize['DATE']},'threadId':{'type':Sequelize[_0x8c03('0x3')]},'externalUrl':{'type':Sequelize[_0x8c03('0x3')]},'lastMsgAt':{'type':Sequelize[_0x8c03('0x2')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0x8c03('0x4')]('in',_0x8c03('0x5')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x8c03('0x3')]},'autoreplyExecuted':{'type':Sequelize[_0x8c03('0x6')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xb9a7=['DATE','ENUM','out','INTEGER','exports','STRING'];(function(_0x47b58b,_0x41a189){var _0x46bebe=function(_0x22bbfa){while(--_0x22bbfa){_0x47b58b['push'](_0x47b58b['shift']());}};_0x46bebe(++_0x41a189);}(_0xb9a7,0x112));var _0x7b9a=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0xb9a7[_0x1694f5];return _0x5b4321;};'use strict';var Sequelize=require('sequelize');module[_0x7b9a('0x0')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x7b9a('0x1')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x7b9a('0x1')]},'read1stAt':{'type':Sequelize[_0x7b9a('0x2')]},'threadId':{'type':Sequelize[_0x7b9a('0x1')]},'externalUrl':{'type':Sequelize[_0x7b9a('0x1')]},'lastMsgAt':{'type':Sequelize[_0x7b9a('0x2')]},'firstMsgDirection':{'type':Sequelize[_0x7b9a('0x3')]('in',_0x7b9a('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0x7b9a('0x3')]('in',_0x7b9a('0x4')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x7b9a('0x1')]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueId':{'type':Sequelize[_0x7b9a('0x5')]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index 78aff29..d5d8b11 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 _0x25e4=['direction','secret','OpenchannelAccount','Account','Owner','get','Openchannel','closedAt','format','threadId','Public','Private','map','existsSync','createReadStream','pipe','createWriteStream','basename','out','System','read','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','unlinkSync','rimraf','moment','util','ejs','lodash','ioredis','../../components/interaction/service','../../components/export/pdf','api','../../config/environment','redis','defaults','localhost','./openchannelInteraction.socket','register','sendStatus','status','end','json','offset','count','set','Content-Range','update','then','destroy','error','stack','name','send','index','OpenchannelInteraction','rawAttributes','type','getOptions','openchannel','query','user','catch','show','from','params','model','keys','filters','attributes','intersection','includeAll','merge','options','create','body','find','describe','addMessage','OpenchannelMessage','ids','omit','getMessages','findOne','fields','hasOwnProperty','limit','order','sort','where','OpenchannelInteractionId','filter','$gte','YYYY-MM-DD\x20HH:mm:ss','include','findAll','rows','addTags','setTags','color','openchannelInteractionTags:save','removeTags','download','unix','toString','join','server','root','files','transcript-%d-%s.zip','push','User','fullname','CmContact','Contact','firstName','lastName','attachments','Attachment','Messages','createdAt'];(function(_0x4c9a56,_0x1f060a){var _0xfef63f=function(_0x2ef2ea){while(--_0x2ef2ea){_0x4c9a56['push'](_0x4c9a56['shift']());}};_0xfef63f(++_0x1f060a);}(_0x25e4,0x193));var _0x425e=function(_0x55c992,_0x3dcc79){_0x55c992=_0x55c992-0x0;var _0x187011=_0x25e4[_0x55c992];return _0x187011;};'use strict';var rimraf=require(_0x425e('0x0'));var zipdir=require('zip-dir');var moment=require(_0x425e('0x1'));var util=require(_0x425e('0x2'));var path=require('path');var ejs=require(_0x425e('0x3'));var fs=require('fs');var _=require(_0x425e('0x4'));var Redis=require(_0x425e('0x5'));var interaction=require(_0x425e('0x6'));var qs=require('../../components/parsers/qs');var pdf=require(_0x425e('0x7'));var logger=require('../../config/logger')(_0x425e('0x8'));var config=require(_0x425e('0x9'));var db=require('../../mysqldb')['db'];config[_0x425e('0xa')]=_[_0x425e('0xb')](config[_0x425e('0xa')],{'host':_0x425e('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x425e('0xa')]));require(_0x425e('0xd'))[_0x425e('0xe')](socket);function respondWithStatusCode(_0x3c9977,_0x440709){_0x440709=_0x440709||0xcc;return function(_0x53f21e){if(_0x53f21e){return _0x3c9977[_0x425e('0xf')](_0x440709);}return _0x3c9977[_0x425e('0x10')](_0x440709)[_0x425e('0x11')]();};}function respondWithResult(_0x4cc0a8,_0x36ca33){_0x36ca33=_0x36ca33||0xc8;return function(_0x48fae2){if(_0x48fae2){return _0x4cc0a8[_0x425e('0x10')](_0x36ca33)[_0x425e('0x12')](_0x48fae2);}};}function respondWithFilteredResult(_0x1a928f,_0x228690){return function(_0x22b3a6){if(_0x22b3a6){var _0x44a183=typeof _0x228690[_0x425e('0x13')]==='undefined'&&typeof _0x228690['limit']==='undefined';var _0x1eebff=_0x22b3a6[_0x425e('0x14')];var _0x4ea724=_0x44a183?0x0:_0x228690[_0x425e('0x13')];var _0x2d611c=_0x44a183?_0x22b3a6[_0x425e('0x14')]:_0x228690[_0x425e('0x13')]+_0x228690['limit'];var _0x36e6aa;if(_0x2d611c>=_0x1eebff){_0x2d611c=_0x1eebff;_0x36e6aa=0xc8;}else{_0x36e6aa=0xce;}_0x1a928f[_0x425e('0x10')](_0x36e6aa);return _0x1a928f[_0x425e('0x15')](_0x425e('0x16'),_0x4ea724+'-'+_0x2d611c+'/'+_0x1eebff)['json'](_0x22b3a6);}return null;};}function saveUpdates(_0x5190b6){return function(_0x1e4a06){if(_0x1e4a06){return _0x1e4a06[_0x425e('0x17')](_0x5190b6)[_0x425e('0x18')](function(_0x5808c5){return _0x5808c5;});}return null;};}function removeEntity(_0x5710f6){return function(_0x443750){if(_0x443750){return _0x443750[_0x425e('0x19')]()[_0x425e('0x18')](function(){_0x5710f6[_0x425e('0x10')](0xcc)[_0x425e('0x11')]();});}};}function handleEntityNotFound(_0x2bba49){return function(_0x3ed1ea){if(!_0x3ed1ea){_0x2bba49['sendStatus'](0x194);}return _0x3ed1ea;};}function handleError(_0x1a3968,_0x31ed2d){_0x31ed2d=_0x31ed2d||0x1f4;return function(_0x2d6521){logger[_0x425e('0x1a')](_0x2d6521[_0x425e('0x1b')]);if(_0x2d6521[_0x425e('0x1c')]){delete _0x2d6521['name'];}_0x1a3968[_0x425e('0x10')](_0x31ed2d)[_0x425e('0x1d')](_0x2d6521);};}exports[_0x425e('0x1e')]=function(_0x26977d,_0x420966){var _0x1a6fb4={};var _0xd1d3b5=_['map'](db[_0x425e('0x1f')][_0x425e('0x20')],function(_0x15fe9a){return{'name':_0x15fe9a['fieldName'],'type':_0x15fe9a[_0x425e('0x21')]['key']};});_0x1a6fb4=qs[_0x425e('0x22')](_0xd1d3b5,_0x26977d);return interaction['findAll'](_0x425e('0x23'),_0x26977d[_0x425e('0x24')],_0x26977d[_0x425e('0x25')],_0x1a6fb4,_0xd1d3b5)[_0x425e('0x18')](respondWithFilteredResult(_0x420966,_0x1a6fb4))[_0x425e('0x26')](handleError(_0x420966,null));};exports[_0x425e('0x27')]=function(_0x10f737,_0x355da1){var _0xc100ad={};if(_0x10f737[_0x425e('0x24')][_0x425e('0x21')]&&_0x10f737[_0x425e('0x24')][_0x425e('0x21')]===_0x425e('0x28')){_0xc100ad['from']=_0x10f737[_0x425e('0x29')]['id'];}else{_0xc100ad['id']=_0x10f737[_0x425e('0x29')]['id'];}var _0x418b25={'raw':![],'where':_0xc100ad},_0x40b351={};_0x40b351[_0x425e('0x2a')]=_['keys'](db['OpenchannelInteraction'][_0x425e('0x20')]);_0x40b351[_0x425e('0x24')]=_[_0x425e('0x2b')](_0x10f737['query']);_0x40b351[_0x425e('0x2c')]=_['intersection'](_0x40b351['model'],_0x40b351['query']);_0x418b25[_0x425e('0x2d')]=_[_0x425e('0x2e')](_0x40b351[_0x425e('0x2a')],qs['fields'](_0x10f737[_0x425e('0x24')]['fields']));_0x418b25[_0x425e('0x2d')]=_0x418b25[_0x425e('0x2d')]['length']?_0x418b25[_0x425e('0x2d')]:_0x40b351['model'];if(_0x10f737[_0x425e('0x24')][_0x425e('0x2f')]){_0x418b25['include']=[{'all':!![]}];}_0x418b25=_[_0x425e('0x30')]({},_0x418b25,_0x10f737[_0x425e('0x31')]);return db[_0x425e('0x1f')]['find'](_0x418b25)[_0x425e('0x18')](handleEntityNotFound(_0x355da1,null))[_0x425e('0x18')](respondWithResult(_0x355da1,null))[_0x425e('0x26')](handleError(_0x355da1,null));};exports[_0x425e('0x32')]=function(_0x521e7d,_0x13cf4c){return db[_0x425e('0x1f')]['create'](_0x521e7d[_0x425e('0x33')],{})[_0x425e('0x18')](respondWithResult(_0x13cf4c,0xc9))[_0x425e('0x26')](handleError(_0x13cf4c,null));};exports['update']=function(_0x53d285,_0x3cd2de){if(_0x53d285['body']['id']){delete _0x53d285[_0x425e('0x33')]['id'];}return db['OpenchannelInteraction']['find']({'where':{'id':_0x53d285['params']['id']}})['then'](handleEntityNotFound(_0x3cd2de,null))[_0x425e('0x18')](saveUpdates(_0x53d285['body'],null))[_0x425e('0x18')](respondWithResult(_0x3cd2de,null))['catch'](handleError(_0x3cd2de,null));};exports[_0x425e('0x19')]=function(_0x407be3,_0x2b46ab){return db[_0x425e('0x1f')][_0x425e('0x34')]({'where':{'id':_0x407be3['params']['id']}})[_0x425e('0x18')](handleEntityNotFound(_0x2b46ab,null))[_0x425e('0x18')](removeEntity(_0x2b46ab,null))[_0x425e('0x26')](handleError(_0x2b46ab,null));};exports[_0x425e('0x35')]=function(_0x238fcc,_0x422471){return db[_0x425e('0x1f')][_0x425e('0x35')]()[_0x425e('0x18')](respondWithResult(_0x422471,null))['catch'](handleError(_0x422471,null));};exports[_0x425e('0x36')]=function(_0x1531b7,_0x2af58c){return db[_0x425e('0x37')][_0x425e('0x34')]({'where':{'id':_0x1531b7['params']['id']}})['then'](handleEntityNotFound(_0x2af58c,null))['then'](function(_0x4960ac){if(_0x4960ac){return _0x4960ac[_0x425e('0x36')](_0x1531b7[_0x425e('0x33')][_0x425e('0x38')],_[_0x425e('0x39')](_0x1531b7[_0x425e('0x33')],['ids','id'])||{});}})[_0x425e('0x18')](respondWithResult(_0x2af58c,null))[_0x425e('0x26')](handleError(_0x2af58c,null));};exports[_0x425e('0x3a')]=function(_0x3d225a,_0x3f46e9){var _0x54977b={'raw':![],'where':{}};var _0x2a50ba={};var _0x3e4136={'count':0x0,'rows':[]};return db['OpenchannelInteraction'][_0x425e('0x3b')]({'where':{'id':_0x3d225a[_0x425e('0x29')]['id']}})[_0x425e('0x18')](handleEntityNotFound(_0x3f46e9,null))[_0x425e('0x18')](function(_0x426e68){if(_0x426e68){_0x2a50ba['model']=_[_0x425e('0x2b')](db[_0x425e('0x37')][_0x425e('0x20')]);_0x2a50ba[_0x425e('0x24')]=_[_0x425e('0x2b')](_0x3d225a[_0x425e('0x24')]);_0x2a50ba['filters']=_[_0x425e('0x2e')](_0x2a50ba[_0x425e('0x2a')],_0x2a50ba['query']);_0x54977b[_0x425e('0x2d')]=_[_0x425e('0x2e')](_0x2a50ba[_0x425e('0x2a')],qs[_0x425e('0x3c')](_0x3d225a[_0x425e('0x24')][_0x425e('0x3c')]));_0x54977b[_0x425e('0x2d')]=_0x54977b[_0x425e('0x2d')]['length']?_0x54977b[_0x425e('0x2d')]:_0x2a50ba[_0x425e('0x2a')];if(!_0x3d225a[_0x425e('0x24')][_0x425e('0x3d')]('nolimit')){_0x54977b[_0x425e('0x3e')]=qs[_0x425e('0x3e')](_0x3d225a[_0x425e('0x24')][_0x425e('0x3e')]);_0x54977b[_0x425e('0x13')]=qs[_0x425e('0x13')](_0x3d225a[_0x425e('0x24')][_0x425e('0x13')]);}_0x54977b[_0x425e('0x3f')]=qs[_0x425e('0x40')](_0x3d225a['query'][_0x425e('0x40')]);_0x54977b[_0x425e('0x41')]=qs[_0x425e('0x2c')](_['pick'](_0x3d225a['query'],_0x2a50ba[_0x425e('0x2c')]));_0x54977b[_0x425e('0x41')][_0x425e('0x42')]=_0x426e68['id'];if(_0x3d225a[_0x425e('0x24')][_0x425e('0x43')]){_0x54977b[_0x425e('0x41')]=_[_0x425e('0x30')](_0x54977b['where'],{'$or':_['map'](_0x54977b[_0x425e('0x2d')],function(_0x857bd5){var _0x3221fb={};_0x3221fb[_0x857bd5]={'$like':'%'+_0x3d225a[_0x425e('0x24')][_0x425e('0x43')]+'%'};return _0x3221fb;})});}if(_0x3d225a[_0x425e('0x24')][_0x425e('0x44')]){var _0x2b29d2=_0x3d225a[_0x425e('0x24')]['$gte']['split'](',');var _0x435b88={};_0x435b88[_0x2b29d2[0x0]]={'$gte':moment(_0x2b29d2[0x1])['format'](_0x425e('0x45'))};_0x54977b['where']=_['merge'](_0x54977b[_0x425e('0x41')],_0x435b88);}_0x54977b=_[_0x425e('0x30')]({},_0x54977b,_0x3d225a[_0x425e('0x31')]);return db[_0x425e('0x37')][_0x425e('0x14')]({'where':_0x54977b[_0x425e('0x41')]})['then'](function(_0x1de044){_0x3e4136[_0x425e('0x14')]=_0x1de044;if(_0x3d225a['query'][_0x425e('0x2f')]){_0x54977b[_0x425e('0x46')]=[{'all':!![]}];}return db[_0x425e('0x37')][_0x425e('0x47')](_0x54977b);})[_0x425e('0x18')](function(_0x90a80c){_0x3e4136[_0x425e('0x48')]=_0x90a80c;return _0x3e4136;});}})[_0x425e('0x18')](respondWithFilteredResult(_0x3f46e9,_0x54977b))[_0x425e('0x26')](handleError(_0x3f46e9,null));};exports[_0x425e('0x49')]=function(_0x14f697,_0x47749e){return db['OpenchannelInteraction'][_0x425e('0x34')]({'where':{'id':_0x14f697[_0x425e('0x29')]['id']}})[_0x425e('0x18')](handleEntityNotFound(_0x47749e,null))['then'](function(_0x43a874){if(_0x43a874){return _0x43a874[_0x425e('0x4a')](_0x14f697[_0x425e('0x33')][_0x425e('0x38')],_[_0x425e('0x39')](_0x14f697[_0x425e('0x33')],[_0x425e('0x38'),'id'])||{})['spread'](function(){return db['Tag']['findAll']({'attributes':['id',_0x425e('0x1c'),_0x425e('0x4b')],'where':{'id':_0x14f697[_0x425e('0x33')][_0x425e('0x38')]}});})[_0x425e('0x18')](function(_0x516323){socket['emit'](_0x425e('0x4c'),{'id':Number(_0x14f697[_0x425e('0x29')]['id']),'tags':_0x516323||[]});return{'id':Number(_0x14f697[_0x425e('0x29')]['id']),'tags':_0x516323||[]};});}})[_0x425e('0x18')](respondWithResult(_0x47749e,null))[_0x425e('0x26')](handleError(_0x47749e,null));};exports[_0x425e('0x4d')]=function(_0x50848d,_0x2abacd){return db[_0x425e('0x1f')][_0x425e('0x34')]({'where':{'id':_0x50848d[_0x425e('0x29')]['id']}})[_0x425e('0x18')](handleEntityNotFound(_0x2abacd,null))['then'](function(_0xbaa449){if(_0xbaa449){return _0xbaa449['removeTags'](_0x50848d[_0x425e('0x24')][_0x425e('0x38')]);}})[_0x425e('0x18')](respondWithStatusCode(_0x2abacd,null))['catch'](handleError(_0x2abacd,null));};exports[_0x425e('0x4e')]=function(_0x2d49cc,_0x24abb5){var _0x11dc09=moment()[_0x425e('0x4f')]()[_0x425e('0x50')]();var _0x30d9c3=path[_0x425e('0x51')](config['root'],_0x425e('0x52'),'files','tmp');var _0x25065a=path[_0x425e('0x51')](config[_0x425e('0x53')],_0x425e('0x52'),_0x425e('0x54'),'attachments');var _0x4d8f6f=path[_0x425e('0x51')](_0x30d9c3,_0x11dc09);var _0x24cef5=util['format'](_0x425e('0x55'),_0x2d49cc['params']['id'],_0x11dc09);var _0x4765db=path[_0x425e('0x51')](_0x30d9c3,_0x24cef5);var _0x53d918=[];_0x53d918[_0x425e('0x56')]({'model':db[_0x425e('0x57')],'as':_0x425e('0x57'),'attributes':['id',_0x425e('0x58')],'raw':!![]});_0x53d918['push']({'model':db[_0x425e('0x59')],'as':_0x425e('0x5a'),'attributes':['id',_0x425e('0x5b'),_0x425e('0x5c')],'raw':!![]});if(_0x2d49cc[_0x425e('0x24')][_0x425e('0x5d')]){_0x53d918[_0x425e('0x56')]({'model':db['Attachment'],'as':_0x425e('0x5e'),'raw':!![]});}var _0x3b83a8=[{'model':db[_0x425e('0x37')],'as':_0x425e('0x5f'),'attributes':['id','body',_0x425e('0x60'),_0x425e('0x61'),_0x425e('0x62'),'read'],'include':_0x53d918}];_0x3b83a8[_0x425e('0x56')]({'model':db[_0x425e('0x63')],'as':_0x425e('0x64'),'attributes':['id','name']});_0x3b83a8[_0x425e('0x56')]({'model':db[_0x425e('0x57')],'as':_0x425e('0x65'),'attributes':['id',_0x425e('0x58')]});return db[_0x425e('0x1f')][_0x425e('0x34')]({'where':{'id':_0x2d49cc['params']['id']},'include':_0x3b83a8})['then'](handleEntityNotFound(_0x24abb5,null))['then'](function(_0x3c4bd2){if(_0x3c4bd2){var _0x3a172f=_0x3c4bd2[_0x425e('0x66')]({'plain':!![]});fs['mkdirSync'](_0x4d8f6f);var _0x4ee437={'channel':_0x425e('0x67'),'account':_0x3a172f[_0x425e('0x64')][_0x425e('0x1c')],'agent':_0x3a172f[_0x425e('0x65')]?_0x3a172f['Owner'][_0x425e('0x58')]:'N.A.','createdAt':moment(_0x3a172f[_0x425e('0x60')])['format'](_0x425e('0x45'))[_0x425e('0x50')](),'closedAt':_0x3a172f['closed']?moment(_0x3a172f[_0x425e('0x68')])[_0x425e('0x69')](_0x425e('0x45'))[_0x425e('0x50')]():'','disposition':_0x3a172f['disposition'],'visibility':_0x3a172f[_0x425e('0x6a')]?_0x425e('0x6b'):_0x425e('0x6c'),'messages':_(_0x3a172f['Messages'])[_0x425e('0x43')]({'secret':![]})[_0x425e('0x6d')](function(_0x4f8063){if(_0x4f8063[_0x425e('0x5e')]){var _0x513b01=path[_0x425e('0x51')](_0x25065a,_0x4f8063[_0x425e('0x5e')]['basename']);if(fs[_0x425e('0x6e')](_0x513b01)){fs[_0x425e('0x6f')](_0x513b01)[_0x425e('0x70')](fs[_0x425e('0x71')](path[_0x425e('0x51')](_0x4d8f6f,_0x4f8063[_0x425e('0x5e')][_0x425e('0x72')])));}}return{'date':moment(_0x4f8063[_0x425e('0x60')])['format'](_0x425e('0x45'))[_0x425e('0x50')](),'sender':_0x4f8063['direction']===_0x425e('0x73')?_0x4f8063['User']?_0x4f8063[_0x425e('0x57')]['fullname']:_0x425e('0x74'):_0x4f8063['Contact'][_0x425e('0x5b')]+(_0x4f8063[_0x425e('0x5a')]['lastName']?'\x20'+_0x4f8063[_0x425e('0x5a')]['lastName']:''),'body':_0x4f8063[_0x425e('0x5e')]?_0x4f8063['Attachment'][_0x425e('0x72')]:_0x4f8063[_0x425e('0x33')],'direction':_0x4f8063[_0x425e('0x61')]===_0x425e('0x73')?'A':'C','secret':_0x4f8063['secret'],'read':_0x4f8063[_0x425e('0x75')],'attachment':_0x4f8063[_0x425e('0x5e')]};})['value']()};return ejs[_0x425e('0x76')](path[_0x425e('0x51')](config[_0x425e('0x53')],'server',_0x425e('0x77'),_0x425e('0x78')),{'interaction':_0x4ee437})['then'](function(_0x30dd61){var _0x23cda5=path[_0x425e('0x51')](_0x4d8f6f,_0x425e('0x79')+_0x3a172f['id']+'-'+_0x11dc09+_0x425e('0x7a'));var _0x18b52d={'path':_0x23cda5,'channel':_0x425e('0x67'),'interactionId':_0x3a172f['id']};return pdf[_0x425e('0x7b')](_0x30dd61,_0x18b52d);})['then'](function(){return new Promise(function(_0x561849,_0x2615a9){zipdir(_0x4d8f6f,{'saveTo':_0x4765db},function(_0x283f11,_0x4e7e3c){if(_0x283f11)return _0x2615a9(_0x283f11);return _0x561849(_0x4e7e3c);});})['then'](function(){return new Promise(function(_0x3a9858,_0x1069d6){rimraf(_0x4d8f6f,function(_0x821a60){if(_0x821a60)_0x1069d6(_0x821a60);return _0x3a9858();});});})[_0x425e('0x18')](function(){return _0x24abb5[_0x425e('0x4e')](_0x4765db,_0x24cef5,function(_0x50c7e3){if(_0x50c7e3){logger[_0x425e('0x1a')]('Unable\x20to\x20delete\x20zip\x20file',_0x50c7e3);}else{fs[_0x425e('0x7c')](_0x4765db);}});});});}else{return _0x24abb5[_0x425e('0xf')](0xc8);}})['catch'](handleError(_0x24abb5,null));}; \ No newline at end of file +var _0x3d8a=['then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','openchannel','query','user','show','from','params','keys','filters','intersection','attributes','model','fields','length','includeAll','merge','options','OpenchannelInteraction','find','catch','create','body','describe','addMessage','OpenchannelMessage','ids','omit','getMessages','findOne','hasOwnProperty','nolimit','order','sort','where','pick','OpenchannelInteractionId','filter','$gte','YYYY-MM-DD\x20HH:mm:ss','include','rows','addTags','spread','color','emit','removeTags','download','join','root','server','files','attachments','format','transcript-%d-%s.zip','User','fullname','push','CmContact','Contact','lastName','Attachment','Messages','createdAt','read','Account','Owner','get','mkdirSync','Openchannel','N.A.','closed','closedAt','toString','disposition','threadId','Public','Private','basename','existsSync','createReadStream','pipe','createWriteStream','direction','out','System','firstName','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','Unable\x20to\x20delete\x20zip\x20file','unlinkSync','rimraf','zip-dir','moment','util','path','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','register','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','update'];(function(_0x2e38e4,_0x142005){var _0x2de619=function(_0x5f5bda){while(--_0x5f5bda){_0x2e38e4['push'](_0x2e38e4['shift']());}};_0x2de619(++_0x142005);}(_0x3d8a,0x16a));var _0xa3d8=function(_0x5767c6,_0x41cd86){_0x5767c6=_0x5767c6-0x0;var _0x4e02a6=_0x3d8a[_0x5767c6];return _0x4e02a6;};'use strict';var rimraf=require(_0xa3d8('0x0'));var zipdir=require(_0xa3d8('0x1'));var moment=require(_0xa3d8('0x2'));var util=require(_0xa3d8('0x3'));var path=require(_0xa3d8('0x4'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var Redis=require(_0xa3d8('0x5'));var interaction=require(_0xa3d8('0x6'));var qs=require(_0xa3d8('0x7'));var pdf=require('../../components/export/pdf');var logger=require(_0xa3d8('0x8'))('api');var config=require(_0xa3d8('0x9'));var db=require(_0xa3d8('0xa'))['db'];config[_0xa3d8('0xb')]=_[_0xa3d8('0xc')](config[_0xa3d8('0xb')],{'host':_0xa3d8('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa3d8('0xb')]));require('./openchannelInteraction.socket')[_0xa3d8('0xe')](socket);function respondWithStatusCode(_0x58579f,_0x1415dd){_0x1415dd=_0x1415dd||0xcc;return function(_0x1d8634){if(_0x1d8634){return _0x58579f[_0xa3d8('0xf')](_0x1415dd);}return _0x58579f['status'](_0x1415dd)[_0xa3d8('0x10')]();};}function respondWithResult(_0x4ffd7a,_0x592f63){_0x592f63=_0x592f63||0xc8;return function(_0x59d431){if(_0x59d431){return _0x4ffd7a[_0xa3d8('0x11')](_0x592f63)[_0xa3d8('0x12')](_0x59d431);}};}function respondWithFilteredResult(_0x30d7cf,_0x4c4cd9){return function(_0x3cc058){if(_0x3cc058){var _0x5eb675=typeof _0x4c4cd9[_0xa3d8('0x13')]===_0xa3d8('0x14')&&typeof _0x4c4cd9[_0xa3d8('0x15')]===_0xa3d8('0x14');var _0x1ba779=_0x3cc058['count'];var _0x230f37=_0x5eb675?0x0:_0x4c4cd9[_0xa3d8('0x13')];var _0x47aa05=_0x5eb675?_0x3cc058[_0xa3d8('0x16')]:_0x4c4cd9[_0xa3d8('0x13')]+_0x4c4cd9[_0xa3d8('0x15')];var _0x1b8e07;if(_0x47aa05>=_0x1ba779){_0x47aa05=_0x1ba779;_0x1b8e07=0xc8;}else{_0x1b8e07=0xce;}_0x30d7cf[_0xa3d8('0x11')](_0x1b8e07);return _0x30d7cf['set'](_0xa3d8('0x17'),_0x230f37+'-'+_0x47aa05+'/'+_0x1ba779)[_0xa3d8('0x12')](_0x3cc058);}return null;};}function saveUpdates(_0x826cd9){return function(_0x3b84a2){if(_0x3b84a2){return _0x3b84a2[_0xa3d8('0x18')](_0x826cd9)[_0xa3d8('0x19')](function(_0x446368){return _0x446368;});}return null;};}function removeEntity(_0x2f1eb9){return function(_0x42e494){if(_0x42e494){return _0x42e494[_0xa3d8('0x1a')]()[_0xa3d8('0x19')](function(){_0x2f1eb9[_0xa3d8('0x11')](0xcc)[_0xa3d8('0x10')]();});}};}function handleEntityNotFound(_0x429cce){return function(_0x486175){if(!_0x486175){_0x429cce[_0xa3d8('0xf')](0x194);}return _0x486175;};}function handleError(_0x43cb94,_0x4d32c8){_0x4d32c8=_0x4d32c8||0x1f4;return function(_0x22b1df){logger[_0xa3d8('0x1b')](_0x22b1df[_0xa3d8('0x1c')]);if(_0x22b1df['name']){delete _0x22b1df[_0xa3d8('0x1d')];}_0x43cb94[_0xa3d8('0x11')](_0x4d32c8)[_0xa3d8('0x1e')](_0x22b1df);};}exports[_0xa3d8('0x1f')]=function(_0x4fe393,_0x4d9056){var _0x5ca340={};var _0x49a1e3=_[_0xa3d8('0x20')](db['OpenchannelInteraction'][_0xa3d8('0x21')],function(_0x39ee12){return{'name':_0x39ee12[_0xa3d8('0x22')],'type':_0x39ee12[_0xa3d8('0x23')][_0xa3d8('0x24')]};});_0x5ca340=qs['getOptions'](_0x49a1e3,_0x4fe393);return interaction['findAll'](_0xa3d8('0x25'),_0x4fe393[_0xa3d8('0x26')],_0x4fe393[_0xa3d8('0x27')],_0x5ca340,_0x49a1e3)['then'](respondWithFilteredResult(_0x4d9056,_0x5ca340))['catch'](handleError(_0x4d9056,null));};exports[_0xa3d8('0x28')]=function(_0xd5b9a0,_0xdadf3){var _0x5cdbff={};if(_0xd5b9a0[_0xa3d8('0x26')][_0xa3d8('0x23')]&&_0xd5b9a0[_0xa3d8('0x26')][_0xa3d8('0x23')]===_0xa3d8('0x29')){_0x5cdbff[_0xa3d8('0x29')]=_0xd5b9a0[_0xa3d8('0x2a')]['id'];}else{_0x5cdbff['id']=_0xd5b9a0[_0xa3d8('0x2a')]['id'];}var _0x931d6d={'raw':![],'where':_0x5cdbff},_0x37eb18={};_0x37eb18['model']=_['keys'](db['OpenchannelInteraction']['rawAttributes']);_0x37eb18[_0xa3d8('0x26')]=_[_0xa3d8('0x2b')](_0xd5b9a0[_0xa3d8('0x26')]);_0x37eb18[_0xa3d8('0x2c')]=_[_0xa3d8('0x2d')](_0x37eb18['model'],_0x37eb18[_0xa3d8('0x26')]);_0x931d6d[_0xa3d8('0x2e')]=_['intersection'](_0x37eb18[_0xa3d8('0x2f')],qs['fields'](_0xd5b9a0[_0xa3d8('0x26')][_0xa3d8('0x30')]));_0x931d6d[_0xa3d8('0x2e')]=_0x931d6d['attributes'][_0xa3d8('0x31')]?_0x931d6d[_0xa3d8('0x2e')]:_0x37eb18['model'];if(_0xd5b9a0['query'][_0xa3d8('0x32')]){_0x931d6d['include']=[{'all':!![]}];}_0x931d6d=_[_0xa3d8('0x33')]({},_0x931d6d,_0xd5b9a0[_0xa3d8('0x34')]);return db[_0xa3d8('0x35')][_0xa3d8('0x36')](_0x931d6d)['then'](handleEntityNotFound(_0xdadf3,null))[_0xa3d8('0x19')](respondWithResult(_0xdadf3,null))[_0xa3d8('0x37')](handleError(_0xdadf3,null));};exports[_0xa3d8('0x38')]=function(_0x2e3cab,_0x1a4bb8){return db[_0xa3d8('0x35')]['create'](_0x2e3cab[_0xa3d8('0x39')],{})[_0xa3d8('0x19')](respondWithResult(_0x1a4bb8,0xc9))['catch'](handleError(_0x1a4bb8,null));};exports[_0xa3d8('0x18')]=function(_0xc9eaad,_0x165686){if(_0xc9eaad[_0xa3d8('0x39')]['id']){delete _0xc9eaad['body']['id'];}return db[_0xa3d8('0x35')][_0xa3d8('0x36')]({'where':{'id':_0xc9eaad[_0xa3d8('0x2a')]['id']}})[_0xa3d8('0x19')](handleEntityNotFound(_0x165686,null))[_0xa3d8('0x19')](saveUpdates(_0xc9eaad[_0xa3d8('0x39')],null))[_0xa3d8('0x19')](respondWithResult(_0x165686,null))['catch'](handleError(_0x165686,null));};exports[_0xa3d8('0x1a')]=function(_0x1654ff,_0x3a592d){return db[_0xa3d8('0x35')][_0xa3d8('0x36')]({'where':{'id':_0x1654ff[_0xa3d8('0x2a')]['id']}})['then'](handleEntityNotFound(_0x3a592d,null))['then'](removeEntity(_0x3a592d,null))[_0xa3d8('0x37')](handleError(_0x3a592d,null));};exports[_0xa3d8('0x3a')]=function(_0x2621e4,_0x390dd9){return db[_0xa3d8('0x35')][_0xa3d8('0x3a')]()['then'](respondWithResult(_0x390dd9,null))['catch'](handleError(_0x390dd9,null));};exports[_0xa3d8('0x3b')]=function(_0x198259,_0x549a68){return db[_0xa3d8('0x3c')][_0xa3d8('0x36')]({'where':{'id':_0x198259[_0xa3d8('0x2a')]['id']}})[_0xa3d8('0x19')](handleEntityNotFound(_0x549a68,null))[_0xa3d8('0x19')](function(_0x5c73f1){if(_0x5c73f1){return _0x5c73f1[_0xa3d8('0x3b')](_0x198259[_0xa3d8('0x39')][_0xa3d8('0x3d')],_[_0xa3d8('0x3e')](_0x198259[_0xa3d8('0x39')],[_0xa3d8('0x3d'),'id'])||{});}})[_0xa3d8('0x19')](respondWithResult(_0x549a68,null))[_0xa3d8('0x37')](handleError(_0x549a68,null));};exports[_0xa3d8('0x3f')]=function(_0x22b84f,_0x222e87){var _0x527317={'raw':![],'where':{}};var _0x2ed310={};var _0x33636d={'count':0x0,'rows':[]};return db[_0xa3d8('0x35')][_0xa3d8('0x40')]({'where':{'id':_0x22b84f[_0xa3d8('0x2a')]['id']}})[_0xa3d8('0x19')](handleEntityNotFound(_0x222e87,null))['then'](function(_0x163c83){if(_0x163c83){_0x2ed310[_0xa3d8('0x2f')]=_[_0xa3d8('0x2b')](db[_0xa3d8('0x3c')][_0xa3d8('0x21')]);_0x2ed310[_0xa3d8('0x26')]=_[_0xa3d8('0x2b')](_0x22b84f[_0xa3d8('0x26')]);_0x2ed310[_0xa3d8('0x2c')]=_[_0xa3d8('0x2d')](_0x2ed310[_0xa3d8('0x2f')],_0x2ed310[_0xa3d8('0x26')]);_0x527317[_0xa3d8('0x2e')]=_[_0xa3d8('0x2d')](_0x2ed310[_0xa3d8('0x2f')],qs[_0xa3d8('0x30')](_0x22b84f['query'][_0xa3d8('0x30')]));_0x527317[_0xa3d8('0x2e')]=_0x527317[_0xa3d8('0x2e')][_0xa3d8('0x31')]?_0x527317[_0xa3d8('0x2e')]:_0x2ed310[_0xa3d8('0x2f')];if(!_0x22b84f['query'][_0xa3d8('0x41')](_0xa3d8('0x42'))){_0x527317[_0xa3d8('0x15')]=qs[_0xa3d8('0x15')](_0x22b84f[_0xa3d8('0x26')]['limit']);_0x527317[_0xa3d8('0x13')]=qs['offset'](_0x22b84f[_0xa3d8('0x26')]['offset']);}_0x527317[_0xa3d8('0x43')]=qs[_0xa3d8('0x44')](_0x22b84f[_0xa3d8('0x26')]['sort']);_0x527317[_0xa3d8('0x45')]=qs['filters'](_[_0xa3d8('0x46')](_0x22b84f[_0xa3d8('0x26')],_0x2ed310['filters']));_0x527317[_0xa3d8('0x45')][_0xa3d8('0x47')]=_0x163c83['id'];if(_0x22b84f[_0xa3d8('0x26')][_0xa3d8('0x48')]){_0x527317[_0xa3d8('0x45')]=_['merge'](_0x527317[_0xa3d8('0x45')],{'$or':_[_0xa3d8('0x20')](_0x527317[_0xa3d8('0x2e')],function(_0x2f267f){var _0x3b7f35={};_0x3b7f35[_0x2f267f]={'$like':'%'+_0x22b84f[_0xa3d8('0x26')][_0xa3d8('0x48')]+'%'};return _0x3b7f35;})});}if(_0x22b84f[_0xa3d8('0x26')][_0xa3d8('0x49')]){var _0x24feb7=_0x22b84f['query'][_0xa3d8('0x49')]['split'](',');var _0x1659d8={};_0x1659d8[_0x24feb7[0x0]]={'$gte':moment(_0x24feb7[0x1])['format'](_0xa3d8('0x4a'))};_0x527317[_0xa3d8('0x45')]=_[_0xa3d8('0x33')](_0x527317[_0xa3d8('0x45')],_0x1659d8);}_0x527317=_[_0xa3d8('0x33')]({},_0x527317,_0x22b84f[_0xa3d8('0x34')]);return db[_0xa3d8('0x3c')][_0xa3d8('0x16')]({'where':_0x527317['where']})[_0xa3d8('0x19')](function(_0x410138){_0x33636d['count']=_0x410138;if(_0x22b84f[_0xa3d8('0x26')]['includeAll']){_0x527317[_0xa3d8('0x4b')]=[{'all':!![]}];}return db[_0xa3d8('0x3c')]['findAll'](_0x527317);})[_0xa3d8('0x19')](function(_0x54525d){_0x33636d[_0xa3d8('0x4c')]=_0x54525d;return _0x33636d;});}})[_0xa3d8('0x19')](respondWithFilteredResult(_0x222e87,_0x527317))[_0xa3d8('0x37')](handleError(_0x222e87,null));};exports[_0xa3d8('0x4d')]=function(_0x40d1ab,_0x5d5139){return db[_0xa3d8('0x35')][_0xa3d8('0x36')]({'where':{'id':_0x40d1ab[_0xa3d8('0x2a')]['id']}})['then'](handleEntityNotFound(_0x5d5139,null))['then'](function(_0xb013c){if(_0xb013c){return _0xb013c['setTags'](_0x40d1ab[_0xa3d8('0x39')][_0xa3d8('0x3d')],_[_0xa3d8('0x3e')](_0x40d1ab[_0xa3d8('0x39')],[_0xa3d8('0x3d'),'id'])||{})[_0xa3d8('0x4e')](function(){return db['Tag']['findAll']({'attributes':['id','name',_0xa3d8('0x4f')],'where':{'id':_0x40d1ab['body'][_0xa3d8('0x3d')]}});})['then'](function(_0xde3a58){socket[_0xa3d8('0x50')]('openchannelInteractionTags:save',{'id':Number(_0x40d1ab['params']['id']),'tags':_0xde3a58||[]});return{'id':Number(_0x40d1ab['params']['id']),'tags':_0xde3a58||[]};});}})[_0xa3d8('0x19')](respondWithResult(_0x5d5139,null))[_0xa3d8('0x37')](handleError(_0x5d5139,null));};exports['removeTags']=function(_0x1433e1,_0x50eed0){return db[_0xa3d8('0x35')]['find']({'where':{'id':_0x1433e1['params']['id']}})[_0xa3d8('0x19')](handleEntityNotFound(_0x50eed0,null))[_0xa3d8('0x19')](function(_0xc415a0){if(_0xc415a0){return _0xc415a0[_0xa3d8('0x51')](_0x1433e1[_0xa3d8('0x26')][_0xa3d8('0x3d')]);}})['then'](respondWithStatusCode(_0x50eed0,null))[_0xa3d8('0x37')](handleError(_0x50eed0,null));};exports[_0xa3d8('0x52')]=function(_0x3ffdd3,_0xb3e73f){var _0x17f59f=moment()['unix']()['toString']();var _0x27f86b=path[_0xa3d8('0x53')](config[_0xa3d8('0x54')],_0xa3d8('0x55'),_0xa3d8('0x56'),'tmp');var _0x9c1b5f=path[_0xa3d8('0x53')](config[_0xa3d8('0x54')],_0xa3d8('0x55'),_0xa3d8('0x56'),_0xa3d8('0x57'));var _0x468649=path['join'](_0x27f86b,_0x17f59f);var _0x3de8a7=util[_0xa3d8('0x58')](_0xa3d8('0x59'),_0x3ffdd3['params']['id'],_0x17f59f);var _0x11b92d=path['join'](_0x27f86b,_0x3de8a7);var _0x396b43=[];_0x396b43['push']({'model':db[_0xa3d8('0x5a')],'as':'User','attributes':['id',_0xa3d8('0x5b')],'raw':!![]});_0x396b43[_0xa3d8('0x5c')]({'model':db[_0xa3d8('0x5d')],'as':_0xa3d8('0x5e'),'attributes':['id','firstName',_0xa3d8('0x5f')],'raw':!![]});if(_0x3ffdd3[_0xa3d8('0x26')][_0xa3d8('0x57')]){_0x396b43[_0xa3d8('0x5c')]({'model':db[_0xa3d8('0x60')],'as':_0xa3d8('0x60'),'raw':!![]});}var _0x59a7cb=[{'model':db['OpenchannelMessage'],'as':_0xa3d8('0x61'),'attributes':['id','body',_0xa3d8('0x62'),'direction','secret',_0xa3d8('0x63')],'include':_0x396b43}];_0x59a7cb[_0xa3d8('0x5c')]({'model':db['OpenchannelAccount'],'as':_0xa3d8('0x64'),'attributes':['id',_0xa3d8('0x1d')]});_0x59a7cb['push']({'model':db[_0xa3d8('0x5a')],'as':_0xa3d8('0x65'),'attributes':['id',_0xa3d8('0x5b')]});return db[_0xa3d8('0x35')][_0xa3d8('0x36')]({'where':{'id':_0x3ffdd3[_0xa3d8('0x2a')]['id']},'include':_0x59a7cb})[_0xa3d8('0x19')](handleEntityNotFound(_0xb3e73f,null))[_0xa3d8('0x19')](function(_0x29dc79){if(_0x29dc79){var _0x542183=_0x29dc79[_0xa3d8('0x66')]({'plain':!![]});fs[_0xa3d8('0x67')](_0x468649);var _0x564de4={'channel':_0xa3d8('0x68'),'account':_0x542183['Account'][_0xa3d8('0x1d')],'agent':_0x542183['Owner']?_0x542183[_0xa3d8('0x65')]['fullname']:_0xa3d8('0x69'),'createdAt':moment(_0x542183[_0xa3d8('0x62')])[_0xa3d8('0x58')](_0xa3d8('0x4a'))['toString'](),'closedAt':_0x542183[_0xa3d8('0x6a')]?moment(_0x542183[_0xa3d8('0x6b')])[_0xa3d8('0x58')](_0xa3d8('0x4a'))[_0xa3d8('0x6c')]():'','disposition':_0x542183[_0xa3d8('0x6d')],'visibility':_0x542183[_0xa3d8('0x6e')]?_0xa3d8('0x6f'):_0xa3d8('0x70'),'messages':_(_0x542183['Messages'])[_0xa3d8('0x48')]({'secret':![]})['map'](function(_0x3228c2){if(_0x3228c2['Attachment']){var _0x295ecc=path[_0xa3d8('0x53')](_0x9c1b5f,_0x3228c2[_0xa3d8('0x60')][_0xa3d8('0x71')]);if(fs[_0xa3d8('0x72')](_0x295ecc)){fs[_0xa3d8('0x73')](_0x295ecc)[_0xa3d8('0x74')](fs[_0xa3d8('0x75')](path['join'](_0x468649,_0x3228c2[_0xa3d8('0x60')][_0xa3d8('0x71')])));}}return{'date':moment(_0x3228c2[_0xa3d8('0x62')])['format'](_0xa3d8('0x4a'))['toString'](),'sender':_0x3228c2[_0xa3d8('0x76')]===_0xa3d8('0x77')?_0x3228c2[_0xa3d8('0x5a')]?_0x3228c2[_0xa3d8('0x5a')][_0xa3d8('0x5b')]:_0xa3d8('0x78'):_0x3228c2[_0xa3d8('0x5e')][_0xa3d8('0x79')]+(_0x3228c2[_0xa3d8('0x5e')][_0xa3d8('0x5f')]?'\x20'+_0x3228c2[_0xa3d8('0x5e')][_0xa3d8('0x5f')]:''),'body':_0x3228c2[_0xa3d8('0x60')]?_0x3228c2['Attachment']['basename']:_0x3228c2[_0xa3d8('0x39')],'direction':_0x3228c2[_0xa3d8('0x76')]===_0xa3d8('0x77')?'A':'C','secret':_0x3228c2['secret'],'read':_0x3228c2['read'],'attachment':_0x3228c2[_0xa3d8('0x60')]};})['value']()};return ejs['renderFile'](path[_0xa3d8('0x53')](config[_0xa3d8('0x54')],_0xa3d8('0x55'),_0xa3d8('0x7a'),_0xa3d8('0x7b')),{'interaction':_0x564de4})[_0xa3d8('0x19')](function(_0x57a8f9){var _0x2e1619=path[_0xa3d8('0x53')](_0x468649,_0xa3d8('0x7c')+_0x542183['id']+'-'+_0x17f59f+_0xa3d8('0x7d'));var _0x3ff3de={'path':_0x2e1619,'channel':_0xa3d8('0x68'),'interactionId':_0x542183['id']};return pdf[_0xa3d8('0x7e')](_0x57a8f9,_0x3ff3de);})['then'](function(){return new Promise(function(_0x427022,_0x1e4a46){zipdir(_0x468649,{'saveTo':_0x11b92d},function(_0x2b7f4c,_0x358a8b){if(_0x2b7f4c)return _0x1e4a46(_0x2b7f4c);return _0x427022(_0x358a8b);});})[_0xa3d8('0x19')](function(){return new Promise(function(_0x1a2169,_0x317244){rimraf(_0x468649,function(_0x6b2ff5){if(_0x6b2ff5)_0x317244(_0x6b2ff5);return _0x1a2169();});});})[_0xa3d8('0x19')](function(){return _0xb3e73f[_0xa3d8('0x52')](_0x11b92d,_0x3de8a7,function(_0x5f2cc5){if(_0x5f2cc5){logger[_0xa3d8('0x1b')](_0xa3d8('0x7f'),_0x5f2cc5);}else{fs[_0xa3d8('0x80')](_0x11b92d);}});});});}else{return _0xb3e73f[_0xa3d8('0xf')](0xc8);}})[_0xa3d8('0x37')](handleError(_0xb3e73f,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index 61d5975..f34aaff 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 _0x2664=['length','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelInteraction','setMaxListeners','save','update','remove','getUsers','setDataValue','Users','map'];(function(_0x28e692,_0x248ddb){var _0x485625=function(_0x3cdf6e){while(--_0x3cdf6e){_0x28e692['push'](_0x28e692['shift']());}};_0x485625(++_0x248ddb);}(_0x2664,0x121));var _0x4266=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x2664[_0x432682];return _0x463d05;};'use strict';var EventEmitter=require(_0x4266('0x0'));var OpenchannelInteraction=require(_0x4266('0x1'))['db'][_0x4266('0x2')];var OpenchannelMessage=require(_0x4266('0x1'))['db']['OpenchannelMessage'];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x4266('0x3')](0x0);var events={'afterCreate':_0x4266('0x4'),'afterUpdate':_0x4266('0x5'),'afterDestroy':_0x4266('0x6')};function emitEvent(_0x48ecd5){return function(_0x115997,_0x4bb15f,_0x46e11f){_0x115997[_0x4266('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x50ea25){_0x115997[_0x4266('0x8')](_0x4266('0x9'),_0x50ea25[_0x4266('0xa')](function(_0x1d958a){return{'id':_0x1d958a['id']};}));return OpenchannelMessage['findAll']({'where':{'OpenchannelInteractionId':_0x115997['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x46b572){_0x115997[_0x4266('0x8')]('unreadMessages',_0x46b572[_0x4266('0xb')]);OpenchannelInteractionEvents['emit'](_0x48ecd5+':'+_0x115997['id'],_0x115997);OpenchannelInteractionEvents['emit'](_0x48ecd5,_0x115997);_0x46e11f(null);})['catch'](_0x46e11f(null));};}for(var e in events){if(events[_0x4266('0xc')](e)){var event=events[e];OpenchannelInteraction[_0x4266('0xd')](e,emitEvent(event));}}module[_0x4266('0xe')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0x311e=['length','emit','catch','hasOwnProperty','exports','events','../../mysqldb','OpenchannelInteraction','OpenchannelMessage','setMaxListeners','update','remove','then','setDataValue','Users','map','findAll','unreadMessages'];(function(_0x49075c,_0x338cd1){var _0x26b54a=function(_0x1a5c10){while(--_0x1a5c10){_0x49075c['push'](_0x49075c['shift']());}};_0x26b54a(++_0x338cd1);}(_0x311e,0x101));var _0xe311=function(_0x3561cd,_0x3ac60e){_0x3561cd=_0x3561cd-0x0;var _0x2f498e=_0x311e[_0x3561cd];return _0x2f498e;};'use strict';var EventEmitter=require(_0xe311('0x0'));var OpenchannelInteraction=require(_0xe311('0x1'))['db'][_0xe311('0x2')];var OpenchannelMessage=require(_0xe311('0x1'))['db'][_0xe311('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0xe311('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0xe311('0x5'),'afterDestroy':_0xe311('0x6')};function emitEvent(_0x44ec46){return function(_0x5958f4,_0x3a0e87,_0x30310e){_0x5958f4['getUsers']({'attributes':['id'],'raw':!![]})[_0xe311('0x7')](function(_0x5cfdec){_0x5958f4[_0xe311('0x8')](_0xe311('0x9'),_0x5cfdec[_0xe311('0xa')](function(_0x738369){return{'id':_0x738369['id']};}));return OpenchannelMessage[_0xe311('0xb')]({'where':{'OpenchannelInteractionId':_0x5958f4['id'],'direction':'in','read':![]},'raw':!![]});})[_0xe311('0x7')](function(_0xd03dd){_0x5958f4['setDataValue'](_0xe311('0xc'),_0xd03dd[_0xe311('0xd')]);OpenchannelInteractionEvents[_0xe311('0xe')](_0x44ec46+':'+_0x5958f4['id'],_0x5958f4);OpenchannelInteractionEvents['emit'](_0x44ec46,_0x5958f4);_0x30310e(null);})[_0xe311('0xf')](_0x30310e(null));};}for(var e in events){if(events[_0xe311('0x10')](e)){var event=events[e];OpenchannelInteraction['hook'](e,emitEvent(event));}}module[_0xe311('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 25811e3..9a90daa 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 _0x3441=['path','rimraf','../../config/environment','./openchannelInteraction.attributes','exports','OpenchannelInteraction','utf8mb4_unicode_ci','changed','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x3441,0xf9));var _0x1344=function(_0x17325e,_0x5863f2){_0x17325e=_0x17325e-0x0;var _0x51062a=_0x3441[_0x17325e];return _0x51062a;};'use strict';var _=require(_0x1344('0x0'));var util=require('util');var logger=require(_0x1344('0x1'))(_0x1344('0x2'));var moment=require(_0x1344('0x3'));var BPromise=require(_0x1344('0x4'));var rp=require(_0x1344('0x5'));var fs=require('fs');var path=require(_0x1344('0x6'));var rimraf=require(_0x1344('0x7'));var config=require(_0x1344('0x8'));var attributes=require(_0x1344('0x9'));module[_0x1344('0xa')]=function(_0x29a2af,_0x3292aa){return _0x29a2af['define'](_0x1344('0xb'),attributes,{'tableName':'openchannel_interactions','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x1344('0xc'),'hooks':{'beforeUpdate':function(_0x2cd767,_0x1dd2cc,_0x5d3e51){if(_0x2cd767[_0x1344('0xd')]('closed')){_0x2cd767['closedAt']=moment()['format'](_0x1344('0xe'));}_0x5d3e51(null,_0x2cd767);}}});}; \ No newline at end of file +var _0x510c=['path','../../config/environment','./openchannelInteraction.attributes','define','OpenchannelInteraction','openchannel_interactions','utf8mb4','utf8mb4_unicode_ci','closedAt','format','util','../../config/logger','bluebird','request-promise'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x510c,0x88));var _0xc510=function(_0x1e5e66,_0x3bdc13){_0x1e5e66=_0x1e5e66-0x0;var _0x4307e8=_0x510c[_0x1e5e66];return _0x4307e8;};'use strict';var _=require('lodash');var util=require(_0xc510('0x0'));var logger=require(_0xc510('0x1'))('api');var moment=require('moment');var BPromise=require(_0xc510('0x2'));var rp=require(_0xc510('0x3'));var fs=require('fs');var path=require(_0xc510('0x4'));var rimraf=require('rimraf');var config=require(_0xc510('0x5'));var attributes=require(_0xc510('0x6'));module['exports']=function(_0x58ccec,_0x10a220){return _0x58ccec[_0xc510('0x7')](_0xc510('0x8'),attributes,{'tableName':_0xc510('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc510('0xa'),'collate':_0xc510('0xb'),'hooks':{'beforeUpdate':function(_0x4f1d76,_0x5b4163,_0x3d3fa3){if(_0x4f1d76['changed']('closed')){_0x4f1d76[_0xc510('0xc')]=moment()[_0xc510('0xd')]('YYYY-MM-DD\x20HH:mm:ss');}_0x3d3fa3(null,_0x4f1d76);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 16cfa0d..facaac1 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 _0x8d3f=['redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','register','request','then','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','OpenchannelInteraction','update','body','options','where','attributes','UpdateOpenchannelInteraction','debug','stringify','find','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8d3f,0x120));var _0xf8d3=function(_0x58722d,_0x139d86){_0x58722d=_0x58722d-0x0;var _0x1f8a71=_0x8d3f[_0x58722d];return _0x1f8a71;};'use strict';var _=require(_0xf8d3('0x0'));var util=require(_0xf8d3('0x1'));var moment=require(_0xf8d3('0x2'));var BPromise=require(_0xf8d3('0x3'));var rs=require(_0xf8d3('0x4'));var fs=require('fs');var Redis=require(_0xf8d3('0x5'));var db=require(_0xf8d3('0x6'))['db'];var utils=require(_0xf8d3('0x7'));var logger=require(_0xf8d3('0x8'))(_0xf8d3('0x9'));var config=require('../../config/environment');var jayson=require(_0xf8d3('0xa'));var client=jayson[_0xf8d3('0xb')][_0xf8d3('0xc')]({'port':0x232a});config[_0xf8d3('0xd')]=_[_0xf8d3('0xe')](config[_0xf8d3('0xd')],{'host':_0xf8d3('0xf'),'port':0x18eb});var socket=require(_0xf8d3('0x10'))(new Redis(config[_0xf8d3('0xd')]));require(_0xf8d3('0x11'))[_0xf8d3('0x12')](socket);function respondWithRpcPromise(_0x4ea5f2,_0x2619b4,_0x181205){return new BPromise(function(_0x52d7c2,_0x3d6a44){return client[_0xf8d3('0x13')](_0x4ea5f2,_0x181205)[_0xf8d3('0x14')](function(_0x493ebc){logger[_0xf8d3('0x15')](_0xf8d3('0x16'),_0x2619b4,_0xf8d3('0x17'));logger['debug'](_0xf8d3('0x18'),_0x2619b4,_0xf8d3('0x17'),JSON['stringify'](_0x493ebc));if(_0x493ebc['error']){if(_0x493ebc[_0xf8d3('0x19')][_0xf8d3('0x1a')]===0x1f4){logger[_0xf8d3('0x19')](_0xf8d3('0x16'),_0x2619b4,_0x493ebc[_0xf8d3('0x19')][_0xf8d3('0x1b')]);return _0x3d6a44(_0x493ebc[_0xf8d3('0x19')][_0xf8d3('0x1b')]);}logger['error'](_0xf8d3('0x16'),_0x2619b4,_0x493ebc['error'][_0xf8d3('0x1b')]);return _0x52d7c2(_0x493ebc['error']['message']);}else{logger[_0xf8d3('0x15')](_0xf8d3('0x16'),_0x2619b4,_0xf8d3('0x17'));_0x52d7c2(_0x493ebc[_0xf8d3('0x1c')][_0xf8d3('0x1b')]);}})[_0xf8d3('0x1d')](function(_0x4b22ac){logger[_0xf8d3('0x19')]('OpenchannelInteraction,\x20%s,\x20%s',_0x2619b4,_0x4b22ac);_0x3d6a44(_0x4b22ac);});});}exports['UpdateOpenchannelInteraction']=function(_0xabaada){var _0x4bb875=this;return new Promise(function(_0x44b47a,_0x179253){return db[_0xf8d3('0x1e')][_0xf8d3('0x1f')](_0xabaada[_0xf8d3('0x20')],{'raw':_0xabaada['options']?_0xabaada[_0xf8d3('0x21')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xabaada[_0xf8d3('0x21')]?_0xabaada[_0xf8d3('0x21')][_0xf8d3('0x22')]||null:null,'attributes':_0xabaada[_0xf8d3('0x21')]?_0xabaada[_0xf8d3('0x21')][_0xf8d3('0x23')]||null:null,'limit':_0xabaada[_0xf8d3('0x21')]?_0xabaada[_0xf8d3('0x21')]['limit']||null:null})['then'](function(_0x57c6de){logger[_0xf8d3('0x15')](_0xf8d3('0x24'),_0xabaada);logger[_0xf8d3('0x25')](_0xf8d3('0x24'),_0xabaada,JSON[_0xf8d3('0x26')](_0x57c6de));_0x44b47a(_0x57c6de);})[_0xf8d3('0x1d')](function(_0x3d9a2c){logger[_0xf8d3('0x19')](_0xf8d3('0x24'),_0x3d9a2c['message'],_0xabaada);_0x179253(_0x4bb875[_0xf8d3('0x19')](0x1f4,_0x3d9a2c[_0xf8d3('0x1b')]));});});};exports['AddTagsToOpenchannelInteraction']=function(_0x534b67){return new Promise(function(_0x1dd8f6,_0xf9a4a4){return db[_0xf8d3('0x1e')][_0xf8d3('0x27')]({'where':_0x534b67[_0xf8d3('0x21')]?_0x534b67[_0xf8d3('0x21')][_0xf8d3('0x22')]||null:null})[_0xf8d3('0x14')](function(_0x2c3c8f){if(_0x2c3c8f){return _0x2c3c8f['addTags'](_0x534b67[_0xf8d3('0x20')]['ids'],_[_0xf8d3('0x28')](_0x534b67[_0xf8d3('0x20')],['ids','id'])||{});}})[_0xf8d3('0x29')](function(_0x3e183c){logger[_0xf8d3('0x15')](_0xf8d3('0x2a'),_0x534b67);logger[_0xf8d3('0x25')](_0xf8d3('0x2a'),_0x534b67,JSON[_0xf8d3('0x26')](_0x3e183c));_0x1dd8f6(_0x3e183c);})['catch'](function(_0x6b4744){logger[_0xf8d3('0x19')](_0xf8d3('0x2a'),_0x6b4744[_0xf8d3('0x1b')],_0x534b67);_0xf9a4a4(_this[_0xf8d3('0x19')](0x1f4,_0x6b4744[_0xf8d3('0x1b')]));});});}; \ No newline at end of file +var _0xea3e=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','register','then','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','OpenchannelInteraction,\x20%s,\x20%s','result','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','body','options','raw','AddTagsToOpenchannelInteraction','find','addTags','ids','omit','spread','AddTags','util'];(function(_0x57eab0,_0x5dbe67){var _0x4c6cb2=function(_0x253078){while(--_0x253078){_0x57eab0['push'](_0x57eab0['shift']());}};_0x4c6cb2(++_0x5dbe67);}(_0xea3e,0x117));var _0xeea3=function(_0x11d546,_0x4b441a){_0x11d546=_0x11d546-0x0;var _0x23cafc=_0xea3e[_0x11d546];return _0x23cafc;};'use strict';var _=require('lodash');var util=require(_0xeea3('0x0'));var moment=require(_0xeea3('0x1'));var BPromise=require(_0xeea3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xeea3('0x3'));var db=require(_0xeea3('0x4'))['db'];var utils=require(_0xeea3('0x5'));var logger=require('../../config/logger')(_0xeea3('0x6'));var config=require(_0xeea3('0x7'));var jayson=require(_0xeea3('0x8'));var client=jayson[_0xeea3('0x9')][_0xeea3('0xa')]({'port':0x232a});config[_0xeea3('0xb')]=_['defaults'](config['redis'],{'host':_0xeea3('0xc'),'port':0x18eb});var socket=require(_0xeea3('0xd'))(new Redis(config[_0xeea3('0xb')]));require(_0xeea3('0xe'))[_0xeea3('0xf')](socket);function respondWithRpcPromise(_0x5f4cd1,_0x460c92,_0x2d3083){return new BPromise(function(_0x3cc15b,_0xaf2b4){return client['request'](_0x5f4cd1,_0x2d3083)[_0xeea3('0x10')](function(_0x268740){logger['info']('OpenchannelInteraction,\x20%s,\x20%s',_0x460c92,'request\x20sent');logger[_0xeea3('0x11')](_0xeea3('0x12'),_0x460c92,_0xeea3('0x13'),JSON[_0xeea3('0x14')](_0x268740));if(_0x268740[_0xeea3('0x15')]){if(_0x268740[_0xeea3('0x15')][_0xeea3('0x16')]===0x1f4){logger[_0xeea3('0x15')]('OpenchannelInteraction,\x20%s,\x20%s',_0x460c92,_0x268740[_0xeea3('0x15')]['message']);return _0xaf2b4(_0x268740[_0xeea3('0x15')][_0xeea3('0x17')]);}logger[_0xeea3('0x15')]('OpenchannelInteraction,\x20%s,\x20%s',_0x460c92,_0x268740[_0xeea3('0x15')][_0xeea3('0x17')]);return _0x3cc15b(_0x268740[_0xeea3('0x15')][_0xeea3('0x17')]);}else{logger[_0xeea3('0x18')](_0xeea3('0x19'),_0x460c92,_0xeea3('0x13'));_0x3cc15b(_0x268740[_0xeea3('0x1a')][_0xeea3('0x17')]);}})[_0xeea3('0x1b')](function(_0x3caa9f){logger['error'](_0xeea3('0x19'),_0x460c92,_0x3caa9f);_0xaf2b4(_0x3caa9f);});});}exports[_0xeea3('0x1c')]=function(_0x13f412){var _0x41f6c2=this;return new Promise(function(_0x3057fb,_0x3ef600){return db[_0xeea3('0x1d')]['update'](_0x13f412[_0xeea3('0x1e')],{'raw':_0x13f412[_0xeea3('0x1f')]?_0x13f412[_0xeea3('0x1f')][_0xeea3('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x13f412[_0xeea3('0x1f')]?_0x13f412[_0xeea3('0x1f')]['where']||null:null,'attributes':_0x13f412['options']?_0x13f412[_0xeea3('0x1f')]['attributes']||null:null,'limit':_0x13f412[_0xeea3('0x1f')]?_0x13f412[_0xeea3('0x1f')]['limit']||null:null})['then'](function(_0x1e3510){logger[_0xeea3('0x18')](_0xeea3('0x1c'),_0x13f412);logger[_0xeea3('0x11')](_0xeea3('0x1c'),_0x13f412,JSON[_0xeea3('0x14')](_0x1e3510));_0x3057fb(_0x1e3510);})[_0xeea3('0x1b')](function(_0x1e8aec){logger[_0xeea3('0x15')](_0xeea3('0x1c'),_0x1e8aec['message'],_0x13f412);_0x3ef600(_0x41f6c2[_0xeea3('0x15')](0x1f4,_0x1e8aec[_0xeea3('0x17')]));});});};exports[_0xeea3('0x21')]=function(_0x4b0925){return new Promise(function(_0x467565,_0x13c016){return db[_0xeea3('0x1d')][_0xeea3('0x22')]({'where':_0x4b0925[_0xeea3('0x1f')]?_0x4b0925[_0xeea3('0x1f')]['where']||null:null})['then'](function(_0x356665){if(_0x356665){return _0x356665[_0xeea3('0x23')](_0x4b0925['body'][_0xeea3('0x24')],_[_0xeea3('0x25')](_0x4b0925['body'],[_0xeea3('0x24'),'id'])||{});}})[_0xeea3('0x26')](function(_0x2ffee0){logger['info']('AddTags',_0x4b0925);logger['debug']('AddTags',_0x4b0925,JSON[_0xeea3('0x14')](_0x2ffee0));_0x467565(_0x2ffee0);})[_0xeea3('0x1b')](function(_0x533e7e){logger[_0xeea3('0x15')](_0xeea3('0x27'),_0x533e7e[_0xeea3('0x17')],_0x4b0925);_0x13c016(_this[_0xeea3('0x15')](0x1f4,_0x533e7e['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index ac4c098..2804eb2 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 _0x9fe4=['update','removeListener','register','openchannelInteraction:','./openchannelInteraction.events','save','remove'];(function(_0x58cfd1,_0x496c65){var _0x46ed96=function(_0x591208){while(--_0x591208){_0x58cfd1['push'](_0x58cfd1['shift']());}};_0x46ed96(++_0x496c65);}(_0x9fe4,0x1ee));var _0x49fe=function(_0x44880f,_0x1ef6c1){_0x44880f=_0x44880f-0x0;var _0x4f4302=_0x9fe4[_0x44880f];return _0x4f4302;};'use strict';var OpenchannelInteractionEvents=require(_0x49fe('0x0'));var events=[_0x49fe('0x1'),_0x49fe('0x2'),_0x49fe('0x3')];function createListener(_0x20359a,_0xba438b){return function(_0x5212fd){_0xba438b['emit'](_0x20359a,_0x5212fd);};}function removeListener(_0x5f13d5,_0xc187b){return function(){OpenchannelInteractionEvents[_0x49fe('0x4')](_0x5f13d5,_0xc187b);};}exports[_0x49fe('0x5')]=function(_0x4c4b3a){for(var _0x279e0e=0x0,_0x405d24=events['length'];_0x279e0e<_0x405d24;_0x279e0e++){var _0x209d99=events[_0x279e0e];var _0x1f7ae5=createListener(_0x49fe('0x6')+_0x209d99,_0x4c4b3a);OpenchannelInteractionEvents['on'](_0x209d99,_0x1f7ae5);}}; \ No newline at end of file +var _0x526b=['length','remove','update','removeListener'];(function(_0x218ca4,_0x41cc40){var _0x1b3ff9=function(_0x5003cd){while(--_0x5003cd){_0x218ca4['push'](_0x218ca4['shift']());}};_0x1b3ff9(++_0x41cc40);}(_0x526b,0x14d));var _0xb526=function(_0x26b5b7,_0x3c4e24){_0x26b5b7=_0x26b5b7-0x0;var _0x18035a=_0x526b[_0x26b5b7];return _0x18035a;};'use strict';var OpenchannelInteractionEvents=require('./openchannelInteraction.events');var events=['save',_0xb526('0x0'),_0xb526('0x1')];function createListener(_0x3bb149,_0x570b07){return function(_0x10fc67){_0x570b07['emit'](_0x3bb149,_0x10fc67);};}function removeListener(_0x495312,_0x4234c3){return function(){OpenchannelInteractionEvents[_0xb526('0x2')](_0x495312,_0x4234c3);};}exports['register']=function(_0x392d97){for(var _0x15021b=0x0,_0x1da1f1=events[_0xb526('0x3')];_0x15021b<_0x1da1f1;_0x15021b++){var _0x137130=events[_0x15021b];var _0x2a99a6=createListener('openchannelInteraction:'+_0x137130,_0x392d97);OpenchannelInteractionEvents['on'](_0x137130,_0x2a99a6);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index a17150a..5529095 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 _0xa9e0=['index','/describe','show','post','isAuthenticated','tracked','openchannel','openchannelmessage:create','update','put','/:id/accept','accept','reject','delete','/:id','destroy','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelMessage.controller','get'];(function(_0x8ffcd3,_0xb070d4){var _0x11d0c9=function(_0x141d58){while(--_0x141d58){_0x8ffcd3['push'](_0x8ffcd3['shift']());}};_0x11d0c9(++_0xb070d4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0xa9e0[_0x1c546c];return _0x2cc384;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),interaction[_0x0a9e('0xe')](_0x0a9e('0xf'),_0x0a9e('0x10')),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0x11')]);router[_0x0a9e('0x12')](_0x0a9e('0x13'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x14')]);router[_0x0a9e('0x12')]('/:id/reject',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x15')]);router[_0x0a9e('0x16')](_0x0a9e('0x17'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x18')]);module['exports']=router; \ No newline at end of file +var _0xa9e0=['index','/describe','show','post','isAuthenticated','tracked','openchannel','openchannelmessage:create','update','put','/:id/accept','accept','reject','delete','/:id','destroy','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelMessage.controller','get'];(function(_0x24e56c,_0x2d60ff){var _0x1add57=function(_0x594dd5){while(--_0x594dd5){_0x24e56c['push'](_0x24e56c['shift']());}};_0x1add57(++_0x2d60ff);}(_0xa9e0,0x123));var _0x0a9e=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xa9e0[_0x501510];return _0x1e6ee5;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),interaction[_0x0a9e('0xe')](_0x0a9e('0xf'),_0x0a9e('0x10')),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0x11')]);router[_0x0a9e('0x12')](_0x0a9e('0x13'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x14')]);router[_0x0a9e('0x12')]('/:id/reject',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x15')]);router[_0x0a9e('0x16')](_0x0a9e('0x17'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x18')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index 0247bc7..d4bd91a 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 _0x97db=['TEXT','BOOLEAN','ENUM','out','sequelize','exports'];(function(_0x35216f,_0x1fe4d3){var _0x429b12=function(_0x3863d7){while(--_0x3863d7){_0x35216f['push'](_0x35216f['shift']());}};_0x429b12(++_0x1fe4d3);}(_0x97db,0x1b4));var _0xb97d=function(_0x42ef79,_0xc8d68f){_0x42ef79=_0x42ef79-0x0;var _0x596001=_0x97db[_0x42ef79];return _0x596001;};'use strict';var Sequelize=require(_0xb97d('0x0'));module[_0xb97d('0x1')]={'body':{'type':Sequelize[_0xb97d('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0xb97d('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xb97d('0x4')]('in',_0xb97d('0x5')),'defaultValue':_0xb97d('0x5'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xb97d('0x2')]}}; \ No newline at end of file +var _0xabad=['sequelize','TEXT','medium','BOOLEAN','ENUM','out','DATE','STRING'];(function(_0x6ba94e,_0x5d705f){var _0x25c60a=function(_0x944643){while(--_0x944643){_0x6ba94e['push'](_0x6ba94e['shift']());}};_0x25c60a(++_0x5d705f);}(_0xabad,0x150));var _0xdaba=function(_0xd2dd48,_0x1a985){_0xd2dd48=_0xd2dd48-0x0;var _0x3853db=_0xabad[_0xd2dd48];return _0x3853db;};'use strict';var Sequelize=require(_0xdaba('0x0'));module['exports']={'body':{'type':Sequelize[_0xdaba('0x1')](_0xdaba('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xdaba('0x3')],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xdaba('0x4')]('in',_0xdaba('0x5')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0xdaba('0x6')]},'providerName':{'type':Sequelize[_0xdaba('0x7')]},'providerResponse':{'type':Sequelize[_0xdaba('0x1')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index b530ffb..171c4d0 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 _0x7044=['message','OpenchannelMessage,\x20%s,\x20%s','catch','status','json','offset','limit','undefined','count','set','Content-Range','reject','update','destroy','end','sendStatus','stack','name','send','map','OpenchannelMessage','rawAttributes','fieldName','type','key','query','filters','intersection','model','fields','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','length','create','body','find','params','describe','openchannel-interactions','openchannel','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','OpenchannelInteraction','OpenchannelInteractionId','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','User','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','accept','EventManager','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','rejectmessage','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','./openchannelMessage.socket','register','jayson/promise','client','http','then','info','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x5f5df5,_0x2f41c8){var _0x511d12=function(_0x33bbd6){while(--_0x33bbd6){_0x5f5df5['push'](_0x5f5df5['shift']());}};_0x511d12(++_0x2f41c8);}(_0x7044,0x1ce));var _0x4704=function(_0x1e0152,_0x1693d9){_0x1e0152=_0x1e0152-0x0;var _0x36be50=_0x7044[_0x1e0152];return _0x36be50;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4704('0x0'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x4704('0x1'));var BPromise=require(_0x4704('0x2'));var Mustache=require(_0x4704('0x3'));var util=require(_0x4704('0x4'));var path=require(_0x4704('0x5'));var sox=require(_0x4704('0x6'));var csv=require(_0x4704('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4704('0x8'));var _=require(_0x4704('0x9'));var squel=require(_0x4704('0xa'));var crypto=require(_0x4704('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x4704('0xc'));var toCsv=require(_0x4704('0x7'));var querystring=require('querystring');var Papa=require(_0x4704('0xd'));var Redis=require(_0x4704('0xe'));var authService=require(_0x4704('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x4704('0x10'));var hardwareService=require(_0x4704('0x11'));var logger=require(_0x4704('0x12'))(_0x4704('0x13'));var utils=require('../../config/utils');var config=require(_0x4704('0x14'));var licenseUtil=require(_0x4704('0x15'));var db=require(_0x4704('0x16'))['db'];config['redis']=_['defaults'](config[_0x4704('0x17')],{'host':_0x4704('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x4704('0x19'))[_0x4704('0x1a')](socket);var jayson=require(_0x4704('0x1b'));var client=jayson[_0x4704('0x1c')][_0x4704('0x1d')]({'port':0x232c});var client9002=jayson[_0x4704('0x1c')][_0x4704('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x4d0cfc,_0x13abd8,_0xf79f94,_0x58d13a){return new BPromise(function(_0xa68891,_0x2a9b11){var _0x1aeb98=_0x58d13a||client;return _0x1aeb98['request'](_0x4d0cfc,_0xf79f94)[_0x4704('0x1e')](function(_0xa1af58){logger[_0x4704('0x1f')]('OpenchannelMessage,\x20%s,\x20%s',_0x13abd8,_0x4704('0x20'));logger[_0x4704('0x21')](_0x4704('0x22'),_0x13abd8,'request\x20sent',JSON[_0x4704('0x23')](_0xa1af58));if(_0xa1af58[_0x4704('0x24')]){if(_0xa1af58[_0x4704('0x24')][_0x4704('0x25')]===0x1f4){logger[_0x4704('0x24')]('OpenchannelMessage,\x20%s,\x20%s',_0x13abd8,_0xa1af58[_0x4704('0x24')]['message']);return _0x2a9b11(_0xa1af58[_0x4704('0x24')][_0x4704('0x26')]);}logger[_0x4704('0x24')](_0x4704('0x27'),_0x13abd8,_0xa1af58[_0x4704('0x24')][_0x4704('0x26')]);return _0xa68891(_0xa1af58[_0x4704('0x24')][_0x4704('0x26')]);}else{logger[_0x4704('0x1f')](_0x4704('0x27'),_0x13abd8,_0x4704('0x20'));_0xa68891(_0xa1af58['result'][_0x4704('0x26')]);}})[_0x4704('0x28')](function(_0x40c831){logger[_0x4704('0x24')](_0x4704('0x27'),_0x13abd8,_0x40c831);_0x2a9b11(_0x40c831);});});}function respondWithStatusCode(_0x37b8d8,_0x269c6d){_0x269c6d=_0x269c6d||0xcc;return function(_0x5427b9){if(_0x5427b9){return _0x37b8d8['sendStatus'](_0x269c6d);}return _0x37b8d8[_0x4704('0x29')](_0x269c6d)['end']();};}function respondWithResult(_0x28074,_0xe210d7){_0xe210d7=_0xe210d7||0xc8;return function(_0x45f940){if(_0x45f940){return _0x28074[_0x4704('0x29')](_0xe210d7)[_0x4704('0x2a')](_0x45f940);}};}function respondWithFilteredResult(_0x83ee34,_0x5c025d){return function(_0x260b88){if(_0x260b88){var _0x57ab11=typeof _0x5c025d[_0x4704('0x2b')]==='undefined'&&typeof _0x5c025d[_0x4704('0x2c')]===_0x4704('0x2d');var _0x52e082=_0x260b88['count'];var _0x2ab537=_0x57ab11?0x0:_0x5c025d[_0x4704('0x2b')];var _0x241b48=_0x57ab11?_0x260b88[_0x4704('0x2e')]:_0x5c025d['offset']+_0x5c025d[_0x4704('0x2c')];var _0x17590c;if(_0x241b48>=_0x52e082){_0x241b48=_0x52e082;_0x17590c=0xc8;}else{_0x17590c=0xce;}_0x83ee34[_0x4704('0x29')](_0x17590c);return _0x83ee34[_0x4704('0x2f')](_0x4704('0x30'),_0x2ab537+'-'+_0x241b48+'/'+_0x52e082)[_0x4704('0x2a')](_0x260b88);}return null;};}function patchUpdates(_0x4a1bea){return function(_0xa17cf9){try{jsonpatch['apply'](_0xa17cf9,_0x4a1bea,!![]);}catch(_0x5cd316){return BPromise[_0x4704('0x31')](_0x5cd316);}return _0xa17cf9['save']();};}function saveUpdates(_0x1ae947,_0x4f8502){return function(_0x4b5a2e){if(_0x4b5a2e){return _0x4b5a2e[_0x4704('0x32')](_0x1ae947)[_0x4704('0x1e')](function(_0xa38b27){return _0xa38b27;});}return null;};}function removeEntity(_0x382278,_0x4eb4f7){return function(_0x2c3bb6){if(_0x2c3bb6){return _0x2c3bb6[_0x4704('0x33')]()['then'](function(){_0x382278['status'](0xcc)[_0x4704('0x34')]();});}};}function handleEntityNotFound(_0x35dae3,_0x1e8a9b){return function(_0x47b45c){if(!_0x47b45c){_0x35dae3[_0x4704('0x35')](0x194);}return _0x47b45c;};}function handleError(_0x2c72d7,_0x314769){_0x314769=_0x314769||0x1f4;return function(_0x3c72d5){logger[_0x4704('0x24')](_0x3c72d5[_0x4704('0x36')]);if(_0x3c72d5[_0x4704('0x37')]){delete _0x3c72d5[_0x4704('0x37')];}_0x2c72d7['status'](_0x314769)[_0x4704('0x38')](_0x3c72d5);};}exports['index']=function(_0x570c59,_0x574fbf){var _0x397fcf={},_0x483788={},_0x33de1e={'count':0x0,'rows':[]};var _0x1b1c36=_[_0x4704('0x39')](db[_0x4704('0x3a')][_0x4704('0x3b')],function(_0x3c717b){return{'name':_0x3c717b[_0x4704('0x3c')],'type':_0x3c717b[_0x4704('0x3d')][_0x4704('0x3e')]};});_0x483788['model']=_['map'](_0x1b1c36,_0x4704('0x37'));_0x483788[_0x4704('0x3f')]=_['keys'](_0x570c59[_0x4704('0x3f')]);_0x483788[_0x4704('0x40')]=_[_0x4704('0x41')](_0x483788[_0x4704('0x42')],_0x483788[_0x4704('0x3f')]);_0x397fcf['attributes']=_['intersection'](_0x483788[_0x4704('0x42')],qs[_0x4704('0x43')](_0x570c59[_0x4704('0x3f')][_0x4704('0x43')]));_0x397fcf[_0x4704('0x44')]=_0x397fcf[_0x4704('0x44')]['length']?_0x397fcf[_0x4704('0x44')]:_0x483788['model'];if(!_0x570c59['query'][_0x4704('0x45')]('nolimit')){_0x397fcf['limit']=qs[_0x4704('0x2c')](_0x570c59[_0x4704('0x3f')][_0x4704('0x2c')]);_0x397fcf[_0x4704('0x2b')]=qs['offset'](_0x570c59[_0x4704('0x3f')][_0x4704('0x2b')]);}_0x397fcf[_0x4704('0x46')]=qs[_0x4704('0x47')](_0x570c59['query'][_0x4704('0x47')]);_0x397fcf[_0x4704('0x48')]=qs[_0x4704('0x40')](_[_0x4704('0x49')](_0x570c59[_0x4704('0x3f')],_0x483788[_0x4704('0x40')]),_0x1b1c36);if(_0x570c59[_0x4704('0x3f')][_0x4704('0x4a')]){_0x397fcf[_0x4704('0x48')]=_[_0x4704('0x4b')](_0x397fcf[_0x4704('0x48')],{'$or':_[_0x4704('0x39')](_0x1b1c36,function(_0x3a1c55){if(_0x3a1c55[_0x4704('0x3d')]!==_0x4704('0x4c')){var _0x4c5bd2={};_0x4c5bd2[_0x3a1c55[_0x4704('0x37')]]={'$like':'%'+_0x570c59[_0x4704('0x3f')][_0x4704('0x4a')]+'%'};return _0x4c5bd2;}})});}_0x397fcf=_[_0x4704('0x4b')]({},_0x397fcf,_0x570c59[_0x4704('0x4d')]);var _0x11c64f={'where':_0x397fcf['where']};return db[_0x4704('0x3a')][_0x4704('0x2e')](_0x11c64f)[_0x4704('0x1e')](function(_0x58bd21){_0x33de1e['count']=_0x58bd21;if(_0x570c59['query']['includeAll']){_0x397fcf[_0x4704('0x4e')]=[{'all':!![]}];}return db[_0x4704('0x3a')][_0x4704('0x4f')](_0x397fcf);})[_0x4704('0x1e')](function(_0x16f291){_0x33de1e[_0x4704('0x50')]=_0x16f291;return _0x33de1e;})[_0x4704('0x1e')](respondWithFilteredResult(_0x574fbf,_0x397fcf))[_0x4704('0x28')](handleError(_0x574fbf,null));};exports['show']=function(_0x4725c2,_0xfc3c21){var _0x5c9046={'raw':!![],'where':{'id':_0x4725c2['params']['id']}},_0x794665={};_0x794665[_0x4704('0x42')]=_['keys'](db[_0x4704('0x3a')][_0x4704('0x3b')]);_0x794665[_0x4704('0x3f')]=_['keys'](_0x4725c2[_0x4704('0x3f')]);_0x794665['filters']=_['intersection'](_0x794665[_0x4704('0x42')],_0x794665['query']);_0x5c9046[_0x4704('0x44')]=_[_0x4704('0x41')](_0x794665[_0x4704('0x42')],qs[_0x4704('0x43')](_0x4725c2['query'][_0x4704('0x43')]));_0x5c9046[_0x4704('0x44')]=_0x5c9046[_0x4704('0x44')][_0x4704('0x51')]?_0x5c9046[_0x4704('0x44')]:_0x794665[_0x4704('0x42')];if(_0x4725c2[_0x4704('0x3f')]['includeAll']){_0x5c9046['include']=[{'all':!![]}];}_0x5c9046=_[_0x4704('0x4b')]({},_0x5c9046,_0x4725c2['options']);return db[_0x4704('0x3a')]['find'](_0x5c9046)['then'](handleEntityNotFound(_0xfc3c21,null))['then'](respondWithResult(_0xfc3c21,null))[_0x4704('0x28')](handleError(_0xfc3c21,null));};exports[_0x4704('0x52')]=function(_0x1fd8fd,_0x37d41f){return db[_0x4704('0x3a')][_0x4704('0x52')](_0x1fd8fd['body'],{})['then'](respondWithResult(_0x37d41f,0xc9))['catch'](handleError(_0x37d41f,null));};exports[_0x4704('0x32')]=function(_0xac83b5,_0x2371f1){if(_0xac83b5['body']['id']){delete _0xac83b5[_0x4704('0x53')]['id'];}return db[_0x4704('0x3a')][_0x4704('0x54')]({'where':{'id':_0xac83b5['params']['id']}})[_0x4704('0x1e')](handleEntityNotFound(_0x2371f1,null))[_0x4704('0x1e')](saveUpdates(_0xac83b5[_0x4704('0x53')],null))['then'](respondWithResult(_0x2371f1,null))['catch'](handleError(_0x2371f1,null));};exports['destroy']=function(_0x1a20fe,_0x36b389){return db[_0x4704('0x3a')][_0x4704('0x54')]({'where':{'id':_0x1a20fe[_0x4704('0x55')]['id']}})[_0x4704('0x1e')](handleEntityNotFound(_0x36b389,null))[_0x4704('0x1e')](removeEntity(_0x36b389,null))[_0x4704('0x28')](handleError(_0x36b389,null));};exports[_0x4704('0x56')]=function(_0x1b0a51,_0x58ce2e){return db[_0x4704('0x3a')]['describe']()[_0x4704('0x1e')](respondWithResult(_0x58ce2e,null))[_0x4704('0x28')](handleError(_0x58ce2e,null));};var interaction_log=require(_0x4704('0x12'))(_0x4704('0x57'));exports['accept']=function(_0x4a4464,_0x31debd,_0x4bd3a9){var _0x195ffc={'agent':{},'channel':_0x4704('0x58')};if(_0x4a4464[_0x4704('0x53')]['id']){delete _0x4a4464[_0x4704('0x53')]['id'];}_0x4a4464['body'][_0x4704('0x59')]=!![];_0x4a4464['body'][_0x4704('0x5a')]=moment()[_0x4704('0x5b')](_0x4704('0x5c'));_0x4a4464[_0x4704('0x53')][_0x4704('0x5d')]=_0x4a4464['body'][_0x4704('0x5d')]||_0x4a4464[_0x4704('0x5e')]['id'];_0x195ffc[_0x4704('0x5f')]['id']=_0x4a4464[_0x4704('0x53')][_0x4704('0x5d')];return db[_0x4704('0x3a')][_0x4704('0x54')]({'where':{'id':_0x4a4464['params']['id'],'UserId':null}})[_0x4704('0x1e')](handleEntityNotFound(_0x31debd,null))[_0x4704('0x1e')](saveUpdates(_0x4a4464[_0x4704('0x53')],null))['then'](function(_0x49429e){if(_0x49429e){_0x195ffc[_0x4704('0x26')]=_0x49429e[_0x4704('0x60')]({'plain':!![]});return db[_0x4704('0x61')][_0x4704('0x54')]({'where':{'id':_0x49429e[_0x4704('0x62')]}});}return null;})['then'](handleEntityNotFound(_0x31debd,null))['then'](function(_0x406bd2){if(_0x406bd2){return _0x406bd2[_0x4704('0x32')]({'UserId':_0x4a4464[_0x4704('0x53')]['UserId'],'read1stAt':_['isNil'](_0x406bd2['read1stAt'])?moment()['format'](_0x4704('0x5c')):undefined});}return null;})['then'](function(_0x52e5d0){if(_0x52e5d0){_0x195ffc[_0x4704('0x63')]=_0x52e5d0[_0x4704('0x60')]({'plain':!![]});interaction_log[_0x4704('0x1f')](_0x4704('0x64'),_0x4a4464['user']['id'],_0x4a4464[_0x4704('0x5e')]['name'],_0x4a4464[_0x4704('0x5e')]['role'],_0x195ffc[_0x4704('0x63')]['id'],_0x4a4464[_0x4704('0x53')]?JSON['stringify'](_0x4a4464[_0x4704('0x53')]):_0x4704('0x65'));return respondWithRpcPromise('AcceptMessage',_0x4704('0x66'),_0x195ffc);}return null;})[_0x4704('0x1e')](function(_0x463406){var _0x1b51d5=_0x4704('0x67')+_0x463406['message'][_0x4704('0x68')];return db[_0x4704('0x69')][_0x4704('0x3f')](_0x1b51d5,{'type':db[_0x4704('0x6a')][_0x4704('0x6b')][_0x4704('0x6c')],'raw':!![]})['then'](function(_0x95569){return _0x95569;});})['then'](function(_0x56cab0){if(_0x56cab0){_0x195ffc[_0x4704('0x26')]['contact']=_0x56cab0[0x0];if(!_0x4a4464[_0x4704('0x53')][_0x4704('0x5d')])return;return db[_0x4704('0x6d')][_0x4704('0x54')]({'where':{'id':_0x4a4464[_0x4704('0x53')][_0x4704('0x5d')],'role':_0x4704('0x5f')},'attributes':['id',_0x4704('0x37'),_0x4704('0x6e'),_0x4704('0x6f'),_0x4704('0x70')],'raw':!![]});}return null;})[_0x4704('0x1e')](function(_0x378b74){if(!_0x378b74)return null;_0x195ffc['message'][_0x4704('0x5f')]=_0x378b74;return _0x195ffc;})[_0x4704('0x1e')](function(_0x34d3d6){if(_0x34d3d6){if(_0x4a4464[_0x4704('0x53')][_0x4704('0x71')]){_0x195ffc['message'][_0x4704('0x72')]=util[_0x4704('0x5b')](_0x4704('0x73'),_0x4a4464[_0x4704('0x5e')][_0x4704('0x37')]);_0x195ffc[_0x4704('0x26')][_0x4704('0x74')]=_0x195ffc[_0x4704('0x74')];_0x195ffc[_0x4704('0x26')][_0x4704('0x75')]=_0x195ffc[_0x4704('0x74')];_0x195ffc['message'][_0x4704('0x76')]=_0x4704('0x77');return respondWithRpcPromise(_0x4704('0x78'),'EventManager',{'event':'acceptmessage','message':_0x195ffc[_0x4704('0x26')]},client9002)[_0x4704('0x1e')](function(){return _0x195ffc;});}return _0x195ffc;}return null;})[_0x4704('0x1e')](respondWithResult(_0x31debd,null))['catch'](handleError(_0x31debd,null));};var interaction_log=require(_0x4704('0x12'))(_0x4704('0x57'));exports['reject']=function(_0x51bfda,_0x125027,_0x305545){var _0x307349={'agent':{},'channel':_0x4704('0x58')};if(_0x51bfda[_0x4704('0x53')]['id']){delete _0x51bfda[_0x4704('0x53')]['id'];}_0x51bfda['body'][_0x4704('0x5d')]=_0x51bfda[_0x4704('0x53')]['UserId']||_0x51bfda[_0x4704('0x5e')]['id'];_0x307349[_0x4704('0x5f')]['id']=_0x51bfda[_0x4704('0x53')][_0x4704('0x5d')];return db[_0x4704('0x3a')][_0x4704('0x54')]({'where':{'id':_0x51bfda[_0x4704('0x55')]['id'],'UserId':null}})[_0x4704('0x1e')](handleEntityNotFound(_0x125027,null))['then'](function(_0x5ac92d){if(_0x5ac92d){_0x307349[_0x4704('0x26')]=_0x5ac92d[_0x4704('0x60')]({'plain':!![]});return db[_0x4704('0x61')][_0x4704('0x54')]({'where':{'id':_0x5ac92d[_0x4704('0x62')]}});}return null;})[_0x4704('0x1e')](handleEntityNotFound(_0x125027,null))[_0x4704('0x1e')](function(_0x4898df){if(_0x4898df){_0x307349[_0x4704('0x63')]=_0x4898df[_0x4704('0x60')]({'plain':!![]});interaction_log[_0x4704('0x1f')](_0x4704('0x79'),_0x51bfda[_0x4704('0x5e')]['id'],_0x51bfda[_0x4704('0x5e')]['name'],_0x51bfda[_0x4704('0x5e')]['role'],_0x307349['interaction']['id'],_0x51bfda[_0x4704('0x53')]?JSON[_0x4704('0x23')](_0x51bfda[_0x4704('0x53')]):_0x4704('0x65'));return respondWithRpcPromise(_0x4704('0x7a'),_0x4704('0x7b'),_0x307349);}return null;})[_0x4704('0x1e')](function(_0x4aa378){var _0x1b3224='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x4aa378['message'][_0x4704('0x68')];return db[_0x4704('0x69')][_0x4704('0x3f')](_0x1b3224,{'type':db['Sequelize'][_0x4704('0x6b')][_0x4704('0x6c')],'raw':!![]})[_0x4704('0x1e')](function(_0x62cba9){return _0x62cba9;});})[_0x4704('0x1e')](function(_0x395684){if(_0x395684){_0x307349['message']['contact']=_0x395684[0x0];if(!_0x51bfda[_0x4704('0x53')][_0x4704('0x5d')])return;return db[_0x4704('0x6d')]['find']({'where':{'id':_0x51bfda[_0x4704('0x53')][_0x4704('0x5d')],'role':_0x4704('0x5f')},'attributes':['id','name',_0x4704('0x6e'),_0x4704('0x6f'),_0x4704('0x70')],'raw':!![]});}return null;})['then'](function(_0x49dcb3){if(!_0x49dcb3)return null;_0x307349[_0x4704('0x26')][_0x4704('0x5f')]=_0x49dcb3;return _0x307349;})[_0x4704('0x1e')](function(_0x5ac64c){if(_0x5ac64c){_0x5ac64c[_0x4704('0x26')][_0x4704('0x72')]=util[_0x4704('0x5b')]('SIP/%s',_0x51bfda['user'][_0x4704('0x37')]);_0x5ac64c[_0x4704('0x26')][_0x4704('0x74')]=_0x307349[_0x4704('0x74')];_0x5ac64c[_0x4704('0x26')][_0x4704('0x75')]=_0x307349[_0x4704('0x74')];_0x5ac64c[_0x4704('0x26')][_0x4704('0x76')]=_0x4704('0x31');respondWithRpcPromise(_0x4704('0x78'),_0x4704('0x78'),{'event':_0x4704('0x7c'),'message':_0x5ac64c[_0x4704('0x26')]},client9002);return _0x307349;}return null;})[_0x4704('0x1e')](respondWithResult(_0x125027,null))[_0x4704('0x28')](handleError(_0x125027,null));}; \ No newline at end of file +var _0xbf10=['destroy','stack','name','send','index','map','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','OpenchannelMessage','findAll','rows','params','rawAttributes','include','find','create','body','describe','openchannel-interactions','accept','openchannel','readAt','format','UserId','user','agent','OpenchannelInteraction','OpenchannelInteractionId','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','null','AcceptMessage','acceptMessage','sequelize','SELECT','contact','User','fullname','internal','manual','SIP/%s','channel','event','EventManager','reject','get','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','Sequelize','QueryTypes','interface','motionChannel','rejectmessage','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','jayson/promise','client','request','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','status','json','offset','undefined','count','Content-Range','apply','save','update'];(function(_0x3d0fb4,_0x4e5464){var _0xea699f=function(_0x3f863d){while(--_0x3f863d){_0x3d0fb4['push'](_0x3d0fb4['shift']());}};_0xea699f(++_0x4e5464);}(_0xbf10,0x1d2));var _0x0bf1=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0xbf10[_0x5c351c];return _0x26f3b3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0bf1('0x0'));var zipdir=require(_0x0bf1('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x0bf1('0x2'));var moment=require('moment');var BPromise=require(_0x0bf1('0x3'));var Mustache=require(_0x0bf1('0x4'));var util=require(_0x0bf1('0x5'));var path=require(_0x0bf1('0x6'));var sox=require(_0x0bf1('0x7'));var csv=require(_0x0bf1('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0bf1('0x9'));var squel=require(_0x0bf1('0xa'));var crypto=require(_0x0bf1('0xb'));var jsforce=require(_0x0bf1('0xc'));var deskjs=require(_0x0bf1('0xd'));var toCsv=require('to-csv');var querystring=require(_0x0bf1('0xe'));var Papa=require(_0x0bf1('0xf'));var Redis=require('ioredis');var authService=require(_0x0bf1('0x10'));var qs=require(_0x0bf1('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0bf1('0x12'));var logger=require(_0x0bf1('0x13'))(_0x0bf1('0x14'));var utils=require(_0x0bf1('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x0bf1('0x16'));var db=require(_0x0bf1('0x17'))['db'];config['redis']=_[_0x0bf1('0x18')](config[_0x0bf1('0x19')],{'host':_0x0bf1('0x1a'),'port':0x18eb});var socket=require(_0x0bf1('0x1b'))(new Redis(config[_0x0bf1('0x19')]));require('./openchannelMessage.socket')['register'](socket);var jayson=require(_0x0bf1('0x1c'));var client=jayson[_0x0bf1('0x1d')]['http']({'port':0x232c});var client9002=jayson[_0x0bf1('0x1d')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4aae04,_0x2a31f7,_0x244461,_0x471778){return new BPromise(function(_0x5efa71,_0x201bd0){var _0xbd3360=_0x471778||client;return _0xbd3360[_0x0bf1('0x1e')](_0x4aae04,_0x244461)[_0x0bf1('0x1f')](function(_0xf6dd29){logger[_0x0bf1('0x20')](_0x0bf1('0x21'),_0x2a31f7,_0x0bf1('0x22'));logger[_0x0bf1('0x23')](_0x0bf1('0x24'),_0x2a31f7,_0x0bf1('0x22'),JSON[_0x0bf1('0x25')](_0xf6dd29));if(_0xf6dd29[_0x0bf1('0x26')]){if(_0xf6dd29['error'][_0x0bf1('0x27')]===0x1f4){logger[_0x0bf1('0x26')](_0x0bf1('0x21'),_0x2a31f7,_0xf6dd29['error']['message']);return _0x201bd0(_0xf6dd29[_0x0bf1('0x26')]['message']);}logger[_0x0bf1('0x26')]('OpenchannelMessage,\x20%s,\x20%s',_0x2a31f7,_0xf6dd29[_0x0bf1('0x26')][_0x0bf1('0x28')]);return _0x5efa71(_0xf6dd29[_0x0bf1('0x26')][_0x0bf1('0x28')]);}else{logger[_0x0bf1('0x20')](_0x0bf1('0x21'),_0x2a31f7,_0x0bf1('0x22'));_0x5efa71(_0xf6dd29[_0x0bf1('0x29')][_0x0bf1('0x28')]);}})[_0x0bf1('0x2a')](function(_0x3ef4ef){logger[_0x0bf1('0x26')](_0x0bf1('0x21'),_0x2a31f7,_0x3ef4ef);_0x201bd0(_0x3ef4ef);});});}function respondWithStatusCode(_0x37da07,_0x33f3c5){_0x33f3c5=_0x33f3c5||0xcc;return function(_0x883147){if(_0x883147){return _0x37da07[_0x0bf1('0x2b')](_0x33f3c5);}return _0x37da07['status'](_0x33f3c5)[_0x0bf1('0x2c')]();};}function respondWithResult(_0x5c645f,_0x2ba7c7){_0x2ba7c7=_0x2ba7c7||0xc8;return function(_0x16aa97){if(_0x16aa97){return _0x5c645f[_0x0bf1('0x2d')](_0x2ba7c7)[_0x0bf1('0x2e')](_0x16aa97);}};}function respondWithFilteredResult(_0x20353c,_0x2285fd){return function(_0x37165b){if(_0x37165b){var _0x1ec499=typeof _0x2285fd[_0x0bf1('0x2f')]==='undefined'&&typeof _0x2285fd['limit']===_0x0bf1('0x30');var _0x4ddf62=_0x37165b[_0x0bf1('0x31')];var _0x17a751=_0x1ec499?0x0:_0x2285fd[_0x0bf1('0x2f')];var _0x378774=_0x1ec499?_0x37165b[_0x0bf1('0x31')]:_0x2285fd[_0x0bf1('0x2f')]+_0x2285fd['limit'];var _0x1d8686;if(_0x378774>=_0x4ddf62){_0x378774=_0x4ddf62;_0x1d8686=0xc8;}else{_0x1d8686=0xce;}_0x20353c[_0x0bf1('0x2d')](_0x1d8686);return _0x20353c['set'](_0x0bf1('0x32'),_0x17a751+'-'+_0x378774+'/'+_0x4ddf62)[_0x0bf1('0x2e')](_0x37165b);}return null;};}function patchUpdates(_0x10ebe8){return function(_0x566ffe){try{jsonpatch[_0x0bf1('0x33')](_0x566ffe,_0x10ebe8,!![]);}catch(_0x460fdb){return BPromise['reject'](_0x460fdb);}return _0x566ffe[_0x0bf1('0x34')]();};}function saveUpdates(_0x304536,_0x67e0e3){return function(_0x1fbe93){if(_0x1fbe93){return _0x1fbe93[_0x0bf1('0x35')](_0x304536)['then'](function(_0x22bf58){return _0x22bf58;});}return null;};}function removeEntity(_0x299756,_0x203deb){return function(_0x175f0f){if(_0x175f0f){return _0x175f0f[_0x0bf1('0x36')]()[_0x0bf1('0x1f')](function(){_0x299756['status'](0xcc)[_0x0bf1('0x2c')]();});}};}function handleEntityNotFound(_0x5f228e,_0x3a62b1){return function(_0x1f9c31){if(!_0x1f9c31){_0x5f228e[_0x0bf1('0x2b')](0x194);}return _0x1f9c31;};}function handleError(_0x186fc1,_0x5110bb){_0x5110bb=_0x5110bb||0x1f4;return function(_0x251d0e){logger[_0x0bf1('0x26')](_0x251d0e[_0x0bf1('0x37')]);if(_0x251d0e[_0x0bf1('0x38')]){delete _0x251d0e[_0x0bf1('0x38')];}_0x186fc1['status'](_0x5110bb)[_0x0bf1('0x39')](_0x251d0e);};}exports[_0x0bf1('0x3a')]=function(_0x3dd724,_0xc78852){var _0x5483ef={},_0x3af9e5={},_0x252aed={'count':0x0,'rows':[]};var _0x55fb9e=_[_0x0bf1('0x3b')](db['OpenchannelMessage']['rawAttributes'],function(_0x4b46db){return{'name':_0x4b46db[_0x0bf1('0x3c')],'type':_0x4b46db[_0x0bf1('0x3d')]['key']};});_0x3af9e5[_0x0bf1('0x3e')]=_[_0x0bf1('0x3b')](_0x55fb9e,_0x0bf1('0x38'));_0x3af9e5[_0x0bf1('0x3f')]=_[_0x0bf1('0x40')](_0x3dd724[_0x0bf1('0x3f')]);_0x3af9e5[_0x0bf1('0x41')]=_[_0x0bf1('0x42')](_0x3af9e5[_0x0bf1('0x3e')],_0x3af9e5[_0x0bf1('0x3f')]);_0x5483ef[_0x0bf1('0x43')]=_[_0x0bf1('0x42')](_0x3af9e5[_0x0bf1('0x3e')],qs['fields'](_0x3dd724[_0x0bf1('0x3f')][_0x0bf1('0x44')]));_0x5483ef[_0x0bf1('0x43')]=_0x5483ef['attributes'][_0x0bf1('0x45')]?_0x5483ef[_0x0bf1('0x43')]:_0x3af9e5[_0x0bf1('0x3e')];if(!_0x3dd724[_0x0bf1('0x3f')][_0x0bf1('0x46')]('nolimit')){_0x5483ef['limit']=qs[_0x0bf1('0x47')](_0x3dd724[_0x0bf1('0x3f')][_0x0bf1('0x47')]);_0x5483ef['offset']=qs['offset'](_0x3dd724['query'][_0x0bf1('0x2f')]);}_0x5483ef[_0x0bf1('0x48')]=qs['sort'](_0x3dd724[_0x0bf1('0x3f')][_0x0bf1('0x49')]);_0x5483ef[_0x0bf1('0x4a')]=qs[_0x0bf1('0x41')](_[_0x0bf1('0x4b')](_0x3dd724[_0x0bf1('0x3f')],_0x3af9e5[_0x0bf1('0x41')]),_0x55fb9e);if(_0x3dd724[_0x0bf1('0x3f')][_0x0bf1('0x4c')]){_0x5483ef[_0x0bf1('0x4a')]=_['merge'](_0x5483ef[_0x0bf1('0x4a')],{'$or':_[_0x0bf1('0x3b')](_0x55fb9e,function(_0x572925){if(_0x572925[_0x0bf1('0x3d')]!==_0x0bf1('0x4d')){var _0x374413={};_0x374413[_0x572925['name']]={'$like':'%'+_0x3dd724[_0x0bf1('0x3f')][_0x0bf1('0x4c')]+'%'};return _0x374413;}})});}_0x5483ef=_[_0x0bf1('0x4e')]({},_0x5483ef,_0x3dd724[_0x0bf1('0x4f')]);var _0x251b90={'where':_0x5483ef[_0x0bf1('0x4a')]};return db['OpenchannelMessage']['count'](_0x251b90)[_0x0bf1('0x1f')](function(_0x167249){_0x252aed[_0x0bf1('0x31')]=_0x167249;if(_0x3dd724[_0x0bf1('0x3f')][_0x0bf1('0x50')]){_0x5483ef['include']=[{'all':!![]}];}return db[_0x0bf1('0x51')][_0x0bf1('0x52')](_0x5483ef);})[_0x0bf1('0x1f')](function(_0x5ada25){_0x252aed[_0x0bf1('0x53')]=_0x5ada25;return _0x252aed;})[_0x0bf1('0x1f')](respondWithFilteredResult(_0xc78852,_0x5483ef))[_0x0bf1('0x2a')](handleError(_0xc78852,null));};exports['show']=function(_0x1f58ba,_0x1a6a72){var _0xea86f1={'raw':!![],'where':{'id':_0x1f58ba[_0x0bf1('0x54')]['id']}},_0x1fd229={};_0x1fd229['model']=_[_0x0bf1('0x40')](db[_0x0bf1('0x51')][_0x0bf1('0x55')]);_0x1fd229[_0x0bf1('0x3f')]=_[_0x0bf1('0x40')](_0x1f58ba[_0x0bf1('0x3f')]);_0x1fd229[_0x0bf1('0x41')]=_[_0x0bf1('0x42')](_0x1fd229['model'],_0x1fd229[_0x0bf1('0x3f')]);_0xea86f1[_0x0bf1('0x43')]=_[_0x0bf1('0x42')](_0x1fd229[_0x0bf1('0x3e')],qs[_0x0bf1('0x44')](_0x1f58ba[_0x0bf1('0x3f')][_0x0bf1('0x44')]));_0xea86f1[_0x0bf1('0x43')]=_0xea86f1[_0x0bf1('0x43')][_0x0bf1('0x45')]?_0xea86f1[_0x0bf1('0x43')]:_0x1fd229[_0x0bf1('0x3e')];if(_0x1f58ba[_0x0bf1('0x3f')][_0x0bf1('0x50')]){_0xea86f1[_0x0bf1('0x56')]=[{'all':!![]}];}_0xea86f1=_[_0x0bf1('0x4e')]({},_0xea86f1,_0x1f58ba[_0x0bf1('0x4f')]);return db['OpenchannelMessage'][_0x0bf1('0x57')](_0xea86f1)[_0x0bf1('0x1f')](handleEntityNotFound(_0x1a6a72,null))[_0x0bf1('0x1f')](respondWithResult(_0x1a6a72,null))[_0x0bf1('0x2a')](handleError(_0x1a6a72,null));};exports[_0x0bf1('0x58')]=function(_0x308311,_0x5e1bb2){return db[_0x0bf1('0x51')]['create'](_0x308311[_0x0bf1('0x59')],{})['then'](respondWithResult(_0x5e1bb2,0xc9))[_0x0bf1('0x2a')](handleError(_0x5e1bb2,null));};exports['update']=function(_0x5351de,_0x35e0de){if(_0x5351de['body']['id']){delete _0x5351de[_0x0bf1('0x59')]['id'];}return db[_0x0bf1('0x51')][_0x0bf1('0x57')]({'where':{'id':_0x5351de[_0x0bf1('0x54')]['id']}})['then'](handleEntityNotFound(_0x35e0de,null))['then'](saveUpdates(_0x5351de[_0x0bf1('0x59')],null))[_0x0bf1('0x1f')](respondWithResult(_0x35e0de,null))['catch'](handleError(_0x35e0de,null));};exports[_0x0bf1('0x36')]=function(_0x37a1b6,_0x210ef4){return db[_0x0bf1('0x51')]['find']({'where':{'id':_0x37a1b6['params']['id']}})[_0x0bf1('0x1f')](handleEntityNotFound(_0x210ef4,null))[_0x0bf1('0x1f')](removeEntity(_0x210ef4,null))[_0x0bf1('0x2a')](handleError(_0x210ef4,null));};exports[_0x0bf1('0x5a')]=function(_0x565456,_0xc72753){return db[_0x0bf1('0x51')][_0x0bf1('0x5a')]()[_0x0bf1('0x1f')](respondWithResult(_0xc72753,null))[_0x0bf1('0x2a')](handleError(_0xc72753,null));};var interaction_log=require(_0x0bf1('0x13'))(_0x0bf1('0x5b'));exports[_0x0bf1('0x5c')]=function(_0x3b0309,_0x175751,_0xac3ab5){var _0x13b23a={'agent':{},'channel':_0x0bf1('0x5d')};if(_0x3b0309['body']['id']){delete _0x3b0309[_0x0bf1('0x59')]['id'];}_0x3b0309[_0x0bf1('0x59')]['read']=!![];_0x3b0309[_0x0bf1('0x59')][_0x0bf1('0x5e')]=moment()[_0x0bf1('0x5f')]('YYYY-MM-DD\x20HH:mm:ss');_0x3b0309[_0x0bf1('0x59')][_0x0bf1('0x60')]=_0x3b0309[_0x0bf1('0x59')][_0x0bf1('0x60')]||_0x3b0309[_0x0bf1('0x61')]['id'];_0x13b23a[_0x0bf1('0x62')]['id']=_0x3b0309[_0x0bf1('0x59')]['UserId'];return db[_0x0bf1('0x51')]['find']({'where':{'id':_0x3b0309['params']['id'],'UserId':null}})[_0x0bf1('0x1f')](handleEntityNotFound(_0x175751,null))['then'](saveUpdates(_0x3b0309[_0x0bf1('0x59')],null))['then'](function(_0x47cc55){if(_0x47cc55){_0x13b23a[_0x0bf1('0x28')]=_0x47cc55['get']({'plain':!![]});return db[_0x0bf1('0x63')][_0x0bf1('0x57')]({'where':{'id':_0x47cc55[_0x0bf1('0x64')]}});}return null;})[_0x0bf1('0x1f')](handleEntityNotFound(_0x175751,null))[_0x0bf1('0x1f')](function(_0x5f1f10){if(_0x5f1f10){return _0x5f1f10[_0x0bf1('0x35')]({'UserId':_0x3b0309[_0x0bf1('0x59')][_0x0bf1('0x60')],'read1stAt':_[_0x0bf1('0x65')](_0x5f1f10[_0x0bf1('0x66')])?moment()[_0x0bf1('0x5f')](_0x0bf1('0x67')):undefined});}return null;})[_0x0bf1('0x1f')](function(_0x5a66a8){if(_0x5a66a8){_0x13b23a['interaction']=_0x5a66a8['get']({'plain':!![]});interaction_log[_0x0bf1('0x20')](_0x0bf1('0x68'),_0x3b0309[_0x0bf1('0x61')]['id'],_0x3b0309[_0x0bf1('0x61')][_0x0bf1('0x38')],_0x3b0309['user'][_0x0bf1('0x69')],_0x13b23a[_0x0bf1('0x6a')]['id'],_0x3b0309[_0x0bf1('0x59')]?JSON['stringify'](_0x3b0309['body']):_0x0bf1('0x6b'));return respondWithRpcPromise(_0x0bf1('0x6c'),_0x0bf1('0x6d'),_0x13b23a);}return null;})['then'](function(_0x1c3e77){var _0x49426c='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x1c3e77['message']['ContactId'];return db[_0x0bf1('0x6e')][_0x0bf1('0x3f')](_0x49426c,{'type':db['Sequelize']['QueryTypes'][_0x0bf1('0x6f')],'raw':!![]})[_0x0bf1('0x1f')](function(_0x4771a0){return _0x4771a0;});})['then'](function(_0x4b48ca){if(_0x4b48ca){_0x13b23a['message'][_0x0bf1('0x70')]=_0x4b48ca[0x0];if(!_0x3b0309[_0x0bf1('0x59')][_0x0bf1('0x60')])return;return db[_0x0bf1('0x71')][_0x0bf1('0x57')]({'where':{'id':_0x3b0309[_0x0bf1('0x59')]['UserId'],'role':_0x0bf1('0x62')},'attributes':['id',_0x0bf1('0x38'),_0x0bf1('0x72'),'email',_0x0bf1('0x73')],'raw':!![]});}return null;})[_0x0bf1('0x1f')](function(_0x305031){if(!_0x305031)return null;_0x13b23a[_0x0bf1('0x28')][_0x0bf1('0x62')]=_0x305031;return _0x13b23a;})['then'](function(_0x3a16fd){if(_0x3a16fd){if(_0x3b0309['body'][_0x0bf1('0x74')]){_0x13b23a[_0x0bf1('0x28')]['interface']=util[_0x0bf1('0x5f')](_0x0bf1('0x75'),_0x3b0309[_0x0bf1('0x61')][_0x0bf1('0x38')]);_0x13b23a[_0x0bf1('0x28')][_0x0bf1('0x76')]=_0x13b23a[_0x0bf1('0x76')];_0x13b23a[_0x0bf1('0x28')]['motionChannel']=_0x13b23a[_0x0bf1('0x76')];_0x13b23a['message'][_0x0bf1('0x77')]=_0x0bf1('0x5c');return respondWithRpcPromise(_0x0bf1('0x78'),_0x0bf1('0x78'),{'event':'acceptmessage','message':_0x13b23a[_0x0bf1('0x28')]},client9002)[_0x0bf1('0x1f')](function(){return _0x13b23a;});}return _0x13b23a;}return null;})[_0x0bf1('0x1f')](respondWithResult(_0x175751,null))[_0x0bf1('0x2a')](handleError(_0x175751,null));};var interaction_log=require(_0x0bf1('0x13'))(_0x0bf1('0x5b'));exports[_0x0bf1('0x79')]=function(_0x23801e,_0x471859,_0x4fb77b){var _0x307c49={'agent':{},'channel':_0x0bf1('0x5d')};if(_0x23801e[_0x0bf1('0x59')]['id']){delete _0x23801e['body']['id'];}_0x23801e[_0x0bf1('0x59')][_0x0bf1('0x60')]=_0x23801e[_0x0bf1('0x59')][_0x0bf1('0x60')]||_0x23801e[_0x0bf1('0x61')]['id'];_0x307c49[_0x0bf1('0x62')]['id']=_0x23801e['body'][_0x0bf1('0x60')];return db[_0x0bf1('0x51')][_0x0bf1('0x57')]({'where':{'id':_0x23801e['params']['id'],'UserId':null}})[_0x0bf1('0x1f')](handleEntityNotFound(_0x471859,null))[_0x0bf1('0x1f')](function(_0x5db439){if(_0x5db439){_0x307c49['message']=_0x5db439[_0x0bf1('0x7a')]({'plain':!![]});return db[_0x0bf1('0x63')]['find']({'where':{'id':_0x5db439[_0x0bf1('0x64')]}});}return null;})[_0x0bf1('0x1f')](handleEntityNotFound(_0x471859,null))[_0x0bf1('0x1f')](function(_0x44596f){if(_0x44596f){_0x307c49['interaction']=_0x44596f[_0x0bf1('0x7a')]({'plain':!![]});interaction_log[_0x0bf1('0x20')]('[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x23801e[_0x0bf1('0x61')]['id'],_0x23801e[_0x0bf1('0x61')][_0x0bf1('0x38')],_0x23801e['user']['role'],_0x307c49[_0x0bf1('0x6a')]['id'],_0x23801e[_0x0bf1('0x59')]?JSON[_0x0bf1('0x25')](_0x23801e[_0x0bf1('0x59')]):'null');return respondWithRpcPromise('RejectMessage',_0x0bf1('0x7b'),_0x307c49);}return null;})[_0x0bf1('0x1f')](function(_0x34df3e){var _0x1acb66=_0x0bf1('0x7c')+_0x34df3e[_0x0bf1('0x28')]['ContactId'];return db[_0x0bf1('0x6e')][_0x0bf1('0x3f')](_0x1acb66,{'type':db[_0x0bf1('0x7d')][_0x0bf1('0x7e')][_0x0bf1('0x6f')],'raw':!![]})[_0x0bf1('0x1f')](function(_0x31f0bc){return _0x31f0bc;});})[_0x0bf1('0x1f')](function(_0x4cb085){if(_0x4cb085){_0x307c49[_0x0bf1('0x28')][_0x0bf1('0x70')]=_0x4cb085[0x0];if(!_0x23801e[_0x0bf1('0x59')][_0x0bf1('0x60')])return;return db[_0x0bf1('0x71')][_0x0bf1('0x57')]({'where':{'id':_0x23801e[_0x0bf1('0x59')][_0x0bf1('0x60')],'role':_0x0bf1('0x62')},'attributes':['id',_0x0bf1('0x38'),_0x0bf1('0x72'),'email',_0x0bf1('0x73')],'raw':!![]});}return null;})[_0x0bf1('0x1f')](function(_0x3cb231){if(!_0x3cb231)return null;_0x307c49[_0x0bf1('0x28')]['agent']=_0x3cb231;return _0x307c49;})[_0x0bf1('0x1f')](function(_0x2d4971){if(_0x2d4971){_0x2d4971[_0x0bf1('0x28')][_0x0bf1('0x7f')]=util[_0x0bf1('0x5f')]('SIP/%s',_0x23801e['user'][_0x0bf1('0x38')]);_0x2d4971[_0x0bf1('0x28')][_0x0bf1('0x76')]=_0x307c49[_0x0bf1('0x76')];_0x2d4971[_0x0bf1('0x28')][_0x0bf1('0x80')]=_0x307c49[_0x0bf1('0x76')];_0x2d4971['message'][_0x0bf1('0x77')]=_0x0bf1('0x79');respondWithRpcPromise('EventManager','EventManager',{'event':_0x0bf1('0x81'),'message':_0x2d4971[_0x0bf1('0x28')]},client9002);return _0x307c49;}return null;})[_0x0bf1('0x1f')](respondWithResult(_0x471859,null))[_0x0bf1('0x2a')](handleError(_0x471859,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index be87771..23b5934 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 _0x4e5c=['update','emit','hasOwnProperty','hook','events','setMaxListeners','save'];(function(_0x3778d6,_0x2e4fd0){var _0x30c1cd=function(_0x1ab516){while(--_0x1ab516){_0x3778d6['push'](_0x3778d6['shift']());}};_0x30c1cd(++_0x2e4fd0);}(_0x4e5c,0x170));var _0xc4e5=function(_0x2235bf,_0x3a06a7){_0x2235bf=_0x2235bf-0x0;var _0x4c3a64=_0x4e5c[_0x2235bf];return _0x4c3a64;};'use strict';var EventEmitter=require(_0xc4e5('0x0'));var OpenchannelMessage=require('../../mysqldb')['db']['OpenchannelMessage'];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0xc4e5('0x1')](0x0);var events={'afterCreate':_0xc4e5('0x2'),'afterUpdate':_0xc4e5('0x3'),'afterDestroy':'remove'};function emitEvent(_0x3f83fb){return function(_0x53b1db,_0x5adbf8,_0x514ca6){OpenchannelMessageEvents[_0xc4e5('0x4')](_0x3f83fb+':'+_0x53b1db['id'],_0x53b1db);OpenchannelMessageEvents[_0xc4e5('0x4')](_0x3f83fb,_0x53b1db);_0x514ca6(null);};}for(var e in events){if(events[_0xc4e5('0x5')](e)){var event=events[e];OpenchannelMessage[_0xc4e5('0x6')](e,emitEvent(event));}}module['exports']=OpenchannelMessageEvents; \ No newline at end of file +var _0xe7c8=['update','emit','hook','../../mysqldb','OpenchannelMessage','setMaxListeners'];(function(_0xafde69,_0x4c6063){var _0x52c818=function(_0x1f800d){while(--_0x1f800d){_0xafde69['push'](_0xafde69['shift']());}};_0x52c818(++_0x4c6063);}(_0xe7c8,0x153));var _0x8e7c=function(_0x17a0a9,_0x3900c8){_0x17a0a9=_0x17a0a9-0x0;var _0x4901f1=_0xe7c8[_0x17a0a9];return _0x4901f1;};'use strict';var EventEmitter=require('events');var OpenchannelMessage=require(_0x8e7c('0x0'))['db'][_0x8e7c('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x8e7c('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x8e7c('0x3'),'afterDestroy':'remove'};function emitEvent(_0x595c4f){return function(_0x1520bf,_0x42938e,_0x40dbc2){OpenchannelMessageEvents[_0x8e7c('0x4')](_0x595c4f+':'+_0x1520bf['id'],_0x1520bf);OpenchannelMessageEvents[_0x8e7c('0x4')](_0x595c4f,_0x1520bf);_0x40dbc2(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelMessage[_0x8e7c('0x5')](e,emitEvent(event));}}module['exports']=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index 8f767f2..027e426 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 _0xa692=['rimraf','./openchannelMessage.attributes','exports','define','fti_openchannel_messages','body','FULLTEXT','models','get','direction','toLowerCase','secret','isNil','UserId','findOne','OpenchannelInteractionId','then','createdAt','catch','error','out','CmContact','OpenchannelAccount','find','OpenchannelAccountId','Interactions','Contact','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','Forwarding\x20message\x20%d\x20to\x20%s','length','Interaction','omit','POST','method','format','Message\x20%d\x20forwarded\x20to\x20%s','threadId','update','inspect','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','request-promise','path'];(function(_0x1e6737,_0x3a00b9){var _0x13209b=function(_0x161523){while(--_0x161523){_0x1e6737['push'](_0x1e6737['shift']());}};_0x13209b(++_0x3a00b9);}(_0xa692,0x1ee));var _0x2a69=function(_0x28e71a,_0x4405bd){_0x28e71a=_0x28e71a-0x0;var _0x268fed=_0xa692[_0x28e71a];return _0x268fed;};'use strict';var _=require(_0x2a69('0x0'));var util=require(_0x2a69('0x1'));var logger=require(_0x2a69('0x2'))(_0x2a69('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x2a69('0x4'));var fs=require('fs');var path=require(_0x2a69('0x5'));var rimraf=require(_0x2a69('0x6'));var config=require('../../config/environment');var attributes=require(_0x2a69('0x7'));module[_0x2a69('0x8')]=function(_0x1da0d4,_0x33f129){return _0x1da0d4[_0x2a69('0x9')]('OpenchannelMessage',attributes,{'tableName':'openchannel_messages','paranoid':![],'indexes':[{'name':_0x2a69('0xa'),'fields':[_0x2a69('0xb')],'type':_0x2a69('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1abe45,_0x298a2c,_0x4855b4){var _0x203d81=_0x1da0d4[_0x2a69('0xd')];var _0x24e348=_0x1abe45[_0x2a69('0xe')]({'plain':!![]});if(_0x24e348[_0x2a69('0xf')]['toLowerCase']()==='in'||_0x24e348[_0x2a69('0xf')][_0x2a69('0x10')]()==='out'&&!_0x24e348[_0x2a69('0x11')]&&!_[_0x2a69('0x12')](_0x24e348[_0x2a69('0x13')])){_0x203d81['OpenchannelInteraction'][_0x2a69('0x14')]({'where':{'id':_0x24e348[_0x2a69('0x15')]}})[_0x2a69('0x16')](function(_0x59974c){if(_0x59974c){_0x59974c['update']({'lastMsgAt':_0x24e348[_0x2a69('0x17')],'lastMsgDirection':_0x24e348[_0x2a69('0xf')][_0x2a69('0x10')]()});}})[_0x2a69('0x18')](function(_0x136d72){console[_0x2a69('0x19')](_0x136d72);});}if(_0x24e348['direction']===_0x2a69('0x1a')&&!_0x24e348[_0x2a69('0x11')]){var _0x81f61b;_0x203d81[_0x2a69('0x1b')]['describe']()[_0x2a69('0x16')](function(_0x4218fb){return _0x203d81[_0x2a69('0x1c')][_0x2a69('0x1d')]({'where':{'id':_0x24e348[_0x2a69('0x1e')]},'include':[{'model':_0x203d81['OpenchannelInteraction'],'as':_0x2a69('0x1f'),'where':{'id':_0x24e348[_0x2a69('0x15')]},'limit':0x1,'include':[{'model':_0x203d81[_0x2a69('0x1b')],'as':_0x2a69('0x20'),'attributes':_['keys'](_0x4218fb)}]}]});})['then'](function(_0x5d73ec){_0x81f61b=_0x5d73ec[_0x2a69('0xe')]({'plain':!![]});if(_0x81f61b&&_0x81f61b[_0x2a69('0x21')]){logger[_0x2a69('0x22')](_0x2a69('0x23'),_0x2a69('0x24'),util['format'](_0x2a69('0x25'),_0x24e348['id'],_0x81f61b[_0x2a69('0x21')]));if(_0x81f61b[_0x2a69('0x1f')]&&_0x81f61b['Interactions'][_0x2a69('0x26')]){_0x24e348[_0x2a69('0x27')]=_[_0x2a69('0x28')](_0x81f61b[_0x2a69('0x1f')][0x0],_0x2a69('0x20'));_0x24e348[_0x2a69('0x20')]=_0x81f61b[_0x2a69('0x1f')][0x0]['Contact'];}var _0x298a2c={'method':_0x2a69('0x29'),'uri':encodeURI(_0x81f61b['replyUri']),'json':!![],'resolveWithFullResponse':!![]};switch(_0x298a2c[_0x2a69('0x2a')]){case'GET':_0x298a2c['qs']=_0x24e348;break;case _0x2a69('0x29'):_0x298a2c[_0x2a69('0xb')]=_0x24e348;break;}return rp(_0x298a2c)[_0x2a69('0x16')](function(_0x5510fc){logger[_0x2a69('0x22')](_0x2a69('0x23'),_0x2a69('0x24'),util[_0x2a69('0x2b')](_0x2a69('0x2c'),_0x24e348['id'],_0x81f61b[_0x2a69('0x21')]));if(_0x5510fc[_0x2a69('0xb')][_0x2a69('0x2d')]&&_0x5510fc['body'][_0x2a69('0x2d')]!=_0x24e348['Interaction'][_0x2a69('0x2d')]){return _0x203d81['OpenchannelInteraction'][_0x2a69('0x2e')]({'threadId':_0x5510fc[_0x2a69('0xb')][_0x2a69('0x2d')]},{'where':{'id':_0x24e348[_0x2a69('0x27')]['id']}});}else{return;}})['then'](function(){return _0x1abe45[_0x2a69('0x2e')]({'read':!![]});})[_0x2a69('0x18')](function(_0x49e2b2){logger['error'](_0x2a69('0x23'),_0x2a69('0x24'),util[_0x2a69('0x2f')](_0x49e2b2,{'showHidden':![],'depth':null}));_0x4855b4();});}else{_0x4855b4();}})['finally'](function(){_0x4855b4();});}else{_0x4855b4();}}},'charset':_0x2a69('0x30'),'collate':_0x2a69('0x31')});}; \ No newline at end of file +var _0x9c8e=['direction','toLowerCase','out','secret','isNil','OpenchannelInteraction','OpenchannelInteractionId','then','update','createdAt','catch','error','CmContact','describe','find','Interactions','Contact','keys','replyUri','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','length','Interaction','omit','POST','method','GET','threadId','inspect','finally','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','path','../../config/environment','./openchannelMessage.attributes','exports','define','OpenchannelMessage','fti_openchannel_messages','body'];(function(_0x23c8ef,_0x334e53){var _0x3969a7=function(_0x475417){while(--_0x475417){_0x23c8ef['push'](_0x23c8ef['shift']());}};_0x3969a7(++_0x334e53);}(_0x9c8e,0xac));var _0xe9c8=function(_0x24850c,_0x25094a){_0x24850c=_0x24850c-0x0;var _0x5f1bf0=_0x9c8e[_0x24850c];return _0x5f1bf0;};'use strict';var _=require(_0xe9c8('0x0'));var util=require('util');var logger=require(_0xe9c8('0x1'))(_0xe9c8('0x2'));var moment=require(_0xe9c8('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xe9c8('0x4'));var rimraf=require('rimraf');var config=require(_0xe9c8('0x5'));var attributes=require(_0xe9c8('0x6'));module[_0xe9c8('0x7')]=function(_0x40da92,_0x19b21b){return _0x40da92[_0xe9c8('0x8')](_0xe9c8('0x9'),attributes,{'tableName':'openchannel_messages','paranoid':![],'indexes':[{'name':_0xe9c8('0xa'),'fields':[_0xe9c8('0xb')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x300156,_0x360d10,_0x421066){var _0x42566c=_0x40da92['models'];var _0x249375=_0x300156['get']({'plain':!![]});if(_0x249375[_0xe9c8('0xc')][_0xe9c8('0xd')]()==='in'||_0x249375[_0xe9c8('0xc')][_0xe9c8('0xd')]()===_0xe9c8('0xe')&&!_0x249375[_0xe9c8('0xf')]&&!_[_0xe9c8('0x10')](_0x249375['UserId'])){_0x42566c[_0xe9c8('0x11')]['findOne']({'where':{'id':_0x249375[_0xe9c8('0x12')]}})[_0xe9c8('0x13')](function(_0x2007cf){if(_0x2007cf){_0x2007cf[_0xe9c8('0x14')]({'lastMsgAt':_0x249375[_0xe9c8('0x15')],'lastMsgDirection':_0x249375[_0xe9c8('0xc')][_0xe9c8('0xd')]()});}})[_0xe9c8('0x16')](function(_0xfb5829){console[_0xe9c8('0x17')](_0xfb5829);});}if(_0x249375[_0xe9c8('0xc')]==='out'&&!_0x249375['secret']){var _0x1f7ed3;_0x42566c[_0xe9c8('0x18')][_0xe9c8('0x19')]()[_0xe9c8('0x13')](function(_0x4df04f){return _0x42566c['OpenchannelAccount'][_0xe9c8('0x1a')]({'where':{'id':_0x249375['OpenchannelAccountId']},'include':[{'model':_0x42566c[_0xe9c8('0x11')],'as':_0xe9c8('0x1b'),'where':{'id':_0x249375['OpenchannelInteractionId']},'limit':0x1,'include':[{'model':_0x42566c[_0xe9c8('0x18')],'as':_0xe9c8('0x1c'),'attributes':_[_0xe9c8('0x1d')](_0x4df04f)}]}]});})[_0xe9c8('0x13')](function(_0x23b3fa){_0x1f7ed3=_0x23b3fa['get']({'plain':!![]});if(_0x1f7ed3&&_0x1f7ed3[_0xe9c8('0x1e')]){logger[_0xe9c8('0x1f')](_0xe9c8('0x20'),_0xe9c8('0x21'),util[_0xe9c8('0x22')](_0xe9c8('0x23'),_0x249375['id'],_0x1f7ed3[_0xe9c8('0x1e')]));if(_0x1f7ed3[_0xe9c8('0x1b')]&&_0x1f7ed3[_0xe9c8('0x1b')][_0xe9c8('0x24')]){_0x249375[_0xe9c8('0x25')]=_[_0xe9c8('0x26')](_0x1f7ed3[_0xe9c8('0x1b')][0x0],_0xe9c8('0x1c'));_0x249375[_0xe9c8('0x1c')]=_0x1f7ed3[_0xe9c8('0x1b')][0x0][_0xe9c8('0x1c')];}var _0x360d10={'method':_0xe9c8('0x27'),'uri':encodeURI(_0x1f7ed3['replyUri']),'json':!![],'resolveWithFullResponse':!![]};switch(_0x360d10[_0xe9c8('0x28')]){case _0xe9c8('0x29'):_0x360d10['qs']=_0x249375;break;case'POST':_0x360d10[_0xe9c8('0xb')]=_0x249375;break;}return rp(_0x360d10)[_0xe9c8('0x13')](function(_0x52e16c){logger[_0xe9c8('0x1f')](_0xe9c8('0x20'),_0xe9c8('0x21'),util['format']('Message\x20%d\x20forwarded\x20to\x20%s',_0x249375['id'],_0x1f7ed3[_0xe9c8('0x1e')]));if(_0x52e16c[_0xe9c8('0xb')][_0xe9c8('0x2a')]&&_0x52e16c[_0xe9c8('0xb')][_0xe9c8('0x2a')]!=_0x249375[_0xe9c8('0x25')][_0xe9c8('0x2a')]){return _0x42566c[_0xe9c8('0x11')][_0xe9c8('0x14')]({'threadId':_0x52e16c[_0xe9c8('0xb')][_0xe9c8('0x2a')]},{'where':{'id':_0x249375['Interaction']['id']}});}else{return;}})[_0xe9c8('0x13')](function(){return _0x300156[_0xe9c8('0x14')]({'read':!![]});})[_0xe9c8('0x16')](function(_0x1b32bf){logger[_0xe9c8('0x17')](_0xe9c8('0x20'),_0xe9c8('0x21'),util[_0xe9c8('0x2b')](_0x1b32bf,{'showHidden':![],'depth':null}));_0x421066();});}else{_0x421066();}})[_0xe9c8('0x2c')](function(){_0x421066();});}else{_0x421066();}}},'charset':'utf8mb4','collate':_0xe9c8('0x2d')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index 2f0b2aa..115c60e 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(_0x16f365,_0x117a19){var _0x9eddc8=function(_0x37e200){while(--_0x37e200){_0x16f365['push'](_0x16f365['shift']());}};_0x9eddc8(++_0x117a19);}(_0xadb5,0xad));var _0x5adb=function(_0x3a9c9f,_0x1488b3){_0x3a9c9f=_0x3a9c9f-0x0;var _0x52dd4c=_0xadb5[_0x3a9c9f];return _0x52dd4c;};'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 _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(_0x20b9ad,_0x59a2f7){var _0x40e80a=function(_0xdf53be){while(--_0xdf53be){_0x20b9ad['push'](_0x20b9ad['shift']());}};_0x40e80a(++_0x59a2f7);}(_0xadb5,0xad));var _0x5adb=function(_0x24822d,_0x229667){_0x24822d=_0x24822d-0x0;var _0x22f4d6=_0xadb5[_0x24822d];return _0x22f4d6;};'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 diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index b5035b6..10dbd11 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 _0x1396=['removeListener','register','length','openchannelMessage:','./openchannelMessage.events','remove'];(function(_0x4160ff,_0x3d6483){var _0x402af5=function(_0x245afa){while(--_0x245afa){_0x4160ff['push'](_0x4160ff['shift']());}};_0x402af5(++_0x3d6483);}(_0x1396,0x1ea));var _0x6139=function(_0x74745d,_0x177606){_0x74745d=_0x74745d-0x0;var _0x174ab3=_0x1396[_0x74745d];return _0x174ab3;};'use strict';var OpenchannelMessageEvents=require(_0x6139('0x0'));var events=['save',_0x6139('0x1'),'update'];function createListener(_0x56c0d8,_0xc1512c){return function(_0x15153d){_0xc1512c['emit'](_0x56c0d8,_0x15153d);};}function removeListener(_0x409054,_0x55c7d4){return function(){OpenchannelMessageEvents[_0x6139('0x2')](_0x409054,_0x55c7d4);};}exports[_0x6139('0x3')]=function(_0x5fe8f0){for(var _0x9e7835=0x0,_0x453449=events[_0x6139('0x4')];_0x9e7835<_0x453449;_0x9e7835++){var _0x32f7e9=events[_0x9e7835];var _0x488fba=createListener(_0x6139('0x5')+_0x32f7e9,_0x5fe8f0);OpenchannelMessageEvents['on'](_0x32f7e9,_0x488fba);}}; \ No newline at end of file +var _0xa810=['length','openchannelMessage:','./openchannelMessage.events','save','emit','removeListener','register'];(function(_0xafdec6,_0x3d94df){var _0x372bdb=function(_0x5b3fd6){while(--_0x5b3fd6){_0xafdec6['push'](_0xafdec6['shift']());}};_0x372bdb(++_0x3d94df);}(_0xa810,0x80));var _0x0a81=function(_0x18b931,_0x2cad1d){_0x18b931=_0x18b931-0x0;var _0x114958=_0xa810[_0x18b931];return _0x114958;};'use strict';var OpenchannelMessageEvents=require(_0x0a81('0x0'));var events=[_0x0a81('0x1'),'remove','update'];function createListener(_0x37e358,_0x2b2541){return function(_0x2c81ad){_0x2b2541[_0x0a81('0x2')](_0x37e358,_0x2c81ad);};}function removeListener(_0x4e0012,_0x419d7f){return function(){OpenchannelMessageEvents[_0x0a81('0x3')](_0x4e0012,_0x419d7f);};}exports[_0x0a81('0x4')]=function(_0xb0e926){for(var _0x59e823=0x0,_0x17d2da=events[_0x0a81('0x5')];_0x59e823<_0x17d2da;_0x59e823++){var _0x25b9f0=events[_0x59e823];var _0x3b34a9=createListener(_0x0a81('0x6')+_0x25b9f0,_0xb0e926);OpenchannelMessageEvents['on'](_0x25b9f0,_0x3b34a9);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 14e392b..f40d17b 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 _0x86ca=['post','addAgents','put','update','destroy','delete','removeTeams','removeAgents','exports','multer','path','express','Router','fs-extra','get','isAuthenticated','index','/describe','/:id','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','create'];(function(_0x2880ab,_0x37fc24){var _0x50792b=function(_0x991a93){while(--_0x991a93){_0x2880ab['push'](_0x2880ab['shift']());}};_0x50792b(++_0x37fc24);}(_0x86ca,0xd9));var _0xa86c=function(_0x386e9c,_0x1d508c){_0x386e9c=_0x386e9c-0x0;var _0x13d254=_0x86ca[_0x386e9c];return _0x13d254;};'use strict';var multer=require(_0xa86c('0x0'));var util=require('util');var path=require(_0xa86c('0x1'));var timeout=require('connect-timeout');var express=require(_0xa86c('0x2'));var router=express[_0xa86c('0x3')]();var fs_extra=require(_0xa86c('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./openchannelQueue.controller');router[_0xa86c('0x5')]('/',auth[_0xa86c('0x6')](),controller[_0xa86c('0x7')]);router[_0xa86c('0x5')](_0xa86c('0x8'),auth[_0xa86c('0x6')](),controller['describe']);router[_0xa86c('0x5')](_0xa86c('0x9'),auth[_0xa86c('0x6')](),controller[_0xa86c('0xa')]);router[_0xa86c('0x5')](_0xa86c('0xb'),auth['isAuthenticated'](),controller['getMembers']);router[_0xa86c('0x5')](_0xa86c('0xc'),auth[_0xa86c('0x6')](),controller[_0xa86c('0xd')]);router[_0xa86c('0x5')](_0xa86c('0xe'),auth['isAuthenticated'](),controller[_0xa86c('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0xa86c('0x10')]);router[_0xa86c('0x11')](_0xa86c('0xc'),auth['isAuthenticated'](),controller['addTeams']);router[_0xa86c('0x11')](_0xa86c('0xe'),auth[_0xa86c('0x6')](),controller[_0xa86c('0x12')]);router[_0xa86c('0x13')](_0xa86c('0x9'),auth[_0xa86c('0x6')](),controller[_0xa86c('0x14')]);router['delete'](_0xa86c('0x9'),auth[_0xa86c('0x6')](),controller[_0xa86c('0x15')]);router[_0xa86c('0x16')](_0xa86c('0xc'),auth[_0xa86c('0x6')](),controller[_0xa86c('0x17')]);router[_0xa86c('0x16')]('/:id/users',auth['isAuthenticated'](),controller[_0xa86c('0x18')]);module[_0xa86c('0x19')]=router; \ No newline at end of file +var _0xecea=['addAgents','put','update','delete','destroy','/:id/teams','removeTeams','removeAgents','exports','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','getMembers','getTeams','/:id/users','post'];(function(_0x38209c,_0x1c0e7e){var _0x44eebb=function(_0x10721f){while(--_0x10721f){_0x38209c['push'](_0x38209c['shift']());}};_0x44eebb(++_0x1c0e7e);}(_0xecea,0xd9));var _0xaece=function(_0x3ae1aa,_0xa535d0){_0x3ae1aa=_0x3ae1aa-0x0;var _0x32801e=_0xecea[_0x3ae1aa];return _0x32801e;};'use strict';var multer=require(_0xaece('0x0'));var util=require(_0xaece('0x1'));var path=require(_0xaece('0x2'));var timeout=require('connect-timeout');var express=require(_0xaece('0x3'));var router=express[_0xaece('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xaece('0x5'));var config=require(_0xaece('0x6'));var controller=require('./openchannelQueue.controller');router[_0xaece('0x7')]('/',auth[_0xaece('0x8')](),controller[_0xaece('0x9')]);router[_0xaece('0x7')](_0xaece('0xa'),auth[_0xaece('0x8')](),controller[_0xaece('0xb')]);router['get'](_0xaece('0xc'),auth[_0xaece('0x8')](),controller['show']);router[_0xaece('0x7')]('/:id/members',auth[_0xaece('0x8')](),controller[_0xaece('0xd')]);router[_0xaece('0x7')]('/:id/teams',auth[_0xaece('0x8')](),controller[_0xaece('0xe')]);router[_0xaece('0x7')](_0xaece('0xf'),auth['isAuthenticated'](),controller['getAgents']);router['post']('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/teams',auth[_0xaece('0x8')](),controller['addTeams']);router[_0xaece('0x10')]('/:id/users',auth[_0xaece('0x8')](),controller[_0xaece('0x11')]);router[_0xaece('0x12')](_0xaece('0xc'),auth[_0xaece('0x8')](),controller[_0xaece('0x13')]);router[_0xaece('0x14')](_0xaece('0xc'),auth[_0xaece('0x8')](),controller[_0xaece('0x15')]);router[_0xaece('0x14')](_0xaece('0x16'),auth[_0xaece('0x8')](),controller[_0xaece('0x17')]);router['delete'](_0xaece('0xf'),auth['isAuthenticated'](),controller[_0xaece('0x18')]);module[_0xaece('0x19')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index aa28b04..b32b8d0 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 _0xb601=['ENUM','rrmemory','beepall','roundrobin','sequelize','exports','name','STRING'];(function(_0x10a540,_0xfaa1bd){var _0xb724c4=function(_0x1ad592){while(--_0x1ad592){_0x10a540['push'](_0x10a540['shift']());}};_0xb724c4(++_0xfaa1bd);}(_0xb601,0xac));var _0x1b60=function(_0x394c4c,_0x201031){_0x394c4c=_0x394c4c-0x0;var _0x5bfa5a=_0xb601[_0x394c4c];return _0x5bfa5a;};'use strict';var Sequelize=require(_0x1b60('0x0'));module[_0x1b60('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x1b60('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x1b60('0x3')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x1b60('0x4')](_0x1b60('0x5'),_0x1b60('0x6'),_0x1b60('0x7'))}}; \ No newline at end of file +var _0x9dfa=['roundrobin','sequelize','STRING','rrmemory'];(function(_0xb4eb4c,_0x5e6d26){var _0x4340bf=function(_0x375950){while(--_0x375950){_0xb4eb4c['push'](_0xb4eb4c['shift']());}};_0x4340bf(++_0x5e6d26);}(_0x9dfa,0xf9));var _0xa9df=function(_0x24d1db,_0x380710){_0x24d1db=_0x24d1db-0x0;var _0x5445=_0x9dfa[_0x24d1db];return _0x5445;};'use strict';var Sequelize=require(_0xa9df('0x0'));module['exports']={'name':{'type':Sequelize[_0xa9df('0x1')],'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'](_0xa9df('0x2'),'beepall',_0xa9df('0x3'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 7c699cc..7120def 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 _0x9158=['format','%s/%s','SIP','getTeams','findOne','Team','addTeams','User','Agents','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','userOpenchannelQueue:save','removeTeams','field','tq.TeamId','from','team_has_openchannel_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','compact','omit','spread','ids','removeAgents','isArray','emit','userOpenchannelQueue:remove','getAgents','nolimit','bluebird','util','lodash','squel','api','../../mysqldb','redis','localhost','socket.io-emitter','./openchannelQueue.socket','register','sendStatus','status','json','offset','undefined','limit','set','update','then','destroy','get','OpenchannelQueues','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','where','OpenchannelQueue','count','include','findAll','rows','catch','show','params','model','keys','query','intersection','attributes','fields','length','includeAll','merge','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','UserOpenchannelQueue','filters','hasOwnProperty','order','sort','pick','OpenchannelQueueId','filter','findAndCountAll','UserId','agent','openchannelPause','updatedAt','createdAt'];(function(_0x5ac273,_0x34bad0){var _0x3b9515=function(_0xc8d6f8){while(--_0xc8d6f8){_0x5ac273['push'](_0x5ac273['shift']());}};_0x3b9515(++_0x34bad0);}(_0x9158,0x129));var _0x8915=function(_0x544bc6,_0x5bce7a){_0x544bc6=_0x544bc6-0x0;var _0x1bdee1=_0x9158[_0x544bc6];return _0x1bdee1;};'use strict';var BPromise=require(_0x8915('0x0'));var util=require(_0x8915('0x1'));var _=require(_0x8915('0x2'));var squel=require(_0x8915('0x3'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0x8915('0x4'));var config=require('../../config/environment');var db=require(_0x8915('0x5'))['db'];config[_0x8915('0x6')]=_['defaults'](config[_0x8915('0x6')],{'host':_0x8915('0x7'),'port':0x18eb});var socket=require(_0x8915('0x8'))(new Redis(config[_0x8915('0x6')]));require(_0x8915('0x9'))[_0x8915('0xa')](socket);function respondWithStatusCode(_0x29c6b3,_0x62712a){_0x62712a=_0x62712a||0xcc;return function(_0xba774f){if(_0xba774f){return _0x29c6b3[_0x8915('0xb')](_0x62712a);}return _0x29c6b3['status'](_0x62712a)['end']();};}function respondWithResult(_0x5159fc,_0x3ca9f2){_0x3ca9f2=_0x3ca9f2||0xc8;return function(_0xbb2196){if(_0xbb2196){return _0x5159fc[_0x8915('0xc')](_0x3ca9f2)[_0x8915('0xd')](_0xbb2196);}};}function respondWithFilteredResult(_0x3aec03,_0xf0fc40){return function(_0x484e52){if(_0x484e52){var _0x4745f7=typeof _0xf0fc40[_0x8915('0xe')]===_0x8915('0xf')&&typeof _0xf0fc40[_0x8915('0x10')]===_0x8915('0xf');var _0x45a4cc=_0x484e52['count'];var _0x1b257b=_0x4745f7?0x0:_0xf0fc40[_0x8915('0xe')];var _0xd3769a=_0x4745f7?_0x484e52['count']:_0xf0fc40[_0x8915('0xe')]+_0xf0fc40['limit'];var _0xa17829;if(_0xd3769a>=_0x45a4cc){_0xd3769a=_0x45a4cc;_0xa17829=0xc8;}else{_0xa17829=0xce;}_0x3aec03[_0x8915('0xc')](_0xa17829);return _0x3aec03[_0x8915('0x11')]('Content-Range',_0x1b257b+'-'+_0xd3769a+'/'+_0x45a4cc)[_0x8915('0xd')](_0x484e52);}return null;};}function saveUpdates(_0x32ac46){return function(_0xb7e457){if(_0xb7e457){return _0xb7e457[_0x8915('0x12')](_0x32ac46)[_0x8915('0x13')](function(_0x26e5cc){return _0x26e5cc;});}return null;};}function removeEntity(_0x4516fa){return function(_0xb1acc4){if(_0xb1acc4){return _0xb1acc4[_0x8915('0x14')]()['then'](function(){var _0x2a2472=_0xb1acc4[_0x8915('0x15')]({'plain':!![]});var _0xa1e3ee=_0x8915('0x16');return db[_0x8915('0x17')][_0x8915('0x14')]({'where':{'type':_0xa1e3ee,'resourceId':_0x2a2472['id']}})[_0x8915('0x13')](function(){return _0xb1acc4;});})[_0x8915('0x13')](function(){_0x4516fa[_0x8915('0xc')](0xcc)['end']();});}};}function handleEntityNotFound(_0x491575){return function(_0x588b4a){if(!_0x588b4a){_0x491575[_0x8915('0xb')](0x194);}return _0x588b4a;};}function handleError(_0x4fae44,_0x17c0c6){_0x17c0c6=_0x17c0c6||0x1f4;return function(_0x296563){logger[_0x8915('0x18')](_0x296563[_0x8915('0x19')]);if(_0x296563['name']){delete _0x296563[_0x8915('0x1a')];}_0x4fae44[_0x8915('0xc')](_0x17c0c6)[_0x8915('0x1b')](_0x296563);};}exports[_0x8915('0x1c')]=function(_0xab0598,_0x306f9a){var _0x5efd97={};var _0x4885f6={'count':0x0,'rows':[]};var _0x4e15e1=_[_0x8915('0x1d')](db['OpenchannelQueue'][_0x8915('0x1e')],function(_0x3cf17c){return{'name':_0x3cf17c[_0x8915('0x1f')],'type':_0x3cf17c[_0x8915('0x20')][_0x8915('0x21')]};});_0x5efd97=qs['getOptions'](_0x4e15e1,_0xab0598);var _0x550ec7={'where':_0x5efd97[_0x8915('0x22')]};return db[_0x8915('0x23')][_0x8915('0x24')](_0x550ec7)[_0x8915('0x13')](function(_0x23d80b){_0x4885f6[_0x8915('0x24')]=_0x23d80b;_0x5efd97[_0x8915('0x25')]=qs[_0x8915('0x25')](_0xab0598['query']);return db[_0x8915('0x23')][_0x8915('0x26')](_0x5efd97);})[_0x8915('0x13')](function(_0x4efd82){_0x4885f6[_0x8915('0x27')]=_0x4efd82;return _0x4885f6;})[_0x8915('0x13')](respondWithFilteredResult(_0x306f9a,_0x5efd97))[_0x8915('0x28')](handleError(_0x306f9a,null));};exports[_0x8915('0x29')]=function(_0x3015a0,_0x425d92){var _0x19df16={'raw':!![],'where':{'id':_0x3015a0[_0x8915('0x2a')]['id']}},_0x16dd92={};_0x16dd92[_0x8915('0x2b')]=_[_0x8915('0x2c')](db['OpenchannelQueue'][_0x8915('0x1e')]);_0x16dd92[_0x8915('0x2d')]=_[_0x8915('0x2c')](_0x3015a0[_0x8915('0x2d')]);_0x16dd92['filters']=_[_0x8915('0x2e')](_0x16dd92[_0x8915('0x2b')],_0x16dd92['query']);_0x19df16[_0x8915('0x2f')]=_[_0x8915('0x2e')](_0x16dd92[_0x8915('0x2b')],qs['fields'](_0x3015a0['query'][_0x8915('0x30')]));_0x19df16[_0x8915('0x2f')]=_0x19df16[_0x8915('0x2f')][_0x8915('0x31')]?_0x19df16[_0x8915('0x2f')]:_0x16dd92[_0x8915('0x2b')];if(_0x3015a0['query'][_0x8915('0x32')]){_0x19df16[_0x8915('0x25')]=[{'all':!![]}];}_0x19df16=_[_0x8915('0x33')]({},_0x19df16,_0x3015a0[_0x8915('0x34')]);return db[_0x8915('0x23')][_0x8915('0x35')](_0x19df16)[_0x8915('0x13')](handleEntityNotFound(_0x425d92,null))['then'](respondWithResult(_0x425d92,null))[_0x8915('0x28')](handleError(_0x425d92,null));};exports[_0x8915('0x36')]=function(_0x5ae34e,_0x1eb7fc){return db[_0x8915('0x23')]['create'](_0x5ae34e['body'],{})['then'](function(_0x331a9e){var _0x256ec6=_0x5ae34e[_0x8915('0x37')][_0x8915('0x15')]({'plain':!![]});if(!_0x256ec6)throw new Error(_0x8915('0x38'));if(_0x256ec6[_0x8915('0x39')]==='user'){var _0x1b7520=_0x331a9e[_0x8915('0x15')]({'plain':!![]});var _0x1dc7cb=_0x8915('0x16');return db[_0x8915('0x3a')][_0x8915('0x35')]({'where':{'name':_0x1dc7cb,'userProfileId':_0x256ec6[_0x8915('0x3b')]},'raw':!![]})[_0x8915('0x13')](function(_0x280cea){if(_0x280cea&&_0x280cea[_0x8915('0x3c')]===0x0){return db[_0x8915('0x17')][_0x8915('0x36')]({'name':_0x1b7520[_0x8915('0x1a')],'resourceId':_0x1b7520['id'],'type':_0x280cea[_0x8915('0x1a')],'sectionId':_0x280cea['id']},{})[_0x8915('0x13')](function(){return _0x331a9e;});}else{return _0x331a9e;}})[_0x8915('0x28')](function(_0x12413f){logger[_0x8915('0x18')](_0x8915('0x3d'),_0x12413f);throw _0x12413f;});}return _0x331a9e;})[_0x8915('0x13')](respondWithResult(_0x1eb7fc,0xc9))[_0x8915('0x28')](handleError(_0x1eb7fc,null));};exports[_0x8915('0x12')]=function(_0x1a163f,_0x1e7021){if(_0x1a163f[_0x8915('0x3e')]['id']){delete _0x1a163f[_0x8915('0x3e')]['id'];}return db[_0x8915('0x23')][_0x8915('0x35')]({'where':{'id':_0x1a163f['params']['id']}})[_0x8915('0x13')](handleEntityNotFound(_0x1e7021,null))[_0x8915('0x13')](saveUpdates(_0x1a163f[_0x8915('0x3e')],null))['then'](respondWithResult(_0x1e7021,null))[_0x8915('0x28')](handleError(_0x1e7021,null));};exports[_0x8915('0x14')]=function(_0x324ec2,_0x5af593){return db[_0x8915('0x23')][_0x8915('0x35')]({'where':{'id':_0x324ec2[_0x8915('0x2a')]['id']}})[_0x8915('0x13')](handleEntityNotFound(_0x5af593,null))['then'](removeEntity(_0x5af593,null))[_0x8915('0x28')](handleError(_0x5af593,null));};exports[_0x8915('0x3f')]=function(_0x46e67f,_0x2da118){return db[_0x8915('0x23')][_0x8915('0x3f')]()[_0x8915('0x13')](respondWithResult(_0x2da118,null))['catch'](handleError(_0x2da118,null));};exports['getMembers']=function(_0x46d5b7,_0x4d253a){var _0x455275={'raw':!![],'where':{}},_0x2b4407={},_0x2bd8db;return db[_0x8915('0x23')]['findOne']({'where':{'id':_0x46d5b7[_0x8915('0x2a')]['id']}})[_0x8915('0x13')](handleEntityNotFound(_0x4d253a,null))['then'](function(_0x1f7018){if(_0x1f7018){_0x2bd8db=_0x1f7018[_0x8915('0x15')]({'plain':!![]});_0x2b4407[_0x8915('0x2b')]=_[_0x8915('0x2c')](db[_0x8915('0x40')][_0x8915('0x1e')]);_0x2b4407['query']=_[_0x8915('0x2c')](_0x46d5b7[_0x8915('0x2d')]);_0x2b4407[_0x8915('0x41')]=_[_0x8915('0x2e')](_0x2b4407[_0x8915('0x2b')],_0x2b4407['query']);_0x455275[_0x8915('0x2f')]=_[_0x8915('0x2e')](_0x2b4407[_0x8915('0x2b')],qs[_0x8915('0x30')](_0x46d5b7[_0x8915('0x2d')][_0x8915('0x30')]));_0x455275[_0x8915('0x2f')]=_0x455275[_0x8915('0x2f')][_0x8915('0x31')]?_0x455275[_0x8915('0x2f')]:_0x2b4407[_0x8915('0x2b')];if(!_0x46d5b7[_0x8915('0x2d')][_0x8915('0x42')]('nolimit')){_0x455275['limit']=qs['limit'](_0x46d5b7[_0x8915('0x2d')][_0x8915('0x10')]);_0x455275[_0x8915('0xe')]=qs[_0x8915('0xe')](_0x46d5b7[_0x8915('0x2d')]['offset']);}_0x455275[_0x8915('0x43')]=qs[_0x8915('0x44')](_0x46d5b7[_0x8915('0x2d')][_0x8915('0x44')]);_0x455275['where']=qs[_0x8915('0x41')](_[_0x8915('0x45')](_0x46d5b7[_0x8915('0x2d')],_0x2b4407[_0x8915('0x41')]));_0x455275[_0x8915('0x22')][_0x8915('0x46')]=_0x1f7018['id'];if(_0x46d5b7[_0x8915('0x2d')][_0x8915('0x47')]){_0x455275[_0x8915('0x22')]=_['merge'](_0x455275[_0x8915('0x22')],{'$or':_[_0x8915('0x1d')](_0x455275[_0x8915('0x2f')],function(_0x58d443){var _0xac8cf4={};_0xac8cf4[_0x58d443]={'$like':'%'+_0x46d5b7[_0x8915('0x2d')][_0x8915('0x47')]+'%'};return _0xac8cf4;})});}_0x455275=_[_0x8915('0x33')]({},_0x455275,_0x46d5b7['options']);return db['UserOpenchannelQueue'][_0x8915('0x26')](_0x455275);}})[_0x8915('0x13')](function(_0x36f196){if(_0x36f196){return db['User'][_0x8915('0x48')]({'where':{'id':_[_0x8915('0x1d')](_0x36f196,_0x8915('0x49')),'role':_0x8915('0x4a')},'attributes':['id',_0x8915('0x1a'),_0x8915('0x4b'),_0x8915('0x4c'),_0x8915('0x4d')]});}})[_0x8915('0x13')](function(_0x350513){if(_0x350513){return{'count':_0x350513[_0x8915('0x24')],'rows':_['map'](_0x350513[_0x8915('0x27')],function(_0x3f1134){return{'membername':_0x3f1134['name'],'UserId':_0x3f1134['id'],'queue_name':_0x2bd8db[_0x8915('0x1a')],'OpenchannelQueueId':_0x2bd8db['id'],'interface':util[_0x8915('0x4e')](_0x8915('0x4f'),_0x8915('0x50'),_0x3f1134[_0x8915('0x1a')]),'penalty':0x0,'paused':_0x3f1134[_0x8915('0x4b')],'createdAt':_0x3f1134[_0x8915('0x4d')],'updatedAt':_0x3f1134[_0x8915('0x4c')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x4d253a,_0x455275))[_0x8915('0x28')](handleError(_0x4d253a,null));};exports[_0x8915('0x51')]=function(_0x167f3a,_0x3423da){var _0x1e1a80={};var _0x325a06={};var _0xe6ce82;var _0x5021d7;return db[_0x8915('0x23')][_0x8915('0x52')]({'where':{'id':_0x167f3a[_0x8915('0x2a')]['id']}})['then'](handleEntityNotFound(_0x3423da,null))[_0x8915('0x13')](function(_0x1c9f69){if(_0x1c9f69){_0xe6ce82=_0x1c9f69;_0x325a06[_0x8915('0x2b')]=_[_0x8915('0x2c')](db[_0x8915('0x53')][_0x8915('0x1e')]);_0x325a06[_0x8915('0x2d')]=_[_0x8915('0x2c')](_0x167f3a[_0x8915('0x2d')]);_0x325a06[_0x8915('0x41')]=_['intersection'](_0x325a06[_0x8915('0x2b')],_0x325a06[_0x8915('0x2d')]);_0x1e1a80[_0x8915('0x2f')]=_['intersection'](_0x325a06[_0x8915('0x2b')],qs[_0x8915('0x30')](_0x167f3a['query'][_0x8915('0x30')]));_0x1e1a80[_0x8915('0x2f')]=_0x1e1a80['attributes'][_0x8915('0x31')]?_0x1e1a80['attributes']:_0x325a06[_0x8915('0x2b')];_0x1e1a80[_0x8915('0x43')]=qs[_0x8915('0x44')](_0x167f3a[_0x8915('0x2d')][_0x8915('0x44')]);_0x1e1a80[_0x8915('0x22')]=qs[_0x8915('0x41')](_[_0x8915('0x45')](_0x167f3a[_0x8915('0x2d')],_0x325a06[_0x8915('0x41')]));if(_0x167f3a[_0x8915('0x2d')][_0x8915('0x47')]){_0x1e1a80[_0x8915('0x22')]=_[_0x8915('0x33')](_0x1e1a80[_0x8915('0x22')],{'$or':_[_0x8915('0x1d')](_0x1e1a80['attributes'],function(_0x44cbb0){var _0x121a04={};_0x121a04[_0x44cbb0]={'$like':'%'+_0x167f3a['query'][_0x8915('0x47')]+'%'};return _0x121a04;})});}_0x1e1a80=_[_0x8915('0x33')]({},_0x1e1a80,_0x167f3a[_0x8915('0x34')]);return _0xe6ce82['getTeams'](_0x1e1a80);}})[_0x8915('0x13')](function(_0x1cfa67){if(_0x1cfa67){_0x5021d7=_0x1cfa67[_0x8915('0x31')];if(!_0x167f3a[_0x8915('0x2d')][_0x8915('0x42')]('nolimit')){_0x1e1a80[_0x8915('0x10')]=qs[_0x8915('0x10')](_0x167f3a[_0x8915('0x2d')][_0x8915('0x10')]);_0x1e1a80[_0x8915('0xe')]=qs['offset'](_0x167f3a['query']['offset']);}return _0xe6ce82[_0x8915('0x51')](_0x1e1a80);}})[_0x8915('0x13')](function(_0x4dd1b1){if(_0x4dd1b1){return _0x4dd1b1?{'count':_0x5021d7,'rows':_0x4dd1b1}:null;}})[_0x8915('0x13')](respondWithResult(_0x3423da,null))['catch'](handleError(_0x3423da,null));};exports[_0x8915('0x54')]=function(_0x4f0ede,_0x2b3a6f){var _0x5d6c17=_0x4f0ede[_0x8915('0x3e')]['ids'];return db['Team'][_0x8915('0x26')]({'where':{'id':_0x5d6c17},'attributes':['id'],'include':[{'model':db[_0x8915('0x55')],'as':_0x8915('0x56'),'attributes':['id',_0x8915('0x1a'),'online',_0x8915('0x57'),_0x8915('0x58')],'raw':!![]}]})[_0x8915('0x13')](function(_0x6f6ba9){if(_0x6f6ba9){var _0x41d5b8=_[_0x8915('0x59')](_0x6f6ba9,function(_0x43d3f1){var _0x592cc0=_0x43d3f1[_0x8915('0x15')]({'plain':!![]});return _0x592cc0[_0x8915('0x56')];});return db[_0x8915('0x23')]['find']({'where':{'id':_0x4f0ede[_0x8915('0x2a')]['id']}})[_0x8915('0x13')](function(_0x111ed1){return db[_0x8915('0x5a')][_0x8915('0x5b')](function(_0x10c17c){return _0x111ed1['addTeams'](_0x5d6c17,{'transaction':_0x10c17c})[_0x8915('0x13')](function(){return BPromise[_0x8915('0x5c')](_0x41d5b8,function(_0x2501a8){return db[_0x8915('0x40')][_0x8915('0x5d')]({'where':{'UserId':_0x2501a8['id'],'OpenchannelQueueId':_0x4f0ede[_0x8915('0x2a')]['id']},'transaction':_0x10c17c});});})[_0x8915('0x13')](function(){_0x41d5b8[_0x8915('0x5e')](function(_0x59305a){socket['emit'](_0x8915('0x5f'),{'UserId':_0x59305a['id'],'OpenchannelQueueId':_0x111ed1['id']});});});});});}})[_0x8915('0x13')](respondWithStatusCode(_0x2b3a6f,null))['catch'](handleError(_0x2b3a6f,null));};exports[_0x8915('0x60')]=function(_0x2b2cbf,_0x4953b8){return db[_0x8915('0x53')][_0x8915('0x26')]({'where':{'id':_0x2b2cbf['query']['ids']},'attributes':['id'],'include':[{'model':db[_0x8915('0x55')],'as':_0x8915('0x56'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x4953b8,null))['then'](function(_0x569b28){var _0x3fb50b=_['map'](_0x569b28,'id');var _0x4ad416=[];var _0x27f1ba=[];var _0x141139=squel['select']();_0x141139[_0x8915('0x61')](_0x8915('0x62'))[_0x8915('0x63')](_0x8915('0x64'),'tq')[_0x8915('0x65')](_0x8915('0x66'),'ut',_0x8915('0x67'))['where'](_0x8915('0x68'),_0x2b2cbf[_0x8915('0x2a')]['id']);for(var _0x5eaf86=0x0;_0x5eaf86<_0x569b28[_0x8915('0x31')];_0x5eaf86+=0x1){let _0x21b151=_0x569b28[_0x5eaf86];for(var _0x5c306b=0x0;_0x5c306b<_0x21b151['Agents']['length'];_0x5c306b+=0x1){let _0x6a5432=_0x21b151[_0x8915('0x56')][_0x5c306b];var _0x486cba=_0x141139[_0x8915('0x69')]();_0x486cba['where'](_0x8915('0x6a'),_0x6a5432['id']);_0x27f1ba[_0x8915('0x6b')](db[_0x8915('0x5a')][_0x8915('0x2d')](_0x486cba[_0x8915('0x6c')](),{'type':db[_0x8915('0x5a')][_0x8915('0x6d')][_0x8915('0x6e')]})[_0x8915('0x13')](function(_0x427e75){if(_0x427e75[_0x8915('0x31')]===0x1){return _0x6a5432['id'];}else{var _0x2cce47=_[_0x8915('0x6f')](_['map'](_0x427e75,_0x8915('0x70')),function(_0x191d5f){return _[_0x8915('0x71')](_0x3fb50b,_0x191d5f);});if(_0x2cce47){return _0x6a5432['id'];}}}));}}return BPromise[_0x8915('0x72')](_0x27f1ba)[_0x8915('0x13')](function(_0x555d1d){_0x4ad416=_(_0x4ad416)['union'](_0x555d1d)[_0x8915('0x73')]()['value']();return db[_0x8915('0x23')][_0x8915('0x35')]({'where':{'id':_0x2b2cbf[_0x8915('0x2a')]['id']}})[_0x8915('0x13')](function(_0x46466d){return db['sequelize'][_0x8915('0x5b')](function(_0x4df07b){return _0x46466d['removeTeams'](_0x2b2cbf['query']['ids'],{'transaction':_0x4df07b})[_0x8915('0x13')](function(){if(!_['isEmpty'](_0x4ad416)){return _0x46466d['removeAgents'](_0x4ad416,{'transaction':_0x4df07b});}})[_0x8915('0x13')](function(){_0x4ad416[_0x8915('0x5e')](function(_0x38b5d3){socket['emit']('userOpenchannelQueue:remove',{'UserId':_0x38b5d3,'OpenchannelQueueId':_0x46466d['id']});});});});});});})[_0x8915('0x13')](respondWithStatusCode(_0x4953b8,null))[_0x8915('0x28')](handleError(_0x4953b8,null));};exports['addAgents']=function(_0x4b4353,_0x21d859){return db[_0x8915('0x23')][_0x8915('0x35')]({'where':{'id':_0x4b4353[_0x8915('0x2a')]['id']}})[_0x8915('0x13')](handleEntityNotFound(_0x21d859,null))[_0x8915('0x13')](function(_0x3d14c3){if(_0x3d14c3){return _0x3d14c3['addAgents'](_0x4b4353[_0x8915('0x3e')]['ids'],_[_0x8915('0x74')](_0x4b4353[_0x8915('0x3e')],['ids','id'])||{})[_0x8915('0x75')](function(_0x251186){for(var _0x5bed78=0x0;_0x5bed78<_0x4b4353[_0x8915('0x3e')][_0x8915('0x76')][_0x8915('0x31')];_0x5bed78+=0x1){socket['emit'](_0x8915('0x5f'),{'UserId':Number(_0x4b4353[_0x8915('0x3e')]['ids'][_0x5bed78]),'OpenchannelQueueId':Number(_0x4b4353[_0x8915('0x2a')]['id'])});}return _0x251186;});}})[_0x8915('0x13')](respondWithResult(_0x21d859,null))[_0x8915('0x28')](handleError(_0x21d859,null));};exports['removeAgents']=function(_0x221919,_0x3dc47b){return db[_0x8915('0x23')]['find']({'where':{'id':_0x221919[_0x8915('0x2a')]['id']}})['then'](handleEntityNotFound(_0x3dc47b,null))[_0x8915('0x13')](function(_0x33d04c){if(_0x33d04c){return _0x33d04c[_0x8915('0x77')](_0x221919[_0x8915('0x2d')][_0x8915('0x76')])['then'](function(){if(_[_0x8915('0x78')](_0x221919[_0x8915('0x2d')]['ids'])){for(var _0x1a3c8e=0x0;_0x1a3c8e<_0x221919[_0x8915('0x2d')][_0x8915('0x76')]['length'];_0x1a3c8e+=0x1){socket[_0x8915('0x79')](_0x8915('0x7a'),{'UserId':Number(_0x221919['query'][_0x8915('0x76')][_0x1a3c8e]),'OpenchannelQueueId':Number(_0x221919[_0x8915('0x2a')]['id'])});}}else{socket['emit'](_0x8915('0x7a'),{'UserId':Number(_0x221919[_0x8915('0x2d')]['ids']),'OpenchannelQueueId':Number(_0x221919[_0x8915('0x2a')]['id'])});}});}})[_0x8915('0x13')](respondWithStatusCode(_0x3dc47b,null))['catch'](handleError(_0x3dc47b,null));};exports[_0x8915('0x7b')]=function(_0x56b22e,_0x488093){var _0x194554={};var _0xe5fbae={};var _0x4b974d;var _0x49e0b3;return db['OpenchannelQueue'][_0x8915('0x52')]({'where':{'id':_0x56b22e[_0x8915('0x2a')]['id']}})[_0x8915('0x13')](handleEntityNotFound(_0x488093,null))['then'](function(_0x546702){if(_0x546702){_0x4b974d=_0x546702;_0xe5fbae[_0x8915('0x2b')]=_['keys'](db[_0x8915('0x55')][_0x8915('0x1e')]);_0xe5fbae[_0x8915('0x2d')]=_['keys'](_0x56b22e[_0x8915('0x2d')]);_0xe5fbae[_0x8915('0x41')]=_['intersection'](_0xe5fbae[_0x8915('0x2b')],_0xe5fbae['query']);_0x194554[_0x8915('0x2f')]=_['intersection'](_0xe5fbae[_0x8915('0x2b')],qs[_0x8915('0x30')](_0x56b22e[_0x8915('0x2d')]['fields']));_0x194554['attributes']=_0x194554[_0x8915('0x2f')][_0x8915('0x31')]?_0x194554[_0x8915('0x2f')]:_0xe5fbae[_0x8915('0x2b')];_0x194554[_0x8915('0x43')]=qs[_0x8915('0x44')](_0x56b22e['query'][_0x8915('0x44')]);_0x194554[_0x8915('0x22')]=qs[_0x8915('0x41')](_[_0x8915('0x45')](_0x56b22e['query'],_0xe5fbae[_0x8915('0x41')]));if(_0x56b22e[_0x8915('0x2d')][_0x8915('0x47')]){_0x194554[_0x8915('0x22')]=_[_0x8915('0x33')](_0x194554['where'],{'$or':_[_0x8915('0x1d')](_0x194554[_0x8915('0x2f')],function(_0x347616){var _0x44a39b={};_0x44a39b[_0x347616]={'$like':'%'+_0x56b22e[_0x8915('0x2d')][_0x8915('0x47')]+'%'};return _0x44a39b;})});}_0x194554=_[_0x8915('0x33')]({},_0x194554,_0x56b22e[_0x8915('0x34')]);return _0x4b974d['getAgents'](_0x194554);}})['then'](function(_0x32870b){if(_0x32870b){_0x49e0b3=_0x32870b[_0x8915('0x31')];if(!_0x56b22e['query'][_0x8915('0x42')](_0x8915('0x7c'))){_0x194554[_0x8915('0x10')]=qs[_0x8915('0x10')](_0x56b22e[_0x8915('0x2d')][_0x8915('0x10')]);_0x194554[_0x8915('0xe')]=qs[_0x8915('0xe')](_0x56b22e[_0x8915('0x2d')]['offset']);}return _0x4b974d[_0x8915('0x7b')](_0x194554);}})['then'](function(_0x1aec9e){if(_0x1aec9e){return _0x1aec9e?{'count':_0x49e0b3,'rows':_0x1aec9e}:null;}})['then'](respondWithResult(_0x488093,null))[_0x8915('0x28')](handleError(_0x488093,null));}; \ No newline at end of file +var _0x6936=['ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','includes','all','union','value','removeAgents','userOpenchannelQueue:remove','addAgents','spread','isArray','getAgents','findOne','bluebird','util','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./openchannelQueue.socket','register','status','end','json','offset','undefined','count','limit','Content-Range','update','then','destroy','sendStatus','error','name','send','index','map','OpenchannelQueue','fieldName','type','key','where','include','query','findAll','rows','catch','params','model','keys','intersection','attributes','fields','length','merge','find','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','OpenchannelQueues','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','UserOpenchannelQueue','hasOwnProperty','nolimit','sort','pick','filters','OpenchannelQueueId','filter','findAndCountAll','UserId','updatedAt','createdAt','format','%s/%s','SIP','openchannelPause','Team','rawAttributes','order','options','getTeams','ids','User','Agents','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userOpenchannelQueue:save','removeTeams','select','field','tq.TeamId','from','join','user_has_teams','OpenchannelQueueId\x20=\x20?'];(function(_0xd09668,_0x1435b2){var _0x68726=function(_0x54a030){while(--_0x54a030){_0xd09668['push'](_0xd09668['shift']());}};_0x68726(++_0x1435b2);}(_0x6936,0xfe));var _0x6693=function(_0xdd7819,_0x439dcf){_0xdd7819=_0xdd7819-0x0;var _0x3fce94=_0x6936[_0xdd7819];return _0x3fce94;};'use strict';var BPromise=require(_0x6693('0x0'));var util=require(_0x6693('0x1'));var _=require(_0x6693('0x2'));var squel=require('squel');var Redis=require('ioredis');var qs=require(_0x6693('0x3'));var logger=require(_0x6693('0x4'))(_0x6693('0x5'));var config=require(_0x6693('0x6'));var db=require(_0x6693('0x7'))['db'];config[_0x6693('0x8')]=_[_0x6693('0x9')](config['redis'],{'host':_0x6693('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6693('0x8')]));require(_0x6693('0xb'))[_0x6693('0xc')](socket);function respondWithStatusCode(_0x25c7db,_0x203b69){_0x203b69=_0x203b69||0xcc;return function(_0x13aef2){if(_0x13aef2){return _0x25c7db['sendStatus'](_0x203b69);}return _0x25c7db[_0x6693('0xd')](_0x203b69)[_0x6693('0xe')]();};}function respondWithResult(_0x5c8da1,_0x5c92a6){_0x5c92a6=_0x5c92a6||0xc8;return function(_0x9f5334){if(_0x9f5334){return _0x5c8da1[_0x6693('0xd')](_0x5c92a6)[_0x6693('0xf')](_0x9f5334);}};}function respondWithFilteredResult(_0x3b5529,_0xa31334){return function(_0x4028d6){if(_0x4028d6){var _0xd25ed7=typeof _0xa31334[_0x6693('0x10')]===_0x6693('0x11')&&typeof _0xa31334['limit']===_0x6693('0x11');var _0x213dd5=_0x4028d6['count'];var _0x337f40=_0xd25ed7?0x0:_0xa31334[_0x6693('0x10')];var _0x4837d8=_0xd25ed7?_0x4028d6[_0x6693('0x12')]:_0xa31334[_0x6693('0x10')]+_0xa31334[_0x6693('0x13')];var _0x444b76;if(_0x4837d8>=_0x213dd5){_0x4837d8=_0x213dd5;_0x444b76=0xc8;}else{_0x444b76=0xce;}_0x3b5529[_0x6693('0xd')](_0x444b76);return _0x3b5529['set'](_0x6693('0x14'),_0x337f40+'-'+_0x4837d8+'/'+_0x213dd5)['json'](_0x4028d6);}return null;};}function saveUpdates(_0x9f4124){return function(_0x595175){if(_0x595175){return _0x595175[_0x6693('0x15')](_0x9f4124)[_0x6693('0x16')](function(_0x22013e){return _0x22013e;});}return null;};}function removeEntity(_0x17c3b6){return function(_0x4f9cf3){if(_0x4f9cf3){return _0x4f9cf3['destroy']()[_0x6693('0x16')](function(){var _0x1e5f4d=_0x4f9cf3['get']({'plain':!![]});var _0x1c0691='OpenchannelQueues';return db['UserProfileResource'][_0x6693('0x17')]({'where':{'type':_0x1c0691,'resourceId':_0x1e5f4d['id']}})[_0x6693('0x16')](function(){return _0x4f9cf3;});})[_0x6693('0x16')](function(){_0x17c3b6['status'](0xcc)[_0x6693('0xe')]();});}};}function handleEntityNotFound(_0x5ef574){return function(_0xd6f31a){if(!_0xd6f31a){_0x5ef574[_0x6693('0x18')](0x194);}return _0xd6f31a;};}function handleError(_0x28d4cd,_0x330caa){_0x330caa=_0x330caa||0x1f4;return function(_0x4f4ee2){logger[_0x6693('0x19')](_0x4f4ee2['stack']);if(_0x4f4ee2[_0x6693('0x1a')]){delete _0x4f4ee2[_0x6693('0x1a')];}_0x28d4cd[_0x6693('0xd')](_0x330caa)[_0x6693('0x1b')](_0x4f4ee2);};}exports[_0x6693('0x1c')]=function(_0x2bdde7,_0x4a36f6){var _0x29a023={};var _0x3d2999={'count':0x0,'rows':[]};var _0x2e577f=_[_0x6693('0x1d')](db[_0x6693('0x1e')]['rawAttributes'],function(_0x38edd2){return{'name':_0x38edd2[_0x6693('0x1f')],'type':_0x38edd2[_0x6693('0x20')][_0x6693('0x21')]};});_0x29a023=qs['getOptions'](_0x2e577f,_0x2bdde7);var _0x26ba57={'where':_0x29a023[_0x6693('0x22')]};return db['OpenchannelQueue']['count'](_0x26ba57)[_0x6693('0x16')](function(_0x21ec21){_0x3d2999[_0x6693('0x12')]=_0x21ec21;_0x29a023[_0x6693('0x23')]=qs[_0x6693('0x23')](_0x2bdde7[_0x6693('0x24')]);return db['OpenchannelQueue'][_0x6693('0x25')](_0x29a023);})[_0x6693('0x16')](function(_0x781ceb){_0x3d2999[_0x6693('0x26')]=_0x781ceb;return _0x3d2999;})[_0x6693('0x16')](respondWithFilteredResult(_0x4a36f6,_0x29a023))[_0x6693('0x27')](handleError(_0x4a36f6,null));};exports['show']=function(_0xc44449,_0x249ecd){var _0x165ee7={'raw':!![],'where':{'id':_0xc44449[_0x6693('0x28')]['id']}},_0x5af413={};_0x5af413[_0x6693('0x29')]=_[_0x6693('0x2a')](db[_0x6693('0x1e')]['rawAttributes']);_0x5af413[_0x6693('0x24')]=_['keys'](_0xc44449[_0x6693('0x24')]);_0x5af413['filters']=_[_0x6693('0x2b')](_0x5af413[_0x6693('0x29')],_0x5af413[_0x6693('0x24')]);_0x165ee7[_0x6693('0x2c')]=_[_0x6693('0x2b')](_0x5af413[_0x6693('0x29')],qs[_0x6693('0x2d')](_0xc44449[_0x6693('0x24')][_0x6693('0x2d')]));_0x165ee7['attributes']=_0x165ee7[_0x6693('0x2c')][_0x6693('0x2e')]?_0x165ee7['attributes']:_0x5af413[_0x6693('0x29')];if(_0xc44449[_0x6693('0x24')]['includeAll']){_0x165ee7[_0x6693('0x23')]=[{'all':!![]}];}_0x165ee7=_[_0x6693('0x2f')]({},_0x165ee7,_0xc44449['options']);return db['OpenchannelQueue'][_0x6693('0x30')](_0x165ee7)[_0x6693('0x16')](handleEntityNotFound(_0x249ecd,null))[_0x6693('0x16')](respondWithResult(_0x249ecd,null))[_0x6693('0x27')](handleError(_0x249ecd,null));};exports['create']=function(_0x292369,_0x136d00){return db[_0x6693('0x1e')][_0x6693('0x31')](_0x292369['body'],{})[_0x6693('0x16')](function(_0x3985dc){var _0x28ee96=_0x292369['user'][_0x6693('0x32')]({'plain':!![]});if(!_0x28ee96)throw new Error(_0x6693('0x33'));if(_0x28ee96[_0x6693('0x34')]==='user'){var _0x273101=_0x3985dc[_0x6693('0x32')]({'plain':!![]});var _0x45b3e4=_0x6693('0x35');return db[_0x6693('0x36')]['find']({'where':{'name':_0x45b3e4,'userProfileId':_0x28ee96[_0x6693('0x37')]},'raw':!![]})[_0x6693('0x16')](function(_0xb45053){if(_0xb45053&&_0xb45053['autoAssociation']===0x0){return db[_0x6693('0x38')][_0x6693('0x31')]({'name':_0x273101['name'],'resourceId':_0x273101['id'],'type':_0xb45053[_0x6693('0x1a')],'sectionId':_0xb45053['id']},{})[_0x6693('0x16')](function(){return _0x3985dc;});}else{return _0x3985dc;}})[_0x6693('0x27')](function(_0x1f79d4){logger[_0x6693('0x19')](_0x6693('0x39'),_0x1f79d4);throw _0x1f79d4;});}return _0x3985dc;})['then'](respondWithResult(_0x136d00,0xc9))[_0x6693('0x27')](handleError(_0x136d00,null));};exports[_0x6693('0x15')]=function(_0x2e3ed6,_0x3a15cf){if(_0x2e3ed6[_0x6693('0x3a')]['id']){delete _0x2e3ed6[_0x6693('0x3a')]['id'];}return db['OpenchannelQueue'][_0x6693('0x30')]({'where':{'id':_0x2e3ed6[_0x6693('0x28')]['id']}})[_0x6693('0x16')](handleEntityNotFound(_0x3a15cf,null))['then'](saveUpdates(_0x2e3ed6[_0x6693('0x3a')],null))[_0x6693('0x16')](respondWithResult(_0x3a15cf,null))[_0x6693('0x27')](handleError(_0x3a15cf,null));};exports[_0x6693('0x17')]=function(_0x2e9235,_0x523b45){return db[_0x6693('0x1e')][_0x6693('0x30')]({'where':{'id':_0x2e9235[_0x6693('0x28')]['id']}})[_0x6693('0x16')](handleEntityNotFound(_0x523b45,null))[_0x6693('0x16')](removeEntity(_0x523b45,null))[_0x6693('0x27')](handleError(_0x523b45,null));};exports[_0x6693('0x3b')]=function(_0x40eba2,_0x1356de){return db[_0x6693('0x1e')][_0x6693('0x3b')]()[_0x6693('0x16')](respondWithResult(_0x1356de,null))[_0x6693('0x27')](handleError(_0x1356de,null));};exports[_0x6693('0x3c')]=function(_0x412897,_0x113db7){var _0x5e532b={'raw':!![],'where':{}},_0x33b2ef={},_0xfe6de6;return db[_0x6693('0x1e')]['findOne']({'where':{'id':_0x412897[_0x6693('0x28')]['id']}})[_0x6693('0x16')](handleEntityNotFound(_0x113db7,null))[_0x6693('0x16')](function(_0x346982){if(_0x346982){_0xfe6de6=_0x346982[_0x6693('0x32')]({'plain':!![]});_0x33b2ef[_0x6693('0x29')]=_[_0x6693('0x2a')](db[_0x6693('0x3d')]['rawAttributes']);_0x33b2ef[_0x6693('0x24')]=_[_0x6693('0x2a')](_0x412897['query']);_0x33b2ef['filters']=_[_0x6693('0x2b')](_0x33b2ef[_0x6693('0x29')],_0x33b2ef[_0x6693('0x24')]);_0x5e532b[_0x6693('0x2c')]=_[_0x6693('0x2b')](_0x33b2ef[_0x6693('0x29')],qs[_0x6693('0x2d')](_0x412897[_0x6693('0x24')][_0x6693('0x2d')]));_0x5e532b[_0x6693('0x2c')]=_0x5e532b[_0x6693('0x2c')][_0x6693('0x2e')]?_0x5e532b[_0x6693('0x2c')]:_0x33b2ef[_0x6693('0x29')];if(!_0x412897[_0x6693('0x24')][_0x6693('0x3e')](_0x6693('0x3f'))){_0x5e532b[_0x6693('0x13')]=qs[_0x6693('0x13')](_0x412897[_0x6693('0x24')]['limit']);_0x5e532b[_0x6693('0x10')]=qs[_0x6693('0x10')](_0x412897[_0x6693('0x24')][_0x6693('0x10')]);}_0x5e532b['order']=qs['sort'](_0x412897['query'][_0x6693('0x40')]);_0x5e532b[_0x6693('0x22')]=qs['filters'](_[_0x6693('0x41')](_0x412897[_0x6693('0x24')],_0x33b2ef[_0x6693('0x42')]));_0x5e532b[_0x6693('0x22')][_0x6693('0x43')]=_0x346982['id'];if(_0x412897[_0x6693('0x24')][_0x6693('0x44')]){_0x5e532b[_0x6693('0x22')]=_[_0x6693('0x2f')](_0x5e532b['where'],{'$or':_[_0x6693('0x1d')](_0x5e532b[_0x6693('0x2c')],function(_0x2eec0d){var _0x418efe={};_0x418efe[_0x2eec0d]={'$like':'%'+_0x412897[_0x6693('0x24')]['filter']+'%'};return _0x418efe;})});}_0x5e532b=_[_0x6693('0x2f')]({},_0x5e532b,_0x412897['options']);return db[_0x6693('0x3d')][_0x6693('0x25')](_0x5e532b);}})[_0x6693('0x16')](function(_0x196144){if(_0x196144){return db['User'][_0x6693('0x45')]({'where':{'id':_['map'](_0x196144,_0x6693('0x46')),'role':'agent'},'attributes':['id',_0x6693('0x1a'),'openchannelPause',_0x6693('0x47'),_0x6693('0x48')]});}})[_0x6693('0x16')](function(_0x3d7d1c){if(_0x3d7d1c){return{'count':_0x3d7d1c['count'],'rows':_['map'](_0x3d7d1c[_0x6693('0x26')],function(_0x56c4af){return{'membername':_0x56c4af[_0x6693('0x1a')],'UserId':_0x56c4af['id'],'queue_name':_0xfe6de6[_0x6693('0x1a')],'OpenchannelQueueId':_0xfe6de6['id'],'interface':util[_0x6693('0x49')](_0x6693('0x4a'),_0x6693('0x4b'),_0x56c4af[_0x6693('0x1a')]),'penalty':0x0,'paused':_0x56c4af[_0x6693('0x4c')],'createdAt':_0x56c4af[_0x6693('0x48')],'updatedAt':_0x56c4af[_0x6693('0x47')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x6693('0x16')](respondWithFilteredResult(_0x113db7,_0x5e532b))[_0x6693('0x27')](handleError(_0x113db7,null));};exports['getTeams']=function(_0x2fe245,_0x2377d1){var _0x42f6ac={};var _0x27d660={};var _0x2ddd8f;var _0x2e32f6;return db[_0x6693('0x1e')]['findOne']({'where':{'id':_0x2fe245['params']['id']}})[_0x6693('0x16')](handleEntityNotFound(_0x2377d1,null))['then'](function(_0x5d7dc0){if(_0x5d7dc0){_0x2ddd8f=_0x5d7dc0;_0x27d660[_0x6693('0x29')]=_[_0x6693('0x2a')](db[_0x6693('0x4d')][_0x6693('0x4e')]);_0x27d660[_0x6693('0x24')]=_[_0x6693('0x2a')](_0x2fe245[_0x6693('0x24')]);_0x27d660[_0x6693('0x42')]=_[_0x6693('0x2b')](_0x27d660[_0x6693('0x29')],_0x27d660[_0x6693('0x24')]);_0x42f6ac[_0x6693('0x2c')]=_[_0x6693('0x2b')](_0x27d660[_0x6693('0x29')],qs[_0x6693('0x2d')](_0x2fe245[_0x6693('0x24')][_0x6693('0x2d')]));_0x42f6ac[_0x6693('0x2c')]=_0x42f6ac[_0x6693('0x2c')][_0x6693('0x2e')]?_0x42f6ac[_0x6693('0x2c')]:_0x27d660[_0x6693('0x29')];_0x42f6ac[_0x6693('0x4f')]=qs[_0x6693('0x40')](_0x2fe245[_0x6693('0x24')][_0x6693('0x40')]);_0x42f6ac['where']=qs[_0x6693('0x42')](_['pick'](_0x2fe245[_0x6693('0x24')],_0x27d660[_0x6693('0x42')]));if(_0x2fe245[_0x6693('0x24')]['filter']){_0x42f6ac['where']=_[_0x6693('0x2f')](_0x42f6ac[_0x6693('0x22')],{'$or':_[_0x6693('0x1d')](_0x42f6ac[_0x6693('0x2c')],function(_0x3d7d2b){var _0x5a5889={};_0x5a5889[_0x3d7d2b]={'$like':'%'+_0x2fe245[_0x6693('0x24')]['filter']+'%'};return _0x5a5889;})});}_0x42f6ac=_[_0x6693('0x2f')]({},_0x42f6ac,_0x2fe245[_0x6693('0x50')]);return _0x2ddd8f[_0x6693('0x51')](_0x42f6ac);}})[_0x6693('0x16')](function(_0x3c5395){if(_0x3c5395){_0x2e32f6=_0x3c5395[_0x6693('0x2e')];if(!_0x2fe245[_0x6693('0x24')][_0x6693('0x3e')](_0x6693('0x3f'))){_0x42f6ac[_0x6693('0x13')]=qs['limit'](_0x2fe245[_0x6693('0x24')][_0x6693('0x13')]);_0x42f6ac[_0x6693('0x10')]=qs[_0x6693('0x10')](_0x2fe245[_0x6693('0x24')][_0x6693('0x10')]);}return _0x2ddd8f[_0x6693('0x51')](_0x42f6ac);}})['then'](function(_0x912d38){if(_0x912d38){return _0x912d38?{'count':_0x2e32f6,'rows':_0x912d38}:null;}})['then'](respondWithResult(_0x2377d1,null))[_0x6693('0x27')](handleError(_0x2377d1,null));};exports['addTeams']=function(_0x4cc40c,_0x47ee1e){var _0x4c87a0=_0x4cc40c[_0x6693('0x3a')][_0x6693('0x52')];return db[_0x6693('0x4d')][_0x6693('0x25')]({'where':{'id':_0x4c87a0},'attributes':['id'],'include':[{'model':db[_0x6693('0x53')],'as':_0x6693('0x54'),'attributes':['id','name','online',_0x6693('0x55'),_0x6693('0x56')],'raw':!![]}]})[_0x6693('0x16')](function(_0x4d4078){if(_0x4d4078){var _0x82109=_[_0x6693('0x57')](_0x4d4078,function(_0x342d7a){var _0x2367a5=_0x342d7a[_0x6693('0x32')]({'plain':!![]});return _0x2367a5[_0x6693('0x54')];});return db[_0x6693('0x1e')]['find']({'where':{'id':_0x4cc40c[_0x6693('0x28')]['id']}})[_0x6693('0x16')](function(_0x3f9be8){return db[_0x6693('0x58')][_0x6693('0x59')](function(_0x4473e5){return _0x3f9be8['addTeams'](_0x4c87a0,{'transaction':_0x4473e5})[_0x6693('0x16')](function(){return BPromise[_0x6693('0x5a')](_0x82109,function(_0x155d49){return db[_0x6693('0x3d')][_0x6693('0x5b')]({'where':{'UserId':_0x155d49['id'],'OpenchannelQueueId':_0x4cc40c[_0x6693('0x28')]['id']},'transaction':_0x4473e5});});})[_0x6693('0x16')](function(){_0x82109[_0x6693('0x5c')](function(_0x180481){socket[_0x6693('0x5d')](_0x6693('0x5e'),{'UserId':_0x180481['id'],'OpenchannelQueueId':_0x3f9be8['id']});});});});});}})[_0x6693('0x16')](respondWithStatusCode(_0x47ee1e,null))['catch'](handleError(_0x47ee1e,null));};exports[_0x6693('0x5f')]=function(_0xd2fc,_0x33735c){return db[_0x6693('0x4d')]['findAll']({'where':{'id':_0xd2fc['query']['ids']},'attributes':['id'],'include':[{'model':db[_0x6693('0x53')],'as':_0x6693('0x54'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x33735c,null))[_0x6693('0x16')](function(_0x50ef19){var _0x4fc17c=_[_0x6693('0x1d')](_0x50ef19,'id');var _0x2ad1e3=[];var _0x53a6e2=[];var _0x314b33=squel[_0x6693('0x60')]();_0x314b33[_0x6693('0x61')](_0x6693('0x62'))[_0x6693('0x63')]('team_has_openchannel_queues','tq')[_0x6693('0x64')](_0x6693('0x65'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0x6693('0x66'),_0xd2fc[_0x6693('0x28')]['id']);for(var _0x23660c=0x0;_0x23660c<_0x50ef19[_0x6693('0x2e')];_0x23660c+=0x1){let _0x484b98=_0x50ef19[_0x23660c];for(var _0xdd3746=0x0;_0xdd3746<_0x484b98[_0x6693('0x54')][_0x6693('0x2e')];_0xdd3746+=0x1){let _0xc833c2=_0x484b98[_0x6693('0x54')][_0xdd3746];var _0xba51f2=_0x314b33['clone']();_0xba51f2[_0x6693('0x22')](_0x6693('0x67'),_0xc833c2['id']);_0x53a6e2['push'](db[_0x6693('0x58')][_0x6693('0x24')](_0xba51f2[_0x6693('0x68')](),{'type':db[_0x6693('0x58')][_0x6693('0x69')][_0x6693('0x6a')]})[_0x6693('0x16')](function(_0x1cd523){if(_0x1cd523['length']===0x1){return _0xc833c2['id'];}else{var _0x5088a4=_[_0x6693('0x6b')](_[_0x6693('0x1d')](_0x1cd523,'TeamId'),function(_0x3235ef){return _[_0x6693('0x6c')](_0x4fc17c,_0x3235ef);});if(_0x5088a4){return _0xc833c2['id'];}}}));}}return BPromise[_0x6693('0x6d')](_0x53a6e2)[_0x6693('0x16')](function(_0x3dac6e){_0x2ad1e3=_(_0x2ad1e3)[_0x6693('0x6e')](_0x3dac6e)['compact']()[_0x6693('0x6f')]();return db[_0x6693('0x1e')]['find']({'where':{'id':_0xd2fc['params']['id']}})[_0x6693('0x16')](function(_0x59177a){return db[_0x6693('0x58')][_0x6693('0x59')](function(_0x289592){return _0x59177a[_0x6693('0x5f')](_0xd2fc['query'][_0x6693('0x52')],{'transaction':_0x289592})['then'](function(){if(!_['isEmpty'](_0x2ad1e3)){return _0x59177a[_0x6693('0x70')](_0x2ad1e3,{'transaction':_0x289592});}})['then'](function(){_0x2ad1e3['forEach'](function(_0x127c57){socket[_0x6693('0x5d')](_0x6693('0x71'),{'UserId':_0x127c57,'OpenchannelQueueId':_0x59177a['id']});});});});});});})[_0x6693('0x16')](respondWithStatusCode(_0x33735c,null))['catch'](handleError(_0x33735c,null));};exports['addAgents']=function(_0x48b836,_0x2faf39){return db[_0x6693('0x1e')][_0x6693('0x30')]({'where':{'id':_0x48b836[_0x6693('0x28')]['id']}})[_0x6693('0x16')](handleEntityNotFound(_0x2faf39,null))[_0x6693('0x16')](function(_0x16570b){if(_0x16570b){return _0x16570b[_0x6693('0x72')](_0x48b836[_0x6693('0x3a')][_0x6693('0x52')],_['omit'](_0x48b836[_0x6693('0x3a')],[_0x6693('0x52'),'id'])||{})[_0x6693('0x73')](function(_0x20c20f){for(var _0x315b4b=0x0;_0x315b4b<_0x48b836[_0x6693('0x3a')]['ids']['length'];_0x315b4b+=0x1){socket['emit'](_0x6693('0x5e'),{'UserId':Number(_0x48b836[_0x6693('0x3a')][_0x6693('0x52')][_0x315b4b]),'OpenchannelQueueId':Number(_0x48b836['params']['id'])});}return _0x20c20f;});}})[_0x6693('0x16')](respondWithResult(_0x2faf39,null))[_0x6693('0x27')](handleError(_0x2faf39,null));};exports['removeAgents']=function(_0x15d415,_0x560fef){return db[_0x6693('0x1e')]['find']({'where':{'id':_0x15d415[_0x6693('0x28')]['id']}})['then'](handleEntityNotFound(_0x560fef,null))[_0x6693('0x16')](function(_0x45f07e){if(_0x45f07e){return _0x45f07e[_0x6693('0x70')](_0x15d415[_0x6693('0x24')][_0x6693('0x52')])[_0x6693('0x16')](function(){if(_[_0x6693('0x74')](_0x15d415[_0x6693('0x24')]['ids'])){for(var _0x4a0a07=0x0;_0x4a0a07<_0x15d415[_0x6693('0x24')][_0x6693('0x52')][_0x6693('0x2e')];_0x4a0a07+=0x1){socket[_0x6693('0x5d')]('userOpenchannelQueue:remove',{'UserId':Number(_0x15d415[_0x6693('0x24')][_0x6693('0x52')][_0x4a0a07]),'OpenchannelQueueId':Number(_0x15d415[_0x6693('0x28')]['id'])});}}else{socket['emit']('userOpenchannelQueue:remove',{'UserId':Number(_0x15d415[_0x6693('0x24')][_0x6693('0x52')]),'OpenchannelQueueId':Number(_0x15d415['params']['id'])});}});}})[_0x6693('0x16')](respondWithStatusCode(_0x560fef,null))[_0x6693('0x27')](handleError(_0x560fef,null));};exports[_0x6693('0x75')]=function(_0x20b5c6,_0x2c209a){var _0x3832a8={};var _0x1330b4={};var _0x57fb77;var _0x761476;return db[_0x6693('0x1e')][_0x6693('0x76')]({'where':{'id':_0x20b5c6[_0x6693('0x28')]['id']}})[_0x6693('0x16')](handleEntityNotFound(_0x2c209a,null))['then'](function(_0xe09002){if(_0xe09002){_0x57fb77=_0xe09002;_0x1330b4[_0x6693('0x29')]=_['keys'](db[_0x6693('0x53')][_0x6693('0x4e')]);_0x1330b4[_0x6693('0x24')]=_[_0x6693('0x2a')](_0x20b5c6[_0x6693('0x24')]);_0x1330b4[_0x6693('0x42')]=_[_0x6693('0x2b')](_0x1330b4[_0x6693('0x29')],_0x1330b4[_0x6693('0x24')]);_0x3832a8[_0x6693('0x2c')]=_[_0x6693('0x2b')](_0x1330b4[_0x6693('0x29')],qs[_0x6693('0x2d')](_0x20b5c6['query'][_0x6693('0x2d')]));_0x3832a8[_0x6693('0x2c')]=_0x3832a8[_0x6693('0x2c')]['length']?_0x3832a8[_0x6693('0x2c')]:_0x1330b4['model'];_0x3832a8[_0x6693('0x4f')]=qs['sort'](_0x20b5c6['query'][_0x6693('0x40')]);_0x3832a8[_0x6693('0x22')]=qs[_0x6693('0x42')](_[_0x6693('0x41')](_0x20b5c6[_0x6693('0x24')],_0x1330b4[_0x6693('0x42')]));if(_0x20b5c6['query'][_0x6693('0x44')]){_0x3832a8[_0x6693('0x22')]=_[_0x6693('0x2f')](_0x3832a8[_0x6693('0x22')],{'$or':_[_0x6693('0x1d')](_0x3832a8[_0x6693('0x2c')],function(_0x16a2a){var _0x6507cd={};_0x6507cd[_0x16a2a]={'$like':'%'+_0x20b5c6[_0x6693('0x24')]['filter']+'%'};return _0x6507cd;})});}_0x3832a8=_[_0x6693('0x2f')]({},_0x3832a8,_0x20b5c6[_0x6693('0x50')]);return _0x57fb77['getAgents'](_0x3832a8);}})[_0x6693('0x16')](function(_0x5b3941){if(_0x5b3941){_0x761476=_0x5b3941[_0x6693('0x2e')];if(!_0x20b5c6[_0x6693('0x24')][_0x6693('0x3e')](_0x6693('0x3f'))){_0x3832a8[_0x6693('0x13')]=qs[_0x6693('0x13')](_0x20b5c6[_0x6693('0x24')][_0x6693('0x13')]);_0x3832a8[_0x6693('0x10')]=qs['offset'](_0x20b5c6[_0x6693('0x24')][_0x6693('0x10')]);}return _0x57fb77['getAgents'](_0x3832a8);}})[_0x6693('0x16')](function(_0x172448){if(_0x172448){return _0x172448?{'count':_0x761476,'rows':_0x172448}:null;}})[_0x6693('0x16')](respondWithResult(_0x2c209a,null))[_0x6693('0x27')](handleError(_0x2c209a,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 08b176c..81d06ef 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 _0x2bc9=['remove','emit','hasOwnProperty','hook','../../mysqldb','setMaxListeners','save'];(function(_0x37fe26,_0x26e5ea){var _0xef9bec=function(_0x567867){while(--_0x567867){_0x37fe26['push'](_0x37fe26['shift']());}};_0xef9bec(++_0x26e5ea);}(_0x2bc9,0x1bd));var _0x92bc=function(_0x56d1b5,_0x289333){_0x56d1b5=_0x56d1b5-0x0;var _0x4ad91e=_0x2bc9[_0x56d1b5];return _0x4ad91e;};'use strict';var EventEmitter=require('events');var OpenchannelQueue=require(_0x92bc('0x0'))['db']['OpenchannelQueue'];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x92bc('0x1')](0x0);var events={'afterCreate':_0x92bc('0x2'),'afterUpdate':'update','afterDestroy':_0x92bc('0x3')};function emitEvent(_0x18bb97){return function(_0x4afb38,_0x3323d6,_0x4d72bf){OpenchannelQueueEvents[_0x92bc('0x4')](_0x18bb97+':'+_0x4afb38['id'],_0x4afb38);OpenchannelQueueEvents[_0x92bc('0x4')](_0x18bb97,_0x4afb38);_0x4d72bf(null);};}for(var e in events){if(events[_0x92bc('0x5')](e)){var event=events[e];OpenchannelQueue[_0x92bc('0x6')](e,emitEvent(event));}}module['exports']=OpenchannelQueueEvents; \ No newline at end of file +var _0x26fe=['update','remove','emit','hook','../../mysqldb','OpenchannelQueue','setMaxListeners'];(function(_0xf50820,_0x56f041){var _0x2a9b10=function(_0x33f0f4){while(--_0x33f0f4){_0xf50820['push'](_0xf50820['shift']());}};_0x2a9b10(++_0x56f041);}(_0x26fe,0x1c4));var _0xe26f=function(_0x37c51e,_0x1233a5){_0x37c51e=_0x37c51e-0x0;var _0x40b262=_0x26fe[_0x37c51e];return _0x40b262;};'use strict';var EventEmitter=require('events');var OpenchannelQueue=require(_0xe26f('0x0'))['db'][_0xe26f('0x1')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0xe26f('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xe26f('0x3'),'afterDestroy':_0xe26f('0x4')};function emitEvent(_0x464807){return function(_0x12770c,_0x459fd9,_0x485755){OpenchannelQueueEvents[_0xe26f('0x5')](_0x464807+':'+_0x12770c['id'],_0x12770c);OpenchannelQueueEvents['emit'](_0x464807,_0x12770c);_0x485755(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelQueue[_0xe26f('0x6')](e,emitEvent(event));}}module['exports']=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index 6ea2810..f06197e 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 _0x6907=['bluebird','request-promise','path','rimraf','../../config/environment','exports','define','OpenchannelQueue','lodash','util','../../config/logger'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0x6907,0x8c));var _0x7690=function(_0x564c3f,_0x563c13){_0x564c3f=_0x564c3f-0x0;var _0xdeb099=_0x6907[_0x564c3f];return _0xdeb099;};'use strict';var _=require(_0x7690('0x0'));var util=require(_0x7690('0x1'));var logger=require(_0x7690('0x2'))('api');var moment=require('moment');var BPromise=require(_0x7690('0x3'));var rp=require(_0x7690('0x4'));var fs=require('fs');var path=require(_0x7690('0x5'));var rimraf=require(_0x7690('0x6'));var config=require(_0x7690('0x7'));var attributes=require('./openchannelQueue.attributes');module[_0x7690('0x8')]=function(_0x5732fb,_0x240ec5){return _0x5732fb[_0x7690('0x9')](_0x7690('0xa'),attributes,{'tableName':'openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x449c=['define','OpenchannelQueue','openchannel_queues','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./openchannelQueue.attributes','exports'];(function(_0x4bdf98,_0x3df53d){var _0x1ec3ca=function(_0x582d8f){while(--_0x582d8f){_0x4bdf98['push'](_0x4bdf98['shift']());}};_0x1ec3ca(++_0x3df53d);}(_0x449c,0x189));var _0xc449=function(_0x56213b,_0x20a174){_0x56213b=_0x56213b-0x0;var _0x1d74be=_0x449c[_0x56213b];return _0x1d74be;};'use strict';var _=require(_0xc449('0x0'));var util=require(_0xc449('0x1'));var logger=require(_0xc449('0x2'))(_0xc449('0x3'));var moment=require(_0xc449('0x4'));var BPromise=require('bluebird');var rp=require(_0xc449('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc449('0x6'));var config=require(_0xc449('0x7'));var attributes=require(_0xc449('0x8'));module[_0xc449('0x9')]=function(_0x5f3f8b,_0x37c655){return _0x5f3f8b[_0xc449('0xa')](_0xc449('0xb'),attributes,{'tableName':_0xc449('0xc'),'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 ef1cc8f..f2ca449 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 _0x5d96=['find','raw','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','request','then','info','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','OpenchannelQueue,\x20%s,\x20%s','result','catch','GetOpenchannelQueue','OpenchannelQueue','options','where','attributes','limit','include','map','model','ShowOpenchannelQueue'];(function(_0x1e175d,_0x41ff45){var _0x3a3ce5=function(_0x186001){while(--_0x186001){_0x1e175d['push'](_0x1e175d['shift']());}};_0x3a3ce5(++_0x41ff45);}(_0x5d96,0xd4));var _0x65d9=function(_0x2af394,_0x1e6132){_0x2af394=_0x2af394-0x0;var _0x316104=_0x5d96[_0x2af394];return _0x316104;};'use strict';var _=require('lodash');var util=require(_0x65d9('0x0'));var moment=require(_0x65d9('0x1'));var BPromise=require('bluebird');var rs=require(_0x65d9('0x2'));var fs=require('fs');var Redis=require(_0x65d9('0x3'));var db=require(_0x65d9('0x4'))['db'];var utils=require(_0x65d9('0x5'));var logger=require(_0x65d9('0x6'))(_0x65d9('0x7'));var config=require(_0x65d9('0x8'));var jayson=require(_0x65d9('0x9'));var client=jayson[_0x65d9('0xa')]['http']({'port':0x232a});config[_0x65d9('0xb')]=_[_0x65d9('0xc')](config[_0x65d9('0xb')],{'host':_0x65d9('0xd'),'port':0x18eb});var socket=require(_0x65d9('0xe'))(new Redis(config[_0x65d9('0xb')]));require(_0x65d9('0xf'))[_0x65d9('0x10')](socket);function respondWithRpcPromise(_0x59316b,_0x4092dd,_0x38f221){return new BPromise(function(_0x47a53c,_0x3e85b1){return client[_0x65d9('0x11')](_0x59316b,_0x38f221)[_0x65d9('0x12')](function(_0x3aff99){logger[_0x65d9('0x13')]('OpenchannelQueue,\x20%s,\x20%s',_0x4092dd,_0x65d9('0x14'));logger[_0x65d9('0x15')](_0x65d9('0x16'),_0x4092dd,'request\x20sent',JSON[_0x65d9('0x17')](_0x3aff99));if(_0x3aff99[_0x65d9('0x18')]){if(_0x3aff99[_0x65d9('0x18')][_0x65d9('0x19')]===0x1f4){logger['error']('OpenchannelQueue,\x20%s,\x20%s',_0x4092dd,_0x3aff99[_0x65d9('0x18')][_0x65d9('0x1a')]);return _0x3e85b1(_0x3aff99[_0x65d9('0x18')]['message']);}logger[_0x65d9('0x18')](_0x65d9('0x1b'),_0x4092dd,_0x3aff99[_0x65d9('0x18')][_0x65d9('0x1a')]);return _0x47a53c(_0x3aff99[_0x65d9('0x18')]['message']);}else{logger[_0x65d9('0x13')](_0x65d9('0x1b'),_0x4092dd,_0x65d9('0x14'));_0x47a53c(_0x3aff99[_0x65d9('0x1c')][_0x65d9('0x1a')]);}})[_0x65d9('0x1d')](function(_0x1426c7){logger[_0x65d9('0x18')](_0x65d9('0x1b'),_0x4092dd,_0x1426c7);_0x3e85b1(_0x1426c7);});});}exports[_0x65d9('0x1e')]=function(_0x303cb5){var _0x39aeea=this;return new Promise(function(_0x5c6688,_0xdd3059){return db[_0x65d9('0x1f')]['findAll']({'raw':_0x303cb5['options']?_0x303cb5[_0x65d9('0x20')]['raw']===undefined?!![]:![]:!![],'where':_0x303cb5[_0x65d9('0x20')]?_0x303cb5[_0x65d9('0x20')][_0x65d9('0x21')]||null:null,'attributes':_0x303cb5['options']?_0x303cb5[_0x65d9('0x20')][_0x65d9('0x22')]||null:null,'limit':_0x303cb5[_0x65d9('0x20')]?_0x303cb5[_0x65d9('0x20')][_0x65d9('0x23')]||null:null,'include':_0x303cb5[_0x65d9('0x20')]?_0x303cb5[_0x65d9('0x20')][_0x65d9('0x24')]?_[_0x65d9('0x25')](_0x303cb5[_0x65d9('0x20')][_0x65d9('0x24')],function(_0x43f918){return{'model':db[_0x43f918[_0x65d9('0x26')]],'as':_0x43f918['as'],'attributes':_0x43f918[_0x65d9('0x22')],'include':_0x43f918[_0x65d9('0x24')]?_[_0x65d9('0x25')](_0x43f918[_0x65d9('0x24')],function(_0x84493d){return{'model':db[_0x84493d[_0x65d9('0x26')]],'as':_0x84493d['as'],'attributes':_0x84493d[_0x65d9('0x22')],'include':_0x84493d['include']?_[_0x65d9('0x25')](_0x84493d[_0x65d9('0x24')],function(_0x56e4e1){return{'model':db[_0x56e4e1[_0x65d9('0x26')]],'as':_0x56e4e1['as'],'attributes':_0x56e4e1['attributes']};}):[]};}):[]};}):[]:[]})[_0x65d9('0x12')](function(_0x5471ca){logger[_0x65d9('0x13')](_0x65d9('0x1e'),_0x303cb5);logger[_0x65d9('0x15')]('GetOpenchannelQueue',_0x303cb5,JSON[_0x65d9('0x17')](_0x5471ca));_0x5c6688(_0x5471ca);})[_0x65d9('0x1d')](function(_0x4545a8){logger[_0x65d9('0x18')](_0x65d9('0x1e'),_0x4545a8['message'],_0x303cb5);_0xdd3059(_0x39aeea[_0x65d9('0x18')](0x1f4,_0x4545a8['message']));});});};exports[_0x65d9('0x27')]=function(_0x4971d1){var _0x56c6e1=this;return new Promise(function(_0x785a68,_0x1c5766){return db[_0x65d9('0x1f')][_0x65d9('0x28')]({'raw':_0x4971d1[_0x65d9('0x20')]?_0x4971d1[_0x65d9('0x20')][_0x65d9('0x29')]===undefined?!![]:![]:!![],'where':_0x4971d1[_0x65d9('0x20')]?_0x4971d1[_0x65d9('0x20')][_0x65d9('0x21')]||null:null,'attributes':_0x4971d1[_0x65d9('0x20')]?_0x4971d1[_0x65d9('0x20')][_0x65d9('0x22')]||null:null,'include':_0x4971d1['options']?_0x4971d1[_0x65d9('0x20')][_0x65d9('0x24')]?_[_0x65d9('0x25')](_0x4971d1[_0x65d9('0x20')][_0x65d9('0x24')],function(_0x325d30){return{'model':db[_0x325d30[_0x65d9('0x26')]],'as':_0x325d30['as'],'attributes':_0x325d30[_0x65d9('0x22')],'include':_0x325d30[_0x65d9('0x24')]?_[_0x65d9('0x25')](_0x325d30[_0x65d9('0x24')],function(_0x5cea1f){return{'model':db[_0x5cea1f[_0x65d9('0x26')]],'as':_0x5cea1f['as'],'attributes':_0x5cea1f['attributes'],'include':_0x5cea1f[_0x65d9('0x24')]?_[_0x65d9('0x25')](_0x5cea1f['include'],function(_0x468da4){return{'model':db[_0x468da4['model']],'as':_0x468da4['as'],'attributes':_0x468da4['attributes']};}):[]};}):[]};}):[]:[]})[_0x65d9('0x12')](function(_0x4107e8){logger[_0x65d9('0x13')](_0x65d9('0x27'),_0x4971d1);logger['debug'](_0x65d9('0x27'),_0x4971d1,JSON['stringify'](_0x4107e8));_0x785a68(_0x4107e8);})['catch'](function(_0x20ae4f){logger[_0x65d9('0x18')](_0x65d9('0x27'),_0x20ae4f[_0x65d9('0x1a')],_0x4971d1);_0x1c5766(_0x56c6e1['error'](0x1f4,_0x20ae4f['message']));});});}; \ No newline at end of file +var _0x75e3=['request\x20sent','stringify','error','message','result','catch','OpenchannelQueue','findAll','options','raw','where','attributes','include','map','model','then','GetOpenchannelQueue','ShowOpenchannelQueue','find','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','request','info','OpenchannelQueue,\x20%s,\x20%s','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s'];(function(_0x533de2,_0x4aeb49){var _0x1334f4=function(_0xbc5b8a){while(--_0xbc5b8a){_0x533de2['push'](_0x533de2['shift']());}};_0x1334f4(++_0x4aeb49);}(_0x75e3,0x184));var _0x375e=function(_0x3f928e,_0x5b5f02){_0x3f928e=_0x3f928e-0x0;var _0x32ab48=_0x75e3[_0x3f928e];return _0x32ab48;};'use strict';var _=require(_0x375e('0x0'));var util=require(_0x375e('0x1'));var moment=require('moment');var BPromise=require(_0x375e('0x2'));var rs=require(_0x375e('0x3'));var fs=require('fs');var Redis=require(_0x375e('0x4'));var db=require(_0x375e('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x375e('0x6'))(_0x375e('0x7'));var config=require('../../config/environment');var jayson=require(_0x375e('0x8'));var client=jayson[_0x375e('0x9')][_0x375e('0xa')]({'port':0x232a});config[_0x375e('0xb')]=_[_0x375e('0xc')](config[_0x375e('0xb')],{'host':_0x375e('0xd'),'port':0x18eb});var socket=require(_0x375e('0xe'))(new Redis(config['redis']));require(_0x375e('0xf'))[_0x375e('0x10')](socket);function respondWithRpcPromise(_0x55489b,_0x446762,_0x256b23){return new BPromise(function(_0x1656cc,_0x302b80){return client[_0x375e('0x11')](_0x55489b,_0x256b23)['then'](function(_0x555721){logger[_0x375e('0x12')](_0x375e('0x13'),_0x446762,'request\x20sent');logger[_0x375e('0x14')](_0x375e('0x15'),_0x446762,_0x375e('0x16'),JSON[_0x375e('0x17')](_0x555721));if(_0x555721['error']){if(_0x555721['error']['code']===0x1f4){logger[_0x375e('0x18')](_0x375e('0x13'),_0x446762,_0x555721[_0x375e('0x18')][_0x375e('0x19')]);return _0x302b80(_0x555721[_0x375e('0x18')][_0x375e('0x19')]);}logger['error'](_0x375e('0x13'),_0x446762,_0x555721[_0x375e('0x18')][_0x375e('0x19')]);return _0x1656cc(_0x555721[_0x375e('0x18')]['message']);}else{logger['info'](_0x375e('0x13'),_0x446762,_0x375e('0x16'));_0x1656cc(_0x555721[_0x375e('0x1a')][_0x375e('0x19')]);}})[_0x375e('0x1b')](function(_0x457a4f){logger['error'](_0x375e('0x13'),_0x446762,_0x457a4f);_0x302b80(_0x457a4f);});});}exports['GetOpenchannelQueue']=function(_0x59af1b){var _0x441872=this;return new Promise(function(_0xa9a6a1,_0x3dc9f7){return db[_0x375e('0x1c')][_0x375e('0x1d')]({'raw':_0x59af1b['options']?_0x59af1b[_0x375e('0x1e')][_0x375e('0x1f')]===undefined?!![]:![]:!![],'where':_0x59af1b[_0x375e('0x1e')]?_0x59af1b[_0x375e('0x1e')][_0x375e('0x20')]||null:null,'attributes':_0x59af1b[_0x375e('0x1e')]?_0x59af1b[_0x375e('0x1e')][_0x375e('0x21')]||null:null,'limit':_0x59af1b[_0x375e('0x1e')]?_0x59af1b[_0x375e('0x1e')]['limit']||null:null,'include':_0x59af1b[_0x375e('0x1e')]?_0x59af1b['options'][_0x375e('0x22')]?_[_0x375e('0x23')](_0x59af1b[_0x375e('0x1e')]['include'],function(_0x36683b){return{'model':db[_0x36683b[_0x375e('0x24')]],'as':_0x36683b['as'],'attributes':_0x36683b[_0x375e('0x21')],'include':_0x36683b[_0x375e('0x22')]?_['map'](_0x36683b[_0x375e('0x22')],function(_0x5447d9){return{'model':db[_0x5447d9[_0x375e('0x24')]],'as':_0x5447d9['as'],'attributes':_0x5447d9[_0x375e('0x21')],'include':_0x5447d9[_0x375e('0x22')]?_[_0x375e('0x23')](_0x5447d9['include'],function(_0x26987a){return{'model':db[_0x26987a[_0x375e('0x24')]],'as':_0x26987a['as'],'attributes':_0x26987a['attributes']};}):[]};}):[]};}):[]:[]})[_0x375e('0x25')](function(_0x3ad28a){logger['info']('GetOpenchannelQueue',_0x59af1b);logger['debug'](_0x375e('0x26'),_0x59af1b,JSON[_0x375e('0x17')](_0x3ad28a));_0xa9a6a1(_0x3ad28a);})[_0x375e('0x1b')](function(_0xe10c38){logger[_0x375e('0x18')](_0x375e('0x26'),_0xe10c38[_0x375e('0x19')],_0x59af1b);_0x3dc9f7(_0x441872[_0x375e('0x18')](0x1f4,_0xe10c38[_0x375e('0x19')]));});});};exports[_0x375e('0x27')]=function(_0x333b72){var _0x5d1b77=this;return new Promise(function(_0x3e3da1,_0x2ef5e4){return db[_0x375e('0x1c')][_0x375e('0x28')]({'raw':_0x333b72[_0x375e('0x1e')]?_0x333b72[_0x375e('0x1e')][_0x375e('0x1f')]===undefined?!![]:![]:!![],'where':_0x333b72['options']?_0x333b72[_0x375e('0x1e')][_0x375e('0x20')]||null:null,'attributes':_0x333b72[_0x375e('0x1e')]?_0x333b72[_0x375e('0x1e')][_0x375e('0x21')]||null:null,'include':_0x333b72['options']?_0x333b72[_0x375e('0x1e')][_0x375e('0x22')]?_[_0x375e('0x23')](_0x333b72['options'][_0x375e('0x22')],function(_0x57ea86){return{'model':db[_0x57ea86[_0x375e('0x24')]],'as':_0x57ea86['as'],'attributes':_0x57ea86[_0x375e('0x21')],'include':_0x57ea86['include']?_[_0x375e('0x23')](_0x57ea86[_0x375e('0x22')],function(_0x5e9e59){return{'model':db[_0x5e9e59[_0x375e('0x24')]],'as':_0x5e9e59['as'],'attributes':_0x5e9e59[_0x375e('0x21')],'include':_0x5e9e59[_0x375e('0x22')]?_[_0x375e('0x23')](_0x5e9e59[_0x375e('0x22')],function(_0x417361){return{'model':db[_0x417361[_0x375e('0x24')]],'as':_0x417361['as'],'attributes':_0x417361[_0x375e('0x21')]};}):[]};}):[]};}):[]:[]})[_0x375e('0x25')](function(_0x56d18f){logger[_0x375e('0x12')](_0x375e('0x27'),_0x333b72);logger[_0x375e('0x14')](_0x375e('0x27'),_0x333b72,JSON[_0x375e('0x17')](_0x56d18f));_0x3e3da1(_0x56d18f);})['catch'](function(_0x144af8){logger[_0x375e('0x18')](_0x375e('0x27'),_0x144af8[_0x375e('0x19')],_0x333b72);_0x2ef5e4(_0x5d1b77[_0x375e('0x18')](0x1f4,_0x144af8['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 61c1387..00a6de0 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 _0x45bc=['remove','emit','register','openchannelQueue:','./openchannelQueue.events','save'];(function(_0xa60623,_0x2d4e4f){var _0x4a6487=function(_0xba6cbe){while(--_0xba6cbe){_0xa60623['push'](_0xa60623['shift']());}};_0x4a6487(++_0x2d4e4f);}(_0x45bc,0x10c));var _0xc45b=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x45bc[_0x14add3];return _0x4a174f;};'use strict';var OpenchannelQueueEvents=require(_0xc45b('0x0'));var events=[_0xc45b('0x1'),_0xc45b('0x2'),'update'];function createListener(_0x207a81,_0x44e464){return function(_0x55b992){_0x44e464[_0xc45b('0x3')](_0x207a81,_0x55b992);};}function removeListener(_0x1b3524,_0x29e9e6){return function(){OpenchannelQueueEvents['removeListener'](_0x1b3524,_0x29e9e6);};}exports[_0xc45b('0x4')]=function(_0x4b684c){for(var _0x4a6351=0x0,_0x4322d0=events['length'];_0x4a6351<_0x4322d0;_0x4a6351++){var _0x11adbf=events[_0x4a6351];var _0x3853c0=createListener(_0xc45b('0x5')+_0x11adbf,_0x4b684c);OpenchannelQueueEvents['on'](_0x11adbf,_0x3853c0);}}; \ No newline at end of file +var _0x7305=['register','length','save','remove','emit'];(function(_0x1a5f7b,_0x142a59){var _0x4b292e=function(_0x5d7d1e){while(--_0x5d7d1e){_0x1a5f7b['push'](_0x1a5f7b['shift']());}};_0x4b292e(++_0x142a59);}(_0x7305,0x1b0));var _0x5730=function(_0x1d42dd,_0x3e0b8d){_0x1d42dd=_0x1d42dd-0x0;var _0x5563f9=_0x7305[_0x1d42dd];return _0x5563f9;};'use strict';var OpenchannelQueueEvents=require('./openchannelQueue.events');var events=[_0x5730('0x0'),_0x5730('0x1'),'update'];function createListener(_0x139d48,_0x1e0ac7){return function(_0x2ce264){_0x1e0ac7[_0x5730('0x2')](_0x139d48,_0x2ce264);};}function removeListener(_0x5b91a9,_0x34de6b){return function(){OpenchannelQueueEvents['removeListener'](_0x5b91a9,_0x34de6b);};}exports[_0x5730('0x3')]=function(_0x34b399){for(var _0x3ed2e9=0x0,_0x67b601=events[_0x5730('0x4')];_0x3ed2e9<_0x67b601;_0x3ed2e9++){var _0x22cc41=events[_0x3ed2e9];var _0x1612e5=createListener('openchannelQueue:'+_0x22cc41,_0x34b399);OpenchannelQueueEvents['on'](_0x22cc41,_0x1612e5);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index 17d8620..3fd1ab9 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 _0x2294=['../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x6f1a87,_0x5d5bcf){var _0x2495c7=function(_0x1c6733){while(--_0x1c6733){_0x6f1a87['push'](_0x6f1a87['shift']());}};_0x2495c7(++_0x5d5bcf);}(_0x2294,0x13c));var _0x4229=function(_0x42e299,_0x5dddde){_0x42e299=_0x42e299-0x0;var _0x1f09f8=_0x2294[_0x42e299];return _0x1f09f8;};'use strict';var multer=require(_0x4229('0x0'));var util=require(_0x4229('0x1'));var path=require(_0x4229('0x2'));var timeout=require(_0x4229('0x3'));var express=require(_0x4229('0x4'));var router=express[_0x4229('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x4229('0x6'));var interaction=require(_0x4229('0x7'));var config=require(_0x4229('0x8'));var controller=require(_0x4229('0x9'));router[_0x4229('0xa')]('/',auth['isAuthenticated'](),controller[_0x4229('0xb')]);router[_0x4229('0xa')](_0x4229('0xc'),auth[_0x4229('0xd')](),controller[_0x4229('0xe')]);router[_0x4229('0xa')](_0x4229('0xf'),auth[_0x4229('0xd')](),controller[_0x4229('0x10')]);router[_0x4229('0x11')]('/',auth[_0x4229('0xd')](),controller[_0x4229('0x12')]);router[_0x4229('0x13')](_0x4229('0xf'),auth['isAuthenticated'](),controller['update']);router[_0x4229('0x14')]('/:id',auth[_0x4229('0xd')](),controller[_0x4229('0x15')]);module[_0x4229('0x16')]=router; \ No newline at end of file +var _0x6438=['update','delete','exports','multer','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','/:id','show','post','create','put'];(function(_0x10b0d0,_0x4bdc65){var _0x27b302=function(_0x3972b3){while(--_0x3972b3){_0x10b0d0['push'](_0x10b0d0['shift']());}};_0x27b302(++_0x4bdc65);}(_0x6438,0xc1));var _0x8643=function(_0x292a21,_0x3df55b){_0x292a21=_0x292a21-0x0;var _0x3ab1b1=_0x6438[_0x292a21];return _0x3ab1b1;};'use strict';var multer=require(_0x8643('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x8643('0x1'));var express=require(_0x8643('0x2'));var router=express['Router']();var fs_extra=require(_0x8643('0x3'));var auth=require(_0x8643('0x4'));var interaction=require(_0x8643('0x5'));var config=require(_0x8643('0x6'));var controller=require('./openchannelQueueReport.controller');router['get']('/',auth[_0x8643('0x7')](),controller[_0x8643('0x8')]);router[_0x8643('0x9')](_0x8643('0xa'),auth[_0x8643('0x7')](),controller['describe']);router[_0x8643('0x9')](_0x8643('0xb'),auth[_0x8643('0x7')](),controller[_0x8643('0xc')]);router[_0x8643('0xd')]('/',auth['isAuthenticated'](),controller[_0x8643('0xe')]);router[_0x8643('0xf')](_0x8643('0xb'),auth['isAuthenticated'](),controller[_0x8643('0x10')]);router[_0x8643('0x11')]('/:id',auth[_0x8643('0x7')](),controller['destroy']);module[_0x8643('0x12')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index 79c0086..d6c6f4d 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 _0x5aa7=['DATE','moment','sequelize','STRING'];(function(_0x4c4037,_0x15054b){var _0x357862=function(_0x480015){while(--_0x480015){_0x4c4037['push'](_0x4c4037['shift']());}};_0x357862(++_0x15054b);}(_0x5aa7,0x131));var _0x75aa=function(_0x3b3b97,_0x362e97){_0x3b3b97=_0x3b3b97-0x0;var _0x4e691e=_0x5aa7[_0x3b3b97];return _0x4e691e;};'use strict';var moment=require(_0x75aa('0x0'));var Sequelize=require(_0x75aa('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x75aa('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x75aa('0x2')]},'joinAt':{'type':Sequelize[_0x75aa('0x3')]},'leaveAt':{'type':Sequelize[_0x75aa('0x3')]},'acceptAt':{'type':Sequelize[_0x75aa('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x75aa('0x2')]}}; \ No newline at end of file +var _0x0c34=['sequelize','STRING','DATE'];(function(_0x1d9aa0,_0x272488){var _0x226868=function(_0x17127c){while(--_0x17127c){_0x1d9aa0['push'](_0x1d9aa0['shift']());}};_0x226868(++_0x272488);}(_0x0c34,0x153));var _0x40c3=function(_0x3a1962,_0x415659){_0x3a1962=_0x3a1962-0x0;var _0x567d8a=_0x0c34[_0x3a1962];return _0x567d8a;};'use strict';var moment=require('moment');var Sequelize=require(_0x40c3('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x40c3('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0x40c3('0x1')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x40c3('0x2')]},'acceptAt':{'type':Sequelize[_0x40c3('0x2')]},'exitAt':{'type':Sequelize[_0x40c3('0x2')]},'reason':{'type':Sequelize[_0x40c3('0x1')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index 8623e33..7ca37db 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 _0xfbe7=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','save','destroy','then','sendStatus','error','name','send','index','map','OpenchannelQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','find','catch','body','update','rimraf','zip-dir','bluebird','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring'];(function(_0x1fdcd4,_0x4cc208){var _0x355d6a=function(_0x17826a){while(--_0x17826a){_0x1fdcd4['push'](_0x1fdcd4['shift']());}};_0x355d6a(++_0x4cc208);}(_0xfbe7,0x82));var _0x7fbe=function(_0x150737,_0x5bee68){_0x150737=_0x150737-0x0;var _0x4c0e80=_0xfbe7[_0x150737];return _0x4c0e80;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7fbe('0x0'));var zipdir=require(_0x7fbe('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x7fbe('0x2'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x7fbe('0x3'));var csv=require('to-csv');var ejs=require(_0x7fbe('0x4'));var fs=require('fs');var fs_extra=require(_0x7fbe('0x5'));var _=require(_0x7fbe('0x6'));var squel=require(_0x7fbe('0x7'));var crypto=require(_0x7fbe('0x8'));var jsforce=require(_0x7fbe('0x9'));var deskjs=require(_0x7fbe('0xa'));var toCsv=require('to-csv');var querystring=require(_0x7fbe('0xb'));var Papa=require(_0x7fbe('0xc'));var Redis=require(_0x7fbe('0xd'));var authService=require(_0x7fbe('0xe'));var qs=require(_0x7fbe('0xf'));var as=require(_0x7fbe('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7fbe('0x11'))(_0x7fbe('0x12'));var utils=require(_0x7fbe('0x13'));var config=require(_0x7fbe('0x14'));var licenseUtil=require(_0x7fbe('0x15'));var db=require(_0x7fbe('0x16'))['db'];function respondWithStatusCode(_0x50d761,_0x3b7c7e){_0x3b7c7e=_0x3b7c7e||0xcc;return function(_0x1f7cff){if(_0x1f7cff){return _0x50d761['sendStatus'](_0x3b7c7e);}return _0x50d761[_0x7fbe('0x17')](_0x3b7c7e)[_0x7fbe('0x18')]();};}function respondWithResult(_0x41b42f,_0x448d92){_0x448d92=_0x448d92||0xc8;return function(_0x4fe9fc){if(_0x4fe9fc){return _0x41b42f[_0x7fbe('0x17')](_0x448d92)[_0x7fbe('0x19')](_0x4fe9fc);}};}function respondWithFilteredResult(_0x5d2084,_0x3b171d){return function(_0x5337a7){if(_0x5337a7){var _0x1aa9c2=typeof _0x3b171d[_0x7fbe('0x1a')]===_0x7fbe('0x1b')&&typeof _0x3b171d[_0x7fbe('0x1c')]==='undefined';var _0x508266=_0x5337a7[_0x7fbe('0x1d')];var _0x2a4fee=_0x1aa9c2?0x0:_0x3b171d['offset'];var _0x43710f=_0x1aa9c2?_0x5337a7['count']:_0x3b171d[_0x7fbe('0x1a')]+_0x3b171d[_0x7fbe('0x1c')];var _0x34d579;if(_0x43710f>=_0x508266){_0x43710f=_0x508266;_0x34d579=0xc8;}else{_0x34d579=0xce;}_0x5d2084['status'](_0x34d579);return _0x5d2084['set']('Content-Range',_0x2a4fee+'-'+_0x43710f+'/'+_0x508266)['json'](_0x5337a7);}return null;};}function patchUpdates(_0x30847f){return function(_0x4825ab){try{jsonpatch['apply'](_0x4825ab,_0x30847f,!![]);}catch(_0x1036b0){return BPromise['reject'](_0x1036b0);}return _0x4825ab[_0x7fbe('0x1e')]();};}function saveUpdates(_0x388569,_0x20580b){return function(_0x2f6851){if(_0x2f6851){return _0x2f6851['update'](_0x388569)['then'](function(_0xb1963f){return _0xb1963f;});}return null;};}function removeEntity(_0x3c0445,_0x5173fb){return function(_0x5b6669){if(_0x5b6669){return _0x5b6669[_0x7fbe('0x1f')]()[_0x7fbe('0x20')](function(){_0x3c0445['status'](0xcc)[_0x7fbe('0x18')]();});}};}function handleEntityNotFound(_0x10275f,_0x3b356b){return function(_0x2bdc95){if(!_0x2bdc95){_0x10275f[_0x7fbe('0x21')](0x194);}return _0x2bdc95;};}function handleError(_0x4fad93,_0x50c08d){_0x50c08d=_0x50c08d||0x1f4;return function(_0x4d00c4){logger[_0x7fbe('0x22')](_0x4d00c4['stack']);if(_0x4d00c4[_0x7fbe('0x23')]){delete _0x4d00c4['name'];}_0x4fad93['status'](_0x50c08d)[_0x7fbe('0x24')](_0x4d00c4);};}exports[_0x7fbe('0x25')]=function(_0x1006f0,_0x5244dc){var _0x5cb690={},_0x2b15bb={},_0x3e0297={'count':0x0,'rows':[]};var _0xb92f56=_[_0x7fbe('0x26')](db[_0x7fbe('0x27')][_0x7fbe('0x28')],function(_0x1f9dd4){return{'name':_0x1f9dd4[_0x7fbe('0x29')],'type':_0x1f9dd4[_0x7fbe('0x2a')][_0x7fbe('0x2b')]};});_0x2b15bb[_0x7fbe('0x2c')]=_['map'](_0xb92f56,_0x7fbe('0x23'));_0x2b15bb[_0x7fbe('0x2d')]=_[_0x7fbe('0x2e')](_0x1006f0[_0x7fbe('0x2d')]);_0x2b15bb[_0x7fbe('0x2f')]=_[_0x7fbe('0x30')](_0x2b15bb[_0x7fbe('0x2c')],_0x2b15bb[_0x7fbe('0x2d')]);_0x5cb690[_0x7fbe('0x31')]=_[_0x7fbe('0x30')](_0x2b15bb[_0x7fbe('0x2c')],qs[_0x7fbe('0x32')](_0x1006f0[_0x7fbe('0x2d')][_0x7fbe('0x32')]));_0x5cb690['attributes']=_0x5cb690[_0x7fbe('0x31')][_0x7fbe('0x33')]?_0x5cb690['attributes']:_0x2b15bb[_0x7fbe('0x2c')];if(!_0x1006f0[_0x7fbe('0x2d')][_0x7fbe('0x34')](_0x7fbe('0x35'))){_0x5cb690['limit']=qs[_0x7fbe('0x1c')](_0x1006f0[_0x7fbe('0x2d')][_0x7fbe('0x1c')]);_0x5cb690[_0x7fbe('0x1a')]=qs[_0x7fbe('0x1a')](_0x1006f0[_0x7fbe('0x2d')][_0x7fbe('0x1a')]);}_0x5cb690[_0x7fbe('0x36')]=qs[_0x7fbe('0x37')](_0x1006f0['query'][_0x7fbe('0x37')]);_0x5cb690[_0x7fbe('0x38')]=qs[_0x7fbe('0x2f')](_[_0x7fbe('0x39')](_0x1006f0[_0x7fbe('0x2d')],_0x2b15bb[_0x7fbe('0x2f')]),_0xb92f56);if(_0x1006f0[_0x7fbe('0x2d')][_0x7fbe('0x3a')]){_0x5cb690[_0x7fbe('0x38')]=_[_0x7fbe('0x3b')](_0x5cb690['where'],{'$or':_[_0x7fbe('0x26')](_0xb92f56,function(_0x3ace53){if(_0x3ace53[_0x7fbe('0x2a')]!==_0x7fbe('0x3c')){var _0x5f3842={};_0x5f3842[_0x3ace53[_0x7fbe('0x23')]]={'$like':'%'+_0x1006f0['query'][_0x7fbe('0x3a')]+'%'};return _0x5f3842;}})});}_0x5cb690=_[_0x7fbe('0x3b')]({},_0x5cb690,_0x1006f0[_0x7fbe('0x3d')]);var _0x908ee6={'where':_0x5cb690[_0x7fbe('0x38')]};return db['OpenchannelQueueReport'][_0x7fbe('0x1d')](_0x908ee6)[_0x7fbe('0x20')](function(_0x1320bc){_0x3e0297[_0x7fbe('0x1d')]=_0x1320bc;if(_0x1006f0[_0x7fbe('0x2d')][_0x7fbe('0x3e')]){_0x5cb690[_0x7fbe('0x3f')]=[{'all':!![]}];}return db[_0x7fbe('0x27')][_0x7fbe('0x40')](_0x5cb690);})[_0x7fbe('0x20')](function(_0x557191){_0x3e0297[_0x7fbe('0x41')]=_0x557191;return _0x3e0297;})[_0x7fbe('0x20')](respondWithFilteredResult(_0x5244dc,_0x5cb690))['catch'](handleError(_0x5244dc,null));};exports['show']=function(_0x39dbf0,_0x3db3b9){var _0x47be02={'raw':!![],'where':{'id':_0x39dbf0[_0x7fbe('0x42')]['id']}},_0x1e4dd7={};_0x1e4dd7[_0x7fbe('0x2c')]=_['keys'](db[_0x7fbe('0x27')][_0x7fbe('0x28')]);_0x1e4dd7['query']=_[_0x7fbe('0x2e')](_0x39dbf0[_0x7fbe('0x2d')]);_0x1e4dd7[_0x7fbe('0x2f')]=_[_0x7fbe('0x30')](_0x1e4dd7[_0x7fbe('0x2c')],_0x1e4dd7[_0x7fbe('0x2d')]);_0x47be02[_0x7fbe('0x31')]=_[_0x7fbe('0x30')](_0x1e4dd7[_0x7fbe('0x2c')],qs['fields'](_0x39dbf0['query']['fields']));_0x47be02[_0x7fbe('0x31')]=_0x47be02[_0x7fbe('0x31')][_0x7fbe('0x33')]?_0x47be02[_0x7fbe('0x31')]:_0x1e4dd7['model'];if(_0x39dbf0[_0x7fbe('0x2d')][_0x7fbe('0x3e')]){_0x47be02[_0x7fbe('0x3f')]=[{'all':!![]}];}_0x47be02=_[_0x7fbe('0x3b')]({},_0x47be02,_0x39dbf0[_0x7fbe('0x3d')]);return db[_0x7fbe('0x27')][_0x7fbe('0x43')](_0x47be02)['then'](handleEntityNotFound(_0x3db3b9,null))['then'](respondWithResult(_0x3db3b9,null))[_0x7fbe('0x44')](handleError(_0x3db3b9,null));};exports['create']=function(_0xd6a4b4,_0x2fffae){return db[_0x7fbe('0x27')]['create'](_0xd6a4b4[_0x7fbe('0x45')],{})[_0x7fbe('0x20')](respondWithResult(_0x2fffae,0xc9))['catch'](handleError(_0x2fffae,null));};exports[_0x7fbe('0x46')]=function(_0x1afb7a,_0x403965){if(_0x1afb7a[_0x7fbe('0x45')]['id']){delete _0x1afb7a['body']['id'];}return db[_0x7fbe('0x27')]['find']({'where':{'id':_0x1afb7a[_0x7fbe('0x42')]['id']}})[_0x7fbe('0x20')](handleEntityNotFound(_0x403965,null))[_0x7fbe('0x20')](saveUpdates(_0x1afb7a[_0x7fbe('0x45')],null))[_0x7fbe('0x20')](respondWithResult(_0x403965,null))[_0x7fbe('0x44')](handleError(_0x403965,null));};exports[_0x7fbe('0x1f')]=function(_0x3c5b3d,_0x9cb913){return db[_0x7fbe('0x27')][_0x7fbe('0x43')]({'where':{'id':_0x3c5b3d['params']['id']}})[_0x7fbe('0x20')](handleEntityNotFound(_0x9cb913,null))['then'](removeEntity(_0x9cb913,null))[_0x7fbe('0x44')](handleError(_0x9cb913,null));};exports['describe']=function(_0x3a7ee7,_0x4dd24d){return db[_0x7fbe('0x27')]['describe']()[_0x7fbe('0x20')](respondWithResult(_0x4dd24d,null))[_0x7fbe('0x44')](handleError(_0x4dd24d,null));}; \ No newline at end of file +var _0xaa91=['options','OpenchannelQueueReport','includeAll','findAll','rows','catch','show','params','include','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','map','fieldName','type','key','model','query','keys','intersection','fields','length','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL'];(function(_0x35161f,_0x32ddd5){var _0x21cfd1=function(_0x4e6923){while(--_0x4e6923){_0x35161f['push'](_0x35161f['shift']());}};_0x21cfd1(++_0x32ddd5);}(_0xaa91,0x159));var _0x1aa9=function(_0x36607b,_0xc2184a){_0x36607b=_0x36607b-0x0;var _0x1d743d=_0xaa91[_0x36607b];return _0x1d743d;};'use strict';var emlformat=require(_0x1aa9('0x0'));var rimraf=require(_0x1aa9('0x1'));var zipdir=require(_0x1aa9('0x2'));var jsonpatch=require(_0x1aa9('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x1aa9('0x4'));var Mustache=require(_0x1aa9('0x5'));var util=require(_0x1aa9('0x6'));var path=require('path');var sox=require(_0x1aa9('0x7'));var csv=require(_0x1aa9('0x8'));var ejs=require(_0x1aa9('0x9'));var fs=require('fs');var fs_extra=require(_0x1aa9('0xa'));var _=require(_0x1aa9('0xb'));var squel=require(_0x1aa9('0xc'));var crypto=require(_0x1aa9('0xd'));var jsforce=require(_0x1aa9('0xe'));var deskjs=require(_0x1aa9('0xf'));var toCsv=require('to-csv');var querystring=require(_0x1aa9('0x10'));var Papa=require(_0x1aa9('0x11'));var Redis=require(_0x1aa9('0x12'));var authService=require(_0x1aa9('0x13'));var qs=require(_0x1aa9('0x14'));var as=require(_0x1aa9('0x15'));var hardwareService=require(_0x1aa9('0x16'));var logger=require(_0x1aa9('0x17'))(_0x1aa9('0x18'));var utils=require(_0x1aa9('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x1aa9('0x1a'));var db=require(_0x1aa9('0x1b'))['db'];function respondWithStatusCode(_0x170c59,_0xa77e26){_0xa77e26=_0xa77e26||0xcc;return function(_0x54e505){if(_0x54e505){return _0x170c59[_0x1aa9('0x1c')](_0xa77e26);}return _0x170c59[_0x1aa9('0x1d')](_0xa77e26)['end']();};}function respondWithResult(_0x5a84f7,_0xd6c762){_0xd6c762=_0xd6c762||0xc8;return function(_0x2d8bf3){if(_0x2d8bf3){return _0x5a84f7[_0x1aa9('0x1d')](_0xd6c762)[_0x1aa9('0x1e')](_0x2d8bf3);}};}function respondWithFilteredResult(_0x584d21,_0x35d3fc){return function(_0x4572a4){if(_0x4572a4){var _0x1d4e8b=typeof _0x35d3fc[_0x1aa9('0x1f')]===_0x1aa9('0x20')&&typeof _0x35d3fc[_0x1aa9('0x21')]==='undefined';var _0x587d30=_0x4572a4['count'];var _0x3eaf71=_0x1d4e8b?0x0:_0x35d3fc['offset'];var _0x3300c8=_0x1d4e8b?_0x4572a4[_0x1aa9('0x22')]:_0x35d3fc[_0x1aa9('0x1f')]+_0x35d3fc[_0x1aa9('0x21')];var _0x2541f5;if(_0x3300c8>=_0x587d30){_0x3300c8=_0x587d30;_0x2541f5=0xc8;}else{_0x2541f5=0xce;}_0x584d21[_0x1aa9('0x1d')](_0x2541f5);return _0x584d21[_0x1aa9('0x23')](_0x1aa9('0x24'),_0x3eaf71+'-'+_0x3300c8+'/'+_0x587d30)[_0x1aa9('0x1e')](_0x4572a4);}return null;};}function patchUpdates(_0x1440eb){return function(_0x2c3cc1){try{jsonpatch[_0x1aa9('0x25')](_0x2c3cc1,_0x1440eb,!![]);}catch(_0x5bf542){return BPromise[_0x1aa9('0x26')](_0x5bf542);}return _0x2c3cc1[_0x1aa9('0x27')]();};}function saveUpdates(_0x114eed,_0x51c27b){return function(_0xa0458e){if(_0xa0458e){return _0xa0458e[_0x1aa9('0x28')](_0x114eed)[_0x1aa9('0x29')](function(_0xa6236e){return _0xa6236e;});}return null;};}function removeEntity(_0x3ba1ac,_0x113ea7){return function(_0x3206fe){if(_0x3206fe){return _0x3206fe[_0x1aa9('0x2a')]()[_0x1aa9('0x29')](function(){_0x3ba1ac[_0x1aa9('0x1d')](0xcc)[_0x1aa9('0x2b')]();});}};}function handleEntityNotFound(_0x54e82,_0x22693a){return function(_0x37a9d1){if(!_0x37a9d1){_0x54e82[_0x1aa9('0x1c')](0x194);}return _0x37a9d1;};}function handleError(_0x5e274d,_0x476476){_0x476476=_0x476476||0x1f4;return function(_0x35b302){logger[_0x1aa9('0x2c')](_0x35b302[_0x1aa9('0x2d')]);if(_0x35b302[_0x1aa9('0x2e')]){delete _0x35b302['name'];}_0x5e274d['status'](_0x476476)[_0x1aa9('0x2f')](_0x35b302);};}exports[_0x1aa9('0x30')]=function(_0x5bbd84,_0x23a3da){var _0x4fe470={},_0x25dc54={},_0xb1357b={'count':0x0,'rows':[]};var _0x2ace32=_[_0x1aa9('0x31')](db['OpenchannelQueueReport']['rawAttributes'],function(_0xebe6de){return{'name':_0xebe6de[_0x1aa9('0x32')],'type':_0xebe6de[_0x1aa9('0x33')][_0x1aa9('0x34')]};});_0x25dc54[_0x1aa9('0x35')]=_['map'](_0x2ace32,'name');_0x25dc54[_0x1aa9('0x36')]=_[_0x1aa9('0x37')](_0x5bbd84[_0x1aa9('0x36')]);_0x25dc54['filters']=_[_0x1aa9('0x38')](_0x25dc54[_0x1aa9('0x35')],_0x25dc54[_0x1aa9('0x36')]);_0x4fe470['attributes']=_[_0x1aa9('0x38')](_0x25dc54[_0x1aa9('0x35')],qs['fields'](_0x5bbd84[_0x1aa9('0x36')][_0x1aa9('0x39')]));_0x4fe470['attributes']=_0x4fe470['attributes'][_0x1aa9('0x3a')]?_0x4fe470[_0x1aa9('0x3b')]:_0x25dc54[_0x1aa9('0x35')];if(!_0x5bbd84[_0x1aa9('0x36')][_0x1aa9('0x3c')](_0x1aa9('0x3d'))){_0x4fe470[_0x1aa9('0x21')]=qs['limit'](_0x5bbd84[_0x1aa9('0x36')][_0x1aa9('0x21')]);_0x4fe470[_0x1aa9('0x1f')]=qs[_0x1aa9('0x1f')](_0x5bbd84[_0x1aa9('0x36')]['offset']);}_0x4fe470[_0x1aa9('0x3e')]=qs[_0x1aa9('0x3f')](_0x5bbd84[_0x1aa9('0x36')][_0x1aa9('0x3f')]);_0x4fe470[_0x1aa9('0x40')]=qs[_0x1aa9('0x41')](_[_0x1aa9('0x42')](_0x5bbd84['query'],_0x25dc54[_0x1aa9('0x41')]),_0x2ace32);if(_0x5bbd84[_0x1aa9('0x36')][_0x1aa9('0x43')]){_0x4fe470['where']=_[_0x1aa9('0x44')](_0x4fe470[_0x1aa9('0x40')],{'$or':_[_0x1aa9('0x31')](_0x2ace32,function(_0x2b49e2){if(_0x2b49e2[_0x1aa9('0x33')]!==_0x1aa9('0x45')){var _0xe0502f={};_0xe0502f[_0x2b49e2[_0x1aa9('0x2e')]]={'$like':'%'+_0x5bbd84[_0x1aa9('0x36')][_0x1aa9('0x43')]+'%'};return _0xe0502f;}})});}_0x4fe470=_[_0x1aa9('0x44')]({},_0x4fe470,_0x5bbd84[_0x1aa9('0x46')]);var _0x310464={'where':_0x4fe470[_0x1aa9('0x40')]};return db[_0x1aa9('0x47')]['count'](_0x310464)[_0x1aa9('0x29')](function(_0x26cf24){_0xb1357b[_0x1aa9('0x22')]=_0x26cf24;if(_0x5bbd84[_0x1aa9('0x36')][_0x1aa9('0x48')]){_0x4fe470['include']=[{'all':!![]}];}return db[_0x1aa9('0x47')][_0x1aa9('0x49')](_0x4fe470);})[_0x1aa9('0x29')](function(_0x4fb340){_0xb1357b[_0x1aa9('0x4a')]=_0x4fb340;return _0xb1357b;})[_0x1aa9('0x29')](respondWithFilteredResult(_0x23a3da,_0x4fe470))[_0x1aa9('0x4b')](handleError(_0x23a3da,null));};exports[_0x1aa9('0x4c')]=function(_0x44944d,_0x199f95){var _0x2004b4={'raw':!![],'where':{'id':_0x44944d[_0x1aa9('0x4d')]['id']}},_0xd5b14a={};_0xd5b14a['model']=_[_0x1aa9('0x37')](db[_0x1aa9('0x47')]['rawAttributes']);_0xd5b14a[_0x1aa9('0x36')]=_[_0x1aa9('0x37')](_0x44944d['query']);_0xd5b14a[_0x1aa9('0x41')]=_[_0x1aa9('0x38')](_0xd5b14a['model'],_0xd5b14a['query']);_0x2004b4[_0x1aa9('0x3b')]=_[_0x1aa9('0x38')](_0xd5b14a[_0x1aa9('0x35')],qs[_0x1aa9('0x39')](_0x44944d[_0x1aa9('0x36')][_0x1aa9('0x39')]));_0x2004b4[_0x1aa9('0x3b')]=_0x2004b4[_0x1aa9('0x3b')][_0x1aa9('0x3a')]?_0x2004b4[_0x1aa9('0x3b')]:_0xd5b14a['model'];if(_0x44944d[_0x1aa9('0x36')][_0x1aa9('0x48')]){_0x2004b4[_0x1aa9('0x4e')]=[{'all':!![]}];}_0x2004b4=_['merge']({},_0x2004b4,_0x44944d[_0x1aa9('0x46')]);return db['OpenchannelQueueReport']['find'](_0x2004b4)[_0x1aa9('0x29')](handleEntityNotFound(_0x199f95,null))['then'](respondWithResult(_0x199f95,null))[_0x1aa9('0x4b')](handleError(_0x199f95,null));};exports[_0x1aa9('0x4f')]=function(_0x86e539,_0x1d4139){return db[_0x1aa9('0x47')][_0x1aa9('0x4f')](_0x86e539['body'],{})['then'](respondWithResult(_0x1d4139,0xc9))[_0x1aa9('0x4b')](handleError(_0x1d4139,null));};exports[_0x1aa9('0x28')]=function(_0x55fd01,_0x569217){if(_0x55fd01[_0x1aa9('0x50')]['id']){delete _0x55fd01['body']['id'];}return db[_0x1aa9('0x47')][_0x1aa9('0x51')]({'where':{'id':_0x55fd01[_0x1aa9('0x4d')]['id']}})[_0x1aa9('0x29')](handleEntityNotFound(_0x569217,null))[_0x1aa9('0x29')](saveUpdates(_0x55fd01['body'],null))[_0x1aa9('0x29')](respondWithResult(_0x569217,null))[_0x1aa9('0x4b')](handleError(_0x569217,null));};exports[_0x1aa9('0x2a')]=function(_0x32b0ff,_0x5aa353){return db[_0x1aa9('0x47')]['find']({'where':{'id':_0x32b0ff['params']['id']}})[_0x1aa9('0x29')](handleEntityNotFound(_0x5aa353,null))[_0x1aa9('0x29')](removeEntity(_0x5aa353,null))[_0x1aa9('0x4b')](handleError(_0x5aa353,null));};exports[_0x1aa9('0x52')]=function(_0x3f0f44,_0x375b74){return db[_0x1aa9('0x47')][_0x1aa9('0x52')]()[_0x1aa9('0x29')](respondWithResult(_0x375b74,null))[_0x1aa9('0x4b')](handleError(_0x375b74,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index c5853ba..1a48b3a 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(_0x27c421,_0x179355){var _0xc84af5=function(_0x4a43dc){while(--_0x4a43dc){_0x27c421['push'](_0x27c421['shift']());}};_0xc84af5(++_0x179355);}(_0x326f,0xd1));var _0xf326=function(_0x3dffdd,_0x1532b5){_0x3dffdd=_0x3dffdd-0x0;var _0x12a046=_0x326f[_0x3dffdd];return _0x12a046;};'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 _0x1261=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','define','report_openchannel_queue','uniqueid','util'];(function(_0x53d899,_0x54f22b){var _0x55159c=function(_0x94da16){while(--_0x94da16){_0x53d899['push'](_0x53d899['shift']());}};_0x55159c(++_0x54f22b);}(_0x1261,0x144));var _0x1126=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0x1261[_0x278e3c];return _0x3e2d9b;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var logger=require(_0x1126('0x1'))(_0x1126('0x2'));var moment=require(_0x1126('0x3'));var BPromise=require(_0x1126('0x4'));var rp=require(_0x1126('0x5'));var fs=require('fs');var path=require(_0x1126('0x6'));var rimraf=require(_0x1126('0x7'));var config=require(_0x1126('0x8'));var attributes=require(_0x1126('0x9'));module['exports']=function(_0x5c68c8,_0x40ba58){return _0x5c68c8[_0x1126('0xa')]('OpenchannelQueueReport',attributes,{'tableName':_0x1126('0xb'),'paranoid':![],'indexes':[{'name':_0x1126('0xc'),'fields':[_0x1126('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index eaffb06..a8827be 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 _0xd290=['OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','body','options','raw','UpdateOpenchannelQueueReport','update','where','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','OpenchannelQueueReport,\x20%s,\x20%s','debug'];(function(_0x23d2ff,_0x21c665){var _0x32725f=function(_0x37bccc){while(--_0x37bccc){_0x23d2ff['push'](_0x23d2ff['shift']());}};_0x32725f(++_0x21c665);}(_0xd290,0x165));var _0x0d29=function(_0x4b71cf,_0x1d5e7c){_0x4b71cf=_0x4b71cf-0x0;var _0x1e234b=_0xd290[_0x4b71cf];return _0x1e234b;};'use strict';var _=require(_0x0d29('0x0'));var util=require(_0x0d29('0x1'));var moment=require('moment');var BPromise=require(_0x0d29('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0d29('0x3'))['db'];var utils=require(_0x0d29('0x4'));var logger=require(_0x0d29('0x5'))(_0x0d29('0x6'));var config=require(_0x0d29('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x0d29('0x8')][_0x0d29('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x151d32,_0x376d19,_0x276aeb){return new BPromise(function(_0x4edfcd,_0x3ee63c){return client[_0x0d29('0xa')](_0x151d32,_0x276aeb)[_0x0d29('0xb')](function(_0x4b876e){logger[_0x0d29('0xc')](_0x0d29('0xd'),_0x376d19,'request\x20sent');logger[_0x0d29('0xe')](_0x0d29('0xf'),_0x376d19,'request\x20sent',JSON[_0x0d29('0x10')](_0x4b876e));if(_0x4b876e['error']){if(_0x4b876e[_0x0d29('0x11')][_0x0d29('0x12')]===0x1f4){logger[_0x0d29('0x11')](_0x0d29('0xd'),_0x376d19,_0x4b876e[_0x0d29('0x11')]['message']);return _0x3ee63c(_0x4b876e[_0x0d29('0x11')][_0x0d29('0x13')]);}logger[_0x0d29('0x11')](_0x0d29('0xd'),_0x376d19,_0x4b876e[_0x0d29('0x11')]['message']);return _0x4edfcd(_0x4b876e['error']['message']);}else{logger[_0x0d29('0xc')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x376d19,_0x0d29('0x14'));_0x4edfcd(_0x4b876e['result'][_0x0d29('0x13')]);}})[_0x0d29('0x15')](function(_0x2a04d6){logger[_0x0d29('0x11')](_0x0d29('0xd'),_0x376d19,_0x2a04d6);_0x3ee63c(_0x2a04d6);});});}exports[_0x0d29('0x16')]=function(_0x488fa2){var _0x319a36=this;return new Promise(function(_0x2600b3,_0xca30af){return db[_0x0d29('0x17')][_0x0d29('0x18')](_0x488fa2[_0x0d29('0x19')],{'raw':_0x488fa2[_0x0d29('0x1a')]?_0x488fa2['options'][_0x0d29('0x1b')]===undefined?!![]:![]:!![]})[_0x0d29('0xb')](function(_0x215cd7){logger[_0x0d29('0xc')](_0x0d29('0x16'),_0x488fa2);logger[_0x0d29('0xe')](_0x0d29('0x16'),_0x488fa2,JSON[_0x0d29('0x10')](_0x215cd7));_0x2600b3(_0x215cd7);})[_0x0d29('0x15')](function(_0xed8228){logger[_0x0d29('0x11')](_0x0d29('0x16'),_0xed8228[_0x0d29('0x13')],_0x488fa2);_0xca30af(_0x319a36['error'](0x1f4,_0xed8228[_0x0d29('0x13')]));});});};exports[_0x0d29('0x1c')]=function(_0x2f0fe2){var _0xd3afa0=this;return new Promise(function(_0x4adc85,_0x249205){return db[_0x0d29('0x17')][_0x0d29('0x1d')](_0x2f0fe2[_0x0d29('0x19')],{'raw':_0x2f0fe2[_0x0d29('0x1a')]?_0x2f0fe2[_0x0d29('0x1a')][_0x0d29('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2f0fe2['options']?_0x2f0fe2['options'][_0x0d29('0x1e')]||null:null,'attributes':_0x2f0fe2['options']?_0x2f0fe2[_0x0d29('0x1a')]['attributes']||null:null,'limit':_0x2f0fe2['options']?_0x2f0fe2[_0x0d29('0x1a')]['limit']||null:null})[_0x0d29('0xb')](function(_0x5c197f){logger[_0x0d29('0xc')](_0x0d29('0x1c'),_0x2f0fe2);logger['debug'](_0x0d29('0x1c'),_0x2f0fe2,JSON[_0x0d29('0x10')](_0x5c197f));_0x4adc85(_0x5c197f);})[_0x0d29('0x15')](function(_0x58caa6){logger[_0x0d29('0x11')](_0x0d29('0x1c'),_0x58caa6[_0x0d29('0x13')],_0x2f0fe2);_0x249205(_0xd3afa0[_0x0d29('0x11')](0x1f4,_0x58caa6[_0x0d29('0x13')]));});});}; \ No newline at end of file +var _0xb78e=['rpc','../../config/environment','client','http','then','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','body','options','update','where','limit','UpdateOpenchannelQueueReport','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x883a94,_0x489267){var _0x51ef98=function(_0x2e86a7){while(--_0x2e86a7){_0x883a94['push'](_0x883a94['shift']());}};_0x51ef98(++_0x489267);}(_0xb78e,0x1c9));var _0xeb78=function(_0x4ec03f,_0x42063d){_0x4ec03f=_0x4ec03f-0x0;var _0x399672=_0xb78e[_0x4ec03f];return _0x399672;};'use strict';var _=require(_0xeb78('0x0'));var util=require(_0xeb78('0x1'));var moment=require('moment');var BPromise=require(_0xeb78('0x2'));var rs=require(_0xeb78('0x3'));var fs=require('fs');var Redis=require(_0xeb78('0x4'));var db=require(_0xeb78('0x5'))['db'];var utils=require(_0xeb78('0x6'));var logger=require(_0xeb78('0x7'))(_0xeb78('0x8'));var config=require(_0xeb78('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xeb78('0xa')][_0xeb78('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1ccc2f,_0x30c884,_0x2b7925){return new BPromise(function(_0x36963f,_0x5259aa){return client['request'](_0x1ccc2f,_0x2b7925)[_0xeb78('0xc')](function(_0x1c941d){logger[_0xeb78('0xd')](_0xeb78('0xe'),_0x30c884,_0xeb78('0xf'));logger[_0xeb78('0x10')](_0xeb78('0x11'),_0x30c884,_0xeb78('0xf'),JSON[_0xeb78('0x12')](_0x1c941d));if(_0x1c941d['error']){if(_0x1c941d[_0xeb78('0x13')][_0xeb78('0x14')]===0x1f4){logger[_0xeb78('0x13')](_0xeb78('0xe'),_0x30c884,_0x1c941d[_0xeb78('0x13')][_0xeb78('0x15')]);return _0x5259aa(_0x1c941d[_0xeb78('0x13')][_0xeb78('0x15')]);}logger[_0xeb78('0x13')](_0xeb78('0xe'),_0x30c884,_0x1c941d['error'][_0xeb78('0x15')]);return _0x36963f(_0x1c941d[_0xeb78('0x13')]['message']);}else{logger['info']('OpenchannelQueueReport,\x20%s,\x20%s',_0x30c884,_0xeb78('0xf'));_0x36963f(_0x1c941d['result'][_0xeb78('0x15')]);}})[_0xeb78('0x16')](function(_0x49123d){logger[_0xeb78('0x13')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x30c884,_0x49123d);_0x5259aa(_0x49123d);});});}exports[_0xeb78('0x17')]=function(_0x92e410){var _0x576802=this;return new Promise(function(_0x45176e,_0xb97756){return db[_0xeb78('0x18')]['create'](_0x92e410[_0xeb78('0x19')],{'raw':_0x92e410[_0xeb78('0x1a')]?_0x92e410['options']['raw']===undefined?!![]:![]:!![]})[_0xeb78('0xc')](function(_0x106c5d){logger[_0xeb78('0xd')](_0xeb78('0x17'),_0x92e410);logger[_0xeb78('0x10')](_0xeb78('0x17'),_0x92e410,JSON[_0xeb78('0x12')](_0x106c5d));_0x45176e(_0x106c5d);})[_0xeb78('0x16')](function(_0x18f08d){logger['error']('CreateOpenchannelQueueReport',_0x18f08d['message'],_0x92e410);_0xb97756(_0x576802['error'](0x1f4,_0x18f08d[_0xeb78('0x15')]));});});};exports['UpdateOpenchannelQueueReport']=function(_0x2159c1){var _0x1fbf2f=this;return new Promise(function(_0x566336,_0x777ca3){return db['OpenchannelQueueReport'][_0xeb78('0x1b')](_0x2159c1[_0xeb78('0x19')],{'raw':_0x2159c1[_0xeb78('0x1a')]?_0x2159c1[_0xeb78('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2159c1[_0xeb78('0x1a')]?_0x2159c1['options'][_0xeb78('0x1c')]||null:null,'attributes':_0x2159c1[_0xeb78('0x1a')]?_0x2159c1[_0xeb78('0x1a')]['attributes']||null:null,'limit':_0x2159c1[_0xeb78('0x1a')]?_0x2159c1[_0xeb78('0x1a')][_0xeb78('0x1d')]||null:null})[_0xeb78('0xc')](function(_0x3d4a97){logger[_0xeb78('0xd')](_0xeb78('0x1e'),_0x2159c1);logger[_0xeb78('0x10')](_0xeb78('0x1e'),_0x2159c1,JSON[_0xeb78('0x12')](_0x3d4a97));_0x566336(_0x3d4a97);})[_0xeb78('0x16')](function(_0x505468){logger['error']('UpdateOpenchannelQueueReport',_0x505468[_0xeb78('0x15')],_0x2159c1);_0x777ca3(_0x1fbf2f[_0xeb78('0x13')](0x1f4,_0x505468[_0xeb78('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index a049db3..26d43e4 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 _0x29f9=['delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./openchannelTransferReport.controller','isAuthenticated','get','/:id','show','post','update'];(function(_0x4e518d,_0x32a45d){var _0x458ff2=function(_0xc96c49){while(--_0xc96c49){_0x4e518d['push'](_0x4e518d['shift']());}};_0x458ff2(++_0x32a45d);}(_0x29f9,0x1c5));var _0x929f=function(_0x44cc07,_0x4ae8f7){_0x44cc07=_0x44cc07-0x0;var _0x59acb4=_0x29f9[_0x44cc07];return _0x59acb4;};'use strict';var multer=require(_0x929f('0x0'));var util=require('util');var path=require(_0x929f('0x1'));var timeout=require(_0x929f('0x2'));var express=require(_0x929f('0x3'));var router=express[_0x929f('0x4')]();var fs_extra=require(_0x929f('0x5'));var auth=require(_0x929f('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x929f('0x7'));var controller=require(_0x929f('0x8'));router['get']('/',auth[_0x929f('0x9')](),controller['index']);router[_0x929f('0xa')]('/describe',auth[_0x929f('0x9')](),controller['describe']);router[_0x929f('0xa')](_0x929f('0xb'),auth['isAuthenticated'](),controller[_0x929f('0xc')]);router[_0x929f('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put']('/:id',auth[_0x929f('0x9')](),controller[_0x929f('0xe')]);router[_0x929f('0xf')](_0x929f('0xb'),auth[_0x929f('0x9')](),controller[_0x929f('0x10')]);module[_0x929f('0x11')]=router; \ No newline at end of file +var _0x2e8d=['describe','/:id','show','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','./openchannelTransferReport.controller','isAuthenticated','index','get','/describe'];(function(_0xa7d0,_0x17e205){var _0x451584=function(_0x4d95e5){while(--_0x4d95e5){_0xa7d0['push'](_0xa7d0['shift']());}};_0x451584(++_0x17e205);}(_0x2e8d,0xf0));var _0xd2e8=function(_0x992fd0,_0x53feeb){_0x992fd0=_0x992fd0-0x0;var _0x5a4785=_0x2e8d[_0x992fd0];return _0x5a4785;};'use strict';var multer=require(_0xd2e8('0x0'));var util=require(_0xd2e8('0x1'));var path=require(_0xd2e8('0x2'));var timeout=require(_0xd2e8('0x3'));var express=require(_0xd2e8('0x4'));var router=express['Router']();var fs_extra=require(_0xd2e8('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xd2e8('0x6'));var config=require('../../config/environment');var controller=require(_0xd2e8('0x7'));router['get']('/',auth[_0xd2e8('0x8')](),controller[_0xd2e8('0x9')]);router[_0xd2e8('0xa')](_0xd2e8('0xb'),auth[_0xd2e8('0x8')](),controller[_0xd2e8('0xc')]);router[_0xd2e8('0xa')](_0xd2e8('0xd'),auth[_0xd2e8('0x8')](),controller[_0xd2e8('0xe')]);router['post']('/',auth[_0xd2e8('0x8')](),controller[_0xd2e8('0xf')]);router[_0xd2e8('0x10')](_0xd2e8('0xd'),auth[_0xd2e8('0x8')](),controller[_0xd2e8('0x11')]);router[_0xd2e8('0x12')](_0xd2e8('0xd'),auth[_0xd2e8('0x8')](),controller[_0xd2e8('0x13')]);module[_0xd2e8('0x14')]=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index 84efd04..aec0c12 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 _0x34e8=['queue','DATE','NOW','moment','sequelize','exports','STRING','account','agent'];(function(_0x9ac89b,_0x25b61d){var _0x40da74=function(_0x2643a2){while(--_0x2643a2){_0x9ac89b['push'](_0x9ac89b['shift']());}};_0x40da74(++_0x25b61d);}(_0x34e8,0x12c));var _0x834e=function(_0x339bf2,_0x311442){_0x339bf2=_0x339bf2-0x0;var _0x1d3768=_0x34e8[_0x339bf2];return _0x1d3768;};'use strict';var moment=require(_0x834e('0x0'));var Sequelize=require(_0x834e('0x1'));module[_0x834e('0x2')]={'uniqueid':{'type':Sequelize[_0x834e('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x834e('0x4'),_0x834e('0x5'),_0x834e('0x6')),'allowNull':![],'defaultValue':_0x834e('0x6')},'transferredAt':{'type':Sequelize[_0x834e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x834e('0x8')]}}; \ No newline at end of file +var _0x34e8=['queue','DATE','NOW','moment','sequelize','exports','STRING','account','agent'];(function(_0x2b2c2f,_0x645409){var _0x2984ea=function(_0x4c84f0){while(--_0x4c84f0){_0x2b2c2f['push'](_0x2b2c2f['shift']());}};_0x2984ea(++_0x645409);}(_0x34e8,0x12c));var _0x834e=function(_0x4a0c7f,_0x11c365){_0x4a0c7f=_0x4a0c7f-0x0;var _0x194906=_0x34e8[_0x4a0c7f];return _0x194906;};'use strict';var moment=require(_0x834e('0x0'));var Sequelize=require(_0x834e('0x1'));module[_0x834e('0x2')]={'uniqueid':{'type':Sequelize[_0x834e('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x834e('0x4'),_0x834e('0x5'),_0x834e('0x6')),'allowNull':![],'defaultValue':_0x834e('0x6')},'transferredAt':{'type':Sequelize[_0x834e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x834e('0x8')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index 280fa24..d960404 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 _0xfe95=['../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','OpenchannelTransferReport','includeAll','include','findAll','rows','catch','params','length','options','create','body','find','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x4e9d3c,_0x1f4b98){var _0x2d0825=function(_0x384676){while(--_0x384676){_0x4e9d3c['push'](_0x4e9d3c['shift']());}};_0x2d0825(++_0x1f4b98);}(_0xfe95,0xd5));var _0x5fe9=function(_0x3af2ff,_0x39ab4d){_0x3af2ff=_0x3af2ff-0x0;var _0x5657cb=_0xfe95[_0x3af2ff];return _0x5657cb;};'use strict';var emlformat=require(_0x5fe9('0x0'));var rimraf=require(_0x5fe9('0x1'));var zipdir=require(_0x5fe9('0x2'));var jsonpatch=require(_0x5fe9('0x3'));var rp=require(_0x5fe9('0x4'));var moment=require(_0x5fe9('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x5fe9('0x6'));var path=require(_0x5fe9('0x7'));var sox=require(_0x5fe9('0x8'));var csv=require(_0x5fe9('0x9'));var ejs=require(_0x5fe9('0xa'));var fs=require('fs');var fs_extra=require(_0x5fe9('0xb'));var _=require(_0x5fe9('0xc'));var squel=require(_0x5fe9('0xd'));var crypto=require('crypto');var jsforce=require(_0x5fe9('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x5fe9('0xf'));var Papa=require('papaparse');var Redis=require(_0x5fe9('0x10'));var authService=require(_0x5fe9('0x11'));var qs=require(_0x5fe9('0x12'));var as=require(_0x5fe9('0x13'));var hardwareService=require(_0x5fe9('0x14'));var logger=require(_0x5fe9('0x15'))(_0x5fe9('0x16'));var utils=require(_0x5fe9('0x17'));var config=require(_0x5fe9('0x18'));var licenseUtil=require(_0x5fe9('0x19'));var db=require(_0x5fe9('0x1a'))['db'];function respondWithStatusCode(_0x5dbc2d,_0x3b1e70){_0x3b1e70=_0x3b1e70||0xcc;return function(_0x36e766){if(_0x36e766){return _0x5dbc2d[_0x5fe9('0x1b')](_0x3b1e70);}return _0x5dbc2d[_0x5fe9('0x1c')](_0x3b1e70)[_0x5fe9('0x1d')]();};}function respondWithResult(_0x13128b,_0x5d40d4){_0x5d40d4=_0x5d40d4||0xc8;return function(_0x1481a6){if(_0x1481a6){return _0x13128b[_0x5fe9('0x1c')](_0x5d40d4)[_0x5fe9('0x1e')](_0x1481a6);}};}function respondWithFilteredResult(_0x1ddb1e,_0x26fea8){return function(_0x170c58){if(_0x170c58){var _0x529457=typeof _0x26fea8['offset']===_0x5fe9('0x1f')&&typeof _0x26fea8[_0x5fe9('0x20')]===_0x5fe9('0x1f');var _0x54eecf=_0x170c58[_0x5fe9('0x21')];var _0x16cb61=_0x529457?0x0:_0x26fea8['offset'];var _0x4bdb60=_0x529457?_0x170c58[_0x5fe9('0x21')]:_0x26fea8[_0x5fe9('0x22')]+_0x26fea8[_0x5fe9('0x20')];var _0x11e7cf;if(_0x4bdb60>=_0x54eecf){_0x4bdb60=_0x54eecf;_0x11e7cf=0xc8;}else{_0x11e7cf=0xce;}_0x1ddb1e[_0x5fe9('0x1c')](_0x11e7cf);return _0x1ddb1e[_0x5fe9('0x23')](_0x5fe9('0x24'),_0x16cb61+'-'+_0x4bdb60+'/'+_0x54eecf)['json'](_0x170c58);}return null;};}function patchUpdates(_0x542272){return function(_0x15ba89){try{jsonpatch[_0x5fe9('0x25')](_0x15ba89,_0x542272,!![]);}catch(_0x527e3e){return BPromise[_0x5fe9('0x26')](_0x527e3e);}return _0x15ba89[_0x5fe9('0x27')]();};}function saveUpdates(_0x5233b0,_0x1f9cde){return function(_0x129746){if(_0x129746){return _0x129746[_0x5fe9('0x28')](_0x5233b0)[_0x5fe9('0x29')](function(_0xb1fb3){return _0xb1fb3;});}return null;};}function removeEntity(_0x1eef25,_0x3b71c1){return function(_0x44f09e){if(_0x44f09e){return _0x44f09e[_0x5fe9('0x2a')]()[_0x5fe9('0x29')](function(){_0x1eef25[_0x5fe9('0x1c')](0xcc)[_0x5fe9('0x1d')]();});}};}function handleEntityNotFound(_0x313a96,_0xb1cbbf){return function(_0x6de5eb){if(!_0x6de5eb){_0x313a96[_0x5fe9('0x1b')](0x194);}return _0x6de5eb;};}function handleError(_0x54b831,_0x55e4b3){_0x55e4b3=_0x55e4b3||0x1f4;return function(_0x1b8b19){logger[_0x5fe9('0x2b')](_0x1b8b19['stack']);if(_0x1b8b19[_0x5fe9('0x2c')]){delete _0x1b8b19[_0x5fe9('0x2c')];}_0x54b831[_0x5fe9('0x1c')](_0x55e4b3)[_0x5fe9('0x2d')](_0x1b8b19);};}exports[_0x5fe9('0x2e')]=function(_0x4cb4ca,_0x243032){var _0x5f20b3={},_0x30f9d5={},_0x13e437={'count':0x0,'rows':[]};var _0x3817ef=_[_0x5fe9('0x2f')](db['OpenchannelTransferReport'][_0x5fe9('0x30')],function(_0x337574){return{'name':_0x337574['fieldName'],'type':_0x337574[_0x5fe9('0x31')][_0x5fe9('0x32')]};});_0x30f9d5[_0x5fe9('0x33')]=_[_0x5fe9('0x2f')](_0x3817ef,'name');_0x30f9d5[_0x5fe9('0x34')]=_[_0x5fe9('0x35')](_0x4cb4ca['query']);_0x30f9d5[_0x5fe9('0x36')]=_[_0x5fe9('0x37')](_0x30f9d5[_0x5fe9('0x33')],_0x30f9d5['query']);_0x5f20b3[_0x5fe9('0x38')]=_[_0x5fe9('0x37')](_0x30f9d5['model'],qs[_0x5fe9('0x39')](_0x4cb4ca[_0x5fe9('0x34')][_0x5fe9('0x39')]));_0x5f20b3['attributes']=_0x5f20b3[_0x5fe9('0x38')]['length']?_0x5f20b3['attributes']:_0x30f9d5[_0x5fe9('0x33')];if(!_0x4cb4ca[_0x5fe9('0x34')][_0x5fe9('0x3a')](_0x5fe9('0x3b'))){_0x5f20b3[_0x5fe9('0x20')]=qs[_0x5fe9('0x20')](_0x4cb4ca['query'][_0x5fe9('0x20')]);_0x5f20b3[_0x5fe9('0x22')]=qs[_0x5fe9('0x22')](_0x4cb4ca[_0x5fe9('0x34')][_0x5fe9('0x22')]);}_0x5f20b3[_0x5fe9('0x3c')]=qs['sort'](_0x4cb4ca[_0x5fe9('0x34')][_0x5fe9('0x3d')]);_0x5f20b3[_0x5fe9('0x3e')]=qs[_0x5fe9('0x36')](_['pick'](_0x4cb4ca[_0x5fe9('0x34')],_0x30f9d5[_0x5fe9('0x36')]),_0x3817ef);if(_0x4cb4ca['query'][_0x5fe9('0x3f')]){_0x5f20b3[_0x5fe9('0x3e')]=_[_0x5fe9('0x40')](_0x5f20b3[_0x5fe9('0x3e')],{'$or':_['map'](_0x3817ef,function(_0x1d924b){if(_0x1d924b[_0x5fe9('0x31')]!=='VIRTUAL'){var _0x4bf80b={};_0x4bf80b[_0x1d924b[_0x5fe9('0x2c')]]={'$like':'%'+_0x4cb4ca['query'][_0x5fe9('0x3f')]+'%'};return _0x4bf80b;}})});}_0x5f20b3=_['merge']({},_0x5f20b3,_0x4cb4ca['options']);var _0x24bfe7={'where':_0x5f20b3[_0x5fe9('0x3e')]};return db[_0x5fe9('0x41')][_0x5fe9('0x21')](_0x24bfe7)[_0x5fe9('0x29')](function(_0x32185e){_0x13e437['count']=_0x32185e;if(_0x4cb4ca['query'][_0x5fe9('0x42')]){_0x5f20b3[_0x5fe9('0x43')]=[{'all':!![]}];}return db[_0x5fe9('0x41')][_0x5fe9('0x44')](_0x5f20b3);})[_0x5fe9('0x29')](function(_0x2f0028){_0x13e437[_0x5fe9('0x45')]=_0x2f0028;return _0x13e437;})[_0x5fe9('0x29')](respondWithFilteredResult(_0x243032,_0x5f20b3))[_0x5fe9('0x46')](handleError(_0x243032,null));};exports['show']=function(_0x457570,_0x8d264){var _0x457b5f={'raw':!![],'where':{'id':_0x457570[_0x5fe9('0x47')]['id']}},_0x792f46={};_0x792f46[_0x5fe9('0x33')]=_[_0x5fe9('0x35')](db[_0x5fe9('0x41')]['rawAttributes']);_0x792f46['query']=_[_0x5fe9('0x35')](_0x457570['query']);_0x792f46[_0x5fe9('0x36')]=_[_0x5fe9('0x37')](_0x792f46[_0x5fe9('0x33')],_0x792f46['query']);_0x457b5f[_0x5fe9('0x38')]=_['intersection'](_0x792f46[_0x5fe9('0x33')],qs['fields'](_0x457570['query'][_0x5fe9('0x39')]));_0x457b5f['attributes']=_0x457b5f[_0x5fe9('0x38')][_0x5fe9('0x48')]?_0x457b5f['attributes']:_0x792f46['model'];if(_0x457570[_0x5fe9('0x34')][_0x5fe9('0x42')]){_0x457b5f[_0x5fe9('0x43')]=[{'all':!![]}];}_0x457b5f=_[_0x5fe9('0x40')]({},_0x457b5f,_0x457570[_0x5fe9('0x49')]);return db['OpenchannelTransferReport']['find'](_0x457b5f)[_0x5fe9('0x29')](handleEntityNotFound(_0x8d264,null))[_0x5fe9('0x29')](respondWithResult(_0x8d264,null))['catch'](handleError(_0x8d264,null));};exports[_0x5fe9('0x4a')]=function(_0x4633ee,_0x185063){return db[_0x5fe9('0x41')][_0x5fe9('0x4a')](_0x4633ee[_0x5fe9('0x4b')],{})[_0x5fe9('0x29')](respondWithResult(_0x185063,0xc9))[_0x5fe9('0x46')](handleError(_0x185063,null));};exports['update']=function(_0x2a6958,_0x1c6eb2){if(_0x2a6958[_0x5fe9('0x4b')]['id']){delete _0x2a6958[_0x5fe9('0x4b')]['id'];}return db['OpenchannelTransferReport'][_0x5fe9('0x4c')]({'where':{'id':_0x2a6958[_0x5fe9('0x47')]['id']}})[_0x5fe9('0x29')](handleEntityNotFound(_0x1c6eb2,null))[_0x5fe9('0x29')](saveUpdates(_0x2a6958['body'],null))['then'](respondWithResult(_0x1c6eb2,null))[_0x5fe9('0x46')](handleError(_0x1c6eb2,null));};exports[_0x5fe9('0x2a')]=function(_0x4a1fbb,_0x13f474){return db[_0x5fe9('0x41')][_0x5fe9('0x4c')]({'where':{'id':_0x4a1fbb[_0x5fe9('0x47')]['id']}})['then'](handleEntityNotFound(_0x13f474,null))[_0x5fe9('0x29')](removeEntity(_0x13f474,null))['catch'](handleError(_0x13f474,null));};exports[_0x5fe9('0x4d')]=function(_0x19df59,_0x4c62cf){return db['OpenchannelTransferReport'][_0x5fe9('0x4d')]()['then'](respondWithResult(_0x4c62cf,null))[_0x5fe9('0x46')](handleError(_0x4c62cf,null));}; \ No newline at end of file +var _0xedcc=['index','map','OpenchannelTransferReport','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','options','includeAll','findAll','rows','show','params','rawAttributes','include','merge','find','catch','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','sendStatus','error','name','send'];(function(_0x4848cd,_0x3d9895){var _0x261a1d=function(_0xc825c0){while(--_0xc825c0){_0x4848cd['push'](_0x4848cd['shift']());}};_0x261a1d(++_0x3d9895);}(_0xedcc,0x100));var _0xcedc=function(_0x19f03c,_0x2e1052){_0x19f03c=_0x19f03c-0x0;var _0x9edf98=_0xedcc[_0x19f03c];return _0x9edf98;};'use strict';var emlformat=require(_0xcedc('0x0'));var rimraf=require(_0xcedc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xcedc('0x2'));var rp=require(_0xcedc('0x3'));var moment=require(_0xcedc('0x4'));var BPromise=require(_0xcedc('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xcedc('0x6'));var sox=require(_0xcedc('0x7'));var csv=require(_0xcedc('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcedc('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xcedc('0xa'));var deskjs=require(_0xcedc('0xb'));var toCsv=require(_0xcedc('0x8'));var querystring=require(_0xcedc('0xc'));var Papa=require('papaparse');var Redis=require(_0xcedc('0xd'));var authService=require(_0xcedc('0xe'));var qs=require(_0xcedc('0xf'));var as=require(_0xcedc('0x10'));var hardwareService=require(_0xcedc('0x11'));var logger=require(_0xcedc('0x12'))('api');var utils=require(_0xcedc('0x13'));var config=require(_0xcedc('0x14'));var licenseUtil=require(_0xcedc('0x15'));var db=require(_0xcedc('0x16'))['db'];function respondWithStatusCode(_0x1b8757,_0x225536){_0x225536=_0x225536||0xcc;return function(_0x96373f){if(_0x96373f){return _0x1b8757['sendStatus'](_0x225536);}return _0x1b8757[_0xcedc('0x17')](_0x225536)[_0xcedc('0x18')]();};}function respondWithResult(_0x56eed8,_0x276771){_0x276771=_0x276771||0xc8;return function(_0x6c7d92){if(_0x6c7d92){return _0x56eed8[_0xcedc('0x17')](_0x276771)[_0xcedc('0x19')](_0x6c7d92);}};}function respondWithFilteredResult(_0x1b82d6,_0x35e2d2){return function(_0x23831e){if(_0x23831e){var _0x103960=typeof _0x35e2d2[_0xcedc('0x1a')]===_0xcedc('0x1b')&&typeof _0x35e2d2[_0xcedc('0x1c')]==='undefined';var _0xb2041d=_0x23831e[_0xcedc('0x1d')];var _0x21f26d=_0x103960?0x0:_0x35e2d2[_0xcedc('0x1a')];var _0x3f325a=_0x103960?_0x23831e['count']:_0x35e2d2[_0xcedc('0x1a')]+_0x35e2d2[_0xcedc('0x1c')];var _0x10edd5;if(_0x3f325a>=_0xb2041d){_0x3f325a=_0xb2041d;_0x10edd5=0xc8;}else{_0x10edd5=0xce;}_0x1b82d6[_0xcedc('0x17')](_0x10edd5);return _0x1b82d6['set'](_0xcedc('0x1e'),_0x21f26d+'-'+_0x3f325a+'/'+_0xb2041d)[_0xcedc('0x19')](_0x23831e);}return null;};}function patchUpdates(_0x36775b){return function(_0x4df35d){try{jsonpatch[_0xcedc('0x1f')](_0x4df35d,_0x36775b,!![]);}catch(_0x26230f){return BPromise[_0xcedc('0x20')](_0x26230f);}return _0x4df35d[_0xcedc('0x21')]();};}function saveUpdates(_0x1051dc,_0x747edf){return function(_0x2952e4){if(_0x2952e4){return _0x2952e4[_0xcedc('0x22')](_0x1051dc)['then'](function(_0x2e3b98){return _0x2e3b98;});}return null;};}function removeEntity(_0x37e2a4,_0x4da126){return function(_0x2792d5){if(_0x2792d5){return _0x2792d5['destroy']()[_0xcedc('0x23')](function(){_0x37e2a4['status'](0xcc)[_0xcedc('0x18')]();});}};}function handleEntityNotFound(_0x233d0c,_0x213980){return function(_0xd7a132){if(!_0xd7a132){_0x233d0c[_0xcedc('0x24')](0x194);}return _0xd7a132;};}function handleError(_0x2cdd87,_0x4c8efb){_0x4c8efb=_0x4c8efb||0x1f4;return function(_0xba60a7){logger[_0xcedc('0x25')](_0xba60a7['stack']);if(_0xba60a7[_0xcedc('0x26')]){delete _0xba60a7[_0xcedc('0x26')];}_0x2cdd87[_0xcedc('0x17')](_0x4c8efb)[_0xcedc('0x27')](_0xba60a7);};}exports[_0xcedc('0x28')]=function(_0x509f90,_0x576aae){var _0x2e81cf={},_0x2bedbb={},_0x1693e5={'count':0x0,'rows':[]};var _0x2812ac=_[_0xcedc('0x29')](db[_0xcedc('0x2a')]['rawAttributes'],function(_0x5d7379){return{'name':_0x5d7379[_0xcedc('0x2b')],'type':_0x5d7379[_0xcedc('0x2c')][_0xcedc('0x2d')]};});_0x2bedbb['model']=_['map'](_0x2812ac,_0xcedc('0x26'));_0x2bedbb[_0xcedc('0x2e')]=_[_0xcedc('0x2f')](_0x509f90['query']);_0x2bedbb[_0xcedc('0x30')]=_[_0xcedc('0x31')](_0x2bedbb['model'],_0x2bedbb[_0xcedc('0x2e')]);_0x2e81cf[_0xcedc('0x32')]=_[_0xcedc('0x31')](_0x2bedbb[_0xcedc('0x33')],qs[_0xcedc('0x34')](_0x509f90[_0xcedc('0x2e')][_0xcedc('0x34')]));_0x2e81cf[_0xcedc('0x32')]=_0x2e81cf['attributes'][_0xcedc('0x35')]?_0x2e81cf[_0xcedc('0x32')]:_0x2bedbb[_0xcedc('0x33')];if(!_0x509f90[_0xcedc('0x2e')][_0xcedc('0x36')](_0xcedc('0x37'))){_0x2e81cf[_0xcedc('0x1c')]=qs[_0xcedc('0x1c')](_0x509f90[_0xcedc('0x2e')][_0xcedc('0x1c')]);_0x2e81cf[_0xcedc('0x1a')]=qs[_0xcedc('0x1a')](_0x509f90['query'][_0xcedc('0x1a')]);}_0x2e81cf[_0xcedc('0x38')]=qs[_0xcedc('0x39')](_0x509f90[_0xcedc('0x2e')][_0xcedc('0x39')]);_0x2e81cf[_0xcedc('0x3a')]=qs[_0xcedc('0x30')](_[_0xcedc('0x3b')](_0x509f90[_0xcedc('0x2e')],_0x2bedbb['filters']),_0x2812ac);if(_0x509f90[_0xcedc('0x2e')][_0xcedc('0x3c')]){_0x2e81cf['where']=_['merge'](_0x2e81cf[_0xcedc('0x3a')],{'$or':_[_0xcedc('0x29')](_0x2812ac,function(_0x34adb5){if(_0x34adb5[_0xcedc('0x2c')]!=='VIRTUAL'){var _0xdf4e09={};_0xdf4e09[_0x34adb5['name']]={'$like':'%'+_0x509f90[_0xcedc('0x2e')][_0xcedc('0x3c')]+'%'};return _0xdf4e09;}})});}_0x2e81cf=_['merge']({},_0x2e81cf,_0x509f90[_0xcedc('0x3d')]);var _0x5e07ae={'where':_0x2e81cf[_0xcedc('0x3a')]};return db['OpenchannelTransferReport'][_0xcedc('0x1d')](_0x5e07ae)[_0xcedc('0x23')](function(_0x1a6e36){_0x1693e5[_0xcedc('0x1d')]=_0x1a6e36;if(_0x509f90[_0xcedc('0x2e')][_0xcedc('0x3e')]){_0x2e81cf['include']=[{'all':!![]}];}return db[_0xcedc('0x2a')][_0xcedc('0x3f')](_0x2e81cf);})[_0xcedc('0x23')](function(_0xc73699){_0x1693e5[_0xcedc('0x40')]=_0xc73699;return _0x1693e5;})[_0xcedc('0x23')](respondWithFilteredResult(_0x576aae,_0x2e81cf))['catch'](handleError(_0x576aae,null));};exports[_0xcedc('0x41')]=function(_0x107abb,_0x2f683e){var _0x56752d={'raw':!![],'where':{'id':_0x107abb[_0xcedc('0x42')]['id']}},_0x517715={};_0x517715['model']=_[_0xcedc('0x2f')](db[_0xcedc('0x2a')][_0xcedc('0x43')]);_0x517715[_0xcedc('0x2e')]=_[_0xcedc('0x2f')](_0x107abb[_0xcedc('0x2e')]);_0x517715[_0xcedc('0x30')]=_[_0xcedc('0x31')](_0x517715[_0xcedc('0x33')],_0x517715[_0xcedc('0x2e')]);_0x56752d['attributes']=_[_0xcedc('0x31')](_0x517715[_0xcedc('0x33')],qs['fields'](_0x107abb[_0xcedc('0x2e')]['fields']));_0x56752d['attributes']=_0x56752d[_0xcedc('0x32')][_0xcedc('0x35')]?_0x56752d['attributes']:_0x517715[_0xcedc('0x33')];if(_0x107abb[_0xcedc('0x2e')][_0xcedc('0x3e')]){_0x56752d[_0xcedc('0x44')]=[{'all':!![]}];}_0x56752d=_[_0xcedc('0x45')]({},_0x56752d,_0x107abb[_0xcedc('0x3d')]);return db[_0xcedc('0x2a')][_0xcedc('0x46')](_0x56752d)['then'](handleEntityNotFound(_0x2f683e,null))[_0xcedc('0x23')](respondWithResult(_0x2f683e,null))[_0xcedc('0x47')](handleError(_0x2f683e,null));};exports[_0xcedc('0x48')]=function(_0x5b5ffe,_0x59bbda){return db['OpenchannelTransferReport'][_0xcedc('0x48')](_0x5b5ffe[_0xcedc('0x49')],{})[_0xcedc('0x23')](respondWithResult(_0x59bbda,0xc9))[_0xcedc('0x47')](handleError(_0x59bbda,null));};exports[_0xcedc('0x22')]=function(_0x581a10,_0x54c1e9){if(_0x581a10[_0xcedc('0x49')]['id']){delete _0x581a10['body']['id'];}return db[_0xcedc('0x2a')][_0xcedc('0x46')]({'where':{'id':_0x581a10[_0xcedc('0x42')]['id']}})[_0xcedc('0x23')](handleEntityNotFound(_0x54c1e9,null))[_0xcedc('0x23')](saveUpdates(_0x581a10[_0xcedc('0x49')],null))['then'](respondWithResult(_0x54c1e9,null))['catch'](handleError(_0x54c1e9,null));};exports['destroy']=function(_0x2882d2,_0x96528e){return db[_0xcedc('0x2a')][_0xcedc('0x46')]({'where':{'id':_0x2882d2[_0xcedc('0x42')]['id']}})[_0xcedc('0x23')](handleEntityNotFound(_0x96528e,null))[_0xcedc('0x23')](removeEntity(_0x96528e,null))[_0xcedc('0x47')](handleError(_0x96528e,null));};exports['describe']=function(_0x49079f,_0x263951){return db[_0xcedc('0x2a')]['describe']()[_0xcedc('0x23')](respondWithResult(_0x263951,null))[_0xcedc('0x47')](handleError(_0x263951,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index f48fdb8..7d72297 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 _0x9593=['util','api','moment','bluebird','request-promise','path','../../config/environment','./openchannelTransferReport.attributes','exports','define','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash'];(function(_0x19c037,_0x3269b3){var _0x2dc6b8=function(_0x3f43a7){while(--_0x3f43a7){_0x19c037['push'](_0x19c037['shift']());}};_0x2dc6b8(++_0x3269b3);}(_0x9593,0x1db));var _0x3959=function(_0x571c1d,_0x3b0586){_0x571c1d=_0x571c1d-0x0;var _0x33c609=_0x9593[_0x571c1d];return _0x33c609;};'use strict';var _=require(_0x3959('0x0'));var util=require(_0x3959('0x1'));var logger=require('../../config/logger')(_0x3959('0x2'));var moment=require(_0x3959('0x3'));var BPromise=require(_0x3959('0x4'));var rp=require(_0x3959('0x5'));var fs=require('fs');var path=require(_0x3959('0x6'));var rimraf=require('rimraf');var config=require(_0x3959('0x7'));var attributes=require(_0x3959('0x8'));module[_0x3959('0x9')]=function(_0x2af95d,_0x15823d){return _0x2af95d[_0x3959('0xa')](_0x3959('0xb'),attributes,{'tableName':_0x3959('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x3959('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7ff0=['moment','bluebird','path','../../config/environment','./openchannelTransferReport.attributes','exports','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash','util','../../config/logger','api'];(function(_0x11b072,_0x358877){var _0x3fe03f=function(_0x3bbe1c){while(--_0x3bbe1c){_0x11b072['push'](_0x11b072['shift']());}};_0x3fe03f(++_0x358877);}(_0x7ff0,0x182));var _0x07ff=function(_0x44946b,_0xf874ec){_0x44946b=_0x44946b-0x0;var _0x249bc4=_0x7ff0[_0x44946b];return _0x249bc4;};'use strict';var _=require(_0x07ff('0x0'));var util=require(_0x07ff('0x1'));var logger=require(_0x07ff('0x2'))(_0x07ff('0x3'));var moment=require(_0x07ff('0x4'));var BPromise=require(_0x07ff('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x07ff('0x6'));var rimraf=require('rimraf');var config=require(_0x07ff('0x7'));var attributes=require(_0x07ff('0x8'));module[_0x07ff('0x9')]=function(_0x34c4d0,_0x356758){return _0x34c4d0['define'](_0x07ff('0xa'),attributes,{'tableName':_0x07ff('0xb'),'paranoid':![],'indexes':[{'name':_0x07ff('0xc'),'fields':[_0x07ff('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 e4562e3..85d2994 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 _0xa990=['../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','OpenchannelTransferReport,\x20%s,\x20%s','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x486f4a,_0x478dc7){var _0x135d99=function(_0x434008){while(--_0x434008){_0x486f4a['push'](_0x486f4a['shift']());}};_0x135d99(++_0x478dc7);}(_0xa990,0xc9));var _0x0a99=function(_0x12a910,_0x50d299){_0x12a910=_0x12a910-0x0;var _0x490af7=_0xa990[_0x12a910];return _0x490af7;};'use strict';var _=require(_0x0a99('0x0'));var util=require(_0x0a99('0x1'));var moment=require(_0x0a99('0x2'));var BPromise=require(_0x0a99('0x3'));var rs=require(_0x0a99('0x4'));var fs=require('fs');var Redis=require(_0x0a99('0x5'));var db=require(_0x0a99('0x6'))['db'];var utils=require(_0x0a99('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x0a99('0x8'));var jayson=require(_0x0a99('0x9'));var client=jayson[_0x0a99('0xa')][_0x0a99('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x45b195,_0x398d95,_0xc6001b){return new BPromise(function(_0x599c7,_0x3cf0ef){return client[_0x0a99('0xc')](_0x45b195,_0xc6001b)[_0x0a99('0xd')](function(_0x56810b){logger[_0x0a99('0xe')](_0x0a99('0xf'),_0x398d95,'request\x20sent');logger['debug'](_0x0a99('0x10'),_0x398d95,_0x0a99('0x11'),JSON[_0x0a99('0x12')](_0x56810b));if(_0x56810b[_0x0a99('0x13')]){if(_0x56810b[_0x0a99('0x13')]['code']===0x1f4){logger[_0x0a99('0x13')](_0x0a99('0xf'),_0x398d95,_0x56810b['error'][_0x0a99('0x14')]);return _0x3cf0ef(_0x56810b[_0x0a99('0x13')][_0x0a99('0x14')]);}logger[_0x0a99('0x13')](_0x0a99('0xf'),_0x398d95,_0x56810b[_0x0a99('0x13')][_0x0a99('0x14')]);return _0x599c7(_0x56810b[_0x0a99('0x13')]['message']);}else{logger['info'](_0x0a99('0xf'),_0x398d95,_0x0a99('0x11'));_0x599c7(_0x56810b[_0x0a99('0x15')]['message']);}})[_0x0a99('0x16')](function(_0x5c91f9){logger['error'](_0x0a99('0xf'),_0x398d95,_0x5c91f9);_0x3cf0ef(_0x5c91f9);});});} \ No newline at end of file +var _0x7f42=['message','catch','lodash','moment','bluebird','ioredis','../../config/utils','rpc','jayson/promise','http','request','then','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x237e8b,_0x3ee1a8){var _0x5814b2=function(_0x360648){while(--_0x360648){_0x237e8b['push'](_0x237e8b['shift']());}};_0x5814b2(++_0x3ee1a8);}(_0x7f42,0x1dd));var _0x27f4=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x7f42[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0x27f4('0x0'));var util=require('util');var moment=require(_0x27f4('0x1'));var BPromise=require(_0x27f4('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x27f4('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x27f4('0x4'));var logger=require('../../config/logger')(_0x27f4('0x5'));var config=require('../../config/environment');var jayson=require(_0x27f4('0x6'));var client=jayson['client'][_0x27f4('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1a85f2,_0xd283e2,_0x3010e3){return new BPromise(function(_0x2a4b6f,_0x9bc56e){return client[_0x27f4('0x8')](_0x1a85f2,_0x3010e3)[_0x27f4('0x9')](function(_0xe67021){logger[_0x27f4('0xa')](_0x27f4('0xb'),_0xd283e2,_0x27f4('0xc'));logger[_0x27f4('0xd')](_0x27f4('0xe'),_0xd283e2,_0x27f4('0xc'),JSON[_0x27f4('0xf')](_0xe67021));if(_0xe67021[_0x27f4('0x10')]){if(_0xe67021[_0x27f4('0x10')]['code']===0x1f4){logger['error'](_0x27f4('0xb'),_0xd283e2,_0xe67021[_0x27f4('0x10')][_0x27f4('0x11')]);return _0x9bc56e(_0xe67021[_0x27f4('0x10')][_0x27f4('0x11')]);}logger[_0x27f4('0x10')](_0x27f4('0xb'),_0xd283e2,_0xe67021[_0x27f4('0x10')]['message']);return _0x2a4b6f(_0xe67021['error'][_0x27f4('0x11')]);}else{logger[_0x27f4('0xa')](_0x27f4('0xb'),_0xd283e2,_0x27f4('0xc'));_0x2a4b6f(_0xe67021['result'][_0x27f4('0x11')]);}})[_0x27f4('0x12')](function(_0x321821){logger['error'](_0x27f4('0xb'),_0xd283e2,_0x321821);_0x9bc56e(_0x321821);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index b61ea39..2f711d7 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 _0xcd96=['fs-extra','../../components/interaction/service','../../config/environment','./pause.controller','get','isAuthenticated','show','post','create','put','delete','/:id','exports','util','path','connect-timeout','express','Router'];(function(_0x18cd5b,_0x10240b){var _0x5eaa52=function(_0x2bccad){while(--_0x2bccad){_0x18cd5b['push'](_0x18cd5b['shift']());}};_0x5eaa52(++_0x10240b);}(_0xcd96,0x1e1));var _0x6cd9=function(_0x5eb22e,_0x27cbac){_0x5eb22e=_0x5eb22e-0x0;var _0x27fed5=_0xcd96[_0x5eb22e];return _0x27fed5;};'use strict';var multer=require('multer');var util=require(_0x6cd9('0x0'));var path=require(_0x6cd9('0x1'));var timeout=require(_0x6cd9('0x2'));var express=require(_0x6cd9('0x3'));var router=express[_0x6cd9('0x4')]();var fs_extra=require(_0x6cd9('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x6cd9('0x6'));var config=require(_0x6cd9('0x7'));var controller=require(_0x6cd9('0x8'));router[_0x6cd9('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/:id',auth[_0x6cd9('0xa')](),controller[_0x6cd9('0xb')]);router[_0x6cd9('0xc')]('/',auth[_0x6cd9('0xa')](),controller[_0x6cd9('0xd')]);router[_0x6cd9('0xe')]('/:id',auth[_0x6cd9('0xa')](),controller['update']);router[_0x6cd9('0xf')](_0x6cd9('0x10'),auth[_0x6cd9('0xa')](),controller['destroy']);module[_0x6cd9('0x11')]=router; \ No newline at end of file +var _0x8d02=['destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','get','index','show','create','isAuthenticated','update','delete','/:id'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8d02,0x134));var _0x28d0=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x8d02[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require(_0x28d0('0x0'));var util=require(_0x28d0('0x1'));var path=require('path');var timeout=require(_0x28d0('0x2'));var express=require(_0x28d0('0x3'));var router=express[_0x28d0('0x4')]();var fs_extra=require(_0x28d0('0x5'));var auth=require(_0x28d0('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./pause.controller');router[_0x28d0('0x7')]('/',auth['isAuthenticated'](),controller[_0x28d0('0x8')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x28d0('0x9')]);router['post']('/',auth['isAuthenticated'](),controller[_0x28d0('0xa')]);router['put']('/:id',auth[_0x28d0('0xb')](),controller[_0x28d0('0xc')]);router[_0x28d0('0xd')](_0x28d0('0xe'),auth['isAuthenticated'](),controller[_0x28d0('0xf')]);module[_0x28d0('0x10')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 4cc8f69..46626c2 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 _0xdaad=['sequelize','STRING'];(function(_0x1b376c,_0x19f3c1){var _0x429a60=function(_0xe76a08){while(--_0xe76a08){_0x1b376c['push'](_0x1b376c['shift']());}};_0x429a60(++_0x19f3c1);}(_0xdaad,0x16a));var _0xddaa=function(_0x153b2f,_0x5a9b00){_0x153b2f=_0x153b2f-0x0;var _0x3bca6c=_0xdaad[_0x153b2f];return _0x3bca6c;};'use strict';var Sequelize=require(_0xddaa('0x0'));module['exports']={'name':{'type':Sequelize[_0xddaa('0x1')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0xddaa('0x1')]}}; \ No newline at end of file +var _0x14bc=['name','exports','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x14bc,0x115));var _0xc14b=function(_0x423b87,_0x487dcd){_0x423b87=_0x423b87-0x0;var _0x3b1c0f=_0x14bc[_0x423b87];return _0x3b1c0f;};'use strict';var Sequelize=require('sequelize');module[_0xc14b('0x0')]={'name':{'type':Sequelize[_0xc14b('0x1')],'unique':_0xc14b('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0xc14b('0x1')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index 894a5ee..0686416 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 _0xdca5=['catch','show','params','keys','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','then','destroy','UserProfileResource','error','name','send','index','map','Pause','rawAttributes','fieldName','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','include','findAll','rows'];(function(_0x45435b,_0x8f2922){var _0x55379f=function(_0x1d78d5){while(--_0x1d78d5){_0x45435b['push'](_0x45435b['shift']());}};_0x55379f(++_0x8f2922);}(_0xdca5,0x168));var _0x5dca=function(_0x3bbaae,_0xb69da){_0x3bbaae=_0x3bbaae-0x0;var _0x4c69ac=_0xdca5[_0x3bbaae];return _0x4c69ac;};'use strict';var emlformat=require(_0x5dca('0x0'));var rimraf=require(_0x5dca('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5dca('0x2'));var rp=require(_0x5dca('0x3'));var moment=require(_0x5dca('0x4'));var BPromise=require(_0x5dca('0x5'));var Mustache=require(_0x5dca('0x6'));var util=require('util');var path=require(_0x5dca('0x7'));var sox=require('sox');var csv=require(_0x5dca('0x8'));var ejs=require(_0x5dca('0x9'));var fs=require('fs');var fs_extra=require(_0x5dca('0xa'));var _=require(_0x5dca('0xb'));var squel=require(_0x5dca('0xc'));var crypto=require(_0x5dca('0xd'));var jsforce=require(_0x5dca('0xe'));var deskjs=require(_0x5dca('0xf'));var toCsv=require(_0x5dca('0x8'));var querystring=require('querystring');var Papa=require(_0x5dca('0x10'));var Redis=require(_0x5dca('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x5dca('0x12'));var as=require(_0x5dca('0x13'));var hardwareService=require(_0x5dca('0x14'));var logger=require(_0x5dca('0x15'))(_0x5dca('0x16'));var utils=require('../../config/utils');var config=require(_0x5dca('0x17'));var licenseUtil=require(_0x5dca('0x18'));var db=require(_0x5dca('0x19'))['db'];function respondWithStatusCode(_0x1ae9a2,_0x10a1f6){_0x10a1f6=_0x10a1f6||0xcc;return function(_0x231659){if(_0x231659){return _0x1ae9a2[_0x5dca('0x1a')](_0x10a1f6);}return _0x1ae9a2[_0x5dca('0x1b')](_0x10a1f6)[_0x5dca('0x1c')]();};}function respondWithResult(_0x334163,_0x1cbe2a){_0x1cbe2a=_0x1cbe2a||0xc8;return function(_0x1b4902){if(_0x1b4902){return _0x334163[_0x5dca('0x1b')](_0x1cbe2a)[_0x5dca('0x1d')](_0x1b4902);}};}function respondWithFilteredResult(_0x4f6fe6,_0x34f054){return function(_0x5b62ba){if(_0x5b62ba){var _0x1444f1=typeof _0x34f054['offset']==='undefined'&&typeof _0x34f054['limit']===_0x5dca('0x1e');var _0x4548f4=_0x5b62ba[_0x5dca('0x1f')];var _0x3cbb64=_0x1444f1?0x0:_0x34f054[_0x5dca('0x20')];var _0x249e85=_0x1444f1?_0x5b62ba[_0x5dca('0x1f')]:_0x34f054['offset']+_0x34f054[_0x5dca('0x21')];var _0x45cef4;if(_0x249e85>=_0x4548f4){_0x249e85=_0x4548f4;_0x45cef4=0xc8;}else{_0x45cef4=0xce;}_0x4f6fe6[_0x5dca('0x1b')](_0x45cef4);return _0x4f6fe6[_0x5dca('0x22')](_0x5dca('0x23'),_0x3cbb64+'-'+_0x249e85+'/'+_0x4548f4)[_0x5dca('0x1d')](_0x5b62ba);}return null;};}function patchUpdates(_0x16bf89){return function(_0x36af01){try{jsonpatch[_0x5dca('0x24')](_0x36af01,_0x16bf89,!![]);}catch(_0x25854a){return BPromise[_0x5dca('0x25')](_0x25854a);}return _0x36af01['save']();};}function saveUpdates(_0x387902,_0x555d14){return function(_0x1e81ea){if(_0x1e81ea){return _0x1e81ea['update'](_0x387902)[_0x5dca('0x26')](function(_0x30abf5){return _0x30abf5;});}return null;};}function removeEntity(_0x2fdae9,_0x454dcb){return function(_0x51b789){if(_0x51b789){return _0x51b789[_0x5dca('0x27')]()[_0x5dca('0x26')](function(){var _0x266b94=_0x51b789['get']({'plain':!![]});var _0x565faa='Pauses';return db[_0x5dca('0x28')]['destroy']({'where':{'type':_0x565faa,'resourceId':_0x266b94['id']}})[_0x5dca('0x26')](function(){return _0x51b789;});})[_0x5dca('0x26')](function(){_0x2fdae9[_0x5dca('0x1b')](0xcc)[_0x5dca('0x1c')]();});}};}function handleEntityNotFound(_0x1d708c,_0x77396d){return function(_0x26c4d1){if(!_0x26c4d1){_0x1d708c[_0x5dca('0x1a')](0x194);}return _0x26c4d1;};}function handleError(_0x4fab64,_0x24c179){_0x24c179=_0x24c179||0x1f4;return function(_0xbf8fb5){logger[_0x5dca('0x29')](_0xbf8fb5['stack']);if(_0xbf8fb5[_0x5dca('0x2a')]){delete _0xbf8fb5[_0x5dca('0x2a')];}_0x4fab64['status'](_0x24c179)[_0x5dca('0x2b')](_0xbf8fb5);};}exports[_0x5dca('0x2c')]=function(_0x346bad,_0x533d0a){var _0xfcc753={},_0x2318fd={},_0xe5dcd0={'count':0x0,'rows':[]};var _0xeb9b36=_[_0x5dca('0x2d')](db[_0x5dca('0x2e')][_0x5dca('0x2f')],function(_0x1f634d){return{'name':_0x1f634d[_0x5dca('0x30')],'type':_0x1f634d['type']['key']};});_0x2318fd['model']=_[_0x5dca('0x2d')](_0xeb9b36,_0x5dca('0x2a'));_0x2318fd[_0x5dca('0x31')]=_['keys'](_0x346bad[_0x5dca('0x31')]);_0x2318fd[_0x5dca('0x32')]=_[_0x5dca('0x33')](_0x2318fd[_0x5dca('0x34')],_0x2318fd[_0x5dca('0x31')]);_0xfcc753[_0x5dca('0x35')]=_['intersection'](_0x2318fd[_0x5dca('0x34')],qs[_0x5dca('0x36')](_0x346bad[_0x5dca('0x31')][_0x5dca('0x36')]));_0xfcc753[_0x5dca('0x35')]=_0xfcc753[_0x5dca('0x35')][_0x5dca('0x37')]?_0xfcc753[_0x5dca('0x35')]:_0x2318fd[_0x5dca('0x34')];if(!_0x346bad[_0x5dca('0x31')][_0x5dca('0x38')](_0x5dca('0x39'))){_0xfcc753[_0x5dca('0x21')]=qs[_0x5dca('0x21')](_0x346bad['query'][_0x5dca('0x21')]);_0xfcc753[_0x5dca('0x20')]=qs[_0x5dca('0x20')](_0x346bad[_0x5dca('0x31')]['offset']);}_0xfcc753[_0x5dca('0x3a')]=qs['sort'](_0x346bad[_0x5dca('0x31')][_0x5dca('0x3b')]);_0xfcc753[_0x5dca('0x3c')]=qs[_0x5dca('0x32')](_[_0x5dca('0x3d')](_0x346bad[_0x5dca('0x31')],_0x2318fd[_0x5dca('0x32')]),_0xeb9b36);if(_0x346bad['query'][_0x5dca('0x3e')]){_0xfcc753[_0x5dca('0x3c')]=_[_0x5dca('0x3f')](_0xfcc753['where'],{'$or':_[_0x5dca('0x2d')](_0xeb9b36,function(_0x118a95){if(_0x118a95[_0x5dca('0x40')]!==_0x5dca('0x41')){var _0x4aca30={};_0x4aca30[_0x118a95['name']]={'$like':'%'+_0x346bad[_0x5dca('0x31')]['filter']+'%'};return _0x4aca30;}})});}_0xfcc753=_[_0x5dca('0x3f')]({},_0xfcc753,_0x346bad[_0x5dca('0x42')]);var _0x597eec={'where':_0xfcc753[_0x5dca('0x3c')]};return db[_0x5dca('0x2e')][_0x5dca('0x1f')](_0x597eec)[_0x5dca('0x26')](function(_0x6d09eb){_0xe5dcd0['count']=_0x6d09eb;if(_0x346bad[_0x5dca('0x31')]['includeAll']){_0xfcc753[_0x5dca('0x43')]=[{'all':!![]}];}return db['Pause'][_0x5dca('0x44')](_0xfcc753);})['then'](function(_0x396afa){_0xe5dcd0[_0x5dca('0x45')]=_0x396afa;return _0xe5dcd0;})[_0x5dca('0x26')](respondWithFilteredResult(_0x533d0a,_0xfcc753))[_0x5dca('0x46')](handleError(_0x533d0a,null));};exports[_0x5dca('0x47')]=function(_0x4c8d39,_0x3d71fb){var _0x433b52={'raw':!![],'where':{'id':_0x4c8d39[_0x5dca('0x48')]['id']}},_0x11a5b3={};_0x11a5b3[_0x5dca('0x34')]=_['keys'](db[_0x5dca('0x2e')][_0x5dca('0x2f')]);_0x11a5b3['query']=_[_0x5dca('0x49')](_0x4c8d39[_0x5dca('0x31')]);_0x11a5b3[_0x5dca('0x32')]=_[_0x5dca('0x33')](_0x11a5b3[_0x5dca('0x34')],_0x11a5b3['query']);_0x433b52[_0x5dca('0x35')]=_[_0x5dca('0x33')](_0x11a5b3[_0x5dca('0x34')],qs[_0x5dca('0x36')](_0x4c8d39[_0x5dca('0x31')][_0x5dca('0x36')]));_0x433b52[_0x5dca('0x35')]=_0x433b52[_0x5dca('0x35')][_0x5dca('0x37')]?_0x433b52[_0x5dca('0x35')]:_0x11a5b3['model'];if(_0x4c8d39['query'][_0x5dca('0x4a')]){_0x433b52[_0x5dca('0x43')]=[{'all':!![]}];}_0x433b52=_[_0x5dca('0x3f')]({},_0x433b52,_0x4c8d39[_0x5dca('0x42')]);return db[_0x5dca('0x2e')][_0x5dca('0x4b')](_0x433b52)[_0x5dca('0x26')](handleEntityNotFound(_0x3d71fb,null))['then'](respondWithResult(_0x3d71fb,null))[_0x5dca('0x46')](handleError(_0x3d71fb,null));};exports[_0x5dca('0x4c')]=function(_0x27631f,_0x82613e){return db[_0x5dca('0x2e')]['create'](_0x27631f[_0x5dca('0x4d')],{})[_0x5dca('0x26')](function(_0x3e6ffd){var _0x2c91c1=_0x27631f[_0x5dca('0x4e')]['get']({'plain':!![]});if(!_0x2c91c1)throw new Error(_0x5dca('0x4f'));if(_0x2c91c1[_0x5dca('0x50')]===_0x5dca('0x4e')){var _0x30f079=_0x3e6ffd[_0x5dca('0x51')]({'plain':!![]});var _0x59fdc9='Pauses';return db[_0x5dca('0x52')]['find']({'where':{'name':_0x59fdc9,'userProfileId':_0x2c91c1[_0x5dca('0x53')]},'raw':!![]})['then'](function(_0x1a1da3){if(_0x1a1da3&&_0x1a1da3[_0x5dca('0x54')]===0x0){return db[_0x5dca('0x28')][_0x5dca('0x4c')]({'name':_0x30f079[_0x5dca('0x2a')],'resourceId':_0x30f079['id'],'type':_0x1a1da3[_0x5dca('0x2a')],'sectionId':_0x1a1da3['id']},{})[_0x5dca('0x26')](function(){return _0x3e6ffd;});}else{return _0x3e6ffd;}})[_0x5dca('0x46')](function(_0x290b1a){logger[_0x5dca('0x29')](_0x5dca('0x55'),_0x290b1a);throw _0x290b1a;});}return _0x3e6ffd;})['then'](respondWithResult(_0x82613e,0xc9))[_0x5dca('0x46')](handleError(_0x82613e,null));};exports['update']=function(_0x1baf98,_0x415a26){if(_0x1baf98[_0x5dca('0x4d')]['id']){delete _0x1baf98['body']['id'];}return db[_0x5dca('0x2e')][_0x5dca('0x4b')]({'where':{'id':_0x1baf98[_0x5dca('0x48')]['id']}})[_0x5dca('0x26')](handleEntityNotFound(_0x415a26,null))[_0x5dca('0x26')](saveUpdates(_0x1baf98[_0x5dca('0x4d')],null))[_0x5dca('0x26')](respondWithResult(_0x415a26,null))[_0x5dca('0x46')](handleError(_0x415a26,null));};exports[_0x5dca('0x27')]=function(_0x381a12,_0x3680a7){return db[_0x5dca('0x2e')]['find']({'where':{'id':_0x381a12[_0x5dca('0x48')]['id']}})[_0x5dca('0x26')](handleEntityNotFound(_0x3680a7,null))[_0x5dca('0x26')](removeEntity(_0x3680a7,null))[_0x5dca('0x46')](handleError(_0x3680a7,null));}; \ No newline at end of file +var _0xa529=['length','includeAll','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Pauses','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','Content-Range','apply','reject','save','update','destroy','then','get','name','send','index','Pause','rawAttributes','type','key','model','map','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','VIRTUAL','options','include','findAll','rows'];(function(_0x2bb73e,_0x51aeee){var _0x577ca1=function(_0x39329b){while(--_0x39329b){_0x2bb73e['push'](_0x2bb73e['shift']());}};_0x577ca1(++_0x51aeee);}(_0xa529,0x105));var _0x9a52=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xa529[_0xa464c9];return _0x3d73c4;};'use strict';var emlformat=require(_0x9a52('0x0'));var rimraf=require(_0x9a52('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9a52('0x2'));var rp=require('request-promise');var moment=require(_0x9a52('0x3'));var BPromise=require(_0x9a52('0x4'));var Mustache=require(_0x9a52('0x5'));var util=require('util');var path=require(_0x9a52('0x6'));var sox=require(_0x9a52('0x7'));var csv=require('to-csv');var ejs=require(_0x9a52('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9a52('0x9'));var squel=require(_0x9a52('0xa'));var crypto=require('crypto');var jsforce=require(_0x9a52('0xb'));var deskjs=require(_0x9a52('0xc'));var toCsv=require(_0x9a52('0xd'));var querystring=require(_0x9a52('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x9a52('0xf'));var qs=require(_0x9a52('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9a52('0x11'));var logger=require(_0x9a52('0x12'))(_0x9a52('0x13'));var utils=require(_0x9a52('0x14'));var config=require(_0x9a52('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x9a52('0x16'))['db'];function respondWithStatusCode(_0x7035f6,_0x3cb874){_0x3cb874=_0x3cb874||0xcc;return function(_0x270cbe){if(_0x270cbe){return _0x7035f6[_0x9a52('0x17')](_0x3cb874);}return _0x7035f6[_0x9a52('0x18')](_0x3cb874)[_0x9a52('0x19')]();};}function respondWithResult(_0x402aae,_0xb1c3d9){_0xb1c3d9=_0xb1c3d9||0xc8;return function(_0x18a8ab){if(_0x18a8ab){return _0x402aae[_0x9a52('0x18')](_0xb1c3d9)[_0x9a52('0x1a')](_0x18a8ab);}};}function respondWithFilteredResult(_0x2a46bd,_0x5a71a3){return function(_0x43f3ec){if(_0x43f3ec){var _0x37c416=typeof _0x5a71a3[_0x9a52('0x1b')]===_0x9a52('0x1c')&&typeof _0x5a71a3['limit']===_0x9a52('0x1c');var _0x788078=_0x43f3ec[_0x9a52('0x1d')];var _0x4e4cc7=_0x37c416?0x0:_0x5a71a3['offset'];var _0x4bd1a6=_0x37c416?_0x43f3ec[_0x9a52('0x1d')]:_0x5a71a3[_0x9a52('0x1b')]+_0x5a71a3['limit'];var _0x24c9fa;if(_0x4bd1a6>=_0x788078){_0x4bd1a6=_0x788078;_0x24c9fa=0xc8;}else{_0x24c9fa=0xce;}_0x2a46bd[_0x9a52('0x18')](_0x24c9fa);return _0x2a46bd['set'](_0x9a52('0x1e'),_0x4e4cc7+'-'+_0x4bd1a6+'/'+_0x788078)[_0x9a52('0x1a')](_0x43f3ec);}return null;};}function patchUpdates(_0xa2f578){return function(_0x1881a6){try{jsonpatch[_0x9a52('0x1f')](_0x1881a6,_0xa2f578,!![]);}catch(_0x537e8f){return BPromise[_0x9a52('0x20')](_0x537e8f);}return _0x1881a6[_0x9a52('0x21')]();};}function saveUpdates(_0x40e347,_0x19fede){return function(_0x59893a){if(_0x59893a){return _0x59893a[_0x9a52('0x22')](_0x40e347)['then'](function(_0x71ca44){return _0x71ca44;});}return null;};}function removeEntity(_0x68173a,_0x1426ca){return function(_0xba4385){if(_0xba4385){return _0xba4385[_0x9a52('0x23')]()[_0x9a52('0x24')](function(){var _0x231350=_0xba4385[_0x9a52('0x25')]({'plain':!![]});var _0x5988f4='Pauses';return db['UserProfileResource'][_0x9a52('0x23')]({'where':{'type':_0x5988f4,'resourceId':_0x231350['id']}})['then'](function(){return _0xba4385;});})[_0x9a52('0x24')](function(){_0x68173a[_0x9a52('0x18')](0xcc)[_0x9a52('0x19')]();});}};}function handleEntityNotFound(_0x4a5a34,_0x4b0e95){return function(_0x519396){if(!_0x519396){_0x4a5a34[_0x9a52('0x17')](0x194);}return _0x519396;};}function handleError(_0x5c4768,_0x142dff){_0x142dff=_0x142dff||0x1f4;return function(_0x297011){logger['error'](_0x297011['stack']);if(_0x297011[_0x9a52('0x26')]){delete _0x297011[_0x9a52('0x26')];}_0x5c4768[_0x9a52('0x18')](_0x142dff)[_0x9a52('0x27')](_0x297011);};}exports[_0x9a52('0x28')]=function(_0x377d9f,_0x336c45){var _0x3c5f74={},_0x2982d2={},_0x58a403={'count':0x0,'rows':[]};var _0x4f6245=_['map'](db[_0x9a52('0x29')][_0x9a52('0x2a')],function(_0x3192f9){return{'name':_0x3192f9['fieldName'],'type':_0x3192f9[_0x9a52('0x2b')][_0x9a52('0x2c')]};});_0x2982d2[_0x9a52('0x2d')]=_[_0x9a52('0x2e')](_0x4f6245,_0x9a52('0x26'));_0x2982d2[_0x9a52('0x2f')]=_[_0x9a52('0x30')](_0x377d9f[_0x9a52('0x2f')]);_0x2982d2[_0x9a52('0x31')]=_[_0x9a52('0x32')](_0x2982d2['model'],_0x2982d2['query']);_0x3c5f74['attributes']=_[_0x9a52('0x32')](_0x2982d2[_0x9a52('0x2d')],qs[_0x9a52('0x33')](_0x377d9f['query']['fields']));_0x3c5f74[_0x9a52('0x34')]=_0x3c5f74[_0x9a52('0x34')]['length']?_0x3c5f74[_0x9a52('0x34')]:_0x2982d2[_0x9a52('0x2d')];if(!_0x377d9f['query'][_0x9a52('0x35')](_0x9a52('0x36'))){_0x3c5f74[_0x9a52('0x37')]=qs[_0x9a52('0x37')](_0x377d9f['query']['limit']);_0x3c5f74[_0x9a52('0x1b')]=qs[_0x9a52('0x1b')](_0x377d9f[_0x9a52('0x2f')][_0x9a52('0x1b')]);}_0x3c5f74[_0x9a52('0x38')]=qs['sort'](_0x377d9f[_0x9a52('0x2f')][_0x9a52('0x39')]);_0x3c5f74['where']=qs[_0x9a52('0x31')](_[_0x9a52('0x3a')](_0x377d9f[_0x9a52('0x2f')],_0x2982d2[_0x9a52('0x31')]),_0x4f6245);if(_0x377d9f[_0x9a52('0x2f')][_0x9a52('0x3b')]){_0x3c5f74[_0x9a52('0x3c')]=_[_0x9a52('0x3d')](_0x3c5f74[_0x9a52('0x3c')],{'$or':_[_0x9a52('0x2e')](_0x4f6245,function(_0x3bde83){if(_0x3bde83['type']!==_0x9a52('0x3e')){var _0x387c8d={};_0x387c8d[_0x3bde83['name']]={'$like':'%'+_0x377d9f[_0x9a52('0x2f')][_0x9a52('0x3b')]+'%'};return _0x387c8d;}})});}_0x3c5f74=_[_0x9a52('0x3d')]({},_0x3c5f74,_0x377d9f[_0x9a52('0x3f')]);var _0x180666={'where':_0x3c5f74[_0x9a52('0x3c')]};return db['Pause'][_0x9a52('0x1d')](_0x180666)[_0x9a52('0x24')](function(_0x4e7909){_0x58a403[_0x9a52('0x1d')]=_0x4e7909;if(_0x377d9f['query']['includeAll']){_0x3c5f74[_0x9a52('0x40')]=[{'all':!![]}];}return db[_0x9a52('0x29')][_0x9a52('0x41')](_0x3c5f74);})[_0x9a52('0x24')](function(_0x7e8c60){_0x58a403[_0x9a52('0x42')]=_0x7e8c60;return _0x58a403;})[_0x9a52('0x24')](respondWithFilteredResult(_0x336c45,_0x3c5f74))['catch'](handleError(_0x336c45,null));};exports['show']=function(_0x2e3bff,_0x34cd88){var _0x2ba735={'raw':!![],'where':{'id':_0x2e3bff['params']['id']}},_0x293e88={};_0x293e88[_0x9a52('0x2d')]=_[_0x9a52('0x30')](db[_0x9a52('0x29')][_0x9a52('0x2a')]);_0x293e88[_0x9a52('0x2f')]=_[_0x9a52('0x30')](_0x2e3bff[_0x9a52('0x2f')]);_0x293e88[_0x9a52('0x31')]=_['intersection'](_0x293e88[_0x9a52('0x2d')],_0x293e88[_0x9a52('0x2f')]);_0x2ba735['attributes']=_[_0x9a52('0x32')](_0x293e88[_0x9a52('0x2d')],qs['fields'](_0x2e3bff[_0x9a52('0x2f')][_0x9a52('0x33')]));_0x2ba735[_0x9a52('0x34')]=_0x2ba735[_0x9a52('0x34')][_0x9a52('0x43')]?_0x2ba735[_0x9a52('0x34')]:_0x293e88['model'];if(_0x2e3bff[_0x9a52('0x2f')][_0x9a52('0x44')]){_0x2ba735['include']=[{'all':!![]}];}_0x2ba735=_[_0x9a52('0x3d')]({},_0x2ba735,_0x2e3bff[_0x9a52('0x3f')]);return db[_0x9a52('0x29')][_0x9a52('0x45')](_0x2ba735)['then'](handleEntityNotFound(_0x34cd88,null))[_0x9a52('0x24')](respondWithResult(_0x34cd88,null))[_0x9a52('0x46')](handleError(_0x34cd88,null));};exports[_0x9a52('0x47')]=function(_0x2b11ca,_0xe9860b){return db[_0x9a52('0x29')]['create'](_0x2b11ca[_0x9a52('0x48')],{})['then'](function(_0x546dfb){var _0x96235d=_0x2b11ca[_0x9a52('0x49')]['get']({'plain':!![]});if(!_0x96235d)throw new Error(_0x9a52('0x4a'));if(_0x96235d[_0x9a52('0x4b')]===_0x9a52('0x49')){var _0x287105=_0x546dfb[_0x9a52('0x25')]({'plain':!![]});var _0x5029d4=_0x9a52('0x4c');return db['UserProfileSection'][_0x9a52('0x45')]({'where':{'name':_0x5029d4,'userProfileId':_0x96235d[_0x9a52('0x4d')]},'raw':!![]})[_0x9a52('0x24')](function(_0x4ba77b){if(_0x4ba77b&&_0x4ba77b[_0x9a52('0x4e')]===0x0){return db[_0x9a52('0x4f')][_0x9a52('0x47')]({'name':_0x287105[_0x9a52('0x26')],'resourceId':_0x287105['id'],'type':_0x4ba77b[_0x9a52('0x26')],'sectionId':_0x4ba77b['id']},{})[_0x9a52('0x24')](function(){return _0x546dfb;});}else{return _0x546dfb;}})[_0x9a52('0x46')](function(_0xd10e96){logger['error'](_0x9a52('0x50'),_0xd10e96);throw _0xd10e96;});}return _0x546dfb;})[_0x9a52('0x24')](respondWithResult(_0xe9860b,0xc9))[_0x9a52('0x46')](handleError(_0xe9860b,null));};exports['update']=function(_0x5c17a9,_0x3f607f){if(_0x5c17a9[_0x9a52('0x48')]['id']){delete _0x5c17a9['body']['id'];}return db[_0x9a52('0x29')][_0x9a52('0x45')]({'where':{'id':_0x5c17a9[_0x9a52('0x51')]['id']}})[_0x9a52('0x24')](handleEntityNotFound(_0x3f607f,null))[_0x9a52('0x24')](saveUpdates(_0x5c17a9[_0x9a52('0x48')],null))[_0x9a52('0x24')](respondWithResult(_0x3f607f,null))['catch'](handleError(_0x3f607f,null));};exports[_0x9a52('0x23')]=function(_0x1378f2,_0x5bf936){return db[_0x9a52('0x29')][_0x9a52('0x45')]({'where':{'id':_0x1378f2[_0x9a52('0x51')]['id']}})[_0x9a52('0x24')](handleEntityNotFound(_0x5bf936,null))[_0x9a52('0x24')](removeEntity(_0x5bf936,null))[_0x9a52('0x46')](handleError(_0x5bf936,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 5e1e055..72173e7 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(_0x24d4a9,_0x529407){var _0x29fd2d=function(_0x57caf1){while(--_0x57caf1){_0x24d4a9['push'](_0x24d4a9['shift']());}};_0x29fd2d(++_0x529407);}(_0x814b,0x1a2));var _0xb814=function(_0x30c649,_0x2ebbac){_0x30c649=_0x30c649-0x0;var _0x3edfb9=_0x814b[_0x30c649];return _0x3edfb9;};'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(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0xc4aa[_0x5f09c5];return _0x426ad9;};'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 621c0b5..8477c44 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 _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(_0x521fa2,_0x1139fc){var _0x2b9b65=function(_0x342d5b){while(--_0x342d5b){_0x521fa2['push'](_0x521fa2['shift']());}};_0x2b9b65(++_0x1139fc);}(_0x7a54,0x106));var _0x47a5=function(_0xb209b8,_0x66e824){_0xb209b8=_0xb209b8-0x0;var _0x38a496=_0x7a54[_0xb209b8];return _0x38a496;};'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 +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(_0x4a49c9,_0x13bb6f){var _0x437142=function(_0x488397){while(--_0x488397){_0x4a49c9['push'](_0x4a49c9['shift']());}};_0x437142(++_0x13bb6f);}(_0x7a54,0x106));var _0x47a5=function(_0x16baab,_0x1e4b07){_0x16baab=_0x16baab-0x0;var _0x2fc5ad=_0x7a54[_0x16baab];return _0x2fc5ad;};'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 57317a2..de2bb50 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 _0xbd50=['extname','post','single','upload','webhookPost','put','/:id','update','delete','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/webhook','webhookGet','show','download','join','root','server/files/plugins','originalname','replace','format','%s-%s%s','basename'];(function(_0x410532,_0x201fc0){var _0x2123a7=function(_0x54be79){while(--_0x54be79){_0x410532['push'](_0x410532['shift']());}};_0x2123a7(++_0x201fc0);}(_0xbd50,0x196));var _0x0bd5=function(_0x3fd222,_0x27f900){_0x3fd222=_0x3fd222-0x0;var _0xb7371d=_0xbd50[_0x3fd222];return _0xb7371d;};'use strict';var multer=require(_0x0bd5('0x0'));var util=require(_0x0bd5('0x1'));var path=require(_0x0bd5('0x2'));var timeout=require('connect-timeout');var express=require(_0x0bd5('0x3'));var router=express[_0x0bd5('0x4')]();var fs_extra=require(_0x0bd5('0x5'));var auth=require(_0x0bd5('0x6'));var interaction=require(_0x0bd5('0x7'));var config=require('../../config/environment');var controller=require('./plugin.controller');router['get']('/',auth[_0x0bd5('0x8')](),controller[_0x0bd5('0x9')]);router[_0x0bd5('0xa')](_0x0bd5('0xb'),controller[_0x0bd5('0xc')]);router['get']('/:id',auth[_0x0bd5('0x8')](),controller[_0x0bd5('0xd')]);router[_0x0bd5('0xa')]('/:id/download',auth[_0x0bd5('0x8')](),controller[_0x0bd5('0xe')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x210f45,_0x7db86e,_0x4d7d17){_0x4d7d17(null,path[_0x0bd5('0xf')](config[_0x0bd5('0x10')],_0x0bd5('0x11')));},'filename':function(_0x5f49ee,_0x2f7a0c,_0x23982f){_0x2f7a0c[_0x0bd5('0x12')]=_0x2f7a0c[_0x0bd5('0x12')][_0x0bd5('0x13')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x23982f(null,util[_0x0bd5('0x14')](_0x0bd5('0x15'),path[_0x0bd5('0x16')](_0x2f7a0c['originalname'],path[_0x0bd5('0x17')](_0x2f7a0c[_0x0bd5('0x12')])),Date['now'](),path[_0x0bd5('0x17')](_0x2f7a0c[_0x0bd5('0x12')])));}})});router[_0x0bd5('0x18')]('/',upload[_0x0bd5('0x19')]('file'),controller[_0x0bd5('0x1a')]);router[_0x0bd5('0x18')](_0x0bd5('0xb'),controller[_0x0bd5('0x1b')]);router[_0x0bd5('0x1c')](_0x0bd5('0x1d'),auth[_0x0bd5('0x8')](),controller[_0x0bd5('0x1e')]);router[_0x0bd5('0x1f')](_0x0bd5('0x1d'),auth[_0x0bd5('0x8')](),controller[_0x0bd5('0x1f')]);module[_0x0bd5('0x20')]=router; \ No newline at end of file +var _0x6aa7=['isAuthenticated','get','/webhook','webhookGet','/:id','show','/:id/download','download','diskStorage','join','root','server/files/plugins','originalname','replace','format','%s-%s%s','extname','now','post','file','webhookPost','put','delete','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x41b9d8,_0x32402f){var _0xdb9b8e=function(_0x2e3b98){while(--_0x2e3b98){_0x41b9d8['push'](_0x41b9d8['shift']());}};_0xdb9b8e(++_0x32402f);}(_0x6aa7,0x178));var _0x76aa=function(_0x2015a3,_0x1815ba){_0x2015a3=_0x2015a3-0x0;var _0x1479f9=_0x6aa7[_0x2015a3];return _0x1479f9;};'use strict';var multer=require(_0x76aa('0x0'));var util=require('util');var path=require(_0x76aa('0x1'));var timeout=require(_0x76aa('0x2'));var express=require(_0x76aa('0x3'));var router=express[_0x76aa('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x76aa('0x5'));var interaction=require(_0x76aa('0x6'));var config=require(_0x76aa('0x7'));var controller=require('./plugin.controller');router['get']('/',auth[_0x76aa('0x8')](),controller['index']);router[_0x76aa('0x9')](_0x76aa('0xa'),controller[_0x76aa('0xb')]);router['get'](_0x76aa('0xc'),auth[_0x76aa('0x8')](),controller[_0x76aa('0xd')]);router['get'](_0x76aa('0xe'),auth[_0x76aa('0x8')](),controller[_0x76aa('0xf')]);var upload=multer({'storage':multer[_0x76aa('0x10')]({'destination':function(_0x37f1ab,_0x128435,_0x2c5075){_0x2c5075(null,path[_0x76aa('0x11')](config[_0x76aa('0x12')],_0x76aa('0x13')));},'filename':function(_0x5e5f47,_0x112c39,_0x5df49c){_0x112c39[_0x76aa('0x14')]=_0x112c39[_0x76aa('0x14')][_0x76aa('0x15')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x5df49c(null,util[_0x76aa('0x16')](_0x76aa('0x17'),path['basename'](_0x112c39['originalname'],path[_0x76aa('0x18')](_0x112c39['originalname'])),Date[_0x76aa('0x19')](),path[_0x76aa('0x18')](_0x112c39['originalname'])));}})});router[_0x76aa('0x1a')]('/',upload['single'](_0x76aa('0x1b')),controller['upload']);router[_0x76aa('0x1a')](_0x76aa('0xa'),controller[_0x76aa('0x1c')]);router[_0x76aa('0x1d')](_0x76aa('0xc'),auth[_0x76aa('0x8')](),controller['update']);router['delete'](_0x76aa('0xc'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x1e')]);module[_0x76aa('0x1f')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index 4d86837..88bbcb7 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 _0x5450=['never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports','STRING','ENUM','html','script','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'];(function(_0x423a84,_0x5d8ae0){var _0xd6ee39=function(_0x2cf03b){while(--_0x2cf03b){_0x423a84['push'](_0x423a84['shift']());}};_0xd6ee39(++_0x5d8ae0);}(_0x5450,0x1de));var _0x0545=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x5450[_0x2d7f0e];return _0x110b07;};'use strict';var Sequelize=require(_0x0545('0x0'));module[_0x0545('0x1')]={'name':{'type':Sequelize[_0x0545('0x2')]},'type':{'type':Sequelize[_0x0545('0x3')](_0x0545('0x4'),_0x0545('0x5'))},'description':{'type':Sequelize['TEXT']},'version':{'type':Sequelize['TEXT']},'path':{'type':Sequelize['STRING'],'comment':_0x0545('0x6')},'active':{'type':Sequelize[_0x0545('0x7')],'defaultValue':0x0,'comment':_0x0545('0x8')},'sidebar':{'type':Sequelize[_0x0545('0x3')](_0x0545('0x9'),_0x0545('0xa'),_0x0545('0xb'),_0x0545('0xc')),'defaultValue':_0x0545('0xb'),'comment':_0x0545('0xd')},'icon':{'type':Sequelize[_0x0545('0x2')]},'adminUrl':{'type':Sequelize['STRING']},'agentUrl':{'type':Sequelize['STRING']},'scriptName':{'type':Sequelize['STRING']},'scriptPath':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xed7a=['sequelize','exports','STRING','html','script','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','ENUM','agentOnly','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0xed7a,0x17a));var _0xaed7=function(_0x269ac7,_0x40ea9a){_0x269ac7=_0x269ac7-0x0;var _0x4b9606=_0xed7a[_0x269ac7];return _0x4b9606;};'use strict';var Sequelize=require(_0xaed7('0x0'));module[_0xaed7('0x1')]={'name':{'type':Sequelize[_0xaed7('0x2')]},'type':{'type':Sequelize['ENUM'](_0xaed7('0x3'),_0xaed7('0x4'))},'description':{'type':Sequelize[_0xaed7('0x5')]},'version':{'type':Sequelize[_0xaed7('0x5')]},'path':{'type':Sequelize[_0xaed7('0x2')],'comment':_0xaed7('0x6')},'active':{'type':Sequelize[_0xaed7('0x7')],'defaultValue':0x0,'comment':_0xaed7('0x8')},'sidebar':{'type':Sequelize[_0xaed7('0x9')]('adminOnly',_0xaed7('0xa'),_0xaed7('0xb'),_0xaed7('0xc')),'defaultValue':_0xaed7('0xb'),'comment':_0xaed7('0xd')},'icon':{'type':Sequelize['STRING']},'adminUrl':{'type':Sequelize[_0xaed7('0x2')]},'agentUrl':{'type':Sequelize[_0xaed7('0x2')]},'scriptName':{'type':Sequelize[_0xaed7('0x2')]},'scriptPath':{'type':Sequelize[_0xaed7('0x2')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index 368be21..01de9cf 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 _0x8a4e=['options','Plugin','includeAll','include','findAll','rows','find','catch','params','join','server/files/plugins','format','%s.zip','basename','createWriteStream','zip','warning','code','ENOENT','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','Sequelize','glob','**/*','root','node_modules/**/*','existsSync','Plugin\x20not\x20found','download','Error\x20while\x20downloading\x20the\x20plugin','info','Download\x20completed','Temporary\x20file\x20removed','upload','file','filename','extname','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','0777','Invalid\x20plugin\x20structure','lstatSync','readdirSync','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','parse','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','views','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','scriptName','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','icon','icon-apps','plugins','Warning:\x20admin\x20view\x20not\x20specified','Warning:\x20agent\x20view\x20not\x20specified','script','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','dirname','webhookGet','resolve','hostname','port','http://localhost:','encoding','method','%s%s','headers','content-length','content-type','endsWith','statusCode','webhookPost','\x27PATH\x27\x20parameter\x20not\x20specified','\x27PORT\x27\x20parameter\x20not\x20specified','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','archiver','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','redis','defaults','./plugin.socket','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','then','destroy','get','Plugins','UserProfileResource','sendStatus','error','stack','name','send','index','map','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge'];(function(_0x854a47,_0x414f99){var _0x34d49f=function(_0x62a29a){while(--_0x62a29a){_0x854a47['push'](_0x854a47['shift']());}};_0x34d49f(++_0x414f99);}(_0x8a4e,0x108));var _0xe8a4=function(_0x15185f,_0x2003a5){_0x15185f=_0x15185f-0x0;var _0x3c9c47=_0x8a4e[_0x15185f];return _0x3c9c47;};'use strict';var emlformat=require(_0xe8a4('0x0'));var rimraf=require(_0xe8a4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe8a4('0x2'));var rp=require(_0xe8a4('0x3'));var moment=require(_0xe8a4('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xe8a4('0x5'));var util=require(_0xe8a4('0x6'));var path=require(_0xe8a4('0x7'));var sox=require(_0xe8a4('0x8'));var csv=require(_0xe8a4('0x9'));var ejs=require(_0xe8a4('0xa'));var fs=require('fs');var fs_extra=require(_0xe8a4('0xb'));var _=require(_0xe8a4('0xc'));var squel=require(_0xe8a4('0xd'));var crypto=require(_0xe8a4('0xe'));var jsforce=require(_0xe8a4('0xf'));var deskjs=require(_0xe8a4('0x10'));var toCsv=require('to-csv');var querystring=require(_0xe8a4('0x11'));var Papa=require(_0xe8a4('0x12'));var extract=require('extract-zip');var rimraf=require(_0xe8a4('0x1'));var archiver=require(_0xe8a4('0x13'));var Redis=require(_0xe8a4('0x14'));var authService=require('../../components/auth/service');var qs=require(_0xe8a4('0x15'));var as=require(_0xe8a4('0x16'));var hardwareService=require(_0xe8a4('0x17'));var logger=require(_0xe8a4('0x18'))('api');var utils=require('../../config/utils');var config=require(_0xe8a4('0x19'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xe8a4('0x1a')]=_[_0xe8a4('0x1b')](config[_0xe8a4('0x1a')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe8a4('0x1a')]));require(_0xe8a4('0x1c'))['register'](socket);function respondWithStatusCode(_0x16027f,_0x52bc2a){_0x52bc2a=_0x52bc2a||0xcc;return function(_0x33d4c8){if(_0x33d4c8){return _0x16027f['sendStatus'](_0x52bc2a);}return _0x16027f[_0xe8a4('0x1d')](_0x52bc2a)[_0xe8a4('0x1e')]();};}function respondWithResult(_0x18ff45,_0x3c3283){_0x3c3283=_0x3c3283||0xc8;return function(_0x2aefa3){if(_0x2aefa3){return _0x18ff45[_0xe8a4('0x1d')](_0x3c3283)['json'](_0x2aefa3);}};}function respondWithFilteredResult(_0x2c1a78,_0xe2dc9){return function(_0x4932de){if(_0x4932de){var _0x5bba68=typeof _0xe2dc9[_0xe8a4('0x1f')]===_0xe8a4('0x20')&&typeof _0xe2dc9[_0xe8a4('0x21')]===_0xe8a4('0x20');var _0x33533f=_0x4932de['count'];var _0x34fb6a=_0x5bba68?0x0:_0xe2dc9[_0xe8a4('0x1f')];var _0x2afe85=_0x5bba68?_0x4932de[_0xe8a4('0x22')]:_0xe2dc9[_0xe8a4('0x1f')]+_0xe2dc9[_0xe8a4('0x21')];var _0x56b925;if(_0x2afe85>=_0x33533f){_0x2afe85=_0x33533f;_0x56b925=0xc8;}else{_0x56b925=0xce;}_0x2c1a78[_0xe8a4('0x1d')](_0x56b925);return _0x2c1a78[_0xe8a4('0x23')](_0xe8a4('0x24'),_0x34fb6a+'-'+_0x2afe85+'/'+_0x33533f)[_0xe8a4('0x25')](_0x4932de);}return null;};}function patchUpdates(_0x4c6e55){return function(_0x20def8){try{jsonpatch[_0xe8a4('0x26')](_0x20def8,_0x4c6e55,!![]);}catch(_0x604a39){return BPromise['reject'](_0x604a39);}return _0x20def8[_0xe8a4('0x27')]();};}function saveUpdates(_0x57e4b2,_0x4841a3){return function(_0x109e9c){if(_0x109e9c){return _0x109e9c[_0xe8a4('0x28')](_0x57e4b2)[_0xe8a4('0x29')](function(_0x43c9bb){return _0x43c9bb;});}return null;};}function removeEntity(_0x224fc0,_0x269dad){return function(_0x119188){if(_0x119188){return _0x119188[_0xe8a4('0x2a')]()[_0xe8a4('0x29')](function(){var _0xbb89d8=_0x119188[_0xe8a4('0x2b')]({'plain':!![]});var _0x44412a=_0xe8a4('0x2c');return db[_0xe8a4('0x2d')]['destroy']({'where':{'type':_0x44412a,'resourceId':_0xbb89d8['id']}})['then'](function(){return _0x119188;});})[_0xe8a4('0x29')](function(){_0x224fc0[_0xe8a4('0x1d')](0xcc)[_0xe8a4('0x1e')]();});}};}function handleEntityNotFound(_0x16d376,_0x5adba2){return function(_0x162291){if(!_0x162291){_0x16d376[_0xe8a4('0x2e')](0x194);}return _0x162291;};}function handleError(_0x20283a,_0x57a05c){_0x57a05c=_0x57a05c||0x1f4;return function(_0xf7d9c9){logger[_0xe8a4('0x2f')](_0xf7d9c9[_0xe8a4('0x30')]);if(_0xf7d9c9['name']){delete _0xf7d9c9[_0xe8a4('0x31')];}_0x20283a['status'](_0x57a05c)[_0xe8a4('0x32')](_0xf7d9c9);};}exports[_0xe8a4('0x33')]=function(_0x3c04f8,_0x33859e){var _0x15ccb6={},_0xd7be6f={},_0x301f90={'count':0x0,'rows':[]};var _0x551bb6=_[_0xe8a4('0x34')](db['Plugin']['rawAttributes'],function(_0x5d353b){return{'name':_0x5d353b['fieldName'],'type':_0x5d353b[_0xe8a4('0x35')][_0xe8a4('0x36')]};});_0xd7be6f[_0xe8a4('0x37')]=_[_0xe8a4('0x34')](_0x551bb6,_0xe8a4('0x31'));_0xd7be6f[_0xe8a4('0x38')]=_[_0xe8a4('0x39')](_0x3c04f8[_0xe8a4('0x38')]);_0xd7be6f[_0xe8a4('0x3a')]=_[_0xe8a4('0x3b')](_0xd7be6f['model'],_0xd7be6f[_0xe8a4('0x38')]);_0x15ccb6['attributes']=_['intersection'](_0xd7be6f[_0xe8a4('0x37')],qs[_0xe8a4('0x3c')](_0x3c04f8[_0xe8a4('0x38')][_0xe8a4('0x3c')]));_0x15ccb6[_0xe8a4('0x3d')]=_0x15ccb6[_0xe8a4('0x3d')][_0xe8a4('0x3e')]?_0x15ccb6[_0xe8a4('0x3d')]:_0xd7be6f[_0xe8a4('0x37')];if(!_0x3c04f8[_0xe8a4('0x38')][_0xe8a4('0x3f')]('nolimit')){_0x15ccb6[_0xe8a4('0x21')]=qs['limit'](_0x3c04f8[_0xe8a4('0x38')][_0xe8a4('0x21')]);_0x15ccb6['offset']=qs[_0xe8a4('0x1f')](_0x3c04f8[_0xe8a4('0x38')]['offset']);}_0x15ccb6[_0xe8a4('0x40')]=qs[_0xe8a4('0x41')](_0x3c04f8['query'][_0xe8a4('0x41')]);_0x15ccb6[_0xe8a4('0x42')]=qs[_0xe8a4('0x3a')](_[_0xe8a4('0x43')](_0x3c04f8[_0xe8a4('0x38')],_0xd7be6f[_0xe8a4('0x3a')]),_0x551bb6);if(_0x3c04f8[_0xe8a4('0x38')][_0xe8a4('0x44')]){_0x15ccb6[_0xe8a4('0x42')]=_[_0xe8a4('0x45')](_0x15ccb6[_0xe8a4('0x42')],{'$or':_[_0xe8a4('0x34')](_0x551bb6,function(_0xda8fee){if(_0xda8fee[_0xe8a4('0x35')]!=='VIRTUAL'){var _0x2dd3eb={};_0x2dd3eb[_0xda8fee[_0xe8a4('0x31')]]={'$like':'%'+_0x3c04f8[_0xe8a4('0x38')][_0xe8a4('0x44')]+'%'};return _0x2dd3eb;}})});}_0x15ccb6=_[_0xe8a4('0x45')]({},_0x15ccb6,_0x3c04f8[_0xe8a4('0x46')]);var _0x44d255={'where':_0x15ccb6[_0xe8a4('0x42')]};return db[_0xe8a4('0x47')]['count'](_0x44d255)[_0xe8a4('0x29')](function(_0x40bbec){_0x301f90[_0xe8a4('0x22')]=_0x40bbec;if(_0x3c04f8['query'][_0xe8a4('0x48')]){_0x15ccb6[_0xe8a4('0x49')]=[{'all':!![]}];}return db[_0xe8a4('0x47')][_0xe8a4('0x4a')](_0x15ccb6);})[_0xe8a4('0x29')](function(_0x38385a){_0x301f90[_0xe8a4('0x4b')]=_0x38385a;return _0x301f90;})[_0xe8a4('0x29')](respondWithFilteredResult(_0x33859e,_0x15ccb6))['catch'](handleError(_0x33859e,null));};exports['show']=function(_0x542d76,_0x2e8fbd){var _0x1c30ff={'raw':!![],'where':{'id':_0x542d76['params']['id']}},_0x1cf86e={};_0x1cf86e[_0xe8a4('0x37')]=_[_0xe8a4('0x39')](db[_0xe8a4('0x47')]['rawAttributes']);_0x1cf86e[_0xe8a4('0x38')]=_[_0xe8a4('0x39')](_0x542d76[_0xe8a4('0x38')]);_0x1cf86e[_0xe8a4('0x3a')]=_[_0xe8a4('0x3b')](_0x1cf86e[_0xe8a4('0x37')],_0x1cf86e['query']);_0x1c30ff[_0xe8a4('0x3d')]=_[_0xe8a4('0x3b')](_0x1cf86e[_0xe8a4('0x37')],qs[_0xe8a4('0x3c')](_0x542d76['query'][_0xe8a4('0x3c')]));_0x1c30ff[_0xe8a4('0x3d')]=_0x1c30ff['attributes'][_0xe8a4('0x3e')]?_0x1c30ff['attributes']:_0x1cf86e[_0xe8a4('0x37')];if(_0x542d76[_0xe8a4('0x38')][_0xe8a4('0x48')]){_0x1c30ff['include']=[{'all':!![]}];}_0x1c30ff=_[_0xe8a4('0x45')]({},_0x1c30ff,_0x542d76[_0xe8a4('0x46')]);return db['Plugin'][_0xe8a4('0x4c')](_0x1c30ff)['then'](handleEntityNotFound(_0x2e8fbd,null))[_0xe8a4('0x29')](respondWithResult(_0x2e8fbd,null))[_0xe8a4('0x4d')](handleError(_0x2e8fbd,null));};exports['download']=function(_0x49809d,_0x5aa98f,_0x3cf76a){return db['Plugin'][_0xe8a4('0x4c')]({'where':{'id':_0x49809d[_0xe8a4('0x4e')]['id']},'attributes':[_0xe8a4('0x31'),'path'],'raw':!![]})['then'](handleEntityNotFound(_0x5aa98f,null))[_0xe8a4('0x29')](function(_0x5c382e){if(_0x5c382e){var _0x5d9786=path[_0xe8a4('0x4f')](config['root'],_0xe8a4('0x50'),util[_0xe8a4('0x51')](_0xe8a4('0x52'),path[_0xe8a4('0x53')](_0x5c382e[_0xe8a4('0x7')])));var _0x30053a=fs[_0xe8a4('0x54')](_0x5d9786);var _0x4ef7e5=archiver(_0xe8a4('0x55'),{'zlib':{'level':0x9}});_0x4ef7e5['on'](_0xe8a4('0x56'),function(_0x34f61b){if(_0x34f61b[_0xe8a4('0x57')]===_0xe8a4('0x58')){logger[_0xe8a4('0x2f')](_0x34f61b);}else{throw new db['Sequelize'][(_0xe8a4('0x59'))](_0xe8a4('0x5a'));}});_0x4ef7e5['on'](_0xe8a4('0x2f'),function(_0x541573){throw new db[(_0xe8a4('0x5b'))][(_0xe8a4('0x59'))](_0xe8a4('0x5a'));});_0x4ef7e5['pipe'](_0x30053a);_0x4ef7e5[_0xe8a4('0x5c')](_0xe8a4('0x5d'),{'cwd':path[_0xe8a4('0x4f')](config[_0xe8a4('0x5e')],_0xe8a4('0x50'),path['dirname'](_0x5c382e['path'])),'ignore':[path[_0xe8a4('0x4f')](path['basename'](_0x5c382e[_0xe8a4('0x7')]),_0xe8a4('0x5f')),path['join'](path[_0xe8a4('0x53')](_0x5c382e[_0xe8a4('0x7')]),'attachments/**/*')],'nodir':!![]})['finalize']();_0x30053a['on']('close',function(){if(!fs[_0xe8a4('0x60')](_0x5d9786)){throw new db[(_0xe8a4('0x5b'))][(_0xe8a4('0x59'))](_0xe8a4('0x61'));}return _0x5aa98f[_0xe8a4('0x62')](_0x5d9786,util[_0xe8a4('0x51')](_0xe8a4('0x52'),path[_0xe8a4('0x53')](_0x5c382e[_0xe8a4('0x7')])),function(_0x1bc08a){if(_0x1bc08a){throw new db[(_0xe8a4('0x5b'))][(_0xe8a4('0x59'))](_0xe8a4('0x63'));}fs['unlinkSync'](_0x5d9786);logger[_0xe8a4('0x64')](_0xe8a4('0x65'));logger['info'](_0xe8a4('0x66'));});});}return null;})[_0xe8a4('0x4d')](handleError(_0x5aa98f,null));};exports[_0xe8a4('0x67')]=function(_0xa02c81,_0x269160,_0x509510){var _0x595c3c=path[_0xe8a4('0x53')](_0xa02c81[_0xe8a4('0x68')][_0xe8a4('0x69')],path[_0xe8a4('0x6a')](_0xa02c81[_0xe8a4('0x68')][_0xe8a4('0x69')]));var _0x44af30=path[_0xe8a4('0x4f')](config['root'],_0xe8a4('0x50'),_0xa02c81['file'][_0xe8a4('0x69')]);var _0x4c7870=path[_0xe8a4('0x4f')](config['root'],_0xe8a4('0x50'),_0x595c3c);logger[_0xe8a4('0x64')](_0xe8a4('0x6b'),_0x44af30);logger[_0xe8a4('0x64')](_0xe8a4('0x6c'),_0x4c7870);try{fs['chmodSync'](_0x44af30,parseInt(_0xe8a4('0x6d'),0x8));extract(_0x44af30,{'dir':_0x4c7870},function(_0x12c2c1){if(_0x12c2c1){logger[_0xe8a4('0x2f')](_0x12c2c1);handleError(_0x12c2c1,!![]);};var _0x3c5ad8=fs['readdirSync'](_0x4c7870);if(_0x3c5ad8[_0xe8a4('0x3e')]>0x1){removeReferences(_0x44af30,_0x4c7870);logger[_0xe8a4('0x2f')](_0xe8a4('0x6e'));return _0x509510(new Error('Invalid\x20plugin\x20structure'));}var _0x559850=fs[_0xe8a4('0x6f')](path[_0xe8a4('0x4f')](_0x4c7870,_0x3c5ad8[0x0]));if(_0x559850['isFile']()){removeReferences(_0x44af30,_0x4c7870);logger[_0xe8a4('0x2f')](_0xe8a4('0x6e'));return _0x509510(new Error('Invalid\x20plugin\x20structure'));}if(_0x559850['isDirectory']()){var _0x10a1b9=fs[_0xe8a4('0x70')](path[_0xe8a4('0x4f')](_0x4c7870,_0x3c5ad8[0x0]));if(_0x10a1b9['length']===0x0){removeReferences(_0x44af30,_0x4c7870);logger['error'](_0xe8a4('0x6e'));return _0x509510(new Error('Invalid\x20plugin\x20structure'));}var _0x2c0c8a=_0x10a1b9[_0xe8a4('0x71')](function(_0x30115b){return _0x30115b===_0xe8a4('0x72');});if(!_0x2c0c8a){return _0x509510(new Error(_0xe8a4('0x73')));}var _0x34ef4d=fs[_0xe8a4('0x74')](path[_0xe8a4('0x4f')](_0x4c7870,_0x3c5ad8[0x0],_0xe8a4('0x72')));var _0x327597=JSON[_0xe8a4('0x75')](_0x34ef4d);if(_0xe8a4('0x20')==typeof _0x327597[_0xe8a4('0x31')]){return _0x509510(new Error(_0xe8a4('0x76')));}if(_0xe8a4('0x20')==typeof _0x327597[_0xe8a4('0x35')]){return _0x509510(new Error(_0xe8a4('0x77')));}if(_0xe8a4('0x20')==typeof _0x327597[_0xe8a4('0x78')]){return _0x509510(new Error('Invalid\x20manifest:\x20version\x20not\x20specified'));}if(_0xe8a4('0x20')==typeof _0x327597[_0xe8a4('0x79')]){return _0x509510(new Error(_0xe8a4('0x7a')));}if(_0x327597['type']===_0xe8a4('0x7b')){if('undefined'==typeof _0x327597[_0xe8a4('0x79')]['views']){return _0x509510(new Error('Invalid\x20manifest:\x20views\x20missing'));}if(_0xe8a4('0x20')==typeof _0x327597[_0xe8a4('0x79')][_0xe8a4('0x7c')][_0xe8a4('0x7d')]&&_0xe8a4('0x20')==typeof _0x327597[_0xe8a4('0x79')][_0xe8a4('0x7c')][_0xe8a4('0x7e')]){return _0x509510(new Error(_0xe8a4('0x7f')));}}else if(_0x327597[_0xe8a4('0x35')]==='script'){if('undefined'==typeof _0x327597[_0xe8a4('0x79')][_0xe8a4('0x80')]){return _0x509510(new Error('Invalid\x20manifest:\x20script\x20name\x20missing'));}if(_0xe8a4('0x20')==typeof _0x327597[_0xe8a4('0x79')][_0xe8a4('0x81')]){return _0x509510(new Error(_0xe8a4('0x82')));}}else{return _0x509510(new Error(_0xe8a4('0x83')));}var _0x3d6ef7=_0x327597[_0xe8a4('0x31')];var _0x2d7656=_0x327597[_0xe8a4('0x84')];var _0x5ef61e=_0x327597[_0xe8a4('0x35')];var _0x5c3ac1=_0x327597[_0xe8a4('0x85')]?_0x327597[_0xe8a4('0x85')]:'always';var _0x27896d=_0x327597[_0xe8a4('0x86')]?_0x327597[_0xe8a4('0x86')]:_0xe8a4('0x87');var _0x527d80='';var _0x590fa5='';var _0x264d4a='';var _0x4dd010='';var _0x27cf60=_0x327597['version'];if(_0x5ef61e===_0xe8a4('0x7b')){if(_0xe8a4('0x20')!=typeof _0x327597['parameters'][_0xe8a4('0x7c')][_0xe8a4('0x7d')]){var _0x3ad2c4=_0x327597[_0xe8a4('0x79')]['views'][_0xe8a4('0x7d')];if(!/^(f|ht)tps?:\/\//i['test'](_0x3ad2c4)){_0x527d80=path[_0xe8a4('0x4f')](_0xe8a4('0x88'),_0x595c3c,_0x3c5ad8[0x0],_0x3ad2c4);}else{_0x527d80=_0x3ad2c4;}}else{logger[_0xe8a4('0x64')](_0xe8a4('0x89'));}if(_0xe8a4('0x20')!=typeof _0x327597[_0xe8a4('0x79')]['views'][_0xe8a4('0x7e')]){var _0x580381=_0x327597[_0xe8a4('0x79')]['views'][_0xe8a4('0x7e')];if(!/^(f|ht)tps?:\/\//i['test'](_0x580381)){_0x590fa5=path[_0xe8a4('0x4f')]('plugins',_0x595c3c,_0x3c5ad8[0x0],_0x580381);}else{_0x590fa5=_0x580381;}}else{logger[_0xe8a4('0x64')](_0xe8a4('0x8a'));}}else if(_0x5ef61e===_0xe8a4('0x8b')){_0x264d4a=_0x327597[_0xe8a4('0x79')][_0xe8a4('0x80')];_0x4dd010=_0x327597[_0xe8a4('0x79')][_0xe8a4('0x81')];if(_0xe8a4('0x20')!=typeof _0x327597['parameters'][_0xe8a4('0x7c')]){if('undefined'!=typeof _0x327597[_0xe8a4('0x79')][_0xe8a4('0x7c')]['admin']){var _0x3ad2c4=_0x327597[_0xe8a4('0x79')][_0xe8a4('0x7c')][_0xe8a4('0x7d')];if(!/^(f|ht)tps?:\/\//i['test'](_0x3ad2c4)){_0x527d80=path[_0xe8a4('0x4f')](_0xe8a4('0x88'),_0x595c3c,_0x3c5ad8[0x0],_0x3ad2c4);}else{_0x527d80=_0x3ad2c4;}}if(_0xe8a4('0x20')!=typeof _0x327597[_0xe8a4('0x79')]['views'][_0xe8a4('0x7e')]){var _0x580381=_0x327597['parameters'][_0xe8a4('0x7c')][_0xe8a4('0x7e')];if(!/^(f|ht)tps?:\/\//i['test'](_0x580381)){_0x590fa5=path['join']('plugins',_0x595c3c,_0x3c5ad8[0x0],_0x580381);}else{_0x590fa5=_0x580381;}}}}var _0x48c3f6={'name':_0x3d6ef7,'description':_0x2d7656,'path':path[_0xe8a4('0x4f')](_0x595c3c,_0x3c5ad8[0x0]),'type':_0x5ef61e,'sidebar':_0x5c3ac1,'icon':_0x27896d,'adminUrl':_0x527d80,'agentUrl':_0x590fa5,'scriptName':_0x264d4a,'scriptPath':_0x4dd010,'version':_0x27cf60};removeReferences(_0x44af30,null);return db['Plugin']['create'](_0x48c3f6)[_0xe8a4('0x29')](function(_0x54666c){var _0x397e6e={'role':_0xa02c81[_0xe8a4('0x8c')]['role'],'userProfileId':_0xa02c81['body']['userProfileId']};if(!_0x397e6e)throw new Error(_0xe8a4('0x8d'));if(_0x397e6e['role']===_0xe8a4('0x8e')){var _0x392fa4=_0x54666c['get']({'plain':!![]});return db[_0xe8a4('0x8f')]['find']({'where':{'name':_0xe8a4('0x2c'),'userProfileId':_0x397e6e[_0xe8a4('0x90')]},'raw':!![]})[_0xe8a4('0x29')](function(_0x59793e){if(_0x59793e&&_0x59793e[_0xe8a4('0x91')]===0x0){return db[_0xe8a4('0x2d')][_0xe8a4('0x92')]({'name':_0x392fa4[_0xe8a4('0x31')],'resourceId':_0x392fa4['id'],'type':_0x59793e[_0xe8a4('0x31')],'sectionId':_0x59793e['id']},{})[_0xe8a4('0x29')](function(){return _0x54666c;});}else{return _0x54666c;}})[_0xe8a4('0x4d')](function(_0x2414f3){logger[_0xe8a4('0x2f')](_0xe8a4('0x93'),_0x2414f3);throw _0x2414f3;});}return _0x54666c;})['then'](respondWithResult(_0x269160,null))[_0xe8a4('0x4d')](handleError(_0x269160,null));}});}catch(_0x35f45a){_0x269160['status'](0x1f4)[_0xe8a4('0x32')](_0x35f45a);}};function removeReferences(_0x5d58bc,_0x50301b){try{if(_0x5d58bc){fs['unlinkSync'](_0x5d58bc);logger[_0xe8a4('0x64')](_0xe8a4('0x94'));}if(_0x50301b){rimraf(_0x50301b,function(){});logger[_0xe8a4('0x64')](_0xe8a4('0x95'));}}catch(_0x37af72){logger[_0xe8a4('0x2f')](_0x37af72);}}exports[_0xe8a4('0x28')]=function(_0x168ef8,_0x27f540,_0x354523){return db[_0xe8a4('0x47')][_0xe8a4('0x4c')]({'where':{'id':_0x168ef8[_0xe8a4('0x4e')]['id']}})['then'](handleEntityNotFound(_0x27f540,null))[_0xe8a4('0x29')](saveUpdates(_0x168ef8['body'],null))[_0xe8a4('0x29')](respondWithResult(_0x27f540,null))['catch'](handleError(_0x27f540,null));};exports['delete']=function(_0x4ee139,_0x24a86e,_0x502444){return db[_0xe8a4('0x47')][_0xe8a4('0x4c')]({'where':{'id':_0x4ee139[_0xe8a4('0x4e')]['id']}})[_0xe8a4('0x29')](function(_0x10b51b){if(_0x10b51b){return _0x10b51b['destroy']();}})['then'](function(_0x24bf07){rimraf(path[_0xe8a4('0x4f')](config['root'],_0xe8a4('0x50'),path[_0xe8a4('0x96')](_0x24bf07[_0xe8a4('0x7')])),function(){});return _0x24bf07;})['then'](handleEntityNotFound(_0x24a86e,null))[_0xe8a4('0x29')](respondWithStatusCode(_0x24a86e,null))[_0xe8a4('0x4d')](handleError(_0x24a86e,null));};exports[_0xe8a4('0x97')]=function(_0xdbc7bc,_0x11969c,_0x10b696){return BPromise[_0xe8a4('0x98')]()[_0xe8a4('0x29')](function(){if(!_0xdbc7bc[_0xe8a4('0x38')][_0xe8a4('0x7')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0xdbc7bc[_0xe8a4('0x38')]['port']){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x621ffb=_0xdbc7bc[_0xe8a4('0x38')][_0xe8a4('0x99')]?_0xdbc7bc[_0xe8a4('0x38')][_0xe8a4('0x99')]+':'+_0xdbc7bc[_0xe8a4('0x38')][_0xe8a4('0x9a')]:_0xe8a4('0x9b')+_0xdbc7bc[_0xe8a4('0x38')][_0xe8a4('0x9a')];var _0x48f1b7=_0xdbc7bc['query'][_0xe8a4('0x25')]?_0xdbc7bc[_0xe8a4('0x38')][_0xe8a4('0x25')]:!![];var _0x479dfe=_0xdbc7bc[_0xe8a4('0x38')]['encoding']?_0xdbc7bc['query'][_0xe8a4('0x9c')]:null;var _0xdf7439={'method':_0xdbc7bc[_0xe8a4('0x9d')],'uri':util[_0xe8a4('0x51')](_0xe8a4('0x9e'),_0x621ffb,_0xdbc7bc[_0xe8a4('0x38')][_0xe8a4('0x7')]),'json':_0x48f1b7,'resolveWithFullResponse':!![],'encoding':_0x479dfe,'qs':_0xdbc7bc[_0xe8a4('0x38')]};if(_0xdbc7bc[_0xe8a4('0x9f')]){_0xdf7439[_0xe8a4('0x9f')]=_0xdbc7bc[_0xe8a4('0x9f')];if(_0xdf7439[_0xe8a4('0x9f')][_0xe8a4('0xa0')]){delete _0xdf7439[_0xe8a4('0x9f')][_0xe8a4('0xa0')];}}if(_0xdf7439[_0xe8a4('0x9f')][_0xe8a4('0xa1')]){delete _0xdf7439[_0xe8a4('0x9f')][_0xe8a4('0xa1')];}return rp(_0xdf7439);})['then'](function(_0x771de9){if(_0x771de9){_0x11969c[_0xe8a4('0x23')](_0x771de9[_0xe8a4('0x9f')]);logger['info'](_0x771de9[_0xe8a4('0x8c')]);if(_[_0xe8a4('0xa2')](_0xdbc7bc['query'][_0xe8a4('0x7')],_0xe8a4('0x62'))&&_0x771de9[_0xe8a4('0xa3')]==0x1f4){return _0x11969c[_0xe8a4('0x2e')](_0x771de9[_0xe8a4('0xa3')]);}else{return _0x11969c[_0xe8a4('0x1d')](_0x771de9[_0xe8a4('0xa3')])[_0xe8a4('0x32')](_0x771de9['body']);}}else{return _0x11969c[_0xe8a4('0x2e')](0xc8);}})[_0xe8a4('0x4d')](handleError(_0x11969c,null));};exports[_0xe8a4('0xa4')]=function(_0x290f09,_0x6bf6ef,_0x4e6af8){return BPromise[_0xe8a4('0x98')]()['then'](function(){if(!_0x290f09[_0xe8a4('0x38')][_0xe8a4('0x7')]){throw new Error(_0xe8a4('0xa5'));}if(!_0x290f09[_0xe8a4('0x38')][_0xe8a4('0x9a')]){throw new Error(_0xe8a4('0xa6'));}var _0x42f4d5=_0x290f09[_0xe8a4('0x38')][_0xe8a4('0x99')]?_0x290f09[_0xe8a4('0x38')][_0xe8a4('0x99')]+':'+_0x290f09['query']['port']:_0xe8a4('0x9b')+_0x290f09[_0xe8a4('0x38')][_0xe8a4('0x9a')];var _0x3ba456=_0x290f09[_0xe8a4('0x38')][_0xe8a4('0x25')]?_0x290f09[_0xe8a4('0x38')][_0xe8a4('0x25')]:!![];var _0x3cc506=_0x290f09[_0xe8a4('0x38')][_0xe8a4('0x9c')]?_0x290f09['query'][_0xe8a4('0x9c')]:null;var _0x44d3de={'method':_0x290f09[_0xe8a4('0x9d')],'uri':util[_0xe8a4('0x51')](_0xe8a4('0x9e'),_0x42f4d5,_0x290f09['query'][_0xe8a4('0x7')]),'json':_0x3ba456,'resolveWithFullResponse':!![],'encoding':_0x3cc506,'body':_0x290f09[_0xe8a4('0x8c')]};if(_0x290f09[_0xe8a4('0x9f')]){_0x44d3de[_0xe8a4('0x9f')]=_0x290f09['headers'];if(_0x44d3de[_0xe8a4('0x9f')][_0xe8a4('0xa0')]){delete _0x44d3de[_0xe8a4('0x9f')][_0xe8a4('0xa0')];}}if(_0x44d3de[_0xe8a4('0x9f')][_0xe8a4('0xa1')]){delete _0x44d3de[_0xe8a4('0x9f')][_0xe8a4('0xa1')];}return rp(_0x44d3de);})[_0xe8a4('0x29')](function(_0x28eb2b){if(_0x28eb2b){_0x6bf6ef[_0xe8a4('0x23')](_0x28eb2b['headers']);logger['info'](_0x28eb2b[_0xe8a4('0x8c')]);return _0x6bf6ef[_0xe8a4('0x1d')](_0x28eb2b[_0xe8a4('0xa3')])['send'](_0x28eb2b[_0xe8a4('0x8c')]);}else{return _0x6bf6ef['sendStatus'](0xc8);}})[_0xe8a4('0x4d')](handleError(_0x6bf6ef,null));}; \ No newline at end of file +var _0x77c0=['mustache','util','sox','to-csv','crypto','jsforce','desk.js','querystring','papaparse','rimraf','archiver','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','defaults','redis','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','Plugins','UserProfileResource','error','stack','name','send','map','Plugin','rawAttributes','fieldName','type','query','keys','filters','model','attributes','intersection','fields','length','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','catch','params','include','find','download','path','join','root','server/files/plugins','format','%s.zip','basename','createWriteStream','zip','warning','code','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','dirname','node_modules/**/*','attachments/**/*','finalize','existsSync','Plugin\x20not\x20found','info','Temporary\x20file\x20removed','upload','file','filename','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','parse','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','html','views','admin','agent','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','sidebar','icon','icon-apps','Warning:\x20admin\x20view\x20not\x20specified','test','plugins','Warning:\x20agent\x20view\x20not\x20specified','body','role','UserProfileSection','userProfileId','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','unlinkSync','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','delete','webhookGet','resolve','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','method','%s%s','headers','content-length','content-type','endsWith','statusCode','webhookPost','\x27PATH\x27\x20parameter\x20not\x20specified','fast-json-patch','request-promise','moment','bluebird'];(function(_0x1ab180,_0x382b2c){var _0xfb2c2d=function(_0x1c5fd3){while(--_0x1c5fd3){_0x1ab180['push'](_0x1ab180['shift']());}};_0xfb2c2d(++_0x382b2c);}(_0x77c0,0x9e));var _0x077c=function(_0x326652,_0x7da8aa){_0x326652=_0x326652-0x0;var _0x36e1f3=_0x77c0[_0x326652];return _0x36e1f3;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x077c('0x0'));var rp=require(_0x077c('0x1'));var moment=require(_0x077c('0x2'));var BPromise=require(_0x077c('0x3'));var Mustache=require(_0x077c('0x4'));var util=require(_0x077c('0x5'));var path=require('path');var sox=require(_0x077c('0x6'));var csv=require(_0x077c('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(_0x077c('0x8'));var jsforce=require(_0x077c('0x9'));var deskjs=require(_0x077c('0xa'));var toCsv=require(_0x077c('0x7'));var querystring=require(_0x077c('0xb'));var Papa=require(_0x077c('0xc'));var extract=require('extract-zip');var rimraf=require(_0x077c('0xd'));var archiver=require(_0x077c('0xe'));var Redis=require('ioredis');var authService=require(_0x077c('0xf'));var qs=require(_0x077c('0x10'));var as=require(_0x077c('0x11'));var hardwareService=require(_0x077c('0x12'));var logger=require(_0x077c('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x077c('0x14'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x077c('0x15')](config[_0x077c('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0x077c('0x17'))(new Redis(config['redis']));require('./plugin.socket')[_0x077c('0x18')](socket);function respondWithStatusCode(_0x41146b,_0x45b43b){_0x45b43b=_0x45b43b||0xcc;return function(_0x5038c2){if(_0x5038c2){return _0x41146b[_0x077c('0x19')](_0x45b43b);}return _0x41146b[_0x077c('0x1a')](_0x45b43b)[_0x077c('0x1b')]();};}function respondWithResult(_0xe1ea29,_0x2cfc19){_0x2cfc19=_0x2cfc19||0xc8;return function(_0x8c3784){if(_0x8c3784){return _0xe1ea29[_0x077c('0x1a')](_0x2cfc19)[_0x077c('0x1c')](_0x8c3784);}};}function respondWithFilteredResult(_0x1e3a4a,_0x255b06){return function(_0x7de785){if(_0x7de785){var _0x760a82=typeof _0x255b06[_0x077c('0x1d')]===_0x077c('0x1e')&&typeof _0x255b06[_0x077c('0x1f')]===_0x077c('0x1e');var _0x33af3f=_0x7de785[_0x077c('0x20')];var _0xa86e83=_0x760a82?0x0:_0x255b06[_0x077c('0x1d')];var _0x11717e=_0x760a82?_0x7de785[_0x077c('0x20')]:_0x255b06[_0x077c('0x1d')]+_0x255b06[_0x077c('0x1f')];var _0x4276e3;if(_0x11717e>=_0x33af3f){_0x11717e=_0x33af3f;_0x4276e3=0xc8;}else{_0x4276e3=0xce;}_0x1e3a4a[_0x077c('0x1a')](_0x4276e3);return _0x1e3a4a[_0x077c('0x21')](_0x077c('0x22'),_0xa86e83+'-'+_0x11717e+'/'+_0x33af3f)[_0x077c('0x1c')](_0x7de785);}return null;};}function patchUpdates(_0x58d655){return function(_0x3098fa){try{jsonpatch[_0x077c('0x23')](_0x3098fa,_0x58d655,!![]);}catch(_0x375d37){return BPromise[_0x077c('0x24')](_0x375d37);}return _0x3098fa[_0x077c('0x25')]();};}function saveUpdates(_0x52b985,_0x589cb9){return function(_0x2a8b55){if(_0x2a8b55){return _0x2a8b55[_0x077c('0x26')](_0x52b985)[_0x077c('0x27')](function(_0x4000c7){return _0x4000c7;});}return null;};}function removeEntity(_0x256a32,_0x1a2bb6){return function(_0x1920a0){if(_0x1920a0){return _0x1920a0[_0x077c('0x28')]()[_0x077c('0x27')](function(){var _0x15648b=_0x1920a0[_0x077c('0x29')]({'plain':!![]});var _0x5dedf7=_0x077c('0x2a');return db[_0x077c('0x2b')][_0x077c('0x28')]({'where':{'type':_0x5dedf7,'resourceId':_0x15648b['id']}})[_0x077c('0x27')](function(){return _0x1920a0;});})['then'](function(){_0x256a32[_0x077c('0x1a')](0xcc)[_0x077c('0x1b')]();});}};}function handleEntityNotFound(_0xbbabae,_0x525e9a){return function(_0x46312a){if(!_0x46312a){_0xbbabae['sendStatus'](0x194);}return _0x46312a;};}function handleError(_0xb529b,_0xd3c3e7){_0xd3c3e7=_0xd3c3e7||0x1f4;return function(_0x1ed594){logger[_0x077c('0x2c')](_0x1ed594[_0x077c('0x2d')]);if(_0x1ed594[_0x077c('0x2e')]){delete _0x1ed594['name'];}_0xb529b[_0x077c('0x1a')](_0xd3c3e7)[_0x077c('0x2f')](_0x1ed594);};}exports['index']=function(_0x24e537,_0x592a91){var _0x5d9253={},_0x39fedf={},_0x3dda88={'count':0x0,'rows':[]};var _0x561af9=_[_0x077c('0x30')](db[_0x077c('0x31')][_0x077c('0x32')],function(_0x4dc5cb){return{'name':_0x4dc5cb[_0x077c('0x33')],'type':_0x4dc5cb[_0x077c('0x34')]['key']};});_0x39fedf['model']=_[_0x077c('0x30')](_0x561af9,_0x077c('0x2e'));_0x39fedf[_0x077c('0x35')]=_[_0x077c('0x36')](_0x24e537['query']);_0x39fedf[_0x077c('0x37')]=_['intersection'](_0x39fedf[_0x077c('0x38')],_0x39fedf[_0x077c('0x35')]);_0x5d9253[_0x077c('0x39')]=_[_0x077c('0x3a')](_0x39fedf[_0x077c('0x38')],qs[_0x077c('0x3b')](_0x24e537['query'][_0x077c('0x3b')]));_0x5d9253[_0x077c('0x39')]=_0x5d9253['attributes'][_0x077c('0x3c')]?_0x5d9253[_0x077c('0x39')]:_0x39fedf['model'];if(!_0x24e537[_0x077c('0x35')]['hasOwnProperty'](_0x077c('0x3d'))){_0x5d9253['limit']=qs[_0x077c('0x1f')](_0x24e537['query'][_0x077c('0x1f')]);_0x5d9253['offset']=qs[_0x077c('0x1d')](_0x24e537[_0x077c('0x35')][_0x077c('0x1d')]);}_0x5d9253['order']=qs['sort'](_0x24e537[_0x077c('0x35')][_0x077c('0x3e')]);_0x5d9253[_0x077c('0x3f')]=qs[_0x077c('0x37')](_[_0x077c('0x40')](_0x24e537[_0x077c('0x35')],_0x39fedf[_0x077c('0x37')]),_0x561af9);if(_0x24e537[_0x077c('0x35')]['filter']){_0x5d9253[_0x077c('0x3f')]=_[_0x077c('0x41')](_0x5d9253[_0x077c('0x3f')],{'$or':_[_0x077c('0x30')](_0x561af9,function(_0x498912){if(_0x498912['type']!==_0x077c('0x42')){var _0x363576={};_0x363576[_0x498912['name']]={'$like':'%'+_0x24e537['query'][_0x077c('0x43')]+'%'};return _0x363576;}})});}_0x5d9253=_[_0x077c('0x41')]({},_0x5d9253,_0x24e537[_0x077c('0x44')]);var _0x3348a8={'where':_0x5d9253[_0x077c('0x3f')]};return db['Plugin']['count'](_0x3348a8)[_0x077c('0x27')](function(_0x26ed53){_0x3dda88['count']=_0x26ed53;if(_0x24e537['query'][_0x077c('0x45')]){_0x5d9253['include']=[{'all':!![]}];}return db['Plugin']['findAll'](_0x5d9253);})[_0x077c('0x27')](function(_0x35c44f){_0x3dda88['rows']=_0x35c44f;return _0x3dda88;})['then'](respondWithFilteredResult(_0x592a91,_0x5d9253))[_0x077c('0x46')](handleError(_0x592a91,null));};exports['show']=function(_0x1895a,_0x5229c8){var _0x3f89c4={'raw':!![],'where':{'id':_0x1895a[_0x077c('0x47')]['id']}},_0x38b3e6={};_0x38b3e6[_0x077c('0x38')]=_[_0x077c('0x36')](db[_0x077c('0x31')][_0x077c('0x32')]);_0x38b3e6[_0x077c('0x35')]=_[_0x077c('0x36')](_0x1895a[_0x077c('0x35')]);_0x38b3e6[_0x077c('0x37')]=_[_0x077c('0x3a')](_0x38b3e6[_0x077c('0x38')],_0x38b3e6[_0x077c('0x35')]);_0x3f89c4[_0x077c('0x39')]=_['intersection'](_0x38b3e6[_0x077c('0x38')],qs[_0x077c('0x3b')](_0x1895a[_0x077c('0x35')][_0x077c('0x3b')]));_0x3f89c4['attributes']=_0x3f89c4['attributes'][_0x077c('0x3c')]?_0x3f89c4[_0x077c('0x39')]:_0x38b3e6[_0x077c('0x38')];if(_0x1895a[_0x077c('0x35')][_0x077c('0x45')]){_0x3f89c4[_0x077c('0x48')]=[{'all':!![]}];}_0x3f89c4=_[_0x077c('0x41')]({},_0x3f89c4,_0x1895a[_0x077c('0x44')]);return db[_0x077c('0x31')][_0x077c('0x49')](_0x3f89c4)[_0x077c('0x27')](handleEntityNotFound(_0x5229c8,null))[_0x077c('0x27')](respondWithResult(_0x5229c8,null))['catch'](handleError(_0x5229c8,null));};exports[_0x077c('0x4a')]=function(_0x2e65ed,_0x39378b,_0x1cb514){return db['Plugin'][_0x077c('0x49')]({'where':{'id':_0x2e65ed[_0x077c('0x47')]['id']},'attributes':[_0x077c('0x2e'),_0x077c('0x4b')],'raw':!![]})[_0x077c('0x27')](handleEntityNotFound(_0x39378b,null))['then'](function(_0x2a183c){if(_0x2a183c){var _0x2b80eb=path[_0x077c('0x4c')](config[_0x077c('0x4d')],_0x077c('0x4e'),util[_0x077c('0x4f')](_0x077c('0x50'),path[_0x077c('0x51')](_0x2a183c[_0x077c('0x4b')])));var _0x5038bf=fs[_0x077c('0x52')](_0x2b80eb);var _0x18e0f7=archiver(_0x077c('0x53'),{'zlib':{'level':0x9}});_0x18e0f7['on'](_0x077c('0x54'),function(_0x20d3e4){if(_0x20d3e4[_0x077c('0x55')]===_0x077c('0x56')){logger[_0x077c('0x2c')](_0x20d3e4);}else{throw new db[(_0x077c('0x57'))][(_0x077c('0x58'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');}});_0x18e0f7['on'](_0x077c('0x2c'),function(_0x387709){throw new db[(_0x077c('0x57'))][(_0x077c('0x58'))](_0x077c('0x59'));});_0x18e0f7[_0x077c('0x5a')](_0x5038bf);_0x18e0f7[_0x077c('0x5b')]('**/*',{'cwd':path[_0x077c('0x4c')](config[_0x077c('0x4d')],_0x077c('0x4e'),path[_0x077c('0x5c')](_0x2a183c[_0x077c('0x4b')])),'ignore':[path[_0x077c('0x4c')](path[_0x077c('0x51')](_0x2a183c[_0x077c('0x4b')]),_0x077c('0x5d')),path[_0x077c('0x4c')](path[_0x077c('0x51')](_0x2a183c[_0x077c('0x4b')]),_0x077c('0x5e'))],'nodir':!![]})[_0x077c('0x5f')]();_0x5038bf['on']('close',function(){if(!fs[_0x077c('0x60')](_0x2b80eb)){throw new db[(_0x077c('0x57'))][(_0x077c('0x58'))](_0x077c('0x61'));}return _0x39378b[_0x077c('0x4a')](_0x2b80eb,util[_0x077c('0x4f')](_0x077c('0x50'),path[_0x077c('0x51')](_0x2a183c[_0x077c('0x4b')])),function(_0xfec4d3){if(_0xfec4d3){throw new db[(_0x077c('0x57'))][(_0x077c('0x58'))]('Error\x20while\x20downloading\x20the\x20plugin');}fs['unlinkSync'](_0x2b80eb);logger[_0x077c('0x62')]('Download\x20completed');logger[_0x077c('0x62')](_0x077c('0x63'));});});}return null;})[_0x077c('0x46')](handleError(_0x39378b,null));};exports[_0x077c('0x64')]=function(_0x2efaaf,_0x454199,_0xd16254){var _0x257ac9=path[_0x077c('0x51')](_0x2efaaf[_0x077c('0x65')][_0x077c('0x66')],path['extname'](_0x2efaaf[_0x077c('0x65')]['filename']));var _0x3efbdb=path[_0x077c('0x4c')](config[_0x077c('0x4d')],_0x077c('0x4e'),_0x2efaaf[_0x077c('0x65')][_0x077c('0x66')]);var _0x1c5e6a=path['join'](config[_0x077c('0x4d')],'server/files/plugins',_0x257ac9);logger[_0x077c('0x62')]('Plugin\x20upload\x20filepath:\x20%s',_0x3efbdb);logger[_0x077c('0x62')](_0x077c('0x67'),_0x1c5e6a);try{fs[_0x077c('0x68')](_0x3efbdb,parseInt(_0x077c('0x69'),0x8));extract(_0x3efbdb,{'dir':_0x1c5e6a},function(_0x44f7cd){if(_0x44f7cd){logger[_0x077c('0x2c')](_0x44f7cd);handleError(_0x44f7cd,!![]);};var _0x1b1cb4=fs[_0x077c('0x6a')](_0x1c5e6a);if(_0x1b1cb4[_0x077c('0x3c')]>0x1){removeReferences(_0x3efbdb,_0x1c5e6a);logger[_0x077c('0x2c')](_0x077c('0x6b'));return _0xd16254(new Error(_0x077c('0x6b')));}var _0x3161c8=fs[_0x077c('0x6c')](path['join'](_0x1c5e6a,_0x1b1cb4[0x0]));if(_0x3161c8[_0x077c('0x6d')]()){removeReferences(_0x3efbdb,_0x1c5e6a);logger['error'](_0x077c('0x6b'));return _0xd16254(new Error(_0x077c('0x6b')));}if(_0x3161c8[_0x077c('0x6e')]()){var _0xd229a4=fs['readdirSync'](path[_0x077c('0x4c')](_0x1c5e6a,_0x1b1cb4[0x0]));if(_0xd229a4['length']===0x0){removeReferences(_0x3efbdb,_0x1c5e6a);logger['error'](_0x077c('0x6b'));return _0xd16254(new Error(_0x077c('0x6b')));}var _0x2ccef6=_0xd229a4[_0x077c('0x6f')](function(_0x480c07){return _0x480c07===_0x077c('0x70');});if(!_0x2ccef6){return _0xd16254(new Error(_0x077c('0x71')));}var _0x21c3a6=fs[_0x077c('0x72')](path['join'](_0x1c5e6a,_0x1b1cb4[0x0],_0x077c('0x70')));var _0x3b993b=JSON[_0x077c('0x73')](_0x21c3a6);if(_0x077c('0x1e')==typeof _0x3b993b[_0x077c('0x2e')]){return _0xd16254(new Error('Invalid\x20manifest:\x20name\x20missing'));}if(_0x077c('0x1e')==typeof _0x3b993b[_0x077c('0x34')]){return _0xd16254(new Error('Invalid\x20manifest:\x20type\x20missing'));}if('undefined'==typeof _0x3b993b[_0x077c('0x74')]){return _0xd16254(new Error(_0x077c('0x75')));}if(_0x077c('0x1e')==typeof _0x3b993b[_0x077c('0x76')]){return _0xd16254(new Error('Invalid\x20manifest:\x20parameters\x20missing'));}if(_0x3b993b[_0x077c('0x34')]===_0x077c('0x77')){if('undefined'==typeof _0x3b993b[_0x077c('0x76')]['views']){return _0xd16254(new Error('Invalid\x20manifest:\x20views\x20missing'));}if(_0x077c('0x1e')==typeof _0x3b993b['parameters'][_0x077c('0x78')][_0x077c('0x79')]&&_0x077c('0x1e')==typeof _0x3b993b[_0x077c('0x76')]['views'][_0x077c('0x7a')]){return _0xd16254(new Error('Invalid\x20manifest:\x20no\x20view\x20specified'));}}else if(_0x3b993b[_0x077c('0x34')]===_0x077c('0x7b')){if(_0x077c('0x1e')==typeof _0x3b993b['parameters'][_0x077c('0x7c')]){return _0xd16254(new Error(_0x077c('0x7d')));}if(_0x077c('0x1e')==typeof _0x3b993b['parameters'][_0x077c('0x7e')]){return _0xd16254(new Error(_0x077c('0x7f')));}}else{return _0xd16254(new Error(_0x077c('0x80')));}var _0xc02ccf=_0x3b993b[_0x077c('0x2e')];var _0x4a5a8c=_0x3b993b['description'];var _0x2088bd=_0x3b993b[_0x077c('0x34')];var _0x515fbe=_0x3b993b[_0x077c('0x81')]?_0x3b993b[_0x077c('0x81')]:'always';var _0x2102a1=_0x3b993b[_0x077c('0x82')]?_0x3b993b[_0x077c('0x82')]:_0x077c('0x83');var _0x16ea5c='';var _0x226aed='';var _0x5147c3='';var _0x50736a='';var _0x2d623b=_0x3b993b['version'];if(_0x2088bd===_0x077c('0x77')){if(_0x077c('0x1e')!=typeof _0x3b993b[_0x077c('0x76')][_0x077c('0x78')][_0x077c('0x79')]){var _0x153dcc=_0x3b993b['parameters'][_0x077c('0x78')][_0x077c('0x79')];if(!/^(f|ht)tps?:\/\//i['test'](_0x153dcc)){_0x16ea5c=path[_0x077c('0x4c')]('plugins',_0x257ac9,_0x1b1cb4[0x0],_0x153dcc);}else{_0x16ea5c=_0x153dcc;}}else{logger['info'](_0x077c('0x84'));}if(_0x077c('0x1e')!=typeof _0x3b993b['parameters'][_0x077c('0x78')][_0x077c('0x7a')]){var _0x268a17=_0x3b993b[_0x077c('0x76')][_0x077c('0x78')]['agent'];if(!/^(f|ht)tps?:\/\//i[_0x077c('0x85')](_0x268a17)){_0x226aed=path[_0x077c('0x4c')](_0x077c('0x86'),_0x257ac9,_0x1b1cb4[0x0],_0x268a17);}else{_0x226aed=_0x268a17;}}else{logger[_0x077c('0x62')](_0x077c('0x87'));}}else if(_0x2088bd==='script'){_0x5147c3=_0x3b993b['parameters'][_0x077c('0x7c')];_0x50736a=_0x3b993b[_0x077c('0x76')][_0x077c('0x7e')];if(_0x077c('0x1e')!=typeof _0x3b993b[_0x077c('0x76')]['views']){if(_0x077c('0x1e')!=typeof _0x3b993b[_0x077c('0x76')]['views'][_0x077c('0x79')]){var _0x153dcc=_0x3b993b['parameters'][_0x077c('0x78')][_0x077c('0x79')];if(!/^(f|ht)tps?:\/\//i[_0x077c('0x85')](_0x153dcc)){_0x16ea5c=path[_0x077c('0x4c')](_0x077c('0x86'),_0x257ac9,_0x1b1cb4[0x0],_0x153dcc);}else{_0x16ea5c=_0x153dcc;}}if('undefined'!=typeof _0x3b993b[_0x077c('0x76')][_0x077c('0x78')]['agent']){var _0x268a17=_0x3b993b[_0x077c('0x76')][_0x077c('0x78')][_0x077c('0x7a')];if(!/^(f|ht)tps?:\/\//i['test'](_0x268a17)){_0x226aed=path[_0x077c('0x4c')]('plugins',_0x257ac9,_0x1b1cb4[0x0],_0x268a17);}else{_0x226aed=_0x268a17;}}}}var _0x2ceca3={'name':_0xc02ccf,'description':_0x4a5a8c,'path':path['join'](_0x257ac9,_0x1b1cb4[0x0]),'type':_0x2088bd,'sidebar':_0x515fbe,'icon':_0x2102a1,'adminUrl':_0x16ea5c,'agentUrl':_0x226aed,'scriptName':_0x5147c3,'scriptPath':_0x50736a,'version':_0x2d623b};removeReferences(_0x3efbdb,null);return db[_0x077c('0x31')]['create'](_0x2ceca3)[_0x077c('0x27')](function(_0xae8b34){var _0x5bbc00={'role':_0x2efaaf['body']['role'],'userProfileId':_0x2efaaf[_0x077c('0x88')]['userProfileId']};if(!_0x5bbc00)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5bbc00[_0x077c('0x89')]==='user'){var _0x50103e=_0xae8b34[_0x077c('0x29')]({'plain':!![]});return db[_0x077c('0x8a')][_0x077c('0x49')]({'where':{'name':_0x077c('0x2a'),'userProfileId':_0x5bbc00[_0x077c('0x8b')]},'raw':!![]})[_0x077c('0x27')](function(_0x49f407){if(_0x49f407&&_0x49f407['autoAssociation']===0x0){return db[_0x077c('0x2b')][_0x077c('0x8c')]({'name':_0x50103e[_0x077c('0x2e')],'resourceId':_0x50103e['id'],'type':_0x49f407[_0x077c('0x2e')],'sectionId':_0x49f407['id']},{})['then'](function(){return _0xae8b34;});}else{return _0xae8b34;}})[_0x077c('0x46')](function(_0x3c11c8){logger[_0x077c('0x2c')](_0x077c('0x8d'),_0x3c11c8);throw _0x3c11c8;});}return _0xae8b34;})[_0x077c('0x27')](respondWithResult(_0x454199,null))[_0x077c('0x46')](handleError(_0x454199,null));}});}catch(_0x596a30){_0x454199[_0x077c('0x1a')](0x1f4)[_0x077c('0x2f')](_0x596a30);}};function removeReferences(_0x59444d,_0x25a1ba){try{if(_0x59444d){fs[_0x077c('0x8e')](_0x59444d);logger[_0x077c('0x62')](_0x077c('0x8f'));}if(_0x25a1ba){rimraf(_0x25a1ba,function(){});logger[_0x077c('0x62')](_0x077c('0x90'));}}catch(_0x3aa654){logger['error'](_0x3aa654);}}exports[_0x077c('0x26')]=function(_0xda7ab0,_0x101262,_0x202514){return db[_0x077c('0x31')][_0x077c('0x49')]({'where':{'id':_0xda7ab0['params']['id']}})[_0x077c('0x27')](handleEntityNotFound(_0x101262,null))[_0x077c('0x27')](saveUpdates(_0xda7ab0[_0x077c('0x88')],null))['then'](respondWithResult(_0x101262,null))['catch'](handleError(_0x101262,null));};exports[_0x077c('0x91')]=function(_0x19bb42,_0x470855,_0x276b96){return db[_0x077c('0x31')][_0x077c('0x49')]({'where':{'id':_0x19bb42['params']['id']}})['then'](function(_0x404861){if(_0x404861){return _0x404861[_0x077c('0x28')]();}})[_0x077c('0x27')](function(_0x494de4){rimraf(path[_0x077c('0x4c')](config['root'],_0x077c('0x4e'),path[_0x077c('0x5c')](_0x494de4[_0x077c('0x4b')])),function(){});return _0x494de4;})['then'](handleEntityNotFound(_0x470855,null))[_0x077c('0x27')](respondWithStatusCode(_0x470855,null))[_0x077c('0x46')](handleError(_0x470855,null));};exports[_0x077c('0x92')]=function(_0x236feb,_0x66640c,_0x1347a5){return BPromise[_0x077c('0x93')]()['then'](function(){if(!_0x236feb[_0x077c('0x35')][_0x077c('0x4b')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x236feb['query'][_0x077c('0x94')]){throw new Error(_0x077c('0x95'));}var _0xd3eccc=_0x236feb['query']['hostname']?_0x236feb[_0x077c('0x35')][_0x077c('0x96')]+':'+_0x236feb[_0x077c('0x35')][_0x077c('0x94')]:_0x077c('0x97')+_0x236feb['query'][_0x077c('0x94')];var _0x2763b2=_0x236feb[_0x077c('0x35')][_0x077c('0x1c')]?_0x236feb[_0x077c('0x35')]['json']:!![];var _0x4b72e8=_0x236feb[_0x077c('0x35')][_0x077c('0x98')]?_0x236feb['query'][_0x077c('0x98')]:null;var _0x15bf9e={'method':_0x236feb[_0x077c('0x99')],'uri':util['format'](_0x077c('0x9a'),_0xd3eccc,_0x236feb[_0x077c('0x35')][_0x077c('0x4b')]),'json':_0x2763b2,'resolveWithFullResponse':!![],'encoding':_0x4b72e8,'qs':_0x236feb[_0x077c('0x35')]};if(_0x236feb[_0x077c('0x9b')]){_0x15bf9e['headers']=_0x236feb[_0x077c('0x9b')];if(_0x15bf9e['headers'][_0x077c('0x9c')]){delete _0x15bf9e[_0x077c('0x9b')]['content-length'];}}if(_0x15bf9e['headers'][_0x077c('0x9d')]){delete _0x15bf9e[_0x077c('0x9b')]['content-type'];}return rp(_0x15bf9e);})[_0x077c('0x27')](function(_0x559299){if(_0x559299){_0x66640c['set'](_0x559299[_0x077c('0x9b')]);logger[_0x077c('0x62')](_0x559299[_0x077c('0x88')]);if(_[_0x077c('0x9e')](_0x236feb['query'][_0x077c('0x4b')],'download')&&_0x559299['statusCode']==0x1f4){return _0x66640c[_0x077c('0x19')](_0x559299[_0x077c('0x9f')]);}else{return _0x66640c[_0x077c('0x1a')](_0x559299[_0x077c('0x9f')])[_0x077c('0x2f')](_0x559299[_0x077c('0x88')]);}}else{return _0x66640c[_0x077c('0x19')](0xc8);}})[_0x077c('0x46')](handleError(_0x66640c,null));};exports[_0x077c('0xa0')]=function(_0x5cf787,_0x10ed18,_0x74c93c){return BPromise['resolve']()[_0x077c('0x27')](function(){if(!_0x5cf787[_0x077c('0x35')][_0x077c('0x4b')]){throw new Error(_0x077c('0xa1'));}if(!_0x5cf787[_0x077c('0x35')][_0x077c('0x94')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x383641=_0x5cf787[_0x077c('0x35')][_0x077c('0x96')]?_0x5cf787[_0x077c('0x35')][_0x077c('0x96')]+':'+_0x5cf787[_0x077c('0x35')][_0x077c('0x94')]:_0x077c('0x97')+_0x5cf787['query']['port'];var _0x38327c=_0x5cf787[_0x077c('0x35')][_0x077c('0x1c')]?_0x5cf787['query'][_0x077c('0x1c')]:!![];var _0x247442=_0x5cf787['query']['encoding']?_0x5cf787[_0x077c('0x35')][_0x077c('0x98')]:null;var _0x586ca9={'method':_0x5cf787[_0x077c('0x99')],'uri':util[_0x077c('0x4f')](_0x077c('0x9a'),_0x383641,_0x5cf787[_0x077c('0x35')][_0x077c('0x4b')]),'json':_0x38327c,'resolveWithFullResponse':!![],'encoding':_0x247442,'body':_0x5cf787[_0x077c('0x88')]};if(_0x5cf787[_0x077c('0x9b')]){_0x586ca9['headers']=_0x5cf787[_0x077c('0x9b')];if(_0x586ca9[_0x077c('0x9b')][_0x077c('0x9c')]){delete _0x586ca9[_0x077c('0x9b')]['content-length'];}}if(_0x586ca9[_0x077c('0x9b')][_0x077c('0x9d')]){delete _0x586ca9[_0x077c('0x9b')]['content-type'];}return rp(_0x586ca9);})[_0x077c('0x27')](function(_0x45d38c){if(_0x45d38c){_0x10ed18[_0x077c('0x21')](_0x45d38c[_0x077c('0x9b')]);logger[_0x077c('0x62')](_0x45d38c[_0x077c('0x88')]);return _0x10ed18[_0x077c('0x1a')](_0x45d38c[_0x077c('0x9f')])[_0x077c('0x2f')](_0x45d38c['body']);}else{return _0x10ed18[_0x077c('0x19')](0xc8);}})[_0x077c('0x46')](handleError(_0x10ed18,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index bc5bd90..9e3c2f3 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 _0x9aac=['hook','events','Plugin','setMaxListeners','update','emit','hasOwnProperty'];(function(_0x33a573,_0x5e88b2){var _0xa8c4c0=function(_0x17fe11){while(--_0x17fe11){_0x33a573['push'](_0x33a573['shift']());}};_0xa8c4c0(++_0x5e88b2);}(_0x9aac,0x135));var _0xc9aa=function(_0x3769c4,_0x11890f){_0x3769c4=_0x3769c4-0x0;var _0x3898dc=_0x9aac[_0x3769c4];return _0x3898dc;};'use strict';var EventEmitter=require(_0xc9aa('0x0'));var Plugin=require('../../mysqldb')['db'][_0xc9aa('0x1')];var PluginEvents=new EventEmitter();PluginEvents[_0xc9aa('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xc9aa('0x3'),'afterDestroy':'remove'};function emitEvent(_0x8ca086){return function(_0x5c8ce2,_0x28c49c,_0x267772){PluginEvents['emit'](_0x8ca086+':'+_0x5c8ce2['id'],_0x5c8ce2);PluginEvents[_0xc9aa('0x4')](_0x8ca086,_0x5c8ce2);_0x267772(null);};}for(var e in events){if(events[_0xc9aa('0x5')](e)){var event=events[e];Plugin[_0xc9aa('0x6')](e,emitEvent(event));}}module['exports']=PluginEvents; \ No newline at end of file +var _0xd9a8=['emit','hook','exports','events','../../mysqldb','Plugin','save','update'];(function(_0x512c83,_0x42a67a){var _0x1f7f25=function(_0x1e656c){while(--_0x1e656c){_0x512c83['push'](_0x512c83['shift']());}};_0x1f7f25(++_0x42a67a);}(_0xd9a8,0xc3));var _0x8d9a=function(_0x5d07ac,_0x119581){_0x5d07ac=_0x5d07ac-0x0;var _0x3da334=_0xd9a8[_0x5d07ac];return _0x3da334;};'use strict';var EventEmitter=require(_0x8d9a('0x0'));var Plugin=require(_0x8d9a('0x1'))['db'][_0x8d9a('0x2')];var PluginEvents=new EventEmitter();PluginEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x8d9a('0x3'),'afterUpdate':_0x8d9a('0x4'),'afterDestroy':'remove'};function emitEvent(_0x489c45){return function(_0x47177e,_0x3a40f0,_0x34bbf9){PluginEvents[_0x8d9a('0x5')](_0x489c45+':'+_0x47177e['id'],_0x47177e);PluginEvents[_0x8d9a('0x5')](_0x489c45,_0x47177e);_0x34bbf9(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Plugin[_0x8d9a('0x6')](e,emitEvent(event));}}module[_0x8d9a('0x7')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index cdfc346..25215ee 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 _0xf883=['rimraf','../../config/environment','./plugin.attributes','exports','define','lodash','util','api','bluebird','request-promise'];(function(_0x45a1c1,_0x3a40f2){var _0x3428b6=function(_0x5365d3){while(--_0x5365d3){_0x45a1c1['push'](_0x45a1c1['shift']());}};_0x3428b6(++_0x3a40f2);}(_0xf883,0x177));var _0x3f88=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf883[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x3f88('0x0'));var util=require(_0x3f88('0x1'));var logger=require('../../config/logger')(_0x3f88('0x2'));var moment=require('moment');var BPromise=require(_0x3f88('0x3'));var rp=require(_0x3f88('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3f88('0x5'));var config=require(_0x3f88('0x6'));var attributes=require(_0x3f88('0x7'));module[_0x3f88('0x8')]=function(_0x391e1c,_0x26139d){return _0x391e1c[_0x3f88('0x9')]('Plugin',attributes,{'tableName':'plugins','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x54a9=['rimraf','../../config/environment','./plugin.attributes','define','Plugin','plugins','lodash','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x3ea357,_0x554585){var _0x3416f9=function(_0x10c9df){while(--_0x10c9df){_0x3ea357['push'](_0x3ea357['shift']());}};_0x3416f9(++_0x554585);}(_0x54a9,0x186));var _0x954a=function(_0x1c01ed,_0x201774){_0x1c01ed=_0x1c01ed-0x0;var _0x2dcc8d=_0x54a9[_0x1c01ed];return _0x2dcc8d;};'use strict';var _=require(_0x954a('0x0'));var util=require('util');var logger=require(_0x954a('0x1'))('api');var moment=require(_0x954a('0x2'));var BPromise=require(_0x954a('0x3'));var rp=require(_0x954a('0x4'));var fs=require('fs');var path=require(_0x954a('0x5'));var rimraf=require(_0x954a('0x6'));var config=require(_0x954a('0x7'));var attributes=require(_0x954a('0x8'));module['exports']=function(_0x2066b6,_0x5634fc){return _0x2066b6[_0x954a('0x9')](_0x954a('0xa'),attributes,{'tableName':_0x954a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.rpc.js b/server/api/plugin/plugin.rpc.js index ade66d4..7b8ac5d 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 _0x826d=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','redis','localhost','socket.io-emitter','register','then','info','Plugin,\x20%s,\x20%s','request\x20sent','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreatePlugin','create','options','raw','util','moment','bluebird','randomstring'];(function(_0x378cf6,_0x30ea0a){var _0x561525=function(_0x291d7a){while(--_0x291d7a){_0x378cf6['push'](_0x378cf6['shift']());}};_0x561525(++_0x30ea0a);}(_0x826d,0x184));var _0xd826=function(_0x1121c6,_0x4b400d){_0x1121c6=_0x1121c6-0x0;var _0x207280=_0x826d[_0x1121c6];return _0x207280;};'use strict';var _=require('lodash');var util=require(_0xd826('0x0'));var moment=require(_0xd826('0x1'));var BPromise=require(_0xd826('0x2'));var rs=require(_0xd826('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd826('0x4'))['db'];var utils=require(_0xd826('0x5'));var logger=require(_0xd826('0x6'))(_0xd826('0x7'));var config=require(_0xd826('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});config[_0xd826('0x9')]=_['defaults'](config[_0xd826('0x9')],{'host':_0xd826('0xa'),'port':0x18eb});var socket=require(_0xd826('0xb'))(new Redis(config[_0xd826('0x9')]));require('./plugin.socket')[_0xd826('0xc')](socket);function respondWithRpcPromise(_0x3aed65,_0x1aa3dd,_0x2dc436){return new BPromise(function(_0x11d786,_0x1562fd){return client['request'](_0x3aed65,_0x2dc436)[_0xd826('0xd')](function(_0x442c29){logger[_0xd826('0xe')](_0xd826('0xf'),_0x1aa3dd,_0xd826('0x10'));logger['debug'](_0xd826('0x11'),_0x1aa3dd,_0xd826('0x10'),JSON[_0xd826('0x12')](_0x442c29));if(_0x442c29[_0xd826('0x13')]){if(_0x442c29['error'][_0xd826('0x14')]===0x1f4){logger[_0xd826('0x13')](_0xd826('0xf'),_0x1aa3dd,_0x442c29[_0xd826('0x13')][_0xd826('0x15')]);return _0x1562fd(_0x442c29['error'][_0xd826('0x15')]);}logger[_0xd826('0x13')]('Plugin,\x20%s,\x20%s',_0x1aa3dd,_0x442c29[_0xd826('0x13')]['message']);return _0x11d786(_0x442c29[_0xd826('0x13')]['message']);}else{logger['info'](_0xd826('0xf'),_0x1aa3dd,'request\x20sent');_0x11d786(_0x442c29[_0xd826('0x16')][_0xd826('0x15')]);}})[_0xd826('0x17')](function(_0x39d88f){logger[_0xd826('0x13')]('Plugin,\x20%s,\x20%s',_0x1aa3dd,_0x39d88f);_0x1562fd(_0x39d88f);});});}exports[_0xd826('0x18')]=function(_0x2591af){var _0x4822ca=this;return new Promise(function(_0x177880,_0x191a55){return db['Plugin'][_0xd826('0x19')](_0x2591af['body'],{'raw':_0x2591af[_0xd826('0x1a')]?_0x2591af[_0xd826('0x1a')][_0xd826('0x1b')]===undefined?!![]:![]:!![]})[_0xd826('0xd')](function(_0x3cf7a1){logger[_0xd826('0xe')](_0xd826('0x18'),_0x2591af);logger['debug'](_0xd826('0x18'),_0x2591af,JSON[_0xd826('0x12')](_0x3cf7a1));_0x177880(_0x3cf7a1);})[_0xd826('0x17')](function(_0x4c2f71){logger[_0xd826('0x13')](_0xd826('0x18'),_0x4c2f71[_0xd826('0x15')],_0x2591af);_0x191a55(_0x4822ca['error'](0x1f4,_0x4c2f71[_0xd826('0x15')]));});});}; \ No newline at end of file +var _0x7502=['randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','register','info','Plugin,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','CreatePlugin','Plugin','create','options','then','stringify','lodash','util','moment','bluebird'];(function(_0x375af8,_0x544a8d){var _0x3f002d=function(_0xd2ce0e){while(--_0xd2ce0e){_0x375af8['push'](_0x375af8['shift']());}};_0x3f002d(++_0x544a8d);}(_0x7502,0x11e));var _0x2750=function(_0x301bd6,_0x4d0a0f){_0x301bd6=_0x301bd6-0x0;var _0x638dac=_0x7502[_0x301bd6];return _0x638dac;};'use strict';var _=require(_0x2750('0x0'));var util=require(_0x2750('0x1'));var moment=require(_0x2750('0x2'));var BPromise=require(_0x2750('0x3'));var rs=require(_0x2750('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2750('0x5'))['db'];var utils=require(_0x2750('0x6'));var logger=require('../../config/logger')(_0x2750('0x7'));var config=require('../../config/environment');var jayson=require(_0x2750('0x8'));var client=jayson[_0x2750('0x9')]['http']({'port':0x232a});config[_0x2750('0xa')]=_[_0x2750('0xb')](config[_0x2750('0xa')],{'host':_0x2750('0xc'),'port':0x18eb});var socket=require(_0x2750('0xd'))(new Redis(config[_0x2750('0xa')]));require('./plugin.socket')[_0x2750('0xe')](socket);function respondWithRpcPromise(_0x3af77e,_0x141462,_0x22cb18){return new BPromise(function(_0x3a1f83,_0x252fe5){return client['request'](_0x3af77e,_0x22cb18)['then'](function(_0x3511e4){logger[_0x2750('0xf')](_0x2750('0x10'),_0x141462,_0x2750('0x11'));logger[_0x2750('0x12')]('Plugin,\x20%s,\x20%s,\x20%s',_0x141462,_0x2750('0x11'),JSON['stringify'](_0x3511e4));if(_0x3511e4[_0x2750('0x13')]){if(_0x3511e4[_0x2750('0x13')]['code']===0x1f4){logger[_0x2750('0x13')](_0x2750('0x10'),_0x141462,_0x3511e4['error'][_0x2750('0x14')]);return _0x252fe5(_0x3511e4['error'][_0x2750('0x14')]);}logger['error'](_0x2750('0x10'),_0x141462,_0x3511e4[_0x2750('0x13')]['message']);return _0x3a1f83(_0x3511e4[_0x2750('0x13')][_0x2750('0x14')]);}else{logger[_0x2750('0xf')]('Plugin,\x20%s,\x20%s',_0x141462,'request\x20sent');_0x3a1f83(_0x3511e4[_0x2750('0x15')][_0x2750('0x14')]);}})[_0x2750('0x16')](function(_0xb7eff9){logger['error'](_0x2750('0x10'),_0x141462,_0xb7eff9);_0x252fe5(_0xb7eff9);});});}exports[_0x2750('0x17')]=function(_0x172602){var _0x1a8cf2=this;return new Promise(function(_0x2c0db0,_0x1c62b3){return db[_0x2750('0x18')][_0x2750('0x19')](_0x172602['body'],{'raw':_0x172602['options']?_0x172602[_0x2750('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0x2750('0x1b')](function(_0x4c9a3b){logger[_0x2750('0xf')](_0x2750('0x17'),_0x172602);logger[_0x2750('0x12')](_0x2750('0x17'),_0x172602,JSON[_0x2750('0x1c')](_0x4c9a3b));_0x2c0db0(_0x4c9a3b);})[_0x2750('0x16')](function(_0x51be22){logger['error']('CreatePlugin',_0x51be22[_0x2750('0x14')],_0x172602);_0x1c62b3(_0x1a8cf2[_0x2750('0x13')](0x1f4,_0x51be22[_0x2750('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index ef8a38a..a0bf94a 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 _0x238b=['remove','update','emit','removeListener','register','plugin:','./plugin.events','save'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x238b,0x196));var _0xb238=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x238b[_0x20a584];return _0x4b41a8;};'use strict';var PluginEvents=require(_0xb238('0x0'));var events=[_0xb238('0x1'),_0xb238('0x2'),_0xb238('0x3')];function createListener(_0x9f1294,_0x2e6082){return function(_0x2a18fb){_0x2e6082[_0xb238('0x4')](_0x9f1294,_0x2a18fb);};}function removeListener(_0x3088c3,_0xa089e0){return function(){PluginEvents[_0xb238('0x5')](_0x3088c3,_0xa089e0);};}exports[_0xb238('0x6')]=function(_0xbe4be4){for(var _0xe2ecbd=0x0,_0x4d7623=events['length'];_0xe2ecbd<_0x4d7623;_0xe2ecbd++){var _0x4ceb99=events[_0xe2ecbd];var _0x228361=createListener(_0xb238('0x7')+_0x4ceb99,_0xbe4be4);PluginEvents['on'](_0x4ceb99,_0x228361);}}; \ No newline at end of file +var _0x22e2=['removeListener','register','length','save','remove','update'];(function(_0xca2456,_0x49b439){var _0x21b937=function(_0x581650){while(--_0x581650){_0xca2456['push'](_0xca2456['shift']());}};_0x21b937(++_0x49b439);}(_0x22e2,0x1bf));var _0x222e=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x22e2[_0x13d07a];return _0x5ee0ee;};'use strict';var PluginEvents=require('./plugin.events');var events=[_0x222e('0x0'),_0x222e('0x1'),_0x222e('0x2')];function createListener(_0x6f322e,_0x3fecd5){return function(_0x31cf18){_0x3fecd5['emit'](_0x6f322e,_0x31cf18);};}function removeListener(_0x9c3c8f,_0x231df2){return function(){PluginEvents[_0x222e('0x3')](_0x9c3c8f,_0x231df2);};}exports[_0x222e('0x4')]=function(_0x2739d0){for(var _0x2e765b=0x0,_0x156ad9=events[_0x222e('0x5')];_0x2e765b<_0x156ad9;_0x2e765b++){var _0x376e72=events[_0x2e765b];var _0x5d84ab=createListener('plugin:'+_0x376e72,_0x2739d0);PluginEvents['on'](_0x376e72,_0x5d84ab);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index a5ec6bf..5b6a1cf 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(_0x4ee07e,_0xb7eab0){var _0x37f9cd=function(_0x41cceb){while(--_0x41cceb){_0x4ee07e['push'](_0x4ee07e['shift']());}};_0x37f9cd(++_0xb7eab0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0xa9e0[_0x411add];return _0x238242;};'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(_0x19c950,_0x3a4318){var _0x5def46=function(_0x3f1a9f){while(--_0x3f1a9f){_0x19c950['push'](_0x19c950['shift']());}};_0x5def46(++_0x3a4318);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0xa9e0[_0x5447fd];return _0x15b28a;};'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 e6c3524..b03c2bf 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 _0xc6d8=['Unknown\x20status','destroy','delete','dump','Unknown\x20id','lodash','../../config/logger','path','exec','sendStatus','status','stack','name','send','npm\x20install','info','error','index','list','then','reject','length','show','describe','create','body','join','cwd','chdir','start','Missing\x20name\x20and/or\x20path','update','hasOwnProperty','params','catch'];(function(_0x2f48cd,_0x46a75a){var _0x193ae2=function(_0x253c01){while(--_0x253c01){_0x2f48cd['push'](_0x2f48cd['shift']());}};_0x193ae2(++_0x46a75a);}(_0xc6d8,0xd7));var _0x8c6d=function(_0x2f4748,_0x24af55){_0x2f4748=_0x2f4748-0x0;var _0x18eece=_0xc6d8[_0x2f4748];return _0x18eece;};'use strict';var _=require(_0x8c6d('0x0'));var pm2=require('../../config/pm2');var logger=require(_0x8c6d('0x1'))('api');var path=require(_0x8c6d('0x2'));var exec=require('child_process')[_0x8c6d('0x3')];var BPromise=require('bluebird');function handleEntityNotFound(_0x5b6b04,_0x352b8c){return function(_0xdff6f){if(!_0xdff6f){_0x5b6b04[_0x8c6d('0x4')](0x194);;}return _0xdff6f;};}function respondWithResult(_0x4f5e8f,_0x3c265c){_0x3c265c=_0x3c265c||0xc8;return function(_0x2dbb52){if(_0x2dbb52){return _0x4f5e8f[_0x8c6d('0x5')](_0x3c265c)['json'](_0x2dbb52);}return null;};}function handleError(_0x1496ba,_0x75c49f){_0x75c49f=_0x75c49f||0x1f4;return function(_0x16d4b2){logger['error'](_0x16d4b2[_0x8c6d('0x6')]);if(_0x16d4b2[_0x8c6d('0x7')]){delete _0x16d4b2[_0x8c6d('0x7')];}_0x1496ba[_0x8c6d('0x5')](_0x75c49f)[_0x8c6d('0x8')](_0x16d4b2);};}function execChildProcess(){return new BPromise(function(_0x43a7ab,_0x60cd5c){exec(_0x8c6d('0x9'),function(_0x50af75,_0x36d6fb,_0x559d17){logger['info'](_0x36d6fb);logger[_0x8c6d('0xa')](_0x559d17);if(_0x50af75){logger[_0x8c6d('0xb')](_0x50af75);return _0x60cd5c(_0x50af75);}return _0x43a7ab(_0x36d6fb);});});}exports[_0x8c6d('0xc')]=function(_0x8ec2d4,_0x30ecfa){return pm2[_0x8c6d('0xd')]()[_0x8c6d('0xe')](function(_0x103699){if(_0x103699){var _0x14c1ee=_[_0x8c6d('0xf')](_0x103699,function(_0x4fb956){return _0x4fb956[_0x8c6d('0x7')]==='express'||_0x4fb956[_0x8c6d('0x7')]==='motion2';});return{'rows':_0x14c1ee,'count':_0x14c1ee[_0x8c6d('0x10')]};}return null;})[_0x8c6d('0xe')](respondWithResult(_0x30ecfa,null))['catch'](handleError(_0x30ecfa,null));};exports[_0x8c6d('0x11')]=function(_0x2b8a26,_0x51a5fa){return pm2[_0x8c6d('0x12')](_0x2b8a26['params']['id'])['then'](respondWithResult(_0x51a5fa,null))[_0x8c6d('0xe')](handleEntityNotFound(_0x51a5fa,null))['catch'](handleError(_0x51a5fa,null));};exports[_0x8c6d('0x13')]=function(_0x174a4f,_0x1d0f0a){if(_0x174a4f[_0x8c6d('0x14')][_0x8c6d('0x7')]&&_0x174a4f['body']['script']){var _0x550079=path[_0x8c6d('0x15')](__dirname,'../../files/plugins',_0x174a4f[_0x8c6d('0x14')]['script']);var _0x4c378b=process[_0x8c6d('0x16')]();process[_0x8c6d('0x17')](path['dirname'](_0x550079));return execChildProcess()['then'](function(_0x51bb08){process['chdir'](_0x4c378b);return pm2[_0x8c6d('0x18')]({'name':_0x174a4f[_0x8c6d('0x14')][_0x8c6d('0x7')],'script':_0x550079});})['then'](function(_0x41c904){pm2['dump']();return _0x41c904[0x0];})[_0x8c6d('0xe')](respondWithResult(_0x1d0f0a,0xc9))['catch'](handleError(_0x1d0f0a,null));}else{return _0x1d0f0a[_0x8c6d('0x5')](0x1f4)[_0x8c6d('0x8')]({'message':_0x8c6d('0x19')});}};exports[_0x8c6d('0x1a')]=function(_0x1e6755,_0x3e3cd3){if(_0x1e6755[_0x8c6d('0x14')]['id']){delete _0x1e6755[_0x8c6d('0x14')]['id'];}var _0x3eab38={'online':'restart','stopped':'stop'};if(_0x3eab38[_0x8c6d('0x1b')](_0x1e6755[_0x8c6d('0x14')][_0x8c6d('0x5')])){return pm2[_0x3eab38[_0x1e6755[_0x8c6d('0x14')][_0x8c6d('0x5')]]](_0x1e6755[_0x8c6d('0x1c')]['id'])[_0x8c6d('0xe')](respondWithResult(_0x3e3cd3,0xc8))[_0x8c6d('0x1d')](handleError(_0x3e3cd3,null));}else{return _0x3e3cd3[_0x8c6d('0x5')](0x1f4)[_0x8c6d('0x8')]({'message':_0x8c6d('0x1e')});}};exports[_0x8c6d('0x1f')]=function(_0x4e5203,_0x3af625){if(_0x4e5203[_0x8c6d('0x14')]['id']){delete _0x4e5203[_0x8c6d('0x14')]['id'];}if(_0x4e5203[_0x8c6d('0x1c')]['id']){return pm2[_0x8c6d('0x20')](_0x4e5203[_0x8c6d('0x1c')]['id'])[_0x8c6d('0xe')](function(_0x1857f9){pm2[_0x8c6d('0x21')]();return _0x1857f9[0x0];})['then'](respondWithResult(_0x3af625,null))[_0x8c6d('0x1d')](handleError(_0x3af625,null));}else{return _0x3af625['status'](0x1f4)[_0x8c6d('0x8')]({'message':_0x8c6d('0x22')});}}; \ No newline at end of file +var _0xc6d8=['Unknown\x20status','destroy','delete','dump','Unknown\x20id','lodash','../../config/logger','path','exec','sendStatus','status','stack','name','send','npm\x20install','info','error','index','list','then','reject','length','show','describe','create','body','join','cwd','chdir','start','Missing\x20name\x20and/or\x20path','update','hasOwnProperty','params','catch'];(function(_0x53c256,_0x382a24){var _0x25feb6=function(_0x2652fd){while(--_0x2652fd){_0x53c256['push'](_0x53c256['shift']());}};_0x25feb6(++_0x382a24);}(_0xc6d8,0xd7));var _0x8c6d=function(_0x30b547,_0x5b89e9){_0x30b547=_0x30b547-0x0;var _0xab9618=_0xc6d8[_0x30b547];return _0xab9618;};'use strict';var _=require(_0x8c6d('0x0'));var pm2=require('../../config/pm2');var logger=require(_0x8c6d('0x1'))('api');var path=require(_0x8c6d('0x2'));var exec=require('child_process')[_0x8c6d('0x3')];var BPromise=require('bluebird');function handleEntityNotFound(_0x5b6b04,_0x352b8c){return function(_0xdff6f){if(!_0xdff6f){_0x5b6b04[_0x8c6d('0x4')](0x194);;}return _0xdff6f;};}function respondWithResult(_0x4f5e8f,_0x3c265c){_0x3c265c=_0x3c265c||0xc8;return function(_0x2dbb52){if(_0x2dbb52){return _0x4f5e8f[_0x8c6d('0x5')](_0x3c265c)['json'](_0x2dbb52);}return null;};}function handleError(_0x1496ba,_0x75c49f){_0x75c49f=_0x75c49f||0x1f4;return function(_0x16d4b2){logger['error'](_0x16d4b2[_0x8c6d('0x6')]);if(_0x16d4b2[_0x8c6d('0x7')]){delete _0x16d4b2[_0x8c6d('0x7')];}_0x1496ba[_0x8c6d('0x5')](_0x75c49f)[_0x8c6d('0x8')](_0x16d4b2);};}function execChildProcess(){return new BPromise(function(_0x43a7ab,_0x60cd5c){exec(_0x8c6d('0x9'),function(_0x50af75,_0x36d6fb,_0x559d17){logger['info'](_0x36d6fb);logger[_0x8c6d('0xa')](_0x559d17);if(_0x50af75){logger[_0x8c6d('0xb')](_0x50af75);return _0x60cd5c(_0x50af75);}return _0x43a7ab(_0x36d6fb);});});}exports[_0x8c6d('0xc')]=function(_0x8ec2d4,_0x30ecfa){return pm2[_0x8c6d('0xd')]()[_0x8c6d('0xe')](function(_0x103699){if(_0x103699){var _0x14c1ee=_[_0x8c6d('0xf')](_0x103699,function(_0x4fb956){return _0x4fb956[_0x8c6d('0x7')]==='express'||_0x4fb956[_0x8c6d('0x7')]==='motion2';});return{'rows':_0x14c1ee,'count':_0x14c1ee[_0x8c6d('0x10')]};}return null;})[_0x8c6d('0xe')](respondWithResult(_0x30ecfa,null))['catch'](handleError(_0x30ecfa,null));};exports[_0x8c6d('0x11')]=function(_0x2b8a26,_0x51a5fa){return pm2[_0x8c6d('0x12')](_0x2b8a26['params']['id'])['then'](respondWithResult(_0x51a5fa,null))[_0x8c6d('0xe')](handleEntityNotFound(_0x51a5fa,null))['catch'](handleError(_0x51a5fa,null));};exports[_0x8c6d('0x13')]=function(_0x174a4f,_0x1d0f0a){if(_0x174a4f[_0x8c6d('0x14')][_0x8c6d('0x7')]&&_0x174a4f['body']['script']){var _0x550079=path[_0x8c6d('0x15')](__dirname,'../../files/plugins',_0x174a4f[_0x8c6d('0x14')]['script']);var _0x4c378b=process[_0x8c6d('0x16')]();process[_0x8c6d('0x17')](path['dirname'](_0x550079));return execChildProcess()['then'](function(_0x51bb08){process['chdir'](_0x4c378b);return pm2[_0x8c6d('0x18')]({'name':_0x174a4f[_0x8c6d('0x14')][_0x8c6d('0x7')],'script':_0x550079});})['then'](function(_0x41c904){pm2['dump']();return _0x41c904[0x0];})[_0x8c6d('0xe')](respondWithResult(_0x1d0f0a,0xc9))['catch'](handleError(_0x1d0f0a,null));}else{return _0x1d0f0a[_0x8c6d('0x5')](0x1f4)[_0x8c6d('0x8')]({'message':_0x8c6d('0x19')});}};exports[_0x8c6d('0x1a')]=function(_0x1e6755,_0x3e3cd3){if(_0x1e6755[_0x8c6d('0x14')]['id']){delete _0x1e6755[_0x8c6d('0x14')]['id'];}var _0x3eab38={'online':'restart','stopped':'stop'};if(_0x3eab38[_0x8c6d('0x1b')](_0x1e6755[_0x8c6d('0x14')][_0x8c6d('0x5')])){return pm2[_0x3eab38[_0x1e6755[_0x8c6d('0x14')][_0x8c6d('0x5')]]](_0x1e6755[_0x8c6d('0x1c')]['id'])[_0x8c6d('0xe')](respondWithResult(_0x3e3cd3,0xc8))[_0x8c6d('0x1d')](handleError(_0x3e3cd3,null));}else{return _0x3e3cd3[_0x8c6d('0x5')](0x1f4)[_0x8c6d('0x8')]({'message':_0x8c6d('0x1e')});}};exports[_0x8c6d('0x1f')]=function(_0x4e5203,_0x3af625){if(_0x4e5203[_0x8c6d('0x14')]['id']){delete _0x4e5203[_0x8c6d('0x14')]['id'];}if(_0x4e5203[_0x8c6d('0x1c')]['id']){return pm2[_0x8c6d('0x20')](_0x4e5203[_0x8c6d('0x1c')]['id'])[_0x8c6d('0xe')](function(_0x1857f9){pm2[_0x8c6d('0x21')]();return _0x1857f9[0x0];})['then'](respondWithResult(_0x3af625,null))[_0x8c6d('0x1d')](handleError(_0x3af625,null));}else{return _0x3af625['status'](0x1f4)[_0x8c6d('0x8')]({'message':_0x8c6d('0x22')});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index caa9632..0c3c749 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 _0xd8b6=['Router','../../components/auth/service','get','/agents','isAuthenticated','getAgents','/queues','getQueues','express'];(function(_0x227ea0,_0x4d3e91){var _0x5edb7e=function(_0x7c4636){while(--_0x7c4636){_0x227ea0['push'](_0x227ea0['shift']());}};_0x5edb7e(++_0x4d3e91);}(_0xd8b6,0xfb));var _0x6d8b=function(_0x1dcaa3,_0x4601c6){_0x1dcaa3=_0x1dcaa3-0x0;var _0xf670fc=_0xd8b6[_0x1dcaa3];return _0xf670fc;};'use strict';var express=require(_0x6d8b('0x0'));var router=express[_0x6d8b('0x1')]();var auth=require(_0x6d8b('0x2'));var controller=require('./realtime.controller');router[_0x6d8b('0x3')](_0x6d8b('0x4'),auth[_0x6d8b('0x5')](),controller[_0x6d8b('0x6')]);router[_0x6d8b('0x3')](_0x6d8b('0x7'),auth[_0x6d8b('0x5')](),controller[_0x6d8b('0x8')]);module['exports']=router; \ No newline at end of file +var _0xade0=['Router','../../components/auth/service','./realtime.controller','get','/agents','isAuthenticated','getAgents','/queues','getQueues','express'];(function(_0x523cdf,_0x3fb49d){var _0x287652=function(_0x3c3c12){while(--_0x3c3c12){_0x523cdf['push'](_0x523cdf['shift']());}};_0x287652(++_0x3fb49d);}(_0xade0,0x10d));var _0x0ade=function(_0x4e9628,_0x250573){_0x4e9628=_0x4e9628-0x0;var _0x27bc8c=_0xade0[_0x4e9628];return _0x27bc8c;};'use strict';var express=require(_0x0ade('0x0'));var router=express[_0x0ade('0x1')]();var auth=require(_0x0ade('0x2'));var controller=require(_0x0ade('0x3'));router[_0x0ade('0x4')](_0x0ade('0x5'),auth[_0x0ade('0x6')](),controller[_0x0ade('0x7')]);router[_0x0ade('0x4')](_0x0ade('0x8'),auth[_0x0ade('0x6')](),controller[_0x0ade('0x9')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/realtime/realtime.controller.js b/server/api/realtime/realtime.controller.js index fd641d7..c5aa65f 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 _0x9730=['getUpdatedSortOptions','join','order','getAgentIdsByQueues','getRealtimeAgents','rows','getSortedAgentsIdsByStatus','getAgentIdsByStatus','length','map','User','rawAttributes','fieldName','type','key','role','agent','getOptions','raw','push','literal','FIELD(id,','forEach','Pause','where','merge','user','userProfileId','Agents','online','extraQueryConditions','UserProfile','findAndCountAll','find','filterAgentAttributes','getAgentStatus','voice','talking','voiceStatus','pause','Status','sortAgentsByStatus','pick','catch','getQueues','Channel\x20parameter\x20%s\x20is\x20invalid','startCase','fields','dialActive','dialMethod','outbound','QueueCampaigns','assign','getResources','getRealtimeQueues','initializeQueues','lodash','../../components/realtime/agents','../../components/realtime/queues','../../components/parsers/qs','../../config/utils','../../mysqldb','../../errors/api','offset','undefined','limit','count','status','set','Content-Range','json','getAgents','getChannels','query','globalQueueFilter','*pause','resolve','then','isValidChannel','channel','format','toLowerCase','sort','globalStatus','validateSortParameter'];(function(_0x344a3f,_0x579a22){var _0x264712=function(_0x34c9f0){while(--_0x34c9f0){_0x344a3f['push'](_0x344a3f['shift']());}};_0x264712(++_0x579a22);}(_0x9730,0x1e1));var _0x0973=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x9730[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0973('0x0'));var util=require('util');var rta=require(_0x0973('0x1'));var rtq=require(_0x0973('0x2'));var qs=require(_0x0973('0x3'));var utils=require(_0x0973('0x4'));var db=require(_0x0973('0x5'))['db'];var APIBadRequestError=require(_0x0973('0x6'))['APIBadRequestError'];var APIHandleError=require(_0x0973('0x6'))['handleError'];function respondWithFilteredResult(_0x3d8c6d,_0x41ccc1){return function(_0xdd4d6c){if(_0xdd4d6c){var _0x40e2ca=typeof _0x41ccc1[_0x0973('0x7')]===_0x0973('0x8')&&typeof _0x41ccc1[_0x0973('0x9')]===_0x0973('0x8');var _0x3b840f=_0xdd4d6c[_0x0973('0xa')];var _0x108ce5=_0x40e2ca?0x0:_0x41ccc1[_0x0973('0x7')];var _0x3e1fc7=_0x40e2ca?_0xdd4d6c['count']:_0x41ccc1[_0x0973('0x7')]+_0x41ccc1['limit'];var _0x2188ce;if(_0x3e1fc7>=_0x3b840f){_0x3e1fc7=_0x3b840f;_0x2188ce=0xc8;}else{_0x2188ce=0xce;}_0x3d8c6d[_0x0973('0xb')](_0x2188ce);return _0x3d8c6d[_0x0973('0xc')](_0x0973('0xd'),_0x108ce5+'-'+_0x3e1fc7+'/'+_0x3b840f)[_0x0973('0xe')](_0xdd4d6c);}return null;};}exports[_0x0973('0xf')]=function(_0x2707c2,_0x19e6f4){var _0x235edb={'count':0x0,'rows':[]};var _0x3cb072={};var _0x2b2019;var _0x2f1492=utils[_0x0973('0x10')]();var _0x190b2b;var _0x53ff35;var _0x47dfbb=_0x2707c2[_0x0973('0x11')][_0x0973('0x12')];var _0x58dba3=_0x2707c2[_0x0973('0x11')]['globalStatusFilter'];var _0x24920a=_0x2707c2['query']['pauseTypeFilter'];var _0x49a13a=_0x58dba3==='pause'||_0x58dba3===_0x0973('0x13')?!![]:![];var _0x55658f=[];var _0x1d90d2;var _0xf02341;Promise[_0x0973('0x14')]()[_0x0973('0x15')](function(){if(_0x2707c2[_0x0973('0x11')]['channel']){if(!utils[_0x0973('0x16')](_0x2707c2[_0x0973('0x11')][_0x0973('0x17')])){throw new APIBadRequestError(util[_0x0973('0x18')]('Channel\x20parameter\x20%s\x20is\x20invalid',_0x2707c2[_0x0973('0x11')][_0x0973('0x17')]));}_0x2b2019=_0x2707c2['query'][_0x0973('0x17')][_0x0973('0x19')]();}if(!_0x2707c2[_0x0973('0x11')][_0x0973('0x1a')]||!_0x2707c2[_0x0973('0x11')][_0x0973('0x1a')]['includes'](_0x0973('0x1b'))){_0x2707c2[_0x0973('0x11')][_0x0973('0x1a')]=rta[_0x0973('0x1c')](_0x2707c2[_0x0973('0x11')]['sort']);return;}var _0xc30250=rta[_0x0973('0x1d')](_0x2707c2[_0x0973('0x11')][_0x0973('0x1a')]);_0x2707c2[_0x0973('0x11')][_0x0973('0x1a')]=_0xc30250['fields'][_0x0973('0x1e')](',');_0x1d90d2=_0xc30250[_0x0973('0x1f')];})[_0x0973('0x15')](function(){if(!_0x47dfbb){return[];}return rta[_0x0973('0x20')](_0x47dfbb,_0x2b2019);})['then'](function(_0x156358){_0x55658f=_0x156358;return rta[_0x0973('0x21')]();})[_0x0973('0x15')](function(_0x54f73f){_0x53ff35=_0x54f73f[_0x0973('0x22')];if((!_0x58dba3||_0x49a13a)&&!_0x1d90d2){return _0x55658f;}if(_0x1d90d2&&!_0x58dba3){return rta[_0x0973('0x23')](_0x53ff35,_0x55658f,_0x1d90d2);}else{return rta[_0x0973('0x24')](_0x53ff35,_0x55658f,_0x58dba3);}})[_0x0973('0x15')](function(_0x51114c){_0x55658f=_0x51114c;var _0x416eb4=![];if(_0x55658f[_0x0973('0x25')]===0x0){if(_0x47dfbb||_0x58dba3){_0x416eb4=!![];}if(_0x49a13a){_0x416eb4=![];}}if(_0x416eb4){return _0x235edb;}var _0x134761=_[_0x0973('0x26')](db[_0x0973('0x27')][_0x0973('0x28')],function(_0x54324c){return{'name':_0x54324c[_0x0973('0x29')],'type':_0x54324c[_0x0973('0x2a')][_0x0973('0x2b')]};});_0x2707c2[_0x0973('0x11')][_0x0973('0x2c')]=_0x0973('0x2d');_0x3cb072=qs[_0x0973('0x2e')](_0x134761,_0x2707c2);_0x3cb072[_0x0973('0x2f')]=!![];var _0x4ec339=[];if(_0x55658f[_0x0973('0x25')]>0x0){_0x4ec339[_0x0973('0x30')]({'id':{'$in':_0x55658f}});if(_0x1d90d2&&!_0x58dba3){_0xf02341=[db['sequelize'][_0x0973('0x31')](_0x0973('0x32')+_0x55658f+')')];_0x3cb072[_0x0973('0x1f')]=_0xf02341;}}if(_0x49a13a){_0x2f1492[_0x0973('0x33')](function(_0x5d4af9){var _0x51a5a0=!![];if(_0x58dba3===_0x0973('0x13')&&_0x2b2019!==_0x5d4af9){_0x51a5a0=![];}_0x4ec339[_0x0973('0x30')]({[_0x5d4af9+_0x0973('0x34')]:_0x51a5a0});});if(_0x24920a){_0x4ec339['push']({'pauseType':_0x24920a});}}else if(_0x58dba3){_0x2f1492['forEach'](function(_0x5ac474){_0x4ec339['push']({[_0x5ac474+_0x0973('0x34')]:![]});});}_0x3cb072[_0x0973('0x35')]=_[_0x0973('0x36')](_0x3cb072[_0x0973('0x35')],{'$and':_0x4ec339});if(_0x2707c2[_0x0973('0x37')][_0x0973('0x2c')]===_0x0973('0x37')){var _0x57069b={'params':{'id':_0x2707c2[_0x0973('0x37')][_0x0973('0x38')]},'query':{'section':_0x0973('0x39'),'role':_0x0973('0x2d'),'raw':!![],'ids':_0x55658f,'customSorting':_0xf02341}};if(_0x2707c2[_0x0973('0x11')][_0x0973('0x3a')]){_0x57069b[_0x0973('0x11')][_0x0973('0x3a')]=!![];}if(_0x49a13a){_0x57069b[_0x0973('0x11')][_0x0973('0x3b')]=_0x4ec339;}_0x57069b[_0x0973('0x11')]=Object['assign'](_0x57069b['query'],_['omit'](_0x2707c2[_0x0973('0x11')],'id'));return db[_0x0973('0x3c')]['getResources'](_0x57069b);}return db['User'][_0x0973('0x3d')](_0x3cb072);})[_0x0973('0x15')](function(_0x14e419){_0x235edb[_0x0973('0xa')]=_0x14e419['count'];_0x190b2b=_0x14e419[_0x0973('0x22')];return _0x190b2b['map'](function(_0x315e9a){var _0x2c7962=_[_0x0973('0x3e')](_0x53ff35,['id',_0x315e9a['id']]);if(_0x2c7962){var _0x28895d=rta[_0x0973('0x3f')](_0x2c7962);_[_0x0973('0x36')](_0x315e9a,_0x28895d);}_0x315e9a['globalStatus']=rta[_0x0973('0x40')](_0x315e9a);if(_0x315e9a['globalStatus']['includes']('pause')){_0x2f1492[_0x0973('0x33')](function(_0x23f122){if(_0x315e9a[_0x23f122+_0x0973('0x34')]){if(_0x23f122===_0x0973('0x41')){if(_0x315e9a['voiceStatus']!==_0x0973('0x42')){_0x315e9a[_0x0973('0x43')]=_0x0973('0x44');}}else{_0x315e9a[_0x23f122+_0x0973('0x45')]=_0x0973('0x44');}}});}return _0x315e9a;});})[_0x0973('0x15')](function(_0x58e8e7){if(!_0x1d90d2||_0xf02341){return _0x58e8e7;}return rta[_0x0973('0x46')](_0x58e8e7,_0x1d90d2);})[_0x0973('0x15')](function(_0x47623a){var _0x270597=rta['getRealtimeAgentsQueryFields']();_0x235edb['rows']=_0x47623a[_0x0973('0x26')](function(_0x2ce059){return _[_0x0973('0x47')](_0x2ce059,_0x270597);});return _0x235edb;})['then'](respondWithFilteredResult(_0x19e6f4,_0x3cb072))[_0x0973('0x48')](APIHandleError(_0x19e6f4));};exports[_0x0973('0x49')]=function(_0x4498ed,_0x51195b){var _0x3bd841={'count':0x0,'rows':[]};var _0x160776={};var _0x231db3;var _0x14c296;var _0x50276f;Promise[_0x0973('0x14')]()[_0x0973('0x15')](function(){if(_0x4498ed['query']['channel']){if(!utils[_0x0973('0x16')](_0x4498ed[_0x0973('0x11')][_0x0973('0x17')])){throw new APIBadRequestError(util['format'](_0x0973('0x4a'),_0x4498ed[_0x0973('0x11')][_0x0973('0x17')]));}_0x231db3=_0x4498ed['query'][_0x0973('0x17')][_0x0973('0x19')]();}var _0x83bd9=_[_0x0973('0x4b')](_0x231db3)+'Queue';var _0xb10b18=_[_0x0973('0x26')](db[_0x83bd9][_0x0973('0x28')],function(_0x320240){return{'name':_0x320240[_0x0973('0x29')],'type':_0x320240[_0x0973('0x2a')][_0x0973('0x2b')]};});if(!_0x4498ed[_0x0973('0x11')][_0x0973('0x4c')]){var _0x25368c=['id','name'];if(_0x231db3===_0x0973('0x41')){_0x25368c[_0x0973('0x30')](_0x0973('0x2a'));if(_0x4498ed[_0x0973('0x11')][_0x0973('0x2a')]==='outbound'){_0x25368c[_0x0973('0x30')]([_0x0973('0x4d'),_0x0973('0x4e')]);}}_0x4498ed[_0x0973('0x11')]['fields']=_0x25368c[_0x0973('0x1e')](',');}_0x160776=qs[_0x0973('0x2e')](_0xb10b18,_0x4498ed);if(_0x4498ed['user'][_0x0973('0x2c')]===_0x0973('0x37')){var _0x4a1375={'params':{'id':_0x4498ed['user'][_0x0973('0x38')]},'query':{'section':_0x231db3==='voice'&&_0x4498ed[_0x0973('0x11')][_0x0973('0x2a')]===_0x0973('0x4f')?_0x0973('0x50'):_[_0x0973('0x4b')](_0x231db3)+'Queues','type':_0x4498ed[_0x0973('0x11')]['type'],'nolimit':!![],'sort':'name','filter':_0x4498ed[_0x0973('0x11')]['filter']}};_0x4a1375[_0x0973('0x11')]=Object[_0x0973('0x51')](_0x4a1375[_0x0973('0x11')],_0x4498ed[_0x0973('0x11')]);delete _0x4a1375[_0x0973('0x11')]['id'];return db[_0x0973('0x3c')][_0x0973('0x52')](_0x4a1375);}return db[_0x83bd9][_0x0973('0x3d')](_0x160776);})['then'](function(_0x40e5cc){_0x3bd841[_0x0973('0xa')]=_0x40e5cc[_0x0973('0xa')];_0x14c296=_0x40e5cc[_0x0973('0x22')];return rtq[_0x0973('0x53')](_0x4498ed,_0x231db3);})[_0x0973('0x15')](function(_0x1ff8e0){_0x50276f=_0x1ff8e0[_0x0973('0x22')];return rtq[_0x0973('0x54')](_0x14c296,_0x50276f,_0x231db3,_0x4498ed[_0x0973('0x11')][_0x0973('0x2a')]);})[_0x0973('0x15')](function(_0xe30678){_0x3bd841['rows']=_0xe30678;return _0x3bd841;})['then'](respondWithFilteredResult(_0x51195b,_0x160776))[_0x0973('0x48')](APIHandleError(_0x51195b));}; \ No newline at end of file +var _0x9dd3=['getAgents','query','globalQueueFilter','globalStatusFilter','pauseTypeFilter','pause','*pause','resolve','then','channel','Channel\x20parameter\x20%s\x20is\x20invalid','toLowerCase','sort','globalStatus','validateSortParameter','getUpdatedSortOptions','fields','join','order','getAgentIdsByQueues','getRealtimeAgents','rows','getSortedAgentsIdsByStatus','getAgentIdsByStatus','length','User','rawAttributes','type','key','role','getOptions','raw','sequelize','FIELD(id,','forEach','push','Pause','where','merge','user','userProfileId','Agents','online','assign','omit','UserProfile','map','find','getAgentStatus','includes','voiceStatus','talking','Status','sortAgentsByStatus','getRealtimeAgentsQueryFields','pick','catch','getQueues','isValidChannel','format','startCase','Queue','fieldName','name','voice','outbound','dialActive','dialMethod','QueueCampaigns','Queues','filter','getResources','getRealtimeQueues','initializeQueues','lodash','util','../../components/realtime/agents','../../components/realtime/queues','../../config/utils','../../errors/api','APIBadRequestError','undefined','count','offset','limit','Content-Range'];(function(_0x139d70,_0x179bca){var _0x1144ff=function(_0x2f4dd2){while(--_0x2f4dd2){_0x139d70['push'](_0x139d70['shift']());}};_0x1144ff(++_0x179bca);}(_0x9dd3,0x1a2));var _0x39dd=function(_0x51332e,_0x4fe7ff){_0x51332e=_0x51332e-0x0;var _0x3fd27a=_0x9dd3[_0x51332e];return _0x3fd27a;};'use strict';var _=require(_0x39dd('0x0'));var util=require(_0x39dd('0x1'));var rta=require(_0x39dd('0x2'));var rtq=require(_0x39dd('0x3'));var qs=require('../../components/parsers/qs');var utils=require(_0x39dd('0x4'));var db=require('../../mysqldb')['db'];var APIBadRequestError=require(_0x39dd('0x5'))[_0x39dd('0x6')];var APIHandleError=require(_0x39dd('0x5'))['handleError'];function respondWithFilteredResult(_0x4da1eb,_0x47cb91){return function(_0xfd7a21){if(_0xfd7a21){var _0x347e4b=typeof _0x47cb91['offset']===_0x39dd('0x7')&&typeof _0x47cb91['limit']===_0x39dd('0x7');var _0x74c92=_0xfd7a21[_0x39dd('0x8')];var _0x14b5d0=_0x347e4b?0x0:_0x47cb91[_0x39dd('0x9')];var _0x5d1b9e=_0x347e4b?_0xfd7a21[_0x39dd('0x8')]:_0x47cb91['offset']+_0x47cb91[_0x39dd('0xa')];var _0x171b15;if(_0x5d1b9e>=_0x74c92){_0x5d1b9e=_0x74c92;_0x171b15=0xc8;}else{_0x171b15=0xce;}_0x4da1eb['status'](_0x171b15);return _0x4da1eb['set'](_0x39dd('0xb'),_0x14b5d0+'-'+_0x5d1b9e+'/'+_0x74c92)['json'](_0xfd7a21);}return null;};}exports[_0x39dd('0xc')]=function(_0x916da4,_0x1ae946){var _0x522116={'count':0x0,'rows':[]};var _0x28b023={};var _0x123da2;var _0x408c8e=utils['getChannels']();var _0x3bfc0c;var _0x4b56e1;var _0x4a935e=_0x916da4[_0x39dd('0xd')][_0x39dd('0xe')];var _0x297ac6=_0x916da4[_0x39dd('0xd')][_0x39dd('0xf')];var _0x555b17=_0x916da4[_0x39dd('0xd')][_0x39dd('0x10')];var _0x19edb7=_0x297ac6===_0x39dd('0x11')||_0x297ac6===_0x39dd('0x12')?!![]:![];var _0x564fdb=[];var _0x1edbdf;var _0x3361fd;Promise[_0x39dd('0x13')]()[_0x39dd('0x14')](function(){if(_0x916da4[_0x39dd('0xd')][_0x39dd('0x15')]){if(!utils['isValidChannel'](_0x916da4[_0x39dd('0xd')][_0x39dd('0x15')])){throw new APIBadRequestError(util['format'](_0x39dd('0x16'),_0x916da4[_0x39dd('0xd')][_0x39dd('0x15')]));}_0x123da2=_0x916da4[_0x39dd('0xd')][_0x39dd('0x15')][_0x39dd('0x17')]();}if(!_0x916da4[_0x39dd('0xd')][_0x39dd('0x18')]||!_0x916da4[_0x39dd('0xd')][_0x39dd('0x18')]['includes'](_0x39dd('0x19'))){_0x916da4[_0x39dd('0xd')][_0x39dd('0x18')]=rta[_0x39dd('0x1a')](_0x916da4[_0x39dd('0xd')][_0x39dd('0x18')]);return;}var _0x196102=rta[_0x39dd('0x1b')](_0x916da4[_0x39dd('0xd')][_0x39dd('0x18')]);_0x916da4[_0x39dd('0xd')][_0x39dd('0x18')]=_0x196102[_0x39dd('0x1c')][_0x39dd('0x1d')](',');_0x1edbdf=_0x196102[_0x39dd('0x1e')];})[_0x39dd('0x14')](function(){if(!_0x4a935e){return[];}return rta[_0x39dd('0x1f')](_0x4a935e,_0x123da2);})[_0x39dd('0x14')](function(_0x8b3979){_0x564fdb=_0x8b3979;return rta[_0x39dd('0x20')]();})[_0x39dd('0x14')](function(_0x7d40b3){_0x4b56e1=_0x7d40b3[_0x39dd('0x21')];if((!_0x297ac6||_0x19edb7)&&!_0x1edbdf){return _0x564fdb;}if(_0x1edbdf&&!_0x297ac6){return rta[_0x39dd('0x22')](_0x4b56e1,_0x564fdb,_0x1edbdf);}else{return rta[_0x39dd('0x23')](_0x4b56e1,_0x564fdb,_0x297ac6);}})[_0x39dd('0x14')](function(_0x3ab967){_0x564fdb=_0x3ab967;var _0x5569a4=![];if(_0x564fdb[_0x39dd('0x24')]===0x0){if(_0x4a935e||_0x297ac6){_0x5569a4=!![];}if(_0x19edb7){_0x5569a4=![];}}if(_0x5569a4){return _0x522116;}var _0x1b57b9=_['map'](db[_0x39dd('0x25')][_0x39dd('0x26')],function(_0x45c569){return{'name':_0x45c569['fieldName'],'type':_0x45c569[_0x39dd('0x27')][_0x39dd('0x28')]};});_0x916da4[_0x39dd('0xd')][_0x39dd('0x29')]='agent';_0x28b023=qs[_0x39dd('0x2a')](_0x1b57b9,_0x916da4);_0x28b023[_0x39dd('0x2b')]=!![];var _0x4a4138=[];if(_0x564fdb[_0x39dd('0x24')]>0x0){_0x4a4138['push']({'id':{'$in':_0x564fdb}});if(_0x1edbdf&&!_0x297ac6){_0x3361fd=[db[_0x39dd('0x2c')]['literal'](_0x39dd('0x2d')+_0x564fdb+')')];_0x28b023[_0x39dd('0x1e')]=_0x3361fd;}}if(_0x19edb7){_0x408c8e[_0x39dd('0x2e')](function(_0x5e194a){var _0xe8d267=!![];if(_0x297ac6===_0x39dd('0x12')&&_0x123da2!==_0x5e194a){_0xe8d267=![];}_0x4a4138[_0x39dd('0x2f')]({[_0x5e194a+_0x39dd('0x30')]:_0xe8d267});});if(_0x555b17){_0x4a4138['push']({'pauseType':_0x555b17});}}else if(_0x297ac6){_0x408c8e[_0x39dd('0x2e')](function(_0x2734b0){_0x4a4138['push']({[_0x2734b0+_0x39dd('0x30')]:![]});});}_0x28b023[_0x39dd('0x31')]=_[_0x39dd('0x32')](_0x28b023['where'],{'$and':_0x4a4138});if(_0x916da4[_0x39dd('0x33')][_0x39dd('0x29')]===_0x39dd('0x33')){var _0x395bb5={'params':{'id':_0x916da4[_0x39dd('0x33')][_0x39dd('0x34')]},'query':{'section':_0x39dd('0x35'),'role':'agent','raw':!![],'ids':_0x564fdb,'customSorting':_0x3361fd}};if(_0x916da4['query'][_0x39dd('0x36')]){_0x395bb5[_0x39dd('0xd')][_0x39dd('0x36')]=!![];}if(_0x19edb7){_0x395bb5[_0x39dd('0xd')]['extraQueryConditions']=_0x4a4138;}_0x395bb5[_0x39dd('0xd')]=Object[_0x39dd('0x37')](_0x395bb5[_0x39dd('0xd')],_[_0x39dd('0x38')](_0x916da4[_0x39dd('0xd')],'id'));return db[_0x39dd('0x39')]['getResources'](_0x395bb5);}return db['User']['findAndCountAll'](_0x28b023);})['then'](function(_0x52ae1a){_0x522116[_0x39dd('0x8')]=_0x52ae1a[_0x39dd('0x8')];_0x3bfc0c=_0x52ae1a['rows'];return _0x3bfc0c[_0x39dd('0x3a')](function(_0x6f5451){var _0xaf7cc7=_[_0x39dd('0x3b')](_0x4b56e1,['id',_0x6f5451['id']]);if(_0xaf7cc7){var _0x5d85dc=rta['filterAgentAttributes'](_0xaf7cc7);_[_0x39dd('0x32')](_0x6f5451,_0x5d85dc);}_0x6f5451[_0x39dd('0x19')]=rta[_0x39dd('0x3c')](_0x6f5451);if(_0x6f5451[_0x39dd('0x19')][_0x39dd('0x3d')](_0x39dd('0x11'))){_0x408c8e[_0x39dd('0x2e')](function(_0x4b5ec7){if(_0x6f5451[_0x4b5ec7+_0x39dd('0x30')]){if(_0x4b5ec7==='voice'){if(_0x6f5451[_0x39dd('0x3e')]!==_0x39dd('0x3f')){_0x6f5451[_0x39dd('0x3e')]=_0x39dd('0x11');}}else{_0x6f5451[_0x4b5ec7+_0x39dd('0x40')]=_0x39dd('0x11');}}});}return _0x6f5451;});})[_0x39dd('0x14')](function(_0x1f5e3e){if(!_0x1edbdf||_0x3361fd){return _0x1f5e3e;}return rta[_0x39dd('0x41')](_0x1f5e3e,_0x1edbdf);})[_0x39dd('0x14')](function(_0x3ec4bb){var _0x31ff6b=rta[_0x39dd('0x42')]();_0x522116[_0x39dd('0x21')]=_0x3ec4bb[_0x39dd('0x3a')](function(_0x199155){return _[_0x39dd('0x43')](_0x199155,_0x31ff6b);});return _0x522116;})[_0x39dd('0x14')](respondWithFilteredResult(_0x1ae946,_0x28b023))[_0x39dd('0x44')](APIHandleError(_0x1ae946));};exports[_0x39dd('0x45')]=function(_0x3a9424,_0xa86d87){var _0x383ed4={'count':0x0,'rows':[]};var _0x16fece={};var _0x112779;var _0x4c50a4;var _0x499bce;Promise[_0x39dd('0x13')]()[_0x39dd('0x14')](function(){if(_0x3a9424[_0x39dd('0xd')][_0x39dd('0x15')]){if(!utils[_0x39dd('0x46')](_0x3a9424[_0x39dd('0xd')][_0x39dd('0x15')])){throw new APIBadRequestError(util[_0x39dd('0x47')](_0x39dd('0x16'),_0x3a9424[_0x39dd('0xd')][_0x39dd('0x15')]));}_0x112779=_0x3a9424[_0x39dd('0xd')][_0x39dd('0x15')][_0x39dd('0x17')]();}var _0x3a13fd=_[_0x39dd('0x48')](_0x112779)+_0x39dd('0x49');var _0x5eec10=_[_0x39dd('0x3a')](db[_0x3a13fd]['rawAttributes'],function(_0x1ee42c){return{'name':_0x1ee42c[_0x39dd('0x4a')],'type':_0x1ee42c[_0x39dd('0x27')]['key']};});if(!_0x3a9424[_0x39dd('0xd')]['fields']){var _0x2e252d=['id',_0x39dd('0x4b')];if(_0x112779===_0x39dd('0x4c')){_0x2e252d[_0x39dd('0x2f')]('type');if(_0x3a9424[_0x39dd('0xd')][_0x39dd('0x27')]===_0x39dd('0x4d')){_0x2e252d[_0x39dd('0x2f')]([_0x39dd('0x4e'),_0x39dd('0x4f')]);}}_0x3a9424[_0x39dd('0xd')]['fields']=_0x2e252d[_0x39dd('0x1d')](',');}_0x16fece=qs[_0x39dd('0x2a')](_0x5eec10,_0x3a9424);if(_0x3a9424[_0x39dd('0x33')]['role']===_0x39dd('0x33')){var _0x2b7574={'params':{'id':_0x3a9424[_0x39dd('0x33')][_0x39dd('0x34')]},'query':{'section':_0x112779===_0x39dd('0x4c')&&_0x3a9424[_0x39dd('0xd')]['type']===_0x39dd('0x4d')?_0x39dd('0x50'):_[_0x39dd('0x48')](_0x112779)+_0x39dd('0x51'),'type':_0x3a9424['query'][_0x39dd('0x27')],'nolimit':!![],'sort':_0x39dd('0x4b'),'filter':_0x3a9424['query'][_0x39dd('0x52')]}};_0x2b7574[_0x39dd('0xd')]=Object[_0x39dd('0x37')](_0x2b7574['query'],_0x3a9424['query']);delete _0x2b7574[_0x39dd('0xd')]['id'];return db[_0x39dd('0x39')][_0x39dd('0x53')](_0x2b7574);}return db[_0x3a13fd]['findAndCountAll'](_0x16fece);})['then'](function(_0x39f9a5){_0x383ed4[_0x39dd('0x8')]=_0x39f9a5[_0x39dd('0x8')];_0x4c50a4=_0x39f9a5['rows'];return rtq[_0x39dd('0x54')](_0x3a9424,_0x112779);})[_0x39dd('0x14')](function(_0x46224b){_0x499bce=_0x46224b[_0x39dd('0x21')];return rtq[_0x39dd('0x55')](_0x4c50a4,_0x499bce,_0x112779,_0x3a9424[_0x39dd('0xd')][_0x39dd('0x27')]);})['then'](function(_0x5001b1){_0x383ed4[_0x39dd('0x21')]=_0x5001b1;return _0x383ed4;})[_0x39dd('0x14')](respondWithFilteredResult(_0xa86d87,_0x16fece))[_0x39dd('0x44')](APIHandleError(_0xa86d87));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index d38d89c..0a3a76b 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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x5c9f2a,_0x4f465c){var _0x27266e=function(_0x5abed){while(--_0x5abed){_0x5c9f2a['push'](_0x5c9f2a['shift']());}};_0x27266e(++_0x4f465c);}(_0xe706,0xa3));var _0x6e70=function(_0x5a039f,_0x2c6ee6){_0x5a039f=_0x5a039f-0x0;var _0x304d1d=_0xe706[_0x5a039f];return _0x304d1d;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x298954,_0x2922df){var _0x3df1a8=function(_0x4c1936){while(--_0x4c1936){_0x298954['push'](_0x298954['shift']());}};_0x3df1a8(++_0x2922df);}(_0x70e0,0x17b));var _0x070e=function(_0x21076c,_0x3816d9){_0x21076c=_0x21076c-0x0;var _0x191384=_0x70e0[_0x21076c];return _0x191384;};'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/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index d212b48..e73912b 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 _0xa46e=['STRING','DATE','sequelize','exports'];(function(_0x3a037b,_0x25ec24){var _0x11b964=function(_0x267d89){while(--_0x267d89){_0x3a037b['push'](_0x3a037b['shift']());}};_0x11b964(++_0x25ec24);}(_0xa46e,0x8a));var _0xea46=function(_0x597484,_0x199340){_0x597484=_0x597484-0x0;var _0x218e64=_0xa46e[_0x597484];return _0x218e64;};'use strict';var Sequelize=require(_0xea46('0x0'));module[_0xea46('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0xea46('0x2')]},'scheduledat':{'type':Sequelize[_0xea46('0x3')]},'uniqueid':{'type':Sequelize[_0xea46('0x2')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0xea46('0x3')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'campaign':{'type':Sequelize[_0xea46('0x2')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xea46('0x2')]}}; \ No newline at end of file +var _0x4af9=['sequelize','exports','DATE','STRING','INTEGER'];(function(_0x553bfd,_0x460754){var _0x2fdd61=function(_0xa11a0b){while(--_0xa11a0b){_0x553bfd['push'](_0x553bfd['shift']());}};_0x2fdd61(++_0x460754);}(_0x4af9,0x12c));var _0x94af=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x4af9[_0x3bf83f];return _0x22c4a9;};'use strict';var Sequelize=require(_0x94af('0x0'));module[_0x94af('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x94af('0x2')]},'uniqueid':{'type':Sequelize[_0x94af('0x3')]},'starttime':{'type':Sequelize[_0x94af('0x2')]},'responsetime':{'type':Sequelize[_0x94af('0x2')]},'ringtime':{'type':Sequelize[_0x94af('0x4')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x94af('0x3')]},'campaigntype':{'type':Sequelize[_0x94af('0x3')]},'membername':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index a32f7c1..c9a1bd7 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 _0x6196=['ReportAgentPreview','report_agent_preview','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./reportAgentPreview.attributes','define'];(function(_0x4878aa,_0x9d272d){var _0x4f5086=function(_0x55f9e0){while(--_0x55f9e0){_0x4878aa['push'](_0x4878aa['shift']());}};_0x4f5086(++_0x9d272d);}(_0x6196,0x12d));var _0x6619=function(_0x7c94a3,_0x19083e){_0x7c94a3=_0x7c94a3-0x0;var _0x58063d=_0x6196[_0x7c94a3];return _0x58063d;};'use strict';var _=require(_0x6619('0x0'));var util=require(_0x6619('0x1'));var logger=require(_0x6619('0x2'))(_0x6619('0x3'));var moment=require(_0x6619('0x4'));var BPromise=require(_0x6619('0x5'));var rp=require(_0x6619('0x6'));var fs=require('fs');var path=require(_0x6619('0x7'));var rimraf=require('rimraf');var config=require(_0x6619('0x8'));var attributes=require(_0x6619('0x9'));module['exports']=function(_0x17fa50,_0x584194){return _0x17fa50[_0x6619('0xa')](_0x6619('0xb'),attributes,{'tableName':_0x6619('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xec95=['exports','define','ReportAgentPreview','report_agent_preview','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','./reportAgentPreview.attributes'];(function(_0x42e988,_0xd8abe0){var _0x5ce1fb=function(_0x2531bc){while(--_0x2531bc){_0x42e988['push'](_0x42e988['shift']());}};_0x5ce1fb(++_0xd8abe0);}(_0xec95,0xc4));var _0x5ec9=function(_0x217c2e,_0x358f06){_0x217c2e=_0x217c2e-0x0;var _0x22b7d8=_0xec95[_0x217c2e];return _0x22b7d8;};'use strict';var _=require(_0x5ec9('0x0'));var util=require('util');var logger=require(_0x5ec9('0x1'))(_0x5ec9('0x2'));var moment=require(_0x5ec9('0x3'));var BPromise=require(_0x5ec9('0x4'));var rp=require(_0x5ec9('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5ec9('0x6'));var config=require('../../config/environment');var attributes=require(_0x5ec9('0x7'));module[_0x5ec9('0x8')]=function(_0x1975bd,_0x4adabd){return _0x1975bd[_0x5ec9('0x9')](_0x5ec9('0xa'),attributes,{'tableName':_0x5ec9('0xb'),'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 90c943e..fce6291 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 _0xd76c=['randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','then','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','error','code','message','catch','CreateReportAgentPreview','ReportAgentPreview','create','options','stringify','moment'];(function(_0x1bc6d3,_0x24ec7e){var _0x30db07=function(_0x46caf1){while(--_0x46caf1){_0x1bc6d3['push'](_0x1bc6d3['shift']());}};_0x30db07(++_0x24ec7e);}(_0xd76c,0x1cb));var _0xcd76=function(_0x5cc8,_0x1faa02){_0x5cc8=_0x5cc8-0x0;var _0x450661=_0xd76c[_0x5cc8];return _0x450661;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xcd76('0x0'));var BPromise=require('bluebird');var rs=require(_0xcd76('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcd76('0x2'))['db'];var utils=require(_0xcd76('0x3'));var logger=require('../../config/logger')('rpc');var config=require(_0xcd76('0x4'));var jayson=require(_0xcd76('0x5'));var client=jayson[_0xcd76('0x6')][_0xcd76('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2772ed,_0x5c72ee,_0x373c10){return new BPromise(function(_0x58cbfa,_0xecc20b){return client['request'](_0x2772ed,_0x373c10)[_0xcd76('0x8')](function(_0x1a162f){logger[_0xcd76('0x9')](_0xcd76('0xa'),_0x5c72ee,_0xcd76('0xb'));logger[_0xcd76('0xc')](_0xcd76('0xd'),_0x5c72ee,'request\x20sent',JSON['stringify'](_0x1a162f));if(_0x1a162f[_0xcd76('0xe')]){if(_0x1a162f[_0xcd76('0xe')][_0xcd76('0xf')]===0x1f4){logger[_0xcd76('0xe')](_0xcd76('0xa'),_0x5c72ee,_0x1a162f[_0xcd76('0xe')][_0xcd76('0x10')]);return _0xecc20b(_0x1a162f[_0xcd76('0xe')][_0xcd76('0x10')]);}logger[_0xcd76('0xe')](_0xcd76('0xa'),_0x5c72ee,_0x1a162f[_0xcd76('0xe')][_0xcd76('0x10')]);return _0x58cbfa(_0x1a162f[_0xcd76('0xe')][_0xcd76('0x10')]);}else{logger[_0xcd76('0x9')](_0xcd76('0xa'),_0x5c72ee,'request\x20sent');_0x58cbfa(_0x1a162f['result'][_0xcd76('0x10')]);}})[_0xcd76('0x11')](function(_0x579516){logger[_0xcd76('0xe')](_0xcd76('0xa'),_0x5c72ee,_0x579516);_0xecc20b(_0x579516);});});}exports[_0xcd76('0x12')]=function(_0x2d27b5){var _0x1b92f8=this;return new Promise(function(_0x181bd5,_0x399ecc){return db[_0xcd76('0x13')][_0xcd76('0x14')](_0x2d27b5['body'],{'raw':_0x2d27b5[_0xcd76('0x15')]?_0x2d27b5['options']['raw']===undefined?!![]:![]:!![]})[_0xcd76('0x8')](function(_0x1a74b7){logger['info']('CreateReportAgentPreview',_0x2d27b5);logger[_0xcd76('0xc')](_0xcd76('0x12'),_0x2d27b5,JSON[_0xcd76('0x16')](_0x1a74b7));_0x181bd5(_0x1a74b7);})[_0xcd76('0x11')](function(_0x137269){logger['error']('CreateReportAgentPreview',_0x137269[_0xcd76('0x10')],_0x2d27b5);_0x399ecc(_0x1b92f8[_0xcd76('0xe')](0x1f4,_0x137269[_0xcd76('0x10')]));});});}; \ No newline at end of file +var _0x09a8=['request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ReportAgentPreview','create','body','options','raw','CreateReportAgentPreview','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','ReportAgentPreview,\x20%s,\x20%s'];(function(_0x538a20,_0x5c14d6){var _0xec72f5=function(_0x582321){while(--_0x582321){_0x538a20['push'](_0x538a20['shift']());}};_0xec72f5(++_0x5c14d6);}(_0x09a8,0x1a5));var _0x809a=function(_0x597592,_0x15c160){_0x597592=_0x597592-0x0;var _0x23c97f=_0x09a8[_0x597592];return _0x23c97f;};'use strict';var _=require(_0x809a('0x0'));var util=require('util');var moment=require(_0x809a('0x1'));var BPromise=require('bluebird');var rs=require(_0x809a('0x2'));var fs=require('fs');var Redis=require(_0x809a('0x3'));var db=require(_0x809a('0x4'))['db'];var utils=require(_0x809a('0x5'));var logger=require('../../config/logger')(_0x809a('0x6'));var config=require('../../config/environment');var jayson=require(_0x809a('0x7'));var client=jayson[_0x809a('0x8')][_0x809a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x547bca,_0x2fe0e2,_0x523a3e){return new BPromise(function(_0x737cf1,_0x387c0a){return client[_0x809a('0xa')](_0x547bca,_0x523a3e)[_0x809a('0xb')](function(_0x31fa34){logger[_0x809a('0xc')](_0x809a('0xd'),_0x2fe0e2,_0x809a('0xe'));logger[_0x809a('0xf')](_0x809a('0x10'),_0x2fe0e2,_0x809a('0xe'),JSON[_0x809a('0x11')](_0x31fa34));if(_0x31fa34[_0x809a('0x12')]){if(_0x31fa34['error'][_0x809a('0x13')]===0x1f4){logger['error'](_0x809a('0xd'),_0x2fe0e2,_0x31fa34[_0x809a('0x12')][_0x809a('0x14')]);return _0x387c0a(_0x31fa34[_0x809a('0x12')][_0x809a('0x14')]);}logger[_0x809a('0x12')](_0x809a('0xd'),_0x2fe0e2,_0x31fa34[_0x809a('0x12')]['message']);return _0x737cf1(_0x31fa34[_0x809a('0x12')][_0x809a('0x14')]);}else{logger[_0x809a('0xc')](_0x809a('0xd'),_0x2fe0e2,'request\x20sent');_0x737cf1(_0x31fa34[_0x809a('0x15')]['message']);}})[_0x809a('0x16')](function(_0xbfc3fd){logger[_0x809a('0x12')]('ReportAgentPreview,\x20%s,\x20%s',_0x2fe0e2,_0xbfc3fd);_0x387c0a(_0xbfc3fd);});});}exports['CreateReportAgentPreview']=function(_0x1fd767){var _0x21a990=this;return new Promise(function(_0x121f1f,_0x243e3f){return db[_0x809a('0x17')][_0x809a('0x18')](_0x1fd767[_0x809a('0x19')],{'raw':_0x1fd767[_0x809a('0x1a')]?_0x1fd767[_0x809a('0x1a')][_0x809a('0x1b')]===undefined?!![]:![]:!![]})[_0x809a('0xb')](function(_0x4c7e48){logger[_0x809a('0xc')](_0x809a('0x1c'),_0x1fd767);logger[_0x809a('0xf')](_0x809a('0x1c'),_0x1fd767,JSON['stringify'](_0x4c7e48));_0x121f1f(_0x4c7e48);})[_0x809a('0x16')](function(_0x4079f0){logger[_0x809a('0x12')](_0x809a('0x1c'),_0x4079f0[_0x809a('0x14')],_0x1fd767);_0x243e3f(_0x21a990[_0x809a('0x12')](0x1f4,_0x4079f0[_0x809a('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index daca559..8ae7417 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 _0xfff2=['Router','../../components/auth/service','./rpc.controller','get','/voice/channels','voiceChannels','/voice/channels/:uniqueid/mixmonitor','isAuthenticated','voiceChannelMixMonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues','chatQueues','/mail/accounts','mailAccounts','openchannelQueues','/sms/queues','/whatsapp/queues','whatsappQueues','/fax/queues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','/voice/queues/channels/:uniqueid/redirect/:exten','put','/voice/queues/:id','updateVoiceQueue','/outbound','outbound','/outbound/channels','outboundChannels','/agents','agents','/agents/:id/capacity','agentCapacity','/telephones','telephones','/trunks','trunks','/campaigns','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','/openchannel/queues/:id/waitinginteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','post','/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','chat','/chat/queues/:id','fax','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/sms/queues/:id/notify','/whatsapp/queues/:id/notify','whatsapp','showSmsQueues','/agents/:id/notify','exports','multer','util'];(function(_0x9187c1,_0x76c6a8){var _0x26cda5=function(_0x533beb){while(--_0x533beb){_0x9187c1['push'](_0x9187c1['shift']());}};_0x26cda5(++_0x76c6a8);}(_0xfff2,0x98));var _0x2fff=function(_0x5e31ef,_0xf54ce8){_0x5e31ef=_0x5e31ef-0x0;var _0xc39185=_0xfff2[_0x5e31ef];return _0xc39185;};'use strict';var multer=require(_0x2fff('0x0'));var util=require(_0x2fff('0x1'));var path=require('path');var express=require('express');var router=express[_0x2fff('0x2')]();var auth=require(_0x2fff('0x3'));var controller=require(_0x2fff('0x4'));router[_0x2fff('0x5')](_0x2fff('0x6'),auth['isAuthenticated'](),controller[_0x2fff('0x7')]);router[_0x2fff('0x5')](_0x2fff('0x8'),auth[_0x2fff('0x9')](),controller[_0x2fff('0xa')]);router[_0x2fff('0x5')]('/voice/channels/:uniqueid/stopmixmonitor',auth['isAuthenticated'](),controller[_0x2fff('0xb')]);router[_0x2fff('0x5')](_0x2fff('0xc'),auth[_0x2fff('0x9')](),controller[_0x2fff('0xd')]);router['get'](_0x2fff('0xe'),auth['isAuthenticated'](),controller[_0x2fff('0xf')]);router[_0x2fff('0x5')]('/mail/queues',auth['isAuthenticated'](),controller['mailQueues']);router[_0x2fff('0x5')](_0x2fff('0x10'),auth['isAuthenticated'](),controller[_0x2fff('0x11')]);router['get']('/openchannel/queues',auth[_0x2fff('0x9')](),controller[_0x2fff('0x12')]);router[_0x2fff('0x5')](_0x2fff('0x13'),auth[_0x2fff('0x9')](),controller['smsQueues']);router[_0x2fff('0x5')](_0x2fff('0x14'),auth[_0x2fff('0x9')](),controller[_0x2fff('0x15')]);router[_0x2fff('0x5')](_0x2fff('0x16'),auth[_0x2fff('0x9')](),controller['faxQueues']);router[_0x2fff('0x5')](_0x2fff('0x17'),auth['isAuthenticated'](),controller[_0x2fff('0x18')]);router[_0x2fff('0x5')](_0x2fff('0x19'),auth['isAuthenticated'](),controller['voiceQueuesChannels']);router['get'](_0x2fff('0x1a'),auth['isAuthenticated'](),controller[_0x2fff('0x1b')]);router['get'](_0x2fff('0x1c'),auth[_0x2fff('0x9')](),controller['voiceQueuesChannelHangup']);router['get'](_0x2fff('0x1d'),auth[_0x2fff('0x9')](),controller['voiceQueuesChannelRedirect']);router[_0x2fff('0x5')]('/voice/queues/:id',auth[_0x2fff('0x9')](),controller['showVoiceQueues']);router[_0x2fff('0x1e')](_0x2fff('0x1f'),auth[_0x2fff('0x9')](),controller[_0x2fff('0x20')]);router[_0x2fff('0x5')](_0x2fff('0x21'),auth[_0x2fff('0x9')](),controller[_0x2fff('0x22')]);router[_0x2fff('0x5')](_0x2fff('0x23'),auth[_0x2fff('0x9')](),controller[_0x2fff('0x24')]);router[_0x2fff('0x5')](_0x2fff('0x25'),auth[_0x2fff('0x9')](),controller[_0x2fff('0x26')]);router[_0x2fff('0x1e')](_0x2fff('0x27'),auth[_0x2fff('0x9')](),controller[_0x2fff('0x28')]);router[_0x2fff('0x5')](_0x2fff('0x29'),auth[_0x2fff('0x9')](),controller[_0x2fff('0x2a')]);router[_0x2fff('0x5')](_0x2fff('0x2b'),auth[_0x2fff('0x9')](),controller[_0x2fff('0x2c')]);router[_0x2fff('0x5')](_0x2fff('0x2d'),auth[_0x2fff('0x9')](),controller[_0x2fff('0x2e')]);router[_0x2fff('0x5')](_0x2fff('0x2f'),auth[_0x2fff('0x9')](),controller[_0x2fff('0x30')]);router[_0x2fff('0x5')](_0x2fff('0x31'),auth[_0x2fff('0x9')](),controller[_0x2fff('0x32')]);router[_0x2fff('0x5')](_0x2fff('0x33'),auth[_0x2fff('0x9')](),controller[_0x2fff('0x34')]);router['get'](_0x2fff('0x35'),auth['isAuthenticated'](),controller['openchannelQueuesWaitingInteractions']);router[_0x2fff('0x5')](_0x2fff('0x36'),auth[_0x2fff('0x9')](),controller['openchannelQueuesIdWaitingInteractions']);router[_0x2fff('0x5')](_0x2fff('0x37'),auth[_0x2fff('0x9')](),controller[_0x2fff('0x38')]);router[_0x2fff('0x5')](_0x2fff('0x39'),auth[_0x2fff('0x9')](),controller[_0x2fff('0x3a')]);router[_0x2fff('0x5')]('/fax/queues/waitinginteractions',auth[_0x2fff('0x9')](),controller['faxQueuesWaitingInteractions']);router[_0x2fff('0x3b')](_0x2fff('0x3c'),auth['isAuthenticated'](),controller[_0x2fff('0x3d')](_0x2fff('0x3e')));router['get'](_0x2fff('0x3f'),auth[_0x2fff('0x9')](),controller['showMailQueues']);router[_0x2fff('0x3b')]('/chat/queues/:id/notify',auth[_0x2fff('0x9')](),controller[_0x2fff('0x3d')](_0x2fff('0x40')));router[_0x2fff('0x5')](_0x2fff('0x41'),auth[_0x2fff('0x9')](),controller['showChatQueues']);router[_0x2fff('0x3b')]('/fax/queues/:id/notify',auth[_0x2fff('0x9')](),controller['queueNotify'](_0x2fff('0x42')));router[_0x2fff('0x5')](_0x2fff('0x43'),auth[_0x2fff('0x9')](),controller[_0x2fff('0x44')]);router[_0x2fff('0x3b')](_0x2fff('0x45'),auth[_0x2fff('0x9')](),controller[_0x2fff('0x3d')](_0x2fff('0x46')));router[_0x2fff('0x5')]('/openchannel/queues/:id',auth['isAuthenticated'](),controller['showOpenchannelQueues']);router[_0x2fff('0x3b')](_0x2fff('0x47'),auth['isAuthenticated'](),controller['queueNotify']('sms'));router[_0x2fff('0x3b')](_0x2fff('0x48'),auth[_0x2fff('0x9')](),controller['queueNotify'](_0x2fff('0x49')));router[_0x2fff('0x5')]('/sms/queues/:id',auth[_0x2fff('0x9')](),controller[_0x2fff('0x4a')]);router[_0x2fff('0x5')]('/whatsapp/queues/:id',auth[_0x2fff('0x9')](),controller['showWhatsappQueues']);router[_0x2fff('0x3b')](_0x2fff('0x4b'),auth[_0x2fff('0x9')](),controller['agentNotify']);module[_0x2fff('0x4c')]=router; \ No newline at end of file +var _0x7694=['outbound','/outbound/channels','outboundChannels','/agents','agents','agentCapacity','/telephones','telephones','/trunks','/campaigns','campaigns','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','/mail/queues/:id/notify','queueNotify','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','chat','/chat/queues/:id','post','/fax/queues/:id/notify','fax','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','sms','whatsapp','/sms/queues/:id','/whatsapp/queues/:id','/agents/:id/notify','exports','multer','util','express','../../components/auth/service','./rpc.controller','/voice/channels','isAuthenticated','voiceChannels','get','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','voiceChannelStopMixMonitor','voiceQueues','/chat/queues','chatQueues','/mail/queues','mailQueues','/mail/accounts','mailAccounts','/openchannel/queues','openchannelQueues','/sms/queues','smsQueues','/whatsapp/queues','whatsappQueues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','put','updateVoiceQueue','/outbound'];(function(_0x56e363,_0x146efe){var _0x11e555=function(_0x434a4d){while(--_0x434a4d){_0x56e363['push'](_0x56e363['shift']());}};_0x11e555(++_0x146efe);}(_0x7694,0x86));var _0x4769=function(_0x3872a6,_0x5b68c7){_0x3872a6=_0x3872a6-0x0;var _0x24ef22=_0x7694[_0x3872a6];return _0x24ef22;};'use strict';var multer=require(_0x4769('0x0'));var util=require(_0x4769('0x1'));var path=require('path');var express=require(_0x4769('0x2'));var router=express['Router']();var auth=require(_0x4769('0x3'));var controller=require(_0x4769('0x4'));router['get'](_0x4769('0x5'),auth[_0x4769('0x6')](),controller[_0x4769('0x7')]);router[_0x4769('0x8')](_0x4769('0x9'),auth[_0x4769('0x6')](),controller[_0x4769('0xa')]);router[_0x4769('0x8')]('/voice/channels/:uniqueid/stopmixmonitor',auth[_0x4769('0x6')](),controller[_0x4769('0xb')]);router[_0x4769('0x8')]('/voice/queues',auth['isAuthenticated'](),controller[_0x4769('0xc')]);router[_0x4769('0x8')](_0x4769('0xd'),auth['isAuthenticated'](),controller[_0x4769('0xe')]);router[_0x4769('0x8')](_0x4769('0xf'),auth[_0x4769('0x6')](),controller[_0x4769('0x10')]);router['get'](_0x4769('0x11'),auth[_0x4769('0x6')](),controller[_0x4769('0x12')]);router[_0x4769('0x8')](_0x4769('0x13'),auth[_0x4769('0x6')](),controller[_0x4769('0x14')]);router['get'](_0x4769('0x15'),auth[_0x4769('0x6')](),controller[_0x4769('0x16')]);router[_0x4769('0x8')](_0x4769('0x17'),auth[_0x4769('0x6')](),controller[_0x4769('0x18')]);router[_0x4769('0x8')]('/fax/queues',auth[_0x4769('0x6')](),controller[_0x4769('0x19')]);router[_0x4769('0x8')](_0x4769('0x1a'),auth[_0x4769('0x6')](),controller[_0x4769('0x1b')]);router['get']('/voice/queues/channels',auth[_0x4769('0x6')](),controller[_0x4769('0x1c')]);router[_0x4769('0x8')](_0x4769('0x1d'),auth[_0x4769('0x6')](),controller[_0x4769('0x1e')]);router[_0x4769('0x8')](_0x4769('0x1f'),auth[_0x4769('0x6')](),controller[_0x4769('0x20')]);router[_0x4769('0x8')](_0x4769('0x21'),auth[_0x4769('0x6')](),controller[_0x4769('0x22')]);router[_0x4769('0x8')](_0x4769('0x23'),auth[_0x4769('0x6')](),controller[_0x4769('0x24')]);router[_0x4769('0x25')](_0x4769('0x23'),auth[_0x4769('0x6')](),controller[_0x4769('0x26')]);router[_0x4769('0x8')](_0x4769('0x27'),auth['isAuthenticated'](),controller[_0x4769('0x28')]);router[_0x4769('0x8')](_0x4769('0x29'),auth[_0x4769('0x6')](),controller[_0x4769('0x2a')]);router[_0x4769('0x8')](_0x4769('0x2b'),auth[_0x4769('0x6')](),controller[_0x4769('0x2c')]);router[_0x4769('0x25')]('/agents/:id/capacity',auth[_0x4769('0x6')](),controller[_0x4769('0x2d')]);router[_0x4769('0x8')](_0x4769('0x2e'),auth['isAuthenticated'](),controller[_0x4769('0x2f')]);router[_0x4769('0x8')](_0x4769('0x30'),auth[_0x4769('0x6')](),controller['trunks']);router['get'](_0x4769('0x31'),auth[_0x4769('0x6')](),controller[_0x4769('0x32')]);router[_0x4769('0x8')]('/fax/accounts',auth['isAuthenticated'](),controller[_0x4769('0x33')]);router[_0x4769('0x8')](_0x4769('0x34'),auth[_0x4769('0x6')](),controller[_0x4769('0x35')]);router['get'](_0x4769('0x36'),auth['isAuthenticated'](),controller[_0x4769('0x37')]);router[_0x4769('0x8')](_0x4769('0x38'),auth[_0x4769('0x6')](),controller[_0x4769('0x39')]);router[_0x4769('0x8')](_0x4769('0x3a'),auth[_0x4769('0x6')](),controller['openchannelQueuesIdWaitingInteractions']);router[_0x4769('0x8')](_0x4769('0x3b'),auth[_0x4769('0x6')](),controller[_0x4769('0x3c')]);router[_0x4769('0x8')](_0x4769('0x3d'),auth[_0x4769('0x6')](),controller[_0x4769('0x3e')]);router['get'](_0x4769('0x3f'),auth[_0x4769('0x6')](),controller[_0x4769('0x40')]);router['post'](_0x4769('0x41'),auth['isAuthenticated'](),controller[_0x4769('0x42')]('mail'));router[_0x4769('0x8')](_0x4769('0x43'),auth[_0x4769('0x6')](),controller[_0x4769('0x44')]);router['post'](_0x4769('0x45'),auth[_0x4769('0x6')](),controller[_0x4769('0x42')](_0x4769('0x46')));router['get'](_0x4769('0x47'),auth['isAuthenticated'](),controller['showChatQueues']);router[_0x4769('0x48')](_0x4769('0x49'),auth[_0x4769('0x6')](),controller[_0x4769('0x42')](_0x4769('0x4a')));router[_0x4769('0x8')](_0x4769('0x4b'),auth['isAuthenticated'](),controller[_0x4769('0x4c')]);router[_0x4769('0x48')](_0x4769('0x4d'),auth[_0x4769('0x6')](),controller['queueNotify']('openchannel'));router[_0x4769('0x8')](_0x4769('0x4e'),auth['isAuthenticated'](),controller[_0x4769('0x4f')]);router[_0x4769('0x48')](_0x4769('0x50'),auth[_0x4769('0x6')](),controller[_0x4769('0x42')](_0x4769('0x51')));router[_0x4769('0x48')]('/whatsapp/queues/:id/notify',auth[_0x4769('0x6')](),controller[_0x4769('0x42')](_0x4769('0x52')));router[_0x4769('0x8')](_0x4769('0x53'),auth['isAuthenticated'](),controller['showSmsQueues']);router[_0x4769('0x8')](_0x4769('0x54'),auth[_0x4769('0x6')](),controller['showWhatsappQueues']);router['post'](_0x4769('0x55'),auth[_0x4769('0x6')](),controller['agentNotify']);module[_0x4769('0x56')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index 5d40ad2..14613db 100644 --- a/server/api/rpc/rpc.controller.js +++ b/server/api/rpc/rpc.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['showSmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','faxQueues','FaxQueues','FaxAccounts','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','map','queue_id','uniq','value','filter','indexOf','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','Website','Account','Queue','findOne','\x20Queue\x20not\x20found','messageId','Interaction','\x20Message\x20not\x20found','update','MessageId','InteractionId','From','QueueId','TransferReport','queueTransferTimeout','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','capitalize','chat','agent','Message','create','Start','agentTransferTimeout','bluebird','moment','../../config/logger','api','jayson/promise','client','http','request','then','error','code','result','catch','status','json','sendStatus','stack','name','send','isNil','rows','find','voiceChannels','VoiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','params','VoiceChannelStopMixMonitor','merge','voiceQueues','VoiceQueues','showVoiceQueues','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesChannels','voiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','interaction','findAll','user','length','format','updateAttributes','MemberReport','findOrCreate','INTERACTION','interface','SIP/%s','internal','capacity','campaigns','showChatQueues','ChatQueues','MailQueues','showMailQueues','mailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues'];(function(_0x338c9,_0x44383e){var _0x29e8d0=function(_0x302125){while(--_0x302125){_0x338c9['push'](_0x338c9['shift']());}};_0x29e8d0(++_0x44383e);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var BPromise=require(_0x0d8b('0x0'));var moment=require(_0x0d8b('0x1'));var _=require('lodash');var util=require('util');var db=require('../../mysqldb')['db'];var logger=require(_0x0d8b('0x2'))(_0x0d8b('0x3'));var jayson=require(_0x0d8b('0x4'));var amiClient=jayson[_0x0d8b('0x5')][_0x0d8b('0x6')]({'port':0x232a});var mailClient=jayson['client']['http']({'port':0x232b});var routingClient=jayson[_0x0d8b('0x5')][_0x0d8b('0x6')]({'port':0x232c});function respondWithRpcPromise(_0x39f43a,_0x4a4470,_0x413284){return new BPromise(function(_0x284169,_0x58e4e2){var _0x129310=_0x413284?_0x413284:amiClient;return _0x129310[_0x0d8b('0x7')](_0x39f43a,_0x4a4470)[_0x0d8b('0x8')](function(_0x1f4800){if(_0x1f4800[_0x0d8b('0x9')]){if(_0x1f4800[_0x0d8b('0x9')][_0x0d8b('0xa')]===0x1f4){return _0x58e4e2(_0x1f4800[_0x0d8b('0x9')]['message']);}return _0x284169(_0x1f4800[_0x0d8b('0x9')]['message']);}else{_0x284169(_0x1f4800[_0x0d8b('0xb')]);}})[_0x0d8b('0xc')](function(_0x340cc4){_0x58e4e2(_0x340cc4);});});}function respondWithResult(_0x92cdd8,_0x35a07b){_0x35a07b=_0x35a07b||0xc8;return function(_0x32bb1a){if(_0x32bb1a){return _0x92cdd8[_0x0d8b('0xd')](_0x35a07b)[_0x0d8b('0xe')](_0x32bb1a);}return _0x92cdd8[_0x0d8b('0xf')](0x194);};}function handleError(_0x2ce75e,_0x5ad086){_0x5ad086=_0x5ad086||0x1f4;return function(_0xe65334){logger[_0x0d8b('0x9')](_0xe65334[_0x0d8b('0x10')]);if(_0xe65334['name']){delete _0xe65334[_0x0d8b('0x11')];}_0x2ce75e[_0x0d8b('0xd')](_0x5ad086)[_0x0d8b('0x12')](_0xe65334);};}function findById(_0xe2e167){return function(_0x2cb03c){if(!_['isNil'](_0xe2e167)&&!_[_0x0d8b('0x13')](_0x2cb03c)&&!_[_0x0d8b('0x13')](_0x2cb03c[_0x0d8b('0x14')])){return _[_0x0d8b('0x15')](_0x2cb03c[_0x0d8b('0x14')],function(_0x18dd2d){return _0x18dd2d['id']==_0xe2e167;});}return null;};}exports[_0x0d8b('0x16')]=function(_0xa3612a,_0x4a15bf){return respondWithRpcPromise(_0x0d8b('0x17'),_0xa3612a[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x4a15bf,null))[_0x0d8b('0xc')](handleError(_0x4a15bf,null));};exports[_0x0d8b('0x19')]=function(_0x5b709c,_0x393beb){return respondWithRpcPromise(_0x0d8b('0x1a'),_['merge'](_0x5b709c['query'],_0x5b709c[_0x0d8b('0x1b')]))['then'](respondWithResult(_0x393beb,null))['catch'](handleError(_0x393beb,null));};exports['voiceChannelStopMixMonitor']=function(_0x238728,_0x2b924f){return respondWithRpcPromise(_0x0d8b('0x1c'),_[_0x0d8b('0x1d')](_0x238728[_0x0d8b('0x18')],_0x238728[_0x0d8b('0x1b')]))[_0x0d8b('0x8')](respondWithResult(_0x2b924f,null))[_0x0d8b('0xc')](handleError(_0x2b924f,null));};exports[_0x0d8b('0x1e')]=function(_0x5e5bc3,_0xe8bbee){return respondWithRpcPromise(_0x0d8b('0x1f'),_0x5e5bc3['query'])[_0x0d8b('0x8')](respondWithResult(_0xe8bbee,null))['catch'](handleError(_0xe8bbee,null));};exports[_0x0d8b('0x20')]=function(_0x234bdd,_0xa2af02){return respondWithRpcPromise('VoiceQueues',_0x234bdd['query'])[_0x0d8b('0x8')](findById(_0x234bdd[_0x0d8b('0x1b')]['id']))['then'](respondWithResult(_0xa2af02,null))[_0x0d8b('0xc')](handleError(_0xa2af02,null));};exports['updateVoiceQueue']=function(_0x1b2b59,_0x4b59e5){return respondWithRpcPromise(_0x0d8b('0x21'),_['merge'](_0x1b2b59[_0x0d8b('0x22')],_0x1b2b59['params']))[_0x0d8b('0x8')](respondWithResult(_0x4b59e5,null))['catch'](handleError(_0x4b59e5,null));};exports[_0x0d8b('0x23')]=function(_0x106e4c,_0x2c058d){return respondWithRpcPromise('VoiceQueuesPreview',_['merge'](_0x106e4c['query'],_0x106e4c[_0x0d8b('0x1b')]))['then'](respondWithResult(_0x2c058d,null))[_0x0d8b('0xc')](handleError(_0x2c058d,null));};exports['voiceQueuesChannels']=function(_0x5d05fc,_0x36017a){return respondWithRpcPromise(_0x0d8b('0x24'),_0x5d05fc[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x36017a,null))[_0x0d8b('0xc')](handleError(_0x36017a,null));};exports[_0x0d8b('0x25')]=function(_0x4a99d3,_0x6f93c7){return respondWithRpcPromise('VoiceQueuesChannel',_[_0x0d8b('0x1d')](_0x4a99d3[_0x0d8b('0x18')],_0x4a99d3['params']))[_0x0d8b('0x8')](respondWithResult(_0x6f93c7,null))[_0x0d8b('0xc')](handleError(_0x6f93c7,null));};exports[_0x0d8b('0x26')]=function(_0x4f2ed2,_0x113318){return respondWithRpcPromise(_0x0d8b('0x27'),_[_0x0d8b('0x1d')](_0x4f2ed2[_0x0d8b('0x18')],_0x4f2ed2[_0x0d8b('0x1b')]))['then'](respondWithResult(_0x113318,null))[_0x0d8b('0xc')](handleError(_0x113318,null));};exports[_0x0d8b('0x28')]=function(_0x5ad0fe,_0x1180ac){return respondWithRpcPromise(_0x0d8b('0x29'),_[_0x0d8b('0x1d')](_0x5ad0fe[_0x0d8b('0x18')],_0x5ad0fe[_0x0d8b('0x1b')]))['then'](respondWithResult(_0x1180ac,null))['catch'](handleError(_0x1180ac,null));};exports[_0x0d8b('0x2a')]=function(_0x5c2c04,_0x531c55){return respondWithRpcPromise(_0x0d8b('0x2b'),_0x5c2c04[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x531c55,null))[_0x0d8b('0xc')](handleError(_0x531c55,null));};exports[_0x0d8b('0x2c')]=function(_0x24c789,_0x579324){return respondWithRpcPromise(_0x0d8b('0x2d'),_0x24c789[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x579324,null))[_0x0d8b('0xc')](handleError(_0x579324,null));};exports[_0x0d8b('0x2e')]=function(_0x1a39ad,_0xf1680e){var _0x5c980b;return respondWithRpcPromise(_0x0d8b('0x2f'),_0x1a39ad[_0x0d8b('0x18')])[_0x0d8b('0x8')](function(_0x1f196d){_0x5c980b=_0x1f196d;return respondWithRpcPromise('Agents',_0x1a39ad[_0x0d8b('0x18')],routingClient);})['then'](function(_0x37b26c){return _[_0x0d8b('0x1d')]({},_0x37b26c,_0x5c980b);})[_0x0d8b('0x8')](respondWithResult(_0xf1680e,null))[_0x0d8b('0xc')](handleError(_0xf1680e,null));};exports[_0x0d8b('0x30')]=function(_0x3e632e,_0x1ff17d){if(_0x3e632e[_0x0d8b('0x22')]&&_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')]&&_0x3e632e['user']&&_0x3e632e['user']['name']){for(var _0x4d0811 in _0x3e632e['body'][_0x0d8b('0x31')]){if(_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')]['hasOwnProperty'](_0x4d0811)){db['MemberReport'][_0x0d8b('0x32')]({'where':{'channel':_0x4d0811,'membername':_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x11')],'type':'INTERACTION','exitAt':null,'uniqueid':_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')][_0x4d0811]&&_0x3e632e['body']['interaction'][_0x4d0811][_0x0d8b('0x34')]?{'$notIn':_0x3e632e['body'][_0x0d8b('0x31')][_0x4d0811]}:{'$ne':null}}})['then'](function(_0x53f643){var _0x30ccee=moment()[_0x0d8b('0x35')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x5ebe8a=0x0,_0x59b8e9=_0x53f643['length'];_0x5ebe8a<_0x59b8e9;_0x5ebe8a+=0x1){_0x53f643[_0x5ebe8a][_0x0d8b('0x36')]({'exitAt':_0x30ccee});}});for(var _0x1e0498=0x0;_0x1e0498<_0x3e632e[_0x0d8b('0x22')]['interaction'][_0x4d0811][_0x0d8b('0x34')];_0x1e0498+=0x1){db[_0x0d8b('0x37')][_0x0d8b('0x38')]({'where':{'channel':_0x4d0811,'membername':_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x11')],'type':_0x0d8b('0x39'),'uniqueid':_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')][_0x4d0811][_0x1e0498],'exitAt':null},'defaults':{'channel':_0x4d0811,'membername':_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x11')],'interface':_[_0x0d8b('0x13')](_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x3a')])?util[_0x0d8b('0x35')](_0x0d8b('0x3b'),_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x11')]):_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x3a')],'type':'INTERACTION','enterAt':moment()[_0x0d8b('0x35')]('YYYY-MM-DD\x20HH:mm:ss'),'role':'agent','internal':_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x3c')],'uniqueid':_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')][_0x4d0811][_0x1e0498]}});}}}}return respondWithRpcPromise('AgentCapacity',{'id':_0x3e632e[_0x0d8b('0x1b')]['id'],'capacity':_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x3d')]},routingClient)[_0x0d8b('0x8')](respondWithResult(_0x1ff17d,null))[_0x0d8b('0xc')](handleError(_0x1ff17d,null));};exports['telephones']=function(_0x5c0824,_0x4e4d5f){return respondWithRpcPromise('Telephones',_0x5c0824[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x4e4d5f,null))['catch'](handleError(_0x4e4d5f,null));};exports['trunks']=function(_0x44c5c1,_0x3d3cb6){return respondWithRpcPromise('Trunks',_0x44c5c1['query'])[_0x0d8b('0x8')](respondWithResult(_0x3d3cb6,null))[_0x0d8b('0xc')](handleError(_0x3d3cb6,null));};exports[_0x0d8b('0x3e')]=function(_0x346c0d,_0x2d5519){return respondWithRpcPromise('Campaigns',_0x346c0d[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x2d5519,null))['catch'](handleError(_0x2d5519,null));};exports['chatQueues']=function(_0xf6a773,_0x3f2d95){return respondWithRpcPromise('ChatQueues',_0xf6a773['query'],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3f2d95,null))[_0x0d8b('0xc')](handleError(_0x3f2d95,null));};exports[_0x0d8b('0x3f')]=function(_0xb58818,_0x4a2989){return respondWithRpcPromise(_0x0d8b('0x40'),_0xb58818['query'],routingClient)['then'](findById(_0xb58818[_0x0d8b('0x1b')]['id']))[_0x0d8b('0x8')](respondWithResult(_0x4a2989,null))['catch'](handleError(_0x4a2989,null));};exports['mailQueues']=function(_0x44ed23,_0x3d7161){return respondWithRpcPromise(_0x0d8b('0x41'),_0x44ed23[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3d7161,null))[_0x0d8b('0xc')](handleError(_0x3d7161,null));};exports[_0x0d8b('0x42')]=function(_0x3bead7,_0x5418d8){return respondWithRpcPromise(_0x0d8b('0x41'),_0x3bead7[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](findById(_0x3bead7[_0x0d8b('0x1b')]['id']))[_0x0d8b('0x8')](respondWithResult(_0x5418d8,null))[_0x0d8b('0xc')](handleError(_0x5418d8,null));};exports[_0x0d8b('0x43')]=function(_0x1c78b6,_0x375684){return respondWithRpcPromise('MailAccounts',_0x1c78b6[_0x0d8b('0x18')],mailClient)[_0x0d8b('0x8')](respondWithResult(_0x375684,null))[_0x0d8b('0xc')](handleError(_0x375684,null));};exports[_0x0d8b('0x44')]=function(_0x43ad22,_0x577951){return respondWithRpcPromise(_0x0d8b('0x45'),_0x43ad22[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x577951,null))[_0x0d8b('0xc')](handleError(_0x577951,null));};exports[_0x0d8b('0x46')]=function(_0x59ada2,_0x4d0e7c){return respondWithRpcPromise(_0x0d8b('0x45'),_0x59ada2[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](findById(_0x59ada2[_0x0d8b('0x1b')]['id']))['then'](respondWithResult(_0x4d0e7c,null))[_0x0d8b('0xc')](handleError(_0x4d0e7c,null));};exports[_0x0d8b('0x47')]=function(_0x8c0bbe,_0x5952dd){return respondWithRpcPromise(_0x0d8b('0x48'),_0x8c0bbe['query'],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x5952dd,null))[_0x0d8b('0xc')](handleError(_0x5952dd,null));};exports[_0x0d8b('0x49')]=function(_0x26ccf0,_0x2b6eb6){return respondWithRpcPromise(_0x0d8b('0x48'),_0x26ccf0['query'],routingClient)[_0x0d8b('0x8')](findById(_0x26ccf0['params']['id']))[_0x0d8b('0x8')](respondWithResult(_0x2b6eb6,null))[_0x0d8b('0xc')](handleError(_0x2b6eb6,null));};exports[_0x0d8b('0x4a')]=function(_0x33a614,_0x48025e){return respondWithRpcPromise(_0x0d8b('0x4b'),_0x33a614[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x48025e,null))[_0x0d8b('0xc')](handleError(_0x48025e,null));};exports[_0x0d8b('0x4c')]=function(_0x273aef,_0x223fd8){return respondWithRpcPromise(_0x0d8b('0x4b'),_0x273aef[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](findById(_0x273aef['params']['id']))['then'](respondWithResult(_0x223fd8,null))[_0x0d8b('0xc')](handleError(_0x223fd8,null));};exports[_0x0d8b('0x4d')]=function(_0x53e399,_0xb1aa96){return respondWithRpcPromise('FaxQueues',_0x53e399['query'],routingClient)[_0x0d8b('0x8')](respondWithResult(_0xb1aa96,null))[_0x0d8b('0xc')](handleError(_0xb1aa96,null));};exports['showFaxQueues']=function(_0x587128,_0x1900e3){return respondWithRpcPromise(_0x0d8b('0x4e'),_0x587128[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](findById(_0x587128[_0x0d8b('0x1b')]['id']))[_0x0d8b('0x8')](respondWithResult(_0x1900e3,null))[_0x0d8b('0xc')](handleError(_0x1900e3,null));};exports['faxAccounts']=function(_0x1ca60c,_0x5878c2){return respondWithRpcPromise(_0x0d8b('0x4f'),_0x1ca60c[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x5878c2,null))[_0x0d8b('0xc')](handleError(_0x5878c2,null));};exports['chatQueuesWaitingInteractions']=function(_0x3fe47d,_0x4a1c4a){return respondWithRpcPromise(_0x0d8b('0x50'),_0x3fe47d[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x4a1c4a,null))[_0x0d8b('0xc')](handleError(_0x4a1c4a,null));};exports[_0x0d8b('0x51')]=function(_0x2b44e5,_0x3e927c){return respondWithRpcPromise(_0x0d8b('0x52'),_0x2b44e5[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3e927c,null))['catch'](handleError(_0x3e927c,null));};exports[_0x0d8b('0x53')]=function(_0x54c28b,_0x3e4121){return respondWithRpcPromise(_0x0d8b('0x54'),_0x54c28b['query'],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3e4121,null))['catch'](handleError(_0x3e4121,null));};exports[_0x0d8b('0x55')]=function(_0x445a00,_0x24f75){return respondWithRpcPromise(_0x0d8b('0x54'),_0x445a00[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](function(_0x3a073b){if(_0x445a00[_0x0d8b('0x18')]['type']!==undefined){var _0x10eca6=_(_0x3a073b[_0x0d8b('0x14')])['filter']([_0x445a00[_0x0d8b('0x18')][_0x0d8b('0x56')],_0x445a00[_0x0d8b('0x1b')]['id']])[_0x0d8b('0x57')](_0x0d8b('0x58'))[_0x0d8b('0x59')]()[_0x0d8b('0x5a')]();return _0x3a073b[_0x0d8b('0x14')][_0x0d8b('0x5b')](function(_0x5007c0){return _0x10eca6[_0x0d8b('0x5c')](_0x5007c0[_0x0d8b('0x58')])>-0x1;});}else{return _0x3a073b['rows'][_0x0d8b('0x5b')](function(_0x93fc55){return _0x93fc55[_0x0d8b('0x58')]===parseInt(_0x445a00['params']['id']);});}})['then'](respondWithResult(_0x24f75,null))[_0x0d8b('0xc')](handleError(_0x24f75,null));};exports[_0x0d8b('0x5d')]=function(_0x2c55bc,_0x5b76af){return respondWithRpcPromise('SmsQueuesWaitingInteractions',_0x2c55bc[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x5b76af,null))[_0x0d8b('0xc')](handleError(_0x5b76af,null));};exports[_0x0d8b('0x5e')]=function(_0x2a2b58,_0x3f7895){return respondWithRpcPromise(_0x0d8b('0x5f'),_0x2a2b58[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3f7895,null))[_0x0d8b('0xc')](handleError(_0x3f7895,null));};exports[_0x0d8b('0x60')]=function(_0x291336,_0x3b060e){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0x291336[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3b060e,null))['catch'](handleError(_0x3b060e,null));};exports['queueNotify']=function(_0x1a1029){return function(_0x1dad9f,_0x3573b4){var _0x14b1b8,_0x23e2e0;var _0x354208=_['capitalize'](_0x1a1029);var _0x502715=_0x1a1029==='chat'?_0x0d8b('0x61'):_0x0d8b('0x62');return db[_0x354208+_0x0d8b('0x63')][_0x0d8b('0x64')]({'raw':!![],'where':{'id':_0x1dad9f[_0x0d8b('0x1b')]['id']}})[_0x0d8b('0x8')](function(_0x5ef461){if(_[_0x0d8b('0x13')](_0x5ef461)){throw new Error(_0x354208+_0x0d8b('0x65'));}_0x14b1b8=_0x5ef461;return db[_0x354208+'Message'][_0x0d8b('0x64')]({'where':{'id':_0x1dad9f['body'][_0x0d8b('0x66')]},'include':[{'model':db[_0x354208+_0x0d8b('0x67')],'as':_0x0d8b('0x67')},{'model':db[_0x354208+_0x502715],'as':_0x0d8b('0x62')}]});})[_0x0d8b('0x8')](function(_0x8fae7f){if(_[_0x0d8b('0x13')](_0x8fae7f)){throw new Error(_0x354208+_0x0d8b('0x68'));}_0x23e2e0=_0x8fae7f;return _0x8fae7f[_0x0d8b('0x69')]({'read':0x0,'readAt':null,'UserId':null});})[_0x0d8b('0x8')](function(){var _0x276558={'uniqueid':_0x1a1029+'.'+_0x23e2e0['id']+'.'+_0x23e2e0[_0x0d8b('0x67')]['id'],'FromUserId':_0x1dad9f['user']['id'],'type':'queue'};_0x276558[_0x354208+_0x0d8b('0x6a')]=_0x23e2e0['id'];_0x276558[_0x354208+_0x0d8b('0x6b')]=_0x23e2e0[_0x0d8b('0x67')]['id'];_0x276558[_0x0d8b('0x6c')+_0x354208+_0x502715+'Id']=_0x23e2e0[_0x0d8b('0x62')]['id'];_0x276558['To'+_0x354208+_0x0d8b('0x6d')]=_0x14b1b8['id'];return db[_0x354208+_0x0d8b('0x6e')]['create'](_0x276558);})[_0x0d8b('0x8')](function(){return respondWithRpcPromise('Start',{'channel':_0x1a1029,'interaction':_0x23e2e0[_0x0d8b('0x67')],'message':_0x23e2e0,'account':_0x23e2e0['Account'],'applications':[{'id':0x0,'priority':0x1,'app':'queue','appdata':_0x14b1b8[_0x0d8b('0x11')]+','+(_0x23e2e0[_0x0d8b('0x62')][_0x0d8b('0x6f')]||0x12c),'interval':_0x0d8b('0x70')}],'transfer':!![]},routingClient);})[_0x0d8b('0x8')](respondWithResult(_0x3573b4,null))[_0x0d8b('0xc')](handleError(_0x3573b4,null));};};exports[_0x0d8b('0x71')]=function(_0x180eda,_0x35267a){var _0x20a8b6,_0x3a6014;if(_[_0x0d8b('0x13')](_0x180eda['body'][_0x0d8b('0x72')])){throw new Error(_0x0d8b('0x73'));}var _0x8be77c=_0x180eda['body']['channel'];var _0x2db144=_[_0x0d8b('0x74')](_0x8be77c);var _0x36d6ca=_0x8be77c===_0x0d8b('0x75')?_0x0d8b('0x61'):_0x0d8b('0x62');return db['User'][_0x0d8b('0x64')]({'raw':!![],'where':{'id':_0x180eda[_0x0d8b('0x1b')]['id'],'role':_0x0d8b('0x76')}})[_0x0d8b('0x8')](function(_0x4350ee){if(_['isNil'](_0x4350ee)){throw new Error('Agent\x20not\x20found');}_0x20a8b6=_0x4350ee;return db[_0x2db144+_0x0d8b('0x77')][_0x0d8b('0x64')]({'where':{'id':_0x180eda[_0x0d8b('0x22')]['messageId']},'include':[{'model':db[_0x2db144+_0x0d8b('0x67')],'as':_0x0d8b('0x67')},{'model':db[_0x2db144+_0x36d6ca],'as':_0x0d8b('0x62')}]});})['then'](function(_0xb61d4b){if(_[_0x0d8b('0x13')](_0xb61d4b)){throw new Error(_0x2db144+_0x0d8b('0x68'));}_0x3a6014=_0xb61d4b;return _0xb61d4b[_0x0d8b('0x69')]({'read':0x0,'readAt':null,'UserId':null});})[_0x0d8b('0x8')](function(){var _0x150e9f={'uniqueid':_0x8be77c+'.'+_0x3a6014['id']+'.'+_0x3a6014[_0x0d8b('0x67')]['id'],'FromUserId':_0x180eda[_0x0d8b('0x33')]['id'],'type':_0x0d8b('0x76'),'ToUserId':_0x20a8b6['id']};_0x150e9f[_0x2db144+'MessageId']=_0x3a6014['id'];_0x150e9f[_0x2db144+_0x0d8b('0x6b')]=_0x3a6014[_0x0d8b('0x67')]['id'];_0x150e9f[_0x0d8b('0x6c')+_0x2db144+_0x36d6ca+'Id']=_0x3a6014[_0x0d8b('0x62')]['id'];return db[_0x2db144+_0x0d8b('0x6e')][_0x0d8b('0x78')](_0x150e9f);})[_0x0d8b('0x8')](function(){return respondWithRpcPromise(_0x0d8b('0x79'),{'channel':_0x8be77c,'interaction':_0x3a6014[_0x0d8b('0x67')],'message':_0x3a6014,'account':_0x3a6014['Account'],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0x20a8b6[_0x0d8b('0x11')]+','+(_0x3a6014[_0x0d8b('0x62')][_0x0d8b('0x7a')]||0x12c),'interval':_0x0d8b('0x70')}],'transfer':!![]},routingClient);})['then'](respondWithResult(_0x35267a,null))[_0x0d8b('0xc')](handleError(_0x35267a,null));}; \ No newline at end of file +var _0xd8b0=['showSmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','faxQueues','FaxQueues','FaxAccounts','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','map','queue_id','uniq','value','filter','indexOf','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','Website','Account','Queue','findOne','\x20Queue\x20not\x20found','messageId','Interaction','\x20Message\x20not\x20found','update','MessageId','InteractionId','From','QueueId','TransferReport','queueTransferTimeout','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','capitalize','chat','agent','Message','create','Start','agentTransferTimeout','bluebird','moment','../../config/logger','api','jayson/promise','client','http','request','then','error','code','result','catch','status','json','sendStatus','stack','name','send','isNil','rows','find','voiceChannels','VoiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','params','VoiceChannelStopMixMonitor','merge','voiceQueues','VoiceQueues','showVoiceQueues','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesChannels','voiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','interaction','findAll','user','length','format','updateAttributes','MemberReport','findOrCreate','INTERACTION','interface','SIP/%s','internal','capacity','campaigns','showChatQueues','ChatQueues','MailQueues','showMailQueues','mailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues'];(function(_0xd9c94b,_0x76ec54){var _0x47e75f=function(_0x1549da){while(--_0x1549da){_0xd9c94b['push'](_0xd9c94b['shift']());}};_0x47e75f(++_0x76ec54);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var BPromise=require(_0x0d8b('0x0'));var moment=require(_0x0d8b('0x1'));var _=require('lodash');var util=require('util');var db=require('../../mysqldb')['db'];var logger=require(_0x0d8b('0x2'))(_0x0d8b('0x3'));var jayson=require(_0x0d8b('0x4'));var amiClient=jayson[_0x0d8b('0x5')][_0x0d8b('0x6')]({'port':0x232a});var mailClient=jayson['client']['http']({'port':0x232b});var routingClient=jayson[_0x0d8b('0x5')][_0x0d8b('0x6')]({'port':0x232c});function respondWithRpcPromise(_0x39f43a,_0x4a4470,_0x413284){return new BPromise(function(_0x284169,_0x58e4e2){var _0x129310=_0x413284?_0x413284:amiClient;return _0x129310[_0x0d8b('0x7')](_0x39f43a,_0x4a4470)[_0x0d8b('0x8')](function(_0x1f4800){if(_0x1f4800[_0x0d8b('0x9')]){if(_0x1f4800[_0x0d8b('0x9')][_0x0d8b('0xa')]===0x1f4){return _0x58e4e2(_0x1f4800[_0x0d8b('0x9')]['message']);}return _0x284169(_0x1f4800[_0x0d8b('0x9')]['message']);}else{_0x284169(_0x1f4800[_0x0d8b('0xb')]);}})[_0x0d8b('0xc')](function(_0x340cc4){_0x58e4e2(_0x340cc4);});});}function respondWithResult(_0x92cdd8,_0x35a07b){_0x35a07b=_0x35a07b||0xc8;return function(_0x32bb1a){if(_0x32bb1a){return _0x92cdd8[_0x0d8b('0xd')](_0x35a07b)[_0x0d8b('0xe')](_0x32bb1a);}return _0x92cdd8[_0x0d8b('0xf')](0x194);};}function handleError(_0x2ce75e,_0x5ad086){_0x5ad086=_0x5ad086||0x1f4;return function(_0xe65334){logger[_0x0d8b('0x9')](_0xe65334[_0x0d8b('0x10')]);if(_0xe65334['name']){delete _0xe65334[_0x0d8b('0x11')];}_0x2ce75e[_0x0d8b('0xd')](_0x5ad086)[_0x0d8b('0x12')](_0xe65334);};}function findById(_0xe2e167){return function(_0x2cb03c){if(!_['isNil'](_0xe2e167)&&!_[_0x0d8b('0x13')](_0x2cb03c)&&!_[_0x0d8b('0x13')](_0x2cb03c[_0x0d8b('0x14')])){return _[_0x0d8b('0x15')](_0x2cb03c[_0x0d8b('0x14')],function(_0x18dd2d){return _0x18dd2d['id']==_0xe2e167;});}return null;};}exports[_0x0d8b('0x16')]=function(_0xa3612a,_0x4a15bf){return respondWithRpcPromise(_0x0d8b('0x17'),_0xa3612a[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x4a15bf,null))[_0x0d8b('0xc')](handleError(_0x4a15bf,null));};exports[_0x0d8b('0x19')]=function(_0x5b709c,_0x393beb){return respondWithRpcPromise(_0x0d8b('0x1a'),_['merge'](_0x5b709c['query'],_0x5b709c[_0x0d8b('0x1b')]))['then'](respondWithResult(_0x393beb,null))['catch'](handleError(_0x393beb,null));};exports['voiceChannelStopMixMonitor']=function(_0x238728,_0x2b924f){return respondWithRpcPromise(_0x0d8b('0x1c'),_[_0x0d8b('0x1d')](_0x238728[_0x0d8b('0x18')],_0x238728[_0x0d8b('0x1b')]))[_0x0d8b('0x8')](respondWithResult(_0x2b924f,null))[_0x0d8b('0xc')](handleError(_0x2b924f,null));};exports[_0x0d8b('0x1e')]=function(_0x5e5bc3,_0xe8bbee){return respondWithRpcPromise(_0x0d8b('0x1f'),_0x5e5bc3['query'])[_0x0d8b('0x8')](respondWithResult(_0xe8bbee,null))['catch'](handleError(_0xe8bbee,null));};exports[_0x0d8b('0x20')]=function(_0x234bdd,_0xa2af02){return respondWithRpcPromise('VoiceQueues',_0x234bdd['query'])[_0x0d8b('0x8')](findById(_0x234bdd[_0x0d8b('0x1b')]['id']))['then'](respondWithResult(_0xa2af02,null))[_0x0d8b('0xc')](handleError(_0xa2af02,null));};exports['updateVoiceQueue']=function(_0x1b2b59,_0x4b59e5){return respondWithRpcPromise(_0x0d8b('0x21'),_['merge'](_0x1b2b59[_0x0d8b('0x22')],_0x1b2b59['params']))[_0x0d8b('0x8')](respondWithResult(_0x4b59e5,null))['catch'](handleError(_0x4b59e5,null));};exports[_0x0d8b('0x23')]=function(_0x106e4c,_0x2c058d){return respondWithRpcPromise('VoiceQueuesPreview',_['merge'](_0x106e4c['query'],_0x106e4c[_0x0d8b('0x1b')]))['then'](respondWithResult(_0x2c058d,null))[_0x0d8b('0xc')](handleError(_0x2c058d,null));};exports['voiceQueuesChannels']=function(_0x5d05fc,_0x36017a){return respondWithRpcPromise(_0x0d8b('0x24'),_0x5d05fc[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x36017a,null))[_0x0d8b('0xc')](handleError(_0x36017a,null));};exports[_0x0d8b('0x25')]=function(_0x4a99d3,_0x6f93c7){return respondWithRpcPromise('VoiceQueuesChannel',_[_0x0d8b('0x1d')](_0x4a99d3[_0x0d8b('0x18')],_0x4a99d3['params']))[_0x0d8b('0x8')](respondWithResult(_0x6f93c7,null))[_0x0d8b('0xc')](handleError(_0x6f93c7,null));};exports[_0x0d8b('0x26')]=function(_0x4f2ed2,_0x113318){return respondWithRpcPromise(_0x0d8b('0x27'),_[_0x0d8b('0x1d')](_0x4f2ed2[_0x0d8b('0x18')],_0x4f2ed2[_0x0d8b('0x1b')]))['then'](respondWithResult(_0x113318,null))[_0x0d8b('0xc')](handleError(_0x113318,null));};exports[_0x0d8b('0x28')]=function(_0x5ad0fe,_0x1180ac){return respondWithRpcPromise(_0x0d8b('0x29'),_[_0x0d8b('0x1d')](_0x5ad0fe[_0x0d8b('0x18')],_0x5ad0fe[_0x0d8b('0x1b')]))['then'](respondWithResult(_0x1180ac,null))['catch'](handleError(_0x1180ac,null));};exports[_0x0d8b('0x2a')]=function(_0x5c2c04,_0x531c55){return respondWithRpcPromise(_0x0d8b('0x2b'),_0x5c2c04[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x531c55,null))[_0x0d8b('0xc')](handleError(_0x531c55,null));};exports[_0x0d8b('0x2c')]=function(_0x24c789,_0x579324){return respondWithRpcPromise(_0x0d8b('0x2d'),_0x24c789[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x579324,null))[_0x0d8b('0xc')](handleError(_0x579324,null));};exports[_0x0d8b('0x2e')]=function(_0x1a39ad,_0xf1680e){var _0x5c980b;return respondWithRpcPromise(_0x0d8b('0x2f'),_0x1a39ad[_0x0d8b('0x18')])[_0x0d8b('0x8')](function(_0x1f196d){_0x5c980b=_0x1f196d;return respondWithRpcPromise('Agents',_0x1a39ad[_0x0d8b('0x18')],routingClient);})['then'](function(_0x37b26c){return _[_0x0d8b('0x1d')]({},_0x37b26c,_0x5c980b);})[_0x0d8b('0x8')](respondWithResult(_0xf1680e,null))[_0x0d8b('0xc')](handleError(_0xf1680e,null));};exports[_0x0d8b('0x30')]=function(_0x3e632e,_0x1ff17d){if(_0x3e632e[_0x0d8b('0x22')]&&_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')]&&_0x3e632e['user']&&_0x3e632e['user']['name']){for(var _0x4d0811 in _0x3e632e['body'][_0x0d8b('0x31')]){if(_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')]['hasOwnProperty'](_0x4d0811)){db['MemberReport'][_0x0d8b('0x32')]({'where':{'channel':_0x4d0811,'membername':_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x11')],'type':'INTERACTION','exitAt':null,'uniqueid':_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')][_0x4d0811]&&_0x3e632e['body']['interaction'][_0x4d0811][_0x0d8b('0x34')]?{'$notIn':_0x3e632e['body'][_0x0d8b('0x31')][_0x4d0811]}:{'$ne':null}}})['then'](function(_0x53f643){var _0x30ccee=moment()[_0x0d8b('0x35')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x5ebe8a=0x0,_0x59b8e9=_0x53f643['length'];_0x5ebe8a<_0x59b8e9;_0x5ebe8a+=0x1){_0x53f643[_0x5ebe8a][_0x0d8b('0x36')]({'exitAt':_0x30ccee});}});for(var _0x1e0498=0x0;_0x1e0498<_0x3e632e[_0x0d8b('0x22')]['interaction'][_0x4d0811][_0x0d8b('0x34')];_0x1e0498+=0x1){db[_0x0d8b('0x37')][_0x0d8b('0x38')]({'where':{'channel':_0x4d0811,'membername':_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x11')],'type':_0x0d8b('0x39'),'uniqueid':_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')][_0x4d0811][_0x1e0498],'exitAt':null},'defaults':{'channel':_0x4d0811,'membername':_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x11')],'interface':_[_0x0d8b('0x13')](_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x3a')])?util[_0x0d8b('0x35')](_0x0d8b('0x3b'),_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x11')]):_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x3a')],'type':'INTERACTION','enterAt':moment()[_0x0d8b('0x35')]('YYYY-MM-DD\x20HH:mm:ss'),'role':'agent','internal':_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x3c')],'uniqueid':_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')][_0x4d0811][_0x1e0498]}});}}}}return respondWithRpcPromise('AgentCapacity',{'id':_0x3e632e[_0x0d8b('0x1b')]['id'],'capacity':_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x3d')]},routingClient)[_0x0d8b('0x8')](respondWithResult(_0x1ff17d,null))[_0x0d8b('0xc')](handleError(_0x1ff17d,null));};exports['telephones']=function(_0x5c0824,_0x4e4d5f){return respondWithRpcPromise('Telephones',_0x5c0824[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x4e4d5f,null))['catch'](handleError(_0x4e4d5f,null));};exports['trunks']=function(_0x44c5c1,_0x3d3cb6){return respondWithRpcPromise('Trunks',_0x44c5c1['query'])[_0x0d8b('0x8')](respondWithResult(_0x3d3cb6,null))[_0x0d8b('0xc')](handleError(_0x3d3cb6,null));};exports[_0x0d8b('0x3e')]=function(_0x346c0d,_0x2d5519){return respondWithRpcPromise('Campaigns',_0x346c0d[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x2d5519,null))['catch'](handleError(_0x2d5519,null));};exports['chatQueues']=function(_0xf6a773,_0x3f2d95){return respondWithRpcPromise('ChatQueues',_0xf6a773['query'],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3f2d95,null))[_0x0d8b('0xc')](handleError(_0x3f2d95,null));};exports[_0x0d8b('0x3f')]=function(_0xb58818,_0x4a2989){return respondWithRpcPromise(_0x0d8b('0x40'),_0xb58818['query'],routingClient)['then'](findById(_0xb58818[_0x0d8b('0x1b')]['id']))[_0x0d8b('0x8')](respondWithResult(_0x4a2989,null))['catch'](handleError(_0x4a2989,null));};exports['mailQueues']=function(_0x44ed23,_0x3d7161){return respondWithRpcPromise(_0x0d8b('0x41'),_0x44ed23[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3d7161,null))[_0x0d8b('0xc')](handleError(_0x3d7161,null));};exports[_0x0d8b('0x42')]=function(_0x3bead7,_0x5418d8){return respondWithRpcPromise(_0x0d8b('0x41'),_0x3bead7[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](findById(_0x3bead7[_0x0d8b('0x1b')]['id']))[_0x0d8b('0x8')](respondWithResult(_0x5418d8,null))[_0x0d8b('0xc')](handleError(_0x5418d8,null));};exports[_0x0d8b('0x43')]=function(_0x1c78b6,_0x375684){return respondWithRpcPromise('MailAccounts',_0x1c78b6[_0x0d8b('0x18')],mailClient)[_0x0d8b('0x8')](respondWithResult(_0x375684,null))[_0x0d8b('0xc')](handleError(_0x375684,null));};exports[_0x0d8b('0x44')]=function(_0x43ad22,_0x577951){return respondWithRpcPromise(_0x0d8b('0x45'),_0x43ad22[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x577951,null))[_0x0d8b('0xc')](handleError(_0x577951,null));};exports[_0x0d8b('0x46')]=function(_0x59ada2,_0x4d0e7c){return respondWithRpcPromise(_0x0d8b('0x45'),_0x59ada2[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](findById(_0x59ada2[_0x0d8b('0x1b')]['id']))['then'](respondWithResult(_0x4d0e7c,null))[_0x0d8b('0xc')](handleError(_0x4d0e7c,null));};exports[_0x0d8b('0x47')]=function(_0x8c0bbe,_0x5952dd){return respondWithRpcPromise(_0x0d8b('0x48'),_0x8c0bbe['query'],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x5952dd,null))[_0x0d8b('0xc')](handleError(_0x5952dd,null));};exports[_0x0d8b('0x49')]=function(_0x26ccf0,_0x2b6eb6){return respondWithRpcPromise(_0x0d8b('0x48'),_0x26ccf0['query'],routingClient)[_0x0d8b('0x8')](findById(_0x26ccf0['params']['id']))[_0x0d8b('0x8')](respondWithResult(_0x2b6eb6,null))[_0x0d8b('0xc')](handleError(_0x2b6eb6,null));};exports[_0x0d8b('0x4a')]=function(_0x33a614,_0x48025e){return respondWithRpcPromise(_0x0d8b('0x4b'),_0x33a614[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x48025e,null))[_0x0d8b('0xc')](handleError(_0x48025e,null));};exports[_0x0d8b('0x4c')]=function(_0x273aef,_0x223fd8){return respondWithRpcPromise(_0x0d8b('0x4b'),_0x273aef[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](findById(_0x273aef['params']['id']))['then'](respondWithResult(_0x223fd8,null))[_0x0d8b('0xc')](handleError(_0x223fd8,null));};exports[_0x0d8b('0x4d')]=function(_0x53e399,_0xb1aa96){return respondWithRpcPromise('FaxQueues',_0x53e399['query'],routingClient)[_0x0d8b('0x8')](respondWithResult(_0xb1aa96,null))[_0x0d8b('0xc')](handleError(_0xb1aa96,null));};exports['showFaxQueues']=function(_0x587128,_0x1900e3){return respondWithRpcPromise(_0x0d8b('0x4e'),_0x587128[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](findById(_0x587128[_0x0d8b('0x1b')]['id']))[_0x0d8b('0x8')](respondWithResult(_0x1900e3,null))[_0x0d8b('0xc')](handleError(_0x1900e3,null));};exports['faxAccounts']=function(_0x1ca60c,_0x5878c2){return respondWithRpcPromise(_0x0d8b('0x4f'),_0x1ca60c[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x5878c2,null))[_0x0d8b('0xc')](handleError(_0x5878c2,null));};exports['chatQueuesWaitingInteractions']=function(_0x3fe47d,_0x4a1c4a){return respondWithRpcPromise(_0x0d8b('0x50'),_0x3fe47d[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x4a1c4a,null))[_0x0d8b('0xc')](handleError(_0x4a1c4a,null));};exports[_0x0d8b('0x51')]=function(_0x2b44e5,_0x3e927c){return respondWithRpcPromise(_0x0d8b('0x52'),_0x2b44e5[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3e927c,null))['catch'](handleError(_0x3e927c,null));};exports[_0x0d8b('0x53')]=function(_0x54c28b,_0x3e4121){return respondWithRpcPromise(_0x0d8b('0x54'),_0x54c28b['query'],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3e4121,null))['catch'](handleError(_0x3e4121,null));};exports[_0x0d8b('0x55')]=function(_0x445a00,_0x24f75){return respondWithRpcPromise(_0x0d8b('0x54'),_0x445a00[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](function(_0x3a073b){if(_0x445a00[_0x0d8b('0x18')]['type']!==undefined){var _0x10eca6=_(_0x3a073b[_0x0d8b('0x14')])['filter']([_0x445a00[_0x0d8b('0x18')][_0x0d8b('0x56')],_0x445a00[_0x0d8b('0x1b')]['id']])[_0x0d8b('0x57')](_0x0d8b('0x58'))[_0x0d8b('0x59')]()[_0x0d8b('0x5a')]();return _0x3a073b[_0x0d8b('0x14')][_0x0d8b('0x5b')](function(_0x5007c0){return _0x10eca6[_0x0d8b('0x5c')](_0x5007c0[_0x0d8b('0x58')])>-0x1;});}else{return _0x3a073b['rows'][_0x0d8b('0x5b')](function(_0x93fc55){return _0x93fc55[_0x0d8b('0x58')]===parseInt(_0x445a00['params']['id']);});}})['then'](respondWithResult(_0x24f75,null))[_0x0d8b('0xc')](handleError(_0x24f75,null));};exports[_0x0d8b('0x5d')]=function(_0x2c55bc,_0x5b76af){return respondWithRpcPromise('SmsQueuesWaitingInteractions',_0x2c55bc[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x5b76af,null))[_0x0d8b('0xc')](handleError(_0x5b76af,null));};exports[_0x0d8b('0x5e')]=function(_0x2a2b58,_0x3f7895){return respondWithRpcPromise(_0x0d8b('0x5f'),_0x2a2b58[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3f7895,null))[_0x0d8b('0xc')](handleError(_0x3f7895,null));};exports[_0x0d8b('0x60')]=function(_0x291336,_0x3b060e){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0x291336[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3b060e,null))['catch'](handleError(_0x3b060e,null));};exports['queueNotify']=function(_0x1a1029){return function(_0x1dad9f,_0x3573b4){var _0x14b1b8,_0x23e2e0;var _0x354208=_['capitalize'](_0x1a1029);var _0x502715=_0x1a1029==='chat'?_0x0d8b('0x61'):_0x0d8b('0x62');return db[_0x354208+_0x0d8b('0x63')][_0x0d8b('0x64')]({'raw':!![],'where':{'id':_0x1dad9f[_0x0d8b('0x1b')]['id']}})[_0x0d8b('0x8')](function(_0x5ef461){if(_[_0x0d8b('0x13')](_0x5ef461)){throw new Error(_0x354208+_0x0d8b('0x65'));}_0x14b1b8=_0x5ef461;return db[_0x354208+'Message'][_0x0d8b('0x64')]({'where':{'id':_0x1dad9f['body'][_0x0d8b('0x66')]},'include':[{'model':db[_0x354208+_0x0d8b('0x67')],'as':_0x0d8b('0x67')},{'model':db[_0x354208+_0x502715],'as':_0x0d8b('0x62')}]});})[_0x0d8b('0x8')](function(_0x8fae7f){if(_[_0x0d8b('0x13')](_0x8fae7f)){throw new Error(_0x354208+_0x0d8b('0x68'));}_0x23e2e0=_0x8fae7f;return _0x8fae7f[_0x0d8b('0x69')]({'read':0x0,'readAt':null,'UserId':null});})[_0x0d8b('0x8')](function(){var _0x276558={'uniqueid':_0x1a1029+'.'+_0x23e2e0['id']+'.'+_0x23e2e0[_0x0d8b('0x67')]['id'],'FromUserId':_0x1dad9f['user']['id'],'type':'queue'};_0x276558[_0x354208+_0x0d8b('0x6a')]=_0x23e2e0['id'];_0x276558[_0x354208+_0x0d8b('0x6b')]=_0x23e2e0[_0x0d8b('0x67')]['id'];_0x276558[_0x0d8b('0x6c')+_0x354208+_0x502715+'Id']=_0x23e2e0[_0x0d8b('0x62')]['id'];_0x276558['To'+_0x354208+_0x0d8b('0x6d')]=_0x14b1b8['id'];return db[_0x354208+_0x0d8b('0x6e')]['create'](_0x276558);})[_0x0d8b('0x8')](function(){return respondWithRpcPromise('Start',{'channel':_0x1a1029,'interaction':_0x23e2e0[_0x0d8b('0x67')],'message':_0x23e2e0,'account':_0x23e2e0['Account'],'applications':[{'id':0x0,'priority':0x1,'app':'queue','appdata':_0x14b1b8[_0x0d8b('0x11')]+','+(_0x23e2e0[_0x0d8b('0x62')][_0x0d8b('0x6f')]||0x12c),'interval':_0x0d8b('0x70')}],'transfer':!![]},routingClient);})[_0x0d8b('0x8')](respondWithResult(_0x3573b4,null))[_0x0d8b('0xc')](handleError(_0x3573b4,null));};};exports[_0x0d8b('0x71')]=function(_0x180eda,_0x35267a){var _0x20a8b6,_0x3a6014;if(_[_0x0d8b('0x13')](_0x180eda['body'][_0x0d8b('0x72')])){throw new Error(_0x0d8b('0x73'));}var _0x8be77c=_0x180eda['body']['channel'];var _0x2db144=_[_0x0d8b('0x74')](_0x8be77c);var _0x36d6ca=_0x8be77c===_0x0d8b('0x75')?_0x0d8b('0x61'):_0x0d8b('0x62');return db['User'][_0x0d8b('0x64')]({'raw':!![],'where':{'id':_0x180eda[_0x0d8b('0x1b')]['id'],'role':_0x0d8b('0x76')}})[_0x0d8b('0x8')](function(_0x4350ee){if(_['isNil'](_0x4350ee)){throw new Error('Agent\x20not\x20found');}_0x20a8b6=_0x4350ee;return db[_0x2db144+_0x0d8b('0x77')][_0x0d8b('0x64')]({'where':{'id':_0x180eda[_0x0d8b('0x22')]['messageId']},'include':[{'model':db[_0x2db144+_0x0d8b('0x67')],'as':_0x0d8b('0x67')},{'model':db[_0x2db144+_0x36d6ca],'as':_0x0d8b('0x62')}]});})['then'](function(_0xb61d4b){if(_[_0x0d8b('0x13')](_0xb61d4b)){throw new Error(_0x2db144+_0x0d8b('0x68'));}_0x3a6014=_0xb61d4b;return _0xb61d4b[_0x0d8b('0x69')]({'read':0x0,'readAt':null,'UserId':null});})[_0x0d8b('0x8')](function(){var _0x150e9f={'uniqueid':_0x8be77c+'.'+_0x3a6014['id']+'.'+_0x3a6014[_0x0d8b('0x67')]['id'],'FromUserId':_0x180eda[_0x0d8b('0x33')]['id'],'type':_0x0d8b('0x76'),'ToUserId':_0x20a8b6['id']};_0x150e9f[_0x2db144+'MessageId']=_0x3a6014['id'];_0x150e9f[_0x2db144+_0x0d8b('0x6b')]=_0x3a6014[_0x0d8b('0x67')]['id'];_0x150e9f[_0x0d8b('0x6c')+_0x2db144+_0x36d6ca+'Id']=_0x3a6014[_0x0d8b('0x62')]['id'];return db[_0x2db144+_0x0d8b('0x6e')][_0x0d8b('0x78')](_0x150e9f);})[_0x0d8b('0x8')](function(){return respondWithRpcPromise(_0x0d8b('0x79'),{'channel':_0x8be77c,'interaction':_0x3a6014[_0x0d8b('0x67')],'message':_0x3a6014,'account':_0x3a6014['Account'],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0x20a8b6[_0x0d8b('0x11')]+','+(_0x3a6014[_0x0d8b('0x62')][_0x0d8b('0x7a')]||0x12c),'interval':_0x0d8b('0x70')}],'transfer':!![]},routingClient);})['then'](respondWithResult(_0x35267a,null))[_0x0d8b('0xc')](handleError(_0x35267a,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 1ee6fc6..977e0af 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 _0xbf29=['run','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./schedule.controller','isAuthenticated','index','/:id','show','get','/:id/run'];(function(_0x3358c9,_0xff1065){var _0x4859e6=function(_0x5a88bf){while(--_0x5a88bf){_0x3358c9['push'](_0x3358c9['shift']());}};_0x4859e6(++_0xff1065);}(_0xbf29,0x13f));var _0x9bf2=function(_0x298e3a,_0x52c9b1){_0x298e3a=_0x298e3a-0x0;var _0x9ddbae=_0xbf29[_0x298e3a];return _0x9ddbae;};'use strict';var multer=require(_0x9bf2('0x0'));var util=require(_0x9bf2('0x1'));var path=require(_0x9bf2('0x2'));var timeout=require(_0x9bf2('0x3'));var express=require(_0x9bf2('0x4'));var router=express[_0x9bf2('0x5')]();var fs_extra=require(_0x9bf2('0x6'));var auth=require(_0x9bf2('0x7'));var interaction=require(_0x9bf2('0x8'));var config=require(_0x9bf2('0x9'));var controller=require(_0x9bf2('0xa'));router['get']('/',auth[_0x9bf2('0xb')](),controller[_0x9bf2('0xc')]);router['get'](_0x9bf2('0xd'),auth['isAuthenticated'](),controller[_0x9bf2('0xe')]);router[_0x9bf2('0xf')](_0x9bf2('0x10'),auth['isAuthenticated'](),controller[_0x9bf2('0x11')]);router[_0x9bf2('0x12')]('/',auth[_0x9bf2('0xb')](),controller[_0x9bf2('0x13')]);router[_0x9bf2('0x14')](_0x9bf2('0xd'),auth['isAuthenticated'](),controller[_0x9bf2('0x15')]);router['delete'](_0x9bf2('0xd'),auth[_0x9bf2('0xb')](),controller[_0x9bf2('0x16')]);module[_0x9bf2('0x17')]=router; \ No newline at end of file +var _0x178b=['destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./schedule.controller','isAuthenticated','get','/:id','show','run','create','put','update','delete'];(function(_0x1cc211,_0x4856f1){var _0x5df05a=function(_0xc641cb){while(--_0xc641cb){_0x1cc211['push'](_0x1cc211['shift']());}};_0x5df05a(++_0x4856f1);}(_0x178b,0x17e));var _0xb178=function(_0x63f925,_0x25eea2){_0x63f925=_0x63f925-0x0;var _0x1aa894=_0x178b[_0x63f925];return _0x1aa894;};'use strict';var multer=require('multer');var util=require(_0xb178('0x0'));var path=require('path');var timeout=require(_0xb178('0x1'));var express=require(_0xb178('0x2'));var router=express[_0xb178('0x3')]();var fs_extra=require(_0xb178('0x4'));var auth=require(_0xb178('0x5'));var interaction=require(_0xb178('0x6'));var config=require(_0xb178('0x7'));var controller=require(_0xb178('0x8'));router['get']('/',auth[_0xb178('0x9')](),controller['index']);router[_0xb178('0xa')](_0xb178('0xb'),auth[_0xb178('0x9')](),controller[_0xb178('0xc')]);router['get']('/:id/run',auth[_0xb178('0x9')](),controller[_0xb178('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0xb178('0xe')]);router[_0xb178('0xf')]('/:id',auth[_0xb178('0x9')](),controller[_0xb178('0x10')]);router[_0xb178('0x11')](_0xb178('0xb'),auth[_0xb178('0x9')](),controller[_0xb178('0x12')]);module[_0xb178('0x13')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index efe1445..086c184 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 _0x494b=['csv','xlsx','default','TEXT','sequelize','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','quarters','months','weeks','days','hours','minutes'];(function(_0x49dd5a,_0x1da7e6){var _0x91c8da=function(_0x46408e){while(--_0x46408e){_0x49dd5a['push'](_0x49dd5a['shift']());}};_0x91c8da(++_0x1da7e6);}(_0x494b,0x147));var _0xb494=function(_0x4e63f1,_0x34a2db){_0x4e63f1=_0x4e63f1-0x0;var _0xdbd910=_0x494b[_0x4e63f1];return _0xdbd910;};'use strict';var Sequelize=require(_0xb494('0x0'));module['exports']={'name':{'type':Sequelize[_0xb494('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xb494('0x1')]},'active':{'type':Sequelize[_0xb494('0x2')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0xb494('0x1')],'allowNull':![],'defaultValue':_0xb494('0x3')},'startAt':{'type':Sequelize[_0xb494('0x4')],'allowNull':![]},'endAt':{'type':Sequelize[_0xb494('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0xb494('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0xb494('0x6')]('years',_0xb494('0x7'),_0xb494('0x8'),_0xb494('0x9'),_0xb494('0xa'),_0xb494('0xb'),_0xb494('0xc')),'allowNull':![],'defaultValue':_0xb494('0xa')},'output':{'type':Sequelize['ENUM'](_0xb494('0xd'),'pdf',_0xb494('0xe')),'allowNull':![],'defaultValue':_0xb494('0xd')},'type':{'type':Sequelize['ENUM']('custom',_0xb494('0xf')),'allowNull':![],'defaultValue':'custom'},'sendMail':{'type':Sequelize[_0xb494('0x2')],'defaultValue':![]},'email':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0xb494('0x10')]},'bcc':{'type':Sequelize[_0xb494('0x10')]},'sendIfEmpty':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0xafcd=['INTEGER','ENUM','years','quarters','months','weeks','days','hours','minutes','pdf','xlsx','csv','default','custom','TEXT','sequelize','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE'];(function(_0xf50820,_0x56f041){var _0x2a9b10=function(_0x33f0f4){while(--_0x33f0f4){_0xf50820['push'](_0xf50820['shift']());}};_0x2a9b10(++_0x56f041);}(_0xafcd,0x174));var _0xdafc=function(_0x2ea087,_0x17f324){_0x2ea087=_0x2ea087-0x0;var _0x23ebac=_0xafcd[_0x2ea087];return _0x23ebac;};'use strict';var Sequelize=require(_0xdafc('0x0'));module[_0xdafc('0x1')]={'name':{'type':Sequelize[_0xdafc('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xdafc('0x2')]},'active':{'type':Sequelize[_0xdafc('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0xdafc('0x2')],'allowNull':![],'defaultValue':_0xdafc('0x4')},'startAt':{'type':Sequelize['DATE'],'allowNull':![]},'endAt':{'type':Sequelize[_0xdafc('0x5')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0xdafc('0x6')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0xdafc('0x7')](_0xdafc('0x8'),_0xdafc('0x9'),_0xdafc('0xa'),_0xdafc('0xb'),_0xdafc('0xc'),_0xdafc('0xd'),_0xdafc('0xe')),'allowNull':![],'defaultValue':'days'},'output':{'type':Sequelize[_0xdafc('0x7')]('csv',_0xdafc('0xf'),_0xdafc('0x10')),'allowNull':![],'defaultValue':_0xdafc('0x11')},'type':{'type':Sequelize[_0xdafc('0x7')]('custom',_0xdafc('0x12')),'allowNull':![],'defaultValue':_0xdafc('0x13')},'sendMail':{'type':Sequelize[_0xdafc('0x3')],'defaultValue':![]},'email':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0xdafc('0x14')]},'bcc':{'type':Sequelize[_0xdafc('0x14')]},'sendIfEmpty':{'type':Sequelize[_0xdafc('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index 8ac41b3..3ada640 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 _0x44d2=['includeAll','include','findAll','rows','catch','show','keys','rawAttributes','length','find','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','params','run','../../config/schedule','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','fs-extra','lodash','squel','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','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','then','get','Scheduler','UserProfileResource','destroy','end','error','stack','name','send','index','map','Schedule','fieldName','type','key','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x44d2,0xc8));var _0x244d=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x44d2[_0xa464c9];return _0x3d73c4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x244d('0x0'));var zipdir=require(_0x244d('0x1'));var jsonpatch=require(_0x244d('0x2'));var rp=require(_0x244d('0x3'));var moment=require(_0x244d('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x244d('0x5'));var util=require(_0x244d('0x6'));var path=require(_0x244d('0x7'));var sox=require(_0x244d('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x244d('0x9'));var _=require(_0x244d('0xa'));var squel=require(_0x244d('0xb'));var crypto=require('crypto');var jsforce=require(_0x244d('0xc'));var deskjs=require(_0x244d('0xd'));var toCsv=require(_0x244d('0xe'));var querystring=require(_0x244d('0xf'));var Papa=require(_0x244d('0x10'));var Redis=require(_0x244d('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x244d('0x12'));var as=require(_0x244d('0x13'));var hardwareService=require(_0x244d('0x14'));var logger=require(_0x244d('0x15'))('api');var utils=require(_0x244d('0x16'));var config=require(_0x244d('0x17'));var licenseUtil=require(_0x244d('0x18'));var db=require(_0x244d('0x19'))['db'];function respondWithStatusCode(_0x12ab5a,_0x54c64f){_0x54c64f=_0x54c64f||0xcc;return function(_0x516df2){if(_0x516df2){return _0x12ab5a[_0x244d('0x1a')](_0x54c64f);}return _0x12ab5a[_0x244d('0x1b')](_0x54c64f)['end']();};}function respondWithResult(_0x476c3f,_0x562789){_0x562789=_0x562789||0xc8;return function(_0x49bc02){if(_0x49bc02){return _0x476c3f[_0x244d('0x1b')](_0x562789)[_0x244d('0x1c')](_0x49bc02);}};}function respondWithFilteredResult(_0x321b7c,_0x4ac344){return function(_0x3cb3ec){if(_0x3cb3ec){var _0x2847ef=typeof _0x4ac344[_0x244d('0x1d')]===_0x244d('0x1e')&&typeof _0x4ac344[_0x244d('0x1f')]===_0x244d('0x1e');var _0x477850=_0x3cb3ec[_0x244d('0x20')];var _0x66555=_0x2847ef?0x0:_0x4ac344[_0x244d('0x1d')];var _0x20516f=_0x2847ef?_0x3cb3ec['count']:_0x4ac344[_0x244d('0x1d')]+_0x4ac344[_0x244d('0x1f')];var _0x4e6aef;if(_0x20516f>=_0x477850){_0x20516f=_0x477850;_0x4e6aef=0xc8;}else{_0x4e6aef=0xce;}_0x321b7c[_0x244d('0x1b')](_0x4e6aef);return _0x321b7c[_0x244d('0x21')]('Content-Range',_0x66555+'-'+_0x20516f+'/'+_0x477850)['json'](_0x3cb3ec);}return null;};}function patchUpdates(_0x3399b7){return function(_0x289ab7){try{jsonpatch[_0x244d('0x22')](_0x289ab7,_0x3399b7,!![]);}catch(_0xc89df0){return BPromise[_0x244d('0x23')](_0xc89df0);}return _0x289ab7[_0x244d('0x24')]();};}function saveUpdates(_0x14cde5,_0x4f13f3){return function(_0x1fb317){if(_0x1fb317){return _0x1fb317['update'](_0x14cde5)['then'](function(_0x15edb7){return _0x15edb7;});}return null;};}function removeEntity(_0x686767,_0x1d0d2f){return function(_0x3a3e1d){if(_0x3a3e1d){return _0x3a3e1d['destroy']()[_0x244d('0x25')](function(){var _0x54e9d8=_0x3a3e1d[_0x244d('0x26')]({'plain':!![]});var _0x59769a=_0x244d('0x27');return db[_0x244d('0x28')][_0x244d('0x29')]({'where':{'type':_0x59769a,'resourceId':_0x54e9d8['id']}})['then'](function(){return _0x3a3e1d;});})['then'](function(){_0x686767[_0x244d('0x1b')](0xcc)[_0x244d('0x2a')]();});}};}function handleEntityNotFound(_0x2f95d4,_0x2c4cef){return function(_0x10d461){if(!_0x10d461){_0x2f95d4['sendStatus'](0x194);}return _0x10d461;};}function handleError(_0xe13b2c,_0x31f279){_0x31f279=_0x31f279||0x1f4;return function(_0x3abf9f){logger[_0x244d('0x2b')](_0x3abf9f[_0x244d('0x2c')]);if(_0x3abf9f[_0x244d('0x2d')]){delete _0x3abf9f[_0x244d('0x2d')];}_0xe13b2c[_0x244d('0x1b')](_0x31f279)[_0x244d('0x2e')](_0x3abf9f);};}exports[_0x244d('0x2f')]=function(_0xa79e45,_0x564772){var _0x4af49e={},_0x51c3b8={},_0x52f319={'count':0x0,'rows':[]};var _0x44c8c7=_[_0x244d('0x30')](db[_0x244d('0x31')]['rawAttributes'],function(_0x3c14da){return{'name':_0x3c14da[_0x244d('0x32')],'type':_0x3c14da[_0x244d('0x33')][_0x244d('0x34')]};});_0x51c3b8['model']=_[_0x244d('0x30')](_0x44c8c7,_0x244d('0x2d'));_0x51c3b8[_0x244d('0x35')]=_['keys'](_0xa79e45[_0x244d('0x35')]);_0x51c3b8[_0x244d('0x36')]=_[_0x244d('0x37')](_0x51c3b8[_0x244d('0x38')],_0x51c3b8[_0x244d('0x35')]);_0x4af49e[_0x244d('0x39')]=_[_0x244d('0x37')](_0x51c3b8[_0x244d('0x38')],qs['fields'](_0xa79e45[_0x244d('0x35')][_0x244d('0x3a')]));_0x4af49e[_0x244d('0x39')]=_0x4af49e[_0x244d('0x39')]['length']?_0x4af49e['attributes']:_0x51c3b8[_0x244d('0x38')];if(!_0xa79e45[_0x244d('0x35')][_0x244d('0x3b')](_0x244d('0x3c'))){_0x4af49e[_0x244d('0x1f')]=qs[_0x244d('0x1f')](_0xa79e45[_0x244d('0x35')][_0x244d('0x1f')]);_0x4af49e[_0x244d('0x1d')]=qs[_0x244d('0x1d')](_0xa79e45[_0x244d('0x35')][_0x244d('0x1d')]);}_0x4af49e[_0x244d('0x3d')]=qs[_0x244d('0x3e')](_0xa79e45[_0x244d('0x35')][_0x244d('0x3e')]);_0x4af49e[_0x244d('0x3f')]=qs[_0x244d('0x36')](_[_0x244d('0x40')](_0xa79e45[_0x244d('0x35')],_0x51c3b8['filters']),_0x44c8c7);if(_0xa79e45[_0x244d('0x35')][_0x244d('0x41')]){_0x4af49e['where']=_['merge'](_0x4af49e[_0x244d('0x3f')],{'$or':_[_0x244d('0x30')](_0x44c8c7,function(_0x4ecbef){if(_0x4ecbef[_0x244d('0x33')]!=='VIRTUAL'){var _0x3cf3df={};_0x3cf3df[_0x4ecbef[_0x244d('0x2d')]]={'$like':'%'+_0xa79e45[_0x244d('0x35')]['filter']+'%'};return _0x3cf3df;}})});}_0x4af49e=_[_0x244d('0x42')]({},_0x4af49e,_0xa79e45['options']);var _0x4077ee={'where':_0x4af49e[_0x244d('0x3f')]};return db[_0x244d('0x31')][_0x244d('0x20')](_0x4077ee)[_0x244d('0x25')](function(_0x3efb10){_0x52f319['count']=_0x3efb10;if(_0xa79e45[_0x244d('0x35')][_0x244d('0x43')]){_0x4af49e[_0x244d('0x44')]=[{'all':!![]}];}return db['Schedule'][_0x244d('0x45')](_0x4af49e);})['then'](function(_0x4b18ac){_0x52f319[_0x244d('0x46')]=_0x4b18ac;return _0x52f319;})[_0x244d('0x25')](respondWithFilteredResult(_0x564772,_0x4af49e))[_0x244d('0x47')](handleError(_0x564772,null));};exports[_0x244d('0x48')]=function(_0x2b1dc1,_0x558e5e){var _0x2aa690={'raw':![],'where':{'id':_0x2b1dc1['params']['id']}},_0x233867={};_0x233867[_0x244d('0x38')]=_[_0x244d('0x49')](db[_0x244d('0x31')][_0x244d('0x4a')]);_0x233867['query']=_[_0x244d('0x49')](_0x2b1dc1[_0x244d('0x35')]);_0x233867[_0x244d('0x36')]=_['intersection'](_0x233867[_0x244d('0x38')],_0x233867[_0x244d('0x35')]);_0x2aa690[_0x244d('0x39')]=_[_0x244d('0x37')](_0x233867[_0x244d('0x38')],qs['fields'](_0x2b1dc1[_0x244d('0x35')][_0x244d('0x3a')]));_0x2aa690['attributes']=_0x2aa690[_0x244d('0x39')][_0x244d('0x4b')]?_0x2aa690['attributes']:_0x233867[_0x244d('0x38')];if(_0x2b1dc1[_0x244d('0x35')]['includeAll']){_0x2aa690[_0x244d('0x44')]=[{'all':!![]}];}_0x2aa690=_['merge']({},_0x2aa690,_0x2b1dc1['options']);return db[_0x244d('0x31')][_0x244d('0x4c')](_0x2aa690)[_0x244d('0x25')](handleEntityNotFound(_0x558e5e,null))[_0x244d('0x25')](respondWithResult(_0x558e5e,null))[_0x244d('0x47')](handleError(_0x558e5e,null));};exports['create']=function(_0x571e11,_0x58b494){return db[_0x244d('0x31')]['create'](_0x571e11['body'],{})[_0x244d('0x25')](function(_0x3d634c){var _0x48ce2c=_0x571e11[_0x244d('0x4d')][_0x244d('0x26')]({'plain':!![]});if(!_0x48ce2c)throw new Error(_0x244d('0x4e'));if(_0x48ce2c[_0x244d('0x4f')]===_0x244d('0x4d')){var _0x556d48=_0x3d634c['get']({'plain':!![]});var _0x2503f5=_0x244d('0x27');return db['UserProfileSection'][_0x244d('0x4c')]({'where':{'name':_0x2503f5,'userProfileId':_0x48ce2c[_0x244d('0x50')]},'raw':!![]})[_0x244d('0x25')](function(_0x1b4141){if(_0x1b4141&&_0x1b4141[_0x244d('0x51')]===0x0){return db['UserProfileResource'][_0x244d('0x52')]({'name':_0x556d48['name'],'resourceId':_0x556d48['id'],'type':_0x1b4141['name'],'sectionId':_0x1b4141['id']},{})[_0x244d('0x25')](function(){return _0x3d634c;});}else{return _0x3d634c;}})['catch'](function(_0x309658){logger[_0x244d('0x2b')](_0x244d('0x53'),_0x309658);throw _0x309658;});}return _0x3d634c;})[_0x244d('0x25')](respondWithResult(_0x58b494,0xc9))[_0x244d('0x47')](handleError(_0x58b494,null));};exports[_0x244d('0x54')]=function(_0x3a2065,_0x1fe5c0){if(_0x3a2065[_0x244d('0x55')]['id']){delete _0x3a2065['body']['id'];}return db['Schedule'][_0x244d('0x4c')]({'where':{'id':_0x3a2065[_0x244d('0x56')]['id']}})[_0x244d('0x25')](handleEntityNotFound(_0x1fe5c0,null))['then'](saveUpdates(_0x3a2065[_0x244d('0x55')],null))[_0x244d('0x25')](respondWithResult(_0x1fe5c0,null))[_0x244d('0x47')](handleError(_0x1fe5c0,null));};exports[_0x244d('0x29')]=function(_0xcac3a9,_0x35935c){return db['Schedule'][_0x244d('0x4c')]({'where':{'id':_0xcac3a9[_0x244d('0x56')]['id']}})[_0x244d('0x25')](handleEntityNotFound(_0x35935c,null))['then'](removeEntity(_0x35935c,null))[_0x244d('0x47')](handleError(_0x35935c,null));};exports[_0x244d('0x57')]=function(_0x59d29e,_0x6781a3,_0x48a7c2){var _0x32ae9f=require(_0x244d('0x58'));return db[_0x244d('0x31')]['find']({'where':{'id':_0x59d29e[_0x244d('0x56')]['id']},'raw':!![]})[_0x244d('0x25')](handleEntityNotFound(_0x6781a3,null))[_0x244d('0x25')](function(){_0x32ae9f[_0x244d('0x57')](_0x59d29e[_0x244d('0x56')]['id']);})[_0x244d('0x25')](respondWithStatusCode(_0x6781a3,null))[_0x244d('0x47')](handleError(_0x6781a3,null));}; \ No newline at end of file +var _0x4535=['filters','intersection','fields','attributes','nolimit','order','where','pick','merge','filter','options','includeAll','findAll','rows','catch','show','params','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','run','../../config/schedule','eml-format','rimraf','zip-dir','fast-json-patch','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','count','set','json','reject','save','update','then','get','Scheduler','destroy','error','stack','name','send','index','map','Schedule','rawAttributes','type','key','model','query','keys'];(function(_0x4bd06e,_0x593701){var _0x85ebb=function(_0x26a7f2){while(--_0x26a7f2){_0x4bd06e['push'](_0x4bd06e['shift']());}};_0x85ebb(++_0x593701);}(_0x4535,0x117));var _0x5453=function(_0xd58d58,_0x4760c9){_0xd58d58=_0xd58d58-0x0;var _0x598b08=_0x4535[_0xd58d58];return _0x598b08;};'use strict';var emlformat=require(_0x5453('0x0'));var rimraf=require(_0x5453('0x1'));var zipdir=require(_0x5453('0x2'));var jsonpatch=require(_0x5453('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x5453('0x4'));var path=require(_0x5453('0x5'));var sox=require(_0x5453('0x6'));var csv=require(_0x5453('0x7'));var ejs=require(_0x5453('0x8'));var fs=require('fs');var fs_extra=require(_0x5453('0x9'));var _=require(_0x5453('0xa'));var squel=require(_0x5453('0xb'));var crypto=require(_0x5453('0xc'));var jsforce=require(_0x5453('0xd'));var deskjs=require(_0x5453('0xe'));var toCsv=require(_0x5453('0x7'));var querystring=require(_0x5453('0xf'));var Papa=require('papaparse');var Redis=require(_0x5453('0x10'));var authService=require(_0x5453('0x11'));var qs=require(_0x5453('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5453('0x13'));var logger=require(_0x5453('0x14'))(_0x5453('0x15'));var utils=require('../../config/utils');var config=require(_0x5453('0x16'));var licenseUtil=require(_0x5453('0x17'));var db=require(_0x5453('0x18'))['db'];function respondWithStatusCode(_0x2dc459,_0x4c24bc){_0x4c24bc=_0x4c24bc||0xcc;return function(_0x466670){if(_0x466670){return _0x2dc459[_0x5453('0x19')](_0x4c24bc);}return _0x2dc459[_0x5453('0x1a')](_0x4c24bc)[_0x5453('0x1b')]();};}function respondWithResult(_0x5807b3,_0x566cda){_0x566cda=_0x566cda||0xc8;return function(_0x33a1c6){if(_0x33a1c6){return _0x5807b3[_0x5453('0x1a')](_0x566cda)['json'](_0x33a1c6);}};}function respondWithFilteredResult(_0x282435,_0x3299d2){return function(_0x5494ff){if(_0x5494ff){var _0x111521=typeof _0x3299d2[_0x5453('0x1c')]==='undefined'&&typeof _0x3299d2[_0x5453('0x1d')]==='undefined';var _0xe380d7=_0x5494ff[_0x5453('0x1e')];var _0x3c19c4=_0x111521?0x0:_0x3299d2['offset'];var _0x3e00c1=_0x111521?_0x5494ff[_0x5453('0x1e')]:_0x3299d2[_0x5453('0x1c')]+_0x3299d2[_0x5453('0x1d')];var _0x30ffbe;if(_0x3e00c1>=_0xe380d7){_0x3e00c1=_0xe380d7;_0x30ffbe=0xc8;}else{_0x30ffbe=0xce;}_0x282435['status'](_0x30ffbe);return _0x282435[_0x5453('0x1f')]('Content-Range',_0x3c19c4+'-'+_0x3e00c1+'/'+_0xe380d7)[_0x5453('0x20')](_0x5494ff);}return null;};}function patchUpdates(_0x9af3ba){return function(_0x40f2a9){try{jsonpatch['apply'](_0x40f2a9,_0x9af3ba,!![]);}catch(_0x2891fd){return BPromise[_0x5453('0x21')](_0x2891fd);}return _0x40f2a9[_0x5453('0x22')]();};}function saveUpdates(_0x4d8d2a,_0x391bd8){return function(_0x41e456){if(_0x41e456){return _0x41e456[_0x5453('0x23')](_0x4d8d2a)[_0x5453('0x24')](function(_0x16ebcb){return _0x16ebcb;});}return null;};}function removeEntity(_0x40bbcd,_0x4725ff){return function(_0x2d04b3){if(_0x2d04b3){return _0x2d04b3['destroy']()[_0x5453('0x24')](function(){var _0x1dcf45=_0x2d04b3[_0x5453('0x25')]({'plain':!![]});var _0x42e0b3=_0x5453('0x26');return db['UserProfileResource'][_0x5453('0x27')]({'where':{'type':_0x42e0b3,'resourceId':_0x1dcf45['id']}})[_0x5453('0x24')](function(){return _0x2d04b3;});})[_0x5453('0x24')](function(){_0x40bbcd['status'](0xcc)[_0x5453('0x1b')]();});}};}function handleEntityNotFound(_0x1e013a,_0x24a0f9){return function(_0x1f7f3f){if(!_0x1f7f3f){_0x1e013a['sendStatus'](0x194);}return _0x1f7f3f;};}function handleError(_0xd14f7,_0x195c1b){_0x195c1b=_0x195c1b||0x1f4;return function(_0x32a714){logger[_0x5453('0x28')](_0x32a714[_0x5453('0x29')]);if(_0x32a714['name']){delete _0x32a714[_0x5453('0x2a')];}_0xd14f7['status'](_0x195c1b)[_0x5453('0x2b')](_0x32a714);};}exports[_0x5453('0x2c')]=function(_0x40ecd8,_0x3624ab){var _0x1f266e={},_0xb85aa5={},_0x3209ef={'count':0x0,'rows':[]};var _0x509729=_[_0x5453('0x2d')](db[_0x5453('0x2e')][_0x5453('0x2f')],function(_0x44c3f7){return{'name':_0x44c3f7['fieldName'],'type':_0x44c3f7[_0x5453('0x30')][_0x5453('0x31')]};});_0xb85aa5[_0x5453('0x32')]=_[_0x5453('0x2d')](_0x509729,_0x5453('0x2a'));_0xb85aa5[_0x5453('0x33')]=_[_0x5453('0x34')](_0x40ecd8['query']);_0xb85aa5[_0x5453('0x35')]=_[_0x5453('0x36')](_0xb85aa5[_0x5453('0x32')],_0xb85aa5['query']);_0x1f266e['attributes']=_[_0x5453('0x36')](_0xb85aa5['model'],qs[_0x5453('0x37')](_0x40ecd8[_0x5453('0x33')]['fields']));_0x1f266e[_0x5453('0x38')]=_0x1f266e[_0x5453('0x38')]['length']?_0x1f266e['attributes']:_0xb85aa5[_0x5453('0x32')];if(!_0x40ecd8['query']['hasOwnProperty'](_0x5453('0x39'))){_0x1f266e[_0x5453('0x1d')]=qs[_0x5453('0x1d')](_0x40ecd8[_0x5453('0x33')][_0x5453('0x1d')]);_0x1f266e[_0x5453('0x1c')]=qs[_0x5453('0x1c')](_0x40ecd8['query']['offset']);}_0x1f266e[_0x5453('0x3a')]=qs['sort'](_0x40ecd8['query']['sort']);_0x1f266e[_0x5453('0x3b')]=qs[_0x5453('0x35')](_[_0x5453('0x3c')](_0x40ecd8[_0x5453('0x33')],_0xb85aa5['filters']),_0x509729);if(_0x40ecd8[_0x5453('0x33')]['filter']){_0x1f266e[_0x5453('0x3b')]=_[_0x5453('0x3d')](_0x1f266e[_0x5453('0x3b')],{'$or':_[_0x5453('0x2d')](_0x509729,function(_0x211952){if(_0x211952[_0x5453('0x30')]!=='VIRTUAL'){var _0x2eede9={};_0x2eede9[_0x211952[_0x5453('0x2a')]]={'$like':'%'+_0x40ecd8['query'][_0x5453('0x3e')]+'%'};return _0x2eede9;}})});}_0x1f266e=_[_0x5453('0x3d')]({},_0x1f266e,_0x40ecd8[_0x5453('0x3f')]);var _0x4064b6={'where':_0x1f266e[_0x5453('0x3b')]};return db[_0x5453('0x2e')]['count'](_0x4064b6)[_0x5453('0x24')](function(_0x5f5b95){_0x3209ef['count']=_0x5f5b95;if(_0x40ecd8[_0x5453('0x33')][_0x5453('0x40')]){_0x1f266e['include']=[{'all':!![]}];}return db[_0x5453('0x2e')][_0x5453('0x41')](_0x1f266e);})['then'](function(_0xac41c6){_0x3209ef[_0x5453('0x42')]=_0xac41c6;return _0x3209ef;})[_0x5453('0x24')](respondWithFilteredResult(_0x3624ab,_0x1f266e))[_0x5453('0x43')](handleError(_0x3624ab,null));};exports[_0x5453('0x44')]=function(_0xeada75,_0x35262a){var _0x5aff3f={'raw':![],'where':{'id':_0xeada75[_0x5453('0x45')]['id']}},_0x59a325={};_0x59a325[_0x5453('0x32')]=_['keys'](db[_0x5453('0x2e')][_0x5453('0x2f')]);_0x59a325[_0x5453('0x33')]=_[_0x5453('0x34')](_0xeada75['query']);_0x59a325[_0x5453('0x35')]=_['intersection'](_0x59a325['model'],_0x59a325[_0x5453('0x33')]);_0x5aff3f['attributes']=_[_0x5453('0x36')](_0x59a325[_0x5453('0x32')],qs['fields'](_0xeada75[_0x5453('0x33')][_0x5453('0x37')]));_0x5aff3f[_0x5453('0x38')]=_0x5aff3f[_0x5453('0x38')][_0x5453('0x46')]?_0x5aff3f[_0x5453('0x38')]:_0x59a325[_0x5453('0x32')];if(_0xeada75[_0x5453('0x33')][_0x5453('0x40')]){_0x5aff3f['include']=[{'all':!![]}];}_0x5aff3f=_[_0x5453('0x3d')]({},_0x5aff3f,_0xeada75[_0x5453('0x3f')]);return db[_0x5453('0x2e')][_0x5453('0x47')](_0x5aff3f)[_0x5453('0x24')](handleEntityNotFound(_0x35262a,null))[_0x5453('0x24')](respondWithResult(_0x35262a,null))['catch'](handleError(_0x35262a,null));};exports['create']=function(_0x7fa8a6,_0x50ecf9){return db[_0x5453('0x2e')][_0x5453('0x48')](_0x7fa8a6[_0x5453('0x49')],{})[_0x5453('0x24')](function(_0x4e0ae5){var _0xe4e7b8=_0x7fa8a6[_0x5453('0x4a')]['get']({'plain':!![]});if(!_0xe4e7b8)throw new Error(_0x5453('0x4b'));if(_0xe4e7b8[_0x5453('0x4c')]==='user'){var _0x1118cf=_0x4e0ae5[_0x5453('0x25')]({'plain':!![]});var _0x2618ec=_0x5453('0x26');return db[_0x5453('0x4d')][_0x5453('0x47')]({'where':{'name':_0x2618ec,'userProfileId':_0xe4e7b8[_0x5453('0x4e')]},'raw':!![]})[_0x5453('0x24')](function(_0x270270){if(_0x270270&&_0x270270['autoAssociation']===0x0){return db[_0x5453('0x4f')][_0x5453('0x48')]({'name':_0x1118cf[_0x5453('0x2a')],'resourceId':_0x1118cf['id'],'type':_0x270270[_0x5453('0x2a')],'sectionId':_0x270270['id']},{})[_0x5453('0x24')](function(){return _0x4e0ae5;});}else{return _0x4e0ae5;}})[_0x5453('0x43')](function(_0x396de4){logger[_0x5453('0x28')](_0x5453('0x50'),_0x396de4);throw _0x396de4;});}return _0x4e0ae5;})['then'](respondWithResult(_0x50ecf9,0xc9))[_0x5453('0x43')](handleError(_0x50ecf9,null));};exports[_0x5453('0x23')]=function(_0x68aa8f,_0x458dff){if(_0x68aa8f[_0x5453('0x49')]['id']){delete _0x68aa8f['body']['id'];}return db['Schedule']['find']({'where':{'id':_0x68aa8f['params']['id']}})['then'](handleEntityNotFound(_0x458dff,null))[_0x5453('0x24')](saveUpdates(_0x68aa8f[_0x5453('0x49')],null))[_0x5453('0x24')](respondWithResult(_0x458dff,null))[_0x5453('0x43')](handleError(_0x458dff,null));};exports[_0x5453('0x27')]=function(_0x23c902,_0x291d2b){return db['Schedule'][_0x5453('0x47')]({'where':{'id':_0x23c902[_0x5453('0x45')]['id']}})[_0x5453('0x24')](handleEntityNotFound(_0x291d2b,null))['then'](removeEntity(_0x291d2b,null))['catch'](handleError(_0x291d2b,null));};exports[_0x5453('0x51')]=function(_0x1ea5c4,_0x38f193,_0x398713){var _0x4973e7=require(_0x5453('0x52'));return db['Schedule'][_0x5453('0x47')]({'where':{'id':_0x1ea5c4[_0x5453('0x45')]['id']},'raw':!![]})[_0x5453('0x24')](handleEntityNotFound(_0x38f193,null))['then'](function(){_0x4973e7[_0x5453('0x51')](_0x1ea5c4['params']['id']);})[_0x5453('0x24')](respondWithStatusCode(_0x38f193,null))['catch'](handleError(_0x38f193,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 5aa4296..28ab671 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 _0x6b04=['api','moment','request-promise','path','./schedule.attributes','tools_schedules','lodash','../../config/logger'];(function(_0x2b16b8,_0x336263){var _0x47763d=function(_0x4e9c6c){while(--_0x4e9c6c){_0x2b16b8['push'](_0x2b16b8['shift']());}};_0x47763d(++_0x336263);}(_0x6b04,0x1b6));var _0x46b0=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x6b04[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x46b0('0x0'));var util=require('util');var logger=require(_0x46b0('0x1'))(_0x46b0('0x2'));var moment=require(_0x46b0('0x3'));var BPromise=require('bluebird');var rp=require(_0x46b0('0x4'));var fs=require('fs');var path=require(_0x46b0('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x46b0('0x6'));module['exports']=function(_0x5008ba,_0x365bab){return _0x5008ba['define']('Schedule',attributes,{'tableName':_0x46b0('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x57a7=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./schedule.attributes','exports','lodash','util'];(function(_0x12acaa,_0x5ed722){var _0xe2b239=function(_0x3cc144){while(--_0x3cc144){_0x12acaa['push'](_0x12acaa['shift']());}};_0xe2b239(++_0x5ed722);}(_0x57a7,0x142));var _0x757a=function(_0x156c67,_0x2a5744){_0x156c67=_0x156c67-0x0;var _0x46506d=_0x57a7[_0x156c67];return _0x46506d;};'use strict';var _=require(_0x757a('0x0'));var util=require(_0x757a('0x1'));var logger=require(_0x757a('0x2'))(_0x757a('0x3'));var moment=require(_0x757a('0x4'));var BPromise=require(_0x757a('0x5'));var rp=require(_0x757a('0x6'));var fs=require('fs');var path=require(_0x757a('0x7'));var rimraf=require(_0x757a('0x8'));var config=require(_0x757a('0x9'));var attributes=require(_0x757a('0xa'));module[_0x757a('0xb')]=function(_0xdfc41d,_0x33d189){return _0xdfc41d['define']('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 48551e9..17fb9df 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 _0x68a6=['lodash','util','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','client','request','then','info','Schedule,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x68a6,0x1db));var _0x668a=function(_0x1597b8,_0x3a1392){_0x1597b8=_0x1597b8-0x0;var _0x43464c=_0x68a6[_0x1597b8];return _0x43464c;};'use strict';var _=require(_0x668a('0x0'));var util=require(_0x668a('0x1'));var moment=require(_0x668a('0x2'));var BPromise=require(_0x668a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x668a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x668a('0x5'));var logger=require('../../config/logger')(_0x668a('0x6'));var config=require(_0x668a('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x668a('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x447583,_0x4fd32e,_0x553c3f){return new BPromise(function(_0x387b51,_0x1061d1){return client[_0x668a('0x9')](_0x447583,_0x553c3f)[_0x668a('0xa')](function(_0x433aa5){logger[_0x668a('0xb')](_0x668a('0xc'),_0x4fd32e,'request\x20sent');logger[_0x668a('0xd')]('Schedule,\x20%s,\x20%s,\x20%s',_0x4fd32e,_0x668a('0xe'),JSON[_0x668a('0xf')](_0x433aa5));if(_0x433aa5[_0x668a('0x10')]){if(_0x433aa5['error'][_0x668a('0x11')]===0x1f4){logger[_0x668a('0x10')](_0x668a('0xc'),_0x4fd32e,_0x433aa5[_0x668a('0x10')][_0x668a('0x12')]);return _0x1061d1(_0x433aa5[_0x668a('0x10')][_0x668a('0x12')]);}logger['error'](_0x668a('0xc'),_0x4fd32e,_0x433aa5[_0x668a('0x10')][_0x668a('0x12')]);return _0x387b51(_0x433aa5[_0x668a('0x10')][_0x668a('0x12')]);}else{logger[_0x668a('0xb')](_0x668a('0xc'),_0x4fd32e,_0x668a('0xe'));_0x387b51(_0x433aa5['result']['message']);}})['catch'](function(_0x4b5cdd){logger[_0x668a('0x10')](_0x668a('0xc'),_0x4fd32e,_0x4b5cdd);_0x1061d1(_0x4b5cdd);});});} \ No newline at end of file +var _0xf8ea=['moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Schedule,\x20%s,\x20%s','result','util'];(function(_0x555d9a,_0x338f6a){var _0x1c6616=function(_0xc40b3f){while(--_0xc40b3f){_0x555d9a['push'](_0x555d9a['shift']());}};_0x1c6616(++_0x338f6a);}(_0xf8ea,0x179));var _0xaf8e=function(_0x53eaa1,_0x5c3fc3){_0x53eaa1=_0x53eaa1-0x0;var _0x5a1022=_0xf8ea[_0x53eaa1];return _0x5a1022;};'use strict';var _=require('lodash');var util=require(_0xaf8e('0x0'));var moment=require(_0xaf8e('0x1'));var BPromise=require(_0xaf8e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xaf8e('0x3'))['db'];var utils=require(_0xaf8e('0x4'));var logger=require('../../config/logger')(_0xaf8e('0x5'));var config=require(_0xaf8e('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xaf8e('0x7')][_0xaf8e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xe79291,_0x462cc1,_0x12a061){return new BPromise(function(_0x42d34f,_0xc0929f){return client[_0xaf8e('0x9')](_0xe79291,_0x12a061)[_0xaf8e('0xa')](function(_0x52fff7){logger[_0xaf8e('0xb')]('Schedule,\x20%s,\x20%s',_0x462cc1,_0xaf8e('0xc'));logger[_0xaf8e('0xd')](_0xaf8e('0xe'),_0x462cc1,_0xaf8e('0xc'),JSON[_0xaf8e('0xf')](_0x52fff7));if(_0x52fff7[_0xaf8e('0x10')]){if(_0x52fff7['error'][_0xaf8e('0x11')]===0x1f4){logger['error']('Schedule,\x20%s,\x20%s',_0x462cc1,_0x52fff7[_0xaf8e('0x10')][_0xaf8e('0x12')]);return _0xc0929f(_0x52fff7[_0xaf8e('0x10')]['message']);}logger[_0xaf8e('0x10')](_0xaf8e('0x13'),_0x462cc1,_0x52fff7[_0xaf8e('0x10')]['message']);return _0x42d34f(_0x52fff7[_0xaf8e('0x10')][_0xaf8e('0x12')]);}else{logger[_0xaf8e('0xb')](_0xaf8e('0x13'),_0x462cc1,'request\x20sent');_0x42d34f(_0x52fff7[_0xaf8e('0x14')]['message']);}})['catch'](function(_0x163783){logger[_0xaf8e('0x10')](_0xaf8e('0x13'),_0x462cc1,_0x163783);_0xc0929f(_0x163783);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index 218c136..dd6bcb5 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 _0x756c=['path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./screenRecording.controller','get','isAuthenticated','/describe','describe','/:id','/:id/download','download','post','put','delete','destroy','exports','multer','util'];(function(_0x3f90fb,_0x3ac912){var _0x239540=function(_0x1c7476){while(--_0x1c7476){_0x3f90fb['push'](_0x3f90fb['shift']());}};_0x239540(++_0x3ac912);}(_0x756c,0x163));var _0xc756=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x756c[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xc756('0x0'));var util=require(_0xc756('0x1'));var path=require(_0xc756('0x2'));var timeout=require('connect-timeout');var express=require(_0xc756('0x3'));var router=express[_0xc756('0x4')]();var fs_extra=require(_0xc756('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xc756('0x6'));var config=require(_0xc756('0x7'));var controller=require(_0xc756('0x8'));router[_0xc756('0x9')]('/',auth[_0xc756('0xa')](),controller['index']);router[_0xc756('0x9')](_0xc756('0xb'),auth[_0xc756('0xa')](),controller[_0xc756('0xc')]);router[_0xc756('0x9')](_0xc756('0xd'),auth[_0xc756('0xa')](),controller['show']);router[_0xc756('0x9')](_0xc756('0xe'),auth['isAuthenticated'](),controller[_0xc756('0xf')]);router[_0xc756('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0xc756('0x11')]('/:id',auth[_0xc756('0xa')](),controller['update']);router[_0xc756('0x12')](_0xc756('0xd'),auth['isAuthenticated'](),controller[_0xc756('0x13')]);module[_0xc756('0x14')]=router; \ No newline at end of file +var _0x541c=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./screenRecording.controller','get','isAuthenticated','index','/describe','describe','/:id/download','post','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x32cfa5,_0x2e1ed5){var _0x2fbbee=function(_0x2b6ac7){while(--_0x2b6ac7){_0x32cfa5['push'](_0x32cfa5['shift']());}};_0x2fbbee(++_0x2e1ed5);}(_0x541c,0x1f4));var _0xc541=function(_0x1d3019,_0x8dbbd5){_0x1d3019=_0x1d3019-0x0;var _0x36458e=_0x541c[_0x1d3019];return _0x36458e;};'use strict';var multer=require(_0xc541('0x0'));var util=require(_0xc541('0x1'));var path=require(_0xc541('0x2'));var timeout=require(_0xc541('0x3'));var express=require(_0xc541('0x4'));var router=express[_0xc541('0x5')]();var fs_extra=require(_0xc541('0x6'));var auth=require(_0xc541('0x7'));var interaction=require(_0xc541('0x8'));var config=require(_0xc541('0x9'));var controller=require(_0xc541('0xa'));router[_0xc541('0xb')]('/',auth[_0xc541('0xc')](),controller[_0xc541('0xd')]);router['get'](_0xc541('0xe'),auth[_0xc541('0xc')](),controller[_0xc541('0xf')]);router[_0xc541('0xb')]('/:id',auth[_0xc541('0xc')](),controller['show']);router['get'](_0xc541('0x10'),auth[_0xc541('0xc')](),controller['download']);router[_0xc541('0x11')]('/',auth[_0xc541('0xc')](),controller['create']);router[_0xc541('0x12')](_0xc541('0x13'),auth[_0xc541('0xc')](),controller[_0xc541('0x14')]);router[_0xc541('0x15')](_0xc541('0x13'),auth['isAuthenticated'](),controller[_0xc541('0x16')]);module[_0xc541('0x17')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index 721499c..405731b 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 _0x4253=['INTEGER','closedAt','duration','startedAt','format','toString','DATE','MM-DD-YYYY\x20HH:mm','sequelize','moment','../../config/environment','VIRTUAL','getDataValue','value','extname','STRING','replace','setDataValue'];(function(_0x3d83cb,_0x3e1202){var _0x5418cc=function(_0x1f128c){while(--_0x1f128c){_0x3d83cb['push'](_0x3d83cb['shift']());}};_0x5418cc(++_0x3e1202);}(_0x4253,0x14c));var _0x3425=function(_0x57d24d,_0x36220d){_0x57d24d=_0x57d24d-0x0;var _0x51ea82=_0x4253[_0x57d24d];return _0x51ea82;};'use strict';var Sequelize=require(_0x3425('0x0'));var moment=require(_0x3425('0x1'));var path=require('path');var config=require(_0x3425('0x2'));module['exports']={'format':{'type':Sequelize[_0x3425('0x3')],'get':function(){return this[_0x3425('0x4')](_0x3425('0x5'))?path[_0x3425('0x6')](this[_0x3425('0x4')](_0x3425('0x5'))):undefined;}},'interactionid':{'type':Sequelize[_0x3425('0x7')]},'channel':{'type':Sequelize[_0x3425('0x7')]},'value':{'type':Sequelize[_0x3425('0x7')],'set':function(_0x53cc1f){var _0x1bb3ca=_0x53cc1f[_0x3425('0x8')](/\\/g,'/');this[_0x3425('0x9')]('value',_0x1bb3ca);}},'rating':{'type':Sequelize[_0x3425('0xa')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x3425('0xa')],'set':function(_0x5a2bc6){this[_0x3425('0x9')]('startedAt',moment()['subtract'](_0x5a2bc6,'ms'));this['setDataValue'](_0x3425('0xb'),moment());this[_0x3425('0x9')](_0x3425('0xc'),_0x5a2bc6);}},'startedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x3425('0x4')](_0x3425('0xd')))[_0x3425('0xe')]('MM-DD-YYYY\x20HH:mm')[_0x3425('0xf')]();}},'closedAt':{'type':Sequelize[_0x3425('0x10')],'get':function(){return moment(this[_0x3425('0x4')](_0x3425('0xb')))[_0x3425('0xe')](_0x3425('0x11'))[_0x3425('0xf')]();}},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x3425('0x4')]('createdAt'))[_0x3425('0xe')](_0x3425('0x11'))['toString']();}},'updatedAt':{'type':Sequelize[_0x3425('0x10')],'get':function(){return moment(this[_0x3425('0x4')]('updatedAt'))[_0x3425('0xe')]('MM-DD-YYYY\x20HH:mm')[_0x3425('0xf')]();}}}; \ No newline at end of file +var _0x9458=['value','extname','getDataValue','STRING','replace','INTEGER','setDataValue','startedAt','closedAt','DATE','format','MM-DD-YYYY\x20HH:mm','toString','createdAt','updatedAt','path','VIRTUAL'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x9458,0x1b8));var _0x8945=function(_0x347459,_0x47c2eb){_0x347459=_0x347459-0x0;var _0x1e8e0d=_0x9458[_0x347459];return _0x1e8e0d;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');var path=require(_0x8945('0x0'));var config=require('../../config/environment');module['exports']={'format':{'type':Sequelize[_0x8945('0x1')],'get':function(){return this['getDataValue'](_0x8945('0x2'))?path[_0x8945('0x3')](this[_0x8945('0x4')](_0x8945('0x2'))):undefined;}},'interactionid':{'type':Sequelize[_0x8945('0x5')]},'channel':{'type':Sequelize[_0x8945('0x5')]},'value':{'type':Sequelize[_0x8945('0x5')],'set':function(_0x12187d){var _0x928802=_0x12187d[_0x8945('0x6')](/\\/g,'/');this['setDataValue'](_0x8945('0x2'),_0x928802);}},'rating':{'type':Sequelize[_0x8945('0x7')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x8945('0x7')],'set':function(_0x307b9e){this[_0x8945('0x8')](_0x8945('0x9'),moment()['subtract'](_0x307b9e,'ms'));this[_0x8945('0x8')](_0x8945('0xa'),moment());this['setDataValue']('duration',_0x307b9e);}},'startedAt':{'type':Sequelize[_0x8945('0xb')],'get':function(){return moment(this['getDataValue'](_0x8945('0x9')))[_0x8945('0xc')](_0x8945('0xd'))[_0x8945('0xe')]();}},'closedAt':{'type':Sequelize[_0x8945('0xb')],'get':function(){return moment(this[_0x8945('0x4')]('closedAt'))[_0x8945('0xc')](_0x8945('0xd'))['toString']();}},'createdAt':{'type':Sequelize[_0x8945('0xb')],'get':function(){return moment(this[_0x8945('0x4')](_0x8945('0xf')))[_0x8945('0xc')](_0x8945('0xd'))[_0x8945('0xe')]();}},'updatedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this['getDataValue'](_0x8945('0x10')))['format']('MM-DD-YYYY\x20HH:mm')[_0x8945('0xe')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 1376144..e4ad61a 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 _0x207c=['sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','error','name','send','index','map','ScreenRecording','rawAttributes','fieldName','type','key','model','differenceBy','format','query','keys','filters','attributes','intersection','fields','length','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','findAll','rows','show','params','options','find','catch','create','body','duration','createdAt','value','describe','../../components/encryptor','uniqueid','join','root','server/files/screen_recordings','%s.cypher','existsSync','secrets','recording','Sequelize','ScreenRecording\x20not\x20found','filename','extname','unlink','download','message','Not\x20found','isNil','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','fs-extra','lodash','squel','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../mysqldb'];(function(_0x14ceb2,_0xeb2ff2){var _0x102bd1=function(_0x22de3d){while(--_0x22de3d){_0x14ceb2['push'](_0x14ceb2['shift']());}};_0x102bd1(++_0xeb2ff2);}(_0x207c,0x1e8));var _0xc207=function(_0x174a4d,_0x203ae3){_0x174a4d=_0x174a4d-0x0;var _0x240fa1=_0x207c[_0x174a4d];return _0x240fa1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc207('0x0'));var zipdir=require(_0xc207('0x1'));var jsonpatch=require(_0xc207('0x2'));var rp=require(_0xc207('0x3'));var moment=require(_0xc207('0x4'));var BPromise=require(_0xc207('0x5'));var Mustache=require(_0xc207('0x6'));var util=require('util');var path=require(_0xc207('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc207('0x8'));var _=require(_0xc207('0x9'));var squel=require(_0xc207('0xa'));var crypto=require('crypto');var jsforce=require(_0xc207('0xb'));var deskjs=require(_0xc207('0xc'));var toCsv=require(_0xc207('0xd'));var querystring=require('querystring');var Papa=require(_0xc207('0xe'));var Redis=require(_0xc207('0xf'));var authService=require(_0xc207('0x10'));var qs=require(_0xc207('0x11'));var as=require(_0xc207('0x12'));var hardwareService=require(_0xc207('0x13'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xc207('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xc207('0x15'))['db'];function respondWithStatusCode(_0x2782ce,_0x59d401){_0x59d401=_0x59d401||0xcc;return function(_0x3e1108){if(_0x3e1108){return _0x2782ce[_0xc207('0x16')](_0x59d401);}return _0x2782ce[_0xc207('0x17')](_0x59d401)[_0xc207('0x18')]();};}function respondWithResult(_0xe993a0,_0x51e967){_0x51e967=_0x51e967||0xc8;return function(_0xc62672){if(_0xc62672){return _0xe993a0[_0xc207('0x17')](_0x51e967)[_0xc207('0x19')](_0xc62672);}};}function respondWithFilteredResult(_0x4031ad,_0x4ef6c4){return function(_0x564cef){if(_0x564cef){var _0x554e5c=typeof _0x4ef6c4[_0xc207('0x1a')]===_0xc207('0x1b')&&typeof _0x4ef6c4[_0xc207('0x1c')]===_0xc207('0x1b');var _0x4b8f44=_0x564cef[_0xc207('0x1d')];var _0x282595=_0x554e5c?0x0:_0x4ef6c4[_0xc207('0x1a')];var _0x5f288e=_0x554e5c?_0x564cef[_0xc207('0x1d')]:_0x4ef6c4['offset']+_0x4ef6c4[_0xc207('0x1c')];var _0x33ddb1;if(_0x5f288e>=_0x4b8f44){_0x5f288e=_0x4b8f44;_0x33ddb1=0xc8;}else{_0x33ddb1=0xce;}_0x4031ad[_0xc207('0x17')](_0x33ddb1);return _0x4031ad[_0xc207('0x1e')](_0xc207('0x1f'),_0x282595+'-'+_0x5f288e+'/'+_0x4b8f44)[_0xc207('0x19')](_0x564cef);}return null;};}function patchUpdates(_0x35c0b0){return function(_0x464dea){try{jsonpatch[_0xc207('0x20')](_0x464dea,_0x35c0b0,!![]);}catch(_0x2bd2eb){return BPromise[_0xc207('0x21')](_0x2bd2eb);}return _0x464dea[_0xc207('0x22')]();};}function saveUpdates(_0x40de25,_0x4b52a7){return function(_0x163b36){if(_0x163b36){return _0x163b36['update'](_0x40de25)[_0xc207('0x23')](function(_0x3ac142){return _0x3ac142;});}return null;};}function removeEntity(_0x1eabe8,_0x83253f){return function(_0x3539f4){if(_0x3539f4){return _0x3539f4[_0xc207('0x24')]()[_0xc207('0x23')](function(){_0x1eabe8[_0xc207('0x17')](0xcc)[_0xc207('0x18')]();});}};}function handleEntityNotFound(_0x2385f7,_0x25c91e){return function(_0x27df03){if(!_0x27df03){_0x2385f7[_0xc207('0x16')](0x194);}return _0x27df03;};}function handleError(_0x138970,_0x1445d3){_0x1445d3=_0x1445d3||0x1f4;return function(_0x56a066){logger[_0xc207('0x25')](_0x56a066['stack']);if(_0x56a066['name']){delete _0x56a066[_0xc207('0x26')];}_0x138970[_0xc207('0x17')](_0x1445d3)[_0xc207('0x27')](_0x56a066);};}exports[_0xc207('0x28')]=function(_0x6a653d,_0x478af7){var _0xe5e848={},_0x463ac8={},_0x6223ef={'count':0x0,'rows':[]};var _0x1bec3f=_[_0xc207('0x29')](db[_0xc207('0x2a')][_0xc207('0x2b')],function(_0x27bc72){return{'name':_0x27bc72[_0xc207('0x2c')],'type':_0x27bc72[_0xc207('0x2d')][_0xc207('0x2e')]};});_0x463ac8[_0xc207('0x2f')]=_[_0xc207('0x30')](_['map'](_0x1bec3f,_0xc207('0x26')),[_0xc207('0x31')]);_0x463ac8[_0xc207('0x32')]=_[_0xc207('0x33')](_0x6a653d[_0xc207('0x32')]);_0x463ac8[_0xc207('0x34')]=_['intersection'](_0x463ac8[_0xc207('0x2f')],_0x463ac8[_0xc207('0x32')]);_0xe5e848[_0xc207('0x35')]=_[_0xc207('0x36')](_0x463ac8['model'],qs[_0xc207('0x37')](_0x6a653d[_0xc207('0x32')][_0xc207('0x37')]));_0xe5e848[_0xc207('0x35')]=_0xe5e848[_0xc207('0x35')][_0xc207('0x38')]?_0xe5e848[_0xc207('0x35')]:_0x463ac8[_0xc207('0x2f')];if(!_0x6a653d[_0xc207('0x32')]['hasOwnProperty']('nolimit')){_0xe5e848[_0xc207('0x1c')]=qs[_0xc207('0x1c')](_0x6a653d[_0xc207('0x32')][_0xc207('0x1c')]);_0xe5e848['offset']=qs[_0xc207('0x1a')](_0x6a653d[_0xc207('0x32')][_0xc207('0x1a')]);}_0xe5e848[_0xc207('0x39')]=qs[_0xc207('0x3a')](_0x6a653d['query'][_0xc207('0x3a')]);_0xe5e848[_0xc207('0x3b')]=qs['filters'](_[_0xc207('0x3c')](_0x6a653d['query'],_0x463ac8[_0xc207('0x34')]),_0x1bec3f);if(_0x6a653d[_0xc207('0x32')]['filter']){_0xe5e848[_0xc207('0x3b')]=_[_0xc207('0x3d')](_0xe5e848[_0xc207('0x3b')],{'$or':_['map'](_0x1bec3f,function(_0x5b3041){if(_0x5b3041[_0xc207('0x2d')]!==_0xc207('0x3e')){var _0x41d66c={};_0x41d66c[_0x5b3041[_0xc207('0x26')]]={'$like':'%'+_0x6a653d['query'][_0xc207('0x3f')]+'%'};return _0x41d66c;}})});}_0xe5e848=_['merge']({},_0xe5e848,_0x6a653d['options']);var _0x4c10ed={'where':_0xe5e848['where']};return db[_0xc207('0x2a')][_0xc207('0x1d')](_0x4c10ed)[_0xc207('0x23')](function(_0x487f98){_0x6223ef[_0xc207('0x1d')]=_0x487f98;if(_0x6a653d[_0xc207('0x32')][_0xc207('0x40')]){_0xe5e848[_0xc207('0x41')]=[{'all':!![]}];}return db['ScreenRecording'][_0xc207('0x42')](_0xe5e848);})[_0xc207('0x23')](function(_0x123a46){_0x6223ef[_0xc207('0x43')]=_0x123a46;return _0x6223ef;})[_0xc207('0x23')](respondWithFilteredResult(_0x478af7,_0xe5e848))['catch'](handleError(_0x478af7,null));};exports[_0xc207('0x44')]=function(_0x19a67d,_0x3a935a){var _0x471a85={'raw':![],'where':{'id':_0x19a67d[_0xc207('0x45')]['id']}},_0x153490={};_0x153490[_0xc207('0x2f')]=_[_0xc207('0x33')](db[_0xc207('0x2a')]['rawAttributes']);_0x153490[_0xc207('0x32')]=_[_0xc207('0x33')](_0x19a67d['query']);_0x153490[_0xc207('0x34')]=_[_0xc207('0x36')](_0x153490[_0xc207('0x2f')],_0x153490[_0xc207('0x32')]);_0x471a85[_0xc207('0x35')]=_['intersection'](_0x153490[_0xc207('0x2f')],qs[_0xc207('0x37')](_0x19a67d[_0xc207('0x32')]['fields']));_0x471a85[_0xc207('0x35')]=_0x471a85[_0xc207('0x35')][_0xc207('0x38')]?_0x471a85[_0xc207('0x35')]:_0x153490['model'];if(_0x19a67d['query'][_0xc207('0x40')]){_0x471a85[_0xc207('0x41')]=[{'all':!![]}];}_0x471a85=_[_0xc207('0x3d')]({},_0x471a85,_0x19a67d[_0xc207('0x46')]);return db[_0xc207('0x2a')][_0xc207('0x47')](_0x471a85)[_0xc207('0x23')](handleEntityNotFound(_0x3a935a,null))[_0xc207('0x23')](respondWithResult(_0x3a935a,null))[_0xc207('0x48')](handleError(_0x3a935a,null));};exports[_0xc207('0x49')]=function(_0x2afcd1,_0x2fda4f){return db['ScreenRecording']['create'](_0x2afcd1[_0xc207('0x4a')],{})[_0xc207('0x23')](respondWithResult(_0x2fda4f,0xc9))[_0xc207('0x48')](handleError(_0x2fda4f,null));};exports['update']=function(_0x2b89e0,_0x3f712d){if(_0x2b89e0[_0xc207('0x4a')]['id']){delete _0x2b89e0[_0xc207('0x4a')]['id'];}delete _0x2b89e0['body'][_0xc207('0x4b')];delete _0x2b89e0['body'][_0xc207('0x4c')];delete _0x2b89e0['body']['closedAt'];delete _0x2b89e0[_0xc207('0x4a')][_0xc207('0x4d')];return db['ScreenRecording']['find']({'where':{'id':_0x2b89e0['params']['id']}})[_0xc207('0x23')](handleEntityNotFound(_0x3f712d,null))[_0xc207('0x23')](saveUpdates(_0x2b89e0[_0xc207('0x4a')],null))[_0xc207('0x23')](respondWithResult(_0x3f712d,null))[_0xc207('0x48')](handleError(_0x3f712d,null));};exports[_0xc207('0x4e')]=function(_0x3dc457,_0x1dfdee){return db['ScreenRecording'][_0xc207('0x4e')]()[_0xc207('0x23')](respondWithResult(_0x1dfdee,null))['catch'](handleError(_0x1dfdee,null));};exports['download']=function(_0x362001,_0x47c630,_0x49a78b){var _0x2634d6=require(_0xc207('0x4f'));var _0x356c8c=![];var _0x3b2448={};if(_0x362001[_0xc207('0x32')][_0xc207('0x2d')]&&_0x362001[_0xc207('0x32')][_0xc207('0x2d')]===_0xc207('0x50')){_0x3b2448[_0xc207('0x50')]=_0x362001[_0xc207('0x45')]['id'];}else{_0x3b2448['id']=_0x362001['params']['id'];}return db['ScreenRecording'][_0xc207('0x47')]({'where':_0x3b2448,'attributes':['id',_0xc207('0x4d')],'raw':!![]})[_0xc207('0x23')](handleEntityNotFound(_0x47c630,null))[_0xc207('0x23')](function(_0xaff7a0){if(_0xaff7a0){var _0x21c12b=path[_0xc207('0x51')](config[_0xc207('0x52')],_0xc207('0x53'),_0xaff7a0['value']);var _0x1cc4e3=util[_0xc207('0x31')](_0xc207('0x54'),_0x21c12b);if(fs[_0xc207('0x55')](_0x1cc4e3)){_0x356c8c=!![];return _0x2634d6['decryptFile'](_0x1cc4e3,_0x21c12b,config[_0xc207('0x56')][_0xc207('0x57')])[_0xc207('0x23')](function(){return _0xaff7a0;});}return _0xaff7a0;}})[_0xc207('0x23')](function(_0x464263){if(_0x464263){var _0x45ad58=path[_0xc207('0x51')](config['root'],_0xc207('0x53'),_0x464263[_0xc207('0x4d')]);if(!fs[_0xc207('0x55')](_0x45ad58)){throw new db[(_0xc207('0x58'))]['ValidationError'](_0xc207('0x59'));}if(_0x464263['filename']){return _0x47c630['download'](_0x45ad58,_0x464263[_0xc207('0x5a')]+path[_0xc207('0x5b')](_0x45ad58),function(){if(_0x356c8c){fs[_0xc207('0x5c')](_0x45ad58);}});}else{return _0x47c630[_0xc207('0x5d')](_0x45ad58,function(_0x441d5f){if(_0x356c8c){fs[_0xc207('0x5c')](_0x45ad58);}});}}})[_0xc207('0x48')](function(_0x33c372){if(_0x33c372[_0xc207('0x5e')]===_0xc207('0x59')){_0x47c630[_0xc207('0x17')](0x194)[_0xc207('0x27')](_0xc207('0x5f'));}else{return handleError(_0x47c630,null);}});};exports[_0xc207('0x24')]=function(_0x282ae5,_0x501bca){return db[_0xc207('0x2a')]['find']({'where':{'id':_0x282ae5[_0xc207('0x45')]['id']}})[_0xc207('0x23')](function(_0x2ade23){if(_['isNil'](_0x2ade23)){throw new ReferenceError('Entity\x20not\x20found');}return _0x2ade23;})[_0xc207('0x23')](function(_0x3ac0dd){var _0x2f18a2=path['join'](config[_0xc207('0x52')],_0xc207('0x53'),_0x3ac0dd[_0xc207('0x4d')]);logger['info']('cancellazione\x20fisica\x20documento\x20%s',_0x2f18a2);if(!_[_0xc207('0x60')](_0x3ac0dd['value'])&&fs[_0xc207('0x55')](_0x2f18a2)){logger[_0xc207('0x61')](_0xc207('0x62')+_0x2f18a2+_0xc207('0x63'));fs[_0xc207('0x64')](_0x2f18a2);}_0x2f18a2=_0x2f18a2+_0xc207('0x65');if(!_[_0xc207('0x60')](_0x3ac0dd[_0xc207('0x4d')])&&fs['existsSync'](_0x2f18a2)){logger[_0xc207('0x61')](_0xc207('0x62')+_0x2f18a2+_0xc207('0x63'));fs[_0xc207('0x64')](_0x2f18a2);}return _0x3ac0dd;})[_0xc207('0x23')](function(_0x14050a){if(!_0x14050a)throw new InternalError();return _0x14050a[_0xc207('0x24')]();})[_0xc207('0x23')](function(){_0x501bca[_0xc207('0x17')](0xcc)[_0xc207('0x18')]();})[_0xc207('0x48')](handleError(_0x501bca,null));}; \ No newline at end of file +var _0x8958=['pick','merge','VIRTUAL','filter','options','ScreenRecording','include','findAll','params','rawAttributes','includeAll','create','catch','body','createdAt','closedAt','describe','download','../../components/encryptor','uniqueid','find','value','join','root','server/files/screen_recordings','%s.cypher','decryptFile','secrets','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','unlink','message','Not\x20found','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','File:\x20\x22','destroy','rimraf','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','apply','reject','save','update','then','error','name','send','index','map','fieldName','type','key','model','format','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0x4c11ce,_0x27e6a5){var _0x59b8fa=function(_0x5eb6ec){while(--_0x5eb6ec){_0x4c11ce['push'](_0x4c11ce['shift']());}};_0x59b8fa(++_0x27e6a5);}(_0x8958,0x93));var _0x8895=function(_0x13052b,_0x565758){_0x13052b=_0x13052b-0x0;var _0x135a7a=_0x8958[_0x13052b];return _0x135a7a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8895('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x8895('0x1'));var Mustache=require('mustache');var util=require(_0x8895('0x2'));var path=require(_0x8895('0x3'));var sox=require(_0x8895('0x4'));var csv=require('to-csv');var ejs=require(_0x8895('0x5'));var fs=require('fs');var fs_extra=require(_0x8895('0x6'));var _=require(_0x8895('0x7'));var squel=require(_0x8895('0x8'));var crypto=require(_0x8895('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x8895('0xa'));var toCsv=require(_0x8895('0xb'));var querystring=require(_0x8895('0xc'));var Papa=require(_0x8895('0xd'));var Redis=require(_0x8895('0xe'));var authService=require(_0x8895('0xf'));var qs=require(_0x8895('0x10'));var as=require(_0x8895('0x11'));var hardwareService=require(_0x8895('0x12'));var logger=require(_0x8895('0x13'))('api');var utils=require(_0x8895('0x14'));var config=require(_0x8895('0x15'));var licenseUtil=require(_0x8895('0x16'));var db=require(_0x8895('0x17'))['db'];function respondWithStatusCode(_0x446e1a,_0xaf93bc){_0xaf93bc=_0xaf93bc||0xcc;return function(_0x5af0ef){if(_0x5af0ef){return _0x446e1a[_0x8895('0x18')](_0xaf93bc);}return _0x446e1a[_0x8895('0x19')](_0xaf93bc)[_0x8895('0x1a')]();};}function respondWithResult(_0x57d40a,_0x47b9fe){_0x47b9fe=_0x47b9fe||0xc8;return function(_0x9191b8){if(_0x9191b8){return _0x57d40a['status'](_0x47b9fe)[_0x8895('0x1b')](_0x9191b8);}};}function respondWithFilteredResult(_0x337101,_0x195789){return function(_0x3d7b59){if(_0x3d7b59){var _0x2c9d40=typeof _0x195789['offset']===_0x8895('0x1c')&&typeof _0x195789[_0x8895('0x1d')]===_0x8895('0x1c');var _0xcdd661=_0x3d7b59[_0x8895('0x1e')];var _0x1b5c82=_0x2c9d40?0x0:_0x195789[_0x8895('0x1f')];var _0x26cee0=_0x2c9d40?_0x3d7b59[_0x8895('0x1e')]:_0x195789[_0x8895('0x1f')]+_0x195789[_0x8895('0x1d')];var _0x6b8a16;if(_0x26cee0>=_0xcdd661){_0x26cee0=_0xcdd661;_0x6b8a16=0xc8;}else{_0x6b8a16=0xce;}_0x337101[_0x8895('0x19')](_0x6b8a16);return _0x337101['set']('Content-Range',_0x1b5c82+'-'+_0x26cee0+'/'+_0xcdd661)['json'](_0x3d7b59);}return null;};}function patchUpdates(_0x3daf43){return function(_0x456282){try{jsonpatch[_0x8895('0x20')](_0x456282,_0x3daf43,!![]);}catch(_0x29449a){return BPromise[_0x8895('0x21')](_0x29449a);}return _0x456282[_0x8895('0x22')]();};}function saveUpdates(_0x461346,_0xc1ce17){return function(_0x5219ca){if(_0x5219ca){return _0x5219ca[_0x8895('0x23')](_0x461346)[_0x8895('0x24')](function(_0x2a403){return _0x2a403;});}return null;};}function removeEntity(_0x1f71f3,_0x29223d){return function(_0x4d092d){if(_0x4d092d){return _0x4d092d['destroy']()[_0x8895('0x24')](function(){_0x1f71f3[_0x8895('0x19')](0xcc)[_0x8895('0x1a')]();});}};}function handleEntityNotFound(_0x24a376,_0x4fc150){return function(_0x25da11){if(!_0x25da11){_0x24a376[_0x8895('0x18')](0x194);}return _0x25da11;};}function handleError(_0x187a15,_0x5486a6){_0x5486a6=_0x5486a6||0x1f4;return function(_0x4aee03){logger[_0x8895('0x25')](_0x4aee03['stack']);if(_0x4aee03[_0x8895('0x26')]){delete _0x4aee03[_0x8895('0x26')];}_0x187a15[_0x8895('0x19')](_0x5486a6)[_0x8895('0x27')](_0x4aee03);};}exports[_0x8895('0x28')]=function(_0x5c03ea,_0x4d567a){var _0x6e449d={},_0x37ac3a={},_0x3fc4cc={'count':0x0,'rows':[]};var _0x16b65b=_[_0x8895('0x29')](db['ScreenRecording']['rawAttributes'],function(_0x46ae32){return{'name':_0x46ae32[_0x8895('0x2a')],'type':_0x46ae32[_0x8895('0x2b')][_0x8895('0x2c')]};});_0x37ac3a[_0x8895('0x2d')]=_['differenceBy'](_[_0x8895('0x29')](_0x16b65b,'name'),[_0x8895('0x2e')]);_0x37ac3a['query']=_[_0x8895('0x2f')](_0x5c03ea[_0x8895('0x30')]);_0x37ac3a[_0x8895('0x31')]=_[_0x8895('0x32')](_0x37ac3a[_0x8895('0x2d')],_0x37ac3a['query']);_0x6e449d[_0x8895('0x33')]=_[_0x8895('0x32')](_0x37ac3a[_0x8895('0x2d')],qs[_0x8895('0x34')](_0x5c03ea[_0x8895('0x30')]['fields']));_0x6e449d[_0x8895('0x33')]=_0x6e449d['attributes'][_0x8895('0x35')]?_0x6e449d['attributes']:_0x37ac3a[_0x8895('0x2d')];if(!_0x5c03ea[_0x8895('0x30')][_0x8895('0x36')](_0x8895('0x37'))){_0x6e449d[_0x8895('0x1d')]=qs['limit'](_0x5c03ea[_0x8895('0x30')]['limit']);_0x6e449d[_0x8895('0x1f')]=qs[_0x8895('0x1f')](_0x5c03ea[_0x8895('0x30')][_0x8895('0x1f')]);}_0x6e449d[_0x8895('0x38')]=qs[_0x8895('0x39')](_0x5c03ea['query'][_0x8895('0x39')]);_0x6e449d[_0x8895('0x3a')]=qs['filters'](_[_0x8895('0x3b')](_0x5c03ea['query'],_0x37ac3a[_0x8895('0x31')]),_0x16b65b);if(_0x5c03ea[_0x8895('0x30')]['filter']){_0x6e449d[_0x8895('0x3a')]=_[_0x8895('0x3c')](_0x6e449d['where'],{'$or':_['map'](_0x16b65b,function(_0x202130){if(_0x202130[_0x8895('0x2b')]!==_0x8895('0x3d')){var _0x331a9e={};_0x331a9e[_0x202130[_0x8895('0x26')]]={'$like':'%'+_0x5c03ea['query'][_0x8895('0x3e')]+'%'};return _0x331a9e;}})});}_0x6e449d=_[_0x8895('0x3c')]({},_0x6e449d,_0x5c03ea[_0x8895('0x3f')]);var _0x10005f={'where':_0x6e449d[_0x8895('0x3a')]};return db[_0x8895('0x40')]['count'](_0x10005f)[_0x8895('0x24')](function(_0x5ebfc4){_0x3fc4cc[_0x8895('0x1e')]=_0x5ebfc4;if(_0x5c03ea[_0x8895('0x30')]['includeAll']){_0x6e449d[_0x8895('0x41')]=[{'all':!![]}];}return db['ScreenRecording'][_0x8895('0x42')](_0x6e449d);})['then'](function(_0x4af3b1){_0x3fc4cc['rows']=_0x4af3b1;return _0x3fc4cc;})['then'](respondWithFilteredResult(_0x4d567a,_0x6e449d))['catch'](handleError(_0x4d567a,null));};exports['show']=function(_0x447ed6,_0x206f57){var _0x596531={'raw':![],'where':{'id':_0x447ed6[_0x8895('0x43')]['id']}},_0x4835d7={};_0x4835d7[_0x8895('0x2d')]=_['keys'](db[_0x8895('0x40')][_0x8895('0x44')]);_0x4835d7[_0x8895('0x30')]=_[_0x8895('0x2f')](_0x447ed6[_0x8895('0x30')]);_0x4835d7['filters']=_['intersection'](_0x4835d7['model'],_0x4835d7[_0x8895('0x30')]);_0x596531['attributes']=_[_0x8895('0x32')](_0x4835d7[_0x8895('0x2d')],qs[_0x8895('0x34')](_0x447ed6[_0x8895('0x30')]['fields']));_0x596531[_0x8895('0x33')]=_0x596531[_0x8895('0x33')][_0x8895('0x35')]?_0x596531[_0x8895('0x33')]:_0x4835d7[_0x8895('0x2d')];if(_0x447ed6[_0x8895('0x30')][_0x8895('0x45')]){_0x596531[_0x8895('0x41')]=[{'all':!![]}];}_0x596531=_['merge']({},_0x596531,_0x447ed6[_0x8895('0x3f')]);return db[_0x8895('0x40')]['find'](_0x596531)[_0x8895('0x24')](handleEntityNotFound(_0x206f57,null))['then'](respondWithResult(_0x206f57,null))['catch'](handleError(_0x206f57,null));};exports[_0x8895('0x46')]=function(_0x337a9f,_0x130018){return db['ScreenRecording'][_0x8895('0x46')](_0x337a9f['body'],{})[_0x8895('0x24')](respondWithResult(_0x130018,0xc9))[_0x8895('0x47')](handleError(_0x130018,null));};exports[_0x8895('0x23')]=function(_0x1ca539,_0x2f3bf1){if(_0x1ca539[_0x8895('0x48')]['id']){delete _0x1ca539[_0x8895('0x48')]['id'];}delete _0x1ca539['body']['duration'];delete _0x1ca539[_0x8895('0x48')][_0x8895('0x49')];delete _0x1ca539['body'][_0x8895('0x4a')];delete _0x1ca539['body']['value'];return db[_0x8895('0x40')]['find']({'where':{'id':_0x1ca539[_0x8895('0x43')]['id']}})[_0x8895('0x24')](handleEntityNotFound(_0x2f3bf1,null))[_0x8895('0x24')](saveUpdates(_0x1ca539[_0x8895('0x48')],null))[_0x8895('0x24')](respondWithResult(_0x2f3bf1,null))[_0x8895('0x47')](handleError(_0x2f3bf1,null));};exports[_0x8895('0x4b')]=function(_0x38d6ae,_0x583419){return db[_0x8895('0x40')][_0x8895('0x4b')]()[_0x8895('0x24')](respondWithResult(_0x583419,null))['catch'](handleError(_0x583419,null));};exports[_0x8895('0x4c')]=function(_0x3935fd,_0xd7ffeb,_0x14e769){var _0x1e264a=require(_0x8895('0x4d'));var _0x434ab8=![];var _0x216e6e={};if(_0x3935fd[_0x8895('0x30')][_0x8895('0x2b')]&&_0x3935fd['query'][_0x8895('0x2b')]===_0x8895('0x4e')){_0x216e6e[_0x8895('0x4e')]=_0x3935fd[_0x8895('0x43')]['id'];}else{_0x216e6e['id']=_0x3935fd[_0x8895('0x43')]['id'];}return db['ScreenRecording'][_0x8895('0x4f')]({'where':_0x216e6e,'attributes':['id',_0x8895('0x50')],'raw':!![]})[_0x8895('0x24')](handleEntityNotFound(_0xd7ffeb,null))[_0x8895('0x24')](function(_0x37a7b4){if(_0x37a7b4){var _0x58dd6c=path[_0x8895('0x51')](config[_0x8895('0x52')],_0x8895('0x53'),_0x37a7b4['value']);var _0x20422f=util[_0x8895('0x2e')](_0x8895('0x54'),_0x58dd6c);if(fs['existsSync'](_0x20422f)){_0x434ab8=!![];return _0x1e264a[_0x8895('0x55')](_0x20422f,_0x58dd6c,config[_0x8895('0x56')]['recording'])[_0x8895('0x24')](function(){return _0x37a7b4;});}return _0x37a7b4;}})[_0x8895('0x24')](function(_0x5198f8){if(_0x5198f8){var _0x2f990a=path[_0x8895('0x51')](config[_0x8895('0x52')],_0x8895('0x53'),_0x5198f8['value']);if(!fs['existsSync'](_0x2f990a)){throw new db[(_0x8895('0x57'))][(_0x8895('0x58'))](_0x8895('0x59'));}if(_0x5198f8['filename']){return _0xd7ffeb[_0x8895('0x4c')](_0x2f990a,_0x5198f8[_0x8895('0x5a')]+path['extname'](_0x2f990a),function(){if(_0x434ab8){fs[_0x8895('0x5b')](_0x2f990a);}});}else{return _0xd7ffeb['download'](_0x2f990a,function(_0x435e36){if(_0x434ab8){fs[_0x8895('0x5b')](_0x2f990a);}});}}})[_0x8895('0x47')](function(_0x14f8a4){if(_0x14f8a4[_0x8895('0x5c')]==='ScreenRecording\x20not\x20found'){_0xd7ffeb['status'](0x194)[_0x8895('0x27')](_0x8895('0x5d'));}else{return handleError(_0xd7ffeb,null);}});};exports['destroy']=function(_0x46f8ae,_0x131476){return db[_0x8895('0x40')][_0x8895('0x4f')]({'where':{'id':_0x46f8ae['params']['id']}})[_0x8895('0x24')](function(_0x2d2bf9){if(_[_0x8895('0x5e')](_0x2d2bf9)){throw new ReferenceError(_0x8895('0x5f'));}return _0x2d2bf9;})[_0x8895('0x24')](function(_0x41a2fe){var _0x261d4b=path[_0x8895('0x51')](config[_0x8895('0x52')],_0x8895('0x53'),_0x41a2fe[_0x8895('0x50')]);logger[_0x8895('0x60')](_0x8895('0x61'),_0x261d4b);if(!_[_0x8895('0x5e')](_0x41a2fe[_0x8895('0x50')])&&fs['existsSync'](_0x261d4b)){logger['info']('File:\x20\x22'+_0x261d4b+_0x8895('0x62'));fs[_0x8895('0x63')](_0x261d4b);}_0x261d4b=_0x261d4b+_0x8895('0x64');if(!_[_0x8895('0x5e')](_0x41a2fe[_0x8895('0x50')])&&fs['existsSync'](_0x261d4b)){logger[_0x8895('0x60')](_0x8895('0x65')+_0x261d4b+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x8895('0x63')](_0x261d4b);}return _0x41a2fe;})[_0x8895('0x24')](function(_0xf51f48){if(!_0xf51f48)throw new InternalError();return _0xf51f48[_0x8895('0x66')]();})[_0x8895('0x24')](function(){_0x131476['status'](0xcc)[_0x8895('0x1a')]();})[_0x8895('0x47')](handleError(_0x131476,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index 761fafe..8f7544f 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 _0xa654=['util','api','moment','bluebird','path','rimraf','../../config/environment','define','ScreenRecording','screen_recordings','interactionid','lodash'];(function(_0x223bdb,_0x5882e6){var _0xef8e68=function(_0x55ab83){while(--_0x55ab83){_0x223bdb['push'](_0x223bdb['shift']());}};_0xef8e68(++_0x5882e6);}(_0xa654,0x17f));var _0x4a65=function(_0x231d56,_0x4d8bfe){_0x231d56=_0x231d56-0x0;var _0x220261=_0xa654[_0x231d56];return _0x220261;};'use strict';var _=require(_0x4a65('0x0'));var util=require(_0x4a65('0x1'));var logger=require('../../config/logger')(_0x4a65('0x2'));var moment=require(_0x4a65('0x3'));var BPromise=require(_0x4a65('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4a65('0x5'));var rimraf=require(_0x4a65('0x6'));var config=require(_0x4a65('0x7'));var attributes=require('./screenRecording.attributes');module['exports']=function(_0x19f242,_0x5ce921){return _0x19f242[_0x4a65('0x8')](_0x4a65('0x9'),attributes,{'tableName':_0x4a65('0xa'),'paranoid':![],'indexes':[{'name':'interactionid','fields':[_0x4a65('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xbfb6=['bluebird','request-promise','path','../../config/environment','./screenRecording.attributes','exports','ScreenRecording','interactionid','lodash','util','api','moment'];(function(_0x14e488,_0x31fa6d){var _0x1db1b2=function(_0x204a2d){while(--_0x204a2d){_0x14e488['push'](_0x14e488['shift']());}};_0x1db1b2(++_0x31fa6d);}(_0xbfb6,0xec));var _0x6bfb=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xbfb6[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x6bfb('0x0'));var util=require(_0x6bfb('0x1'));var logger=require('../../config/logger')(_0x6bfb('0x2'));var moment=require(_0x6bfb('0x3'));var BPromise=require(_0x6bfb('0x4'));var rp=require(_0x6bfb('0x5'));var fs=require('fs');var path=require(_0x6bfb('0x6'));var rimraf=require('rimraf');var config=require(_0x6bfb('0x7'));var attributes=require(_0x6bfb('0x8'));module[_0x6bfb('0x9')]=function(_0x2d315a,_0x422677){return _0x2d315a['define'](_0x6bfb('0xa'),attributes,{'tableName':'screen_recordings','paranoid':![],'indexes':[{'name':_0x6bfb('0xb'),'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 3699181..32dea9f 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 _0xc3d4=['http','request','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client'];(function(_0x518c78,_0x4abc5d){var _0x5c5b01=function(_0x3357c6){while(--_0x3357c6){_0x518c78['push'](_0x518c78['shift']());}};_0x5c5b01(++_0x4abc5d);}(_0xc3d4,0x115));var _0x4c3d=function(_0xedf622,_0x5a854d){_0xedf622=_0xedf622-0x0;var _0x245b71=_0xc3d4[_0xedf622];return _0x245b71;};'use strict';var _=require('lodash');var util=require(_0x4c3d('0x0'));var moment=require(_0x4c3d('0x1'));var BPromise=require(_0x4c3d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4c3d('0x3'));var db=require(_0x4c3d('0x4'))['db'];var utils=require(_0x4c3d('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x4c3d('0x6'));var jayson=require(_0x4c3d('0x7'));var client=jayson[_0x4c3d('0x8')][_0x4c3d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2e9f35,_0x334b35,_0x519f50){return new BPromise(function(_0x7df253,_0x59fa3c){return client[_0x4c3d('0xa')](_0x2e9f35,_0x519f50)['then'](function(_0x3d6bd4){logger[_0x4c3d('0xb')](_0x4c3d('0xc'),_0x334b35,_0x4c3d('0xd'));logger[_0x4c3d('0xe')](_0x4c3d('0xf'),_0x334b35,_0x4c3d('0xd'),JSON[_0x4c3d('0x10')](_0x3d6bd4));if(_0x3d6bd4[_0x4c3d('0x11')]){if(_0x3d6bd4[_0x4c3d('0x11')][_0x4c3d('0x12')]===0x1f4){logger[_0x4c3d('0x11')](_0x4c3d('0xc'),_0x334b35,_0x3d6bd4[_0x4c3d('0x11')][_0x4c3d('0x13')]);return _0x59fa3c(_0x3d6bd4[_0x4c3d('0x11')][_0x4c3d('0x13')]);}logger[_0x4c3d('0x11')](_0x4c3d('0xc'),_0x334b35,_0x3d6bd4['error'][_0x4c3d('0x13')]);return _0x7df253(_0x3d6bd4[_0x4c3d('0x11')][_0x4c3d('0x13')]);}else{logger[_0x4c3d('0xb')]('ScreenRecording,\x20%s,\x20%s',_0x334b35,_0x4c3d('0xd'));_0x7df253(_0x3d6bd4[_0x4c3d('0x14')][_0x4c3d('0x13')]);}})[_0x4c3d('0x15')](function(_0xf60ed){logger[_0x4c3d('0x11')](_0x4c3d('0xc'),_0x334b35,_0xf60ed);_0x59fa3c(_0xf60ed);});});} \ No newline at end of file +var _0x7516=['../../config/environment','jayson/promise','client','http','request','info','ScreenRecording,\x20%s,\x20%s','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x3b488b,_0x3ef115){var _0xead735=function(_0x1d897c){while(--_0x1d897c){_0x3b488b['push'](_0x3b488b['shift']());}};_0xead735(++_0x3ef115);}(_0x7516,0x16f));var _0x6751=function(_0x5a7112,_0x1f9492){_0x5a7112=_0x5a7112-0x0;var _0x3147f7=_0x7516[_0x5a7112];return _0x3147f7;};'use strict';var _=require(_0x6751('0x0'));var util=require(_0x6751('0x1'));var moment=require(_0x6751('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6751('0x3'));var db=require(_0x6751('0x4'))['db'];var utils=require(_0x6751('0x5'));var logger=require('../../config/logger')(_0x6751('0x6'));var config=require(_0x6751('0x7'));var jayson=require(_0x6751('0x8'));var client=jayson[_0x6751('0x9')][_0x6751('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2658c2,_0x1bdcbb,_0x12b320){return new BPromise(function(_0x371f23,_0x3befa0){return client[_0x6751('0xb')](_0x2658c2,_0x12b320)['then'](function(_0x4d9693){logger[_0x6751('0xc')](_0x6751('0xd'),_0x1bdcbb,'request\x20sent');logger[_0x6751('0xe')](_0x6751('0xf'),_0x1bdcbb,'request\x20sent',JSON[_0x6751('0x10')](_0x4d9693));if(_0x4d9693[_0x6751('0x11')]){if(_0x4d9693[_0x6751('0x11')]['code']===0x1f4){logger[_0x6751('0x11')]('ScreenRecording,\x20%s,\x20%s',_0x1bdcbb,_0x4d9693[_0x6751('0x11')]['message']);return _0x3befa0(_0x4d9693[_0x6751('0x11')][_0x6751('0x12')]);}logger[_0x6751('0x11')](_0x6751('0xd'),_0x1bdcbb,_0x4d9693[_0x6751('0x11')]['message']);return _0x371f23(_0x4d9693[_0x6751('0x11')][_0x6751('0x12')]);}else{logger['info'](_0x6751('0xd'),_0x1bdcbb,_0x6751('0x13'));_0x371f23(_0x4d9693[_0x6751('0x14')][_0x6751('0x12')]);}})[_0x6751('0x15')](function(_0x504d00){logger['error'](_0x6751('0xd'),_0x1bdcbb,_0x504d00);_0x3befa0(_0x504d00);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index 317d6c1..2330965 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 _0x8629=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/now','getDate','show','getLogo','/:id/logo_login','getLogoLogin','/:id/gdpr','gdpr','/:id/preferred','getPreferred','root','format','%s%s','logo','originalname','post','/:id/logo','single','file','addLogo','diskStorage','join','server/files/images/logos/','logologin','extname','addLogoLogin','preferred','addPreferred','favicon','/:id/favicon','addFavicon','put','/:id','update','exports','util','connect-timeout'];(function(_0x1477ef,_0x54a5d6){var _0x164acd=function(_0x139149){while(--_0x139149){_0x1477ef['push'](_0x1477ef['shift']());}};_0x164acd(++_0x54a5d6);}(_0x8629,0x193));var _0x9862=function(_0x4a6071,_0x13ea96){_0x4a6071=_0x4a6071-0x0;var _0x2e67b8=_0x8629[_0x4a6071];return _0x2e67b8;};'use strict';var multer=require('multer');var util=require(_0x9862('0x0'));var path=require('path');var timeout=require(_0x9862('0x1'));var express=require(_0x9862('0x2'));var router=express['Router']();var fs_extra=require(_0x9862('0x3'));var auth=require(_0x9862('0x4'));var interaction=require(_0x9862('0x5'));var config=require(_0x9862('0x6'));var controller=require('./setting.controller');router['get']('/',auth[_0x9862('0x7')](),controller[_0x9862('0x8')]);router[_0x9862('0x9')](_0x9862('0xa'),controller[_0x9862('0xb')]);router[_0x9862('0x9')]('/:id',controller[_0x9862('0xc')]);router[_0x9862('0x9')]('/:id/logo',controller[_0x9862('0xd')]);router[_0x9862('0x9')](_0x9862('0xe'),controller[_0x9862('0xf')]);router['get'](_0x9862('0x10'),controller[_0x9862('0x11')]);router['get'](_0x9862('0x12'),controller[_0x9862('0x13')]);router['get']('/:id/favicon',controller['getFavicon']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x4d9332,_0x503e5c,_0x11fe29){_0x11fe29(null,path['join'](config[_0x9862('0x14')],'server/files/images/logos/'));},'filename':function(_0x4acae5,_0x3928f1,_0x10178d){_0x10178d(null,util[_0x9862('0x15')](_0x9862('0x16'),_0x9862('0x17'),path['extname'](_0x3928f1[_0x9862('0x18')])));}})});router[_0x9862('0x19')](_0x9862('0x1a'),upload[_0x9862('0x1b')](_0x9862('0x1c')),controller[_0x9862('0x1d')]);var upload=multer({'storage':multer[_0x9862('0x1e')]({'destination':function(_0x1adb55,_0x4a1938,_0x3ffd9){_0x3ffd9(null,path[_0x9862('0x1f')](config[_0x9862('0x14')],_0x9862('0x20')));},'filename':function(_0x26dd4e,_0x54d432,_0x1ce88e){_0x1ce88e(null,util['format'](_0x9862('0x16'),_0x9862('0x21'),path[_0x9862('0x22')](_0x54d432[_0x9862('0x18')])));}})});router[_0x9862('0x19')](_0x9862('0xe'),upload[_0x9862('0x1b')](_0x9862('0x1c')),controller[_0x9862('0x23')]);var upload=multer({'storage':multer[_0x9862('0x1e')]({'destination':function(_0x2c52c,_0x15d57e,_0x3ae44f){_0x3ae44f(null,path[_0x9862('0x1f')](config[_0x9862('0x14')],_0x9862('0x20')));},'filename':function(_0x38840e,_0x2f17ef,_0x43cff4){_0x43cff4(null,util[_0x9862('0x15')]('%s%s',_0x9862('0x24'),path[_0x9862('0x22')](_0x2f17ef[_0x9862('0x18')])));}})});router['post'](_0x9862('0x12'),upload['single'](_0x9862('0x1c')),controller[_0x9862('0x25')]);var upload=multer({'storage':multer[_0x9862('0x1e')]({'destination':function(_0x2ecc2d,_0x3088be,_0x46bccb){_0x46bccb(null,path[_0x9862('0x1f')](config[_0x9862('0x14')],'server/files/images/logos/'));},'filename':function(_0x339a65,_0x3085ff,_0x2ff386){_0x2ff386(null,util[_0x9862('0x15')](_0x9862('0x16'),_0x9862('0x26'),path[_0x9862('0x22')](_0x3085ff[_0x9862('0x18')])));}})});router[_0x9862('0x19')](_0x9862('0x27'),upload['single']('file'),controller[_0x9862('0x28')]);router[_0x9862('0x29')](_0x9862('0x2a'),auth[_0x9862('0x7')](),controller[_0x9862('0x2b')]);module[_0x9862('0x2c')]=router; \ No newline at end of file +var _0x5cd4=['show','/:id/logo','getLogo','/:id/logo_login','getLogoLogin','/:id/gdpr','/:id/preferred','getPreferred','join','root','format','logo','post','single','file','addLogo','diskStorage','server/files/images/logos/','%s%s','logologin','extname','originalname','addLogoLogin','preferred','addPreferred','/:id/favicon','addFavicon','/:id','update','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./setting.controller','isAuthenticated','index','get','/now'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x5cd4,0x176));var _0x45cd=function(_0x35cad4,_0x81e90b){_0x35cad4=_0x35cad4-0x0;var _0x114111=_0x5cd4[_0x35cad4];return _0x114111;};'use strict';var multer=require(_0x45cd('0x0'));var util=require('util');var path=require(_0x45cd('0x1'));var timeout=require(_0x45cd('0x2'));var express=require(_0x45cd('0x3'));var router=express[_0x45cd('0x4')]();var fs_extra=require(_0x45cd('0x5'));var auth=require(_0x45cd('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x45cd('0x7'));var controller=require(_0x45cd('0x8'));router['get']('/',auth[_0x45cd('0x9')](),controller[_0x45cd('0xa')]);router[_0x45cd('0xb')](_0x45cd('0xc'),controller['getDate']);router[_0x45cd('0xb')]('/:id',controller[_0x45cd('0xd')]);router[_0x45cd('0xb')](_0x45cd('0xe'),controller[_0x45cd('0xf')]);router[_0x45cd('0xb')](_0x45cd('0x10'),controller[_0x45cd('0x11')]);router[_0x45cd('0xb')](_0x45cd('0x12'),controller['gdpr']);router[_0x45cd('0xb')](_0x45cd('0x13'),controller[_0x45cd('0x14')]);router['get']('/:id/favicon',controller['getFavicon']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x232596,_0x2428b0,_0x41b3bd){_0x41b3bd(null,path[_0x45cd('0x15')](config[_0x45cd('0x16')],'server/files/images/logos/'));},'filename':function(_0x452638,_0x4dcf34,_0x17fb90){_0x17fb90(null,util[_0x45cd('0x17')]('%s%s',_0x45cd('0x18'),path['extname'](_0x4dcf34['originalname'])));}})});router[_0x45cd('0x19')](_0x45cd('0xe'),upload[_0x45cd('0x1a')](_0x45cd('0x1b')),controller[_0x45cd('0x1c')]);var upload=multer({'storage':multer[_0x45cd('0x1d')]({'destination':function(_0x44bd56,_0x2a9f5f,_0x1c4957){_0x1c4957(null,path[_0x45cd('0x15')](config[_0x45cd('0x16')],_0x45cd('0x1e')));},'filename':function(_0x29dd82,_0x1b73f6,_0x5f4971){_0x5f4971(null,util[_0x45cd('0x17')](_0x45cd('0x1f'),_0x45cd('0x20'),path[_0x45cd('0x21')](_0x1b73f6[_0x45cd('0x22')])));}})});router[_0x45cd('0x19')](_0x45cd('0x10'),upload[_0x45cd('0x1a')](_0x45cd('0x1b')),controller[_0x45cd('0x23')]);var upload=multer({'storage':multer[_0x45cd('0x1d')]({'destination':function(_0x38e640,_0x56c4fc,_0x3afd91){_0x3afd91(null,path[_0x45cd('0x15')](config[_0x45cd('0x16')],_0x45cd('0x1e')));},'filename':function(_0x512afb,_0x4145d6,_0x393073){_0x393073(null,util['format'](_0x45cd('0x1f'),_0x45cd('0x24'),path['extname'](_0x4145d6[_0x45cd('0x22')])));}})});router['post'](_0x45cd('0x13'),upload[_0x45cd('0x1a')](_0x45cd('0x1b')),controller[_0x45cd('0x25')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x25d758,_0x5bca69,_0x326682){_0x326682(null,path[_0x45cd('0x15')](config['root'],'server/files/images/logos/'));},'filename':function(_0x5488b4,_0x3db189,_0xa1a601){_0xa1a601(null,util[_0x45cd('0x17')]('%s%s','favicon',path[_0x45cd('0x21')](_0x3db189[_0x45cd('0x22')])));}})});router['post'](_0x45cd('0x26'),upload[_0x45cd('0x1a')](_0x45cd('0x1b')),controller[_0x45cd('0x27')]);router['put'](_0x45cd('0x28'),auth[_0x45cd('0x9')](),controller[_0x45cd('0x29')]);module[_0x45cd('0x2a')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index f8a6336..88d86c3 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 _0xe4a7=['STRING','https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate','UNSIGNED','sequelize','exports','INTEGER','min_internal','min_mailbox','BOOLEAN'];(function(_0x4875e2,_0x3e656f){var _0x34d2c2=function(_0x29cf79){while(--_0x29cf79){_0x4875e2['push'](_0x4875e2['shift']());}};_0x34d2c2(++_0x3e656f);}(_0xe4a7,0x18a));var _0x7e4a=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe4a7[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x7e4a('0x0'));module[_0x7e4a('0x1')]={'min_internal':{'type':Sequelize[_0x7e4a('0x2')](0xb),'unique':_0x7e4a('0x3'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x7e4a('0x2')](0xb),'unique':_0x7e4a('0x4'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x7e4a('0x2')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize['STRING'],'defaultValue':'/var/opt/motion2/server/files/sounds/converted'},'logo':{'type':Sequelize['STRING']},'defaultLogo':{'type':Sequelize[_0x7e4a('0x5')],'defaultValue':!![]},'loginLogo':{'type':Sequelize['STRING']},'defaultLoginLogo':{'type':Sequelize[_0x7e4a('0x5')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x7e4a('0x6')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x7e4a('0x5')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x7e4a('0x5')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x7e4a('0x5')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x7e4a('0x6')]},'turnaddr':{'type':Sequelize[_0x7e4a('0x6')]},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize[_0x7e4a('0x6')]},'pageTitle':{'type':Sequelize[_0x7e4a('0x6')]},'defaultPageTitle':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x7e4a('0x5')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x7e4a('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x7e4a('0x5')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x7e4a('0x6')],'defaultValue':_0x7e4a('0x7')},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize[_0x7e4a('0x5')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x7e4a('0x2')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x7e4a('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x7e4a('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':_0x7e4a('0x8')},'chatTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x7e4a('0x6')]},'defaultPreferred':{'type':Sequelize[_0x7e4a('0x5')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize['STRING']},'allowedLoginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x7e4a('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x7e4a('0x6')]},'defaultFavicon':{'type':Sequelize[_0x7e4a('0x5')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize['INTEGER'],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x7e4a('0x5')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x7e4a('0x2')]},'transcribeRegion':{'type':Sequelize[_0x7e4a('0x6')]},'sentiment':{'type':Sequelize[_0x7e4a('0x5')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x7e4a('0x5')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x7e4a('0x2')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x7e4a('0x6')]},'bucket':{'type':Sequelize[_0x7e4a('0x6')]},'googleSsoEnabled':{'type':Sequelize[_0x7e4a('0x5')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x7e4a('0x5')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x7e4a('0x5')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x7e4a('0x2')](0x2)[_0x7e4a('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x7e4a('0x2')](0x2)[_0x7e4a('0x9')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x7e4a('0x2')](0x2)[_0x7e4a('0x9')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x7e4a('0x2')](0x2)[_0x7e4a('0x9')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x7e4a('0x5')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x7e4a('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0x7e4a('0x2')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0x7e4a('0x2')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x7e4a('0x5')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x7e4a('0x5')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x7e4a('0x5')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x7e4a('0x2')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize[_0x7e4a('0x5')],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x7e4a('0x2')],'defaultValue':0x14},'filterFullName':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x59eb=['exports','min_internal','INTEGER','STRING','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','UNSIGNED'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x59eb,0x12d));var _0xb59e=function(_0x28611e,_0x586726){_0x28611e=_0x28611e-0x0;var _0x530f69=_0x59eb[_0x28611e];return _0x530f69;};'use strict';var Sequelize=require('sequelize');module[_0xb59e('0x0')]={'min_internal':{'type':Sequelize['INTEGER'](0xb),'unique':_0xb59e('0x1'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0xb59e('0x2')](0xb),'unique':'min_mailbox','defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0xb59e('0x3')],'defaultValue':'/var/opt/motion2/server/files/sounds/converted'},'logo':{'type':Sequelize[_0xb59e('0x3')]},'defaultLogo':{'type':Sequelize[_0xb59e('0x4')],'defaultValue':!![]},'loginLogo':{'type':Sequelize['STRING']},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize['STRING']},'defaultHeaderWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'securePassword':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0xb59e('0x4')],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0xb59e('0x3')]},'turnusername':{'type':Sequelize[_0xb59e('0x3')]},'turnpassword':{'type':Sequelize[_0xb59e('0x3')]},'pageTitle':{'type':Sequelize[_0xb59e('0x3')]},'defaultPageTitle':{'type':Sequelize[_0xb59e('0x4')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0xb59e('0x4')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0xb59e('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0xb59e('0x4')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize['STRING'],'defaultValue':_0xb59e('0x5')},'enableEmailPreview':{'type':Sequelize[_0xb59e('0x4')],'defaultValue':![]},'split':{'type':Sequelize[_0xb59e('0x4')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0xb59e('0x2')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0xb59e('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0xb59e('0x3')],'defaultValue':'alternate'},'chatTimeout':{'type':Sequelize[_0xb59e('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0xb59e('0x4')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0xb59e('0x3')]},'defaultPreferred':{'type':Sequelize[_0xb59e('0x4')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0xb59e('0x4')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0xb59e('0x3')]},'allowedLoginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'blockDuration':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'favicon':{'type':Sequelize['STRING']},'defaultFavicon':{'type':Sequelize[_0xb59e('0x4')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0xb59e('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0xb59e('0x4')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0xb59e('0x2')]},'transcribeRegion':{'type':Sequelize['STRING']},'sentiment':{'type':Sequelize[_0xb59e('0x4')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0xb59e('0x4')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0xb59e('0x2')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xb59e('0x3')]},'bucket':{'type':Sequelize[_0xb59e('0x3')]},'googleSsoEnabled':{'type':Sequelize[_0xb59e('0x4')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0xb59e('0x4')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0xb59e('0x4')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0xb59e('0x2')](0x2)[_0xb59e('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize['INTEGER'](0x2)[_0xb59e('0x6')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0xb59e('0x2')](0x2)[_0xb59e('0x6')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0xb59e('0x2')](0x2)[_0xb59e('0x6')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0xb59e('0x4')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0xb59e('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0xb59e('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0xb59e('0x2')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0xb59e('0x2')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0xb59e('0x4')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0xb59e('0x4')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0xb59e('0x4')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0xb59e('0x2')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize[_0xb59e('0x4')],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0xb59e('0x2')],'defaultValue':0x14},'filterFullName':{'type':Sequelize[_0xb59e('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index 733ea45..5a8cc2a 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 _0x6ddd=['where','merge','options','includeAll','include','findAll','rows','catch','params','keys','find','body','addLogo','file','filename','logo','addLogoLogin','loginLogo','server/files/images/logos','getLicense','favicon','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','toLower','root','join','default_logo.svg','upperFirst','custom','Sequelize','ValidationError','\x20not\x20found','download','getLogoLogin','existsSync','default_loginLogo.svg','default','securePassword','addPreferred','preferred','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','getDate','now','utcOffset','format','zip-dir','fast-json-patch','request-promise','moment','mustache','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','jayson/promise','client','http','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','save','update','destroy','end','name','send','map','Setting','rawAttributes','type','key','model','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','pick','filters','filter'];(function(_0x2c4542,_0x1af293){var _0x178c28=function(_0x4fbc72){while(--_0x4fbc72){_0x2c4542['push'](_0x2c4542['shift']());}};_0x178c28(++_0x1af293);}(_0x6ddd,0xae));var _0xd6dd=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x6ddd[_0x2f5ac5];return _0x37c9a8;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xd6dd('0x0'));var jsonpatch=require(_0xd6dd('0x1'));var rp=require(_0xd6dd('0x2'));var moment=require(_0xd6dd('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xd6dd('0x4'));var util=require('util');var path=require(_0xd6dd('0x5'));var sox=require('sox');var csv=require(_0xd6dd('0x6'));var ejs=require(_0xd6dd('0x7'));var fs=require('fs');var fs_extra=require(_0xd6dd('0x8'));var _=require('lodash');var squel=require(_0xd6dd('0x9'));var crypto=require(_0xd6dd('0xa'));var jsforce=require(_0xd6dd('0xb'));var deskjs=require(_0xd6dd('0xc'));var toCsv=require('to-csv');var querystring=require(_0xd6dd('0xd'));var Papa=require(_0xd6dd('0xe'));var Redis=require(_0xd6dd('0xf'));var authService=require(_0xd6dd('0x10'));var qs=require(_0xd6dd('0x11'));var as=require(_0xd6dd('0x12'));var hardwareService=require(_0xd6dd('0x13'));var logger=require(_0xd6dd('0x14'))(_0xd6dd('0x15'));var utils=require(_0xd6dd('0x16'));var config=require(_0xd6dd('0x17'));var licenseUtil=require(_0xd6dd('0x18'));var db=require('../../mysqldb')['db'];var jayson=require(_0xd6dd('0x19'));var client=jayson[_0xd6dd('0x1a')][_0xd6dd('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x19bdc1,_0x304f44,_0x11f224,_0x302760){return new BPromise(function(_0x550953,_0x305928){var _0x40db91=_0x302760||client;return _0x40db91[_0xd6dd('0x1c')](_0x19bdc1,_0x11f224)[_0xd6dd('0x1d')](function(_0x3381e9){logger[_0xd6dd('0x1e')](_0xd6dd('0x1f'),_0x304f44,_0xd6dd('0x20'));logger[_0xd6dd('0x21')](_0xd6dd('0x22'),_0x304f44,_0xd6dd('0x20'),JSON[_0xd6dd('0x23')](_0x3381e9));if(_0x3381e9['error']){if(_0x3381e9[_0xd6dd('0x24')][_0xd6dd('0x25')]===0x1f4){logger[_0xd6dd('0x24')](_0xd6dd('0x1f'),_0x304f44,_0x3381e9['error']['message']);return _0x305928(_0x3381e9[_0xd6dd('0x24')][_0xd6dd('0x26')]);}logger['error'](_0xd6dd('0x1f'),_0x304f44,_0x3381e9[_0xd6dd('0x24')]['message']);return _0x550953(_0x3381e9[_0xd6dd('0x24')][_0xd6dd('0x26')]);}else{logger[_0xd6dd('0x1e')]('Setting,\x20%s,\x20%s',_0x304f44,_0xd6dd('0x20'));_0x550953(_0x3381e9[_0xd6dd('0x27')][_0xd6dd('0x26')]);}})['catch'](function(_0x436dd0){logger[_0xd6dd('0x24')](_0xd6dd('0x1f'),_0x304f44,_0x436dd0);_0x305928(_0x436dd0);});});}function respondWithStatusCode(_0x1b9275,_0x23d5bc){_0x23d5bc=_0x23d5bc||0xcc;return function(_0x33f40b){if(_0x33f40b){return _0x1b9275[_0xd6dd('0x28')](_0x23d5bc);}return _0x1b9275['status'](_0x23d5bc)['end']();};}function respondWithResult(_0x284a95,_0x48c31a){_0x48c31a=_0x48c31a||0xc8;return function(_0x5be1c6){if(_0x5be1c6){return _0x284a95['status'](_0x48c31a)[_0xd6dd('0x29')](_0x5be1c6);}};}function respondWithFilteredResult(_0x4a03a5,_0x5274fe){return function(_0x5b6424){if(_0x5b6424){var _0x2a2253=typeof _0x5274fe[_0xd6dd('0x2a')]===_0xd6dd('0x2b')&&typeof _0x5274fe[_0xd6dd('0x2c')]===_0xd6dd('0x2b');var _0x315e97=_0x5b6424['count'];var _0x108c10=_0x2a2253?0x0:_0x5274fe['offset'];var _0x336ec7=_0x2a2253?_0x5b6424[_0xd6dd('0x2d')]:_0x5274fe[_0xd6dd('0x2a')]+_0x5274fe[_0xd6dd('0x2c')];var _0x1a0c49;if(_0x336ec7>=_0x315e97){_0x336ec7=_0x315e97;_0x1a0c49=0xc8;}else{_0x1a0c49=0xce;}_0x4a03a5[_0xd6dd('0x2e')](_0x1a0c49);return _0x4a03a5[_0xd6dd('0x2f')](_0xd6dd('0x30'),_0x108c10+'-'+_0x336ec7+'/'+_0x315e97)[_0xd6dd('0x29')](_0x5b6424);}return null;};}function patchUpdates(_0x17e11c){return function(_0x5aa9c0){try{jsonpatch[_0xd6dd('0x31')](_0x5aa9c0,_0x17e11c,!![]);}catch(_0x46348c){return BPromise[_0xd6dd('0x32')](_0x46348c);}return _0x5aa9c0[_0xd6dd('0x33')]();};}function saveUpdates(_0x2a5a73,_0x5ef0bc){return function(_0x590da5){if(_0x590da5){return _0x590da5[_0xd6dd('0x34')](_0x2a5a73)[_0xd6dd('0x1d')](function(_0x3c7c86){return _0x3c7c86;});}return null;};}function removeEntity(_0x157de2,_0x2f1322){return function(_0x166b39){if(_0x166b39){return _0x166b39[_0xd6dd('0x35')]()[_0xd6dd('0x1d')](function(){_0x157de2['status'](0xcc)[_0xd6dd('0x36')]();});}};}function handleEntityNotFound(_0x177fad,_0x30535c){return function(_0xdc693a){if(!_0xdc693a){_0x177fad[_0xd6dd('0x28')](0x194);}return _0xdc693a;};}function handleError(_0x470b9b,_0x69c01d){_0x69c01d=_0x69c01d||0x1f4;return function(_0x59b93e){logger[_0xd6dd('0x24')](_0x59b93e['stack']);if(_0x59b93e[_0xd6dd('0x37')]){delete _0x59b93e['name'];}_0x470b9b[_0xd6dd('0x2e')](_0x69c01d)[_0xd6dd('0x38')](_0x59b93e);};}exports['index']=function(_0x3abd50,_0x2fa2ee){var _0x52141d={},_0x4f6c79={},_0x470bd2={'count':0x0,'rows':[]};var _0xecfa70=_[_0xd6dd('0x39')](db[_0xd6dd('0x3a')][_0xd6dd('0x3b')],function(_0x4b7a53){return{'name':_0x4b7a53['fieldName'],'type':_0x4b7a53[_0xd6dd('0x3c')][_0xd6dd('0x3d')]};});_0x4f6c79[_0xd6dd('0x3e')]=_[_0xd6dd('0x39')](_0xecfa70,_0xd6dd('0x37'));_0x4f6c79[_0xd6dd('0x3f')]=_['keys'](_0x3abd50[_0xd6dd('0x3f')]);_0x4f6c79['filters']=_['intersection'](_0x4f6c79[_0xd6dd('0x3e')],_0x4f6c79[_0xd6dd('0x3f')]);_0x52141d[_0xd6dd('0x40')]=_[_0xd6dd('0x41')](_0x4f6c79[_0xd6dd('0x3e')],qs[_0xd6dd('0x42')](_0x3abd50[_0xd6dd('0x3f')][_0xd6dd('0x42')]));_0x52141d['attributes']=_0x52141d[_0xd6dd('0x40')][_0xd6dd('0x43')]?_0x52141d[_0xd6dd('0x40')]:_0x4f6c79[_0xd6dd('0x3e')];if(!_0x3abd50['query'][_0xd6dd('0x44')](_0xd6dd('0x45'))){_0x52141d['limit']=qs[_0xd6dd('0x2c')](_0x3abd50['query'][_0xd6dd('0x2c')]);_0x52141d[_0xd6dd('0x2a')]=qs['offset'](_0x3abd50['query'][_0xd6dd('0x2a')]);}_0x52141d['order']=qs[_0xd6dd('0x46')](_0x3abd50[_0xd6dd('0x3f')][_0xd6dd('0x46')]);_0x52141d['where']=qs['filters'](_[_0xd6dd('0x47')](_0x3abd50[_0xd6dd('0x3f')],_0x4f6c79[_0xd6dd('0x48')]),_0xecfa70);if(_0x3abd50[_0xd6dd('0x3f')][_0xd6dd('0x49')]){_0x52141d[_0xd6dd('0x4a')]=_[_0xd6dd('0x4b')](_0x52141d['where'],{'$or':_[_0xd6dd('0x39')](_0xecfa70,function(_0x5d5d2c){if(_0x5d5d2c[_0xd6dd('0x3c')]!=='VIRTUAL'){var _0x413fd7={};_0x413fd7[_0x5d5d2c[_0xd6dd('0x37')]]={'$like':'%'+_0x3abd50[_0xd6dd('0x3f')][_0xd6dd('0x49')]+'%'};return _0x413fd7;}})});}_0x52141d=_[_0xd6dd('0x4b')]({},_0x52141d,_0x3abd50[_0xd6dd('0x4c')]);var _0x1aab46={'where':_0x52141d[_0xd6dd('0x4a')]};return db['Setting'][_0xd6dd('0x2d')](_0x1aab46)[_0xd6dd('0x1d')](function(_0x46f600){_0x470bd2['count']=_0x46f600;if(_0x3abd50[_0xd6dd('0x3f')][_0xd6dd('0x4d')]){_0x52141d[_0xd6dd('0x4e')]=[{'all':!![]}];}return db['Setting'][_0xd6dd('0x4f')](_0x52141d);})[_0xd6dd('0x1d')](function(_0x3ca93f){_0x470bd2[_0xd6dd('0x50')]=_0x3ca93f;return _0x470bd2;})[_0xd6dd('0x1d')](respondWithFilteredResult(_0x2fa2ee,_0x52141d))[_0xd6dd('0x51')](handleError(_0x2fa2ee,null));};exports['show']=function(_0x2fb3df,_0x14d15d){var _0x36befa={'raw':![],'where':{'id':_0x2fb3df[_0xd6dd('0x52')]['id']}},_0x9de2ea={};_0x9de2ea['model']=_[_0xd6dd('0x53')](db[_0xd6dd('0x3a')]['rawAttributes']);_0x9de2ea[_0xd6dd('0x3f')]=_[_0xd6dd('0x53')](_0x2fb3df[_0xd6dd('0x3f')]);_0x9de2ea['filters']=_[_0xd6dd('0x41')](_0x9de2ea[_0xd6dd('0x3e')],_0x9de2ea[_0xd6dd('0x3f')]);_0x36befa[_0xd6dd('0x40')]=_[_0xd6dd('0x41')](_0x9de2ea['model'],qs[_0xd6dd('0x42')](_0x2fb3df['query']['fields']));_0x36befa[_0xd6dd('0x40')]=_0x36befa[_0xd6dd('0x40')][_0xd6dd('0x43')]?_0x36befa[_0xd6dd('0x40')]:_0x9de2ea[_0xd6dd('0x3e')];if(_0x2fb3df['query']['includeAll']){_0x36befa[_0xd6dd('0x4e')]=[{'all':!![]}];}_0x36befa=_[_0xd6dd('0x4b')]({},_0x36befa,_0x2fb3df['options']);return db[_0xd6dd('0x3a')][_0xd6dd('0x54')](_0x36befa)[_0xd6dd('0x1d')](handleEntityNotFound(_0x14d15d,null))[_0xd6dd('0x1d')](respondWithResult(_0x14d15d,null))['catch'](handleError(_0x14d15d,null));};exports[_0xd6dd('0x34')]=function(_0x3348e4,_0x93fbd8){if(_0x3348e4[_0xd6dd('0x55')]['id']){delete _0x3348e4[_0xd6dd('0x55')]['id'];}return db[_0xd6dd('0x3a')][_0xd6dd('0x54')]({'where':{'id':_0x3348e4[_0xd6dd('0x52')]['id']}})['then'](handleEntityNotFound(_0x93fbd8,null))[_0xd6dd('0x1d')](saveUpdates(_0x3348e4[_0xd6dd('0x55')],null))['then'](respondWithResult(_0x93fbd8,null))[_0xd6dd('0x51')](handleError(_0x93fbd8,null));};exports[_0xd6dd('0x56')]=function(_0x287610,_0x5623dd,_0x4ebb58){if(_0x287610[_0xd6dd('0x57')]&&_0x287610['file'][_0xd6dd('0x58')]){_0x287610[_0xd6dd('0x55')][_0xd6dd('0x59')]=_0x287610['file'][_0xd6dd('0x58')];}return db[_0xd6dd('0x3a')][_0xd6dd('0x54')]({'where':{'id':_0x287610[_0xd6dd('0x52')]['id']}})[_0xd6dd('0x1d')](handleEntityNotFound(_0x5623dd,null))[_0xd6dd('0x1d')](saveUpdates(_0x287610[_0xd6dd('0x55')],null))[_0xd6dd('0x1d')](respondWithResult(_0x5623dd,null))[_0xd6dd('0x51')](handleError(_0x5623dd,null));};exports[_0xd6dd('0x5a')]=function(_0x51b96b,_0x37ff51,_0x1e6ba0){if(_0x51b96b[_0xd6dd('0x57')]&&_0x51b96b[_0xd6dd('0x57')]['filename']){_0x51b96b['body'][_0xd6dd('0x5b')]=_0x51b96b['file'][_0xd6dd('0x58')];}return db['Setting']['find']({'where':{'id':_0x51b96b[_0xd6dd('0x52')]['id']}})[_0xd6dd('0x1d')](handleEntityNotFound(_0x37ff51,null))[_0xd6dd('0x1d')](saveUpdates(_0x51b96b[_0xd6dd('0x55')],null))['then'](respondWithResult(_0x37ff51,null))['catch'](handleError(_0x37ff51,null));};var utilLicense=require(_0xd6dd('0x18'));exports['getLogo']=function(_0x54abb3,_0x54bafe,_0x5bca41){var _0x265fef=_0xd6dd('0x5c');var _0x2e19c6={'custom':![]};return utilLicense[_0xd6dd('0x5d')]()[_0xd6dd('0x1d')](function(_0x25eca3){if(_0x25eca3){_0x2e19c6=_0x25eca3;}return db['Setting'][_0xd6dd('0x54')]({'where':{'id':_0x54abb3[_0xd6dd('0x52')]['id']},'attributes':[_0xd6dd('0x59'),_0xd6dd('0x5b'),'preferred',_0xd6dd('0x5e'),_0xd6dd('0x5f'),_0xd6dd('0x60'),_0xd6dd('0x61'),_0xd6dd('0x62')],'raw':!![]});})[_0xd6dd('0x1d')](handleEntityNotFound(_0x54bafe,null))[_0xd6dd('0x1d')](function(_0x40ad0f){if(_0x40ad0f){var _0x1103bc=_0x40ad0f[_0xd6dd('0x59')]&&fs['existsSync'](path['join'](config['root'],_0x265fef,_[_0xd6dd('0x63')](_0x40ad0f[_0xd6dd('0x59')])))?path['join'](config[_0xd6dd('0x64')],_0x265fef,_[_0xd6dd('0x63')](_0x40ad0f['logo'])):path[_0xd6dd('0x65')](config[_0xd6dd('0x64')],_0x265fef,_[_0xd6dd('0x63')](_0xd6dd('0x66')));var _0x2b1b4e='default'+_[_0xd6dd('0x67')](_0xd6dd('0x59'));if(_0x40ad0f[_0x2b1b4e]||!_0x2e19c6[_0xd6dd('0x68')]){_0x1103bc=path[_0xd6dd('0x65')](config[_0xd6dd('0x64')],_0x265fef,_['toLower'](_0xd6dd('0x66')));}if(!fs['existsSync'](_0x1103bc)){throw new db[(_0xd6dd('0x69'))][(_0xd6dd('0x6a'))](_[_0xd6dd('0x67')](_0xd6dd('0x59'))+_0xd6dd('0x6b'));}return _0x54bafe[_0xd6dd('0x6c')](_0x1103bc);}})[_0xd6dd('0x51')](handleError(_0x54bafe,null));};var utilLicense=require(_0xd6dd('0x18'));exports[_0xd6dd('0x6d')]=function(_0xbca4b3,_0xb8bfe6,_0x527b1b){var _0x5b2d42=_0xd6dd('0x5c');var _0x3282ee={'custom':![]};return utilLicense['getLicense']()[_0xd6dd('0x1d')](function(_0xf82af0){if(_0xf82af0){_0x3282ee=_0xf82af0;}return db['Setting'][_0xd6dd('0x54')]({'where':{'id':_0xbca4b3[_0xd6dd('0x52')]['id']},'attributes':[_0xd6dd('0x59'),_0xd6dd('0x5b'),'preferred',_0xd6dd('0x5e'),_0xd6dd('0x5f'),_0xd6dd('0x60'),_0xd6dd('0x61'),_0xd6dd('0x62')],'raw':!![]});})[_0xd6dd('0x1d')](handleEntityNotFound(_0xb8bfe6,null))[_0xd6dd('0x1d')](function(_0x5e6ab7){if(_0x5e6ab7){var _0x40b30b=_0x5e6ab7[_0xd6dd('0x5b')]&&fs[_0xd6dd('0x6e')](path[_0xd6dd('0x65')](config['root'],_0x5b2d42,_[_0xd6dd('0x63')](_0x5e6ab7[_0xd6dd('0x5b')])))?path[_0xd6dd('0x65')](config[_0xd6dd('0x64')],_0x5b2d42,_['toLower'](_0x5e6ab7[_0xd6dd('0x5b')])):path[_0xd6dd('0x65')](config[_0xd6dd('0x64')],_0x5b2d42,_['toLower'](_0xd6dd('0x6f')));var _0x47289f=_0xd6dd('0x70')+_[_0xd6dd('0x67')]('loginLogo');if(_0x5e6ab7[_0x47289f]||!_0x3282ee[_0xd6dd('0x68')]){_0x40b30b=path[_0xd6dd('0x65')](config['root'],_0x5b2d42,_[_0xd6dd('0x63')](_0xd6dd('0x6f')));}if(!fs['existsSync'](_0x40b30b)){throw new db[(_0xd6dd('0x69'))][(_0xd6dd('0x6a'))](_[_0xd6dd('0x67')](_0xd6dd('0x5b'))+_0xd6dd('0x6b'));}return _0xb8bfe6[_0xd6dd('0x6c')](_0x40b30b);}})[_0xd6dd('0x51')](handleError(_0xb8bfe6,null));};exports['gdpr']=function(_0x4e9562,_0x3cd9e9){return db[_0xd6dd('0x3a')][_0xd6dd('0x54')]({'where':{'id':_0x4e9562[_0xd6dd('0x52')]['id']},'attributes':[_0xd6dd('0x71')]})['then'](respondWithResult(_0x3cd9e9,null))[_0xd6dd('0x51')](handleError(_0x3cd9e9,null));};exports[_0xd6dd('0x72')]=function(_0x3acf65,_0x985f41,_0x44bdd0){if(_0x3acf65['file']&&_0x3acf65[_0xd6dd('0x57')][_0xd6dd('0x58')]){_0x3acf65[_0xd6dd('0x55')][_0xd6dd('0x73')]=_0x3acf65['file'][_0xd6dd('0x58')];}return db[_0xd6dd('0x3a')][_0xd6dd('0x54')]({'where':{'id':_0x3acf65[_0xd6dd('0x52')]['id']}})[_0xd6dd('0x1d')](handleEntityNotFound(_0x985f41,null))[_0xd6dd('0x1d')](saveUpdates(_0x3acf65[_0xd6dd('0x55')],null))[_0xd6dd('0x1d')](respondWithResult(_0x985f41,null))[_0xd6dd('0x51')](handleError(_0x985f41,null));};var utilLicense=require(_0xd6dd('0x18'));exports['getPreferred']=function(_0x9eea8,_0x42ad31,_0x169e7c){var _0x3167b4=_0xd6dd('0x5c');var _0x543411={'custom':![]};return utilLicense[_0xd6dd('0x5d')]()[_0xd6dd('0x1d')](function(_0x108690){if(_0x108690){_0x543411=_0x108690;}return db[_0xd6dd('0x3a')][_0xd6dd('0x54')]({'where':{'id':_0x9eea8['params']['id']},'attributes':['logo','loginLogo','preferred',_0xd6dd('0x5e'),_0xd6dd('0x5f'),'defaultLoginLogo',_0xd6dd('0x61'),'defaultFavicon'],'raw':!![]});})[_0xd6dd('0x1d')](handleEntityNotFound(_0x42ad31,null))[_0xd6dd('0x1d')](function(_0x5e376b){if(_0x5e376b){var _0x2abb0b=_0x5e376b[_0xd6dd('0x73')]&&fs[_0xd6dd('0x6e')](path[_0xd6dd('0x65')](config[_0xd6dd('0x64')],_0x3167b4,_[_0xd6dd('0x63')](_0x5e376b[_0xd6dd('0x73')])))?path[_0xd6dd('0x65')](config[_0xd6dd('0x64')],_0x3167b4,_['toLower'](_0x5e376b[_0xd6dd('0x73')])):path[_0xd6dd('0x65')](config[_0xd6dd('0x64')],_0x3167b4,_[_0xd6dd('0x63')](_0xd6dd('0x74')));var _0x3f907b='default'+_[_0xd6dd('0x67')](_0xd6dd('0x73'));if(_0x5e376b[_0x3f907b]||!_0x543411[_0xd6dd('0x68')]||!_0x543411[_0xd6dd('0x73')]){_0x2abb0b=path[_0xd6dd('0x65')](config[_0xd6dd('0x64')],_0x3167b4,_['toLower']('default_preferred.png'));}if(!fs[_0xd6dd('0x6e')](_0x2abb0b)){throw new db[(_0xd6dd('0x69'))][(_0xd6dd('0x6a'))](_[_0xd6dd('0x67')](_0xd6dd('0x73'))+_0xd6dd('0x6b'));}return _0x42ad31[_0xd6dd('0x6c')](_0x2abb0b);}})['catch'](handleError(_0x42ad31,null));};exports[_0xd6dd('0x75')]=function(_0xff18bd,_0x3d4448,_0x1d781d){if(_0xff18bd['file']&&_0xff18bd[_0xd6dd('0x57')]['filename']){_0xff18bd[_0xd6dd('0x55')]['favicon']=_0xff18bd[_0xd6dd('0x57')]['filename'];}return db['Setting']['find']({'where':{'id':_0xff18bd[_0xd6dd('0x52')]['id']}})[_0xd6dd('0x1d')](handleEntityNotFound(_0x3d4448,null))[_0xd6dd('0x1d')](saveUpdates(_0xff18bd[_0xd6dd('0x55')],null))[_0xd6dd('0x1d')](respondWithResult(_0x3d4448,null))['catch'](handleError(_0x3d4448,null));};var utilLicense=require(_0xd6dd('0x18'));exports[_0xd6dd('0x76')]=function(_0x897466,_0x169550,_0x33029f){var _0x4701ea=_0xd6dd('0x5c');var _0x542a7d={'custom':![]};return utilLicense['getLicense']()[_0xd6dd('0x1d')](function(_0x17cc70){if(_0x17cc70){_0x542a7d=_0x17cc70;}return db['Setting'][_0xd6dd('0x54')]({'where':{'id':_0x897466[_0xd6dd('0x52')]['id']},'attributes':[_0xd6dd('0x59'),_0xd6dd('0x5b'),'preferred',_0xd6dd('0x5e'),_0xd6dd('0x5f'),_0xd6dd('0x60'),_0xd6dd('0x61'),_0xd6dd('0x62')],'raw':!![]});})[_0xd6dd('0x1d')](handleEntityNotFound(_0x169550,null))['then'](function(_0x1e60b1){if(_0x1e60b1){var _0x38b0e0=_0x1e60b1[_0xd6dd('0x5e')]&&fs[_0xd6dd('0x6e')](path[_0xd6dd('0x65')](config[_0xd6dd('0x64')],_0x4701ea,_[_0xd6dd('0x63')](_0x1e60b1['favicon'])))?path[_0xd6dd('0x65')](config[_0xd6dd('0x64')],_0x4701ea,_['toLower'](_0x1e60b1[_0xd6dd('0x5e')])):path['join'](config[_0xd6dd('0x64')],_0x4701ea,_[_0xd6dd('0x63')](_0xd6dd('0x77')));var _0x33adbb=_0xd6dd('0x70')+_[_0xd6dd('0x67')]('favicon');if(_0x1e60b1[_0x33adbb]||!_0x542a7d[_0xd6dd('0x68')]){_0x38b0e0=path[_0xd6dd('0x65')](config['root'],_0x4701ea,_['toLower'](_0xd6dd('0x77')));}if(!fs[_0xd6dd('0x6e')](_0x38b0e0)){throw new db[(_0xd6dd('0x69'))][(_0xd6dd('0x6a'))](_[_0xd6dd('0x67')]('favicon')+_0xd6dd('0x6b'));}return _0x169550[_0xd6dd('0x6c')](_0x38b0e0);}})[_0xd6dd('0x51')](handleError(_0x169550,null));};exports[_0xd6dd('0x78')]=function(_0x599213,_0x581635){var _0x5a5d2c={'offset':moment()['utcOffset']()};_0x5a5d2c[_0xd6dd('0x79')]=moment()[_0xd6dd('0x7a')](_0x5a5d2c[_0xd6dd('0x2a')])[_0xd6dd('0x7b')]('YYYY-MM-DD\x20HH:mm:ss:SSS');return _0x581635[_0xd6dd('0x2e')](0xc8)[_0xd6dd('0x38')](_0x5a5d2c);}; \ No newline at end of file +var _0xd730=['addPreferred','getPreferred','default_preferred.png','default_favicon.ico','getDate','utcOffset','now','format','YYYY-MM-DD\x20HH:mm:ss:SSS','rimraf','fast-json-patch','moment','mustache','util','path','sox','ejs','fs-extra','squel','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','request\x20sent','debug','error','Setting,\x20%s,\x20%s','message','result','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','map','Setting','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','rows','catch','show','params','options','find','body','addLogo','filename','logo','file','addLogoLogin','getLogo','server/files/images/logos','getLicense','preferred','favicon','defaultLoginLogo','defaultPreferred','defaultFavicon','existsSync','join','root','toLower','default_logo.svg','upperFirst','custom','Sequelize','ValidationError','download','getLogoLogin','loginLogo','defaultLogo','default_loginLogo.svg','default','\x20not\x20found','securePassword'];(function(_0x5a776b,_0x46f785){var _0xbbef59=function(_0x38313e){while(--_0x38313e){_0x5a776b['push'](_0x5a776b['shift']());}};_0xbbef59(++_0x46f785);}(_0xd730,0xfd));var _0x0d73=function(_0xafca90,_0x262b8b){_0xafca90=_0xafca90-0x0;var _0x4d45b7=_0xd730[_0xafca90];return _0x4d45b7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0d73('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0d73('0x1'));var rp=require('request-promise');var moment=require(_0x0d73('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x0d73('0x3'));var util=require(_0x0d73('0x4'));var path=require(_0x0d73('0x5'));var sox=require(_0x0d73('0x6'));var csv=require('to-csv');var ejs=require(_0x0d73('0x7'));var fs=require('fs');var fs_extra=require(_0x0d73('0x8'));var _=require('lodash');var squel=require(_0x0d73('0x9'));var crypto=require('crypto');var jsforce=require(_0x0d73('0xa'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x0d73('0xb'));var Papa=require('papaparse');var Redis=require(_0x0d73('0xc'));var authService=require(_0x0d73('0xd'));var qs=require(_0x0d73('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0d73('0xf'));var logger=require('../../config/logger')(_0x0d73('0x10'));var utils=require(_0x0d73('0x11'));var config=require(_0x0d73('0x12'));var licenseUtil=require(_0x0d73('0x13'));var db=require(_0x0d73('0x14'))['db'];var jayson=require(_0x0d73('0x15'));var client=jayson[_0x0d73('0x16')][_0x0d73('0x17')]({'port':0x232a});function respondWithRpcPromise(_0xe31c4f,_0xf92b61,_0x3daa14,_0x185457){return new BPromise(function(_0xea0953,_0x4d3b4c){var _0x454dd7=_0x185457||client;return _0x454dd7[_0x0d73('0x18')](_0xe31c4f,_0x3daa14)[_0x0d73('0x19')](function(_0x2d2288){logger[_0x0d73('0x1a')]('Setting,\x20%s,\x20%s',_0xf92b61,_0x0d73('0x1b'));logger[_0x0d73('0x1c')]('Setting,\x20%s,\x20%s,\x20%s',_0xf92b61,'request\x20sent',JSON['stringify'](_0x2d2288));if(_0x2d2288[_0x0d73('0x1d')]){if(_0x2d2288[_0x0d73('0x1d')]['code']===0x1f4){logger['error'](_0x0d73('0x1e'),_0xf92b61,_0x2d2288[_0x0d73('0x1d')][_0x0d73('0x1f')]);return _0x4d3b4c(_0x2d2288[_0x0d73('0x1d')][_0x0d73('0x1f')]);}logger[_0x0d73('0x1d')]('Setting,\x20%s,\x20%s',_0xf92b61,_0x2d2288[_0x0d73('0x1d')][_0x0d73('0x1f')]);return _0xea0953(_0x2d2288['error']['message']);}else{logger[_0x0d73('0x1a')](_0x0d73('0x1e'),_0xf92b61,_0x0d73('0x1b'));_0xea0953(_0x2d2288[_0x0d73('0x20')][_0x0d73('0x1f')]);}})['catch'](function(_0x145290){logger[_0x0d73('0x1d')](_0x0d73('0x1e'),_0xf92b61,_0x145290);_0x4d3b4c(_0x145290);});});}function respondWithStatusCode(_0x1d1d0d,_0x3840f6){_0x3840f6=_0x3840f6||0xcc;return function(_0x1d37dd){if(_0x1d37dd){return _0x1d1d0d[_0x0d73('0x21')](_0x3840f6);}return _0x1d1d0d[_0x0d73('0x22')](_0x3840f6)['end']();};}function respondWithResult(_0x197696,_0x18fcac){_0x18fcac=_0x18fcac||0xc8;return function(_0x4f0788){if(_0x4f0788){return _0x197696['status'](_0x18fcac)[_0x0d73('0x23')](_0x4f0788);}};}function respondWithFilteredResult(_0x446edb,_0x119dab){return function(_0xf66c26){if(_0xf66c26){var _0x1dd83c=typeof _0x119dab[_0x0d73('0x24')]===_0x0d73('0x25')&&typeof _0x119dab['limit']==='undefined';var _0x190a82=_0xf66c26[_0x0d73('0x26')];var _0x5513d6=_0x1dd83c?0x0:_0x119dab['offset'];var _0x27ccf7=_0x1dd83c?_0xf66c26[_0x0d73('0x26')]:_0x119dab[_0x0d73('0x24')]+_0x119dab[_0x0d73('0x27')];var _0x567687;if(_0x27ccf7>=_0x190a82){_0x27ccf7=_0x190a82;_0x567687=0xc8;}else{_0x567687=0xce;}_0x446edb[_0x0d73('0x22')](_0x567687);return _0x446edb[_0x0d73('0x28')](_0x0d73('0x29'),_0x5513d6+'-'+_0x27ccf7+'/'+_0x190a82)[_0x0d73('0x23')](_0xf66c26);}return null;};}function patchUpdates(_0x137f15){return function(_0x3d7708){try{jsonpatch[_0x0d73('0x2a')](_0x3d7708,_0x137f15,!![]);}catch(_0x5025d0){return BPromise[_0x0d73('0x2b')](_0x5025d0);}return _0x3d7708[_0x0d73('0x2c')]();};}function saveUpdates(_0x5d0748,_0x4926f0){return function(_0x2c8751){if(_0x2c8751){return _0x2c8751[_0x0d73('0x2d')](_0x5d0748)[_0x0d73('0x19')](function(_0x4fef02){return _0x4fef02;});}return null;};}function removeEntity(_0x3761e5,_0x2335ac){return function(_0xd3cc9b){if(_0xd3cc9b){return _0xd3cc9b[_0x0d73('0x2e')]()[_0x0d73('0x19')](function(){_0x3761e5[_0x0d73('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x35e4a4,_0x346bb7){return function(_0x416fc5){if(!_0x416fc5){_0x35e4a4[_0x0d73('0x21')](0x194);}return _0x416fc5;};}function handleError(_0x54a5dd,_0x34c301){_0x34c301=_0x34c301||0x1f4;return function(_0x3778d3){logger[_0x0d73('0x1d')](_0x3778d3[_0x0d73('0x2f')]);if(_0x3778d3[_0x0d73('0x30')]){delete _0x3778d3[_0x0d73('0x30')];}_0x54a5dd[_0x0d73('0x22')](_0x34c301)[_0x0d73('0x31')](_0x3778d3);};}exports[_0x0d73('0x32')]=function(_0x5d9eb6,_0x3a6190){var _0x521d1e={},_0x548d5e={},_0x25ab7b={'count':0x0,'rows':[]};var _0xdcf4ad=_[_0x0d73('0x33')](db[_0x0d73('0x34')][_0x0d73('0x35')],function(_0x551b3e){return{'name':_0x551b3e[_0x0d73('0x36')],'type':_0x551b3e[_0x0d73('0x37')][_0x0d73('0x38')]};});_0x548d5e[_0x0d73('0x39')]=_[_0x0d73('0x33')](_0xdcf4ad,_0x0d73('0x30'));_0x548d5e[_0x0d73('0x3a')]=_[_0x0d73('0x3b')](_0x5d9eb6[_0x0d73('0x3a')]);_0x548d5e[_0x0d73('0x3c')]=_['intersection'](_0x548d5e[_0x0d73('0x39')],_0x548d5e[_0x0d73('0x3a')]);_0x521d1e[_0x0d73('0x3d')]=_[_0x0d73('0x3e')](_0x548d5e[_0x0d73('0x39')],qs[_0x0d73('0x3f')](_0x5d9eb6[_0x0d73('0x3a')][_0x0d73('0x3f')]));_0x521d1e[_0x0d73('0x3d')]=_0x521d1e[_0x0d73('0x3d')][_0x0d73('0x40')]?_0x521d1e[_0x0d73('0x3d')]:_0x548d5e[_0x0d73('0x39')];if(!_0x5d9eb6[_0x0d73('0x3a')][_0x0d73('0x41')](_0x0d73('0x42'))){_0x521d1e['limit']=qs[_0x0d73('0x27')](_0x5d9eb6[_0x0d73('0x3a')][_0x0d73('0x27')]);_0x521d1e['offset']=qs[_0x0d73('0x24')](_0x5d9eb6[_0x0d73('0x3a')]['offset']);}_0x521d1e[_0x0d73('0x43')]=qs[_0x0d73('0x44')](_0x5d9eb6[_0x0d73('0x3a')][_0x0d73('0x44')]);_0x521d1e[_0x0d73('0x45')]=qs[_0x0d73('0x3c')](_[_0x0d73('0x46')](_0x5d9eb6[_0x0d73('0x3a')],_0x548d5e[_0x0d73('0x3c')]),_0xdcf4ad);if(_0x5d9eb6['query'][_0x0d73('0x47')]){_0x521d1e[_0x0d73('0x45')]=_['merge'](_0x521d1e[_0x0d73('0x45')],{'$or':_[_0x0d73('0x33')](_0xdcf4ad,function(_0xb063e4){if(_0xb063e4[_0x0d73('0x37')]!==_0x0d73('0x48')){var _0x3eb588={};_0x3eb588[_0xb063e4[_0x0d73('0x30')]]={'$like':'%'+_0x5d9eb6['query'][_0x0d73('0x47')]+'%'};return _0x3eb588;}})});}_0x521d1e=_[_0x0d73('0x49')]({},_0x521d1e,_0x5d9eb6['options']);var _0x503825={'where':_0x521d1e[_0x0d73('0x45')]};return db['Setting'][_0x0d73('0x26')](_0x503825)[_0x0d73('0x19')](function(_0x14b035){_0x25ab7b[_0x0d73('0x26')]=_0x14b035;if(_0x5d9eb6[_0x0d73('0x3a')][_0x0d73('0x4a')]){_0x521d1e[_0x0d73('0x4b')]=[{'all':!![]}];}return db[_0x0d73('0x34')]['findAll'](_0x521d1e);})[_0x0d73('0x19')](function(_0x2c74e3){_0x25ab7b[_0x0d73('0x4c')]=_0x2c74e3;return _0x25ab7b;})['then'](respondWithFilteredResult(_0x3a6190,_0x521d1e))[_0x0d73('0x4d')](handleError(_0x3a6190,null));};exports[_0x0d73('0x4e')]=function(_0x41627f,_0x1ba945){var _0x175ca8={'raw':![],'where':{'id':_0x41627f[_0x0d73('0x4f')]['id']}},_0x4d6d1e={};_0x4d6d1e[_0x0d73('0x39')]=_[_0x0d73('0x3b')](db[_0x0d73('0x34')][_0x0d73('0x35')]);_0x4d6d1e[_0x0d73('0x3a')]=_['keys'](_0x41627f[_0x0d73('0x3a')]);_0x4d6d1e['filters']=_[_0x0d73('0x3e')](_0x4d6d1e[_0x0d73('0x39')],_0x4d6d1e[_0x0d73('0x3a')]);_0x175ca8[_0x0d73('0x3d')]=_[_0x0d73('0x3e')](_0x4d6d1e[_0x0d73('0x39')],qs[_0x0d73('0x3f')](_0x41627f[_0x0d73('0x3a')][_0x0d73('0x3f')]));_0x175ca8[_0x0d73('0x3d')]=_0x175ca8[_0x0d73('0x3d')]['length']?_0x175ca8['attributes']:_0x4d6d1e[_0x0d73('0x39')];if(_0x41627f['query'][_0x0d73('0x4a')]){_0x175ca8[_0x0d73('0x4b')]=[{'all':!![]}];}_0x175ca8=_[_0x0d73('0x49')]({},_0x175ca8,_0x41627f[_0x0d73('0x50')]);return db[_0x0d73('0x34')][_0x0d73('0x51')](_0x175ca8)[_0x0d73('0x19')](handleEntityNotFound(_0x1ba945,null))[_0x0d73('0x19')](respondWithResult(_0x1ba945,null))[_0x0d73('0x4d')](handleError(_0x1ba945,null));};exports[_0x0d73('0x2d')]=function(_0x2d7ee1,_0x2930df){if(_0x2d7ee1[_0x0d73('0x52')]['id']){delete _0x2d7ee1[_0x0d73('0x52')]['id'];}return db[_0x0d73('0x34')][_0x0d73('0x51')]({'where':{'id':_0x2d7ee1[_0x0d73('0x4f')]['id']}})[_0x0d73('0x19')](handleEntityNotFound(_0x2930df,null))['then'](saveUpdates(_0x2d7ee1['body'],null))[_0x0d73('0x19')](respondWithResult(_0x2930df,null))['catch'](handleError(_0x2930df,null));};exports[_0x0d73('0x53')]=function(_0x134173,_0x47937c,_0x5670f6){if(_0x134173['file']&&_0x134173['file'][_0x0d73('0x54')]){_0x134173[_0x0d73('0x52')][_0x0d73('0x55')]=_0x134173[_0x0d73('0x56')][_0x0d73('0x54')];}return db[_0x0d73('0x34')][_0x0d73('0x51')]({'where':{'id':_0x134173['params']['id']}})[_0x0d73('0x19')](handleEntityNotFound(_0x47937c,null))[_0x0d73('0x19')](saveUpdates(_0x134173[_0x0d73('0x52')],null))['then'](respondWithResult(_0x47937c,null))['catch'](handleError(_0x47937c,null));};exports[_0x0d73('0x57')]=function(_0x2c44b9,_0x2e6f39,_0xb0d992){if(_0x2c44b9[_0x0d73('0x56')]&&_0x2c44b9[_0x0d73('0x56')][_0x0d73('0x54')]){_0x2c44b9[_0x0d73('0x52')]['loginLogo']=_0x2c44b9['file'][_0x0d73('0x54')];}return db['Setting']['find']({'where':{'id':_0x2c44b9[_0x0d73('0x4f')]['id']}})[_0x0d73('0x19')](handleEntityNotFound(_0x2e6f39,null))['then'](saveUpdates(_0x2c44b9[_0x0d73('0x52')],null))[_0x0d73('0x19')](respondWithResult(_0x2e6f39,null))[_0x0d73('0x4d')](handleError(_0x2e6f39,null));};var utilLicense=require(_0x0d73('0x13'));exports[_0x0d73('0x58')]=function(_0x16f179,_0x4a50fb,_0x4d62b9){var _0x40e752=_0x0d73('0x59');var _0x2fa6ea={'custom':![]};return utilLicense[_0x0d73('0x5a')]()[_0x0d73('0x19')](function(_0x17a05e){if(_0x17a05e){_0x2fa6ea=_0x17a05e;}return db['Setting'][_0x0d73('0x51')]({'where':{'id':_0x16f179[_0x0d73('0x4f')]['id']},'attributes':[_0x0d73('0x55'),'loginLogo',_0x0d73('0x5b'),_0x0d73('0x5c'),'defaultLogo',_0x0d73('0x5d'),_0x0d73('0x5e'),_0x0d73('0x5f')],'raw':!![]});})[_0x0d73('0x19')](handleEntityNotFound(_0x4a50fb,null))[_0x0d73('0x19')](function(_0x561976){if(_0x561976){var _0xa028dc=_0x561976[_0x0d73('0x55')]&&fs[_0x0d73('0x60')](path[_0x0d73('0x61')](config[_0x0d73('0x62')],_0x40e752,_[_0x0d73('0x63')](_0x561976[_0x0d73('0x55')])))?path['join'](config[_0x0d73('0x62')],_0x40e752,_['toLower'](_0x561976[_0x0d73('0x55')])):path[_0x0d73('0x61')](config[_0x0d73('0x62')],_0x40e752,_[_0x0d73('0x63')](_0x0d73('0x64')));var _0x2627e8='default'+_[_0x0d73('0x65')]('logo');if(_0x561976[_0x2627e8]||!_0x2fa6ea[_0x0d73('0x66')]){_0xa028dc=path[_0x0d73('0x61')](config[_0x0d73('0x62')],_0x40e752,_[_0x0d73('0x63')](_0x0d73('0x64')));}if(!fs['existsSync'](_0xa028dc)){throw new db[(_0x0d73('0x67'))][(_0x0d73('0x68'))](_[_0x0d73('0x65')]('logo')+'\x20not\x20found');}return _0x4a50fb[_0x0d73('0x69')](_0xa028dc);}})[_0x0d73('0x4d')](handleError(_0x4a50fb,null));};var utilLicense=require(_0x0d73('0x13'));exports[_0x0d73('0x6a')]=function(_0x4b48d2,_0x50b981,_0x56dacf){var _0x4ddebf='server/files/images/logos';var _0x325b4c={'custom':![]};return utilLicense[_0x0d73('0x5a')]()[_0x0d73('0x19')](function(_0x5a9bcd){if(_0x5a9bcd){_0x325b4c=_0x5a9bcd;}return db[_0x0d73('0x34')][_0x0d73('0x51')]({'where':{'id':_0x4b48d2[_0x0d73('0x4f')]['id']},'attributes':[_0x0d73('0x55'),_0x0d73('0x6b'),_0x0d73('0x5b'),_0x0d73('0x5c'),_0x0d73('0x6c'),_0x0d73('0x5d'),_0x0d73('0x5e'),_0x0d73('0x5f')],'raw':!![]});})[_0x0d73('0x19')](handleEntityNotFound(_0x50b981,null))['then'](function(_0x25299a){if(_0x25299a){var _0x1cf691=_0x25299a[_0x0d73('0x6b')]&&fs[_0x0d73('0x60')](path[_0x0d73('0x61')](config[_0x0d73('0x62')],_0x4ddebf,_[_0x0d73('0x63')](_0x25299a[_0x0d73('0x6b')])))?path[_0x0d73('0x61')](config[_0x0d73('0x62')],_0x4ddebf,_[_0x0d73('0x63')](_0x25299a[_0x0d73('0x6b')])):path[_0x0d73('0x61')](config[_0x0d73('0x62')],_0x4ddebf,_[_0x0d73('0x63')](_0x0d73('0x6d')));var _0xf47905=_0x0d73('0x6e')+_[_0x0d73('0x65')](_0x0d73('0x6b'));if(_0x25299a[_0xf47905]||!_0x325b4c['custom']){_0x1cf691=path[_0x0d73('0x61')](config['root'],_0x4ddebf,_[_0x0d73('0x63')](_0x0d73('0x6d')));}if(!fs[_0x0d73('0x60')](_0x1cf691)){throw new db['Sequelize'][(_0x0d73('0x68'))](_[_0x0d73('0x65')](_0x0d73('0x6b'))+_0x0d73('0x6f'));}return _0x50b981[_0x0d73('0x69')](_0x1cf691);}})[_0x0d73('0x4d')](handleError(_0x50b981,null));};exports['gdpr']=function(_0x3f075b,_0x22dbb6){return db[_0x0d73('0x34')][_0x0d73('0x51')]({'where':{'id':_0x3f075b[_0x0d73('0x4f')]['id']},'attributes':[_0x0d73('0x70')]})[_0x0d73('0x19')](respondWithResult(_0x22dbb6,null))['catch'](handleError(_0x22dbb6,null));};exports[_0x0d73('0x71')]=function(_0x3c4f44,_0x34b099,_0x14d1bc){if(_0x3c4f44[_0x0d73('0x56')]&&_0x3c4f44['file']['filename']){_0x3c4f44[_0x0d73('0x52')][_0x0d73('0x5b')]=_0x3c4f44[_0x0d73('0x56')][_0x0d73('0x54')];}return db[_0x0d73('0x34')][_0x0d73('0x51')]({'where':{'id':_0x3c4f44[_0x0d73('0x4f')]['id']}})[_0x0d73('0x19')](handleEntityNotFound(_0x34b099,null))[_0x0d73('0x19')](saveUpdates(_0x3c4f44['body'],null))[_0x0d73('0x19')](respondWithResult(_0x34b099,null))[_0x0d73('0x4d')](handleError(_0x34b099,null));};var utilLicense=require(_0x0d73('0x13'));exports[_0x0d73('0x72')]=function(_0x1a02de,_0x42e897,_0x1f72b5){var _0x53bb9b='server/files/images/logos';var _0x5dfe82={'custom':![]};return utilLicense[_0x0d73('0x5a')]()[_0x0d73('0x19')](function(_0x2854bc){if(_0x2854bc){_0x5dfe82=_0x2854bc;}return db['Setting'][_0x0d73('0x51')]({'where':{'id':_0x1a02de['params']['id']},'attributes':['logo',_0x0d73('0x6b'),_0x0d73('0x5b'),'favicon',_0x0d73('0x6c'),_0x0d73('0x5d'),'defaultPreferred','defaultFavicon'],'raw':!![]});})['then'](handleEntityNotFound(_0x42e897,null))[_0x0d73('0x19')](function(_0x362ab1){if(_0x362ab1){var _0x13070d=_0x362ab1['preferred']&&fs[_0x0d73('0x60')](path[_0x0d73('0x61')](config[_0x0d73('0x62')],_0x53bb9b,_['toLower'](_0x362ab1['preferred'])))?path['join'](config[_0x0d73('0x62')],_0x53bb9b,_[_0x0d73('0x63')](_0x362ab1[_0x0d73('0x5b')])):path[_0x0d73('0x61')](config['root'],_0x53bb9b,_[_0x0d73('0x63')](_0x0d73('0x73')));var _0x273b9f=_0x0d73('0x6e')+_['upperFirst'](_0x0d73('0x5b'));if(_0x362ab1[_0x273b9f]||!_0x5dfe82['custom']||!_0x5dfe82[_0x0d73('0x5b')]){_0x13070d=path[_0x0d73('0x61')](config['root'],_0x53bb9b,_[_0x0d73('0x63')](_0x0d73('0x73')));}if(!fs[_0x0d73('0x60')](_0x13070d)){throw new db[(_0x0d73('0x67'))][(_0x0d73('0x68'))](_[_0x0d73('0x65')](_0x0d73('0x5b'))+_0x0d73('0x6f'));}return _0x42e897[_0x0d73('0x69')](_0x13070d);}})[_0x0d73('0x4d')](handleError(_0x42e897,null));};exports['addFavicon']=function(_0x2d836,_0x294bc3,_0x1060cf){if(_0x2d836[_0x0d73('0x56')]&&_0x2d836[_0x0d73('0x56')][_0x0d73('0x54')]){_0x2d836[_0x0d73('0x52')][_0x0d73('0x5c')]=_0x2d836[_0x0d73('0x56')][_0x0d73('0x54')];}return db[_0x0d73('0x34')]['find']({'where':{'id':_0x2d836[_0x0d73('0x4f')]['id']}})[_0x0d73('0x19')](handleEntityNotFound(_0x294bc3,null))[_0x0d73('0x19')](saveUpdates(_0x2d836['body'],null))['then'](respondWithResult(_0x294bc3,null))[_0x0d73('0x4d')](handleError(_0x294bc3,null));};var utilLicense=require('../../config/license/util');exports['getFavicon']=function(_0x1b8158,_0x4eb4a9,_0x156a5d){var _0x6814fc=_0x0d73('0x59');var _0x561433={'custom':![]};return utilLicense[_0x0d73('0x5a')]()[_0x0d73('0x19')](function(_0x329356){if(_0x329356){_0x561433=_0x329356;}return db['Setting']['find']({'where':{'id':_0x1b8158[_0x0d73('0x4f')]['id']},'attributes':[_0x0d73('0x55'),_0x0d73('0x6b'),_0x0d73('0x5b'),_0x0d73('0x5c'),_0x0d73('0x6c'),_0x0d73('0x5d'),_0x0d73('0x5e'),'defaultFavicon'],'raw':!![]});})['then'](handleEntityNotFound(_0x4eb4a9,null))[_0x0d73('0x19')](function(_0xda35f1){if(_0xda35f1){var _0x2fc5e0=_0xda35f1[_0x0d73('0x5c')]&&fs[_0x0d73('0x60')](path[_0x0d73('0x61')](config[_0x0d73('0x62')],_0x6814fc,_['toLower'](_0xda35f1[_0x0d73('0x5c')])))?path[_0x0d73('0x61')](config[_0x0d73('0x62')],_0x6814fc,_[_0x0d73('0x63')](_0xda35f1[_0x0d73('0x5c')])):path[_0x0d73('0x61')](config[_0x0d73('0x62')],_0x6814fc,_[_0x0d73('0x63')](_0x0d73('0x74')));var _0x4dfb8e=_0x0d73('0x6e')+_[_0x0d73('0x65')]('favicon');if(_0xda35f1[_0x4dfb8e]||!_0x561433[_0x0d73('0x66')]){_0x2fc5e0=path[_0x0d73('0x61')](config[_0x0d73('0x62')],_0x6814fc,_[_0x0d73('0x63')](_0x0d73('0x74')));}if(!fs['existsSync'](_0x2fc5e0)){throw new db[(_0x0d73('0x67'))][(_0x0d73('0x68'))](_[_0x0d73('0x65')](_0x0d73('0x5c'))+_0x0d73('0x6f'));}return _0x4eb4a9['download'](_0x2fc5e0);}})[_0x0d73('0x4d')](handleError(_0x4eb4a9,null));};exports[_0x0d73('0x75')]=function(_0x30989f,_0x2f57e1){var _0x34fe91={'offset':moment()[_0x0d73('0x76')]()};_0x34fe91[_0x0d73('0x77')]=moment()[_0x0d73('0x76')](_0x34fe91['offset'])[_0x0d73('0x78')](_0x0d73('0x79'));return _0x2f57e1['status'](0xc8)[_0x0d73('0x31')](_0x34fe91);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index 4586922..0b410de 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(_0x3d2d6f,_0x368872){var _0x5c0022=function(_0x408819){while(--_0x408819){_0x3d2d6f['push'](_0x3d2d6f['shift']());}};_0x5c0022(++_0x368872);}(_0x7217,0x19e));var _0x7721=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0x7217[_0x3635ce];return _0x97ecd0;};'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 _0x7217=['../../config/environment','./setting.attributes','exports','define','Setting','settings','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x19aa84,_0x549537){var _0x536146=function(_0x5da480){while(--_0x5da480){_0x19aa84['push'](_0x19aa84['shift']());}};_0x536146(++_0x549537);}(_0x7217,0x19e));var _0x7721=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0x7217[_0x521929];return _0x632436;};'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 diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index f3ee209..51163d0 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 _0x35d6=['then','info','request\x20sent','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Setting,\x20%s,\x20%s','result','catch','ShowSetting','find','options','raw','where','attributes','include','map','model','debug','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x30f797,_0x3ed32b){var _0x49723c=function(_0x10bdca){while(--_0x10bdca){_0x30f797['push'](_0x30f797['shift']());}};_0x49723c(++_0x3ed32b);}(_0x35d6,0x1e3));var _0x635d=function(_0x33416c,_0x475f62){_0x33416c=_0x33416c-0x0;var _0x52d193=_0x35d6[_0x33416c];return _0x52d193;};'use strict';var _=require('lodash');var util=require(_0x635d('0x0'));var moment=require(_0x635d('0x1'));var BPromise=require(_0x635d('0x2'));var rs=require(_0x635d('0x3'));var fs=require('fs');var Redis=require(_0x635d('0x4'));var db=require(_0x635d('0x5'))['db'];var utils=require(_0x635d('0x6'));var logger=require(_0x635d('0x7'))(_0x635d('0x8'));var config=require(_0x635d('0x9'));var jayson=require(_0x635d('0xa'));var client=jayson[_0x635d('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x242ae5,_0x2de7e3,_0x48f9ad){return new BPromise(function(_0x3cfcd3,_0x320b5f){return client['request'](_0x242ae5,_0x48f9ad)[_0x635d('0xc')](function(_0x390fd8){logger[_0x635d('0xd')]('Setting,\x20%s,\x20%s',_0x2de7e3,_0x635d('0xe'));logger['debug'](_0x635d('0xf'),_0x2de7e3,_0x635d('0xe'),JSON[_0x635d('0x10')](_0x390fd8));if(_0x390fd8[_0x635d('0x11')]){if(_0x390fd8[_0x635d('0x11')][_0x635d('0x12')]===0x1f4){logger[_0x635d('0x11')]('Setting,\x20%s,\x20%s',_0x2de7e3,_0x390fd8[_0x635d('0x11')][_0x635d('0x13')]);return _0x320b5f(_0x390fd8[_0x635d('0x11')][_0x635d('0x13')]);}logger[_0x635d('0x11')](_0x635d('0x14'),_0x2de7e3,_0x390fd8[_0x635d('0x11')][_0x635d('0x13')]);return _0x3cfcd3(_0x390fd8[_0x635d('0x11')][_0x635d('0x13')]);}else{logger['info']('Setting,\x20%s,\x20%s',_0x2de7e3,'request\x20sent');_0x3cfcd3(_0x390fd8[_0x635d('0x15')][_0x635d('0x13')]);}})[_0x635d('0x16')](function(_0x287663){logger[_0x635d('0x11')](_0x635d('0x14'),_0x2de7e3,_0x287663);_0x320b5f(_0x287663);});});}exports[_0x635d('0x17')]=function(_0x29e7ee){var _0x47a8a4=this;return new Promise(function(_0x13ad33,_0x4692ba){return db['Setting'][_0x635d('0x18')]({'raw':_0x29e7ee[_0x635d('0x19')]?_0x29e7ee['options'][_0x635d('0x1a')]===undefined?!![]:![]:!![],'where':_0x29e7ee[_0x635d('0x19')]?_0x29e7ee[_0x635d('0x19')][_0x635d('0x1b')]||null:null,'attributes':_0x29e7ee[_0x635d('0x19')]?_0x29e7ee[_0x635d('0x19')][_0x635d('0x1c')]||null:null,'include':_0x29e7ee[_0x635d('0x19')]?_0x29e7ee['options'][_0x635d('0x1d')]?_[_0x635d('0x1e')](_0x29e7ee[_0x635d('0x19')][_0x635d('0x1d')],function(_0x1e2e6c){return{'model':db[_0x1e2e6c[_0x635d('0x1f')]],'as':_0x1e2e6c['as'],'attributes':_0x1e2e6c[_0x635d('0x1c')],'include':_0x1e2e6c[_0x635d('0x1d')]?_[_0x635d('0x1e')](_0x1e2e6c[_0x635d('0x1d')],function(_0x2c1233){return{'model':db[_0x2c1233[_0x635d('0x1f')]],'as':_0x2c1233['as'],'attributes':_0x2c1233[_0x635d('0x1c')],'include':_0x2c1233[_0x635d('0x1d')]?_['map'](_0x2c1233['include'],function(_0x1cd716){return{'model':db[_0x1cd716[_0x635d('0x1f')]],'as':_0x1cd716['as'],'attributes':_0x1cd716[_0x635d('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x658d1b){logger[_0x635d('0xd')](_0x635d('0x17'),_0x29e7ee);logger[_0x635d('0x20')](_0x635d('0x17'),_0x29e7ee,JSON[_0x635d('0x10')](_0x658d1b));_0x13ad33(_0x658d1b);})['catch'](function(_0x13e989){logger['error']('ShowSetting',_0x13e989[_0x635d('0x13')],_0x29e7ee);_0x4692ba(_0x47a8a4['error'](0x1f4,_0x13e989[_0x635d('0x13')]));});});}; \ No newline at end of file +var _0xbba3=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','Setting,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','ShowSetting','Setting','find','options','attributes','include','map','model','debug','lodash','util','moment','bluebird','../../mysqldb','../../config/utils'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xbba3,0x14f));var _0x3bba=function(_0xa16774,_0x5c1c7e){_0xa16774=_0xa16774-0x0;var _0x17f355=_0xbba3[_0xa16774];return _0x17f355;};'use strict';var _=require(_0x3bba('0x0'));var util=require(_0x3bba('0x1'));var moment=require(_0x3bba('0x2'));var BPromise=require(_0x3bba('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3bba('0x4'))['db'];var utils=require(_0x3bba('0x5'));var logger=require(_0x3bba('0x6'))(_0x3bba('0x7'));var config=require(_0x3bba('0x8'));var jayson=require(_0x3bba('0x9'));var client=jayson[_0x3bba('0xa')][_0x3bba('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1e3a44,_0x48bd2c,_0x3b754e){return new BPromise(function(_0x3575fe,_0x36c094){return client[_0x3bba('0xc')](_0x1e3a44,_0x3b754e)[_0x3bba('0xd')](function(_0x1b1221){logger[_0x3bba('0xe')](_0x3bba('0xf'),_0x48bd2c,_0x3bba('0x10'));logger['debug'](_0x3bba('0x11'),_0x48bd2c,_0x3bba('0x10'),JSON[_0x3bba('0x12')](_0x1b1221));if(_0x1b1221[_0x3bba('0x13')]){if(_0x1b1221[_0x3bba('0x13')]['code']===0x1f4){logger[_0x3bba('0x13')]('Setting,\x20%s,\x20%s',_0x48bd2c,_0x1b1221[_0x3bba('0x13')][_0x3bba('0x14')]);return _0x36c094(_0x1b1221['error'][_0x3bba('0x14')]);}logger[_0x3bba('0x13')](_0x3bba('0xf'),_0x48bd2c,_0x1b1221['error']['message']);return _0x3575fe(_0x1b1221[_0x3bba('0x13')]['message']);}else{logger[_0x3bba('0xe')]('Setting,\x20%s,\x20%s',_0x48bd2c,_0x3bba('0x10'));_0x3575fe(_0x1b1221['result'][_0x3bba('0x14')]);}})[_0x3bba('0x15')](function(_0x3ce069){logger[_0x3bba('0x13')](_0x3bba('0xf'),_0x48bd2c,_0x3ce069);_0x36c094(_0x3ce069);});});}exports[_0x3bba('0x16')]=function(_0x2b2d73){var _0x1ba15b=this;return new Promise(function(_0x34294f,_0x160a86){return db[_0x3bba('0x17')][_0x3bba('0x18')]({'raw':_0x2b2d73[_0x3bba('0x19')]?_0x2b2d73['options']['raw']===undefined?!![]:![]:!![],'where':_0x2b2d73[_0x3bba('0x19')]?_0x2b2d73[_0x3bba('0x19')]['where']||null:null,'attributes':_0x2b2d73[_0x3bba('0x19')]?_0x2b2d73[_0x3bba('0x19')][_0x3bba('0x1a')]||null:null,'include':_0x2b2d73[_0x3bba('0x19')]?_0x2b2d73[_0x3bba('0x19')][_0x3bba('0x1b')]?_[_0x3bba('0x1c')](_0x2b2d73[_0x3bba('0x19')][_0x3bba('0x1b')],function(_0x5b2c37){return{'model':db[_0x5b2c37[_0x3bba('0x1d')]],'as':_0x5b2c37['as'],'attributes':_0x5b2c37[_0x3bba('0x1a')],'include':_0x5b2c37['include']?_[_0x3bba('0x1c')](_0x5b2c37[_0x3bba('0x1b')],function(_0x15f0d4){return{'model':db[_0x15f0d4[_0x3bba('0x1d')]],'as':_0x15f0d4['as'],'attributes':_0x15f0d4['attributes'],'include':_0x15f0d4[_0x3bba('0x1b')]?_[_0x3bba('0x1c')](_0x15f0d4[_0x3bba('0x1b')],function(_0x175bba){return{'model':db[_0x175bba[_0x3bba('0x1d')]],'as':_0x175bba['as'],'attributes':_0x175bba[_0x3bba('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x3bba('0xd')](function(_0x3db4d6){logger[_0x3bba('0xe')](_0x3bba('0x16'),_0x2b2d73);logger[_0x3bba('0x1e')]('ShowSetting',_0x2b2d73,JSON['stringify'](_0x3db4d6));_0x34294f(_0x3db4d6);})[_0x3bba('0x15')](function(_0x2e97db){logger[_0x3bba('0x13')](_0x3bba('0x16'),_0x2e97db[_0x3bba('0x14')],_0x2b2d73);_0x160a86(_0x1ba15b[_0x3bba('0x13')](0x1f4,_0x2e97db[_0x3bba('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index a3253fb..b4d6186 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 _0x7a54=['getInteractions','/:id/status','statusGet','/:id/users','post','create','addAnswer','/:id/notify','notify','addApplications','send','status','addAgents','put','/:id','update','delete','destroy','/:id/canned_answers','removeAnswers','removeAgents','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','index','/describe','isAuthenticated','/:id/dispositions','getDispositions','getAnswers','/:id/applications','getApplications'];(function(_0x2d7d06,_0x7cc9f3){var _0x59a463=function(_0x20d777){while(--_0x20d777){_0x2d7d06['push'](_0x2d7d06['shift']());}};_0x59a463(++_0x7cc9f3);}(_0x7a54,0x106));var _0x47a5=function(_0x42838b,_0x56c4b7){_0x42838b=_0x42838b-0x0;var _0x49b156=_0x7a54[_0x42838b];return _0x49b156;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['describe']);router[_0x47a5('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x47a5('0x9')](_0x47a5('0xd'),auth['isAuthenticated'](),controller[_0x47a5('0xe')]);router['get']('/:id/canned_answers',auth[_0x47a5('0xc')](),controller[_0x47a5('0xf')]);router[_0x47a5('0x9')](_0x47a5('0x10'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x11')]);router[_0x47a5('0x9')]('/:id/interactions',auth[_0x47a5('0xc')](),controller[_0x47a5('0x12')]);router[_0x47a5('0x9')](_0x47a5('0x13'),controller[_0x47a5('0x14')]);router[_0x47a5('0x9')](_0x47a5('0x15'),auth[_0x47a5('0xc')](),controller['getAgents']);router[_0x47a5('0x16')]('/',auth[_0x47a5('0xc')](),controller[_0x47a5('0x17')]);router[_0x47a5('0x16')](_0x47a5('0xd'),auth['isAuthenticated'](),controller['addDisposition']);router[_0x47a5('0x16')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x47a5('0x18')]);router[_0x47a5('0x16')](_0x47a5('0x19'),controller[_0x47a5('0x1a')]);router[_0x47a5('0x16')](_0x47a5('0x10'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x1b')]);router[_0x47a5('0x16')]('/:id/send',auth[_0x47a5('0xc')](),controller[_0x47a5('0x1c')]);router['post'](_0x47a5('0x13'),controller[_0x47a5('0x1d')]);router[_0x47a5('0x16')]('/:id/users',auth[_0x47a5('0xc')](),controller[_0x47a5('0x1e')]);router[_0x47a5('0x1f')](_0x47a5('0x20'),auth['isAuthenticated'](),controller[_0x47a5('0x21')]);router[_0x47a5('0x22')]('/:id',auth[_0x47a5('0xc')](),controller[_0x47a5('0x23')]);router[_0x47a5('0x22')](_0x47a5('0xd'),auth[_0x47a5('0xc')](),controller['removeDispositions']);router['delete'](_0x47a5('0x24'),auth['isAuthenticated'](),controller[_0x47a5('0x25')]);router['delete'](_0x47a5('0x15'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x26')]);module[_0x47a5('0x27')]=router; \ No newline at end of file +var _0x7a54=['getInteractions','/:id/status','statusGet','/:id/users','post','create','addAnswer','/:id/notify','notify','addApplications','send','status','addAgents','put','/:id','update','delete','destroy','/:id/canned_answers','removeAnswers','removeAgents','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsAccount.controller','get','index','/describe','isAuthenticated','/:id/dispositions','getDispositions','getAnswers','/:id/applications','getApplications'];(function(_0x5c1e96,_0x5895a3){var _0x1e283c=function(_0x627469){while(--_0x627469){_0x5c1e96['push'](_0x5c1e96['shift']());}};_0x1e283c(++_0x5895a3);}(_0x7a54,0x106));var _0x47a5=function(_0x5e46aa,_0x572155){_0x5e46aa=_0x5e46aa-0x0;var _0x2f6c94=_0x7a54[_0x5e46aa];return _0x2f6c94;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['describe']);router[_0x47a5('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x47a5('0x9')](_0x47a5('0xd'),auth['isAuthenticated'](),controller[_0x47a5('0xe')]);router['get']('/:id/canned_answers',auth[_0x47a5('0xc')](),controller[_0x47a5('0xf')]);router[_0x47a5('0x9')](_0x47a5('0x10'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x11')]);router[_0x47a5('0x9')]('/:id/interactions',auth[_0x47a5('0xc')](),controller[_0x47a5('0x12')]);router[_0x47a5('0x9')](_0x47a5('0x13'),controller[_0x47a5('0x14')]);router[_0x47a5('0x9')](_0x47a5('0x15'),auth[_0x47a5('0xc')](),controller['getAgents']);router[_0x47a5('0x16')]('/',auth[_0x47a5('0xc')](),controller[_0x47a5('0x17')]);router[_0x47a5('0x16')](_0x47a5('0xd'),auth['isAuthenticated'](),controller['addDisposition']);router[_0x47a5('0x16')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x47a5('0x18')]);router[_0x47a5('0x16')](_0x47a5('0x19'),controller[_0x47a5('0x1a')]);router[_0x47a5('0x16')](_0x47a5('0x10'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x1b')]);router[_0x47a5('0x16')]('/:id/send',auth[_0x47a5('0xc')](),controller[_0x47a5('0x1c')]);router['post'](_0x47a5('0x13'),controller[_0x47a5('0x1d')]);router[_0x47a5('0x16')]('/:id/users',auth[_0x47a5('0xc')](),controller[_0x47a5('0x1e')]);router[_0x47a5('0x1f')](_0x47a5('0x20'),auth['isAuthenticated'](),controller[_0x47a5('0x21')]);router[_0x47a5('0x22')]('/:id',auth[_0x47a5('0xc')](),controller[_0x47a5('0x23')]);router[_0x47a5('0x22')](_0x47a5('0xd'),auth[_0x47a5('0xc')](),controller['removeDispositions']);router['delete'](_0x47a5('0x24'),auth['isAuthenticated'](),controller[_0x47a5('0x25')]);router['delete'](_0x47a5('0x15'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x26')]);module[_0x47a5('0x27')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index bef2c0d..1e58d7d 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 _0x3aa0=['Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','randomstring','exports','STRING','name','generate','ENUM','twilio','connectel','plivo','clickatell','bandwidth','csc','infobip','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'];(function(_0x369178,_0x5eb7bb){var _0x13e004=function(_0x3855f5){while(--_0x3855f5){_0x369178['push'](_0x369178['shift']());}};_0x13e004(++_0x5eb7bb);}(_0x3aa0,0x72));var _0x03aa=function(_0x24e2f7,_0x5c8bac){_0x24e2f7=_0x24e2f7-0x0;var _0x31232c=_0x3aa0[_0x24e2f7];return _0x31232c;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x03aa('0x0'));module[_0x03aa('0x1')]={'name':{'type':Sequelize[_0x03aa('0x2')],'unique':_0x03aa('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x03aa('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0x03aa('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0x03aa('0x2')],'defaultValue':function(){return rs[_0x03aa('0x4')]();}},'phone':{'type':Sequelize[_0x03aa('0x2')]},'type':{'type':Sequelize[_0x03aa('0x5')](_0x03aa('0x6'),'skebby',_0x03aa('0x7'),'clicksend',_0x03aa('0x8'),_0x03aa('0x9'),_0x03aa('0xa'),_0x03aa('0xb'),_0x03aa('0xc'),'intelepeer')},'accountSid':{'type':Sequelize[_0x03aa('0x2')]},'authId':{'type':Sequelize[_0x03aa('0x2')]},'authToken':{'type':Sequelize[_0x03aa('0x2')]},'smsMethod':{'type':Sequelize[_0x03aa('0x5')]('SI','TI','GP')},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x03aa('0x2')]},'apiKey':{'type':Sequelize[_0x03aa('0x2')]},'applicationId':{'type':Sequelize[_0x03aa('0x2')]},'accountId':{'type':Sequelize[_0x03aa('0x2')]},'senderString':{'type':Sequelize[_0x03aa('0x2')]},'deliveryReport':{'type':Sequelize[_0x03aa('0xd')],'defaultValue':![]},'description':{'type':Sequelize[_0x03aa('0x2')]},'notificationTemplate':{'type':Sequelize[_0x03aa('0xe')],'defaultValue':function(){return _0x03aa('0xf');}},'notificationSound':{'type':Sequelize[_0x03aa('0xd')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x03aa('0xd')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x03aa('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x03aa('0xd')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x03aa('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x03aa('0xd')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x03aa('0x2')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x03aa('0x11')},'mandatoryDisposition':{'type':Sequelize[_0x03aa('0xd')],'defaultValue':![],'comment':_0x03aa('0x12'),'set':function(_0x3b9e86){if(!_0x3b9e86)this['setDataValue'](_0x03aa('0x13'),null);this[_0x03aa('0x14')](_0x03aa('0x15'),_0x3b9e86);}}}; \ No newline at end of file +var _0x2224=['generate','ENUM','twilio','skebby','connectel','clicksend','plivo','clickatell','bandwidth','csc','infobip','intelepeer','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','randomstring','exports','name','STRING'];(function(_0x48b83a,_0x19af60){var _0xe7102a=function(_0x427eca){while(--_0x427eca){_0x48b83a['push'](_0x48b83a['shift']());}};_0xe7102a(++_0x19af60);}(_0x2224,0x16b));var _0x4222=function(_0x91d019,_0x5223c4){_0x91d019=_0x91d019-0x0;var _0x19de1f=_0x2224[_0x91d019];return _0x19de1f;};'use strict';var Sequelize=require(_0x4222('0x0'));var rs=require(_0x4222('0x1'));module[_0x4222('0x2')]={'name':{'type':Sequelize['STRING'],'unique':_0x4222('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x4222('0x4')],'allowNull':![]},'remote':{'type':Sequelize[_0x4222('0x4')],'allowNull':![]},'token':{'type':Sequelize[_0x4222('0x4')],'defaultValue':function(){return rs[_0x4222('0x5')]();}},'phone':{'type':Sequelize[_0x4222('0x4')]},'type':{'type':Sequelize[_0x4222('0x6')](_0x4222('0x7'),_0x4222('0x8'),_0x4222('0x9'),_0x4222('0xa'),_0x4222('0xb'),_0x4222('0xc'),_0x4222('0xd'),_0x4222('0xe'),_0x4222('0xf'),_0x4222('0x10'))},'accountSid':{'type':Sequelize[_0x4222('0x4')]},'authId':{'type':Sequelize[_0x4222('0x4')]},'authToken':{'type':Sequelize[_0x4222('0x4')]},'smsMethod':{'type':Sequelize['ENUM']('SI','TI','GP')},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x4222('0x4')]},'apiKey':{'type':Sequelize[_0x4222('0x4')]},'applicationId':{'type':Sequelize['STRING']},'accountId':{'type':Sequelize[_0x4222('0x4')]},'senderString':{'type':Sequelize['STRING']},'deliveryReport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0x4222('0x4')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x4222('0x11');}},'notificationSound':{'type':Sequelize[_0x4222('0x12')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x4222('0x12')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x4222('0x13')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x4222('0x13')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x4222('0x12')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x4222('0x13')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x4222('0x4')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x4222('0x13')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x4222('0x14'),'set':function(_0x23e260){if(!_0x23e260)this[_0x4222('0x15')]('mandatoryDispositionPauseId',null);this[_0x4222('0x15')](_0x4222('0x16'),_0x23e260);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index c945906..5c5714e 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 _0xdc71=['list','omit','CmContact','contact','SmsInteraction','spread','interaction','created','autoclose','push','close','SmsMessage','ContactId','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','*,*,*,*','queueId','SmsQueue','queue','Start','startRouting','SmsAccount,\x20%s,\x20%s,\x20%s','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','entity\x20found','stringify','text/xml','send','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','findAndCountAll','priority','getApplications','getInteractions','Contact','Owner','internal','Tags','color','DESC','List','Messages','dataValues','skebby_dispatch_id','requestid','statusInt','status_code','DELIVERED','redif','update','inspect','error_code','groupName','RECEIVED_BY_RECIPIENT','message-delivered','DELIVRD','ACCEPTD','statusGet','message-id','state','userSmsAccount:save','removeAgents','isArray','emit','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','./smsAccount.socket','jayson/promise','http','request','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','save','then','destroy','SmsAccounts','UserProfileResource','stack','name','index','mandatoryDispositionPause','map','SmsAccount','rawAttributes','type','key','model','query','keys','attributes','intersection','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Pause','describe','SmsAccountId','getDispositions','findOne','Disposition','hasOwnProperty','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','sms','SmsApplication','Applications','account','applications','orderBy','Sequelize','ValidationError','no\x20available\x20attributes','difference','updatedAt','createdAt','CompanyId','ListId','mobile','twilio','from','From','MessageSid','skebby','text','connectel','clicksend','messageId','message_id','plivo','Text','MessageUUID','infobip','results','csc','originatingAddress','segmentedMessage','clickatell','bandwidth','intelepeer','refid','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts'];(function(_0x4d8e57,_0x22f23c){var _0xb126d2=function(_0xc811){while(--_0xc811){_0x4d8e57['push'](_0x4d8e57['shift']());}};_0xb126d2(++_0x22f23c);}(_0xdc71,0x12b));var _0x1dc7=function(_0xe884c3,_0x2ed518){_0xe884c3=_0xe884c3-0x0;var _0x303fc6=_0xdc71[_0xe884c3];return _0x303fc6;};'use strict';var emlformat=require(_0x1dc7('0x0'));var rimraf=require(_0x1dc7('0x1'));var zipdir=require(_0x1dc7('0x2'));var jsonpatch=require(_0x1dc7('0x3'));var rp=require(_0x1dc7('0x4'));var moment=require('moment');var BPromise=require(_0x1dc7('0x5'));var Mustache=require(_0x1dc7('0x6'));var util=require('util');var path=require(_0x1dc7('0x7'));var sox=require(_0x1dc7('0x8'));var csv=require(_0x1dc7('0x9'));var ejs=require(_0x1dc7('0xa'));var fs=require('fs');var fs_extra=require(_0x1dc7('0xb'));var _=require(_0x1dc7('0xc'));var squel=require('squel');var crypto=require(_0x1dc7('0xd'));var jsforce=require(_0x1dc7('0xe'));var deskjs=require(_0x1dc7('0xf'));var toCsv=require(_0x1dc7('0x9'));var querystring=require(_0x1dc7('0x10'));var Papa=require(_0x1dc7('0x11'));var Redis=require(_0x1dc7('0x12'));var authService=require(_0x1dc7('0x13'));var qs=require(_0x1dc7('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1dc7('0x15'));var logger=require(_0x1dc7('0x16'))('api');var utils=require('../../config/utils');var config=require(_0x1dc7('0x17'));var licenseUtil=require(_0x1dc7('0x18'));var db=require('../../mysqldb')['db'];config[_0x1dc7('0x19')]=_[_0x1dc7('0x1a')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x1dc7('0x1b'))(new Redis(config[_0x1dc7('0x19')]));require(_0x1dc7('0x1c'))['register'](socket);var jayson=require(_0x1dc7('0x1d'));var client=jayson['client'][_0x1dc7('0x1e')]({'port':0x232c});function respondWithRpcPromise(_0x56907b,_0x188f5c,_0x2e7171,_0x1b1661){return new BPromise(function(_0x39b059,_0x48e20f){var _0x5d1cb9=_0x1b1661||client;return _0x5d1cb9[_0x1dc7('0x1f')](_0x56907b,_0x2e7171)['then'](function(_0x5db17d){logger[_0x1dc7('0x20')](_0x1dc7('0x21'),_0x188f5c,_0x1dc7('0x22'));logger[_0x1dc7('0x23')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x188f5c,_0x1dc7('0x22'),JSON['stringify'](_0x5db17d));if(_0x5db17d[_0x1dc7('0x24')]){if(_0x5db17d[_0x1dc7('0x24')][_0x1dc7('0x25')]===0x1f4){logger[_0x1dc7('0x24')](_0x1dc7('0x21'),_0x188f5c,_0x5db17d['error']['message']);return _0x48e20f(_0x5db17d['error'][_0x1dc7('0x26')]);}logger[_0x1dc7('0x24')](_0x1dc7('0x21'),_0x188f5c,_0x5db17d[_0x1dc7('0x24')][_0x1dc7('0x26')]);return _0x39b059(_0x5db17d[_0x1dc7('0x24')][_0x1dc7('0x26')]);}else{logger[_0x1dc7('0x20')](_0x1dc7('0x21'),_0x188f5c,_0x1dc7('0x22'));_0x39b059(_0x5db17d[_0x1dc7('0x27')][_0x1dc7('0x26')]);}})[_0x1dc7('0x28')](function(_0xb35874){logger['error'](_0x1dc7('0x21'),_0x188f5c,_0xb35874);_0x48e20f(_0xb35874);});});}function respondWithStatusCode(_0x3356f4,_0x579ada){_0x579ada=_0x579ada||0xcc;return function(_0x1fe170){if(_0x1fe170){return _0x3356f4[_0x1dc7('0x29')](_0x579ada);}return _0x3356f4['status'](_0x579ada)['end']();};}function respondWithResult(_0x173dd6,_0x49503d){_0x49503d=_0x49503d||0xc8;return function(_0x1413d4){if(_0x1413d4){return _0x173dd6[_0x1dc7('0x2a')](_0x49503d)[_0x1dc7('0x2b')](_0x1413d4);}};}function respondWithFilteredResult(_0x3081ee,_0x7ee593){return function(_0x5f16bd){if(_0x5f16bd){var _0xe5d2d5=typeof _0x7ee593[_0x1dc7('0x2c')]==='undefined'&&typeof _0x7ee593[_0x1dc7('0x2d')]===_0x1dc7('0x2e');var _0x297f67=_0x5f16bd[_0x1dc7('0x2f')];var _0xfd48ea=_0xe5d2d5?0x0:_0x7ee593[_0x1dc7('0x2c')];var _0xbb4447=_0xe5d2d5?_0x5f16bd[_0x1dc7('0x2f')]:_0x7ee593[_0x1dc7('0x2c')]+_0x7ee593[_0x1dc7('0x2d')];var _0x435f04;if(_0xbb4447>=_0x297f67){_0xbb4447=_0x297f67;_0x435f04=0xc8;}else{_0x435f04=0xce;}_0x3081ee['status'](_0x435f04);return _0x3081ee[_0x1dc7('0x30')](_0x1dc7('0x31'),_0xfd48ea+'-'+_0xbb4447+'/'+_0x297f67)[_0x1dc7('0x2b')](_0x5f16bd);}return null;};}function patchUpdates(_0x36c2c3){return function(_0x9a8038){try{jsonpatch['apply'](_0x9a8038,_0x36c2c3,!![]);}catch(_0x58ca3d){return BPromise['reject'](_0x58ca3d);}return _0x9a8038[_0x1dc7('0x32')]();};}function saveUpdates(_0x493be9,_0x2c9f2f){return function(_0x393cbb){if(_0x393cbb){return _0x393cbb['update'](_0x493be9)[_0x1dc7('0x33')](function(_0x4e93e8){return _0x4e93e8;});}return null;};}function removeEntity(_0x118ee,_0x329f70){return function(_0x56865e){if(_0x56865e){return _0x56865e[_0x1dc7('0x34')]()[_0x1dc7('0x33')](function(){var _0x57f915=_0x56865e['get']({'plain':!![]});var _0x923b68=_0x1dc7('0x35');return db[_0x1dc7('0x36')]['destroy']({'where':{'type':_0x923b68,'resourceId':_0x57f915['id']}})[_0x1dc7('0x33')](function(){return _0x56865e;});})[_0x1dc7('0x33')](function(){_0x118ee[_0x1dc7('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x436a12,_0x41b812){return function(_0x4d8df8){if(!_0x4d8df8){_0x436a12[_0x1dc7('0x29')](0x194);}return _0x4d8df8;};}function handleError(_0xb41abf,_0x4980ce){_0x4980ce=_0x4980ce||0x1f4;return function(_0xbd6a75){logger[_0x1dc7('0x24')](_0xbd6a75[_0x1dc7('0x37')]);if(_0xbd6a75[_0x1dc7('0x38')]){delete _0xbd6a75[_0x1dc7('0x38')];}_0xb41abf['status'](_0x4980ce)['send'](_0xbd6a75);};}exports[_0x1dc7('0x39')]=function(_0x5df0d5,_0xafe108){var _0x50b1fd={'include':[{'model':db['Pause'],'as':_0x1dc7('0x3a')}]},_0x16822f={},_0x2a11a0={'count':0x0,'rows':[]};var _0x4d5e3d=_[_0x1dc7('0x3b')](db[_0x1dc7('0x3c')][_0x1dc7('0x3d')],function(_0x2c5dc8){return{'name':_0x2c5dc8['fieldName'],'type':_0x2c5dc8[_0x1dc7('0x3e')][_0x1dc7('0x3f')]};});_0x16822f[_0x1dc7('0x40')]=_['map'](_0x4d5e3d,_0x1dc7('0x38'));_0x16822f[_0x1dc7('0x41')]=_[_0x1dc7('0x42')](_0x5df0d5['query']);_0x16822f['filters']=_['intersection'](_0x16822f[_0x1dc7('0x40')],_0x16822f[_0x1dc7('0x41')]);_0x50b1fd[_0x1dc7('0x43')]=_[_0x1dc7('0x44')](_0x16822f[_0x1dc7('0x40')],qs[_0x1dc7('0x45')](_0x5df0d5[_0x1dc7('0x41')][_0x1dc7('0x45')]));_0x50b1fd[_0x1dc7('0x43')]=_0x50b1fd[_0x1dc7('0x43')][_0x1dc7('0x46')]?_0x50b1fd[_0x1dc7('0x43')]:_0x16822f[_0x1dc7('0x40')];if(!_0x5df0d5[_0x1dc7('0x41')]['hasOwnProperty'](_0x1dc7('0x47'))){_0x50b1fd[_0x1dc7('0x2d')]=qs['limit'](_0x5df0d5['query'][_0x1dc7('0x2d')]);_0x50b1fd[_0x1dc7('0x2c')]=qs[_0x1dc7('0x2c')](_0x5df0d5[_0x1dc7('0x41')]['offset']);}_0x50b1fd[_0x1dc7('0x48')]=qs['sort'](_0x5df0d5['query'][_0x1dc7('0x49')]);_0x50b1fd[_0x1dc7('0x4a')]=qs[_0x1dc7('0x4b')](_[_0x1dc7('0x4c')](_0x5df0d5[_0x1dc7('0x41')],_0x16822f[_0x1dc7('0x4b')]),_0x4d5e3d);if(_0x5df0d5['query'][_0x1dc7('0x4d')]){_0x50b1fd[_0x1dc7('0x4a')]=_[_0x1dc7('0x4e')](_0x50b1fd[_0x1dc7('0x4a')],{'$or':_[_0x1dc7('0x3b')](_0x4d5e3d,function(_0x231014){if(_0x231014[_0x1dc7('0x3e')]!==_0x1dc7('0x4f')){var _0x4ca98d={};_0x4ca98d[_0x231014[_0x1dc7('0x38')]]={'$like':'%'+_0x5df0d5['query'][_0x1dc7('0x4d')]+'%'};return _0x4ca98d;}})});}_0x50b1fd=_[_0x1dc7('0x4e')]({},_0x50b1fd,_0x5df0d5[_0x1dc7('0x50')]);var _0x191848={'where':_0x50b1fd[_0x1dc7('0x4a')]};return db[_0x1dc7('0x3c')][_0x1dc7('0x2f')](_0x191848)[_0x1dc7('0x33')](function(_0x351d1f){_0x2a11a0[_0x1dc7('0x2f')]=_0x351d1f;if(_0x5df0d5[_0x1dc7('0x41')][_0x1dc7('0x51')]){_0x50b1fd[_0x1dc7('0x52')]=[{'all':!![]}];}return db[_0x1dc7('0x3c')][_0x1dc7('0x53')](_0x50b1fd);})['then'](function(_0x4787c9){_0x2a11a0[_0x1dc7('0x54')]=_0x4787c9;return _0x2a11a0;})['then'](respondWithFilteredResult(_0xafe108,_0x50b1fd))[_0x1dc7('0x28')](handleError(_0xafe108,null));};exports[_0x1dc7('0x55')]=function(_0x508f33,_0x298245){var _0x2b1dfc={'raw':![],'where':{'id':_0x508f33[_0x1dc7('0x56')]['id']},'include':[{'model':db['Pause'],'as':_0x1dc7('0x3a')}]},_0x78d502={};_0x78d502[_0x1dc7('0x40')]=_['keys'](db[_0x1dc7('0x3c')][_0x1dc7('0x3d')]);_0x78d502[_0x1dc7('0x41')]=_[_0x1dc7('0x42')](_0x508f33[_0x1dc7('0x41')]);_0x78d502[_0x1dc7('0x4b')]=_[_0x1dc7('0x44')](_0x78d502[_0x1dc7('0x40')],_0x78d502[_0x1dc7('0x41')]);_0x2b1dfc['attributes']=_[_0x1dc7('0x44')](_0x78d502[_0x1dc7('0x40')],qs['fields'](_0x508f33[_0x1dc7('0x41')][_0x1dc7('0x45')]));_0x2b1dfc[_0x1dc7('0x43')]=_0x2b1dfc['attributes'][_0x1dc7('0x46')]?_0x2b1dfc[_0x1dc7('0x43')]:_0x78d502['model'];if(_0x508f33['query']['includeAll']){_0x2b1dfc[_0x1dc7('0x52')]=[{'all':!![]}];}_0x2b1dfc=_[_0x1dc7('0x4e')]({},_0x2b1dfc,_0x508f33[_0x1dc7('0x50')]);return db['SmsAccount'][_0x1dc7('0x57')](_0x2b1dfc)[_0x1dc7('0x33')](handleEntityNotFound(_0x298245,null))[_0x1dc7('0x33')](respondWithResult(_0x298245,null))[_0x1dc7('0x28')](handleError(_0x298245,null));};exports[_0x1dc7('0x58')]=function(_0x583648,_0x470e5e){return db[_0x1dc7('0x3c')][_0x1dc7('0x58')](_0x583648[_0x1dc7('0x59')],{})[_0x1dc7('0x33')](function(_0x36fc40){var _0x2d74b4=_0x583648[_0x1dc7('0x5a')]['get']({'plain':!![]});if(!_0x2d74b4)throw new Error(_0x1dc7('0x5b'));if(_0x2d74b4[_0x1dc7('0x5c')]==='user'){var _0x2cea6f=_0x36fc40[_0x1dc7('0x5d')]({'plain':!![]});var _0x5f1543='SmsAccounts';return db['UserProfileSection']['find']({'where':{'name':_0x5f1543,'userProfileId':_0x2d74b4['userProfileId']},'raw':!![]})[_0x1dc7('0x33')](function(_0x2cbc1b){if(_0x2cbc1b&&_0x2cbc1b[_0x1dc7('0x5e')]===0x0){return db['UserProfileResource'][_0x1dc7('0x58')]({'name':_0x2cea6f[_0x1dc7('0x38')],'resourceId':_0x2cea6f['id'],'type':_0x2cbc1b[_0x1dc7('0x38')],'sectionId':_0x2cbc1b['id']},{})[_0x1dc7('0x33')](function(){return _0x36fc40;});}else{return _0x36fc40;}})[_0x1dc7('0x28')](function(_0x23fab6){logger['error'](_0x1dc7('0x5f'),_0x23fab6);throw _0x23fab6;});}return _0x36fc40;})[_0x1dc7('0x33')](respondWithResult(_0x470e5e,0xc9))['catch'](handleError(_0x470e5e,null));};exports['update']=function(_0x105db7,_0x1b93ac){if(_0x105db7[_0x1dc7('0x59')]['id']){delete _0x105db7[_0x1dc7('0x59')]['id'];}return db['SmsAccount'][_0x1dc7('0x57')]({'where':{'id':_0x105db7['params']['id']},'include':[{'model':db[_0x1dc7('0x60')],'as':_0x1dc7('0x3a')}]})[_0x1dc7('0x33')](handleEntityNotFound(_0x1b93ac,null))['then'](saveUpdates(_0x105db7[_0x1dc7('0x59')],null))[_0x1dc7('0x33')](respondWithResult(_0x1b93ac,null))[_0x1dc7('0x28')](handleError(_0x1b93ac,null));};exports['destroy']=function(_0xb47fe1,_0x536cc8){return db[_0x1dc7('0x3c')]['find']({'where':{'id':_0xb47fe1[_0x1dc7('0x56')]['id']}})['then'](handleEntityNotFound(_0x536cc8,null))['then'](removeEntity(_0x536cc8,null))[_0x1dc7('0x28')](handleError(_0x536cc8,null));};exports[_0x1dc7('0x61')]=function(_0x59afca,_0x52cc93){return db[_0x1dc7('0x3c')][_0x1dc7('0x61')]()[_0x1dc7('0x33')](respondWithResult(_0x52cc93,null))[_0x1dc7('0x28')](handleError(_0x52cc93,null));};exports['addDisposition']=function(_0x4c118e,_0x538403,_0x33bf8c){if(_0x4c118e[_0x1dc7('0x59')]['id']){delete _0x4c118e[_0x1dc7('0x59')]['id'];}return db[_0x1dc7('0x3c')][_0x1dc7('0x57')]({'where':{'id':_0x4c118e['params']['id']}})['then'](handleEntityNotFound(_0x538403,null))['then'](function(_0x1992eb){if(_0x1992eb){_0x4c118e[_0x1dc7('0x59')][_0x1dc7('0x62')]=_0x1992eb['id'];return db['Disposition']['create'](_0x4c118e[_0x1dc7('0x59')]);}})['then'](respondWithResult(_0x538403,null))['catch'](handleError(_0x538403,null));};exports[_0x1dc7('0x63')]=function(_0x14700b,_0x31a63c,_0x54501b){var _0x1c9f47={'raw':![],'where':{}};var _0x6d4675={};var _0x4ad8f1={'count':0x0,'rows':[]};return db[_0x1dc7('0x3c')][_0x1dc7('0x64')]({'where':{'id':_0x14700b[_0x1dc7('0x56')]['id']}})[_0x1dc7('0x33')](handleEntityNotFound(_0x31a63c,null))[_0x1dc7('0x33')](function(_0x8c7f6a){if(_0x8c7f6a){_0x6d4675[_0x1dc7('0x40')]=_[_0x1dc7('0x42')](db[_0x1dc7('0x65')][_0x1dc7('0x3d')]);_0x6d4675[_0x1dc7('0x41')]=_['keys'](_0x14700b[_0x1dc7('0x41')]);_0x6d4675[_0x1dc7('0x4b')]=_['intersection'](_0x6d4675[_0x1dc7('0x40')],_0x6d4675['query']);_0x1c9f47[_0x1dc7('0x43')]=_['intersection'](_0x6d4675[_0x1dc7('0x40')],qs['fields'](_0x14700b[_0x1dc7('0x41')][_0x1dc7('0x45')]));_0x1c9f47['attributes']=_0x1c9f47['attributes'][_0x1dc7('0x46')]?_0x1c9f47[_0x1dc7('0x43')]:_0x6d4675[_0x1dc7('0x40')];if(!_0x14700b['query'][_0x1dc7('0x66')](_0x1dc7('0x47'))){_0x1c9f47[_0x1dc7('0x2d')]=qs[_0x1dc7('0x2d')](_0x14700b['query'][_0x1dc7('0x2d')]);_0x1c9f47[_0x1dc7('0x2c')]=qs['offset'](_0x14700b[_0x1dc7('0x41')][_0x1dc7('0x2c')]);}_0x1c9f47['order']=qs[_0x1dc7('0x49')](_0x14700b[_0x1dc7('0x41')][_0x1dc7('0x49')]);_0x1c9f47[_0x1dc7('0x4a')]=qs[_0x1dc7('0x4b')](_['pick'](_0x14700b[_0x1dc7('0x41')],_0x6d4675[_0x1dc7('0x4b')]));_0x1c9f47[_0x1dc7('0x4a')]['SmsAccountId']=_0x8c7f6a['id'];if(_0x14700b['query'][_0x1dc7('0x4d')]){_0x1c9f47[_0x1dc7('0x4a')]=_[_0x1dc7('0x4e')](_0x1c9f47[_0x1dc7('0x4a')],{'$or':_[_0x1dc7('0x3b')](_0x1c9f47[_0x1dc7('0x43')],function(_0x43e9a3){var _0x59020e={};_0x59020e[_0x43e9a3]={'$like':'%'+_0x14700b[_0x1dc7('0x41')][_0x1dc7('0x4d')]+'%'};return _0x59020e;})});}_0x1c9f47=_[_0x1dc7('0x4e')]({},_0x1c9f47,_0x14700b[_0x1dc7('0x50')]);return db[_0x1dc7('0x65')][_0x1dc7('0x2f')]({'where':_0x1c9f47['where']})[_0x1dc7('0x33')](function(_0x42def9){_0x4ad8f1[_0x1dc7('0x2f')]=_0x42def9;if(_0x14700b[_0x1dc7('0x41')][_0x1dc7('0x51')]){_0x1c9f47[_0x1dc7('0x52')]=[{'all':!![]}];}return db[_0x1dc7('0x65')][_0x1dc7('0x53')](_0x1c9f47);})[_0x1dc7('0x33')](function(_0xcf21f9){_0x4ad8f1[_0x1dc7('0x54')]=_0xcf21f9;return _0x4ad8f1;});}})[_0x1dc7('0x33')](respondWithFilteredResult(_0x31a63c,_0x1c9f47))[_0x1dc7('0x28')](handleError(_0x31a63c,null));};exports[_0x1dc7('0x67')]=function(_0x21e3e4,_0x3ad20b,_0x1adc5e){return db['SmsAccount'][_0x1dc7('0x57')]({'where':{'id':_0x21e3e4['params']['id']}})['then'](handleEntityNotFound(_0x3ad20b,null))[_0x1dc7('0x33')](function(_0x272157){if(_0x272157){return _0x272157[_0x1dc7('0x67')](_0x21e3e4[_0x1dc7('0x41')][_0x1dc7('0x68')]);}})['then'](respondWithStatusCode(_0x3ad20b,null))[_0x1dc7('0x28')](handleError(_0x3ad20b,null));};exports[_0x1dc7('0x69')]=function(_0x3b66c9,_0x2385c2,_0x327a2b){if(_0x3b66c9[_0x1dc7('0x59')]['id']){delete _0x3b66c9['body']['id'];}return db[_0x1dc7('0x3c')][_0x1dc7('0x57')]({'where':{'id':_0x3b66c9['params']['id']}})[_0x1dc7('0x33')](handleEntityNotFound(_0x2385c2,null))[_0x1dc7('0x33')](function(_0x53e4c8){if(_0x53e4c8){_0x3b66c9[_0x1dc7('0x59')][_0x1dc7('0x62')]=_0x53e4c8['id'];return db['CannedAnswer']['create'](_0x3b66c9[_0x1dc7('0x59')]);}})['then'](respondWithResult(_0x2385c2,null))[_0x1dc7('0x28')](handleError(_0x2385c2,null));};exports['getAnswers']=function(_0x8cf6fa,_0x35f698,_0xe30886){var _0x586d8a={'raw':![],'where':{}};var _0x50a97e={};var _0x58f84f={'count':0x0,'rows':[]};return db[_0x1dc7('0x3c')]['findOne']({'where':{'id':_0x8cf6fa[_0x1dc7('0x56')]['id']}})[_0x1dc7('0x33')](handleEntityNotFound(_0x35f698,null))[_0x1dc7('0x33')](function(_0x257e9c){if(_0x257e9c){_0x50a97e['model']=_[_0x1dc7('0x42')](db[_0x1dc7('0x6a')][_0x1dc7('0x3d')]);_0x50a97e[_0x1dc7('0x41')]=_['keys'](_0x8cf6fa['query']);_0x50a97e[_0x1dc7('0x4b')]=_[_0x1dc7('0x44')](_0x50a97e[_0x1dc7('0x40')],_0x50a97e[_0x1dc7('0x41')]);_0x586d8a[_0x1dc7('0x43')]=_[_0x1dc7('0x44')](_0x50a97e[_0x1dc7('0x40')],qs[_0x1dc7('0x45')](_0x8cf6fa[_0x1dc7('0x41')]['fields']));_0x586d8a[_0x1dc7('0x43')]=_0x586d8a[_0x1dc7('0x43')][_0x1dc7('0x46')]?_0x586d8a[_0x1dc7('0x43')]:_0x50a97e['model'];if(!_0x8cf6fa[_0x1dc7('0x41')][_0x1dc7('0x66')]('nolimit')){_0x586d8a[_0x1dc7('0x2d')]=qs[_0x1dc7('0x2d')](_0x8cf6fa[_0x1dc7('0x41')]['limit']);_0x586d8a[_0x1dc7('0x2c')]=qs['offset'](_0x8cf6fa[_0x1dc7('0x41')]['offset']);}_0x586d8a['order']=qs[_0x1dc7('0x49')](_0x8cf6fa[_0x1dc7('0x41')][_0x1dc7('0x49')]);_0x586d8a[_0x1dc7('0x4a')]=qs[_0x1dc7('0x4b')](_[_0x1dc7('0x4c')](_0x8cf6fa[_0x1dc7('0x41')],_0x50a97e['filters']));_0x586d8a[_0x1dc7('0x4a')]['SmsAccountId']=_0x257e9c['id'];if(_0x8cf6fa[_0x1dc7('0x41')][_0x1dc7('0x4d')]){_0x586d8a['where']=_[_0x1dc7('0x4e')](_0x586d8a['where'],{'$or':_['map'](_0x586d8a[_0x1dc7('0x43')],function(_0x25f4f4){var _0x26b34c={};_0x26b34c[_0x25f4f4]={'$like':'%'+_0x8cf6fa[_0x1dc7('0x41')][_0x1dc7('0x4d')]+'%'};return _0x26b34c;})});}_0x586d8a=_[_0x1dc7('0x4e')]({},_0x586d8a,_0x8cf6fa['options']);return db[_0x1dc7('0x6a')]['count']({'where':_0x586d8a[_0x1dc7('0x4a')]})[_0x1dc7('0x33')](function(_0x169455){_0x58f84f[_0x1dc7('0x2f')]=_0x169455;if(_0x8cf6fa[_0x1dc7('0x41')][_0x1dc7('0x51')]){_0x586d8a[_0x1dc7('0x52')]=[{'all':!![]}];}return db[_0x1dc7('0x6a')]['findAll'](_0x586d8a);})[_0x1dc7('0x33')](function(_0x350530){_0x58f84f['rows']=_0x350530;return _0x58f84f;});}})[_0x1dc7('0x33')](respondWithFilteredResult(_0x35f698,_0x586d8a))[_0x1dc7('0x28')](handleError(_0x35f698,null));};exports[_0x1dc7('0x6b')]=function(_0x41f26d,_0x215d59,_0x456e2a){return db['SmsAccount'][_0x1dc7('0x57')]({'where':{'id':_0x41f26d[_0x1dc7('0x56')]['id']}})[_0x1dc7('0x33')](handleEntityNotFound(_0x215d59,null))['then'](function(_0x5dafe0){if(_0x5dafe0){return _0x5dafe0[_0x1dc7('0x6b')](_0x41f26d[_0x1dc7('0x41')][_0x1dc7('0x68')]);}})['then'](respondWithStatusCode(_0x215d59,null))[_0x1dc7('0x28')](handleError(_0x215d59,null));};exports['notify']=function(_0x501e90,_0x16e458,_0x4f3bdb){var _0x51ed43={'channel':_0x1dc7('0x6c')};var _0xada450=[];var _0xe1d2eb=[];var _0x18cd93={};return db[_0x1dc7('0x3c')]['find']({'where':{'id':_0x501e90[_0x1dc7('0x56')]['id']},'include':[{'model':db[_0x1dc7('0x6d')],'as':_0x1dc7('0x6e')}]})[_0x1dc7('0x33')](handleEntityNotFound(_0x16e458,null))[_0x1dc7('0x33')](function(_0x258d8d){_0x51ed43[_0x1dc7('0x6f')]=_0x258d8d;_0x51ed43[_0x1dc7('0x70')]=_[_0x1dc7('0x71')](_0x258d8d[_0x1dc7('0x6e')],['priority'],['asc']);if(_0x51ed43[_0x1dc7('0x6f')][_0x1dc7('0x6e')]){delete _0x51ed43[_0x1dc7('0x6f')][_0x1dc7('0x6e')];}return db['CmContact'][_0x1dc7('0x61')]();})[_0x1dc7('0x33')](function(_0x39c597){if(!_0x39c597){throw new db[(_0x1dc7('0x72'))][(_0x1dc7('0x73'))](_0x1dc7('0x74'));}_0xada450=_[_0x1dc7('0x75')](_[_0x1dc7('0x42')](_0x39c597),['createdAt',_0x1dc7('0x76')]);_0xe1d2eb=_[_0x1dc7('0x75')](_[_0x1dc7('0x42')](_0x39c597),[_0x1dc7('0x77'),_0x1dc7('0x76'),_0x1dc7('0x78'),_0x1dc7('0x79')]);_0x51ed43['body']={'mapKey':_0x1dc7('0x7a')};if(_0x51ed43[_0x1dc7('0x6f')][_0x1dc7('0x3e')]){switch(_0x51ed43['account']['type']){case _0x1dc7('0x7b'):_0x51ed43[_0x1dc7('0x59')][_0x1dc7('0x7c')]=_0x501e90[_0x1dc7('0x59')][_0x1dc7('0x7d')];_0x51ed43[_0x1dc7('0x59')]['body']=_0x501e90['body']['Body'];_0x51ed43['body']['messageId']=_0x501e90[_0x1dc7('0x59')][_0x1dc7('0x7e')];break;case _0x1dc7('0x7f'):_0x51ed43[_0x1dc7('0x59')][_0x1dc7('0x7c')]='+'+_0x501e90[_0x1dc7('0x59')]['sender'];_0x51ed43[_0x1dc7('0x59')]['body']=_0x501e90[_0x1dc7('0x59')][_0x1dc7('0x80')];break;case _0x1dc7('0x81'):_0x51ed43[_0x1dc7('0x59')][_0x1dc7('0x7c')]=_0x501e90[_0x1dc7('0x59')][_0x1dc7('0x7c')];_0x51ed43['body']['body']=_0x501e90[_0x1dc7('0x59')][_0x1dc7('0x26')];break;case _0x1dc7('0x82'):_0x51ed43[_0x1dc7('0x59')][_0x1dc7('0x7c')]=_0x501e90[_0x1dc7('0x59')]['from'];_0x51ed43[_0x1dc7('0x59')][_0x1dc7('0x59')]=_0x501e90[_0x1dc7('0x59')][_0x1dc7('0x59')];_0x51ed43[_0x1dc7('0x59')][_0x1dc7('0x83')]=_0x501e90[_0x1dc7('0x59')][_0x1dc7('0x84')];break;case _0x1dc7('0x85'):_0x51ed43[_0x1dc7('0x59')]['from']=_0x501e90[_0x1dc7('0x59')][_0x1dc7('0x7d')];_0x51ed43[_0x1dc7('0x59')][_0x1dc7('0x59')]=_0x501e90[_0x1dc7('0x59')][_0x1dc7('0x86')];_0x51ed43['body'][_0x1dc7('0x83')]=_0x501e90[_0x1dc7('0x59')][_0x1dc7('0x87')];break;case _0x1dc7('0x88'):_0x51ed43['body']['from']='+'+_0x501e90[_0x1dc7('0x59')]['results'][0x0]['from'];_0x51ed43[_0x1dc7('0x59')][_0x1dc7('0x59')]=_0x501e90[_0x1dc7('0x59')][_0x1dc7('0x89')][0x0][_0x1dc7('0x80')];_0x51ed43[_0x1dc7('0x59')][_0x1dc7('0x83')]=_0x501e90[_0x1dc7('0x59')][_0x1dc7('0x89')][0x0][_0x1dc7('0x83')];break;case _0x1dc7('0x8a'):_0x51ed43[_0x1dc7('0x59')][_0x1dc7('0x7c')]=_0x501e90[_0x1dc7('0x59')][_0x1dc7('0x8b')];_0x51ed43[_0x1dc7('0x59')][_0x1dc7('0x59')]=_0x501e90[_0x1dc7('0x59')][_0x1dc7('0x8c')][_0x1dc7('0x26')];break;case _0x1dc7('0x8d'):_0x51ed43['body'][_0x1dc7('0x7c')]=_0x501e90['body']['fromNumber'];_0x51ed43[_0x1dc7('0x59')][_0x1dc7('0x59')]=_0x501e90['body'][_0x1dc7('0x80')];_0x51ed43[_0x1dc7('0x59')][_0x1dc7('0x83')]=_0x501e90[_0x1dc7('0x59')]['replyMessageId'];break;case _0x1dc7('0x8e'):_0x51ed43['body'][_0x1dc7('0x83')]=_0x501e90[_0x1dc7('0x59')][0x0]['message']['id'];_0x51ed43[_0x1dc7('0x59')]['from']=_0x501e90[_0x1dc7('0x59')][0x0][_0x1dc7('0x26')][_0x1dc7('0x7c')];_0x51ed43['body']['body']=_0x501e90[_0x1dc7('0x59')][0x0][_0x1dc7('0x26')][_0x1dc7('0x80')];break;case _0x1dc7('0x8f'):_0x51ed43[_0x1dc7('0x59')][_0x1dc7('0x7c')]=_0x501e90[_0x1dc7('0x59')]['from'];_0x51ed43[_0x1dc7('0x59')][_0x1dc7('0x59')]=_0x501e90['body'][_0x1dc7('0x26')];_0x51ed43[_0x1dc7('0x59')]['messageId']=_0x501e90[_0x1dc7('0x59')][_0x1dc7('0x90')];break;}}if(_0x51ed43['body']['id']){delete _0x51ed43['body']['id'];}if(_[_0x1dc7('0x91')](_0x51ed43['body']['from'])){throw new db['Sequelize'][(_0x1dc7('0x73'))](_0x1dc7('0x92'));}if(_[_0x1dc7('0x91')](_0x51ed43['body']['body'])||_0x51ed43[_0x1dc7('0x59')][_0x1dc7('0x59')]===''){throw new db[(_0x1dc7('0x72'))][(_0x1dc7('0x73'))](_0x1dc7('0x93'));}if(_[_0x1dc7('0x91')](_0x51ed43[_0x1dc7('0x59')][_0x1dc7('0x94')])){throw new db[(_0x1dc7('0x72'))][(_0x1dc7('0x73'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0xe1d2eb);}if(!_[_0x1dc7('0x95')](_0xe1d2eb,_0x51ed43[_0x1dc7('0x59')][_0x1dc7('0x94')])){throw new db[(_0x1dc7('0x72'))][(_0x1dc7('0x73'))](_0x1dc7('0x96')+_0xe1d2eb);}_0x18cd93[_0x51ed43[_0x1dc7('0x59')]['mapKey']]=_0x51ed43['body'][_0x1dc7('0x7c')];return db[_0x1dc7('0x97')][_0x1dc7('0x57')]({'where':{'id':_0x51ed43[_0x1dc7('0x6f')]['ListId']},'include':[{'model':db['CmContact'],'as':_0x1dc7('0x98'),'where':_0x18cd93,'limit':0x1,'order':[['updatedAt','DESC']]}]});})[_0x1dc7('0x33')](handleEntityNotFound(_0x16e458,null))[_0x1dc7('0x33')](function(_0xaecff4){if(_0xaecff4){_0x51ed43[_0x1dc7('0x99')]=_[_0x1dc7('0x9a')](_0xaecff4,[_0x1dc7('0x98')]);if(_0xaecff4[_0x1dc7('0x98')]['length']){return _0xaecff4['Contacts'][0x0];}var _0x2d442f=_[_0x1dc7('0x1a')](_0x51ed43[_0x1dc7('0x59')],{'firstName':_0x51ed43['body'][_0x1dc7('0x7c')],'ListId':_0xaecff4['id']});_0x2d442f[_0x51ed43[_0x1dc7('0x59')][_0x1dc7('0x94')]]=_0x51ed43[_0x1dc7('0x59')][_0x1dc7('0x7c')];return db[_0x1dc7('0x9b')][_0x1dc7('0x58')](_0x2d442f,{'fields':_0xada450,'raw':!![]});}})[_0x1dc7('0x33')](handleEntityNotFound(_0x16e458,null))[_0x1dc7('0x33')](function(_0x11ff7f){if(_0x11ff7f){_0x51ed43[_0x1dc7('0x9c')]=_0x11ff7f;var _0x543cb5={'ContactId':_0x11ff7f['id'],'phone':_0x51ed43[_0x1dc7('0x59')][_0x1dc7('0x7c')],'SmsAccountId':_0x501e90[_0x1dc7('0x56')]['id']};var _0x585c25={'ContactId':_0x11ff7f['id'],'SmsAccountId':_0x501e90['params']['id'],'closed':![]};return db['SmsInteraction'][_0x1dc7('0x57')]({'where':_0x585c25})[_0x1dc7('0x33')](function(_0x20b208){if(_0x20b208){return[_0x20b208,![]];}return db[_0x1dc7('0x9d')][_0x1dc7('0x58')](_0x543cb5)[_0x1dc7('0x33')](function(_0x1b2e94){return[_0x1b2e94,!![]];});});}})[_0x1dc7('0x9e')](function(_0x2baab9,_0x24e6d5){_0x51ed43[_0x1dc7('0x9f')]=_0x2baab9[_0x1dc7('0x5d')]({'plain':!![]});_0x51ed43[_0x1dc7('0x9f')][_0x1dc7('0xa0')]=![];if(_0x24e6d5){if(_0x51ed43[_0x1dc7('0x6f')][_0x1dc7('0xa1')]){_0x51ed43['applications'][_0x1dc7('0xa2')]({'id':0x0,'priority':_0x51ed43[_0x1dc7('0x70')][_0x1dc7('0x46')]+0x1,'app':_0x1dc7('0xa3'),'appdata':'unmanaged','interval':'*,*,*,*'});}_0x51ed43[_0x1dc7('0x9f')][_0x1dc7('0xa0')]=!![];}return db[_0x1dc7('0xa4')][_0x1dc7('0x58')]({'phone':_0x51ed43[_0x1dc7('0x59')][_0x1dc7('0x7c')],'messageId':_0x51ed43['body'][_0x1dc7('0x83')],'body':_0x51ed43[_0x1dc7('0x59')][_0x1dc7('0x59')],'SmsAccountId':_0x501e90[_0x1dc7('0x56')]['id'],'SmsInteractionId':_0x2baab9['id'],'direction':'in','ContactId':_0x2baab9[_0x1dc7('0xa5')],'AttachmentId':_0x51ed43[_0x1dc7('0x59')][_0x1dc7('0xa6')]});})['then'](function(_0x54e8d6){_0x51ed43['message']=_0x54e8d6;if(!_0x51ed43[_0x1dc7('0x9f')][_0x1dc7('0xa7')])return;return db[_0x1dc7('0xa8')]['find']({'attributes':['id','name'],'where':{'id':_0x51ed43[_0x1dc7('0x9f')][_0x1dc7('0xa7')]}});})[_0x1dc7('0x33')](function(_0xef2d08){if(_0xef2d08){_0x51ed43[_0x1dc7('0x70')][_0x1dc7('0xa9')]({'id':0x0,'priority':0x0,'app':_0x1dc7('0xaa'),'appdata':_0xef2d08[_0x1dc7('0x38')]+','+(_0x51ed43[_0x1dc7('0x6f')][_0x1dc7('0xab')]||0xa),'interval':_0x1dc7('0xac')});}if(!_0x51ed43[_0x1dc7('0x9f')][_0x1dc7('0xad')])return;return db[_0x1dc7('0xae')][_0x1dc7('0x57')]({'attributes':['id',_0x1dc7('0x38')],'where':{'id':_0x51ed43['interaction'][_0x1dc7('0xad')]}});})[_0x1dc7('0x33')](function(_0x204a75){if(_0x204a75){_0x51ed43[_0x1dc7('0x70')][_0x1dc7('0xa9')]({'id':0x0,'priority':0x1,'app':_0x1dc7('0xaf'),'appdata':_0x204a75['name']+','+(_0x51ed43[_0x1dc7('0x6f')]['waitForTheAssignedQueue']||0x12c),'interval':_0x1dc7('0xac')});}return respondWithRpcPromise(_0x1dc7('0xb0'),_0x1dc7('0xb1'),_0x51ed43);})[_0x1dc7('0x33')](function(_0x3a30e7){if(_0x3a30e7){var _0x426acb=0xc8;var _0x1957d3='receiveMessage';logger[_0x1dc7('0x20')](_0x1dc7('0xb2'),_0x1957d3,_0x426acb,'entity\x20found');logger[_0x1dc7('0x23')](_0x1dc7('0xb3'),_0x1957d3,_0x426acb,_0x1dc7('0xb4'),JSON[_0x1dc7('0xb5')](_0x3a30e7));if(_0x51ed43['account']['type']===_0x1dc7('0x7b')){return _0x16e458[_0x1dc7('0x2a')](_0x426acb)[_0x1dc7('0x30')]('Content-Type',_0x1dc7('0xb6'))[_0x1dc7('0xb7')]('\x0a');}else{return _0x16e458[_0x1dc7('0x2a')](_0x426acb)[_0x1dc7('0x2b')](_0x3a30e7);}}})[_0x1dc7('0x28')](handleError(_0x16e458,null));};exports[_0x1dc7('0xb8')]=function(_0x11f3d2,_0x27d63c){var _0xaaf521=_0x11f3d2['params']['id'];var _0x58a68e=_0x11f3d2['body'];var _0x2b8f5a=0xc8;var _0x3e0fbc=null;return db[_0x1dc7('0xb9')][_0x1dc7('0xba')]({'isolationLevel':db['sequelize'][_0x1dc7('0xbb')][_0x1dc7('0xbc')][_0x1dc7('0xbd')]},function(_0x25ba97){return db[_0x1dc7('0x3c')][_0x1dc7('0x64')]({'where':{'id':_0xaaf521},'transaction':_0x25ba97})[_0x1dc7('0x33')](function(_0xee5333){if(_0xee5333){return db['SmsApplication'][_0x1dc7('0x34')]({'where':{'SmsAccountId':_0xaaf521},'transaction':_0x25ba97})[_0x1dc7('0x33')](function(){var _0x3fab30=_['map'](_0x58a68e,function(_0x2a52ca){_0x2a52ca['SmsAccountId']=_0xaaf521;return _0x2a52ca;});return db[_0x1dc7('0x6d')][_0x1dc7('0xbe')](_0x3fab30,{'transaction':_0x25ba97});});}else{_0x2b8f5a=0x194;_0x3e0fbc=[];}});})[_0x1dc7('0x33')](function(){if(_0x2b8f5a!==0x194){return db[_0x1dc7('0x6d')][_0x1dc7('0xbf')]({'where':{'SmsAccountId':_0xaaf521},'order':_0x1dc7('0xc0')})[_0x1dc7('0x33')](function(_0x3d88c5){_0x3e0fbc=_0x3d88c5;});}})[_0x1dc7('0x28')](function(_0x2da04a){_0x2b8f5a=0x1f4;logger[_0x1dc7('0x24')](_0x2da04a['stack']);if(_0x2da04a[_0x1dc7('0x38')]){delete _0x2da04a[_0x1dc7('0x38')];}_0x3e0fbc=_0x2da04a;})['finally'](function(){if(_0x3e0fbc===null){_0x27d63c['sendStatus'](_0x2b8f5a);}else{if(_0x2b8f5a===0x1f4){_0x27d63c[_0x1dc7('0x2a')](_0x2b8f5a)[_0x1dc7('0xb7')](_0x3e0fbc);}else{_0x27d63c[_0x1dc7('0x2a')](_0x2b8f5a)[_0x1dc7('0x2b')](_0x3e0fbc);}}});};exports[_0x1dc7('0xc1')]=function(_0x345851,_0x18167f,_0x2a75ef){var _0x1b5ade={};var _0x2eec8d={};var _0x53021c;var _0x1cad63;return db[_0x1dc7('0x3c')][_0x1dc7('0x64')]({'where':{'id':_0x345851[_0x1dc7('0x56')]['id']}})[_0x1dc7('0x33')](handleEntityNotFound(_0x18167f,null))['then'](function(_0x25b631){if(_0x25b631){_0x53021c=_0x25b631;_0x2eec8d['model']=_[_0x1dc7('0x42')](db[_0x1dc7('0x6d')][_0x1dc7('0x3d')]);_0x2eec8d[_0x1dc7('0x41')]=_[_0x1dc7('0x42')](_0x345851['query']);_0x2eec8d[_0x1dc7('0x4b')]=_[_0x1dc7('0x44')](_0x2eec8d[_0x1dc7('0x40')],_0x2eec8d[_0x1dc7('0x41')]);_0x1b5ade[_0x1dc7('0x43')]=_[_0x1dc7('0x44')](_0x2eec8d[_0x1dc7('0x40')],qs[_0x1dc7('0x45')](_0x345851['query'][_0x1dc7('0x45')]));_0x1b5ade[_0x1dc7('0x43')]=_0x1b5ade['attributes'][_0x1dc7('0x46')]?_0x1b5ade[_0x1dc7('0x43')]:_0x2eec8d[_0x1dc7('0x40')];_0x1b5ade[_0x1dc7('0x48')]=qs['sort'](_0x345851[_0x1dc7('0x41')][_0x1dc7('0x49')]);_0x1b5ade[_0x1dc7('0x4a')]=qs[_0x1dc7('0x4b')](_['pick'](_0x345851['query'],_0x2eec8d[_0x1dc7('0x4b')]));if(_0x345851[_0x1dc7('0x41')][_0x1dc7('0x4d')]){_0x1b5ade[_0x1dc7('0x4a')]=_[_0x1dc7('0x4e')](_0x1b5ade['where'],{'$or':_['map'](_0x1b5ade[_0x1dc7('0x43')],function(_0x1c76a0){var _0x5e70f2={};_0x5e70f2[_0x1c76a0]={'$like':'%'+_0x345851[_0x1dc7('0x41')][_0x1dc7('0x4d')]+'%'};return _0x5e70f2;})});}_0x1b5ade=_['merge']({},_0x1b5ade,_0x345851['options']);return _0x53021c[_0x1dc7('0xc1')](_0x1b5ade);}})[_0x1dc7('0x33')](function(_0x408864){if(_0x408864){_0x1cad63=_0x408864[_0x1dc7('0x46')];if(!_0x345851['query']['hasOwnProperty'](_0x1dc7('0x47'))){_0x1b5ade[_0x1dc7('0x2d')]=qs[_0x1dc7('0x2d')](_0x345851[_0x1dc7('0x41')][_0x1dc7('0x2d')]);_0x1b5ade[_0x1dc7('0x2c')]=qs[_0x1dc7('0x2c')](_0x345851['query'][_0x1dc7('0x2c')]);}return _0x53021c[_0x1dc7('0xc1')](_0x1b5ade);}})[_0x1dc7('0x33')](function(_0x6bafba){if(_0x6bafba){return _0x6bafba?{'count':_0x1cad63,'rows':_0x6bafba}:null;}})['then'](respondWithResult(_0x18167f,null))[_0x1dc7('0x28')](handleError(_0x18167f,null));};exports[_0x1dc7('0xc2')]=function(_0x4555a3,_0x11b709,_0x2930ba){var _0xbf8a39={'raw':![],'where':{}};var _0x2accf0={};var _0x50f950={'count':0x0,'rows':[]};return db[_0x1dc7('0x3c')][_0x1dc7('0x64')]({'where':{'id':_0x4555a3[_0x1dc7('0x56')]['id']}})[_0x1dc7('0x33')](handleEntityNotFound(_0x11b709,null))[_0x1dc7('0x33')](function(_0x33e1bd){if(_0x33e1bd){_0x2accf0[_0x1dc7('0x40')]=_[_0x1dc7('0x42')](db[_0x1dc7('0x9d')][_0x1dc7('0x3d')]);_0x2accf0[_0x1dc7('0x41')]=_['keys'](_0x4555a3[_0x1dc7('0x41')]);_0x2accf0[_0x1dc7('0x4b')]=_[_0x1dc7('0x44')](_0x2accf0[_0x1dc7('0x40')],_0x2accf0[_0x1dc7('0x41')]);_0xbf8a39[_0x1dc7('0x43')]=_[_0x1dc7('0x44')](_0x2accf0[_0x1dc7('0x40')],qs[_0x1dc7('0x45')](_0x4555a3[_0x1dc7('0x41')][_0x1dc7('0x45')]));_0xbf8a39[_0x1dc7('0x43')]=_0xbf8a39['attributes'][_0x1dc7('0x46')]?_0xbf8a39[_0x1dc7('0x43')]:_0x2accf0[_0x1dc7('0x40')];if(!_0x4555a3[_0x1dc7('0x41')][_0x1dc7('0x66')](_0x1dc7('0x47'))){_0xbf8a39[_0x1dc7('0x2d')]=qs[_0x1dc7('0x2d')](_0x4555a3[_0x1dc7('0x41')][_0x1dc7('0x2d')]);_0xbf8a39[_0x1dc7('0x2c')]=qs[_0x1dc7('0x2c')](_0x4555a3[_0x1dc7('0x41')][_0x1dc7('0x2c')]);}_0xbf8a39[_0x1dc7('0x48')]=qs['sort'](_0x4555a3[_0x1dc7('0x41')]['sort']);_0xbf8a39[_0x1dc7('0x4a')]=qs[_0x1dc7('0x4b')](_[_0x1dc7('0x4c')](_0x4555a3[_0x1dc7('0x41')],_0x2accf0[_0x1dc7('0x4b')]));_0xbf8a39[_0x1dc7('0x4a')][_0x1dc7('0x62')]=_0x33e1bd['id'];if(_0x4555a3['query'][_0x1dc7('0x4d')]){_0xbf8a39[_0x1dc7('0x4a')]=_[_0x1dc7('0x4e')](_0xbf8a39['where'],{'$or':_['map'](_0xbf8a39[_0x1dc7('0x43')],function(_0x4768d2){var _0x8320b={};_0x8320b[_0x4768d2]={'$like':'%'+_0x4555a3['query'][_0x1dc7('0x4d')]+'%'};return _0x8320b;})});}_0xbf8a39=_[_0x1dc7('0x4e')]({},_0xbf8a39,_0x4555a3[_0x1dc7('0x50')]);return db[_0x1dc7('0x9d')]['count']({'where':_0xbf8a39[_0x1dc7('0x4a')]})[_0x1dc7('0x33')](function(_0x39d58b){_0x50f950[_0x1dc7('0x2f')]=_0x39d58b;if(_0x4555a3[_0x1dc7('0x41')]['includeAll']){_0xbf8a39[_0x1dc7('0x52')]=[{'model':db[_0x1dc7('0x9b')],'as':_0x1dc7('0xc3'),'required':![]},{'model':db[_0x1dc7('0xa8')],'as':_0x1dc7('0xc4'),'attributes':[_0x1dc7('0x38'),'fullname',_0x1dc7('0xc5')],'required':![]},{'model':db['Tag'],'as':_0x1dc7('0xc6'),'attributes':['id',_0x1dc7('0x38'),_0x1dc7('0xc7')],'where':_0x4555a3['query']['tag']?{'id':_0x4555a3[_0x1dc7('0x41')]['tag']}:undefined,'required':_0x4555a3[_0x1dc7('0x41')]['tag']?!![]:![]}];}return db['SmsInteraction'][_0x1dc7('0x53')](_0xbf8a39);})['then'](function(_0x2a7ac5){_0x50f950[_0x1dc7('0x54')]=_0x2a7ac5;return _0x50f950;});}})[_0x1dc7('0x33')](respondWithFilteredResult(_0x11b709,_0xbf8a39))[_0x1dc7('0x28')](handleError(_0x11b709,null));};exports['send']=function(_0x7ae488,_0x33668f,_0x42f576){var _0x59cda4,_0x2b6fe9,_0x1dcd26;if(_[_0x1dc7('0x91')](_0x7ae488[_0x1dc7('0x59')][_0x1dc7('0x59')])||_0x7ae488[_0x1dc7('0x59')][_0x1dc7('0x59')]===''){throw new db[(_0x1dc7('0x72'))][(_0x1dc7('0x73'))](_0x1dc7('0x93'));}if(_['isNil'](_0x7ae488[_0x1dc7('0x59')]['to'])){throw new db['Sequelize'][(_0x1dc7('0x73'))]('to\x20is\x20mandatory');}_0x59cda4=_0x7ae488[_0x1dc7('0x59')]['to'];return db[_0x1dc7('0x3c')][_0x1dc7('0x57')]({'where':{'id':_0x7ae488[_0x1dc7('0x56')]['id']},'include':[{'model':db[_0x1dc7('0x97')],'as':'List','include':[{'model':db[_0x1dc7('0x9b')],'as':'Contacts','where':{'mobile':_0x59cda4},'limit':0x1,'order':[[_0x1dc7('0x76'),_0x1dc7('0xc8')]]}]}]})[_0x1dc7('0x33')](handleEntityNotFound(_0x33668f,null))[_0x1dc7('0x33')](function(_0x3f56e0){if(_0x3f56e0&&_0x3f56e0[_0x1dc7('0xc9')]){_0x2b6fe9=_0x3f56e0['get']({'plain':!![]});if(_0x2b6fe9[_0x1dc7('0xc9')]&&_0x2b6fe9['List'][_0x1dc7('0x98')][_0x1dc7('0x46')]){return _0x2b6fe9[_0x1dc7('0xc9')][_0x1dc7('0x98')][0x0];}return db['CmContact']['create'](_['defaults'](_0x7ae488['body'],{'firstName':_0x59cda4,'mobile':_0x59cda4,'phone':_0x59cda4,'ListId':_0x2b6fe9[_0x1dc7('0x79')]}));}})['then'](handleEntityNotFound(_0x33668f,null))[_0x1dc7('0x33')](function(_0x529de7){if(_0x529de7){_0x1dcd26=_0x529de7;return db['SmsInteraction'][_0x1dc7('0x57')]({'where':{'ContactId':_0x1dcd26['id'],'closed':![],'SmsAccountId':_0x2b6fe9['id']}})['then'](function(_0x4a1fee){if(_0x4a1fee){return[_0x4a1fee,![]];}return db[_0x1dc7('0x9d')]['create']({'UserId':_0x7ae488[_0x1dc7('0x5a')]['id'],'ContactId':_0x1dcd26['id'],'SmsAccountId':_0x2b6fe9['id'],'phone':_0x59cda4,'firstMsgDirection':'out','Messages':[_[_0x1dc7('0x4e')](_0x7ae488[_0x1dc7('0x59')],{'read':![],'body':_0x7ae488['body'][_0x1dc7('0x59')],'phone':_0x59cda4,'SmsAccountId':_0x2b6fe9['id'],'UserId':_0x7ae488[_0x1dc7('0x5a')]['id'],'ContactId':_0x1dcd26['id']})]},{'include':[{'model':db[_0x1dc7('0xa4')],'as':_0x1dc7('0xca')}]})[_0x1dc7('0x33')](function(_0x960091){return[_0x960091,!![]];});});}})[_0x1dc7('0x9e')](function(_0x56f5a5,_0x298718){if(_0x298718){return _0x56f5a5;}return db[_0x1dc7('0xa4')]['create'](_[_0x1dc7('0x4e')](_0x7ae488[_0x1dc7('0x59')],{'read':![],'body':_0x7ae488[_0x1dc7('0x59')][_0x1dc7('0x59')],'phone':_0x59cda4,'SmsAccountId':_0x2b6fe9['id'],'SmsInteractionId':_0x56f5a5['id'],'UserId':_0x7ae488['user']['id'],'ContactId':_0x1dcd26['id']}))[_0x1dc7('0x33')](function(_0x58911b){_0x56f5a5[_0x1dc7('0xcb')]['Messages']=[];_0x56f5a5[_0x1dc7('0xcb')][_0x1dc7('0xca')][_0x1dc7('0xa2')](_0x58911b['dataValues']);return _0x56f5a5;});})[_0x1dc7('0x33')](respondWithResult(_0x33668f,null))[_0x1dc7('0x28')](handleError(_0x33668f,null));};exports['status']=function(_0x188ca4,_0x3292ea,_0x2dc499){if(_0x188ca4[_0x1dc7('0x59')]['id']){delete _0x188ca4[_0x1dc7('0x59')]['id'];}var _0x53ce86,_0x4b30f2,_0x4d7d25;return db[_0x1dc7('0x3c')]['find']({'where':{'id':_0x188ca4['params']['id']}})[_0x1dc7('0x33')](handleEntityNotFound(_0x3292ea,null))['then'](function(_0x198b42){if(_0x198b42){_0x4d7d25=_0x198b42;logger[_0x1dc7('0x23')](_0x1dc7('0xb2'),_0x1dc7('0x2a'),'received\x20delivery\x20report\x20from',_0x198b42[_0x1dc7('0x3e')],util['inspect'](_0x188ca4['body'],{'showHidden':![],'depth':null}));switch(_0x198b42['type']){case'skebby':if(_0x188ca4[_0x1dc7('0x59')]['skebby_dispatch_id']&&_0x188ca4[_0x1dc7('0x59')][_0x1dc7('0x2a')]){_0x4b30f2=_0x188ca4[_0x1dc7('0x59')][_0x1dc7('0x2a')];return db['SmsMessage'][_0x1dc7('0x57')]({'where':{'messageId':_0x188ca4[_0x1dc7('0x59')][_0x1dc7('0xcc')]}});}break;case _0x1dc7('0x81'):if(_0x188ca4[_0x1dc7('0x59')][_0x1dc7('0xcd')]&&_0x188ca4[_0x1dc7('0x59')][_0x1dc7('0xce')]){_0x4b30f2=_0x188ca4[_0x1dc7('0x59')][_0x1dc7('0xce')];return db[_0x1dc7('0xa4')][_0x1dc7('0x57')]({'where':{'messageId':_0x188ca4[_0x1dc7('0x59')]['requestid']}});}break;case _0x1dc7('0x82'):if(_0x188ca4[_0x1dc7('0x59')][_0x1dc7('0x84')]&&_0x188ca4[_0x1dc7('0x59')][_0x1dc7('0xcf')]){_0x4b30f2=_0x188ca4['body'][_0x1dc7('0xcf')];return db[_0x1dc7('0xa4')]['find']({'where':{'messageId':_0x188ca4[_0x1dc7('0x59')][_0x1dc7('0x84')]}});}break;case _0x1dc7('0x88'):var _0x1811d0=_0x188ca4[_0x1dc7('0x59')][_0x1dc7('0x89')][0x0];if(_0x1811d0[_0x1dc7('0x83')]&&_0x1811d0[_0x1dc7('0x2a')]['groupName']===_0x1dc7('0xd0')){_0x4b30f2=_0x1811d0[_0x1dc7('0x2a')]['groupName'];return db[_0x1dc7('0xa4')]['find']({'where':{'messageId':_0x1811d0['messageId']}});}break;case'clickatell':if(_0x188ca4[_0x1dc7('0x59')][_0x1dc7('0x83')]&&_0x188ca4['body'][_0x1dc7('0x2a')]){_0x4b30f2=_0x188ca4['body'][_0x1dc7('0x2a')];return db['SmsMessage'][_0x1dc7('0x57')]({'where':{'messageId':_0x188ca4[_0x1dc7('0x59')]['messageId']}});}break;case _0x1dc7('0x8e'):if(_0x188ca4[_0x1dc7('0x59')][0x0][_0x1dc7('0x26')]['id']){_0x4b30f2=_0x188ca4[_0x1dc7('0x59')][0x0][_0x1dc7('0x3e')];return db[_0x1dc7('0xa4')][_0x1dc7('0x57')]({'where':{'messageId':_0x188ca4[_0x1dc7('0x59')][0x0][_0x1dc7('0x26')]['id']}});}break;case _0x1dc7('0x8f'):if(_0x188ca4['body'][_0x1dc7('0xd1')]&&_0x188ca4[_0x1dc7('0x59')][_0x1dc7('0x2a')]){_0x4b30f2=_0x188ca4[_0x1dc7('0x59')]['status'];return db[_0x1dc7('0xa4')][_0x1dc7('0x57')]({'where':{'messageId':_0x188ca4[_0x1dc7('0x59')][_0x1dc7('0xd1')]}});}break;}}})['then'](handleEntityNotFound(_0x3292ea,null))[_0x1dc7('0x33')](function(_0x3de22f){if(_0x3de22f){_0x53ce86=_0x3de22f;switch(_0x4d7d25['type']){case _0x1dc7('0x7f'):if(_0x4b30f2===_0x1dc7('0xd0')){return _0x53ce86[_0x1dc7('0xd2')]({'read':!![]});}else{logger[_0x1dc7('0x24')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x1dc7('0x7f'),util[_0x1dc7('0xd3')](_0x188ca4[_0x1dc7('0x59')],{'showHidden':![],'depth':null}));}break;case'connectel':if(_0x4b30f2==='1'){return _0x53ce86[_0x1dc7('0xd2')]({'read':!![]});}else{logger[_0x1dc7('0x24')](_0x1dc7('0xb2'),_0x1dc7('0x2a'),_0x1dc7('0x7f'),util[_0x1dc7('0xd3')](_0x188ca4[_0x1dc7('0x59')],{'showHidden':![],'depth':null}));}break;case _0x1dc7('0x82'):if(!_0x188ca4[_0x1dc7('0x59')][_0x1dc7('0xd4')]&&_0x4b30f2>=0xc8&&_0x4b30f2<=0xce){return _0x53ce86[_0x1dc7('0xd2')]({'read':!![]});}else{logger[_0x1dc7('0x24')](_0x1dc7('0xb2'),_0x1dc7('0x2a'),_0x1dc7('0x82'),util[_0x1dc7('0xd3')](_0x188ca4['body'],{'showHidden':![],'depth':null}));}break;case _0x1dc7('0x88'):var _0x10333f=_0x188ca4['body'][_0x1dc7('0x89')][0x0];if(_0x10333f['status'][_0x1dc7('0xd5')]===_0x1dc7('0xd0')){return _0x53ce86['update']({'read':!![]});}else{logger[_0x1dc7('0x24')](_0x1dc7('0xb2'),_0x1dc7('0x2a'),_0x1dc7('0x88'),util[_0x1dc7('0xd3')](_0x188ca4[_0x1dc7('0x59')],{'showHidden':![],'depth':null}));}break;case _0x1dc7('0x8d'):if(_0x4b30f2=='DELIVERED_TO_GATEWAY'||_0x4b30f2==_0x1dc7('0xd6')){return _0x53ce86[_0x1dc7('0xd2')]({'read':!![]});}else{logger[_0x1dc7('0x24')](_0x1dc7('0xb2'),_0x1dc7('0x2a'),'clickatell',util[_0x1dc7('0xd3')](_0x188ca4[_0x1dc7('0x59')],{'showHidden':![],'depth':null}));}break;case _0x1dc7('0x8e'):if(_0x4b30f2==_0x1dc7('0xd7')){return _0x53ce86[_0x1dc7('0xd2')]({'read':!![]});}else{logger[_0x1dc7('0x24')](_0x1dc7('0xb2'),_0x1dc7('0x2a'),_0x1dc7('0x8e'),util[_0x1dc7('0xd3')](_0x188ca4[_0x1dc7('0x59')],{'showHidden':![],'depth':null}));}break;case _0x1dc7('0x8f'):if(_0x4b30f2===_0x1dc7('0xd8')||_0x4b30f2===_0x1dc7('0xd9')){return _0x53ce86[_0x1dc7('0xd2')]({'read':!![]});}else{logger[_0x1dc7('0x24')](_0x1dc7('0xb2'),_0x1dc7('0x2a'),'intelepeer',util['inspect'](_0x188ca4[_0x1dc7('0x59')],{'showHidden':![],'depth':null}));}break;}return _0x53ce86;}})[_0x1dc7('0x33')](respondWithResult(_0x3292ea,null))[_0x1dc7('0x28')](handleError(_0x3292ea,null));};exports[_0x1dc7('0xda')]=function(_0x528632,_0x5728e2,_0x5800f2){var _0x2ce399,_0x1bea9c,_0x149d7d;return db['SmsAccount'][_0x1dc7('0x57')]({'where':{'id':_0x528632['params']['id']}})[_0x1dc7('0x33')](handleEntityNotFound(_0x5728e2,null))['then'](function(_0x3f8d3f){if(_0x3f8d3f){_0x149d7d=_0x3f8d3f;logger[_0x1dc7('0x23')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x1dc7('0x2a'),'received\x20delivery\x20report\x20from',_0x3f8d3f[_0x1dc7('0x3e')],util['inspect'](_0x528632[_0x1dc7('0x41')],{'showHidden':![],'depth':null}));switch(_0x3f8d3f[_0x1dc7('0x3e')]){case _0x1dc7('0x8a'):if(_0x528632['query'][_0x1dc7('0xdb')]&&_0x528632[_0x1dc7('0x41')][_0x1dc7('0xdc')]){_0x1bea9c=_0x528632[_0x1dc7('0x41')][_0x1dc7('0xdc')];return db[_0x1dc7('0xa4')][_0x1dc7('0x57')]({'where':{'messageId':_0x528632['query'][_0x1dc7('0xdb')]}});}break;}}})[_0x1dc7('0x33')](handleEntityNotFound(_0x5728e2,null))[_0x1dc7('0x33')](function(_0x4199b3){if(_0x4199b3){_0x2ce399=_0x4199b3;switch(_0x149d7d[_0x1dc7('0x3e')]){case _0x1dc7('0x8a'):if(_0x1bea9c==='2'||_0x1bea9c==='6'){return _0x2ce399[_0x1dc7('0xd2')]({'read':!![]});}else{logger[_0x1dc7('0x24')](_0x1dc7('0xb2'),_0x1dc7('0x2a'),_0x1dc7('0x8a'),util['inspect'](_0x528632[_0x1dc7('0x41')],{'showHidden':![],'depth':null}));};break;}return _0x2ce399;}})['then'](respondWithResult(_0x5728e2,null))[_0x1dc7('0x28')](handleError(_0x5728e2,null));};exports['addAgents']=function(_0x21eb0d,_0x147d88,_0x59339f){return db[_0x1dc7('0x3c')][_0x1dc7('0x57')]({'where':{'id':_0x21eb0d[_0x1dc7('0x56')]['id']}})['then'](handleEntityNotFound(_0x147d88,null))[_0x1dc7('0x33')](function(_0x1b01a8){if(_0x1b01a8){return _0x1b01a8['addAgents'](_0x21eb0d['body']['ids'],_['omit'](_0x21eb0d[_0x1dc7('0x59')],[_0x1dc7('0x68'),'id'])||{})['spread'](function(_0xaddf88){for(var _0x7711a9=0x0;_0x7711a9<_0x21eb0d[_0x1dc7('0x59')][_0x1dc7('0x68')][_0x1dc7('0x46')];_0x7711a9+=0x1){socket['emit'](_0x1dc7('0xdd'),{'UserId':Number(_0x21eb0d[_0x1dc7('0x59')][_0x1dc7('0x68')][_0x7711a9]),'SmsAccountId':Number(_0x21eb0d['params']['id'])});}return _0xaddf88;});}})['then'](respondWithResult(_0x147d88,null))[_0x1dc7('0x28')](handleError(_0x147d88,null));};exports['removeAgents']=function(_0x4ef951,_0x7cecb8,_0x5bcf50){return db['SmsAccount'][_0x1dc7('0x57')]({'where':{'id':_0x4ef951[_0x1dc7('0x56')]['id']}})['then'](handleEntityNotFound(_0x7cecb8,null))[_0x1dc7('0x33')](function(_0x51768a){if(_0x51768a){return _0x51768a[_0x1dc7('0xde')](_0x4ef951[_0x1dc7('0x41')][_0x1dc7('0x68')])['then'](function(){if(_[_0x1dc7('0xdf')](_0x4ef951['query'][_0x1dc7('0x68')])){for(var _0x3ffb1c=0x0;_0x3ffb1c<_0x4ef951[_0x1dc7('0x41')][_0x1dc7('0x68')][_0x1dc7('0x46')];_0x3ffb1c+=0x1){socket[_0x1dc7('0xe0')]('userSmsAccount:remove',{'UserId':Number(_0x4ef951['query'][_0x1dc7('0x68')][_0x3ffb1c]),'SmsAccountId':Number(_0x4ef951[_0x1dc7('0x56')]['id'])});}}else{socket[_0x1dc7('0xe0')]('userSmsAccount:remove',{'UserId':Number(_0x4ef951[_0x1dc7('0x41')][_0x1dc7('0x68')]),'SmsAccountId':Number(_0x4ef951['params']['id'])});}});}})[_0x1dc7('0x33')](respondWithStatusCode(_0x7cecb8,null))[_0x1dc7('0x28')](handleError(_0x7cecb8,null));};exports[_0x1dc7('0xe1')]=function(_0x4e16c8,_0x1a1d31,_0x363d74){var _0x26b40b={};var _0xc15914={};var _0x3848f4;var _0xec13a0;return db['SmsAccount'][_0x1dc7('0x64')]({'where':{'id':_0x4e16c8['params']['id']}})[_0x1dc7('0x33')](handleEntityNotFound(_0x1a1d31,null))[_0x1dc7('0x33')](function(_0x51c6a5){if(_0x51c6a5){_0x3848f4=_0x51c6a5;_0xc15914[_0x1dc7('0x40')]=_['keys'](db[_0x1dc7('0xa8')]['rawAttributes']);_0xc15914['query']=_[_0x1dc7('0x42')](_0x4e16c8[_0x1dc7('0x41')]);_0xc15914[_0x1dc7('0x4b')]=_[_0x1dc7('0x44')](_0xc15914['model'],_0xc15914['query']);_0x26b40b[_0x1dc7('0x43')]=_[_0x1dc7('0x44')](_0xc15914[_0x1dc7('0x40')],qs['fields'](_0x4e16c8[_0x1dc7('0x41')][_0x1dc7('0x45')]));_0x26b40b['attributes']=_0x26b40b[_0x1dc7('0x43')][_0x1dc7('0x46')]?_0x26b40b[_0x1dc7('0x43')]:_0xc15914[_0x1dc7('0x40')];_0x26b40b[_0x1dc7('0x48')]=qs[_0x1dc7('0x49')](_0x4e16c8['query'][_0x1dc7('0x49')]);_0x26b40b['where']=qs[_0x1dc7('0x4b')](_[_0x1dc7('0x4c')](_0x4e16c8[_0x1dc7('0x41')],_0xc15914[_0x1dc7('0x4b')]));if(_0x4e16c8[_0x1dc7('0x41')][_0x1dc7('0x4d')]){_0x26b40b[_0x1dc7('0x4a')]=_[_0x1dc7('0x4e')](_0x26b40b[_0x1dc7('0x4a')],{'$or':_[_0x1dc7('0x3b')](_0x26b40b[_0x1dc7('0x43')],function(_0x516ec7){var _0x315515={};_0x315515[_0x516ec7]={'$like':'%'+_0x4e16c8[_0x1dc7('0x41')][_0x1dc7('0x4d')]+'%'};return _0x315515;})});}_0x26b40b=_['merge']({},_0x26b40b,_0x4e16c8[_0x1dc7('0x50')]);return _0x3848f4[_0x1dc7('0xe1')](_0x26b40b);}})[_0x1dc7('0x33')](function(_0x79bc5){if(_0x79bc5){_0xec13a0=_0x79bc5[_0x1dc7('0x46')];if(!_0x4e16c8[_0x1dc7('0x41')]['hasOwnProperty'](_0x1dc7('0x47'))){_0x26b40b[_0x1dc7('0x2d')]=qs[_0x1dc7('0x2d')](_0x4e16c8[_0x1dc7('0x41')]['limit']);_0x26b40b[_0x1dc7('0x2c')]=qs[_0x1dc7('0x2c')](_0x4e16c8[_0x1dc7('0x41')][_0x1dc7('0x2c')]);}return _0x3848f4[_0x1dc7('0xe1')](_0x26b40b);}})[_0x1dc7('0x33')](function(_0x3676d9){if(_0x3676d9){return _0x3676d9?{'count':_0xec13a0,'rows':_0x3676d9}:null;}})[_0x1dc7('0x33')](respondWithResult(_0x1a1d31,null))[_0x1dc7('0x28')](handleError(_0x1a1d31,null));}; \ No newline at end of file +var _0xf93a=['getAgents','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./smsAccount.socket','register','jayson/promise','http','then','SmsAccount,\x20%s,\x20%s','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','SmsAccounts','UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause','map','SmsAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','params','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','SmsAccountId','Disposition','getDispositions','findOne','nolimit','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','removeAnswers','notify','account','applications','orderBy','Applications','CmContact','ValidationError','difference','createdAt','updatedAt','ListId','mobile','twilio','from','From','Body','messageId','skebby','sender','text','clicksend','message_id','plivo','infobip','results','csc','originatingAddress','segmentedMessage','clickatell','fromNumber','replyMessageId','intelepeer','isNil','Sequelize','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','Contacts','DESC','list','contact','SmsInteraction','spread','interaction','created','unmanaged','*,*,*,*','SmsMessage','UserId','User','unshift','agent','waitForTheAssignedAgent','queueId','queue','waitForTheAssignedQueue','Start','receiveMessage','debug','entity\x20found','Content-Type','\x0a','addApplications','transaction','sequelize','SmsApplication','findAndCountAll','finally','getApplications','getInteractions','Contact','internal','color','tag','to\x20is\x20mandatory','CmList','List','out','Messages','dataValues','push','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','requestid','statusInt','groupName','DELIVERED','redif','connectel','error_code','RECEIVED_BY_RECIPIENT','bandwidth','DELIVRD','statusGet','state','message-id','addAgents','omit','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove'];(function(_0x52ac48,_0x146d20){var _0x17b0f6=function(_0xfd2b28){while(--_0xfd2b28){_0x52ac48['push'](_0x52ac48['shift']());}};_0x17b0f6(++_0x146d20);}(_0xf93a,0xdb));var _0xaf93=function(_0x132730,_0x139a4c){_0x132730=_0x132730-0x0;var _0x1bf01f=_0xf93a[_0x132730];return _0x1bf01f;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xaf93('0x0'));var rp=require(_0xaf93('0x1'));var moment=require(_0xaf93('0x2'));var BPromise=require(_0xaf93('0x3'));var Mustache=require(_0xaf93('0x4'));var util=require(_0xaf93('0x5'));var path=require(_0xaf93('0x6'));var sox=require('sox');var csv=require(_0xaf93('0x7'));var ejs=require(_0xaf93('0x8'));var fs=require('fs');var fs_extra=require(_0xaf93('0x9'));var _=require(_0xaf93('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xaf93('0xb'));var toCsv=require(_0xaf93('0x7'));var querystring=require(_0xaf93('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xaf93('0xd'));var as=require(_0xaf93('0xe'));var hardwareService=require(_0xaf93('0xf'));var logger=require(_0xaf93('0x10'))(_0xaf93('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xaf93('0x12'));var db=require(_0xaf93('0x13'))['db'];config['redis']=_[_0xaf93('0x14')](config[_0xaf93('0x15')],{'host':_0xaf93('0x16'),'port':0x18eb});var socket=require(_0xaf93('0x17'))(new Redis(config['redis']));require(_0xaf93('0x18'))[_0xaf93('0x19')](socket);var jayson=require(_0xaf93('0x1a'));var client=jayson['client'][_0xaf93('0x1b')]({'port':0x232c});function respondWithRpcPromise(_0x5471fd,_0x811118,_0x2a2d72,_0x51f507){return new BPromise(function(_0x9cd40d,_0x1dd313){var _0x5f9068=_0x51f507||client;return _0x5f9068['request'](_0x5471fd,_0x2a2d72)[_0xaf93('0x1c')](function(_0x14fd20){logger['info'](_0xaf93('0x1d'),_0x811118,_0xaf93('0x1e'));logger['debug'](_0xaf93('0x1f'),_0x811118,_0xaf93('0x1e'),JSON[_0xaf93('0x20')](_0x14fd20));if(_0x14fd20['error']){if(_0x14fd20[_0xaf93('0x21')]['code']===0x1f4){logger[_0xaf93('0x21')](_0xaf93('0x1d'),_0x811118,_0x14fd20[_0xaf93('0x21')][_0xaf93('0x22')]);return _0x1dd313(_0x14fd20[_0xaf93('0x21')][_0xaf93('0x22')]);}logger[_0xaf93('0x21')]('SmsAccount,\x20%s,\x20%s',_0x811118,_0x14fd20['error'][_0xaf93('0x22')]);return _0x9cd40d(_0x14fd20[_0xaf93('0x21')][_0xaf93('0x22')]);}else{logger[_0xaf93('0x23')](_0xaf93('0x1d'),_0x811118,_0xaf93('0x1e'));_0x9cd40d(_0x14fd20[_0xaf93('0x24')][_0xaf93('0x22')]);}})[_0xaf93('0x25')](function(_0x135806){logger['error']('SmsAccount,\x20%s,\x20%s',_0x811118,_0x135806);_0x1dd313(_0x135806);});});}function respondWithStatusCode(_0x25f4e6,_0x2cc91b){_0x2cc91b=_0x2cc91b||0xcc;return function(_0x812ba5){if(_0x812ba5){return _0x25f4e6[_0xaf93('0x26')](_0x2cc91b);}return _0x25f4e6[_0xaf93('0x27')](_0x2cc91b)[_0xaf93('0x28')]();};}function respondWithResult(_0x3b5c6d,_0x509e0f){_0x509e0f=_0x509e0f||0xc8;return function(_0x190d85){if(_0x190d85){return _0x3b5c6d['status'](_0x509e0f)[_0xaf93('0x29')](_0x190d85);}};}function respondWithFilteredResult(_0x507db3,_0x20fb95){return function(_0x127b91){if(_0x127b91){var _0x137395=typeof _0x20fb95[_0xaf93('0x2a')]===_0xaf93('0x2b')&&typeof _0x20fb95['limit']==='undefined';var _0x4658d2=_0x127b91[_0xaf93('0x2c')];var _0x34bd01=_0x137395?0x0:_0x20fb95['offset'];var _0x3e1e67=_0x137395?_0x127b91['count']:_0x20fb95[_0xaf93('0x2a')]+_0x20fb95[_0xaf93('0x2d')];var _0x337267;if(_0x3e1e67>=_0x4658d2){_0x3e1e67=_0x4658d2;_0x337267=0xc8;}else{_0x337267=0xce;}_0x507db3[_0xaf93('0x27')](_0x337267);return _0x507db3[_0xaf93('0x2e')](_0xaf93('0x2f'),_0x34bd01+'-'+_0x3e1e67+'/'+_0x4658d2)['json'](_0x127b91);}return null;};}function patchUpdates(_0x2b639c){return function(_0x338243){try{jsonpatch[_0xaf93('0x30')](_0x338243,_0x2b639c,!![]);}catch(_0x52851e){return BPromise[_0xaf93('0x31')](_0x52851e);}return _0x338243[_0xaf93('0x32')]();};}function saveUpdates(_0x88b2d0,_0xf6fc81){return function(_0x405d62){if(_0x405d62){return _0x405d62[_0xaf93('0x33')](_0x88b2d0)[_0xaf93('0x1c')](function(_0x4311a4){return _0x4311a4;});}return null;};}function removeEntity(_0x52c1d0,_0x19ef60){return function(_0x14dd34){if(_0x14dd34){return _0x14dd34[_0xaf93('0x34')]()['then'](function(){var _0x532c53=_0x14dd34['get']({'plain':!![]});var _0x1d31c4=_0xaf93('0x35');return db[_0xaf93('0x36')][_0xaf93('0x34')]({'where':{'type':_0x1d31c4,'resourceId':_0x532c53['id']}})[_0xaf93('0x1c')](function(){return _0x14dd34;});})['then'](function(){_0x52c1d0[_0xaf93('0x27')](0xcc)[_0xaf93('0x28')]();});}};}function handleEntityNotFound(_0x2bb6cf,_0x8e84){return function(_0x1a91ce){if(!_0x1a91ce){_0x2bb6cf['sendStatus'](0x194);}return _0x1a91ce;};}function handleError(_0x13f5d7,_0x1d2979){_0x1d2979=_0x1d2979||0x1f4;return function(_0x3ad581){logger['error'](_0x3ad581[_0xaf93('0x37')]);if(_0x3ad581[_0xaf93('0x38')]){delete _0x3ad581[_0xaf93('0x38')];}_0x13f5d7[_0xaf93('0x27')](_0x1d2979)[_0xaf93('0x39')](_0x3ad581);};}exports[_0xaf93('0x3a')]=function(_0x87fe08,_0x10296){var _0x336f06={'include':[{'model':db[_0xaf93('0x3b')],'as':_0xaf93('0x3c')}]},_0xc1f3a7={},_0x444bcd={'count':0x0,'rows':[]};var _0x40c767=_[_0xaf93('0x3d')](db[_0xaf93('0x3e')][_0xaf93('0x3f')],function(_0x85dbc9){return{'name':_0x85dbc9[_0xaf93('0x40')],'type':_0x85dbc9[_0xaf93('0x41')][_0xaf93('0x42')]};});_0xc1f3a7[_0xaf93('0x43')]=_['map'](_0x40c767,_0xaf93('0x38'));_0xc1f3a7[_0xaf93('0x44')]=_[_0xaf93('0x45')](_0x87fe08[_0xaf93('0x44')]);_0xc1f3a7[_0xaf93('0x46')]=_[_0xaf93('0x47')](_0xc1f3a7[_0xaf93('0x43')],_0xc1f3a7[_0xaf93('0x44')]);_0x336f06['attributes']=_[_0xaf93('0x47')](_0xc1f3a7[_0xaf93('0x43')],qs[_0xaf93('0x48')](_0x87fe08[_0xaf93('0x44')]['fields']));_0x336f06[_0xaf93('0x49')]=_0x336f06['attributes'][_0xaf93('0x4a')]?_0x336f06[_0xaf93('0x49')]:_0xc1f3a7[_0xaf93('0x43')];if(!_0x87fe08[_0xaf93('0x44')][_0xaf93('0x4b')]('nolimit')){_0x336f06['limit']=qs['limit'](_0x87fe08[_0xaf93('0x44')][_0xaf93('0x2d')]);_0x336f06[_0xaf93('0x2a')]=qs[_0xaf93('0x2a')](_0x87fe08[_0xaf93('0x44')][_0xaf93('0x2a')]);}_0x336f06[_0xaf93('0x4c')]=qs[_0xaf93('0x4d')](_0x87fe08[_0xaf93('0x44')]['sort']);_0x336f06[_0xaf93('0x4e')]=qs[_0xaf93('0x46')](_[_0xaf93('0x4f')](_0x87fe08[_0xaf93('0x44')],_0xc1f3a7['filters']),_0x40c767);if(_0x87fe08[_0xaf93('0x44')][_0xaf93('0x50')]){_0x336f06[_0xaf93('0x4e')]=_[_0xaf93('0x51')](_0x336f06[_0xaf93('0x4e')],{'$or':_[_0xaf93('0x3d')](_0x40c767,function(_0x21f76e){if(_0x21f76e[_0xaf93('0x41')]!==_0xaf93('0x52')){var _0xa2010={};_0xa2010[_0x21f76e[_0xaf93('0x38')]]={'$like':'%'+_0x87fe08[_0xaf93('0x44')][_0xaf93('0x50')]+'%'};return _0xa2010;}})});}_0x336f06=_[_0xaf93('0x51')]({},_0x336f06,_0x87fe08['options']);var _0x2d8c0a={'where':_0x336f06[_0xaf93('0x4e')]};return db[_0xaf93('0x3e')][_0xaf93('0x2c')](_0x2d8c0a)['then'](function(_0x51ed1e){_0x444bcd['count']=_0x51ed1e;if(_0x87fe08[_0xaf93('0x44')][_0xaf93('0x53')]){_0x336f06[_0xaf93('0x54')]=[{'all':!![]}];}return db[_0xaf93('0x3e')][_0xaf93('0x55')](_0x336f06);})['then'](function(_0x52489c){_0x444bcd[_0xaf93('0x56')]=_0x52489c;return _0x444bcd;})['then'](respondWithFilteredResult(_0x10296,_0x336f06))[_0xaf93('0x25')](handleError(_0x10296,null));};exports['show']=function(_0x3f5dd2,_0x512b35){var _0x26a89d={'raw':![],'where':{'id':_0x3f5dd2[_0xaf93('0x57')]['id']},'include':[{'model':db[_0xaf93('0x3b')],'as':_0xaf93('0x3c')}]},_0x2ca97e={};_0x2ca97e[_0xaf93('0x43')]=_[_0xaf93('0x45')](db[_0xaf93('0x3e')][_0xaf93('0x3f')]);_0x2ca97e['query']=_[_0xaf93('0x45')](_0x3f5dd2[_0xaf93('0x44')]);_0x2ca97e[_0xaf93('0x46')]=_['intersection'](_0x2ca97e[_0xaf93('0x43')],_0x2ca97e[_0xaf93('0x44')]);_0x26a89d['attributes']=_[_0xaf93('0x47')](_0x2ca97e[_0xaf93('0x43')],qs['fields'](_0x3f5dd2[_0xaf93('0x44')][_0xaf93('0x48')]));_0x26a89d[_0xaf93('0x49')]=_0x26a89d[_0xaf93('0x49')][_0xaf93('0x4a')]?_0x26a89d[_0xaf93('0x49')]:_0x2ca97e['model'];if(_0x3f5dd2[_0xaf93('0x44')][_0xaf93('0x53')]){_0x26a89d[_0xaf93('0x54')]=[{'all':!![]}];}_0x26a89d=_['merge']({},_0x26a89d,_0x3f5dd2[_0xaf93('0x58')]);return db[_0xaf93('0x3e')][_0xaf93('0x59')](_0x26a89d)[_0xaf93('0x1c')](handleEntityNotFound(_0x512b35,null))[_0xaf93('0x1c')](respondWithResult(_0x512b35,null))['catch'](handleError(_0x512b35,null));};exports[_0xaf93('0x5a')]=function(_0x5c3ddf,_0x241cbd){return db[_0xaf93('0x3e')][_0xaf93('0x5a')](_0x5c3ddf[_0xaf93('0x5b')],{})[_0xaf93('0x1c')](function(_0x162a83){var _0x390384=_0x5c3ddf[_0xaf93('0x5c')][_0xaf93('0x5d')]({'plain':!![]});if(!_0x390384)throw new Error(_0xaf93('0x5e'));if(_0x390384[_0xaf93('0x5f')]===_0xaf93('0x5c')){var _0xf13d35=_0x162a83['get']({'plain':!![]});var _0xf86610='SmsAccounts';return db[_0xaf93('0x60')][_0xaf93('0x59')]({'where':{'name':_0xf86610,'userProfileId':_0x390384['userProfileId']},'raw':!![]})['then'](function(_0x3d3501){if(_0x3d3501&&_0x3d3501[_0xaf93('0x61')]===0x0){return db[_0xaf93('0x36')]['create']({'name':_0xf13d35[_0xaf93('0x38')],'resourceId':_0xf13d35['id'],'type':_0x3d3501[_0xaf93('0x38')],'sectionId':_0x3d3501['id']},{})[_0xaf93('0x1c')](function(){return _0x162a83;});}else{return _0x162a83;}})[_0xaf93('0x25')](function(_0x304669){logger['error'](_0xaf93('0x62'),_0x304669);throw _0x304669;});}return _0x162a83;})[_0xaf93('0x1c')](respondWithResult(_0x241cbd,0xc9))[_0xaf93('0x25')](handleError(_0x241cbd,null));};exports['update']=function(_0x2cbd86,_0x1b01c0){if(_0x2cbd86[_0xaf93('0x5b')]['id']){delete _0x2cbd86[_0xaf93('0x5b')]['id'];}return db['SmsAccount'][_0xaf93('0x59')]({'where':{'id':_0x2cbd86[_0xaf93('0x57')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})['then'](handleEntityNotFound(_0x1b01c0,null))['then'](saveUpdates(_0x2cbd86[_0xaf93('0x5b')],null))['then'](respondWithResult(_0x1b01c0,null))[_0xaf93('0x25')](handleError(_0x1b01c0,null));};exports[_0xaf93('0x34')]=function(_0x5130c6,_0x2752ee){return db[_0xaf93('0x3e')][_0xaf93('0x59')]({'where':{'id':_0x5130c6['params']['id']}})[_0xaf93('0x1c')](handleEntityNotFound(_0x2752ee,null))[_0xaf93('0x1c')](removeEntity(_0x2752ee,null))[_0xaf93('0x25')](handleError(_0x2752ee,null));};exports[_0xaf93('0x63')]=function(_0x5a2577,_0x48a749){return db['SmsAccount']['describe']()['then'](respondWithResult(_0x48a749,null))['catch'](handleError(_0x48a749,null));};exports['addDisposition']=function(_0x31f103,_0x5e4464,_0x375cb3){if(_0x31f103[_0xaf93('0x5b')]['id']){delete _0x31f103['body']['id'];}return db[_0xaf93('0x3e')][_0xaf93('0x59')]({'where':{'id':_0x31f103[_0xaf93('0x57')]['id']}})['then'](handleEntityNotFound(_0x5e4464,null))[_0xaf93('0x1c')](function(_0x572798){if(_0x572798){_0x31f103['body'][_0xaf93('0x64')]=_0x572798['id'];return db[_0xaf93('0x65')]['create'](_0x31f103[_0xaf93('0x5b')]);}})[_0xaf93('0x1c')](respondWithResult(_0x5e4464,null))[_0xaf93('0x25')](handleError(_0x5e4464,null));};exports[_0xaf93('0x66')]=function(_0x51a5c6,_0x312d7b,_0x4cc695){var _0x3fc8e0={'raw':![],'where':{}};var _0x2fe382={};var _0x3f7125={'count':0x0,'rows':[]};return db[_0xaf93('0x3e')][_0xaf93('0x67')]({'where':{'id':_0x51a5c6[_0xaf93('0x57')]['id']}})[_0xaf93('0x1c')](handleEntityNotFound(_0x312d7b,null))['then'](function(_0xd3b4b2){if(_0xd3b4b2){_0x2fe382['model']=_['keys'](db[_0xaf93('0x65')][_0xaf93('0x3f')]);_0x2fe382[_0xaf93('0x44')]=_[_0xaf93('0x45')](_0x51a5c6[_0xaf93('0x44')]);_0x2fe382[_0xaf93('0x46')]=_[_0xaf93('0x47')](_0x2fe382['model'],_0x2fe382[_0xaf93('0x44')]);_0x3fc8e0[_0xaf93('0x49')]=_['intersection'](_0x2fe382[_0xaf93('0x43')],qs[_0xaf93('0x48')](_0x51a5c6['query'][_0xaf93('0x48')]));_0x3fc8e0[_0xaf93('0x49')]=_0x3fc8e0[_0xaf93('0x49')]['length']?_0x3fc8e0[_0xaf93('0x49')]:_0x2fe382[_0xaf93('0x43')];if(!_0x51a5c6[_0xaf93('0x44')][_0xaf93('0x4b')](_0xaf93('0x68'))){_0x3fc8e0['limit']=qs[_0xaf93('0x2d')](_0x51a5c6[_0xaf93('0x44')][_0xaf93('0x2d')]);_0x3fc8e0[_0xaf93('0x2a')]=qs[_0xaf93('0x2a')](_0x51a5c6[_0xaf93('0x44')][_0xaf93('0x2a')]);}_0x3fc8e0[_0xaf93('0x4c')]=qs[_0xaf93('0x4d')](_0x51a5c6[_0xaf93('0x44')]['sort']);_0x3fc8e0[_0xaf93('0x4e')]=qs[_0xaf93('0x46')](_[_0xaf93('0x4f')](_0x51a5c6['query'],_0x2fe382[_0xaf93('0x46')]));_0x3fc8e0[_0xaf93('0x4e')][_0xaf93('0x64')]=_0xd3b4b2['id'];if(_0x51a5c6[_0xaf93('0x44')][_0xaf93('0x50')]){_0x3fc8e0[_0xaf93('0x4e')]=_[_0xaf93('0x51')](_0x3fc8e0['where'],{'$or':_[_0xaf93('0x3d')](_0x3fc8e0[_0xaf93('0x49')],function(_0x533eec){var _0x18c79c={};_0x18c79c[_0x533eec]={'$like':'%'+_0x51a5c6[_0xaf93('0x44')]['filter']+'%'};return _0x18c79c;})});}_0x3fc8e0=_['merge']({},_0x3fc8e0,_0x51a5c6['options']);return db[_0xaf93('0x65')][_0xaf93('0x2c')]({'where':_0x3fc8e0[_0xaf93('0x4e')]})[_0xaf93('0x1c')](function(_0x8e13e7){_0x3f7125[_0xaf93('0x2c')]=_0x8e13e7;if(_0x51a5c6[_0xaf93('0x44')][_0xaf93('0x53')]){_0x3fc8e0['include']=[{'all':!![]}];}return db[_0xaf93('0x65')][_0xaf93('0x55')](_0x3fc8e0);})[_0xaf93('0x1c')](function(_0x49ad88){_0x3f7125[_0xaf93('0x56')]=_0x49ad88;return _0x3f7125;});}})[_0xaf93('0x1c')](respondWithFilteredResult(_0x312d7b,_0x3fc8e0))[_0xaf93('0x25')](handleError(_0x312d7b,null));};exports[_0xaf93('0x69')]=function(_0x3a7141,_0x25cf62,_0x120172){return db[_0xaf93('0x3e')][_0xaf93('0x59')]({'where':{'id':_0x3a7141[_0xaf93('0x57')]['id']}})[_0xaf93('0x1c')](handleEntityNotFound(_0x25cf62,null))['then'](function(_0x1ebef3){if(_0x1ebef3){return _0x1ebef3[_0xaf93('0x69')](_0x3a7141[_0xaf93('0x44')][_0xaf93('0x6a')]);}})[_0xaf93('0x1c')](respondWithStatusCode(_0x25cf62,null))[_0xaf93('0x25')](handleError(_0x25cf62,null));};exports[_0xaf93('0x6b')]=function(_0x1bd3df,_0x3da5e3,_0x9495a5){if(_0x1bd3df[_0xaf93('0x5b')]['id']){delete _0x1bd3df[_0xaf93('0x5b')]['id'];}return db['SmsAccount'][_0xaf93('0x59')]({'where':{'id':_0x1bd3df[_0xaf93('0x57')]['id']}})['then'](handleEntityNotFound(_0x3da5e3,null))['then'](function(_0x131206){if(_0x131206){_0x1bd3df[_0xaf93('0x5b')][_0xaf93('0x64')]=_0x131206['id'];return db['CannedAnswer'][_0xaf93('0x5a')](_0x1bd3df[_0xaf93('0x5b')]);}})[_0xaf93('0x1c')](respondWithResult(_0x3da5e3,null))[_0xaf93('0x25')](handleError(_0x3da5e3,null));};exports[_0xaf93('0x6c')]=function(_0x4643f7,_0x1341ea,_0x5161e3){var _0x5ddb0d={'raw':![],'where':{}};var _0x37fee0={};var _0x575f9f={'count':0x0,'rows':[]};return db[_0xaf93('0x3e')][_0xaf93('0x67')]({'where':{'id':_0x4643f7[_0xaf93('0x57')]['id']}})[_0xaf93('0x1c')](handleEntityNotFound(_0x1341ea,null))['then'](function(_0x7ff984){if(_0x7ff984){_0x37fee0['model']=_[_0xaf93('0x45')](db[_0xaf93('0x6d')]['rawAttributes']);_0x37fee0['query']=_['keys'](_0x4643f7[_0xaf93('0x44')]);_0x37fee0[_0xaf93('0x46')]=_['intersection'](_0x37fee0['model'],_0x37fee0[_0xaf93('0x44')]);_0x5ddb0d['attributes']=_[_0xaf93('0x47')](_0x37fee0['model'],qs[_0xaf93('0x48')](_0x4643f7[_0xaf93('0x44')][_0xaf93('0x48')]));_0x5ddb0d[_0xaf93('0x49')]=_0x5ddb0d[_0xaf93('0x49')][_0xaf93('0x4a')]?_0x5ddb0d['attributes']:_0x37fee0['model'];if(!_0x4643f7[_0xaf93('0x44')]['hasOwnProperty']('nolimit')){_0x5ddb0d[_0xaf93('0x2d')]=qs[_0xaf93('0x2d')](_0x4643f7[_0xaf93('0x44')][_0xaf93('0x2d')]);_0x5ddb0d[_0xaf93('0x2a')]=qs[_0xaf93('0x2a')](_0x4643f7['query'][_0xaf93('0x2a')]);}_0x5ddb0d[_0xaf93('0x4c')]=qs[_0xaf93('0x4d')](_0x4643f7[_0xaf93('0x44')][_0xaf93('0x4d')]);_0x5ddb0d[_0xaf93('0x4e')]=qs[_0xaf93('0x46')](_[_0xaf93('0x4f')](_0x4643f7['query'],_0x37fee0[_0xaf93('0x46')]));_0x5ddb0d[_0xaf93('0x4e')][_0xaf93('0x64')]=_0x7ff984['id'];if(_0x4643f7[_0xaf93('0x44')][_0xaf93('0x50')]){_0x5ddb0d[_0xaf93('0x4e')]=_[_0xaf93('0x51')](_0x5ddb0d[_0xaf93('0x4e')],{'$or':_['map'](_0x5ddb0d['attributes'],function(_0x2f344e){var _0xbb9eec={};_0xbb9eec[_0x2f344e]={'$like':'%'+_0x4643f7[_0xaf93('0x44')][_0xaf93('0x50')]+'%'};return _0xbb9eec;})});}_0x5ddb0d=_[_0xaf93('0x51')]({},_0x5ddb0d,_0x4643f7[_0xaf93('0x58')]);return db[_0xaf93('0x6d')][_0xaf93('0x2c')]({'where':_0x5ddb0d[_0xaf93('0x4e')]})['then'](function(_0x5c19db){_0x575f9f[_0xaf93('0x2c')]=_0x5c19db;if(_0x4643f7['query'][_0xaf93('0x53')]){_0x5ddb0d[_0xaf93('0x54')]=[{'all':!![]}];}return db[_0xaf93('0x6d')][_0xaf93('0x55')](_0x5ddb0d);})[_0xaf93('0x1c')](function(_0x488d14){_0x575f9f[_0xaf93('0x56')]=_0x488d14;return _0x575f9f;});}})['then'](respondWithFilteredResult(_0x1341ea,_0x5ddb0d))[_0xaf93('0x25')](handleError(_0x1341ea,null));};exports[_0xaf93('0x6e')]=function(_0x5001cb,_0x19886c,_0x2b551f){return db[_0xaf93('0x3e')]['find']({'where':{'id':_0x5001cb[_0xaf93('0x57')]['id']}})['then'](handleEntityNotFound(_0x19886c,null))['then'](function(_0x38c913){if(_0x38c913){return _0x38c913[_0xaf93('0x6e')](_0x5001cb[_0xaf93('0x44')][_0xaf93('0x6a')]);}})[_0xaf93('0x1c')](respondWithStatusCode(_0x19886c,null))[_0xaf93('0x25')](handleError(_0x19886c,null));};exports[_0xaf93('0x6f')]=function(_0x365021,_0x1fdde9,_0x228c1b){var _0x387433={'channel':'sms'};var _0x5484e4=[];var _0x835a93=[];var _0x721c8={};return db[_0xaf93('0x3e')]['find']({'where':{'id':_0x365021[_0xaf93('0x57')]['id']},'include':[{'model':db['SmsApplication'],'as':'Applications'}]})[_0xaf93('0x1c')](handleEntityNotFound(_0x1fdde9,null))[_0xaf93('0x1c')](function(_0x529f77){_0x387433[_0xaf93('0x70')]=_0x529f77;_0x387433[_0xaf93('0x71')]=_[_0xaf93('0x72')](_0x529f77[_0xaf93('0x73')],['priority'],['asc']);if(_0x387433[_0xaf93('0x70')]['Applications']){delete _0x387433[_0xaf93('0x70')]['Applications'];}return db[_0xaf93('0x74')][_0xaf93('0x63')]();})[_0xaf93('0x1c')](function(_0x2f06f0){if(!_0x2f06f0){throw new db['Sequelize'][(_0xaf93('0x75'))]('no\x20available\x20attributes');}_0x5484e4=_[_0xaf93('0x76')](_[_0xaf93('0x45')](_0x2f06f0),[_0xaf93('0x77'),_0xaf93('0x78')]);_0x835a93=_['difference'](_['keys'](_0x2f06f0),[_0xaf93('0x77'),_0xaf93('0x78'),'CompanyId',_0xaf93('0x79')]);_0x387433[_0xaf93('0x5b')]={'mapKey':_0xaf93('0x7a')};if(_0x387433[_0xaf93('0x70')][_0xaf93('0x41')]){switch(_0x387433[_0xaf93('0x70')][_0xaf93('0x41')]){case _0xaf93('0x7b'):_0x387433[_0xaf93('0x5b')][_0xaf93('0x7c')]=_0x365021[_0xaf93('0x5b')][_0xaf93('0x7d')];_0x387433[_0xaf93('0x5b')][_0xaf93('0x5b')]=_0x365021[_0xaf93('0x5b')][_0xaf93('0x7e')];_0x387433[_0xaf93('0x5b')][_0xaf93('0x7f')]=_0x365021[_0xaf93('0x5b')]['MessageSid'];break;case _0xaf93('0x80'):_0x387433['body'][_0xaf93('0x7c')]='+'+_0x365021[_0xaf93('0x5b')][_0xaf93('0x81')];_0x387433[_0xaf93('0x5b')][_0xaf93('0x5b')]=_0x365021[_0xaf93('0x5b')][_0xaf93('0x82')];break;case'connectel':_0x387433[_0xaf93('0x5b')][_0xaf93('0x7c')]=_0x365021[_0xaf93('0x5b')][_0xaf93('0x7c')];_0x387433[_0xaf93('0x5b')][_0xaf93('0x5b')]=_0x365021['body'][_0xaf93('0x22')];break;case _0xaf93('0x83'):_0x387433[_0xaf93('0x5b')][_0xaf93('0x7c')]=_0x365021[_0xaf93('0x5b')]['from'];_0x387433[_0xaf93('0x5b')][_0xaf93('0x5b')]=_0x365021[_0xaf93('0x5b')][_0xaf93('0x5b')];_0x387433[_0xaf93('0x5b')][_0xaf93('0x7f')]=_0x365021[_0xaf93('0x5b')][_0xaf93('0x84')];break;case _0xaf93('0x85'):_0x387433[_0xaf93('0x5b')]['from']=_0x365021[_0xaf93('0x5b')][_0xaf93('0x7d')];_0x387433[_0xaf93('0x5b')][_0xaf93('0x5b')]=_0x365021[_0xaf93('0x5b')]['Text'];_0x387433[_0xaf93('0x5b')][_0xaf93('0x7f')]=_0x365021[_0xaf93('0x5b')]['MessageUUID'];break;case _0xaf93('0x86'):_0x387433[_0xaf93('0x5b')][_0xaf93('0x7c')]='+'+_0x365021[_0xaf93('0x5b')]['results'][0x0][_0xaf93('0x7c')];_0x387433[_0xaf93('0x5b')]['body']=_0x365021[_0xaf93('0x5b')]['results'][0x0]['text'];_0x387433['body'][_0xaf93('0x7f')]=_0x365021[_0xaf93('0x5b')][_0xaf93('0x87')][0x0][_0xaf93('0x7f')];break;case _0xaf93('0x88'):_0x387433[_0xaf93('0x5b')][_0xaf93('0x7c')]=_0x365021[_0xaf93('0x5b')][_0xaf93('0x89')];_0x387433[_0xaf93('0x5b')][_0xaf93('0x5b')]=_0x365021[_0xaf93('0x5b')][_0xaf93('0x8a')][_0xaf93('0x22')];break;case _0xaf93('0x8b'):_0x387433[_0xaf93('0x5b')][_0xaf93('0x7c')]=_0x365021[_0xaf93('0x5b')][_0xaf93('0x8c')];_0x387433['body']['body']=_0x365021[_0xaf93('0x5b')][_0xaf93('0x82')];_0x387433[_0xaf93('0x5b')][_0xaf93('0x7f')]=_0x365021[_0xaf93('0x5b')][_0xaf93('0x8d')];break;case'bandwidth':_0x387433[_0xaf93('0x5b')][_0xaf93('0x7f')]=_0x365021[_0xaf93('0x5b')][0x0]['message']['id'];_0x387433['body'][_0xaf93('0x7c')]=_0x365021[_0xaf93('0x5b')][0x0]['message'][_0xaf93('0x7c')];_0x387433[_0xaf93('0x5b')][_0xaf93('0x5b')]=_0x365021[_0xaf93('0x5b')][0x0]['message']['text'];break;case _0xaf93('0x8e'):_0x387433[_0xaf93('0x5b')][_0xaf93('0x7c')]=_0x365021[_0xaf93('0x5b')][_0xaf93('0x7c')];_0x387433['body']['body']=_0x365021[_0xaf93('0x5b')][_0xaf93('0x22')];_0x387433['body'][_0xaf93('0x7f')]=_0x365021[_0xaf93('0x5b')]['refid'];break;}}if(_0x387433[_0xaf93('0x5b')]['id']){delete _0x387433[_0xaf93('0x5b')]['id'];}if(_[_0xaf93('0x8f')](_0x387433[_0xaf93('0x5b')][_0xaf93('0x7c')])){throw new db[(_0xaf93('0x90'))][(_0xaf93('0x75'))]('from\x20is\x20mandatory');}if(_['isNil'](_0x387433[_0xaf93('0x5b')]['body'])||_0x387433[_0xaf93('0x5b')][_0xaf93('0x5b')]===''){throw new db[(_0xaf93('0x90'))][(_0xaf93('0x75'))](_0xaf93('0x91'));}if(_[_0xaf93('0x8f')](_0x387433['body'][_0xaf93('0x92')])){throw new db[(_0xaf93('0x90'))][(_0xaf93('0x75'))](_0xaf93('0x93')+_0x835a93);}if(!_[_0xaf93('0x94')](_0x835a93,_0x387433['body'][_0xaf93('0x92')])){throw new db[(_0xaf93('0x90'))][(_0xaf93('0x75'))](_0xaf93('0x95')+_0x835a93);}_0x721c8[_0x387433['body'][_0xaf93('0x92')]]=_0x387433[_0xaf93('0x5b')][_0xaf93('0x7c')];return db['CmList'][_0xaf93('0x59')]({'where':{'id':_0x387433[_0xaf93('0x70')][_0xaf93('0x79')]},'include':[{'model':db['CmContact'],'as':_0xaf93('0x96'),'where':_0x721c8,'limit':0x1,'order':[[_0xaf93('0x78'),_0xaf93('0x97')]]}]});})[_0xaf93('0x1c')](handleEntityNotFound(_0x1fdde9,null))[_0xaf93('0x1c')](function(_0x1f4f8b){if(_0x1f4f8b){_0x387433[_0xaf93('0x98')]=_['omit'](_0x1f4f8b,[_0xaf93('0x96')]);if(_0x1f4f8b['Contacts'][_0xaf93('0x4a')]){return _0x1f4f8b[_0xaf93('0x96')][0x0];}var _0x52a383=_[_0xaf93('0x14')](_0x387433[_0xaf93('0x5b')],{'firstName':_0x387433[_0xaf93('0x5b')][_0xaf93('0x7c')],'ListId':_0x1f4f8b['id']});_0x52a383[_0x387433['body']['mapKey']]=_0x387433['body']['from'];return db[_0xaf93('0x74')][_0xaf93('0x5a')](_0x52a383,{'fields':_0x5484e4,'raw':!![]});}})[_0xaf93('0x1c')](handleEntityNotFound(_0x1fdde9,null))['then'](function(_0x4a87c1){if(_0x4a87c1){_0x387433[_0xaf93('0x99')]=_0x4a87c1;var _0x4f0b52={'ContactId':_0x4a87c1['id'],'phone':_0x387433[_0xaf93('0x5b')][_0xaf93('0x7c')],'SmsAccountId':_0x365021['params']['id']};var _0x4572c8={'ContactId':_0x4a87c1['id'],'SmsAccountId':_0x365021[_0xaf93('0x57')]['id'],'closed':![]};return db[_0xaf93('0x9a')][_0xaf93('0x59')]({'where':_0x4572c8})[_0xaf93('0x1c')](function(_0x3fb610){if(_0x3fb610){return[_0x3fb610,![]];}return db['SmsInteraction']['create'](_0x4f0b52)[_0xaf93('0x1c')](function(_0x52e2a3){return[_0x52e2a3,!![]];});});}})[_0xaf93('0x9b')](function(_0xba4789,_0x586379){_0x387433[_0xaf93('0x9c')]=_0xba4789[_0xaf93('0x5d')]({'plain':!![]});_0x387433[_0xaf93('0x9c')][_0xaf93('0x9d')]=![];if(_0x586379){if(_0x387433[_0xaf93('0x70')]['autoclose']){_0x387433[_0xaf93('0x71')]['push']({'id':0x0,'priority':_0x387433[_0xaf93('0x71')][_0xaf93('0x4a')]+0x1,'app':'close','appdata':_0xaf93('0x9e'),'interval':_0xaf93('0x9f')});}_0x387433[_0xaf93('0x9c')]['created']=!![];}return db[_0xaf93('0xa0')][_0xaf93('0x5a')]({'phone':_0x387433['body'][_0xaf93('0x7c')],'messageId':_0x387433[_0xaf93('0x5b')][_0xaf93('0x7f')],'body':_0x387433[_0xaf93('0x5b')][_0xaf93('0x5b')],'SmsAccountId':_0x365021[_0xaf93('0x57')]['id'],'SmsInteractionId':_0xba4789['id'],'direction':'in','ContactId':_0xba4789['ContactId'],'AttachmentId':_0x387433[_0xaf93('0x5b')]['AttachmentId']});})[_0xaf93('0x1c')](function(_0x36c33a){_0x387433[_0xaf93('0x22')]=_0x36c33a;if(!_0x387433[_0xaf93('0x9c')][_0xaf93('0xa1')])return;return db[_0xaf93('0xa2')][_0xaf93('0x59')]({'attributes':['id',_0xaf93('0x38')],'where':{'id':_0x387433[_0xaf93('0x9c')][_0xaf93('0xa1')]}});})[_0xaf93('0x1c')](function(_0x2a9be6){if(_0x2a9be6){_0x387433['applications'][_0xaf93('0xa3')]({'id':0x0,'priority':0x0,'app':_0xaf93('0xa4'),'appdata':_0x2a9be6[_0xaf93('0x38')]+','+(_0x387433[_0xaf93('0x70')][_0xaf93('0xa5')]||0xa),'interval':_0xaf93('0x9f')});}if(!_0x387433['interaction']['queueId'])return;return db['SmsQueue']['find']({'attributes':['id','name'],'where':{'id':_0x387433[_0xaf93('0x9c')][_0xaf93('0xa6')]}});})[_0xaf93('0x1c')](function(_0x36060a){if(_0x36060a){_0x387433['applications'][_0xaf93('0xa3')]({'id':0x0,'priority':0x1,'app':_0xaf93('0xa7'),'appdata':_0x36060a[_0xaf93('0x38')]+','+(_0x387433[_0xaf93('0x70')][_0xaf93('0xa8')]||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0xaf93('0xa9'),'startRouting',_0x387433);})['then'](function(_0x46c88b){if(_0x46c88b){var _0x5a6be5=0xc8;var _0x594291=_0xaf93('0xaa');logger['info']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x594291,_0x5a6be5,'entity\x20found');logger[_0xaf93('0xab')]('SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x594291,_0x5a6be5,_0xaf93('0xac'),JSON['stringify'](_0x46c88b));if(_0x387433[_0xaf93('0x70')]['type']===_0xaf93('0x7b')){return _0x1fdde9['status'](_0x5a6be5)[_0xaf93('0x2e')](_0xaf93('0xad'),'text/xml')[_0xaf93('0x39')](_0xaf93('0xae'));}else{return _0x1fdde9[_0xaf93('0x27')](_0x5a6be5)['json'](_0x46c88b);}}})[_0xaf93('0x25')](handleError(_0x1fdde9,null));};exports[_0xaf93('0xaf')]=function(_0x4f4d50,_0x3118b2){var _0x21c4bd=_0x4f4d50[_0xaf93('0x57')]['id'];var _0x4c37fb=_0x4f4d50[_0xaf93('0x5b')];var _0x4aeaf4=0xc8;var _0x217c03=null;return db['sequelize'][_0xaf93('0xb0')]({'isolationLevel':db[_0xaf93('0xb1')]['Transaction']['ISOLATION_LEVELS']['READ_COMMITTED']},function(_0x49ec0f){return db[_0xaf93('0x3e')][_0xaf93('0x67')]({'where':{'id':_0x21c4bd},'transaction':_0x49ec0f})[_0xaf93('0x1c')](function(_0x12a93b){if(_0x12a93b){return db[_0xaf93('0xb2')][_0xaf93('0x34')]({'where':{'SmsAccountId':_0x21c4bd},'transaction':_0x49ec0f})['then'](function(){var _0x197341=_['map'](_0x4c37fb,function(_0x1e34fb){_0x1e34fb['SmsAccountId']=_0x21c4bd;return _0x1e34fb;});return db[_0xaf93('0xb2')]['bulkCreate'](_0x197341,{'transaction':_0x49ec0f});});}else{_0x4aeaf4=0x194;_0x217c03=[];}});})[_0xaf93('0x1c')](function(){if(_0x4aeaf4!==0x194){return db[_0xaf93('0xb2')][_0xaf93('0xb3')]({'where':{'SmsAccountId':_0x21c4bd},'order':'priority'})[_0xaf93('0x1c')](function(_0x219d1a){_0x217c03=_0x219d1a;});}})[_0xaf93('0x25')](function(_0x11e260){_0x4aeaf4=0x1f4;logger[_0xaf93('0x21')](_0x11e260[_0xaf93('0x37')]);if(_0x11e260[_0xaf93('0x38')]){delete _0x11e260[_0xaf93('0x38')];}_0x217c03=_0x11e260;})[_0xaf93('0xb4')](function(){if(_0x217c03===null){_0x3118b2[_0xaf93('0x26')](_0x4aeaf4);}else{if(_0x4aeaf4===0x1f4){_0x3118b2[_0xaf93('0x27')](_0x4aeaf4)[_0xaf93('0x39')](_0x217c03);}else{_0x3118b2[_0xaf93('0x27')](_0x4aeaf4)[_0xaf93('0x29')](_0x217c03);}}});};exports[_0xaf93('0xb5')]=function(_0x152587,_0x158668,_0x5e1061){var _0x53c154={};var _0xccdf1a={};var _0x153e60;var _0x43920f;return db[_0xaf93('0x3e')][_0xaf93('0x67')]({'where':{'id':_0x152587[_0xaf93('0x57')]['id']}})['then'](handleEntityNotFound(_0x158668,null))['then'](function(_0x5974e7){if(_0x5974e7){_0x153e60=_0x5974e7;_0xccdf1a[_0xaf93('0x43')]=_[_0xaf93('0x45')](db[_0xaf93('0xb2')][_0xaf93('0x3f')]);_0xccdf1a[_0xaf93('0x44')]=_[_0xaf93('0x45')](_0x152587[_0xaf93('0x44')]);_0xccdf1a['filters']=_[_0xaf93('0x47')](_0xccdf1a[_0xaf93('0x43')],_0xccdf1a[_0xaf93('0x44')]);_0x53c154['attributes']=_[_0xaf93('0x47')](_0xccdf1a[_0xaf93('0x43')],qs[_0xaf93('0x48')](_0x152587[_0xaf93('0x44')][_0xaf93('0x48')]));_0x53c154['attributes']=_0x53c154[_0xaf93('0x49')][_0xaf93('0x4a')]?_0x53c154[_0xaf93('0x49')]:_0xccdf1a['model'];_0x53c154[_0xaf93('0x4c')]=qs[_0xaf93('0x4d')](_0x152587['query']['sort']);_0x53c154[_0xaf93('0x4e')]=qs['filters'](_['pick'](_0x152587[_0xaf93('0x44')],_0xccdf1a[_0xaf93('0x46')]));if(_0x152587[_0xaf93('0x44')][_0xaf93('0x50')]){_0x53c154[_0xaf93('0x4e')]=_[_0xaf93('0x51')](_0x53c154[_0xaf93('0x4e')],{'$or':_[_0xaf93('0x3d')](_0x53c154['attributes'],function(_0x48fd4e){var _0x5ae978={};_0x5ae978[_0x48fd4e]={'$like':'%'+_0x152587[_0xaf93('0x44')][_0xaf93('0x50')]+'%'};return _0x5ae978;})});}_0x53c154=_[_0xaf93('0x51')]({},_0x53c154,_0x152587[_0xaf93('0x58')]);return _0x153e60['getApplications'](_0x53c154);}})[_0xaf93('0x1c')](function(_0x32ece4){if(_0x32ece4){_0x43920f=_0x32ece4[_0xaf93('0x4a')];if(!_0x152587[_0xaf93('0x44')][_0xaf93('0x4b')](_0xaf93('0x68'))){_0x53c154[_0xaf93('0x2d')]=qs[_0xaf93('0x2d')](_0x152587[_0xaf93('0x44')]['limit']);_0x53c154['offset']=qs[_0xaf93('0x2a')](_0x152587['query'][_0xaf93('0x2a')]);}return _0x153e60['getApplications'](_0x53c154);}})[_0xaf93('0x1c')](function(_0x1ccd2d){if(_0x1ccd2d){return _0x1ccd2d?{'count':_0x43920f,'rows':_0x1ccd2d}:null;}})[_0xaf93('0x1c')](respondWithResult(_0x158668,null))[_0xaf93('0x25')](handleError(_0x158668,null));};exports[_0xaf93('0xb6')]=function(_0x5ca6c9,_0x15ff92,_0x54d401){var _0x55b20c={'raw':![],'where':{}};var _0x3d79d9={};var _0x797fee={'count':0x0,'rows':[]};return db[_0xaf93('0x3e')][_0xaf93('0x67')]({'where':{'id':_0x5ca6c9[_0xaf93('0x57')]['id']}})['then'](handleEntityNotFound(_0x15ff92,null))[_0xaf93('0x1c')](function(_0x21bc83){if(_0x21bc83){_0x3d79d9[_0xaf93('0x43')]=_[_0xaf93('0x45')](db[_0xaf93('0x9a')][_0xaf93('0x3f')]);_0x3d79d9[_0xaf93('0x44')]=_[_0xaf93('0x45')](_0x5ca6c9[_0xaf93('0x44')]);_0x3d79d9[_0xaf93('0x46')]=_[_0xaf93('0x47')](_0x3d79d9['model'],_0x3d79d9[_0xaf93('0x44')]);_0x55b20c[_0xaf93('0x49')]=_[_0xaf93('0x47')](_0x3d79d9[_0xaf93('0x43')],qs['fields'](_0x5ca6c9['query'][_0xaf93('0x48')]));_0x55b20c[_0xaf93('0x49')]=_0x55b20c[_0xaf93('0x49')]['length']?_0x55b20c[_0xaf93('0x49')]:_0x3d79d9[_0xaf93('0x43')];if(!_0x5ca6c9['query'][_0xaf93('0x4b')](_0xaf93('0x68'))){_0x55b20c['limit']=qs[_0xaf93('0x2d')](_0x5ca6c9[_0xaf93('0x44')][_0xaf93('0x2d')]);_0x55b20c[_0xaf93('0x2a')]=qs[_0xaf93('0x2a')](_0x5ca6c9['query'][_0xaf93('0x2a')]);}_0x55b20c[_0xaf93('0x4c')]=qs[_0xaf93('0x4d')](_0x5ca6c9['query'][_0xaf93('0x4d')]);_0x55b20c[_0xaf93('0x4e')]=qs[_0xaf93('0x46')](_[_0xaf93('0x4f')](_0x5ca6c9[_0xaf93('0x44')],_0x3d79d9[_0xaf93('0x46')]));_0x55b20c[_0xaf93('0x4e')][_0xaf93('0x64')]=_0x21bc83['id'];if(_0x5ca6c9[_0xaf93('0x44')][_0xaf93('0x50')]){_0x55b20c['where']=_[_0xaf93('0x51')](_0x55b20c[_0xaf93('0x4e')],{'$or':_['map'](_0x55b20c['attributes'],function(_0x57ec42){var _0x3de2c8={};_0x3de2c8[_0x57ec42]={'$like':'%'+_0x5ca6c9[_0xaf93('0x44')][_0xaf93('0x50')]+'%'};return _0x3de2c8;})});}_0x55b20c=_[_0xaf93('0x51')]({},_0x55b20c,_0x5ca6c9[_0xaf93('0x58')]);return db[_0xaf93('0x9a')][_0xaf93('0x2c')]({'where':_0x55b20c['where']})['then'](function(_0x265639){_0x797fee[_0xaf93('0x2c')]=_0x265639;if(_0x5ca6c9['query']['includeAll']){_0x55b20c[_0xaf93('0x54')]=[{'model':db[_0xaf93('0x74')],'as':_0xaf93('0xb7'),'required':![]},{'model':db[_0xaf93('0xa2')],'as':'Owner','attributes':[_0xaf93('0x38'),'fullname',_0xaf93('0xb8')],'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0xaf93('0x38'),_0xaf93('0xb9')],'where':_0x5ca6c9[_0xaf93('0x44')][_0xaf93('0xba')]?{'id':_0x5ca6c9[_0xaf93('0x44')]['tag']}:undefined,'required':_0x5ca6c9[_0xaf93('0x44')]['tag']?!![]:![]}];}return db[_0xaf93('0x9a')][_0xaf93('0x55')](_0x55b20c);})[_0xaf93('0x1c')](function(_0x359c1c){_0x797fee[_0xaf93('0x56')]=_0x359c1c;return _0x797fee;});}})[_0xaf93('0x1c')](respondWithFilteredResult(_0x15ff92,_0x55b20c))['catch'](handleError(_0x15ff92,null));};exports['send']=function(_0x76b281,_0x3261b3,_0x19fe40){var _0x4337c2,_0x24a996,_0x27a892;if(_[_0xaf93('0x8f')](_0x76b281[_0xaf93('0x5b')][_0xaf93('0x5b')])||_0x76b281['body'][_0xaf93('0x5b')]===''){throw new db[(_0xaf93('0x90'))][(_0xaf93('0x75'))](_0xaf93('0x91'));}if(_[_0xaf93('0x8f')](_0x76b281[_0xaf93('0x5b')]['to'])){throw new db[(_0xaf93('0x90'))][(_0xaf93('0x75'))](_0xaf93('0xbb'));}_0x4337c2=_0x76b281[_0xaf93('0x5b')]['to'];return db[_0xaf93('0x3e')][_0xaf93('0x59')]({'where':{'id':_0x76b281[_0xaf93('0x57')]['id']},'include':[{'model':db[_0xaf93('0xbc')],'as':_0xaf93('0xbd'),'include':[{'model':db[_0xaf93('0x74')],'as':_0xaf93('0x96'),'where':{'mobile':_0x4337c2},'limit':0x1,'order':[['updatedAt',_0xaf93('0x97')]]}]}]})[_0xaf93('0x1c')](handleEntityNotFound(_0x3261b3,null))[_0xaf93('0x1c')](function(_0x4b2c7c){if(_0x4b2c7c&&_0x4b2c7c[_0xaf93('0xbd')]){_0x24a996=_0x4b2c7c[_0xaf93('0x5d')]({'plain':!![]});if(_0x24a996[_0xaf93('0xbd')]&&_0x24a996[_0xaf93('0xbd')][_0xaf93('0x96')][_0xaf93('0x4a')]){return _0x24a996['List']['Contacts'][0x0];}return db[_0xaf93('0x74')][_0xaf93('0x5a')](_[_0xaf93('0x14')](_0x76b281[_0xaf93('0x5b')],{'firstName':_0x4337c2,'mobile':_0x4337c2,'phone':_0x4337c2,'ListId':_0x24a996['ListId']}));}})[_0xaf93('0x1c')](handleEntityNotFound(_0x3261b3,null))[_0xaf93('0x1c')](function(_0x2f12be){if(_0x2f12be){_0x27a892=_0x2f12be;return db[_0xaf93('0x9a')][_0xaf93('0x59')]({'where':{'ContactId':_0x27a892['id'],'closed':![],'SmsAccountId':_0x24a996['id']}})[_0xaf93('0x1c')](function(_0x423038){if(_0x423038){return[_0x423038,![]];}return db[_0xaf93('0x9a')][_0xaf93('0x5a')]({'UserId':_0x76b281[_0xaf93('0x5c')]['id'],'ContactId':_0x27a892['id'],'SmsAccountId':_0x24a996['id'],'phone':_0x4337c2,'firstMsgDirection':_0xaf93('0xbe'),'Messages':[_[_0xaf93('0x51')](_0x76b281['body'],{'read':![],'body':_0x76b281[_0xaf93('0x5b')]['body'],'phone':_0x4337c2,'SmsAccountId':_0x24a996['id'],'UserId':_0x76b281[_0xaf93('0x5c')]['id'],'ContactId':_0x27a892['id']})]},{'include':[{'model':db[_0xaf93('0xa0')],'as':_0xaf93('0xbf')}]})[_0xaf93('0x1c')](function(_0x318b13){return[_0x318b13,!![]];});});}})[_0xaf93('0x9b')](function(_0x2f7fe6,_0x5b8873){if(_0x5b8873){return _0x2f7fe6;}return db[_0xaf93('0xa0')]['create'](_[_0xaf93('0x51')](_0x76b281[_0xaf93('0x5b')],{'read':![],'body':_0x76b281[_0xaf93('0x5b')][_0xaf93('0x5b')],'phone':_0x4337c2,'SmsAccountId':_0x24a996['id'],'SmsInteractionId':_0x2f7fe6['id'],'UserId':_0x76b281[_0xaf93('0x5c')]['id'],'ContactId':_0x27a892['id']}))[_0xaf93('0x1c')](function(_0x24470e){_0x2f7fe6[_0xaf93('0xc0')][_0xaf93('0xbf')]=[];_0x2f7fe6[_0xaf93('0xc0')][_0xaf93('0xbf')][_0xaf93('0xc1')](_0x24470e['dataValues']);return _0x2f7fe6;});})['then'](respondWithResult(_0x3261b3,null))[_0xaf93('0x25')](handleError(_0x3261b3,null));};exports[_0xaf93('0x27')]=function(_0x4821a0,_0x41d160,_0x2a10aa){if(_0x4821a0[_0xaf93('0x5b')]['id']){delete _0x4821a0[_0xaf93('0x5b')]['id'];}var _0x517748,_0x2c56d0,_0x3b533d;return db['SmsAccount'][_0xaf93('0x59')]({'where':{'id':_0x4821a0[_0xaf93('0x57')]['id']}})[_0xaf93('0x1c')](handleEntityNotFound(_0x41d160,null))[_0xaf93('0x1c')](function(_0x35715e){if(_0x35715e){_0x3b533d=_0x35715e;logger[_0xaf93('0xab')](_0xaf93('0x1f'),_0xaf93('0x27'),_0xaf93('0xc2'),_0x35715e[_0xaf93('0x41')],util[_0xaf93('0xc3')](_0x4821a0[_0xaf93('0x5b')],{'showHidden':![],'depth':null}));switch(_0x35715e[_0xaf93('0x41')]){case _0xaf93('0x80'):if(_0x4821a0[_0xaf93('0x5b')]['skebby_dispatch_id']&&_0x4821a0[_0xaf93('0x5b')]['status']){_0x2c56d0=_0x4821a0[_0xaf93('0x5b')][_0xaf93('0x27')];return db[_0xaf93('0xa0')][_0xaf93('0x59')]({'where':{'messageId':_0x4821a0['body'][_0xaf93('0xc4')]}});}break;case'connectel':if(_0x4821a0[_0xaf93('0x5b')][_0xaf93('0xc5')]&&_0x4821a0[_0xaf93('0x5b')]['statusInt']){_0x2c56d0=_0x4821a0[_0xaf93('0x5b')][_0xaf93('0xc6')];return db[_0xaf93('0xa0')]['find']({'where':{'messageId':_0x4821a0['body'][_0xaf93('0xc5')]}});}break;case _0xaf93('0x83'):if(_0x4821a0[_0xaf93('0x5b')][_0xaf93('0x84')]&&_0x4821a0['body']['status_code']){_0x2c56d0=_0x4821a0[_0xaf93('0x5b')]['status_code'];return db['SmsMessage'][_0xaf93('0x59')]({'where':{'messageId':_0x4821a0[_0xaf93('0x5b')][_0xaf93('0x84')]}});}break;case'infobip':var _0x10030f=_0x4821a0[_0xaf93('0x5b')][_0xaf93('0x87')][0x0];if(_0x10030f[_0xaf93('0x7f')]&&_0x10030f[_0xaf93('0x27')][_0xaf93('0xc7')]===_0xaf93('0xc8')){_0x2c56d0=_0x10030f['status'][_0xaf93('0xc7')];return db['SmsMessage'][_0xaf93('0x59')]({'where':{'messageId':_0x10030f[_0xaf93('0x7f')]}});}break;case _0xaf93('0x8b'):if(_0x4821a0['body'][_0xaf93('0x7f')]&&_0x4821a0['body'][_0xaf93('0x27')]){_0x2c56d0=_0x4821a0['body'][_0xaf93('0x27')];return db[_0xaf93('0xa0')]['find']({'where':{'messageId':_0x4821a0['body']['messageId']}});}break;case'bandwidth':if(_0x4821a0[_0xaf93('0x5b')][0x0]['message']['id']){_0x2c56d0=_0x4821a0[_0xaf93('0x5b')][0x0][_0xaf93('0x41')];return db['SmsMessage'][_0xaf93('0x59')]({'where':{'messageId':_0x4821a0[_0xaf93('0x5b')][0x0]['message']['id']}});}break;case _0xaf93('0x8e'):if(_0x4821a0[_0xaf93('0x5b')][_0xaf93('0xc9')]&&_0x4821a0[_0xaf93('0x5b')]['status']){_0x2c56d0=_0x4821a0['body'][_0xaf93('0x27')];return db['SmsMessage'][_0xaf93('0x59')]({'where':{'messageId':_0x4821a0[_0xaf93('0x5b')][_0xaf93('0xc9')]}});}break;}}})[_0xaf93('0x1c')](handleEntityNotFound(_0x41d160,null))[_0xaf93('0x1c')](function(_0x48c267){if(_0x48c267){_0x517748=_0x48c267;switch(_0x3b533d[_0xaf93('0x41')]){case _0xaf93('0x80'):if(_0x2c56d0==='DELIVERED'){return _0x517748['update']({'read':!![]});}else{logger[_0xaf93('0x21')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xaf93('0x27'),_0xaf93('0x80'),util[_0xaf93('0xc3')](_0x4821a0[_0xaf93('0x5b')],{'showHidden':![],'depth':null}));}break;case _0xaf93('0xca'):if(_0x2c56d0==='1'){return _0x517748[_0xaf93('0x33')]({'read':!![]});}else{logger['error'](_0xaf93('0x1f'),_0xaf93('0x27'),_0xaf93('0x80'),util[_0xaf93('0xc3')](_0x4821a0['body'],{'showHidden':![],'depth':null}));}break;case _0xaf93('0x83'):if(!_0x4821a0['body'][_0xaf93('0xcb')]&&_0x2c56d0>=0xc8&&_0x2c56d0<=0xce){return _0x517748[_0xaf93('0x33')]({'read':!![]});}else{logger[_0xaf93('0x21')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xaf93('0x27'),'clicksend',util[_0xaf93('0xc3')](_0x4821a0[_0xaf93('0x5b')],{'showHidden':![],'depth':null}));}break;case _0xaf93('0x86'):var _0x43dba6=_0x4821a0[_0xaf93('0x5b')]['results'][0x0];if(_0x43dba6[_0xaf93('0x27')]['groupName']==='DELIVERED'){return _0x517748[_0xaf93('0x33')]({'read':!![]});}else{logger[_0xaf93('0x21')](_0xaf93('0x1f'),_0xaf93('0x27'),_0xaf93('0x86'),util[_0xaf93('0xc3')](_0x4821a0[_0xaf93('0x5b')],{'showHidden':![],'depth':null}));}break;case _0xaf93('0x8b'):if(_0x2c56d0=='DELIVERED_TO_GATEWAY'||_0x2c56d0==_0xaf93('0xcc')){return _0x517748['update']({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0xaf93('0x27'),_0xaf93('0x8b'),util[_0xaf93('0xc3')](_0x4821a0['body'],{'showHidden':![],'depth':null}));}break;case _0xaf93('0xcd'):if(_0x2c56d0=='message-delivered'){return _0x517748[_0xaf93('0x33')]({'read':!![]});}else{logger[_0xaf93('0x21')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xaf93('0x27'),_0xaf93('0xcd'),util[_0xaf93('0xc3')](_0x4821a0[_0xaf93('0x5b')],{'showHidden':![],'depth':null}));}break;case _0xaf93('0x8e'):if(_0x2c56d0===_0xaf93('0xce')||_0x2c56d0==='ACCEPTD'){return _0x517748[_0xaf93('0x33')]({'read':!![]});}else{logger[_0xaf93('0x21')](_0xaf93('0x1f'),'status',_0xaf93('0x8e'),util[_0xaf93('0xc3')](_0x4821a0['body'],{'showHidden':![],'depth':null}));}break;}return _0x517748;}})['then'](respondWithResult(_0x41d160,null))['catch'](handleError(_0x41d160,null));};exports[_0xaf93('0xcf')]=function(_0x564fd1,_0x185183,_0x230c3e){var _0x5c7ad4,_0x42219f,_0x427ebf;return db[_0xaf93('0x3e')][_0xaf93('0x59')]({'where':{'id':_0x564fd1[_0xaf93('0x57')]['id']}})[_0xaf93('0x1c')](handleEntityNotFound(_0x185183,null))['then'](function(_0x1dd935){if(_0x1dd935){_0x427ebf=_0x1dd935;logger[_0xaf93('0xab')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xaf93('0x27'),_0xaf93('0xc2'),_0x1dd935['type'],util[_0xaf93('0xc3')](_0x564fd1['query'],{'showHidden':![],'depth':null}));switch(_0x1dd935[_0xaf93('0x41')]){case _0xaf93('0x88'):if(_0x564fd1['query']['message-id']&&_0x564fd1[_0xaf93('0x44')][_0xaf93('0xd0')]){_0x42219f=_0x564fd1[_0xaf93('0x44')][_0xaf93('0xd0')];return db[_0xaf93('0xa0')][_0xaf93('0x59')]({'where':{'messageId':_0x564fd1['query'][_0xaf93('0xd1')]}});}break;}}})[_0xaf93('0x1c')](handleEntityNotFound(_0x185183,null))['then'](function(_0x2542a4){if(_0x2542a4){_0x5c7ad4=_0x2542a4;switch(_0x427ebf[_0xaf93('0x41')]){case _0xaf93('0x88'):if(_0x42219f==='2'||_0x42219f==='6'){return _0x5c7ad4[_0xaf93('0x33')]({'read':!![]});}else{logger[_0xaf93('0x21')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xaf93('0x27'),_0xaf93('0x88'),util[_0xaf93('0xc3')](_0x564fd1[_0xaf93('0x44')],{'showHidden':![],'depth':null}));};break;}return _0x5c7ad4;}})[_0xaf93('0x1c')](respondWithResult(_0x185183,null))[_0xaf93('0x25')](handleError(_0x185183,null));};exports[_0xaf93('0xd2')]=function(_0x3cf95d,_0x34b233,_0x4c23f3){return db[_0xaf93('0x3e')][_0xaf93('0x59')]({'where':{'id':_0x3cf95d[_0xaf93('0x57')]['id']}})[_0xaf93('0x1c')](handleEntityNotFound(_0x34b233,null))[_0xaf93('0x1c')](function(_0x4ed69d){if(_0x4ed69d){return _0x4ed69d['addAgents'](_0x3cf95d[_0xaf93('0x5b')][_0xaf93('0x6a')],_[_0xaf93('0xd3')](_0x3cf95d[_0xaf93('0x5b')],[_0xaf93('0x6a'),'id'])||{})[_0xaf93('0x9b')](function(_0x41ae67){for(var _0x33e0c6=0x0;_0x33e0c6<_0x3cf95d[_0xaf93('0x5b')][_0xaf93('0x6a')][_0xaf93('0x4a')];_0x33e0c6+=0x1){socket[_0xaf93('0xd4')](_0xaf93('0xd5'),{'UserId':Number(_0x3cf95d[_0xaf93('0x5b')][_0xaf93('0x6a')][_0x33e0c6]),'SmsAccountId':Number(_0x3cf95d['params']['id'])});}return _0x41ae67;});}})[_0xaf93('0x1c')](respondWithResult(_0x34b233,null))[_0xaf93('0x25')](handleError(_0x34b233,null));};exports[_0xaf93('0xd6')]=function(_0xea2472,_0x2761ea,_0x133b4b){return db[_0xaf93('0x3e')][_0xaf93('0x59')]({'where':{'id':_0xea2472[_0xaf93('0x57')]['id']}})[_0xaf93('0x1c')](handleEntityNotFound(_0x2761ea,null))[_0xaf93('0x1c')](function(_0xa350a8){if(_0xa350a8){return _0xa350a8['removeAgents'](_0xea2472['query'][_0xaf93('0x6a')])[_0xaf93('0x1c')](function(){if(_[_0xaf93('0xd7')](_0xea2472['query'][_0xaf93('0x6a')])){for(var _0x3a0b04=0x0;_0x3a0b04<_0xea2472[_0xaf93('0x44')][_0xaf93('0x6a')]['length'];_0x3a0b04+=0x1){socket[_0xaf93('0xd4')](_0xaf93('0xd8'),{'UserId':Number(_0xea2472['query']['ids'][_0x3a0b04]),'SmsAccountId':Number(_0xea2472[_0xaf93('0x57')]['id'])});}}else{socket[_0xaf93('0xd4')](_0xaf93('0xd8'),{'UserId':Number(_0xea2472[_0xaf93('0x44')][_0xaf93('0x6a')]),'SmsAccountId':Number(_0xea2472['params']['id'])});}});}})['then'](respondWithStatusCode(_0x2761ea,null))[_0xaf93('0x25')](handleError(_0x2761ea,null));};exports['getAgents']=function(_0x1a211e,_0x5094bd,_0x4c2c14){var _0x10e89d={};var _0x47d749={};var _0x192e79;var _0x58a80d;return db[_0xaf93('0x3e')][_0xaf93('0x67')]({'where':{'id':_0x1a211e['params']['id']}})[_0xaf93('0x1c')](handleEntityNotFound(_0x5094bd,null))['then'](function(_0x2ba588){if(_0x2ba588){_0x192e79=_0x2ba588;_0x47d749[_0xaf93('0x43')]=_[_0xaf93('0x45')](db[_0xaf93('0xa2')][_0xaf93('0x3f')]);_0x47d749['query']=_[_0xaf93('0x45')](_0x1a211e[_0xaf93('0x44')]);_0x47d749[_0xaf93('0x46')]=_[_0xaf93('0x47')](_0x47d749[_0xaf93('0x43')],_0x47d749[_0xaf93('0x44')]);_0x10e89d[_0xaf93('0x49')]=_[_0xaf93('0x47')](_0x47d749['model'],qs[_0xaf93('0x48')](_0x1a211e[_0xaf93('0x44')][_0xaf93('0x48')]));_0x10e89d[_0xaf93('0x49')]=_0x10e89d[_0xaf93('0x49')][_0xaf93('0x4a')]?_0x10e89d[_0xaf93('0x49')]:_0x47d749[_0xaf93('0x43')];_0x10e89d['order']=qs[_0xaf93('0x4d')](_0x1a211e[_0xaf93('0x44')][_0xaf93('0x4d')]);_0x10e89d[_0xaf93('0x4e')]=qs['filters'](_['pick'](_0x1a211e[_0xaf93('0x44')],_0x47d749['filters']));if(_0x1a211e[_0xaf93('0x44')][_0xaf93('0x50')]){_0x10e89d['where']=_['merge'](_0x10e89d['where'],{'$or':_[_0xaf93('0x3d')](_0x10e89d['attributes'],function(_0x3f5f6f){var _0x5b358e={};_0x5b358e[_0x3f5f6f]={'$like':'%'+_0x1a211e[_0xaf93('0x44')]['filter']+'%'};return _0x5b358e;})});}_0x10e89d=_[_0xaf93('0x51')]({},_0x10e89d,_0x1a211e[_0xaf93('0x58')]);return _0x192e79[_0xaf93('0xd9')](_0x10e89d);}})['then'](function(_0x29807e){if(_0x29807e){_0x58a80d=_0x29807e[_0xaf93('0x4a')];if(!_0x1a211e[_0xaf93('0x44')][_0xaf93('0x4b')]('nolimit')){_0x10e89d['limit']=qs[_0xaf93('0x2d')](_0x1a211e[_0xaf93('0x44')][_0xaf93('0x2d')]);_0x10e89d[_0xaf93('0x2a')]=qs['offset'](_0x1a211e[_0xaf93('0x44')]['offset']);}return _0x192e79[_0xaf93('0xd9')](_0x10e89d);}})[_0xaf93('0x1c')](function(_0xae97e7){if(_0xae97e7){return _0xae97e7?{'count':_0x58a80d,'rows':_0xae97e7}:null;}})[_0xaf93('0x1c')](respondWithResult(_0x5094bd,null))[_0xaf93('0x25')](handleError(_0x5094bd,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 98831bc..f580cb8 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 _0x7b1e=['update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','SmsAccount','setMaxListeners','save'];(function(_0x2dcfe4,_0x2cc090){var _0x4f4f03=function(_0x191be4){while(--_0x191be4){_0x2dcfe4['push'](_0x2dcfe4['shift']());}};_0x4f4f03(++_0x2cc090);}(_0x7b1e,0x178));var _0xe7b1=function(_0xaa6a4,_0x64b067){_0xaa6a4=_0xaa6a4-0x0;var _0xdc31a4=_0x7b1e[_0xaa6a4];return _0xdc31a4;};'use strict';var EventEmitter=require('events');var SmsAccount=require(_0xe7b1('0x0'))['db'][_0xe7b1('0x1')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0xe7b1('0x2')](0x0);var events={'afterCreate':_0xe7b1('0x3'),'afterUpdate':_0xe7b1('0x4'),'afterDestroy':_0xe7b1('0x5')};function emitEvent(_0x3a3d23){return function(_0x44b05e,_0x30f0b1,_0xe0c2f1){SmsAccountEvents[_0xe7b1('0x6')](_0x3a3d23+':'+_0x44b05e['id'],_0x44b05e);SmsAccountEvents[_0xe7b1('0x6')](_0x3a3d23,_0x44b05e);_0xe0c2f1(null);};}for(var e in events){if(events[_0xe7b1('0x7')](e)){var event=events[e];SmsAccount[_0xe7b1('0x8')](e,emitEvent(event));}}module[_0xe7b1('0x9')]=SmsAccountEvents; \ No newline at end of file +var _0x57d5=['events','../../mysqldb','SmsAccount','setMaxListeners','update','remove','emit','hasOwnProperty','hook'];(function(_0xad30d3,_0x2fdef1){var _0x11e4a3=function(_0x4c7633){while(--_0x4c7633){_0xad30d3['push'](_0xad30d3['shift']());}};_0x11e4a3(++_0x2fdef1);}(_0x57d5,0x90));var _0x557d=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x57d5[_0x1d1779];return _0x2377e9;};'use strict';var EventEmitter=require(_0x557d('0x0'));var SmsAccount=require(_0x557d('0x1'))['db'][_0x557d('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x557d('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x557d('0x4'),'afterDestroy':_0x557d('0x5')};function emitEvent(_0x356616){return function(_0x21a76e,_0x455192,_0xaabf5b){SmsAccountEvents[_0x557d('0x6')](_0x356616+':'+_0x21a76e['id'],_0x21a76e);SmsAccountEvents['emit'](_0x356616,_0x21a76e);_0xaabf5b(null);};}for(var e in events){if(events[_0x557d('0x7')](e)){var event=events[e];SmsAccount[_0x557d('0x8')](e,emitEvent(event));}}module['exports']=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index fd64183..7c3182a 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 _0xea92=['rimraf','./smsAccount.attributes','define','SmsAccount','sms_accounts','lodash','util','../../config/logger','api','moment','request-promise','path'];(function(_0xcb813d,_0x204798){var _0x259ee8=function(_0x48d828){while(--_0x48d828){_0xcb813d['push'](_0xcb813d['shift']());}};_0x259ee8(++_0x204798);}(_0xea92,0x95));var _0x2ea9=function(_0x4fd206,_0x216111){_0x4fd206=_0x4fd206-0x0;var _0x3416aa=_0xea92[_0x4fd206];return _0x3416aa;};'use strict';var _=require(_0x2ea9('0x0'));var util=require(_0x2ea9('0x1'));var logger=require(_0x2ea9('0x2'))(_0x2ea9('0x3'));var moment=require(_0x2ea9('0x4'));var BPromise=require('bluebird');var rp=require(_0x2ea9('0x5'));var fs=require('fs');var path=require(_0x2ea9('0x6'));var rimraf=require(_0x2ea9('0x7'));var config=require('../../config/environment');var attributes=require(_0x2ea9('0x8'));module['exports']=function(_0x3599d4,_0x4db54c){return _0x3599d4[_0x2ea9('0x9')](_0x2ea9('0xa'),attributes,{'tableName':_0x2ea9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6cf2=['rimraf','./smsAccount.attributes','define','SmsAccount','sms_accounts','util','moment','bluebird','path'];(function(_0x2d9ca1,_0x5c00a0){var _0x35d407=function(_0x239f18){while(--_0x239f18){_0x2d9ca1['push'](_0x2d9ca1['shift']());}};_0x35d407(++_0x5c00a0);}(_0x6cf2,0x1c7));var _0x26cf=function(_0x5d8ffb,_0x47dad1){_0x5d8ffb=_0x5d8ffb-0x0;var _0x43e952=_0x6cf2[_0x5d8ffb];return _0x43e952;};'use strict';var _=require('lodash');var util=require(_0x26cf('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x26cf('0x1'));var BPromise=require(_0x26cf('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x26cf('0x3'));var rimraf=require(_0x26cf('0x4'));var config=require('../../config/environment');var attributes=require(_0x26cf('0x5'));module['exports']=function(_0x3bb690,_0x12f791){return _0x3bb690[_0x26cf('0x6')](_0x26cf('0x7'),attributes,{'tableName':_0x26cf('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.rpc.js b/server/api/smsAccount/smsAccount.rpc.js index 59e138d..d1b5bdd 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 _0xbf30=['defaults','localhost','socket.io-emitter','redis','./smsAccount.socket','register','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowSmsAccount','SmsAccount','find','options','raw','where','attributes','map','model','include','debug','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x2e6a69,_0x1ba014){var _0x583b2a=function(_0x1e8d49){while(--_0x1e8d49){_0x2e6a69['push'](_0x2e6a69['shift']());}};_0x583b2a(++_0x1ba014);}(_0xbf30,0x1e4));var _0x0bf3=function(_0x17be32,_0x23310d){_0x17be32=_0x17be32-0x0;var _0x3ae4a8=_0xbf30[_0x17be32];return _0x3ae4a8;};'use strict';var _=require('lodash');var util=require(_0x0bf3('0x0'));var moment=require(_0x0bf3('0x1'));var BPromise=require(_0x0bf3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0bf3('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0bf3('0x4'));var logger=require(_0x0bf3('0x5'))(_0x0bf3('0x6'));var config=require(_0x0bf3('0x7'));var jayson=require(_0x0bf3('0x8'));var client=jayson[_0x0bf3('0x9')]['http']({'port':0x232a});config['redis']=_[_0x0bf3('0xa')](config['redis'],{'host':_0x0bf3('0xb'),'port':0x18eb});var socket=require(_0x0bf3('0xc'))(new Redis(config[_0x0bf3('0xd')]));require(_0x0bf3('0xe'))[_0x0bf3('0xf')](socket);function respondWithRpcPromise(_0x490f0d,_0x32a85c,_0x3fb532){return new BPromise(function(_0x3a0f88,_0x14ce9d){return client['request'](_0x490f0d,_0x3fb532)[_0x0bf3('0x10')](function(_0x42c5ef){logger[_0x0bf3('0x11')](_0x0bf3('0x12'),_0x32a85c,_0x0bf3('0x13'));logger['debug'](_0x0bf3('0x14'),_0x32a85c,_0x0bf3('0x13'),JSON[_0x0bf3('0x15')](_0x42c5ef));if(_0x42c5ef[_0x0bf3('0x16')]){if(_0x42c5ef[_0x0bf3('0x16')][_0x0bf3('0x17')]===0x1f4){logger[_0x0bf3('0x16')]('SmsAccount,\x20%s,\x20%s',_0x32a85c,_0x42c5ef[_0x0bf3('0x16')][_0x0bf3('0x18')]);return _0x14ce9d(_0x42c5ef[_0x0bf3('0x16')][_0x0bf3('0x18')]);}logger[_0x0bf3('0x16')](_0x0bf3('0x12'),_0x32a85c,_0x42c5ef[_0x0bf3('0x16')]['message']);return _0x3a0f88(_0x42c5ef['error']['message']);}else{logger[_0x0bf3('0x11')](_0x0bf3('0x12'),_0x32a85c,_0x0bf3('0x13'));_0x3a0f88(_0x42c5ef[_0x0bf3('0x19')][_0x0bf3('0x18')]);}})[_0x0bf3('0x1a')](function(_0x250aaa){logger['error'](_0x0bf3('0x12'),_0x32a85c,_0x250aaa);_0x14ce9d(_0x250aaa);});});}exports[_0x0bf3('0x1b')]=function(_0x3e5f0e){var _0x38d70e=this;return new Promise(function(_0x356180,_0x1617a6){return db[_0x0bf3('0x1c')][_0x0bf3('0x1d')]({'raw':_0x3e5f0e[_0x0bf3('0x1e')]?_0x3e5f0e[_0x0bf3('0x1e')][_0x0bf3('0x1f')]===undefined?!![]:![]:!![],'where':_0x3e5f0e[_0x0bf3('0x1e')]?_0x3e5f0e[_0x0bf3('0x1e')][_0x0bf3('0x20')]||null:null,'attributes':_0x3e5f0e[_0x0bf3('0x1e')]?_0x3e5f0e[_0x0bf3('0x1e')][_0x0bf3('0x21')]||null:null,'include':_0x3e5f0e[_0x0bf3('0x1e')]?_0x3e5f0e[_0x0bf3('0x1e')]['include']?_[_0x0bf3('0x22')](_0x3e5f0e[_0x0bf3('0x1e')]['include'],function(_0x5d82c0){return{'model':db[_0x5d82c0[_0x0bf3('0x23')]],'as':_0x5d82c0['as'],'attributes':_0x5d82c0[_0x0bf3('0x21')],'include':_0x5d82c0[_0x0bf3('0x24')]?_[_0x0bf3('0x22')](_0x5d82c0[_0x0bf3('0x24')],function(_0x110fdb){return{'model':db[_0x110fdb[_0x0bf3('0x23')]],'as':_0x110fdb['as'],'attributes':_0x110fdb['attributes'],'include':_0x110fdb[_0x0bf3('0x24')]?_[_0x0bf3('0x22')](_0x110fdb['include'],function(_0x237173){return{'model':db[_0x237173[_0x0bf3('0x23')]],'as':_0x237173['as'],'attributes':_0x237173[_0x0bf3('0x21')]};}):[]};}):[]};}):[]:[]})[_0x0bf3('0x10')](function(_0x2b4237){logger[_0x0bf3('0x11')](_0x0bf3('0x1b'),_0x3e5f0e);logger[_0x0bf3('0x25')](_0x0bf3('0x1b'),_0x3e5f0e,JSON['stringify'](_0x2b4237));_0x356180(_0x2b4237);})[_0x0bf3('0x1a')](function(_0x26ebdc){logger[_0x0bf3('0x16')](_0x0bf3('0x1b'),_0x26ebdc['message'],_0x3e5f0e);_0x1617a6(_0x38d70e[_0x0bf3('0x16')](0x1f4,_0x26ebdc[_0x0bf3('0x18')]));});});}; \ No newline at end of file +var _0xb045=['ShowSmsAccount','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','then','info','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','SmsAccount,\x20%s,\x20%s','message','SmsAccount','find','options','raw','where','attributes','include','model','map'];(function(_0x200283,_0x541fa9){var _0x516075=function(_0x3fd312){while(--_0x3fd312){_0x200283['push'](_0x200283['shift']());}};_0x516075(++_0x541fa9);}(_0xb045,0x1de));var _0x5b04=function(_0xa7d678,_0x3dfdff){_0xa7d678=_0xa7d678-0x0;var _0x5cc539=_0xb045[_0xa7d678];return _0x5cc539;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x5b04('0x0'));var BPromise=require(_0x5b04('0x1'));var rs=require(_0x5b04('0x2'));var fs=require('fs');var Redis=require(_0x5b04('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5b04('0x4'));var logger=require(_0x5b04('0x5'))(_0x5b04('0x6'));var config=require(_0x5b04('0x7'));var jayson=require(_0x5b04('0x8'));var client=jayson[_0x5b04('0x9')][_0x5b04('0xa')]({'port':0x232a});config[_0x5b04('0xb')]=_[_0x5b04('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x5b04('0xd'))(new Redis(config[_0x5b04('0xb')]));require('./smsAccount.socket')['register'](socket);function respondWithRpcPromise(_0x316899,_0x434030,_0x494b58){return new BPromise(function(_0x3babd9,_0x5f282d){return client['request'](_0x316899,_0x494b58)[_0x5b04('0xe')](function(_0x120957){logger[_0x5b04('0xf')]('SmsAccount,\x20%s,\x20%s',_0x434030,_0x5b04('0x10'));logger[_0x5b04('0x11')](_0x5b04('0x12'),_0x434030,_0x5b04('0x10'),JSON[_0x5b04('0x13')](_0x120957));if(_0x120957[_0x5b04('0x14')]){if(_0x120957[_0x5b04('0x14')]['code']===0x1f4){logger[_0x5b04('0x14')](_0x5b04('0x15'),_0x434030,_0x120957['error']['message']);return _0x5f282d(_0x120957['error'][_0x5b04('0x16')]);}logger[_0x5b04('0x14')](_0x5b04('0x15'),_0x434030,_0x120957[_0x5b04('0x14')][_0x5b04('0x16')]);return _0x3babd9(_0x120957['error'][_0x5b04('0x16')]);}else{logger[_0x5b04('0xf')](_0x5b04('0x15'),_0x434030,_0x5b04('0x10'));_0x3babd9(_0x120957['result'][_0x5b04('0x16')]);}})['catch'](function(_0x49b377){logger[_0x5b04('0x14')]('SmsAccount,\x20%s,\x20%s',_0x434030,_0x49b377);_0x5f282d(_0x49b377);});});}exports['ShowSmsAccount']=function(_0x5621e0){var _0x46545e=this;return new Promise(function(_0x4bf060,_0x331c08){return db[_0x5b04('0x17')][_0x5b04('0x18')]({'raw':_0x5621e0[_0x5b04('0x19')]?_0x5621e0[_0x5b04('0x19')][_0x5b04('0x1a')]===undefined?!![]:![]:!![],'where':_0x5621e0['options']?_0x5621e0[_0x5b04('0x19')][_0x5b04('0x1b')]||null:null,'attributes':_0x5621e0[_0x5b04('0x19')]?_0x5621e0['options'][_0x5b04('0x1c')]||null:null,'include':_0x5621e0['options']?_0x5621e0[_0x5b04('0x19')][_0x5b04('0x1d')]?_['map'](_0x5621e0[_0x5b04('0x19')][_0x5b04('0x1d')],function(_0x399170){return{'model':db[_0x399170[_0x5b04('0x1e')]],'as':_0x399170['as'],'attributes':_0x399170[_0x5b04('0x1c')],'include':_0x399170[_0x5b04('0x1d')]?_[_0x5b04('0x1f')](_0x399170[_0x5b04('0x1d')],function(_0x5eaa16){return{'model':db[_0x5eaa16[_0x5b04('0x1e')]],'as':_0x5eaa16['as'],'attributes':_0x5eaa16[_0x5b04('0x1c')],'include':_0x5eaa16[_0x5b04('0x1d')]?_[_0x5b04('0x1f')](_0x5eaa16[_0x5b04('0x1d')],function(_0x683706){return{'model':db[_0x683706[_0x5b04('0x1e')]],'as':_0x683706['as'],'attributes':_0x683706[_0x5b04('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x5b04('0xe')](function(_0x3f4e34){logger[_0x5b04('0xf')](_0x5b04('0x20'),_0x5621e0);logger[_0x5b04('0x11')](_0x5b04('0x20'),_0x5621e0,JSON['stringify'](_0x3f4e34));_0x4bf060(_0x3f4e34);})[_0x5b04('0x21')](function(_0x8d87a7){logger[_0x5b04('0x14')](_0x5b04('0x20'),_0x8d87a7['message'],_0x5621e0);_0x331c08(_0x46545e[_0x5b04('0x14')](0x1f4,_0x8d87a7[_0x5b04('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 8eb28bd..9d49f00 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(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xa9e0,0x123));var _0x0a9e=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0xa9e0[_0x43d11d];return _0x38cd08;};'use strict';var SmsAccountEvents=require(_0x0a9e('0x0'));var events=[_0x0a9e('0x1'),_0x0a9e('0x2'),'update'];function createListener(_0x550fbc,_0x18d5c9){return function(_0x4ce2f1){_0x18d5c9[_0x0a9e('0x3')](_0x550fbc,_0x4ce2f1);};}function removeListener(_0x432180,_0x2ab90b){return function(){SmsAccountEvents[_0x0a9e('0x4')](_0x432180,_0x2ab90b);};}exports[_0x0a9e('0x5')]=function(_0x57b080){for(var _0x219af0=0x0,_0x441e3a=events[_0x0a9e('0x6')];_0x219af0<_0x441e3a;_0x219af0++){var _0x5f41ea=events[_0x219af0];var _0x503809=createListener(_0x0a9e('0x7')+_0x5f41ea,_0x57b080);SmsAccountEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file +var _0xa9e0=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xa9e0,0x123));var _0x0a9e=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xa9e0[_0x24237f];return _0x48298e;};'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 06d43a5..64d51ca 100644 --- a/server/api/smsApplication/index.js +++ b/server/api/smsApplication/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x34e8=['../../config/environment','./smsApplication.controller','get','index','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x46ee1c,_0x45a091){var _0x23d17b=function(_0x29348b){while(--_0x29348b){_0x46ee1c['push'](_0x46ee1c['shift']());}};_0x23d17b(++_0x45a091);}(_0x34e8,0x12c));var _0x834e=function(_0x2cd1bd,_0x167f12){_0x2cd1bd=_0x2cd1bd-0x0;var _0x4694c0=_0x34e8[_0x2cd1bd];return _0x4694c0;};'use strict';var multer=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var path=require(_0x834e('0x2'));var timeout=require(_0x834e('0x3'));var express=require('express');var router=express[_0x834e('0x4')]();var fs_extra=require(_0x834e('0x5'));var auth=require(_0x834e('0x6'));var interaction=require(_0x834e('0x7'));var config=require(_0x834e('0x8'));var controller=require(_0x834e('0x9'));router[_0x834e('0xa')]('/',auth['isAuthenticated'](),controller[_0x834e('0xb')]);router['get'](_0x834e('0xc'),auth[_0x834e('0xd')](),controller[_0x834e('0xe')]);router[_0x834e('0xf')]('/',auth[_0x834e('0xd')](),controller[_0x834e('0x10')]);router[_0x834e('0x11')](_0x834e('0xc'),auth[_0x834e('0xd')](),controller[_0x834e('0x12')]);router[_0x834e('0x13')](_0x834e('0xc'),auth[_0x834e('0xd')](),controller[_0x834e('0x14')]);module[_0x834e('0x15')]=router; \ No newline at end of file +var _0x3e74=['path','connect-timeout','express','../../components/auth/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','exports','multer'];(function(_0x13553b,_0x10b2c0){var _0x10bcd4=function(_0x2cfc93){while(--_0x2cfc93){_0x13553b['push'](_0x13553b['shift']());}};_0x10bcd4(++_0x10b2c0);}(_0x3e74,0x175));var _0x43e7=function(_0x4f87ef,_0x5a1902){_0x4f87ef=_0x4f87ef-0x0;var _0x16b135=_0x3e74[_0x4f87ef];return _0x16b135;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x43e7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x43e7('0x5'));var controller=require(_0x43e7('0x6'));router[_0x43e7('0x7')]('/',auth[_0x43e7('0x8')](),controller[_0x43e7('0x9')]);router['get'](_0x43e7('0xa'),auth[_0x43e7('0x8')](),controller[_0x43e7('0xb')]);router[_0x43e7('0xc')]('/',auth[_0x43e7('0x8')](),controller['create']);router[_0x43e7('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x43e7('0xe')]);router[_0x43e7('0xf')]('/:id',auth[_0x43e7('0x8')](),controller['destroy']);module[_0x43e7('0x10')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index 20f0117..b7db5b8 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 _0xb617=['TEXT','STRING','INTEGER','noop'];(function(_0x28f412,_0x5c00c8){var _0x312e7b=function(_0x29a0f3){while(--_0x29a0f3){_0x28f412['push'](_0x28f412['shift']());}};_0x312e7b(++_0x5c00c8);}(_0xb617,0x15a));var _0x7b61=function(_0x3ccd29,_0x4339d1){_0x3ccd29=_0x3ccd29-0x0;var _0x4f9c9c=_0xb617[_0x3ccd29];return _0x4f9c9c;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize[_0x7b61('0x0')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x7b61('0x1')},'appdata':{'type':Sequelize[_0x7b61('0x2')]()},'description':{'type':Sequelize[_0x7b61('0x3')]},'interval':{'type':Sequelize[_0x7b61('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x8287=['sequelize','exports','INTEGER','STRING','TEXT','*,*,*,*'];(function(_0x1b828b,_0x344400){var _0x98da1a=function(_0x1a0f5b){while(--_0x1a0f5b){_0x1b828b['push'](_0x1b828b['shift']());}};_0x98da1a(++_0x344400);}(_0x8287,0x72));var _0x7828=function(_0x55ff79,_0x3d45e7){_0x55ff79=_0x55ff79-0x0;var _0x579067=_0x8287[_0x55ff79];return _0x579067;};'use strict';var Sequelize=require(_0x7828('0x0'));module[_0x7828('0x1')]={'priority':{'type':Sequelize[_0x7828('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x7828('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x7828('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x7828('0x3')],'defaultValue':_0x7828('0x5')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index 0879e35..f072066 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 _0x90df=['map','SmsApplication','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','filters','pick','merge','filter','options','includeAll','include','findAll','catch','show','keys','create','body','update','params','find','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','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','status','json','count','offset','set','Content-Range','apply','reject','save','then','destroy','end','error','stack','name','send','index'];(function(_0xa192fc,_0x1fd64a){var _0x283a70=function(_0x9dc9d6){while(--_0x9dc9d6){_0xa192fc['push'](_0xa192fc['shift']());}};_0x283a70(++_0x1fd64a);}(_0x90df,0x148));var _0xf90d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x90df[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf90d('0x0'));var zipdir=require(_0xf90d('0x1'));var jsonpatch=require(_0xf90d('0x2'));var rp=require(_0xf90d('0x3'));var moment=require('moment');var BPromise=require(_0xf90d('0x4'));var Mustache=require(_0xf90d('0x5'));var util=require(_0xf90d('0x6'));var path=require('path');var sox=require(_0xf90d('0x7'));var csv=require(_0xf90d('0x8'));var ejs=require(_0xf90d('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf90d('0xa'));var squel=require('squel');var crypto=require(_0xf90d('0xb'));var jsforce=require(_0xf90d('0xc'));var deskjs=require(_0xf90d('0xd'));var toCsv=require('to-csv');var querystring=require(_0xf90d('0xe'));var Papa=require('papaparse');var Redis=require(_0xf90d('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xf90d('0x10'));var as=require(_0xf90d('0x11'));var hardwareService=require(_0xf90d('0x12'));var logger=require(_0xf90d('0x13'))(_0xf90d('0x14'));var utils=require('../../config/utils');var config=require(_0xf90d('0x15'));var licenseUtil=require(_0xf90d('0x16'));var db=require(_0xf90d('0x17'))['db'];function respondWithStatusCode(_0x2b034b,_0x3e1b7b){_0x3e1b7b=_0x3e1b7b||0xcc;return function(_0x5e54e9){if(_0x5e54e9){return _0x2b034b[_0xf90d('0x18')](_0x3e1b7b);}return _0x2b034b[_0xf90d('0x19')](_0x3e1b7b)['end']();};}function respondWithResult(_0x586473,_0x582bca){_0x582bca=_0x582bca||0xc8;return function(_0x462389){if(_0x462389){return _0x586473['status'](_0x582bca)[_0xf90d('0x1a')](_0x462389);}};}function respondWithFilteredResult(_0x5ce07d,_0x371828){return function(_0x25db1a){if(_0x25db1a){var _0x12c119=typeof _0x371828['offset']==='undefined'&&typeof _0x371828['limit']==='undefined';var _0x3cca1d=_0x25db1a[_0xf90d('0x1b')];var _0x4eb5c5=_0x12c119?0x0:_0x371828[_0xf90d('0x1c')];var _0x1ea544=_0x12c119?_0x25db1a[_0xf90d('0x1b')]:_0x371828[_0xf90d('0x1c')]+_0x371828['limit'];var _0x54caa2;if(_0x1ea544>=_0x3cca1d){_0x1ea544=_0x3cca1d;_0x54caa2=0xc8;}else{_0x54caa2=0xce;}_0x5ce07d[_0xf90d('0x19')](_0x54caa2);return _0x5ce07d[_0xf90d('0x1d')](_0xf90d('0x1e'),_0x4eb5c5+'-'+_0x1ea544+'/'+_0x3cca1d)['json'](_0x25db1a);}return null;};}function patchUpdates(_0x818543){return function(_0x198911){try{jsonpatch[_0xf90d('0x1f')](_0x198911,_0x818543,!![]);}catch(_0x1782d0){return BPromise[_0xf90d('0x20')](_0x1782d0);}return _0x198911[_0xf90d('0x21')]();};}function saveUpdates(_0x590e13,_0x4b3dbb){return function(_0x2df657){if(_0x2df657){return _0x2df657['update'](_0x590e13)[_0xf90d('0x22')](function(_0x200481){return _0x200481;});}return null;};}function removeEntity(_0x352654,_0x2ed617){return function(_0x72de7a){if(_0x72de7a){return _0x72de7a[_0xf90d('0x23')]()['then'](function(){_0x352654[_0xf90d('0x19')](0xcc)[_0xf90d('0x24')]();});}};}function handleEntityNotFound(_0x36e749,_0x488002){return function(_0x12811c){if(!_0x12811c){_0x36e749[_0xf90d('0x18')](0x194);}return _0x12811c;};}function handleError(_0x40090f,_0x22bbef){_0x22bbef=_0x22bbef||0x1f4;return function(_0x3c221d){logger[_0xf90d('0x25')](_0x3c221d[_0xf90d('0x26')]);if(_0x3c221d[_0xf90d('0x27')]){delete _0x3c221d['name'];}_0x40090f['status'](_0x22bbef)[_0xf90d('0x28')](_0x3c221d);};}exports[_0xf90d('0x29')]=function(_0x47cd9c,_0x93957b){var _0x57d32d={},_0x274d3c={},_0x5856c7={'count':0x0,'rows':[]};var _0x3ca0b7=_[_0xf90d('0x2a')](db[_0xf90d('0x2b')]['rawAttributes'],function(_0x52bc13){return{'name':_0x52bc13[_0xf90d('0x2c')],'type':_0x52bc13[_0xf90d('0x2d')][_0xf90d('0x2e')]};});_0x274d3c[_0xf90d('0x2f')]=_[_0xf90d('0x2a')](_0x3ca0b7,_0xf90d('0x27'));_0x274d3c[_0xf90d('0x30')]=_['keys'](_0x47cd9c[_0xf90d('0x30')]);_0x274d3c['filters']=_[_0xf90d('0x31')](_0x274d3c['model'],_0x274d3c['query']);_0x57d32d[_0xf90d('0x32')]=_['intersection'](_0x274d3c[_0xf90d('0x2f')],qs[_0xf90d('0x33')](_0x47cd9c[_0xf90d('0x30')][_0xf90d('0x33')]));_0x57d32d[_0xf90d('0x32')]=_0x57d32d[_0xf90d('0x32')][_0xf90d('0x34')]?_0x57d32d[_0xf90d('0x32')]:_0x274d3c[_0xf90d('0x2f')];if(!_0x47cd9c['query'][_0xf90d('0x35')]('nolimit')){_0x57d32d['limit']=qs[_0xf90d('0x36')](_0x47cd9c['query'][_0xf90d('0x36')]);_0x57d32d['offset']=qs[_0xf90d('0x1c')](_0x47cd9c[_0xf90d('0x30')][_0xf90d('0x1c')]);}_0x57d32d[_0xf90d('0x37')]=qs[_0xf90d('0x38')](_0x47cd9c[_0xf90d('0x30')][_0xf90d('0x38')]);_0x57d32d[_0xf90d('0x39')]=qs[_0xf90d('0x3a')](_[_0xf90d('0x3b')](_0x47cd9c[_0xf90d('0x30')],_0x274d3c[_0xf90d('0x3a')]),_0x3ca0b7);if(_0x47cd9c['query']['filter']){_0x57d32d[_0xf90d('0x39')]=_[_0xf90d('0x3c')](_0x57d32d[_0xf90d('0x39')],{'$or':_['map'](_0x3ca0b7,function(_0x537391){if(_0x537391['type']!=='VIRTUAL'){var _0x5a04f0={};_0x5a04f0[_0x537391[_0xf90d('0x27')]]={'$like':'%'+_0x47cd9c[_0xf90d('0x30')][_0xf90d('0x3d')]+'%'};return _0x5a04f0;}})});}_0x57d32d=_['merge']({},_0x57d32d,_0x47cd9c[_0xf90d('0x3e')]);var _0x5d559f={'where':_0x57d32d[_0xf90d('0x39')]};return db['SmsApplication'][_0xf90d('0x1b')](_0x5d559f)[_0xf90d('0x22')](function(_0x6076dd){_0x5856c7[_0xf90d('0x1b')]=_0x6076dd;if(_0x47cd9c[_0xf90d('0x30')][_0xf90d('0x3f')]){_0x57d32d[_0xf90d('0x40')]=[{'all':!![]}];}return db['SmsApplication'][_0xf90d('0x41')](_0x57d32d);})[_0xf90d('0x22')](function(_0xc0195b){_0x5856c7['rows']=_0xc0195b;return _0x5856c7;})[_0xf90d('0x22')](respondWithFilteredResult(_0x93957b,_0x57d32d))[_0xf90d('0x42')](handleError(_0x93957b,null));};exports[_0xf90d('0x43')]=function(_0x26301c,_0x1521a2){var _0x36b583={'raw':!![],'where':{'id':_0x26301c['params']['id']}},_0x1997e2={};_0x1997e2[_0xf90d('0x2f')]=_['keys'](db[_0xf90d('0x2b')]['rawAttributes']);_0x1997e2['query']=_[_0xf90d('0x44')](_0x26301c[_0xf90d('0x30')]);_0x1997e2[_0xf90d('0x3a')]=_[_0xf90d('0x31')](_0x1997e2['model'],_0x1997e2['query']);_0x36b583[_0xf90d('0x32')]=_['intersection'](_0x1997e2['model'],qs[_0xf90d('0x33')](_0x26301c['query']['fields']));_0x36b583[_0xf90d('0x32')]=_0x36b583[_0xf90d('0x32')][_0xf90d('0x34')]?_0x36b583[_0xf90d('0x32')]:_0x1997e2[_0xf90d('0x2f')];if(_0x26301c[_0xf90d('0x30')]['includeAll']){_0x36b583[_0xf90d('0x40')]=[{'all':!![]}];}_0x36b583=_[_0xf90d('0x3c')]({},_0x36b583,_0x26301c[_0xf90d('0x3e')]);return db[_0xf90d('0x2b')]['find'](_0x36b583)['then'](handleEntityNotFound(_0x1521a2,null))[_0xf90d('0x22')](respondWithResult(_0x1521a2,null))[_0xf90d('0x42')](handleError(_0x1521a2,null));};exports['create']=function(_0x599803,_0x39b892){return db[_0xf90d('0x2b')][_0xf90d('0x45')](_0x599803[_0xf90d('0x46')],{})[_0xf90d('0x22')](respondWithResult(_0x39b892,0xc9))[_0xf90d('0x42')](handleError(_0x39b892,null));};exports[_0xf90d('0x47')]=function(_0x823dcd,_0x40a634){if(_0x823dcd[_0xf90d('0x46')]['id']){delete _0x823dcd[_0xf90d('0x46')]['id'];}return db[_0xf90d('0x2b')]['find']({'where':{'id':_0x823dcd[_0xf90d('0x48')]['id']}})['then'](handleEntityNotFound(_0x40a634,null))['then'](saveUpdates(_0x823dcd[_0xf90d('0x46')],null))[_0xf90d('0x22')](respondWithResult(_0x40a634,null))[_0xf90d('0x42')](handleError(_0x40a634,null));};exports[_0xf90d('0x23')]=function(_0x37e3bb,_0x27baf7){return db[_0xf90d('0x2b')][_0xf90d('0x49')]({'where':{'id':_0x37e3bb[_0xf90d('0x48')]['id']}})[_0xf90d('0x22')](handleEntityNotFound(_0x27baf7,null))['then'](removeEntity(_0x27baf7,null))[_0xf90d('0x42')](handleError(_0x27baf7,null));}; \ No newline at end of file +var _0xe01a=['then','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','SmsApplication','include','findAll','rows','catch','keys','includeAll','find','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','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','end','status','json','offset','limit','count','set','Content-Range','apply','reject','save','update','destroy'];(function(_0x12cf59,_0x50fc5c){var _0x2aca7c=function(_0x37d638){while(--_0x37d638){_0x12cf59['push'](_0x12cf59['shift']());}};_0x2aca7c(++_0x50fc5c);}(_0xe01a,0x1e1));var _0xae01=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xe01a[_0x2641f9];return _0x585741;};'use strict';var emlformat=require(_0xae01('0x0'));var rimraf=require(_0xae01('0x1'));var zipdir=require(_0xae01('0x2'));var jsonpatch=require(_0xae01('0x3'));var rp=require(_0xae01('0x4'));var moment=require(_0xae01('0x5'));var BPromise=require(_0xae01('0x6'));var Mustache=require(_0xae01('0x7'));var util=require(_0xae01('0x8'));var path=require(_0xae01('0x9'));var sox=require(_0xae01('0xa'));var csv=require(_0xae01('0xb'));var ejs=require(_0xae01('0xc'));var fs=require('fs');var fs_extra=require(_0xae01('0xd'));var _=require(_0xae01('0xe'));var squel=require('squel');var crypto=require(_0xae01('0xf'));var jsforce=require(_0xae01('0x10'));var deskjs=require(_0xae01('0x11'));var toCsv=require(_0xae01('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xae01('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xae01('0x13'))(_0xae01('0x14'));var utils=require(_0xae01('0x15'));var config=require(_0xae01('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x15bee7,_0x2c33dc){_0x2c33dc=_0x2c33dc||0xcc;return function(_0x4b5105){if(_0x4b5105){return _0x15bee7[_0xae01('0x17')](_0x2c33dc);}return _0x15bee7['status'](_0x2c33dc)[_0xae01('0x18')]();};}function respondWithResult(_0x16c53d,_0x176d0d){_0x176d0d=_0x176d0d||0xc8;return function(_0x4f3c66){if(_0x4f3c66){return _0x16c53d[_0xae01('0x19')](_0x176d0d)[_0xae01('0x1a')](_0x4f3c66);}};}function respondWithFilteredResult(_0x38b6a5,_0x3971f){return function(_0x5ab403){if(_0x5ab403){var _0x273808=typeof _0x3971f[_0xae01('0x1b')]==='undefined'&&typeof _0x3971f[_0xae01('0x1c')]==='undefined';var _0x42db46=_0x5ab403[_0xae01('0x1d')];var _0x59da92=_0x273808?0x0:_0x3971f['offset'];var _0x13f396=_0x273808?_0x5ab403[_0xae01('0x1d')]:_0x3971f[_0xae01('0x1b')]+_0x3971f[_0xae01('0x1c')];var _0x4a555c;if(_0x13f396>=_0x42db46){_0x13f396=_0x42db46;_0x4a555c=0xc8;}else{_0x4a555c=0xce;}_0x38b6a5[_0xae01('0x19')](_0x4a555c);return _0x38b6a5[_0xae01('0x1e')](_0xae01('0x1f'),_0x59da92+'-'+_0x13f396+'/'+_0x42db46)['json'](_0x5ab403);}return null;};}function patchUpdates(_0x520dd7){return function(_0x4232ba){try{jsonpatch[_0xae01('0x20')](_0x4232ba,_0x520dd7,!![]);}catch(_0x409f72){return BPromise[_0xae01('0x21')](_0x409f72);}return _0x4232ba[_0xae01('0x22')]();};}function saveUpdates(_0x2a2601,_0x154f23){return function(_0x6c5672){if(_0x6c5672){return _0x6c5672[_0xae01('0x23')](_0x2a2601)['then'](function(_0x291b41){return _0x291b41;});}return null;};}function removeEntity(_0x755f10,_0x589bab){return function(_0x20dbdf){if(_0x20dbdf){return _0x20dbdf[_0xae01('0x24')]()[_0xae01('0x25')](function(){_0x755f10[_0xae01('0x19')](0xcc)[_0xae01('0x18')]();});}};}function handleEntityNotFound(_0x159362,_0x2cdaf5){return function(_0x2e1c39){if(!_0x2e1c39){_0x159362[_0xae01('0x17')](0x194);}return _0x2e1c39;};}function handleError(_0x3105a8,_0x1860ad){_0x1860ad=_0x1860ad||0x1f4;return function(_0x25cf38){logger[_0xae01('0x26')](_0x25cf38[_0xae01('0x27')]);if(_0x25cf38[_0xae01('0x28')]){delete _0x25cf38[_0xae01('0x28')];}_0x3105a8[_0xae01('0x19')](_0x1860ad)[_0xae01('0x29')](_0x25cf38);};}exports['index']=function(_0x7091ef,_0x115539){var _0x179d9c={},_0x26772e={},_0x59beb4={'count':0x0,'rows':[]};var _0x11a024=_[_0xae01('0x2a')](db['SmsApplication'][_0xae01('0x2b')],function(_0x27e056){return{'name':_0x27e056[_0xae01('0x2c')],'type':_0x27e056[_0xae01('0x2d')][_0xae01('0x2e')]};});_0x26772e[_0xae01('0x2f')]=_[_0xae01('0x2a')](_0x11a024,_0xae01('0x28'));_0x26772e[_0xae01('0x30')]=_['keys'](_0x7091ef[_0xae01('0x30')]);_0x26772e[_0xae01('0x31')]=_[_0xae01('0x32')](_0x26772e['model'],_0x26772e['query']);_0x179d9c[_0xae01('0x33')]=_['intersection'](_0x26772e[_0xae01('0x2f')],qs[_0xae01('0x34')](_0x7091ef[_0xae01('0x30')][_0xae01('0x34')]));_0x179d9c[_0xae01('0x33')]=_0x179d9c[_0xae01('0x33')][_0xae01('0x35')]?_0x179d9c[_0xae01('0x33')]:_0x26772e[_0xae01('0x2f')];if(!_0x7091ef['query'][_0xae01('0x36')](_0xae01('0x37'))){_0x179d9c[_0xae01('0x1c')]=qs[_0xae01('0x1c')](_0x7091ef[_0xae01('0x30')][_0xae01('0x1c')]);_0x179d9c[_0xae01('0x1b')]=qs['offset'](_0x7091ef[_0xae01('0x30')]['offset']);}_0x179d9c[_0xae01('0x38')]=qs[_0xae01('0x39')](_0x7091ef[_0xae01('0x30')][_0xae01('0x39')]);_0x179d9c[_0xae01('0x3a')]=qs[_0xae01('0x31')](_[_0xae01('0x3b')](_0x7091ef[_0xae01('0x30')],_0x26772e['filters']),_0x11a024);if(_0x7091ef[_0xae01('0x30')][_0xae01('0x3c')]){_0x179d9c['where']=_['merge'](_0x179d9c[_0xae01('0x3a')],{'$or':_[_0xae01('0x2a')](_0x11a024,function(_0x5b9683){if(_0x5b9683['type']!==_0xae01('0x3d')){var _0x90b74e={};_0x90b74e[_0x5b9683[_0xae01('0x28')]]={'$like':'%'+_0x7091ef[_0xae01('0x30')]['filter']+'%'};return _0x90b74e;}})});}_0x179d9c=_[_0xae01('0x3e')]({},_0x179d9c,_0x7091ef[_0xae01('0x3f')]);var _0x1af197={'where':_0x179d9c[_0xae01('0x3a')]};return db[_0xae01('0x40')][_0xae01('0x1d')](_0x1af197)[_0xae01('0x25')](function(_0x49cd17){_0x59beb4[_0xae01('0x1d')]=_0x49cd17;if(_0x7091ef[_0xae01('0x30')]['includeAll']){_0x179d9c[_0xae01('0x41')]=[{'all':!![]}];}return db[_0xae01('0x40')][_0xae01('0x42')](_0x179d9c);})['then'](function(_0x52f98c){_0x59beb4[_0xae01('0x43')]=_0x52f98c;return _0x59beb4;})[_0xae01('0x25')](respondWithFilteredResult(_0x115539,_0x179d9c))[_0xae01('0x44')](handleError(_0x115539,null));};exports['show']=function(_0x58ba5a,_0x1176c2){var _0x13244e={'raw':!![],'where':{'id':_0x58ba5a['params']['id']}},_0x43ff64={};_0x43ff64['model']=_[_0xae01('0x45')](db[_0xae01('0x40')][_0xae01('0x2b')]);_0x43ff64[_0xae01('0x30')]=_[_0xae01('0x45')](_0x58ba5a[_0xae01('0x30')]);_0x43ff64[_0xae01('0x31')]=_[_0xae01('0x32')](_0x43ff64[_0xae01('0x2f')],_0x43ff64[_0xae01('0x30')]);_0x13244e[_0xae01('0x33')]=_[_0xae01('0x32')](_0x43ff64['model'],qs['fields'](_0x58ba5a['query'][_0xae01('0x34')]));_0x13244e[_0xae01('0x33')]=_0x13244e['attributes'][_0xae01('0x35')]?_0x13244e['attributes']:_0x43ff64[_0xae01('0x2f')];if(_0x58ba5a[_0xae01('0x30')][_0xae01('0x46')]){_0x13244e['include']=[{'all':!![]}];}_0x13244e=_[_0xae01('0x3e')]({},_0x13244e,_0x58ba5a['options']);return db[_0xae01('0x40')][_0xae01('0x47')](_0x13244e)[_0xae01('0x25')](handleEntityNotFound(_0x1176c2,null))[_0xae01('0x25')](respondWithResult(_0x1176c2,null))[_0xae01('0x44')](handleError(_0x1176c2,null));};exports['create']=function(_0x244128,_0x5ef1a4){return db['SmsApplication']['create'](_0x244128['body'],{})[_0xae01('0x25')](respondWithResult(_0x5ef1a4,0xc9))[_0xae01('0x44')](handleError(_0x5ef1a4,null));};exports['update']=function(_0x10afbe,_0x489c01){if(_0x10afbe[_0xae01('0x48')]['id']){delete _0x10afbe[_0xae01('0x48')]['id'];}return db[_0xae01('0x40')][_0xae01('0x47')]({'where':{'id':_0x10afbe['params']['id']}})[_0xae01('0x25')](handleEntityNotFound(_0x489c01,null))['then'](saveUpdates(_0x10afbe['body'],null))[_0xae01('0x25')](respondWithResult(_0x489c01,null))['catch'](handleError(_0x489c01,null));};exports[_0xae01('0x24')]=function(_0x1502dc,_0x4781f9){return db['SmsApplication'][_0xae01('0x47')]({'where':{'id':_0x1502dc[_0xae01('0x49')]['id']}})[_0xae01('0x25')](handleEntityNotFound(_0x4781f9,null))[_0xae01('0x25')](removeEntity(_0x4781f9,null))[_0xae01('0x44')](handleError(_0x4781f9,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index db18b70..ec2ff51 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 _0x770d=['utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./smsApplication.attributes','exports','define','SmsApplication','sms_applications'];(function(_0x2ba8cc,_0x2ccb6d){var _0x53b54c=function(_0x37042a){while(--_0x37042a){_0x2ba8cc['push'](_0x2ba8cc['shift']());}};_0x53b54c(++_0x2ccb6d);}(_0x770d,0x122));var _0xd770=function(_0x931c95,_0x2b3e1e){_0x931c95=_0x931c95-0x0;var _0x5b3d92=_0x770d[_0x931c95];return _0x5b3d92;};'use strict';var _=require(_0xd770('0x0'));var util=require(_0xd770('0x1'));var logger=require(_0xd770('0x2'))(_0xd770('0x3'));var moment=require(_0xd770('0x4'));var BPromise=require(_0xd770('0x5'));var rp=require(_0xd770('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd770('0x7'));var config=require(_0xd770('0x8'));var attributes=require(_0xd770('0x9'));module[_0xd770('0xa')]=function(_0x5d3b18,_0x554c5e){return _0x5d3b18[_0xd770('0xb')](_0xd770('0xc'),attributes,{'tableName':_0xd770('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xd770('0xe'),'collate':_0xd770('0xf')});}; \ No newline at end of file +var _0x2351=['util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./smsApplication.attributes','exports','define','SmsApplication','sms_applications','lodash'];(function(_0x44ca27,_0x81f0da){var _0x38bc17=function(_0x476f85){while(--_0x476f85){_0x44ca27['push'](_0x44ca27['shift']());}};_0x38bc17(++_0x81f0da);}(_0x2351,0x125));var _0x1235=function(_0x2f7ce2,_0x16291b){_0x2f7ce2=_0x2f7ce2-0x0;var _0x2b65df=_0x2351[_0x2f7ce2];return _0x2b65df;};'use strict';var _=require(_0x1235('0x0'));var util=require(_0x1235('0x1'));var logger=require(_0x1235('0x2'))(_0x1235('0x3'));var moment=require(_0x1235('0x4'));var BPromise=require(_0x1235('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1235('0x6'));var rimraf=require(_0x1235('0x7'));var config=require(_0x1235('0x8'));var attributes=require(_0x1235('0x9'));module[_0x1235('0xa')]=function(_0x2b7f5f,_0x1aedfd){return _0x2b7f5f[_0x1235('0xb')](_0x1235('0xc'),attributes,{'tableName':_0x1235('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','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 0141289..e4d42ec 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 _0x8b0e=['client','http','request','then','info','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x2555d0,_0x4150a6){var _0x3bb486=function(_0x1eb89f){while(--_0x1eb89f){_0x2555d0['push'](_0x2555d0['shift']());}};_0x3bb486(++_0x4150a6);}(_0x8b0e,0x166));var _0xe8b0=function(_0xe8129c,_0x2fb03c){_0xe8129c=_0xe8129c-0x0;var _0x709fc5=_0x8b0e[_0xe8129c];return _0x709fc5;};'use strict';var _=require(_0xe8b0('0x0'));var util=require(_0xe8b0('0x1'));var moment=require(_0xe8b0('0x2'));var BPromise=require(_0xe8b0('0x3'));var rs=require(_0xe8b0('0x4'));var fs=require('fs');var Redis=require(_0xe8b0('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xe8b0('0x6'));var logger=require('../../config/logger')(_0xe8b0('0x7'));var config=require(_0xe8b0('0x8'));var jayson=require(_0xe8b0('0x9'));var client=jayson[_0xe8b0('0xa')][_0xe8b0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x35fe3d,_0x25faf7,_0x2e56f4){return new BPromise(function(_0x59f3a4,_0x103966){return client[_0xe8b0('0xc')](_0x35fe3d,_0x2e56f4)[_0xe8b0('0xd')](function(_0x82589f){logger[_0xe8b0('0xe')](_0xe8b0('0xf'),_0x25faf7,_0xe8b0('0x10'));logger[_0xe8b0('0x11')](_0xe8b0('0x12'),_0x25faf7,'request\x20sent',JSON['stringify'](_0x82589f));if(_0x82589f[_0xe8b0('0x13')]){if(_0x82589f[_0xe8b0('0x13')][_0xe8b0('0x14')]===0x1f4){logger['error'](_0xe8b0('0xf'),_0x25faf7,_0x82589f[_0xe8b0('0x13')][_0xe8b0('0x15')]);return _0x103966(_0x82589f[_0xe8b0('0x13')][_0xe8b0('0x15')]);}logger[_0xe8b0('0x13')](_0xe8b0('0xf'),_0x25faf7,_0x82589f['error'][_0xe8b0('0x15')]);return _0x59f3a4(_0x82589f[_0xe8b0('0x13')][_0xe8b0('0x15')]);}else{logger['info'](_0xe8b0('0xf'),_0x25faf7,'request\x20sent');_0x59f3a4(_0x82589f['result']['message']);}})[_0xe8b0('0x16')](function(_0x3818a7){logger['error'](_0xe8b0('0xf'),_0x25faf7,_0x3818a7);_0x103966(_0x3818a7);});});} \ No newline at end of file +var _0x5f2f=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','SmsApplication,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch'];(function(_0x317636,_0x28b9bc){var _0x1953bb=function(_0x2ff8fc){while(--_0x2ff8fc){_0x317636['push'](_0x317636['shift']());}};_0x1953bb(++_0x28b9bc);}(_0x5f2f,0x73));var _0xf5f2=function(_0x3c5c0a,_0xd38ac7){_0x3c5c0a=_0x3c5c0a-0x0;var _0x273361=_0x5f2f[_0x3c5c0a];return _0x273361;};'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')]('SmsApplication,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 3f8a97b..d3672d2 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 _0xed3c=['sms','smsinteraction:addtags','addTags','put','tracked','smsinteraction:update','update','delete','/:id','smsinteraction:destroy','destroy','/:id/tags','removeTags','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','./smsInteraction.controller','get','isAuthenticated','index','describe','show','/:id/messages','getMessages','/:id/download','download','create','post','addMessage'];(function(_0x24181a,_0x1ef764){var _0xe3d59a=function(_0x434449){while(--_0x434449){_0x24181a['push'](_0x24181a['shift']());}};_0xe3d59a(++_0x1ef764);}(_0xed3c,0x1a6));var _0xced3=function(_0x321728,_0x1fbc48){_0x321728=_0x321728-0x0;var _0x211876=_0xed3c[_0x321728];return _0x211876;};'use strict';var multer=require(_0xced3('0x0'));var util=require(_0xced3('0x1'));var path=require(_0xced3('0x2'));var timeout=require(_0xced3('0x3'));var express=require('express');var router=express[_0xced3('0x4')]();var fs_extra=require(_0xced3('0x5'));var auth=require(_0xced3('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xced3('0x7'));router[_0xced3('0x8')]('/',auth[_0xced3('0x9')](),controller[_0xced3('0xa')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0xced3('0xb')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xced3('0xc')]);router[_0xced3('0x8')](_0xced3('0xd'),auth[_0xced3('0x9')](),controller[_0xced3('0xe')]);router['get'](_0xced3('0xf'),auth[_0xced3('0x9')](),controller[_0xced3('0x10')]);router['post']('/',auth[_0xced3('0x9')](),controller[_0xced3('0x11')]);router[_0xced3('0x12')](_0xced3('0xd'),auth[_0xced3('0x9')](),controller[_0xced3('0x13')]);router[_0xced3('0x12')]('/:id/tags',auth[_0xced3('0x9')](),interaction['tracked'](_0xced3('0x14'),_0xced3('0x15')),controller[_0xced3('0x16')]);router[_0xced3('0x17')]('/:id',auth[_0xced3('0x9')](),interaction[_0xced3('0x18')]('sms',_0xced3('0x19')),controller[_0xced3('0x1a')]);router[_0xced3('0x1b')](_0xced3('0x1c'),auth['isAuthenticated'](),interaction[_0xced3('0x18')]('sms',_0xced3('0x1d')),controller[_0xced3('0x1e')]);router[_0xced3('0x1b')](_0xced3('0x1f'),auth[_0xced3('0x9')](),controller[_0xced3('0x20')]);module[_0xced3('0x21')]=router; \ No newline at end of file +var _0x6e6c=['create','addMessage','tracked','sms','smsinteraction:addtags','addTags','/:id','smsinteraction:update','update','smsinteraction:destroy','destroy','delete','/:id/tags','removeTags','exports','multer','util','connect-timeout','express','../../components/auth/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id/messages','getMessages','/:id/download','download','post'];(function(_0x34e5e4,_0x394b04){var _0x37fd15=function(_0x53561d){while(--_0x53561d){_0x34e5e4['push'](_0x34e5e4['shift']());}};_0x37fd15(++_0x394b04);}(_0x6e6c,0xc3));var _0xc6e6=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6e6c[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0xc6e6('0x0'));var util=require(_0xc6e6('0x1'));var path=require('path');var timeout=require(_0xc6e6('0x2'));var express=require(_0xc6e6('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xc6e6('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xc6e6('0x5'));var controller=require('./smsInteraction.controller');router[_0xc6e6('0x6')]('/',auth[_0xc6e6('0x7')](),controller['index']);router[_0xc6e6('0x6')](_0xc6e6('0x8'),auth['isAuthenticated'](),controller[_0xc6e6('0x9')]);router[_0xc6e6('0x6')]('/:id',auth[_0xc6e6('0x7')](),controller['show']);router[_0xc6e6('0x6')](_0xc6e6('0xa'),auth[_0xc6e6('0x7')](),controller[_0xc6e6('0xb')]);router[_0xc6e6('0x6')](_0xc6e6('0xc'),auth[_0xc6e6('0x7')](),controller[_0xc6e6('0xd')]);router[_0xc6e6('0xe')]('/',auth['isAuthenticated'](),controller[_0xc6e6('0xf')]);router['post'](_0xc6e6('0xa'),auth[_0xc6e6('0x7')](),controller[_0xc6e6('0x10')]);router[_0xc6e6('0xe')]('/:id/tags',auth[_0xc6e6('0x7')](),interaction[_0xc6e6('0x11')](_0xc6e6('0x12'),_0xc6e6('0x13')),controller[_0xc6e6('0x14')]);router['put'](_0xc6e6('0x15'),auth[_0xc6e6('0x7')](),interaction['tracked'](_0xc6e6('0x12'),_0xc6e6('0x16')),controller[_0xc6e6('0x17')]);router['delete']('/:id',auth['isAuthenticated'](),interaction[_0xc6e6('0x11')]('sms',_0xc6e6('0x18')),controller[_0xc6e6('0x19')]);router[_0xc6e6('0x1a')](_0xc6e6('0x1b'),auth[_0xc6e6('0x7')](),controller[_0xc6e6('0x1c')]);module[_0xc6e6('0x1d')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index afdfe26..554664f 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 _0x00ea=['STRING','ENUM','out','BOOLEAN','INTEGER','moment','exports','DATE'];(function(_0x56974d,_0xf84545){var _0x27e676=function(_0x584e8b){while(--_0x584e8b){_0x56974d['push'](_0x56974d['shift']());}};_0x27e676(++_0xf84545);}(_0x00ea,0x19d));var _0xa00e=function(_0x22c45b,_0x36c4d6){_0x22c45b=_0x22c45b-0x0;var _0xe984ad=_0x00ea[_0x22c45b];return _0xe984ad;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xa00e('0x0'));module[_0xa00e('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xa00e('0x2')]},'disposition':{'type':Sequelize[_0xa00e('0x3')]},'secondDisposition':{'type':Sequelize[_0xa00e('0x3')]},'thirdDisposition':{'type':Sequelize[_0xa00e('0x3')]},'note':{'type':Sequelize[_0xa00e('0x3')]},'phone':{'type':Sequelize[_0xa00e('0x3')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0xa00e('0x4')]('in',_0xa00e('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xa00e('0x2')]},'lastMsgDirection':{'type':Sequelize[_0xa00e('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xa00e('0x6')],'defaultValue':![]},'queueId':{'type':Sequelize[_0xa00e('0x7')]}}; \ No newline at end of file +var _0x62cf=['ENUM','out','BOOLEAN','sequelize','exports','DATE','STRING'];(function(_0x5ed0ef,_0x7823a1){var _0xd1c4ef=function(_0x3146ba){while(--_0x3146ba){_0x5ed0ef['push'](_0x5ed0ef['shift']());}};_0xd1c4ef(++_0x7823a1);}(_0x62cf,0x81));var _0xf62c=function(_0x545963,_0x275787){_0x545963=_0x545963-0x0;var _0x5761df=_0x62cf[_0x545963];return _0x5761df;};'use strict';var Sequelize=require(_0xf62c('0x0'));var moment=require('moment');module[_0xf62c('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xf62c('0x2')]},'disposition':{'type':Sequelize[_0xf62c('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xf62c('0x3')]},'phone':{'type':Sequelize[_0xf62c('0x3')]},'read1stAt':{'type':Sequelize[_0xf62c('0x2')]},'firstMsgDirection':{'type':Sequelize[_0xf62c('0x4')]('in',_0xf62c('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xf62c('0x2')]},'lastMsgDirection':{'type':Sequelize[_0xf62c('0x4')]('in',_0xf62c('0x5')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xf62c('0x6')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index 5c48263..9c489d2 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 _0xd0cd=['../../config/logger','api','../../mysqldb','redis','localhost','socket.io-emitter','./smsInteraction.socket','register','status','end','json','limit','undefined','count','offset','set','update','sendStatus','error','stack','send','SmsInteraction','fieldName','type','key','findAll','sms','query','user','then','catch','show','keys','filters','model','intersection','fields','attributes','length','includeAll','include','merge','options','create','body','find','params','destroy','describe','SmsMessage','ids','omit','getMessages','findOne','rawAttributes','hasOwnProperty','nolimit','order','sort','where','SmsInteractionId','filter','map','$gte','split','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','setTags','spread','name','color','emit','smsInteractionTags:save','removeTags','download','unix','toString','join','root','server','tmp','format','transcript-%d-%s.zip','push','User','fullname','CmContact','Contact','firstName','lastName','Messages','direction','secret','SmsAccount','Account','Owner','Sms','createdAt','closedAt','disposition','out','System','read','value','renderFile','views','downloadInteraction.ejs','transcript-','createPdfFromHTML','moment','bluebird','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf'];(function(_0x210d7f,_0x2abe4f){var _0x42d687=function(_0x46b2ae){while(--_0x46b2ae){_0x210d7f['push'](_0x210d7f['shift']());}};_0x42d687(++_0x2abe4f);}(_0xd0cd,0xe5));var _0xdd0c=function(_0x1ff414,_0x12c95d){_0x1ff414=_0x1ff414-0x0;var _0x52c0fa=_0xd0cd[_0x1ff414];return _0x52c0fa;};'use strict';var rimraf=require('rimraf');var zipdir=require('zip-dir');var moment=require(_0xdd0c('0x0'));var BPromise=require(_0xdd0c('0x1'));var util=require('util');var path=require(_0xdd0c('0x2'));var ejs=require(_0xdd0c('0x3'));var fs=require('fs');var _=require(_0xdd0c('0x4'));var Redis=require(_0xdd0c('0x5'));var interaction=require(_0xdd0c('0x6'));var qs=require(_0xdd0c('0x7'));var pdf=require(_0xdd0c('0x8'));var logger=require(_0xdd0c('0x9'))(_0xdd0c('0xa'));var config=require('../../config/environment');var db=require(_0xdd0c('0xb'))['db'];config[_0xdd0c('0xc')]=_['defaults'](config[_0xdd0c('0xc')],{'host':_0xdd0c('0xd'),'port':0x18eb});var socket=require(_0xdd0c('0xe'))(new Redis(config[_0xdd0c('0xc')]));require(_0xdd0c('0xf'))[_0xdd0c('0x10')](socket);function respondWithStatusCode(_0x1de343,_0x4d0aca){_0x4d0aca=_0x4d0aca||0xcc;return function(_0x389ea9){if(_0x389ea9){return _0x1de343['sendStatus'](_0x4d0aca);}return _0x1de343[_0xdd0c('0x11')](_0x4d0aca)[_0xdd0c('0x12')]();};}function respondWithResult(_0x4e7cdf,_0x1674be){_0x1674be=_0x1674be||0xc8;return function(_0x262d9c){if(_0x262d9c){return _0x4e7cdf[_0xdd0c('0x11')](_0x1674be)[_0xdd0c('0x13')](_0x262d9c);}};}function respondWithFilteredResult(_0x5f5f1,_0x1fd833){return function(_0x565bf6){if(_0x565bf6){var _0x2bac95=typeof _0x1fd833['offset']==='undefined'&&typeof _0x1fd833[_0xdd0c('0x14')]===_0xdd0c('0x15');var _0x166f37=_0x565bf6[_0xdd0c('0x16')];var _0x3c469e=_0x2bac95?0x0:_0x1fd833[_0xdd0c('0x17')];var _0x3a8e2b=_0x2bac95?_0x565bf6[_0xdd0c('0x16')]:_0x1fd833[_0xdd0c('0x17')]+_0x1fd833['limit'];var _0x2c2eee;if(_0x3a8e2b>=_0x166f37){_0x3a8e2b=_0x166f37;_0x2c2eee=0xc8;}else{_0x2c2eee=0xce;}_0x5f5f1[_0xdd0c('0x11')](_0x2c2eee);return _0x5f5f1[_0xdd0c('0x18')]('Content-Range',_0x3c469e+'-'+_0x3a8e2b+'/'+_0x166f37)[_0xdd0c('0x13')](_0x565bf6);}return null;};}function saveUpdates(_0x57b13f){return function(_0x365af0){if(_0x365af0){return _0x365af0[_0xdd0c('0x19')](_0x57b13f)['then'](function(_0x19c3d9){return _0x19c3d9;});}return null;};}function removeEntity(_0x44fd0c){return function(_0x4d35e2){if(_0x4d35e2){return _0x4d35e2['destroy']()['then'](function(){_0x44fd0c[_0xdd0c('0x11')](0xcc)[_0xdd0c('0x12')]();});}};}function handleEntityNotFound(_0x425134){return function(_0x562972){if(!_0x562972){_0x425134[_0xdd0c('0x1a')](0x194);}return _0x562972;};}function handleError(_0x42beef,_0x38ed8f){_0x38ed8f=_0x38ed8f||0x1f4;return function(_0x340694){logger[_0xdd0c('0x1b')](_0x340694[_0xdd0c('0x1c')]);if(_0x340694['name']){delete _0x340694['name'];}_0x42beef['status'](_0x38ed8f)[_0xdd0c('0x1d')](_0x340694);};}exports['index']=function(_0x138f32,_0x30222d){var _0x5ee802={};var _0x2e37a1=_['map'](db[_0xdd0c('0x1e')]['rawAttributes'],function(_0x2ad977){return{'name':_0x2ad977[_0xdd0c('0x1f')],'type':_0x2ad977[_0xdd0c('0x20')][_0xdd0c('0x21')]};});_0x5ee802=qs['getOptions'](_0x2e37a1,_0x138f32);return interaction[_0xdd0c('0x22')](_0xdd0c('0x23'),_0x138f32[_0xdd0c('0x24')],_0x138f32[_0xdd0c('0x25')],_0x5ee802,_0x2e37a1)[_0xdd0c('0x26')](respondWithFilteredResult(_0x30222d,_0x5ee802))[_0xdd0c('0x27')](handleError(_0x30222d,null));};exports[_0xdd0c('0x28')]=function(_0x3269b6,_0x18c3e9){var _0x6ed3d4={'raw':![],'where':{'id':_0x3269b6['params']['id']}},_0x4f6c13={};_0x4f6c13['model']=_[_0xdd0c('0x29')](db[_0xdd0c('0x1e')]['rawAttributes']);_0x4f6c13['query']=_[_0xdd0c('0x29')](_0x3269b6['query']);_0x4f6c13[_0xdd0c('0x2a')]=_['intersection'](_0x4f6c13[_0xdd0c('0x2b')],_0x4f6c13[_0xdd0c('0x24')]);_0x6ed3d4['attributes']=_[_0xdd0c('0x2c')](_0x4f6c13[_0xdd0c('0x2b')],qs[_0xdd0c('0x2d')](_0x3269b6[_0xdd0c('0x24')]['fields']));_0x6ed3d4['attributes']=_0x6ed3d4[_0xdd0c('0x2e')][_0xdd0c('0x2f')]?_0x6ed3d4[_0xdd0c('0x2e')]:_0x4f6c13[_0xdd0c('0x2b')];if(_0x3269b6[_0xdd0c('0x24')][_0xdd0c('0x30')]){_0x6ed3d4[_0xdd0c('0x31')]=[{'all':!![]}];}_0x6ed3d4=_[_0xdd0c('0x32')]({},_0x6ed3d4,_0x3269b6[_0xdd0c('0x33')]);return db[_0xdd0c('0x1e')]['find'](_0x6ed3d4)[_0xdd0c('0x26')](handleEntityNotFound(_0x18c3e9,null))[_0xdd0c('0x26')](respondWithResult(_0x18c3e9,null))[_0xdd0c('0x27')](handleError(_0x18c3e9,null));};exports[_0xdd0c('0x34')]=function(_0x4e6404,_0x4d84a8){return db[_0xdd0c('0x1e')][_0xdd0c('0x34')](_0x4e6404[_0xdd0c('0x35')],{})[_0xdd0c('0x26')](respondWithResult(_0x4d84a8,0xc9))[_0xdd0c('0x27')](handleError(_0x4d84a8,null));};exports[_0xdd0c('0x19')]=function(_0x21a0f7,_0x28fc3d){if(_0x21a0f7[_0xdd0c('0x35')]['id']){delete _0x21a0f7[_0xdd0c('0x35')]['id'];}return db['SmsInteraction'][_0xdd0c('0x36')]({'where':{'id':_0x21a0f7[_0xdd0c('0x37')]['id']}})[_0xdd0c('0x26')](handleEntityNotFound(_0x28fc3d,null))[_0xdd0c('0x26')](saveUpdates(_0x21a0f7['body'],null))[_0xdd0c('0x26')](respondWithResult(_0x28fc3d,null))[_0xdd0c('0x27')](handleError(_0x28fc3d,null));};exports[_0xdd0c('0x38')]=function(_0x5647a5,_0x319be9){return db[_0xdd0c('0x1e')][_0xdd0c('0x36')]({'where':{'id':_0x5647a5['params']['id']}})[_0xdd0c('0x26')](handleEntityNotFound(_0x319be9,null))[_0xdd0c('0x26')](removeEntity(_0x319be9,null))[_0xdd0c('0x27')](handleError(_0x319be9,null));};exports[_0xdd0c('0x39')]=function(_0x103feb,_0x60f0a4){return db['SmsInteraction'][_0xdd0c('0x39')]()[_0xdd0c('0x26')](respondWithResult(_0x60f0a4,null))[_0xdd0c('0x27')](handleError(_0x60f0a4,null));};exports['addMessage']=function(_0x158415,_0x197a89){return db[_0xdd0c('0x3a')][_0xdd0c('0x36')]({'where':{'id':_0x158415['params']['id']}})[_0xdd0c('0x26')](handleEntityNotFound(_0x197a89,null))[_0xdd0c('0x26')](function(_0x28f3f2){if(_0x28f3f2){return _0x28f3f2['addMessage'](_0x158415[_0xdd0c('0x35')][_0xdd0c('0x3b')],_[_0xdd0c('0x3c')](_0x158415[_0xdd0c('0x35')],[_0xdd0c('0x3b'),'id'])||{});}})[_0xdd0c('0x26')](respondWithResult(_0x197a89,null))[_0xdd0c('0x27')](handleError(_0x197a89,null));};exports[_0xdd0c('0x3d')]=function(_0x46b063,_0x1e1fac){var _0x3b2efa={'raw':![],'where':{}};var _0x3824e6={};var _0x538803={'count':0x0,'rows':[]};return db[_0xdd0c('0x1e')][_0xdd0c('0x3e')]({'where':{'id':_0x46b063[_0xdd0c('0x37')]['id']}})['then'](handleEntityNotFound(_0x1e1fac,null))[_0xdd0c('0x26')](function(_0x115888){if(_0x115888){_0x3824e6[_0xdd0c('0x2b')]=_['keys'](db[_0xdd0c('0x3a')][_0xdd0c('0x3f')]);_0x3824e6[_0xdd0c('0x24')]=_['keys'](_0x46b063[_0xdd0c('0x24')]);_0x3824e6[_0xdd0c('0x2a')]=_[_0xdd0c('0x2c')](_0x3824e6[_0xdd0c('0x2b')],_0x3824e6[_0xdd0c('0x24')]);_0x3b2efa['attributes']=_[_0xdd0c('0x2c')](_0x3824e6[_0xdd0c('0x2b')],qs[_0xdd0c('0x2d')](_0x46b063[_0xdd0c('0x24')][_0xdd0c('0x2d')]));_0x3b2efa[_0xdd0c('0x2e')]=_0x3b2efa[_0xdd0c('0x2e')]['length']?_0x3b2efa[_0xdd0c('0x2e')]:_0x3824e6[_0xdd0c('0x2b')];if(!_0x46b063['query'][_0xdd0c('0x40')](_0xdd0c('0x41'))){_0x3b2efa[_0xdd0c('0x14')]=qs[_0xdd0c('0x14')](_0x46b063[_0xdd0c('0x24')][_0xdd0c('0x14')]);_0x3b2efa['offset']=qs[_0xdd0c('0x17')](_0x46b063[_0xdd0c('0x24')][_0xdd0c('0x17')]);}_0x3b2efa[_0xdd0c('0x42')]=qs[_0xdd0c('0x43')](_0x46b063[_0xdd0c('0x24')][_0xdd0c('0x43')]);_0x3b2efa[_0xdd0c('0x44')]=qs[_0xdd0c('0x2a')](_['pick'](_0x46b063[_0xdd0c('0x24')],_0x3824e6[_0xdd0c('0x2a')]));_0x3b2efa[_0xdd0c('0x44')][_0xdd0c('0x45')]=_0x115888['id'];if(_0x46b063[_0xdd0c('0x24')][_0xdd0c('0x46')]){_0x3b2efa[_0xdd0c('0x44')]=_[_0xdd0c('0x32')](_0x3b2efa[_0xdd0c('0x44')],{'$or':_[_0xdd0c('0x47')](_0x3b2efa[_0xdd0c('0x2e')],function(_0x37b776){var _0x3573e0={};_0x3573e0[_0x37b776]={'$like':'%'+_0x46b063[_0xdd0c('0x24')]['filter']+'%'};return _0x3573e0;})});}if(_0x46b063['query'][_0xdd0c('0x48')]){var _0x497d1a=_0x46b063['query'][_0xdd0c('0x48')][_0xdd0c('0x49')](',');var _0x298320={};_0x298320[_0x497d1a[0x0]]={'$gte':moment(_0x497d1a[0x1])['format'](_0xdd0c('0x4a'))};_0x3b2efa['where']=_[_0xdd0c('0x32')](_0x3b2efa[_0xdd0c('0x44')],_0x298320);}_0x3b2efa=_[_0xdd0c('0x32')]({},_0x3b2efa,_0x46b063['options']);return db[_0xdd0c('0x3a')]['count']({'where':_0x3b2efa[_0xdd0c('0x44')]})[_0xdd0c('0x26')](function(_0x34ab2e){_0x538803[_0xdd0c('0x16')]=_0x34ab2e;if(_0x46b063[_0xdd0c('0x24')][_0xdd0c('0x30')]){_0x3b2efa[_0xdd0c('0x31')]=[{'all':!![]}];}return db['SmsMessage'][_0xdd0c('0x22')](_0x3b2efa);})[_0xdd0c('0x26')](function(_0x3eb0d4){_0x538803[_0xdd0c('0x4b')]=_0x3eb0d4;return _0x538803;});}})[_0xdd0c('0x26')](respondWithFilteredResult(_0x1e1fac,_0x3b2efa))[_0xdd0c('0x27')](handleError(_0x1e1fac,null));};exports[_0xdd0c('0x4c')]=function(_0x2e0920,_0xb7ea77){return db['SmsInteraction'][_0xdd0c('0x36')]({'where':{'id':_0x2e0920[_0xdd0c('0x37')]['id']}})['then'](handleEntityNotFound(_0xb7ea77,null))[_0xdd0c('0x26')](function(_0x173e53){if(_0x173e53){return _0x173e53[_0xdd0c('0x4d')](_0x2e0920[_0xdd0c('0x35')]['ids'],_[_0xdd0c('0x3c')](_0x2e0920[_0xdd0c('0x35')],[_0xdd0c('0x3b'),'id'])||{})[_0xdd0c('0x4e')](function(){return db['Tag']['findAll']({'attributes':['id',_0xdd0c('0x4f'),_0xdd0c('0x50')],'where':{'id':_0x2e0920[_0xdd0c('0x35')][_0xdd0c('0x3b')]}});})['then'](function(_0x2e7855){socket[_0xdd0c('0x51')](_0xdd0c('0x52'),{'id':Number(_0x2e0920[_0xdd0c('0x37')]['id']),'tags':_0x2e7855||[]});return{'id':Number(_0x2e0920[_0xdd0c('0x37')]['id']),'tags':_0x2e7855||[]};});}})[_0xdd0c('0x26')](respondWithResult(_0xb7ea77,null))[_0xdd0c('0x27')](handleError(_0xb7ea77,null));};exports[_0xdd0c('0x53')]=function(_0x3b5d92,_0x3f059a){return db['SmsInteraction'][_0xdd0c('0x36')]({'where':{'id':_0x3b5d92[_0xdd0c('0x37')]['id']}})[_0xdd0c('0x26')](handleEntityNotFound(_0x3f059a,null))[_0xdd0c('0x26')](function(_0x15b85c){if(_0x15b85c){return _0x15b85c['removeTags'](_0x3b5d92[_0xdd0c('0x24')][_0xdd0c('0x3b')]);}})[_0xdd0c('0x26')](respondWithStatusCode(_0x3f059a,null))['catch'](handleError(_0x3f059a,null));};exports[_0xdd0c('0x54')]=function(_0x4334b4,_0x1221b1){var _0x5b1694=moment()[_0xdd0c('0x55')]()[_0xdd0c('0x56')]();var _0x4bd57c=path[_0xdd0c('0x57')](config[_0xdd0c('0x58')],_0xdd0c('0x59'),'files',_0xdd0c('0x5a'));var _0x50cc78=path[_0xdd0c('0x57')](_0x4bd57c,_0x5b1694);var _0x27f1f2=util[_0xdd0c('0x5b')](_0xdd0c('0x5c'),_0x4334b4[_0xdd0c('0x37')]['id'],_0x5b1694);var _0x5d7a21=path[_0xdd0c('0x57')](_0x4bd57c,_0x27f1f2);var _0x15fd60=[];_0x15fd60[_0xdd0c('0x5d')]({'model':db[_0xdd0c('0x5e')],'as':'User','attributes':['id',_0xdd0c('0x5f')],'raw':!![]});_0x15fd60['push']({'model':db[_0xdd0c('0x60')],'as':_0xdd0c('0x61'),'attributes':['id',_0xdd0c('0x62'),_0xdd0c('0x63')],'raw':!![]});var _0x4302bb=[{'model':db['SmsMessage'],'as':_0xdd0c('0x64'),'attributes':['id',_0xdd0c('0x35'),'createdAt',_0xdd0c('0x65'),_0xdd0c('0x66'),'read'],'include':_0x15fd60}];_0x4302bb[_0xdd0c('0x5d')]({'model':db[_0xdd0c('0x67')],'as':_0xdd0c('0x68'),'attributes':['id',_0xdd0c('0x4f')]});_0x4302bb['push']({'model':db[_0xdd0c('0x5e')],'as':_0xdd0c('0x69'),'attributes':['id',_0xdd0c('0x5f')]});return db[_0xdd0c('0x1e')][_0xdd0c('0x36')]({'where':{'id':_0x4334b4[_0xdd0c('0x37')]['id']},'include':_0x4302bb})[_0xdd0c('0x26')](handleEntityNotFound(_0x1221b1,null))[_0xdd0c('0x26')](function(_0x1df146){if(_0x1df146){var _0x33b157=_0x1df146['get']({'plain':!![]});fs['mkdirSync'](_0x50cc78);var _0x2ddaf6={'channel':_0xdd0c('0x6a'),'account':_0x33b157[_0xdd0c('0x68')][_0xdd0c('0x4f')],'agent':_0x33b157[_0xdd0c('0x69')]?_0x33b157[_0xdd0c('0x69')][_0xdd0c('0x5f')]:'N.A.','createdAt':moment(_0x33b157[_0xdd0c('0x6b')])[_0xdd0c('0x5b')](_0xdd0c('0x4a'))[_0xdd0c('0x56')](),'closedAt':_0x33b157['closed']?moment(_0x33b157[_0xdd0c('0x6c')])[_0xdd0c('0x5b')](_0xdd0c('0x4a'))[_0xdd0c('0x56')]():'','disposition':_0x33b157[_0xdd0c('0x6d')],'messages':_(_0x33b157['Messages'])[_0xdd0c('0x46')]({'secret':![]})[_0xdd0c('0x47')](function(_0x35a751){return{'date':moment(_0x35a751[_0xdd0c('0x6b')])[_0xdd0c('0x5b')](_0xdd0c('0x4a'))[_0xdd0c('0x56')](),'sender':_0x35a751[_0xdd0c('0x65')]===_0xdd0c('0x6e')?_0x35a751[_0xdd0c('0x5e')]?_0x35a751['User'][_0xdd0c('0x5f')]:_0xdd0c('0x6f'):_0x35a751['Contact'][_0xdd0c('0x62')]+(_0x35a751[_0xdd0c('0x61')]['lastName']?'\x20'+_0x35a751[_0xdd0c('0x61')][_0xdd0c('0x63')]:''),'body':_0x35a751[_0xdd0c('0x35')],'direction':_0x35a751[_0xdd0c('0x65')]===_0xdd0c('0x6e')?'A':'C','secret':_0x35a751[_0xdd0c('0x66')],'read':_0x35a751[_0xdd0c('0x70')]};})[_0xdd0c('0x71')]()};return ejs[_0xdd0c('0x72')](path['join'](config['root'],_0xdd0c('0x59'),_0xdd0c('0x73'),_0xdd0c('0x74')),{'interaction':_0x2ddaf6})[_0xdd0c('0x26')](function(_0x28b9b1){var _0xddc2ef=path['join'](_0x50cc78,_0xdd0c('0x75')+_0x33b157['id']+'-'+_0x5b1694+'.pdf');var _0xa3cb25={'path':_0xddc2ef,'channel':_0xdd0c('0x6a'),'interactionId':_0x33b157['id']};return pdf[_0xdd0c('0x76')](_0x28b9b1,_0xa3cb25);})[_0xdd0c('0x26')](function(){return new BPromise(function(_0x5d1a95,_0x5326f0){zipdir(_0x50cc78,{'saveTo':_0x5d7a21},function(_0x7c9ec6,_0x17c29c){if(_0x7c9ec6)return _0x5326f0(_0x7c9ec6);return _0x5d1a95(_0x17c29c);});})[_0xdd0c('0x26')](function(){return new BPromise(function(_0x316367,_0x1ce420){rimraf(_0x50cc78,function(_0x312784){if(_0x312784)_0x1ce420(_0x312784);return _0x316367();});});})[_0xdd0c('0x26')](function(){return _0x1221b1[_0xdd0c('0x54')](_0x5d7a21,_0x27f1f2,function(_0x2b9fb9){if(_0x2b9fb9){console['log']('err',_0x2b9fb9);}else{fs['unlinkSync'](_0x5d7a21);}});});});}else{return _0x1221b1[_0xdd0c('0x1a')](0xc8);}})[_0xdd0c('0x27')](handleError(_0x1221b1,null));}; \ No newline at end of file +var _0x8450=['../../mysqldb','redis','defaults','localhost','./smsInteraction.socket','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','end','error','stack','name','send','index','map','SmsInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','sms','query','user','catch','show','params','model','keys','filters','fields','length','attributes','includeAll','include','options','find','create','body','describe','addMessage','SmsMessage','omit','intersection','hasOwnProperty','nolimit','order','sort','where','pick','SmsInteractionId','filter','merge','$gte','split','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','ids','spread','Tag','emit','smsInteractionTags:save','removeTags','download','toString','join','server','files','transcript-%d-%s.zip','push','User','fullname','CmContact','Contact','lastName','Messages','createdAt','direction','secret','read','SmsAccount','Account','Owner','mkdirSync','Sms','closed','closedAt','format','disposition','out','System','value','renderFile','root','views','downloadInteraction.ejs','.pdf','createPdfFromHTML','log','unlinkSync','rimraf','zip-dir','moment','util','path','lodash','../../components/interaction/service','../../components/export/pdf','../../config/logger','../../config/environment'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x8450,0x1da));var _0x0845=function(_0x341ced,_0x5774ad){_0x341ced=_0x341ced-0x0;var _0x5726b5=_0x8450[_0x341ced];return _0x5726b5;};'use strict';var rimraf=require(_0x0845('0x0'));var zipdir=require(_0x0845('0x1'));var moment=require(_0x0845('0x2'));var BPromise=require('bluebird');var util=require(_0x0845('0x3'));var path=require(_0x0845('0x4'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x0845('0x5'));var Redis=require('ioredis');var interaction=require(_0x0845('0x6'));var qs=require('../../components/parsers/qs');var pdf=require(_0x0845('0x7'));var logger=require(_0x0845('0x8'))('api');var config=require(_0x0845('0x9'));var db=require(_0x0845('0xa'))['db'];config[_0x0845('0xb')]=_[_0x0845('0xc')](config[_0x0845('0xb')],{'host':_0x0845('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0845('0xe'))['register'](socket);function respondWithStatusCode(_0x4a61c8,_0x405cef){_0x405cef=_0x405cef||0xcc;return function(_0x4d18b6){if(_0x4d18b6){return _0x4a61c8[_0x0845('0xf')](_0x405cef);}return _0x4a61c8[_0x0845('0x10')](_0x405cef)['end']();};}function respondWithResult(_0x2f988b,_0x32f4a8){_0x32f4a8=_0x32f4a8||0xc8;return function(_0x1ffe1f){if(_0x1ffe1f){return _0x2f988b[_0x0845('0x10')](_0x32f4a8)[_0x0845('0x11')](_0x1ffe1f);}};}function respondWithFilteredResult(_0xd67708,_0x316e4f){return function(_0x14c76c){if(_0x14c76c){var _0xd5806a=typeof _0x316e4f[_0x0845('0x12')]===_0x0845('0x13')&&typeof _0x316e4f[_0x0845('0x14')]==='undefined';var _0x2ee98b=_0x14c76c[_0x0845('0x15')];var _0x1d1076=_0xd5806a?0x0:_0x316e4f[_0x0845('0x12')];var _0x233f23=_0xd5806a?_0x14c76c[_0x0845('0x15')]:_0x316e4f[_0x0845('0x12')]+_0x316e4f[_0x0845('0x14')];var _0x2922e7;if(_0x233f23>=_0x2ee98b){_0x233f23=_0x2ee98b;_0x2922e7=0xc8;}else{_0x2922e7=0xce;}_0xd67708[_0x0845('0x10')](_0x2922e7);return _0xd67708[_0x0845('0x16')](_0x0845('0x17'),_0x1d1076+'-'+_0x233f23+'/'+_0x2ee98b)[_0x0845('0x11')](_0x14c76c);}return null;};}function saveUpdates(_0x414f6f){return function(_0x50e3d3){if(_0x50e3d3){return _0x50e3d3[_0x0845('0x18')](_0x414f6f)[_0x0845('0x19')](function(_0x5e5ce7){return _0x5e5ce7;});}return null;};}function removeEntity(_0x476078){return function(_0x5c8282){if(_0x5c8282){return _0x5c8282[_0x0845('0x1a')]()[_0x0845('0x19')](function(){_0x476078[_0x0845('0x10')](0xcc)[_0x0845('0x1b')]();});}};}function handleEntityNotFound(_0x41603a){return function(_0x263bcb){if(!_0x263bcb){_0x41603a[_0x0845('0xf')](0x194);}return _0x263bcb;};}function handleError(_0x3aa3b0,_0x2b978a){_0x2b978a=_0x2b978a||0x1f4;return function(_0x5d014e){logger[_0x0845('0x1c')](_0x5d014e[_0x0845('0x1d')]);if(_0x5d014e[_0x0845('0x1e')]){delete _0x5d014e[_0x0845('0x1e')];}_0x3aa3b0['status'](_0x2b978a)[_0x0845('0x1f')](_0x5d014e);};}exports[_0x0845('0x20')]=function(_0x3ed62a,_0x39d129){var _0x59f2e0={};var _0x3d43dd=_[_0x0845('0x21')](db[_0x0845('0x22')][_0x0845('0x23')],function(_0x1b98b7){return{'name':_0x1b98b7[_0x0845('0x24')],'type':_0x1b98b7[_0x0845('0x25')][_0x0845('0x26')]};});_0x59f2e0=qs[_0x0845('0x27')](_0x3d43dd,_0x3ed62a);return interaction[_0x0845('0x28')](_0x0845('0x29'),_0x3ed62a[_0x0845('0x2a')],_0x3ed62a[_0x0845('0x2b')],_0x59f2e0,_0x3d43dd)[_0x0845('0x19')](respondWithFilteredResult(_0x39d129,_0x59f2e0))[_0x0845('0x2c')](handleError(_0x39d129,null));};exports[_0x0845('0x2d')]=function(_0x104646,_0x4aaa3b){var _0x2ce554={'raw':![],'where':{'id':_0x104646[_0x0845('0x2e')]['id']}},_0x365faf={};_0x365faf[_0x0845('0x2f')]=_[_0x0845('0x30')](db[_0x0845('0x22')][_0x0845('0x23')]);_0x365faf[_0x0845('0x2a')]=_[_0x0845('0x30')](_0x104646['query']);_0x365faf[_0x0845('0x31')]=_['intersection'](_0x365faf[_0x0845('0x2f')],_0x365faf[_0x0845('0x2a')]);_0x2ce554['attributes']=_['intersection'](_0x365faf[_0x0845('0x2f')],qs[_0x0845('0x32')](_0x104646['query'][_0x0845('0x32')]));_0x2ce554['attributes']=_0x2ce554['attributes'][_0x0845('0x33')]?_0x2ce554[_0x0845('0x34')]:_0x365faf[_0x0845('0x2f')];if(_0x104646[_0x0845('0x2a')][_0x0845('0x35')]){_0x2ce554[_0x0845('0x36')]=[{'all':!![]}];}_0x2ce554=_['merge']({},_0x2ce554,_0x104646[_0x0845('0x37')]);return db[_0x0845('0x22')][_0x0845('0x38')](_0x2ce554)[_0x0845('0x19')](handleEntityNotFound(_0x4aaa3b,null))[_0x0845('0x19')](respondWithResult(_0x4aaa3b,null))[_0x0845('0x2c')](handleError(_0x4aaa3b,null));};exports[_0x0845('0x39')]=function(_0x4a51f9,_0x414e84){return db['SmsInteraction'][_0x0845('0x39')](_0x4a51f9[_0x0845('0x3a')],{})[_0x0845('0x19')](respondWithResult(_0x414e84,0xc9))[_0x0845('0x2c')](handleError(_0x414e84,null));};exports[_0x0845('0x18')]=function(_0x53f4d2,_0x21ca0a){if(_0x53f4d2['body']['id']){delete _0x53f4d2['body']['id'];}return db[_0x0845('0x22')]['find']({'where':{'id':_0x53f4d2['params']['id']}})[_0x0845('0x19')](handleEntityNotFound(_0x21ca0a,null))[_0x0845('0x19')](saveUpdates(_0x53f4d2[_0x0845('0x3a')],null))['then'](respondWithResult(_0x21ca0a,null))['catch'](handleError(_0x21ca0a,null));};exports[_0x0845('0x1a')]=function(_0x46b01b,_0xa56145){return db['SmsInteraction'][_0x0845('0x38')]({'where':{'id':_0x46b01b[_0x0845('0x2e')]['id']}})[_0x0845('0x19')](handleEntityNotFound(_0xa56145,null))[_0x0845('0x19')](removeEntity(_0xa56145,null))[_0x0845('0x2c')](handleError(_0xa56145,null));};exports['describe']=function(_0x526bfd,_0x2aa467){return db['SmsInteraction'][_0x0845('0x3b')]()['then'](respondWithResult(_0x2aa467,null))['catch'](handleError(_0x2aa467,null));};exports[_0x0845('0x3c')]=function(_0x160410,_0x55639d){return db[_0x0845('0x3d')]['find']({'where':{'id':_0x160410[_0x0845('0x2e')]['id']}})[_0x0845('0x19')](handleEntityNotFound(_0x55639d,null))[_0x0845('0x19')](function(_0x1c7ee5){if(_0x1c7ee5){return _0x1c7ee5[_0x0845('0x3c')](_0x160410[_0x0845('0x3a')]['ids'],_[_0x0845('0x3e')](_0x160410['body'],['ids','id'])||{});}})[_0x0845('0x19')](respondWithResult(_0x55639d,null))[_0x0845('0x2c')](handleError(_0x55639d,null));};exports['getMessages']=function(_0x6d966c,_0x21b669){var _0x4ca372={'raw':![],'where':{}};var _0x509c6a={};var _0x5b04e={'count':0x0,'rows':[]};return db[_0x0845('0x22')]['findOne']({'where':{'id':_0x6d966c[_0x0845('0x2e')]['id']}})['then'](handleEntityNotFound(_0x21b669,null))['then'](function(_0x5a131f){if(_0x5a131f){_0x509c6a[_0x0845('0x2f')]=_[_0x0845('0x30')](db['SmsMessage']['rawAttributes']);_0x509c6a[_0x0845('0x2a')]=_['keys'](_0x6d966c[_0x0845('0x2a')]);_0x509c6a[_0x0845('0x31')]=_[_0x0845('0x3f')](_0x509c6a[_0x0845('0x2f')],_0x509c6a['query']);_0x4ca372[_0x0845('0x34')]=_[_0x0845('0x3f')](_0x509c6a['model'],qs[_0x0845('0x32')](_0x6d966c['query'][_0x0845('0x32')]));_0x4ca372['attributes']=_0x4ca372[_0x0845('0x34')]['length']?_0x4ca372[_0x0845('0x34')]:_0x509c6a['model'];if(!_0x6d966c['query'][_0x0845('0x40')](_0x0845('0x41'))){_0x4ca372[_0x0845('0x14')]=qs[_0x0845('0x14')](_0x6d966c['query'][_0x0845('0x14')]);_0x4ca372[_0x0845('0x12')]=qs[_0x0845('0x12')](_0x6d966c[_0x0845('0x2a')]['offset']);}_0x4ca372[_0x0845('0x42')]=qs[_0x0845('0x43')](_0x6d966c[_0x0845('0x2a')][_0x0845('0x43')]);_0x4ca372[_0x0845('0x44')]=qs['filters'](_[_0x0845('0x45')](_0x6d966c[_0x0845('0x2a')],_0x509c6a[_0x0845('0x31')]));_0x4ca372[_0x0845('0x44')][_0x0845('0x46')]=_0x5a131f['id'];if(_0x6d966c[_0x0845('0x2a')][_0x0845('0x47')]){_0x4ca372[_0x0845('0x44')]=_[_0x0845('0x48')](_0x4ca372[_0x0845('0x44')],{'$or':_[_0x0845('0x21')](_0x4ca372['attributes'],function(_0x2cef9){var _0x43f0e4={};_0x43f0e4[_0x2cef9]={'$like':'%'+_0x6d966c['query']['filter']+'%'};return _0x43f0e4;})});}if(_0x6d966c[_0x0845('0x2a')][_0x0845('0x49')]){var _0x33bc22=_0x6d966c['query']['$gte'][_0x0845('0x4a')](',');var _0x400935={};_0x400935[_0x33bc22[0x0]]={'$gte':moment(_0x33bc22[0x1])['format'](_0x0845('0x4b'))};_0x4ca372[_0x0845('0x44')]=_[_0x0845('0x48')](_0x4ca372[_0x0845('0x44')],_0x400935);}_0x4ca372=_['merge']({},_0x4ca372,_0x6d966c[_0x0845('0x37')]);return db['SmsMessage'][_0x0845('0x15')]({'where':_0x4ca372[_0x0845('0x44')]})['then'](function(_0xe59b9f){_0x5b04e[_0x0845('0x15')]=_0xe59b9f;if(_0x6d966c[_0x0845('0x2a')]['includeAll']){_0x4ca372[_0x0845('0x36')]=[{'all':!![]}];}return db['SmsMessage'][_0x0845('0x28')](_0x4ca372);})[_0x0845('0x19')](function(_0x3beeb4){_0x5b04e[_0x0845('0x4c')]=_0x3beeb4;return _0x5b04e;});}})[_0x0845('0x19')](respondWithFilteredResult(_0x21b669,_0x4ca372))[_0x0845('0x2c')](handleError(_0x21b669,null));};exports[_0x0845('0x4d')]=function(_0x3bd450,_0x499f68){return db['SmsInteraction'][_0x0845('0x38')]({'where':{'id':_0x3bd450[_0x0845('0x2e')]['id']}})[_0x0845('0x19')](handleEntityNotFound(_0x499f68,null))['then'](function(_0x2ad6fd){if(_0x2ad6fd){return _0x2ad6fd['setTags'](_0x3bd450[_0x0845('0x3a')][_0x0845('0x4e')],_[_0x0845('0x3e')](_0x3bd450[_0x0845('0x3a')],[_0x0845('0x4e'),'id'])||{})[_0x0845('0x4f')](function(){return db[_0x0845('0x50')][_0x0845('0x28')]({'attributes':['id',_0x0845('0x1e'),'color'],'where':{'id':_0x3bd450[_0x0845('0x3a')][_0x0845('0x4e')]}});})[_0x0845('0x19')](function(_0xaece85){socket[_0x0845('0x51')](_0x0845('0x52'),{'id':Number(_0x3bd450[_0x0845('0x2e')]['id']),'tags':_0xaece85||[]});return{'id':Number(_0x3bd450[_0x0845('0x2e')]['id']),'tags':_0xaece85||[]};});}})[_0x0845('0x19')](respondWithResult(_0x499f68,null))[_0x0845('0x2c')](handleError(_0x499f68,null));};exports[_0x0845('0x53')]=function(_0x3f7bac,_0x4edff7){return db[_0x0845('0x22')]['find']({'where':{'id':_0x3f7bac[_0x0845('0x2e')]['id']}})['then'](handleEntityNotFound(_0x4edff7,null))[_0x0845('0x19')](function(_0xbfd9e7){if(_0xbfd9e7){return _0xbfd9e7['removeTags'](_0x3f7bac[_0x0845('0x2a')]['ids']);}})[_0x0845('0x19')](respondWithStatusCode(_0x4edff7,null))[_0x0845('0x2c')](handleError(_0x4edff7,null));};exports[_0x0845('0x54')]=function(_0xb265be,_0xd8141e){var _0x4acb58=moment()['unix']()[_0x0845('0x55')]();var _0x9aaafd=path[_0x0845('0x56')](config['root'],_0x0845('0x57'),_0x0845('0x58'),'tmp');var _0xa969ac=path[_0x0845('0x56')](_0x9aaafd,_0x4acb58);var _0x325ea3=util['format'](_0x0845('0x59'),_0xb265be[_0x0845('0x2e')]['id'],_0x4acb58);var _0x504622=path[_0x0845('0x56')](_0x9aaafd,_0x325ea3);var _0x253724=[];_0x253724[_0x0845('0x5a')]({'model':db[_0x0845('0x5b')],'as':_0x0845('0x5b'),'attributes':['id',_0x0845('0x5c')],'raw':!![]});_0x253724['push']({'model':db[_0x0845('0x5d')],'as':_0x0845('0x5e'),'attributes':['id','firstName',_0x0845('0x5f')],'raw':!![]});var _0x2ddf54=[{'model':db[_0x0845('0x3d')],'as':_0x0845('0x60'),'attributes':['id',_0x0845('0x3a'),_0x0845('0x61'),_0x0845('0x62'),_0x0845('0x63'),_0x0845('0x64')],'include':_0x253724}];_0x2ddf54[_0x0845('0x5a')]({'model':db[_0x0845('0x65')],'as':_0x0845('0x66'),'attributes':['id','name']});_0x2ddf54[_0x0845('0x5a')]({'model':db[_0x0845('0x5b')],'as':_0x0845('0x67'),'attributes':['id','fullname']});return db[_0x0845('0x22')]['find']({'where':{'id':_0xb265be['params']['id']},'include':_0x2ddf54})['then'](handleEntityNotFound(_0xd8141e,null))['then'](function(_0x3b065c){if(_0x3b065c){var _0x1d8987=_0x3b065c['get']({'plain':!![]});fs[_0x0845('0x68')](_0xa969ac);var _0x149b9a={'channel':_0x0845('0x69'),'account':_0x1d8987['Account'][_0x0845('0x1e')],'agent':_0x1d8987[_0x0845('0x67')]?_0x1d8987[_0x0845('0x67')][_0x0845('0x5c')]:'N.A.','createdAt':moment(_0x1d8987[_0x0845('0x61')])['format'](_0x0845('0x4b'))['toString'](),'closedAt':_0x1d8987[_0x0845('0x6a')]?moment(_0x1d8987[_0x0845('0x6b')])[_0x0845('0x6c')]('YYYY-MM-DD\x20HH:mm:ss')[_0x0845('0x55')]():'','disposition':_0x1d8987[_0x0845('0x6d')],'messages':_(_0x1d8987['Messages'])['filter']({'secret':![]})['map'](function(_0x275169){return{'date':moment(_0x275169[_0x0845('0x61')])['format'](_0x0845('0x4b'))[_0x0845('0x55')](),'sender':_0x275169[_0x0845('0x62')]===_0x0845('0x6e')?_0x275169[_0x0845('0x5b')]?_0x275169[_0x0845('0x5b')][_0x0845('0x5c')]:_0x0845('0x6f'):_0x275169[_0x0845('0x5e')]['firstName']+(_0x275169['Contact']['lastName']?'\x20'+_0x275169['Contact'][_0x0845('0x5f')]:''),'body':_0x275169[_0x0845('0x3a')],'direction':_0x275169['direction']===_0x0845('0x6e')?'A':'C','secret':_0x275169['secret'],'read':_0x275169[_0x0845('0x64')]};})[_0x0845('0x70')]()};return ejs[_0x0845('0x71')](path[_0x0845('0x56')](config[_0x0845('0x72')],_0x0845('0x57'),_0x0845('0x73'),_0x0845('0x74')),{'interaction':_0x149b9a})['then'](function(_0x1c04e4){var _0x11f8d5=path[_0x0845('0x56')](_0xa969ac,'transcript-'+_0x1d8987['id']+'-'+_0x4acb58+_0x0845('0x75'));var _0x83715f={'path':_0x11f8d5,'channel':'Sms','interactionId':_0x1d8987['id']};return pdf[_0x0845('0x76')](_0x1c04e4,_0x83715f);})['then'](function(){return new BPromise(function(_0x1fbacd,_0xafc00f){zipdir(_0xa969ac,{'saveTo':_0x504622},function(_0x5b3c94,_0x30ec91){if(_0x5b3c94)return _0xafc00f(_0x5b3c94);return _0x1fbacd(_0x30ec91);});})[_0x0845('0x19')](function(){return new BPromise(function(_0x36fa58,_0x3c9bca){rimraf(_0xa969ac,function(_0x5732a8){if(_0x5732a8)_0x3c9bca(_0x5732a8);return _0x36fa58();});});})[_0x0845('0x19')](function(){return _0xd8141e[_0x0845('0x54')](_0x504622,_0x325ea3,function(_0x5245b0){if(_0x5245b0){console[_0x0845('0x77')]('err',_0x5245b0);}else{fs[_0x0845('0x78')](_0x504622);}});});});}else{return _0xd8141e[_0x0845('0xf')](0xc8);}})['catch'](handleError(_0xd8141e,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index 06cb33c..22ecb63 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 _0x9f0e=['unreadMessages','length','emit','catch','hasOwnProperty','hook','events','../../mysqldb','SmsInteraction','SmsMessage','update','remove','then','setDataValue','map','findAll'];(function(_0x14b4b2,_0x42aed0){var _0x2710fd=function(_0x2bb074){while(--_0x2bb074){_0x14b4b2['push'](_0x14b4b2['shift']());}};_0x2710fd(++_0x42aed0);}(_0x9f0e,0x116));var _0xe9f0=function(_0x10be36,_0x9b47f7){_0x10be36=_0x10be36-0x0;var _0x458c11=_0x9f0e[_0x10be36];return _0x458c11;};'use strict';var EventEmitter=require(_0xe9f0('0x0'));var SmsInteraction=require(_0xe9f0('0x1'))['db'][_0xe9f0('0x2')];var SmsMessage=require(_0xe9f0('0x1'))['db'][_0xe9f0('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xe9f0('0x4'),'afterDestroy':_0xe9f0('0x5')};function emitEvent(_0x3c589d){return function(_0x202d69,_0x1eed45,_0x50313d){_0x202d69['getUsers']({'attributes':['id'],'raw':!![]})[_0xe9f0('0x6')](function(_0x167198){_0x202d69[_0xe9f0('0x7')]('Users',_0x167198[_0xe9f0('0x8')](function(_0x335b82){return{'id':_0x335b82['id']};}));return SmsMessage[_0xe9f0('0x9')]({'where':{'SmsInteractionId':_0x202d69['id'],'direction':'in','read':![]},'raw':!![]});})[_0xe9f0('0x6')](function(_0xa523c0){_0x202d69[_0xe9f0('0x7')](_0xe9f0('0xa'),_0xa523c0[_0xe9f0('0xb')]);SmsInteractionEvents[_0xe9f0('0xc')](_0x3c589d+':'+_0x202d69['id'],_0x202d69);SmsInteractionEvents['emit'](_0x3c589d,_0x202d69);_0x50313d(null);})[_0xe9f0('0xd')](_0x50313d(null));};}for(var e in events){if(events[_0xe9f0('0xe')](e)){var event=events[e];SmsInteraction[_0xe9f0('0xf')](e,emitEvent(event));}}module['exports']=SmsInteractionEvents; \ No newline at end of file +var _0xf61e=['exports','events','../../mysqldb','SmsInteraction','SmsMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','map','unreadMessages','length','emit','catch','hasOwnProperty','hook'];(function(_0x57b2c6,_0x264e53){var _0x4b8ce0=function(_0x1f6e7a){while(--_0x1f6e7a){_0x57b2c6['push'](_0x57b2c6['shift']());}};_0x4b8ce0(++_0x264e53);}(_0xf61e,0x191));var _0xef61=function(_0x23820d,_0x550376){_0x23820d=_0x23820d-0x0;var _0x2b24ff=_0xf61e[_0x23820d];return _0x2b24ff;};'use strict';var EventEmitter=require(_0xef61('0x0'));var SmsInteraction=require(_0xef61('0x1'))['db'][_0xef61('0x2')];var SmsMessage=require(_0xef61('0x1'))['db'][_0xef61('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0xef61('0x4')](0x0);var events={'afterCreate':_0xef61('0x5'),'afterUpdate':_0xef61('0x6'),'afterDestroy':_0xef61('0x7')};function emitEvent(_0x14122a){return function(_0x239fa9,_0x45a18d,_0x5b00b2){_0x239fa9[_0xef61('0x8')]({'attributes':['id'],'raw':!![]})[_0xef61('0x9')](function(_0x4f0cc5){_0x239fa9[_0xef61('0xa')](_0xef61('0xb'),_0x4f0cc5[_0xef61('0xc')](function(_0x4dba00){return{'id':_0x4dba00['id']};}));return SmsMessage['findAll']({'where':{'SmsInteractionId':_0x239fa9['id'],'direction':'in','read':![]},'raw':!![]});})[_0xef61('0x9')](function(_0x2e28c7){_0x239fa9[_0xef61('0xa')](_0xef61('0xd'),_0x2e28c7[_0xef61('0xe')]);SmsInteractionEvents[_0xef61('0xf')](_0x14122a+':'+_0x239fa9['id'],_0x239fa9);SmsInteractionEvents[_0xef61('0xf')](_0x14122a,_0x239fa9);_0x5b00b2(null);})[_0xef61('0x10')](_0x5b00b2(null));};}for(var e in events){if(events[_0xef61('0x11')](e)){var event=events[e];SmsInteraction[_0xef61('0x12')](e,emitEvent(event));}}module[_0xef61('0x13')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index 2c13c65..7c266bd 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 _0x4d9a=['YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./smsInteraction.attributes','exports','define','SmsInteraction','sms_interactions','changed','closedAt','format'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x4d9a,0x19f));var _0xa4d9=function(_0x5acda3,_0x22eede){_0x5acda3=_0x5acda3-0x0;var _0x53dfd5=_0x4d9a[_0x5acda3];return _0x53dfd5;};'use strict';var _=require(_0xa4d9('0x0'));var util=require(_0xa4d9('0x1'));var logger=require(_0xa4d9('0x2'))(_0xa4d9('0x3'));var moment=require('moment');var BPromise=require(_0xa4d9('0x4'));var rp=require(_0xa4d9('0x5'));var fs=require('fs');var path=require(_0xa4d9('0x6'));var rimraf=require(_0xa4d9('0x7'));var config=require(_0xa4d9('0x8'));var attributes=require(_0xa4d9('0x9'));module[_0xa4d9('0xa')]=function(_0x7f9000,_0x922105){return _0x7f9000[_0xa4d9('0xb')](_0xa4d9('0xc'),attributes,{'tableName':_0xa4d9('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1a71e1,_0x4a658f,_0xcf3b5c){if(_0x1a71e1[_0xa4d9('0xe')]('closed')){_0x1a71e1[_0xa4d9('0xf')]=moment()[_0xa4d9('0x10')](_0xa4d9('0x11'));}_0xcf3b5c(null,_0x1a71e1);}}});}; \ No newline at end of file +var _0x9ea2=['../../config/environment','define','SmsInteraction','sms_interactions','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x46b3de,_0x10cebe){var _0x45887a=function(_0xb6119f){while(--_0xb6119f){_0x46b3de['push'](_0x46b3de['shift']());}};_0x45887a(++_0x10cebe);}(_0x9ea2,0xa8));var _0x29ea=function(_0x43e3df,_0x36a8f3){_0x43e3df=_0x43e3df-0x0;var _0x16b399=_0x9ea2[_0x43e3df];return _0x16b399;};'use strict';var _=require(_0x29ea('0x0'));var util=require(_0x29ea('0x1'));var logger=require('../../config/logger')(_0x29ea('0x2'));var moment=require(_0x29ea('0x3'));var BPromise=require(_0x29ea('0x4'));var rp=require(_0x29ea('0x5'));var fs=require('fs');var path=require(_0x29ea('0x6'));var rimraf=require(_0x29ea('0x7'));var config=require(_0x29ea('0x8'));var attributes=require('./smsInteraction.attributes');module['exports']=function(_0x3cf91a,_0x195a79){return _0x3cf91a[_0x29ea('0x9')](_0x29ea('0xa'),attributes,{'tableName':_0x29ea('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5947d0,_0xe498c3,_0x276537){if(_0x5947d0[_0x29ea('0xc')]('closed')){_0x5947d0[_0x29ea('0xd')]=moment()[_0x29ea('0xe')](_0x29ea('0xf'));}_0x276537(null,_0x5947d0);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index c13c668..e727b3e 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 _0x804a=['update','body','options','where','attributes','limit','then','UpdateSmsInteraction','AddTagsToSmsInteraction','SmsInteraction','find','ids','omit','spread','AddTags','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','localhost','./smsInteraction.socket','register','request','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x432ac2,_0x238b44){var _0x5a17cf=function(_0x4e9e1a){while(--_0x4e9e1a){_0x432ac2['push'](_0x432ac2['shift']());}};_0x5a17cf(++_0x238b44);}(_0x804a,0xaf));var _0xa804=function(_0x318c82,_0x4b37f6){_0x318c82=_0x318c82-0x0;var _0x19ee4a=_0x804a[_0x318c82];return _0x19ee4a;};'use strict';var _=require(_0xa804('0x0'));var util=require(_0xa804('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa804('0x2'));var fs=require('fs');var Redis=require(_0xa804('0x3'));var db=require(_0xa804('0x4'))['db'];var utils=require(_0xa804('0x5'));var logger=require(_0xa804('0x6'))(_0xa804('0x7'));var config=require('../../config/environment');var jayson=require(_0xa804('0x8'));var client=jayson[_0xa804('0x9')]['http']({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0xa804('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xa804('0xb'))[_0xa804('0xc')](socket);function respondWithRpcPromise(_0x25eb7f,_0x4bf4f7,_0x2a7b01){return new BPromise(function(_0x2b66e5,_0x387544){return client[_0xa804('0xd')](_0x25eb7f,_0x2a7b01)['then'](function(_0x3a75ff){logger[_0xa804('0xe')](_0xa804('0xf'),_0x4bf4f7,_0xa804('0x10'));logger[_0xa804('0x11')](_0xa804('0x12'),_0x4bf4f7,_0xa804('0x10'),JSON[_0xa804('0x13')](_0x3a75ff));if(_0x3a75ff[_0xa804('0x14')]){if(_0x3a75ff[_0xa804('0x14')][_0xa804('0x15')]===0x1f4){logger[_0xa804('0x14')]('SmsInteraction,\x20%s,\x20%s',_0x4bf4f7,_0x3a75ff['error'][_0xa804('0x16')]);return _0x387544(_0x3a75ff[_0xa804('0x14')][_0xa804('0x16')]);}logger[_0xa804('0x14')](_0xa804('0xf'),_0x4bf4f7,_0x3a75ff[_0xa804('0x14')][_0xa804('0x16')]);return _0x2b66e5(_0x3a75ff['error']['message']);}else{logger[_0xa804('0xe')](_0xa804('0xf'),_0x4bf4f7,_0xa804('0x10'));_0x2b66e5(_0x3a75ff[_0xa804('0x17')][_0xa804('0x16')]);}})[_0xa804('0x18')](function(_0x594ec6){logger[_0xa804('0x14')](_0xa804('0xf'),_0x4bf4f7,_0x594ec6);_0x387544(_0x594ec6);});});}exports['UpdateSmsInteraction']=function(_0x4a65a2){var _0x2f15e2=this;return new Promise(function(_0x63a7e,_0x50b9ba){return db['SmsInteraction'][_0xa804('0x19')](_0x4a65a2[_0xa804('0x1a')],{'raw':_0x4a65a2[_0xa804('0x1b')]?_0x4a65a2[_0xa804('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4a65a2[_0xa804('0x1b')]?_0x4a65a2[_0xa804('0x1b')][_0xa804('0x1c')]||null:null,'attributes':_0x4a65a2[_0xa804('0x1b')]?_0x4a65a2[_0xa804('0x1b')][_0xa804('0x1d')]||null:null,'limit':_0x4a65a2['options']?_0x4a65a2['options'][_0xa804('0x1e')]||null:null})[_0xa804('0x1f')](function(_0x1ceebe){logger[_0xa804('0xe')](_0xa804('0x20'),_0x4a65a2);logger[_0xa804('0x11')](_0xa804('0x20'),_0x4a65a2,JSON['stringify'](_0x1ceebe));_0x63a7e(_0x1ceebe);})['catch'](function(_0x5b7290){logger[_0xa804('0x14')](_0xa804('0x20'),_0x5b7290[_0xa804('0x16')],_0x4a65a2);_0x50b9ba(_0x2f15e2[_0xa804('0x14')](0x1f4,_0x5b7290[_0xa804('0x16')]));});});};exports[_0xa804('0x21')]=function(_0x2add96){return new Promise(function(_0x2f8518,_0x435343){return db[_0xa804('0x22')][_0xa804('0x23')]({'where':_0x2add96[_0xa804('0x1b')]?_0x2add96[_0xa804('0x1b')][_0xa804('0x1c')]||null:null})[_0xa804('0x1f')](function(_0x2e9087){if(_0x2e9087){return _0x2e9087['addTags'](_0x2add96[_0xa804('0x1a')][_0xa804('0x24')],_[_0xa804('0x25')](_0x2add96[_0xa804('0x1a')],[_0xa804('0x24'),'id'])||{});}})[_0xa804('0x26')](function(_0x391d5e){logger[_0xa804('0xe')](_0xa804('0x27'),_0x2add96);logger['debug'](_0xa804('0x27'),_0x2add96,JSON[_0xa804('0x13')](_0x391d5e));_0x2f8518(_0x391d5e);})['catch'](function(_0x16567f){logger['error'](_0xa804('0x27'),_0x16567f[_0xa804('0x16')],_0x2add96);_0x435343(_this['error'](0x1f4,_0x16567f['message']));});});}; \ No newline at end of file +var _0x0871=['SmsInteraction,\x20%s,\x20%s','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','SmsInteraction','update','body','options','attributes','limit','then','UpdateSmsInteraction','stringify','catch','AddTagsToSmsInteraction','find','where','addTags','omit','spread','AddTags','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','socket.io-emitter','./smsInteraction.socket','register','request','info'];(function(_0x1945a5,_0x50de54){var _0x5817a5=function(_0x2a5a93){while(--_0x2a5a93){_0x1945a5['push'](_0x1945a5['shift']());}};_0x5817a5(++_0x50de54);}(_0x0871,0xbd));var _0x1087=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0x0871[_0x5f1391];return _0x50ebe3;};'use strict';var _=require(_0x1087('0x0'));var util=require(_0x1087('0x1'));var moment=require(_0x1087('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1087('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1087('0x4'));var logger=require(_0x1087('0x5'))(_0x1087('0x6'));var config=require('../../config/environment');var jayson=require(_0x1087('0x7'));var client=jayson[_0x1087('0x8')][_0x1087('0x9')]({'port':0x232a});config[_0x1087('0xa')]=_['defaults'](config[_0x1087('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x1087('0xb'))(new Redis(config[_0x1087('0xa')]));require(_0x1087('0xc'))[_0x1087('0xd')](socket);function respondWithRpcPromise(_0x5750f2,_0x472804,_0x5a7e89){return new BPromise(function(_0x382836,_0x10b0dc){return client[_0x1087('0xe')](_0x5750f2,_0x5a7e89)['then'](function(_0x41a8a4){logger[_0x1087('0xf')](_0x1087('0x10'),_0x472804,'request\x20sent');logger[_0x1087('0x11')](_0x1087('0x12'),_0x472804,_0x1087('0x13'),JSON['stringify'](_0x41a8a4));if(_0x41a8a4[_0x1087('0x14')]){if(_0x41a8a4[_0x1087('0x14')][_0x1087('0x15')]===0x1f4){logger[_0x1087('0x14')](_0x1087('0x10'),_0x472804,_0x41a8a4[_0x1087('0x14')][_0x1087('0x16')]);return _0x10b0dc(_0x41a8a4['error']['message']);}logger['error'](_0x1087('0x10'),_0x472804,_0x41a8a4[_0x1087('0x14')]['message']);return _0x382836(_0x41a8a4['error'][_0x1087('0x16')]);}else{logger[_0x1087('0xf')](_0x1087('0x10'),_0x472804,_0x1087('0x13'));_0x382836(_0x41a8a4[_0x1087('0x17')]['message']);}})['catch'](function(_0x16046c){logger[_0x1087('0x14')](_0x1087('0x10'),_0x472804,_0x16046c);_0x10b0dc(_0x16046c);});});}exports['UpdateSmsInteraction']=function(_0x51ccf7){var _0x1cfeb5=this;return new Promise(function(_0x4ee81b,_0x8ee63d){return db[_0x1087('0x18')][_0x1087('0x19')](_0x51ccf7[_0x1087('0x1a')],{'raw':_0x51ccf7['options']?_0x51ccf7['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x51ccf7[_0x1087('0x1b')]?_0x51ccf7[_0x1087('0x1b')]['where']||null:null,'attributes':_0x51ccf7[_0x1087('0x1b')]?_0x51ccf7['options'][_0x1087('0x1c')]||null:null,'limit':_0x51ccf7[_0x1087('0x1b')]?_0x51ccf7['options'][_0x1087('0x1d')]||null:null})[_0x1087('0x1e')](function(_0x26f350){logger[_0x1087('0xf')]('UpdateSmsInteraction',_0x51ccf7);logger[_0x1087('0x11')](_0x1087('0x1f'),_0x51ccf7,JSON[_0x1087('0x20')](_0x26f350));_0x4ee81b(_0x26f350);})[_0x1087('0x21')](function(_0x5832dd){logger[_0x1087('0x14')]('UpdateSmsInteraction',_0x5832dd[_0x1087('0x16')],_0x51ccf7);_0x8ee63d(_0x1cfeb5[_0x1087('0x14')](0x1f4,_0x5832dd[_0x1087('0x16')]));});});};exports[_0x1087('0x22')]=function(_0x3a85f3){return new Promise(function(_0x28471c,_0xb30b6b){return db[_0x1087('0x18')][_0x1087('0x23')]({'where':_0x3a85f3[_0x1087('0x1b')]?_0x3a85f3[_0x1087('0x1b')][_0x1087('0x24')]||null:null})['then'](function(_0x31f210){if(_0x31f210){return _0x31f210[_0x1087('0x25')](_0x3a85f3[_0x1087('0x1a')]['ids'],_[_0x1087('0x26')](_0x3a85f3['body'],['ids','id'])||{});}})[_0x1087('0x27')](function(_0x428302){logger[_0x1087('0xf')](_0x1087('0x28'),_0x3a85f3);logger[_0x1087('0x11')](_0x1087('0x28'),_0x3a85f3,JSON['stringify'](_0x428302));_0x28471c(_0x428302);})[_0x1087('0x21')](function(_0x285714){logger[_0x1087('0x14')]('AddTags',_0x285714[_0x1087('0x16')],_0x3a85f3);_0xb30b6b(_this[_0x1087('0x14')](0x1f4,_0x285714[_0x1087('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index 1e78cd7..b3a9062 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 _0x5aad=['./smsInteraction.events','remove','update','smsInteraction:'];(function(_0x5dc919,_0x1c3b6e){var _0x34e5a1=function(_0x363df2){while(--_0x363df2){_0x5dc919['push'](_0x5dc919['shift']());}};_0x34e5a1(++_0x1c3b6e);}(_0x5aad,0x8c));var _0xd5aa=function(_0x5905c0,_0x240ec8){_0x5905c0=_0x5905c0-0x0;var _0xcaf7ed=_0x5aad[_0x5905c0];return _0xcaf7ed;};'use strict';var SmsInteractionEvents=require(_0xd5aa('0x0'));var events=['save',_0xd5aa('0x1'),_0xd5aa('0x2')];function createListener(_0x2795c1,_0x1bb219){return function(_0x441090){_0x1bb219['emit'](_0x2795c1,_0x441090);};}function removeListener(_0x238814,_0x8aaa4f){return function(){SmsInteractionEvents['removeListener'](_0x238814,_0x8aaa4f);};}exports['register']=function(_0x1508f5){for(var _0x522a18=0x0,_0x4a8d43=events['length'];_0x522a18<_0x4a8d43;_0x522a18++){var _0x7d3772=events[_0x522a18];var _0x4b9690=createListener(_0xd5aa('0x3')+_0x7d3772,_0x1508f5);SmsInteractionEvents['on'](_0x7d3772,_0x4b9690);}}; \ No newline at end of file +var _0x5137=['smsInteraction:','save','remove','update','emit','removeListener','length'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x5137,0x127));var _0x7513=function(_0x277c64,_0x5a4d3b){_0x277c64=_0x277c64-0x0;var _0x24ce40=_0x5137[_0x277c64];return _0x24ce40;};'use strict';var SmsInteractionEvents=require('./smsInteraction.events');var events=[_0x7513('0x0'),_0x7513('0x1'),_0x7513('0x2')];function createListener(_0x28a90e,_0x574b7a){return function(_0x5484e2){_0x574b7a[_0x7513('0x3')](_0x28a90e,_0x5484e2);};}function removeListener(_0x4eb989,_0xe23453){return function(){SmsInteractionEvents[_0x7513('0x4')](_0x4eb989,_0xe23453);};}exports['register']=function(_0x4dba47){for(var _0x176feb=0x0,_0x30406b=events[_0x7513('0x5')];_0x176feb<_0x30406b;_0x176feb++){var _0x4c6cb3=events[_0x176feb];var _0x281e59=createListener(_0x7513('0x6')+_0x4c6cb3,_0x4dba47);SmsInteractionEvents['on'](_0x4c6cb3,_0x281e59);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index c7d20f8..dd479f2 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 _0x7f0e=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','tracked','sms','smsmessage:create','create','/:id/status','status','put','update','/:id/accept','reject','delete','exports','multer'];(function(_0x2f2b66,_0x6825bd){var _0xdd99be=function(_0x4147a6){while(--_0x4147a6){_0x2f2b66['push'](_0x2f2b66['shift']());}};_0xdd99be(++_0x6825bd);}(_0x7f0e,0xd1));var _0xe7f0=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x7f0e[_0x618414];return _0x21c19a;};'use strict';var multer=require(_0xe7f0('0x0'));var util=require(_0xe7f0('0x1'));var path=require(_0xe7f0('0x2'));var timeout=require(_0xe7f0('0x3'));var express=require(_0xe7f0('0x4'));var router=express[_0xe7f0('0x5')]();var fs_extra=require(_0xe7f0('0x6'));var auth=require(_0xe7f0('0x7'));var interaction=require(_0xe7f0('0x8'));var config=require('../../config/environment');var controller=require(_0xe7f0('0x9'));router[_0xe7f0('0xa')]('/',auth[_0xe7f0('0xb')](),controller[_0xe7f0('0xc')]);router['get'](_0xe7f0('0xd'),auth[_0xe7f0('0xb')](),controller[_0xe7f0('0xe')]);router[_0xe7f0('0xa')](_0xe7f0('0xf'),auth[_0xe7f0('0xb')](),controller[_0xe7f0('0x10')]);router[_0xe7f0('0x11')]('/',auth[_0xe7f0('0xb')](),interaction[_0xe7f0('0x12')](_0xe7f0('0x13'),_0xe7f0('0x14')),controller[_0xe7f0('0x15')]);router[_0xe7f0('0x11')](_0xe7f0('0x16'),controller[_0xe7f0('0x17')]);router[_0xe7f0('0x18')](_0xe7f0('0xf'),auth[_0xe7f0('0xb')](),controller[_0xe7f0('0x19')]);router[_0xe7f0('0x18')](_0xe7f0('0x1a'),auth[_0xe7f0('0xb')](),controller['accept']);router[_0xe7f0('0x18')]('/:id/reject',auth['isAuthenticated'](),controller[_0xe7f0('0x1b')]);router[_0xe7f0('0x1c')](_0xe7f0('0xf'),auth[_0xe7f0('0xb')](),controller['destroy']);module[_0xe7f0('0x1d')]=router; \ No newline at end of file +var _0x98e7=['destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','show','post','tracked','sms','smsmessage:create','create','status','put','/:id/accept','accept','/:id/reject','reject','delete','/:id'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x98e7,0x1c2));var _0x798e=function(_0x257b51,_0x325d77){_0x257b51=_0x257b51-0x0;var _0x256c79=_0x98e7[_0x257b51];return _0x256c79;};'use strict';var multer=require('multer');var util=require(_0x798e('0x0'));var path=require(_0x798e('0x1'));var timeout=require(_0x798e('0x2'));var express=require(_0x798e('0x3'));var router=express[_0x798e('0x4')]();var fs_extra=require(_0x798e('0x5'));var auth=require(_0x798e('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x798e('0x7'));var controller=require('./smsMessage.controller');router[_0x798e('0x8')]('/',auth[_0x798e('0x9')](),controller[_0x798e('0xa')]);router[_0x798e('0x8')](_0x798e('0xb'),auth[_0x798e('0x9')](),controller['describe']);router[_0x798e('0x8')]('/:id',auth[_0x798e('0x9')](),controller[_0x798e('0xc')]);router[_0x798e('0xd')]('/',auth['isAuthenticated'](),interaction[_0x798e('0xe')](_0x798e('0xf'),_0x798e('0x10')),controller[_0x798e('0x11')]);router[_0x798e('0xd')]('/:id/status',controller[_0x798e('0x12')]);router[_0x798e('0x13')]('/:id',auth[_0x798e('0x9')](),controller['update']);router[_0x798e('0x13')](_0x798e('0x14'),auth['isAuthenticated'](),controller[_0x798e('0x15')]);router[_0x798e('0x13')](_0x798e('0x16'),auth[_0x798e('0x9')](),controller[_0x798e('0x17')]);router[_0x798e('0x18')](_0x798e('0x19'),auth[_0x798e('0x9')](),controller[_0x798e('0x1a')]);module[_0x798e('0x1b')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index 5eef300..f03814a 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 _0xdd05=['exports','medium','BOOLEAN','out','STRING','DATE','sequelize'];(function(_0x1e440c,_0x3b2ca5){var _0x3cfab5=function(_0x905734){while(--_0x905734){_0x1e440c['push'](_0x1e440c['shift']());}};_0x3cfab5(++_0x3b2ca5);}(_0xdd05,0xfb));var _0x5dd0=function(_0x4ce315,_0x388074){_0x4ce315=_0x4ce315-0x0;var _0x1a6160=_0xdd05[_0x4ce315];return _0x1a6160;};'use strict';var Sequelize=require(_0x5dd0('0x0'));module[_0x5dd0('0x1')]={'body':{'type':Sequelize['TEXT'](_0x5dd0('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x5dd0('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x5dd0('0x4')),'defaultValue':_0x5dd0('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0x5dd0('0x5')](0xbe)},'phone':{'type':Sequelize[_0x5dd0('0x5')]},'readAt':{'type':Sequelize[_0x5dd0('0x6')]},'secret':{'type':Sequelize[_0x5dd0('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x5dd0('0x5')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x410d=['BOOLEAN','out','STRING','DATE','sequelize','exports','TEXT'];(function(_0x2393c0,_0x5d5d61){var _0x188aa9=function(_0x330de9){while(--_0x330de9){_0x2393c0['push'](_0x2393c0['shift']());}};_0x188aa9(++_0x5d5d61);}(_0x410d,0x66));var _0xd410=function(_0x3a6e4b,_0x118cd9){_0x3a6e4b=_0x3a6e4b-0x0;var _0x36572d=_0x410d[_0x3a6e4b];return _0x36572d;};'use strict';var Sequelize=require(_0xd410('0x0'));module[_0xd410('0x1')]={'body':{'type':Sequelize[_0xd410('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xd410('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xd410('0x4')),'defaultValue':_0xd410('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0xd410('0x5')](0xbe)},'phone':{'type':Sequelize[_0xd410('0x5')]},'readAt':{'type':Sequelize[_0xd410('0x6')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0xd410('0x5')]},'providerResponse':{'type':Sequelize[_0xd410('0x2')]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index 79bfa54..94e375a 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 _0x0d78=['interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','sms','SmsInteraction','SmsInteractionId','null','RejectMessage','rejectMessage','SmsAccountId','received\x20delivery\x20report\x20from','inspect','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','twilio','delivered','Status','plivio','groupName','DELIVERED','infobip','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','crypto','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','redis','defaults','./smsMessage.socket','register','jayson/promise','client','request','then','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','SmsMessage,\x20%s,\x20%s','info','result','catch','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','end','sendStatus','name','send','index','map','SmsMessage','rawAttributes','fieldName','type','key','model','query','keys','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','include','rows','show','params','intersection','includeAll','find','create','body','update','destroy','describe','../../config/logger','sms-interactions','accept','UserId','agent','isNil','read1stAt','format','YYYY-MM-DD\x20HH:mm:ss','interaction','get','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','SELECT','contact','User','fullname','email','manual'];(function(_0x65c903,_0x41e920){var _0x23e1d7=function(_0x4279cd){while(--_0x4279cd){_0x65c903['push'](_0x65c903['shift']());}};_0x23e1d7(++_0x41e920);}(_0x0d78,0x134));var _0x80d7=function(_0x5962b4,_0x84be73){_0x5962b4=_0x5962b4-0x0;var _0xe6443c=_0x0d78[_0x5962b4];return _0xe6443c;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x80d7('0x0'));var rp=require('request-promise');var moment=require(_0x80d7('0x1'));var BPromise=require(_0x80d7('0x2'));var Mustache=require(_0x80d7('0x3'));var util=require(_0x80d7('0x4'));var path=require('path');var sox=require(_0x80d7('0x5'));var csv=require('to-csv');var ejs=require(_0x80d7('0x6'));var fs=require('fs');var fs_extra=require(_0x80d7('0x7'));var _=require(_0x80d7('0x8'));var squel=require(_0x80d7('0x9'));var crypto=require(_0x80d7('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x80d7('0xb'));var querystring=require(_0x80d7('0xc'));var Papa=require(_0x80d7('0xd'));var Redis=require(_0x80d7('0xe'));var authService=require(_0x80d7('0xf'));var qs=require(_0x80d7('0x10'));var as=require(_0x80d7('0x11'));var hardwareService=require(_0x80d7('0x12'));var logger=require('../../config/logger')(_0x80d7('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x80d7('0x14'))['db'];config[_0x80d7('0x15')]=_[_0x80d7('0x16')](config[_0x80d7('0x15')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x80d7('0x17'))[_0x80d7('0x18')](socket);var jayson=require(_0x80d7('0x19'));var client=jayson[_0x80d7('0x1a')]['http']({'port':0x232c});var client9002=jayson[_0x80d7('0x1a')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3d27e5,_0x5bfdd5,_0xc7ba3f,_0x37bc0c){return new BPromise(function(_0xdbe61c,_0x4ab691){var _0x5051ad=_0x37bc0c||client;return _0x5051ad[_0x80d7('0x1b')](_0x3d27e5,_0xc7ba3f)[_0x80d7('0x1c')](function(_0x46c695){logger['info']('SmsMessage,\x20%s,\x20%s',_0x5bfdd5,_0x80d7('0x1d'));logger[_0x80d7('0x1e')](_0x80d7('0x1f'),_0x5bfdd5,_0x80d7('0x1d'),JSON[_0x80d7('0x20')](_0x46c695));if(_0x46c695['error']){if(_0x46c695[_0x80d7('0x21')][_0x80d7('0x22')]===0x1f4){logger[_0x80d7('0x21')]('SmsMessage,\x20%s,\x20%s',_0x5bfdd5,_0x46c695[_0x80d7('0x21')][_0x80d7('0x23')]);return _0x4ab691(_0x46c695['error'][_0x80d7('0x23')]);}logger[_0x80d7('0x21')](_0x80d7('0x24'),_0x5bfdd5,_0x46c695[_0x80d7('0x21')][_0x80d7('0x23')]);return _0xdbe61c(_0x46c695['error'][_0x80d7('0x23')]);}else{logger[_0x80d7('0x25')](_0x80d7('0x24'),_0x5bfdd5,_0x80d7('0x1d'));_0xdbe61c(_0x46c695[_0x80d7('0x26')][_0x80d7('0x23')]);}})[_0x80d7('0x27')](function(_0x54416d){logger['error']('SmsMessage,\x20%s,\x20%s',_0x5bfdd5,_0x54416d);_0x4ab691(_0x54416d);});});}function respondWithStatusCode(_0x12a69b,_0x1a17f7){_0x1a17f7=_0x1a17f7||0xcc;return function(_0x3d632a){if(_0x3d632a){return _0x12a69b['sendStatus'](_0x1a17f7);}return _0x12a69b[_0x80d7('0x28')](_0x1a17f7)['end']();};}function respondWithResult(_0x370876,_0x1d6489){_0x1d6489=_0x1d6489||0xc8;return function(_0x75155a){if(_0x75155a){return _0x370876[_0x80d7('0x28')](_0x1d6489)['json'](_0x75155a);}};}function respondWithFilteredResult(_0x178ee0,_0x347ecd){return function(_0x3aed24){if(_0x3aed24){var _0x1782bb=typeof _0x347ecd[_0x80d7('0x29')]===_0x80d7('0x2a')&&typeof _0x347ecd[_0x80d7('0x2b')]===_0x80d7('0x2a');var _0x430692=_0x3aed24[_0x80d7('0x2c')];var _0x2e513c=_0x1782bb?0x0:_0x347ecd[_0x80d7('0x29')];var _0x257d00=_0x1782bb?_0x3aed24[_0x80d7('0x2c')]:_0x347ecd[_0x80d7('0x29')]+_0x347ecd['limit'];var _0xd47106;if(_0x257d00>=_0x430692){_0x257d00=_0x430692;_0xd47106=0xc8;}else{_0xd47106=0xce;}_0x178ee0['status'](_0xd47106);return _0x178ee0[_0x80d7('0x2d')](_0x80d7('0x2e'),_0x2e513c+'-'+_0x257d00+'/'+_0x430692)[_0x80d7('0x2f')](_0x3aed24);}return null;};}function patchUpdates(_0x517ffb){return function(_0x460f30){try{jsonpatch[_0x80d7('0x30')](_0x460f30,_0x517ffb,!![]);}catch(_0x461895){return BPromise[_0x80d7('0x31')](_0x461895);}return _0x460f30['save']();};}function saveUpdates(_0x1439ab,_0x42ee9e){return function(_0x24e548){if(_0x24e548){return _0x24e548['update'](_0x1439ab)[_0x80d7('0x1c')](function(_0x5643ae){return _0x5643ae;});}return null;};}function removeEntity(_0x2e1060,_0x2ef379){return function(_0x1ed1c1){if(_0x1ed1c1){return _0x1ed1c1['destroy']()[_0x80d7('0x1c')](function(){_0x2e1060[_0x80d7('0x28')](0xcc)[_0x80d7('0x32')]();});}};}function handleEntityNotFound(_0x5c97d6,_0x476c67){return function(_0x4458ee){if(!_0x4458ee){_0x5c97d6[_0x80d7('0x33')](0x194);}return _0x4458ee;};}function handleError(_0xe6d493,_0x166dd8){_0x166dd8=_0x166dd8||0x1f4;return function(_0x20013d){logger[_0x80d7('0x21')](_0x20013d['stack']);if(_0x20013d['name']){delete _0x20013d[_0x80d7('0x34')];}_0xe6d493[_0x80d7('0x28')](_0x166dd8)[_0x80d7('0x35')](_0x20013d);};}exports[_0x80d7('0x36')]=function(_0x239173,_0x148474){var _0x4214e4={},_0x51e041={},_0x169039={'count':0x0,'rows':[]};var _0x14d45c=_[_0x80d7('0x37')](db[_0x80d7('0x38')][_0x80d7('0x39')],function(_0x436af6){return{'name':_0x436af6[_0x80d7('0x3a')],'type':_0x436af6[_0x80d7('0x3b')][_0x80d7('0x3c')]};});_0x51e041[_0x80d7('0x3d')]=_[_0x80d7('0x37')](_0x14d45c,_0x80d7('0x34'));_0x51e041[_0x80d7('0x3e')]=_[_0x80d7('0x3f')](_0x239173['query']);_0x51e041['filters']=_['intersection'](_0x51e041[_0x80d7('0x3d')],_0x51e041[_0x80d7('0x3e')]);_0x4214e4[_0x80d7('0x40')]=_['intersection'](_0x51e041[_0x80d7('0x3d')],qs['fields'](_0x239173[_0x80d7('0x3e')][_0x80d7('0x41')]));_0x4214e4[_0x80d7('0x40')]=_0x4214e4[_0x80d7('0x40')][_0x80d7('0x42')]?_0x4214e4[_0x80d7('0x40')]:_0x51e041[_0x80d7('0x3d')];if(!_0x239173[_0x80d7('0x3e')][_0x80d7('0x43')](_0x80d7('0x44'))){_0x4214e4[_0x80d7('0x2b')]=qs[_0x80d7('0x2b')](_0x239173['query']['limit']);_0x4214e4[_0x80d7('0x29')]=qs[_0x80d7('0x29')](_0x239173[_0x80d7('0x3e')][_0x80d7('0x29')]);}_0x4214e4[_0x80d7('0x45')]=qs[_0x80d7('0x46')](_0x239173[_0x80d7('0x3e')][_0x80d7('0x46')]);_0x4214e4[_0x80d7('0x47')]=qs[_0x80d7('0x48')](_['pick'](_0x239173['query'],_0x51e041[_0x80d7('0x48')]),_0x14d45c);if(_0x239173[_0x80d7('0x3e')][_0x80d7('0x49')]){_0x4214e4[_0x80d7('0x47')]=_[_0x80d7('0x4a')](_0x4214e4[_0x80d7('0x47')],{'$or':_[_0x80d7('0x37')](_0x14d45c,function(_0x3f54d9){if(_0x3f54d9[_0x80d7('0x3b')]!==_0x80d7('0x4b')){var _0x518ff8={};_0x518ff8[_0x3f54d9[_0x80d7('0x34')]]={'$like':'%'+_0x239173['query']['filter']+'%'};return _0x518ff8;}})});}_0x4214e4=_[_0x80d7('0x4a')]({},_0x4214e4,_0x239173[_0x80d7('0x4c')]);var _0x71350f={'where':_0x4214e4[_0x80d7('0x47')]};return db[_0x80d7('0x38')][_0x80d7('0x2c')](_0x71350f)[_0x80d7('0x1c')](function(_0x1ffaf1){_0x169039[_0x80d7('0x2c')]=_0x1ffaf1;if(_0x239173[_0x80d7('0x3e')]['includeAll']){_0x4214e4[_0x80d7('0x4d')]=[{'all':!![]}];}return db[_0x80d7('0x38')]['findAll'](_0x4214e4);})['then'](function(_0x333c1f){_0x169039[_0x80d7('0x4e')]=_0x333c1f;return _0x169039;})[_0x80d7('0x1c')](respondWithFilteredResult(_0x148474,_0x4214e4))[_0x80d7('0x27')](handleError(_0x148474,null));};exports[_0x80d7('0x4f')]=function(_0x41173f,_0x57fa70){var _0x17d1d9={'raw':!![],'where':{'id':_0x41173f[_0x80d7('0x50')]['id']}},_0x2a074e={};_0x2a074e[_0x80d7('0x3d')]=_[_0x80d7('0x3f')](db[_0x80d7('0x38')][_0x80d7('0x39')]);_0x2a074e[_0x80d7('0x3e')]=_['keys'](_0x41173f[_0x80d7('0x3e')]);_0x2a074e[_0x80d7('0x48')]=_[_0x80d7('0x51')](_0x2a074e[_0x80d7('0x3d')],_0x2a074e[_0x80d7('0x3e')]);_0x17d1d9[_0x80d7('0x40')]=_[_0x80d7('0x51')](_0x2a074e[_0x80d7('0x3d')],qs[_0x80d7('0x41')](_0x41173f[_0x80d7('0x3e')][_0x80d7('0x41')]));_0x17d1d9[_0x80d7('0x40')]=_0x17d1d9[_0x80d7('0x40')][_0x80d7('0x42')]?_0x17d1d9[_0x80d7('0x40')]:_0x2a074e[_0x80d7('0x3d')];if(_0x41173f[_0x80d7('0x3e')][_0x80d7('0x52')]){_0x17d1d9[_0x80d7('0x4d')]=[{'all':!![]}];}_0x17d1d9=_[_0x80d7('0x4a')]({},_0x17d1d9,_0x41173f['options']);return db[_0x80d7('0x38')][_0x80d7('0x53')](_0x17d1d9)['then'](handleEntityNotFound(_0x57fa70,null))[_0x80d7('0x1c')](respondWithResult(_0x57fa70,null))[_0x80d7('0x27')](handleError(_0x57fa70,null));};exports[_0x80d7('0x54')]=function(_0x357397,_0x11f00d){return db[_0x80d7('0x38')]['create'](_0x357397[_0x80d7('0x55')],{})[_0x80d7('0x1c')](respondWithResult(_0x11f00d,0xc9))[_0x80d7('0x27')](handleError(_0x11f00d,null));};exports[_0x80d7('0x56')]=function(_0x1a82c4,_0x477b54){if(_0x1a82c4[_0x80d7('0x55')]['id']){delete _0x1a82c4[_0x80d7('0x55')]['id'];}return db[_0x80d7('0x38')][_0x80d7('0x53')]({'where':{'id':_0x1a82c4[_0x80d7('0x50')]['id']}})['then'](handleEntityNotFound(_0x477b54,null))[_0x80d7('0x1c')](saveUpdates(_0x1a82c4[_0x80d7('0x55')],null))[_0x80d7('0x1c')](respondWithResult(_0x477b54,null))[_0x80d7('0x27')](handleError(_0x477b54,null));};exports[_0x80d7('0x57')]=function(_0x95c0b9,_0x12e178){return db['SmsMessage'][_0x80d7('0x53')]({'where':{'id':_0x95c0b9[_0x80d7('0x50')]['id']}})[_0x80d7('0x1c')](handleEntityNotFound(_0x12e178,null))[_0x80d7('0x1c')](removeEntity(_0x12e178,null))[_0x80d7('0x27')](handleError(_0x12e178,null));};exports[_0x80d7('0x58')]=function(_0x232b59,_0xff0698){return db[_0x80d7('0x38')][_0x80d7('0x58')]()['then'](respondWithResult(_0xff0698,null))['catch'](handleError(_0xff0698,null));};var interaction_log=require(_0x80d7('0x59'))(_0x80d7('0x5a'));exports[_0x80d7('0x5b')]=function(_0x59599c,_0x110b7c,_0x21b37a){var _0x54634b={'agent':{},'channel':'sms'};if(_0x59599c[_0x80d7('0x55')]['id']){delete _0x59599c[_0x80d7('0x55')]['id'];}_0x59599c[_0x80d7('0x55')]['read']=!![];_0x59599c[_0x80d7('0x55')]['readAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x59599c[_0x80d7('0x55')][_0x80d7('0x5c')]=_0x59599c[_0x80d7('0x55')][_0x80d7('0x5c')]||_0x59599c['user']['id'];_0x54634b[_0x80d7('0x5d')]['id']=_0x59599c[_0x80d7('0x55')][_0x80d7('0x5c')];return db['SmsMessage']['find']({'where':{'id':_0x59599c[_0x80d7('0x50')]['id'],'UserId':null}})[_0x80d7('0x1c')](handleEntityNotFound(_0x110b7c,null))[_0x80d7('0x1c')](saveUpdates(_0x59599c['body'],null))[_0x80d7('0x1c')](function(_0x2c439d){if(_0x2c439d){_0x54634b[_0x80d7('0x23')]=_0x2c439d['get']({'plain':!![]});return db['SmsInteraction'][_0x80d7('0x53')]({'where':{'id':_0x2c439d['SmsInteractionId']}});}return null;})[_0x80d7('0x1c')](handleEntityNotFound(_0x110b7c,null))[_0x80d7('0x1c')](function(_0x50e346){if(_0x50e346){return _0x50e346[_0x80d7('0x56')]({'UserId':_0x59599c[_0x80d7('0x55')][_0x80d7('0x5c')],'read1stAt':_[_0x80d7('0x5e')](_0x50e346[_0x80d7('0x5f')])?moment()[_0x80d7('0x60')](_0x80d7('0x61')):undefined});}return null;})[_0x80d7('0x1c')](function(_0x9e69bf){if(_0x9e69bf){_0x54634b[_0x80d7('0x62')]=_0x9e69bf[_0x80d7('0x63')]({'plain':!![]});interaction_log[_0x80d7('0x25')](_0x80d7('0x64'),_0x59599c['user']['id'],_0x59599c[_0x80d7('0x65')][_0x80d7('0x34')],_0x59599c[_0x80d7('0x65')][_0x80d7('0x66')],_0x54634b['interaction']['id'],_0x59599c[_0x80d7('0x55')]?JSON[_0x80d7('0x20')](_0x59599c['body']):'null');return respondWithRpcPromise(_0x80d7('0x67'),_0x80d7('0x68'),_0x54634b);}return null;})[_0x80d7('0x1c')](function(_0x55a19c){var _0x53d584=_0x80d7('0x69')+_0x55a19c[_0x80d7('0x23')][_0x80d7('0x6a')];return db[_0x80d7('0x6b')][_0x80d7('0x3e')](_0x53d584,{'type':db['Sequelize'][_0x80d7('0x6c')][_0x80d7('0x6d')],'raw':!![]})[_0x80d7('0x1c')](function(_0x541344){return _0x541344;});})['then'](function(_0x2109bd){if(_0x2109bd){_0x54634b[_0x80d7('0x23')][_0x80d7('0x6e')]=_0x2109bd[0x0];if(!_0x59599c[_0x80d7('0x55')][_0x80d7('0x5c')])return;return db[_0x80d7('0x6f')][_0x80d7('0x53')]({'where':{'id':_0x59599c[_0x80d7('0x55')]['UserId'],'role':_0x80d7('0x5d')},'attributes':['id',_0x80d7('0x34'),_0x80d7('0x70'),_0x80d7('0x71'),'internal'],'raw':!![]});}return null;})[_0x80d7('0x1c')](function(_0xe3aea1){if(!_0xe3aea1)return null;_0x54634b['message']['agent']=_0xe3aea1;return _0x54634b;})['then'](function(_0x5f29d6){if(_0x5f29d6){if(_0x59599c['body'][_0x80d7('0x72')]){_0x54634b[_0x80d7('0x23')][_0x80d7('0x73')]=util[_0x80d7('0x60')](_0x80d7('0x74'),_0x59599c[_0x80d7('0x65')][_0x80d7('0x34')]);_0x54634b[_0x80d7('0x23')]['channel']=_0x54634b[_0x80d7('0x75')];_0x54634b['message'][_0x80d7('0x76')]=_0x54634b['channel'];_0x54634b[_0x80d7('0x23')][_0x80d7('0x77')]=_0x80d7('0x5b');return respondWithRpcPromise(_0x80d7('0x78'),_0x80d7('0x78'),{'event':_0x80d7('0x79'),'message':_0x54634b[_0x80d7('0x23')]},client9002)['then'](function(){return _0x54634b;});}return _0x54634b;}return null;})[_0x80d7('0x1c')](respondWithResult(_0x110b7c,null))[_0x80d7('0x27')](handleError(_0x110b7c,null));};var interaction_log=require(_0x80d7('0x59'))(_0x80d7('0x5a'));exports[_0x80d7('0x31')]=function(_0x46921f,_0x5ae980,_0x5f6a6a){var _0x3f30b7={'agent':{},'channel':_0x80d7('0x7a')};if(_0x46921f[_0x80d7('0x55')]['id']){delete _0x46921f[_0x80d7('0x55')]['id'];}_0x46921f[_0x80d7('0x55')]['UserId']=_0x46921f['body'][_0x80d7('0x5c')]||_0x46921f['user']['id'];_0x3f30b7[_0x80d7('0x5d')]['id']=_0x46921f['body'][_0x80d7('0x5c')];return db['SmsMessage'][_0x80d7('0x53')]({'where':{'id':_0x46921f[_0x80d7('0x50')]['id'],'UserId':null}})[_0x80d7('0x1c')](handleEntityNotFound(_0x5ae980,null))[_0x80d7('0x1c')](function(_0x43ca41){if(_0x43ca41){_0x3f30b7[_0x80d7('0x23')]=_0x43ca41[_0x80d7('0x63')]({'plain':!![]});return db[_0x80d7('0x7b')][_0x80d7('0x53')]({'where':{'id':_0x43ca41[_0x80d7('0x7c')]}});}return null;})[_0x80d7('0x1c')](handleEntityNotFound(_0x5ae980,null))[_0x80d7('0x1c')](function(_0x22b21e){if(_0x22b21e){_0x3f30b7[_0x80d7('0x62')]=_0x22b21e['get']({'plain':!![]});interaction_log['info']('[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x46921f[_0x80d7('0x65')]['id'],_0x46921f[_0x80d7('0x65')][_0x80d7('0x34')],_0x46921f[_0x80d7('0x65')][_0x80d7('0x66')],_0x3f30b7['interaction']['id'],_0x46921f[_0x80d7('0x55')]?JSON[_0x80d7('0x20')](_0x46921f[_0x80d7('0x55')]):_0x80d7('0x7d'));return respondWithRpcPromise(_0x80d7('0x7e'),_0x80d7('0x7f'),_0x3f30b7);}return null;})[_0x80d7('0x1c')](function(_0x5bdc44){var _0x1f721e=_0x80d7('0x69')+_0x5bdc44[_0x80d7('0x23')][_0x80d7('0x6a')];return db['sequelize'][_0x80d7('0x3e')](_0x1f721e,{'type':db['Sequelize']['QueryTypes'][_0x80d7('0x6d')],'raw':!![]})['then'](function(_0xe8e837){return _0xe8e837;});})['then'](function(_0x5de17b){if(_0x5de17b){_0x3f30b7[_0x80d7('0x23')]['contact']=_0x5de17b[0x0];if(!_0x46921f[_0x80d7('0x55')][_0x80d7('0x5c')])return;return db['User'][_0x80d7('0x53')]({'where':{'id':_0x46921f[_0x80d7('0x55')]['UserId'],'role':_0x80d7('0x5d')},'attributes':['id',_0x80d7('0x34'),_0x80d7('0x70'),_0x80d7('0x71'),'internal'],'raw':!![]});}return null;})[_0x80d7('0x1c')](function(_0x1e9fee){if(!_0x1e9fee)return null;_0x3f30b7[_0x80d7('0x23')][_0x80d7('0x5d')]=_0x1e9fee;return _0x3f30b7;})[_0x80d7('0x1c')](function(_0x507dc4){if(_0x507dc4){_0x507dc4['message'][_0x80d7('0x73')]=util['format'](_0x80d7('0x74'),_0x46921f[_0x80d7('0x65')]['name']);_0x507dc4[_0x80d7('0x23')][_0x80d7('0x75')]=_0x3f30b7[_0x80d7('0x75')];_0x507dc4[_0x80d7('0x23')]['motionChannel']=_0x3f30b7[_0x80d7('0x75')];_0x507dc4[_0x80d7('0x23')]['event']='reject';respondWithRpcPromise(_0x80d7('0x78'),_0x80d7('0x78'),{'event':'rejectmessage','message':_0x507dc4[_0x80d7('0x23')]},client9002);return _0x3f30b7;}return null;})[_0x80d7('0x1c')](respondWithResult(_0x5ae980,null))[_0x80d7('0x27')](handleError(_0x5ae980,null));};exports[_0x80d7('0x28')]=function(_0x5d56a4,_0x3782c1,_0x5e1385){if(_0x5d56a4[_0x80d7('0x55')]['id']){delete _0x5d56a4[_0x80d7('0x55')]['id'];}var _0x45bbed;return db['SmsMessage'][_0x80d7('0x53')]({'where':{'id':_0x5d56a4[_0x80d7('0x50')]['id']}})[_0x80d7('0x1c')](handleEntityNotFound(_0x3782c1,null))[_0x80d7('0x1c')](function(_0x22c547){if(_0x22c547){_0x45bbed=_0x22c547;return db['SmsAccount'][_0x80d7('0x53')]({'where':{'id':_0x22c547[_0x80d7('0x80')]}});}})[_0x80d7('0x1c')](handleEntityNotFound(_0x3782c1,null))[_0x80d7('0x1c')](function(_0x4cb4ca){if(_0x4cb4ca){logger[_0x80d7('0x1e')](_0x80d7('0x1f'),_0x80d7('0x28'),_0x80d7('0x81'),_0x4cb4ca['type'],util[_0x80d7('0x82')](_0x5d56a4['body'],{'showHidden':![],'depth':null}));switch(_0x4cb4ca['type']){case'twilio':if(_0x5d56a4[_0x80d7('0x55')][_0x80d7('0x83')]&&_0x5d56a4[_0x80d7('0x55')][_0x80d7('0x83')]===_0x45bbed[_0x80d7('0x84')]){return _0x45bbed['update']({'read':!![]});}else{logger[_0x80d7('0x21')](_0x80d7('0x85'),'status',_0x80d7('0x86'),util[_0x80d7('0x82')](_0x5d56a4[_0x80d7('0x55')],{'showHidden':![],'depth':null}));}break;case'plivo':if(_0x5d56a4[_0x80d7('0x55')]['MessageUUID']&&_0x5d56a4[_0x80d7('0x55')]['MessageUUID']===_0x45bbed[_0x80d7('0x84')]&&_['indexOf'](['sent',_0x80d7('0x87')],_0x5d56a4[_0x80d7('0x55')][_0x80d7('0x88')])>=0x0){return _0x45bbed[_0x80d7('0x56')]({'read':!![]});}else{logger['error'](_0x80d7('0x85'),_0x80d7('0x28'),_0x80d7('0x89'),util[_0x80d7('0x82')](_0x5d56a4[_0x80d7('0x55')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x56d01a=_0x5d56a4[_0x80d7('0x55')]['results'][0x0];if(_0x56d01a[_0x80d7('0x28')][_0x80d7('0x8a')]===_0x80d7('0x8b')){return _0x45bbed[_0x80d7('0x56')]({'read':!![]});}else{logger[_0x80d7('0x21')](_0x80d7('0x85'),_0x80d7('0x28'),_0x80d7('0x8c'),util[_0x80d7('0x82')](_0x5d56a4[_0x80d7('0x55')],{'showHidden':![],'depth':null}));}break;}return _0x45bbed;}})['then'](respondWithResult(_0x3782c1,null))[_0x80d7('0x27')](handleError(_0x3782c1,null));}; \ No newline at end of file +var _0x23db=['rejectmessage','SmsAccount','SmsAccountId','SmsMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','MessageSid','SmsAccount,\x20%s,\x20%s,\x20%s','twilio','inspect','plivo','MessageUUID','messageId','indexOf','sent','delivered','Status','plivio','infobip','DELIVERED','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','register','jayson/promise','client','http','then','info','SmsMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','map','SmsMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','count','includeAll','findAll','catch','show','params','include','create','body','find','describe','../../config/logger','sms-interactions','accept','sms','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','SmsInteraction','SmsInteractionId','read1stAt','format','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','AcceptMessage','acceptMessage','ContactId','QueryTypes','SELECT','User','fullname','email','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','agent','RejectMessage','rejectMessage','contact','internal'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x23db,0x141));var _0xb23d=function(_0x164eca,_0x555e28){_0x164eca=_0x164eca-0x0;var _0x2ce562=_0x23db[_0x164eca];return _0x2ce562;};'use strict';var emlformat=require(_0xb23d('0x0'));var rimraf=require(_0xb23d('0x1'));var zipdir=require(_0xb23d('0x2'));var jsonpatch=require(_0xb23d('0x3'));var rp=require(_0xb23d('0x4'));var moment=require(_0xb23d('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xb23d('0x6'));var path=require(_0xb23d('0x7'));var sox=require('sox');var csv=require(_0xb23d('0x8'));var ejs=require(_0xb23d('0x9'));var fs=require('fs');var fs_extra=require(_0xb23d('0xa'));var _=require(_0xb23d('0xb'));var squel=require(_0xb23d('0xc'));var crypto=require(_0xb23d('0xd'));var jsforce=require(_0xb23d('0xe'));var deskjs=require(_0xb23d('0xf'));var toCsv=require(_0xb23d('0x8'));var querystring=require('querystring');var Papa=require(_0xb23d('0x10'));var Redis=require(_0xb23d('0x11'));var authService=require(_0xb23d('0x12'));var qs=require(_0xb23d('0x13'));var as=require(_0xb23d('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xb23d('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xb23d('0x16'));var db=require(_0xb23d('0x17'))['db'];config[_0xb23d('0x18')]=_[_0xb23d('0x19')](config[_0xb23d('0x18')],{'host':_0xb23d('0x1a'),'port':0x18eb});var socket=require(_0xb23d('0x1b'))(new Redis(config['redis']));require(_0xb23d('0x1c'))[_0xb23d('0x1d')](socket);var jayson=require(_0xb23d('0x1e'));var client=jayson[_0xb23d('0x1f')][_0xb23d('0x20')]({'port':0x232c});var client9002=jayson[_0xb23d('0x1f')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5a8364,_0x2fba80,_0x45f0d1,_0x1b35d7){return new BPromise(function(_0x9e5eb3,_0x3c606f){var _0x21f5a=_0x1b35d7||client;return _0x21f5a['request'](_0x5a8364,_0x45f0d1)[_0xb23d('0x21')](function(_0x3f2c6b){logger[_0xb23d('0x22')](_0xb23d('0x23'),_0x2fba80,'request\x20sent');logger[_0xb23d('0x24')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x2fba80,_0xb23d('0x25'),JSON[_0xb23d('0x26')](_0x3f2c6b));if(_0x3f2c6b[_0xb23d('0x27')]){if(_0x3f2c6b[_0xb23d('0x27')][_0xb23d('0x28')]===0x1f4){logger[_0xb23d('0x27')](_0xb23d('0x23'),_0x2fba80,_0x3f2c6b['error'][_0xb23d('0x29')]);return _0x3c606f(_0x3f2c6b['error']['message']);}logger[_0xb23d('0x27')](_0xb23d('0x23'),_0x2fba80,_0x3f2c6b[_0xb23d('0x27')][_0xb23d('0x29')]);return _0x9e5eb3(_0x3f2c6b[_0xb23d('0x27')][_0xb23d('0x29')]);}else{logger[_0xb23d('0x22')](_0xb23d('0x23'),_0x2fba80,_0xb23d('0x25'));_0x9e5eb3(_0x3f2c6b[_0xb23d('0x2a')][_0xb23d('0x29')]);}})['catch'](function(_0x1f0731){logger[_0xb23d('0x27')](_0xb23d('0x23'),_0x2fba80,_0x1f0731);_0x3c606f(_0x1f0731);});});}function respondWithStatusCode(_0x4e1538,_0x4919dc){_0x4919dc=_0x4919dc||0xcc;return function(_0x21a571){if(_0x21a571){return _0x4e1538[_0xb23d('0x2b')](_0x4919dc);}return _0x4e1538[_0xb23d('0x2c')](_0x4919dc)[_0xb23d('0x2d')]();};}function respondWithResult(_0x4de438,_0x2785f5){_0x2785f5=_0x2785f5||0xc8;return function(_0x28bf09){if(_0x28bf09){return _0x4de438[_0xb23d('0x2c')](_0x2785f5)[_0xb23d('0x2e')](_0x28bf09);}};}function respondWithFilteredResult(_0x1a892c,_0x67eaf3){return function(_0x26990e){if(_0x26990e){var _0x867d69=typeof _0x67eaf3[_0xb23d('0x2f')]===_0xb23d('0x30')&&typeof _0x67eaf3[_0xb23d('0x31')]===_0xb23d('0x30');var _0x917292=_0x26990e['count'];var _0x56f62a=_0x867d69?0x0:_0x67eaf3['offset'];var _0x4722c1=_0x867d69?_0x26990e['count']:_0x67eaf3['offset']+_0x67eaf3[_0xb23d('0x31')];var _0x49d4cf;if(_0x4722c1>=_0x917292){_0x4722c1=_0x917292;_0x49d4cf=0xc8;}else{_0x49d4cf=0xce;}_0x1a892c[_0xb23d('0x2c')](_0x49d4cf);return _0x1a892c[_0xb23d('0x32')](_0xb23d('0x33'),_0x56f62a+'-'+_0x4722c1+'/'+_0x917292)[_0xb23d('0x2e')](_0x26990e);}return null;};}function patchUpdates(_0x2026e0){return function(_0x2d49c1){try{jsonpatch[_0xb23d('0x34')](_0x2d49c1,_0x2026e0,!![]);}catch(_0x1b1927){return BPromise[_0xb23d('0x35')](_0x1b1927);}return _0x2d49c1[_0xb23d('0x36')]();};}function saveUpdates(_0x3fac9c,_0x397899){return function(_0x2f14b1){if(_0x2f14b1){return _0x2f14b1[_0xb23d('0x37')](_0x3fac9c)[_0xb23d('0x21')](function(_0x29f472){return _0x29f472;});}return null;};}function removeEntity(_0x55f252,_0x12df0a){return function(_0x1f0ff7){if(_0x1f0ff7){return _0x1f0ff7[_0xb23d('0x38')]()[_0xb23d('0x21')](function(){_0x55f252[_0xb23d('0x2c')](0xcc)[_0xb23d('0x2d')]();});}};}function handleEntityNotFound(_0xc28f19,_0x39be18){return function(_0x5c68c7){if(!_0x5c68c7){_0xc28f19[_0xb23d('0x2b')](0x194);}return _0x5c68c7;};}function handleError(_0xe306ce,_0x109a30){_0x109a30=_0x109a30||0x1f4;return function(_0x1658ef){logger[_0xb23d('0x27')](_0x1658ef[_0xb23d('0x39')]);if(_0x1658ef[_0xb23d('0x3a')]){delete _0x1658ef[_0xb23d('0x3a')];}_0xe306ce[_0xb23d('0x2c')](_0x109a30)[_0xb23d('0x3b')](_0x1658ef);};}exports[_0xb23d('0x3c')]=function(_0x22683a,_0x4f84fb){var _0x359a8e={},_0x24f55a={},_0x8feeea={'count':0x0,'rows':[]};var _0x4dae03=_[_0xb23d('0x3d')](db[_0xb23d('0x3e')][_0xb23d('0x3f')],function(_0x1ed4c5){return{'name':_0x1ed4c5[_0xb23d('0x40')],'type':_0x1ed4c5[_0xb23d('0x41')][_0xb23d('0x42')]};});_0x24f55a[_0xb23d('0x43')]=_[_0xb23d('0x3d')](_0x4dae03,'name');_0x24f55a[_0xb23d('0x44')]=_[_0xb23d('0x45')](_0x22683a[_0xb23d('0x44')]);_0x24f55a[_0xb23d('0x46')]=_['intersection'](_0x24f55a[_0xb23d('0x43')],_0x24f55a['query']);_0x359a8e['attributes']=_[_0xb23d('0x47')](_0x24f55a['model'],qs[_0xb23d('0x48')](_0x22683a[_0xb23d('0x44')][_0xb23d('0x48')]));_0x359a8e[_0xb23d('0x49')]=_0x359a8e['attributes'][_0xb23d('0x4a')]?_0x359a8e['attributes']:_0x24f55a[_0xb23d('0x43')];if(!_0x22683a['query'][_0xb23d('0x4b')]('nolimit')){_0x359a8e['limit']=qs['limit'](_0x22683a['query'][_0xb23d('0x31')]);_0x359a8e[_0xb23d('0x2f')]=qs['offset'](_0x22683a[_0xb23d('0x44')][_0xb23d('0x2f')]);}_0x359a8e[_0xb23d('0x4c')]=qs[_0xb23d('0x4d')](_0x22683a['query']['sort']);_0x359a8e[_0xb23d('0x4e')]=qs[_0xb23d('0x46')](_[_0xb23d('0x4f')](_0x22683a[_0xb23d('0x44')],_0x24f55a['filters']),_0x4dae03);if(_0x22683a[_0xb23d('0x44')][_0xb23d('0x50')]){_0x359a8e[_0xb23d('0x4e')]=_[_0xb23d('0x51')](_0x359a8e['where'],{'$or':_[_0xb23d('0x3d')](_0x4dae03,function(_0x545fa3){if(_0x545fa3[_0xb23d('0x41')]!==_0xb23d('0x52')){var _0x1de003={};_0x1de003[_0x545fa3['name']]={'$like':'%'+_0x22683a[_0xb23d('0x44')]['filter']+'%'};return _0x1de003;}})});}_0x359a8e=_[_0xb23d('0x51')]({},_0x359a8e,_0x22683a['options']);var _0x374540={'where':_0x359a8e[_0xb23d('0x4e')]};return db[_0xb23d('0x3e')][_0xb23d('0x53')](_0x374540)[_0xb23d('0x21')](function(_0x2382b5){_0x8feeea[_0xb23d('0x53')]=_0x2382b5;if(_0x22683a[_0xb23d('0x44')][_0xb23d('0x54')]){_0x359a8e['include']=[{'all':!![]}];}return db[_0xb23d('0x3e')][_0xb23d('0x55')](_0x359a8e);})['then'](function(_0x135ebd){_0x8feeea['rows']=_0x135ebd;return _0x8feeea;})[_0xb23d('0x21')](respondWithFilteredResult(_0x4f84fb,_0x359a8e))[_0xb23d('0x56')](handleError(_0x4f84fb,null));};exports[_0xb23d('0x57')]=function(_0x4f0956,_0xc78b28){var _0x232f78={'raw':!![],'where':{'id':_0x4f0956[_0xb23d('0x58')]['id']}},_0x526c76={};_0x526c76[_0xb23d('0x43')]=_[_0xb23d('0x45')](db[_0xb23d('0x3e')][_0xb23d('0x3f')]);_0x526c76[_0xb23d('0x44')]=_[_0xb23d('0x45')](_0x4f0956[_0xb23d('0x44')]);_0x526c76['filters']=_['intersection'](_0x526c76[_0xb23d('0x43')],_0x526c76['query']);_0x232f78[_0xb23d('0x49')]=_[_0xb23d('0x47')](_0x526c76[_0xb23d('0x43')],qs['fields'](_0x4f0956[_0xb23d('0x44')][_0xb23d('0x48')]));_0x232f78[_0xb23d('0x49')]=_0x232f78['attributes'][_0xb23d('0x4a')]?_0x232f78['attributes']:_0x526c76[_0xb23d('0x43')];if(_0x4f0956[_0xb23d('0x44')][_0xb23d('0x54')]){_0x232f78[_0xb23d('0x59')]=[{'all':!![]}];}_0x232f78=_[_0xb23d('0x51')]({},_0x232f78,_0x4f0956['options']);return db[_0xb23d('0x3e')]['find'](_0x232f78)[_0xb23d('0x21')](handleEntityNotFound(_0xc78b28,null))[_0xb23d('0x21')](respondWithResult(_0xc78b28,null))[_0xb23d('0x56')](handleError(_0xc78b28,null));};exports[_0xb23d('0x5a')]=function(_0x1f18bc,_0x163e8e){return db['SmsMessage']['create'](_0x1f18bc['body'],{})[_0xb23d('0x21')](respondWithResult(_0x163e8e,0xc9))[_0xb23d('0x56')](handleError(_0x163e8e,null));};exports[_0xb23d('0x37')]=function(_0x4ed196,_0x1bd004){if(_0x4ed196[_0xb23d('0x5b')]['id']){delete _0x4ed196[_0xb23d('0x5b')]['id'];}return db['SmsMessage'][_0xb23d('0x5c')]({'where':{'id':_0x4ed196[_0xb23d('0x58')]['id']}})[_0xb23d('0x21')](handleEntityNotFound(_0x1bd004,null))[_0xb23d('0x21')](saveUpdates(_0x4ed196[_0xb23d('0x5b')],null))['then'](respondWithResult(_0x1bd004,null))[_0xb23d('0x56')](handleError(_0x1bd004,null));};exports[_0xb23d('0x38')]=function(_0x5129ed,_0x57e003){return db[_0xb23d('0x3e')]['find']({'where':{'id':_0x5129ed[_0xb23d('0x58')]['id']}})[_0xb23d('0x21')](handleEntityNotFound(_0x57e003,null))[_0xb23d('0x21')](removeEntity(_0x57e003,null))[_0xb23d('0x56')](handleError(_0x57e003,null));};exports[_0xb23d('0x5d')]=function(_0x25fc65,_0x24fb1c){return db['SmsMessage'][_0xb23d('0x5d')]()['then'](respondWithResult(_0x24fb1c,null))['catch'](handleError(_0x24fb1c,null));};var interaction_log=require(_0xb23d('0x5e'))(_0xb23d('0x5f'));exports[_0xb23d('0x60')]=function(_0xc9867d,_0x12c60b,_0x266ebd){var _0x4fdcde={'agent':{},'channel':_0xb23d('0x61')};if(_0xc9867d[_0xb23d('0x5b')]['id']){delete _0xc9867d[_0xb23d('0x5b')]['id'];}_0xc9867d[_0xb23d('0x5b')][_0xb23d('0x62')]=!![];_0xc9867d['body'][_0xb23d('0x63')]=moment()['format'](_0xb23d('0x64'));_0xc9867d[_0xb23d('0x5b')][_0xb23d('0x65')]=_0xc9867d['body'][_0xb23d('0x65')]||_0xc9867d[_0xb23d('0x66')]['id'];_0x4fdcde['agent']['id']=_0xc9867d[_0xb23d('0x5b')][_0xb23d('0x65')];return db[_0xb23d('0x3e')]['find']({'where':{'id':_0xc9867d[_0xb23d('0x58')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x12c60b,null))[_0xb23d('0x21')](saveUpdates(_0xc9867d[_0xb23d('0x5b')],null))[_0xb23d('0x21')](function(_0x5a0817){if(_0x5a0817){_0x4fdcde['message']=_0x5a0817[_0xb23d('0x67')]({'plain':!![]});return db[_0xb23d('0x68')][_0xb23d('0x5c')]({'where':{'id':_0x5a0817[_0xb23d('0x69')]}});}return null;})[_0xb23d('0x21')](handleEntityNotFound(_0x12c60b,null))[_0xb23d('0x21')](function(_0x50319e){if(_0x50319e){return _0x50319e[_0xb23d('0x37')]({'UserId':_0xc9867d[_0xb23d('0x5b')][_0xb23d('0x65')],'read1stAt':_['isNil'](_0x50319e[_0xb23d('0x6a')])?moment()[_0xb23d('0x6b')](_0xb23d('0x64')):undefined});}return null;})[_0xb23d('0x21')](function(_0xbdba41){if(_0xbdba41){_0x4fdcde[_0xb23d('0x6c')]=_0xbdba41[_0xb23d('0x67')]({'plain':!![]});interaction_log[_0xb23d('0x22')](_0xb23d('0x6d'),_0xc9867d[_0xb23d('0x66')]['id'],_0xc9867d[_0xb23d('0x66')]['name'],_0xc9867d['user'][_0xb23d('0x6e')],_0x4fdcde['interaction']['id'],_0xc9867d[_0xb23d('0x5b')]?JSON['stringify'](_0xc9867d[_0xb23d('0x5b')]):'null');return respondWithRpcPromise(_0xb23d('0x6f'),_0xb23d('0x70'),_0x4fdcde);}return null;})[_0xb23d('0x21')](function(_0xe3c92b){var _0x15d8bb='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0xe3c92b['message'][_0xb23d('0x71')];return db['sequelize'][_0xb23d('0x44')](_0x15d8bb,{'type':db['Sequelize'][_0xb23d('0x72')][_0xb23d('0x73')],'raw':!![]})['then'](function(_0x2d16a7){return _0x2d16a7;});})['then'](function(_0x2276f3){if(_0x2276f3){_0x4fdcde[_0xb23d('0x29')]['contact']=_0x2276f3[0x0];if(!_0xc9867d[_0xb23d('0x5b')]['UserId'])return;return db[_0xb23d('0x74')][_0xb23d('0x5c')]({'where':{'id':_0xc9867d[_0xb23d('0x5b')]['UserId'],'role':'agent'},'attributes':['id',_0xb23d('0x3a'),_0xb23d('0x75'),_0xb23d('0x76'),'internal'],'raw':!![]});}return null;})['then'](function(_0x274760){if(!_0x274760)return null;_0x4fdcde[_0xb23d('0x29')]['agent']=_0x274760;return _0x4fdcde;})[_0xb23d('0x21')](function(_0x921a54){if(_0x921a54){if(_0xc9867d[_0xb23d('0x5b')][_0xb23d('0x77')]){_0x4fdcde[_0xb23d('0x29')][_0xb23d('0x78')]=util[_0xb23d('0x6b')](_0xb23d('0x79'),_0xc9867d[_0xb23d('0x66')]['name']);_0x4fdcde[_0xb23d('0x29')][_0xb23d('0x7a')]=_0x4fdcde[_0xb23d('0x7a')];_0x4fdcde[_0xb23d('0x29')][_0xb23d('0x7b')]=_0x4fdcde[_0xb23d('0x7a')];_0x4fdcde['message'][_0xb23d('0x7c')]=_0xb23d('0x60');return respondWithRpcPromise(_0xb23d('0x7d'),_0xb23d('0x7d'),{'event':_0xb23d('0x7e'),'message':_0x4fdcde[_0xb23d('0x29')]},client9002)['then'](function(){return _0x4fdcde;});}return _0x4fdcde;}return null;})[_0xb23d('0x21')](respondWithResult(_0x12c60b,null))[_0xb23d('0x56')](handleError(_0x12c60b,null));};var interaction_log=require(_0xb23d('0x5e'))('sms-interactions');exports[_0xb23d('0x35')]=function(_0x589a55,_0x166352,_0x1e0f25){var _0x51b854={'agent':{},'channel':_0xb23d('0x61')};if(_0x589a55[_0xb23d('0x5b')]['id']){delete _0x589a55[_0xb23d('0x5b')]['id'];}_0x589a55[_0xb23d('0x5b')]['UserId']=_0x589a55[_0xb23d('0x5b')][_0xb23d('0x65')]||_0x589a55['user']['id'];_0x51b854[_0xb23d('0x7f')]['id']=_0x589a55[_0xb23d('0x5b')][_0xb23d('0x65')];return db[_0xb23d('0x3e')]['find']({'where':{'id':_0x589a55[_0xb23d('0x58')]['id'],'UserId':null}})[_0xb23d('0x21')](handleEntityNotFound(_0x166352,null))[_0xb23d('0x21')](function(_0x3297ad){if(_0x3297ad){_0x51b854[_0xb23d('0x29')]=_0x3297ad[_0xb23d('0x67')]({'plain':!![]});return db[_0xb23d('0x68')]['find']({'where':{'id':_0x3297ad['SmsInteractionId']}});}return null;})[_0xb23d('0x21')](handleEntityNotFound(_0x166352,null))[_0xb23d('0x21')](function(_0xeb4d3c){if(_0xeb4d3c){_0x51b854['interaction']=_0xeb4d3c[_0xb23d('0x67')]({'plain':!![]});interaction_log[_0xb23d('0x22')]('[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x589a55['user']['id'],_0x589a55[_0xb23d('0x66')][_0xb23d('0x3a')],_0x589a55[_0xb23d('0x66')]['role'],_0x51b854[_0xb23d('0x6c')]['id'],_0x589a55[_0xb23d('0x5b')]?JSON[_0xb23d('0x26')](_0x589a55[_0xb23d('0x5b')]):'null');return respondWithRpcPromise(_0xb23d('0x80'),_0xb23d('0x81'),_0x51b854);}return null;})['then'](function(_0x37e440){var _0x4d3b73='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x37e440['message'][_0xb23d('0x71')];return db['sequelize'][_0xb23d('0x44')](_0x4d3b73,{'type':db['Sequelize'][_0xb23d('0x72')][_0xb23d('0x73')],'raw':!![]})[_0xb23d('0x21')](function(_0x1d9637){return _0x1d9637;});})[_0xb23d('0x21')](function(_0x582ef5){if(_0x582ef5){_0x51b854[_0xb23d('0x29')][_0xb23d('0x82')]=_0x582ef5[0x0];if(!_0x589a55['body'][_0xb23d('0x65')])return;return db[_0xb23d('0x74')][_0xb23d('0x5c')]({'where':{'id':_0x589a55[_0xb23d('0x5b')][_0xb23d('0x65')],'role':_0xb23d('0x7f')},'attributes':['id',_0xb23d('0x3a'),_0xb23d('0x75'),_0xb23d('0x76'),_0xb23d('0x83')],'raw':!![]});}return null;})[_0xb23d('0x21')](function(_0x514879){if(!_0x514879)return null;_0x51b854[_0xb23d('0x29')][_0xb23d('0x7f')]=_0x514879;return _0x51b854;})[_0xb23d('0x21')](function(_0x4925f3){if(_0x4925f3){_0x4925f3[_0xb23d('0x29')][_0xb23d('0x78')]=util[_0xb23d('0x6b')](_0xb23d('0x79'),_0x589a55[_0xb23d('0x66')][_0xb23d('0x3a')]);_0x4925f3[_0xb23d('0x29')][_0xb23d('0x7a')]=_0x51b854[_0xb23d('0x7a')];_0x4925f3[_0xb23d('0x29')]['motionChannel']=_0x51b854[_0xb23d('0x7a')];_0x4925f3[_0xb23d('0x29')]['event']=_0xb23d('0x35');respondWithRpcPromise(_0xb23d('0x7d'),_0xb23d('0x7d'),{'event':_0xb23d('0x84'),'message':_0x4925f3[_0xb23d('0x29')]},client9002);return _0x51b854;}return null;})[_0xb23d('0x21')](respondWithResult(_0x166352,null))['catch'](handleError(_0x166352,null));};exports[_0xb23d('0x2c')]=function(_0x3f2460,_0x158f13,_0xff9f92){if(_0x3f2460[_0xb23d('0x5b')]['id']){delete _0x3f2460[_0xb23d('0x5b')]['id'];}var _0x333d45;return db['SmsMessage'][_0xb23d('0x5c')]({'where':{'id':_0x3f2460[_0xb23d('0x58')]['id']}})[_0xb23d('0x21')](handleEntityNotFound(_0x158f13,null))[_0xb23d('0x21')](function(_0x43f285){if(_0x43f285){_0x333d45=_0x43f285;return db[_0xb23d('0x85')][_0xb23d('0x5c')]({'where':{'id':_0x43f285[_0xb23d('0x86')]}});}})[_0xb23d('0x21')](handleEntityNotFound(_0x158f13,null))[_0xb23d('0x21')](function(_0x352816){if(_0x352816){logger[_0xb23d('0x24')](_0xb23d('0x87'),_0xb23d('0x2c'),_0xb23d('0x88'),_0x352816[_0xb23d('0x41')],util['inspect'](_0x3f2460[_0xb23d('0x5b')],{'showHidden':![],'depth':null}));switch(_0x352816[_0xb23d('0x41')]){case'twilio':if(_0x3f2460[_0xb23d('0x5b')][_0xb23d('0x89')]&&_0x3f2460['body']['MessageSid']===_0x333d45['messageId']){return _0x333d45[_0xb23d('0x37')]({'read':!![]});}else{logger[_0xb23d('0x27')](_0xb23d('0x8a'),'status',_0xb23d('0x8b'),util[_0xb23d('0x8c')](_0x3f2460['body'],{'showHidden':![],'depth':null}));}break;case _0xb23d('0x8d'):if(_0x3f2460['body'][_0xb23d('0x8e')]&&_0x3f2460[_0xb23d('0x5b')][_0xb23d('0x8e')]===_0x333d45[_0xb23d('0x8f')]&&_[_0xb23d('0x90')]([_0xb23d('0x91'),_0xb23d('0x92')],_0x3f2460['body'][_0xb23d('0x93')])>=0x0){return _0x333d45['update']({'read':!![]});}else{logger[_0xb23d('0x27')](_0xb23d('0x8a'),'status',_0xb23d('0x94'),util[_0xb23d('0x8c')](_0x3f2460[_0xb23d('0x5b')],{'showHidden':![],'depth':null}));}break;case _0xb23d('0x95'):var _0xae9265=_0x3f2460[_0xb23d('0x5b')]['results'][0x0];if(_0xae9265[_0xb23d('0x2c')]['groupName']===_0xb23d('0x96')){return _0x333d45[_0xb23d('0x37')]({'read':!![]});}else{logger['error'](_0xb23d('0x8a'),_0xb23d('0x2c'),_0xb23d('0x95'),util[_0xb23d('0x8c')](_0x3f2460[_0xb23d('0x5b')],{'showHidden':![],'depth':null}));}break;}return _0x333d45;}})[_0xb23d('0x21')](respondWithResult(_0x158f13,null))[_0xb23d('0x56')](handleError(_0x158f13,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index 19427b2..db8b26a 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 _0x3888=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','SmsMessage','setMaxListeners','save','update'];(function(_0x35fc6a,_0xd05315){var _0x4a2f4b=function(_0x4a86a7){while(--_0x4a86a7){_0x35fc6a['push'](_0x35fc6a['shift']());}};_0x4a2f4b(++_0xd05315);}(_0x3888,0x11c));var _0x8388=function(_0xd58823,_0x15c483){_0xd58823=_0xd58823-0x0;var _0x249c0a=_0x3888[_0xd58823];return _0x249c0a;};'use strict';var EventEmitter=require(_0x8388('0x0'));var SmsMessage=require(_0x8388('0x1'))['db'][_0x8388('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x8388('0x3')](0x0);var events={'afterCreate':_0x8388('0x4'),'afterUpdate':_0x8388('0x5'),'afterDestroy':'remove'};function emitEvent(_0x58c76e){return function(_0x24b14a,_0x1ddf44,_0x254461){SmsMessageEvents['emit'](_0x58c76e+':'+_0x24b14a['id'],_0x24b14a);SmsMessageEvents[_0x8388('0x6')](_0x58c76e,_0x24b14a);_0x254461(null);};}for(var e in events){if(events[_0x8388('0x7')](e)){var event=events[e];SmsMessage[_0x8388('0x8')](e,emitEvent(event));}}module[_0x8388('0x9')]=SmsMessageEvents; \ No newline at end of file +var _0x16aa=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','../../mysqldb','SmsMessage'];(function(_0x23e908,_0x1a14ef){var _0x50c441=function(_0x1de759){while(--_0x1de759){_0x23e908['push'](_0x23e908['shift']());}};_0x50c441(++_0x1a14ef);}(_0x16aa,0x15d));var _0xa16a=function(_0x32ebbb,_0x2c3715){_0x32ebbb=_0x32ebbb-0x0;var _0x12ccae=_0x16aa[_0x32ebbb];return _0x12ccae;};'use strict';var EventEmitter=require('events');var SmsMessage=require(_0xa16a('0x0'))['db'][_0xa16a('0x1')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0xa16a('0x2')](0x0);var events={'afterCreate':_0xa16a('0x3'),'afterUpdate':_0xa16a('0x4'),'afterDestroy':_0xa16a('0x5')};function emitEvent(_0x4d9991){return function(_0x4feb1e,_0x33fb28,_0x55fcde){SmsMessageEvents[_0xa16a('0x6')](_0x4d9991+':'+_0x4feb1e['id'],_0x4feb1e);SmsMessageEvents[_0xa16a('0x6')](_0x4d9991,_0x4feb1e);_0x55fcde(null);};}for(var e in events){if(events[_0xa16a('0x7')](e)){var event=events[e];SmsMessage[_0xa16a('0x8')](e,emitEvent(event));}}module['exports']=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index c3f7433..2463c3d 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 _0x095a=['password','smsMethod','sender','login?username=','username','GET','split','sms','total_sent','internal_order_id','deliveryReport','skebby','inspect','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','requestid','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','format','%s:%s','POST','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','http_code','data','head','message_id','read','clickSend','Missing\x20parameters:\x20username,\x20password','plivo','authId','/api/sms/messages/','token','https://api.plivo.com/v1/Account/%s/Message/','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/sms/2/text/advanced','application/json','IBSSO\x20','Missing\x20parameters:\x20base_url','csc','crypto','login','text','timestamp','keys','sort','length','apiKey','md5','digest','hex','signature=','id_sms','Missing\x20parameters:\x20apiKey','clickatell','uuid','bandwidth','accountId','base64','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','status','refid','Token\x20not\x20received','utf8mb4','utf8mb4_unicode_ci','util','api','moment','bluebird','request-promise','path','rimraf','./smsMessage.attributes','exports','define','SmsMessage','messageId','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','SmsInteractionId','SmsInteraction','findOne','then','update','catch','error','SmsAccount','find','SmsAccountId','type','twilio','accountSid','authToken','messages','phone','remote','/status?token=','sid','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','https://api.skebby.it/API/v1.0/REST/'];(function(_0x40beba,_0xbb8fef){var _0x54e971=function(_0x3a0d63){while(--_0x3a0d63){_0x40beba['push'](_0x40beba['shift']());}};_0x54e971(++_0xbb8fef);}(_0x095a,0xc6));var _0xa095=function(_0x35b77e,_0x25d76a){_0x35b77e=_0x35b77e-0x0;var _0xb5b2b2=_0x095a[_0x35b77e];return _0xb5b2b2;};'use strict';var _=require('lodash');var util=require(_0xa095('0x0'));var logger=require('../../config/logger')(_0xa095('0x1'));var moment=require(_0xa095('0x2'));var BPromise=require(_0xa095('0x3'));var rp=require(_0xa095('0x4'));var fs=require('fs');var path=require(_0xa095('0x5'));var rimraf=require(_0xa095('0x6'));var config=require('../../config/environment');var attributes=require(_0xa095('0x7'));module[_0xa095('0x8')]=function(_0x3f70b0,_0x4312ea){return _0x3f70b0[_0xa095('0x9')](_0xa095('0xa'),attributes,{'tableName':'sms_messages','paranoid':![],'indexes':[{'name':_0xa095('0xb'),'fields':[_0xa095('0xb')]},{'name':'fti_sms_messages','fields':[_0xa095('0xc')],'type':_0xa095('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3d7fab,_0x16e9f1,_0x19a491){var _0x122320=_0x3f70b0[_0xa095('0xe')];var _0x5d9249=_0x3d7fab[_0xa095('0xf')]({'plain':!![]});if(_0x5d9249[_0xa095('0x10')][_0xa095('0x11')]()==='in'||_0x5d9249[_0xa095('0x10')]['toLowerCase']()===_0xa095('0x12')&&!_0x5d9249[_0xa095('0x13')]&&!_[_0xa095('0x14')](_0x5d9249[_0xa095('0x15')])&&!_['isNil'](_0x5d9249[_0xa095('0x16')])){_0x122320[_0xa095('0x17')][_0xa095('0x18')]({'where':{'id':_0x5d9249[_0xa095('0x16')]}})[_0xa095('0x19')](function(_0x4fa331){if(_0x4fa331){_0x4fa331[_0xa095('0x1a')]({'lastMsgAt':_0x5d9249['createdAt'],'lastMsgDirection':_0x5d9249[_0xa095('0x10')][_0xa095('0x11')]()});}})[_0xa095('0x1b')](function(_0x2f5536){console[_0xa095('0x1c')](_0x2f5536);});}if(_0x5d9249['direction']==='out'&&!_0x5d9249[_0xa095('0x13')]){var _0x3e99fa;_0x122320[_0xa095('0x1d')][_0xa095('0x1e')]({'where':{'id':_0x5d9249[_0xa095('0x1f')]},'raw':!![]})[_0xa095('0x19')](function(_0x18220a){_0x3e99fa=_0x18220a;if(_0x3e99fa&&_0x3e99fa[_0xa095('0x20')]){switch(_0x3e99fa['type']){case _0xa095('0x21'):var _0x312b2d=require(_0xa095('0x21'));if(_0x3e99fa[_0xa095('0x22')]&&_0x3e99fa[_0xa095('0x23')]&&_0x3e99fa['phone']){var _0x1f5c66=new _0x312b2d(_0x3e99fa['accountSid'],_0x3e99fa['authToken']);_0x1f5c66[_0xa095('0x24')]['create']({'body':_0x5d9249[_0xa095('0xc')],'to':_0x5d9249[_0xa095('0x25')],'from':_0x3e99fa[_0xa095('0x25')],'statusCallback':_0x3e99fa[_0xa095('0x26')]+'/api/sms/messages/'+_0x5d9249['id']+_0xa095('0x27')+_0x3e99fa['token']})[_0xa095('0x19')](function(_0x54c4dc){if(_0x54c4dc[_0xa095('0x28')]){return _0x3d7fab['update']({'messageId':_0x54c4dc[_0xa095('0x28')]});}})[_0xa095('0x1b')](function(_0x26a14b){logger[_0xa095('0x1c')](_0xa095('0x29'),_0xa095('0x2a'),'twilio',util['inspect'](_0x26a14b,{'showHidden':![],'depth':null}));});}else{logger[_0xa095('0x1c')](_0xa095('0x29'),'afterCreate',_0xa095('0x21'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case'skebby':var _0x161ada=_0xa095('0x2b');if(_0x3e99fa['username']&&_0x3e99fa[_0xa095('0x2c')]){var _0x508b21={'recipient':[_0x5d9249[_0xa095('0x25')]],'message':_0x5d9249[_0xa095('0xc')],'message_type':_0x3e99fa[_0xa095('0x2d')]};if(_0x3e99fa[_0xa095('0x2d')]&&_0x3e99fa[_0xa095('0x2d')]!=='SI'){_0x508b21[_0xa095('0x2e')]=_0x3e99fa[_0xa095('0x25')];}var _0x3c7557={'url':_0x161ada+_0xa095('0x2f')+_0x3e99fa[_0xa095('0x30')]+'&password='+_0x3e99fa[_0xa095('0x2c')],'method':_0xa095('0x31')};rp(_0x3c7557)['then'](function(_0x506914){var _0x493d0a=_0x506914[_0xa095('0x32')](';');var _0x56e10f={'user_key':_0x493d0a[0x0],'session_key':_0x493d0a[0x1]};_0x3c7557={'url':_0x161ada+_0xa095('0x33'),'method':'POST','headers':{'user_key':_0x56e10f['user_key'],'Session_key':_0x56e10f['session_key']},'json':!![],'body':_0x508b21};return rp(_0x3c7557);})[_0xa095('0x19')](function(_0x573191){if(_0x573191[_0xa095('0x34')]>=0x1){var _0x2eee74={'messageId':_0x573191[_0xa095('0x35')]};if(_0x3e99fa[_0xa095('0x2d')]!=='GP'||!_0x3e99fa[_0xa095('0x36')]){_0x2eee74['read']=!![];}return _0x3d7fab[_0xa095('0x1a')](_0x2eee74);}else{return logger[_0xa095('0x1c')](_0xa095('0x29'),'afterCreate',_0xa095('0x37'),util['inspect'](_0x573191,{'showHidden':![],'depth':null}));}})['catch'](function(_0x2da8c0){return logger['error'](_0xa095('0x29'),'afterCreate',_0xa095('0x37'),util[_0xa095('0x38')](_0x2da8c0,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xa095('0x2a'),'skebby','Missing\x20parameters:\x20username,\x20password');}break;case _0xa095('0x39'):if(_0x3e99fa[_0xa095('0x23')]){var _0x529e2a={'recipient':_0x5d9249[_0xa095('0x25')],'message':_0x5d9249[_0xa095('0xc')],'sender':_0x3e99fa[_0xa095('0x3a')]||_0x3e99fa['phone'],'authorization':_0x3e99fa['authToken']};var _0x16e9f1={'method':'POST','uri':_0xa095('0x3b'),'body':_0x529e2a,'json':!![]};rp(_0x16e9f1)[_0xa095('0x19')](function(_0x489ce3){var _0x434acc={'messageId':_0x489ce3[_0xa095('0x3c')]};if(!_0x3e99fa[_0xa095('0x36')]){_0x434acc['read']=!![];}return _0x3d7fab[_0xa095('0x1a')](_0x434acc);})[_0xa095('0x1b')](function(_0x5afb73){logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xa095('0x2a'),'connectel',util['inspect'](_0x5afb73,{'showHidden':![],'depth':null}));});}else{logger[_0xa095('0x1c')](_0xa095('0x29'),_0xa095('0x2a'),_0xa095('0x39'),_0xa095('0x3d'));}break;case _0xa095('0x3e'):if(_0x3e99fa[_0xa095('0x30')]&&_0x3e99fa[_0xa095('0x2c')]){var _0x529e2a={'messages':[{'source':_0xa095('0x3f'),'to':_0x5d9249[_0xa095('0x25')],'body':_0x5d9249[_0xa095('0xc')],'from':_0x3e99fa[_0xa095('0x3a')]||_0x3e99fa[_0xa095('0x25')]}]};var _0x577bab=util[_0xa095('0x40')](_0xa095('0x41'),_0x3e99fa['username'],_0x3e99fa[_0xa095('0x2c')]);var _0x16e9f1={'method':_0xa095('0x42'),'uri':_0xa095('0x43'),'body':_0x529e2a,'headers':{'Authorization':util[_0xa095('0x40')](_0xa095('0x44'),new Buffer(_0x577bab)[_0xa095('0x45')]('base64'))},'json':!![]};rp(_0x16e9f1)['then'](function(_0x5ea149){if(_0x5ea149[_0xa095('0x46')]>=0xc8&&_0x5ea149['http_code']<=0xce){if(_0x5ea149[_0xa095('0x47')]&&_0x5ea149['data']['queued_count']>0x0){var _0x53462d=_[_0xa095('0x48')](_0x5ea149[_0xa095('0x47')][_0xa095('0x24')]);var _0x264846={'messageId':_0x53462d[_0xa095('0x49')]};if(!_0x3e99fa[_0xa095('0x36')]){_0x264846[_0xa095('0x4a')]=!![];}return _0x3d7fab[_0xa095('0x1a')](_0x264846);}else{logger[_0xa095('0x1c')](_0xa095('0x29'),'afterCreate','clickSend',util[_0xa095('0x38')](_0x5ea149,{'showHidden':![],'depth':null}));}}else{logger[_0xa095('0x1c')](_0xa095('0x29'),_0xa095('0x2a'),_0xa095('0x4b'),util[_0xa095('0x38')](_0x5ea149,{'showHidden':![],'depth':null}));}})['catch'](function(_0x3b372d){logger[_0xa095('0x1c')](_0xa095('0x29'),_0xa095('0x2a'),_0xa095('0x4b'),util[_0xa095('0x38')](_0x3b372d,{'showHidden':![],'depth':null}));});}else{logger[_0xa095('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xa095('0x2a'),_0xa095('0x4b'),_0xa095('0x4c'));}break;case _0xa095('0x4d'):if(_0x3e99fa[_0xa095('0x4e')]&&_0x3e99fa[_0xa095('0x23')]){var _0x529e2a={'dst':_0x5d9249[_0xa095('0x25')],'text':_0x5d9249['body'],'src':_0x3e99fa[_0xa095('0x3a')]||_0x3e99fa[_0xa095('0x25')],'url':_0x3e99fa['remote']+_0xa095('0x4f')+_0x5d9249['id']+'/status?token='+_0x3e99fa[_0xa095('0x50')]};var _0x577bab=util[_0xa095('0x40')](_0xa095('0x41'),_0x3e99fa[_0xa095('0x4e')],_0x3e99fa[_0xa095('0x23')]);var _0x16e9f1={'method':_0xa095('0x42'),'uri':util[_0xa095('0x40')](_0xa095('0x51'),_0x3e99fa['authId']),'body':_0x529e2a,'headers':{'Authorization':util[_0xa095('0x40')](_0xa095('0x44'),new Buffer(_0x577bab)[_0xa095('0x45')]('base64'))},'json':!![]};rp(_0x16e9f1)['then'](function(_0x2d46f6){var _0x48fc6c={'messageId':_0x2d46f6[_0xa095('0x52')][0x0]};return _0x3d7fab['update'](_0x48fc6c);})[_0xa095('0x1b')](function(_0x2670aa){logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xa095('0x2a'),_0xa095('0x4d'),util['inspect'](_0x2670aa,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xa095('0x29'),_0xa095('0x2a'),_0xa095('0x4d'),_0xa095('0x53'));}break;case _0xa095('0x54'):if(_0x3e99fa[_0xa095('0x30')]&&_0x3e99fa[_0xa095('0x2c')]){if(_0x3e99fa[_0xa095('0x55')]){var _0x3b85d0={'method':'POST','uri':_0x3e99fa[_0xa095('0x55')]+'/auth/1/session','body':{'username':_0x3e99fa[_0xa095('0x30')],'password':_0x3e99fa[_0xa095('0x2c')]},'json':!![]};return rp(_0x3b85d0)['then'](function(_0xb7bcf8){var _0x584ba6={'method':_0xa095('0x42'),'uri':_0x3e99fa[_0xa095('0x55')]+_0xa095('0x56'),'body':{'messages':[{'from':_0x3e99fa[_0xa095('0x25')],'destinations':[{'to':_0x5d9249[_0xa095('0x25')]}],'text':_0x5d9249[_0xa095('0xc')],'notifyUrl':_0x3e99fa[_0xa095('0x26')]+_0xa095('0x4f')+_0x5d9249['id']+_0xa095('0x27')+_0x3e99fa[_0xa095('0x50')],'notifyContentType':_0xa095('0x57'),'callbackData':_0x3e99fa[_0xa095('0x25')]+';'+_0x5d9249[_0xa095('0xc')]}]},'headers':{'Authorization':_0xa095('0x58')+_0xb7bcf8[_0xa095('0x50')]},'json':!![]};return rp(_0x584ba6)[_0xa095('0x19')](function(_0x397454){if(_0x397454[_0xa095('0x24')]){var _0x2c8814={'messageId':_0x397454[_0xa095('0x24')][0x0][_0xa095('0xb')]};if(!_0x3e99fa[_0xa095('0x36')]){_0x2c8814['read']=!![];}return _0x3d7fab[_0xa095('0x1a')](_0x2c8814);}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xa095('0x54'),util[_0xa095('0x38')](_0x397454,{'showHidden':![],'depth':null}));}});})[_0xa095('0x1b')](function(_0x305a0e){return logger[_0xa095('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xa095('0x2a'),_0xa095('0x54'),util['inspect'](_0x305a0e,{'showHidden':![],'depth':null}));});}else{logger[_0xa095('0x1c')](_0xa095('0x29'),_0xa095('0x2a'),_0xa095('0x54'),_0xa095('0x59'));}}else{logger[_0xa095('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xa095('0x2a'),_0xa095('0x54'),'Missing\x20parameters:\x20username,\x20password');}break;case _0xa095('0x5a'):var _0x9a1941=require(_0xa095('0x5b'));if(_0x3e99fa['apiKey']){var _0xeebe0b={};_0xeebe0b[_0xa095('0x5c')]=_0x3e99fa[_0xa095('0x30')];_0xeebe0b[_0xa095('0x25')]=_0x5d9249[_0xa095('0x25')];_0xeebe0b[_0xa095('0x2e')]=_0x3e99fa['phone'];_0xeebe0b[_0xa095('0x5d')]=_0x5d9249[_0xa095('0xc')];_0xeebe0b[_0xa095('0x5e')]=+new Date();var _0x2d392c='';var _0x5de608='';var _0x2c6a4e=Object[_0xa095('0x5f')](_0xeebe0b);_0x2c6a4e[_0xa095('0x60')]();for(var _0xe6d9af=0x0;_0xe6d9af<_0x2c6a4e[_0xa095('0x61')];_0xe6d9af++){if(_0x2d392c!=''){_0x2d392c+='&';}_0x2d392c+=_0x2c6a4e[_0xe6d9af]+'='+encodeURIComponent(_0xeebe0b[_0x2c6a4e[_0xe6d9af]]);_0x5de608+=_0xeebe0b[_0x2c6a4e[_0xe6d9af]];}_0x5de608+=_0x3e99fa[_0xa095('0x62')];_0x5de608=_0x9a1941['createHash'](_0xa095('0x63'))[_0xa095('0x1a')](_0x5de608)[_0xa095('0x64')](_0xa095('0x65'));if(_0x2d392c!==''){_0x2d392c+='&';}_0x2d392c+=_0xa095('0x66')+_0x5de608;var _0x3c7557={'method':'GET','uri':_0x3e99fa[_0xa095('0x55')]+'/external/get/send.php?'+_0x2d392c,'json':!![]};return rp(_0x3c7557)[_0xa095('0x19')](function(_0x43c5fb){var _0x48f863=Object[_0xa095('0x5f')](_0x43c5fb);if(_0x43c5fb[_0x48f863[0x0]][_0xa095('0x1c')]&&parseInt(_0x43c5fb[_0x48f863[0x0]]['error'])===0x0){var _0x51c7c5={'messageId':_0x43c5fb[_0x48f863[0x0]][_0xa095('0x67')]};if(!_0x3e99fa['deliveryReport']){_0x51c7c5[_0xa095('0x4a')]=!![];}return _0x3d7fab[_0xa095('0x1a')](_0x51c7c5);}else{return logger[_0xa095('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xa095('0x5a'),util[_0xa095('0x38')](_0x43c5fb['error'],{'showHidden':![],'depth':null}));}})['catch'](function(_0x1d225f){return logger[_0xa095('0x1c')](_0xa095('0x29'),'afterCreate',_0xa095('0x5a'),util[_0xa095('0x38')](_0x1d225f,{'showHidden':![],'depth':null}));});}else{logger[_0xa095('0x1c')](_0xa095('0x29'),_0xa095('0x2a'),_0xa095('0x5a'),_0xa095('0x68'));}break;case _0xa095('0x69'):if(_0x3e99fa[_0xa095('0x62')]){var _0x47bc42={'method':_0xa095('0x42'),'uri':'https://platform.clickatell.com/messages','headers':{'Authorization':_0x3e99fa[_0xa095('0x62')]},'body':{'content':_0x5d9249[_0xa095('0xc')],'to':[_0x5d9249[_0xa095('0x25')]],'from':_0x3e99fa['phone'],'binary':![],'clientMessageId':_0xa095('0x6a'),'charset':'UTF-8'},'json':!![]};rp(_0x47bc42)[_0xa095('0x19')](function(_0x35fb48){if(!_0x35fb48[_0xa095('0x1c')]){var _0x3eefc7={'messageId':_0x35fb48['messages'][0x0]['apiMessageId']};if(!_0x3e99fa[_0xa095('0x36')]){_0x3eefc7[_0xa095('0x4a')]=!![];}return _0x3d7fab['update'](_0x3eefc7);}else{return logger[_0xa095('0x1c')](_0xa095('0x29'),'afterCreate',_0xa095('0x69'),util[_0xa095('0x38')](_0x35fb48[_0xa095('0x1c')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x4343f8){return logger['error'](_0xa095('0x29'),_0xa095('0x2a'),_0xa095('0x69'),util['inspect'](_0x4343f8,{'showHidden':![],'depth':null}));});}else{logger[_0xa095('0x1c')](_0xa095('0x29'),'afterCreate','clickatell',_0xa095('0x68'));}break;case _0xa095('0x6b'):if(_0x3e99fa[_0xa095('0x30')]&&_0x3e99fa[_0xa095('0x2c')]){var _0x577bab=util['format'](_0xa095('0x41'),_0x3e99fa[_0xa095('0x30')],_0x3e99fa[_0xa095('0x2c')]);var _0x16e9f1={'method':_0xa095('0x42'),'uri':'https://messaging.bandwidth.com/api/v2/users/'+_0x3e99fa[_0xa095('0x6c')]+'/messages','body':{'to':[_0x5d9249[_0xa095('0x25')]],'text':_0x5d9249[_0xa095('0xc')],'from':_0x3e99fa['phone'],'applicationId':_0x3e99fa['applicationId']},'headers':{'Authorization':util['format']('Basic\x20%s',new Buffer(_0x577bab)['toString'](_0xa095('0x6d')))},'json':!![]};rp(_0x16e9f1)[_0xa095('0x19')](function(_0x29860c){if(_0x29860c['id']){var _0x4d897b={'messageId':_0x29860c['id']};return _0x3d7fab[_0xa095('0x1a')](_0x4d897b);}else{logger[_0xa095('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xa095('0x2a'),_0xa095('0x6b'),util[_0xa095('0x38')](_0x29860c,{'showHidden':![],'depth':null}));}})['catch'](function(_0x521ab7){logger['error'](_0xa095('0x29'),_0xa095('0x2a'),_0xa095('0x6b'),util['inspect'](_0x521ab7,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xa095('0x29'),_0xa095('0x2a'),'bandwidth','Missing\x20parameters:\x20username,\x20password');}break;case _0xa095('0x6e'):if(_0x3e99fa[_0xa095('0x62')]){var _0x4f3694={};var _0x3c7557={'method':'POST','uri':_0xa095('0x6f'),'headers':{'Authorization':_0xa095('0x70')+_0x3e99fa[_0xa095('0x62')],'Content-Type':'application/json'},'body':{'from':_0x3e99fa[_0xa095('0x25')],'to':_0x5d9249['phone'],'text':_0x5d9249[_0xa095('0xc')]},'json':!![]};return rp(_0x3c7557)[_0xa095('0x19')](function(_0x43d7df){if(_0x43d7df[_0xa095('0x71')]==0xca){_0x4f3694[_0xa095('0x72')]=_0x43d7df;var _0x206bd9={'method':_0xa095('0x42'),'uri':_0xa095('0x73'),'headers':{'Authorization':_0xa095('0x70')+_0x3e99fa[_0xa095('0x62')],'Content-Type':'application/json'},'body':{'refid':_0x4f3694[_0xa095('0x72')]['refid']},'json':!![]};return rp(_0x206bd9)[_0xa095('0x19')](function(_0x4a0fbf){_0x4f3694[_0xa095('0x74')]=_0x4a0fbf;var _0x3ec43a={'messageId':_0x4f3694[_0xa095('0x72')][_0xa095('0x75')],'read':!![]};return _0x3d7fab[_0xa095('0x1a')](_0x3ec43a);});}else{return logger[_0xa095('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xa095('0x2a'),_0xa095('0x6e'),util[_0xa095('0x38')](_0x43d7df,{'showHidden':![],'depth':null}));}})[_0xa095('0x1b')](function(_0x51f79c){return logger[_0xa095('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xa095('0x6e'),util[_0xa095('0x38')](_0x51f79c,{'showHidden':![],'depth':null}));});}else{return logger['error'](_0xa095('0x29'),_0xa095('0x2a'),_0xa095('0x6e'),_0xa095('0x76'));}break;}}})['finally'](function(){_0x19a491();});}else{_0x19a491();}}},'charset':_0xa095('0x77'),'collate':_0xa095('0x78')});}; \ No newline at end of file +var _0x01ae=['twilio','accountSid','authToken','phone','messages','create','remote','/api/sms/messages/','/status?token=','token','sid','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','&password=','GET','sms','POST','user_key','session_key','total_sent','internal_order_id','deliveryReport','read','senderString','https://smsapi.connectel.se/api/v2/send/','connectel','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','format','%s:%s','https://rest.clicksend.com/v3/sms/send','toString','base64','http_code','head','message_id','clickSend','Missing\x20parameters:\x20username,\x20password','plivo','authId','Basic\x20%s','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','IBSSO\x20','csc','crypto','apiKey','sender','text','timestamp','keys','sort','createHash','md5','digest','hex','/external/get/send.php?','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','uuid','UTF-8','apiMessageId','/messages','applicationId','bandwidth','https://api.intelepeer.com/_rest/v4/app/sms/send','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','Bearer\x20','status','refid','intelepeer','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','../../config/logger','api','moment','bluebird','request-promise','path','exports','define','sms_messages','messageId','fti_sms_messages','body','FULLTEXT','models','get','direction','toLowerCase','isNil','UserId','SmsInteractionId','SmsInteraction','findOne','then','update','createdAt','catch','error','secret','SmsAccount','find','SmsAccountId','type'];(function(_0x435044,_0x36ab8e){var _0x33d4c6=function(_0x15efa0){while(--_0x15efa0){_0x435044['push'](_0x435044['shift']());}};_0x33d4c6(++_0x36ab8e);}(_0x01ae,0xd2));var _0xe01a=function(_0xb7a459,_0xc13228){_0xb7a459=_0xb7a459-0x0;var _0x104ab5=_0x01ae[_0xb7a459];return _0x104ab5;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe01a('0x0'))(_0xe01a('0x1'));var moment=require(_0xe01a('0x2'));var BPromise=require(_0xe01a('0x3'));var rp=require(_0xe01a('0x4'));var fs=require('fs');var path=require(_0xe01a('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./smsMessage.attributes');module[_0xe01a('0x6')]=function(_0x48cff0,_0x514e89){return _0x48cff0[_0xe01a('0x7')]('SmsMessage',attributes,{'tableName':_0xe01a('0x8'),'paranoid':![],'indexes':[{'name':_0xe01a('0x9'),'fields':[_0xe01a('0x9')]},{'name':_0xe01a('0xa'),'fields':[_0xe01a('0xb')],'type':_0xe01a('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x41025b,_0x1d2e26,_0x2fbb52){var _0x5313c3=_0x48cff0[_0xe01a('0xd')];var _0x4e4a35=_0x41025b[_0xe01a('0xe')]({'plain':!![]});if(_0x4e4a35[_0xe01a('0xf')][_0xe01a('0x10')]()==='in'||_0x4e4a35[_0xe01a('0xf')][_0xe01a('0x10')]()==='out'&&!_0x4e4a35['secret']&&!_[_0xe01a('0x11')](_0x4e4a35[_0xe01a('0x12')])&&!_[_0xe01a('0x11')](_0x4e4a35[_0xe01a('0x13')])){_0x5313c3[_0xe01a('0x14')][_0xe01a('0x15')]({'where':{'id':_0x4e4a35['SmsInteractionId']}})[_0xe01a('0x16')](function(_0x5a907f){if(_0x5a907f){_0x5a907f[_0xe01a('0x17')]({'lastMsgAt':_0x4e4a35[_0xe01a('0x18')],'lastMsgDirection':_0x4e4a35[_0xe01a('0xf')]['toLowerCase']()});}})[_0xe01a('0x19')](function(_0x57b2a3){console[_0xe01a('0x1a')](_0x57b2a3);});}if(_0x4e4a35[_0xe01a('0xf')]==='out'&&!_0x4e4a35[_0xe01a('0x1b')]){var _0x17fd36;_0x5313c3[_0xe01a('0x1c')][_0xe01a('0x1d')]({'where':{'id':_0x4e4a35[_0xe01a('0x1e')]},'raw':!![]})['then'](function(_0x410f2d){_0x17fd36=_0x410f2d;if(_0x17fd36&&_0x17fd36[_0xe01a('0x1f')]){switch(_0x17fd36[_0xe01a('0x1f')]){case _0xe01a('0x20'):var _0x1534ab=require(_0xe01a('0x20'));if(_0x17fd36[_0xe01a('0x21')]&&_0x17fd36[_0xe01a('0x22')]&&_0x17fd36[_0xe01a('0x23')]){var _0x5c22c8=new _0x1534ab(_0x17fd36[_0xe01a('0x21')],_0x17fd36[_0xe01a('0x22')]);_0x5c22c8[_0xe01a('0x24')][_0xe01a('0x25')]({'body':_0x4e4a35[_0xe01a('0xb')],'to':_0x4e4a35[_0xe01a('0x23')],'from':_0x17fd36[_0xe01a('0x23')],'statusCallback':_0x17fd36[_0xe01a('0x26')]+_0xe01a('0x27')+_0x4e4a35['id']+_0xe01a('0x28')+_0x17fd36[_0xe01a('0x29')]})[_0xe01a('0x16')](function(_0x3339a9){if(_0x3339a9[_0xe01a('0x2a')]){return _0x41025b['update']({'messageId':_0x3339a9[_0xe01a('0x2a')]});}})['catch'](function(_0x4434e8){logger[_0xe01a('0x1a')](_0xe01a('0x2b'),_0xe01a('0x2c'),_0xe01a('0x20'),util[_0xe01a('0x2d')](_0x4434e8,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xe01a('0x2c'),_0xe01a('0x20'),_0xe01a('0x2e'));}break;case _0xe01a('0x2f'):var _0x433402=_0xe01a('0x30');if(_0x17fd36[_0xe01a('0x31')]&&_0x17fd36[_0xe01a('0x32')]){var _0x4db585={'recipient':[_0x4e4a35[_0xe01a('0x23')]],'message':_0x4e4a35[_0xe01a('0xb')],'message_type':_0x17fd36[_0xe01a('0x33')]};if(_0x17fd36[_0xe01a('0x33')]&&_0x17fd36[_0xe01a('0x33')]!=='SI'){_0x4db585['sender']=_0x17fd36[_0xe01a('0x23')];}var _0x3b45cf={'url':_0x433402+'login?username='+_0x17fd36[_0xe01a('0x31')]+_0xe01a('0x34')+_0x17fd36[_0xe01a('0x32')],'method':_0xe01a('0x35')};rp(_0x3b45cf)[_0xe01a('0x16')](function(_0x47ec43){var _0x3af844=_0x47ec43['split'](';');var _0x425694={'user_key':_0x3af844[0x0],'session_key':_0x3af844[0x1]};_0x3b45cf={'url':_0x433402+_0xe01a('0x36'),'method':_0xe01a('0x37'),'headers':{'user_key':_0x425694[_0xe01a('0x38')],'Session_key':_0x425694[_0xe01a('0x39')]},'json':!![],'body':_0x4db585};return rp(_0x3b45cf);})['then'](function(_0x78364f){if(_0x78364f[_0xe01a('0x3a')]>=0x1){var _0x252237={'messageId':_0x78364f[_0xe01a('0x3b')]};if(_0x17fd36[_0xe01a('0x33')]!=='GP'||!_0x17fd36[_0xe01a('0x3c')]){_0x252237[_0xe01a('0x3d')]=!![];}return _0x41025b[_0xe01a('0x17')](_0x252237);}else{return logger[_0xe01a('0x1a')](_0xe01a('0x2b'),_0xe01a('0x2c'),_0xe01a('0x2f'),util[_0xe01a('0x2d')](_0x78364f,{'showHidden':![],'depth':null}));}})[_0xe01a('0x19')](function(_0x5117da){return logger[_0xe01a('0x1a')](_0xe01a('0x2b'),_0xe01a('0x2c'),_0xe01a('0x2f'),util[_0xe01a('0x2d')](_0x5117da,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xe01a('0x2b'),_0xe01a('0x2c'),_0xe01a('0x2f'),'Missing\x20parameters:\x20username,\x20password');}break;case'connectel':if(_0x17fd36[_0xe01a('0x22')]){var _0x5ea5d0={'recipient':_0x4e4a35[_0xe01a('0x23')],'message':_0x4e4a35[_0xe01a('0xb')],'sender':_0x17fd36[_0xe01a('0x3e')]||_0x17fd36['phone'],'authorization':_0x17fd36[_0xe01a('0x22')]};var _0x1d2e26={'method':'POST','uri':_0xe01a('0x3f'),'body':_0x5ea5d0,'json':!![]};rp(_0x1d2e26)[_0xe01a('0x16')](function(_0x55fa80){var _0x8c3032={'messageId':_0x55fa80['requestid']};if(!_0x17fd36[_0xe01a('0x3c')]){_0x8c3032[_0xe01a('0x3d')]=!![];}return _0x41025b[_0xe01a('0x17')](_0x8c3032);})[_0xe01a('0x19')](function(_0x46210f){logger[_0xe01a('0x1a')](_0xe01a('0x2b'),_0xe01a('0x2c'),_0xe01a('0x40'),util['inspect'](_0x46210f,{'showHidden':![],'depth':null}));});}else{logger[_0xe01a('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xe01a('0x2c'),_0xe01a('0x40'),_0xe01a('0x41'));}break;case _0xe01a('0x42'):if(_0x17fd36[_0xe01a('0x31')]&&_0x17fd36[_0xe01a('0x32')]){var _0x5ea5d0={'messages':[{'source':_0xe01a('0x43'),'to':_0x4e4a35['phone'],'body':_0x4e4a35[_0xe01a('0xb')],'from':_0x17fd36[_0xe01a('0x3e')]||_0x17fd36[_0xe01a('0x23')]}]};var _0x3be297=util[_0xe01a('0x44')](_0xe01a('0x45'),_0x17fd36[_0xe01a('0x31')],_0x17fd36[_0xe01a('0x32')]);var _0x1d2e26={'method':'POST','uri':_0xe01a('0x46'),'body':_0x5ea5d0,'headers':{'Authorization':util[_0xe01a('0x44')]('Basic\x20%s',new Buffer(_0x3be297)[_0xe01a('0x47')](_0xe01a('0x48')))},'json':!![]};rp(_0x1d2e26)['then'](function(_0x5989b8){if(_0x5989b8[_0xe01a('0x49')]>=0xc8&&_0x5989b8[_0xe01a('0x49')]<=0xce){if(_0x5989b8['data']&&_0x5989b8['data']['queued_count']>0x0){var _0x268076=_[_0xe01a('0x4a')](_0x5989b8['data'][_0xe01a('0x24')]);var _0x14d70a={'messageId':_0x268076[_0xe01a('0x4b')]};if(!_0x17fd36['deliveryReport']){_0x14d70a['read']=!![];}return _0x41025b[_0xe01a('0x17')](_0x14d70a);}else{logger[_0xe01a('0x1a')](_0xe01a('0x2b'),'afterCreate',_0xe01a('0x4c'),util['inspect'](_0x5989b8,{'showHidden':![],'depth':null}));}}else{logger['error'](_0xe01a('0x2b'),_0xe01a('0x2c'),_0xe01a('0x4c'),util[_0xe01a('0x2d')](_0x5989b8,{'showHidden':![],'depth':null}));}})[_0xe01a('0x19')](function(_0x364fbe){logger[_0xe01a('0x1a')](_0xe01a('0x2b'),_0xe01a('0x2c'),_0xe01a('0x4c'),util[_0xe01a('0x2d')](_0x364fbe,{'showHidden':![],'depth':null}));});}else{logger[_0xe01a('0x1a')](_0xe01a('0x2b'),_0xe01a('0x2c'),_0xe01a('0x4c'),_0xe01a('0x4d'));}break;case _0xe01a('0x4e'):if(_0x17fd36['authId']&&_0x17fd36[_0xe01a('0x22')]){var _0x5ea5d0={'dst':_0x4e4a35['phone'],'text':_0x4e4a35[_0xe01a('0xb')],'src':_0x17fd36[_0xe01a('0x3e')]||_0x17fd36[_0xe01a('0x23')],'url':_0x17fd36[_0xe01a('0x26')]+_0xe01a('0x27')+_0x4e4a35['id']+_0xe01a('0x28')+_0x17fd36['token']};var _0x3be297=util[_0xe01a('0x44')](_0xe01a('0x45'),_0x17fd36[_0xe01a('0x4f')],_0x17fd36[_0xe01a('0x22')]);var _0x1d2e26={'method':_0xe01a('0x37'),'uri':util['format']('https://api.plivo.com/v1/Account/%s/Message/',_0x17fd36[_0xe01a('0x4f')]),'body':_0x5ea5d0,'headers':{'Authorization':util[_0xe01a('0x44')](_0xe01a('0x50'),new Buffer(_0x3be297)[_0xe01a('0x47')](_0xe01a('0x48')))},'json':!![]};rp(_0x1d2e26)[_0xe01a('0x16')](function(_0x3aceaa){var _0x433f44={'messageId':_0x3aceaa['message_uuid'][0x0]};return _0x41025b[_0xe01a('0x17')](_0x433f44);})[_0xe01a('0x19')](function(_0x55a84e){logger[_0xe01a('0x1a')](_0xe01a('0x2b'),_0xe01a('0x2c'),_0xe01a('0x4e'),util[_0xe01a('0x2d')](_0x55a84e,{'showHidden':![],'depth':null}));});}else{logger[_0xe01a('0x1a')](_0xe01a('0x2b'),_0xe01a('0x2c'),_0xe01a('0x4e'),'Missing\x20parameters:\x20authId,\x20authToken');}break;case _0xe01a('0x51'):if(_0x17fd36['username']&&_0x17fd36[_0xe01a('0x32')]){if(_0x17fd36['baseUrl']){var _0x502a57={'method':_0xe01a('0x37'),'uri':_0x17fd36[_0xe01a('0x52')]+_0xe01a('0x53'),'body':{'username':_0x17fd36['username'],'password':_0x17fd36[_0xe01a('0x32')]},'json':!![]};return rp(_0x502a57)[_0xe01a('0x16')](function(_0xa0bc98){var _0x337937={'method':_0xe01a('0x37'),'uri':_0x17fd36[_0xe01a('0x52')]+_0xe01a('0x54'),'body':{'messages':[{'from':_0x17fd36[_0xe01a('0x23')],'destinations':[{'to':_0x4e4a35[_0xe01a('0x23')]}],'text':_0x4e4a35[_0xe01a('0xb')],'notifyUrl':_0x17fd36['remote']+'/api/sms/messages/'+_0x4e4a35['id']+_0xe01a('0x28')+_0x17fd36[_0xe01a('0x29')],'notifyContentType':_0xe01a('0x55'),'callbackData':_0x17fd36[_0xe01a('0x23')]+';'+_0x4e4a35['body']}]},'headers':{'Authorization':_0xe01a('0x56')+_0xa0bc98[_0xe01a('0x29')]},'json':!![]};return rp(_0x337937)[_0xe01a('0x16')](function(_0xe21888){if(_0xe21888['messages']){var _0x2e5699={'messageId':_0xe21888[_0xe01a('0x24')][0x0][_0xe01a('0x9')]};if(!_0x17fd36[_0xe01a('0x3c')]){_0x2e5699[_0xe01a('0x3d')]=!![];}return _0x41025b['update'](_0x2e5699);}else{return logger[_0xe01a('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xe01a('0x2c'),_0xe01a('0x51'),util[_0xe01a('0x2d')](_0xe21888,{'showHidden':![],'depth':null}));}});})['catch'](function(_0x3f7b9b){return logger[_0xe01a('0x1a')](_0xe01a('0x2b'),'afterCreate',_0xe01a('0x51'),util[_0xe01a('0x2d')](_0x3f7b9b,{'showHidden':![],'depth':null}));});}else{logger[_0xe01a('0x1a')](_0xe01a('0x2b'),_0xe01a('0x2c'),_0xe01a('0x51'),'Missing\x20parameters:\x20base_url');}}else{logger[_0xe01a('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xe01a('0x2c'),_0xe01a('0x51'),_0xe01a('0x4d'));}break;case _0xe01a('0x57'):var _0x6815d8=require(_0xe01a('0x58'));if(_0x17fd36[_0xe01a('0x59')]){var _0x3d293b={};_0x3d293b['login']=_0x17fd36['username'];_0x3d293b['phone']=_0x4e4a35[_0xe01a('0x23')];_0x3d293b[_0xe01a('0x5a')]=_0x17fd36[_0xe01a('0x23')];_0x3d293b[_0xe01a('0x5b')]=_0x4e4a35[_0xe01a('0xb')];_0x3d293b[_0xe01a('0x5c')]=+new Date();var _0x244266='';var _0xb76d39='';var _0x51ca20=Object[_0xe01a('0x5d')](_0x3d293b);_0x51ca20[_0xe01a('0x5e')]();for(var _0x14d0c1=0x0;_0x14d0c1<_0x51ca20['length'];_0x14d0c1++){if(_0x244266!=''){_0x244266+='&';}_0x244266+=_0x51ca20[_0x14d0c1]+'='+encodeURIComponent(_0x3d293b[_0x51ca20[_0x14d0c1]]);_0xb76d39+=_0x3d293b[_0x51ca20[_0x14d0c1]];}_0xb76d39+=_0x17fd36[_0xe01a('0x59')];_0xb76d39=_0x6815d8[_0xe01a('0x5f')](_0xe01a('0x60'))['update'](_0xb76d39)[_0xe01a('0x61')](_0xe01a('0x62'));if(_0x244266!==''){_0x244266+='&';}_0x244266+='signature='+_0xb76d39;var _0x3b45cf={'method':_0xe01a('0x35'),'uri':_0x17fd36[_0xe01a('0x52')]+_0xe01a('0x63')+_0x244266,'json':!![]};return rp(_0x3b45cf)[_0xe01a('0x16')](function(_0x10301a){var _0x1c4167=Object[_0xe01a('0x5d')](_0x10301a);if(_0x10301a[_0x1c4167[0x0]][_0xe01a('0x1a')]&&parseInt(_0x10301a[_0x1c4167[0x0]][_0xe01a('0x1a')])===0x0){var _0x4a8884={'messageId':_0x10301a[_0x1c4167[0x0]]['id_sms']};if(!_0x17fd36[_0xe01a('0x3c')]){_0x4a8884['read']=!![];}return _0x41025b[_0xe01a('0x17')](_0x4a8884);}else{return logger[_0xe01a('0x1a')](_0xe01a('0x2b'),'afterCreate',_0xe01a('0x57'),util[_0xe01a('0x2d')](_0x10301a[_0xe01a('0x1a')],{'showHidden':![],'depth':null}));}})[_0xe01a('0x19')](function(_0xf9ee50){return logger[_0xe01a('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xe01a('0x2c'),'csc',util['inspect'](_0xf9ee50,{'showHidden':![],'depth':null}));});}else{logger[_0xe01a('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xe01a('0x2c'),_0xe01a('0x57'),_0xe01a('0x64'));}break;case _0xe01a('0x65'):if(_0x17fd36[_0xe01a('0x59')]){var _0x3f7e4c={'method':_0xe01a('0x37'),'uri':_0xe01a('0x66'),'headers':{'Authorization':_0x17fd36[_0xe01a('0x59')]},'body':{'content':_0x4e4a35[_0xe01a('0xb')],'to':[_0x4e4a35[_0xe01a('0x23')]],'from':_0x17fd36[_0xe01a('0x23')],'binary':![],'clientMessageId':_0xe01a('0x67'),'charset':_0xe01a('0x68')},'json':!![]};rp(_0x3f7e4c)[_0xe01a('0x16')](function(_0x6c9fe2){if(!_0x6c9fe2['error']){var _0x2ee07b={'messageId':_0x6c9fe2['messages'][0x0][_0xe01a('0x69')]};if(!_0x17fd36[_0xe01a('0x3c')]){_0x2ee07b[_0xe01a('0x3d')]=!![];}return _0x41025b[_0xe01a('0x17')](_0x2ee07b);}else{return logger['error'](_0xe01a('0x2b'),_0xe01a('0x2c'),_0xe01a('0x65'),util[_0xe01a('0x2d')](_0x6c9fe2['error'],{'showHidden':![],'depth':null}));}})['catch'](function(_0x5bece2){return logger[_0xe01a('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xe01a('0x65'),util[_0xe01a('0x2d')](_0x5bece2,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xe01a('0x2b'),_0xe01a('0x2c'),_0xe01a('0x65'),_0xe01a('0x64'));}break;case'bandwidth':if(_0x17fd36[_0xe01a('0x31')]&&_0x17fd36[_0xe01a('0x32')]){var _0x3be297=util[_0xe01a('0x44')](_0xe01a('0x45'),_0x17fd36[_0xe01a('0x31')],_0x17fd36[_0xe01a('0x32')]);var _0x1d2e26={'method':'POST','uri':'https://messaging.bandwidth.com/api/v2/users/'+_0x17fd36['accountId']+_0xe01a('0x6a'),'body':{'to':[_0x4e4a35[_0xe01a('0x23')]],'text':_0x4e4a35[_0xe01a('0xb')],'from':_0x17fd36[_0xe01a('0x23')],'applicationId':_0x17fd36[_0xe01a('0x6b')]},'headers':{'Authorization':util[_0xe01a('0x44')](_0xe01a('0x50'),new Buffer(_0x3be297)[_0xe01a('0x47')](_0xe01a('0x48')))},'json':!![]};rp(_0x1d2e26)[_0xe01a('0x16')](function(_0x475304){if(_0x475304['id']){var _0x130b87={'messageId':_0x475304['id']};return _0x41025b[_0xe01a('0x17')](_0x130b87);}else{logger['error'](_0xe01a('0x2b'),_0xe01a('0x2c'),_0xe01a('0x6c'),util['inspect'](_0x475304,{'showHidden':![],'depth':null}));}})['catch'](function(_0x42064d){logger['error'](_0xe01a('0x2b'),'afterCreate',_0xe01a('0x6c'),util[_0xe01a('0x2d')](_0x42064d,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xe01a('0x2b'),'afterCreate','bandwidth',_0xe01a('0x4d'));}break;case'intelepeer':if(_0x17fd36['apiKey']){var _0x26c3f6={};var _0x3b45cf={'method':'POST','uri':_0xe01a('0x6d'),'headers':{'Authorization':'Bearer\x20'+_0x17fd36[_0xe01a('0x59')],'Content-Type':'application/json'},'body':{'from':_0x17fd36[_0xe01a('0x23')],'to':_0x4e4a35[_0xe01a('0x23')],'text':_0x4e4a35[_0xe01a('0xb')]},'json':!![]};return rp(_0x3b45cf)['then'](function(_0x561070){if(_0x561070[_0xe01a('0x6e')]==0xca){_0x26c3f6[_0xe01a('0x6f')]=_0x561070;var _0x452add={'method':_0xe01a('0x37'),'uri':_0xe01a('0x70'),'headers':{'Authorization':_0xe01a('0x71')+_0x17fd36['apiKey'],'Content-Type':_0xe01a('0x55')},'body':{'refid':_0x26c3f6[_0xe01a('0x6f')]['refid']},'json':!![]};return rp(_0x452add)[_0xe01a('0x16')](function(_0x427f9d){_0x26c3f6[_0xe01a('0x72')]=_0x427f9d;var _0x54c30c={'messageId':_0x26c3f6['message'][_0xe01a('0x73')],'read':!![]};return _0x41025b['update'](_0x54c30c);});}else{return logger[_0xe01a('0x1a')](_0xe01a('0x2b'),'afterCreate',_0xe01a('0x74'),util[_0xe01a('0x2d')](_0x561070,{'showHidden':![],'depth':null}));}})[_0xe01a('0x19')](function(_0x290197){return logger[_0xe01a('0x1a')](_0xe01a('0x2b'),_0xe01a('0x2c'),_0xe01a('0x74'),util[_0xe01a('0x2d')](_0x290197,{'showHidden':![],'depth':null}));});}else{return logger[_0xe01a('0x1a')](_0xe01a('0x2b'),_0xe01a('0x2c'),_0xe01a('0x74'),_0xe01a('0x75'));}break;}}})[_0xe01a('0x76')](function(){_0x2fbb52();});}else{_0x2fbb52();}}},'charset':_0xe01a('0x77'),'collate':_0xe01a('0x78')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index a31ec18..a848f5d 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 _0x593b=['info','SmsMessage,\x20%s,\x20%s','debug','SmsMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateSmsMessage','SmsMessage','create','options','raw','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket','register','request','then'];(function(_0x3944b3,_0xf05375){var _0xbf7a53=function(_0x1c5aa2){while(--_0x1c5aa2){_0x3944b3['push'](_0x3944b3['shift']());}};_0xbf7a53(++_0xf05375);}(_0x593b,0x9c));var _0xb593=function(_0x53372c,_0x3ae72c){_0x53372c=_0x53372c-0x0;var _0x15ac02=_0x593b[_0x53372c];return _0x15ac02;};'use strict';var _=require('lodash');var util=require(_0xb593('0x0'));var moment=require(_0xb593('0x1'));var BPromise=require(_0xb593('0x2'));var rs=require(_0xb593('0x3'));var fs=require('fs');var Redis=require(_0xb593('0x4'));var db=require(_0xb593('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xb593('0x6'))(_0xb593('0x7'));var config=require(_0xb593('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xb593('0x9')][_0xb593('0xa')]({'port':0x232a});config[_0xb593('0xb')]=_[_0xb593('0xc')](config[_0xb593('0xb')],{'host':_0xb593('0xd'),'port':0x18eb});var socket=require(_0xb593('0xe'))(new Redis(config[_0xb593('0xb')]));require(_0xb593('0xf'))[_0xb593('0x10')](socket);function respondWithRpcPromise(_0xe2fbc,_0x505657,_0x50a759){return new BPromise(function(_0x598216,_0x1ca0a5){return client[_0xb593('0x11')](_0xe2fbc,_0x50a759)[_0xb593('0x12')](function(_0x34a2d4){logger[_0xb593('0x13')](_0xb593('0x14'),_0x505657,'request\x20sent');logger[_0xb593('0x15')](_0xb593('0x16'),_0x505657,_0xb593('0x17'),JSON[_0xb593('0x18')](_0x34a2d4));if(_0x34a2d4[_0xb593('0x19')]){if(_0x34a2d4[_0xb593('0x19')][_0xb593('0x1a')]===0x1f4){logger[_0xb593('0x19')](_0xb593('0x14'),_0x505657,_0x34a2d4['error'][_0xb593('0x1b')]);return _0x1ca0a5(_0x34a2d4[_0xb593('0x19')][_0xb593('0x1b')]);}logger[_0xb593('0x19')]('SmsMessage,\x20%s,\x20%s',_0x505657,_0x34a2d4[_0xb593('0x19')][_0xb593('0x1b')]);return _0x598216(_0x34a2d4['error'][_0xb593('0x1b')]);}else{logger[_0xb593('0x13')]('SmsMessage,\x20%s,\x20%s',_0x505657,_0xb593('0x17'));_0x598216(_0x34a2d4[_0xb593('0x1c')][_0xb593('0x1b')]);}})[_0xb593('0x1d')](function(_0x3d6f70){logger['error'](_0xb593('0x14'),_0x505657,_0x3d6f70);_0x1ca0a5(_0x3d6f70);});});}exports[_0xb593('0x1e')]=function(_0x2de3eb){var _0x850759=this;return new Promise(function(_0x1a2c99,_0x22395a){return db[_0xb593('0x1f')][_0xb593('0x20')](_0x2de3eb['body'],{'raw':_0x2de3eb[_0xb593('0x21')]?_0x2de3eb[_0xb593('0x21')][_0xb593('0x22')]===undefined?!![]:![]:!![]})[_0xb593('0x12')](function(_0x447d85){logger[_0xb593('0x13')](_0xb593('0x1e'),_0x2de3eb);logger[_0xb593('0x15')](_0xb593('0x1e'),_0x2de3eb,JSON['stringify'](_0x447d85));_0x1a2c99(_0x447d85);})[_0xb593('0x1d')](function(_0x34b40c){logger[_0xb593('0x19')](_0xb593('0x1e'),_0x34b40c[_0xb593('0x1b')],_0x2de3eb);_0x22395a(_0x850759[_0xb593('0x19')](0x1f4,_0x34b40c['message']));});});}; \ No newline at end of file +var _0x6606=['stringify','error','code','message','result','catch','CreateSmsMessage','SmsMessage','body','options','debug','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','jayson/promise','http','defaults','redis','localhost','socket.io-emitter','./smsMessage.socket','register','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','SmsMessage,\x20%s,\x20%s,\x20%s'];(function(_0x4b0233,_0x3136ea){var _0x5a4841=function(_0x65af23){while(--_0x65af23){_0x4b0233['push'](_0x4b0233['shift']());}};_0x5a4841(++_0x3136ea);}(_0x6606,0x1eb));var _0x6660=function(_0x245e2e,_0x5dd654){_0x245e2e=_0x245e2e-0x0;var _0x94fe72=_0x6606[_0x245e2e];return _0x94fe72;};'use strict';var _=require(_0x6660('0x0'));var util=require(_0x6660('0x1'));var moment=require('moment');var BPromise=require(_0x6660('0x2'));var rs=require(_0x6660('0x3'));var fs=require('fs');var Redis=require(_0x6660('0x4'));var db=require(_0x6660('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x6660('0x6'));var client=jayson['client'][_0x6660('0x7')]({'port':0x232a});config['redis']=_[_0x6660('0x8')](config[_0x6660('0x9')],{'host':_0x6660('0xa'),'port':0x18eb});var socket=require(_0x6660('0xb'))(new Redis(config[_0x6660('0x9')]));require(_0x6660('0xc'))[_0x6660('0xd')](socket);function respondWithRpcPromise(_0x30ac9a,_0x105b9d,_0xa7d237){return new BPromise(function(_0x30faab,_0x341e8b){return client['request'](_0x30ac9a,_0xa7d237)[_0x6660('0xe')](function(_0x54ce47){logger[_0x6660('0xf')](_0x6660('0x10'),_0x105b9d,_0x6660('0x11'));logger['debug'](_0x6660('0x12'),_0x105b9d,_0x6660('0x11'),JSON[_0x6660('0x13')](_0x54ce47));if(_0x54ce47[_0x6660('0x14')]){if(_0x54ce47[_0x6660('0x14')][_0x6660('0x15')]===0x1f4){logger['error']('SmsMessage,\x20%s,\x20%s',_0x105b9d,_0x54ce47[_0x6660('0x14')][_0x6660('0x16')]);return _0x341e8b(_0x54ce47[_0x6660('0x14')]['message']);}logger[_0x6660('0x14')](_0x6660('0x10'),_0x105b9d,_0x54ce47[_0x6660('0x14')][_0x6660('0x16')]);return _0x30faab(_0x54ce47['error'][_0x6660('0x16')]);}else{logger[_0x6660('0xf')](_0x6660('0x10'),_0x105b9d,_0x6660('0x11'));_0x30faab(_0x54ce47[_0x6660('0x17')][_0x6660('0x16')]);}})[_0x6660('0x18')](function(_0x5e8ddb){logger[_0x6660('0x14')](_0x6660('0x10'),_0x105b9d,_0x5e8ddb);_0x341e8b(_0x5e8ddb);});});}exports[_0x6660('0x19')]=function(_0x1fe924){var _0x2bf68b=this;return new Promise(function(_0x3ddd3c,_0xa66d){return db[_0x6660('0x1a')]['create'](_0x1fe924[_0x6660('0x1b')],{'raw':_0x1fe924[_0x6660('0x1c')]?_0x1fe924[_0x6660('0x1c')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x50d7ec){logger['info'](_0x6660('0x19'),_0x1fe924);logger[_0x6660('0x1d')](_0x6660('0x19'),_0x1fe924,JSON['stringify'](_0x50d7ec));_0x3ddd3c(_0x50d7ec);})[_0x6660('0x18')](function(_0x5c3a50){logger[_0x6660('0x14')](_0x6660('0x19'),_0x5c3a50[_0x6660('0x16')],_0x1fe924);_0xa66d(_0x2bf68b[_0x6660('0x14')](0x1f4,_0x5c3a50[_0x6660('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index 3e43f5f..081f19c 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 _0x5e98=['emit','removeListener','length','smsMessage:','./smsMessage.events','save','remove','update'];(function(_0xc889c2,_0x513cab){var _0x2355ea=function(_0x417b23){while(--_0x417b23){_0xc889c2['push'](_0xc889c2['shift']());}};_0x2355ea(++_0x513cab);}(_0x5e98,0xe4));var _0x85e9=function(_0x26035d,_0xc68032){_0x26035d=_0x26035d-0x0;var _0x18de85=_0x5e98[_0x26035d];return _0x18de85;};'use strict';var SmsMessageEvents=require(_0x85e9('0x0'));var events=[_0x85e9('0x1'),_0x85e9('0x2'),_0x85e9('0x3')];function createListener(_0x448453,_0x4afd5e){return function(_0x356102){_0x4afd5e[_0x85e9('0x4')](_0x448453,_0x356102);};}function removeListener(_0xc5bd73,_0x130184){return function(){SmsMessageEvents[_0x85e9('0x5')](_0xc5bd73,_0x130184);};}exports['register']=function(_0x21a93f){for(var _0x25078a=0x0,_0x389f38=events[_0x85e9('0x6')];_0x25078a<_0x389f38;_0x25078a++){var _0x447ad4=events[_0x25078a];var _0x50f714=createListener(_0x85e9('0x7')+_0x447ad4,_0x21a93f);SmsMessageEvents['on'](_0x447ad4,_0x50f714);}}; \ No newline at end of file +var _0x8833=['length','smsMessage:','./smsMessage.events','save','update','emit','removeListener','register'];(function(_0x132f78,_0x3a5aa5){var _0x5b7e61=function(_0x48f9bf){while(--_0x48f9bf){_0x132f78['push'](_0x132f78['shift']());}};_0x5b7e61(++_0x3a5aa5);}(_0x8833,0x102));var _0x3883=function(_0x2f126a,_0x2d36f9){_0x2f126a=_0x2f126a-0x0;var _0x10b04e=_0x8833[_0x2f126a];return _0x10b04e;};'use strict';var SmsMessageEvents=require(_0x3883('0x0'));var events=[_0x3883('0x1'),'remove',_0x3883('0x2')];function createListener(_0x58471a,_0x102691){return function(_0x8fe71c){_0x102691[_0x3883('0x3')](_0x58471a,_0x8fe71c);};}function removeListener(_0x58f566,_0x25164e){return function(){SmsMessageEvents[_0x3883('0x4')](_0x58f566,_0x25164e);};}exports[_0x3883('0x5')]=function(_0x5650f0){for(var _0x45bc3f=0x0,_0x3b9ff3=events[_0x3883('0x6')];_0x45bc3f<_0x3b9ff3;_0x45bc3f++){var _0x312cce=events[_0x45bc3f];var _0x2d9a10=createListener(_0x3883('0x7')+_0x312cce,_0x5650f0);SmsMessageEvents['on'](_0x312cce,_0x2d9a10);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index d977753..2472785 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 _0x809e=['../../components/interaction/service','../../config/environment','./smsQueue.controller','get','isAuthenticated','/describe','describe','/:id','/:id/members','getMembers','getTeams','/:id/users','getAgents','post','/:id/teams','addTeams','addAgents','update','delete','destroy','removeTeams','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x2862b1,_0x51a367){var _0x817ee6=function(_0x59cc5b){while(--_0x59cc5b){_0x2862b1['push'](_0x2862b1['shift']());}};_0x817ee6(++_0x51a367);}(_0x809e,0xfe));var _0xe809=function(_0x5150fc,_0x499418){_0x5150fc=_0x5150fc-0x0;var _0x4ee25=_0x809e[_0x5150fc];return _0x4ee25;};'use strict';var multer=require(_0xe809('0x0'));var util=require(_0xe809('0x1'));var path=require(_0xe809('0x2'));var timeout=require(_0xe809('0x3'));var express=require(_0xe809('0x4'));var router=express[_0xe809('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xe809('0x6'));var interaction=require(_0xe809('0x7'));var config=require(_0xe809('0x8'));var controller=require(_0xe809('0x9'));router[_0xe809('0xa')]('/',auth[_0xe809('0xb')](),controller['index']);router[_0xe809('0xa')](_0xe809('0xc'),auth[_0xe809('0xb')](),controller[_0xe809('0xd')]);router[_0xe809('0xa')](_0xe809('0xe'),auth['isAuthenticated'](),controller['show']);router[_0xe809('0xa')](_0xe809('0xf'),auth['isAuthenticated'](),controller[_0xe809('0x10')]);router[_0xe809('0xa')]('/:id/teams',auth[_0xe809('0xb')](),controller[_0xe809('0x11')]);router[_0xe809('0xa')](_0xe809('0x12'),auth[_0xe809('0xb')](),controller[_0xe809('0x13')]);router[_0xe809('0x14')]('/',auth[_0xe809('0xb')](),controller['create']);router[_0xe809('0x14')](_0xe809('0x15'),auth[_0xe809('0xb')](),controller[_0xe809('0x16')]);router[_0xe809('0x14')](_0xe809('0x12'),auth['isAuthenticated'](),controller[_0xe809('0x17')]);router['put'](_0xe809('0xe'),auth['isAuthenticated'](),controller[_0xe809('0x18')]);router[_0xe809('0x19')]('/:id',auth[_0xe809('0xb')](),controller[_0xe809('0x1a')]);router[_0xe809('0x19')](_0xe809('0x15'),auth[_0xe809('0xb')](),controller[_0xe809('0x1b')]);router[_0xe809('0x19')](_0xe809('0x12'),auth[_0xe809('0xb')](),controller['removeAgents']);module[_0xe809('0x1c')]=router; \ No newline at end of file +var _0x7347=['addAgents','put','update','delete','destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueue.controller','get','isAuthenticated','/describe','describe','/:id','show','getMembers','/:id/teams','/:id/users','post','addTeams'];(function(_0x35219f,_0xd1652d){var _0x20d059=function(_0x345be2){while(--_0x345be2){_0x35219f['push'](_0x35219f['shift']());}};_0x20d059(++_0xd1652d);}(_0x7347,0xd6));var _0x7734=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x7347[_0x27af45];return _0x18df21;};'use strict';var multer=require(_0x7734('0x0'));var util=require(_0x7734('0x1'));var path=require(_0x7734('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x7734('0x3')]();var fs_extra=require(_0x7734('0x4'));var auth=require(_0x7734('0x5'));var interaction=require(_0x7734('0x6'));var config=require(_0x7734('0x7'));var controller=require(_0x7734('0x8'));router[_0x7734('0x9')]('/',auth[_0x7734('0xa')](),controller['index']);router['get'](_0x7734('0xb'),auth[_0x7734('0xa')](),controller[_0x7734('0xc')]);router[_0x7734('0x9')](_0x7734('0xd'),auth[_0x7734('0xa')](),controller[_0x7734('0xe')]);router[_0x7734('0x9')]('/:id/members',auth[_0x7734('0xa')](),controller[_0x7734('0xf')]);router['get'](_0x7734('0x10'),auth[_0x7734('0xa')](),controller['getTeams']);router[_0x7734('0x9')](_0x7734('0x11'),auth[_0x7734('0xa')](),controller['getAgents']);router[_0x7734('0x12')]('/',auth['isAuthenticated'](),controller['create']);router[_0x7734('0x12')](_0x7734('0x10'),auth[_0x7734('0xa')](),controller[_0x7734('0x13')]);router[_0x7734('0x12')]('/:id/users',auth[_0x7734('0xa')](),controller[_0x7734('0x14')]);router[_0x7734('0x15')](_0x7734('0xd'),auth[_0x7734('0xa')](),controller[_0x7734('0x16')]);router[_0x7734('0x17')]('/:id',auth[_0x7734('0xa')](),controller[_0x7734('0x18')]);router['delete']('/:id/teams',auth[_0x7734('0xa')](),controller['removeTeams']);router[_0x7734('0x17')](_0x7734('0x11'),auth['isAuthenticated'](),controller['removeAgents']);module[_0x7734('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 4d0a071..fe12e20 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 _0xccef=['name','STRING','INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize','exports'];(function(_0x11337a,_0x6127b3){var _0x546b3d=function(_0x22a1a7){while(--_0x22a1a7){_0x11337a['push'](_0x11337a['shift']());}};_0x546b3d(++_0x6127b3);}(_0xccef,0xd6));var _0xfcce=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xccef[_0x2c91e9];return _0x13f0ff;};'use strict';var Sequelize=require(_0xfcce('0x0'));module[_0xfcce('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xfcce('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xfcce('0x3')]},'timeout':{'type':Sequelize[_0xfcce('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xfcce('0x5')](_0xfcce('0x6'),_0xfcce('0x7'),_0xfcce('0x8'))}}; \ No newline at end of file +var _0x2a40=['ENUM','rrmemory','sequelize','exports','STRING','INTEGER'];(function(_0x49ca18,_0x5e6d05){var _0x145d54=function(_0x30b9be){while(--_0x30b9be){_0x49ca18['push'](_0x49ca18['shift']());}};_0x145d54(++_0x5e6d05);}(_0x2a40,0x86));var _0x02a4=function(_0x176329,_0x568c84){_0x176329=_0x176329-0x0;var _0x31997c=_0x2a40[_0x176329];return _0x31997c;};'use strict';var Sequelize=require(_0x02a4('0x0'));module[_0x02a4('0x1')]={'name':{'type':Sequelize[_0x02a4('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x02a4('0x2')]},'timeout':{'type':Sequelize[_0x02a4('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x02a4('0x4')](_0x02a4('0x5'),'beepall','roundrobin')}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index 40cf9de..65925b2 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 _0x2032=['offset','limit','set','Content-Range','json','update','then','get','SmsQueues','UserProfileResource','destroy','error','name','send','index','map','SmsQueue','rawAttributes','fieldName','type','getOptions','where','include','query','rows','show','keys','filters','intersection','attributes','model','fields','options','find','catch','body','user','UserProfileSection','autoAssociation','params','describe','findOne','UserSmsQueue','hasOwnProperty','order','sort','SmsQueueId','filter','merge','findAll','User','agent','smsPause','updatedAt','createdAt','%s/%s','SIP','getTeams','Team','pick','nolimit','addTeams','Agents','online','voicePause','interface','sequelize','each','findOrCreate','forEach','userSmsQueue:save','removeTeams','ids','select','field','tq.TeamId','from','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','length','clone','toString','QueryTypes','SELECT','every','TeamId','includes','all','value','transaction','isEmpty','emit','userSmsQueue:remove','addAgents','omit','spread','removeAgents','isArray','getAgents','util','lodash','squel','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','register','sendStatus','end','status','count'];(function(_0x77d310,_0x2b2fe7){var _0x2cdce4=function(_0xbaa481){while(--_0xbaa481){_0x77d310['push'](_0x77d310['shift']());}};_0x2cdce4(++_0x2b2fe7);}(_0x2032,0xd9));var _0x2203=function(_0x5b787d,_0x141ae7){_0x5b787d=_0x5b787d-0x0;var _0x191771=_0x2032[_0x5b787d];return _0x191771;};'use strict';var BPromise=require('bluebird');var util=require(_0x2203('0x0'));var _=require(_0x2203('0x1'));var squel=require(_0x2203('0x2'));var Redis=require('ioredis');var qs=require(_0x2203('0x3'));var logger=require(_0x2203('0x4'))('api');var config=require(_0x2203('0x5'));var db=require(_0x2203('0x6'))['db'];config[_0x2203('0x7')]=_[_0x2203('0x8')](config[_0x2203('0x7')],{'host':_0x2203('0x9'),'port':0x18eb});var socket=require(_0x2203('0xa'))(new Redis(config[_0x2203('0x7')]));require(_0x2203('0xb'))[_0x2203('0xc')](socket);function respondWithStatusCode(_0x2999ed,_0x5ecf9e){_0x5ecf9e=_0x5ecf9e||0xcc;return function(_0x526ae0){if(_0x526ae0){return _0x2999ed[_0x2203('0xd')](_0x5ecf9e);}return _0x2999ed['status'](_0x5ecf9e)[_0x2203('0xe')]();};}function respondWithResult(_0x2972f3,_0x6339c4){_0x6339c4=_0x6339c4||0xc8;return function(_0x5b19df){if(_0x5b19df){return _0x2972f3[_0x2203('0xf')](_0x6339c4)['json'](_0x5b19df);}};}function respondWithFilteredResult(_0x3f690a,_0x4b73be){return function(_0x297459){if(_0x297459){var _0x1abb51=typeof _0x4b73be['offset']==='undefined'&&typeof _0x4b73be['limit']==='undefined';var _0x4bad7c=_0x297459[_0x2203('0x10')];var _0x538b30=_0x1abb51?0x0:_0x4b73be['offset'];var _0x21a3af=_0x1abb51?_0x297459[_0x2203('0x10')]:_0x4b73be[_0x2203('0x11')]+_0x4b73be[_0x2203('0x12')];var _0x226209;if(_0x21a3af>=_0x4bad7c){_0x21a3af=_0x4bad7c;_0x226209=0xc8;}else{_0x226209=0xce;}_0x3f690a[_0x2203('0xf')](_0x226209);return _0x3f690a[_0x2203('0x13')](_0x2203('0x14'),_0x538b30+'-'+_0x21a3af+'/'+_0x4bad7c)[_0x2203('0x15')](_0x297459);}return null;};}function saveUpdates(_0x3053f3){return function(_0x5129fb){if(_0x5129fb){return _0x5129fb[_0x2203('0x16')](_0x3053f3)[_0x2203('0x17')](function(_0x4893ff){return _0x4893ff;});}return null;};}function removeEntity(_0x3f9ef6){return function(_0x8906e1){if(_0x8906e1){return _0x8906e1['destroy']()[_0x2203('0x17')](function(){var _0x5ee83c=_0x8906e1[_0x2203('0x18')]({'plain':!![]});var _0x310b8c=_0x2203('0x19');return db[_0x2203('0x1a')][_0x2203('0x1b')]({'where':{'type':_0x310b8c,'resourceId':_0x5ee83c['id']}})[_0x2203('0x17')](function(){return _0x8906e1;});})['then'](function(){_0x3f9ef6[_0x2203('0xf')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5ac866){return function(_0x15f543){if(!_0x15f543){_0x5ac866['sendStatus'](0x194);}return _0x15f543;};}function handleError(_0x3b8ef9,_0x5bfe61){_0x5bfe61=_0x5bfe61||0x1f4;return function(_0x5d4c4e){logger[_0x2203('0x1c')](_0x5d4c4e['stack']);if(_0x5d4c4e['name']){delete _0x5d4c4e[_0x2203('0x1d')];}_0x3b8ef9[_0x2203('0xf')](_0x5bfe61)[_0x2203('0x1e')](_0x5d4c4e);};}exports[_0x2203('0x1f')]=function(_0x1244f4,_0x3114ef){var _0x49c12={};var _0x250349={'count':0x0,'rows':[]};var _0x576378=_[_0x2203('0x20')](db[_0x2203('0x21')][_0x2203('0x22')],function(_0x5f11bf){return{'name':_0x5f11bf[_0x2203('0x23')],'type':_0x5f11bf[_0x2203('0x24')]['key']};});_0x49c12=qs[_0x2203('0x25')](_0x576378,_0x1244f4);var _0xd91f5d={'where':_0x49c12[_0x2203('0x26')]};return db[_0x2203('0x21')][_0x2203('0x10')](_0xd91f5d)[_0x2203('0x17')](function(_0x9c53f){_0x250349['count']=_0x9c53f;_0x49c12[_0x2203('0x27')]=qs[_0x2203('0x27')](_0x1244f4[_0x2203('0x28')]);return db[_0x2203('0x21')]['findAll'](_0x49c12);})[_0x2203('0x17')](function(_0x21ff0d){_0x250349[_0x2203('0x29')]=_0x21ff0d;return _0x250349;})[_0x2203('0x17')](respondWithFilteredResult(_0x3114ef,_0x49c12))['catch'](handleError(_0x3114ef,null));};exports[_0x2203('0x2a')]=function(_0x50aa17,_0x5e6560){var _0x5c0157={'raw':!![],'where':{'id':_0x50aa17['params']['id']}},_0x1d5f74={};_0x1d5f74['model']=_[_0x2203('0x2b')](db[_0x2203('0x21')][_0x2203('0x22')]);_0x1d5f74[_0x2203('0x28')]=_[_0x2203('0x2b')](_0x50aa17['query']);_0x1d5f74[_0x2203('0x2c')]=_[_0x2203('0x2d')](_0x1d5f74['model'],_0x1d5f74[_0x2203('0x28')]);_0x5c0157[_0x2203('0x2e')]=_[_0x2203('0x2d')](_0x1d5f74[_0x2203('0x2f')],qs[_0x2203('0x30')](_0x50aa17[_0x2203('0x28')][_0x2203('0x30')]));_0x5c0157[_0x2203('0x2e')]=_0x5c0157[_0x2203('0x2e')]['length']?_0x5c0157[_0x2203('0x2e')]:_0x1d5f74[_0x2203('0x2f')];if(_0x50aa17['query']['includeAll']){_0x5c0157[_0x2203('0x27')]=[{'all':!![]}];}_0x5c0157=_['merge']({},_0x5c0157,_0x50aa17[_0x2203('0x31')]);return db[_0x2203('0x21')][_0x2203('0x32')](_0x5c0157)['then'](handleEntityNotFound(_0x5e6560,null))['then'](respondWithResult(_0x5e6560,null))[_0x2203('0x33')](handleError(_0x5e6560,null));};exports['create']=function(_0x2d0365,_0x5cfe5e){return db[_0x2203('0x21')]['create'](_0x2d0365[_0x2203('0x34')],{})[_0x2203('0x17')](function(_0x4311d1){var _0x40a793=_0x2d0365[_0x2203('0x35')]['get']({'plain':!![]});if(!_0x40a793)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x40a793['role']===_0x2203('0x35')){var _0x25a2dc=_0x4311d1[_0x2203('0x18')]({'plain':!![]});var _0x3b0c7a=_0x2203('0x19');return db[_0x2203('0x36')][_0x2203('0x32')]({'where':{'name':_0x3b0c7a,'userProfileId':_0x40a793['userProfileId']},'raw':!![]})[_0x2203('0x17')](function(_0x1b12c3){if(_0x1b12c3&&_0x1b12c3[_0x2203('0x37')]===0x0){return db[_0x2203('0x1a')]['create']({'name':_0x25a2dc['name'],'resourceId':_0x25a2dc['id'],'type':_0x1b12c3[_0x2203('0x1d')],'sectionId':_0x1b12c3['id']},{})['then'](function(){return _0x4311d1;});}else{return _0x4311d1;}})[_0x2203('0x33')](function(_0x446209){logger[_0x2203('0x1c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x446209);throw _0x446209;});}return _0x4311d1;})['then'](respondWithResult(_0x5cfe5e,0xc9))[_0x2203('0x33')](handleError(_0x5cfe5e,null));};exports[_0x2203('0x16')]=function(_0x368444,_0x1e09f3){if(_0x368444[_0x2203('0x34')]['id']){delete _0x368444[_0x2203('0x34')]['id'];}return db['SmsQueue'][_0x2203('0x32')]({'where':{'id':_0x368444[_0x2203('0x38')]['id']}})[_0x2203('0x17')](handleEntityNotFound(_0x1e09f3,null))[_0x2203('0x17')](saveUpdates(_0x368444[_0x2203('0x34')],null))[_0x2203('0x17')](respondWithResult(_0x1e09f3,null))[_0x2203('0x33')](handleError(_0x1e09f3,null));};exports[_0x2203('0x1b')]=function(_0x36b8e4,_0x1e34a0){return db['SmsQueue'][_0x2203('0x32')]({'where':{'id':_0x36b8e4[_0x2203('0x38')]['id']}})[_0x2203('0x17')](handleEntityNotFound(_0x1e34a0,null))[_0x2203('0x17')](removeEntity(_0x1e34a0,null))['catch'](handleError(_0x1e34a0,null));};exports['describe']=function(_0x1c6661,_0x48129c){return db[_0x2203('0x21')][_0x2203('0x39')]()[_0x2203('0x17')](respondWithResult(_0x48129c,null))[_0x2203('0x33')](handleError(_0x48129c,null));};exports['getMembers']=function(_0x289146,_0x102803){var _0x5cd8c6={'raw':!![],'where':{}},_0x29bd91={},_0x381b3e;return db[_0x2203('0x21')][_0x2203('0x3a')]({'where':{'id':_0x289146['params']['id']}})['then'](handleEntityNotFound(_0x102803,null))[_0x2203('0x17')](function(_0x5707c8){if(_0x5707c8){_0x381b3e=_0x5707c8['get']({'plain':!![]});_0x29bd91[_0x2203('0x2f')]=_[_0x2203('0x2b')](db[_0x2203('0x3b')]['rawAttributes']);_0x29bd91['query']=_[_0x2203('0x2b')](_0x289146[_0x2203('0x28')]);_0x29bd91[_0x2203('0x2c')]=_[_0x2203('0x2d')](_0x29bd91[_0x2203('0x2f')],_0x29bd91[_0x2203('0x28')]);_0x5cd8c6['attributes']=_[_0x2203('0x2d')](_0x29bd91['model'],qs[_0x2203('0x30')](_0x289146[_0x2203('0x28')][_0x2203('0x30')]));_0x5cd8c6[_0x2203('0x2e')]=_0x5cd8c6['attributes']['length']?_0x5cd8c6[_0x2203('0x2e')]:_0x29bd91[_0x2203('0x2f')];if(!_0x289146[_0x2203('0x28')][_0x2203('0x3c')]('nolimit')){_0x5cd8c6['limit']=qs['limit'](_0x289146[_0x2203('0x28')][_0x2203('0x12')]);_0x5cd8c6['offset']=qs[_0x2203('0x11')](_0x289146[_0x2203('0x28')]['offset']);}_0x5cd8c6[_0x2203('0x3d')]=qs[_0x2203('0x3e')](_0x289146[_0x2203('0x28')][_0x2203('0x3e')]);_0x5cd8c6['where']=qs[_0x2203('0x2c')](_['pick'](_0x289146[_0x2203('0x28')],_0x29bd91[_0x2203('0x2c')]));_0x5cd8c6['where'][_0x2203('0x3f')]=_0x5707c8['id'];if(_0x289146[_0x2203('0x28')][_0x2203('0x40')]){_0x5cd8c6[_0x2203('0x26')]=_[_0x2203('0x41')](_0x5cd8c6[_0x2203('0x26')],{'$or':_['map'](_0x5cd8c6['attributes'],function(_0x2f2537){var _0x524356={};_0x524356[_0x2f2537]={'$like':'%'+_0x289146['query'][_0x2203('0x40')]+'%'};return _0x524356;})});}_0x5cd8c6=_[_0x2203('0x41')]({},_0x5cd8c6,_0x289146[_0x2203('0x31')]);return db['UserSmsQueue'][_0x2203('0x42')](_0x5cd8c6);}})['then'](function(_0x5ddf9e){if(_0x5ddf9e){return db[_0x2203('0x43')]['findAndCountAll']({'where':{'id':_['map'](_0x5ddf9e,'UserId'),'role':_0x2203('0x44')},'attributes':['id',_0x2203('0x1d'),_0x2203('0x45'),_0x2203('0x46'),_0x2203('0x47')]});}})[_0x2203('0x17')](function(_0x2baea2){if(_0x2baea2){return{'count':_0x2baea2[_0x2203('0x10')],'rows':_[_0x2203('0x20')](_0x2baea2[_0x2203('0x29')],function(_0x384a59){return{'membername':_0x384a59[_0x2203('0x1d')],'UserId':_0x384a59['id'],'queue_name':_0x381b3e['name'],'SmsQueueId':_0x381b3e['id'],'interface':util['format'](_0x2203('0x48'),_0x2203('0x49'),_0x384a59[_0x2203('0x1d')]),'penalty':0x0,'paused':_0x384a59[_0x2203('0x45')],'createdAt':_0x384a59[_0x2203('0x47')],'updatedAt':_0x384a59[_0x2203('0x46')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x102803,_0x5cd8c6))['catch'](handleError(_0x102803,null));};exports[_0x2203('0x4a')]=function(_0x34358e,_0x21ee59){var _0x1e6d21={};var _0xcab922={};var _0x7b0b9c;var _0x133d22;return db[_0x2203('0x21')][_0x2203('0x3a')]({'where':{'id':_0x34358e[_0x2203('0x38')]['id']}})[_0x2203('0x17')](handleEntityNotFound(_0x21ee59,null))['then'](function(_0x1ea97a){if(_0x1ea97a){_0x7b0b9c=_0x1ea97a;_0xcab922[_0x2203('0x2f')]=_[_0x2203('0x2b')](db[_0x2203('0x4b')][_0x2203('0x22')]);_0xcab922[_0x2203('0x28')]=_[_0x2203('0x2b')](_0x34358e[_0x2203('0x28')]);_0xcab922[_0x2203('0x2c')]=_[_0x2203('0x2d')](_0xcab922[_0x2203('0x2f')],_0xcab922[_0x2203('0x28')]);_0x1e6d21[_0x2203('0x2e')]=_[_0x2203('0x2d')](_0xcab922[_0x2203('0x2f')],qs[_0x2203('0x30')](_0x34358e[_0x2203('0x28')][_0x2203('0x30')]));_0x1e6d21[_0x2203('0x2e')]=_0x1e6d21[_0x2203('0x2e')]['length']?_0x1e6d21[_0x2203('0x2e')]:_0xcab922[_0x2203('0x2f')];_0x1e6d21[_0x2203('0x3d')]=qs['sort'](_0x34358e[_0x2203('0x28')][_0x2203('0x3e')]);_0x1e6d21[_0x2203('0x26')]=qs[_0x2203('0x2c')](_[_0x2203('0x4c')](_0x34358e['query'],_0xcab922[_0x2203('0x2c')]));if(_0x34358e[_0x2203('0x28')][_0x2203('0x40')]){_0x1e6d21['where']=_['merge'](_0x1e6d21['where'],{'$or':_['map'](_0x1e6d21['attributes'],function(_0x418d48){var _0xbc9f88={};_0xbc9f88[_0x418d48]={'$like':'%'+_0x34358e[_0x2203('0x28')][_0x2203('0x40')]+'%'};return _0xbc9f88;})});}_0x1e6d21=_[_0x2203('0x41')]({},_0x1e6d21,_0x34358e[_0x2203('0x31')]);return _0x7b0b9c[_0x2203('0x4a')](_0x1e6d21);}})[_0x2203('0x17')](function(_0x56dcbe){if(_0x56dcbe){_0x133d22=_0x56dcbe['length'];if(!_0x34358e[_0x2203('0x28')][_0x2203('0x3c')](_0x2203('0x4d'))){_0x1e6d21[_0x2203('0x12')]=qs[_0x2203('0x12')](_0x34358e[_0x2203('0x28')][_0x2203('0x12')]);_0x1e6d21[_0x2203('0x11')]=qs[_0x2203('0x11')](_0x34358e[_0x2203('0x28')][_0x2203('0x11')]);}return _0x7b0b9c[_0x2203('0x4a')](_0x1e6d21);}})[_0x2203('0x17')](function(_0xae45a5){if(_0xae45a5){return _0xae45a5?{'count':_0x133d22,'rows':_0xae45a5}:null;}})[_0x2203('0x17')](respondWithResult(_0x21ee59,null))[_0x2203('0x33')](handleError(_0x21ee59,null));};exports[_0x2203('0x4e')]=function(_0x173ac1,_0xa15021){var _0x4b2e4f=_0x173ac1[_0x2203('0x34')]['ids'];return db[_0x2203('0x4b')]['findAll']({'where':{'id':_0x4b2e4f},'attributes':['id'],'include':[{'model':db[_0x2203('0x43')],'as':_0x2203('0x4f'),'attributes':['id',_0x2203('0x1d'),_0x2203('0x50'),_0x2203('0x51'),_0x2203('0x52')],'raw':!![]}]})[_0x2203('0x17')](function(_0x2eab08){if(_0x2eab08){var _0x4e9a01=_['flatMap'](_0x2eab08,function(_0x38903b){var _0x34593a=_0x38903b[_0x2203('0x18')]({'plain':!![]});return _0x34593a['Agents'];});return db['SmsQueue']['find']({'where':{'id':_0x173ac1[_0x2203('0x38')]['id']}})[_0x2203('0x17')](function(_0x20385b){return db[_0x2203('0x53')]['transaction'](function(_0x2f7850){return _0x20385b['addTeams'](_0x4b2e4f,{'transaction':_0x2f7850})[_0x2203('0x17')](function(){return BPromise[_0x2203('0x54')](_0x4e9a01,function(_0xe3bee5){return db[_0x2203('0x3b')][_0x2203('0x55')]({'where':{'UserId':_0xe3bee5['id'],'SmsQueueId':_0x173ac1['params']['id']},'transaction':_0x2f7850});});})[_0x2203('0x17')](function(){_0x4e9a01[_0x2203('0x56')](function(_0x18663f){socket['emit'](_0x2203('0x57'),{'UserId':_0x18663f['id'],'SmsQueueId':_0x20385b['id']});});});});});}})[_0x2203('0x17')](respondWithStatusCode(_0xa15021,null))[_0x2203('0x33')](handleError(_0xa15021,null));};exports[_0x2203('0x58')]=function(_0x1c65f9,_0x4356fe){return db[_0x2203('0x4b')][_0x2203('0x42')]({'where':{'id':_0x1c65f9[_0x2203('0x28')][_0x2203('0x59')]},'attributes':['id'],'include':[{'model':db[_0x2203('0x43')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x2203('0x17')](handleEntityNotFound(_0x4356fe,null))[_0x2203('0x17')](function(_0x21b755){var _0x2da37c=_[_0x2203('0x20')](_0x21b755,'id');var _0x52c35e=[];var _0x23f7b1=[];var _0x2a5a4b=squel[_0x2203('0x5a')]();_0x2a5a4b[_0x2203('0x5b')](_0x2203('0x5c'))[_0x2203('0x5d')]('team_has_sms_queues','tq')['join'](_0x2203('0x5e'),'ut',_0x2203('0x5f'))[_0x2203('0x26')](_0x2203('0x60'),_0x1c65f9[_0x2203('0x38')]['id']);for(var _0x4fd029=0x0;_0x4fd029<_0x21b755[_0x2203('0x61')];_0x4fd029+=0x1){let _0x3cb792=_0x21b755[_0x4fd029];for(var _0x4e539b=0x0;_0x4e539b<_0x3cb792['Agents']['length'];_0x4e539b+=0x1){let _0x4fc51a=_0x3cb792['Agents'][_0x4e539b];var _0x2952fc=_0x2a5a4b[_0x2203('0x62')]();_0x2952fc[_0x2203('0x26')]('ut.UserId\x20=\x20?',_0x4fc51a['id']);_0x23f7b1['push'](db['sequelize'][_0x2203('0x28')](_0x2952fc[_0x2203('0x63')](),{'type':db[_0x2203('0x53')][_0x2203('0x64')][_0x2203('0x65')]})[_0x2203('0x17')](function(_0x3d1797){if(_0x3d1797['length']===0x1){return _0x4fc51a['id'];}else{var _0x3bf2c9=_[_0x2203('0x66')](_[_0x2203('0x20')](_0x3d1797,_0x2203('0x67')),function(_0x35ff6b){return _[_0x2203('0x68')](_0x2da37c,_0x35ff6b);});if(_0x3bf2c9){return _0x4fc51a['id'];}}}));}}return BPromise[_0x2203('0x69')](_0x23f7b1)['then'](function(_0x188722){_0x52c35e=_(_0x52c35e)['union'](_0x188722)['compact']()[_0x2203('0x6a')]();return db['SmsQueue'][_0x2203('0x32')]({'where':{'id':_0x1c65f9[_0x2203('0x38')]['id']}})['then'](function(_0x29d545){return db[_0x2203('0x53')][_0x2203('0x6b')](function(_0x461f90){return _0x29d545[_0x2203('0x58')](_0x1c65f9[_0x2203('0x28')]['ids'],{'transaction':_0x461f90})[_0x2203('0x17')](function(){if(!_[_0x2203('0x6c')](_0x52c35e)){return _0x29d545['removeAgents'](_0x52c35e,{'transaction':_0x461f90});}})['then'](function(){_0x52c35e[_0x2203('0x56')](function(_0x3fe71b){socket[_0x2203('0x6d')](_0x2203('0x6e'),{'UserId':_0x3fe71b,'SmsQueueId':_0x29d545['id']});});});});});});})[_0x2203('0x17')](respondWithStatusCode(_0x4356fe,null))[_0x2203('0x33')](handleError(_0x4356fe,null));};exports[_0x2203('0x6f')]=function(_0x3c41bf,_0x4749df){return db[_0x2203('0x21')][_0x2203('0x32')]({'where':{'id':_0x3c41bf[_0x2203('0x38')]['id']}})[_0x2203('0x17')](handleEntityNotFound(_0x4749df,null))[_0x2203('0x17')](function(_0x7589a7){if(_0x7589a7){return _0x7589a7[_0x2203('0x6f')](_0x3c41bf['body']['ids'],_[_0x2203('0x70')](_0x3c41bf[_0x2203('0x34')],['ids','id'])||{})[_0x2203('0x71')](function(_0x447a95){for(var _0x5b5e95=0x0;_0x5b5e95<_0x3c41bf[_0x2203('0x34')][_0x2203('0x59')]['length'];_0x5b5e95+=0x1){socket[_0x2203('0x6d')](_0x2203('0x57'),{'UserId':Number(_0x3c41bf['body'][_0x2203('0x59')][_0x5b5e95]),'SmsQueueId':Number(_0x3c41bf[_0x2203('0x38')]['id'])});}return _0x447a95;});}})[_0x2203('0x17')](respondWithResult(_0x4749df,null))[_0x2203('0x33')](handleError(_0x4749df,null));};exports['removeAgents']=function(_0x511c66,_0x2df837){return db[_0x2203('0x21')][_0x2203('0x32')]({'where':{'id':_0x511c66['params']['id']}})['then'](handleEntityNotFound(_0x2df837,null))[_0x2203('0x17')](function(_0x199bec){if(_0x199bec){return _0x199bec[_0x2203('0x72')](_0x511c66['query']['ids'])[_0x2203('0x17')](function(){if(_[_0x2203('0x73')](_0x511c66['query'][_0x2203('0x59')])){for(var _0x2de64d=0x0;_0x2de64d<_0x511c66['query'][_0x2203('0x59')]['length'];_0x2de64d+=0x1){socket[_0x2203('0x6d')]('userSmsQueue:remove',{'UserId':Number(_0x511c66['query']['ids'][_0x2de64d]),'SmsQueueId':Number(_0x511c66[_0x2203('0x38')]['id'])});}}else{socket[_0x2203('0x6d')]('userSmsQueue:remove',{'UserId':Number(_0x511c66[_0x2203('0x28')][_0x2203('0x59')]),'SmsQueueId':Number(_0x511c66[_0x2203('0x38')]['id'])});}});}})['then'](respondWithStatusCode(_0x2df837,null))[_0x2203('0x33')](handleError(_0x2df837,null));};exports['getAgents']=function(_0x3f31e0,_0x3edb38){var _0x486563={};var _0x4358c1={};var _0x4096f4;var _0x5bd4e4;return db[_0x2203('0x21')][_0x2203('0x3a')]({'where':{'id':_0x3f31e0[_0x2203('0x38')]['id']}})[_0x2203('0x17')](handleEntityNotFound(_0x3edb38,null))[_0x2203('0x17')](function(_0x5d73a7){if(_0x5d73a7){_0x4096f4=_0x5d73a7;_0x4358c1[_0x2203('0x2f')]=_[_0x2203('0x2b')](db[_0x2203('0x43')][_0x2203('0x22')]);_0x4358c1[_0x2203('0x28')]=_[_0x2203('0x2b')](_0x3f31e0['query']);_0x4358c1[_0x2203('0x2c')]=_[_0x2203('0x2d')](_0x4358c1['model'],_0x4358c1[_0x2203('0x28')]);_0x486563['attributes']=_[_0x2203('0x2d')](_0x4358c1[_0x2203('0x2f')],qs[_0x2203('0x30')](_0x3f31e0['query'][_0x2203('0x30')]));_0x486563[_0x2203('0x2e')]=_0x486563[_0x2203('0x2e')][_0x2203('0x61')]?_0x486563[_0x2203('0x2e')]:_0x4358c1[_0x2203('0x2f')];_0x486563[_0x2203('0x3d')]=qs['sort'](_0x3f31e0['query'][_0x2203('0x3e')]);_0x486563[_0x2203('0x26')]=qs[_0x2203('0x2c')](_[_0x2203('0x4c')](_0x3f31e0[_0x2203('0x28')],_0x4358c1[_0x2203('0x2c')]));if(_0x3f31e0[_0x2203('0x28')]['filter']){_0x486563[_0x2203('0x26')]=_[_0x2203('0x41')](_0x486563['where'],{'$or':_[_0x2203('0x20')](_0x486563['attributes'],function(_0xc3dac5){var _0xbd1866={};_0xbd1866[_0xc3dac5]={'$like':'%'+_0x3f31e0['query'][_0x2203('0x40')]+'%'};return _0xbd1866;})});}_0x486563=_[_0x2203('0x41')]({},_0x486563,_0x3f31e0[_0x2203('0x31')]);return _0x4096f4[_0x2203('0x74')](_0x486563);}})[_0x2203('0x17')](function(_0x36ab7f){if(_0x36ab7f){_0x5bd4e4=_0x36ab7f[_0x2203('0x61')];if(!_0x3f31e0[_0x2203('0x28')][_0x2203('0x3c')](_0x2203('0x4d'))){_0x486563[_0x2203('0x12')]=qs[_0x2203('0x12')](_0x3f31e0['query'][_0x2203('0x12')]);_0x486563['offset']=qs[_0x2203('0x11')](_0x3f31e0[_0x2203('0x28')][_0x2203('0x11')]);}return _0x4096f4[_0x2203('0x74')](_0x486563);}})[_0x2203('0x17')](function(_0x2159a5){if(_0x2159a5){return _0x2159a5?{'count':_0x5bd4e4,'rows':_0x2159a5}:null;}})[_0x2203('0x17')](respondWithResult(_0x3edb38,null))[_0x2203('0x33')](handleError(_0x3edb38,null));}; \ No newline at end of file +var _0xdb28=['userSmsQueue:save','removeTeams','select','field','from','team_has_sms_queues','join','SmsQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','QueryTypes','TeamId','includes','all','union','value','isEmpty','removeAgents','forEach','addAgents','omit','spread','userSmsQueue:remove','getAgents','bluebird','util','lodash','squel','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','./smsQueue.socket','register','sendStatus','end','status','json','offset','undefined','count','limit','Content-Range','update','then','get','SmsQueues','destroy','error','stack','name','map','SmsQueue','fieldName','type','key','where','include','rows','show','keys','query','filters','intersection','model','attributes','fields','length','includeAll','merge','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','catch','body','params','describe','getMembers','findOne','UserSmsQueue','rawAttributes','hasOwnProperty','nolimit','order','sort','SmsQueueId','filter','findAll','User','findAndCountAll','UserId','agent','smsPause','updatedAt','createdAt','format','%s/%s','getTeams','Team','pick','ids','Agents','online','voicePause','interface','sequelize','transaction','addTeams','each','emit'];(function(_0xd2e442,_0x3a399e){var _0x28f991=function(_0x4340da){while(--_0x4340da){_0xd2e442['push'](_0xd2e442['shift']());}};_0x28f991(++_0x3a399e);}(_0xdb28,0x106));var _0x8db2=function(_0x192cad,_0x48d323){_0x192cad=_0x192cad-0x0;var _0x27eca6=_0xdb28[_0x192cad];return _0x27eca6;};'use strict';var BPromise=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var _=require(_0x8db2('0x2'));var squel=require(_0x8db2('0x3'));var Redis=require('ioredis');var qs=require(_0x8db2('0x4'));var logger=require(_0x8db2('0x5'))(_0x8db2('0x6'));var config=require(_0x8db2('0x7'));var db=require(_0x8db2('0x8'))['db'];config['redis']=_[_0x8db2('0x9')](config[_0x8db2('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8db2('0xa')]));require(_0x8db2('0xb'))[_0x8db2('0xc')](socket);function respondWithStatusCode(_0x29f698,_0x2f3f2f){_0x2f3f2f=_0x2f3f2f||0xcc;return function(_0x1ff362){if(_0x1ff362){return _0x29f698[_0x8db2('0xd')](_0x2f3f2f);}return _0x29f698['status'](_0x2f3f2f)[_0x8db2('0xe')]();};}function respondWithResult(_0x476216,_0x1f62af){_0x1f62af=_0x1f62af||0xc8;return function(_0x57015f){if(_0x57015f){return _0x476216[_0x8db2('0xf')](_0x1f62af)[_0x8db2('0x10')](_0x57015f);}};}function respondWithFilteredResult(_0x576475,_0x41beda){return function(_0x3b2faa){if(_0x3b2faa){var _0x1349f6=typeof _0x41beda[_0x8db2('0x11')]===_0x8db2('0x12')&&typeof _0x41beda['limit']==='undefined';var _0x15070d=_0x3b2faa[_0x8db2('0x13')];var _0x350d61=_0x1349f6?0x0:_0x41beda[_0x8db2('0x11')];var _0x227355=_0x1349f6?_0x3b2faa[_0x8db2('0x13')]:_0x41beda[_0x8db2('0x11')]+_0x41beda[_0x8db2('0x14')];var _0x131252;if(_0x227355>=_0x15070d){_0x227355=_0x15070d;_0x131252=0xc8;}else{_0x131252=0xce;}_0x576475[_0x8db2('0xf')](_0x131252);return _0x576475['set'](_0x8db2('0x15'),_0x350d61+'-'+_0x227355+'/'+_0x15070d)[_0x8db2('0x10')](_0x3b2faa);}return null;};}function saveUpdates(_0x48101e){return function(_0x2b3f73){if(_0x2b3f73){return _0x2b3f73[_0x8db2('0x16')](_0x48101e)[_0x8db2('0x17')](function(_0x3fddc2){return _0x3fddc2;});}return null;};}function removeEntity(_0x2efd06){return function(_0x46ce14){if(_0x46ce14){return _0x46ce14['destroy']()['then'](function(){var _0x77789=_0x46ce14[_0x8db2('0x18')]({'plain':!![]});var _0x1310d3=_0x8db2('0x19');return db['UserProfileResource'][_0x8db2('0x1a')]({'where':{'type':_0x1310d3,'resourceId':_0x77789['id']}})[_0x8db2('0x17')](function(){return _0x46ce14;});})[_0x8db2('0x17')](function(){_0x2efd06[_0x8db2('0xf')](0xcc)[_0x8db2('0xe')]();});}};}function handleEntityNotFound(_0x597260){return function(_0x124467){if(!_0x124467){_0x597260[_0x8db2('0xd')](0x194);}return _0x124467;};}function handleError(_0x18f69c,_0x125be2){_0x125be2=_0x125be2||0x1f4;return function(_0x2260d8){logger[_0x8db2('0x1b')](_0x2260d8[_0x8db2('0x1c')]);if(_0x2260d8['name']){delete _0x2260d8[_0x8db2('0x1d')];}_0x18f69c['status'](_0x125be2)['send'](_0x2260d8);};}exports['index']=function(_0x4d923c,_0xec8cd2){var _0x29b5cd={};var _0x3be281={'count':0x0,'rows':[]};var _0x2baed0=_[_0x8db2('0x1e')](db[_0x8db2('0x1f')]['rawAttributes'],function(_0x3544ba){return{'name':_0x3544ba[_0x8db2('0x20')],'type':_0x3544ba[_0x8db2('0x21')][_0x8db2('0x22')]};});_0x29b5cd=qs['getOptions'](_0x2baed0,_0x4d923c);var _0x2e0691={'where':_0x29b5cd[_0x8db2('0x23')]};return db[_0x8db2('0x1f')][_0x8db2('0x13')](_0x2e0691)[_0x8db2('0x17')](function(_0x21bae5){_0x3be281[_0x8db2('0x13')]=_0x21bae5;_0x29b5cd[_0x8db2('0x24')]=qs[_0x8db2('0x24')](_0x4d923c['query']);return db[_0x8db2('0x1f')]['findAll'](_0x29b5cd);})['then'](function(_0x302188){_0x3be281[_0x8db2('0x25')]=_0x302188;return _0x3be281;})[_0x8db2('0x17')](respondWithFilteredResult(_0xec8cd2,_0x29b5cd))['catch'](handleError(_0xec8cd2,null));};exports[_0x8db2('0x26')]=function(_0x56b71a,_0x3f7aac){var _0x2b653b={'raw':!![],'where':{'id':_0x56b71a['params']['id']}},_0x14bd12={};_0x14bd12['model']=_[_0x8db2('0x27')](db[_0x8db2('0x1f')]['rawAttributes']);_0x14bd12['query']=_[_0x8db2('0x27')](_0x56b71a[_0x8db2('0x28')]);_0x14bd12[_0x8db2('0x29')]=_[_0x8db2('0x2a')](_0x14bd12[_0x8db2('0x2b')],_0x14bd12[_0x8db2('0x28')]);_0x2b653b[_0x8db2('0x2c')]=_[_0x8db2('0x2a')](_0x14bd12[_0x8db2('0x2b')],qs[_0x8db2('0x2d')](_0x56b71a['query'][_0x8db2('0x2d')]));_0x2b653b[_0x8db2('0x2c')]=_0x2b653b['attributes'][_0x8db2('0x2e')]?_0x2b653b[_0x8db2('0x2c')]:_0x14bd12['model'];if(_0x56b71a['query'][_0x8db2('0x2f')]){_0x2b653b['include']=[{'all':!![]}];}_0x2b653b=_[_0x8db2('0x30')]({},_0x2b653b,_0x56b71a[_0x8db2('0x31')]);return db[_0x8db2('0x1f')][_0x8db2('0x32')](_0x2b653b)['then'](handleEntityNotFound(_0x3f7aac,null))[_0x8db2('0x17')](respondWithResult(_0x3f7aac,null))['catch'](handleError(_0x3f7aac,null));};exports[_0x8db2('0x33')]=function(_0xd550ae,_0x2c8bc9){return db[_0x8db2('0x1f')]['create'](_0xd550ae['body'],{})[_0x8db2('0x17')](function(_0x2c0507){var _0x5dc2b4=_0xd550ae[_0x8db2('0x34')][_0x8db2('0x18')]({'plain':!![]});if(!_0x5dc2b4)throw new Error(_0x8db2('0x35'));if(_0x5dc2b4['role']===_0x8db2('0x34')){var _0x149186=_0x2c0507[_0x8db2('0x18')]({'plain':!![]});var _0x279e74=_0x8db2('0x19');return db[_0x8db2('0x36')][_0x8db2('0x32')]({'where':{'name':_0x279e74,'userProfileId':_0x5dc2b4[_0x8db2('0x37')]},'raw':!![]})[_0x8db2('0x17')](function(_0x63c561){if(_0x63c561&&_0x63c561[_0x8db2('0x38')]===0x0){return db[_0x8db2('0x39')][_0x8db2('0x33')]({'name':_0x149186['name'],'resourceId':_0x149186['id'],'type':_0x63c561[_0x8db2('0x1d')],'sectionId':_0x63c561['id']},{})[_0x8db2('0x17')](function(){return _0x2c0507;});}else{return _0x2c0507;}})['catch'](function(_0x49a7ae){logger[_0x8db2('0x1b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x49a7ae);throw _0x49a7ae;});}return _0x2c0507;})[_0x8db2('0x17')](respondWithResult(_0x2c8bc9,0xc9))[_0x8db2('0x3a')](handleError(_0x2c8bc9,null));};exports[_0x8db2('0x16')]=function(_0x307783,_0xb4fe2c){if(_0x307783[_0x8db2('0x3b')]['id']){delete _0x307783[_0x8db2('0x3b')]['id'];}return db['SmsQueue'][_0x8db2('0x32')]({'where':{'id':_0x307783[_0x8db2('0x3c')]['id']}})[_0x8db2('0x17')](handleEntityNotFound(_0xb4fe2c,null))[_0x8db2('0x17')](saveUpdates(_0x307783['body'],null))[_0x8db2('0x17')](respondWithResult(_0xb4fe2c,null))[_0x8db2('0x3a')](handleError(_0xb4fe2c,null));};exports[_0x8db2('0x1a')]=function(_0x2c47cc,_0x5427af){return db[_0x8db2('0x1f')]['find']({'where':{'id':_0x2c47cc[_0x8db2('0x3c')]['id']}})[_0x8db2('0x17')](handleEntityNotFound(_0x5427af,null))[_0x8db2('0x17')](removeEntity(_0x5427af,null))['catch'](handleError(_0x5427af,null));};exports['describe']=function(_0x1ec3d0,_0x47c556){return db[_0x8db2('0x1f')][_0x8db2('0x3d')]()[_0x8db2('0x17')](respondWithResult(_0x47c556,null))[_0x8db2('0x3a')](handleError(_0x47c556,null));};exports[_0x8db2('0x3e')]=function(_0x40c6e6,_0x4355e2){var _0xab6bdd={'raw':!![],'where':{}},_0x4291e3={},_0x12a1ef;return db[_0x8db2('0x1f')][_0x8db2('0x3f')]({'where':{'id':_0x40c6e6['params']['id']}})[_0x8db2('0x17')](handleEntityNotFound(_0x4355e2,null))[_0x8db2('0x17')](function(_0xdbba64){if(_0xdbba64){_0x12a1ef=_0xdbba64[_0x8db2('0x18')]({'plain':!![]});_0x4291e3['model']=_['keys'](db[_0x8db2('0x40')][_0x8db2('0x41')]);_0x4291e3[_0x8db2('0x28')]=_['keys'](_0x40c6e6['query']);_0x4291e3['filters']=_[_0x8db2('0x2a')](_0x4291e3[_0x8db2('0x2b')],_0x4291e3[_0x8db2('0x28')]);_0xab6bdd[_0x8db2('0x2c')]=_[_0x8db2('0x2a')](_0x4291e3[_0x8db2('0x2b')],qs[_0x8db2('0x2d')](_0x40c6e6['query']['fields']));_0xab6bdd[_0x8db2('0x2c')]=_0xab6bdd[_0x8db2('0x2c')][_0x8db2('0x2e')]?_0xab6bdd[_0x8db2('0x2c')]:_0x4291e3[_0x8db2('0x2b')];if(!_0x40c6e6[_0x8db2('0x28')][_0x8db2('0x42')](_0x8db2('0x43'))){_0xab6bdd[_0x8db2('0x14')]=qs[_0x8db2('0x14')](_0x40c6e6[_0x8db2('0x28')][_0x8db2('0x14')]);_0xab6bdd[_0x8db2('0x11')]=qs[_0x8db2('0x11')](_0x40c6e6[_0x8db2('0x28')]['offset']);}_0xab6bdd[_0x8db2('0x44')]=qs[_0x8db2('0x45')](_0x40c6e6['query'][_0x8db2('0x45')]);_0xab6bdd[_0x8db2('0x23')]=qs[_0x8db2('0x29')](_['pick'](_0x40c6e6[_0x8db2('0x28')],_0x4291e3[_0x8db2('0x29')]));_0xab6bdd[_0x8db2('0x23')][_0x8db2('0x46')]=_0xdbba64['id'];if(_0x40c6e6[_0x8db2('0x28')]['filter']){_0xab6bdd[_0x8db2('0x23')]=_[_0x8db2('0x30')](_0xab6bdd[_0x8db2('0x23')],{'$or':_['map'](_0xab6bdd[_0x8db2('0x2c')],function(_0x18cc13){var _0x33dddd={};_0x33dddd[_0x18cc13]={'$like':'%'+_0x40c6e6[_0x8db2('0x28')][_0x8db2('0x47')]+'%'};return _0x33dddd;})});}_0xab6bdd=_[_0x8db2('0x30')]({},_0xab6bdd,_0x40c6e6[_0x8db2('0x31')]);return db['UserSmsQueue'][_0x8db2('0x48')](_0xab6bdd);}})[_0x8db2('0x17')](function(_0x4d3c19){if(_0x4d3c19){return db[_0x8db2('0x49')][_0x8db2('0x4a')]({'where':{'id':_['map'](_0x4d3c19,_0x8db2('0x4b')),'role':_0x8db2('0x4c')},'attributes':['id',_0x8db2('0x1d'),_0x8db2('0x4d'),_0x8db2('0x4e'),_0x8db2('0x4f')]});}})[_0x8db2('0x17')](function(_0x33a600){if(_0x33a600){return{'count':_0x33a600[_0x8db2('0x13')],'rows':_[_0x8db2('0x1e')](_0x33a600[_0x8db2('0x25')],function(_0x447a47){return{'membername':_0x447a47[_0x8db2('0x1d')],'UserId':_0x447a47['id'],'queue_name':_0x12a1ef[_0x8db2('0x1d')],'SmsQueueId':_0x12a1ef['id'],'interface':util[_0x8db2('0x50')](_0x8db2('0x51'),'SIP',_0x447a47[_0x8db2('0x1d')]),'penalty':0x0,'paused':_0x447a47[_0x8db2('0x4d')],'createdAt':_0x447a47[_0x8db2('0x4f')],'updatedAt':_0x447a47[_0x8db2('0x4e')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x8db2('0x17')](respondWithFilteredResult(_0x4355e2,_0xab6bdd))['catch'](handleError(_0x4355e2,null));};exports[_0x8db2('0x52')]=function(_0x2c3087,_0x3ab670){var _0x1e1c0d={};var _0x2ad70f={};var _0x348da8;var _0x17341d;return db[_0x8db2('0x1f')][_0x8db2('0x3f')]({'where':{'id':_0x2c3087[_0x8db2('0x3c')]['id']}})[_0x8db2('0x17')](handleEntityNotFound(_0x3ab670,null))[_0x8db2('0x17')](function(_0x170a72){if(_0x170a72){_0x348da8=_0x170a72;_0x2ad70f[_0x8db2('0x2b')]=_[_0x8db2('0x27')](db[_0x8db2('0x53')][_0x8db2('0x41')]);_0x2ad70f[_0x8db2('0x28')]=_['keys'](_0x2c3087[_0x8db2('0x28')]);_0x2ad70f['filters']=_[_0x8db2('0x2a')](_0x2ad70f['model'],_0x2ad70f[_0x8db2('0x28')]);_0x1e1c0d[_0x8db2('0x2c')]=_[_0x8db2('0x2a')](_0x2ad70f[_0x8db2('0x2b')],qs[_0x8db2('0x2d')](_0x2c3087['query']['fields']));_0x1e1c0d[_0x8db2('0x2c')]=_0x1e1c0d[_0x8db2('0x2c')][_0x8db2('0x2e')]?_0x1e1c0d[_0x8db2('0x2c')]:_0x2ad70f[_0x8db2('0x2b')];_0x1e1c0d[_0x8db2('0x44')]=qs[_0x8db2('0x45')](_0x2c3087[_0x8db2('0x28')]['sort']);_0x1e1c0d[_0x8db2('0x23')]=qs[_0x8db2('0x29')](_[_0x8db2('0x54')](_0x2c3087[_0x8db2('0x28')],_0x2ad70f[_0x8db2('0x29')]));if(_0x2c3087[_0x8db2('0x28')][_0x8db2('0x47')]){_0x1e1c0d[_0x8db2('0x23')]=_['merge'](_0x1e1c0d['where'],{'$or':_[_0x8db2('0x1e')](_0x1e1c0d[_0x8db2('0x2c')],function(_0x1d2dfc){var _0x27f4cd={};_0x27f4cd[_0x1d2dfc]={'$like':'%'+_0x2c3087[_0x8db2('0x28')]['filter']+'%'};return _0x27f4cd;})});}_0x1e1c0d=_['merge']({},_0x1e1c0d,_0x2c3087[_0x8db2('0x31')]);return _0x348da8[_0x8db2('0x52')](_0x1e1c0d);}})['then'](function(_0xa698bd){if(_0xa698bd){_0x17341d=_0xa698bd[_0x8db2('0x2e')];if(!_0x2c3087[_0x8db2('0x28')]['hasOwnProperty'](_0x8db2('0x43'))){_0x1e1c0d[_0x8db2('0x14')]=qs[_0x8db2('0x14')](_0x2c3087['query'][_0x8db2('0x14')]);_0x1e1c0d[_0x8db2('0x11')]=qs[_0x8db2('0x11')](_0x2c3087[_0x8db2('0x28')][_0x8db2('0x11')]);}return _0x348da8['getTeams'](_0x1e1c0d);}})[_0x8db2('0x17')](function(_0x3023fe){if(_0x3023fe){return _0x3023fe?{'count':_0x17341d,'rows':_0x3023fe}:null;}})[_0x8db2('0x17')](respondWithResult(_0x3ab670,null))['catch'](handleError(_0x3ab670,null));};exports['addTeams']=function(_0x2cdf3c,_0xbe05ca){var _0x487dcb=_0x2cdf3c[_0x8db2('0x3b')][_0x8db2('0x55')];return db[_0x8db2('0x53')][_0x8db2('0x48')]({'where':{'id':_0x487dcb},'attributes':['id'],'include':[{'model':db[_0x8db2('0x49')],'as':_0x8db2('0x56'),'attributes':['id',_0x8db2('0x1d'),_0x8db2('0x57'),_0x8db2('0x58'),_0x8db2('0x59')],'raw':!![]}]})[_0x8db2('0x17')](function(_0x3e1478){if(_0x3e1478){var _0x24a52d=_['flatMap'](_0x3e1478,function(_0x2ba42d){var _0x4f29f1=_0x2ba42d[_0x8db2('0x18')]({'plain':!![]});return _0x4f29f1[_0x8db2('0x56')];});return db['SmsQueue'][_0x8db2('0x32')]({'where':{'id':_0x2cdf3c[_0x8db2('0x3c')]['id']}})['then'](function(_0x2159c4){return db[_0x8db2('0x5a')][_0x8db2('0x5b')](function(_0x25a3ab){return _0x2159c4[_0x8db2('0x5c')](_0x487dcb,{'transaction':_0x25a3ab})[_0x8db2('0x17')](function(){return BPromise[_0x8db2('0x5d')](_0x24a52d,function(_0x3ac0fa){return db[_0x8db2('0x40')]['findOrCreate']({'where':{'UserId':_0x3ac0fa['id'],'SmsQueueId':_0x2cdf3c['params']['id']},'transaction':_0x25a3ab});});})[_0x8db2('0x17')](function(){_0x24a52d['forEach'](function(_0xf8afa5){socket[_0x8db2('0x5e')](_0x8db2('0x5f'),{'UserId':_0xf8afa5['id'],'SmsQueueId':_0x2159c4['id']});});});});});}})['then'](respondWithStatusCode(_0xbe05ca,null))[_0x8db2('0x3a')](handleError(_0xbe05ca,null));};exports[_0x8db2('0x60')]=function(_0x3e37e7,_0x591c5d){return db[_0x8db2('0x53')][_0x8db2('0x48')]({'where':{'id':_0x3e37e7[_0x8db2('0x28')][_0x8db2('0x55')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x8db2('0x56'),'attributes':['id'],'raw':!![]}]})[_0x8db2('0x17')](handleEntityNotFound(_0x591c5d,null))[_0x8db2('0x17')](function(_0x1edb1a){var _0xcf1c42=_[_0x8db2('0x1e')](_0x1edb1a,'id');var _0x1aadfb=[];var _0x3682bf=[];var _0x358f48=squel[_0x8db2('0x61')]();_0x358f48[_0x8db2('0x62')]('tq.TeamId')[_0x8db2('0x63')](_0x8db2('0x64'),'tq')[_0x8db2('0x65')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0x8db2('0x66'),_0x3e37e7[_0x8db2('0x3c')]['id']);for(var _0x3191c8=0x0;_0x3191c8<_0x1edb1a[_0x8db2('0x2e')];_0x3191c8+=0x1){let _0x2ad024=_0x1edb1a[_0x3191c8];for(var _0x313918=0x0;_0x313918<_0x2ad024[_0x8db2('0x56')][_0x8db2('0x2e')];_0x313918+=0x1){let _0x3b1929=_0x2ad024[_0x8db2('0x56')][_0x313918];var _0x46eb80=_0x358f48['clone']();_0x46eb80[_0x8db2('0x23')](_0x8db2('0x67'),_0x3b1929['id']);_0x3682bf[_0x8db2('0x68')](db[_0x8db2('0x5a')]['query'](_0x46eb80['toString'](),{'type':db[_0x8db2('0x5a')][_0x8db2('0x69')]['SELECT']})[_0x8db2('0x17')](function(_0x121f31){if(_0x121f31[_0x8db2('0x2e')]===0x1){return _0x3b1929['id'];}else{var _0x5f2ece=_['every'](_['map'](_0x121f31,_0x8db2('0x6a')),function(_0x18b4a6){return _[_0x8db2('0x6b')](_0xcf1c42,_0x18b4a6);});if(_0x5f2ece){return _0x3b1929['id'];}}}));}}return BPromise[_0x8db2('0x6c')](_0x3682bf)[_0x8db2('0x17')](function(_0x4e8aac){_0x1aadfb=_(_0x1aadfb)[_0x8db2('0x6d')](_0x4e8aac)['compact']()[_0x8db2('0x6e')]();return db[_0x8db2('0x1f')][_0x8db2('0x32')]({'where':{'id':_0x3e37e7[_0x8db2('0x3c')]['id']}})[_0x8db2('0x17')](function(_0x5d5380){return db['sequelize'][_0x8db2('0x5b')](function(_0x51afcf){return _0x5d5380[_0x8db2('0x60')](_0x3e37e7[_0x8db2('0x28')][_0x8db2('0x55')],{'transaction':_0x51afcf})[_0x8db2('0x17')](function(){if(!_[_0x8db2('0x6f')](_0x1aadfb)){return _0x5d5380[_0x8db2('0x70')](_0x1aadfb,{'transaction':_0x51afcf});}})['then'](function(){_0x1aadfb[_0x8db2('0x71')](function(_0x222ea2){socket[_0x8db2('0x5e')]('userSmsQueue:remove',{'UserId':_0x222ea2,'SmsQueueId':_0x5d5380['id']});});});});});});})[_0x8db2('0x17')](respondWithStatusCode(_0x591c5d,null))[_0x8db2('0x3a')](handleError(_0x591c5d,null));};exports['addAgents']=function(_0x2d7abf,_0x7cb97d){return db[_0x8db2('0x1f')][_0x8db2('0x32')]({'where':{'id':_0x2d7abf[_0x8db2('0x3c')]['id']}})[_0x8db2('0x17')](handleEntityNotFound(_0x7cb97d,null))[_0x8db2('0x17')](function(_0x19e25b){if(_0x19e25b){return _0x19e25b[_0x8db2('0x72')](_0x2d7abf['body'][_0x8db2('0x55')],_[_0x8db2('0x73')](_0x2d7abf[_0x8db2('0x3b')],[_0x8db2('0x55'),'id'])||{})[_0x8db2('0x74')](function(_0x345ff9){for(var _0x16d1c5=0x0;_0x16d1c5<_0x2d7abf[_0x8db2('0x3b')][_0x8db2('0x55')][_0x8db2('0x2e')];_0x16d1c5+=0x1){socket['emit'](_0x8db2('0x5f'),{'UserId':Number(_0x2d7abf[_0x8db2('0x3b')][_0x8db2('0x55')][_0x16d1c5]),'SmsQueueId':Number(_0x2d7abf[_0x8db2('0x3c')]['id'])});}return _0x345ff9;});}})['then'](respondWithResult(_0x7cb97d,null))[_0x8db2('0x3a')](handleError(_0x7cb97d,null));};exports[_0x8db2('0x70')]=function(_0x46476e,_0x4f653e){return db['SmsQueue'][_0x8db2('0x32')]({'where':{'id':_0x46476e[_0x8db2('0x3c')]['id']}})[_0x8db2('0x17')](handleEntityNotFound(_0x4f653e,null))[_0x8db2('0x17')](function(_0x4f9ce4){if(_0x4f9ce4){return _0x4f9ce4[_0x8db2('0x70')](_0x46476e[_0x8db2('0x28')][_0x8db2('0x55')])[_0x8db2('0x17')](function(){if(_['isArray'](_0x46476e[_0x8db2('0x28')][_0x8db2('0x55')])){for(var _0x3e7b24=0x0;_0x3e7b24<_0x46476e['query']['ids']['length'];_0x3e7b24+=0x1){socket[_0x8db2('0x5e')](_0x8db2('0x75'),{'UserId':Number(_0x46476e[_0x8db2('0x28')][_0x8db2('0x55')][_0x3e7b24]),'SmsQueueId':Number(_0x46476e['params']['id'])});}}else{socket['emit'](_0x8db2('0x75'),{'UserId':Number(_0x46476e[_0x8db2('0x28')][_0x8db2('0x55')]),'SmsQueueId':Number(_0x46476e[_0x8db2('0x3c')]['id'])});}});}})[_0x8db2('0x17')](respondWithStatusCode(_0x4f653e,null))[_0x8db2('0x3a')](handleError(_0x4f653e,null));};exports['getAgents']=function(_0x2942eb,_0x5f32ce){var _0x432780={};var _0x23457b={};var _0x1ef898;var _0x39f2d3;return db[_0x8db2('0x1f')]['findOne']({'where':{'id':_0x2942eb[_0x8db2('0x3c')]['id']}})[_0x8db2('0x17')](handleEntityNotFound(_0x5f32ce,null))['then'](function(_0x28beec){if(_0x28beec){_0x1ef898=_0x28beec;_0x23457b[_0x8db2('0x2b')]=_[_0x8db2('0x27')](db[_0x8db2('0x49')]['rawAttributes']);_0x23457b[_0x8db2('0x28')]=_['keys'](_0x2942eb['query']);_0x23457b[_0x8db2('0x29')]=_[_0x8db2('0x2a')](_0x23457b[_0x8db2('0x2b')],_0x23457b[_0x8db2('0x28')]);_0x432780[_0x8db2('0x2c')]=_[_0x8db2('0x2a')](_0x23457b[_0x8db2('0x2b')],qs['fields'](_0x2942eb[_0x8db2('0x28')]['fields']));_0x432780['attributes']=_0x432780[_0x8db2('0x2c')]['length']?_0x432780['attributes']:_0x23457b[_0x8db2('0x2b')];_0x432780[_0x8db2('0x44')]=qs[_0x8db2('0x45')](_0x2942eb['query'][_0x8db2('0x45')]);_0x432780[_0x8db2('0x23')]=qs[_0x8db2('0x29')](_['pick'](_0x2942eb[_0x8db2('0x28')],_0x23457b[_0x8db2('0x29')]));if(_0x2942eb[_0x8db2('0x28')][_0x8db2('0x47')]){_0x432780[_0x8db2('0x23')]=_[_0x8db2('0x30')](_0x432780[_0x8db2('0x23')],{'$or':_[_0x8db2('0x1e')](_0x432780['attributes'],function(_0xa7b208){var _0x3cb456={};_0x3cb456[_0xa7b208]={'$like':'%'+_0x2942eb[_0x8db2('0x28')][_0x8db2('0x47')]+'%'};return _0x3cb456;})});}_0x432780=_[_0x8db2('0x30')]({},_0x432780,_0x2942eb[_0x8db2('0x31')]);return _0x1ef898[_0x8db2('0x76')](_0x432780);}})[_0x8db2('0x17')](function(_0x3a53e2){if(_0x3a53e2){_0x39f2d3=_0x3a53e2[_0x8db2('0x2e')];if(!_0x2942eb[_0x8db2('0x28')]['hasOwnProperty'](_0x8db2('0x43'))){_0x432780[_0x8db2('0x14')]=qs[_0x8db2('0x14')](_0x2942eb['query'][_0x8db2('0x14')]);_0x432780[_0x8db2('0x11')]=qs[_0x8db2('0x11')](_0x2942eb['query']['offset']);}return _0x1ef898[_0x8db2('0x76')](_0x432780);}})[_0x8db2('0x17')](function(_0x296966){if(_0x296966){return _0x296966?{'count':_0x39f2d3,'rows':_0x296966}:null;}})[_0x8db2('0x17')](respondWithResult(_0x5f32ce,null))[_0x8db2('0x3a')](handleError(_0x5f32ce,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index d6f8773..bd41da8 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 _0x3a90=['hasOwnProperty','hook','exports','events','../../mysqldb','update','emit'];(function(_0x5c8f9f,_0xadc68){var _0x3a9576=function(_0x2eca1e){while(--_0x2eca1e){_0x5c8f9f['push'](_0x5c8f9f['shift']());}};_0x3a9576(++_0xadc68);}(_0x3a90,0xe3));var _0x03a9=function(_0x492afc,_0x52fde5){_0x492afc=_0x492afc-0x0;var _0x44b4f5=_0x3a90[_0x492afc];return _0x44b4f5;};'use strict';var EventEmitter=require(_0x03a9('0x0'));var SmsQueue=require(_0x03a9('0x1'))['db']['SmsQueue'];var SmsQueueEvents=new EventEmitter();SmsQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x03a9('0x2'),'afterDestroy':'remove'};function emitEvent(_0x3113c1){return function(_0x3deb00,_0x4339f1,_0x4e77bd){SmsQueueEvents[_0x03a9('0x3')](_0x3113c1+':'+_0x3deb00['id'],_0x3deb00);SmsQueueEvents[_0x03a9('0x3')](_0x3113c1,_0x3deb00);_0x4e77bd(null);};}for(var e in events){if(events[_0x03a9('0x4')](e)){var event=events[e];SmsQueue[_0x03a9('0x5')](e,emitEvent(event));}}module[_0x03a9('0x6')]=SmsQueueEvents; \ No newline at end of file +var _0x3161=['save','update','emit','hasOwnProperty','exports','events','../../mysqldb','SmsQueue','setMaxListeners'];(function(_0x29bdee,_0x115562){var _0x27e670=function(_0x46ca07){while(--_0x46ca07){_0x29bdee['push'](_0x29bdee['shift']());}};_0x27e670(++_0x115562);}(_0x3161,0x8c));var _0x1316=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x3161[_0x122ef9];return _0x42fba0;};'use strict';var EventEmitter=require(_0x1316('0x0'));var SmsQueue=require(_0x1316('0x1'))['db'][_0x1316('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x1316('0x3')](0x0);var events={'afterCreate':_0x1316('0x4'),'afterUpdate':_0x1316('0x5'),'afterDestroy':'remove'};function emitEvent(_0x3c2fdc){return function(_0xd92d7b,_0x5760f1,_0xeecb16){SmsQueueEvents[_0x1316('0x6')](_0x3c2fdc+':'+_0xd92d7b['id'],_0xd92d7b);SmsQueueEvents[_0x1316('0x6')](_0x3c2fdc,_0xd92d7b);_0xeecb16(null);};}for(var e in events){if(events[_0x1316('0x7')](e)){var event=events[e];SmsQueue['hook'](e,emitEvent(event));}}module[_0x1316('0x8')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index c3f05b9..ad5df61 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 _0x2a8c=['define','SmsQueue','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsQueue.attributes','exports'];(function(_0xb128cb,_0x213bb3){var _0x3f7b43=function(_0x38ab8d){while(--_0x38ab8d){_0xb128cb['push'](_0xb128cb['shift']());}};_0x3f7b43(++_0x213bb3);}(_0x2a8c,0x8e));var _0xc2a8=function(_0x4d239f,_0x4f4b1b){_0x4d239f=_0x4d239f-0x0;var _0x1c1fe0=_0x2a8c[_0x4d239f];return _0x1c1fe0;};'use strict';var _=require(_0xc2a8('0x0'));var util=require(_0xc2a8('0x1'));var logger=require(_0xc2a8('0x2'))(_0xc2a8('0x3'));var moment=require(_0xc2a8('0x4'));var BPromise=require(_0xc2a8('0x5'));var rp=require(_0xc2a8('0x6'));var fs=require('fs');var path=require(_0xc2a8('0x7'));var rimraf=require(_0xc2a8('0x8'));var config=require(_0xc2a8('0x9'));var attributes=require(_0xc2a8('0xa'));module[_0xc2a8('0xb')]=function(_0x54468d,_0x36b93d){return _0x54468d[_0xc2a8('0xc')](_0xc2a8('0xd'),attributes,{'tableName':'sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x54f9=['../../config/environment','./smsQueue.attributes','SmsQueue','sms_queues','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x15e60d,_0x441d21){var _0x18eaad=function(_0x3c4178){while(--_0x3c4178){_0x15e60d['push'](_0x15e60d['shift']());}};_0x18eaad(++_0x441d21);}(_0x54f9,0x9d));var _0x954f=function(_0x2d6189,_0x568081){_0x2d6189=_0x2d6189-0x0;var _0x39fdfb=_0x54f9[_0x2d6189];return _0x39fdfb;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x954f('0x0'))('api');var moment=require(_0x954f('0x1'));var BPromise=require(_0x954f('0x2'));var rp=require(_0x954f('0x3'));var fs=require('fs');var path=require(_0x954f('0x4'));var rimraf=require('rimraf');var config=require(_0x954f('0x5'));var attributes=require(_0x954f('0x6'));module['exports']=function(_0x129a63,_0x9ea9a){return _0x129a63['define'](_0x954f('0x7'),attributes,{'tableName':_0x954f('0x8'),'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 df9006b..1f74197 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 _0x1f62=['http','redis','socket.io-emitter','./smsQueue.socket','register','request','info','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','GetSmsQueue','SmsQueue','findAll','options','where','attributes','limit','include','map','model','then','catch','ShowSmsQueue','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','client'];(function(_0x2150c8,_0xfb4121){var _0x113c31=function(_0x418a92){while(--_0x418a92){_0x2150c8['push'](_0x2150c8['shift']());}};_0x113c31(++_0xfb4121);}(_0x1f62,0x13c));var _0x21f6=function(_0x389fee,_0x18baf5){_0x389fee=_0x389fee-0x0;var _0x1511f6=_0x1f62[_0x389fee];return _0x1511f6;};'use strict';var _=require(_0x21f6('0x0'));var util=require('util');var moment=require(_0x21f6('0x1'));var BPromise=require(_0x21f6('0x2'));var rs=require(_0x21f6('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x21f6('0x4'))['db'];var utils=require(_0x21f6('0x5'));var logger=require('../../config/logger')(_0x21f6('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x21f6('0x7')][_0x21f6('0x8')]({'port':0x232a});config[_0x21f6('0x9')]=_['defaults'](config[_0x21f6('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x21f6('0xa'))(new Redis(config['redis']));require(_0x21f6('0xb'))[_0x21f6('0xc')](socket);function respondWithRpcPromise(_0x4c38e4,_0x52ec2e,_0x4b0a40){return new BPromise(function(_0x166eb4,_0xc1c396){return client[_0x21f6('0xd')](_0x4c38e4,_0x4b0a40)['then'](function(_0x115c15){logger[_0x21f6('0xe')](_0x21f6('0xf'),_0x52ec2e,_0x21f6('0x10'));logger[_0x21f6('0x11')]('SmsQueue,\x20%s,\x20%s,\x20%s',_0x52ec2e,'request\x20sent',JSON[_0x21f6('0x12')](_0x115c15));if(_0x115c15[_0x21f6('0x13')]){if(_0x115c15['error'][_0x21f6('0x14')]===0x1f4){logger[_0x21f6('0x13')](_0x21f6('0xf'),_0x52ec2e,_0x115c15[_0x21f6('0x13')]['message']);return _0xc1c396(_0x115c15[_0x21f6('0x13')][_0x21f6('0x15')]);}logger[_0x21f6('0x13')]('SmsQueue,\x20%s,\x20%s',_0x52ec2e,_0x115c15[_0x21f6('0x13')][_0x21f6('0x15')]);return _0x166eb4(_0x115c15[_0x21f6('0x13')][_0x21f6('0x15')]);}else{logger[_0x21f6('0xe')](_0x21f6('0xf'),_0x52ec2e,_0x21f6('0x10'));_0x166eb4(_0x115c15[_0x21f6('0x16')]['message']);}})['catch'](function(_0x312729){logger[_0x21f6('0x13')](_0x21f6('0xf'),_0x52ec2e,_0x312729);_0xc1c396(_0x312729);});});}exports[_0x21f6('0x17')]=function(_0x541b70){var _0xbdf631=this;return new Promise(function(_0x26bf22,_0x1758bc){return db[_0x21f6('0x18')][_0x21f6('0x19')]({'raw':_0x541b70[_0x21f6('0x1a')]?_0x541b70['options']['raw']===undefined?!![]:![]:!![],'where':_0x541b70['options']?_0x541b70[_0x21f6('0x1a')][_0x21f6('0x1b')]||null:null,'attributes':_0x541b70[_0x21f6('0x1a')]?_0x541b70[_0x21f6('0x1a')][_0x21f6('0x1c')]||null:null,'limit':_0x541b70[_0x21f6('0x1a')]?_0x541b70[_0x21f6('0x1a')][_0x21f6('0x1d')]||null:null,'include':_0x541b70['options']?_0x541b70[_0x21f6('0x1a')][_0x21f6('0x1e')]?_[_0x21f6('0x1f')](_0x541b70['options'][_0x21f6('0x1e')],function(_0x58921b){return{'model':db[_0x58921b[_0x21f6('0x20')]],'as':_0x58921b['as'],'attributes':_0x58921b[_0x21f6('0x1c')],'include':_0x58921b[_0x21f6('0x1e')]?_[_0x21f6('0x1f')](_0x58921b[_0x21f6('0x1e')],function(_0x6ea499){return{'model':db[_0x6ea499[_0x21f6('0x20')]],'as':_0x6ea499['as'],'attributes':_0x6ea499['attributes'],'include':_0x6ea499['include']?_[_0x21f6('0x1f')](_0x6ea499[_0x21f6('0x1e')],function(_0x404ad9){return{'model':db[_0x404ad9[_0x21f6('0x20')]],'as':_0x404ad9['as'],'attributes':_0x404ad9[_0x21f6('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x21f6('0x21')](function(_0x1495d9){logger[_0x21f6('0xe')]('GetSmsQueue',_0x541b70);logger[_0x21f6('0x11')](_0x21f6('0x17'),_0x541b70,JSON[_0x21f6('0x12')](_0x1495d9));_0x26bf22(_0x1495d9);})[_0x21f6('0x22')](function(_0x31d98f){logger[_0x21f6('0x13')](_0x21f6('0x17'),_0x31d98f['message'],_0x541b70);_0x1758bc(_0xbdf631[_0x21f6('0x13')](0x1f4,_0x31d98f[_0x21f6('0x15')]));});});};exports['ShowSmsQueue']=function(_0x286a4a){var _0x3cad9d=this;return new Promise(function(_0x224bd0,_0x4e8aa5){return db[_0x21f6('0x18')]['find']({'raw':_0x286a4a[_0x21f6('0x1a')]?_0x286a4a[_0x21f6('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x286a4a[_0x21f6('0x1a')]?_0x286a4a[_0x21f6('0x1a')][_0x21f6('0x1b')]||null:null,'attributes':_0x286a4a['options']?_0x286a4a['options']['attributes']||null:null,'include':_0x286a4a[_0x21f6('0x1a')]?_0x286a4a[_0x21f6('0x1a')]['include']?_[_0x21f6('0x1f')](_0x286a4a['options'][_0x21f6('0x1e')],function(_0x2483ce){return{'model':db[_0x2483ce[_0x21f6('0x20')]],'as':_0x2483ce['as'],'attributes':_0x2483ce[_0x21f6('0x1c')],'include':_0x2483ce[_0x21f6('0x1e')]?_[_0x21f6('0x1f')](_0x2483ce['include'],function(_0x41ecf6){return{'model':db[_0x41ecf6[_0x21f6('0x20')]],'as':_0x41ecf6['as'],'attributes':_0x41ecf6['attributes'],'include':_0x41ecf6[_0x21f6('0x1e')]?_['map'](_0x41ecf6['include'],function(_0xe62c82){return{'model':db[_0xe62c82[_0x21f6('0x20')]],'as':_0xe62c82['as'],'attributes':_0xe62c82[_0x21f6('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4f3f3b){logger[_0x21f6('0xe')](_0x21f6('0x23'),_0x286a4a);logger[_0x21f6('0x11')]('ShowSmsQueue',_0x286a4a,JSON[_0x21f6('0x12')](_0x4f3f3b));_0x224bd0(_0x4f3f3b);})[_0x21f6('0x22')](function(_0x3b23e5){logger[_0x21f6('0x13')]('ShowSmsQueue',_0x3b23e5[_0x21f6('0x15')],_0x286a4a);_0x4e8aa5(_0x3cad9d[_0x21f6('0x13')](0x1f4,_0x3b23e5[_0x21f6('0x15')]));});});}; \ No newline at end of file +var _0x71e0=['info','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','error','message','catch','GetSmsQueue','SmsQueue','findAll','options','raw','where','attributes','limit','include','map','model','ShowSmsQueue','find','stringify','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','register','request','then'];(function(_0x3a4e3c,_0x55d4c7){var _0x4db0c2=function(_0x1479e7){while(--_0x1479e7){_0x3a4e3c['push'](_0x3a4e3c['shift']());}};_0x4db0c2(++_0x55d4c7);}(_0x71e0,0x8b));var _0x071e=function(_0xe12ab2,_0x38dbad){_0xe12ab2=_0xe12ab2-0x0;var _0x5b818a=_0x71e0[_0xe12ab2];return _0x5b818a;};'use strict';var _=require('lodash');var util=require(_0x071e('0x0'));var moment=require('moment');var BPromise=require(_0x071e('0x1'));var rs=require(_0x071e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x071e('0x3'));var logger=require(_0x071e('0x4'))(_0x071e('0x5'));var config=require(_0x071e('0x6'));var jayson=require(_0x071e('0x7'));var client=jayson['client'][_0x071e('0x8')]({'port':0x232a});config[_0x071e('0x9')]=_[_0x071e('0xa')](config[_0x071e('0x9')],{'host':_0x071e('0xb'),'port':0x18eb});var socket=require(_0x071e('0xc'))(new Redis(config[_0x071e('0x9')]));require(_0x071e('0xd'))[_0x071e('0xe')](socket);function respondWithRpcPromise(_0x436f41,_0x4cedec,_0x29c699){return new BPromise(function(_0x45d5cb,_0x26a037){return client[_0x071e('0xf')](_0x436f41,_0x29c699)[_0x071e('0x10')](function(_0x588635){logger[_0x071e('0x11')](_0x071e('0x12'),_0x4cedec,_0x071e('0x13'));logger[_0x071e('0x14')](_0x071e('0x15'),_0x4cedec,_0x071e('0x13'),JSON['stringify'](_0x588635));if(_0x588635['error']){if(_0x588635[_0x071e('0x16')]['code']===0x1f4){logger['error'](_0x071e('0x12'),_0x4cedec,_0x588635[_0x071e('0x16')][_0x071e('0x17')]);return _0x26a037(_0x588635[_0x071e('0x16')][_0x071e('0x17')]);}logger['error'](_0x071e('0x12'),_0x4cedec,_0x588635[_0x071e('0x16')][_0x071e('0x17')]);return _0x45d5cb(_0x588635[_0x071e('0x16')][_0x071e('0x17')]);}else{logger[_0x071e('0x11')](_0x071e('0x12'),_0x4cedec,_0x071e('0x13'));_0x45d5cb(_0x588635['result'][_0x071e('0x17')]);}})[_0x071e('0x18')](function(_0x453a2d){logger[_0x071e('0x16')](_0x071e('0x12'),_0x4cedec,_0x453a2d);_0x26a037(_0x453a2d);});});}exports[_0x071e('0x19')]=function(_0x2fe396){var _0x2c7a2b=this;return new Promise(function(_0x27ef0e,_0x38ae8d){return db[_0x071e('0x1a')][_0x071e('0x1b')]({'raw':_0x2fe396['options']?_0x2fe396[_0x071e('0x1c')][_0x071e('0x1d')]===undefined?!![]:![]:!![],'where':_0x2fe396['options']?_0x2fe396[_0x071e('0x1c')][_0x071e('0x1e')]||null:null,'attributes':_0x2fe396[_0x071e('0x1c')]?_0x2fe396[_0x071e('0x1c')][_0x071e('0x1f')]||null:null,'limit':_0x2fe396[_0x071e('0x1c')]?_0x2fe396[_0x071e('0x1c')][_0x071e('0x20')]||null:null,'include':_0x2fe396[_0x071e('0x1c')]?_0x2fe396[_0x071e('0x1c')][_0x071e('0x21')]?_[_0x071e('0x22')](_0x2fe396[_0x071e('0x1c')]['include'],function(_0x562b1d){return{'model':db[_0x562b1d[_0x071e('0x23')]],'as':_0x562b1d['as'],'attributes':_0x562b1d['attributes'],'include':_0x562b1d[_0x071e('0x21')]?_[_0x071e('0x22')](_0x562b1d[_0x071e('0x21')],function(_0x1d74ec){return{'model':db[_0x1d74ec[_0x071e('0x23')]],'as':_0x1d74ec['as'],'attributes':_0x1d74ec[_0x071e('0x1f')],'include':_0x1d74ec[_0x071e('0x21')]?_[_0x071e('0x22')](_0x1d74ec[_0x071e('0x21')],function(_0x2bbf8f){return{'model':db[_0x2bbf8f[_0x071e('0x23')]],'as':_0x2bbf8f['as'],'attributes':_0x2bbf8f[_0x071e('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x071e('0x10')](function(_0x35656a){logger['info']('GetSmsQueue',_0x2fe396);logger['debug'](_0x071e('0x19'),_0x2fe396,JSON['stringify'](_0x35656a));_0x27ef0e(_0x35656a);})['catch'](function(_0x27e650){logger[_0x071e('0x16')](_0x071e('0x19'),_0x27e650[_0x071e('0x17')],_0x2fe396);_0x38ae8d(_0x2c7a2b[_0x071e('0x16')](0x1f4,_0x27e650[_0x071e('0x17')]));});});};exports[_0x071e('0x24')]=function(_0x43b9f8){var _0x4b7070=this;return new Promise(function(_0x5ca22b,_0x127d6f){return db['SmsQueue'][_0x071e('0x25')]({'raw':_0x43b9f8[_0x071e('0x1c')]?_0x43b9f8['options'][_0x071e('0x1d')]===undefined?!![]:![]:!![],'where':_0x43b9f8[_0x071e('0x1c')]?_0x43b9f8[_0x071e('0x1c')][_0x071e('0x1e')]||null:null,'attributes':_0x43b9f8[_0x071e('0x1c')]?_0x43b9f8[_0x071e('0x1c')][_0x071e('0x1f')]||null:null,'include':_0x43b9f8[_0x071e('0x1c')]?_0x43b9f8[_0x071e('0x1c')][_0x071e('0x21')]?_[_0x071e('0x22')](_0x43b9f8[_0x071e('0x1c')][_0x071e('0x21')],function(_0x37c072){return{'model':db[_0x37c072[_0x071e('0x23')]],'as':_0x37c072['as'],'attributes':_0x37c072['attributes'],'include':_0x37c072[_0x071e('0x21')]?_['map'](_0x37c072['include'],function(_0x845583){return{'model':db[_0x845583[_0x071e('0x23')]],'as':_0x845583['as'],'attributes':_0x845583[_0x071e('0x1f')],'include':_0x845583['include']?_['map'](_0x845583[_0x071e('0x21')],function(_0x5939d5){return{'model':db[_0x5939d5[_0x071e('0x23')]],'as':_0x5939d5['as'],'attributes':_0x5939d5['attributes']};}):[]};}):[]};}):[]:[]})[_0x071e('0x10')](function(_0x356b52){logger[_0x071e('0x11')](_0x071e('0x24'),_0x43b9f8);logger[_0x071e('0x14')]('ShowSmsQueue',_0x43b9f8,JSON[_0x071e('0x26')](_0x356b52));_0x5ca22b(_0x356b52);})[_0x071e('0x18')](function(_0x2dad21){logger[_0x071e('0x16')](_0x071e('0x24'),_0x2dad21[_0x071e('0x17')],_0x43b9f8);_0x127d6f(_0x4b7070['error'](0x1f4,_0x2dad21[_0x071e('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index cc7687c..9b3191b 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 _0x7d46=['update','emit','removeListener','register','length','smsQueue:','./smsQueue.events','save'];(function(_0xa79afb,_0x4fc78f){var _0x33ccb8=function(_0x2b3751){while(--_0x2b3751){_0xa79afb['push'](_0xa79afb['shift']());}};_0x33ccb8(++_0x4fc78f);}(_0x7d46,0x1de));var _0x67d4=function(_0x18cd5b,_0x10240b){_0x18cd5b=_0x18cd5b-0x0;var _0x5eaa52=_0x7d46[_0x18cd5b];return _0x5eaa52;};'use strict';var SmsQueueEvents=require(_0x67d4('0x0'));var events=[_0x67d4('0x1'),'remove',_0x67d4('0x2')];function createListener(_0xa1e686,_0x23c4b0){return function(_0x1c281e){_0x23c4b0[_0x67d4('0x3')](_0xa1e686,_0x1c281e);};}function removeListener(_0x39067d,_0x5d96c3){return function(){SmsQueueEvents[_0x67d4('0x4')](_0x39067d,_0x5d96c3);};}exports[_0x67d4('0x5')]=function(_0x58983c){for(var _0x71492=0x0,_0x52f25b=events[_0x67d4('0x6')];_0x71492<_0x52f25b;_0x71492++){var _0x359e16=events[_0x71492];var _0x5a86e9=createListener(_0x67d4('0x7')+_0x359e16,_0x58983c);SmsQueueEvents['on'](_0x359e16,_0x5a86e9);}}; \ No newline at end of file +var _0x9f4b=['smsQueue:','./smsQueue.events','remove','register','length'];(function(_0x50f07b,_0x4d964e){var _0x45e479=function(_0x2addc2){while(--_0x2addc2){_0x50f07b['push'](_0x50f07b['shift']());}};_0x45e479(++_0x4d964e);}(_0x9f4b,0x10a));var _0xb9f4=function(_0x4f9ece,_0x4e20f7){_0x4f9ece=_0x4f9ece-0x0;var _0x22232f=_0x9f4b[_0x4f9ece];return _0x22232f;};'use strict';var SmsQueueEvents=require(_0xb9f4('0x0'));var events=['save',_0xb9f4('0x1'),'update'];function createListener(_0x24d9ba,_0x42847b){return function(_0x69e336){_0x42847b['emit'](_0x24d9ba,_0x69e336);};}function removeListener(_0x58e2fe,_0x52ccdd){return function(){SmsQueueEvents['removeListener'](_0x58e2fe,_0x52ccdd);};}exports[_0xb9f4('0x2')]=function(_0x293b5b){for(var _0x5a68e9=0x0,_0x46704e=events[_0xb9f4('0x3')];_0x5a68e9<_0x46704e;_0x5a68e9++){var _0x5a75cd=events[_0x5a68e9];var _0x27e5ef=createListener(_0xb9f4('0x4')+_0x5a75cd,_0x293b5b);SmsQueueEvents['on'](_0x5a75cd,_0x27e5ef);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 64b439d..9c09f54 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 _0x108e=['describe','/:id','show','post','update','destroy','util','path','express','fs-extra','../../components/interaction/service','get','isAuthenticated','index','/describe'];(function(_0x38c21f,_0x5d27a5){var _0x2e1b03=function(_0x70cc69){while(--_0x70cc69){_0x38c21f['push'](_0x38c21f['shift']());}};_0x2e1b03(++_0x5d27a5);}(_0x108e,0x141));var _0xe108=function(_0x30cd1d,_0x440373){_0x30cd1d=_0x30cd1d-0x0;var _0x12b888=_0x108e[_0x30cd1d];return _0x12b888;};'use strict';var multer=require('multer');var util=require(_0xe108('0x0'));var path=require(_0xe108('0x1'));var timeout=require('connect-timeout');var express=require(_0xe108('0x2'));var router=express['Router']();var fs_extra=require(_0xe108('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xe108('0x4'));var config=require('../../config/environment');var controller=require('./smsQueueReport.controller');router[_0xe108('0x5')]('/',auth[_0xe108('0x6')](),controller[_0xe108('0x7')]);router[_0xe108('0x5')](_0xe108('0x8'),auth[_0xe108('0x6')](),controller[_0xe108('0x9')]);router[_0xe108('0x5')](_0xe108('0xa'),auth['isAuthenticated'](),controller[_0xe108('0xb')]);router[_0xe108('0xc')]('/',auth[_0xe108('0x6')](),controller['create']);router['put'](_0xe108('0xa'),auth[_0xe108('0x6')](),controller[_0xe108('0xd')]);router['delete'](_0xe108('0xa'),auth[_0xe108('0x6')](),controller[_0xe108('0xe')]);module['exports']=router; \ No newline at end of file +var _0x9ec0=['./smsQueueReport.controller','get','isAuthenticated','/:id','show','post','put','destroy','exports','connect-timeout','Router','../../components/auth/service','../../config/environment'];(function(_0x1a9aed,_0x20c820){var _0x30754a=function(_0x4a5b08){while(--_0x4a5b08){_0x1a9aed['push'](_0x1a9aed['shift']());}};_0x30754a(++_0x20c820);}(_0x9ec0,0x71));var _0x09ec=function(_0x20432d,_0x162aef){_0x20432d=_0x20432d-0x0;var _0x3d47db=_0x9ec0[_0x20432d];return _0x3d47db;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x09ec('0x0'));var express=require('express');var router=express[_0x09ec('0x1')]();var fs_extra=require('fs-extra');var auth=require(_0x09ec('0x2'));var interaction=require('../../components/interaction/service');var config=require(_0x09ec('0x3'));var controller=require(_0x09ec('0x4'));router[_0x09ec('0x5')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/describe',auth[_0x09ec('0x6')](),controller['describe']);router['get'](_0x09ec('0x7'),auth[_0x09ec('0x6')](),controller[_0x09ec('0x8')]);router[_0x09ec('0x9')]('/',auth[_0x09ec('0x6')](),controller['create']);router[_0x09ec('0xa')]('/:id',auth[_0x09ec('0x6')](),controller['update']);router['delete'](_0x09ec('0x7'),auth['isAuthenticated'](),controller[_0x09ec('0xb')]);module[_0x09ec('0xc')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index e156903..2d655f2 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 _0xe75f=['DATE','moment','sequelize','exports','STRING'];(function(_0x1ed116,_0x23bc80){var _0x574066=function(_0x424f9e){while(--_0x424f9e){_0x1ed116['push'](_0x1ed116['shift']());}};_0x574066(++_0x23bc80);}(_0xe75f,0x11e));var _0xfe75=function(_0x22b2f1,_0x8af4ca){_0x22b2f1=_0x22b2f1-0x0;var _0x1a139b=_0xe75f[_0x22b2f1];return _0x1a139b;};'use strict';var moment=require(_0xfe75('0x0'));var Sequelize=require(_0xfe75('0x1'));module[_0xfe75('0x2')]={'uniqueid':{'type':Sequelize[_0xfe75('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xfe75('0x4')]},'leaveAt':{'type':Sequelize[_0xfe75('0x4')]},'acceptAt':{'type':Sequelize[_0xfe75('0x4')]},'exitAt':{'type':Sequelize[_0xfe75('0x4')]},'reason':{'type':Sequelize[_0xfe75('0x3')]}}; \ No newline at end of file +var _0xea6c=['sequelize','exports','STRING','DATE'];(function(_0x42e4d7,_0x4bd202){var _0x346cd8=function(_0x36c0f6){while(--_0x36c0f6){_0x42e4d7['push'](_0x42e4d7['shift']());}};_0x346cd8(++_0x4bd202);}(_0xea6c,0x164));var _0xcea6=function(_0x11ba32,_0x5a7ba6){_0x11ba32=_0x11ba32-0x0;var _0x296558=_0xea6c[_0x11ba32];return _0x296558;};'use strict';var moment=require('moment');var Sequelize=require(_0xcea6('0x0'));module[_0xcea6('0x1')]={'uniqueid':{'type':Sequelize[_0xcea6('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xcea6('0x2')]},'joinAt':{'type':Sequelize[_0xcea6('0x3')]},'leaveAt':{'type':Sequelize[_0xcea6('0x3')]},'acceptAt':{'type':Sequelize[_0xcea6('0x3')]},'exitAt':{'type':Sequelize[_0xcea6('0x3')]},'reason':{'type':Sequelize[_0xcea6('0x2')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index d589a8b..097e85d 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 _0x082f=['lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','update','then','destroy','error','stack','name','index','map','SmsQueueReport','model','query','keys','attributes','intersection','fields','hasOwnProperty','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','length','find','create','body','params','describe','eml-format','rimraf','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','fs-extra'];(function(_0x5f343f,_0x157119){var _0x509d92=function(_0x111a69){while(--_0x111a69){_0x5f343f['push'](_0x5f343f['shift']());}};_0x509d92(++_0x157119);}(_0x082f,0x14f));var _0xf082=function(_0x568496,_0x565afd){_0x568496=_0x568496-0x0;var _0x26c5c1=_0x082f[_0x568496];return _0x26c5c1;};'use strict';var emlformat=require(_0xf082('0x0'));var rimraf=require(_0xf082('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf082('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xf082('0x3'));var Mustache=require('mustache');var util=require(_0xf082('0x4'));var path=require(_0xf082('0x5'));var sox=require(_0xf082('0x6'));var csv=require(_0xf082('0x7'));var ejs=require(_0xf082('0x8'));var fs=require('fs');var fs_extra=require(_0xf082('0x9'));var _=require(_0xf082('0xa'));var squel=require(_0xf082('0xb'));var crypto=require(_0xf082('0xc'));var jsforce=require(_0xf082('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xf082('0x7'));var querystring=require(_0xf082('0xe'));var Papa=require(_0xf082('0xf'));var Redis=require(_0xf082('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xf082('0x11'));var hardwareService=require(_0xf082('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xf082('0x13'));var licenseUtil=require(_0xf082('0x14'));var db=require(_0xf082('0x15'))['db'];function respondWithStatusCode(_0x24fe6e,_0x3f2cff){_0x3f2cff=_0x3f2cff||0xcc;return function(_0x1063a2){if(_0x1063a2){return _0x24fe6e['sendStatus'](_0x3f2cff);}return _0x24fe6e[_0xf082('0x16')](_0x3f2cff)[_0xf082('0x17')]();};}function respondWithResult(_0x1caff9,_0x4dfd62){_0x4dfd62=_0x4dfd62||0xc8;return function(_0x9c9c4){if(_0x9c9c4){return _0x1caff9[_0xf082('0x16')](_0x4dfd62)[_0xf082('0x18')](_0x9c9c4);}};}function respondWithFilteredResult(_0x419430,_0x3f8881){return function(_0x105e9c){if(_0x105e9c){var _0x1c9d99=typeof _0x3f8881[_0xf082('0x19')]===_0xf082('0x1a')&&typeof _0x3f8881[_0xf082('0x1b')]===_0xf082('0x1a');var _0x376417=_0x105e9c[_0xf082('0x1c')];var _0x46a7d6=_0x1c9d99?0x0:_0x3f8881[_0xf082('0x19')];var _0x8284f5=_0x1c9d99?_0x105e9c[_0xf082('0x1c')]:_0x3f8881[_0xf082('0x19')]+_0x3f8881[_0xf082('0x1b')];var _0x19b1bd;if(_0x8284f5>=_0x376417){_0x8284f5=_0x376417;_0x19b1bd=0xc8;}else{_0x19b1bd=0xce;}_0x419430[_0xf082('0x16')](_0x19b1bd);return _0x419430['set'](_0xf082('0x1d'),_0x46a7d6+'-'+_0x8284f5+'/'+_0x376417)[_0xf082('0x18')](_0x105e9c);}return null;};}function patchUpdates(_0x56cd85){return function(_0x3f5f9a){try{jsonpatch['apply'](_0x3f5f9a,_0x56cd85,!![]);}catch(_0x52a05a){return BPromise[_0xf082('0x1e')](_0x52a05a);}return _0x3f5f9a[_0xf082('0x1f')]();};}function saveUpdates(_0x422913,_0x240c91){return function(_0xe1af09){if(_0xe1af09){return _0xe1af09[_0xf082('0x20')](_0x422913)[_0xf082('0x21')](function(_0x367835){return _0x367835;});}return null;};}function removeEntity(_0x101ec3,_0x3951d1){return function(_0xff535a){if(_0xff535a){return _0xff535a[_0xf082('0x22')]()['then'](function(){_0x101ec3[_0xf082('0x16')](0xcc)[_0xf082('0x17')]();});}};}function handleEntityNotFound(_0x10e835,_0x1d83c0){return function(_0x1368dd){if(!_0x1368dd){_0x10e835['sendStatus'](0x194);}return _0x1368dd;};}function handleError(_0x3cf777,_0x1d954d){_0x1d954d=_0x1d954d||0x1f4;return function(_0x6b47a2){logger[_0xf082('0x23')](_0x6b47a2[_0xf082('0x24')]);if(_0x6b47a2[_0xf082('0x25')]){delete _0x6b47a2[_0xf082('0x25')];}_0x3cf777[_0xf082('0x16')](_0x1d954d)['send'](_0x6b47a2);};}exports[_0xf082('0x26')]=function(_0x44fc4a,_0x5e9ea3){var _0x1c9bc8={},_0x1ffbab={},_0x1d0161={'count':0x0,'rows':[]};var _0x3cc64b=_[_0xf082('0x27')](db[_0xf082('0x28')]['rawAttributes'],function(_0x67423f){return{'name':_0x67423f['fieldName'],'type':_0x67423f['type']['key']};});_0x1ffbab[_0xf082('0x29')]=_[_0xf082('0x27')](_0x3cc64b,_0xf082('0x25'));_0x1ffbab[_0xf082('0x2a')]=_[_0xf082('0x2b')](_0x44fc4a[_0xf082('0x2a')]);_0x1ffbab['filters']=_['intersection'](_0x1ffbab[_0xf082('0x29')],_0x1ffbab[_0xf082('0x2a')]);_0x1c9bc8[_0xf082('0x2c')]=_[_0xf082('0x2d')](_0x1ffbab[_0xf082('0x29')],qs[_0xf082('0x2e')](_0x44fc4a[_0xf082('0x2a')][_0xf082('0x2e')]));_0x1c9bc8[_0xf082('0x2c')]=_0x1c9bc8['attributes']['length']?_0x1c9bc8[_0xf082('0x2c')]:_0x1ffbab['model'];if(!_0x44fc4a[_0xf082('0x2a')][_0xf082('0x2f')]('nolimit')){_0x1c9bc8['limit']=qs['limit'](_0x44fc4a[_0xf082('0x2a')][_0xf082('0x1b')]);_0x1c9bc8[_0xf082('0x19')]=qs[_0xf082('0x19')](_0x44fc4a[_0xf082('0x2a')][_0xf082('0x19')]);}_0x1c9bc8[_0xf082('0x30')]=qs['sort'](_0x44fc4a[_0xf082('0x2a')][_0xf082('0x31')]);_0x1c9bc8[_0xf082('0x32')]=qs[_0xf082('0x33')](_[_0xf082('0x34')](_0x44fc4a['query'],_0x1ffbab[_0xf082('0x33')]),_0x3cc64b);if(_0x44fc4a[_0xf082('0x2a')][_0xf082('0x35')]){_0x1c9bc8['where']=_[_0xf082('0x36')](_0x1c9bc8['where'],{'$or':_[_0xf082('0x27')](_0x3cc64b,function(_0x96afb3){if(_0x96afb3[_0xf082('0x37')]!==_0xf082('0x38')){var _0x10c3e7={};_0x10c3e7[_0x96afb3[_0xf082('0x25')]]={'$like':'%'+_0x44fc4a[_0xf082('0x2a')][_0xf082('0x35')]+'%'};return _0x10c3e7;}})});}_0x1c9bc8=_[_0xf082('0x36')]({},_0x1c9bc8,_0x44fc4a[_0xf082('0x39')]);var _0x3fa109={'where':_0x1c9bc8[_0xf082('0x32')]};return db[_0xf082('0x28')][_0xf082('0x1c')](_0x3fa109)['then'](function(_0xbdcf74){_0x1d0161[_0xf082('0x1c')]=_0xbdcf74;if(_0x44fc4a[_0xf082('0x2a')][_0xf082('0x3a')]){_0x1c9bc8[_0xf082('0x3b')]=[{'all':!![]}];}return db[_0xf082('0x28')][_0xf082('0x3c')](_0x1c9bc8);})[_0xf082('0x21')](function(_0x575e11){_0x1d0161[_0xf082('0x3d')]=_0x575e11;return _0x1d0161;})[_0xf082('0x21')](respondWithFilteredResult(_0x5e9ea3,_0x1c9bc8))[_0xf082('0x3e')](handleError(_0x5e9ea3,null));};exports['show']=function(_0x5d4772,_0x1088c8){var _0x2e4718={'raw':!![],'where':{'id':_0x5d4772['params']['id']}},_0x5e1647={};_0x5e1647[_0xf082('0x29')]=_[_0xf082('0x2b')](db[_0xf082('0x28')]['rawAttributes']);_0x5e1647['query']=_[_0xf082('0x2b')](_0x5d4772[_0xf082('0x2a')]);_0x5e1647['filters']=_[_0xf082('0x2d')](_0x5e1647['model'],_0x5e1647[_0xf082('0x2a')]);_0x2e4718[_0xf082('0x2c')]=_['intersection'](_0x5e1647[_0xf082('0x29')],qs[_0xf082('0x2e')](_0x5d4772['query'][_0xf082('0x2e')]));_0x2e4718['attributes']=_0x2e4718[_0xf082('0x2c')][_0xf082('0x3f')]?_0x2e4718[_0xf082('0x2c')]:_0x5e1647[_0xf082('0x29')];if(_0x5d4772[_0xf082('0x2a')][_0xf082('0x3a')]){_0x2e4718['include']=[{'all':!![]}];}_0x2e4718=_[_0xf082('0x36')]({},_0x2e4718,_0x5d4772[_0xf082('0x39')]);return db[_0xf082('0x28')][_0xf082('0x40')](_0x2e4718)[_0xf082('0x21')](handleEntityNotFound(_0x1088c8,null))[_0xf082('0x21')](respondWithResult(_0x1088c8,null))[_0xf082('0x3e')](handleError(_0x1088c8,null));};exports[_0xf082('0x41')]=function(_0x2ba576,_0x470877){return db[_0xf082('0x28')][_0xf082('0x41')](_0x2ba576[_0xf082('0x42')],{})[_0xf082('0x21')](respondWithResult(_0x470877,0xc9))[_0xf082('0x3e')](handleError(_0x470877,null));};exports[_0xf082('0x20')]=function(_0x3d2ce9,_0x1e630b){if(_0x3d2ce9[_0xf082('0x42')]['id']){delete _0x3d2ce9[_0xf082('0x42')]['id'];}return db['SmsQueueReport'][_0xf082('0x40')]({'where':{'id':_0x3d2ce9[_0xf082('0x43')]['id']}})['then'](handleEntityNotFound(_0x1e630b,null))['then'](saveUpdates(_0x3d2ce9[_0xf082('0x42')],null))[_0xf082('0x21')](respondWithResult(_0x1e630b,null))['catch'](handleError(_0x1e630b,null));};exports['destroy']=function(_0x33322f,_0x51d52a){return db['SmsQueueReport'][_0xf082('0x40')]({'where':{'id':_0x33322f['params']['id']}})[_0xf082('0x21')](handleEntityNotFound(_0x51d52a,null))[_0xf082('0x21')](removeEntity(_0x51d52a,null))[_0xf082('0x3e')](handleError(_0x51d52a,null));};exports[_0xf082('0x44')]=function(_0x4c99a7,_0x30f655){return db[_0xf082('0x28')][_0xf082('0x44')]()['then'](respondWithResult(_0x30f655,null))[_0xf082('0x3e')](handleError(_0x30f655,null));}; \ No newline at end of file +var _0xd204=['show','params','options','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','count','set','Content-Range','json','apply','reject','save','then','end','error','send','rawAttributes','fieldName','name','keys','query','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','merge','map','VIRTUAL','includeAll','include','SmsQueueReport','findAll','rows','catch'];(function(_0x47b7fe,_0x2d52a3){var _0x279957=function(_0x3da762){while(--_0x3da762){_0x47b7fe['push'](_0x47b7fe['shift']());}};_0x279957(++_0x2d52a3);}(_0xd204,0x17e));var _0x4d20=function(_0x33f474,_0x16c53d){_0x33f474=_0x33f474-0x0;var _0xc14bbf=_0xd204[_0x33f474];return _0xc14bbf;};'use strict';var emlformat=require(_0x4d20('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4d20('0x1'));var jsonpatch=require(_0x4d20('0x2'));var rp=require(_0x4d20('0x3'));var moment=require('moment');var BPromise=require(_0x4d20('0x4'));var Mustache=require(_0x4d20('0x5'));var util=require(_0x4d20('0x6'));var path=require(_0x4d20('0x7'));var sox=require(_0x4d20('0x8'));var csv=require(_0x4d20('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4d20('0xa'));var _=require('lodash');var squel=require(_0x4d20('0xb'));var crypto=require(_0x4d20('0xc'));var jsforce=require(_0x4d20('0xd'));var deskjs=require(_0x4d20('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x4d20('0xf'));var Redis=require(_0x4d20('0x10'));var authService=require(_0x4d20('0x11'));var qs=require(_0x4d20('0x12'));var as=require(_0x4d20('0x13'));var hardwareService=require(_0x4d20('0x14'));var logger=require(_0x4d20('0x15'))('api');var utils=require(_0x4d20('0x16'));var config=require(_0x4d20('0x17'));var licenseUtil=require(_0x4d20('0x18'));var db=require(_0x4d20('0x19'))['db'];function respondWithStatusCode(_0x4983aa,_0x141d14){_0x141d14=_0x141d14||0xcc;return function(_0x3507f1){if(_0x3507f1){return _0x4983aa[_0x4d20('0x1a')](_0x141d14);}return _0x4983aa[_0x4d20('0x1b')](_0x141d14)['end']();};}function respondWithResult(_0x35ea4d,_0x59edcb){_0x59edcb=_0x59edcb||0xc8;return function(_0x310672){if(_0x310672){return _0x35ea4d[_0x4d20('0x1b')](_0x59edcb)['json'](_0x310672);}};}function respondWithFilteredResult(_0x33a2c0,_0x15fcc0){return function(_0x1496a0){if(_0x1496a0){var _0x47f32d=typeof _0x15fcc0[_0x4d20('0x1c')]===_0x4d20('0x1d')&&typeof _0x15fcc0['limit']===_0x4d20('0x1d');var _0x576d13=_0x1496a0[_0x4d20('0x1e')];var _0x4b620f=_0x47f32d?0x0:_0x15fcc0[_0x4d20('0x1c')];var _0x2f2608=_0x47f32d?_0x1496a0[_0x4d20('0x1e')]:_0x15fcc0[_0x4d20('0x1c')]+_0x15fcc0['limit'];var _0x5bcead;if(_0x2f2608>=_0x576d13){_0x2f2608=_0x576d13;_0x5bcead=0xc8;}else{_0x5bcead=0xce;}_0x33a2c0[_0x4d20('0x1b')](_0x5bcead);return _0x33a2c0[_0x4d20('0x1f')](_0x4d20('0x20'),_0x4b620f+'-'+_0x2f2608+'/'+_0x576d13)[_0x4d20('0x21')](_0x1496a0);}return null;};}function patchUpdates(_0x53aa16){return function(_0x581f18){try{jsonpatch[_0x4d20('0x22')](_0x581f18,_0x53aa16,!![]);}catch(_0x3c1fce){return BPromise[_0x4d20('0x23')](_0x3c1fce);}return _0x581f18[_0x4d20('0x24')]();};}function saveUpdates(_0x413733,_0x216d3b){return function(_0x27d94f){if(_0x27d94f){return _0x27d94f['update'](_0x413733)[_0x4d20('0x25')](function(_0x5bca03){return _0x5bca03;});}return null;};}function removeEntity(_0x52ee1f,_0x112d97){return function(_0x1137f6){if(_0x1137f6){return _0x1137f6['destroy']()[_0x4d20('0x25')](function(){_0x52ee1f['status'](0xcc)[_0x4d20('0x26')]();});}};}function handleEntityNotFound(_0x2730ec,_0x42dc32){return function(_0x43b832){if(!_0x43b832){_0x2730ec[_0x4d20('0x1a')](0x194);}return _0x43b832;};}function handleError(_0x237396,_0x58ef11){_0x58ef11=_0x58ef11||0x1f4;return function(_0x889efc){logger[_0x4d20('0x27')](_0x889efc['stack']);if(_0x889efc['name']){delete _0x889efc['name'];}_0x237396['status'](_0x58ef11)[_0x4d20('0x28')](_0x889efc);};}exports['index']=function(_0x22d9ec,_0x490a57){var _0x5cdb47={},_0x1de4f5={},_0x25e54c={'count':0x0,'rows':[]};var _0x5c1364=_['map'](db['SmsQueueReport'][_0x4d20('0x29')],function(_0x659af8){return{'name':_0x659af8[_0x4d20('0x2a')],'type':_0x659af8['type']['key']};});_0x1de4f5['model']=_['map'](_0x5c1364,_0x4d20('0x2b'));_0x1de4f5['query']=_[_0x4d20('0x2c')](_0x22d9ec[_0x4d20('0x2d')]);_0x1de4f5['filters']=_[_0x4d20('0x2e')](_0x1de4f5[_0x4d20('0x2f')],_0x1de4f5[_0x4d20('0x2d')]);_0x5cdb47['attributes']=_[_0x4d20('0x2e')](_0x1de4f5['model'],qs[_0x4d20('0x30')](_0x22d9ec[_0x4d20('0x2d')]['fields']));_0x5cdb47[_0x4d20('0x31')]=_0x5cdb47['attributes'][_0x4d20('0x32')]?_0x5cdb47[_0x4d20('0x31')]:_0x1de4f5['model'];if(!_0x22d9ec[_0x4d20('0x2d')][_0x4d20('0x33')](_0x4d20('0x34'))){_0x5cdb47[_0x4d20('0x35')]=qs[_0x4d20('0x35')](_0x22d9ec[_0x4d20('0x2d')][_0x4d20('0x35')]);_0x5cdb47[_0x4d20('0x1c')]=qs[_0x4d20('0x1c')](_0x22d9ec[_0x4d20('0x2d')]['offset']);}_0x5cdb47[_0x4d20('0x36')]=qs[_0x4d20('0x37')](_0x22d9ec[_0x4d20('0x2d')]['sort']);_0x5cdb47[_0x4d20('0x38')]=qs[_0x4d20('0x39')](_[_0x4d20('0x3a')](_0x22d9ec['query'],_0x1de4f5[_0x4d20('0x39')]),_0x5c1364);if(_0x22d9ec[_0x4d20('0x2d')]['filter']){_0x5cdb47['where']=_[_0x4d20('0x3b')](_0x5cdb47['where'],{'$or':_[_0x4d20('0x3c')](_0x5c1364,function(_0x56f8c4){if(_0x56f8c4['type']!==_0x4d20('0x3d')){var _0x4fa4d3={};_0x4fa4d3[_0x56f8c4[_0x4d20('0x2b')]]={'$like':'%'+_0x22d9ec[_0x4d20('0x2d')]['filter']+'%'};return _0x4fa4d3;}})});}_0x5cdb47=_[_0x4d20('0x3b')]({},_0x5cdb47,_0x22d9ec['options']);var _0x257220={'where':_0x5cdb47[_0x4d20('0x38')]};return db['SmsQueueReport'][_0x4d20('0x1e')](_0x257220)[_0x4d20('0x25')](function(_0x4f679b){_0x25e54c['count']=_0x4f679b;if(_0x22d9ec[_0x4d20('0x2d')][_0x4d20('0x3e')]){_0x5cdb47[_0x4d20('0x3f')]=[{'all':!![]}];}return db[_0x4d20('0x40')][_0x4d20('0x41')](_0x5cdb47);})[_0x4d20('0x25')](function(_0x57a440){_0x25e54c[_0x4d20('0x42')]=_0x57a440;return _0x25e54c;})[_0x4d20('0x25')](respondWithFilteredResult(_0x490a57,_0x5cdb47))[_0x4d20('0x43')](handleError(_0x490a57,null));};exports[_0x4d20('0x44')]=function(_0x55052c,_0x160766){var _0x363ee9={'raw':!![],'where':{'id':_0x55052c[_0x4d20('0x45')]['id']}},_0x706dec={};_0x706dec[_0x4d20('0x2f')]=_['keys'](db[_0x4d20('0x40')][_0x4d20('0x29')]);_0x706dec[_0x4d20('0x2d')]=_[_0x4d20('0x2c')](_0x55052c['query']);_0x706dec[_0x4d20('0x39')]=_[_0x4d20('0x2e')](_0x706dec[_0x4d20('0x2f')],_0x706dec['query']);_0x363ee9[_0x4d20('0x31')]=_['intersection'](_0x706dec[_0x4d20('0x2f')],qs[_0x4d20('0x30')](_0x55052c[_0x4d20('0x2d')]['fields']));_0x363ee9[_0x4d20('0x31')]=_0x363ee9['attributes'][_0x4d20('0x32')]?_0x363ee9['attributes']:_0x706dec[_0x4d20('0x2f')];if(_0x55052c[_0x4d20('0x2d')][_0x4d20('0x3e')]){_0x363ee9[_0x4d20('0x3f')]=[{'all':!![]}];}_0x363ee9=_[_0x4d20('0x3b')]({},_0x363ee9,_0x55052c[_0x4d20('0x46')]);return db[_0x4d20('0x40')][_0x4d20('0x47')](_0x363ee9)[_0x4d20('0x25')](handleEntityNotFound(_0x160766,null))[_0x4d20('0x25')](respondWithResult(_0x160766,null))[_0x4d20('0x43')](handleError(_0x160766,null));};exports[_0x4d20('0x48')]=function(_0x671c14,_0x499944){return db[_0x4d20('0x40')]['create'](_0x671c14[_0x4d20('0x49')],{})['then'](respondWithResult(_0x499944,0xc9))['catch'](handleError(_0x499944,null));};exports['update']=function(_0x4df899,_0x2139e5){if(_0x4df899[_0x4d20('0x49')]['id']){delete _0x4df899[_0x4d20('0x49')]['id'];}return db['SmsQueueReport']['find']({'where':{'id':_0x4df899['params']['id']}})[_0x4d20('0x25')](handleEntityNotFound(_0x2139e5,null))[_0x4d20('0x25')](saveUpdates(_0x4df899[_0x4d20('0x49')],null))[_0x4d20('0x25')](respondWithResult(_0x2139e5,null))[_0x4d20('0x43')](handleError(_0x2139e5,null));};exports['destroy']=function(_0x505932,_0xc3d4bf){return db['SmsQueueReport'][_0x4d20('0x47')]({'where':{'id':_0x505932['params']['id']}})[_0x4d20('0x25')](handleEntityNotFound(_0xc3d4bf,null))[_0x4d20('0x25')](removeEntity(_0xc3d4bf,null))[_0x4d20('0x43')](handleError(_0xc3d4bf,null));};exports[_0x4d20('0x4a')]=function(_0x54f571,_0x1e7293){return db[_0x4d20('0x40')][_0x4d20('0x4a')]()[_0x4d20('0x25')](respondWithResult(_0x1e7293,null))[_0x4d20('0x43')](handleError(_0x1e7293,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index b6bae33..cf9b04d 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(_0x2fee0b,_0x43ab54){var _0x357d87=function(_0x3fbfb1){while(--_0x3fbfb1){_0x2fee0b['push'](_0x2fee0b['shift']());}};_0x357d87(++_0x43ab54);}(_0xbaf0,0x12a));var _0x0baf=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xbaf0[_0x6c993a];return _0x27f547;};'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 _0xcb91=['path','rimraf','./smsQueueReport.attributes','exports','define','report_sms_queue','uniqueid','../../config/logger','api','moment','bluebird'];(function(_0x579804,_0x5b1cfd){var _0x2e3b29=function(_0x5ca2ed){while(--_0x5ca2ed){_0x579804['push'](_0x579804['shift']());}};_0x2e3b29(++_0x5b1cfd);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x37c07d,_0xdbdb5f){_0x37c07d=_0x37c07d-0x0;var _0x10dadc=_0xcb91[_0x37c07d];return _0x10dadc;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1cb9('0x0'))(_0x1cb9('0x1'));var moment=require(_0x1cb9('0x2'));var BPromise=require(_0x1cb9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1cb9('0x4'));var rimraf=require(_0x1cb9('0x5'));var config=require('../../config/environment');var attributes=require(_0x1cb9('0x6'));module[_0x1cb9('0x7')]=function(_0x53ffbd,_0x226b69){return _0x53ffbd[_0x1cb9('0x8')]('SmsQueueReport',attributes,{'tableName':_0x1cb9('0x9'),'paranoid':![],'indexes':[{'name':_0x1cb9('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index b1180fe..81e2441 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 _0x6ef7=['jayson/promise','client','http','request','then','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSmsQueueReport','SmsQueueReport','create','options','raw','update','where','attributes','limit','UpdateSmsQueueReport','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x86b219,_0x43038f){var _0x1f320c=function(_0x8cd63f){while(--_0x8cd63f){_0x86b219['push'](_0x86b219['shift']());}};_0x1f320c(++_0x43038f);}(_0x6ef7,0xe0));var _0x76ef=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6ef7[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0x76ef('0x0'));var moment=require(_0x76ef('0x1'));var BPromise=require(_0x76ef('0x2'));var rs=require(_0x76ef('0x3'));var fs=require('fs');var Redis=require(_0x76ef('0x4'));var db=require(_0x76ef('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x76ef('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x76ef('0x7'));var client=jayson[_0x76ef('0x8')][_0x76ef('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x416e13,_0x2624a3,_0xb2b2ab){return new BPromise(function(_0x3558d6,_0x18fccf){return client[_0x76ef('0xa')](_0x416e13,_0xb2b2ab)[_0x76ef('0xb')](function(_0x13896d){logger[_0x76ef('0xc')](_0x76ef('0xd'),_0x2624a3,_0x76ef('0xe'));logger[_0x76ef('0xf')](_0x76ef('0x10'),_0x2624a3,_0x76ef('0xe'),JSON[_0x76ef('0x11')](_0x13896d));if(_0x13896d[_0x76ef('0x12')]){if(_0x13896d[_0x76ef('0x12')][_0x76ef('0x13')]===0x1f4){logger[_0x76ef('0x12')](_0x76ef('0xd'),_0x2624a3,_0x13896d[_0x76ef('0x12')][_0x76ef('0x14')]);return _0x18fccf(_0x13896d[_0x76ef('0x12')]['message']);}logger[_0x76ef('0x12')](_0x76ef('0xd'),_0x2624a3,_0x13896d[_0x76ef('0x12')][_0x76ef('0x14')]);return _0x3558d6(_0x13896d['error'][_0x76ef('0x14')]);}else{logger['info'](_0x76ef('0xd'),_0x2624a3,_0x76ef('0xe'));_0x3558d6(_0x13896d[_0x76ef('0x15')][_0x76ef('0x14')]);}})[_0x76ef('0x16')](function(_0x492086){logger[_0x76ef('0x12')](_0x76ef('0xd'),_0x2624a3,_0x492086);_0x18fccf(_0x492086);});});}exports[_0x76ef('0x17')]=function(_0x4172b2){var _0x1e8ee4=this;return new Promise(function(_0x3cbc09,_0x27ceff){return db[_0x76ef('0x18')][_0x76ef('0x19')](_0x4172b2['body'],{'raw':_0x4172b2[_0x76ef('0x1a')]?_0x4172b2[_0x76ef('0x1a')][_0x76ef('0x1b')]===undefined?!![]:![]:!![]})[_0x76ef('0xb')](function(_0x3b6359){logger['info'](_0x76ef('0x17'),_0x4172b2);logger['debug'](_0x76ef('0x17'),_0x4172b2,JSON[_0x76ef('0x11')](_0x3b6359));_0x3cbc09(_0x3b6359);})[_0x76ef('0x16')](function(_0x344fb3){logger['error']('CreateSmsQueueReport',_0x344fb3[_0x76ef('0x14')],_0x4172b2);_0x27ceff(_0x1e8ee4[_0x76ef('0x12')](0x1f4,_0x344fb3[_0x76ef('0x14')]));});});};exports['UpdateSmsQueueReport']=function(_0x41e376){var _0x20e481=this;return new Promise(function(_0x29dc9b,_0x56b659){return db['SmsQueueReport'][_0x76ef('0x1c')](_0x41e376['body'],{'raw':_0x41e376[_0x76ef('0x1a')]?_0x41e376[_0x76ef('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x41e376[_0x76ef('0x1a')]?_0x41e376[_0x76ef('0x1a')][_0x76ef('0x1d')]||null:null,'attributes':_0x41e376[_0x76ef('0x1a')]?_0x41e376['options'][_0x76ef('0x1e')]||null:null,'limit':_0x41e376[_0x76ef('0x1a')]?_0x41e376[_0x76ef('0x1a')][_0x76ef('0x1f')]||null:null})[_0x76ef('0xb')](function(_0x42124c){logger['info'](_0x76ef('0x20'),_0x41e376);logger[_0x76ef('0xf')](_0x76ef('0x20'),_0x41e376,JSON[_0x76ef('0x11')](_0x42124c));_0x29dc9b(_0x42124c);})['catch'](function(_0x2d6626){logger[_0x76ef('0x12')](_0x76ef('0x20'),_0x2d6626[_0x76ef('0x14')],_0x41e376);_0x56b659(_0x20e481[_0x76ef('0x12')](0x1f4,_0x2d6626[_0x76ef('0x14')]));});});}; \ No newline at end of file +var _0xa826=['then','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateSmsQueueReport','SmsQueueReport','options','raw','debug','update','body','where','attributes','UpdateSmsQueueReport','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request'];(function(_0x3092d6,_0x2c22ff){var _0x1fe374=function(_0x21fd12){while(--_0x21fd12){_0x3092d6['push'](_0x3092d6['shift']());}};_0x1fe374(++_0x2c22ff);}(_0xa826,0x1f4));var _0x6a82=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xa826[_0x5b644e];return _0x49c6bf;};'use strict';var _=require('lodash');var util=require(_0x6a82('0x0'));var moment=require('moment');var BPromise=require(_0x6a82('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6a82('0x2'));var db=require(_0x6a82('0x3'))['db'];var utils=require(_0x6a82('0x4'));var logger=require(_0x6a82('0x5'))(_0x6a82('0x6'));var config=require(_0x6a82('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x6a82('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x549474,_0x58b247,_0x5bea26){return new BPromise(function(_0xfe64f3,_0x2f73a9){return client[_0x6a82('0x9')](_0x549474,_0x5bea26)[_0x6a82('0xa')](function(_0x463702){logger[_0x6a82('0xb')](_0x6a82('0xc'),_0x58b247,_0x6a82('0xd'));logger['debug'](_0x6a82('0xe'),_0x58b247,_0x6a82('0xd'),JSON[_0x6a82('0xf')](_0x463702));if(_0x463702[_0x6a82('0x10')]){if(_0x463702['error']['code']===0x1f4){logger[_0x6a82('0x10')]('SmsQueueReport,\x20%s,\x20%s',_0x58b247,_0x463702['error'][_0x6a82('0x11')]);return _0x2f73a9(_0x463702['error'][_0x6a82('0x11')]);}logger[_0x6a82('0x10')](_0x6a82('0xc'),_0x58b247,_0x463702[_0x6a82('0x10')][_0x6a82('0x11')]);return _0xfe64f3(_0x463702[_0x6a82('0x10')]['message']);}else{logger[_0x6a82('0xb')]('SmsQueueReport,\x20%s,\x20%s',_0x58b247,'request\x20sent');_0xfe64f3(_0x463702[_0x6a82('0x12')][_0x6a82('0x11')]);}})[_0x6a82('0x13')](function(_0x36d7a7){logger[_0x6a82('0x10')](_0x6a82('0xc'),_0x58b247,_0x36d7a7);_0x2f73a9(_0x36d7a7);});});}exports[_0x6a82('0x14')]=function(_0x26e5dd){var _0xb4c503=this;return new Promise(function(_0xc3625f,_0x9641c){return db[_0x6a82('0x15')]['create'](_0x26e5dd['body'],{'raw':_0x26e5dd[_0x6a82('0x16')]?_0x26e5dd['options'][_0x6a82('0x17')]===undefined?!![]:![]:!![]})[_0x6a82('0xa')](function(_0x4112c3){logger['info']('CreateSmsQueueReport',_0x26e5dd);logger[_0x6a82('0x18')]('CreateSmsQueueReport',_0x26e5dd,JSON['stringify'](_0x4112c3));_0xc3625f(_0x4112c3);})[_0x6a82('0x13')](function(_0x3d0f1f){logger['error'](_0x6a82('0x14'),_0x3d0f1f[_0x6a82('0x11')],_0x26e5dd);_0x9641c(_0xb4c503['error'](0x1f4,_0x3d0f1f[_0x6a82('0x11')]));});});};exports['UpdateSmsQueueReport']=function(_0x2a0ced){var _0x502f2f=this;return new Promise(function(_0x16a19b,_0x20aacc){return db[_0x6a82('0x15')][_0x6a82('0x19')](_0x2a0ced[_0x6a82('0x1a')],{'raw':_0x2a0ced['options']?_0x2a0ced['options'][_0x6a82('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2a0ced[_0x6a82('0x16')]?_0x2a0ced[_0x6a82('0x16')][_0x6a82('0x1b')]||null:null,'attributes':_0x2a0ced[_0x6a82('0x16')]?_0x2a0ced['options'][_0x6a82('0x1c')]||null:null,'limit':_0x2a0ced['options']?_0x2a0ced[_0x6a82('0x16')]['limit']||null:null})[_0x6a82('0xa')](function(_0x130aa9){logger[_0x6a82('0xb')](_0x6a82('0x1d'),_0x2a0ced);logger[_0x6a82('0x18')](_0x6a82('0x1d'),_0x2a0ced,JSON[_0x6a82('0xf')](_0x130aa9));_0x16a19b(_0x130aa9);})[_0x6a82('0x13')](function(_0x257a21){logger[_0x6a82('0x10')](_0x6a82('0x1d'),_0x257a21[_0x6a82('0x11')],_0x2a0ced);_0x20aacc(_0x502f2f[_0x6a82('0x10')](0x1f4,_0x257a21['message']));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index e12ba5f..f10daaa 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 _0x5075=['get','isAuthenticated','describe','show','post','create','/:id','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsTransferReport.controller','index'];(function(_0xcd9668,_0x376ccd){var _0x488dc4=function(_0x24f7a6){while(--_0x24f7a6){_0xcd9668['push'](_0xcd9668['shift']());}};_0x488dc4(++_0x376ccd);}(_0x5075,0x73));var _0x5507=function(_0x1df7b8,_0x2fe5e5){_0x1df7b8=_0x1df7b8-0x0;var _0x29d911=_0x5075[_0x1df7b8];return _0x29d911;};'use strict';var multer=require(_0x5507('0x0'));var util=require(_0x5507('0x1'));var path=require(_0x5507('0x2'));var timeout=require(_0x5507('0x3'));var express=require(_0x5507('0x4'));var router=express[_0x5507('0x5')]();var fs_extra=require(_0x5507('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x5507('0x7'));var config=require(_0x5507('0x8'));var controller=require(_0x5507('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x5507('0xa')]);router[_0x5507('0xb')]('/describe',auth[_0x5507('0xc')](),controller[_0x5507('0xd')]);router[_0x5507('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x5507('0xe')]);router[_0x5507('0xf')]('/',auth[_0x5507('0xc')](),controller[_0x5507('0x10')]);router['put'](_0x5507('0x11'),auth[_0x5507('0xc')](),controller['update']);router[_0x5507('0x12')](_0x5507('0x11'),auth['isAuthenticated'](),controller[_0x5507('0x13')]);module[_0x5507('0x14')]=router; \ No newline at end of file +var _0xc949=['show','post','create','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./smsTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x11054a,_0x58dc9d){var _0x371a80=function(_0x5c260c){while(--_0x5c260c){_0x11054a['push'](_0x11054a['shift']());}};_0x371a80(++_0x58dc9d);}(_0xc949,0x181));var _0x9c94=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0xc949[_0x187ee1];return _0x388160;};'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')]('/',auth[_0x9c94('0x9')](),controller[_0x9c94('0xa')]);router['get'](_0x9c94('0xb'),auth[_0x9c94('0x9')](),controller[_0x9c94('0xc')]);router[_0x9c94('0x8')](_0x9c94('0xd'),auth[_0x9c94('0x9')](),controller[_0x9c94('0xe')]);router[_0x9c94('0xf')]('/',auth[_0x9c94('0x9')](),controller[_0x9c94('0x10')]);router['put'](_0x9c94('0xd'),auth[_0x9c94('0x9')](),controller[_0x9c94('0x11')]);router[_0x9c94('0x12')](_0x9c94('0xd'),auth[_0x9c94('0x9')](),controller[_0x9c94('0x13')]);module[_0x9c94('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 3c9d09a..0b952c0 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 _0x00bb=['moment','sequelize','exports','ENUM','agent','queue','DATE','NOW'];(function(_0x4aa7cd,_0x2ee3c1){var _0x84be32=function(_0x10b2e7){while(--_0x10b2e7){_0x4aa7cd['push'](_0x4aa7cd['shift']());}};_0x84be32(++_0x2ee3c1);}(_0x00bb,0x1d8));var _0xb00b=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0x00bb[_0x3ff085];return _0x2b68c3;};'use strict';var moment=require(_0xb00b('0x0'));var Sequelize=require(_0xb00b('0x1'));module[_0xb00b('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xb00b('0x3')]('account',_0xb00b('0x4'),_0xb00b('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0xb00b('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xb00b('0x7')]}}; \ No newline at end of file +var _0x9c44=['ENUM','account','agent','queue','NOW','exports','STRING'];(function(_0x1667df,_0x266940){var _0x341abf=function(_0x123c3f){while(--_0x123c3f){_0x1667df['push'](_0x1667df['shift']());}};_0x341abf(++_0x266940);}(_0x9c44,0x178));var _0x49c4=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0x9c44[_0x68c979];return _0x4f0001;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x49c4('0x0')]={'uniqueid':{'type':Sequelize[_0x49c4('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x49c4('0x2')](_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x49c4('0x6')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index 4f0d9a3..9c0b85e 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 _0xc32f=['rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','index','map','rawAttributes','fieldName','type','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','SmsTransferReport','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe'];(function(_0x45ef66,_0x3f609e){var _0x3847cf=function(_0x4875e5){while(--_0x4875e5){_0x45ef66['push'](_0x45ef66['shift']());}};_0x3847cf(++_0x3f609e);}(_0xc32f,0xed));var _0xfc32=function(_0x3f67ab,_0x5a843c){_0x3f67ab=_0x3f67ab-0x0;var _0x13d5ae=_0xc32f[_0x3f67ab];return _0x13d5ae;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfc32('0x0'));var zipdir=require(_0xfc32('0x1'));var jsonpatch=require(_0xfc32('0x2'));var rp=require(_0xfc32('0x3'));var moment=require(_0xfc32('0x4'));var BPromise=require(_0xfc32('0x5'));var Mustache=require(_0xfc32('0x6'));var util=require(_0xfc32('0x7'));var path=require(_0xfc32('0x8'));var sox=require(_0xfc32('0x9'));var csv=require(_0xfc32('0xa'));var ejs=require(_0xfc32('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xfc32('0xc'));var crypto=require(_0xfc32('0xd'));var jsforce=require(_0xfc32('0xe'));var deskjs=require(_0xfc32('0xf'));var toCsv=require(_0xfc32('0xa'));var querystring=require(_0xfc32('0x10'));var Papa=require(_0xfc32('0x11'));var Redis=require(_0xfc32('0x12'));var authService=require(_0xfc32('0x13'));var qs=require(_0xfc32('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xfc32('0x15'))('api');var utils=require(_0xfc32('0x16'));var config=require(_0xfc32('0x17'));var licenseUtil=require(_0xfc32('0x18'));var db=require(_0xfc32('0x19'))['db'];function respondWithStatusCode(_0x4f5df2,_0x5c1a0f){_0x5c1a0f=_0x5c1a0f||0xcc;return function(_0x194cb2){if(_0x194cb2){return _0x4f5df2[_0xfc32('0x1a')](_0x5c1a0f);}return _0x4f5df2[_0xfc32('0x1b')](_0x5c1a0f)[_0xfc32('0x1c')]();};}function respondWithResult(_0x3693e6,_0x21c398){_0x21c398=_0x21c398||0xc8;return function(_0x98498e){if(_0x98498e){return _0x3693e6[_0xfc32('0x1b')](_0x21c398)[_0xfc32('0x1d')](_0x98498e);}};}function respondWithFilteredResult(_0x4d1220,_0x4325ec){return function(_0x277e0e){if(_0x277e0e){var _0x67c3bc=typeof _0x4325ec[_0xfc32('0x1e')]==='undefined'&&typeof _0x4325ec['limit']===_0xfc32('0x1f');var _0xeafc07=_0x277e0e['count'];var _0xe863ff=_0x67c3bc?0x0:_0x4325ec[_0xfc32('0x1e')];var _0x3a1965=_0x67c3bc?_0x277e0e[_0xfc32('0x20')]:_0x4325ec['offset']+_0x4325ec[_0xfc32('0x21')];var _0x4bbeef;if(_0x3a1965>=_0xeafc07){_0x3a1965=_0xeafc07;_0x4bbeef=0xc8;}else{_0x4bbeef=0xce;}_0x4d1220['status'](_0x4bbeef);return _0x4d1220[_0xfc32('0x22')](_0xfc32('0x23'),_0xe863ff+'-'+_0x3a1965+'/'+_0xeafc07)['json'](_0x277e0e);}return null;};}function patchUpdates(_0x2ca882){return function(_0x2c1bb6){try{jsonpatch[_0xfc32('0x24')](_0x2c1bb6,_0x2ca882,!![]);}catch(_0x1623f5){return BPromise[_0xfc32('0x25')](_0x1623f5);}return _0x2c1bb6[_0xfc32('0x26')]();};}function saveUpdates(_0x3f9749,_0xfcd1c9){return function(_0x2f6183){if(_0x2f6183){return _0x2f6183[_0xfc32('0x27')](_0x3f9749)[_0xfc32('0x28')](function(_0x2ff5f9){return _0x2ff5f9;});}return null;};}function removeEntity(_0x644122,_0x218787){return function(_0x1d6c5a){if(_0x1d6c5a){return _0x1d6c5a[_0xfc32('0x29')]()[_0xfc32('0x28')](function(){_0x644122[_0xfc32('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x287477,_0x450ffa){return function(_0x2f18ec){if(!_0x2f18ec){_0x287477[_0xfc32('0x1a')](0x194);}return _0x2f18ec;};}function handleError(_0x422f23,_0x407b9d){_0x407b9d=_0x407b9d||0x1f4;return function(_0x63dc2d){logger[_0xfc32('0x2a')](_0x63dc2d[_0xfc32('0x2b')]);if(_0x63dc2d[_0xfc32('0x2c')]){delete _0x63dc2d[_0xfc32('0x2c')];}_0x422f23[_0xfc32('0x1b')](_0x407b9d)['send'](_0x63dc2d);};}exports[_0xfc32('0x2d')]=function(_0x350b7d,_0x13d265){var _0x1701cc={},_0x13c92a={},_0x248c18={'count':0x0,'rows':[]};var _0x1d351f=_[_0xfc32('0x2e')](db['SmsTransferReport'][_0xfc32('0x2f')],function(_0x5e448b){return{'name':_0x5e448b[_0xfc32('0x30')],'type':_0x5e448b[_0xfc32('0x31')]['key']};});_0x13c92a[_0xfc32('0x32')]=_[_0xfc32('0x2e')](_0x1d351f,_0xfc32('0x2c'));_0x13c92a[_0xfc32('0x33')]=_[_0xfc32('0x34')](_0x350b7d['query']);_0x13c92a['filters']=_['intersection'](_0x13c92a[_0xfc32('0x32')],_0x13c92a[_0xfc32('0x33')]);_0x1701cc['attributes']=_[_0xfc32('0x35')](_0x13c92a['model'],qs['fields'](_0x350b7d[_0xfc32('0x33')][_0xfc32('0x36')]));_0x1701cc[_0xfc32('0x37')]=_0x1701cc[_0xfc32('0x37')][_0xfc32('0x38')]?_0x1701cc[_0xfc32('0x37')]:_0x13c92a[_0xfc32('0x32')];if(!_0x350b7d['query'][_0xfc32('0x39')](_0xfc32('0x3a'))){_0x1701cc[_0xfc32('0x21')]=qs['limit'](_0x350b7d[_0xfc32('0x33')][_0xfc32('0x21')]);_0x1701cc['offset']=qs['offset'](_0x350b7d[_0xfc32('0x33')][_0xfc32('0x1e')]);}_0x1701cc[_0xfc32('0x3b')]=qs[_0xfc32('0x3c')](_0x350b7d[_0xfc32('0x33')][_0xfc32('0x3c')]);_0x1701cc[_0xfc32('0x3d')]=qs['filters'](_['pick'](_0x350b7d[_0xfc32('0x33')],_0x13c92a[_0xfc32('0x3e')]),_0x1d351f);if(_0x350b7d[_0xfc32('0x33')][_0xfc32('0x3f')]){_0x1701cc[_0xfc32('0x3d')]=_[_0xfc32('0x40')](_0x1701cc[_0xfc32('0x3d')],{'$or':_['map'](_0x1d351f,function(_0x19ad85){if(_0x19ad85[_0xfc32('0x31')]!==_0xfc32('0x41')){var _0x479e01={};_0x479e01[_0x19ad85[_0xfc32('0x2c')]]={'$like':'%'+_0x350b7d[_0xfc32('0x33')][_0xfc32('0x3f')]+'%'};return _0x479e01;}})});}_0x1701cc=_[_0xfc32('0x40')]({},_0x1701cc,_0x350b7d[_0xfc32('0x42')]);var _0x4d6c24={'where':_0x1701cc[_0xfc32('0x3d')]};return db[_0xfc32('0x43')][_0xfc32('0x20')](_0x4d6c24)[_0xfc32('0x28')](function(_0x23ae74){_0x248c18[_0xfc32('0x20')]=_0x23ae74;if(_0x350b7d[_0xfc32('0x33')][_0xfc32('0x44')]){_0x1701cc[_0xfc32('0x45')]=[{'all':!![]}];}return db[_0xfc32('0x43')][_0xfc32('0x46')](_0x1701cc);})[_0xfc32('0x28')](function(_0x5e7c8e){_0x248c18[_0xfc32('0x47')]=_0x5e7c8e;return _0x248c18;})[_0xfc32('0x28')](respondWithFilteredResult(_0x13d265,_0x1701cc))[_0xfc32('0x48')](handleError(_0x13d265,null));};exports[_0xfc32('0x49')]=function(_0x2a144c,_0x493cd6){var _0x5ca32={'raw':!![],'where':{'id':_0x2a144c[_0xfc32('0x4a')]['id']}},_0x4b112d={};_0x4b112d[_0xfc32('0x32')]=_['keys'](db['SmsTransferReport'][_0xfc32('0x2f')]);_0x4b112d[_0xfc32('0x33')]=_[_0xfc32('0x34')](_0x2a144c[_0xfc32('0x33')]);_0x4b112d[_0xfc32('0x3e')]=_[_0xfc32('0x35')](_0x4b112d[_0xfc32('0x32')],_0x4b112d['query']);_0x5ca32[_0xfc32('0x37')]=_[_0xfc32('0x35')](_0x4b112d[_0xfc32('0x32')],qs['fields'](_0x2a144c[_0xfc32('0x33')]['fields']));_0x5ca32[_0xfc32('0x37')]=_0x5ca32[_0xfc32('0x37')][_0xfc32('0x38')]?_0x5ca32[_0xfc32('0x37')]:_0x4b112d[_0xfc32('0x32')];if(_0x2a144c[_0xfc32('0x33')]['includeAll']){_0x5ca32[_0xfc32('0x45')]=[{'all':!![]}];}_0x5ca32=_['merge']({},_0x5ca32,_0x2a144c[_0xfc32('0x42')]);return db['SmsTransferReport'][_0xfc32('0x4b')](_0x5ca32)[_0xfc32('0x28')](handleEntityNotFound(_0x493cd6,null))[_0xfc32('0x28')](respondWithResult(_0x493cd6,null))[_0xfc32('0x48')](handleError(_0x493cd6,null));};exports[_0xfc32('0x4c')]=function(_0x38092b,_0x5938ea){return db['SmsTransferReport'][_0xfc32('0x4c')](_0x38092b[_0xfc32('0x4d')],{})[_0xfc32('0x28')](respondWithResult(_0x5938ea,0xc9))[_0xfc32('0x48')](handleError(_0x5938ea,null));};exports[_0xfc32('0x27')]=function(_0x455a2b,_0x21d629){if(_0x455a2b[_0xfc32('0x4d')]['id']){delete _0x455a2b[_0xfc32('0x4d')]['id'];}return db[_0xfc32('0x43')][_0xfc32('0x4b')]({'where':{'id':_0x455a2b[_0xfc32('0x4a')]['id']}})[_0xfc32('0x28')](handleEntityNotFound(_0x21d629,null))[_0xfc32('0x28')](saveUpdates(_0x455a2b[_0xfc32('0x4d')],null))[_0xfc32('0x28')](respondWithResult(_0x21d629,null))[_0xfc32('0x48')](handleError(_0x21d629,null));};exports[_0xfc32('0x29')]=function(_0x1981d2,_0x3b22c1){return db[_0xfc32('0x43')]['find']({'where':{'id':_0x1981d2[_0xfc32('0x4a')]['id']}})[_0xfc32('0x28')](handleEntityNotFound(_0x3b22c1,null))['then'](removeEntity(_0x3b22c1,null))['catch'](handleError(_0x3b22c1,null));};exports[_0xfc32('0x4e')]=function(_0xd568cb,_0x27a02b){return db[_0xfc32('0x43')][_0xfc32('0x4e')]()['then'](respondWithResult(_0x27a02b,null))[_0xfc32('0x48')](handleError(_0x27a02b,null));}; \ No newline at end of file +var _0x69d5=['destroy','stack','name','send','index','map','SmsTransferReport','type','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','merge','filter','options','findAll','rows','rawAttributes','includeAll','include','catch','create','body','find','params','describe','eml-format','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/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','then'];(function(_0x3dea7d,_0x2cd4ea){var _0x53919a=function(_0x1554e2){while(--_0x1554e2){_0x3dea7d['push'](_0x3dea7d['shift']());}};_0x53919a(++_0x2cd4ea);}(_0x69d5,0x70));var _0x569d=function(_0xace50c,_0x1f1c70){_0xace50c=_0xace50c-0x0;var _0x31e16b=_0x69d5[_0xace50c];return _0x31e16b;};'use strict';var emlformat=require(_0x569d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x569d('0x1'));var jsonpatch=require(_0x569d('0x2'));var rp=require(_0x569d('0x3'));var moment=require(_0x569d('0x4'));var BPromise=require(_0x569d('0x5'));var Mustache=require(_0x569d('0x6'));var util=require(_0x569d('0x7'));var path=require(_0x569d('0x8'));var sox=require(_0x569d('0x9'));var csv=require(_0x569d('0xa'));var ejs=require(_0x569d('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x569d('0xc'));var squel=require(_0x569d('0xd'));var crypto=require(_0x569d('0xe'));var jsforce=require(_0x569d('0xf'));var deskjs=require(_0x569d('0x10'));var toCsv=require(_0x569d('0xa'));var querystring=require('querystring');var Papa=require(_0x569d('0x11'));var Redis=require(_0x569d('0x12'));var authService=require(_0x569d('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x569d('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x569d('0x15'))(_0x569d('0x16'));var utils=require(_0x569d('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x569d('0x18'));var db=require(_0x569d('0x19'))['db'];function respondWithStatusCode(_0x1e05cf,_0x22a913){_0x22a913=_0x22a913||0xcc;return function(_0x25a370){if(_0x25a370){return _0x1e05cf[_0x569d('0x1a')](_0x22a913);}return _0x1e05cf[_0x569d('0x1b')](_0x22a913)[_0x569d('0x1c')]();};}function respondWithResult(_0x56193e,_0x53ebef){_0x53ebef=_0x53ebef||0xc8;return function(_0x133ce5){if(_0x133ce5){return _0x56193e[_0x569d('0x1b')](_0x53ebef)['json'](_0x133ce5);}};}function respondWithFilteredResult(_0xa0a93c,_0x2705b4){return function(_0xb6efac){if(_0xb6efac){var _0x8174e6=typeof _0x2705b4[_0x569d('0x1d')]===_0x569d('0x1e')&&typeof _0x2705b4[_0x569d('0x1f')]===_0x569d('0x1e');var _0x104a25=_0xb6efac[_0x569d('0x20')];var _0x55e6c7=_0x8174e6?0x0:_0x2705b4['offset'];var _0x22db0b=_0x8174e6?_0xb6efac['count']:_0x2705b4[_0x569d('0x1d')]+_0x2705b4[_0x569d('0x1f')];var _0x17a148;if(_0x22db0b>=_0x104a25){_0x22db0b=_0x104a25;_0x17a148=0xc8;}else{_0x17a148=0xce;}_0xa0a93c['status'](_0x17a148);return _0xa0a93c[_0x569d('0x21')](_0x569d('0x22'),_0x55e6c7+'-'+_0x22db0b+'/'+_0x104a25)[_0x569d('0x23')](_0xb6efac);}return null;};}function patchUpdates(_0x47cca1){return function(_0x13e5bf){try{jsonpatch[_0x569d('0x24')](_0x13e5bf,_0x47cca1,!![]);}catch(_0x4407c5){return BPromise['reject'](_0x4407c5);}return _0x13e5bf[_0x569d('0x25')]();};}function saveUpdates(_0x28646f,_0x4f0935){return function(_0x45b699){if(_0x45b699){return _0x45b699[_0x569d('0x26')](_0x28646f)[_0x569d('0x27')](function(_0x1a0818){return _0x1a0818;});}return null;};}function removeEntity(_0x2f46a3,_0x2ad7b6){return function(_0x113960){if(_0x113960){return _0x113960[_0x569d('0x28')]()['then'](function(){_0x2f46a3[_0x569d('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4dc811,_0x4a3d87){return function(_0x5bc3fe){if(!_0x5bc3fe){_0x4dc811[_0x569d('0x1a')](0x194);}return _0x5bc3fe;};}function handleError(_0xc85607,_0x4566ec){_0x4566ec=_0x4566ec||0x1f4;return function(_0x288d10){logger['error'](_0x288d10[_0x569d('0x29')]);if(_0x288d10[_0x569d('0x2a')]){delete _0x288d10['name'];}_0xc85607[_0x569d('0x1b')](_0x4566ec)[_0x569d('0x2b')](_0x288d10);};}exports[_0x569d('0x2c')]=function(_0xbfae16,_0x52f992){var _0x4f24fe={},_0x18f96b={},_0x306be2={'count':0x0,'rows':[]};var _0x376aeb=_[_0x569d('0x2d')](db[_0x569d('0x2e')]['rawAttributes'],function(_0x1444c0){return{'name':_0x1444c0['fieldName'],'type':_0x1444c0[_0x569d('0x2f')][_0x569d('0x30')]};});_0x18f96b[_0x569d('0x31')]=_[_0x569d('0x2d')](_0x376aeb,'name');_0x18f96b[_0x569d('0x32')]=_[_0x569d('0x33')](_0xbfae16[_0x569d('0x32')]);_0x18f96b[_0x569d('0x34')]=_['intersection'](_0x18f96b[_0x569d('0x31')],_0x18f96b[_0x569d('0x32')]);_0x4f24fe[_0x569d('0x35')]=_[_0x569d('0x36')](_0x18f96b[_0x569d('0x31')],qs['fields'](_0xbfae16[_0x569d('0x32')][_0x569d('0x37')]));_0x4f24fe['attributes']=_0x4f24fe[_0x569d('0x35')][_0x569d('0x38')]?_0x4f24fe[_0x569d('0x35')]:_0x18f96b[_0x569d('0x31')];if(!_0xbfae16[_0x569d('0x32')]['hasOwnProperty'](_0x569d('0x39'))){_0x4f24fe[_0x569d('0x1f')]=qs[_0x569d('0x1f')](_0xbfae16[_0x569d('0x32')][_0x569d('0x1f')]);_0x4f24fe[_0x569d('0x1d')]=qs['offset'](_0xbfae16['query'][_0x569d('0x1d')]);}_0x4f24fe[_0x569d('0x3a')]=qs[_0x569d('0x3b')](_0xbfae16[_0x569d('0x32')]['sort']);_0x4f24fe[_0x569d('0x3c')]=qs[_0x569d('0x34')](_[_0x569d('0x3d')](_0xbfae16['query'],_0x18f96b[_0x569d('0x34')]),_0x376aeb);if(_0xbfae16[_0x569d('0x32')]['filter']){_0x4f24fe[_0x569d('0x3c')]=_[_0x569d('0x3e')](_0x4f24fe[_0x569d('0x3c')],{'$or':_[_0x569d('0x2d')](_0x376aeb,function(_0x1e508c){if(_0x1e508c[_0x569d('0x2f')]!=='VIRTUAL'){var _0x45954b={};_0x45954b[_0x1e508c[_0x569d('0x2a')]]={'$like':'%'+_0xbfae16[_0x569d('0x32')][_0x569d('0x3f')]+'%'};return _0x45954b;}})});}_0x4f24fe=_[_0x569d('0x3e')]({},_0x4f24fe,_0xbfae16[_0x569d('0x40')]);var _0x1636a7={'where':_0x4f24fe[_0x569d('0x3c')]};return db[_0x569d('0x2e')]['count'](_0x1636a7)[_0x569d('0x27')](function(_0x403556){_0x306be2[_0x569d('0x20')]=_0x403556;if(_0xbfae16[_0x569d('0x32')]['includeAll']){_0x4f24fe['include']=[{'all':!![]}];}return db[_0x569d('0x2e')][_0x569d('0x41')](_0x4f24fe);})[_0x569d('0x27')](function(_0x1220ce){_0x306be2[_0x569d('0x42')]=_0x1220ce;return _0x306be2;})[_0x569d('0x27')](respondWithFilteredResult(_0x52f992,_0x4f24fe))['catch'](handleError(_0x52f992,null));};exports['show']=function(_0x4adc3a,_0x152a9b){var _0x23fbc9={'raw':!![],'where':{'id':_0x4adc3a['params']['id']}},_0x4e6925={};_0x4e6925[_0x569d('0x31')]=_[_0x569d('0x33')](db['SmsTransferReport'][_0x569d('0x43')]);_0x4e6925[_0x569d('0x32')]=_['keys'](_0x4adc3a[_0x569d('0x32')]);_0x4e6925[_0x569d('0x34')]=_[_0x569d('0x36')](_0x4e6925[_0x569d('0x31')],_0x4e6925[_0x569d('0x32')]);_0x23fbc9[_0x569d('0x35')]=_['intersection'](_0x4e6925[_0x569d('0x31')],qs[_0x569d('0x37')](_0x4adc3a[_0x569d('0x32')][_0x569d('0x37')]));_0x23fbc9[_0x569d('0x35')]=_0x23fbc9[_0x569d('0x35')][_0x569d('0x38')]?_0x23fbc9[_0x569d('0x35')]:_0x4e6925[_0x569d('0x31')];if(_0x4adc3a['query'][_0x569d('0x44')]){_0x23fbc9[_0x569d('0x45')]=[{'all':!![]}];}_0x23fbc9=_[_0x569d('0x3e')]({},_0x23fbc9,_0x4adc3a[_0x569d('0x40')]);return db['SmsTransferReport']['find'](_0x23fbc9)[_0x569d('0x27')](handleEntityNotFound(_0x152a9b,null))[_0x569d('0x27')](respondWithResult(_0x152a9b,null))[_0x569d('0x46')](handleError(_0x152a9b,null));};exports['create']=function(_0x2b2d21,_0x570e8d){return db[_0x569d('0x2e')][_0x569d('0x47')](_0x2b2d21[_0x569d('0x48')],{})[_0x569d('0x27')](respondWithResult(_0x570e8d,0xc9))[_0x569d('0x46')](handleError(_0x570e8d,null));};exports[_0x569d('0x26')]=function(_0x593964,_0x58de8b){if(_0x593964['body']['id']){delete _0x593964[_0x569d('0x48')]['id'];}return db['SmsTransferReport'][_0x569d('0x49')]({'where':{'id':_0x593964[_0x569d('0x4a')]['id']}})[_0x569d('0x27')](handleEntityNotFound(_0x58de8b,null))[_0x569d('0x27')](saveUpdates(_0x593964['body'],null))[_0x569d('0x27')](respondWithResult(_0x58de8b,null))[_0x569d('0x46')](handleError(_0x58de8b,null));};exports[_0x569d('0x28')]=function(_0x19bd34,_0x103111){return db[_0x569d('0x2e')][_0x569d('0x49')]({'where':{'id':_0x19bd34[_0x569d('0x4a')]['id']}})['then'](handleEntityNotFound(_0x103111,null))[_0x569d('0x27')](removeEntity(_0x103111,null))['catch'](handleError(_0x103111,null));};exports[_0x569d('0x4b')]=function(_0x2d9fc5,_0x1c0315){return db['SmsTransferReport'][_0x569d('0x4b')]()[_0x569d('0x27')](respondWithResult(_0x1c0315,null))[_0x569d('0x46')](handleError(_0x1c0315,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 5401ace..9f687f7 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 _0x79c6=['moment','bluebird','rimraf','../../config/environment','./smsTransferReport.attributes','exports','define','uniqueid','lodash','../../config/logger','api'];(function(_0x4fef08,_0x4c98c7){var _0x1bde5d=function(_0x192d56){while(--_0x192d56){_0x4fef08['push'](_0x4fef08['shift']());}};_0x1bde5d(++_0x4c98c7);}(_0x79c6,0x81));var _0x679c=function(_0x47fd36,_0x41535d){_0x47fd36=_0x47fd36-0x0;var _0x21a0fc=_0x79c6[_0x47fd36];return _0x21a0fc;};'use strict';var _=require(_0x679c('0x0'));var util=require('util');var logger=require(_0x679c('0x1'))(_0x679c('0x2'));var moment=require(_0x679c('0x3'));var BPromise=require(_0x679c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x679c('0x5'));var config=require(_0x679c('0x6'));var attributes=require(_0x679c('0x7'));module[_0x679c('0x8')]=function(_0x2d8a16,_0x1969be){return _0x2d8a16[_0x679c('0x9')]('SmsTransferReport',attributes,{'tableName':'report_sms_transfer','paranoid':![],'indexes':[{'name':_0x679c('0xa'),'fields':[_0x679c('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x43e8=['util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','SmsTransferReport','report_sms_transfer','uniqueid','lodash'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x43e8,0x81));var _0x843e=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x43e8[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0x843e('0x0'));var util=require(_0x843e('0x1'));var logger=require(_0x843e('0x2'))('api');var moment=require(_0x843e('0x3'));var BPromise=require(_0x843e('0x4'));var rp=require(_0x843e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x843e('0x6'));var config=require(_0x843e('0x7'));var attributes=require('./smsTransferReport.attributes');module[_0x843e('0x8')]=function(_0x22aa5e,_0x1ca8b9){return _0x22aa5e[_0x843e('0x9')](_0x843e('0xa'),attributes,{'tableName':_0x843e('0xb'),'paranoid':![],'indexes':[{'name':_0x843e('0xc'),'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 87a604f..03db6a2 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 _0x0ef0=['code','message','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x2580f4,_0x2016b5){var _0x5a8838=function(_0x5b72bc){while(--_0x5b72bc){_0x2580f4['push'](_0x2580f4['shift']());}};_0x5a8838(++_0x2016b5);}(_0x0ef0,0x80));var _0x00ef=function(_0x44039a,_0x2ac8a8){_0x44039a=_0x44039a-0x0;var _0x525de5=_0x0ef0[_0x44039a];return _0x525de5;};'use strict';var _=require(_0x00ef('0x0'));var util=require(_0x00ef('0x1'));var moment=require('moment');var BPromise=require(_0x00ef('0x2'));var rs=require(_0x00ef('0x3'));var fs=require('fs');var Redis=require(_0x00ef('0x4'));var db=require(_0x00ef('0x5'))['db'];var utils=require(_0x00ef('0x6'));var logger=require(_0x00ef('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x00ef('0x8'));var client=jayson[_0x00ef('0x9')][_0x00ef('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x19321c,_0x50cbde,_0x303c49){return new BPromise(function(_0x3dd5cd,_0x2ee1a6){return client[_0x00ef('0xb')](_0x19321c,_0x303c49)[_0x00ef('0xc')](function(_0x4984c2){logger[_0x00ef('0xd')](_0x00ef('0xe'),_0x50cbde,_0x00ef('0xf'));logger['debug'](_0x00ef('0x10'),_0x50cbde,'request\x20sent',JSON[_0x00ef('0x11')](_0x4984c2));if(_0x4984c2[_0x00ef('0x12')]){if(_0x4984c2[_0x00ef('0x12')][_0x00ef('0x13')]===0x1f4){logger[_0x00ef('0x12')]('SmsTransferReport,\x20%s,\x20%s',_0x50cbde,_0x4984c2[_0x00ef('0x12')]['message']);return _0x2ee1a6(_0x4984c2[_0x00ef('0x12')][_0x00ef('0x14')]);}logger[_0x00ef('0x12')]('SmsTransferReport,\x20%s,\x20%s',_0x50cbde,_0x4984c2[_0x00ef('0x12')]['message']);return _0x3dd5cd(_0x4984c2['error'][_0x00ef('0x14')]);}else{logger[_0x00ef('0xd')](_0x00ef('0xe'),_0x50cbde,_0x00ef('0xf'));_0x3dd5cd(_0x4984c2['result'][_0x00ef('0x14')]);}})['catch'](function(_0xbd149a){logger[_0x00ef('0x12')](_0x00ef('0xe'),_0x50cbde,_0xbd149a);_0x2ee1a6(_0xbd149a);});});} \ No newline at end of file +var _0xe0ae=['debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','moment','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','http','info','SmsTransferReport,\x20%s,\x20%s'];(function(_0x458f09,_0xf2ee90){var _0x1ca565=function(_0x8ec760){while(--_0x8ec760){_0x458f09['push'](_0x458f09['shift']());}};_0x1ca565(++_0xf2ee90);}(_0xe0ae,0xa1));var _0xee0a=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xe0ae[_0x4565bf];return _0x5610ba;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xee0a('0x0'));var BPromise=require(_0xee0a('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xee0a('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xee0a('0x3'));var logger=require(_0xee0a('0x4'))('rpc');var config=require(_0xee0a('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0xee0a('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x1c5071,_0x347cb3,_0x344355){return new BPromise(function(_0x5e6d2e,_0x2296b9){return client['request'](_0x1c5071,_0x344355)['then'](function(_0x1f9d42){logger[_0xee0a('0x7')](_0xee0a('0x8'),_0x347cb3,'request\x20sent');logger[_0xee0a('0x9')](_0xee0a('0xa'),_0x347cb3,'request\x20sent',JSON[_0xee0a('0xb')](_0x1f9d42));if(_0x1f9d42['error']){if(_0x1f9d42[_0xee0a('0xc')][_0xee0a('0xd')]===0x1f4){logger['error'](_0xee0a('0x8'),_0x347cb3,_0x1f9d42['error'][_0xee0a('0xe')]);return _0x2296b9(_0x1f9d42[_0xee0a('0xc')]['message']);}logger['error'](_0xee0a('0x8'),_0x347cb3,_0x1f9d42[_0xee0a('0xc')][_0xee0a('0xe')]);return _0x5e6d2e(_0x1f9d42[_0xee0a('0xc')][_0xee0a('0xe')]);}else{logger['info'](_0xee0a('0x8'),_0x347cb3,_0xee0a('0xf'));_0x5e6d2e(_0x1f9d42['result'][_0xee0a('0xe')]);}})[_0xee0a('0x10')](function(_0x1bc8e1){logger[_0xee0a('0xc')]('SmsTransferReport,\x20%s,\x20%s',_0x347cb3,_0x1bc8e1);_0x2296b9(_0x1bc8e1);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 66c073a..cb517eb 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 _0x91df=['originalname','replace','format','basename','now','post','single','file','create','put','update','delete','/:id','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./sound.controller','get','index','isAuthenticated','download','diskStorage','root'];(function(_0x5bb148,_0x34eaff){var _0x5e3648=function(_0x30ae6a){while(--_0x30ae6a){_0x5bb148['push'](_0x5bb148['shift']());}};_0x5e3648(++_0x34eaff);}(_0x91df,0x11c));var _0xf91d=function(_0x3b932f,_0x512078){_0x3b932f=_0x3b932f-0x0;var _0x4519be=_0x91df[_0x3b932f];return _0x4519be;};'use strict';var multer=require(_0xf91d('0x0'));var util=require(_0xf91d('0x1'));var path=require(_0xf91d('0x2'));var timeout=require(_0xf91d('0x3'));var express=require(_0xf91d('0x4'));var router=express[_0xf91d('0x5')]();var fs_extra=require(_0xf91d('0x6'));var auth=require(_0xf91d('0x7'));var interaction=require(_0xf91d('0x8'));var config=require('../../config/environment');var controller=require(_0xf91d('0x9'));router[_0xf91d('0xa')]('/',auth['isAuthenticated'](),controller[_0xf91d('0xb')]);router[_0xf91d('0xa')]('/:id',auth[_0xf91d('0xc')](),controller['show']);router['get']('/:id/download',auth[_0xf91d('0xc')](),controller[_0xf91d('0xd')]);var upload=multer({'storage':multer[_0xf91d('0xe')]({'destination':function(_0x44611a,_0x525874,_0x572f8f){_0x572f8f(null,path['join'](config[_0xf91d('0xf')],'server/files/sounds/original/'));},'filename':function(_0x4027f0,_0x350e76,_0xb6013f){_0x350e76['originalname']=_0x350e76[_0xf91d('0x10')][_0xf91d('0x11')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0xb6013f(null,util[_0xf91d('0x12')]('%s-%s%s',path[_0xf91d('0x13')](_0x350e76[_0xf91d('0x10')],path['extname'](_0x350e76[_0xf91d('0x10')])),Date[_0xf91d('0x14')](),path['extname'](_0x350e76['originalname'])));}})});router[_0xf91d('0x15')]('/',upload[_0xf91d('0x16')](_0xf91d('0x17')),controller[_0xf91d('0x18')]);router[_0xf91d('0x19')]('/:id',auth[_0xf91d('0xc')](),controller[_0xf91d('0x1a')]);router[_0xf91d('0x1b')](_0xf91d('0x1c'),auth[_0xf91d('0xc')](),controller[_0xf91d('0x1b')]);module[_0xf91d('0x1d')]=router; \ No newline at end of file +var _0xf69b=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','diskStorage','root','server/files/sounds/original/','originalname','replace','format','%s-%s%s','basename','now','extname','post','single','file','put','update','delete','exports','express','Router'];(function(_0x137c34,_0x2ebd98){var _0x145d9b=function(_0x1b7701){while(--_0x1b7701){_0x137c34['push'](_0x137c34['shift']());}};_0x145d9b(++_0x2ebd98);}(_0xf69b,0x1e4));var _0xbf69=function(_0x4887ef,_0x57cd6c){_0x4887ef=_0x4887ef-0x0;var _0x1cf77f=_0xf69b[_0x4887ef];return _0x1cf77f;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbf69('0x0'));var router=express[_0xbf69('0x1')]();var fs_extra=require(_0xbf69('0x2'));var auth=require(_0xbf69('0x3'));var interaction=require(_0xbf69('0x4'));var config=require(_0xbf69('0x5'));var controller=require('./sound.controller');router[_0xbf69('0x6')]('/',auth[_0xbf69('0x7')](),controller['index']);router['get'](_0xbf69('0x8'),auth['isAuthenticated'](),controller[_0xbf69('0x9')]);router[_0xbf69('0x6')]('/:id/download',auth[_0xbf69('0x7')](),controller['download']);var upload=multer({'storage':multer[_0xbf69('0xa')]({'destination':function(_0xd010,_0x3d3b2c,_0x78ebf){_0x78ebf(null,path['join'](config[_0xbf69('0xb')],_0xbf69('0xc')));},'filename':function(_0x9cf45b,_0x3b12c1,_0x1f623e){_0x3b12c1['originalname']=_0x3b12c1[_0xbf69('0xd')][_0xbf69('0xe')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x1f623e(null,util[_0xbf69('0xf')](_0xbf69('0x10'),path[_0xbf69('0x11')](_0x3b12c1[_0xbf69('0xd')],path['extname'](_0x3b12c1[_0xbf69('0xd')])),Date[_0xbf69('0x12')](),path[_0xbf69('0x13')](_0x3b12c1[_0xbf69('0xd')])));}})});router[_0xbf69('0x14')]('/',upload[_0xbf69('0x15')](_0xbf69('0x16')),controller['create']);router[_0xbf69('0x17')]('/:id',auth[_0xbf69('0x7')](),controller[_0xbf69('0x18')]);router[_0xbf69('0x19')](_0xbf69('0x8'),auth[_0xbf69('0x7')](),controller[_0xbf69('0x19')]);module[_0xbf69('0x1a')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index 886d9f8..8e8b719 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 _0x35d2=['INTEGER','BIGINT','exports','name','STRING','FLOAT'];(function(_0x53995f,_0x1b135c){var _0x1649a9=function(_0x4da99b){while(--_0x4da99b){_0x53995f['push'](_0x53995f['shift']());}};_0x1649a9(++_0x1b135c);}(_0x35d2,0x1ca));var _0x235d=function(_0x5136c0,_0x32f5c3){_0x5136c0=_0x5136c0-0x0;var _0x42eb2e=_0x35d2[_0x5136c0];return _0x42eb2e;};'use strict';var Sequelize=require('sequelize');module[_0x235d('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x235d('0x1'),'allowNull':![]},'save_name':{'type':Sequelize[_0x235d('0x2')]},'display_name':{'type':Sequelize[_0x235d('0x2')],'defaultValue':''},'description':{'type':Sequelize[_0x235d('0x2')]},'original_format':{'type':Sequelize[_0x235d('0x2')]},'original_duration':{'type':Sequelize[_0x235d('0x3')]},'original_sampleCount':{'type':Sequelize['BIGINT']},'original_channelCount':{'type':Sequelize[_0x235d('0x4')]},'original_bitRate':{'type':Sequelize[_0x235d('0x5')]},'original_sampleRate':{'type':Sequelize['INTEGER']},'converted_format':{'type':Sequelize[_0x235d('0x2')]},'converted_duration':{'type':Sequelize[_0x235d('0x3')]},'converted_sampleCount':{'type':Sequelize[_0x235d('0x5')]},'converted_channelCount':{'type':Sequelize[_0x235d('0x4')]},'converted_bitRate':{'type':Sequelize[_0x235d('0x5')]},'converted_sampleRate':{'type':Sequelize[_0x235d('0x4')]}}; \ No newline at end of file +var _0xe7bb=['INTEGER','exports','STRING','BIGINT'];(function(_0x2f43f4,_0x2428b1){var _0x4f4223=function(_0x5b4c1a){while(--_0x5b4c1a){_0x2f43f4['push'](_0x2f43f4['shift']());}};_0x4f4223(++_0x2428b1);}(_0xe7bb,0x105));var _0xbe7b=function(_0x3f71fb,_0x5b921f){_0x3f71fb=_0x3f71fb-0x0;var _0x550613=_0xe7bb[_0x3f71fb];return _0x550613;};'use strict';var Sequelize=require('sequelize');module[_0xbe7b('0x0')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'save_name':{'type':Sequelize['STRING']},'display_name':{'type':Sequelize[_0xbe7b('0x1')],'defaultValue':''},'description':{'type':Sequelize[_0xbe7b('0x1')]},'original_format':{'type':Sequelize[_0xbe7b('0x1')]},'original_duration':{'type':Sequelize['FLOAT']},'original_sampleCount':{'type':Sequelize[_0xbe7b('0x2')]},'original_channelCount':{'type':Sequelize[_0xbe7b('0x3')]},'original_bitRate':{'type':Sequelize['BIGINT']},'original_sampleRate':{'type':Sequelize['INTEGER']},'converted_format':{'type':Sequelize['STRING']},'converted_duration':{'type':Sequelize['FLOAT']},'converted_sampleCount':{'type':Sequelize['BIGINT']},'converted_channelCount':{'type':Sequelize[_0xbe7b('0x3')]},'converted_bitRate':{'type':Sequelize[_0xbe7b('0x2')]},'converted_sampleRate':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index c69e70a..105dc7e 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 _0x67d6=['catch','basename','file','originalname','extname','filename','wav','server/files/sounds/original','info','Sound\x20upload\x20destination:\x20%s','transcode','src','original_duration','duration','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','dest','converted_duration','converted_sampleCount','converted_bitRate','converted_sampleRate','sampleRate','chmodSync','0777','create','body','role','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','description','delete','destroy','original_format','unlinkSync','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','get','Sounds','sendStatus','error','stack','name','send','map','Sound','rawAttributes','fieldName','type','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','then','includeAll','include','findAll','rows','show','params','find','download','save_name','join','root','converted_format','Sequelize','ValidationError','server/files/sounds/converted','format','%s.%s'];(function(_0x120fdb,_0x586aa3){var _0xc2f5ba=function(_0x34c71a){while(--_0x34c71a){_0x120fdb['push'](_0x120fdb['shift']());}};_0xc2f5ba(++_0x586aa3);}(_0x67d6,0xa9));var _0x667d=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0x67d6[_0x173d7e];return _0x2220d6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x667d('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x667d('0x1'));var rp=require(_0x667d('0x2'));var moment=require(_0x667d('0x3'));var BPromise=require(_0x667d('0x4'));var Mustache=require(_0x667d('0x5'));var util=require(_0x667d('0x6'));var path=require(_0x667d('0x7'));var sox=require('sox');var csv=require(_0x667d('0x8'));var ejs=require(_0x667d('0x9'));var fs=require('fs');var fs_extra=require(_0x667d('0xa'));var _=require(_0x667d('0xb'));var squel=require(_0x667d('0xc'));var crypto=require(_0x667d('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x667d('0xe'));var toCsv=require(_0x667d('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x667d('0xf'));var authService=require(_0x667d('0x10'));var qs=require(_0x667d('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x667d('0x12'));var logger=require(_0x667d('0x13'))(_0x667d('0x14'));var utils=require('../../config/utils');var config=require(_0x667d('0x15'));var licenseUtil=require(_0x667d('0x16'));var db=require(_0x667d('0x17'))['db'];function respondWithStatusCode(_0x1d30c0,_0x3a8391){_0x3a8391=_0x3a8391||0xcc;return function(_0x42b7fa){if(_0x42b7fa){return _0x1d30c0['sendStatus'](_0x3a8391);}return _0x1d30c0['status'](_0x3a8391)[_0x667d('0x18')]();};}function respondWithResult(_0x23a8d0,_0x2c09e1){_0x2c09e1=_0x2c09e1||0xc8;return function(_0x483832){if(_0x483832){return _0x23a8d0[_0x667d('0x19')](_0x2c09e1)[_0x667d('0x1a')](_0x483832);}};}function respondWithFilteredResult(_0x3152f8,_0x96adcb){return function(_0x712e94){if(_0x712e94){var _0x3856fd=typeof _0x96adcb[_0x667d('0x1b')]===_0x667d('0x1c')&&typeof _0x96adcb[_0x667d('0x1d')]===_0x667d('0x1c');var _0x5417cc=_0x712e94[_0x667d('0x1e')];var _0x27a96e=_0x3856fd?0x0:_0x96adcb[_0x667d('0x1b')];var _0x41959e=_0x3856fd?_0x712e94[_0x667d('0x1e')]:_0x96adcb['offset']+_0x96adcb[_0x667d('0x1d')];var _0x2ea14c;if(_0x41959e>=_0x5417cc){_0x41959e=_0x5417cc;_0x2ea14c=0xc8;}else{_0x2ea14c=0xce;}_0x3152f8[_0x667d('0x19')](_0x2ea14c);return _0x3152f8[_0x667d('0x1f')](_0x667d('0x20'),_0x27a96e+'-'+_0x41959e+'/'+_0x5417cc)[_0x667d('0x1a')](_0x712e94);}return null;};}function patchUpdates(_0x5b9adf){return function(_0x56e6fa){try{jsonpatch['apply'](_0x56e6fa,_0x5b9adf,!![]);}catch(_0x286113){return BPromise[_0x667d('0x21')](_0x286113);}return _0x56e6fa[_0x667d('0x22')]();};}function saveUpdates(_0x5ea273,_0x1446d8){return function(_0x56509c){if(_0x56509c){return _0x56509c[_0x667d('0x23')](_0x5ea273)['then'](function(_0xabf794){return _0xabf794;});}return null;};}function removeEntity(_0x844453,_0x53b733){return function(_0x411660){if(_0x411660){return _0x411660['destroy']()['then'](function(){var _0x5afc79=_0x411660[_0x667d('0x24')]({'plain':!![]});var _0x25cea7=_0x667d('0x25');return db['UserProfileResource']['destroy']({'where':{'type':_0x25cea7,'resourceId':_0x5afc79['id']}})['then'](function(){return _0x411660;});})['then'](function(){_0x844453[_0x667d('0x19')](0xcc)[_0x667d('0x18')]();});}};}function handleEntityNotFound(_0x1678ab,_0x2a7ebb){return function(_0x8f361a){if(!_0x8f361a){_0x1678ab[_0x667d('0x26')](0x194);}return _0x8f361a;};}function handleError(_0x21b85e,_0x993e6c){_0x993e6c=_0x993e6c||0x1f4;return function(_0x3cc309){logger[_0x667d('0x27')](_0x3cc309[_0x667d('0x28')]);if(_0x3cc309[_0x667d('0x29')]){delete _0x3cc309[_0x667d('0x29')];}_0x21b85e[_0x667d('0x19')](_0x993e6c)[_0x667d('0x2a')](_0x3cc309);};}exports['index']=function(_0x9c19ec,_0x55a864){var _0x1fdd5b={},_0x5881e0={},_0x47f7bb={'count':0x0,'rows':[]};var _0x45e33c=_[_0x667d('0x2b')](db[_0x667d('0x2c')][_0x667d('0x2d')],function(_0x384295){return{'name':_0x384295[_0x667d('0x2e')],'type':_0x384295[_0x667d('0x2f')]['key']};});_0x5881e0[_0x667d('0x30')]=_[_0x667d('0x2b')](_0x45e33c,_0x667d('0x29'));_0x5881e0['query']=_[_0x667d('0x31')](_0x9c19ec[_0x667d('0x32')]);_0x5881e0[_0x667d('0x33')]=_['intersection'](_0x5881e0[_0x667d('0x30')],_0x5881e0[_0x667d('0x32')]);_0x1fdd5b[_0x667d('0x34')]=_[_0x667d('0x35')](_0x5881e0[_0x667d('0x30')],qs[_0x667d('0x36')](_0x9c19ec[_0x667d('0x32')]['fields']));_0x1fdd5b[_0x667d('0x34')]=_0x1fdd5b[_0x667d('0x34')][_0x667d('0x37')]?_0x1fdd5b[_0x667d('0x34')]:_0x5881e0[_0x667d('0x30')];if(!_0x9c19ec[_0x667d('0x32')][_0x667d('0x38')](_0x667d('0x39'))){_0x1fdd5b[_0x667d('0x1d')]=qs['limit'](_0x9c19ec['query']['limit']);_0x1fdd5b[_0x667d('0x1b')]=qs[_0x667d('0x1b')](_0x9c19ec[_0x667d('0x32')][_0x667d('0x1b')]);}_0x1fdd5b[_0x667d('0x3a')]=qs[_0x667d('0x3b')](_0x9c19ec[_0x667d('0x32')][_0x667d('0x3b')]);_0x1fdd5b[_0x667d('0x3c')]=qs[_0x667d('0x33')](_[_0x667d('0x3d')](_0x9c19ec[_0x667d('0x32')],_0x5881e0[_0x667d('0x33')]),_0x45e33c);if(_0x9c19ec['query'][_0x667d('0x3e')]){_0x1fdd5b[_0x667d('0x3c')]=_[_0x667d('0x3f')](_0x1fdd5b[_0x667d('0x3c')],{'$or':_[_0x667d('0x2b')](_0x45e33c,function(_0xd5ac7b){if(_0xd5ac7b[_0x667d('0x2f')]!==_0x667d('0x40')){var _0x3e3ebb={};_0x3e3ebb[_0xd5ac7b['name']]={'$like':'%'+_0x9c19ec[_0x667d('0x32')][_0x667d('0x3e')]+'%'};return _0x3e3ebb;}})});}_0x1fdd5b=_['merge']({},_0x1fdd5b,_0x9c19ec['options']);var _0x221fdb={'where':_0x1fdd5b['where']};return db[_0x667d('0x2c')][_0x667d('0x1e')](_0x221fdb)[_0x667d('0x41')](function(_0x2d80e1){_0x47f7bb[_0x667d('0x1e')]=_0x2d80e1;if(_0x9c19ec[_0x667d('0x32')][_0x667d('0x42')]){_0x1fdd5b[_0x667d('0x43')]=[{'all':!![]}];}return db[_0x667d('0x2c')][_0x667d('0x44')](_0x1fdd5b);})[_0x667d('0x41')](function(_0x3fd856){_0x47f7bb[_0x667d('0x45')]=_0x3fd856;return _0x47f7bb;})[_0x667d('0x41')](respondWithFilteredResult(_0x55a864,_0x1fdd5b))['catch'](handleError(_0x55a864,null));};exports[_0x667d('0x46')]=function(_0x53e535,_0xf22ee5){var _0x529db9={'raw':!![],'where':{'id':_0x53e535[_0x667d('0x47')]['id']}},_0x18c7da={};_0x18c7da['model']=_[_0x667d('0x31')](db[_0x667d('0x2c')][_0x667d('0x2d')]);_0x18c7da[_0x667d('0x32')]=_[_0x667d('0x31')](_0x53e535[_0x667d('0x32')]);_0x18c7da[_0x667d('0x33')]=_[_0x667d('0x35')](_0x18c7da[_0x667d('0x30')],_0x18c7da[_0x667d('0x32')]);_0x529db9[_0x667d('0x34')]=_['intersection'](_0x18c7da[_0x667d('0x30')],qs[_0x667d('0x36')](_0x53e535[_0x667d('0x32')][_0x667d('0x36')]));_0x529db9[_0x667d('0x34')]=_0x529db9[_0x667d('0x34')][_0x667d('0x37')]?_0x529db9['attributes']:_0x18c7da['model'];if(_0x53e535[_0x667d('0x32')][_0x667d('0x42')]){_0x529db9[_0x667d('0x43')]=[{'all':!![]}];}_0x529db9=_[_0x667d('0x3f')]({},_0x529db9,_0x53e535['options']);return db[_0x667d('0x2c')][_0x667d('0x48')](_0x529db9)[_0x667d('0x41')](handleEntityNotFound(_0xf22ee5,null))['then'](respondWithResult(_0xf22ee5,null))['catch'](handleError(_0xf22ee5,null));};exports[_0x667d('0x49')]=function(_0x10da2e,_0x12f23d,_0xb2001d){return db[_0x667d('0x2c')]['find']({'where':{'id':_0x10da2e[_0x667d('0x47')]['id']},'attributes':['name',_0x667d('0x4a'),'converted_format'],'raw':!![]})['then'](handleEntityNotFound(_0x12f23d,null))[_0x667d('0x41')](function(_0x518668){if(_0x518668){if(!fs['existsSync'](path[_0x667d('0x4b')](config[_0x667d('0x4c')],'server/files/sounds/converted',_0x518668['save_name']+'.'+_0x518668[_0x667d('0x4d')]))){throw new db[(_0x667d('0x4e'))][(_0x667d('0x4f'))]('Sound\x20not\x20found');}return _0x12f23d[_0x667d('0x49')](path[_0x667d('0x4b')](config['root'],_0x667d('0x50'),util[_0x667d('0x51')](_0x667d('0x52'),_0x518668[_0x667d('0x4a')],_0x518668[_0x667d('0x4d')])),util[_0x667d('0x51')](_0x667d('0x52'),_0x518668['name'],_0x518668[_0x667d('0x4d')]));}return null;})[_0x667d('0x53')](handleError(_0x12f23d,null));};exports['create']=function(_0x2b2e5d,_0x43dddf,_0x42adf8){var _0x5d752a={'name':path[_0x667d('0x54')](_0x2b2e5d[_0x667d('0x55')][_0x667d('0x56')],path[_0x667d('0x57')](_0x2b2e5d['file'][_0x667d('0x56')])),'save_name':path[_0x667d('0x54')](_0x2b2e5d[_0x667d('0x55')][_0x667d('0x58')],path[_0x667d('0x57')](_0x2b2e5d['file'][_0x667d('0x58')])),'original_format':path[_0x667d('0x57')](_0x2b2e5d[_0x667d('0x55')][_0x667d('0x56')])['substring'](0x1),'converted_format':_0x667d('0x59')};var _0x337386=path[_0x667d('0x4b')](config[_0x667d('0x4c')],_0x667d('0x5a'),_0x2b2e5d['file'][_0x667d('0x58')]);var _0x312844=path[_0x667d('0x4b')](config['root'],_0x667d('0x50'),util[_0x667d('0x51')]('%s.%s',path[_0x667d('0x54')](_0x2b2e5d[_0x667d('0x55')][_0x667d('0x58')],path[_0x667d('0x57')](_0x2b2e5d[_0x667d('0x55')]['filename'])),_0x5d752a[_0x667d('0x4d')]));logger[_0x667d('0x5b')]('Sound\x20upload\x20filepath:\x20%s',_0x337386);logger[_0x667d('0x5b')](_0x667d('0x5c'),_0x312844);try{fs['chmodSync'](_0x337386,parseInt('0777',0x8));var _0x5bd717=sox[_0x667d('0x5d')](_0x337386,_0x312844,{'sampleRate':0x1f40,'format':_0x667d('0x59'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x5bd717['on']('error',function(_0x1712b9){fs['unlinkSync'](_0x337386);_0x43dddf['status'](0x1f4)[_0x667d('0x2a')](_0x1712b9);});_0x5bd717['on'](_0x667d('0x5e'),function(_0xe2bb7a){_0x5d752a[_0x667d('0x5f')]=isNaN(_0xe2bb7a['duration'])?null:_0xe2bb7a[_0x667d('0x60')]*0x3e8;_0x5d752a['original_sampleCount']=isNaN(_0xe2bb7a[_0x667d('0x61')])?null:_0xe2bb7a[_0x667d('0x61')];_0x5d752a[_0x667d('0x62')]=isNaN(_0xe2bb7a['channelCount'])?null:_0xe2bb7a[_0x667d('0x63')];_0x5d752a[_0x667d('0x64')]=isNaN(_0xe2bb7a[_0x667d('0x65')])?null:_0xe2bb7a[_0x667d('0x65')];_0x5d752a['original_sampleRate']=isNaN(_0xe2bb7a['sampleRate'])?null:_0xe2bb7a['sampleRate'];});_0x5bd717['on'](_0x667d('0x66'),function(_0x2a2d36){_0x5d752a[_0x667d('0x67')]=isNaN(_0x2a2d36[_0x667d('0x60')])?null:_0x2a2d36['duration']*0x3e8;_0x5d752a[_0x667d('0x68')]=isNaN(_0x2a2d36['sampleCount'])?null:_0x2a2d36[_0x667d('0x61')];_0x5d752a['converted_channelCount']=isNaN(_0x2a2d36[_0x667d('0x63')])?null:_0x2a2d36[_0x667d('0x63')];_0x5d752a[_0x667d('0x69')]=isNaN(_0x2a2d36[_0x667d('0x65')])?null:_0x2a2d36[_0x667d('0x65')];_0x5d752a[_0x667d('0x6a')]=isNaN(_0x2a2d36[_0x667d('0x6b')])?null:_0x2a2d36[_0x667d('0x6b')];});_0x5bd717['on'](_0x667d('0x18'),function(){fs[_0x667d('0x6c')](_0x312844,parseInt(_0x667d('0x6d'),0x8));return db[_0x667d('0x2c')][_0x667d('0x6e')](_0x5d752a)[_0x667d('0x41')](function(_0x43bc4e){var _0x22a5a3={'role':_0x2b2e5d[_0x667d('0x6f')][_0x667d('0x70')],'userProfileId':_0x2b2e5d[_0x667d('0x6f')]['userProfileId']};if(!_0x22a5a3)throw new Error(_0x667d('0x71'));if(_0x22a5a3[_0x667d('0x70')]===_0x667d('0x72')){var _0x2789ba=_0x43bc4e['get']({'plain':!![]});return db[_0x667d('0x73')][_0x667d('0x48')]({'where':{'name':_0x667d('0x25'),'userProfileId':_0x22a5a3[_0x667d('0x74')]},'raw':!![]})[_0x667d('0x41')](function(_0x545dd0){if(_0x545dd0&&_0x545dd0[_0x667d('0x75')]===0x0){return db[_0x667d('0x76')][_0x667d('0x6e')]({'name':_0x2789ba[_0x667d('0x29')],'resourceId':_0x2789ba['id'],'type':_0x545dd0[_0x667d('0x29')],'sectionId':_0x545dd0['id']},{})[_0x667d('0x41')](function(){return _0x43bc4e;});}else{return _0x43bc4e;}})[_0x667d('0x53')](function(_0x2dd51b){logger['error'](_0x667d('0x77'),_0x2dd51b);throw _0x2dd51b;});}return _0x43bc4e;})['then'](respondWithResult(_0x43dddf,null))['catch'](handleError(_0x43dddf,null));});_0x5bd717[_0x667d('0x78')]();}catch(_0x432107){_0x43dddf[_0x667d('0x19')](0x1f4)[_0x667d('0x2a')](_0x432107);}};exports[_0x667d('0x23')]=function(_0x35d37e,_0x479cc9,_0x18492d){return db[_0x667d('0x2c')]['find']({'where':{'id':_0x35d37e[_0x667d('0x47')]['id']}})[_0x667d('0x41')](handleEntityNotFound(_0x479cc9,null))[_0x667d('0x41')](saveUpdates(_[_0x667d('0x3d')](_0x35d37e[_0x667d('0x6f')],[_0x667d('0x29'),_0x667d('0x79')]),null))[_0x667d('0x41')](respondWithResult(_0x479cc9,null))[_0x667d('0x53')](handleError(_0x479cc9,null));};exports[_0x667d('0x7a')]=function(_0x5b2c49,_0x440535,_0x56add1){return db[_0x667d('0x2c')][_0x667d('0x48')]({'where':{'id':_0x5b2c49['params']['id']}})[_0x667d('0x41')](function(_0xbfed3b){if(_0xbfed3b){return _0xbfed3b[_0x667d('0x7b')]();}})['then'](function(_0x4ff2cd){var _0x4321c9=path['join'](config[_0x667d('0x4c')],'server/files/sounds/original',util['format'](_0x667d('0x52'),_0x4ff2cd['save_name'],_0x4ff2cd[_0x667d('0x7c')]));var _0x2a2aad=path['join'](config['root'],_0x667d('0x50'),util[_0x667d('0x51')]('%s.%s',_0x4ff2cd[_0x667d('0x4a')],_0x4ff2cd['converted_format']));fs[_0x667d('0x7d')](_0x4321c9);fs[_0x667d('0x7d')](_0x2a2aad);return _0x4ff2cd;})[_0x667d('0x41')](function(_0x2e0111){if(_0x2e0111){return _0x440535['status'](0xcc)[_0x667d('0x18')]();}})[_0x667d('0x41')](handleEntityNotFound(_0x440535,null))['catch'](handleError(_0x440535,null));}; \ No newline at end of file +var _0x6be6=['converted_sampleRate','0777','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','description','delete','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','api','../../config/environment','../../mysqldb','sendStatus','json','offset','limit','undefined','count','status','set','Content-Range','apply','reject','save','update','then','destroy','Sounds','UserProfileResource','end','error','stack','name','send','map','Sound','rawAttributes','fieldName','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','findAll','catch','show','params','intersection','includeAll','include','find','download','save_name','converted_format','join','root','server/files/sounds/converted','Sequelize','ValidationError','Sound\x20not\x20found','format','%s.%s','create','basename','file','originalname','extname','filename','substring','wav','server/files/sounds/original','Sound\x20upload\x20filepath:\x20%s','chmodSync','transcode','unlinkSync','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_sampleCount','converted_channelCount','converted_bitRate'];(function(_0x54a4eb,_0x15420e){var _0x50f503=function(_0x53dc35){while(--_0x53dc35){_0x54a4eb['push'](_0x54a4eb['shift']());}};_0x50f503(++_0x15420e);}(_0x6be6,0x17c));var _0x66be=function(_0x4ff05b,_0x1c3588){_0x4ff05b=_0x4ff05b-0x0;var _0x45d15e=_0x6be6[_0x4ff05b];return _0x45d15e;};'use strict';var emlformat=require(_0x66be('0x0'));var rimraf=require(_0x66be('0x1'));var zipdir=require(_0x66be('0x2'));var jsonpatch=require(_0x66be('0x3'));var rp=require(_0x66be('0x4'));var moment=require(_0x66be('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x66be('0x6'));var path=require(_0x66be('0x7'));var sox=require(_0x66be('0x8'));var csv=require('to-csv');var ejs=require(_0x66be('0x9'));var fs=require('fs');var fs_extra=require(_0x66be('0xa'));var _=require('lodash');var squel=require(_0x66be('0xb'));var crypto=require(_0x66be('0xc'));var jsforce=require(_0x66be('0xd'));var deskjs=require(_0x66be('0xe'));var toCsv=require(_0x66be('0xf'));var querystring=require(_0x66be('0x10'));var Papa=require(_0x66be('0x11'));var Redis=require(_0x66be('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x66be('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x66be('0x14'));var utils=require('../../config/utils');var config=require(_0x66be('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x66be('0x16'))['db'];function respondWithStatusCode(_0x263df4,_0x1a4b87){_0x1a4b87=_0x1a4b87||0xcc;return function(_0x4ae00f){if(_0x4ae00f){return _0x263df4[_0x66be('0x17')](_0x1a4b87);}return _0x263df4['status'](_0x1a4b87)['end']();};}function respondWithResult(_0x4cab2e,_0x25aa5d){_0x25aa5d=_0x25aa5d||0xc8;return function(_0x3a1cf0){if(_0x3a1cf0){return _0x4cab2e['status'](_0x25aa5d)[_0x66be('0x18')](_0x3a1cf0);}};}function respondWithFilteredResult(_0x142465,_0x5834f9){return function(_0x1cfbca){if(_0x1cfbca){var _0x1b93e1=typeof _0x5834f9[_0x66be('0x19')]==='undefined'&&typeof _0x5834f9[_0x66be('0x1a')]===_0x66be('0x1b');var _0x3f827e=_0x1cfbca[_0x66be('0x1c')];var _0x5e8f5a=_0x1b93e1?0x0:_0x5834f9[_0x66be('0x19')];var _0x5e5706=_0x1b93e1?_0x1cfbca[_0x66be('0x1c')]:_0x5834f9[_0x66be('0x19')]+_0x5834f9[_0x66be('0x1a')];var _0x405de9;if(_0x5e5706>=_0x3f827e){_0x5e5706=_0x3f827e;_0x405de9=0xc8;}else{_0x405de9=0xce;}_0x142465[_0x66be('0x1d')](_0x405de9);return _0x142465[_0x66be('0x1e')](_0x66be('0x1f'),_0x5e8f5a+'-'+_0x5e5706+'/'+_0x3f827e)[_0x66be('0x18')](_0x1cfbca);}return null;};}function patchUpdates(_0x4f4108){return function(_0x50e987){try{jsonpatch[_0x66be('0x20')](_0x50e987,_0x4f4108,!![]);}catch(_0x27a750){return BPromise[_0x66be('0x21')](_0x27a750);}return _0x50e987[_0x66be('0x22')]();};}function saveUpdates(_0x53df66,_0x200430){return function(_0x13153a){if(_0x13153a){return _0x13153a[_0x66be('0x23')](_0x53df66)[_0x66be('0x24')](function(_0x4684cc){return _0x4684cc;});}return null;};}function removeEntity(_0x38c09b,_0x5d4e2b){return function(_0x41d763){if(_0x41d763){return _0x41d763[_0x66be('0x25')]()[_0x66be('0x24')](function(){var _0x575f8e=_0x41d763['get']({'plain':!![]});var _0x4df16e=_0x66be('0x26');return db[_0x66be('0x27')][_0x66be('0x25')]({'where':{'type':_0x4df16e,'resourceId':_0x575f8e['id']}})[_0x66be('0x24')](function(){return _0x41d763;});})[_0x66be('0x24')](function(){_0x38c09b['status'](0xcc)[_0x66be('0x28')]();});}};}function handleEntityNotFound(_0x234a9e,_0x1cad82){return function(_0x49e3c6){if(!_0x49e3c6){_0x234a9e['sendStatus'](0x194);}return _0x49e3c6;};}function handleError(_0x4a97f6,_0x2c22f0){_0x2c22f0=_0x2c22f0||0x1f4;return function(_0x4c58c5){logger[_0x66be('0x29')](_0x4c58c5[_0x66be('0x2a')]);if(_0x4c58c5[_0x66be('0x2b')]){delete _0x4c58c5[_0x66be('0x2b')];}_0x4a97f6[_0x66be('0x1d')](_0x2c22f0)[_0x66be('0x2c')](_0x4c58c5);};}exports['index']=function(_0x4e3daf,_0x1463a1){var _0x19e1b0={},_0xcc7ae8={},_0x450800={'count':0x0,'rows':[]};var _0x1ae748=_[_0x66be('0x2d')](db[_0x66be('0x2e')][_0x66be('0x2f')],function(_0x3c5f67){return{'name':_0x3c5f67[_0x66be('0x30')],'type':_0x3c5f67['type']['key']};});_0xcc7ae8[_0x66be('0x31')]=_['map'](_0x1ae748,_0x66be('0x2b'));_0xcc7ae8[_0x66be('0x32')]=_[_0x66be('0x33')](_0x4e3daf[_0x66be('0x32')]);_0xcc7ae8[_0x66be('0x34')]=_['intersection'](_0xcc7ae8[_0x66be('0x31')],_0xcc7ae8['query']);_0x19e1b0[_0x66be('0x35')]=_['intersection'](_0xcc7ae8[_0x66be('0x31')],qs[_0x66be('0x36')](_0x4e3daf[_0x66be('0x32')][_0x66be('0x36')]));_0x19e1b0[_0x66be('0x35')]=_0x19e1b0['attributes'][_0x66be('0x37')]?_0x19e1b0[_0x66be('0x35')]:_0xcc7ae8[_0x66be('0x31')];if(!_0x4e3daf[_0x66be('0x32')][_0x66be('0x38')](_0x66be('0x39'))){_0x19e1b0['limit']=qs['limit'](_0x4e3daf[_0x66be('0x32')]['limit']);_0x19e1b0['offset']=qs['offset'](_0x4e3daf['query'][_0x66be('0x19')]);}_0x19e1b0[_0x66be('0x3a')]=qs[_0x66be('0x3b')](_0x4e3daf[_0x66be('0x32')]['sort']);_0x19e1b0[_0x66be('0x3c')]=qs[_0x66be('0x34')](_[_0x66be('0x3d')](_0x4e3daf[_0x66be('0x32')],_0xcc7ae8['filters']),_0x1ae748);if(_0x4e3daf['query'][_0x66be('0x3e')]){_0x19e1b0[_0x66be('0x3c')]=_[_0x66be('0x3f')](_0x19e1b0[_0x66be('0x3c')],{'$or':_[_0x66be('0x2d')](_0x1ae748,function(_0x17ff72){if(_0x17ff72['type']!==_0x66be('0x40')){var _0x1e79f1={};_0x1e79f1[_0x17ff72[_0x66be('0x2b')]]={'$like':'%'+_0x4e3daf[_0x66be('0x32')][_0x66be('0x3e')]+'%'};return _0x1e79f1;}})});}_0x19e1b0=_[_0x66be('0x3f')]({},_0x19e1b0,_0x4e3daf[_0x66be('0x41')]);var _0x1ba6cf={'where':_0x19e1b0[_0x66be('0x3c')]};return db[_0x66be('0x2e')][_0x66be('0x1c')](_0x1ba6cf)[_0x66be('0x24')](function(_0x334597){_0x450800[_0x66be('0x1c')]=_0x334597;if(_0x4e3daf[_0x66be('0x32')]['includeAll']){_0x19e1b0['include']=[{'all':!![]}];}return db['Sound'][_0x66be('0x42')](_0x19e1b0);})[_0x66be('0x24')](function(_0x2ab88e){_0x450800['rows']=_0x2ab88e;return _0x450800;})['then'](respondWithFilteredResult(_0x1463a1,_0x19e1b0))[_0x66be('0x43')](handleError(_0x1463a1,null));};exports[_0x66be('0x44')]=function(_0x36bd32,_0x1ffeba){var _0x4c3fa2={'raw':!![],'where':{'id':_0x36bd32[_0x66be('0x45')]['id']}},_0x4693e2={};_0x4693e2['model']=_['keys'](db[_0x66be('0x2e')]['rawAttributes']);_0x4693e2[_0x66be('0x32')]=_[_0x66be('0x33')](_0x36bd32[_0x66be('0x32')]);_0x4693e2['filters']=_[_0x66be('0x46')](_0x4693e2[_0x66be('0x31')],_0x4693e2[_0x66be('0x32')]);_0x4c3fa2[_0x66be('0x35')]=_[_0x66be('0x46')](_0x4693e2['model'],qs[_0x66be('0x36')](_0x36bd32[_0x66be('0x32')][_0x66be('0x36')]));_0x4c3fa2[_0x66be('0x35')]=_0x4c3fa2[_0x66be('0x35')][_0x66be('0x37')]?_0x4c3fa2['attributes']:_0x4693e2[_0x66be('0x31')];if(_0x36bd32[_0x66be('0x32')][_0x66be('0x47')]){_0x4c3fa2[_0x66be('0x48')]=[{'all':!![]}];}_0x4c3fa2=_['merge']({},_0x4c3fa2,_0x36bd32[_0x66be('0x41')]);return db[_0x66be('0x2e')][_0x66be('0x49')](_0x4c3fa2)[_0x66be('0x24')](handleEntityNotFound(_0x1ffeba,null))[_0x66be('0x24')](respondWithResult(_0x1ffeba,null))[_0x66be('0x43')](handleError(_0x1ffeba,null));};exports[_0x66be('0x4a')]=function(_0x3bb82b,_0x557360,_0x5a2226){return db[_0x66be('0x2e')][_0x66be('0x49')]({'where':{'id':_0x3bb82b[_0x66be('0x45')]['id']},'attributes':[_0x66be('0x2b'),_0x66be('0x4b'),_0x66be('0x4c')],'raw':!![]})[_0x66be('0x24')](handleEntityNotFound(_0x557360,null))['then'](function(_0x377fee){if(_0x377fee){if(!fs['existsSync'](path[_0x66be('0x4d')](config[_0x66be('0x4e')],_0x66be('0x4f'),_0x377fee[_0x66be('0x4b')]+'.'+_0x377fee['converted_format']))){throw new db[(_0x66be('0x50'))][(_0x66be('0x51'))](_0x66be('0x52'));}return _0x557360[_0x66be('0x4a')](path['join'](config[_0x66be('0x4e')],_0x66be('0x4f'),util[_0x66be('0x53')]('%s.%s',_0x377fee[_0x66be('0x4b')],_0x377fee[_0x66be('0x4c')])),util['format'](_0x66be('0x54'),_0x377fee[_0x66be('0x2b')],_0x377fee[_0x66be('0x4c')]));}return null;})[_0x66be('0x43')](handleError(_0x557360,null));};exports[_0x66be('0x55')]=function(_0x5da45d,_0x3483af,_0x142425){var _0x1bdb7e={'name':path[_0x66be('0x56')](_0x5da45d[_0x66be('0x57')][_0x66be('0x58')],path[_0x66be('0x59')](_0x5da45d['file'][_0x66be('0x58')])),'save_name':path[_0x66be('0x56')](_0x5da45d['file'][_0x66be('0x5a')],path['extname'](_0x5da45d['file'][_0x66be('0x5a')])),'original_format':path[_0x66be('0x59')](_0x5da45d[_0x66be('0x57')]['originalname'])[_0x66be('0x5b')](0x1),'converted_format':_0x66be('0x5c')};var _0x395b9f=path[_0x66be('0x4d')](config[_0x66be('0x4e')],_0x66be('0x5d'),_0x5da45d['file'][_0x66be('0x5a')]);var _0x454bff=path['join'](config[_0x66be('0x4e')],_0x66be('0x4f'),util[_0x66be('0x53')](_0x66be('0x54'),path[_0x66be('0x56')](_0x5da45d[_0x66be('0x57')][_0x66be('0x5a')],path[_0x66be('0x59')](_0x5da45d[_0x66be('0x57')][_0x66be('0x5a')])),_0x1bdb7e[_0x66be('0x4c')]));logger['info'](_0x66be('0x5e'),_0x395b9f);logger['info']('Sound\x20upload\x20destination:\x20%s',_0x454bff);try{fs[_0x66be('0x5f')](_0x395b9f,parseInt('0777',0x8));var _0x2ab5af=sox[_0x66be('0x60')](_0x395b9f,_0x454bff,{'sampleRate':0x1f40,'format':_0x66be('0x5c'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x2ab5af['on'](_0x66be('0x29'),function(_0x17cd82){fs[_0x66be('0x61')](_0x395b9f);_0x3483af[_0x66be('0x1d')](0x1f4)[_0x66be('0x2c')](_0x17cd82);});_0x2ab5af['on']('src',function(_0x50cef9){_0x1bdb7e[_0x66be('0x62')]=isNaN(_0x50cef9['duration'])?null:_0x50cef9[_0x66be('0x63')]*0x3e8;_0x1bdb7e[_0x66be('0x64')]=isNaN(_0x50cef9['sampleCount'])?null:_0x50cef9[_0x66be('0x65')];_0x1bdb7e[_0x66be('0x66')]=isNaN(_0x50cef9[_0x66be('0x67')])?null:_0x50cef9['channelCount'];_0x1bdb7e[_0x66be('0x68')]=isNaN(_0x50cef9[_0x66be('0x69')])?null:_0x50cef9[_0x66be('0x69')];_0x1bdb7e[_0x66be('0x6a')]=isNaN(_0x50cef9['sampleRate'])?null:_0x50cef9[_0x66be('0x6b')];});_0x2ab5af['on'](_0x66be('0x6c'),function(_0x1a6e92){_0x1bdb7e['converted_duration']=isNaN(_0x1a6e92[_0x66be('0x63')])?null:_0x1a6e92[_0x66be('0x63')]*0x3e8;_0x1bdb7e[_0x66be('0x6d')]=isNaN(_0x1a6e92[_0x66be('0x65')])?null:_0x1a6e92[_0x66be('0x65')];_0x1bdb7e[_0x66be('0x6e')]=isNaN(_0x1a6e92[_0x66be('0x67')])?null:_0x1a6e92['channelCount'];_0x1bdb7e[_0x66be('0x6f')]=isNaN(_0x1a6e92[_0x66be('0x69')])?null:_0x1a6e92[_0x66be('0x69')];_0x1bdb7e[_0x66be('0x70')]=isNaN(_0x1a6e92['sampleRate'])?null:_0x1a6e92[_0x66be('0x6b')];});_0x2ab5af['on']('end',function(){fs[_0x66be('0x5f')](_0x454bff,parseInt(_0x66be('0x71'),0x8));return db[_0x66be('0x2e')][_0x66be('0x55')](_0x1bdb7e)[_0x66be('0x24')](function(_0x323677){var _0x56076a={'role':_0x5da45d[_0x66be('0x72')][_0x66be('0x73')],'userProfileId':_0x5da45d[_0x66be('0x72')][_0x66be('0x74')]};if(!_0x56076a)throw new Error(_0x66be('0x75'));if(_0x56076a['role']==='user'){var _0x494026=_0x323677['get']({'plain':!![]});return db[_0x66be('0x76')]['find']({'where':{'name':_0x66be('0x26'),'userProfileId':_0x56076a[_0x66be('0x74')]},'raw':!![]})[_0x66be('0x24')](function(_0x85baa){if(_0x85baa&&_0x85baa['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x494026[_0x66be('0x2b')],'resourceId':_0x494026['id'],'type':_0x85baa[_0x66be('0x2b')],'sectionId':_0x85baa['id']},{})[_0x66be('0x24')](function(){return _0x323677;});}else{return _0x323677;}})[_0x66be('0x43')](function(_0x2b4b6c){logger['error'](_0x66be('0x77'),_0x2b4b6c);throw _0x2b4b6c;});}return _0x323677;})['then'](respondWithResult(_0x3483af,null))[_0x66be('0x43')](handleError(_0x3483af,null));});_0x2ab5af[_0x66be('0x78')]();}catch(_0x1dbca2){_0x3483af['status'](0x1f4)['send'](_0x1dbca2);}};exports['update']=function(_0x57ace3,_0x1da210,_0x350d3f){return db[_0x66be('0x2e')][_0x66be('0x49')]({'where':{'id':_0x57ace3['params']['id']}})[_0x66be('0x24')](handleEntityNotFound(_0x1da210,null))['then'](saveUpdates(_[_0x66be('0x3d')](_0x57ace3['body'],['name',_0x66be('0x79')]),null))['then'](respondWithResult(_0x1da210,null))[_0x66be('0x43')](handleError(_0x1da210,null));};exports[_0x66be('0x7a')]=function(_0x2c0fa8,_0x2ddd12,_0x5da080){return db[_0x66be('0x2e')]['find']({'where':{'id':_0x2c0fa8[_0x66be('0x45')]['id']}})[_0x66be('0x24')](function(_0x3e2d1e){if(_0x3e2d1e){return _0x3e2d1e['destroy']();}})[_0x66be('0x24')](function(_0x5073f0){var _0xc430cb=path[_0x66be('0x4d')](config[_0x66be('0x4e')],_0x66be('0x5d'),util[_0x66be('0x53')](_0x66be('0x54'),_0x5073f0[_0x66be('0x4b')],_0x5073f0['original_format']));var _0x2a48f4=path['join'](config[_0x66be('0x4e')],'server/files/sounds/converted',util['format'](_0x66be('0x54'),_0x5073f0[_0x66be('0x4b')],_0x5073f0[_0x66be('0x4c')]));fs[_0x66be('0x61')](_0xc430cb);fs['unlinkSync'](_0x2a48f4);return _0x5073f0;})['then'](function(_0x5e05a7){if(_0x5e05a7){return _0x2ddd12['status'](0xcc)[_0x66be('0x28')]();}})[_0x66be('0x24')](handleEntityNotFound(_0x2ddd12,null))[_0x66be('0x43')](handleError(_0x2ddd12,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index 7e22bd6..9ed09f9 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 _0xc77d=['./sound.attributes','exports','Sound','tools_sounds','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0xe96ecf,_0x369b43){var _0x25b9b0=function(_0x44190f){while(--_0x44190f){_0xe96ecf['push'](_0xe96ecf['shift']());}};_0x25b9b0(++_0x369b43);}(_0xc77d,0x1d8));var _0xdc77=function(_0x21f28f,_0x3be6b8){_0x21f28f=_0x21f28f-0x0;var _0x180f21=_0xc77d[_0x21f28f];return _0x180f21;};'use strict';var _=require(_0xdc77('0x0'));var util=require(_0xdc77('0x1'));var logger=require(_0xdc77('0x2'))(_0xdc77('0x3'));var moment=require(_0xdc77('0x4'));var BPromise=require(_0xdc77('0x5'));var rp=require(_0xdc77('0x6'));var fs=require('fs');var path=require(_0xdc77('0x7'));var rimraf=require(_0xdc77('0x8'));var config=require('../../config/environment');var attributes=require(_0xdc77('0x9'));module[_0xdc77('0xa')]=function(_0x15ec11,_0x1735b8){return _0x15ec11['define'](_0xdc77('0xb'),attributes,{'tableName':_0xdc77('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x187c=['api','moment','request-promise','./sound.attributes','exports','define','Sound','tools_sounds','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x187c,0x1c1));var _0xc187=function(_0x4835c6,_0x23195e){_0x4835c6=_0x4835c6-0x0;var _0x3bc3f4=_0x187c[_0x4835c6];return _0x3bc3f4;};'use strict';var _=require('lodash');var util=require(_0xc187('0x0'));var logger=require('../../config/logger')(_0xc187('0x1'));var moment=require(_0xc187('0x2'));var BPromise=require('bluebird');var rp=require(_0xc187('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xc187('0x4'));module[_0xc187('0x5')]=function(_0x1ef6d1,_0x35ee9b){return _0x1ef6d1[_0xc187('0x6')](_0xc187('0x7'),attributes,{'tableName':_0xc187('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/sound/sound.rpc.js b/server/api/sound/sound.rpc.js index 3813e2b..b65c5ff 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 _0x6146=['error','code','message','catch','Sound','find','options','attributes','include','model','map','ShowSound','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','then','info','Sound,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x52733b,_0xabcaa5){var _0xee7369=function(_0xec8462){while(--_0xec8462){_0x52733b['push'](_0x52733b['shift']());}};_0xee7369(++_0xabcaa5);}(_0x6146,0x124));var _0x6614=function(_0x575f33,_0x3e34e3){_0x575f33=_0x575f33-0x0;var _0x3e153b=_0x6146[_0x575f33];return _0x3e153b;};'use strict';var _=require('lodash');var util=require(_0x6614('0x0'));var moment=require(_0x6614('0x1'));var BPromise=require(_0x6614('0x2'));var rs=require(_0x6614('0x3'));var fs=require('fs');var Redis=require(_0x6614('0x4'));var db=require(_0x6614('0x5'))['db'];var utils=require(_0x6614('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x6614('0x7'));var jayson=require(_0x6614('0x8'));var client=jayson[_0x6614('0x9')][_0x6614('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2b2c0d,_0x33112a,_0x39f8a3){return new BPromise(function(_0x50c611,_0x1e5fcb){return client['request'](_0x2b2c0d,_0x39f8a3)[_0x6614('0xb')](function(_0x53e4af){logger[_0x6614('0xc')](_0x6614('0xd'),_0x33112a,_0x6614('0xe'));logger['debug']('Sound,\x20%s,\x20%s,\x20%s',_0x33112a,_0x6614('0xe'),JSON[_0x6614('0xf')](_0x53e4af));if(_0x53e4af[_0x6614('0x10')]){if(_0x53e4af[_0x6614('0x10')][_0x6614('0x11')]===0x1f4){logger[_0x6614('0x10')](_0x6614('0xd'),_0x33112a,_0x53e4af['error'][_0x6614('0x12')]);return _0x1e5fcb(_0x53e4af[_0x6614('0x10')][_0x6614('0x12')]);}logger['error'](_0x6614('0xd'),_0x33112a,_0x53e4af[_0x6614('0x10')][_0x6614('0x12')]);return _0x50c611(_0x53e4af['error']['message']);}else{logger[_0x6614('0xc')](_0x6614('0xd'),_0x33112a,_0x6614('0xe'));_0x50c611(_0x53e4af['result']['message']);}})[_0x6614('0x13')](function(_0x1dd0d2){logger[_0x6614('0x10')](_0x6614('0xd'),_0x33112a,_0x1dd0d2);_0x1e5fcb(_0x1dd0d2);});});}exports['ShowSound']=function(_0x26c8bf){var _0x5626cc=this;return new Promise(function(_0x31f92d,_0x573547){return db[_0x6614('0x14')][_0x6614('0x15')]({'raw':_0x26c8bf[_0x6614('0x16')]?_0x26c8bf['options']['raw']===undefined?!![]:![]:!![],'where':_0x26c8bf[_0x6614('0x16')]?_0x26c8bf['options']['where']||null:null,'attributes':_0x26c8bf[_0x6614('0x16')]?_0x26c8bf[_0x6614('0x16')][_0x6614('0x17')]||null:null,'include':_0x26c8bf[_0x6614('0x16')]?_0x26c8bf['options'][_0x6614('0x18')]?_['map'](_0x26c8bf[_0x6614('0x16')][_0x6614('0x18')],function(_0x36e98f){return{'model':db[_0x36e98f[_0x6614('0x19')]],'as':_0x36e98f['as'],'attributes':_0x36e98f['attributes'],'include':_0x36e98f[_0x6614('0x18')]?_['map'](_0x36e98f[_0x6614('0x18')],function(_0x520c81){return{'model':db[_0x520c81[_0x6614('0x19')]],'as':_0x520c81['as'],'attributes':_0x520c81[_0x6614('0x17')],'include':_0x520c81[_0x6614('0x18')]?_[_0x6614('0x1a')](_0x520c81[_0x6614('0x18')],function(_0x4e1b42){return{'model':db[_0x4e1b42['model']],'as':_0x4e1b42['as'],'attributes':_0x4e1b42['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x222787){logger[_0x6614('0xc')](_0x6614('0x1b'),_0x26c8bf);logger['debug'](_0x6614('0x1b'),_0x26c8bf,JSON[_0x6614('0xf')](_0x222787));_0x31f92d(_0x222787);})[_0x6614('0x13')](function(_0x19eacf){logger[_0x6614('0x10')](_0x6614('0x1b'),_0x19eacf[_0x6614('0x12')],_0x26c8bf);_0x573547(_0x5626cc[_0x6614('0x10')](0x1f4,_0x19eacf[_0x6614('0x12')]));});});}; \ No newline at end of file +var _0x358d=['client','http','request','then','info','Sound,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','ShowSound','Sound','find','options','raw','where','attributes','map','include','model','lodash','util','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x44ce01,_0x275b23){var _0x19c7d=function(_0x1a22af){while(--_0x1a22af){_0x44ce01['push'](_0x44ce01['shift']());}};_0x19c7d(++_0x275b23);}(_0x358d,0x97));var _0xd358=function(_0x1dbb97,_0xc2e02f){_0x1dbb97=_0x1dbb97-0x0;var _0x57612f=_0x358d[_0x1dbb97];return _0x57612f;};'use strict';var _=require(_0xd358('0x0'));var util=require(_0xd358('0x1'));var moment=require('moment');var BPromise=require(_0xd358('0x2'));var rs=require(_0xd358('0x3'));var fs=require('fs');var Redis=require(_0xd358('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xd358('0x5'));var logger=require('../../config/logger')(_0xd358('0x6'));var config=require(_0xd358('0x7'));var jayson=require(_0xd358('0x8'));var client=jayson[_0xd358('0x9')][_0xd358('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5c6742,_0x2ba868,_0x398a48){return new BPromise(function(_0x53d59b,_0x479d71){return client[_0xd358('0xb')](_0x5c6742,_0x398a48)[_0xd358('0xc')](function(_0x2ae69c){logger[_0xd358('0xd')](_0xd358('0xe'),_0x2ba868,_0xd358('0xf'));logger[_0xd358('0x10')]('Sound,\x20%s,\x20%s,\x20%s',_0x2ba868,_0xd358('0xf'),JSON[_0xd358('0x11')](_0x2ae69c));if(_0x2ae69c[_0xd358('0x12')]){if(_0x2ae69c[_0xd358('0x12')]['code']===0x1f4){logger['error']('Sound,\x20%s,\x20%s',_0x2ba868,_0x2ae69c[_0xd358('0x12')][_0xd358('0x13')]);return _0x479d71(_0x2ae69c[_0xd358('0x12')][_0xd358('0x13')]);}logger[_0xd358('0x12')]('Sound,\x20%s,\x20%s',_0x2ba868,_0x2ae69c[_0xd358('0x12')]['message']);return _0x53d59b(_0x2ae69c[_0xd358('0x12')][_0xd358('0x13')]);}else{logger[_0xd358('0xd')](_0xd358('0xe'),_0x2ba868,_0xd358('0xf'));_0x53d59b(_0x2ae69c[_0xd358('0x14')]['message']);}})[_0xd358('0x15')](function(_0x2972ff){logger['error'](_0xd358('0xe'),_0x2ba868,_0x2972ff);_0x479d71(_0x2972ff);});});}exports[_0xd358('0x16')]=function(_0x27240f){var _0x2e552e=this;return new Promise(function(_0x2d55bd,_0x18de6d){return db[_0xd358('0x17')][_0xd358('0x18')]({'raw':_0x27240f[_0xd358('0x19')]?_0x27240f[_0xd358('0x19')][_0xd358('0x1a')]===undefined?!![]:![]:!![],'where':_0x27240f[_0xd358('0x19')]?_0x27240f[_0xd358('0x19')][_0xd358('0x1b')]||null:null,'attributes':_0x27240f['options']?_0x27240f[_0xd358('0x19')][_0xd358('0x1c')]||null:null,'include':_0x27240f['options']?_0x27240f[_0xd358('0x19')]['include']?_[_0xd358('0x1d')](_0x27240f[_0xd358('0x19')][_0xd358('0x1e')],function(_0x27ade1){return{'model':db[_0x27ade1[_0xd358('0x1f')]],'as':_0x27ade1['as'],'attributes':_0x27ade1['attributes'],'include':_0x27ade1[_0xd358('0x1e')]?_[_0xd358('0x1d')](_0x27ade1[_0xd358('0x1e')],function(_0x42c01b){return{'model':db[_0x42c01b[_0xd358('0x1f')]],'as':_0x42c01b['as'],'attributes':_0x42c01b['attributes'],'include':_0x42c01b['include']?_['map'](_0x42c01b[_0xd358('0x1e')],function(_0x42aedb){return{'model':db[_0x42aedb['model']],'as':_0x42aedb['as'],'attributes':_0x42aedb['attributes']};}):[]};}):[]};}):[]:[]})[_0xd358('0xc')](function(_0x362827){logger['info'](_0xd358('0x16'),_0x27240f);logger[_0xd358('0x10')](_0xd358('0x16'),_0x27240f,JSON[_0xd358('0x11')](_0x362827));_0x2d55bd(_0x362827);})['catch'](function(_0x53623a){logger['error'](_0xd358('0x16'),_0x53623a[_0xd358('0x13')],_0x27240f);_0x18de6d(_0x2e552e['error'](0x1f4,_0x53623a['message']));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index 89c60df..f1b65c7 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 _0xd8b0=['update','delete','destroy','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','show','create','put','/:id'];(function(_0xf21e71,_0x16e276){var _0x1a0e33=function(_0x857e1){while(--_0x857e1){_0xf21e71['push'](_0xf21e71['shift']());}};_0x1a0e33(++_0x16e276);}(_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('./squareMessage.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/:id',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['post']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xb')]);router[_0x0d8b('0xc')](_0x0d8b('0xd'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xd'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);module['exports']=router; \ No newline at end of file +var _0xbaf0=['connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareMessage.controller','get','isAuthenticated','index','/:id','post','create','put','update','delete','destroy','exports','util','path'];(function(_0x4c0b3a,_0x262b04){var _0x54f019=function(_0x290fae){while(--_0x290fae){_0x4c0b3a['push'](_0x4c0b3a['shift']());}};_0x54f019(++_0x262b04);}(_0xbaf0,0x12a));var _0x0baf=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xbaf0[_0x6c993a];return _0x27f547;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var fs_extra=require(_0x0baf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var controller=require(_0x0baf('0x8'));router[_0x0baf('0x9')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xb')]);router[_0x0baf('0x9')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller['show']);router[_0x0baf('0xd')]('/',auth['isAuthenticated'](),controller[_0x0baf('0xe')]);router[_0x0baf('0xf')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x10')]);router[_0x0baf('0x11')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x12')]);module[_0x0baf('0x13')]=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index b82408b..a1e2e3f 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 _0x4fb1=['out','sequelize','STRING','TEXT','medium','ENUM'];(function(_0x422905,_0x3bce3a){var _0x33dc6c=function(_0x4852c9){while(--_0x4852c9){_0x422905['push'](_0x422905['shift']());}};_0x33dc6c(++_0x3bce3a);}(_0x4fb1,0x8b));var _0x14fb=function(_0x15da57,_0x1f1240){_0x15da57=_0x15da57-0x0;var _0x1933b1=_0x4fb1[_0x15da57];return _0x1933b1;};'use strict';var Sequelize=require(_0x14fb('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x14fb('0x1')]},'body':{'type':Sequelize[_0x14fb('0x2')](_0x14fb('0x3')),'allowNull':![]},'direction':{'type':Sequelize[_0x14fb('0x4')]('in',_0x14fb('0x5')),'defaultValue':_0x14fb('0x5'),'allowNull':![]},'providerName':{'type':Sequelize[_0x14fb('0x1')]},'providerResponse':{'type':Sequelize[_0x14fb('0x2')]}}; \ No newline at end of file +var _0x5396=['TEXT','sequelize','exports','STRING','ENUM','out'];(function(_0x22d19d,_0x379051){var _0x103fc2=function(_0x10b414){while(--_0x10b414){_0x22d19d['push'](_0x22d19d['shift']());}};_0x103fc2(++_0x379051);}(_0x5396,0x19f));var _0x6539=function(_0x470976,_0x5b95c3){_0x470976=_0x470976-0x0;var _0x164f8f=_0x5396[_0x470976];return _0x164f8f;};'use strict';var Sequelize=require(_0x6539('0x0'));module[_0x6539('0x1')]={'uniqueid':{'type':Sequelize[_0x6539('0x2')]},'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'direction':{'type':Sequelize[_0x6539('0x3')]('in','out'),'defaultValue':_0x6539('0x4'),'allowNull':![]},'providerName':{'type':Sequelize[_0x6539('0x2')]},'providerResponse':{'type':Sequelize[_0x6539('0x5')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index cc0d7f8..e62b590 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 _0xf3d0=['name','filter','includeAll','findAll','catch','show','params','intersection','include','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','crypto','desk.js','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','destroy','error','stack','send','map','SquareMessage','rawAttributes','type','model','query','keys','filters','attributes','fields','length','nolimit','order','sort','where','merge','VIRTUAL'];(function(_0x256684,_0x529c1e){var _0x37a0c9=function(_0x4b431b){while(--_0x4b431b){_0x256684['push'](_0x256684['shift']());}};_0x37a0c9(++_0x529c1e);}(_0xf3d0,0x160));var _0x0f3d=function(_0x26592a,_0x15b3d3){_0x26592a=_0x26592a-0x0;var _0x37acfa=_0xf3d0[_0x26592a];return _0x37acfa;};'use strict';var emlformat=require(_0x0f3d('0x0'));var rimraf=require(_0x0f3d('0x1'));var zipdir=require(_0x0f3d('0x2'));var jsonpatch=require(_0x0f3d('0x3'));var rp=require('request-promise');var moment=require(_0x0f3d('0x4'));var BPromise=require(_0x0f3d('0x5'));var Mustache=require(_0x0f3d('0x6'));var util=require(_0x0f3d('0x7'));var path=require(_0x0f3d('0x8'));var sox=require('sox');var csv=require(_0x0f3d('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0f3d('0xa'));var _=require(_0x0f3d('0xb'));var squel=require('squel');var crypto=require(_0x0f3d('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x0f3d('0xd'));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(_0x0f3d('0xe'));var as=require(_0x0f3d('0xf'));var hardwareService=require(_0x0f3d('0x10'));var logger=require('../../config/logger')(_0x0f3d('0x11'));var utils=require(_0x0f3d('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x0f3d('0x13'));var db=require(_0x0f3d('0x14'))['db'];function respondWithStatusCode(_0x4138ce,_0x5b78cd){_0x5b78cd=_0x5b78cd||0xcc;return function(_0x370450){if(_0x370450){return _0x4138ce[_0x0f3d('0x15')](_0x5b78cd);}return _0x4138ce['status'](_0x5b78cd)[_0x0f3d('0x16')]();};}function respondWithResult(_0x521846,_0x5b9ffb){_0x5b9ffb=_0x5b9ffb||0xc8;return function(_0x1e7874){if(_0x1e7874){return _0x521846[_0x0f3d('0x17')](_0x5b9ffb)[_0x0f3d('0x18')](_0x1e7874);}};}function respondWithFilteredResult(_0x5e6fcc,_0x188110){return function(_0x415053){if(_0x415053){var _0x205d2f=typeof _0x188110['offset']===_0x0f3d('0x19')&&typeof _0x188110[_0x0f3d('0x1a')]===_0x0f3d('0x19');var _0x444d61=_0x415053[_0x0f3d('0x1b')];var _0x5eb0c1=_0x205d2f?0x0:_0x188110[_0x0f3d('0x1c')];var _0x19b85f=_0x205d2f?_0x415053['count']:_0x188110[_0x0f3d('0x1c')]+_0x188110[_0x0f3d('0x1a')];var _0x4f1149;if(_0x19b85f>=_0x444d61){_0x19b85f=_0x444d61;_0x4f1149=0xc8;}else{_0x4f1149=0xce;}_0x5e6fcc[_0x0f3d('0x17')](_0x4f1149);return _0x5e6fcc[_0x0f3d('0x1d')](_0x0f3d('0x1e'),_0x5eb0c1+'-'+_0x19b85f+'/'+_0x444d61)[_0x0f3d('0x18')](_0x415053);}return null;};}function patchUpdates(_0xae0cd0){return function(_0x4f3ab2){try{jsonpatch[_0x0f3d('0x1f')](_0x4f3ab2,_0xae0cd0,!![]);}catch(_0x32b41f){return BPromise[_0x0f3d('0x20')](_0x32b41f);}return _0x4f3ab2['save']();};}function saveUpdates(_0x13638d,_0x18a5c5){return function(_0x3e0f94){if(_0x3e0f94){return _0x3e0f94[_0x0f3d('0x21')](_0x13638d)[_0x0f3d('0x22')](function(_0x55d846){return _0x55d846;});}return null;};}function removeEntity(_0x331ec3,_0x40e83e){return function(_0x3a362d){if(_0x3a362d){return _0x3a362d[_0x0f3d('0x23')]()[_0x0f3d('0x22')](function(){_0x331ec3[_0x0f3d('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x8c89a0,_0x357866){return function(_0x16c8fb){if(!_0x16c8fb){_0x8c89a0['sendStatus'](0x194);}return _0x16c8fb;};}function handleError(_0x2bacb5,_0x3abe5b){_0x3abe5b=_0x3abe5b||0x1f4;return function(_0x47b536){logger[_0x0f3d('0x24')](_0x47b536[_0x0f3d('0x25')]);if(_0x47b536['name']){delete _0x47b536['name'];}_0x2bacb5[_0x0f3d('0x17')](_0x3abe5b)[_0x0f3d('0x26')](_0x47b536);};}exports['index']=function(_0x2fceca,_0xc98a0){var _0x128a81={},_0x9a3ee2={},_0x43664a={'count':0x0,'rows':[]};var _0x5e3b1e=_[_0x0f3d('0x27')](db[_0x0f3d('0x28')][_0x0f3d('0x29')],function(_0x3d0fb5){return{'name':_0x3d0fb5['fieldName'],'type':_0x3d0fb5[_0x0f3d('0x2a')]['key']};});_0x9a3ee2[_0x0f3d('0x2b')]=_[_0x0f3d('0x27')](_0x5e3b1e,'name');_0x9a3ee2[_0x0f3d('0x2c')]=_[_0x0f3d('0x2d')](_0x2fceca[_0x0f3d('0x2c')]);_0x9a3ee2[_0x0f3d('0x2e')]=_['intersection'](_0x9a3ee2['model'],_0x9a3ee2[_0x0f3d('0x2c')]);_0x128a81[_0x0f3d('0x2f')]=_['intersection'](_0x9a3ee2[_0x0f3d('0x2b')],qs[_0x0f3d('0x30')](_0x2fceca['query'][_0x0f3d('0x30')]));_0x128a81[_0x0f3d('0x2f')]=_0x128a81[_0x0f3d('0x2f')][_0x0f3d('0x31')]?_0x128a81['attributes']:_0x9a3ee2[_0x0f3d('0x2b')];if(!_0x2fceca[_0x0f3d('0x2c')]['hasOwnProperty'](_0x0f3d('0x32'))){_0x128a81[_0x0f3d('0x1a')]=qs[_0x0f3d('0x1a')](_0x2fceca[_0x0f3d('0x2c')][_0x0f3d('0x1a')]);_0x128a81[_0x0f3d('0x1c')]=qs[_0x0f3d('0x1c')](_0x2fceca[_0x0f3d('0x2c')]['offset']);}_0x128a81[_0x0f3d('0x33')]=qs[_0x0f3d('0x34')](_0x2fceca[_0x0f3d('0x2c')][_0x0f3d('0x34')]);_0x128a81[_0x0f3d('0x35')]=qs['filters'](_['pick'](_0x2fceca[_0x0f3d('0x2c')],_0x9a3ee2[_0x0f3d('0x2e')]),_0x5e3b1e);if(_0x2fceca[_0x0f3d('0x2c')]['filter']){_0x128a81['where']=_[_0x0f3d('0x36')](_0x128a81[_0x0f3d('0x35')],{'$or':_['map'](_0x5e3b1e,function(_0x5098aa){if(_0x5098aa[_0x0f3d('0x2a')]!==_0x0f3d('0x37')){var _0x39c804={};_0x39c804[_0x5098aa[_0x0f3d('0x38')]]={'$like':'%'+_0x2fceca[_0x0f3d('0x2c')][_0x0f3d('0x39')]+'%'};return _0x39c804;}})});}_0x128a81=_[_0x0f3d('0x36')]({},_0x128a81,_0x2fceca['options']);var _0x29fc70={'where':_0x128a81[_0x0f3d('0x35')]};return db[_0x0f3d('0x28')]['count'](_0x29fc70)[_0x0f3d('0x22')](function(_0x9bc5f8){_0x43664a[_0x0f3d('0x1b')]=_0x9bc5f8;if(_0x2fceca['query'][_0x0f3d('0x3a')]){_0x128a81['include']=[{'all':!![]}];}return db[_0x0f3d('0x28')][_0x0f3d('0x3b')](_0x128a81);})[_0x0f3d('0x22')](function(_0x53ce1e){_0x43664a['rows']=_0x53ce1e;return _0x43664a;})['then'](respondWithFilteredResult(_0xc98a0,_0x128a81))[_0x0f3d('0x3c')](handleError(_0xc98a0,null));};exports[_0x0f3d('0x3d')]=function(_0x2e103b,_0x23020e){var _0x126433={'raw':!![],'where':{'id':_0x2e103b[_0x0f3d('0x3e')]['id']}},_0x30ef8a={};_0x30ef8a[_0x0f3d('0x2b')]=_[_0x0f3d('0x2d')](db[_0x0f3d('0x28')][_0x0f3d('0x29')]);_0x30ef8a['query']=_['keys'](_0x2e103b[_0x0f3d('0x2c')]);_0x30ef8a['filters']=_[_0x0f3d('0x3f')](_0x30ef8a[_0x0f3d('0x2b')],_0x30ef8a[_0x0f3d('0x2c')]);_0x126433[_0x0f3d('0x2f')]=_['intersection'](_0x30ef8a[_0x0f3d('0x2b')],qs[_0x0f3d('0x30')](_0x2e103b['query']['fields']));_0x126433[_0x0f3d('0x2f')]=_0x126433[_0x0f3d('0x2f')][_0x0f3d('0x31')]?_0x126433['attributes']:_0x30ef8a['model'];if(_0x2e103b[_0x0f3d('0x2c')]['includeAll']){_0x126433[_0x0f3d('0x40')]=[{'all':!![]}];}_0x126433=_['merge']({},_0x126433,_0x2e103b['options']);return db['SquareMessage'][_0x0f3d('0x41')](_0x126433)[_0x0f3d('0x22')](handleEntityNotFound(_0x23020e,null))['then'](respondWithResult(_0x23020e,null))['catch'](handleError(_0x23020e,null));};exports[_0x0f3d('0x42')]=function(_0x88f6e0,_0x4fe1b2){return db['SquareMessage'][_0x0f3d('0x42')](_0x88f6e0[_0x0f3d('0x43')],{})[_0x0f3d('0x22')](respondWithResult(_0x4fe1b2,0xc9))[_0x0f3d('0x3c')](handleError(_0x4fe1b2,null));};exports[_0x0f3d('0x21')]=function(_0xa64698,_0x419806){if(_0xa64698[_0x0f3d('0x43')]['id']){delete _0xa64698[_0x0f3d('0x43')]['id'];}return db[_0x0f3d('0x28')][_0x0f3d('0x41')]({'where':{'id':_0xa64698[_0x0f3d('0x3e')]['id']}})[_0x0f3d('0x22')](handleEntityNotFound(_0x419806,null))[_0x0f3d('0x22')](saveUpdates(_0xa64698[_0x0f3d('0x43')],null))[_0x0f3d('0x22')](respondWithResult(_0x419806,null))[_0x0f3d('0x3c')](handleError(_0x419806,null));};exports[_0x0f3d('0x23')]=function(_0x33028b,_0x3004c5){return db[_0x0f3d('0x28')][_0x0f3d('0x41')]({'where':{'id':_0x33028b[_0x0f3d('0x3e')]['id']}})[_0x0f3d('0x22')](handleEntityNotFound(_0x3004c5,null))['then'](removeEntity(_0x3004c5,null))[_0x0f3d('0x3c')](handleError(_0x3004c5,null));}; \ No newline at end of file +var _0xe3b3=['../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','reject','save','destroy','then','error','name','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','SquareMessage','includeAll','include','findAll','rows','catch','show','params','length','update','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0x20d9d1,_0xcf39d2){var _0x54f62a=function(_0x15859c){while(--_0x15859c){_0x20d9d1['push'](_0x20d9d1['shift']());}};_0x54f62a(++_0xcf39d2);}(_0xe3b3,0x1b3));var _0x3e3b=function(_0x25a1c3,_0x1269c2){_0x25a1c3=_0x25a1c3-0x0;var _0x305030=_0xe3b3[_0x25a1c3];return _0x305030;};'use strict';var emlformat=require(_0x3e3b('0x0'));var rimraf=require(_0x3e3b('0x1'));var zipdir=require(_0x3e3b('0x2'));var jsonpatch=require(_0x3e3b('0x3'));var rp=require(_0x3e3b('0x4'));var moment=require(_0x3e3b('0x5'));var BPromise=require(_0x3e3b('0x6'));var Mustache=require(_0x3e3b('0x7'));var util=require(_0x3e3b('0x8'));var path=require(_0x3e3b('0x9'));var sox=require('sox');var csv=require(_0x3e3b('0xa'));var ejs=require(_0x3e3b('0xb'));var fs=require('fs');var fs_extra=require(_0x3e3b('0xc'));var _=require('lodash');var squel=require(_0x3e3b('0xd'));var crypto=require(_0x3e3b('0xe'));var jsforce=require(_0x3e3b('0xf'));var deskjs=require(_0x3e3b('0x10'));var toCsv=require(_0x3e3b('0xa'));var querystring=require(_0x3e3b('0x11'));var Papa=require(_0x3e3b('0x12'));var Redis=require(_0x3e3b('0x13'));var authService=require(_0x3e3b('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x3e3b('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3e3b('0x16'))(_0x3e3b('0x17'));var utils=require(_0x3e3b('0x18'));var config=require(_0x3e3b('0x19'));var licenseUtil=require(_0x3e3b('0x1a'));var db=require(_0x3e3b('0x1b'))['db'];function respondWithStatusCode(_0x1ae7a6,_0x471a74){_0x471a74=_0x471a74||0xcc;return function(_0x107dce){if(_0x107dce){return _0x1ae7a6[_0x3e3b('0x1c')](_0x471a74);}return _0x1ae7a6[_0x3e3b('0x1d')](_0x471a74)[_0x3e3b('0x1e')]();};}function respondWithResult(_0x19878a,_0x1cc39f){_0x1cc39f=_0x1cc39f||0xc8;return function(_0x43eb3a){if(_0x43eb3a){return _0x19878a[_0x3e3b('0x1d')](_0x1cc39f)[_0x3e3b('0x1f')](_0x43eb3a);}};}function respondWithFilteredResult(_0x4fffd3,_0x2a6d19){return function(_0x537e66){if(_0x537e66){var _0x45f5d5=typeof _0x2a6d19[_0x3e3b('0x20')]===_0x3e3b('0x21')&&typeof _0x2a6d19['limit']==='undefined';var _0x5f4e5d=_0x537e66[_0x3e3b('0x22')];var _0x3c9829=_0x45f5d5?0x0:_0x2a6d19[_0x3e3b('0x20')];var _0x35fc4e=_0x45f5d5?_0x537e66[_0x3e3b('0x22')]:_0x2a6d19[_0x3e3b('0x20')]+_0x2a6d19[_0x3e3b('0x23')];var _0x42d031;if(_0x35fc4e>=_0x5f4e5d){_0x35fc4e=_0x5f4e5d;_0x42d031=0xc8;}else{_0x42d031=0xce;}_0x4fffd3['status'](_0x42d031);return _0x4fffd3[_0x3e3b('0x24')]('Content-Range',_0x3c9829+'-'+_0x35fc4e+'/'+_0x5f4e5d)[_0x3e3b('0x1f')](_0x537e66);}return null;};}function patchUpdates(_0x1eb56f){return function(_0x1a096a){try{jsonpatch[_0x3e3b('0x25')](_0x1a096a,_0x1eb56f,!![]);}catch(_0x5a40fe){return BPromise[_0x3e3b('0x26')](_0x5a40fe);}return _0x1a096a[_0x3e3b('0x27')]();};}function saveUpdates(_0x567443,_0x1af87e){return function(_0xc1b47a){if(_0xc1b47a){return _0xc1b47a['update'](_0x567443)['then'](function(_0x5cba48){return _0x5cba48;});}return null;};}function removeEntity(_0x47660d,_0x1334df){return function(_0x15ec1c){if(_0x15ec1c){return _0x15ec1c[_0x3e3b('0x28')]()[_0x3e3b('0x29')](function(){_0x47660d[_0x3e3b('0x1d')](0xcc)[_0x3e3b('0x1e')]();});}};}function handleEntityNotFound(_0x2903aa,_0x1ab037){return function(_0x452be0){if(!_0x452be0){_0x2903aa[_0x3e3b('0x1c')](0x194);}return _0x452be0;};}function handleError(_0x29af34,_0x1ff8c0){_0x1ff8c0=_0x1ff8c0||0x1f4;return function(_0x7da1af){logger[_0x3e3b('0x2a')](_0x7da1af['stack']);if(_0x7da1af[_0x3e3b('0x2b')]){delete _0x7da1af[_0x3e3b('0x2b')];}_0x29af34[_0x3e3b('0x1d')](_0x1ff8c0)['send'](_0x7da1af);};}exports[_0x3e3b('0x2c')]=function(_0x59b061,_0x4588cd){var _0x4bb59f={},_0x5922bb={},_0xc15d5b={'count':0x0,'rows':[]};var _0x3262a4=_[_0x3e3b('0x2d')](db['SquareMessage'][_0x3e3b('0x2e')],function(_0x6ad43e){return{'name':_0x6ad43e['fieldName'],'type':_0x6ad43e[_0x3e3b('0x2f')][_0x3e3b('0x30')]};});_0x5922bb[_0x3e3b('0x31')]=_[_0x3e3b('0x2d')](_0x3262a4,'name');_0x5922bb[_0x3e3b('0x32')]=_[_0x3e3b('0x33')](_0x59b061[_0x3e3b('0x32')]);_0x5922bb[_0x3e3b('0x34')]=_[_0x3e3b('0x35')](_0x5922bb['model'],_0x5922bb[_0x3e3b('0x32')]);_0x4bb59f['attributes']=_[_0x3e3b('0x35')](_0x5922bb[_0x3e3b('0x31')],qs['fields'](_0x59b061[_0x3e3b('0x32')][_0x3e3b('0x36')]));_0x4bb59f['attributes']=_0x4bb59f[_0x3e3b('0x37')]['length']?_0x4bb59f[_0x3e3b('0x37')]:_0x5922bb[_0x3e3b('0x31')];if(!_0x59b061[_0x3e3b('0x32')][_0x3e3b('0x38')](_0x3e3b('0x39'))){_0x4bb59f[_0x3e3b('0x23')]=qs[_0x3e3b('0x23')](_0x59b061[_0x3e3b('0x32')]['limit']);_0x4bb59f[_0x3e3b('0x20')]=qs[_0x3e3b('0x20')](_0x59b061[_0x3e3b('0x32')]['offset']);}_0x4bb59f['order']=qs[_0x3e3b('0x3a')](_0x59b061[_0x3e3b('0x32')][_0x3e3b('0x3a')]);_0x4bb59f[_0x3e3b('0x3b')]=qs[_0x3e3b('0x34')](_[_0x3e3b('0x3c')](_0x59b061[_0x3e3b('0x32')],_0x5922bb[_0x3e3b('0x34')]),_0x3262a4);if(_0x59b061[_0x3e3b('0x32')]['filter']){_0x4bb59f[_0x3e3b('0x3b')]=_['merge'](_0x4bb59f[_0x3e3b('0x3b')],{'$or':_[_0x3e3b('0x2d')](_0x3262a4,function(_0x120844){if(_0x120844[_0x3e3b('0x2f')]!=='VIRTUAL'){var _0x2a48cb={};_0x2a48cb[_0x120844[_0x3e3b('0x2b')]]={'$like':'%'+_0x59b061[_0x3e3b('0x32')][_0x3e3b('0x3d')]+'%'};return _0x2a48cb;}})});}_0x4bb59f=_[_0x3e3b('0x3e')]({},_0x4bb59f,_0x59b061[_0x3e3b('0x3f')]);var _0x7a539e={'where':_0x4bb59f[_0x3e3b('0x3b')]};return db[_0x3e3b('0x40')]['count'](_0x7a539e)['then'](function(_0x460f33){_0xc15d5b[_0x3e3b('0x22')]=_0x460f33;if(_0x59b061[_0x3e3b('0x32')][_0x3e3b('0x41')]){_0x4bb59f[_0x3e3b('0x42')]=[{'all':!![]}];}return db['SquareMessage'][_0x3e3b('0x43')](_0x4bb59f);})[_0x3e3b('0x29')](function(_0x3e36e2){_0xc15d5b[_0x3e3b('0x44')]=_0x3e36e2;return _0xc15d5b;})[_0x3e3b('0x29')](respondWithFilteredResult(_0x4588cd,_0x4bb59f))[_0x3e3b('0x45')](handleError(_0x4588cd,null));};exports[_0x3e3b('0x46')]=function(_0x2ab6df,_0x1b032a){var _0xba3b07={'raw':!![],'where':{'id':_0x2ab6df[_0x3e3b('0x47')]['id']}},_0x3093f5={};_0x3093f5[_0x3e3b('0x31')]=_[_0x3e3b('0x33')](db[_0x3e3b('0x40')][_0x3e3b('0x2e')]);_0x3093f5[_0x3e3b('0x32')]=_['keys'](_0x2ab6df[_0x3e3b('0x32')]);_0x3093f5[_0x3e3b('0x34')]=_[_0x3e3b('0x35')](_0x3093f5[_0x3e3b('0x31')],_0x3093f5[_0x3e3b('0x32')]);_0xba3b07[_0x3e3b('0x37')]=_[_0x3e3b('0x35')](_0x3093f5['model'],qs[_0x3e3b('0x36')](_0x2ab6df['query'][_0x3e3b('0x36')]));_0xba3b07['attributes']=_0xba3b07[_0x3e3b('0x37')][_0x3e3b('0x48')]?_0xba3b07[_0x3e3b('0x37')]:_0x3093f5[_0x3e3b('0x31')];if(_0x2ab6df[_0x3e3b('0x32')][_0x3e3b('0x41')]){_0xba3b07['include']=[{'all':!![]}];}_0xba3b07=_[_0x3e3b('0x3e')]({},_0xba3b07,_0x2ab6df[_0x3e3b('0x3f')]);return db[_0x3e3b('0x40')]['find'](_0xba3b07)[_0x3e3b('0x29')](handleEntityNotFound(_0x1b032a,null))['then'](respondWithResult(_0x1b032a,null))[_0x3e3b('0x45')](handleError(_0x1b032a,null));};exports['create']=function(_0x429393,_0x81e619){return db[_0x3e3b('0x40')]['create'](_0x429393['body'],{})[_0x3e3b('0x29')](respondWithResult(_0x81e619,0xc9))[_0x3e3b('0x45')](handleError(_0x81e619,null));};exports[_0x3e3b('0x49')]=function(_0x333070,_0x947564){if(_0x333070[_0x3e3b('0x4a')]['id']){delete _0x333070[_0x3e3b('0x4a')]['id'];}return db[_0x3e3b('0x40')][_0x3e3b('0x4b')]({'where':{'id':_0x333070['params']['id']}})[_0x3e3b('0x29')](handleEntityNotFound(_0x947564,null))['then'](saveUpdates(_0x333070[_0x3e3b('0x4a')],null))[_0x3e3b('0x29')](respondWithResult(_0x947564,null))['catch'](handleError(_0x947564,null));};exports['destroy']=function(_0x5616fe,_0x40564d){return db[_0x3e3b('0x40')]['find']({'where':{'id':_0x5616fe[_0x3e3b('0x47')]['id']}})['then'](handleEntityNotFound(_0x40564d,null))[_0x3e3b('0x29')](removeEntity(_0x40564d,null))[_0x3e3b('0x45')](handleError(_0x40564d,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index ea74a22..f206e95 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 _0x9bf0=['path','../../config/environment','./squareMessage.attributes','exports','define','square_messages','util','api','bluebird'];(function(_0x3296d1,_0x14a8a7){var _0x1df975=function(_0x111bb5){while(--_0x111bb5){_0x3296d1['push'](_0x3296d1['shift']());}};_0x1df975(++_0x14a8a7);}(_0x9bf0,0x14a));var _0x09bf=function(_0x4cbf20,_0x1bfa66){_0x4cbf20=_0x4cbf20-0x0;var _0x582ae4=_0x9bf0[_0x4cbf20];return _0x582ae4;};'use strict';var _=require('lodash');var util=require(_0x09bf('0x0'));var logger=require('../../config/logger')(_0x09bf('0x1'));var moment=require('moment');var BPromise=require(_0x09bf('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x09bf('0x3'));var rimraf=require('rimraf');var config=require(_0x09bf('0x4'));var attributes=require(_0x09bf('0x5'));module[_0x09bf('0x6')]=function(_0x2fb85b,_0x52556c){return _0x2fb85b[_0x09bf('0x7')]('SquareMessage',attributes,{'tableName':_0x09bf('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3448=['rimraf','../../config/environment','./squareMessage.attributes','define','SquareMessage','square_messages','lodash','util','../../config/logger','api','moment','request-promise','path'];(function(_0xf22107,_0x32a8d9){var _0x272c8a=function(_0x239714){while(--_0x239714){_0xf22107['push'](_0xf22107['shift']());}};_0x272c8a(++_0x32a8d9);}(_0x3448,0x172));var _0x8344=function(_0x127028,_0x524a06){_0x127028=_0x127028-0x0;var _0x129f01=_0x3448[_0x127028];return _0x129f01;};'use strict';var _=require(_0x8344('0x0'));var util=require(_0x8344('0x1'));var logger=require(_0x8344('0x2'))(_0x8344('0x3'));var moment=require(_0x8344('0x4'));var BPromise=require('bluebird');var rp=require(_0x8344('0x5'));var fs=require('fs');var path=require(_0x8344('0x6'));var rimraf=require(_0x8344('0x7'));var config=require(_0x8344('0x8'));var attributes=require(_0x8344('0x9'));module['exports']=function(_0x12f97c,_0x124f2a){return _0x12f97c[_0x8344('0xa')](_0x8344('0xb'),attributes,{'tableName':_0x8344('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 ca991bf..84a93a0 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 _0x833a=['client','http','request','info','SquareMessage,\x20%s,\x20%s','request\x20sent','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','SquareMessage','body','options','raw','CreateSquareMessage','debug','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x4cd727,_0x37335e){var _0x9f3a81=function(_0x2940bd){while(--_0x2940bd){_0x4cd727['push'](_0x4cd727['shift']());}};_0x9f3a81(++_0x37335e);}(_0x833a,0x10f));var _0xa833=function(_0x20a67a,_0x519dee){_0x20a67a=_0x20a67a-0x0;var _0x777bd7=_0x833a[_0x20a67a];return _0x777bd7;};'use strict';var _=require(_0xa833('0x0'));var util=require(_0xa833('0x1'));var moment=require(_0xa833('0x2'));var BPromise=require(_0xa833('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa833('0x4'));var db=require(_0xa833('0x5'))['db'];var utils=require(_0xa833('0x6'));var logger=require(_0xa833('0x7'))('rpc');var config=require(_0xa833('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xa833('0x9')][_0xa833('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4fdd1a,_0x3f05e3,_0x6d016f){return new BPromise(function(_0x23582e,_0x44ebac){return client[_0xa833('0xb')](_0x4fdd1a,_0x6d016f)['then'](function(_0x2ea7e6){logger[_0xa833('0xc')](_0xa833('0xd'),_0x3f05e3,_0xa833('0xe'));logger['debug'](_0xa833('0xf'),_0x3f05e3,_0xa833('0xe'),JSON[_0xa833('0x10')](_0x2ea7e6));if(_0x2ea7e6[_0xa833('0x11')]){if(_0x2ea7e6[_0xa833('0x11')][_0xa833('0x12')]===0x1f4){logger[_0xa833('0x11')]('SquareMessage,\x20%s,\x20%s',_0x3f05e3,_0x2ea7e6[_0xa833('0x11')]['message']);return _0x44ebac(_0x2ea7e6['error'][_0xa833('0x13')]);}logger[_0xa833('0x11')]('SquareMessage,\x20%s,\x20%s',_0x3f05e3,_0x2ea7e6[_0xa833('0x11')][_0xa833('0x13')]);return _0x23582e(_0x2ea7e6[_0xa833('0x11')][_0xa833('0x13')]);}else{logger[_0xa833('0xc')](_0xa833('0xd'),_0x3f05e3,_0xa833('0xe'));_0x23582e(_0x2ea7e6[_0xa833('0x14')][_0xa833('0x13')]);}})[_0xa833('0x15')](function(_0x361624){logger[_0xa833('0x11')](_0xa833('0xd'),_0x3f05e3,_0x361624);_0x44ebac(_0x361624);});});}exports['CreateSquareMessage']=function(_0x6be428){var _0x5ea276=this;return new Promise(function(_0x380c6e,_0x597775){return db[_0xa833('0x16')]['create'](_0x6be428[_0xa833('0x17')],{'raw':_0x6be428['options']?_0x6be428[_0xa833('0x18')][_0xa833('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x3dc062){logger[_0xa833('0xc')](_0xa833('0x1a'),_0x6be428);logger[_0xa833('0x1b')](_0xa833('0x1a'),_0x6be428,JSON['stringify'](_0x3dc062));_0x380c6e(_0x3dc062);})['catch'](function(_0x25121b){logger[_0xa833('0x11')](_0xa833('0x1a'),_0x25121b[_0xa833('0x13')],_0x6be428);_0x597775(_0x5ea276[_0xa833('0x11')](0x1f4,_0x25121b[_0xa833('0x13')]));});});}; \ No newline at end of file +var _0x4081=['then','info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','CreateSquareMessage','SquareMessage','create','body','options','stringify','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x3e2532,_0x81ac5e){var _0x5b2647=function(_0x1896a3){while(--_0x1896a3){_0x3e2532['push'](_0x3e2532['shift']());}};_0x5b2647(++_0x81ac5e);}(_0x4081,0x154));var _0x1408=function(_0x4bd9de,_0x4c79ec){_0x4bd9de=_0x4bd9de-0x0;var _0x4855c0=_0x4081[_0x4bd9de];return _0x4855c0;};'use strict';var _=require('lodash');var util=require(_0x1408('0x0'));var moment=require(_0x1408('0x1'));var BPromise=require(_0x1408('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1408('0x3'));var db=require(_0x1408('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x1408('0x5'))(_0x1408('0x6'));var config=require(_0x1408('0x7'));var jayson=require(_0x1408('0x8'));var client=jayson[_0x1408('0x9')][_0x1408('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x23eb5c,_0x4fa279,_0x3f4353){return new BPromise(function(_0x5d86f4,_0x3f805d){return client['request'](_0x23eb5c,_0x3f4353)[_0x1408('0xb')](function(_0x1d128a){logger[_0x1408('0xc')](_0x1408('0xd'),_0x4fa279,_0x1408('0xe'));logger[_0x1408('0xf')]('SquareMessage,\x20%s,\x20%s,\x20%s',_0x4fa279,_0x1408('0xe'),JSON['stringify'](_0x1d128a));if(_0x1d128a[_0x1408('0x10')]){if(_0x1d128a['error'][_0x1408('0x11')]===0x1f4){logger[_0x1408('0x10')](_0x1408('0xd'),_0x4fa279,_0x1d128a['error'][_0x1408('0x12')]);return _0x3f805d(_0x1d128a[_0x1408('0x10')][_0x1408('0x12')]);}logger[_0x1408('0x10')]('SquareMessage,\x20%s,\x20%s',_0x4fa279,_0x1d128a[_0x1408('0x10')][_0x1408('0x12')]);return _0x5d86f4(_0x1d128a['error'][_0x1408('0x12')]);}else{logger[_0x1408('0xc')](_0x1408('0xd'),_0x4fa279,_0x1408('0xe'));_0x5d86f4(_0x1d128a[_0x1408('0x13')]['message']);}})[_0x1408('0x14')](function(_0x34a67a){logger[_0x1408('0x10')]('SquareMessage,\x20%s,\x20%s',_0x4fa279,_0x34a67a);_0x3f805d(_0x34a67a);});});}exports[_0x1408('0x15')]=function(_0x206567){var _0x56bf60=this;return new Promise(function(_0x18b073,_0x1fbf84){return db[_0x1408('0x16')][_0x1408('0x17')](_0x206567[_0x1408('0x18')],{'raw':_0x206567[_0x1408('0x19')]?_0x206567['options']['raw']===undefined?!![]:![]:!![]})[_0x1408('0xb')](function(_0x2f9d49){logger[_0x1408('0xc')](_0x1408('0x15'),_0x206567);logger[_0x1408('0xf')](_0x1408('0x15'),_0x206567,JSON[_0x1408('0x1a')](_0x2f9d49));_0x18b073(_0x2f9d49);})[_0x1408('0x14')](function(_0x1c26fa){logger[_0x1408('0x10')](_0x1408('0x15'),_0x1c26fa[_0x1408('0x12')],_0x206567);_0x1fbf84(_0x56bf60[_0x1408('0x10')](0x1f4,_0x1c26fa[_0x1408('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index eb6f146..6875edf 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 _0xdeff=['test','post','create','put','/:id','update','delete','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','show'];(function(_0x1f1c15,_0x479902){var _0xd09c74=function(_0x3dca16){while(--_0x3dca16){_0x1f1c15['push'](_0x1f1c15['shift']());}};_0xd09c74(++_0x479902);}(_0xdeff,0x116));var _0xfdef=function(_0x1f99a0,_0x50b73d){_0x1f99a0=_0x1f99a0-0x0;var _0x1e0849=_0xdeff[_0x1f99a0];return _0x1e0849;};'use strict';var multer=require('multer');var util=require(_0xfdef('0x0'));var path=require('path');var timeout=require(_0xfdef('0x1'));var express=require(_0xfdef('0x2'));var router=express[_0xfdef('0x3')]();var fs_extra=require(_0xfdef('0x4'));var auth=require(_0xfdef('0x5'));var interaction=require(_0xfdef('0x6'));var config=require('../../config/environment');var controller=require('./squareOdbc.controller');router[_0xfdef('0x7')]('/',auth[_0xfdef('0x8')](),controller['index']);router[_0xfdef('0x7')]('/:id',auth[_0xfdef('0x8')](),controller[_0xfdef('0x9')]);router[_0xfdef('0x7')]('/:id/test',auth[_0xfdef('0x8')](),timeout('15s'),controller[_0xfdef('0xa')]);router[_0xfdef('0xb')]('/',auth[_0xfdef('0x8')](),controller[_0xfdef('0xc')]);router[_0xfdef('0xd')](_0xfdef('0xe'),auth[_0xfdef('0x8')](),controller[_0xfdef('0xf')]);router[_0xfdef('0x10')](_0xfdef('0xe'),auth[_0xfdef('0x8')](),controller['destroy']);module[_0xfdef('0x11')]=router; \ No newline at end of file +var _0xe85a=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareOdbc.controller','get','index','/:id','show','/:id/test','isAuthenticated','15s','post','create','put','delete','destroy','exports','multer','path','connect-timeout','express'];(function(_0x328bd3,_0x9cf5a5){var _0x458149=function(_0x3f60d9){while(--_0x3f60d9){_0x328bd3['push'](_0x328bd3['shift']());}};_0x458149(++_0x9cf5a5);}(_0xe85a,0x6a));var _0xae85=function(_0xcd17db,_0x1b4ea0){_0xcd17db=_0xcd17db-0x0;var _0x1f3bfa=_0xe85a[_0xcd17db];return _0x1f3bfa;};'use strict';var multer=require(_0xae85('0x0'));var util=require('util');var path=require(_0xae85('0x1'));var timeout=require(_0xae85('0x2'));var express=require(_0xae85('0x3'));var router=express['Router']();var fs_extra=require(_0xae85('0x4'));var auth=require(_0xae85('0x5'));var interaction=require(_0xae85('0x6'));var config=require(_0xae85('0x7'));var controller=require(_0xae85('0x8'));router[_0xae85('0x9')]('/',auth['isAuthenticated'](),controller[_0xae85('0xa')]);router[_0xae85('0x9')](_0xae85('0xb'),auth['isAuthenticated'](),controller[_0xae85('0xc')]);router[_0xae85('0x9')](_0xae85('0xd'),auth[_0xae85('0xe')](),timeout(_0xae85('0xf')),controller['test']);router[_0xae85('0x10')]('/',auth[_0xae85('0xe')](),controller[_0xae85('0x11')]);router[_0xae85('0x12')](_0xae85('0xb'),auth[_0xae85('0xe')](),controller['update']);router[_0xae85('0x13')](_0xae85('0xb'),auth[_0xae85('0xe')](),controller[_0xae85('0x14')]);module[_0xae85('0x15')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index cec9884..c40ed47 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 _0x500a=['STRING','name','sequelize','exports'];(function(_0x3e9395,_0x2c3433){var _0x11193a=function(_0x9baecc){while(--_0x9baecc){_0x3e9395['push'](_0x3e9395['shift']());}};_0x11193a(++_0x2c3433);}(_0x500a,0x12e));var _0xa500=function(_0x2073fa,_0x56d893){_0x2073fa=_0x2073fa-0x0;var _0x35173a=_0x500a[_0x2073fa];return _0x35173a;};'use strict';var Sequelize=require(_0xa500('0x0'));module[_0xa500('0x1')]={'name':{'type':Sequelize[_0xa500('0x2')],'unique':_0xa500('0x3'),'allowNull':![]},'dsn':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xa500('0x2')]}}; \ No newline at end of file +var _0x9671=['STRING','sequelize','exports'];(function(_0x55677b,_0x3e5655){var _0x104b88=function(_0x78d34f){while(--_0x78d34f){_0x55677b['push'](_0x55677b['shift']());}};_0x104b88(++_0x3e5655);}(_0x9671,0x175));var _0x1967=function(_0x336241,_0x4219ad){_0x336241=_0x336241-0x0;var _0x276cac=_0x9671[_0x336241];return _0x276cac;};'use strict';var Sequelize=require(_0x1967('0x0'));module[_0x1967('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'dsn':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x1967('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 3cf9b06..567fbf4 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 _0x7c4b=['Content-Range','apply','reject','save','update','destroy','then','get','sendStatus','error','stack','name','send','index','SquareOdbc','rawAttributes','fieldName','type','key','model','map','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','options','include','findAll','catch','params','keys','includeAll','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','dsn','odbc','closeSync','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','set'];(function(_0x29aefc,_0x4dcf53){var _0x11be36=function(_0x3d472a){while(--_0x3d472a){_0x29aefc['push'](_0x29aefc['shift']());}};_0x11be36(++_0x4dcf53);}(_0x7c4b,0xdf));var _0xb7c4=function(_0x5517f4,_0x22232d){_0x5517f4=_0x5517f4-0x0;var _0x404d02=_0x7c4b[_0x5517f4];return _0x404d02;};'use strict';var emlformat=require(_0xb7c4('0x0'));var rimraf=require(_0xb7c4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb7c4('0x2'));var rp=require(_0xb7c4('0x3'));var moment=require(_0xb7c4('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xb7c4('0x5'));var util=require(_0xb7c4('0x6'));var path=require(_0xb7c4('0x7'));var sox=require('sox');var csv=require(_0xb7c4('0x8'));var ejs=require(_0xb7c4('0x9'));var fs=require('fs');var fs_extra=require(_0xb7c4('0xa'));var _=require('lodash');var squel=require(_0xb7c4('0xb'));var crypto=require(_0xb7c4('0xc'));var jsforce=require(_0xb7c4('0xd'));var deskjs=require(_0xb7c4('0xe'));var toCsv=require(_0xb7c4('0x8'));var querystring=require(_0xb7c4('0xf'));var Papa=require(_0xb7c4('0x10'));var Redis=require(_0xb7c4('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xb7c4('0x12'));var as=require(_0xb7c4('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xb7c4('0x14'));var config=require(_0xb7c4('0x15'));var licenseUtil=require(_0xb7c4('0x16'));var db=require(_0xb7c4('0x17'))['db'];function respondWithStatusCode(_0x530c02,_0x580e23){_0x580e23=_0x580e23||0xcc;return function(_0x4dce36){if(_0x4dce36){return _0x530c02['sendStatus'](_0x580e23);}return _0x530c02[_0xb7c4('0x18')](_0x580e23)[_0xb7c4('0x19')]();};}function respondWithResult(_0x1ffe08,_0x3c831d){_0x3c831d=_0x3c831d||0xc8;return function(_0x35178b){if(_0x35178b){return _0x1ffe08['status'](_0x3c831d)[_0xb7c4('0x1a')](_0x35178b);}};}function respondWithFilteredResult(_0x46efc2,_0x5b7b33){return function(_0x12b980){if(_0x12b980){var _0x2291c4=typeof _0x5b7b33[_0xb7c4('0x1b')]==='undefined'&&typeof _0x5b7b33[_0xb7c4('0x1c')]===_0xb7c4('0x1d');var _0x118f60=_0x12b980['count'];var _0x158f83=_0x2291c4?0x0:_0x5b7b33[_0xb7c4('0x1b')];var _0x366741=_0x2291c4?_0x12b980[_0xb7c4('0x1e')]:_0x5b7b33['offset']+_0x5b7b33[_0xb7c4('0x1c')];var _0x21637b;if(_0x366741>=_0x118f60){_0x366741=_0x118f60;_0x21637b=0xc8;}else{_0x21637b=0xce;}_0x46efc2[_0xb7c4('0x18')](_0x21637b);return _0x46efc2[_0xb7c4('0x1f')](_0xb7c4('0x20'),_0x158f83+'-'+_0x366741+'/'+_0x118f60)[_0xb7c4('0x1a')](_0x12b980);}return null;};}function patchUpdates(_0x49b0e3){return function(_0x3d3f2e){try{jsonpatch[_0xb7c4('0x21')](_0x3d3f2e,_0x49b0e3,!![]);}catch(_0x12ba71){return BPromise[_0xb7c4('0x22')](_0x12ba71);}return _0x3d3f2e[_0xb7c4('0x23')]();};}function saveUpdates(_0x195fed,_0x3801b8){return function(_0x223389){if(_0x223389){return _0x223389[_0xb7c4('0x24')](_0x195fed)['then'](function(_0x112ae4){return _0x112ae4;});}return null;};}function removeEntity(_0x1f4052,_0x28759b){return function(_0x1e3bde){if(_0x1e3bde){return _0x1e3bde[_0xb7c4('0x25')]()[_0xb7c4('0x26')](function(){var _0x1faf2d=_0x1e3bde[_0xb7c4('0x27')]({'plain':!![]});var _0x43e2df='ODBC';return db['UserProfileResource']['destroy']({'where':{'type':_0x43e2df,'resourceId':_0x1faf2d['id']}})[_0xb7c4('0x26')](function(){return _0x1e3bde;});})[_0xb7c4('0x26')](function(){_0x1f4052[_0xb7c4('0x18')](0xcc)[_0xb7c4('0x19')]();});}};}function handleEntityNotFound(_0x30a2ae,_0x14bec4){return function(_0x507232){if(!_0x507232){_0x30a2ae[_0xb7c4('0x28')](0x194);}return _0x507232;};}function handleError(_0x4c9d37,_0x204384){_0x204384=_0x204384||0x1f4;return function(_0x3cf125){logger[_0xb7c4('0x29')](_0x3cf125[_0xb7c4('0x2a')]);if(_0x3cf125[_0xb7c4('0x2b')]){delete _0x3cf125['name'];}_0x4c9d37[_0xb7c4('0x18')](_0x204384)[_0xb7c4('0x2c')](_0x3cf125);};}exports[_0xb7c4('0x2d')]=function(_0x4dfbb8,_0x1da466){var _0x264ebf={},_0x2b4f98={},_0x2d102d={'count':0x0,'rows':[]};var _0x16b16b=_['map'](db[_0xb7c4('0x2e')][_0xb7c4('0x2f')],function(_0xab59fc){return{'name':_0xab59fc[_0xb7c4('0x30')],'type':_0xab59fc[_0xb7c4('0x31')][_0xb7c4('0x32')]};});_0x2b4f98[_0xb7c4('0x33')]=_[_0xb7c4('0x34')](_0x16b16b,_0xb7c4('0x2b'));_0x2b4f98[_0xb7c4('0x35')]=_['keys'](_0x4dfbb8[_0xb7c4('0x35')]);_0x2b4f98[_0xb7c4('0x36')]=_['intersection'](_0x2b4f98['model'],_0x2b4f98[_0xb7c4('0x35')]);_0x264ebf[_0xb7c4('0x37')]=_[_0xb7c4('0x38')](_0x2b4f98[_0xb7c4('0x33')],qs[_0xb7c4('0x39')](_0x4dfbb8[_0xb7c4('0x35')][_0xb7c4('0x39')]));_0x264ebf['attributes']=_0x264ebf[_0xb7c4('0x37')][_0xb7c4('0x3a')]?_0x264ebf[_0xb7c4('0x37')]:_0x2b4f98[_0xb7c4('0x33')];if(!_0x4dfbb8[_0xb7c4('0x35')][_0xb7c4('0x3b')](_0xb7c4('0x3c'))){_0x264ebf[_0xb7c4('0x1c')]=qs['limit'](_0x4dfbb8['query'][_0xb7c4('0x1c')]);_0x264ebf['offset']=qs['offset'](_0x4dfbb8['query'][_0xb7c4('0x1b')]);}_0x264ebf[_0xb7c4('0x3d')]=qs[_0xb7c4('0x3e')](_0x4dfbb8[_0xb7c4('0x35')][_0xb7c4('0x3e')]);_0x264ebf['where']=qs[_0xb7c4('0x36')](_['pick'](_0x4dfbb8[_0xb7c4('0x35')],_0x2b4f98[_0xb7c4('0x36')]),_0x16b16b);if(_0x4dfbb8[_0xb7c4('0x35')][_0xb7c4('0x3f')]){_0x264ebf[_0xb7c4('0x40')]=_[_0xb7c4('0x41')](_0x264ebf['where'],{'$or':_[_0xb7c4('0x34')](_0x16b16b,function(_0x226dae){if(_0x226dae[_0xb7c4('0x31')]!=='VIRTUAL'){var _0x4d5182={};_0x4d5182[_0x226dae[_0xb7c4('0x2b')]]={'$like':'%'+_0x4dfbb8[_0xb7c4('0x35')]['filter']+'%'};return _0x4d5182;}})});}_0x264ebf=_[_0xb7c4('0x41')]({},_0x264ebf,_0x4dfbb8[_0xb7c4('0x42')]);var _0x53e1b4={'where':_0x264ebf[_0xb7c4('0x40')]};return db['SquareOdbc'][_0xb7c4('0x1e')](_0x53e1b4)[_0xb7c4('0x26')](function(_0x3fa446){_0x2d102d['count']=_0x3fa446;if(_0x4dfbb8['query']['includeAll']){_0x264ebf[_0xb7c4('0x43')]=[{'all':!![]}];}return db[_0xb7c4('0x2e')][_0xb7c4('0x44')](_0x264ebf);})['then'](function(_0x159b4f){_0x2d102d['rows']=_0x159b4f;return _0x2d102d;})['then'](respondWithFilteredResult(_0x1da466,_0x264ebf))[_0xb7c4('0x45')](handleError(_0x1da466,null));};exports['show']=function(_0x1dc4f1,_0x1c9563){var _0x306e6c={'raw':!![],'where':{'id':_0x1dc4f1[_0xb7c4('0x46')]['id']}},_0x57ea25={};_0x57ea25[_0xb7c4('0x33')]=_[_0xb7c4('0x47')](db[_0xb7c4('0x2e')][_0xb7c4('0x2f')]);_0x57ea25[_0xb7c4('0x35')]=_['keys'](_0x1dc4f1['query']);_0x57ea25[_0xb7c4('0x36')]=_[_0xb7c4('0x38')](_0x57ea25['model'],_0x57ea25[_0xb7c4('0x35')]);_0x306e6c['attributes']=_[_0xb7c4('0x38')](_0x57ea25[_0xb7c4('0x33')],qs['fields'](_0x1dc4f1['query'][_0xb7c4('0x39')]));_0x306e6c[_0xb7c4('0x37')]=_0x306e6c['attributes'][_0xb7c4('0x3a')]?_0x306e6c[_0xb7c4('0x37')]:_0x57ea25[_0xb7c4('0x33')];if(_0x1dc4f1[_0xb7c4('0x35')][_0xb7c4('0x48')]){_0x306e6c[_0xb7c4('0x43')]=[{'all':!![]}];}_0x306e6c=_[_0xb7c4('0x41')]({},_0x306e6c,_0x1dc4f1['options']);return db[_0xb7c4('0x2e')]['find'](_0x306e6c)[_0xb7c4('0x26')](handleEntityNotFound(_0x1c9563,null))[_0xb7c4('0x26')](respondWithResult(_0x1c9563,null))[_0xb7c4('0x45')](handleError(_0x1c9563,null));};exports[_0xb7c4('0x49')]=function(_0x124fc1,_0x459920){return db[_0xb7c4('0x2e')][_0xb7c4('0x49')](_0x124fc1[_0xb7c4('0x4a')],{})['then'](function(_0x2bd588){var _0x17dbf3=_0x124fc1[_0xb7c4('0x4b')]['get']({'plain':!![]});if(!_0x17dbf3)throw new Error(_0xb7c4('0x4c'));if(_0x17dbf3[_0xb7c4('0x4d')]==='user'){var _0x3388ec=_0x2bd588['get']({'plain':!![]});var _0x57a099='ODBC';return db[_0xb7c4('0x4e')][_0xb7c4('0x4f')]({'where':{'name':_0x57a099,'userProfileId':_0x17dbf3[_0xb7c4('0x50')]},'raw':!![]})[_0xb7c4('0x26')](function(_0x167eb7){if(_0x167eb7&&_0x167eb7['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x3388ec[_0xb7c4('0x2b')],'resourceId':_0x3388ec['id'],'type':_0x167eb7['name'],'sectionId':_0x167eb7['id']},{})[_0xb7c4('0x26')](function(){return _0x2bd588;});}else{return _0x2bd588;}})[_0xb7c4('0x45')](function(_0x2c7386){logger[_0xb7c4('0x29')](_0xb7c4('0x51'),_0x2c7386);throw _0x2c7386;});}return _0x2bd588;})[_0xb7c4('0x26')](respondWithResult(_0x459920,0xc9))[_0xb7c4('0x45')](handleError(_0x459920,null));};exports[_0xb7c4('0x24')]=function(_0x3d4fe7,_0x13a14b){if(_0x3d4fe7['body']['id']){delete _0x3d4fe7[_0xb7c4('0x4a')]['id'];}return db['SquareOdbc']['find']({'where':{'id':_0x3d4fe7[_0xb7c4('0x46')]['id']}})[_0xb7c4('0x26')](handleEntityNotFound(_0x13a14b,null))[_0xb7c4('0x26')](saveUpdates(_0x3d4fe7['body'],null))[_0xb7c4('0x26')](respondWithResult(_0x13a14b,null))[_0xb7c4('0x45')](handleError(_0x13a14b,null));};exports['destroy']=function(_0x4d8d5b,_0xa5e03c){return db['SquareOdbc'][_0xb7c4('0x4f')]({'where':{'id':_0x4d8d5b['params']['id']}})['then'](handleEntityNotFound(_0xa5e03c,null))['then'](removeEntity(_0xa5e03c,null))[_0xb7c4('0x45')](handleError(_0xa5e03c,null));};exports['test']=function(_0x97f58e,_0x99e030,_0x143282){var _0x57b54e;return db[_0xb7c4('0x2e')][_0xb7c4('0x4f')]({'where':{'id':_0x97f58e[_0xb7c4('0x46')]['id']},'attributes':['id',_0xb7c4('0x52')]})[_0xb7c4('0x26')](handleEntityNotFound(_0x99e030,null))[_0xb7c4('0x26')](function(_0x38196f){if(_0x38196f){var _0x366087=require(_0xb7c4('0x53'))();_0x366087['openSync'](_0x38196f['dsn']);_0x366087[_0xb7c4('0x54')]();return _0x38196f;}})[_0xb7c4('0x26')](respondWithResult(_0x99e030,null))[_0xb7c4('0x45')](handleError(_0x99e030,null));}; \ No newline at end of file +var _0xf827=['get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','test','dsn','odbc','closeSync','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','then','ODBC','UserProfileResource','error','stack','name','send','index','rawAttributes','type','map','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','filter','merge','where','VIRTUAL','options','SquareOdbc','includeAll','include','rows','catch','show','find','create','body','user'];(function(_0x21549c,_0x6d64d1){var _0x426cbd=function(_0x323f5b){while(--_0x323f5b){_0x21549c['push'](_0x21549c['shift']());}};_0x426cbd(++_0x6d64d1);}(_0xf827,0x113));var _0x7f82=function(_0x1db65c,_0x4ad8d0){_0x1db65c=_0x1db65c-0x0;var _0x2a77cf=_0xf827[_0x1db65c];return _0x2a77cf;};'use strict';var emlformat=require(_0x7f82('0x0'));var rimraf=require(_0x7f82('0x1'));var zipdir=require(_0x7f82('0x2'));var jsonpatch=require(_0x7f82('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x7f82('0x4'));var util=require(_0x7f82('0x5'));var path=require('path');var sox=require(_0x7f82('0x6'));var csv=require(_0x7f82('0x7'));var ejs=require(_0x7f82('0x8'));var fs=require('fs');var fs_extra=require(_0x7f82('0x9'));var _=require(_0x7f82('0xa'));var squel=require(_0x7f82('0xb'));var crypto=require(_0x7f82('0xc'));var jsforce=require(_0x7f82('0xd'));var deskjs=require(_0x7f82('0xe'));var toCsv=require(_0x7f82('0x7'));var querystring=require(_0x7f82('0xf'));var Papa=require('papaparse');var Redis=require(_0x7f82('0x10'));var authService=require(_0x7f82('0x11'));var qs=require(_0x7f82('0x12'));var as=require(_0x7f82('0x13'));var hardwareService=require(_0x7f82('0x14'));var logger=require('../../config/logger')(_0x7f82('0x15'));var utils=require(_0x7f82('0x16'));var config=require(_0x7f82('0x17'));var licenseUtil=require(_0x7f82('0x18'));var db=require(_0x7f82('0x19'))['db'];function respondWithStatusCode(_0x2b6dff,_0x8db5f7){_0x8db5f7=_0x8db5f7||0xcc;return function(_0x2ad166){if(_0x2ad166){return _0x2b6dff[_0x7f82('0x1a')](_0x8db5f7);}return _0x2b6dff[_0x7f82('0x1b')](_0x8db5f7)[_0x7f82('0x1c')]();};}function respondWithResult(_0xd22b76,_0x120c6b){_0x120c6b=_0x120c6b||0xc8;return function(_0xa2bc43){if(_0xa2bc43){return _0xd22b76[_0x7f82('0x1b')](_0x120c6b)[_0x7f82('0x1d')](_0xa2bc43);}};}function respondWithFilteredResult(_0x572665,_0x376c0b){return function(_0x3b7390){if(_0x3b7390){var _0x216eaa=typeof _0x376c0b[_0x7f82('0x1e')]===_0x7f82('0x1f')&&typeof _0x376c0b[_0x7f82('0x20')]===_0x7f82('0x1f');var _0x3ebee2=_0x3b7390[_0x7f82('0x21')];var _0x302220=_0x216eaa?0x0:_0x376c0b[_0x7f82('0x1e')];var _0x537d8b=_0x216eaa?_0x3b7390[_0x7f82('0x21')]:_0x376c0b[_0x7f82('0x1e')]+_0x376c0b[_0x7f82('0x20')];var _0x1f30cc;if(_0x537d8b>=_0x3ebee2){_0x537d8b=_0x3ebee2;_0x1f30cc=0xc8;}else{_0x1f30cc=0xce;}_0x572665[_0x7f82('0x1b')](_0x1f30cc);return _0x572665[_0x7f82('0x22')]('Content-Range',_0x302220+'-'+_0x537d8b+'/'+_0x3ebee2)[_0x7f82('0x1d')](_0x3b7390);}return null;};}function patchUpdates(_0x4143e8){return function(_0x2a3d0b){try{jsonpatch[_0x7f82('0x23')](_0x2a3d0b,_0x4143e8,!![]);}catch(_0x126c38){return BPromise[_0x7f82('0x24')](_0x126c38);}return _0x2a3d0b[_0x7f82('0x25')]();};}function saveUpdates(_0x26717d,_0x5e198a){return function(_0xe40859){if(_0xe40859){return _0xe40859[_0x7f82('0x26')](_0x26717d)['then'](function(_0x1e3c8f){return _0x1e3c8f;});}return null;};}function removeEntity(_0x658ba4,_0x27d303){return function(_0x24afee){if(_0x24afee){return _0x24afee[_0x7f82('0x27')]()[_0x7f82('0x28')](function(){var _0x2f5bbe=_0x24afee['get']({'plain':!![]});var _0xc6c17f=_0x7f82('0x29');return db[_0x7f82('0x2a')][_0x7f82('0x27')]({'where':{'type':_0xc6c17f,'resourceId':_0x2f5bbe['id']}})[_0x7f82('0x28')](function(){return _0x24afee;});})['then'](function(){_0x658ba4[_0x7f82('0x1b')](0xcc)[_0x7f82('0x1c')]();});}};}function handleEntityNotFound(_0x2a0bcc,_0x1968e2){return function(_0xd9778b){if(!_0xd9778b){_0x2a0bcc['sendStatus'](0x194);}return _0xd9778b;};}function handleError(_0xd33d8,_0x124725){_0x124725=_0x124725||0x1f4;return function(_0x59136c){logger[_0x7f82('0x2b')](_0x59136c[_0x7f82('0x2c')]);if(_0x59136c[_0x7f82('0x2d')]){delete _0x59136c[_0x7f82('0x2d')];}_0xd33d8[_0x7f82('0x1b')](_0x124725)[_0x7f82('0x2e')](_0x59136c);};}exports[_0x7f82('0x2f')]=function(_0x2f8609,_0x27bfbd){var _0x3ad98b={},_0x3b61f5={},_0x4db372={'count':0x0,'rows':[]};var _0x3aa9b7=_['map'](db['SquareOdbc'][_0x7f82('0x30')],function(_0xb48c7f){return{'name':_0xb48c7f['fieldName'],'type':_0xb48c7f[_0x7f82('0x31')]['key']};});_0x3b61f5['model']=_[_0x7f82('0x32')](_0x3aa9b7,_0x7f82('0x2d'));_0x3b61f5['query']=_[_0x7f82('0x33')](_0x2f8609[_0x7f82('0x34')]);_0x3b61f5[_0x7f82('0x35')]=_[_0x7f82('0x36')](_0x3b61f5[_0x7f82('0x37')],_0x3b61f5[_0x7f82('0x34')]);_0x3ad98b[_0x7f82('0x38')]=_[_0x7f82('0x36')](_0x3b61f5[_0x7f82('0x37')],qs[_0x7f82('0x39')](_0x2f8609[_0x7f82('0x34')][_0x7f82('0x39')]));_0x3ad98b[_0x7f82('0x38')]=_0x3ad98b[_0x7f82('0x38')][_0x7f82('0x3a')]?_0x3ad98b[_0x7f82('0x38')]:_0x3b61f5[_0x7f82('0x37')];if(!_0x2f8609['query'][_0x7f82('0x3b')]('nolimit')){_0x3ad98b['limit']=qs[_0x7f82('0x20')](_0x2f8609[_0x7f82('0x34')]['limit']);_0x3ad98b[_0x7f82('0x1e')]=qs[_0x7f82('0x1e')](_0x2f8609[_0x7f82('0x34')]['offset']);}_0x3ad98b[_0x7f82('0x3c')]=qs[_0x7f82('0x3d')](_0x2f8609[_0x7f82('0x34')]['sort']);_0x3ad98b['where']=qs['filters'](_['pick'](_0x2f8609[_0x7f82('0x34')],_0x3b61f5[_0x7f82('0x35')]),_0x3aa9b7);if(_0x2f8609['query'][_0x7f82('0x3e')]){_0x3ad98b['where']=_[_0x7f82('0x3f')](_0x3ad98b[_0x7f82('0x40')],{'$or':_[_0x7f82('0x32')](_0x3aa9b7,function(_0x5bf013){if(_0x5bf013[_0x7f82('0x31')]!==_0x7f82('0x41')){var _0x1ae44c={};_0x1ae44c[_0x5bf013[_0x7f82('0x2d')]]={'$like':'%'+_0x2f8609[_0x7f82('0x34')][_0x7f82('0x3e')]+'%'};return _0x1ae44c;}})});}_0x3ad98b=_[_0x7f82('0x3f')]({},_0x3ad98b,_0x2f8609[_0x7f82('0x42')]);var _0x38f53f={'where':_0x3ad98b['where']};return db[_0x7f82('0x43')][_0x7f82('0x21')](_0x38f53f)[_0x7f82('0x28')](function(_0x151e00){_0x4db372['count']=_0x151e00;if(_0x2f8609[_0x7f82('0x34')][_0x7f82('0x44')]){_0x3ad98b[_0x7f82('0x45')]=[{'all':!![]}];}return db[_0x7f82('0x43')]['findAll'](_0x3ad98b);})['then'](function(_0x3dbf99){_0x4db372[_0x7f82('0x46')]=_0x3dbf99;return _0x4db372;})[_0x7f82('0x28')](respondWithFilteredResult(_0x27bfbd,_0x3ad98b))[_0x7f82('0x47')](handleError(_0x27bfbd,null));};exports[_0x7f82('0x48')]=function(_0x36b9d1,_0x2a7237){var _0x150e96={'raw':!![],'where':{'id':_0x36b9d1['params']['id']}},_0xf96a6b={};_0xf96a6b[_0x7f82('0x37')]=_['keys'](db['SquareOdbc'][_0x7f82('0x30')]);_0xf96a6b[_0x7f82('0x34')]=_['keys'](_0x36b9d1[_0x7f82('0x34')]);_0xf96a6b[_0x7f82('0x35')]=_['intersection'](_0xf96a6b[_0x7f82('0x37')],_0xf96a6b[_0x7f82('0x34')]);_0x150e96['attributes']=_[_0x7f82('0x36')](_0xf96a6b[_0x7f82('0x37')],qs[_0x7f82('0x39')](_0x36b9d1['query'][_0x7f82('0x39')]));_0x150e96['attributes']=_0x150e96[_0x7f82('0x38')][_0x7f82('0x3a')]?_0x150e96[_0x7f82('0x38')]:_0xf96a6b[_0x7f82('0x37')];if(_0x36b9d1[_0x7f82('0x34')][_0x7f82('0x44')]){_0x150e96[_0x7f82('0x45')]=[{'all':!![]}];}_0x150e96=_[_0x7f82('0x3f')]({},_0x150e96,_0x36b9d1[_0x7f82('0x42')]);return db[_0x7f82('0x43')][_0x7f82('0x49')](_0x150e96)[_0x7f82('0x28')](handleEntityNotFound(_0x2a7237,null))['then'](respondWithResult(_0x2a7237,null))['catch'](handleError(_0x2a7237,null));};exports['create']=function(_0x2d41f9,_0x3503c5){return db[_0x7f82('0x43')][_0x7f82('0x4a')](_0x2d41f9[_0x7f82('0x4b')],{})[_0x7f82('0x28')](function(_0x6e2f3){var _0x5e94f4=_0x2d41f9[_0x7f82('0x4c')][_0x7f82('0x4d')]({'plain':!![]});if(!_0x5e94f4)throw new Error(_0x7f82('0x4e'));if(_0x5e94f4[_0x7f82('0x4f')]==='user'){var _0x300b65=_0x6e2f3[_0x7f82('0x4d')]({'plain':!![]});var _0x1dcda4=_0x7f82('0x29');return db[_0x7f82('0x50')][_0x7f82('0x49')]({'where':{'name':_0x1dcda4,'userProfileId':_0x5e94f4['userProfileId']},'raw':!![]})[_0x7f82('0x28')](function(_0x58bb1d){if(_0x58bb1d&&_0x58bb1d[_0x7f82('0x51')]===0x0){return db[_0x7f82('0x2a')][_0x7f82('0x4a')]({'name':_0x300b65[_0x7f82('0x2d')],'resourceId':_0x300b65['id'],'type':_0x58bb1d[_0x7f82('0x2d')],'sectionId':_0x58bb1d['id']},{})['then'](function(){return _0x6e2f3;});}else{return _0x6e2f3;}})[_0x7f82('0x47')](function(_0x4b339c){logger[_0x7f82('0x2b')](_0x7f82('0x52'),_0x4b339c);throw _0x4b339c;});}return _0x6e2f3;})[_0x7f82('0x28')](respondWithResult(_0x3503c5,0xc9))[_0x7f82('0x47')](handleError(_0x3503c5,null));};exports[_0x7f82('0x26')]=function(_0xb8d728,_0xde1dce){if(_0xb8d728[_0x7f82('0x4b')]['id']){delete _0xb8d728['body']['id'];}return db[_0x7f82('0x43')][_0x7f82('0x49')]({'where':{'id':_0xb8d728[_0x7f82('0x53')]['id']}})[_0x7f82('0x28')](handleEntityNotFound(_0xde1dce,null))[_0x7f82('0x28')](saveUpdates(_0xb8d728['body'],null))[_0x7f82('0x28')](respondWithResult(_0xde1dce,null))['catch'](handleError(_0xde1dce,null));};exports[_0x7f82('0x27')]=function(_0x51f0df,_0x1eedc6){return db[_0x7f82('0x43')]['find']({'where':{'id':_0x51f0df[_0x7f82('0x53')]['id']}})[_0x7f82('0x28')](handleEntityNotFound(_0x1eedc6,null))['then'](removeEntity(_0x1eedc6,null))[_0x7f82('0x47')](handleError(_0x1eedc6,null));};exports[_0x7f82('0x54')]=function(_0x356779,_0x357e14,_0x204ed2){var _0x319bc8;return db[_0x7f82('0x43')][_0x7f82('0x49')]({'where':{'id':_0x356779[_0x7f82('0x53')]['id']},'attributes':['id',_0x7f82('0x55')]})[_0x7f82('0x28')](handleEntityNotFound(_0x357e14,null))[_0x7f82('0x28')](function(_0x5490d1){if(_0x5490d1){var _0x288440=require(_0x7f82('0x56'))();_0x288440['openSync'](_0x5490d1[_0x7f82('0x55')]);_0x288440[_0x7f82('0x57')]();return _0x5490d1;}})[_0x7f82('0x28')](respondWithResult(_0x357e14,null))['catch'](handleError(_0x357e14,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index a90bb33..8efec04 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 _0x2ae9=['SquareOdbc','square_odbc','util','../../config/logger','api','bluebird','path','exports','define'];(function(_0x4fc9e6,_0xc51915){var _0x551d28=function(_0x1a603b){while(--_0x1a603b){_0x4fc9e6['push'](_0x4fc9e6['shift']());}};_0x551d28(++_0xc51915);}(_0x2ae9,0x107));var _0x92ae=function(_0x42f036,_0x5e6443){_0x42f036=_0x42f036-0x0;var _0xcda4b=_0x2ae9[_0x42f036];return _0xcda4b;};'use strict';var _=require('lodash');var util=require(_0x92ae('0x0'));var logger=require(_0x92ae('0x1'))(_0x92ae('0x2'));var moment=require('moment');var BPromise=require(_0x92ae('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x92ae('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./squareOdbc.attributes');module[_0x92ae('0x5')]=function(_0x5d7357,_0x5ad955){return _0x5d7357[_0x92ae('0x6')](_0x92ae('0x7'),attributes,{'tableName':_0x92ae('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbd4a=['square_odbc','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./squareOdbc.attributes','exports','SquareOdbc'];(function(_0x4455bc,_0x25c254){var _0x721c22=function(_0x29e62e){while(--_0x29e62e){_0x4455bc['push'](_0x4455bc['shift']());}};_0x721c22(++_0x25c254);}(_0xbd4a,0xb5));var _0xabd4=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xbd4a[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0xabd4('0x0'));var util=require(_0xabd4('0x1'));var logger=require(_0xabd4('0x2'))(_0xabd4('0x3'));var moment=require('moment');var BPromise=require(_0xabd4('0x4'));var rp=require(_0xabd4('0x5'));var fs=require('fs');var path=require(_0xabd4('0x6'));var rimraf=require('rimraf');var config=require(_0xabd4('0x7'));var attributes=require(_0xabd4('0x8'));module[_0xabd4('0x9')]=function(_0x35824f,_0x4fe886){return _0x35824f['define'](_0xabd4('0xa'),attributes,{'tableName':_0xabd4('0xb'),'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 8b04070..44dfda2 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 _0x9363=['jayson/promise','http','request','then','info','SquareOdbc,\x20%s,\x20%s','request\x20sent','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','code','error','message','catch','ShowSquareOdbc','SquareOdbc','options','attributes','include','map','model','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x250f7c,_0xadc77b){var _0x395f32=function(_0x503061){while(--_0x503061){_0x250f7c['push'](_0x250f7c['shift']());}};_0x395f32(++_0xadc77b);}(_0x9363,0x105));var _0x3936=function(_0x441563,_0x1d4a28){_0x441563=_0x441563-0x0;var _0x2369ec=_0x9363[_0x441563];return _0x2369ec;};'use strict';var _=require(_0x3936('0x0'));var util=require(_0x3936('0x1'));var moment=require(_0x3936('0x2'));var BPromise=require(_0x3936('0x3'));var rs=require(_0x3936('0x4'));var fs=require('fs');var Redis=require(_0x3936('0x5'));var db=require(_0x3936('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x3936('0x7'))(_0x3936('0x8'));var config=require('../../config/environment');var jayson=require(_0x3936('0x9'));var client=jayson['client'][_0x3936('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x221bba,_0x5419b3,_0x1641b2){return new BPromise(function(_0x2f9d32,_0x4a2ba6){return client[_0x3936('0xb')](_0x221bba,_0x1641b2)[_0x3936('0xc')](function(_0x103ea1){logger[_0x3936('0xd')](_0x3936('0xe'),_0x5419b3,_0x3936('0xf'));logger['debug'](_0x3936('0x10'),_0x5419b3,_0x3936('0xf'),JSON[_0x3936('0x11')](_0x103ea1));if(_0x103ea1['error']){if(_0x103ea1['error'][_0x3936('0x12')]===0x1f4){logger[_0x3936('0x13')](_0x3936('0xe'),_0x5419b3,_0x103ea1['error'][_0x3936('0x14')]);return _0x4a2ba6(_0x103ea1['error'][_0x3936('0x14')]);}logger[_0x3936('0x13')](_0x3936('0xe'),_0x5419b3,_0x103ea1[_0x3936('0x13')][_0x3936('0x14')]);return _0x2f9d32(_0x103ea1['error']['message']);}else{logger['info'](_0x3936('0xe'),_0x5419b3,'request\x20sent');_0x2f9d32(_0x103ea1['result'][_0x3936('0x14')]);}})[_0x3936('0x15')](function(_0x1b0725){logger[_0x3936('0x13')]('SquareOdbc,\x20%s,\x20%s',_0x5419b3,_0x1b0725);_0x4a2ba6(_0x1b0725);});});}exports[_0x3936('0x16')]=function(_0x455269){var _0x32b3ca=this;return new Promise(function(_0x2329c9,_0x3d487f){return db[_0x3936('0x17')]['find']({'raw':_0x455269[_0x3936('0x18')]?_0x455269[_0x3936('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x455269[_0x3936('0x18')]?_0x455269['options']['where']||null:null,'attributes':_0x455269[_0x3936('0x18')]?_0x455269[_0x3936('0x18')][_0x3936('0x19')]||null:null,'include':_0x455269['options']?_0x455269[_0x3936('0x18')][_0x3936('0x1a')]?_[_0x3936('0x1b')](_0x455269['options'][_0x3936('0x1a')],function(_0x15feaa){return{'model':db[_0x15feaa[_0x3936('0x1c')]],'as':_0x15feaa['as'],'attributes':_0x15feaa[_0x3936('0x19')],'include':_0x15feaa[_0x3936('0x1a')]?_[_0x3936('0x1b')](_0x15feaa[_0x3936('0x1a')],function(_0x48ea22){return{'model':db[_0x48ea22[_0x3936('0x1c')]],'as':_0x48ea22['as'],'attributes':_0x48ea22['attributes'],'include':_0x48ea22[_0x3936('0x1a')]?_[_0x3936('0x1b')](_0x48ea22[_0x3936('0x1a')],function(_0x532225){return{'model':db[_0x532225['model']],'as':_0x532225['as'],'attributes':_0x532225['attributes']};}):[]};}):[]};}):[]:[]})[_0x3936('0xc')](function(_0x1edb24){logger[_0x3936('0xd')](_0x3936('0x16'),_0x455269);logger[_0x3936('0x1d')](_0x3936('0x16'),_0x455269,JSON[_0x3936('0x11')](_0x1edb24));_0x2329c9(_0x1edb24);})[_0x3936('0x15')](function(_0x26615a){logger[_0x3936('0x13')](_0x3936('0x16'),_0x26615a[_0x3936('0x14')],_0x455269);_0x3d487f(_0x32b3ca['error'](0x1f4,_0x26615a[_0x3936('0x14')]));});});}; \ No newline at end of file +var _0x3b94=['util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','then','info','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','ShowSquareOdbc','SquareOdbc','find','options','raw','where','attributes','include','map','model','lodash'];(function(_0x819464,_0x46fc91){var _0x49dcc0=function(_0x36b2b2){while(--_0x36b2b2){_0x819464['push'](_0x819464['shift']());}};_0x49dcc0(++_0x46fc91);}(_0x3b94,0x1d0));var _0x43b9=function(_0x494e5e,_0x28fff6){_0x494e5e=_0x494e5e-0x0;var _0xc1457e=_0x3b94[_0x494e5e];return _0xc1457e;};'use strict';var _=require(_0x43b9('0x0'));var util=require(_0x43b9('0x1'));var moment=require(_0x43b9('0x2'));var BPromise=require(_0x43b9('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x43b9('0x4'));var db=require(_0x43b9('0x5'))['db'];var utils=require(_0x43b9('0x6'));var logger=require(_0x43b9('0x7'))(_0x43b9('0x8'));var config=require('../../config/environment');var jayson=require(_0x43b9('0x9'));var client=jayson['client'][_0x43b9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x322057,_0x45de9c,_0x42ad38){return new BPromise(function(_0x100bf4,_0x14e935){return client['request'](_0x322057,_0x42ad38)[_0x43b9('0xb')](function(_0x12c61c){logger[_0x43b9('0xc')](_0x43b9('0xd'),_0x45de9c,_0x43b9('0xe'));logger[_0x43b9('0xf')](_0x43b9('0x10'),_0x45de9c,_0x43b9('0xe'),JSON[_0x43b9('0x11')](_0x12c61c));if(_0x12c61c['error']){if(_0x12c61c[_0x43b9('0x12')]['code']===0x1f4){logger[_0x43b9('0x12')](_0x43b9('0xd'),_0x45de9c,_0x12c61c[_0x43b9('0x12')][_0x43b9('0x13')]);return _0x14e935(_0x12c61c[_0x43b9('0x12')][_0x43b9('0x13')]);}logger[_0x43b9('0x12')]('SquareOdbc,\x20%s,\x20%s',_0x45de9c,_0x12c61c[_0x43b9('0x12')][_0x43b9('0x13')]);return _0x100bf4(_0x12c61c[_0x43b9('0x12')][_0x43b9('0x13')]);}else{logger[_0x43b9('0xc')](_0x43b9('0xd'),_0x45de9c,_0x43b9('0xe'));_0x100bf4(_0x12c61c['result'][_0x43b9('0x13')]);}})[_0x43b9('0x14')](function(_0x33bb2c){logger['error']('SquareOdbc,\x20%s,\x20%s',_0x45de9c,_0x33bb2c);_0x14e935(_0x33bb2c);});});}exports[_0x43b9('0x15')]=function(_0x2fc2bc){var _0x46dccc=this;return new Promise(function(_0x2fc016,_0x3db0f4){return db[_0x43b9('0x16')][_0x43b9('0x17')]({'raw':_0x2fc2bc[_0x43b9('0x18')]?_0x2fc2bc[_0x43b9('0x18')][_0x43b9('0x19')]===undefined?!![]:![]:!![],'where':_0x2fc2bc[_0x43b9('0x18')]?_0x2fc2bc[_0x43b9('0x18')][_0x43b9('0x1a')]||null:null,'attributes':_0x2fc2bc['options']?_0x2fc2bc[_0x43b9('0x18')][_0x43b9('0x1b')]||null:null,'include':_0x2fc2bc['options']?_0x2fc2bc[_0x43b9('0x18')][_0x43b9('0x1c')]?_[_0x43b9('0x1d')](_0x2fc2bc[_0x43b9('0x18')]['include'],function(_0xfcda87){return{'model':db[_0xfcda87[_0x43b9('0x1e')]],'as':_0xfcda87['as'],'attributes':_0xfcda87[_0x43b9('0x1b')],'include':_0xfcda87[_0x43b9('0x1c')]?_[_0x43b9('0x1d')](_0xfcda87[_0x43b9('0x1c')],function(_0x56d0aa){return{'model':db[_0x56d0aa[_0x43b9('0x1e')]],'as':_0x56d0aa['as'],'attributes':_0x56d0aa[_0x43b9('0x1b')],'include':_0x56d0aa[_0x43b9('0x1c')]?_[_0x43b9('0x1d')](_0x56d0aa['include'],function(_0x321df4){return{'model':db[_0x321df4['model']],'as':_0x321df4['as'],'attributes':_0x321df4[_0x43b9('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x43b9('0xb')](function(_0x1315ff){logger[_0x43b9('0xc')](_0x43b9('0x15'),_0x2fc2bc);logger['debug'](_0x43b9('0x15'),_0x2fc2bc,JSON[_0x43b9('0x11')](_0x1315ff));_0x2fc016(_0x1315ff);})['catch'](function(_0x4a5b74){logger['error'](_0x43b9('0x15'),_0x4a5b74[_0x43b9('0x13')],_0x2fc2bc);_0x3db0f4(_0x46dccc[_0x43b9('0x12')](0x1f4,_0x4a5b74[_0x43b9('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index 670b4be..49d6f14 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 _0xc5af=['../../components/auth/service','../../components/interaction/service','../../config/environment','./squareProject.controller','get','isAuthenticated','index','/:id','post','create','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra'];(function(_0x3e7a1e,_0x1589be){var _0x267c30=function(_0x1f6a70){while(--_0x1f6a70){_0x3e7a1e['push'](_0x3e7a1e['shift']());}};_0x267c30(++_0x1589be);}(_0xc5af,0x135));var _0xfc5a=function(_0x5a0fc8,_0x21be76){_0x5a0fc8=_0x5a0fc8-0x0;var _0x4afc31=_0xc5af[_0x5a0fc8];return _0x4afc31;};'use strict';var multer=require(_0xfc5a('0x0'));var util=require(_0xfc5a('0x1'));var path=require(_0xfc5a('0x2'));var timeout=require('connect-timeout');var express=require(_0xfc5a('0x3'));var router=express[_0xfc5a('0x4')]();var fs_extra=require(_0xfc5a('0x5'));var auth=require(_0xfc5a('0x6'));var interaction=require(_0xfc5a('0x7'));var config=require(_0xfc5a('0x8'));var controller=require(_0xfc5a('0x9'));router[_0xfc5a('0xa')]('/',auth[_0xfc5a('0xb')](),controller[_0xfc5a('0xc')]);router[_0xfc5a('0xa')](_0xfc5a('0xd'),auth['isAuthenticated'](),controller['show']);router[_0xfc5a('0xe')]('/',auth[_0xfc5a('0xb')](),controller[_0xfc5a('0xf')]);router[_0xfc5a('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xfc5a('0x11')]);router[_0xfc5a('0x12')](_0xfc5a('0xd'),auth[_0xfc5a('0xb')](),controller[_0xfc5a('0x13')]);module[_0xfc5a('0x14')]=router; \ No newline at end of file +var _0xa914=['../../config/environment','./squareProject.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy','multer','util','connect-timeout','fs-extra'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa914,0x7c));var _0x4a91=function(_0x4acf20,_0x3f4636){_0x4acf20=_0x4acf20-0x0;var _0x50eabc=_0xa914[_0x4acf20];return _0x50eabc;};'use strict';var multer=require(_0x4a91('0x0'));var util=require(_0x4a91('0x1'));var path=require('path');var timeout=require(_0x4a91('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x4a91('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x4a91('0x4'));var controller=require(_0x4a91('0x5'));router[_0x4a91('0x6')]('/',auth[_0x4a91('0x7')](),controller[_0x4a91('0x8')]);router[_0x4a91('0x6')](_0x4a91('0x9'),auth[_0x4a91('0x7')](),controller[_0x4a91('0xa')]);router[_0x4a91('0xb')]('/',auth[_0x4a91('0x7')](),controller[_0x4a91('0xc')]);router[_0x4a91('0xd')]('/:id',auth[_0x4a91('0x7')](),controller['update']);router[_0x4a91('0xe')]('/:id',auth[_0x4a91('0x7')](),controller[_0x4a91('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index ceb6a1c..5e7d3ae 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 _0x2ca2=['long','preproduction','getDataValue','toString','BLOB','production','utf8','DATE','sequelize','exports','STRING','name'];(function(_0x468383,_0x15c0f1){var _0x9dc1c4=function(_0x203a23){while(--_0x203a23){_0x468383['push'](_0x468383['shift']());}};_0x9dc1c4(++_0x15c0f1);}(_0x2ca2,0x11c));var _0x22ca=function(_0x3c4313,_0x4c508f){_0x3c4313=_0x3c4313-0x0;var _0x177120=_0x2ca2[_0x3c4313];return _0x177120;};'use strict';var Sequelize=require(_0x22ca('0x0'));module[_0x22ca('0x1')]={'name':{'type':Sequelize[_0x22ca('0x2')],'unique':_0x22ca('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x22ca('0x2')]},'notes':{'type':Sequelize['TEXT']},'preproduction':{'type':Sequelize['BLOB'](_0x22ca('0x4')),'get':function(){if(this['getDataValue'](_0x22ca('0x5'))){return this[_0x22ca('0x6')](_0x22ca('0x5'))[_0x22ca('0x7')]('utf8');}}},'production':{'type':Sequelize[_0x22ca('0x8')]('long'),'get':function(){if(this[_0x22ca('0x6')]('production')){return this[_0x22ca('0x6')](_0x22ca('0x9'))[_0x22ca('0x7')](_0x22ca('0xa'));}}},'savedAt':{'type':Sequelize['DATE']},'publishedAt':{'type':Sequelize[_0x22ca('0xb')]}}; \ No newline at end of file +var _0xe14a=['utf8','long','production','DATE','TEXT','BLOB','getDataValue','preproduction','toString'];(function(_0x22899b,_0x29900f){var _0x6506bc=function(_0x120071){while(--_0x120071){_0x22899b['push'](_0x22899b['shift']());}};_0x6506bc(++_0x29900f);}(_0xe14a,0x94));var _0xae14=function(_0x32576b,_0x315e02){_0x32576b=_0x32576b-0x0;var _0x3bd7c7=_0xe14a[_0x32576b];return _0x3bd7c7;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'description':{'type':Sequelize['STRING']},'notes':{'type':Sequelize[_0xae14('0x0')]},'preproduction':{'type':Sequelize[_0xae14('0x1')]('long'),'get':function(){if(this[_0xae14('0x2')](_0xae14('0x3'))){return this[_0xae14('0x2')](_0xae14('0x3'))[_0xae14('0x4')](_0xae14('0x5'));}}},'production':{'type':Sequelize[_0xae14('0x1')](_0xae14('0x6')),'get':function(){if(this[_0xae14('0x2')](_0xae14('0x7'))){return this[_0xae14('0x2')](_0xae14('0x7'))[_0xae14('0x4')]('utf8');}}},'savedAt':{'type':Sequelize['DATE']},'publishedAt':{'type':Sequelize[_0xae14('0x8')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index 31a1eae..be60b5c 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 _0xbe3d=['Content-Range','update','then','destroy','get','SquareProjects','publish','agi','stringify','end','sendStatus','error','name','send','map','SquareProject','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','include','rows','catch','show','params','keys','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','production','lodash','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','status','json','undefined','limit','count','offset'];(function(_0x155d16,_0x30ff43){var _0xda9a99=function(_0x449ee9){while(--_0x449ee9){_0x155d16['push'](_0x155d16['shift']());}};_0xda9a99(++_0x30ff43);}(_0xbe3d,0x79));var _0xdbe3=function(_0xbb6c3e,_0x4bf721){_0xbb6c3e=_0xbb6c3e-0x0;var _0x3a0f89=_0xbe3d[_0xbb6c3e];return _0x3a0f89;};'use strict';var _=require(_0xdbe3('0x0'));var Redis=require(_0xdbe3('0x1'));var qs=require(_0xdbe3('0x2'));var logger=require(_0xdbe3('0x3'))('api');var config=require(_0xdbe3('0x4'));var db=require(_0xdbe3('0x5'))['db'];config[_0xdbe3('0x6')]=_[_0xdbe3('0x7')](config[_0xdbe3('0x6')],{'host':_0xdbe3('0x8'),'port':0x18eb});var socket=require(_0xdbe3('0x9'))(new Redis(config[_0xdbe3('0x6')]));require(_0xdbe3('0xa'))['register'](socket);function respondWithResult(_0x5a2bf0,_0x342bf0){_0x342bf0=_0x342bf0||0xc8;return function(_0x5aa936){if(_0x5aa936){return _0x5a2bf0[_0xdbe3('0xb')](_0x342bf0)[_0xdbe3('0xc')](_0x5aa936);}};}function respondWithFilteredResult(_0x34476a,_0x489568){return function(_0x3989c8){if(_0x3989c8){var _0x27ff46=typeof _0x489568['offset']===_0xdbe3('0xd')&&typeof _0x489568[_0xdbe3('0xe')]===_0xdbe3('0xd');var _0x554985=_0x3989c8[_0xdbe3('0xf')];var _0x40596f=_0x27ff46?0x0:_0x489568[_0xdbe3('0x10')];var _0x52e708=_0x27ff46?_0x3989c8['count']:_0x489568['offset']+_0x489568[_0xdbe3('0xe')];var _0x3a4a48;if(_0x52e708>=_0x554985){_0x52e708=_0x554985;_0x3a4a48=0xc8;}else{_0x3a4a48=0xce;}_0x34476a['status'](_0x3a4a48);return _0x34476a['set'](_0xdbe3('0x11'),_0x40596f+'-'+_0x52e708+'/'+_0x554985)[_0xdbe3('0xc')](_0x3989c8);}return null;};}function saveUpdates(_0x88519){return function(_0x5afc41){if(_0x5afc41){return _0x5afc41[_0xdbe3('0x12')](_0x88519)[_0xdbe3('0x13')](function(_0x570c06){return _0x570c06;});}return null;};}function removeEntity(_0x7ebfe6){return function(_0x2e70ba){if(_0x2e70ba){return _0x2e70ba[_0xdbe3('0x14')]()['then'](function(){var _0x3d26ea=_0x2e70ba[_0xdbe3('0x15')]({'plain':!![]});var _0x1c27ef=_0xdbe3('0x16');return db['UserProfileResource']['destroy']({'where':{'type':_0x1c27ef,'resourceId':_0x3d26ea['id']}})[_0xdbe3('0x13')](function(){return _0x2e70ba;});})['then'](function(){var _0x139555=new Redis(config['redis']);_0x139555[_0xdbe3('0x17')](_0xdbe3('0x18'),JSON[_0xdbe3('0x19')]({'id':_0x2e70ba['id'],'deleted':!![]}));})[_0xdbe3('0x13')](function(){_0x7ebfe6[_0xdbe3('0xb')](0xcc)[_0xdbe3('0x1a')]();});}};}function handleEntityNotFound(_0x5b6a16){return function(_0x4dcbb6){if(!_0x4dcbb6){_0x5b6a16[_0xdbe3('0x1b')](0x194);}return _0x4dcbb6;};}function handleError(_0x4300bd,_0x314368){_0x314368=_0x314368||0x1f4;return function(_0x1923d7){logger[_0xdbe3('0x1c')](_0x1923d7['stack']);if(_0x1923d7[_0xdbe3('0x1d')]){delete _0x1923d7[_0xdbe3('0x1d')];}_0x4300bd[_0xdbe3('0xb')](_0x314368)[_0xdbe3('0x1e')](_0x1923d7);};}exports['index']=function(_0x8784c3,_0x5379e0){var _0x5ea931={},_0x5f07f7={},_0x2c1e1a={'count':0x0,'rows':[]};var _0x2119ff=_[_0xdbe3('0x1f')](db[_0xdbe3('0x20')][_0xdbe3('0x21')],function(_0x262a46){return{'name':_0x262a46[_0xdbe3('0x22')],'type':_0x262a46[_0xdbe3('0x23')][_0xdbe3('0x24')]};});_0x5f07f7[_0xdbe3('0x25')]=_['map'](_0x2119ff,_0xdbe3('0x1d'));_0x5f07f7[_0xdbe3('0x26')]=_['keys'](_0x8784c3['query']);_0x5f07f7[_0xdbe3('0x27')]=_[_0xdbe3('0x28')](_0x5f07f7[_0xdbe3('0x25')],_0x5f07f7['query']);_0x5ea931[_0xdbe3('0x29')]=_[_0xdbe3('0x28')](_0x5f07f7[_0xdbe3('0x25')],qs[_0xdbe3('0x2a')](_0x8784c3[_0xdbe3('0x26')][_0xdbe3('0x2a')]));_0x5ea931[_0xdbe3('0x29')]=_0x5ea931['attributes'][_0xdbe3('0x2b')]?_0x5ea931[_0xdbe3('0x29')]:_0x5f07f7[_0xdbe3('0x25')];if(!_0x8784c3['query'][_0xdbe3('0x2c')](_0xdbe3('0x2d'))){_0x5ea931[_0xdbe3('0xe')]=qs['limit'](_0x8784c3[_0xdbe3('0x26')][_0xdbe3('0xe')]);_0x5ea931[_0xdbe3('0x10')]=qs[_0xdbe3('0x10')](_0x8784c3[_0xdbe3('0x26')][_0xdbe3('0x10')]);}_0x5ea931['order']=qs[_0xdbe3('0x2e')](_0x8784c3[_0xdbe3('0x26')][_0xdbe3('0x2e')]);_0x5ea931['where']=qs[_0xdbe3('0x27')](_[_0xdbe3('0x2f')](_0x8784c3[_0xdbe3('0x26')],_0x5f07f7['filters']),_0x2119ff);if(_0x8784c3[_0xdbe3('0x26')][_0xdbe3('0x30')]){_0x5ea931[_0xdbe3('0x31')]=_[_0xdbe3('0x32')](_0x5ea931['where'],{'$or':_[_0xdbe3('0x1f')](_0x2119ff,function(_0x36a1e3){if(_0x36a1e3[_0xdbe3('0x23')]!==_0xdbe3('0x33')){var _0x26de9a={};_0x26de9a[_0x36a1e3[_0xdbe3('0x1d')]]={'$like':'%'+_0x8784c3['query'][_0xdbe3('0x30')]+'%'};return _0x26de9a;}})});}_0x5ea931=_[_0xdbe3('0x32')]({},_0x5ea931,_0x8784c3['options']);var _0x4c2cf1={'where':_0x5ea931[_0xdbe3('0x31')]};return db['SquareProject']['count'](_0x4c2cf1)[_0xdbe3('0x13')](function(_0x45ab44){_0x2c1e1a[_0xdbe3('0xf')]=_0x45ab44;if(_0x8784c3['query']['includeAll']){_0x5ea931[_0xdbe3('0x34')]=[{'all':!![]}];}return db[_0xdbe3('0x20')]['findAll'](_0x5ea931);})['then'](function(_0x20d48d){_0x2c1e1a[_0xdbe3('0x35')]=_0x20d48d;return _0x2c1e1a;})[_0xdbe3('0x13')](respondWithFilteredResult(_0x5379e0,_0x5ea931))[_0xdbe3('0x36')](handleError(_0x5379e0,null));};exports[_0xdbe3('0x37')]=function(_0x177cce,_0x3d7351){var _0xcba29e={'raw':![],'where':{'id':_0x177cce[_0xdbe3('0x38')]['id']}},_0x1c7df5={};_0x1c7df5[_0xdbe3('0x25')]=_[_0xdbe3('0x39')](db[_0xdbe3('0x20')][_0xdbe3('0x21')]);_0x1c7df5[_0xdbe3('0x26')]=_[_0xdbe3('0x39')](_0x177cce[_0xdbe3('0x26')]);_0x1c7df5[_0xdbe3('0x27')]=_[_0xdbe3('0x28')](_0x1c7df5[_0xdbe3('0x25')],_0x1c7df5['query']);_0xcba29e['attributes']=_['intersection'](_0x1c7df5[_0xdbe3('0x25')],qs[_0xdbe3('0x2a')](_0x177cce[_0xdbe3('0x26')][_0xdbe3('0x2a')]));_0xcba29e['attributes']=_0xcba29e['attributes'][_0xdbe3('0x2b')]?_0xcba29e[_0xdbe3('0x29')]:_0x1c7df5['model'];if(_0x177cce[_0xdbe3('0x26')]['includeAll']){_0xcba29e[_0xdbe3('0x34')]=[{'all':!![]}];}_0xcba29e=_[_0xdbe3('0x32')]({},_0xcba29e,_0x177cce[_0xdbe3('0x3a')]);return db[_0xdbe3('0x20')][_0xdbe3('0x3b')](_0xcba29e)['then'](handleEntityNotFound(_0x3d7351,null))['then'](respondWithResult(_0x3d7351,null))[_0xdbe3('0x36')](handleError(_0x3d7351,null));};exports['create']=function(_0x319171,_0x40530b){return db[_0xdbe3('0x20')][_0xdbe3('0x3c')](_0x319171[_0xdbe3('0x3d')],{})[_0xdbe3('0x13')](function(_0x53a7a9){var _0x2de9ee=_0x319171[_0xdbe3('0x3e')][_0xdbe3('0x15')]({'plain':!![]});if(!_0x2de9ee)throw new Error(_0xdbe3('0x3f'));if(_0x2de9ee[_0xdbe3('0x40')]==='user'){var _0x10f724=_0x53a7a9[_0xdbe3('0x15')]({'plain':!![]});var _0xf9d61a=_0xdbe3('0x16');return db[_0xdbe3('0x41')][_0xdbe3('0x3b')]({'where':{'name':_0xf9d61a,'userProfileId':_0x2de9ee['userProfileId']},'raw':!![]})[_0xdbe3('0x13')](function(_0x25d5cd){if(_0x25d5cd&&_0x25d5cd['autoAssociation']===0x0){return db[_0xdbe3('0x42')][_0xdbe3('0x3c')]({'name':_0x10f724[_0xdbe3('0x1d')],'resourceId':_0x10f724['id'],'type':_0x25d5cd[_0xdbe3('0x1d')],'sectionId':_0x25d5cd['id']},{})['then'](function(){return _0x53a7a9;});}else{return _0x53a7a9;}})[_0xdbe3('0x36')](function(_0x30e3dc){logger[_0xdbe3('0x1c')](_0xdbe3('0x43'),_0x30e3dc);throw _0x30e3dc;});}return _0x53a7a9;})[_0xdbe3('0x13')](respondWithResult(_0x40530b,0xc9))[_0xdbe3('0x36')](handleError(_0x40530b,null));};exports[_0xdbe3('0x12')]=function(_0x3b6f1a,_0x4da62d){if(_0x3b6f1a[_0xdbe3('0x3d')]['id']){delete _0x3b6f1a[_0xdbe3('0x3d')]['id'];}return db[_0xdbe3('0x20')][_0xdbe3('0x3b')]({'where':{'id':_0x3b6f1a['params']['id']}})['then'](handleEntityNotFound(_0x4da62d,null))[_0xdbe3('0x13')](saveUpdates(_0x3b6f1a[_0xdbe3('0x3d')],null))['then'](function(_0x37814c){if(!_0x37814c)return;var _0x23fe25=_0x37814c[_0xdbe3('0x15')]({'plain':!![]});return _0x23fe25;})[_0xdbe3('0x13')](function(_0x4a8f5e){var _0x797358=new Redis(config[_0xdbe3('0x6')]);_0x797358[_0xdbe3('0x17')](_0xdbe3('0x18'),JSON[_0xdbe3('0x19')](_['pick'](_0x4a8f5e,['id',_0xdbe3('0x1d'),_0xdbe3('0x44')])));return _0x4a8f5e;})['then'](respondWithResult(_0x4da62d,null))[_0xdbe3('0x36')](handleError(_0x4da62d,null));};exports['destroy']=function(_0x4b44e9,_0x4b9f76){return db[_0xdbe3('0x20')][_0xdbe3('0x3b')]({'where':{'id':_0x4b44e9[_0xdbe3('0x38')]['id']}})[_0xdbe3('0x13')](handleEntityNotFound(_0x4b9f76,null))[_0xdbe3('0x13')](removeEntity(_0x4b9f76,null))[_0xdbe3('0x36')](handleError(_0x4b9f76,null));}; \ No newline at end of file +var _0x155a=['create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','publish','production','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','localhost','./squareProject.socket','register','status','json','undefined','count','offset','limit','Content-Range','update','destroy','get','SquareProjects','UserProfileResource','then','agi','stringify','end','sendStatus','stack','name','map','SquareProject','rawAttributes','fieldName','type','key','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','include','findAll','catch','show','params','keys','includeAll','find'];(function(_0x5a89ea,_0x436388){var _0x21193d=function(_0x1a9118){while(--_0x1a9118){_0x5a89ea['push'](_0x5a89ea['shift']());}};_0x21193d(++_0x436388);}(_0x155a,0x1e6));var _0xa155=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x155a[_0x199572];return _0x13cfa3;};'use strict';var _=require(_0xa155('0x0'));var Redis=require(_0xa155('0x1'));var qs=require(_0xa155('0x2'));var logger=require(_0xa155('0x3'))(_0xa155('0x4'));var config=require('../../config/environment');var db=require(_0xa155('0x5'))['db'];config[_0xa155('0x6')]=_['defaults'](config['redis'],{'host':_0xa155('0x7'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa155('0x6')]));require(_0xa155('0x8'))[_0xa155('0x9')](socket);function respondWithResult(_0x170a4f,_0xe415a1){_0xe415a1=_0xe415a1||0xc8;return function(_0x521774){if(_0x521774){return _0x170a4f[_0xa155('0xa')](_0xe415a1)[_0xa155('0xb')](_0x521774);}};}function respondWithFilteredResult(_0x4d9c31,_0x33592){return function(_0x2da35b){if(_0x2da35b){var _0x3e39c6=typeof _0x33592['offset']===_0xa155('0xc')&&typeof _0x33592['limit']==='undefined';var _0x194ebd=_0x2da35b[_0xa155('0xd')];var _0x4a1dcb=_0x3e39c6?0x0:_0x33592[_0xa155('0xe')];var _0x2e989d=_0x3e39c6?_0x2da35b[_0xa155('0xd')]:_0x33592[_0xa155('0xe')]+_0x33592[_0xa155('0xf')];var _0x5ac95d;if(_0x2e989d>=_0x194ebd){_0x2e989d=_0x194ebd;_0x5ac95d=0xc8;}else{_0x5ac95d=0xce;}_0x4d9c31[_0xa155('0xa')](_0x5ac95d);return _0x4d9c31['set'](_0xa155('0x10'),_0x4a1dcb+'-'+_0x2e989d+'/'+_0x194ebd)[_0xa155('0xb')](_0x2da35b);}return null;};}function saveUpdates(_0x171fbb){return function(_0x72e470){if(_0x72e470){return _0x72e470[_0xa155('0x11')](_0x171fbb)['then'](function(_0x5dfbea){return _0x5dfbea;});}return null;};}function removeEntity(_0x139efb){return function(_0x52da33){if(_0x52da33){return _0x52da33[_0xa155('0x12')]()['then'](function(){var _0x1033b7=_0x52da33[_0xa155('0x13')]({'plain':!![]});var _0x4d4f59=_0xa155('0x14');return db[_0xa155('0x15')][_0xa155('0x12')]({'where':{'type':_0x4d4f59,'resourceId':_0x1033b7['id']}})[_0xa155('0x16')](function(){return _0x52da33;});})[_0xa155('0x16')](function(){var _0x13b4be=new Redis(config[_0xa155('0x6')]);_0x13b4be['publish'](_0xa155('0x17'),JSON[_0xa155('0x18')]({'id':_0x52da33['id'],'deleted':!![]}));})['then'](function(){_0x139efb[_0xa155('0xa')](0xcc)[_0xa155('0x19')]();});}};}function handleEntityNotFound(_0x453ddb){return function(_0x295a53){if(!_0x295a53){_0x453ddb[_0xa155('0x1a')](0x194);}return _0x295a53;};}function handleError(_0x14cdbc,_0x2d0267){_0x2d0267=_0x2d0267||0x1f4;return function(_0xb7e97){logger['error'](_0xb7e97[_0xa155('0x1b')]);if(_0xb7e97[_0xa155('0x1c')]){delete _0xb7e97[_0xa155('0x1c')];}_0x14cdbc[_0xa155('0xa')](_0x2d0267)['send'](_0xb7e97);};}exports['index']=function(_0x581f2b,_0x2bd12e){var _0x3db065={},_0x693d59={},_0x5e55bf={'count':0x0,'rows':[]};var _0x1f138c=_[_0xa155('0x1d')](db[_0xa155('0x1e')][_0xa155('0x1f')],function(_0x4443a0){return{'name':_0x4443a0[_0xa155('0x20')],'type':_0x4443a0[_0xa155('0x21')][_0xa155('0x22')]};});_0x693d59['model']=_['map'](_0x1f138c,_0xa155('0x1c'));_0x693d59['query']=_['keys'](_0x581f2b[_0xa155('0x23')]);_0x693d59[_0xa155('0x24')]=_['intersection'](_0x693d59[_0xa155('0x25')],_0x693d59[_0xa155('0x23')]);_0x3db065[_0xa155('0x26')]=_[_0xa155('0x27')](_0x693d59[_0xa155('0x25')],qs['fields'](_0x581f2b[_0xa155('0x23')][_0xa155('0x28')]));_0x3db065['attributes']=_0x3db065[_0xa155('0x26')][_0xa155('0x29')]?_0x3db065[_0xa155('0x26')]:_0x693d59['model'];if(!_0x581f2b['query'][_0xa155('0x2a')]('nolimit')){_0x3db065[_0xa155('0xf')]=qs[_0xa155('0xf')](_0x581f2b[_0xa155('0x23')]['limit']);_0x3db065[_0xa155('0xe')]=qs['offset'](_0x581f2b['query'][_0xa155('0xe')]);}_0x3db065[_0xa155('0x2b')]=qs[_0xa155('0x2c')](_0x581f2b[_0xa155('0x23')][_0xa155('0x2c')]);_0x3db065['where']=qs['filters'](_[_0xa155('0x2d')](_0x581f2b[_0xa155('0x23')],_0x693d59[_0xa155('0x24')]),_0x1f138c);if(_0x581f2b[_0xa155('0x23')][_0xa155('0x2e')]){_0x3db065[_0xa155('0x2f')]=_[_0xa155('0x30')](_0x3db065[_0xa155('0x2f')],{'$or':_[_0xa155('0x1d')](_0x1f138c,function(_0x3a0eee){if(_0x3a0eee[_0xa155('0x21')]!==_0xa155('0x31')){var _0x36cbb0={};_0x36cbb0[_0x3a0eee[_0xa155('0x1c')]]={'$like':'%'+_0x581f2b[_0xa155('0x23')][_0xa155('0x2e')]+'%'};return _0x36cbb0;}})});}_0x3db065=_[_0xa155('0x30')]({},_0x3db065,_0x581f2b['options']);var _0x56e01b={'where':_0x3db065[_0xa155('0x2f')]};return db['SquareProject'][_0xa155('0xd')](_0x56e01b)[_0xa155('0x16')](function(_0x26c32e){_0x5e55bf[_0xa155('0xd')]=_0x26c32e;if(_0x581f2b[_0xa155('0x23')]['includeAll']){_0x3db065[_0xa155('0x32')]=[{'all':!![]}];}return db['SquareProject'][_0xa155('0x33')](_0x3db065);})[_0xa155('0x16')](function(_0x16597d){_0x5e55bf['rows']=_0x16597d;return _0x5e55bf;})[_0xa155('0x16')](respondWithFilteredResult(_0x2bd12e,_0x3db065))[_0xa155('0x34')](handleError(_0x2bd12e,null));};exports[_0xa155('0x35')]=function(_0x231a05,_0x2536c5){var _0x5c53bb={'raw':![],'where':{'id':_0x231a05[_0xa155('0x36')]['id']}},_0x326135={};_0x326135[_0xa155('0x25')]=_['keys'](db[_0xa155('0x1e')][_0xa155('0x1f')]);_0x326135[_0xa155('0x23')]=_[_0xa155('0x37')](_0x231a05['query']);_0x326135[_0xa155('0x24')]=_[_0xa155('0x27')](_0x326135['model'],_0x326135[_0xa155('0x23')]);_0x5c53bb[_0xa155('0x26')]=_[_0xa155('0x27')](_0x326135[_0xa155('0x25')],qs[_0xa155('0x28')](_0x231a05[_0xa155('0x23')][_0xa155('0x28')]));_0x5c53bb['attributes']=_0x5c53bb[_0xa155('0x26')]['length']?_0x5c53bb[_0xa155('0x26')]:_0x326135[_0xa155('0x25')];if(_0x231a05['query'][_0xa155('0x38')]){_0x5c53bb[_0xa155('0x32')]=[{'all':!![]}];}_0x5c53bb=_[_0xa155('0x30')]({},_0x5c53bb,_0x231a05['options']);return db[_0xa155('0x1e')][_0xa155('0x39')](_0x5c53bb)[_0xa155('0x16')](handleEntityNotFound(_0x2536c5,null))[_0xa155('0x16')](respondWithResult(_0x2536c5,null))[_0xa155('0x34')](handleError(_0x2536c5,null));};exports[_0xa155('0x3a')]=function(_0x3ed578,_0x293d7a){return db[_0xa155('0x1e')][_0xa155('0x3a')](_0x3ed578[_0xa155('0x3b')],{})[_0xa155('0x16')](function(_0x57fec0){var _0x1a05e2=_0x3ed578['user'][_0xa155('0x13')]({'plain':!![]});if(!_0x1a05e2)throw new Error(_0xa155('0x3c'));if(_0x1a05e2['role']===_0xa155('0x3d')){var _0x51c1c9=_0x57fec0[_0xa155('0x13')]({'plain':!![]});var _0x1fb6d5=_0xa155('0x14');return db['UserProfileSection'][_0xa155('0x39')]({'where':{'name':_0x1fb6d5,'userProfileId':_0x1a05e2[_0xa155('0x3e')]},'raw':!![]})[_0xa155('0x16')](function(_0x5c5b30){if(_0x5c5b30&&_0x5c5b30[_0xa155('0x3f')]===0x0){return db[_0xa155('0x15')][_0xa155('0x3a')]({'name':_0x51c1c9[_0xa155('0x1c')],'resourceId':_0x51c1c9['id'],'type':_0x5c5b30[_0xa155('0x1c')],'sectionId':_0x5c5b30['id']},{})[_0xa155('0x16')](function(){return _0x57fec0;});}else{return _0x57fec0;}})['catch'](function(_0x1fe716){logger[_0xa155('0x40')](_0xa155('0x41'),_0x1fe716);throw _0x1fe716;});}return _0x57fec0;})[_0xa155('0x16')](respondWithResult(_0x293d7a,0xc9))[_0xa155('0x34')](handleError(_0x293d7a,null));};exports[_0xa155('0x11')]=function(_0x2af363,_0xa654cb){if(_0x2af363[_0xa155('0x3b')]['id']){delete _0x2af363[_0xa155('0x3b')]['id'];}return db[_0xa155('0x1e')][_0xa155('0x39')]({'where':{'id':_0x2af363[_0xa155('0x36')]['id']}})[_0xa155('0x16')](handleEntityNotFound(_0xa654cb,null))[_0xa155('0x16')](saveUpdates(_0x2af363[_0xa155('0x3b')],null))['then'](function(_0x12c2bc){if(!_0x12c2bc)return;var _0x54ae8b=_0x12c2bc[_0xa155('0x13')]({'plain':!![]});return _0x54ae8b;})['then'](function(_0x5169ff){var _0x31db30=new Redis(config['redis']);_0x31db30[_0xa155('0x42')]('agi',JSON[_0xa155('0x18')](_['pick'](_0x5169ff,['id',_0xa155('0x1c'),_0xa155('0x43')])));return _0x5169ff;})[_0xa155('0x16')](respondWithResult(_0xa654cb,null))[_0xa155('0x34')](handleError(_0xa654cb,null));};exports[_0xa155('0x12')]=function(_0x382ee6,_0x3d1eb9){return db['SquareProject']['find']({'where':{'id':_0x382ee6[_0xa155('0x36')]['id']}})[_0xa155('0x16')](handleEntityNotFound(_0x3d1eb9,null))[_0xa155('0x16')](removeEntity(_0x3d1eb9,null))[_0xa155('0x34')](handleError(_0x3d1eb9,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index 84193ef..df4c8e0 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 _0x7316=['../../mysqldb','SquareProject','setMaxListeners','save','update','remove','emit','hook','events'];(function(_0x5e4e70,_0xd62f42){var _0x5018c1=function(_0x37d67d){while(--_0x37d67d){_0x5e4e70['push'](_0x5e4e70['shift']());}};_0x5018c1(++_0xd62f42);}(_0x7316,0x1ee));var _0x6731=function(_0x5ddaac,_0x2697a8){_0x5ddaac=_0x5ddaac-0x0;var _0x2a9c58=_0x7316[_0x5ddaac];return _0x2a9c58;};'use strict';var EventEmitter=require(_0x6731('0x0'));var SquareProject=require(_0x6731('0x1'))['db'][_0x6731('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x6731('0x3')](0x0);var events={'afterCreate':_0x6731('0x4'),'afterUpdate':_0x6731('0x5'),'afterDestroy':_0x6731('0x6')};function emitEvent(_0x3ea6a0){return function(_0xbcf012,_0x317dfa,_0x315d55){SquareProjectEvents[_0x6731('0x7')](_0x3ea6a0+':'+_0xbcf012['id'],_0xbcf012);SquareProjectEvents[_0x6731('0x7')](_0x3ea6a0,_0xbcf012);_0x315d55(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SquareProject[_0x6731('0x8')](e,emitEvent(event));}}module['exports']=SquareProjectEvents; \ No newline at end of file +var _0x32a9=['SquareProject','setMaxListeners','save','emit','hasOwnProperty','hook','exports','events'];(function(_0x4acfd2,_0x5b9374){var _0x12afbe=function(_0x5bc178){while(--_0x5bc178){_0x4acfd2['push'](_0x4acfd2['shift']());}};_0x12afbe(++_0x5b9374);}(_0x32a9,0x16f));var _0x932a=function(_0x2064e5,_0x4f6fa2){_0x2064e5=_0x2064e5-0x0;var _0x21a233=_0x32a9[_0x2064e5];return _0x21a233;};'use strict';var EventEmitter=require(_0x932a('0x0'));var SquareProject=require('../../mysqldb')['db'][_0x932a('0x1')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x932a('0x2')](0x0);var events={'afterCreate':_0x932a('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x30453b){return function(_0x16ae74,_0x1e63a2,_0x338c7c){SquareProjectEvents[_0x932a('0x4')](_0x30453b+':'+_0x16ae74['id'],_0x16ae74);SquareProjectEvents[_0x932a('0x4')](_0x30453b,_0x16ae74);_0x338c7c(null);};}for(var e in events){if(events[_0x932a('0x5')](e)){var event=events[e];SquareProject[_0x932a('0x6')](e,emitEvent(event));}}module[_0x932a('0x7')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index e29b892..438836d 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 _0xcbd9=['lodash','api','moment','bluebird','request-promise','path','../../config/environment','./squareProject.attributes','exports','SquareProject','square_projects','changed','preproduction','savedAt','format','production','publishedAt','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x3eac77,_0x3153c1){var _0x180cf2=function(_0x3a4f11){while(--_0x3a4f11){_0x3eac77['push'](_0x3eac77['shift']());}};_0x180cf2(++_0x3153c1);}(_0xcbd9,0x168));var _0x9cbd=function(_0x54e49f,_0x3733ba){_0x54e49f=_0x54e49f-0x0;var _0x1d6c09=_0xcbd9[_0x54e49f];return _0x1d6c09;};'use strict';var _=require(_0x9cbd('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x9cbd('0x1'));var moment=require(_0x9cbd('0x2'));var BPromise=require(_0x9cbd('0x3'));var rp=require(_0x9cbd('0x4'));var fs=require('fs');var path=require(_0x9cbd('0x5'));var rimraf=require('rimraf');var config=require(_0x9cbd('0x6'));var attributes=require(_0x9cbd('0x7'));module[_0x9cbd('0x8')]=function(_0x1f9d49,_0x3542b3){return _0x1f9d49['define'](_0x9cbd('0x9'),attributes,{'tableName':_0x9cbd('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x7155da,_0x39ebba,_0x1b2e2e){if(_0x7155da[_0x9cbd('0xb')](_0x9cbd('0xc'))){_0x7155da[_0x9cbd('0xd')]=moment()[_0x9cbd('0xe')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x7155da[_0x9cbd('0xb')](_0x9cbd('0xf'))){_0x7155da[_0x9cbd('0x10')]=moment()['format'](_0x9cbd('0x11'));}_0x1b2e2e(null,_0x7155da);}}});}; \ No newline at end of file +var _0x054b=['bluebird','request-promise','rimraf','../../config/environment','./squareProject.attributes','exports','square_projects','changed','savedAt','format','YYYY-MM-DD\x20HH:mm:ss','production','publishedAt','lodash','util','../../config/logger','moment'];(function(_0x4c49a5,_0x698519){var _0x3e9d8c=function(_0x3ed3ad){while(--_0x3ed3ad){_0x4c49a5['push'](_0x4c49a5['shift']());}};_0x3e9d8c(++_0x698519);}(_0x054b,0x11d));var _0xb054=function(_0x3c7a93,_0x534527){_0x3c7a93=_0x3c7a93-0x0;var _0x3376c4=_0x054b[_0x3c7a93];return _0x3376c4;};'use strict';var _=require(_0xb054('0x0'));var util=require(_0xb054('0x1'));var logger=require(_0xb054('0x2'))('api');var moment=require(_0xb054('0x3'));var BPromise=require(_0xb054('0x4'));var rp=require(_0xb054('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb054('0x6'));var config=require(_0xb054('0x7'));var attributes=require(_0xb054('0x8'));module[_0xb054('0x9')]=function(_0x1b0dae,_0x7860e0){return _0x1b0dae['define']('SquareProject',attributes,{'tableName':_0xb054('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x45388f,_0x356487,_0x11c03c){if(_0x45388f[_0xb054('0xb')]('preproduction')){_0x45388f[_0xb054('0xc')]=moment()[_0xb054('0xd')](_0xb054('0xe'));}if(_0x45388f[_0xb054('0xb')](_0xb054('0xf'))){_0x45388f[_0xb054('0x10')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x11c03c(null,_0x45388f);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 97e300a..d262586 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 _0xb57e=['attributes','limit','map','include','model','then','info','debug','stringify','catch','error','message','ShowSquareProject','find','lodash','ioredis','../../mysqldb','rpc','redis','localhost','GetSquareProjects','SquareProject','findAll','options','where'];(function(_0x4ef11c,_0x387510){var _0x1c3026=function(_0x582d43){while(--_0x582d43){_0x4ef11c['push'](_0x4ef11c['shift']());}};_0x1c3026(++_0x387510);}(_0xb57e,0x16c));var _0xeb57=function(_0x5517d6,_0x36dbb6){_0x5517d6=_0x5517d6-0x0;var _0x1f61d9=_0xb57e[_0x5517d6];return _0x1f61d9;};'use strict';var _=require(_0xeb57('0x0'));var Redis=require(_0xeb57('0x1'));var db=require(_0xeb57('0x2'))['db'];var logger=require('../../config/logger')(_0xeb57('0x3'));var config=require('../../config/environment');config[_0xeb57('0x4')]=_['defaults'](config['redis'],{'host':_0xeb57('0x5'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xeb57('0x4')]));require('./squareProject.socket')['register'](socket);exports[_0xeb57('0x6')]=function(_0x2df100){var _0x425e7d=this;return new Promise(function(_0x3fa689,_0x107ec4){return db[_0xeb57('0x7')][_0xeb57('0x8')]({'raw':_0x2df100[_0xeb57('0x9')]?_0x2df100['options']['raw']===undefined?!![]:![]:!![],'where':_0x2df100[_0xeb57('0x9')]?_0x2df100[_0xeb57('0x9')][_0xeb57('0xa')]||null:null,'attributes':_0x2df100[_0xeb57('0x9')]?_0x2df100[_0xeb57('0x9')][_0xeb57('0xb')]||null:null,'limit':_0x2df100['options']?_0x2df100[_0xeb57('0x9')][_0xeb57('0xc')]||null:null,'include':_0x2df100['options']?_0x2df100[_0xeb57('0x9')]['include']?_[_0xeb57('0xd')](_0x2df100[_0xeb57('0x9')][_0xeb57('0xe')],function(_0x42afa6){return{'model':db[_0x42afa6[_0xeb57('0xf')]],'as':_0x42afa6['as'],'attributes':_0x42afa6[_0xeb57('0xb')],'include':_0x42afa6[_0xeb57('0xe')]?_[_0xeb57('0xd')](_0x42afa6[_0xeb57('0xe')],function(_0x2be09d){return{'model':db[_0x2be09d['model']],'as':_0x2be09d['as'],'attributes':_0x2be09d[_0xeb57('0xb')],'include':_0x2be09d[_0xeb57('0xe')]?_[_0xeb57('0xd')](_0x2be09d[_0xeb57('0xe')],function(_0x623ccd){return{'model':db[_0x623ccd['model']],'as':_0x623ccd['as'],'attributes':_0x623ccd[_0xeb57('0xb')]};}):[]};}):[]};}):[]:[]})[_0xeb57('0x10')](function(_0x2be9b0){logger[_0xeb57('0x11')](_0xeb57('0x6'),_0x2df100);logger[_0xeb57('0x12')](_0xeb57('0x6'),_0x2df100,JSON[_0xeb57('0x13')](_0x2be9b0));_0x3fa689(_0x2be9b0);})[_0xeb57('0x14')](function(_0x1c2371){logger[_0xeb57('0x15')](_0xeb57('0x6'),_0x1c2371[_0xeb57('0x16')],_0x2df100);_0x107ec4(_0x425e7d['error'](0x1f4,_0x1c2371[_0xeb57('0x16')]));});});};exports[_0xeb57('0x17')]=function(_0x988567){var _0x39fce9=this;return new Promise(function(_0x9fd3de,_0xc59eac){return db[_0xeb57('0x7')][_0xeb57('0x18')]({'raw':_0x988567[_0xeb57('0x9')]?_0x988567['options']['raw']===undefined?!![]:![]:!![],'where':_0x988567[_0xeb57('0x9')]?_0x988567['options'][_0xeb57('0xa')]||null:null,'attributes':_0x988567[_0xeb57('0x9')]?_0x988567[_0xeb57('0x9')][_0xeb57('0xb')]||null:null,'include':_0x988567['options']?_0x988567[_0xeb57('0x9')][_0xeb57('0xe')]?_[_0xeb57('0xd')](_0x988567[_0xeb57('0x9')][_0xeb57('0xe')],function(_0x3ef998){return{'model':db[_0x3ef998[_0xeb57('0xf')]],'as':_0x3ef998['as'],'attributes':_0x3ef998[_0xeb57('0xb')],'include':_0x3ef998['include']?_[_0xeb57('0xd')](_0x3ef998[_0xeb57('0xe')],function(_0x54f6c0){return{'model':db[_0x54f6c0[_0xeb57('0xf')]],'as':_0x54f6c0['as'],'attributes':_0x54f6c0[_0xeb57('0xb')],'include':_0x54f6c0[_0xeb57('0xe')]?_[_0xeb57('0xd')](_0x54f6c0[_0xeb57('0xe')],function(_0x587461){return{'model':db[_0x587461[_0xeb57('0xf')]],'as':_0x587461['as'],'attributes':_0x587461[_0xeb57('0xb')]};}):[]};}):[]};}):[]:[]})[_0xeb57('0x10')](function(_0x1998f4){logger[_0xeb57('0x11')]('ShowSquareProject',_0x988567);logger[_0xeb57('0x12')]('ShowSquareProject',_0x988567,JSON[_0xeb57('0x13')](_0x1998f4));_0x9fd3de(_0x1998f4);})['catch'](function(_0x364cfb){logger[_0xeb57('0x15')](_0xeb57('0x17'),_0x364cfb[_0xeb57('0x16')],_0x988567);_0xc59eac(_0x39fce9[_0xeb57('0x15')](0x1f4,_0x364cfb['message']));});});}; \ No newline at end of file +var _0xcf5d=['ShowSquareProject','ioredis','../../mysqldb','../../config/logger','defaults','redis','localhost','socket.io-emitter','./squareProject.socket','register','GetSquareProjects','SquareProject','findAll','options','raw','attributes','limit','include','map','model','then','info','debug','stringify','error','message','find','where'];(function(_0x490e17,_0x356a88){var _0x1a2781=function(_0x10f1a5){while(--_0x10f1a5){_0x490e17['push'](_0x490e17['shift']());}};_0x1a2781(++_0x356a88);}(_0xcf5d,0xfd));var _0xdcf5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcf5d[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var Redis=require(_0xdcf5('0x0'));var db=require(_0xdcf5('0x1'))['db'];var logger=require(_0xdcf5('0x2'))('rpc');var config=require('../../config/environment');config['redis']=_[_0xdcf5('0x3')](config[_0xdcf5('0x4')],{'host':_0xdcf5('0x5'),'port':0x18eb});var socket=require(_0xdcf5('0x6'))(new Redis(config[_0xdcf5('0x4')]));require(_0xdcf5('0x7'))[_0xdcf5('0x8')](socket);exports[_0xdcf5('0x9')]=function(_0x5ddf98){var _0x5a1069=this;return new Promise(function(_0x195f73,_0x1fd9e1){return db[_0xdcf5('0xa')][_0xdcf5('0xb')]({'raw':_0x5ddf98[_0xdcf5('0xc')]?_0x5ddf98[_0xdcf5('0xc')][_0xdcf5('0xd')]===undefined?!![]:![]:!![],'where':_0x5ddf98[_0xdcf5('0xc')]?_0x5ddf98[_0xdcf5('0xc')]['where']||null:null,'attributes':_0x5ddf98[_0xdcf5('0xc')]?_0x5ddf98['options'][_0xdcf5('0xe')]||null:null,'limit':_0x5ddf98[_0xdcf5('0xc')]?_0x5ddf98[_0xdcf5('0xc')][_0xdcf5('0xf')]||null:null,'include':_0x5ddf98[_0xdcf5('0xc')]?_0x5ddf98[_0xdcf5('0xc')][_0xdcf5('0x10')]?_[_0xdcf5('0x11')](_0x5ddf98['options'][_0xdcf5('0x10')],function(_0x310e08){return{'model':db[_0x310e08['model']],'as':_0x310e08['as'],'attributes':_0x310e08[_0xdcf5('0xe')],'include':_0x310e08[_0xdcf5('0x10')]?_[_0xdcf5('0x11')](_0x310e08[_0xdcf5('0x10')],function(_0x2273f7){return{'model':db[_0x2273f7['model']],'as':_0x2273f7['as'],'attributes':_0x2273f7['attributes'],'include':_0x2273f7[_0xdcf5('0x10')]?_['map'](_0x2273f7[_0xdcf5('0x10')],function(_0x449f0c){return{'model':db[_0x449f0c[_0xdcf5('0x12')]],'as':_0x449f0c['as'],'attributes':_0x449f0c[_0xdcf5('0xe')]};}):[]};}):[]};}):[]:[]})[_0xdcf5('0x13')](function(_0x2f2116){logger[_0xdcf5('0x14')](_0xdcf5('0x9'),_0x5ddf98);logger[_0xdcf5('0x15')](_0xdcf5('0x9'),_0x5ddf98,JSON[_0xdcf5('0x16')](_0x2f2116));_0x195f73(_0x2f2116);})['catch'](function(_0x1ebbeb){logger[_0xdcf5('0x17')]('GetSquareProjects',_0x1ebbeb['message'],_0x5ddf98);_0x1fd9e1(_0x5a1069[_0xdcf5('0x17')](0x1f4,_0x1ebbeb[_0xdcf5('0x18')]));});});};exports['ShowSquareProject']=function(_0x4505b0){var _0x528b52=this;return new Promise(function(_0x2a9a47,_0x2562b9){return db[_0xdcf5('0xa')][_0xdcf5('0x19')]({'raw':_0x4505b0['options']?_0x4505b0[_0xdcf5('0xc')][_0xdcf5('0xd')]===undefined?!![]:![]:!![],'where':_0x4505b0[_0xdcf5('0xc')]?_0x4505b0[_0xdcf5('0xc')][_0xdcf5('0x1a')]||null:null,'attributes':_0x4505b0[_0xdcf5('0xc')]?_0x4505b0[_0xdcf5('0xc')][_0xdcf5('0xe')]||null:null,'include':_0x4505b0['options']?_0x4505b0['options'][_0xdcf5('0x10')]?_[_0xdcf5('0x11')](_0x4505b0['options']['include'],function(_0x3bbafa){return{'model':db[_0x3bbafa['model']],'as':_0x3bbafa['as'],'attributes':_0x3bbafa[_0xdcf5('0xe')],'include':_0x3bbafa[_0xdcf5('0x10')]?_[_0xdcf5('0x11')](_0x3bbafa[_0xdcf5('0x10')],function(_0x5386da){return{'model':db[_0x5386da[_0xdcf5('0x12')]],'as':_0x5386da['as'],'attributes':_0x5386da[_0xdcf5('0xe')],'include':_0x5386da['include']?_[_0xdcf5('0x11')](_0x5386da[_0xdcf5('0x10')],function(_0x2a480c){return{'model':db[_0x2a480c[_0xdcf5('0x12')]],'as':_0x2a480c['as'],'attributes':_0x2a480c[_0xdcf5('0xe')]};}):[]};}):[]};}):[]:[]})[_0xdcf5('0x13')](function(_0x2cea5b){logger[_0xdcf5('0x14')](_0xdcf5('0x1b'),_0x4505b0);logger[_0xdcf5('0x15')](_0xdcf5('0x1b'),_0x4505b0,JSON[_0xdcf5('0x16')](_0x2cea5b));_0x2a9a47(_0x2cea5b);})['catch'](function(_0x5bfa1f){logger[_0xdcf5('0x17')](_0xdcf5('0x1b'),_0x5bfa1f[_0xdcf5('0x18')],_0x4505b0);_0x2562b9(_0x528b52[_0xdcf5('0x17')](0x1f4,_0x5bfa1f['message']));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index e260beb..60114b6 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 _0x0e8b=['remove','update','emit','length','./squareProject.events'];(function(_0x217a53,_0x5bd9fa){var _0xac141f=function(_0x4e5975){while(--_0x4e5975){_0x217a53['push'](_0x217a53['shift']());}};_0xac141f(++_0x5bd9fa);}(_0x0e8b,0x13f));var _0xb0e8=function(_0x5c438d,_0x4d256b){_0x5c438d=_0x5c438d-0x0;var _0x33704f=_0x0e8b[_0x5c438d];return _0x33704f;};'use strict';var SquareProjectEvents=require(_0xb0e8('0x0'));var events=['save',_0xb0e8('0x1'),_0xb0e8('0x2')];function createListener(_0x4ea868,_0x6918f1){return function(_0x18afb6){_0x6918f1[_0xb0e8('0x3')](_0x4ea868,_0x18afb6);};}function removeListener(_0x3c44fd,_0x4e7140){return function(){SquareProjectEvents['removeListener'](_0x3c44fd,_0x4e7140);};}exports['register']=function(_0x2b0635){for(var _0x21b92f=0x0,_0x2e1ee6=events[_0xb0e8('0x4')];_0x21b92f<_0x2e1ee6;_0x21b92f++){var _0x34b1c1=events[_0x21b92f];var _0x5a1c01=createListener('squareProject:'+_0x34b1c1,_0x2b0635);SquareProjectEvents['on'](_0x34b1c1,_0x5a1c01);}}; \ No newline at end of file +var _0xbcd3=['squareProject:','save','remove','update','emit','removeListener','length'];(function(_0x41aec8,_0x5f45f4){var _0x4672e2=function(_0x2f65c5){while(--_0x2f65c5){_0x41aec8['push'](_0x41aec8['shift']());}};_0x4672e2(++_0x5f45f4);}(_0xbcd3,0x143));var _0x3bcd=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xbcd3[_0xa464c9];return _0x3d73c4;};'use strict';var SquareProjectEvents=require('./squareProject.events');var events=[_0x3bcd('0x0'),_0x3bcd('0x1'),_0x3bcd('0x2')];function createListener(_0x25dd07,_0x19354f){return function(_0x4622e9){_0x19354f[_0x3bcd('0x3')](_0x25dd07,_0x4622e9);};}function removeListener(_0x2332a4,_0x580073){return function(){SquareProjectEvents[_0x3bcd('0x4')](_0x2332a4,_0x580073);};}exports['register']=function(_0x33b106){for(var _0x3bff42=0x0,_0xce4aac=events[_0x3bcd('0x5')];_0x3bff42<_0xce4aac;_0x3bff42++){var _0x528a37=events[_0x3bff42];var _0x38443f=createListener(_0x3bcd('0x6')+_0x528a37,_0x33b106);SquareProjectEvents['on'](_0x528a37,_0x38443f);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index 96cf505..edc7e9f 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 _0x5fab=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','isAuthenticated','/:id','show','/:id/download','download','create','put','update','delete','destroy','multer','util','connect-timeout'];(function(_0x1ded63,_0x613b5d){var _0x126a33=function(_0x1a56a7){while(--_0x1a56a7){_0x1ded63['push'](_0x1ded63['shift']());}};_0x126a33(++_0x613b5d);}(_0x5fab,0x177));var _0xb5fa=function(_0x5c1930,_0x1b15e7){_0x5c1930=_0x5c1930-0x0;var _0x163a34=_0x5fab[_0x5c1930];return _0x163a34;};'use strict';var multer=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var path=require('path');var timeout=require(_0xb5fa('0x2'));var express=require(_0xb5fa('0x3'));var router=express[_0xb5fa('0x4')]();var fs_extra=require(_0xb5fa('0x5'));var auth=require(_0xb5fa('0x6'));var interaction=require(_0xb5fa('0x7'));var config=require(_0xb5fa('0x8'));var controller=require(_0xb5fa('0x9'));router[_0xb5fa('0xa')]('/',auth[_0xb5fa('0xb')](),controller['index']);router['get'](_0xb5fa('0xc'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0xd')]);router['get'](_0xb5fa('0xe'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0xb5fa('0x10')]);router[_0xb5fa('0x11')](_0xb5fa('0xc'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x12')]);router[_0xb5fa('0x13')](_0xb5fa('0xc'),auth[_0xb5fa('0xb')](),controller[_0xb5fa('0x14')]);module['exports']=router; \ No newline at end of file +var _0x7a54=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','index','/:id','isAuthenticated','post','put','update','delete','destroy','exports','multer','util','path','express'];(function(_0x23b971,_0x104dcf){var _0x54aa2d=function(_0x4ef77d){while(--_0x4ef77d){_0x23b971['push'](_0x23b971['shift']());}};_0x54aa2d(++_0x104dcf);}(_0x7a54,0x106));var _0x47a5=function(_0x4b4ae7,_0x41efab){_0x4b4ae7=_0x4b4ae7-0x0;var _0x1432af=_0x7a54[_0x4b4ae7];return _0x1432af;};'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('0x9')]('/:id/download',auth['isAuthenticated'](),controller['download']);router[_0x47a5('0xd')]('/',auth[_0x47a5('0xc')](),controller['create']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);router[_0x47a5('0x10')](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller[_0x47a5('0x11')]);module[_0x47a5('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 143d47f..d2efbd4 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 _0x2675=['getDataValue','savePath','lastIndexOf','sequelize','STRING','VIRTUAL'];(function(_0x521500,_0x4cc29f){var _0x4c0a73=function(_0xfbfda){while(--_0xfbfda){_0x521500['push'](_0x521500['shift']());}};_0x4c0a73(++_0x4cc29f);}(_0x2675,0x75));var _0x5267=function(_0x308288,_0x300c57){_0x308288=_0x308288-0x0;var _0x153718=_0x2675[_0x308288];return _0x153718;};'use strict';var Sequelize=require(_0x5267('0x0'));module['exports']={'uniqueid':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x5267('0x1')]},'context':{'type':Sequelize[_0x5267('0x1')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x5267('0x1')]},'accountcode':{'type':Sequelize[_0x5267('0x1')]},'dnid':{'type':Sequelize['STRING']},'projectName':{'type':Sequelize[_0x5267('0x1')]},'saveName':{'type':Sequelize[_0x5267('0x1')]},'filename':{'type':Sequelize[_0x5267('0x1')]},'savePath':{'type':Sequelize[_0x5267('0x1')]},'format':{'type':Sequelize[_0x5267('0x2')],'get':function(){var _0xc56cd5='';var _0x527c16=this[_0x5267('0x3')](_0x5267('0x4'));if(_0x527c16){_0xc56cd5=_0x527c16['substring'](_0x527c16[_0x5267('0x5')]('.'));}return _0xc56cd5;}}}; \ No newline at end of file +var _0xb458=['sequelize','exports','STRING','VIRTUAL','getDataValue','substring','lastIndexOf'];(function(_0x4ed220,_0x5e099c){var _0x3c065b=function(_0x2a7f74){while(--_0x2a7f74){_0x4ed220['push'](_0x4ed220['shift']());}};_0x3c065b(++_0x5e099c);}(_0xb458,0x103));var _0x8b45=function(_0x2bbbab,_0x53275f){_0x2bbbab=_0x2bbbab-0x0;var _0x18816b=_0xb458[_0x2bbbab];return _0x18816b;};'use strict';var Sequelize=require(_0x8b45('0x0'));module[_0x8b45('0x1')]={'uniqueid':{'type':Sequelize[_0x8b45('0x2')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x8b45('0x2')]},'extension':{'type':Sequelize[_0x8b45('0x2')]},'priority':{'type':Sequelize[_0x8b45('0x2')]},'accountcode':{'type':Sequelize[_0x8b45('0x2')]},'dnid':{'type':Sequelize['STRING']},'projectName':{'type':Sequelize[_0x8b45('0x2')]},'saveName':{'type':Sequelize['STRING']},'filename':{'type':Sequelize['STRING']},'savePath':{'type':Sequelize[_0x8b45('0x2')]},'format':{'type':Sequelize[_0x8b45('0x3')],'get':function(){var _0x2daa9a='';var _0x3a8ccb=this[_0x8b45('0x4')]('savePath');if(_0x3a8ccb){_0x2daa9a=_0x3a8ccb[_0x8b45('0x5')](_0x3a8ccb[_0x8b45('0x6')]('.'));}return _0x2daa9a;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index 5c502a0..5e99e91 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 _0xc138=['fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','json','apply','then','destroy','sendStatus','error','stack','send','index','SquareRecording','rawAttributes','name','keys','query','filters','intersection','model','fields','attributes','length','nolimit','order','sort','where','filter','merge','map','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','update','download','../../components/encryptor','type','uniqueid','savePath','filename','format','existsSync','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','mustache','util','sox','ejs'];(function(_0x419e17,_0x7fe78c){var _0x1f2044=function(_0x3723e6){while(--_0x3723e6){_0x419e17['push'](_0x419e17['shift']());}};_0x1f2044(++_0x7fe78c);}(_0xc138,0x172));var _0x8c13=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xc138[_0x4b369d];return _0x571a98;};'use strict';var emlformat=require(_0x8c13('0x0'));var rimraf=require(_0x8c13('0x1'));var zipdir=require(_0x8c13('0x2'));var jsonpatch=require(_0x8c13('0x3'));var rp=require('request-promise');var moment=require(_0x8c13('0x4'));var BPromise=require(_0x8c13('0x5'));var Mustache=require(_0x8c13('0x6'));var util=require(_0x8c13('0x7'));var path=require('path');var sox=require(_0x8c13('0x8'));var csv=require('to-csv');var ejs=require(_0x8c13('0x9'));var fs=require('fs');var fs_extra=require(_0x8c13('0xa'));var _=require('lodash');var squel=require(_0x8c13('0xb'));var crypto=require(_0x8c13('0xc'));var jsforce=require(_0x8c13('0xd'));var deskjs=require(_0x8c13('0xe'));var toCsv=require(_0x8c13('0xf'));var querystring=require(_0x8c13('0x10'));var Papa=require(_0x8c13('0x11'));var Redis=require(_0x8c13('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x8c13('0x13'));var as=require(_0x8c13('0x14'));var hardwareService=require(_0x8c13('0x15'));var logger=require('../../config/logger')(_0x8c13('0x16'));var utils=require('../../config/utils');var config=require(_0x8c13('0x17'));var licenseUtil=require(_0x8c13('0x18'));var db=require(_0x8c13('0x19'))['db'];function respondWithStatusCode(_0x4b5b17,_0x1edc4d){_0x1edc4d=_0x1edc4d||0xcc;return function(_0x2f3de5){if(_0x2f3de5){return _0x4b5b17['sendStatus'](_0x1edc4d);}return _0x4b5b17[_0x8c13('0x1a')](_0x1edc4d)[_0x8c13('0x1b')]();};}function respondWithResult(_0x2aeedf,_0x2dca00){_0x2dca00=_0x2dca00||0xc8;return function(_0x99548b){if(_0x99548b){return _0x2aeedf[_0x8c13('0x1a')](_0x2dca00)['json'](_0x99548b);}};}function respondWithFilteredResult(_0x308712,_0x574162){return function(_0xf243cb){if(_0xf243cb){var _0xaa1056=typeof _0x574162[_0x8c13('0x1c')]===_0x8c13('0x1d')&&typeof _0x574162[_0x8c13('0x1e')]==='undefined';var _0x145a38=_0xf243cb[_0x8c13('0x1f')];var _0x1859be=_0xaa1056?0x0:_0x574162[_0x8c13('0x1c')];var _0x289604=_0xaa1056?_0xf243cb[_0x8c13('0x1f')]:_0x574162[_0x8c13('0x1c')]+_0x574162[_0x8c13('0x1e')];var _0x4a6b26;if(_0x289604>=_0x145a38){_0x289604=_0x145a38;_0x4a6b26=0xc8;}else{_0x4a6b26=0xce;}_0x308712['status'](_0x4a6b26);return _0x308712['set']('Content-Range',_0x1859be+'-'+_0x289604+'/'+_0x145a38)[_0x8c13('0x20')](_0xf243cb);}return null;};}function patchUpdates(_0x3a2e7b){return function(_0x12be33){try{jsonpatch[_0x8c13('0x21')](_0x12be33,_0x3a2e7b,!![]);}catch(_0x29dc02){return BPromise['reject'](_0x29dc02);}return _0x12be33['save']();};}function saveUpdates(_0x1f6de8,_0xd47abd){return function(_0x34b118){if(_0x34b118){return _0x34b118['update'](_0x1f6de8)[_0x8c13('0x22')](function(_0x516610){return _0x516610;});}return null;};}function removeEntity(_0x11c993,_0x1ac07f){return function(_0x289587){if(_0x289587){return _0x289587[_0x8c13('0x23')]()['then'](function(){_0x11c993[_0x8c13('0x1a')](0xcc)[_0x8c13('0x1b')]();});}};}function handleEntityNotFound(_0xa3708b,_0x2df9d8){return function(_0x50d6a5){if(!_0x50d6a5){_0xa3708b[_0x8c13('0x24')](0x194);}return _0x50d6a5;};}function handleError(_0x2f7f21,_0xcbf49){_0xcbf49=_0xcbf49||0x1f4;return function(_0x295cc0){logger[_0x8c13('0x25')](_0x295cc0[_0x8c13('0x26')]);if(_0x295cc0['name']){delete _0x295cc0['name'];}_0x2f7f21['status'](_0xcbf49)[_0x8c13('0x27')](_0x295cc0);};}exports[_0x8c13('0x28')]=function(_0x541d21,_0x4b0c7e){var _0x14d250={},_0x291207={},_0x1c9507={'count':0x0,'rows':[]};var _0x50d29c=_['map'](db[_0x8c13('0x29')][_0x8c13('0x2a')],function(_0x56cbc){return{'name':_0x56cbc['fieldName'],'type':_0x56cbc['type']['key']};});_0x291207['model']=_['map'](_0x50d29c,_0x8c13('0x2b'));_0x291207['query']=_[_0x8c13('0x2c')](_0x541d21[_0x8c13('0x2d')]);_0x291207[_0x8c13('0x2e')]=_[_0x8c13('0x2f')](_0x291207[_0x8c13('0x30')],_0x291207[_0x8c13('0x2d')]);_0x14d250['attributes']=_[_0x8c13('0x2f')](_0x291207['model'],qs['fields'](_0x541d21[_0x8c13('0x2d')][_0x8c13('0x31')]));_0x14d250[_0x8c13('0x32')]=_0x14d250[_0x8c13('0x32')][_0x8c13('0x33')]?_0x14d250[_0x8c13('0x32')]:_0x291207[_0x8c13('0x30')];if(!_0x541d21[_0x8c13('0x2d')]['hasOwnProperty'](_0x8c13('0x34'))){_0x14d250[_0x8c13('0x1e')]=qs[_0x8c13('0x1e')](_0x541d21[_0x8c13('0x2d')][_0x8c13('0x1e')]);_0x14d250[_0x8c13('0x1c')]=qs['offset'](_0x541d21[_0x8c13('0x2d')][_0x8c13('0x1c')]);}_0x14d250[_0x8c13('0x35')]=qs['sort'](_0x541d21[_0x8c13('0x2d')][_0x8c13('0x36')]);_0x14d250[_0x8c13('0x37')]=qs['filters'](_['pick'](_0x541d21['query'],_0x291207[_0x8c13('0x2e')]),_0x50d29c);if(_0x541d21[_0x8c13('0x2d')][_0x8c13('0x38')]){_0x14d250[_0x8c13('0x37')]=_[_0x8c13('0x39')](_0x14d250[_0x8c13('0x37')],{'$or':_[_0x8c13('0x3a')](_0x50d29c,function(_0x927c9e){if(_0x927c9e['type']!==_0x8c13('0x3b')){var _0xd428fa={};_0xd428fa[_0x927c9e[_0x8c13('0x2b')]]={'$like':'%'+_0x541d21['query'][_0x8c13('0x38')]+'%'};return _0xd428fa;}})});}_0x14d250=_['merge']({},_0x14d250,_0x541d21[_0x8c13('0x3c')]);var _0x3fd993={'where':_0x14d250[_0x8c13('0x37')]};return db[_0x8c13('0x29')][_0x8c13('0x1f')](_0x3fd993)[_0x8c13('0x22')](function(_0x447599){_0x1c9507[_0x8c13('0x1f')]=_0x447599;if(_0x541d21[_0x8c13('0x2d')][_0x8c13('0x3d')]){_0x14d250[_0x8c13('0x3e')]=[{'all':!![]}];}return db[_0x8c13('0x29')][_0x8c13('0x3f')](_0x14d250);})[_0x8c13('0x22')](function(_0x4ca4f0){_0x1c9507[_0x8c13('0x40')]=_0x4ca4f0;return _0x1c9507;})[_0x8c13('0x22')](respondWithFilteredResult(_0x4b0c7e,_0x14d250))[_0x8c13('0x41')](handleError(_0x4b0c7e,null));};exports[_0x8c13('0x42')]=function(_0x2526bc,_0x39040f){var _0x3cf2fb={'raw':!![],'where':{'id':_0x2526bc[_0x8c13('0x43')]['id']}},_0x337018={};_0x337018[_0x8c13('0x30')]=_[_0x8c13('0x2c')](db[_0x8c13('0x29')][_0x8c13('0x2a')]);_0x337018['query']=_[_0x8c13('0x2c')](_0x2526bc[_0x8c13('0x2d')]);_0x337018['filters']=_['intersection'](_0x337018[_0x8c13('0x30')],_0x337018[_0x8c13('0x2d')]);_0x3cf2fb['attributes']=_[_0x8c13('0x2f')](_0x337018['model'],qs[_0x8c13('0x31')](_0x2526bc[_0x8c13('0x2d')][_0x8c13('0x31')]));_0x3cf2fb[_0x8c13('0x32')]=_0x3cf2fb[_0x8c13('0x32')][_0x8c13('0x33')]?_0x3cf2fb['attributes']:_0x337018[_0x8c13('0x30')];if(_0x2526bc['query']['includeAll']){_0x3cf2fb[_0x8c13('0x3e')]=[{'all':!![]}];}_0x3cf2fb=_['merge']({},_0x3cf2fb,_0x2526bc[_0x8c13('0x3c')]);return db[_0x8c13('0x29')][_0x8c13('0x44')](_0x3cf2fb)[_0x8c13('0x22')](handleEntityNotFound(_0x39040f,null))[_0x8c13('0x22')](respondWithResult(_0x39040f,null))[_0x8c13('0x41')](handleError(_0x39040f,null));};exports[_0x8c13('0x45')]=function(_0x569ad6,_0x5cddd6){return db[_0x8c13('0x29')][_0x8c13('0x45')](_0x569ad6[_0x8c13('0x46')],{})[_0x8c13('0x22')](respondWithResult(_0x5cddd6,0xc9))[_0x8c13('0x41')](handleError(_0x5cddd6,null));};exports[_0x8c13('0x47')]=function(_0x1994c4,_0x486ff8){if(_0x1994c4[_0x8c13('0x46')]['id']){delete _0x1994c4[_0x8c13('0x46')]['id'];}return db[_0x8c13('0x29')][_0x8c13('0x44')]({'where':{'id':_0x1994c4['params']['id']}})[_0x8c13('0x22')](handleEntityNotFound(_0x486ff8,null))['then'](saveUpdates(_0x1994c4['body'],null))[_0x8c13('0x22')](respondWithResult(_0x486ff8,null))['catch'](handleError(_0x486ff8,null));};exports[_0x8c13('0x48')]=function(_0x58ab72,_0x4b8375,_0x41afe5){var _0x1bf793=require(_0x8c13('0x49'));var _0x25983e=![];var _0x5e2e56={};if(_0x58ab72[_0x8c13('0x2d')]['type']&&_0x58ab72[_0x8c13('0x2d')][_0x8c13('0x4a')]==='uniqueid'){_0x5e2e56[_0x8c13('0x4b')]=_0x58ab72[_0x8c13('0x43')]['id'];}else{_0x5e2e56['id']=_0x58ab72['params']['id'];}return db[_0x8c13('0x29')]['find']({'where':_0x5e2e56,'attributes':['id',_0x8c13('0x4c'),_0x8c13('0x4d')],'raw':!![]})['then'](handleEntityNotFound(_0x4b8375,null))['then'](function(_0x393c72){if(_0x393c72){var _0x948ee4=_0x393c72['savePath'];var _0x5b80a9=util[_0x8c13('0x4e')]('%s.cypher',_0x948ee4);if(fs[_0x8c13('0x4f')](_0x5b80a9)){_0x25983e=!![];return _0x1bf793['decryptFile'](_0x5b80a9,_0x948ee4,config[_0x8c13('0x50')][_0x8c13('0x51')])['then'](function(){return _0x393c72;});}return _0x393c72;}})[_0x8c13('0x22')](function(_0x49243a){if(_0x49243a){var _0x25dbb6=_0x49243a[_0x8c13('0x4c')];if(!fs[_0x8c13('0x4f')](_0x25dbb6)){throw new db[(_0x8c13('0x52'))][(_0x8c13('0x53'))](_0x8c13('0x54'));}if(_0x49243a[_0x8c13('0x4d')]){return _0x4b8375[_0x8c13('0x48')](_0x25dbb6,_0x49243a[_0x8c13('0x4d')]+path['extname'](_0x25dbb6),function(){if(_0x25983e){fs['unlink'](_0x25dbb6);}});}else{return _0x4b8375[_0x8c13('0x48')](_0x25dbb6,function(_0x1cc456){if(_0x25983e){fs[_0x8c13('0x55')](_0x25dbb6);}});}}})[_0x8c13('0x41')](function(_0x4572c5){if(_0x4572c5[_0x8c13('0x56')]==='SquareRecording\x20not\x20found'){_0x4b8375[_0x8c13('0x1a')](0x194)[_0x8c13('0x27')](_0x8c13('0x57'));}else{return handleError(_0x4b8375,null);}});};exports[_0x8c13('0x23')]=function(_0x4c9982,_0x408935){return db['SquareRecording'][_0x8c13('0x44')]({'where':{'id':_0x4c9982[_0x8c13('0x43')]['id']}})[_0x8c13('0x22')](function(_0x561aa0){if(_[_0x8c13('0x58')](_0x561aa0)){throw new ReferenceError('Entity\x20not\x20found');}return _0x561aa0;})[_0x8c13('0x22')](function(_0x1c88fc){var _0x238f56=_0x1c88fc[_0x8c13('0x4c')];logger[_0x8c13('0x59')](_0x8c13('0x5a'),_0x238f56);if(!_[_0x8c13('0x58')](_0x1c88fc[_0x8c13('0x4c')])&&fs[_0x8c13('0x4f')](_0x238f56)){logger[_0x8c13('0x59')](_0x8c13('0x5b')+_0x238f56+_0x8c13('0x5c'));fs[_0x8c13('0x5d')](_0x238f56);}_0x238f56=_0x238f56+_0x8c13('0x5e');if(!_[_0x8c13('0x58')](_0x1c88fc[_0x8c13('0x4c')])&&fs[_0x8c13('0x4f')](_0x238f56)){logger[_0x8c13('0x59')](_0x8c13('0x5b')+_0x238f56+_0x8c13('0x5c'));fs[_0x8c13('0x5d')](_0x238f56);}return _0x1c88fc;})[_0x8c13('0x22')](function(_0x5f2059){if(!_0x5f2059)throw new InternalError();return _0x5f2059[_0x8c13('0x23')]();})[_0x8c13('0x22')](function(){_0x408935['status'](0xcc)[_0x8c13('0x1b')]();})[_0x8c13('0x41')](handleError(_0x408935,null));}; \ No newline at end of file +var _0xe290=['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','limit','count','set','Content-Range','apply','reject','destroy','then','sendStatus','error','stack','name','SquareRecording','rawAttributes','fieldName','map','query','keys','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filters','filter','merge','type','includeAll','include','findAll','rows','catch','show','params','intersection','options','find','create','body','update','download','../../components/encryptor','uniqueid','savePath','%s.cypher','existsSync','decryptFile','secrets','filename','extname','unlink','message','SquareRecording\x20not\x20found','send','Not\x20found','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','eml-format','rimraf','zip-dir','moment','bluebird','mustache','path','ejs','fs-extra','squel'];(function(_0x1672f5,_0x2b5931){var _0x45866d=function(_0x26f1fd){while(--_0x26f1fd){_0x1672f5['push'](_0x1672f5['shift']());}};_0x45866d(++_0x2b5931);}(_0xe290,0x1c7));var _0x0e29=function(_0x31f5b0,_0x3ceb60){_0x31f5b0=_0x31f5b0-0x0;var _0x25dfd3=_0xe290[_0x31f5b0];return _0x25dfd3;};'use strict';var emlformat=require(_0x0e29('0x0'));var rimraf=require(_0x0e29('0x1'));var zipdir=require(_0x0e29('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0e29('0x3'));var BPromise=require(_0x0e29('0x4'));var Mustache=require(_0x0e29('0x5'));var util=require('util');var path=require(_0x0e29('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0e29('0x7'));var fs=require('fs');var fs_extra=require(_0x0e29('0x8'));var _=require('lodash');var squel=require(_0x0e29('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x0e29('0xa'));var querystring=require(_0x0e29('0xb'));var Papa=require(_0x0e29('0xc'));var Redis=require(_0x0e29('0xd'));var authService=require(_0x0e29('0xe'));var qs=require(_0x0e29('0xf'));var as=require(_0x0e29('0x10'));var hardwareService=require(_0x0e29('0x11'));var logger=require(_0x0e29('0x12'))(_0x0e29('0x13'));var utils=require(_0x0e29('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x0e29('0x15'))['db'];function respondWithStatusCode(_0x267d79,_0x25df9d){_0x25df9d=_0x25df9d||0xcc;return function(_0x4870cd){if(_0x4870cd){return _0x267d79['sendStatus'](_0x25df9d);}return _0x267d79[_0x0e29('0x16')](_0x25df9d)[_0x0e29('0x17')]();};}function respondWithResult(_0x1ad23c,_0x540af){_0x540af=_0x540af||0xc8;return function(_0x5c181b){if(_0x5c181b){return _0x1ad23c[_0x0e29('0x16')](_0x540af)[_0x0e29('0x18')](_0x5c181b);}};}function respondWithFilteredResult(_0x647a25,_0x3f2104){return function(_0x57e45c){if(_0x57e45c){var _0xfda196=typeof _0x3f2104[_0x0e29('0x19')]===_0x0e29('0x1a')&&typeof _0x3f2104[_0x0e29('0x1b')]==='undefined';var _0x3c2063=_0x57e45c[_0x0e29('0x1c')];var _0x17917a=_0xfda196?0x0:_0x3f2104[_0x0e29('0x19')];var _0x1630bb=_0xfda196?_0x57e45c[_0x0e29('0x1c')]:_0x3f2104['offset']+_0x3f2104['limit'];var _0x27965e;if(_0x1630bb>=_0x3c2063){_0x1630bb=_0x3c2063;_0x27965e=0xc8;}else{_0x27965e=0xce;}_0x647a25['status'](_0x27965e);return _0x647a25[_0x0e29('0x1d')](_0x0e29('0x1e'),_0x17917a+'-'+_0x1630bb+'/'+_0x3c2063)[_0x0e29('0x18')](_0x57e45c);}return null;};}function patchUpdates(_0x4e8c82){return function(_0x587a94){try{jsonpatch[_0x0e29('0x1f')](_0x587a94,_0x4e8c82,!![]);}catch(_0x1c1345){return BPromise[_0x0e29('0x20')](_0x1c1345);}return _0x587a94['save']();};}function saveUpdates(_0x255a16,_0x2b53b6){return function(_0xe1e9d4){if(_0xe1e9d4){return _0xe1e9d4['update'](_0x255a16)['then'](function(_0x3e24c5){return _0x3e24c5;});}return null;};}function removeEntity(_0x2fe4b7,_0xbe09ec){return function(_0x4c4262){if(_0x4c4262){return _0x4c4262[_0x0e29('0x21')]()[_0x0e29('0x22')](function(){_0x2fe4b7[_0x0e29('0x16')](0xcc)[_0x0e29('0x17')]();});}};}function handleEntityNotFound(_0x4fec34,_0x16d386){return function(_0x1a62a2){if(!_0x1a62a2){_0x4fec34[_0x0e29('0x23')](0x194);}return _0x1a62a2;};}function handleError(_0x4873d8,_0x4935ce){_0x4935ce=_0x4935ce||0x1f4;return function(_0x5bffc5){logger[_0x0e29('0x24')](_0x5bffc5[_0x0e29('0x25')]);if(_0x5bffc5[_0x0e29('0x26')]){delete _0x5bffc5['name'];}_0x4873d8[_0x0e29('0x16')](_0x4935ce)['send'](_0x5bffc5);};}exports['index']=function(_0xddd91a,_0x24ec3c){var _0x36b55b={},_0x55b7e2={},_0x3f0e4f={'count':0x0,'rows':[]};var _0x2d080b=_['map'](db[_0x0e29('0x27')][_0x0e29('0x28')],function(_0x152983){return{'name':_0x152983[_0x0e29('0x29')],'type':_0x152983['type']['key']};});_0x55b7e2['model']=_[_0x0e29('0x2a')](_0x2d080b,_0x0e29('0x26'));_0x55b7e2[_0x0e29('0x2b')]=_[_0x0e29('0x2c')](_0xddd91a[_0x0e29('0x2b')]);_0x55b7e2['filters']=_['intersection'](_0x55b7e2[_0x0e29('0x2d')],_0x55b7e2[_0x0e29('0x2b')]);_0x36b55b[_0x0e29('0x2e')]=_['intersection'](_0x55b7e2['model'],qs[_0x0e29('0x2f')](_0xddd91a[_0x0e29('0x2b')][_0x0e29('0x2f')]));_0x36b55b[_0x0e29('0x2e')]=_0x36b55b[_0x0e29('0x2e')][_0x0e29('0x30')]?_0x36b55b[_0x0e29('0x2e')]:_0x55b7e2['model'];if(!_0xddd91a[_0x0e29('0x2b')][_0x0e29('0x31')](_0x0e29('0x32'))){_0x36b55b['limit']=qs['limit'](_0xddd91a[_0x0e29('0x2b')]['limit']);_0x36b55b[_0x0e29('0x19')]=qs[_0x0e29('0x19')](_0xddd91a[_0x0e29('0x2b')]['offset']);}_0x36b55b['order']=qs['sort'](_0xddd91a[_0x0e29('0x2b')][_0x0e29('0x33')]);_0x36b55b[_0x0e29('0x34')]=qs['filters'](_[_0x0e29('0x35')](_0xddd91a[_0x0e29('0x2b')],_0x55b7e2[_0x0e29('0x36')]),_0x2d080b);if(_0xddd91a[_0x0e29('0x2b')][_0x0e29('0x37')]){_0x36b55b[_0x0e29('0x34')]=_[_0x0e29('0x38')](_0x36b55b['where'],{'$or':_[_0x0e29('0x2a')](_0x2d080b,function(_0x1e0697){if(_0x1e0697[_0x0e29('0x39')]!=='VIRTUAL'){var _0x49b166={};_0x49b166[_0x1e0697[_0x0e29('0x26')]]={'$like':'%'+_0xddd91a['query']['filter']+'%'};return _0x49b166;}})});}_0x36b55b=_[_0x0e29('0x38')]({},_0x36b55b,_0xddd91a['options']);var _0x3fc1a8={'where':_0x36b55b['where']};return db[_0x0e29('0x27')][_0x0e29('0x1c')](_0x3fc1a8)[_0x0e29('0x22')](function(_0x579461){_0x3f0e4f[_0x0e29('0x1c')]=_0x579461;if(_0xddd91a[_0x0e29('0x2b')][_0x0e29('0x3a')]){_0x36b55b[_0x0e29('0x3b')]=[{'all':!![]}];}return db[_0x0e29('0x27')][_0x0e29('0x3c')](_0x36b55b);})[_0x0e29('0x22')](function(_0x486019){_0x3f0e4f[_0x0e29('0x3d')]=_0x486019;return _0x3f0e4f;})['then'](respondWithFilteredResult(_0x24ec3c,_0x36b55b))[_0x0e29('0x3e')](handleError(_0x24ec3c,null));};exports[_0x0e29('0x3f')]=function(_0x2151ea,_0x1340bb){var _0x2df560={'raw':!![],'where':{'id':_0x2151ea[_0x0e29('0x40')]['id']}},_0x54e52f={};_0x54e52f[_0x0e29('0x2d')]=_[_0x0e29('0x2c')](db[_0x0e29('0x27')][_0x0e29('0x28')]);_0x54e52f['query']=_[_0x0e29('0x2c')](_0x2151ea[_0x0e29('0x2b')]);_0x54e52f['filters']=_[_0x0e29('0x41')](_0x54e52f[_0x0e29('0x2d')],_0x54e52f[_0x0e29('0x2b')]);_0x2df560[_0x0e29('0x2e')]=_[_0x0e29('0x41')](_0x54e52f['model'],qs[_0x0e29('0x2f')](_0x2151ea[_0x0e29('0x2b')]['fields']));_0x2df560[_0x0e29('0x2e')]=_0x2df560[_0x0e29('0x2e')][_0x0e29('0x30')]?_0x2df560[_0x0e29('0x2e')]:_0x54e52f[_0x0e29('0x2d')];if(_0x2151ea[_0x0e29('0x2b')][_0x0e29('0x3a')]){_0x2df560[_0x0e29('0x3b')]=[{'all':!![]}];}_0x2df560=_['merge']({},_0x2df560,_0x2151ea[_0x0e29('0x42')]);return db[_0x0e29('0x27')][_0x0e29('0x43')](_0x2df560)[_0x0e29('0x22')](handleEntityNotFound(_0x1340bb,null))[_0x0e29('0x22')](respondWithResult(_0x1340bb,null))['catch'](handleError(_0x1340bb,null));};exports[_0x0e29('0x44')]=function(_0x11c4c7,_0x16efc3){return db[_0x0e29('0x27')]['create'](_0x11c4c7[_0x0e29('0x45')],{})['then'](respondWithResult(_0x16efc3,0xc9))[_0x0e29('0x3e')](handleError(_0x16efc3,null));};exports[_0x0e29('0x46')]=function(_0x5fe349,_0x5b798e){if(_0x5fe349['body']['id']){delete _0x5fe349['body']['id'];}return db['SquareRecording'][_0x0e29('0x43')]({'where':{'id':_0x5fe349[_0x0e29('0x40')]['id']}})['then'](handleEntityNotFound(_0x5b798e,null))[_0x0e29('0x22')](saveUpdates(_0x5fe349['body'],null))['then'](respondWithResult(_0x5b798e,null))[_0x0e29('0x3e')](handleError(_0x5b798e,null));};exports[_0x0e29('0x47')]=function(_0x20d5ca,_0x114faa,_0x5eba04){var _0x5cb638=require(_0x0e29('0x48'));var _0x1c7ff5=![];var _0x55a588={};if(_0x20d5ca[_0x0e29('0x2b')]['type']&&_0x20d5ca[_0x0e29('0x2b')][_0x0e29('0x39')]==='uniqueid'){_0x55a588[_0x0e29('0x49')]=_0x20d5ca['params']['id'];}else{_0x55a588['id']=_0x20d5ca[_0x0e29('0x40')]['id'];}return db[_0x0e29('0x27')][_0x0e29('0x43')]({'where':_0x55a588,'attributes':['id','savePath','filename'],'raw':!![]})[_0x0e29('0x22')](handleEntityNotFound(_0x114faa,null))[_0x0e29('0x22')](function(_0x510c8c){if(_0x510c8c){var _0x25988e=_0x510c8c[_0x0e29('0x4a')];var _0x3da3cb=util['format'](_0x0e29('0x4b'),_0x25988e);if(fs[_0x0e29('0x4c')](_0x3da3cb)){_0x1c7ff5=!![];return _0x5cb638[_0x0e29('0x4d')](_0x3da3cb,_0x25988e,config[_0x0e29('0x4e')]['recording'])[_0x0e29('0x22')](function(){return _0x510c8c;});}return _0x510c8c;}})[_0x0e29('0x22')](function(_0x422062){if(_0x422062){var _0x19933d=_0x422062[_0x0e29('0x4a')];if(!fs[_0x0e29('0x4c')](_0x19933d)){throw new db['Sequelize']['ValidationError']('SquareRecording\x20not\x20found');}if(_0x422062[_0x0e29('0x4f')]){return _0x114faa[_0x0e29('0x47')](_0x19933d,_0x422062[_0x0e29('0x4f')]+path[_0x0e29('0x50')](_0x19933d),function(){if(_0x1c7ff5){fs[_0x0e29('0x51')](_0x19933d);}});}else{return _0x114faa['download'](_0x19933d,function(_0x46bf13){if(_0x1c7ff5){fs[_0x0e29('0x51')](_0x19933d);}});}}})[_0x0e29('0x3e')](function(_0x4ff417){if(_0x4ff417[_0x0e29('0x52')]===_0x0e29('0x53')){_0x114faa[_0x0e29('0x16')](0x194)[_0x0e29('0x54')](_0x0e29('0x55'));}else{return handleError(_0x114faa,null);}});};exports['destroy']=function(_0x274a81,_0x3808ad){return db[_0x0e29('0x27')][_0x0e29('0x43')]({'where':{'id':_0x274a81[_0x0e29('0x40')]['id']}})[_0x0e29('0x22')](function(_0x753008){if(_[_0x0e29('0x56')](_0x753008)){throw new ReferenceError(_0x0e29('0x57'));}return _0x753008;})[_0x0e29('0x22')](function(_0x5af6f5){var _0x32d0cb=_0x5af6f5[_0x0e29('0x4a')];logger[_0x0e29('0x58')](_0x0e29('0x59'),_0x32d0cb);if(!_[_0x0e29('0x56')](_0x5af6f5[_0x0e29('0x4a')])&&fs[_0x0e29('0x4c')](_0x32d0cb)){logger[_0x0e29('0x58')](_0x0e29('0x5a')+_0x32d0cb+_0x0e29('0x5b'));fs['unlinkSync'](_0x32d0cb);}_0x32d0cb=_0x32d0cb+_0x0e29('0x5c');if(!_[_0x0e29('0x56')](_0x5af6f5['savePath'])&&fs['existsSync'](_0x32d0cb)){logger[_0x0e29('0x58')](_0x0e29('0x5a')+_0x32d0cb+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x32d0cb);}return _0x5af6f5;})[_0x0e29('0x22')](function(_0x5bd6b9){if(!_0x5bd6b9)throw new InternalError();return _0x5bd6b9[_0x0e29('0x21')]();})['then'](function(){_0x3808ad['status'](0xcc)['end']();})['catch'](handleError(_0x3808ad,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 1b555e8..1d956cc 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 _0x958a=['bluebird','request-promise','path','../../config/environment','exports','define','SquareRecording','square_recordings','lodash','util','api','moment'];(function(_0x5c2e3e,_0x26ecd3){var _0x53f64a=function(_0x2b5df8){while(--_0x2b5df8){_0x5c2e3e['push'](_0x5c2e3e['shift']());}};_0x53f64a(++_0x26ecd3);}(_0x958a,0x128));var _0xa958=function(_0xf70548,_0x5bb4d0){_0xf70548=_0xf70548-0x0;var _0x44b74e=_0x958a[_0xf70548];return _0x44b74e;};'use strict';var _=require(_0xa958('0x0'));var util=require(_0xa958('0x1'));var logger=require('../../config/logger')(_0xa958('0x2'));var moment=require(_0xa958('0x3'));var BPromise=require(_0xa958('0x4'));var rp=require(_0xa958('0x5'));var fs=require('fs');var path=require(_0xa958('0x6'));var rimraf=require('rimraf');var config=require(_0xa958('0x7'));var attributes=require('./squareRecording.attributes');module[_0xa958('0x8')]=function(_0x9b7d9e,_0x2692d6){return _0x9b7d9e[_0xa958('0x9')](_0xa958('0xa'),attributes,{'tableName':_0xa958('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6c99=['SquareRecording','square_recordings','lodash','../../config/logger','rimraf','../../config/environment','./squareRecording.attributes','exports','define'];(function(_0x7f8b61,_0x4fa837){var _0x16e761=function(_0x1872ee){while(--_0x1872ee){_0x7f8b61['push'](_0x7f8b61['shift']());}};_0x16e761(++_0x4fa837);}(_0x6c99,0x9b));var _0x96c9=function(_0x1098db,_0x39ba6b){_0x1098db=_0x1098db-0x0;var _0x14f090=_0x6c99[_0x1098db];return _0x14f090;};'use strict';var _=require(_0x96c9('0x0'));var util=require('util');var logger=require(_0x96c9('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x96c9('0x2'));var config=require(_0x96c9('0x3'));var attributes=require(_0x96c9('0x4'));module[_0x96c9('0x5')]=function(_0x4c175f,_0x3bb16a){return _0x4c175f[_0x96c9('0x6')](_0x96c9('0x7'),attributes,{'tableName':_0x96c9('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 273fdc3..a82220f 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 _0x69c6=['client','http','then','SquareRecording,\x20%s,\x20%s','request\x20sent','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateSquareRecording','create','body','options','info','debug','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x95411e,_0x38b4c3){var _0x2c8718=function(_0x35c672){while(--_0x35c672){_0x95411e['push'](_0x95411e['shift']());}};_0x2c8718(++_0x38b4c3);}(_0x69c6,0xe2));var _0x669c=function(_0x1687b4,_0x2661ab){_0x1687b4=_0x1687b4-0x0;var _0x45d6b0=_0x69c6[_0x1687b4];return _0x45d6b0;};'use strict';var _=require(_0x669c('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x669c('0x1'));var rs=require(_0x669c('0x2'));var fs=require('fs');var Redis=require(_0x669c('0x3'));var db=require(_0x669c('0x4'))['db'];var utils=require(_0x669c('0x5'));var logger=require('../../config/logger')(_0x669c('0x6'));var config=require(_0x669c('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x669c('0x8')][_0x669c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x58bae3,_0x169e58,_0x2d9116){return new BPromise(function(_0x737daa,_0x523b98){return client['request'](_0x58bae3,_0x2d9116)[_0x669c('0xa')](function(_0x45f431){logger['info'](_0x669c('0xb'),_0x169e58,_0x669c('0xc'));logger['debug'](_0x669c('0xd'),_0x169e58,_0x669c('0xc'),JSON[_0x669c('0xe')](_0x45f431));if(_0x45f431[_0x669c('0xf')]){if(_0x45f431[_0x669c('0xf')][_0x669c('0x10')]===0x1f4){logger[_0x669c('0xf')](_0x669c('0xb'),_0x169e58,_0x45f431[_0x669c('0xf')][_0x669c('0x11')]);return _0x523b98(_0x45f431[_0x669c('0xf')][_0x669c('0x11')]);}logger[_0x669c('0xf')](_0x669c('0xb'),_0x169e58,_0x45f431[_0x669c('0xf')][_0x669c('0x11')]);return _0x737daa(_0x45f431[_0x669c('0xf')]['message']);}else{logger['info'](_0x669c('0xb'),_0x169e58,_0x669c('0xc'));_0x737daa(_0x45f431[_0x669c('0x12')]['message']);}})['catch'](function(_0x1e41ab){logger[_0x669c('0xf')](_0x669c('0xb'),_0x169e58,_0x1e41ab);_0x523b98(_0x1e41ab);});});}exports[_0x669c('0x13')]=function(_0x1d6a3e){var _0x4cbde3=this;return new Promise(function(_0x713237,_0x498923){return db['SquareRecording'][_0x669c('0x14')](_0x1d6a3e[_0x669c('0x15')],{'raw':_0x1d6a3e[_0x669c('0x16')]?_0x1d6a3e[_0x669c('0x16')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x400f40){logger[_0x669c('0x17')](_0x669c('0x13'),_0x1d6a3e);logger[_0x669c('0x18')]('CreateSquareRecording',_0x1d6a3e,JSON[_0x669c('0xe')](_0x400f40));_0x713237(_0x400f40);})[_0x669c('0x19')](function(_0x51ba2f){logger[_0x669c('0xf')]('CreateSquareRecording',_0x51ba2f[_0x669c('0x11')],_0x1d6a3e);_0x498923(_0x4cbde3[_0x669c('0xf')](0x1f4,_0x51ba2f[_0x669c('0x11')]));});});}; \ No newline at end of file +var _0xf01d=['rpc','../../config/environment','client','http','request','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateSquareRecording','create','body','options','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0xf01d,0x1c8));var _0xdf01=function(_0x5baad3,_0x1aaa3f){_0x5baad3=_0x5baad3-0x0;var _0x12b860=_0xf01d[_0x5baad3];return _0x12b860;};'use strict';var _=require(_0xdf01('0x0'));var util=require(_0xdf01('0x1'));var moment=require(_0xdf01('0x2'));var BPromise=require(_0xdf01('0x3'));var rs=require(_0xdf01('0x4'));var fs=require('fs');var Redis=require(_0xdf01('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xdf01('0x6'));var logger=require(_0xdf01('0x7'))(_0xdf01('0x8'));var config=require(_0xdf01('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xdf01('0xa')][_0xdf01('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x48333d,_0x5867d6,_0x57fe52){return new BPromise(function(_0x4395e4,_0x314238){return client[_0xdf01('0xc')](_0x48333d,_0x57fe52)[_0xdf01('0xd')](function(_0x1ef70d){logger[_0xdf01('0xe')](_0xdf01('0xf'),_0x5867d6,_0xdf01('0x10'));logger[_0xdf01('0x11')](_0xdf01('0x12'),_0x5867d6,_0xdf01('0x10'),JSON['stringify'](_0x1ef70d));if(_0x1ef70d[_0xdf01('0x13')]){if(_0x1ef70d[_0xdf01('0x13')][_0xdf01('0x14')]===0x1f4){logger[_0xdf01('0x13')](_0xdf01('0xf'),_0x5867d6,_0x1ef70d[_0xdf01('0x13')][_0xdf01('0x15')]);return _0x314238(_0x1ef70d[_0xdf01('0x13')][_0xdf01('0x15')]);}logger['error']('SquareRecording,\x20%s,\x20%s',_0x5867d6,_0x1ef70d[_0xdf01('0x13')][_0xdf01('0x15')]);return _0x4395e4(_0x1ef70d[_0xdf01('0x13')]['message']);}else{logger[_0xdf01('0xe')](_0xdf01('0xf'),_0x5867d6,_0xdf01('0x10'));_0x4395e4(_0x1ef70d[_0xdf01('0x16')][_0xdf01('0x15')]);}})[_0xdf01('0x17')](function(_0x584c0a){logger[_0xdf01('0x13')](_0xdf01('0xf'),_0x5867d6,_0x584c0a);_0x314238(_0x584c0a);});});}exports[_0xdf01('0x18')]=function(_0x1f028f){var _0x5aa98b=this;return new Promise(function(_0x3b2594,_0x8c5c68){return db['SquareRecording'][_0xdf01('0x19')](_0x1f028f[_0xdf01('0x1a')],{'raw':_0x1f028f[_0xdf01('0x1b')]?_0x1f028f[_0xdf01('0x1b')][_0xdf01('0x1c')]===undefined?!![]:![]:!![]})[_0xdf01('0xd')](function(_0x2191a5){logger['info']('CreateSquareRecording',_0x1f028f);logger[_0xdf01('0x11')]('CreateSquareRecording',_0x1f028f,JSON['stringify'](_0x2191a5));_0x3b2594(_0x2191a5);})[_0xdf01('0x17')](function(_0xf191e6){logger[_0xdf01('0x13')](_0xdf01('0x18'),_0xf191e6['message'],_0x1f028f);_0x8c5c68(_0x5aa98b['error'](0x1f4,_0xf191e6['message']));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 11d1734..7a77de8 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 _0xa9e0=['isAuthenticated','create','put','/:id','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReport.controller','get','index','/describe','show','post'];(function(_0x2718c7,_0x5a1636){var _0x59d89c=function(_0x4d4f49){while(--_0x4d4f49){_0x2718c7['push'](_0x2718c7['shift']());}};_0x59d89c(++_0x5a1636);}(_0xa9e0,0x123));var _0x0a9e=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0xa9e0[_0x8de54f];return _0x14cba4;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0xc')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')](_0x0a9e('0x10'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);module[_0x0a9e('0x12')]=router; \ No newline at end of file +var _0xd8b0=['destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update'];(function(_0x158f5a,_0xaacc25){var _0xb3722e=function(_0x1659bd){while(--_0x1659bd){_0x158f5a['push'](_0x158f5a['shift']());}};_0xb3722e(++_0xaacc25);}(_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('./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 diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index 5fed21a..db59701 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 _0xaa56=['DATE','BOOLEAN','exports','STRING'];(function(_0x4d1083,_0x186e4c){var _0x444e4c=function(_0x5ee74d){while(--_0x5ee74d){_0x4d1083['push'](_0x4d1083['shift']());}};_0x444e4c(++_0x186e4c);}(_0xaa56,0xc6));var _0x6aa5=function(_0x31929e,_0x5121dd){_0x31929e=_0x31929e-0x0;var _0x5c3ec5=_0xaa56[_0x31929e];return _0x5c3ec5;};'use strict';var Sequelize=require('sequelize');module[_0x6aa5('0x0')]={'network':{'type':Sequelize[_0x6aa5('0x1')]},'network_script':{'type':Sequelize[_0x6aa5('0x1')]},'request':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x6aa5('0x1')]},'language':{'type':Sequelize[_0x6aa5('0x1')]},'type':{'type':Sequelize[_0x6aa5('0x1')]},'uniqueid':{'type':Sequelize[_0x6aa5('0x1')]},'version':{'type':Sequelize[_0x6aa5('0x1')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x6aa5('0x1')]},'callingpres':{'type':Sequelize['STRING']},'callingani2':{'type':Sequelize[_0x6aa5('0x1')]},'callington':{'type':Sequelize[_0x6aa5('0x1')]},'callingtns':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize[_0x6aa5('0x1')]},'rdnis':{'type':Sequelize[_0x6aa5('0x1')]},'context':{'type':Sequelize[_0x6aa5('0x1')]},'extension':{'type':Sequelize[_0x6aa5('0x1')]},'priority':{'type':Sequelize[_0x6aa5('0x1')]},'enhanced':{'type':Sequelize[_0x6aa5('0x1')]},'accountcode':{'type':Sequelize[_0x6aa5('0x1')]},'threadid':{'type':Sequelize[_0x6aa5('0x1')]},'project_name':{'type':Sequelize[_0x6aa5('0x1')]},'joinAt':{'type':Sequelize[_0x6aa5('0x2')]},'leaveAt':{'type':Sequelize[_0x6aa5('0x2')]},'bot':{'type':Sequelize[_0x6aa5('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x9d16=['exports','STRING','DATE','BOOLEAN'];(function(_0x49a94e,_0x61146e){var _0x3ef05b=function(_0x4fdd7b){while(--_0x4fdd7b){_0x49a94e['push'](_0x49a94e['shift']());}};_0x3ef05b(++_0x61146e);}(_0x9d16,0x1dc));var _0x69d1=function(_0x4bacb6,_0x2b299d){_0x4bacb6=_0x4bacb6-0x0;var _0x58c029=_0x9d16[_0x4bacb6];return _0x58c029;};'use strict';var Sequelize=require('sequelize');module[_0x69d1('0x0')]={'network':{'type':Sequelize[_0x69d1('0x1')]},'network_script':{'type':Sequelize[_0x69d1('0x1')]},'request':{'type':Sequelize[_0x69d1('0x1')]},'channel':{'type':Sequelize[_0x69d1('0x1')]},'language':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x69d1('0x1')]},'uniqueid':{'type':Sequelize[_0x69d1('0x1')]},'version':{'type':Sequelize[_0x69d1('0x1')]},'callerid':{'type':Sequelize[_0x69d1('0x1')]},'calleridname':{'type':Sequelize[_0x69d1('0x1')]},'callingpres':{'type':Sequelize[_0x69d1('0x1')]},'callingani2':{'type':Sequelize[_0x69d1('0x1')]},'callington':{'type':Sequelize[_0x69d1('0x1')]},'callingtns':{'type':Sequelize[_0x69d1('0x1')]},'dnid':{'type':Sequelize[_0x69d1('0x1')]},'rdnis':{'type':Sequelize[_0x69d1('0x1')]},'context':{'type':Sequelize[_0x69d1('0x1')]},'extension':{'type':Sequelize[_0x69d1('0x1')]},'priority':{'type':Sequelize[_0x69d1('0x1')]},'enhanced':{'type':Sequelize[_0x69d1('0x1')]},'accountcode':{'type':Sequelize[_0x69d1('0x1')]},'threadid':{'type':Sequelize[_0x69d1('0x1')]},'project_name':{'type':Sequelize[_0x69d1('0x1')]},'joinAt':{'type':Sequelize[_0x69d1('0x2')]},'leaveAt':{'type':Sequelize[_0x69d1('0x2')]},'bot':{'type':Sequelize[_0x69d1('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 7dafff2..8e435c0 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 _0x7ebe=['body','describe','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','save','destroy','then','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','SquareReport','findAll','rows','catch','show','params','find','create','update'];(function(_0x2eae90,_0x3b09f2){var _0x27fce6=function(_0x30c5c7){while(--_0x30c5c7){_0x2eae90['push'](_0x2eae90['shift']());}};_0x27fce6(++_0x3b09f2);}(_0x7ebe,0xf8));var _0xe7eb=function(_0x3e660e,_0x443de6){_0x3e660e=_0x3e660e-0x0;var _0x113b80=_0x7ebe[_0x3e660e];return _0x113b80;};'use strict';var emlformat=require(_0xe7eb('0x0'));var rimraf=require(_0xe7eb('0x1'));var zipdir=require(_0xe7eb('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe7eb('0x3'));var moment=require('moment');var BPromise=require(_0xe7eb('0x4'));var Mustache=require(_0xe7eb('0x5'));var util=require(_0xe7eb('0x6'));var path=require(_0xe7eb('0x7'));var sox=require(_0xe7eb('0x8'));var csv=require(_0xe7eb('0x9'));var ejs=require(_0xe7eb('0xa'));var fs=require('fs');var fs_extra=require(_0xe7eb('0xb'));var _=require(_0xe7eb('0xc'));var squel=require(_0xe7eb('0xd'));var crypto=require(_0xe7eb('0xe'));var jsforce=require(_0xe7eb('0xf'));var deskjs=require(_0xe7eb('0x10'));var toCsv=require('to-csv');var querystring=require(_0xe7eb('0x11'));var Papa=require(_0xe7eb('0x12'));var Redis=require(_0xe7eb('0x13'));var authService=require(_0xe7eb('0x14'));var qs=require(_0xe7eb('0x15'));var as=require(_0xe7eb('0x16'));var hardwareService=require(_0xe7eb('0x17'));var logger=require(_0xe7eb('0x18'))(_0xe7eb('0x19'));var utils=require(_0xe7eb('0x1a'));var config=require(_0xe7eb('0x1b'));var licenseUtil=require(_0xe7eb('0x1c'));var db=require(_0xe7eb('0x1d'))['db'];function respondWithStatusCode(_0x34c6d8,_0x226f73){_0x226f73=_0x226f73||0xcc;return function(_0x500e45){if(_0x500e45){return _0x34c6d8[_0xe7eb('0x1e')](_0x226f73);}return _0x34c6d8[_0xe7eb('0x1f')](_0x226f73)[_0xe7eb('0x20')]();};}function respondWithResult(_0x8b26c6,_0x36fa50){_0x36fa50=_0x36fa50||0xc8;return function(_0x20ce7b){if(_0x20ce7b){return _0x8b26c6[_0xe7eb('0x1f')](_0x36fa50)[_0xe7eb('0x21')](_0x20ce7b);}};}function respondWithFilteredResult(_0x1e0b69,_0x9d9670){return function(_0x3396ff){if(_0x3396ff){var _0x20bc30=typeof _0x9d9670[_0xe7eb('0x22')]===_0xe7eb('0x23')&&typeof _0x9d9670['limit']===_0xe7eb('0x23');var _0x4e90b5=_0x3396ff[_0xe7eb('0x24')];var _0x5f0c39=_0x20bc30?0x0:_0x9d9670['offset'];var _0x4e626c=_0x20bc30?_0x3396ff[_0xe7eb('0x24')]:_0x9d9670[_0xe7eb('0x22')]+_0x9d9670[_0xe7eb('0x25')];var _0x54f135;if(_0x4e626c>=_0x4e90b5){_0x4e626c=_0x4e90b5;_0x54f135=0xc8;}else{_0x54f135=0xce;}_0x1e0b69[_0xe7eb('0x1f')](_0x54f135);return _0x1e0b69['set'](_0xe7eb('0x26'),_0x5f0c39+'-'+_0x4e626c+'/'+_0x4e90b5)['json'](_0x3396ff);}return null;};}function patchUpdates(_0x18a540){return function(_0x37db86){try{jsonpatch[_0xe7eb('0x27')](_0x37db86,_0x18a540,!![]);}catch(_0x1f4b34){return BPromise[_0xe7eb('0x28')](_0x1f4b34);}return _0x37db86[_0xe7eb('0x29')]();};}function saveUpdates(_0xe27c3,_0x5efc8b){return function(_0xfd2357){if(_0xfd2357){return _0xfd2357['update'](_0xe27c3)['then'](function(_0xd4b6f9){return _0xd4b6f9;});}return null;};}function removeEntity(_0x1d7516,_0x40dc38){return function(_0x46f9cf){if(_0x46f9cf){return _0x46f9cf[_0xe7eb('0x2a')]()[_0xe7eb('0x2b')](function(){_0x1d7516[_0xe7eb('0x1f')](0xcc)[_0xe7eb('0x20')]();});}};}function handleEntityNotFound(_0x287f0e,_0x3a4a80){return function(_0x4dad21){if(!_0x4dad21){_0x287f0e[_0xe7eb('0x1e')](0x194);}return _0x4dad21;};}function handleError(_0x2d6545,_0x4c7922){_0x4c7922=_0x4c7922||0x1f4;return function(_0x4cbe85){logger[_0xe7eb('0x2c')](_0x4cbe85[_0xe7eb('0x2d')]);if(_0x4cbe85[_0xe7eb('0x2e')]){delete _0x4cbe85['name'];}_0x2d6545[_0xe7eb('0x1f')](_0x4c7922)[_0xe7eb('0x2f')](_0x4cbe85);};}exports['index']=function(_0x1bad98,_0x594e8b){var _0x3441bc={},_0x54e443={},_0x224d9e={'count':0x0,'rows':[]};var _0x285446=_[_0xe7eb('0x30')](db['SquareReport'][_0xe7eb('0x31')],function(_0x321dca){return{'name':_0x321dca[_0xe7eb('0x32')],'type':_0x321dca[_0xe7eb('0x33')][_0xe7eb('0x34')]};});_0x54e443[_0xe7eb('0x35')]=_[_0xe7eb('0x30')](_0x285446,_0xe7eb('0x2e'));_0x54e443[_0xe7eb('0x36')]=_['keys'](_0x1bad98[_0xe7eb('0x36')]);_0x54e443['filters']=_[_0xe7eb('0x37')](_0x54e443[_0xe7eb('0x35')],_0x54e443[_0xe7eb('0x36')]);_0x3441bc[_0xe7eb('0x38')]=_[_0xe7eb('0x37')](_0x54e443[_0xe7eb('0x35')],qs[_0xe7eb('0x39')](_0x1bad98['query']['fields']));_0x3441bc['attributes']=_0x3441bc[_0xe7eb('0x38')][_0xe7eb('0x3a')]?_0x3441bc[_0xe7eb('0x38')]:_0x54e443[_0xe7eb('0x35')];if(!_0x1bad98[_0xe7eb('0x36')]['hasOwnProperty'](_0xe7eb('0x3b'))){_0x3441bc[_0xe7eb('0x25')]=qs[_0xe7eb('0x25')](_0x1bad98['query'][_0xe7eb('0x25')]);_0x3441bc[_0xe7eb('0x22')]=qs[_0xe7eb('0x22')](_0x1bad98[_0xe7eb('0x36')][_0xe7eb('0x22')]);}_0x3441bc[_0xe7eb('0x3c')]=qs[_0xe7eb('0x3d')](_0x1bad98[_0xe7eb('0x36')][_0xe7eb('0x3d')]);_0x3441bc[_0xe7eb('0x3e')]=qs[_0xe7eb('0x3f')](_[_0xe7eb('0x40')](_0x1bad98[_0xe7eb('0x36')],_0x54e443[_0xe7eb('0x3f')]),_0x285446);if(_0x1bad98[_0xe7eb('0x36')][_0xe7eb('0x41')]){_0x3441bc['where']=_[_0xe7eb('0x42')](_0x3441bc[_0xe7eb('0x3e')],{'$or':_[_0xe7eb('0x30')](_0x285446,function(_0x47724c){if(_0x47724c[_0xe7eb('0x33')]!==_0xe7eb('0x43')){var _0x49f807={};_0x49f807[_0x47724c[_0xe7eb('0x2e')]]={'$like':'%'+_0x1bad98[_0xe7eb('0x36')][_0xe7eb('0x41')]+'%'};return _0x49f807;}})});}_0x3441bc=_[_0xe7eb('0x42')]({},_0x3441bc,_0x1bad98[_0xe7eb('0x44')]);var _0x4d9589={'where':_0x3441bc[_0xe7eb('0x3e')]};return db['SquareReport'][_0xe7eb('0x24')](_0x4d9589)[_0xe7eb('0x2b')](function(_0x71dd51){_0x224d9e[_0xe7eb('0x24')]=_0x71dd51;if(_0x1bad98[_0xe7eb('0x36')][_0xe7eb('0x45')]){_0x3441bc[_0xe7eb('0x46')]=[{'all':!![]}];}return db[_0xe7eb('0x47')][_0xe7eb('0x48')](_0x3441bc);})[_0xe7eb('0x2b')](function(_0x166cf2){_0x224d9e[_0xe7eb('0x49')]=_0x166cf2;return _0x224d9e;})[_0xe7eb('0x2b')](respondWithFilteredResult(_0x594e8b,_0x3441bc))[_0xe7eb('0x4a')](handleError(_0x594e8b,null));};exports[_0xe7eb('0x4b')]=function(_0xab3225,_0x2d6266){var _0x54cf11={'raw':!![],'where':{'id':_0xab3225[_0xe7eb('0x4c')]['id']}},_0x37de08={};_0x37de08[_0xe7eb('0x35')]=_['keys'](db[_0xe7eb('0x47')][_0xe7eb('0x31')]);_0x37de08[_0xe7eb('0x36')]=_['keys'](_0xab3225[_0xe7eb('0x36')]);_0x37de08['filters']=_[_0xe7eb('0x37')](_0x37de08['model'],_0x37de08[_0xe7eb('0x36')]);_0x54cf11[_0xe7eb('0x38')]=_[_0xe7eb('0x37')](_0x37de08[_0xe7eb('0x35')],qs['fields'](_0xab3225['query'][_0xe7eb('0x39')]));_0x54cf11[_0xe7eb('0x38')]=_0x54cf11[_0xe7eb('0x38')][_0xe7eb('0x3a')]?_0x54cf11[_0xe7eb('0x38')]:_0x37de08[_0xe7eb('0x35')];if(_0xab3225[_0xe7eb('0x36')][_0xe7eb('0x45')]){_0x54cf11[_0xe7eb('0x46')]=[{'all':!![]}];}_0x54cf11=_[_0xe7eb('0x42')]({},_0x54cf11,_0xab3225[_0xe7eb('0x44')]);return db[_0xe7eb('0x47')][_0xe7eb('0x4d')](_0x54cf11)[_0xe7eb('0x2b')](handleEntityNotFound(_0x2d6266,null))[_0xe7eb('0x2b')](respondWithResult(_0x2d6266,null))['catch'](handleError(_0x2d6266,null));};exports['create']=function(_0xd8f9a0,_0x1ae74e){return db[_0xe7eb('0x47')][_0xe7eb('0x4e')](_0xd8f9a0['body'],{})[_0xe7eb('0x2b')](respondWithResult(_0x1ae74e,0xc9))['catch'](handleError(_0x1ae74e,null));};exports[_0xe7eb('0x4f')]=function(_0x3105f2,_0xdf5a41){if(_0x3105f2[_0xe7eb('0x50')]['id']){delete _0x3105f2[_0xe7eb('0x50')]['id'];}return db[_0xe7eb('0x47')][_0xe7eb('0x4d')]({'where':{'id':_0x3105f2[_0xe7eb('0x4c')]['id']}})[_0xe7eb('0x2b')](handleEntityNotFound(_0xdf5a41,null))[_0xe7eb('0x2b')](saveUpdates(_0x3105f2[_0xe7eb('0x50')],null))[_0xe7eb('0x2b')](respondWithResult(_0xdf5a41,null))[_0xe7eb('0x4a')](handleError(_0xdf5a41,null));};exports['destroy']=function(_0x1e3af6,_0x5694ab){return db[_0xe7eb('0x47')]['find']({'where':{'id':_0x1e3af6['params']['id']}})['then'](handleEntityNotFound(_0x5694ab,null))[_0xe7eb('0x2b')](removeEntity(_0x5694ab,null))[_0xe7eb('0x4a')](handleError(_0x5694ab,null));};exports[_0xe7eb('0x51')]=function(_0x1db503,_0x3433a8){return db[_0xe7eb('0x47')]['describe']()['then'](respondWithResult(_0x3433a8,null))[_0xe7eb('0x4a')](handleError(_0x3433a8,null));}; \ No newline at end of file +var _0xf101=['attributes','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','keys','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','index','map','SquareReport','rawAttributes','fieldName','key','model','query','filters','intersection','fields'];(function(_0x740983,_0x314689){var _0x16bddc=function(_0x5d0aa3){while(--_0x5d0aa3){_0x740983['push'](_0x740983['shift']());}};_0x16bddc(++_0x314689);}(_0xf101,0x1e5));var _0x1f10=function(_0x2d36a6,_0x2f8cd0){_0x2d36a6=_0x2d36a6-0x0;var _0x59cec0=_0xf101[_0x2d36a6];return _0x59cec0;};'use strict';var emlformat=require(_0x1f10('0x0'));var rimraf=require(_0x1f10('0x1'));var zipdir=require(_0x1f10('0x2'));var jsonpatch=require(_0x1f10('0x3'));var rp=require(_0x1f10('0x4'));var moment=require(_0x1f10('0x5'));var BPromise=require(_0x1f10('0x6'));var Mustache=require(_0x1f10('0x7'));var util=require('util');var path=require(_0x1f10('0x8'));var sox=require(_0x1f10('0x9'));var csv=require(_0x1f10('0xa'));var ejs=require(_0x1f10('0xb'));var fs=require('fs');var fs_extra=require(_0x1f10('0xc'));var _=require(_0x1f10('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x1f10('0xe'));var deskjs=require(_0x1f10('0xf'));var toCsv=require(_0x1f10('0xa'));var querystring=require(_0x1f10('0x10'));var Papa=require(_0x1f10('0x11'));var Redis=require(_0x1f10('0x12'));var authService=require(_0x1f10('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x1f10('0x14'))('api');var utils=require(_0x1f10('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x1f10('0x16'));var db=require(_0x1f10('0x17'))['db'];function respondWithStatusCode(_0x3bfc30,_0x2a4bff){_0x2a4bff=_0x2a4bff||0xcc;return function(_0x5b0401){if(_0x5b0401){return _0x3bfc30[_0x1f10('0x18')](_0x2a4bff);}return _0x3bfc30[_0x1f10('0x19')](_0x2a4bff)['end']();};}function respondWithResult(_0x5153f7,_0x4db1f9){_0x4db1f9=_0x4db1f9||0xc8;return function(_0x4f4806){if(_0x4f4806){return _0x5153f7[_0x1f10('0x19')](_0x4db1f9)[_0x1f10('0x1a')](_0x4f4806);}};}function respondWithFilteredResult(_0x543aaa,_0x3c1591){return function(_0x30174a){if(_0x30174a){var _0x1a27c1=typeof _0x3c1591[_0x1f10('0x1b')]===_0x1f10('0x1c')&&typeof _0x3c1591[_0x1f10('0x1d')]===_0x1f10('0x1c');var _0x52d506=_0x30174a[_0x1f10('0x1e')];var _0x42132d=_0x1a27c1?0x0:_0x3c1591[_0x1f10('0x1b')];var _0x4b3019=_0x1a27c1?_0x30174a[_0x1f10('0x1e')]:_0x3c1591[_0x1f10('0x1b')]+_0x3c1591[_0x1f10('0x1d')];var _0x261d52;if(_0x4b3019>=_0x52d506){_0x4b3019=_0x52d506;_0x261d52=0xc8;}else{_0x261d52=0xce;}_0x543aaa[_0x1f10('0x19')](_0x261d52);return _0x543aaa[_0x1f10('0x1f')](_0x1f10('0x20'),_0x42132d+'-'+_0x4b3019+'/'+_0x52d506)[_0x1f10('0x1a')](_0x30174a);}return null;};}function patchUpdates(_0x21853c){return function(_0x13b54b){try{jsonpatch[_0x1f10('0x21')](_0x13b54b,_0x21853c,!![]);}catch(_0x2afe1f){return BPromise[_0x1f10('0x22')](_0x2afe1f);}return _0x13b54b[_0x1f10('0x23')]();};}function saveUpdates(_0xcfbbd8,_0x56a2c6){return function(_0x226a8e){if(_0x226a8e){return _0x226a8e[_0x1f10('0x24')](_0xcfbbd8)[_0x1f10('0x25')](function(_0x3d621a){return _0x3d621a;});}return null;};}function removeEntity(_0x4cde62,_0x104267){return function(_0xe2d1dd){if(_0xe2d1dd){return _0xe2d1dd[_0x1f10('0x26')]()['then'](function(){_0x4cde62[_0x1f10('0x19')](0xcc)[_0x1f10('0x27')]();});}};}function handleEntityNotFound(_0x4752e2,_0x5c52f6){return function(_0x2718c8){if(!_0x2718c8){_0x4752e2['sendStatus'](0x194);}return _0x2718c8;};}function handleError(_0x4a64e8,_0x825a2a){_0x825a2a=_0x825a2a||0x1f4;return function(_0x5447b3){logger[_0x1f10('0x28')](_0x5447b3[_0x1f10('0x29')]);if(_0x5447b3[_0x1f10('0x2a')]){delete _0x5447b3['name'];}_0x4a64e8['status'](_0x825a2a)['send'](_0x5447b3);};}exports[_0x1f10('0x2b')]=function(_0x15e4fb,_0x3e885c){var _0x2f93a8={},_0x3ff592={},_0x32dbec={'count':0x0,'rows':[]};var _0xbd8660=_[_0x1f10('0x2c')](db[_0x1f10('0x2d')][_0x1f10('0x2e')],function(_0x400cbd){return{'name':_0x400cbd[_0x1f10('0x2f')],'type':_0x400cbd['type'][_0x1f10('0x30')]};});_0x3ff592[_0x1f10('0x31')]=_['map'](_0xbd8660,_0x1f10('0x2a'));_0x3ff592[_0x1f10('0x32')]=_['keys'](_0x15e4fb['query']);_0x3ff592[_0x1f10('0x33')]=_[_0x1f10('0x34')](_0x3ff592['model'],_0x3ff592['query']);_0x2f93a8['attributes']=_['intersection'](_0x3ff592[_0x1f10('0x31')],qs['fields'](_0x15e4fb[_0x1f10('0x32')][_0x1f10('0x35')]));_0x2f93a8[_0x1f10('0x36')]=_0x2f93a8[_0x1f10('0x36')][_0x1f10('0x37')]?_0x2f93a8[_0x1f10('0x36')]:_0x3ff592[_0x1f10('0x31')];if(!_0x15e4fb[_0x1f10('0x32')][_0x1f10('0x38')](_0x1f10('0x39'))){_0x2f93a8[_0x1f10('0x1d')]=qs[_0x1f10('0x1d')](_0x15e4fb['query']['limit']);_0x2f93a8['offset']=qs[_0x1f10('0x1b')](_0x15e4fb['query'][_0x1f10('0x1b')]);}_0x2f93a8[_0x1f10('0x3a')]=qs[_0x1f10('0x3b')](_0x15e4fb[_0x1f10('0x32')][_0x1f10('0x3b')]);_0x2f93a8['where']=qs[_0x1f10('0x33')](_['pick'](_0x15e4fb[_0x1f10('0x32')],_0x3ff592[_0x1f10('0x33')]),_0xbd8660);if(_0x15e4fb[_0x1f10('0x32')][_0x1f10('0x3c')]){_0x2f93a8[_0x1f10('0x3d')]=_[_0x1f10('0x3e')](_0x2f93a8[_0x1f10('0x3d')],{'$or':_['map'](_0xbd8660,function(_0x40e455){if(_0x40e455[_0x1f10('0x3f')]!==_0x1f10('0x40')){var _0x27f029={};_0x27f029[_0x40e455['name']]={'$like':'%'+_0x15e4fb[_0x1f10('0x32')][_0x1f10('0x3c')]+'%'};return _0x27f029;}})});}_0x2f93a8=_[_0x1f10('0x3e')]({},_0x2f93a8,_0x15e4fb[_0x1f10('0x41')]);var _0x5f09fb={'where':_0x2f93a8[_0x1f10('0x3d')]};return db['SquareReport']['count'](_0x5f09fb)[_0x1f10('0x25')](function(_0x527820){_0x32dbec[_0x1f10('0x1e')]=_0x527820;if(_0x15e4fb['query'][_0x1f10('0x42')]){_0x2f93a8[_0x1f10('0x43')]=[{'all':!![]}];}return db[_0x1f10('0x2d')][_0x1f10('0x44')](_0x2f93a8);})[_0x1f10('0x25')](function(_0x44bfc3){_0x32dbec[_0x1f10('0x45')]=_0x44bfc3;return _0x32dbec;})['then'](respondWithFilteredResult(_0x3e885c,_0x2f93a8))[_0x1f10('0x46')](handleError(_0x3e885c,null));};exports['show']=function(_0x413d5f,_0xaefc1f){var _0x5bb414={'raw':!![],'where':{'id':_0x413d5f[_0x1f10('0x47')]['id']}},_0x32c253={};_0x32c253[_0x1f10('0x31')]=_[_0x1f10('0x48')](db[_0x1f10('0x2d')][_0x1f10('0x2e')]);_0x32c253['query']=_[_0x1f10('0x48')](_0x413d5f[_0x1f10('0x32')]);_0x32c253[_0x1f10('0x33')]=_[_0x1f10('0x34')](_0x32c253[_0x1f10('0x31')],_0x32c253[_0x1f10('0x32')]);_0x5bb414[_0x1f10('0x36')]=_[_0x1f10('0x34')](_0x32c253[_0x1f10('0x31')],qs['fields'](_0x413d5f[_0x1f10('0x32')]['fields']));_0x5bb414['attributes']=_0x5bb414[_0x1f10('0x36')][_0x1f10('0x37')]?_0x5bb414[_0x1f10('0x36')]:_0x32c253[_0x1f10('0x31')];if(_0x413d5f[_0x1f10('0x32')][_0x1f10('0x42')]){_0x5bb414[_0x1f10('0x43')]=[{'all':!![]}];}_0x5bb414=_[_0x1f10('0x3e')]({},_0x5bb414,_0x413d5f[_0x1f10('0x41')]);return db[_0x1f10('0x2d')][_0x1f10('0x49')](_0x5bb414)[_0x1f10('0x25')](handleEntityNotFound(_0xaefc1f,null))[_0x1f10('0x25')](respondWithResult(_0xaefc1f,null))[_0x1f10('0x46')](handleError(_0xaefc1f,null));};exports[_0x1f10('0x4a')]=function(_0x46d76,_0x7ceb79){return db[_0x1f10('0x2d')][_0x1f10('0x4a')](_0x46d76[_0x1f10('0x4b')],{})[_0x1f10('0x25')](respondWithResult(_0x7ceb79,0xc9))[_0x1f10('0x46')](handleError(_0x7ceb79,null));};exports[_0x1f10('0x24')]=function(_0x38a1ab,_0x51d27b){if(_0x38a1ab['body']['id']){delete _0x38a1ab[_0x1f10('0x4b')]['id'];}return db[_0x1f10('0x2d')]['find']({'where':{'id':_0x38a1ab[_0x1f10('0x47')]['id']}})[_0x1f10('0x25')](handleEntityNotFound(_0x51d27b,null))[_0x1f10('0x25')](saveUpdates(_0x38a1ab[_0x1f10('0x4b')],null))[_0x1f10('0x25')](respondWithResult(_0x51d27b,null))[_0x1f10('0x46')](handleError(_0x51d27b,null));};exports['destroy']=function(_0x28f068,_0x5717f0){return db['SquareReport'][_0x1f10('0x49')]({'where':{'id':_0x28f068['params']['id']}})['then'](handleEntityNotFound(_0x5717f0,null))[_0x1f10('0x25')](removeEntity(_0x5717f0,null))[_0x1f10('0x46')](handleError(_0x5717f0,null));};exports[_0x1f10('0x4c')]=function(_0x1c30b8,_0x461d24){return db[_0x1f10('0x2d')][_0x1f10('0x4c')]()[_0x1f10('0x25')](respondWithResult(_0x461d24,null))[_0x1f10('0x46')](handleError(_0x461d24,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index 1300f74..def1af1 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 _0x5c59=['../../config/logger','moment','bluebird','rimraf','../../config/environment','./squareReport.attributes','exports','define','SquareReport','report_square','uid_pname','project_name','leaveAt','lodash','util'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x5c59,0x12a));var _0x95c5=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x5c59[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x95c5('0x0'));var util=require(_0x95c5('0x1'));var logger=require(_0x95c5('0x2'))('api');var moment=require(_0x95c5('0x3'));var BPromise=require(_0x95c5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x95c5('0x5'));var config=require(_0x95c5('0x6'));var attributes=require(_0x95c5('0x7'));module[_0x95c5('0x8')]=function(_0x38bcc6,_0x54e85c){return _0x38bcc6[_0x95c5('0x9')](_0x95c5('0xa'),attributes,{'tableName':_0x95c5('0xb'),'paranoid':![],'indexes':[{'name':_0x95c5('0xc'),'fields':['uniqueid',_0x95c5('0xd')]},{'name':_0x95c5('0xe'),'fields':['leaveAt']}],'timestamps':!![]});}; \ No newline at end of file +var _0xe270=['exports','define','report_square','uid_pname','uniqueid','project_name','leaveAt','lodash','util','api','../../config/environment','./squareReport.attributes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe270,0xc7));var _0x0e27=function(_0x89311d,_0x991439){_0x89311d=_0x89311d-0x0;var _0x53ee33=_0xe270[_0x89311d];return _0x53ee33;};'use strict';var _=require(_0x0e27('0x0'));var util=require(_0x0e27('0x1'));var logger=require('../../config/logger')(_0x0e27('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x0e27('0x3'));var attributes=require(_0x0e27('0x4'));module[_0x0e27('0x5')]=function(_0x1d7781,_0x599f08){return _0x1d7781[_0x0e27('0x6')]('SquareReport',attributes,{'tableName':_0x0e27('0x7'),'paranoid':![],'indexes':[{'name':_0x0e27('0x8'),'fields':[_0x0e27('0x9'),_0x0e27('0xa')]},{'name':_0x0e27('0xb'),'fields':[_0x0e27('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index c64ca5a..3e54de3 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 _0xeb54=['error','code','message','result','CreateSquareReport','SquareReport','create','body','options','raw','catch','UpdateSquareReport','update','where','attributes','limit','then','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','SquareReport,\x20%s,\x20%s','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x57a060,_0x3daa47){var _0x3b5ed6=function(_0x11d3e1){while(--_0x11d3e1){_0x57a060['push'](_0x57a060['shift']());}};_0x3b5ed6(++_0x3daa47);}(_0xeb54,0x14c));var _0x4eb5=function(_0x2c0fa9,_0x4277b9){_0x2c0fa9=_0x2c0fa9-0x0;var _0x5224aa=_0xeb54[_0x2c0fa9];return _0x5224aa;};'use strict';var _=require(_0x4eb5('0x0'));var util=require(_0x4eb5('0x1'));var moment=require(_0x4eb5('0x2'));var BPromise=require('bluebird');var rs=require(_0x4eb5('0x3'));var fs=require('fs');var Redis=require(_0x4eb5('0x4'));var db=require(_0x4eb5('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x4eb5('0x6'))('rpc');var config=require(_0x4eb5('0x7'));var jayson=require(_0x4eb5('0x8'));var client=jayson[_0x4eb5('0x9')][_0x4eb5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4f0a4c,_0x3e5ef8,_0x20adb9){return new BPromise(function(_0x3f1383,_0x2e747e){return client[_0x4eb5('0xb')](_0x4f0a4c,_0x20adb9)['then'](function(_0x25c11b){logger[_0x4eb5('0xc')](_0x4eb5('0xd'),_0x3e5ef8,_0x4eb5('0xe'));logger[_0x4eb5('0xf')](_0x4eb5('0x10'),_0x3e5ef8,_0x4eb5('0xe'),JSON[_0x4eb5('0x11')](_0x25c11b));if(_0x25c11b[_0x4eb5('0x12')]){if(_0x25c11b[_0x4eb5('0x12')][_0x4eb5('0x13')]===0x1f4){logger[_0x4eb5('0x12')](_0x4eb5('0xd'),_0x3e5ef8,_0x25c11b[_0x4eb5('0x12')][_0x4eb5('0x14')]);return _0x2e747e(_0x25c11b['error'][_0x4eb5('0x14')]);}logger['error'](_0x4eb5('0xd'),_0x3e5ef8,_0x25c11b['error']['message']);return _0x3f1383(_0x25c11b[_0x4eb5('0x12')][_0x4eb5('0x14')]);}else{logger[_0x4eb5('0xc')](_0x4eb5('0xd'),_0x3e5ef8,_0x4eb5('0xe'));_0x3f1383(_0x25c11b[_0x4eb5('0x15')]['message']);}})['catch'](function(_0x1a2a69){logger['error'](_0x4eb5('0xd'),_0x3e5ef8,_0x1a2a69);_0x2e747e(_0x1a2a69);});});}exports[_0x4eb5('0x16')]=function(_0x5315cb){var _0x30188d=this;return new Promise(function(_0x135827,_0x5c9e2f){return db[_0x4eb5('0x17')][_0x4eb5('0x18')](_0x5315cb[_0x4eb5('0x19')],{'raw':_0x5315cb['options']?_0x5315cb[_0x4eb5('0x1a')][_0x4eb5('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x1e6d95){logger[_0x4eb5('0xc')](_0x4eb5('0x16'),_0x5315cb);logger[_0x4eb5('0xf')]('CreateSquareReport',_0x5315cb,JSON[_0x4eb5('0x11')](_0x1e6d95));_0x135827(_0x1e6d95);})[_0x4eb5('0x1c')](function(_0x3024ed){logger['error'](_0x4eb5('0x16'),_0x3024ed[_0x4eb5('0x14')],_0x5315cb);_0x5c9e2f(_0x30188d[_0x4eb5('0x12')](0x1f4,_0x3024ed[_0x4eb5('0x14')]));});});};exports[_0x4eb5('0x1d')]=function(_0x522d6e){var _0x19fe02=this;return new Promise(function(_0x4b1078,_0x7caf4d){return db[_0x4eb5('0x17')][_0x4eb5('0x1e')](_0x522d6e[_0x4eb5('0x19')],{'raw':_0x522d6e['options']?_0x522d6e[_0x4eb5('0x1a')][_0x4eb5('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x522d6e[_0x4eb5('0x1a')]?_0x522d6e[_0x4eb5('0x1a')][_0x4eb5('0x1f')]||null:null,'attributes':_0x522d6e[_0x4eb5('0x1a')]?_0x522d6e[_0x4eb5('0x1a')][_0x4eb5('0x20')]||null:null,'limit':_0x522d6e[_0x4eb5('0x1a')]?_0x522d6e[_0x4eb5('0x1a')][_0x4eb5('0x21')]||null:null})[_0x4eb5('0x22')](function(_0x2dbf45){logger[_0x4eb5('0xc')](_0x4eb5('0x1d'),_0x522d6e);logger[_0x4eb5('0xf')]('UpdateSquareReport',_0x522d6e,JSON[_0x4eb5('0x11')](_0x2dbf45));_0x4b1078(_0x2dbf45);})[_0x4eb5('0x1c')](function(_0x34c33f){logger[_0x4eb5('0x12')](_0x4eb5('0x1d'),_0x34c33f[_0x4eb5('0x14')],_0x522d6e);_0x7caf4d(_0x19fe02['error'](0x1f4,_0x34c33f[_0x4eb5('0x14')]));});});}; \ No newline at end of file +var _0x2a9c=['then','info','debug','stringify','error','code','message','SquareReport,\x20%s,\x20%s','request\x20sent','catch','CreateSquareReport','SquareReport','create','options','raw','UpdateSquareReport','update','body','where','attributes','limit','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request'];(function(_0x4e7d25,_0x58285f){var _0x526fe6=function(_0x4f0aec){while(--_0x4f0aec){_0x4e7d25['push'](_0x4e7d25['shift']());}};_0x526fe6(++_0x58285f);}(_0x2a9c,0x155));var _0xc2a9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2a9c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc2a9('0x0'));var util=require(_0xc2a9('0x1'));var moment=require(_0xc2a9('0x2'));var BPromise=require('bluebird');var rs=require(_0xc2a9('0x3'));var fs=require('fs');var Redis=require(_0xc2a9('0x4'));var db=require(_0xc2a9('0x5'))['db'];var utils=require(_0xc2a9('0x6'));var logger=require(_0xc2a9('0x7'))(_0xc2a9('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xc2a9('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x101449,_0x496f3a,_0x501b08){return new BPromise(function(_0x5dab01,_0x314545){return client[_0xc2a9('0xa')](_0x101449,_0x501b08)[_0xc2a9('0xb')](function(_0x4e6323){logger[_0xc2a9('0xc')]('SquareReport,\x20%s,\x20%s',_0x496f3a,'request\x20sent');logger[_0xc2a9('0xd')]('SquareReport,\x20%s,\x20%s,\x20%s',_0x496f3a,'request\x20sent',JSON[_0xc2a9('0xe')](_0x4e6323));if(_0x4e6323[_0xc2a9('0xf')]){if(_0x4e6323[_0xc2a9('0xf')][_0xc2a9('0x10')]===0x1f4){logger[_0xc2a9('0xf')]('SquareReport,\x20%s,\x20%s',_0x496f3a,_0x4e6323[_0xc2a9('0xf')][_0xc2a9('0x11')]);return _0x314545(_0x4e6323[_0xc2a9('0xf')][_0xc2a9('0x11')]);}logger[_0xc2a9('0xf')](_0xc2a9('0x12'),_0x496f3a,_0x4e6323[_0xc2a9('0xf')][_0xc2a9('0x11')]);return _0x5dab01(_0x4e6323[_0xc2a9('0xf')]['message']);}else{logger['info'](_0xc2a9('0x12'),_0x496f3a,_0xc2a9('0x13'));_0x5dab01(_0x4e6323['result']['message']);}})[_0xc2a9('0x14')](function(_0x31abff){logger['error'](_0xc2a9('0x12'),_0x496f3a,_0x31abff);_0x314545(_0x31abff);});});}exports[_0xc2a9('0x15')]=function(_0xeeb5a4){var _0x12b6b6=this;return new Promise(function(_0x5f287d,_0x2f3a0c){return db[_0xc2a9('0x16')][_0xc2a9('0x17')](_0xeeb5a4['body'],{'raw':_0xeeb5a4['options']?_0xeeb5a4[_0xc2a9('0x18')][_0xc2a9('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x209f3d){logger[_0xc2a9('0xc')](_0xc2a9('0x15'),_0xeeb5a4);logger['debug'](_0xc2a9('0x15'),_0xeeb5a4,JSON[_0xc2a9('0xe')](_0x209f3d));_0x5f287d(_0x209f3d);})[_0xc2a9('0x14')](function(_0x1b26b9){logger[_0xc2a9('0xf')](_0xc2a9('0x15'),_0x1b26b9[_0xc2a9('0x11')],_0xeeb5a4);_0x2f3a0c(_0x12b6b6[_0xc2a9('0xf')](0x1f4,_0x1b26b9[_0xc2a9('0x11')]));});});};exports[_0xc2a9('0x1a')]=function(_0x529eda){var _0x5b65a7=this;return new Promise(function(_0x98558e,_0x305c38){return db[_0xc2a9('0x16')][_0xc2a9('0x1b')](_0x529eda[_0xc2a9('0x1c')],{'raw':_0x529eda[_0xc2a9('0x18')]?_0x529eda['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x529eda[_0xc2a9('0x18')]?_0x529eda['options'][_0xc2a9('0x1d')]||null:null,'attributes':_0x529eda['options']?_0x529eda[_0xc2a9('0x18')][_0xc2a9('0x1e')]||null:null,'limit':_0x529eda[_0xc2a9('0x18')]?_0x529eda[_0xc2a9('0x18')][_0xc2a9('0x1f')]||null:null})[_0xc2a9('0xb')](function(_0xbb96f2){logger[_0xc2a9('0xc')](_0xc2a9('0x1a'),_0x529eda);logger['debug']('UpdateSquareReport',_0x529eda,JSON[_0xc2a9('0xe')](_0xbb96f2));_0x98558e(_0xbb96f2);})[_0xc2a9('0x14')](function(_0x102cd5){logger[_0xc2a9('0xf')](_0xc2a9('0x1a'),_0x102cd5[_0xc2a9('0x11')],_0x529eda);_0x305c38(_0x5b65a7[_0xc2a9('0xf')](0x1f4,_0x102cd5[_0xc2a9('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index 16ceec3..20f5c3c 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 _0x3eda=['create','/:id','update','delete','destroy','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','get','index','/describe','isAuthenticated','describe','show'];(function(_0x323626,_0x23a399){var _0x32d9c7=function(_0x3b5789){while(--_0x3b5789){_0x323626['push'](_0x323626['shift']());}};_0x32d9c7(++_0x23a399);}(_0x3eda,0x1e1));var _0xa3ed=function(_0x3cb679,_0x28195f){_0x3cb679=_0x3cb679-0x0;var _0x18f926=_0x3eda[_0x3cb679];return _0x18f926;};'use strict';var multer=require(_0xa3ed('0x0'));var util=require('util');var path=require(_0xa3ed('0x1'));var timeout=require('connect-timeout');var express=require(_0xa3ed('0x2'));var router=express[_0xa3ed('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xa3ed('0x4'));var interaction=require(_0xa3ed('0x5'));var config=require('../../config/environment');var controller=require('./squareReportDetail.controller');router[_0xa3ed('0x6')]('/',auth['isAuthenticated'](),controller[_0xa3ed('0x7')]);router['get'](_0xa3ed('0x8'),auth[_0xa3ed('0x9')](),controller[_0xa3ed('0xa')]);router['get']('/:id',auth[_0xa3ed('0x9')](),controller[_0xa3ed('0xb')]);router['post']('/',auth[_0xa3ed('0x9')](),controller[_0xa3ed('0xc')]);router['put'](_0xa3ed('0xd'),auth['isAuthenticated'](),controller[_0xa3ed('0xe')]);router[_0xa3ed('0xf')]('/:id',auth[_0xa3ed('0x9')](),controller[_0xa3ed('0x10')]);module['exports']=router; \ No newline at end of file +var _0x9d6b=['index','isAuthenticated','describe','/:id','show','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./squareReportDetail.controller','get'];(function(_0x55d8c5,_0x10287a){var _0x225ae5=function(_0x2ba03a){while(--_0x2ba03a){_0x55d8c5['push'](_0x55d8c5['shift']());}};_0x225ae5(++_0x10287a);}(_0x9d6b,0x88));var _0xb9d6=function(_0x17dde4,_0xf8352a){_0x17dde4=_0x17dde4-0x0;var _0x1f15bc=_0x9d6b[_0x17dde4];return _0x1f15bc;};'use strict';var multer=require(_0xb9d6('0x0'));var util=require(_0xb9d6('0x1'));var path=require(_0xb9d6('0x2'));var timeout=require(_0xb9d6('0x3'));var express=require(_0xb9d6('0x4'));var router=express[_0xb9d6('0x5')]();var fs_extra=require(_0xb9d6('0x6'));var auth=require(_0xb9d6('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xb9d6('0x8'));var controller=require(_0xb9d6('0x9'));router[_0xb9d6('0xa')]('/',auth['isAuthenticated'](),controller[_0xb9d6('0xb')]);router['get']('/describe',auth[_0xb9d6('0xc')](),controller[_0xb9d6('0xd')]);router['get'](_0xb9d6('0xe'),auth[_0xb9d6('0xc')](),controller[_0xb9d6('0xf')]);router['post']('/',auth[_0xb9d6('0xc')](),controller[_0xb9d6('0x10')]);router['put'](_0xb9d6('0xe'),auth[_0xb9d6('0xc')](),controller[_0xb9d6('0x11')]);router[_0xb9d6('0x12')]('/:id',auth[_0xb9d6('0xc')](),controller[_0xb9d6('0x13')]);module[_0xb9d6('0x14')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index eb8ef06..dcde9e5 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 _0x1af6=['exports','STRING','sequelize'];(function(_0x32f834,_0x29d346){var _0x57e253=function(_0x86c610){while(--_0x86c610){_0x32f834['push'](_0x32f834['shift']());}};_0x57e253(++_0x29d346);}(_0x1af6,0x1c7));var _0x61af=function(_0x3e7a28,_0x25a64e){_0x3e7a28=_0x3e7a28-0x0;var _0x51387b=_0x1af6[_0x3e7a28];return _0x51387b;};'use strict';var Sequelize=require(_0x61af('0x0'));module[_0x61af('0x1')]={'uniqueid':{'type':Sequelize[_0x61af('0x2')]},'node':{'type':Sequelize[_0x61af('0x2')]},'application':{'type':Sequelize['STRING']},'data':{'type':Sequelize['TEXT']},'project_name':{'type':Sequelize[_0x61af('0x2')]},'callerid':{'type':Sequelize[_0x61af('0x2')]}}; \ No newline at end of file +var _0x8986=['exports','STRING','TEXT'];(function(_0x5c6299,_0x11bd28){var _0x23b564=function(_0x329ed6){while(--_0x329ed6){_0x5c6299['push'](_0x5c6299['shift']());}};_0x23b564(++_0x11bd28);}(_0x8986,0x132));var _0x6898=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x8986[_0x19e35c];return _0x3e1fe8;};'use strict';var Sequelize=require('sequelize');module[_0x6898('0x0')]={'uniqueid':{'type':Sequelize[_0x6898('0x1')]},'node':{'type':Sequelize[_0x6898('0x1')]},'application':{'type':Sequelize[_0x6898('0x1')]},'data':{'type':Sequelize[_0x6898('0x2')]},'project_name':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index 5e5b4a2..69c3a22 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 _0xf6d4=['pick','merge','VIRTUAL','SquareDetailsReport','count','then','rows','show','params','rawAttributes','intersection','include','options','catch','create','body','find','destroy','describe','rimraf','fast-json-patch','moment','mustache','path','sox','to-csv','ejs','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','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','stack','name','map','fieldName','type','key','query','keys','filters','model','fields','attributes','length','hasOwnProperty','order','sort','where'];(function(_0x196bca,_0x570e9b){var _0x54fb4c=function(_0x28ccac){while(--_0x28ccac){_0x196bca['push'](_0x196bca['shift']());}};_0x54fb4c(++_0x570e9b);}(_0xf6d4,0x180));var _0x4f6d=function(_0x198156,_0x4b6fcc){_0x198156=_0x198156-0x0;var _0x2be896=_0xf6d4[_0x198156];return _0x2be896;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4f6d('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4f6d('0x1'));var rp=require('request-promise');var moment=require(_0x4f6d('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x4f6d('0x3'));var util=require('util');var path=require(_0x4f6d('0x4'));var sox=require(_0x4f6d('0x5'));var csv=require(_0x4f6d('0x6'));var ejs=require(_0x4f6d('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4f6d('0x8'));var squel=require(_0x4f6d('0x9'));var crypto=require(_0x4f6d('0xa'));var jsforce=require(_0x4f6d('0xb'));var deskjs=require(_0x4f6d('0xc'));var toCsv=require(_0x4f6d('0x6'));var querystring=require(_0x4f6d('0xd'));var Papa=require(_0x4f6d('0xe'));var Redis=require('ioredis');var authService=require(_0x4f6d('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x4f6d('0x10'));var hardwareService=require(_0x4f6d('0x11'));var logger=require(_0x4f6d('0x12'))(_0x4f6d('0x13'));var utils=require(_0x4f6d('0x14'));var config=require(_0x4f6d('0x15'));var licenseUtil=require(_0x4f6d('0x16'));var db=require(_0x4f6d('0x17'))['db'];function respondWithStatusCode(_0x120f97,_0x1e281b){_0x1e281b=_0x1e281b||0xcc;return function(_0x337e09){if(_0x337e09){return _0x120f97[_0x4f6d('0x18')](_0x1e281b);}return _0x120f97[_0x4f6d('0x19')](_0x1e281b)[_0x4f6d('0x1a')]();};}function respondWithResult(_0x2f8e47,_0x2439fe){_0x2439fe=_0x2439fe||0xc8;return function(_0x476a5f){if(_0x476a5f){return _0x2f8e47[_0x4f6d('0x19')](_0x2439fe)[_0x4f6d('0x1b')](_0x476a5f);}};}function respondWithFilteredResult(_0x1a13c7,_0x45b5dd){return function(_0xb34f14){if(_0xb34f14){var _0x47d9ed=typeof _0x45b5dd[_0x4f6d('0x1c')]===_0x4f6d('0x1d')&&typeof _0x45b5dd[_0x4f6d('0x1e')]===_0x4f6d('0x1d');var _0x5b1001=_0xb34f14['count'];var _0x17ba4d=_0x47d9ed?0x0:_0x45b5dd[_0x4f6d('0x1c')];var _0x2cac3b=_0x47d9ed?_0xb34f14['count']:_0x45b5dd[_0x4f6d('0x1c')]+_0x45b5dd[_0x4f6d('0x1e')];var _0x42de24;if(_0x2cac3b>=_0x5b1001){_0x2cac3b=_0x5b1001;_0x42de24=0xc8;}else{_0x42de24=0xce;}_0x1a13c7[_0x4f6d('0x19')](_0x42de24);return _0x1a13c7[_0x4f6d('0x1f')](_0x4f6d('0x20'),_0x17ba4d+'-'+_0x2cac3b+'/'+_0x5b1001)[_0x4f6d('0x1b')](_0xb34f14);}return null;};}function patchUpdates(_0x5d9132){return function(_0x3eeb01){try{jsonpatch[_0x4f6d('0x21')](_0x3eeb01,_0x5d9132,!![]);}catch(_0x1b7ff8){return BPromise[_0x4f6d('0x22')](_0x1b7ff8);}return _0x3eeb01[_0x4f6d('0x23')]();};}function saveUpdates(_0x5c7c34,_0x51a468){return function(_0x221286){if(_0x221286){return _0x221286[_0x4f6d('0x24')](_0x5c7c34)['then'](function(_0x17b0df){return _0x17b0df;});}return null;};}function removeEntity(_0xc4ce8c,_0x150a4e){return function(_0x24ddfd){if(_0x24ddfd){return _0x24ddfd['destroy']()['then'](function(){_0xc4ce8c[_0x4f6d('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x46c90e,_0x306e2b){return function(_0x45219c){if(!_0x45219c){_0x46c90e[_0x4f6d('0x18')](0x194);}return _0x45219c;};}function handleError(_0xc91d55,_0x5c13d7){_0x5c13d7=_0x5c13d7||0x1f4;return function(_0x5690f7){logger['error'](_0x5690f7[_0x4f6d('0x25')]);if(_0x5690f7[_0x4f6d('0x26')]){delete _0x5690f7['name'];}_0xc91d55[_0x4f6d('0x19')](_0x5c13d7)['send'](_0x5690f7);};}exports['index']=function(_0x2361e9,_0x2518e4){var _0x32ecbf={},_0x288333={},_0x19f0e4={'count':0x0,'rows':[]};var _0x534204=_[_0x4f6d('0x27')](db['SquareDetailsReport']['rawAttributes'],function(_0x563ef4){return{'name':_0x563ef4[_0x4f6d('0x28')],'type':_0x563ef4[_0x4f6d('0x29')][_0x4f6d('0x2a')]};});_0x288333['model']=_[_0x4f6d('0x27')](_0x534204,_0x4f6d('0x26'));_0x288333[_0x4f6d('0x2b')]=_[_0x4f6d('0x2c')](_0x2361e9[_0x4f6d('0x2b')]);_0x288333[_0x4f6d('0x2d')]=_['intersection'](_0x288333[_0x4f6d('0x2e')],_0x288333[_0x4f6d('0x2b')]);_0x32ecbf['attributes']=_['intersection'](_0x288333[_0x4f6d('0x2e')],qs[_0x4f6d('0x2f')](_0x2361e9[_0x4f6d('0x2b')]['fields']));_0x32ecbf[_0x4f6d('0x30')]=_0x32ecbf[_0x4f6d('0x30')][_0x4f6d('0x31')]?_0x32ecbf['attributes']:_0x288333[_0x4f6d('0x2e')];if(!_0x2361e9['query'][_0x4f6d('0x32')]('nolimit')){_0x32ecbf[_0x4f6d('0x1e')]=qs[_0x4f6d('0x1e')](_0x2361e9[_0x4f6d('0x2b')][_0x4f6d('0x1e')]);_0x32ecbf[_0x4f6d('0x1c')]=qs[_0x4f6d('0x1c')](_0x2361e9['query'][_0x4f6d('0x1c')]);}_0x32ecbf[_0x4f6d('0x33')]=qs['sort'](_0x2361e9[_0x4f6d('0x2b')][_0x4f6d('0x34')]);_0x32ecbf[_0x4f6d('0x35')]=qs[_0x4f6d('0x2d')](_[_0x4f6d('0x36')](_0x2361e9[_0x4f6d('0x2b')],_0x288333[_0x4f6d('0x2d')]),_0x534204);if(_0x2361e9[_0x4f6d('0x2b')]['filter']){_0x32ecbf[_0x4f6d('0x35')]=_[_0x4f6d('0x37')](_0x32ecbf[_0x4f6d('0x35')],{'$or':_[_0x4f6d('0x27')](_0x534204,function(_0x461c71){if(_0x461c71[_0x4f6d('0x29')]!==_0x4f6d('0x38')){var _0x3a2b8e={};_0x3a2b8e[_0x461c71[_0x4f6d('0x26')]]={'$like':'%'+_0x2361e9[_0x4f6d('0x2b')]['filter']+'%'};return _0x3a2b8e;}})});}_0x32ecbf=_[_0x4f6d('0x37')]({},_0x32ecbf,_0x2361e9['options']);var _0x3fff4c={'where':_0x32ecbf[_0x4f6d('0x35')]};return db[_0x4f6d('0x39')][_0x4f6d('0x3a')](_0x3fff4c)['then'](function(_0x48a91e){_0x19f0e4[_0x4f6d('0x3a')]=_0x48a91e;if(_0x2361e9[_0x4f6d('0x2b')]['includeAll']){_0x32ecbf['include']=[{'all':!![]}];}return db['SquareDetailsReport']['findAll'](_0x32ecbf);})[_0x4f6d('0x3b')](function(_0x744410){_0x19f0e4[_0x4f6d('0x3c')]=_0x744410;return _0x19f0e4;})[_0x4f6d('0x3b')](respondWithFilteredResult(_0x2518e4,_0x32ecbf))['catch'](handleError(_0x2518e4,null));};exports[_0x4f6d('0x3d')]=function(_0xa217b9,_0x5c8bda){var _0x48eded={'raw':!![],'where':{'id':_0xa217b9[_0x4f6d('0x3e')]['id']}},_0x3d9fad={};_0x3d9fad['model']=_[_0x4f6d('0x2c')](db[_0x4f6d('0x39')][_0x4f6d('0x3f')]);_0x3d9fad['query']=_[_0x4f6d('0x2c')](_0xa217b9['query']);_0x3d9fad[_0x4f6d('0x2d')]=_[_0x4f6d('0x40')](_0x3d9fad[_0x4f6d('0x2e')],_0x3d9fad[_0x4f6d('0x2b')]);_0x48eded['attributes']=_[_0x4f6d('0x40')](_0x3d9fad[_0x4f6d('0x2e')],qs[_0x4f6d('0x2f')](_0xa217b9[_0x4f6d('0x2b')][_0x4f6d('0x2f')]));_0x48eded[_0x4f6d('0x30')]=_0x48eded[_0x4f6d('0x30')][_0x4f6d('0x31')]?_0x48eded[_0x4f6d('0x30')]:_0x3d9fad['model'];if(_0xa217b9['query']['includeAll']){_0x48eded[_0x4f6d('0x41')]=[{'all':!![]}];}_0x48eded=_[_0x4f6d('0x37')]({},_0x48eded,_0xa217b9[_0x4f6d('0x42')]);return db[_0x4f6d('0x39')]['find'](_0x48eded)[_0x4f6d('0x3b')](handleEntityNotFound(_0x5c8bda,null))[_0x4f6d('0x3b')](respondWithResult(_0x5c8bda,null))[_0x4f6d('0x43')](handleError(_0x5c8bda,null));};exports[_0x4f6d('0x44')]=function(_0x5314e4,_0x20fddc){return db[_0x4f6d('0x39')][_0x4f6d('0x44')](_0x5314e4['body'],{})['then'](respondWithResult(_0x20fddc,0xc9))[_0x4f6d('0x43')](handleError(_0x20fddc,null));};exports[_0x4f6d('0x24')]=function(_0xd6ba4e,_0x3fbf79){if(_0xd6ba4e[_0x4f6d('0x45')]['id']){delete _0xd6ba4e['body']['id'];}return db[_0x4f6d('0x39')][_0x4f6d('0x46')]({'where':{'id':_0xd6ba4e['params']['id']}})['then'](handleEntityNotFound(_0x3fbf79,null))['then'](saveUpdates(_0xd6ba4e[_0x4f6d('0x45')],null))[_0x4f6d('0x3b')](respondWithResult(_0x3fbf79,null))['catch'](handleError(_0x3fbf79,null));};exports[_0x4f6d('0x47')]=function(_0x319384,_0x595552){return db[_0x4f6d('0x39')][_0x4f6d('0x46')]({'where':{'id':_0x319384['params']['id']}})[_0x4f6d('0x3b')](handleEntityNotFound(_0x595552,null))[_0x4f6d('0x3b')](removeEntity(_0x595552,null))[_0x4f6d('0x43')](handleError(_0x595552,null));};exports[_0x4f6d('0x48')]=function(_0x4dfceb,_0x2f4720){return db[_0x4f6d('0x39')][_0x4f6d('0x48')]()[_0x4f6d('0x3b')](respondWithResult(_0x2f4720,null))['catch'](handleError(_0x2f4720,null));}; \ No newline at end of file +var _0x87bc=['Content-Range','apply','reject','save','then','destroy','stack','name','send','index','map','SquareDetailsReport','rawAttributes','fieldName','type','key','model','keys','intersection','query','attributes','fields','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','update','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count'];(function(_0x37d44e,_0x7ea385){var _0x2dd918=function(_0x1773c6){while(--_0x1773c6){_0x37d44e['push'](_0x37d44e['shift']());}};_0x2dd918(++_0x7ea385);}(_0x87bc,0x159));var _0xc87b=function(_0x20a6ad,_0x6154ed){_0x20a6ad=_0x20a6ad-0x0;var _0x417cc0=_0x87bc[_0x20a6ad];return _0x417cc0;};'use strict';var emlformat=require(_0xc87b('0x0'));var rimraf=require(_0xc87b('0x1'));var zipdir=require(_0xc87b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc87b('0x3'));var moment=require(_0xc87b('0x4'));var BPromise=require(_0xc87b('0x5'));var Mustache=require('mustache');var util=require(_0xc87b('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(_0xc87b('0x7'));var _=require(_0xc87b('0x8'));var squel=require(_0xc87b('0x9'));var crypto=require(_0xc87b('0xa'));var jsforce=require(_0xc87b('0xb'));var deskjs=require(_0xc87b('0xc'));var toCsv=require(_0xc87b('0xd'));var querystring=require(_0xc87b('0xe'));var Papa=require('papaparse');var Redis=require(_0xc87b('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xc87b('0x10'));var as=require(_0xc87b('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xc87b('0x12'));var utils=require(_0xc87b('0x13'));var config=require(_0xc87b('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xc87b('0x15'))['db'];function respondWithStatusCode(_0x4893ae,_0x50325a){_0x50325a=_0x50325a||0xcc;return function(_0x40bf45){if(_0x40bf45){return _0x4893ae[_0xc87b('0x16')](_0x50325a);}return _0x4893ae[_0xc87b('0x17')](_0x50325a)[_0xc87b('0x18')]();};}function respondWithResult(_0x4182f5,_0x1c056f){_0x1c056f=_0x1c056f||0xc8;return function(_0x17538b){if(_0x17538b){return _0x4182f5[_0xc87b('0x17')](_0x1c056f)[_0xc87b('0x19')](_0x17538b);}};}function respondWithFilteredResult(_0x247975,_0x5289a1){return function(_0x1e8395){if(_0x1e8395){var _0x20d5e8=typeof _0x5289a1[_0xc87b('0x1a')]===_0xc87b('0x1b')&&typeof _0x5289a1[_0xc87b('0x1c')]===_0xc87b('0x1b');var _0x1a9994=_0x1e8395['count'];var _0x3478a6=_0x20d5e8?0x0:_0x5289a1['offset'];var _0x1fa1e8=_0x20d5e8?_0x1e8395[_0xc87b('0x1d')]:_0x5289a1[_0xc87b('0x1a')]+_0x5289a1['limit'];var _0x47e987;if(_0x1fa1e8>=_0x1a9994){_0x1fa1e8=_0x1a9994;_0x47e987=0xc8;}else{_0x47e987=0xce;}_0x247975[_0xc87b('0x17')](_0x47e987);return _0x247975['set'](_0xc87b('0x1e'),_0x3478a6+'-'+_0x1fa1e8+'/'+_0x1a9994)[_0xc87b('0x19')](_0x1e8395);}return null;};}function patchUpdates(_0x4d948a){return function(_0x52b697){try{jsonpatch[_0xc87b('0x1f')](_0x52b697,_0x4d948a,!![]);}catch(_0x34dd4d){return BPromise[_0xc87b('0x20')](_0x34dd4d);}return _0x52b697[_0xc87b('0x21')]();};}function saveUpdates(_0x1887c9,_0x5f067b){return function(_0xc834c0){if(_0xc834c0){return _0xc834c0['update'](_0x1887c9)[_0xc87b('0x22')](function(_0x508fce){return _0x508fce;});}return null;};}function removeEntity(_0x546dc5,_0x14470a){return function(_0x38425d){if(_0x38425d){return _0x38425d[_0xc87b('0x23')]()[_0xc87b('0x22')](function(){_0x546dc5[_0xc87b('0x17')](0xcc)[_0xc87b('0x18')]();});}};}function handleEntityNotFound(_0x2bdb0e,_0x443eb0){return function(_0x2f402a){if(!_0x2f402a){_0x2bdb0e['sendStatus'](0x194);}return _0x2f402a;};}function handleError(_0x4d050f,_0x416492){_0x416492=_0x416492||0x1f4;return function(_0x15f7c0){logger['error'](_0x15f7c0[_0xc87b('0x24')]);if(_0x15f7c0[_0xc87b('0x25')]){delete _0x15f7c0['name'];}_0x4d050f[_0xc87b('0x17')](_0x416492)[_0xc87b('0x26')](_0x15f7c0);};}exports[_0xc87b('0x27')]=function(_0x166322,_0x108107){var _0x46c869={},_0x30bd46={},_0x3382b5={'count':0x0,'rows':[]};var _0x223284=_[_0xc87b('0x28')](db[_0xc87b('0x29')][_0xc87b('0x2a')],function(_0x572104){return{'name':_0x572104[_0xc87b('0x2b')],'type':_0x572104[_0xc87b('0x2c')][_0xc87b('0x2d')]};});_0x30bd46[_0xc87b('0x2e')]=_[_0xc87b('0x28')](_0x223284,_0xc87b('0x25'));_0x30bd46['query']=_[_0xc87b('0x2f')](_0x166322['query']);_0x30bd46['filters']=_[_0xc87b('0x30')](_0x30bd46['model'],_0x30bd46[_0xc87b('0x31')]);_0x46c869[_0xc87b('0x32')]=_[_0xc87b('0x30')](_0x30bd46[_0xc87b('0x2e')],qs[_0xc87b('0x33')](_0x166322[_0xc87b('0x31')][_0xc87b('0x33')]));_0x46c869[_0xc87b('0x32')]=_0x46c869[_0xc87b('0x32')]['length']?_0x46c869['attributes']:_0x30bd46[_0xc87b('0x2e')];if(!_0x166322[_0xc87b('0x31')][_0xc87b('0x34')](_0xc87b('0x35'))){_0x46c869['limit']=qs[_0xc87b('0x1c')](_0x166322[_0xc87b('0x31')][_0xc87b('0x1c')]);_0x46c869[_0xc87b('0x1a')]=qs[_0xc87b('0x1a')](_0x166322[_0xc87b('0x31')][_0xc87b('0x1a')]);}_0x46c869['order']=qs[_0xc87b('0x36')](_0x166322[_0xc87b('0x31')]['sort']);_0x46c869[_0xc87b('0x37')]=qs[_0xc87b('0x38')](_[_0xc87b('0x39')](_0x166322['query'],_0x30bd46[_0xc87b('0x38')]),_0x223284);if(_0x166322[_0xc87b('0x31')][_0xc87b('0x3a')]){_0x46c869['where']=_[_0xc87b('0x3b')](_0x46c869[_0xc87b('0x37')],{'$or':_[_0xc87b('0x28')](_0x223284,function(_0x20c5a8){if(_0x20c5a8[_0xc87b('0x2c')]!==_0xc87b('0x3c')){var _0x32debf={};_0x32debf[_0x20c5a8[_0xc87b('0x25')]]={'$like':'%'+_0x166322[_0xc87b('0x31')][_0xc87b('0x3a')]+'%'};return _0x32debf;}})});}_0x46c869=_[_0xc87b('0x3b')]({},_0x46c869,_0x166322[_0xc87b('0x3d')]);var _0xd00816={'where':_0x46c869[_0xc87b('0x37')]};return db[_0xc87b('0x29')]['count'](_0xd00816)['then'](function(_0x14fbb5){_0x3382b5[_0xc87b('0x1d')]=_0x14fbb5;if(_0x166322[_0xc87b('0x31')][_0xc87b('0x3e')]){_0x46c869[_0xc87b('0x3f')]=[{'all':!![]}];}return db[_0xc87b('0x29')][_0xc87b('0x40')](_0x46c869);})[_0xc87b('0x22')](function(_0x21f512){_0x3382b5[_0xc87b('0x41')]=_0x21f512;return _0x3382b5;})[_0xc87b('0x22')](respondWithFilteredResult(_0x108107,_0x46c869))[_0xc87b('0x42')](handleError(_0x108107,null));};exports[_0xc87b('0x43')]=function(_0x388d63,_0x1104c9){var _0x3146b9={'raw':!![],'where':{'id':_0x388d63[_0xc87b('0x44')]['id']}},_0x4e477e={};_0x4e477e['model']=_[_0xc87b('0x2f')](db[_0xc87b('0x29')][_0xc87b('0x2a')]);_0x4e477e[_0xc87b('0x31')]=_['keys'](_0x388d63[_0xc87b('0x31')]);_0x4e477e[_0xc87b('0x38')]=_['intersection'](_0x4e477e[_0xc87b('0x2e')],_0x4e477e[_0xc87b('0x31')]);_0x3146b9[_0xc87b('0x32')]=_[_0xc87b('0x30')](_0x4e477e[_0xc87b('0x2e')],qs[_0xc87b('0x33')](_0x388d63[_0xc87b('0x31')][_0xc87b('0x33')]));_0x3146b9['attributes']=_0x3146b9[_0xc87b('0x32')][_0xc87b('0x45')]?_0x3146b9[_0xc87b('0x32')]:_0x4e477e[_0xc87b('0x2e')];if(_0x388d63[_0xc87b('0x31')]['includeAll']){_0x3146b9[_0xc87b('0x3f')]=[{'all':!![]}];}_0x3146b9=_['merge']({},_0x3146b9,_0x388d63[_0xc87b('0x3d')]);return db[_0xc87b('0x29')][_0xc87b('0x46')](_0x3146b9)['then'](handleEntityNotFound(_0x1104c9,null))[_0xc87b('0x22')](respondWithResult(_0x1104c9,null))['catch'](handleError(_0x1104c9,null));};exports[_0xc87b('0x47')]=function(_0x143565,_0x39a17b){return db[_0xc87b('0x29')][_0xc87b('0x47')](_0x143565['body'],{})['then'](respondWithResult(_0x39a17b,0xc9))[_0xc87b('0x42')](handleError(_0x39a17b,null));};exports[_0xc87b('0x48')]=function(_0x29bfc8,_0x4d979b){if(_0x29bfc8['body']['id']){delete _0x29bfc8[_0xc87b('0x49')]['id'];}return db[_0xc87b('0x29')]['find']({'where':{'id':_0x29bfc8['params']['id']}})[_0xc87b('0x22')](handleEntityNotFound(_0x4d979b,null))[_0xc87b('0x22')](saveUpdates(_0x29bfc8[_0xc87b('0x49')],null))[_0xc87b('0x22')](respondWithResult(_0x4d979b,null))[_0xc87b('0x42')](handleError(_0x4d979b,null));};exports['destroy']=function(_0x1f874d,_0x1cccc2){return db[_0xc87b('0x29')][_0xc87b('0x46')]({'where':{'id':_0x1f874d[_0xc87b('0x44')]['id']}})[_0xc87b('0x22')](handleEntityNotFound(_0x1cccc2,null))[_0xc87b('0x22')](removeEntity(_0x1cccc2,null))[_0xc87b('0x42')](handleError(_0x1cccc2,null));};exports['describe']=function(_0x20aea9,_0x54e99e){return db[_0xc87b('0x29')][_0xc87b('0x4a')]()['then'](respondWithResult(_0x54e99e,null))[_0xc87b('0x42')](handleError(_0x54e99e,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index af4cb71..08f2f7d 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 _0x262e=['path','../../config/environment','./squareReportDetail.attributes','exports','SquareDetailsReport','report_square_details','util','request-promise'];(function(_0x2ec5c3,_0x835a4f){var _0x367052=function(_0x81c406){while(--_0x81c406){_0x2ec5c3['push'](_0x2ec5c3['shift']());}};_0x367052(++_0x835a4f);}(_0x262e,0x19e));var _0xe262=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x262e[_0x138adb];return _0x1b27f2;};'use strict';var _=require('lodash');var util=require(_0xe262('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xe262('0x1'));var fs=require('fs');var path=require(_0xe262('0x2'));var rimraf=require('rimraf');var config=require(_0xe262('0x3'));var attributes=require(_0xe262('0x4'));module[_0xe262('0x5')]=function(_0x2af798,_0x32336e){return _0x2af798['define'](_0xe262('0x6'),attributes,{'tableName':_0xe262('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x88cc=['bluebird','request-promise','./squareReportDetail.attributes','define','SquareDetailsReport','report_square_details','lodash','util','../../config/logger','api','moment'];(function(_0x4d699d,_0x5c23bf){var _0x3029d5=function(_0x3aa64e){while(--_0x3aa64e){_0x4d699d['push'](_0x4d699d['shift']());}};_0x3029d5(++_0x5c23bf);}(_0x88cc,0xc1));var _0xc88c=function(_0x181dfe,_0xf84557){_0x181dfe=_0x181dfe-0x0;var _0x40c38f=_0x88cc[_0x181dfe];return _0x40c38f;};'use strict';var _=require(_0xc88c('0x0'));var util=require(_0xc88c('0x1'));var logger=require(_0xc88c('0x2'))(_0xc88c('0x3'));var moment=require(_0xc88c('0x4'));var BPromise=require(_0xc88c('0x5'));var rp=require(_0xc88c('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xc88c('0x7'));module['exports']=function(_0x30eef2,_0x4caf1c){return _0x30eef2[_0xc88c('0x8')](_0xc88c('0x9'),attributes,{'tableName':_0xc88c('0xa'),'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 ec1ec16..8d2f239 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 _0xd5fc=['SquareDetailsReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','info','result','catch','create','body','options','CreateSquareDetailsReport','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','then'];(function(_0x5317b5,_0x4dfd6e){var _0x3b7ce2=function(_0xc146d6){while(--_0xc146d6){_0x5317b5['push'](_0x5317b5['shift']());}};_0x3b7ce2(++_0x4dfd6e);}(_0xd5fc,0xae));var _0xcd5f=function(_0x23eaf7,_0x50e9cb){_0x23eaf7=_0x23eaf7-0x0;var _0x46dd9c=_0xd5fc[_0x23eaf7];return _0x46dd9c;};'use strict';var _=require(_0xcd5f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xcd5f('0x1'));var fs=require('fs');var Redis=require(_0xcd5f('0x2'));var db=require(_0xcd5f('0x3'))['db'];var utils=require(_0xcd5f('0x4'));var logger=require(_0xcd5f('0x5'))(_0xcd5f('0x6'));var config=require('../../config/environment');var jayson=require(_0xcd5f('0x7'));var client=jayson['client'][_0xcd5f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x159b3f,_0x5af696,_0x58d65d){return new BPromise(function(_0x4e668e,_0x102ce9){return client['request'](_0x159b3f,_0x58d65d)[_0xcd5f('0x9')](function(_0x3e63d4){logger['info'](_0xcd5f('0xa'),_0x5af696,'request\x20sent');logger[_0xcd5f('0xb')]('SquareDetailsReport,\x20%s,\x20%s,\x20%s',_0x5af696,_0xcd5f('0xc'),JSON[_0xcd5f('0xd')](_0x3e63d4));if(_0x3e63d4[_0xcd5f('0xe')]){if(_0x3e63d4[_0xcd5f('0xe')]['code']===0x1f4){logger[_0xcd5f('0xe')](_0xcd5f('0xa'),_0x5af696,_0x3e63d4['error'][_0xcd5f('0xf')]);return _0x102ce9(_0x3e63d4[_0xcd5f('0xe')][_0xcd5f('0xf')]);}logger[_0xcd5f('0xe')](_0xcd5f('0xa'),_0x5af696,_0x3e63d4['error'][_0xcd5f('0xf')]);return _0x4e668e(_0x3e63d4[_0xcd5f('0xe')][_0xcd5f('0xf')]);}else{logger[_0xcd5f('0x10')](_0xcd5f('0xa'),_0x5af696,_0xcd5f('0xc'));_0x4e668e(_0x3e63d4[_0xcd5f('0x11')]['message']);}})[_0xcd5f('0x12')](function(_0x33ab1a){logger[_0xcd5f('0xe')](_0xcd5f('0xa'),_0x5af696,_0x33ab1a);_0x102ce9(_0x33ab1a);});});}exports['CreateSquareDetailsReport']=function(_0x1a4cb6){var _0x56a874=this;return new Promise(function(_0xb23761,_0x36c60c){return db['SquareDetailsReport'][_0xcd5f('0x13')](_0x1a4cb6[_0xcd5f('0x14')],{'raw':_0x1a4cb6['options']?_0x1a4cb6[_0xcd5f('0x15')]['raw']===undefined?!![]:![]:!![]})[_0xcd5f('0x9')](function(_0x5c3c9f){logger['info'](_0xcd5f('0x16'),_0x1a4cb6);logger['debug']('CreateSquareDetailsReport',_0x1a4cb6,JSON['stringify'](_0x5c3c9f));_0xb23761(_0x5c3c9f);})[_0xcd5f('0x12')](function(_0x5c03b9){logger[_0xcd5f('0xe')](_0xcd5f('0x16'),_0x5c03b9[_0xcd5f('0xf')],_0x1a4cb6);_0x36c60c(_0x56a874[_0xcd5f('0xe')](0x1f4,_0x5c03b9[_0xcd5f('0xf')]));});});}; \ No newline at end of file +var _0x49f8=['SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateSquareDetailsReport','SquareDetailsReport','body','options','then','stringify','lodash','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','client','http','info'];(function(_0x3c4087,_0x5c764b){var _0x23ad1f=function(_0x39bf1c){while(--_0x39bf1c){_0x3c4087['push'](_0x3c4087['shift']());}};_0x23ad1f(++_0x5c764b);}(_0x49f8,0xff));var _0x849f=function(_0x487933,_0x77076d){_0x487933=_0x487933-0x0;var _0x741518=_0x49f8[_0x487933];return _0x741518;};'use strict';var _=require(_0x849f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x849f('0x1'));var rs=require(_0x849f('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x849f('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x849f('0x4'))('rpc');var config=require(_0x849f('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x849f('0x6')][_0x849f('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x21f577,_0xb4c798,_0x33b630){return new BPromise(function(_0xc6443e,_0x565438){return client['request'](_0x21f577,_0x33b630)['then'](function(_0x306c11){logger[_0x849f('0x8')](_0x849f('0x9'),_0xb4c798,_0x849f('0xa'));logger[_0x849f('0xb')](_0x849f('0xc'),_0xb4c798,_0x849f('0xa'),JSON['stringify'](_0x306c11));if(_0x306c11[_0x849f('0xd')]){if(_0x306c11['error'][_0x849f('0xe')]===0x1f4){logger[_0x849f('0xd')](_0x849f('0x9'),_0xb4c798,_0x306c11[_0x849f('0xd')]['message']);return _0x565438(_0x306c11[_0x849f('0xd')][_0x849f('0xf')]);}logger[_0x849f('0xd')](_0x849f('0x9'),_0xb4c798,_0x306c11[_0x849f('0xd')]['message']);return _0xc6443e(_0x306c11['error'][_0x849f('0xf')]);}else{logger['info'](_0x849f('0x9'),_0xb4c798,_0x849f('0xa'));_0xc6443e(_0x306c11[_0x849f('0x10')][_0x849f('0xf')]);}})[_0x849f('0x11')](function(_0x19ba28){logger[_0x849f('0xd')]('SquareDetailsReport,\x20%s,\x20%s',_0xb4c798,_0x19ba28);_0x565438(_0x19ba28);});});}exports[_0x849f('0x12')]=function(_0x20bea7){var _0x189529=this;return new Promise(function(_0x541cd6,_0x1e4017){return db[_0x849f('0x13')]['create'](_0x20bea7[_0x849f('0x14')],{'raw':_0x20bea7[_0x849f('0x15')]?_0x20bea7['options']['raw']===undefined?!![]:![]:!![]})[_0x849f('0x16')](function(_0x11d183){logger[_0x849f('0x8')](_0x849f('0x12'),_0x20bea7);logger[_0x849f('0xb')](_0x849f('0x12'),_0x20bea7,JSON[_0x849f('0x17')](_0x11d183));_0x541cd6(_0x11d183);})[_0x849f('0x11')](function(_0x4b29f1){logger[_0x849f('0xd')](_0x849f('0x12'),_0x4b29f1[_0x849f('0xf')],_0x20bea7);_0x1e4017(_0x189529[_0x849f('0xd')](0x1f4,_0x4b29f1[_0x849f('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index 5fd8192..155e4a4 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 _0xe7d7=['isAuthenticated','/process/:pid/kill','exports','express','Router','../../components/auth/service','./system.controller','get'];(function(_0x11beab,_0x2100c4){var _0x182daf=function(_0x48ca51){while(--_0x48ca51){_0x11beab['push'](_0x11beab['shift']());}};_0x182daf(++_0x2100c4);}(_0xe7d7,0x17b));var _0x7e7d=function(_0x4d1597,_0x2987ed){_0x4d1597=_0x4d1597-0x0;var _0x3fc5ba=_0xe7d7[_0x4d1597];return _0x3fc5ba;};'use strict';var express=require(_0x7e7d('0x0'));var router=express[_0x7e7d('0x1')]();var auth=require(_0x7e7d('0x2'));var controller=require(_0x7e7d('0x3'));router[_0x7e7d('0x4')]('/',auth[_0x7e7d('0x5')](),controller['index']);router['get'](_0x7e7d('0x6'),auth[_0x7e7d('0x5')](),controller['killProcess']);module[_0x7e7d('0x7')]=router; \ No newline at end of file +var _0x075e=['../../components/auth/service','./system.controller','get','isAuthenticated','index','killProcess','exports','express'];(function(_0xf16b1,_0x33c637){var _0x26f94d=function(_0x5643d7){while(--_0x5643d7){_0xf16b1['push'](_0xf16b1['shift']());}};_0x26f94d(++_0x33c637);}(_0x075e,0xe7));var _0xe075=function(_0xf91383,_0x44a84a){_0xf91383=_0xf91383-0x0;var _0x26a6d5=_0x075e[_0xf91383];return _0x26a6d5;};'use strict';var express=require(_0xe075('0x0'));var router=express['Router']();var auth=require(_0xe075('0x1'));var controller=require(_0xe075('0x2'));router[_0xe075('0x3')]('/',auth[_0xe075('0x4')](),controller[_0xe075('0x5')]);router[_0xe075('0x3')]('/process/:pid/kill',auth['isAuthenticated'](),controller[_0xe075('0x6')]);module[_0xe075('0x7')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index 3f214b7..5849b61 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 _0xfaba=['status','send','index','getAllData','json','catch','killProcess','format','params','pid','then','split','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','child_process','exec','../../config/logger','api','util','bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name'];(function(_0x458eef,_0x551783){var _0x2fb384=function(_0x28465e){while(--_0x28465e){_0x458eef['push'](_0x458eef['shift']());}};_0x2fb384(++_0x551783);}(_0xfaba,0x102));var _0xafab=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfaba[_0x3dd15e];return _0x231fd0;};'use strict';var info=require(_0xafab('0x0'));var exec=require(_0xafab('0x1'))[_0xafab('0x2')];var logger=require(_0xafab('0x3'))(_0xafab('0x4'));var util=require(_0xafab('0x5'));var BPromise=require(_0xafab('0x6'));var _=require(_0xafab('0x7'));function handleError(_0x5d60cc,_0x5e4b45,_0x2f847){_0x5e4b45=_0x5e4b45||0x1f4;return function(_0x265084){logger[_0xafab('0x8')](_0xafab('0x9'),_0x2f847,_0x5e4b45,util[_0xafab('0xa')](_0x265084,{'showHidden':![],'depth':null}));delete _0x265084[_0xafab('0xb')];_0x5d60cc[_0xafab('0xc')](_0x5e4b45)[_0xafab('0xd')](_0x265084);};}exports[_0xafab('0xe')]=function(_0x26f348,_0x3622a9){return info[_0xafab('0xf')]()['then'](function(_0x476983){return _0x3622a9['status'](0xc8)[_0xafab('0x10')](_0x476983);})[_0xafab('0x11')](function(_0x1d219a){return _0x3622a9['status'](0x1f4)[_0xafab('0x10')](_0x1d219a);});};exports[_0xafab('0x12')]=function(_0x5103e0,_0x48989d){var _0x3bf6d8=['components/import/cm'];return new BPromise(function(_0x2db380,_0xb86170){return exec(util[_0xafab('0x13')]('ps\x20-p\x20%s\x20-ww\x20-o\x20args',_0x5103e0[_0xafab('0x14')][_0xafab('0x15')]),function(_0x434b7c,_0x551dbd,_0x588bce){if(_0x434b7c){return _0xb86170(_0x434b7c);}return _0x2db380(_0x551dbd);});})[_0xafab('0x16')](function(_0x409e59){var _0x14efbf=![];var _0x1f3f42=_0x409e59[_0xafab('0x17')](/\n/);for(var _0x1d5034=0x0,_0xdda691=_0x3bf6d8[_0xafab('0x18')];_0x1d5034<_0xdda691,_0x14efbf===![];_0x1d5034+=0x1){if(_0x409e59[_0xafab('0x19')](_0x3bf6d8[_0x1d5034])>=0x0){_0x14efbf=!![];}}if(!_0x14efbf){throw new Error(util[_0xafab('0x13')](_0xafab('0x1a'),_0x5103e0[_0xafab('0x14')][_0xafab('0x15')]));}process[_0xafab('0x1b')](_0x5103e0[_0xafab('0x14')][_0xafab('0x15')],_0xafab('0x1c'));return _0x48989d[_0xafab('0xc')](0xc8)[_0xafab('0x10')]({'message':util['format'](_0xafab('0x1d'),_0x5103e0[_0xafab('0x14')][_0xafab('0x15')])});})[_0xafab('0x11')](handleError(_0x48989d,null,_0xafab('0x12')));}; \ No newline at end of file +var _0x8df8=['bluebird','lodash','error','status','send','getAllData','json','catch','killProcess','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','pid','then','split','length','Process\x20with\x20pid\x20%s\x20not\x20found!','kill','params','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','child_process','exec','../../config/logger','api','util'];(function(_0x8e8ca7,_0x5a5e07){var _0x561381=function(_0x2f4bda){while(--_0x2f4bda){_0x8e8ca7['push'](_0x8e8ca7['shift']());}};_0x561381(++_0x5a5e07);}(_0x8df8,0x13e));var _0x88df=function(_0x28bcbc,_0x30ec21){_0x28bcbc=_0x28bcbc-0x0;var _0x3a814e=_0x8df8[_0x28bcbc];return _0x3a814e;};'use strict';var info=require(_0x88df('0x0'));var exec=require(_0x88df('0x1'))[_0x88df('0x2')];var logger=require(_0x88df('0x3'))(_0x88df('0x4'));var util=require(_0x88df('0x5'));var BPromise=require(_0x88df('0x6'));var _=require(_0x88df('0x7'));function handleError(_0x5c4312,_0x578a0f,_0x28b91e){_0x578a0f=_0x578a0f||0x1f4;return function(_0x3cf364){logger[_0x88df('0x8')]('<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s',_0x28b91e,_0x578a0f,util['inspect'](_0x3cf364,{'showHidden':![],'depth':null}));delete _0x3cf364['name'];_0x5c4312[_0x88df('0x9')](_0x578a0f)[_0x88df('0xa')](_0x3cf364);};}exports['index']=function(_0x1e53fe,_0x94315d){return info[_0x88df('0xb')]()['then'](function(_0x208182){return _0x94315d[_0x88df('0x9')](0xc8)[_0x88df('0xc')](_0x208182);})[_0x88df('0xd')](function(_0x1bf09a){return _0x94315d[_0x88df('0x9')](0x1f4)['json'](_0x1bf09a);});};exports[_0x88df('0xe')]=function(_0x327adc,_0x37fec1){var _0x177229=[_0x88df('0xf')];return new BPromise(function(_0x4aa028,_0x46d578){return exec(util[_0x88df('0x10')](_0x88df('0x11'),_0x327adc['params'][_0x88df('0x12')]),function(_0x96523b,_0x56ec97,_0x4caee6){if(_0x96523b){return _0x46d578(_0x96523b);}return _0x4aa028(_0x56ec97);});})[_0x88df('0x13')](function(_0x48a207){var _0x10e9e6=![];var _0x53cff3=_0x48a207[_0x88df('0x14')](/\n/);for(var _0x422e5a=0x0,_0x4bcfd2=_0x177229[_0x88df('0x15')];_0x422e5a<_0x4bcfd2,_0x10e9e6===![];_0x422e5a+=0x1){if(_0x48a207['indexOf'](_0x177229[_0x422e5a])>=0x0){_0x10e9e6=!![];}}if(!_0x10e9e6){throw new Error(util['format'](_0x88df('0x16'),_0x327adc['params'][_0x88df('0x12')]));}process[_0x88df('0x17')](_0x327adc[_0x88df('0x18')][_0x88df('0x12')],_0x88df('0x19'));return _0x37fec1['status'](0xc8)['json']({'message':util[_0x88df('0x10')](_0x88df('0x1a'),_0x327adc[_0x88df('0x18')][_0x88df('0x12')])});})[_0x88df('0xd')](handleError(_0x37fec1,null,'killProcess'));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index 3e54b40..efaabe4 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 _0x22fb=['./tag.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0xc70631,_0x2a3f9b){var _0x54be7f=function(_0x22485c){while(--_0x22485c){_0xc70631['push'](_0xc70631['shift']());}};_0x54be7f(++_0x2a3f9b);}(_0x22fb,0x192));var _0xb22f=function(_0x344143,_0x391cba){_0x344143=_0x344143-0x0;var _0x424d1a=_0x22fb[_0x344143];return _0x424d1a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xb22f('0x0'));var timeout=require('connect-timeout');var express=require(_0xb22f('0x1'));var router=express[_0xb22f('0x2')]();var fs_extra=require(_0xb22f('0x3'));var auth=require(_0xb22f('0x4'));var interaction=require(_0xb22f('0x5'));var config=require('../../config/environment');var controller=require(_0xb22f('0x6'));router[_0xb22f('0x7')]('/',auth[_0xb22f('0x8')](),controller[_0xb22f('0x9')]);router[_0xb22f('0x7')](_0xb22f('0xa'),auth['isAuthenticated'](),controller[_0xb22f('0xb')]);router[_0xb22f('0x7')](_0xb22f('0xc'),auth[_0xb22f('0x8')](),controller[_0xb22f('0xd')]);router[_0xb22f('0xe')]('/',auth[_0xb22f('0x8')](),controller[_0xb22f('0xf')]);router[_0xb22f('0x10')](_0xb22f('0xc'),auth[_0xb22f('0x8')](),controller['update']);router['delete']('/:id',auth[_0xb22f('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xe5b3=['../../config/environment','./tag.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(_0x3a9fb9,_0x36617a){var _0x180839=function(_0x271fd5){while(--_0x271fd5){_0x3a9fb9['push'](_0x3a9fb9['shift']());}};_0x180839(++_0x36617a);}(_0xe5b3,0x133));var _0x3e5b=function(_0x310e94,_0x129456){_0x310e94=_0x310e94-0x0;var _0x5aa359=_0xe5b3[_0x310e94];return _0x5aa359;};'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/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index 4b46a5d..9d5808d 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 _0xd1f1=['sequelize','exports','STRING','name'];(function(_0x599ad4,_0x4b2612){var _0x3a634c=function(_0x44b62d){while(--_0x44b62d){_0x599ad4['push'](_0x599ad4['shift']());}};_0x3a634c(++_0x4b2612);}(_0xd1f1,0x84));var _0x1d1f=function(_0x246a98,_0xdf59a8){_0x246a98=_0x246a98-0x0;var _0x3b8b79=_0xd1f1[_0x246a98];return _0x3b8b79;};'use strict';var Sequelize=require(_0x1d1f('0x0'));module[_0x1d1f('0x1')]={'name':{'type':Sequelize[_0x1d1f('0x2')],'unique':_0x1d1f('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x1d1f('0x2')],'defaultValue':'#0091EA'},'description':{'type':Sequelize[_0x1d1f('0x2')]}}; \ No newline at end of file +var _0x8f4c=['sequelize','exports','STRING','name','#0091EA'];(function(_0x422905,_0x3bce3a){var _0x33dc6c=function(_0x4852c9){while(--_0x4852c9){_0x422905['push'](_0x422905['shift']());}};_0x33dc6c(++_0x3bce3a);}(_0x8f4c,0x113));var _0xc8f4=function(_0x30d9b5,_0x39b36d){_0x30d9b5=_0x30d9b5-0x0;var _0x4429af=_0x8f4c[_0x30d9b5];return _0x4429af;};'use strict';var Sequelize=require(_0xc8f4('0x0'));module[_0xc8f4('0x1')]={'name':{'type':Sequelize[_0xc8f4('0x2')],'unique':_0xc8f4('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0xc8f4('0x2')],'defaultValue':_0xc8f4('0x4')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index 5a50255..b389838 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 _0xd056=['papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','UserProfileResource','error','stack','name','send','map','Tag','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','catch','show','params','include','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Tags','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv'];(function(_0x2abc78,_0x4f6b41){var _0x10e462=function(_0x136510){while(--_0x136510){_0x2abc78['push'](_0x2abc78['shift']());}};_0x10e462(++_0x4f6b41);}(_0xd056,0x13f));var _0x6d05=function(_0x588b55,_0x80d4c){_0x588b55=_0x588b55-0x0;var _0x54c685=_0xd056[_0x588b55];return _0x54c685;};'use strict';var emlformat=require(_0x6d05('0x0'));var rimraf=require(_0x6d05('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6d05('0x2'));var rp=require(_0x6d05('0x3'));var moment=require(_0x6d05('0x4'));var BPromise=require(_0x6d05('0x5'));var Mustache=require(_0x6d05('0x6'));var util=require(_0x6d05('0x7'));var path=require(_0x6d05('0x8'));var sox=require(_0x6d05('0x9'));var csv=require('to-csv');var ejs=require(_0x6d05('0xa'));var fs=require('fs');var fs_extra=require(_0x6d05('0xb'));var _=require(_0x6d05('0xc'));var squel=require('squel');var crypto=require(_0x6d05('0xd'));var jsforce=require(_0x6d05('0xe'));var deskjs=require(_0x6d05('0xf'));var toCsv=require(_0x6d05('0x10'));var querystring=require('querystring');var Papa=require(_0x6d05('0x11'));var Redis=require(_0x6d05('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x6d05('0x13'));var as=require(_0x6d05('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x6d05('0x15'));var config=require(_0x6d05('0x16'));var licenseUtil=require(_0x6d05('0x17'));var db=require(_0x6d05('0x18'))['db'];function respondWithStatusCode(_0x24f317,_0x17119c){_0x17119c=_0x17119c||0xcc;return function(_0x1c92c7){if(_0x1c92c7){return _0x24f317[_0x6d05('0x19')](_0x17119c);}return _0x24f317['status'](_0x17119c)[_0x6d05('0x1a')]();};}function respondWithResult(_0x5729bd,_0x35c5f6){_0x35c5f6=_0x35c5f6||0xc8;return function(_0x37c7e5){if(_0x37c7e5){return _0x5729bd[_0x6d05('0x1b')](_0x35c5f6)[_0x6d05('0x1c')](_0x37c7e5);}};}function respondWithFilteredResult(_0x2c92b4,_0xc2efd1){return function(_0x320634){if(_0x320634){var _0x4ee183=typeof _0xc2efd1[_0x6d05('0x1d')]===_0x6d05('0x1e')&&typeof _0xc2efd1[_0x6d05('0x1f')]===_0x6d05('0x1e');var _0x219db5=_0x320634[_0x6d05('0x20')];var _0x3e71c7=_0x4ee183?0x0:_0xc2efd1[_0x6d05('0x1d')];var _0x3eadfb=_0x4ee183?_0x320634[_0x6d05('0x20')]:_0xc2efd1['offset']+_0xc2efd1[_0x6d05('0x1f')];var _0x164b93;if(_0x3eadfb>=_0x219db5){_0x3eadfb=_0x219db5;_0x164b93=0xc8;}else{_0x164b93=0xce;}_0x2c92b4[_0x6d05('0x1b')](_0x164b93);return _0x2c92b4[_0x6d05('0x21')](_0x6d05('0x22'),_0x3e71c7+'-'+_0x3eadfb+'/'+_0x219db5)[_0x6d05('0x1c')](_0x320634);}return null;};}function patchUpdates(_0x18f3e9){return function(_0x2b6f4b){try{jsonpatch[_0x6d05('0x23')](_0x2b6f4b,_0x18f3e9,!![]);}catch(_0x5327c6){return BPromise[_0x6d05('0x24')](_0x5327c6);}return _0x2b6f4b[_0x6d05('0x25')]();};}function saveUpdates(_0xe1d6fc,_0x219092){return function(_0x5a87b7){if(_0x5a87b7){return _0x5a87b7[_0x6d05('0x26')](_0xe1d6fc)['then'](function(_0x3f2829){return _0x3f2829;});}return null;};}function removeEntity(_0x55fc6d,_0x17944d){return function(_0x471d3d){if(_0x471d3d){return _0x471d3d[_0x6d05('0x27')]()[_0x6d05('0x28')](function(){var _0x34bb77=_0x471d3d['get']({'plain':!![]});var _0x57a8d1='Tags';return db[_0x6d05('0x29')]['destroy']({'where':{'type':_0x57a8d1,'resourceId':_0x34bb77['id']}})[_0x6d05('0x28')](function(){return _0x471d3d;});})[_0x6d05('0x28')](function(){_0x55fc6d['status'](0xcc)[_0x6d05('0x1a')]();});}};}function handleEntityNotFound(_0x59df33,_0xe7e1f9){return function(_0x546c8e){if(!_0x546c8e){_0x59df33[_0x6d05('0x19')](0x194);}return _0x546c8e;};}function handleError(_0x578287,_0x4e1dcc){_0x4e1dcc=_0x4e1dcc||0x1f4;return function(_0x94dad5){logger[_0x6d05('0x2a')](_0x94dad5[_0x6d05('0x2b')]);if(_0x94dad5[_0x6d05('0x2c')]){delete _0x94dad5[_0x6d05('0x2c')];}_0x578287['status'](_0x4e1dcc)[_0x6d05('0x2d')](_0x94dad5);};}exports['index']=function(_0x514a5c,_0x41e9fc){var _0x499006={},_0x56a0c={},_0xdb074f={'count':0x0,'rows':[]};var _0x39870b=_[_0x6d05('0x2e')](db[_0x6d05('0x2f')][_0x6d05('0x30')],function(_0x5198a7){return{'name':_0x5198a7[_0x6d05('0x31')],'type':_0x5198a7[_0x6d05('0x32')][_0x6d05('0x33')]};});_0x56a0c['model']=_[_0x6d05('0x2e')](_0x39870b,_0x6d05('0x2c'));_0x56a0c['query']=_[_0x6d05('0x34')](_0x514a5c[_0x6d05('0x35')]);_0x56a0c[_0x6d05('0x36')]=_[_0x6d05('0x37')](_0x56a0c[_0x6d05('0x38')],_0x56a0c[_0x6d05('0x35')]);_0x499006[_0x6d05('0x39')]=_[_0x6d05('0x37')](_0x56a0c[_0x6d05('0x38')],qs[_0x6d05('0x3a')](_0x514a5c[_0x6d05('0x35')][_0x6d05('0x3a')]));_0x499006['attributes']=_0x499006[_0x6d05('0x39')][_0x6d05('0x3b')]?_0x499006[_0x6d05('0x39')]:_0x56a0c['model'];if(!_0x514a5c['query']['hasOwnProperty'](_0x6d05('0x3c'))){_0x499006[_0x6d05('0x1f')]=qs[_0x6d05('0x1f')](_0x514a5c[_0x6d05('0x35')][_0x6d05('0x1f')]);_0x499006[_0x6d05('0x1d')]=qs['offset'](_0x514a5c[_0x6d05('0x35')]['offset']);}_0x499006['order']=qs['sort'](_0x514a5c[_0x6d05('0x35')][_0x6d05('0x3d')]);_0x499006[_0x6d05('0x3e')]=qs[_0x6d05('0x36')](_[_0x6d05('0x3f')](_0x514a5c['query'],_0x56a0c['filters']),_0x39870b);if(_0x514a5c['query'][_0x6d05('0x40')]){_0x499006[_0x6d05('0x3e')]=_[_0x6d05('0x41')](_0x499006[_0x6d05('0x3e')],{'$or':_[_0x6d05('0x2e')](_0x39870b,function(_0xf09d0e){if(_0xf09d0e[_0x6d05('0x32')]!==_0x6d05('0x42')){var _0x455cea={};_0x455cea[_0xf09d0e[_0x6d05('0x2c')]]={'$like':'%'+_0x514a5c['query'][_0x6d05('0x40')]+'%'};return _0x455cea;}})});}_0x499006=_[_0x6d05('0x41')]({},_0x499006,_0x514a5c['options']);var _0x5b7fb9={'where':_0x499006[_0x6d05('0x3e')]};return db[_0x6d05('0x2f')][_0x6d05('0x20')](_0x5b7fb9)[_0x6d05('0x28')](function(_0x483edd){_0xdb074f['count']=_0x483edd;if(_0x514a5c['query'][_0x6d05('0x43')]){_0x499006['include']=[{'all':!![]}];}return db[_0x6d05('0x2f')][_0x6d05('0x44')](_0x499006);})['then'](function(_0x4e19bf){_0xdb074f['rows']=_0x4e19bf;return _0xdb074f;})[_0x6d05('0x28')](respondWithFilteredResult(_0x41e9fc,_0x499006))[_0x6d05('0x45')](handleError(_0x41e9fc,null));};exports[_0x6d05('0x46')]=function(_0x527daa,_0x3613a5){var _0x16edb3={'raw':!![],'where':{'id':_0x527daa[_0x6d05('0x47')]['id']}},_0x4c825f={};_0x4c825f[_0x6d05('0x38')]=_[_0x6d05('0x34')](db['Tag']['rawAttributes']);_0x4c825f['query']=_[_0x6d05('0x34')](_0x527daa['query']);_0x4c825f[_0x6d05('0x36')]=_[_0x6d05('0x37')](_0x4c825f[_0x6d05('0x38')],_0x4c825f[_0x6d05('0x35')]);_0x16edb3['attributes']=_['intersection'](_0x4c825f[_0x6d05('0x38')],qs[_0x6d05('0x3a')](_0x527daa[_0x6d05('0x35')][_0x6d05('0x3a')]));_0x16edb3[_0x6d05('0x39')]=_0x16edb3[_0x6d05('0x39')][_0x6d05('0x3b')]?_0x16edb3['attributes']:_0x4c825f['model'];if(_0x527daa[_0x6d05('0x35')][_0x6d05('0x43')]){_0x16edb3[_0x6d05('0x48')]=[{'all':!![]}];}_0x16edb3=_[_0x6d05('0x41')]({},_0x16edb3,_0x527daa[_0x6d05('0x49')]);return db[_0x6d05('0x2f')][_0x6d05('0x4a')](_0x16edb3)['then'](handleEntityNotFound(_0x3613a5,null))['then'](respondWithResult(_0x3613a5,null))['catch'](handleError(_0x3613a5,null));};exports[_0x6d05('0x4b')]=function(_0x11db73,_0xc1f2cd){return db[_0x6d05('0x2f')][_0x6d05('0x4b')](_0x11db73[_0x6d05('0x4c')],{})['then'](function(_0x4443d8){var _0x4a28a1=_0x11db73[_0x6d05('0x4d')]['get']({'plain':!![]});if(!_0x4a28a1)throw new Error(_0x6d05('0x4e'));if(_0x4a28a1['role']===_0x6d05('0x4d')){var _0x3eeff2=_0x4443d8['get']({'plain':!![]});var _0x1ac130=_0x6d05('0x4f');return db[_0x6d05('0x50')][_0x6d05('0x4a')]({'where':{'name':_0x1ac130,'userProfileId':_0x4a28a1['userProfileId']},'raw':!![]})[_0x6d05('0x28')](function(_0x28db8c){if(_0x28db8c&&_0x28db8c[_0x6d05('0x51')]===0x0){return db[_0x6d05('0x29')]['create']({'name':_0x3eeff2['name'],'resourceId':_0x3eeff2['id'],'type':_0x28db8c[_0x6d05('0x2c')],'sectionId':_0x28db8c['id']},{})[_0x6d05('0x28')](function(){return _0x4443d8;});}else{return _0x4443d8;}})[_0x6d05('0x45')](function(_0x3640ab){logger['error'](_0x6d05('0x52'),_0x3640ab);throw _0x3640ab;});}return _0x4443d8;})[_0x6d05('0x28')](respondWithResult(_0xc1f2cd,0xc9))[_0x6d05('0x45')](handleError(_0xc1f2cd,null));};exports[_0x6d05('0x26')]=function(_0x846e68,_0x164697){if(_0x846e68['body']['id']){delete _0x846e68[_0x6d05('0x4c')]['id'];}return db[_0x6d05('0x2f')][_0x6d05('0x4a')]({'where':{'id':_0x846e68[_0x6d05('0x47')]['id']}})[_0x6d05('0x28')](handleEntityNotFound(_0x164697,null))[_0x6d05('0x28')](saveUpdates(_0x846e68['body'],null))['then'](respondWithResult(_0x164697,null))['catch'](handleError(_0x164697,null));};exports['destroy']=function(_0x98ab52,_0x4ec2ea){return db[_0x6d05('0x2f')]['find']({'where':{'id':_0x98ab52[_0x6d05('0x47')]['id']}})[_0x6d05('0x28')](handleEntityNotFound(_0x4ec2ea,null))['then'](removeEntity(_0x4ec2ea,null))[_0x6d05('0x45')](handleError(_0x4ec2ea,null));};exports[_0x6d05('0x53')]=function(_0x5391c6,_0x8b2054){return db[_0x6d05('0x2f')]['describe']()[_0x6d05('0x28')](respondWithResult(_0x8b2054,null))['catch'](handleError(_0x8b2054,null));}; \ No newline at end of file +var _0x6e5f=['Tag','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','merge','options','include','catch','show','params','includeAll','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Tags','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','apply','reject','save','update','then','destroy','UserProfileResource','stack','name','send','index','map'];(function(_0x4a26b4,_0x3d9906){var _0x233eeb=function(_0xbe7581){while(--_0xbe7581){_0x4a26b4['push'](_0x4a26b4['shift']());}};_0x233eeb(++_0x3d9906);}(_0x6e5f,0x17f));var _0xf6e5=function(_0x467b60,_0x306acf){_0x467b60=_0x467b60-0x0;var _0x180832=_0x6e5f[_0x467b60];return _0x180832;};'use strict';var emlformat=require(_0xf6e5('0x0'));var rimraf=require(_0xf6e5('0x1'));var zipdir=require(_0xf6e5('0x2'));var jsonpatch=require(_0xf6e5('0x3'));var rp=require(_0xf6e5('0x4'));var moment=require(_0xf6e5('0x5'));var BPromise=require(_0xf6e5('0x6'));var Mustache=require(_0xf6e5('0x7'));var util=require(_0xf6e5('0x8'));var path=require('path');var sox=require(_0xf6e5('0x9'));var csv=require(_0xf6e5('0xa'));var ejs=require(_0xf6e5('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xf6e5('0xc'));var crypto=require(_0xf6e5('0xd'));var jsforce=require(_0xf6e5('0xe'));var deskjs=require(_0xf6e5('0xf'));var toCsv=require(_0xf6e5('0xa'));var querystring=require(_0xf6e5('0x10'));var Papa=require(_0xf6e5('0x11'));var Redis=require(_0xf6e5('0x12'));var authService=require(_0xf6e5('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf6e5('0x14'));var logger=require(_0xf6e5('0x15'))(_0xf6e5('0x16'));var utils=require(_0xf6e5('0x17'));var config=require(_0xf6e5('0x18'));var licenseUtil=require(_0xf6e5('0x19'));var db=require(_0xf6e5('0x1a'))['db'];function respondWithStatusCode(_0xf546fd,_0x147d2d){_0x147d2d=_0x147d2d||0xcc;return function(_0x37a562){if(_0x37a562){return _0xf546fd[_0xf6e5('0x1b')](_0x147d2d);}return _0xf546fd[_0xf6e5('0x1c')](_0x147d2d)['end']();};}function respondWithResult(_0x2cef98,_0x5d5133){_0x5d5133=_0x5d5133||0xc8;return function(_0x2ea690){if(_0x2ea690){return _0x2cef98[_0xf6e5('0x1c')](_0x5d5133)[_0xf6e5('0x1d')](_0x2ea690);}};}function respondWithFilteredResult(_0xe8dbc9,_0x1a1a0c){return function(_0x411751){if(_0x411751){var _0x5d25ae=typeof _0x1a1a0c['offset']===_0xf6e5('0x1e')&&typeof _0x1a1a0c['limit']===_0xf6e5('0x1e');var _0x38a2cb=_0x411751[_0xf6e5('0x1f')];var _0x13cdb9=_0x5d25ae?0x0:_0x1a1a0c[_0xf6e5('0x20')];var _0x47f5c2=_0x5d25ae?_0x411751[_0xf6e5('0x1f')]:_0x1a1a0c['offset']+_0x1a1a0c[_0xf6e5('0x21')];var _0x292ea0;if(_0x47f5c2>=_0x38a2cb){_0x47f5c2=_0x38a2cb;_0x292ea0=0xc8;}else{_0x292ea0=0xce;}_0xe8dbc9[_0xf6e5('0x1c')](_0x292ea0);return _0xe8dbc9[_0xf6e5('0x22')]('Content-Range',_0x13cdb9+'-'+_0x47f5c2+'/'+_0x38a2cb)[_0xf6e5('0x1d')](_0x411751);}return null;};}function patchUpdates(_0x17ad15){return function(_0x433238){try{jsonpatch[_0xf6e5('0x23')](_0x433238,_0x17ad15,!![]);}catch(_0x2d5f6e){return BPromise[_0xf6e5('0x24')](_0x2d5f6e);}return _0x433238[_0xf6e5('0x25')]();};}function saveUpdates(_0x10abc7,_0x3503f5){return function(_0x3599ea){if(_0x3599ea){return _0x3599ea[_0xf6e5('0x26')](_0x10abc7)[_0xf6e5('0x27')](function(_0x2b1f3e){return _0x2b1f3e;});}return null;};}function removeEntity(_0x2e3540,_0x3ab350){return function(_0x17fe79){if(_0x17fe79){return _0x17fe79[_0xf6e5('0x28')]()[_0xf6e5('0x27')](function(){var _0x4f7a64=_0x17fe79['get']({'plain':!![]});var _0x51a3d0='Tags';return db[_0xf6e5('0x29')][_0xf6e5('0x28')]({'where':{'type':_0x51a3d0,'resourceId':_0x4f7a64['id']}})[_0xf6e5('0x27')](function(){return _0x17fe79;});})[_0xf6e5('0x27')](function(){_0x2e3540['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x501751,_0x2057a4){return function(_0x355216){if(!_0x355216){_0x501751[_0xf6e5('0x1b')](0x194);}return _0x355216;};}function handleError(_0x1af67f,_0x41c39b){_0x41c39b=_0x41c39b||0x1f4;return function(_0x462b9a){logger['error'](_0x462b9a[_0xf6e5('0x2a')]);if(_0x462b9a[_0xf6e5('0x2b')]){delete _0x462b9a['name'];}_0x1af67f[_0xf6e5('0x1c')](_0x41c39b)[_0xf6e5('0x2c')](_0x462b9a);};}exports[_0xf6e5('0x2d')]=function(_0x37ffa1,_0x2bc97d){var _0x5e927c={},_0x395916={},_0x2c1418={'count':0x0,'rows':[]};var _0xda16c4=_[_0xf6e5('0x2e')](db[_0xf6e5('0x2f')][_0xf6e5('0x30')],function(_0x8a9cd0){return{'name':_0x8a9cd0[_0xf6e5('0x31')],'type':_0x8a9cd0[_0xf6e5('0x32')]['key']};});_0x395916[_0xf6e5('0x33')]=_[_0xf6e5('0x2e')](_0xda16c4,'name');_0x395916[_0xf6e5('0x34')]=_[_0xf6e5('0x35')](_0x37ffa1['query']);_0x395916[_0xf6e5('0x36')]=_['intersection'](_0x395916['model'],_0x395916[_0xf6e5('0x34')]);_0x5e927c[_0xf6e5('0x37')]=_[_0xf6e5('0x38')](_0x395916['model'],qs[_0xf6e5('0x39')](_0x37ffa1['query'][_0xf6e5('0x39')]));_0x5e927c[_0xf6e5('0x37')]=_0x5e927c[_0xf6e5('0x37')][_0xf6e5('0x3a')]?_0x5e927c[_0xf6e5('0x37')]:_0x395916[_0xf6e5('0x33')];if(!_0x37ffa1['query'][_0xf6e5('0x3b')](_0xf6e5('0x3c'))){_0x5e927c[_0xf6e5('0x21')]=qs[_0xf6e5('0x21')](_0x37ffa1[_0xf6e5('0x34')][_0xf6e5('0x21')]);_0x5e927c[_0xf6e5('0x20')]=qs[_0xf6e5('0x20')](_0x37ffa1[_0xf6e5('0x34')]['offset']);}_0x5e927c[_0xf6e5('0x3d')]=qs[_0xf6e5('0x3e')](_0x37ffa1[_0xf6e5('0x34')][_0xf6e5('0x3e')]);_0x5e927c[_0xf6e5('0x3f')]=qs[_0xf6e5('0x36')](_[_0xf6e5('0x40')](_0x37ffa1[_0xf6e5('0x34')],_0x395916[_0xf6e5('0x36')]),_0xda16c4);if(_0x37ffa1[_0xf6e5('0x34')]['filter']){_0x5e927c[_0xf6e5('0x3f')]=_['merge'](_0x5e927c[_0xf6e5('0x3f')],{'$or':_[_0xf6e5('0x2e')](_0xda16c4,function(_0x443588){if(_0x443588[_0xf6e5('0x32')]!==_0xf6e5('0x41')){var _0x12b15c={};_0x12b15c[_0x443588[_0xf6e5('0x2b')]]={'$like':'%'+_0x37ffa1['query']['filter']+'%'};return _0x12b15c;}})});}_0x5e927c=_[_0xf6e5('0x42')]({},_0x5e927c,_0x37ffa1[_0xf6e5('0x43')]);var _0x342e2e={'where':_0x5e927c[_0xf6e5('0x3f')]};return db[_0xf6e5('0x2f')][_0xf6e5('0x1f')](_0x342e2e)[_0xf6e5('0x27')](function(_0x3bed4f){_0x2c1418['count']=_0x3bed4f;if(_0x37ffa1[_0xf6e5('0x34')]['includeAll']){_0x5e927c[_0xf6e5('0x44')]=[{'all':!![]}];}return db['Tag']['findAll'](_0x5e927c);})[_0xf6e5('0x27')](function(_0x17b09d){_0x2c1418['rows']=_0x17b09d;return _0x2c1418;})[_0xf6e5('0x27')](respondWithFilteredResult(_0x2bc97d,_0x5e927c))[_0xf6e5('0x45')](handleError(_0x2bc97d,null));};exports[_0xf6e5('0x46')]=function(_0x44bfb,_0x326db0){var _0x25f0ad={'raw':!![],'where':{'id':_0x44bfb[_0xf6e5('0x47')]['id']}},_0x987764={};_0x987764[_0xf6e5('0x33')]=_['keys'](db[_0xf6e5('0x2f')][_0xf6e5('0x30')]);_0x987764[_0xf6e5('0x34')]=_[_0xf6e5('0x35')](_0x44bfb[_0xf6e5('0x34')]);_0x987764['filters']=_[_0xf6e5('0x38')](_0x987764['model'],_0x987764[_0xf6e5('0x34')]);_0x25f0ad[_0xf6e5('0x37')]=_[_0xf6e5('0x38')](_0x987764[_0xf6e5('0x33')],qs[_0xf6e5('0x39')](_0x44bfb[_0xf6e5('0x34')][_0xf6e5('0x39')]));_0x25f0ad['attributes']=_0x25f0ad[_0xf6e5('0x37')]['length']?_0x25f0ad[_0xf6e5('0x37')]:_0x987764['model'];if(_0x44bfb[_0xf6e5('0x34')][_0xf6e5('0x48')]){_0x25f0ad[_0xf6e5('0x44')]=[{'all':!![]}];}_0x25f0ad=_[_0xf6e5('0x42')]({},_0x25f0ad,_0x44bfb[_0xf6e5('0x43')]);return db['Tag'][_0xf6e5('0x49')](_0x25f0ad)[_0xf6e5('0x27')](handleEntityNotFound(_0x326db0,null))[_0xf6e5('0x27')](respondWithResult(_0x326db0,null))[_0xf6e5('0x45')](handleError(_0x326db0,null));};exports[_0xf6e5('0x4a')]=function(_0x15449e,_0xd8952){return db[_0xf6e5('0x2f')][_0xf6e5('0x4a')](_0x15449e['body'],{})[_0xf6e5('0x27')](function(_0x29a4c3){var _0x40d4ad=_0x15449e[_0xf6e5('0x4b')][_0xf6e5('0x4c')]({'plain':!![]});if(!_0x40d4ad)throw new Error(_0xf6e5('0x4d'));if(_0x40d4ad[_0xf6e5('0x4e')]===_0xf6e5('0x4b')){var _0x131259=_0x29a4c3[_0xf6e5('0x4c')]({'plain':!![]});var _0x5563af=_0xf6e5('0x4f');return db[_0xf6e5('0x50')][_0xf6e5('0x49')]({'where':{'name':_0x5563af,'userProfileId':_0x40d4ad[_0xf6e5('0x51')]},'raw':!![]})['then'](function(_0x296c64){if(_0x296c64&&_0x296c64[_0xf6e5('0x52')]===0x0){return db[_0xf6e5('0x29')][_0xf6e5('0x4a')]({'name':_0x131259[_0xf6e5('0x2b')],'resourceId':_0x131259['id'],'type':_0x296c64[_0xf6e5('0x2b')],'sectionId':_0x296c64['id']},{})[_0xf6e5('0x27')](function(){return _0x29a4c3;});}else{return _0x29a4c3;}})[_0xf6e5('0x45')](function(_0x1954c5){logger[_0xf6e5('0x53')](_0xf6e5('0x54'),_0x1954c5);throw _0x1954c5;});}return _0x29a4c3;})[_0xf6e5('0x27')](respondWithResult(_0xd8952,0xc9))[_0xf6e5('0x45')](handleError(_0xd8952,null));};exports[_0xf6e5('0x26')]=function(_0x2e0060,_0x379123){if(_0x2e0060[_0xf6e5('0x55')]['id']){delete _0x2e0060[_0xf6e5('0x55')]['id'];}return db[_0xf6e5('0x2f')][_0xf6e5('0x49')]({'where':{'id':_0x2e0060[_0xf6e5('0x47')]['id']}})[_0xf6e5('0x27')](handleEntityNotFound(_0x379123,null))[_0xf6e5('0x27')](saveUpdates(_0x2e0060[_0xf6e5('0x55')],null))['then'](respondWithResult(_0x379123,null))['catch'](handleError(_0x379123,null));};exports['destroy']=function(_0x4187e9,_0x3285e5){return db['Tag'][_0xf6e5('0x49')]({'where':{'id':_0x4187e9[_0xf6e5('0x47')]['id']}})['then'](handleEntityNotFound(_0x3285e5,null))[_0xf6e5('0x27')](removeEntity(_0x3285e5,null))[_0xf6e5('0x45')](handleError(_0x3285e5,null));};exports['describe']=function(_0x5d19f0,_0x573266){return db['Tag']['describe']()[_0xf6e5('0x27')](respondWithResult(_0x573266,null))['catch'](handleError(_0x573266,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index e4773cb..cc1640b 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 _0xf350=['rimraf','exports','define','Tag','tools_tags','lodash','util','api','moment','bluebird','request-promise'];(function(_0x24fd53,_0x281a15){var _0x5dc7ed=function(_0x4f9e15){while(--_0x4f9e15){_0x24fd53['push'](_0x24fd53['shift']());}};_0x5dc7ed(++_0x281a15);}(_0xf350,0x1e9));var _0x0f35=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xf350[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x0f35('0x0'));var util=require(_0x0f35('0x1'));var logger=require('../../config/logger')(_0x0f35('0x2'));var moment=require(_0x0f35('0x3'));var BPromise=require(_0x0f35('0x4'));var rp=require(_0x0f35('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0f35('0x6'));var config=require('../../config/environment');var attributes=require('./tag.attributes');module[_0x0f35('0x7')]=function(_0x51ed13,_0x3753e7){return _0x51ed13[_0x0f35('0x8')](_0x0f35('0x9'),attributes,{'tableName':_0x0f35('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1cd6=['bluebird','request-promise','path','rimraf','../../config/environment','./tag.attributes','exports','define','Tag','tools_tags','lodash','../../config/logger','moment'];(function(_0x233c9a,_0x173748){var _0x68211c=function(_0x31f15a){while(--_0x31f15a){_0x233c9a['push'](_0x233c9a['shift']());}};_0x68211c(++_0x173748);}(_0x1cd6,0x1eb));var _0x61cd=function(_0x4cebe6,_0x425af2){_0x4cebe6=_0x4cebe6-0x0;var _0x4113a3=_0x1cd6[_0x4cebe6];return _0x4113a3;};'use strict';var _=require(_0x61cd('0x0'));var util=require('util');var logger=require(_0x61cd('0x1'))('api');var moment=require(_0x61cd('0x2'));var BPromise=require(_0x61cd('0x3'));var rp=require(_0x61cd('0x4'));var fs=require('fs');var path=require(_0x61cd('0x5'));var rimraf=require(_0x61cd('0x6'));var config=require(_0x61cd('0x7'));var attributes=require(_0x61cd('0x8'));module[_0x61cd('0x9')]=function(_0x6d6010,_0x3decfd){return _0x6d6010[_0x61cd('0xa')](_0x61cd('0xb'),attributes,{'tableName':_0x61cd('0xc'),'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 cc08d05..18d3caa 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 _0x6aa7=['result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','request','then','info','Tag,\x20%s,\x20%s','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x274cc2,_0xed72ce){var _0x201e34=function(_0x5a281a){while(--_0x5a281a){_0x274cc2['push'](_0x274cc2['shift']());}};_0x201e34(++_0xed72ce);}(_0x6aa7,0x178));var _0x76aa=function(_0x3b95df,_0x3ba3a0){_0x3b95df=_0x3b95df-0x0;var _0x59b22a=_0x6aa7[_0x3b95df];return _0x59b22a;};'use strict';var _=require(_0x76aa('0x0'));var util=require('util');var moment=require(_0x76aa('0x1'));var BPromise=require(_0x76aa('0x2'));var rs=require(_0x76aa('0x3'));var fs=require('fs');var Redis=require(_0x76aa('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x76aa('0x5'));var logger=require(_0x76aa('0x6'))(_0x76aa('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x76aa('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x32dee5,_0x36d12b,_0xa9b695){return new BPromise(function(_0x56d6bc,_0x3dae33){return client[_0x76aa('0x9')](_0x32dee5,_0xa9b695)[_0x76aa('0xa')](function(_0x557d69){logger[_0x76aa('0xb')](_0x76aa('0xc'),_0x36d12b,_0x76aa('0xd'));logger[_0x76aa('0xe')](_0x76aa('0xf'),_0x36d12b,_0x76aa('0xd'),JSON[_0x76aa('0x10')](_0x557d69));if(_0x557d69[_0x76aa('0x11')]){if(_0x557d69[_0x76aa('0x11')][_0x76aa('0x12')]===0x1f4){logger['error'](_0x76aa('0xc'),_0x36d12b,_0x557d69['error'][_0x76aa('0x13')]);return _0x3dae33(_0x557d69[_0x76aa('0x11')][_0x76aa('0x13')]);}logger[_0x76aa('0x11')](_0x76aa('0xc'),_0x36d12b,_0x557d69['error']['message']);return _0x56d6bc(_0x557d69[_0x76aa('0x11')]['message']);}else{logger[_0x76aa('0xb')](_0x76aa('0xc'),_0x36d12b,'request\x20sent');_0x56d6bc(_0x557d69[_0x76aa('0x14')]['message']);}})[_0x76aa('0x15')](function(_0x5181d2){logger[_0x76aa('0x11')](_0x76aa('0xc'),_0x36d12b,_0x5181d2);_0x3dae33(_0x5181d2);});});} \ No newline at end of file +var _0xf3cd=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','info','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','Tag,\x20%s,\x20%s','message','result'];(function(_0x247932,_0x11c953){var _0x47cc0b=function(_0x505765){while(--_0x505765){_0x247932['push'](_0x247932['shift']());}};_0x47cc0b(++_0x11c953);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0xf3cd[_0x3e112d];return _0x531c31;};'use strict';var _=require(_0xdf3c('0x0'));var util=require(_0xdf3c('0x1'));var moment=require(_0xdf3c('0x2'));var BPromise=require(_0xdf3c('0x3'));var rs=require(_0xdf3c('0x4'));var fs=require('fs');var Redis=require(_0xdf3c('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xdf3c('0x6'));var logger=require(_0xdf3c('0x7'))(_0xdf3c('0x8'));var config=require('../../config/environment');var jayson=require(_0xdf3c('0x9'));var client=jayson[_0xdf3c('0xa')][_0xdf3c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1f0601,_0x106021,_0x28edae){return new BPromise(function(_0x52c073,_0x15705d){return client['request'](_0x1f0601,_0x28edae)['then'](function(_0x22d8ae){logger[_0xdf3c('0xc')]('Tag,\x20%s,\x20%s',_0x106021,_0xdf3c('0xd'));logger[_0xdf3c('0xe')](_0xdf3c('0xf'),_0x106021,_0xdf3c('0xd'),JSON[_0xdf3c('0x10')](_0x22d8ae));if(_0x22d8ae[_0xdf3c('0x11')]){if(_0x22d8ae[_0xdf3c('0x11')][_0xdf3c('0x12')]===0x1f4){logger['error'](_0xdf3c('0x13'),_0x106021,_0x22d8ae[_0xdf3c('0x11')][_0xdf3c('0x14')]);return _0x15705d(_0x22d8ae[_0xdf3c('0x11')]['message']);}logger[_0xdf3c('0x11')](_0xdf3c('0x13'),_0x106021,_0x22d8ae[_0xdf3c('0x11')]['message']);return _0x52c073(_0x22d8ae[_0xdf3c('0x11')][_0xdf3c('0x14')]);}else{logger[_0xdf3c('0xc')](_0xdf3c('0x13'),_0x106021,_0xdf3c('0xd'));_0x52c073(_0x22d8ae[_0xdf3c('0x15')][_0xdf3c('0x14')]);}})[_0xdf3c('0x16')](function(_0x2986d0){logger[_0xdf3c('0x11')]('Tag,\x20%s,\x20%s',_0x106021,_0x2986d0);_0x15705d(_0x2986d0);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index b1701fb..60aaf35 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(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0xa9e0[_0x3a6efd];return _0x487b9a;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/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(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0xa9e0[_0x220dbb];return _0x2b77de;};'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 500b38c..5da6814 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 _0x2032=['name','exports','STRING'];(function(_0x14cdd1,_0x1f1e6d){var _0xad9607=function(_0xdbb85){while(--_0xdbb85){_0x14cdd1['push'](_0x14cdd1['shift']());}};_0xad9607(++_0x1f1e6d);}(_0x2032,0xd9));var _0x2203=function(_0x412710,_0x4ff6ce){_0x412710=_0x412710-0x0;var _0x279aa6=_0x2032[_0x412710];return _0x279aa6;};'use strict';var Sequelize=require('sequelize');module[_0x2203('0x0')]={'name':{'type':Sequelize[_0x2203('0x1')],'allowNull':![],'unique':_0x2203('0x2')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xbaf0=['name','exports','STRING'];(function(_0x166e96,_0x55191d){var _0x553d73=function(_0x586142){while(--_0x586142){_0x166e96['push'](_0x166e96['shift']());}};_0x553d73(++_0x55191d);}(_0xbaf0,0x12a));var _0x0baf=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xbaf0[_0x1facfa];return _0x9ec701;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'name':{'type':Sequelize[_0x0baf('0x1')],'allowNull':![],'unique':_0x0baf('0x2')},'description':{'type':Sequelize[_0x0baf('0x1')]}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index 59da1ce..55834da 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 _0xc52b=['Openchannel','through','QueueId','TeamVoiceQueue','User','findOrCreate','online','voicePause','interface','UserVoiceQueueRt','upsert','isNil','SIP/%s','all','VoicePrefixId','spread','removeAgents','Whatsapp','emit','Queue:remove','getAgents','eml-format','zip-dir','fast-json-patch','moment','bluebird','path','sox','ejs','fs-extra','lodash','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./team.socket','register','sendStatus','status','undefined','count','offset','limit','set','json','apply','reject','save','then','error','name','send','map','Team','fieldName','type','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','include','findAll','catch','show','params','rawAttributes','fields','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Teams','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','destroy','sequelize','transaction','Sequelize','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','SELECT','VoiceQueueId','UserVoiceQueue','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','QueryTypes','MailQueueId','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','SmsQueueId','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','ChatQueueId','UserChatQueue','FaxQueueId','UserFaxQueue','OpenchannelQueueId','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','TeamVoicePrefix','UserVoicePrefix','end','getQueues','findOne','channel','ValidationError','Unknown\x20channel','capitalize','Queue','Queues','isValidChannel','toLowerCase','ids','removeQueues','remove','addAgents','isArray','Voice','Chat','Mail','Sms','Fax'];(function(_0x5bb7e4,_0x43ba19){var _0x399c95=function(_0xbf0f85){while(--_0xbf0f85){_0x5bb7e4['push'](_0x5bb7e4['shift']());}};_0x399c95(++_0x43ba19);}(_0xc52b,0x1d1));var _0xbc52=function(_0x5041dc,_0xa27310){_0x5041dc=_0x5041dc-0x0;var _0x1370ab=_0xc52b[_0x5041dc];return _0x1370ab;};'use strict';var emlformat=require(_0xbc52('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbc52('0x1'));var jsonpatch=require(_0xbc52('0x2'));var rp=require('request-promise');var moment=require(_0xbc52('0x3'));var BPromise=require(_0xbc52('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xbc52('0x5'));var sox=require(_0xbc52('0x6'));var csv=require('to-csv');var ejs=require(_0xbc52('0x7'));var fs=require('fs');var fs_extra=require(_0xbc52('0x8'));var _=require(_0xbc52('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xbc52('0xa'));var toCsv=require(_0xbc52('0xb'));var querystring=require(_0xbc52('0xc'));var Papa=require('papaparse');var Redis=require(_0xbc52('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xbc52('0xe'));var as=require(_0xbc52('0xf'));var hardwareService=require(_0xbc52('0x10'));var logger=require(_0xbc52('0x11'))(_0xbc52('0x12'));var utils=require(_0xbc52('0x13'));var config=require(_0xbc52('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xbc52('0x15'))['db'];config[_0xbc52('0x16')]=_[_0xbc52('0x17')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xbc52('0x18'))(new Redis(config[_0xbc52('0x16')]));require(_0xbc52('0x19'))[_0xbc52('0x1a')](socket);function respondWithStatusCode(_0x760af8,_0x488a45){_0x488a45=_0x488a45||0xcc;return function(_0x295b57){if(_0x295b57){return _0x760af8[_0xbc52('0x1b')](_0x488a45);}return _0x760af8[_0xbc52('0x1c')](_0x488a45)['end']();};}function respondWithResult(_0x2bb037,_0x22d96f){_0x22d96f=_0x22d96f||0xc8;return function(_0x44ab35){if(_0x44ab35){return _0x2bb037[_0xbc52('0x1c')](_0x22d96f)['json'](_0x44ab35);}};}function respondWithFilteredResult(_0x2addf8,_0x4a4b84){return function(_0x34c74c){if(_0x34c74c){var _0x339803=typeof _0x4a4b84['offset']===_0xbc52('0x1d')&&typeof _0x4a4b84['limit']===_0xbc52('0x1d');var _0x34508e=_0x34c74c[_0xbc52('0x1e')];var _0x121335=_0x339803?0x0:_0x4a4b84[_0xbc52('0x1f')];var _0x2ad46b=_0x339803?_0x34c74c[_0xbc52('0x1e')]:_0x4a4b84[_0xbc52('0x1f')]+_0x4a4b84[_0xbc52('0x20')];var _0x4cbaa0;if(_0x2ad46b>=_0x34508e){_0x2ad46b=_0x34508e;_0x4cbaa0=0xc8;}else{_0x4cbaa0=0xce;}_0x2addf8['status'](_0x4cbaa0);return _0x2addf8[_0xbc52('0x21')]('Content-Range',_0x121335+'-'+_0x2ad46b+'/'+_0x34508e)[_0xbc52('0x22')](_0x34c74c);}return null;};}function patchUpdates(_0x808781){return function(_0x4bb7a6){try{jsonpatch[_0xbc52('0x23')](_0x4bb7a6,_0x808781,!![]);}catch(_0x10ee1c){return BPromise[_0xbc52('0x24')](_0x10ee1c);}return _0x4bb7a6[_0xbc52('0x25')]();};}function saveUpdates(_0x4ca768,_0x15d544){return function(_0x5803b3){if(_0x5803b3){return _0x5803b3['update'](_0x4ca768)[_0xbc52('0x26')](function(_0x32ba52){return _0x32ba52;});}return null;};}function handleEntityNotFound(_0x4fc345,_0x31074f){return function(_0x4d686a){if(!_0x4d686a){_0x4fc345['sendStatus'](0x194);}return _0x4d686a;};}function handleError(_0x1196f6,_0x5746c1){_0x5746c1=_0x5746c1||0x1f4;return function(_0x54fcb5){logger[_0xbc52('0x27')](_0x54fcb5['stack']);if(_0x54fcb5[_0xbc52('0x28')]){delete _0x54fcb5[_0xbc52('0x28')];}_0x1196f6[_0xbc52('0x1c')](_0x5746c1)[_0xbc52('0x29')](_0x54fcb5);};}exports['index']=function(_0x3bc3bd,_0x33a4e6){var _0x22cbb4={},_0x3607c3={},_0x39c359={'count':0x0,'rows':[]};var _0x26e364=_[_0xbc52('0x2a')](db[_0xbc52('0x2b')]['rawAttributes'],function(_0x331987){return{'name':_0x331987[_0xbc52('0x2c')],'type':_0x331987[_0xbc52('0x2d')]['key']};});_0x3607c3[_0xbc52('0x2e')]=_['map'](_0x26e364,'name');_0x3607c3[_0xbc52('0x2f')]=_[_0xbc52('0x30')](_0x3bc3bd['query']);_0x3607c3[_0xbc52('0x31')]=_[_0xbc52('0x32')](_0x3607c3[_0xbc52('0x2e')],_0x3607c3[_0xbc52('0x2f')]);_0x22cbb4[_0xbc52('0x33')]=_[_0xbc52('0x32')](_0x3607c3['model'],qs['fields'](_0x3bc3bd[_0xbc52('0x2f')]['fields']));_0x22cbb4[_0xbc52('0x33')]=_0x22cbb4[_0xbc52('0x33')][_0xbc52('0x34')]?_0x22cbb4['attributes']:_0x3607c3[_0xbc52('0x2e')];if(!_0x3bc3bd[_0xbc52('0x2f')][_0xbc52('0x35')](_0xbc52('0x36'))){_0x22cbb4[_0xbc52('0x20')]=qs['limit'](_0x3bc3bd[_0xbc52('0x2f')][_0xbc52('0x20')]);_0x22cbb4[_0xbc52('0x1f')]=qs['offset'](_0x3bc3bd['query'][_0xbc52('0x1f')]);}_0x22cbb4['order']=qs[_0xbc52('0x37')](_0x3bc3bd[_0xbc52('0x2f')][_0xbc52('0x37')]);_0x22cbb4[_0xbc52('0x38')]=qs[_0xbc52('0x31')](_[_0xbc52('0x39')](_0x3bc3bd[_0xbc52('0x2f')],_0x3607c3[_0xbc52('0x31')]),_0x26e364);if(_0x3bc3bd[_0xbc52('0x2f')][_0xbc52('0x3a')]){_0x22cbb4[_0xbc52('0x38')]=_[_0xbc52('0x3b')](_0x22cbb4['where'],{'$or':_[_0xbc52('0x2a')](_0x26e364,function(_0x4930e6){if(_0x4930e6[_0xbc52('0x2d')]!=='VIRTUAL'){var _0x13e62f={};_0x13e62f[_0x4930e6[_0xbc52('0x28')]]={'$like':'%'+_0x3bc3bd[_0xbc52('0x2f')]['filter']+'%'};return _0x13e62f;}})});}_0x22cbb4=_[_0xbc52('0x3b')]({},_0x22cbb4,_0x3bc3bd[_0xbc52('0x3c')]);var _0x5c132e={'where':_0x22cbb4[_0xbc52('0x38')]};return db[_0xbc52('0x2b')][_0xbc52('0x1e')](_0x5c132e)[_0xbc52('0x26')](function(_0x37c9fa){_0x39c359[_0xbc52('0x1e')]=_0x37c9fa;if(_0x3bc3bd[_0xbc52('0x2f')][_0xbc52('0x3d')]){_0x22cbb4[_0xbc52('0x3e')]=[{'all':!![]}];}return db['Team'][_0xbc52('0x3f')](_0x22cbb4);})['then'](function(_0x59988a){_0x39c359['rows']=_0x59988a;return _0x39c359;})[_0xbc52('0x26')](respondWithFilteredResult(_0x33a4e6,_0x22cbb4))[_0xbc52('0x40')](handleError(_0x33a4e6,null));};exports[_0xbc52('0x41')]=function(_0x3d687d,_0x3fc5b6){var _0xb1263b={'raw':![],'where':{'id':_0x3d687d[_0xbc52('0x42')]['id']}},_0x5c6677={};_0x5c6677['model']=_[_0xbc52('0x30')](db['Team'][_0xbc52('0x43')]);_0x5c6677['query']=_[_0xbc52('0x30')](_0x3d687d[_0xbc52('0x2f')]);_0x5c6677['filters']=_[_0xbc52('0x32')](_0x5c6677['model'],_0x5c6677['query']);_0xb1263b['attributes']=_['intersection'](_0x5c6677['model'],qs[_0xbc52('0x44')](_0x3d687d[_0xbc52('0x2f')]['fields']));_0xb1263b[_0xbc52('0x33')]=_0xb1263b[_0xbc52('0x33')][_0xbc52('0x34')]?_0xb1263b[_0xbc52('0x33')]:_0x5c6677['model'];if(_0x3d687d[_0xbc52('0x2f')][_0xbc52('0x3d')]){_0xb1263b[_0xbc52('0x3e')]=[{'all':!![]}];}_0xb1263b=_[_0xbc52('0x3b')]({},_0xb1263b,_0x3d687d['options']);return db[_0xbc52('0x2b')][_0xbc52('0x45')](_0xb1263b)[_0xbc52('0x26')](handleEntityNotFound(_0x3fc5b6,null))['then'](respondWithResult(_0x3fc5b6,null))[_0xbc52('0x40')](handleError(_0x3fc5b6,null));};exports[_0xbc52('0x46')]=function(_0x281ef1,_0x514ba7){return db[_0xbc52('0x2b')][_0xbc52('0x46')](_0x281ef1[_0xbc52('0x47')],{})[_0xbc52('0x26')](function(_0x18cb8b){var _0x525595=_0x281ef1[_0xbc52('0x48')][_0xbc52('0x49')]({'plain':!![]});if(!_0x525595)throw new Error(_0xbc52('0x4a'));if(_0x525595[_0xbc52('0x4b')]===_0xbc52('0x48')){var _0xc62d05=_0x18cb8b[_0xbc52('0x49')]({'plain':!![]});var _0x590372=_0xbc52('0x4c');return db[_0xbc52('0x4d')][_0xbc52('0x45')]({'where':{'name':_0x590372,'userProfileId':_0x525595[_0xbc52('0x4e')]},'raw':!![]})[_0xbc52('0x26')](function(_0x3fb400){if(_0x3fb400&&_0x3fb400[_0xbc52('0x4f')]===0x0){return db[_0xbc52('0x50')][_0xbc52('0x46')]({'name':_0xc62d05[_0xbc52('0x28')],'resourceId':_0xc62d05['id'],'type':_0x3fb400[_0xbc52('0x28')],'sectionId':_0x3fb400['id']},{})['then'](function(){return _0x18cb8b;});}else{return _0x18cb8b;}})['catch'](function(_0x455342){logger[_0xbc52('0x27')](_0xbc52('0x51'),_0x455342);throw _0x455342;});}return _0x18cb8b;})[_0xbc52('0x26')](respondWithResult(_0x514ba7,0xc9))[_0xbc52('0x40')](handleError(_0x514ba7,null));};exports[_0xbc52('0x52')]=function(_0x478a47,_0x586716){if(_0x478a47['body']['id']){delete _0x478a47[_0xbc52('0x47')]['id'];}return db[_0xbc52('0x2b')][_0xbc52('0x45')]({'where':{'id':_0x478a47[_0xbc52('0x42')]['id']}})[_0xbc52('0x26')](handleEntityNotFound(_0x586716,null))['then'](saveUpdates(_0x478a47['body'],null))[_0xbc52('0x26')](respondWithResult(_0x586716,null))['catch'](handleError(_0x586716,null));};exports[_0xbc52('0x53')]=function(_0x10ae82,_0x4a48d8){var _0x425c79=_0x10ae82[_0xbc52('0x42')]['id'];var _0x1e5b55=[];return db[_0xbc52('0x54')][_0xbc52('0x55')](function(_0x19c7a3){var _0x3d8db6='SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20'+_0x425c79;return db[_0xbc52('0x54')][_0xbc52('0x2f')](_0x3d8db6,{'type':db[_0xbc52('0x56')]['QueryTypes']['SELECT'],'raw':!![],'transaction':_0x19c7a3})[_0xbc52('0x26')](function(_0x3bfe6c){_0x1e5b55=_[_0xbc52('0x2a')](_0x3bfe6c,function(_0x5258c8){return Number(_0x5258c8[_0xbc52('0x57')]);});})['then'](function(){var _0x1a6760=_0xbc52('0x58')+_0x425c79;return db[_0xbc52('0x54')][_0xbc52('0x2f')](_0x1a6760,{'type':db[_0xbc52('0x56')]['QueryTypes'][_0xbc52('0x59')],'raw':!![],'transaction':_0x19c7a3});})[_0xbc52('0x26')](function(_0x2bc615){var _0xc52710=_[_0xbc52('0x2a')](_0x2bc615,function(_0x1d4931){return Number(_0x1d4931[_0xbc52('0x5a')]);});return db[_0xbc52('0x5b')][_0xbc52('0x53')]({'where':{'UserId':{'$in':_0x1e5b55},'VoiceQueueId':{'$in':_0xc52710}},'transaction':_0x19c7a3});})[_0xbc52('0x26')](function(){var _0x3580ea=_0xbc52('0x5c')+_0x425c79;return db[_0xbc52('0x54')][_0xbc52('0x2f')](_0x3580ea,{'type':db[_0xbc52('0x56')][_0xbc52('0x5d')]['SELECT'],'raw':!![],'transaction':_0x19c7a3});})['then'](function(_0x1aa5a4){var _0x23d532=_['map'](_0x1aa5a4,function(_0x52f098){return Number(_0x52f098[_0xbc52('0x5e')]);});return db['UserMailQueue'][_0xbc52('0x53')]({'where':{'UserId':{'$in':_0x1e5b55},'MailQueueId':{'$in':_0x23d532}},'transaction':_0x19c7a3});})['then'](function(){var _0x17ec36=_0xbc52('0x5f')+_0x425c79;return db['sequelize'][_0xbc52('0x2f')](_0x17ec36,{'type':db[_0xbc52('0x56')][_0xbc52('0x5d')][_0xbc52('0x59')],'raw':!![],'transaction':_0x19c7a3});})['then'](function(_0x17ed8a){var _0x2c927f=_['map'](_0x17ed8a,function(_0x443a76){return Number(_0x443a76[_0xbc52('0x60')]);});return db['UserSmsQueue']['destroy']({'where':{'UserId':{'$in':_0x1e5b55},'SmsQueueId':{'$in':_0x2c927f}},'transaction':_0x19c7a3});})[_0xbc52('0x26')](function(){var _0xf02008=_0xbc52('0x61')+_0x425c79;return db[_0xbc52('0x54')][_0xbc52('0x2f')](_0xf02008,{'type':db[_0xbc52('0x56')][_0xbc52('0x5d')]['SELECT'],'raw':!![],'transaction':_0x19c7a3});})['then'](function(_0x1a3654){var _0x4c7441=_[_0xbc52('0x2a')](_0x1a3654,function(_0x4f7e03){return Number(_0x4f7e03[_0xbc52('0x62')]);});return db[_0xbc52('0x63')][_0xbc52('0x53')]({'where':{'UserId':{'$in':_0x1e5b55},'ChatQueueId':{'$in':_0x4c7441}},'transaction':_0x19c7a3});})[_0xbc52('0x26')](function(){var _0x470094='SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20'+_0x425c79;return db[_0xbc52('0x54')]['query'](_0x470094,{'type':db[_0xbc52('0x56')][_0xbc52('0x5d')][_0xbc52('0x59')],'raw':!![],'transaction':_0x19c7a3});})['then'](function(_0xf09b1e){var _0x4074e5=_[_0xbc52('0x2a')](_0xf09b1e,function(_0x3a0d49){return Number(_0x3a0d49[_0xbc52('0x64')]);});return db[_0xbc52('0x65')][_0xbc52('0x53')]({'where':{'UserId':{'$in':_0x1e5b55},'FaxQueueId':{'$in':_0x4074e5}},'transaction':_0x19c7a3});})[_0xbc52('0x26')](function(){var _0x4e428d='SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20'+_0x425c79;return db[_0xbc52('0x54')]['query'](_0x4e428d,{'type':db['Sequelize'][_0xbc52('0x5d')]['SELECT'],'raw':!![],'transaction':_0x19c7a3});})[_0xbc52('0x26')](function(_0x488a83){var _0x16be19=_[_0xbc52('0x2a')](_0x488a83,function(_0x2e9e82){return Number(_0x2e9e82[_0xbc52('0x66')]);});return db['UserOpenchannelQueue'][_0xbc52('0x53')]({'where':{'UserId':{'$in':_0x1e5b55},'OpenchannelQueueId':{'$in':_0x16be19}},'transaction':_0x19c7a3});})[_0xbc52('0x26')](function(){var _0x5de829=_0xbc52('0x67')+_0x425c79;return db['sequelize'][_0xbc52('0x2f')](_0x5de829,{'type':db[_0xbc52('0x56')][_0xbc52('0x5d')][_0xbc52('0x59')],'raw':!![],'transaction':_0x19c7a3});})[_0xbc52('0x26')](function(_0x1767fa){var _0xff3b06=_[_0xbc52('0x2a')](_0x1767fa,function(_0x2e2c67){return Number(_0x2e2c67['WhatsappQueueId']);});return db['UserWhatsappQueue']['destroy']({'where':{'UserId':{'$in':_0x1e5b55},'WhatsappQueueId':{'$in':_0xff3b06}},'transaction':_0x19c7a3});})['then'](function(){return db[_0xbc52('0x68')][_0xbc52('0x45')]({'where':{'TeamId':_0x425c79}});})['then'](function(_0x52d603){if(_0x52d603===null){return;}return db[_0xbc52('0x69')][_0xbc52('0x53')]({'where':{'UserId':{'$in':_0x1e5b55},'VoicePrefixId':_0x52d603['VoicePrefixId']},'transaction':_0x19c7a3});})[_0xbc52('0x26')](function(){return db[_0xbc52('0x2b')][_0xbc52('0x53')]({'where':{'id':_0x425c79},'cascade':!![],'transaction':_0x19c7a3});})[_0xbc52('0x26')](function(_0x20397e){if(_0x20397e===0x0){_0x4a48d8['sendStatus'](0x194);}else{return db[_0xbc52('0x50')][_0xbc52('0x53')]({'where':{'type':_0xbc52('0x4c'),'resourceId':_0x425c79},'cascade':!![],'transaction':_0x19c7a3})['then'](function(){_0x4a48d8[_0xbc52('0x1c')](0xcc)[_0xbc52('0x6a')]();});}})[_0xbc52('0x40')](function(_0x7e2607){_0x4a48d8[_0xbc52('0x1c')](0x1f4)[_0xbc52('0x29')](_0x7e2607);});});};exports[_0xbc52('0x6b')]=function(_0x38ed68,_0x151977,_0x10f12f){return db[_0xbc52('0x2b')][_0xbc52('0x6c')]({'where':{'id':_0x38ed68[_0xbc52('0x42')]['id']}})['then'](handleEntityNotFound(_0x151977,null))[_0xbc52('0x26')](function(_0x361757){if(!_0x38ed68[_0xbc52('0x2f')]['channel']||!utils['isValidChannel'](_0x38ed68[_0xbc52('0x2f')][_0xbc52('0x6d')])){throw new db['Sequelize'][(_0xbc52('0x6e'))](_0xbc52('0x6f'));}var _0x27f8b2={};var _0x48f4b3={};_0x48f4b3[_0xbc52('0x2e')]=_[_0xbc52('0x30')](db[_[_0xbc52('0x70')](_0x38ed68[_0xbc52('0x2f')][_0xbc52('0x6d')]['toLowerCase']())+_0xbc52('0x71')]['rawAttributes']);_0x48f4b3[_0xbc52('0x2f')]=_['keys'](_0x38ed68[_0xbc52('0x2f')]);_0x48f4b3[_0xbc52('0x31')]=_[_0xbc52('0x32')](_0x48f4b3[_0xbc52('0x2e')],_0x48f4b3[_0xbc52('0x2f')]);_0x27f8b2[_0xbc52('0x33')]=_[_0xbc52('0x32')](_0x48f4b3[_0xbc52('0x2e')],qs[_0xbc52('0x44')](_0x38ed68['query'][_0xbc52('0x44')]));_0x27f8b2[_0xbc52('0x33')]=_0x27f8b2[_0xbc52('0x33')][_0xbc52('0x34')]?_0x27f8b2[_0xbc52('0x33')]:_0x48f4b3[_0xbc52('0x2e')];_0x27f8b2[_0xbc52('0x20')]=qs[_0xbc52('0x20')](_0x38ed68[_0xbc52('0x2f')][_0xbc52('0x20')]);_0x27f8b2[_0xbc52('0x1f')]=qs[_0xbc52('0x1f')](_0x38ed68[_0xbc52('0x2f')][_0xbc52('0x1f')]);_0x27f8b2['order']=qs[_0xbc52('0x37')](_0x38ed68[_0xbc52('0x2f')]['sort']);_0x27f8b2[_0xbc52('0x38')]=qs[_0xbc52('0x31')](_['pick'](_0x38ed68[_0xbc52('0x2f')],_0x48f4b3[_0xbc52('0x31')]));_0x27f8b2=_[_0xbc52('0x3b')]({},_0x27f8b2,_0x38ed68['options']);return _0x361757[_0xbc52('0x49')+_[_0xbc52('0x70')](_0x38ed68['query']['channel']['toLowerCase']())+_0xbc52('0x72')](_0x27f8b2);})['then'](respondWithResult(_0x151977,null))['catch'](handleError(_0x151977,null));};exports['addQueues']=function(_0x3e206d,_0xaab06,_0x3afef4){return db[_0xbc52('0x2b')][_0xbc52('0x6c')]({'where':{'id':_0x3e206d[_0xbc52('0x42')]['id']}})[_0xbc52('0x26')](function(_0xb9813b){if(_0xb9813b){if(!_0x3e206d[_0xbc52('0x47')][_0xbc52('0x6d')]||!utils[_0xbc52('0x73')](_0x3e206d[_0xbc52('0x47')][_0xbc52('0x6d')])){throw new db[(_0xbc52('0x56'))][(_0xbc52('0x6e'))](_0xbc52('0x6f'));}return _0xb9813b['add'+_[_0xbc52('0x70')](_0x3e206d[_0xbc52('0x47')]['channel'][_0xbc52('0x74')]())+_0xbc52('0x72')](_0x3e206d[_0xbc52('0x47')][_0xbc52('0x75')]);}return null;})[_0xbc52('0x26')](handleEntityNotFound(_0xaab06,null))[_0xbc52('0x26')](respondWithStatusCode(_0xaab06,null))[_0xbc52('0x40')](handleError(_0xaab06,null));};exports[_0xbc52('0x76')]=function(_0x56aee8,_0x10aec5,_0x5b50ce){return db[_0xbc52('0x2b')][_0xbc52('0x6c')]({'where':{'id':_0x56aee8[_0xbc52('0x42')]['id']}})[_0xbc52('0x26')](function(_0x1153d6){if(_0x1153d6){if(!_0x56aee8[_0xbc52('0x2f')]['channel']||!utils[_0xbc52('0x73')](_0x56aee8['query'][_0xbc52('0x6d')])){throw new db[(_0xbc52('0x56'))][(_0xbc52('0x6e'))](_0xbc52('0x6f'));}return _0x1153d6[_0xbc52('0x77')+_[_0xbc52('0x70')](_0x56aee8[_0xbc52('0x2f')][_0xbc52('0x6d')][_0xbc52('0x74')]())+_0xbc52('0x72')](_0x56aee8[_0xbc52('0x2f')][_0xbc52('0x75')]);}return null;})[_0xbc52('0x26')](handleEntityNotFound(_0x10aec5,null))[_0xbc52('0x26')](respondWithStatusCode(_0x10aec5,null))[_0xbc52('0x40')](handleError(_0x10aec5,null));};exports[_0xbc52('0x78')]=function(_0x1e4605,_0x1356cd){var _0x17309a=_[_0xbc52('0x79')](_0x1e4605[_0xbc52('0x47')][_0xbc52('0x75')])?_0x1e4605[_0xbc52('0x47')][_0xbc52('0x75')]:[_0x1e4605[_0xbc52('0x47')][_0xbc52('0x75')]];var _0x13b103=_0x1e4605[_0xbc52('0x42')]['id'];return db[_0xbc52('0x2b')][_0xbc52('0x45')]({'where':{'id':_0x13b103}})[_0xbc52('0x26')](handleEntityNotFound(_0x1356cd,null))['then'](function(_0x5d9afd){if(_0x5d9afd){var _0x290bf4=[_0xbc52('0x7a'),_0xbc52('0x7b'),_0xbc52('0x7c'),_0xbc52('0x7d'),_0xbc52('0x7e'),_0xbc52('0x7f'),'Whatsapp'];return db[_0xbc52('0x54')][_0xbc52('0x55')](function(_0x3f0ace){var _0x47f931=_[_0xbc52('0x2a')](_0x290bf4,function(_0x49c472){var _0x515d9b={'attributes':['id',_0xbc52('0x28')]};if(_0x49c472===_0xbc52('0x7a')){_0x515d9b[_0xbc52('0x80')]={'attributes':['penalty']};}return _0x5d9afd[_0xbc52('0x49')+_0x49c472+_0xbc52('0x72')](_0x515d9b)['then'](function(_0x4c9570){var _0x3a3900=_[_0xbc52('0x2a')](_0x4c9570,function(_0x298eca){var _0x42dedc=_['map'](_0x17309a,function(_0x16a9ff){var _0x36c9b1={'where':{'UserId':_0x16a9ff,[_0x49c472+_0xbc52('0x81')]:_0x298eca['id']},'transaction':_0x3f0ace};if(_0x49c472===_0xbc52('0x7a')){_0x36c9b1['defaults']={'penalty':_0x298eca[_0xbc52('0x82')]['penalty']};}return db[_0xbc52('0x83')+_0x49c472+_0xbc52('0x71')][_0xbc52('0x84')](_0x36c9b1)[_0xbc52('0x26')](function(){socket['emit']('user'+_0x49c472+'Queue:save',{'UserId':_0x16a9ff,[_0x49c472+_0xbc52('0x81')]:_0x298eca['id']});if(_0x49c472!==_0xbc52('0x7a')){return;}return db[_0xbc52('0x83')][_0xbc52('0x3f')]({'where':{'id':_0x17309a,'online':0x1},'attributes':['id',_0xbc52('0x28'),_0xbc52('0x85'),_0xbc52('0x86'),_0xbc52('0x87')],'raw':!![]})[_0xbc52('0x26')](function(_0x1ffe6a){var _0x13a6da=_['map'](_0x1ffe6a,function(_0x3d79bb){return db[_0xbc52('0x88')][_0xbc52('0x89')]({'membername':_0x3d79bb[_0xbc52('0x28')],'UserId':_0x3d79bb['id'],'queue_name':_0x298eca['name'],'VoiceQueueId':_0x298eca['id'],'interface':_[_0xbc52('0x8a')](_0x3d79bb['interface'])?util['format'](_0xbc52('0x8b'),_0x3d79bb[_0xbc52('0x28')]):_0x3d79bb['interface'],'paused':_0x3d79bb[_0xbc52('0x86')]||![],'penalty':_0x298eca[_0xbc52('0x82')]['penalty']},{'transaction':_0x3f0ace});});return Promise[_0xbc52('0x8c')](_0x13a6da);});});});return Promise[_0xbc52('0x8c')](_0x42dedc);});return Promise[_0xbc52('0x8c')](_0x3a3900);})[_0xbc52('0x26')](function(){return db['TeamVoicePrefix'][_0xbc52('0x6c')]({'where':{'teamId':_0x13b103}})[_0xbc52('0x26')](function(_0x4f3547){if(_0x4f3547){var _0x44c1ca=_[_0xbc52('0x2a')](_0x17309a,function(_0x31e83e){db['UserVoicePrefix'][_0xbc52('0x89')]({'UserId':_0x31e83e,'VoicePrefixId':_0x4f3547[_0xbc52('0x8d')]});});return Promise['all'](_0x44c1ca);}});});});return Promise['all'](_0x47f931)[_0xbc52('0x26')](function(){return _0x5d9afd[_0xbc52('0x78')](_0x17309a,{'transaction':_0x3f0ace})[_0xbc52('0x8e')](function(_0xb3614d){return _0xb3614d;});});});}})[_0xbc52('0x26')](respondWithResult(_0x1356cd,null))[_0xbc52('0x40')](handleError(_0x1356cd,null));};exports[_0xbc52('0x8f')]=function(_0x40a3c0,_0x148a6d){var _0x2f0ec5=_['isArray'](_0x40a3c0[_0xbc52('0x2f')]['ids'])?_0x40a3c0[_0xbc52('0x2f')]['ids']:[_0x40a3c0['query'][_0xbc52('0x75')]];var _0x1fbffa=_0x40a3c0[_0xbc52('0x42')]['id'];return db[_0xbc52('0x2b')][_0xbc52('0x45')]({'where':{'id':_0x1fbffa}})['then'](handleEntityNotFound(_0x148a6d,null))[_0xbc52('0x26')](function(_0x1df7ee){if(_0x1df7ee){var _0x44b0e4=[_0xbc52('0x7a'),_0xbc52('0x7b'),_0xbc52('0x7c'),'Sms',_0xbc52('0x7e'),_0xbc52('0x7f'),_0xbc52('0x90')];return db[_0xbc52('0x54')][_0xbc52('0x55')](function(_0x55ec95){var _0x28b85f=_[_0xbc52('0x2a')](_0x44b0e4,function(_0x105a98){var _0x1b2338={'attributes':['id',_0xbc52('0x28')]};return _0x1df7ee[_0xbc52('0x49')+_0x105a98+_0xbc52('0x72')](_0x1b2338)['then'](function(_0xce2154){var _0x489fef=_['map'](_0xce2154,function(_0x3e8c0a){return _0x3e8c0a[_0xbc52('0x8f')](_0x2f0ec5,{'transaction':_0x55ec95})[_0xbc52('0x26')](function(){var _0x1d4cd6=_[_0xbc52('0x2a')](_0x2f0ec5,function(_0x1bbf76){socket[_0xbc52('0x91')]('user'+_0x105a98+_0xbc52('0x92'),{'UserId':Number(_0x1bbf76),[_0x105a98+'QueueId']:_0x3e8c0a['id']});if(_0x105a98!==_0xbc52('0x7a')){return;}return db['UserVoiceQueueRt'][_0xbc52('0x53')]({'where':{'VoiceQueueId':_0x3e8c0a['id'],'UserId':_0x1bbf76},'transaction':_0x55ec95});});return Promise['all'](_0x1d4cd6);});});return Promise[_0xbc52('0x8c')](_0x489fef);});});return Promise[_0xbc52('0x8c')](_0x28b85f)[_0xbc52('0x26')](function(){return _0x1df7ee['removeAgents'](_0x2f0ec5,{'transaction':_0x55ec95});})[_0xbc52('0x26')](function(){return db[_0xbc52('0x68')][_0xbc52('0x6c')]({'where':{'teamId':_0x1fbffa}})[_0xbc52('0x26')](function(_0x4b46f2){if(_0x4b46f2){var _0x47b3f9=_[_0xbc52('0x2a')](_0x2f0ec5,function(_0x31807b){db[_0xbc52('0x69')]['destroy']({'where':{'UserId':_0x31807b,'VoicePrefixId':_0x4b46f2[_0xbc52('0x8d')]}});});return Promise[_0xbc52('0x8c')](_0x47b3f9);}});});});}})['then'](respondWithStatusCode(_0x148a6d,null))[_0xbc52('0x40')](handleError(_0x148a6d,null));};exports[_0xbc52('0x93')]=function(_0x3bc305,_0x48487f,_0x12e650){var _0x3bbfd5={};var _0x59dbe4={};var _0x1b5504;var _0x5eb8dd;return db[_0xbc52('0x2b')][_0xbc52('0x6c')]({'where':{'id':_0x3bc305['params']['id']}})['then'](handleEntityNotFound(_0x48487f,null))[_0xbc52('0x26')](function(_0x77449c){if(_0x77449c){_0x1b5504=_0x77449c;_0x59dbe4[_0xbc52('0x2e')]=_[_0xbc52('0x30')](db[_0xbc52('0x83')]['rawAttributes']);_0x59dbe4[_0xbc52('0x2f')]=_['keys'](_0x3bc305[_0xbc52('0x2f')]);_0x59dbe4[_0xbc52('0x31')]=_['intersection'](_0x59dbe4[_0xbc52('0x2e')],_0x59dbe4[_0xbc52('0x2f')]);_0x3bbfd5['attributes']=_['intersection'](_0x59dbe4[_0xbc52('0x2e')],qs[_0xbc52('0x44')](_0x3bc305[_0xbc52('0x2f')][_0xbc52('0x44')]));_0x3bbfd5[_0xbc52('0x33')]=_0x3bbfd5[_0xbc52('0x33')][_0xbc52('0x34')]?_0x3bbfd5[_0xbc52('0x33')]:_0x59dbe4[_0xbc52('0x2e')];_0x3bbfd5['order']=qs[_0xbc52('0x37')](_0x3bc305[_0xbc52('0x2f')][_0xbc52('0x37')]);_0x3bbfd5[_0xbc52('0x38')]=qs[_0xbc52('0x31')](_[_0xbc52('0x39')](_0x3bc305['query'],_0x59dbe4[_0xbc52('0x31')]));if(_0x3bc305[_0xbc52('0x2f')][_0xbc52('0x3a')]){_0x3bbfd5['where']=_[_0xbc52('0x3b')](_0x3bbfd5[_0xbc52('0x38')],{'$or':_[_0xbc52('0x2a')](_0x3bbfd5[_0xbc52('0x33')],function(_0x38fb72){var _0xf83fb5={};_0xf83fb5[_0x38fb72]={'$like':'%'+_0x3bc305[_0xbc52('0x2f')][_0xbc52('0x3a')]+'%'};return _0xf83fb5;})});}_0x3bbfd5=_[_0xbc52('0x3b')]({},_0x3bbfd5,_0x3bc305[_0xbc52('0x3c')]);return _0x1b5504[_0xbc52('0x93')](_0x3bbfd5);}})['then'](function(_0x19d429){if(_0x19d429){_0x5eb8dd=_0x19d429[_0xbc52('0x34')];if(!_0x3bc305['query'][_0xbc52('0x35')](_0xbc52('0x36'))){_0x3bbfd5[_0xbc52('0x20')]=qs['limit'](_0x3bc305['query'][_0xbc52('0x20')]);_0x3bbfd5['offset']=qs['offset'](_0x3bc305['query'][_0xbc52('0x1f')]);}return _0x1b5504['getAgents'](_0x3bbfd5);}})[_0xbc52('0x26')](function(_0x1ca7ff){if(_0x1ca7ff){return _0x1ca7ff?{'count':_0x5eb8dd,'rows':_0x1ca7ff}:null;}})[_0xbc52('0x26')](respondWithResult(_0x48487f,null))[_0xbc52('0x40')](handleError(_0x48487f,null));}; \ No newline at end of file +var _0x9f78=['all','spread','removeAgents','Sms','Fax','Openchannel','Queue:remove','getAgents','rimraf','moment','bluebird','util','path','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','redis','defaults','localhost','register','status','end','undefined','limit','count','offset','Content-Range','json','apply','reject','save','update','sendStatus','error','name','send','index','map','Team','rawAttributes','fieldName','type','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','then','includeAll','include','rows','catch','params','length','options','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Teams','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','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','SELECT','VoiceQueueId','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','MailQueueId','UserMailQueue','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_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','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','UserWhatsappQueue','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','findOne','channel','isValidChannel','ValidationError','Unknown\x20channel','capitalize','toLowerCase','Queue','addQueues','add','Queues','removeQueues','ids','addAgents','isArray','Voice','Chat','Mail','Whatsapp','through','penalty','TeamVoiceQueue','User','findOrCreate','emit','QueueId','findAll','interface','UserVoiceQueueRt','upsert','SIP/%s','voicePause'];(function(_0x2d8fc2,_0x1c461d){var _0x3a9e53=function(_0x18941c){while(--_0x18941c){_0x2d8fc2['push'](_0x2d8fc2['shift']());}};_0x3a9e53(++_0x1c461d);}(_0x9f78,0x99));var _0x89f7=function(_0x51bda1,_0x44f80d){_0x51bda1=_0x51bda1-0x0;var _0x1ce08c=_0x9f78[_0x51bda1];return _0x1ce08c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x89f7('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x89f7('0x1'));var BPromise=require(_0x89f7('0x2'));var Mustache=require('mustache');var util=require(_0x89f7('0x3'));var path=require(_0x89f7('0x4'));var sox=require('sox');var csv=require(_0x89f7('0x5'));var ejs=require(_0x89f7('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x89f7('0x7'));var squel=require('squel');var crypto=require(_0x89f7('0x8'));var jsforce=require(_0x89f7('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x89f7('0x5'));var querystring=require(_0x89f7('0xa'));var Papa=require(_0x89f7('0xb'));var Redis=require(_0x89f7('0xc'));var authService=require(_0x89f7('0xd'));var qs=require(_0x89f7('0xe'));var as=require(_0x89f7('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x89f7('0x10'));var utils=require(_0x89f7('0x11'));var config=require(_0x89f7('0x12'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x89f7('0x13')]=_[_0x89f7('0x14')](config[_0x89f7('0x13')],{'host':_0x89f7('0x15'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./team.socket')[_0x89f7('0x16')](socket);function respondWithStatusCode(_0xb134b3,_0x152b63){_0x152b63=_0x152b63||0xcc;return function(_0x108a79){if(_0x108a79){return _0xb134b3['sendStatus'](_0x152b63);}return _0xb134b3[_0x89f7('0x17')](_0x152b63)[_0x89f7('0x18')]();};}function respondWithResult(_0x3db462,_0x9df216){_0x9df216=_0x9df216||0xc8;return function(_0x412fcc){if(_0x412fcc){return _0x3db462['status'](_0x9df216)['json'](_0x412fcc);}};}function respondWithFilteredResult(_0x4f4258,_0x1c7c1f){return function(_0x3bf5c4){if(_0x3bf5c4){var _0x5e7fe5=typeof _0x1c7c1f['offset']===_0x89f7('0x19')&&typeof _0x1c7c1f[_0x89f7('0x1a')]===_0x89f7('0x19');var _0x2e1dce=_0x3bf5c4[_0x89f7('0x1b')];var _0xe0592e=_0x5e7fe5?0x0:_0x1c7c1f[_0x89f7('0x1c')];var _0xb58e58=_0x5e7fe5?_0x3bf5c4[_0x89f7('0x1b')]:_0x1c7c1f['offset']+_0x1c7c1f[_0x89f7('0x1a')];var _0x10c883;if(_0xb58e58>=_0x2e1dce){_0xb58e58=_0x2e1dce;_0x10c883=0xc8;}else{_0x10c883=0xce;}_0x4f4258[_0x89f7('0x17')](_0x10c883);return _0x4f4258['set'](_0x89f7('0x1d'),_0xe0592e+'-'+_0xb58e58+'/'+_0x2e1dce)[_0x89f7('0x1e')](_0x3bf5c4);}return null;};}function patchUpdates(_0xeccee){return function(_0x5a8b18){try{jsonpatch[_0x89f7('0x1f')](_0x5a8b18,_0xeccee,!![]);}catch(_0x3bb7f3){return BPromise[_0x89f7('0x20')](_0x3bb7f3);}return _0x5a8b18[_0x89f7('0x21')]();};}function saveUpdates(_0x1294c2,_0x4bbd31){return function(_0x5be37b){if(_0x5be37b){return _0x5be37b[_0x89f7('0x22')](_0x1294c2)['then'](function(_0x51bc12){return _0x51bc12;});}return null;};}function handleEntityNotFound(_0x47ae93,_0x4696df){return function(_0x4b0a85){if(!_0x4b0a85){_0x47ae93[_0x89f7('0x23')](0x194);}return _0x4b0a85;};}function handleError(_0x1b4817,_0x1bbd54){_0x1bbd54=_0x1bbd54||0x1f4;return function(_0xa7994a){logger[_0x89f7('0x24')](_0xa7994a['stack']);if(_0xa7994a[_0x89f7('0x25')]){delete _0xa7994a['name'];}_0x1b4817[_0x89f7('0x17')](_0x1bbd54)[_0x89f7('0x26')](_0xa7994a);};}exports[_0x89f7('0x27')]=function(_0x479482,_0x5ab1e2){var _0x1a0b99={},_0x1ea96d={},_0x442659={'count':0x0,'rows':[]};var _0x359513=_[_0x89f7('0x28')](db[_0x89f7('0x29')][_0x89f7('0x2a')],function(_0x2f12f8){return{'name':_0x2f12f8[_0x89f7('0x2b')],'type':_0x2f12f8[_0x89f7('0x2c')]['key']};});_0x1ea96d['model']=_['map'](_0x359513,_0x89f7('0x25'));_0x1ea96d[_0x89f7('0x2d')]=_[_0x89f7('0x2e')](_0x479482[_0x89f7('0x2d')]);_0x1ea96d[_0x89f7('0x2f')]=_[_0x89f7('0x30')](_0x1ea96d[_0x89f7('0x31')],_0x1ea96d[_0x89f7('0x2d')]);_0x1a0b99['attributes']=_[_0x89f7('0x30')](_0x1ea96d[_0x89f7('0x31')],qs['fields'](_0x479482[_0x89f7('0x2d')][_0x89f7('0x32')]));_0x1a0b99['attributes']=_0x1a0b99[_0x89f7('0x33')]['length']?_0x1a0b99[_0x89f7('0x33')]:_0x1ea96d[_0x89f7('0x31')];if(!_0x479482['query'][_0x89f7('0x34')](_0x89f7('0x35'))){_0x1a0b99[_0x89f7('0x1a')]=qs[_0x89f7('0x1a')](_0x479482[_0x89f7('0x2d')]['limit']);_0x1a0b99[_0x89f7('0x1c')]=qs['offset'](_0x479482['query'][_0x89f7('0x1c')]);}_0x1a0b99['order']=qs[_0x89f7('0x36')](_0x479482[_0x89f7('0x2d')]['sort']);_0x1a0b99['where']=qs[_0x89f7('0x2f')](_[_0x89f7('0x37')](_0x479482[_0x89f7('0x2d')],_0x1ea96d[_0x89f7('0x2f')]),_0x359513);if(_0x479482[_0x89f7('0x2d')][_0x89f7('0x38')]){_0x1a0b99[_0x89f7('0x39')]=_[_0x89f7('0x3a')](_0x1a0b99['where'],{'$or':_[_0x89f7('0x28')](_0x359513,function(_0x490f65){if(_0x490f65[_0x89f7('0x2c')]!==_0x89f7('0x3b')){var _0x50d17a={};_0x50d17a[_0x490f65[_0x89f7('0x25')]]={'$like':'%'+_0x479482[_0x89f7('0x2d')]['filter']+'%'};return _0x50d17a;}})});}_0x1a0b99=_[_0x89f7('0x3a')]({},_0x1a0b99,_0x479482['options']);var _0x37336b={'where':_0x1a0b99['where']};return db[_0x89f7('0x29')][_0x89f7('0x1b')](_0x37336b)[_0x89f7('0x3c')](function(_0x45e9a5){_0x442659[_0x89f7('0x1b')]=_0x45e9a5;if(_0x479482[_0x89f7('0x2d')][_0x89f7('0x3d')]){_0x1a0b99[_0x89f7('0x3e')]=[{'all':!![]}];}return db[_0x89f7('0x29')]['findAll'](_0x1a0b99);})[_0x89f7('0x3c')](function(_0x245442){_0x442659[_0x89f7('0x3f')]=_0x245442;return _0x442659;})[_0x89f7('0x3c')](respondWithFilteredResult(_0x5ab1e2,_0x1a0b99))[_0x89f7('0x40')](handleError(_0x5ab1e2,null));};exports['show']=function(_0x423e6f,_0x186edd){var _0x28682d={'raw':![],'where':{'id':_0x423e6f[_0x89f7('0x41')]['id']}},_0x3183c6={};_0x3183c6[_0x89f7('0x31')]=_['keys'](db['Team']['rawAttributes']);_0x3183c6[_0x89f7('0x2d')]=_[_0x89f7('0x2e')](_0x423e6f[_0x89f7('0x2d')]);_0x3183c6[_0x89f7('0x2f')]=_[_0x89f7('0x30')](_0x3183c6[_0x89f7('0x31')],_0x3183c6['query']);_0x28682d[_0x89f7('0x33')]=_[_0x89f7('0x30')](_0x3183c6[_0x89f7('0x31')],qs[_0x89f7('0x32')](_0x423e6f['query'][_0x89f7('0x32')]));_0x28682d[_0x89f7('0x33')]=_0x28682d[_0x89f7('0x33')][_0x89f7('0x42')]?_0x28682d[_0x89f7('0x33')]:_0x3183c6['model'];if(_0x423e6f['query']['includeAll']){_0x28682d[_0x89f7('0x3e')]=[{'all':!![]}];}_0x28682d=_[_0x89f7('0x3a')]({},_0x28682d,_0x423e6f[_0x89f7('0x43')]);return db[_0x89f7('0x29')]['find'](_0x28682d)[_0x89f7('0x3c')](handleEntityNotFound(_0x186edd,null))[_0x89f7('0x3c')](respondWithResult(_0x186edd,null))[_0x89f7('0x40')](handleError(_0x186edd,null));};exports[_0x89f7('0x44')]=function(_0x4d6f7b,_0x443635){return db[_0x89f7('0x29')][_0x89f7('0x44')](_0x4d6f7b[_0x89f7('0x45')],{})[_0x89f7('0x3c')](function(_0xc203f5){var _0x1787fe=_0x4d6f7b[_0x89f7('0x46')][_0x89f7('0x47')]({'plain':!![]});if(!_0x1787fe)throw new Error(_0x89f7('0x48'));if(_0x1787fe[_0x89f7('0x49')]===_0x89f7('0x46')){var _0x4ec7c4=_0xc203f5[_0x89f7('0x47')]({'plain':!![]});var _0x331aea=_0x89f7('0x4a');return db[_0x89f7('0x4b')][_0x89f7('0x4c')]({'where':{'name':_0x331aea,'userProfileId':_0x1787fe[_0x89f7('0x4d')]},'raw':!![]})['then'](function(_0x317d3c){if(_0x317d3c&&_0x317d3c[_0x89f7('0x4e')]===0x0){return db[_0x89f7('0x4f')][_0x89f7('0x44')]({'name':_0x4ec7c4[_0x89f7('0x25')],'resourceId':_0x4ec7c4['id'],'type':_0x317d3c['name'],'sectionId':_0x317d3c['id']},{})['then'](function(){return _0xc203f5;});}else{return _0xc203f5;}})[_0x89f7('0x40')](function(_0x2c0319){logger[_0x89f7('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2c0319);throw _0x2c0319;});}return _0xc203f5;})[_0x89f7('0x3c')](respondWithResult(_0x443635,0xc9))[_0x89f7('0x40')](handleError(_0x443635,null));};exports[_0x89f7('0x22')]=function(_0x31c9ac,_0x415e8c){if(_0x31c9ac[_0x89f7('0x45')]['id']){delete _0x31c9ac[_0x89f7('0x45')]['id'];}return db[_0x89f7('0x29')]['find']({'where':{'id':_0x31c9ac[_0x89f7('0x41')]['id']}})[_0x89f7('0x3c')](handleEntityNotFound(_0x415e8c,null))['then'](saveUpdates(_0x31c9ac[_0x89f7('0x45')],null))[_0x89f7('0x3c')](respondWithResult(_0x415e8c,null))[_0x89f7('0x40')](handleError(_0x415e8c,null));};exports[_0x89f7('0x50')]=function(_0x8f9cce,_0x87525d){var _0x596407=_0x8f9cce[_0x89f7('0x41')]['id'];var _0x443f4a=[];return db[_0x89f7('0x51')]['transaction'](function(_0x3a8fbd){var _0x2af020=_0x89f7('0x52')+_0x596407;return db[_0x89f7('0x51')][_0x89f7('0x2d')](_0x2af020,{'type':db[_0x89f7('0x53')][_0x89f7('0x54')]['SELECT'],'raw':!![],'transaction':_0x3a8fbd})['then'](function(_0x108536){_0x443f4a=_['map'](_0x108536,function(_0x3171cb){return Number(_0x3171cb[_0x89f7('0x55')]);});})[_0x89f7('0x3c')](function(){var _0x1d8378=_0x89f7('0x56')+_0x596407;return db[_0x89f7('0x51')]['query'](_0x1d8378,{'type':db[_0x89f7('0x53')]['QueryTypes'][_0x89f7('0x57')],'raw':!![],'transaction':_0x3a8fbd});})[_0x89f7('0x3c')](function(_0x2826db){var _0x47573b=_['map'](_0x2826db,function(_0x42e9bb){return Number(_0x42e9bb[_0x89f7('0x58')]);});return db['UserVoiceQueue'][_0x89f7('0x50')]({'where':{'UserId':{'$in':_0x443f4a},'VoiceQueueId':{'$in':_0x47573b}},'transaction':_0x3a8fbd});})[_0x89f7('0x3c')](function(){var _0x4854f6=_0x89f7('0x59')+_0x596407;return db['sequelize']['query'](_0x4854f6,{'type':db[_0x89f7('0x53')]['QueryTypes']['SELECT'],'raw':!![],'transaction':_0x3a8fbd});})['then'](function(_0x382c06){var _0x34705b=_['map'](_0x382c06,function(_0x467b82){return Number(_0x467b82[_0x89f7('0x5a')]);});return db[_0x89f7('0x5b')][_0x89f7('0x50')]({'where':{'UserId':{'$in':_0x443f4a},'MailQueueId':{'$in':_0x34705b}},'transaction':_0x3a8fbd});})['then'](function(){var _0x308021=_0x89f7('0x5c')+_0x596407;return db[_0x89f7('0x51')][_0x89f7('0x2d')](_0x308021,{'type':db[_0x89f7('0x53')]['QueryTypes'][_0x89f7('0x57')],'raw':!![],'transaction':_0x3a8fbd});})['then'](function(_0x3a611b){var _0x3e8fcd=_[_0x89f7('0x28')](_0x3a611b,function(_0x422abe){return Number(_0x422abe['SmsQueueId']);});return db['UserSmsQueue'][_0x89f7('0x50')]({'where':{'UserId':{'$in':_0x443f4a},'SmsQueueId':{'$in':_0x3e8fcd}},'transaction':_0x3a8fbd});})[_0x89f7('0x3c')](function(){var _0x258edc='SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20'+_0x596407;return db[_0x89f7('0x51')][_0x89f7('0x2d')](_0x258edc,{'type':db[_0x89f7('0x53')][_0x89f7('0x54')][_0x89f7('0x57')],'raw':!![],'transaction':_0x3a8fbd});})[_0x89f7('0x3c')](function(_0x4cd727){var _0x49b6e8=_[_0x89f7('0x28')](_0x4cd727,function(_0x169b50){return Number(_0x169b50[_0x89f7('0x5d')]);});return db[_0x89f7('0x5e')][_0x89f7('0x50')]({'where':{'UserId':{'$in':_0x443f4a},'ChatQueueId':{'$in':_0x49b6e8}},'transaction':_0x3a8fbd});})[_0x89f7('0x3c')](function(){var _0x126176=_0x89f7('0x5f')+_0x596407;return db['sequelize'][_0x89f7('0x2d')](_0x126176,{'type':db['Sequelize'][_0x89f7('0x54')][_0x89f7('0x57')],'raw':!![],'transaction':_0x3a8fbd});})['then'](function(_0x15adc6){var _0x420869=_['map'](_0x15adc6,function(_0x3bc45c){return Number(_0x3bc45c[_0x89f7('0x60')]);});return db[_0x89f7('0x61')][_0x89f7('0x50')]({'where':{'UserId':{'$in':_0x443f4a},'FaxQueueId':{'$in':_0x420869}},'transaction':_0x3a8fbd});})[_0x89f7('0x3c')](function(){var _0x1d5857=_0x89f7('0x62')+_0x596407;return db[_0x89f7('0x51')][_0x89f7('0x2d')](_0x1d5857,{'type':db['Sequelize'][_0x89f7('0x54')][_0x89f7('0x57')],'raw':!![],'transaction':_0x3a8fbd});})[_0x89f7('0x3c')](function(_0x1c3160){var _0x4b93f8=_[_0x89f7('0x28')](_0x1c3160,function(_0x58faac){return Number(_0x58faac['OpenchannelQueueId']);});return db[_0x89f7('0x63')][_0x89f7('0x50')]({'where':{'UserId':{'$in':_0x443f4a},'OpenchannelQueueId':{'$in':_0x4b93f8}},'transaction':_0x3a8fbd});})[_0x89f7('0x3c')](function(){var _0x2cb589=_0x89f7('0x64')+_0x596407;return db[_0x89f7('0x51')][_0x89f7('0x2d')](_0x2cb589,{'type':db['Sequelize'][_0x89f7('0x54')][_0x89f7('0x57')],'raw':!![],'transaction':_0x3a8fbd});})[_0x89f7('0x3c')](function(_0x14b4e2){var _0x471203=_[_0x89f7('0x28')](_0x14b4e2,function(_0xe69993){return Number(_0xe69993['WhatsappQueueId']);});return db[_0x89f7('0x65')][_0x89f7('0x50')]({'where':{'UserId':{'$in':_0x443f4a},'WhatsappQueueId':{'$in':_0x471203}},'transaction':_0x3a8fbd});})['then'](function(){return db[_0x89f7('0x66')][_0x89f7('0x4c')]({'where':{'TeamId':_0x596407}});})[_0x89f7('0x3c')](function(_0x2ab02d){if(_0x2ab02d===null){return;}return db[_0x89f7('0x67')][_0x89f7('0x50')]({'where':{'UserId':{'$in':_0x443f4a},'VoicePrefixId':_0x2ab02d[_0x89f7('0x68')]},'transaction':_0x3a8fbd});})[_0x89f7('0x3c')](function(){return db[_0x89f7('0x29')][_0x89f7('0x50')]({'where':{'id':_0x596407},'cascade':!![],'transaction':_0x3a8fbd});})[_0x89f7('0x3c')](function(_0x2eb9ea){if(_0x2eb9ea===0x0){_0x87525d[_0x89f7('0x23')](0x194);}else{return db[_0x89f7('0x4f')][_0x89f7('0x50')]({'where':{'type':_0x89f7('0x4a'),'resourceId':_0x596407},'cascade':!![],'transaction':_0x3a8fbd})[_0x89f7('0x3c')](function(){_0x87525d[_0x89f7('0x17')](0xcc)[_0x89f7('0x18')]();});}})[_0x89f7('0x40')](function(_0x37d7fc){_0x87525d[_0x89f7('0x17')](0x1f4)['send'](_0x37d7fc);});});};exports['getQueues']=function(_0x41118d,_0x2f7b51,_0x22c484){return db[_0x89f7('0x29')][_0x89f7('0x69')]({'where':{'id':_0x41118d[_0x89f7('0x41')]['id']}})['then'](handleEntityNotFound(_0x2f7b51,null))[_0x89f7('0x3c')](function(_0x4464f0){if(!_0x41118d[_0x89f7('0x2d')][_0x89f7('0x6a')]||!utils[_0x89f7('0x6b')](_0x41118d[_0x89f7('0x2d')][_0x89f7('0x6a')])){throw new db[(_0x89f7('0x53'))][(_0x89f7('0x6c'))](_0x89f7('0x6d'));}var _0x286ab3={};var _0xc963d2={};_0xc963d2['model']=_[_0x89f7('0x2e')](db[_[_0x89f7('0x6e')](_0x41118d[_0x89f7('0x2d')][_0x89f7('0x6a')][_0x89f7('0x6f')]())+_0x89f7('0x70')][_0x89f7('0x2a')]);_0xc963d2[_0x89f7('0x2d')]=_[_0x89f7('0x2e')](_0x41118d[_0x89f7('0x2d')]);_0xc963d2[_0x89f7('0x2f')]=_['intersection'](_0xc963d2[_0x89f7('0x31')],_0xc963d2[_0x89f7('0x2d')]);_0x286ab3['attributes']=_['intersection'](_0xc963d2[_0x89f7('0x31')],qs[_0x89f7('0x32')](_0x41118d['query'][_0x89f7('0x32')]));_0x286ab3['attributes']=_0x286ab3[_0x89f7('0x33')][_0x89f7('0x42')]?_0x286ab3[_0x89f7('0x33')]:_0xc963d2[_0x89f7('0x31')];_0x286ab3[_0x89f7('0x1a')]=qs[_0x89f7('0x1a')](_0x41118d[_0x89f7('0x2d')][_0x89f7('0x1a')]);_0x286ab3[_0x89f7('0x1c')]=qs[_0x89f7('0x1c')](_0x41118d['query'][_0x89f7('0x1c')]);_0x286ab3['order']=qs[_0x89f7('0x36')](_0x41118d[_0x89f7('0x2d')][_0x89f7('0x36')]);_0x286ab3[_0x89f7('0x39')]=qs[_0x89f7('0x2f')](_[_0x89f7('0x37')](_0x41118d[_0x89f7('0x2d')],_0xc963d2[_0x89f7('0x2f')]));_0x286ab3=_['merge']({},_0x286ab3,_0x41118d[_0x89f7('0x43')]);return _0x4464f0[_0x89f7('0x47')+_['capitalize'](_0x41118d[_0x89f7('0x2d')][_0x89f7('0x6a')][_0x89f7('0x6f')]())+'Queues'](_0x286ab3);})[_0x89f7('0x3c')](respondWithResult(_0x2f7b51,null))['catch'](handleError(_0x2f7b51,null));};exports[_0x89f7('0x71')]=function(_0x4c4159,_0x148cbe,_0x271e54){return db[_0x89f7('0x29')][_0x89f7('0x69')]({'where':{'id':_0x4c4159[_0x89f7('0x41')]['id']}})[_0x89f7('0x3c')](function(_0x554dd3){if(_0x554dd3){if(!_0x4c4159[_0x89f7('0x45')][_0x89f7('0x6a')]||!utils[_0x89f7('0x6b')](_0x4c4159[_0x89f7('0x45')][_0x89f7('0x6a')])){throw new db[(_0x89f7('0x53'))][(_0x89f7('0x6c'))](_0x89f7('0x6d'));}return _0x554dd3[_0x89f7('0x72')+_['capitalize'](_0x4c4159[_0x89f7('0x45')]['channel'][_0x89f7('0x6f')]())+_0x89f7('0x73')](_0x4c4159[_0x89f7('0x45')]['ids']);}return null;})[_0x89f7('0x3c')](handleEntityNotFound(_0x148cbe,null))['then'](respondWithStatusCode(_0x148cbe,null))[_0x89f7('0x40')](handleError(_0x148cbe,null));};exports[_0x89f7('0x74')]=function(_0x16f724,_0x55bfad,_0x478288){return db[_0x89f7('0x29')][_0x89f7('0x69')]({'where':{'id':_0x16f724[_0x89f7('0x41')]['id']}})[_0x89f7('0x3c')](function(_0x377eb8){if(_0x377eb8){if(!_0x16f724['query'][_0x89f7('0x6a')]||!utils[_0x89f7('0x6b')](_0x16f724[_0x89f7('0x2d')][_0x89f7('0x6a')])){throw new db[(_0x89f7('0x53'))][(_0x89f7('0x6c'))](_0x89f7('0x6d'));}return _0x377eb8['remove'+_[_0x89f7('0x6e')](_0x16f724[_0x89f7('0x2d')][_0x89f7('0x6a')][_0x89f7('0x6f')]())+_0x89f7('0x73')](_0x16f724[_0x89f7('0x2d')][_0x89f7('0x75')]);}return null;})[_0x89f7('0x3c')](handleEntityNotFound(_0x55bfad,null))[_0x89f7('0x3c')](respondWithStatusCode(_0x55bfad,null))[_0x89f7('0x40')](handleError(_0x55bfad,null));};exports[_0x89f7('0x76')]=function(_0x45d5cc,_0x391bd0){var _0x54c64e=_[_0x89f7('0x77')](_0x45d5cc[_0x89f7('0x45')][_0x89f7('0x75')])?_0x45d5cc[_0x89f7('0x45')]['ids']:[_0x45d5cc[_0x89f7('0x45')][_0x89f7('0x75')]];var _0x54ad02=_0x45d5cc[_0x89f7('0x41')]['id'];return db[_0x89f7('0x29')][_0x89f7('0x4c')]({'where':{'id':_0x54ad02}})[_0x89f7('0x3c')](handleEntityNotFound(_0x391bd0,null))[_0x89f7('0x3c')](function(_0x35ee7b){if(_0x35ee7b){var _0x28a68b=[_0x89f7('0x78'),_0x89f7('0x79'),_0x89f7('0x7a'),'Sms','Fax','Openchannel',_0x89f7('0x7b')];return db[_0x89f7('0x51')]['transaction'](function(_0x3178de){var _0x3d18b2=_['map'](_0x28a68b,function(_0x4b7fae){var _0x394394={'attributes':['id',_0x89f7('0x25')]};if(_0x4b7fae===_0x89f7('0x78')){_0x394394[_0x89f7('0x7c')]={'attributes':[_0x89f7('0x7d')]};}return _0x35ee7b[_0x89f7('0x47')+_0x4b7fae+_0x89f7('0x73')](_0x394394)['then'](function(_0x36d917){var _0xbe53ae=_['map'](_0x36d917,function(_0x3f4730){var _0x50db5a=_[_0x89f7('0x28')](_0x54c64e,function(_0x1d288f){var _0x1b3bb2={'where':{'UserId':_0x1d288f,[_0x4b7fae+'QueueId']:_0x3f4730['id']},'transaction':_0x3178de};if(_0x4b7fae===_0x89f7('0x78')){_0x1b3bb2[_0x89f7('0x14')]={'penalty':_0x3f4730[_0x89f7('0x7e')][_0x89f7('0x7d')]};}return db[_0x89f7('0x7f')+_0x4b7fae+_0x89f7('0x70')][_0x89f7('0x80')](_0x1b3bb2)[_0x89f7('0x3c')](function(){socket[_0x89f7('0x81')](_0x89f7('0x46')+_0x4b7fae+'Queue:save',{'UserId':_0x1d288f,[_0x4b7fae+_0x89f7('0x82')]:_0x3f4730['id']});if(_0x4b7fae!=='Voice'){return;}return db[_0x89f7('0x7f')][_0x89f7('0x83')]({'where':{'id':_0x54c64e,'online':0x1},'attributes':['id',_0x89f7('0x25'),'online','voicePause',_0x89f7('0x84')],'raw':!![]})['then'](function(_0x11e22e){var _0x11e7fe=_[_0x89f7('0x28')](_0x11e22e,function(_0x3699dc){return db[_0x89f7('0x85')][_0x89f7('0x86')]({'membername':_0x3699dc['name'],'UserId':_0x3699dc['id'],'queue_name':_0x3f4730[_0x89f7('0x25')],'VoiceQueueId':_0x3f4730['id'],'interface':_['isNil'](_0x3699dc['interface'])?util['format'](_0x89f7('0x87'),_0x3699dc[_0x89f7('0x25')]):_0x3699dc[_0x89f7('0x84')],'paused':_0x3699dc[_0x89f7('0x88')]||![],'penalty':_0x3f4730[_0x89f7('0x7e')][_0x89f7('0x7d')]},{'transaction':_0x3178de});});return Promise[_0x89f7('0x89')](_0x11e7fe);});});});return Promise[_0x89f7('0x89')](_0x50db5a);});return Promise[_0x89f7('0x89')](_0xbe53ae);})[_0x89f7('0x3c')](function(){return db[_0x89f7('0x66')]['findOne']({'where':{'teamId':_0x54ad02}})[_0x89f7('0x3c')](function(_0x92cd57){if(_0x92cd57){var _0x178e11=_[_0x89f7('0x28')](_0x54c64e,function(_0x462c41){db[_0x89f7('0x67')][_0x89f7('0x86')]({'UserId':_0x462c41,'VoicePrefixId':_0x92cd57[_0x89f7('0x68')]});});return Promise[_0x89f7('0x89')](_0x178e11);}});});});return Promise[_0x89f7('0x89')](_0x3d18b2)[_0x89f7('0x3c')](function(){return _0x35ee7b[_0x89f7('0x76')](_0x54c64e,{'transaction':_0x3178de})[_0x89f7('0x8a')](function(_0x1c991f){return _0x1c991f;});});});}})['then'](respondWithResult(_0x391bd0,null))['catch'](handleError(_0x391bd0,null));};exports[_0x89f7('0x8b')]=function(_0x113c3b,_0xa4bb22){var _0x1d7a13=_[_0x89f7('0x77')](_0x113c3b[_0x89f7('0x2d')][_0x89f7('0x75')])?_0x113c3b[_0x89f7('0x2d')]['ids']:[_0x113c3b[_0x89f7('0x2d')]['ids']];var _0x112142=_0x113c3b[_0x89f7('0x41')]['id'];return db['Team'][_0x89f7('0x4c')]({'where':{'id':_0x112142}})['then'](handleEntityNotFound(_0xa4bb22,null))[_0x89f7('0x3c')](function(_0x1751eb){if(_0x1751eb){var _0x139982=['Voice',_0x89f7('0x79'),'Mail',_0x89f7('0x8c'),_0x89f7('0x8d'),_0x89f7('0x8e'),'Whatsapp'];return db['sequelize']['transaction'](function(_0x4f6d8f){var _0x485fd3=_[_0x89f7('0x28')](_0x139982,function(_0x5af498){var _0x368639={'attributes':['id',_0x89f7('0x25')]};return _0x1751eb[_0x89f7('0x47')+_0x5af498+_0x89f7('0x73')](_0x368639)['then'](function(_0x16676e){var _0x1ebd7e=_[_0x89f7('0x28')](_0x16676e,function(_0x14299b){return _0x14299b[_0x89f7('0x8b')](_0x1d7a13,{'transaction':_0x4f6d8f})['then'](function(){var _0x34c51d=_['map'](_0x1d7a13,function(_0x10bd01){socket['emit'](_0x89f7('0x46')+_0x5af498+_0x89f7('0x8f'),{'UserId':Number(_0x10bd01),[_0x5af498+_0x89f7('0x82')]:_0x14299b['id']});if(_0x5af498!==_0x89f7('0x78')){return;}return db['UserVoiceQueueRt'][_0x89f7('0x50')]({'where':{'VoiceQueueId':_0x14299b['id'],'UserId':_0x10bd01},'transaction':_0x4f6d8f});});return Promise[_0x89f7('0x89')](_0x34c51d);});});return Promise[_0x89f7('0x89')](_0x1ebd7e);});});return Promise['all'](_0x485fd3)[_0x89f7('0x3c')](function(){return _0x1751eb['removeAgents'](_0x1d7a13,{'transaction':_0x4f6d8f});})[_0x89f7('0x3c')](function(){return db[_0x89f7('0x66')]['findOne']({'where':{'teamId':_0x112142}})[_0x89f7('0x3c')](function(_0x2b534b){if(_0x2b534b){var _0x2890d1=_[_0x89f7('0x28')](_0x1d7a13,function(_0x1e2860){db[_0x89f7('0x67')]['destroy']({'where':{'UserId':_0x1e2860,'VoicePrefixId':_0x2b534b[_0x89f7('0x68')]}});});return Promise[_0x89f7('0x89')](_0x2890d1);}});});});}})[_0x89f7('0x3c')](respondWithStatusCode(_0xa4bb22,null))[_0x89f7('0x40')](handleError(_0xa4bb22,null));};exports[_0x89f7('0x90')]=function(_0x4e7c86,_0x5b4e3e,_0x24af9a){var _0x268185={};var _0x477295={};var _0x2ae0a8;var _0x572a7a;return db['Team']['findOne']({'where':{'id':_0x4e7c86[_0x89f7('0x41')]['id']}})['then'](handleEntityNotFound(_0x5b4e3e,null))[_0x89f7('0x3c')](function(_0x462ce3){if(_0x462ce3){_0x2ae0a8=_0x462ce3;_0x477295[_0x89f7('0x31')]=_[_0x89f7('0x2e')](db[_0x89f7('0x7f')]['rawAttributes']);_0x477295['query']=_['keys'](_0x4e7c86['query']);_0x477295[_0x89f7('0x2f')]=_[_0x89f7('0x30')](_0x477295[_0x89f7('0x31')],_0x477295[_0x89f7('0x2d')]);_0x268185[_0x89f7('0x33')]=_[_0x89f7('0x30')](_0x477295[_0x89f7('0x31')],qs[_0x89f7('0x32')](_0x4e7c86[_0x89f7('0x2d')][_0x89f7('0x32')]));_0x268185[_0x89f7('0x33')]=_0x268185[_0x89f7('0x33')][_0x89f7('0x42')]?_0x268185[_0x89f7('0x33')]:_0x477295['model'];_0x268185['order']=qs['sort'](_0x4e7c86[_0x89f7('0x2d')][_0x89f7('0x36')]);_0x268185[_0x89f7('0x39')]=qs['filters'](_[_0x89f7('0x37')](_0x4e7c86[_0x89f7('0x2d')],_0x477295[_0x89f7('0x2f')]));if(_0x4e7c86[_0x89f7('0x2d')][_0x89f7('0x38')]){_0x268185[_0x89f7('0x39')]=_['merge'](_0x268185[_0x89f7('0x39')],{'$or':_[_0x89f7('0x28')](_0x268185[_0x89f7('0x33')],function(_0x5cb198){var _0x145f3f={};_0x145f3f[_0x5cb198]={'$like':'%'+_0x4e7c86[_0x89f7('0x2d')][_0x89f7('0x38')]+'%'};return _0x145f3f;})});}_0x268185=_[_0x89f7('0x3a')]({},_0x268185,_0x4e7c86[_0x89f7('0x43')]);return _0x2ae0a8[_0x89f7('0x90')](_0x268185);}})['then'](function(_0x3cd4d8){if(_0x3cd4d8){_0x572a7a=_0x3cd4d8['length'];if(!_0x4e7c86[_0x89f7('0x2d')][_0x89f7('0x34')](_0x89f7('0x35'))){_0x268185[_0x89f7('0x1a')]=qs[_0x89f7('0x1a')](_0x4e7c86['query'][_0x89f7('0x1a')]);_0x268185[_0x89f7('0x1c')]=qs[_0x89f7('0x1c')](_0x4e7c86[_0x89f7('0x2d')][_0x89f7('0x1c')]);}return _0x2ae0a8[_0x89f7('0x90')](_0x268185);}})[_0x89f7('0x3c')](function(_0xb7b830){if(_0xb7b830){return _0xb7b830?{'count':_0x572a7a,'rows':_0xb7b830}:null;}})['then'](respondWithResult(_0x5b4e3e,null))[_0x89f7('0x40')](handleError(_0x5b4e3e,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index f4747ad..727d080 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 _0xbc34=['update','remove','emit','hasOwnProperty','hook','events','Team','setMaxListeners','save'];(function(_0x4ed752,_0x1c4eee){var _0x55331d=function(_0x33b72b){while(--_0x33b72b){_0x4ed752['push'](_0x4ed752['shift']());}};_0x55331d(++_0x1c4eee);}(_0xbc34,0x1a3));var _0x4bc3=function(_0x47e20a,_0xa604f6){_0x47e20a=_0x47e20a-0x0;var _0x1bdde9=_0xbc34[_0x47e20a];return _0x1bdde9;};'use strict';var EventEmitter=require(_0x4bc3('0x0'));var Team=require('../../mysqldb')['db'][_0x4bc3('0x1')];var TeamEvents=new EventEmitter();TeamEvents[_0x4bc3('0x2')](0x0);var events={'afterCreate':_0x4bc3('0x3'),'afterUpdate':_0x4bc3('0x4'),'afterDestroy':_0x4bc3('0x5')};function emitEvent(_0x1f2305){return function(_0x48293f,_0x50483d,_0x4bba0e){TeamEvents[_0x4bc3('0x6')](_0x1f2305+':'+_0x48293f['id'],_0x48293f);TeamEvents[_0x4bc3('0x6')](_0x1f2305,_0x48293f);_0x4bba0e(null);};}for(var e in events){if(events[_0x4bc3('0x7')](e)){var event=events[e];Team[_0x4bc3('0x8')](e,emitEvent(event));}}module['exports']=TeamEvents; \ No newline at end of file +var _0xfadf=['emit','hasOwnProperty','hook','exports','events','Team','update','remove'];(function(_0x4b1473,_0x570c61){var _0x4eb602=function(_0x4ee4ab){while(--_0x4ee4ab){_0x4b1473['push'](_0x4b1473['shift']());}};_0x4eb602(++_0x570c61);}(_0xfadf,0xcc));var _0xffad=function(_0x35055a,_0x29fc63){_0x35055a=_0x35055a-0x0;var _0xf04908=_0xfadf[_0x35055a];return _0xf04908;};'use strict';var EventEmitter=require(_0xffad('0x0'));var Team=require('../../mysqldb')['db'][_0xffad('0x1')];var TeamEvents=new EventEmitter();TeamEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xffad('0x2'),'afterDestroy':_0xffad('0x3')};function emitEvent(_0x437d32){return function(_0x13b585,_0x1b2851,_0x302049){TeamEvents['emit'](_0x437d32+':'+_0x13b585['id'],_0x13b585);TeamEvents[_0xffad('0x4')](_0x437d32,_0x13b585);_0x302049(null);};}for(var e in events){if(events[_0xffad('0x5')](e)){var event=events[e];Team[_0xffad('0x6')](e,emitEvent(event));}}module[_0xffad('0x7')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index 1491c91..d2e9c48 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 _0xdb75=['exports','define','Team','Chat','Fax','Mail','Openchannel','Sms','Voice','resolve','all','lodash','./team.attributes','get','Queues','then','map','setDataValue','channel'];(function(_0x3b500a,_0xbbeb08){var _0x230eda=function(_0xc6e2d){while(--_0xc6e2d){_0x3b500a['push'](_0x3b500a['shift']());}};_0x230eda(++_0xbbeb08);}(_0xdb75,0xb6));var _0x5db7=function(_0x57fcc0,_0x585004){_0x57fcc0=_0x57fcc0-0x0;var _0x5270df=_0xdb75[_0x57fcc0];return _0x5270df;};'use strict';var _=require(_0x5db7('0x0'));var attributes=require(_0x5db7('0x1'));function getQueuesByChannel(_0x4d258f,_0x33ad11){var _0x3c62f8=_0x5db7('0x2')+_0x33ad11+_0x5db7('0x3');return _0x4d258f[_0x3c62f8]()[_0x5db7('0x4')](function(_0x21d988){return _[_0x5db7('0x5')](_0x21d988,function(_0x59b9df){_0x59b9df[_0x5db7('0x6')](_0x5db7('0x7'),_0x33ad11);return _0x59b9df;});})['catch'](function(_0x47c51b){throw _0x47c51b;});}module[_0x5db7('0x8')]=function(_0x41683e){return _0x41683e[_0x5db7('0x9')](_0x5db7('0xa'),attributes,{'tableName':'teams','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x24ff89=this;var _0x456066=[_0x5db7('0xb'),_0x5db7('0xc'),_0x5db7('0xd'),_0x5db7('0xe'),_0x5db7('0xf'),_0x5db7('0x10'),'Whatsapp'];return Promise[_0x5db7('0x11')]()[_0x5db7('0x4')](function(){var _0x337ae7=_[_0x5db7('0x5')](_0x456066,function(_0x3caf1b){return getQueuesByChannel(_0x24ff89,_0x3caf1b);});return Promise[_0x5db7('0x12')](_0x337ae7);})['catch'](function(_0x520b32){throw _0x520b32;});}}});}; \ No newline at end of file +var _0x5a2f=['Openchannel','Sms','Voice','Whatsapp','resolve','all','lodash','./team.attributes','get','then','map','channel','catch','exports','define','Team','teams','Chat','Fax','Mail'];(function(_0x29f31c,_0x46bbdf){var _0x3b6b8a=function(_0x557471){while(--_0x557471){_0x29f31c['push'](_0x29f31c['shift']());}};_0x3b6b8a(++_0x46bbdf);}(_0x5a2f,0xce));var _0xf5a2=function(_0x16216a,_0x55226d){_0x16216a=_0x16216a-0x0;var _0x274993=_0x5a2f[_0x16216a];return _0x274993;};'use strict';var _=require(_0xf5a2('0x0'));var attributes=require(_0xf5a2('0x1'));function getQueuesByChannel(_0x19b793,_0xd0ee5b){var _0x2d9686=_0xf5a2('0x2')+_0xd0ee5b+'Queues';return _0x19b793[_0x2d9686]()[_0xf5a2('0x3')](function(_0x4a11c9){return _[_0xf5a2('0x4')](_0x4a11c9,function(_0x2901e2){_0x2901e2['setDataValue'](_0xf5a2('0x5'),_0xd0ee5b);return _0x2901e2;});})[_0xf5a2('0x6')](function(_0x2fcd2d){throw _0x2fcd2d;});}module[_0xf5a2('0x7')]=function(_0xea5b4b){return _0xea5b4b[_0xf5a2('0x8')](_0xf5a2('0x9'),attributes,{'tableName':_0xf5a2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x3f58e4=this;var _0xd0705a=[_0xf5a2('0xb'),_0xf5a2('0xc'),_0xf5a2('0xd'),_0xf5a2('0xe'),_0xf5a2('0xf'),_0xf5a2('0x10'),_0xf5a2('0x11')];return Promise[_0xf5a2('0x12')]()[_0xf5a2('0x3')](function(){var _0x588e4c=_[_0xf5a2('0x4')](_0xd0705a,function(_0x39d1f2){return getQueuesByChannel(_0x3f58e4,_0x39d1f2);});return Promise[_0xf5a2('0x13')](_0x588e4c);})[_0xf5a2('0x6')](function(_0x4ba79a){throw _0x4ba79a;});}}});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index 2008e3f..176832d 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 _0x8d7c=['error','code','Team,\x20%s,\x20%s','message','catch','lodash','util','moment','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./team.socket','register','request','then','info','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x178f52,_0x5d9675){var _0x556f99=function(_0x4a7b17){while(--_0x4a7b17){_0x178f52['push'](_0x178f52['shift']());}};_0x556f99(++_0x5d9675);}(_0x8d7c,0x17f));var _0xc8d7=function(_0x40c525,_0x57d8fc){_0x40c525=_0x40c525-0x0;var _0x1e7b68=_0x8d7c[_0x40c525];return _0x1e7b68;};'use strict';var _=require(_0xc8d7('0x0'));var util=require(_0xc8d7('0x1'));var moment=require(_0xc8d7('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc8d7('0x3'))['db'];var utils=require(_0xc8d7('0x4'));var logger=require('../../config/logger')(_0xc8d7('0x5'));var config=require(_0xc8d7('0x6'));var jayson=require(_0xc8d7('0x7'));var client=jayson[_0xc8d7('0x8')][_0xc8d7('0x9')]({'port':0x232a});config[_0xc8d7('0xa')]=_[_0xc8d7('0xb')](config[_0xc8d7('0xa')],{'host':_0xc8d7('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xc8d7('0xd'))[_0xc8d7('0xe')](socket);function respondWithRpcPromise(_0x3a73e4,_0x4256e1,_0xa99b62){return new BPromise(function(_0x52b168,_0x5959a4){return client[_0xc8d7('0xf')](_0x3a73e4,_0xa99b62)[_0xc8d7('0x10')](function(_0x3df194){logger[_0xc8d7('0x11')]('Team,\x20%s,\x20%s',_0x4256e1,_0xc8d7('0x12'));logger[_0xc8d7('0x13')](_0xc8d7('0x14'),_0x4256e1,'request\x20sent',JSON[_0xc8d7('0x15')](_0x3df194));if(_0x3df194[_0xc8d7('0x16')]){if(_0x3df194[_0xc8d7('0x16')][_0xc8d7('0x17')]===0x1f4){logger[_0xc8d7('0x16')](_0xc8d7('0x18'),_0x4256e1,_0x3df194['error'][_0xc8d7('0x19')]);return _0x5959a4(_0x3df194['error']['message']);}logger[_0xc8d7('0x16')](_0xc8d7('0x18'),_0x4256e1,_0x3df194[_0xc8d7('0x16')]['message']);return _0x52b168(_0x3df194['error'][_0xc8d7('0x19')]);}else{logger[_0xc8d7('0x11')](_0xc8d7('0x18'),_0x4256e1,_0xc8d7('0x12'));_0x52b168(_0x3df194['result'][_0xc8d7('0x19')]);}})[_0xc8d7('0x1a')](function(_0x4bd674){logger['error'](_0xc8d7('0x18'),_0x4256e1,_0x4bd674);_0x5959a4(_0x4bd674);});});} \ No newline at end of file +var _0xfc32=['Team,\x20%s,\x20%s','request\x20sent','error','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./team.socket','register','request','then','info'];(function(_0xc0a6d,_0x29d67b){var _0x491682=function(_0x27b609){while(--_0x27b609){_0xc0a6d['push'](_0xc0a6d['shift']());}};_0x491682(++_0x29d67b);}(_0xfc32,0x10e));var _0x2fc3=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0xfc32[_0x5d6456];return _0x4d66c1;};'use strict';var _=require('lodash');var util=require(_0x2fc3('0x0'));var moment=require('moment');var BPromise=require(_0x2fc3('0x1'));var rs=require(_0x2fc3('0x2'));var fs=require('fs');var Redis=require(_0x2fc3('0x3'));var db=require(_0x2fc3('0x4'))['db'];var utils=require(_0x2fc3('0x5'));var logger=require(_0x2fc3('0x6'))('rpc');var config=require(_0x2fc3('0x7'));var jayson=require(_0x2fc3('0x8'));var client=jayson['client']['http']({'port':0x232a});config[_0x2fc3('0x9')]=_[_0x2fc3('0xa')](config['redis'],{'host':_0x2fc3('0xb'),'port':0x18eb});var socket=require(_0x2fc3('0xc'))(new Redis(config[_0x2fc3('0x9')]));require(_0x2fc3('0xd'))[_0x2fc3('0xe')](socket);function respondWithRpcPromise(_0xe0f6e9,_0x389345,_0x101a7d){return new BPromise(function(_0x170c70,_0x5a2e3e){return client[_0x2fc3('0xf')](_0xe0f6e9,_0x101a7d)[_0x2fc3('0x10')](function(_0x59c7a8){logger[_0x2fc3('0x11')](_0x2fc3('0x12'),_0x389345,'request\x20sent');logger['debug']('Team,\x20%s,\x20%s,\x20%s',_0x389345,_0x2fc3('0x13'),JSON['stringify'](_0x59c7a8));if(_0x59c7a8[_0x2fc3('0x14')]){if(_0x59c7a8[_0x2fc3('0x14')]['code']===0x1f4){logger[_0x2fc3('0x14')](_0x2fc3('0x12'),_0x389345,_0x59c7a8[_0x2fc3('0x14')]['message']);return _0x5a2e3e(_0x59c7a8['error'][_0x2fc3('0x15')]);}logger[_0x2fc3('0x14')](_0x2fc3('0x12'),_0x389345,_0x59c7a8[_0x2fc3('0x14')][_0x2fc3('0x15')]);return _0x170c70(_0x59c7a8[_0x2fc3('0x14')][_0x2fc3('0x15')]);}else{logger['info'](_0x2fc3('0x12'),_0x389345,_0x2fc3('0x13'));_0x170c70(_0x59c7a8[_0x2fc3('0x16')][_0x2fc3('0x15')]);}})[_0x2fc3('0x17')](function(_0x1ed186){logger[_0x2fc3('0x14')](_0x2fc3('0x12'),_0x389345,_0x1ed186);_0x5a2e3e(_0x1ed186);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index aa66e54..7661ee6 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 _0xc1cd=['register','length','team:','./team.events','save','remove','update'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0xc1cd,0x1e6));var _0xdc1c=function(_0x15a84b,_0x117f12){_0x15a84b=_0x15a84b-0x0;var _0x330b3a=_0xc1cd[_0x15a84b];return _0x330b3a;};'use strict';var TeamEvents=require(_0xdc1c('0x0'));var events=[_0xdc1c('0x1'),_0xdc1c('0x2'),_0xdc1c('0x3')];function createListener(_0x4e5e1c,_0x3ba32d){return function(_0x27a796){_0x3ba32d['emit'](_0x4e5e1c,_0x27a796);};}function removeListener(_0x2e8025,_0x5cc809){return function(){TeamEvents['removeListener'](_0x2e8025,_0x5cc809);};}exports[_0xdc1c('0x4')]=function(_0x230aa){for(var _0x2b3f05=0x0,_0x2d2e67=events[_0xdc1c('0x5')];_0x2b3f05<_0x2d2e67;_0x2b3f05++){var _0x54c204=events[_0x2b3f05];var _0x459fa2=createListener(_0xdc1c('0x6')+_0x54c204,_0x230aa);TeamEvents['on'](_0x54c204,_0x459fa2);}}; \ No newline at end of file +var _0xfb5d=['length','team:','./team.events','save','remove','update','register'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0xfb5d,0x11a));var _0xdfb5=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xfb5d[_0x2c91e9];return _0x13f0ff;};'use strict';var TeamEvents=require(_0xdfb5('0x0'));var events=[_0xdfb5('0x1'),_0xdfb5('0x2'),_0xdfb5('0x3')];function createListener(_0x4e784f,_0x174f23){return function(_0x51442a){_0x174f23['emit'](_0x4e784f,_0x51442a);};}function removeListener(_0x5e1c81,_0x507c17){return function(){TeamEvents['removeListener'](_0x5e1c81,_0x507c17);};}exports[_0xdfb5('0x4')]=function(_0x4b0a35){for(var _0x4892a7=0x0,_0x2d6086=events[_0xdfb5('0x5')];_0x4892a7<_0x2d6086;_0x4892a7++){var _0x164eb2=events[_0x4892a7];var _0x5c410c=createListener(_0xdfb5('0x6')+_0x164eb2,_0x4b0a35);TeamEvents['on'](_0x164eb2,_0x5c410c);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index 06b6752..4a95177 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 _0xe3ed=['sequelize','exports','INTEGER'];(function(_0x56fe98,_0x43dc16){var _0x212f4f=function(_0xc3427d){while(--_0xc3427d){_0x56fe98['push'](_0x56fe98['shift']());}};_0x212f4f(++_0x43dc16);}(_0xe3ed,0x8d));var _0xde3e=function(_0x1d99f0,_0x21d9d6){_0x1d99f0=_0x1d99f0-0x0;var _0x294825=_0xe3ed[_0x1d99f0];return _0x294825;};'use strict';var Sequelize=require(_0xde3e('0x0'));module[_0xde3e('0x1')]={'TeamId':{'type':Sequelize[_0xde3e('0x2')]},'VoicePrefixId':{'type':Sequelize[_0xde3e('0x2')]}}; \ No newline at end of file +var _0x54f3=['exports','INTEGER'];(function(_0x5277db,_0x2aaa75){var _0x4039ce=function(_0x374399){while(--_0x374399){_0x5277db['push'](_0x5277db['shift']());}};_0x4039ce(++_0x2aaa75);}(_0x54f3,0x120));var _0x354f=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x54f3[_0x199572];return _0x13cfa3;};'use strict';var Sequelize=require('sequelize');module[_0x354f('0x0')]={'TeamId':{'type':Sequelize[_0x354f('0x1')]},'VoicePrefixId':{'type':Sequelize[_0x354f('0x1')]}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index e670b7d..9178343 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 _0xe3d4=['api','bluebird','request-promise','rimraf','./teamVoicePrefix.attributes','exports','define','team_has_voice_prefixes','util','../../config/logger'];(function(_0x30ca74,_0x22f37b){var _0x106abe=function(_0x39c16b){while(--_0x39c16b){_0x30ca74['push'](_0x30ca74['shift']());}};_0x106abe(++_0x22f37b);}(_0xe3d4,0xc6));var _0x4e3d=function(_0x3e8f4d,_0x2973ed){_0x3e8f4d=_0x3e8f4d-0x0;var _0x590a2e=_0xe3d4[_0x3e8f4d];return _0x590a2e;};'use strict';var _=require('lodash');var util=require(_0x4e3d('0x0'));var logger=require(_0x4e3d('0x1'))(_0x4e3d('0x2'));var moment=require('moment');var BPromise=require(_0x4e3d('0x3'));var rp=require(_0x4e3d('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4e3d('0x5'));var config=require('../../config/environment');var attributes=require(_0x4e3d('0x6'));module[_0x4e3d('0x7')]=function(_0x4fd5ff,_0x3eaf60){return _0x4fd5ff[_0x4e3d('0x8')]('TeamVoicePrefix',attributes,{'tableName':_0x4e3d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3611=['../../config/environment','exports','define','team_has_voice_prefixes','lodash','api','request-promise','path','rimraf'];(function(_0x127dcc,_0x1a7af6){var _0xd97ade=function(_0x36b97c){while(--_0x36b97c){_0x127dcc['push'](_0x127dcc['shift']());}};_0xd97ade(++_0x1a7af6);}(_0x3611,0x136));var _0x1361=function(_0x471780,_0x568329){_0x471780=_0x471780-0x0;var _0x3342dd=_0x3611[_0x471780];return _0x3342dd;};'use strict';var _=require(_0x1361('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x1361('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x1361('0x2'));var fs=require('fs');var path=require(_0x1361('0x3'));var rimraf=require(_0x1361('0x4'));var config=require(_0x1361('0x5'));var attributes=require('./teamVoicePrefix.attributes');module[_0x1361('0x6')]=function(_0x304832,_0x5aa5dc){return _0x304832[_0x1361('0x7')]('TeamVoicePrefix',attributes,{'tableName':_0x1361('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index 0c96c67..2edc3f6 100644 --- a/server/api/teamVoiceQueue/index.js +++ b/server/api/teamVoiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x3f3ae8,_0x3f1861){var _0x12ba6=function(_0x3b90cd){while(--_0x3b90cd){_0x3f3ae8['push'](_0x3f3ae8['shift']());}};_0x12ba6(++_0x3f1861);}(_0xedd9,0xfc));var _0x9edd=function(_0x1aaf4b,_0x363c33){_0x1aaf4b=_0x1aaf4b-0x0;var _0x4d0ef1=_0xedd9[_0x1aaf4b];return _0x4d0ef1;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file +var _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x619a9c,_0x2fb640){var _0xc67076=function(_0x5ce4ec){while(--_0x5ce4ec){_0x619a9c['push'](_0x619a9c['shift']());}};_0xc67076(++_0x2fb640);}(_0xedd9,0xfc));var _0x9edd=function(_0x4cf5d9,_0x47e2fd){_0x4cf5d9=_0x4cf5d9-0x0;var _0xb2749a=_0xedd9[_0x4cf5d9];return _0xb2749a;};'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/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index 3236451..e157686 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 _0x5e69=['INTEGER','sequelize'];(function(_0x1b4057,_0x58212a){var _0x1d749a=function(_0x1fa30b){while(--_0x1fa30b){_0x1b4057['push'](_0x1b4057['shift']());}};_0x1d749a(++_0x58212a);}(_0x5e69,0x185));var _0x95e6=function(_0x4a363f,_0x36480a){_0x4a363f=_0x4a363f-0x0;var _0x391de0=_0x5e69[_0x4a363f];return _0x391de0;};'use strict';var Sequelize=require(_0x95e6('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x95e6('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xaa9d=['sequelize','exports','INTEGER'];(function(_0x307060,_0x26dc3d){var _0x3a2587=function(_0x283dde){while(--_0x283dde){_0x307060['push'](_0x307060['shift']());}};_0x3a2587(++_0x26dc3d);}(_0xaa9d,0x1aa));var _0xdaa9=function(_0x338b4b,_0x38f81d){_0x338b4b=_0x338b4b-0x0;var _0x4d2e3b=_0xaa9d[_0x338b4b];return _0x4d2e3b;};'use strict';var Sequelize=require(_0xdaa9('0x0'));module[_0xdaa9('0x1')]={'penalty':{'type':Sequelize[_0xdaa9('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 f80e9f3..03f9afa 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 _0x8d53=['path','rimraf','../../config/environment','./teamVoiceQueue.attributes','define','team_has_voice_queues','lodash','util','api','moment','bluebird','request-promise'];(function(_0x47b0d9,_0x41b561){var _0x599df3=function(_0x4c0c30){while(--_0x4c0c30){_0x47b0d9['push'](_0x47b0d9['shift']());}};_0x599df3(++_0x41b561);}(_0x8d53,0x1c2));var _0x38d5=function(_0x588d6c,_0x7189cf){_0x588d6c=_0x588d6c-0x0;var _0x616ba7=_0x8d53[_0x588d6c];return _0x616ba7;};'use strict';var _=require(_0x38d5('0x0'));var util=require(_0x38d5('0x1'));var logger=require('../../config/logger')(_0x38d5('0x2'));var moment=require(_0x38d5('0x3'));var BPromise=require(_0x38d5('0x4'));var rp=require(_0x38d5('0x5'));var fs=require('fs');var path=require(_0x38d5('0x6'));var rimraf=require(_0x38d5('0x7'));var config=require(_0x38d5('0x8'));var attributes=require(_0x38d5('0x9'));module['exports']=function(_0x31ccc0,_0x5c6cc6){return _0x31ccc0[_0x38d5('0xa')]('TeamVoiceQueue',attributes,{'tableName':_0x38d5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x22fb=['define','TeamVoiceQueue','../../config/logger','moment','bluebird','request-promise','path','rimraf','./teamVoiceQueue.attributes','exports'];(function(_0x1bcaf7,_0x50a612){var _0xc63092=function(_0x57db47){while(--_0x57db47){_0x1bcaf7['push'](_0x1bcaf7['shift']());}};_0xc63092(++_0x50a612);}(_0x22fb,0x192));var _0xb22f=function(_0x207ddb,_0x1763e7){_0x207ddb=_0x207ddb-0x0;var _0x50c17a=_0x22fb[_0x207ddb];return _0x50c17a;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xb22f('0x0'))('api');var moment=require(_0xb22f('0x1'));var BPromise=require(_0xb22f('0x2'));var rp=require(_0xb22f('0x3'));var fs=require('fs');var path=require(_0xb22f('0x4'));var rimraf=require(_0xb22f('0x5'));var config=require('../../config/environment');var attributes=require(_0xb22f('0x6'));module[_0xb22f('0x7')]=function(_0x2d1fb3,_0xc3ffcc){return _0x2d1fb3[_0xb22f('0x8')](_0xb22f('0x9'),attributes,{'tableName':'team_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js b/server/api/teamVoiceQueue/teamVoiceQueue.rpc.js index 50f2d53..4d15f8a 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 _0x6ff5=['then','info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request'];(function(_0x580a58,_0x55cbf6){var _0x11ed0b=function(_0x5a05c3){while(--_0x5a05c3){_0x580a58['push'](_0x580a58['shift']());}};_0x11ed0b(++_0x55cbf6);}(_0x6ff5,0xab));var _0x56ff=function(_0x40220a,_0x22feb1){_0x40220a=_0x40220a-0x0;var _0x3903cc=_0x6ff5[_0x40220a];return _0x3903cc;};'use strict';var _=require(_0x56ff('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x56ff('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x56ff('0x2'))['db'];var utils=require(_0x56ff('0x3'));var logger=require('../../config/logger')('rpc');var config=require(_0x56ff('0x4'));var jayson=require(_0x56ff('0x5'));var client=jayson[_0x56ff('0x6')][_0x56ff('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1f7c30,_0x308195,_0x2fbf8d){return new BPromise(function(_0x4183ab,_0x36c4e0){return client[_0x56ff('0x8')](_0x1f7c30,_0x2fbf8d)[_0x56ff('0x9')](function(_0x3dab53){logger[_0x56ff('0xa')](_0x56ff('0xb'),_0x308195,_0x56ff('0xc'));logger[_0x56ff('0xd')](_0x56ff('0xe'),_0x308195,_0x56ff('0xc'),JSON[_0x56ff('0xf')](_0x3dab53));if(_0x3dab53[_0x56ff('0x10')]){if(_0x3dab53[_0x56ff('0x10')][_0x56ff('0x11')]===0x1f4){logger[_0x56ff('0x10')](_0x56ff('0xb'),_0x308195,_0x3dab53[_0x56ff('0x10')][_0x56ff('0x12')]);return _0x36c4e0(_0x3dab53[_0x56ff('0x10')][_0x56ff('0x12')]);}logger[_0x56ff('0x10')](_0x56ff('0xb'),_0x308195,_0x3dab53[_0x56ff('0x10')][_0x56ff('0x12')]);return _0x4183ab(_0x3dab53[_0x56ff('0x10')]['message']);}else{logger[_0x56ff('0xa')](_0x56ff('0xb'),_0x308195,_0x56ff('0xc'));_0x4183ab(_0x3dab53[_0x56ff('0x13')][_0x56ff('0x12')]);}})['catch'](function(_0x59c1f5){logger[_0x56ff('0x10')](_0x56ff('0xb'),_0x308195,_0x59c1f5);_0x36c4e0(_0x59c1f5);});});} \ No newline at end of file +var _0x65e9=['client','http','request','then','info','TeamVoiceQueue,\x20%s,\x20%s','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x8e14c1,_0x4224d4){var _0x1fe05e=function(_0x5dc761){while(--_0x5dc761){_0x8e14c1['push'](_0x8e14c1['shift']());}};_0x1fe05e(++_0x4224d4);}(_0x65e9,0x15e));var _0x965e=function(_0x44d7a2,_0x3d9b82){_0x44d7a2=_0x44d7a2-0x0;var _0x4586a6=_0x65e9[_0x44d7a2];return _0x4586a6;};'use strict';var _=require(_0x965e('0x0'));var util=require(_0x965e('0x1'));var moment=require('moment');var BPromise=require(_0x965e('0x2'));var rs=require(_0x965e('0x3'));var fs=require('fs');var Redis=require(_0x965e('0x4'));var db=require(_0x965e('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x965e('0x6'))(_0x965e('0x7'));var config=require(_0x965e('0x8'));var jayson=require(_0x965e('0x9'));var client=jayson[_0x965e('0xa')][_0x965e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xa623d5,_0x377231,_0x38081c){return new BPromise(function(_0x4bc92d,_0x356be0){return client[_0x965e('0xc')](_0xa623d5,_0x38081c)[_0x965e('0xd')](function(_0x3f1458){logger[_0x965e('0xe')](_0x965e('0xf'),_0x377231,'request\x20sent');logger[_0x965e('0x10')](_0x965e('0x11'),_0x377231,_0x965e('0x12'),JSON[_0x965e('0x13')](_0x3f1458));if(_0x3f1458['error']){if(_0x3f1458['error'][_0x965e('0x14')]===0x1f4){logger[_0x965e('0x15')](_0x965e('0xf'),_0x377231,_0x3f1458['error'][_0x965e('0x16')]);return _0x356be0(_0x3f1458[_0x965e('0x15')][_0x965e('0x16')]);}logger[_0x965e('0x15')](_0x965e('0xf'),_0x377231,_0x3f1458[_0x965e('0x15')][_0x965e('0x16')]);return _0x4bc92d(_0x3f1458[_0x965e('0x15')]['message']);}else{logger['info'](_0x965e('0xf'),_0x377231,_0x965e('0x12'));_0x4bc92d(_0x3f1458['result'][_0x965e('0x16')]);}})[_0x965e('0x17')](function(_0x4d2ddb){logger['error'](_0x965e('0xf'),_0x377231,_0x4d2ddb);_0x356be0(_0x4d2ddb);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index c71b098..56286aa 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 _0x2ef3=['show','post','create','put','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./template.controller','get','/:id','isAuthenticated'];(function(_0x1f4517,_0x282333){var _0x5915e1=function(_0x8eafd2){while(--_0x8eafd2){_0x1f4517['push'](_0x1f4517['shift']());}};_0x5915e1(++_0x282333);}(_0x2ef3,0xba));var _0x32ef=function(_0x142940,_0x4d7ee8){_0x142940=_0x142940-0x0;var _0x455ec7=_0x2ef3[_0x142940];return _0x455ec7;};'use strict';var multer=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var path=require(_0x32ef('0x2'));var timeout=require(_0x32ef('0x3'));var express=require(_0x32ef('0x4'));var router=express[_0x32ef('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x32ef('0x6'));var interaction=require(_0x32ef('0x7'));var config=require('../../config/environment');var controller=require(_0x32ef('0x8'));router[_0x32ef('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x32ef('0x9')](_0x32ef('0xa'),auth[_0x32ef('0xb')](),controller[_0x32ef('0xc')]);router[_0x32ef('0xd')]('/',auth[_0x32ef('0xb')](),controller[_0x32ef('0xe')]);router[_0x32ef('0xf')](_0x32ef('0xa'),auth[_0x32ef('0xb')](),controller['update']);router['delete'](_0x32ef('0xa'),auth[_0x32ef('0xb')](),controller[_0x32ef('0x10')]);module[_0x32ef('0x11')]=router; \ No newline at end of file +var _0x3e4d=['../../components/auth/service','../../components/interaction/service','./template.controller','index','get','/:id','isAuthenticated','show','create','put','update','destroy','exports','multer','path','fs-extra'];(function(_0x29e35f,_0x4859ef){var _0x266b74=function(_0xc09e1){while(--_0xc09e1){_0x29e35f['push'](_0x29e35f['shift']());}};_0x266b74(++_0x4859ef);}(_0x3e4d,0x16d));var _0xd3e4=function(_0xdfdd8e,_0x4fcf09){_0xdfdd8e=_0xdfdd8e-0x0;var _0x44bf26=_0x3e4d[_0xdfdd8e];return _0x44bf26;};'use strict';var multer=require(_0xd3e4('0x0'));var util=require('util');var path=require(_0xd3e4('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xd3e4('0x2'));var auth=require(_0xd3e4('0x3'));var interaction=require(_0xd3e4('0x4'));var config=require('../../config/environment');var controller=require(_0xd3e4('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0xd3e4('0x6')]);router[_0xd3e4('0x7')](_0xd3e4('0x8'),auth[_0xd3e4('0x9')](),controller[_0xd3e4('0xa')]);router['post']('/',auth[_0xd3e4('0x9')](),controller[_0xd3e4('0xb')]);router[_0xd3e4('0xc')]('/:id',auth[_0xd3e4('0x9')](),controller[_0xd3e4('0xd')]);router['delete']('/:id',auth[_0xd3e4('0x9')](),controller[_0xd3e4('0xe')]);module[_0xd3e4('0xf')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index 70fa48b..791aa09 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 _0x6930=['STRING','TEXT'];(function(_0x24f999,_0x1077ba){var _0x1119f4=function(_0x37dd8b){while(--_0x37dd8b){_0x24f999['push'](_0x24f999['shift']());}};_0x1119f4(++_0x1077ba);}(_0x6930,0xda));var _0x0693=function(_0x856d37,_0x4786db){_0x856d37=_0x856d37-0x0;var _0xf90737=_0x6930[_0x856d37];return _0xf90737;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x0693('0x0')]},'html':{'type':Sequelize[_0x0693('0x1')]}}; \ No newline at end of file +var _0x4941=['STRING','TEXT','sequelize','exports'];(function(_0xd22918,_0x1de1a1){var _0x30c9f9=function(_0x40b277){while(--_0x40b277){_0xd22918['push'](_0xd22918['shift']());}};_0x30c9f9(++_0x1de1a1);}(_0x4941,0xfa));var _0x1494=function(_0x5ee3d3,_0x537c30){_0x5ee3d3=_0x5ee3d3-0x0;var _0x4b272f=_0x4941[_0x5ee3d3];return _0x4b272f;};'use strict';var Sequelize=require(_0x1494('0x0'));module[_0x1494('0x1')]={'name':{'type':Sequelize[_0x1494('0x2')]},'description':{'type':Sequelize['STRING']},'html':{'type':Sequelize[_0x1494('0x3')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index 9fa9492..165b5d4 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 _0xb840=['autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','Content-Range','apply','reject','destroy','then','get','Templates','UserProfileResource','error','stack','name','send','index','map','Template','fieldName','key','model','query','filters','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','merge','VIRTUAL','options','where','includeAll','rows','catch','params','keys','rawAttributes','intersection','find','create','body','user','role','userProfileId'];(function(_0x4c2dfc,_0x4814c0){var _0xfd728d=function(_0x5b8d81){while(--_0x5b8d81){_0x4c2dfc['push'](_0x4c2dfc['shift']());}};_0xfd728d(++_0x4814c0);}(_0xb840,0x197));var _0x0b84=function(_0x1c20a9,_0x1a7ab1){_0x1c20a9=_0x1c20a9-0x0;var _0x4bfa40=_0xb840[_0x1c20a9];return _0x4bfa40;};'use strict';var emlformat=require(_0x0b84('0x0'));var rimraf=require(_0x0b84('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0b84('0x2'));var moment=require(_0x0b84('0x3'));var BPromise=require(_0x0b84('0x4'));var Mustache=require(_0x0b84('0x5'));var util=require(_0x0b84('0x6'));var path=require(_0x0b84('0x7'));var sox=require(_0x0b84('0x8'));var csv=require(_0x0b84('0x9'));var ejs=require(_0x0b84('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0b84('0xb'));var squel=require(_0x0b84('0xc'));var crypto=require(_0x0b84('0xd'));var jsforce=require(_0x0b84('0xe'));var deskjs=require(_0x0b84('0xf'));var toCsv=require(_0x0b84('0x9'));var querystring=require(_0x0b84('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x0b84('0x11'));var as=require(_0x0b84('0x12'));var hardwareService=require(_0x0b84('0x13'));var logger=require('../../config/logger')(_0x0b84('0x14'));var utils=require(_0x0b84('0x15'));var config=require(_0x0b84('0x16'));var licenseUtil=require(_0x0b84('0x17'));var db=require(_0x0b84('0x18'))['db'];function respondWithStatusCode(_0x2c0889,_0x44deca){_0x44deca=_0x44deca||0xcc;return function(_0x2f862f){if(_0x2f862f){return _0x2c0889[_0x0b84('0x19')](_0x44deca);}return _0x2c0889[_0x0b84('0x1a')](_0x44deca)[_0x0b84('0x1b')]();};}function respondWithResult(_0x245518,_0x510b9b){_0x510b9b=_0x510b9b||0xc8;return function(_0x5126c7){if(_0x5126c7){return _0x245518['status'](_0x510b9b)[_0x0b84('0x1c')](_0x5126c7);}};}function respondWithFilteredResult(_0x367785,_0x204642){return function(_0xb53505){if(_0xb53505){var _0x1eec1b=typeof _0x204642[_0x0b84('0x1d')]===_0x0b84('0x1e')&&typeof _0x204642['limit']===_0x0b84('0x1e');var _0x1f53f3=_0xb53505[_0x0b84('0x1f')];var _0x1690ed=_0x1eec1b?0x0:_0x204642[_0x0b84('0x1d')];var _0x34c52b=_0x1eec1b?_0xb53505[_0x0b84('0x1f')]:_0x204642['offset']+_0x204642['limit'];var _0x34b265;if(_0x34c52b>=_0x1f53f3){_0x34c52b=_0x1f53f3;_0x34b265=0xc8;}else{_0x34b265=0xce;}_0x367785['status'](_0x34b265);return _0x367785['set'](_0x0b84('0x20'),_0x1690ed+'-'+_0x34c52b+'/'+_0x1f53f3)[_0x0b84('0x1c')](_0xb53505);}return null;};}function patchUpdates(_0x292d29){return function(_0x1f9bfd){try{jsonpatch[_0x0b84('0x21')](_0x1f9bfd,_0x292d29,!![]);}catch(_0x2f1833){return BPromise[_0x0b84('0x22')](_0x2f1833);}return _0x1f9bfd['save']();};}function saveUpdates(_0x2bfe01,_0x301495){return function(_0x7bc4c3){if(_0x7bc4c3){return _0x7bc4c3['update'](_0x2bfe01)['then'](function(_0x3cbb49){return _0x3cbb49;});}return null;};}function removeEntity(_0xdc6d01,_0xe25ea7){return function(_0x4bb23f){if(_0x4bb23f){return _0x4bb23f[_0x0b84('0x23')]()[_0x0b84('0x24')](function(){var _0x45805b=_0x4bb23f[_0x0b84('0x25')]({'plain':!![]});var _0x1fc9d4=_0x0b84('0x26');return db[_0x0b84('0x27')][_0x0b84('0x23')]({'where':{'type':_0x1fc9d4,'resourceId':_0x45805b['id']}})[_0x0b84('0x24')](function(){return _0x4bb23f;});})[_0x0b84('0x24')](function(){_0xdc6d01['status'](0xcc)[_0x0b84('0x1b')]();});}};}function handleEntityNotFound(_0x33b804,_0x5386ce){return function(_0x26378f){if(!_0x26378f){_0x33b804[_0x0b84('0x19')](0x194);}return _0x26378f;};}function handleError(_0x1ad07f,_0x227d67){_0x227d67=_0x227d67||0x1f4;return function(_0x1066bc){logger[_0x0b84('0x28')](_0x1066bc[_0x0b84('0x29')]);if(_0x1066bc[_0x0b84('0x2a')]){delete _0x1066bc['name'];}_0x1ad07f[_0x0b84('0x1a')](_0x227d67)[_0x0b84('0x2b')](_0x1066bc);};}exports[_0x0b84('0x2c')]=function(_0x5779a0,_0x233bdb){var _0x30633c={},_0x422626={},_0x1b8fe1={'count':0x0,'rows':[]};var _0x1a88dc=_[_0x0b84('0x2d')](db[_0x0b84('0x2e')]['rawAttributes'],function(_0x478f2b){return{'name':_0x478f2b[_0x0b84('0x2f')],'type':_0x478f2b['type'][_0x0b84('0x30')]};});_0x422626[_0x0b84('0x31')]=_['map'](_0x1a88dc,'name');_0x422626['query']=_['keys'](_0x5779a0[_0x0b84('0x32')]);_0x422626[_0x0b84('0x33')]=_['intersection'](_0x422626[_0x0b84('0x31')],_0x422626[_0x0b84('0x32')]);_0x30633c[_0x0b84('0x34')]=_['intersection'](_0x422626[_0x0b84('0x31')],qs['fields'](_0x5779a0[_0x0b84('0x32')][_0x0b84('0x35')]));_0x30633c[_0x0b84('0x34')]=_0x30633c['attributes'][_0x0b84('0x36')]?_0x30633c[_0x0b84('0x34')]:_0x422626[_0x0b84('0x31')];if(!_0x5779a0[_0x0b84('0x32')][_0x0b84('0x37')](_0x0b84('0x38'))){_0x30633c[_0x0b84('0x39')]=qs['limit'](_0x5779a0[_0x0b84('0x32')][_0x0b84('0x39')]);_0x30633c[_0x0b84('0x1d')]=qs['offset'](_0x5779a0[_0x0b84('0x32')][_0x0b84('0x1d')]);}_0x30633c[_0x0b84('0x3a')]=qs[_0x0b84('0x3b')](_0x5779a0[_0x0b84('0x32')][_0x0b84('0x3b')]);_0x30633c['where']=qs['filters'](_[_0x0b84('0x3c')](_0x5779a0['query'],_0x422626[_0x0b84('0x33')]),_0x1a88dc);if(_0x5779a0[_0x0b84('0x32')][_0x0b84('0x3d')]){_0x30633c['where']=_[_0x0b84('0x3e')](_0x30633c['where'],{'$or':_['map'](_0x1a88dc,function(_0x5e2a7e){if(_0x5e2a7e['type']!==_0x0b84('0x3f')){var _0x49db18={};_0x49db18[_0x5e2a7e['name']]={'$like':'%'+_0x5779a0[_0x0b84('0x32')][_0x0b84('0x3d')]+'%'};return _0x49db18;}})});}_0x30633c=_[_0x0b84('0x3e')]({},_0x30633c,_0x5779a0[_0x0b84('0x40')]);var _0x1689b6={'where':_0x30633c[_0x0b84('0x41')]};return db[_0x0b84('0x2e')][_0x0b84('0x1f')](_0x1689b6)['then'](function(_0x55886a){_0x1b8fe1[_0x0b84('0x1f')]=_0x55886a;if(_0x5779a0[_0x0b84('0x32')][_0x0b84('0x42')]){_0x30633c['include']=[{'all':!![]}];}return db[_0x0b84('0x2e')]['findAll'](_0x30633c);})[_0x0b84('0x24')](function(_0x811186){_0x1b8fe1[_0x0b84('0x43')]=_0x811186;return _0x1b8fe1;})[_0x0b84('0x24')](respondWithFilteredResult(_0x233bdb,_0x30633c))[_0x0b84('0x44')](handleError(_0x233bdb,null));};exports['show']=function(_0x19544c,_0x2c465b){var _0x35f965={'raw':!![],'where':{'id':_0x19544c[_0x0b84('0x45')]['id']}},_0x332e88={};_0x332e88[_0x0b84('0x31')]=_[_0x0b84('0x46')](db[_0x0b84('0x2e')][_0x0b84('0x47')]);_0x332e88[_0x0b84('0x32')]=_[_0x0b84('0x46')](_0x19544c[_0x0b84('0x32')]);_0x332e88['filters']=_[_0x0b84('0x48')](_0x332e88[_0x0b84('0x31')],_0x332e88[_0x0b84('0x32')]);_0x35f965[_0x0b84('0x34')]=_[_0x0b84('0x48')](_0x332e88['model'],qs[_0x0b84('0x35')](_0x19544c[_0x0b84('0x32')]['fields']));_0x35f965[_0x0b84('0x34')]=_0x35f965[_0x0b84('0x34')][_0x0b84('0x36')]?_0x35f965[_0x0b84('0x34')]:_0x332e88['model'];if(_0x19544c[_0x0b84('0x32')][_0x0b84('0x42')]){_0x35f965['include']=[{'all':!![]}];}_0x35f965=_[_0x0b84('0x3e')]({},_0x35f965,_0x19544c['options']);return db[_0x0b84('0x2e')][_0x0b84('0x49')](_0x35f965)['then'](handleEntityNotFound(_0x2c465b,null))[_0x0b84('0x24')](respondWithResult(_0x2c465b,null))[_0x0b84('0x44')](handleError(_0x2c465b,null));};exports[_0x0b84('0x4a')]=function(_0xfffcb6,_0x4e27ec){return db[_0x0b84('0x2e')][_0x0b84('0x4a')](_0xfffcb6[_0x0b84('0x4b')],{})[_0x0b84('0x24')](function(_0x54134f){var _0x36455e=_0xfffcb6[_0x0b84('0x4c')][_0x0b84('0x25')]({'plain':!![]});if(!_0x36455e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x36455e[_0x0b84('0x4d')]==='user'){var _0x4a9792=_0x54134f[_0x0b84('0x25')]({'plain':!![]});var _0x144b52=_0x0b84('0x26');return db['UserProfileSection'][_0x0b84('0x49')]({'where':{'name':_0x144b52,'userProfileId':_0x36455e[_0x0b84('0x4e')]},'raw':!![]})[_0x0b84('0x24')](function(_0x3bd798){if(_0x3bd798&&_0x3bd798[_0x0b84('0x4f')]===0x0){return db[_0x0b84('0x27')][_0x0b84('0x4a')]({'name':_0x4a9792[_0x0b84('0x2a')],'resourceId':_0x4a9792['id'],'type':_0x3bd798[_0x0b84('0x2a')],'sectionId':_0x3bd798['id']},{})[_0x0b84('0x24')](function(){return _0x54134f;});}else{return _0x54134f;}})[_0x0b84('0x44')](function(_0x20b3bf){logger[_0x0b84('0x28')](_0x0b84('0x50'),_0x20b3bf);throw _0x20b3bf;});}return _0x54134f;})[_0x0b84('0x24')](respondWithResult(_0x4e27ec,0xc9))[_0x0b84('0x44')](handleError(_0x4e27ec,null));};exports['update']=function(_0x4b87f9,_0xa01111){if(_0x4b87f9['body']['id']){delete _0x4b87f9[_0x0b84('0x4b')]['id'];}return db['Template'][_0x0b84('0x49')]({'where':{'id':_0x4b87f9[_0x0b84('0x45')]['id']}})[_0x0b84('0x24')](handleEntityNotFound(_0xa01111,null))[_0x0b84('0x24')](saveUpdates(_0x4b87f9[_0x0b84('0x4b')],null))[_0x0b84('0x24')](respondWithResult(_0xa01111,null))['catch'](handleError(_0xa01111,null));};exports[_0x0b84('0x23')]=function(_0x52a665,_0x408764){return db[_0x0b84('0x2e')][_0x0b84('0x49')]({'where':{'id':_0x52a665[_0x0b84('0x45')]['id']}})[_0x0b84('0x24')](handleEntityNotFound(_0x408764,null))[_0x0b84('0x24')](removeEntity(_0x408764,null))['catch'](handleError(_0x408764,null));}; \ No newline at end of file +var _0x0e6e=['attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','type','VIRTUAL','options','include','findAll','rows','catch','show','rawAttributes','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','params','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','desk.js','ioredis','../../components/auth/service','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','Templates','UserProfileResource','error','stack','name','send','index','Template','fieldName','model','map','query','keys','filters','intersection'];(function(_0x23abe8,_0x2a1839){var _0x2f01c0=function(_0x5c816f){while(--_0x5c816f){_0x23abe8['push'](_0x23abe8['shift']());}};_0x2f01c0(++_0x2a1839);}(_0x0e6e,0x155));var _0xe0e6=function(_0x57ef6d,_0x2c079b){_0x57ef6d=_0x57ef6d-0x0;var _0x304448=_0x0e6e[_0x57ef6d];return _0x304448;};'use strict';var emlformat=require(_0xe0e6('0x0'));var rimraf=require(_0xe0e6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xe0e6('0x2'));var moment=require(_0xe0e6('0x3'));var BPromise=require(_0xe0e6('0x4'));var Mustache=require(_0xe0e6('0x5'));var util=require(_0xe0e6('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xe0e6('0x7'));var ejs=require(_0xe0e6('0x8'));var fs=require('fs');var fs_extra=require(_0xe0e6('0x9'));var _=require(_0xe0e6('0xa'));var squel=require(_0xe0e6('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xe0e6('0xc'));var toCsv=require(_0xe0e6('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xe0e6('0xd'));var authService=require(_0xe0e6('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xe0e6('0xf'))('api');var utils=require(_0xe0e6('0x10'));var config=require(_0xe0e6('0x11'));var licenseUtil=require(_0xe0e6('0x12'));var db=require(_0xe0e6('0x13'))['db'];function respondWithStatusCode(_0x190f6c,_0x1cde5a){_0x1cde5a=_0x1cde5a||0xcc;return function(_0x4da767){if(_0x4da767){return _0x190f6c[_0xe0e6('0x14')](_0x1cde5a);}return _0x190f6c[_0xe0e6('0x15')](_0x1cde5a)[_0xe0e6('0x16')]();};}function respondWithResult(_0x44037d,_0x65fc93){_0x65fc93=_0x65fc93||0xc8;return function(_0xc70d72){if(_0xc70d72){return _0x44037d[_0xe0e6('0x15')](_0x65fc93)[_0xe0e6('0x17')](_0xc70d72);}};}function respondWithFilteredResult(_0x4ac866,_0x37bd28){return function(_0xe86835){if(_0xe86835){var _0x53264d=typeof _0x37bd28[_0xe0e6('0x18')]===_0xe0e6('0x19')&&typeof _0x37bd28['limit']===_0xe0e6('0x19');var _0x1a99bc=_0xe86835[_0xe0e6('0x1a')];var _0x535c16=_0x53264d?0x0:_0x37bd28[_0xe0e6('0x18')];var _0x5f594=_0x53264d?_0xe86835[_0xe0e6('0x1a')]:_0x37bd28[_0xe0e6('0x18')]+_0x37bd28[_0xe0e6('0x1b')];var _0x3d24cc;if(_0x5f594>=_0x1a99bc){_0x5f594=_0x1a99bc;_0x3d24cc=0xc8;}else{_0x3d24cc=0xce;}_0x4ac866[_0xe0e6('0x15')](_0x3d24cc);return _0x4ac866[_0xe0e6('0x1c')](_0xe0e6('0x1d'),_0x535c16+'-'+_0x5f594+'/'+_0x1a99bc)[_0xe0e6('0x17')](_0xe86835);}return null;};}function patchUpdates(_0x41f911){return function(_0x390249){try{jsonpatch['apply'](_0x390249,_0x41f911,!![]);}catch(_0x10fec0){return BPromise[_0xe0e6('0x1e')](_0x10fec0);}return _0x390249[_0xe0e6('0x1f')]();};}function saveUpdates(_0x1320a3,_0x25f05f){return function(_0x3b90c3){if(_0x3b90c3){return _0x3b90c3[_0xe0e6('0x20')](_0x1320a3)[_0xe0e6('0x21')](function(_0x58e8df){return _0x58e8df;});}return null;};}function removeEntity(_0x55cedb,_0x14f81d){return function(_0x2f4c70){if(_0x2f4c70){return _0x2f4c70['destroy']()[_0xe0e6('0x21')](function(){var _0x2d2fde=_0x2f4c70['get']({'plain':!![]});var _0x1cb0d4=_0xe0e6('0x22');return db[_0xe0e6('0x23')]['destroy']({'where':{'type':_0x1cb0d4,'resourceId':_0x2d2fde['id']}})['then'](function(){return _0x2f4c70;});})[_0xe0e6('0x21')](function(){_0x55cedb[_0xe0e6('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x390352,_0x43828b){return function(_0x4bd4e1){if(!_0x4bd4e1){_0x390352[_0xe0e6('0x14')](0x194);}return _0x4bd4e1;};}function handleError(_0x517161,_0x5eb4eb){_0x5eb4eb=_0x5eb4eb||0x1f4;return function(_0x3dba99){logger[_0xe0e6('0x24')](_0x3dba99[_0xe0e6('0x25')]);if(_0x3dba99[_0xe0e6('0x26')]){delete _0x3dba99['name'];}_0x517161[_0xe0e6('0x15')](_0x5eb4eb)[_0xe0e6('0x27')](_0x3dba99);};}exports[_0xe0e6('0x28')]=function(_0x27b394,_0x234d76){var _0x4cbeff={},_0x11c8c2={},_0x1675de={'count':0x0,'rows':[]};var _0x1bc152=_['map'](db[_0xe0e6('0x29')]['rawAttributes'],function(_0x304f39){return{'name':_0x304f39[_0xe0e6('0x2a')],'type':_0x304f39['type']['key']};});_0x11c8c2[_0xe0e6('0x2b')]=_[_0xe0e6('0x2c')](_0x1bc152,_0xe0e6('0x26'));_0x11c8c2[_0xe0e6('0x2d')]=_[_0xe0e6('0x2e')](_0x27b394[_0xe0e6('0x2d')]);_0x11c8c2[_0xe0e6('0x2f')]=_[_0xe0e6('0x30')](_0x11c8c2[_0xe0e6('0x2b')],_0x11c8c2[_0xe0e6('0x2d')]);_0x4cbeff[_0xe0e6('0x31')]=_[_0xe0e6('0x30')](_0x11c8c2[_0xe0e6('0x2b')],qs['fields'](_0x27b394[_0xe0e6('0x2d')][_0xe0e6('0x32')]));_0x4cbeff['attributes']=_0x4cbeff[_0xe0e6('0x31')][_0xe0e6('0x33')]?_0x4cbeff['attributes']:_0x11c8c2[_0xe0e6('0x2b')];if(!_0x27b394[_0xe0e6('0x2d')][_0xe0e6('0x34')]('nolimit')){_0x4cbeff[_0xe0e6('0x1b')]=qs[_0xe0e6('0x1b')](_0x27b394['query']['limit']);_0x4cbeff[_0xe0e6('0x18')]=qs[_0xe0e6('0x18')](_0x27b394[_0xe0e6('0x2d')][_0xe0e6('0x18')]);}_0x4cbeff['order']=qs[_0xe0e6('0x35')](_0x27b394[_0xe0e6('0x2d')][_0xe0e6('0x35')]);_0x4cbeff[_0xe0e6('0x36')]=qs[_0xe0e6('0x2f')](_[_0xe0e6('0x37')](_0x27b394['query'],_0x11c8c2[_0xe0e6('0x2f')]),_0x1bc152);if(_0x27b394[_0xe0e6('0x2d')][_0xe0e6('0x38')]){_0x4cbeff[_0xe0e6('0x36')]=_[_0xe0e6('0x39')](_0x4cbeff['where'],{'$or':_['map'](_0x1bc152,function(_0x3fa747){if(_0x3fa747[_0xe0e6('0x3a')]!==_0xe0e6('0x3b')){var _0xffd93b={};_0xffd93b[_0x3fa747[_0xe0e6('0x26')]]={'$like':'%'+_0x27b394[_0xe0e6('0x2d')][_0xe0e6('0x38')]+'%'};return _0xffd93b;}})});}_0x4cbeff=_[_0xe0e6('0x39')]({},_0x4cbeff,_0x27b394[_0xe0e6('0x3c')]);var _0x4f870c={'where':_0x4cbeff[_0xe0e6('0x36')]};return db[_0xe0e6('0x29')]['count'](_0x4f870c)[_0xe0e6('0x21')](function(_0x44718e){_0x1675de[_0xe0e6('0x1a')]=_0x44718e;if(_0x27b394[_0xe0e6('0x2d')]['includeAll']){_0x4cbeff[_0xe0e6('0x3d')]=[{'all':!![]}];}return db[_0xe0e6('0x29')][_0xe0e6('0x3e')](_0x4cbeff);})[_0xe0e6('0x21')](function(_0x5f455b){_0x1675de[_0xe0e6('0x3f')]=_0x5f455b;return _0x1675de;})[_0xe0e6('0x21')](respondWithFilteredResult(_0x234d76,_0x4cbeff))[_0xe0e6('0x40')](handleError(_0x234d76,null));};exports[_0xe0e6('0x41')]=function(_0x1c35d9,_0x2c0a13){var _0x45464={'raw':!![],'where':{'id':_0x1c35d9['params']['id']}},_0x3eecd1={};_0x3eecd1[_0xe0e6('0x2b')]=_['keys'](db[_0xe0e6('0x29')][_0xe0e6('0x42')]);_0x3eecd1['query']=_[_0xe0e6('0x2e')](_0x1c35d9[_0xe0e6('0x2d')]);_0x3eecd1[_0xe0e6('0x2f')]=_[_0xe0e6('0x30')](_0x3eecd1[_0xe0e6('0x2b')],_0x3eecd1['query']);_0x45464[_0xe0e6('0x31')]=_[_0xe0e6('0x30')](_0x3eecd1[_0xe0e6('0x2b')],qs[_0xe0e6('0x32')](_0x1c35d9[_0xe0e6('0x2d')][_0xe0e6('0x32')]));_0x45464[_0xe0e6('0x31')]=_0x45464[_0xe0e6('0x31')][_0xe0e6('0x33')]?_0x45464[_0xe0e6('0x31')]:_0x3eecd1[_0xe0e6('0x2b')];if(_0x1c35d9[_0xe0e6('0x2d')]['includeAll']){_0x45464[_0xe0e6('0x3d')]=[{'all':!![]}];}_0x45464=_[_0xe0e6('0x39')]({},_0x45464,_0x1c35d9['options']);return db[_0xe0e6('0x29')][_0xe0e6('0x43')](_0x45464)[_0xe0e6('0x21')](handleEntityNotFound(_0x2c0a13,null))[_0xe0e6('0x21')](respondWithResult(_0x2c0a13,null))[_0xe0e6('0x40')](handleError(_0x2c0a13,null));};exports[_0xe0e6('0x44')]=function(_0x514bb,_0x5e2c5b){return db[_0xe0e6('0x29')][_0xe0e6('0x44')](_0x514bb[_0xe0e6('0x45')],{})[_0xe0e6('0x21')](function(_0x3a0413){var _0x576363=_0x514bb[_0xe0e6('0x46')][_0xe0e6('0x47')]({'plain':!![]});if(!_0x576363)throw new Error(_0xe0e6('0x48'));if(_0x576363[_0xe0e6('0x49')]===_0xe0e6('0x46')){var _0x282262=_0x3a0413['get']({'plain':!![]});var _0x557b50='Templates';return db[_0xe0e6('0x4a')]['find']({'where':{'name':_0x557b50,'userProfileId':_0x576363[_0xe0e6('0x4b')]},'raw':!![]})[_0xe0e6('0x21')](function(_0x43099a){if(_0x43099a&&_0x43099a[_0xe0e6('0x4c')]===0x0){return db[_0xe0e6('0x23')][_0xe0e6('0x44')]({'name':_0x282262[_0xe0e6('0x26')],'resourceId':_0x282262['id'],'type':_0x43099a[_0xe0e6('0x26')],'sectionId':_0x43099a['id']},{})['then'](function(){return _0x3a0413;});}else{return _0x3a0413;}})[_0xe0e6('0x40')](function(_0x467594){logger[_0xe0e6('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x467594);throw _0x467594;});}return _0x3a0413;})[_0xe0e6('0x21')](respondWithResult(_0x5e2c5b,0xc9))[_0xe0e6('0x40')](handleError(_0x5e2c5b,null));};exports[_0xe0e6('0x20')]=function(_0x21ee2e,_0x191eb9){if(_0x21ee2e[_0xe0e6('0x45')]['id']){delete _0x21ee2e[_0xe0e6('0x45')]['id'];}return db[_0xe0e6('0x29')]['find']({'where':{'id':_0x21ee2e[_0xe0e6('0x4d')]['id']}})[_0xe0e6('0x21')](handleEntityNotFound(_0x191eb9,null))['then'](saveUpdates(_0x21ee2e[_0xe0e6('0x45')],null))[_0xe0e6('0x21')](respondWithResult(_0x191eb9,null))['catch'](handleError(_0x191eb9,null));};exports['destroy']=function(_0x2c7e54,_0xc5ae8){return db[_0xe0e6('0x29')][_0xe0e6('0x43')]({'where':{'id':_0x2c7e54[_0xe0e6('0x4d')]['id']}})[_0xe0e6('0x21')](handleEntityNotFound(_0xc5ae8,null))[_0xe0e6('0x21')](removeEntity(_0xc5ae8,null))[_0xe0e6('0x40')](handleError(_0xc5ae8,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index fa05cc9..b551d4f 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 _0x08a7=['path','rimraf','../../config/environment','./template.attributes','exports','define','Template','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x38d697,_0x2d0fb6){var _0x112f82=function(_0x21e908){while(--_0x21e908){_0x38d697['push'](_0x38d697['shift']());}};_0x112f82(++_0x2d0fb6);}(_0x08a7,0x180));var _0x708a=function(_0x1668b4,_0x4055ec){_0x1668b4=_0x1668b4-0x0;var _0x3e2277=_0x08a7[_0x1668b4];return _0x3e2277;};'use strict';var _=require(_0x708a('0x0'));var util=require(_0x708a('0x1'));var logger=require(_0x708a('0x2'))(_0x708a('0x3'));var moment=require(_0x708a('0x4'));var BPromise=require(_0x708a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x708a('0x6'));var rimraf=require(_0x708a('0x7'));var config=require(_0x708a('0x8'));var attributes=require(_0x708a('0x9'));module[_0x708a('0xa')]=function(_0x13c9e8,_0x4135e9){return _0x13c9e8[_0x708a('0xb')](_0x708a('0xc'),attributes,{'tableName':'tools_templates','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfe55=['exports','Template','tools_templates','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./template.attributes'];(function(_0x747f30,_0xb65d87){var _0x3b8f2a=function(_0x23016f){while(--_0x23016f){_0x747f30['push'](_0x747f30['shift']());}};_0x3b8f2a(++_0xb65d87);}(_0xfe55,0x196));var _0x5fe5=function(_0x1269c6,_0x1c8942){_0x1269c6=_0x1269c6-0x0;var _0x4868c7=_0xfe55[_0x1269c6];return _0x4868c7;};'use strict';var _=require(_0x5fe5('0x0'));var util=require(_0x5fe5('0x1'));var logger=require(_0x5fe5('0x2'))(_0x5fe5('0x3'));var moment=require('moment');var BPromise=require(_0x5fe5('0x4'));var rp=require(_0x5fe5('0x5'));var fs=require('fs');var path=require(_0x5fe5('0x6'));var rimraf=require(_0x5fe5('0x7'));var config=require(_0x5fe5('0x8'));var attributes=require(_0x5fe5('0x9'));module[_0x5fe5('0xa')]=function(_0x2aaf26,_0x519df7){return _0x2aaf26['define'](_0x5fe5('0xb'),attributes,{'tableName':_0x5fe5('0xc'),'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 9373cc4..3692e66 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 _0x3fc5=['raw','attributes','include','map','model','GetTemplate','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','Template,\x20%s,\x20%s','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','stringify','error','message','Template','options'];(function(_0x5842c3,_0x56bd74){var _0x44bf8c=function(_0x79551f){while(--_0x79551f){_0x5842c3['push'](_0x5842c3['shift']());}};_0x44bf8c(++_0x56bd74);}(_0x3fc5,0x10c));var _0x53fc=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x3fc5[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0x53fc('0x0'));var util=require('util');var moment=require(_0x53fc('0x1'));var BPromise=require('bluebird');var rs=require(_0x53fc('0x2'));var fs=require('fs');var Redis=require(_0x53fc('0x3'));var db=require(_0x53fc('0x4'))['db'];var utils=require(_0x53fc('0x5'));var logger=require(_0x53fc('0x6'))(_0x53fc('0x7'));var config=require('../../config/environment');var jayson=require(_0x53fc('0x8'));var client=jayson[_0x53fc('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x63058e,_0x5db06e,_0x4f9a68){return new BPromise(function(_0xa64f9f,_0x31e051){return client[_0x53fc('0xa')](_0x63058e,_0x4f9a68)[_0x53fc('0xb')](function(_0x4c067f){logger[_0x53fc('0xc')](_0x53fc('0xd'),_0x5db06e,_0x53fc('0xe'));logger[_0x53fc('0xf')](_0x53fc('0x10'),_0x5db06e,_0x53fc('0xe'),JSON[_0x53fc('0x11')](_0x4c067f));if(_0x4c067f['error']){if(_0x4c067f[_0x53fc('0x12')]['code']===0x1f4){logger[_0x53fc('0x12')](_0x53fc('0xd'),_0x5db06e,_0x4c067f['error'][_0x53fc('0x13')]);return _0x31e051(_0x4c067f['error'][_0x53fc('0x13')]);}logger[_0x53fc('0x12')](_0x53fc('0xd'),_0x5db06e,_0x4c067f['error'][_0x53fc('0x13')]);return _0xa64f9f(_0x4c067f['error'][_0x53fc('0x13')]);}else{logger[_0x53fc('0xc')](_0x53fc('0xd'),_0x5db06e,_0x53fc('0xe'));_0xa64f9f(_0x4c067f['result']['message']);}})['catch'](function(_0x2ddebd){logger['error'](_0x53fc('0xd'),_0x5db06e,_0x2ddebd);_0x31e051(_0x2ddebd);});});}exports['GetTemplate']=function(_0x41c94f){var _0x2b9e51=this;return new Promise(function(_0x5e1811,_0x84e7b3){return db[_0x53fc('0x14')]['findAll']({'raw':_0x41c94f[_0x53fc('0x15')]?_0x41c94f['options'][_0x53fc('0x16')]===undefined?!![]:![]:!![],'where':_0x41c94f[_0x53fc('0x15')]?_0x41c94f[_0x53fc('0x15')]['where']||null:null,'attributes':_0x41c94f['options']?_0x41c94f[_0x53fc('0x15')][_0x53fc('0x17')]||null:null,'limit':_0x41c94f['options']?_0x41c94f[_0x53fc('0x15')]['limit']||null:null,'include':_0x41c94f[_0x53fc('0x15')]?_0x41c94f['options'][_0x53fc('0x18')]?_[_0x53fc('0x19')](_0x41c94f[_0x53fc('0x15')]['include'],function(_0x921b91){return{'model':db[_0x921b91[_0x53fc('0x1a')]],'as':_0x921b91['as'],'attributes':_0x921b91[_0x53fc('0x17')],'include':_0x921b91[_0x53fc('0x18')]?_[_0x53fc('0x19')](_0x921b91[_0x53fc('0x18')],function(_0x1c1364){return{'model':db[_0x1c1364[_0x53fc('0x1a')]],'as':_0x1c1364['as'],'attributes':_0x1c1364[_0x53fc('0x17')],'include':_0x1c1364['include']?_[_0x53fc('0x19')](_0x1c1364[_0x53fc('0x18')],function(_0x12d367){return{'model':db[_0x12d367[_0x53fc('0x1a')]],'as':_0x12d367['as'],'attributes':_0x12d367['attributes']};}):[]};}):[]};}):[]:[]})[_0x53fc('0xb')](function(_0x29af5d){logger['info'](_0x53fc('0x1b'),_0x41c94f);logger['debug'](_0x53fc('0x1b'),_0x41c94f,JSON[_0x53fc('0x11')](_0x29af5d));_0x5e1811(_0x29af5d);})[_0x53fc('0x1c')](function(_0x130c1a){logger[_0x53fc('0x12')](_0x53fc('0x1b'),_0x130c1a[_0x53fc('0x13')],_0x41c94f);_0x84e7b3(_0x2b9e51[_0x53fc('0x12')](0x1f4,_0x130c1a[_0x53fc('0x13')]));});});}; \ No newline at end of file +var _0x49f8=['client','http','info','Template,\x20%s,\x20%s','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetTemplate','Template','options','where','attributes','limit','include','map','model','then','stringify','lodash','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment'];(function(_0x157b7d,_0x30abec){var _0x1bc084=function(_0x60b767){while(--_0x60b767){_0x157b7d['push'](_0x157b7d['shift']());}};_0x1bc084(++_0x30abec);}(_0x49f8,0xff));var _0x849f=function(_0x26d398,_0x22f9b0){_0x26d398=_0x26d398-0x0;var _0x3e65f2=_0x49f8[_0x26d398];return _0x3e65f2;};'use strict';var _=require(_0x849f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x849f('0x1'));var rs=require(_0x849f('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x849f('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x849f('0x4'))('rpc');var config=require(_0x849f('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x849f('0x6')][_0x849f('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x21f577,_0xb4c798,_0x33b630){return new BPromise(function(_0xc6443e,_0x565438){return client['request'](_0x21f577,_0x33b630)['then'](function(_0x306c11){logger[_0x849f('0x8')](_0x849f('0x9'),_0xb4c798,_0x849f('0xa'));logger[_0x849f('0xb')](_0x849f('0xc'),_0xb4c798,_0x849f('0xa'),JSON['stringify'](_0x306c11));if(_0x306c11[_0x849f('0xd')]){if(_0x306c11['error'][_0x849f('0xe')]===0x1f4){logger[_0x849f('0xd')](_0x849f('0x9'),_0xb4c798,_0x306c11[_0x849f('0xd')]['message']);return _0x565438(_0x306c11[_0x849f('0xd')][_0x849f('0xf')]);}logger[_0x849f('0xd')](_0x849f('0x9'),_0xb4c798,_0x306c11[_0x849f('0xd')]['message']);return _0xc6443e(_0x306c11['error'][_0x849f('0xf')]);}else{logger['info'](_0x849f('0x9'),_0xb4c798,_0x849f('0xa'));_0xc6443e(_0x306c11[_0x849f('0x10')][_0x849f('0xf')]);}})[_0x849f('0x11')](function(_0x19ba28){logger[_0x849f('0xd')]('Template,\x20%s,\x20%s',_0xb4c798,_0x19ba28);_0x565438(_0x19ba28);});});}exports[_0x849f('0x12')]=function(_0x20bea7){var _0x189529=this;return new Promise(function(_0x541cd6,_0x1e4017){return db[_0x849f('0x13')]['findAll']({'raw':_0x20bea7[_0x849f('0x14')]?_0x20bea7[_0x849f('0x14')]['raw']===undefined?!![]:![]:!![],'where':_0x20bea7['options']?_0x20bea7[_0x849f('0x14')][_0x849f('0x15')]||null:null,'attributes':_0x20bea7[_0x849f('0x14')]?_0x20bea7[_0x849f('0x14')][_0x849f('0x16')]||null:null,'limit':_0x20bea7[_0x849f('0x14')]?_0x20bea7[_0x849f('0x14')][_0x849f('0x17')]||null:null,'include':_0x20bea7['options']?_0x20bea7[_0x849f('0x14')][_0x849f('0x18')]?_[_0x849f('0x19')](_0x20bea7[_0x849f('0x14')][_0x849f('0x18')],function(_0x4fdf55){return{'model':db[_0x4fdf55[_0x849f('0x1a')]],'as':_0x4fdf55['as'],'attributes':_0x4fdf55[_0x849f('0x16')],'include':_0x4fdf55[_0x849f('0x18')]?_[_0x849f('0x19')](_0x4fdf55[_0x849f('0x18')],function(_0x264e89){return{'model':db[_0x264e89[_0x849f('0x1a')]],'as':_0x264e89['as'],'attributes':_0x264e89[_0x849f('0x16')],'include':_0x264e89[_0x849f('0x18')]?_[_0x849f('0x19')](_0x264e89[_0x849f('0x18')],function(_0x347f4a){return{'model':db[_0x347f4a[_0x849f('0x1a')]],'as':_0x347f4a['as'],'attributes':_0x347f4a['attributes']};}):[]};}):[]};}):[]:[]})[_0x849f('0x1b')](function(_0x4aadde){logger[_0x849f('0x8')](_0x849f('0x12'),_0x20bea7);logger[_0x849f('0xb')](_0x849f('0x12'),_0x20bea7,JSON[_0x849f('0x1c')](_0x4aadde));_0x541cd6(_0x4aadde);})[_0x849f('0x11')](function(_0x5c4234){logger[_0x849f('0xd')](_0x849f('0x12'),_0x5c4234[_0x849f('0xf')],_0x20bea7);_0x1e4017(_0x189529['error'](0x1f4,_0x5c4234[_0x849f('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index dab0ad7..a5dc954 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 _0x0bf7=['put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','index','get','/:id','isAuthenticated','show','/:id/all_conditions','getAllConditions','getAnyConditions','/:id/actions','getActions','post','addAnyCondition'];(function(_0x70b942,_0x2a72cc){var _0x3b986b=function(_0x4b2363){while(--_0x4b2363){_0x70b942['push'](_0x70b942['shift']());}};_0x3b986b(++_0x2a72cc);}(_0x0bf7,0x14a));var _0x70bf=function(_0x33ba8a,_0x5a5fbe){_0x33ba8a=_0x33ba8a-0x0;var _0x399324=_0x0bf7[_0x33ba8a];return _0x399324;};'use strict';var multer=require(_0x70bf('0x0'));var util=require('util');var path=require(_0x70bf('0x1'));var timeout=require(_0x70bf('0x2'));var express=require(_0x70bf('0x3'));var router=express[_0x70bf('0x4')]();var fs_extra=require(_0x70bf('0x5'));var auth=require(_0x70bf('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x70bf('0x7'));var controller=require('./trigger.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x70bf('0x8')]);router[_0x70bf('0x9')](_0x70bf('0xa'),auth[_0x70bf('0xb')](),controller[_0x70bf('0xc')]);router[_0x70bf('0x9')](_0x70bf('0xd'),auth[_0x70bf('0xb')](),controller[_0x70bf('0xe')]);router[_0x70bf('0x9')]('/:id/any_conditions',auth['isAuthenticated'](),controller[_0x70bf('0xf')]);router['get'](_0x70bf('0x10'),auth[_0x70bf('0xb')](),controller[_0x70bf('0x11')]);router[_0x70bf('0x12')]('/',auth[_0x70bf('0xb')](),controller['create']);router[_0x70bf('0x12')](_0x70bf('0xd'),auth[_0x70bf('0xb')](),controller['addAllCondition']);router[_0x70bf('0x12')]('/:id/any_conditions',auth['isAuthenticated'](),controller[_0x70bf('0x13')]);router[_0x70bf('0x12')]('/:id/actions',auth[_0x70bf('0xb')](),controller['addAction']);router[_0x70bf('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x70bf('0x15')]);router[_0x70bf('0x16')](_0x70bf('0xa'),auth[_0x70bf('0xb')](),controller[_0x70bf('0x17')]);module[_0x70bf('0x18')]=router; \ No newline at end of file +var _0xdfaa=['put','update','delete','exports','multer','util','path','connect-timeout','Router','../../config/environment','get','isAuthenticated','index','/:id','/:id/all_conditions','getAllConditions','/:id/any_conditions','getAnyConditions','/:id/actions','post','create','addAllCondition','addAction'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xdfaa,0xa5));var _0xadfa=function(_0x53aea7,_0x2e3007){_0x53aea7=_0x53aea7-0x0;var _0x39138e=_0xdfaa[_0x53aea7];return _0x39138e;};'use strict';var multer=require(_0xadfa('0x0'));var util=require(_0xadfa('0x1'));var path=require(_0xadfa('0x2'));var timeout=require(_0xadfa('0x3'));var express=require('express');var router=express[_0xadfa('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xadfa('0x5'));var controller=require('./trigger.controller');router[_0xadfa('0x6')]('/',auth[_0xadfa('0x7')](),controller[_0xadfa('0x8')]);router['get'](_0xadfa('0x9'),auth[_0xadfa('0x7')](),controller['show']);router[_0xadfa('0x6')](_0xadfa('0xa'),auth[_0xadfa('0x7')](),controller[_0xadfa('0xb')]);router[_0xadfa('0x6')](_0xadfa('0xc'),auth[_0xadfa('0x7')](),controller[_0xadfa('0xd')]);router[_0xadfa('0x6')](_0xadfa('0xe'),auth[_0xadfa('0x7')](),controller['getActions']);router[_0xadfa('0xf')]('/',auth[_0xadfa('0x7')](),controller[_0xadfa('0x10')]);router[_0xadfa('0xf')]('/:id/all_conditions',auth['isAuthenticated'](),controller[_0xadfa('0x11')]);router[_0xadfa('0xf')](_0xadfa('0xc'),auth[_0xadfa('0x7')](),controller['addAnyCondition']);router[_0xadfa('0xf')](_0xadfa('0xe'),auth[_0xadfa('0x7')](),controller[_0xadfa('0x12')]);router[_0xadfa('0x13')]('/:id',auth[_0xadfa('0x7')](),controller[_0xadfa('0x14')]);router[_0xadfa('0x15')](_0xadfa('0x9'),auth[_0xadfa('0x7')](),controller['destroy']);module[_0xadfa('0x16')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index f85abdb..a9ef5c8 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 _0x5ab8=['exports','STRING','BOOLEAN'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x5ab8,0xed));var _0x85ab=function(_0x559cd6,_0xdec496){_0x559cd6=_0x559cd6-0x0;var _0x16c3f8=_0x5ab8[_0x559cd6];return _0x16c3f8;};'use strict';var Sequelize=require('sequelize');module[_0x85ab('0x0')]={'name':{'type':Sequelize[_0x85ab('0x1')]},'channel':{'type':Sequelize[_0x85ab('0x1')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0x85ab('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x6dac=['STRING','BOOLEAN','sequelize','exports'];(function(_0x6978dc,_0x31f14b){var _0x454eea=function(_0x5e811e){while(--_0x5e811e){_0x6978dc['push'](_0x6978dc['shift']());}};_0x454eea(++_0x31f14b);}(_0x6dac,0x16e));var _0xc6da=function(_0x4e91c0,_0x1e4d49){_0x4e91c0=_0x4e91c0-0x0;var _0x89adbe=_0x6dac[_0x4e91c0];return _0x89adbe;};'use strict';var Sequelize=require(_0xc6da('0x0'));module[_0xc6da('0x1')]={'name':{'type':Sequelize[_0xc6da('0x2')]},'channel':{'type':Sequelize[_0xc6da('0x2')]},'description':{'type':Sequelize[_0xc6da('0x2')]},'status':{'type':Sequelize[_0xc6da('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 b7a9fab..4eadc31 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 _0x2c95=['user','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addAllCondition','TriggerAllId','Condition','addAnyCondition','TriggerAnyId','getAllConditions','findOne','hasOwnProperty','getAnyConditions','addAction','TriggerId','Action','getActions','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','offset','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','Triggers','UserProfileResource','error','name','send','index','Trigger','rawAttributes','type','key','model','map','query','keys','intersection','length','attributes','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','fields','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role'];(function(_0x488fa5,_0x1024c5){var _0x2bb695=function(_0x3a4de3){while(--_0x3a4de3){_0x488fa5['push'](_0x488fa5['shift']());}};_0x2bb695(++_0x1024c5);}(_0x2c95,0x13f));var _0x52c9=function(_0x296897,_0x4d23ea){_0x296897=_0x296897-0x0;var _0x2b44ab=_0x2c95[_0x296897];return _0x2b44ab;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x52c9('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x52c9('0x1'));var rp=require(_0x52c9('0x2'));var moment=require(_0x52c9('0x3'));var BPromise=require(_0x52c9('0x4'));var Mustache=require(_0x52c9('0x5'));var util=require(_0x52c9('0x6'));var path=require(_0x52c9('0x7'));var sox=require(_0x52c9('0x8'));var csv=require(_0x52c9('0x9'));var ejs=require(_0x52c9('0xa'));var fs=require('fs');var fs_extra=require(_0x52c9('0xb'));var _=require(_0x52c9('0xc'));var squel=require(_0x52c9('0xd'));var crypto=require(_0x52c9('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x52c9('0xf'));var toCsv=require('to-csv');var querystring=require(_0x52c9('0x10'));var Papa=require(_0x52c9('0x11'));var Redis=require(_0x52c9('0x12'));var authService=require(_0x52c9('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x52c9('0x14'));var utils=require(_0x52c9('0x15'));var config=require(_0x52c9('0x16'));var licenseUtil=require(_0x52c9('0x17'));var db=require(_0x52c9('0x18'))['db'];function respondWithStatusCode(_0x4e4061,_0x4c61ae){_0x4c61ae=_0x4c61ae||0xcc;return function(_0x53cac8){if(_0x53cac8){return _0x4e4061[_0x52c9('0x19')](_0x4c61ae);}return _0x4e4061[_0x52c9('0x1a')](_0x4c61ae)[_0x52c9('0x1b')]();};}function respondWithResult(_0x35438c,_0x425c89){_0x425c89=_0x425c89||0xc8;return function(_0x4a8ec4){if(_0x4a8ec4){return _0x35438c[_0x52c9('0x1a')](_0x425c89)[_0x52c9('0x1c')](_0x4a8ec4);}};}function respondWithFilteredResult(_0x1ecbc2,_0x17f664){return function(_0x32e81f){if(_0x32e81f){var _0x3fabd4=typeof _0x17f664['offset']===_0x52c9('0x1d')&&typeof _0x17f664['limit']===_0x52c9('0x1d');var _0x1736d6=_0x32e81f['count'];var _0x3c629a=_0x3fabd4?0x0:_0x17f664[_0x52c9('0x1e')];var _0x52d95a=_0x3fabd4?_0x32e81f[_0x52c9('0x1f')]:_0x17f664[_0x52c9('0x1e')]+_0x17f664[_0x52c9('0x20')];var _0x122724;if(_0x52d95a>=_0x1736d6){_0x52d95a=_0x1736d6;_0x122724=0xc8;}else{_0x122724=0xce;}_0x1ecbc2[_0x52c9('0x1a')](_0x122724);return _0x1ecbc2[_0x52c9('0x21')](_0x52c9('0x22'),_0x3c629a+'-'+_0x52d95a+'/'+_0x1736d6)[_0x52c9('0x1c')](_0x32e81f);}return null;};}function patchUpdates(_0x59508b){return function(_0x4d81ef){try{jsonpatch[_0x52c9('0x23')](_0x4d81ef,_0x59508b,!![]);}catch(_0x1ff62d){return BPromise[_0x52c9('0x24')](_0x1ff62d);}return _0x4d81ef[_0x52c9('0x25')]();};}function saveUpdates(_0x324590,_0x16ef01){return function(_0x288eb4){if(_0x288eb4){return _0x288eb4[_0x52c9('0x26')](_0x324590)[_0x52c9('0x27')](function(_0x3a3e3f){return _0x3a3e3f;});}return null;};}function removeEntity(_0x53b444,_0x4b8833){return function(_0x4451e3){if(_0x4451e3){return _0x4451e3[_0x52c9('0x28')]()['then'](function(){var _0x5f2c2a=_0x4451e3[_0x52c9('0x29')]({'plain':!![]});var _0x198073=_0x52c9('0x2a');return db[_0x52c9('0x2b')]['destroy']({'where':{'type':_0x198073,'resourceId':_0x5f2c2a['id']}})[_0x52c9('0x27')](function(){return _0x4451e3;});})[_0x52c9('0x27')](function(){_0x53b444[_0x52c9('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4135b7,_0x1f950f){return function(_0x4c1e3b){if(!_0x4c1e3b){_0x4135b7['sendStatus'](0x194);}return _0x4c1e3b;};}function handleError(_0x2fe188,_0x378e73){_0x378e73=_0x378e73||0x1f4;return function(_0x421cec){logger[_0x52c9('0x2c')](_0x421cec['stack']);if(_0x421cec[_0x52c9('0x2d')]){delete _0x421cec[_0x52c9('0x2d')];}_0x2fe188[_0x52c9('0x1a')](_0x378e73)[_0x52c9('0x2e')](_0x421cec);};}exports[_0x52c9('0x2f')]=function(_0xbe17e9,_0x354ea0){var _0x5c0635={},_0x2a4f24={},_0x6aa0f0={'count':0x0,'rows':[]};var _0x3e187e=_['map'](db[_0x52c9('0x30')][_0x52c9('0x31')],function(_0x337089){return{'name':_0x337089['fieldName'],'type':_0x337089[_0x52c9('0x32')][_0x52c9('0x33')]};});_0x2a4f24[_0x52c9('0x34')]=_[_0x52c9('0x35')](_0x3e187e,_0x52c9('0x2d'));_0x2a4f24[_0x52c9('0x36')]=_[_0x52c9('0x37')](_0xbe17e9[_0x52c9('0x36')]);_0x2a4f24['filters']=_[_0x52c9('0x38')](_0x2a4f24[_0x52c9('0x34')],_0x2a4f24[_0x52c9('0x36')]);_0x5c0635['attributes']=_[_0x52c9('0x38')](_0x2a4f24[_0x52c9('0x34')],qs['fields'](_0xbe17e9[_0x52c9('0x36')]['fields']));_0x5c0635['attributes']=_0x5c0635['attributes'][_0x52c9('0x39')]?_0x5c0635[_0x52c9('0x3a')]:_0x2a4f24[_0x52c9('0x34')];if(!_0xbe17e9[_0x52c9('0x36')]['hasOwnProperty'](_0x52c9('0x3b'))){_0x5c0635[_0x52c9('0x20')]=qs[_0x52c9('0x20')](_0xbe17e9[_0x52c9('0x36')][_0x52c9('0x20')]);_0x5c0635[_0x52c9('0x1e')]=qs[_0x52c9('0x1e')](_0xbe17e9[_0x52c9('0x36')]['offset']);}_0x5c0635[_0x52c9('0x3c')]=qs[_0x52c9('0x3d')](_0xbe17e9[_0x52c9('0x36')][_0x52c9('0x3d')]);_0x5c0635[_0x52c9('0x3e')]=qs[_0x52c9('0x3f')](_[_0x52c9('0x40')](_0xbe17e9[_0x52c9('0x36')],_0x2a4f24[_0x52c9('0x3f')]),_0x3e187e);if(_0xbe17e9[_0x52c9('0x36')][_0x52c9('0x41')]){_0x5c0635['where']=_[_0x52c9('0x42')](_0x5c0635['where'],{'$or':_[_0x52c9('0x35')](_0x3e187e,function(_0x34805e){if(_0x34805e[_0x52c9('0x32')]!==_0x52c9('0x43')){var _0x17cf60={};_0x17cf60[_0x34805e['name']]={'$like':'%'+_0xbe17e9[_0x52c9('0x36')][_0x52c9('0x41')]+'%'};return _0x17cf60;}})});}_0x5c0635=_['merge']({},_0x5c0635,_0xbe17e9[_0x52c9('0x44')]);var _0x52f365={'where':_0x5c0635[_0x52c9('0x3e')]};return db['Trigger'][_0x52c9('0x1f')](_0x52f365)['then'](function(_0x3d2b81){_0x6aa0f0[_0x52c9('0x1f')]=_0x3d2b81;if(_0xbe17e9[_0x52c9('0x36')][_0x52c9('0x45')]){_0x5c0635[_0x52c9('0x46')]=[{'all':!![]}];}return db[_0x52c9('0x30')][_0x52c9('0x47')](_0x5c0635);})[_0x52c9('0x27')](function(_0x19b4d6){_0x6aa0f0[_0x52c9('0x48')]=_0x19b4d6;return _0x6aa0f0;})['then'](respondWithFilteredResult(_0x354ea0,_0x5c0635))['catch'](handleError(_0x354ea0,null));};exports[_0x52c9('0x49')]=function(_0x1461cb,_0x2de3e8){var _0x491eda={'raw':![],'where':{'id':_0x1461cb[_0x52c9('0x4a')]['id']}},_0xdd1fd1={};_0xdd1fd1[_0x52c9('0x34')]=_[_0x52c9('0x37')](db['Trigger'][_0x52c9('0x31')]);_0xdd1fd1['query']=_[_0x52c9('0x37')](_0x1461cb['query']);_0xdd1fd1[_0x52c9('0x3f')]=_[_0x52c9('0x38')](_0xdd1fd1[_0x52c9('0x34')],_0xdd1fd1['query']);_0x491eda[_0x52c9('0x3a')]=_['intersection'](_0xdd1fd1[_0x52c9('0x34')],qs[_0x52c9('0x4b')](_0x1461cb[_0x52c9('0x36')]['fields']));_0x491eda['attributes']=_0x491eda[_0x52c9('0x3a')][_0x52c9('0x39')]?_0x491eda[_0x52c9('0x3a')]:_0xdd1fd1[_0x52c9('0x34')];if(_0x1461cb[_0x52c9('0x36')]['includeAll']){_0x491eda[_0x52c9('0x46')]=[{'all':!![]}];}_0x491eda=_[_0x52c9('0x42')]({},_0x491eda,_0x1461cb['options']);return db[_0x52c9('0x30')]['find'](_0x491eda)[_0x52c9('0x27')](handleEntityNotFound(_0x2de3e8,null))['then'](respondWithResult(_0x2de3e8,null))[_0x52c9('0x4c')](handleError(_0x2de3e8,null));};exports[_0x52c9('0x4d')]=function(_0x58d589,_0x49e4e2){return db['Trigger'][_0x52c9('0x4d')](_0x58d589[_0x52c9('0x4e')],{})[_0x52c9('0x27')](function(_0x3e570f){var _0x470576=_0x58d589['user'][_0x52c9('0x29')]({'plain':!![]});if(!_0x470576)throw new Error(_0x52c9('0x4f'));if(_0x470576[_0x52c9('0x50')]===_0x52c9('0x51')){var _0x4abdc6=_0x3e570f[_0x52c9('0x29')]({'plain':!![]});var _0x264925=_0x52c9('0x2a');return db[_0x52c9('0x52')][_0x52c9('0x53')]({'where':{'name':_0x264925,'userProfileId':_0x470576[_0x52c9('0x54')]},'raw':!![]})['then'](function(_0x425c11){if(_0x425c11&&_0x425c11[_0x52c9('0x55')]===0x0){return db[_0x52c9('0x2b')][_0x52c9('0x4d')]({'name':_0x4abdc6['name'],'resourceId':_0x4abdc6['id'],'type':_0x425c11[_0x52c9('0x2d')],'sectionId':_0x425c11['id']},{})[_0x52c9('0x27')](function(){return _0x3e570f;});}else{return _0x3e570f;}})[_0x52c9('0x4c')](function(_0x3d3535){logger[_0x52c9('0x2c')](_0x52c9('0x56'),_0x3d3535);throw _0x3d3535;});}return _0x3e570f;})['then'](respondWithResult(_0x49e4e2,0xc9))['catch'](handleError(_0x49e4e2,null));};exports[_0x52c9('0x26')]=function(_0x265e4e,_0x42f2b7){if(_0x265e4e[_0x52c9('0x4e')]['id']){delete _0x265e4e[_0x52c9('0x4e')]['id'];}return db[_0x52c9('0x30')][_0x52c9('0x53')]({'where':{'id':_0x265e4e[_0x52c9('0x4a')]['id']}})[_0x52c9('0x27')](handleEntityNotFound(_0x42f2b7,null))[_0x52c9('0x27')](saveUpdates(_0x265e4e[_0x52c9('0x4e')],null))[_0x52c9('0x27')](respondWithResult(_0x42f2b7,null))[_0x52c9('0x4c')](handleError(_0x42f2b7,null));};exports[_0x52c9('0x28')]=function(_0x373216,_0x4836e4){return db[_0x52c9('0x30')][_0x52c9('0x53')]({'where':{'id':_0x373216['params']['id']}})[_0x52c9('0x27')](handleEntityNotFound(_0x4836e4,null))[_0x52c9('0x27')](removeEntity(_0x4836e4,null))[_0x52c9('0x4c')](handleError(_0x4836e4,null));};exports[_0x52c9('0x57')]=function(_0x260a8f,_0x1083a9,_0x477626){if(_0x260a8f[_0x52c9('0x4e')]['id']){delete _0x260a8f[_0x52c9('0x4e')]['id'];}return db[_0x52c9('0x30')]['find']({'where':{'id':_0x260a8f[_0x52c9('0x4a')]['id']}})['then'](handleEntityNotFound(_0x1083a9,null))[_0x52c9('0x27')](function(_0x4b6e1c){if(_0x4b6e1c){_0x260a8f['body'][_0x52c9('0x58')]=_0x4b6e1c['id'];return db[_0x52c9('0x59')][_0x52c9('0x4d')](_0x260a8f[_0x52c9('0x4e')]);}})[_0x52c9('0x27')](respondWithResult(_0x1083a9,null))[_0x52c9('0x4c')](handleError(_0x1083a9,null));};exports[_0x52c9('0x5a')]=function(_0x6d49d4,_0xdf203,_0x538469){if(_0x6d49d4['body']['id']){delete _0x6d49d4[_0x52c9('0x4e')]['id'];}return db[_0x52c9('0x30')][_0x52c9('0x53')]({'where':{'id':_0x6d49d4[_0x52c9('0x4a')]['id']}})['then'](handleEntityNotFound(_0xdf203,null))['then'](function(_0x1af89e){if(_0x1af89e){_0x6d49d4[_0x52c9('0x4e')][_0x52c9('0x5b')]=_0x1af89e['id'];return db[_0x52c9('0x59')]['create'](_0x6d49d4[_0x52c9('0x4e')]);}})[_0x52c9('0x27')](respondWithResult(_0xdf203,null))['catch'](handleError(_0xdf203,null));};exports[_0x52c9('0x5c')]=function(_0x8512ef,_0x314b31,_0x165a37){var _0x2e4460={};var _0x584d3c={};var _0x1f8c15;var _0x35fab2;return db['Trigger'][_0x52c9('0x5d')]({'where':{'id':_0x8512ef[_0x52c9('0x4a')]['id']}})['then'](handleEntityNotFound(_0x314b31,null))['then'](function(_0x2ffd94){if(_0x2ffd94){_0x1f8c15=_0x2ffd94;_0x584d3c[_0x52c9('0x34')]=_[_0x52c9('0x37')](db['Condition'][_0x52c9('0x31')]);_0x584d3c[_0x52c9('0x36')]=_[_0x52c9('0x37')](_0x8512ef[_0x52c9('0x36')]);_0x584d3c[_0x52c9('0x3f')]=_[_0x52c9('0x38')](_0x584d3c[_0x52c9('0x34')],_0x584d3c[_0x52c9('0x36')]);_0x2e4460[_0x52c9('0x3a')]=_[_0x52c9('0x38')](_0x584d3c['model'],qs[_0x52c9('0x4b')](_0x8512ef[_0x52c9('0x36')][_0x52c9('0x4b')]));_0x2e4460[_0x52c9('0x3a')]=_0x2e4460[_0x52c9('0x3a')][_0x52c9('0x39')]?_0x2e4460[_0x52c9('0x3a')]:_0x584d3c[_0x52c9('0x34')];_0x2e4460['order']=qs['sort'](_0x8512ef[_0x52c9('0x36')]['sort']);_0x2e4460['where']=qs['filters'](_[_0x52c9('0x40')](_0x8512ef['query'],_0x584d3c[_0x52c9('0x3f')]));if(_0x8512ef[_0x52c9('0x36')][_0x52c9('0x41')]){_0x2e4460['where']=_[_0x52c9('0x42')](_0x2e4460[_0x52c9('0x3e')],{'$or':_[_0x52c9('0x35')](_0x2e4460[_0x52c9('0x3a')],function(_0x42f949){var _0x3d3ea2={};_0x3d3ea2[_0x42f949]={'$like':'%'+_0x8512ef[_0x52c9('0x36')]['filter']+'%'};return _0x3d3ea2;})});}_0x2e4460=_[_0x52c9('0x42')]({},_0x2e4460,_0x8512ef[_0x52c9('0x44')]);return _0x1f8c15[_0x52c9('0x5c')](_0x2e4460);}})[_0x52c9('0x27')](function(_0x2b6069){if(_0x2b6069){_0x35fab2=_0x2b6069[_0x52c9('0x39')];if(!_0x8512ef[_0x52c9('0x36')][_0x52c9('0x5e')](_0x52c9('0x3b'))){_0x2e4460[_0x52c9('0x20')]=qs[_0x52c9('0x20')](_0x8512ef[_0x52c9('0x36')][_0x52c9('0x20')]);_0x2e4460[_0x52c9('0x1e')]=qs[_0x52c9('0x1e')](_0x8512ef[_0x52c9('0x36')][_0x52c9('0x1e')]);}return _0x1f8c15[_0x52c9('0x5c')](_0x2e4460);}})[_0x52c9('0x27')](function(_0x49b664){if(_0x49b664){return _0x49b664?{'count':_0x35fab2,'rows':_0x49b664}:null;}})['then'](respondWithResult(_0x314b31,null))[_0x52c9('0x4c')](handleError(_0x314b31,null));};exports['getAnyConditions']=function(_0x4dc197,_0x14d56f,_0x4ec7ff){var _0x22c823={};var _0x4fefb1={};var _0x3ad94f;var _0x12e0f8;return db[_0x52c9('0x30')][_0x52c9('0x5d')]({'where':{'id':_0x4dc197[_0x52c9('0x4a')]['id']}})['then'](handleEntityNotFound(_0x14d56f,null))[_0x52c9('0x27')](function(_0x51cbc2){if(_0x51cbc2){_0x3ad94f=_0x51cbc2;_0x4fefb1[_0x52c9('0x34')]=_['keys'](db[_0x52c9('0x59')][_0x52c9('0x31')]);_0x4fefb1[_0x52c9('0x36')]=_[_0x52c9('0x37')](_0x4dc197['query']);_0x4fefb1[_0x52c9('0x3f')]=_[_0x52c9('0x38')](_0x4fefb1[_0x52c9('0x34')],_0x4fefb1['query']);_0x22c823[_0x52c9('0x3a')]=_['intersection'](_0x4fefb1[_0x52c9('0x34')],qs[_0x52c9('0x4b')](_0x4dc197[_0x52c9('0x36')][_0x52c9('0x4b')]));_0x22c823[_0x52c9('0x3a')]=_0x22c823[_0x52c9('0x3a')][_0x52c9('0x39')]?_0x22c823[_0x52c9('0x3a')]:_0x4fefb1[_0x52c9('0x34')];_0x22c823[_0x52c9('0x3c')]=qs[_0x52c9('0x3d')](_0x4dc197[_0x52c9('0x36')][_0x52c9('0x3d')]);_0x22c823[_0x52c9('0x3e')]=qs['filters'](_[_0x52c9('0x40')](_0x4dc197[_0x52c9('0x36')],_0x4fefb1[_0x52c9('0x3f')]));if(_0x4dc197[_0x52c9('0x36')][_0x52c9('0x41')]){_0x22c823[_0x52c9('0x3e')]=_[_0x52c9('0x42')](_0x22c823[_0x52c9('0x3e')],{'$or':_[_0x52c9('0x35')](_0x22c823[_0x52c9('0x3a')],function(_0x4372ac){var _0x188589={};_0x188589[_0x4372ac]={'$like':'%'+_0x4dc197[_0x52c9('0x36')][_0x52c9('0x41')]+'%'};return _0x188589;})});}_0x22c823=_[_0x52c9('0x42')]({},_0x22c823,_0x4dc197[_0x52c9('0x44')]);return _0x3ad94f[_0x52c9('0x5f')](_0x22c823);}})['then'](function(_0x41daad){if(_0x41daad){_0x12e0f8=_0x41daad['length'];if(!_0x4dc197['query'][_0x52c9('0x5e')]('nolimit')){_0x22c823[_0x52c9('0x20')]=qs[_0x52c9('0x20')](_0x4dc197[_0x52c9('0x36')][_0x52c9('0x20')]);_0x22c823['offset']=qs[_0x52c9('0x1e')](_0x4dc197[_0x52c9('0x36')][_0x52c9('0x1e')]);}return _0x3ad94f['getAnyConditions'](_0x22c823);}})[_0x52c9('0x27')](function(_0x1e7a1f){if(_0x1e7a1f){return _0x1e7a1f?{'count':_0x12e0f8,'rows':_0x1e7a1f}:null;}})[_0x52c9('0x27')](respondWithResult(_0x14d56f,null))[_0x52c9('0x4c')](handleError(_0x14d56f,null));};exports[_0x52c9('0x60')]=function(_0x1ef96b,_0x390d57,_0x5cdee4){if(_0x1ef96b[_0x52c9('0x4e')]['id']){delete _0x1ef96b[_0x52c9('0x4e')]['id'];}return db[_0x52c9('0x30')]['find']({'where':{'id':_0x1ef96b[_0x52c9('0x4a')]['id']}})['then'](handleEntityNotFound(_0x390d57,null))['then'](function(_0x1cb1f6){if(_0x1cb1f6){_0x1ef96b[_0x52c9('0x4e')][_0x52c9('0x61')]=_0x1cb1f6['id'];return db[_0x52c9('0x62')]['create'](_0x1ef96b[_0x52c9('0x4e')]);}})[_0x52c9('0x27')](respondWithResult(_0x390d57,null))[_0x52c9('0x4c')](handleError(_0x390d57,null));};exports[_0x52c9('0x63')]=function(_0x469bbe,_0x3cabe2,_0x1440f1){var _0x4ef62b={};var _0x10e349={};var _0x1e6c28;var _0x189ca6;return db[_0x52c9('0x30')][_0x52c9('0x5d')]({'where':{'id':_0x469bbe['params']['id']}})[_0x52c9('0x27')](handleEntityNotFound(_0x3cabe2,null))[_0x52c9('0x27')](function(_0x2112a1){if(_0x2112a1){_0x1e6c28=_0x2112a1;_0x10e349[_0x52c9('0x34')]=_[_0x52c9('0x37')](db[_0x52c9('0x62')][_0x52c9('0x31')]);_0x10e349['query']=_[_0x52c9('0x37')](_0x469bbe[_0x52c9('0x36')]);_0x10e349[_0x52c9('0x3f')]=_[_0x52c9('0x38')](_0x10e349[_0x52c9('0x34')],_0x10e349[_0x52c9('0x36')]);_0x4ef62b['attributes']=_['intersection'](_0x10e349['model'],qs[_0x52c9('0x4b')](_0x469bbe[_0x52c9('0x36')]['fields']));_0x4ef62b[_0x52c9('0x3a')]=_0x4ef62b[_0x52c9('0x3a')]['length']?_0x4ef62b[_0x52c9('0x3a')]:_0x10e349[_0x52c9('0x34')];_0x4ef62b[_0x52c9('0x3c')]=qs['sort'](_0x469bbe[_0x52c9('0x36')][_0x52c9('0x3d')]);_0x4ef62b[_0x52c9('0x3e')]=qs[_0x52c9('0x3f')](_[_0x52c9('0x40')](_0x469bbe[_0x52c9('0x36')],_0x10e349['filters']));if(_0x469bbe[_0x52c9('0x36')][_0x52c9('0x41')]){_0x4ef62b[_0x52c9('0x3e')]=_[_0x52c9('0x42')](_0x4ef62b[_0x52c9('0x3e')],{'$or':_['map'](_0x4ef62b[_0x52c9('0x3a')],function(_0x154940){var _0x21b585={};_0x21b585[_0x154940]={'$like':'%'+_0x469bbe[_0x52c9('0x36')][_0x52c9('0x41')]+'%'};return _0x21b585;})});}_0x4ef62b=_[_0x52c9('0x42')]({},_0x4ef62b,_0x469bbe[_0x52c9('0x44')]);return _0x1e6c28[_0x52c9('0x63')](_0x4ef62b);}})['then'](function(_0x4e85bc){if(_0x4e85bc){_0x189ca6=_0x4e85bc[_0x52c9('0x39')];if(!_0x469bbe['query'][_0x52c9('0x5e')]('nolimit')){_0x4ef62b[_0x52c9('0x20')]=qs['limit'](_0x469bbe[_0x52c9('0x36')]['limit']);_0x4ef62b[_0x52c9('0x1e')]=qs[_0x52c9('0x1e')](_0x469bbe[_0x52c9('0x36')][_0x52c9('0x1e')]);}return _0x1e6c28['getActions'](_0x4ef62b);}})['then'](function(_0x3a136c){if(_0x3a136c){return _0x3a136c?{'count':_0x189ca6,'rows':_0x3a136c}:null;}})[_0x52c9('0x27')](respondWithResult(_0x3cabe2,null))[_0x52c9('0x4c')](handleError(_0x3cabe2,null));}; \ No newline at end of file +var _0x48b2=['jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','Content-Range','apply','reject','save','update','then','get','Triggers','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','keys','query','filters','intersection','fields','attributes','length','order','sort','where','pick','merge','type','VIRTUAL','Trigger','count','includeAll','include','findAll','rows','catch','show','params','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','addAllCondition','addAnyCondition','TriggerAnyId','Condition','getAllConditions','findOne','filter','hasOwnProperty','nolimit','getAnyConditions','addAction','TriggerId','Action','getActions','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto'];(function(_0x377e73,_0x5cd510){var _0x3cbf3f=function(_0x76a59e){while(--_0x76a59e){_0x377e73['push'](_0x377e73['shift']());}};_0x3cbf3f(++_0x5cd510);}(_0x48b2,0x185));var _0x248b=function(_0x250c18,_0x12e8bf){_0x250c18=_0x250c18-0x0;var _0x5b1b45=_0x48b2[_0x250c18];return _0x5b1b45;};'use strict';var emlformat=require(_0x248b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x248b('0x1'));var jsonpatch=require(_0x248b('0x2'));var rp=require(_0x248b('0x3'));var moment=require(_0x248b('0x4'));var BPromise=require(_0x248b('0x5'));var Mustache=require(_0x248b('0x6'));var util=require(_0x248b('0x7'));var path=require(_0x248b('0x8'));var sox=require(_0x248b('0x9'));var csv=require(_0x248b('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x248b('0xb'));var _=require(_0x248b('0xc'));var squel=require(_0x248b('0xd'));var crypto=require(_0x248b('0xe'));var jsforce=require(_0x248b('0xf'));var deskjs=require(_0x248b('0x10'));var toCsv=require('to-csv');var querystring=require(_0x248b('0x11'));var Papa=require(_0x248b('0x12'));var Redis=require(_0x248b('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x248b('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x248b('0x15'));var logger=require(_0x248b('0x16'))(_0x248b('0x17'));var utils=require(_0x248b('0x18'));var config=require(_0x248b('0x19'));var licenseUtil=require(_0x248b('0x1a'));var db=require(_0x248b('0x1b'))['db'];function respondWithStatusCode(_0x5647dc,_0x38ff9d){_0x38ff9d=_0x38ff9d||0xcc;return function(_0xb61f6c){if(_0xb61f6c){return _0x5647dc[_0x248b('0x1c')](_0x38ff9d);}return _0x5647dc[_0x248b('0x1d')](_0x38ff9d)[_0x248b('0x1e')]();};}function respondWithResult(_0x3f2465,_0x205993){_0x205993=_0x205993||0xc8;return function(_0x101059){if(_0x101059){return _0x3f2465['status'](_0x205993)[_0x248b('0x1f')](_0x101059);}};}function respondWithFilteredResult(_0x58f977,_0x23fe70){return function(_0x58a492){if(_0x58a492){var _0x39f9d7=typeof _0x23fe70[_0x248b('0x20')]===_0x248b('0x21')&&typeof _0x23fe70[_0x248b('0x22')]===_0x248b('0x21');var _0x5cbb0b=_0x58a492['count'];var _0xa89c48=_0x39f9d7?0x0:_0x23fe70[_0x248b('0x20')];var _0x5def8a=_0x39f9d7?_0x58a492['count']:_0x23fe70[_0x248b('0x20')]+_0x23fe70[_0x248b('0x22')];var _0x256521;if(_0x5def8a>=_0x5cbb0b){_0x5def8a=_0x5cbb0b;_0x256521=0xc8;}else{_0x256521=0xce;}_0x58f977[_0x248b('0x1d')](_0x256521);return _0x58f977['set'](_0x248b('0x23'),_0xa89c48+'-'+_0x5def8a+'/'+_0x5cbb0b)[_0x248b('0x1f')](_0x58a492);}return null;};}function patchUpdates(_0x3062e2){return function(_0x5d7bc2){try{jsonpatch[_0x248b('0x24')](_0x5d7bc2,_0x3062e2,!![]);}catch(_0x5af86b){return BPromise[_0x248b('0x25')](_0x5af86b);}return _0x5d7bc2[_0x248b('0x26')]();};}function saveUpdates(_0x138d99,_0x1bc2bf){return function(_0x487c23){if(_0x487c23){return _0x487c23[_0x248b('0x27')](_0x138d99)[_0x248b('0x28')](function(_0x28d7d5){return _0x28d7d5;});}return null;};}function removeEntity(_0x4f8571,_0x146f35){return function(_0x238cd5){if(_0x238cd5){return _0x238cd5['destroy']()[_0x248b('0x28')](function(){var _0x53278b=_0x238cd5[_0x248b('0x29')]({'plain':!![]});var _0x4d544f=_0x248b('0x2a');return db[_0x248b('0x2b')]['destroy']({'where':{'type':_0x4d544f,'resourceId':_0x53278b['id']}})[_0x248b('0x28')](function(){return _0x238cd5;});})[_0x248b('0x28')](function(){_0x4f8571[_0x248b('0x1d')](0xcc)[_0x248b('0x1e')]();});}};}function handleEntityNotFound(_0x5e399d,_0xdbecd1){return function(_0x2695fd){if(!_0x2695fd){_0x5e399d[_0x248b('0x1c')](0x194);}return _0x2695fd;};}function handleError(_0x1372fd,_0x12dcbb){_0x12dcbb=_0x12dcbb||0x1f4;return function(_0x1eac59){logger[_0x248b('0x2c')](_0x1eac59[_0x248b('0x2d')]);if(_0x1eac59['name']){delete _0x1eac59[_0x248b('0x2e')];}_0x1372fd[_0x248b('0x1d')](_0x12dcbb)[_0x248b('0x2f')](_0x1eac59);};}exports[_0x248b('0x30')]=function(_0x43654d,_0x5db0b7){var _0x420782={},_0x410b95={},_0xfcca5f={'count':0x0,'rows':[]};var _0x547550=_[_0x248b('0x31')](db['Trigger'][_0x248b('0x32')],function(_0x2d0337){return{'name':_0x2d0337[_0x248b('0x33')],'type':_0x2d0337['type'][_0x248b('0x34')]};});_0x410b95[_0x248b('0x35')]=_[_0x248b('0x31')](_0x547550,_0x248b('0x2e'));_0x410b95['query']=_[_0x248b('0x36')](_0x43654d[_0x248b('0x37')]);_0x410b95[_0x248b('0x38')]=_[_0x248b('0x39')](_0x410b95[_0x248b('0x35')],_0x410b95['query']);_0x420782['attributes']=_[_0x248b('0x39')](_0x410b95['model'],qs[_0x248b('0x3a')](_0x43654d[_0x248b('0x37')]['fields']));_0x420782['attributes']=_0x420782[_0x248b('0x3b')][_0x248b('0x3c')]?_0x420782[_0x248b('0x3b')]:_0x410b95[_0x248b('0x35')];if(!_0x43654d[_0x248b('0x37')]['hasOwnProperty']('nolimit')){_0x420782[_0x248b('0x22')]=qs[_0x248b('0x22')](_0x43654d['query'][_0x248b('0x22')]);_0x420782[_0x248b('0x20')]=qs[_0x248b('0x20')](_0x43654d[_0x248b('0x37')][_0x248b('0x20')]);}_0x420782[_0x248b('0x3d')]=qs[_0x248b('0x3e')](_0x43654d['query'][_0x248b('0x3e')]);_0x420782[_0x248b('0x3f')]=qs[_0x248b('0x38')](_[_0x248b('0x40')](_0x43654d[_0x248b('0x37')],_0x410b95[_0x248b('0x38')]),_0x547550);if(_0x43654d[_0x248b('0x37')]['filter']){_0x420782[_0x248b('0x3f')]=_[_0x248b('0x41')](_0x420782[_0x248b('0x3f')],{'$or':_[_0x248b('0x31')](_0x547550,function(_0x1cb0c9){if(_0x1cb0c9[_0x248b('0x42')]!==_0x248b('0x43')){var _0x2f16fa={};_0x2f16fa[_0x1cb0c9[_0x248b('0x2e')]]={'$like':'%'+_0x43654d['query']['filter']+'%'};return _0x2f16fa;}})});}_0x420782=_[_0x248b('0x41')]({},_0x420782,_0x43654d['options']);var _0x3cdb17={'where':_0x420782['where']};return db[_0x248b('0x44')][_0x248b('0x45')](_0x3cdb17)[_0x248b('0x28')](function(_0x43daab){_0xfcca5f['count']=_0x43daab;if(_0x43654d['query'][_0x248b('0x46')]){_0x420782[_0x248b('0x47')]=[{'all':!![]}];}return db[_0x248b('0x44')][_0x248b('0x48')](_0x420782);})['then'](function(_0x5ad67b){_0xfcca5f[_0x248b('0x49')]=_0x5ad67b;return _0xfcca5f;})[_0x248b('0x28')](respondWithFilteredResult(_0x5db0b7,_0x420782))[_0x248b('0x4a')](handleError(_0x5db0b7,null));};exports[_0x248b('0x4b')]=function(_0x392705,_0x3e1b1c){var _0x1bd735={'raw':![],'where':{'id':_0x392705[_0x248b('0x4c')]['id']}},_0x149415={};_0x149415[_0x248b('0x35')]=_['keys'](db[_0x248b('0x44')][_0x248b('0x32')]);_0x149415[_0x248b('0x37')]=_['keys'](_0x392705[_0x248b('0x37')]);_0x149415[_0x248b('0x38')]=_[_0x248b('0x39')](_0x149415[_0x248b('0x35')],_0x149415['query']);_0x1bd735[_0x248b('0x3b')]=_[_0x248b('0x39')](_0x149415[_0x248b('0x35')],qs[_0x248b('0x3a')](_0x392705['query'][_0x248b('0x3a')]));_0x1bd735[_0x248b('0x3b')]=_0x1bd735[_0x248b('0x3b')][_0x248b('0x3c')]?_0x1bd735[_0x248b('0x3b')]:_0x149415[_0x248b('0x35')];if(_0x392705[_0x248b('0x37')][_0x248b('0x46')]){_0x1bd735[_0x248b('0x47')]=[{'all':!![]}];}_0x1bd735=_[_0x248b('0x41')]({},_0x1bd735,_0x392705[_0x248b('0x4d')]);return db[_0x248b('0x44')]['find'](_0x1bd735)['then'](handleEntityNotFound(_0x3e1b1c,null))[_0x248b('0x28')](respondWithResult(_0x3e1b1c,null))[_0x248b('0x4a')](handleError(_0x3e1b1c,null));};exports[_0x248b('0x4e')]=function(_0x3b61f5,_0x2fb960){return db[_0x248b('0x44')][_0x248b('0x4e')](_0x3b61f5[_0x248b('0x4f')],{})[_0x248b('0x28')](function(_0x527e4a){var _0x563b5b=_0x3b61f5[_0x248b('0x50')]['get']({'plain':!![]});if(!_0x563b5b)throw new Error(_0x248b('0x51'));if(_0x563b5b[_0x248b('0x52')]===_0x248b('0x50')){var _0x518783=_0x527e4a['get']({'plain':!![]});var _0x48b2e7=_0x248b('0x2a');return db[_0x248b('0x53')][_0x248b('0x54')]({'where':{'name':_0x48b2e7,'userProfileId':_0x563b5b[_0x248b('0x55')]},'raw':!![]})['then'](function(_0x22aabb){if(_0x22aabb&&_0x22aabb['autoAssociation']===0x0){return db[_0x248b('0x2b')][_0x248b('0x4e')]({'name':_0x518783[_0x248b('0x2e')],'resourceId':_0x518783['id'],'type':_0x22aabb[_0x248b('0x2e')],'sectionId':_0x22aabb['id']},{})[_0x248b('0x28')](function(){return _0x527e4a;});}else{return _0x527e4a;}})[_0x248b('0x4a')](function(_0x3f28f1){logger[_0x248b('0x2c')](_0x248b('0x56'),_0x3f28f1);throw _0x3f28f1;});}return _0x527e4a;})[_0x248b('0x28')](respondWithResult(_0x2fb960,0xc9))[_0x248b('0x4a')](handleError(_0x2fb960,null));};exports['update']=function(_0x33c01,_0x12ebae){if(_0x33c01['body']['id']){delete _0x33c01[_0x248b('0x4f')]['id'];}return db['Trigger'][_0x248b('0x54')]({'where':{'id':_0x33c01[_0x248b('0x4c')]['id']}})[_0x248b('0x28')](handleEntityNotFound(_0x12ebae,null))[_0x248b('0x28')](saveUpdates(_0x33c01[_0x248b('0x4f')],null))[_0x248b('0x28')](respondWithResult(_0x12ebae,null))[_0x248b('0x4a')](handleError(_0x12ebae,null));};exports['destroy']=function(_0x1d4acc,_0x3677dd){return db[_0x248b('0x44')][_0x248b('0x54')]({'where':{'id':_0x1d4acc[_0x248b('0x4c')]['id']}})[_0x248b('0x28')](handleEntityNotFound(_0x3677dd,null))['then'](removeEntity(_0x3677dd,null))[_0x248b('0x4a')](handleError(_0x3677dd,null));};exports[_0x248b('0x57')]=function(_0x130426,_0x5f56dc,_0x32fd14){if(_0x130426[_0x248b('0x4f')]['id']){delete _0x130426[_0x248b('0x4f')]['id'];}return db[_0x248b('0x44')][_0x248b('0x54')]({'where':{'id':_0x130426[_0x248b('0x4c')]['id']}})['then'](handleEntityNotFound(_0x5f56dc,null))['then'](function(_0x584030){if(_0x584030){_0x130426[_0x248b('0x4f')]['TriggerAllId']=_0x584030['id'];return db['Condition'][_0x248b('0x4e')](_0x130426[_0x248b('0x4f')]);}})[_0x248b('0x28')](respondWithResult(_0x5f56dc,null))[_0x248b('0x4a')](handleError(_0x5f56dc,null));};exports[_0x248b('0x58')]=function(_0x2f996e,_0xbe3171,_0x5d1bbb){if(_0x2f996e[_0x248b('0x4f')]['id']){delete _0x2f996e[_0x248b('0x4f')]['id'];}return db[_0x248b('0x44')][_0x248b('0x54')]({'where':{'id':_0x2f996e[_0x248b('0x4c')]['id']}})[_0x248b('0x28')](handleEntityNotFound(_0xbe3171,null))['then'](function(_0x510e09){if(_0x510e09){_0x2f996e[_0x248b('0x4f')][_0x248b('0x59')]=_0x510e09['id'];return db[_0x248b('0x5a')][_0x248b('0x4e')](_0x2f996e[_0x248b('0x4f')]);}})[_0x248b('0x28')](respondWithResult(_0xbe3171,null))[_0x248b('0x4a')](handleError(_0xbe3171,null));};exports[_0x248b('0x5b')]=function(_0x16a1ed,_0x4967a7,_0x4c1241){var _0x76dc4f={};var _0xf23b3={};var _0x2eaf1c;var _0x561179;return db['Trigger'][_0x248b('0x5c')]({'where':{'id':_0x16a1ed[_0x248b('0x4c')]['id']}})['then'](handleEntityNotFound(_0x4967a7,null))[_0x248b('0x28')](function(_0x13ce00){if(_0x13ce00){_0x2eaf1c=_0x13ce00;_0xf23b3['model']=_[_0x248b('0x36')](db[_0x248b('0x5a')][_0x248b('0x32')]);_0xf23b3[_0x248b('0x37')]=_['keys'](_0x16a1ed[_0x248b('0x37')]);_0xf23b3['filters']=_[_0x248b('0x39')](_0xf23b3[_0x248b('0x35')],_0xf23b3[_0x248b('0x37')]);_0x76dc4f['attributes']=_[_0x248b('0x39')](_0xf23b3[_0x248b('0x35')],qs[_0x248b('0x3a')](_0x16a1ed[_0x248b('0x37')]['fields']));_0x76dc4f['attributes']=_0x76dc4f['attributes'][_0x248b('0x3c')]?_0x76dc4f[_0x248b('0x3b')]:_0xf23b3[_0x248b('0x35')];_0x76dc4f['order']=qs[_0x248b('0x3e')](_0x16a1ed[_0x248b('0x37')]['sort']);_0x76dc4f['where']=qs[_0x248b('0x38')](_[_0x248b('0x40')](_0x16a1ed[_0x248b('0x37')],_0xf23b3[_0x248b('0x38')]));if(_0x16a1ed[_0x248b('0x37')][_0x248b('0x5d')]){_0x76dc4f['where']=_[_0x248b('0x41')](_0x76dc4f[_0x248b('0x3f')],{'$or':_[_0x248b('0x31')](_0x76dc4f['attributes'],function(_0x397c9f){var _0x4d5582={};_0x4d5582[_0x397c9f]={'$like':'%'+_0x16a1ed[_0x248b('0x37')][_0x248b('0x5d')]+'%'};return _0x4d5582;})});}_0x76dc4f=_[_0x248b('0x41')]({},_0x76dc4f,_0x16a1ed[_0x248b('0x4d')]);return _0x2eaf1c[_0x248b('0x5b')](_0x76dc4f);}})['then'](function(_0x220001){if(_0x220001){_0x561179=_0x220001[_0x248b('0x3c')];if(!_0x16a1ed[_0x248b('0x37')][_0x248b('0x5e')](_0x248b('0x5f'))){_0x76dc4f['limit']=qs[_0x248b('0x22')](_0x16a1ed[_0x248b('0x37')][_0x248b('0x22')]);_0x76dc4f[_0x248b('0x20')]=qs['offset'](_0x16a1ed['query'][_0x248b('0x20')]);}return _0x2eaf1c[_0x248b('0x5b')](_0x76dc4f);}})[_0x248b('0x28')](function(_0x4eb14f){if(_0x4eb14f){return _0x4eb14f?{'count':_0x561179,'rows':_0x4eb14f}:null;}})[_0x248b('0x28')](respondWithResult(_0x4967a7,null))['catch'](handleError(_0x4967a7,null));};exports[_0x248b('0x60')]=function(_0x2870b4,_0x44a236,_0x1f1dab){var _0x249742={};var _0x3d5855={};var _0x56ebf2;var _0x192692;return db[_0x248b('0x44')][_0x248b('0x5c')]({'where':{'id':_0x2870b4[_0x248b('0x4c')]['id']}})[_0x248b('0x28')](handleEntityNotFound(_0x44a236,null))['then'](function(_0x51849e){if(_0x51849e){_0x56ebf2=_0x51849e;_0x3d5855['model']=_['keys'](db['Condition']['rawAttributes']);_0x3d5855[_0x248b('0x37')]=_[_0x248b('0x36')](_0x2870b4[_0x248b('0x37')]);_0x3d5855[_0x248b('0x38')]=_['intersection'](_0x3d5855[_0x248b('0x35')],_0x3d5855[_0x248b('0x37')]);_0x249742['attributes']=_['intersection'](_0x3d5855[_0x248b('0x35')],qs[_0x248b('0x3a')](_0x2870b4[_0x248b('0x37')]['fields']));_0x249742['attributes']=_0x249742['attributes'][_0x248b('0x3c')]?_0x249742[_0x248b('0x3b')]:_0x3d5855[_0x248b('0x35')];_0x249742[_0x248b('0x3d')]=qs[_0x248b('0x3e')](_0x2870b4[_0x248b('0x37')]['sort']);_0x249742['where']=qs[_0x248b('0x38')](_[_0x248b('0x40')](_0x2870b4[_0x248b('0x37')],_0x3d5855[_0x248b('0x38')]));if(_0x2870b4['query'][_0x248b('0x5d')]){_0x249742[_0x248b('0x3f')]=_[_0x248b('0x41')](_0x249742[_0x248b('0x3f')],{'$or':_[_0x248b('0x31')](_0x249742[_0x248b('0x3b')],function(_0x298f75){var _0x36d110={};_0x36d110[_0x298f75]={'$like':'%'+_0x2870b4[_0x248b('0x37')]['filter']+'%'};return _0x36d110;})});}_0x249742=_['merge']({},_0x249742,_0x2870b4['options']);return _0x56ebf2['getAnyConditions'](_0x249742);}})[_0x248b('0x28')](function(_0x5147e7){if(_0x5147e7){_0x192692=_0x5147e7[_0x248b('0x3c')];if(!_0x2870b4[_0x248b('0x37')][_0x248b('0x5e')](_0x248b('0x5f'))){_0x249742[_0x248b('0x22')]=qs[_0x248b('0x22')](_0x2870b4[_0x248b('0x37')][_0x248b('0x22')]);_0x249742[_0x248b('0x20')]=qs[_0x248b('0x20')](_0x2870b4['query'][_0x248b('0x20')]);}return _0x56ebf2[_0x248b('0x60')](_0x249742);}})[_0x248b('0x28')](function(_0x12fe5a){if(_0x12fe5a){return _0x12fe5a?{'count':_0x192692,'rows':_0x12fe5a}:null;}})[_0x248b('0x28')](respondWithResult(_0x44a236,null))[_0x248b('0x4a')](handleError(_0x44a236,null));};exports[_0x248b('0x61')]=function(_0x5b9452,_0x230a76,_0x306b9d){if(_0x5b9452[_0x248b('0x4f')]['id']){delete _0x5b9452[_0x248b('0x4f')]['id'];}return db[_0x248b('0x44')][_0x248b('0x54')]({'where':{'id':_0x5b9452[_0x248b('0x4c')]['id']}})[_0x248b('0x28')](handleEntityNotFound(_0x230a76,null))['then'](function(_0x8a19a5){if(_0x8a19a5){_0x5b9452['body'][_0x248b('0x62')]=_0x8a19a5['id'];return db[_0x248b('0x63')][_0x248b('0x4e')](_0x5b9452['body']);}})['then'](respondWithResult(_0x230a76,null))[_0x248b('0x4a')](handleError(_0x230a76,null));};exports[_0x248b('0x64')]=function(_0x3c1f7d,_0x35e6dd,_0x5af33c){var _0x2eae65={};var _0x1bcbd6={};var _0x1d3376;var _0x1d877d;return db[_0x248b('0x44')][_0x248b('0x5c')]({'where':{'id':_0x3c1f7d[_0x248b('0x4c')]['id']}})[_0x248b('0x28')](handleEntityNotFound(_0x35e6dd,null))[_0x248b('0x28')](function(_0x152e37){if(_0x152e37){_0x1d3376=_0x152e37;_0x1bcbd6[_0x248b('0x35')]=_[_0x248b('0x36')](db['Action'][_0x248b('0x32')]);_0x1bcbd6[_0x248b('0x37')]=_['keys'](_0x3c1f7d[_0x248b('0x37')]);_0x1bcbd6[_0x248b('0x38')]=_['intersection'](_0x1bcbd6['model'],_0x1bcbd6[_0x248b('0x37')]);_0x2eae65[_0x248b('0x3b')]=_[_0x248b('0x39')](_0x1bcbd6[_0x248b('0x35')],qs['fields'](_0x3c1f7d[_0x248b('0x37')][_0x248b('0x3a')]));_0x2eae65[_0x248b('0x3b')]=_0x2eae65[_0x248b('0x3b')][_0x248b('0x3c')]?_0x2eae65['attributes']:_0x1bcbd6[_0x248b('0x35')];_0x2eae65[_0x248b('0x3d')]=qs['sort'](_0x3c1f7d[_0x248b('0x37')]['sort']);_0x2eae65[_0x248b('0x3f')]=qs[_0x248b('0x38')](_[_0x248b('0x40')](_0x3c1f7d['query'],_0x1bcbd6[_0x248b('0x38')]));if(_0x3c1f7d[_0x248b('0x37')][_0x248b('0x5d')]){_0x2eae65[_0x248b('0x3f')]=_[_0x248b('0x41')](_0x2eae65[_0x248b('0x3f')],{'$or':_[_0x248b('0x31')](_0x2eae65[_0x248b('0x3b')],function(_0x50cbed){var _0x4e49e4={};_0x4e49e4[_0x50cbed]={'$like':'%'+_0x3c1f7d[_0x248b('0x37')][_0x248b('0x5d')]+'%'};return _0x4e49e4;})});}_0x2eae65=_['merge']({},_0x2eae65,_0x3c1f7d[_0x248b('0x4d')]);return _0x1d3376['getActions'](_0x2eae65);}})[_0x248b('0x28')](function(_0x2ad892){if(_0x2ad892){_0x1d877d=_0x2ad892[_0x248b('0x3c')];if(!_0x3c1f7d[_0x248b('0x37')][_0x248b('0x5e')](_0x248b('0x5f'))){_0x2eae65['limit']=qs['limit'](_0x3c1f7d[_0x248b('0x37')][_0x248b('0x22')]);_0x2eae65[_0x248b('0x20')]=qs[_0x248b('0x20')](_0x3c1f7d[_0x248b('0x37')]['offset']);}return _0x1d3376[_0x248b('0x64')](_0x2eae65);}})[_0x248b('0x28')](function(_0xb2cbcc){if(_0xb2cbcc){return _0xb2cbcc?{'count':_0x1d877d,'rows':_0xb2cbcc}:null;}})['then'](respondWithResult(_0x35e6dd,null))[_0x248b('0x4a')](handleError(_0x35e6dd,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index 876677a..01ac096 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 _0xd8ee=['exports','define','Trigger','tools_triggers','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./trigger.attributes'];(function(_0x3da267,_0x1037b0){var _0x467fdb=function(_0x2ede7a){while(--_0x2ede7a){_0x3da267['push'](_0x3da267['shift']());}};_0x467fdb(++_0x1037b0);}(_0xd8ee,0x1f2));var _0xed8e=function(_0x548cfa,_0x55d716){_0x548cfa=_0x548cfa-0x0;var _0x7b3d22=_0xd8ee[_0x548cfa];return _0x7b3d22;};'use strict';var _=require(_0xed8e('0x0'));var util=require('util');var logger=require(_0xed8e('0x1'))(_0xed8e('0x2'));var moment=require(_0xed8e('0x3'));var BPromise=require('bluebird');var rp=require(_0xed8e('0x4'));var fs=require('fs');var path=require(_0xed8e('0x5'));var rimraf=require(_0xed8e('0x6'));var config=require(_0xed8e('0x7'));var attributes=require(_0xed8e('0x8'));module[_0xed8e('0x9')]=function(_0x576b26,_0x3a030a){return _0x576b26[_0xed8e('0xa')](_0xed8e('0xb'),attributes,{'tableName':_0xed8e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0d6a=['./trigger.attributes','exports','define','Trigger','tools_triggers','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0xd2ed9a,_0x571f07){var _0x32eac2=function(_0x3b99eb){while(--_0x3b99eb){_0xd2ed9a['push'](_0xd2ed9a['shift']());}};_0x32eac2(++_0x571f07);}(_0x0d6a,0xc9));var _0xa0d6=function(_0x4d8ed9,_0x2ae284){_0x4d8ed9=_0x4d8ed9-0x0;var _0x1e2140=_0x0d6a[_0x4d8ed9];return _0x1e2140;};'use strict';var _=require(_0xa0d6('0x0'));var util=require(_0xa0d6('0x1'));var logger=require('../../config/logger')(_0xa0d6('0x2'));var moment=require(_0xa0d6('0x3'));var BPromise=require(_0xa0d6('0x4'));var rp=require(_0xa0d6('0x5'));var fs=require('fs');var path=require(_0xa0d6('0x6'));var rimraf=require(_0xa0d6('0x7'));var config=require(_0xa0d6('0x8'));var attributes=require(_0xa0d6('0x9'));module[_0xa0d6('0xa')]=function(_0x179a70,_0x4857ce){return _0x179a70[_0xa0d6('0xb')](_0xa0d6('0xc'),attributes,{'tableName':_0xa0d6('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trigger/trigger.rpc.js b/server/api/trigger/trigger.rpc.js index 07891c3..df1fe22 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 _0x46e6=['info','debug','request\x20sent','error','message','result','Trigger,\x20%s,\x20%s','GetTrigger','findAll','options','raw','attributes','limit','include','model','map','then','stringify','catch','ShowTrigger','Trigger','find','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x3e8ba4,_0x2d1af1){var _0x5721d9=function(_0x4477b9){while(--_0x4477b9){_0x3e8ba4['push'](_0x3e8ba4['shift']());}};_0x5721d9(++_0x2d1af1);}(_0x46e6,0xe8));var _0x646e=function(_0x500684,_0x113728){_0x500684=_0x500684-0x0;var _0x4f8830=_0x46e6[_0x500684];return _0x4f8830;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x646e('0x0'));var BPromise=require(_0x646e('0x1'));var rs=require(_0x646e('0x2'));var fs=require('fs');var Redis=require(_0x646e('0x3'));var db=require(_0x646e('0x4'))['db'];var utils=require(_0x646e('0x5'));var logger=require(_0x646e('0x6'))(_0x646e('0x7'));var config=require(_0x646e('0x8'));var jayson=require(_0x646e('0x9'));var client=jayson[_0x646e('0xa')][_0x646e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x223d1d,_0xb374dc,_0x147d6c){return new BPromise(function(_0x12b4f0,_0x455394){return client[_0x646e('0xc')](_0x223d1d,_0x147d6c)['then'](function(_0x5c13c7){logger[_0x646e('0xd')]('Trigger,\x20%s,\x20%s',_0xb374dc,'request\x20sent');logger[_0x646e('0xe')]('Trigger,\x20%s,\x20%s,\x20%s',_0xb374dc,_0x646e('0xf'),JSON['stringify'](_0x5c13c7));if(_0x5c13c7[_0x646e('0x10')]){if(_0x5c13c7[_0x646e('0x10')]['code']===0x1f4){logger[_0x646e('0x10')]('Trigger,\x20%s,\x20%s',_0xb374dc,_0x5c13c7[_0x646e('0x10')][_0x646e('0x11')]);return _0x455394(_0x5c13c7['error'][_0x646e('0x11')]);}logger[_0x646e('0x10')]('Trigger,\x20%s,\x20%s',_0xb374dc,_0x5c13c7[_0x646e('0x10')][_0x646e('0x11')]);return _0x12b4f0(_0x5c13c7[_0x646e('0x10')][_0x646e('0x11')]);}else{logger['info']('Trigger,\x20%s,\x20%s',_0xb374dc,'request\x20sent');_0x12b4f0(_0x5c13c7[_0x646e('0x12')][_0x646e('0x11')]);}})['catch'](function(_0x2d23b8){logger['error'](_0x646e('0x13'),_0xb374dc,_0x2d23b8);_0x455394(_0x2d23b8);});});}exports[_0x646e('0x14')]=function(_0x49274b){var _0x526994=this;return new Promise(function(_0x19e786,_0x500d02){return db['Trigger'][_0x646e('0x15')]({'raw':_0x49274b[_0x646e('0x16')]?_0x49274b['options'][_0x646e('0x17')]===undefined?!![]:![]:!![],'where':_0x49274b['options']?_0x49274b[_0x646e('0x16')]['where']||null:null,'attributes':_0x49274b[_0x646e('0x16')]?_0x49274b[_0x646e('0x16')][_0x646e('0x18')]||null:null,'limit':_0x49274b[_0x646e('0x16')]?_0x49274b['options'][_0x646e('0x19')]||null:null,'include':_0x49274b['options']?_0x49274b[_0x646e('0x16')][_0x646e('0x1a')]?_['map'](_0x49274b[_0x646e('0x16')][_0x646e('0x1a')],function(_0x3b285b){return{'model':db[_0x3b285b[_0x646e('0x1b')]],'as':_0x3b285b['as'],'attributes':_0x3b285b['attributes'],'include':_0x3b285b[_0x646e('0x1a')]?_['map'](_0x3b285b['include'],function(_0x544f1b){return{'model':db[_0x544f1b[_0x646e('0x1b')]],'as':_0x544f1b['as'],'attributes':_0x544f1b[_0x646e('0x18')],'include':_0x544f1b[_0x646e('0x1a')]?_[_0x646e('0x1c')](_0x544f1b[_0x646e('0x1a')],function(_0x5e9eb3){return{'model':db[_0x5e9eb3['model']],'as':_0x5e9eb3['as'],'attributes':_0x5e9eb3[_0x646e('0x18')]};}):[]};}):[]};}):[]:[]})[_0x646e('0x1d')](function(_0x4ffff6){logger['info']('GetTrigger',_0x49274b);logger['debug'](_0x646e('0x14'),_0x49274b,JSON[_0x646e('0x1e')](_0x4ffff6));_0x19e786(_0x4ffff6);})[_0x646e('0x1f')](function(_0x5f3450){logger[_0x646e('0x10')](_0x646e('0x14'),_0x5f3450[_0x646e('0x11')],_0x49274b);_0x500d02(_0x526994['error'](0x1f4,_0x5f3450[_0x646e('0x11')]));});});};exports[_0x646e('0x20')]=function(_0xf29ea3){var _0x22b8b7=this;return new Promise(function(_0x591dc3,_0x584930){return db[_0x646e('0x21')][_0x646e('0x22')]({'raw':_0xf29ea3['options']?_0xf29ea3[_0x646e('0x16')][_0x646e('0x17')]===undefined?!![]:![]:!![],'where':_0xf29ea3[_0x646e('0x16')]?_0xf29ea3['options']['where']||null:null,'attributes':_0xf29ea3[_0x646e('0x16')]?_0xf29ea3[_0x646e('0x16')][_0x646e('0x18')]||null:null,'include':_0xf29ea3[_0x646e('0x16')]?_0xf29ea3[_0x646e('0x16')][_0x646e('0x1a')]?_['map'](_0xf29ea3[_0x646e('0x16')][_0x646e('0x1a')],function(_0x3fba66){return{'model':db[_0x3fba66[_0x646e('0x1b')]],'as':_0x3fba66['as'],'attributes':_0x3fba66[_0x646e('0x18')],'include':_0x3fba66[_0x646e('0x1a')]?_[_0x646e('0x1c')](_0x3fba66['include'],function(_0x26505b){return{'model':db[_0x26505b[_0x646e('0x1b')]],'as':_0x26505b['as'],'attributes':_0x26505b[_0x646e('0x18')],'include':_0x26505b[_0x646e('0x1a')]?_['map'](_0x26505b['include'],function(_0x4c1f7e){return{'model':db[_0x4c1f7e[_0x646e('0x1b')]],'as':_0x4c1f7e['as'],'attributes':_0x4c1f7e['attributes']};}):[]};}):[]};}):[]:[]})[_0x646e('0x1d')](function(_0x5321ea){logger[_0x646e('0xd')]('ShowTrigger',_0xf29ea3);logger['debug'](_0x646e('0x20'),_0xf29ea3,JSON[_0x646e('0x1e')](_0x5321ea));_0x591dc3(_0x5321ea);})[_0x646e('0x1f')](function(_0x3e23d6){logger[_0x646e('0x10')](_0x646e('0x20'),_0x3e23d6[_0x646e('0x11')],_0xf29ea3);_0x584930(_0x22b8b7[_0x646e('0x10')](0x1f4,_0x3e23d6[_0x646e('0x11')]));});});}; \ No newline at end of file +var _0x0dfc=['include','catch','ShowTrigger','Trigger','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','http','request','then','Trigger,\x20%s,\x20%s','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','GetTrigger','options','raw','where','attributes','limit','map','model'];(function(_0x1f764d,_0x3550f0){var _0x3ae4f6=function(_0x5a2b24){while(--_0x5a2b24){_0x1f764d['push'](_0x1f764d['shift']());}};_0x3ae4f6(++_0x3550f0);}(_0x0dfc,0x1e1));var _0xc0df=function(_0x3e49b6,_0x426b16){_0x3e49b6=_0x3e49b6-0x0;var _0x5dbca1=_0x0dfc[_0x3e49b6];return _0x5dbca1;};'use strict';var _=require(_0xc0df('0x0'));var util=require(_0xc0df('0x1'));var moment=require(_0xc0df('0x2'));var BPromise=require(_0xc0df('0x3'));var rs=require(_0xc0df('0x4'));var fs=require('fs');var Redis=require(_0xc0df('0x5'));var db=require(_0xc0df('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xc0df('0x7'))(_0xc0df('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xc0df('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x7cc465,_0x184de3,_0xd5971d){return new BPromise(function(_0x38e4b5,_0x29eb4c){return client[_0xc0df('0xa')](_0x7cc465,_0xd5971d)[_0xc0df('0xb')](function(_0x2b1b5b){logger['info'](_0xc0df('0xc'),_0x184de3,_0xc0df('0xd'));logger[_0xc0df('0xe')](_0xc0df('0xf'),_0x184de3,_0xc0df('0xd'),JSON[_0xc0df('0x10')](_0x2b1b5b));if(_0x2b1b5b[_0xc0df('0x11')]){if(_0x2b1b5b[_0xc0df('0x11')][_0xc0df('0x12')]===0x1f4){logger['error'](_0xc0df('0xc'),_0x184de3,_0x2b1b5b['error'][_0xc0df('0x13')]);return _0x29eb4c(_0x2b1b5b[_0xc0df('0x11')][_0xc0df('0x13')]);}logger[_0xc0df('0x11')](_0xc0df('0xc'),_0x184de3,_0x2b1b5b[_0xc0df('0x11')][_0xc0df('0x13')]);return _0x38e4b5(_0x2b1b5b['error']['message']);}else{logger[_0xc0df('0x14')](_0xc0df('0xc'),_0x184de3,'request\x20sent');_0x38e4b5(_0x2b1b5b['result'][_0xc0df('0x13')]);}})['catch'](function(_0x480f95){logger[_0xc0df('0x11')](_0xc0df('0xc'),_0x184de3,_0x480f95);_0x29eb4c(_0x480f95);});});}exports[_0xc0df('0x15')]=function(_0x5d86e1){var _0x42615c=this;return new Promise(function(_0xa9cf49,_0x4e7825){return db['Trigger']['findAll']({'raw':_0x5d86e1['options']?_0x5d86e1[_0xc0df('0x16')][_0xc0df('0x17')]===undefined?!![]:![]:!![],'where':_0x5d86e1[_0xc0df('0x16')]?_0x5d86e1[_0xc0df('0x16')][_0xc0df('0x18')]||null:null,'attributes':_0x5d86e1[_0xc0df('0x16')]?_0x5d86e1['options'][_0xc0df('0x19')]||null:null,'limit':_0x5d86e1[_0xc0df('0x16')]?_0x5d86e1['options'][_0xc0df('0x1a')]||null:null,'include':_0x5d86e1[_0xc0df('0x16')]?_0x5d86e1['options']['include']?_[_0xc0df('0x1b')](_0x5d86e1[_0xc0df('0x16')]['include'],function(_0x1ac23b){return{'model':db[_0x1ac23b[_0xc0df('0x1c')]],'as':_0x1ac23b['as'],'attributes':_0x1ac23b[_0xc0df('0x19')],'include':_0x1ac23b[_0xc0df('0x1d')]?_[_0xc0df('0x1b')](_0x1ac23b[_0xc0df('0x1d')],function(_0xdd0b2c){return{'model':db[_0xdd0b2c[_0xc0df('0x1c')]],'as':_0xdd0b2c['as'],'attributes':_0xdd0b2c['attributes'],'include':_0xdd0b2c[_0xc0df('0x1d')]?_[_0xc0df('0x1b')](_0xdd0b2c['include'],function(_0x1ecef4){return{'model':db[_0x1ecef4[_0xc0df('0x1c')]],'as':_0x1ecef4['as'],'attributes':_0x1ecef4['attributes']};}):[]};}):[]};}):[]:[]})[_0xc0df('0xb')](function(_0x111875){logger['info']('GetTrigger',_0x5d86e1);logger['debug'](_0xc0df('0x15'),_0x5d86e1,JSON[_0xc0df('0x10')](_0x111875));_0xa9cf49(_0x111875);})[_0xc0df('0x1e')](function(_0x53cffa){logger[_0xc0df('0x11')](_0xc0df('0x15'),_0x53cffa[_0xc0df('0x13')],_0x5d86e1);_0x4e7825(_0x42615c[_0xc0df('0x11')](0x1f4,_0x53cffa['message']));});});};exports[_0xc0df('0x1f')]=function(_0x220504){var _0x58127b=this;return new Promise(function(_0xe27732,_0x36227a){return db[_0xc0df('0x20')][_0xc0df('0x21')]({'raw':_0x220504[_0xc0df('0x16')]?_0x220504[_0xc0df('0x16')][_0xc0df('0x17')]===undefined?!![]:![]:!![],'where':_0x220504[_0xc0df('0x16')]?_0x220504[_0xc0df('0x16')][_0xc0df('0x18')]||null:null,'attributes':_0x220504['options']?_0x220504[_0xc0df('0x16')][_0xc0df('0x19')]||null:null,'include':_0x220504['options']?_0x220504['options']['include']?_[_0xc0df('0x1b')](_0x220504[_0xc0df('0x16')][_0xc0df('0x1d')],function(_0x5b5bc2){return{'model':db[_0x5b5bc2[_0xc0df('0x1c')]],'as':_0x5b5bc2['as'],'attributes':_0x5b5bc2['attributes'],'include':_0x5b5bc2[_0xc0df('0x1d')]?_[_0xc0df('0x1b')](_0x5b5bc2[_0xc0df('0x1d')],function(_0x415a9c){return{'model':db[_0x415a9c[_0xc0df('0x1c')]],'as':_0x415a9c['as'],'attributes':_0x415a9c[_0xc0df('0x19')],'include':_0x415a9c[_0xc0df('0x1d')]?_[_0xc0df('0x1b')](_0x415a9c[_0xc0df('0x1d')],function(_0x4d7f94){return{'model':db[_0x4d7f94[_0xc0df('0x1c')]],'as':_0x4d7f94['as'],'attributes':_0x4d7f94[_0xc0df('0x19')]};}):[]};}):[]};}):[]:[]})[_0xc0df('0xb')](function(_0x19c6c3){logger[_0xc0df('0x14')](_0xc0df('0x1f'),_0x220504);logger[_0xc0df('0xe')](_0xc0df('0x1f'),_0x220504,JSON['stringify'](_0x19c6c3));_0xe27732(_0x19c6c3);})[_0xc0df('0x1e')](function(_0xb3fe32){logger[_0xc0df('0x11')](_0xc0df('0x1f'),_0xb3fe32[_0xc0df('0x13')],_0x220504);_0x36227a(_0x58127b[_0xc0df('0x11')](0x1f4,_0xb3fe32[_0xc0df('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 192c600..00fa8dd 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 _0x9220=['fs-extra','../../components/interaction/service','../../config/environment','./trunk.controller','index','get','show','post','/:id/clone','isAuthenticated','clone','create','put','/:id','update','exports','util','path','connect-timeout','express','Router'];(function(_0x1b685d,_0x41d26a){var _0x550db7=function(_0x3b61b5){while(--_0x3b61b5){_0x1b685d['push'](_0x1b685d['shift']());}};_0x550db7(++_0x41d26a);}(_0x9220,0x14b));var _0x0922=function(_0x35885a,_0x42fed7){_0x35885a=_0x35885a-0x0;var _0xe86249=_0x9220[_0x35885a];return _0xe86249;};'use strict';var multer=require('multer');var util=require(_0x0922('0x0'));var path=require(_0x0922('0x1'));var timeout=require(_0x0922('0x2'));var express=require(_0x0922('0x3'));var router=express[_0x0922('0x4')]();var fs_extra=require(_0x0922('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0922('0x6'));var config=require(_0x0922('0x7'));var controller=require(_0x0922('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x0922('0x9')]);router[_0x0922('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x0922('0xb')]);router[_0x0922('0xc')](_0x0922('0xd'),auth[_0x0922('0xe')](),controller[_0x0922('0xf')]);router[_0x0922('0xc')]('/',auth[_0x0922('0xe')](),controller[_0x0922('0x10')]);router[_0x0922('0x11')](_0x0922('0x12'),auth[_0x0922('0xe')](),controller[_0x0922('0x13')]);router['delete'](_0x0922('0x12'),auth['isAuthenticated'](),controller['destroy']);module[_0x0922('0x14')]=router; \ No newline at end of file +var _0xc440=['isAuthenticated','index','/:id','show','clone','post','create','put','update','delete','multer','path','express','Router','../../components/auth/service','get'];(function(_0x2a68e2,_0x24e1ef){var _0x1c802f=function(_0x6c5b0b){while(--_0x6c5b0b){_0x2a68e2['push'](_0x2a68e2['shift']());}};_0x1c802f(++_0x24e1ef);}(_0xc440,0x15a));var _0x0c44=function(_0x4fe7bb,_0x1bdd1c){_0x4fe7bb=_0x4fe7bb-0x0;var _0x5659cc=_0xc440[_0x4fe7bb];return _0x5659cc;};'use strict';var multer=require(_0x0c44('0x0'));var util=require('util');var path=require(_0x0c44('0x1'));var timeout=require('connect-timeout');var express=require(_0x0c44('0x2'));var router=express[_0x0c44('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0c44('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./trunk.controller');router[_0x0c44('0x5')]('/',auth[_0x0c44('0x6')](),controller[_0x0c44('0x7')]);router[_0x0c44('0x5')](_0x0c44('0x8'),auth['isAuthenticated'](),controller[_0x0c44('0x9')]);router['post']('/:id/clone',auth[_0x0c44('0x6')](),controller[_0x0c44('0xa')]);router[_0x0c44('0xb')]('/',auth[_0x0c44('0x6')](),controller[_0x0c44('0xc')]);router[_0x0c44('0xd')](_0x0c44('0x8'),auth['isAuthenticated'](),controller[_0x0c44('0xe')]);router[_0x0c44('0xf')](_0x0c44('0x8'),auth[_0x0c44('0x6')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index 66d9591..af27a67 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 _0xe157=['inband','auto','update','outgoing','yes','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','allow','ulaw;alaw;gsm','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<>','always','INTEGER','refuse','originate','uac','uas','pai','certificate','passive','dynamic','nonat','update,nonat','exports','STRING','name','friend','peer','from-voip-provider','ENUM','ALLOWED_PASSED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','setDataValue','transport','join','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info'];(function(_0x4401d0,_0x284d82){var _0x380ee3=function(_0x4c1f06){while(--_0x4c1f06){_0x4401d0['push'](_0x4401d0['shift']());}};_0x380ee3(++_0x284d82);}(_0xe157,0x14f));var _0x7e15=function(_0x1dc5d2,_0xe79646){_0x1dc5d2=_0x1dc5d2-0x0;var _0x2a377e=_0xe157[_0x1dc5d2];return _0x2a377e;};'use strict';var Sequelize=require('sequelize');module[_0x7e15('0x0')]={'name':{'type':Sequelize[_0x7e15('0x1')],'allowNull':![],'unique':_0x7e15('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0x7e15('0x3'),'user',_0x7e15('0x4')),'allowNull':![],'defaultValue':'friend'},'context':{'type':Sequelize[_0x7e15('0x1')],'allowNull':![],'defaultValue':_0x7e15('0x5')},'callingpres':{'type':Sequelize[_0x7e15('0x6')]('ALLOWED_NOT_SCREENED',_0x7e15('0x7'),'ALLOWED_FAILED_SCREEN',_0x7e15('0x8'),_0x7e15('0x9'),_0x7e15('0xa'),_0x7e15('0xb'),_0x7e15('0xc'))},'deny':{'type':Sequelize[_0x7e15('0x1')]},'permit':{'type':Sequelize[_0x7e15('0x1')]},'secret':{'type':Sequelize['STRING']},'md5secret':{'type':Sequelize['STRING']},'remotesecret':{'type':Sequelize['STRING']},'transport':{'type':Sequelize['STRING'],'defaultValue':_0x7e15('0xd'),'set':function(_0x14c606){this[_0x7e15('0xe')](_0x7e15('0xf'),_0x14c606?_0x14c606[_0x7e15('0x10')](','):null);},'get':function(){return this['getDataValue'](_0x7e15('0xf'))?this[_0x7e15('0x11')](_0x7e15('0xf'))[_0x7e15('0x12')](','):null;},'comment':_0x7e15('0x13')},'dtmfmode':{'type':Sequelize[_0x7e15('0x6')](_0x7e15('0x14'),_0x7e15('0x15'),'shortinfo',_0x7e15('0x16'),_0x7e15('0x17')),'defaultValue':_0x7e15('0x14')},'directmedia':{'type':Sequelize[_0x7e15('0x6')]('yes','no','nonat',_0x7e15('0x18'),_0x7e15('0x19')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x7e15('0x6')](_0x7e15('0x1a'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING']},'directmediadeny':{'type':Sequelize[_0x7e15('0x1')]},'nat':{'type':Sequelize[_0x7e15('0x1')],'defaultValue':_0x7e15('0x1b'),'set':function(_0x1d963c){this[_0x7e15('0xe')](_0x7e15('0x1c'),_0x1d963c?_0x1d963c['join'](','):null);},'get':function(){return this[_0x7e15('0x11')](_0x7e15('0x1c'))?this[_0x7e15('0x11')](_0x7e15('0x1c'))['split'](','):null;},'comment':_0x7e15('0x1d')},'callgroup':{'type':Sequelize[_0x7e15('0x1')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0x7e15('0x1')]},'namedpickupgroup':{'type':Sequelize[_0x7e15('0x1')]},'language':{'type':Sequelize[_0x7e15('0x1')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x7e15('0x1')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x7e15('0x1')],'defaultValue':_0x7e15('0x1e')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x36f9dd){this[_0x7e15('0xe')](_0x7e15('0x1f'),_0x36f9dd?_0x36f9dd['join'](';'):_0x7e15('0x20'));},'get':function(){return this[_0x7e15('0x11')](_0x7e15('0x1f'))?this[_0x7e15('0x11')]('allow')['split'](';'):null;},'comment':_0x7e15('0x21')},'autoframing':{'type':Sequelize['ENUM'](_0x7e15('0x1a'),'no')},'insecure':{'type':Sequelize['STRING'],'defaultValue':_0x7e15('0x22'),'set':function(_0x4e8d68){this['setDataValue'](_0x7e15('0x23'),_0x4e8d68?_0x4e8d68[_0x7e15('0x10')](','):null);},'get':function(){return this['getDataValue']('insecure')?this['getDataValue']('insecure')[_0x7e15('0x12')](','):null;},'comment':_0x7e15('0x24')},'trustrpid':{'type':Sequelize[_0x7e15('0x6')](_0x7e15('0x1a'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x7e15('0x6')](_0x7e15('0x1a'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM'](_0x7e15('0x1a'),'no',_0x7e15('0x25'))},'promiscredir':{'type':Sequelize[_0x7e15('0x6')](_0x7e15('0x1a'),'no')},'useclientcode':{'type':Sequelize[_0x7e15('0x6')](_0x7e15('0x1a'),'no')},'accountcode':{'type':Sequelize['INTEGER'](0xb)},'setvar':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x7e15('0x1')],'defaultValue':_0x7e15('0x26')},'amaflags':{'type':Sequelize['STRING']},'callcounter':{'type':Sequelize[_0x7e15('0x6')]('yes','no'),'defaultValue':_0x7e15('0x1a')},'busylevel':{'type':Sequelize['INTEGER'](0xb)},'allowoverlap':{'type':Sequelize[_0x7e15('0x6')](_0x7e15('0x1a'),'no')},'allowsubscribe':{'type':Sequelize['ENUM'](_0x7e15('0x1a'),'no')},'allowtransfer':{'type':Sequelize['ENUM'](_0x7e15('0x1a'),'no')},'ignoresdpversion':{'type':Sequelize[_0x7e15('0x6')](_0x7e15('0x1a'),'no')},'subscribecontext':{'type':Sequelize['STRING']},'template':{'type':Sequelize['STRING']},'videosupport':{'type':Sequelize[_0x7e15('0x6')](_0x7e15('0x1a'),'no',_0x7e15('0x27')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x7e15('0x28')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x7e15('0x6')]('yes','no')},'mailbox':{'type':Sequelize[_0x7e15('0x1')]},'session_timers':{'type':Sequelize[_0x7e15('0x6')]('accept',_0x7e15('0x29'),_0x7e15('0x2a'))},'session_expires':{'type':Sequelize[_0x7e15('0x28')](0xb)},'session_minse':{'type':Sequelize['INTEGER'](0xb)},'session_refresher':{'type':Sequelize[_0x7e15('0x6')](_0x7e15('0x2b'),'uas'),'defaultValue':_0x7e15('0x2c')},'t38pt_usertpsource':{'type':Sequelize[_0x7e15('0x1')]},'regexten':{'type':Sequelize['STRING']},'fromdomain':{'type':Sequelize[_0x7e15('0x1')]},'fromuser':{'type':Sequelize['STRING']},'port':{'type':Sequelize['INTEGER'](0x5)},'qualify':{'type':Sequelize[_0x7e15('0x6')](_0x7e15('0x1a'),'no'),'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0x7e15('0x28')](0xb)},'defaultip':{'type':Sequelize[_0x7e15('0x1')]},'defaultuser':{'type':Sequelize[_0x7e15('0x1')]},'rtptimeout':{'type':Sequelize[_0x7e15('0x28')](0xb)},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpkeepalive':{'type':Sequelize[_0x7e15('0x28')](0xb)},'sendrpid':{'type':Sequelize[_0x7e15('0x6')](_0x7e15('0x1a'),'no',_0x7e15('0x2d')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x7e15('0x1')]},'callbackextension':{'type':Sequelize['STRING']},'timert1':{'type':Sequelize[_0x7e15('0x28')](0xb)},'timerb':{'type':Sequelize[_0x7e15('0x28')](0xb)},'qualifyfreq':{'type':Sequelize[_0x7e15('0x28')](0xb)},'contactpermit':{'type':Sequelize[_0x7e15('0x1')]},'contactdeny':{'type':Sequelize['STRING']},'contactacl':{'type':Sequelize[_0x7e15('0x1')]},'unsolicited_mailbox':{'type':Sequelize[_0x7e15('0x1')]},'use_q850_reason':{'type':Sequelize[_0x7e15('0x1')]},'maxforwards':{'type':Sequelize[_0x7e15('0x28')](0xb)},'encryption':{'type':Sequelize[_0x7e15('0x6')](_0x7e15('0x1a'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM']('yes','no')},'force_avp':{'type':Sequelize['ENUM'](_0x7e15('0x1a'),'no')},'icesupport':{'type':Sequelize['ENUM'](_0x7e15('0x1a'),'no')},'dtlsenable':{'type':Sequelize['ENUM']('yes','no')},'dtlsverify':{'type':Sequelize[_0x7e15('0x6')](_0x7e15('0x1a'),'no','fingerprint',_0x7e15('0x2e'))},'dtlsrekey':{'type':Sequelize[_0x7e15('0x28')](0xb)},'dtlscertfile':{'type':Sequelize[_0x7e15('0x1')]},'dtlsprivatekey':{'type':Sequelize[_0x7e15('0x1')]},'dtlscipher':{'type':Sequelize[_0x7e15('0x1')]},'dtlscafile':{'type':Sequelize['STRING']},'dtlscapath':{'type':Sequelize[_0x7e15('0x1')]},'dtlssetup':{'type':Sequelize[_0x7e15('0x6')]('active',_0x7e15('0x2f'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x7e15('0x1')]},'usereqphone':{'type':Sequelize[_0x7e15('0x6')]('yes','no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING']},'recordofffeature':{'type':Sequelize[_0x7e15('0x1')]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x7e15('0x6')](_0x7e15('0x1a'),'no')},'subscribemwi':{'type':Sequelize[_0x7e15('0x6')](_0x7e15('0x1a'),'no')},'vmexten':{'type':Sequelize[_0x7e15('0x1')]},'mohinterpret':{'type':Sequelize[_0x7e15('0x1')]},'mohsuggest':{'type':Sequelize[_0x7e15('0x1')]},'parkinglot':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x7e15('0x1')]},'host':{'type':Sequelize[_0x7e15('0x1')],'defaultValue':_0x7e15('0x30')},'canreinvite':{'type':Sequelize['ENUM'](_0x7e15('0x1a'),'no',_0x7e15('0x31'),_0x7e15('0x18'),_0x7e15('0x32')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x7e15('0x1')]},'otherFields':{'type':Sequelize['STRING']},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x7e15('0x1')],'defaultValue':'no'}}; \ No newline at end of file +var _0xc343=['String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','nonat','update','outgoing','yes','force_rport,comedia','setDataValue','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','allow','ulaw;alaw;gsm','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','INTEGER','\x22\x22\x20<>','always','accept','refuse','originate','uac','uas','pai','fingerprint','certificate','active','passive','actpass','dynamic','update,nonat','BOOLEAN','sequelize','exports','STRING','name','ENUM','friend','user','peer','from-voip-provider','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','transport','join','getDataValue','split'];(function(_0x53377b,_0x166f23){var _0x39cba9=function(_0x4be07d){while(--_0x4be07d){_0x53377b['push'](_0x53377b['shift']());}};_0x39cba9(++_0x166f23);}(_0xc343,0xc1));var _0x3c34=function(_0x5990c8,_0x42115d){_0x5990c8=_0x5990c8-0x0;var _0x5aa7a6=_0xc343[_0x5990c8];return _0x5aa7a6;};'use strict';var Sequelize=require(_0x3c34('0x0'));module[_0x3c34('0x1')]={'name':{'type':Sequelize[_0x3c34('0x2')],'allowNull':![],'unique':_0x3c34('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x3c34('0x4')](_0x3c34('0x5'),_0x3c34('0x6'),_0x3c34('0x7')),'allowNull':![],'defaultValue':_0x3c34('0x5')},'context':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x3c34('0x8')},'callingpres':{'type':Sequelize[_0x3c34('0x4')]('ALLOWED_NOT_SCREENED',_0x3c34('0x9'),_0x3c34('0xa'),_0x3c34('0xb'),_0x3c34('0xc'),_0x3c34('0xd'),_0x3c34('0xe'),'PROHIB')},'deny':{'type':Sequelize[_0x3c34('0x2')]},'permit':{'type':Sequelize['STRING']},'secret':{'type':Sequelize[_0x3c34('0x2')]},'md5secret':{'type':Sequelize['STRING']},'remotesecret':{'type':Sequelize[_0x3c34('0x2')]},'transport':{'type':Sequelize[_0x3c34('0x2')],'defaultValue':'udp','set':function(_0x5640ab){this['setDataValue'](_0x3c34('0xf'),_0x5640ab?_0x5640ab[_0x3c34('0x10')](','):null);},'get':function(){return this['getDataValue'](_0x3c34('0xf'))?this[_0x3c34('0x11')](_0x3c34('0xf'))[_0x3c34('0x12')](','):null;},'comment':_0x3c34('0x13')},'dtmfmode':{'type':Sequelize[_0x3c34('0x4')](_0x3c34('0x14'),_0x3c34('0x15'),'shortinfo','inband','auto'),'defaultValue':_0x3c34('0x14')},'directmedia':{'type':Sequelize[_0x3c34('0x4')]('yes','no',_0x3c34('0x16'),_0x3c34('0x17'),_0x3c34('0x18')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x3c34('0x4')](_0x3c34('0x19'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x3c34('0x2')]},'directmediadeny':{'type':Sequelize['STRING']},'nat':{'type':Sequelize[_0x3c34('0x2')],'defaultValue':_0x3c34('0x1a'),'set':function(_0x164058){this[_0x3c34('0x1b')](_0x3c34('0x1c'),_0x164058?_0x164058['join'](','):null);},'get':function(){return this[_0x3c34('0x11')](_0x3c34('0x1c'))?this['getDataValue'](_0x3c34('0x1c'))[_0x3c34('0x12')](','):null;},'comment':_0x3c34('0x1d')},'callgroup':{'type':Sequelize[_0x3c34('0x2')]},'namedcallgroup':{'type':Sequelize[_0x3c34('0x2')]},'pickupgroup':{'type':Sequelize[_0x3c34('0x2')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x3c34('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x3c34('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x3c34('0x2')],'defaultValue':_0x3c34('0x1e')},'allow':{'type':Sequelize[_0x3c34('0x2')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x2b06b2){this[_0x3c34('0x1b')](_0x3c34('0x1f'),_0x2b06b2?_0x2b06b2[_0x3c34('0x10')](';'):_0x3c34('0x20'));},'get':function(){return this[_0x3c34('0x11')](_0x3c34('0x1f'))?this[_0x3c34('0x11')]('allow')['split'](';'):null;},'comment':_0x3c34('0x21')},'autoframing':{'type':Sequelize[_0x3c34('0x4')](_0x3c34('0x19'),'no')},'insecure':{'type':Sequelize[_0x3c34('0x2')],'defaultValue':_0x3c34('0x22'),'set':function(_0x3b385b){this['setDataValue']('insecure',_0x3b385b?_0x3b385b[_0x3c34('0x10')](','):null);},'get':function(){return this['getDataValue']('insecure')?this[_0x3c34('0x11')]('insecure')[_0x3c34('0x12')](','):null;},'comment':_0x3c34('0x23')},'trustrpid':{'type':Sequelize[_0x3c34('0x4')]('yes','no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x3c34('0x4')](_0x3c34('0x19'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x3c34('0x4')]('yes','no','never')},'promiscredir':{'type':Sequelize['ENUM'](_0x3c34('0x19'),'no')},'useclientcode':{'type':Sequelize[_0x3c34('0x4')](_0x3c34('0x19'),'no')},'accountcode':{'type':Sequelize[_0x3c34('0x24')](0xb)},'setvar':{'type':Sequelize[_0x3c34('0x2')]},'callerid':{'type':Sequelize[_0x3c34('0x2')],'defaultValue':_0x3c34('0x25')},'amaflags':{'type':Sequelize[_0x3c34('0x2')]},'callcounter':{'type':Sequelize[_0x3c34('0x4')](_0x3c34('0x19'),'no'),'defaultValue':_0x3c34('0x19')},'busylevel':{'type':Sequelize[_0x3c34('0x24')](0xb)},'allowoverlap':{'type':Sequelize['ENUM'](_0x3c34('0x19'),'no')},'allowsubscribe':{'type':Sequelize[_0x3c34('0x4')](_0x3c34('0x19'),'no')},'allowtransfer':{'type':Sequelize['ENUM'](_0x3c34('0x19'),'no')},'ignoresdpversion':{'type':Sequelize[_0x3c34('0x4')](_0x3c34('0x19'),'no')},'subscribecontext':{'type':Sequelize['STRING']},'template':{'type':Sequelize[_0x3c34('0x2')]},'videosupport':{'type':Sequelize['ENUM']('yes','no',_0x3c34('0x26')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x3c34('0x24')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x3c34('0x4')](_0x3c34('0x19'),'no')},'mailbox':{'type':Sequelize[_0x3c34('0x2')]},'session_timers':{'type':Sequelize[_0x3c34('0x4')](_0x3c34('0x27'),_0x3c34('0x28'),_0x3c34('0x29'))},'session_expires':{'type':Sequelize[_0x3c34('0x24')](0xb)},'session_minse':{'type':Sequelize[_0x3c34('0x24')](0xb)},'session_refresher':{'type':Sequelize[_0x3c34('0x4')](_0x3c34('0x2a'),_0x3c34('0x2b')),'defaultValue':_0x3c34('0x2b')},'t38pt_usertpsource':{'type':Sequelize[_0x3c34('0x2')]},'regexten':{'type':Sequelize[_0x3c34('0x2')]},'fromdomain':{'type':Sequelize[_0x3c34('0x2')]},'fromuser':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x3c34('0x24')](0x5)},'qualify':{'type':Sequelize[_0x3c34('0x4')](_0x3c34('0x19'),'no'),'defaultValue':_0x3c34('0x19')},'keepalive':{'type':Sequelize[_0x3c34('0x24')](0xb)},'defaultip':{'type':Sequelize[_0x3c34('0x2')]},'defaultuser':{'type':Sequelize[_0x3c34('0x2')]},'rtptimeout':{'type':Sequelize[_0x3c34('0x24')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x3c34('0x24')](0xb)},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb)},'sendrpid':{'type':Sequelize[_0x3c34('0x4')](_0x3c34('0x19'),'no',_0x3c34('0x2c')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x3c34('0x2')]},'callbackextension':{'type':Sequelize[_0x3c34('0x2')]},'timert1':{'type':Sequelize[_0x3c34('0x24')](0xb)},'timerb':{'type':Sequelize[_0x3c34('0x24')](0xb)},'qualifyfreq':{'type':Sequelize[_0x3c34('0x24')](0xb)},'contactpermit':{'type':Sequelize['STRING']},'contactdeny':{'type':Sequelize[_0x3c34('0x2')]},'contactacl':{'type':Sequelize['STRING']},'unsolicited_mailbox':{'type':Sequelize['STRING']},'use_q850_reason':{'type':Sequelize[_0x3c34('0x2')]},'maxforwards':{'type':Sequelize[_0x3c34('0x24')](0xb)},'encryption':{'type':Sequelize['ENUM'](_0x3c34('0x19'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x3c34('0x4')](_0x3c34('0x19'),'no')},'force_avp':{'type':Sequelize[_0x3c34('0x4')](_0x3c34('0x19'),'no')},'icesupport':{'type':Sequelize[_0x3c34('0x4')]('yes','no')},'dtlsenable':{'type':Sequelize[_0x3c34('0x4')](_0x3c34('0x19'),'no')},'dtlsverify':{'type':Sequelize[_0x3c34('0x4')]('yes','no',_0x3c34('0x2d'),_0x3c34('0x2e'))},'dtlsrekey':{'type':Sequelize[_0x3c34('0x24')](0xb)},'dtlscertfile':{'type':Sequelize[_0x3c34('0x2')]},'dtlsprivatekey':{'type':Sequelize['STRING']},'dtlscipher':{'type':Sequelize[_0x3c34('0x2')]},'dtlscafile':{'type':Sequelize['STRING']},'dtlscapath':{'type':Sequelize[_0x3c34('0x2')]},'dtlssetup':{'type':Sequelize[_0x3c34('0x4')](_0x3c34('0x2f'),_0x3c34('0x30'),_0x3c34('0x31')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x3c34('0x2')]},'usereqphone':{'type':Sequelize[_0x3c34('0x4')](_0x3c34('0x19'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x3c34('0x2')]},'recordofffeature':{'type':Sequelize['STRING']},'call_limit':{'type':Sequelize[_0x3c34('0x24')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize['ENUM'](_0x3c34('0x19'),'no')},'subscribemwi':{'type':Sequelize[_0x3c34('0x4')](_0x3c34('0x19'),'no')},'vmexten':{'type':Sequelize[_0x3c34('0x2')]},'mohinterpret':{'type':Sequelize['STRING']},'mohsuggest':{'type':Sequelize[_0x3c34('0x2')]},'parkinglot':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x3c34('0x2')]},'host':{'type':Sequelize[_0x3c34('0x2')],'defaultValue':_0x3c34('0x32')},'canreinvite':{'type':Sequelize[_0x3c34('0x4')](_0x3c34('0x19'),'no',_0x3c34('0x16'),_0x3c34('0x17'),_0x3c34('0x33')),'defaultValue':'no'},'registry':{'type':Sequelize[_0x3c34('0x2')]},'otherFields':{'type':Sequelize[_0x3c34('0x2')]},'active':{'type':Sequelize[_0x3c34('0x34')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize['STRING'],'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 2451f39..16b53c5 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 _0xf2ca=['omit','createdAt','body','updatedAt','role','user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','join','root','server/files/templates/trunk.ejs','utf8','render','writeFileSync','registry','/etc/asterisk/sip_xcally_registers.conf','Unable\x20to\x20retrieve\x20the\x20current\x20user','server/files/templates/registry.ejs','/etc/asterisk/sip_xcally_trunks.conf','Reload','chan_sip.so','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','end','json','offset','limit','count','set','Content-Range','apply','save','update','destroy','get','Trunks','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','pick','filter','where','merge','options','includeAll','include','findAll','show','params','Trunk','find','clone'];(function(_0x3e6af8,_0x116679){var _0x6319b1=function(_0x3f079c){while(--_0x3f079c){_0x3e6af8['push'](_0x3e6af8['shift']());}};_0x6319b1(++_0x116679);}(_0xf2ca,0x16a));var _0xaf2c=function(_0x3aeb36,_0x312dc9){_0x3aeb36=_0x3aeb36-0x0;var _0xa2ef21=_0xf2ca[_0x3aeb36];return _0xa2ef21;};'use strict';var emlformat=require(_0xaf2c('0x0'));var rimraf=require(_0xaf2c('0x1'));var zipdir=require(_0xaf2c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xaf2c('0x3'));var moment=require(_0xaf2c('0x4'));var BPromise=require(_0xaf2c('0x5'));var Mustache=require(_0xaf2c('0x6'));var util=require(_0xaf2c('0x7'));var path=require(_0xaf2c('0x8'));var sox=require('sox');var csv=require(_0xaf2c('0x9'));var ejs=require(_0xaf2c('0xa'));var fs=require('fs');var fs_extra=require(_0xaf2c('0xb'));var _=require(_0xaf2c('0xc'));var squel=require('squel');var crypto=require(_0xaf2c('0xd'));var jsforce=require(_0xaf2c('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xaf2c('0x9'));var querystring=require('querystring');var Papa=require(_0xaf2c('0xf'));var Redis=require('ioredis');var authService=require(_0xaf2c('0x10'));var qs=require(_0xaf2c('0x11'));var as=require(_0xaf2c('0x12'));var hardwareService=require(_0xaf2c('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xaf2c('0x14'));var config=require(_0xaf2c('0x15'));var licenseUtil=require(_0xaf2c('0x16'));var db=require(_0xaf2c('0x17'))['db'];var jayson=require(_0xaf2c('0x18'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x15ccb4,_0x8eaf9b,_0x935959,_0x18a8a5){return new BPromise(function(_0x293ca6,_0x152c73){var _0x214f47=_0x18a8a5||client;return _0x214f47[_0xaf2c('0x19')](_0x15ccb4,_0x935959)[_0xaf2c('0x1a')](function(_0x1d0633){logger[_0xaf2c('0x1b')](_0xaf2c('0x1c'),_0x8eaf9b,_0xaf2c('0x1d'));logger[_0xaf2c('0x1e')](_0xaf2c('0x1f'),_0x8eaf9b,'request\x20sent',JSON[_0xaf2c('0x20')](_0x1d0633));if(_0x1d0633['error']){if(_0x1d0633[_0xaf2c('0x21')][_0xaf2c('0x22')]===0x1f4){logger[_0xaf2c('0x21')]('Trunk,\x20%s,\x20%s',_0x8eaf9b,_0x1d0633[_0xaf2c('0x21')][_0xaf2c('0x23')]);return _0x152c73(_0x1d0633[_0xaf2c('0x21')][_0xaf2c('0x23')]);}logger[_0xaf2c('0x21')](_0xaf2c('0x1c'),_0x8eaf9b,_0x1d0633['error'][_0xaf2c('0x23')]);return _0x293ca6(_0x1d0633[_0xaf2c('0x21')][_0xaf2c('0x23')]);}else{logger[_0xaf2c('0x1b')](_0xaf2c('0x1c'),_0x8eaf9b,'request\x20sent');_0x293ca6(_0x1d0633[_0xaf2c('0x24')][_0xaf2c('0x23')]);}})[_0xaf2c('0x25')](function(_0x4be6ed){logger['error'](_0xaf2c('0x1c'),_0x8eaf9b,_0x4be6ed);_0x152c73(_0x4be6ed);});});}function respondWithStatusCode(_0x303546,_0x1cafad){_0x1cafad=_0x1cafad||0xcc;return function(_0x99f78d){if(_0x99f78d){return _0x303546['sendStatus'](_0x1cafad);}return _0x303546[_0xaf2c('0x26')](_0x1cafad)[_0xaf2c('0x27')]();};}function respondWithResult(_0x3a0145,_0x3c1ae6){_0x3c1ae6=_0x3c1ae6||0xc8;return function(_0xe929b5){if(_0xe929b5){return _0x3a0145[_0xaf2c('0x26')](_0x3c1ae6)[_0xaf2c('0x28')](_0xe929b5);}};}function respondWithFilteredResult(_0x4a8dd8,_0x29f8b0){return function(_0x2051be){if(_0x2051be){var _0x36f37c=typeof _0x29f8b0[_0xaf2c('0x29')]==='undefined'&&typeof _0x29f8b0[_0xaf2c('0x2a')]==='undefined';var _0x38db1b=_0x2051be[_0xaf2c('0x2b')];var _0x15466b=_0x36f37c?0x0:_0x29f8b0['offset'];var _0x2747bb=_0x36f37c?_0x2051be[_0xaf2c('0x2b')]:_0x29f8b0[_0xaf2c('0x29')]+_0x29f8b0['limit'];var _0xe18ba7;if(_0x2747bb>=_0x38db1b){_0x2747bb=_0x38db1b;_0xe18ba7=0xc8;}else{_0xe18ba7=0xce;}_0x4a8dd8[_0xaf2c('0x26')](_0xe18ba7);return _0x4a8dd8[_0xaf2c('0x2c')](_0xaf2c('0x2d'),_0x15466b+'-'+_0x2747bb+'/'+_0x38db1b)['json'](_0x2051be);}return null;};}function patchUpdates(_0x3da072){return function(_0x4072ff){try{jsonpatch[_0xaf2c('0x2e')](_0x4072ff,_0x3da072,!![]);}catch(_0x51a49c){return BPromise['reject'](_0x51a49c);}return _0x4072ff[_0xaf2c('0x2f')]();};}function saveUpdates(_0x4c9b4f,_0x39c0ed){return function(_0x5e7247){if(_0x5e7247){return _0x5e7247[_0xaf2c('0x30')](_0x4c9b4f)[_0xaf2c('0x1a')](function(_0x4ffbb9){return _0x4ffbb9;});}return null;};}function removeEntity(_0x1408e3,_0x5403f8){return function(_0x54db57){if(_0x54db57){return _0x54db57[_0xaf2c('0x31')]()[_0xaf2c('0x1a')](function(){var _0x211a69=_0x54db57[_0xaf2c('0x32')]({'plain':!![]});var _0x2d6ed7=_0xaf2c('0x33');return db['UserProfileResource'][_0xaf2c('0x31')]({'where':{'type':_0x2d6ed7,'resourceId':_0x211a69['id']}})['then'](function(){return _0x54db57;});})[_0xaf2c('0x1a')](function(){_0x1408e3['status'](0xcc)[_0xaf2c('0x27')]();});}};}function handleEntityNotFound(_0x59f686,_0x2f3d16){return function(_0x4e877e){if(!_0x4e877e){_0x59f686[_0xaf2c('0x34')](0x194);}return _0x4e877e;};}function handleError(_0x4b9c6b,_0x30fd87){_0x30fd87=_0x30fd87||0x1f4;return function(_0x356402){logger[_0xaf2c('0x21')](_0x356402[_0xaf2c('0x35')]);if(_0x356402[_0xaf2c('0x36')]){delete _0x356402['name'];}_0x4b9c6b['status'](_0x30fd87)[_0xaf2c('0x37')](_0x356402);};}exports[_0xaf2c('0x38')]=function(_0x409700,_0xa44813){var _0x4eeecf={},_0x316238={},_0x573db3={'count':0x0,'rows':[]};var _0xa1248e=_[_0xaf2c('0x39')](db['Trunk'][_0xaf2c('0x3a')],function(_0x24668d){return{'name':_0x24668d[_0xaf2c('0x3b')],'type':_0x24668d[_0xaf2c('0x3c')][_0xaf2c('0x3d')]};});_0x316238[_0xaf2c('0x3e')]=_[_0xaf2c('0x39')](_0xa1248e,_0xaf2c('0x36'));_0x316238[_0xaf2c('0x3f')]=_[_0xaf2c('0x40')](_0x409700[_0xaf2c('0x3f')]);_0x316238[_0xaf2c('0x41')]=_[_0xaf2c('0x42')](_0x316238['model'],_0x316238['query']);_0x4eeecf['attributes']=_[_0xaf2c('0x42')](_0x316238[_0xaf2c('0x3e')],qs[_0xaf2c('0x43')](_0x409700[_0xaf2c('0x3f')][_0xaf2c('0x43')]));_0x4eeecf[_0xaf2c('0x44')]=_0x4eeecf['attributes'][_0xaf2c('0x45')]?_0x4eeecf[_0xaf2c('0x44')]:_0x316238[_0xaf2c('0x3e')];if(!_0x409700['query']['hasOwnProperty'](_0xaf2c('0x46'))){_0x4eeecf['limit']=qs[_0xaf2c('0x2a')](_0x409700[_0xaf2c('0x3f')][_0xaf2c('0x2a')]);_0x4eeecf[_0xaf2c('0x29')]=qs['offset'](_0x409700[_0xaf2c('0x3f')]['offset']);}_0x4eeecf[_0xaf2c('0x47')]=qs[_0xaf2c('0x48')](_0x409700['query'][_0xaf2c('0x48')]);_0x4eeecf['where']=qs[_0xaf2c('0x41')](_[_0xaf2c('0x49')](_0x409700[_0xaf2c('0x3f')],_0x316238[_0xaf2c('0x41')]),_0xa1248e);if(_0x409700[_0xaf2c('0x3f')][_0xaf2c('0x4a')]){_0x4eeecf[_0xaf2c('0x4b')]=_[_0xaf2c('0x4c')](_0x4eeecf[_0xaf2c('0x4b')],{'$or':_['map'](_0xa1248e,function(_0x51d751){if(_0x51d751[_0xaf2c('0x3c')]!=='VIRTUAL'){var _0x4ad36e={};_0x4ad36e[_0x51d751['name']]={'$like':'%'+_0x409700[_0xaf2c('0x3f')][_0xaf2c('0x4a')]+'%'};return _0x4ad36e;}})});}_0x4eeecf=_[_0xaf2c('0x4c')]({},_0x4eeecf,_0x409700[_0xaf2c('0x4d')]);var _0x599b2d={'where':_0x4eeecf[_0xaf2c('0x4b')]};return db['Trunk'][_0xaf2c('0x2b')](_0x599b2d)['then'](function(_0x166c26){_0x573db3[_0xaf2c('0x2b')]=_0x166c26;if(_0x409700[_0xaf2c('0x3f')][_0xaf2c('0x4e')]){_0x4eeecf[_0xaf2c('0x4f')]=[{'all':!![]}];}return db['Trunk'][_0xaf2c('0x50')](_0x4eeecf);})[_0xaf2c('0x1a')](function(_0x4b3ca4){_0x573db3['rows']=_0x4b3ca4;return _0x573db3;})[_0xaf2c('0x1a')](respondWithFilteredResult(_0xa44813,_0x4eeecf))['catch'](handleError(_0xa44813,null));};exports[_0xaf2c('0x51')]=function(_0x23642b,_0x17b9ec){var _0x315b9f={'raw':![],'where':{'id':_0x23642b[_0xaf2c('0x52')]['id']}},_0x367112={};_0x367112[_0xaf2c('0x3e')]=_[_0xaf2c('0x40')](db[_0xaf2c('0x53')][_0xaf2c('0x3a')]);_0x367112[_0xaf2c('0x3f')]=_['keys'](_0x23642b[_0xaf2c('0x3f')]);_0x367112[_0xaf2c('0x41')]=_['intersection'](_0x367112['model'],_0x367112['query']);_0x315b9f[_0xaf2c('0x44')]=_[_0xaf2c('0x42')](_0x367112['model'],qs[_0xaf2c('0x43')](_0x23642b[_0xaf2c('0x3f')][_0xaf2c('0x43')]));_0x315b9f[_0xaf2c('0x44')]=_0x315b9f[_0xaf2c('0x44')][_0xaf2c('0x45')]?_0x315b9f[_0xaf2c('0x44')]:_0x367112['model'];if(_0x23642b[_0xaf2c('0x3f')][_0xaf2c('0x4e')]){_0x315b9f['include']=[{'all':!![]}];}_0x315b9f=_[_0xaf2c('0x4c')]({},_0x315b9f,_0x23642b[_0xaf2c('0x4d')]);return db[_0xaf2c('0x53')][_0xaf2c('0x54')](_0x315b9f)[_0xaf2c('0x1a')](handleEntityNotFound(_0x17b9ec,null))[_0xaf2c('0x1a')](respondWithResult(_0x17b9ec,null))[_0xaf2c('0x25')](handleError(_0x17b9ec,null));};exports[_0xaf2c('0x55')]=function(_0x19b82d,_0x300254){var _0x133678={'where':{'id':_0x19b82d[_0xaf2c('0x52')]['id']}},_0x10a270={};_0x10a270[_0xaf2c('0x3e')]=_[_0xaf2c('0x40')](db[_0xaf2c('0x53')][_0xaf2c('0x3a')]);_0x133678[_0xaf2c('0x44')]=_[_0xaf2c('0x42')](_0x10a270[_0xaf2c('0x3e')],qs['fields'](_0x19b82d[_0xaf2c('0x3f')][_0xaf2c('0x43')]));_0x133678[_0xaf2c('0x44')]=_0x133678['attributes'][_0xaf2c('0x45')]?_0x133678['attributes']:_0x10a270[_0xaf2c('0x3e')];if(_0x19b82d[_0xaf2c('0x3f')][_0xaf2c('0x4e')]){_0x133678[_0xaf2c('0x4f')]=[{'all':!![]}];}_0x133678=_[_0xaf2c('0x4c')]({},_0x133678,_0x19b82d[_0xaf2c('0x4d')]);return db[_0xaf2c('0x53')][_0xaf2c('0x54')](_0x133678)[_0xaf2c('0x1a')](handleEntityNotFound(_0x300254,null))['then'](function(_0x41d08b){if(_0x41d08b){var _0x400dcd=_0x41d08b[_0xaf2c('0x32')]({'plain':!![]});_0x400dcd=qs[_0xaf2c('0x56')](_0x400dcd,['id',_0xaf2c('0x57'),'updatedAt']);_0x19b82d[_0xaf2c('0x58')]=_[_0xaf2c('0x56')](_0x19b82d['body'],['id',_0xaf2c('0x57'),_0xaf2c('0x59')]);return db['Trunk']['create'](_[_0xaf2c('0x4c')](_0x400dcd,_0x19b82d[_0xaf2c('0x58')]),{'include':_0x19b82d[_0xaf2c('0x3f')][_0xaf2c('0x4e')]?[{'all':!![]}]:undefined})['then'](function(_0x36b6f0){var _0x3f48f1=_0x19b82d['user'][_0xaf2c('0x32')]({'plain':!![]});if(!_0x3f48f1)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3f48f1[_0xaf2c('0x5a')]===_0xaf2c('0x5b')){var _0x16e9f4=_0x36b6f0[_0xaf2c('0x32')]({'plain':!![]});var _0x1a297e=_0xaf2c('0x33');return db[_0xaf2c('0x5c')][_0xaf2c('0x54')]({'where':{'name':_0x1a297e,'userProfileId':_0x3f48f1[_0xaf2c('0x5d')]},'raw':!![]})[_0xaf2c('0x1a')](function(_0x53ba41){if(_0x53ba41&&_0x53ba41[_0xaf2c('0x5e')]===0x0){return db[_0xaf2c('0x5f')][_0xaf2c('0x60')]({'name':_0x16e9f4[_0xaf2c('0x36')],'resourceId':_0x16e9f4['id'],'type':_0x53ba41[_0xaf2c('0x36')],'sectionId':_0x53ba41['id']},{})['then'](function(){return _0x36b6f0;});}else{return _0x36b6f0;}})[_0xaf2c('0x25')](function(_0x28b09f){logger[_0xaf2c('0x21')](_0xaf2c('0x61'),_0x28b09f);throw _0x28b09f;});}return _0x36b6f0;});}})[_0xaf2c('0x1a')](respondWithResult(_0x300254,0xc9))['catch'](handleError(_0x300254,null));};exports['create']=function(_0x1166c9,_0x1ead61,_0x5849f8){var _0xf96361;return db[_0xaf2c('0x53')][_0xaf2c('0x60')](_0x1166c9['body'],{'raw':!![]})[_0xaf2c('0x1a')](function(_0x2bd845){_0xf96361=_0x2bd845;return db[_0xaf2c('0x53')][_0xaf2c('0x50')]({'raw':!![]});})['then'](function(_0x32d552){var _0x26129c=fs[_0xaf2c('0x62')](path[_0xaf2c('0x63')](config[_0xaf2c('0x64')],_0xaf2c('0x65')),_0xaf2c('0x66'));var _0x2767c7=fs[_0xaf2c('0x62')](path[_0xaf2c('0x63')](config[_0xaf2c('0x64')],'server/files/templates/registry.ejs'),_0xaf2c('0x66'));var _0x5d965c=ejs[_0xaf2c('0x67')](_0x26129c,{'trunks':_0x32d552||[]});fs[_0xaf2c('0x68')]('/etc/asterisk/sip_xcally_trunks.conf',_0x5d965c);if(_0xf96361[_0xaf2c('0x69')]){var _0x5a95ac=ejs['render'](_0x2767c7,{'trunks':_0x32d552||[]});fs[_0xaf2c('0x68')](_0xaf2c('0x6a'),_0x5a95ac);}})[_0xaf2c('0x1a')](function(){return respondWithRpcPromise('Reload','create',{'module':'chan_sip.so'});})[_0xaf2c('0x1a')](function(){var _0x3e972c=_0x1166c9['user'][_0xaf2c('0x32')]({'plain':!![]});if(!_0x3e972c)throw new Error(_0xaf2c('0x6b'));if(_0x3e972c[_0xaf2c('0x5a')]===_0xaf2c('0x5b')){var _0x6e1837=_0xf96361[_0xaf2c('0x32')]({'plain':!![]});return db['UserProfileSection'][_0xaf2c('0x54')]({'where':{'name':_0xaf2c('0x33'),'userProfileId':_0x3e972c[_0xaf2c('0x5d')]},'raw':!![]})['then'](function(_0xc9dd21){if(_0xc9dd21&&_0xc9dd21[_0xaf2c('0x5e')]===0x0){return db[_0xaf2c('0x5f')]['create']({'name':_0x6e1837[_0xaf2c('0x36')],'resourceId':_0x6e1837['id'],'type':_0xc9dd21[_0xaf2c('0x36')],'sectionId':_0xc9dd21['id']},{})[_0xaf2c('0x1a')](function(){return _0xf96361;});}else{return _0xf96361;}})[_0xaf2c('0x25')](function(_0x491160){logger[_0xaf2c('0x21')](_0xaf2c('0x61'),_0x491160);throw _0x491160;});}return _0xf96361;})[_0xaf2c('0x1a')](respondWithResult(_0x1ead61,0xc9))['catch'](handleError(_0x1ead61,null));};exports['update']=function(_0x427ece,_0x1b7dc1,_0x5571eb){var _0x3675d9;return db[_0xaf2c('0x53')]['find']({'where':{'id':_0x427ece[_0xaf2c('0x52')]['id']}})[_0xaf2c('0x1a')](handleEntityNotFound(_0x1b7dc1,null))[_0xaf2c('0x1a')](saveUpdates(_0x427ece[_0xaf2c('0x58')],null))[_0xaf2c('0x1a')](function(_0x4af252){if(_0x4af252){_0x3675d9=_0x4af252;return db['Trunk'][_0xaf2c('0x50')]({'raw':!![]});}})[_0xaf2c('0x1a')](function(_0x55b568){if(_0x55b568){var _0x4f378e=fs[_0xaf2c('0x62')](path[_0xaf2c('0x63')](config[_0xaf2c('0x64')],_0xaf2c('0x65')),_0xaf2c('0x66'));var _0x4b9fdc=fs[_0xaf2c('0x62')](path[_0xaf2c('0x63')](config[_0xaf2c('0x64')],_0xaf2c('0x6c')),_0xaf2c('0x66'));var _0x41c707=ejs['render'](_0x4f378e,{'trunks':_0x55b568||[]});fs[_0xaf2c('0x68')](_0xaf2c('0x6d'),_0x41c707);var _0x483774=ejs['render'](_0x4b9fdc,{'trunks':_0x55b568||[]});fs['writeFileSync'](_0xaf2c('0x6a'),_0x483774);return respondWithRpcPromise(_0xaf2c('0x6e'),_0xaf2c('0x30'),{'module':_0xaf2c('0x6f')});}return null;})['then'](function(_0x19fbd5){if(_0x19fbd5){return _0x3675d9;}})[_0xaf2c('0x1a')](respondWithResult(_0x1b7dc1,null))[_0xaf2c('0x25')](handleError(_0x1b7dc1,null));};exports[_0xaf2c('0x31')]=function(_0x4ddf95,_0x1e8fc0,_0x23aeac){var _0x41590;return db[_0xaf2c('0x53')][_0xaf2c('0x54')]({'where':{'id':_0x4ddf95['params']['id']}})[_0xaf2c('0x1a')](handleEntityNotFound(_0x1e8fc0,null))[_0xaf2c('0x1a')](removeEntity(_0x1e8fc0,null))['then'](function(){return db['Trunk'][_0xaf2c('0x50')]({'raw':!![]});})[_0xaf2c('0x1a')](function(_0x5bce65){var _0x1e6a12=fs[_0xaf2c('0x62')](path[_0xaf2c('0x63')](config[_0xaf2c('0x64')],_0xaf2c('0x65')),_0xaf2c('0x66'));var _0x2a3cb4=fs[_0xaf2c('0x62')](path['join'](config[_0xaf2c('0x64')],'server/files/templates/registry.ejs'),_0xaf2c('0x66'));var _0x7724cc=ejs['render'](_0x1e6a12,{'trunks':_0x5bce65});var _0x4a9ea8=ejs[_0xaf2c('0x67')](_0x2a3cb4,{'trunks':_0x5bce65});fs[_0xaf2c('0x68')](_0xaf2c('0x6d'),_0x7724cc);fs['writeFileSync'](_0xaf2c('0x6a'),_0x4a9ea8);return respondWithRpcPromise(_0xaf2c('0x6e'),_0xaf2c('0x31'),{'module':'chan_sip.so'});})['catch'](handleError(_0x1e8fc0,null));}; \ No newline at end of file +var _0x3e74=['map','Trunk','rawAttributes','fieldName','key','model','keys','query','filters','intersection','fields','attributes','length','nolimit','order','sort','pick','where','type','filter','merge','options','includeAll','include','findAll','params','clone','find','get','omit','createdAt','body','updatedAt','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','root','server/files/templates/trunk.ejs','utf8','readFileSync','server/files/templates/registry.ejs','render','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','writeFileSync','eml-format','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','request','then','info','debug','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','Trunk,\x20%s,\x20%s','message','result','catch','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','apply','reject','update','destroy','Trunks','UserProfileResource','stack','name','send','index'];(function(_0x511a8e,_0x4bd697){var _0x497352=function(_0x19ee4f){while(--_0x19ee4f){_0x511a8e['push'](_0x511a8e['shift']());}};_0x497352(++_0x4bd697);}(_0x3e74,0x175));var _0x43e7=function(_0x3188fa,_0x20e3b8){_0x3188fa=_0x3188fa-0x0;var _0x32b83b=_0x3e74[_0x3188fa];return _0x32b83b;};'use strict';var emlformat=require(_0x43e7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x43e7('0x1'));var jsonpatch=require(_0x43e7('0x2'));var rp=require(_0x43e7('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x43e7('0x4'));var util=require('util');var path=require(_0x43e7('0x5'));var sox=require(_0x43e7('0x6'));var csv=require(_0x43e7('0x7'));var ejs=require(_0x43e7('0x8'));var fs=require('fs');var fs_extra=require(_0x43e7('0x9'));var _=require('lodash');var squel=require(_0x43e7('0xa'));var crypto=require(_0x43e7('0xb'));var jsforce=require(_0x43e7('0xc'));var deskjs=require(_0x43e7('0xd'));var toCsv=require(_0x43e7('0x7'));var querystring=require('querystring');var Papa=require(_0x43e7('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x43e7('0xf'));var as=require(_0x43e7('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x43e7('0x11'))('api');var utils=require(_0x43e7('0x12'));var config=require(_0x43e7('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x43e7('0x14'))['db'];var jayson=require(_0x43e7('0x15'));var client=jayson[_0x43e7('0x16')][_0x43e7('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x4e008c,_0x583d85,_0x2fcb36,_0x21fdd3){return new BPromise(function(_0x44b0bd,_0x51b974){var _0x5e641c=_0x21fdd3||client;return _0x5e641c[_0x43e7('0x18')](_0x4e008c,_0x2fcb36)[_0x43e7('0x19')](function(_0x203378){logger[_0x43e7('0x1a')]('Trunk,\x20%s,\x20%s',_0x583d85,'request\x20sent');logger[_0x43e7('0x1b')](_0x43e7('0x1c'),_0x583d85,_0x43e7('0x1d'),JSON['stringify'](_0x203378));if(_0x203378['error']){if(_0x203378[_0x43e7('0x1e')][_0x43e7('0x1f')]===0x1f4){logger[_0x43e7('0x1e')](_0x43e7('0x20'),_0x583d85,_0x203378[_0x43e7('0x1e')][_0x43e7('0x21')]);return _0x51b974(_0x203378[_0x43e7('0x1e')][_0x43e7('0x21')]);}logger[_0x43e7('0x1e')](_0x43e7('0x20'),_0x583d85,_0x203378[_0x43e7('0x1e')][_0x43e7('0x21')]);return _0x44b0bd(_0x203378['error'][_0x43e7('0x21')]);}else{logger[_0x43e7('0x1a')]('Trunk,\x20%s,\x20%s',_0x583d85,_0x43e7('0x1d'));_0x44b0bd(_0x203378[_0x43e7('0x22')][_0x43e7('0x21')]);}})[_0x43e7('0x23')](function(_0x4077fb){logger[_0x43e7('0x1e')]('Trunk,\x20%s,\x20%s',_0x583d85,_0x4077fb);_0x51b974(_0x4077fb);});});}function respondWithStatusCode(_0x454359,_0x4eea52){_0x4eea52=_0x4eea52||0xcc;return function(_0x4c9df3){if(_0x4c9df3){return _0x454359[_0x43e7('0x24')](_0x4eea52);}return _0x454359[_0x43e7('0x25')](_0x4eea52)['end']();};}function respondWithResult(_0x1f0673,_0x4ca5cf){_0x4ca5cf=_0x4ca5cf||0xc8;return function(_0x326dab){if(_0x326dab){return _0x1f0673['status'](_0x4ca5cf)[_0x43e7('0x26')](_0x326dab);}};}function respondWithFilteredResult(_0x1b5f50,_0x20888b){return function(_0x405f85){if(_0x405f85){var _0x51f4d7=typeof _0x20888b['offset']===_0x43e7('0x27')&&typeof _0x20888b['limit']===_0x43e7('0x27');var _0x40dc8f=_0x405f85[_0x43e7('0x28')];var _0xb1fc63=_0x51f4d7?0x0:_0x20888b['offset'];var _0x33a1a5=_0x51f4d7?_0x405f85[_0x43e7('0x28')]:_0x20888b[_0x43e7('0x29')]+_0x20888b[_0x43e7('0x2a')];var _0x442c3b;if(_0x33a1a5>=_0x40dc8f){_0x33a1a5=_0x40dc8f;_0x442c3b=0xc8;}else{_0x442c3b=0xce;}_0x1b5f50[_0x43e7('0x25')](_0x442c3b);return _0x1b5f50[_0x43e7('0x2b')](_0x43e7('0x2c'),_0xb1fc63+'-'+_0x33a1a5+'/'+_0x40dc8f)[_0x43e7('0x26')](_0x405f85);}return null;};}function patchUpdates(_0x35dbcd){return function(_0x17df44){try{jsonpatch[_0x43e7('0x2d')](_0x17df44,_0x35dbcd,!![]);}catch(_0x2bde44){return BPromise[_0x43e7('0x2e')](_0x2bde44);}return _0x17df44['save']();};}function saveUpdates(_0x238321,_0x44f6b0){return function(_0x3b8f78){if(_0x3b8f78){return _0x3b8f78[_0x43e7('0x2f')](_0x238321)[_0x43e7('0x19')](function(_0x4c8650){return _0x4c8650;});}return null;};}function removeEntity(_0x1eba65,_0x49b83d){return function(_0x30d47e){if(_0x30d47e){return _0x30d47e[_0x43e7('0x30')]()['then'](function(){var _0x5a7342=_0x30d47e['get']({'plain':!![]});var _0xf8320=_0x43e7('0x31');return db[_0x43e7('0x32')][_0x43e7('0x30')]({'where':{'type':_0xf8320,'resourceId':_0x5a7342['id']}})[_0x43e7('0x19')](function(){return _0x30d47e;});})[_0x43e7('0x19')](function(){_0x1eba65['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4ac23d,_0x59e5b2){return function(_0x4e8e86){if(!_0x4e8e86){_0x4ac23d['sendStatus'](0x194);}return _0x4e8e86;};}function handleError(_0x5cb753,_0x14d888){_0x14d888=_0x14d888||0x1f4;return function(_0x49cda6){logger[_0x43e7('0x1e')](_0x49cda6[_0x43e7('0x33')]);if(_0x49cda6[_0x43e7('0x34')]){delete _0x49cda6[_0x43e7('0x34')];}_0x5cb753[_0x43e7('0x25')](_0x14d888)[_0x43e7('0x35')](_0x49cda6);};}exports[_0x43e7('0x36')]=function(_0x4f1a5f,_0x5332d9){var _0x5d84f4={},_0xfa0474={},_0xfe70e9={'count':0x0,'rows':[]};var _0x199ff6=_[_0x43e7('0x37')](db[_0x43e7('0x38')][_0x43e7('0x39')],function(_0x1d4589){return{'name':_0x1d4589[_0x43e7('0x3a')],'type':_0x1d4589['type'][_0x43e7('0x3b')]};});_0xfa0474[_0x43e7('0x3c')]=_['map'](_0x199ff6,_0x43e7('0x34'));_0xfa0474['query']=_[_0x43e7('0x3d')](_0x4f1a5f[_0x43e7('0x3e')]);_0xfa0474[_0x43e7('0x3f')]=_[_0x43e7('0x40')](_0xfa0474[_0x43e7('0x3c')],_0xfa0474[_0x43e7('0x3e')]);_0x5d84f4['attributes']=_['intersection'](_0xfa0474[_0x43e7('0x3c')],qs[_0x43e7('0x41')](_0x4f1a5f[_0x43e7('0x3e')][_0x43e7('0x41')]));_0x5d84f4[_0x43e7('0x42')]=_0x5d84f4['attributes'][_0x43e7('0x43')]?_0x5d84f4[_0x43e7('0x42')]:_0xfa0474['model'];if(!_0x4f1a5f[_0x43e7('0x3e')]['hasOwnProperty'](_0x43e7('0x44'))){_0x5d84f4['limit']=qs[_0x43e7('0x2a')](_0x4f1a5f[_0x43e7('0x3e')][_0x43e7('0x2a')]);_0x5d84f4[_0x43e7('0x29')]=qs['offset'](_0x4f1a5f['query'][_0x43e7('0x29')]);}_0x5d84f4[_0x43e7('0x45')]=qs[_0x43e7('0x46')](_0x4f1a5f[_0x43e7('0x3e')]['sort']);_0x5d84f4['where']=qs['filters'](_[_0x43e7('0x47')](_0x4f1a5f['query'],_0xfa0474[_0x43e7('0x3f')]),_0x199ff6);if(_0x4f1a5f['query']['filter']){_0x5d84f4[_0x43e7('0x48')]=_['merge'](_0x5d84f4[_0x43e7('0x48')],{'$or':_[_0x43e7('0x37')](_0x199ff6,function(_0x257bd8){if(_0x257bd8[_0x43e7('0x49')]!=='VIRTUAL'){var _0x91f1e4={};_0x91f1e4[_0x257bd8[_0x43e7('0x34')]]={'$like':'%'+_0x4f1a5f[_0x43e7('0x3e')][_0x43e7('0x4a')]+'%'};return _0x91f1e4;}})});}_0x5d84f4=_[_0x43e7('0x4b')]({},_0x5d84f4,_0x4f1a5f[_0x43e7('0x4c')]);var _0x51eef4={'where':_0x5d84f4['where']};return db[_0x43e7('0x38')][_0x43e7('0x28')](_0x51eef4)[_0x43e7('0x19')](function(_0x4c00a8){_0xfe70e9['count']=_0x4c00a8;if(_0x4f1a5f['query'][_0x43e7('0x4d')]){_0x5d84f4[_0x43e7('0x4e')]=[{'all':!![]}];}return db['Trunk'][_0x43e7('0x4f')](_0x5d84f4);})[_0x43e7('0x19')](function(_0x3c96fe){_0xfe70e9['rows']=_0x3c96fe;return _0xfe70e9;})['then'](respondWithFilteredResult(_0x5332d9,_0x5d84f4))['catch'](handleError(_0x5332d9,null));};exports['show']=function(_0x214e7e,_0xe955fc){var _0x52fea5={'raw':![],'where':{'id':_0x214e7e[_0x43e7('0x50')]['id']}},_0x23e7cb={};_0x23e7cb[_0x43e7('0x3c')]=_[_0x43e7('0x3d')](db['Trunk'][_0x43e7('0x39')]);_0x23e7cb['query']=_['keys'](_0x214e7e[_0x43e7('0x3e')]);_0x23e7cb[_0x43e7('0x3f')]=_[_0x43e7('0x40')](_0x23e7cb[_0x43e7('0x3c')],_0x23e7cb[_0x43e7('0x3e')]);_0x52fea5[_0x43e7('0x42')]=_[_0x43e7('0x40')](_0x23e7cb[_0x43e7('0x3c')],qs[_0x43e7('0x41')](_0x214e7e[_0x43e7('0x3e')]['fields']));_0x52fea5[_0x43e7('0x42')]=_0x52fea5[_0x43e7('0x42')]['length']?_0x52fea5[_0x43e7('0x42')]:_0x23e7cb['model'];if(_0x214e7e[_0x43e7('0x3e')][_0x43e7('0x4d')]){_0x52fea5[_0x43e7('0x4e')]=[{'all':!![]}];}_0x52fea5=_[_0x43e7('0x4b')]({},_0x52fea5,_0x214e7e[_0x43e7('0x4c')]);return db['Trunk']['find'](_0x52fea5)[_0x43e7('0x19')](handleEntityNotFound(_0xe955fc,null))[_0x43e7('0x19')](respondWithResult(_0xe955fc,null))[_0x43e7('0x23')](handleError(_0xe955fc,null));};exports[_0x43e7('0x51')]=function(_0x23d835,_0x25bb44){var _0xa47464={'where':{'id':_0x23d835[_0x43e7('0x50')]['id']}},_0x44f8a0={};_0x44f8a0[_0x43e7('0x3c')]=_[_0x43e7('0x3d')](db['Trunk'][_0x43e7('0x39')]);_0xa47464[_0x43e7('0x42')]=_['intersection'](_0x44f8a0[_0x43e7('0x3c')],qs[_0x43e7('0x41')](_0x23d835[_0x43e7('0x3e')]['fields']));_0xa47464['attributes']=_0xa47464[_0x43e7('0x42')][_0x43e7('0x43')]?_0xa47464['attributes']:_0x44f8a0[_0x43e7('0x3c')];if(_0x23d835['query']['includeAll']){_0xa47464[_0x43e7('0x4e')]=[{'all':!![]}];}_0xa47464=_[_0x43e7('0x4b')]({},_0xa47464,_0x23d835[_0x43e7('0x4c')]);return db[_0x43e7('0x38')][_0x43e7('0x52')](_0xa47464)['then'](handleEntityNotFound(_0x25bb44,null))[_0x43e7('0x19')](function(_0xdb9fbe){if(_0xdb9fbe){var _0x4d89bd=_0xdb9fbe[_0x43e7('0x53')]({'plain':!![]});_0x4d89bd=qs[_0x43e7('0x54')](_0x4d89bd,['id',_0x43e7('0x55'),'updatedAt']);_0x23d835['body']=_['omit'](_0x23d835[_0x43e7('0x56')],['id',_0x43e7('0x55'),_0x43e7('0x57')]);return db[_0x43e7('0x38')]['create'](_['merge'](_0x4d89bd,_0x23d835[_0x43e7('0x56')]),{'include':_0x23d835[_0x43e7('0x3e')][_0x43e7('0x4d')]?[{'all':!![]}]:undefined})[_0x43e7('0x19')](function(_0x5ea0db){var _0x4438c0=_0x23d835[_0x43e7('0x58')][_0x43e7('0x53')]({'plain':!![]});if(!_0x4438c0)throw new Error(_0x43e7('0x59'));if(_0x4438c0[_0x43e7('0x5a')]===_0x43e7('0x58')){var _0x4665db=_0x5ea0db[_0x43e7('0x53')]({'plain':!![]});var _0x406155=_0x43e7('0x31');return db[_0x43e7('0x5b')]['find']({'where':{'name':_0x406155,'userProfileId':_0x4438c0['userProfileId']},'raw':!![]})[_0x43e7('0x19')](function(_0x58a3a8){if(_0x58a3a8&&_0x58a3a8['autoAssociation']===0x0){return db['UserProfileResource'][_0x43e7('0x5c')]({'name':_0x4665db[_0x43e7('0x34')],'resourceId':_0x4665db['id'],'type':_0x58a3a8['name'],'sectionId':_0x58a3a8['id']},{})[_0x43e7('0x19')](function(){return _0x5ea0db;});}else{return _0x5ea0db;}})[_0x43e7('0x23')](function(_0x1d8438){logger['error'](_0x43e7('0x5d'),_0x1d8438);throw _0x1d8438;});}return _0x5ea0db;});}})[_0x43e7('0x19')](respondWithResult(_0x25bb44,0xc9))[_0x43e7('0x23')](handleError(_0x25bb44,null));};exports[_0x43e7('0x5c')]=function(_0x2f43d7,_0x472a19,_0x1e02fa){var _0x515f01;return db[_0x43e7('0x38')][_0x43e7('0x5c')](_0x2f43d7[_0x43e7('0x56')],{'raw':!![]})['then'](function(_0x56b06d){_0x515f01=_0x56b06d;return db[_0x43e7('0x38')]['findAll']({'raw':!![]});})['then'](function(_0x1b793d){var _0x154e47=fs['readFileSync'](path[_0x43e7('0x5e')](config[_0x43e7('0x5f')],_0x43e7('0x60')),_0x43e7('0x61'));var _0x16499c=fs[_0x43e7('0x62')](path[_0x43e7('0x5e')](config['root'],_0x43e7('0x63')),_0x43e7('0x61'));var _0x4e5956=ejs[_0x43e7('0x64')](_0x154e47,{'trunks':_0x1b793d||[]});fs['writeFileSync'](_0x43e7('0x65'),_0x4e5956);if(_0x515f01[_0x43e7('0x66')]){var _0x37301b=ejs[_0x43e7('0x64')](_0x16499c,{'trunks':_0x1b793d||[]});fs['writeFileSync'](_0x43e7('0x67'),_0x37301b);}})[_0x43e7('0x19')](function(){return respondWithRpcPromise(_0x43e7('0x68'),'create',{'module':_0x43e7('0x69')});})[_0x43e7('0x19')](function(){var _0x219dc6=_0x2f43d7[_0x43e7('0x58')][_0x43e7('0x53')]({'plain':!![]});if(!_0x219dc6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x219dc6[_0x43e7('0x5a')]===_0x43e7('0x58')){var _0x35d133=_0x515f01[_0x43e7('0x53')]({'plain':!![]});return db[_0x43e7('0x5b')][_0x43e7('0x52')]({'where':{'name':_0x43e7('0x31'),'userProfileId':_0x219dc6['userProfileId']},'raw':!![]})['then'](function(_0x405faa){if(_0x405faa&&_0x405faa['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x35d133[_0x43e7('0x34')],'resourceId':_0x35d133['id'],'type':_0x405faa[_0x43e7('0x34')],'sectionId':_0x405faa['id']},{})[_0x43e7('0x19')](function(){return _0x515f01;});}else{return _0x515f01;}})[_0x43e7('0x23')](function(_0x18713b){logger[_0x43e7('0x1e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x18713b);throw _0x18713b;});}return _0x515f01;})[_0x43e7('0x19')](respondWithResult(_0x472a19,0xc9))[_0x43e7('0x23')](handleError(_0x472a19,null));};exports[_0x43e7('0x2f')]=function(_0x5b4c76,_0x2abca0,_0xea84ec){var _0x184ae3;return db[_0x43e7('0x38')][_0x43e7('0x52')]({'where':{'id':_0x5b4c76[_0x43e7('0x50')]['id']}})[_0x43e7('0x19')](handleEntityNotFound(_0x2abca0,null))[_0x43e7('0x19')](saveUpdates(_0x5b4c76['body'],null))['then'](function(_0x55990c){if(_0x55990c){_0x184ae3=_0x55990c;return db[_0x43e7('0x38')][_0x43e7('0x4f')]({'raw':!![]});}})['then'](function(_0x3fe23f){if(_0x3fe23f){var _0x39a787=fs[_0x43e7('0x62')](path[_0x43e7('0x5e')](config['root'],'server/files/templates/trunk.ejs'),'utf8');var _0x177a7a=fs[_0x43e7('0x62')](path['join'](config['root'],_0x43e7('0x63')),_0x43e7('0x61'));var _0x3b7e5b=ejs['render'](_0x39a787,{'trunks':_0x3fe23f||[]});fs[_0x43e7('0x6a')](_0x43e7('0x65'),_0x3b7e5b);var _0x401654=ejs[_0x43e7('0x64')](_0x177a7a,{'trunks':_0x3fe23f||[]});fs['writeFileSync'](_0x43e7('0x67'),_0x401654);return respondWithRpcPromise('Reload',_0x43e7('0x2f'),{'module':_0x43e7('0x69')});}return null;})[_0x43e7('0x19')](function(_0x90667c){if(_0x90667c){return _0x184ae3;}})[_0x43e7('0x19')](respondWithResult(_0x2abca0,null))[_0x43e7('0x23')](handleError(_0x2abca0,null));};exports[_0x43e7('0x30')]=function(_0x5e8d4e,_0x109c86,_0x40257e){var _0x1aea4e;return db[_0x43e7('0x38')]['find']({'where':{'id':_0x5e8d4e['params']['id']}})['then'](handleEntityNotFound(_0x109c86,null))[_0x43e7('0x19')](removeEntity(_0x109c86,null))['then'](function(){return db[_0x43e7('0x38')][_0x43e7('0x4f')]({'raw':!![]});})[_0x43e7('0x19')](function(_0x7387f6){var _0xa75254=fs[_0x43e7('0x62')](path[_0x43e7('0x5e')](config[_0x43e7('0x5f')],_0x43e7('0x60')),_0x43e7('0x61'));var _0x3de22e=fs['readFileSync'](path[_0x43e7('0x5e')](config[_0x43e7('0x5f')],_0x43e7('0x63')),_0x43e7('0x61'));var _0x206e54=ejs['render'](_0xa75254,{'trunks':_0x7387f6});var _0x5e04ec=ejs[_0x43e7('0x64')](_0x3de22e,{'trunks':_0x7387f6});fs[_0x43e7('0x6a')]('/etc/asterisk/sip_xcally_trunks.conf',_0x206e54);fs[_0x43e7('0x6a')](_0x43e7('0x67'),_0x5e04ec);return respondWithRpcPromise('Reload','destroy',{'module':_0x43e7('0x69')});})[_0x43e7('0x23')](handleError(_0x109c86,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index c9db31e..478e75d 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 _0x3503=['request-promise','rimraf','../../config/environment','./trunk.attributes','exports','define','tools_trunks','lodash','util','bluebird'];(function(_0x354663,_0x24387d){var _0x4206f2=function(_0x284eb6){while(--_0x284eb6){_0x354663['push'](_0x354663['shift']());}};_0x4206f2(++_0x24387d);}(_0x3503,0x18d));var _0x3350=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x3503[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x3350('0x0'));var util=require(_0x3350('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x3350('0x2'));var rp=require(_0x3350('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3350('0x4'));var config=require(_0x3350('0x5'));var attributes=require(_0x3350('0x6'));module[_0x3350('0x7')]=function(_0x3ae8f0,_0x3bff30){return _0x3ae8f0[_0x3350('0x8')]('Trunk',attributes,{'tableName':_0x3350('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x335a=['bluebird','path','rimraf','exports','define','tools_trunks','lodash','../../config/logger','api','moment'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x335a,0xec));var _0xa335=function(_0x4bb0fb,_0x19f6cf){_0x4bb0fb=_0x4bb0fb-0x0;var _0x49a83c=_0x335a[_0x4bb0fb];return _0x49a83c;};'use strict';var _=require(_0xa335('0x0'));var util=require('util');var logger=require(_0xa335('0x1'))(_0xa335('0x2'));var moment=require(_0xa335('0x3'));var BPromise=require(_0xa335('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa335('0x5'));var rimraf=require(_0xa335('0x6'));var config=require('../../config/environment');var attributes=require('./trunk.attributes');module[_0xa335('0x7')]=function(_0x241c1f,_0x5cd307){return _0x241c1f[_0xa335('0x8')]('Trunk',attributes,{'tableName':_0xa335('0x9'),'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 c6f85c8..e22cbe2 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 _0x7a0b=['debug','stringify','error','code','message','catch','GetTrunk','Trunk','options','raw','limit','map','include','attributes','ShowTrunk','find','model','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent'];(function(_0x240f3c,_0x1d5716){var _0x5bb04e=function(_0x3b228d){while(--_0x3b228d){_0x240f3c['push'](_0x240f3c['shift']());}};_0x5bb04e(++_0x1d5716);}(_0x7a0b,0x13a));var _0xb7a0=function(_0x156e2c,_0x2a7300){_0x156e2c=_0x156e2c-0x0;var _0x136ac8=_0x7a0b[_0x156e2c];return _0x136ac8;};'use strict';var _=require('lodash');var util=require(_0xb7a0('0x0'));var moment=require(_0xb7a0('0x1'));var BPromise=require(_0xb7a0('0x2'));var rs=require(_0xb7a0('0x3'));var fs=require('fs');var Redis=require(_0xb7a0('0x4'));var db=require(_0xb7a0('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xb7a0('0x6'))(_0xb7a0('0x7'));var config=require(_0xb7a0('0x8'));var jayson=require(_0xb7a0('0x9'));var client=jayson[_0xb7a0('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x32926b,_0x30d6db,_0x58d628){return new BPromise(function(_0x21ac72,_0x10febd){return client[_0xb7a0('0xb')](_0x32926b,_0x58d628)[_0xb7a0('0xc')](function(_0xed781b){logger[_0xb7a0('0xd')](_0xb7a0('0xe'),_0x30d6db,_0xb7a0('0xf'));logger[_0xb7a0('0x10')]('Trunk,\x20%s,\x20%s,\x20%s',_0x30d6db,_0xb7a0('0xf'),JSON[_0xb7a0('0x11')](_0xed781b));if(_0xed781b['error']){if(_0xed781b[_0xb7a0('0x12')][_0xb7a0('0x13')]===0x1f4){logger['error']('Trunk,\x20%s,\x20%s',_0x30d6db,_0xed781b[_0xb7a0('0x12')][_0xb7a0('0x14')]);return _0x10febd(_0xed781b[_0xb7a0('0x12')]['message']);}logger[_0xb7a0('0x12')](_0xb7a0('0xe'),_0x30d6db,_0xed781b[_0xb7a0('0x12')][_0xb7a0('0x14')]);return _0x21ac72(_0xed781b['error']['message']);}else{logger[_0xb7a0('0xd')]('Trunk,\x20%s,\x20%s',_0x30d6db,_0xb7a0('0xf'));_0x21ac72(_0xed781b['result'][_0xb7a0('0x14')]);}})[_0xb7a0('0x15')](function(_0x30d56b){logger[_0xb7a0('0x12')]('Trunk,\x20%s,\x20%s',_0x30d6db,_0x30d56b);_0x10febd(_0x30d56b);});});}exports[_0xb7a0('0x16')]=function(_0x3f7392){var _0x32c86d=this;return new Promise(function(_0x3f6b0e,_0x4b48e0){return db[_0xb7a0('0x17')]['findAll']({'raw':_0x3f7392[_0xb7a0('0x18')]?_0x3f7392[_0xb7a0('0x18')][_0xb7a0('0x19')]===undefined?!![]:![]:!![],'where':_0x3f7392['options']?_0x3f7392[_0xb7a0('0x18')]['where']||null:null,'attributes':_0x3f7392[_0xb7a0('0x18')]?_0x3f7392[_0xb7a0('0x18')]['attributes']||null:null,'limit':_0x3f7392[_0xb7a0('0x18')]?_0x3f7392[_0xb7a0('0x18')][_0xb7a0('0x1a')]||null:null,'include':_0x3f7392[_0xb7a0('0x18')]?_0x3f7392[_0xb7a0('0x18')]['include']?_[_0xb7a0('0x1b')](_0x3f7392[_0xb7a0('0x18')][_0xb7a0('0x1c')],function(_0x38b14e){return{'model':db[_0x38b14e['model']],'as':_0x38b14e['as'],'attributes':_0x38b14e[_0xb7a0('0x1d')],'include':_0x38b14e['include']?_[_0xb7a0('0x1b')](_0x38b14e[_0xb7a0('0x1c')],function(_0x50cc0c){return{'model':db[_0x50cc0c['model']],'as':_0x50cc0c['as'],'attributes':_0x50cc0c['attributes'],'include':_0x50cc0c[_0xb7a0('0x1c')]?_[_0xb7a0('0x1b')](_0x50cc0c[_0xb7a0('0x1c')],function(_0x36c0af){return{'model':db[_0x36c0af['model']],'as':_0x36c0af['as'],'attributes':_0x36c0af[_0xb7a0('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x46a9f5){logger[_0xb7a0('0xd')](_0xb7a0('0x16'),_0x3f7392);logger[_0xb7a0('0x10')]('GetTrunk',_0x3f7392,JSON[_0xb7a0('0x11')](_0x46a9f5));_0x3f6b0e(_0x46a9f5);})[_0xb7a0('0x15')](function(_0x1fd249){logger[_0xb7a0('0x12')](_0xb7a0('0x16'),_0x1fd249['message'],_0x3f7392);_0x4b48e0(_0x32c86d[_0xb7a0('0x12')](0x1f4,_0x1fd249['message']));});});};exports[_0xb7a0('0x1e')]=function(_0x2525f4){var _0x380030=this;return new Promise(function(_0x5cd8e6,_0x34feee){return db[_0xb7a0('0x17')][_0xb7a0('0x1f')]({'raw':_0x2525f4['options']?_0x2525f4[_0xb7a0('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x2525f4[_0xb7a0('0x18')]?_0x2525f4[_0xb7a0('0x18')]['where']||null:null,'attributes':_0x2525f4['options']?_0x2525f4[_0xb7a0('0x18')][_0xb7a0('0x1d')]||null:null,'include':_0x2525f4[_0xb7a0('0x18')]?_0x2525f4[_0xb7a0('0x18')][_0xb7a0('0x1c')]?_[_0xb7a0('0x1b')](_0x2525f4[_0xb7a0('0x18')][_0xb7a0('0x1c')],function(_0x58201f){return{'model':db[_0x58201f[_0xb7a0('0x20')]],'as':_0x58201f['as'],'attributes':_0x58201f[_0xb7a0('0x1d')],'include':_0x58201f['include']?_['map'](_0x58201f['include'],function(_0x2de68d){return{'model':db[_0x2de68d['model']],'as':_0x2de68d['as'],'attributes':_0x2de68d[_0xb7a0('0x1d')],'include':_0x2de68d[_0xb7a0('0x1c')]?_[_0xb7a0('0x1b')](_0x2de68d[_0xb7a0('0x1c')],function(_0x3bc366){return{'model':db[_0x3bc366[_0xb7a0('0x20')]],'as':_0x3bc366['as'],'attributes':_0x3bc366[_0xb7a0('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xb7a0('0xc')](function(_0x47ba9b){logger[_0xb7a0('0xd')](_0xb7a0('0x1e'),_0x2525f4);logger['debug'](_0xb7a0('0x1e'),_0x2525f4,JSON[_0xb7a0('0x11')](_0x47ba9b));_0x5cd8e6(_0x47ba9b);})[_0xb7a0('0x15')](function(_0x3165bb){logger[_0xb7a0('0x12')](_0xb7a0('0x1e'),_0x3165bb['message'],_0x2525f4);_0x34feee(_0x380030['error'](0x1f4,_0x3165bb[_0xb7a0('0x14')]));});});}; \ No newline at end of file +var _0x9c45=['../../config/utils','../../config/logger','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','GetTrunk','Trunk','findAll','options','attributes','include','model','ShowTrunk','find','raw','where','map','lodash','moment','bluebird','ioredis'];(function(_0x5b027b,_0x2fdeb9){var _0x3c08e4=function(_0x595bf4){while(--_0x595bf4){_0x5b027b['push'](_0x5b027b['shift']());}};_0x3c08e4(++_0x2fdeb9);}(_0x9c45,0x84));var _0x59c4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9c45[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x59c4('0x0'));var util=require('util');var moment=require(_0x59c4('0x1'));var BPromise=require(_0x59c4('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x59c4('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x59c4('0x4'));var logger=require(_0x59c4('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x59c4('0x6'));var client=jayson[_0x59c4('0x7')][_0x59c4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x310d18,_0x411a34,_0x1a7781){return new BPromise(function(_0xcad758,_0xac801b){return client[_0x59c4('0x9')](_0x310d18,_0x1a7781)[_0x59c4('0xa')](function(_0x2475b8){logger[_0x59c4('0xb')](_0x59c4('0xc'),_0x411a34,_0x59c4('0xd'));logger[_0x59c4('0xe')](_0x59c4('0xf'),_0x411a34,_0x59c4('0xd'),JSON[_0x59c4('0x10')](_0x2475b8));if(_0x2475b8[_0x59c4('0x11')]){if(_0x2475b8[_0x59c4('0x11')][_0x59c4('0x12')]===0x1f4){logger[_0x59c4('0x11')](_0x59c4('0xc'),_0x411a34,_0x2475b8['error'][_0x59c4('0x13')]);return _0xac801b(_0x2475b8[_0x59c4('0x11')][_0x59c4('0x13')]);}logger[_0x59c4('0x11')](_0x59c4('0xc'),_0x411a34,_0x2475b8['error'][_0x59c4('0x13')]);return _0xcad758(_0x2475b8['error'][_0x59c4('0x13')]);}else{logger[_0x59c4('0xb')]('Trunk,\x20%s,\x20%s',_0x411a34,_0x59c4('0xd'));_0xcad758(_0x2475b8[_0x59c4('0x14')][_0x59c4('0x13')]);}})[_0x59c4('0x15')](function(_0x57ee01){logger['error']('Trunk,\x20%s,\x20%s',_0x411a34,_0x57ee01);_0xac801b(_0x57ee01);});});}exports[_0x59c4('0x16')]=function(_0x3d41eb){var _0x25589f=this;return new Promise(function(_0x5f0244,_0x4f4369){return db[_0x59c4('0x17')][_0x59c4('0x18')]({'raw':_0x3d41eb[_0x59c4('0x19')]?_0x3d41eb['options']['raw']===undefined?!![]:![]:!![],'where':_0x3d41eb[_0x59c4('0x19')]?_0x3d41eb[_0x59c4('0x19')]['where']||null:null,'attributes':_0x3d41eb[_0x59c4('0x19')]?_0x3d41eb[_0x59c4('0x19')][_0x59c4('0x1a')]||null:null,'limit':_0x3d41eb[_0x59c4('0x19')]?_0x3d41eb['options']['limit']||null:null,'include':_0x3d41eb[_0x59c4('0x19')]?_0x3d41eb[_0x59c4('0x19')][_0x59c4('0x1b')]?_['map'](_0x3d41eb['options'][_0x59c4('0x1b')],function(_0x41f374){return{'model':db[_0x41f374[_0x59c4('0x1c')]],'as':_0x41f374['as'],'attributes':_0x41f374[_0x59c4('0x1a')],'include':_0x41f374[_0x59c4('0x1b')]?_['map'](_0x41f374[_0x59c4('0x1b')],function(_0x1bda5f){return{'model':db[_0x1bda5f[_0x59c4('0x1c')]],'as':_0x1bda5f['as'],'attributes':_0x1bda5f['attributes'],'include':_0x1bda5f['include']?_['map'](_0x1bda5f[_0x59c4('0x1b')],function(_0x3cd99d){return{'model':db[_0x3cd99d[_0x59c4('0x1c')]],'as':_0x3cd99d['as'],'attributes':_0x3cd99d[_0x59c4('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x59c4('0xa')](function(_0x1064d8){logger['info'](_0x59c4('0x16'),_0x3d41eb);logger['debug'](_0x59c4('0x16'),_0x3d41eb,JSON[_0x59c4('0x10')](_0x1064d8));_0x5f0244(_0x1064d8);})[_0x59c4('0x15')](function(_0x525bb5){logger[_0x59c4('0x11')](_0x59c4('0x16'),_0x525bb5[_0x59c4('0x13')],_0x3d41eb);_0x4f4369(_0x25589f[_0x59c4('0x11')](0x1f4,_0x525bb5[_0x59c4('0x13')]));});});};exports[_0x59c4('0x1d')]=function(_0x5439d3){var _0x2e42cb=this;return new Promise(function(_0x20aaf8,_0x41bd6f){return db[_0x59c4('0x17')][_0x59c4('0x1e')]({'raw':_0x5439d3[_0x59c4('0x19')]?_0x5439d3['options'][_0x59c4('0x1f')]===undefined?!![]:![]:!![],'where':_0x5439d3[_0x59c4('0x19')]?_0x5439d3[_0x59c4('0x19')][_0x59c4('0x20')]||null:null,'attributes':_0x5439d3['options']?_0x5439d3['options'][_0x59c4('0x1a')]||null:null,'include':_0x5439d3['options']?_0x5439d3['options'][_0x59c4('0x1b')]?_['map'](_0x5439d3[_0x59c4('0x19')][_0x59c4('0x1b')],function(_0x3e1f2a){return{'model':db[_0x3e1f2a[_0x59c4('0x1c')]],'as':_0x3e1f2a['as'],'attributes':_0x3e1f2a[_0x59c4('0x1a')],'include':_0x3e1f2a[_0x59c4('0x1b')]?_['map'](_0x3e1f2a['include'],function(_0x5aa5e4){return{'model':db[_0x5aa5e4[_0x59c4('0x1c')]],'as':_0x5aa5e4['as'],'attributes':_0x5aa5e4[_0x59c4('0x1a')],'include':_0x5aa5e4[_0x59c4('0x1b')]?_[_0x59c4('0x21')](_0x5aa5e4[_0x59c4('0x1b')],function(_0x4dabe2){return{'model':db[_0x4dabe2[_0x59c4('0x1c')]],'as':_0x4dabe2['as'],'attributes':_0x4dabe2[_0x59c4('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x352e53){logger[_0x59c4('0xb')](_0x59c4('0x1d'),_0x5439d3);logger['debug'](_0x59c4('0x1d'),_0x5439d3,JSON[_0x59c4('0x10')](_0x352e53));_0x20aaf8(_0x352e53);})['catch'](function(_0x151f7e){logger[_0x59c4('0x11')]('ShowTrunk',_0x151f7e[_0x59c4('0x13')],_0x5439d3);_0x41bd6f(_0x2e42cb[_0x59c4('0x11')](0x1f4,_0x151f7e['message']));});});}; \ No newline at end of file diff --git a/server/api/user-setting/index.js b/server/api/user-setting/index.js index 7f82bf4..78f49d4 100644 --- a/server/api/user-setting/index.js +++ b/server/api/user-setting/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70d3=['update','exports','express','../../components/auth/service','./user-setting.controller','/:id','isAuthenticated'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x70d3,0x121));var _0x370d=function(_0x4272ba,_0x1519c2){_0x4272ba=_0x4272ba-0x0;var _0xd86ed2=_0x70d3[_0x4272ba];return _0xd86ed2;};'use strict';var express=require(_0x370d('0x0'));var router=express['Router']();var auth=require(_0x370d('0x1'));var controller=require(_0x370d('0x2'));router['put'](_0x370d('0x3'),auth[_0x370d('0x4')](),controller[_0x370d('0x5')]);module[_0x370d('0x6')]=router; \ No newline at end of file +var _0x7d06=['exports','express','Router','../../components/auth/service','./user-setting.controller','/:id','isAuthenticated','update'];(function(_0x900366,_0x153709){var _0x4c11f7=function(_0xaec6b9){while(--_0xaec6b9){_0x900366['push'](_0x900366['shift']());}};_0x4c11f7(++_0x153709);}(_0x7d06,0x109));var _0x67d0=function(_0x34b511,_0x1353c0){_0x34b511=_0x34b511-0x0;var _0x474aee=_0x7d06[_0x34b511];return _0x474aee;};'use strict';var express=require(_0x67d0('0x0'));var router=express[_0x67d0('0x1')]();var auth=require(_0x67d0('0x2'));var controller=require(_0x67d0('0x3'));router['put'](_0x67d0('0x4'),auth[_0x67d0('0x5')](),controller[_0x67d0('0x6')]);module[_0x67d0('0x7')]=router; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.attributes.js b/server/api/user-setting/user-setting.attributes.js index b338b53..edb6930 100644 --- a/server/api/user-setting/user-setting.attributes.js +++ b/server/api/user-setting/user-setting.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xce3f=['DATE','INTEGER','UserId','sequelize','error','warning','info','debug','exports','ENUM','TEXT'];(function(_0x1e8dd5,_0x571f6d){var _0x9aa844=function(_0x21dee6){while(--_0x21dee6){_0x1e8dd5['push'](_0x1e8dd5['shift']());}};_0x9aa844(++_0x571f6d);}(_0xce3f,0xb3));var _0xfce3=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xce3f[_0x5b644e];return _0x49c6bf;};'use strict';var Sequelize=require(_0xfce3('0x0'));const CLIENT_SIDE_LOG_LEVELS=[_0xfce3('0x1'),_0xfce3('0x2'),_0xfce3('0x3'),_0xfce3('0x4')];module[_0xfce3('0x5')]={'clientSideLoggingLevel':{'type':Sequelize[_0xfce3('0x6')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0xfce3('0x1'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0xfce3('0x7')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0xfce3('0x8')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0xfce3('0x9')],'unique':_0xfce3('0xa')}}; \ No newline at end of file +var _0x5673=['ENUM','BOOLEAN','TEXT','DATE','INTEGER','UserId','sequelize','error','info','debug','exports'];(function(_0xfbdff6,_0x2af690){var _0x4cb9be=function(_0x4022d8){while(--_0x4022d8){_0xfbdff6['push'](_0xfbdff6['shift']());}};_0x4cb9be(++_0x2af690);}(_0x5673,0xc1));var _0x3567=function(_0x308374,_0x550e85){_0x308374=_0x308374-0x0;var _0x1f71e0=_0x5673[_0x308374];return _0x1f71e0;};'use strict';var Sequelize=require(_0x3567('0x0'));const CLIENT_SIDE_LOG_LEVELS=[_0x3567('0x1'),'warning',_0x3567('0x2'),_0x3567('0x3')];module[_0x3567('0x4')]={'clientSideLoggingLevel':{'type':Sequelize[_0x3567('0x5')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0x3567('0x1'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0x3567('0x6')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0x3567('0x7')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0x3567('0x8')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0x3567('0x9')],'unique':_0x3567('0xa')}}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.controller.js b/server/api/user-setting/user-setting.controller.js index 6229863..53c9735 100644 --- a/server/api/user-setting/user-setting.controller.js +++ b/server/api/user-setting/user-setting.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa8a8=['body','catch','lodash','ioredis','../../config/logger','api','../../mysqldb','socket.io-emitter','redis','./user-setting.socket','register','defaults','localhost','status','json','then','stack','name','update','user','role','admin','Unauthorized','params','Invalid\x20user\x20setting\x20id','find'];(function(_0x56125e,_0x1abe70){var _0x2db39e=function(_0x4cec20){while(--_0x4cec20){_0x56125e['push'](_0x56125e['shift']());}};_0x2db39e(++_0x1abe70);}(_0xa8a8,0xec));var _0x8a8a=function(_0x40bdee,_0x1f1264){_0x40bdee=_0x40bdee-0x0;var _0x3a6dc5=_0xa8a8[_0x40bdee];return _0x3a6dc5;};'use strict';var _=require(_0x8a8a('0x0'));var Redis=require(_0x8a8a('0x1'));var logger=require(_0x8a8a('0x2'))(_0x8a8a('0x3'));var config=require('../../config/environment');var db=require(_0x8a8a('0x4'))['db'];var socket=require(_0x8a8a('0x5'))(new Redis(config[_0x8a8a('0x6')]));require(_0x8a8a('0x7'))[_0x8a8a('0x8')](socket);config[_0x8a8a('0x6')]=_[_0x8a8a('0x9')](config[_0x8a8a('0x6')],{'host':_0x8a8a('0xa'),'port':0x18eb});function respondWithResult(_0x315fe9,_0x1d7121){_0x1d7121=_0x1d7121||0xc8;return function(_0x8e7aa0){if(_0x8e7aa0){return _0x315fe9[_0x8a8a('0xb')](_0x1d7121)[_0x8a8a('0xc')](_0x8e7aa0);}};}function saveUpdates(_0x3287f5){return function(_0x58a2f8){if(_0x58a2f8){return _0x58a2f8['update'](_0x3287f5)[_0x8a8a('0xd')](function(_0x497b8a){return _0x497b8a;});}return null;};}function handleEntityNotFound(_0x11788d){return function(_0x3d3a00){if(!_0x3d3a00){_0x11788d['sendStatus'](0x194);}return _0x3d3a00;};}function handleError(_0x118380,_0x76b586){_0x76b586=_0x76b586||0x1f4;return function(_0xb13fca){logger['error'](_0xb13fca[_0x8a8a('0xe')]);if(_0xb13fca[_0x8a8a('0xf')]){delete _0xb13fca[_0x8a8a('0xf')];}_0x118380[_0x8a8a('0xb')](_0x76b586)['send'](_0xb13fca);};}exports[_0x8a8a('0x10')]=function(_0x4e5d74,_0x25e1d5){if(_0x4e5d74[_0x8a8a('0x11')][_0x8a8a('0x12')]!==_0x8a8a('0x13'))throw new Error(_0x8a8a('0x14'));if(isNaN(Number(_0x4e5d74[_0x8a8a('0x15')]['id'])))throw new Error(_0x8a8a('0x16'));return db['UserSetting'][_0x8a8a('0x17')]({'where':{'id':_0x4e5d74['params']['id']}})[_0x8a8a('0xd')](handleEntityNotFound(_0x25e1d5,null))[_0x8a8a('0xd')](saveUpdates(_0x4e5d74[_0x8a8a('0x18')],null))[_0x8a8a('0xd')](respondWithResult(_0x25e1d5,null))[_0x8a8a('0x19')](handleError(_0x25e1d5,null));}; \ No newline at end of file +var _0xee39=['lodash','ioredis','../../config/logger','../../config/environment','../../mysqldb','socket.io-emitter','redis','./user-setting.socket','register','defaults','localhost','status','update','sendStatus','error','stack','name','send','user','role','Unauthorized','params','Invalid\x20user\x20setting\x20id','UserSetting','then','body','catch'];(function(_0x4bd06e,_0x593701){var _0x85ebb=function(_0x26a7f2){while(--_0x26a7f2){_0x4bd06e['push'](_0x4bd06e['shift']());}};_0x85ebb(++_0x593701);}(_0xee39,0x1e6));var _0x9ee3=function(_0x578915,_0x593e7e){_0x578915=_0x578915-0x0;var _0x1eed28=_0xee39[_0x578915];return _0x1eed28;};'use strict';var _=require(_0x9ee3('0x0'));var Redis=require(_0x9ee3('0x1'));var logger=require(_0x9ee3('0x2'))('api');var config=require(_0x9ee3('0x3'));var db=require(_0x9ee3('0x4'))['db'];var socket=require(_0x9ee3('0x5'))(new Redis(config[_0x9ee3('0x6')]));require(_0x9ee3('0x7'))[_0x9ee3('0x8')](socket);config[_0x9ee3('0x6')]=_[_0x9ee3('0x9')](config[_0x9ee3('0x6')],{'host':_0x9ee3('0xa'),'port':0x18eb});function respondWithResult(_0x4dc1eb,_0x10e9e6){_0x10e9e6=_0x10e9e6||0xc8;return function(_0x22264c){if(_0x22264c){return _0x4dc1eb[_0x9ee3('0xb')](_0x10e9e6)['json'](_0x22264c);}};}function saveUpdates(_0x206442){return function(_0x5634ca){if(_0x5634ca){return _0x5634ca[_0x9ee3('0xc')](_0x206442)['then'](function(_0x2a5ae7){return _0x2a5ae7;});}return null;};}function handleEntityNotFound(_0x4cf2af){return function(_0x577593){if(!_0x577593){_0x4cf2af[_0x9ee3('0xd')](0x194);}return _0x577593;};}function handleError(_0x5d3644,_0x33e8bc){_0x33e8bc=_0x33e8bc||0x1f4;return function(_0x47abfd){logger[_0x9ee3('0xe')](_0x47abfd[_0x9ee3('0xf')]);if(_0x47abfd[_0x9ee3('0x10')]){delete _0x47abfd[_0x9ee3('0x10')];}_0x5d3644[_0x9ee3('0xb')](_0x33e8bc)[_0x9ee3('0x11')](_0x47abfd);};}exports[_0x9ee3('0xc')]=function(_0x4e7134,_0x1d12e9){if(_0x4e7134[_0x9ee3('0x12')][_0x9ee3('0x13')]!=='admin')throw new Error(_0x9ee3('0x14'));if(isNaN(Number(_0x4e7134[_0x9ee3('0x15')]['id'])))throw new Error(_0x9ee3('0x16'));return db[_0x9ee3('0x17')]['find']({'where':{'id':_0x4e7134['params']['id']}})[_0x9ee3('0x18')](handleEntityNotFound(_0x1d12e9,null))[_0x9ee3('0x18')](saveUpdates(_0x4e7134[_0x9ee3('0x19')],null))[_0x9ee3('0x18')](respondWithResult(_0x1d12e9,null))[_0x9ee3('0x1a')](handleError(_0x1d12e9,null));}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.events.js b/server/api/user-setting/user-setting.events.js index c745806..7ebb9c7 100644 --- a/server/api/user-setting/user-setting.events.js +++ b/server/api/user-setting/user-setting.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb224=['UserSetting','setMaxListeners','save','update','emit','hasOwnProperty','hook','events'];(function(_0x4c12ec,_0x2e9103){var _0x3ae42c=function(_0x5a728f){while(--_0x5a728f){_0x4c12ec['push'](_0x4c12ec['shift']());}};_0x3ae42c(++_0x2e9103);}(_0xb224,0x97));var _0x4b22=function(_0x57cadd,_0x49cac1){_0x57cadd=_0x57cadd-0x0;var _0x46644b=_0xb224[_0x57cadd];return _0x46644b;};'use strict';var EventEmitter=require(_0x4b22('0x0'));var UserSetting=require('../../mysqldb')['db'][_0x4b22('0x1')];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0x4b22('0x2')](0x0);var events={'afterCreate':_0x4b22('0x3'),'afterUpdate':_0x4b22('0x4'),'afterDestroy':'remove'};function emitEvent(_0x3bfadf){return function(_0x573dc9,_0x5d888b,_0xc4660b){UserSettingEvents[_0x4b22('0x5')](_0x3bfadf+':'+_0x573dc9['id'],_0x573dc9);UserSettingEvents[_0x4b22('0x5')](_0x3bfadf,_0x573dc9);_0xc4660b(null);};}for(var e in events){if(events[_0x4b22('0x6')](e)){var event=events[e];UserSetting[_0x4b22('0x7')](e,emitEvent(event));}}module['exports']=UserSettingEvents; \ No newline at end of file +var _0xdad9=['hasOwnProperty','hook','exports','events','UserSetting','setMaxListeners','save','update','remove','emit'];(function(_0x4accc7,_0x4bf5b9){var _0x21ee99=function(_0x5d4f9e){while(--_0x5d4f9e){_0x4accc7['push'](_0x4accc7['shift']());}};_0x21ee99(++_0x4bf5b9);}(_0xdad9,0x175));var _0x9dad=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xdad9[_0x122ef9];return _0x42fba0;};'use strict';var EventEmitter=require(_0x9dad('0x0'));var UserSetting=require('../../mysqldb')['db'][_0x9dad('0x1')];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0x9dad('0x2')](0x0);var events={'afterCreate':_0x9dad('0x3'),'afterUpdate':_0x9dad('0x4'),'afterDestroy':_0x9dad('0x5')};function emitEvent(_0x1c4eb3){return function(_0x23f20f,_0x215b8c,_0x233f1d){UserSettingEvents[_0x9dad('0x6')](_0x1c4eb3+':'+_0x23f20f['id'],_0x23f20f);UserSettingEvents['emit'](_0x1c4eb3,_0x23f20f);_0x233f1d(null);};}for(var e in events){if(events[_0x9dad('0x7')](e)){var event=events[e];UserSetting[_0x9dad('0x8')](e,emitEvent(event));}}module[_0x9dad('0x9')]=UserSettingEvents; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.model.js b/server/api/user-setting/user-setting.model.js index c43ef7d..2dc24be 100644 --- a/server/api/user-setting/user-setting.model.js +++ b/server/api/user-setting/user-setting.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6ae2=['user_settings','clientSideLoggingEnabled','clientSideLoggingEnabledSince','./user-setting.attributes','exports','define','UserSetting'];(function(_0x5e9c9c,_0x45a8d2){var _0x598f09=function(_0x14983a){while(--_0x14983a){_0x5e9c9c['push'](_0x5e9c9c['shift']());}};_0x598f09(++_0x45a8d2);}(_0x6ae2,0x1ed));var _0x26ae=function(_0x43820d,_0x2cf3b3){_0x43820d=_0x43820d-0x0;var _0x70d9af=_0x6ae2[_0x43820d];return _0x70d9af;};'use strict';var attributes=require(_0x26ae('0x0'));module[_0x26ae('0x1')]=function(_0x118942){return _0x118942[_0x26ae('0x2')](_0x26ae('0x3'),attributes,{'tableName':_0x26ae('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xde8ef3){if(!_0xde8ef3[_0x26ae('0x5')])_0xde8ef3[_0x26ae('0x6')]=null;else if(_0xde8ef3['clientSideLoggingEnabledSince']===null)_0xde8ef3[_0x26ae('0x6')]=new Date();}}});}; \ No newline at end of file +var _0xbf6e=['UserSetting','user_settings','clientSideLoggingEnabled','clientSideLoggingEnabledSince','define'];(function(_0x7f2f57,_0x2d8145){var _0x58c467=function(_0x40805b){while(--_0x40805b){_0x7f2f57['push'](_0x7f2f57['shift']());}};_0x58c467(++_0x2d8145);}(_0xbf6e,0x149));var _0xebf6=function(_0x619e53,_0x3cdbd2){_0x619e53=_0x619e53-0x0;var _0x24c385=_0xbf6e[_0x619e53];return _0x24c385;};'use strict';var attributes=require('./user-setting.attributes');module['exports']=function(_0x1f94d5){return _0x1f94d5[_0xebf6('0x0')](_0xebf6('0x1'),attributes,{'tableName':_0xebf6('0x2'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x473e65){if(!_0x473e65[_0xebf6('0x3')])_0x473e65[_0xebf6('0x4')]=null;else if(_0x473e65['clientSideLoggingEnabledSince']===null)_0x473e65[_0xebf6('0x4')]=new Date();}}});}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.socket.js b/server/api/user-setting/user-setting.socket.js index 0993d1f..81cf783 100644 --- a/server/api/user-setting/user-setting.socket.js +++ b/server/api/user-setting/user-setting.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdef5=['user-setting:update','emit','register','length','user-setting:','save','remove','update'];(function(_0x1903c1,_0x4b778a){var _0x31cd5b=function(_0x5366e6){while(--_0x5366e6){_0x1903c1['push'](_0x1903c1['shift']());}};_0x31cd5b(++_0x4b778a);}(_0xdef5,0x7d));var _0x5def=function(_0xd579dc,_0x492656){_0xd579dc=_0xd579dc-0x0;var _0x1ceae1=_0xdef5[_0xd579dc];return _0x1ceae1;};'use strict';var UserSettingEvents=require('./user-setting.events');var events=[_0x5def('0x0'),_0x5def('0x1'),_0x5def('0x2')];function createListener(_0x726667,_0x50ad2f){return function(_0x32245f){_0x50ad2f['emit'](_0x726667,_0x32245f);if(_0x726667===_0x5def('0x3')){_0x50ad2f[_0x5def('0x4')]('user-setting:update:user-'+_0x32245f['UserId'],_0x32245f);}};}exports[_0x5def('0x5')]=function(_0x3a9c57){for(var _0x5aa4f5=0x0,_0x5b778e=events[_0x5def('0x6')];_0x5aa4f5<_0x5b778e;_0x5aa4f5++){var _0x200967=events[_0x5aa4f5];var _0x3b0e73=createListener(_0x5def('0x7')+_0x200967,_0x3a9c57);UserSettingEvents['on'](_0x200967,_0x3b0e73);}}; \ No newline at end of file +var _0xb105=['user-setting:','./user-setting.events','save','update','emit','user-setting:update','UserId','register','length'];(function(_0x210584,_0x5c1aca){var _0x4498cb=function(_0x18fed3){while(--_0x18fed3){_0x210584['push'](_0x210584['shift']());}};_0x4498cb(++_0x5c1aca);}(_0xb105,0x184));var _0x5b10=function(_0x4c3d23,_0x450102){_0x4c3d23=_0x4c3d23-0x0;var _0x3f9119=_0xb105[_0x4c3d23];return _0x3f9119;};'use strict';var UserSettingEvents=require(_0x5b10('0x0'));var events=[_0x5b10('0x1'),'remove',_0x5b10('0x2')];function createListener(_0x384f23,_0x36df07){return function(_0xc84f39){_0x36df07[_0x5b10('0x3')](_0x384f23,_0xc84f39);if(_0x384f23===_0x5b10('0x4')){_0x36df07[_0x5b10('0x3')]('user-setting:update:user-'+_0xc84f39[_0x5b10('0x5')],_0xc84f39);}};}exports[_0x5b10('0x6')]=function(_0xcaddfb){for(var _0x5ddd7a=0x0,_0x4b5f54=events[_0x5b10('0x7')];_0x5ddd7a<_0x4b5f54;_0x5ddd7a++){var _0x237359=events[_0x5ddd7a];var _0x38b26d=createListener(_0x5b10('0x8')+_0x237359,_0xcaddfb);UserSettingEvents['on'](_0x237359,_0x38b26d);}}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 34316f2..448f60e 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 _0x7128=['removeChatInteractions','removeFaxInteractions','/:id/sms_interactions','/:id/openchannel_interactions','/:id/whatsapp_interactions','removeFaxAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','removeApiKey','messengerSoundNotification','exports','multer','path','express','Router','fs-extra','../../config/environment','./user.controller','isAuthenticated','get','describe','/whoami','whoami','/:id','show','getAvatar','/:id/open_tabs','getOpenTabs','/:id/contacts','getVoiceQueuesRt','/:id/groups','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getMailInteractions','/:id/fax/interactions','getFaxInteractions','getWhatsappInteractions','/:id/teams','getTeams','getLists','/:id/agents','getAgents','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','getApiKey','addContacts','create','post','/create_many','addQueues','diskStorage','join','root','server/files/images/','%s-%s','now','originalname','/:id/avatar','single','addAvatar','/:id/login','/:id/logout','logout','/:id/pause','pause','/:id/unpause','unpause','addTeams','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addSmsInteractions','addOpenchannelInteractions','addWhatsappInteractions','addMailAccounts','addSmsAccounts','/:id/chat_websites','addChatWebsites','put','changePassword','delete','/:id/queues','removeQueues','removeTeams','destroy','/:id/chat_interactions'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x7128,0x1b9));var _0x8712=function(_0x255d5b,_0x4f6f35){_0x255d5b=_0x255d5b-0x0;var _0x3e141a=_0x7128[_0x255d5b];return _0x3e141a;};'use strict';var multer=require(_0x8712('0x0'));var util=require('util');var path=require(_0x8712('0x1'));var timeout=require('connect-timeout');var express=require(_0x8712('0x2'));var router=express[_0x8712('0x3')]();var fs_extra=require(_0x8712('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x8712('0x5'));var controller=require(_0x8712('0x6'));router['get']('/',auth[_0x8712('0x7')](),controller['index']);router[_0x8712('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x8712('0x9')]);router['get'](_0x8712('0xa'),auth[_0x8712('0x7')](),controller[_0x8712('0xb')]);router[_0x8712('0x8')]('/presence',auth[_0x8712('0x7')](),controller['getPresence']);router[_0x8712('0x8')](_0x8712('0xc'),auth[_0x8712('0x7')](),controller[_0x8712('0xd')]);router['get']('/:id/avatar',controller[_0x8712('0xe')]);router[_0x8712('0x8')](_0x8712('0xf'),auth[_0x8712('0x7')](),controller[_0x8712('0x10')]);router[_0x8712('0x8')](_0x8712('0x11'),auth[_0x8712('0x7')](),controller['getContacts']);router[_0x8712('0x8')]('/:id/queues',auth[_0x8712('0x7')](),controller['getQueues']);router['get']('/:id/queues_rt',auth['isAuthenticated'](),controller[_0x8712('0x12')]);router[_0x8712('0x8')](_0x8712('0x13'),auth[_0x8712('0x7')](),controller[_0x8712('0x14')]);router[_0x8712('0x8')](_0x8712('0x15'),auth['isAuthenticated'](),controller[_0x8712('0x16')]);router['get'](_0x8712('0x17'),auth[_0x8712('0x7')](),controller[_0x8712('0x18')]);router[_0x8712('0x8')](_0x8712('0x19'),auth[_0x8712('0x7')](),controller[_0x8712('0x1a')]);router[_0x8712('0x8')](_0x8712('0x1b'),auth['isAuthenticated'](),controller['getOpenchannelInteractions']);router[_0x8712('0x8')]('/:id/mail/interactions',auth['isAuthenticated'](),controller[_0x8712('0x1c')]);router['get']('/:id/sms/interactions',auth[_0x8712('0x7')](),controller['getSmsInteractions']);router[_0x8712('0x8')](_0x8712('0x1d'),auth[_0x8712('0x7')](),controller[_0x8712('0x1e')]);router[_0x8712('0x8')]('/:id/whatsapp/interactions',auth['isAuthenticated'](),controller[_0x8712('0x1f')]);router[_0x8712('0x8')](_0x8712('0x20'),auth['isAuthenticated'](),controller[_0x8712('0x21')]);router[_0x8712('0x8')]('/:id/lists',auth[_0x8712('0x7')](),controller[_0x8712('0x22')]);router[_0x8712('0x8')](_0x8712('0x23'),auth[_0x8712('0x7')](),controller[_0x8712('0x24')]);router[_0x8712('0x8')]('/:id/prefixes',auth[_0x8712('0x7')](),controller[_0x8712('0x25')]);router['get'](_0x8712('0x26'),auth[_0x8712('0x7')](),controller[_0x8712('0x27')]);router[_0x8712('0x8')](_0x8712('0x28'),auth['isAuthenticated'](),controller['getMailAccounts']);router[_0x8712('0x8')](_0x8712('0x29'),auth['isAuthenticated'](),controller[_0x8712('0x2a')]);router['get'](_0x8712('0x2b'),auth['isAuthenticated'](),controller[_0x8712('0x2c')]);router[_0x8712('0x8')]('/:id/chat_websites',auth[_0x8712('0x7')](),controller[_0x8712('0x2d')]);router[_0x8712('0x8')](_0x8712('0x2e'),auth['isAuthenticated'](),controller[_0x8712('0x2f')]);router[_0x8712('0x8')](_0x8712('0x30'),auth['isAuthenticated'](),controller[_0x8712('0x31')]);router[_0x8712('0x8')](_0x8712('0x32'),auth[_0x8712('0x7')](),controller[_0x8712('0x33')]);router['post'](_0x8712('0x11'),auth[_0x8712('0x7')](),controller[_0x8712('0x34')]);router['post']('/',auth[_0x8712('0x7')](),controller[_0x8712('0x35')]);router[_0x8712('0x36')](_0x8712('0x37'),auth[_0x8712('0x7')](),controller['bulkCreate']);router['post']('/:id/queues',auth['isAuthenticated'](),controller[_0x8712('0x38')]);var upload=multer({'storage':multer[_0x8712('0x39')]({'destination':function(_0x3c9684,_0x5def4b,_0x4c8273){_0x4c8273(null,path[_0x8712('0x3a')](config[_0x8712('0x3b')],_0x8712('0x3c')));},'filename':function(_0x4532bd,_0x46a525,_0x732597){_0x732597(null,util['format'](_0x8712('0x3d'),Date[_0x8712('0x3e')](),_0x46a525[_0x8712('0x3f')]));}})});router[_0x8712('0x36')](_0x8712('0x40'),upload[_0x8712('0x41')]('file'),controller[_0x8712('0x42')]);router[_0x8712('0x36')](_0x8712('0x43'),auth['isAuthenticated'](),controller['login']);router['post'](_0x8712('0x44'),auth[_0x8712('0x7')](),controller[_0x8712('0x45')]);router['post'](_0x8712('0x46'),auth[_0x8712('0x7')](),controller[_0x8712('0x47')]);router['post'](_0x8712('0x48'),auth[_0x8712('0x7')](),controller[_0x8712('0x49')]);router[_0x8712('0x36')](_0x8712('0x20'),auth[_0x8712('0x7')](),controller[_0x8712('0x4a')]);router['post']('/:id/chat_interactions',auth['isAuthenticated'](),controller[_0x8712('0x4b')]);router['post'](_0x8712('0x4c'),auth[_0x8712('0x7')](),controller[_0x8712('0x4d')]);router[_0x8712('0x36')](_0x8712('0x4e'),auth[_0x8712('0x7')](),controller['addFaxInteractions']);router[_0x8712('0x36')]('/:id/sms_interactions',auth[_0x8712('0x7')](),controller[_0x8712('0x4f')]);router['post']('/:id/openchannel_interactions',auth['isAuthenticated'](),controller[_0x8712('0x50')]);router[_0x8712('0x36')]('/:id/whatsapp_interactions',auth[_0x8712('0x7')](),controller[_0x8712('0x51')]);router['post'](_0x8712('0x26'),auth['isAuthenticated'](),controller['addFaxAccounts']);router[_0x8712('0x36')]('/:id/mail_accounts',auth['isAuthenticated'](),controller[_0x8712('0x52')]);router['post'](_0x8712('0x29'),auth[_0x8712('0x7')](),controller['addOpenchannelAccounts']);router[_0x8712('0x36')](_0x8712('0x2b'),auth[_0x8712('0x7')](),controller[_0x8712('0x53')]);router['post'](_0x8712('0x54'),auth[_0x8712('0x7')](),controller[_0x8712('0x55')]);router[_0x8712('0x36')](_0x8712('0x2e'),auth[_0x8712('0x7')](),controller['addWhatsappAccounts']);router['post'](_0x8712('0x32'),auth[_0x8712('0x7')](),controller['createApiKey']);router[_0x8712('0x56')](_0x8712('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x8712('0x56')]('/:id/password',auth['isAuthenticated'](),controller[_0x8712('0x57')]);router[_0x8712('0x58')](_0x8712('0x59'),auth[_0x8712('0x7')](),controller[_0x8712('0x5a')]);router[_0x8712('0x58')](_0x8712('0x20'),auth[_0x8712('0x7')](),controller[_0x8712('0x5b')]);router['delete'](_0x8712('0xc'),auth[_0x8712('0x7')](),controller[_0x8712('0x5c')]);router['delete'](_0x8712('0x5d'),auth[_0x8712('0x7')](),controller[_0x8712('0x5e')]);router[_0x8712('0x58')](_0x8712('0x4c'),auth['isAuthenticated'](),controller['removeMailInteractions']);router['delete'](_0x8712('0x4e'),auth['isAuthenticated'](),controller[_0x8712('0x5f')]);router['delete'](_0x8712('0x60'),auth[_0x8712('0x7')](),controller['removeSmsInteractions']);router[_0x8712('0x58')](_0x8712('0x61'),auth[_0x8712('0x7')](),controller['removeOpenchannelInteractions']);router['delete'](_0x8712('0x62'),auth[_0x8712('0x7')](),controller['removeWhatsappInteractions']);router[_0x8712('0x58')](_0x8712('0x26'),auth[_0x8712('0x7')](),controller[_0x8712('0x63')]);router['delete'](_0x8712('0x28'),auth[_0x8712('0x7')](),controller['removeMailAccounts']);router[_0x8712('0x58')](_0x8712('0x29'),auth['isAuthenticated'](),controller[_0x8712('0x64')]);router[_0x8712('0x58')](_0x8712('0x2b'),auth[_0x8712('0x7')](),controller[_0x8712('0x65')]);router['delete'](_0x8712('0x54'),auth[_0x8712('0x7')](),controller[_0x8712('0x66')]);router[_0x8712('0x58')](_0x8712('0x2e'),auth[_0x8712('0x7')](),controller[_0x8712('0x67')]);router['delete'](_0x8712('0x32'),auth['isAuthenticated'](),controller[_0x8712('0x68')]);router[_0x8712('0x36')]('/:id/messengerSoundNotification',auth['isAuthenticated'](),controller[_0x8712('0x69')]);module[_0x8712('0x6a')]=router; \ No newline at end of file +var _0xc473=['/:id/pause','pause','/:id/unpause','unpause','addTeams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addMailAccounts','addOpenchannelAccounts','/:id/chat_websites','addChatWebsites','addWhatsappAccounts','/:id','update','put','/:id/password','changePassword','delete','removeTeams','destroy','removeChatInteractions','/:id/fax_interactions','removeFaxInteractions','/:id/sms_interactions','removeSmsInteractions','/:id/openchannel_interactions','removeOpenchannelInteractions','removeWhatsappInteractions','removeMailAccounts','removeOpenchannelAccounts','removeChatWebsites','removeWhatsappAccounts','removeApiKey','exports','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/whoami','/presence','getPresence','show','/:id/avatar','getAvatar','/:id/open_tabs','getOpenTabs','/:id/contacts','getContacts','/:id/queues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','/:id/chat/interactions','/:id/openchannel/interactions','getOpenchannelInteractions','getMailInteractions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','/:id/teams','getTeams','/:id/lists','/:id/agents','getAgents','getVoicePrefixes','/:id/fax_accounts','/:id/mail_accounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','getApiKey','post','addContacts','create','/create_many','diskStorage','join','server/files/images/','format','%s-%s','originalname','single','file','addAvatar','/:id/login','login','/:id/logout','logout'];(function(_0x5a6468,_0x16aa00){var _0x3eea81=function(_0x9b87c7){while(--_0x9b87c7){_0x5a6468['push'](_0x5a6468['shift']());}};_0x3eea81(++_0x16aa00);}(_0xc473,0x174));var _0x3c47=function(_0xfe27e,_0x5b2947){_0xfe27e=_0xfe27e-0x0;var _0x13e6fc=_0xc473[_0xfe27e];return _0x13e6fc;};'use strict';var multer=require('multer');var util=require(_0x3c47('0x0'));var path=require(_0x3c47('0x1'));var timeout=require('connect-timeout');var express=require(_0x3c47('0x2'));var router=express[_0x3c47('0x3')]();var fs_extra=require(_0x3c47('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3c47('0x5'));var config=require(_0x3c47('0x6'));var controller=require('./user.controller');router[_0x3c47('0x7')]('/',auth[_0x3c47('0x8')](),controller[_0x3c47('0x9')]);router[_0x3c47('0x7')](_0x3c47('0xa'),auth[_0x3c47('0x8')](),controller[_0x3c47('0xb')]);router[_0x3c47('0x7')](_0x3c47('0xc'),auth[_0x3c47('0x8')](),controller['whoami']);router[_0x3c47('0x7')](_0x3c47('0xd'),auth[_0x3c47('0x8')](),controller[_0x3c47('0xe')]);router[_0x3c47('0x7')]('/:id',auth[_0x3c47('0x8')](),controller[_0x3c47('0xf')]);router['get'](_0x3c47('0x10'),controller[_0x3c47('0x11')]);router[_0x3c47('0x7')](_0x3c47('0x12'),auth[_0x3c47('0x8')](),controller[_0x3c47('0x13')]);router[_0x3c47('0x7')](_0x3c47('0x14'),auth['isAuthenticated'](),controller[_0x3c47('0x15')]);router[_0x3c47('0x7')](_0x3c47('0x16'),auth['isAuthenticated'](),controller['getQueues']);router[_0x3c47('0x7')](_0x3c47('0x17'),auth['isAuthenticated'](),controller[_0x3c47('0x18')]);router['get'](_0x3c47('0x19'),auth[_0x3c47('0x8')](),controller[_0x3c47('0x1a')]);router[_0x3c47('0x7')](_0x3c47('0x1b'),auth[_0x3c47('0x8')](),controller[_0x3c47('0x1c')]);router[_0x3c47('0x7')](_0x3c47('0x1d'),auth[_0x3c47('0x8')](),controller['getScreenRecordings']);router['get'](_0x3c47('0x1e'),auth[_0x3c47('0x8')](),controller['getChatInteractions']);router[_0x3c47('0x7')](_0x3c47('0x1f'),auth['isAuthenticated'](),controller[_0x3c47('0x20')]);router[_0x3c47('0x7')]('/:id/mail/interactions',auth[_0x3c47('0x8')](),controller[_0x3c47('0x21')]);router[_0x3c47('0x7')]('/:id/sms/interactions',auth[_0x3c47('0x8')](),controller[_0x3c47('0x22')]);router[_0x3c47('0x7')](_0x3c47('0x23'),auth[_0x3c47('0x8')](),controller[_0x3c47('0x24')]);router[_0x3c47('0x7')](_0x3c47('0x25'),auth[_0x3c47('0x8')](),controller['getWhatsappInteractions']);router[_0x3c47('0x7')](_0x3c47('0x26'),auth[_0x3c47('0x8')](),controller[_0x3c47('0x27')]);router['get'](_0x3c47('0x28'),auth[_0x3c47('0x8')](),controller['getLists']);router[_0x3c47('0x7')](_0x3c47('0x29'),auth[_0x3c47('0x8')](),controller[_0x3c47('0x2a')]);router[_0x3c47('0x7')]('/:id/prefixes',auth[_0x3c47('0x8')](),controller[_0x3c47('0x2b')]);router[_0x3c47('0x7')](_0x3c47('0x2c'),auth[_0x3c47('0x8')](),controller['getFaxAccounts']);router['get'](_0x3c47('0x2d'),auth['isAuthenticated'](),controller['getMailAccounts']);router[_0x3c47('0x7')](_0x3c47('0x2e'),auth[_0x3c47('0x8')](),controller[_0x3c47('0x2f')]);router['get'](_0x3c47('0x30'),auth['isAuthenticated'](),controller['getSmsAccounts']);router[_0x3c47('0x7')]('/:id/chat_websites',auth[_0x3c47('0x8')](),controller['getChatWebsites']);router[_0x3c47('0x7')](_0x3c47('0x31'),auth['isAuthenticated'](),controller[_0x3c47('0x32')]);router['get'](_0x3c47('0x33'),auth[_0x3c47('0x8')](),controller[_0x3c47('0x34')]);router['get'](_0x3c47('0x35'),auth['isAuthenticated'](),controller[_0x3c47('0x36')]);router[_0x3c47('0x37')](_0x3c47('0x14'),auth[_0x3c47('0x8')](),controller[_0x3c47('0x38')]);router[_0x3c47('0x37')]('/',auth['isAuthenticated'](),controller[_0x3c47('0x39')]);router['post'](_0x3c47('0x3a'),auth[_0x3c47('0x8')](),controller['bulkCreate']);router[_0x3c47('0x37')](_0x3c47('0x16'),auth[_0x3c47('0x8')](),controller['addQueues']);var upload=multer({'storage':multer[_0x3c47('0x3b')]({'destination':function(_0x25faa3,_0x29caec,_0xf62ef3){_0xf62ef3(null,path[_0x3c47('0x3c')](config['root'],_0x3c47('0x3d')));},'filename':function(_0x25c01e,_0x2e8478,_0x51f511){_0x51f511(null,util[_0x3c47('0x3e')](_0x3c47('0x3f'),Date['now'](),_0x2e8478[_0x3c47('0x40')]));}})});router[_0x3c47('0x37')](_0x3c47('0x10'),upload[_0x3c47('0x41')](_0x3c47('0x42')),controller[_0x3c47('0x43')]);router[_0x3c47('0x37')](_0x3c47('0x44'),auth['isAuthenticated'](),controller[_0x3c47('0x45')]);router[_0x3c47('0x37')](_0x3c47('0x46'),auth[_0x3c47('0x8')](),controller[_0x3c47('0x47')]);router[_0x3c47('0x37')](_0x3c47('0x48'),auth[_0x3c47('0x8')](),controller[_0x3c47('0x49')]);router[_0x3c47('0x37')](_0x3c47('0x4a'),auth['isAuthenticated'](),controller[_0x3c47('0x4b')]);router['post'](_0x3c47('0x26'),auth['isAuthenticated'](),controller[_0x3c47('0x4c')]);router[_0x3c47('0x37')](_0x3c47('0x4d'),auth['isAuthenticated'](),controller[_0x3c47('0x4e')]);router['post'](_0x3c47('0x4f'),auth['isAuthenticated'](),controller[_0x3c47('0x50')]);router['post']('/:id/fax_interactions',auth[_0x3c47('0x8')](),controller['addFaxInteractions']);router[_0x3c47('0x37')]('/:id/sms_interactions',auth[_0x3c47('0x8')](),controller['addSmsInteractions']);router[_0x3c47('0x37')]('/:id/openchannel_interactions',auth[_0x3c47('0x8')](),controller[_0x3c47('0x51')]);router[_0x3c47('0x37')](_0x3c47('0x52'),auth[_0x3c47('0x8')](),controller[_0x3c47('0x53')]);router['post'](_0x3c47('0x2c'),auth[_0x3c47('0x8')](),controller['addFaxAccounts']);router[_0x3c47('0x37')]('/:id/mail_accounts',auth[_0x3c47('0x8')](),controller[_0x3c47('0x54')]);router['post'](_0x3c47('0x2e'),auth[_0x3c47('0x8')](),controller[_0x3c47('0x55')]);router[_0x3c47('0x37')]('/:id/sms_accounts',auth[_0x3c47('0x8')](),controller['addSmsAccounts']);router[_0x3c47('0x37')](_0x3c47('0x56'),auth[_0x3c47('0x8')](),controller[_0x3c47('0x57')]);router[_0x3c47('0x37')](_0x3c47('0x31'),auth[_0x3c47('0x8')](),controller[_0x3c47('0x58')]);router[_0x3c47('0x37')](_0x3c47('0x35'),auth[_0x3c47('0x8')](),controller['createApiKey']);router['put'](_0x3c47('0x59'),auth[_0x3c47('0x8')](),controller[_0x3c47('0x5a')]);router[_0x3c47('0x5b')](_0x3c47('0x5c'),auth[_0x3c47('0x8')](),controller[_0x3c47('0x5d')]);router[_0x3c47('0x5e')](_0x3c47('0x16'),auth[_0x3c47('0x8')](),controller['removeQueues']);router['delete'](_0x3c47('0x26'),auth[_0x3c47('0x8')](),controller[_0x3c47('0x5f')]);router[_0x3c47('0x5e')](_0x3c47('0x59'),auth[_0x3c47('0x8')](),controller[_0x3c47('0x60')]);router[_0x3c47('0x5e')](_0x3c47('0x4d'),auth[_0x3c47('0x8')](),controller[_0x3c47('0x61')]);router['delete'](_0x3c47('0x4f'),auth['isAuthenticated'](),controller['removeMailInteractions']);router[_0x3c47('0x5e')](_0x3c47('0x62'),auth['isAuthenticated'](),controller[_0x3c47('0x63')]);router[_0x3c47('0x5e')](_0x3c47('0x64'),auth[_0x3c47('0x8')](),controller[_0x3c47('0x65')]);router[_0x3c47('0x5e')](_0x3c47('0x66'),auth[_0x3c47('0x8')](),controller[_0x3c47('0x67')]);router[_0x3c47('0x5e')]('/:id/whatsapp_interactions',auth['isAuthenticated'](),controller[_0x3c47('0x68')]);router[_0x3c47('0x5e')](_0x3c47('0x2c'),auth['isAuthenticated'](),controller['removeFaxAccounts']);router[_0x3c47('0x5e')](_0x3c47('0x2d'),auth[_0x3c47('0x8')](),controller[_0x3c47('0x69')]);router[_0x3c47('0x5e')](_0x3c47('0x2e'),auth['isAuthenticated'](),controller[_0x3c47('0x6a')]);router[_0x3c47('0x5e')]('/:id/sms_accounts',auth['isAuthenticated'](),controller['removeSmsAccounts']);router[_0x3c47('0x5e')]('/:id/chat_websites',auth[_0x3c47('0x8')](),controller[_0x3c47('0x6b')]);router[_0x3c47('0x5e')]('/:id/whatsapp_accounts',auth[_0x3c47('0x8')](),controller[_0x3c47('0x6c')]);router[_0x3c47('0x5e')](_0x3c47('0x35'),auth[_0x3c47('0x8')](),controller[_0x3c47('0x6d')]);router['post']('/:id/messengerSoundNotification',auth[_0x3c47('0x8')](),controller['messengerSoundNotification']);module[_0x3c47('0x6e')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index a77b450..b52d2fb 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 _0x8ff4=['PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','transport','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','auto','nonat','update','yes','force_rport,comedia','nat','split','all','ulaw;alaw;gsm','allow','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','always','refuse','originate','uac','uas','fingerprint','certificate','passive','actpass','update,nonat','TEXT','showWebBar','isArray','join','udp','wss','encryption','avpf','force_avp','icesupport','dtlsenable','dtlsverify','dtlssetup','dtlscertfile','dtlsprivatekey','rtcp_mux','/etc/pki/tls/private/motion.key','permissions','phoneBarEnableScreenRecordingByAgent','true','screenrecording','blocked','loginAttempts','blockedAt','sequelize','util','lodash','exports','STRING','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','format','\x22%s\x22\x20<%s>','getDataValue','email','toLowerCase','admin','user','agent','internal','accountcode','callerid','fullname','BOOLEAN','DEFAULT\x20PAUSE','DATE','INTEGER','dynamic','ENUM','friend','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN'];(function(_0x28f947,_0x1f3a25){var _0x52d24c=function(_0x335aca){while(--_0x335aca){_0x28f947['push'](_0x28f947['shift']());}};_0x52d24c(++_0x1f3a25);}(_0x8ff4,0x18b));var _0x48ff=function(_0x33ddea,_0x222f65){_0x33ddea=_0x33ddea-0x0;var _0x5e2f59=_0x8ff4[_0x33ddea];return _0x5e2f59;};'use strict';var Sequelize=require(_0x48ff('0x0'));var moment=require('moment');var util=require(_0x48ff('0x1'));var _=require(_0x48ff('0x2'));module[_0x48ff('0x3')]={'name':{'type':Sequelize[_0x48ff('0x4')],'allowNull':![],'unique':_0x48ff('0x5'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x53183c){this[_0x48ff('0x6')](_0x48ff('0x5'),_0x53183c);this[_0x48ff('0x6')](_0x48ff('0x7'),_0x53183c);},'comment':_0x48ff('0x8')},'fullname':{'type':Sequelize[_0x48ff('0x4')],'allowNull':![],'set':function(_0x152e9a){this[_0x48ff('0x6')]('fullname',_0x152e9a);this[_0x48ff('0x6')]('callerid',util[_0x48ff('0x9')](_0x48ff('0xa'),_0x152e9a,this[_0x48ff('0xb')]('internal')));}},'alias':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x48ff('0x4')],'allowNull':![],'unique':_0x48ff('0xc'),'validate':{'isEmail':!![]},'set':function(_0xbb5e){if(_0xbb5e){this[_0x48ff('0x6')](_0x48ff('0xc'),_0xbb5e[_0x48ff('0xd')]());}}},'role':{'type':Sequelize['ENUM'](_0x48ff('0xe'),_0x48ff('0xf'),_0x48ff('0x10'),'telephone'),'allowNull':![]},'password':{'type':Sequelize[_0x48ff('0x4')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x48ff('0x4')],'defaultValue':'local'},'internal':{'type':Sequelize['INTEGER'](0xb),'allowNull':![],'unique':_0x48ff('0x11'),'set':function(_0x12b30a){this[_0x48ff('0x6')](_0x48ff('0x11'),_0x12b30a);this[_0x48ff('0x6')](_0x48ff('0x12'),_0x12b30a);this[_0x48ff('0x6')](_0x48ff('0x13'),util[_0x48ff('0x9')](_0x48ff('0xa'),this['getDataValue'](_0x48ff('0x14')),_0x12b30a));}},'salt':{'type':Sequelize[_0x48ff('0x4')]},'phone':{'type':Sequelize[_0x48ff('0x4')]},'mobile':{'type':Sequelize['STRING']},'address':{'type':Sequelize['STRING']},'zipcode':{'type':Sequelize[_0x48ff('0x4')]},'userpic':{'type':Sequelize[_0x48ff('0x4')]},'city':{'type':Sequelize[_0x48ff('0x4')]},'country':{'type':Sequelize[_0x48ff('0x4')]},'online':{'type':Sequelize[_0x48ff('0x15')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize['DATE']},'voicePause':{'type':Sequelize[_0x48ff('0x15')],'defaultValue':![]},'chatPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x48ff('0x15')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x48ff('0x15')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x48ff('0x15')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x48ff('0x15')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x48ff('0x15')],'defaultValue':![]},'pauseType':{'type':Sequelize['STRING'],'defaultValue':_0x48ff('0x16')},'lastPauseAt':{'type':Sequelize[_0x48ff('0x17')]},'chatCapacity':{'type':Sequelize[_0x48ff('0x18')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x48ff('0x18')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x48ff('0x18')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x48ff('0x18')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x48ff('0x18')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x48ff('0x18')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x48ff('0x18')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x48ff('0x15')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x48ff('0x18')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x48ff('0x15')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x48ff('0x15')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x48ff('0x15')],'defaultValue':![]},'description':{'type':Sequelize[_0x48ff('0x4')],'allowNull':!![]},'host':{'type':Sequelize[_0x48ff('0x4')],'allowNull':!![],'defaultValue':_0x48ff('0x19')},'ipaddr':{'type':Sequelize[_0x48ff('0x4')],'allowNull':!![]},'port':{'type':Sequelize['INTEGER'](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x48ff('0x18')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x48ff('0x4')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x48ff('0x4')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x48ff('0x4')],'allowNull':!![]},'lastms':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x48ff('0x1a')]('friend',_0x48ff('0xf'),'peer'),'allowNull':!![],'defaultValue':_0x48ff('0x1b')},'context':{'type':Sequelize[_0x48ff('0x4')],'allowNull':!![],'defaultValue':'from-sip'},'callingpres':{'type':Sequelize['ENUM'](_0x48ff('0x1c'),_0x48ff('0x1d'),'ALLOWED_FAILED_SCREEN','ALLOWED',_0x48ff('0x1e'),_0x48ff('0x1f'),_0x48ff('0x20'),'PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize[_0x48ff('0x4')],'allowNull':!![]},'permit':{'type':Sequelize[_0x48ff('0x4')],'allowNull':!![]},'secret':{'type':Sequelize[_0x48ff('0x4')],'allowNull':!![]},'md5secret':{'type':Sequelize['STRING'],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x48ff('0x4')],'allowNull':!![]},'transport':{'type':Sequelize[_0x48ff('0x4')],'allowNull':!![],'defaultValue':'udp','set':function(_0x36479b){this[_0x48ff('0x6')](_0x48ff('0x21'),_0x36479b?_0x36479b['join'](','):null);},'get':function(){return this[_0x48ff('0xb')](_0x48ff('0x21'))?this[_0x48ff('0xb')](_0x48ff('0x21'))['split'](','):null;},'comment':_0x48ff('0x22')},'dtmfmode':{'type':Sequelize[_0x48ff('0x1a')](_0x48ff('0x23'),_0x48ff('0x24'),'shortinfo','inband',_0x48ff('0x25')),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize['ENUM']('yes','no',_0x48ff('0x26'),_0x48ff('0x27'),'outgoing'),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x48ff('0x1a')](_0x48ff('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x48ff('0x4')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x48ff('0x4')],'allowNull':!![]},'nat':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x48ff('0x29'),'set':function(_0xff87e2){this[_0x48ff('0x6')](_0x48ff('0x2a'),_0xff87e2?_0xff87e2['join'](','):null);},'get':function(){return this[_0x48ff('0xb')]('nat')?this['getDataValue'](_0x48ff('0x2a'))[_0x48ff('0x2b')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x48ff('0x4')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0x48ff('0x4')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x48ff('0x4')]},'disallow':{'type':Sequelize[_0x48ff('0x4')],'allowNull':![],'defaultValue':_0x48ff('0x2c')},'allow':{'type':Sequelize[_0x48ff('0x4')],'allowNull':![],'defaultValue':_0x48ff('0x2d'),'set':function(_0x55584f){this['setDataValue'](_0x48ff('0x2e'),_0x55584f?_0x55584f['join'](';'):_0x48ff('0x2d'));},'get':function(){return this[_0x48ff('0xb')](_0x48ff('0x2e'))?this[_0x48ff('0xb')]('allow')[_0x48ff('0x2b')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize['ENUM'](_0x48ff('0x28'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x48ff('0x4')],'allowNull':!![],'set':function(_0xe6833a){this[_0x48ff('0x6')](_0x48ff('0x2f'),_0xe6833a?_0xe6833a['join'](','):null);},'get':function(){return this['getDataValue']('insecure')?this[_0x48ff('0xb')]('insecure')[_0x48ff('0x2b')](','):null;},'comment':_0x48ff('0x30')},'trustrpid':{'type':Sequelize[_0x48ff('0x1a')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x48ff('0x1a')](_0x48ff('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM'](_0x48ff('0x28'),'no',_0x48ff('0x31')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x48ff('0x1a')]('yes','no'),'allowNull':!![]},'useclientcode':{'type':Sequelize['ENUM'](_0x48ff('0x28'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x48ff('0x18')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x48ff('0x4')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x48ff('0x4')],'allowNull':!![],'defaultValue':_0x48ff('0x32')},'amaflags':{'type':Sequelize[_0x48ff('0x4')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x48ff('0x1a')](_0x48ff('0x28'),'no'),'allowNull':!![],'defaultValue':_0x48ff('0x28')},'busylevel':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize['ENUM'](_0x48ff('0x28'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x48ff('0x1a')](_0x48ff('0x28'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x48ff('0x1a')](_0x48ff('0x28'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x48ff('0x4')],'allowNull':!![]},'template':{'type':Sequelize[_0x48ff('0x4')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x48ff('0x1a')](_0x48ff('0x28'),'no',_0x48ff('0x33')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x48ff('0x18')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x48ff('0x1a')](_0x48ff('0x28'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x48ff('0x4')],'allowNull':!![]},'session_timers':{'type':Sequelize['ENUM']('accept',_0x48ff('0x34'),_0x48ff('0x35')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x48ff('0x18')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x48ff('0x1a')](_0x48ff('0x36'),_0x48ff('0x37')),'allowNull':!![],'defaultValue':_0x48ff('0x37')},'t38pt_usertpsource':{'type':Sequelize[_0x48ff('0x4')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x48ff('0x4')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x48ff('0x4')],'allowNull':!![]},'fromuser':{'type':Sequelize['STRING'],'allowNull':!![]},'qualify':{'type':Sequelize[_0x48ff('0x1a')](_0x48ff('0x28'),'no'),'allowNull':!![],'defaultValue':_0x48ff('0x28')},'keepalive':{'type':Sequelize[_0x48ff('0x18')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x48ff('0x4')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x48ff('0x18')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0x48ff('0x18')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x48ff('0x18')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x48ff('0x1a')](_0x48ff('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x48ff('0x4')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x48ff('0x4')],'allowNull':!![]},'timert1':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x48ff('0x18')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x48ff('0x18')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x48ff('0x4')],'allowNull':!![]},'contactdeny':{'type':Sequelize['STRING'],'allowNull':!![]},'contactacl':{'type':Sequelize[_0x48ff('0x4')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x48ff('0x4')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x48ff('0x4')],'allowNull':!![]},'maxforwards':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x48ff('0x1a')](_0x48ff('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0x48ff('0x28'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x48ff('0x1a')](_0x48ff('0x28'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x48ff('0x1a')]('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x48ff('0x1a')](_0x48ff('0x28'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize['ENUM'](_0x48ff('0x28'),'no',_0x48ff('0x38'),_0x48ff('0x39')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x48ff('0x18')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x48ff('0x4')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x48ff('0x4')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x48ff('0x4')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x48ff('0x4')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x48ff('0x4')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x48ff('0x1a')]('active',_0x48ff('0x3a'),_0x48ff('0x3b')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x48ff('0x4')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x48ff('0x1a')](_0x48ff('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x48ff('0x4')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x48ff('0x4')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x48ff('0x18')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x48ff('0x1a')](_0x48ff('0x28'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x48ff('0x1a')](_0x48ff('0x28'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x48ff('0x4')],'allowNull':!![]},'mohinterpret':{'type':Sequelize['STRING'],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x48ff('0x4')],'allowNull':!![]},'parkinglot':{'type':Sequelize['STRING'],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x48ff('0x1a')](_0x48ff('0x28'),'no','nonat',_0x48ff('0x27'),_0x48ff('0x3c')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x48ff('0x15')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x48ff('0x4')]},'resetPasswordExpires':{'type':Sequelize['DATE']},'passwordResetAt':{'type':Sequelize[_0x48ff('0x17')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x48ff('0x3d')]},'showWebBar':{'type':Sequelize['INTEGER'],'defaultValue':0x0,'set':function(_0x3c962d){this[_0x48ff('0x6')](_0x48ff('0x3e'),_0x3c962d);var _0x46f6e7=this['get']({'plain':!![]});switch(_0x3c962d){case 0x0:case 0x1:var _0x2fa3cd=_0x46f6e7[_0x48ff('0x21')]?_[_0x48ff('0x3f')](_0x46f6e7['transport'])?_0x46f6e7[_0x48ff('0x21')][_0x48ff('0x40')]():_0x46f6e7[_0x48ff('0x21')]:_0x48ff('0x41');if(_0x2fa3cd===_0x48ff('0x42')){_0x2fa3cd=_0x48ff('0x41');}this[_0x48ff('0x6')](_0x48ff('0x21'),_0x2fa3cd);this[_0x48ff('0x6')](_0x48ff('0x43'),'no');this[_0x48ff('0x6')](_0x48ff('0x44'),null);this[_0x48ff('0x6')](_0x48ff('0x45'),null);this[_0x48ff('0x6')](_0x48ff('0x46'),null);this[_0x48ff('0x6')](_0x48ff('0x47'),null);this['setDataValue'](_0x48ff('0x48'),null);this[_0x48ff('0x6')](_0x48ff('0x49'),null);this[_0x48ff('0x6')](_0x48ff('0x4a'),null);this[_0x48ff('0x6')](_0x48ff('0x4b'),null);this['setDataValue'](_0x48ff('0x4c'),'no');break;case 0x2:this[_0x48ff('0x6')](_0x48ff('0x21'),_0x48ff('0x42'));this[_0x48ff('0x6')]('encryption','yes');this[_0x48ff('0x6')](_0x48ff('0x44'),'yes');this[_0x48ff('0x6')](_0x48ff('0x45'),_0x48ff('0x28'));this[_0x48ff('0x6')](_0x48ff('0x46'),_0x48ff('0x28'));this['setDataValue'](_0x48ff('0x47'),_0x48ff('0x28'));this[_0x48ff('0x6')]('dtlsverify','no');this[_0x48ff('0x6')](_0x48ff('0x49'),'actpass');this[_0x48ff('0x6')](_0x48ff('0x4a'),_0x46f6e7[_0x48ff('0x4a')]||'/etc/pki/tls/certs/motion.crt');this[_0x48ff('0x6')]('dtlsprivatekey',_0x46f6e7[_0x48ff('0x4b')]||_0x48ff('0x4d'));this[_0x48ff('0x6')](_0x48ff('0x4c'),_0x48ff('0x28'));break;default:}}},'permissions':{'type':Sequelize[_0x48ff('0x3d')],'set':function(_0x34ee3b){this['setDataValue'](_0x48ff('0x4e'),_0x34ee3b?_0x34ee3b['join'](','):[]);},'get':function(){return this[_0x48ff('0xb')](_0x48ff('0x4e'))?_['map'](this[_0x48ff('0xb')](_0x48ff('0x4e'))['split'](','),function(_0x20db35){return parseInt(_0x20db35,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x48ff('0x4')]},'phoneBarNoReplyNumber':{'type':Sequelize['STRING']},'phoneBarBusyNumber':{'type':Sequelize[_0x48ff('0x4')]},'phoneBarUnconditional':{'type':Sequelize[_0x48ff('0x15')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x48ff('0x15')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x48ff('0x15')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x48ff('0x15')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x48ff('0x18')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x48ff('0x4')],'defaultValue':''},'crudPermissions':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x48ff('0x1a')](_0x48ff('0x28'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x48ff('0x15')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x48ff('0x4')]},'phoneBarEnableJaws':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x48ff('0xb')](_0x48ff('0x4f'))?this[_0x48ff('0xb')](_0x48ff('0x4f')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x48ff('0x15')],'defaultValue':![]},'hotdesk':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'interface':{'type':Sequelize[_0x48ff('0x4')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x48ff('0x15')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize['STRING'],'allowNull':!![]},'apiKeyIat':{'type':Sequelize['STRING'],'allowNull':!![]},'screenrecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x1c8f57){if(typeof _0x1c8f57==='string'){var _0x480565=_0x1c8f57==='1'?!![]:_0x1c8f57==='0'?![]:_0x1c8f57===_0x48ff('0x50')?!![]:_0x1c8f57==='false'?![]:![];this['setDataValue'](_0x48ff('0x51'),_0x480565);}else{this[_0x48ff('0x6')]('screenrecording',_0x1c8f57);}}},'blocked':{'type':Sequelize[_0x48ff('0x15')],'defaultValue':![],'set':function(_0x11e47e){this[_0x48ff('0x6')](_0x48ff('0x52'),_0x11e47e);if(_0x11e47e===!![]){this['setDataValue']('blockedAt',moment());this[_0x48ff('0x6')](_0x48ff('0x53'),0x0);}else{this[_0x48ff('0x6')](_0x48ff('0x54'),null);}}},'blockedAt':{'type':Sequelize[_0x48ff('0x17')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x48ff('0x18')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x48ff('0x15')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x48ff('0x18')](0x5)['UNSIGNED'],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x48ff('0x15')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x48ff('0x15')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x48ff('0x15')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x48ff('0x15')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x48ff('0x15')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0x48ff('0x15')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0x48ff('0x15')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0x48ff('0x18')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0x48ff('0x18')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x48ff('0x15')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0x48ff('0x15')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0x48ff('0x18')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0x48ff('0x18')],'defaultValue':0x0},'messengerSoundNotification':{'type':Sequelize[_0x48ff('0x15')],'defaultValue':![]}}; \ No newline at end of file +var _0xde4d=['nonat','update','yes','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','always','accept','originate','uac','uas','fingerprint','certificate','active','passive','actpass','update,nonat','DATE','TEXT','get','isArray','wss','encryption','avpf','force_avp','icesupport','dtlsenable','dtlssetup','dtlscertfile','dtlsprivatekey','rtcp_mux','/etc/pki/tls/private/motion.key','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','false','screenrecording','blocked','sequelize','moment','util','lodash','STRING','name','setDataValue','The\x20name\x20of\x20the\x20user','fullname','callerid','format','\x22%s\x22\x20<%s>','getDataValue','internal','email','toLowerCase','admin','user','agent','telephone','local','INTEGER','accountcode','BOOLEAN','DEFAULT\x20PAUSE','ENUM','friend','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_FAILED_SCREEN','udp','join','transport','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','inband','auto'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xde4d,0x197));var _0xdde4=function(_0x164044,_0x2ca426){_0x164044=_0x164044-0x0;var _0x57ba10=_0xde4d[_0x164044];return _0x57ba10;};'use strict';var Sequelize=require(_0xdde4('0x0'));var moment=require(_0xdde4('0x1'));var util=require(_0xdde4('0x2'));var _=require(_0xdde4('0x3'));module['exports']={'name':{'type':Sequelize[_0xdde4('0x4')],'allowNull':![],'unique':_0xdde4('0x5'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x161d03){this[_0xdde4('0x6')](_0xdde4('0x5'),_0x161d03);this[_0xdde4('0x6')]('defaultuser',_0x161d03);},'comment':_0xdde4('0x7')},'fullname':{'type':Sequelize[_0xdde4('0x4')],'allowNull':![],'set':function(_0xee20ad){this['setDataValue'](_0xdde4('0x8'),_0xee20ad);this[_0xdde4('0x6')](_0xdde4('0x9'),util[_0xdde4('0xa')](_0xdde4('0xb'),_0xee20ad,this[_0xdde4('0xc')](_0xdde4('0xd'))));}},'alias':{'type':Sequelize[_0xdde4('0x4')]},'email':{'type':Sequelize[_0xdde4('0x4')],'allowNull':![],'unique':_0xdde4('0xe'),'validate':{'isEmail':!![]},'set':function(_0x47520e){if(_0x47520e){this['setDataValue'](_0xdde4('0xe'),_0x47520e[_0xdde4('0xf')]());}}},'role':{'type':Sequelize['ENUM'](_0xdde4('0x10'),_0xdde4('0x11'),_0xdde4('0x12'),_0xdde4('0x13')),'allowNull':![]},'password':{'type':Sequelize[_0xdde4('0x4')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0xdde4('0x4')],'defaultValue':_0xdde4('0x14')},'internal':{'type':Sequelize[_0xdde4('0x15')](0xb),'allowNull':![],'unique':'internal','set':function(_0x135d8b){this[_0xdde4('0x6')](_0xdde4('0xd'),_0x135d8b);this['setDataValue'](_0xdde4('0x16'),_0x135d8b);this[_0xdde4('0x6')]('callerid',util[_0xdde4('0xa')](_0xdde4('0xb'),this[_0xdde4('0xc')](_0xdde4('0x8')),_0x135d8b));}},'salt':{'type':Sequelize[_0xdde4('0x4')]},'phone':{'type':Sequelize[_0xdde4('0x4')]},'mobile':{'type':Sequelize[_0xdde4('0x4')]},'address':{'type':Sequelize[_0xdde4('0x4')]},'zipcode':{'type':Sequelize[_0xdde4('0x4')]},'userpic':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0xdde4('0x4')]},'country':{'type':Sequelize[_0xdde4('0x4')]},'online':{'type':Sequelize[_0xdde4('0x17')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize['DATE']},'voicePause':{'type':Sequelize[_0xdde4('0x17')],'defaultValue':![]},'chatPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'mailPause':{'type':Sequelize[_0xdde4('0x17')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0xdde4('0x17')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0xdde4('0x17')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0xdde4('0x17')],'defaultValue':![]},'openchannelPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'pauseType':{'type':Sequelize[_0xdde4('0x4')],'defaultValue':_0xdde4('0x18')},'lastPauseAt':{'type':Sequelize['DATE']},'chatCapacity':{'type':Sequelize[_0xdde4('0x15')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0xdde4('0x15')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0xdde4('0x15')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0xdde4('0x15')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0xdde4('0x15')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0xdde4('0x15')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0xdde4('0x17')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0xdde4('0x15')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0xdde4('0x17')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0xdde4('0x17')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0xdde4('0x17')],'defaultValue':![]},'description':{'type':Sequelize[_0xdde4('0x4')],'allowNull':!![]},'host':{'type':Sequelize[_0xdde4('0x4')],'allowNull':!![],'defaultValue':'dynamic'},'ipaddr':{'type':Sequelize[_0xdde4('0x4')],'allowNull':!![]},'port':{'type':Sequelize[_0xdde4('0x15')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0xdde4('0x15')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0xdde4('0x4')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize['STRING'],'allowNull':!![]},'lastms':{'type':Sequelize[_0xdde4('0x15')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0xdde4('0x19')](_0xdde4('0x1a'),'user','peer'),'allowNull':!![],'defaultValue':_0xdde4('0x1a')},'context':{'type':Sequelize[_0xdde4('0x4')],'allowNull':!![],'defaultValue':_0xdde4('0x1b')},'callingpres':{'type':Sequelize[_0xdde4('0x19')](_0xdde4('0x1c'),_0xdde4('0x1d'),_0xdde4('0x1e'),_0xdde4('0x1f'),_0xdde4('0x20'),'PROHIB_PASSED_SCREEN',_0xdde4('0x21'),'PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize[_0xdde4('0x4')],'allowNull':!![]},'permit':{'type':Sequelize[_0xdde4('0x4')],'allowNull':!![]},'secret':{'type':Sequelize[_0xdde4('0x4')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0xdde4('0x4')],'allowNull':!![]},'remotesecret':{'type':Sequelize['STRING'],'allowNull':!![]},'transport':{'type':Sequelize[_0xdde4('0x4')],'allowNull':!![],'defaultValue':_0xdde4('0x22'),'set':function(_0x477d87){this[_0xdde4('0x6')]('transport',_0x477d87?_0x477d87[_0xdde4('0x23')](','):null);},'get':function(){return this[_0xdde4('0xc')](_0xdde4('0x24'))?this[_0xdde4('0xc')]('transport')[_0xdde4('0x25')](','):null;},'comment':_0xdde4('0x26')},'dtmfmode':{'type':Sequelize[_0xdde4('0x19')](_0xdde4('0x27'),_0xdde4('0x28'),'shortinfo',_0xdde4('0x29'),_0xdde4('0x2a')),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0xdde4('0x19')]('yes','no',_0xdde4('0x2b'),_0xdde4('0x2c'),'outgoing'),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xdde4('0x19')](_0xdde4('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xdde4('0x4')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0xdde4('0x4')],'allowNull':!![]},'nat':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xdde4('0x2e'),'set':function(_0x3a23b8){this[_0xdde4('0x6')](_0xdde4('0x2f'),_0x3a23b8?_0x3a23b8[_0xdde4('0x23')](','):null);},'get':function(){return this[_0xdde4('0xc')](_0xdde4('0x2f'))?this['getDataValue'](_0xdde4('0x2f'))[_0xdde4('0x25')](','):null;},'comment':_0xdde4('0x30')},'callgroup':{'type':Sequelize[_0xdde4('0x4')]},'namedcallgroup':{'type':Sequelize[_0xdde4('0x4')]},'pickupgroup':{'type':Sequelize[_0xdde4('0x4')]},'namedpickupgroup':{'type':Sequelize[_0xdde4('0x4')]},'language':{'type':Sequelize[_0xdde4('0x4')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xdde4('0x4')]},'disallow':{'type':Sequelize[_0xdde4('0x4')],'allowNull':![],'defaultValue':_0xdde4('0x31')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xdde4('0x32'),'set':function(_0x3e5eb9){this[_0xdde4('0x6')](_0xdde4('0x33'),_0x3e5eb9?_0x3e5eb9[_0xdde4('0x23')](';'):_0xdde4('0x32'));},'get':function(){return this[_0xdde4('0xc')](_0xdde4('0x33'))?this[_0xdde4('0xc')](_0xdde4('0x33'))[_0xdde4('0x25')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize[_0xdde4('0x19')](_0xdde4('0x2d'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0xdde4('0x4')],'allowNull':!![],'set':function(_0x2e91b5){this['setDataValue'](_0xdde4('0x34'),_0x2e91b5?_0x2e91b5[_0xdde4('0x23')](','):null);},'get':function(){return this[_0xdde4('0xc')](_0xdde4('0x34'))?this['getDataValue'](_0xdde4('0x34'))[_0xdde4('0x25')](','):null;},'comment':_0xdde4('0x35')},'trustrpid':{'type':Sequelize[_0xdde4('0x19')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0xdde4('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xdde4('0x19')](_0xdde4('0x2d'),'no',_0xdde4('0x36')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0xdde4('0x19')]('yes','no'),'allowNull':!![]},'useclientcode':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0xdde4('0x15')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0xdde4('0x4')],'allowNull':!![]},'callerid':{'type':Sequelize[_0xdde4('0x4')],'allowNull':!![],'defaultValue':_0xdde4('0x37')},'amaflags':{'type':Sequelize[_0xdde4('0x4')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0xdde4('0x19')](_0xdde4('0x2d'),'no'),'allowNull':!![],'defaultValue':_0xdde4('0x2d')},'busylevel':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize['ENUM'](_0xdde4('0x2d'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0xdde4('0x19')](_0xdde4('0x2d'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0xdde4('0x19')](_0xdde4('0x2d'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0xdde4('0x19')]('yes','no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0xdde4('0x4')],'allowNull':!![]},'template':{'type':Sequelize['STRING'],'allowNull':!![]},'videosupport':{'type':Sequelize[_0xdde4('0x19')](_0xdde4('0x2d'),'no',_0xdde4('0x38')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xdde4('0x15')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0xdde4('0x19')](_0xdde4('0x2d'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0xdde4('0x4')],'allowNull':!![]},'session_timers':{'type':Sequelize['ENUM'](_0xdde4('0x39'),'refuse',_0xdde4('0x3a')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0xdde4('0x15')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0xdde4('0x15')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0xdde4('0x19')](_0xdde4('0x3b'),_0xdde4('0x3c')),'allowNull':!![],'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0xdde4('0x4')],'allowNull':!![]},'regexten':{'type':Sequelize[_0xdde4('0x4')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0xdde4('0x4')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0xdde4('0x4')],'allowNull':!![]},'qualify':{'type':Sequelize[_0xdde4('0x19')](_0xdde4('0x2d'),'no'),'allowNull':!![],'defaultValue':_0xdde4('0x2d')},'keepalive':{'type':Sequelize[_0xdde4('0x15')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0xdde4('0x4')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0xdde4('0x4')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0xdde4('0x15')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0xdde4('0x15')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0xdde4('0x15')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0xdde4('0x19')](_0xdde4('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xdde4('0x4')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0xdde4('0x4')],'allowNull':!![]},'timert1':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0xdde4('0x15')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0xdde4('0x15')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0xdde4('0x4')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0xdde4('0x4')],'allowNull':!![]},'contactacl':{'type':Sequelize['STRING'],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'use_q850_reason':{'type':Sequelize['STRING'],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0xdde4('0x15')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0xdde4('0x19')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0xdde4('0x19')]('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0xdde4('0x19')](_0xdde4('0x2d'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0xdde4('0x19')](_0xdde4('0x2d'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0xdde4('0x19')](_0xdde4('0x2d'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0xdde4('0x19')]('yes','no',_0xdde4('0x3d'),_0xdde4('0x3e')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0xdde4('0x15')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0xdde4('0x4')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0xdde4('0x4')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0xdde4('0x4')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0xdde4('0x4')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0xdde4('0x4')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0xdde4('0x19')](_0xdde4('0x3f'),_0xdde4('0x40'),_0xdde4('0x41')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xdde4('0x4')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0xdde4('0x19')](_0xdde4('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xdde4('0x4')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0xdde4('0x4')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0xdde4('0x15')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0xdde4('0x4')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0xdde4('0x4')],'allowNull':!![]},'mohsuggest':{'type':Sequelize['STRING'],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0xdde4('0x4')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0xdde4('0x19')](_0xdde4('0x2d'),'no','nonat',_0xdde4('0x2c'),_0xdde4('0x42')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0xdde4('0x17')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0xdde4('0x4')]},'resetPasswordExpires':{'type':Sequelize[_0xdde4('0x43')]},'passwordResetAt':{'type':Sequelize[_0xdde4('0x43')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0xdde4('0x44')]},'showWebBar':{'type':Sequelize['INTEGER'],'defaultValue':0x0,'set':function(_0x34e23d){this[_0xdde4('0x6')]('showWebBar',_0x34e23d);var _0x24b09e=this[_0xdde4('0x45')]({'plain':!![]});switch(_0x34e23d){case 0x0:case 0x1:var _0x5d6dab=_0x24b09e[_0xdde4('0x24')]?_[_0xdde4('0x46')](_0x24b09e[_0xdde4('0x24')])?_0x24b09e['transport'][_0xdde4('0x23')]():_0x24b09e['transport']:_0xdde4('0x22');if(_0x5d6dab===_0xdde4('0x47')){_0x5d6dab=_0xdde4('0x22');}this['setDataValue']('transport',_0x5d6dab);this['setDataValue'](_0xdde4('0x48'),'no');this[_0xdde4('0x6')](_0xdde4('0x49'),null);this[_0xdde4('0x6')](_0xdde4('0x4a'),null);this['setDataValue'](_0xdde4('0x4b'),null);this[_0xdde4('0x6')](_0xdde4('0x4c'),null);this['setDataValue']('dtlsverify',null);this['setDataValue'](_0xdde4('0x4d'),null);this[_0xdde4('0x6')](_0xdde4('0x4e'),null);this[_0xdde4('0x6')](_0xdde4('0x4f'),null);this['setDataValue'](_0xdde4('0x50'),'no');break;case 0x2:this[_0xdde4('0x6')](_0xdde4('0x24'),_0xdde4('0x47'));this['setDataValue'](_0xdde4('0x48'),_0xdde4('0x2d'));this[_0xdde4('0x6')](_0xdde4('0x49'),_0xdde4('0x2d'));this[_0xdde4('0x6')](_0xdde4('0x4a'),_0xdde4('0x2d'));this['setDataValue'](_0xdde4('0x4b'),'yes');this[_0xdde4('0x6')](_0xdde4('0x4c'),_0xdde4('0x2d'));this['setDataValue']('dtlsverify','no');this[_0xdde4('0x6')](_0xdde4('0x4d'),_0xdde4('0x41'));this[_0xdde4('0x6')](_0xdde4('0x4e'),_0x24b09e[_0xdde4('0x4e')]||'/etc/pki/tls/certs/motion.crt');this[_0xdde4('0x6')](_0xdde4('0x4f'),_0x24b09e[_0xdde4('0x4f')]||_0xdde4('0x51'));this['setDataValue'](_0xdde4('0x50'),_0xdde4('0x2d'));break;default:}}},'permissions':{'type':Sequelize[_0xdde4('0x44')],'set':function(_0x4b834){this[_0xdde4('0x6')](_0xdde4('0x52'),_0x4b834?_0x4b834['join'](','):[]);},'get':function(){return this['getDataValue'](_0xdde4('0x52'))?_[_0xdde4('0x53')](this[_0xdde4('0xc')](_0xdde4('0x52'))[_0xdde4('0x25')](','),function(_0x4f3e08){return parseInt(_0x4f3e08,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0xdde4('0x4')]},'phoneBarNoReplyNumber':{'type':Sequelize['STRING']},'phoneBarBusyNumber':{'type':Sequelize[_0xdde4('0x4')]},'phoneBarUnconditional':{'type':Sequelize[_0xdde4('0x17')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0xdde4('0x17')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0xdde4('0x17')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0xdde4('0x4')],'defaultValue':''},'crudPermissions':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0xdde4('0x19')](_0xdde4('0x2d'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0xdde4('0x17')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize['STRING']},'phoneBarEnableJaws':{'type':Sequelize[_0xdde4('0x17')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0xdde4('0x17')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0xdde4('0x54')],'get':function(){return this[_0xdde4('0xc')]('phoneBarEnableScreenRecordingByAgent')?this[_0xdde4('0xc')](_0xdde4('0x55')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0xdde4('0x17')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0xdde4('0x17')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0xdde4('0x17')],'defaultValue':![]},'interface':{'type':Sequelize[_0xdde4('0x4')],'defaultValue':null},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize['STRING'],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0xdde4('0x4')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0xdde4('0x17')],'defaultValue':![],'set':function(_0x10e684){if(typeof _0x10e684===_0xdde4('0x56')){var _0x1b2319=_0x10e684==='1'?!![]:_0x10e684==='0'?![]:_0x10e684==='true'?!![]:_0x10e684===_0xdde4('0x57')?![]:![];this[_0xdde4('0x6')](_0xdde4('0x58'),_0x1b2319);}else{this[_0xdde4('0x6')](_0xdde4('0x58'),_0x10e684);}}},'blocked':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x3977c8){this[_0xdde4('0x6')](_0xdde4('0x59'),_0x3977c8);if(_0x3977c8===!![]){this[_0xdde4('0x6')]('blockedAt',moment());this[_0xdde4('0x6')]('loginAttempts',0x0);}else{this['setDataValue']('blockedAt',null);}}},'blockedAt':{'type':Sequelize['DATE'],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0xdde4('0x15')],'defaultValue':0x0},'disabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0xdde4('0x17')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0xdde4('0x15')](0x5)['UNSIGNED'],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0xdde4('0x17')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xdde4('0x17')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xdde4('0x17')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0xdde4('0x17')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0xdde4('0x17')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0xdde4('0x17')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0xdde4('0x15')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0xdde4('0x17')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0xdde4('0x15')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0xdde4('0x15')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0xdde4('0x15')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0xdde4('0x15')],'defaultValue':0x0},'messengerSoundNotification':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index f64bf0b..1951a21 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 _0x364e=['path','squel','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/realtime/agents','api','../../config/environment','../../config/license/util','../../errors/api','APINotFoundError','APIForbiddenrror','handleError','../../mysqldb','socket.io-emitter','redis','./user.socket','register','defaults','client','http','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','request','then','info','User,\x20%s,\x20%s','request\x20sent','debug','error','message','result','role','agent','emit','userNotification:recalc:','destroy','admin','Users','user','Agents','Telephones','filter','ignore','map','value','includes','find','name','stack','send','rawAttributes','type','key','password','previousPasswords','resetPasswordExpires','md5secret','index','getOptions','where','User','query','includeAll','include','userSetting','true','UserSetting','attributes','push','findAll','rows','openTabs','chat','dataValues','sms','mail','openchannel','show','params','merge','options','whatsapp','fax','update','body','describe','catch','addContacts','ids','internal','Setting','findById','validatePasswordPattern','max','isNil','min_internal','sequelize','select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)','QueryTypes','SELECT','length','from','mailbox','fullname','permissions','101','102','103','113','110','104','105','106','107','108','109','100','111','115','create','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','checkUserLimits','settingsEnabled','VoiceMail','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','bulkCreate','Unauthorized','some','all','telephone','UserProfileSection','compact','changePassword','oldPassword','newPassword','Sequelize','ValidationError','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','authenticate','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','findOne','securePassword','enforcePasswordHistory','passwordHistoryLimit','validatePasswordHistory','updatePasswordsHistory','channel','online','interface','Unknown\x20channel','add','toLowerCase','Queues','penalty','spread','QueueId','capitalize','Queue:save','voice','VoiceQueue','get','format','SIP/%s','upsert','isValidChannel','remove','Queue:remove','userpic','file','filename','root','server/files/images/logos/default_profile.png','download','existsSync','join','server/files/images/','CHAT','createdAt','FAX','SMS','concat','getContacts','User\x20with\x20id\x20%s\x20not\x20found','CmList','List','Tags','color','tag','model','keys','Queue','filters','intersection','fields','order','sort','pick','Unknown\x20role','nolimit','getVoiceQueuesRt','UserVoiceQueueRt','hasOwnProperty','getGroups','ChatGroup','getRecordings','VoiceRecording','UserId','ScreenRecording','getChatInteractions','ChatInteraction','getOpenchannelInteractions','OpenchannelInteraction','MailInteraction','SmsInteraction','getSmsInteractions','getFaxInteractions','FaxInteraction','WhatsappInteraction','getWhatsappInteractions','phone','mobile','loginInPause','LOCAL/%s@from-sip/n','intrf','user:forcelogout','x-forwarded-for','connection','remoteAddress','socket','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','UserVoiceQueue.penalty','MemberReport','forEach','getChannels','YYYY-MM-DD\x20HH:mm:ss','LOGIN','device','PAUSE','LOGININPAUSE','isMiddleware','resolve','logout','pause','QueuePause','updateAttributes','DEFAULT\x20PAUSE','unpause','Channel\x20parameter\x20%s\x20is\x20invalid','voicePause','mailPause','chatPause','faxPause','openchannelPause','smsPause','whatsappPause','pauseType','lastPauseAt','getTeams','addTeams','Body\x20parameter\x20\x27ids\x27\x20is\x20required','transaction','Team','getAssociatedQueues','getDataValue','Voice','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','removeTeams','isArray','Query\x20parameter\x20\x27ids\x27\x20is\x20required','flattenDeep','removeAgent','getLists','getAgents','getVoiceQueues','values','You\x20can\x27t\x20delete\x20yourself','CmHopper','addChatInteractions','user_has_chat_interactions:save','removeChatInteractions','user_has_chat_interactions:remove','addMailInteractions','omit','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','user_has_whatsapp_interactions:save','removeWhatsappInteractions','VoicePrefix','getVoicePrefixes','getFaxAccounts','addFaxAccounts','removeFaxAccounts','MailAccount','getMailAccounts','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','OpenchannelAccount','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','SmsAccount','addSmsAccounts','removeSmsAccounts','addChatWebsites','removeChatWebsites','getWhatsappAccounts','WhatsappAccount','removeWhatsappAccounts','$and','$or','$lt','$lte','$ne','$not','$between','$notBetween','$in','$notIn','$like','$notLike','$overlap','$contains','$any','lastName','Contact','dialActive','retrieveApiKey','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','generateApiKey','iat','token','removeApiKey','apiKeyNonce','apiKeyIat','API\x20key\x20not\x20available','whoami','getUserSetting','getPresence','ringing','teams','queues','toString','lower','asc','desc','substring','uniqBy','orderBy','offline','voiceStatus','unavailable','busy','slice','charAt','toUpperCase','field','ui.','InteractionId','ui.createdAt','user_has_','_interactions','ui.UserId\x20=\x20?','OpenTabs','messengerSoundNotification','moment'];(function(_0x539175,_0x3ccad0){var _0x4afbc3=function(_0x4bda0c){while(--_0x4bda0c){_0x539175['push'](_0x539175['shift']());}};_0x4afbc3(++_0x3ccad0);}(_0x364e,0x188));var _0xe364=function(_0x3d42d8,_0x4cffaa){_0x3d42d8=_0x3d42d8-0x0;var _0x27fc41=_0x364e[_0x3d42d8];return _0x27fc41;};'use strict';var moment=require(_0xe364('0x0'));var util=require('util');var path=require(_0xe364('0x1'));var fs=require('fs');var _=require('lodash');var squel=require(_0xe364('0x2'));var Redis=require(_0xe364('0x3'));var jayson=require('jayson/promise');var authService=require(_0xe364('0x4'));var contacts=require('../../components/contacts');var qs=require(_0xe364('0x5'));var rta=require(_0xe364('0x6'));var logger=require('../../config/logger')(_0xe364('0x7'));var utils=require('../../config/utils');var config=require(_0xe364('0x8'));var licenseUtil=require(_0xe364('0x9'));var APIBadRequestError=require(_0xe364('0xa'))['APIBadRequestError'];var APINotFoundError=require(_0xe364('0xa'))[_0xe364('0xb')];var APIForbiddenError=require('../../errors/api')[_0xe364('0xc')];var APIHandleError=require(_0xe364('0xa'))[_0xe364('0xd')];var db=require(_0xe364('0xe'))['db'];var socket=require(_0xe364('0xf'))(new Redis(config[_0xe364('0x10')]));require(_0xe364('0x11'))[_0xe364('0x12')](socket);config[_0xe364('0x10')]=_[_0xe364('0x13')](config['redis'],{'host':'localhost','port':0x18eb});var amiClient=jayson[_0xe364('0x14')][_0xe364('0x15')]({'port':0x232a});var values;function respondWithStatusCode(_0x5334e6,_0x525f66){_0x525f66=_0x525f66||0xcc;return function(_0x2a05a2){if(_0x2a05a2){return _0x5334e6[_0xe364('0x16')](_0x525f66);}return _0x5334e6[_0xe364('0x17')](_0x525f66)[_0xe364('0x18')]();};}function respondWithResult(_0x2e8b1e,_0x258608){_0x258608=_0x258608||0xc8;return function(_0x3552e3){if(_0x3552e3){return _0x2e8b1e['status'](_0x258608)['json'](_0x3552e3);}};}function respondWithFilteredResult(_0x6bd85e,_0x13f262){return function(_0x2ec017){if(_0x2ec017){var _0x7a8ffa=typeof _0x13f262[_0xe364('0x19')]===_0xe364('0x1a')&&typeof _0x13f262[_0xe364('0x1b')]===_0xe364('0x1a');var _0x3a5c88=_0x2ec017[_0xe364('0x1c')];var _0x59e83e=_0x7a8ffa?0x0:_0x13f262[_0xe364('0x19')];var _0x543524=_0x7a8ffa?_0x2ec017['count']:_0x13f262[_0xe364('0x19')]+_0x13f262[_0xe364('0x1b')];var _0x3f1943;if(_0x543524>=_0x3a5c88){_0x543524=_0x3a5c88;_0x3f1943=0xc8;}else{_0x3f1943=0xce;}_0x6bd85e['status'](_0x3f1943);return _0x6bd85e['set'](_0xe364('0x1d'),_0x59e83e+'-'+_0x543524+'/'+_0x3a5c88)[_0xe364('0x1e')](_0x2ec017);}return null;};}function respondWithRpcPromise(_0x59ef21,_0x33a37a,_0x14db3b,_0x1fe63d){return new Promise(function(_0x5888e9,_0x5bf6a){var _0x5c30a3=_0x1fe63d||amiClient;return _0x5c30a3[_0xe364('0x1f')](_0x59ef21,_0x14db3b)[_0xe364('0x20')](function(_0x2cab3d){logger[_0xe364('0x21')](_0xe364('0x22'),_0x33a37a,_0xe364('0x23'));logger[_0xe364('0x24')]('User,\x20%s,\x20%s,\x20%s',_0x33a37a,_0xe364('0x23'),JSON['stringify'](_0x2cab3d));if(_0x2cab3d[_0xe364('0x25')]){if(_0x2cab3d[_0xe364('0x25')]['code']===0x1f4){logger[_0xe364('0x25')](_0xe364('0x22'),_0x33a37a,_0x2cab3d['error'][_0xe364('0x26')]);return _0x5bf6a(_0x2cab3d['error'][_0xe364('0x26')]);}logger[_0xe364('0x25')](_0xe364('0x22'),_0x33a37a,_0x2cab3d[_0xe364('0x25')]['message']);return _0x5888e9(_0x2cab3d['error'][_0xe364('0x26')]);}else{logger[_0xe364('0x21')]('User,\x20%s,\x20%s',_0x33a37a,'request\x20sent');_0x5888e9(_0x2cab3d[_0xe364('0x27')][_0xe364('0x26')]);}})['catch'](function(_0x2866f7){logger[_0xe364('0x25')](_0xe364('0x22'),_0x33a37a,_0x2866f7);_0x5bf6a(_0x2866f7);});});}function saveUpdates(_0x31dcd9){return function(_0x32b84a){if(_0x32b84a){return _0x32b84a['update'](_0x31dcd9)[_0xe364('0x20')](function(_0x5d7e68){if(_0x5d7e68[_0xe364('0x28')]===_0xe364('0x29')){socket[_0xe364('0x2a')](_0xe364('0x2b')+_0x5d7e68['id'],_0x5d7e68);}return _0x5d7e68;});}return null;};}function removeEntity(_0x4a6c9d,_0x232ba0){return function(_0xed326d){if(_0xed326d){return _0xed326d[_0xe364('0x2c')]({'transaction':_0x232ba0})['then'](function(){var _0x576a7c=_0xed326d['get']({'plain':!![]});if(_0x576a7c[_0xe364('0x28')]===_0xe364('0x2d'))return;var _0x27114b=[{'name':_0xe364('0x2e'),'value':_0xe364('0x2f'),'ignore':!![]},{'name':_0xe364('0x30'),'value':_0xe364('0x29'),'ignore':![]},{'name':_0xe364('0x31'),'value':'telephone','ignore':![]}];var _0x32c7a6=_(_0x27114b)[_0xe364('0x32')](_0xe364('0x33'))[_0xe364('0x34')](_0xe364('0x35'))['value']();if(_[_0xe364('0x36')](_0x32c7a6,_0x576a7c[_0xe364('0x28')])){return;}var _0x55cb84=_[_0xe364('0x37')](_0x27114b,['value',_0x576a7c[_0xe364('0x28')]])[_0xe364('0x38')];return db['UserProfileResource'][_0xe364('0x2c')]({'where':{'type':_0x55cb84,'resourceId':_0x576a7c['id']},'transaction':_0x232ba0})[_0xe364('0x20')](function(){return _0xed326d;});})['then'](function(){_0x4a6c9d[_0xe364('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x11984c){return function(_0xa3f584){if(!_0xa3f584){_0x11984c['sendStatus'](0x194);}return _0xa3f584;};}function handleError(_0x27b834,_0x5e30b0){_0x5e30b0=_0x5e30b0||0x1f4;return function(_0x51d32c){logger[_0xe364('0x25')](_0x51d32c[_0xe364('0x39')]);if(_0x51d32c[_0xe364('0x38')]){delete _0x51d32c[_0xe364('0x38')];}_0x27b834['status'](_0x5e30b0)[_0xe364('0x3a')](_0x51d32c);};}function getUserAttributes(){return _(db['User'][_0xe364('0x3b')])[_0xe364('0x34')](function(_0x253a19){return{'name':_0x253a19['fieldName'],'type':_0x253a19[_0xe364('0x3c')][_0xe364('0x3d')]};})[_0xe364('0x32')](function(_0x320438){return![_0xe364('0x3e'),'salt',_0xe364('0x3f'),'resetPasswordToken',_0xe364('0x40'),_0xe364('0x41')][_0xe364('0x36')](_0x320438[_0xe364('0x38')]);})['value']();}exports[_0xe364('0x42')]=function(_0x5ee343,_0x15e8c8){var _0x3ccfd2={},_0x45dbe9={'count':0x0,'rows':[]};var _0x1f7845=getUserAttributes();_0x3ccfd2=qs[_0xe364('0x43')](_0x1f7845,_0x5ee343);var _0x1bdfab={'where':_0x3ccfd2[_0xe364('0x44')]};return db[_0xe364('0x45')][_0xe364('0x1c')](_0x1bdfab)[_0xe364('0x20')](function(_0xbb741b){_0x45dbe9[_0xe364('0x1c')]=_0xbb741b;if(_0x5ee343[_0xe364('0x46')][_0xe364('0x47')]){_0x3ccfd2[_0xe364('0x48')]=[{'all':!![]}];}if(_0x5ee343[_0xe364('0x46')][_0xe364('0x49')]===_0xe364('0x4a')){_0x3ccfd2['include']=[{'model':db[_0xe364('0x4b')],'as':_0xe364('0x49')}];}if(!_[_0xe364('0x36')](_0x3ccfd2[_0xe364('0x4c')],'id')){_0x3ccfd2[_0xe364('0x4c')][_0xe364('0x4d')]('id');}return db[_0xe364('0x45')][_0xe364('0x4e')](_0x3ccfd2);})[_0xe364('0x20')](function(_0x1d67fd){_0x45dbe9[_0xe364('0x4f')]=_0x1d67fd;if(_0x5ee343[_0xe364('0x46')][_0xe364('0x50')]==='true'){var _0x2931e5=[];for(var _0x16243d=0x0;_0x16243d<_0x45dbe9[_0xe364('0x4f')]['length'];_0x16243d++){_0x2931e5[_0xe364('0x4d')](get_open_tabs(_0xe364('0x51'),_0x45dbe9[_0xe364('0x4f')][_0x16243d][_0xe364('0x52')]));_0x2931e5['push'](get_open_tabs(_0xe364('0x53'),_0x45dbe9[_0xe364('0x4f')][_0x16243d]['dataValues']));_0x2931e5[_0xe364('0x4d')](get_open_tabs('fax',_0x45dbe9['rows'][_0x16243d][_0xe364('0x52')]));_0x2931e5[_0xe364('0x4d')](get_open_tabs(_0xe364('0x54'),_0x45dbe9[_0xe364('0x4f')][_0x16243d][_0xe364('0x52')]));_0x2931e5[_0xe364('0x4d')](get_open_tabs(_0xe364('0x55'),_0x45dbe9[_0xe364('0x4f')][_0x16243d][_0xe364('0x52')]));_0x2931e5[_0xe364('0x4d')](get_open_tabs('whatsapp',_0x45dbe9['rows'][_0x16243d][_0xe364('0x52')]));}return Promise['all'](_0x2931e5)[_0xe364('0x20')](function(){return _0x45dbe9;});}else{return _0x45dbe9;}})[_0xe364('0x20')](respondWithFilteredResult(_0x15e8c8,_0x3ccfd2))['catch'](handleError(_0x15e8c8,null));};exports[_0xe364('0x56')]=function(_0xaadae8,_0x37a6dc){var _0x395949=getUserAttributes();_0xaadae8['query']['id']=_0xaadae8[_0xe364('0x57')]['id'];var _0x40b9ec=qs[_0xe364('0x43')](_0x395949,_0xaadae8);if(_0xaadae8['query']['includeAll']){_0x40b9ec[_0xe364('0x48')]=[{'all':!![]}];}if(_0xaadae8[_0xe364('0x46')][_0xe364('0x49')]===_0xe364('0x4a')){_0x40b9ec['include']=[{'model':db[_0xe364('0x4b')],'as':'userSetting'}];}_0x40b9ec=_[_0xe364('0x58')]({},_0x40b9ec,_0xaadae8[_0xe364('0x59')]);if(!_['includes'](_0x40b9ec[_0xe364('0x4c')],'id')){_0x40b9ec[_0xe364('0x4c')][_0xe364('0x4d')]('id');}return db[_0xe364('0x45')][_0xe364('0x37')](_0x40b9ec)['then'](handleEntityNotFound(_0x37a6dc,null))['then'](function(_0x192376){var _0x95c744=[];values=_0x192376;if(_0xaadae8[_0xe364('0x46')][_0xe364('0x50')]===_0xe364('0x4a')){_0x95c744[_0xe364('0x4d')](get_open_tabs(_0xe364('0x51'),_0x192376[_0xe364('0x52')]));_0x95c744['push'](get_open_tabs(_0xe364('0x53'),_0x192376['dataValues']));_0x95c744[_0xe364('0x4d')](get_open_tabs('openchannel',_0x192376[_0xe364('0x52')]));_0x95c744[_0xe364('0x4d')](get_open_tabs(_0xe364('0x5a'),_0x192376['dataValues']));_0x95c744[_0xe364('0x4d')](get_open_tabs(_0xe364('0x5b'),_0x192376['dataValues']));_0x95c744[_0xe364('0x4d')](get_open_tabs(_0xe364('0x54'),_0x192376[_0xe364('0x52')]));return Promise['all'](_0x95c744);}else{return values;}})[_0xe364('0x20')](function(){return values;})[_0xe364('0x20')](respondWithResult(_0x37a6dc,null))['catch'](handleError(_0x37a6dc,null));};exports[_0xe364('0x5c')]=function(_0x1130fb,_0x2cd6af){if(_0x1130fb[_0xe364('0x5d')]['id']){delete _0x1130fb['body']['id'];}delete _0x1130fb[_0xe364('0x5d')][_0xe364('0x28')];return db[_0xe364('0x45')][_0xe364('0x37')]({'where':{'id':_0x1130fb[_0xe364('0x57')]['id']}})['then'](handleEntityNotFound(_0x2cd6af,null))[_0xe364('0x20')](saveUpdates(_0x1130fb[_0xe364('0x5d')],null))[_0xe364('0x20')](respondWithResult(_0x2cd6af,null))['catch'](handleError(_0x2cd6af,null));};exports[_0xe364('0x5e')]=function(_0x11f416,_0x5389d0){return db[_0xe364('0x45')][_0xe364('0x5e')]()[_0xe364('0x20')](respondWithResult(_0x5389d0,null))[_0xe364('0x5f')](handleError(_0x5389d0,null));};exports[_0xe364('0x60')]=function(_0x3442ff,_0xa9f902){return db['User'][_0xe364('0x37')]({'where':{'id':_0x3442ff[_0xe364('0x57')]['id']}})[_0xe364('0x20')](handleEntityNotFound(_0xa9f902,null))['then'](function(_0x1b8362){if(_0x1b8362){return _0x1b8362[_0xe364('0x60')](_0x3442ff[_0xe364('0x5d')][_0xe364('0x61')],_['omit'](_0x3442ff['body'],['ids','id'])||{});}})[_0xe364('0x20')](respondWithResult(_0xa9f902,null))[_0xe364('0x5f')](handleError(_0xa9f902,null));};function validateUser(_0x501afa){return new Promise(function(_0x5866f4,_0x34c2f4){if(_0x501afa[_0xe364('0x62')])return _0x5866f4(_0x501afa);return db[_0xe364('0x63')][_0xe364('0x64')](0x1)[_0xe364('0x20')](function(_0x104de3){if(_0x104de3['securePassword'])authService[_0xe364('0x65')](_0x501afa[_0xe364('0x3e')]);db['User'][_0xe364('0x66')](_0xe364('0x62'))['then'](function(_0x1ff92a){if(_[_0xe364('0x67')](_0x1ff92a)){_0x501afa[_0xe364('0x62')]=_0x104de3[_0xe364('0x68')]||0x1;return;}if(_[_0xe364('0x67')](_0x104de3[_0xe364('0x68')])||_0x104de3[_0xe364('0x68')]===_0x1ff92a){_0x501afa[_0xe364('0x62')]=_0x1ff92a+0x1;return;}if(_0x104de3[_0xe364('0x68')]>_0x1ff92a){_0x501afa[_0xe364('0x62')]=_0x104de3[_0xe364('0x68')];return;}return db[_0xe364('0x69')]['query'](_0xe364('0x6a'),{'type':db[_0xe364('0x69')][_0xe364('0x6b')][_0xe364('0x6c')]})[_0xe364('0x20')](function(_0x33fd0f){if(_0x33fd0f&&_0x33fd0f[_0xe364('0x6d')]){for(var _0x3a1f16=0x0,_0x28f8ba=_0x33fd0f[_0xe364('0x6d')];_0x3a1f16<_0x28f8ba&&_[_0xe364('0x67')](_0x501afa[_0xe364('0x62')]);_0x3a1f16++){if(_0x104de3[_0xe364('0x68')]<=_0x33fd0f[_0x3a1f16][_0xe364('0x6e')]){_0x501afa[_0xe364('0x62')]=_0x33fd0f[_0x3a1f16][_0xe364('0x6e')];}else if(_0x104de3['min_internal']>_0x33fd0f[_0x3a1f16][_0xe364('0x6e')]&&_0x104de3[_0xe364('0x68')]<=_0x33fd0f[_0x3a1f16]['to']){_0x501afa['internal']=_0x104de3[_0xe364('0x68')];}}}if(_[_0xe364('0x67')](_0x501afa[_0xe364('0x62')])){_0x501afa[_0xe364('0x62')]=_0x1ff92a+0x1;}return _0x5866f4(_0x501afa);});});})['catch'](function(_0x1857a6){_0x34c2f4(_0x1857a6);});});}function updateUser(_0x185f47){return new Promise(function(_0x5449d6,_0x76fc63){try{if(_0x185f47['voicemail']){_0x185f47[_0xe364('0x6f')]=_0x185f47[_0xe364('0x62')];_0x185f47['VoiceMail']={'mailbox':_0x185f47[_0xe364('0x62')],'password':_0x185f47[_0xe364('0x3e')],'fullname':_0x185f47[_0xe364('0x70')],'email':_0x185f47['email']};}if(_0x185f47[_0xe364('0x28')]===_0xe364('0x29')){if(!_0x185f47[_0xe364('0x71')])_0x185f47['permissions']=[_0xe364('0x72'),_0xe364('0x73'),_0xe364('0x74'),_0xe364('0x75'),_0xe364('0x76'),_0xe364('0x77'),_0xe364('0x78'),_0xe364('0x79'),_0xe364('0x7a'),_0xe364('0x7b'),_0xe364('0x7c'),_0xe364('0x7d'),_0xe364('0x7e'),'114',_0xe364('0x7f')];}_0x5449d6(_0x185f47);}catch(_0x3c00c0){_0x76fc63(_0x3c00c0);}});}exports[_0xe364('0x80')]=function(_0x362dd0,_0x1727f2){if(_0x362dd0[_0xe364('0x2f')][_0xe364('0x28')]===_0xe364('0x29'))throw new Error('Unauthorized');if(_0x362dd0[_0xe364('0x5d')]['role']==='user'&&_0x362dd0[_0xe364('0x2f')][_0xe364('0x28')]!==_0xe364('0x2d')){throw new Error(_0xe364('0x81'));}if(_0x362dd0[_0xe364('0x5d')]['role']===_0xe364('0x2d')&&_0x362dd0[_0xe364('0x2f')]['role']!=='admin'){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator');}return licenseUtil[_0xe364('0x82')]([_0x362dd0['body']])['then'](function(){return validateUser(_0x362dd0[_0xe364('0x5d')]);})[_0xe364('0x20')](function(_0x2ae5fd){return updateUser(_0x2ae5fd)[_0xe364('0x20')](function(_0x59404a){if(_0x59404a[_0xe364('0x28')]===_0xe364('0x2d')){_0x59404a[_0xe364('0x83')]=_0x362dd0[_0xe364('0x2f')]['settingsEnabled'];delete _0x59404a['userProfileId'];}return _0x59404a;});})['then'](function(_0x1955e5){return db[_0xe364('0x45')][_0xe364('0x80')](_0x1955e5,{'include':[{'model':db[_0xe364('0x84')],'as':_0xe364('0x84')}]});})[_0xe364('0x20')](function(_0x1c6700){if(_0x362dd0['body'][_0xe364('0x28')]==='user')return _0x1c6700;if(_0x362dd0[_0xe364('0x2f')][_0xe364('0x28')]!==_0xe364('0x2f'))return _0x1c6700;return db['UserProfileSection']['find']({'where':{'name':_0x1c6700[_0xe364('0x28')]===_0xe364('0x29')?_0xe364('0x30'):_0xe364('0x31'),'userProfileId':_0x362dd0[_0xe364('0x2f')][_0xe364('0x85')]},'raw':!![]})[_0xe364('0x20')](function(_0x300b5e){if(!_0x300b5e||_0x300b5e[_0xe364('0x86')]!=0x0)return _0x1c6700;return db[_0xe364('0x87')]['create']({'name':_0x1c6700['name'],'resourceId':_0x1c6700['id'],'type':_0x300b5e['name'],'sectionId':_0x300b5e['id']},{})[_0xe364('0x20')](function(){return _0x1c6700;});})[_0xe364('0x5f')](function(_0x2f6b01){logger[_0xe364('0x25')](_0xe364('0x88'),_0x2f6b01);throw _0x2f6b01;});})[_0xe364('0x20')](respondWithResult(_0x1727f2,0xc9))['catch'](handleError(_0x1727f2,null));};exports[_0xe364('0x89')]=function(_0x342003,_0xdaa20b){var _0x3f3ae4=_0x342003['body'];var _0x3be835=[];if(_0x342003[_0xe364('0x2f')]['role']==='agent')throw new Error(_0xe364('0x8a'));if(_[_0xe364('0x8b')](_0x3f3ae4,[_0xe364('0x28'),_0xe364('0x2f')])&&_0x342003['user'][_0xe364('0x28')]!==_0xe364('0x2d')){throw new Error(_0xe364('0x81'));}if(_[_0xe364('0x8b')](_0x3f3ae4,[_0xe364('0x28'),_0xe364('0x2d')])&&_0x342003[_0xe364('0x2f')][_0xe364('0x28')]!==_0xe364('0x2d')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator');}return licenseUtil[_0xe364('0x82')](_0x3f3ae4)[_0xe364('0x20')](function(){return validateUser(_0x3f3ae4[0x0]);})['then'](function(){for(var _0x2dc3d1=0x1;_0x2dc3d1<_0x3f3ae4[_0xe364('0x6d')];_0x2dc3d1++){var _0x5d48f0=_0x3f3ae4[_0x2dc3d1-0x1]['internal'];if(!_0x3f3ae4[_0x2dc3d1][_0xe364('0x62')])_0x3f3ae4[_0x2dc3d1][_0xe364('0x62')]=_0x5d48f0+0x1;_0x3be835[_0xe364('0x4d')](validateUser(_0x3f3ae4[_0x2dc3d1]));}return Promise['all'](_0x3be835);})['then'](function(){_0x3be835=[];for(var _0x4f3e0c=0x0;_0x4f3e0c<_0x3f3ae4[_0xe364('0x6d')];_0x4f3e0c++){_0x3be835[_0xe364('0x4d')](updateUser(_0x3f3ae4[_0x4f3e0c]));}return Promise['all'](_0x3be835);})['then'](function(){_0x3be835=_0x3f3ae4['map'](function(_0x295321){return db[_0xe364('0x45')][_0xe364('0x80')](_0x295321,{'include':[{'model':db[_0xe364('0x84')],'as':_0xe364('0x84')}]})[_0xe364('0x20')](function(_0x2deb41){_0x295321['id']=_0x2deb41['id'];return _0x295321;});});return Promise[_0xe364('0x8c')](_0x3be835);})[_0xe364('0x20')](function(_0x54bdb1){if(_0x342003[_0xe364('0x5d')][_0xe364('0x28')]==='user')return _0x54bdb1;if(_0x342003[_0xe364('0x2f')][_0xe364('0x28')]!=='user')return _0x54bdb1;var _0x57d1d8=_['some'](_0x54bdb1,function(_0x3d82c7){return _0x3d82c7[_0xe364('0x28')]==='agent'||_0x3d82c7[_0xe364('0x28')]===_0xe364('0x8d');});if(!_0x57d1d8)return _0x54bdb1;return db[_0xe364('0x8e')][_0xe364('0x4e')]({'where':{'name':{'$or':['Agents',_0xe364('0x31')]},'userProfileId':_0x342003[_0xe364('0x2f')][_0xe364('0x85')]},'raw':!![]})[_0xe364('0x20')](function(_0x4b9bb8){if(_['isEmpty'](_0x4b9bb8)||!_[_0xe364('0x8b')](_0x4b9bb8,[_0xe364('0x86'),0x0]))return _0x54bdb1;_0x3be835=[];var _0xe0e53b=_(_0x4b9bb8)[_0xe364('0x34')](function(_0x214a95){if(_0x214a95[_0xe364('0x86')]===0x1)return;return _0x214a95['name']==='Agents'?_0xe364('0x29'):'telephone';})[_0xe364('0x8f')]()[_0xe364('0x35')]();for(var _0x2903f9=0x0;_0x2903f9<_0x54bdb1['length'];_0x2903f9++){if(!_['includes'](_0xe0e53b,_0x54bdb1[_0x2903f9][_0xe364('0x28')]))return;var _0x27c12c=_0x54bdb1[_0x2903f9][_0xe364('0x28')]===_0xe364('0x29')?_0xe364('0x30'):_0xe364('0x31');_0x3be835[_0xe364('0x4d')](db['UserProfileResource'][_0xe364('0x80')]({'name':_0x54bdb1[_0x2903f9][_0xe364('0x38')],'resourceId':_0x54bdb1[_0x2903f9]['id'],'type':_0x27c12c,'sectionId':_['find'](_0x4b9bb8,[_0xe364('0x38'),_0x27c12c])['id']},{}));}return Promise[_0xe364('0x8c')](_0x3be835);});})[_0xe364('0x20')](respondWithResult(_0xdaa20b,0xc9))[_0xe364('0x5f')](handleError(_0xdaa20b,null));};exports[_0xe364('0x90')]=function(_0x467b78,_0x2aa885){if(_0x467b78[_0xe364('0x5d')]['id']){delete _0x467b78[_0xe364('0x5d')]['id'];}return db[_0xe364('0x45')][_0xe364('0x37')]({'where':{'id':_0x467b78[_0xe364('0x57')]['id']}})[_0xe364('0x20')](function(_0x2b8739){if(!_0x2b8739)return null;if(_0x2b8739['id']===_0x467b78[_0xe364('0x2f')]['id']){if(!_0x467b78['body'][_0xe364('0x91')]||!_0x467b78[_0xe364('0x5d')][_0xe364('0x92')]){throw new db[(_0xe364('0x93'))][(_0xe364('0x94'))](_0xe364('0x95'));}if(!_0x2b8739[_0xe364('0x96')](_0x467b78['body']['oldPassword'])){throw new db['Sequelize']['ValidationError']('Wrong\x20credentials');}if(_0x467b78[_0xe364('0x5d')]['oldPassword']===_0x467b78['body'][_0xe364('0x92')]){throw new db[(_0xe364('0x93'))][(_0xe364('0x94'))](_0xe364('0x97'));}}else if(_0x467b78['user'][_0xe364('0x28')]==='admin'){if(!_0x467b78[_0xe364('0x5d')][_0xe364('0x92')]){throw new db[(_0xe364('0x93'))][(_0xe364('0x94'))](_0xe364('0x98'));}}else if(_0x467b78[_0xe364('0x2f')]['role']==='user'){if(!_0x467b78[_0xe364('0x5d')][_0xe364('0x92')]){throw new db[(_0xe364('0x93'))][(_0xe364('0x94'))](_0xe364('0x98'));}if(_0x2b8739[_0xe364('0x28')]!==_0xe364('0x29')){throw new db[(_0xe364('0x93'))][(_0xe364('0x94'))](_0xe364('0x8a'));}}else{throw new db[(_0xe364('0x93'))][(_0xe364('0x94'))](_0xe364('0x8a'));}return _0x2b8739;})['then'](handleEntityNotFound(_0x2aa885,null))[_0xe364('0x20')](function(_0x181c8e){return db['Setting'][_0xe364('0x99')]({'attributes':['id',_0xe364('0x9a'),_0xe364('0x9b'),_0xe364('0x9c')]})[_0xe364('0x20')](function(_0x37d7dd){if(_0x37d7dd[_0xe364('0x9a')])authService[_0xe364('0x65')](_0x467b78[_0xe364('0x5d')][_0xe364('0x92')]);if(!_0x37d7dd[_0xe364('0x9b')]||!_0x181c8e[_0xe364('0x3f')])return _0x181c8e;authService[_0xe364('0x9d')](_0x467b78[_0xe364('0x5d')][_0xe364('0x92')],_0x181c8e[_0xe364('0x3f')],_0x37d7dd[_0xe364('0x9c')]);return _0x181c8e;})['then'](saveUpdates({'password':_0x467b78[_0xe364('0x5d')][_0xe364('0x92')],'passwordResetAt':_0x467b78[_0xe364('0x2f')]['id']==_0x467b78[_0xe364('0x57')]['id']?moment():null,'previousPasswords':authService[_0xe364('0x9e')](_0x467b78[_0xe364('0x5d')][_0xe364('0x92')],_0x181c8e[_0xe364('0x3f')])},null));})[_0xe364('0x20')](respondWithResult(_0x2aa885,null))['catch'](handleError(_0x2aa885,null));};exports['addQueues']=function(_0x67bb6e,_0x5709d6){var _0x24c2ba=_0x67bb6e[_0xe364('0x5d')][_0xe364('0x9f')];return db[_0xe364('0x45')][_0xe364('0x37')]({'where':{'id':_0x67bb6e[_0xe364('0x57')]['id']},'attributes':['id',_0xe364('0x38'),'role',_0xe364('0xa0'),'loginInPause','voicePause',_0xe364('0xa1')]})[_0xe364('0x20')](handleEntityNotFound(_0x5709d6,null))[_0xe364('0x20')](function(_0x5555b2){if(_0x5555b2){if(!utils['isValidChannel'](_0x24c2ba)){throw new db[(_0xe364('0x93'))]['ValidationError'](_0xe364('0xa2'));}return _0x5555b2[_0xe364('0xa3')+_['capitalize'](_0x24c2ba[_0xe364('0xa4')]())+_0xe364('0xa5')](_0x67bb6e[_0xe364('0x5d')]['ids'],{'penalty':_0x67bb6e['body'][_0xe364('0xa6')]||0x0})[_0xe364('0xa7')](function(_0x4d3a19){for(var _0x4233e8=0x0;_0x4233e8<_0x67bb6e[_0xe364('0x5d')]['ids'][_0xe364('0x6d')];_0x4233e8+=0x1){var _0x34a7b9={'UserId':Number(_0x67bb6e[_0xe364('0x57')]['id'])};_0x34a7b9[_['capitalize'](_0x24c2ba[_0xe364('0xa4')]())+_0xe364('0xa8')]=Number(_0x67bb6e[_0xe364('0x5d')][_0xe364('0x61')][_0x4233e8]);socket[_0xe364('0x2a')](_0xe364('0x2f')+_[_0xe364('0xa9')](_0x24c2ba['toLowerCase']())+_0xe364('0xaa'),_0x34a7b9);}return _0x4d3a19;})[_0xe364('0x20')](function(){if(_0x24c2ba===_0xe364('0xab')){return db[_0xe364('0xac')][_0xe364('0x4e')]({'where':{'id':_0x67bb6e['body']['ids']||[]},'raw':!![],'attributes':['id','name']});}})[_0xe364('0x20')](function(_0x27bac7){var _0x917b2a=_0x5555b2[_0xe364('0xad')]({'plain':!![]});var _0x113951=[];if(_0x24c2ba===_0xe364('0xab')&&_0x917b2a[_0xe364('0x28')]==='agent'&&_0x917b2a[_0xe364('0xa0')]){for(let _0x127e67=0x0;_0x127e67<_0x27bac7[_0xe364('0x6d')];_0x127e67+=0x1){_0x113951['push']({'membername':_0x917b2a[_0xe364('0x38')],'UserId':_0x917b2a['id'],'queue_name':_0x27bac7[_0x127e67][_0xe364('0x38')],'VoiceQueueId':_0x27bac7[_0x127e67]['id'],'interface':_[_0xe364('0x67')](_0x917b2a['interface'])?util[_0xe364('0xae')](_0xe364('0xaf'),_0x917b2a['name']):_0x917b2a[_0xe364('0xa1')],'paused':_0x917b2a['voicePause']||![],'penalty':_0x67bb6e[_0xe364('0x5d')][_0xe364('0xa6')]||0x0});}return Promise['all'](_0x113951[_0xe364('0x34')](function(_0xa7f952){return db['UserVoiceQueueRt'][_0xe364('0xb0')](_0xa7f952);}));}return _0x5555b2;});}})[_0xe364('0x20')](respondWithStatusCode(_0x5709d6,null))[_0xe364('0x5f')](handleError(_0x5709d6,null));};exports['removeQueues']=function(_0x318868,_0x46d69){var _0x2c6f20,_0x772483;return db[_0xe364('0x45')][_0xe364('0x37')]({'where':{'id':_0x318868['params']['id']},'attributes':['id','name',_0xe364('0x28')]})[_0xe364('0x20')](handleEntityNotFound(_0x46d69,null))[_0xe364('0x20')](function(_0x2be84f){if(_0x2be84f){_0x2c6f20=_0x2be84f;if(!_0x318868[_0xe364('0x46')][_0xe364('0x9f')]||!utils[_0xe364('0xb1')](_0x318868['query'][_0xe364('0x9f')])){throw new db['Sequelize'][(_0xe364('0x94'))](_0xe364('0xa2'));}return _0x2be84f[_0xe364('0xb2')+_[_0xe364('0xa9')](_0x318868[_0xe364('0x46')][_0xe364('0x9f')][_0xe364('0xa4')]())+_0xe364('0xa5')](_0x318868[_0xe364('0x46')][_0xe364('0x61')]);}})['then'](function(_0x3b455f){if(_['isArray'](_0x318868['query'][_0xe364('0x61')])){for(var _0x4be509=0x0;_0x4be509<_0x318868[_0xe364('0x46')][_0xe364('0x61')]['length'];_0x4be509+=0x1){_0x772483={'UserId':Number(_0x318868[_0xe364('0x57')]['id'])};_0x772483[_['capitalize'](_0x318868[_0xe364('0x46')][_0xe364('0x9f')][_0xe364('0xa4')]())+'QueueId']=Number(_0x318868[_0xe364('0x46')][_0xe364('0x61')][_0x4be509]);socket['emit'](_0xe364('0x2f')+_[_0xe364('0xa9')](_0x318868['query'][_0xe364('0x9f')][_0xe364('0xa4')]())+_0xe364('0xb3'),_0x772483);}}else{_0x772483={'UserId':Number(_0x318868[_0xe364('0x57')]['id'])};_0x772483[_[_0xe364('0xa9')](_0x318868['query'][_0xe364('0x9f')]['toLowerCase']())+_0xe364('0xa8')]=Number(_0x318868['query'][_0xe364('0x61')]);socket[_0xe364('0x2a')](_0xe364('0x2f')+_[_0xe364('0xa9')](_0x318868[_0xe364('0x46')][_0xe364('0x9f')]['toLowerCase']())+_0xe364('0xb3'),_0x772483);}return _0x3b455f;})[_0xe364('0x20')](function(){if(_0x318868[_0xe364('0x46')][_0xe364('0x9f')]===_0xe364('0xab')){return db['UserVoiceQueueRt'][_0xe364('0x2c')]({'where':{'UserId':_0x318868[_0xe364('0x57')]['id'],'VoiceQueueId':_0x318868[_0xe364('0x46')][_0xe364('0x61')]},'individualHooks':!![]})[_0xe364('0x20')](function(){return _0x2c6f20;});}return _0x2c6f20;})['then'](respondWithStatusCode(_0x46d69,null))[_0xe364('0x5f')](handleError(_0x46d69,null));};exports['addAvatar']=function(_0x29beb6,_0x5781b8){_0x29beb6[_0xe364('0x5d')][_0xe364('0xb4')]=_0x29beb6[_0xe364('0xb5')][_0xe364('0xb6')];return db[_0xe364('0x45')][_0xe364('0x37')]({'where':{'id':_0x29beb6[_0xe364('0x57')]['id']}})['then'](handleEntityNotFound(_0x5781b8,null))[_0xe364('0x20')](saveUpdates(_0x29beb6['body'],null))['then'](respondWithResult(_0x5781b8,null))[_0xe364('0x5f')](handleError(_0x5781b8,null));};exports['getAvatar']=function(_0x9dc6b0,_0x5168b6){var _0x424f2=path['join'](config[_0xe364('0xb7')],_0xe364('0xb8'));return db[_0xe364('0x45')][_0xe364('0x37')]({'where':{'id':_0x9dc6b0['params']['id']},'attributes':['id',_0xe364('0xb4')],'raw':!![]})[_0xe364('0x20')](handleEntityNotFound(_0x5168b6,null))['then'](function(_0x16ac65){if(_0x16ac65){if(_['isNil'](_0x16ac65['userpic'])){return _0x5168b6[_0xe364('0xb9')](_0x424f2);}else{if(!fs[_0xe364('0xba')](path['join'](config[_0xe364('0xb7')],'server/files/images/',_0x16ac65[_0xe364('0xb4')]))){return _0x5168b6[_0xe364('0xb9')](_0x424f2);}return _0x5168b6['download'](path[_0xe364('0xbb')](config[_0xe364('0xb7')],_0xe364('0xbc'),_0x16ac65['userpic']));}}})[_0xe364('0x5f')](handleError(_0x5168b6,null));};exports['getOpenTabs']=function(_0x9900a7,_0x59d56f){return db[_0xe364('0x45')][_0xe364('0x37')]({'where':{'id':_0x9900a7[_0xe364('0x57')]['id']},'attributes':['id']})[_0xe364('0x20')](handleEntityNotFound(_0x59d56f,null))[_0xe364('0x20')](function(_0x21b13e){var _0x48be17=[];values=_0x21b13e[_0xe364('0x52')];_0x48be17[_0xe364('0x4d')](get_open_tabs(_0xe364('0x51'),_0x21b13e[_0xe364('0x52')]));_0x48be17[_0xe364('0x4d')](get_open_tabs(_0xe364('0x53'),_0x21b13e[_0xe364('0x52')]));_0x48be17[_0xe364('0x4d')](get_open_tabs('openchannel',_0x21b13e[_0xe364('0x52')]));_0x48be17[_0xe364('0x4d')](get_open_tabs(_0xe364('0x5a'),_0x21b13e[_0xe364('0x52')]));_0x48be17[_0xe364('0x4d')](get_open_tabs(_0xe364('0x5b'),_0x21b13e['dataValues']));_0x48be17[_0xe364('0x4d')](get_open_tabs(_0xe364('0x54'),_0x21b13e[_0xe364('0x52')]));return Promise[_0xe364('0x8c')](_0x48be17);})[_0xe364('0x20')](function(_0x58f1da){if(_0x58f1da){var _0x5179d2=_[_0xe364('0x34')](values['ChatOpenTabs'],function(_0x3e3be5){return{'channel':_0xe364('0xbd'),'id':_0x3e3be5['id'],'createdAt':_0x3e3be5[_0xe364('0xbe')]};});var _0x53e7f5=_[_0xe364('0x34')](values['FaxOpenTabs'],function(_0x13a7a6){return{'channel':_0xe364('0xbf'),'id':_0x13a7a6['id'],'createdAt':_0x13a7a6['createdAt']};});var _0x4fcc2a=_[_0xe364('0x34')](values['OpenchannelOpenTabs'],function(_0x2827e6){return{'channel':'OPENCHANNEL','id':_0x2827e6['id'],'createdAt':_0x2827e6[_0xe364('0xbe')]};});var _0x3b1243=_[_0xe364('0x34')](values['MailOpenTabs'],function(_0xf93253){return{'channel':'MAIL','id':_0xf93253['id'],'createdAt':_0xf93253[_0xe364('0xbe')]};});var _0x35b4a0=_[_0xe364('0x34')](values['SmsOpenTabs'],function(_0x420c6f){return{'channel':_0xe364('0xc0'),'id':_0x420c6f['id'],'createdAt':_0x420c6f[_0xe364('0xbe')]};});var _0x4bfd63=_[_0xe364('0x34')](values['WhatsappOpenTabs'],function(_0x1e29b9){return{'channel':'WHATSAPP','id':_0x1e29b9['id'],'createdAt':_0x1e29b9['createdAt']};});var _0x2fa7cb=_[_0xe364('0xc1')](_0x5179d2,_0x53e7f5,_0x4fcc2a,_0x3b1243,_0x35b4a0,_0x4bfd63);var _0xed3822={'count':_0x2fa7cb[_0xe364('0x6d')],'rows':_0x2fa7cb};return _0xed3822;}else return null;})[_0xe364('0x20')](respondWithResult(_0x59d56f,null))[_0xe364('0x5f')](handleError(_0x59d56f,null));};exports[_0xe364('0xc2')]=function(_0x150c26,_0x8e260b){var _0x3a2094={};return db[_0xe364('0x45')]['findOne']({'where':{'id':_0x150c26[_0xe364('0x57')]['id']}})[_0xe364('0x20')](function(_0x42f3c1){if(!_0x42f3c1){throw new APINotFoundError(util[_0xe364('0xae')](_0xe364('0xc3'),_0x150c26[_0xe364('0x57')]['id']));}return contacts[_0xe364('0x5e')]();})['then'](function(_0x262538){_0x150c26[_0xe364('0x46')][_0xe364('0x45')]=_0x150c26['params']['id'];_0x3a2094=qs[_0xe364('0x43')](_0x262538,_0x150c26);if(_0x150c26[_0xe364('0x46')]['hasOwnProperty'](_0xe364('0x47'))){_0x3a2094[_0xe364('0x48')]=[{'model':db[_0xe364('0xc4')],'as':_0xe364('0xc5'),'required':![]},{'model':db['Tag'],'as':_0xe364('0xc6'),'attributes':['id',_0xe364('0x38'),_0xe364('0xc7')],'where':_0x150c26[_0xe364('0x46')][_0xe364('0xc8')]?{'id':_0x150c26[_0xe364('0x46')][_0xe364('0xc8')]}:undefined,'required':_0x150c26[_0xe364('0x46')][_0xe364('0xc8')]?!![]:![]}];}return contacts[_0xe364('0x4e')](_0x150c26[_0xe364('0x46')],_0x150c26[_0xe364('0x2f')],_0x3a2094,_0x262538);})[_0xe364('0x20')](respondWithFilteredResult(_0x8e260b,_0x3a2094))[_0xe364('0x5f')](APIHandleError(_0x8e260b));};exports['getQueues']=function(_0x3d1e4d,_0x1b1aa9){var _0xb2b0f1;var _0xb84f61={};var _0xb8b80c;return db['User'][_0xe364('0x99')]({'where':{'id':_0x3d1e4d[_0xe364('0x57')]['id']},'attributes':['id',_0xe364('0x38'),'role']})[_0xe364('0x20')](handleEntityNotFound(_0x1b1aa9,null))['then'](function(_0x1aa296){if(!utils[_0xe364('0xb1')](_0x3d1e4d[_0xe364('0x46')]['channel'])){throw new db['Sequelize']['ValidationError'](_0xe364('0xa2'));}_0xb2b0f1=_0x1aa296;var _0x30293f={};_0x30293f[_0xe364('0xc9')]=_[_0xe364('0xca')](db[_['capitalize'](_0x3d1e4d[_0xe364('0x46')][_0xe364('0x9f')])+_0xe364('0xcb')][_0xe364('0x3b')]);_0x30293f[_0xe364('0x46')]=_[_0xe364('0xca')](_0x3d1e4d[_0xe364('0x46')]);_0x30293f[_0xe364('0xcc')]=_[_0xe364('0xcd')](_0x30293f[_0xe364('0xc9')],_0x30293f['query']);_0xb84f61[_0xe364('0x4c')]=_[_0xe364('0xcd')](_0x30293f[_0xe364('0xc9')],qs[_0xe364('0xce')](_0x3d1e4d[_0xe364('0x46')]['fields']));_0xb84f61[_0xe364('0x4c')]=_0xb84f61[_0xe364('0x4c')][_0xe364('0x6d')]?_0xb84f61[_0xe364('0x4c')]:_0x30293f[_0xe364('0xc9')];_0xb84f61[_0xe364('0xcf')]=qs[_0xe364('0xd0')](_0x3d1e4d['query']['sort']);_0xb84f61[_0xe364('0x44')]=qs[_0xe364('0xcc')](_[_0xe364('0xd1')](_0x3d1e4d[_0xe364('0x46')],_0x30293f[_0xe364('0xcc')]));if(_0x3d1e4d['query'][_0xe364('0x32')]){_0xb84f61[_0xe364('0x44')]=_[_0xe364('0x58')](_0xb84f61[_0xe364('0x44')],{'$or':_['map'](_0xb84f61['attributes'],function(_0x3d8958){var _0xf8de00={};_0xf8de00[_0x3d8958]={'$like':'%'+_0x3d1e4d[_0xe364('0x46')][_0xe364('0x32')]+'%'};return _0xf8de00;})});}_0xb84f61=_[_0xe364('0x58')]({},_0xb84f61,_0x3d1e4d['options']);switch(_0xb2b0f1[_0xe364('0x28')]){case'admin':return db[_[_0xe364('0xa9')](_0x3d1e4d[_0xe364('0x46')][_0xe364('0x9f')])+_0xe364('0xcb')][_0xe364('0x4e')](_0xb84f61);case _0xe364('0x2f'):case _0xe364('0x29'):return _0xb2b0f1[_0xe364('0xad')+_[_0xe364('0xa9')](_0x3d1e4d['query'][_0xe364('0x9f')])+'Queues'](_0xb84f61);default:throw new db[(_0xe364('0x93'))][(_0xe364('0x94'))](_0xe364('0xd2'));}})[_0xe364('0x20')](function(_0xb12e15){_0xb8b80c=_0xb12e15[_0xe364('0x6d')];if(!_0x3d1e4d[_0xe364('0x46')]['hasOwnProperty'](_0xe364('0xd3'))){_0xb84f61['limit']=qs['limit'](_0x3d1e4d[_0xe364('0x46')][_0xe364('0x1b')]);_0xb84f61[_0xe364('0x19')]=qs['offset'](_0x3d1e4d[_0xe364('0x46')]['offset']);}switch(_0xb2b0f1['role']){case _0xe364('0x2d'):return db[_[_0xe364('0xa9')](_0x3d1e4d[_0xe364('0x46')][_0xe364('0x9f')])+_0xe364('0xcb')][_0xe364('0x4e')](_0xb84f61);case _0xe364('0x2f'):case _0xe364('0x29'):return _0xb2b0f1[_0xe364('0xad')+_[_0xe364('0xa9')](_0x3d1e4d['query'][_0xe364('0x9f')])+'Queues'](_0xb84f61);}})[_0xe364('0x20')](function(_0x2bb921){return{'count':_0xb8b80c,'rows':_0x2bb921};})[_0xe364('0x20')](respondWithResult(_0x1b1aa9,null))[_0xe364('0x5f')](handleError(_0x1b1aa9,null));};exports[_0xe364('0xd4')]=function(_0x13372b,_0x4a2bbe){var _0x417150={};var _0x478554={};var _0x24cf8c;var _0x32d05e;return db[_0xe364('0x45')]['findOne']({'where':{'id':_0x13372b[_0xe364('0x57')]['id']}})['then'](handleEntityNotFound(_0x4a2bbe,null))[_0xe364('0x20')](function(_0x4cf5d9){if(_0x4cf5d9){_0x24cf8c=_0x4cf5d9;_0x478554[_0xe364('0xc9')]=_[_0xe364('0xca')](db[_0xe364('0xd5')][_0xe364('0x3b')]);_0x478554[_0xe364('0x46')]=_[_0xe364('0xca')](_0x13372b['query']);_0x478554[_0xe364('0xcc')]=_[_0xe364('0xcd')](_0x478554['model'],_0x478554[_0xe364('0x46')]);_0x417150[_0xe364('0x4c')]=_[_0xe364('0xcd')](_0x478554['model'],qs[_0xe364('0xce')](_0x13372b[_0xe364('0x46')][_0xe364('0xce')]));_0x417150['attributes']=_0x417150['attributes'][_0xe364('0x6d')]?_0x417150[_0xe364('0x4c')]:_0x478554['model'];_0x417150[_0xe364('0xcf')]=qs[_0xe364('0xd0')](_0x13372b['query'][_0xe364('0xd0')]);_0x417150['where']=qs[_0xe364('0xcc')](_[_0xe364('0xd1')](_0x13372b[_0xe364('0x46')],_0x478554['filters']));if(_0x13372b[_0xe364('0x46')][_0xe364('0x32')]){_0x417150[_0xe364('0x44')]=_['merge'](_0x417150[_0xe364('0x44')],{'$or':_[_0xe364('0x34')](_0x417150[_0xe364('0x4c')],function(_0x823f6){var _0xedd558={};_0xedd558[_0x823f6]={'$like':'%'+_0x13372b[_0xe364('0x46')][_0xe364('0x32')]+'%'};return _0xedd558;})});}_0x417150=_[_0xe364('0x58')]({},_0x417150,_0x13372b[_0xe364('0x59')]);return _0x24cf8c[_0xe364('0xd4')](_0x417150);}})[_0xe364('0x20')](function(_0x598ba1){if(_0x598ba1){_0x32d05e=_0x598ba1[_0xe364('0x6d')];if(!_0x13372b[_0xe364('0x46')][_0xe364('0xd6')](_0xe364('0xd3'))){_0x417150['limit']=qs[_0xe364('0x1b')](_0x13372b[_0xe364('0x46')][_0xe364('0x1b')]);_0x417150[_0xe364('0x19')]=qs[_0xe364('0x19')](_0x13372b[_0xe364('0x46')][_0xe364('0x19')]);}return _0x24cf8c['getVoiceQueuesRt'](_0x417150);}})[_0xe364('0x20')](function(_0x209083){if(_0x209083){return _0x209083?{'count':_0x32d05e,'rows':_0x209083}:null;}})[_0xe364('0x20')](respondWithResult(_0x4a2bbe,null))[_0xe364('0x5f')](handleError(_0x4a2bbe,null));};exports[_0xe364('0xd7')]=function(_0x350479,_0x51c51e){var _0x27a0fb={};var _0xc4e3ef={};var _0x1feb0e;var _0x4ec0fa;return db[_0xe364('0x45')]['findOne']({'where':{'id':_0x350479[_0xe364('0x57')]['id']}})[_0xe364('0x20')](handleEntityNotFound(_0x51c51e,null))[_0xe364('0x20')](function(_0x421c0d){if(_0x421c0d){_0x1feb0e=_0x421c0d;_0xc4e3ef[_0xe364('0xc9')]=_[_0xe364('0xca')](db[_0xe364('0xd8')][_0xe364('0x3b')]);_0xc4e3ef[_0xe364('0x46')]=_[_0xe364('0xca')](_0x350479[_0xe364('0x46')]);_0xc4e3ef['filters']=_[_0xe364('0xcd')](_0xc4e3ef[_0xe364('0xc9')],_0xc4e3ef[_0xe364('0x46')]);_0x27a0fb['attributes']=_[_0xe364('0xcd')](_0xc4e3ef[_0xe364('0xc9')],qs[_0xe364('0xce')](_0x350479[_0xe364('0x46')][_0xe364('0xce')]));_0x27a0fb[_0xe364('0x4c')]=_0x27a0fb[_0xe364('0x4c')][_0xe364('0x6d')]?_0x27a0fb['attributes']:_0xc4e3ef['model'];_0x27a0fb[_0xe364('0xcf')]=qs[_0xe364('0xd0')](_0x350479[_0xe364('0x46')][_0xe364('0xd0')]);_0x27a0fb[_0xe364('0x44')]=qs['filters'](_[_0xe364('0xd1')](_0x350479[_0xe364('0x46')],_0xc4e3ef[_0xe364('0xcc')]));if(_0x350479[_0xe364('0x46')][_0xe364('0x32')]){_0x27a0fb[_0xe364('0x44')]=_[_0xe364('0x58')](_0x27a0fb[_0xe364('0x44')],{'$or':_[_0xe364('0x34')](_0x27a0fb[_0xe364('0x4c')],function(_0x3712c7){var _0x339bfd={};_0x339bfd[_0x3712c7]={'$like':'%'+_0x350479[_0xe364('0x46')]['filter']+'%'};return _0x339bfd;})});}_0x27a0fb=_[_0xe364('0x58')]({},_0x27a0fb,_0x350479[_0xe364('0x59')]);return _0x1feb0e[_0xe364('0xd7')](_0x27a0fb);}})[_0xe364('0x20')](function(_0x5c1048){if(_0x5c1048){_0x4ec0fa=_0x5c1048[_0xe364('0x6d')];if(!_0x350479['query'][_0xe364('0xd6')](_0xe364('0xd3'))){_0x27a0fb[_0xe364('0x1b')]=qs['limit'](_0x350479[_0xe364('0x46')][_0xe364('0x1b')]);_0x27a0fb['offset']=qs[_0xe364('0x19')](_0x350479[_0xe364('0x46')]['offset']);}return _0x1feb0e[_0xe364('0xd7')](_0x27a0fb);}})[_0xe364('0x20')](function(_0x3972e4){if(_0x3972e4){return _0x3972e4?{'count':_0x4ec0fa,'rows':_0x3972e4}:null;}})['then'](respondWithResult(_0x51c51e,null))['catch'](handleError(_0x51c51e,null));};exports[_0xe364('0xd9')]=function(_0x3eac6f,_0x5d9b63){var _0x1d657b={'raw':!![],'where':{}};var _0x63ae4e={};var _0x1ca5a2={'count':0x0,'rows':[]};return db[_0xe364('0x45')][_0xe364('0x99')]({'where':{'id':_0x3eac6f[_0xe364('0x57')]['id']}})[_0xe364('0x20')](handleEntityNotFound(_0x5d9b63,null))[_0xe364('0x20')](function(_0x3c344a){if(_0x3c344a){_0x63ae4e[_0xe364('0xc9')]=_[_0xe364('0xca')](db[_0xe364('0xda')][_0xe364('0x3b')]);_0x63ae4e['query']=_['keys'](_0x3eac6f['query']);_0x63ae4e['filters']=_[_0xe364('0xcd')](_0x63ae4e[_0xe364('0xc9')],_0x63ae4e[_0xe364('0x46')]);_0x1d657b[_0xe364('0x4c')]=_[_0xe364('0xcd')](_0x63ae4e[_0xe364('0xc9')],qs[_0xe364('0xce')](_0x3eac6f[_0xe364('0x46')]['fields']));_0x1d657b[_0xe364('0x4c')]=_0x1d657b[_0xe364('0x4c')][_0xe364('0x6d')]?_0x1d657b['attributes']:_0x63ae4e['model'];if(!_0x3eac6f['query'][_0xe364('0xd6')](_0xe364('0xd3'))){_0x1d657b[_0xe364('0x1b')]=qs[_0xe364('0x1b')](_0x3eac6f['query'][_0xe364('0x1b')]);_0x1d657b['offset']=qs[_0xe364('0x19')](_0x3eac6f[_0xe364('0x46')][_0xe364('0x19')]);}_0x1d657b[_0xe364('0xcf')]=qs[_0xe364('0xd0')](_0x3eac6f['query'][_0xe364('0xd0')]);_0x1d657b[_0xe364('0x44')]=qs[_0xe364('0xcc')](_[_0xe364('0xd1')](_0x3eac6f[_0xe364('0x46')],_0x63ae4e[_0xe364('0xcc')]));_0x1d657b[_0xe364('0x44')][_0xe364('0xdb')]=_0x3c344a['id'];if(_0x3eac6f[_0xe364('0x46')][_0xe364('0x32')]){_0x1d657b[_0xe364('0x44')]=_[_0xe364('0x58')](_0x1d657b[_0xe364('0x44')],{'$or':_[_0xe364('0x34')](_0x1d657b[_0xe364('0x4c')],function(_0x122491){var _0x24fd9c={};_0x24fd9c[_0x122491]={'$like':'%'+_0x3eac6f[_0xe364('0x46')][_0xe364('0x32')]+'%'};return _0x24fd9c;})});}_0x1d657b=_['merge']({},_0x1d657b,_0x3eac6f[_0xe364('0x59')]);return db[_0xe364('0xda')][_0xe364('0x1c')]({'where':_0x1d657b[_0xe364('0x44')]})[_0xe364('0x20')](function(_0x494a9b){_0x1ca5a2[_0xe364('0x1c')]=_0x494a9b;if(_0x3eac6f[_0xe364('0x46')][_0xe364('0x47')]){_0x1d657b[_0xe364('0x48')]=[{'all':!![]}];}return db[_0xe364('0xda')]['findAll'](_0x1d657b);})['then'](function(_0x2e7f2f){_0x1ca5a2['rows']=_0x2e7f2f;return _0x1ca5a2;});}})[_0xe364('0x20')](respondWithFilteredResult(_0x5d9b63,_0x1d657b))[_0xe364('0x5f')](handleError(_0x5d9b63,null));};exports['getScreenRecordings']=function(_0x2ede06,_0x1072be){var _0x3cfd11={'raw':!![],'where':{}};var _0x293410={};var _0x332a2b={'count':0x0,'rows':[]};return db['User'][_0xe364('0x99')]({'where':{'id':_0x2ede06[_0xe364('0x57')]['id']}})['then'](handleEntityNotFound(_0x1072be,null))['then'](function(_0x38e1b2){if(_0x38e1b2){_0x293410[_0xe364('0xc9')]=_[_0xe364('0xca')](db[_0xe364('0xdc')]['rawAttributes']);_0x293410[_0xe364('0x46')]=_['keys'](_0x2ede06[_0xe364('0x46')]);_0x293410[_0xe364('0xcc')]=_['intersection'](_0x293410[_0xe364('0xc9')],_0x293410['query']);_0x3cfd11['attributes']=_[_0xe364('0xcd')](_0x293410[_0xe364('0xc9')],qs[_0xe364('0xce')](_0x2ede06[_0xe364('0x46')][_0xe364('0xce')]));_0x3cfd11[_0xe364('0x4c')]=_0x3cfd11[_0xe364('0x4c')][_0xe364('0x6d')]?_0x3cfd11[_0xe364('0x4c')]:_0x293410['model'];if(!_0x2ede06[_0xe364('0x46')][_0xe364('0xd6')](_0xe364('0xd3'))){_0x3cfd11['limit']=qs['limit'](_0x2ede06['query'][_0xe364('0x1b')]);_0x3cfd11[_0xe364('0x19')]=qs[_0xe364('0x19')](_0x2ede06[_0xe364('0x46')]['offset']);}_0x3cfd11['order']=qs[_0xe364('0xd0')](_0x2ede06['query'][_0xe364('0xd0')]);_0x3cfd11['where']=qs[_0xe364('0xcc')](_[_0xe364('0xd1')](_0x2ede06['query'],_0x293410[_0xe364('0xcc')]));_0x3cfd11[_0xe364('0x44')][_0xe364('0xdb')]=_0x38e1b2['id'];if(_0x2ede06[_0xe364('0x46')]['filter']){_0x3cfd11[_0xe364('0x44')]=_[_0xe364('0x58')](_0x3cfd11[_0xe364('0x44')],{'$or':_[_0xe364('0x34')](_0x3cfd11[_0xe364('0x4c')],function(_0x17525d){var _0x5069d5={};_0x5069d5[_0x17525d]={'$like':'%'+_0x2ede06[_0xe364('0x46')][_0xe364('0x32')]+'%'};return _0x5069d5;})});}_0x3cfd11=_[_0xe364('0x58')]({},_0x3cfd11,_0x2ede06[_0xe364('0x59')]);return db[_0xe364('0xdc')][_0xe364('0x1c')]({'where':_0x3cfd11[_0xe364('0x44')]})[_0xe364('0x20')](function(_0x2cd57e){_0x332a2b[_0xe364('0x1c')]=_0x2cd57e;if(_0x2ede06[_0xe364('0x46')][_0xe364('0x47')]){_0x3cfd11[_0xe364('0x48')]=[{'all':!![]}];}return db[_0xe364('0xdc')]['findAll'](_0x3cfd11);})[_0xe364('0x20')](function(_0x362d57){_0x332a2b[_0xe364('0x4f')]=_0x362d57;return _0x332a2b;});}})['then'](respondWithFilteredResult(_0x1072be,_0x3cfd11))[_0xe364('0x5f')](handleError(_0x1072be,null));};exports[_0xe364('0xdd')]=function(_0x3b577d,_0x2cfc75){var _0x65990d={};var _0x5e2ee1={};var _0x3e6ada;var _0x2cb1fb;return db[_0xe364('0x45')][_0xe364('0x99')]({'where':{'id':_0x3b577d['params']['id']}})[_0xe364('0x20')](handleEntityNotFound(_0x2cfc75,null))[_0xe364('0x20')](function(_0x3fa073){if(_0x3fa073){_0x3e6ada=_0x3fa073;_0x5e2ee1[_0xe364('0xc9')]=_[_0xe364('0xca')](db[_0xe364('0xde')]['rawAttributes']);_0x5e2ee1['query']=_[_0xe364('0xca')](_0x3b577d['query']);_0x5e2ee1[_0xe364('0xcc')]=_['intersection'](_0x5e2ee1[_0xe364('0xc9')],_0x5e2ee1['query']);_0x65990d[_0xe364('0x4c')]=_[_0xe364('0xcd')](_0x5e2ee1[_0xe364('0xc9')],qs[_0xe364('0xce')](_0x3b577d[_0xe364('0x46')][_0xe364('0xce')]));_0x65990d[_0xe364('0x4c')]=_0x65990d['attributes'][_0xe364('0x6d')]?_0x65990d[_0xe364('0x4c')]:_0x5e2ee1[_0xe364('0xc9')];_0x65990d['order']=qs[_0xe364('0xd0')](_0x3b577d[_0xe364('0x46')][_0xe364('0xd0')]);_0x65990d['where']=qs[_0xe364('0xcc')](_[_0xe364('0xd1')](_0x3b577d[_0xe364('0x46')],_0x5e2ee1[_0xe364('0xcc')]));if(_0x3b577d['query'][_0xe364('0x32')]){_0x65990d['where']=_[_0xe364('0x58')](_0x65990d['where'],{'$or':_[_0xe364('0x34')](_0x65990d[_0xe364('0x4c')],function(_0x5eba85){var _0x56f9cc={};_0x56f9cc[_0x5eba85]={'$like':'%'+_0x3b577d[_0xe364('0x46')][_0xe364('0x32')]+'%'};return _0x56f9cc;})});}_0x65990d=_[_0xe364('0x58')]({},_0x65990d,_0x3b577d[_0xe364('0x59')]);return _0x3e6ada[_0xe364('0xdd')](_0x65990d);}})['then'](function(_0x5e1b9a){if(_0x5e1b9a){_0x2cb1fb=_0x5e1b9a[_0xe364('0x6d')];if(!_0x3b577d[_0xe364('0x46')][_0xe364('0xd6')](_0xe364('0xd3'))){_0x65990d[_0xe364('0x1b')]=qs[_0xe364('0x1b')](_0x3b577d['query'][_0xe364('0x1b')]);_0x65990d[_0xe364('0x19')]=qs['offset'](_0x3b577d['query']['offset']);}return _0x3e6ada[_0xe364('0xdd')](_0x65990d);}})['then'](function(_0x2c0ada){if(_0x2c0ada){return _0x2c0ada?{'count':_0x2cb1fb,'rows':_0x2c0ada}:null;}})[_0xe364('0x20')](respondWithResult(_0x2cfc75,null))[_0xe364('0x5f')](handleError(_0x2cfc75,null));};exports[_0xe364('0xdf')]=function(_0x3422f5,_0x1b657e){var _0x5878fe={};var _0xa97a35={};var _0x19bd13;var _0x19dfd1;return db[_0xe364('0x45')][_0xe364('0x99')]({'where':{'id':_0x3422f5[_0xe364('0x57')]['id']}})['then'](handleEntityNotFound(_0x1b657e,null))[_0xe364('0x20')](function(_0x1ac5f3){if(_0x1ac5f3){_0x19bd13=_0x1ac5f3;_0xa97a35[_0xe364('0xc9')]=_[_0xe364('0xca')](db[_0xe364('0xe0')][_0xe364('0x3b')]);_0xa97a35['query']=_[_0xe364('0xca')](_0x3422f5[_0xe364('0x46')]);_0xa97a35[_0xe364('0xcc')]=_[_0xe364('0xcd')](_0xa97a35['model'],_0xa97a35[_0xe364('0x46')]);_0x5878fe[_0xe364('0x4c')]=_[_0xe364('0xcd')](_0xa97a35[_0xe364('0xc9')],qs['fields'](_0x3422f5[_0xe364('0x46')][_0xe364('0xce')]));_0x5878fe[_0xe364('0x4c')]=_0x5878fe[_0xe364('0x4c')][_0xe364('0x6d')]?_0x5878fe['attributes']:_0xa97a35[_0xe364('0xc9')];_0x5878fe[_0xe364('0xcf')]=qs[_0xe364('0xd0')](_0x3422f5[_0xe364('0x46')]['sort']);_0x5878fe[_0xe364('0x44')]=qs[_0xe364('0xcc')](_[_0xe364('0xd1')](_0x3422f5[_0xe364('0x46')],_0xa97a35[_0xe364('0xcc')]));if(_0x3422f5[_0xe364('0x46')][_0xe364('0x32')]){_0x5878fe['where']=_[_0xe364('0x58')](_0x5878fe[_0xe364('0x44')],{'$or':_[_0xe364('0x34')](_0x5878fe[_0xe364('0x4c')],function(_0x389ffd){var _0x37b97c={};_0x37b97c[_0x389ffd]={'$like':'%'+_0x3422f5[_0xe364('0x46')][_0xe364('0x32')]+'%'};return _0x37b97c;})});}_0x5878fe=_[_0xe364('0x58')]({},_0x5878fe,_0x3422f5['options']);return _0x19bd13[_0xe364('0xdf')](_0x5878fe);}})[_0xe364('0x20')](function(_0x118b0e){if(_0x118b0e){_0x19dfd1=_0x118b0e['length'];if(!_0x3422f5[_0xe364('0x46')][_0xe364('0xd6')](_0xe364('0xd3'))){_0x5878fe[_0xe364('0x1b')]=qs[_0xe364('0x1b')](_0x3422f5[_0xe364('0x46')][_0xe364('0x1b')]);_0x5878fe[_0xe364('0x19')]=qs[_0xe364('0x19')](_0x3422f5[_0xe364('0x46')][_0xe364('0x19')]);}return _0x19bd13['getOpenchannelInteractions'](_0x5878fe);}})[_0xe364('0x20')](function(_0x26d4d0){if(_0x26d4d0){return _0x26d4d0?{'count':_0x19dfd1,'rows':_0x26d4d0}:null;}})[_0xe364('0x20')](respondWithResult(_0x1b657e,null))[_0xe364('0x5f')](handleError(_0x1b657e,null));};exports['getMailInteractions']=function(_0x515d61,_0x534af1){var _0x45b790={'raw':!![],'where':{}};var _0x3542d5={};var _0x1ba4ec={'count':0x0,'rows':[]};return db[_0xe364('0x45')][_0xe364('0x99')]({'where':{'id':_0x515d61[_0xe364('0x57')]['id']}})[_0xe364('0x20')](handleEntityNotFound(_0x534af1,null))[_0xe364('0x20')](function(_0x19e130){if(_0x19e130){_0x3542d5[_0xe364('0xc9')]=_[_0xe364('0xca')](db['MailInteraction'][_0xe364('0x3b')]);_0x3542d5[_0xe364('0x46')]=_[_0xe364('0xca')](_0x515d61[_0xe364('0x46')]);_0x3542d5[_0xe364('0xcc')]=_['intersection'](_0x3542d5[_0xe364('0xc9')],_0x3542d5[_0xe364('0x46')]);_0x45b790['attributes']=_['intersection'](_0x3542d5[_0xe364('0xc9')],qs[_0xe364('0xce')](_0x515d61['query'][_0xe364('0xce')]));_0x45b790[_0xe364('0x4c')]=_0x45b790[_0xe364('0x4c')]['length']?_0x45b790[_0xe364('0x4c')]:_0x3542d5['model'];if(!_0x515d61[_0xe364('0x46')][_0xe364('0xd6')](_0xe364('0xd3'))){_0x45b790['limit']=qs[_0xe364('0x1b')](_0x515d61[_0xe364('0x46')][_0xe364('0x1b')]);_0x45b790[_0xe364('0x19')]=qs[_0xe364('0x19')](_0x515d61[_0xe364('0x46')]['offset']);}_0x45b790['order']=qs[_0xe364('0xd0')](_0x515d61[_0xe364('0x46')]['sort']);_0x45b790[_0xe364('0x44')]=qs['filters'](_[_0xe364('0xd1')](_0x515d61[_0xe364('0x46')],_0x3542d5[_0xe364('0xcc')]));_0x45b790[_0xe364('0x44')]['UserId']=_0x19e130['id'];if(_0x515d61[_0xe364('0x46')][_0xe364('0x32')]){_0x45b790[_0xe364('0x44')]=_[_0xe364('0x58')](_0x45b790['where'],{'$or':_[_0xe364('0x34')](_0x45b790[_0xe364('0x4c')],function(_0x14e3a1){var _0x3881ef={};_0x3881ef[_0x14e3a1]={'$like':'%'+_0x515d61[_0xe364('0x46')][_0xe364('0x32')]+'%'};return _0x3881ef;})});}_0x45b790=_[_0xe364('0x58')]({},_0x45b790,_0x515d61['options']);return db[_0xe364('0xe1')][_0xe364('0x1c')]({'where':_0x45b790[_0xe364('0x44')]})[_0xe364('0x20')](function(_0x5960b7){_0x1ba4ec[_0xe364('0x1c')]=_0x5960b7;if(_0x515d61[_0xe364('0x46')][_0xe364('0x47')]){_0x45b790['include']=[{'all':!![]}];}return db['MailInteraction'][_0xe364('0x4e')](_0x45b790);})['then'](function(_0x3f8331){_0x1ba4ec['rows']=_0x3f8331;return _0x1ba4ec;});}})['then'](respondWithFilteredResult(_0x534af1,_0x45b790))[_0xe364('0x5f')](handleError(_0x534af1,null));};exports['getSmsInteractions']=function(_0x3e4a86,_0x35f2fd){var _0xd46625={};var _0x33a257={};var _0x101333;var _0x41af12;return db[_0xe364('0x45')][_0xe364('0x99')]({'where':{'id':_0x3e4a86[_0xe364('0x57')]['id']}})['then'](handleEntityNotFound(_0x35f2fd,null))[_0xe364('0x20')](function(_0x5d4753){if(_0x5d4753){_0x101333=_0x5d4753;_0x33a257['model']=_[_0xe364('0xca')](db[_0xe364('0xe2')]['rawAttributes']);_0x33a257[_0xe364('0x46')]=_['keys'](_0x3e4a86[_0xe364('0x46')]);_0x33a257[_0xe364('0xcc')]=_[_0xe364('0xcd')](_0x33a257[_0xe364('0xc9')],_0x33a257[_0xe364('0x46')]);_0xd46625[_0xe364('0x4c')]=_[_0xe364('0xcd')](_0x33a257[_0xe364('0xc9')],qs['fields'](_0x3e4a86['query']['fields']));_0xd46625[_0xe364('0x4c')]=_0xd46625[_0xe364('0x4c')][_0xe364('0x6d')]?_0xd46625[_0xe364('0x4c')]:_0x33a257[_0xe364('0xc9')];_0xd46625['order']=qs['sort'](_0x3e4a86['query']['sort']);_0xd46625[_0xe364('0x44')]=qs[_0xe364('0xcc')](_[_0xe364('0xd1')](_0x3e4a86[_0xe364('0x46')],_0x33a257[_0xe364('0xcc')]));if(_0x3e4a86[_0xe364('0x46')][_0xe364('0x32')]){_0xd46625['where']=_[_0xe364('0x58')](_0xd46625[_0xe364('0x44')],{'$or':_[_0xe364('0x34')](_0xd46625[_0xe364('0x4c')],function(_0x3623e9){var _0x94f5f7={};_0x94f5f7[_0x3623e9]={'$like':'%'+_0x3e4a86[_0xe364('0x46')][_0xe364('0x32')]+'%'};return _0x94f5f7;})});}_0xd46625=_[_0xe364('0x58')]({},_0xd46625,_0x3e4a86['options']);return _0x101333[_0xe364('0xe3')](_0xd46625);}})[_0xe364('0x20')](function(_0x34d6de){if(_0x34d6de){_0x41af12=_0x34d6de[_0xe364('0x6d')];if(!_0x3e4a86[_0xe364('0x46')][_0xe364('0xd6')](_0xe364('0xd3'))){_0xd46625['limit']=qs['limit'](_0x3e4a86['query'][_0xe364('0x1b')]);_0xd46625[_0xe364('0x19')]=qs[_0xe364('0x19')](_0x3e4a86[_0xe364('0x46')][_0xe364('0x19')]);}return _0x101333['getSmsInteractions'](_0xd46625);}})[_0xe364('0x20')](function(_0x31e95b){if(_0x31e95b){return _0x31e95b?{'count':_0x41af12,'rows':_0x31e95b}:null;}})[_0xe364('0x20')](respondWithResult(_0x35f2fd,null))[_0xe364('0x5f')](handleError(_0x35f2fd,null));};exports[_0xe364('0xe4')]=function(_0x3d425e,_0x1e9fb8){var _0x515d19={};var _0x1f1821={};var _0x7affb;var _0x225837;return db[_0xe364('0x45')]['findOne']({'where':{'id':_0x3d425e[_0xe364('0x57')]['id']}})[_0xe364('0x20')](handleEntityNotFound(_0x1e9fb8,null))[_0xe364('0x20')](function(_0x5823ba){if(_0x5823ba){_0x7affb=_0x5823ba;_0x1f1821[_0xe364('0xc9')]=_['keys'](db[_0xe364('0xe5')][_0xe364('0x3b')]);_0x1f1821[_0xe364('0x46')]=_[_0xe364('0xca')](_0x3d425e[_0xe364('0x46')]);_0x1f1821[_0xe364('0xcc')]=_[_0xe364('0xcd')](_0x1f1821[_0xe364('0xc9')],_0x1f1821['query']);_0x515d19[_0xe364('0x4c')]=_[_0xe364('0xcd')](_0x1f1821[_0xe364('0xc9')],qs[_0xe364('0xce')](_0x3d425e['query'][_0xe364('0xce')]));_0x515d19[_0xe364('0x4c')]=_0x515d19['attributes'][_0xe364('0x6d')]?_0x515d19[_0xe364('0x4c')]:_0x1f1821[_0xe364('0xc9')];_0x515d19['order']=qs[_0xe364('0xd0')](_0x3d425e['query'][_0xe364('0xd0')]);_0x515d19[_0xe364('0x44')]=qs[_0xe364('0xcc')](_[_0xe364('0xd1')](_0x3d425e[_0xe364('0x46')],_0x1f1821[_0xe364('0xcc')]));if(_0x3d425e['query'][_0xe364('0x32')]){_0x515d19[_0xe364('0x44')]=_[_0xe364('0x58')](_0x515d19[_0xe364('0x44')],{'$or':_[_0xe364('0x34')](_0x515d19['attributes'],function(_0x31d6ad){var _0x463e8a={};_0x463e8a[_0x31d6ad]={'$like':'%'+_0x3d425e[_0xe364('0x46')][_0xe364('0x32')]+'%'};return _0x463e8a;})});}_0x515d19=_[_0xe364('0x58')]({},_0x515d19,_0x3d425e['options']);return _0x7affb[_0xe364('0xe4')](_0x515d19);}})[_0xe364('0x20')](function(_0x551022){if(_0x551022){_0x225837=_0x551022[_0xe364('0x6d')];if(!_0x3d425e[_0xe364('0x46')]['hasOwnProperty']('nolimit')){_0x515d19['limit']=qs[_0xe364('0x1b')](_0x3d425e['query'][_0xe364('0x1b')]);_0x515d19[_0xe364('0x19')]=qs[_0xe364('0x19')](_0x3d425e[_0xe364('0x46')]['offset']);}return _0x7affb[_0xe364('0xe4')](_0x515d19);}})[_0xe364('0x20')](function(_0x2dccf4){if(_0x2dccf4){return _0x2dccf4?{'count':_0x225837,'rows':_0x2dccf4}:null;}})[_0xe364('0x20')](respondWithResult(_0x1e9fb8,null))[_0xe364('0x5f')](handleError(_0x1e9fb8,null));};exports['getWhatsappInteractions']=function(_0x5cc7d0,_0x1c46fa){var _0x721b67={};var _0xb57cf6={};var _0x258f5d;var _0x318cac;return db['User'][_0xe364('0x99')]({'where':{'id':_0x5cc7d0[_0xe364('0x57')]['id']}})[_0xe364('0x20')](handleEntityNotFound(_0x1c46fa,null))[_0xe364('0x20')](function(_0x51bb67){if(_0x51bb67){_0x258f5d=_0x51bb67;_0xb57cf6[_0xe364('0xc9')]=_['keys'](db[_0xe364('0xe6')][_0xe364('0x3b')]);_0xb57cf6['query']=_['keys'](_0x5cc7d0['query']);_0xb57cf6[_0xe364('0xcc')]=_[_0xe364('0xcd')](_0xb57cf6['model'],_0xb57cf6[_0xe364('0x46')]);_0x721b67['attributes']=_[_0xe364('0xcd')](_0xb57cf6[_0xe364('0xc9')],qs[_0xe364('0xce')](_0x5cc7d0[_0xe364('0x46')][_0xe364('0xce')]));_0x721b67[_0xe364('0x4c')]=_0x721b67[_0xe364('0x4c')][_0xe364('0x6d')]?_0x721b67[_0xe364('0x4c')]:_0xb57cf6['model'];_0x721b67[_0xe364('0xcf')]=qs[_0xe364('0xd0')](_0x5cc7d0[_0xe364('0x46')][_0xe364('0xd0')]);_0x721b67[_0xe364('0x44')]=qs[_0xe364('0xcc')](_[_0xe364('0xd1')](_0x5cc7d0[_0xe364('0x46')],_0xb57cf6[_0xe364('0xcc')]));if(_0x5cc7d0[_0xe364('0x46')]['filter']){_0x721b67[_0xe364('0x44')]=_[_0xe364('0x58')](_0x721b67[_0xe364('0x44')],{'$or':_[_0xe364('0x34')](_0x721b67[_0xe364('0x4c')],function(_0x425edc){var _0x32db34={};_0x32db34[_0x425edc]={'$like':'%'+_0x5cc7d0[_0xe364('0x46')][_0xe364('0x32')]+'%'};return _0x32db34;})});}_0x721b67=_[_0xe364('0x58')]({},_0x721b67,_0x5cc7d0['options']);return _0x258f5d[_0xe364('0xe7')](_0x721b67);}})[_0xe364('0x20')](function(_0x2f66f9){if(_0x2f66f9){_0x318cac=_0x2f66f9['length'];if(!_0x5cc7d0[_0xe364('0x46')]['hasOwnProperty'](_0xe364('0xd3'))){_0x721b67[_0xe364('0x1b')]=qs[_0xe364('0x1b')](_0x5cc7d0['query'][_0xe364('0x1b')]);_0x721b67[_0xe364('0x19')]=qs[_0xe364('0x19')](_0x5cc7d0[_0xe364('0x46')]['offset']);}return _0x258f5d['getWhatsappInteractions'](_0x721b67);}})[_0xe364('0x20')](function(_0x5196f5){if(_0x5196f5){return _0x5196f5?{'count':_0x318cac,'rows':_0x5196f5}:null;}})[_0xe364('0x20')](respondWithResult(_0x1c46fa,null))[_0xe364('0x5f')](handleError(_0x1c46fa,null));};exports['login']=function(_0x3ecbcb,_0x594dd8,_0x3e5b15){var _0x24ff88;var _0x436512;var _0x4e8877;var _0x5ad694=!_[_0xe364('0x67')](_0x3ecbcb['params']['id'])?_0x3ecbcb[_0xe364('0x57')]['id']:!_[_0xe364('0x67')](_0x3ecbcb['user']['id'])?_0x3ecbcb[_0xe364('0x2f')]['id']:null;return db[_0xe364('0x45')][_0xe364('0x37')]({'where':{'id':_0x5ad694,'role':{'$or':[_0xe364('0x2d'),'user','agent']}},'attributes':['id','name',_0xe364('0xe8'),_0xe364('0xe9'),_0xe364('0x28'),_0xe364('0x62'),_0xe364('0xea')]})[_0xe364('0x20')](function(_0x369be4){if(_0x369be4){if(_0x369be4[_0xe364('0x28')]==='agent'){_0x24ff88=_0x369be4;if(_0x3ecbcb[_0xe364('0x5d')][_0xe364('0xa1')]){_0x4e8877=util[_0xe364('0xae')](_0xe364('0xeb'),_0x24ff88[_0x3ecbcb['body'][_0xe364('0xa1')]]);}else if(_0x3ecbcb['body'][_0xe364('0xec')]){_0x4e8877=util['format']('SIP/%s',_0x3ecbcb[_0xe364('0x5d')][_0xe364('0xec')]);}else{_0x4e8877=util['format'](_0xe364('0xaf'),_0x24ff88[_0xe364('0x38')]);}socket['to'](util[_0xe364('0xae')]('user:%s',_0x24ff88[_0xe364('0x38')]))['emit'](_0xe364('0xed'),{'user':{'id':_0x24ff88['id'],'name':_0x24ff88[_0xe364('0x38')]},'ip':_0x3ecbcb['headers'][_0xe364('0xee')]||_0x3ecbcb[_0xe364('0xef')][_0xe364('0xf0')]||_0x3ecbcb[_0xe364('0xf1')][_0xe364('0xf0')]||_0x3ecbcb[_0xe364('0xef')][_0xe364('0xf1')][_0xe364('0xf0')]});return db[_0xe364('0xd5')][_0xe364('0x2c')]({'where':{'membername':_0x24ff88[_0xe364('0x38')]},'individualHooks':!![]});}}else{throw new db['Sequelize'][(_0xe364('0x94'))](_0xe364('0xf2'));}})[_0xe364('0x20')](function(){if(_0x24ff88){return _0x24ff88['getVoiceQueues']({'raw':!![]});}})['then'](function(_0xfb4469){if(_0x24ff88){if(_0xfb4469){_0x436512=_0xfb4469;if(_0x436512[_0xe364('0x6d')]){var _0x32f193=_0x436512['map'](function(_0x811402){var _0x362cad={'membername':_0x24ff88['name'],'UserId':_0x24ff88['id'],'queue_name':_0x811402['name'],'VoiceQueueId':_0x811402['id'],'interface':_0x4e8877,'paused':_0x24ff88[_0xe364('0xea')]||![],'penalty':_0x811402[_0xe364('0xf3')]||0x0};return db[_0xe364('0xd5')][_0xe364('0xb0')](_0x362cad);});return Promise['all'](_0x32f193);}}}})['then'](function(){if(_0x24ff88){return db[_0xe364('0xf4')][_0xe364('0x4e')]({'where':{'membername':_0x24ff88[_0xe364('0x38')],'exitAt':null}});}})[_0xe364('0x20')](function(_0x4aedd0){if(_0x24ff88){var _0x3c7002=[];_0x4aedd0[_0xe364('0xf5')](function(_0x5503d9){_0x3c7002['push'](_0x5503d9[_0xe364('0x5c')]({'exitAt':moment()[_0xe364('0xae')]('YYYY-MM-DD\x20HH:mm:ss')}));});return Promise[_0xe364('0x8c')](_0x3c7002);}})['then'](function(){if(_0x24ff88){var _0x3347ec=[];var _0x160e92=[];var _0x332dcf=utils[_0xe364('0xf6')]();var _0x14de76={'membername':_0x24ff88[_0xe364('0x38')],'interface':_0x4e8877,'enterAt':moment()[_0xe364('0xae')](_0xe364('0xf7')),'role':_0x24ff88[_0xe364('0x28')],'internal':_0x24ff88[_0xe364('0x62')]};_0x332dcf[_0xe364('0xf5')](function(_0x31202b){_0x3347ec[_0xe364('0x4d')](_[_0xe364('0x58')]({'channel':_0x31202b,'type':_0xe364('0xf8'),'data1':_0x3ecbcb[_0xe364('0x5d')][_0xe364('0xf9')],'data2':_0x4e8877},_0x14de76));if(_0x24ff88['loginInPause']){_0x160e92[_0xe364('0x4d')](_['merge']({'channel':_0x31202b,'type':_0xe364('0xfa'),'data1':_0xe364('0xfb')},_0x14de76));}});return db[_0xe364('0xf4')][_0xe364('0x89')](_0x3347ec[_0xe364('0xc1')](_0x160e92),{'individualHooks':!![]});}})['then'](function(){if(_0x24ff88){return _0x24ff88[_0xe364('0x5c')]({'online':!![],'lastLoginAt':moment()[_0xe364('0xae')](_0xe364('0xf7')),'voicePause':_0x24ff88[_0xe364('0xea')]||![],'mailPause':_0x24ff88[_0xe364('0xea')]||![],'chatPause':_0x24ff88[_0xe364('0xea')]||![],'faxPause':_0x24ff88[_0xe364('0xea')]||![],'smsPause':_0x24ff88[_0xe364('0xea')]||![],'openchannelPause':_0x24ff88[_0xe364('0xea')]||![],'whatsappPause':_0x24ff88[_0xe364('0xea')]||![],'pauseType':_0x24ff88[_0xe364('0xea')]?_0xe364('0xfb'):null,'interface':_0x4e8877,'lastPauseAt':moment()[_0xe364('0xae')](_0xe364('0xf7'))});}})[_0xe364('0x20')](function(_0x13b807){if(_0x3ecbcb[_0xe364('0xfc')]){return _0x3e5b15();}else{return Promise[_0xe364('0xfd')](_0x13b807)[_0xe364('0x20')](respondWithResult(_0x594dd8,null));}})[_0xe364('0x5f')](handleError(_0x594dd8,null));};exports[_0xe364('0xfe')]=function(_0x372c1a,_0x409743){var _0x384c4f;return db[_0xe364('0x45')][_0xe364('0x37')]({'where':{'id':_0x372c1a[_0xe364('0x57')]['id'],'role':_0xe364('0x29')},'attributes':['id',_0xe364('0x38'),_0xe364('0x28')]})[_0xe364('0x20')](handleEntityNotFound(_0x409743,null))[_0xe364('0x20')](function(_0x1c1c4f){if(_0x1c1c4f){_0x384c4f=_0x1c1c4f;return db[_0xe364('0xd5')][_0xe364('0x2c')]({'where':{'membername':_0x384c4f['name']},'individualHooks':!![]});}})[_0xe364('0x20')](function(){return db[_0xe364('0xf4')][_0xe364('0x4e')]({'where':{'membername':_0x384c4f[_0xe364('0x38')],'exitAt':null}});})[_0xe364('0x20')](function(_0x3c4b83){var _0x3644a4=[];_0x3c4b83[_0xe364('0xf5')](function(_0x5b4b61){_0x3644a4[_0xe364('0x4d')](_0x5b4b61['update']({'exitAt':moment()[_0xe364('0xae')](_0xe364('0xf7'))}));});return Promise[_0xe364('0x8c')](_0x3644a4);})[_0xe364('0x20')](function(){return _0x384c4f[_0xe364('0x5c')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0xe364('0x20')](respondWithResult(_0x409743,null))[_0xe364('0x5f')](handleError(_0x409743,null));};exports[_0xe364('0xff')]=function(_0x25e870,_0x4edb9b){var _0x1f8384;return db['UserVoiceQueueRt'][_0xe364('0x5c')]({'paused':0x1},{'where':{'UserId':_0x25e870['params']['id']},'individualHooks':!![]})['then'](function(){return db[_0xe364('0x45')][_0xe364('0x37')]({'where':{'id':_0x25e870['params']['id'],'role':_0xe364('0x29')},'attributes':['id','name',_0xe364('0x28'),_0xe364('0x62'),_0xe364('0xa1'),_0xe364('0xa0')]});})[_0xe364('0x20')](handleEntityNotFound(_0x4edb9b,null))[_0xe364('0x20')](function(_0x4bcbda){if(_0x4bcbda){_0x1f8384=_0x4bcbda;return respondWithRpcPromise(_0xe364('0x100'),_0xe364('0xff'),{'id':_0x1f8384['id'],'name':_0x1f8384['name'],'pause':!![]});}})[_0xe364('0x20')](function(){if(_0x1f8384){return db[_0xe364('0xf4')][_0xe364('0x4e')]({'where':{'membername':_0x1f8384['name'],'type':'PAUSE','exitAt':null}});}})[_0xe364('0x20')](function(_0x4cb2b3){if(_0x4cb2b3[_0xe364('0x6d')]){var _0x286a20=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');for(var _0x4c6880=0x0,_0x1deb16=_0x4cb2b3[_0xe364('0x6d')];_0x4c6880<_0x1deb16;_0x4c6880++){_0x4cb2b3[_0x4c6880][_0xe364('0x101')]({'exitAt':_0x286a20});}}})[_0xe364('0x20')](function(){var _0x558966=[];var _0x5ae94a=utils['getChannels']();_0x5ae94a[_0xe364('0xf5')](function(_0x936dab){_0x558966[_0xe364('0x4d')]({'channel':_0x936dab,'membername':_0x1f8384[_0xe364('0x38')],'interface':_[_0xe364('0x67')](_0x1f8384[_0xe364('0xa1')])?util[_0xe364('0xae')](_0xe364('0xaf'),_0x1f8384['name']):_0x1f8384[_0xe364('0xa1')],'type':_0xe364('0xfa'),'enterAt':moment()['format'](_0xe364('0xf7')),'data1':_0x25e870[_0xe364('0x5d')][_0xe364('0x3c')]||_0xe364('0x102'),'role':_0x1f8384['role'],'internal':_0x1f8384[_0xe364('0x62')]});});return db[_0xe364('0xf4')][_0xe364('0x89')](_0x558966,{'individualHooks':!![]});})[_0xe364('0x20')](function(){return _0x1f8384[_0xe364('0x5c')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x25e870['body'][_0xe364('0x3c')]||'DEFAULT\x20PAUSE','lastPauseAt':moment()[_0xe364('0xae')]('YYYY-MM-DD\x20HH:mm:ss')});})[_0xe364('0x20')](respondWithResult(_0x4edb9b,null))['catch'](handleError(_0x4edb9b,null));};exports[_0xe364('0x103')]=function(_0xf2b925,_0x2178da){if(_0xf2b925[_0xe364('0x5d')][_0xe364('0x9f')]&&!utils[_0xe364('0xb1')](_0xf2b925['body']['channel'])){throw new APIBadRequestError(util[_0xe364('0xae')](_0xe364('0x104'),_0xf2b925[_0xe364('0x5d')][_0xe364('0x9f')]));}return db[_0xe364('0x45')][_0xe364('0x37')]({'where':{'id':_0xf2b925[_0xe364('0x57')]['id']},'attributes':['id',_0xe364('0x38'),_0xe364('0x28'),_0xe364('0x62'),_0xe364('0xa1'),_0xe364('0xa0'),_0xe364('0x105'),_0xe364('0x106'),_0xe364('0x107'),_0xe364('0x108'),_0xe364('0x109'),_0xe364('0x10a'),_0xe364('0x10b'),_0xe364('0x10c'),_0xe364('0x10d')]})['then'](function(_0x216bcd){if(!_0x216bcd){throw new APINotFoundError(util['format'](_0xe364('0xc3'),_0xf2b925[_0xe364('0x57')]['id']));}return _0x216bcd[_0xe364('0x103')](_0xf2b925['body']['channel']);})[_0xe364('0x20')](respondWithResult(_0x2178da,null))[_0xe364('0x5f')](APIHandleError(_0x2178da));};exports[_0xe364('0x10e')]=function(_0x3ecb23,_0x584f92){var _0x4d5089={};var _0x120736={};var _0x443ccd;var _0x97b9f3;return db[_0xe364('0x45')]['findOne']({'where':{'id':_0x3ecb23[_0xe364('0x57')]['id']}})[_0xe364('0x20')](handleEntityNotFound(_0x584f92,null))[_0xe364('0x20')](function(_0x284d48){if(_0x284d48){_0x443ccd=_0x284d48;_0x120736[_0xe364('0xc9')]=_['keys'](db['Team'][_0xe364('0x3b')]);_0x120736[_0xe364('0x46')]=_[_0xe364('0xca')](_0x3ecb23[_0xe364('0x46')]);_0x120736[_0xe364('0xcc')]=_['intersection'](_0x120736[_0xe364('0xc9')],_0x120736['query']);_0x4d5089[_0xe364('0x4c')]=_[_0xe364('0xcd')](_0x120736['model'],qs[_0xe364('0xce')](_0x3ecb23[_0xe364('0x46')][_0xe364('0xce')]));_0x4d5089[_0xe364('0x4c')]=_0x4d5089['attributes'][_0xe364('0x6d')]?_0x4d5089[_0xe364('0x4c')]:_0x120736[_0xe364('0xc9')];_0x4d5089['order']=qs['sort'](_0x3ecb23[_0xe364('0x46')][_0xe364('0xd0')]);_0x4d5089['where']=qs[_0xe364('0xcc')](_[_0xe364('0xd1')](_0x3ecb23[_0xe364('0x46')],_0x120736[_0xe364('0xcc')]));if(_0x3ecb23['query'][_0xe364('0x32')]){_0x4d5089[_0xe364('0x44')]=_['merge'](_0x4d5089['where'],{'$or':_[_0xe364('0x34')](_0x4d5089[_0xe364('0x4c')],function(_0xf976b4){var _0x475be7={};_0x475be7[_0xf976b4]={'$like':'%'+_0x3ecb23[_0xe364('0x46')][_0xe364('0x32')]+'%'};return _0x475be7;})});}_0x4d5089=_[_0xe364('0x58')]({},_0x4d5089,_0x3ecb23[_0xe364('0x59')]);return _0x443ccd[_0xe364('0x10e')](_0x4d5089);}})[_0xe364('0x20')](function(_0x933216){if(_0x933216){_0x97b9f3=_0x933216['length'];if(!_0x3ecb23[_0xe364('0x46')]['hasOwnProperty'](_0xe364('0xd3'))){_0x4d5089[_0xe364('0x1b')]=qs[_0xe364('0x1b')](_0x3ecb23['query'][_0xe364('0x1b')]);_0x4d5089[_0xe364('0x19')]=qs[_0xe364('0x19')](_0x3ecb23['query'][_0xe364('0x19')]);}return _0x443ccd['getTeams'](_0x4d5089);}})['then'](function(_0x28dfbe){if(_0x28dfbe){return _0x28dfbe?{'count':_0x97b9f3,'rows':_0x28dfbe}:null;}})[_0xe364('0x20')](respondWithResult(_0x584f92,null))[_0xe364('0x5f')](handleError(_0x584f92,null));};exports[_0xe364('0x10f')]=function(_0x2189ff,_0x1b91c5){var _0x48484b=_0x2189ff['params']['id'];var _0x1d0790=_0x2189ff[_0xe364('0x5d')]?_0x2189ff[_0xe364('0x5d')]['ids']:null;var _0x3c30da=[];return Promise['resolve']()['then'](function(){if(!_0x1d0790)throw new APIBadRequestError(_0xe364('0x110'));})[_0xe364('0x20')](function(){return db[_0xe364('0x45')][_0xe364('0x99')]({'where':{'id':_0x48484b}});})[_0xe364('0x20')](function(_0x3a5a4a){if(!_0x3a5a4a)throw new APINotFoundError(util[_0xe364('0xae')](_0xe364('0xc3'),_0x2189ff[_0xe364('0x57')]['id']));return db['sequelize'][_0xe364('0x111')](function(_0x5ccb82){return _0x3a5a4a[_0xe364('0x10f')](_0x1d0790,{'transaction':_0x5ccb82})[_0xe364('0x20')](function(){return db[_0xe364('0x112')]['findAll']({'where':{'id':{'$in':_0x1d0790}}});})[_0xe364('0x20')](function(_0x54aa52){var _0x2f53a3=_[_0xe364('0x34')](_0x54aa52,function(_0x17bb49){return _0x17bb49[_0xe364('0x113')]();});return Promise[_0xe364('0x8c')](_0x2f53a3);})[_0xe364('0x20')](function(_0x5f1e57){_0x3c30da=_['flattenDeep'](_0x5f1e57);var _0x3dea54=_[_0xe364('0x34')](_0x3c30da,function(_0x3a1f22){return _0x3a1f22['addAgent'](_0x3a5a4a['id'],{'transaction':_0x5ccb82});});return Promise['all'](_0x3dea54);})['then'](function(){if(!_0x3a5a4a[_0xe364('0xa0')])return;var _0x4a36f6=_[_0xe364('0x32')](_0x3c30da,function(_0x263ddd){return _0x263ddd[_0xe364('0x114')](_0xe364('0x9f'))===_0xe364('0x115');});var _0x1391f9=_['map'](_0x4a36f6,function(_0xa2dd6e){return db[_0xe364('0xd5')]['upsert']({'membername':_0x3a5a4a['name'],'UserId':_0x3a5a4a['id'],'queue_name':_0xa2dd6e[_0xe364('0x38')],'VoiceQueueId':_0xa2dd6e['id'],'interface':_[_0xe364('0x67')](_0x3a5a4a[_0xe364('0xa1')])?util[_0xe364('0xae')](_0xe364('0xaf'),_0x3a5a4a['name']):_0x3a5a4a[_0xe364('0xa1')],'paused':_0x3a5a4a[_0xe364('0x105')]||![],'penalty':_0x3a5a4a[_0xe364('0xa6')]},{'transaction':_0x5ccb82});});return Promise[_0xe364('0x8c')](_0x1391f9);})[_0xe364('0x20')](function(){return db[_0xe364('0x116')][_0xe364('0x4e')]({'where':{'teamId':{'$in':_0x1d0790}}});})[_0xe364('0x20')](function(_0x4b3c5e){var _0xfe3375=_[_0xe364('0x34')](_0x4b3c5e,function(_0xbd7cb0){return db[_0xe364('0x117')][_0xe364('0x80')]({'UserId':_0x3a5a4a['id'],'VoicePrefixId':_0xbd7cb0[_0xe364('0x118')]},{'transaction':_0x5ccb82});});return Promise[_0xe364('0x8c')](_0xfe3375);});});})[_0xe364('0x20')](function(){for(var _0x2f1280=0x0;_0x2f1280<_0x3c30da['length'];_0x2f1280++){var _0x2104f5=_0x3c30da[_0x2f1280][_0xe364('0x114')](_0xe364('0x9f'));var _0x25f5d0=_0x2104f5+'QueueId';socket[_0xe364('0x2a')](_0xe364('0x2f')+_0x2104f5+_0xe364('0xaa'),{'UserId':_0x48484b,['queueField']:_0x3c30da[_0x2f1280]['id']});}})[_0xe364('0x20')](respondWithStatusCode(_0x1b91c5,null))[_0xe364('0x5f')](APIHandleError(_0x1b91c5));};exports[_0xe364('0x119')]=function(_0x3721cf,_0x1f6d29){var _0x22c763=_0x3721cf['params']['id'];var _0x11ee82=null;if(_0x3721cf[_0xe364('0x46')][_0xe364('0x61')]){_0x11ee82=_[_0xe364('0x11a')](_0x3721cf['query'][_0xe364('0x61')])?_0x3721cf['query']['ids']:[_0x3721cf[_0xe364('0x46')][_0xe364('0x61')]];}var _0x23f5aa=[];return Promise['resolve']()['then'](function(){if(!_0x11ee82)throw new APIBadRequestError(_0xe364('0x11b'));})[_0xe364('0x20')](function(){return db[_0xe364('0x45')]['findOne']({'where':{'id':_0x22c763}});})[_0xe364('0x20')](function(_0x4a0f73){if(!_0x4a0f73)throw new APINotFoundError(util['format'](_0xe364('0xc3'),_0x3721cf['params']['id']));return db[_0xe364('0x69')]['transaction'](function(_0x246a2e){return _0x4a0f73[_0xe364('0x119')](_0x11ee82,{'transaction':_0x246a2e})[_0xe364('0x20')](function(){return db[_0xe364('0x112')][_0xe364('0x4e')]({'where':{'id':{'$in':_0x11ee82}}});})[_0xe364('0x20')](function(_0x3ed7bf){var _0xa90c31=_['map'](_0x3ed7bf,function(_0x2e35f9){return _0x2e35f9[_0xe364('0x113')]();});return Promise[_0xe364('0x8c')](_0xa90c31);})['then'](function(_0x5c08cb){_0x23f5aa=_[_0xe364('0x11c')](_0x5c08cb);var _0x22ba70=_[_0xe364('0x34')](_0x23f5aa,function(_0x33f9d7){return _0x33f9d7[_0xe364('0x11d')](_0x4a0f73['id'],{'transaction':_0x246a2e});});return Promise['all'](_0x22ba70);})['then'](function(){if(!_0x4a0f73[_0xe364('0xa0')])return;var _0x5bb17e=_[_0xe364('0x32')](_0x23f5aa,function(_0x235a6e){return _0x235a6e[_0xe364('0x114')](_0xe364('0x9f'))===_0xe364('0x115');});var _0x2626b2=_[_0xe364('0x34')](_0x5bb17e,function(_0x15690a){return db['UserVoiceQueueRt'][_0xe364('0x2c')]({'where':{'VoiceQueueId':_0x15690a['id'],'UserId':_0x4a0f73['id']},'transaction':_0x246a2e});});return Promise[_0xe364('0x8c')](_0x2626b2);})['then'](function(){return db['TeamVoicePrefix'][_0xe364('0x4e')]({'where':{'teamId':{'$in':_0x11ee82}}});})['then'](function(_0x2f4cc8){var _0x811d9b=_[_0xe364('0x34')](_0x2f4cc8,function(_0x3a0a5d){return db['UserVoicePrefix']['destroy']({'where':{'UserId':_0x4a0f73['id'],'VoicePrefixId':_0x3a0a5d[_0xe364('0x118')]}},{'transaction':_0x246a2e});});return Promise['all'](_0x811d9b);});});})[_0xe364('0x20')](function(){for(var _0x10c6a4=0x0;_0x10c6a4<_0x23f5aa[_0xe364('0x6d')];_0x10c6a4++){var _0x47f60f=_0x23f5aa[_0x10c6a4][_0xe364('0x114')](_0xe364('0x9f'));var _0x3d726a=_0x47f60f+'QueueId';socket[_0xe364('0x2a')](_0xe364('0x2f')+_0x47f60f+'Queue:remove',{'UserId':_0x22c763,['queueField']:_0x23f5aa[_0x10c6a4]['id']});}})[_0xe364('0x20')](respondWithStatusCode(_0x1f6d29,null))['catch'](APIHandleError(_0x1f6d29));};exports['getLists']=function(_0x27bdd1,_0x5e90ae){var _0x3e025a={};var _0x14c44d={};var _0x529828;var _0x2e8ed8;return db['User'][_0xe364('0x99')]({'where':{'id':_0x27bdd1[_0xe364('0x57')]['id']}})[_0xe364('0x20')](handleEntityNotFound(_0x5e90ae,null))[_0xe364('0x20')](function(_0x43fc1c){if(_0x43fc1c){_0x529828=_0x43fc1c;_0x14c44d[_0xe364('0xc9')]=_[_0xe364('0xca')](db[_0xe364('0xc4')][_0xe364('0x3b')]);_0x14c44d[_0xe364('0x46')]=_[_0xe364('0xca')](_0x27bdd1['query']);_0x14c44d[_0xe364('0xcc')]=_[_0xe364('0xcd')](_0x14c44d['model'],_0x14c44d[_0xe364('0x46')]);_0x3e025a[_0xe364('0x4c')]=_[_0xe364('0xcd')](_0x14c44d[_0xe364('0xc9')],qs['fields'](_0x27bdd1[_0xe364('0x46')][_0xe364('0xce')]));_0x3e025a[_0xe364('0x4c')]=_0x3e025a[_0xe364('0x4c')]['length']?_0x3e025a['attributes']:_0x14c44d[_0xe364('0xc9')];_0x3e025a[_0xe364('0xcf')]=qs[_0xe364('0xd0')](_0x27bdd1[_0xe364('0x46')][_0xe364('0xd0')]);_0x3e025a[_0xe364('0x44')]=qs['filters'](_[_0xe364('0xd1')](_0x27bdd1[_0xe364('0x46')],_0x14c44d[_0xe364('0xcc')]));if(_0x27bdd1[_0xe364('0x46')][_0xe364('0x32')]){_0x3e025a[_0xe364('0x44')]=_['merge'](_0x3e025a[_0xe364('0x44')],{'$or':_[_0xe364('0x34')](_0x3e025a['attributes'],function(_0x563b15){var _0x5d429e={};_0x5d429e[_0x563b15]={'$like':'%'+_0x27bdd1[_0xe364('0x46')]['filter']+'%'};return _0x5d429e;})});}_0x3e025a=_[_0xe364('0x58')]({},_0x3e025a,_0x27bdd1[_0xe364('0x59')]);return _0x529828[_0xe364('0x11e')](_0x3e025a);}})['then'](function(_0x42f255){if(_0x42f255){_0x2e8ed8=_0x42f255[_0xe364('0x6d')];if(!_0x27bdd1[_0xe364('0x46')][_0xe364('0xd6')]('nolimit')){_0x3e025a['limit']=qs[_0xe364('0x1b')](_0x27bdd1[_0xe364('0x46')][_0xe364('0x1b')]);_0x3e025a['offset']=qs['offset'](_0x27bdd1['query'][_0xe364('0x19')]);}return _0x529828['getLists'](_0x3e025a);}})[_0xe364('0x20')](function(_0x4194cc){if(_0x4194cc){return _0x4194cc?{'count':_0x2e8ed8,'rows':_0x4194cc}:null;}})['then'](respondWithResult(_0x5e90ae,null))[_0xe364('0x5f')](handleError(_0x5e90ae,null));};exports[_0xe364('0x11f')]=function(_0x27867d,_0x5e9eec){var _0x2cdf2b={};var _0x3e9f9f={};var _0x1b7b27;return db[_0xe364('0x45')][_0xe364('0x99')]({'where':{'id':_0x27867d[_0xe364('0x57')]['id']}})[_0xe364('0x20')](handleEntityNotFound(_0x5e9eec,null))[_0xe364('0x20')](function(_0x5ecfaa){if(_0x5ecfaa){_0x1b7b27=_0x5ecfaa;_0x3e9f9f[_0xe364('0xc9')]=_['keys'](db[_0xe364('0x45')][_0xe364('0x3b')]);_0x3e9f9f[_0xe364('0x46')]=_[_0xe364('0xca')](_0x27867d[_0xe364('0x46')]);_0x3e9f9f[_0xe364('0xcc')]=_[_0xe364('0xcd')](_0x3e9f9f[_0xe364('0xc9')],_0x3e9f9f[_0xe364('0x46')]);_0x2cdf2b[_0xe364('0x4c')]=_[_0xe364('0xcd')](_0x3e9f9f['model'],qs[_0xe364('0xce')](_0x27867d[_0xe364('0x46')][_0xe364('0xce')]));_0x2cdf2b[_0xe364('0x4c')]=_0x2cdf2b[_0xe364('0x4c')][_0xe364('0x6d')]?_0x2cdf2b['attributes']:_0x3e9f9f['model'];_0x2cdf2b[_0xe364('0xcf')]=qs[_0xe364('0xd0')](_0x27867d[_0xe364('0x46')][_0xe364('0xd0')]);_0x2cdf2b[_0xe364('0x44')]=qs['filters'](_[_0xe364('0xd1')](_0x27867d['query'],_0x3e9f9f['filters']));if(_0x27867d[_0xe364('0x46')][_0xe364('0x32')]){_0x2cdf2b[_0xe364('0x44')]=_[_0xe364('0x58')](_0x2cdf2b['where'],{'$or':_[_0xe364('0x34')](_0x2cdf2b[_0xe364('0x4c')],function(_0x1c6ec3){var _0x21221e={};_0x21221e[_0x1c6ec3]={'$like':'%'+_0x27867d[_0xe364('0x46')][_0xe364('0x32')]+'%'};return _0x21221e;})});}_0x2cdf2b[_0xe364('0xc9')]=db[_0xe364('0x45')];_0x2cdf2b['as']='Agents';_0x2cdf2b=_[_0xe364('0x58')]({},_0x2cdf2b,_0x27867d['options']);return _0x1b7b27[_0xe364('0x120')]({'include':[_0x2cdf2b]});}})[_0xe364('0x20')](function(_0x4ae2d4){if(_0x4ae2d4){var _0x182b1c={},_0x5d1797=[];for(var _0xfebea7=0x0;_0xfebea7<_0x4ae2d4[_0xe364('0x6d')];_0xfebea7+=0x1){for(var _0x50a3a8=0x0,_0x45f244;_0x50a3a8<_0x4ae2d4[_0xfebea7][_0xe364('0x30')][_0xe364('0x6d')];_0x50a3a8+=0x1){_0x45f244=_0x4ae2d4[_0xfebea7][_0xe364('0x30')][_0x50a3a8][_0xe364('0xad')]({'plain':!![]});_0x182b1c[_0x45f244['id']]=_0x45f244;}}_0x182b1c=_[_0xe364('0x121')](_0x182b1c);for(var _0x18b1ba=qs[_0xe364('0x19')](_0x27867d[_0xe364('0x46')]['offset']);_0x18b1ba<_0x182b1c[_0xe364('0x6d')]&&_0x5d1797[_0xe364('0x6d')]=_0x1f9853){_0x3d56da=_0x1f9853;_0x4a256c=0xc8;}else{_0x4a256c=0xce;}_0x51ca1f['status'](_0x4a256c);return _0x51ca1f['set']('Content-Range',_0x414911+'-'+_0x3d56da+'/'+_0x1f9853)[_0x2af7('0x23')](_0x50078d);}return null;};}function respondWithRpcPromise(_0x20ee09,_0x11c362,_0xe5583c,_0x7264c4){return new Promise(function(_0x13b80f,_0x4c439a){var _0x5c7a1b=_0x7264c4||amiClient;return _0x5c7a1b[_0x2af7('0x24')](_0x20ee09,_0xe5583c)['then'](function(_0x5d6e75){logger[_0x2af7('0x25')](_0x2af7('0x26'),_0x11c362,_0x2af7('0x27'));logger[_0x2af7('0x28')](_0x2af7('0x29'),_0x11c362,_0x2af7('0x27'),JSON[_0x2af7('0x2a')](_0x5d6e75));if(_0x5d6e75[_0x2af7('0x2b')]){if(_0x5d6e75[_0x2af7('0x2b')]['code']===0x1f4){logger[_0x2af7('0x2b')](_0x2af7('0x26'),_0x11c362,_0x5d6e75[_0x2af7('0x2b')][_0x2af7('0x2c')]);return _0x4c439a(_0x5d6e75[_0x2af7('0x2b')][_0x2af7('0x2c')]);}logger['error'](_0x2af7('0x26'),_0x11c362,_0x5d6e75['error'][_0x2af7('0x2c')]);return _0x13b80f(_0x5d6e75[_0x2af7('0x2b')]['message']);}else{logger[_0x2af7('0x25')]('User,\x20%s,\x20%s',_0x11c362,_0x2af7('0x27'));_0x13b80f(_0x5d6e75[_0x2af7('0x2d')]['message']);}})['catch'](function(_0xffa22e){logger['error'](_0x2af7('0x26'),_0x11c362,_0xffa22e);_0x4c439a(_0xffa22e);});});}function saveUpdates(_0x28c961){return function(_0x4ffa8b){if(_0x4ffa8b){return _0x4ffa8b[_0x2af7('0x2e')](_0x28c961)[_0x2af7('0x2f')](function(_0x2f26a2){if(_0x2f26a2[_0x2af7('0x30')]===_0x2af7('0x31')){socket[_0x2af7('0x32')]('userNotification:recalc:'+_0x2f26a2['id'],_0x2f26a2);}return _0x2f26a2;});}return null;};}function removeEntity(_0x4e30e2,_0x3ae00a){return function(_0x69137){if(_0x69137){return _0x69137['destroy']({'transaction':_0x3ae00a})[_0x2af7('0x2f')](function(){var _0x1cc724=_0x69137[_0x2af7('0x33')]({'plain':!![]});if(_0x1cc724[_0x2af7('0x30')]===_0x2af7('0x34'))return;var _0x5260f1=[{'name':'Users','value':'user','ignore':!![]},{'name':'Agents','value':_0x2af7('0x31'),'ignore':![]},{'name':'Telephones','value':'telephone','ignore':![]}];var _0x488ead=_(_0x5260f1)[_0x2af7('0x35')]('ignore')[_0x2af7('0x36')](_0x2af7('0x37'))[_0x2af7('0x37')]();if(_[_0x2af7('0x38')](_0x488ead,_0x1cc724['role'])){return;}var _0x2b28e9=_['find'](_0x5260f1,[_0x2af7('0x37'),_0x1cc724[_0x2af7('0x30')]])[_0x2af7('0x39')];return db[_0x2af7('0x3a')][_0x2af7('0x3b')]({'where':{'type':_0x2b28e9,'resourceId':_0x1cc724['id']},'transaction':_0x3ae00a})[_0x2af7('0x2f')](function(){return _0x69137;});})[_0x2af7('0x2f')](function(){_0x4e30e2['status'](0xcc)[_0x2af7('0x1f')]();});}};}function handleEntityNotFound(_0x2c274d){return function(_0x312894){if(!_0x312894){_0x2c274d['sendStatus'](0x194);}return _0x312894;};}function handleError(_0x51095a,_0x2f4ad0){_0x2f4ad0=_0x2f4ad0||0x1f4;return function(_0xfb28fc){logger['error'](_0xfb28fc[_0x2af7('0x3c')]);if(_0xfb28fc[_0x2af7('0x39')]){delete _0xfb28fc[_0x2af7('0x39')];}_0x51095a[_0x2af7('0x1e')](_0x2f4ad0)[_0x2af7('0x3d')](_0xfb28fc);};}function getUserAttributes(){return _(db[_0x2af7('0x3e')][_0x2af7('0x3f')])[_0x2af7('0x36')](function(_0x34bd5c){return{'name':_0x34bd5c['fieldName'],'type':_0x34bd5c[_0x2af7('0x40')][_0x2af7('0x41')]};})['filter'](function(_0x524fb0){return!['password','salt',_0x2af7('0x42'),_0x2af7('0x43'),_0x2af7('0x44'),_0x2af7('0x45')]['includes'](_0x524fb0['name']);})[_0x2af7('0x37')]();}exports[_0x2af7('0x46')]=function(_0x40c73c,_0x597619){var _0x54c883={},_0x3669c1={'count':0x0,'rows':[]};var _0x23de91=getUserAttributes();_0x54c883=qs[_0x2af7('0x47')](_0x23de91,_0x40c73c);var _0x293d01={'where':_0x54c883[_0x2af7('0x48')]};return db[_0x2af7('0x3e')][_0x2af7('0x49')](_0x293d01)['then'](function(_0x3d10f4){_0x3669c1[_0x2af7('0x49')]=_0x3d10f4;if(_0x40c73c[_0x2af7('0x4a')]['includeAll']){_0x54c883['include']=[{'all':!![]}];}if(_0x40c73c['query'][_0x2af7('0x4b')]===_0x2af7('0x4c')){_0x54c883['include']=[{'model':db[_0x2af7('0x4d')],'as':_0x2af7('0x4b')}];}if(!_[_0x2af7('0x38')](_0x54c883[_0x2af7('0x4e')],'id')){_0x54c883['attributes'][_0x2af7('0x4f')]('id');}return db[_0x2af7('0x3e')][_0x2af7('0x50')](_0x54c883);})[_0x2af7('0x2f')](function(_0x41487a){_0x3669c1[_0x2af7('0x51')]=_0x41487a;if(_0x40c73c[_0x2af7('0x4a')][_0x2af7('0x52')]===_0x2af7('0x4c')){var _0x2dcc28=[];for(var _0x41e3c0=0x0;_0x41e3c0<_0x3669c1['rows'][_0x2af7('0x53')];_0x41e3c0++){_0x2dcc28['push'](get_open_tabs('chat',_0x3669c1[_0x2af7('0x51')][_0x41e3c0][_0x2af7('0x54')]));_0x2dcc28[_0x2af7('0x4f')](get_open_tabs('sms',_0x3669c1['rows'][_0x41e3c0][_0x2af7('0x54')]));_0x2dcc28['push'](get_open_tabs(_0x2af7('0x55'),_0x3669c1['rows'][_0x41e3c0][_0x2af7('0x54')]));_0x2dcc28[_0x2af7('0x4f')](get_open_tabs(_0x2af7('0x56'),_0x3669c1[_0x2af7('0x51')][_0x41e3c0]['dataValues']));_0x2dcc28['push'](get_open_tabs(_0x2af7('0x57'),_0x3669c1[_0x2af7('0x51')][_0x41e3c0]['dataValues']));_0x2dcc28[_0x2af7('0x4f')](get_open_tabs('whatsapp',_0x3669c1[_0x2af7('0x51')][_0x41e3c0][_0x2af7('0x54')]));}return Promise[_0x2af7('0x58')](_0x2dcc28)['then'](function(){return _0x3669c1;});}else{return _0x3669c1;}})[_0x2af7('0x2f')](respondWithFilteredResult(_0x597619,_0x54c883))[_0x2af7('0x59')](handleError(_0x597619,null));};exports[_0x2af7('0x5a')]=function(_0x463596,_0x46c870){var _0xbe7ae2=getUserAttributes();_0x463596[_0x2af7('0x4a')]['id']=_0x463596[_0x2af7('0x5b')]['id'];var _0x3cfe2c=qs[_0x2af7('0x47')](_0xbe7ae2,_0x463596);if(_0x463596['query'][_0x2af7('0x5c')]){_0x3cfe2c[_0x2af7('0x5d')]=[{'all':!![]}];}if(_0x463596[_0x2af7('0x4a')]['userSetting']==='true'){_0x3cfe2c[_0x2af7('0x5d')]=[{'model':db['UserSetting'],'as':_0x2af7('0x4b')}];}_0x3cfe2c=_[_0x2af7('0x5e')]({},_0x3cfe2c,_0x463596[_0x2af7('0x5f')]);if(!_[_0x2af7('0x38')](_0x3cfe2c['attributes'],'id')){_0x3cfe2c[_0x2af7('0x4e')][_0x2af7('0x4f')]('id');}return db[_0x2af7('0x3e')]['find'](_0x3cfe2c)[_0x2af7('0x2f')](handleEntityNotFound(_0x46c870,null))['then'](function(_0x464505){var _0x13f754=[];values=_0x464505;if(_0x463596['query'][_0x2af7('0x52')]==='true'){_0x13f754[_0x2af7('0x4f')](get_open_tabs('chat',_0x464505[_0x2af7('0x54')]));_0x13f754[_0x2af7('0x4f')](get_open_tabs(_0x2af7('0x60'),_0x464505[_0x2af7('0x54')]));_0x13f754[_0x2af7('0x4f')](get_open_tabs(_0x2af7('0x57'),_0x464505[_0x2af7('0x54')]));_0x13f754[_0x2af7('0x4f')](get_open_tabs(_0x2af7('0x61'),_0x464505['dataValues']));_0x13f754[_0x2af7('0x4f')](get_open_tabs('fax',_0x464505['dataValues']));_0x13f754[_0x2af7('0x4f')](get_open_tabs(_0x2af7('0x56'),_0x464505[_0x2af7('0x54')]));return Promise[_0x2af7('0x58')](_0x13f754);}else{return values;}})[_0x2af7('0x2f')](function(){return values;})['then'](respondWithResult(_0x46c870,null))[_0x2af7('0x59')](handleError(_0x46c870,null));};exports['update']=function(_0x3e65a2,_0x4162c8){if(_0x3e65a2[_0x2af7('0x62')]['id']){delete _0x3e65a2[_0x2af7('0x62')]['id'];}delete _0x3e65a2[_0x2af7('0x62')][_0x2af7('0x30')];return db[_0x2af7('0x3e')][_0x2af7('0x63')]({'where':{'id':_0x3e65a2[_0x2af7('0x5b')]['id']}})[_0x2af7('0x2f')](handleEntityNotFound(_0x4162c8,null))[_0x2af7('0x2f')](saveUpdates(_0x3e65a2[_0x2af7('0x62')],null))['then'](respondWithResult(_0x4162c8,null))[_0x2af7('0x59')](handleError(_0x4162c8,null));};exports['describe']=function(_0x5f2829,_0x143935){return db[_0x2af7('0x3e')][_0x2af7('0x64')]()[_0x2af7('0x2f')](respondWithResult(_0x143935,null))['catch'](handleError(_0x143935,null));};exports[_0x2af7('0x65')]=function(_0x286b0c,_0x809357){return db[_0x2af7('0x3e')][_0x2af7('0x63')]({'where':{'id':_0x286b0c[_0x2af7('0x5b')]['id']}})[_0x2af7('0x2f')](handleEntityNotFound(_0x809357,null))[_0x2af7('0x2f')](function(_0x2a0459){if(_0x2a0459){return _0x2a0459['addContacts'](_0x286b0c[_0x2af7('0x62')]['ids'],_['omit'](_0x286b0c[_0x2af7('0x62')],[_0x2af7('0x66'),'id'])||{});}})['then'](respondWithResult(_0x809357,null))[_0x2af7('0x59')](handleError(_0x809357,null));};function validateUser(_0x30d1cc){return new Promise(function(_0x4efb95,_0x555296){if(_0x30d1cc[_0x2af7('0x67')])return _0x4efb95(_0x30d1cc);return db[_0x2af7('0x68')][_0x2af7('0x69')](0x1)[_0x2af7('0x2f')](function(_0x2a3d12){if(_0x2a3d12['securePassword'])authService[_0x2af7('0x6a')](_0x30d1cc[_0x2af7('0x6b')]);db['User']['max'](_0x2af7('0x67'))[_0x2af7('0x2f')](function(_0x27161c){if(_[_0x2af7('0x6c')](_0x27161c)){_0x30d1cc['internal']=_0x2a3d12[_0x2af7('0x6d')]||0x1;return;}if(_[_0x2af7('0x6c')](_0x2a3d12[_0x2af7('0x6d')])||_0x2a3d12[_0x2af7('0x6d')]===_0x27161c){_0x30d1cc[_0x2af7('0x67')]=_0x27161c+0x1;return;}if(_0x2a3d12[_0x2af7('0x6d')]>_0x27161c){_0x30d1cc['internal']=_0x2a3d12[_0x2af7('0x6d')];return;}return db['sequelize'][_0x2af7('0x4a')](_0x2af7('0x6e'),{'type':db[_0x2af7('0x6f')]['QueryTypes'][_0x2af7('0x70')]})[_0x2af7('0x2f')](function(_0x2ea3fc){if(_0x2ea3fc&&_0x2ea3fc['length']){for(var _0x3da8cc=0x0,_0x50f0ea=_0x2ea3fc[_0x2af7('0x53')];_0x3da8cc<_0x50f0ea&&_['isNil'](_0x30d1cc[_0x2af7('0x67')]);_0x3da8cc++){if(_0x2a3d12[_0x2af7('0x6d')]<=_0x2ea3fc[_0x3da8cc][_0x2af7('0x71')]){_0x30d1cc[_0x2af7('0x67')]=_0x2ea3fc[_0x3da8cc][_0x2af7('0x71')];}else if(_0x2a3d12[_0x2af7('0x6d')]>_0x2ea3fc[_0x3da8cc][_0x2af7('0x71')]&&_0x2a3d12[_0x2af7('0x6d')]<=_0x2ea3fc[_0x3da8cc]['to']){_0x30d1cc[_0x2af7('0x67')]=_0x2a3d12['min_internal'];}}}if(_[_0x2af7('0x6c')](_0x30d1cc['internal'])){_0x30d1cc[_0x2af7('0x67')]=_0x27161c+0x1;}return _0x4efb95(_0x30d1cc);});});})[_0x2af7('0x59')](function(_0x3d4c27){_0x555296(_0x3d4c27);});});}function updateUser(_0x59212c){return new Promise(function(_0x194262,_0xed8432){try{if(_0x59212c[_0x2af7('0x72')]){_0x59212c['mailbox']=_0x59212c[_0x2af7('0x67')];_0x59212c[_0x2af7('0x73')]={'mailbox':_0x59212c['internal'],'password':_0x59212c[_0x2af7('0x6b')],'fullname':_0x59212c[_0x2af7('0x74')],'email':_0x59212c[_0x2af7('0x75')]};}if(_0x59212c[_0x2af7('0x30')]===_0x2af7('0x31')){if(!_0x59212c[_0x2af7('0x76')])_0x59212c['permissions']=[_0x2af7('0x77'),'102','103',_0x2af7('0x78'),_0x2af7('0x79'),'104',_0x2af7('0x7a'),_0x2af7('0x7b'),'107','108',_0x2af7('0x7c'),'100',_0x2af7('0x7d'),_0x2af7('0x7e'),_0x2af7('0x7f')];}_0x194262(_0x59212c);}catch(_0x1d20d9){_0xed8432(_0x1d20d9);}});}exports[_0x2af7('0x80')]=function(_0x2f5689,_0x4c5c49){if(_0x2f5689['user'][_0x2af7('0x30')]===_0x2af7('0x31'))throw new Error(_0x2af7('0x81'));if(_0x2f5689[_0x2af7('0x62')][_0x2af7('0x30')]==='user'&&_0x2f5689['user'][_0x2af7('0x30')]!==_0x2af7('0x34')){throw new Error(_0x2af7('0x82'));}if(_0x2f5689[_0x2af7('0x62')][_0x2af7('0x30')]===_0x2af7('0x34')&&_0x2f5689['user'][_0x2af7('0x30')]!==_0x2af7('0x34')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator');}return licenseUtil[_0x2af7('0x83')]([_0x2f5689[_0x2af7('0x62')]])[_0x2af7('0x2f')](function(){return validateUser(_0x2f5689[_0x2af7('0x62')]);})[_0x2af7('0x2f')](function(_0x1aba54){return updateUser(_0x1aba54)[_0x2af7('0x2f')](function(_0x5e35ae){if(_0x5e35ae[_0x2af7('0x30')]==='admin'){_0x5e35ae[_0x2af7('0x84')]=_0x2f5689[_0x2af7('0x85')][_0x2af7('0x84')];delete _0x5e35ae[_0x2af7('0x86')];}return _0x5e35ae;});})['then'](function(_0x430ff6){return db['User'][_0x2af7('0x80')](_0x430ff6,{'include':[{'model':db[_0x2af7('0x73')],'as':_0x2af7('0x73')}]});})[_0x2af7('0x2f')](function(_0x1f53c7){if(_0x2f5689[_0x2af7('0x62')][_0x2af7('0x30')]===_0x2af7('0x85'))return _0x1f53c7;if(_0x2f5689[_0x2af7('0x85')][_0x2af7('0x30')]!==_0x2af7('0x85'))return _0x1f53c7;return db[_0x2af7('0x87')]['find']({'where':{'name':_0x1f53c7[_0x2af7('0x30')]===_0x2af7('0x31')?_0x2af7('0x88'):_0x2af7('0x89'),'userProfileId':_0x2f5689[_0x2af7('0x85')][_0x2af7('0x86')]},'raw':!![]})[_0x2af7('0x2f')](function(_0x2ca1c5){if(!_0x2ca1c5||_0x2ca1c5['autoAssociation']!=0x0)return _0x1f53c7;return db[_0x2af7('0x3a')][_0x2af7('0x80')]({'name':_0x1f53c7[_0x2af7('0x39')],'resourceId':_0x1f53c7['id'],'type':_0x2ca1c5[_0x2af7('0x39')],'sectionId':_0x2ca1c5['id']},{})[_0x2af7('0x2f')](function(){return _0x1f53c7;});})[_0x2af7('0x59')](function(_0x448f11){logger[_0x2af7('0x2b')](_0x2af7('0x8a'),_0x448f11);throw _0x448f11;});})['then'](respondWithResult(_0x4c5c49,0xc9))[_0x2af7('0x59')](handleError(_0x4c5c49,null));};exports['bulkCreate']=function(_0x3a1de8,_0x4edaad){var _0x58884e=_0x3a1de8[_0x2af7('0x62')];var _0x30fe95=[];if(_0x3a1de8['user'][_0x2af7('0x30')]===_0x2af7('0x31'))throw new Error(_0x2af7('0x81'));if(_[_0x2af7('0x8b')](_0x58884e,[_0x2af7('0x30'),_0x2af7('0x85')])&&_0x3a1de8[_0x2af7('0x85')][_0x2af7('0x30')]!==_0x2af7('0x34')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_[_0x2af7('0x8b')](_0x58884e,[_0x2af7('0x30'),'admin'])&&_0x3a1de8['user']['role']!=='admin'){throw new Error(_0x2af7('0x8c'));}return licenseUtil[_0x2af7('0x83')](_0x58884e)[_0x2af7('0x2f')](function(){return validateUser(_0x58884e[0x0]);})['then'](function(){for(var _0x4f90d2=0x1;_0x4f90d2<_0x58884e[_0x2af7('0x53')];_0x4f90d2++){var _0x47c14b=_0x58884e[_0x4f90d2-0x1]['internal'];if(!_0x58884e[_0x4f90d2]['internal'])_0x58884e[_0x4f90d2]['internal']=_0x47c14b+0x1;_0x30fe95[_0x2af7('0x4f')](validateUser(_0x58884e[_0x4f90d2]));}return Promise[_0x2af7('0x58')](_0x30fe95);})[_0x2af7('0x2f')](function(){_0x30fe95=[];for(var _0xb55667=0x0;_0xb55667<_0x58884e[_0x2af7('0x53')];_0xb55667++){_0x30fe95[_0x2af7('0x4f')](updateUser(_0x58884e[_0xb55667]));}return Promise[_0x2af7('0x58')](_0x30fe95);})[_0x2af7('0x2f')](function(){_0x30fe95=_0x58884e[_0x2af7('0x36')](function(_0x52f642){return db['User']['create'](_0x52f642,{'include':[{'model':db['VoiceMail'],'as':_0x2af7('0x73')}]})[_0x2af7('0x2f')](function(_0xec16f8){_0x52f642['id']=_0xec16f8['id'];return _0x52f642;});});return Promise[_0x2af7('0x58')](_0x30fe95);})[_0x2af7('0x2f')](function(_0x5dddd1){if(_0x3a1de8[_0x2af7('0x62')]['role']==='user')return _0x5dddd1;if(_0x3a1de8[_0x2af7('0x85')][_0x2af7('0x30')]!==_0x2af7('0x85'))return _0x5dddd1;var _0x4ca0af=_[_0x2af7('0x8b')](_0x5dddd1,function(_0x4faeeb){return _0x4faeeb[_0x2af7('0x30')]===_0x2af7('0x31')||_0x4faeeb[_0x2af7('0x30')]===_0x2af7('0x8d');});if(!_0x4ca0af)return _0x5dddd1;return db[_0x2af7('0x87')]['findAll']({'where':{'name':{'$or':['Agents',_0x2af7('0x89')]},'userProfileId':_0x3a1de8[_0x2af7('0x85')][_0x2af7('0x86')]},'raw':!![]})[_0x2af7('0x2f')](function(_0x51d8dd){if(_[_0x2af7('0x8e')](_0x51d8dd)||!_['some'](_0x51d8dd,[_0x2af7('0x8f'),0x0]))return _0x5dddd1;_0x30fe95=[];var _0x11c3b8=_(_0x51d8dd)[_0x2af7('0x36')](function(_0x30d24a){if(_0x30d24a['autoAssociation']===0x1)return;return _0x30d24a[_0x2af7('0x39')]===_0x2af7('0x88')?'agent':_0x2af7('0x8d');})['compact']()[_0x2af7('0x37')]();for(var _0x47c865=0x0;_0x47c865<_0x5dddd1[_0x2af7('0x53')];_0x47c865++){if(!_[_0x2af7('0x38')](_0x11c3b8,_0x5dddd1[_0x47c865][_0x2af7('0x30')]))return;var _0x57c8ee=_0x5dddd1[_0x47c865][_0x2af7('0x30')]===_0x2af7('0x31')?_0x2af7('0x88'):_0x2af7('0x89');_0x30fe95[_0x2af7('0x4f')](db['UserProfileResource'][_0x2af7('0x80')]({'name':_0x5dddd1[_0x47c865][_0x2af7('0x39')],'resourceId':_0x5dddd1[_0x47c865]['id'],'type':_0x57c8ee,'sectionId':_[_0x2af7('0x63')](_0x51d8dd,[_0x2af7('0x39'),_0x57c8ee])['id']},{}));}return Promise[_0x2af7('0x58')](_0x30fe95);});})['then'](respondWithResult(_0x4edaad,0xc9))[_0x2af7('0x59')](handleError(_0x4edaad,null));};exports[_0x2af7('0x90')]=function(_0x2331e8,_0x187ad8){if(_0x2331e8['body']['id']){delete _0x2331e8[_0x2af7('0x62')]['id'];}return db[_0x2af7('0x3e')][_0x2af7('0x63')]({'where':{'id':_0x2331e8[_0x2af7('0x5b')]['id']}})[_0x2af7('0x2f')](function(_0x232ec1){if(!_0x232ec1)return null;if(_0x232ec1['id']===_0x2331e8[_0x2af7('0x85')]['id']){if(!_0x2331e8[_0x2af7('0x62')][_0x2af7('0x91')]||!_0x2331e8[_0x2af7('0x62')][_0x2af7('0x92')]){throw new db['Sequelize'][(_0x2af7('0x93'))](_0x2af7('0x94'));}if(!_0x232ec1[_0x2af7('0x95')](_0x2331e8[_0x2af7('0x62')]['oldPassword'])){throw new db['Sequelize'][(_0x2af7('0x93'))]('Wrong\x20credentials');}if(_0x2331e8[_0x2af7('0x62')][_0x2af7('0x91')]===_0x2331e8[_0x2af7('0x62')][_0x2af7('0x92')]){throw new db[(_0x2af7('0x96'))][(_0x2af7('0x93'))](_0x2af7('0x97'));}}else if(_0x2331e8['user'][_0x2af7('0x30')]===_0x2af7('0x34')){if(!_0x2331e8[_0x2af7('0x62')][_0x2af7('0x92')]){throw new db[(_0x2af7('0x96'))][(_0x2af7('0x93'))](_0x2af7('0x98'));}}else if(_0x2331e8[_0x2af7('0x85')][_0x2af7('0x30')]==='user'){if(!_0x2331e8['body']['newPassword']){throw new db[(_0x2af7('0x96'))][(_0x2af7('0x93'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}if(_0x232ec1[_0x2af7('0x30')]!=='agent'){throw new db['Sequelize'][(_0x2af7('0x93'))](_0x2af7('0x81'));}}else{throw new db[(_0x2af7('0x96'))][(_0x2af7('0x93'))]('Unauthorized');}return _0x232ec1;})[_0x2af7('0x2f')](handleEntityNotFound(_0x187ad8,null))['then'](function(_0x1657c3){return db[_0x2af7('0x68')][_0x2af7('0x99')]({'attributes':['id',_0x2af7('0x9a'),_0x2af7('0x9b'),_0x2af7('0x9c')]})[_0x2af7('0x2f')](function(_0x22dfe1){if(_0x22dfe1['securePassword'])authService[_0x2af7('0x6a')](_0x2331e8[_0x2af7('0x62')][_0x2af7('0x92')]);if(!_0x22dfe1['enforcePasswordHistory']||!_0x1657c3[_0x2af7('0x42')])return _0x1657c3;authService[_0x2af7('0x9d')](_0x2331e8[_0x2af7('0x62')][_0x2af7('0x92')],_0x1657c3[_0x2af7('0x42')],_0x22dfe1[_0x2af7('0x9c')]);return _0x1657c3;})[_0x2af7('0x2f')](saveUpdates({'password':_0x2331e8[_0x2af7('0x62')][_0x2af7('0x92')],'passwordResetAt':_0x2331e8[_0x2af7('0x85')]['id']==_0x2331e8[_0x2af7('0x5b')]['id']?moment():null,'previousPasswords':authService[_0x2af7('0x9e')](_0x2331e8[_0x2af7('0x62')][_0x2af7('0x92')],_0x1657c3['previousPasswords'])},null));})['then'](respondWithResult(_0x187ad8,null))[_0x2af7('0x59')](handleError(_0x187ad8,null));};exports[_0x2af7('0x9f')]=function(_0x367e3a,_0x4a6851){var _0x5c4ac0=_0x367e3a[_0x2af7('0x62')][_0x2af7('0xa0')];return db['User'][_0x2af7('0x63')]({'where':{'id':_0x367e3a[_0x2af7('0x5b')]['id']},'attributes':['id',_0x2af7('0x39'),_0x2af7('0x30'),_0x2af7('0xa1'),_0x2af7('0xa2'),'voicePause',_0x2af7('0xa3')]})[_0x2af7('0x2f')](handleEntityNotFound(_0x4a6851,null))[_0x2af7('0x2f')](function(_0x4f8826){if(_0x4f8826){if(!utils[_0x2af7('0xa4')](_0x5c4ac0)){throw new db[(_0x2af7('0x96'))][(_0x2af7('0x93'))](_0x2af7('0xa5'));}return _0x4f8826[_0x2af7('0xa6')+_[_0x2af7('0xa7')](_0x5c4ac0[_0x2af7('0xa8')]())+'Queues'](_0x367e3a[_0x2af7('0x62')][_0x2af7('0x66')],{'penalty':_0x367e3a[_0x2af7('0x62')][_0x2af7('0xa9')]||0x0})['spread'](function(_0x34c9c7){for(var _0xe637de=0x0;_0xe637de<_0x367e3a[_0x2af7('0x62')][_0x2af7('0x66')][_0x2af7('0x53')];_0xe637de+=0x1){var _0x3b9708={'UserId':Number(_0x367e3a[_0x2af7('0x5b')]['id'])};_0x3b9708[_[_0x2af7('0xa7')](_0x5c4ac0['toLowerCase']())+_0x2af7('0xaa')]=Number(_0x367e3a[_0x2af7('0x62')][_0x2af7('0x66')][_0xe637de]);socket[_0x2af7('0x32')](_0x2af7('0x85')+_[_0x2af7('0xa7')](_0x5c4ac0[_0x2af7('0xa8')]())+'Queue:save',_0x3b9708);}return _0x34c9c7;})[_0x2af7('0x2f')](function(){if(_0x5c4ac0==='voice'){return db['VoiceQueue'][_0x2af7('0x50')]({'where':{'id':_0x367e3a[_0x2af7('0x62')][_0x2af7('0x66')]||[]},'raw':!![],'attributes':['id','name']});}})[_0x2af7('0x2f')](function(_0x460599){var _0x1562ec=_0x4f8826[_0x2af7('0x33')]({'plain':!![]});var _0x2b5338=[];if(_0x5c4ac0===_0x2af7('0xab')&&_0x1562ec[_0x2af7('0x30')]===_0x2af7('0x31')&&_0x1562ec[_0x2af7('0xa1')]){for(let _0x4100fe=0x0;_0x4100fe<_0x460599[_0x2af7('0x53')];_0x4100fe+=0x1){_0x2b5338[_0x2af7('0x4f')]({'membername':_0x1562ec[_0x2af7('0x39')],'UserId':_0x1562ec['id'],'queue_name':_0x460599[_0x4100fe][_0x2af7('0x39')],'VoiceQueueId':_0x460599[_0x4100fe]['id'],'interface':_[_0x2af7('0x6c')](_0x1562ec['interface'])?util['format'](_0x2af7('0xac'),_0x1562ec[_0x2af7('0x39')]):_0x1562ec[_0x2af7('0xa3')],'paused':_0x1562ec[_0x2af7('0xad')]||![],'penalty':_0x367e3a['body']['penalty']||0x0});}return Promise[_0x2af7('0x58')](_0x2b5338[_0x2af7('0x36')](function(_0x1950ae){return db[_0x2af7('0xae')][_0x2af7('0xaf')](_0x1950ae);}));}return _0x4f8826;});}})['then'](respondWithStatusCode(_0x4a6851,null))[_0x2af7('0x59')](handleError(_0x4a6851,null));};exports[_0x2af7('0xb0')]=function(_0x256006,_0x1236da){var _0x1fa8cb,_0x811bb8;return db[_0x2af7('0x3e')][_0x2af7('0x63')]({'where':{'id':_0x256006['params']['id']},'attributes':['id',_0x2af7('0x39'),_0x2af7('0x30')]})['then'](handleEntityNotFound(_0x1236da,null))[_0x2af7('0x2f')](function(_0x545989){if(_0x545989){_0x1fa8cb=_0x545989;if(!_0x256006[_0x2af7('0x4a')][_0x2af7('0xa0')]||!utils[_0x2af7('0xa4')](_0x256006[_0x2af7('0x4a')][_0x2af7('0xa0')])){throw new db[(_0x2af7('0x96'))][(_0x2af7('0x93'))](_0x2af7('0xa5'));}return _0x545989[_0x2af7('0xb1')+_[_0x2af7('0xa7')](_0x256006['query'][_0x2af7('0xa0')][_0x2af7('0xa8')]())+_0x2af7('0xb2')](_0x256006[_0x2af7('0x4a')][_0x2af7('0x66')]);}})['then'](function(_0x30c517){if(_[_0x2af7('0xb3')](_0x256006[_0x2af7('0x4a')][_0x2af7('0x66')])){for(var _0x240985=0x0;_0x240985<_0x256006[_0x2af7('0x4a')][_0x2af7('0x66')][_0x2af7('0x53')];_0x240985+=0x1){_0x811bb8={'UserId':Number(_0x256006[_0x2af7('0x5b')]['id'])};_0x811bb8[_[_0x2af7('0xa7')](_0x256006[_0x2af7('0x4a')]['channel'][_0x2af7('0xa8')]())+_0x2af7('0xaa')]=Number(_0x256006[_0x2af7('0x4a')][_0x2af7('0x66')][_0x240985]);socket[_0x2af7('0x32')](_0x2af7('0x85')+_[_0x2af7('0xa7')](_0x256006[_0x2af7('0x4a')][_0x2af7('0xa0')][_0x2af7('0xa8')]())+_0x2af7('0xb4'),_0x811bb8);}}else{_0x811bb8={'UserId':Number(_0x256006[_0x2af7('0x5b')]['id'])};_0x811bb8[_[_0x2af7('0xa7')](_0x256006[_0x2af7('0x4a')][_0x2af7('0xa0')][_0x2af7('0xa8')]())+_0x2af7('0xaa')]=Number(_0x256006[_0x2af7('0x4a')][_0x2af7('0x66')]);socket[_0x2af7('0x32')](_0x2af7('0x85')+_['capitalize'](_0x256006[_0x2af7('0x4a')][_0x2af7('0xa0')][_0x2af7('0xa8')]())+'Queue:remove',_0x811bb8);}return _0x30c517;})[_0x2af7('0x2f')](function(){if(_0x256006[_0x2af7('0x4a')][_0x2af7('0xa0')]===_0x2af7('0xab')){return db[_0x2af7('0xae')]['destroy']({'where':{'UserId':_0x256006['params']['id'],'VoiceQueueId':_0x256006[_0x2af7('0x4a')][_0x2af7('0x66')]},'individualHooks':!![]})[_0x2af7('0x2f')](function(){return _0x1fa8cb;});}return _0x1fa8cb;})['then'](respondWithStatusCode(_0x1236da,null))[_0x2af7('0x59')](handleError(_0x1236da,null));};exports[_0x2af7('0xb5')]=function(_0x266f13,_0x5612a4){_0x266f13[_0x2af7('0x62')][_0x2af7('0xb6')]=_0x266f13[_0x2af7('0xb7')]['filename'];return db[_0x2af7('0x3e')][_0x2af7('0x63')]({'where':{'id':_0x266f13[_0x2af7('0x5b')]['id']}})[_0x2af7('0x2f')](handleEntityNotFound(_0x5612a4,null))[_0x2af7('0x2f')](saveUpdates(_0x266f13['body'],null))[_0x2af7('0x2f')](respondWithResult(_0x5612a4,null))[_0x2af7('0x59')](handleError(_0x5612a4,null));};exports[_0x2af7('0xb8')]=function(_0x234c2a,_0x15dc18){var _0x124c56=path[_0x2af7('0xb9')](config[_0x2af7('0xba')],'server/files/images/logos/default_profile.png');return db[_0x2af7('0x3e')][_0x2af7('0x63')]({'where':{'id':_0x234c2a['params']['id']},'attributes':['id',_0x2af7('0xb6')],'raw':!![]})[_0x2af7('0x2f')](handleEntityNotFound(_0x15dc18,null))[_0x2af7('0x2f')](function(_0x2cfd86){if(_0x2cfd86){if(_[_0x2af7('0x6c')](_0x2cfd86[_0x2af7('0xb6')])){return _0x15dc18[_0x2af7('0xbb')](_0x124c56);}else{if(!fs[_0x2af7('0xbc')](path[_0x2af7('0xb9')](config[_0x2af7('0xba')],_0x2af7('0xbd'),_0x2cfd86[_0x2af7('0xb6')]))){return _0x15dc18[_0x2af7('0xbb')](_0x124c56);}return _0x15dc18[_0x2af7('0xbb')](path[_0x2af7('0xb9')](config[_0x2af7('0xba')],_0x2af7('0xbd'),_0x2cfd86[_0x2af7('0xb6')]));}}})[_0x2af7('0x59')](handleError(_0x15dc18,null));};exports[_0x2af7('0xbe')]=function(_0x4e9d17,_0x289d97){return db[_0x2af7('0x3e')][_0x2af7('0x63')]({'where':{'id':_0x4e9d17[_0x2af7('0x5b')]['id']},'attributes':['id']})[_0x2af7('0x2f')](handleEntityNotFound(_0x289d97,null))['then'](function(_0x41fef9){var _0x3b914c=[];values=_0x41fef9[_0x2af7('0x54')];_0x3b914c['push'](get_open_tabs('chat',_0x41fef9['dataValues']));_0x3b914c['push'](get_open_tabs(_0x2af7('0x60'),_0x41fef9['dataValues']));_0x3b914c[_0x2af7('0x4f')](get_open_tabs(_0x2af7('0x57'),_0x41fef9['dataValues']));_0x3b914c[_0x2af7('0x4f')](get_open_tabs('whatsapp',_0x41fef9['dataValues']));_0x3b914c[_0x2af7('0x4f')](get_open_tabs('fax',_0x41fef9['dataValues']));_0x3b914c[_0x2af7('0x4f')](get_open_tabs(_0x2af7('0x56'),_0x41fef9[_0x2af7('0x54')]));return Promise[_0x2af7('0x58')](_0x3b914c);})['then'](function(_0x3900a){if(_0x3900a){var _0x1d0158=_[_0x2af7('0x36')](values[_0x2af7('0xbf')],function(_0x3a27db){return{'channel':_0x2af7('0xc0'),'id':_0x3a27db['id'],'createdAt':_0x3a27db[_0x2af7('0xc1')]};});var _0x312445=_['map'](values['FaxOpenTabs'],function(_0x3d7b5a){return{'channel':_0x2af7('0xc2'),'id':_0x3d7b5a['id'],'createdAt':_0x3d7b5a[_0x2af7('0xc1')]};});var _0x5e1ea6=_[_0x2af7('0x36')](values[_0x2af7('0xc3')],function(_0x58c262){return{'channel':_0x2af7('0xc4'),'id':_0x58c262['id'],'createdAt':_0x58c262['createdAt']};});var _0x12bd71=_[_0x2af7('0x36')](values['MailOpenTabs'],function(_0x312501){return{'channel':_0x2af7('0xc5'),'id':_0x312501['id'],'createdAt':_0x312501['createdAt']};});var _0x22d64f=_[_0x2af7('0x36')](values[_0x2af7('0xc6')],function(_0x39e8ee){return{'channel':'SMS','id':_0x39e8ee['id'],'createdAt':_0x39e8ee[_0x2af7('0xc1')]};});var _0x4d9221=_[_0x2af7('0x36')](values[_0x2af7('0xc7')],function(_0x500775){return{'channel':_0x2af7('0xc8'),'id':_0x500775['id'],'createdAt':_0x500775['createdAt']};});var _0x44da4d=_[_0x2af7('0xc9')](_0x1d0158,_0x312445,_0x5e1ea6,_0x12bd71,_0x22d64f,_0x4d9221);var _0xeb323e={'count':_0x44da4d[_0x2af7('0x53')],'rows':_0x44da4d};return _0xeb323e;}else return null;})[_0x2af7('0x2f')](respondWithResult(_0x289d97,null))['catch'](handleError(_0x289d97,null));};exports['getContacts']=function(_0x83f250,_0x343a01){var _0x329c09={};return db[_0x2af7('0x3e')][_0x2af7('0x99')]({'where':{'id':_0x83f250['params']['id']}})[_0x2af7('0x2f')](function(_0x4d3807){if(!_0x4d3807){throw new APINotFoundError(util['format']('User\x20with\x20id\x20%s\x20not\x20found',_0x83f250[_0x2af7('0x5b')]['id']));}return contacts[_0x2af7('0x64')]();})[_0x2af7('0x2f')](function(_0x34d9fe){_0x83f250[_0x2af7('0x4a')][_0x2af7('0x3e')]=_0x83f250[_0x2af7('0x5b')]['id'];_0x329c09=qs['getOptions'](_0x34d9fe,_0x83f250);if(_0x83f250[_0x2af7('0x4a')]['hasOwnProperty'](_0x2af7('0x5c'))){_0x329c09['include']=[{'model':db[_0x2af7('0xca')],'as':_0x2af7('0xcb'),'required':![]},{'model':db[_0x2af7('0xcc')],'as':_0x2af7('0xcd'),'attributes':['id',_0x2af7('0x39'),_0x2af7('0xce')],'where':_0x83f250[_0x2af7('0x4a')][_0x2af7('0xcf')]?{'id':_0x83f250[_0x2af7('0x4a')][_0x2af7('0xcf')]}:undefined,'required':_0x83f250[_0x2af7('0x4a')][_0x2af7('0xcf')]?!![]:![]}];}return contacts[_0x2af7('0x50')](_0x83f250[_0x2af7('0x4a')],_0x83f250[_0x2af7('0x85')],_0x329c09,_0x34d9fe);})[_0x2af7('0x2f')](respondWithFilteredResult(_0x343a01,_0x329c09))['catch'](APIHandleError(_0x343a01));};exports[_0x2af7('0xd0')]=function(_0x4bd264,_0x4ba851){var _0x331b06;var _0x4631d4={};var _0xd3bae4;return db[_0x2af7('0x3e')][_0x2af7('0x99')]({'where':{'id':_0x4bd264['params']['id']},'attributes':['id',_0x2af7('0x39'),'role']})[_0x2af7('0x2f')](handleEntityNotFound(_0x4ba851,null))[_0x2af7('0x2f')](function(_0x12433a){if(!utils[_0x2af7('0xa4')](_0x4bd264[_0x2af7('0x4a')]['channel'])){throw new db[(_0x2af7('0x96'))][(_0x2af7('0x93'))](_0x2af7('0xa5'));}_0x331b06=_0x12433a;var _0x2cc091={};_0x2cc091[_0x2af7('0xd1')]=_[_0x2af7('0xd2')](db[_[_0x2af7('0xa7')](_0x4bd264['query'][_0x2af7('0xa0')])+'Queue']['rawAttributes']);_0x2cc091[_0x2af7('0x4a')]=_[_0x2af7('0xd2')](_0x4bd264[_0x2af7('0x4a')]);_0x2cc091['filters']=_[_0x2af7('0xd3')](_0x2cc091[_0x2af7('0xd1')],_0x2cc091[_0x2af7('0x4a')]);_0x4631d4[_0x2af7('0x4e')]=_[_0x2af7('0xd3')](_0x2cc091['model'],qs[_0x2af7('0xd4')](_0x4bd264[_0x2af7('0x4a')]['fields']));_0x4631d4[_0x2af7('0x4e')]=_0x4631d4[_0x2af7('0x4e')][_0x2af7('0x53')]?_0x4631d4[_0x2af7('0x4e')]:_0x2cc091[_0x2af7('0xd1')];_0x4631d4[_0x2af7('0xd5')]=qs[_0x2af7('0xd6')](_0x4bd264['query'][_0x2af7('0xd6')]);_0x4631d4[_0x2af7('0x48')]=qs[_0x2af7('0xd7')](_['pick'](_0x4bd264[_0x2af7('0x4a')],_0x2cc091[_0x2af7('0xd7')]));if(_0x4bd264['query']['filter']){_0x4631d4[_0x2af7('0x48')]=_[_0x2af7('0x5e')](_0x4631d4[_0x2af7('0x48')],{'$or':_['map'](_0x4631d4[_0x2af7('0x4e')],function(_0x3688f3){var _0x1829c4={};_0x1829c4[_0x3688f3]={'$like':'%'+_0x4bd264[_0x2af7('0x4a')][_0x2af7('0x35')]+'%'};return _0x1829c4;})});}_0x4631d4=_[_0x2af7('0x5e')]({},_0x4631d4,_0x4bd264[_0x2af7('0x5f')]);switch(_0x331b06[_0x2af7('0x30')]){case'admin':return db[_[_0x2af7('0xa7')](_0x4bd264[_0x2af7('0x4a')][_0x2af7('0xa0')])+_0x2af7('0xd8')]['findAll'](_0x4631d4);case _0x2af7('0x85'):case'agent':return _0x331b06[_0x2af7('0x33')+_[_0x2af7('0xa7')](_0x4bd264['query'][_0x2af7('0xa0')])+_0x2af7('0xb2')](_0x4631d4);default:throw new db[(_0x2af7('0x96'))]['ValidationError'](_0x2af7('0xd9'));}})[_0x2af7('0x2f')](function(_0x2b0a0e){_0xd3bae4=_0x2b0a0e['length'];if(!_0x4bd264[_0x2af7('0x4a')][_0x2af7('0xda')](_0x2af7('0xdb'))){_0x4631d4[_0x2af7('0x22')]=qs['limit'](_0x4bd264[_0x2af7('0x4a')][_0x2af7('0x22')]);_0x4631d4[_0x2af7('0x20')]=qs[_0x2af7('0x20')](_0x4bd264['query'][_0x2af7('0x20')]);}switch(_0x331b06[_0x2af7('0x30')]){case'admin':return db[_[_0x2af7('0xa7')](_0x4bd264[_0x2af7('0x4a')][_0x2af7('0xa0')])+'Queue'][_0x2af7('0x50')](_0x4631d4);case'user':case _0x2af7('0x31'):return _0x331b06[_0x2af7('0x33')+_[_0x2af7('0xa7')](_0x4bd264[_0x2af7('0x4a')][_0x2af7('0xa0')])+_0x2af7('0xb2')](_0x4631d4);}})[_0x2af7('0x2f')](function(_0x5c0204){return{'count':_0xd3bae4,'rows':_0x5c0204};})[_0x2af7('0x2f')](respondWithResult(_0x4ba851,null))[_0x2af7('0x59')](handleError(_0x4ba851,null));};exports[_0x2af7('0xdc')]=function(_0x18402,_0x13fd09){var _0x49b381={};var _0x106eeb={};var _0x1c4c29;var _0x42e42d;return db['User'][_0x2af7('0x99')]({'where':{'id':_0x18402[_0x2af7('0x5b')]['id']}})[_0x2af7('0x2f')](handleEntityNotFound(_0x13fd09,null))[_0x2af7('0x2f')](function(_0x23e31b){if(_0x23e31b){_0x1c4c29=_0x23e31b;_0x106eeb[_0x2af7('0xd1')]=_[_0x2af7('0xd2')](db[_0x2af7('0xae')][_0x2af7('0x3f')]);_0x106eeb[_0x2af7('0x4a')]=_[_0x2af7('0xd2')](_0x18402[_0x2af7('0x4a')]);_0x106eeb[_0x2af7('0xd7')]=_[_0x2af7('0xd3')](_0x106eeb[_0x2af7('0xd1')],_0x106eeb[_0x2af7('0x4a')]);_0x49b381[_0x2af7('0x4e')]=_[_0x2af7('0xd3')](_0x106eeb['model'],qs['fields'](_0x18402[_0x2af7('0x4a')][_0x2af7('0xd4')]));_0x49b381[_0x2af7('0x4e')]=_0x49b381[_0x2af7('0x4e')][_0x2af7('0x53')]?_0x49b381['attributes']:_0x106eeb[_0x2af7('0xd1')];_0x49b381['order']=qs['sort'](_0x18402[_0x2af7('0x4a')][_0x2af7('0xd6')]);_0x49b381[_0x2af7('0x48')]=qs[_0x2af7('0xd7')](_[_0x2af7('0xdd')](_0x18402[_0x2af7('0x4a')],_0x106eeb[_0x2af7('0xd7')]));if(_0x18402[_0x2af7('0x4a')][_0x2af7('0x35')]){_0x49b381['where']=_[_0x2af7('0x5e')](_0x49b381[_0x2af7('0x48')],{'$or':_[_0x2af7('0x36')](_0x49b381[_0x2af7('0x4e')],function(_0xceaf05){var _0x1b3b5a={};_0x1b3b5a[_0xceaf05]={'$like':'%'+_0x18402[_0x2af7('0x4a')][_0x2af7('0x35')]+'%'};return _0x1b3b5a;})});}_0x49b381=_['merge']({},_0x49b381,_0x18402[_0x2af7('0x5f')]);return _0x1c4c29[_0x2af7('0xdc')](_0x49b381);}})[_0x2af7('0x2f')](function(_0x5f0384){if(_0x5f0384){_0x42e42d=_0x5f0384['length'];if(!_0x18402['query'][_0x2af7('0xda')](_0x2af7('0xdb'))){_0x49b381[_0x2af7('0x22')]=qs[_0x2af7('0x22')](_0x18402[_0x2af7('0x4a')]['limit']);_0x49b381[_0x2af7('0x20')]=qs[_0x2af7('0x20')](_0x18402['query'][_0x2af7('0x20')]);}return _0x1c4c29['getVoiceQueuesRt'](_0x49b381);}})[_0x2af7('0x2f')](function(_0x4b1a61){if(_0x4b1a61){return _0x4b1a61?{'count':_0x42e42d,'rows':_0x4b1a61}:null;}})['then'](respondWithResult(_0x13fd09,null))[_0x2af7('0x59')](handleError(_0x13fd09,null));};exports['getGroups']=function(_0x111b1e,_0x333a50){var _0x47e41c={};var _0x2654cf={};var _0x270ef6;var _0xb903ec;return db[_0x2af7('0x3e')][_0x2af7('0x99')]({'where':{'id':_0x111b1e['params']['id']}})[_0x2af7('0x2f')](handleEntityNotFound(_0x333a50,null))[_0x2af7('0x2f')](function(_0x47ad7c){if(_0x47ad7c){_0x270ef6=_0x47ad7c;_0x2654cf[_0x2af7('0xd1')]=_[_0x2af7('0xd2')](db['ChatGroup']['rawAttributes']);_0x2654cf[_0x2af7('0x4a')]=_[_0x2af7('0xd2')](_0x111b1e[_0x2af7('0x4a')]);_0x2654cf[_0x2af7('0xd7')]=_[_0x2af7('0xd3')](_0x2654cf['model'],_0x2654cf[_0x2af7('0x4a')]);_0x47e41c['attributes']=_['intersection'](_0x2654cf['model'],qs[_0x2af7('0xd4')](_0x111b1e[_0x2af7('0x4a')][_0x2af7('0xd4')]));_0x47e41c[_0x2af7('0x4e')]=_0x47e41c[_0x2af7('0x4e')][_0x2af7('0x53')]?_0x47e41c['attributes']:_0x2654cf[_0x2af7('0xd1')];_0x47e41c[_0x2af7('0xd5')]=qs[_0x2af7('0xd6')](_0x111b1e[_0x2af7('0x4a')][_0x2af7('0xd6')]);_0x47e41c['where']=qs['filters'](_[_0x2af7('0xdd')](_0x111b1e[_0x2af7('0x4a')],_0x2654cf[_0x2af7('0xd7')]));if(_0x111b1e[_0x2af7('0x4a')][_0x2af7('0x35')]){_0x47e41c['where']=_[_0x2af7('0x5e')](_0x47e41c[_0x2af7('0x48')],{'$or':_[_0x2af7('0x36')](_0x47e41c[_0x2af7('0x4e')],function(_0x1258ec){var _0x19535c={};_0x19535c[_0x1258ec]={'$like':'%'+_0x111b1e[_0x2af7('0x4a')][_0x2af7('0x35')]+'%'};return _0x19535c;})});}_0x47e41c=_[_0x2af7('0x5e')]({},_0x47e41c,_0x111b1e[_0x2af7('0x5f')]);return _0x270ef6['getGroups'](_0x47e41c);}})[_0x2af7('0x2f')](function(_0x2d39ed){if(_0x2d39ed){_0xb903ec=_0x2d39ed[_0x2af7('0x53')];if(!_0x111b1e['query'][_0x2af7('0xda')]('nolimit')){_0x47e41c[_0x2af7('0x22')]=qs[_0x2af7('0x22')](_0x111b1e[_0x2af7('0x4a')][_0x2af7('0x22')]);_0x47e41c[_0x2af7('0x20')]=qs['offset'](_0x111b1e[_0x2af7('0x4a')]['offset']);}return _0x270ef6['getGroups'](_0x47e41c);}})['then'](function(_0x3ded72){if(_0x3ded72){return _0x3ded72?{'count':_0xb903ec,'rows':_0x3ded72}:null;}})[_0x2af7('0x2f')](respondWithResult(_0x333a50,null))['catch'](handleError(_0x333a50,null));};exports[_0x2af7('0xde')]=function(_0x37e2a6,_0x533fe0){var _0x1518dc={'raw':!![],'where':{}};var _0x209c28={};var _0x44cc3f={'count':0x0,'rows':[]};return db[_0x2af7('0x3e')]['findOne']({'where':{'id':_0x37e2a6[_0x2af7('0x5b')]['id']}})[_0x2af7('0x2f')](handleEntityNotFound(_0x533fe0,null))[_0x2af7('0x2f')](function(_0x1f464f){if(_0x1f464f){_0x209c28['model']=_['keys'](db[_0x2af7('0xdf')][_0x2af7('0x3f')]);_0x209c28[_0x2af7('0x4a')]=_[_0x2af7('0xd2')](_0x37e2a6[_0x2af7('0x4a')]);_0x209c28[_0x2af7('0xd7')]=_[_0x2af7('0xd3')](_0x209c28[_0x2af7('0xd1')],_0x209c28[_0x2af7('0x4a')]);_0x1518dc[_0x2af7('0x4e')]=_[_0x2af7('0xd3')](_0x209c28[_0x2af7('0xd1')],qs[_0x2af7('0xd4')](_0x37e2a6[_0x2af7('0x4a')][_0x2af7('0xd4')]));_0x1518dc[_0x2af7('0x4e')]=_0x1518dc[_0x2af7('0x4e')][_0x2af7('0x53')]?_0x1518dc[_0x2af7('0x4e')]:_0x209c28[_0x2af7('0xd1')];if(!_0x37e2a6[_0x2af7('0x4a')]['hasOwnProperty'](_0x2af7('0xdb'))){_0x1518dc['limit']=qs['limit'](_0x37e2a6[_0x2af7('0x4a')][_0x2af7('0x22')]);_0x1518dc[_0x2af7('0x20')]=qs[_0x2af7('0x20')](_0x37e2a6[_0x2af7('0x4a')]['offset']);}_0x1518dc[_0x2af7('0xd5')]=qs[_0x2af7('0xd6')](_0x37e2a6[_0x2af7('0x4a')]['sort']);_0x1518dc['where']=qs[_0x2af7('0xd7')](_[_0x2af7('0xdd')](_0x37e2a6[_0x2af7('0x4a')],_0x209c28[_0x2af7('0xd7')]));_0x1518dc[_0x2af7('0x48')][_0x2af7('0xe0')]=_0x1f464f['id'];if(_0x37e2a6['query'][_0x2af7('0x35')]){_0x1518dc[_0x2af7('0x48')]=_[_0x2af7('0x5e')](_0x1518dc['where'],{'$or':_[_0x2af7('0x36')](_0x1518dc['attributes'],function(_0x246bee){var _0x11efd0={};_0x11efd0[_0x246bee]={'$like':'%'+_0x37e2a6[_0x2af7('0x4a')][_0x2af7('0x35')]+'%'};return _0x11efd0;})});}_0x1518dc=_[_0x2af7('0x5e')]({},_0x1518dc,_0x37e2a6[_0x2af7('0x5f')]);return db[_0x2af7('0xdf')][_0x2af7('0x49')]({'where':_0x1518dc[_0x2af7('0x48')]})[_0x2af7('0x2f')](function(_0x3df9e5){_0x44cc3f[_0x2af7('0x49')]=_0x3df9e5;if(_0x37e2a6[_0x2af7('0x4a')][_0x2af7('0x5c')]){_0x1518dc[_0x2af7('0x5d')]=[{'all':!![]}];}return db[_0x2af7('0xdf')][_0x2af7('0x50')](_0x1518dc);})[_0x2af7('0x2f')](function(_0x3f89c8){_0x44cc3f[_0x2af7('0x51')]=_0x3f89c8;return _0x44cc3f;});}})[_0x2af7('0x2f')](respondWithFilteredResult(_0x533fe0,_0x1518dc))[_0x2af7('0x59')](handleError(_0x533fe0,null));};exports[_0x2af7('0xe1')]=function(_0x38e26d,_0x4b305b){var _0x219b0d={'raw':!![],'where':{}};var _0x1770d2={};var _0x40a2c9={'count':0x0,'rows':[]};return db[_0x2af7('0x3e')][_0x2af7('0x99')]({'where':{'id':_0x38e26d[_0x2af7('0x5b')]['id']}})[_0x2af7('0x2f')](handleEntityNotFound(_0x4b305b,null))[_0x2af7('0x2f')](function(_0x4c7c54){if(_0x4c7c54){_0x1770d2[_0x2af7('0xd1')]=_[_0x2af7('0xd2')](db[_0x2af7('0xe2')][_0x2af7('0x3f')]);_0x1770d2[_0x2af7('0x4a')]=_['keys'](_0x38e26d[_0x2af7('0x4a')]);_0x1770d2['filters']=_[_0x2af7('0xd3')](_0x1770d2['model'],_0x1770d2['query']);_0x219b0d[_0x2af7('0x4e')]=_[_0x2af7('0xd3')](_0x1770d2[_0x2af7('0xd1')],qs[_0x2af7('0xd4')](_0x38e26d[_0x2af7('0x4a')][_0x2af7('0xd4')]));_0x219b0d[_0x2af7('0x4e')]=_0x219b0d[_0x2af7('0x4e')][_0x2af7('0x53')]?_0x219b0d[_0x2af7('0x4e')]:_0x1770d2[_0x2af7('0xd1')];if(!_0x38e26d[_0x2af7('0x4a')][_0x2af7('0xda')](_0x2af7('0xdb'))){_0x219b0d[_0x2af7('0x22')]=qs[_0x2af7('0x22')](_0x38e26d[_0x2af7('0x4a')]['limit']);_0x219b0d[_0x2af7('0x20')]=qs[_0x2af7('0x20')](_0x38e26d[_0x2af7('0x4a')][_0x2af7('0x20')]);}_0x219b0d[_0x2af7('0xd5')]=qs[_0x2af7('0xd6')](_0x38e26d[_0x2af7('0x4a')]['sort']);_0x219b0d[_0x2af7('0x48')]=qs['filters'](_[_0x2af7('0xdd')](_0x38e26d[_0x2af7('0x4a')],_0x1770d2[_0x2af7('0xd7')]));_0x219b0d[_0x2af7('0x48')]['UserId']=_0x4c7c54['id'];if(_0x38e26d[_0x2af7('0x4a')][_0x2af7('0x35')]){_0x219b0d[_0x2af7('0x48')]=_[_0x2af7('0x5e')](_0x219b0d['where'],{'$or':_[_0x2af7('0x36')](_0x219b0d[_0x2af7('0x4e')],function(_0x631524){var _0x5a7076={};_0x5a7076[_0x631524]={'$like':'%'+_0x38e26d[_0x2af7('0x4a')][_0x2af7('0x35')]+'%'};return _0x5a7076;})});}_0x219b0d=_[_0x2af7('0x5e')]({},_0x219b0d,_0x38e26d['options']);return db[_0x2af7('0xe2')]['count']({'where':_0x219b0d[_0x2af7('0x48')]})[_0x2af7('0x2f')](function(_0x3bac6e){_0x40a2c9[_0x2af7('0x49')]=_0x3bac6e;if(_0x38e26d[_0x2af7('0x4a')][_0x2af7('0x5c')]){_0x219b0d[_0x2af7('0x5d')]=[{'all':!![]}];}return db[_0x2af7('0xe2')][_0x2af7('0x50')](_0x219b0d);})['then'](function(_0x11e3bd){_0x40a2c9[_0x2af7('0x51')]=_0x11e3bd;return _0x40a2c9;});}})[_0x2af7('0x2f')](respondWithFilteredResult(_0x4b305b,_0x219b0d))[_0x2af7('0x59')](handleError(_0x4b305b,null));};exports[_0x2af7('0xe3')]=function(_0x20704c,_0x280d70){var _0x24975a={};var _0x1d2c9d={};var _0x5c7576;var _0x5d636f;return db[_0x2af7('0x3e')][_0x2af7('0x99')]({'where':{'id':_0x20704c[_0x2af7('0x5b')]['id']}})['then'](handleEntityNotFound(_0x280d70,null))[_0x2af7('0x2f')](function(_0x4fe12f){if(_0x4fe12f){_0x5c7576=_0x4fe12f;_0x1d2c9d[_0x2af7('0xd1')]=_[_0x2af7('0xd2')](db['ChatInteraction']['rawAttributes']);_0x1d2c9d[_0x2af7('0x4a')]=_[_0x2af7('0xd2')](_0x20704c[_0x2af7('0x4a')]);_0x1d2c9d[_0x2af7('0xd7')]=_['intersection'](_0x1d2c9d[_0x2af7('0xd1')],_0x1d2c9d[_0x2af7('0x4a')]);_0x24975a[_0x2af7('0x4e')]=_[_0x2af7('0xd3')](_0x1d2c9d['model'],qs[_0x2af7('0xd4')](_0x20704c['query'][_0x2af7('0xd4')]));_0x24975a[_0x2af7('0x4e')]=_0x24975a[_0x2af7('0x4e')]['length']?_0x24975a['attributes']:_0x1d2c9d[_0x2af7('0xd1')];_0x24975a['order']=qs[_0x2af7('0xd6')](_0x20704c[_0x2af7('0x4a')][_0x2af7('0xd6')]);_0x24975a[_0x2af7('0x48')]=qs['filters'](_['pick'](_0x20704c[_0x2af7('0x4a')],_0x1d2c9d['filters']));if(_0x20704c[_0x2af7('0x4a')][_0x2af7('0x35')]){_0x24975a['where']=_[_0x2af7('0x5e')](_0x24975a[_0x2af7('0x48')],{'$or':_[_0x2af7('0x36')](_0x24975a[_0x2af7('0x4e')],function(_0x37fabf){var _0x369b0f={};_0x369b0f[_0x37fabf]={'$like':'%'+_0x20704c['query'][_0x2af7('0x35')]+'%'};return _0x369b0f;})});}_0x24975a=_['merge']({},_0x24975a,_0x20704c[_0x2af7('0x5f')]);return _0x5c7576[_0x2af7('0xe3')](_0x24975a);}})[_0x2af7('0x2f')](function(_0x377a1a){if(_0x377a1a){_0x5d636f=_0x377a1a['length'];if(!_0x20704c[_0x2af7('0x4a')][_0x2af7('0xda')](_0x2af7('0xdb'))){_0x24975a[_0x2af7('0x22')]=qs[_0x2af7('0x22')](_0x20704c[_0x2af7('0x4a')][_0x2af7('0x22')]);_0x24975a[_0x2af7('0x20')]=qs[_0x2af7('0x20')](_0x20704c[_0x2af7('0x4a')][_0x2af7('0x20')]);}return _0x5c7576[_0x2af7('0xe3')](_0x24975a);}})[_0x2af7('0x2f')](function(_0x22e390){if(_0x22e390){return _0x22e390?{'count':_0x5d636f,'rows':_0x22e390}:null;}})['then'](respondWithResult(_0x280d70,null))[_0x2af7('0x59')](handleError(_0x280d70,null));};exports[_0x2af7('0xe4')]=function(_0xcd2967,_0x894d22){var _0x27375b={};var _0x160387={};var _0x3ec531;var _0x29cf91;return db[_0x2af7('0x3e')][_0x2af7('0x99')]({'where':{'id':_0xcd2967[_0x2af7('0x5b')]['id']}})[_0x2af7('0x2f')](handleEntityNotFound(_0x894d22,null))['then'](function(_0x191db7){if(_0x191db7){_0x3ec531=_0x191db7;_0x160387[_0x2af7('0xd1')]=_[_0x2af7('0xd2')](db[_0x2af7('0xe5')]['rawAttributes']);_0x160387['query']=_[_0x2af7('0xd2')](_0xcd2967[_0x2af7('0x4a')]);_0x160387['filters']=_['intersection'](_0x160387[_0x2af7('0xd1')],_0x160387[_0x2af7('0x4a')]);_0x27375b['attributes']=_[_0x2af7('0xd3')](_0x160387[_0x2af7('0xd1')],qs[_0x2af7('0xd4')](_0xcd2967['query'][_0x2af7('0xd4')]));_0x27375b[_0x2af7('0x4e')]=_0x27375b[_0x2af7('0x4e')][_0x2af7('0x53')]?_0x27375b[_0x2af7('0x4e')]:_0x160387[_0x2af7('0xd1')];_0x27375b[_0x2af7('0xd5')]=qs['sort'](_0xcd2967[_0x2af7('0x4a')][_0x2af7('0xd6')]);_0x27375b['where']=qs[_0x2af7('0xd7')](_[_0x2af7('0xdd')](_0xcd2967[_0x2af7('0x4a')],_0x160387[_0x2af7('0xd7')]));if(_0xcd2967[_0x2af7('0x4a')][_0x2af7('0x35')]){_0x27375b[_0x2af7('0x48')]=_[_0x2af7('0x5e')](_0x27375b[_0x2af7('0x48')],{'$or':_[_0x2af7('0x36')](_0x27375b[_0x2af7('0x4e')],function(_0x175f36){var _0x25749f={};_0x25749f[_0x175f36]={'$like':'%'+_0xcd2967[_0x2af7('0x4a')][_0x2af7('0x35')]+'%'};return _0x25749f;})});}_0x27375b=_['merge']({},_0x27375b,_0xcd2967[_0x2af7('0x5f')]);return _0x3ec531[_0x2af7('0xe4')](_0x27375b);}})[_0x2af7('0x2f')](function(_0x31220a){if(_0x31220a){_0x29cf91=_0x31220a[_0x2af7('0x53')];if(!_0xcd2967[_0x2af7('0x4a')][_0x2af7('0xda')](_0x2af7('0xdb'))){_0x27375b[_0x2af7('0x22')]=qs['limit'](_0xcd2967['query'][_0x2af7('0x22')]);_0x27375b[_0x2af7('0x20')]=qs[_0x2af7('0x20')](_0xcd2967[_0x2af7('0x4a')][_0x2af7('0x20')]);}return _0x3ec531[_0x2af7('0xe4')](_0x27375b);}})[_0x2af7('0x2f')](function(_0x474520){if(_0x474520){return _0x474520?{'count':_0x29cf91,'rows':_0x474520}:null;}})[_0x2af7('0x2f')](respondWithResult(_0x894d22,null))[_0x2af7('0x59')](handleError(_0x894d22,null));};exports['getMailInteractions']=function(_0x1a1d32,_0x26c71e){var _0x57abb7={'raw':!![],'where':{}};var _0x4eabba={};var _0x3fdb04={'count':0x0,'rows':[]};return db['User'][_0x2af7('0x99')]({'where':{'id':_0x1a1d32[_0x2af7('0x5b')]['id']}})[_0x2af7('0x2f')](handleEntityNotFound(_0x26c71e,null))[_0x2af7('0x2f')](function(_0x3f4411){if(_0x3f4411){_0x4eabba[_0x2af7('0xd1')]=_[_0x2af7('0xd2')](db[_0x2af7('0xe6')][_0x2af7('0x3f')]);_0x4eabba['query']=_['keys'](_0x1a1d32['query']);_0x4eabba[_0x2af7('0xd7')]=_[_0x2af7('0xd3')](_0x4eabba[_0x2af7('0xd1')],_0x4eabba[_0x2af7('0x4a')]);_0x57abb7[_0x2af7('0x4e')]=_[_0x2af7('0xd3')](_0x4eabba[_0x2af7('0xd1')],qs['fields'](_0x1a1d32[_0x2af7('0x4a')]['fields']));_0x57abb7['attributes']=_0x57abb7['attributes'][_0x2af7('0x53')]?_0x57abb7['attributes']:_0x4eabba['model'];if(!_0x1a1d32[_0x2af7('0x4a')]['hasOwnProperty'](_0x2af7('0xdb'))){_0x57abb7[_0x2af7('0x22')]=qs[_0x2af7('0x22')](_0x1a1d32[_0x2af7('0x4a')]['limit']);_0x57abb7[_0x2af7('0x20')]=qs[_0x2af7('0x20')](_0x1a1d32['query'][_0x2af7('0x20')]);}_0x57abb7[_0x2af7('0xd5')]=qs[_0x2af7('0xd6')](_0x1a1d32[_0x2af7('0x4a')]['sort']);_0x57abb7['where']=qs['filters'](_['pick'](_0x1a1d32[_0x2af7('0x4a')],_0x4eabba['filters']));_0x57abb7[_0x2af7('0x48')][_0x2af7('0xe0')]=_0x3f4411['id'];if(_0x1a1d32[_0x2af7('0x4a')][_0x2af7('0x35')]){_0x57abb7['where']=_[_0x2af7('0x5e')](_0x57abb7[_0x2af7('0x48')],{'$or':_[_0x2af7('0x36')](_0x57abb7['attributes'],function(_0x2f20ca){var _0x30d572={};_0x30d572[_0x2f20ca]={'$like':'%'+_0x1a1d32[_0x2af7('0x4a')]['filter']+'%'};return _0x30d572;})});}_0x57abb7=_[_0x2af7('0x5e')]({},_0x57abb7,_0x1a1d32['options']);return db['MailInteraction'][_0x2af7('0x49')]({'where':_0x57abb7[_0x2af7('0x48')]})['then'](function(_0x3950ee){_0x3fdb04[_0x2af7('0x49')]=_0x3950ee;if(_0x1a1d32[_0x2af7('0x4a')]['includeAll']){_0x57abb7[_0x2af7('0x5d')]=[{'all':!![]}];}return db['MailInteraction'][_0x2af7('0x50')](_0x57abb7);})[_0x2af7('0x2f')](function(_0x1df03f){_0x3fdb04[_0x2af7('0x51')]=_0x1df03f;return _0x3fdb04;});}})[_0x2af7('0x2f')](respondWithFilteredResult(_0x26c71e,_0x57abb7))['catch'](handleError(_0x26c71e,null));};exports['getSmsInteractions']=function(_0x3920a8,_0x1969cc){var _0x2592f9={};var _0x160a25={};var _0x7e9ed3;var _0x463e1d;return db[_0x2af7('0x3e')]['findOne']({'where':{'id':_0x3920a8['params']['id']}})[_0x2af7('0x2f')](handleEntityNotFound(_0x1969cc,null))[_0x2af7('0x2f')](function(_0x2fb668){if(_0x2fb668){_0x7e9ed3=_0x2fb668;_0x160a25[_0x2af7('0xd1')]=_[_0x2af7('0xd2')](db[_0x2af7('0xe7')][_0x2af7('0x3f')]);_0x160a25[_0x2af7('0x4a')]=_[_0x2af7('0xd2')](_0x3920a8[_0x2af7('0x4a')]);_0x160a25['filters']=_[_0x2af7('0xd3')](_0x160a25[_0x2af7('0xd1')],_0x160a25[_0x2af7('0x4a')]);_0x2592f9[_0x2af7('0x4e')]=_[_0x2af7('0xd3')](_0x160a25[_0x2af7('0xd1')],qs['fields'](_0x3920a8[_0x2af7('0x4a')][_0x2af7('0xd4')]));_0x2592f9[_0x2af7('0x4e')]=_0x2592f9[_0x2af7('0x4e')]['length']?_0x2592f9[_0x2af7('0x4e')]:_0x160a25[_0x2af7('0xd1')];_0x2592f9[_0x2af7('0xd5')]=qs[_0x2af7('0xd6')](_0x3920a8['query'][_0x2af7('0xd6')]);_0x2592f9[_0x2af7('0x48')]=qs['filters'](_[_0x2af7('0xdd')](_0x3920a8[_0x2af7('0x4a')],_0x160a25[_0x2af7('0xd7')]));if(_0x3920a8['query'][_0x2af7('0x35')]){_0x2592f9[_0x2af7('0x48')]=_[_0x2af7('0x5e')](_0x2592f9[_0x2af7('0x48')],{'$or':_[_0x2af7('0x36')](_0x2592f9[_0x2af7('0x4e')],function(_0x5927e7){var _0x28faa9={};_0x28faa9[_0x5927e7]={'$like':'%'+_0x3920a8[_0x2af7('0x4a')][_0x2af7('0x35')]+'%'};return _0x28faa9;})});}_0x2592f9=_['merge']({},_0x2592f9,_0x3920a8['options']);return _0x7e9ed3[_0x2af7('0xe8')](_0x2592f9);}})['then'](function(_0x41aa01){if(_0x41aa01){_0x463e1d=_0x41aa01[_0x2af7('0x53')];if(!_0x3920a8['query'][_0x2af7('0xda')](_0x2af7('0xdb'))){_0x2592f9[_0x2af7('0x22')]=qs['limit'](_0x3920a8[_0x2af7('0x4a')][_0x2af7('0x22')]);_0x2592f9[_0x2af7('0x20')]=qs['offset'](_0x3920a8['query'][_0x2af7('0x20')]);}return _0x7e9ed3['getSmsInteractions'](_0x2592f9);}})[_0x2af7('0x2f')](function(_0x322e9f){if(_0x322e9f){return _0x322e9f?{'count':_0x463e1d,'rows':_0x322e9f}:null;}})[_0x2af7('0x2f')](respondWithResult(_0x1969cc,null))[_0x2af7('0x59')](handleError(_0x1969cc,null));};exports['getFaxInteractions']=function(_0x305ff4,_0x332c0f){var _0x48793b={};var _0x385095={};var _0x546435;var _0x3d5720;return db['User'][_0x2af7('0x99')]({'where':{'id':_0x305ff4[_0x2af7('0x5b')]['id']}})['then'](handleEntityNotFound(_0x332c0f,null))[_0x2af7('0x2f')](function(_0x356c07){if(_0x356c07){_0x546435=_0x356c07;_0x385095[_0x2af7('0xd1')]=_['keys'](db[_0x2af7('0xe9')][_0x2af7('0x3f')]);_0x385095[_0x2af7('0x4a')]=_[_0x2af7('0xd2')](_0x305ff4[_0x2af7('0x4a')]);_0x385095[_0x2af7('0xd7')]=_[_0x2af7('0xd3')](_0x385095[_0x2af7('0xd1')],_0x385095[_0x2af7('0x4a')]);_0x48793b[_0x2af7('0x4e')]=_[_0x2af7('0xd3')](_0x385095[_0x2af7('0xd1')],qs[_0x2af7('0xd4')](_0x305ff4['query'][_0x2af7('0xd4')]));_0x48793b[_0x2af7('0x4e')]=_0x48793b[_0x2af7('0x4e')][_0x2af7('0x53')]?_0x48793b['attributes']:_0x385095['model'];_0x48793b[_0x2af7('0xd5')]=qs['sort'](_0x305ff4[_0x2af7('0x4a')][_0x2af7('0xd6')]);_0x48793b[_0x2af7('0x48')]=qs[_0x2af7('0xd7')](_['pick'](_0x305ff4[_0x2af7('0x4a')],_0x385095['filters']));if(_0x305ff4[_0x2af7('0x4a')][_0x2af7('0x35')]){_0x48793b[_0x2af7('0x48')]=_[_0x2af7('0x5e')](_0x48793b['where'],{'$or':_[_0x2af7('0x36')](_0x48793b[_0x2af7('0x4e')],function(_0x1e0218){var _0x228638={};_0x228638[_0x1e0218]={'$like':'%'+_0x305ff4[_0x2af7('0x4a')][_0x2af7('0x35')]+'%'};return _0x228638;})});}_0x48793b=_[_0x2af7('0x5e')]({},_0x48793b,_0x305ff4['options']);return _0x546435[_0x2af7('0xea')](_0x48793b);}})[_0x2af7('0x2f')](function(_0x21003f){if(_0x21003f){_0x3d5720=_0x21003f['length'];if(!_0x305ff4[_0x2af7('0x4a')][_0x2af7('0xda')](_0x2af7('0xdb'))){_0x48793b['limit']=qs[_0x2af7('0x22')](_0x305ff4['query'][_0x2af7('0x22')]);_0x48793b[_0x2af7('0x20')]=qs[_0x2af7('0x20')](_0x305ff4[_0x2af7('0x4a')]['offset']);}return _0x546435['getFaxInteractions'](_0x48793b);}})['then'](function(_0x568698){if(_0x568698){return _0x568698?{'count':_0x3d5720,'rows':_0x568698}:null;}})[_0x2af7('0x2f')](respondWithResult(_0x332c0f,null))['catch'](handleError(_0x332c0f,null));};exports[_0x2af7('0xeb')]=function(_0x329a88,_0x9da38b){var _0x22b658={};var _0x328635={};var _0x415081;var _0x4ea935;return db[_0x2af7('0x3e')][_0x2af7('0x99')]({'where':{'id':_0x329a88['params']['id']}})['then'](handleEntityNotFound(_0x9da38b,null))[_0x2af7('0x2f')](function(_0x47d8eb){if(_0x47d8eb){_0x415081=_0x47d8eb;_0x328635[_0x2af7('0xd1')]=_[_0x2af7('0xd2')](db[_0x2af7('0xec')][_0x2af7('0x3f')]);_0x328635[_0x2af7('0x4a')]=_[_0x2af7('0xd2')](_0x329a88['query']);_0x328635[_0x2af7('0xd7')]=_[_0x2af7('0xd3')](_0x328635[_0x2af7('0xd1')],_0x328635[_0x2af7('0x4a')]);_0x22b658[_0x2af7('0x4e')]=_[_0x2af7('0xd3')](_0x328635[_0x2af7('0xd1')],qs['fields'](_0x329a88['query'][_0x2af7('0xd4')]));_0x22b658['attributes']=_0x22b658[_0x2af7('0x4e')][_0x2af7('0x53')]?_0x22b658[_0x2af7('0x4e')]:_0x328635[_0x2af7('0xd1')];_0x22b658['order']=qs[_0x2af7('0xd6')](_0x329a88['query'][_0x2af7('0xd6')]);_0x22b658['where']=qs['filters'](_['pick'](_0x329a88['query'],_0x328635[_0x2af7('0xd7')]));if(_0x329a88[_0x2af7('0x4a')][_0x2af7('0x35')]){_0x22b658[_0x2af7('0x48')]=_[_0x2af7('0x5e')](_0x22b658[_0x2af7('0x48')],{'$or':_[_0x2af7('0x36')](_0x22b658[_0x2af7('0x4e')],function(_0x567230){var _0xbddb92={};_0xbddb92[_0x567230]={'$like':'%'+_0x329a88['query'][_0x2af7('0x35')]+'%'};return _0xbddb92;})});}_0x22b658=_[_0x2af7('0x5e')]({},_0x22b658,_0x329a88[_0x2af7('0x5f')]);return _0x415081['getWhatsappInteractions'](_0x22b658);}})['then'](function(_0x5c7d2e){if(_0x5c7d2e){_0x4ea935=_0x5c7d2e[_0x2af7('0x53')];if(!_0x329a88[_0x2af7('0x4a')][_0x2af7('0xda')](_0x2af7('0xdb'))){_0x22b658[_0x2af7('0x22')]=qs['limit'](_0x329a88[_0x2af7('0x4a')][_0x2af7('0x22')]);_0x22b658[_0x2af7('0x20')]=qs['offset'](_0x329a88[_0x2af7('0x4a')]['offset']);}return _0x415081[_0x2af7('0xeb')](_0x22b658);}})['then'](function(_0x4b94c3){if(_0x4b94c3){return _0x4b94c3?{'count':_0x4ea935,'rows':_0x4b94c3}:null;}})[_0x2af7('0x2f')](respondWithResult(_0x9da38b,null))[_0x2af7('0x59')](handleError(_0x9da38b,null));};exports[_0x2af7('0xed')]=function(_0x27b668,_0x42eed7,_0xfa6052){var _0x50a35a;var _0x440933;var _0x1f85cf;var _0x5f1c4c=!_[_0x2af7('0x6c')](_0x27b668[_0x2af7('0x5b')]['id'])?_0x27b668['params']['id']:!_[_0x2af7('0x6c')](_0x27b668['user']['id'])?_0x27b668[_0x2af7('0x85')]['id']:null;return db['User'][_0x2af7('0x63')]({'where':{'id':_0x5f1c4c,'role':{'$or':['admin',_0x2af7('0x85'),_0x2af7('0x31')]}},'attributes':['id','name',_0x2af7('0xee'),_0x2af7('0xef'),_0x2af7('0x30'),'internal',_0x2af7('0xa2')]})[_0x2af7('0x2f')](function(_0x47b5e4){if(_0x47b5e4){if(_0x47b5e4['role']===_0x2af7('0x31')){_0x50a35a=_0x47b5e4;if(_0x27b668[_0x2af7('0x62')][_0x2af7('0xa3')]){_0x1f85cf=util[_0x2af7('0xf0')](_0x2af7('0xf1'),_0x50a35a[_0x27b668['body']['interface']]);}else if(_0x27b668[_0x2af7('0x62')][_0x2af7('0xf2')]){_0x1f85cf=util['format'](_0x2af7('0xac'),_0x27b668[_0x2af7('0x62')][_0x2af7('0xf2')]);}else{_0x1f85cf=util[_0x2af7('0xf0')]('SIP/%s',_0x50a35a['name']);}socket['to'](util['format']('user:%s',_0x50a35a['name']))[_0x2af7('0x32')]('user:forcelogout',{'user':{'id':_0x50a35a['id'],'name':_0x50a35a[_0x2af7('0x39')]},'ip':_0x27b668[_0x2af7('0xf3')][_0x2af7('0xf4')]||_0x27b668[_0x2af7('0xf5')][_0x2af7('0xf6')]||_0x27b668[_0x2af7('0xf7')][_0x2af7('0xf6')]||_0x27b668[_0x2af7('0xf5')][_0x2af7('0xf7')][_0x2af7('0xf6')]});return db['UserVoiceQueueRt'][_0x2af7('0x3b')]({'where':{'membername':_0x50a35a[_0x2af7('0x39')]},'individualHooks':!![]});}}else{throw new db[(_0x2af7('0x96'))][(_0x2af7('0x93'))](_0x2af7('0xf8'));}})[_0x2af7('0x2f')](function(){if(_0x50a35a){return _0x50a35a[_0x2af7('0xf9')]({'raw':!![]});}})[_0x2af7('0x2f')](function(_0x5f34ce){if(_0x50a35a){if(_0x5f34ce){_0x440933=_0x5f34ce;if(_0x440933[_0x2af7('0x53')]){var _0xf6d4f1=_0x440933['map'](function(_0x2a78e3){var _0x40a201={'membername':_0x50a35a[_0x2af7('0x39')],'UserId':_0x50a35a['id'],'queue_name':_0x2a78e3[_0x2af7('0x39')],'VoiceQueueId':_0x2a78e3['id'],'interface':_0x1f85cf,'paused':_0x50a35a[_0x2af7('0xa2')]||![],'penalty':_0x2a78e3[_0x2af7('0xfa')]||0x0};return db[_0x2af7('0xae')]['upsert'](_0x40a201);});return Promise[_0x2af7('0x58')](_0xf6d4f1);}}}})[_0x2af7('0x2f')](function(){if(_0x50a35a){return db[_0x2af7('0xfb')][_0x2af7('0x50')]({'where':{'membername':_0x50a35a[_0x2af7('0x39')],'exitAt':null}});}})[_0x2af7('0x2f')](function(_0x5297a9){if(_0x50a35a){var _0x1c7b21=[];_0x5297a9['forEach'](function(_0x2b4cf5){_0x1c7b21[_0x2af7('0x4f')](_0x2b4cf5['update']({'exitAt':moment()[_0x2af7('0xf0')](_0x2af7('0xfc'))}));});return Promise[_0x2af7('0x58')](_0x1c7b21);}})[_0x2af7('0x2f')](function(){if(_0x50a35a){var _0x231378=[];var _0x1c1f50=[];var _0x25cd0e=utils[_0x2af7('0xfd')]();var _0x5084a0={'membername':_0x50a35a['name'],'interface':_0x1f85cf,'enterAt':moment()[_0x2af7('0xf0')](_0x2af7('0xfc')),'role':_0x50a35a[_0x2af7('0x30')],'internal':_0x50a35a[_0x2af7('0x67')]};_0x25cd0e[_0x2af7('0xfe')](function(_0x5a949f){_0x231378[_0x2af7('0x4f')](_['merge']({'channel':_0x5a949f,'type':'LOGIN','data1':_0x27b668[_0x2af7('0x62')][_0x2af7('0xff')],'data2':_0x1f85cf},_0x5084a0));if(_0x50a35a['loginInPause']){_0x1c1f50['push'](_['merge']({'channel':_0x5a949f,'type':_0x2af7('0x100'),'data1':_0x2af7('0x101')},_0x5084a0));}});return db[_0x2af7('0xfb')]['bulkCreate'](_0x231378['concat'](_0x1c1f50),{'individualHooks':!![]});}})[_0x2af7('0x2f')](function(){if(_0x50a35a){return _0x50a35a[_0x2af7('0x2e')]({'online':!![],'lastLoginAt':moment()[_0x2af7('0xf0')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x50a35a[_0x2af7('0xa2')]||![],'mailPause':_0x50a35a['loginInPause']||![],'chatPause':_0x50a35a[_0x2af7('0xa2')]||![],'faxPause':_0x50a35a[_0x2af7('0xa2')]||![],'smsPause':_0x50a35a[_0x2af7('0xa2')]||![],'openchannelPause':_0x50a35a[_0x2af7('0xa2')]||![],'whatsappPause':_0x50a35a['loginInPause']||![],'pauseType':_0x50a35a[_0x2af7('0xa2')]?_0x2af7('0x101'):null,'interface':_0x1f85cf,'lastPauseAt':moment()[_0x2af7('0xf0')](_0x2af7('0xfc'))});}})[_0x2af7('0x2f')](function(_0x3b8a29){if(_0x27b668['isMiddleware']){return _0xfa6052();}else{return Promise[_0x2af7('0x102')](_0x3b8a29)[_0x2af7('0x2f')](respondWithResult(_0x42eed7,null));}})[_0x2af7('0x59')](handleError(_0x42eed7,null));};exports['logout']=function(_0x582f2e,_0x47f0af){var _0x23dac7;return db[_0x2af7('0x3e')][_0x2af7('0x63')]({'where':{'id':_0x582f2e[_0x2af7('0x5b')]['id'],'role':'agent'},'attributes':['id',_0x2af7('0x39'),_0x2af7('0x30')]})[_0x2af7('0x2f')](handleEntityNotFound(_0x47f0af,null))[_0x2af7('0x2f')](function(_0x21fe42){if(_0x21fe42){_0x23dac7=_0x21fe42;return db[_0x2af7('0xae')][_0x2af7('0x3b')]({'where':{'membername':_0x23dac7['name']},'individualHooks':!![]});}})['then'](function(){return db[_0x2af7('0xfb')][_0x2af7('0x50')]({'where':{'membername':_0x23dac7[_0x2af7('0x39')],'exitAt':null}});})[_0x2af7('0x2f')](function(_0x6c261e){var _0x28ba22=[];_0x6c261e[_0x2af7('0xfe')](function(_0x5f4a0a){_0x28ba22[_0x2af7('0x4f')](_0x5f4a0a[_0x2af7('0x2e')]({'exitAt':moment()[_0x2af7('0xf0')]('YYYY-MM-DD\x20HH:mm:ss')}));});return Promise['all'](_0x28ba22);})[_0x2af7('0x2f')](function(){return _0x23dac7['update']({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x2af7('0x2f')](respondWithResult(_0x47f0af,null))['catch'](handleError(_0x47f0af,null));};exports[_0x2af7('0x103')]=function(_0x32ea4c,_0x5e7614){var _0x34ed2e;return db[_0x2af7('0xae')][_0x2af7('0x2e')]({'paused':0x1},{'where':{'UserId':_0x32ea4c[_0x2af7('0x5b')]['id']},'individualHooks':!![]})['then'](function(){return db[_0x2af7('0x3e')][_0x2af7('0x63')]({'where':{'id':_0x32ea4c[_0x2af7('0x5b')]['id'],'role':'agent'},'attributes':['id',_0x2af7('0x39'),_0x2af7('0x30'),_0x2af7('0x67'),_0x2af7('0xa3'),_0x2af7('0xa1')]});})['then'](handleEntityNotFound(_0x5e7614,null))[_0x2af7('0x2f')](function(_0x469319){if(_0x469319){_0x34ed2e=_0x469319;return respondWithRpcPromise(_0x2af7('0x104'),_0x2af7('0x103'),{'id':_0x34ed2e['id'],'name':_0x34ed2e[_0x2af7('0x39')],'pause':!![]});}})[_0x2af7('0x2f')](function(){if(_0x34ed2e){return db[_0x2af7('0xfb')]['findAll']({'where':{'membername':_0x34ed2e[_0x2af7('0x39')],'type':_0x2af7('0x100'),'exitAt':null}});}})[_0x2af7('0x2f')](function(_0x4e50a3){if(_0x4e50a3['length']){var _0x3c80f0=moment()['format'](_0x2af7('0xfc'));for(var _0x584763=0x0,_0x22d51b=_0x4e50a3[_0x2af7('0x53')];_0x584763<_0x22d51b;_0x584763++){_0x4e50a3[_0x584763][_0x2af7('0x105')]({'exitAt':_0x3c80f0});}}})[_0x2af7('0x2f')](function(){var _0xd9d03b=[];var _0x26b14b=utils[_0x2af7('0xfd')]();_0x26b14b[_0x2af7('0xfe')](function(_0x13c80a){_0xd9d03b[_0x2af7('0x4f')]({'channel':_0x13c80a,'membername':_0x34ed2e[_0x2af7('0x39')],'interface':_[_0x2af7('0x6c')](_0x34ed2e[_0x2af7('0xa3')])?util['format'](_0x2af7('0xac'),_0x34ed2e[_0x2af7('0x39')]):_0x34ed2e['interface'],'type':_0x2af7('0x100'),'enterAt':moment()['format'](_0x2af7('0xfc')),'data1':_0x32ea4c[_0x2af7('0x62')]['type']||_0x2af7('0x106'),'role':_0x34ed2e[_0x2af7('0x30')],'internal':_0x34ed2e[_0x2af7('0x67')]});});return db[_0x2af7('0xfb')][_0x2af7('0x107')](_0xd9d03b,{'individualHooks':!![]});})['then'](function(){return _0x34ed2e[_0x2af7('0x2e')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x32ea4c[_0x2af7('0x62')][_0x2af7('0x40')]||_0x2af7('0x106'),'lastPauseAt':moment()[_0x2af7('0xf0')](_0x2af7('0xfc'))});})[_0x2af7('0x2f')](respondWithResult(_0x5e7614,null))[_0x2af7('0x59')](handleError(_0x5e7614,null));};exports['unpause']=function(_0x188c07,_0x5c6e3d){if(_0x188c07['body'][_0x2af7('0xa0')]&&!utils[_0x2af7('0xa4')](_0x188c07[_0x2af7('0x62')]['channel'])){throw new APIBadRequestError(util['format'](_0x2af7('0x108'),_0x188c07[_0x2af7('0x62')][_0x2af7('0xa0')]));}return db[_0x2af7('0x3e')][_0x2af7('0x63')]({'where':{'id':_0x188c07[_0x2af7('0x5b')]['id']},'attributes':['id','name',_0x2af7('0x30'),_0x2af7('0x67'),_0x2af7('0xa3'),_0x2af7('0xa1'),_0x2af7('0xad'),_0x2af7('0x109'),'chatPause',_0x2af7('0x10a'),_0x2af7('0x10b'),_0x2af7('0x10c'),_0x2af7('0x10d'),_0x2af7('0x10e'),_0x2af7('0x10f')]})['then'](function(_0x30dda3){if(!_0x30dda3){throw new APINotFoundError(util[_0x2af7('0xf0')](_0x2af7('0x110'),_0x188c07['params']['id']));}return _0x30dda3[_0x2af7('0x111')](_0x188c07[_0x2af7('0x62')][_0x2af7('0xa0')]);})[_0x2af7('0x2f')](respondWithResult(_0x5c6e3d,null))[_0x2af7('0x59')](APIHandleError(_0x5c6e3d));};exports['getTeams']=function(_0xe34208,_0x5bfef2){var _0x4e6f03={};var _0x598944={};var _0x1c95f7;var _0x22a0ac;return db[_0x2af7('0x3e')][_0x2af7('0x99')]({'where':{'id':_0xe34208[_0x2af7('0x5b')]['id']}})['then'](handleEntityNotFound(_0x5bfef2,null))[_0x2af7('0x2f')](function(_0x379c0d){if(_0x379c0d){_0x1c95f7=_0x379c0d;_0x598944[_0x2af7('0xd1')]=_['keys'](db[_0x2af7('0x112')]['rawAttributes']);_0x598944['query']=_[_0x2af7('0xd2')](_0xe34208[_0x2af7('0x4a')]);_0x598944[_0x2af7('0xd7')]=_[_0x2af7('0xd3')](_0x598944['model'],_0x598944[_0x2af7('0x4a')]);_0x4e6f03[_0x2af7('0x4e')]=_['intersection'](_0x598944['model'],qs[_0x2af7('0xd4')](_0xe34208[_0x2af7('0x4a')][_0x2af7('0xd4')]));_0x4e6f03[_0x2af7('0x4e')]=_0x4e6f03[_0x2af7('0x4e')][_0x2af7('0x53')]?_0x4e6f03[_0x2af7('0x4e')]:_0x598944[_0x2af7('0xd1')];_0x4e6f03[_0x2af7('0xd5')]=qs[_0x2af7('0xd6')](_0xe34208[_0x2af7('0x4a')][_0x2af7('0xd6')]);_0x4e6f03[_0x2af7('0x48')]=qs['filters'](_[_0x2af7('0xdd')](_0xe34208[_0x2af7('0x4a')],_0x598944['filters']));if(_0xe34208['query'][_0x2af7('0x35')]){_0x4e6f03[_0x2af7('0x48')]=_[_0x2af7('0x5e')](_0x4e6f03[_0x2af7('0x48')],{'$or':_[_0x2af7('0x36')](_0x4e6f03['attributes'],function(_0xc44a69){var _0x5972d9={};_0x5972d9[_0xc44a69]={'$like':'%'+_0xe34208[_0x2af7('0x4a')][_0x2af7('0x35')]+'%'};return _0x5972d9;})});}_0x4e6f03=_['merge']({},_0x4e6f03,_0xe34208[_0x2af7('0x5f')]);return _0x1c95f7[_0x2af7('0x113')](_0x4e6f03);}})[_0x2af7('0x2f')](function(_0x155009){if(_0x155009){_0x22a0ac=_0x155009[_0x2af7('0x53')];if(!_0xe34208[_0x2af7('0x4a')]['hasOwnProperty'](_0x2af7('0xdb'))){_0x4e6f03[_0x2af7('0x22')]=qs[_0x2af7('0x22')](_0xe34208[_0x2af7('0x4a')][_0x2af7('0x22')]);_0x4e6f03[_0x2af7('0x20')]=qs['offset'](_0xe34208['query']['offset']);}return _0x1c95f7[_0x2af7('0x113')](_0x4e6f03);}})[_0x2af7('0x2f')](function(_0x28cf7f){if(_0x28cf7f){return _0x28cf7f?{'count':_0x22a0ac,'rows':_0x28cf7f}:null;}})[_0x2af7('0x2f')](respondWithResult(_0x5bfef2,null))[_0x2af7('0x59')](handleError(_0x5bfef2,null));};exports[_0x2af7('0x114')]=function(_0xb680f9,_0x9fb421){var _0x36290b=_0xb680f9[_0x2af7('0x5b')]['id'];var _0x5959f5=_0xb680f9[_0x2af7('0x62')]?_0xb680f9[_0x2af7('0x62')][_0x2af7('0x66')]:null;var _0x562a6a=[];return Promise['resolve']()[_0x2af7('0x2f')](function(){if(!_0x5959f5)throw new APIBadRequestError(_0x2af7('0x115'));})[_0x2af7('0x2f')](function(){return db[_0x2af7('0x3e')][_0x2af7('0x99')]({'where':{'id':_0x36290b}});})[_0x2af7('0x2f')](function(_0x57ffad){if(!_0x57ffad)throw new APINotFoundError(util['format'](_0x2af7('0x110'),_0xb680f9['params']['id']));return db['sequelize']['transaction'](function(_0x2cccc9){return _0x57ffad['addTeams'](_0x5959f5,{'transaction':_0x2cccc9})['then'](function(){return db[_0x2af7('0x112')]['findAll']({'where':{'id':{'$in':_0x5959f5}}});})[_0x2af7('0x2f')](function(_0xe450c1){var _0x334e34=_[_0x2af7('0x36')](_0xe450c1,function(_0x358684){return _0x358684[_0x2af7('0x116')]();});return Promise[_0x2af7('0x58')](_0x334e34);})[_0x2af7('0x2f')](function(_0x49c672){_0x562a6a=_[_0x2af7('0x117')](_0x49c672);var _0x178a3a=_[_0x2af7('0x36')](_0x562a6a,function(_0x100dc6){return _0x100dc6[_0x2af7('0x118')](_0x57ffad['id'],{'transaction':_0x2cccc9});});return Promise[_0x2af7('0x58')](_0x178a3a);})['then'](function(){if(!_0x57ffad['online'])return;var _0x2d5b6c=_[_0x2af7('0x35')](_0x562a6a,function(_0x3b7f7d){return _0x3b7f7d[_0x2af7('0x119')](_0x2af7('0xa0'))===_0x2af7('0x11a');});var _0x53349e=_['map'](_0x2d5b6c,function(_0x132dbf){return db[_0x2af7('0xae')][_0x2af7('0xaf')]({'membername':_0x57ffad[_0x2af7('0x39')],'UserId':_0x57ffad['id'],'queue_name':_0x132dbf[_0x2af7('0x39')],'VoiceQueueId':_0x132dbf['id'],'interface':_['isNil'](_0x57ffad[_0x2af7('0xa3')])?util['format'](_0x2af7('0xac'),_0x57ffad[_0x2af7('0x39')]):_0x57ffad[_0x2af7('0xa3')],'paused':_0x57ffad[_0x2af7('0xad')]||![],'penalty':_0x57ffad[_0x2af7('0xa9')]},{'transaction':_0x2cccc9});});return Promise[_0x2af7('0x58')](_0x53349e);})['then'](function(){return db[_0x2af7('0x11b')][_0x2af7('0x50')]({'where':{'teamId':{'$in':_0x5959f5}}});})['then'](function(_0x2eccc2){var _0x5ca8ee=_['map'](_0x2eccc2,function(_0x5ad40f){return db['UserVoicePrefix'][_0x2af7('0x80')]({'UserId':_0x57ffad['id'],'VoicePrefixId':_0x5ad40f['VoicePrefixId']},{'transaction':_0x2cccc9});});return Promise[_0x2af7('0x58')](_0x5ca8ee);});});})[_0x2af7('0x2f')](function(){for(var _0x1a1eea=0x0;_0x1a1eea<_0x562a6a[_0x2af7('0x53')];_0x1a1eea++){var _0x469209=_0x562a6a[_0x1a1eea][_0x2af7('0x119')](_0x2af7('0xa0'));var _0x39c180=_0x469209+_0x2af7('0xaa');socket[_0x2af7('0x32')](_0x2af7('0x85')+_0x469209+_0x2af7('0x11c'),{'UserId':_0x36290b,['queueField']:_0x562a6a[_0x1a1eea]['id']});}})[_0x2af7('0x2f')](respondWithStatusCode(_0x9fb421,null))[_0x2af7('0x59')](APIHandleError(_0x9fb421));};exports['removeTeams']=function(_0x504788,_0x3fbfcf){var _0x823e78=_0x504788['params']['id'];var _0x3e653b=null;if(_0x504788[_0x2af7('0x4a')]['ids']){_0x3e653b=_[_0x2af7('0xb3')](_0x504788[_0x2af7('0x4a')][_0x2af7('0x66')])?_0x504788[_0x2af7('0x4a')]['ids']:[_0x504788[_0x2af7('0x4a')][_0x2af7('0x66')]];}var _0x1bc873=[];return Promise[_0x2af7('0x102')]()[_0x2af7('0x2f')](function(){if(!_0x3e653b)throw new APIBadRequestError(_0x2af7('0x11d'));})[_0x2af7('0x2f')](function(){return db[_0x2af7('0x3e')]['findOne']({'where':{'id':_0x823e78}});})[_0x2af7('0x2f')](function(_0x32b6bd){if(!_0x32b6bd)throw new APINotFoundError(util['format']('User\x20with\x20id\x20%s\x20not\x20found',_0x504788[_0x2af7('0x5b')]['id']));return db['sequelize'][_0x2af7('0x11e')](function(_0x4d3c21){return _0x32b6bd[_0x2af7('0x11f')](_0x3e653b,{'transaction':_0x4d3c21})['then'](function(){return db['Team'][_0x2af7('0x50')]({'where':{'id':{'$in':_0x3e653b}}});})[_0x2af7('0x2f')](function(_0x23fef9){var _0x3f378b=_[_0x2af7('0x36')](_0x23fef9,function(_0x5d13b3){return _0x5d13b3[_0x2af7('0x116')]();});return Promise[_0x2af7('0x58')](_0x3f378b);})[_0x2af7('0x2f')](function(_0x268165){_0x1bc873=_[_0x2af7('0x117')](_0x268165);var _0x374926=_[_0x2af7('0x36')](_0x1bc873,function(_0x2b9964){return _0x2b9964[_0x2af7('0x120')](_0x32b6bd['id'],{'transaction':_0x4d3c21});});return Promise[_0x2af7('0x58')](_0x374926);})['then'](function(){if(!_0x32b6bd['online'])return;var _0x36528a=_[_0x2af7('0x35')](_0x1bc873,function(_0x21c470){return _0x21c470[_0x2af7('0x119')](_0x2af7('0xa0'))===_0x2af7('0x11a');});var _0x59b2f1=_[_0x2af7('0x36')](_0x36528a,function(_0x30203a){return db[_0x2af7('0xae')][_0x2af7('0x3b')]({'where':{'VoiceQueueId':_0x30203a['id'],'UserId':_0x32b6bd['id']},'transaction':_0x4d3c21});});return Promise['all'](_0x59b2f1);})['then'](function(){return db[_0x2af7('0x11b')][_0x2af7('0x50')]({'where':{'teamId':{'$in':_0x3e653b}}});})[_0x2af7('0x2f')](function(_0x261172){var _0x5b49a6=_[_0x2af7('0x36')](_0x261172,function(_0x4031b3){return db[_0x2af7('0x121')][_0x2af7('0x3b')]({'where':{'UserId':_0x32b6bd['id'],'VoicePrefixId':_0x4031b3['VoicePrefixId']}},{'transaction':_0x4d3c21});});return Promise[_0x2af7('0x58')](_0x5b49a6);});});})[_0x2af7('0x2f')](function(){for(var _0x3883ad=0x0;_0x3883ad<_0x1bc873['length'];_0x3883ad++){var _0x3f21f6=_0x1bc873[_0x3883ad][_0x2af7('0x119')](_0x2af7('0xa0'));var _0x3a77b1=_0x3f21f6+'QueueId';socket[_0x2af7('0x32')](_0x2af7('0x85')+_0x3f21f6+_0x2af7('0xb4'),{'UserId':_0x823e78,['queueField']:_0x1bc873[_0x3883ad]['id']});}})[_0x2af7('0x2f')](respondWithStatusCode(_0x3fbfcf,null))['catch'](APIHandleError(_0x3fbfcf));};exports['getLists']=function(_0x392ca4,_0x40d852){var _0x19d7cf={};var _0x53bc54={};var _0x49e3d6;var _0x11374f;return db[_0x2af7('0x3e')][_0x2af7('0x99')]({'where':{'id':_0x392ca4[_0x2af7('0x5b')]['id']}})[_0x2af7('0x2f')](handleEntityNotFound(_0x40d852,null))[_0x2af7('0x2f')](function(_0x275fb6){if(_0x275fb6){_0x49e3d6=_0x275fb6;_0x53bc54[_0x2af7('0xd1')]=_[_0x2af7('0xd2')](db['CmList']['rawAttributes']);_0x53bc54['query']=_[_0x2af7('0xd2')](_0x392ca4[_0x2af7('0x4a')]);_0x53bc54[_0x2af7('0xd7')]=_['intersection'](_0x53bc54[_0x2af7('0xd1')],_0x53bc54['query']);_0x19d7cf[_0x2af7('0x4e')]=_[_0x2af7('0xd3')](_0x53bc54[_0x2af7('0xd1')],qs[_0x2af7('0xd4')](_0x392ca4[_0x2af7('0x4a')][_0x2af7('0xd4')]));_0x19d7cf[_0x2af7('0x4e')]=_0x19d7cf[_0x2af7('0x4e')][_0x2af7('0x53')]?_0x19d7cf[_0x2af7('0x4e')]:_0x53bc54[_0x2af7('0xd1')];_0x19d7cf['order']=qs[_0x2af7('0xd6')](_0x392ca4[_0x2af7('0x4a')][_0x2af7('0xd6')]);_0x19d7cf[_0x2af7('0x48')]=qs['filters'](_[_0x2af7('0xdd')](_0x392ca4['query'],_0x53bc54[_0x2af7('0xd7')]));if(_0x392ca4[_0x2af7('0x4a')][_0x2af7('0x35')]){_0x19d7cf[_0x2af7('0x48')]=_[_0x2af7('0x5e')](_0x19d7cf[_0x2af7('0x48')],{'$or':_[_0x2af7('0x36')](_0x19d7cf[_0x2af7('0x4e')],function(_0x2eae65){var _0x1087e1={};_0x1087e1[_0x2eae65]={'$like':'%'+_0x392ca4[_0x2af7('0x4a')][_0x2af7('0x35')]+'%'};return _0x1087e1;})});}_0x19d7cf=_[_0x2af7('0x5e')]({},_0x19d7cf,_0x392ca4[_0x2af7('0x5f')]);return _0x49e3d6[_0x2af7('0x122')](_0x19d7cf);}})[_0x2af7('0x2f')](function(_0x31fe88){if(_0x31fe88){_0x11374f=_0x31fe88['length'];if(!_0x392ca4[_0x2af7('0x4a')][_0x2af7('0xda')]('nolimit')){_0x19d7cf[_0x2af7('0x22')]=qs[_0x2af7('0x22')](_0x392ca4[_0x2af7('0x4a')]['limit']);_0x19d7cf[_0x2af7('0x20')]=qs[_0x2af7('0x20')](_0x392ca4[_0x2af7('0x4a')][_0x2af7('0x20')]);}return _0x49e3d6[_0x2af7('0x122')](_0x19d7cf);}})[_0x2af7('0x2f')](function(_0x5d495f){if(_0x5d495f){return _0x5d495f?{'count':_0x11374f,'rows':_0x5d495f}:null;}})[_0x2af7('0x2f')](respondWithResult(_0x40d852,null))[_0x2af7('0x59')](handleError(_0x40d852,null));};exports[_0x2af7('0x123')]=function(_0x1beaa7,_0x2af3c6){var _0x48e5cc={};var _0x417da1={};var _0x6d0b60;return db[_0x2af7('0x3e')][_0x2af7('0x99')]({'where':{'id':_0x1beaa7[_0x2af7('0x5b')]['id']}})[_0x2af7('0x2f')](handleEntityNotFound(_0x2af3c6,null))['then'](function(_0x13f0b1){if(_0x13f0b1){_0x6d0b60=_0x13f0b1;_0x417da1[_0x2af7('0xd1')]=_[_0x2af7('0xd2')](db[_0x2af7('0x3e')][_0x2af7('0x3f')]);_0x417da1[_0x2af7('0x4a')]=_[_0x2af7('0xd2')](_0x1beaa7[_0x2af7('0x4a')]);_0x417da1[_0x2af7('0xd7')]=_['intersection'](_0x417da1['model'],_0x417da1['query']);_0x48e5cc[_0x2af7('0x4e')]=_[_0x2af7('0xd3')](_0x417da1[_0x2af7('0xd1')],qs[_0x2af7('0xd4')](_0x1beaa7['query'][_0x2af7('0xd4')]));_0x48e5cc['attributes']=_0x48e5cc['attributes'][_0x2af7('0x53')]?_0x48e5cc['attributes']:_0x417da1['model'];_0x48e5cc['order']=qs[_0x2af7('0xd6')](_0x1beaa7[_0x2af7('0x4a')][_0x2af7('0xd6')]);_0x48e5cc['where']=qs[_0x2af7('0xd7')](_[_0x2af7('0xdd')](_0x1beaa7[_0x2af7('0x4a')],_0x417da1[_0x2af7('0xd7')]));if(_0x1beaa7['query']['filter']){_0x48e5cc[_0x2af7('0x48')]=_[_0x2af7('0x5e')](_0x48e5cc[_0x2af7('0x48')],{'$or':_[_0x2af7('0x36')](_0x48e5cc['attributes'],function(_0x4db9c7){var _0x4926fe={};_0x4926fe[_0x4db9c7]={'$like':'%'+_0x1beaa7[_0x2af7('0x4a')]['filter']+'%'};return _0x4926fe;})});}_0x48e5cc[_0x2af7('0xd1')]=db[_0x2af7('0x3e')];_0x48e5cc['as']='Agents';_0x48e5cc=_[_0x2af7('0x5e')]({},_0x48e5cc,_0x1beaa7[_0x2af7('0x5f')]);return _0x6d0b60[_0x2af7('0xf9')]({'include':[_0x48e5cc]});}})[_0x2af7('0x2f')](function(_0x73fe62){if(_0x73fe62){var _0x1d7334={},_0x1e0fe4=[];for(var _0x5911f7=0x0;_0x5911f7<_0x73fe62[_0x2af7('0x53')];_0x5911f7+=0x1){for(var _0x4d960d=0x0,_0xa1351c;_0x4d960d<_0x73fe62[_0x5911f7][_0x2af7('0x88')][_0x2af7('0x53')];_0x4d960d+=0x1){_0xa1351c=_0x73fe62[_0x5911f7][_0x2af7('0x88')][_0x4d960d][_0x2af7('0x33')]({'plain':!![]});_0x1d7334[_0xa1351c['id']]=_0xa1351c;}}_0x1d7334=_[_0x2af7('0x124')](_0x1d7334);for(var _0x291cad=qs[_0x2af7('0x20')](_0x1beaa7['query'][_0x2af7('0x20')]);_0x291cad<_0x1d7334[_0x2af7('0x53')]&&_0x1e0fe4['length']=_0x3e7d2d['agents']){throw new Error(_0xf6e6('0x4c'));}})[_0xf6e6('0x14')](function(){if(_0x4a5d2d){return db[_0xf6e6('0x25')][_0xf6e6('0x4d')]({'where':{'membername':_0x4a5d2d[_0xf6e6('0x1f')]},'individualHooks':!![]});}})[_0xf6e6('0x14')](function(){if(_0x4a5d2d){return _0x4a5d2d[_0xf6e6('0x4e')]({'raw':!![]});}})[_0xf6e6('0x14')](function(_0x202562){if(_0x4a5d2d){if(_0x202562){var _0x385cae=[];_0x4eb827=_0x202562;if(_0x4eb827[_0xf6e6('0x29')]){for(var _0x563758=0x0;_0x563758<_0x4eb827[_0xf6e6('0x29')];_0x563758++){_0x385cae[_0xf6e6('0x42')](db[_0xf6e6('0x25')][_0xf6e6('0x4f')]({'membername':_0x4a5d2d[_0xf6e6('0x1f')],'UserId':_0x4a5d2d['id'],'queue_name':_0x4eb827[_0x563758][_0xf6e6('0x1f')],'VoiceQueueId':_0x4eb827[_0x563758]['id'],'interface':_0x2277b2,'paused':_0x4a5d2d['loginInPause']||![],'penalty':_0x4eb827[_0x563758][_0xf6e6('0x50')]||0x0}));}return BPromise[_0xf6e6('0x51')](_0x385cae);}}}})[_0xf6e6('0x14')](function(){if(_0x4a5d2d){return db[_0xf6e6('0x27')][_0xf6e6('0xc')]({'where':{'membername':_0x4a5d2d[_0xf6e6('0x1f')],'exitAt':null}});}})[_0xf6e6('0x14')](function(_0x438632){if(_0x4a5d2d){if(_0x438632&&_0x438632['length']){var _0x34f9df=[];_0x438632['forEach'](function(_0x3ae0f3){_0x34f9df[_0xf6e6('0x42')](_0x3ae0f3[_0xf6e6('0x26')]({'exitAt':moment()['format'](_0xf6e6('0x28'))}));});return BPromise['all'](_0x34f9df);}}})[_0xf6e6('0x14')](function(){if(_0x4a5d2d){var _0x729d17=[];var _0x20eb0a=[];var _0x1abc12=utils['getChannels']();var _0x312a34={'membername':_0x4a5d2d[_0xf6e6('0x1f')],'interface':_0x2277b2,'enterAt':moment()['format'](_0xf6e6('0x28')),'role':_0x4a5d2d[_0xf6e6('0x20')],'internal':_0x4a5d2d[_0xf6e6('0x21')]};_0x1abc12[_0xf6e6('0x2c')](function(_0x44b5a4){_0x729d17[_0xf6e6('0x42')](_['merge']({'channel':_0x44b5a4,'type':_0xf6e6('0x52'),'data1':_0xf6e6('0x53'),'data2':_0x2277b2},_0x312a34));if(_0x4a5d2d[_0xf6e6('0x46')]){_0x20eb0a['push'](_[_0xf6e6('0x54')]({'channel':_0x44b5a4,'type':_0xf6e6('0x2e'),'data1':'LOGININPAUSE'},_0x312a34));}});return db[_0xf6e6('0x27')][_0xf6e6('0x55')](_0x729d17[_0xf6e6('0x56')](_0x20eb0a),{'individualHooks':!![]});}})[_0xf6e6('0x14')](function(){if(_0x4a5d2d){return _0x4a5d2d[_0xf6e6('0x26')]({'online':!![],'lastLoginAt':moment()[_0xf6e6('0x23')](_0xf6e6('0x28')),'voicePause':_0x4a5d2d['loginInPause']||![],'mailPause':_0x4a5d2d[_0xf6e6('0x46')]||![],'chatPause':_0x4a5d2d[_0xf6e6('0x46')]||![],'faxPause':_0x4a5d2d[_0xf6e6('0x46')]||![],'smsPause':_0x4a5d2d['loginInPause']||![],'openchannelPause':_0x4a5d2d[_0xf6e6('0x46')]||![],'pauseType':_0x4a5d2d[_0xf6e6('0x46')]?_0xf6e6('0x57'):null,'lastPauseAt':moment()[_0xf6e6('0x23')]('YYYY-MM-DD\x20HH:mm:ss'),'interface':_0x2277b2});}})[_0xf6e6('0x14')](function(_0x559fc6){_0x3e41d8(_0x559fc6);})[_0xf6e6('0x1c')](function(_0x56e42b){_0x3d36c0(_0x371dca[_0xf6e6('0x18')](0x1f4,_0x56e42b[_0xf6e6('0x19')]));});});}; \ No newline at end of file +var _0x7ca9=['voicePause','chatPause','faxPause','openchannelPause','whatsappPause','pauseType','lastPauseAt','params','unpause','LogoutUser','findOne','destroy','all','LoginUser','mobile','phone','loginInPause','agent','../../config/license/util','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','upsert','UserVoiceQueue.penalty','merge','LOGIN','callysquare','LOGININPAUSE','concat','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','redis','defaults','localhost','socket.io-emitter','./user.socket','GetUser','User','findAll','options','raw','where','attributes','include','map','model','then','info','debug','catch','error','message','ShowUser','find','stringify','PauseUser','name','internal','interface','User\x20with\x20id\x20%s\x20not\x20found','UserVoiceQueueRt','MemberReport','PAUSE','length','format','getChannels','forEach','push','isNil','SIP/%s','YYYY-MM-DD\x20HH:mm:ss','type','role','body','uniqueid','bulkCreate','update','DEFAULT\x20PAUSE','resolve','channel','isValidChannel'];(function(_0x22d026,_0x49824a){var _0x533fa8=function(_0x590391){while(--_0x590391){_0x22d026['push'](_0x22d026['shift']());}};_0x533fa8(++_0x49824a);}(_0x7ca9,0x171));var _0x97ca=function(_0x1fcd0e,_0x1bbf1a){_0x1fcd0e=_0x1fcd0e-0x0;var _0x5a6465=_0x7ca9[_0x1fcd0e];return _0x5a6465;};'use strict';var _=require(_0x97ca('0x0'));var util=require('util');var moment=require(_0x97ca('0x1'));var BPromise=require(_0x97ca('0x2'));var Redis=require('ioredis');var db=require(_0x97ca('0x3'))['db'];var utils=require(_0x97ca('0x4'));var logger=require(_0x97ca('0x5'))('rpc');var config=require('../../config/environment');config[_0x97ca('0x6')]=_[_0x97ca('0x7')](config[_0x97ca('0x6')],{'host':_0x97ca('0x8'),'port':0x18eb});var socket=require(_0x97ca('0x9'))(new Redis(config['redis']));require(_0x97ca('0xa'))['register'](socket);exports[_0x97ca('0xb')]=function(_0x349f73){var _0x3e58ab=this;return new Promise(function(_0x196bbb,_0x1d73f0){return db[_0x97ca('0xc')][_0x97ca('0xd')]({'raw':_0x349f73[_0x97ca('0xe')]?_0x349f73[_0x97ca('0xe')][_0x97ca('0xf')]===undefined?!![]:![]:!![],'where':_0x349f73[_0x97ca('0xe')]?_0x349f73[_0x97ca('0xe')][_0x97ca('0x10')]||null:null,'attributes':_0x349f73['options']?_0x349f73[_0x97ca('0xe')][_0x97ca('0x11')]||null:null,'limit':_0x349f73[_0x97ca('0xe')]?_0x349f73[_0x97ca('0xe')]['limit']||null:null,'include':_0x349f73['options']?_0x349f73[_0x97ca('0xe')][_0x97ca('0x12')]?_[_0x97ca('0x13')](_0x349f73['options'][_0x97ca('0x12')],function(_0x10b636){return{'model':db[_0x10b636[_0x97ca('0x14')]],'as':_0x10b636['as'],'attributes':_0x10b636[_0x97ca('0x11')],'include':_0x10b636[_0x97ca('0x12')]?_[_0x97ca('0x13')](_0x10b636[_0x97ca('0x12')],function(_0x58799c){return{'model':db[_0x58799c[_0x97ca('0x14')]],'as':_0x58799c['as'],'attributes':_0x58799c['attributes'],'include':_0x58799c[_0x97ca('0x12')]?_[_0x97ca('0x13')](_0x58799c[_0x97ca('0x12')],function(_0x3e2494){return{'model':db[_0x3e2494[_0x97ca('0x14')]],'as':_0x3e2494['as'],'attributes':_0x3e2494[_0x97ca('0x11')]};}):[]};}):[]};}):[]:[]})[_0x97ca('0x15')](function(_0xb18d69){logger[_0x97ca('0x16')](_0x97ca('0xb'),_0x349f73);logger[_0x97ca('0x17')](_0x97ca('0xb'),_0x349f73,JSON['stringify'](_0xb18d69));_0x196bbb(_0xb18d69);})[_0x97ca('0x18')](function(_0x5a81fa){logger[_0x97ca('0x19')](_0x97ca('0xb'),_0x5a81fa[_0x97ca('0x1a')],_0x349f73);_0x1d73f0(_0x3e58ab[_0x97ca('0x19')](0x1f4,_0x5a81fa[_0x97ca('0x1a')]));});});};exports[_0x97ca('0x1b')]=function(_0x5364a8){var _0x1febaa=this;return new Promise(function(_0x3c41f4,_0x501b0f){return db[_0x97ca('0xc')][_0x97ca('0x1c')]({'raw':_0x5364a8[_0x97ca('0xe')]?_0x5364a8[_0x97ca('0xe')][_0x97ca('0xf')]===undefined?!![]:![]:!![],'where':_0x5364a8[_0x97ca('0xe')]?_0x5364a8[_0x97ca('0xe')][_0x97ca('0x10')]||null:null,'attributes':_0x5364a8[_0x97ca('0xe')]?_0x5364a8[_0x97ca('0xe')]['attributes']||null:null,'include':_0x5364a8[_0x97ca('0xe')]?_0x5364a8[_0x97ca('0xe')][_0x97ca('0x12')]?_[_0x97ca('0x13')](_0x5364a8['options'][_0x97ca('0x12')],function(_0x479842){return{'model':db[_0x479842['model']],'as':_0x479842['as'],'attributes':_0x479842[_0x97ca('0x11')],'include':_0x479842[_0x97ca('0x12')]?_[_0x97ca('0x13')](_0x479842[_0x97ca('0x12')],function(_0x4b6e83){return{'model':db[_0x4b6e83[_0x97ca('0x14')]],'as':_0x4b6e83['as'],'attributes':_0x4b6e83[_0x97ca('0x11')],'include':_0x4b6e83[_0x97ca('0x12')]?_['map'](_0x4b6e83[_0x97ca('0x12')],function(_0x4ea719){return{'model':db[_0x4ea719[_0x97ca('0x14')]],'as':_0x4ea719['as'],'attributes':_0x4ea719[_0x97ca('0x11')]};}):[]};}):[]};}):[]:[]})[_0x97ca('0x15')](function(_0x333a31){logger['info']('ShowUser',_0x5364a8);logger[_0x97ca('0x17')](_0x97ca('0x1b'),_0x5364a8,JSON[_0x97ca('0x1d')](_0x333a31));_0x3c41f4(_0x333a31);})['catch'](function(_0x38f069){logger[_0x97ca('0x19')](_0x97ca('0x1b'),_0x38f069[_0x97ca('0x1a')],_0x5364a8);_0x501b0f(_0x1febaa[_0x97ca('0x19')](0x1f4,_0x38f069[_0x97ca('0x1a')]));});});};exports[_0x97ca('0x1e')]=function(_0x45a6e3){var _0x279d71;return db[_0x97ca('0xc')][_0x97ca('0x1c')]({'where':_0x45a6e3[_0x97ca('0xe')][_0x97ca('0x10')]||{},'attributes':['id',_0x97ca('0x1f'),'role',_0x97ca('0x20'),_0x97ca('0x21')]})[_0x97ca('0x15')](function(_0x33ae2c){if(!_0x33ae2c){throw new Error(util['format'](_0x97ca('0x22'),_0x45a6e3['params']['id']));}_0x279d71=_0x33ae2c;return db[_0x97ca('0x23')]['update']({'paused':0x1},{'where':{'UserId':_0x279d71['id']},'individualHooks':!![]});})[_0x97ca('0x15')](function(){return db[_0x97ca('0x24')][_0x97ca('0xd')]({'where':{'membername':_0x279d71[_0x97ca('0x1f')],'type':_0x97ca('0x25'),'exitAt':null}});})[_0x97ca('0x15')](function(_0x245d65){if(_0x245d65&&_0x245d65[_0x97ca('0x26')]){var _0x3170d8=moment()[_0x97ca('0x27')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x3a9579=0x0,_0x1e730f=_0x245d65[_0x97ca('0x26')];_0x3a9579<_0x1e730f;_0x3a9579++){_0x245d65[_0x3a9579]['updateAttributes']({'exitAt':_0x3170d8});}}})['then'](function(){var _0x2ff380=[];var _0x57602b=utils[_0x97ca('0x28')]();_0x57602b[_0x97ca('0x29')](function(_0x554946){_0x2ff380[_0x97ca('0x2a')]({'channel':_0x554946,'membername':_0x279d71['name'],'interface':_[_0x97ca('0x2b')](_0x279d71[_0x97ca('0x21')])?util['format'](_0x97ca('0x2c'),_0x279d71[_0x97ca('0x1f')]):_0x279d71[_0x97ca('0x21')],'type':_0x97ca('0x25'),'enterAt':moment()[_0x97ca('0x27')](_0x97ca('0x2d')),'data1':_0x45a6e3['body'][_0x97ca('0x2e')]||'DEFAULT\x20PAUSE','role':_0x279d71[_0x97ca('0x2f')],'internal':_0x279d71[_0x97ca('0x20')],'uniqueid':_0x45a6e3[_0x97ca('0x30')][_0x97ca('0x31')]||null});});return db[_0x97ca('0x24')][_0x97ca('0x32')](_0x2ff380,{'individualHooks':!![]});})[_0x97ca('0x15')](function(){return _0x279d71[_0x97ca('0x33')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x45a6e3['body'][_0x97ca('0x2e')]||_0x97ca('0x34'),'lastPauseAt':moment()[_0x97ca('0x27')]('YYYY-MM-DD\x20HH:mm:ss')});})[_0x97ca('0x18')](function(_0xba3a56){throw _0xba3a56;});};exports['UnpauseUser']=function(_0x1ea0dc){return Promise[_0x97ca('0x35')]()[_0x97ca('0x15')](function(){if(_0x1ea0dc['body'][_0x97ca('0x36')]&&!utils[_0x97ca('0x37')](_0x1ea0dc[_0x97ca('0x30')][_0x97ca('0x36')])){throw new Error(util[_0x97ca('0x27')]('Channel\x20parameter\x20%s\x20is\x20invalid',_0x1ea0dc[_0x97ca('0x30')]['channel']));}return db[_0x97ca('0xc')]['findOne']({'where':_0x1ea0dc[_0x97ca('0xe')][_0x97ca('0x10')]||{},'attributes':['id','name',_0x97ca('0x2f'),_0x97ca('0x20'),_0x97ca('0x21'),'online',_0x97ca('0x38'),'mailPause',_0x97ca('0x39'),_0x97ca('0x3a'),_0x97ca('0x3b'),'smsPause',_0x97ca('0x3c'),_0x97ca('0x3d'),_0x97ca('0x3e')]});})[_0x97ca('0x15')](function(_0x4624d0){if(!_0x4624d0){throw new Error(util[_0x97ca('0x27')](_0x97ca('0x22'),_0x1ea0dc[_0x97ca('0x3f')]['id']));}return _0x4624d0[_0x97ca('0x40')](_0x1ea0dc[_0x97ca('0x30')][_0x97ca('0x36')],'system');})[_0x97ca('0x18')](function(_0x2a1995){throw _0x2a1995;});};exports[_0x97ca('0x41')]=function(_0x23b5e5){var _0x19aa56=this;return new Promise(function(_0xef8a12,_0x2e2117){var _0x2ff386;return db[_0x97ca('0xc')][_0x97ca('0x42')]({'where':_0x23b5e5[_0x97ca('0xe')][_0x97ca('0x10')]||{},'attributes':['id',_0x97ca('0x1f')]})[_0x97ca('0x15')](function(_0xbb340b){if(_0xbb340b){_0x2ff386=_0xbb340b;return db[_0x97ca('0x23')][_0x97ca('0x43')]({'where':{'membername':_0x2ff386['name']},'individualHooks':!![]});}})[_0x97ca('0x15')](function(){if(_0x2ff386){return db['MemberReport'][_0x97ca('0xd')]({'where':{'membername':_0x2ff386[_0x97ca('0x1f')],'exitAt':null}});}})['then'](function(_0x30ffac){if(_0x2ff386){if(_0x30ffac&&_0x30ffac[_0x97ca('0x26')]){var _0x3d427b=[];_0x30ffac[_0x97ca('0x29')](function(_0x5e5295){_0x3d427b[_0x97ca('0x2a')](_0x5e5295[_0x97ca('0x33')]({'exitAt':moment()[_0x97ca('0x27')](_0x97ca('0x2d'))}));});return BPromise[_0x97ca('0x44')](_0x3d427b);}}})['then'](function(){if(_0x2ff386){return _0x2ff386[_0x97ca('0x33')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})['then'](function(_0x4e6cb3){_0xef8a12(_0x4e6cb3);})[_0x97ca('0x18')](function(_0x49b7ad){_0x2e2117(_0x19aa56[_0x97ca('0x19')](0x1f4,_0x49b7ad['message']));});});};exports[_0x97ca('0x45')]=function(_0x3f36e8){var _0x3e5670=this;return new Promise(function(_0x2cfee1,_0x536ea2){var _0x47516f;var _0x1d2c53;var _0x56c85d;var _0x2427ae;return db[_0x97ca('0xc')][_0x97ca('0x42')]({'where':_0x3f36e8[_0x97ca('0xe')]['where']||{},'attributes':['id','name',_0x97ca('0x2f'),_0x97ca('0x46'),_0x97ca('0x47'),_0x97ca('0x20'),_0x97ca('0x48'),_0x97ca('0x21')]})[_0x97ca('0x15')](function(_0x159662){if(_0x159662){_0x47516f=_0x159662;_0x2427ae=_0x3f36e8[_0x97ca('0x30')][_0x97ca('0x21')]?_0x3f36e8[_0x97ca('0x30')][_0x97ca('0x21')]:util[_0x97ca('0x27')](_0x97ca('0x2c'),_0x47516f['name']);return db[_0x97ca('0xc')]['count']({'where':{'role':_0x97ca('0x49'),'online':!![],'id':{'$ne':_0x47516f['id']}}});}})['then'](function(_0x27a50a){if(_0x27a50a){_0x56c85d=_0x27a50a;return require(_0x97ca('0x4a'))[_0x97ca('0x4b')]();}})[_0x97ca('0x15')](function(_0x5b4533){if(_0x5b4533&&_0x5b4533[_0x97ca('0x4c')]&&_0x56c85d>=_0x5b4533[_0x97ca('0x4c')]){throw new Error(_0x97ca('0x4d'));}})['then'](function(){if(_0x47516f){return db[_0x97ca('0x23')][_0x97ca('0x43')]({'where':{'membername':_0x47516f['name']},'individualHooks':!![]});}})['then'](function(){if(_0x47516f){return _0x47516f['getVoiceQueues']({'raw':!![]});}})[_0x97ca('0x15')](function(_0x347ec9){if(_0x47516f){if(_0x347ec9){var _0xbe6541=[];_0x1d2c53=_0x347ec9;if(_0x1d2c53['length']){for(var _0x106ad8=0x0;_0x106ad8<_0x1d2c53['length'];_0x106ad8++){_0xbe6541[_0x97ca('0x2a')](db[_0x97ca('0x23')][_0x97ca('0x4e')]({'membername':_0x47516f['name'],'UserId':_0x47516f['id'],'queue_name':_0x1d2c53[_0x106ad8]['name'],'VoiceQueueId':_0x1d2c53[_0x106ad8]['id'],'interface':_0x2427ae,'paused':_0x47516f[_0x97ca('0x48')]||![],'penalty':_0x1d2c53[_0x106ad8][_0x97ca('0x4f')]||0x0}));}return BPromise['all'](_0xbe6541);}}}})[_0x97ca('0x15')](function(){if(_0x47516f){return db[_0x97ca('0x24')][_0x97ca('0xd')]({'where':{'membername':_0x47516f[_0x97ca('0x1f')],'exitAt':null}});}})[_0x97ca('0x15')](function(_0x1edf52){if(_0x47516f){if(_0x1edf52&&_0x1edf52[_0x97ca('0x26')]){var _0x1e4e52=[];_0x1edf52[_0x97ca('0x29')](function(_0x184848){_0x1e4e52[_0x97ca('0x2a')](_0x184848[_0x97ca('0x33')]({'exitAt':moment()[_0x97ca('0x27')](_0x97ca('0x2d'))}));});return BPromise[_0x97ca('0x44')](_0x1e4e52);}}})[_0x97ca('0x15')](function(){if(_0x47516f){var _0x4c530a=[];var _0x1153b4=[];var _0x16dbb1=utils[_0x97ca('0x28')]();var _0x4722a6={'membername':_0x47516f[_0x97ca('0x1f')],'interface':_0x2427ae,'enterAt':moment()[_0x97ca('0x27')](_0x97ca('0x2d')),'role':_0x47516f[_0x97ca('0x2f')],'internal':_0x47516f[_0x97ca('0x20')]};_0x16dbb1[_0x97ca('0x29')](function(_0x44089d){_0x4c530a[_0x97ca('0x2a')](_[_0x97ca('0x50')]({'channel':_0x44089d,'type':_0x97ca('0x51'),'data1':_0x97ca('0x52'),'data2':_0x2427ae},_0x4722a6));if(_0x47516f[_0x97ca('0x48')]){_0x1153b4[_0x97ca('0x2a')](_[_0x97ca('0x50')]({'channel':_0x44089d,'type':_0x97ca('0x25'),'data1':_0x97ca('0x53')},_0x4722a6));}});return db[_0x97ca('0x24')][_0x97ca('0x32')](_0x4c530a[_0x97ca('0x54')](_0x1153b4),{'individualHooks':!![]});}})['then'](function(){if(_0x47516f){return _0x47516f[_0x97ca('0x33')]({'online':!![],'lastLoginAt':moment()[_0x97ca('0x27')](_0x97ca('0x2d')),'voicePause':_0x47516f[_0x97ca('0x48')]||![],'mailPause':_0x47516f[_0x97ca('0x48')]||![],'chatPause':_0x47516f[_0x97ca('0x48')]||![],'faxPause':_0x47516f[_0x97ca('0x48')]||![],'smsPause':_0x47516f[_0x97ca('0x48')]||![],'openchannelPause':_0x47516f['loginInPause']||![],'pauseType':_0x47516f[_0x97ca('0x48')]?_0x97ca('0x53'):null,'lastPauseAt':moment()[_0x97ca('0x27')]('YYYY-MM-DD\x20HH:mm:ss'),'interface':_0x2427ae});}})[_0x97ca('0x15')](function(_0x5a73cb){_0x2cfee1(_0x5a73cb);})[_0x97ca('0x18')](function(_0x5ca4b4){_0x536ea2(_0x3e5670[_0x97ca('0x19')](0x1f4,_0x5ca4b4['message']));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index a4d3dfd..529275d 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 _0x3cfd=['save','remove','update','emit','removeListener','length','./user.events'];(function(_0x1d8fb7,_0x2d990d){var _0x35b6ea=function(_0x550c69){while(--_0x550c69){_0x1d8fb7['push'](_0x1d8fb7['shift']());}};_0x35b6ea(++_0x2d990d);}(_0x3cfd,0xa0));var _0xd3cf=function(_0x7a7f75,_0x202c7c){_0x7a7f75=_0x7a7f75-0x0;var _0x3e3004=_0x3cfd[_0x7a7f75];return _0x3e3004;};'use strict';var UserEvents=require(_0xd3cf('0x0'));var events=[_0xd3cf('0x1'),_0xd3cf('0x2'),_0xd3cf('0x3')];function createListener(_0x101c72,_0x5a40f9){return function(_0x45a82b){_0x5a40f9[_0xd3cf('0x4')](_0x101c72,_0x45a82b);};}function removeListener(_0x231fd4,_0x3a8058){return function(){UserEvents[_0xd3cf('0x5')](_0x231fd4,_0x3a8058);};}exports['register']=function(_0x3ec6a5){for(var _0x2f8399=0x0,_0x504aa5=events[_0xd3cf('0x6')];_0x2f8399<_0x504aa5;_0x2f8399++){var _0x3bf842=events[_0x2f8399];var _0x36c199=createListener('user:'+_0x3bf842,_0x3ec6a5);UserEvents['on'](_0x3bf842,_0x36c199);}}; \ No newline at end of file +var _0x576d=['emit','removeListener','register','length','./user.events','save','remove'];(function(_0x547a6b,_0x607a82){var _0x513e24=function(_0x28f690){while(--_0x28f690){_0x547a6b['push'](_0x547a6b['shift']());}};_0x513e24(++_0x607a82);}(_0x576d,0x146));var _0xd576=function(_0x46a74f,_0x12457a){_0x46a74f=_0x46a74f-0x0;var _0x4f822e=_0x576d[_0x46a74f];return _0x4f822e;};'use strict';var UserEvents=require(_0xd576('0x0'));var events=[_0xd576('0x1'),_0xd576('0x2'),'update'];function createListener(_0x2c8c93,_0x1fc127){return function(_0x350053){_0x1fc127[_0xd576('0x3')](_0x2c8c93,_0x350053);};}function removeListener(_0xe8cdae,_0x4e0976){return function(){UserEvents[_0xd576('0x4')](_0xe8cdae,_0x4e0976);};}exports[_0xd576('0x5')]=function(_0x259a6f){for(var _0xe4f950=0x0,_0x5690f3=events[_0xd576('0x6')];_0xe4f950<_0x5690f3;_0xe4f950++){var _0x1fa093=events[_0xe4f950];var _0x1f12bd=createListener('user:'+_0x1fa093,_0x259a6f);UserEvents['on'](_0x1fa093,_0x1f12bd);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index 343a37a..4b7af91 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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x2d909d,_0x2e2072){var _0x40cc8d=function(_0x3733e3){while(--_0x3733e3){_0x2d909d['push'](_0x2d909d['shift']());}};_0x40cc8d(++_0x2e2072);}(_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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x236ce3,_0xb8d03f){var _0x4a3f88=function(_0x233607){while(--_0x233607){_0x236ce3['push'](_0x236ce3['shift']());}};_0x4a3f88(++_0xb8d03f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xa9e0[_0x6131cd];return _0x47e916;};'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/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index ea7cb29..352ce83 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 _0xcaa6=['sequelize','exports','INTEGER'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xcaa6,0x1ad));var _0x6caa=function(_0x537d12,_0x3b0a0b){_0x537d12=_0x537d12-0x0;var _0x31bc7a=_0xcaa6[_0x537d12];return _0x31bc7a;};'use strict';var Sequelize=require(_0x6caa('0x0'));module[_0x6caa('0x1')]={'penalty':{'type':Sequelize[_0x6caa('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x9bb9=['sequelize','exports'];(function(_0x538eaf,_0x568445){var _0x402e72=function(_0xa30875){while(--_0xa30875){_0x538eaf['push'](_0x538eaf['shift']());}};_0x402e72(++_0x568445);}(_0x9bb9,0x84));var _0x99bb=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x9bb9[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x99bb('0x0'));module[_0x99bb('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'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 c169c5b..1863a55 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 _0x924e=['path','rimraf','./userChatQueue.attributes','exports','define','UserChatQueue','user_has_chat_queues','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x924e,0x89));var _0xe924=function(_0xa0a64d,_0x5da164){_0xa0a64d=_0xa0a64d-0x0;var _0x5bb346=_0x924e[_0xa0a64d];return _0x5bb346;};'use strict';var _=require(_0xe924('0x0'));var util=require(_0xe924('0x1'));var logger=require(_0xe924('0x2'))(_0xe924('0x3'));var moment=require('moment');var BPromise=require(_0xe924('0x4'));var rp=require(_0xe924('0x5'));var fs=require('fs');var path=require(_0xe924('0x6'));var rimraf=require(_0xe924('0x7'));var config=require('../../config/environment');var attributes=require(_0xe924('0x8'));module[_0xe924('0x9')]=function(_0x5745a2,_0x4e1c9f){return _0x5745a2[_0xe924('0xa')](_0xe924('0xb'),attributes,{'tableName':_0xe924('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4924=['define','UserChatQueue','lodash','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./userChatQueue.attributes','exports'];(function(_0x4d2deb,_0x173635){var _0x1e2b4b=function(_0x3f3095){while(--_0x3f3095){_0x4d2deb['push'](_0x4d2deb['shift']());}};_0x1e2b4b(++_0x173635);}(_0x4924,0x91));var _0x4492=function(_0x49fcfb,_0x504dec){_0x49fcfb=_0x49fcfb-0x0;var _0x964926=_0x4924[_0x49fcfb];return _0x964926;};'use strict';var _=require(_0x4492('0x0'));var util=require(_0x4492('0x1'));var logger=require(_0x4492('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x4492('0x3'));var fs=require('fs');var path=require(_0x4492('0x4'));var rimraf=require(_0x4492('0x5'));var config=require(_0x4492('0x6'));var attributes=require(_0x4492('0x7'));module[_0x4492('0x8')]=function(_0x5a31ab,_0x222e63){return _0x5a31ab[_0x4492('0x9')](_0x4492('0xa'),attributes,{'tableName':'user_has_chat_queues','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 8e97db0..5da5fb6 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 _0x9f57=['then','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','request'];(function(_0x3ac78d,_0x162f0a){var _0x5135d9=function(_0x31e741){while(--_0x31e741){_0x3ac78d['push'](_0x3ac78d['shift']());}};_0x5135d9(++_0x162f0a);}(_0x9f57,0xfc));var _0x79f5=function(_0x2162ca,_0x503cf3){_0x2162ca=_0x2162ca-0x0;var _0x116643=_0x9f57[_0x2162ca];return _0x116643;};'use strict';var _=require(_0x79f5('0x0'));var util=require(_0x79f5('0x1'));var moment=require(_0x79f5('0x2'));var BPromise=require(_0x79f5('0x3'));var rs=require(_0x79f5('0x4'));var fs=require('fs');var Redis=require(_0x79f5('0x5'));var db=require(_0x79f5('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x79f5('0x7'))(_0x79f5('0x8'));var config=require('../../config/environment');var jayson=require(_0x79f5('0x9'));var client=jayson[_0x79f5('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x481bc4,_0x2b3563,_0x2688ac){return new BPromise(function(_0x420ee1,_0x2fc4a3){return client[_0x79f5('0xb')](_0x481bc4,_0x2688ac)[_0x79f5('0xc')](function(_0x1b7467){logger[_0x79f5('0xd')](_0x79f5('0xe'),_0x2b3563,_0x79f5('0xf'));logger[_0x79f5('0x10')](_0x79f5('0x11'),_0x2b3563,_0x79f5('0xf'),JSON[_0x79f5('0x12')](_0x1b7467));if(_0x1b7467[_0x79f5('0x13')]){if(_0x1b7467[_0x79f5('0x13')][_0x79f5('0x14')]===0x1f4){logger[_0x79f5('0x13')]('UserChatQueue,\x20%s,\x20%s',_0x2b3563,_0x1b7467[_0x79f5('0x13')]['message']);return _0x2fc4a3(_0x1b7467[_0x79f5('0x13')][_0x79f5('0x15')]);}logger[_0x79f5('0x13')](_0x79f5('0xe'),_0x2b3563,_0x1b7467[_0x79f5('0x13')]['message']);return _0x420ee1(_0x1b7467[_0x79f5('0x13')][_0x79f5('0x15')]);}else{logger[_0x79f5('0xd')](_0x79f5('0xe'),_0x2b3563,_0x79f5('0xf'));_0x420ee1(_0x1b7467[_0x79f5('0x16')][_0x79f5('0x15')]);}})[_0x79f5('0x17')](function(_0x46e809){logger[_0x79f5('0x13')](_0x79f5('0xe'),_0x2b3563,_0x46e809);_0x2fc4a3(_0x46e809);});});} \ No newline at end of file +var _0xc9c4=['debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','request','then','info','UserChatQueue,\x20%s,\x20%s','request\x20sent'];(function(_0x134827,_0x21f6ed){var _0x366671=function(_0x4dc8d4){while(--_0x4dc8d4){_0x134827['push'](_0x134827['shift']());}};_0x366671(++_0x21f6ed);}(_0xc9c4,0x1ea));var _0x4c9c=function(_0x3d8e50,_0x303a43){_0x3d8e50=_0x3d8e50-0x0;var _0x591754=_0xc9c4[_0x3d8e50];return _0x591754;};'use strict';var _=require(_0x4c9c('0x0'));var util=require(_0x4c9c('0x1'));var moment=require(_0x4c9c('0x2'));var BPromise=require(_0x4c9c('0x3'));var rs=require(_0x4c9c('0x4'));var fs=require('fs');var Redis=require(_0x4c9c('0x5'));var db=require(_0x4c9c('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x4c9c('0x7'))(_0x4c9c('0x8'));var config=require(_0x4c9c('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x4c9c('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x382aec,_0x10c3d6,_0x34f839){return new BPromise(function(_0x1166b8,_0x1cd5fc){return client[_0x4c9c('0xb')](_0x382aec,_0x34f839)[_0x4c9c('0xc')](function(_0x4f69ab){logger[_0x4c9c('0xd')](_0x4c9c('0xe'),_0x10c3d6,_0x4c9c('0xf'));logger[_0x4c9c('0x10')](_0x4c9c('0x11'),_0x10c3d6,_0x4c9c('0xf'),JSON[_0x4c9c('0x12')](_0x4f69ab));if(_0x4f69ab[_0x4c9c('0x13')]){if(_0x4f69ab[_0x4c9c('0x13')]['code']===0x1f4){logger['error'](_0x4c9c('0xe'),_0x10c3d6,_0x4f69ab['error'][_0x4c9c('0x14')]);return _0x1cd5fc(_0x4f69ab['error'][_0x4c9c('0x14')]);}logger[_0x4c9c('0x13')](_0x4c9c('0xe'),_0x10c3d6,_0x4f69ab[_0x4c9c('0x13')][_0x4c9c('0x14')]);return _0x1166b8(_0x4f69ab[_0x4c9c('0x13')][_0x4c9c('0x14')]);}else{logger[_0x4c9c('0xd')](_0x4c9c('0xe'),_0x10c3d6,_0x4c9c('0xf'));_0x1166b8(_0x4f69ab[_0x4c9c('0x15')][_0x4c9c('0x14')]);}})['catch'](function(_0x588a1a){logger[_0x4c9c('0x13')](_0x4c9c('0xe'),_0x10c3d6,_0x588a1a);_0x1cd5fc(_0x588a1a);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index d85c3a8..f48f997 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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x2ee944,_0x1614aa){var _0x7e5b60=function(_0x507df7){while(--_0x507df7){_0x2ee944['push'](_0x2ee944['shift']());}};_0x7e5b60(++_0x1614aa);}(_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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x19094c,_0xf66e76){var _0x6934d2=function(_0x14e39b){while(--_0x14e39b){_0x19094c['push'](_0x19094c['shift']());}};_0x6934d2(++_0xf66e76);}(_0x70e0,0x17b));var _0x070e=function(_0xe498c0,_0x5eb8ba){_0xe498c0=_0xe498c0-0x0;var _0x3961ec=_0x70e0[_0xe498c0];return _0x3961ec;};'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 8de31c7..247a740 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 _0x0a55=['sequelize','exports','INTEGER'];(function(_0x150c1b,_0x1d683e){var _0x1fc7a7=function(_0x30d999){while(--_0x30d999){_0x150c1b['push'](_0x150c1b['shift']());}};_0x1fc7a7(++_0x1d683e);}(_0x0a55,0x1d7));var _0x50a5=function(_0xf84528,_0x1a841d){_0xf84528=_0xf84528-0x0;var _0x59f125=_0x0a55[_0xf84528];return _0x59f125;};'use strict';var Sequelize=require(_0x50a5('0x0'));module[_0x50a5('0x1')]={'penalty':{'type':Sequelize[_0x50a5('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x50a5('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xfdb2=['sequelize','INTEGER'];(function(_0x3a3e38,_0x408ae1){var _0x402708=function(_0x5c2102){while(--_0x5c2102){_0x3a3e38['push'](_0x3a3e38['shift']());}};_0x402708(++_0x408ae1);}(_0xfdb2,0x1ec));var _0x2fdb=function(_0x1ea356,_0x1c6819){_0x1ea356=_0x1ea356-0x0;var _0x23845f=_0xfdb2[_0x1ea356];return _0x23845f;};'use strict';var Sequelize=require(_0x2fdb('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x2fdb('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x2fdb('0x1')],'defaultValue':0x0},'queue':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index a36b835..334d121 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 _0x2435=['UserFaxQueue','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./userFaxQueue.attributes'];(function(_0x49d21f,_0x6e7f5){var _0x1b93f2=function(_0x1cd8e7){while(--_0x1cd8e7){_0x49d21f['push'](_0x49d21f['shift']());}};_0x1b93f2(++_0x6e7f5);}(_0x2435,0x1af));var _0x5243=function(_0x2d2c16,_0x4e88b6){_0x2d2c16=_0x2d2c16-0x0;var _0x53f2fb=_0x2435[_0x2d2c16];return _0x53f2fb;};'use strict';var _=require(_0x5243('0x0'));var util=require('util');var logger=require(_0x5243('0x1'))(_0x5243('0x2'));var moment=require(_0x5243('0x3'));var BPromise=require(_0x5243('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5243('0x5'));var rimraf=require(_0x5243('0x6'));var config=require(_0x5243('0x7'));var attributes=require(_0x5243('0x8'));module['exports']=function(_0xcf966d,_0x5620a8){return _0xcf966d['define'](_0x5243('0x9'),attributes,{'tableName':'user_has_fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9cbf=['../../config/environment','./userFaxQueue.attributes','define','UserFaxQueue','user_has_fax_queues','../../config/logger','moment','bluebird'];(function(_0x53aeb3,_0x2fe85c){var _0x47b3c8=function(_0x181ab2){while(--_0x181ab2){_0x53aeb3['push'](_0x53aeb3['shift']());}};_0x47b3c8(++_0x2fe85c);}(_0x9cbf,0x12d));var _0xf9cb=function(_0x247012,_0x2ea6fe){_0x247012=_0x247012-0x0;var _0x4d93d7=_0x9cbf[_0x247012];return _0x4d93d7;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xf9cb('0x0'))('api');var moment=require(_0xf9cb('0x1'));var BPromise=require(_0xf9cb('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xf9cb('0x3'));var attributes=require(_0xf9cb('0x4'));module['exports']=function(_0x55b197,_0x551653){return _0x55b197[_0xf9cb('0x5')](_0xf9cb('0x6'),attributes,{'tableName':_0xf9cb('0x7'),'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 d2e03ec..d20bc68 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 _0xbb92=['debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','jayson/promise','client','http','request','then','UserFaxQueue,\x20%s,\x20%s'];(function(_0x466bf0,_0x158b01){var _0x37b958=function(_0x6cb0e3){while(--_0x6cb0e3){_0x466bf0['push'](_0x466bf0['shift']());}};_0x37b958(++_0x158b01);}(_0xbb92,0x111));var _0x2bb9=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xbb92[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x2bb9('0x0'));var util=require(_0x2bb9('0x1'));var moment=require(_0x2bb9('0x2'));var BPromise=require(_0x2bb9('0x3'));var rs=require(_0x2bb9('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2bb9('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x2bb9('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x2bb9('0x7'));var client=jayson[_0x2bb9('0x8')][_0x2bb9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3e9b0b,_0x2f4294,_0x5ab1d9){return new BPromise(function(_0x18d66f,_0x224489){return client[_0x2bb9('0xa')](_0x3e9b0b,_0x5ab1d9)[_0x2bb9('0xb')](function(_0x49e438){logger['info'](_0x2bb9('0xc'),_0x2f4294,'request\x20sent');logger[_0x2bb9('0xd')](_0x2bb9('0xe'),_0x2f4294,_0x2bb9('0xf'),JSON['stringify'](_0x49e438));if(_0x49e438['error']){if(_0x49e438[_0x2bb9('0x10')][_0x2bb9('0x11')]===0x1f4){logger['error']('UserFaxQueue,\x20%s,\x20%s',_0x2f4294,_0x49e438[_0x2bb9('0x10')][_0x2bb9('0x12')]);return _0x224489(_0x49e438[_0x2bb9('0x10')]['message']);}logger[_0x2bb9('0x10')](_0x2bb9('0xc'),_0x2f4294,_0x49e438[_0x2bb9('0x10')]['message']);return _0x18d66f(_0x49e438['error'][_0x2bb9('0x12')]);}else{logger[_0x2bb9('0x13')](_0x2bb9('0xc'),_0x2f4294,_0x2bb9('0xf'));_0x18d66f(_0x49e438[_0x2bb9('0x14')][_0x2bb9('0x12')]);}})[_0x2bb9('0x15')](function(_0x109cae){logger[_0x2bb9('0x10')]('UserFaxQueue,\x20%s,\x20%s',_0x2f4294,_0x109cae);_0x224489(_0x109cae);});});} \ No newline at end of file +var _0xc815=['then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','UserFaxQueue,\x20%s,\x20%s,\x20%s','error','message','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request'];(function(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0xc815,0x15d));var _0x5c81=function(_0x255d5b,_0x4f6f35){_0x255d5b=_0x255d5b-0x0;var _0x3e141a=_0xc815[_0x255d5b];return _0x3e141a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x5c81('0x0'));var BPromise=require(_0x5c81('0x1'));var rs=require(_0x5c81('0x2'));var fs=require('fs');var Redis=require(_0x5c81('0x3'));var db=require(_0x5c81('0x4'))['db'];var utils=require(_0x5c81('0x5'));var logger=require(_0x5c81('0x6'))(_0x5c81('0x7'));var config=require(_0x5c81('0x8'));var jayson=require(_0x5c81('0x9'));var client=jayson['client'][_0x5c81('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x23aeb5,_0x1da22f,_0x291ce4){return new BPromise(function(_0x35ddc4,_0x4d87a0){return client[_0x5c81('0xb')](_0x23aeb5,_0x291ce4)[_0x5c81('0xc')](function(_0x522ce1){logger[_0x5c81('0xd')](_0x5c81('0xe'),_0x1da22f,_0x5c81('0xf'));logger['debug'](_0x5c81('0x10'),_0x1da22f,_0x5c81('0xf'),JSON['stringify'](_0x522ce1));if(_0x522ce1[_0x5c81('0x11')]){if(_0x522ce1[_0x5c81('0x11')]['code']===0x1f4){logger[_0x5c81('0x11')]('UserFaxQueue,\x20%s,\x20%s',_0x1da22f,_0x522ce1[_0x5c81('0x11')][_0x5c81('0x12')]);return _0x4d87a0(_0x522ce1[_0x5c81('0x11')][_0x5c81('0x12')]);}logger[_0x5c81('0x11')](_0x5c81('0xe'),_0x1da22f,_0x522ce1[_0x5c81('0x11')][_0x5c81('0x12')]);return _0x35ddc4(_0x522ce1[_0x5c81('0x11')][_0x5c81('0x12')]);}else{logger[_0x5c81('0xd')](_0x5c81('0xe'),_0x1da22f,_0x5c81('0xf'));_0x35ddc4(_0x522ce1['result']['message']);}})['catch'](function(_0x23d823){logger['error']('UserFaxQueue,\x20%s,\x20%s',_0x1da22f,_0x23d823);_0x4d87a0(_0x23d823);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index 52e4bf0..6652a6a 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x94cd9e,_0x2b50f2){var _0x1bf136=function(_0xf97f0){while(--_0xf97f0){_0x94cd9e['push'](_0x94cd9e['shift']());}};_0x1bf136(++_0x2b50f2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xa9e0[_0x2b10c6];return _0x3789d2;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x152a03,_0x41a4fe){var _0x3ccbd0=function(_0x4fbf24){while(--_0x4fbf24){_0x152a03['push'](_0x152a03['shift']());}};_0x3ccbd0(++_0x41a4fe);}(_0x9c44,0x178));var _0x49c4=function(_0x4f9b18,_0x2cb5ca){_0x4f9b18=_0x4f9b18-0x0;var _0x29f20c=_0x9c44[_0x4f9b18];return _0x29f20c;};'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/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index 5589603..3e9f425 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 _0xc83f=['sequelize','exports'];(function(_0x1e36d8,_0x41ac49){var _0x5c4ed5=function(_0x444aa8){while(--_0x444aa8){_0x1e36d8['push'](_0x1e36d8['shift']());}};_0x5c4ed5(++_0x41ac49);}(_0xc83f,0xf6));var _0xfc83=function(_0xe7d655,_0x184955){_0xe7d655=_0xe7d655-0x0;var _0x3e4804=_0xc83f[_0xe7d655];return _0x3e4804;};'use strict';var Sequelize=require(_0xfc83('0x0'));module[_0xfc83('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xac05=['exports','INTEGER'];(function(_0x62656,_0x2bddd7){var _0x58569a=function(_0x54267a){while(--_0x54267a){_0x62656['push'](_0x62656['shift']());}};_0x58569a(++_0x2bddd7);}(_0xac05,0xd6));var _0x5ac0=function(_0x373c15,_0x5a6b2e){_0x373c15=_0x373c15-0x0;var _0x18b000=_0xac05[_0x373c15];return _0x18b000;};'use strict';var Sequelize=require('sequelize');module[_0x5ac0('0x0')]={'penalty':{'type':Sequelize[_0x5ac0('0x1')],'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 53544d1..a92f23d 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 _0x0e9e=['request-promise','path','./userMailQueue.attributes','exports','define','UserMailQueue','user_has_mail_queues','lodash','util','../../config/logger','api','moment'];(function(_0x2706da,_0x3856f5){var _0x3ba87e=function(_0x479a79){while(--_0x479a79){_0x2706da['push'](_0x2706da['shift']());}};_0x3ba87e(++_0x3856f5);}(_0x0e9e,0xa3));var _0xe0e9=function(_0x367f8c,_0x313e21){_0x367f8c=_0x367f8c-0x0;var _0x118639=_0x0e9e[_0x367f8c];return _0x118639;};'use strict';var _=require(_0xe0e9('0x0'));var util=require(_0xe0e9('0x1'));var logger=require(_0xe0e9('0x2'))(_0xe0e9('0x3'));var moment=require(_0xe0e9('0x4'));var BPromise=require('bluebird');var rp=require(_0xe0e9('0x5'));var fs=require('fs');var path=require(_0xe0e9('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xe0e9('0x7'));module[_0xe0e9('0x8')]=function(_0x4935d9,_0x5b3e74){return _0x4935d9[_0xe0e9('0x9')](_0xe0e9('0xa'),attributes,{'tableName':_0xe0e9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3cf1=['define','user_has_mail_queues','lodash','../../config/logger','api','bluebird','rimraf','exports'];(function(_0x506a20,_0x4ae51d){var _0x4d2592=function(_0x53bfa6){while(--_0x53bfa6){_0x506a20['push'](_0x506a20['shift']());}};_0x4d2592(++_0x4ae51d);}(_0x3cf1,0x15a));var _0x13cf=function(_0x161c15,_0x22ae04){_0x161c15=_0x161c15-0x0;var _0xc64a6c=_0x3cf1[_0x161c15];return _0xc64a6c;};'use strict';var _=require(_0x13cf('0x0'));var util=require('util');var logger=require(_0x13cf('0x1'))(_0x13cf('0x2'));var moment=require('moment');var BPromise=require(_0x13cf('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x13cf('0x4'));var config=require('../../config/environment');var attributes=require('./userMailQueue.attributes');module[_0x13cf('0x5')]=function(_0x1e88ba,_0x5f528b){return _0x1e88ba[_0x13cf('0x6')]('UserMailQueue',attributes,{'tableName':_0x13cf('0x7'),'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 9f3081e..d26df32 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 _0x9957=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x3f3882,_0x46187b){var _0x3c9c7b=function(_0x1e802c){while(--_0x1e802c){_0x3f3882['push'](_0x3f3882['shift']());}};_0x3c9c7b(++_0x46187b);}(_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']('UserMailQueue,\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 _0x5fc3=['../../config/environment','jayson/promise','request','then','info','request\x20sent','debug','stringify','error','code','message','UserMailQueue,\x20%s,\x20%s','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x5c2f54,_0x38ff14){var _0x316d47=function(_0x42e014){while(--_0x42e014){_0x5c2f54['push'](_0x5c2f54['shift']());}};_0x316d47(++_0x38ff14);}(_0x5fc3,0xa8));var _0x35fc=function(_0x11a55c,_0x4eced9){_0x11a55c=_0x11a55c-0x0;var _0x26c390=_0x5fc3[_0x11a55c];return _0x26c390;};'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')]('UserMailQueue,\x20%s,\x20%s',_0x508b32,_0x35fc('0xd'));logger[_0x35fc('0xe')]('UserMailQueue,\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']('UserMailQueue,\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/userNotification/index.js b/server/api/userNotification/index.js index 2b817df..01aecbe 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 _0x8f83=['fs-extra','../../components/auth/service','../../components/interaction/service','post','isAuthenticated','sendUserNotification','multer','util','path','express','Router'];(function(_0x4c8805,_0x996d5e){var _0x2ff438=function(_0x22443e){while(--_0x22443e){_0x4c8805['push'](_0x4c8805['shift']());}};_0x2ff438(++_0x996d5e);}(_0x8f83,0xed));var _0x38f8=function(_0x304602,_0x32d265){_0x304602=_0x304602-0x0;var _0x586307=_0x8f83[_0x304602];return _0x586307;};'use strict';var multer=require(_0x38f8('0x0'));var util=require(_0x38f8('0x1'));var path=require(_0x38f8('0x2'));var timeout=require('connect-timeout');var express=require(_0x38f8('0x3'));var router=express[_0x38f8('0x4')]();var fs_extra=require(_0x38f8('0x5'));var auth=require(_0x38f8('0x6'));var interaction=require(_0x38f8('0x7'));var config=require('../../config/environment');var controller=require('./userNotification.controller');router[_0x38f8('0x8')]('/',auth[_0x38f8('0x9')](),controller[_0x38f8('0xa')]);module['exports']=router; \ No newline at end of file +var _0x1ca8=['path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./userNotification.controller','post','isAuthenticated','sendUserNotification','exports','multer','util'];(function(_0x176bd6,_0x3e9bd1){var _0x5e5c0f=function(_0xd77e90){while(--_0xd77e90){_0x176bd6['push'](_0x176bd6['shift']());}};_0x5e5c0f(++_0x3e9bd1);}(_0x1ca8,0x1ba));var _0x81ca=function(_0x12a3a5,_0xe829a6){_0x12a3a5=_0x12a3a5-0x0;var _0x443e3a=_0x1ca8[_0x12a3a5];return _0x443e3a;};'use strict';var multer=require(_0x81ca('0x0'));var util=require(_0x81ca('0x1'));var path=require(_0x81ca('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x81ca('0x3')]();var fs_extra=require(_0x81ca('0x4'));var auth=require(_0x81ca('0x5'));var interaction=require(_0x81ca('0x6'));var config=require('../../config/environment');var controller=require(_0x81ca('0x7'));router[_0x81ca('0x8')]('/',auth[_0x81ca('0x9')](),controller[_0x81ca('0xa')]);module[_0x81ca('0xb')]=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index d88dc02..7c70ba5 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 _0xf749=['sequelize','exports','TEXT','STRING'];(function(_0x5aee96,_0x7fe6ce){var _0x46e81e=function(_0x1e079f){while(--_0x1e079f){_0x5aee96['push'](_0x5aee96['shift']());}};_0x46e81e(++_0x7fe6ce);}(_0xf749,0x70));var _0x9f74=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xf749[_0x59ee6f];return _0x4c0979;};'use strict';var Sequelize=require(_0x9f74('0x0'));module[_0x9f74('0x1')]={'body':{'type':Sequelize[_0x9f74('0x2')]},'senderName':{'type':Sequelize[_0x9f74('0x3')]},'recipientsId':{'type':Sequelize['TEXT']},'recipientsDescription':{'type':Sequelize[_0x9f74('0x3')]},'beep':{'type':Sequelize['BOOLEAN']}}; \ No newline at end of file +var _0x8f75=['BOOLEAN','exports','TEXT','STRING'];(function(_0x453536,_0x46622b){var _0x252fb0=function(_0x14e766){while(--_0x14e766){_0x453536['push'](_0x453536['shift']());}};_0x252fb0(++_0x46622b);}(_0x8f75,0x1d9));var _0x58f7=function(_0x41ea6a,_0x5c608b){_0x41ea6a=_0x41ea6a-0x0;var _0x3e3b34=_0x8f75[_0x41ea6a];return _0x3e3b34;};'use strict';var Sequelize=require('sequelize');module[_0x58f7('0x0')]={'body':{'type':Sequelize[_0x58f7('0x1')]},'senderName':{'type':Sequelize['STRING']},'recipientsId':{'type':Sequelize[_0x58f7('0x1')]},'recipientsDescription':{'type':Sequelize[_0x58f7('0x2')]},'beep':{'type':Sequelize[_0x58f7('0x3')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index 7ffe39f..6023d50 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 _0x3643=['rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','end','stack','name','send','hasOwnProperty','body','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','error','Invalid\x20\x27recipients\x27\x20object','faxqueue','mailqueue','voicequeue','whatsappqueue','team','user','includes','model','isEmpty','beep','recipientsId','sortBy','transaction','UserNotification','senderName','forEach','recipient','emit','userNotification:send','text','Template','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','catch','startCase','toLowerCase','User','queue','replace','Queue','ids','all','union','getAgents','map'];(function(_0x231efb,_0x3fea4f){var _0x5e045b=function(_0x54d3b1){while(--_0x54d3b1){_0x231efb['push'](_0x231efb['shift']());}};_0x5e045b(++_0x3fea4f);}(_0x3643,0xba));var _0x3364=function(_0x4cca12,_0x31da07){_0x4cca12=_0x4cca12-0x0;var _0x3ac3c7=_0x3643[_0x4cca12];return _0x3ac3c7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3364('0x0'));var zipdir=require(_0x3364('0x1'));var jsonpatch=require(_0x3364('0x2'));var rp=require(_0x3364('0x3'));var moment=require(_0x3364('0x4'));var BPromise=require(_0x3364('0x5'));var Mustache=require(_0x3364('0x6'));var util=require(_0x3364('0x7'));var path=require('path');var sox=require(_0x3364('0x8'));var csv=require(_0x3364('0x9'));var ejs=require(_0x3364('0xa'));var fs=require('fs');var fs_extra=require(_0x3364('0xb'));var _=require('lodash');var squel=require(_0x3364('0xc'));var crypto=require(_0x3364('0xd'));var jsforce=require(_0x3364('0xe'));var deskjs=require(_0x3364('0xf'));var toCsv=require(_0x3364('0x9'));var querystring=require(_0x3364('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x3364('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x3364('0x12'));var hardwareService=require(_0x3364('0x13'));var logger=require('../../config/logger')(_0x3364('0x14'));var utils=require(_0x3364('0x15'));var config=require(_0x3364('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x3364('0x17')]=_[_0x3364('0x18')](config['redis'],{'host':_0x3364('0x19'),'port':0x18eb});var socket=require(_0x3364('0x1a'))(new Redis(config[_0x3364('0x17')]));require('./userNotification.socket')[_0x3364('0x1b')](socket);function respondWithStatusCode(_0x32d6ca,_0x280d21){_0x280d21=_0x280d21||0xcc;return function(_0x545b0c){if(_0x545b0c){return _0x32d6ca[_0x3364('0x1c')](_0x280d21);}return _0x32d6ca['status'](_0x280d21)['end']();};}function respondWithResult(_0x3d04b5,_0x994aaf){_0x994aaf=_0x994aaf||0xc8;return function(_0x445881){if(_0x445881){return _0x3d04b5[_0x3364('0x1d')](_0x994aaf)[_0x3364('0x1e')](_0x445881);}};}function respondWithFilteredResult(_0x4041fa,_0x9f6380){return function(_0x13649f){if(_0x13649f){var _0x603103=typeof _0x9f6380[_0x3364('0x1f')]===_0x3364('0x20')&&typeof _0x9f6380[_0x3364('0x21')]===_0x3364('0x20');var _0x664265=_0x13649f[_0x3364('0x22')];var _0x50b9f2=_0x603103?0x0:_0x9f6380[_0x3364('0x1f')];var _0x58ebdf=_0x603103?_0x13649f[_0x3364('0x22')]:_0x9f6380['offset']+_0x9f6380[_0x3364('0x21')];var _0x1dfb7a;if(_0x58ebdf>=_0x664265){_0x58ebdf=_0x664265;_0x1dfb7a=0xc8;}else{_0x1dfb7a=0xce;}_0x4041fa[_0x3364('0x1d')](_0x1dfb7a);return _0x4041fa['set'](_0x3364('0x23'),_0x50b9f2+'-'+_0x58ebdf+'/'+_0x664265)[_0x3364('0x1e')](_0x13649f);}return null;};}function patchUpdates(_0xecd93){return function(_0x44092c){try{jsonpatch[_0x3364('0x24')](_0x44092c,_0xecd93,!![]);}catch(_0x3a20c0){return BPromise[_0x3364('0x25')](_0x3a20c0);}return _0x44092c[_0x3364('0x26')]();};}function saveUpdates(_0x108947,_0xd52fb6){return function(_0x470832){if(_0x470832){return _0x470832[_0x3364('0x27')](_0x108947)[_0x3364('0x28')](function(_0x2071db){return _0x2071db;});}return null;};}function removeEntity(_0x35e0ca,_0x4f4440){return function(_0x1e5e2f){if(_0x1e5e2f){return _0x1e5e2f['destroy']()[_0x3364('0x28')](function(){_0x35e0ca[_0x3364('0x1d')](0xcc)[_0x3364('0x29')]();});}};}function handleEntityNotFound(_0x254d04,_0x93ae52){return function(_0xeb6b0c){if(!_0xeb6b0c){_0x254d04[_0x3364('0x1c')](0x194);}return _0xeb6b0c;};}function handleError(_0x46a27f,_0x47905e){_0x47905e=_0x47905e||0x1f4;return function(_0x428445){logger['error'](_0x428445[_0x3364('0x2a')]);if(_0x428445[_0x3364('0x2b')]){delete _0x428445[_0x3364('0x2b')];}_0x46a27f[_0x3364('0x1d')](_0x47905e)[_0x3364('0x2c')](_0x428445);};}exports['sendUserNotification']=function(_0x579eff,_0x59e0a1,_0x4bb8b1){if(!_0x579eff['body'][_0x3364('0x2d')]('text')&&!_0x579eff[_0x3364('0x2e')][_0x3364('0x2d')](_0x3364('0x2f'))){throw new db[(_0x3364('0x30'))][(_0x3364('0x31'))](_0x3364('0x32'));}else{if(_0x579eff[_0x3364('0x2e')][_0x3364('0x2d')](_0x3364('0x2f'))&&!_0x579eff[_0x3364('0x2e')][_0x3364('0x2d')](_0x3364('0x33'))){throw new db[(_0x3364('0x30'))][(_0x3364('0x31'))](_0x3364('0x34'));}if(!_0x579eff['body']['hasOwnProperty'](_0x3364('0x35'))){throw new db[(_0x3364('0x30'))]['ValidationError'](_0x3364('0x36'));}else{try{var _0x4081a0=JSON['parse'](_0x579eff[_0x3364('0x2e')]['recipients']);}catch(_0x3524f7){logger[_0x3364('0x37')](_0x3524f7);throw new db[(_0x3364('0x30'))][(_0x3364('0x31'))](_0x3364('0x38'));}var _0x409b62=['chatqueue',_0x3364('0x39'),_0x3364('0x3a'),'openchannelqueue','smsqueue',_0x3364('0x3b'),_0x3364('0x3c'),_0x3364('0x3d'),_0x3364('0x3e')];if(_['some'](_0x4081a0,function(_0x379c6f){return!_[_0x3364('0x3f')](_0x409b62,_0x379c6f[_0x3364('0x40')]['toLowerCase']());})){throw new db[(_0x3364('0x30'))]['ValidationError']('Invalid\x20model\x20in\x20\x27recipients\x27\x20object');}}}var _0x2589c5={};_0x2589c5['senderName']=_0x579eff[_0x3364('0x2e')][_0x3364('0x2d')]('senderName')?_0x579eff[_0x3364('0x2e')]['senderName']:_0x579eff[_0x3364('0x3e')]['fullname'];_0x2589c5['recipientsDescription']=_[_0x3364('0x41')](_0x579eff['body']['recipientsDescription'])?null:_0x579eff[_0x3364('0x2e')]['recipientsDescription'];_0x2589c5[_0x3364('0x42')]=_0x579eff[_0x3364('0x2e')][_0x3364('0x42')]||![];_0x2589c5['SenderId']=_0x579eff['user']['id'];return getContent(_0x579eff[_0x3364('0x2e')])[_0x3364('0x28')](function(_0x564234){_0x2589c5[_0x3364('0x2e')]=_0x564234;return getRecipients(_0x4081a0);})['then'](function(_0x351541){_0x2589c5[_0x3364('0x43')]=_[_0x3364('0x44')](_0x351541)['join'](',');return db['sequelize'][_0x3364('0x45')](function(_0x2039e5){return db[_0x3364('0x46')]['create'](_0x2589c5,{'raw':!![],'transaction':_0x2039e5})['then'](function(_0x3bbda7){var _0x495aca={'sender':_0x2589c5[_0x3364('0x47')],'description':_0x2589c5['recipientsDescription'],'content':_0x2589c5[_0x3364('0x2e')],'beep':_0x2589c5[_0x3364('0x42')]};_0x351541[_0x3364('0x48')](function(_0x56b17a){_0x495aca[_0x3364('0x49')]=_0x56b17a;socket[_0x3364('0x4a')](_0x3364('0x4b'),_0x495aca);});return _0x3bbda7;});});})[_0x3364('0x28')](respondWithResult(_0x59e0a1,0xc9))['catch'](handleError(_0x59e0a1,null));};function getContent(_0x371fca){return new BPromise(function(_0x4a6101,_0xd31a88){if(_0x371fca['text']){_0x4a6101(_0x371fca[_0x3364('0x4c')]);return;}return db[_0x3364('0x4d')][_0x3364('0x4e')]({'attributes':[_0x3364('0x4f')],'where':{'id':_0x371fca[_0x3364('0x2f')]},'raw':!![]})[_0x3364('0x28')](function(_0xe9ea4f){if(!_0xe9ea4f)throw new db['Sequelize'][(_0x3364('0x31'))](_0x3364('0x50'));var _0xff9d2b=Mustache['render'](_0xe9ea4f[_0x3364('0x4f')],_0x371fca[_0x3364('0x33')]);_0x4a6101(_0xff9d2b);})[_0x3364('0x51')](function(_0x4de3c1){_0xd31a88(_0x4de3c1);});});}function getRecipients(_0x32ce99){return new BPromise(function(_0x50c6af,_0x15578c){var _0x299a0c=[];var _0x1746e6=[];_0x32ce99[_0x3364('0x48')](function(_0x293803){var _0x46d4c6=_[_0x3364('0x52')](_0x293803[_0x3364('0x40')][_0x3364('0x53')]());if(_0x46d4c6===_0x3364('0x54')){_0x299a0c=_['union'](_0x299a0c,_0x293803['ids']);}else{if(_[_0x3364('0x3f')](_0x46d4c6,_0x3364('0x55')))_0x46d4c6=_0x46d4c6[_0x3364('0x56')](_0x3364('0x55'),_0x3364('0x57'));_0x293803[_0x3364('0x58')][_0x3364('0x48')](function(_0x569573){_0x1746e6['push'](getAgents(_0x46d4c6,_0x569573));});}});return BPromise[_0x3364('0x59')](_0x1746e6)[_0x3364('0x28')](function(_0x238b6e){_0x299a0c=_[_0x3364('0x5a')](_0x299a0c,_['flatten'](_0x238b6e));_0x50c6af(_0x299a0c);})[_0x3364('0x51')](function(_0x425c8f){_0x15578c(_0x425c8f);});});}function getAgents(_0x4689a4,_0x1836ef){return new BPromise(function(_0x44c6e4,_0x479b22){return db[_0x4689a4]['findOne']({'where':{'id':_0x1836ef}})['then'](function(_0x1d9bab){return _0x1d9bab[_0x3364('0x5b')]({'attributes':['id'],'raw':!![]})['then'](function(_0x42fdc9){var _0x14ef4d=_[_0x3364('0x5c')](_0x42fdc9,'id');_0x44c6e4(_0x14ef4d);});})[_0x3364('0x51')](function(_0x45e625){_0x479b22(_0x45e625);});});} \ No newline at end of file +var _0x8d89=['zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./userNotification.socket','register','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','sendUserNotification','body','hasOwnProperty','Sequelize','view','ValidationError','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','Invalid\x20\x27recipients\x27\x20object','faxqueue','mailqueue','voicequeue','team','user','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','recipientsDescription','beep','SenderId','recipientsId','sortBy','join','sequelize','transaction','UserNotification','create','forEach','recipient','catch','text','Template','findOne','html','TemplateId','Invalid\x20\x27TemplateId\x27\x20parameter','startCase','union','ids','includes','queue','Queue','push','all','flatten','getAgents','eml-format','rimraf'];(function(_0x6c82c5,_0x41487b){var _0x4fa253=function(_0x26694b){while(--_0x26694b){_0x6c82c5['push'](_0x6c82c5['shift']());}};_0x4fa253(++_0x41487b);}(_0x8d89,0x66));var _0x98d8=function(_0x147bc1,_0x47f948){_0x147bc1=_0x147bc1-0x0;var _0x124e63=_0x8d89[_0x147bc1];return _0x124e63;};'use strict';var emlformat=require(_0x98d8('0x0'));var rimraf=require(_0x98d8('0x1'));var zipdir=require(_0x98d8('0x2'));var jsonpatch=require(_0x98d8('0x3'));var rp=require(_0x98d8('0x4'));var moment=require(_0x98d8('0x5'));var BPromise=require(_0x98d8('0x6'));var Mustache=require(_0x98d8('0x7'));var util=require(_0x98d8('0x8'));var path=require(_0x98d8('0x9'));var sox=require(_0x98d8('0xa'));var csv=require('to-csv');var ejs=require(_0x98d8('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x98d8('0xc'));var squel=require('squel');var crypto=require(_0x98d8('0xd'));var jsforce=require(_0x98d8('0xe'));var deskjs=require(_0x98d8('0xf'));var toCsv=require(_0x98d8('0x10'));var querystring=require(_0x98d8('0x11'));var Papa=require(_0x98d8('0x12'));var Redis=require(_0x98d8('0x13'));var authService=require(_0x98d8('0x14'));var qs=require(_0x98d8('0x15'));var as=require(_0x98d8('0x16'));var hardwareService=require(_0x98d8('0x17'));var logger=require(_0x98d8('0x18'))(_0x98d8('0x19'));var utils=require(_0x98d8('0x1a'));var config=require(_0x98d8('0x1b'));var licenseUtil=require(_0x98d8('0x1c'));var db=require(_0x98d8('0x1d'))['db'];config[_0x98d8('0x1e')]=_[_0x98d8('0x1f')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x98d8('0x20'))(new Redis(config[_0x98d8('0x1e')]));require(_0x98d8('0x21'))[_0x98d8('0x22')](socket);function respondWithStatusCode(_0x139398,_0x4fad09){_0x4fad09=_0x4fad09||0xcc;return function(_0x4fc494){if(_0x4fc494){return _0x139398[_0x98d8('0x23')](_0x4fad09);}return _0x139398['status'](_0x4fad09)[_0x98d8('0x24')]();};}function respondWithResult(_0x1a96b0,_0x1023b0){_0x1023b0=_0x1023b0||0xc8;return function(_0x40068e){if(_0x40068e){return _0x1a96b0[_0x98d8('0x25')](_0x1023b0)[_0x98d8('0x26')](_0x40068e);}};}function respondWithFilteredResult(_0x2788f2,_0x587e72){return function(_0x505c1a){if(_0x505c1a){var _0x21cf2e=typeof _0x587e72['offset']===_0x98d8('0x27')&&typeof _0x587e72[_0x98d8('0x28')]===_0x98d8('0x27');var _0x31c37b=_0x505c1a[_0x98d8('0x29')];var _0x3d473a=_0x21cf2e?0x0:_0x587e72[_0x98d8('0x2a')];var _0x383ffa=_0x21cf2e?_0x505c1a[_0x98d8('0x29')]:_0x587e72[_0x98d8('0x2a')]+_0x587e72[_0x98d8('0x28')];var _0x18281c;if(_0x383ffa>=_0x31c37b){_0x383ffa=_0x31c37b;_0x18281c=0xc8;}else{_0x18281c=0xce;}_0x2788f2['status'](_0x18281c);return _0x2788f2[_0x98d8('0x2b')](_0x98d8('0x2c'),_0x3d473a+'-'+_0x383ffa+'/'+_0x31c37b)['json'](_0x505c1a);}return null;};}function patchUpdates(_0x2eb929){return function(_0x50f6a9){try{jsonpatch[_0x98d8('0x2d')](_0x50f6a9,_0x2eb929,!![]);}catch(_0x2421f1){return BPromise[_0x98d8('0x2e')](_0x2421f1);}return _0x50f6a9[_0x98d8('0x2f')]();};}function saveUpdates(_0x3598e0,_0x24efca){return function(_0x548f8d){if(_0x548f8d){return _0x548f8d[_0x98d8('0x30')](_0x3598e0)[_0x98d8('0x31')](function(_0x13346e){return _0x13346e;});}return null;};}function removeEntity(_0x90913c,_0xff3b99){return function(_0x3b03bf){if(_0x3b03bf){return _0x3b03bf[_0x98d8('0x32')]()['then'](function(){_0x90913c[_0x98d8('0x25')](0xcc)[_0x98d8('0x24')]();});}};}function handleEntityNotFound(_0x8d0acf,_0x2c7a3b){return function(_0x3ed425){if(!_0x3ed425){_0x8d0acf[_0x98d8('0x23')](0x194);}return _0x3ed425;};}function handleError(_0x3bb580,_0x24d6bf){_0x24d6bf=_0x24d6bf||0x1f4;return function(_0x1db97b){logger[_0x98d8('0x33')](_0x1db97b[_0x98d8('0x34')]);if(_0x1db97b[_0x98d8('0x35')]){delete _0x1db97b[_0x98d8('0x35')];}_0x3bb580[_0x98d8('0x25')](_0x24d6bf)[_0x98d8('0x36')](_0x1db97b);};}exports[_0x98d8('0x37')]=function(_0x25ce85,_0x1e7032,_0x3227d3){if(!_0x25ce85[_0x98d8('0x38')][_0x98d8('0x39')]('text')&&!_0x25ce85[_0x98d8('0x38')][_0x98d8('0x39')]('TemplateId')){throw new db[(_0x98d8('0x3a'))]['ValidationError']('Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27');}else{if(_0x25ce85[_0x98d8('0x38')]['hasOwnProperty']('TemplateId')&&!_0x25ce85['body'][_0x98d8('0x39')](_0x98d8('0x3b'))){throw new db['Sequelize'][(_0x98d8('0x3c'))](_0x98d8('0x3d'));}if(!_0x25ce85[_0x98d8('0x38')]['hasOwnProperty'](_0x98d8('0x3e'))){throw new db[(_0x98d8('0x3a'))][(_0x98d8('0x3c'))](_0x98d8('0x3f'));}else{try{var _0x27ff30=JSON[_0x98d8('0x40')](_0x25ce85[_0x98d8('0x38')][_0x98d8('0x3e')]);}catch(_0x27489d){logger[_0x98d8('0x33')](_0x27489d);throw new db[(_0x98d8('0x3a'))][(_0x98d8('0x3c'))](_0x98d8('0x41'));}var _0x298768=['chatqueue',_0x98d8('0x42'),_0x98d8('0x43'),'openchannelqueue','smsqueue',_0x98d8('0x44'),'whatsappqueue',_0x98d8('0x45'),_0x98d8('0x46')];if(_['some'](_0x27ff30,function(_0x13bcf9){return!_['includes'](_0x298768,_0x13bcf9['model'][_0x98d8('0x47')]());})){throw new db[(_0x98d8('0x3a'))][(_0x98d8('0x3c'))](_0x98d8('0x48'));}}}var _0x48fa17={};_0x48fa17['senderName']=_0x25ce85[_0x98d8('0x38')]['hasOwnProperty'](_0x98d8('0x49'))?_0x25ce85[_0x98d8('0x38')]['senderName']:_0x25ce85[_0x98d8('0x46')][_0x98d8('0x4a')];_0x48fa17['recipientsDescription']=_['isEmpty'](_0x25ce85[_0x98d8('0x38')][_0x98d8('0x4b')])?null:_0x25ce85['body'][_0x98d8('0x4b')];_0x48fa17[_0x98d8('0x4c')]=_0x25ce85[_0x98d8('0x38')][_0x98d8('0x4c')]||![];_0x48fa17[_0x98d8('0x4d')]=_0x25ce85['user']['id'];return getContent(_0x25ce85[_0x98d8('0x38')])['then'](function(_0x1dec80){_0x48fa17[_0x98d8('0x38')]=_0x1dec80;return getRecipients(_0x27ff30);})[_0x98d8('0x31')](function(_0x65ad20){_0x48fa17[_0x98d8('0x4e')]=_[_0x98d8('0x4f')](_0x65ad20)[_0x98d8('0x50')](',');return db[_0x98d8('0x51')][_0x98d8('0x52')](function(_0x4fa797){return db[_0x98d8('0x53')][_0x98d8('0x54')](_0x48fa17,{'raw':!![],'transaction':_0x4fa797})[_0x98d8('0x31')](function(_0x1156a1){var _0x128e40={'sender':_0x48fa17[_0x98d8('0x49')],'description':_0x48fa17[_0x98d8('0x4b')],'content':_0x48fa17['body'],'beep':_0x48fa17[_0x98d8('0x4c')]};_0x65ad20[_0x98d8('0x55')](function(_0xd46a2e){_0x128e40[_0x98d8('0x56')]=_0xd46a2e;socket['emit']('userNotification:send',_0x128e40);});return _0x1156a1;});});})[_0x98d8('0x31')](respondWithResult(_0x1e7032,0xc9))[_0x98d8('0x57')](handleError(_0x1e7032,null));};function getContent(_0x2920b4){return new BPromise(function(_0x508cd3,_0x23686e){if(_0x2920b4[_0x98d8('0x58')]){_0x508cd3(_0x2920b4[_0x98d8('0x58')]);return;}return db[_0x98d8('0x59')][_0x98d8('0x5a')]({'attributes':[_0x98d8('0x5b')],'where':{'id':_0x2920b4[_0x98d8('0x5c')]},'raw':!![]})[_0x98d8('0x31')](function(_0x1622ef){if(!_0x1622ef)throw new db[(_0x98d8('0x3a'))][(_0x98d8('0x3c'))](_0x98d8('0x5d'));var _0x521e31=Mustache['render'](_0x1622ef[_0x98d8('0x5b')],_0x2920b4[_0x98d8('0x3b')]);_0x508cd3(_0x521e31);})[_0x98d8('0x57')](function(_0x39114c){_0x23686e(_0x39114c);});});}function getRecipients(_0x3f268f){return new BPromise(function(_0x174ca6,_0x249467){var _0x9a08f7=[];var _0x201d69=[];_0x3f268f[_0x98d8('0x55')](function(_0x4dd345){var _0xd493a=_[_0x98d8('0x5e')](_0x4dd345['model'][_0x98d8('0x47')]());if(_0xd493a==='User'){_0x9a08f7=_[_0x98d8('0x5f')](_0x9a08f7,_0x4dd345[_0x98d8('0x60')]);}else{if(_[_0x98d8('0x61')](_0xd493a,_0x98d8('0x62')))_0xd493a=_0xd493a['replace']('queue',_0x98d8('0x63'));_0x4dd345[_0x98d8('0x60')][_0x98d8('0x55')](function(_0x29e36e){_0x201d69[_0x98d8('0x64')](getAgents(_0xd493a,_0x29e36e));});}});return BPromise[_0x98d8('0x65')](_0x201d69)['then'](function(_0x81f405){_0x9a08f7=_[_0x98d8('0x5f')](_0x9a08f7,_[_0x98d8('0x66')](_0x81f405));_0x174ca6(_0x9a08f7);})[_0x98d8('0x57')](function(_0x2eebec){_0x249467(_0x2eebec);});});}function getAgents(_0x2b1bb9,_0x2de354){return new BPromise(function(_0x12b562,_0xa21ce9){return db[_0x2b1bb9][_0x98d8('0x5a')]({'where':{'id':_0x2de354}})['then'](function(_0x359a52){return _0x359a52[_0x98d8('0x67')]({'attributes':['id'],'raw':!![]})[_0x98d8('0x31')](function(_0x1a534c){var _0x56629c=_['map'](_0x1a534c,'id');_0x12b562(_0x56629c);});})[_0x98d8('0x57')](function(_0x214e78){_0xa21ce9(_0x214e78);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index a507dc4..c9a1447 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 _0x8dd3=['exports','setMaxListeners','update','emit','hasOwnProperty'];(function(_0x694143,_0x48bdd6){var _0x56a54e=function(_0x971ac6){while(--_0x971ac6){_0x694143['push'](_0x694143['shift']());}};_0x56a54e(++_0x48bdd6);}(_0x8dd3,0x100));var _0x38dd=function(_0x2c7d73,_0x17c4e9){_0x2c7d73=_0x2c7d73-0x0;var _0x2e8d18=_0x8dd3[_0x2c7d73];return _0x2e8d18;};'use strict';var EventEmitter=require('events');var UserNotification=require('../../mysqldb')['db']['UserNotification'];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x38dd('0x0')](0x0);var events={'afterCreate':'save','afterUpdate':_0x38dd('0x1'),'afterDestroy':'remove'};function emitEvent(_0x54b7e0){return function(_0x5f0ac7,_0x5cd18d,_0x4560b7){UserNotificationEvents[_0x38dd('0x2')](_0x54b7e0+':'+_0x5f0ac7['id'],_0x5f0ac7);UserNotificationEvents['emit'](_0x54b7e0,_0x5f0ac7);_0x4560b7(null);};}for(var e in events){if(events[_0x38dd('0x3')](e)){var event=events[e];UserNotification['hook'](e,emitEvent(event));}}module[_0x38dd('0x4')]=UserNotificationEvents; \ No newline at end of file +var _0xed50=['save','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0x3dd61b,_0x48c05f){var _0x19093c=function(_0x22659d){while(--_0x22659d){_0x3dd61b['push'](_0x3dd61b['shift']());}};_0x19093c(++_0x48c05f);}(_0xed50,0x197));var _0x0ed5=function(_0x2c3201,_0x1f76ff){_0x2c3201=_0x2c3201-0x0;var _0x564fc4=_0xed50[_0x2c3201];return _0x564fc4;};'use strict';var EventEmitter=require('events');var UserNotification=require(_0x0ed5('0x0'))['db']['UserNotification'];var UserNotificationEvents=new EventEmitter();UserNotificationEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x0ed5('0x1'),'afterUpdate':_0x0ed5('0x2'),'afterDestroy':_0x0ed5('0x3')};function emitEvent(_0x2ed6d5){return function(_0x2e8137,_0x9fb336,_0x34fe8f){UserNotificationEvents[_0x0ed5('0x4')](_0x2ed6d5+':'+_0x2e8137['id'],_0x2e8137);UserNotificationEvents[_0x0ed5('0x4')](_0x2ed6d5,_0x2e8137);_0x34fe8f(null);};}for(var e in events){if(events[_0x0ed5('0x5')](e)){var event=events[e];UserNotification[_0x0ed5('0x6')](e,emitEvent(event));}}module[_0x0ed5('0x7')]=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index 1ca7474..7518c89 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 _0xe2ae=['api','moment','bluebird','path','rimraf','define','UserNotification','userNotifications','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger'];(function(_0x200c1a,_0x163f92){var _0x2222f7=function(_0xa3c969){while(--_0xa3c969){_0x200c1a['push'](_0x200c1a['shift']());}};_0x2222f7(++_0x163f92);}(_0xe2ae,0x1a2));var _0xee2a=function(_0x552061,_0x378b4a){_0x552061=_0x552061-0x0;var _0x14fb3e=_0xe2ae[_0x552061];return _0x14fb3e;};'use strict';var _=require(_0xee2a('0x0'));var util=require('util');var logger=require(_0xee2a('0x1'))(_0xee2a('0x2'));var moment=require(_0xee2a('0x3'));var BPromise=require(_0xee2a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xee2a('0x5'));var rimraf=require(_0xee2a('0x6'));var config=require('../../config/environment');var attributes=require('./userNotification.attributes');module['exports']=function(_0x24b988,_0x1ca4d5){return _0x24b988[_0xee2a('0x7')](_0xee2a('0x8'),attributes,{'tableName':_0xee2a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xee2a('0xa'),'collate':_0xee2a('0xb')});}; \ No newline at end of file +var _0x3ef1=['util','moment','request-promise','path','../../config/environment','UserNotification','utf8mb4','lodash'];(function(_0x47f533,_0x3c9b36){var _0x573006=function(_0x2b0fbc){while(--_0x2b0fbc){_0x47f533['push'](_0x47f533['shift']());}};_0x573006(++_0x3c9b36);}(_0x3ef1,0x187));var _0x13ef=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x3ef1[_0x1d1779];return _0x2377e9;};'use strict';var _=require(_0x13ef('0x0'));var util=require(_0x13ef('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x13ef('0x2'));var BPromise=require('bluebird');var rp=require(_0x13ef('0x3'));var fs=require('fs');var path=require(_0x13ef('0x4'));var rimraf=require('rimraf');var config=require(_0x13ef('0x5'));var attributes=require('./userNotification.attributes');module['exports']=function(_0x4d2513,_0xe0bfd0){return _0x4d2513['define'](_0x13ef('0x6'),attributes,{'tableName':'userNotifications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x13ef('0x7'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index 8fe5e64..ae4aa6d 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 _0x994a=['request\x20sent','result','catch','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','UserNotification,\x20%s,\x20%s','debug','UserNotification,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x32fa2f,_0x517452){var _0x40256e=function(_0x269922){while(--_0x269922){_0x32fa2f['push'](_0x32fa2f['shift']());}};_0x40256e(++_0x517452);}(_0x994a,0x9f));var _0xa994=function(_0x43bb00,_0x56d787){_0x43bb00=_0x43bb00-0x0;var _0x1b9aa0=_0x994a[_0x43bb00];return _0x1b9aa0;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xa994('0x0'));var rs=require(_0xa994('0x1'));var fs=require('fs');var Redis=require(_0xa994('0x2'));var db=require(_0xa994('0x3'))['db'];var utils=require(_0xa994('0x4'));var logger=require(_0xa994('0x5'))(_0xa994('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xa994('0x7')][_0xa994('0x8')]({'port':0x232a});config[_0xa994('0x9')]=_[_0xa994('0xa')](config['redis'],{'host':_0xa994('0xb'),'port':0x18eb});var socket=require(_0xa994('0xc'))(new Redis(config[_0xa994('0x9')]));require('./userNotification.socket')[_0xa994('0xd')](socket);function respondWithRpcPromise(_0x35f97c,_0x21cb36,_0x59227b){return new BPromise(function(_0x1a90ff,_0x555500){return client[_0xa994('0xe')](_0x35f97c,_0x59227b)[_0xa994('0xf')](function(_0xb3202d){logger[_0xa994('0x10')](_0xa994('0x11'),_0x21cb36,'request\x20sent');logger[_0xa994('0x12')](_0xa994('0x13'),_0x21cb36,'request\x20sent',JSON[_0xa994('0x14')](_0xb3202d));if(_0xb3202d['error']){if(_0xb3202d[_0xa994('0x15')]['code']===0x1f4){logger['error'](_0xa994('0x11'),_0x21cb36,_0xb3202d['error']['message']);return _0x555500(_0xb3202d['error'][_0xa994('0x16')]);}logger[_0xa994('0x15')](_0xa994('0x11'),_0x21cb36,_0xb3202d[_0xa994('0x15')][_0xa994('0x16')]);return _0x1a90ff(_0xb3202d[_0xa994('0x15')][_0xa994('0x16')]);}else{logger[_0xa994('0x10')](_0xa994('0x11'),_0x21cb36,_0xa994('0x17'));_0x1a90ff(_0xb3202d[_0xa994('0x18')][_0xa994('0x16')]);}})[_0xa994('0x19')](function(_0x2fe553){logger[_0xa994('0x15')]('UserNotification,\x20%s,\x20%s',_0x21cb36,_0x2fe553);_0x555500(_0x2fe553);});});} \ No newline at end of file +var _0xddbc=['http','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','register','request','then','info','debug','UserNotification,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','UserNotification,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x20a68a,_0x54502e){var _0x56c5d4=function(_0x4ace56){while(--_0x4ace56){_0x20a68a['push'](_0x20a68a['shift']());}};_0x56c5d4(++_0x54502e);}(_0xddbc,0x114));var _0xcddb=function(_0xd626e7,_0x48bd92){_0xd626e7=_0xd626e7-0x0;var _0x2ef506=_0xddbc[_0xd626e7];return _0x2ef506;};'use strict';var _=require(_0xcddb('0x0'));var util=require('util');var moment=require(_0xcddb('0x1'));var BPromise=require(_0xcddb('0x2'));var rs=require(_0xcddb('0x3'));var fs=require('fs');var Redis=require(_0xcddb('0x4'));var db=require(_0xcddb('0x5'))['db'];var utils=require(_0xcddb('0x6'));var logger=require(_0xcddb('0x7'))(_0xcddb('0x8'));var config=require(_0xcddb('0x9'));var jayson=require(_0xcddb('0xa'));var client=jayson[_0xcddb('0xb')][_0xcddb('0xc')]({'port':0x232a});config[_0xcddb('0xd')]=_[_0xcddb('0xe')](config[_0xcddb('0xd')],{'host':_0xcddb('0xf'),'port':0x18eb});var socket=require(_0xcddb('0x10'))(new Redis(config[_0xcddb('0xd')]));require(_0xcddb('0x11'))[_0xcddb('0x12')](socket);function respondWithRpcPromise(_0x1ac4d8,_0x51057e,_0x1cda52){return new BPromise(function(_0x34613f,_0x25c955){return client[_0xcddb('0x13')](_0x1ac4d8,_0x1cda52)[_0xcddb('0x14')](function(_0xcc5293){logger[_0xcddb('0x15')]('UserNotification,\x20%s,\x20%s',_0x51057e,'request\x20sent');logger[_0xcddb('0x16')](_0xcddb('0x17'),_0x51057e,_0xcddb('0x18'),JSON[_0xcddb('0x19')](_0xcc5293));if(_0xcc5293['error']){if(_0xcc5293[_0xcddb('0x1a')][_0xcddb('0x1b')]===0x1f4){logger[_0xcddb('0x1a')](_0xcddb('0x1c'),_0x51057e,_0xcc5293['error'][_0xcddb('0x1d')]);return _0x25c955(_0xcc5293['error'][_0xcddb('0x1d')]);}logger[_0xcddb('0x1a')](_0xcddb('0x1c'),_0x51057e,_0xcc5293['error'][_0xcddb('0x1d')]);return _0x34613f(_0xcc5293[_0xcddb('0x1a')][_0xcddb('0x1d')]);}else{logger['info'](_0xcddb('0x1c'),_0x51057e,'request\x20sent');_0x34613f(_0xcc5293[_0xcddb('0x1e')][_0xcddb('0x1d')]);}})[_0xcddb('0x1f')](function(_0x151de6){logger[_0xcddb('0x1a')](_0xcddb('0x1c'),_0x51057e,_0x151de6);_0x25c955(_0x151de6);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index 8d1a19a..9a6e507 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 _0x6611=['save','remove','emit','removeListener','register','userNotification:'];(function(_0x2759ad,_0x4d2d4e){var _0x37003e=function(_0x42a45c){while(--_0x42a45c){_0x2759ad['push'](_0x2759ad['shift']());}};_0x37003e(++_0x4d2d4e);}(_0x6611,0xde));var _0x1661=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x6611[_0x3947c9];return _0x2e7871;};'use strict';var UserNotificationEvents=require('./userNotification.events');var events=[_0x1661('0x0'),_0x1661('0x1'),'update'];function createListener(_0xc6621c,_0x33e3f3){return function(_0xbfedb5){_0x33e3f3[_0x1661('0x2')](_0xc6621c,_0xbfedb5);};}function removeListener(_0x3a54a5,_0x1ab6f1){return function(){UserNotificationEvents[_0x1661('0x3')](_0x3a54a5,_0x1ab6f1);};}exports[_0x1661('0x4')]=function(_0x1fc70a){for(var _0x48162f=0x0,_0x2b0caa=events['length'];_0x48162f<_0x2b0caa;_0x48162f++){var _0x4ee3c4=events[_0x48162f];var _0xe7bbb5=createListener(_0x1661('0x5')+_0x4ee3c4,_0x1fc70a);UserNotificationEvents['on'](_0x4ee3c4,_0xe7bbb5);}}; \ No newline at end of file +var _0xf688=['save','remove','emit','removeListener','register','userNotification:','./userNotification.events'];(function(_0x488dd0,_0x1e0044){var _0xb0577d=function(_0x5045d0){while(--_0x5045d0){_0x488dd0['push'](_0x488dd0['shift']());}};_0xb0577d(++_0x1e0044);}(_0xf688,0x12c));var _0x8f68=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf688[_0x3dd15e];return _0x231fd0;};'use strict';var UserNotificationEvents=require(_0x8f68('0x0'));var events=[_0x8f68('0x1'),_0x8f68('0x2'),'update'];function createListener(_0x5def8c,_0x6a084c){return function(_0x3c460f){_0x6a084c[_0x8f68('0x3')](_0x5def8c,_0x3c460f);};}function removeListener(_0x363124,_0x27d50e){return function(){UserNotificationEvents[_0x8f68('0x4')](_0x363124,_0x27d50e);};}exports[_0x8f68('0x5')]=function(_0x5ae6ae){for(var _0x209518=0x0,_0x77ba29=events['length'];_0x209518<_0x77ba29;_0x209518++){var _0x2635cb=events[_0x209518];var _0x3499cd=createListener(_0x8f68('0x6')+_0x2635cb,_0x5ae6ae);UserNotificationEvents['on'](_0x2635cb,_0x3499cd);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index 1407e12..51fb025 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x51dd2c,_0x2a2345){var _0x41c678=function(_0xa14c31){while(--_0xa14c31){_0x51dd2c['push'](_0x51dd2c['shift']());}};_0x41c678(++_0x2a2345);}(_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(_0x331886,_0x16c8a7){var _0x398ff6=function(_0x3063fa){while(--_0x3063fa){_0x331886['push'](_0x331886['shift']());}};_0x398ff6(++_0x16c8a7);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var fs_extra=require(_0x3071('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));module[_0x3071('0x7')]=router; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index 14e3ba6..32bcd81 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 _0x59cb=['exports','sequelize'];(function(_0x4259cd,_0x32ffd6){var _0x4f5230=function(_0x24ca95){while(--_0x24ca95){_0x4259cd['push'](_0x4259cd['shift']());}};_0x4f5230(++_0x32ffd6);}(_0x59cb,0x69));var _0xb59c=function(_0x8c43de,_0x90ff31){_0x8c43de=_0x8c43de-0x0;var _0xa6591b=_0x59cb[_0x8c43de];return _0xa6591b;};'use strict';var Sequelize=require(_0xb59c('0x0'));module[_0xb59c('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x29f7=['INTEGER','sequelize','exports'];(function(_0x24b15d,_0x80998e){var _0x43b8e2=function(_0x13a26e){while(--_0x13a26e){_0x24b15d['push'](_0x24b15d['shift']());}};_0x43b8e2(++_0x80998e);}(_0x29f7,0xca));var _0x729f=function(_0xc522ec,_0x27182f){_0xc522ec=_0xc522ec-0x0;var _0x336078=_0x29f7[_0xc522ec];return _0x336078;};'use strict';var Sequelize=require(_0x729f('0x0'));module[_0x729f('0x1')]={'penalty':{'type':Sequelize[_0x729f('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 63b1008..9f99478 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 _0xa6ae=['request-promise','rimraf','./userOpenchannelQueue.attributes','define','lodash','util','../../config/logger','api','moment'];(function(_0x2509f1,_0x5c9f8c){var _0x410842=function(_0x1b1eeb){while(--_0x1b1eeb){_0x2509f1['push'](_0x2509f1['shift']());}};_0x410842(++_0x5c9f8c);}(_0xa6ae,0x12d));var _0xea6a=function(_0x487933,_0x77076d){_0x487933=_0x487933-0x0;var _0x741518=_0xa6ae[_0x487933];return _0x741518;};'use strict';var _=require(_0xea6a('0x0'));var util=require(_0xea6a('0x1'));var logger=require(_0xea6a('0x2'))(_0xea6a('0x3'));var moment=require(_0xea6a('0x4'));var BPromise=require('bluebird');var rp=require(_0xea6a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xea6a('0x6'));var config=require('../../config/environment');var attributes=require(_0xea6a('0x7'));module['exports']=function(_0x42cc10,_0x32c5e9){return _0x42cc10[_0xea6a('0x8')]('UserOpenchannelQueue',attributes,{'tableName':'user_has_openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcebf=['lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','UserOpenchannelQueue','user_has_openchannel_queues'];(function(_0x49692b,_0x569f9e){var _0x23672c=function(_0x4b9c45){while(--_0x4b9c45){_0x49692b['push'](_0x49692b['shift']());}};_0x23672c(++_0x569f9e);}(_0xcebf,0x1ef));var _0xfceb=function(_0x9fcf8f,_0x10d946){_0x9fcf8f=_0x9fcf8f-0x0;var _0x43a4c4=_0xcebf[_0x9fcf8f];return _0x43a4c4;};'use strict';var _=require(_0xfceb('0x0'));var util=require(_0xfceb('0x1'));var logger=require('../../config/logger')(_0xfceb('0x2'));var moment=require(_0xfceb('0x3'));var BPromise=require(_0xfceb('0x4'));var rp=require(_0xfceb('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfceb('0x6'));var config=require(_0xfceb('0x7'));var attributes=require('./userOpenchannelQueue.attributes');module[_0xfceb('0x8')]=function(_0x1a5d57,_0xce121){return _0x1a5d57['define'](_0xfceb('0x9'),attributes,{'tableName':_0xfceb('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js index 17862d0..b949de6 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 _0xf365=['code','message','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x4e9e2c,_0x2908b5){var _0x412df5=function(_0x1d64ce){while(--_0x1d64ce){_0x4e9e2c['push'](_0x4e9e2c['shift']());}};_0x412df5(++_0x2908b5);}(_0xf365,0x71));var _0x5f36=function(_0xce06d0,_0xe944b9){_0xce06d0=_0xce06d0-0x0;var _0x360347=_0xf365[_0xce06d0];return _0x360347;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x5f36('0x0'));var BPromise=require(_0x5f36('0x1'));var rs=require(_0x5f36('0x2'));var fs=require('fs');var Redis=require(_0x5f36('0x3'));var db=require(_0x5f36('0x4'))['db'];var utils=require(_0x5f36('0x5'));var logger=require(_0x5f36('0x6'))(_0x5f36('0x7'));var config=require(_0x5f36('0x8'));var jayson=require(_0x5f36('0x9'));var client=jayson[_0x5f36('0xa')][_0x5f36('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x17d2c0,_0xe8b4df,_0x5c29c2){return new BPromise(function(_0x3bf39d,_0x554745){return client[_0x5f36('0xc')](_0x17d2c0,_0x5c29c2)[_0x5f36('0xd')](function(_0x124bec){logger['info'](_0x5f36('0xe'),_0xe8b4df,_0x5f36('0xf'));logger['debug'](_0x5f36('0x10'),_0xe8b4df,_0x5f36('0xf'),JSON[_0x5f36('0x11')](_0x124bec));if(_0x124bec['error']){if(_0x124bec[_0x5f36('0x12')][_0x5f36('0x13')]===0x1f4){logger[_0x5f36('0x12')](_0x5f36('0xe'),_0xe8b4df,_0x124bec[_0x5f36('0x12')]['message']);return _0x554745(_0x124bec['error'][_0x5f36('0x14')]);}logger[_0x5f36('0x12')](_0x5f36('0xe'),_0xe8b4df,_0x124bec[_0x5f36('0x12')][_0x5f36('0x14')]);return _0x3bf39d(_0x124bec['error'][_0x5f36('0x14')]);}else{logger['info'](_0x5f36('0xe'),_0xe8b4df,_0x5f36('0xf'));_0x3bf39d(_0x124bec['result'][_0x5f36('0x14')]);}})[_0x5f36('0x15')](function(_0x417cac){logger['error'](_0x5f36('0xe'),_0xe8b4df,_0x417cac);_0x554745(_0x417cac);});});} \ No newline at end of file +var _0x88a5=['debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','UserOpenchannelQueue,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','then','info','request\x20sent'];(function(_0x434f66,_0x2348b5){var _0xdb588d=function(_0x2d444c){while(--_0x2d444c){_0x434f66['push'](_0x434f66['shift']());}};_0xdb588d(++_0x2348b5);}(_0x88a5,0x1ed));var _0x588a=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0x88a5[_0xf50820];return _0x2a9b10;};'use strict';var _=require(_0x588a('0x0'));var util=require(_0x588a('0x1'));var moment=require(_0x588a('0x2'));var BPromise=require(_0x588a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x588a('0x4'));var db=require(_0x588a('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x588a('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x588a('0x7'));var client=jayson[_0x588a('0x8')][_0x588a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2c1ed2,_0x95c0d4,_0x92bf6d){return new BPromise(function(_0x79710f,_0xb73061){return client['request'](_0x2c1ed2,_0x92bf6d)[_0x588a('0xa')](function(_0x3bfb00){logger[_0x588a('0xb')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x95c0d4,_0x588a('0xc'));logger[_0x588a('0xd')](_0x588a('0xe'),_0x95c0d4,'request\x20sent',JSON[_0x588a('0xf')](_0x3bfb00));if(_0x3bfb00[_0x588a('0x10')]){if(_0x3bfb00[_0x588a('0x10')][_0x588a('0x11')]===0x1f4){logger[_0x588a('0x10')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x95c0d4,_0x3bfb00['error']['message']);return _0xb73061(_0x3bfb00[_0x588a('0x10')][_0x588a('0x12')]);}logger[_0x588a('0x10')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x95c0d4,_0x3bfb00[_0x588a('0x10')][_0x588a('0x12')]);return _0x79710f(_0x3bfb00[_0x588a('0x10')][_0x588a('0x12')]);}else{logger[_0x588a('0xb')](_0x588a('0x13'),_0x95c0d4,'request\x20sent');_0x79710f(_0x3bfb00[_0x588a('0x14')][_0x588a('0x12')]);}})[_0x588a('0x15')](function(_0x237bf7){logger[_0x588a('0x10')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x95c0d4,_0x237bf7);_0xb73061(_0x237bf7);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index d845f61..3979622 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 _0xe58b=['/:id/resources','put','update','delete','removeSections','removeResources','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./userProfile.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/sections','getSections','getResources','post','create','/:id/clone','clone','addSections'];(function(_0x3feccc,_0x5534c7){var _0x2c13b5=function(_0x59a2cd){while(--_0x59a2cd){_0x3feccc['push'](_0x3feccc['shift']());}};_0x2c13b5(++_0x5534c7);}(_0xe58b,0x17b));var _0xbe58=function(_0x533b60,_0x4f121c){_0x533b60=_0x533b60-0x0;var _0x3ba02f=_0xe58b[_0x533b60];return _0x3ba02f;};'use strict';var multer=require('multer');var util=require(_0xbe58('0x0'));var path=require(_0xbe58('0x1'));var timeout=require(_0xbe58('0x2'));var express=require(_0xbe58('0x3'));var router=express[_0xbe58('0x4')]();var fs_extra=require(_0xbe58('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xbe58('0x6'));var config=require(_0xbe58('0x7'));var controller=require(_0xbe58('0x8'));router[_0xbe58('0x9')]('/',auth[_0xbe58('0xa')](),controller[_0xbe58('0xb')]);router[_0xbe58('0x9')](_0xbe58('0xc'),auth[_0xbe58('0xa')](),controller[_0xbe58('0xd')]);router[_0xbe58('0x9')](_0xbe58('0xe'),auth[_0xbe58('0xa')](),controller[_0xbe58('0xf')]);router[_0xbe58('0x9')](_0xbe58('0x10'),auth[_0xbe58('0xa')](),controller[_0xbe58('0x11')]);router[_0xbe58('0x9')]('/:id/resources',auth[_0xbe58('0xa')](),controller[_0xbe58('0x12')]);router[_0xbe58('0x13')]('/',auth[_0xbe58('0xa')](),controller[_0xbe58('0x14')]);router[_0xbe58('0x13')](_0xbe58('0x15'),auth[_0xbe58('0xa')](),controller[_0xbe58('0x16')]);router[_0xbe58('0x13')](_0xbe58('0x10'),auth[_0xbe58('0xa')](),controller[_0xbe58('0x17')]);router[_0xbe58('0x13')](_0xbe58('0x18'),auth['isAuthenticated'](),controller['addResources']);router[_0xbe58('0x19')]('/:id',auth['isAuthenticated'](),controller[_0xbe58('0x1a')]);router[_0xbe58('0x1b')](_0xbe58('0xe'),auth[_0xbe58('0xa')](),controller['destroy']);router[_0xbe58('0x1b')](_0xbe58('0x10'),auth[_0xbe58('0xa')](),controller[_0xbe58('0x1c')]);router[_0xbe58('0x1b')](_0xbe58('0x18'),auth[_0xbe58('0xa')](),controller[_0xbe58('0x1d')]);module[_0xbe58('0x1e')]=router; \ No newline at end of file +var _0xcd05=['addSections','addResources','put','delete','destroy','removeSections','removeResources','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfile.controller','get','index','/describe','isAuthenticated','describe','/:id','/:id/sections','getSections','/:id/resources','post','create','/:id/clone','clone'];(function(_0x2e4fef,_0x2afaef){var _0x1a73e9=function(_0x3c1c44){while(--_0x3c1c44){_0x2e4fef['push'](_0x2e4fef['shift']());}};_0x1a73e9(++_0x2afaef);}(_0xcd05,0x103));var _0x5cd0=function(_0x49a1a0,_0x48f776){_0x49a1a0=_0x49a1a0-0x0;var _0x518a4f=_0xcd05[_0x49a1a0];return _0x518a4f;};'use strict';var multer=require('multer');var util=require(_0x5cd0('0x0'));var path=require(_0x5cd0('0x1'));var timeout=require('connect-timeout');var express=require(_0x5cd0('0x2'));var router=express[_0x5cd0('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5cd0('0x4'));var interaction=require(_0x5cd0('0x5'));var config=require(_0x5cd0('0x6'));var controller=require(_0x5cd0('0x7'));router[_0x5cd0('0x8')]('/',auth['isAuthenticated'](),controller[_0x5cd0('0x9')]);router[_0x5cd0('0x8')](_0x5cd0('0xa'),auth[_0x5cd0('0xb')](),controller[_0x5cd0('0xc')]);router[_0x5cd0('0x8')](_0x5cd0('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x5cd0('0x8')](_0x5cd0('0xe'),auth[_0x5cd0('0xb')](),controller[_0x5cd0('0xf')]);router[_0x5cd0('0x8')](_0x5cd0('0x10'),auth['isAuthenticated'](),controller['getResources']);router[_0x5cd0('0x11')]('/',auth[_0x5cd0('0xb')](),controller[_0x5cd0('0x12')]);router[_0x5cd0('0x11')](_0x5cd0('0x13'),auth[_0x5cd0('0xb')](),controller[_0x5cd0('0x14')]);router[_0x5cd0('0x11')](_0x5cd0('0xe'),auth[_0x5cd0('0xb')](),controller[_0x5cd0('0x15')]);router[_0x5cd0('0x11')](_0x5cd0('0x10'),auth[_0x5cd0('0xb')](),controller[_0x5cd0('0x16')]);router[_0x5cd0('0x17')](_0x5cd0('0xd'),auth[_0x5cd0('0xb')](),controller['update']);router[_0x5cd0('0x18')](_0x5cd0('0xd'),auth[_0x5cd0('0xb')](),controller[_0x5cd0('0x19')]);router[_0x5cd0('0x18')](_0x5cd0('0xe'),auth[_0x5cd0('0xb')](),controller[_0x5cd0('0x1a')]);router[_0x5cd0('0x18')]('/:id/resources',auth[_0x5cd0('0xb')](),controller[_0x5cd0('0x1b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index 310c793..4ca76b0 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 _0xd606=['BOOLEAN','exports','STRING','setDataValue','crudPermissions','getDataValue','split'];(function(_0x22d623,_0x34de81){var _0x2b0105=function(_0x3b5053){while(--_0x3b5053){_0x22d623['push'](_0x22d623['shift']());}};_0x2b0105(++_0x34de81);}(_0xd606,0x190));var _0x6d60=function(_0x5d09f0,_0x465f05){_0x5d09f0=_0x5d09f0-0x0;var _0x56a145=_0xd606[_0x5d09f0];return _0x56a145;};'use strict';var Sequelize=require('sequelize');module[_0x6d60('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'crudPermissions':{'type':Sequelize[_0x6d60('0x1')],'set':function(_0x3a3d8a){this[_0x6d60('0x2')](_0x6d60('0x3'),_0x3a3d8a?_0x3a3d8a['join'](''):[]);},'get':function(){return this[_0x6d60('0x4')](_0x6d60('0x3'))?this[_0x6d60('0x4')](_0x6d60('0x3'))[_0x6d60('0x5')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x6d60('0x6')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x6d60('0x6')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x6d60('0x6')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x6d60('0x6')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x6d60('0x6')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x6d60('0x6')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x6d60('0x6')],'defaultValue':!![]}}; \ No newline at end of file +var _0xfecf=['split','BOOLEAN','exports','STRING','name','crudPermissions','join','getDataValue'];(function(_0x468481,_0x3d8b88){var _0x363252=function(_0x32e2a9){while(--_0x32e2a9){_0x468481['push'](_0x468481['shift']());}};_0x363252(++_0x3d8b88);}(_0xfecf,0x8a));var _0xffec=function(_0x5f0268,_0x2fd4a6){_0x5f0268=_0x5f0268-0x0;var _0xd0f7af=_0xfecf[_0x5f0268];return _0xd0f7af;};'use strict';var Sequelize=require('sequelize');module[_0xffec('0x0')]={'name':{'type':Sequelize[_0xffec('0x1')],'allowNull':![],'unique':_0xffec('0x2')},'crudPermissions':{'type':Sequelize[_0xffec('0x1')],'set':function(_0x186326){this['setDataValue'](_0xffec('0x3'),_0x186326?_0x186326[_0xffec('0x4')](''):[]);},'get':function(){return this[_0xffec('0x5')](_0xffec('0x3'))?this[_0xffec('0x5')]('crudPermissions')[_0xffec('0x6')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0xffec('0x1')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0xffec('0x7')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0xffec('0x7')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0xffec('0x7')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0xffec('0x7')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0xffec('0x7')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xffec('0x7')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xffec('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 95e192c..2b14c92 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 _0x7738=['omit','createdAt','crudPermissions','updatedAt','sequelize','transaction','UserProfileSection','autoAssociation','UserProfileResource','Resources','describe','destroy','sectionId','userProfileId','each','push','removeSections','ids','getSections','enabled','isEmpty','includes','subsections','concat','Dashboard','forEach','resourceId','bulkCreate','removeResources','getResources','Missing\x20section\x20parameter','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','redis','localhost','socket.io-emitter','./userProfile.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','name','index','map','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','UserProfile','includeAll','findAll','rows','show','params','rawAttributes','include','find','catch','create','body','clone','get'];(function(_0xfaaea7,_0xa69add){var _0x1280f3=function(_0x49bb16){while(--_0x49bb16){_0xfaaea7['push'](_0xfaaea7['shift']());}};_0x1280f3(++_0xa69add);}(_0x7738,0x1df));var _0x8773=function(_0x38a9cb,_0xfd8b2b){_0x38a9cb=_0x38a9cb-0x0;var _0xfa7687=_0x7738[_0x38a9cb];return _0xfa7687;};'use strict';var emlformat=require(_0x8773('0x0'));var rimraf=require(_0x8773('0x1'));var zipdir=require(_0x8773('0x2'));var jsonpatch=require(_0x8773('0x3'));var rp=require('request-promise');var moment=require(_0x8773('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x8773('0x5'));var util=require(_0x8773('0x6'));var path=require(_0x8773('0x7'));var sox=require(_0x8773('0x8'));var csv=require(_0x8773('0x9'));var ejs=require(_0x8773('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8773('0xb'));var squel=require(_0x8773('0xc'));var crypto=require('crypto');var jsforce=require(_0x8773('0xd'));var deskjs=require(_0x8773('0xe'));var toCsv=require(_0x8773('0x9'));var querystring=require(_0x8773('0xf'));var Papa=require(_0x8773('0x10'));var Redis=require('ioredis');var authService=require(_0x8773('0x11'));var qs=require(_0x8773('0x12'));var as=require(_0x8773('0x13'));var hardwareService=require(_0x8773('0x14'));var logger=require(_0x8773('0x15'))(_0x8773('0x16'));var utils=require(_0x8773('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0x8773('0x18')],{'host':_0x8773('0x19'),'port':0x18eb});var socket=require(_0x8773('0x1a'))(new Redis(config[_0x8773('0x18')]));require(_0x8773('0x1b'))[_0x8773('0x1c')](socket);function respondWithStatusCode(_0x2d5947,_0x4402c4){_0x4402c4=_0x4402c4||0xcc;return function(_0x5b42aa){if(_0x5b42aa){return _0x2d5947[_0x8773('0x1d')](_0x4402c4);}return _0x2d5947[_0x8773('0x1e')](_0x4402c4)[_0x8773('0x1f')]();};}function respondWithResult(_0x38af38,_0x31be31){_0x31be31=_0x31be31||0xc8;return function(_0x382418){if(_0x382418){return _0x38af38['status'](_0x31be31)[_0x8773('0x20')](_0x382418);}};}function respondWithFilteredResult(_0x168e69,_0x4613b2){return function(_0x2d7e31){if(_0x2d7e31){var _0x59994e=typeof _0x4613b2[_0x8773('0x21')]===_0x8773('0x22')&&typeof _0x4613b2[_0x8773('0x23')]===_0x8773('0x22');var _0x4a5748=_0x2d7e31[_0x8773('0x24')];var _0x24a3d8=_0x59994e?0x0:_0x4613b2[_0x8773('0x21')];var _0x14e4f0=_0x59994e?_0x2d7e31['count']:_0x4613b2[_0x8773('0x21')]+_0x4613b2[_0x8773('0x23')];var _0x1e3a6a;if(_0x14e4f0>=_0x4a5748){_0x14e4f0=_0x4a5748;_0x1e3a6a=0xc8;}else{_0x1e3a6a=0xce;}_0x168e69['status'](_0x1e3a6a);return _0x168e69[_0x8773('0x25')](_0x8773('0x26'),_0x24a3d8+'-'+_0x14e4f0+'/'+_0x4a5748)[_0x8773('0x20')](_0x2d7e31);}return null;};}function patchUpdates(_0x533f90){return function(_0x622233){try{jsonpatch[_0x8773('0x27')](_0x622233,_0x533f90,!![]);}catch(_0x27fb3c){return BPromise[_0x8773('0x28')](_0x27fb3c);}return _0x622233[_0x8773('0x29')]();};}function saveUpdates(_0x34d887,_0x2becdf){return function(_0x5cbc8b){if(_0x5cbc8b){return _0x5cbc8b[_0x8773('0x2a')](_0x34d887)[_0x8773('0x2b')](function(_0x5e2f1f){return _0x5e2f1f;});}return null;};}function removeEntity(_0x2f68e9,_0x4e75d8){return function(_0x37f939){if(_0x37f939){return _0x37f939['destroy']()['then'](function(){_0x2f68e9[_0x8773('0x1e')](0xcc)[_0x8773('0x1f')]();});}};}function handleEntityNotFound(_0x36a4cf,_0x9a5a4f){return function(_0x5285f8){if(!_0x5285f8){_0x36a4cf[_0x8773('0x1d')](0x194);}return _0x5285f8;};}function handleError(_0x210d26,_0x421dd5){_0x421dd5=_0x421dd5||0x1f4;return function(_0x4313a7){logger[_0x8773('0x2c')](_0x4313a7['stack']);if(_0x4313a7[_0x8773('0x2d')]){delete _0x4313a7[_0x8773('0x2d')];}_0x210d26['status'](_0x421dd5)['send'](_0x4313a7);};}exports[_0x8773('0x2e')]=function(_0xdcfa1d,_0x434bed){var _0x2dfe6f={},_0x2b8360={},_0x143a00={'count':0x0,'rows':[]};var _0x5d6600=_[_0x8773('0x2f')](db['UserProfile']['rawAttributes'],function(_0x45bfb4){return{'name':_0x45bfb4['fieldName'],'type':_0x45bfb4[_0x8773('0x30')][_0x8773('0x31')]};});_0x2b8360[_0x8773('0x32')]=_[_0x8773('0x2f')](_0x5d6600,_0x8773('0x2d'));_0x2b8360['query']=_[_0x8773('0x33')](_0xdcfa1d[_0x8773('0x34')]);_0x2b8360[_0x8773('0x35')]=_[_0x8773('0x36')](_0x2b8360[_0x8773('0x32')],_0x2b8360['query']);_0x2dfe6f[_0x8773('0x37')]=_[_0x8773('0x36')](_0x2b8360[_0x8773('0x32')],qs[_0x8773('0x38')](_0xdcfa1d[_0x8773('0x34')][_0x8773('0x38')]));_0x2dfe6f[_0x8773('0x37')]=_0x2dfe6f['attributes'][_0x8773('0x39')]?_0x2dfe6f[_0x8773('0x37')]:_0x2b8360['model'];if(!_0xdcfa1d[_0x8773('0x34')][_0x8773('0x3a')](_0x8773('0x3b'))){_0x2dfe6f['limit']=qs[_0x8773('0x23')](_0xdcfa1d[_0x8773('0x34')][_0x8773('0x23')]);_0x2dfe6f[_0x8773('0x21')]=qs['offset'](_0xdcfa1d['query'][_0x8773('0x21')]);}_0x2dfe6f['order']=qs[_0x8773('0x3c')](_0xdcfa1d[_0x8773('0x34')]['sort']);_0x2dfe6f[_0x8773('0x3d')]=qs['filters'](_[_0x8773('0x3e')](_0xdcfa1d['query'],_0x2b8360[_0x8773('0x35')]),_0x5d6600);if(_0xdcfa1d[_0x8773('0x34')][_0x8773('0x3f')]){_0x2dfe6f[_0x8773('0x3d')]=_[_0x8773('0x40')](_0x2dfe6f[_0x8773('0x3d')],{'$or':_['map'](_0x5d6600,function(_0x4d53d6){if(_0x4d53d6[_0x8773('0x30')]!==_0x8773('0x41')){var _0x4a84c6={};_0x4a84c6[_0x4d53d6['name']]={'$like':'%'+_0xdcfa1d['query'][_0x8773('0x3f')]+'%'};return _0x4a84c6;}})});}_0x2dfe6f=_[_0x8773('0x40')]({},_0x2dfe6f,_0xdcfa1d[_0x8773('0x42')]);var _0x42156e={'where':_0x2dfe6f[_0x8773('0x3d')]};return db[_0x8773('0x43')]['count'](_0x42156e)['then'](function(_0x5d1c22){_0x143a00[_0x8773('0x24')]=_0x5d1c22;if(_0xdcfa1d['query'][_0x8773('0x44')]){_0x2dfe6f['include']=[{'all':!![]}];}return db[_0x8773('0x43')][_0x8773('0x45')](_0x2dfe6f);})[_0x8773('0x2b')](function(_0x3e3bce){_0x143a00[_0x8773('0x46')]=_0x3e3bce;return _0x143a00;})[_0x8773('0x2b')](respondWithFilteredResult(_0x434bed,_0x2dfe6f))['catch'](handleError(_0x434bed,null));};exports[_0x8773('0x47')]=function(_0xc3c99e,_0x1c7b4c){var _0x5873d3={'raw':![],'where':{'id':_0xc3c99e[_0x8773('0x48')]['id']}},_0xab5cb9={};_0xab5cb9[_0x8773('0x32')]=_[_0x8773('0x33')](db[_0x8773('0x43')][_0x8773('0x49')]);_0xab5cb9[_0x8773('0x34')]=_[_0x8773('0x33')](_0xc3c99e['query']);_0xab5cb9[_0x8773('0x35')]=_[_0x8773('0x36')](_0xab5cb9[_0x8773('0x32')],_0xab5cb9[_0x8773('0x34')]);_0x5873d3[_0x8773('0x37')]=_['intersection'](_0xab5cb9['model'],qs[_0x8773('0x38')](_0xc3c99e[_0x8773('0x34')][_0x8773('0x38')]));_0x5873d3[_0x8773('0x37')]=_0x5873d3['attributes'][_0x8773('0x39')]?_0x5873d3['attributes']:_0xab5cb9[_0x8773('0x32')];if(_0xc3c99e[_0x8773('0x34')][_0x8773('0x44')]){_0x5873d3[_0x8773('0x4a')]=[{'all':!![]}];}_0x5873d3=_[_0x8773('0x40')]({},_0x5873d3,_0xc3c99e[_0x8773('0x42')]);return db[_0x8773('0x43')][_0x8773('0x4b')](_0x5873d3)[_0x8773('0x2b')](handleEntityNotFound(_0x1c7b4c,null))['then'](respondWithResult(_0x1c7b4c,null))[_0x8773('0x4c')](handleError(_0x1c7b4c,null));};exports['create']=function(_0xf6e8fd,_0x57eb19){return db[_0x8773('0x43')][_0x8773('0x4d')](_0xf6e8fd[_0x8773('0x4e')],{})[_0x8773('0x2b')](respondWithResult(_0x57eb19,0xc9))[_0x8773('0x4c')](handleError(_0x57eb19,null));};exports[_0x8773('0x4f')]=function(_0x4ba7c6,_0x1aef4f){var _0x189cea={'where':{'id':_0x4ba7c6[_0x8773('0x48')]['id']}},_0xce690e={};_0xce690e['model']=_[_0x8773('0x33')](db[_0x8773('0x43')][_0x8773('0x49')]);_0x189cea[_0x8773('0x37')]=_[_0x8773('0x36')](_0xce690e[_0x8773('0x32')],qs['fields'](_0x4ba7c6[_0x8773('0x34')][_0x8773('0x38')]));_0x189cea[_0x8773('0x37')]=_0x189cea[_0x8773('0x37')][_0x8773('0x39')]?_0x189cea[_0x8773('0x37')]:_0xce690e[_0x8773('0x32')];if(_0x4ba7c6[_0x8773('0x34')][_0x8773('0x44')]){_0x189cea[_0x8773('0x4a')]=[{'all':!![]}];}_0x189cea=_['merge']({},_0x189cea,_0x4ba7c6[_0x8773('0x42')]);return db[_0x8773('0x43')]['find'](_0x189cea)[_0x8773('0x2b')](handleEntityNotFound(_0x1aef4f,null))[_0x8773('0x2b')](function(_0x20966a){if(_0x20966a){var _0x2b2762=_0x20966a[_0x8773('0x50')]({'plain':!![]});_0x2b2762=qs[_0x8773('0x51')](_0x2b2762,['id',_0x8773('0x52'),'updatedAt',_0x8773('0x53')]);_0x4ba7c6[_0x8773('0x4e')]=_[_0x8773('0x51')](_0x4ba7c6[_0x8773('0x4e')],['id',_0x8773('0x52'),_0x8773('0x54')]);return db[_0x8773('0x55')][_0x8773('0x56')](function(_0x4b0d83){return db['UserProfile']['create'](_[_0x8773('0x40')](_0x2b2762,_0x4ba7c6[_0x8773('0x4e')]),{'include':_0x4ba7c6[_0x8773('0x34')]['includeAll']?[{'all':!![]}]:undefined,'transaction':_0x4b0d83})['then'](function(_0x170ff7){var _0x3e64d2=_0x170ff7[_0x8773('0x50')]({'plain':!![]});return db[_0x8773('0x57')][_0x8773('0x45')]({'where':{'userProfileId':_0x4ba7c6['params']['id']},'raw':!![]})[_0x8773('0x2b')](function(_0x57de6d){if(_0x57de6d){return BPromise['each'](_0x57de6d,function(_0x16baf1){return new BPromise(function(_0x4cef36,_0x1acce1){if(_0x16baf1[_0x8773('0x58')]===null||_0x16baf1['autoAssociation']===0x1)_0x4cef36(null);return db['UserProfileResource'][_0x8773('0x45')]({'where':{'sectionId':_0x16baf1['id']},'raw':!![]})[_0x8773('0x2b')](function(_0xa68e00){var _0x538d06=_[_0x8773('0x2f')](_0xa68e00,function(_0x1c7214){return qs[_0x8773('0x51')](_0x1c7214,['id','createdAt',_0x8773('0x54'),'sectionId']);});_0x4cef36(_0x538d06);})[_0x8773('0x4c')](function(_0x226656){_0x1acce1(_0x226656);});})[_0x8773('0x2b')](function(_0x1d5bde){var _0xe60c9c=qs[_0x8773('0x51')](_0x16baf1,['id','createdAt',_0x8773('0x54')]);_0xe60c9c['userProfileId']=_0x3e64d2['id'];if(_0x1d5bde)_0xe60c9c['Resources']=_0x1d5bde;return _0xe60c9c;})[_0x8773('0x2b')](function(_0x5d7bfc){return db[_0x8773('0x57')]['create'](_0x5d7bfc,{'include':[{'model':db[_0x8773('0x59')],'as':_0x8773('0x5a')}],'raw':!![],'transaction':_0x4b0d83});});})[_0x8773('0x2b')](function(){return _0x3e64d2;});}});});});}})[_0x8773('0x2b')](respondWithResult(_0x1aef4f,0xc9))[_0x8773('0x4c')](handleError(_0x1aef4f,null));};exports[_0x8773('0x2a')]=function(_0x2bb8da,_0x5d56b2){if(_0x2bb8da[_0x8773('0x4e')]['id']){delete _0x2bb8da[_0x8773('0x4e')]['id'];}return db['UserProfile'][_0x8773('0x4b')]({'where':{'id':_0x2bb8da[_0x8773('0x48')]['id']}})[_0x8773('0x2b')](handleEntityNotFound(_0x5d56b2,null))[_0x8773('0x2b')](saveUpdates(_0x2bb8da[_0x8773('0x4e')],null))[_0x8773('0x2b')](respondWithResult(_0x5d56b2,null))['catch'](handleError(_0x5d56b2,null));};exports['destroy']=function(_0x125048,_0x3ae329){return db[_0x8773('0x43')][_0x8773('0x4b')]({'where':{'id':_0x125048[_0x8773('0x48')]['id']}})[_0x8773('0x2b')](handleEntityNotFound(_0x3ae329,null))[_0x8773('0x2b')](removeEntity(_0x3ae329,null))[_0x8773('0x4c')](handleError(_0x3ae329,null));};exports[_0x8773('0x5b')]=function(_0x583d8d,_0x3610a6){return db[_0x8773('0x43')]['describe']()[_0x8773('0x2b')](respondWithResult(_0x3610a6,null))[_0x8773('0x4c')](handleError(_0x3610a6,null));};exports['addSections']=function(_0x2a4eb7,_0x256106){var _0x4931bd=_0x2a4eb7[_0x8773('0x4e')];return db[_0x8773('0x43')]['find']({'where':{'id':_0x2a4eb7[_0x8773('0x48')]['id']}})[_0x8773('0x2b')](handleEntityNotFound(_0x256106,null))[_0x8773('0x2b')](function(_0x320a89){if(_0x320a89){return db['sequelize'][_0x8773('0x56')](function(_0x3f8eea){return db[_0x8773('0x57')][_0x8773('0x5c')]({'where':{'userProfileId':_0x2a4eb7[_0x8773('0x48')]['id'],'sectionId':_[_0x8773('0x2f')](_0x4931bd,function(_0x527e71){return _0x527e71[_0x8773('0x5d')];})},'transaction':_0x3f8eea})['then'](function(){var _0x3fce40=_['map'](_0x4931bd,function(_0x5ad939){_0x5ad939[_0x8773('0x5e')]=_0x2a4eb7[_0x8773('0x48')]['id'];return _0x5ad939;});var _0x1944c6=[];return BPromise[_0x8773('0x5f')](_0x3fce40,function(_0x36d379){return db[_0x8773('0x57')][_0x8773('0x4d')](_0x36d379,{'include':[{'model':db[_0x8773('0x59')],'as':_0x8773('0x5a')}],'raw':!![],'transaction':_0x3f8eea})[_0x8773('0x2b')](function(_0x7f1e0){_0x1944c6[_0x8773('0x60')](_0x7f1e0[_0x8773('0x50')]({'plain':!![]}));});})[_0x8773('0x2b')](function(){return _0x1944c6;});});});}})['then'](function(_0x203bdb){return _0x203bdb;})[_0x8773('0x2b')](respondWithResult(_0x256106,null))[_0x8773('0x4c')](handleError(_0x256106,null));};exports[_0x8773('0x61')]=function(_0x2b740c,_0x579632){var _0x2475e9;return db[_0x8773('0x43')][_0x8773('0x4b')]({'where':{'id':_0x2b740c[_0x8773('0x48')]['id']},'attributes':['id',_0x8773('0x2d')]})[_0x8773('0x2b')](handleEntityNotFound(_0x579632,null))[_0x8773('0x2b')](function(_0x5a0e32){if(_0x5a0e32){_0x2475e9=_0x5a0e32;return db[_0x8773('0x57')][_0x8773('0x5c')]({'where':{'userProfileId':_0x2b740c[_0x8773('0x48')]['id'],'sectionId':_0x2b740c[_0x8773('0x34')][_0x8773('0x62')]}});}})['then'](function(){return _0x2475e9;})['then'](respondWithStatusCode(_0x579632,null))[_0x8773('0x4c')](handleError(_0x579632,null));};exports[_0x8773('0x63')]=function(_0x422d6b,_0x58349f){var _0x554f60=[];var _0x15e457=[];return db[_0x8773('0x57')]['findAll']({'where':{'userProfileId':_0x422d6b[_0x8773('0x48')]['id']},'raw':!![]})[_0x8773('0x2b')](function(_0x5b1279){_0x554f60=_[_0x8773('0x3f')](_0x5b1279,function(_0x5dfbe1){return _0x5dfbe1[_0x8773('0x64')]===0x1||_['includes']([0x3eb,0x709],_0x5dfbe1[_0x8773('0x5d')]);});if(!_[_0x8773('0x65')](_0x554f60)){return _['map'](_0x554f60,function(_0x577f72){return _0x577f72[_0x8773('0x5d')];});}else{return;}})[_0x8773('0x2b')](function(_0x5ad508){if(_0x5ad508)_0x15e457=_0x5ad508;if(_[_0x8773('0x66')](_0x15e457,0x64)){var _0x49fd60=_[_0x8773('0x4b')](_0x554f60,{'sectionId':0x64});return hasDefaultDashboard(_0x49fd60)['then'](function(_0x3cff7e){return _[_0x8773('0x2f')](_0x554f60,function(_0x2d7807){if(_0x2d7807[_0x8773('0x5d')]===0x64){_0x2d7807[_0x8773('0x67')]=_0x3cff7e;}return _0x2d7807;});});}else{return;}})['then'](function(_0xfac45a){if(_0xfac45a)_0x554f60=_0xfac45a;if(_['includes'](_0x15e457,0x3eb)){var _0xfbc574=_[_0x8773('0x4b')](_0x554f60,{'sectionId':0x3eb});return getCustomDashboards(_0xfbc574)[_0x8773('0x2b')](function(_0x17ee4f){return _[_0x8773('0x2f')](_0x554f60,function(_0x5177ca){if(_0xfbc574[_0x8773('0x64')]){if(_0x5177ca['sectionId']===0x3eb){_0x5177ca[_0x8773('0x67')]=_0x17ee4f;}}else{if(_0x5177ca[_0x8773('0x5d')]===0x64){if(!_0x5177ca['subsections']){_0x5177ca['subsections']=[];}_0x5177ca['subsections']=_0x5177ca[_0x8773('0x67')][_0x8773('0x68')](_0x17ee4f);}}return _0x5177ca;});});}else{return;}})[_0x8773('0x2b')](function(_0x1a2999){if(_0x1a2999)_0x554f60=_0x1a2999;if(_[_0x8773('0x66')](_0x15e457,0x709)){var _0x1f52e4=_['find'](_0x554f60,{'sectionId':0x709});return getPlugins(_0x1f52e4)[_0x8773('0x2b')](function(_0x21f5f1){if(_0x1f52e4[_0x8773('0x64')]){return _['map'](_0x554f60,function(_0x3d9d32){if(_0x3d9d32[_0x8773('0x5d')]===0x709){_0x3d9d32[_0x8773('0x67')]=_0x21f5f1;}return _0x3d9d32;});}else{var _0x4c21ff={'sectionId':0x76c,'enabled':0x1,'subsections':_0x21f5f1};var _0x3152c5=_['map'](_0x554f60);_0x3152c5[_0x8773('0x60')](_0x4c21ff);return _0x3152c5;}});}else{return;}})[_0x8773('0x2b')](function(_0x190db7){if(_0x190db7)_0x554f60=_0x190db7;return _[_0x8773('0x3f')](_0x554f60,[_0x8773('0x64'),0x1]);})[_0x8773('0x2b')](respondWithResult(_0x58349f,null))[_0x8773('0x4c')](handleError(_0x58349f,null));};function hasDefaultDashboard(_0x2342cf){var _0x215fec=[0x65];return new BPromise(function(_0x4371d7,_0x3f2cb4){try{if(_0x2342cf[_0x8773('0x58')]){_0x4371d7(_0x215fec);}else{return db['UserProfileResource']['findOne']({'where':{'sectionId':_0x2342cf['id']},'raw':!![]})['then'](function(_0x56bca5){_0x56bca5?_0x4371d7(_0x215fec):_0x4371d7();});}}catch(_0x4c6475){_0x3f2cb4(_0x4c6475);}});}function getCustomDashboards(_0x4a991a){var _0x544117=[];return new BPromise(function(_0x18cae5,_0x4fb1e5){try{if(_0x4a991a[_0x8773('0x58')]){return db[_0x8773('0x69')][_0x8773('0x45')]({'raw':!![]})[_0x8773('0x2b')](function(_0x4881cb){_0x4881cb[_0x8773('0x6a')](function(_0x4f6e4f){_0x544117[_0x8773('0x60')](_0x4f6e4f['id']+0x1869f);});_0x18cae5(_0x544117);});}else{return db[_0x8773('0x59')][_0x8773('0x45')]({'where':{'sectionId':_0x4a991a['id']},'raw':!![]})[_0x8773('0x2b')](function(_0x12b046){_0x12b046[_0x8773('0x6a')](function(_0x2c4a7e){_0x544117[_0x8773('0x60')](_0x2c4a7e[_0x8773('0x6b')]+0x1869f);});_0x18cae5(_0x544117);});}}catch(_0x5ae6bb){_0x4fb1e5(_0x5ae6bb);}});}function getPlugins(_0x2834ab){var _0x1956b1=[];return new BPromise(function(_0x5d7292,_0x340c33){try{if(_0x2834ab['autoAssociation']){return db['Plugin']['findAll']({'raw':!![]})[_0x8773('0x2b')](function(_0xe4a6e4){_0xe4a6e4['forEach'](function(_0x4fa071){_0x1956b1[_0x8773('0x60')](_0x4fa071['id']+0x15b38);});_0x5d7292(_0x1956b1);});}else{return db[_0x8773('0x59')]['findAll']({'where':{'sectionId':_0x2834ab['id']},'raw':!![]})['then'](function(_0x4a5432){_0x4a5432['forEach'](function(_0x2e9ad9){_0x1956b1[_0x8773('0x60')](_0x2e9ad9['resourceId']+0x15b38);});_0x5d7292(_0x1956b1);});}}catch(_0x187103){_0x340c33(_0x187103);}});}exports['addResources']=function(_0x1e4bb5,_0x44d042){return db['UserProfile']['find']({'where':{'id':_0x1e4bb5[_0x8773('0x48')]['id']}})[_0x8773('0x2b')](handleEntityNotFound(_0x44d042,null))['then'](function(_0x3dc26f){if(_0x3dc26f){return db['sequelize'][_0x8773('0x56')](function(_0x40fbe5){return db[_0x8773('0x57')][_0x8773('0x45')]({'where':{'userProfileId':_0x1e4bb5['params']['id']},'attributes':['id'],'raw':!![]})[_0x8773('0x2b')](function(_0x52231b){if(_0x52231b){return db['UserProfileSection']['destroy']({'where':{'userProfileId':_0x1e4bb5[_0x8773('0x48')]['id'],'id':_[_0x8773('0x2f')](_0x52231b,function(_0x5cf704){return _0x5cf704['id'];})},'transaction':_0x40fbe5});}})[_0x8773('0x2b')](function(_0x3f9369){var _0x3b04f3=_[_0x8773('0x2f')](_0x1e4bb5[_0x8773('0x4e')],function(_0x2c02ab){_0x2c02ab['userProfileId']=_0x1e4bb5[_0x8773('0x48')]['id'];return _0x2c02ab;});return db[_0x8773('0x57')][_0x8773('0x6c')](_0x3b04f3,{'raw':!![],'transaction':_0x40fbe5});})[_0x8773('0x2b')](function(_0x4b17bf){var _0x38dd57=_[_0x8773('0x3f')](_[_0x8773('0x2f')](_0x4b17bf,function(_0xd1556c){return _0xd1556c['get']({'plain':!![]});}),{'includeAll':![]});if(_0x38dd57){return db['UserProfileSection'][_0x8773('0x45')]({'where':{'userProfileId':_0x1e4bb5['params']['id'],'sectionId':_[_0x8773('0x2f')](_0x38dd57,function(_0x347532){return _0x347532['sectionId'];})},'attributes':['id','sectionId'],'raw':!![]})['then'](function(_0x151f54){var _0x307bff=_[_0x8773('0x2f')](_0x1e4bb5[_0x8773('0x4e')],function(_0x5461fc){_0x5461fc['userProfileId']=_0x1e4bb5[_0x8773('0x48')]['id'];return _0x5461fc;});return db[_0x8773('0x59')][_0x8773('0x6c')](_0x307bff,{'raw':!![],'transaction':_0x40fbe5});});}})['catch'](handleError(_0x44d042,null));});}})[_0x8773('0x2b')](function(_0x2f905a){var _0x24102a=_['map'](_0x2f905a,function(_0x3a4653){return _0x3a4653['get']({'plain':!![]});});})[_0x8773('0x2b')](respondWithResult(_0x44d042,null))[_0x8773('0x4c')](handleError(_0x44d042,null));};exports[_0x8773('0x6d')]=function(_0x523d79,_0x26c314,_0x4133be){return db['UserProfile']['find']({'where':{'id':_0x523d79[_0x8773('0x48')]['id']}})[_0x8773('0x2b')](handleEntityNotFound(_0x26c314,null))[_0x8773('0x2b')](function(_0x458685){if(_0x458685){return _0x458685[_0x8773('0x6d')](_0x523d79[_0x8773('0x34')][_0x8773('0x62')]);}})[_0x8773('0x2b')](respondWithStatusCode(_0x26c314,null))['catch'](handleError(_0x26c314,null));};exports[_0x8773('0x6e')]=function(_0x429557,_0x5e5925){var _0x5953a0={};if(!_0x429557[_0x8773('0x34')]['section'])throw new Error(_0x8773('0x6f'));if(!_0x429557['query']['hasOwnProperty']('nolimit')){_0x5953a0[_0x8773('0x23')]=qs[_0x8773('0x23')](_0x429557[_0x8773('0x34')][_0x8773('0x23')]);_0x5953a0[_0x8773('0x21')]=qs[_0x8773('0x21')](_0x429557[_0x8773('0x34')]['offset']);}return db[_0x8773('0x43')]['find']({'where':{'id':_0x429557[_0x8773('0x48')]['id']}})[_0x8773('0x2b')](function(_0x358217){if(!_0x358217)throw new Error('No\x20User\x20Profile\x20found\x20for\x20id\x20'+_0x429557[_0x8773('0x48')]['id']);return db['UserProfile']['getResources'](_0x429557);})[_0x8773('0x2b')](respondWithFilteredResult(_0x5e5925,_0x5953a0))[_0x8773('0x4c')](handleError(_0x5e5925,null));}; \ No newline at end of file +var _0x59c1=['keys','intersection','fields','attributes','hasOwnProperty','nolimit','offset','order','sort','filters','pick','filter','where','VIRTUAL','merge','options','then','include','findAll','catch','show','find','create','body','length','includeAll','get','omit','createdAt','crudPermissions','sequelize','transaction','UserProfileSection','params','each','autoAssociation','UserProfileResource','updatedAt','sectionId','describe','addSections','ids','getSections','enabled','includes','subsections','concat','push','findOne','Dashboard','forEach','resourceId','Plugin','addResources','userProfileId','bulkCreate','removeResources','getResources','section','No\x20User\x20Profile\x20found\x20for\x20id\x20','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','redis','socket.io-emitter','./userProfile.socket','register','sendStatus','status','end','json','undefined','limit','count','set','Content-Range','reject','update','destroy','name','send','map','UserProfile','rawAttributes','fieldName','type','key','model','query'];(function(_0x1ac9f4,_0x5edaf3){var _0x1e48f6=function(_0x3d6fcc){while(--_0x3d6fcc){_0x1ac9f4['push'](_0x1ac9f4['shift']());}};_0x1e48f6(++_0x5edaf3);}(_0x59c1,0x17a));var _0x159c=function(_0x437639,_0x405d69){_0x437639=_0x437639-0x0;var _0x1a17bd=_0x59c1[_0x437639];return _0x1a17bd;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x159c('0x0'));var zipdir=require(_0x159c('0x1'));var jsonpatch=require(_0x159c('0x2'));var rp=require(_0x159c('0x3'));var moment=require(_0x159c('0x4'));var BPromise=require(_0x159c('0x5'));var Mustache=require('mustache');var util=require(_0x159c('0x6'));var path=require(_0x159c('0x7'));var sox=require('sox');var csv=require(_0x159c('0x8'));var ejs=require(_0x159c('0x9'));var fs=require('fs');var fs_extra=require(_0x159c('0xa'));var _=require(_0x159c('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x159c('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x159c('0x8'));var querystring=require(_0x159c('0xd'));var Papa=require('papaparse');var Redis=require(_0x159c('0xe'));var authService=require(_0x159c('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x159c('0x10'));var hardwareService=require(_0x159c('0x11'));var logger=require(_0x159c('0x12'))(_0x159c('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x159c('0x14')]=_['defaults'](config[_0x159c('0x14')],{'host':'localhost','port':0x18eb});var socket=require(_0x159c('0x15'))(new Redis(config[_0x159c('0x14')]));require(_0x159c('0x16'))[_0x159c('0x17')](socket);function respondWithStatusCode(_0x3859b6,_0xa8a76a){_0xa8a76a=_0xa8a76a||0xcc;return function(_0x384167){if(_0x384167){return _0x3859b6[_0x159c('0x18')](_0xa8a76a);}return _0x3859b6[_0x159c('0x19')](_0xa8a76a)[_0x159c('0x1a')]();};}function respondWithResult(_0x2299ca,_0x436b1c){_0x436b1c=_0x436b1c||0xc8;return function(_0x479e4a){if(_0x479e4a){return _0x2299ca[_0x159c('0x19')](_0x436b1c)[_0x159c('0x1b')](_0x479e4a);}};}function respondWithFilteredResult(_0x3ff70e,_0x33f5c8){return function(_0x2bf541){if(_0x2bf541){var _0x4c1df3=typeof _0x33f5c8['offset']===_0x159c('0x1c')&&typeof _0x33f5c8[_0x159c('0x1d')]===_0x159c('0x1c');var _0x3dc7bb=_0x2bf541[_0x159c('0x1e')];var _0xe02f67=_0x4c1df3?0x0:_0x33f5c8['offset'];var _0x9c4226=_0x4c1df3?_0x2bf541['count']:_0x33f5c8['offset']+_0x33f5c8[_0x159c('0x1d')];var _0x1cc746;if(_0x9c4226>=_0x3dc7bb){_0x9c4226=_0x3dc7bb;_0x1cc746=0xc8;}else{_0x1cc746=0xce;}_0x3ff70e[_0x159c('0x19')](_0x1cc746);return _0x3ff70e[_0x159c('0x1f')](_0x159c('0x20'),_0xe02f67+'-'+_0x9c4226+'/'+_0x3dc7bb)['json'](_0x2bf541);}return null;};}function patchUpdates(_0x58b001){return function(_0x58f83d){try{jsonpatch['apply'](_0x58f83d,_0x58b001,!![]);}catch(_0x301f1d){return BPromise[_0x159c('0x21')](_0x301f1d);}return _0x58f83d['save']();};}function saveUpdates(_0xb0771e,_0x199024){return function(_0x37eb36){if(_0x37eb36){return _0x37eb36[_0x159c('0x22')](_0xb0771e)['then'](function(_0x30be17){return _0x30be17;});}return null;};}function removeEntity(_0x93cb5f,_0x32ff2c){return function(_0x1c0b40){if(_0x1c0b40){return _0x1c0b40[_0x159c('0x23')]()['then'](function(){_0x93cb5f[_0x159c('0x19')](0xcc)[_0x159c('0x1a')]();});}};}function handleEntityNotFound(_0x14b455,_0x4be547){return function(_0x408bca){if(!_0x408bca){_0x14b455[_0x159c('0x18')](0x194);}return _0x408bca;};}function handleError(_0x26d698,_0x5327d8){_0x5327d8=_0x5327d8||0x1f4;return function(_0x4a0c08){logger['error'](_0x4a0c08['stack']);if(_0x4a0c08[_0x159c('0x24')]){delete _0x4a0c08[_0x159c('0x24')];}_0x26d698[_0x159c('0x19')](_0x5327d8)[_0x159c('0x25')](_0x4a0c08);};}exports['index']=function(_0x3209f0,_0x440c0e){var _0x207c41={},_0x1a55cc={},_0x524e09={'count':0x0,'rows':[]};var _0x5ce05f=_[_0x159c('0x26')](db[_0x159c('0x27')][_0x159c('0x28')],function(_0x4f5b73){return{'name':_0x4f5b73[_0x159c('0x29')],'type':_0x4f5b73[_0x159c('0x2a')][_0x159c('0x2b')]};});_0x1a55cc[_0x159c('0x2c')]=_[_0x159c('0x26')](_0x5ce05f,'name');_0x1a55cc[_0x159c('0x2d')]=_[_0x159c('0x2e')](_0x3209f0[_0x159c('0x2d')]);_0x1a55cc['filters']=_[_0x159c('0x2f')](_0x1a55cc[_0x159c('0x2c')],_0x1a55cc[_0x159c('0x2d')]);_0x207c41['attributes']=_['intersection'](_0x1a55cc[_0x159c('0x2c')],qs[_0x159c('0x30')](_0x3209f0['query'][_0x159c('0x30')]));_0x207c41[_0x159c('0x31')]=_0x207c41['attributes']['length']?_0x207c41[_0x159c('0x31')]:_0x1a55cc[_0x159c('0x2c')];if(!_0x3209f0[_0x159c('0x2d')][_0x159c('0x32')](_0x159c('0x33'))){_0x207c41[_0x159c('0x1d')]=qs[_0x159c('0x1d')](_0x3209f0['query'][_0x159c('0x1d')]);_0x207c41[_0x159c('0x34')]=qs['offset'](_0x3209f0[_0x159c('0x2d')][_0x159c('0x34')]);}_0x207c41[_0x159c('0x35')]=qs[_0x159c('0x36')](_0x3209f0[_0x159c('0x2d')]['sort']);_0x207c41['where']=qs[_0x159c('0x37')](_[_0x159c('0x38')](_0x3209f0['query'],_0x1a55cc[_0x159c('0x37')]),_0x5ce05f);if(_0x3209f0[_0x159c('0x2d')][_0x159c('0x39')]){_0x207c41[_0x159c('0x3a')]=_['merge'](_0x207c41[_0x159c('0x3a')],{'$or':_[_0x159c('0x26')](_0x5ce05f,function(_0x518350){if(_0x518350[_0x159c('0x2a')]!==_0x159c('0x3b')){var _0x4e70f4={};_0x4e70f4[_0x518350[_0x159c('0x24')]]={'$like':'%'+_0x3209f0[_0x159c('0x2d')][_0x159c('0x39')]+'%'};return _0x4e70f4;}})});}_0x207c41=_[_0x159c('0x3c')]({},_0x207c41,_0x3209f0[_0x159c('0x3d')]);var _0x51c4ca={'where':_0x207c41['where']};return db['UserProfile'][_0x159c('0x1e')](_0x51c4ca)[_0x159c('0x3e')](function(_0x278acb){_0x524e09['count']=_0x278acb;if(_0x3209f0[_0x159c('0x2d')]['includeAll']){_0x207c41[_0x159c('0x3f')]=[{'all':!![]}];}return db[_0x159c('0x27')][_0x159c('0x40')](_0x207c41);})[_0x159c('0x3e')](function(_0x2aedfb){_0x524e09['rows']=_0x2aedfb;return _0x524e09;})['then'](respondWithFilteredResult(_0x440c0e,_0x207c41))[_0x159c('0x41')](handleError(_0x440c0e,null));};exports[_0x159c('0x42')]=function(_0x51b064,_0x38ad99){var _0x130cef={'raw':![],'where':{'id':_0x51b064['params']['id']}},_0x2fc2d6={};_0x2fc2d6[_0x159c('0x2c')]=_[_0x159c('0x2e')](db['UserProfile'][_0x159c('0x28')]);_0x2fc2d6[_0x159c('0x2d')]=_[_0x159c('0x2e')](_0x51b064[_0x159c('0x2d')]);_0x2fc2d6[_0x159c('0x37')]=_[_0x159c('0x2f')](_0x2fc2d6['model'],_0x2fc2d6[_0x159c('0x2d')]);_0x130cef[_0x159c('0x31')]=_[_0x159c('0x2f')](_0x2fc2d6[_0x159c('0x2c')],qs[_0x159c('0x30')](_0x51b064[_0x159c('0x2d')][_0x159c('0x30')]));_0x130cef[_0x159c('0x31')]=_0x130cef['attributes']['length']?_0x130cef[_0x159c('0x31')]:_0x2fc2d6['model'];if(_0x51b064[_0x159c('0x2d')]['includeAll']){_0x130cef['include']=[{'all':!![]}];}_0x130cef=_['merge']({},_0x130cef,_0x51b064[_0x159c('0x3d')]);return db['UserProfile'][_0x159c('0x43')](_0x130cef)[_0x159c('0x3e')](handleEntityNotFound(_0x38ad99,null))[_0x159c('0x3e')](respondWithResult(_0x38ad99,null))[_0x159c('0x41')](handleError(_0x38ad99,null));};exports[_0x159c('0x44')]=function(_0x3c3b55,_0x157e0b){return db['UserProfile'][_0x159c('0x44')](_0x3c3b55[_0x159c('0x45')],{})[_0x159c('0x3e')](respondWithResult(_0x157e0b,0xc9))[_0x159c('0x41')](handleError(_0x157e0b,null));};exports['clone']=function(_0x533ca0,_0x3b7708){var _0x32694f={'where':{'id':_0x533ca0['params']['id']}},_0xb6a9a={};_0xb6a9a['model']=_[_0x159c('0x2e')](db['UserProfile']['rawAttributes']);_0x32694f[_0x159c('0x31')]=_[_0x159c('0x2f')](_0xb6a9a[_0x159c('0x2c')],qs[_0x159c('0x30')](_0x533ca0[_0x159c('0x2d')][_0x159c('0x30')]));_0x32694f[_0x159c('0x31')]=_0x32694f[_0x159c('0x31')][_0x159c('0x46')]?_0x32694f[_0x159c('0x31')]:_0xb6a9a['model'];if(_0x533ca0[_0x159c('0x2d')][_0x159c('0x47')]){_0x32694f['include']=[{'all':!![]}];}_0x32694f=_['merge']({},_0x32694f,_0x533ca0[_0x159c('0x3d')]);return db[_0x159c('0x27')]['find'](_0x32694f)['then'](handleEntityNotFound(_0x3b7708,null))[_0x159c('0x3e')](function(_0x100339){if(_0x100339){var _0x358ee6=_0x100339[_0x159c('0x48')]({'plain':!![]});_0x358ee6=qs[_0x159c('0x49')](_0x358ee6,['id',_0x159c('0x4a'),'updatedAt',_0x159c('0x4b')]);_0x533ca0['body']=_[_0x159c('0x49')](_0x533ca0[_0x159c('0x45')],['id',_0x159c('0x4a'),'updatedAt']);return db[_0x159c('0x4c')][_0x159c('0x4d')](function(_0xae2acd){return db['UserProfile'][_0x159c('0x44')](_['merge'](_0x358ee6,_0x533ca0['body']),{'include':_0x533ca0[_0x159c('0x2d')][_0x159c('0x47')]?[{'all':!![]}]:undefined,'transaction':_0xae2acd})[_0x159c('0x3e')](function(_0x278a78){var _0x4aa350=_0x278a78[_0x159c('0x48')]({'plain':!![]});return db[_0x159c('0x4e')]['findAll']({'where':{'userProfileId':_0x533ca0[_0x159c('0x4f')]['id']},'raw':!![]})[_0x159c('0x3e')](function(_0x1583b4){if(_0x1583b4){return BPromise[_0x159c('0x50')](_0x1583b4,function(_0x133864){return new BPromise(function(_0x457e97,_0x3276e3){if(_0x133864['autoAssociation']===null||_0x133864[_0x159c('0x51')]===0x1)_0x457e97(null);return db[_0x159c('0x52')][_0x159c('0x40')]({'where':{'sectionId':_0x133864['id']},'raw':!![]})[_0x159c('0x3e')](function(_0x32a207){var _0x31f830=_[_0x159c('0x26')](_0x32a207,function(_0x190880){return qs['omit'](_0x190880,['id',_0x159c('0x4a'),_0x159c('0x53'),_0x159c('0x54')]);});_0x457e97(_0x31f830);})[_0x159c('0x41')](function(_0x24ba44){_0x3276e3(_0x24ba44);});})[_0x159c('0x3e')](function(_0x1e4a7f){var _0x54615a=qs[_0x159c('0x49')](_0x133864,['id','createdAt',_0x159c('0x53')]);_0x54615a['userProfileId']=_0x4aa350['id'];if(_0x1e4a7f)_0x54615a['Resources']=_0x1e4a7f;return _0x54615a;})[_0x159c('0x3e')](function(_0x448122){return db['UserProfileSection']['create'](_0x448122,{'include':[{'model':db[_0x159c('0x52')],'as':'Resources'}],'raw':!![],'transaction':_0xae2acd});});})[_0x159c('0x3e')](function(){return _0x4aa350;});}});});});}})['then'](respondWithResult(_0x3b7708,0xc9))['catch'](handleError(_0x3b7708,null));};exports[_0x159c('0x22')]=function(_0x4c0c27,_0x1c3631){if(_0x4c0c27[_0x159c('0x45')]['id']){delete _0x4c0c27[_0x159c('0x45')]['id'];}return db[_0x159c('0x27')][_0x159c('0x43')]({'where':{'id':_0x4c0c27[_0x159c('0x4f')]['id']}})['then'](handleEntityNotFound(_0x1c3631,null))[_0x159c('0x3e')](saveUpdates(_0x4c0c27[_0x159c('0x45')],null))[_0x159c('0x3e')](respondWithResult(_0x1c3631,null))['catch'](handleError(_0x1c3631,null));};exports[_0x159c('0x23')]=function(_0x4dd3ee,_0x505bd4){return db[_0x159c('0x27')]['find']({'where':{'id':_0x4dd3ee[_0x159c('0x4f')]['id']}})[_0x159c('0x3e')](handleEntityNotFound(_0x505bd4,null))['then'](removeEntity(_0x505bd4,null))['catch'](handleError(_0x505bd4,null));};exports[_0x159c('0x55')]=function(_0x7c83d4,_0xadf27){return db[_0x159c('0x27')]['describe']()['then'](respondWithResult(_0xadf27,null))[_0x159c('0x41')](handleError(_0xadf27,null));};exports[_0x159c('0x56')]=function(_0x34dd78,_0x594894){var _0x300579=_0x34dd78[_0x159c('0x45')];return db['UserProfile']['find']({'where':{'id':_0x34dd78[_0x159c('0x4f')]['id']}})[_0x159c('0x3e')](handleEntityNotFound(_0x594894,null))['then'](function(_0x59508e){if(_0x59508e){return db[_0x159c('0x4c')]['transaction'](function(_0x4237b6){return db[_0x159c('0x4e')][_0x159c('0x23')]({'where':{'userProfileId':_0x34dd78[_0x159c('0x4f')]['id'],'sectionId':_[_0x159c('0x26')](_0x300579,function(_0xdb79f2){return _0xdb79f2[_0x159c('0x54')];})},'transaction':_0x4237b6})[_0x159c('0x3e')](function(){var _0x442406=_[_0x159c('0x26')](_0x300579,function(_0x29a7f5){_0x29a7f5['userProfileId']=_0x34dd78[_0x159c('0x4f')]['id'];return _0x29a7f5;});var _0x101691=[];return BPromise[_0x159c('0x50')](_0x442406,function(_0x24ea81){return db[_0x159c('0x4e')][_0x159c('0x44')](_0x24ea81,{'include':[{'model':db[_0x159c('0x52')],'as':'Resources'}],'raw':!![],'transaction':_0x4237b6})['then'](function(_0x30a9a1){_0x101691['push'](_0x30a9a1[_0x159c('0x48')]({'plain':!![]}));});})[_0x159c('0x3e')](function(){return _0x101691;});});});}})[_0x159c('0x3e')](function(_0xc165d0){return _0xc165d0;})[_0x159c('0x3e')](respondWithResult(_0x594894,null))[_0x159c('0x41')](handleError(_0x594894,null));};exports['removeSections']=function(_0x507ec0,_0xe08fc5){var _0x5ec857;return db['UserProfile'][_0x159c('0x43')]({'where':{'id':_0x507ec0[_0x159c('0x4f')]['id']},'attributes':['id',_0x159c('0x24')]})[_0x159c('0x3e')](handleEntityNotFound(_0xe08fc5,null))[_0x159c('0x3e')](function(_0x2648b4){if(_0x2648b4){_0x5ec857=_0x2648b4;return db[_0x159c('0x4e')]['destroy']({'where':{'userProfileId':_0x507ec0['params']['id'],'sectionId':_0x507ec0['query'][_0x159c('0x57')]}});}})[_0x159c('0x3e')](function(){return _0x5ec857;})['then'](respondWithStatusCode(_0xe08fc5,null))['catch'](handleError(_0xe08fc5,null));};exports[_0x159c('0x58')]=function(_0x335e5b,_0x514049){var _0x1c5309=[];var _0x4692ea=[];return db[_0x159c('0x4e')][_0x159c('0x40')]({'where':{'userProfileId':_0x335e5b[_0x159c('0x4f')]['id']},'raw':!![]})[_0x159c('0x3e')](function(_0x3d965f){_0x1c5309=_[_0x159c('0x39')](_0x3d965f,function(_0x54be04){return _0x54be04[_0x159c('0x59')]===0x1||_[_0x159c('0x5a')]([0x3eb,0x709],_0x54be04['sectionId']);});if(!_['isEmpty'](_0x1c5309)){return _['map'](_0x1c5309,function(_0x49fc06){return _0x49fc06['sectionId'];});}else{return;}})[_0x159c('0x3e')](function(_0x1c813f){if(_0x1c813f)_0x4692ea=_0x1c813f;if(_[_0x159c('0x5a')](_0x4692ea,0x64)){var _0x3f0f23=_[_0x159c('0x43')](_0x1c5309,{'sectionId':0x64});return hasDefaultDashboard(_0x3f0f23)['then'](function(_0x2de711){return _['map'](_0x1c5309,function(_0x655b6){if(_0x655b6['sectionId']===0x64){_0x655b6[_0x159c('0x5b')]=_0x2de711;}return _0x655b6;});});}else{return;}})[_0x159c('0x3e')](function(_0x1d1338){if(_0x1d1338)_0x1c5309=_0x1d1338;if(_[_0x159c('0x5a')](_0x4692ea,0x3eb)){var _0x373b6b=_[_0x159c('0x43')](_0x1c5309,{'sectionId':0x3eb});return getCustomDashboards(_0x373b6b)['then'](function(_0x1992bb){return _['map'](_0x1c5309,function(_0x4be0a7){if(_0x373b6b[_0x159c('0x59')]){if(_0x4be0a7[_0x159c('0x54')]===0x3eb){_0x4be0a7[_0x159c('0x5b')]=_0x1992bb;}}else{if(_0x4be0a7[_0x159c('0x54')]===0x64){if(!_0x4be0a7[_0x159c('0x5b')]){_0x4be0a7['subsections']=[];}_0x4be0a7[_0x159c('0x5b')]=_0x4be0a7[_0x159c('0x5b')][_0x159c('0x5c')](_0x1992bb);}}return _0x4be0a7;});});}else{return;}})[_0x159c('0x3e')](function(_0x1734c1){if(_0x1734c1)_0x1c5309=_0x1734c1;if(_[_0x159c('0x5a')](_0x4692ea,0x709)){var _0x2fd6b6=_[_0x159c('0x43')](_0x1c5309,{'sectionId':0x709});return getPlugins(_0x2fd6b6)[_0x159c('0x3e')](function(_0x4c9738){if(_0x2fd6b6[_0x159c('0x59')]){return _['map'](_0x1c5309,function(_0x395d6a){if(_0x395d6a[_0x159c('0x54')]===0x709){_0x395d6a['subsections']=_0x4c9738;}return _0x395d6a;});}else{var _0x131bc6={'sectionId':0x76c,'enabled':0x1,'subsections':_0x4c9738};var _0x683009=_[_0x159c('0x26')](_0x1c5309);_0x683009[_0x159c('0x5d')](_0x131bc6);return _0x683009;}});}else{return;}})['then'](function(_0x295383){if(_0x295383)_0x1c5309=_0x295383;return _['filter'](_0x1c5309,[_0x159c('0x59'),0x1]);})[_0x159c('0x3e')](respondWithResult(_0x514049,null))[_0x159c('0x41')](handleError(_0x514049,null));};function hasDefaultDashboard(_0x44c69c){var _0x2e7dd0=[0x65];return new BPromise(function(_0x5d8131,_0x16804c){try{if(_0x44c69c['autoAssociation']){_0x5d8131(_0x2e7dd0);}else{return db[_0x159c('0x52')][_0x159c('0x5e')]({'where':{'sectionId':_0x44c69c['id']},'raw':!![]})[_0x159c('0x3e')](function(_0x2bec38){_0x2bec38?_0x5d8131(_0x2e7dd0):_0x5d8131();});}}catch(_0x5d5c13){_0x16804c(_0x5d5c13);}});}function getCustomDashboards(_0x2c53a0){var _0x1a8c39=[];return new BPromise(function(_0x32971e,_0x100251){try{if(_0x2c53a0['autoAssociation']){return db[_0x159c('0x5f')]['findAll']({'raw':!![]})[_0x159c('0x3e')](function(_0x565ed2){_0x565ed2['forEach'](function(_0x4affc7){_0x1a8c39[_0x159c('0x5d')](_0x4affc7['id']+0x1869f);});_0x32971e(_0x1a8c39);});}else{return db[_0x159c('0x52')]['findAll']({'where':{'sectionId':_0x2c53a0['id']},'raw':!![]})[_0x159c('0x3e')](function(_0x49a956){_0x49a956[_0x159c('0x60')](function(_0x362a1b){_0x1a8c39[_0x159c('0x5d')](_0x362a1b[_0x159c('0x61')]+0x1869f);});_0x32971e(_0x1a8c39);});}}catch(_0x19a854){_0x100251(_0x19a854);}});}function getPlugins(_0x6d2b34){var _0x516767=[];return new BPromise(function(_0x3af988,_0x23af8d){try{if(_0x6d2b34[_0x159c('0x51')]){return db[_0x159c('0x62')][_0x159c('0x40')]({'raw':!![]})[_0x159c('0x3e')](function(_0x239986){_0x239986[_0x159c('0x60')](function(_0x2a225a){_0x516767['push'](_0x2a225a['id']+0x15b38);});_0x3af988(_0x516767);});}else{return db['UserProfileResource']['findAll']({'where':{'sectionId':_0x6d2b34['id']},'raw':!![]})['then'](function(_0x523519){_0x523519[_0x159c('0x60')](function(_0x2d723c){_0x516767['push'](_0x2d723c[_0x159c('0x61')]+0x15b38);});_0x3af988(_0x516767);});}}catch(_0x9c5d0d){_0x23af8d(_0x9c5d0d);}});}exports[_0x159c('0x63')]=function(_0x2f3909,_0x3f75ee){return db[_0x159c('0x27')][_0x159c('0x43')]({'where':{'id':_0x2f3909['params']['id']}})[_0x159c('0x3e')](handleEntityNotFound(_0x3f75ee,null))[_0x159c('0x3e')](function(_0x139708){if(_0x139708){return db[_0x159c('0x4c')][_0x159c('0x4d')](function(_0x2d99ae){return db[_0x159c('0x4e')][_0x159c('0x40')]({'where':{'userProfileId':_0x2f3909[_0x159c('0x4f')]['id']},'attributes':['id'],'raw':!![]})[_0x159c('0x3e')](function(_0x42fc0a){if(_0x42fc0a){return db['UserProfileSection'][_0x159c('0x23')]({'where':{'userProfileId':_0x2f3909[_0x159c('0x4f')]['id'],'id':_[_0x159c('0x26')](_0x42fc0a,function(_0x3d7f75){return _0x3d7f75['id'];})},'transaction':_0x2d99ae});}})[_0x159c('0x3e')](function(_0x434e72){var _0x2e4101=_['map'](_0x2f3909[_0x159c('0x45')],function(_0xc68167){_0xc68167[_0x159c('0x64')]=_0x2f3909[_0x159c('0x4f')]['id'];return _0xc68167;});return db[_0x159c('0x4e')][_0x159c('0x65')](_0x2e4101,{'raw':!![],'transaction':_0x2d99ae});})['then'](function(_0x515761){var _0x3b2990=_[_0x159c('0x39')](_[_0x159c('0x26')](_0x515761,function(_0x3b7bd3){return _0x3b7bd3[_0x159c('0x48')]({'plain':!![]});}),{'includeAll':![]});if(_0x3b2990){return db[_0x159c('0x4e')]['findAll']({'where':{'userProfileId':_0x2f3909[_0x159c('0x4f')]['id'],'sectionId':_[_0x159c('0x26')](_0x3b2990,function(_0x1e855e){return _0x1e855e[_0x159c('0x54')];})},'attributes':['id',_0x159c('0x54')],'raw':!![]})['then'](function(_0x32c407){var _0x37a3da=_[_0x159c('0x26')](_0x2f3909[_0x159c('0x45')],function(_0x28c288){_0x28c288[_0x159c('0x64')]=_0x2f3909[_0x159c('0x4f')]['id'];return _0x28c288;});return db[_0x159c('0x52')]['bulkCreate'](_0x37a3da,{'raw':!![],'transaction':_0x2d99ae});});}})[_0x159c('0x41')](handleError(_0x3f75ee,null));});}})[_0x159c('0x3e')](function(_0xb6712){var _0x3e4906=_['map'](_0xb6712,function(_0x4e76ee){return _0x4e76ee[_0x159c('0x48')]({'plain':!![]});});})[_0x159c('0x3e')](respondWithResult(_0x3f75ee,null))['catch'](handleError(_0x3f75ee,null));};exports[_0x159c('0x66')]=function(_0x1c94da,_0x10af3f,_0x29856d){return db[_0x159c('0x27')][_0x159c('0x43')]({'where':{'id':_0x1c94da['params']['id']}})[_0x159c('0x3e')](handleEntityNotFound(_0x10af3f,null))[_0x159c('0x3e')](function(_0x5a9627){if(_0x5a9627){return _0x5a9627['removeResources'](_0x1c94da[_0x159c('0x2d')][_0x159c('0x57')]);}})[_0x159c('0x3e')](respondWithStatusCode(_0x10af3f,null))[_0x159c('0x41')](handleError(_0x10af3f,null));};exports[_0x159c('0x67')]=function(_0x54cdc9,_0x367508){var _0x299351={};if(!_0x54cdc9[_0x159c('0x2d')][_0x159c('0x68')])throw new Error('Missing\x20section\x20parameter');if(!_0x54cdc9[_0x159c('0x2d')][_0x159c('0x32')](_0x159c('0x33'))){_0x299351[_0x159c('0x1d')]=qs[_0x159c('0x1d')](_0x54cdc9['query']['limit']);_0x299351[_0x159c('0x34')]=qs[_0x159c('0x34')](_0x54cdc9[_0x159c('0x2d')]['offset']);}return db[_0x159c('0x27')][_0x159c('0x43')]({'where':{'id':_0x54cdc9[_0x159c('0x4f')]['id']}})[_0x159c('0x3e')](function(_0x38077b){if(!_0x38077b)throw new Error(_0x159c('0x69')+_0x54cdc9[_0x159c('0x4f')]['id']);return db['UserProfile'][_0x159c('0x67')](_0x54cdc9);})[_0x159c('0x3e')](respondWithFilteredResult(_0x367508,_0x299351))[_0x159c('0x41')](handleError(_0x367508,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index 2611d26..e5a415c 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 _0xf970=['hasOwnProperty','hook','exports','events','UserProfile','setMaxListeners','save','update','remove','emit'];(function(_0x4e7d25,_0x58285f){var _0x526fe6=function(_0x4f0aec){while(--_0x4f0aec){_0x4e7d25['push'](_0x4e7d25['shift']());}};_0x526fe6(++_0x58285f);}(_0xf970,0x1d9));var _0x0f97=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf970[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x0f97('0x0'));var UserProfile=require('../../mysqldb')['db'][_0x0f97('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x0f97('0x2')](0x0);var events={'afterCreate':_0x0f97('0x3'),'afterUpdate':_0x0f97('0x4'),'afterDestroy':_0x0f97('0x5')};function emitEvent(_0x25e484){return function(_0x439149,_0x4ab74d,_0xc822e8){UserProfileEvents[_0x0f97('0x6')](_0x25e484+':'+_0x439149['id'],_0x439149);UserProfileEvents[_0x0f97('0x6')](_0x25e484,_0x439149);_0xc822e8(null);};}for(var e in events){if(events[_0x0f97('0x7')](e)){var event=events[e];UserProfile[_0x0f97('0x8')](e,emitEvent(event));}}module[_0x0f97('0x9')]=UserProfileEvents; \ No newline at end of file +var _0x3e0c=['exports','events','../../mysqldb','UserProfile','save','update','remove'];(function(_0x253c6a,_0xa23815){var _0x5511fc=function(_0x4e594a){while(--_0x4e594a){_0x253c6a['push'](_0x253c6a['shift']());}};_0x5511fc(++_0xa23815);}(_0x3e0c,0x16d));var _0xc3e0=function(_0x1ce595,_0x1069cb){_0x1ce595=_0x1ce595-0x0;var _0x525dfe=_0x3e0c[_0x1ce595];return _0x525dfe;};'use strict';var EventEmitter=require(_0xc3e0('0x0'));var UserProfile=require(_0xc3e0('0x1'))['db'][_0xc3e0('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xc3e0('0x3'),'afterUpdate':_0xc3e0('0x4'),'afterDestroy':_0xc3e0('0x5')};function emitEvent(_0x2ba135){return function(_0xba1d4c,_0x49e5b7,_0x88cddb){UserProfileEvents['emit'](_0x2ba135+':'+_0xba1d4c['id'],_0xba1d4c);UserProfileEvents['emit'](_0x2ba135,_0xba1d4c);_0x88cddb(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserProfile['hook'](e,emitEvent(event));}}module[_0xc3e0('0x6')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index b1bf801..cd18b92 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 _0xa52d=['ignore','isEmpty','union','length','autoAssociation','model','rawAttributes','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','offset','order','sort','pick','key','VIRTUAL','foreignKey','forEach','merge','include','reportType','default','DefaultReports','count','rows','ids','customSorting','extraQueryConditions','includeAll','color','tag','ThroughTags','openTabs','true','chat','dataValues','sms','mail','openchannel','./userProfile.attributes','squel','exports','models','filter','field','value','findAll','then','associatedResources','catch','map','name','UserProfileResource','AnalyticExtractedReport','resourceId','type','toLowerCase','squareprojects','childModel','odbc','SquareOdbc','SquareRecording','SquareProjects','projectName','projects','CmContact','ListId','CmList','companies','CmCustomField','chatqueues','ChatQueue','chatwebsites','FaxQueue','faxaccounts','FaxAccount','inboundroutes','VoiceExtension','contexts','VoiceContext','voicemails','VoiceMail','voicerecordings','VoiceRecording','parentSections','Agents','membername','User','role','agent','Telephones','telephone','VoiceQueues','queue','VoiceQueue','inbound','outbound','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','ivrcampaigns','Campaign','mailqueues','MailQueue','MailAccount','mailsubstatuses','MailSubstatus','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','smsqueues','smsaccounts','SmsAccount','whatsappqueues','teams','Team','voicequeues','queuecampaigns','QueueCampaigns','users','agents','telephones','user','zendeskaccounts','ZendeskAccount','salesforceaccounts','FreshdeskAccount','SugarcrmAccount','deskaccounts','Dashboard','Interval','Pause','scheduler','Schedule','sounds','Sound','tags','Tag','templates','triggers','Trigger','trunks','Trunk','plugins','Plugin','extractedreports','Reports','reportId','AnalyticMetric','charAt','toUpperCase','slice','Sequelize','QueryTypes','select','ui.','InteractionId','ui.createdAt','from','user_has_','where','ui.UserId\x20=\x20?','sequelize','query','toString','OpenTabs','UserProfile','../../components/parsers/qs','section','mergeResources','Invalid\x20section\x20\x27','push','find','all'];(function(_0x16fe4c,_0x2421e8){var _0x9999d=function(_0x26160a){while(--_0x26160a){_0x16fe4c['push'](_0x16fe4c['shift']());}};_0x9999d(++_0x2421e8);}(_0xa52d,0xe2));var _0xda52=function(_0x2bb3f6,_0x25fde0){_0x2bb3f6=_0x2bb3f6-0x0;var _0x62b339=_0xa52d[_0x2bb3f6];return _0x62b339;};'use strict';var _=require('lodash');var attributes=require(_0xda52('0x0'));var squel=require(_0xda52('0x1'));module[_0xda52('0x2')]=function(_0x24f413){var _0x5852ce=_0x24f413[_0xda52('0x3')];function _0x5b5e3a(_0x3d3963,_0x5fb632){return new Promise(function(_0x5920f9,_0x2c18da){if(!_0x5fb632)return _0x5920f9(null);var _0x56247a=_0x5fb632[_0xda52('0x4')]?{[_0x5fb632[_0xda52('0x4')][_0xda52('0x5')]]:_0x5fb632[_0xda52('0x4')][_0xda52('0x6')]}:undefined;return _0x5852ce[_0x3d3963][_0xda52('0x7')]({'where':_0x56247a,'raw':!![]})[_0xda52('0x8')](function(_0x4ee88c){_0x5fb632[_0xda52('0x9')]=_['map'](_0x4ee88c,'id');_0x5920f9(_0x5fb632);})[_0xda52('0xa')](function(_0x36eb00){_0x2c18da(_0x36eb00);});});}function _0x41c9a5(_0x57993c,_0x4de7a2){return new Promise(function(_0x16a2b3,_0xe10c47){var _0x5855c6=_0x57993c['filter']?{[_0x57993c[_0xda52('0x4')][_0xda52('0x5')]]:_0x57993c['filter'][_0xda52('0x6')]}:undefined;return _0x5852ce[_0x57993c['model']]['findAll']({'where':_0x5855c6,'raw':!![]})['then'](function(_0x7fbba9){_0x4de7a2[_0xda52('0x9')]=_[_0xda52('0xb')](_0x7fbba9,function(_0x56ce3d){return _0x56ce3d[_0xda52('0xc')];});_0x16a2b3(_0x4de7a2);})[_0xda52('0xa')](function(_0x5a57a2){_0xe10c47(_0x5a57a2);});});}function _0x17350a(_0x16ef54,_0x2ed69a,_0x142063){if(!_0x2ed69a)return Promise['resolve'](null);return new Promise(function(_0x4fa61e,_0x5ead11){return _0x5852ce[_0xda52('0xd')][_0xda52('0x7')]({'where':{'sectionId':_0x2ed69a['id']},'raw':!![]})[_0xda52('0x8')](function(_0x357935){if(_0x16ef54[_0xda52('0x5')]&&_0x16ef54[_0xda52('0x5')]!=='id'){_0x2ed69a['associatedResources']=_['map'](_0x357935,function(_0x7d9cef){return _0x7d9cef[_0x16ef54['field']];});}else{if(_0x142063===_0xda52('0xe')){_0x2ed69a[_0xda52('0x9')]=_['map'](_0x357935,function(_0x2954a5){return{'id':_0x2954a5[_0xda52('0xf')],'type':_0x2954a5[_0xda52('0x10')]};});}else{_0x2ed69a['associatedResources']=_[_0xda52('0xb')](_0x357935,function(_0x6affba){return _0x6affba[_0xda52('0xf')];});}}_0x4fa61e(_0x2ed69a);})[_0xda52('0xa')](function(_0x4baa80){_0x5ead11(_0x4baa80);});});}function _0x293e84(_0x508ed0,_0x507481){var _0x1d9f83={'parentSections':[]};switch(_0x508ed0[_0xda52('0x11')]()){case _0xda52('0x12'):_0x1d9f83[_0xda52('0x13')]='SquareProject';break;case _0xda52('0x14'):_0x1d9f83[_0xda52('0x13')]=_0xda52('0x15');break;case'squarerecordings':_0x1d9f83[_0xda52('0x13')]=_0xda52('0x16');_0x1d9f83['parentSections']=[{'name':_0xda52('0x17'),'field':_0xda52('0xc'),'foreignKey':_0xda52('0x18')}];break;case _0xda52('0x19'):_0x1d9f83[_0xda52('0x13')]='JscriptyProject';break;case'contacts':_0x1d9f83[_0xda52('0x13')]=_0xda52('0x1a');_0x1d9f83['parentSections']=[{'name':'Lists','field':'id','foreignKey':_0xda52('0x1b')}];break;case'lists':_0x1d9f83[_0xda52('0x13')]=_0xda52('0x1c');break;case _0xda52('0x1d'):_0x1d9f83['childModel']='CmCompany';break;case'globalcustomfields':_0x1d9f83[_0xda52('0x13')]=_0xda52('0x1e');break;case _0xda52('0x1f'):_0x1d9f83[_0xda52('0x13')]=_0xda52('0x20');break;case _0xda52('0x21'):_0x1d9f83[_0xda52('0x13')]='ChatWebsite';break;case'faxqueues':_0x1d9f83[_0xda52('0x13')]=_0xda52('0x22');break;case _0xda52('0x23'):_0x1d9f83[_0xda52('0x13')]=_0xda52('0x24');break;case _0xda52('0x25'):case'internalroutes':case'outboundroutes':_0x1d9f83[_0xda52('0x13')]=_0xda52('0x26');break;case _0xda52('0x27'):_0x1d9f83[_0xda52('0x13')]=_0xda52('0x28');break;case _0xda52('0x29'):_0x1d9f83[_0xda52('0x13')]=_0xda52('0x2a');break;case _0xda52('0x2b'):_0x1d9f83[_0xda52('0x13')]=_0xda52('0x2c');_0x1d9f83[_0xda52('0x2d')]=[{'name':_0xda52('0x2e'),'field':_0xda52('0xc'),'foreignKey':_0xda52('0x2f'),'model':_0xda52('0x30'),'filter':{'field':_0xda52('0x31'),'value':[_0xda52('0x32')]}},{'name':_0xda52('0x33'),'field':'name','foreignKey':_0xda52('0x2f'),'model':_0xda52('0x30'),'filter':{'field':_0xda52('0x31'),'value':[_0xda52('0x34')]}},{'name':_0xda52('0x35'),'field':_0xda52('0xc'),'foreignKey':_0xda52('0x36'),'model':_0xda52('0x37'),'filter':{'field':'type','value':[_0xda52('0x38')]}},{'name':'QueueCampaigns','field':_0xda52('0xc'),'foreignKey':_0xda52('0x36'),'model':_0xda52('0x37'),'filter':{'field':_0xda52('0x10'),'value':[_0xda52('0x39')]}}];break;case _0xda52('0x3a'):_0x1d9f83[_0xda52('0x13')]=_0xda52('0x3b');break;case _0xda52('0x3c'):_0x1d9f83[_0xda52('0x13')]=_0xda52('0x3d');break;case _0xda52('0x3e'):_0x1d9f83[_0xda52('0x13')]=_0xda52('0x3f');break;case _0xda52('0x40'):_0x1d9f83[_0xda52('0x13')]=_0xda52('0x41');break;case _0xda52('0x42'):_0x1d9f83[_0xda52('0x13')]=_0xda52('0x43');break;case'mailaccounts':_0x1d9f83[_0xda52('0x13')]=_0xda52('0x44');break;case _0xda52('0x45'):_0x1d9f83[_0xda52('0x13')]=_0xda52('0x46');break;case'openchannelqueues':_0x1d9f83['childModel']=_0xda52('0x47');break;case _0xda52('0x48'):_0x1d9f83[_0xda52('0x13')]=_0xda52('0x49');break;case _0xda52('0x4a'):_0x1d9f83[_0xda52('0x13')]='SmsQueue';break;case _0xda52('0x4b'):_0x1d9f83[_0xda52('0x13')]=_0xda52('0x4c');break;case _0xda52('0x4d'):_0x1d9f83['childModel']='WhatsappQueue';break;case'whatsappaccounts':_0x1d9f83['childModel']='WhatsappAccount';break;case _0xda52('0x4e'):_0x1d9f83['childModel']=_0xda52('0x4f');break;case _0xda52('0x50'):case _0xda52('0x51'):_0x1d9f83[_0xda52('0x13')]=_0xda52('0x37');if(_0x507481){_0x1d9f83[_0xda52('0x2d')]=[{'name':_0xda52('0x35')},{'name':_0xda52('0x52')}];}break;case _0xda52('0x53'):case _0xda52('0x54'):case _0xda52('0x55'):_0x1d9f83[_0xda52('0x13')]='User';if(_0x507481){_0x1d9f83[_0xda52('0x2d')]=[{'name':'Users','filter':{'field':_0xda52('0x31'),'value':['admin',_0xda52('0x56')]},'ignore':!![]},{'name':_0xda52('0x2e')},{'name':_0xda52('0x33')}];}break;case _0xda52('0x57'):_0x1d9f83[_0xda52('0x13')]=_0xda52('0x58');break;case _0xda52('0x59'):_0x1d9f83['childModel']='SalesforceAccount';break;case'freshdeskaccounts':_0x1d9f83[_0xda52('0x13')]=_0xda52('0x5a');break;case'sugarcrmaccounts':_0x1d9f83['childModel']=_0xda52('0x5b');break;case _0xda52('0x5c'):_0x1d9f83['childModel']='DeskAccount';break;case'zohoaccounts':_0x1d9f83[_0xda52('0x13')]='ZohoAccount';break;case'vtigeraccounts':_0x1d9f83[_0xda52('0x13')]=_0xda52('0x30');break;case'cannedanswers':_0x1d9f83[_0xda52('0x13')]='CannedAnswer';break;case'dispositions':_0x1d9f83[_0xda52('0x13')]='Disposition';break;case'customdashboards':_0x1d9f83[_0xda52('0x13')]=_0xda52('0x5d');break;case'intervals':_0x1d9f83[_0xda52('0x13')]=_0xda52('0x5e');break;case'pauses':_0x1d9f83['childModel']=_0xda52('0x5f');break;case _0xda52('0x60'):_0x1d9f83[_0xda52('0x13')]=_0xda52('0x61');break;case _0xda52('0x62'):_0x1d9f83['childModel']=_0xda52('0x63');break;case _0xda52('0x64'):_0x1d9f83[_0xda52('0x13')]=_0xda52('0x65');break;case _0xda52('0x66'):_0x1d9f83['childModel']='Template';break;case _0xda52('0x67'):_0x1d9f83['childModel']=_0xda52('0x68');break;case _0xda52('0x69'):_0x1d9f83['childModel']=_0xda52('0x6a');break;case'variables':_0x1d9f83[_0xda52('0x13')]='Variable';break;case _0xda52('0x6b'):_0x1d9f83[_0xda52('0x13')]=_0xda52('0x6c');break;case _0xda52('0x6d'):_0x1d9f83[_0xda52('0x13')]='AnalyticExtractedReport';_0x1d9f83[_0xda52('0x2d')]=[{'name':_0xda52('0x6e'),'field':'id','foreignKey':_0xda52('0x6f')}];break;case'metrics':_0x1d9f83[_0xda52('0x13')]=_0xda52('0x70');break;}return _0x1d9f83;}function _0x160e0(_0xc1c7c1,_0x97f32d){var _0x4daa48=_0xc1c7c1[_0xda52('0x71')](0x0)[_0xda52('0x72')]()+_0xc1c7c1[_0xda52('0x73')](0x1);var _0x13a3b2={'type':_0x5852ce[_0xda52('0x74')][_0xda52('0x75')]['SELECT'],'raw':!![]};return new Promise(function(_0x49984a,_0x2b45f3){var _0x54d9d3=squel[_0xda52('0x76')]()[_0xda52('0x5')](_0xda52('0x77')+_0x4daa48+_0xda52('0x78'),'id')[_0xda52('0x5')](_0xda52('0x79'))[_0xda52('0x7a')](_0xda52('0x7b')+_0xc1c7c1+'_interactions','ui')[_0xda52('0x7c')](_0xda52('0x7d'),_0x97f32d['id']);return _0x5852ce[_0xda52('0x7e')][_0xda52('0x7f')](_0x54d9d3[_0xda52('0x80')](),_0x13a3b2)[_0xda52('0x8')](function(_0x53e02d){_0x97f32d[_0x4daa48+_0xda52('0x81')]=_0x53e02d;_0x49984a(_0x53e02d);})[_0xda52('0xa')](function(_0x1f5114){_0x2b45f3(_0x1f5114);});});}return _0x24f413['define'](_0xda52('0x82'),attributes,{'tableName':'user_profiles','paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x303348){var _0x27f787=require(_0xda52('0x83'));var _0x332180={'raw':_0x303348[_0xda52('0x7f')]['raw'],'where':{}};var _0x1e8feb={};var _0x59471d={'count':0x0,'rows':[]};var _0x1e5bd3=_0x303348['query'][_0xda52('0x84')];var _0x5af900=_0x303348[_0xda52('0x7f')][_0xda52('0x85')]||![];var _0x3f0977=_0x293e84(_0x1e5bd3,_0x5af900);if(!_0x3f0977[_0xda52('0x13')])throw new Error(_0xda52('0x86')+_0x1e5bd3+'\x27');var _0x1194f9=[{'name':_0x1e5bd3}];if(!_['isEmpty'](_0x3f0977[_0xda52('0x2d')]))_0x1194f9=_0x3f0977[_0xda52('0x2d')];var _0x1240dd=[];for(var _0x3cd895=0x0;_0x3cd895<_0x1194f9['length'];_0x3cd895++){_0x1240dd[_0xda52('0x87')](_0x5852ce['UserProfileSection'][_0xda52('0x88')]({'where':{'userProfileId':_0x303348['params']['id'],'name':_0x1194f9[_0x3cd895][_0xda52('0xc')]},'raw':!![]}));}return Promise[_0xda52('0x89')](_0x1240dd)[_0xda52('0x8')](function(_0x5908de){var _0x8dc1a7=_['filter'](_0x5908de,function(_0x4f5f2e){return _0x4f5f2e?_0x4f5f2e:undefined;});var _0x34b00c=_[_0xda52('0x4')](_0x1194f9,[_0xda52('0x8a'),!![]]);var _0x200817=_[_0xda52('0x8b')](_0x8dc1a7)&&_[_0xda52('0x8b')](_0x34b00c)?null:_[_0xda52('0x8c')](_0x34b00c,_0x8dc1a7);if(!_0x200817)return null;var _0x74ac8=[];for(var _0x5ad4ce=0x0;_0x5ad4ce<_0x200817[_0xda52('0x8d')];_0x5ad4ce++){var _0x1706df=_[_0xda52('0x88')](_0x1194f9,function(_0x4d7f51){return _0x200817[_0x5ad4ce]?_0x4d7f51[_0xda52('0xc')]===_0x200817[_0x5ad4ce][_0xda52('0xc')]:null;});if(_0x1706df){if(_0x200817[_0x5ad4ce][_0xda52('0x8a')]){_0x74ac8[_0xda52('0x87')](_0x5b5e3a(_0x3f0977[_0xda52('0x13')],_0x200817[_0x5ad4ce]));}else{if(!_0x200817[_0x5ad4ce][_0xda52('0x8e')]){_0x74ac8['push'](_0x17350a(_0x1706df,_0x200817[_0x5ad4ce],_0x3f0977[_0xda52('0x13')]));}else{if(_0x1706df[_0xda52('0x8f')]){_0x74ac8[_0xda52('0x87')](_0x41c9a5(_0x1706df,_0x200817[_0x5ad4ce]));}}}}}return Promise[_0xda52('0x89')](_0x74ac8);})[_0xda52('0x8')](function(_0x1a2341){var _0x5f070d=_0x1a2341;var _0x84fea0=null;if(_0x5f070d){_0x84fea0=_0x5f070d[_0xda52('0x8d')]===0x1?_0x5f070d[0x0]:null;}if(!_0x84fea0&&!_0x5f070d)return _0x59471d;var _0x24e6c1=_0x5852ce[_0x3f0977[_0xda52('0x13')]][_0xda52('0x90')];_0x1e8feb[_0xda52('0x8f')]=_[_0xda52('0x91')](_0x24e6c1);_0x1e8feb['query']=_[_0xda52('0x91')](_0x303348[_0xda52('0x7f')]);_0x1e8feb[_0xda52('0x92')]=_[_0xda52('0x93')](_0x1e8feb[_0xda52('0x8f')],_0x1e8feb[_0xda52('0x7f')]);_0x332180[_0xda52('0x94')]=_[_0xda52('0x93')](_0x1e8feb['model'],_0x27f787[_0xda52('0x95')](_0x303348[_0xda52('0x7f')][_0xda52('0x95')]));_0x332180['attributes']=_0x332180[_0xda52('0x94')][_0xda52('0x8d')]?_0x332180[_0xda52('0x94')]:_0x1e8feb[_0xda52('0x8f')];if(!_0x303348[_0xda52('0x7f')][_0xda52('0x96')](_0xda52('0x97'))){_0x332180['limit']=_0x27f787[_0xda52('0x98')](_0x303348[_0xda52('0x7f')]['limit']);_0x332180[_0xda52('0x99')]=_0x27f787[_0xda52('0x99')](_0x303348[_0xda52('0x7f')][_0xda52('0x99')]);}_0x332180[_0xda52('0x9a')]=_0x27f787[_0xda52('0x9b')](_0x303348[_0xda52('0x7f')][_0xda52('0x9b')]);_0x332180[_0xda52('0x7c')]=_0x27f787[_0xda52('0x92')](_[_0xda52('0x9c')](_0x303348[_0xda52('0x7f')],_0x1e8feb[_0xda52('0x92')]));if(_0x303348['query'][_0xda52('0x4')]){_0x332180[_0xda52('0x7c')]=_['merge'](_0x332180[_0xda52('0x7c')],{'$or':_[_0xda52('0xb')](_0x24e6c1,function(_0x35114a){if(_0x35114a['type'][_0xda52('0x9d')]!==_0xda52('0x9e')){var _0x438b3a={};_0x438b3a[_0x35114a[_0xda52('0x5')]]={'$like':'%'+_0x303348[_0xda52('0x7f')][_0xda52('0x4')]+'%'};return _0x438b3a;}})});}var _0x201a8d=[];var _0x4ac2e2=null;var _0x306def={};if(_0x84fea0){_0x4ac2e2=_[_0xda52('0x88')](_0x1194f9,[_0xda52('0xc'),_0x84fea0[_0xda52('0xc')]]);if(_0x4ac2e2[_0xda52('0x5')]){_0x306def={};if(_0x3f0977[_0xda52('0x13')]===_0xda52('0xe')){_0x306def[_0x4ac2e2[_0xda52('0x9f')]]=_[_0xda52('0xb')](_0x84fea0[_0xda52('0x9')],'id');}else{_0x306def[_0x4ac2e2[_0xda52('0x9f')]]=_0x84fea0['associatedResources'];}_0x201a8d[_0xda52('0x87')](_0x306def);}else{_0x332180[_0xda52('0x7c')]['id']=_0x84fea0[_0xda52('0x9')];}}else{for(var _0x5c5cac=0x0;_0x5c5cac<_0x5f070d[_0xda52('0x8d')];_0x5c5cac++){_0x4ac2e2=_[_0xda52('0x88')](_0x1194f9,[_0xda52('0xc'),_0x5f070d[_0x5c5cac][_0xda52('0xc')]]);if(_0x4ac2e2[_0xda52('0x5')]){_0x306def={};_0x306def[_0x4ac2e2[_0xda52('0x9f')]]=_0x5f070d[_0x5c5cac]['associatedResources'];_0x201a8d[_0xda52('0x87')](_0x306def);}else{if(!_0x332180[_0xda52('0x7c')]['id'])_0x332180[_0xda52('0x7c')]['id']=[];_0x5f070d[_0x5c5cac]['associatedResources'][_0xda52('0xa0')](function(_0x20337e){_0x332180[_0xda52('0x7c')]['id'][_0xda52('0x87')](_0x20337e);});}}}if(!_[_0xda52('0x8b')](_0x201a8d)){_0x332180[_0xda52('0x7c')]=_['merge'](_0x332180[_0xda52('0x7c')],{'$and':{'$or':_0x201a8d}});}_0x332180=_[_0xda52('0xa1')]({},_0x332180,_0x303348['options']);if(_0x84fea0&&!_0x84fea0['autoAssociation']&&_0x3f0977[_0xda52('0x13')]===_0xda52('0xe')){if(_0x303348[_0xda52('0x7f')]['includeAll']){_0x332180[_0xda52('0xa2')]=[{'all':!![]}];}return _0x5852ce[_0x3f0977[_0xda52('0x13')]][_0xda52('0x7')](_0x332180)[_0xda52('0x8')](function(_0x5cb098){var _0x2d08b8=[];_0x5cb098[_0xda52('0xa0')](function(_0x457089){var _0x1a98b8;switch(_0x457089[_0xda52('0xa3')]){case _0xda52('0xa4'):_0x1a98b8=_[_0xda52('0x88')](_0x84fea0[_0xda52('0x9')],function(_0x4f7451){return _0x4f7451['id']===_0x457089[_0xda52('0x6f')]&&_0x4f7451[_0xda52('0x10')]===_0xda52('0xa5');});break;case'custom':_0x1a98b8=_['find'](_0x84fea0[_0xda52('0x9')],function(_0x296e76){return _0x296e76['id']===_0x457089[_0xda52('0x6f')]&&_0x296e76[_0xda52('0x10')]==='CustomReports';});break;}if(_0x1a98b8)_0x2d08b8['push'](_0x457089);});_0x59471d[_0xda52('0xa6')]=_0x2d08b8[_0xda52('0x8d')];_0x59471d[_0xda52('0xa7')]=_0x2d08b8;return _0x59471d;});}else{if(!_['isEmpty'](_0x303348[_0xda52('0x7f')][_0xda52('0xa8')])){_0x332180[_0xda52('0x7c')]['id']=_0x332180[_0xda52('0x7c')]['id']?_[_0xda52('0x93')](_0x332180[_0xda52('0x7c')]['id'],_0x303348[_0xda52('0x7f')][_0xda52('0xa8')]):_0x303348[_0xda52('0x7f')][_0xda52('0xa8')];if(_0x303348[_0xda52('0x7f')][_0xda52('0xa9')]){_0x332180[_0xda52('0x9a')]=_0x303348[_0xda52('0x7f')][_0xda52('0xa9')];}}if(_0x303348['query'][_0xda52('0xaa')]){_0x332180[_0xda52('0x7c')]=_[_0xda52('0xa1')](_0x332180[_0xda52('0x7c')],{'$and':_0x303348[_0xda52('0x7f')][_0xda52('0xaa')]});}return _0x5852ce[_0x3f0977['childModel']][_0xda52('0xa6')]({'where':_0x332180[_0xda52('0x7c')]})[_0xda52('0x8')](function(_0x3c4196){_0x59471d[_0xda52('0xa6')]=_0x3c4196;if(_0x303348[_0xda52('0x7f')][_0xda52('0xab')]){if(_0x3f0977[_0xda52('0x13')]===_0xda52('0x1a')){_0x332180['include']=[{'model':_0x5852ce[_0xda52('0x65')],'as':'Tags','attributes':['id',_0xda52('0xc'),_0xda52('0xac')],'required':_0x303348['query'][_0xda52('0xad')]?!![]:![]},{'model':_0x5852ce[_0xda52('0x65')],'as':_0xda52('0xae'),'attributes':['id',_0xda52('0xc'),_0xda52('0xac')],'through':_0x303348[_0xda52('0x7f')][_0xda52('0xad')]?{'attributes':[],'where':{'TagId':_0x303348[_0xda52('0x7f')][_0xda52('0xad')]||undefined}}:{},'required':_0x303348[_0xda52('0x7f')][_0xda52('0xad')]?!![]:![]}];}else{_0x332180[_0xda52('0xa2')]=[{'all':!![]}];}}return _0x5852ce[_0x3f0977['childModel']][_0xda52('0x7')](_0x332180);})[_0xda52('0x8')](function(_0xea300d){_0x59471d[_0xda52('0xa7')]=_0xea300d;if(_0x1e5bd3==='Agents'&&_0x303348[_0xda52('0x7f')][_0xda52('0xaf')]===_0xda52('0xb0')){var _0x57c4ea=[];for(var _0x24e283=0x0;_0x24e283<_0x59471d[_0xda52('0xa7')][_0xda52('0x8d')];_0x24e283++){_0x57c4ea[_0xda52('0x87')](_0x160e0(_0xda52('0xb1'),_0x59471d[_0xda52('0xa7')][_0x24e283][_0xda52('0xb2')]));_0x57c4ea[_0xda52('0x87')](_0x160e0(_0xda52('0xb3'),_0x59471d['rows'][_0x24e283][_0xda52('0xb2')]));_0x57c4ea['push'](_0x160e0('fax',_0x59471d[_0xda52('0xa7')][_0x24e283][_0xda52('0xb2')]));_0x57c4ea[_0xda52('0x87')](_0x160e0(_0xda52('0xb4'),_0x59471d[_0xda52('0xa7')][_0x24e283][_0xda52('0xb2')]));_0x57c4ea['push'](_0x160e0(_0xda52('0xb5'),_0x59471d[_0xda52('0xa7')][_0x24e283]['dataValues']));_0x57c4ea[_0xda52('0x87')](_0x160e0('whatsapp',_0x59471d['rows'][_0x24e283]['dataValues']));}return Promise[_0xda52('0x89')](_0x57c4ea)[_0xda52('0x8')](function(){return _0x59471d;});}return _0x59471d;});}});}}});}; \ No newline at end of file +var _0xe912=['CustomReports','count','ids','customSorting','extraQueryConditions','Tag','color','ThroughTags','tag','rows','true','chat','sms','dataValues','fax','mail','openchannel','whatsapp','lodash','./userProfile.attributes','exports','filter','findAll','then','associatedResources','map','field','value','UserProfileResource','AnalyticExtractedReport','resourceId','catch','toLowerCase','SquareProject','odbc','childModel','SquareRecording','parentSections','SquareProjects','projectName','JscriptyProject','CmContact','Lists','ListId','lists','CmList','companies','CmCompany','globalcustomfields','ChatQueue','ChatWebsite','faxqueues','FaxQueue','FaxAccount','inboundroutes','internalroutes','outboundroutes','contexts','VoiceContext','VoiceMail','voicerecordings','VoiceRecording','Agents','membername','User','agent','Telephones','name','role','telephone','VoiceQueues','queue','VoiceQueue','type','inbound','outbound','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','ivrcampaigns','Campaign','mailqueues','mailaccounts','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelQueue','openchannelaccounts','SmsQueue','SmsAccount','WhatsappQueue','whatsappaccounts','WhatsappAccount','teams','Team','voicequeues','queuecampaigns','QueueCampaigns','users','agents','telephones','Users','admin','user','zendeskaccounts','ZendeskAccount','salesforceaccounts','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','zohoaccounts','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','Disposition','customdashboards','Dashboard','Interval','pauses','Pause','scheduler','Sound','tags','templates','Template','triggers','Trigger','trunks','variables','Variable','plugins','Plugin','extractedreports','Reports','reportId','metrics','AnalyticMetric','charAt','toUpperCase','Sequelize','QueryTypes','SELECT','select','InteractionId','ui.createdAt','from','where','ui.UserId\x20=\x20?','sequelize','toString','OpenTabs','UserProfile','user_profiles','query','raw','section','mergeResources','Invalid\x20section\x20\x27','length','push','UserProfileSection','find','params','all','isEmpty','union','autoAssociation','rawAttributes','model','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','offset','order','sort','merge','key','VIRTUAL','foreignKey','options','includeAll','include','reportType','default','DefaultReports'];(function(_0x240261,_0x4fe66c){var _0x45c332=function(_0x4f367a){while(--_0x4f367a){_0x240261['push'](_0x240261['shift']());}};_0x45c332(++_0x4fe66c);}(_0xe912,0x19a));var _0x2e91=function(_0x39f26a,_0x3a1660){_0x39f26a=_0x39f26a-0x0;var _0x1b9779=_0xe912[_0x39f26a];return _0x1b9779;};'use strict';var _=require(_0x2e91('0x0'));var attributes=require(_0x2e91('0x1'));var squel=require('squel');module[_0x2e91('0x2')]=function(_0x3a61aa){var _0x57eb1e=_0x3a61aa['models'];function _0x49a675(_0x47d186,_0xfa64e9){return new Promise(function(_0x27bd10,_0x2a24ca){if(!_0xfa64e9)return _0x27bd10(null);var _0x28d0bb=_0xfa64e9[_0x2e91('0x3')]?{[_0xfa64e9[_0x2e91('0x3')]['field']]:_0xfa64e9[_0x2e91('0x3')]['value']}:undefined;return _0x57eb1e[_0x47d186][_0x2e91('0x4')]({'where':_0x28d0bb,'raw':!![]})[_0x2e91('0x5')](function(_0x3f6551){_0xfa64e9[_0x2e91('0x6')]=_[_0x2e91('0x7')](_0x3f6551,'id');_0x27bd10(_0xfa64e9);})['catch'](function(_0x1320f8){_0x2a24ca(_0x1320f8);});});}function _0x360805(_0x165141,_0x178df7){return new Promise(function(_0x4cb18a,_0x4638bb){var _0x2f4c32=_0x165141[_0x2e91('0x3')]?{[_0x165141[_0x2e91('0x3')][_0x2e91('0x8')]]:_0x165141[_0x2e91('0x3')][_0x2e91('0x9')]}:undefined;return _0x57eb1e[_0x165141['model']][_0x2e91('0x4')]({'where':_0x2f4c32,'raw':!![]})[_0x2e91('0x5')](function(_0x1bee0e){_0x178df7[_0x2e91('0x6')]=_['map'](_0x1bee0e,function(_0x2f0ed6){return _0x2f0ed6['name'];});_0x4cb18a(_0x178df7);})['catch'](function(_0x13528f){_0x4638bb(_0x13528f);});});}function _0x1c57eb(_0x5bad02,_0x2534f9,_0x24a5ea){if(!_0x2534f9)return Promise['resolve'](null);return new Promise(function(_0x49f2c3,_0x23b25e){return _0x57eb1e[_0x2e91('0xa')][_0x2e91('0x4')]({'where':{'sectionId':_0x2534f9['id']},'raw':!![]})[_0x2e91('0x5')](function(_0x2d1397){if(_0x5bad02['field']&&_0x5bad02[_0x2e91('0x8')]!=='id'){_0x2534f9[_0x2e91('0x6')]=_['map'](_0x2d1397,function(_0x44f1f9){return _0x44f1f9[_0x5bad02[_0x2e91('0x8')]];});}else{if(_0x24a5ea===_0x2e91('0xb')){_0x2534f9[_0x2e91('0x6')]=_[_0x2e91('0x7')](_0x2d1397,function(_0x617f8d){return{'id':_0x617f8d[_0x2e91('0xc')],'type':_0x617f8d['type']};});}else{_0x2534f9[_0x2e91('0x6')]=_[_0x2e91('0x7')](_0x2d1397,function(_0x206ce6){return _0x206ce6[_0x2e91('0xc')];});}}_0x49f2c3(_0x2534f9);})[_0x2e91('0xd')](function(_0x186700){_0x23b25e(_0x186700);});});}function _0x520455(_0x1648f8,_0x2350da){var _0x55943f={'parentSections':[]};switch(_0x1648f8[_0x2e91('0xe')]()){case'squareprojects':_0x55943f['childModel']=_0x2e91('0xf');break;case _0x2e91('0x10'):_0x55943f[_0x2e91('0x11')]='SquareOdbc';break;case'squarerecordings':_0x55943f[_0x2e91('0x11')]=_0x2e91('0x12');_0x55943f[_0x2e91('0x13')]=[{'name':_0x2e91('0x14'),'field':'name','foreignKey':_0x2e91('0x15')}];break;case'projects':_0x55943f[_0x2e91('0x11')]=_0x2e91('0x16');break;case'contacts':_0x55943f[_0x2e91('0x11')]=_0x2e91('0x17');_0x55943f[_0x2e91('0x13')]=[{'name':_0x2e91('0x18'),'field':'id','foreignKey':_0x2e91('0x19')}];break;case _0x2e91('0x1a'):_0x55943f['childModel']=_0x2e91('0x1b');break;case _0x2e91('0x1c'):_0x55943f[_0x2e91('0x11')]=_0x2e91('0x1d');break;case _0x2e91('0x1e'):_0x55943f[_0x2e91('0x11')]='CmCustomField';break;case'chatqueues':_0x55943f['childModel']=_0x2e91('0x1f');break;case'chatwebsites':_0x55943f[_0x2e91('0x11')]=_0x2e91('0x20');break;case _0x2e91('0x21'):_0x55943f[_0x2e91('0x11')]=_0x2e91('0x22');break;case'faxaccounts':_0x55943f['childModel']=_0x2e91('0x23');break;case _0x2e91('0x24'):case _0x2e91('0x25'):case _0x2e91('0x26'):_0x55943f[_0x2e91('0x11')]='VoiceExtension';break;case _0x2e91('0x27'):_0x55943f['childModel']=_0x2e91('0x28');break;case'voicemails':_0x55943f[_0x2e91('0x11')]=_0x2e91('0x29');break;case _0x2e91('0x2a'):_0x55943f[_0x2e91('0x11')]=_0x2e91('0x2b');_0x55943f['parentSections']=[{'name':_0x2e91('0x2c'),'field':'name','foreignKey':_0x2e91('0x2d'),'model':_0x2e91('0x2e'),'filter':{'field':'role','value':[_0x2e91('0x2f')]}},{'name':_0x2e91('0x30'),'field':_0x2e91('0x31'),'foreignKey':'membername','model':'User','filter':{'field':_0x2e91('0x32'),'value':[_0x2e91('0x33')]}},{'name':_0x2e91('0x34'),'field':_0x2e91('0x31'),'foreignKey':_0x2e91('0x35'),'model':_0x2e91('0x36'),'filter':{'field':_0x2e91('0x37'),'value':[_0x2e91('0x38')]}},{'name':'QueueCampaigns','field':_0x2e91('0x31'),'foreignKey':'queue','model':_0x2e91('0x36'),'filter':{'field':_0x2e91('0x37'),'value':[_0x2e91('0x39')]}}];break;case _0x2e91('0x3a'):_0x55943f[_0x2e91('0x11')]=_0x2e91('0x3b');break;case _0x2e91('0x3c'):_0x55943f[_0x2e91('0x11')]=_0x2e91('0x3d');break;case _0x2e91('0x3e'):_0x55943f[_0x2e91('0x11')]=_0x2e91('0x3f');break;case _0x2e91('0x40'):_0x55943f[_0x2e91('0x11')]=_0x2e91('0x41');break;case _0x2e91('0x42'):_0x55943f[_0x2e91('0x11')]='MailQueue';break;case _0x2e91('0x43'):_0x55943f[_0x2e91('0x11')]='MailAccount';break;case _0x2e91('0x44'):_0x55943f[_0x2e91('0x11')]=_0x2e91('0x45');break;case _0x2e91('0x46'):_0x55943f['childModel']=_0x2e91('0x47');break;case _0x2e91('0x48'):_0x55943f[_0x2e91('0x11')]='OpenchannelAccount';break;case'smsqueues':_0x55943f['childModel']=_0x2e91('0x49');break;case'smsaccounts':_0x55943f[_0x2e91('0x11')]=_0x2e91('0x4a');break;case'whatsappqueues':_0x55943f[_0x2e91('0x11')]=_0x2e91('0x4b');break;case _0x2e91('0x4c'):_0x55943f['childModel']=_0x2e91('0x4d');break;case _0x2e91('0x4e'):_0x55943f['childModel']=_0x2e91('0x4f');break;case _0x2e91('0x50'):case _0x2e91('0x51'):_0x55943f[_0x2e91('0x11')]=_0x2e91('0x36');if(_0x2350da){_0x55943f['parentSections']=[{'name':_0x2e91('0x34')},{'name':_0x2e91('0x52')}];}break;case _0x2e91('0x53'):case _0x2e91('0x54'):case _0x2e91('0x55'):_0x55943f['childModel']=_0x2e91('0x2e');if(_0x2350da){_0x55943f[_0x2e91('0x13')]=[{'name':_0x2e91('0x56'),'filter':{'field':_0x2e91('0x32'),'value':[_0x2e91('0x57'),_0x2e91('0x58')]},'ignore':!![]},{'name':_0x2e91('0x2c')},{'name':_0x2e91('0x30')}];}break;case _0x2e91('0x59'):_0x55943f[_0x2e91('0x11')]=_0x2e91('0x5a');break;case _0x2e91('0x5b'):_0x55943f['childModel']='SalesforceAccount';break;case _0x2e91('0x5c'):_0x55943f[_0x2e91('0x11')]=_0x2e91('0x5d');break;case _0x2e91('0x5e'):_0x55943f[_0x2e91('0x11')]=_0x2e91('0x5f');break;case _0x2e91('0x60'):_0x55943f[_0x2e91('0x11')]='DeskAccount';break;case _0x2e91('0x61'):_0x55943f['childModel']='ZohoAccount';break;case _0x2e91('0x62'):_0x55943f['childModel']=_0x2e91('0x2e');break;case _0x2e91('0x63'):_0x55943f[_0x2e91('0x11')]=_0x2e91('0x64');break;case _0x2e91('0x65'):_0x55943f[_0x2e91('0x11')]=_0x2e91('0x66');break;case _0x2e91('0x67'):_0x55943f[_0x2e91('0x11')]=_0x2e91('0x68');break;case'intervals':_0x55943f[_0x2e91('0x11')]=_0x2e91('0x69');break;case _0x2e91('0x6a'):_0x55943f['childModel']=_0x2e91('0x6b');break;case _0x2e91('0x6c'):_0x55943f[_0x2e91('0x11')]='Schedule';break;case'sounds':_0x55943f[_0x2e91('0x11')]=_0x2e91('0x6d');break;case _0x2e91('0x6e'):_0x55943f[_0x2e91('0x11')]='Tag';break;case _0x2e91('0x6f'):_0x55943f[_0x2e91('0x11')]=_0x2e91('0x70');break;case _0x2e91('0x71'):_0x55943f[_0x2e91('0x11')]=_0x2e91('0x72');break;case _0x2e91('0x73'):_0x55943f[_0x2e91('0x11')]='Trunk';break;case _0x2e91('0x74'):_0x55943f[_0x2e91('0x11')]=_0x2e91('0x75');break;case _0x2e91('0x76'):_0x55943f[_0x2e91('0x11')]=_0x2e91('0x77');break;case _0x2e91('0x78'):_0x55943f[_0x2e91('0x11')]='AnalyticExtractedReport';_0x55943f['parentSections']=[{'name':_0x2e91('0x79'),'field':'id','foreignKey':_0x2e91('0x7a')}];break;case _0x2e91('0x7b'):_0x55943f[_0x2e91('0x11')]=_0x2e91('0x7c');break;}return _0x55943f;}function _0x57e300(_0x3cec02,_0x307a59){var _0xfcb222=_0x3cec02[_0x2e91('0x7d')](0x0)[_0x2e91('0x7e')]()+_0x3cec02['slice'](0x1);var _0x2fdd9c={'type':_0x57eb1e[_0x2e91('0x7f')][_0x2e91('0x80')][_0x2e91('0x81')],'raw':!![]};return new Promise(function(_0xb471fd,_0x59fb45){var _0x280283=squel[_0x2e91('0x82')]()['field']('ui.'+_0xfcb222+_0x2e91('0x83'),'id')[_0x2e91('0x8')](_0x2e91('0x84'))[_0x2e91('0x85')]('user_has_'+_0x3cec02+'_interactions','ui')[_0x2e91('0x86')](_0x2e91('0x87'),_0x307a59['id']);return _0x57eb1e[_0x2e91('0x88')]['query'](_0x280283[_0x2e91('0x89')](),_0x2fdd9c)[_0x2e91('0x5')](function(_0x4e12a0){_0x307a59[_0xfcb222+_0x2e91('0x8a')]=_0x4e12a0;_0xb471fd(_0x4e12a0);})['catch'](function(_0x322128){_0x59fb45(_0x322128);});});}return _0x3a61aa['define'](_0x2e91('0x8b'),attributes,{'tableName':_0x2e91('0x8c'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x437059){var _0x52f1c2=require('../../components/parsers/qs');var _0x3cc580={'raw':_0x437059[_0x2e91('0x8d')][_0x2e91('0x8e')],'where':{}};var _0x4d4059={};var _0x229174={'count':0x0,'rows':[]};var _0x2a3b22=_0x437059[_0x2e91('0x8d')][_0x2e91('0x8f')];var _0x8a5ea1=_0x437059[_0x2e91('0x8d')][_0x2e91('0x90')]||![];var _0x2b0458=_0x520455(_0x2a3b22,_0x8a5ea1);if(!_0x2b0458['childModel'])throw new Error(_0x2e91('0x91')+_0x2a3b22+'\x27');var _0xcecc35=[{'name':_0x2a3b22}];if(!_['isEmpty'](_0x2b0458[_0x2e91('0x13')]))_0xcecc35=_0x2b0458[_0x2e91('0x13')];var _0x1e5853=[];for(var _0x13c317=0x0;_0x13c317<_0xcecc35[_0x2e91('0x92')];_0x13c317++){_0x1e5853[_0x2e91('0x93')](_0x57eb1e[_0x2e91('0x94')][_0x2e91('0x95')]({'where':{'userProfileId':_0x437059[_0x2e91('0x96')]['id'],'name':_0xcecc35[_0x13c317][_0x2e91('0x31')]},'raw':!![]}));}return Promise[_0x2e91('0x97')](_0x1e5853)[_0x2e91('0x5')](function(_0x1b04aa){var _0x29d748=_[_0x2e91('0x3')](_0x1b04aa,function(_0x151709){return _0x151709?_0x151709:undefined;});var _0x3a5e6b=_[_0x2e91('0x3')](_0xcecc35,['ignore',!![]]);var _0x477c61=_['isEmpty'](_0x29d748)&&_[_0x2e91('0x98')](_0x3a5e6b)?null:_[_0x2e91('0x99')](_0x3a5e6b,_0x29d748);if(!_0x477c61)return null;var _0x5571e8=[];for(var _0x4ba738=0x0;_0x4ba738<_0x477c61[_0x2e91('0x92')];_0x4ba738++){var _0x115fa9=_[_0x2e91('0x95')](_0xcecc35,function(_0x375991){return _0x477c61[_0x4ba738]?_0x375991['name']===_0x477c61[_0x4ba738][_0x2e91('0x31')]:null;});if(_0x115fa9){if(_0x477c61[_0x4ba738]['ignore']){_0x5571e8[_0x2e91('0x93')](_0x49a675(_0x2b0458['childModel'],_0x477c61[_0x4ba738]));}else{if(!_0x477c61[_0x4ba738][_0x2e91('0x9a')]){_0x5571e8[_0x2e91('0x93')](_0x1c57eb(_0x115fa9,_0x477c61[_0x4ba738],_0x2b0458[_0x2e91('0x11')]));}else{if(_0x115fa9['model']){_0x5571e8[_0x2e91('0x93')](_0x360805(_0x115fa9,_0x477c61[_0x4ba738]));}}}}}return Promise[_0x2e91('0x97')](_0x5571e8);})[_0x2e91('0x5')](function(_0x2f942e){var _0xa7eddb=_0x2f942e;var _0x91eb94=null;if(_0xa7eddb){_0x91eb94=_0xa7eddb[_0x2e91('0x92')]===0x1?_0xa7eddb[0x0]:null;}if(!_0x91eb94&&!_0xa7eddb)return _0x229174;var _0x240269=_0x57eb1e[_0x2b0458['childModel']][_0x2e91('0x9b')];_0x4d4059[_0x2e91('0x9c')]=_[_0x2e91('0x9d')](_0x240269);_0x4d4059[_0x2e91('0x8d')]=_[_0x2e91('0x9d')](_0x437059[_0x2e91('0x8d')]);_0x4d4059[_0x2e91('0x9e')]=_[_0x2e91('0x9f')](_0x4d4059[_0x2e91('0x9c')],_0x4d4059[_0x2e91('0x8d')]);_0x3cc580[_0x2e91('0xa0')]=_[_0x2e91('0x9f')](_0x4d4059[_0x2e91('0x9c')],_0x52f1c2[_0x2e91('0xa1')](_0x437059[_0x2e91('0x8d')][_0x2e91('0xa1')]));_0x3cc580[_0x2e91('0xa0')]=_0x3cc580['attributes'][_0x2e91('0x92')]?_0x3cc580['attributes']:_0x4d4059[_0x2e91('0x9c')];if(!_0x437059[_0x2e91('0x8d')][_0x2e91('0xa2')](_0x2e91('0xa3'))){_0x3cc580[_0x2e91('0xa4')]=_0x52f1c2['limit'](_0x437059[_0x2e91('0x8d')][_0x2e91('0xa4')]);_0x3cc580[_0x2e91('0xa5')]=_0x52f1c2['offset'](_0x437059['query'][_0x2e91('0xa5')]);}_0x3cc580[_0x2e91('0xa6')]=_0x52f1c2['sort'](_0x437059[_0x2e91('0x8d')][_0x2e91('0xa7')]);_0x3cc580[_0x2e91('0x86')]=_0x52f1c2['filters'](_['pick'](_0x437059[_0x2e91('0x8d')],_0x4d4059[_0x2e91('0x9e')]));if(_0x437059['query']['filter']){_0x3cc580[_0x2e91('0x86')]=_[_0x2e91('0xa8')](_0x3cc580[_0x2e91('0x86')],{'$or':_[_0x2e91('0x7')](_0x240269,function(_0x36233d){if(_0x36233d[_0x2e91('0x37')][_0x2e91('0xa9')]!==_0x2e91('0xaa')){var _0x26f621={};_0x26f621[_0x36233d[_0x2e91('0x8')]]={'$like':'%'+_0x437059[_0x2e91('0x8d')][_0x2e91('0x3')]+'%'};return _0x26f621;}})});}var _0x1cf719=[];var _0x504dcf=null;var _0x35218e={};if(_0x91eb94){_0x504dcf=_[_0x2e91('0x95')](_0xcecc35,[_0x2e91('0x31'),_0x91eb94[_0x2e91('0x31')]]);if(_0x504dcf[_0x2e91('0x8')]){_0x35218e={};if(_0x2b0458[_0x2e91('0x11')]==='AnalyticExtractedReport'){_0x35218e[_0x504dcf['foreignKey']]=_[_0x2e91('0x7')](_0x91eb94[_0x2e91('0x6')],'id');}else{_0x35218e[_0x504dcf[_0x2e91('0xab')]]=_0x91eb94[_0x2e91('0x6')];}_0x1cf719[_0x2e91('0x93')](_0x35218e);}else{_0x3cc580[_0x2e91('0x86')]['id']=_0x91eb94[_0x2e91('0x6')];}}else{for(var _0x1d6eb6=0x0;_0x1d6eb6<_0xa7eddb[_0x2e91('0x92')];_0x1d6eb6++){_0x504dcf=_[_0x2e91('0x95')](_0xcecc35,[_0x2e91('0x31'),_0xa7eddb[_0x1d6eb6]['name']]);if(_0x504dcf[_0x2e91('0x8')]){_0x35218e={};_0x35218e[_0x504dcf[_0x2e91('0xab')]]=_0xa7eddb[_0x1d6eb6][_0x2e91('0x6')];_0x1cf719[_0x2e91('0x93')](_0x35218e);}else{if(!_0x3cc580[_0x2e91('0x86')]['id'])_0x3cc580[_0x2e91('0x86')]['id']=[];_0xa7eddb[_0x1d6eb6][_0x2e91('0x6')]['forEach'](function(_0xf1272c){_0x3cc580[_0x2e91('0x86')]['id'][_0x2e91('0x93')](_0xf1272c);});}}}if(!_[_0x2e91('0x98')](_0x1cf719)){_0x3cc580[_0x2e91('0x86')]=_['merge'](_0x3cc580[_0x2e91('0x86')],{'$and':{'$or':_0x1cf719}});}_0x3cc580=_[_0x2e91('0xa8')]({},_0x3cc580,_0x437059[_0x2e91('0xac')]);if(_0x91eb94&&!_0x91eb94['autoAssociation']&&_0x2b0458[_0x2e91('0x11')]==='AnalyticExtractedReport'){if(_0x437059[_0x2e91('0x8d')][_0x2e91('0xad')]){_0x3cc580[_0x2e91('0xae')]=[{'all':!![]}];}return _0x57eb1e[_0x2b0458[_0x2e91('0x11')]][_0x2e91('0x4')](_0x3cc580)[_0x2e91('0x5')](function(_0x50a00e){var _0x22effb=[];_0x50a00e['forEach'](function(_0x5ed0ca){var _0x4335e3;switch(_0x5ed0ca[_0x2e91('0xaf')]){case _0x2e91('0xb0'):_0x4335e3=_['find'](_0x91eb94['associatedResources'],function(_0x1ba577){return _0x1ba577['id']===_0x5ed0ca[_0x2e91('0x7a')]&&_0x1ba577[_0x2e91('0x37')]===_0x2e91('0xb1');});break;case'custom':_0x4335e3=_['find'](_0x91eb94['associatedResources'],function(_0x33bd6c){return _0x33bd6c['id']===_0x5ed0ca[_0x2e91('0x7a')]&&_0x33bd6c['type']===_0x2e91('0xb2');});break;}if(_0x4335e3)_0x22effb['push'](_0x5ed0ca);});_0x229174[_0x2e91('0xb3')]=_0x22effb[_0x2e91('0x92')];_0x229174['rows']=_0x22effb;return _0x229174;});}else{if(!_['isEmpty'](_0x437059[_0x2e91('0x8d')][_0x2e91('0xb4')])){_0x3cc580['where']['id']=_0x3cc580[_0x2e91('0x86')]['id']?_[_0x2e91('0x9f')](_0x3cc580[_0x2e91('0x86')]['id'],_0x437059[_0x2e91('0x8d')][_0x2e91('0xb4')]):_0x437059['query'][_0x2e91('0xb4')];if(_0x437059[_0x2e91('0x8d')]['customSorting']){_0x3cc580['order']=_0x437059[_0x2e91('0x8d')][_0x2e91('0xb5')];}}if(_0x437059[_0x2e91('0x8d')][_0x2e91('0xb6')]){_0x3cc580[_0x2e91('0x86')]=_[_0x2e91('0xa8')](_0x3cc580['where'],{'$and':_0x437059[_0x2e91('0x8d')][_0x2e91('0xb6')]});}return _0x57eb1e[_0x2b0458[_0x2e91('0x11')]][_0x2e91('0xb3')]({'where':_0x3cc580[_0x2e91('0x86')]})[_0x2e91('0x5')](function(_0x4a557){_0x229174[_0x2e91('0xb3')]=_0x4a557;if(_0x437059['query'][_0x2e91('0xad')]){if(_0x2b0458[_0x2e91('0x11')]==='CmContact'){_0x3cc580[_0x2e91('0xae')]=[{'model':_0x57eb1e[_0x2e91('0xb7')],'as':'Tags','attributes':['id',_0x2e91('0x31'),_0x2e91('0xb8')],'required':_0x437059[_0x2e91('0x8d')]['tag']?!![]:![]},{'model':_0x57eb1e['Tag'],'as':_0x2e91('0xb9'),'attributes':['id',_0x2e91('0x31'),'color'],'through':_0x437059[_0x2e91('0x8d')][_0x2e91('0xba')]?{'attributes':[],'where':{'TagId':_0x437059[_0x2e91('0x8d')]['tag']||undefined}}:{},'required':_0x437059['query']['tag']?!![]:![]}];}else{_0x3cc580[_0x2e91('0xae')]=[{'all':!![]}];}}return _0x57eb1e[_0x2b0458['childModel']][_0x2e91('0x4')](_0x3cc580);})['then'](function(_0x44cf2f){_0x229174[_0x2e91('0xbb')]=_0x44cf2f;if(_0x2a3b22===_0x2e91('0x2c')&&_0x437059[_0x2e91('0x8d')]['openTabs']===_0x2e91('0xbc')){var _0xcde726=[];for(var _0x34384d=0x0;_0x34384d<_0x229174['rows'][_0x2e91('0x92')];_0x34384d++){_0xcde726[_0x2e91('0x93')](_0x57e300(_0x2e91('0xbd'),_0x229174['rows'][_0x34384d]['dataValues']));_0xcde726['push'](_0x57e300(_0x2e91('0xbe'),_0x229174[_0x2e91('0xbb')][_0x34384d][_0x2e91('0xbf')]));_0xcde726[_0x2e91('0x93')](_0x57e300(_0x2e91('0xc0'),_0x229174[_0x2e91('0xbb')][_0x34384d][_0x2e91('0xbf')]));_0xcde726[_0x2e91('0x93')](_0x57e300(_0x2e91('0xc1'),_0x229174[_0x2e91('0xbb')][_0x34384d]['dataValues']));_0xcde726['push'](_0x57e300(_0x2e91('0xc2'),_0x229174[_0x2e91('0xbb')][_0x34384d]['dataValues']));_0xcde726['push'](_0x57e300(_0x2e91('0xc3'),_0x229174[_0x2e91('0xbb')][_0x34384d]['dataValues']));}return Promise[_0x2e91('0x97')](_0xcde726)[_0x2e91('0x5')](function(){return _0x229174;});}return _0x229174;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index 0e6ce77..2da6508 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 _0x6faf=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','http','redis','defaults','socket.io-emitter','./userProfile.socket','then','info','UserProfile,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','UserProfile,\x20%s,\x20%s','message','result','catch','util'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0x6faf,0xf9));var _0xf6fa=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x6faf[_0xa464c9];return _0x3d73c4;};'use strict';var _=require('lodash');var util=require(_0xf6fa('0x0'));var moment=require(_0xf6fa('0x1'));var BPromise=require(_0xf6fa('0x2'));var rs=require(_0xf6fa('0x3'));var fs=require('fs');var Redis=require(_0xf6fa('0x4'));var db=require(_0xf6fa('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xf6fa('0x6'))('rpc');var config=require(_0xf6fa('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xf6fa('0x8')][_0xf6fa('0x9')]({'port':0x232a});config[_0xf6fa('0xa')]=_[_0xf6fa('0xb')](config[_0xf6fa('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xf6fa('0xc'))(new Redis(config[_0xf6fa('0xa')]));require(_0xf6fa('0xd'))['register'](socket);function respondWithRpcPromise(_0x4a1d49,_0x3148bd,_0x535fbc){return new BPromise(function(_0x196e0d,_0x336a07){return client['request'](_0x4a1d49,_0x535fbc)[_0xf6fa('0xe')](function(_0x4a1e5e){logger[_0xf6fa('0xf')]('UserProfile,\x20%s,\x20%s',_0x3148bd,'request\x20sent');logger['debug'](_0xf6fa('0x10'),_0x3148bd,_0xf6fa('0x11'),JSON[_0xf6fa('0x12')](_0x4a1e5e));if(_0x4a1e5e[_0xf6fa('0x13')]){if(_0x4a1e5e[_0xf6fa('0x13')][_0xf6fa('0x14')]===0x1f4){logger[_0xf6fa('0x13')](_0xf6fa('0x15'),_0x3148bd,_0x4a1e5e[_0xf6fa('0x13')][_0xf6fa('0x16')]);return _0x336a07(_0x4a1e5e[_0xf6fa('0x13')]['message']);}logger[_0xf6fa('0x13')](_0xf6fa('0x15'),_0x3148bd,_0x4a1e5e['error'][_0xf6fa('0x16')]);return _0x196e0d(_0x4a1e5e[_0xf6fa('0x13')][_0xf6fa('0x16')]);}else{logger['info'](_0xf6fa('0x15'),_0x3148bd,_0xf6fa('0x11'));_0x196e0d(_0x4a1e5e[_0xf6fa('0x17')][_0xf6fa('0x16')]);}})[_0xf6fa('0x18')](function(_0x553daa){logger[_0xf6fa('0x13')]('UserProfile,\x20%s,\x20%s',_0x3148bd,_0x553daa);_0x336a07(_0x553daa);});});} \ No newline at end of file +var _0xfd2e=['info','UserProfile,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','catch','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','socket.io-emitter','./userProfile.socket','register','request','then'];(function(_0x56482c,_0x16118d){var _0x5aae7a=function(_0x52512f){while(--_0x52512f){_0x56482c['push'](_0x56482c['shift']());}};_0x5aae7a(++_0x16118d);}(_0xfd2e,0x6e));var _0xefd2=function(_0x56d4c5,_0x4e3272){_0x56d4c5=_0x56d4c5-0x0;var _0x2ee02a=_0xfd2e[_0x56d4c5];return _0x2ee02a;};'use strict';var _=require(_0xefd2('0x0'));var util=require('util');var moment=require(_0xefd2('0x1'));var BPromise=require('bluebird');var rs=require(_0xefd2('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xefd2('0x3'))['db'];var utils=require(_0xefd2('0x4'));var logger=require(_0xefd2('0x5'))(_0xefd2('0x6'));var config=require(_0xefd2('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xefd2('0x8')]({'port':0x232a});config['redis']=_['defaults'](config[_0xefd2('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0xefd2('0xa'))(new Redis(config[_0xefd2('0x9')]));require(_0xefd2('0xb'))[_0xefd2('0xc')](socket);function respondWithRpcPromise(_0xa787ba,_0x2d7d0d,_0x602f0){return new BPromise(function(_0x490a6d,_0x2d8eff){return client[_0xefd2('0xd')](_0xa787ba,_0x602f0)[_0xefd2('0xe')](function(_0x14de17){logger[_0xefd2('0xf')](_0xefd2('0x10'),_0x2d7d0d,_0xefd2('0x11'));logger[_0xefd2('0x12')]('UserProfile,\x20%s,\x20%s,\x20%s',_0x2d7d0d,'request\x20sent',JSON[_0xefd2('0x13')](_0x14de17));if(_0x14de17['error']){if(_0x14de17['error'][_0xefd2('0x14')]===0x1f4){logger[_0xefd2('0x15')](_0xefd2('0x10'),_0x2d7d0d,_0x14de17[_0xefd2('0x15')][_0xefd2('0x16')]);return _0x2d8eff(_0x14de17['error'][_0xefd2('0x16')]);}logger[_0xefd2('0x15')](_0xefd2('0x10'),_0x2d7d0d,_0x14de17[_0xefd2('0x15')][_0xefd2('0x16')]);return _0x490a6d(_0x14de17[_0xefd2('0x15')]['message']);}else{logger['info'](_0xefd2('0x10'),_0x2d7d0d,_0xefd2('0x11'));_0x490a6d(_0x14de17[_0xefd2('0x17')][_0xefd2('0x16')]);}})[_0xefd2('0x18')](function(_0x5080a8){logger[_0xefd2('0x15')](_0xefd2('0x10'),_0x2d7d0d,_0x5080a8);_0x2d8eff(_0x5080a8);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index d3782df..aa9311e 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 _0x0782=['./userProfile.events','save','remove','emit','register','length'];(function(_0x2b91c5,_0x3b6db5){var _0xbd5531=function(_0x54783d){while(--_0x54783d){_0x2b91c5['push'](_0x2b91c5['shift']());}};_0xbd5531(++_0x3b6db5);}(_0x0782,0xfc));var _0x2078=function(_0x158f01,_0x12af3e){_0x158f01=_0x158f01-0x0;var _0x5ef74e=_0x0782[_0x158f01];return _0x5ef74e;};'use strict';var UserProfileEvents=require(_0x2078('0x0'));var events=[_0x2078('0x1'),_0x2078('0x2'),'update'];function createListener(_0x58d3c2,_0x4e219a){return function(_0xbdd47f){_0x4e219a[_0x2078('0x3')](_0x58d3c2,_0xbdd47f);};}function removeListener(_0x279610,_0x2944d4){return function(){UserProfileEvents['removeListener'](_0x279610,_0x2944d4);};}exports[_0x2078('0x4')]=function(_0x34e8fd){for(var _0x1eac13=0x0,_0xba6bb5=events[_0x2078('0x5')];_0x1eac13<_0xba6bb5;_0x1eac13++){var _0x28c6c8=events[_0x1eac13];var _0x3848d3=createListener('userProfile:'+_0x28c6c8,_0x34e8fd);UserProfileEvents['on'](_0x28c6c8,_0x3848d3);}}; \ No newline at end of file +var _0xabc4=['removeListener','register','length','./userProfile.events','save','remove','update','emit'];(function(_0x210cb5,_0x5c2003){var _0x4a37d8=function(_0x4e5fb8){while(--_0x4e5fb8){_0x210cb5['push'](_0x210cb5['shift']());}};_0x4a37d8(++_0x5c2003);}(_0xabc4,0x1d3));var _0x4abc=function(_0x1e0d60,_0x503460){_0x1e0d60=_0x1e0d60-0x0;var _0x5b9564=_0xabc4[_0x1e0d60];return _0x5b9564;};'use strict';var UserProfileEvents=require(_0x4abc('0x0'));var events=[_0x4abc('0x1'),_0x4abc('0x2'),_0x4abc('0x3')];function createListener(_0x20fea4,_0x5e8882){return function(_0x2b8a86){_0x5e8882[_0x4abc('0x4')](_0x20fea4,_0x2b8a86);};}function removeListener(_0x5ab588,_0x153d0c){return function(){UserProfileEvents[_0x4abc('0x5')](_0x5ab588,_0x153d0c);};}exports[_0x4abc('0x6')]=function(_0x211af0){for(var _0x2914b7=0x0,_0x7b808d=events[_0x4abc('0x7')];_0x2914b7<_0x7b808d;_0x2914b7++){var _0x3dcc70=events[_0x2914b7];var _0x160dfc=createListener('userProfile:'+_0x3dcc70,_0x211af0);UserProfileEvents['on'](_0x3dcc70,_0x160dfc);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index 6b41ca0..845e0d0 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 _0x22b1=['Router','fs-extra','../../components/auth/service','../../config/environment','./userProfileResource.controller','isAuthenticated','get','/describe','describe','show','create','put','delete','/:id','util','path','express'];(function(_0x1df210,_0x3abe68){var _0x4a5027=function(_0x40efc3){while(--_0x40efc3){_0x1df210['push'](_0x1df210['shift']());}};_0x4a5027(++_0x3abe68);}(_0x22b1,0xc9));var _0x122b=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x22b1[_0x432682];return _0x463d05;};'use strict';var multer=require('multer');var util=require(_0x122b('0x0'));var path=require(_0x122b('0x1'));var timeout=require('connect-timeout');var express=require(_0x122b('0x2'));var router=express[_0x122b('0x3')]();var fs_extra=require(_0x122b('0x4'));var auth=require(_0x122b('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x122b('0x6'));var controller=require(_0x122b('0x7'));router['get']('/',auth[_0x122b('0x8')](),controller['index']);router[_0x122b('0x9')](_0x122b('0xa'),auth[_0x122b('0x8')](),controller[_0x122b('0xb')]);router[_0x122b('0x9')]('/:id',auth[_0x122b('0x8')](),controller[_0x122b('0xc')]);router['post']('/',auth[_0x122b('0x8')](),controller[_0x122b('0xd')]);router[_0x122b('0xe')]('/:id',auth[_0x122b('0x8')](),controller['update']);router[_0x122b('0xf')](_0x122b('0x10'),auth[_0x122b('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x2b7b=['path','connect-timeout','express','Router','fs-extra','../../config/environment','./userProfileResource.controller','get','isAuthenticated','/describe','/:id','show','post','create','update','delete','destroy','exports','multer','util'];(function(_0x2a1873,_0x4a3702){var _0x4520f0=function(_0x442b87){while(--_0x442b87){_0x2a1873['push'](_0x2a1873['shift']());}};_0x4520f0(++_0x4a3702);}(_0x2b7b,0x13e));var _0xb2b7=function(_0x1caf6a,_0x26a5bf){_0x1caf6a=_0x1caf6a-0x0;var _0x1bf493=_0x2b7b[_0x1caf6a];return _0x1bf493;};'use strict';var multer=require(_0xb2b7('0x0'));var util=require(_0xb2b7('0x1'));var path=require(_0xb2b7('0x2'));var timeout=require(_0xb2b7('0x3'));var express=require(_0xb2b7('0x4'));var router=express[_0xb2b7('0x5')]();var fs_extra=require(_0xb2b7('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xb2b7('0x7'));var controller=require(_0xb2b7('0x8'));router[_0xb2b7('0x9')]('/',auth[_0xb2b7('0xa')](),controller['index']);router['get'](_0xb2b7('0xb'),auth[_0xb2b7('0xa')](),controller['describe']);router[_0xb2b7('0x9')](_0xb2b7('0xc'),auth[_0xb2b7('0xa')](),controller[_0xb2b7('0xd')]);router[_0xb2b7('0xe')]('/',auth[_0xb2b7('0xa')](),controller[_0xb2b7('0xf')]);router['put'](_0xb2b7('0xc'),auth[_0xb2b7('0xa')](),controller[_0xb2b7('0x10')]);router[_0xb2b7('0x11')](_0xb2b7('0xc'),auth[_0xb2b7('0xa')](),controller[_0xb2b7('0x12')]);module[_0xb2b7('0x13')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index 3af3ebf..dd6ae4b 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 _0x74fa=['INTEGER','sequelize','exports','STRING'];(function(_0x4f617f,_0x28248f){var _0xe56a5a=function(_0x664484){while(--_0x664484){_0x4f617f['push'](_0x4f617f['shift']());}};_0xe56a5a(++_0x28248f);}(_0x74fa,0x1bd));var _0xa74f=function(_0x275971,_0x571370){_0x275971=_0x275971-0x0;var _0x4ff609=_0x74fa[_0x275971];return _0x4ff609;};'use strict';var Sequelize=require(_0xa74f('0x0'));module[_0xa74f('0x1')]={'name':{'type':Sequelize[_0xa74f('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0xa74f('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xa74f('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xb074=['STRING','exports'];(function(_0x33410f,_0x13059d){var _0x13c8e3=function(_0x5d01ab){while(--_0x5d01ab){_0x33410f['push'](_0x33410f['shift']());}};_0x13c8e3(++_0x13059d);}(_0xb074,0x81));var _0x4b07=function(_0x4c4fbe,_0x483482){_0x4c4fbe=_0x4c4fbe-0x0;var _0x39b3b9=_0xb074[_0x4c4fbe];return _0x39b3b9;};'use strict';var Sequelize=require('sequelize');module[_0x4b07('0x0')]={'name':{'type':Sequelize[_0x4b07('0x1')],'allowNull':![]},'resourceId':{'type':Sequelize['INTEGER'],'allowNull':![]},'type':{'type':Sequelize[_0x4b07('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index db70f88..429b662 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 _0x896e=['hasOwnProperty','nolimit','order','sort','where','merge','filter','UserProfileResource','includeAll','include','findAll','rows','catch','keys','length','options','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','count','limit','set','Content-Range','json','reject','save','update','destroy','then','end','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields'];(function(_0x4a53d,_0x58a95e){var _0x27410e=function(_0x38fc90){while(--_0x38fc90){_0x4a53d['push'](_0x4a53d['shift']());}};_0x27410e(++_0x58a95e);}(_0x896e,0x1e9));var _0xe896=function(_0x162127,_0x20c333){_0x162127=_0x162127-0x0;var _0x2ae871=_0x896e[_0x162127];return _0x2ae871;};'use strict';var emlformat=require(_0xe896('0x0'));var rimraf=require(_0xe896('0x1'));var zipdir=require(_0xe896('0x2'));var jsonpatch=require(_0xe896('0x3'));var rp=require(_0xe896('0x4'));var moment=require(_0xe896('0x5'));var BPromise=require(_0xe896('0x6'));var Mustache=require(_0xe896('0x7'));var util=require(_0xe896('0x8'));var path=require(_0xe896('0x9'));var sox=require(_0xe896('0xa'));var csv=require(_0xe896('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe896('0xc'));var _=require(_0xe896('0xd'));var squel=require(_0xe896('0xe'));var crypto=require(_0xe896('0xf'));var jsforce=require(_0xe896('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xe896('0xb'));var querystring=require(_0xe896('0x11'));var Papa=require(_0xe896('0x12'));var Redis=require('ioredis');var authService=require(_0xe896('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xe896('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe896('0x15'))(_0xe896('0x16'));var utils=require(_0xe896('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xe896('0x18'));var db=require(_0xe896('0x19'))['db'];function respondWithStatusCode(_0x3e8ac9,_0x580aac){_0x580aac=_0x580aac||0xcc;return function(_0x2aa522){if(_0x2aa522){return _0x3e8ac9[_0xe896('0x1a')](_0x580aac);}return _0x3e8ac9[_0xe896('0x1b')](_0x580aac)['end']();};}function respondWithResult(_0x2d0e46,_0x7dcf8a){_0x7dcf8a=_0x7dcf8a||0xc8;return function(_0x1e7ef8){if(_0x1e7ef8){return _0x2d0e46['status'](_0x7dcf8a)['json'](_0x1e7ef8);}};}function respondWithFilteredResult(_0x446ce2,_0x25606b){return function(_0x51e7b7){if(_0x51e7b7){var _0x5e78d6=typeof _0x25606b[_0xe896('0x1c')]===_0xe896('0x1d')&&typeof _0x25606b['limit']===_0xe896('0x1d');var _0x4e062a=_0x51e7b7[_0xe896('0x1e')];var _0x32f86d=_0x5e78d6?0x0:_0x25606b[_0xe896('0x1c')];var _0x5dc89d=_0x5e78d6?_0x51e7b7[_0xe896('0x1e')]:_0x25606b[_0xe896('0x1c')]+_0x25606b[_0xe896('0x1f')];var _0xbebbe1;if(_0x5dc89d>=_0x4e062a){_0x5dc89d=_0x4e062a;_0xbebbe1=0xc8;}else{_0xbebbe1=0xce;}_0x446ce2[_0xe896('0x1b')](_0xbebbe1);return _0x446ce2[_0xe896('0x20')](_0xe896('0x21'),_0x32f86d+'-'+_0x5dc89d+'/'+_0x4e062a)[_0xe896('0x22')](_0x51e7b7);}return null;};}function patchUpdates(_0x49547b){return function(_0x180d46){try{jsonpatch['apply'](_0x180d46,_0x49547b,!![]);}catch(_0x5d2c8d){return BPromise[_0xe896('0x23')](_0x5d2c8d);}return _0x180d46[_0xe896('0x24')]();};}function saveUpdates(_0x40502b,_0xeeec7c){return function(_0x498469){if(_0x498469){return _0x498469[_0xe896('0x25')](_0x40502b)['then'](function(_0x5001f7){return _0x5001f7;});}return null;};}function removeEntity(_0x45dd49,_0x41e689){return function(_0x1e952a){if(_0x1e952a){return _0x1e952a[_0xe896('0x26')]()[_0xe896('0x27')](function(){_0x45dd49[_0xe896('0x1b')](0xcc)[_0xe896('0x28')]();});}};}function handleEntityNotFound(_0x4b71cc,_0x390128){return function(_0x163a75){if(!_0x163a75){_0x4b71cc[_0xe896('0x1a')](0x194);}return _0x163a75;};}function handleError(_0x569d5f,_0x26635e){_0x26635e=_0x26635e||0x1f4;return function(_0xd50fe2){logger[_0xe896('0x29')](_0xd50fe2[_0xe896('0x2a')]);if(_0xd50fe2[_0xe896('0x2b')]){delete _0xd50fe2[_0xe896('0x2b')];}_0x569d5f['status'](_0x26635e)[_0xe896('0x2c')](_0xd50fe2);};}exports[_0xe896('0x2d')]=function(_0x201653,_0xbfb15b){var _0xace03f={},_0x5e0d9b={},_0x47c268={'count':0x0,'rows':[]};var _0x5c7dae=_['map'](db['UserProfileResource'][_0xe896('0x2e')],function(_0x29a18e){return{'name':_0x29a18e[_0xe896('0x2f')],'type':_0x29a18e[_0xe896('0x30')][_0xe896('0x31')]};});_0x5e0d9b[_0xe896('0x32')]=_[_0xe896('0x33')](_0x5c7dae,_0xe896('0x2b'));_0x5e0d9b['query']=_['keys'](_0x201653[_0xe896('0x34')]);_0x5e0d9b[_0xe896('0x35')]=_[_0xe896('0x36')](_0x5e0d9b[_0xe896('0x32')],_0x5e0d9b['query']);_0xace03f[_0xe896('0x37')]=_['intersection'](_0x5e0d9b['model'],qs[_0xe896('0x38')](_0x201653[_0xe896('0x34')][_0xe896('0x38')]));_0xace03f['attributes']=_0xace03f['attributes']['length']?_0xace03f[_0xe896('0x37')]:_0x5e0d9b[_0xe896('0x32')];if(!_0x201653[_0xe896('0x34')][_0xe896('0x39')](_0xe896('0x3a'))){_0xace03f['limit']=qs[_0xe896('0x1f')](_0x201653[_0xe896('0x34')][_0xe896('0x1f')]);_0xace03f[_0xe896('0x1c')]=qs[_0xe896('0x1c')](_0x201653[_0xe896('0x34')][_0xe896('0x1c')]);}_0xace03f[_0xe896('0x3b')]=qs['sort'](_0x201653[_0xe896('0x34')][_0xe896('0x3c')]);_0xace03f['where']=qs[_0xe896('0x35')](_['pick'](_0x201653[_0xe896('0x34')],_0x5e0d9b['filters']),_0x5c7dae);if(_0x201653[_0xe896('0x34')]['filter']){_0xace03f[_0xe896('0x3d')]=_[_0xe896('0x3e')](_0xace03f[_0xe896('0x3d')],{'$or':_[_0xe896('0x33')](_0x5c7dae,function(_0xeb9bbf){if(_0xeb9bbf['type']!=='VIRTUAL'){var _0x203aea={};_0x203aea[_0xeb9bbf[_0xe896('0x2b')]]={'$like':'%'+_0x201653[_0xe896('0x34')][_0xe896('0x3f')]+'%'};return _0x203aea;}})});}_0xace03f=_[_0xe896('0x3e')]({},_0xace03f,_0x201653['options']);var _0x5b8131={'where':_0xace03f[_0xe896('0x3d')]};return db[_0xe896('0x40')]['count'](_0x5b8131)['then'](function(_0x19d2fd){_0x47c268[_0xe896('0x1e')]=_0x19d2fd;if(_0x201653[_0xe896('0x34')][_0xe896('0x41')]){_0xace03f[_0xe896('0x42')]=[{'all':!![]}];}return db[_0xe896('0x40')][_0xe896('0x43')](_0xace03f);})[_0xe896('0x27')](function(_0x372c71){_0x47c268[_0xe896('0x44')]=_0x372c71;return _0x47c268;})[_0xe896('0x27')](respondWithFilteredResult(_0xbfb15b,_0xace03f))[_0xe896('0x45')](handleError(_0xbfb15b,null));};exports['show']=function(_0x1e5434,_0x143ad4){var _0x59b97f={'raw':![],'where':{'id':_0x1e5434['params']['id']}},_0x57366b={};_0x57366b[_0xe896('0x32')]=_[_0xe896('0x46')](db[_0xe896('0x40')]['rawAttributes']);_0x57366b[_0xe896('0x34')]=_[_0xe896('0x46')](_0x1e5434['query']);_0x57366b['filters']=_['intersection'](_0x57366b[_0xe896('0x32')],_0x57366b[_0xe896('0x34')]);_0x59b97f[_0xe896('0x37')]=_[_0xe896('0x36')](_0x57366b[_0xe896('0x32')],qs[_0xe896('0x38')](_0x1e5434['query'][_0xe896('0x38')]));_0x59b97f[_0xe896('0x37')]=_0x59b97f['attributes'][_0xe896('0x47')]?_0x59b97f[_0xe896('0x37')]:_0x57366b[_0xe896('0x32')];if(_0x1e5434[_0xe896('0x34')]['includeAll']){_0x59b97f[_0xe896('0x42')]=[{'all':!![]}];}_0x59b97f=_[_0xe896('0x3e')]({},_0x59b97f,_0x1e5434[_0xe896('0x48')]);return db[_0xe896('0x40')][_0xe896('0x49')](_0x59b97f)[_0xe896('0x27')](handleEntityNotFound(_0x143ad4,null))['then'](respondWithResult(_0x143ad4,null))[_0xe896('0x45')](handleError(_0x143ad4,null));};exports['create']=function(_0x234a22,_0x1c6ae1){return db[_0xe896('0x40')][_0xe896('0x4a')](_0x234a22[_0xe896('0x4b')],{})[_0xe896('0x27')](respondWithResult(_0x1c6ae1,0xc9))['catch'](handleError(_0x1c6ae1,null));};exports[_0xe896('0x25')]=function(_0x206ad3,_0x4818cd){if(_0x206ad3[_0xe896('0x4b')]['id']){delete _0x206ad3[_0xe896('0x4b')]['id'];}return db['UserProfileResource'][_0xe896('0x49')]({'where':{'id':_0x206ad3['params']['id']}})[_0xe896('0x27')](handleEntityNotFound(_0x4818cd,null))[_0xe896('0x27')](saveUpdates(_0x206ad3[_0xe896('0x4b')],null))[_0xe896('0x27')](respondWithResult(_0x4818cd,null))[_0xe896('0x45')](handleError(_0x4818cd,null));};exports['destroy']=function(_0x1fa3fd,_0x819c8a){return db[_0xe896('0x40')]['find']({'where':{'id':_0x1fa3fd[_0xe896('0x4c')]['id']}})['then'](handleEntityNotFound(_0x819c8a,null))['then'](removeEntity(_0x819c8a,null))[_0xe896('0x45')](handleError(_0x819c8a,null));};exports[_0xe896('0x4d')]=function(_0x57aed3,_0x343adb){return db[_0xe896('0x40')]['describe']()['then'](respondWithResult(_0x343adb,null))[_0xe896('0x45')](handleError(_0x343adb,null));}; \ No newline at end of file +var _0xba34=['../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','error','stack','name','send','map','UserProfileResource','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','find','body','params','describe','eml-format','rimraf','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/parsers/advancedSearch','../../config/license/hardware','api'];(function(_0x28509b,_0x5831ff){var _0x1e0b6=function(_0x37d8a2){while(--_0x37d8a2){_0x28509b['push'](_0x28509b['shift']());}};_0x1e0b6(++_0x5831ff);}(_0xba34,0x119));var _0x4ba3=function(_0x5969c7,_0x3dc8d4){_0x5969c7=_0x5969c7-0x0;var _0x4a8239=_0xba34[_0x5969c7];return _0x4a8239;};'use strict';var emlformat=require(_0x4ba3('0x0'));var rimraf=require(_0x4ba3('0x1'));var zipdir=require(_0x4ba3('0x2'));var jsonpatch=require(_0x4ba3('0x3'));var rp=require(_0x4ba3('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x4ba3('0x5'));var path=require(_0x4ba3('0x6'));var sox=require(_0x4ba3('0x7'));var csv=require(_0x4ba3('0x8'));var ejs=require(_0x4ba3('0x9'));var fs=require('fs');var fs_extra=require(_0x4ba3('0xa'));var _=require(_0x4ba3('0xb'));var squel=require('squel');var crypto=require(_0x4ba3('0xc'));var jsforce=require(_0x4ba3('0xd'));var deskjs=require(_0x4ba3('0xe'));var toCsv=require(_0x4ba3('0x8'));var querystring=require(_0x4ba3('0xf'));var Papa=require(_0x4ba3('0x10'));var Redis=require(_0x4ba3('0x11'));var authService=require(_0x4ba3('0x12'));var qs=require(_0x4ba3('0x13'));var as=require(_0x4ba3('0x14'));var hardwareService=require(_0x4ba3('0x15'));var logger=require('../../config/logger')(_0x4ba3('0x16'));var utils=require(_0x4ba3('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x4ba3('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1073d4,_0x52f55c){_0x52f55c=_0x52f55c||0xcc;return function(_0x256f02){if(_0x256f02){return _0x1073d4[_0x4ba3('0x19')](_0x52f55c);}return _0x1073d4[_0x4ba3('0x1a')](_0x52f55c)[_0x4ba3('0x1b')]();};}function respondWithResult(_0x2bc796,_0x3d2ace){_0x3d2ace=_0x3d2ace||0xc8;return function(_0x3a74f7){if(_0x3a74f7){return _0x2bc796[_0x4ba3('0x1a')](_0x3d2ace)[_0x4ba3('0x1c')](_0x3a74f7);}};}function respondWithFilteredResult(_0x401366,_0x36638b){return function(_0x301359){if(_0x301359){var _0x29a9d1=typeof _0x36638b[_0x4ba3('0x1d')]===_0x4ba3('0x1e')&&typeof _0x36638b[_0x4ba3('0x1f')]==='undefined';var _0x382fd0=_0x301359[_0x4ba3('0x20')];var _0x5ff7ce=_0x29a9d1?0x0:_0x36638b[_0x4ba3('0x1d')];var _0x556290=_0x29a9d1?_0x301359[_0x4ba3('0x20')]:_0x36638b[_0x4ba3('0x1d')]+_0x36638b[_0x4ba3('0x1f')];var _0x1e2ce5;if(_0x556290>=_0x382fd0){_0x556290=_0x382fd0;_0x1e2ce5=0xc8;}else{_0x1e2ce5=0xce;}_0x401366[_0x4ba3('0x1a')](_0x1e2ce5);return _0x401366[_0x4ba3('0x21')]('Content-Range',_0x5ff7ce+'-'+_0x556290+'/'+_0x382fd0)['json'](_0x301359);}return null;};}function patchUpdates(_0x2278b0){return function(_0x579d9f){try{jsonpatch[_0x4ba3('0x22')](_0x579d9f,_0x2278b0,!![]);}catch(_0x163967){return BPromise[_0x4ba3('0x23')](_0x163967);}return _0x579d9f[_0x4ba3('0x24')]();};}function saveUpdates(_0x46f1f5,_0x278a23){return function(_0x4a0823){if(_0x4a0823){return _0x4a0823[_0x4ba3('0x25')](_0x46f1f5)[_0x4ba3('0x26')](function(_0x5c28f9){return _0x5c28f9;});}return null;};}function removeEntity(_0x28bb3d,_0x4ffe39){return function(_0x1ae4de){if(_0x1ae4de){return _0x1ae4de[_0x4ba3('0x27')]()[_0x4ba3('0x26')](function(){_0x28bb3d[_0x4ba3('0x1a')](0xcc)[_0x4ba3('0x1b')]();});}};}function handleEntityNotFound(_0xe29a49,_0x159596){return function(_0xe1f7d2){if(!_0xe1f7d2){_0xe29a49[_0x4ba3('0x19')](0x194);}return _0xe1f7d2;};}function handleError(_0x2e67a0,_0x50c729){_0x50c729=_0x50c729||0x1f4;return function(_0x252f37){logger[_0x4ba3('0x28')](_0x252f37[_0x4ba3('0x29')]);if(_0x252f37['name']){delete _0x252f37[_0x4ba3('0x2a')];}_0x2e67a0[_0x4ba3('0x1a')](_0x50c729)[_0x4ba3('0x2b')](_0x252f37);};}exports['index']=function(_0x10cae6,_0x843276){var _0x34ecb4={},_0x22394d={},_0x4a339e={'count':0x0,'rows':[]};var _0x590108=_[_0x4ba3('0x2c')](db[_0x4ba3('0x2d')][_0x4ba3('0x2e')],function(_0x19f039){return{'name':_0x19f039[_0x4ba3('0x2f')],'type':_0x19f039[_0x4ba3('0x30')]['key']};});_0x22394d[_0x4ba3('0x31')]=_[_0x4ba3('0x2c')](_0x590108,_0x4ba3('0x2a'));_0x22394d[_0x4ba3('0x32')]=_[_0x4ba3('0x33')](_0x10cae6[_0x4ba3('0x32')]);_0x22394d[_0x4ba3('0x34')]=_[_0x4ba3('0x35')](_0x22394d[_0x4ba3('0x31')],_0x22394d[_0x4ba3('0x32')]);_0x34ecb4['attributes']=_['intersection'](_0x22394d['model'],qs[_0x4ba3('0x36')](_0x10cae6[_0x4ba3('0x32')][_0x4ba3('0x36')]));_0x34ecb4[_0x4ba3('0x37')]=_0x34ecb4[_0x4ba3('0x37')][_0x4ba3('0x38')]?_0x34ecb4[_0x4ba3('0x37')]:_0x22394d[_0x4ba3('0x31')];if(!_0x10cae6[_0x4ba3('0x32')][_0x4ba3('0x39')](_0x4ba3('0x3a'))){_0x34ecb4[_0x4ba3('0x1f')]=qs['limit'](_0x10cae6[_0x4ba3('0x32')][_0x4ba3('0x1f')]);_0x34ecb4[_0x4ba3('0x1d')]=qs['offset'](_0x10cae6[_0x4ba3('0x32')]['offset']);}_0x34ecb4[_0x4ba3('0x3b')]=qs[_0x4ba3('0x3c')](_0x10cae6[_0x4ba3('0x32')][_0x4ba3('0x3c')]);_0x34ecb4[_0x4ba3('0x3d')]=qs[_0x4ba3('0x34')](_['pick'](_0x10cae6[_0x4ba3('0x32')],_0x22394d[_0x4ba3('0x34')]),_0x590108);if(_0x10cae6[_0x4ba3('0x32')]['filter']){_0x34ecb4[_0x4ba3('0x3d')]=_[_0x4ba3('0x3e')](_0x34ecb4['where'],{'$or':_[_0x4ba3('0x2c')](_0x590108,function(_0x503777){if(_0x503777['type']!==_0x4ba3('0x3f')){var _0x1acc74={};_0x1acc74[_0x503777[_0x4ba3('0x2a')]]={'$like':'%'+_0x10cae6[_0x4ba3('0x32')][_0x4ba3('0x40')]+'%'};return _0x1acc74;}})});}_0x34ecb4=_['merge']({},_0x34ecb4,_0x10cae6[_0x4ba3('0x41')]);var _0x10e4b5={'where':_0x34ecb4[_0x4ba3('0x3d')]};return db[_0x4ba3('0x2d')][_0x4ba3('0x20')](_0x10e4b5)[_0x4ba3('0x26')](function(_0x349af4){_0x4a339e[_0x4ba3('0x20')]=_0x349af4;if(_0x10cae6['query'][_0x4ba3('0x42')]){_0x34ecb4[_0x4ba3('0x43')]=[{'all':!![]}];}return db[_0x4ba3('0x2d')][_0x4ba3('0x44')](_0x34ecb4);})[_0x4ba3('0x26')](function(_0x25b2c9){_0x4a339e[_0x4ba3('0x45')]=_0x25b2c9;return _0x4a339e;})[_0x4ba3('0x26')](respondWithFilteredResult(_0x843276,_0x34ecb4))[_0x4ba3('0x46')](handleError(_0x843276,null));};exports[_0x4ba3('0x47')]=function(_0x3b9a0a,_0x1c58d2){var _0x1d031b={'raw':![],'where':{'id':_0x3b9a0a['params']['id']}},_0x28b649={};_0x28b649['model']=_['keys'](db['UserProfileResource']['rawAttributes']);_0x28b649[_0x4ba3('0x32')]=_['keys'](_0x3b9a0a[_0x4ba3('0x32')]);_0x28b649['filters']=_[_0x4ba3('0x35')](_0x28b649[_0x4ba3('0x31')],_0x28b649[_0x4ba3('0x32')]);_0x1d031b[_0x4ba3('0x37')]=_[_0x4ba3('0x35')](_0x28b649['model'],qs[_0x4ba3('0x36')](_0x3b9a0a['query'][_0x4ba3('0x36')]));_0x1d031b['attributes']=_0x1d031b[_0x4ba3('0x37')][_0x4ba3('0x38')]?_0x1d031b[_0x4ba3('0x37')]:_0x28b649[_0x4ba3('0x31')];if(_0x3b9a0a[_0x4ba3('0x32')][_0x4ba3('0x42')]){_0x1d031b[_0x4ba3('0x43')]=[{'all':!![]}];}_0x1d031b=_['merge']({},_0x1d031b,_0x3b9a0a[_0x4ba3('0x41')]);return db[_0x4ba3('0x2d')][_0x4ba3('0x48')](_0x1d031b)[_0x4ba3('0x26')](handleEntityNotFound(_0x1c58d2,null))[_0x4ba3('0x26')](respondWithResult(_0x1c58d2,null))['catch'](handleError(_0x1c58d2,null));};exports['create']=function(_0xa4bbb2,_0x1fe115){return db[_0x4ba3('0x2d')]['create'](_0xa4bbb2[_0x4ba3('0x49')],{})[_0x4ba3('0x26')](respondWithResult(_0x1fe115,0xc9))[_0x4ba3('0x46')](handleError(_0x1fe115,null));};exports['update']=function(_0x47f588,_0x34dc04){if(_0x47f588['body']['id']){delete _0x47f588[_0x4ba3('0x49')]['id'];}return db[_0x4ba3('0x2d')][_0x4ba3('0x48')]({'where':{'id':_0x47f588[_0x4ba3('0x4a')]['id']}})[_0x4ba3('0x26')](handleEntityNotFound(_0x34dc04,null))[_0x4ba3('0x26')](saveUpdates(_0x47f588['body'],null))[_0x4ba3('0x26')](respondWithResult(_0x34dc04,null))[_0x4ba3('0x46')](handleError(_0x34dc04,null));};exports['destroy']=function(_0x325475,_0x12ae6f){return db[_0x4ba3('0x2d')][_0x4ba3('0x48')]({'where':{'id':_0x325475[_0x4ba3('0x4a')]['id']}})['then'](handleEntityNotFound(_0x12ae6f,null))[_0x4ba3('0x26')](removeEntity(_0x12ae6f,null))[_0x4ba3('0x46')](handleError(_0x12ae6f,null));};exports['describe']=function(_0x43f820,_0x19d70f){return db[_0x4ba3('0x2d')][_0x4ba3('0x4b')]()[_0x4ba3('0x26')](respondWithResult(_0x19d70f,null))[_0x4ba3('0x46')](handleError(_0x19d70f,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index cf0ef33..e4b3cef 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 _0xd59c=['user_profile_has_resources','compositeIndex','resourceId','sectionId','lodash','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','exports','define','UserProfileResource'];(function(_0x169d90,_0x1e8ddf){var _0x2b501e=function(_0x569e03){while(--_0x569e03){_0x169d90['push'](_0x169d90['shift']());}};_0x2b501e(++_0x1e8ddf);}(_0xd59c,0x170));var _0xcd59=function(_0x122d62,_0x28aab2){_0x122d62=_0x122d62-0x0;var _0x50b333=_0xd59c[_0x122d62];return _0x50b333;};'use strict';var _=require(_0xcd59('0x0'));var util=require('util');var logger=require(_0xcd59('0x1'))(_0xcd59('0x2'));var moment=require(_0xcd59('0x3'));var BPromise=require('bluebird');var rp=require(_0xcd59('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcd59('0x5'));var config=require(_0xcd59('0x6'));var attributes=require('./userProfileResource.attributes');module[_0xcd59('0x7')]=function(_0x3e5786,_0x2e746f){return _0x3e5786[_0xcd59('0x8')](_0xcd59('0x9'),attributes,{'tableName':_0xcd59('0xa'),'paranoid':![],'indexes':[{'name':_0xcd59('0xb'),'fields':[_0xcd59('0xc'),_0xcd59('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3d7f=['sectionId','lodash','util','moment','bluebird','request-promise','path','../../config/environment','exports','define','UserProfileResource','user_profile_has_resources','compositeIndex','resourceId'];(function(_0xc0a3d3,_0x2c8d00){var _0x3386e8=function(_0x3f9df4){while(--_0x3f9df4){_0xc0a3d3['push'](_0xc0a3d3['shift']());}};_0x3386e8(++_0x2c8d00);}(_0x3d7f,0x10b));var _0xf3d7=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0x3d7f[_0x139a3c];return _0x2b375b;};'use strict';var _=require(_0xf3d7('0x0'));var util=require(_0xf3d7('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xf3d7('0x2'));var BPromise=require(_0xf3d7('0x3'));var rp=require(_0xf3d7('0x4'));var fs=require('fs');var path=require(_0xf3d7('0x5'));var rimraf=require('rimraf');var config=require(_0xf3d7('0x6'));var attributes=require('./userProfileResource.attributes');module[_0xf3d7('0x7')]=function(_0x454e05,_0x3a7875){return _0x454e05[_0xf3d7('0x8')](_0xf3d7('0x9'),attributes,{'tableName':_0xf3d7('0xa'),'paranoid':![],'indexes':[{'name':_0xf3d7('0xb'),'fields':[_0xf3d7('0xc'),_0xf3d7('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index acd7a15..388d40c 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 _0x9897=['info','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','error','code','message','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then'];(function(_0x17ccac,_0x1c475c){var _0x5cae93=function(_0x2b13d1){while(--_0x2b13d1){_0x17ccac['push'](_0x17ccac['shift']());}};_0x5cae93(++_0x1c475c);}(_0x9897,0xda));var _0x7989=function(_0x2ec461,_0x5f588a){_0x2ec461=_0x2ec461-0x0;var _0x28603d=_0x9897[_0x2ec461];return _0x28603d;};'use strict';var _=require(_0x7989('0x0'));var util=require(_0x7989('0x1'));var moment=require('moment');var BPromise=require(_0x7989('0x2'));var rs=require(_0x7989('0x3'));var fs=require('fs');var Redis=require(_0x7989('0x4'));var db=require(_0x7989('0x5'))['db'];var utils=require(_0x7989('0x6'));var logger=require('../../config/logger')(_0x7989('0x7'));var config=require(_0x7989('0x8'));var jayson=require(_0x7989('0x9'));var client=jayson[_0x7989('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5546be,_0xe8483d,_0x5ebfc7){return new BPromise(function(_0x6b6353,_0x15f295){return client[_0x7989('0xb')](_0x5546be,_0x5ebfc7)[_0x7989('0xc')](function(_0x59c480){logger[_0x7989('0xd')](_0x7989('0xe'),_0xe8483d,_0x7989('0xf'));logger[_0x7989('0x10')](_0x7989('0x11'),_0xe8483d,'request\x20sent',JSON['stringify'](_0x59c480));if(_0x59c480[_0x7989('0x12')]){if(_0x59c480[_0x7989('0x12')][_0x7989('0x13')]===0x1f4){logger[_0x7989('0x12')](_0x7989('0xe'),_0xe8483d,_0x59c480['error'][_0x7989('0x14')]);return _0x15f295(_0x59c480[_0x7989('0x12')][_0x7989('0x14')]);}logger[_0x7989('0x12')](_0x7989('0xe'),_0xe8483d,_0x59c480[_0x7989('0x12')][_0x7989('0x14')]);return _0x6b6353(_0x59c480[_0x7989('0x12')]['message']);}else{logger['info'](_0x7989('0xe'),_0xe8483d,_0x7989('0xf'));_0x6b6353(_0x59c480['result'][_0x7989('0x14')]);}})['catch'](function(_0x1684a4){logger[_0x7989('0x12')]('UserProfileResource,\x20%s,\x20%s',_0xe8483d,_0x1684a4);_0x15f295(_0x1684a4);});});} \ No newline at end of file +var _0x2595=['request','then','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http'];(function(_0x4fb1b8,_0x32d98d){var _0x146c71=function(_0x4bb74e){while(--_0x4bb74e){_0x4fb1b8['push'](_0x4fb1b8['shift']());}};_0x146c71(++_0x32d98d);}(_0x2595,0xbc));var _0x5259=function(_0x4491ef,_0x5153d9){_0x4491ef=_0x4491ef-0x0;var _0x3c72dc=_0x2595[_0x4491ef];return _0x3c72dc;};'use strict';var _=require('lodash');var util=require(_0x5259('0x0'));var moment=require('moment');var BPromise=require(_0x5259('0x1'));var rs=require(_0x5259('0x2'));var fs=require('fs');var Redis=require(_0x5259('0x3'));var db=require(_0x5259('0x4'))['db'];var utils=require(_0x5259('0x5'));var logger=require('../../config/logger')(_0x5259('0x6'));var config=require(_0x5259('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5259('0x8')][_0x5259('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x392bdc,_0x40bbde,_0x4fdeba){return new BPromise(function(_0xf2ed2a,_0x4685b9){return client[_0x5259('0xa')](_0x392bdc,_0x4fdeba)[_0x5259('0xb')](function(_0x20f73d){logger[_0x5259('0xc')](_0x5259('0xd'),_0x40bbde,_0x5259('0xe'));logger['debug'](_0x5259('0xf'),_0x40bbde,_0x5259('0xe'),JSON[_0x5259('0x10')](_0x20f73d));if(_0x20f73d[_0x5259('0x11')]){if(_0x20f73d[_0x5259('0x11')][_0x5259('0x12')]===0x1f4){logger[_0x5259('0x11')](_0x5259('0xd'),_0x40bbde,_0x20f73d['error'][_0x5259('0x13')]);return _0x4685b9(_0x20f73d[_0x5259('0x11')][_0x5259('0x13')]);}logger[_0x5259('0x11')]('UserProfileResource,\x20%s,\x20%s',_0x40bbde,_0x20f73d[_0x5259('0x11')][_0x5259('0x13')]);return _0xf2ed2a(_0x20f73d[_0x5259('0x11')][_0x5259('0x13')]);}else{logger[_0x5259('0xc')](_0x5259('0xd'),_0x40bbde,_0x5259('0xe'));_0xf2ed2a(_0x20f73d[_0x5259('0x14')][_0x5259('0x13')]);}})[_0x5259('0x15')](function(_0x36f812){logger[_0x5259('0x11')]('UserProfileResource,\x20%s,\x20%s',_0x40bbde,_0x36f812);_0x4685b9(_0x36f812);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 6f41f54..f7ea8da 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 _0x807e=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./userProfileSection.controller','isAuthenticated','index','get','/describe','/:id','show','post','create','update','delete'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x807e,0x1a4));var _0xe807=function(_0x1ccefb,_0x240448){_0x1ccefb=_0x1ccefb-0x0;var _0x189504=_0x807e[_0x1ccefb];return _0x189504;};'use strict';var multer=require(_0xe807('0x0'));var util=require(_0xe807('0x1'));var path=require(_0xe807('0x2'));var timeout=require(_0xe807('0x3'));var express=require(_0xe807('0x4'));var router=express[_0xe807('0x5')]();var fs_extra=require(_0xe807('0x6'));var auth=require(_0xe807('0x7'));var interaction=require(_0xe807('0x8'));var config=require('../../config/environment');var controller=require(_0xe807('0x9'));router['get']('/',auth[_0xe807('0xa')](),controller[_0xe807('0xb')]);router[_0xe807('0xc')](_0xe807('0xd'),auth[_0xe807('0xa')](),controller['describe']);router[_0xe807('0xc')](_0xe807('0xe'),auth[_0xe807('0xa')](),controller[_0xe807('0xf')]);router[_0xe807('0x10')]('/',auth[_0xe807('0xa')](),controller[_0xe807('0x11')]);router['put'](_0xe807('0xe'),auth[_0xe807('0xa')](),controller[_0xe807('0x12')]);router[_0xe807('0x13')]('/:id',auth[_0xe807('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x8385=['index','get','/describe','/:id','show','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileSection.controller','isAuthenticated'];(function(_0x5c433c,_0x4bb9bb){var _0x5e3424=function(_0x187d44){while(--_0x187d44){_0x5c433c['push'](_0x5c433c['shift']());}};_0x5e3424(++_0x4bb9bb);}(_0x8385,0x8e));var _0x5838=function(_0x404d88,_0x4b5a7f){_0x404d88=_0x404d88-0x0;var _0x387ad8=_0x8385[_0x404d88];return _0x387ad8;};'use strict';var multer=require(_0x5838('0x0'));var util=require(_0x5838('0x1'));var path=require(_0x5838('0x2'));var timeout=require(_0x5838('0x3'));var express=require(_0x5838('0x4'));var router=express[_0x5838('0x5')]();var fs_extra=require(_0x5838('0x6'));var auth=require(_0x5838('0x7'));var interaction=require(_0x5838('0x8'));var config=require(_0x5838('0x9'));var controller=require(_0x5838('0xa'));router['get']('/',auth[_0x5838('0xb')](),controller[_0x5838('0xc')]);router[_0x5838('0xd')](_0x5838('0xe'),auth[_0x5838('0xb')](),controller['describe']);router['get'](_0x5838('0xf'),auth[_0x5838('0xb')](),controller[_0x5838('0x10')]);router['post']('/',auth[_0x5838('0xb')](),controller[_0x5838('0x11')]);router['put'](_0x5838('0xf'),auth['isAuthenticated'](),controller[_0x5838('0x12')]);router[_0x5838('0x13')](_0x5838('0xf'),auth[_0x5838('0xb')](),controller[_0x5838('0x14')]);module[_0x5838('0x15')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index 754f28f..9ac4080 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 _0x5c00=['crudPermissions','split','sequelize','exports','STRING','INTEGER','BOOLEAN','setDataValue','join','getDataValue'];(function(_0x15892f,_0x5269cc){var _0x1142d7=function(_0x4e8b8a){while(--_0x4e8b8a){_0x15892f['push'](_0x15892f['shift']());}};_0x1142d7(++_0x5269cc);}(_0x5c00,0x17e));var _0x05c0=function(_0x308944,_0x1c462e){_0x308944=_0x308944-0x0;var _0x2bf805=_0x5c00[_0x308944];return _0x2bf805;};'use strict';var Sequelize=require(_0x05c0('0x0'));module[_0x05c0('0x1')]={'name':{'type':Sequelize[_0x05c0('0x2')],'allowNull':![]},'category':{'type':Sequelize['STRING'],'allowNull':![]},'sectionId':{'type':Sequelize[_0x05c0('0x3')],'allowNull':![]},'enabled':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x05c0('0x4')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x05c0('0x2')],'set':function(_0x37b644){this[_0x05c0('0x5')]('crudPermissions',_0x37b644?_0x37b644[_0x05c0('0x6')](''):[]);},'get':function(){return this[_0x05c0('0x7')](_0x05c0('0x8'))?this[_0x05c0('0x7')]('crudPermissions')[_0x05c0('0x9')](''):[];}}}; \ No newline at end of file +var _0x5b12=['split','sequelize','exports','STRING','INTEGER','BOOLEAN','setDataValue','getDataValue','crudPermissions'];(function(_0x3b128d,_0x41e0b4){var _0x5156f9=function(_0x204db1){while(--_0x204db1){_0x3b128d['push'](_0x3b128d['shift']());}};_0x5156f9(++_0x41e0b4);}(_0x5b12,0xa3));var _0x25b1=function(_0x295a99,_0x4b13ce){_0x295a99=_0x295a99-0x0;var _0x1a1fc1=_0x5b12[_0x295a99];return _0x1a1fc1;};'use strict';var Sequelize=require(_0x25b1('0x0'));module[_0x25b1('0x1')]={'name':{'type':Sequelize[_0x25b1('0x2')],'allowNull':![]},'category':{'type':Sequelize['STRING'],'allowNull':![]},'sectionId':{'type':Sequelize[_0x25b1('0x3')],'allowNull':![]},'enabled':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x25b1('0x4')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x25b1('0x2')],'set':function(_0x47995b){this[_0x25b1('0x5')]('crudPermissions',_0x47995b?_0x47995b['join'](''):[]);},'get':function(){return this[_0x25b1('0x6')]('crudPermissions')?this['getDataValue'](_0x25b1('0x7'))[_0x25b1('0x8')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index b400a67..ab640a4 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 _0xba8f=['query','keys','filters','intersection','model','fields','attributes','length','limit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','UserProfileSection','rows','catch','show','params','options','create','body','find','describe','eml-format','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','undefined','count','offset','set','Content-Range','json','reject','save','update','then','destroy','error','name','send','index','map','rawAttributes','type'];(function(_0x2e1f1d,_0x422665){var _0xe652ea=function(_0x59218f){while(--_0x59218f){_0x2e1f1d['push'](_0x2e1f1d['shift']());}};_0xe652ea(++_0x422665);}(_0xba8f,0xb0));var _0xfba8=function(_0x3869c8,_0x2ff137){_0x3869c8=_0x3869c8-0x0;var _0x4caf60=_0xba8f[_0x3869c8];return _0x4caf60;};'use strict';var emlformat=require(_0xfba8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfba8('0x1'));var jsonpatch=require(_0xfba8('0x2'));var rp=require('request-promise');var moment=require(_0xfba8('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xfba8('0x4'));var util=require(_0xfba8('0x5'));var path=require(_0xfba8('0x6'));var sox=require(_0xfba8('0x7'));var csv=require(_0xfba8('0x8'));var ejs=require(_0xfba8('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfba8('0xa'));var squel=require(_0xfba8('0xb'));var crypto=require(_0xfba8('0xc'));var jsforce=require(_0xfba8('0xd'));var deskjs=require(_0xfba8('0xe'));var toCsv=require('to-csv');var querystring=require(_0xfba8('0xf'));var Papa=require('papaparse');var Redis=require(_0xfba8('0x10'));var authService=require(_0xfba8('0x11'));var qs=require(_0xfba8('0x12'));var as=require(_0xfba8('0x13'));var hardwareService=require(_0xfba8('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0xfba8('0x15'));var config=require(_0xfba8('0x16'));var licenseUtil=require(_0xfba8('0x17'));var db=require(_0xfba8('0x18'))['db'];function respondWithStatusCode(_0x4a2930,_0x40c3a1){_0x40c3a1=_0x40c3a1||0xcc;return function(_0x382f51){if(_0x382f51){return _0x4a2930[_0xfba8('0x19')](_0x40c3a1);}return _0x4a2930['status'](_0x40c3a1)[_0xfba8('0x1a')]();};}function respondWithResult(_0xc96829,_0x2091dd){_0x2091dd=_0x2091dd||0xc8;return function(_0x55b0c5){if(_0x55b0c5){return _0xc96829[_0xfba8('0x1b')](_0x2091dd)['json'](_0x55b0c5);}};}function respondWithFilteredResult(_0x2a5f9e,_0x35bbfc){return function(_0x3cf92e){if(_0x3cf92e){var _0x87a90c=typeof _0x35bbfc['offset']==='undefined'&&typeof _0x35bbfc['limit']===_0xfba8('0x1c');var _0x212aa0=_0x3cf92e[_0xfba8('0x1d')];var _0x2d31ea=_0x87a90c?0x0:_0x35bbfc[_0xfba8('0x1e')];var _0x3f1850=_0x87a90c?_0x3cf92e['count']:_0x35bbfc[_0xfba8('0x1e')]+_0x35bbfc['limit'];var _0x1fa3b5;if(_0x3f1850>=_0x212aa0){_0x3f1850=_0x212aa0;_0x1fa3b5=0xc8;}else{_0x1fa3b5=0xce;}_0x2a5f9e[_0xfba8('0x1b')](_0x1fa3b5);return _0x2a5f9e[_0xfba8('0x1f')](_0xfba8('0x20'),_0x2d31ea+'-'+_0x3f1850+'/'+_0x212aa0)[_0xfba8('0x21')](_0x3cf92e);}return null;};}function patchUpdates(_0x4bb0bc){return function(_0xb6f07f){try{jsonpatch['apply'](_0xb6f07f,_0x4bb0bc,!![]);}catch(_0x3376f3){return BPromise[_0xfba8('0x22')](_0x3376f3);}return _0xb6f07f[_0xfba8('0x23')]();};}function saveUpdates(_0x20d73e,_0x4dff1d){return function(_0x410102){if(_0x410102){return _0x410102[_0xfba8('0x24')](_0x20d73e)[_0xfba8('0x25')](function(_0x3ba13b){return _0x3ba13b;});}return null;};}function removeEntity(_0x5158b5,_0x189e4a){return function(_0x4824aa){if(_0x4824aa){return _0x4824aa[_0xfba8('0x26')]()['then'](function(){_0x5158b5['status'](0xcc)[_0xfba8('0x1a')]();});}};}function handleEntityNotFound(_0x564da3,_0x38bb02){return function(_0x34170e){if(!_0x34170e){_0x564da3[_0xfba8('0x19')](0x194);}return _0x34170e;};}function handleError(_0x58f2df,_0x191f10){_0x191f10=_0x191f10||0x1f4;return function(_0x3de395){logger[_0xfba8('0x27')](_0x3de395['stack']);if(_0x3de395[_0xfba8('0x28')]){delete _0x3de395[_0xfba8('0x28')];}_0x58f2df[_0xfba8('0x1b')](_0x191f10)[_0xfba8('0x29')](_0x3de395);};}exports[_0xfba8('0x2a')]=function(_0x24ce3b,_0x28e53a){var _0x59c3dc={},_0x330ec3={},_0x373411={'count':0x0,'rows':[]};var _0xe8e3cc=_[_0xfba8('0x2b')](db['UserProfileSection'][_0xfba8('0x2c')],function(_0x3658f9){return{'name':_0x3658f9['fieldName'],'type':_0x3658f9[_0xfba8('0x2d')]['key']};});_0x330ec3['model']=_[_0xfba8('0x2b')](_0xe8e3cc,_0xfba8('0x28'));_0x330ec3[_0xfba8('0x2e')]=_[_0xfba8('0x2f')](_0x24ce3b[_0xfba8('0x2e')]);_0x330ec3[_0xfba8('0x30')]=_[_0xfba8('0x31')](_0x330ec3[_0xfba8('0x32')],_0x330ec3[_0xfba8('0x2e')]);_0x59c3dc['attributes']=_[_0xfba8('0x31')](_0x330ec3[_0xfba8('0x32')],qs[_0xfba8('0x33')](_0x24ce3b['query'][_0xfba8('0x33')]));_0x59c3dc['attributes']=_0x59c3dc[_0xfba8('0x34')][_0xfba8('0x35')]?_0x59c3dc[_0xfba8('0x34')]:_0x330ec3[_0xfba8('0x32')];if(!_0x24ce3b[_0xfba8('0x2e')]['hasOwnProperty']('nolimit')){_0x59c3dc[_0xfba8('0x36')]=qs['limit'](_0x24ce3b[_0xfba8('0x2e')]['limit']);_0x59c3dc['offset']=qs[_0xfba8('0x1e')](_0x24ce3b[_0xfba8('0x2e')][_0xfba8('0x1e')]);}_0x59c3dc[_0xfba8('0x37')]=qs[_0xfba8('0x38')](_0x24ce3b[_0xfba8('0x2e')]['sort']);_0x59c3dc[_0xfba8('0x39')]=qs['filters'](_[_0xfba8('0x3a')](_0x24ce3b[_0xfba8('0x2e')],_0x330ec3['filters']),_0xe8e3cc);if(_0x24ce3b[_0xfba8('0x2e')][_0xfba8('0x3b')]){_0x59c3dc[_0xfba8('0x39')]=_['merge'](_0x59c3dc[_0xfba8('0x39')],{'$or':_[_0xfba8('0x2b')](_0xe8e3cc,function(_0x14edc7){if(_0x14edc7[_0xfba8('0x2d')]!==_0xfba8('0x3c')){var _0x258ed7={};_0x258ed7[_0x14edc7[_0xfba8('0x28')]]={'$like':'%'+_0x24ce3b[_0xfba8('0x2e')][_0xfba8('0x3b')]+'%'};return _0x258ed7;}})});}_0x59c3dc=_[_0xfba8('0x3d')]({},_0x59c3dc,_0x24ce3b['options']);var _0xaadb0c={'where':_0x59c3dc[_0xfba8('0x39')]};return db['UserProfileSection'][_0xfba8('0x1d')](_0xaadb0c)[_0xfba8('0x25')](function(_0x264637){_0x373411['count']=_0x264637;if(_0x24ce3b[_0xfba8('0x2e')][_0xfba8('0x3e')]){_0x59c3dc[_0xfba8('0x3f')]=[{'all':!![]}];}return db[_0xfba8('0x40')]['findAll'](_0x59c3dc);})['then'](function(_0x3ab922){_0x373411[_0xfba8('0x41')]=_0x3ab922;return _0x373411;})['then'](respondWithFilteredResult(_0x28e53a,_0x59c3dc))[_0xfba8('0x42')](handleError(_0x28e53a,null));};exports[_0xfba8('0x43')]=function(_0x42a1f0,_0x58cc10){var _0xe2fef5={'raw':![],'where':{'id':_0x42a1f0[_0xfba8('0x44')]['id']}},_0x2e70f7={};_0x2e70f7[_0xfba8('0x32')]=_['keys'](db['UserProfileSection']['rawAttributes']);_0x2e70f7['query']=_[_0xfba8('0x2f')](_0x42a1f0[_0xfba8('0x2e')]);_0x2e70f7[_0xfba8('0x30')]=_[_0xfba8('0x31')](_0x2e70f7[_0xfba8('0x32')],_0x2e70f7[_0xfba8('0x2e')]);_0xe2fef5[_0xfba8('0x34')]=_[_0xfba8('0x31')](_0x2e70f7[_0xfba8('0x32')],qs[_0xfba8('0x33')](_0x42a1f0['query'][_0xfba8('0x33')]));_0xe2fef5[_0xfba8('0x34')]=_0xe2fef5[_0xfba8('0x34')]['length']?_0xe2fef5[_0xfba8('0x34')]:_0x2e70f7['model'];if(_0x42a1f0[_0xfba8('0x2e')][_0xfba8('0x3e')]){_0xe2fef5['include']=[{'all':!![]}];}_0xe2fef5=_[_0xfba8('0x3d')]({},_0xe2fef5,_0x42a1f0[_0xfba8('0x45')]);return db[_0xfba8('0x40')]['find'](_0xe2fef5)[_0xfba8('0x25')](handleEntityNotFound(_0x58cc10,null))[_0xfba8('0x25')](respondWithResult(_0x58cc10,null))['catch'](handleError(_0x58cc10,null));};exports[_0xfba8('0x46')]=function(_0x32853b,_0x473d98){return db[_0xfba8('0x40')][_0xfba8('0x46')](_0x32853b[_0xfba8('0x47')],{})[_0xfba8('0x25')](respondWithResult(_0x473d98,0xc9))[_0xfba8('0x42')](handleError(_0x473d98,null));};exports['update']=function(_0x30da2d,_0x33acd8){if(_0x30da2d[_0xfba8('0x47')]['id']){delete _0x30da2d['body']['id'];}return db[_0xfba8('0x40')][_0xfba8('0x48')]({'where':{'id':_0x30da2d[_0xfba8('0x44')]['id']}})[_0xfba8('0x25')](handleEntityNotFound(_0x33acd8,null))[_0xfba8('0x25')](saveUpdates(_0x30da2d['body'],null))[_0xfba8('0x25')](respondWithResult(_0x33acd8,null))[_0xfba8('0x42')](handleError(_0x33acd8,null));};exports['destroy']=function(_0x3829fe,_0x5365e9){return db[_0xfba8('0x40')]['find']({'where':{'id':_0x3829fe[_0xfba8('0x44')]['id']}})[_0xfba8('0x25')](handleEntityNotFound(_0x5365e9,null))['then'](removeEntity(_0x5365e9,null))[_0xfba8('0x42')](handleError(_0x5365e9,null));};exports[_0xfba8('0x49')]=function(_0x39332b,_0x2d637a){return db['UserProfileSection']['describe']()[_0xfba8('0x25')](respondWithResult(_0x2d637a,null))[_0xfba8('0x42')](handleError(_0x2d637a,null));}; \ No newline at end of file +var _0x3e19=['includeAll','findAll','rows','catch','show','find','create','body','params','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','undefined','limit','count','offset','status','json','apply','reject','update','then','error','name','send','map','UserProfileSection','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options'];(function(_0x46c2a8,_0x4058f9){var _0x46026a=function(_0x52c6f0){while(--_0x52c6f0){_0x46c2a8['push'](_0x46c2a8['shift']());}};_0x46026a(++_0x4058f9);}(_0x3e19,0x9c));var _0x93e1=function(_0x42c341,_0x31d467){_0x42c341=_0x42c341-0x0;var _0x43621b=_0x3e19[_0x42c341];return _0x43621b;};'use strict';var emlformat=require(_0x93e1('0x0'));var rimraf=require(_0x93e1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x93e1('0x2'));var rp=require(_0x93e1('0x3'));var moment=require(_0x93e1('0x4'));var BPromise=require(_0x93e1('0x5'));var Mustache=require(_0x93e1('0x6'));var util=require('util');var path=require(_0x93e1('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x93e1('0x8'));var fs=require('fs');var fs_extra=require(_0x93e1('0x9'));var _=require(_0x93e1('0xa'));var squel=require(_0x93e1('0xb'));var crypto=require('crypto');var jsforce=require(_0x93e1('0xc'));var deskjs=require(_0x93e1('0xd'));var toCsv=require(_0x93e1('0xe'));var querystring=require(_0x93e1('0xf'));var Papa=require(_0x93e1('0x10'));var Redis=require(_0x93e1('0x11'));var authService=require(_0x93e1('0x12'));var qs=require(_0x93e1('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x93e1('0x14'))(_0x93e1('0x15'));var utils=require('../../config/utils');var config=require(_0x93e1('0x16'));var licenseUtil=require(_0x93e1('0x17'));var db=require(_0x93e1('0x18'))['db'];function respondWithStatusCode(_0xaf658b,_0x4fd6fb){_0x4fd6fb=_0x4fd6fb||0xcc;return function(_0x52a734){if(_0x52a734){return _0xaf658b[_0x93e1('0x19')](_0x4fd6fb);}return _0xaf658b['status'](_0x4fd6fb)[_0x93e1('0x1a')]();};}function respondWithResult(_0x32e7e7,_0x1f2820){_0x1f2820=_0x1f2820||0xc8;return function(_0x23cc16){if(_0x23cc16){return _0x32e7e7['status'](_0x1f2820)['json'](_0x23cc16);}};}function respondWithFilteredResult(_0x2ea11c,_0x592e77){return function(_0x13fd81){if(_0x13fd81){var _0x2841fb=typeof _0x592e77['offset']===_0x93e1('0x1b')&&typeof _0x592e77[_0x93e1('0x1c')]==='undefined';var _0x180cb8=_0x13fd81[_0x93e1('0x1d')];var _0x51e7b6=_0x2841fb?0x0:_0x592e77[_0x93e1('0x1e')];var _0x3040cb=_0x2841fb?_0x13fd81[_0x93e1('0x1d')]:_0x592e77['offset']+_0x592e77[_0x93e1('0x1c')];var _0x3c09de;if(_0x3040cb>=_0x180cb8){_0x3040cb=_0x180cb8;_0x3c09de=0xc8;}else{_0x3c09de=0xce;}_0x2ea11c[_0x93e1('0x1f')](_0x3c09de);return _0x2ea11c['set']('Content-Range',_0x51e7b6+'-'+_0x3040cb+'/'+_0x180cb8)[_0x93e1('0x20')](_0x13fd81);}return null;};}function patchUpdates(_0x28067a){return function(_0x31368b){try{jsonpatch[_0x93e1('0x21')](_0x31368b,_0x28067a,!![]);}catch(_0xcee434){return BPromise[_0x93e1('0x22')](_0xcee434);}return _0x31368b['save']();};}function saveUpdates(_0x4b325c,_0x5b5451){return function(_0x4d175e){if(_0x4d175e){return _0x4d175e[_0x93e1('0x23')](_0x4b325c)[_0x93e1('0x24')](function(_0x1e21f2){return _0x1e21f2;});}return null;};}function removeEntity(_0x9c9b53,_0x36fe10){return function(_0x2ce14d){if(_0x2ce14d){return _0x2ce14d['destroy']()[_0x93e1('0x24')](function(){_0x9c9b53[_0x93e1('0x1f')](0xcc)[_0x93e1('0x1a')]();});}};}function handleEntityNotFound(_0x25c334,_0x431547){return function(_0x3d22d7){if(!_0x3d22d7){_0x25c334['sendStatus'](0x194);}return _0x3d22d7;};}function handleError(_0x4ca22f,_0x31eec1){_0x31eec1=_0x31eec1||0x1f4;return function(_0x366f93){logger[_0x93e1('0x25')](_0x366f93['stack']);if(_0x366f93['name']){delete _0x366f93[_0x93e1('0x26')];}_0x4ca22f[_0x93e1('0x1f')](_0x31eec1)[_0x93e1('0x27')](_0x366f93);};}exports['index']=function(_0x2cea60,_0x40ab41){var _0x3c5b74={},_0x519479={},_0x50e904={'count':0x0,'rows':[]};var _0x51e9a9=_[_0x93e1('0x28')](db[_0x93e1('0x29')]['rawAttributes'],function(_0x431b7d){return{'name':_0x431b7d[_0x93e1('0x2a')],'type':_0x431b7d[_0x93e1('0x2b')][_0x93e1('0x2c')]};});_0x519479[_0x93e1('0x2d')]=_[_0x93e1('0x28')](_0x51e9a9,_0x93e1('0x26'));_0x519479[_0x93e1('0x2e')]=_[_0x93e1('0x2f')](_0x2cea60[_0x93e1('0x2e')]);_0x519479[_0x93e1('0x30')]=_[_0x93e1('0x31')](_0x519479[_0x93e1('0x2d')],_0x519479[_0x93e1('0x2e')]);_0x3c5b74['attributes']=_[_0x93e1('0x31')](_0x519479[_0x93e1('0x2d')],qs['fields'](_0x2cea60[_0x93e1('0x2e')][_0x93e1('0x32')]));_0x3c5b74[_0x93e1('0x33')]=_0x3c5b74['attributes'][_0x93e1('0x34')]?_0x3c5b74[_0x93e1('0x33')]:_0x519479[_0x93e1('0x2d')];if(!_0x2cea60[_0x93e1('0x2e')][_0x93e1('0x35')](_0x93e1('0x36'))){_0x3c5b74[_0x93e1('0x1c')]=qs[_0x93e1('0x1c')](_0x2cea60['query']['limit']);_0x3c5b74[_0x93e1('0x1e')]=qs[_0x93e1('0x1e')](_0x2cea60['query']['offset']);}_0x3c5b74[_0x93e1('0x37')]=qs[_0x93e1('0x38')](_0x2cea60[_0x93e1('0x2e')][_0x93e1('0x38')]);_0x3c5b74[_0x93e1('0x39')]=qs['filters'](_[_0x93e1('0x3a')](_0x2cea60[_0x93e1('0x2e')],_0x519479[_0x93e1('0x30')]),_0x51e9a9);if(_0x2cea60[_0x93e1('0x2e')][_0x93e1('0x3b')]){_0x3c5b74[_0x93e1('0x39')]=_[_0x93e1('0x3c')](_0x3c5b74[_0x93e1('0x39')],{'$or':_[_0x93e1('0x28')](_0x51e9a9,function(_0x44f6d7){if(_0x44f6d7[_0x93e1('0x2b')]!==_0x93e1('0x3d')){var _0x50a2bc={};_0x50a2bc[_0x44f6d7[_0x93e1('0x26')]]={'$like':'%'+_0x2cea60[_0x93e1('0x2e')]['filter']+'%'};return _0x50a2bc;}})});}_0x3c5b74=_[_0x93e1('0x3c')]({},_0x3c5b74,_0x2cea60[_0x93e1('0x3e')]);var _0x58988={'where':_0x3c5b74['where']};return db[_0x93e1('0x29')][_0x93e1('0x1d')](_0x58988)[_0x93e1('0x24')](function(_0x4c2991){_0x50e904[_0x93e1('0x1d')]=_0x4c2991;if(_0x2cea60[_0x93e1('0x2e')][_0x93e1('0x3f')]){_0x3c5b74['include']=[{'all':!![]}];}return db[_0x93e1('0x29')][_0x93e1('0x40')](_0x3c5b74);})['then'](function(_0x203408){_0x50e904[_0x93e1('0x41')]=_0x203408;return _0x50e904;})[_0x93e1('0x24')](respondWithFilteredResult(_0x40ab41,_0x3c5b74))[_0x93e1('0x42')](handleError(_0x40ab41,null));};exports[_0x93e1('0x43')]=function(_0x4db06f,_0xdd7e37){var _0x1944f6={'raw':![],'where':{'id':_0x4db06f['params']['id']}},_0x42bf2={};_0x42bf2[_0x93e1('0x2d')]=_[_0x93e1('0x2f')](db['UserProfileSection']['rawAttributes']);_0x42bf2[_0x93e1('0x2e')]=_[_0x93e1('0x2f')](_0x4db06f[_0x93e1('0x2e')]);_0x42bf2[_0x93e1('0x30')]=_[_0x93e1('0x31')](_0x42bf2['model'],_0x42bf2['query']);_0x1944f6[_0x93e1('0x33')]=_[_0x93e1('0x31')](_0x42bf2['model'],qs['fields'](_0x4db06f[_0x93e1('0x2e')]['fields']));_0x1944f6['attributes']=_0x1944f6[_0x93e1('0x33')]['length']?_0x1944f6['attributes']:_0x42bf2['model'];if(_0x4db06f[_0x93e1('0x2e')][_0x93e1('0x3f')]){_0x1944f6['include']=[{'all':!![]}];}_0x1944f6=_[_0x93e1('0x3c')]({},_0x1944f6,_0x4db06f[_0x93e1('0x3e')]);return db['UserProfileSection'][_0x93e1('0x44')](_0x1944f6)[_0x93e1('0x24')](handleEntityNotFound(_0xdd7e37,null))['then'](respondWithResult(_0xdd7e37,null))['catch'](handleError(_0xdd7e37,null));};exports['create']=function(_0x1e64cf,_0x3892e2){return db[_0x93e1('0x29')][_0x93e1('0x45')](_0x1e64cf[_0x93e1('0x46')],{})[_0x93e1('0x24')](respondWithResult(_0x3892e2,0xc9))[_0x93e1('0x42')](handleError(_0x3892e2,null));};exports[_0x93e1('0x23')]=function(_0x237cc8,_0x22ab2b){if(_0x237cc8['body']['id']){delete _0x237cc8[_0x93e1('0x46')]['id'];}return db[_0x93e1('0x29')][_0x93e1('0x44')]({'where':{'id':_0x237cc8[_0x93e1('0x47')]['id']}})['then'](handleEntityNotFound(_0x22ab2b,null))[_0x93e1('0x24')](saveUpdates(_0x237cc8['body'],null))[_0x93e1('0x24')](respondWithResult(_0x22ab2b,null))['catch'](handleError(_0x22ab2b,null));};exports['destroy']=function(_0x1648c2,_0x21b17d){return db[_0x93e1('0x29')][_0x93e1('0x44')]({'where':{'id':_0x1648c2[_0x93e1('0x47')]['id']}})[_0x93e1('0x24')](handleEntityNotFound(_0x21b17d,null))['then'](removeEntity(_0x21b17d,null))[_0x93e1('0x42')](handleError(_0x21b17d,null));};exports[_0x93e1('0x48')]=function(_0x258e63,_0xbc9201){return db['UserProfileSection']['describe']()['then'](respondWithResult(_0xbc9201,null))[_0x93e1('0x42')](handleError(_0xbc9201,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 74c3baf..f84a910 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 _0x545e=['lodash','bluebird','request-promise','path','rimraf','./userProfileSection.attributes','exports','define','user_profile_has_sections','compositeIndex','sectionId','userProfileId'];(function(_0x80b13c,_0x3fe450){var _0x14260f=function(_0x227cfe){while(--_0x227cfe){_0x80b13c['push'](_0x80b13c['shift']());}};_0x14260f(++_0x3fe450);}(_0x545e,0xfc));var _0xe545=function(_0x5e5093,_0x36b082){_0x5e5093=_0x5e5093-0x0;var _0x3f525d=_0x545e[_0x5e5093];return _0x3f525d;};'use strict';var _=require(_0xe545('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xe545('0x1'));var rp=require(_0xe545('0x2'));var fs=require('fs');var path=require(_0xe545('0x3'));var rimraf=require(_0xe545('0x4'));var config=require('../../config/environment');var attributes=require(_0xe545('0x5'));module[_0xe545('0x6')]=function(_0x33511a,_0x3d0518){return _0x33511a[_0xe545('0x7')]('UserProfileSection',attributes,{'tableName':_0xe545('0x8'),'paranoid':![],'indexes':[{'name':_0xe545('0x9'),'fields':[_0xe545('0xa'),_0xe545('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5799=['user_profile_has_sections','compositeIndex','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','define','UserProfileSection'];(function(_0x2f8ba6,_0x470106){var _0x1c4502=function(_0x2ead7e){while(--_0x2ead7e){_0x2f8ba6['push'](_0x2f8ba6['shift']());}};_0x1c4502(++_0x470106);}(_0x5799,0x91));var _0x9579=function(_0x5082f0,_0xb299de){_0x5082f0=_0x5082f0-0x0;var _0x1a0ef7=_0x5799[_0x5082f0];return _0x1a0ef7;};'use strict';var _=require('lodash');var util=require(_0x9579('0x0'));var logger=require(_0x9579('0x1'))(_0x9579('0x2'));var moment=require('moment');var BPromise=require(_0x9579('0x3'));var rp=require(_0x9579('0x4'));var fs=require('fs');var path=require(_0x9579('0x5'));var rimraf=require('rimraf');var config=require(_0x9579('0x6'));var attributes=require('./userProfileSection.attributes');module['exports']=function(_0x1086dc,_0x382850){return _0x1086dc[_0x9579('0x7')](_0x9579('0x8'),attributes,{'tableName':_0x9579('0x9'),'paranoid':![],'indexes':[{'name':_0x9579('0xa'),'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 2805610..53f9b2d 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 _0xc3d9=['error','message','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x29f1b5,_0x19ac42){var _0x5bcfbd=function(_0x126629){while(--_0x126629){_0x29f1b5['push'](_0x29f1b5['shift']());}};_0x5bcfbd(++_0x19ac42);}(_0xc3d9,0x6e));var _0x9c3d=function(_0x363ef8,_0x4ecb1a){_0x363ef8=_0x363ef8-0x0;var _0x148822=_0xc3d9[_0x363ef8];return _0x148822;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x9c3d('0x0'));var BPromise=require('bluebird');var rs=require(_0x9c3d('0x1'));var fs=require('fs');var Redis=require(_0x9c3d('0x2'));var db=require(_0x9c3d('0x3'))['db'];var utils=require(_0x9c3d('0x4'));var logger=require(_0x9c3d('0x5'))('rpc');var config=require(_0x9c3d('0x6'));var jayson=require(_0x9c3d('0x7'));var client=jayson[_0x9c3d('0x8')][_0x9c3d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2458e8,_0x2d4f3d,_0x4d7ddc){return new BPromise(function(_0x179ec0,_0x2647c3){return client[_0x9c3d('0xa')](_0x2458e8,_0x4d7ddc)[_0x9c3d('0xb')](function(_0x46917e){logger[_0x9c3d('0xc')](_0x9c3d('0xd'),_0x2d4f3d,_0x9c3d('0xe'));logger['debug']('UserProfileSection,\x20%s,\x20%s,\x20%s',_0x2d4f3d,_0x9c3d('0xe'),JSON[_0x9c3d('0xf')](_0x46917e));if(_0x46917e[_0x9c3d('0x10')]){if(_0x46917e[_0x9c3d('0x10')]['code']===0x1f4){logger['error'](_0x9c3d('0xd'),_0x2d4f3d,_0x46917e['error']['message']);return _0x2647c3(_0x46917e[_0x9c3d('0x10')]['message']);}logger[_0x9c3d('0x10')]('UserProfileSection,\x20%s,\x20%s',_0x2d4f3d,_0x46917e[_0x9c3d('0x10')][_0x9c3d('0x11')]);return _0x179ec0(_0x46917e['error'][_0x9c3d('0x11')]);}else{logger[_0x9c3d('0xc')](_0x9c3d('0xd'),_0x2d4f3d,_0x9c3d('0xe'));_0x179ec0(_0x46917e['result'][_0x9c3d('0x11')]);}})['catch'](function(_0x3728a5){logger[_0x9c3d('0x10')](_0x9c3d('0xd'),_0x2d4f3d,_0x3728a5);_0x2647c3(_0x3728a5);});});} \ No newline at end of file +var _0x9451=['request\x20sent','stringify','error','code','message','result','moment','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','info','UserProfileSection,\x20%s,\x20%s','debug','UserProfileSection,\x20%s,\x20%s,\x20%s'];(function(_0x3dc190,_0xa6c975){var _0x5bde76=function(_0xad954e){while(--_0xad954e){_0x3dc190['push'](_0x3dc190['shift']());}};_0x5bde76(++_0xa6c975);}(_0x9451,0x1da));var _0x1945=function(_0x11f500,_0x1c80c7){_0x11f500=_0x11f500-0x0;var _0x4b9183=_0x9451[_0x11f500];return _0x4b9183;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1945('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1945('0x1'));var db=require(_0x1945('0x2'))['db'];var utils=require(_0x1945('0x3'));var logger=require('../../config/logger')(_0x1945('0x4'));var config=require(_0x1945('0x5'));var jayson=require(_0x1945('0x6'));var client=jayson['client'][_0x1945('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3337c3,_0x263b03,_0x46815c){return new BPromise(function(_0x1f8319,_0x474220){return client['request'](_0x3337c3,_0x46815c)['then'](function(_0x4fc255){logger[_0x1945('0x8')](_0x1945('0x9'),_0x263b03,'request\x20sent');logger[_0x1945('0xa')](_0x1945('0xb'),_0x263b03,_0x1945('0xc'),JSON[_0x1945('0xd')](_0x4fc255));if(_0x4fc255['error']){if(_0x4fc255[_0x1945('0xe')][_0x1945('0xf')]===0x1f4){logger[_0x1945('0xe')](_0x1945('0x9'),_0x263b03,_0x4fc255[_0x1945('0xe')][_0x1945('0x10')]);return _0x474220(_0x4fc255[_0x1945('0xe')][_0x1945('0x10')]);}logger[_0x1945('0xe')](_0x1945('0x9'),_0x263b03,_0x4fc255[_0x1945('0xe')]['message']);return _0x1f8319(_0x4fc255['error']['message']);}else{logger[_0x1945('0x8')]('UserProfileSection,\x20%s,\x20%s',_0x263b03,_0x1945('0xc'));_0x1f8319(_0x4fc255[_0x1945('0x11')]['message']);}})['catch'](function(_0x27b48f){logger[_0x1945('0xe')](_0x1945('0x9'),_0x263b03,_0x27b48f);_0x474220(_0x27b48f);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index df114d8..6a93958 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(_0x3d71a3,_0x3a33b7){var _0x5bb3ab=function(_0x2834f2){while(--_0x2834f2){_0x3d71a3['push'](_0x3d71a3['shift']());}};_0x5bb3ab(++_0x3a33b7);}(_0x9c44,0x178));var _0x49c4=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x9c44[_0x465a0c];return _0x1e202e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0xf03a32,_0x524df3){var _0x1f6551=function(_0x3a40a8){while(--_0x3a40a8){_0xf03a32['push'](_0xf03a32['shift']());}};_0x1f6551(++_0x524df3);}(_0xe706,0xa3));var _0x6e70=function(_0x24853d,_0x16931f){_0x24853d=_0x24853d-0x0;var _0x4c5cff=_0xe706[_0x24853d];return _0x4c5cff;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index 0710896..0b7583e 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 _0x963e=['exports','INTEGER'];(function(_0x302336,_0x1bfc38){var _0x59dac5=function(_0x2c1b8a){while(--_0x2c1b8a){_0x302336['push'](_0x302336['shift']());}};_0x59dac5(++_0x1bfc38);}(_0x963e,0x1e0));var _0xe963=function(_0x590b61,_0x4c4335){_0x590b61=_0x590b61-0x0;var _0x1a14dc=_0x963e[_0x590b61];return _0x1a14dc;};'use strict';var Sequelize=require('sequelize');module[_0xe963('0x0')]={'penalty':{'type':Sequelize[_0xe963('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x6653=['INTEGER','sequelize'];(function(_0x58e469,_0x95ee3e){var _0x4c01c5=function(_0x1ef7ae){while(--_0x1ef7ae){_0x58e469['push'](_0x58e469['shift']());}};_0x4c01c5(++_0x95ee3e);}(_0x6653,0x101));var _0x3665=function(_0x3a41c0,_0x6b45a0){_0x3a41c0=_0x3a41c0-0x0;var _0x3b7bdf=_0x6653[_0x3a41c0];return _0x3b7bdf;};'use strict';var Sequelize=require(_0x3665('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x3665('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.model.js b/server/api/userSmsQueue/userSmsQueue.model.js index b6242aa..988de9b 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 _0xfb11=['bluebird','path','../../config/environment','./userSmsQueue.attributes','UserSmsQueue','user_has_sms_queues','lodash','../../config/logger','api'];(function(_0x4ad19d,_0x4f785c){var _0x476637=function(_0x5e96c1){while(--_0x5e96c1){_0x4ad19d['push'](_0x4ad19d['shift']());}};_0x476637(++_0x4f785c);}(_0xfb11,0x1ad));var _0x1fb1=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xfb11[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0x1fb1('0x0'));var util=require('util');var logger=require(_0x1fb1('0x1'))(_0x1fb1('0x2'));var moment=require('moment');var BPromise=require(_0x1fb1('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1fb1('0x4'));var rimraf=require('rimraf');var config=require(_0x1fb1('0x5'));var attributes=require(_0x1fb1('0x6'));module['exports']=function(_0x25d44f,_0x133727){return _0x25d44f['define'](_0x1fb1('0x7'),attributes,{'tableName':_0x1fb1('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1b65=['UserSmsQueue','user_has_sms_queues','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./userSmsQueue.attributes','exports','define'];(function(_0x3fefc1,_0x2a1963){var _0x5cda4a=function(_0x125658){while(--_0x125658){_0x3fefc1['push'](_0x3fefc1['shift']());}};_0x5cda4a(++_0x2a1963);}(_0x1b65,0x1b4));var _0x51b6=function(_0x40bffc,_0x3a45d7){_0x40bffc=_0x40bffc-0x0;var _0x3007e9=_0x1b65[_0x40bffc];return _0x3007e9;};'use strict';var _=require(_0x51b6('0x0'));var util=require(_0x51b6('0x1'));var logger=require(_0x51b6('0x2'))(_0x51b6('0x3'));var moment=require('moment');var BPromise=require(_0x51b6('0x4'));var rp=require(_0x51b6('0x5'));var fs=require('fs');var path=require(_0x51b6('0x6'));var rimraf=require(_0x51b6('0x7'));var config=require(_0x51b6('0x8'));var attributes=require(_0x51b6('0x9'));module[_0x51b6('0xa')]=function(_0x578b6a,_0x466a60){return _0x578b6a[_0x51b6('0xb')](_0x51b6('0xc'),attributes,{'tableName':_0x51b6('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 6b0016c..14c608c 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 _0xf182=['UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request'];(function(_0x3cc4c8,_0x114636){var _0xdc0123=function(_0x1c3078){while(--_0x1c3078){_0x3cc4c8['push'](_0x3cc4c8['shift']());}};_0xdc0123(++_0x114636);}(_0xf182,0x11c));var _0x2f18=function(_0x5344b9,_0x55d463){_0x5344b9=_0x5344b9-0x0;var _0x152ae8=_0xf182[_0x5344b9];return _0x152ae8;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x2f18('0x0'));var rs=require(_0x2f18('0x1'));var fs=require('fs');var Redis=require(_0x2f18('0x2'));var db=require(_0x2f18('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x2f18('0x4'))('rpc');var config=require(_0x2f18('0x5'));var jayson=require(_0x2f18('0x6'));var client=jayson[_0x2f18('0x7')][_0x2f18('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2a239e,_0x319c85,_0x550f7b){return new BPromise(function(_0x1d87ae,_0x169bec){return client[_0x2f18('0x9')](_0x2a239e,_0x550f7b)['then'](function(_0x318245){logger['info'](_0x2f18('0xa'),_0x319c85,_0x2f18('0xb'));logger[_0x2f18('0xc')](_0x2f18('0xd'),_0x319c85,_0x2f18('0xb'),JSON[_0x2f18('0xe')](_0x318245));if(_0x318245['error']){if(_0x318245[_0x2f18('0xf')][_0x2f18('0x10')]===0x1f4){logger[_0x2f18('0xf')](_0x2f18('0xa'),_0x319c85,_0x318245['error'][_0x2f18('0x11')]);return _0x169bec(_0x318245[_0x2f18('0xf')][_0x2f18('0x11')]);}logger[_0x2f18('0xf')](_0x2f18('0xa'),_0x319c85,_0x318245[_0x2f18('0xf')][_0x2f18('0x11')]);return _0x1d87ae(_0x318245[_0x2f18('0xf')][_0x2f18('0x11')]);}else{logger[_0x2f18('0x12')](_0x2f18('0xa'),_0x319c85,_0x2f18('0xb'));_0x1d87ae(_0x318245[_0x2f18('0x13')]['message']);}})[_0x2f18('0x14')](function(_0x7f6c87){logger['error'](_0x2f18('0xa'),_0x319c85,_0x7f6c87);_0x169bec(_0x7f6c87);});});} \ No newline at end of file +var _0xc782=['moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','debug','request\x20sent','stringify','error','code','UserSmsQueue,\x20%s,\x20%s','message','info','result','catch','lodash','util'];(function(_0x4853fc,_0x52cd55){var _0x23be73=function(_0x541448){while(--_0x541448){_0x4853fc['push'](_0x4853fc['shift']());}};_0x23be73(++_0x52cd55);}(_0xc782,0x136));var _0x2c78=function(_0x3614f2,_0x1bb103){_0x3614f2=_0x3614f2-0x0;var _0x5dc391=_0xc782[_0x3614f2];return _0x5dc391;};'use strict';var _=require(_0x2c78('0x0'));var util=require(_0x2c78('0x1'));var moment=require(_0x2c78('0x2'));var BPromise=require(_0x2c78('0x3'));var rs=require(_0x2c78('0x4'));var fs=require('fs');var Redis=require(_0x2c78('0x5'));var db=require(_0x2c78('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x2c78('0x7'));var config=require(_0x2c78('0x8'));var jayson=require(_0x2c78('0x9'));var client=jayson[_0x2c78('0xa')][_0x2c78('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3d7535,_0x595568,_0x6784a4){return new BPromise(function(_0x275667,_0x3768af){return client[_0x2c78('0xc')](_0x3d7535,_0x6784a4)[_0x2c78('0xd')](function(_0x178d33){logger['info']('UserSmsQueue,\x20%s,\x20%s',_0x595568,'request\x20sent');logger[_0x2c78('0xe')]('UserSmsQueue,\x20%s,\x20%s,\x20%s',_0x595568,_0x2c78('0xf'),JSON[_0x2c78('0x10')](_0x178d33));if(_0x178d33['error']){if(_0x178d33[_0x2c78('0x11')][_0x2c78('0x12')]===0x1f4){logger[_0x2c78('0x11')](_0x2c78('0x13'),_0x595568,_0x178d33[_0x2c78('0x11')][_0x2c78('0x14')]);return _0x3768af(_0x178d33[_0x2c78('0x11')][_0x2c78('0x14')]);}logger[_0x2c78('0x11')](_0x2c78('0x13'),_0x595568,_0x178d33[_0x2c78('0x11')][_0x2c78('0x14')]);return _0x275667(_0x178d33[_0x2c78('0x11')]['message']);}else{logger[_0x2c78('0x15')](_0x2c78('0x13'),_0x595568,_0x2c78('0xf'));_0x275667(_0x178d33[_0x2c78('0x16')]['message']);}})[_0x2c78('0x17')](function(_0x54f5c3){logger[_0x2c78('0x11')]('UserSmsQueue,\x20%s,\x20%s',_0x595568,_0x54f5c3);_0x3768af(_0x54f5c3);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index fc3aafc..816fa76 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 _0xb77e=['INTEGER','exports'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0xb77e,0xc1));var _0xeb77=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0xb77e[_0x433a86];return _0x23000c;};'use strict';var Sequelize=require('sequelize');module[_0xeb77('0x0')]={'UserId':{'type':Sequelize[_0xeb77('0x1')]},'VoicePrefixId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x7ad9=['sequelize','exports','INTEGER'];(function(_0x113512,_0x5582a6){var _0x18ae72=function(_0x87c818){while(--_0x87c818){_0x113512['push'](_0x113512['shift']());}};_0x18ae72(++_0x5582a6);}(_0x7ad9,0x18f));var _0x97ad=function(_0x21e2be,_0x36ee53){_0x21e2be=_0x21e2be-0x0;var _0x13d3da=_0x7ad9[_0x21e2be];return _0x13d3da;};'use strict';var Sequelize=require(_0x97ad('0x0'));module[_0x97ad('0x1')]={'UserId':{'type':Sequelize[_0x97ad('0x2')]},'VoicePrefixId':{'type':Sequelize[_0x97ad('0x2')]}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index 5dbaf95..7f9b928 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(_0x564b3f,_0x13287a){var _0x3374d5=function(_0x30462e){while(--_0x30462e){_0x564b3f['push'](_0x564b3f['shift']());}};_0x3374d5(++_0x13287a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0xa9e0[_0x2160a9];return _0xa88cf7;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var 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(_0x2d87eb,_0xcf7917){var _0x113bb0=function(_0x4a5190){while(--_0x4a5190){_0x2d87eb['push'](_0x2d87eb['shift']());}};_0x113bb0(++_0xcf7917);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xa9e0[_0x2f5ac5];return _0x37c9a8;};'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 cb41979..d00f5c9 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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x1658c3,_0x3221b0){var _0x1546ef=function(_0x48e2b3){while(--_0x48e2b3){_0x1658c3['push'](_0x1658c3['shift']());}};_0x1546ef(++_0x3221b0);}(_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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x5555fd,_0x31b11c){var _0x174889=function(_0x1afb16){while(--_0x1afb16){_0x5555fd['push'](_0x5555fd['shift']());}};_0x174889(++_0x31b11c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xa9e0[_0x47b58b];return _0x46bebe;};'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 8bc9c48..759feb6 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 _0x2c47=['exports','INTEGER','sequelize'];(function(_0x1d7c83,_0x2d8f2d){var _0x283ef2=function(_0x68da53){while(--_0x68da53){_0x1d7c83['push'](_0x1d7c83['shift']());}};_0x283ef2(++_0x2d8f2d);}(_0x2c47,0x18e));var _0x72c4=function(_0x191972,_0x1db9fa){_0x191972=_0x191972-0x0;var _0x152e1c=_0x2c47[_0x191972];return _0x152e1c;};'use strict';var Sequelize=require(_0x72c4('0x0'));module[_0x72c4('0x1')]={'penalty':{'type':Sequelize[_0x72c4('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xd0a2=['INTEGER'];(function(_0x4f0c2b,_0x2c9d14){var _0x526436=function(_0x2e13b6){while(--_0x2e13b6){_0x4f0c2b['push'](_0x4f0c2b['shift']());}};_0x526436(++_0x2c9d14);}(_0xd0a2,0x128));var _0x2d0a=function(_0x163977,_0x4ef72e){_0x163977=_0x163977-0x0;var _0x28bf3a=_0xd0a2[_0x163977];return _0x28bf3a;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0x2d0a('0x0')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.model.js b/server/api/userVoiceQueue/userVoiceQueue.model.js index 823eeeb..c6a7da1 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 _0x56de=['bluebird','path','rimraf','../../config/environment','./userVoiceQueue.attributes','exports','UserVoiceQueue','user_has_voice_queues','lodash','util','moment'];(function(_0x4843e0,_0x3a6543){var _0x320521=function(_0x17f1d7){while(--_0x17f1d7){_0x4843e0['push'](_0x4843e0['shift']());}};_0x320521(++_0x3a6543);}(_0x56de,0x11b));var _0xe56d=function(_0x3e6d65,_0x263be8){_0x3e6d65=_0x3e6d65-0x0;var _0x362269=_0x56de[_0x3e6d65];return _0x362269;};'use strict';var _=require(_0xe56d('0x0'));var util=require(_0xe56d('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xe56d('0x2'));var BPromise=require(_0xe56d('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe56d('0x4'));var rimraf=require(_0xe56d('0x5'));var config=require(_0xe56d('0x6'));var attributes=require(_0xe56d('0x7'));module[_0xe56d('0x8')]=function(_0x14b028,_0x48fb01){return _0x14b028['define'](_0xe56d('0x9'),attributes,{'tableName':_0xe56d('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x88e7=['user_has_voice_queues','lodash','util','../../config/logger','moment','rimraf','../../config/environment','./userVoiceQueue.attributes','exports','define','UserVoiceQueue'];(function(_0x1b8fa9,_0x29c021){var _0x13ed20=function(_0x25bd11){while(--_0x25bd11){_0x1b8fa9['push'](_0x1b8fa9['shift']());}};_0x13ed20(++_0x29c021);}(_0x88e7,0x1a3));var _0x788e=function(_0x4fbfd9,_0x3ab91a){_0x4fbfd9=_0x4fbfd9-0x0;var _0x31dc94=_0x88e7[_0x4fbfd9];return _0x31dc94;};'use strict';var _=require(_0x788e('0x0'));var util=require(_0x788e('0x1'));var logger=require(_0x788e('0x2'))('api');var moment=require(_0x788e('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x788e('0x4'));var config=require(_0x788e('0x5'));var attributes=require(_0x788e('0x6'));module[_0x788e('0x7')]=function(_0x38d03e,_0x5232ec){return _0x38d03e[_0x788e('0x8')](_0x788e('0x9'),attributes,{'tableName':_0x788e('0xa'),'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 fbb01c1..5bf19fc 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 _0xc5bd=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','request','then','info','request\x20sent','debug','error','code','UserVoiceQueue,\x20%s,\x20%s','message','result','catch'];(function(_0x22f237,_0x275250){var _0x47c927=function(_0x2bd18a){while(--_0x2bd18a){_0x22f237['push'](_0x22f237['shift']());}};_0x47c927(++_0x275250);}(_0xc5bd,0x9a));var _0xdc5b=function(_0x4488ac,_0x4a6a27){_0x4488ac=_0x4488ac-0x0;var _0x209b4a=_0xc5bd[_0x4488ac];return _0x209b4a;};'use strict';var _=require(_0xdc5b('0x0'));var util=require(_0xdc5b('0x1'));var moment=require(_0xdc5b('0x2'));var BPromise=require(_0xdc5b('0x3'));var rs=require(_0xdc5b('0x4'));var fs=require('fs');var Redis=require(_0xdc5b('0x5'));var db=require(_0xdc5b('0x6'))['db'];var utils=require(_0xdc5b('0x7'));var logger=require(_0xdc5b('0x8'))(_0xdc5b('0x9'));var config=require('../../config/environment');var jayson=require(_0xdc5b('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x305200,_0x19341e,_0x491e54){return new BPromise(function(_0x4ae255,_0x2a4d6e){return client[_0xdc5b('0xb')](_0x305200,_0x491e54)[_0xdc5b('0xc')](function(_0x3c2514){logger[_0xdc5b('0xd')]('UserVoiceQueue,\x20%s,\x20%s',_0x19341e,_0xdc5b('0xe'));logger[_0xdc5b('0xf')]('UserVoiceQueue,\x20%s,\x20%s,\x20%s',_0x19341e,_0xdc5b('0xe'),JSON['stringify'](_0x3c2514));if(_0x3c2514[_0xdc5b('0x10')]){if(_0x3c2514[_0xdc5b('0x10')][_0xdc5b('0x11')]===0x1f4){logger['error'](_0xdc5b('0x12'),_0x19341e,_0x3c2514[_0xdc5b('0x10')][_0xdc5b('0x13')]);return _0x2a4d6e(_0x3c2514[_0xdc5b('0x10')]['message']);}logger[_0xdc5b('0x10')]('UserVoiceQueue,\x20%s,\x20%s',_0x19341e,_0x3c2514['error'][_0xdc5b('0x13')]);return _0x4ae255(_0x3c2514[_0xdc5b('0x10')]['message']);}else{logger[_0xdc5b('0xd')](_0xdc5b('0x12'),_0x19341e,_0xdc5b('0xe'));_0x4ae255(_0x3c2514[_0xdc5b('0x14')]['message']);}})[_0xdc5b('0x15')](function(_0x47a287){logger['error']('UserVoiceQueue,\x20%s,\x20%s',_0x19341e,_0x47a287);_0x2a4d6e(_0x47a287);});});} \ No newline at end of file +var _0xb9ad=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','request','then','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch'];(function(_0x5bd948,_0x478409){var _0x52771a=function(_0x230a12){while(--_0x230a12){_0x5bd948['push'](_0x5bd948['shift']());}};_0x52771a(++_0x478409);}(_0xb9ad,0x11e));var _0xdb9a=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xb9ad[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0xdb9a('0x0'));var util=require(_0xdb9a('0x1'));var moment=require(_0xdb9a('0x2'));var BPromise=require(_0xdb9a('0x3'));var rs=require(_0xdb9a('0x4'));var fs=require('fs');var Redis=require(_0xdb9a('0x5'));var db=require(_0xdb9a('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xdb9a('0x7'))(_0xdb9a('0x8'));var config=require(_0xdb9a('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x22300a,_0x25df51,_0x3b8965){return new BPromise(function(_0x3a183f,_0x2dde78){return client[_0xdb9a('0xa')](_0x22300a,_0x3b8965)[_0xdb9a('0xb')](function(_0x2ff09c){logger[_0xdb9a('0xc')](_0xdb9a('0xd'),_0x25df51,_0xdb9a('0xe'));logger[_0xdb9a('0xf')]('UserVoiceQueue,\x20%s,\x20%s,\x20%s',_0x25df51,'request\x20sent',JSON[_0xdb9a('0x10')](_0x2ff09c));if(_0x2ff09c[_0xdb9a('0x11')]){if(_0x2ff09c['error'][_0xdb9a('0x12')]===0x1f4){logger['error'](_0xdb9a('0xd'),_0x25df51,_0x2ff09c[_0xdb9a('0x11')][_0xdb9a('0x13')]);return _0x2dde78(_0x2ff09c['error'][_0xdb9a('0x13')]);}logger[_0xdb9a('0x11')]('UserVoiceQueue,\x20%s,\x20%s',_0x25df51,_0x2ff09c['error'][_0xdb9a('0x13')]);return _0x3a183f(_0x2ff09c[_0xdb9a('0x11')]['message']);}else{logger['info'](_0xdb9a('0xd'),_0x25df51,'request\x20sent');_0x3a183f(_0x2ff09c[_0xdb9a('0x14')][_0xdb9a('0x13')]);}})[_0xdb9a('0x15')](function(_0x5d2b8f){logger[_0xdb9a('0x11')](_0xdb9a('0xd'),_0x25df51,_0x5d2b8f);_0x2dde78(_0x5d2b8f);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index f8f4aac..125b8fb 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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x116482,_0x3783a9){var _0x156c0d=function(_0x40c16f){while(--_0x40c16f){_0x116482['push'](_0x116482['shift']());}};_0x156c0d(++_0x3783a9);}(_0xe706,0xa3));var _0x6e70=function(_0x129f74,_0x3d64d8){_0x129f74=_0x129f74-0x0;var _0x1cf683=_0xe706[_0x129f74];return _0x1cf683;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x3753f5,_0x12a1f1){var _0x419010=function(_0x366dd2){while(--_0x366dd2){_0x3753f5['push'](_0x3753f5['shift']());}};_0x419010(++_0x12a1f1);}(_0x9c44,0x178));var _0x49c4=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0x9c44[_0x16b9ed];return _0x66b1f8;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index dda1724..a09028e 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 _0xab3d=['sequelize','STRING','INTEGER','Required\x20by\x20Asterisk'];(function(_0x447a9f,_0x48619b){var _0x1286fc=function(_0x3ae69c){while(--_0x3ae69c){_0x447a9f['push'](_0x447a9f['shift']());}};_0x1286fc(++_0x48619b);}(_0xab3d,0xb0));var _0xdab3=function(_0x154e52,_0x4c2049){_0x154e52=_0x154e52-0x0;var _0x3e457c=_0xab3d[_0x154e52];return _0x3e457c;};'use strict';var Sequelize=require(_0xdab3('0x0'));module['exports']={'uniqueid':{'type':Sequelize['INTEGER'],'primaryKey':!![],'autoIncrement':!![],'comment':'Required\x20by\x20Asterisk'},'membername':{'type':Sequelize[_0xdab3('0x1')],'allowNull':![],'comment':'Required\x20by\x20Asterisk'},'UserId':{'type':Sequelize['INTEGER'],'allowNull':![]},'queue_name':{'type':Sequelize[_0xdab3('0x1')],'allowNull':![],'unique':'queue_interface','comment':'Required\x20by\x20Asterisk'},'VoiceQueueId':{'type':Sequelize[_0xdab3('0x2')],'allowNull':![]},'interface':{'type':Sequelize[_0xdab3('0x1')],'allowNull':![],'unique':'queue_interface','comment':_0xdab3('0x3')},'penalty':{'type':Sequelize[_0xdab3('0x2')](0xb),'defaultValue':0x0,'comment':_0xdab3('0x3')},'paused':{'type':Sequelize[_0xdab3('0x2')](0xb),'defaultValue':0x0,'comment':_0xdab3('0x3')}}; \ No newline at end of file +var _0x198a=['INTEGER','Required\x20by\x20Asterisk','STRING','queue_interface','sequelize'];(function(_0x2aec52,_0x59d962){var _0x3b8835=function(_0x3e2604){while(--_0x3e2604){_0x2aec52['push'](_0x2aec52['shift']());}};_0x3b8835(++_0x59d962);}(_0x198a,0x77));var _0xa198=function(_0x3b36ea,_0xb5e388){_0x3b36ea=_0x3b36ea-0x0;var _0x3371bc=_0x198a[_0x3b36ea];return _0x3371bc;};'use strict';var Sequelize=require(_0xa198('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xa198('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':_0xa198('0x2')},'membername':{'type':Sequelize[_0xa198('0x3')],'allowNull':![],'comment':'Required\x20by\x20Asterisk'},'UserId':{'type':Sequelize[_0xa198('0x1')],'allowNull':![]},'queue_name':{'type':Sequelize[_0xa198('0x3')],'allowNull':![],'unique':_0xa198('0x4'),'comment':_0xa198('0x2')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'allowNull':![]},'interface':{'type':Sequelize[_0xa198('0x3')],'allowNull':![],'unique':_0xa198('0x4'),'comment':'Required\x20by\x20Asterisk'},'penalty':{'type':Sequelize[_0xa198('0x1')](0xb),'defaultValue':0x0,'comment':_0xa198('0x2')},'paused':{'type':Sequelize[_0xa198('0x1')](0xb),'defaultValue':0x0,'comment':_0xa198('0x2')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index aba3fa3..adf67b9 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 _0x9412=['../../mysqldb','UserVoiceQueueRt','save','update','remove','emit','hook','exports'];(function(_0x433650,_0x2780ed){var _0x13ce1d=function(_0x342294){while(--_0x342294){_0x433650['push'](_0x433650['shift']());}};_0x13ce1d(++_0x2780ed);}(_0x9412,0x110));var _0x2941=function(_0x2d86f2,_0x5e1b5c){_0x2d86f2=_0x2d86f2-0x0;var _0x4d2124=_0x9412[_0x2d86f2];return _0x4d2124;};'use strict';var EventEmitter=require('events');var UserVoiceQueueRt=require(_0x2941('0x0'))['db'][_0x2941('0x1')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x2941('0x2'),'afterUpdate':_0x2941('0x3'),'afterDestroy':_0x2941('0x4')};function emitEvent(_0x501392){return function(_0x3d9905,_0x14f805,_0x2a2638){UserVoiceQueueRtEvents[_0x2941('0x5')](_0x501392+':'+_0x3d9905['id'],_0x3d9905);UserVoiceQueueRtEvents[_0x2941('0x5')](_0x501392,_0x3d9905);_0x2a2638(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserVoiceQueueRt[_0x2941('0x6')](e,emitEvent(event));}}module[_0x2941('0x7')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x47d4=['hook','exports','events','../../mysqldb','UserVoiceQueueRt','setMaxListeners','save','remove','emit','hasOwnProperty'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x47d4,0x1b0));var _0x447d=function(_0x54cf50,_0xe0b43b){_0x54cf50=_0x54cf50-0x0;var _0x3e7bd3=_0x47d4[_0x54cf50];return _0x3e7bd3;};'use strict';var EventEmitter=require(_0x447d('0x0'));var UserVoiceQueueRt=require(_0x447d('0x1'))['db'][_0x447d('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x447d('0x3')](0x0);var events={'afterCreate':_0x447d('0x4'),'afterUpdate':'update','afterDestroy':_0x447d('0x5')};function emitEvent(_0x15c673){return function(_0x5646db,_0x4e4557,_0x53d429){UserVoiceQueueRtEvents['emit'](_0x15c673+':'+_0x5646db['id'],_0x5646db);UserVoiceQueueRtEvents[_0x447d('0x6')](_0x15c673,_0x5646db);_0x53d429(null);};}for(var e in events){if(events[_0x447d('0x7')](e)){var event=events[e];UserVoiceQueueRt[_0x447d('0x8')](e,emitEvent(event));}}module[_0x447d('0x9')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index 560bac8..2af7b31 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 _0x5092=['path','rimraf','./userVoiceQueueRt.attributes','define','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x251792,_0x4416e8){var _0x1b5c16=function(_0x58eb72){while(--_0x58eb72){_0x251792['push'](_0x251792['shift']());}};_0x1b5c16(++_0x4416e8);}(_0x5092,0x186));var _0x2509=function(_0x48d3e3,_0x511a12){_0x48d3e3=_0x48d3e3-0x0;var _0x24c8c5=_0x5092[_0x48d3e3];return _0x24c8c5;};'use strict';var _=require(_0x2509('0x0'));var util=require(_0x2509('0x1'));var logger=require(_0x2509('0x2'))(_0x2509('0x3'));var moment=require(_0x2509('0x4'));var BPromise=require(_0x2509('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2509('0x6'));var rimraf=require(_0x2509('0x7'));var config=require('../../config/environment');var attributes=require(_0x2509('0x8'));module['exports']=function(_0x3c9cc4,_0x1f15d2){return _0x3c9cc4[_0x2509('0x9')](_0x2509('0xa'),attributes,{'tableName':_0x2509('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x284e=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userVoiceQueueRt.attributes','exports','define','UserVoiceQueueRt','user_has_voice_queues_rt','lodash'];(function(_0x5b2809,_0x48b226){var _0x572dee=function(_0x4b3e82){while(--_0x4b3e82){_0x5b2809['push'](_0x5b2809['shift']());}};_0x572dee(++_0x48b226);}(_0x284e,0xe0));var _0xe284=function(_0x5a302f,_0x488b68){_0x5a302f=_0x5a302f-0x0;var _0x59480c=_0x284e[_0x5a302f];return _0x59480c;};'use strict';var _=require(_0xe284('0x0'));var util=require(_0xe284('0x1'));var logger=require(_0xe284('0x2'))(_0xe284('0x3'));var moment=require(_0xe284('0x4'));var BPromise=require(_0xe284('0x5'));var rp=require(_0xe284('0x6'));var fs=require('fs');var path=require(_0xe284('0x7'));var rimraf=require(_0xe284('0x8'));var config=require(_0xe284('0x9'));var attributes=require(_0xe284('0xa'));module[_0xe284('0xb')]=function(_0x40bfd0,_0x456795){return _0x40bfd0[_0xe284('0xc')](_0xe284('0xd'),attributes,{'tableName':_0xe284('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 778d5af..76dd58c 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 _0x828b=['options','raw','where','sequelize','literal','`paused`\x20=\x201,\x201,\x20null','GetVoiceQueueRtPauses','debug','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','UserVoiceQueueRt','findAll'];(function(_0x27c6f3,_0x440124){var _0x3ac60a=function(_0x171891){while(--_0x171891){_0x27c6f3['push'](_0x27c6f3['shift']());}};_0x3ac60a(++_0x440124);}(_0x828b,0x166));var _0xb828=function(_0x7e918f,_0x48cf10){_0x7e918f=_0x7e918f-0x0;var _0x5b35ab=_0x828b[_0x7e918f];return _0x5b35ab;};'use strict';var _=require(_0xb828('0x0'));var util=require(_0xb828('0x1'));var moment=require(_0xb828('0x2'));var BPromise=require(_0xb828('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb828('0x4'));var db=require(_0xb828('0x5'))['db'];var utils=require(_0xb828('0x6'));var logger=require(_0xb828('0x7'))('rpc');var config=require(_0xb828('0x8'));var jayson=require(_0xb828('0x9'));var client=jayson[_0xb828('0xa')][_0xb828('0xb')]({'port':0x232a});config[_0xb828('0xc')]=_[_0xb828('0xd')](config['redis'],{'host':_0xb828('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb828('0xc')]));require('./userVoiceQueueRt.socket')['register'](socket);function respondWithRpcPromise(_0x1a2f6a,_0x33f2d4,_0x20268f){return new BPromise(function(_0x2676e4,_0x595118){return client['request'](_0x1a2f6a,_0x20268f)[_0xb828('0xf')](function(_0x350d8a){logger[_0xb828('0x10')](_0xb828('0x11'),_0x33f2d4,_0xb828('0x12'));logger['debug'](_0xb828('0x13'),_0x33f2d4,_0xb828('0x12'),JSON[_0xb828('0x14')](_0x350d8a));if(_0x350d8a[_0xb828('0x15')]){if(_0x350d8a[_0xb828('0x15')][_0xb828('0x16')]===0x1f4){logger[_0xb828('0x15')](_0xb828('0x11'),_0x33f2d4,_0x350d8a['error'][_0xb828('0x17')]);return _0x595118(_0x350d8a[_0xb828('0x15')]['message']);}logger['error'](_0xb828('0x11'),_0x33f2d4,_0x350d8a['error'][_0xb828('0x17')]);return _0x2676e4(_0x350d8a[_0xb828('0x15')][_0xb828('0x17')]);}else{logger[_0xb828('0x10')](_0xb828('0x11'),_0x33f2d4,'request\x20sent');_0x2676e4(_0x350d8a['result']['message']);}})[_0xb828('0x18')](function(_0x5b4493){logger[_0xb828('0x15')](_0xb828('0x11'),_0x33f2d4,_0x5b4493);_0x595118(_0x5b4493);});});}exports['GetVoiceQueueRtPauses']=function(_0x15a763){var _0x126b2d=this;return new Promise(function(_0x3665f1,_0x477a8a){return db[_0xb828('0x19')][_0xb828('0x1a')]({'raw':_0x15a763[_0xb828('0x1b')]?_0x15a763[_0xb828('0x1b')][_0xb828('0x1c')]===undefined?!![]:![]:!![],'where':_0x15a763[_0xb828('0x1b')]?_0x15a763[_0xb828('0x1b')][_0xb828('0x1d')]||null:null,'attributes':[[db[_0xb828('0x1e')]['fn']('COUNT',db[_0xb828('0x1e')]['fn']('IF',db[_0xb828('0x1e')][_0xb828('0x1f')](_0xb828('0x20')))),'outboundQueuePauses']]})[_0xb828('0xf')](function(_0x3b6eeb){logger[_0xb828('0x10')](_0xb828('0x21'),_0x15a763);logger[_0xb828('0x22')](_0xb828('0x21'),_0x15a763,JSON[_0xb828('0x14')](_0x3b6eeb));_0x3665f1(_0x3b6eeb);})['catch'](function(_0x584b85){logger[_0xb828('0x15')](_0xb828('0x21'),_0x584b85[_0xb828('0x17')],_0x15a763);_0x477a8a(_0x126b2d[_0xb828('0x15')](0x1f4,_0x584b85[_0xb828('0x17')]));});});}; \ No newline at end of file +var _0x1b86=['GetVoiceQueueRtPauses','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./userVoiceQueueRt.socket','info','UserVoiceQueueRt,\x20%s,\x20%s','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','UserVoiceQueueRt','findAll','options','raw','COUNT','sequelize','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','then'];(function(_0x4b2436,_0x452299){var _0x4f5ab2=function(_0x5c6679){while(--_0x5c6679){_0x4b2436['push'](_0x4b2436['shift']());}};_0x4f5ab2(++_0x452299);}(_0x1b86,0xb5));var _0x61b8=function(_0x29f0d5,_0x4e824c){_0x29f0d5=_0x29f0d5-0x0;var _0x3ce0eb=_0x1b86[_0x29f0d5];return _0x3ce0eb;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x61b8('0x0'));var BPromise=require(_0x61b8('0x1'));var rs=require(_0x61b8('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x61b8('0x3'))['db'];var utils=require(_0x61b8('0x4'));var logger=require(_0x61b8('0x5'))(_0x61b8('0x6'));var config=require(_0x61b8('0x7'));var jayson=require(_0x61b8('0x8'));var client=jayson[_0x61b8('0x9')][_0x61b8('0xa')]({'port':0x232a});config[_0x61b8('0xb')]=_['defaults'](config[_0x61b8('0xb')],{'host':_0x61b8('0xc'),'port':0x18eb});var socket=require(_0x61b8('0xd'))(new Redis(config[_0x61b8('0xb')]));require(_0x61b8('0xe'))['register'](socket);function respondWithRpcPromise(_0x5bbf6f,_0x49e4cc,_0x26c640){return new BPromise(function(_0x3a8dbc,_0x58af62){return client['request'](_0x5bbf6f,_0x26c640)['then'](function(_0xad86e7){logger[_0x61b8('0xf')](_0x61b8('0x10'),_0x49e4cc,'request\x20sent');logger[_0x61b8('0x11')](_0x61b8('0x12'),_0x49e4cc,'request\x20sent',JSON[_0x61b8('0x13')](_0xad86e7));if(_0xad86e7[_0x61b8('0x14')]){if(_0xad86e7[_0x61b8('0x14')][_0x61b8('0x15')]===0x1f4){logger[_0x61b8('0x14')](_0x61b8('0x10'),_0x49e4cc,_0xad86e7['error'][_0x61b8('0x16')]);return _0x58af62(_0xad86e7[_0x61b8('0x14')][_0x61b8('0x16')]);}logger[_0x61b8('0x14')](_0x61b8('0x10'),_0x49e4cc,_0xad86e7[_0x61b8('0x14')][_0x61b8('0x16')]);return _0x3a8dbc(_0xad86e7[_0x61b8('0x14')][_0x61b8('0x16')]);}else{logger[_0x61b8('0xf')](_0x61b8('0x10'),_0x49e4cc,_0x61b8('0x17'));_0x3a8dbc(_0xad86e7['result'][_0x61b8('0x16')]);}})[_0x61b8('0x18')](function(_0xe6da71){logger['error']('UserVoiceQueueRt,\x20%s,\x20%s',_0x49e4cc,_0xe6da71);_0x58af62(_0xe6da71);});});}exports['GetVoiceQueueRtPauses']=function(_0x198f31){var _0x1bbf85=this;return new Promise(function(_0x799958,_0x5bed67){return db[_0x61b8('0x19')][_0x61b8('0x1a')]({'raw':_0x198f31[_0x61b8('0x1b')]?_0x198f31[_0x61b8('0x1b')][_0x61b8('0x1c')]===undefined?!![]:![]:!![],'where':_0x198f31[_0x61b8('0x1b')]?_0x198f31['options']['where']||null:null,'attributes':[[db['sequelize']['fn'](_0x61b8('0x1d'),db[_0x61b8('0x1e')]['fn']('IF',db['sequelize'][_0x61b8('0x1f')](_0x61b8('0x20')))),_0x61b8('0x21')]]})[_0x61b8('0x22')](function(_0x5cfd64){logger[_0x61b8('0xf')](_0x61b8('0x23'),_0x198f31);logger[_0x61b8('0x11')]('GetVoiceQueueRtPauses',_0x198f31,JSON[_0x61b8('0x13')](_0x5cfd64));_0x799958(_0x5cfd64);})[_0x61b8('0x18')](function(_0x3c4a99){logger['error'](_0x61b8('0x23'),_0x3c4a99[_0x61b8('0x16')],_0x198f31);_0x5bed67(_0x1bbf85['error'](0x1f4,_0x3c4a99[_0x61b8('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 10a7e44..4c30931 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 _0x25fa=['remove','update','emit','removeListener','length','userVoiceQueueRt:','./userVoiceQueueRt.events'];(function(_0x494f4f,_0x2b676c){var _0x52e8de=function(_0x4eed52){while(--_0x4eed52){_0x494f4f['push'](_0x494f4f['shift']());}};_0x52e8de(++_0x2b676c);}(_0x25fa,0x109));var _0xa25f=function(_0x19b81f,_0x4d0aa3){_0x19b81f=_0x19b81f-0x0;var _0x3c880c=_0x25fa[_0x19b81f];return _0x3c880c;};'use strict';var UserVoiceQueueRtEvents=require(_0xa25f('0x0'));var events=['save',_0xa25f('0x1'),_0xa25f('0x2')];function createListener(_0x57e272,_0x408155){return function(_0xb88bd8){_0x408155[_0xa25f('0x3')](_0x57e272,_0xb88bd8);};}function removeListener(_0x4d0b34,_0x4e444d){return function(){UserVoiceQueueRtEvents[_0xa25f('0x4')](_0x4d0b34,_0x4e444d);};}exports['register']=function(_0x2ea9ea){for(var _0x3ab530=0x0,_0x29666d=events[_0xa25f('0x5')];_0x3ab530<_0x29666d;_0x3ab530++){var _0x22982b=events[_0x3ab530];var _0x168907=createListener(_0xa25f('0x6')+_0x22982b,_0x2ea9ea);UserVoiceQueueRtEvents['on'](_0x22982b,_0x168907);}}; \ No newline at end of file +var _0x6ec2=['./userVoiceQueueRt.events','save','remove','update','emit','removeListener','register','userVoiceQueueRt:'];(function(_0x2b8bb2,_0x57db00){var _0x589bf1=function(_0x3522dc){while(--_0x3522dc){_0x2b8bb2['push'](_0x2b8bb2['shift']());}};_0x589bf1(++_0x57db00);}(_0x6ec2,0x78));var _0x26ec=function(_0x363d9e,_0x66fa2e){_0x363d9e=_0x363d9e-0x0;var _0x3449ea=_0x6ec2[_0x363d9e];return _0x3449ea;};'use strict';var UserVoiceQueueRtEvents=require(_0x26ec('0x0'));var events=[_0x26ec('0x1'),_0x26ec('0x2'),_0x26ec('0x3')];function createListener(_0x1f6b85,_0x277401){return function(_0x5ef71c){_0x277401[_0x26ec('0x4')](_0x1f6b85,_0x5ef71c);};}function removeListener(_0x18650a,_0x2b4225){return function(){UserVoiceQueueRtEvents[_0x26ec('0x5')](_0x18650a,_0x2b4225);};}exports[_0x26ec('0x6')]=function(_0x4ce209){for(var _0x3b5955=0x0,_0x4e8781=events['length'];_0x3b5955<_0x4e8781;_0x3b5955++){var _0xf2cd1d=events[_0x3b5955];var _0x2802e7=createListener(_0x26ec('0x7')+_0xf2cd1d,_0x4ce209);UserVoiceQueueRtEvents['on'](_0xf2cd1d,_0x2802e7);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 4e84ebc..68659b6 100644 --- a/server/api/userWhatsappQueue/index.js +++ b/server/api/userWhatsappQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x583c95,_0x2caa4d){var _0x1cb317=function(_0x1e2fd1){while(--_0x1e2fd1){_0x583c95['push'](_0x583c95['shift']());}};_0x1cb317(++_0x2caa4d);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x5ae7ae,_0x534c34){var _0x5929f7=function(_0xeabd3a){while(--_0xeabd3a){_0x5ae7ae['push'](_0x5ae7ae['shift']());}};_0x5929f7(++_0x534c34);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index 28a8a02..02ce777 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 _0x19b5=['INTEGER','sequelize','exports'];(function(_0x47c2f5,_0x1c5789){var _0x2cbdf5=function(_0x4e2c87){while(--_0x4e2c87){_0x47c2f5['push'](_0x47c2f5['shift']());}};_0x2cbdf5(++_0x1c5789);}(_0x19b5,0x1b7));var _0x519b=function(_0x4a3e83,_0xc36841){_0x4a3e83=_0x4a3e83-0x0;var _0x31e1f9=_0x19b5[_0x4a3e83];return _0x31e1f9;};'use strict';var Sequelize=require(_0x519b('0x0'));module[_0x519b('0x1')]={'penalty':{'type':Sequelize[_0x519b('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x98b9=['exports','INTEGER','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x98b9,0x164));var _0x998b=function(_0x3186c6,_0x4ba2c4){_0x3186c6=_0x3186c6-0x0;var _0x344a72=_0x98b9[_0x3186c6];return _0x344a72;};'use strict';var Sequelize=require(_0x998b('0x0'));module[_0x998b('0x1')]={'penalty':{'type':Sequelize[_0x998b('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.model.js b/server/api/userWhatsappQueue/userWhatsappQueue.model.js index 1d0d460..b4a59da 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 _0x0120=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./userWhatsappQueue.attributes','define','UserWhatsappQueue','lodash','../../config/logger','api'];(function(_0x4828b1,_0x5c8cf3){var _0x1fec1b=function(_0x3f2e5a){while(--_0x3f2e5a){_0x4828b1['push'](_0x4828b1['shift']());}};_0x1fec1b(++_0x5c8cf3);}(_0x0120,0x189));var _0x0012=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x0120[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require(_0x0012('0x0'));var util=require('util');var logger=require(_0x0012('0x1'))(_0x0012('0x2'));var moment=require(_0x0012('0x3'));var BPromise=require(_0x0012('0x4'));var rp=require(_0x0012('0x5'));var fs=require('fs');var path=require(_0x0012('0x6'));var rimraf=require(_0x0012('0x7'));var config=require(_0x0012('0x8'));var attributes=require(_0x0012('0x9'));module['exports']=function(_0xeb91d8,_0x32ca9f){return _0xeb91d8[_0x0012('0xa')](_0x0012('0xb'),attributes,{'tableName':'user_has_whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdb72=['UserWhatsappQueue','user_has_whatsapp_queues','util','../../config/logger','api','moment','request-promise','path','../../config/environment','./userWhatsappQueue.attributes','exports','define'];(function(_0x1977ac,_0x3b2074){var _0x4da1c8=function(_0x5c643b){while(--_0x5c643b){_0x1977ac['push'](_0x1977ac['shift']());}};_0x4da1c8(++_0x3b2074);}(_0xdb72,0x12e));var _0x2db7=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0xdb72[_0x45e98e];return _0x374dba;};'use strict';var _=require('lodash');var util=require(_0x2db7('0x0'));var logger=require(_0x2db7('0x1'))(_0x2db7('0x2'));var moment=require(_0x2db7('0x3'));var BPromise=require('bluebird');var rp=require(_0x2db7('0x4'));var fs=require('fs');var path=require(_0x2db7('0x5'));var rimraf=require('rimraf');var config=require(_0x2db7('0x6'));var attributes=require(_0x2db7('0x7'));module[_0x2db7('0x8')]=function(_0x26a383,_0x41b92e){return _0x26a383[_0x2db7('0x9')](_0x2db7('0xa'),attributes,{'tableName':_0x2db7('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js b/server/api/userWhatsappQueue/userWhatsappQueue.rpc.js index 34e6bf6..3451032 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 _0x7cb7=['UserWhatsappQueue,\x20%s,\x20%s','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x5da0d9,_0x49ee54){var _0x4b6d2f=function(_0x9832cf){while(--_0x9832cf){_0x5da0d9['push'](_0x5da0d9['shift']());}};_0x4b6d2f(++_0x49ee54);}(_0x7cb7,0x1e9));var _0x77cb=function(_0x4fae5e,_0x11215c){_0x4fae5e=_0x4fae5e-0x0;var _0x1b0302=_0x7cb7[_0x4fae5e];return _0x1b0302;};'use strict';var _=require(_0x77cb('0x0'));var util=require(_0x77cb('0x1'));var moment=require('moment');var BPromise=require(_0x77cb('0x2'));var rs=require(_0x77cb('0x3'));var fs=require('fs');var Redis=require(_0x77cb('0x4'));var db=require(_0x77cb('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x77cb('0x6'))(_0x77cb('0x7'));var config=require(_0x77cb('0x8'));var jayson=require(_0x77cb('0x9'));var client=jayson[_0x77cb('0xa')][_0x77cb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x420fe5,_0xfba99f,_0x172944){return new BPromise(function(_0x3d0d89,_0xcd17b4){return client[_0x77cb('0xc')](_0x420fe5,_0x172944)[_0x77cb('0xd')](function(_0x5762ae){logger[_0x77cb('0xe')](_0x77cb('0xf'),_0xfba99f,'request\x20sent');logger[_0x77cb('0x10')](_0x77cb('0x11'),_0xfba99f,'request\x20sent',JSON[_0x77cb('0x12')](_0x5762ae));if(_0x5762ae[_0x77cb('0x13')]){if(_0x5762ae[_0x77cb('0x13')][_0x77cb('0x14')]===0x1f4){logger[_0x77cb('0x13')](_0x77cb('0xf'),_0xfba99f,_0x5762ae['error'][_0x77cb('0x15')]);return _0xcd17b4(_0x5762ae[_0x77cb('0x13')][_0x77cb('0x15')]);}logger[_0x77cb('0x13')](_0x77cb('0xf'),_0xfba99f,_0x5762ae[_0x77cb('0x13')][_0x77cb('0x15')]);return _0x3d0d89(_0x5762ae['error'][_0x77cb('0x15')]);}else{logger[_0x77cb('0xe')](_0x77cb('0xf'),_0xfba99f,'request\x20sent');_0x3d0d89(_0x5762ae[_0x77cb('0x16')][_0x77cb('0x15')]);}})[_0x77cb('0x17')](function(_0x1d5248){logger[_0x77cb('0x13')]('UserWhatsappQueue,\x20%s,\x20%s',_0xfba99f,_0x1d5248);_0xcd17b4(_0x1d5248);});});} \ No newline at end of file +var _0xf804=['util','bluebird','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash'];(function(_0x2d2c16,_0x4e88b6){var _0x53f2fb=function(_0x6b6dac){while(--_0x6b6dac){_0x2d2c16['push'](_0x2d2c16['shift']());}};_0x53f2fb(++_0x4e88b6);}(_0xf804,0x11d));var _0x4f80=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xf804[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x4f80('0x0'));var util=require(_0x4f80('0x1'));var moment=require('moment');var BPromise=require(_0x4f80('0x2'));var rs=require(_0x4f80('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x4f80('0x4'))(_0x4f80('0x5'));var config=require(_0x4f80('0x6'));var jayson=require(_0x4f80('0x7'));var client=jayson[_0x4f80('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x595c0c,_0x39cfac,_0x29da72){return new BPromise(function(_0x387b18,_0x2da410){return client[_0x4f80('0x9')](_0x595c0c,_0x29da72)[_0x4f80('0xa')](function(_0x5a36f3){logger[_0x4f80('0xb')](_0x4f80('0xc'),_0x39cfac,_0x4f80('0xd'));logger[_0x4f80('0xe')](_0x4f80('0xf'),_0x39cfac,_0x4f80('0xd'),JSON[_0x4f80('0x10')](_0x5a36f3));if(_0x5a36f3[_0x4f80('0x11')]){if(_0x5a36f3[_0x4f80('0x11')][_0x4f80('0x12')]===0x1f4){logger[_0x4f80('0x11')]('UserWhatsappQueue,\x20%s,\x20%s',_0x39cfac,_0x5a36f3[_0x4f80('0x11')][_0x4f80('0x13')]);return _0x2da410(_0x5a36f3[_0x4f80('0x11')][_0x4f80('0x13')]);}logger['error'](_0x4f80('0xc'),_0x39cfac,_0x5a36f3[_0x4f80('0x11')][_0x4f80('0x13')]);return _0x387b18(_0x5a36f3[_0x4f80('0x11')]['message']);}else{logger[_0x4f80('0xb')]('UserWhatsappQueue,\x20%s,\x20%s',_0x39cfac,_0x4f80('0xd'));_0x387b18(_0x5a36f3[_0x4f80('0x14')][_0x4f80('0x13')]);}})[_0x4f80('0x15')](function(_0x232f4a){logger[_0x4f80('0x11')](_0x4f80('0xc'),_0x39cfac,_0x232f4a);_0x2da410(_0x232f4a);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index 1fe120d..e0dd6c2 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 _0x3667=['fs-extra','../../components/auth/service','../../config/environment','./variable.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x2af015,_0x55f7a1){var _0x58f368=function(_0x45a9c1){while(--_0x45a9c1){_0x2af015['push'](_0x2af015['shift']());}};_0x58f368(++_0x55f7a1);}(_0x3667,0xcd));var _0x7366=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3667[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x7366('0x0'));var util=require(_0x7366('0x1'));var path=require(_0x7366('0x2'));var timeout=require(_0x7366('0x3'));var express=require(_0x7366('0x4'));var router=express['Router']();var fs_extra=require(_0x7366('0x5'));var auth=require(_0x7366('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x7366('0x7'));var controller=require(_0x7366('0x8'));router[_0x7366('0x9')]('/',auth[_0x7366('0xa')](),controller[_0x7366('0xb')]);router['get'](_0x7366('0xc'),auth[_0x7366('0xa')](),controller[_0x7366('0xd')]);router[_0x7366('0xe')]('/',auth[_0x7366('0xa')](),controller[_0x7366('0xf')]);router[_0x7366('0x10')](_0x7366('0xc'),auth[_0x7366('0xa')](),controller[_0x7366('0x11')]);router[_0x7366('0x12')](_0x7366('0xc'),auth[_0x7366('0xa')](),controller[_0x7366('0x13')]);module[_0x7366('0x14')]=router; \ No newline at end of file +var _0xbe02=['put','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./variable.controller','get','isAuthenticated','index','show','post','create'];(function(_0x494d1f,_0x3f72ff){var _0x457b6e=function(_0x38cb16){while(--_0x38cb16){_0x494d1f['push'](_0x494d1f['shift']());}};_0x457b6e(++_0x3f72ff);}(_0xbe02,0x146));var _0x2be0=function(_0x5443c1,_0x5768f8){_0x5443c1=_0x5443c1-0x0;var _0x33768f=_0xbe02[_0x5443c1];return _0x33768f;};'use strict';var multer=require(_0x2be0('0x0'));var util=require(_0x2be0('0x1'));var path=require(_0x2be0('0x2'));var timeout=require(_0x2be0('0x3'));var express=require('express');var router=express[_0x2be0('0x4')]();var fs_extra=require(_0x2be0('0x5'));var auth=require(_0x2be0('0x6'));var interaction=require(_0x2be0('0x7'));var config=require(_0x2be0('0x8'));var controller=require(_0x2be0('0x9'));router[_0x2be0('0xa')]('/',auth[_0x2be0('0xb')](),controller[_0x2be0('0xc')]);router['get']('/:id',auth[_0x2be0('0xb')](),controller[_0x2be0('0xd')]);router[_0x2be0('0xe')]('/',auth[_0x2be0('0xb')](),controller[_0x2be0('0xf')]);router[_0x2be0('0x10')]('/:id',auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x2be0('0x11')]);module[_0x2be0('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 747937e..6d4ece6 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 _0x4645=['exports','name','STRING','sequelize'];(function(_0x5bfdfd,_0x13e70a){var _0x5e6d42=function(_0x17a462){while(--_0x17a462){_0x5bfdfd['push'](_0x5bfdfd['shift']());}};_0x5e6d42(++_0x13e70a);}(_0x4645,0x1cf));var _0x5464=function(_0x37f4c0,_0x3e73ff){_0x37f4c0=_0x37f4c0-0x0;var _0x589bdd=_0x4645[_0x37f4c0];return _0x589bdd;};'use strict';var Sequelize=require(_0x5464('0x0'));module[_0x5464('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x5464('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x5464('0x3')]}}; \ No newline at end of file +var _0xb813=['sequelize','exports','STRING'];(function(_0x19b3f9,_0xade753){var _0x18c3f6=function(_0x21439f){while(--_0x21439f){_0x19b3f9['push'](_0x19b3f9['shift']());}};_0x18c3f6(++_0xade753);}(_0xb813,0x15c));var _0x3b81=function(_0x21d6c4,_0x2ef6c5){_0x21d6c4=_0x21d6c4-0x0;var _0x6f06c0=_0xb813[_0x21d6c4];return _0x6f06c0;};'use strict';var Sequelize=require(_0x3b81('0x0'));module[_0x3b81('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x3b81('0x2')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index a1ecd38..855c3d2 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 _0x794b=['autoAssociation','create','update','body','params','eml-format','bluebird','mustache','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','save','then','destroy','get','Variables','UserProfileResource','error','name','send','map','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','includeAll','Variable','findAll','rows','catch','keys','length','include','options','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','find','userProfileId'];(function(_0x4a5bb2,_0x36ce56){var _0x38c97a=function(_0x4d1990){while(--_0x4d1990){_0x4a5bb2['push'](_0x4a5bb2['shift']());}};_0x38c97a(++_0x36ce56);}(_0x794b,0x99));var _0xb794=function(_0x3f156a,_0x4b9a0c){_0x3f156a=_0x3f156a-0x0;var _0x14f6f8=_0x794b[_0x3f156a];return _0x14f6f8;};'use strict';var emlformat=require(_0xb794('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xb794('0x1'));var Mustache=require(_0xb794('0x2'));var util=require('util');var path=require('path');var sox=require(_0xb794('0x3'));var csv=require(_0xb794('0x4'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb794('0x5'));var _=require('lodash');var squel=require(_0xb794('0x6'));var crypto=require(_0xb794('0x7'));var jsforce=require(_0xb794('0x8'));var deskjs=require(_0xb794('0x9'));var toCsv=require('to-csv');var querystring=require(_0xb794('0xa'));var Papa=require(_0xb794('0xb'));var Redis=require(_0xb794('0xc'));var authService=require(_0xb794('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0xb794('0xe'));var hardwareService=require(_0xb794('0xf'));var logger=require('../../config/logger')(_0xb794('0x10'));var utils=require(_0xb794('0x11'));var config=require(_0xb794('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0xb794('0x13'))['db'];function respondWithStatusCode(_0x5d7368,_0x21e5ba){_0x21e5ba=_0x21e5ba||0xcc;return function(_0x2bbf02){if(_0x2bbf02){return _0x5d7368[_0xb794('0x14')](_0x21e5ba);}return _0x5d7368[_0xb794('0x15')](_0x21e5ba)[_0xb794('0x16')]();};}function respondWithResult(_0x552a29,_0x331961){_0x331961=_0x331961||0xc8;return function(_0x11e9a0){if(_0x11e9a0){return _0x552a29['status'](_0x331961)[_0xb794('0x17')](_0x11e9a0);}};}function respondWithFilteredResult(_0x3632a2,_0x2a8bf2){return function(_0x1352f7){if(_0x1352f7){var _0x57d23e=typeof _0x2a8bf2[_0xb794('0x18')]===_0xb794('0x19')&&typeof _0x2a8bf2[_0xb794('0x1a')]===_0xb794('0x19');var _0x544b98=_0x1352f7[_0xb794('0x1b')];var _0x10e969=_0x57d23e?0x0:_0x2a8bf2['offset'];var _0x2f3812=_0x57d23e?_0x1352f7[_0xb794('0x1b')]:_0x2a8bf2[_0xb794('0x18')]+_0x2a8bf2[_0xb794('0x1a')];var _0x1cfcf3;if(_0x2f3812>=_0x544b98){_0x2f3812=_0x544b98;_0x1cfcf3=0xc8;}else{_0x1cfcf3=0xce;}_0x3632a2[_0xb794('0x15')](_0x1cfcf3);return _0x3632a2['set']('Content-Range',_0x10e969+'-'+_0x2f3812+'/'+_0x544b98)[_0xb794('0x17')](_0x1352f7);}return null;};}function patchUpdates(_0x2f6818){return function(_0x58ab95){try{jsonpatch[_0xb794('0x1c')](_0x58ab95,_0x2f6818,!![]);}catch(_0xacef96){return BPromise[_0xb794('0x1d')](_0xacef96);}return _0x58ab95[_0xb794('0x1e')]();};}function saveUpdates(_0xfcf27d,_0x35c32c){return function(_0x43ed64){if(_0x43ed64){return _0x43ed64['update'](_0xfcf27d)[_0xb794('0x1f')](function(_0x5c16a9){return _0x5c16a9;});}return null;};}function removeEntity(_0x2f86a3,_0x3337d8){return function(_0x26c2e7){if(_0x26c2e7){return _0x26c2e7[_0xb794('0x20')]()['then'](function(){var _0x3bb7e7=_0x26c2e7[_0xb794('0x21')]({'plain':!![]});var _0x35d59f=_0xb794('0x22');return db[_0xb794('0x23')][_0xb794('0x20')]({'where':{'type':_0x35d59f,'resourceId':_0x3bb7e7['id']}})['then'](function(){return _0x26c2e7;});})[_0xb794('0x1f')](function(){_0x2f86a3[_0xb794('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0xa00ee8,_0xfd378f){return function(_0x13468d){if(!_0x13468d){_0xa00ee8[_0xb794('0x14')](0x194);}return _0x13468d;};}function handleError(_0x2e3cb2,_0x15b347){_0x15b347=_0x15b347||0x1f4;return function(_0x42b09f){logger[_0xb794('0x24')](_0x42b09f['stack']);if(_0x42b09f[_0xb794('0x25')]){delete _0x42b09f['name'];}_0x2e3cb2[_0xb794('0x15')](_0x15b347)[_0xb794('0x26')](_0x42b09f);};}exports['index']=function(_0x25bb90,_0x5b4da5){var _0x215749={},_0x588dc7={},_0x4cefce={'count':0x0,'rows':[]};var _0x10564d=_[_0xb794('0x27')](db['Variable'][_0xb794('0x28')],function(_0x5d1b35){return{'name':_0x5d1b35[_0xb794('0x29')],'type':_0x5d1b35['type'][_0xb794('0x2a')]};});_0x588dc7[_0xb794('0x2b')]=_[_0xb794('0x27')](_0x10564d,_0xb794('0x25'));_0x588dc7[_0xb794('0x2c')]=_['keys'](_0x25bb90[_0xb794('0x2c')]);_0x588dc7[_0xb794('0x2d')]=_[_0xb794('0x2e')](_0x588dc7[_0xb794('0x2b')],_0x588dc7[_0xb794('0x2c')]);_0x215749[_0xb794('0x2f')]=_[_0xb794('0x2e')](_0x588dc7[_0xb794('0x2b')],qs['fields'](_0x25bb90[_0xb794('0x2c')]['fields']));_0x215749[_0xb794('0x2f')]=_0x215749['attributes']['length']?_0x215749['attributes']:_0x588dc7['model'];if(!_0x25bb90[_0xb794('0x2c')][_0xb794('0x30')](_0xb794('0x31'))){_0x215749[_0xb794('0x1a')]=qs[_0xb794('0x1a')](_0x25bb90[_0xb794('0x2c')][_0xb794('0x1a')]);_0x215749['offset']=qs[_0xb794('0x18')](_0x25bb90['query'][_0xb794('0x18')]);}_0x215749['order']=qs[_0xb794('0x32')](_0x25bb90[_0xb794('0x2c')][_0xb794('0x32')]);_0x215749[_0xb794('0x33')]=qs[_0xb794('0x2d')](_[_0xb794('0x34')](_0x25bb90['query'],_0x588dc7[_0xb794('0x2d')]),_0x10564d);if(_0x25bb90[_0xb794('0x2c')]['filter']){_0x215749[_0xb794('0x33')]=_[_0xb794('0x35')](_0x215749[_0xb794('0x33')],{'$or':_['map'](_0x10564d,function(_0x4b8abd){if(_0x4b8abd['type']!==_0xb794('0x36')){var _0x3344f3={};_0x3344f3[_0x4b8abd['name']]={'$like':'%'+_0x25bb90[_0xb794('0x2c')]['filter']+'%'};return _0x3344f3;}})});}_0x215749=_[_0xb794('0x35')]({},_0x215749,_0x25bb90['options']);var _0x275623={'where':_0x215749[_0xb794('0x33')]};return db['Variable']['count'](_0x275623)[_0xb794('0x1f')](function(_0x554365){_0x4cefce['count']=_0x554365;if(_0x25bb90['query'][_0xb794('0x37')]){_0x215749['include']=[{'all':!![]}];}return db[_0xb794('0x38')][_0xb794('0x39')](_0x215749);})[_0xb794('0x1f')](function(_0x2cfe4a){_0x4cefce[_0xb794('0x3a')]=_0x2cfe4a;return _0x4cefce;})['then'](respondWithFilteredResult(_0x5b4da5,_0x215749))[_0xb794('0x3b')](handleError(_0x5b4da5,null));};exports['show']=function(_0x344fa5,_0x284ee9){var _0x254825={'raw':!![],'where':{'id':_0x344fa5['params']['id']}},_0x4e81b9={};_0x4e81b9[_0xb794('0x2b')]=_[_0xb794('0x3c')](db['Variable']['rawAttributes']);_0x4e81b9[_0xb794('0x2c')]=_[_0xb794('0x3c')](_0x344fa5[_0xb794('0x2c')]);_0x4e81b9[_0xb794('0x2d')]=_[_0xb794('0x2e')](_0x4e81b9['model'],_0x4e81b9[_0xb794('0x2c')]);_0x254825[_0xb794('0x2f')]=_[_0xb794('0x2e')](_0x4e81b9[_0xb794('0x2b')],qs['fields'](_0x344fa5['query']['fields']));_0x254825[_0xb794('0x2f')]=_0x254825[_0xb794('0x2f')][_0xb794('0x3d')]?_0x254825[_0xb794('0x2f')]:_0x4e81b9['model'];if(_0x344fa5[_0xb794('0x2c')][_0xb794('0x37')]){_0x254825[_0xb794('0x3e')]=[{'all':!![]}];}_0x254825=_['merge']({},_0x254825,_0x344fa5[_0xb794('0x3f')]);return db[_0xb794('0x38')]['find'](_0x254825)[_0xb794('0x1f')](handleEntityNotFound(_0x284ee9,null))['then'](respondWithResult(_0x284ee9,null))['catch'](handleError(_0x284ee9,null));};exports['create']=function(_0x3e6cb9,_0x1b4952){return db[_0xb794('0x38')]['create'](_0x3e6cb9['body'],{})[_0xb794('0x1f')](function(_0xa82ce3){var _0x4af935=_0x3e6cb9['user']['get']({'plain':!![]});if(!_0x4af935)throw new Error(_0xb794('0x40'));if(_0x4af935['role']===_0xb794('0x41')){var _0x2f5fe0=_0xa82ce3[_0xb794('0x21')]({'plain':!![]});var _0x30b447='Variables';return db[_0xb794('0x42')][_0xb794('0x43')]({'where':{'name':_0x30b447,'userProfileId':_0x4af935[_0xb794('0x44')]},'raw':!![]})[_0xb794('0x1f')](function(_0x5610f4){if(_0x5610f4&&_0x5610f4[_0xb794('0x45')]===0x0){return db[_0xb794('0x23')][_0xb794('0x46')]({'name':_0x2f5fe0[_0xb794('0x25')],'resourceId':_0x2f5fe0['id'],'type':_0x5610f4['name'],'sectionId':_0x5610f4['id']},{})[_0xb794('0x1f')](function(){return _0xa82ce3;});}else{return _0xa82ce3;}})[_0xb794('0x3b')](function(_0xdb2469){logger[_0xb794('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xdb2469);throw _0xdb2469;});}return _0xa82ce3;})[_0xb794('0x1f')](respondWithResult(_0x1b4952,0xc9))[_0xb794('0x3b')](handleError(_0x1b4952,null));};exports[_0xb794('0x47')]=function(_0x3639f0,_0x9c26f4){if(_0x3639f0[_0xb794('0x48')]['id']){delete _0x3639f0[_0xb794('0x48')]['id'];}return db[_0xb794('0x38')]['find']({'where':{'id':_0x3639f0['params']['id']}})[_0xb794('0x1f')](handleEntityNotFound(_0x9c26f4,null))['then'](saveUpdates(_0x3639f0[_0xb794('0x48')],null))[_0xb794('0x1f')](respondWithResult(_0x9c26f4,null))[_0xb794('0x3b')](handleError(_0x9c26f4,null));};exports['destroy']=function(_0x3e93ab,_0xd1f387){return db[_0xb794('0x38')]['find']({'where':{'id':_0x3e93ab[_0xb794('0x49')]['id']}})[_0xb794('0x1f')](handleEntityNotFound(_0xd1f387,null))[_0xb794('0x1f')](removeEntity(_0xd1f387,null))['catch'](handleError(_0xd1f387,null));}; \ No newline at end of file +var _0x3459=['user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','Content-Range','apply','save','then','get','UserProfileResource','error','stack','name','map','Variable','rawAttributes','fieldName','key','model','keys','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','options','includeAll','include','findAll','catch','show','params','length','merge','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user'];(function(_0x1147ab,_0x10e72b){var _0x55cb5a=function(_0x364bd6){while(--_0x364bd6){_0x1147ab['push'](_0x1147ab['shift']());}};_0x55cb5a(++_0x10e72b);}(_0x3459,0xef));var _0x9345=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x3459[_0x397e5f];return _0x5302b8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9345('0x0'));var zipdir=require(_0x9345('0x1'));var jsonpatch=require(_0x9345('0x2'));var rp=require(_0x9345('0x3'));var moment=require(_0x9345('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9345('0x5'));var util=require(_0x9345('0x6'));var path=require(_0x9345('0x7'));var sox=require('sox');var csv=require(_0x9345('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9345('0x9'));var squel=require(_0x9345('0xa'));var crypto=require(_0x9345('0xb'));var jsforce=require(_0x9345('0xc'));var deskjs=require(_0x9345('0xd'));var toCsv=require(_0x9345('0x8'));var querystring=require(_0x9345('0xe'));var Papa=require('papaparse');var Redis=require(_0x9345('0xf'));var authService=require(_0x9345('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9345('0x11'));var logger=require(_0x9345('0x12'))(_0x9345('0x13'));var utils=require(_0x9345('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x9345('0x15'));var db=require(_0x9345('0x16'))['db'];function respondWithStatusCode(_0x3684a4,_0x631130){_0x631130=_0x631130||0xcc;return function(_0x5eb29a){if(_0x5eb29a){return _0x3684a4[_0x9345('0x17')](_0x631130);}return _0x3684a4['status'](_0x631130)[_0x9345('0x18')]();};}function respondWithResult(_0xe5d788,_0x16c0e8){_0x16c0e8=_0x16c0e8||0xc8;return function(_0x142608){if(_0x142608){return _0xe5d788[_0x9345('0x19')](_0x16c0e8)[_0x9345('0x1a')](_0x142608);}};}function respondWithFilteredResult(_0x1188e1,_0xd50dc6){return function(_0x464fa2){if(_0x464fa2){var _0x5177b3=typeof _0xd50dc6['offset']===_0x9345('0x1b')&&typeof _0xd50dc6[_0x9345('0x1c')]===_0x9345('0x1b');var _0x2ed126=_0x464fa2[_0x9345('0x1d')];var _0x122e03=_0x5177b3?0x0:_0xd50dc6[_0x9345('0x1e')];var _0x15007a=_0x5177b3?_0x464fa2[_0x9345('0x1d')]:_0xd50dc6['offset']+_0xd50dc6[_0x9345('0x1c')];var _0x420f1a;if(_0x15007a>=_0x2ed126){_0x15007a=_0x2ed126;_0x420f1a=0xc8;}else{_0x420f1a=0xce;}_0x1188e1['status'](_0x420f1a);return _0x1188e1['set'](_0x9345('0x1f'),_0x122e03+'-'+_0x15007a+'/'+_0x2ed126)['json'](_0x464fa2);}return null;};}function patchUpdates(_0x3d77c4){return function(_0xa9c130){try{jsonpatch[_0x9345('0x20')](_0xa9c130,_0x3d77c4,!![]);}catch(_0x4f28de){return BPromise['reject'](_0x4f28de);}return _0xa9c130[_0x9345('0x21')]();};}function saveUpdates(_0x1390ed,_0x59876a){return function(_0x36cab9){if(_0x36cab9){return _0x36cab9['update'](_0x1390ed)[_0x9345('0x22')](function(_0x22ea24){return _0x22ea24;});}return null;};}function removeEntity(_0xeb3578,_0xb044b){return function(_0x5c73bd){if(_0x5c73bd){return _0x5c73bd['destroy']()[_0x9345('0x22')](function(){var _0x5199b8=_0x5c73bd[_0x9345('0x23')]({'plain':!![]});var _0x3fee8d='Variables';return db[_0x9345('0x24')]['destroy']({'where':{'type':_0x3fee8d,'resourceId':_0x5199b8['id']}})[_0x9345('0x22')](function(){return _0x5c73bd;});})[_0x9345('0x22')](function(){_0xeb3578[_0x9345('0x19')](0xcc)[_0x9345('0x18')]();});}};}function handleEntityNotFound(_0x1d1269,_0x377317){return function(_0x1d2402){if(!_0x1d2402){_0x1d1269['sendStatus'](0x194);}return _0x1d2402;};}function handleError(_0x4aef78,_0x3b6b6d){_0x3b6b6d=_0x3b6b6d||0x1f4;return function(_0x18afa7){logger[_0x9345('0x25')](_0x18afa7[_0x9345('0x26')]);if(_0x18afa7[_0x9345('0x27')]){delete _0x18afa7[_0x9345('0x27')];}_0x4aef78[_0x9345('0x19')](_0x3b6b6d)['send'](_0x18afa7);};}exports['index']=function(_0x8e460,_0x4dd382){var _0x2c9704={},_0x1cca32={},_0x5b6ea1={'count':0x0,'rows':[]};var _0x2493cb=_[_0x9345('0x28')](db[_0x9345('0x29')][_0x9345('0x2a')],function(_0x4c89a5){return{'name':_0x4c89a5[_0x9345('0x2b')],'type':_0x4c89a5['type'][_0x9345('0x2c')]};});_0x1cca32[_0x9345('0x2d')]=_['map'](_0x2493cb,_0x9345('0x27'));_0x1cca32['query']=_[_0x9345('0x2e')](_0x8e460[_0x9345('0x2f')]);_0x1cca32['filters']=_[_0x9345('0x30')](_0x1cca32['model'],_0x1cca32['query']);_0x2c9704[_0x9345('0x31')]=_[_0x9345('0x30')](_0x1cca32['model'],qs[_0x9345('0x32')](_0x8e460[_0x9345('0x2f')]['fields']));_0x2c9704[_0x9345('0x31')]=_0x2c9704[_0x9345('0x31')]['length']?_0x2c9704[_0x9345('0x31')]:_0x1cca32[_0x9345('0x2d')];if(!_0x8e460[_0x9345('0x2f')][_0x9345('0x33')](_0x9345('0x34'))){_0x2c9704[_0x9345('0x1c')]=qs[_0x9345('0x1c')](_0x8e460[_0x9345('0x2f')]['limit']);_0x2c9704['offset']=qs[_0x9345('0x1e')](_0x8e460['query'][_0x9345('0x1e')]);}_0x2c9704[_0x9345('0x35')]=qs[_0x9345('0x36')](_0x8e460[_0x9345('0x2f')][_0x9345('0x36')]);_0x2c9704[_0x9345('0x37')]=qs[_0x9345('0x38')](_[_0x9345('0x39')](_0x8e460[_0x9345('0x2f')],_0x1cca32[_0x9345('0x38')]),_0x2493cb);if(_0x8e460[_0x9345('0x2f')][_0x9345('0x3a')]){_0x2c9704[_0x9345('0x37')]=_['merge'](_0x2c9704[_0x9345('0x37')],{'$or':_[_0x9345('0x28')](_0x2493cb,function(_0x489a7e){if(_0x489a7e['type']!==_0x9345('0x3b')){var _0x2fd66b={};_0x2fd66b[_0x489a7e['name']]={'$like':'%'+_0x8e460[_0x9345('0x2f')][_0x9345('0x3a')]+'%'};return _0x2fd66b;}})});}_0x2c9704=_['merge']({},_0x2c9704,_0x8e460[_0x9345('0x3c')]);var _0x2e5645={'where':_0x2c9704['where']};return db[_0x9345('0x29')][_0x9345('0x1d')](_0x2e5645)['then'](function(_0x3f5fe2){_0x5b6ea1[_0x9345('0x1d')]=_0x3f5fe2;if(_0x8e460['query'][_0x9345('0x3d')]){_0x2c9704[_0x9345('0x3e')]=[{'all':!![]}];}return db[_0x9345('0x29')][_0x9345('0x3f')](_0x2c9704);})['then'](function(_0x901a92){_0x5b6ea1['rows']=_0x901a92;return _0x5b6ea1;})[_0x9345('0x22')](respondWithFilteredResult(_0x4dd382,_0x2c9704))[_0x9345('0x40')](handleError(_0x4dd382,null));};exports[_0x9345('0x41')]=function(_0x513b78,_0x3cd51c){var _0xce491d={'raw':!![],'where':{'id':_0x513b78[_0x9345('0x42')]['id']}},_0x58c52a={};_0x58c52a[_0x9345('0x2d')]=_[_0x9345('0x2e')](db[_0x9345('0x29')]['rawAttributes']);_0x58c52a['query']=_[_0x9345('0x2e')](_0x513b78[_0x9345('0x2f')]);_0x58c52a[_0x9345('0x38')]=_['intersection'](_0x58c52a[_0x9345('0x2d')],_0x58c52a['query']);_0xce491d['attributes']=_[_0x9345('0x30')](_0x58c52a[_0x9345('0x2d')],qs[_0x9345('0x32')](_0x513b78[_0x9345('0x2f')]['fields']));_0xce491d['attributes']=_0xce491d[_0x9345('0x31')][_0x9345('0x43')]?_0xce491d[_0x9345('0x31')]:_0x58c52a[_0x9345('0x2d')];if(_0x513b78[_0x9345('0x2f')][_0x9345('0x3d')]){_0xce491d['include']=[{'all':!![]}];}_0xce491d=_[_0x9345('0x44')]({},_0xce491d,_0x513b78[_0x9345('0x3c')]);return db[_0x9345('0x29')][_0x9345('0x45')](_0xce491d)[_0x9345('0x22')](handleEntityNotFound(_0x3cd51c,null))[_0x9345('0x22')](respondWithResult(_0x3cd51c,null))['catch'](handleError(_0x3cd51c,null));};exports['create']=function(_0x56b635,_0x5e59ca){return db['Variable'][_0x9345('0x46')](_0x56b635[_0x9345('0x47')],{})[_0x9345('0x22')](function(_0x162a9f){var _0x2b522e=_0x56b635['user']['get']({'plain':!![]});if(!_0x2b522e)throw new Error(_0x9345('0x48'));if(_0x2b522e['role']===_0x9345('0x49')){var _0x30640b=_0x162a9f[_0x9345('0x23')]({'plain':!![]});var _0x5d081b='Variables';return db[_0x9345('0x4a')][_0x9345('0x45')]({'where':{'name':_0x5d081b,'userProfileId':_0x2b522e[_0x9345('0x4b')]},'raw':!![]})[_0x9345('0x22')](function(_0x3a922d){if(_0x3a922d&&_0x3a922d['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x30640b[_0x9345('0x27')],'resourceId':_0x30640b['id'],'type':_0x3a922d[_0x9345('0x27')],'sectionId':_0x3a922d['id']},{})['then'](function(){return _0x162a9f;});}else{return _0x162a9f;}})[_0x9345('0x40')](function(_0x4b9149){logger[_0x9345('0x25')](_0x9345('0x4c'),_0x4b9149);throw _0x4b9149;});}return _0x162a9f;})['then'](respondWithResult(_0x5e59ca,0xc9))[_0x9345('0x40')](handleError(_0x5e59ca,null));};exports[_0x9345('0x4d')]=function(_0x306419,_0x5cad8b){if(_0x306419[_0x9345('0x47')]['id']){delete _0x306419[_0x9345('0x47')]['id'];}return db['Variable'][_0x9345('0x45')]({'where':{'id':_0x306419[_0x9345('0x42')]['id']}})[_0x9345('0x22')](handleEntityNotFound(_0x5cad8b,null))[_0x9345('0x22')](saveUpdates(_0x306419[_0x9345('0x47')],null))[_0x9345('0x22')](respondWithResult(_0x5cad8b,null))['catch'](handleError(_0x5cad8b,null));};exports['destroy']=function(_0x419f2e,_0x474ce8){return db[_0x9345('0x29')][_0x9345('0x45')]({'where':{'id':_0x419f2e[_0x9345('0x42')]['id']}})['then'](handleEntityNotFound(_0x474ce8,null))[_0x9345('0x22')](removeEntity(_0x474ce8,null))[_0x9345('0x40')](handleError(_0x474ce8,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index d291338..178659a 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 _0x2a06=['Variable','tools_variables','lodash','util','../../config/logger','api','request-promise','path','rimraf','./variable.attributes','exports','define'];(function(_0x9d27de,_0x5517e2){var _0x499bdf=function(_0x2ed520){while(--_0x2ed520){_0x9d27de['push'](_0x9d27de['shift']());}};_0x499bdf(++_0x5517e2);}(_0x2a06,0xb6));var _0x62a0=function(_0x488380,_0xfbd584){_0x488380=_0x488380-0x0;var _0x4fbf93=_0x2a06[_0x488380];return _0x4fbf93;};'use strict';var _=require(_0x62a0('0x0'));var util=require(_0x62a0('0x1'));var logger=require(_0x62a0('0x2'))(_0x62a0('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x62a0('0x4'));var fs=require('fs');var path=require(_0x62a0('0x5'));var rimraf=require(_0x62a0('0x6'));var config=require('../../config/environment');var attributes=require(_0x62a0('0x7'));module[_0x62a0('0x8')]=function(_0x4ee83e,_0x2773fb){return _0x4ee83e[_0x62a0('0x9')](_0x62a0('0xa'),attributes,{'tableName':_0x62a0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7d81=['bluebird','request-promise','path','./variable.attributes','define','Variable','tools_variables','util','../../config/logger','api','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7d81,0x6a));var _0x17d8=function(_0x2a1db7,_0x5dfed8){_0x2a1db7=_0x2a1db7-0x0;var _0x217a9d=_0x7d81[_0x2a1db7];return _0x217a9d;};'use strict';var _=require('lodash');var util=require(_0x17d8('0x0'));var logger=require(_0x17d8('0x1'))(_0x17d8('0x2'));var moment=require(_0x17d8('0x3'));var BPromise=require(_0x17d8('0x4'));var rp=require(_0x17d8('0x5'));var fs=require('fs');var path=require(_0x17d8('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x17d8('0x7'));module['exports']=function(_0x52a0f7,_0x528590){return _0x52a0f7[_0x17d8('0x8')](_0x17d8('0x9'),attributes,{'tableName':_0x17d8('0xa'),'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 f54b3fe..6e84bed 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 _0x5fc3=['info','request\x20sent','debug','stringify','error','code','message','Variable,\x20%s,\x20%s','result','catch','ShowVariable','find','options','where','attributes','include','map','model','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','request','then'];(function(_0x322efb,_0x539552){var _0x4245ca=function(_0x456790){while(--_0x456790){_0x322efb['push'](_0x322efb['shift']());}};_0x4245ca(++_0x539552);}(_0x5fc3,0xa8));var _0x35fc=function(_0x22eb96,_0x3c2d8d){_0x22eb96=_0x22eb96-0x0;var _0x5e1adf=_0x5fc3[_0x22eb96];return _0x5e1adf;};'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')]('Variable,\x20%s,\x20%s',_0x508b32,_0x35fc('0xd'));logger[_0x35fc('0xe')]('Variable,\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']('Variable,\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);});});}exports[_0x35fc('0x16')]=function(_0x553677){var _0x41e165=this;return new Promise(function(_0x363e47,_0x2e513b){return db['Variable'][_0x35fc('0x17')]({'raw':_0x553677[_0x35fc('0x18')]?_0x553677[_0x35fc('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x553677[_0x35fc('0x18')]?_0x553677[_0x35fc('0x18')][_0x35fc('0x19')]||null:null,'attributes':_0x553677[_0x35fc('0x18')]?_0x553677[_0x35fc('0x18')][_0x35fc('0x1a')]||null:null,'include':_0x553677[_0x35fc('0x18')]?_0x553677[_0x35fc('0x18')][_0x35fc('0x1b')]?_[_0x35fc('0x1c')](_0x553677['options'][_0x35fc('0x1b')],function(_0xd5399f){return{'model':db[_0xd5399f[_0x35fc('0x1d')]],'as':_0xd5399f['as'],'attributes':_0xd5399f[_0x35fc('0x1a')],'include':_0xd5399f[_0x35fc('0x1b')]?_['map'](_0xd5399f[_0x35fc('0x1b')],function(_0x4c587a){return{'model':db[_0x4c587a['model']],'as':_0x4c587a['as'],'attributes':_0x4c587a[_0x35fc('0x1a')],'include':_0x4c587a[_0x35fc('0x1b')]?_[_0x35fc('0x1c')](_0x4c587a['include'],function(_0x4086e9){return{'model':db[_0x4086e9['model']],'as':_0x4086e9['as'],'attributes':_0x4086e9[_0x35fc('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x35fc('0xb')](function(_0x5cb986){logger['info'](_0x35fc('0x16'),_0x553677);logger['debug'](_0x35fc('0x16'),_0x553677,JSON[_0x35fc('0xf')](_0x5cb986));_0x363e47(_0x5cb986);})['catch'](function(_0x26b7cb){logger[_0x35fc('0x10')](_0x35fc('0x16'),_0x26b7cb[_0x35fc('0x12')],_0x553677);_0x2e513b(_0x41e165[_0x35fc('0x10')](0x1f4,_0x26b7cb[_0x35fc('0x12')]));});});}; \ No newline at end of file +var _0xf494=['where','attributes','include','map','model','debug','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Variable,\x20%s,\x20%s','request\x20sent','Variable,\x20%s,\x20%s,\x20%s','error','message','catch','ShowVariable','find','options','raw'];(function(_0x4ae4a8,_0x29421e){var _0x5e2d74=function(_0x442198){while(--_0x442198){_0x4ae4a8['push'](_0x4ae4a8['shift']());}};_0x5e2d74(++_0x29421e);}(_0xf494,0x1c6));var _0x4f49=function(_0x131f4a,_0xfc35fb){_0x131f4a=_0x131f4a-0x0;var _0x41e0ee=_0xf494[_0x131f4a];return _0x41e0ee;};'use strict';var _=require(_0x4f49('0x0'));var util=require(_0x4f49('0x1'));var moment=require(_0x4f49('0x2'));var BPromise=require('bluebird');var rs=require(_0x4f49('0x3'));var fs=require('fs');var Redis=require(_0x4f49('0x4'));var db=require(_0x4f49('0x5'))['db'];var utils=require(_0x4f49('0x6'));var logger=require(_0x4f49('0x7'))(_0x4f49('0x8'));var config=require(_0x4f49('0x9'));var jayson=require(_0x4f49('0xa'));var client=jayson[_0x4f49('0xb')][_0x4f49('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x42b0e8,_0x5eb186,_0x58e9a0){return new BPromise(function(_0x169c95,_0x327bd5){return client[_0x4f49('0xd')](_0x42b0e8,_0x58e9a0)[_0x4f49('0xe')](function(_0x185174){logger[_0x4f49('0xf')](_0x4f49('0x10'),_0x5eb186,_0x4f49('0x11'));logger['debug'](_0x4f49('0x12'),_0x5eb186,_0x4f49('0x11'),JSON['stringify'](_0x185174));if(_0x185174[_0x4f49('0x13')]){if(_0x185174['error']['code']===0x1f4){logger[_0x4f49('0x13')](_0x4f49('0x10'),_0x5eb186,_0x185174['error'][_0x4f49('0x14')]);return _0x327bd5(_0x185174[_0x4f49('0x13')][_0x4f49('0x14')]);}logger[_0x4f49('0x13')](_0x4f49('0x10'),_0x5eb186,_0x185174[_0x4f49('0x13')][_0x4f49('0x14')]);return _0x169c95(_0x185174['error'][_0x4f49('0x14')]);}else{logger[_0x4f49('0xf')](_0x4f49('0x10'),_0x5eb186,'request\x20sent');_0x169c95(_0x185174['result'][_0x4f49('0x14')]);}})[_0x4f49('0x15')](function(_0x74886e){logger['error'](_0x4f49('0x10'),_0x5eb186,_0x74886e);_0x327bd5(_0x74886e);});});}exports[_0x4f49('0x16')]=function(_0x4e85df){var _0x49cdaf=this;return new Promise(function(_0x5bb23b,_0x560592){return db['Variable'][_0x4f49('0x17')]({'raw':_0x4e85df[_0x4f49('0x18')]?_0x4e85df[_0x4f49('0x18')][_0x4f49('0x19')]===undefined?!![]:![]:!![],'where':_0x4e85df['options']?_0x4e85df[_0x4f49('0x18')][_0x4f49('0x1a')]||null:null,'attributes':_0x4e85df[_0x4f49('0x18')]?_0x4e85df[_0x4f49('0x18')][_0x4f49('0x1b')]||null:null,'include':_0x4e85df['options']?_0x4e85df[_0x4f49('0x18')][_0x4f49('0x1c')]?_[_0x4f49('0x1d')](_0x4e85df['options'][_0x4f49('0x1c')],function(_0x1d70a7){return{'model':db[_0x1d70a7[_0x4f49('0x1e')]],'as':_0x1d70a7['as'],'attributes':_0x1d70a7[_0x4f49('0x1b')],'include':_0x1d70a7[_0x4f49('0x1c')]?_[_0x4f49('0x1d')](_0x1d70a7['include'],function(_0x4e9041){return{'model':db[_0x4e9041[_0x4f49('0x1e')]],'as':_0x4e9041['as'],'attributes':_0x4e9041[_0x4f49('0x1b')],'include':_0x4e9041['include']?_[_0x4f49('0x1d')](_0x4e9041[_0x4f49('0x1c')],function(_0x35f8e0){return{'model':db[_0x35f8e0['model']],'as':_0x35f8e0['as'],'attributes':_0x35f8e0[_0x4f49('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x4f49('0xe')](function(_0x298785){logger[_0x4f49('0xf')](_0x4f49('0x16'),_0x4e85df);logger[_0x4f49('0x1f')]('ShowVariable',_0x4e85df,JSON['stringify'](_0x298785));_0x5bb23b(_0x298785);})[_0x4f49('0x15')](function(_0x2c00ee){logger[_0x4f49('0x13')]('ShowVariable',_0x2c00ee[_0x4f49('0x14')],_0x4e85df);_0x560592(_0x49cdaf[_0x4f49('0x13')](0x1f4,_0x2c00ee[_0x4f49('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index b536240..2bc8647 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 _0x36f6=['pull','restart','exports','express','Router','../../components/auth/service','./version.controller','get','index','/fetch','canUpdate','fetch','/reset','isAuthenticated','reset','/pull'];(function(_0x435044,_0x36ab8e){var _0x33d4c6=function(_0x15efa0){while(--_0x15efa0){_0x435044['push'](_0x435044['shift']());}};_0x33d4c6(++_0x36ab8e);}(_0x36f6,0x163));var _0x636f=function(_0x44dba1,_0x270ad5){_0x44dba1=_0x44dba1-0x0;var _0x2fbd3f=_0x36f6[_0x44dba1];return _0x2fbd3f;};'use strict';var express=require(_0x636f('0x0'));var router=express[_0x636f('0x1')]();var auth=require(_0x636f('0x2'));var controller=require(_0x636f('0x3'));router[_0x636f('0x4')]('/',controller[_0x636f('0x5')]);router['get'](_0x636f('0x6'),auth['isAuthenticated'](),auth[_0x636f('0x7')](),controller[_0x636f('0x8')]);router[_0x636f('0x4')](_0x636f('0x9'),auth[_0x636f('0xa')](),auth[_0x636f('0x7')](),controller[_0x636f('0xb')]);router[_0x636f('0x4')](_0x636f('0xc'),auth[_0x636f('0xa')](),auth[_0x636f('0x7')](),controller[_0x636f('0xd')]);router[_0x636f('0x4')]('/restart',auth[_0x636f('0xa')](),controller[_0x636f('0xe')]);router[_0x636f('0x4')]('/migrations',controller['migrations']);module[_0x636f('0xf')]=router; \ No newline at end of file +var _0x0632=['../../components/auth/service','index','isAuthenticated','get','/reset','canUpdate','reset','/pull','pull','/restart','restart','exports'];(function(_0x5d1945,_0x19e859){var _0xb90287=function(_0x4f18a1){while(--_0x4f18a1){_0x5d1945['push'](_0x5d1945['shift']());}};_0xb90287(++_0x19e859);}(_0x0632,0x108));var _0x2063=function(_0x301dab,_0x38050a){_0x301dab=_0x301dab-0x0;var _0x2500a2=_0x0632[_0x301dab];return _0x2500a2;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0x2063('0x0'));var controller=require('./version.controller');router['get']('/',controller[_0x2063('0x1')]);router['get']('/fetch',auth[_0x2063('0x2')](),auth['canUpdate'](),controller['fetch']);router[_0x2063('0x3')](_0x2063('0x4'),auth[_0x2063('0x2')](),auth[_0x2063('0x5')](),controller[_0x2063('0x6')]);router['get'](_0x2063('0x7'),auth['isAuthenticated'](),auth['canUpdate'](),controller[_0x2063('0x8')]);router[_0x2063('0x3')](_0x2063('0x9'),auth[_0x2063('0x2')](),controller[_0x2063('0xa')]);router[_0x2063('0x3')]('/migrations',controller['migrations']);module[_0x2063('0xb')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index ce2af82..4a0ad92 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 _0x1257=['constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','migrations','map','.js','\x20to\x20','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','lodash','version','compare-versions','child_process','exec','../../mysqldb','../../config/pm2','../../config/logger','simple-git','root','index','query','latest','tags','exports','2.0.0','status','json','fetch','origin','master','error','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','restart','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','join','server','length','replace','push','sort','Migration','sequelize'];(function(_0x450b9b,_0x1b91d2){var _0x5f5d00=function(_0x335dca){while(--_0x335dca){_0x450b9b['push'](_0x450b9b['shift']());}};_0x5f5d00(++_0x1b91d2);}(_0x1257,0xdc));var _0x7125=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0x1257[_0x580576];return _0x3f55a0;};'use strict';var Umzug=require(_0x7125('0x0'));var path=require('path');var fs=require('fs');var _=require(_0x7125('0x1'));var pkginfo=require('pkginfo')(module,_0x7125('0x2'));var compareVersions=require(_0x7125('0x3'));var exec=require(_0x7125('0x4'))[_0x7125('0x5')];var db=require(_0x7125('0x6'))['db'];var config=require('../../config/environment');var pm2=require(_0x7125('0x7'));var logger=require(_0x7125('0x8'))('update');var git=require(_0x7125('0x9'))(config[_0x7125('0xa')]);exports[_0x7125('0xb')]=function(_0x346de1,_0x4f6984){var _0x54fe45={'current':module['exports'][_0x7125('0x2')],'phonebar':0x2};if(_0x346de1[_0x7125('0xc')]&&_0x346de1[_0x7125('0xc')][_0x7125('0xd')]){return git['fetch']()[_0x7125('0xe')](function(_0x74c6f7,_0xad3560){_0x54fe45[_0x7125('0xd')]=(_0x74c6f7?module[_0x7125('0xf')][_0x7125('0x2')]:_0xad3560['latest'])||_0x7125('0x10');return _0x4f6984[_0x7125('0x11')](0xc8)[_0x7125('0x12')](_0x54fe45);});}else{return _0x4f6984[_0x7125('0x11')](0xc8)[_0x7125('0x12')](_0x54fe45);}};exports[_0x7125('0x13')]=function(_0x1ecdfb,_0x23b202){return git[_0x7125('0x13')]([_0x7125('0x14'),_0x7125('0x15')],function(_0xb0edc7){if(_0xb0edc7){logger[_0x7125('0x16')](_0xb0edc7);return _0x23b202[_0x7125('0x11')](0x1f4)['json'](_0xb0edc7);}logger[_0x7125('0x17')](_0x7125('0x18'));return _0x23b202['status'](0xc8)[_0x7125('0x12')]({'output':_0x7125('0x19')});});};exports[_0x7125('0x1a')]=function(_0x3f9123,_0x176d00){return git['reset']([_0x7125('0x1b'),_0x7125('0x1c')],function(_0x13e5d1){if(_0x13e5d1){logger[_0x7125('0x16')](_0x13e5d1);return _0x176d00[_0x7125('0x11')](0x1f4)[_0x7125('0x12')](_0x13e5d1);}logger[_0x7125('0x17')](_0x7125('0x1d'));return _0x176d00[_0x7125('0x11')](0xc8)[_0x7125('0x12')]({'output':_0x7125('0x1e')});});};exports[_0x7125('0x1f')]=function(_0x35ac62,_0x49c217){exec('npm\x20install\x20--production',function(_0x5a8893,_0x44eff0,_0x3f7e8e){logger['info'](_0x44eff0);logger[_0x7125('0x17')](_0x3f7e8e);if(_0x5a8893){logger[_0x7125('0x16')](_0x5a8893);return _0x49c217[_0x7125('0x11')](0x1f4)[_0x7125('0x12')](_0x5a8893);}return _0x49c217['status'](0xc8)[_0x7125('0x12')]({'output':_0x44eff0});});};exports[_0x7125('0x20')]=function(_0x1d940e,_0x2e819f){return pm2[_0x7125('0x20')]('motion2')[_0x7125('0x21')](function(_0x2d70bf){logger[_0x7125('0x17')](_0x7125('0x22'),_0x2d70bf);return _0x2e819f[_0x7125('0x11')](0xc8)[_0x7125('0x12')]({'output':_0x7125('0x23')});})[_0x7125('0x24')](function(_0x127a49){logger[_0x7125('0x16')](_0x127a49);return _0x2e819f['status'](0x1f4)[_0x7125('0x12')](_0x127a49);});};exports['migrations']=function(_0x2aec91,_0x2a7a7f){var _0xa1683d=fs['readdirSync'](path[_0x7125('0x25')](config[_0x7125('0xa')],_0x7125('0x26'),'migrations'));var _0x2010a6=[];for(var _0x28a298=0x0;_0x28a298<_0xa1683d[_0x7125('0x27')];_0x28a298++){var _0xee25c7=_0xa1683d[_0x28a298][_0x7125('0x28')]('.js','');if(compareVersions(module[_0x7125('0xf')][_0x7125('0x2')],_0xee25c7)===-0x1){_0x2010a6[_0x7125('0x29')](_0xee25c7);}}if(_0x2010a6[_0x7125('0x27')]){var _0x545899=_0x2010a6[_0x7125('0x2a')](compareVersions);var _0x48e013=new Umzug({'storage':'sequelize','storageOptions':{'model':db[_0x7125('0x2b')],'modelName':'Migration','columnName':_0x7125('0x2')},'migrations':{'params':[db[_0x7125('0x2c')]['getQueryInterface'](),db[_0x7125('0x2c')][_0x7125('0x2d')],function(){throw new Error(_0x7125('0x2e'));}],'path':path[_0x7125('0x25')](config[_0x7125('0xa')],_0x7125('0x26'),_0x7125('0x2f')),'pattern':/\.js$/}});_0x48e013['up']({'migrations':_[_0x7125('0x30')](_0x545899,function(_0x136c06){return _0x136c06+_0x7125('0x31');})})['then'](function(){return _0x2a7a7f[_0x7125('0x11')](0xc8)[_0x7125('0x12')]({'output':'Database\x20migrated\x20successfully\x20from\x20version\x20'+module['exports'][_0x7125('0x2')]+_0x7125('0x32')+_['last'](_0x545899),'migrations':_[_0x7125('0x25')](_0x545899)});})[_0x7125('0x24')](function(_0x593af0){if(_0x593af0 instanceof db['sequelize'][_0x7125('0x33')]){return _0x2a7a7f[_0x7125('0x11')](0xc8)['json']({'output':'Database\x20already\x20up-to-date'});}else{return _0x2a7a7f[_0x7125('0x11')](0x1f4)[_0x7125('0x12')](_0x593af0);}});}else{return _0x2a7a7f[_0x7125('0x11')](0xc8)['json']({'output':_0x7125('0x34')});}}; \ No newline at end of file +var _0x1e65=['exports','query','latest','tags','json','status','fetch','origin','master','error','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync','join','.js','push','length','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.','root','server','then','\x20to\x20','last','Database\x20already\x20up-to-date','path','pkginfo','version','child_process','../../config/environment','../../config/pm2','update','simple-git','index'];(function(_0x4ff939,_0x5f54ea){var _0x3f8ba8=function(_0x25e6f7){while(--_0x25e6f7){_0x4ff939['push'](_0x4ff939['shift']());}};_0x3f8ba8(++_0x5f54ea);}(_0x1e65,0x17f));var _0x51e6=function(_0x1ebc4b,_0xef6d40){_0x1ebc4b=_0x1ebc4b-0x0;var _0x394c4f=_0x1e65[_0x1ebc4b];return _0x394c4f;};'use strict';var Umzug=require('umzug');var path=require(_0x51e6('0x0'));var fs=require('fs');var _=require('lodash');var pkginfo=require(_0x51e6('0x1'))(module,_0x51e6('0x2'));var compareVersions=require('compare-versions');var exec=require(_0x51e6('0x3'))['exec'];var db=require('../../mysqldb')['db'];var config=require(_0x51e6('0x4'));var pm2=require(_0x51e6('0x5'));var logger=require('../../config/logger')(_0x51e6('0x6'));var git=require(_0x51e6('0x7'))(config['root']);exports[_0x51e6('0x8')]=function(_0x43d649,_0x6c5c01){var _0x54b1aa={'current':module[_0x51e6('0x9')][_0x51e6('0x2')],'phonebar':0x2};if(_0x43d649[_0x51e6('0xa')]&&_0x43d649[_0x51e6('0xa')][_0x51e6('0xb')]){return git['fetch']()[_0x51e6('0xc')](function(_0x992782,_0x48b6dc){_0x54b1aa['latest']=(_0x992782?module[_0x51e6('0x9')]['version']:_0x48b6dc[_0x51e6('0xb')])||'2.0.0';return _0x6c5c01['status'](0xc8)[_0x51e6('0xd')](_0x54b1aa);});}else{return _0x6c5c01[_0x51e6('0xe')](0xc8)[_0x51e6('0xd')](_0x54b1aa);}};exports['fetch']=function(_0xd21550,_0x12cee4){return git[_0x51e6('0xf')]([_0x51e6('0x10'),_0x51e6('0x11')],function(_0x509a28){if(_0x509a28){logger[_0x51e6('0x12')](_0x509a28);return _0x12cee4[_0x51e6('0xe')](0x1f4)[_0x51e6('0xd')](_0x509a28);}logger[_0x51e6('0x13')](_0x51e6('0x14'));return _0x12cee4['status'](0xc8)['json']({'output':_0x51e6('0x15')});});};exports[_0x51e6('0x16')]=function(_0x334d3f,_0x6a55a1){return git[_0x51e6('0x16')]([_0x51e6('0x17'),'FETCH_HEAD'],function(_0x8621da){if(_0x8621da){logger['error'](_0x8621da);return _0x6a55a1[_0x51e6('0xe')](0x1f4)[_0x51e6('0xd')](_0x8621da);}logger[_0x51e6('0x13')](_0x51e6('0x18'));return _0x6a55a1[_0x51e6('0xe')](0xc8)[_0x51e6('0xd')]({'output':_0x51e6('0x19')});});};exports[_0x51e6('0x1a')]=function(_0x263420,_0x423ff6){exec(_0x51e6('0x1b'),function(_0x2ae3d6,_0x3e22b4,_0x2d1a43){logger['info'](_0x3e22b4);logger[_0x51e6('0x13')](_0x2d1a43);if(_0x2ae3d6){logger[_0x51e6('0x12')](_0x2ae3d6);return _0x423ff6[_0x51e6('0xe')](0x1f4)[_0x51e6('0xd')](_0x2ae3d6);}return _0x423ff6['status'](0xc8)[_0x51e6('0xd')]({'output':_0x3e22b4});});};exports['restart']=function(_0x550730,_0x4d4855){return pm2[_0x51e6('0x1c')]('motion2')['then'](function(_0x5d6235){logger['info'](_0x51e6('0x1d'),_0x5d6235);return _0x4d4855[_0x51e6('0xe')](0xc8)[_0x51e6('0xd')]({'output':_0x51e6('0x1e')});})[_0x51e6('0x1f')](function(_0x243a30){logger[_0x51e6('0x12')](_0x243a30);return _0x4d4855[_0x51e6('0xe')](0x1f4)[_0x51e6('0xd')](_0x243a30);});};exports[_0x51e6('0x20')]=function(_0x451dee,_0x584517){var _0x5edf1e=fs[_0x51e6('0x21')](path[_0x51e6('0x22')](config['root'],'server',_0x51e6('0x20')));var _0x41a56e=[];for(var _0x1ab1cb=0x0;_0x1ab1cb<_0x5edf1e['length'];_0x1ab1cb++){var _0x2226d4=_0x5edf1e[_0x1ab1cb]['replace'](_0x51e6('0x23'),'');if(compareVersions(module['exports'][_0x51e6('0x2')],_0x2226d4)===-0x1){_0x41a56e[_0x51e6('0x24')](_0x2226d4);}}if(_0x41a56e[_0x51e6('0x25')]){var _0x185666=_0x41a56e['sort'](compareVersions);var _0x1d4ced=new Umzug({'storage':_0x51e6('0x26'),'storageOptions':{'model':db[_0x51e6('0x27')],'modelName':_0x51e6('0x27'),'columnName':_0x51e6('0x2')},'migrations':{'params':[db[_0x51e6('0x26')][_0x51e6('0x28')](),db[_0x51e6('0x26')][_0x51e6('0x29')],function(){throw new Error(_0x51e6('0x2a'));}],'path':path['join'](config[_0x51e6('0x2b')],_0x51e6('0x2c'),_0x51e6('0x20')),'pattern':/\.js$/}});_0x1d4ced['up']({'migrations':_['map'](_0x185666,function(_0x6c9e0){return _0x6c9e0+_0x51e6('0x23');})})[_0x51e6('0x2d')](function(){return _0x584517['status'](0xc8)[_0x51e6('0xd')]({'output':'Database\x20migrated\x20successfully\x20from\x20version\x20'+module['exports']['version']+_0x51e6('0x2e')+_[_0x51e6('0x2f')](_0x185666),'migrations':_[_0x51e6('0x22')](_0x185666)});})[_0x51e6('0x1f')](function(_0x1c0c5c){if(_0x1c0c5c instanceof db[_0x51e6('0x26')]['UniqueConstraintError']){return _0x584517[_0x51e6('0xe')](0xc8)[_0x51e6('0xd')]({'output':_0x51e6('0x30')});}else{return _0x584517['status'](0x1f4)[_0x51e6('0xd')](_0x1c0c5c);}});}else{return _0x584517['status'](0xc8)['json']({'output':_0x51e6('0x30')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index bb1740a..ec84a51 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 _0x2ad7=['describe','/:id','show','post','create','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x335588,_0x1d4164){var _0x4740fc=function(_0x1866c5){while(--_0x1866c5){_0x335588['push'](_0x335588['shift']());}};_0x4740fc(++_0x1d4164);}(_0x2ad7,0xbd));var _0x72ad=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x2ad7[_0x59ee6f];return _0x4c0979;};'use strict';var multer=require(_0x72ad('0x0'));var util=require(_0x72ad('0x1'));var path=require(_0x72ad('0x2'));var timeout=require('connect-timeout');var express=require(_0x72ad('0x3'));var router=express[_0x72ad('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x72ad('0x5'));var interaction=require(_0x72ad('0x6'));var config=require(_0x72ad('0x7'));var controller=require('./voiceAgentReport.controller');router[_0x72ad('0x8')]('/',auth[_0x72ad('0x9')](),controller[_0x72ad('0xa')]);router[_0x72ad('0x8')]('/describe',auth[_0x72ad('0x9')](),controller[_0x72ad('0xb')]);router[_0x72ad('0x8')](_0x72ad('0xc'),auth[_0x72ad('0x9')](),controller[_0x72ad('0xd')]);router[_0x72ad('0xe')]('/',auth[_0x72ad('0x9')](),controller[_0x72ad('0xf')]);router['put'](_0x72ad('0xc'),auth[_0x72ad('0x9')](),controller[_0x72ad('0x10')]);router[_0x72ad('0x11')](_0x72ad('0xc'),auth[_0x72ad('0x9')](),controller[_0x72ad('0x12')]);module[_0x72ad('0x13')]=router; \ No newline at end of file +var _0x9b4e=['/:id','show','post','create','put','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','get','isAuthenticated','describe'];(function(_0x2f12ef,_0x1c3221){var _0x55e1e0=function(_0x2bd5d2){while(--_0x2bd5d2){_0x2f12ef['push'](_0x2f12ef['shift']());}};_0x55e1e0(++_0x1c3221);}(_0x9b4e,0x116));var _0xe9b4=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9b4e[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require(_0xe9b4('0x0'));var util=require(_0xe9b4('0x1'));var path=require('path');var timeout=require(_0xe9b4('0x2'));var express=require(_0xe9b4('0x3'));var router=express[_0xe9b4('0x4')]();var fs_extra=require(_0xe9b4('0x5'));var auth=require(_0xe9b4('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./voiceAgentReport.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xe9b4('0x7')]('/describe',auth[_0xe9b4('0x8')](),controller[_0xe9b4('0x9')]);router['get'](_0xe9b4('0xa'),auth[_0xe9b4('0x8')](),controller[_0xe9b4('0xb')]);router[_0xe9b4('0xc')]('/',auth[_0xe9b4('0x8')](),controller[_0xe9b4('0xd')]);router[_0xe9b4('0xe')](_0xe9b4('0xa'),auth[_0xe9b4('0x8')](),controller['update']);router[_0xe9b4('0xf')]('/:id',auth[_0xe9b4('0x8')](),controller[_0xe9b4('0x10')]);module[_0xe9b4('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index a371bb2..e4ab316 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 _0x80e0=['INTEGER','FORWARD,\x20BLIND,\x20ATTENDED','STRING','DATE','BOOLEAN'];(function(_0x1467c1,_0x2e4edb){var _0x100952=function(_0x57cf38){while(--_0x57cf38){_0x1467c1['push'](_0x1467c1['shift']());}};_0x100952(++_0x2e4edb);}(_0x80e0,0x9d));var _0x080e=function(_0x61dd04,_0xc480ee){_0x61dd04=_0x61dd04-0x0;var _0xf9eb29=_0x80e0[_0x61dd04];return _0xf9eb29;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x080e('0x0')]},'uniqueid':{'type':Sequelize[_0x080e('0x0')]},'calleridnum':{'type':Sequelize[_0x080e('0x0')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x080e('0x0')]},'interface':{'type':Sequelize[_0x080e('0x0')]},'membername':{'type':Sequelize[_0x080e('0x0')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0x080e('0x1')]},'agentcompleteAt':{'type':Sequelize[_0x080e('0x1')]},'agentringnoanswerAt':{'type':Sequelize[_0x080e('0x1')]},'agentdumpAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x080e('0x2')],'defaultValue':![]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'talktime':{'type':Sequelize[_0x080e('0x3')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x080e('0x3')]},'reason':{'type':Sequelize[_0x080e('0x0')]},'lastevent':{'type':Sequelize[_0x080e('0x0')]},'channel':{'type':Sequelize[_0x080e('0x0')]},'channelstate':{'type':Sequelize[_0x080e('0x3')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x080e('0x0')]},'language':{'type':Sequelize[_0x080e('0x0')]},'accountcode':{'type':Sequelize[_0x080e('0x0')]},'context':{'type':Sequelize[_0x080e('0x0')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0x080e('0x0')]},'destchannelstate':{'type':Sequelize[_0x080e('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x080e('0x0')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0x080e('0x0')]},'destconnectedlinenum':{'type':Sequelize[_0x080e('0x0')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x080e('0x0')]},'destpriority':{'type':Sequelize[_0x080e('0x0')]},'destuniqueid':{'type':Sequelize['STRING']},'answeredelsewheredestinationuniqueid':{'type':Sequelize['STRING']},'answeredelsewheremembername':{'type':Sequelize[_0x080e('0x0')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0x080e('0x4')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize[_0x080e('0x0')]},'agententerreason':{'type':Sequelize[_0x080e('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0xc04a=['BOOLEAN','INTEGER','sequelize','STRING','DATE'];(function(_0x576266,_0x4002b0){var _0x18234f=function(_0x4e9ad5){while(--_0x4e9ad5){_0x576266['push'](_0x576266['shift']());}};_0x18234f(++_0x4002b0);}(_0xc04a,0x12e));var _0xac04=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc04a[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xac04('0x0'));module['exports']={'type':{'type':Sequelize[_0xac04('0x1')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xac04('0x1')]},'calleridname':{'type':Sequelize[_0xac04('0x1')]},'queue':{'type':Sequelize[_0xac04('0x1')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xac04('0x1')]},'agentcalledAt':{'type':Sequelize[_0xac04('0x2')]},'agentconnectAt':{'type':Sequelize[_0xac04('0x2')]},'agentcompleteAt':{'type':Sequelize[_0xac04('0x2')]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdumpAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0xac04('0x3')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0xac04('0x3')],'defaultValue':![]},'talktime':{'type':Sequelize[_0xac04('0x4')]},'agentacw':{'type':Sequelize[_0xac04('0x3')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xac04('0x4')]},'reason':{'type':Sequelize[_0xac04('0x1')]},'lastevent':{'type':Sequelize[_0xac04('0x1')]},'channel':{'type':Sequelize[_0xac04('0x1')]},'channelstate':{'type':Sequelize[_0xac04('0x4')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0xac04('0x1')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xac04('0x1')]},'accountcode':{'type':Sequelize[_0xac04('0x1')]},'context':{'type':Sequelize[_0xac04('0x1')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0xac04('0x1')]},'destcalleridnum':{'type':Sequelize[_0xac04('0x1')]},'destcalleridname':{'type':Sequelize[_0xac04('0x1')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0xac04('0x1')]},'destlanguage':{'type':Sequelize[_0xac04('0x1')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0xac04('0x1')]},'destexten':{'type':Sequelize[_0xac04('0x1')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize[_0xac04('0x1')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xac04('0x1')]},'answeredelsewheremembername':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xac04('0x1')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0xac04('0x1')]},'transferuniqueid':{'type':Sequelize['STRING']},'agententerreason':{'type':Sequelize[_0xac04('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 38880a6..f20e887 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(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xa9e0[_0x24237f];return _0x48298e;};'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(_0x39e283,_0x247e6b){var _0x7de89f=function(_0x2f8c50){while(--_0x2f8c50){_0x39e283['push'](_0x39e283['shift']());}};_0x7de89f(++_0x247e6b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0xa9e0[_0x28947d];return _0x12d2ee;};'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 0984db9..dcaae3b 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 _0x8d0a=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceAgentReport.attributes','define','VoiceAgentReport','report_agent','lodash','../../config/logger','api'];(function(_0x5ee577,_0x1effb4){var _0x15adb2=function(_0xad666f){while(--_0xad666f){_0x5ee577['push'](_0x5ee577['shift']());}};_0x15adb2(++_0x1effb4);}(_0x8d0a,0x65));var _0xa8d0=function(_0x16ccf8,_0x4e71f2){_0x16ccf8=_0x16ccf8-0x0;var _0x19ded2=_0x8d0a[_0x16ccf8];return _0x19ded2;};'use strict';var _=require(_0xa8d0('0x0'));var util=require('util');var logger=require(_0xa8d0('0x1'))(_0xa8d0('0x2'));var moment=require(_0xa8d0('0x3'));var BPromise=require(_0xa8d0('0x4'));var rp=require(_0xa8d0('0x5'));var fs=require('fs');var path=require(_0xa8d0('0x6'));var rimraf=require(_0xa8d0('0x7'));var config=require(_0xa8d0('0x8'));var attributes=require(_0xa8d0('0x9'));module['exports']=function(_0x1cac4f,_0x212aaf){return _0x1cac4f[_0xa8d0('0xa')](_0xa8d0('0xb'),attributes,{'tableName':_0xa8d0('0xc'),'paranoid':![],'indexes':[{'fields':['uniqueid','destuniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x0618=['util','api','moment','path','rimraf','../../config/environment','./voiceAgentReport.attributes','exports','define','VoiceAgentReport','report_agent','uniqueid','lodash'];(function(_0x5607f9,_0x2036fe){var _0x240a62=function(_0x393fb4){while(--_0x393fb4){_0x5607f9['push'](_0x5607f9['shift']());}};_0x240a62(++_0x2036fe);}(_0x0618,0x1c6));var _0x8061=function(_0x457cf0,_0x180ed7){_0x457cf0=_0x457cf0-0x0;var _0x44ba42=_0x0618[_0x457cf0];return _0x44ba42;};'use strict';var _=require(_0x8061('0x0'));var util=require(_0x8061('0x1'));var logger=require('../../config/logger')(_0x8061('0x2'));var moment=require(_0x8061('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x8061('0x4'));var rimraf=require(_0x8061('0x5'));var config=require(_0x8061('0x6'));var attributes=require(_0x8061('0x7'));module[_0x8061('0x8')]=function(_0x2c47b6,_0x1cca7f){return _0x2c47b6[_0x8061('0x9')](_0x8061('0xa'),attributes,{'tableName':_0x8061('0xb'),'paranoid':![],'indexes':[{'fields':[_0x8061('0xc'),'destuniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index d2749fd..a2508a7 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 _0x8e75=['result','catch','CreateVoiceAgentReport','VoiceAgentReport','body','options','raw','info','UpdateVoiceAgentReport','update','where','attributes','limit','util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceAgentReport,\x20%s,\x20%s','message'];(function(_0x1a7f6e,_0x23ce37){var _0xa934a0=function(_0x2a8603){while(--_0x2a8603){_0x1a7f6e['push'](_0x1a7f6e['shift']());}};_0xa934a0(++_0x23ce37);}(_0x8e75,0x10d));var _0x58e7=function(_0x1f4b1a,_0x5a0343){_0x1f4b1a=_0x1f4b1a-0x0;var _0x1ea9cb=_0x8e75[_0x1f4b1a];return _0x1ea9cb;};'use strict';var _=require('lodash');var util=require(_0x58e7('0x0'));var moment=require('moment');var BPromise=require(_0x58e7('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x58e7('0x2'));var db=require(_0x58e7('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x58e7('0x4'))(_0x58e7('0x5'));var config=require(_0x58e7('0x6'));var jayson=require(_0x58e7('0x7'));var client=jayson[_0x58e7('0x8')][_0x58e7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x302fe7,_0xed9f9b,_0xc1a361){return new BPromise(function(_0x2c1100,_0xdf1bec){return client['request'](_0x302fe7,_0xc1a361)[_0x58e7('0xa')](function(_0x3c0c47){logger['info']('VoiceAgentReport,\x20%s,\x20%s',_0xed9f9b,_0x58e7('0xb'));logger[_0x58e7('0xc')](_0x58e7('0xd'),_0xed9f9b,'request\x20sent',JSON[_0x58e7('0xe')](_0x3c0c47));if(_0x3c0c47[_0x58e7('0xf')]){if(_0x3c0c47[_0x58e7('0xf')][_0x58e7('0x10')]===0x1f4){logger['error'](_0x58e7('0x11'),_0xed9f9b,_0x3c0c47[_0x58e7('0xf')][_0x58e7('0x12')]);return _0xdf1bec(_0x3c0c47[_0x58e7('0xf')][_0x58e7('0x12')]);}logger['error'](_0x58e7('0x11'),_0xed9f9b,_0x3c0c47[_0x58e7('0xf')][_0x58e7('0x12')]);return _0x2c1100(_0x3c0c47[_0x58e7('0xf')][_0x58e7('0x12')]);}else{logger['info'](_0x58e7('0x11'),_0xed9f9b,_0x58e7('0xb'));_0x2c1100(_0x3c0c47[_0x58e7('0x13')]['message']);}})[_0x58e7('0x14')](function(_0x5d0151){logger['error'](_0x58e7('0x11'),_0xed9f9b,_0x5d0151);_0xdf1bec(_0x5d0151);});});}exports[_0x58e7('0x15')]=function(_0x501ab0){var _0x5ad09a=this;return new Promise(function(_0x132b10,_0x1e4829){return db[_0x58e7('0x16')]['create'](_0x501ab0[_0x58e7('0x17')],{'raw':_0x501ab0[_0x58e7('0x18')]?_0x501ab0[_0x58e7('0x18')][_0x58e7('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1234ae){logger[_0x58e7('0x1a')](_0x58e7('0x15'),_0x501ab0);logger[_0x58e7('0xc')](_0x58e7('0x15'),_0x501ab0,JSON[_0x58e7('0xe')](_0x1234ae));_0x132b10(_0x1234ae);})['catch'](function(_0x3b56ef){logger['error'](_0x58e7('0x15'),_0x3b56ef[_0x58e7('0x12')],_0x501ab0);_0x1e4829(_0x5ad09a[_0x58e7('0xf')](0x1f4,_0x3b56ef[_0x58e7('0x12')]));});});};exports[_0x58e7('0x1b')]=function(_0x4c7b48){var _0x97cd26=this;return new Promise(function(_0x304f2d,_0x5738db){return db[_0x58e7('0x16')][_0x58e7('0x1c')](_0x4c7b48['body'],{'raw':_0x4c7b48[_0x58e7('0x18')]?_0x4c7b48['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4c7b48[_0x58e7('0x18')]?_0x4c7b48[_0x58e7('0x18')][_0x58e7('0x1d')]||null:null,'attributes':_0x4c7b48[_0x58e7('0x18')]?_0x4c7b48['options'][_0x58e7('0x1e')]||null:null,'limit':_0x4c7b48['options']?_0x4c7b48[_0x58e7('0x18')][_0x58e7('0x1f')]||null:null})[_0x58e7('0xa')](function(_0x33a70c){logger[_0x58e7('0x1a')](_0x58e7('0x1b'),_0x4c7b48);logger['debug']('UpdateVoiceAgentReport',_0x4c7b48,JSON[_0x58e7('0xe')](_0x33a70c));_0x304f2d(_0x33a70c);})[_0x58e7('0x14')](function(_0x212505){logger['error']('UpdateVoiceAgentReport',_0x212505['message'],_0x4c7b48);_0x5738db(_0x97cd26[_0x58e7('0xf')](0x1f4,_0x212505['message']));});});}; \ No newline at end of file +var _0x6c8a=['info','request\x20sent','debug','stringify','error','code','VoiceAgentReport,\x20%s,\x20%s','message','result','CreateVoiceAgentReport','options','raw','catch','UpdateVoiceAgentReport','VoiceAgentReport','body','where','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then'];(function(_0x3a710f,_0x3509a8){var _0x11e9fc=function(_0x122165){while(--_0x122165){_0x3a710f['push'](_0x3a710f['shift']());}};_0x11e9fc(++_0x3509a8);}(_0x6c8a,0x92));var _0xa6c8=function(_0x13f8ac,_0x5c892){_0x13f8ac=_0x13f8ac-0x0;var _0x241192=_0x6c8a[_0x13f8ac];return _0x241192;};'use strict';var _=require(_0xa6c8('0x0'));var util=require(_0xa6c8('0x1'));var moment=require(_0xa6c8('0x2'));var BPromise=require(_0xa6c8('0x3'));var rs=require(_0xa6c8('0x4'));var fs=require('fs');var Redis=require(_0xa6c8('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xa6c8('0x6'));var logger=require(_0xa6c8('0x7'))(_0xa6c8('0x8'));var config=require(_0xa6c8('0x9'));var jayson=require(_0xa6c8('0xa'));var client=jayson[_0xa6c8('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3bdbd0,_0x4e7c69,_0x2dd8b6){return new BPromise(function(_0x81d6e6,_0x1c33fb){return client[_0xa6c8('0xc')](_0x3bdbd0,_0x2dd8b6)[_0xa6c8('0xd')](function(_0x180c5c){logger[_0xa6c8('0xe')]('VoiceAgentReport,\x20%s,\x20%s',_0x4e7c69,_0xa6c8('0xf'));logger[_0xa6c8('0x10')]('VoiceAgentReport,\x20%s,\x20%s,\x20%s',_0x4e7c69,_0xa6c8('0xf'),JSON[_0xa6c8('0x11')](_0x180c5c));if(_0x180c5c[_0xa6c8('0x12')]){if(_0x180c5c[_0xa6c8('0x12')][_0xa6c8('0x13')]===0x1f4){logger[_0xa6c8('0x12')](_0xa6c8('0x14'),_0x4e7c69,_0x180c5c[_0xa6c8('0x12')][_0xa6c8('0x15')]);return _0x1c33fb(_0x180c5c['error']['message']);}logger[_0xa6c8('0x12')]('VoiceAgentReport,\x20%s,\x20%s',_0x4e7c69,_0x180c5c[_0xa6c8('0x12')][_0xa6c8('0x15')]);return _0x81d6e6(_0x180c5c[_0xa6c8('0x12')][_0xa6c8('0x15')]);}else{logger['info'](_0xa6c8('0x14'),_0x4e7c69,_0xa6c8('0xf'));_0x81d6e6(_0x180c5c[_0xa6c8('0x16')][_0xa6c8('0x15')]);}})['catch'](function(_0x3dddf6){logger[_0xa6c8('0x12')](_0xa6c8('0x14'),_0x4e7c69,_0x3dddf6);_0x1c33fb(_0x3dddf6);});});}exports[_0xa6c8('0x17')]=function(_0x3eb894){var _0x3bf601=this;return new Promise(function(_0x379253,_0x521740){return db['VoiceAgentReport']['create'](_0x3eb894['body'],{'raw':_0x3eb894[_0xa6c8('0x18')]?_0x3eb894[_0xa6c8('0x18')][_0xa6c8('0x19')]===undefined?!![]:![]:!![]})[_0xa6c8('0xd')](function(_0x3d7798){logger[_0xa6c8('0xe')](_0xa6c8('0x17'),_0x3eb894);logger[_0xa6c8('0x10')]('CreateVoiceAgentReport',_0x3eb894,JSON[_0xa6c8('0x11')](_0x3d7798));_0x379253(_0x3d7798);})[_0xa6c8('0x1a')](function(_0x4bb4ac){logger['error'](_0xa6c8('0x17'),_0x4bb4ac[_0xa6c8('0x15')],_0x3eb894);_0x521740(_0x3bf601[_0xa6c8('0x12')](0x1f4,_0x4bb4ac[_0xa6c8('0x15')]));});});};exports[_0xa6c8('0x1b')]=function(_0x1f505b){var _0x273f6d=this;return new Promise(function(_0xc80729,_0x2ba2cc){return db[_0xa6c8('0x1c')]['update'](_0x1f505b[_0xa6c8('0x1d')],{'raw':_0x1f505b[_0xa6c8('0x18')]?_0x1f505b[_0xa6c8('0x18')][_0xa6c8('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1f505b[_0xa6c8('0x18')]?_0x1f505b['options'][_0xa6c8('0x1e')]||null:null,'attributes':_0x1f505b[_0xa6c8('0x18')]?_0x1f505b[_0xa6c8('0x18')]['attributes']||null:null,'limit':_0x1f505b[_0xa6c8('0x18')]?_0x1f505b['options'][_0xa6c8('0x1f')]||null:null})[_0xa6c8('0xd')](function(_0x1f8fe4){logger[_0xa6c8('0xe')](_0xa6c8('0x1b'),_0x1f505b);logger['debug'](_0xa6c8('0x1b'),_0x1f505b,JSON[_0xa6c8('0x11')](_0x1f8fe4));_0xc80729(_0x1f8fe4);})[_0xa6c8('0x1a')](function(_0x4b1c19){logger[_0xa6c8('0x12')](_0xa6c8('0x1b'),_0x4b1c19[_0xa6c8('0x15')],_0x1f505b);_0x2ba2cc(_0x273f6d[_0xa6c8('0x12')](0x1f4,_0x4b1c19[_0xa6c8('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 2d5b220..f67707b 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 _0x62b8=['create','put','update','/with-retry/:id','updateWithRetry','delete','destroy','exports','express','Router','index','get','describe','/:id','isAuthenticated','show','post'];(function(_0x284b03,_0x54c298){var _0x395eca=function(_0x304bd9){while(--_0x304bd9){_0x284b03['push'](_0x284b03['shift']());}};_0x395eca(++_0x54c298);}(_0x62b8,0x107));var _0x862b=function(_0x1e9424,_0x191cba){_0x1e9424=_0x1e9424-0x0;var _0x1bd96c=_0x62b8[_0x1e9424];return _0x1bd96c;};'use strict';var express=require(_0x862b('0x0'));var router=express[_0x862b('0x1')]();var auth=require('../../components/auth/service');var controller=require('./voiceCallReport.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x862b('0x2')]);router[_0x862b('0x3')]('/describe',auth['isAuthenticated'](),controller[_0x862b('0x4')]);router[_0x862b('0x3')](_0x862b('0x5'),auth[_0x862b('0x6')](),controller[_0x862b('0x7')]);router[_0x862b('0x8')]('/',auth[_0x862b('0x6')](),controller[_0x862b('0x9')]);router[_0x862b('0xa')](_0x862b('0x5'),auth[_0x862b('0x6')](),controller[_0x862b('0xb')]);router['put'](_0x862b('0xc'),auth[_0x862b('0x6')](),controller[_0x862b('0xd')]);router[_0x862b('0xe')](_0x862b('0x5'),auth['isAuthenticated'](),controller[_0x862b('0xf')]);module[_0x862b('0x10')]=router; \ No newline at end of file +var _0xfa18=['isAuthenticated','get','/describe','/:id','show','post','create','put','/with-retry/:id','updateWithRetry','delete','exports','express'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xfa18,0x1d3));var _0x8fa1=function(_0x345841,_0x5d813e){_0x345841=_0x345841-0x0;var _0x185748=_0xfa18[_0x345841];return _0x185748;};'use strict';var express=require(_0x8fa1('0x0'));var router=express['Router']();var auth=require('../../components/auth/service');var controller=require('./voiceCallReport.controller');router['get']('/',auth[_0x8fa1('0x1')](),controller['index']);router[_0x8fa1('0x2')](_0x8fa1('0x3'),auth[_0x8fa1('0x1')](),controller['describe']);router['get'](_0x8fa1('0x4'),auth[_0x8fa1('0x1')](),controller[_0x8fa1('0x5')]);router[_0x8fa1('0x6')]('/',auth[_0x8fa1('0x1')](),controller[_0x8fa1('0x7')]);router[_0x8fa1('0x8')](_0x8fa1('0x4'),auth['isAuthenticated'](),controller['update']);router[_0x8fa1('0x8')](_0x8fa1('0x9'),auth[_0x8fa1('0x1')](),controller[_0x8fa1('0xa')]);router[_0x8fa1('0xb')](_0x8fa1('0x4'),auth[_0x8fa1('0x1')](),controller['destroy']);module[_0x8fa1('0xc')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index 163eea8..c4f2b52 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 _0x7fda=['DATE','INTEGER','sequelize','exports','ENUM','inbound','internal','outbound','outbound-fax','STRING','TEXT'];(function(_0x33199e,_0x428ded){var _0x2eef3c=function(_0x41a97a){while(--_0x41a97a){_0x33199e['push'](_0x33199e['shift']());}};_0x2eef3c(++_0x428ded);}(_0x7fda,0xf4));var _0xa7fd=function(_0x4d2cb6,_0x593d26){_0x4d2cb6=_0x4d2cb6-0x0;var _0x26e1f4=_0x7fda[_0x4d2cb6];return _0x26e1f4;};'use strict';var Sequelize=require(_0xa7fd('0x0'));module[_0xa7fd('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xa7fd('0x2')](_0xa7fd('0x3'),_0xa7fd('0x4'),_0xa7fd('0x5'),'inbound-fax',_0xa7fd('0x6'),'dialer')},'tag':{'type':Sequelize[_0xa7fd('0x7')]},'accountcode':{'type':Sequelize[_0xa7fd('0x7')]},'source':{'type':Sequelize['STRING']},'destination':{'type':Sequelize[_0xa7fd('0x7')]},'destinationcontext':{'type':Sequelize[_0xa7fd('0x7')]},'callerid':{'type':Sequelize[_0xa7fd('0x7')]},'channel':{'type':Sequelize[_0xa7fd('0x7')]},'destinationchannel':{'type':Sequelize[_0xa7fd('0x7')]},'lastapplication':{'type':Sequelize[_0xa7fd('0x7')]},'lastdata':{'type':Sequelize[_0xa7fd('0x8')]},'starttime':{'type':Sequelize[_0xa7fd('0x9')]},'systemanswertime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0xa7fd('0x9')]},'endtime':{'type':Sequelize[_0xa7fd('0x9')]},'duration':{'type':Sequelize[_0xa7fd('0xa')]},'billableseconds':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0xa7fd('0xa')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xa7fd('0x7')]},'amaflags':{'type':Sequelize[_0xa7fd('0x7')]},'userfield':{'type':Sequelize[_0xa7fd('0x7')]},'userDisposition':{'type':Sequelize[_0xa7fd('0x7')]},'userSecondDisposition':{'type':Sequelize['STRING']},'userThirdDisposition':{'type':Sequelize[_0xa7fd('0x7')]},'note':{'type':Sequelize[_0xa7fd('0x7')]},'prefix':{'type':Sequelize[_0xa7fd('0x7')]},'routeid':{'type':Sequelize[_0xa7fd('0xa')]},'sipcallid':{'type':Sequelize[_0xa7fd('0x7')]}}; \ No newline at end of file +var _0x8403=['inbound','outbound','inbound-fax','dialer','TEXT','DATE','INTEGER','sequelize','exports','STRING','ENUM'];(function(_0x31b1f3,_0x11426e){var _0xcaebce=function(_0x14fabe){while(--_0x14fabe){_0x31b1f3['push'](_0x31b1f3['shift']());}};_0xcaebce(++_0x11426e);}(_0x8403,0x188));var _0x3840=function(_0x2284d6,_0x2b7218){_0x2284d6=_0x2284d6-0x0;var _0x1a9e3d=_0x8403[_0x2284d6];return _0x1a9e3d;};'use strict';var Sequelize=require(_0x3840('0x0'));module[_0x3840('0x1')]={'uniqueid':{'type':Sequelize[_0x3840('0x2')]},'type':{'type':Sequelize[_0x3840('0x3')](_0x3840('0x4'),'internal',_0x3840('0x5'),_0x3840('0x6'),'outbound-fax',_0x3840('0x7'))},'tag':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x3840('0x2')]},'source':{'type':Sequelize[_0x3840('0x2')]},'destination':{'type':Sequelize[_0x3840('0x2')]},'destinationcontext':{'type':Sequelize[_0x3840('0x2')]},'callerid':{'type':Sequelize[_0x3840('0x2')]},'channel':{'type':Sequelize[_0x3840('0x2')]},'destinationchannel':{'type':Sequelize[_0x3840('0x2')]},'lastapplication':{'type':Sequelize[_0x3840('0x2')]},'lastdata':{'type':Sequelize[_0x3840('0x8')]},'starttime':{'type':Sequelize[_0x3840('0x9')]},'systemanswertime':{'type':Sequelize[_0x3840('0x9')]},'answertime':{'type':Sequelize[_0x3840('0x9')]},'endtime':{'type':Sequelize[_0x3840('0x9')]},'duration':{'type':Sequelize[_0x3840('0xa')]},'billableseconds':{'type':Sequelize[_0x3840('0xa')]},'mohtime':{'type':Sequelize[_0x3840('0xa')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x3840('0x2')]},'amaflags':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0x3840('0x2')]},'userDisposition':{'type':Sequelize[_0x3840('0x2')]},'userSecondDisposition':{'type':Sequelize['STRING']},'userThirdDisposition':{'type':Sequelize[_0x3840('0x2')]},'note':{'type':Sequelize[_0x3840('0x2')]},'prefix':{'type':Sequelize[_0x3840('0x2')]},'routeid':{'type':Sequelize[_0x3840('0xa')]},'sipcallid':{'type':Sequelize[_0x3840('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index 375a39a..ff59123 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 _0x1339=['attributes','length','hasOwnProperty','order','sort','where','filter','type','VIRTUAL','options','includeAll','include','fullname','alias','User','findAll','rows','catch','params','rawAttributes','merge','find','create','describe','user','body','uniqueid','updateWithRetry','No\x20such\x20Voice\x20Call\x20Report','../../config/logger','api','../../mysqldb','promise-retry','status','offset','undefined','limit','count','set','Content-Range','json','update','destroy','then','end','error','stack','name','send','VoiceCallReport','fieldName','key','query','keys','filters','intersection','model','fields'];(function(_0x4617c5,_0x259a0e){var _0x1cdb82=function(_0xe97146){while(--_0xe97146){_0x4617c5['push'](_0x4617c5['shift']());}};_0x1cdb82(++_0x259a0e);}(_0x1339,0x1ed));var _0x9133=function(_0x586a4e,_0x37fc2a){_0x586a4e=_0x586a4e-0x0;var _0x352a2d=_0x1339[_0x586a4e];return _0x352a2d;};'use strict';var _=require('lodash');var qs=require('../../components/parsers/qs');var logger=require(_0x9133('0x0'))(_0x9133('0x1'));var db=require(_0x9133('0x2'))['db'];const promiseRetry=require(_0x9133('0x3'));function respondWithResult(_0x447096,_0x192d48){_0x192d48=_0x192d48||0xc8;return function(_0x176e80){if(_0x176e80){return _0x447096[_0x9133('0x4')](_0x192d48)['json'](_0x176e80);}};}function respondWithFilteredResult(_0x578643,_0x855473){return function(_0x379915){if(_0x379915){var _0x539af6=typeof _0x855473[_0x9133('0x5')]===_0x9133('0x6')&&typeof _0x855473[_0x9133('0x7')]===_0x9133('0x6');var _0x261698=_0x379915[_0x9133('0x8')];var _0x4294b7=_0x539af6?0x0:_0x855473[_0x9133('0x5')];var _0x10a9e4=_0x539af6?_0x379915[_0x9133('0x8')]:_0x855473['offset']+_0x855473[_0x9133('0x7')];var _0x3533fa;if(_0x10a9e4>=_0x261698){_0x10a9e4=_0x261698;_0x3533fa=0xc8;}else{_0x3533fa=0xce;}_0x578643[_0x9133('0x4')](_0x3533fa);return _0x578643[_0x9133('0x9')](_0x9133('0xa'),_0x4294b7+'-'+_0x10a9e4+'/'+_0x261698)[_0x9133('0xb')](_0x379915);}return null;};}function saveUpdates(_0x5ef6b5){return function(_0xb64550){if(_0xb64550){return _0xb64550[_0x9133('0xc')](_0x5ef6b5)['then'](function(_0x5283a3){return _0x5283a3;});}return null;};}function removeEntity(_0x10475c){return function(_0x4bf947){if(_0x4bf947){return _0x4bf947[_0x9133('0xd')]()[_0x9133('0xe')](function(){_0x10475c[_0x9133('0x4')](0xcc)[_0x9133('0xf')]();});}};}function handleEntityNotFound(_0x31847a){return function(_0x4327b3){if(!_0x4327b3){_0x31847a['sendStatus'](0x194);}return _0x4327b3;};}function handleError(_0x13f8fc,_0x1e23ce){_0x1e23ce=_0x1e23ce||0x1f4;return function(_0x4f4f14){logger[_0x9133('0x10')](_0x4f4f14[_0x9133('0x11')]);if(_0x4f4f14[_0x9133('0x12')]){delete _0x4f4f14[_0x9133('0x12')];}_0x13f8fc['status'](_0x1e23ce)[_0x9133('0x13')](_0x4f4f14);};}exports['index']=function(_0x3c48ef,_0x5d4a77){var _0x115ee8={},_0x1d6d0b={},_0x5e8620={'count':0x0,'rows':[]};var _0x38dd60=_['map'](db[_0x9133('0x14')]['rawAttributes'],function(_0x5e4f0c){return{'name':_0x5e4f0c[_0x9133('0x15')],'type':_0x5e4f0c['type'][_0x9133('0x16')]};});_0x1d6d0b['model']=_['map'](_0x38dd60,'name');_0x1d6d0b[_0x9133('0x17')]=_[_0x9133('0x18')](_0x3c48ef['query']);_0x1d6d0b[_0x9133('0x19')]=_[_0x9133('0x1a')](_0x1d6d0b[_0x9133('0x1b')],_0x1d6d0b[_0x9133('0x17')]);_0x115ee8['attributes']=_[_0x9133('0x1a')](_0x1d6d0b['model'],qs[_0x9133('0x1c')](_0x3c48ef[_0x9133('0x17')][_0x9133('0x1c')]));_0x115ee8[_0x9133('0x1d')]=_0x115ee8[_0x9133('0x1d')][_0x9133('0x1e')]?_0x115ee8[_0x9133('0x1d')]:_0x1d6d0b[_0x9133('0x1b')];if(!_0x3c48ef[_0x9133('0x17')][_0x9133('0x1f')]('nolimit')){_0x115ee8['limit']=qs[_0x9133('0x7')](_0x3c48ef[_0x9133('0x17')][_0x9133('0x7')]);_0x115ee8[_0x9133('0x5')]=qs['offset'](_0x3c48ef['query'][_0x9133('0x5')]);}_0x115ee8[_0x9133('0x20')]=qs[_0x9133('0x21')](_0x3c48ef[_0x9133('0x17')][_0x9133('0x21')]);_0x115ee8[_0x9133('0x22')]=qs['filters'](_['pick'](_0x3c48ef['query'],_0x1d6d0b[_0x9133('0x19')]),_0x38dd60);if(_0x3c48ef['query'][_0x9133('0x23')]){_0x115ee8[_0x9133('0x22')]=_['merge'](_0x115ee8[_0x9133('0x22')],{'$or':_['map'](_0x38dd60,function(_0xf0aec4){if(_0xf0aec4[_0x9133('0x24')]!==_0x9133('0x25')){var _0x5f1de2={};_0x5f1de2[_0xf0aec4[_0x9133('0x12')]]={'$like':'%'+_0x3c48ef[_0x9133('0x17')][_0x9133('0x23')]+'%'};return _0x5f1de2;}})});}_0x115ee8=_['merge']({},_0x115ee8,_0x3c48ef[_0x9133('0x26')]);var _0x3393a1={'where':_0x115ee8[_0x9133('0x22')]};return db['VoiceCallReport'][_0x9133('0x8')](_0x3393a1)[_0x9133('0xe')](function(_0x1b5700){_0x5e8620[_0x9133('0x8')]=_0x1b5700;if(_0x3c48ef['query'][_0x9133('0x27')]){_0x115ee8[_0x9133('0x28')]=[{'attributes':['id','name',_0x9133('0x29'),_0x9133('0x2a')],'model':db[_0x9133('0x2b')],'as':_0x9133('0x2b')}];}return db[_0x9133('0x14')][_0x9133('0x2c')](_0x115ee8);})[_0x9133('0xe')](function(_0x167e45){_0x5e8620[_0x9133('0x2d')]=_0x167e45;return _0x5e8620;})[_0x9133('0xe')](respondWithFilteredResult(_0x5d4a77,_0x115ee8))[_0x9133('0x2e')](handleError(_0x5d4a77,null));};exports['show']=function(_0x17bb4c,_0x2c2e16){var _0x5a676b={'raw':!![],'where':{'id':_0x17bb4c[_0x9133('0x2f')]['id']}},_0x1f2f8c={};_0x1f2f8c[_0x9133('0x1b')]=_[_0x9133('0x18')](db[_0x9133('0x14')][_0x9133('0x30')]);_0x1f2f8c['query']=_['keys'](_0x17bb4c[_0x9133('0x17')]);_0x1f2f8c[_0x9133('0x19')]=_[_0x9133('0x1a')](_0x1f2f8c[_0x9133('0x1b')],_0x1f2f8c[_0x9133('0x17')]);_0x5a676b[_0x9133('0x1d')]=_[_0x9133('0x1a')](_0x1f2f8c[_0x9133('0x1b')],qs[_0x9133('0x1c')](_0x17bb4c['query'][_0x9133('0x1c')]));_0x5a676b[_0x9133('0x1d')]=_0x5a676b[_0x9133('0x1d')][_0x9133('0x1e')]?_0x5a676b[_0x9133('0x1d')]:_0x1f2f8c['model'];if(_0x17bb4c[_0x9133('0x17')][_0x9133('0x27')]){_0x5a676b[_0x9133('0x28')]=[{'all':!![]}];}_0x5a676b=_[_0x9133('0x31')]({},_0x5a676b,_0x17bb4c['options']);return db[_0x9133('0x14')][_0x9133('0x32')](_0x5a676b)[_0x9133('0xe')](handleEntityNotFound(_0x2c2e16,null))[_0x9133('0xe')](respondWithResult(_0x2c2e16,null))[_0x9133('0x2e')](handleError(_0x2c2e16,null));};exports[_0x9133('0x33')]=function(_0x3b2287,_0x4ca1a3){return db[_0x9133('0x14')]['create'](_0x3b2287['body'],{})[_0x9133('0xe')](respondWithResult(_0x4ca1a3,0xc9))[_0x9133('0x2e')](handleError(_0x4ca1a3,null));};exports[_0x9133('0xd')]=function(_0x264df4,_0xdd485f){return db[_0x9133('0x14')][_0x9133('0x32')]({'where':{'id':_0x264df4[_0x9133('0x2f')]['id']}})[_0x9133('0xe')](handleEntityNotFound(_0xdd485f,null))['then'](removeEntity(_0xdd485f,null))[_0x9133('0x2e')](handleError(_0xdd485f,null));};exports[_0x9133('0x34')]=function(_0x2928bd,_0x597434){return db['VoiceCallReport'][_0x9133('0x34')]()[_0x9133('0xe')](respondWithResult(_0x597434,null))['catch'](handleError(_0x597434,null));};function findForUpdate(_0x28d281){return db[_0x9133('0x14')][_0x9133('0x32')]({'where':{'uniqueid':_0x28d281[_0x9133('0x2f')]['id'],'UserId':{'$or':[null,_0x28d281[_0x9133('0x35')]['id']]}}});}exports['update']=function(_0x2901fa,_0x4423b4){if(_0x2901fa[_0x9133('0x36')]['uniqueid']){delete _0x2901fa[_0x9133('0x36')][_0x9133('0x37')];}return findForUpdate(_0x2901fa)['then'](handleEntityNotFound(_0x4423b4,null))['then'](saveUpdates(_0x2901fa[_0x9133('0x36')],null))[_0x9133('0xe')](respondWithResult(_0x4423b4,null))[_0x9133('0x2e')](handleError(_0x4423b4,null));};exports[_0x9133('0x38')]=function(_0x3fe9bb,_0xe31c84,_0xe065c4){if(_0x3fe9bb[_0x9133('0x36')][_0x9133('0x37')]){delete _0x3fe9bb[_0x9133('0x36')][_0x9133('0x37')];}promiseRetry(function(){return findForUpdate(_0x3fe9bb);},{'retries':0x6,'minTimeout':0xfa})[_0x9133('0xe')](function(_0x4f3092){if(!_0x4f3092){return new Promise(function(_0x4dc5ee){_0x4dc5ee(handleEntityNotFound(_0xe31c84,null)({'message':_0x9133('0x39')}));});}else{return _0x4f3092['update'](_0x3fe9bb[_0x9133('0x36')])[_0x9133('0xe')](function(_0x6fbb11){return respondWithResult(_0xe31c84)(_0x6fbb11);});}},function(){handleEntityNotFound(_0xe31c84)();})[_0x9133('0x2e')](function(){handleEntityNotFound(_0xe31c84)();});}; \ No newline at end of file +var _0x6210=['stack','name','index','map','VoiceCallReport','rawAttributes','fieldName','key','model','intersection','query','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filters','merge','type','VIRTUAL','filter','options','fullname','alias','User','findAll','rows','catch','show','keys','includeAll','include','find','create','params','describe','body','uniqueid','updateWithRetry','error','update','can\x27t\x20find\x20voiceCallReport\x20IN\x20THE\x20SECOND\x20FUNCTION','can\x27t\x20find\x20voiceCallReport\x20IN\x20THE\x20CATCH','lodash','../../components/parsers/qs','../../config/logger','api','../../mysqldb','promise-retry','json','offset','undefined','limit','count','status','set','Content-Range','then','destroy','end','sendStatus'];(function(_0x279d37,_0x14de3f){var _0x530173=function(_0x37fc79){while(--_0x37fc79){_0x279d37['push'](_0x279d37['shift']());}};_0x530173(++_0x14de3f);}(_0x6210,0x1a7));var _0x0621=function(_0x20ef64,_0x4a8fe9){_0x20ef64=_0x20ef64-0x0;var _0x3707d8=_0x6210[_0x20ef64];return _0x3707d8;};'use strict';var _=require(_0x0621('0x0'));var qs=require(_0x0621('0x1'));var logger=require(_0x0621('0x2'))(_0x0621('0x3'));var db=require(_0x0621('0x4'))['db'];const promiseRetry=require(_0x0621('0x5'));function respondWithResult(_0x6b9c01,_0x3943a7){_0x3943a7=_0x3943a7||0xc8;return function(_0x43b02d){if(_0x43b02d){return _0x6b9c01['status'](_0x3943a7)[_0x0621('0x6')](_0x43b02d);}};}function respondWithFilteredResult(_0x2152bc,_0x1be71a){return function(_0x4bccd2){if(_0x4bccd2){var _0x12e1e2=typeof _0x1be71a[_0x0621('0x7')]===_0x0621('0x8')&&typeof _0x1be71a[_0x0621('0x9')]==='undefined';var _0x4d14df=_0x4bccd2['count'];var _0x49987e=_0x12e1e2?0x0:_0x1be71a['offset'];var _0x131f4f=_0x12e1e2?_0x4bccd2[_0x0621('0xa')]:_0x1be71a[_0x0621('0x7')]+_0x1be71a[_0x0621('0x9')];var _0x3828ad;if(_0x131f4f>=_0x4d14df){_0x131f4f=_0x4d14df;_0x3828ad=0xc8;}else{_0x3828ad=0xce;}_0x2152bc[_0x0621('0xb')](_0x3828ad);return _0x2152bc[_0x0621('0xc')](_0x0621('0xd'),_0x49987e+'-'+_0x131f4f+'/'+_0x4d14df)[_0x0621('0x6')](_0x4bccd2);}return null;};}function saveUpdates(_0x47a089){return function(_0x143a3b){if(_0x143a3b){return _0x143a3b['update'](_0x47a089)[_0x0621('0xe')](function(_0x46b413){return _0x46b413;});}return null;};}function removeEntity(_0x144f0c){return function(_0x57face){if(_0x57face){return _0x57face[_0x0621('0xf')]()[_0x0621('0xe')](function(){_0x144f0c[_0x0621('0xb')](0xcc)[_0x0621('0x10')]();});}};}function handleEntityNotFound(_0x11dfa4){return function(_0x918954){if(!_0x918954){_0x11dfa4[_0x0621('0x11')](0x194);}return _0x918954;};}function handleError(_0x52dfee,_0xaf7cc6){_0xaf7cc6=_0xaf7cc6||0x1f4;return function(_0x47d2f1){logger['error'](_0x47d2f1[_0x0621('0x12')]);if(_0x47d2f1[_0x0621('0x13')]){delete _0x47d2f1[_0x0621('0x13')];}_0x52dfee[_0x0621('0xb')](_0xaf7cc6)['send'](_0x47d2f1);};}exports[_0x0621('0x14')]=function(_0x2079d2,_0x177a3c){var _0xd92fe1={},_0x3328eb={},_0x585c51={'count':0x0,'rows':[]};var _0x7e622b=_[_0x0621('0x15')](db[_0x0621('0x16')][_0x0621('0x17')],function(_0x20f132){return{'name':_0x20f132[_0x0621('0x18')],'type':_0x20f132['type'][_0x0621('0x19')]};});_0x3328eb[_0x0621('0x1a')]=_[_0x0621('0x15')](_0x7e622b,_0x0621('0x13'));_0x3328eb['query']=_['keys'](_0x2079d2['query']);_0x3328eb['filters']=_[_0x0621('0x1b')](_0x3328eb[_0x0621('0x1a')],_0x3328eb[_0x0621('0x1c')]);_0xd92fe1[_0x0621('0x1d')]=_[_0x0621('0x1b')](_0x3328eb[_0x0621('0x1a')],qs[_0x0621('0x1e')](_0x2079d2[_0x0621('0x1c')][_0x0621('0x1e')]));_0xd92fe1[_0x0621('0x1d')]=_0xd92fe1[_0x0621('0x1d')]['length']?_0xd92fe1[_0x0621('0x1d')]:_0x3328eb[_0x0621('0x1a')];if(!_0x2079d2[_0x0621('0x1c')][_0x0621('0x1f')](_0x0621('0x20'))){_0xd92fe1['limit']=qs[_0x0621('0x9')](_0x2079d2['query'][_0x0621('0x9')]);_0xd92fe1['offset']=qs[_0x0621('0x7')](_0x2079d2[_0x0621('0x1c')][_0x0621('0x7')]);}_0xd92fe1['order']=qs[_0x0621('0x21')](_0x2079d2[_0x0621('0x1c')]['sort']);_0xd92fe1[_0x0621('0x22')]=qs['filters'](_[_0x0621('0x23')](_0x2079d2[_0x0621('0x1c')],_0x3328eb[_0x0621('0x24')]),_0x7e622b);if(_0x2079d2[_0x0621('0x1c')]['filter']){_0xd92fe1['where']=_[_0x0621('0x25')](_0xd92fe1[_0x0621('0x22')],{'$or':_[_0x0621('0x15')](_0x7e622b,function(_0x21b0bb){if(_0x21b0bb[_0x0621('0x26')]!==_0x0621('0x27')){var _0x290ffa={};_0x290ffa[_0x21b0bb[_0x0621('0x13')]]={'$like':'%'+_0x2079d2[_0x0621('0x1c')][_0x0621('0x28')]+'%'};return _0x290ffa;}})});}_0xd92fe1=_[_0x0621('0x25')]({},_0xd92fe1,_0x2079d2[_0x0621('0x29')]);var _0x174ac0={'where':_0xd92fe1[_0x0621('0x22')]};return db[_0x0621('0x16')][_0x0621('0xa')](_0x174ac0)[_0x0621('0xe')](function(_0x28b17c){_0x585c51['count']=_0x28b17c;if(_0x2079d2[_0x0621('0x1c')]['includeAll']){_0xd92fe1['include']=[{'attributes':['id',_0x0621('0x13'),_0x0621('0x2a'),_0x0621('0x2b')],'model':db[_0x0621('0x2c')],'as':_0x0621('0x2c')}];}return db['VoiceCallReport'][_0x0621('0x2d')](_0xd92fe1);})[_0x0621('0xe')](function(_0x1d0416){_0x585c51[_0x0621('0x2e')]=_0x1d0416;return _0x585c51;})[_0x0621('0xe')](respondWithFilteredResult(_0x177a3c,_0xd92fe1))[_0x0621('0x2f')](handleError(_0x177a3c,null));};exports[_0x0621('0x30')]=function(_0x5530be,_0x3aac25){var _0xbdc6ef={'raw':!![],'where':{'id':_0x5530be['params']['id']}},_0xe2e9c6={};_0xe2e9c6[_0x0621('0x1a')]=_[_0x0621('0x31')](db[_0x0621('0x16')][_0x0621('0x17')]);_0xe2e9c6[_0x0621('0x1c')]=_['keys'](_0x5530be[_0x0621('0x1c')]);_0xe2e9c6[_0x0621('0x24')]=_[_0x0621('0x1b')](_0xe2e9c6[_0x0621('0x1a')],_0xe2e9c6['query']);_0xbdc6ef[_0x0621('0x1d')]=_['intersection'](_0xe2e9c6[_0x0621('0x1a')],qs[_0x0621('0x1e')](_0x5530be[_0x0621('0x1c')][_0x0621('0x1e')]));_0xbdc6ef[_0x0621('0x1d')]=_0xbdc6ef[_0x0621('0x1d')]['length']?_0xbdc6ef[_0x0621('0x1d')]:_0xe2e9c6[_0x0621('0x1a')];if(_0x5530be[_0x0621('0x1c')][_0x0621('0x32')]){_0xbdc6ef[_0x0621('0x33')]=[{'all':!![]}];}_0xbdc6ef=_['merge']({},_0xbdc6ef,_0x5530be['options']);return db[_0x0621('0x16')][_0x0621('0x34')](_0xbdc6ef)[_0x0621('0xe')](handleEntityNotFound(_0x3aac25,null))[_0x0621('0xe')](respondWithResult(_0x3aac25,null))[_0x0621('0x2f')](handleError(_0x3aac25,null));};exports['create']=function(_0x3e8edb,_0x29b1d6){return db['VoiceCallReport'][_0x0621('0x35')](_0x3e8edb['body'],{})[_0x0621('0xe')](respondWithResult(_0x29b1d6,0xc9))[_0x0621('0x2f')](handleError(_0x29b1d6,null));};exports[_0x0621('0xf')]=function(_0x4a4356,_0x554af3){return db[_0x0621('0x16')]['find']({'where':{'id':_0x4a4356[_0x0621('0x36')]['id']}})[_0x0621('0xe')](handleEntityNotFound(_0x554af3,null))['then'](removeEntity(_0x554af3,null))[_0x0621('0x2f')](handleError(_0x554af3,null));};exports[_0x0621('0x37')]=function(_0x1e2f1a,_0x2da732){return db['VoiceCallReport']['describe']()[_0x0621('0xe')](respondWithResult(_0x2da732,null))[_0x0621('0x2f')](handleError(_0x2da732,null));};function findForUpdate(_0x35bd50){return db[_0x0621('0x16')]['find']({'where':{'uniqueid':_0x35bd50['params']['id'],'UserId':{'$or':[null,_0x35bd50['user']['id']]}}});}exports['update']=function(_0x97d0ea,_0x186ec0){if(_0x97d0ea[_0x0621('0x38')][_0x0621('0x39')]){delete _0x97d0ea[_0x0621('0x38')]['uniqueid'];}return findForUpdate(_0x97d0ea)[_0x0621('0xe')](handleEntityNotFound(_0x186ec0,null))[_0x0621('0xe')](saveUpdates(_0x97d0ea[_0x0621('0x38')],null))['then'](respondWithResult(_0x186ec0,null))[_0x0621('0x2f')](handleError(_0x186ec0,null));};exports[_0x0621('0x3a')]=function(_0x1c6dbc,_0x54729f,_0xa7e008){if(_0x1c6dbc[_0x0621('0x38')][_0x0621('0x39')]){delete _0x1c6dbc[_0x0621('0x38')][_0x0621('0x39')];}promiseRetry(function(){return findForUpdate(_0x1c6dbc);},{'retries':0x6,'minTimeout':0xfa})[_0x0621('0xe')](function(_0x57f6a2){if(!_0x57f6a2){logger[_0x0621('0x3b')]('can\x27t\x20find\x20voiceCallReport\x20IN\x20THE\x20FIRST\x20FUNCTION',_0x1c6dbc[_0x0621('0x38')]);return new Promise(function(_0x14b26d){_0x14b26d(handleEntityNotFound(_0x54729f)());});}else{return _0x57f6a2[_0x0621('0x3c')](_0x1c6dbc[_0x0621('0x38')])[_0x0621('0xe')](function(_0x537a4c){return respondWithResult(_0x54729f)(_0x537a4c);});}},function(){logger['error'](_0x0621('0x3d'),_0x1c6dbc[_0x0621('0x38')]);handleEntityNotFound(_0x54729f)();})[_0x0621('0x2f')](function(){logger[_0x0621('0x3b')](_0x0621('0x3e'),_0x1c6dbc[_0x0621('0x38')]);handleEntityNotFound(_0x54729f)();});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index 08b59ce..7e10c7c 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 _0xcc17=['rimraf','../../config/environment','./voiceCallReport.attributes','exports','define','VoiceCallReport','report_call','uniqueid','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x34e939,_0x26bc81){var _0xcb77df=function(_0x453d0f){while(--_0x453d0f){_0x34e939['push'](_0x34e939['shift']());}};_0xcb77df(++_0x26bc81);}(_0xcc17,0x174));var _0x7cc1=function(_0xcd0918,_0x56bdf9){_0xcd0918=_0xcd0918-0x0;var _0x250704=_0xcc17[_0xcd0918];return _0x250704;};'use strict';var _=require(_0x7cc1('0x0'));var util=require(_0x7cc1('0x1'));var logger=require(_0x7cc1('0x2'))(_0x7cc1('0x3'));var moment=require(_0x7cc1('0x4'));var BPromise=require(_0x7cc1('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x7cc1('0x6'));var config=require(_0x7cc1('0x7'));var attributes=require(_0x7cc1('0x8'));module[_0x7cc1('0x9')]=function(_0x28d630,_0x54a6cc){return _0x28d630[_0x7cc1('0xa')](_0x7cc1('0xb'),attributes,{'tableName':_0x7cc1('0xc'),'paranoid':![],'indexes':[{'fields':[_0x7cc1('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc86a=['report_call','uniqueid','lodash','util','api','moment','request-promise','rimraf','../../config/environment','./voiceCallReport.attributes','exports','define','VoiceCallReport'];(function(_0x5d0a43,_0xe1cda7){var _0x4a3bf1=function(_0x540ad4){while(--_0x540ad4){_0x5d0a43['push'](_0x5d0a43['shift']());}};_0x4a3bf1(++_0xe1cda7);}(_0xc86a,0x1f0));var _0xac86=function(_0x448f8,_0x2aa1d7){_0x448f8=_0x448f8-0x0;var _0xa73126=_0xc86a[_0x448f8];return _0xa73126;};'use strict';var _=require(_0xac86('0x0'));var util=require(_0xac86('0x1'));var logger=require('../../config/logger')(_0xac86('0x2'));var moment=require(_0xac86('0x3'));var BPromise=require('bluebird');var rp=require(_0xac86('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xac86('0x5'));var config=require(_0xac86('0x6'));var attributes=require(_0xac86('0x7'));module[_0xac86('0x8')]=function(_0x4fd3f4,_0x295f80){return _0x4fd3f4[_0xac86('0x9')](_0xac86('0xa'),attributes,{'tableName':_0xac86('0xb'),'paranoid':![],'indexes':[{'fields':[_0xac86('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 b508d6a..7bb84ea 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 _0xce3e=['request','then','info','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','VoiceCallReport,\x20%s,\x20%s','message','result','catch','GetVoiceCallReport','VoiceCallReport','findAll','options','raw','where','attributes','include','map','model','CreateVoiceCallReport','create','body','update','limit','UpdateVoiceCallReport','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','client','http'];(function(_0x425541,_0x5dec0e){var _0x455616=function(_0x28e721){while(--_0x28e721){_0x425541['push'](_0x425541['shift']());}};_0x455616(++_0x5dec0e);}(_0xce3e,0x1be));var _0xece3=function(_0x28db62,_0xfe11c1){_0x28db62=_0x28db62-0x0;var _0xbc95be=_0xce3e[_0x28db62];return _0xbc95be;};'use strict';var _=require('lodash');var util=require(_0xece3('0x0'));var moment=require(_0xece3('0x1'));var BPromise=require(_0xece3('0x2'));var rs=require(_0xece3('0x3'));var fs=require('fs');var Redis=require(_0xece3('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xece3('0x5'));var logger=require(_0xece3('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xece3('0x7'));var client=jayson[_0xece3('0x8')][_0xece3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x58a52e,_0x593726,_0x31fb4f){return new BPromise(function(_0x18499d,_0x141c6c){return client[_0xece3('0xa')](_0x58a52e,_0x31fb4f)[_0xece3('0xb')](function(_0x5a9fd0){logger[_0xece3('0xc')]('VoiceCallReport,\x20%s,\x20%s',_0x593726,_0xece3('0xd'));logger[_0xece3('0xe')](_0xece3('0xf'),_0x593726,_0xece3('0xd'),JSON[_0xece3('0x10')](_0x5a9fd0));if(_0x5a9fd0[_0xece3('0x11')]){if(_0x5a9fd0['error']['code']===0x1f4){logger[_0xece3('0x11')](_0xece3('0x12'),_0x593726,_0x5a9fd0[_0xece3('0x11')][_0xece3('0x13')]);return _0x141c6c(_0x5a9fd0['error'][_0xece3('0x13')]);}logger['error'](_0xece3('0x12'),_0x593726,_0x5a9fd0[_0xece3('0x11')][_0xece3('0x13')]);return _0x18499d(_0x5a9fd0[_0xece3('0x11')][_0xece3('0x13')]);}else{logger['info']('VoiceCallReport,\x20%s,\x20%s',_0x593726,_0xece3('0xd'));_0x18499d(_0x5a9fd0[_0xece3('0x14')][_0xece3('0x13')]);}})[_0xece3('0x15')](function(_0x2f6ff9){logger[_0xece3('0x11')]('VoiceCallReport,\x20%s,\x20%s',_0x593726,_0x2f6ff9);_0x141c6c(_0x2f6ff9);});});}exports[_0xece3('0x16')]=function(_0x2964d9){var _0x10709c=this;return new Promise(function(_0x36133c,_0x14260e){return db[_0xece3('0x17')][_0xece3('0x18')]({'raw':_0x2964d9[_0xece3('0x19')]?_0x2964d9[_0xece3('0x19')][_0xece3('0x1a')]===undefined?!![]:![]:!![],'where':_0x2964d9[_0xece3('0x19')]?_0x2964d9[_0xece3('0x19')][_0xece3('0x1b')]||null:null,'attributes':_0x2964d9[_0xece3('0x19')]?_0x2964d9[_0xece3('0x19')][_0xece3('0x1c')]||null:null,'limit':_0x2964d9[_0xece3('0x19')]?_0x2964d9[_0xece3('0x19')]['limit']||null:null,'include':_0x2964d9[_0xece3('0x19')]?_0x2964d9['options'][_0xece3('0x1d')]?_[_0xece3('0x1e')](_0x2964d9[_0xece3('0x19')][_0xece3('0x1d')],function(_0x115e50){return{'model':db[_0x115e50[_0xece3('0x1f')]],'as':_0x115e50['as'],'attributes':_0x115e50[_0xece3('0x1c')],'include':_0x115e50[_0xece3('0x1d')]?_['map'](_0x115e50['include'],function(_0x400113){return{'model':db[_0x400113[_0xece3('0x1f')]],'as':_0x400113['as'],'attributes':_0x400113[_0xece3('0x1c')],'include':_0x400113[_0xece3('0x1d')]?_[_0xece3('0x1e')](_0x400113[_0xece3('0x1d')],function(_0x53db19){return{'model':db[_0x53db19['model']],'as':_0x53db19['as'],'attributes':_0x53db19['attributes']};}):[]};}):[]};}):[]:[]})[_0xece3('0xb')](function(_0x467c42){logger[_0xece3('0xc')](_0xece3('0x16'),_0x2964d9);logger['debug']('GetVoiceCallReport',_0x2964d9,JSON['stringify'](_0x467c42));_0x36133c(_0x467c42);})[_0xece3('0x15')](function(_0x450ea3){logger[_0xece3('0x11')](_0xece3('0x16'),_0x450ea3['message'],_0x2964d9);_0x14260e(_0x10709c[_0xece3('0x11')](0x1f4,_0x450ea3['message']));});});};exports[_0xece3('0x20')]=function(_0xa4bccb){var _0x2d61d2=this;return new Promise(function(_0x6b5604,_0x290836){return db['VoiceCallReport'][_0xece3('0x21')](_0xa4bccb[_0xece3('0x22')],{'raw':_0xa4bccb[_0xece3('0x19')]?_0xa4bccb[_0xece3('0x19')][_0xece3('0x1a')]===undefined?!![]:![]:!![]})[_0xece3('0xb')](function(_0x2b7e6d){logger['info'](_0xece3('0x20'),_0xa4bccb);logger[_0xece3('0xe')](_0xece3('0x20'),_0xa4bccb,JSON[_0xece3('0x10')](_0x2b7e6d));_0x6b5604(_0x2b7e6d);})[_0xece3('0x15')](function(_0x355dbf){logger[_0xece3('0x11')](_0xece3('0x20'),_0x355dbf[_0xece3('0x13')],_0xa4bccb);_0x290836(_0x2d61d2[_0xece3('0x11')](0x1f4,_0x355dbf[_0xece3('0x13')]));});});};exports['UpdateVoiceCallReport']=function(_0xf6e601){var _0x173aa4=this;return new Promise(function(_0x4b3ff2,_0x190c64){return db['VoiceCallReport'][_0xece3('0x23')](_0xf6e601[_0xece3('0x22')],{'raw':_0xf6e601[_0xece3('0x19')]?_0xf6e601['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xf6e601['options']?_0xf6e601[_0xece3('0x19')]['where']||null:null,'attributes':_0xf6e601[_0xece3('0x19')]?_0xf6e601[_0xece3('0x19')][_0xece3('0x1c')]||null:null,'limit':_0xf6e601['options']?_0xf6e601[_0xece3('0x19')][_0xece3('0x24')]||null:null})[_0xece3('0xb')](function(_0x332fcf){logger[_0xece3('0xc')](_0xece3('0x25'),_0xf6e601);logger[_0xece3('0xe')](_0xece3('0x25'),_0xf6e601,JSON[_0xece3('0x10')](_0x332fcf));_0x4b3ff2(_0x332fcf);})[_0xece3('0x15')](function(_0x40960a){logger[_0xece3('0x11')](_0xece3('0x25'),_0x40960a[_0xece3('0x13')],_0xf6e601);_0x190c64(_0x173aa4[_0xece3('0x11')](0x1f4,_0x40960a[_0xece3('0x13')]));});});}; \ No newline at end of file +var _0xa90f=['where','attributes','include','map','model','CreateVoiceCallReport','create','body','then','UpdateVoiceCallReport','update','raw','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','request','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceCallReport','VoiceCallReport','findAll','options'];(function(_0x7c0674,_0x1e846b){var _0x4a5358=function(_0x4e9902){while(--_0x4e9902){_0x7c0674['push'](_0x7c0674['shift']());}};_0x4a5358(++_0x1e846b);}(_0xa90f,0x175));var _0xfa90=function(_0x3335f6,_0x4a6989){_0x3335f6=_0x3335f6-0x0;var _0x2405e9=_0xa90f[_0x3335f6];return _0x2405e9;};'use strict';var _=require(_0xfa90('0x0'));var util=require(_0xfa90('0x1'));var moment=require(_0xfa90('0x2'));var BPromise=require(_0xfa90('0x3'));var rs=require(_0xfa90('0x4'));var fs=require('fs');var Redis=require(_0xfa90('0x5'));var db=require(_0xfa90('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xfa90('0x7'))('rpc');var config=require(_0xfa90('0x8'));var jayson=require(_0xfa90('0x9'));var client=jayson['client'][_0xfa90('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2a0c10,_0x1424d7,_0x58d74b){return new BPromise(function(_0x1721e0,_0x2174c7){return client[_0xfa90('0xb')](_0x2a0c10,_0x58d74b)['then'](function(_0x2f140b){logger[_0xfa90('0xc')](_0xfa90('0xd'),_0x1424d7,_0xfa90('0xe'));logger[_0xfa90('0xf')](_0xfa90('0x10'),_0x1424d7,_0xfa90('0xe'),JSON[_0xfa90('0x11')](_0x2f140b));if(_0x2f140b['error']){if(_0x2f140b[_0xfa90('0x12')][_0xfa90('0x13')]===0x1f4){logger[_0xfa90('0x12')]('VoiceCallReport,\x20%s,\x20%s',_0x1424d7,_0x2f140b[_0xfa90('0x12')][_0xfa90('0x14')]);return _0x2174c7(_0x2f140b['error'][_0xfa90('0x14')]);}logger[_0xfa90('0x12')]('VoiceCallReport,\x20%s,\x20%s',_0x1424d7,_0x2f140b[_0xfa90('0x12')]['message']);return _0x1721e0(_0x2f140b[_0xfa90('0x12')][_0xfa90('0x14')]);}else{logger['info'](_0xfa90('0xd'),_0x1424d7,_0xfa90('0xe'));_0x1721e0(_0x2f140b[_0xfa90('0x15')][_0xfa90('0x14')]);}})[_0xfa90('0x16')](function(_0x5c2d3e){logger[_0xfa90('0x12')](_0xfa90('0xd'),_0x1424d7,_0x5c2d3e);_0x2174c7(_0x5c2d3e);});});}exports[_0xfa90('0x17')]=function(_0x3277af){var _0x3e0204=this;return new Promise(function(_0x5638d3,_0x18e663){return db[_0xfa90('0x18')][_0xfa90('0x19')]({'raw':_0x3277af[_0xfa90('0x1a')]?_0x3277af['options']['raw']===undefined?!![]:![]:!![],'where':_0x3277af[_0xfa90('0x1a')]?_0x3277af[_0xfa90('0x1a')][_0xfa90('0x1b')]||null:null,'attributes':_0x3277af[_0xfa90('0x1a')]?_0x3277af[_0xfa90('0x1a')][_0xfa90('0x1c')]||null:null,'limit':_0x3277af[_0xfa90('0x1a')]?_0x3277af['options']['limit']||null:null,'include':_0x3277af['options']?_0x3277af[_0xfa90('0x1a')][_0xfa90('0x1d')]?_[_0xfa90('0x1e')](_0x3277af[_0xfa90('0x1a')]['include'],function(_0x22986a){return{'model':db[_0x22986a[_0xfa90('0x1f')]],'as':_0x22986a['as'],'attributes':_0x22986a['attributes'],'include':_0x22986a[_0xfa90('0x1d')]?_['map'](_0x22986a[_0xfa90('0x1d')],function(_0x2fa581){return{'model':db[_0x2fa581['model']],'as':_0x2fa581['as'],'attributes':_0x2fa581[_0xfa90('0x1c')],'include':_0x2fa581[_0xfa90('0x1d')]?_['map'](_0x2fa581[_0xfa90('0x1d')],function(_0xe614b9){return{'model':db[_0xe614b9[_0xfa90('0x1f')]],'as':_0xe614b9['as'],'attributes':_0xe614b9['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x11b6fa){logger[_0xfa90('0xc')](_0xfa90('0x17'),_0x3277af);logger[_0xfa90('0xf')](_0xfa90('0x17'),_0x3277af,JSON[_0xfa90('0x11')](_0x11b6fa));_0x5638d3(_0x11b6fa);})[_0xfa90('0x16')](function(_0x3322cc){logger[_0xfa90('0x12')](_0xfa90('0x17'),_0x3322cc['message'],_0x3277af);_0x18e663(_0x3e0204[_0xfa90('0x12')](0x1f4,_0x3322cc[_0xfa90('0x14')]));});});};exports[_0xfa90('0x20')]=function(_0x2029f2){var _0x27dbdb=this;return new Promise(function(_0x30188d,_0x1c7477){return db['VoiceCallReport'][_0xfa90('0x21')](_0x2029f2[_0xfa90('0x22')],{'raw':_0x2029f2[_0xfa90('0x1a')]?_0x2029f2[_0xfa90('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0xfa90('0x23')](function(_0x1c5242){logger[_0xfa90('0xc')](_0xfa90('0x20'),_0x2029f2);logger[_0xfa90('0xf')]('CreateVoiceCallReport',_0x2029f2,JSON['stringify'](_0x1c5242));_0x30188d(_0x1c5242);})[_0xfa90('0x16')](function(_0x3410ce){logger[_0xfa90('0x12')](_0xfa90('0x20'),_0x3410ce[_0xfa90('0x14')],_0x2029f2);_0x1c7477(_0x27dbdb[_0xfa90('0x12')](0x1f4,_0x3410ce[_0xfa90('0x14')]));});});};exports[_0xfa90('0x24')]=function(_0x1d6847){var _0x52063a=this;return new Promise(function(_0x18db72,_0x262518){return db['VoiceCallReport'][_0xfa90('0x25')](_0x1d6847[_0xfa90('0x22')],{'raw':_0x1d6847[_0xfa90('0x1a')]?_0x1d6847[_0xfa90('0x1a')][_0xfa90('0x26')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1d6847['options']?_0x1d6847[_0xfa90('0x1a')]['where']||null:null,'attributes':_0x1d6847[_0xfa90('0x1a')]?_0x1d6847[_0xfa90('0x1a')][_0xfa90('0x1c')]||null:null,'limit':_0x1d6847[_0xfa90('0x1a')]?_0x1d6847[_0xfa90('0x1a')][_0xfa90('0x27')]||null:null})[_0xfa90('0x23')](function(_0x1d6b81){logger[_0xfa90('0xc')](_0xfa90('0x24'),_0x1d6847);logger[_0xfa90('0xf')](_0xfa90('0x24'),_0x1d6847,JSON[_0xfa90('0x11')](_0x1d6b81));_0x18db72(_0x1d6b81);})['catch'](function(_0x52e89c){logger[_0xfa90('0x12')](_0xfa90('0x24'),_0x52e89c[_0xfa90('0x14')],_0x1d6847);_0x262518(_0x52063a[_0xfa90('0x12')](0x1f4,_0x52e89c[_0xfa90('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index cf1288b..042d698 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 _0x21bd=['update','delete','/:id','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','get','isAuthenticated','index','show','create'];(function(_0x33abb4,_0x24d426){var _0x2b3661=function(_0x3ec907){while(--_0x3ec907){_0x33abb4['push'](_0x33abb4['shift']());}};_0x2b3661(++_0x24d426);}(_0x21bd,0x1b4));var _0xd21b=function(_0x235215,_0x2cd57b){_0x235215=_0x235215-0x0;var _0x227dfb=_0x21bd[_0x235215];return _0x227dfb;};'use strict';var multer=require(_0xd21b('0x0'));var util=require(_0xd21b('0x1'));var path=require(_0xd21b('0x2'));var timeout=require(_0xd21b('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xd21b('0x4'));var auth=require(_0xd21b('0x5'));var interaction=require(_0xd21b('0x6'));var config=require(_0xd21b('0x7'));var controller=require(_0xd21b('0x8'));router[_0xd21b('0x9')]('/',auth[_0xd21b('0xa')](),controller[_0xd21b('0xb')]);router[_0xd21b('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xd21b('0xc')]);router['post']('/',auth[_0xd21b('0xa')](),controller[_0xd21b('0xd')]);router['put']('/:id',auth[_0xd21b('0xa')](),controller[_0xd21b('0xe')]);router[_0xd21b('0xf')](_0xd21b('0x10'),auth[_0xd21b('0xa')](),controller['destroy']);module[_0xd21b('0x11')]=router; \ No newline at end of file +var _0x1e1c=['destroy','exports','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','get','isAuthenticated','index','/:id','show','post','create','update'];(function(_0x4911e6,_0x1a52dd){var _0x15956d=function(_0x5bd09f){while(--_0x5bd09f){_0x4911e6['push'](_0x4911e6['shift']());}};_0x15956d(++_0x1a52dd);}(_0x1e1c,0x9b));var _0xc1e1=function(_0x188409,_0x409b58){_0x188409=_0x188409-0x0;var _0x3371af=_0x1e1c[_0x188409];return _0x3371af;};'use strict';var multer=require('multer');var util=require(_0xc1e1('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xc1e1('0x1'));var router=express[_0xc1e1('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xc1e1('0x3'));var interaction=require(_0xc1e1('0x4'));var config=require(_0xc1e1('0x5'));var controller=require(_0xc1e1('0x6'));router[_0xc1e1('0x7')]('/',auth[_0xc1e1('0x8')](),controller[_0xc1e1('0x9')]);router[_0xc1e1('0x7')](_0xc1e1('0xa'),auth[_0xc1e1('0x8')](),controller[_0xc1e1('0xb')]);router[_0xc1e1('0xc')]('/',auth[_0xc1e1('0x8')](),controller[_0xc1e1('0xd')]);router['put'](_0xc1e1('0xa'),auth[_0xc1e1('0x8')](),controller[_0xc1e1('0xe')]);router['delete'](_0xc1e1('0xa'),auth[_0xc1e1('0x8')](),controller[_0xc1e1('0xf')]);module[_0xc1e1('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index 75681c5..97d80fa 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 _0x9dbf=['exports','STRING','name','options','join','getDataValue','split','BOOLEAN'];(function(_0x3ee322,_0x186ee5){var _0x188de7=function(_0x527177){while(--_0x527177){_0x3ee322['push'](_0x3ee322['shift']());}};_0x188de7(++_0x186ee5);}(_0x9dbf,0x118));var _0xf9db=function(_0x34f94d,_0x7dc959){_0x34f94d=_0x34f94d-0x0;var _0x111dd8=_0x9dbf[_0x34f94d];return _0x111dd8;};'use strict';var Sequelize=require('sequelize');module[_0xf9db('0x0')]={'name':{'type':Sequelize[_0xf9db('0x1')]},'prefix':{'type':Sequelize[_0xf9db('0x1')],'unique':_0xf9db('0x2'),'allowNull':![]},'options':{'type':Sequelize['STRING'],'set':function(_0x216e9e){this['setDataValue'](_0xf9db('0x3'),_0x216e9e?_0x216e9e[_0xf9db('0x4')](''):[]);},'get':function(){return this['getDataValue']('options')?this[_0xf9db('0x5')](_0xf9db('0x3'))[_0xf9db('0x6')](''):[];}},'auth':{'type':Sequelize[_0xf9db('0x7')],'defaultValue':![]},'password':{'type':Sequelize[_0xf9db('0x1')]},'record':{'type':Sequelize[_0xf9db('0x7')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0xf9db('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xc773=['join','BOOLEAN','sequelize','exports','STRING','name','options'];(function(_0x135365,_0x5ce7bf){var _0x3cdc77=function(_0x589ebe){while(--_0x589ebe){_0x135365['push'](_0x135365['shift']());}};_0x3cdc77(++_0x5ce7bf);}(_0xc773,0xcd));var _0x3c77=function(_0x172ff9,_0x54a1a4){_0x172ff9=_0x172ff9-0x0;var _0x5047d6=_0xc773[_0x172ff9];return _0x5047d6;};'use strict';var Sequelize=require(_0x3c77('0x0'));module[_0x3c77('0x1')]={'name':{'type':Sequelize[_0x3c77('0x2')]},'prefix':{'type':Sequelize[_0x3c77('0x2')],'unique':_0x3c77('0x3'),'allowNull':![]},'options':{'type':Sequelize['STRING'],'set':function(_0x3f4758){this['setDataValue'](_0x3c77('0x4'),_0x3f4758?_0x3f4758[_0x3c77('0x5')](''):[]);},'get':function(){return this['getDataValue'](_0x3c77('0x4'))?this['getDataValue']('options')['split'](''):[];}},'auth':{'type':Sequelize[_0x3c77('0x6')],'defaultValue':![]},'password':{'type':Sequelize[_0x3c77('0x2')]},'record':{'type':Sequelize[_0x3c77('0x6')],'defaultValue':![]},'recordingFormat':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x3c77('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index 28ce7b5..a6a53a4 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 _0x0fc2=['order','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','include','rows','find','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','ChanSpies','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','destroy','params','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','get','UserProfileResource','end','error','stack','send','map','VoiceChanSpy','rawAttributes','fieldName','model','name','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit'];(function(_0x55e6b5,_0x3d146e){var _0x483199=function(_0x17a601){while(--_0x17a601){_0x55e6b5['push'](_0x55e6b5['shift']());}};_0x483199(++_0x3d146e);}(_0x0fc2,0x6e));var _0x20fc=function(_0xb0576f,_0x15bcbe){_0xb0576f=_0xb0576f-0x0;var _0x497031=_0x0fc2[_0xb0576f];return _0x497031;};'use strict';var emlformat=require(_0x20fc('0x0'));var rimraf=require(_0x20fc('0x1'));var zipdir=require(_0x20fc('0x2'));var jsonpatch=require(_0x20fc('0x3'));var rp=require('request-promise');var moment=require(_0x20fc('0x4'));var BPromise=require(_0x20fc('0x5'));var Mustache=require(_0x20fc('0x6'));var util=require(_0x20fc('0x7'));var path=require(_0x20fc('0x8'));var sox=require(_0x20fc('0x9'));var csv=require(_0x20fc('0xa'));var ejs=require(_0x20fc('0xb'));var fs=require('fs');var fs_extra=require(_0x20fc('0xc'));var _=require(_0x20fc('0xd'));var squel=require(_0x20fc('0xe'));var crypto=require(_0x20fc('0xf'));var jsforce=require(_0x20fc('0x10'));var deskjs=require(_0x20fc('0x11'));var toCsv=require(_0x20fc('0xa'));var querystring=require(_0x20fc('0x12'));var Papa=require('papaparse');var Redis=require(_0x20fc('0x13'));var authService=require(_0x20fc('0x14'));var qs=require(_0x20fc('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x20fc('0x16'));var logger=require(_0x20fc('0x17'))(_0x20fc('0x18'));var utils=require(_0x20fc('0x19'));var config=require(_0x20fc('0x1a'));var licenseUtil=require(_0x20fc('0x1b'));var db=require(_0x20fc('0x1c'))['db'];function respondWithStatusCode(_0x395d8b,_0x552afe){_0x552afe=_0x552afe||0xcc;return function(_0xe97a3e){if(_0xe97a3e){return _0x395d8b['sendStatus'](_0x552afe);}return _0x395d8b[_0x20fc('0x1d')](_0x552afe)['end']();};}function respondWithResult(_0x2f0048,_0x4c7f0e){_0x4c7f0e=_0x4c7f0e||0xc8;return function(_0x520c02){if(_0x520c02){return _0x2f0048[_0x20fc('0x1d')](_0x4c7f0e)[_0x20fc('0x1e')](_0x520c02);}};}function respondWithFilteredResult(_0x25f620,_0x38a6da){return function(_0x511e79){if(_0x511e79){var _0x29fe77=typeof _0x38a6da[_0x20fc('0x1f')]==='undefined'&&typeof _0x38a6da['limit']===_0x20fc('0x20');var _0x3dbdc0=_0x511e79[_0x20fc('0x21')];var _0x421ff8=_0x29fe77?0x0:_0x38a6da['offset'];var _0x3f4190=_0x29fe77?_0x511e79[_0x20fc('0x21')]:_0x38a6da[_0x20fc('0x1f')]+_0x38a6da[_0x20fc('0x22')];var _0x1eaebd;if(_0x3f4190>=_0x3dbdc0){_0x3f4190=_0x3dbdc0;_0x1eaebd=0xc8;}else{_0x1eaebd=0xce;}_0x25f620[_0x20fc('0x1d')](_0x1eaebd);return _0x25f620[_0x20fc('0x23')](_0x20fc('0x24'),_0x421ff8+'-'+_0x3f4190+'/'+_0x3dbdc0)[_0x20fc('0x1e')](_0x511e79);}return null;};}function patchUpdates(_0x41be86){return function(_0x4e2b0c){try{jsonpatch[_0x20fc('0x25')](_0x4e2b0c,_0x41be86,!![]);}catch(_0x14b835){return BPromise['reject'](_0x14b835);}return _0x4e2b0c[_0x20fc('0x26')]();};}function saveUpdates(_0xd6e20e,_0x359881){return function(_0x39339a){if(_0x39339a){return _0x39339a[_0x20fc('0x27')](_0xd6e20e)[_0x20fc('0x28')](function(_0x1dcafe){return _0x1dcafe;});}return null;};}function removeEntity(_0x4bc36b,_0x37d3ad){return function(_0x25d8d9){if(_0x25d8d9){return _0x25d8d9['destroy']()[_0x20fc('0x28')](function(){var _0x2d3831=_0x25d8d9[_0x20fc('0x29')]({'plain':!![]});var _0x2ed63f='ChanSpies';return db[_0x20fc('0x2a')]['destroy']({'where':{'type':_0x2ed63f,'resourceId':_0x2d3831['id']}})['then'](function(){return _0x25d8d9;});})[_0x20fc('0x28')](function(){_0x4bc36b['status'](0xcc)[_0x20fc('0x2b')]();});}};}function handleEntityNotFound(_0x1d387f,_0x43e310){return function(_0x5eae37){if(!_0x5eae37){_0x1d387f['sendStatus'](0x194);}return _0x5eae37;};}function handleError(_0x56f147,_0x3e0655){_0x3e0655=_0x3e0655||0x1f4;return function(_0x295f9a){logger[_0x20fc('0x2c')](_0x295f9a[_0x20fc('0x2d')]);if(_0x295f9a['name']){delete _0x295f9a['name'];}_0x56f147[_0x20fc('0x1d')](_0x3e0655)[_0x20fc('0x2e')](_0x295f9a);};}exports['index']=function(_0x5923b1,_0x37fb71){var _0x539268={},_0x21929a={},_0x40fe37={'count':0x0,'rows':[]};var _0x1865db=_[_0x20fc('0x2f')](db[_0x20fc('0x30')][_0x20fc('0x31')],function(_0x4bfa23){return{'name':_0x4bfa23[_0x20fc('0x32')],'type':_0x4bfa23['type']['key']};});_0x21929a[_0x20fc('0x33')]=_['map'](_0x1865db,_0x20fc('0x34'));_0x21929a[_0x20fc('0x35')]=_[_0x20fc('0x36')](_0x5923b1[_0x20fc('0x35')]);_0x21929a[_0x20fc('0x37')]=_['intersection'](_0x21929a[_0x20fc('0x33')],_0x21929a['query']);_0x539268[_0x20fc('0x38')]=_[_0x20fc('0x39')](_0x21929a['model'],qs[_0x20fc('0x3a')](_0x5923b1['query'][_0x20fc('0x3a')]));_0x539268['attributes']=_0x539268['attributes'][_0x20fc('0x3b')]?_0x539268[_0x20fc('0x38')]:_0x21929a[_0x20fc('0x33')];if(!_0x5923b1[_0x20fc('0x35')][_0x20fc('0x3c')](_0x20fc('0x3d'))){_0x539268['limit']=qs[_0x20fc('0x22')](_0x5923b1[_0x20fc('0x35')][_0x20fc('0x22')]);_0x539268[_0x20fc('0x1f')]=qs[_0x20fc('0x1f')](_0x5923b1[_0x20fc('0x35')][_0x20fc('0x1f')]);}_0x539268[_0x20fc('0x3e')]=qs['sort'](_0x5923b1[_0x20fc('0x35')][_0x20fc('0x3f')]);_0x539268[_0x20fc('0x40')]=qs[_0x20fc('0x37')](_[_0x20fc('0x41')](_0x5923b1[_0x20fc('0x35')],_0x21929a['filters']),_0x1865db);if(_0x5923b1['query']['filter']){_0x539268[_0x20fc('0x40')]=_['merge'](_0x539268[_0x20fc('0x40')],{'$or':_[_0x20fc('0x2f')](_0x1865db,function(_0x236811){if(_0x236811['type']!==_0x20fc('0x42')){var _0x20cb18={};_0x20cb18[_0x236811[_0x20fc('0x34')]]={'$like':'%'+_0x5923b1[_0x20fc('0x35')][_0x20fc('0x43')]+'%'};return _0x20cb18;}})});}_0x539268=_[_0x20fc('0x44')]({},_0x539268,_0x5923b1[_0x20fc('0x45')]);var _0x2ced6b={'where':_0x539268[_0x20fc('0x40')]};return db[_0x20fc('0x30')][_0x20fc('0x21')](_0x2ced6b)[_0x20fc('0x28')](function(_0x5ab2c9){_0x40fe37[_0x20fc('0x21')]=_0x5ab2c9;if(_0x5923b1[_0x20fc('0x35')][_0x20fc('0x46')]){_0x539268[_0x20fc('0x47')]=[{'all':!![]}];}return db['VoiceChanSpy']['findAll'](_0x539268);})[_0x20fc('0x28')](function(_0x2f8ee2){_0x40fe37[_0x20fc('0x48')]=_0x2f8ee2;return _0x40fe37;})[_0x20fc('0x28')](respondWithFilteredResult(_0x37fb71,_0x539268))['catch'](handleError(_0x37fb71,null));};exports['show']=function(_0x278308,_0x39ed13){var _0x912f65={'raw':![],'where':{'id':_0x278308['params']['id']}},_0x2feed2={};_0x2feed2['model']=_[_0x20fc('0x36')](db[_0x20fc('0x30')][_0x20fc('0x31')]);_0x2feed2[_0x20fc('0x35')]=_[_0x20fc('0x36')](_0x278308['query']);_0x2feed2[_0x20fc('0x37')]=_['intersection'](_0x2feed2[_0x20fc('0x33')],_0x2feed2[_0x20fc('0x35')]);_0x912f65[_0x20fc('0x38')]=_[_0x20fc('0x39')](_0x2feed2[_0x20fc('0x33')],qs[_0x20fc('0x3a')](_0x278308[_0x20fc('0x35')][_0x20fc('0x3a')]));_0x912f65[_0x20fc('0x38')]=_0x912f65[_0x20fc('0x38')][_0x20fc('0x3b')]?_0x912f65[_0x20fc('0x38')]:_0x2feed2[_0x20fc('0x33')];if(_0x278308[_0x20fc('0x35')][_0x20fc('0x46')]){_0x912f65[_0x20fc('0x47')]=[{'all':!![]}];}_0x912f65=_['merge']({},_0x912f65,_0x278308[_0x20fc('0x45')]);return db[_0x20fc('0x30')][_0x20fc('0x49')](_0x912f65)[_0x20fc('0x28')](handleEntityNotFound(_0x39ed13,null))[_0x20fc('0x28')](respondWithResult(_0x39ed13,null))[_0x20fc('0x4a')](handleError(_0x39ed13,null));};exports[_0x20fc('0x4b')]=function(_0x2a2897,_0x35d84c){return db[_0x20fc('0x30')][_0x20fc('0x4b')](_0x2a2897['body'],{})[_0x20fc('0x28')](function(_0x220752){var _0x17da1c=_0x2a2897[_0x20fc('0x4c')][_0x20fc('0x29')]({'plain':!![]});if(!_0x17da1c)throw new Error(_0x20fc('0x4d'));if(_0x17da1c['role']===_0x20fc('0x4c')){var _0x236628=_0x220752[_0x20fc('0x29')]({'plain':!![]});var _0x3abe75=_0x20fc('0x4e');return db[_0x20fc('0x4f')][_0x20fc('0x49')]({'where':{'name':_0x3abe75,'userProfileId':_0x17da1c[_0x20fc('0x50')]},'raw':!![]})['then'](function(_0x4bf571){if(_0x4bf571&&_0x4bf571[_0x20fc('0x51')]===0x0){return db[_0x20fc('0x2a')][_0x20fc('0x4b')]({'name':_0x236628[_0x20fc('0x34')],'resourceId':_0x236628['id'],'type':_0x4bf571['name'],'sectionId':_0x4bf571['id']},{})['then'](function(){return _0x220752;});}else{return _0x220752;}})['catch'](function(_0x1b5903){logger[_0x20fc('0x2c')](_0x20fc('0x52'),_0x1b5903);throw _0x1b5903;});}return _0x220752;})['then'](respondWithResult(_0x35d84c,0xc9))[_0x20fc('0x4a')](handleError(_0x35d84c,null));};exports[_0x20fc('0x27')]=function(_0x46bea7,_0x1159a2){if(_0x46bea7['body']['id']){delete _0x46bea7[_0x20fc('0x53')]['id'];}return db[_0x20fc('0x30')][_0x20fc('0x49')]({'where':{'id':_0x46bea7['params']['id']}})[_0x20fc('0x28')](handleEntityNotFound(_0x1159a2,null))[_0x20fc('0x28')](saveUpdates(_0x46bea7[_0x20fc('0x53')],null))[_0x20fc('0x28')](respondWithResult(_0x1159a2,null))[_0x20fc('0x4a')](handleError(_0x1159a2,null));};exports[_0x20fc('0x54')]=function(_0x3e2a1a,_0x1c7fa9){return db[_0x20fc('0x30')][_0x20fc('0x49')]({'where':{'id':_0x3e2a1a[_0x20fc('0x55')]['id']}})['then'](handleEntityNotFound(_0x1c7fa9,null))[_0x20fc('0x28')](removeEntity(_0x1c7fa9,null))[_0x20fc('0x4a')](handleError(_0x1c7fa9,null));}; \ No newline at end of file +var _0x0531=['status','end','json','offset','undefined','count','set','apply','save','then','UserProfileResource','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','VoiceChanSpy','includeAll','include','findAll','rows','catch','show','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','ChanSpies','UserProfileSection','userProfileId','autoAssociation','eml-format','rimraf','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x30655d,_0x371a87){var _0x170c3e=function(_0x4efc97){while(--_0x4efc97){_0x30655d['push'](_0x30655d['shift']());}};_0x170c3e(++_0x371a87);}(_0x0531,0xde));var _0x1053=function(_0x3e478c,_0x152670){_0x3e478c=_0x3e478c-0x0;var _0x29ef89=_0x0531[_0x3e478c];return _0x29ef89;};'use strict';var emlformat=require(_0x1053('0x0'));var rimraf=require(_0x1053('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x1053('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x1053('0x3'));var util=require(_0x1053('0x4'));var path=require(_0x1053('0x5'));var sox=require(_0x1053('0x6'));var csv=require(_0x1053('0x7'));var ejs=require(_0x1053('0x8'));var fs=require('fs');var fs_extra=require(_0x1053('0x9'));var _=require(_0x1053('0xa'));var squel=require(_0x1053('0xb'));var crypto=require(_0x1053('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x1053('0xd'));var toCsv=require(_0x1053('0x7'));var querystring=require(_0x1053('0xe'));var Papa=require('papaparse');var Redis=require(_0x1053('0xf'));var authService=require(_0x1053('0x10'));var qs=require(_0x1053('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x1053('0x12'))(_0x1053('0x13'));var utils=require('../../config/utils');var config=require(_0x1053('0x14'));var licenseUtil=require(_0x1053('0x15'));var db=require(_0x1053('0x16'))['db'];function respondWithStatusCode(_0x453a9c,_0x44b763){_0x44b763=_0x44b763||0xcc;return function(_0x28e0ae){if(_0x28e0ae){return _0x453a9c[_0x1053('0x17')](_0x44b763);}return _0x453a9c[_0x1053('0x18')](_0x44b763)[_0x1053('0x19')]();};}function respondWithResult(_0x2884b2,_0x5f477d){_0x5f477d=_0x5f477d||0xc8;return function(_0x4d6aa1){if(_0x4d6aa1){return _0x2884b2[_0x1053('0x18')](_0x5f477d)[_0x1053('0x1a')](_0x4d6aa1);}};}function respondWithFilteredResult(_0x41bf5c,_0x4db31d){return function(_0x5afba2){if(_0x5afba2){var _0x1f9067=typeof _0x4db31d[_0x1053('0x1b')]==='undefined'&&typeof _0x4db31d['limit']===_0x1053('0x1c');var _0x3c60a4=_0x5afba2[_0x1053('0x1d')];var _0x26c285=_0x1f9067?0x0:_0x4db31d['offset'];var _0x3523c0=_0x1f9067?_0x5afba2[_0x1053('0x1d')]:_0x4db31d[_0x1053('0x1b')]+_0x4db31d['limit'];var _0x259fb6;if(_0x3523c0>=_0x3c60a4){_0x3523c0=_0x3c60a4;_0x259fb6=0xc8;}else{_0x259fb6=0xce;}_0x41bf5c['status'](_0x259fb6);return _0x41bf5c[_0x1053('0x1e')]('Content-Range',_0x26c285+'-'+_0x3523c0+'/'+_0x3c60a4)['json'](_0x5afba2);}return null;};}function patchUpdates(_0x1b7f9e){return function(_0x448651){try{jsonpatch[_0x1053('0x1f')](_0x448651,_0x1b7f9e,!![]);}catch(_0x53a626){return BPromise['reject'](_0x53a626);}return _0x448651[_0x1053('0x20')]();};}function saveUpdates(_0x15204b,_0x203930){return function(_0x27371a){if(_0x27371a){return _0x27371a['update'](_0x15204b)[_0x1053('0x21')](function(_0x5c2710){return _0x5c2710;});}return null;};}function removeEntity(_0x2a13a7,_0x485f14){return function(_0x901db2){if(_0x901db2){return _0x901db2['destroy']()['then'](function(){var _0x4f3eb4=_0x901db2['get']({'plain':!![]});var _0x3dc2c0='ChanSpies';return db[_0x1053('0x22')][_0x1053('0x23')]({'where':{'type':_0x3dc2c0,'resourceId':_0x4f3eb4['id']}})[_0x1053('0x21')](function(){return _0x901db2;});})[_0x1053('0x21')](function(){_0x2a13a7[_0x1053('0x18')](0xcc)[_0x1053('0x19')]();});}};}function handleEntityNotFound(_0x2c7c39,_0x57c6e7){return function(_0x391194){if(!_0x391194){_0x2c7c39['sendStatus'](0x194);}return _0x391194;};}function handleError(_0x32c909,_0x2a4b4a){_0x2a4b4a=_0x2a4b4a||0x1f4;return function(_0x430601){logger[_0x1053('0x24')](_0x430601[_0x1053('0x25')]);if(_0x430601[_0x1053('0x26')]){delete _0x430601[_0x1053('0x26')];}_0x32c909[_0x1053('0x18')](_0x2a4b4a)[_0x1053('0x27')](_0x430601);};}exports[_0x1053('0x28')]=function(_0x20b27a,_0x27c11e){var _0x3ecd53={},_0x13c93b={},_0x4ff75d={'count':0x0,'rows':[]};var _0x363257=_[_0x1053('0x29')](db['VoiceChanSpy'][_0x1053('0x2a')],function(_0x3d75ca){return{'name':_0x3d75ca[_0x1053('0x2b')],'type':_0x3d75ca[_0x1053('0x2c')][_0x1053('0x2d')]};});_0x13c93b[_0x1053('0x2e')]=_[_0x1053('0x29')](_0x363257,_0x1053('0x26'));_0x13c93b[_0x1053('0x2f')]=_[_0x1053('0x30')](_0x20b27a[_0x1053('0x2f')]);_0x13c93b['filters']=_[_0x1053('0x31')](_0x13c93b[_0x1053('0x2e')],_0x13c93b[_0x1053('0x2f')]);_0x3ecd53[_0x1053('0x32')]=_['intersection'](_0x13c93b[_0x1053('0x2e')],qs[_0x1053('0x33')](_0x20b27a[_0x1053('0x2f')][_0x1053('0x33')]));_0x3ecd53[_0x1053('0x32')]=_0x3ecd53[_0x1053('0x32')][_0x1053('0x34')]?_0x3ecd53[_0x1053('0x32')]:_0x13c93b['model'];if(!_0x20b27a[_0x1053('0x2f')][_0x1053('0x35')]('nolimit')){_0x3ecd53[_0x1053('0x36')]=qs['limit'](_0x20b27a['query']['limit']);_0x3ecd53[_0x1053('0x1b')]=qs[_0x1053('0x1b')](_0x20b27a[_0x1053('0x2f')][_0x1053('0x1b')]);}_0x3ecd53[_0x1053('0x37')]=qs[_0x1053('0x38')](_0x20b27a['query'][_0x1053('0x38')]);_0x3ecd53[_0x1053('0x39')]=qs[_0x1053('0x3a')](_[_0x1053('0x3b')](_0x20b27a[_0x1053('0x2f')],_0x13c93b[_0x1053('0x3a')]),_0x363257);if(_0x20b27a[_0x1053('0x2f')][_0x1053('0x3c')]){_0x3ecd53[_0x1053('0x39')]=_[_0x1053('0x3d')](_0x3ecd53[_0x1053('0x39')],{'$or':_[_0x1053('0x29')](_0x363257,function(_0x5de715){if(_0x5de715[_0x1053('0x2c')]!==_0x1053('0x3e')){var _0x145394={};_0x145394[_0x5de715[_0x1053('0x26')]]={'$like':'%'+_0x20b27a[_0x1053('0x2f')]['filter']+'%'};return _0x145394;}})});}_0x3ecd53=_[_0x1053('0x3d')]({},_0x3ecd53,_0x20b27a[_0x1053('0x3f')]);var _0x426af4={'where':_0x3ecd53['where']};return db[_0x1053('0x40')][_0x1053('0x1d')](_0x426af4)[_0x1053('0x21')](function(_0x11cd06){_0x4ff75d[_0x1053('0x1d')]=_0x11cd06;if(_0x20b27a[_0x1053('0x2f')][_0x1053('0x41')]){_0x3ecd53[_0x1053('0x42')]=[{'all':!![]}];}return db[_0x1053('0x40')][_0x1053('0x43')](_0x3ecd53);})[_0x1053('0x21')](function(_0x44d267){_0x4ff75d[_0x1053('0x44')]=_0x44d267;return _0x4ff75d;})[_0x1053('0x21')](respondWithFilteredResult(_0x27c11e,_0x3ecd53))[_0x1053('0x45')](handleError(_0x27c11e,null));};exports[_0x1053('0x46')]=function(_0xed934f,_0x48c6ef){var _0x3087b7={'raw':![],'where':{'id':_0xed934f[_0x1053('0x47')]['id']}},_0x5d6db9={};_0x5d6db9[_0x1053('0x2e')]=_[_0x1053('0x30')](db[_0x1053('0x40')][_0x1053('0x2a')]);_0x5d6db9[_0x1053('0x2f')]=_[_0x1053('0x30')](_0xed934f[_0x1053('0x2f')]);_0x5d6db9[_0x1053('0x3a')]=_[_0x1053('0x31')](_0x5d6db9['model'],_0x5d6db9[_0x1053('0x2f')]);_0x3087b7[_0x1053('0x32')]=_['intersection'](_0x5d6db9[_0x1053('0x2e')],qs[_0x1053('0x33')](_0xed934f[_0x1053('0x2f')]['fields']));_0x3087b7[_0x1053('0x32')]=_0x3087b7[_0x1053('0x32')]['length']?_0x3087b7[_0x1053('0x32')]:_0x5d6db9[_0x1053('0x2e')];if(_0xed934f[_0x1053('0x2f')][_0x1053('0x41')]){_0x3087b7['include']=[{'all':!![]}];}_0x3087b7=_[_0x1053('0x3d')]({},_0x3087b7,_0xed934f[_0x1053('0x3f')]);return db[_0x1053('0x40')][_0x1053('0x48')](_0x3087b7)[_0x1053('0x21')](handleEntityNotFound(_0x48c6ef,null))[_0x1053('0x21')](respondWithResult(_0x48c6ef,null))[_0x1053('0x45')](handleError(_0x48c6ef,null));};exports['create']=function(_0x3b16c4,_0x1066e7){return db[_0x1053('0x40')][_0x1053('0x49')](_0x3b16c4[_0x1053('0x4a')],{})[_0x1053('0x21')](function(_0x1237e4){var _0x2bf362=_0x3b16c4['user']['get']({'plain':!![]});if(!_0x2bf362)throw new Error(_0x1053('0x4b'));if(_0x2bf362[_0x1053('0x4c')]==='user'){var _0x204ac8=_0x1237e4[_0x1053('0x4d')]({'plain':!![]});var _0x26e32=_0x1053('0x4e');return db[_0x1053('0x4f')]['find']({'where':{'name':_0x26e32,'userProfileId':_0x2bf362[_0x1053('0x50')]},'raw':!![]})[_0x1053('0x21')](function(_0x3d0a35){if(_0x3d0a35&&_0x3d0a35[_0x1053('0x51')]===0x0){return db[_0x1053('0x22')]['create']({'name':_0x204ac8[_0x1053('0x26')],'resourceId':_0x204ac8['id'],'type':_0x3d0a35[_0x1053('0x26')],'sectionId':_0x3d0a35['id']},{})['then'](function(){return _0x1237e4;});}else{return _0x1237e4;}})[_0x1053('0x45')](function(_0xc5e21d){logger[_0x1053('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xc5e21d);throw _0xc5e21d;});}return _0x1237e4;})[_0x1053('0x21')](respondWithResult(_0x1066e7,0xc9))['catch'](handleError(_0x1066e7,null));};exports['update']=function(_0x358424,_0x11ee5a){if(_0x358424[_0x1053('0x4a')]['id']){delete _0x358424['body']['id'];}return db[_0x1053('0x40')]['find']({'where':{'id':_0x358424[_0x1053('0x47')]['id']}})['then'](handleEntityNotFound(_0x11ee5a,null))['then'](saveUpdates(_0x358424[_0x1053('0x4a')],null))[_0x1053('0x21')](respondWithResult(_0x11ee5a,null))[_0x1053('0x45')](handleError(_0x11ee5a,null));};exports['destroy']=function(_0x2fbc4,_0x3cc7cb){return db['VoiceChanSpy'][_0x1053('0x48')]({'where':{'id':_0x2fbc4[_0x1053('0x47')]['id']}})[_0x1053('0x21')](handleEntityNotFound(_0x3cc7cb,null))[_0x1053('0x21')](removeEntity(_0x3cc7cb,null))['catch'](handleError(_0x3cc7cb,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index a6c7b03..1521e98 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 _0x6f83=['join','StopMixMonitor','length','concat','internal','findAll','agent','then','catch','exports','models','define','VoiceChanSpy','voice_chanspy','VoiceExtension','bulkCreate','destroy','lodash','util','./voiceChanSpy.attributes','from-sip','format','%s%s','prefix','system','push','merge','Set','CDR(type)=%s','chanspy','record','${UNIQUEID}.%s,a','recordingFormat','auth','Authenticate','password','SIP/%s,%s','name'];(function(_0x41cb4b,_0x200468){var _0x1719c1=function(_0x53ad61){while(--_0x53ad61){_0x41cb4b['push'](_0x41cb4b['shift']());}};_0x1719c1(++_0x200468);}(_0x6f83,0x11b));var _0x36f8=function(_0x5bd928,_0x303efd){_0x5bd928=_0x5bd928-0x0;var _0x2be1fa=_0x6f83[_0x5bd928];return _0x2be1fa;};'use strict';var _=require(_0x36f8('0x0'));var util=require(_0x36f8('0x1'));var BPromise=require('bluebird');var attributes=require(_0x36f8('0x2'));var getUserApplications=function(_0x4f5a64,_0x54b8bc,_0xce371d){var _0x13fd49=0x1;var _0x37377a=[];var _0x3a1590={'context':_0x54b8bc['context']||_0x36f8('0x3'),'exten':util[_0x36f8('0x4')](_0x36f8('0x5'),_0x4f5a64[_0x36f8('0x6')],_0xce371d),'type':_0x36f8('0x7'),'isApp':![],'ChanSpyId':_0x4f5a64['id'],'UserId':_0x54b8bc['id']};_0x37377a[_0x36f8('0x8')](_[_0x36f8('0x9')]({'app':_0x36f8('0xa'),'appdata':util['format'](_0x36f8('0xb'),_0x36f8('0xc')),'priority':_0x13fd49++},_0x3a1590));if(_0x4f5a64[_0x36f8('0xd')]){_0x37377a[_0x36f8('0x8')](_[_0x36f8('0x9')]({'app':'MixMonitor','appdata':util[_0x36f8('0x4')](_0x36f8('0xe'),_0x4f5a64[_0x36f8('0xf')]),'priority':_0x13fd49++},_0x3a1590));}if(_0x4f5a64[_0x36f8('0x10')]){_0x37377a[_0x36f8('0x8')](_['merge']({'app':_0x36f8('0x11'),'appdata':_0x4f5a64[_0x36f8('0x12')],'priority':_0x13fd49++},_0x3a1590));}_0x37377a[_0x36f8('0x8')](_[_0x36f8('0x9')]({'app':'ChanSpy','appdata':util[_0x36f8('0x4')](_0x36f8('0x13'),_0x54b8bc[_0x36f8('0x14')],_0x4f5a64['options']?_0x4f5a64['options'][_0x36f8('0x15')](''):''),'priority':_0x13fd49++},_0x3a1590));if(_0x4f5a64['record']){_0x37377a[_0x36f8('0x8')](_[_0x36f8('0x9')]({'app':_0x36f8('0x16'),'priority':_0x13fd49++},_0x3a1590));}return _0x37377a;};var getChanSpyApplications=function(_0x39ed1b,_0x2b7693){var _0x1eaa21=[];for(var _0x281c8a=0x0,_0xdb4e09=0x1;_0x281c8a<_0x2b7693[_0x36f8('0x17')];_0x281c8a++,_0xdb4e09=0x1){_0x1eaa21=_0x1eaa21[_0x36f8('0x18')](getUserApplications(_0x39ed1b,_0x2b7693[_0x281c8a],_0x2b7693[_0x281c8a][_0x36f8('0x19')]));if(_0x2b7693[_0x281c8a][_0x36f8('0x19')]!=_0x2b7693[_0x281c8a][_0x36f8('0x14')]){_0x1eaa21=_0x1eaa21[_0x36f8('0x18')](getUserApplications(_0x39ed1b,_0x2b7693[_0x281c8a],_0x2b7693[_0x281c8a][_0x36f8('0x14')]));}}return _0x1eaa21;};var getChanSpyPromise=function(_0x543f17,_0x732641){return new BPromise(function(_0x3dee06,_0x5337b5){return _0x543f17['User'][_0x36f8('0x1a')]({'attributes':['id',_0x36f8('0x14'),_0x36f8('0x19')],'where':{'role':_0x36f8('0x1b'),'chanspy':!![]},'raw':!![]})[_0x36f8('0x1c')](function(_0x1f411b){if(_0x1f411b){return _0x3dee06(getChanSpyApplications(_0x732641,_0x1f411b));}return _0x3dee06([]);})[_0x36f8('0x1d')](function(_0xc1555c){_0x5337b5(_0xc1555c);});});};module[_0x36f8('0x1e')]=function(_0x12dfc5,_0x2e3019){var _0x2ad73b=_0x12dfc5[_0x36f8('0x1f')];return _0x12dfc5[_0x36f8('0x20')](_0x36f8('0x21'),attributes,{'tableName':_0x36f8('0x22'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x187a87,_0x52e8b7,_0x297345){return getChanSpyPromise(_0x2ad73b,_0x187a87)[_0x36f8('0x1c')](function(_0x486544){if(_0x486544&&_0x486544[_0x36f8('0x17')]){return _0x2ad73b[_0x36f8('0x23')][_0x36f8('0x24')](_0x486544);}})['then'](function(){_0x297345();})[_0x36f8('0x1d')](function(_0x182e61){_0x297345(_0x182e61);});},'afterUpdate':function(_0x3a0ae9,_0x37937a,_0x4ce17b){return _0x2ad73b[_0x36f8('0x23')][_0x36f8('0x25')]({'where':{'ChanSpyId':_0x3a0ae9['id']}})['then'](function(){return getChanSpyPromise(_0x2ad73b,_0x3a0ae9);})[_0x36f8('0x1c')](function(_0x56f9d1){if(_0x56f9d1&&_0x56f9d1[_0x36f8('0x17')]){return _0x2ad73b[_0x36f8('0x23')][_0x36f8('0x24')](_0x56f9d1);}})[_0x36f8('0x1c')](function(){_0x4ce17b();})[_0x36f8('0x1d')](function(_0x45734b){_0x4ce17b(_0x45734b);});},'afterDestroy':function(_0x41d8ae,_0x2dbe18,_0x57e289){return _0x2ad73b['VoiceExtension'][_0x36f8('0x25')]({'where':{'ChanSpyId':_0x41d8ae['id']}})[_0x36f8('0x1c')](function(){_0x57e289();})[_0x36f8('0x1d')](function(_0x477388){_0x57e289(_0x477388);});}}});}; \ No newline at end of file +var _0x21ab=['bluebird','context','from-sip','format','system','merge','CDR(type)=%s','chanspy','${UNIQUEID}.%s,a','auth','Authenticate','password','ChanSpy','SIP/%s,%s','name','options','push','internal','findAll','agent','then','exports','models','VoiceChanSpy','voice_chanspy','length','VoiceExtension','bulkCreate','catch','destroy','util'];(function(_0x32cfee,_0x512886){var _0xd16341=function(_0x5ae0ef){while(--_0x5ae0ef){_0x32cfee['push'](_0x32cfee['shift']());}};_0xd16341(++_0x512886);}(_0x21ab,0x192));var _0xb21a=function(_0x493370,_0x4c7fac){_0x493370=_0x493370-0x0;var _0xac15d=_0x21ab[_0x493370];return _0xac15d;};'use strict';var _=require('lodash');var util=require(_0xb21a('0x0'));var BPromise=require(_0xb21a('0x1'));var attributes=require('./voiceChanSpy.attributes');var getUserApplications=function(_0x3ec747,_0x30d600,_0x372afb){var _0x222d8d=0x1;var _0x1eaaf4=[];var _0x3210fc={'context':_0x30d600[_0xb21a('0x2')]||_0xb21a('0x3'),'exten':util[_0xb21a('0x4')]('%s%s',_0x3ec747['prefix'],_0x372afb),'type':_0xb21a('0x5'),'isApp':![],'ChanSpyId':_0x3ec747['id'],'UserId':_0x30d600['id']};_0x1eaaf4['push'](_[_0xb21a('0x6')]({'app':'Set','appdata':util[_0xb21a('0x4')](_0xb21a('0x7'),_0xb21a('0x8')),'priority':_0x222d8d++},_0x3210fc));if(_0x3ec747['record']){_0x1eaaf4['push'](_[_0xb21a('0x6')]({'app':'MixMonitor','appdata':util[_0xb21a('0x4')](_0xb21a('0x9'),_0x3ec747['recordingFormat']),'priority':_0x222d8d++},_0x3210fc));}if(_0x3ec747[_0xb21a('0xa')]){_0x1eaaf4['push'](_['merge']({'app':_0xb21a('0xb'),'appdata':_0x3ec747[_0xb21a('0xc')],'priority':_0x222d8d++},_0x3210fc));}_0x1eaaf4['push'](_[_0xb21a('0x6')]({'app':_0xb21a('0xd'),'appdata':util['format'](_0xb21a('0xe'),_0x30d600[_0xb21a('0xf')],_0x3ec747['options']?_0x3ec747[_0xb21a('0x10')]['join'](''):''),'priority':_0x222d8d++},_0x3210fc));if(_0x3ec747['record']){_0x1eaaf4[_0xb21a('0x11')](_[_0xb21a('0x6')]({'app':'StopMixMonitor','priority':_0x222d8d++},_0x3210fc));}return _0x1eaaf4;};var getChanSpyApplications=function(_0x4b4301,_0x450272){var _0x33f19a=[];for(var _0x19658d=0x0,_0x192909=0x1;_0x19658d<_0x450272['length'];_0x19658d++,_0x192909=0x1){_0x33f19a=_0x33f19a['concat'](getUserApplications(_0x4b4301,_0x450272[_0x19658d],_0x450272[_0x19658d][_0xb21a('0x12')]));if(_0x450272[_0x19658d][_0xb21a('0x12')]!=_0x450272[_0x19658d][_0xb21a('0xf')]){_0x33f19a=_0x33f19a['concat'](getUserApplications(_0x4b4301,_0x450272[_0x19658d],_0x450272[_0x19658d]['name']));}}return _0x33f19a;};var getChanSpyPromise=function(_0x464a29,_0x920487){return new BPromise(function(_0x2ef417,_0xbdd18){return _0x464a29['User'][_0xb21a('0x13')]({'attributes':['id',_0xb21a('0xf'),_0xb21a('0x12')],'where':{'role':_0xb21a('0x14'),'chanspy':!![]},'raw':!![]})[_0xb21a('0x15')](function(_0x2941d1){if(_0x2941d1){return _0x2ef417(getChanSpyApplications(_0x920487,_0x2941d1));}return _0x2ef417([]);})['catch'](function(_0x298bed){_0xbdd18(_0x298bed);});});};module[_0xb21a('0x16')]=function(_0xd0ef77,_0x31c703){var _0x2ae463=_0xd0ef77[_0xb21a('0x17')];return _0xd0ef77['define'](_0xb21a('0x18'),attributes,{'tableName':_0xb21a('0x19'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x15aacd,_0x42cffa,_0x46d399){return getChanSpyPromise(_0x2ae463,_0x15aacd)['then'](function(_0x4c9620){if(_0x4c9620&&_0x4c9620[_0xb21a('0x1a')]){return _0x2ae463[_0xb21a('0x1b')][_0xb21a('0x1c')](_0x4c9620);}})[_0xb21a('0x15')](function(){_0x46d399();})[_0xb21a('0x1d')](function(_0x44d220){_0x46d399(_0x44d220);});},'afterUpdate':function(_0x55769a,_0x39ee95,_0x3bf7f6){return _0x2ae463['VoiceExtension'][_0xb21a('0x1e')]({'where':{'ChanSpyId':_0x55769a['id']}})['then'](function(){return getChanSpyPromise(_0x2ae463,_0x55769a);})[_0xb21a('0x15')](function(_0xc85733){if(_0xc85733&&_0xc85733[_0xb21a('0x1a')]){return _0x2ae463[_0xb21a('0x1b')][_0xb21a('0x1c')](_0xc85733);}})[_0xb21a('0x15')](function(){_0x3bf7f6();})[_0xb21a('0x1d')](function(_0x103f6c){_0x3bf7f6(_0x103f6c);});},'afterDestroy':function(_0x5af118,_0x4e649f,_0x597e34){return _0x2ae463['VoiceExtension'][_0xb21a('0x1e')]({'where':{'ChanSpyId':_0x5af118['id']}})[_0xb21a('0x15')](function(){_0x597e34();})[_0xb21a('0x1d')](function(_0x54ac3d){_0x597e34(_0x54ac3d);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 8510908..565c00f 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 _0x6953=['catch','lodash','util','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','request\x20sent','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceChanSpy,\x20%s,\x20%s','message','result'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x6953,0x91));var _0x3695=function(_0x41010e,_0x25e9c5){_0x41010e=_0x41010e-0x0;var _0x59e342=_0x6953[_0x41010e];return _0x59e342;};'use strict';var _=require(_0x3695('0x0'));var util=require(_0x3695('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3695('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x3695('0x3'));var logger=require(_0x3695('0x4'))(_0x3695('0x5'));var config=require('../../config/environment');var jayson=require(_0x3695('0x6'));var client=jayson['client'][_0x3695('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x14eb32,_0x912099,_0x1a4e75){return new BPromise(function(_0x301e46,_0x4e337b){return client[_0x3695('0x8')](_0x14eb32,_0x1a4e75)['then'](function(_0x1fcd43){logger['info']('VoiceChanSpy,\x20%s,\x20%s',_0x912099,_0x3695('0x9'));logger['debug'](_0x3695('0xa'),_0x912099,_0x3695('0x9'),JSON[_0x3695('0xb')](_0x1fcd43));if(_0x1fcd43[_0x3695('0xc')]){if(_0x1fcd43[_0x3695('0xc')][_0x3695('0xd')]===0x1f4){logger['error'](_0x3695('0xe'),_0x912099,_0x1fcd43[_0x3695('0xc')][_0x3695('0xf')]);return _0x4e337b(_0x1fcd43[_0x3695('0xc')][_0x3695('0xf')]);}logger[_0x3695('0xc')](_0x3695('0xe'),_0x912099,_0x1fcd43[_0x3695('0xc')][_0x3695('0xf')]);return _0x301e46(_0x1fcd43[_0x3695('0xc')][_0x3695('0xf')]);}else{logger['info'](_0x3695('0xe'),_0x912099,_0x3695('0x9'));_0x301e46(_0x1fcd43[_0x3695('0x10')][_0x3695('0xf')]);}})[_0x3695('0x11')](function(_0x1973ee){logger[_0x3695('0xc')]('VoiceChanSpy,\x20%s,\x20%s',_0x912099,_0x1973ee);_0x4e337b(_0x1973ee);});});} \ No newline at end of file +var _0xcea2=['VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','request','info'];(function(_0x21002c,_0x2b96fa){var _0x3b8d89=function(_0x54eeef){while(--_0x54eeef){_0x21002c['push'](_0x21002c['shift']());}};_0x3b8d89(++_0x2b96fa);}(_0xcea2,0x15a));var _0x2cea=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0xcea2[_0x4a53d];return _0x27410e;};'use strict';var _=require(_0x2cea('0x0'));var util=require('util');var moment=require(_0x2cea('0x1'));var BPromise=require('bluebird');var rs=require(_0x2cea('0x2'));var fs=require('fs');var Redis=require(_0x2cea('0x3'));var db=require(_0x2cea('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2cea('0x5'))(_0x2cea('0x6'));var config=require(_0x2cea('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x2cea('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2d69ff,_0xc04963,_0x805a1b){return new BPromise(function(_0x160cca,_0x11c5c0){return client[_0x2cea('0x9')](_0x2d69ff,_0x805a1b)['then'](function(_0x1f4d90){logger[_0x2cea('0xa')](_0x2cea('0xb'),_0xc04963,_0x2cea('0xc'));logger[_0x2cea('0xd')](_0x2cea('0xe'),_0xc04963,_0x2cea('0xc'),JSON[_0x2cea('0xf')](_0x1f4d90));if(_0x1f4d90['error']){if(_0x1f4d90['error'][_0x2cea('0x10')]===0x1f4){logger[_0x2cea('0x11')]('VoiceChanSpy,\x20%s,\x20%s',_0xc04963,_0x1f4d90['error'][_0x2cea('0x12')]);return _0x11c5c0(_0x1f4d90['error'][_0x2cea('0x12')]);}logger[_0x2cea('0x11')](_0x2cea('0xb'),_0xc04963,_0x1f4d90['error']['message']);return _0x160cca(_0x1f4d90['error'][_0x2cea('0x12')]);}else{logger['info'](_0x2cea('0xb'),_0xc04963,_0x2cea('0xc'));_0x160cca(_0x1f4d90[_0x2cea('0x13')][_0x2cea('0x12')]);}})[_0x2cea('0x14')](function(_0x1bbfdb){logger[_0x2cea('0x11')](_0x2cea('0xb'),_0xc04963,_0x1bbfdb);_0x11c5c0(_0x1bbfdb);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index b2e74f8..f745b74 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 _0x854d=['put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceContext.controller','get','isAuthenticated','show','create'];(function(_0x1e7b16,_0x4607a1){var _0x37fadc=function(_0x1fc9ce){while(--_0x1fc9ce){_0x1e7b16['push'](_0x1e7b16['shift']());}};_0x37fadc(++_0x4607a1);}(_0x854d,0x182));var _0xd854=function(_0x237e00,_0x53e9ab){_0x237e00=_0x237e00-0x0;var _0x5391ed=_0x854d[_0x237e00];return _0x5391ed;};'use strict';var multer=require(_0xd854('0x0'));var util=require(_0xd854('0x1'));var path=require(_0xd854('0x2'));var timeout=require(_0xd854('0x3'));var express=require(_0xd854('0x4'));var router=express[_0xd854('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xd854('0x6'));var interaction=require(_0xd854('0x7'));var config=require(_0xd854('0x8'));var controller=require(_0xd854('0x9'));router[_0xd854('0xa')]('/',auth[_0xd854('0xb')](),controller['index']);router[_0xd854('0xa')]('/:id',auth[_0xd854('0xb')](),controller[_0xd854('0xc')]);router['post']('/',auth[_0xd854('0xb')](),controller[_0xd854('0xd')]);router[_0xd854('0xe')](_0xd854('0xf'),auth[_0xd854('0xb')](),controller[_0xd854('0x10')]);router[_0xd854('0x11')](_0xd854('0xf'),auth[_0xd854('0xb')](),controller[_0xd854('0x12')]);module[_0xd854('0x13')]=router; \ No newline at end of file +var _0x3b8c=['../../components/interaction/service','../../config/environment','./voiceContext.controller','get','isAuthenticated','show','post','create','put','/:id','update','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x25d5bd,_0x389f37){var _0x1ec0f2=function(_0x8e32bf){while(--_0x8e32bf){_0x25d5bd['push'](_0x25d5bd['shift']());}};_0x1ec0f2(++_0x389f37);}(_0x3b8c,0x1b1));var _0xc3b8=function(_0x46167c,_0x4b8526){_0x46167c=_0x46167c-0x0;var _0x570e76=_0x3b8c[_0x46167c];return _0x570e76;};'use strict';var multer=require(_0xc3b8('0x0'));var util=require('util');var path=require(_0xc3b8('0x1'));var timeout=require(_0xc3b8('0x2'));var express=require(_0xc3b8('0x3'));var router=express[_0xc3b8('0x4')]();var fs_extra=require(_0xc3b8('0x5'));var auth=require(_0xc3b8('0x6'));var interaction=require(_0xc3b8('0x7'));var config=require(_0xc3b8('0x8'));var controller=require(_0xc3b8('0x9'));router[_0xc3b8('0xa')]('/',auth[_0xc3b8('0xb')](),controller['index']);router[_0xc3b8('0xa')]('/:id',auth[_0xc3b8('0xb')](),controller[_0xc3b8('0xc')]);router[_0xc3b8('0xd')]('/',auth[_0xc3b8('0xb')](),controller[_0xc3b8('0xe')]);router[_0xc3b8('0xf')](_0xc3b8('0x10'),auth[_0xc3b8('0xb')](),controller[_0xc3b8('0x11')]);router[_0xc3b8('0x12')](_0xc3b8('0x10'),auth[_0xc3b8('0xb')](),controller[_0xc3b8('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index 6523cc5..03efeca 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 _0xd271=['sequelize','STRING','BOOLEAN'];(function(_0x12655d,_0x2bb430){var _0x4ea8fc=function(_0x2ea579){while(--_0x2ea579){_0x12655d['push'](_0x12655d['shift']());}};_0x4ea8fc(++_0x2bb430);}(_0xd271,0x1aa));var _0x1d27=function(_0x43f3e0,_0x351819){_0x43f3e0=_0x43f3e0-0x0;var _0x4cb544=_0xd271[_0x43f3e0];return _0x4cb544;};'use strict';var Sequelize=require(_0x1d27('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name'},'description':{'type':Sequelize[_0x1d27('0x1')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x1d27('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x71f9=['sequelize','exports','STRING','BOOLEAN'];(function(_0x3a6de7,_0x5ab47b){var _0x2df437=function(_0x176f5f){while(--_0x176f5f){_0x3a6de7['push'](_0x3a6de7['shift']());}};_0x2df437(++_0x5ab47b);}(_0x71f9,0x1ec));var _0x971f=function(_0x3376a7,_0x56bb16){_0x3376a7=_0x3376a7-0x0;var _0x50ae0e=_0x71f9[_0x3376a7];return _0x50ae0e;};'use strict';var Sequelize=require(_0x971f('0x0'));module[_0x971f('0x1')]={'name':{'type':Sequelize[_0x971f('0x2')],'unique':'name'},'description':{'type':Sequelize[_0x971f('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x971f('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.controller.js b/server/api/voiceContext/voiceContext.controller.js index c3810ff..12750db 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 _0x52a9=['get','role','find','userProfileId','autoAssociation','UserProfileResource','update','chan_sip.so','server/files/templates/context.ejs','utf8','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','jayson/promise','request','then','info','VoiceContext,\x20%s,\x20%s','debug','VoiceContext,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','save','destroy','Contexts','stack','name','index','VoiceContext','rawAttributes','key','model','map','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','params','create','readFileSync','join','root','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','user'];(function(_0x290470,_0x496bf5){var _0x18d68c=function(_0x31a7d2){while(--_0x31a7d2){_0x290470['push'](_0x290470['shift']());}};_0x18d68c(++_0x496bf5);}(_0x52a9,0x139));var _0x952a=function(_0x342700,_0x569f75){_0x342700=_0x342700-0x0;var _0x53406f=_0x52a9[_0x342700];return _0x53406f;};'use strict';var emlformat=require(_0x952a('0x0'));var rimraf=require(_0x952a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x952a('0x2'));var rp=require(_0x952a('0x3'));var moment=require('moment');var BPromise=require(_0x952a('0x4'));var Mustache=require(_0x952a('0x5'));var util=require(_0x952a('0x6'));var path=require(_0x952a('0x7'));var sox=require(_0x952a('0x8'));var csv=require(_0x952a('0x9'));var ejs=require(_0x952a('0xa'));var fs=require('fs');var fs_extra=require(_0x952a('0xb'));var _=require(_0x952a('0xc'));var squel=require(_0x952a('0xd'));var crypto=require(_0x952a('0xe'));var jsforce=require(_0x952a('0xf'));var deskjs=require(_0x952a('0x10'));var toCsv=require(_0x952a('0x9'));var querystring=require(_0x952a('0x11'));var Papa=require(_0x952a('0x12'));var Redis=require(_0x952a('0x13'));var authService=require(_0x952a('0x14'));var qs=require(_0x952a('0x15'));var as=require(_0x952a('0x16'));var hardwareService=require(_0x952a('0x17'));var logger=require(_0x952a('0x18'))(_0x952a('0x19'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x952a('0x1a'))['db'];var jayson=require(_0x952a('0x1b'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5ababb,_0x15e314,_0x523c0a,_0x519e50){return new BPromise(function(_0x103829,_0x55b770){var _0x58ec56=_0x519e50||client;return _0x58ec56[_0x952a('0x1c')](_0x5ababb,_0x523c0a)[_0x952a('0x1d')](function(_0x5edf9c){logger[_0x952a('0x1e')](_0x952a('0x1f'),_0x15e314,'request\x20sent');logger[_0x952a('0x20')](_0x952a('0x21'),_0x15e314,_0x952a('0x22'),JSON[_0x952a('0x23')](_0x5edf9c));if(_0x5edf9c[_0x952a('0x24')]){if(_0x5edf9c[_0x952a('0x24')]['code']===0x1f4){logger['error'](_0x952a('0x1f'),_0x15e314,_0x5edf9c[_0x952a('0x24')][_0x952a('0x25')]);return _0x55b770(_0x5edf9c['error'][_0x952a('0x25')]);}logger['error'](_0x952a('0x1f'),_0x15e314,_0x5edf9c[_0x952a('0x24')][_0x952a('0x25')]);return _0x103829(_0x5edf9c[_0x952a('0x24')]['message']);}else{logger['info']('VoiceContext,\x20%s,\x20%s',_0x15e314,'request\x20sent');_0x103829(_0x5edf9c['result'][_0x952a('0x25')]);}})[_0x952a('0x26')](function(_0x1e9323){logger['error'](_0x952a('0x1f'),_0x15e314,_0x1e9323);_0x55b770(_0x1e9323);});});}function respondWithStatusCode(_0x23eafc,_0x1b6afd){_0x1b6afd=_0x1b6afd||0xcc;return function(_0x35b31d){if(_0x35b31d){return _0x23eafc[_0x952a('0x27')](_0x1b6afd);}return _0x23eafc[_0x952a('0x28')](_0x1b6afd)[_0x952a('0x29')]();};}function respondWithResult(_0x540a20,_0x1f6cc3){_0x1f6cc3=_0x1f6cc3||0xc8;return function(_0x5c4d17){if(_0x5c4d17){return _0x540a20['status'](_0x1f6cc3)[_0x952a('0x2a')](_0x5c4d17);}};}function respondWithFilteredResult(_0x44e0db,_0x42a4d2){return function(_0x956b93){if(_0x956b93){var _0x1182d5=typeof _0x42a4d2['offset']===_0x952a('0x2b')&&typeof _0x42a4d2[_0x952a('0x2c')]===_0x952a('0x2b');var _0x3e786=_0x956b93[_0x952a('0x2d')];var _0x4f353d=_0x1182d5?0x0:_0x42a4d2[_0x952a('0x2e')];var _0x2b2527=_0x1182d5?_0x956b93[_0x952a('0x2d')]:_0x42a4d2[_0x952a('0x2e')]+_0x42a4d2[_0x952a('0x2c')];var _0x586a10;if(_0x2b2527>=_0x3e786){_0x2b2527=_0x3e786;_0x586a10=0xc8;}else{_0x586a10=0xce;}_0x44e0db[_0x952a('0x28')](_0x586a10);return _0x44e0db['set'](_0x952a('0x2f'),_0x4f353d+'-'+_0x2b2527+'/'+_0x3e786)[_0x952a('0x2a')](_0x956b93);}return null;};}function patchUpdates(_0x4d9430){return function(_0x195b3a){try{jsonpatch[_0x952a('0x30')](_0x195b3a,_0x4d9430,!![]);}catch(_0x4c56ef){return BPromise['reject'](_0x4c56ef);}return _0x195b3a[_0x952a('0x31')]();};}function saveUpdates(_0x14b11a,_0x26f7d9){return function(_0x17635d){if(_0x17635d){return _0x17635d['update'](_0x14b11a)['then'](function(_0x5e88de){return _0x5e88de;});}return null;};}function removeEntity(_0x1eddd5,_0x369241){return function(_0x1df0ba){if(_0x1df0ba){return _0x1df0ba[_0x952a('0x32')]()[_0x952a('0x1d')](function(){var _0x127535=_0x1df0ba['get']({'plain':!![]});var _0x3449c9=_0x952a('0x33');return db['UserProfileResource'][_0x952a('0x32')]({'where':{'type':_0x3449c9,'resourceId':_0x127535['id']}})[_0x952a('0x1d')](function(){return _0x1df0ba;});})[_0x952a('0x1d')](function(){_0x1eddd5[_0x952a('0x28')](0xcc)[_0x952a('0x29')]();});}};}function handleEntityNotFound(_0x599322,_0x76e838){return function(_0xbfef9a){if(!_0xbfef9a){_0x599322[_0x952a('0x27')](0x194);}return _0xbfef9a;};}function handleError(_0x1e912c,_0x47cc5f){_0x47cc5f=_0x47cc5f||0x1f4;return function(_0x22fd53){logger[_0x952a('0x24')](_0x22fd53[_0x952a('0x34')]);if(_0x22fd53[_0x952a('0x35')]){delete _0x22fd53['name'];}_0x1e912c['status'](_0x47cc5f)['send'](_0x22fd53);};}exports[_0x952a('0x36')]=function(_0x1da6cf,_0x32f0b0){var _0x3fa87e={},_0x5a6cfc={},_0x92413a={'count':0x0,'rows':[]};var _0x390fd6=_['map'](db[_0x952a('0x37')][_0x952a('0x38')],function(_0x33dde3){return{'name':_0x33dde3['fieldName'],'type':_0x33dde3['type'][_0x952a('0x39')]};});_0x5a6cfc[_0x952a('0x3a')]=_[_0x952a('0x3b')](_0x390fd6,_0x952a('0x35'));_0x5a6cfc[_0x952a('0x3c')]=_[_0x952a('0x3d')](_0x1da6cf[_0x952a('0x3c')]);_0x5a6cfc['filters']=_[_0x952a('0x3e')](_0x5a6cfc[_0x952a('0x3a')],_0x5a6cfc[_0x952a('0x3c')]);_0x3fa87e['attributes']=_[_0x952a('0x3e')](_0x5a6cfc[_0x952a('0x3a')],qs[_0x952a('0x3f')](_0x1da6cf[_0x952a('0x3c')][_0x952a('0x3f')]));_0x3fa87e[_0x952a('0x40')]=_0x3fa87e[_0x952a('0x40')][_0x952a('0x41')]?_0x3fa87e['attributes']:_0x5a6cfc[_0x952a('0x3a')];if(!_0x1da6cf[_0x952a('0x3c')][_0x952a('0x42')](_0x952a('0x43'))){_0x3fa87e[_0x952a('0x2c')]=qs[_0x952a('0x2c')](_0x1da6cf[_0x952a('0x3c')]['limit']);_0x3fa87e[_0x952a('0x2e')]=qs[_0x952a('0x2e')](_0x1da6cf[_0x952a('0x3c')][_0x952a('0x2e')]);}_0x3fa87e[_0x952a('0x44')]=qs['sort'](_0x1da6cf['query'][_0x952a('0x45')]);_0x3fa87e[_0x952a('0x46')]=qs['filters'](_[_0x952a('0x47')](_0x1da6cf[_0x952a('0x3c')],_0x5a6cfc['filters']),_0x390fd6);if(_0x1da6cf[_0x952a('0x3c')][_0x952a('0x48')]){_0x3fa87e[_0x952a('0x46')]=_[_0x952a('0x49')](_0x3fa87e[_0x952a('0x46')],{'$or':_[_0x952a('0x3b')](_0x390fd6,function(_0x287398){if(_0x287398[_0x952a('0x4a')]!==_0x952a('0x4b')){var _0x77e0a6={};_0x77e0a6[_0x287398[_0x952a('0x35')]]={'$like':'%'+_0x1da6cf[_0x952a('0x3c')][_0x952a('0x48')]+'%'};return _0x77e0a6;}})});}_0x3fa87e=_['merge']({},_0x3fa87e,_0x1da6cf[_0x952a('0x4c')]);var _0x3d14e8={'where':_0x3fa87e[_0x952a('0x46')]};return db[_0x952a('0x37')][_0x952a('0x2d')](_0x3d14e8)[_0x952a('0x1d')](function(_0x2b2d30){_0x92413a[_0x952a('0x2d')]=_0x2b2d30;if(_0x1da6cf[_0x952a('0x3c')][_0x952a('0x4d')]){_0x3fa87e[_0x952a('0x4e')]=[{'all':!![]}];}return db['VoiceContext'][_0x952a('0x4f')](_0x3fa87e);})['then'](function(_0x4e8a8e){_0x92413a[_0x952a('0x50')]=_0x4e8a8e;return _0x92413a;})[_0x952a('0x1d')](respondWithFilteredResult(_0x32f0b0,_0x3fa87e))['catch'](handleError(_0x32f0b0,null));};exports['show']=function(_0x4504e6,_0x8f8b9e){var _0xdb4e9e={'raw':![],'where':{'id':_0x4504e6[_0x952a('0x51')]['id']}},_0x5dbd5a={};_0x5dbd5a[_0x952a('0x3a')]=_[_0x952a('0x3d')](db['VoiceContext'][_0x952a('0x38')]);_0x5dbd5a[_0x952a('0x3c')]=_[_0x952a('0x3d')](_0x4504e6[_0x952a('0x3c')]);_0x5dbd5a['filters']=_[_0x952a('0x3e')](_0x5dbd5a['model'],_0x5dbd5a[_0x952a('0x3c')]);_0xdb4e9e['attributes']=_['intersection'](_0x5dbd5a[_0x952a('0x3a')],qs[_0x952a('0x3f')](_0x4504e6[_0x952a('0x3c')][_0x952a('0x3f')]));_0xdb4e9e[_0x952a('0x40')]=_0xdb4e9e[_0x952a('0x40')][_0x952a('0x41')]?_0xdb4e9e['attributes']:_0x5dbd5a[_0x952a('0x3a')];if(_0x4504e6[_0x952a('0x3c')][_0x952a('0x4d')]){_0xdb4e9e[_0x952a('0x4e')]=[{'all':!![]}];}_0xdb4e9e=_[_0x952a('0x49')]({},_0xdb4e9e,_0x4504e6[_0x952a('0x4c')]);return db[_0x952a('0x37')]['find'](_0xdb4e9e)['then'](handleEntityNotFound(_0x8f8b9e,null))['then'](respondWithResult(_0x8f8b9e,null))[_0x952a('0x26')](handleError(_0x8f8b9e,null));};exports[_0x952a('0x52')]=function(_0x4f1834,_0x5ba6e0,_0x636b8d){var _0x22277b;return db[_0x952a('0x37')][_0x952a('0x52')](_0x4f1834['body'],{'raw':!![]})[_0x952a('0x1d')](function(_0x5ce2ca){_0x22277b=_0x5ce2ca;return db[_0x952a('0x37')][_0x952a('0x4f')]({'raw':!![]});})['then'](function(_0x2f5004){var _0x3f176d=fs[_0x952a('0x53')](path[_0x952a('0x54')](config[_0x952a('0x55')],'server/files/templates/context.ejs'),'utf8');var _0x1b0ede=ejs[_0x952a('0x56')](_0x3f176d,{'contexts':_0x2f5004||[]});fs[_0x952a('0x57')](_0x952a('0x58'),_0x1b0ede);})['then'](function(){return respondWithRpcPromise(_0x952a('0x59'),'create',{'module':'chan_sip.so'});})[_0x952a('0x1d')](function(){var _0x691bde=_0x4f1834[_0x952a('0x5a')][_0x952a('0x5b')]({'plain':!![]});if(!_0x691bde)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x691bde[_0x952a('0x5c')]==='user'){var _0x4600d3=_0x22277b[_0x952a('0x5b')]({'plain':!![]});return db['UserProfileSection'][_0x952a('0x5d')]({'where':{'name':_0x952a('0x33'),'userProfileId':_0x691bde[_0x952a('0x5e')]},'raw':!![]})[_0x952a('0x1d')](function(_0x1e5065){if(_0x1e5065&&_0x1e5065[_0x952a('0x5f')]===0x0){return db[_0x952a('0x60')]['create']({'name':_0x4600d3['name'],'resourceId':_0x4600d3['id'],'type':_0x1e5065[_0x952a('0x35')],'sectionId':_0x1e5065['id']},{})[_0x952a('0x1d')](function(){return _0x22277b;});}else{return _0x22277b;}})[_0x952a('0x26')](function(_0x2d1c60){logger[_0x952a('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2d1c60);throw _0x2d1c60;});}return _0x22277b;})[_0x952a('0x1d')](respondWithResult(_0x5ba6e0,0xc9))[_0x952a('0x26')](handleError(_0x5ba6e0,null));};exports[_0x952a('0x61')]=function(_0x40d022,_0x441733,_0x5349ca){var _0x37fdcc;return db[_0x952a('0x37')][_0x952a('0x5d')]({'where':{'id':_0x40d022[_0x952a('0x51')]['id']}})['then'](handleEntityNotFound(_0x441733,null))[_0x952a('0x1d')](saveUpdates(_0x40d022['body'],null))['then'](function(_0xdee91a){if(_0xdee91a){_0x37fdcc=_0xdee91a;return db[_0x952a('0x37')]['findAll']({'raw':!![]});}})[_0x952a('0x1d')](function(_0x1ef26f){var _0x27fdcc=fs['readFileSync'](path[_0x952a('0x54')](config['root'],'server/files/templates/context.ejs'),'utf8');var _0x3e69e6=ejs[_0x952a('0x56')](_0x27fdcc,{'contexts':_0x1ef26f||[]});fs[_0x952a('0x57')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x3e69e6);})[_0x952a('0x1d')](function(){return respondWithRpcPromise(_0x952a('0x59'),'update',{'module':_0x952a('0x62')});})[_0x952a('0x1d')](function(){return _0x37fdcc;})[_0x952a('0x1d')](respondWithResult(_0x441733,null))[_0x952a('0x26')](handleError(_0x441733,null));};exports['destroy']=function(_0x585a25,_0x36b0a0,_0x5a79db){var _0x267226;return db[_0x952a('0x37')][_0x952a('0x5d')]({'where':{'id':_0x585a25[_0x952a('0x51')]['id']}})[_0x952a('0x1d')](handleEntityNotFound(_0x36b0a0,null))[_0x952a('0x1d')](removeEntity(_0x36b0a0,null))[_0x952a('0x1d')](function(){return db[_0x952a('0x37')][_0x952a('0x4f')]({'raw':!![]});})[_0x952a('0x1d')](function(_0x544159){var _0x55f0e0=fs[_0x952a('0x53')](path['join'](config['root'],_0x952a('0x63')),_0x952a('0x64'));var _0x587026=ejs[_0x952a('0x56')](_0x55f0e0,{'contexts':_0x544159});fs[_0x952a('0x57')](_0x952a('0x58'),_0x587026);return respondWithRpcPromise(_0x952a('0x59'),_0x952a('0x32'),{'module':_0x952a('0x62')});})[_0x952a('0x26')](handleError(_0x36b0a0,null));}; \ No newline at end of file +var _0xaf8f=['type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','count','includeAll','include','findAll','rows','catch','params','options','find','create','body','join','server/files/templates/context.ejs','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','update','readFileSync','utf8','render','root','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','message','VoiceContext,\x20%s,\x20%s','result','status','json','offset','undefined','limit','set','Content-Range','apply','reject','save','destroy','get','Contexts','UserProfileResource','end','sendStatus','name','send','index','map','VoiceContext','rawAttributes','fieldName'];(function(_0x30cc1a,_0x162bbc){var _0xb3f18f=function(_0x26bdfe){while(--_0x26bdfe){_0x30cc1a['push'](_0x30cc1a['shift']());}};_0xb3f18f(++_0x162bbc);}(_0xaf8f,0x102));var _0xfaf8=function(_0x25a8e2,_0x186f11){_0x25a8e2=_0x25a8e2-0x0;var _0x1d0949=_0xaf8f[_0x25a8e2];return _0x1d0949;};'use strict';var emlformat=require(_0xfaf8('0x0'));var rimraf=require(_0xfaf8('0x1'));var zipdir=require(_0xfaf8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xfaf8('0x3'));var moment=require('moment');var BPromise=require(_0xfaf8('0x4'));var Mustache=require(_0xfaf8('0x5'));var util=require(_0xfaf8('0x6'));var path=require(_0xfaf8('0x7'));var sox=require(_0xfaf8('0x8'));var csv=require(_0xfaf8('0x9'));var ejs=require(_0xfaf8('0xa'));var fs=require('fs');var fs_extra=require(_0xfaf8('0xb'));var _=require(_0xfaf8('0xc'));var squel=require(_0xfaf8('0xd'));var crypto=require(_0xfaf8('0xe'));var jsforce=require(_0xfaf8('0xf'));var deskjs=require(_0xfaf8('0x10'));var toCsv=require(_0xfaf8('0x9'));var querystring=require(_0xfaf8('0x11'));var Papa=require(_0xfaf8('0x12'));var Redis=require(_0xfaf8('0x13'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xfaf8('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfaf8('0x15'))(_0xfaf8('0x16'));var utils=require(_0xfaf8('0x17'));var config=require(_0xfaf8('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xfaf8('0x19'))['db'];var jayson=require(_0xfaf8('0x1a'));var client=jayson[_0xfaf8('0x1b')][_0xfaf8('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x222514,_0x481fcf,_0x56937b,_0x5a81b3){return new BPromise(function(_0x1ec370,_0x2f6a40){var _0x2e2d68=_0x5a81b3||client;return _0x2e2d68[_0xfaf8('0x1d')](_0x222514,_0x56937b)[_0xfaf8('0x1e')](function(_0x2e159c){logger[_0xfaf8('0x1f')]('VoiceContext,\x20%s,\x20%s',_0x481fcf,_0xfaf8('0x20'));logger[_0xfaf8('0x21')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x481fcf,_0xfaf8('0x20'),JSON[_0xfaf8('0x22')](_0x2e159c));if(_0x2e159c[_0xfaf8('0x23')]){if(_0x2e159c[_0xfaf8('0x23')][_0xfaf8('0x24')]===0x1f4){logger['error']('VoiceContext,\x20%s,\x20%s',_0x481fcf,_0x2e159c[_0xfaf8('0x23')][_0xfaf8('0x25')]);return _0x2f6a40(_0x2e159c[_0xfaf8('0x23')][_0xfaf8('0x25')]);}logger['error']('VoiceContext,\x20%s,\x20%s',_0x481fcf,_0x2e159c[_0xfaf8('0x23')][_0xfaf8('0x25')]);return _0x1ec370(_0x2e159c[_0xfaf8('0x23')][_0xfaf8('0x25')]);}else{logger[_0xfaf8('0x1f')](_0xfaf8('0x26'),_0x481fcf,'request\x20sent');_0x1ec370(_0x2e159c[_0xfaf8('0x27')][_0xfaf8('0x25')]);}})['catch'](function(_0xb050b1){logger[_0xfaf8('0x23')]('VoiceContext,\x20%s,\x20%s',_0x481fcf,_0xb050b1);_0x2f6a40(_0xb050b1);});});}function respondWithStatusCode(_0x58842a,_0x4174cb){_0x4174cb=_0x4174cb||0xcc;return function(_0x6484fa){if(_0x6484fa){return _0x58842a['sendStatus'](_0x4174cb);}return _0x58842a[_0xfaf8('0x28')](_0x4174cb)['end']();};}function respondWithResult(_0x4a405a,_0x1ba81f){_0x1ba81f=_0x1ba81f||0xc8;return function(_0x247407){if(_0x247407){return _0x4a405a['status'](_0x1ba81f)[_0xfaf8('0x29')](_0x247407);}};}function respondWithFilteredResult(_0x51d28e,_0x19e58e){return function(_0x3e46f8){if(_0x3e46f8){var _0xdecf39=typeof _0x19e58e[_0xfaf8('0x2a')]===_0xfaf8('0x2b')&&typeof _0x19e58e[_0xfaf8('0x2c')]==='undefined';var _0x397e48=_0x3e46f8['count'];var _0x84e256=_0xdecf39?0x0:_0x19e58e[_0xfaf8('0x2a')];var _0x324573=_0xdecf39?_0x3e46f8['count']:_0x19e58e[_0xfaf8('0x2a')]+_0x19e58e['limit'];var _0x2263c5;if(_0x324573>=_0x397e48){_0x324573=_0x397e48;_0x2263c5=0xc8;}else{_0x2263c5=0xce;}_0x51d28e[_0xfaf8('0x28')](_0x2263c5);return _0x51d28e[_0xfaf8('0x2d')](_0xfaf8('0x2e'),_0x84e256+'-'+_0x324573+'/'+_0x397e48)[_0xfaf8('0x29')](_0x3e46f8);}return null;};}function patchUpdates(_0x474a68){return function(_0x452a1d){try{jsonpatch[_0xfaf8('0x2f')](_0x452a1d,_0x474a68,!![]);}catch(_0x4b5b0d){return BPromise[_0xfaf8('0x30')](_0x4b5b0d);}return _0x452a1d[_0xfaf8('0x31')]();};}function saveUpdates(_0x47076c,_0x2836c2){return function(_0x31d452){if(_0x31d452){return _0x31d452['update'](_0x47076c)[_0xfaf8('0x1e')](function(_0x3f9607){return _0x3f9607;});}return null;};}function removeEntity(_0x4dec29,_0x7f359c){return function(_0x5af295){if(_0x5af295){return _0x5af295[_0xfaf8('0x32')]()[_0xfaf8('0x1e')](function(){var _0x442880=_0x5af295[_0xfaf8('0x33')]({'plain':!![]});var _0x5e7cce=_0xfaf8('0x34');return db[_0xfaf8('0x35')][_0xfaf8('0x32')]({'where':{'type':_0x5e7cce,'resourceId':_0x442880['id']}})[_0xfaf8('0x1e')](function(){return _0x5af295;});})['then'](function(){_0x4dec29[_0xfaf8('0x28')](0xcc)[_0xfaf8('0x36')]();});}};}function handleEntityNotFound(_0x5e161b,_0xfd5761){return function(_0x2a8388){if(!_0x2a8388){_0x5e161b[_0xfaf8('0x37')](0x194);}return _0x2a8388;};}function handleError(_0x53ae20,_0x376f94){_0x376f94=_0x376f94||0x1f4;return function(_0x238c1e){logger[_0xfaf8('0x23')](_0x238c1e['stack']);if(_0x238c1e['name']){delete _0x238c1e[_0xfaf8('0x38')];}_0x53ae20[_0xfaf8('0x28')](_0x376f94)[_0xfaf8('0x39')](_0x238c1e);};}exports[_0xfaf8('0x3a')]=function(_0x21c7ef,_0x21d99f){var _0x53bcc1={},_0x273ed5={},_0x3160cf={'count':0x0,'rows':[]};var _0x3971b5=_[_0xfaf8('0x3b')](db[_0xfaf8('0x3c')][_0xfaf8('0x3d')],function(_0x127dc6){return{'name':_0x127dc6[_0xfaf8('0x3e')],'type':_0x127dc6[_0xfaf8('0x3f')][_0xfaf8('0x40')]};});_0x273ed5[_0xfaf8('0x41')]=_[_0xfaf8('0x3b')](_0x3971b5,_0xfaf8('0x38'));_0x273ed5['query']=_[_0xfaf8('0x42')](_0x21c7ef[_0xfaf8('0x43')]);_0x273ed5['filters']=_[_0xfaf8('0x44')](_0x273ed5[_0xfaf8('0x41')],_0x273ed5[_0xfaf8('0x43')]);_0x53bcc1[_0xfaf8('0x45')]=_[_0xfaf8('0x44')](_0x273ed5['model'],qs[_0xfaf8('0x46')](_0x21c7ef[_0xfaf8('0x43')][_0xfaf8('0x46')]));_0x53bcc1[_0xfaf8('0x45')]=_0x53bcc1[_0xfaf8('0x45')][_0xfaf8('0x47')]?_0x53bcc1[_0xfaf8('0x45')]:_0x273ed5[_0xfaf8('0x41')];if(!_0x21c7ef[_0xfaf8('0x43')][_0xfaf8('0x48')](_0xfaf8('0x49'))){_0x53bcc1[_0xfaf8('0x2c')]=qs[_0xfaf8('0x2c')](_0x21c7ef[_0xfaf8('0x43')][_0xfaf8('0x2c')]);_0x53bcc1['offset']=qs[_0xfaf8('0x2a')](_0x21c7ef[_0xfaf8('0x43')][_0xfaf8('0x2a')]);}_0x53bcc1['order']=qs[_0xfaf8('0x4a')](_0x21c7ef[_0xfaf8('0x43')][_0xfaf8('0x4a')]);_0x53bcc1[_0xfaf8('0x4b')]=qs[_0xfaf8('0x4c')](_[_0xfaf8('0x4d')](_0x21c7ef['query'],_0x273ed5[_0xfaf8('0x4c')]),_0x3971b5);if(_0x21c7ef['query'][_0xfaf8('0x4e')]){_0x53bcc1['where']=_[_0xfaf8('0x4f')](_0x53bcc1[_0xfaf8('0x4b')],{'$or':_['map'](_0x3971b5,function(_0x117251){if(_0x117251['type']!==_0xfaf8('0x50')){var _0x181d30={};_0x181d30[_0x117251[_0xfaf8('0x38')]]={'$like':'%'+_0x21c7ef['query'][_0xfaf8('0x4e')]+'%'};return _0x181d30;}})});}_0x53bcc1=_[_0xfaf8('0x4f')]({},_0x53bcc1,_0x21c7ef['options']);var _0xf984d9={'where':_0x53bcc1[_0xfaf8('0x4b')]};return db[_0xfaf8('0x3c')][_0xfaf8('0x51')](_0xf984d9)[_0xfaf8('0x1e')](function(_0xabed59){_0x3160cf['count']=_0xabed59;if(_0x21c7ef[_0xfaf8('0x43')][_0xfaf8('0x52')]){_0x53bcc1[_0xfaf8('0x53')]=[{'all':!![]}];}return db['VoiceContext'][_0xfaf8('0x54')](_0x53bcc1);})[_0xfaf8('0x1e')](function(_0x51c214){_0x3160cf[_0xfaf8('0x55')]=_0x51c214;return _0x3160cf;})[_0xfaf8('0x1e')](respondWithFilteredResult(_0x21d99f,_0x53bcc1))[_0xfaf8('0x56')](handleError(_0x21d99f,null));};exports['show']=function(_0x1b2d78,_0x53b59a){var _0x285a74={'raw':![],'where':{'id':_0x1b2d78[_0xfaf8('0x57')]['id']}},_0x51895d={};_0x51895d[_0xfaf8('0x41')]=_['keys'](db[_0xfaf8('0x3c')][_0xfaf8('0x3d')]);_0x51895d[_0xfaf8('0x43')]=_[_0xfaf8('0x42')](_0x1b2d78['query']);_0x51895d[_0xfaf8('0x4c')]=_[_0xfaf8('0x44')](_0x51895d[_0xfaf8('0x41')],_0x51895d['query']);_0x285a74['attributes']=_[_0xfaf8('0x44')](_0x51895d[_0xfaf8('0x41')],qs['fields'](_0x1b2d78['query'][_0xfaf8('0x46')]));_0x285a74['attributes']=_0x285a74[_0xfaf8('0x45')]['length']?_0x285a74[_0xfaf8('0x45')]:_0x51895d['model'];if(_0x1b2d78[_0xfaf8('0x43')]['includeAll']){_0x285a74[_0xfaf8('0x53')]=[{'all':!![]}];}_0x285a74=_[_0xfaf8('0x4f')]({},_0x285a74,_0x1b2d78[_0xfaf8('0x58')]);return db['VoiceContext'][_0xfaf8('0x59')](_0x285a74)[_0xfaf8('0x1e')](handleEntityNotFound(_0x53b59a,null))[_0xfaf8('0x1e')](respondWithResult(_0x53b59a,null))[_0xfaf8('0x56')](handleError(_0x53b59a,null));};exports['create']=function(_0x53fe50,_0x34b5ae,_0x519ed7){var _0x165fd1;return db[_0xfaf8('0x3c')][_0xfaf8('0x5a')](_0x53fe50[_0xfaf8('0x5b')],{'raw':!![]})[_0xfaf8('0x1e')](function(_0x1e017a){_0x165fd1=_0x1e017a;return db[_0xfaf8('0x3c')][_0xfaf8('0x54')]({'raw':!![]});})[_0xfaf8('0x1e')](function(_0x461915){var _0x35efbc=fs['readFileSync'](path[_0xfaf8('0x5c')](config['root'],_0xfaf8('0x5d')),'utf8');var _0x58c5b4=ejs['render'](_0x35efbc,{'contexts':_0x461915||[]});fs[_0xfaf8('0x5e')](_0xfaf8('0x5f'),_0x58c5b4);})[_0xfaf8('0x1e')](function(){return respondWithRpcPromise(_0xfaf8('0x60'),_0xfaf8('0x5a'),{'module':_0xfaf8('0x61')});})[_0xfaf8('0x1e')](function(){var _0x12476a=_0x53fe50[_0xfaf8('0x62')][_0xfaf8('0x33')]({'plain':!![]});if(!_0x12476a)throw new Error(_0xfaf8('0x63'));if(_0x12476a[_0xfaf8('0x64')]==='user'){var _0x1bec2a=_0x165fd1['get']({'plain':!![]});return db[_0xfaf8('0x65')][_0xfaf8('0x59')]({'where':{'name':'Contexts','userProfileId':_0x12476a['userProfileId']},'raw':!![]})[_0xfaf8('0x1e')](function(_0x3c5695){if(_0x3c5695&&_0x3c5695['autoAssociation']===0x0){return db['UserProfileResource'][_0xfaf8('0x5a')]({'name':_0x1bec2a[_0xfaf8('0x38')],'resourceId':_0x1bec2a['id'],'type':_0x3c5695[_0xfaf8('0x38')],'sectionId':_0x3c5695['id']},{})[_0xfaf8('0x1e')](function(){return _0x165fd1;});}else{return _0x165fd1;}})['catch'](function(_0x458a67){logger[_0xfaf8('0x23')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x458a67);throw _0x458a67;});}return _0x165fd1;})[_0xfaf8('0x1e')](respondWithResult(_0x34b5ae,0xc9))[_0xfaf8('0x56')](handleError(_0x34b5ae,null));};exports[_0xfaf8('0x66')]=function(_0x3532c2,_0x735f87,_0x518398){var _0x6c69dd;return db[_0xfaf8('0x3c')][_0xfaf8('0x59')]({'where':{'id':_0x3532c2[_0xfaf8('0x57')]['id']}})['then'](handleEntityNotFound(_0x735f87,null))[_0xfaf8('0x1e')](saveUpdates(_0x3532c2['body'],null))['then'](function(_0x59500a){if(_0x59500a){_0x6c69dd=_0x59500a;return db['VoiceContext'][_0xfaf8('0x54')]({'raw':!![]});}})[_0xfaf8('0x1e')](function(_0x159254){var _0x3838f4=fs[_0xfaf8('0x67')](path[_0xfaf8('0x5c')](config['root'],_0xfaf8('0x5d')),_0xfaf8('0x68'));var _0x50f706=ejs[_0xfaf8('0x69')](_0x3838f4,{'contexts':_0x159254||[]});fs[_0xfaf8('0x5e')](_0xfaf8('0x5f'),_0x50f706);})[_0xfaf8('0x1e')](function(){return respondWithRpcPromise(_0xfaf8('0x60'),'update',{'module':_0xfaf8('0x61')});})[_0xfaf8('0x1e')](function(){return _0x6c69dd;})[_0xfaf8('0x1e')](respondWithResult(_0x735f87,null))[_0xfaf8('0x56')](handleError(_0x735f87,null));};exports[_0xfaf8('0x32')]=function(_0x5d4b0b,_0x2bdcc5,_0x50f2fd){var _0x48250a;return db[_0xfaf8('0x3c')][_0xfaf8('0x59')]({'where':{'id':_0x5d4b0b[_0xfaf8('0x57')]['id']}})[_0xfaf8('0x1e')](handleEntityNotFound(_0x2bdcc5,null))[_0xfaf8('0x1e')](removeEntity(_0x2bdcc5,null))[_0xfaf8('0x1e')](function(){return db[_0xfaf8('0x3c')][_0xfaf8('0x54')]({'raw':!![]});})[_0xfaf8('0x1e')](function(_0x3658b4){var _0x55fb27=fs[_0xfaf8('0x67')](path['join'](config[_0xfaf8('0x6a')],_0xfaf8('0x5d')),_0xfaf8('0x68'));var _0x4f34a6=ejs[_0xfaf8('0x69')](_0x55fb27,{'contexts':_0x3658b4});fs[_0xfaf8('0x5e')](_0xfaf8('0x5f'),_0x4f34a6);return respondWithRpcPromise(_0xfaf8('0x60'),_0xfaf8('0x32'),{'module':_0xfaf8('0x61')});})[_0xfaf8('0x56')](handleError(_0x2bdcc5,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index 679c952..9075f30 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 _0xcdf6=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceContext.attributes','exports','define','VoiceContext','lodash','util','../../config/logger'];(function(_0x5d5648,_0x50498d){var _0x43337c=function(_0x4b970f){while(--_0x4b970f){_0x5d5648['push'](_0x5d5648['shift']());}};_0x43337c(++_0x50498d);}(_0xcdf6,0xb3));var _0x6cdf=function(_0x7880d7,_0x59eb91){_0x7880d7=_0x7880d7-0x0;var _0x4f05e7=_0xcdf6[_0x7880d7];return _0x4f05e7;};'use strict';var _=require(_0x6cdf('0x0'));var util=require(_0x6cdf('0x1'));var logger=require(_0x6cdf('0x2'))('api');var moment=require(_0x6cdf('0x3'));var BPromise=require(_0x6cdf('0x4'));var rp=require(_0x6cdf('0x5'));var fs=require('fs');var path=require(_0x6cdf('0x6'));var rimraf=require(_0x6cdf('0x7'));var config=require(_0x6cdf('0x8'));var attributes=require(_0x6cdf('0x9'));module[_0x6cdf('0xa')]=function(_0x52176f,_0x3599e7){return _0x52176f[_0x6cdf('0xb')](_0x6cdf('0xc'),attributes,{'tableName':'voice_contexts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x273e=['VoiceContext','voice_contexts','lodash','util','api','request-promise','path','rimraf','../../config/environment','./voiceContext.attributes','exports','define'];(function(_0x516e7d,_0x960af9){var _0x1c5180=function(_0x32c6c6){while(--_0x32c6c6){_0x516e7d['push'](_0x516e7d['shift']());}};_0x1c5180(++_0x960af9);}(_0x273e,0x1b2));var _0xe273=function(_0x76c3a4,_0x3a4de5){_0x76c3a4=_0x76c3a4-0x0;var _0x1fdd19=_0x273e[_0x76c3a4];return _0x1fdd19;};'use strict';var _=require(_0xe273('0x0'));var util=require(_0xe273('0x1'));var logger=require('../../config/logger')(_0xe273('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xe273('0x3'));var fs=require('fs');var path=require(_0xe273('0x4'));var rimraf=require(_0xe273('0x5'));var config=require(_0xe273('0x6'));var attributes=require(_0xe273('0x7'));module[_0xe273('0x8')]=function(_0x470e3f,_0x11b4d0){return _0x470e3f[_0xe273('0x9')](_0xe273('0xa'),attributes,{'tableName':_0xe273('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.rpc.js b/server/api/voiceContext/voiceContext.rpc.js index 2227647..f99da89 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 _0x1794=['jayson/promise','client','http','then','info','request\x20sent','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','VoiceContext,\x20%s,\x20%s','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment'];(function(_0x548503,_0x1aa00c){var _0xf8f05f=function(_0x2014c2){while(--_0x2014c2){_0x548503['push'](_0x548503['shift']());}};_0xf8f05f(++_0x1aa00c);}(_0x1794,0x19d));var _0x4179=function(_0x391900,_0x1a74f6){_0x391900=_0x391900-0x0;var _0x127094=_0x1794[_0x391900];return _0x127094;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4179('0x0'));var BPromise=require(_0x4179('0x1'));var rs=require(_0x4179('0x2'));var fs=require('fs');var Redis=require(_0x4179('0x3'));var db=require(_0x4179('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x4179('0x5'));var config=require(_0x4179('0x6'));var jayson=require(_0x4179('0x7'));var client=jayson[_0x4179('0x8')][_0x4179('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x840dda,_0xcfdd0b,_0x24f3ff){return new BPromise(function(_0x45d2c9,_0x3fdaff){return client['request'](_0x840dda,_0x24f3ff)[_0x4179('0xa')](function(_0x1e52a6){logger[_0x4179('0xb')]('VoiceContext,\x20%s,\x20%s',_0xcfdd0b,_0x4179('0xc'));logger['debug'](_0x4179('0xd'),_0xcfdd0b,'request\x20sent',JSON[_0x4179('0xe')](_0x1e52a6));if(_0x1e52a6['error']){if(_0x1e52a6[_0x4179('0xf')][_0x4179('0x10')]===0x1f4){logger[_0x4179('0xf')]('VoiceContext,\x20%s,\x20%s',_0xcfdd0b,_0x1e52a6[_0x4179('0xf')]['message']);return _0x3fdaff(_0x1e52a6[_0x4179('0xf')][_0x4179('0x11')]);}logger['error'](_0x4179('0x12'),_0xcfdd0b,_0x1e52a6[_0x4179('0xf')]['message']);return _0x45d2c9(_0x1e52a6[_0x4179('0xf')][_0x4179('0x11')]);}else{logger[_0x4179('0xb')](_0x4179('0x12'),_0xcfdd0b,_0x4179('0xc'));_0x45d2c9(_0x1e52a6[_0x4179('0x13')][_0x4179('0x11')]);}})[_0x4179('0x14')](function(_0x2b82d0){logger[_0x4179('0xf')](_0x4179('0x12'),_0xcfdd0b,_0x2b82d0);_0x3fdaff(_0x2b82d0);});});} \ No newline at end of file +var _0xb584=['debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceContext,\x20%s,\x20%s','message','catch','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent'];(function(_0x26462c,_0xd20a35){var _0x509a42=function(_0x1b22c9){while(--_0x1b22c9){_0x26462c['push'](_0x26462c['shift']());}};_0x509a42(++_0xd20a35);}(_0xb584,0x1c1));var _0x4b58=function(_0x28b768,_0x221980){_0x28b768=_0x28b768-0x0;var _0x1d05e5=_0xb584[_0x28b768];return _0x1d05e5;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4b58('0x0'));var BPromise=require('bluebird');var rs=require(_0x4b58('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4b58('0x2'))['db'];var utils=require(_0x4b58('0x3'));var logger=require(_0x4b58('0x4'))(_0x4b58('0x5'));var config=require(_0x4b58('0x6'));var jayson=require(_0x4b58('0x7'));var client=jayson[_0x4b58('0x8')][_0x4b58('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4c3718,_0x5e050a,_0x3a969b){return new BPromise(function(_0xeac028,_0x33941d){return client[_0x4b58('0xa')](_0x4c3718,_0x3a969b)['then'](function(_0x305c60){logger[_0x4b58('0xb')]('VoiceContext,\x20%s,\x20%s',_0x5e050a,_0x4b58('0xc'));logger[_0x4b58('0xd')](_0x4b58('0xe'),_0x5e050a,_0x4b58('0xc'),JSON[_0x4b58('0xf')](_0x305c60));if(_0x305c60['error']){if(_0x305c60[_0x4b58('0x10')][_0x4b58('0x11')]===0x1f4){logger[_0x4b58('0x10')](_0x4b58('0x12'),_0x5e050a,_0x305c60['error'][_0x4b58('0x13')]);return _0x33941d(_0x305c60[_0x4b58('0x10')]['message']);}logger['error'](_0x4b58('0x12'),_0x5e050a,_0x305c60[_0x4b58('0x10')][_0x4b58('0x13')]);return _0xeac028(_0x305c60['error'][_0x4b58('0x13')]);}else{logger[_0x4b58('0xb')](_0x4b58('0x12'),_0x5e050a,'request\x20sent');_0xeac028(_0x305c60['result'][_0x4b58('0x13')]);}})[_0x4b58('0x14')](function(_0x21c61c){logger[_0x4b58('0x10')](_0x4b58('0x12'),_0x5e050a,_0x21c61c);_0x33941d(_0x21c61c);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index d316e02..2a20f9d 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 _0xb145=['util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create','put','update','delete','exports','multer'];(function(_0x487f3a,_0x2cd116){var _0x2c4d7b=function(_0x3e42b4){while(--_0x3e42b4){_0x487f3a['push'](_0x487f3a['shift']());}};_0x2c4d7b(++_0x2cd116);}(_0xb145,0x15f));var _0x5b14=function(_0x18d177,_0x5eef29){_0x18d177=_0x18d177-0x0;var _0x53fb81=_0xb145[_0x18d177];return _0x53fb81;};'use strict';var multer=require(_0x5b14('0x0'));var util=require(_0x5b14('0x1'));var path=require('path');var timeout=require(_0x5b14('0x2'));var express=require(_0x5b14('0x3'));var router=express[_0x5b14('0x4')]();var fs_extra=require(_0x5b14('0x5'));var auth=require(_0x5b14('0x6'));var interaction=require(_0x5b14('0x7'));var config=require(_0x5b14('0x8'));var controller=require(_0x5b14('0x9'));router[_0x5b14('0xa')]('/',auth[_0x5b14('0xb')](),controller[_0x5b14('0xc')]);router[_0x5b14('0xa')](_0x5b14('0xd'),auth[_0x5b14('0xb')](),controller[_0x5b14('0xe')]);router[_0x5b14('0xa')](_0x5b14('0xf'),auth[_0x5b14('0xb')](),controller[_0x5b14('0x10')]);router['post']('/',auth[_0x5b14('0xb')](),controller[_0x5b14('0x11')]);router[_0x5b14('0x12')](_0x5b14('0xf'),auth[_0x5b14('0xb')](),controller[_0x5b14('0x13')]);router[_0x5b14('0x14')](_0x5b14('0xf'),auth[_0x5b14('0xb')](),controller['destroy']);module[_0x5b14('0x15')]=router; \ No newline at end of file +var _0xfc2f=['util','connect-timeout','../../components/auth/service','./voiceDialReport.controller','get','isAuthenticated','index','/describe','describe','/:id','create','put','delete','exports','multer'];(function(_0xdfe86a,_0x3173e3){var _0x425b8d=function(_0x2f36aa){while(--_0x2f36aa){_0xdfe86a['push'](_0xdfe86a['shift']());}};_0x425b8d(++_0x3173e3);}(_0xfc2f,0x1b2));var _0xffc2=function(_0x5942f2,_0x5b248b){_0x5942f2=_0x5942f2-0x0;var _0x3724b1=_0xfc2f[_0x5942f2];return _0x3724b1;};'use strict';var multer=require(_0xffc2('0x0'));var util=require(_0xffc2('0x1'));var path=require('path');var timeout=require(_0xffc2('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xffc2('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xffc2('0x4'));router[_0xffc2('0x5')]('/',auth[_0xffc2('0x6')](),controller[_0xffc2('0x7')]);router[_0xffc2('0x5')](_0xffc2('0x8'),auth['isAuthenticated'](),controller[_0xffc2('0x9')]);router[_0xffc2('0x5')](_0xffc2('0xa'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0xffc2('0x6')](),controller[_0xffc2('0xb')]);router[_0xffc2('0xc')](_0xffc2('0xa'),auth['isAuthenticated'](),controller['update']);router[_0xffc2('0xd')]('/:id',auth[_0xffc2('0x6')](),controller['destroy']);module[_0xffc2('0xe')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index 6bf996e..e885889 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 _0xe5b3=['STRING','INTEGER','DATE','exports'];(function(_0x48c938,_0x14ac2c){var _0x5625b2=function(_0x3edffd){while(--_0x3edffd){_0x48c938['push'](_0x48c938['shift']());}};_0x5625b2(++_0x14ac2c);}(_0xe5b3,0x133));var _0x3e5b=function(_0x2fde33,_0x1e0652){_0x2fde33=_0x2fde33-0x0;var _0x4d2075=_0xe5b3[_0x2fde33];return _0x4d2075;};'use strict';var Sequelize=require('sequelize');module[_0x3e5b('0x0')]={'privilege':{'type':Sequelize[_0x3e5b('0x1')]},'channel':{'type':Sequelize[_0x3e5b('0x1')]},'channelstate':{'type':Sequelize[_0x3e5b('0x2')]},'channelstatedesc':{'type':Sequelize[_0x3e5b('0x1')]},'calleridnum':{'type':Sequelize[_0x3e5b('0x1')]},'calleridname':{'type':Sequelize[_0x3e5b('0x1')]},'connectedlinenum':{'type':Sequelize[_0x3e5b('0x1')]},'connectedlinename':{'type':Sequelize[_0x3e5b('0x1')]},'language':{'type':Sequelize[_0x3e5b('0x1')]},'accountcode':{'type':Sequelize[_0x3e5b('0x1')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x3e5b('0x1')]},'priority':{'type':Sequelize[_0x3e5b('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0x3e5b('0x1')]},'destchannel':{'type':Sequelize[_0x3e5b('0x1')]},'destchannelstate':{'type':Sequelize[_0x3e5b('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0x3e5b('0x1')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x3e5b('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x3e5b('0x1')]},'destlanguage':{'type':Sequelize[_0x3e5b('0x1')]},'destaccountcode':{'type':Sequelize[_0x3e5b('0x1')]},'destcontext':{'type':Sequelize[_0x3e5b('0x1')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x3e5b('0x2')]},'destuniqueid':{'type':Sequelize['STRING']},'destlinkedid':{'type':Sequelize[_0x3e5b('0x1')]},'dialstring':{'type':Sequelize[_0x3e5b('0x1')]},'dialstatus':{'type':Sequelize[_0x3e5b('0x1')]},'starttime':{'type':Sequelize[_0x3e5b('0x3')]},'answertime':{'type':Sequelize[_0x3e5b('0x3')]},'endtime':{'type':Sequelize[_0x3e5b('0x3')]},'lastevent':{'type':Sequelize[_0x3e5b('0x1')],'comment':'called,connect,complete'},'routeId':{'type':Sequelize[_0x3e5b('0x2')]},'duration':{'type':Sequelize['INTEGER']},'holdtime':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x00bb=['STRING','INTEGER','DATE','called,connect,complete','sequelize','exports'];(function(_0x9bb1b6,_0x22fd75){var _0x3f893e=function(_0x2d13be){while(--_0x2d13be){_0x9bb1b6['push'](_0x9bb1b6['shift']());}};_0x3f893e(++_0x22fd75);}(_0x00bb,0x1d8));var _0xb00b=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0x00bb[_0x1d9aa0];return _0x226868;};'use strict';var Sequelize=require(_0xb00b('0x0'));module[_0xb00b('0x1')]={'privilege':{'type':Sequelize[_0xb00b('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0xb00b('0x3')]},'channelstatedesc':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xb00b('0x2')]},'calleridname':{'type':Sequelize[_0xb00b('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0xb00b('0x2')]},'language':{'type':Sequelize[_0xb00b('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xb00b('0x3')]},'uniqueid':{'type':Sequelize[_0xb00b('0x2')]},'linkedid':{'type':Sequelize[_0xb00b('0x2')]},'destchannel':{'type':Sequelize[_0xb00b('0x2')]},'destchannelstate':{'type':Sequelize[_0xb00b('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0xb00b('0x2')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0xb00b('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xb00b('0x2')]},'destlanguage':{'type':Sequelize[_0xb00b('0x2')]},'destaccountcode':{'type':Sequelize[_0xb00b('0x2')]},'destcontext':{'type':Sequelize[_0xb00b('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0xb00b('0x3')]},'destuniqueid':{'type':Sequelize['STRING']},'destlinkedid':{'type':Sequelize['STRING']},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize[_0xb00b('0x2')]},'starttime':{'type':Sequelize[_0xb00b('0x4')]},'answertime':{'type':Sequelize[_0xb00b('0x4')]},'endtime':{'type':Sequelize[_0xb00b('0x4')]},'lastevent':{'type':Sequelize[_0xb00b('0x2')],'comment':_0xb00b('0x5')},'routeId':{'type':Sequelize['INTEGER']},'duration':{'type':Sequelize[_0xb00b('0x3')]},'holdtime':{'type':Sequelize[_0xb00b('0x3')]},'billableseconds':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index 0297802..20b4ce9 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 _0x10b7=['sendStatus','status','json','offset','undefined','limit','count','set','reject','save','update','then','destroy','end','error','stack','name','index','VoiceDialReport','rawAttributes','fieldName','key','model','map','keys','query','filters','intersection','attributes','length','sort','where','pick','filter','merge','type','options','includeAll','include','findAll','catch','params','fields','body','find','describe','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb'];(function(_0x4154a6,_0x2c0b8e){var _0x3b2786=function(_0x2f5936){while(--_0x2f5936){_0x4154a6['push'](_0x4154a6['shift']());}};_0x3b2786(++_0x2c0b8e);}(_0x10b7,0x191));var _0x710b=function(_0x1bda96,_0x176bdd){_0x1bda96=_0x1bda96-0x0;var _0x20a36e=_0x10b7[_0x1bda96];return _0x20a36e;};'use strict';var emlformat=require(_0x710b('0x0'));var rimraf=require(_0x710b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x710b('0x2'));var rp=require(_0x710b('0x3'));var moment=require('moment');var BPromise=require(_0x710b('0x4'));var Mustache=require(_0x710b('0x5'));var util=require(_0x710b('0x6'));var path=require(_0x710b('0x7'));var sox=require(_0x710b('0x8'));var csv=require(_0x710b('0x9'));var ejs=require(_0x710b('0xa'));var fs=require('fs');var fs_extra=require(_0x710b('0xb'));var _=require(_0x710b('0xc'));var squel=require(_0x710b('0xd'));var crypto=require(_0x710b('0xe'));var jsforce=require(_0x710b('0xf'));var deskjs=require(_0x710b('0x10'));var toCsv=require(_0x710b('0x9'));var querystring=require('querystring');var Papa=require(_0x710b('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x710b('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x710b('0x13'));var logger=require(_0x710b('0x14'))(_0x710b('0x15'));var utils=require(_0x710b('0x16'));var config=require(_0x710b('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x710b('0x18'))['db'];function respondWithStatusCode(_0x84155e,_0x436a16){_0x436a16=_0x436a16||0xcc;return function(_0x3028dd){if(_0x3028dd){return _0x84155e[_0x710b('0x19')](_0x436a16);}return _0x84155e['status'](_0x436a16)['end']();};}function respondWithResult(_0x29544b,_0x415cc8){_0x415cc8=_0x415cc8||0xc8;return function(_0x30f888){if(_0x30f888){return _0x29544b[_0x710b('0x1a')](_0x415cc8)[_0x710b('0x1b')](_0x30f888);}};}function respondWithFilteredResult(_0x382a34,_0x12cb89){return function(_0x102217){if(_0x102217){var _0x847b75=typeof _0x12cb89[_0x710b('0x1c')]===_0x710b('0x1d')&&typeof _0x12cb89[_0x710b('0x1e')]===_0x710b('0x1d');var _0xa34320=_0x102217[_0x710b('0x1f')];var _0x5b45df=_0x847b75?0x0:_0x12cb89[_0x710b('0x1c')];var _0x47e716=_0x847b75?_0x102217['count']:_0x12cb89[_0x710b('0x1c')]+_0x12cb89[_0x710b('0x1e')];var _0x308cb1;if(_0x47e716>=_0xa34320){_0x47e716=_0xa34320;_0x308cb1=0xc8;}else{_0x308cb1=0xce;}_0x382a34[_0x710b('0x1a')](_0x308cb1);return _0x382a34[_0x710b('0x20')]('Content-Range',_0x5b45df+'-'+_0x47e716+'/'+_0xa34320)['json'](_0x102217);}return null;};}function patchUpdates(_0x25067b){return function(_0x3e75cb){try{jsonpatch['apply'](_0x3e75cb,_0x25067b,!![]);}catch(_0x2b7587){return BPromise[_0x710b('0x21')](_0x2b7587);}return _0x3e75cb[_0x710b('0x22')]();};}function saveUpdates(_0x86b502,_0xcea7df){return function(_0x21c58d){if(_0x21c58d){return _0x21c58d[_0x710b('0x23')](_0x86b502)[_0x710b('0x24')](function(_0x4d8c2c){return _0x4d8c2c;});}return null;};}function removeEntity(_0x297f96,_0x12bd35){return function(_0x48c1af){if(_0x48c1af){return _0x48c1af[_0x710b('0x25')]()['then'](function(){_0x297f96[_0x710b('0x1a')](0xcc)[_0x710b('0x26')]();});}};}function handleEntityNotFound(_0x1b923a,_0x3a6142){return function(_0x427e7f){if(!_0x427e7f){_0x1b923a[_0x710b('0x19')](0x194);}return _0x427e7f;};}function handleError(_0x166c1b,_0x44bbfe){_0x44bbfe=_0x44bbfe||0x1f4;return function(_0x5eecd8){logger[_0x710b('0x27')](_0x5eecd8[_0x710b('0x28')]);if(_0x5eecd8[_0x710b('0x29')]){delete _0x5eecd8[_0x710b('0x29')];}_0x166c1b['status'](_0x44bbfe)['send'](_0x5eecd8);};}exports[_0x710b('0x2a')]=function(_0x3c3f84,_0x53ba78){var _0x19d33e={},_0x341441={},_0x7bb90f={'count':0x0,'rows':[]};var _0x3b1f3e=_['map'](db[_0x710b('0x2b')][_0x710b('0x2c')],function(_0x4d42a2){return{'name':_0x4d42a2[_0x710b('0x2d')],'type':_0x4d42a2['type'][_0x710b('0x2e')]};});_0x341441[_0x710b('0x2f')]=_[_0x710b('0x30')](_0x3b1f3e,_0x710b('0x29'));_0x341441['query']=_[_0x710b('0x31')](_0x3c3f84[_0x710b('0x32')]);_0x341441[_0x710b('0x33')]=_[_0x710b('0x34')](_0x341441[_0x710b('0x2f')],_0x341441[_0x710b('0x32')]);_0x19d33e['attributes']=_[_0x710b('0x34')](_0x341441['model'],qs['fields'](_0x3c3f84['query']['fields']));_0x19d33e[_0x710b('0x35')]=_0x19d33e[_0x710b('0x35')][_0x710b('0x36')]?_0x19d33e['attributes']:_0x341441[_0x710b('0x2f')];if(!_0x3c3f84[_0x710b('0x32')]['hasOwnProperty']('nolimit')){_0x19d33e['limit']=qs[_0x710b('0x1e')](_0x3c3f84[_0x710b('0x32')][_0x710b('0x1e')]);_0x19d33e[_0x710b('0x1c')]=qs['offset'](_0x3c3f84[_0x710b('0x32')][_0x710b('0x1c')]);}_0x19d33e['order']=qs[_0x710b('0x37')](_0x3c3f84['query']['sort']);_0x19d33e[_0x710b('0x38')]=qs[_0x710b('0x33')](_[_0x710b('0x39')](_0x3c3f84[_0x710b('0x32')],_0x341441[_0x710b('0x33')]),_0x3b1f3e);if(_0x3c3f84[_0x710b('0x32')][_0x710b('0x3a')]){_0x19d33e[_0x710b('0x38')]=_[_0x710b('0x3b')](_0x19d33e['where'],{'$or':_[_0x710b('0x30')](_0x3b1f3e,function(_0x50f070){if(_0x50f070[_0x710b('0x3c')]!=='VIRTUAL'){var _0x31578b={};_0x31578b[_0x50f070['name']]={'$like':'%'+_0x3c3f84[_0x710b('0x32')]['filter']+'%'};return _0x31578b;}})});}_0x19d33e=_[_0x710b('0x3b')]({},_0x19d33e,_0x3c3f84[_0x710b('0x3d')]);var _0x1ebdc7={'where':_0x19d33e[_0x710b('0x38')]};return db[_0x710b('0x2b')]['count'](_0x1ebdc7)[_0x710b('0x24')](function(_0x17f4d8){_0x7bb90f[_0x710b('0x1f')]=_0x17f4d8;if(_0x3c3f84[_0x710b('0x32')][_0x710b('0x3e')]){_0x19d33e[_0x710b('0x3f')]=[{'all':!![]}];}return db[_0x710b('0x2b')][_0x710b('0x40')](_0x19d33e);})[_0x710b('0x24')](function(_0x44bf64){_0x7bb90f['rows']=_0x44bf64;return _0x7bb90f;})[_0x710b('0x24')](respondWithFilteredResult(_0x53ba78,_0x19d33e))[_0x710b('0x41')](handleError(_0x53ba78,null));};exports['show']=function(_0x13a505,_0x15ac1a){var _0x209744={'raw':!![],'where':{'id':_0x13a505[_0x710b('0x42')]['id']}},_0x579758={};_0x579758[_0x710b('0x2f')]=_[_0x710b('0x31')](db['VoiceDialReport'][_0x710b('0x2c')]);_0x579758[_0x710b('0x32')]=_[_0x710b('0x31')](_0x13a505[_0x710b('0x32')]);_0x579758[_0x710b('0x33')]=_[_0x710b('0x34')](_0x579758[_0x710b('0x2f')],_0x579758[_0x710b('0x32')]);_0x209744[_0x710b('0x35')]=_[_0x710b('0x34')](_0x579758[_0x710b('0x2f')],qs[_0x710b('0x43')](_0x13a505[_0x710b('0x32')][_0x710b('0x43')]));_0x209744[_0x710b('0x35')]=_0x209744[_0x710b('0x35')]['length']?_0x209744[_0x710b('0x35')]:_0x579758[_0x710b('0x2f')];if(_0x13a505[_0x710b('0x32')][_0x710b('0x3e')]){_0x209744[_0x710b('0x3f')]=[{'all':!![]}];}_0x209744=_[_0x710b('0x3b')]({},_0x209744,_0x13a505[_0x710b('0x3d')]);return db[_0x710b('0x2b')]['find'](_0x209744)['then'](handleEntityNotFound(_0x15ac1a,null))[_0x710b('0x24')](respondWithResult(_0x15ac1a,null))['catch'](handleError(_0x15ac1a,null));};exports['create']=function(_0x56bea9,_0x1416ee){return db[_0x710b('0x2b')]['create'](_0x56bea9['body'],{})[_0x710b('0x24')](respondWithResult(_0x1416ee,0xc9))[_0x710b('0x41')](handleError(_0x1416ee,null));};exports[_0x710b('0x23')]=function(_0x16e438,_0x351b56){if(_0x16e438[_0x710b('0x44')]['id']){delete _0x16e438[_0x710b('0x44')]['id'];}return db['VoiceDialReport'][_0x710b('0x45')]({'where':{'id':_0x16e438[_0x710b('0x42')]['id']}})[_0x710b('0x24')](handleEntityNotFound(_0x351b56,null))[_0x710b('0x24')](saveUpdates(_0x16e438['body'],null))[_0x710b('0x24')](respondWithResult(_0x351b56,null))['catch'](handleError(_0x351b56,null));};exports['destroy']=function(_0x4a9f68,_0x3cb073){return db[_0x710b('0x2b')][_0x710b('0x45')]({'where':{'id':_0x4a9f68['params']['id']}})[_0x710b('0x24')](handleEntityNotFound(_0x3cb073,null))['then'](removeEntity(_0x3cb073,null))['catch'](handleError(_0x3cb073,null));};exports[_0x710b('0x46')]=function(_0x314c94,_0x177fb0){return db[_0x710b('0x2b')][_0x710b('0x46')]()[_0x710b('0x24')](respondWithResult(_0x177fb0,null))[_0x710b('0x41')](handleError(_0x177fb0,null));}; \ No newline at end of file +var _0x9adc=['rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','pick','filter','where','merge','options','include','findAll','catch','show','params','includeAll','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','destroy','name','index','map','VoiceDialReport'];(function(_0x117888,_0x464fa2){var _0x499748=function(_0x460e32){while(--_0x460e32){_0x117888['push'](_0x117888['shift']());}};_0x499748(++_0x464fa2);}(_0x9adc,0xae));var _0xc9ad=function(_0x489ba4,_0x1e04f5){_0x489ba4=_0x489ba4-0x0;var _0x59cea6=_0x9adc[_0x489ba4];return _0x59cea6;};'use strict';var emlformat=require(_0xc9ad('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc9ad('0x1'));var jsonpatch=require(_0xc9ad('0x2'));var rp=require(_0xc9ad('0x3'));var moment=require(_0xc9ad('0x4'));var BPromise=require(_0xc9ad('0x5'));var Mustache=require(_0xc9ad('0x6'));var util=require(_0xc9ad('0x7'));var path=require(_0xc9ad('0x8'));var sox=require(_0xc9ad('0x9'));var csv=require(_0xc9ad('0xa'));var ejs=require(_0xc9ad('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xc9ad('0xc'));var crypto=require(_0xc9ad('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xc9ad('0xe'));var toCsv=require(_0xc9ad('0xa'));var querystring=require(_0xc9ad('0xf'));var Papa=require('papaparse');var Redis=require(_0xc9ad('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xc9ad('0x11'));var as=require(_0xc9ad('0x12'));var hardwareService=require(_0xc9ad('0x13'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xc9ad('0x14'));var licenseUtil=require(_0xc9ad('0x15'));var db=require(_0xc9ad('0x16'))['db'];function respondWithStatusCode(_0x4746df,_0x1fe432){_0x1fe432=_0x1fe432||0xcc;return function(_0x26e554){if(_0x26e554){return _0x4746df[_0xc9ad('0x17')](_0x1fe432);}return _0x4746df[_0xc9ad('0x18')](_0x1fe432)[_0xc9ad('0x19')]();};}function respondWithResult(_0x87a175,_0x1e4749){_0x1e4749=_0x1e4749||0xc8;return function(_0x333e65){if(_0x333e65){return _0x87a175[_0xc9ad('0x18')](_0x1e4749)[_0xc9ad('0x1a')](_0x333e65);}};}function respondWithFilteredResult(_0x29bfd4,_0x177492){return function(_0x4ea0aa){if(_0x4ea0aa){var _0x240eeb=typeof _0x177492['offset']===_0xc9ad('0x1b')&&typeof _0x177492[_0xc9ad('0x1c')]==='undefined';var _0x3b663c=_0x4ea0aa[_0xc9ad('0x1d')];var _0x379732=_0x240eeb?0x0:_0x177492[_0xc9ad('0x1e')];var _0xed84e8=_0x240eeb?_0x4ea0aa[_0xc9ad('0x1d')]:_0x177492[_0xc9ad('0x1e')]+_0x177492[_0xc9ad('0x1c')];var _0x27883d;if(_0xed84e8>=_0x3b663c){_0xed84e8=_0x3b663c;_0x27883d=0xc8;}else{_0x27883d=0xce;}_0x29bfd4[_0xc9ad('0x18')](_0x27883d);return _0x29bfd4[_0xc9ad('0x1f')](_0xc9ad('0x20'),_0x379732+'-'+_0xed84e8+'/'+_0x3b663c)[_0xc9ad('0x1a')](_0x4ea0aa);}return null;};}function patchUpdates(_0x4f3be5){return function(_0x4a8e84){try{jsonpatch[_0xc9ad('0x21')](_0x4a8e84,_0x4f3be5,!![]);}catch(_0x5e38f7){return BPromise[_0xc9ad('0x22')](_0x5e38f7);}return _0x4a8e84['save']();};}function saveUpdates(_0x154e70,_0x1022ca){return function(_0x276d6a){if(_0x276d6a){return _0x276d6a[_0xc9ad('0x23')](_0x154e70)[_0xc9ad('0x24')](function(_0x1646d7){return _0x1646d7;});}return null;};}function removeEntity(_0x4e5c3b,_0x43e3eb){return function(_0x3e15dc){if(_0x3e15dc){return _0x3e15dc[_0xc9ad('0x25')]()['then'](function(){_0x4e5c3b[_0xc9ad('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x548d2d,_0x46347a){return function(_0x56870e){if(!_0x56870e){_0x548d2d[_0xc9ad('0x17')](0x194);}return _0x56870e;};}function handleError(_0x7c464b,_0x113be5){_0x113be5=_0x113be5||0x1f4;return function(_0x306f4f){logger['error'](_0x306f4f['stack']);if(_0x306f4f[_0xc9ad('0x26')]){delete _0x306f4f[_0xc9ad('0x26')];}_0x7c464b[_0xc9ad('0x18')](_0x113be5)['send'](_0x306f4f);};}exports[_0xc9ad('0x27')]=function(_0x2657a4,_0x5f18ce){var _0x32e7f6={},_0x5e578e={},_0x466317={'count':0x0,'rows':[]};var _0x52fec0=_[_0xc9ad('0x28')](db[_0xc9ad('0x29')][_0xc9ad('0x2a')],function(_0x3454cf){return{'name':_0x3454cf[_0xc9ad('0x2b')],'type':_0x3454cf[_0xc9ad('0x2c')][_0xc9ad('0x2d')]};});_0x5e578e['model']=_[_0xc9ad('0x28')](_0x52fec0,_0xc9ad('0x26'));_0x5e578e[_0xc9ad('0x2e')]=_[_0xc9ad('0x2f')](_0x2657a4[_0xc9ad('0x2e')]);_0x5e578e[_0xc9ad('0x30')]=_[_0xc9ad('0x31')](_0x5e578e[_0xc9ad('0x32')],_0x5e578e['query']);_0x32e7f6['attributes']=_[_0xc9ad('0x31')](_0x5e578e['model'],qs[_0xc9ad('0x33')](_0x2657a4['query']['fields']));_0x32e7f6['attributes']=_0x32e7f6[_0xc9ad('0x34')][_0xc9ad('0x35')]?_0x32e7f6['attributes']:_0x5e578e['model'];if(!_0x2657a4[_0xc9ad('0x2e')][_0xc9ad('0x36')]('nolimit')){_0x32e7f6[_0xc9ad('0x1c')]=qs['limit'](_0x2657a4[_0xc9ad('0x2e')]['limit']);_0x32e7f6[_0xc9ad('0x1e')]=qs[_0xc9ad('0x1e')](_0x2657a4[_0xc9ad('0x2e')][_0xc9ad('0x1e')]);}_0x32e7f6[_0xc9ad('0x37')]=qs[_0xc9ad('0x38')](_0x2657a4[_0xc9ad('0x2e')]['sort']);_0x32e7f6['where']=qs[_0xc9ad('0x30')](_[_0xc9ad('0x39')](_0x2657a4['query'],_0x5e578e[_0xc9ad('0x30')]),_0x52fec0);if(_0x2657a4[_0xc9ad('0x2e')][_0xc9ad('0x3a')]){_0x32e7f6[_0xc9ad('0x3b')]=_[_0xc9ad('0x3c')](_0x32e7f6[_0xc9ad('0x3b')],{'$or':_[_0xc9ad('0x28')](_0x52fec0,function(_0x26ec64){if(_0x26ec64[_0xc9ad('0x2c')]!=='VIRTUAL'){var _0x5c6212={};_0x5c6212[_0x26ec64[_0xc9ad('0x26')]]={'$like':'%'+_0x2657a4['query'][_0xc9ad('0x3a')]+'%'};return _0x5c6212;}})});}_0x32e7f6=_['merge']({},_0x32e7f6,_0x2657a4[_0xc9ad('0x3d')]);var _0x540703={'where':_0x32e7f6['where']};return db[_0xc9ad('0x29')][_0xc9ad('0x1d')](_0x540703)[_0xc9ad('0x24')](function(_0x3e0355){_0x466317['count']=_0x3e0355;if(_0x2657a4['query']['includeAll']){_0x32e7f6[_0xc9ad('0x3e')]=[{'all':!![]}];}return db[_0xc9ad('0x29')][_0xc9ad('0x3f')](_0x32e7f6);})[_0xc9ad('0x24')](function(_0x2606fe){_0x466317['rows']=_0x2606fe;return _0x466317;})[_0xc9ad('0x24')](respondWithFilteredResult(_0x5f18ce,_0x32e7f6))[_0xc9ad('0x40')](handleError(_0x5f18ce,null));};exports[_0xc9ad('0x41')]=function(_0x105cd4,_0x1bc0b3){var _0x1384de={'raw':!![],'where':{'id':_0x105cd4[_0xc9ad('0x42')]['id']}},_0x26f034={};_0x26f034['model']=_[_0xc9ad('0x2f')](db[_0xc9ad('0x29')]['rawAttributes']);_0x26f034[_0xc9ad('0x2e')]=_[_0xc9ad('0x2f')](_0x105cd4['query']);_0x26f034[_0xc9ad('0x30')]=_[_0xc9ad('0x31')](_0x26f034[_0xc9ad('0x32')],_0x26f034[_0xc9ad('0x2e')]);_0x1384de[_0xc9ad('0x34')]=_[_0xc9ad('0x31')](_0x26f034[_0xc9ad('0x32')],qs[_0xc9ad('0x33')](_0x105cd4[_0xc9ad('0x2e')]['fields']));_0x1384de['attributes']=_0x1384de[_0xc9ad('0x34')][_0xc9ad('0x35')]?_0x1384de[_0xc9ad('0x34')]:_0x26f034[_0xc9ad('0x32')];if(_0x105cd4[_0xc9ad('0x2e')][_0xc9ad('0x43')]){_0x1384de[_0xc9ad('0x3e')]=[{'all':!![]}];}_0x1384de=_['merge']({},_0x1384de,_0x105cd4[_0xc9ad('0x3d')]);return db[_0xc9ad('0x29')][_0xc9ad('0x44')](_0x1384de)[_0xc9ad('0x24')](handleEntityNotFound(_0x1bc0b3,null))['then'](respondWithResult(_0x1bc0b3,null))['catch'](handleError(_0x1bc0b3,null));};exports[_0xc9ad('0x45')]=function(_0x504249,_0x307680){return db[_0xc9ad('0x29')][_0xc9ad('0x45')](_0x504249[_0xc9ad('0x46')],{})[_0xc9ad('0x24')](respondWithResult(_0x307680,0xc9))[_0xc9ad('0x40')](handleError(_0x307680,null));};exports[_0xc9ad('0x23')]=function(_0x1f2537,_0x781140){if(_0x1f2537[_0xc9ad('0x46')]['id']){delete _0x1f2537[_0xc9ad('0x46')]['id'];}return db[_0xc9ad('0x29')][_0xc9ad('0x44')]({'where':{'id':_0x1f2537[_0xc9ad('0x42')]['id']}})[_0xc9ad('0x24')](handleEntityNotFound(_0x781140,null))['then'](saveUpdates(_0x1f2537[_0xc9ad('0x46')],null))['then'](respondWithResult(_0x781140,null))[_0xc9ad('0x40')](handleError(_0x781140,null));};exports['destroy']=function(_0x3233e8,_0xe4e21d){return db['VoiceDialReport'][_0xc9ad('0x44')]({'where':{'id':_0x3233e8[_0xc9ad('0x42')]['id']}})['then'](handleEntityNotFound(_0xe4e21d,null))['then'](removeEntity(_0xe4e21d,null))[_0xc9ad('0x40')](handleError(_0xe4e21d,null));};exports[_0xc9ad('0x47')]=function(_0x2f7ac3,_0x2e2e7b){return db[_0xc9ad('0x29')]['describe']()[_0xc9ad('0x24')](respondWithResult(_0x2e2e7b,null))[_0xc9ad('0x40')](handleError(_0x2e2e7b,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index ef5638a..7f45877 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 _0x1433=['VoiceDialReport','report_dial','uniqueid','lodash','util','api','moment','bluebird','request-promise','../../config/environment','./voiceDialReport.attributes','exports','define'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x1433,0x121));var _0x3143=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1433[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x3143('0x0'));var util=require(_0x3143('0x1'));var logger=require('../../config/logger')(_0x3143('0x2'));var moment=require(_0x3143('0x3'));var BPromise=require(_0x3143('0x4'));var rp=require(_0x3143('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x3143('0x6'));var attributes=require(_0x3143('0x7'));module[_0x3143('0x8')]=function(_0x216e7a,_0xe029e4){return _0x216e7a[_0x3143('0x9')](_0x3143('0xa'),attributes,{'tableName':_0x3143('0xb'),'paranoid':![],'indexes':[{'fields':[_0x3143('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x12be=['api','bluebird','path','rimraf','../../config/environment','./voiceDialReport.attributes','define','VoiceDialReport','uniqueid','lodash','util'];(function(_0x114fb1,_0x40a837){var _0x976b2a=function(_0x2fa2db){while(--_0x2fa2db){_0x114fb1['push'](_0x114fb1['shift']());}};_0x976b2a(++_0x40a837);}(_0x12be,0x169));var _0xe12b=function(_0x1e3671,_0x9ae4fc){_0x1e3671=_0x1e3671-0x0;var _0x48d5f5=_0x12be[_0x1e3671];return _0x48d5f5;};'use strict';var _=require(_0xe12b('0x0'));var util=require(_0xe12b('0x1'));var logger=require('../../config/logger')(_0xe12b('0x2'));var moment=require('moment');var BPromise=require(_0xe12b('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe12b('0x4'));var rimraf=require(_0xe12b('0x5'));var config=require(_0xe12b('0x6'));var attributes=require(_0xe12b('0x7'));module['exports']=function(_0x5dea07,_0x3cbf35){return _0x5dea07[_0xe12b('0x8')](_0xe12b('0x9'),attributes,{'tableName':'report_dial','paranoid':![],'indexes':[{'fields':[_0xe12b('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index c8e7616..19454f6 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 _0xc7ef=['../../config/environment','jayson/promise','then','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','VoiceDialReport','create','body','options','raw','info','CreateVoiceDialReport','catch','where','UpdateVoiceDialReport','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x5e0a2c,_0x8ef4eb){var _0x5ef0d9=function(_0x96e0f7){while(--_0x96e0f7){_0x5e0a2c['push'](_0x5e0a2c['shift']());}};_0x5ef0d9(++_0x8ef4eb);}(_0xc7ef,0x181));var _0xfc7e=function(_0x29f06b,_0x41b2b0){_0x29f06b=_0x29f06b-0x0;var _0x3081d2=_0xc7ef[_0x29f06b];return _0x3081d2;};'use strict';var _=require(_0xfc7e('0x0'));var util=require('util');var moment=require(_0xfc7e('0x1'));var BPromise=require(_0xfc7e('0x2'));var rs=require(_0xfc7e('0x3'));var fs=require('fs');var Redis=require(_0xfc7e('0x4'));var db=require(_0xfc7e('0x5'))['db'];var utils=require(_0xfc7e('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xfc7e('0x7'));var jayson=require(_0xfc7e('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x16d3e5,_0x6346da,_0x1a5ec3){return new BPromise(function(_0xef4902,_0x3d405f){return client['request'](_0x16d3e5,_0x1a5ec3)[_0xfc7e('0x9')](function(_0x106fa2){logger['info'](_0xfc7e('0xa'),_0x6346da,_0xfc7e('0xb'));logger[_0xfc7e('0xc')](_0xfc7e('0xd'),_0x6346da,_0xfc7e('0xb'),JSON[_0xfc7e('0xe')](_0x106fa2));if(_0x106fa2[_0xfc7e('0xf')]){if(_0x106fa2['error']['code']===0x1f4){logger[_0xfc7e('0xf')]('VoiceDialReport,\x20%s,\x20%s',_0x6346da,_0x106fa2['error']['message']);return _0x3d405f(_0x106fa2[_0xfc7e('0xf')][_0xfc7e('0x10')]);}logger['error'](_0xfc7e('0xa'),_0x6346da,_0x106fa2[_0xfc7e('0xf')][_0xfc7e('0x10')]);return _0xef4902(_0x106fa2[_0xfc7e('0xf')][_0xfc7e('0x10')]);}else{logger['info'](_0xfc7e('0xa'),_0x6346da,_0xfc7e('0xb'));_0xef4902(_0x106fa2[_0xfc7e('0x11')][_0xfc7e('0x10')]);}})['catch'](function(_0x45653e){logger[_0xfc7e('0xf')]('VoiceDialReport,\x20%s,\x20%s',_0x6346da,_0x45653e);_0x3d405f(_0x45653e);});});}exports['CreateVoiceDialReport']=function(_0x457b63){var _0x4f7a36=this;return new Promise(function(_0x44185a,_0xa28cd3){return db[_0xfc7e('0x12')][_0xfc7e('0x13')](_0x457b63[_0xfc7e('0x14')],{'raw':_0x457b63[_0xfc7e('0x15')]?_0x457b63[_0xfc7e('0x15')][_0xfc7e('0x16')]===undefined?!![]:![]:!![]})['then'](function(_0xc39e26){logger[_0xfc7e('0x17')](_0xfc7e('0x18'),_0x457b63);logger[_0xfc7e('0xc')](_0xfc7e('0x18'),_0x457b63,JSON['stringify'](_0xc39e26));_0x44185a(_0xc39e26);})[_0xfc7e('0x19')](function(_0x1e89c8){logger[_0xfc7e('0xf')](_0xfc7e('0x18'),_0x1e89c8[_0xfc7e('0x10')],_0x457b63);_0xa28cd3(_0x4f7a36[_0xfc7e('0xf')](0x1f4,_0x1e89c8[_0xfc7e('0x10')]));});});};exports['UpdateVoiceDialReport']=function(_0x4fcd2d){var _0x293e92=this;return new Promise(function(_0x87aad9,_0x56a9e2){return db[_0xfc7e('0x12')]['update'](_0x4fcd2d[_0xfc7e('0x14')],{'raw':_0x4fcd2d[_0xfc7e('0x15')]?_0x4fcd2d[_0xfc7e('0x15')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4fcd2d['options']?_0x4fcd2d[_0xfc7e('0x15')][_0xfc7e('0x1a')]||null:null,'attributes':_0x4fcd2d['options']?_0x4fcd2d[_0xfc7e('0x15')]['attributes']||null:null,'limit':_0x4fcd2d[_0xfc7e('0x15')]?_0x4fcd2d['options']['limit']||null:null})['then'](function(_0x22405f){logger[_0xfc7e('0x17')](_0xfc7e('0x1b'),_0x4fcd2d);logger[_0xfc7e('0xc')](_0xfc7e('0x1b'),_0x4fcd2d,JSON['stringify'](_0x22405f));_0x87aad9(_0x22405f);})[_0xfc7e('0x19')](function(_0x43efd6){logger[_0xfc7e('0xf')](_0xfc7e('0x1b'),_0x43efd6[_0xfc7e('0x10')],_0x4fcd2d);_0x56a9e2(_0x293e92[_0xfc7e('0xf')](0x1f4,_0x43efd6['message']));});});}; \ No newline at end of file +var _0x27b3=['result','VoiceDialReport','create','body','options','CreateVoiceDialReport','debug','update','attributes','limit','UpdateVoiceDialReport','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','request\x20sent','error','code','VoiceDialReport,\x20%s,\x20%s','message','info'];(function(_0x405332,_0x4a03a1){var _0x29aad3=function(_0x21cb3a){while(--_0x21cb3a){_0x405332['push'](_0x405332['shift']());}};_0x29aad3(++_0x4a03a1);}(_0x27b3,0xac));var _0x327b=function(_0x47861a,_0xfcf0d2){_0x47861a=_0x47861a-0x0;var _0xac4430=_0x27b3[_0x47861a];return _0xac4430;};'use strict';var _=require(_0x327b('0x0'));var util=require(_0x327b('0x1'));var moment=require(_0x327b('0x2'));var BPromise=require(_0x327b('0x3'));var rs=require(_0x327b('0x4'));var fs=require('fs');var Redis=require(_0x327b('0x5'));var db=require(_0x327b('0x6'))['db'];var utils=require(_0x327b('0x7'));var logger=require(_0x327b('0x8'))(_0x327b('0x9'));var config=require('../../config/environment');var jayson=require(_0x327b('0xa'));var client=jayson['client'][_0x327b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2b2be2,_0x3099ad,_0x5c3b7b){return new BPromise(function(_0x22e371,_0x426336){return client[_0x327b('0xc')](_0x2b2be2,_0x5c3b7b)[_0x327b('0xd')](function(_0x3b20f1){logger['info']('VoiceDialReport,\x20%s,\x20%s',_0x3099ad,_0x327b('0xe'));logger['debug']('VoiceDialReport,\x20%s,\x20%s,\x20%s',_0x3099ad,_0x327b('0xe'),JSON['stringify'](_0x3b20f1));if(_0x3b20f1[_0x327b('0xf')]){if(_0x3b20f1[_0x327b('0xf')][_0x327b('0x10')]===0x1f4){logger[_0x327b('0xf')](_0x327b('0x11'),_0x3099ad,_0x3b20f1['error']['message']);return _0x426336(_0x3b20f1[_0x327b('0xf')][_0x327b('0x12')]);}logger[_0x327b('0xf')](_0x327b('0x11'),_0x3099ad,_0x3b20f1[_0x327b('0xf')][_0x327b('0x12')]);return _0x22e371(_0x3b20f1['error'][_0x327b('0x12')]);}else{logger[_0x327b('0x13')](_0x327b('0x11'),_0x3099ad,'request\x20sent');_0x22e371(_0x3b20f1[_0x327b('0x14')][_0x327b('0x12')]);}})['catch'](function(_0x3a3907){logger['error']('VoiceDialReport,\x20%s,\x20%s',_0x3099ad,_0x3a3907);_0x426336(_0x3a3907);});});}exports['CreateVoiceDialReport']=function(_0x56ad75){var _0x3a2f2d=this;return new Promise(function(_0x414a45,_0x117d37){return db[_0x327b('0x15')][_0x327b('0x16')](_0x56ad75[_0x327b('0x17')],{'raw':_0x56ad75[_0x327b('0x18')]?_0x56ad75[_0x327b('0x18')]['raw']===undefined?!![]:![]:!![]})[_0x327b('0xd')](function(_0x5a3586){logger[_0x327b('0x13')](_0x327b('0x19'),_0x56ad75);logger[_0x327b('0x1a')]('CreateVoiceDialReport',_0x56ad75,JSON['stringify'](_0x5a3586));_0x414a45(_0x5a3586);})['catch'](function(_0x1634ee){logger[_0x327b('0xf')](_0x327b('0x19'),_0x1634ee[_0x327b('0x12')],_0x56ad75);_0x117d37(_0x3a2f2d[_0x327b('0xf')](0x1f4,_0x1634ee[_0x327b('0x12')]));});});};exports['UpdateVoiceDialReport']=function(_0x110fb9){var _0x32be52=this;return new Promise(function(_0x1ccc7a,_0xc02737){return db[_0x327b('0x15')][_0x327b('0x1b')](_0x110fb9[_0x327b('0x17')],{'raw':_0x110fb9[_0x327b('0x18')]?_0x110fb9[_0x327b('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x110fb9[_0x327b('0x18')]?_0x110fb9[_0x327b('0x18')]['where']||null:null,'attributes':_0x110fb9[_0x327b('0x18')]?_0x110fb9[_0x327b('0x18')][_0x327b('0x1c')]||null:null,'limit':_0x110fb9['options']?_0x110fb9[_0x327b('0x18')][_0x327b('0x1d')]||null:null})[_0x327b('0xd')](function(_0x54e74c){logger[_0x327b('0x13')](_0x327b('0x1e'),_0x110fb9);logger['debug'](_0x327b('0x1e'),_0x110fb9,JSON[_0x327b('0x1f')](_0x54e74c));_0x1ccc7a(_0x54e74c);})['catch'](function(_0x51a17a){logger[_0x327b('0xf')](_0x327b('0x1e'),_0x51a17a['message'],_0x110fb9);_0xc02737(_0x32be52[_0x327b('0xf')](0x1f4,_0x51a17a[_0x327b('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index f2a6db6..be64866 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 _0xbfae=['express','Router','./voiceExtension.controller','get','isAuthenticated','index','show','post','create','/:id/applications','addApplications','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x249f8c,_0xfb3946){var _0x5e224a=function(_0xd4c5a1){while(--_0xd4c5a1){_0x249f8c['push'](_0x249f8c['shift']());}};_0x5e224a(++_0xfb3946);}(_0xbfae,0xa4));var _0xebfa=function(_0x22e010,_0x34c175){_0x22e010=_0x22e010-0x0;var _0x4c4c8a=_0xbfae[_0x22e010];return _0x4c4c8a;};'use strict';var multer=require(_0xebfa('0x0'));var util=require(_0xebfa('0x1'));var path=require(_0xebfa('0x2'));var timeout=require(_0xebfa('0x3'));var express=require(_0xebfa('0x4'));var router=express[_0xebfa('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xebfa('0x6'));router[_0xebfa('0x7')]('/',auth[_0xebfa('0x8')](),controller[_0xebfa('0x9')]);router[_0xebfa('0x7')]('/:id',auth['isAuthenticated'](),controller[_0xebfa('0xa')]);router[_0xebfa('0xb')]('/',auth[_0xebfa('0x8')](),controller[_0xebfa('0xc')]);router['post'](_0xebfa('0xd'),auth[_0xebfa('0x8')](),controller[_0xebfa('0xe')]);router[_0xebfa('0xf')](_0xebfa('0x10'),auth[_0xebfa('0x8')](),controller[_0xebfa('0x11')]);router[_0xebfa('0x12')](_0xebfa('0x10'),auth[_0xebfa('0x8')](),controller[_0xebfa('0x13')]);module[_0xebfa('0x14')]=router; \ No newline at end of file +var _0x9aaf=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceExtension.controller','get','isAuthenticated','index','show','post','create','/:id/applications','/:id','update','delete','destroy','multer','util','path','connect-timeout'];(function(_0x53d0f2,_0x461fff){var _0x4039fe=function(_0x1da59f){while(--_0x1da59f){_0x53d0f2['push'](_0x53d0f2['shift']());}};_0x4039fe(++_0x461fff);}(_0x9aaf,0x1dc));var _0xf9aa=function(_0x342baa,_0x4a110f){_0x342baa=_0x342baa-0x0;var _0x1208f3=_0x9aaf[_0x342baa];return _0x1208f3;};'use strict';var multer=require(_0xf9aa('0x0'));var util=require(_0xf9aa('0x1'));var path=require(_0xf9aa('0x2'));var timeout=require(_0xf9aa('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xf9aa('0x4'));var auth=require(_0xf9aa('0x5'));var interaction=require(_0xf9aa('0x6'));var config=require(_0xf9aa('0x7'));var controller=require(_0xf9aa('0x8'));router[_0xf9aa('0x9')]('/',auth[_0xf9aa('0xa')](),controller[_0xf9aa('0xb')]);router[_0xf9aa('0x9')]('/:id',auth[_0xf9aa('0xa')](),controller[_0xf9aa('0xc')]);router[_0xf9aa('0xd')]('/',auth[_0xf9aa('0xa')](),controller[_0xf9aa('0xe')]);router[_0xf9aa('0xd')](_0xf9aa('0xf'),auth[_0xf9aa('0xa')](),controller['addApplications']);router['put'](_0xf9aa('0x10'),auth['isAuthenticated'](),controller[_0xf9aa('0x11')]);router[_0xf9aa('0x12')](_0xf9aa('0x10'),auth['isAuthenticated'](),controller[_0xf9aa('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index fb2ff08..4b97957 100644 --- a/server/api/voiceExtension/voiceExtension.attributes.js +++ b/server/api/voiceExtension/voiceExtension.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['VIRTUAL','getDataValue','exten','sequelize','exports','STRING','compositeIndex','NoOp','ENUM','inbound','outbound','internal','inbound-fax','outbound-fax','system','any','*,*,*,*','INTEGER','BOOLEAN','wav'];(function(_0x433ced,_0x40a770){var _0x4088e7=function(_0x160c12){while(--_0x160c12){_0x433ced['push'](_0x433ced['shift']());}};_0x4088e7(++_0x40a770);}(_0xe706,0xa3));var _0x6e70=function(_0x1bf639,_0x864d54){_0x1bf639=_0x1bf639-0x0;var _0x553079=_0xe706[_0x1bf639];return _0x553079;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'context':{'type':Sequelize[_0x6e70('0x2')],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x6e70('0x2')],'allowNull':![],'unique':_0x6e70('0x3')},'priority':{'type':Sequelize[_0x6e70('0x2')],'allowNull':![],'defaultValue':'1','unique':_0x6e70('0x3')},'tag':{'type':Sequelize[_0x6e70('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x6e70('0x2')],'allowNull':![],'defaultValue':_0x6e70('0x4')},'appdata':{'type':Sequelize[_0x6e70('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x6e70('0x5')](_0x6e70('0x6'),_0x6e70('0x7'),_0x6e70('0x8'),_0x6e70('0x9'),_0x6e70('0xa'),_0x6e70('0xb'),_0x6e70('0xc')),'allowNull':![]},'description':{'type':Sequelize[_0x6e70('0x2')]},'interval':{'type':Sequelize[_0x6e70('0x2')],'allowNull':![],'defaultValue':_0x6e70('0xd')},'IntervalId':{'type':Sequelize[_0x6e70('0xe')]},'isApp':{'type':Sequelize[_0x6e70('0xf')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x6e70('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0x6e70('0x2')],'allowNull':!![]},'record':{'type':Sequelize[_0x6e70('0xf')],'defaultValue':![]},'cutdigits':{'type':Sequelize['INTEGER']},'recordingFormat':{'type':Sequelize['STRING'],'defaultValue':_0x6e70('0x10')},'answer':{'type':Sequelize[_0x6e70('0xf')],'defaultValue':!![]},'name':{'type':Sequelize[_0x6e70('0x11')],'get':function(){return this[_0x6e70('0x12')](_0x6e70('0x13'));}}}; \ No newline at end of file +var _0xb7e7=['BOOLEAN','wav','VIRTUAL','getDataValue','sequelize','STRING','NoOp','inbound','outbound','internal','outbound-fax','system','any','*,*,*,*','INTEGER'];(function(_0x146f85,_0x2dd421){var _0x6cdd27=function(_0x2b44ae){while(--_0x2b44ae){_0x146f85['push'](_0x146f85['shift']());}};_0x6cdd27(++_0x2dd421);}(_0xb7e7,0x121));var _0x7b7e=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0xb7e7[_0x3e5086];return _0xfeb102;};'use strict';var Sequelize=require(_0x7b7e('0x0'));module['exports']={'context':{'type':Sequelize[_0x7b7e('0x1')],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x7b7e('0x1')],'allowNull':![],'unique':'compositeIndex'},'priority':{'type':Sequelize[_0x7b7e('0x1')],'allowNull':![],'defaultValue':'1','unique':'compositeIndex'},'tag':{'type':Sequelize[_0x7b7e('0x1')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x7b7e('0x1')],'allowNull':![],'defaultValue':_0x7b7e('0x2')},'appdata':{'type':Sequelize['STRING'](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize['ENUM'](_0x7b7e('0x3'),_0x7b7e('0x4'),_0x7b7e('0x5'),'inbound-fax',_0x7b7e('0x6'),_0x7b7e('0x7'),_0x7b7e('0x8')),'allowNull':![]},'description':{'type':Sequelize[_0x7b7e('0x1')]},'interval':{'type':Sequelize[_0x7b7e('0x1')],'allowNull':![],'defaultValue':_0x7b7e('0x9')},'IntervalId':{'type':Sequelize[_0x7b7e('0xa')]},'isApp':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x7b7e('0x1')],'defaultValue':null},'callerID':{'type':Sequelize[_0x7b7e('0x1')],'allowNull':!![]},'record':{'type':Sequelize[_0x7b7e('0xb')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x7b7e('0xa')]},'recordingFormat':{'type':Sequelize[_0x7b7e('0x1')],'defaultValue':_0x7b7e('0xc')},'answer':{'type':Sequelize[_0x7b7e('0xb')],'defaultValue':!![]},'name':{'type':Sequelize[_0x7b7e('0xd')],'get':function(){return this[_0x7b7e('0xe')]('exten');}}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index 7e853f9..b8690b4 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 _0xeb47=['internal','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','recordingFormat','cutdigits','mandatoryDisposition','alias','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findOne','findAndCountAll','cast(priority\x20as\x20unsigned)','finally','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./voiceExtension.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','destroy','then','get','InboundRoutes','OutboundRoutes','outbound','InternalRoutes','filter','ignore','map','value','type','name','UserProfileResource','stack','send','index','VoiceExtension','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include','findAll','show','find','catch','params','create','startsWith','exten','concat','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role'];(function(_0x511fad,_0x26cf29){var _0x4b61bd=function(_0x543692){while(--_0x543692){_0x511fad['push'](_0x511fad['shift']());}};_0x4b61bd(++_0x26cf29);}(_0xeb47,0x6e));var _0x7eb4=function(_0x354a3b,_0x120272){_0x354a3b=_0x354a3b-0x0;var _0x442c1f=_0xeb47[_0x354a3b];return _0x442c1f;};'use strict';var _=require(_0x7eb4('0x0'));var Redis=require(_0x7eb4('0x1'));var qs=require(_0x7eb4('0x2'));var logger=require(_0x7eb4('0x3'))(_0x7eb4('0x4'));var config=require(_0x7eb4('0x5'));var db=require(_0x7eb4('0x6'))['db'];config['redis']=_['defaults'](config[_0x7eb4('0x7')],{'host':_0x7eb4('0x8'),'port':0x18eb});var socket=require(_0x7eb4('0x9'))(new Redis(config['redis']));require(_0x7eb4('0xa'))[_0x7eb4('0xb')](socket);function respondWithStatusCode(_0xd6ee84,_0x46ae1a){_0x46ae1a=_0x46ae1a||0xcc;return function(_0x1dd9f8){if(_0x1dd9f8){return _0xd6ee84[_0x7eb4('0xc')](_0x46ae1a);}return _0xd6ee84[_0x7eb4('0xd')](_0x46ae1a)[_0x7eb4('0xe')]();};}function respondWithResult(_0x4eefc6,_0x985e17){_0x985e17=_0x985e17||0xc8;return function(_0x536c9f){if(_0x536c9f){return _0x4eefc6['status'](_0x985e17)[_0x7eb4('0xf')](_0x536c9f);}};}function respondWithFilteredResult(_0x2dbc50,_0x4d0dab){return function(_0x35e1a9){if(_0x35e1a9){var _0x2e9e84=typeof _0x4d0dab[_0x7eb4('0x10')]===_0x7eb4('0x11')&&typeof _0x4d0dab[_0x7eb4('0x12')]==='undefined';var _0x501da0=_0x35e1a9[_0x7eb4('0x13')];var _0x1d38f0=_0x2e9e84?0x0:_0x4d0dab[_0x7eb4('0x10')];var _0x4fe273=_0x2e9e84?_0x35e1a9['count']:_0x4d0dab['offset']+_0x4d0dab['limit'];var _0x1d99b1;if(_0x4fe273>=_0x501da0){_0x4fe273=_0x501da0;_0x1d99b1=0xc8;}else{_0x1d99b1=0xce;}_0x2dbc50[_0x7eb4('0xd')](_0x1d99b1);return _0x2dbc50[_0x7eb4('0x14')]('Content-Range',_0x1d38f0+'-'+_0x4fe273+'/'+_0x501da0)[_0x7eb4('0xf')](_0x35e1a9);}return null;};}function removeEntity(_0x588564){return function(_0x27d74d){if(_0x27d74d){return _0x27d74d[_0x7eb4('0x15')]()[_0x7eb4('0x16')](function(){var _0x33966d=_0x27d74d[_0x7eb4('0x17')]({'plain':!![]});var _0xdf789=[{'name':_0x7eb4('0x18'),'value':'inbound','ignore':![]},{'name':_0x7eb4('0x19'),'value':_0x7eb4('0x1a'),'ignore':![]},{'name':_0x7eb4('0x1b'),'value':'internal','ignore':![]}];var _0x2d36d8=_(_0xdf789)[_0x7eb4('0x1c')](_0x7eb4('0x1d'))[_0x7eb4('0x1e')](_0x7eb4('0x1f'))[_0x7eb4('0x1f')]();if(_['includes'](_0x2d36d8,_0x33966d[_0x7eb4('0x20')])){return;}var _0x15b997=_['find'](_0xdf789,[_0x7eb4('0x1f'),_0x33966d[_0x7eb4('0x20')]])[_0x7eb4('0x21')];return db[_0x7eb4('0x22')][_0x7eb4('0x15')]({'where':{'type':_0x15b997,'resourceId':_0x33966d['id']}})['then'](function(){return _0x27d74d;});})['then'](function(){_0x588564[_0x7eb4('0xd')](0xcc)['end']();});}};}function handleEntityNotFound(_0xe7da0b){return function(_0x251439){if(!_0x251439){_0xe7da0b[_0x7eb4('0xc')](0x194);}return _0x251439;};}function handleError(_0x5499c1,_0x19e8c3){_0x19e8c3=_0x19e8c3||0x1f4;return function(_0x4d18ec){logger['error'](_0x4d18ec[_0x7eb4('0x23')]);if(_0x4d18ec[_0x7eb4('0x21')]){delete _0x4d18ec['name'];}_0x5499c1[_0x7eb4('0xd')](_0x19e8c3)[_0x7eb4('0x24')](_0x4d18ec);};}exports[_0x7eb4('0x25')]=function(_0x263537,_0x221c47){var _0x4c8090={},_0x3668d5={},_0x407554={'count':0x0,'rows':[]};var _0x315f30=_[_0x7eb4('0x1e')](db[_0x7eb4('0x26')][_0x7eb4('0x27')],function(_0x3d2f2d){return{'name':_0x3d2f2d[_0x7eb4('0x28')],'type':_0x3d2f2d[_0x7eb4('0x20')][_0x7eb4('0x29')]};});_0x3668d5[_0x7eb4('0x2a')]=_['map'](_0x315f30,_0x7eb4('0x21'));_0x3668d5[_0x7eb4('0x2b')]=_[_0x7eb4('0x2c')](_0x263537[_0x7eb4('0x2b')]);_0x3668d5[_0x7eb4('0x2d')]=_[_0x7eb4('0x2e')](_0x3668d5[_0x7eb4('0x2a')],_0x3668d5[_0x7eb4('0x2b')]);_0x4c8090[_0x7eb4('0x2f')]=_['intersection'](_0x3668d5['model'],qs['fields'](_0x263537[_0x7eb4('0x2b')][_0x7eb4('0x30')]));_0x4c8090[_0x7eb4('0x2f')]=_0x4c8090[_0x7eb4('0x2f')][_0x7eb4('0x31')]?_0x4c8090['attributes']:_0x3668d5['model'];if(!_0x263537[_0x7eb4('0x2b')]['hasOwnProperty']('nolimit')){_0x4c8090[_0x7eb4('0x12')]=qs[_0x7eb4('0x12')](_0x263537[_0x7eb4('0x2b')][_0x7eb4('0x12')]);_0x4c8090[_0x7eb4('0x10')]=qs['offset'](_0x263537[_0x7eb4('0x2b')]['offset']);}_0x4c8090[_0x7eb4('0x32')]=qs[_0x7eb4('0x33')](_0x263537['query']['sort']);_0x4c8090[_0x7eb4('0x34')]=qs['filters'](_[_0x7eb4('0x35')](_0x263537[_0x7eb4('0x2b')],_0x3668d5[_0x7eb4('0x2d')]),_0x315f30);if(_0x263537[_0x7eb4('0x2b')]['filter']){_0x4c8090[_0x7eb4('0x34')]=_[_0x7eb4('0x36')](_0x4c8090[_0x7eb4('0x34')],{'$or':_[_0x7eb4('0x1e')](_0x315f30,function(_0x237c3f){if(_0x237c3f[_0x7eb4('0x20')]!==_0x7eb4('0x37')){var _0x1930e3={};_0x1930e3[_0x237c3f[_0x7eb4('0x21')]]={'$like':'%'+_0x263537[_0x7eb4('0x2b')][_0x7eb4('0x1c')]+'%'};return _0x1930e3;}})});}_0x4c8090=_['merge']({},_0x4c8090,_0x263537[_0x7eb4('0x38')]);var _0xee0a1e={'where':_0x4c8090['where']};return db[_0x7eb4('0x26')]['count'](_0xee0a1e)['then'](function(_0xd72fba){_0x407554['count']=_0xd72fba;if(_0x263537[_0x7eb4('0x2b')][_0x7eb4('0x39')]){_0x4c8090[_0x7eb4('0x3a')]=[{'all':!![]}];}return db['VoiceExtension'][_0x7eb4('0x3b')](_0x4c8090);})['then'](function(_0xd85742){_0x407554['rows']=_0xd85742;return _0x407554;})[_0x7eb4('0x16')](respondWithFilteredResult(_0x221c47,_0x4c8090))['catch'](handleError(_0x221c47,null));};exports[_0x7eb4('0x3c')]=function(_0x10943f,_0x109427){var _0x4df382={'raw':![],'where':{'id':_0x10943f['params']['id']}},_0x3745bf={};_0x3745bf['model']=_[_0x7eb4('0x2c')](db[_0x7eb4('0x26')][_0x7eb4('0x27')]);_0x3745bf[_0x7eb4('0x2b')]=_[_0x7eb4('0x2c')](_0x10943f[_0x7eb4('0x2b')]);_0x3745bf[_0x7eb4('0x2d')]=_[_0x7eb4('0x2e')](_0x3745bf[_0x7eb4('0x2a')],_0x3745bf[_0x7eb4('0x2b')]);_0x4df382[_0x7eb4('0x2f')]=_['intersection'](_0x3745bf[_0x7eb4('0x2a')],qs['fields'](_0x10943f[_0x7eb4('0x2b')]['fields']));_0x4df382[_0x7eb4('0x2f')]=_0x4df382[_0x7eb4('0x2f')][_0x7eb4('0x31')]?_0x4df382[_0x7eb4('0x2f')]:_0x3745bf[_0x7eb4('0x2a')];if(_0x10943f[_0x7eb4('0x2b')][_0x7eb4('0x39')]){_0x4df382[_0x7eb4('0x3a')]=[{'all':!![]}];}_0x4df382=_[_0x7eb4('0x36')]({},_0x4df382,_0x10943f['options']);return db[_0x7eb4('0x26')][_0x7eb4('0x3d')](_0x4df382)[_0x7eb4('0x16')](handleEntityNotFound(_0x109427,null))[_0x7eb4('0x16')](respondWithResult(_0x109427,null))[_0x7eb4('0x3e')](handleError(_0x109427,null));};exports[_0x7eb4('0x15')]=function(_0x38f8c9,_0x5054ad){return db[_0x7eb4('0x26')]['find']({'where':{'id':_0x38f8c9[_0x7eb4('0x3f')]['id']}})[_0x7eb4('0x16')](handleEntityNotFound(_0x5054ad,null))[_0x7eb4('0x16')](removeEntity(_0x5054ad,null))[_0x7eb4('0x3e')](handleError(_0x5054ad,null));};exports[_0x7eb4('0x40')]=function(_0x5a4553,_0x128570){if(_0x5a4553['body'][_0x7eb4('0x20')]===_0x7eb4('0x1a')&&!_[_0x7eb4('0x41')](_0x5a4553['body'][_0x7eb4('0x42')],'_')){_0x5a4553['body'][_0x7eb4('0x42')]='_'[_0x7eb4('0x43')](_0x5a4553[_0x7eb4('0x44')]['exten']);}return db[_0x7eb4('0x26')][_0x7eb4('0x40')](_0x5a4553[_0x7eb4('0x44')],{'raw':![]})[_0x7eb4('0x16')](function(_0x5224bb){var _0x5ba520=_0x5a4553[_0x7eb4('0x45')]['get']({'plain':!![]});if(!_0x5ba520)throw new Error(_0x7eb4('0x46'));if(_0x5ba520[_0x7eb4('0x47')]===_0x7eb4('0x45')){var _0x2d5100=_0x5224bb[_0x7eb4('0x17')]({'plain':!![]});var _0xf3642e=[{'name':_0x7eb4('0x18'),'value':'inbound'},{'name':_0x7eb4('0x19'),'value':_0x7eb4('0x1a')},{'name':_0x7eb4('0x1b'),'value':_0x7eb4('0x48')}];var _0x411ad4=_[_0x7eb4('0x3d')](_0xf3642e,[_0x7eb4('0x1f'),_0x2d5100['type']])[_0x7eb4('0x21')];return db['UserProfileSection']['find']({'where':{'name':_0x411ad4,'userProfileId':_0x5ba520[_0x7eb4('0x49')]},'raw':!![]})[_0x7eb4('0x16')](function(_0x552e7d){if(_0x552e7d&&_0x552e7d['autoAssociation']===0x0){return db[_0x7eb4('0x22')][_0x7eb4('0x40')]({'name':_0x2d5100[_0x7eb4('0x21')],'resourceId':_0x2d5100['id'],'type':_0x552e7d[_0x7eb4('0x21')],'sectionId':_0x552e7d['id']},{})['then'](function(){return _0x5224bb;});}else{return _0x5224bb;}})['catch'](function(_0x4075c6){logger[_0x7eb4('0x4a')](_0x7eb4('0x4b'),_0x4075c6);throw _0x4075c6;});}return _0x5224bb;})[_0x7eb4('0x16')](respondWithResult(_0x128570,0xc9))[_0x7eb4('0x3e')](handleError(_0x128570,null));};exports['update']=function(_0x1b6a81,_0x3ab9a2){if(_0x1b6a81[_0x7eb4('0x44')]['id']){delete _0x1b6a81[_0x7eb4('0x44')]['id'];}return db[_0x7eb4('0x26')]['find']({'where':{'id':_0x1b6a81[_0x7eb4('0x3f')]['id']}})['then'](handleEntityNotFound(_0x3ab9a2,null))[_0x7eb4('0x16')](function(_0x2b36da){if(_0x2b36da){return db[_0x7eb4('0x26')]['update'](_['pick'](_0x1b6a81[_0x7eb4('0x44')],['exten',_0x7eb4('0x4c'),'description',_0x7eb4('0x4d'),_0x7eb4('0x4e'),_0x7eb4('0x4f'),_0x7eb4('0x50')]),{'where':{'context':_0x2b36da['context'],'exten':_0x2b36da['exten']},'individualHooks':!![]})[_0x7eb4('0x16')](function(_0x5c391b){return _0x5c391b;});}return null;})[_0x7eb4('0x16')](respondWithStatusCode(_0x3ab9a2,null))[_0x7eb4('0x3e')](handleError(_0x3ab9a2,null));};exports[_0x7eb4('0x51')]=function(_0x414441,_0x29261){var _0xf9abf8=_0x414441[_0x7eb4('0x3f')]['id'];var _0x5f14ad=_0x414441[_0x7eb4('0x44')];var _0x1bc35c=0xc8;var _0x55842b=null;return db[_0x7eb4('0x52')][_0x7eb4('0x53')]({'isolationLevel':db[_0x7eb4('0x52')][_0x7eb4('0x54')][_0x7eb4('0x55')][_0x7eb4('0x56')]},function(_0x19e94e){return db['VoiceExtension'][_0x7eb4('0x57')]({'where':{'id':_0xf9abf8},'transaction':_0x19e94e})[_0x7eb4('0x16')](function(_0x24708c){if(_0x24708c){return db['VoiceExtension'][_0x7eb4('0x15')]({'where':{'VoiceExtensionId':_0xf9abf8},'transaction':_0x19e94e})['then'](function(){var _0x387f12=_[_0x7eb4('0x1e')](_0x5f14ad,function(_0x4ed2d3){_0x4ed2d3['VoiceExtensionId']=_0xf9abf8;_0x4ed2d3['isApp']=!![];return _0x4ed2d3;});return _0x24708c['createRouting'](_0x387f12);})[_0x7eb4('0x16')](function(_0xbe3755){return db[_0x7eb4('0x26')]['bulkCreate'](_0xbe3755,{'transaction':_0x19e94e});});}else{_0x1bc35c=0x194;_0x55842b=[];}});})[_0x7eb4('0x16')](function(){if(_0x1bc35c!==0x194){return db[_0x7eb4('0x26')][_0x7eb4('0x58')]({'where':{'isApp':!![],'VoiceExtensionId':_0xf9abf8},'order':_0x7eb4('0x59')})[_0x7eb4('0x16')](function(_0x9429d6){_0x55842b=_0x9429d6;});}})[_0x7eb4('0x3e')](function(_0x152771){_0x1bc35c=0x1f4;logger[_0x7eb4('0x4a')](_0x152771['stack']);if(_0x152771[_0x7eb4('0x21')]){delete _0x152771[_0x7eb4('0x21')];}_0x55842b=_0x152771;})[_0x7eb4('0x5a')](function(){if(_0x55842b===null){_0x29261['sendStatus'](_0x1bc35c);}else{if(_0x1bc35c===0x1f4){_0x29261['status'](_0x1bc35c)[_0x7eb4('0x24')](_0x55842b);}else{_0x29261[_0x7eb4('0xd')](_0x1bc35c)[_0x7eb4('0xf')](_0x55842b);}}});}; \ No newline at end of file +var _0xde04=['VIRTUAL','options','rows','params','keys','include','catch','create','body','outbound','startsWith','exten','concat','get','user','InboundRoutes','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','context','description','recordingFormat','mandatoryDisposition','alias','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','VoiceExtensionId','isApp','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','stack','finally','lodash','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','then','inbound','OutboundRoutes','InternalRoutes','internal','ignore','map','includes','type','find','value','destroy','end','error','name','send','VoiceExtension','rawAttributes','fieldName','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge'];(function(_0x40b3f2,_0x2c4f5f){var _0x4ce90c=function(_0x516f31){while(--_0x516f31){_0x40b3f2['push'](_0x40b3f2['shift']());}};_0x4ce90c(++_0x2c4f5f);}(_0xde04,0x81));var _0x4de0=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xde04[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x4de0('0x0'));var Redis=require(_0x4de0('0x1'));var qs=require(_0x4de0('0x2'));var logger=require('../../config/logger')(_0x4de0('0x3'));var config=require(_0x4de0('0x4'));var db=require(_0x4de0('0x5'))['db'];config[_0x4de0('0x6')]=_[_0x4de0('0x7')](config[_0x4de0('0x6')],{'host':_0x4de0('0x8'),'port':0x18eb});var socket=require(_0x4de0('0x9'))(new Redis(config[_0x4de0('0x6')]));require(_0x4de0('0xa'))[_0x4de0('0xb')](socket);function respondWithStatusCode(_0x11c676,_0x227d3c){_0x227d3c=_0x227d3c||0xcc;return function(_0x867cf4){if(_0x867cf4){return _0x11c676[_0x4de0('0xc')](_0x227d3c);}return _0x11c676['status'](_0x227d3c)['end']();};}function respondWithResult(_0xd97053,_0x4d4f54){_0x4d4f54=_0x4d4f54||0xc8;return function(_0x55d248){if(_0x55d248){return _0xd97053[_0x4de0('0xd')](_0x4d4f54)['json'](_0x55d248);}};}function respondWithFilteredResult(_0x906031,_0x39549b){return function(_0x49340a){if(_0x49340a){var _0x1a9980=typeof _0x39549b[_0x4de0('0xe')]===_0x4de0('0xf')&&typeof _0x39549b[_0x4de0('0x10')]===_0x4de0('0xf');var _0x5aa4ed=_0x49340a[_0x4de0('0x11')];var _0x4cd543=_0x1a9980?0x0:_0x39549b[_0x4de0('0xe')];var _0x12a740=_0x1a9980?_0x49340a[_0x4de0('0x11')]:_0x39549b[_0x4de0('0xe')]+_0x39549b['limit'];var _0x2cc33f;if(_0x12a740>=_0x5aa4ed){_0x12a740=_0x5aa4ed;_0x2cc33f=0xc8;}else{_0x2cc33f=0xce;}_0x906031[_0x4de0('0xd')](_0x2cc33f);return _0x906031[_0x4de0('0x12')](_0x4de0('0x13'),_0x4cd543+'-'+_0x12a740+'/'+_0x5aa4ed)[_0x4de0('0x14')](_0x49340a);}return null;};}function removeEntity(_0x24160b){return function(_0x16bade){if(_0x16bade){return _0x16bade['destroy']()[_0x4de0('0x15')](function(){var _0x16d207=_0x16bade['get']({'plain':!![]});var _0x2db47d=[{'name':'InboundRoutes','value':_0x4de0('0x16'),'ignore':![]},{'name':_0x4de0('0x17'),'value':'outbound','ignore':![]},{'name':_0x4de0('0x18'),'value':_0x4de0('0x19'),'ignore':![]}];var _0x456b9b=_(_0x2db47d)['filter'](_0x4de0('0x1a'))[_0x4de0('0x1b')]('value')['value']();if(_[_0x4de0('0x1c')](_0x456b9b,_0x16d207[_0x4de0('0x1d')])){return;}var _0x14f92c=_[_0x4de0('0x1e')](_0x2db47d,[_0x4de0('0x1f'),_0x16d207[_0x4de0('0x1d')]])['name'];return db['UserProfileResource'][_0x4de0('0x20')]({'where':{'type':_0x14f92c,'resourceId':_0x16d207['id']}})[_0x4de0('0x15')](function(){return _0x16bade;});})[_0x4de0('0x15')](function(){_0x24160b[_0x4de0('0xd')](0xcc)[_0x4de0('0x21')]();});}};}function handleEntityNotFound(_0x706672){return function(_0x4b4e91){if(!_0x4b4e91){_0x706672[_0x4de0('0xc')](0x194);}return _0x4b4e91;};}function handleError(_0x367118,_0x28212b){_0x28212b=_0x28212b||0x1f4;return function(_0x520972){logger[_0x4de0('0x22')](_0x520972['stack']);if(_0x520972[_0x4de0('0x23')]){delete _0x520972[_0x4de0('0x23')];}_0x367118[_0x4de0('0xd')](_0x28212b)[_0x4de0('0x24')](_0x520972);};}exports['index']=function(_0x256f45,_0x391134){var _0x17fc48={},_0x53f82d={},_0x2b911d={'count':0x0,'rows':[]};var _0x56a223=_[_0x4de0('0x1b')](db[_0x4de0('0x25')][_0x4de0('0x26')],function(_0xdcd3e4){return{'name':_0xdcd3e4[_0x4de0('0x27')],'type':_0xdcd3e4['type']['key']};});_0x53f82d['model']=_['map'](_0x56a223,_0x4de0('0x23'));_0x53f82d[_0x4de0('0x28')]=_['keys'](_0x256f45[_0x4de0('0x28')]);_0x53f82d[_0x4de0('0x29')]=_[_0x4de0('0x2a')](_0x53f82d[_0x4de0('0x2b')],_0x53f82d['query']);_0x17fc48[_0x4de0('0x2c')]=_[_0x4de0('0x2a')](_0x53f82d[_0x4de0('0x2b')],qs[_0x4de0('0x2d')](_0x256f45[_0x4de0('0x28')][_0x4de0('0x2d')]));_0x17fc48['attributes']=_0x17fc48[_0x4de0('0x2c')][_0x4de0('0x2e')]?_0x17fc48[_0x4de0('0x2c')]:_0x53f82d[_0x4de0('0x2b')];if(!_0x256f45[_0x4de0('0x28')][_0x4de0('0x2f')](_0x4de0('0x30'))){_0x17fc48['limit']=qs[_0x4de0('0x10')](_0x256f45['query'][_0x4de0('0x10')]);_0x17fc48[_0x4de0('0xe')]=qs[_0x4de0('0xe')](_0x256f45[_0x4de0('0x28')]['offset']);}_0x17fc48[_0x4de0('0x31')]=qs[_0x4de0('0x32')](_0x256f45[_0x4de0('0x28')][_0x4de0('0x32')]);_0x17fc48[_0x4de0('0x33')]=qs[_0x4de0('0x29')](_[_0x4de0('0x34')](_0x256f45['query'],_0x53f82d[_0x4de0('0x29')]),_0x56a223);if(_0x256f45['query'][_0x4de0('0x35')]){_0x17fc48[_0x4de0('0x33')]=_[_0x4de0('0x36')](_0x17fc48[_0x4de0('0x33')],{'$or':_['map'](_0x56a223,function(_0x137cb5){if(_0x137cb5['type']!==_0x4de0('0x37')){var _0x486e7c={};_0x486e7c[_0x137cb5[_0x4de0('0x23')]]={'$like':'%'+_0x256f45[_0x4de0('0x28')][_0x4de0('0x35')]+'%'};return _0x486e7c;}})});}_0x17fc48=_[_0x4de0('0x36')]({},_0x17fc48,_0x256f45[_0x4de0('0x38')]);var _0x295493={'where':_0x17fc48['where']};return db[_0x4de0('0x25')]['count'](_0x295493)[_0x4de0('0x15')](function(_0x354fc2){_0x2b911d[_0x4de0('0x11')]=_0x354fc2;if(_0x256f45['query']['includeAll']){_0x17fc48['include']=[{'all':!![]}];}return db['VoiceExtension']['findAll'](_0x17fc48);})[_0x4de0('0x15')](function(_0xa6d4b3){_0x2b911d[_0x4de0('0x39')]=_0xa6d4b3;return _0x2b911d;})[_0x4de0('0x15')](respondWithFilteredResult(_0x391134,_0x17fc48))['catch'](handleError(_0x391134,null));};exports['show']=function(_0x33c1d1,_0x48e66e){var _0x199927={'raw':![],'where':{'id':_0x33c1d1[_0x4de0('0x3a')]['id']}},_0x115a8b={};_0x115a8b['model']=_[_0x4de0('0x3b')](db[_0x4de0('0x25')][_0x4de0('0x26')]);_0x115a8b['query']=_[_0x4de0('0x3b')](_0x33c1d1[_0x4de0('0x28')]);_0x115a8b[_0x4de0('0x29')]=_['intersection'](_0x115a8b[_0x4de0('0x2b')],_0x115a8b[_0x4de0('0x28')]);_0x199927[_0x4de0('0x2c')]=_[_0x4de0('0x2a')](_0x115a8b[_0x4de0('0x2b')],qs[_0x4de0('0x2d')](_0x33c1d1[_0x4de0('0x28')]['fields']));_0x199927[_0x4de0('0x2c')]=_0x199927['attributes']['length']?_0x199927[_0x4de0('0x2c')]:_0x115a8b['model'];if(_0x33c1d1[_0x4de0('0x28')]['includeAll']){_0x199927[_0x4de0('0x3c')]=[{'all':!![]}];}_0x199927=_[_0x4de0('0x36')]({},_0x199927,_0x33c1d1['options']);return db[_0x4de0('0x25')][_0x4de0('0x1e')](_0x199927)[_0x4de0('0x15')](handleEntityNotFound(_0x48e66e,null))[_0x4de0('0x15')](respondWithResult(_0x48e66e,null))[_0x4de0('0x3d')](handleError(_0x48e66e,null));};exports[_0x4de0('0x20')]=function(_0x523ad5,_0x2e6124){return db[_0x4de0('0x25')][_0x4de0('0x1e')]({'where':{'id':_0x523ad5['params']['id']}})[_0x4de0('0x15')](handleEntityNotFound(_0x2e6124,null))['then'](removeEntity(_0x2e6124,null))['catch'](handleError(_0x2e6124,null));};exports[_0x4de0('0x3e')]=function(_0x28574c,_0x5a4aee){if(_0x28574c[_0x4de0('0x3f')][_0x4de0('0x1d')]===_0x4de0('0x40')&&!_[_0x4de0('0x41')](_0x28574c[_0x4de0('0x3f')][_0x4de0('0x42')],'_')){_0x28574c[_0x4de0('0x3f')]['exten']='_'[_0x4de0('0x43')](_0x28574c[_0x4de0('0x3f')][_0x4de0('0x42')]);}return db[_0x4de0('0x25')]['create'](_0x28574c[_0x4de0('0x3f')],{'raw':![]})[_0x4de0('0x15')](function(_0x52cd3){var _0xe4ee1=_0x28574c['user'][_0x4de0('0x44')]({'plain':!![]});if(!_0xe4ee1)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xe4ee1['role']===_0x4de0('0x45')){var _0x32708d=_0x52cd3[_0x4de0('0x44')]({'plain':!![]});var _0x1c9fec=[{'name':_0x4de0('0x46'),'value':_0x4de0('0x16')},{'name':'OutboundRoutes','value':_0x4de0('0x40')},{'name':_0x4de0('0x18'),'value':_0x4de0('0x19')}];var _0x40aeeb=_[_0x4de0('0x1e')](_0x1c9fec,['value',_0x32708d[_0x4de0('0x1d')]])[_0x4de0('0x23')];return db[_0x4de0('0x47')][_0x4de0('0x1e')]({'where':{'name':_0x40aeeb,'userProfileId':_0xe4ee1[_0x4de0('0x48')]},'raw':!![]})[_0x4de0('0x15')](function(_0x2d3686){if(_0x2d3686&&_0x2d3686['autoAssociation']===0x0){return db[_0x4de0('0x49')][_0x4de0('0x3e')]({'name':_0x32708d['name'],'resourceId':_0x32708d['id'],'type':_0x2d3686[_0x4de0('0x23')],'sectionId':_0x2d3686['id']},{})[_0x4de0('0x15')](function(){return _0x52cd3;});}else{return _0x52cd3;}})['catch'](function(_0x21c4da){logger[_0x4de0('0x22')](_0x4de0('0x4a'),_0x21c4da);throw _0x21c4da;});}return _0x52cd3;})[_0x4de0('0x15')](respondWithResult(_0x5a4aee,0xc9))['catch'](handleError(_0x5a4aee,null));};exports[_0x4de0('0x4b')]=function(_0x4b8d5d,_0x2371b7){if(_0x4b8d5d['body']['id']){delete _0x4b8d5d[_0x4de0('0x3f')]['id'];}return db[_0x4de0('0x25')][_0x4de0('0x1e')]({'where':{'id':_0x4b8d5d[_0x4de0('0x3a')]['id']}})[_0x4de0('0x15')](handleEntityNotFound(_0x2371b7,null))[_0x4de0('0x15')](function(_0x4b0ac5){if(_0x4b0ac5){return db[_0x4de0('0x25')]['update'](_['pick'](_0x4b8d5d[_0x4de0('0x3f')],['exten',_0x4de0('0x4c'),_0x4de0('0x4d'),_0x4de0('0x4e'),'cutdigits',_0x4de0('0x4f'),_0x4de0('0x50')]),{'where':{'context':_0x4b0ac5[_0x4de0('0x4c')],'exten':_0x4b0ac5[_0x4de0('0x42')]},'individualHooks':!![]})['then'](function(_0x19b45f){return _0x19b45f;});}return null;})[_0x4de0('0x15')](respondWithStatusCode(_0x2371b7,null))[_0x4de0('0x3d')](handleError(_0x2371b7,null));};exports['addApplications']=function(_0x59e604,_0x59d8ca){var _0x56f999=_0x59e604[_0x4de0('0x3a')]['id'];var _0x2e3024=_0x59e604[_0x4de0('0x3f')];var _0x222022=0xc8;var _0x2e1f31=null;return db[_0x4de0('0x51')]['transaction']({'isolationLevel':db[_0x4de0('0x51')][_0x4de0('0x52')][_0x4de0('0x53')][_0x4de0('0x54')]},function(_0x4fd020){return db['VoiceExtension']['findOne']({'where':{'id':_0x56f999},'transaction':_0x4fd020})[_0x4de0('0x15')](function(_0x5af728){if(_0x5af728){return db[_0x4de0('0x25')]['destroy']({'where':{'VoiceExtensionId':_0x56f999},'transaction':_0x4fd020})['then'](function(){var _0xd180a1=_['map'](_0x2e3024,function(_0x3a47ed){_0x3a47ed[_0x4de0('0x55')]=_0x56f999;_0x3a47ed[_0x4de0('0x56')]=!![];return _0x3a47ed;});return _0x5af728['createRouting'](_0xd180a1);})[_0x4de0('0x15')](function(_0x466f18){return db['VoiceExtension'][_0x4de0('0x57')](_0x466f18,{'transaction':_0x4fd020});});}else{_0x222022=0x194;_0x2e1f31=[];}});})[_0x4de0('0x15')](function(){if(_0x222022!==0x194){return db[_0x4de0('0x25')][_0x4de0('0x58')]({'where':{'isApp':!![],'VoiceExtensionId':_0x56f999},'order':_0x4de0('0x59')})[_0x4de0('0x15')](function(_0x1516d1){_0x2e1f31=_0x1516d1;});}})[_0x4de0('0x3d')](function(_0x47580c){_0x222022=0x1f4;logger['error'](_0x47580c[_0x4de0('0x5a')]);if(_0x47580c[_0x4de0('0x23')]){delete _0x47580c['name'];}_0x2e1f31=_0x47580c;})[_0x4de0('0x5b')](function(){if(_0x2e1f31===null){_0x59d8ca[_0x4de0('0xc')](_0x222022);}else{if(_0x222022===0x1f4){_0x59d8ca[_0x4de0('0xd')](_0x222022)[_0x4de0('0x24')](_0x2e1f31);}else{_0x59d8ca[_0x4de0('0xd')](_0x222022)['json'](_0x2e1f31);}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index 1f00ab3..13198d9 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 _0xecbc=['hasOwnProperty','hook','exports','events','../../mysqldb','VoiceExtension','setMaxListeners','emit'];(function(_0x2d1630,_0x11df96){var _0x27fe89=function(_0x199ea3){while(--_0x199ea3){_0x2d1630['push'](_0x2d1630['shift']());}};_0x27fe89(++_0x11df96);}(_0xecbc,0xa3));var _0xcecb=function(_0x2112d4,_0x3c863c){_0x2112d4=_0x2112d4-0x0;var _0x434972=_0xecbc[_0x2112d4];return _0x434972;};'use strict';var EventEmitter=require(_0xcecb('0x0'));var VoiceExtension=require(_0xcecb('0x1'))['db'][_0xcecb('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0xcecb('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x4922da){return function(_0x2fe5d1,_0x3b8362,_0x47cb36){VoiceExtensionEvents[_0xcecb('0x4')](_0x4922da+':'+_0x2fe5d1['id'],_0x2fe5d1);VoiceExtensionEvents[_0xcecb('0x4')](_0x4922da,_0x2fe5d1);_0x47cb36(null);};}for(var e in events){if(events[_0xcecb('0x5')](e)){var event=events[e];VoiceExtension[_0xcecb('0x6')](e,emitEvent(event));}}module[_0xcecb('0x7')]=VoiceExtensionEvents; \ No newline at end of file +var _0xc494=['save','remove','emit','hasOwnProperty','hook','../../mysqldb','VoiceExtension','setMaxListeners'];(function(_0x781f40,_0x4cec48){var _0x5eaa4f=function(_0xf31bfc){while(--_0xf31bfc){_0x781f40['push'](_0x781f40['shift']());}};_0x5eaa4f(++_0x4cec48);}(_0xc494,0x6d));var _0x4c49=function(_0x376db5,_0x2b8874){_0x376db5=_0x376db5-0x0;var _0x304c17=_0xc494[_0x376db5];return _0x304c17;};'use strict';var EventEmitter=require('events');var VoiceExtension=require(_0x4c49('0x0'))['db'][_0x4c49('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x4c49('0x2')](0x0);var events={'afterCreate':_0x4c49('0x3'),'afterUpdate':'update','afterDestroy':_0x4c49('0x4')};function emitEvent(_0x590f0e){return function(_0x5ef810,_0x7694ed,_0x2fc89f){VoiceExtensionEvents[_0x4c49('0x5')](_0x590f0e+':'+_0x5ef810['id'],_0x5ef810);VoiceExtensionEvents[_0x4c49('0x5')](_0x590f0e,_0x5ef810);_0x2fc89f(null);};}for(var e in events){if(events[_0x4c49('0x6')](e)){var event=events[e];VoiceExtension[_0x4c49('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 e7eab53..de09e4f 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 _0xb2fa=['Set','CDR(type)=','context','exten','push','inbound','CDR(routeid)=','XCALLY-MOTION-ANSWER=0','outbound','CDR(type)=outbound','${EXTEN:','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','hasOwnProperty','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','timeout','options','url','split','name','trunk','param','phone','prefix','cutdigits','${EXTEN}','join','none','indexOf','U(xcally-mixmonitor-context)','isEmpty','Interval','findAll','then','length','interval','*,*,*,*','intervals','IntervalId','filter','toLowerCase','tag','CDR(tag)=','callerID','NoOp(No\x20number\x20available)','answer','queue','playback','includes','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','outboundDial','appdata','agi','XMCS-UNIQUEID=${CHANNEL(LINKEDID)}','priority','last','catch','define','VoiceExtension','get','concat','lodash','./voiceExtension.attributes','exports','models','type'];(function(_0x68c979,_0x431cff){var _0x4f0001=function(_0xa7595d){while(--_0xa7595d){_0x68c979['push'](_0x68c979['shift']());}};_0x4f0001(++_0x431cff);}(_0xb2fa,0x13b));var _0xab2f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xb2fa[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xab2f('0x0'));var attributes=require(_0xab2f('0x1'));module[_0xab2f('0x2')]=function(_0x12a684){var _0x2d261f=_0x12a684[_0xab2f('0x3')];function _0x414ab1(_0x4c9dc3){var _0x194fd9=0x2;var _0x42e28f=[{'type':_0x4c9dc3[_0xab2f('0x4')],'app':_0xab2f('0x5'),'appdata':_0xab2f('0x6')+_0x4c9dc3[_0xab2f('0x4')],'context':_0x4c9dc3[_0xab2f('0x7')],'exten':_0x4c9dc3[_0xab2f('0x8')],'priority':_0x194fd9++,'VoiceExtensionId':_0x4c9dc3['id']}];if(_0x4c9dc3[_0xab2f('0x4')]==='inbound'){_0x42e28f[_0xab2f('0x9')]({'type':_0xab2f('0xa'),'app':'Set','appdata':_0xab2f('0xb')+_0x4c9dc3['id'],'context':_0x4c9dc3[_0xab2f('0x7')],'exten':_0x4c9dc3[_0xab2f('0x8')],'priority':_0x194fd9++,'VoiceExtensionId':_0x4c9dc3['id']});}_0x42e28f[_0xab2f('0x9')]({'type':_0x4c9dc3[_0xab2f('0x4')],'app':_0xab2f('0x5'),'appdata':_0xab2f('0xc'),'context':_0x4c9dc3[_0xab2f('0x7')],'exten':_0x4c9dc3['exten'],'priority':_0x194fd9++,'VoiceExtensionId':_0x4c9dc3['id']},{'type':_0x4c9dc3[_0xab2f('0x4')],'app':'Set','appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x4c9dc3[_0xab2f('0x7')],'exten':_0x4c9dc3['exten'],'priority':_0x194fd9++,'VoiceExtensionId':_0x4c9dc3['id']},{'type':_0x4c9dc3[_0xab2f('0x4')],'app':_0xab2f('0x5'),'appdata':'MONITOR_OPTIONS=ab','context':_0x4c9dc3[_0xab2f('0x7')],'exten':_0x4c9dc3[_0xab2f('0x8')],'priority':_0x194fd9++,'VoiceExtensionId':_0x4c9dc3['id']});return _0x42e28f;}function _0x4c182b(_0x4cd060){var _0x4967d5=0x2;var _0x20cc3c=[{'type':_0xab2f('0xd'),'app':_0xab2f('0x5'),'appdata':_0xab2f('0xe'),'context':_0x4cd060[_0xab2f('0x7')],'exten':_0x4cd060[_0xab2f('0x8')],'priority':_0x4967d5++,'VoiceExtensionId':_0x4cd060['id']},{'type':_0xab2f('0xd'),'app':_0xab2f('0x5'),'appdata':'CDR(destination)='+(_0x4cd060['cutdigits']?_0xab2f('0xf')+_0x4cd060['cutdigits']+'}':'${EXTEN}'),'context':_0x4cd060['context'],'exten':_0x4cd060[_0xab2f('0x8')],'priority':_0x4967d5++,'VoiceExtensionId':_0x4cd060['id']},{'type':'outbound','app':_0xab2f('0x5'),'appdata':'CDR(routeid)='+_0x4cd060['id'],'context':_0x4cd060[_0xab2f('0x7')],'exten':_0x4cd060[_0xab2f('0x8')],'priority':_0x4967d5++,'VoiceExtensionId':_0x4cd060['id']},{'type':'outbound','app':_0xab2f('0x10'),'appdata':_0xab2f('0x11')+(_0x4967d5+0x2)+'):Goto('+(_0x4967d5+0x1)+')','context':_0x4cd060[_0xab2f('0x7')],'exten':_0x4cd060[_0xab2f('0x8')],'priority':_0x4967d5++,'VoiceExtensionId':_0x4cd060['id']},{'type':'outbound','app':_0xab2f('0x5'),'appdata':_0x4cd060['cutdigits']?_0xab2f('0x12')+_0x4cd060['cutdigits']+'}':_0xab2f('0x13'),'context':_0x4cd060['context'],'exten':_0x4cd060[_0xab2f('0x8')],'priority':_0x4967d5++,'VoiceExtensionId':_0x4cd060['id']},{'type':'outbound','app':_0xab2f('0x5'),'appdata':_0xab2f('0xc'),'context':_0x4cd060['context'],'exten':_0x4cd060[_0xab2f('0x8')],'priority':_0x4967d5++,'VoiceExtensionId':_0x4cd060['id']},{'type':'outbound','app':_0xab2f('0x5'),'appdata':_0xab2f('0x14'),'context':_0x4cd060[_0xab2f('0x7')],'exten':_0x4cd060[_0xab2f('0x8')],'priority':_0x4967d5++,'VoiceExtensionId':_0x4cd060['id']},{'type':_0xab2f('0xd'),'app':_0xab2f('0x5'),'appdata':_0xab2f('0x15'),'context':_0x4cd060[_0xab2f('0x7')],'exten':_0x4cd060['exten'],'priority':_0x4967d5++,'VoiceExtensionId':_0x4cd060['id']},{'type':_0xab2f('0xd'),'app':_0xab2f('0x5'),'appdata':'outboundrouteid='+_0x4cd060['id'],'context':_0x4cd060['context'],'exten':_0x4cd060[_0xab2f('0x8')],'priority':_0x4967d5++,'VoiceExtensionId':_0x4cd060['id']}];if(_0x4cd060[_0xab2f('0x16')](_0xab2f('0x17'))&&_0x4cd060[_0xab2f('0x17')]!=='none'){_0x20cc3c[_0xab2f('0x9')]({'type':_0xab2f('0xd'),'app':'Set','appdata':_0xab2f('0x18'),'context':_0x4cd060['context'],'exten':_0x4cd060[_0xab2f('0x8')],'priority':_0x4967d5++,'VoiceExtensionId':_0x4cd060['id']},{'type':_0xab2f('0xd'),'app':'Set','appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x4cd060[_0xab2f('0x17')]||'wav','context':_0x4cd060[_0xab2f('0x7')],'exten':_0x4cd060['exten'],'priority':_0x4967d5++,'VoiceExtensionId':_0x4cd060['id']});}return _0x20cc3c;}function _0x2ab520(_0x9108a1,_0x4d5a98){var _0x411b50=[{'name':'trunk','param':0x0},{'name':_0xab2f('0x19'),'param':0x1},{'name':_0xab2f('0x1a'),'param':0x2},{'name':_0xab2f('0x1b'),'param':0x3}];var _0x18d000={};var _0x98b654=_0x4d5a98[_0xab2f('0x1c')](',');var _0x2ad2a8=[];for(var _0x46078a=0x0;_0x46078a<_0x411b50['length'];_0x46078a++){switch(_0x411b50[_0x46078a][_0xab2f('0x1d')]){case _0xab2f('0x1e'):_0x18d000[_0xab2f('0x1e')]=_0x98b654[_0x411b50[_0x46078a][_0xab2f('0x1f')]][_0xab2f('0x1c')]('/')[0x1];_0x18d000[_0xab2f('0x20')]=_0x98b654[_0x411b50[_0x46078a][_0xab2f('0x1f')]][_0xab2f('0x1c')]('/')[0x2];_0x18d000[_0xab2f('0x21')]=_0x18d000[_0xab2f('0x20')]?_0x18d000['phone'][_0xab2f('0x1c')]('$')[0x0]:undefined;_0x18d000[_0xab2f('0x20')]=_0x9108a1[_0xab2f('0x22')]?(_0x18d000[_0xab2f('0x21')]||'')+'${EXTEN:'+_0x9108a1['cutdigits']+'}':(_0x18d000['prefix']||'')+_0xab2f('0x23');_0x2ad2a8[_0x411b50[_0x46078a][_0xab2f('0x1f')]]=['SIP',_0x18d000[_0xab2f('0x1e')],_0x18d000[_0xab2f('0x20')]][_0xab2f('0x24')]('/');break;case _0xab2f('0x1a'):_0x18d000['options']=_0x98b654[_0x411b50[_0x46078a][_0xab2f('0x1f')]];if(_0x9108a1[_0xab2f('0x17')]!==_0xab2f('0x25')){if(_0x18d000[_0xab2f('0x1a')][_0xab2f('0x26')]('U(xcally-mixmonitor-context)')<0x0){_0x18d000[_0xab2f('0x1a')]+=_0xab2f('0x27');}}else{_0x18d000['options']=_0x18d000[_0xab2f('0x1a')]['replace'](_0xab2f('0x27'),'');}_0x2ad2a8[_0x411b50[_0x46078a][_0xab2f('0x1f')]]=_0x18d000[_0xab2f('0x1a')];break;default:_0x2ad2a8[_0x411b50[_0x46078a]['param']]=_0x98b654[_0x411b50[_0x46078a]['param']];}}return _0x2ad2a8[_0xab2f('0x24')](',');}function _0x3ab727(_0x5a18da,_0x4f8fe3,_0x1a7475){return new Promise(function(_0x1269dd,_0x3fc725){var _0x4ce5dc=[];if(_[_0xab2f('0x28')](_0x4f8fe3))return _0x1269dd(_0x4ce5dc);_0x2d261f[_0xab2f('0x29')][_0xab2f('0x2a')]({'attributes':['id','interval','IntervalId'],'raw':!![]})[_0xab2f('0x2b')](function(_0x284b6b){for(var _0x1a5e41=0x0,_0x4eb738=0x0;_0x1a5e41<_0x4f8fe3[_0xab2f('0x2c')];_0x1a5e41++,_0x4eb738=0x0){var _0x1e66b3=_0x4f8fe3[_0x1a5e41];var _0x4df3cd=[];var _0xf1462c=[];delete _0x1e66b3['id'];if(_0x1e66b3[_0xab2f('0x2d')]!==_0xab2f('0x2e')){_0x1e66b3[_0xab2f('0x2f')]=[_0x1e66b3['interval']];}else{_0x1e66b3['intervals']=_0x1e66b3[_0xab2f('0x30')]?_['map'](_[_0xab2f('0x31')](_0x284b6b,{'IntervalId':_0x1e66b3['IntervalId']}),_0xab2f('0x2d')):[];}_0x1e66b3[_0xab2f('0x7')]=_0x5a18da[_0xab2f('0x7')];_0x1e66b3[_0xab2f('0x8')]=_0x5a18da['exten'];if(_0x1e66b3[_0xab2f('0x4')])_0x1e66b3[_0xab2f('0x4')]=_0x1e66b3['type'][_0xab2f('0x32')]();if(_0x5a18da[_0xab2f('0x4')]==='outbound'){if(_0x1e66b3[_0xab2f('0x16')](_0xab2f('0x33'))&&_0x1e66b3[_0xab2f('0x33')]&&_0x1e66b3['tag']!=='--'){_0x4df3cd[_0xab2f('0x9')]({'type':_0x1e66b3[_0xab2f('0x4')][_0xab2f('0x32')](),'app':_0xab2f('0x5'),'appdata':_0xab2f('0x34')+_0x1e66b3[_0xab2f('0x33')],'context':_0x5a18da[_0xab2f('0x7')],'exten':_0x5a18da[_0xab2f('0x8')],'priority':_0x1e66b3[_0xab2f('0x2f')]['length']+_0x1a7475+_0x4eb738++,'VoiceExtensionId':_0x5a18da['id']});}_0x4df3cd[_0xab2f('0x9')]({'type':_0x1e66b3[_0xab2f('0x4')]['toLowerCase'](),'app':_0xab2f('0x10'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):'+(_0x1e66b3[_0xab2f('0x35')]?'Set(CALLERID(all)='+_0x1e66b3['callerID']+')':_0xab2f('0x36')),'context':_0x5a18da[_0xab2f('0x7')],'exten':_0x5a18da['exten'],'priority':_0x1e66b3[_0xab2f('0x2f')][_0xab2f('0x2c')]+_0x1a7475+_0x4eb738++,'VoiceExtensionId':_0x5a18da['id']});}else{if(_0x1e66b3[_0xab2f('0x16')](_0xab2f('0x37'))){if([_0xab2f('0x38'),_0xab2f('0x39')][_0xab2f('0x3a')](_0x1e66b3[_0xab2f('0x3b')][_0xab2f('0x32')]())&&_0x1e66b3[_0xab2f('0x3c')]!==_0xab2f('0x3d')){if(_0x1e66b3[_0xab2f('0x37')]){_0x4df3cd[_0xab2f('0x9')]({'type':_0x1e66b3[_0xab2f('0x4')]['toLowerCase'](),'app':_0xab2f('0x10'),'appdata':_0xab2f('0x3e'),'context':_0x5a18da['context'],'exten':_0x5a18da[_0xab2f('0x8')],'priority':_0x1e66b3[_0xab2f('0x2f')][_0xab2f('0x2c')]+_0x1a7475+_0x4eb738++,'VoiceExtensionId':_0x5a18da['id']});_0x4df3cd['push']({'type':_0x1e66b3[_0xab2f('0x4')][_0xab2f('0x32')](),'app':'Set','appdata':_0xab2f('0x3f'),'context':_0x5a18da[_0xab2f('0x7')],'exten':_0x5a18da['exten'],'priority':_0x1e66b3[_0xab2f('0x2f')]['length']+_0x1a7475+_0x4eb738++,'VoiceExtensionId':_0x5a18da['id']});}else{_0x4df3cd[_0xab2f('0x9')]({'type':_0x1e66b3[_0xab2f('0x4')][_0xab2f('0x32')](),'app':_0xab2f('0x10'),'appdata':_0xab2f('0x40'),'context':_0x5a18da[_0xab2f('0x7')],'exten':_0x5a18da['exten'],'priority':_0x1e66b3['intervals']['length']+_0x1a7475+_0x4eb738++,'VoiceExtensionId':_0x5a18da['id']});_0x4df3cd[_0xab2f('0x9')]({'type':_0x1e66b3[_0xab2f('0x4')][_0xab2f('0x32')](),'app':'Set','appdata':_0xab2f('0x41'),'context':_0x5a18da[_0xab2f('0x7')],'exten':_0x5a18da[_0xab2f('0x8')],'priority':_0x1e66b3['intervals']['length']+_0x1a7475+_0x4eb738++,'VoiceExtensionId':_0x5a18da['id']});}}}}for(var _0x3d56fe=0x0;_0x3d56fe<_0x1e66b3[_0xab2f('0x2f')]['length'];_0x3d56fe++){var _0x462a2b=_0x1a7475+_0x1e66b3[_0xab2f('0x2f')][_0xab2f('0x2c')];var _0x1a0c58=_0x3d56fe===_0x1e66b3[_0xab2f('0x2f')][_0xab2f('0x2c')]-0x1?_0x1a7475+_0x4df3cd['length']+_0xf1462c[_0xab2f('0x2c')]+0x2:_0x1a7475+_0x3d56fe+0x1;_0x4df3cd[_0xab2f('0x42')](_0x3d56fe,0x0,{'type':_0x5a18da[_0xab2f('0x4')],'app':_0xab2f('0x43'),'appdata':_0x1e66b3[_0xab2f('0x2f')][_0x3d56fe]+'?'+_0x5a18da[_0xab2f('0x7')]+',${EXTEN},'+_0x462a2b+':'+_0x5a18da[_0xab2f('0x7')]+_0xab2f('0x44')+_0x1a0c58,'exten':_0x5a18da[_0xab2f('0x8')],'context':_0x5a18da[_0xab2f('0x7')],'priority':_0x1a7475+_0x3d56fe,'VoiceExtensionId':_0x5a18da['id']});}if(_0x1e66b3[_0xab2f('0x3c')]===_0xab2f('0x45')){_0x1e66b3[_0xab2f('0x46')]=_0x2ab520(_0x5a18da,_0x1e66b3[_0xab2f('0x46')]);}if(_0x1e66b3[_0xab2f('0x3c')]===_0xab2f('0x47')){_0x4df3cd[_0xab2f('0x9')]({'type':_0x1e66b3['type']['toLowerCase'](),'app':_0xab2f('0x5'),'appdata':_0xab2f('0x48'),'context':_0x5a18da[_0xab2f('0x7')],'exten':_0x5a18da['exten'],'priority':_0x1e66b3[_0xab2f('0x2f')][_0xab2f('0x2c')]+_0x1a7475+_0x4eb738++,'VoiceExtensionId':_0x5a18da['id']});}_0x1e66b3[_0xab2f('0x49')]=_0x4df3cd['length']?_[_0xab2f('0x4a')](_0x4df3cd)['priority']+0x1:_0x1a7475;_0x4ce5dc=_['concat'](_0x4ce5dc,_0x4df3cd,[_0x1e66b3],_0xf1462c);_0x1a7475=_[_0xab2f('0x4a')](_0x4ce5dc)[_0xab2f('0x49')]+0x1;}return _0x1269dd(_0x4ce5dc);})[_0xab2f('0x4b')](function(_0x599526){_0x3fc725(_0x599526);});});}return _0x12a684[_0xab2f('0x4c')](_0xab2f('0x4d'),attributes,{'tableName':'voice_extensions','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x1090f1){var _0x33890d=this[_0xab2f('0x4e')]({'plain':!![]});var _0x2895c9=_0x33890d[_0xab2f('0x4')]===_0xab2f('0xd')?_0x4c182b(_0x33890d):_0x414ab1(_0x33890d);return _0x3ab727(_0x33890d,_0x1090f1,_[_0xab2f('0x4a')](_0x2895c9)['priority']+0x1)[_0xab2f('0x2b')](function(_0x8926f5){var _0x43a77d=_[_0xab2f('0x4f')](_0x2895c9,_0x8926f5);_0x43a77d[_0xab2f('0x9')]({'type':_0x33890d['type'],'app':'Hangup','exten':_0x33890d[_0xab2f('0x8')],'context':_0x33890d[_0xab2f('0x7')],'priority':_[_0xab2f('0x4a')](_0x43a77d)[_0xab2f('0x49')]+0x1,'VoiceExtensionId':_0x33890d['id']});return _0x43a77d;});}}});}; \ No newline at end of file +var _0xa7d5=['findAll','interval','IntervalId','then','length','*,*,*,*','intervals','map','filter','toLowerCase','tag','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','Set(CALLERID(all)=','hasOwnProperty','answer','queue','includes','app','appType','custom','ExecIf','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice',',${EXTEN},','outboundDial','appdata','agi','XMCS-UNIQUEID=${CHANNEL(LINKEDID)}','priority','concat','last','catch','define','VoiceExtension','Hangup','./voiceExtension.attributes','models','type','CDR(type)=','context','exten','inbound','Set','CDR(routeid)=','push','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','outbound','CDR(type)=outbound','cutdigits','${EXTEN}','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','MONITOR_OPTIONS=ab','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','timeout','options','url','split','name','trunk','phone','param','prefix','${EXTEN:','SIP','join','indexOf','U(xcally-mixmonitor-context)','replace','isEmpty','Interval'];(function(_0x3d3bf9,_0x4f64b9){var _0x1b3b6d=function(_0x305d20){while(--_0x305d20){_0x3d3bf9['push'](_0x3d3bf9['shift']());}};_0x1b3b6d(++_0x4f64b9);}(_0xa7d5,0x76));var _0x5a7d=function(_0x2b4fe4,_0x54a53a){_0x2b4fe4=_0x2b4fe4-0x0;var _0x523048=_0xa7d5[_0x2b4fe4];return _0x523048;};'use strict';var _=require('lodash');var attributes=require(_0x5a7d('0x0'));module['exports']=function(_0x35276b){var _0x33c920=_0x35276b[_0x5a7d('0x1')];function _0x498f5a(_0x2eae0c){var _0xaf8d7d=0x2;var _0x2cc364=[{'type':_0x2eae0c[_0x5a7d('0x2')],'app':'Set','appdata':_0x5a7d('0x3')+_0x2eae0c[_0x5a7d('0x2')],'context':_0x2eae0c[_0x5a7d('0x4')],'exten':_0x2eae0c[_0x5a7d('0x5')],'priority':_0xaf8d7d++,'VoiceExtensionId':_0x2eae0c['id']}];if(_0x2eae0c[_0x5a7d('0x2')]==='inbound'){_0x2cc364['push']({'type':_0x5a7d('0x6'),'app':_0x5a7d('0x7'),'appdata':_0x5a7d('0x8')+_0x2eae0c['id'],'context':_0x2eae0c[_0x5a7d('0x4')],'exten':_0x2eae0c[_0x5a7d('0x5')],'priority':_0xaf8d7d++,'VoiceExtensionId':_0x2eae0c['id']});}_0x2cc364[_0x5a7d('0x9')]({'type':_0x2eae0c[_0x5a7d('0x2')],'app':'Set','appdata':_0x5a7d('0xa'),'context':_0x2eae0c[_0x5a7d('0x4')],'exten':_0x2eae0c[_0x5a7d('0x5')],'priority':_0xaf8d7d++,'VoiceExtensionId':_0x2eae0c['id']},{'type':_0x2eae0c[_0x5a7d('0x2')],'app':_0x5a7d('0x7'),'appdata':_0x5a7d('0xb'),'context':_0x2eae0c[_0x5a7d('0x4')],'exten':_0x2eae0c[_0x5a7d('0x5')],'priority':_0xaf8d7d++,'VoiceExtensionId':_0x2eae0c['id']},{'type':_0x2eae0c['type'],'app':_0x5a7d('0x7'),'appdata':'MONITOR_OPTIONS=ab','context':_0x2eae0c[_0x5a7d('0x4')],'exten':_0x2eae0c['exten'],'priority':_0xaf8d7d++,'VoiceExtensionId':_0x2eae0c['id']});return _0x2cc364;}function _0x20d324(_0x47bc1b){var _0x584b80=0x2;var _0x4decb2=[{'type':_0x5a7d('0xc'),'app':'Set','appdata':_0x5a7d('0xd'),'context':_0x47bc1b[_0x5a7d('0x4')],'exten':_0x47bc1b[_0x5a7d('0x5')],'priority':_0x584b80++,'VoiceExtensionId':_0x47bc1b['id']},{'type':'outbound','app':'Set','appdata':'CDR(destination)='+(_0x47bc1b[_0x5a7d('0xe')]?'${EXTEN:'+_0x47bc1b[_0x5a7d('0xe')]+'}':_0x5a7d('0xf')),'context':_0x47bc1b[_0x5a7d('0x4')],'exten':_0x47bc1b[_0x5a7d('0x5')],'priority':_0x584b80++,'VoiceExtensionId':_0x47bc1b['id']},{'type':_0x5a7d('0xc'),'app':_0x5a7d('0x7'),'appdata':'CDR(routeid)='+_0x47bc1b['id'],'context':_0x47bc1b[_0x5a7d('0x4')],'exten':_0x47bc1b[_0x5a7d('0x5')],'priority':_0x584b80++,'VoiceExtensionId':_0x47bc1b['id']},{'type':_0x5a7d('0xc'),'app':'ExecIf','appdata':_0x5a7d('0x10')+(_0x584b80+0x2)+_0x5a7d('0x11')+(_0x584b80+0x1)+')','context':_0x47bc1b['context'],'exten':_0x47bc1b[_0x5a7d('0x5')],'priority':_0x584b80++,'VoiceExtensionId':_0x47bc1b['id']},{'type':_0x5a7d('0xc'),'app':_0x5a7d('0x7'),'appdata':_0x47bc1b[_0x5a7d('0xe')]?_0x5a7d('0x12')+_0x47bc1b[_0x5a7d('0xe')]+'}':_0x5a7d('0x13'),'context':_0x47bc1b['context'],'exten':_0x47bc1b[_0x5a7d('0x5')],'priority':_0x584b80++,'VoiceExtensionId':_0x47bc1b['id']},{'type':_0x5a7d('0xc'),'app':_0x5a7d('0x7'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x47bc1b[_0x5a7d('0x4')],'exten':_0x47bc1b['exten'],'priority':_0x584b80++,'VoiceExtensionId':_0x47bc1b['id']},{'type':_0x5a7d('0xc'),'app':_0x5a7d('0x7'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x47bc1b[_0x5a7d('0x4')],'exten':_0x47bc1b[_0x5a7d('0x5')],'priority':_0x584b80++,'VoiceExtensionId':_0x47bc1b['id']},{'type':_0x5a7d('0xc'),'app':'Set','appdata':_0x5a7d('0x14'),'context':_0x47bc1b['context'],'exten':_0x47bc1b['exten'],'priority':_0x584b80++,'VoiceExtensionId':_0x47bc1b['id']},{'type':_0x5a7d('0xc'),'app':_0x5a7d('0x7'),'appdata':'outboundrouteid='+_0x47bc1b['id'],'context':_0x47bc1b[_0x5a7d('0x4')],'exten':_0x47bc1b[_0x5a7d('0x5')],'priority':_0x584b80++,'VoiceExtensionId':_0x47bc1b['id']}];if(_0x47bc1b['hasOwnProperty'](_0x5a7d('0x15'))&&_0x47bc1b[_0x5a7d('0x15')]!=='none'){_0x4decb2[_0x5a7d('0x9')]({'type':_0x5a7d('0xc'),'app':_0x5a7d('0x7'),'appdata':_0x5a7d('0x16'),'context':_0x47bc1b['context'],'exten':_0x47bc1b[_0x5a7d('0x5')],'priority':_0x584b80++,'VoiceExtensionId':_0x47bc1b['id']},{'type':_0x5a7d('0xc'),'app':_0x5a7d('0x7'),'appdata':_0x5a7d('0x17')+_0x47bc1b['recordingFormat']||_0x5a7d('0x18'),'context':_0x47bc1b[_0x5a7d('0x4')],'exten':_0x47bc1b['exten'],'priority':_0x584b80++,'VoiceExtensionId':_0x47bc1b['id']});}return _0x4decb2;}function _0x33ce6a(_0x123f6c,_0x3be212){var _0x4a5614=[{'name':'trunk','param':0x0},{'name':_0x5a7d('0x19'),'param':0x1},{'name':_0x5a7d('0x1a'),'param':0x2},{'name':_0x5a7d('0x1b'),'param':0x3}];var _0x4297ff={};var _0x5b5eee=_0x3be212[_0x5a7d('0x1c')](',');var _0x314865=[];for(var _0xeb5b34=0x0;_0xeb5b34<_0x4a5614['length'];_0xeb5b34++){switch(_0x4a5614[_0xeb5b34][_0x5a7d('0x1d')]){case _0x5a7d('0x1e'):_0x4297ff[_0x5a7d('0x1e')]=_0x5b5eee[_0x4a5614[_0xeb5b34]['param']][_0x5a7d('0x1c')]('/')[0x1];_0x4297ff[_0x5a7d('0x1f')]=_0x5b5eee[_0x4a5614[_0xeb5b34][_0x5a7d('0x20')]][_0x5a7d('0x1c')]('/')[0x2];_0x4297ff[_0x5a7d('0x21')]=_0x4297ff[_0x5a7d('0x1f')]?_0x4297ff['phone'][_0x5a7d('0x1c')]('$')[0x0]:undefined;_0x4297ff[_0x5a7d('0x1f')]=_0x123f6c[_0x5a7d('0xe')]?(_0x4297ff[_0x5a7d('0x21')]||'')+_0x5a7d('0x22')+_0x123f6c['cutdigits']+'}':(_0x4297ff[_0x5a7d('0x21')]||'')+_0x5a7d('0xf');_0x314865[_0x4a5614[_0xeb5b34][_0x5a7d('0x20')]]=[_0x5a7d('0x23'),_0x4297ff[_0x5a7d('0x1e')],_0x4297ff[_0x5a7d('0x1f')]][_0x5a7d('0x24')]('/');break;case'options':_0x4297ff[_0x5a7d('0x1a')]=_0x5b5eee[_0x4a5614[_0xeb5b34][_0x5a7d('0x20')]];if(_0x123f6c[_0x5a7d('0x15')]!=='none'){if(_0x4297ff[_0x5a7d('0x1a')][_0x5a7d('0x25')](_0x5a7d('0x26'))<0x0){_0x4297ff['options']+=_0x5a7d('0x26');}}else{_0x4297ff['options']=_0x4297ff[_0x5a7d('0x1a')][_0x5a7d('0x27')](_0x5a7d('0x26'),'');}_0x314865[_0x4a5614[_0xeb5b34][_0x5a7d('0x20')]]=_0x4297ff['options'];break;default:_0x314865[_0x4a5614[_0xeb5b34][_0x5a7d('0x20')]]=_0x5b5eee[_0x4a5614[_0xeb5b34][_0x5a7d('0x20')]];}}return _0x314865[_0x5a7d('0x24')](',');}function _0x2f04fe(_0x464148,_0x5877c0,_0x42fb2){return new Promise(function(_0x2ec5e3,_0x47fecd){var _0xf1c3b3=[];if(_[_0x5a7d('0x28')](_0x5877c0))return _0x2ec5e3(_0xf1c3b3);_0x33c920[_0x5a7d('0x29')][_0x5a7d('0x2a')]({'attributes':['id',_0x5a7d('0x2b'),_0x5a7d('0x2c')],'raw':!![]})[_0x5a7d('0x2d')](function(_0x426a66){for(var _0x2e6369=0x0,_0x574a5a=0x0;_0x2e6369<_0x5877c0[_0x5a7d('0x2e')];_0x2e6369++,_0x574a5a=0x0){var _0xb1cae0=_0x5877c0[_0x2e6369];var _0x341890=[];var _0x39acbb=[];delete _0xb1cae0['id'];if(_0xb1cae0[_0x5a7d('0x2b')]!==_0x5a7d('0x2f')){_0xb1cae0[_0x5a7d('0x30')]=[_0xb1cae0[_0x5a7d('0x2b')]];}else{_0xb1cae0[_0x5a7d('0x30')]=_0xb1cae0[_0x5a7d('0x2c')]?_[_0x5a7d('0x31')](_[_0x5a7d('0x32')](_0x426a66,{'IntervalId':_0xb1cae0[_0x5a7d('0x2c')]}),_0x5a7d('0x2b')):[];}_0xb1cae0['context']=_0x464148[_0x5a7d('0x4')];_0xb1cae0[_0x5a7d('0x5')]=_0x464148[_0x5a7d('0x5')];if(_0xb1cae0[_0x5a7d('0x2')])_0xb1cae0[_0x5a7d('0x2')]=_0xb1cae0['type'][_0x5a7d('0x33')]();if(_0x464148[_0x5a7d('0x2')]==='outbound'){if(_0xb1cae0['hasOwnProperty'](_0x5a7d('0x34'))&&_0xb1cae0[_0x5a7d('0x34')]&&_0xb1cae0['tag']!=='--'){_0x341890[_0x5a7d('0x9')]({'type':_0xb1cae0[_0x5a7d('0x2')][_0x5a7d('0x33')](),'app':_0x5a7d('0x7'),'appdata':'CDR(tag)='+_0xb1cae0[_0x5a7d('0x34')],'context':_0x464148[_0x5a7d('0x4')],'exten':_0x464148[_0x5a7d('0x5')],'priority':_0xb1cae0[_0x5a7d('0x30')][_0x5a7d('0x2e')]+_0x42fb2+_0x574a5a++,'VoiceExtensionId':_0x464148['id']});}_0x341890['push']({'type':_0xb1cae0[_0x5a7d('0x2')]['toLowerCase'](),'app':'ExecIf','appdata':_0x5a7d('0x35')+(_0xb1cae0[_0x5a7d('0x36')]?_0x5a7d('0x37')+_0xb1cae0[_0x5a7d('0x36')]+')':'NoOp(No\x20number\x20available)'),'context':_0x464148[_0x5a7d('0x4')],'exten':_0x464148['exten'],'priority':_0xb1cae0['intervals']['length']+_0x42fb2+_0x574a5a++,'VoiceExtensionId':_0x464148['id']});}else{if(_0xb1cae0[_0x5a7d('0x38')](_0x5a7d('0x39'))){if([_0x5a7d('0x3a'),'playback'][_0x5a7d('0x3b')](_0xb1cae0[_0x5a7d('0x3c')][_0x5a7d('0x33')]())&&_0xb1cae0[_0x5a7d('0x3d')]!==_0x5a7d('0x3e')){if(_0xb1cae0[_0x5a7d('0x39')]){_0x341890[_0x5a7d('0x9')]({'type':_0xb1cae0[_0x5a7d('0x2')][_0x5a7d('0x33')](),'app':_0x5a7d('0x3f'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x464148[_0x5a7d('0x4')],'exten':_0x464148[_0x5a7d('0x5')],'priority':_0xb1cae0['intervals'][_0x5a7d('0x2e')]+_0x42fb2+_0x574a5a++,'VoiceExtensionId':_0x464148['id']});_0x341890['push']({'type':_0xb1cae0[_0x5a7d('0x2')][_0x5a7d('0x33')](),'app':_0x5a7d('0x7'),'appdata':_0x5a7d('0x40'),'context':_0x464148['context'],'exten':_0x464148['exten'],'priority':_0xb1cae0['intervals']['length']+_0x42fb2+_0x574a5a++,'VoiceExtensionId':_0x464148['id']});}else{_0x341890[_0x5a7d('0x9')]({'type':_0xb1cae0[_0x5a7d('0x2')][_0x5a7d('0x33')](),'app':_0x5a7d('0x3f'),'appdata':_0x5a7d('0x41'),'context':_0x464148[_0x5a7d('0x4')],'exten':_0x464148[_0x5a7d('0x5')],'priority':_0xb1cae0['intervals'][_0x5a7d('0x2e')]+_0x42fb2+_0x574a5a++,'VoiceExtensionId':_0x464148['id']});_0x341890[_0x5a7d('0x9')]({'type':_0xb1cae0[_0x5a7d('0x2')]['toLowerCase'](),'app':_0x5a7d('0x7'),'appdata':_0x5a7d('0x42'),'context':_0x464148[_0x5a7d('0x4')],'exten':_0x464148[_0x5a7d('0x5')],'priority':_0xb1cae0[_0x5a7d('0x30')]['length']+_0x42fb2+_0x574a5a++,'VoiceExtensionId':_0x464148['id']});}}}}for(var _0x109660=0x0;_0x109660<_0xb1cae0[_0x5a7d('0x30')][_0x5a7d('0x2e')];_0x109660++){var _0x4a8173=_0x42fb2+_0xb1cae0[_0x5a7d('0x30')][_0x5a7d('0x2e')];var _0x57c61d=_0x109660===_0xb1cae0['intervals']['length']-0x1?_0x42fb2+_0x341890['length']+_0x39acbb['length']+0x2:_0x42fb2+_0x109660+0x1;_0x341890[_0x5a7d('0x43')](_0x109660,0x0,{'type':_0x464148[_0x5a7d('0x2')],'app':'GotoIfTime','appdata':_0xb1cae0[_0x5a7d('0x30')][_0x109660]+'?'+_0x464148[_0x5a7d('0x4')]+',${EXTEN},'+_0x4a8173+':'+_0x464148[_0x5a7d('0x4')]+_0x5a7d('0x44')+_0x57c61d,'exten':_0x464148['exten'],'context':_0x464148[_0x5a7d('0x4')],'priority':_0x42fb2+_0x109660,'VoiceExtensionId':_0x464148['id']});}if(_0xb1cae0[_0x5a7d('0x3d')]===_0x5a7d('0x45')){_0xb1cae0[_0x5a7d('0x46')]=_0x33ce6a(_0x464148,_0xb1cae0[_0x5a7d('0x46')]);}if(_0xb1cae0[_0x5a7d('0x3d')]===_0x5a7d('0x47')){_0x341890[_0x5a7d('0x9')]({'type':_0xb1cae0[_0x5a7d('0x2')][_0x5a7d('0x33')](),'app':'Set','appdata':_0x5a7d('0x48'),'context':_0x464148['context'],'exten':_0x464148[_0x5a7d('0x5')],'priority':_0xb1cae0[_0x5a7d('0x30')][_0x5a7d('0x2e')]+_0x42fb2+_0x574a5a++,'VoiceExtensionId':_0x464148['id']});}_0xb1cae0[_0x5a7d('0x49')]=_0x341890[_0x5a7d('0x2e')]?_['last'](_0x341890)['priority']+0x1:_0x42fb2;_0xf1c3b3=_[_0x5a7d('0x4a')](_0xf1c3b3,_0x341890,[_0xb1cae0],_0x39acbb);_0x42fb2=_[_0x5a7d('0x4b')](_0xf1c3b3)[_0x5a7d('0x49')]+0x1;}return _0x2ec5e3(_0xf1c3b3);})[_0x5a7d('0x4c')](function(_0x3fd7f6){_0x47fecd(_0x3fd7f6);});});}return _0x35276b[_0x5a7d('0x4d')](_0x5a7d('0x4e'),attributes,{'tableName':'voice_extensions','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0xd390b0){var _0x582df8=this['get']({'plain':!![]});var _0x380c99=_0x582df8[_0x5a7d('0x2')]===_0x5a7d('0xc')?_0x20d324(_0x582df8):_0x498f5a(_0x582df8);return _0x2f04fe(_0x582df8,_0xd390b0,_['last'](_0x380c99)[_0x5a7d('0x49')]+0x1)[_0x5a7d('0x2d')](function(_0x3df2e){var _0xc969ad=_[_0x5a7d('0x4a')](_0x380c99,_0x3df2e);_0xc969ad[_0x5a7d('0x9')]({'type':_0x582df8[_0x5a7d('0x2')],'app':_0x5a7d('0x4f'),'exten':_0x582df8[_0x5a7d('0x5')],'context':_0x582df8['context'],'priority':_[_0x5a7d('0x4b')](_0xc969ad)['priority']+0x1,'VoiceExtensionId':_0x582df8['id']});return _0xc969ad;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index 7fd14d1..5b39a66 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 _0x9505=['client','http','redis','localhost','socket.io-emitter','./voiceExtension.socket','register','request','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVoiceExtension','raw','options','where','attributes','limit','include','model','map','then','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise'];(function(_0x2b480a,_0x50786a){var _0x15b748=function(_0xa7685c){while(--_0xa7685c){_0x2b480a['push'](_0x2b480a['shift']());}};_0x15b748(++_0x50786a);}(_0x9505,0x1e5));var _0x5950=function(_0x22eee8,_0x3ea3dd){_0x22eee8=_0x22eee8-0x0;var _0x283249=_0x9505[_0x22eee8];return _0x283249;};'use strict';var _=require(_0x5950('0x0'));var util=require(_0x5950('0x1'));var moment=require('moment');var BPromise=require(_0x5950('0x2'));var rs=require(_0x5950('0x3'));var fs=require('fs');var Redis=require(_0x5950('0x4'));var db=require(_0x5950('0x5'))['db'];var utils=require(_0x5950('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x5950('0x7'));var jayson=require(_0x5950('0x8'));var client=jayson[_0x5950('0x9')][_0x5950('0xa')]({'port':0x232a});config['redis']=_['defaults'](config[_0x5950('0xb')],{'host':_0x5950('0xc'),'port':0x18eb});var socket=require(_0x5950('0xd'))(new Redis(config[_0x5950('0xb')]));require(_0x5950('0xe'))[_0x5950('0xf')](socket);function respondWithRpcPromise(_0x1148ef,_0x213e3b,_0x1c8f39){return new BPromise(function(_0x5ef4ab,_0x32f2e0){return client[_0x5950('0x10')](_0x1148ef,_0x1c8f39)['then'](function(_0x5a6098){logger[_0x5950('0x11')](_0x5950('0x12'),_0x213e3b,_0x5950('0x13'));logger[_0x5950('0x14')](_0x5950('0x15'),_0x213e3b,_0x5950('0x13'),JSON[_0x5950('0x16')](_0x5a6098));if(_0x5a6098[_0x5950('0x17')]){if(_0x5a6098[_0x5950('0x17')][_0x5950('0x18')]===0x1f4){logger[_0x5950('0x17')](_0x5950('0x12'),_0x213e3b,_0x5a6098[_0x5950('0x17')][_0x5950('0x19')]);return _0x32f2e0(_0x5a6098[_0x5950('0x17')][_0x5950('0x19')]);}logger[_0x5950('0x17')](_0x5950('0x12'),_0x213e3b,_0x5a6098[_0x5950('0x17')][_0x5950('0x19')]);return _0x5ef4ab(_0x5a6098[_0x5950('0x17')]['message']);}else{logger['info'](_0x5950('0x12'),_0x213e3b,_0x5950('0x13'));_0x5ef4ab(_0x5a6098[_0x5950('0x1a')][_0x5950('0x19')]);}})[_0x5950('0x1b')](function(_0x483aaf){logger['error'](_0x5950('0x12'),_0x213e3b,_0x483aaf);_0x32f2e0(_0x483aaf);});});}exports[_0x5950('0x1c')]=function(_0x1ad343){var _0x5bd90e=this;return new Promise(function(_0x1cf241,_0x3ea879){return db['VoiceExtension']['findAll']({'raw':_0x1ad343['options']?_0x1ad343['options'][_0x5950('0x1d')]===undefined?!![]:![]:!![],'where':_0x1ad343[_0x5950('0x1e')]?_0x1ad343[_0x5950('0x1e')][_0x5950('0x1f')]||null:null,'attributes':_0x1ad343['options']?_0x1ad343[_0x5950('0x1e')][_0x5950('0x20')]||null:null,'limit':_0x1ad343[_0x5950('0x1e')]?_0x1ad343[_0x5950('0x1e')][_0x5950('0x21')]||null:null,'include':_0x1ad343[_0x5950('0x1e')]?_0x1ad343[_0x5950('0x1e')]['include']?_['map'](_0x1ad343[_0x5950('0x1e')][_0x5950('0x22')],function(_0x545354){return{'model':db[_0x545354[_0x5950('0x23')]],'as':_0x545354['as'],'attributes':_0x545354[_0x5950('0x20')],'include':_0x545354['include']?_['map'](_0x545354['include'],function(_0x20679e){return{'model':db[_0x20679e[_0x5950('0x23')]],'as':_0x20679e['as'],'attributes':_0x20679e[_0x5950('0x20')],'include':_0x20679e[_0x5950('0x22')]?_[_0x5950('0x24')](_0x20679e[_0x5950('0x22')],function(_0x2ff8a3){return{'model':db[_0x2ff8a3[_0x5950('0x23')]],'as':_0x2ff8a3['as'],'attributes':_0x2ff8a3[_0x5950('0x20')]};}):[]};}):[]};}):[]:[]})[_0x5950('0x25')](function(_0x24db8b){logger[_0x5950('0x11')](_0x5950('0x1c'),_0x1ad343);logger[_0x5950('0x14')](_0x5950('0x1c'),_0x1ad343,JSON[_0x5950('0x16')](_0x24db8b));_0x1cf241(_0x24db8b);})[_0x5950('0x1b')](function(_0x18a8ca){logger[_0x5950('0x17')](_0x5950('0x1c'),_0x18a8ca[_0x5950('0x19')],_0x1ad343);_0x3ea879(_0x5bd90e[_0x5950('0x17')](0x1f4,_0x18a8ca[_0x5950('0x19')]));});});}; \ No newline at end of file +var _0xaa3f=['model','map','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','request\x20sent','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','VoiceExtension,\x20%s,\x20%s','message','catch','GetVoiceExtension','VoiceExtension','findAll','options','raw','where','attributes','limit','include'];(function(_0x24ad24,_0x518a6b){var _0x29dc63=function(_0x552be1){while(--_0x552be1){_0x24ad24['push'](_0x24ad24['shift']());}};_0x29dc63(++_0x518a6b);}(_0xaa3f,0xbb));var _0xfaa3=function(_0x4a8c77,_0x3277c5){_0x4a8c77=_0x4a8c77-0x0;var _0xd9ebe7=_0xaa3f[_0x4a8c77];return _0xd9ebe7;};'use strict';var _=require(_0xfaa3('0x0'));var util=require(_0xfaa3('0x1'));var moment=require(_0xfaa3('0x2'));var BPromise=require(_0xfaa3('0x3'));var rs=require(_0xfaa3('0x4'));var fs=require('fs');var Redis=require(_0xfaa3('0x5'));var db=require(_0xfaa3('0x6'))['db'];var utils=require(_0xfaa3('0x7'));var logger=require(_0xfaa3('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0xfaa3('0x9'));var client=jayson['client'][_0xfaa3('0xa')]({'port':0x232a});config[_0xfaa3('0xb')]=_[_0xfaa3('0xc')](config[_0xfaa3('0xb')],{'host':_0xfaa3('0xd'),'port':0x18eb});var socket=require(_0xfaa3('0xe'))(new Redis(config[_0xfaa3('0xb')]));require('./voiceExtension.socket')[_0xfaa3('0xf')](socket);function respondWithRpcPromise(_0x28de66,_0x49380c,_0x5ca0da){return new BPromise(function(_0x44d88e,_0xce3b1f){return client[_0xfaa3('0x10')](_0x28de66,_0x5ca0da)[_0xfaa3('0x11')](function(_0x23e4b6){logger[_0xfaa3('0x12')]('VoiceExtension,\x20%s,\x20%s',_0x49380c,_0xfaa3('0x13'));logger['debug'](_0xfaa3('0x14'),_0x49380c,_0xfaa3('0x13'),JSON[_0xfaa3('0x15')](_0x23e4b6));if(_0x23e4b6['error']){if(_0x23e4b6[_0xfaa3('0x16')]['code']===0x1f4){logger[_0xfaa3('0x16')](_0xfaa3('0x17'),_0x49380c,_0x23e4b6[_0xfaa3('0x16')][_0xfaa3('0x18')]);return _0xce3b1f(_0x23e4b6[_0xfaa3('0x16')][_0xfaa3('0x18')]);}logger['error']('VoiceExtension,\x20%s,\x20%s',_0x49380c,_0x23e4b6[_0xfaa3('0x16')][_0xfaa3('0x18')]);return _0x44d88e(_0x23e4b6[_0xfaa3('0x16')][_0xfaa3('0x18')]);}else{logger['info']('VoiceExtension,\x20%s,\x20%s',_0x49380c,'request\x20sent');_0x44d88e(_0x23e4b6['result']['message']);}})[_0xfaa3('0x19')](function(_0x5cc884){logger[_0xfaa3('0x16')](_0xfaa3('0x17'),_0x49380c,_0x5cc884);_0xce3b1f(_0x5cc884);});});}exports[_0xfaa3('0x1a')]=function(_0x34b276){var _0x1c32dd=this;return new Promise(function(_0x310b0d,_0x1dd053){return db[_0xfaa3('0x1b')][_0xfaa3('0x1c')]({'raw':_0x34b276[_0xfaa3('0x1d')]?_0x34b276['options'][_0xfaa3('0x1e')]===undefined?!![]:![]:!![],'where':_0x34b276[_0xfaa3('0x1d')]?_0x34b276[_0xfaa3('0x1d')][_0xfaa3('0x1f')]||null:null,'attributes':_0x34b276['options']?_0x34b276[_0xfaa3('0x1d')][_0xfaa3('0x20')]||null:null,'limit':_0x34b276[_0xfaa3('0x1d')]?_0x34b276[_0xfaa3('0x1d')][_0xfaa3('0x21')]||null:null,'include':_0x34b276[_0xfaa3('0x1d')]?_0x34b276[_0xfaa3('0x1d')][_0xfaa3('0x22')]?_['map'](_0x34b276[_0xfaa3('0x1d')][_0xfaa3('0x22')],function(_0x699e72){return{'model':db[_0x699e72[_0xfaa3('0x23')]],'as':_0x699e72['as'],'attributes':_0x699e72[_0xfaa3('0x20')],'include':_0x699e72[_0xfaa3('0x22')]?_[_0xfaa3('0x24')](_0x699e72[_0xfaa3('0x22')],function(_0xd67c17){return{'model':db[_0xd67c17[_0xfaa3('0x23')]],'as':_0xd67c17['as'],'attributes':_0xd67c17[_0xfaa3('0x20')],'include':_0xd67c17[_0xfaa3('0x22')]?_[_0xfaa3('0x24')](_0xd67c17[_0xfaa3('0x22')],function(_0x2d7c43){return{'model':db[_0x2d7c43['model']],'as':_0x2d7c43['as'],'attributes':_0x2d7c43[_0xfaa3('0x20')]};}):[]};}):[]};}):[]:[]})[_0xfaa3('0x11')](function(_0xc2e71){logger['info'](_0xfaa3('0x1a'),_0x34b276);logger['debug'](_0xfaa3('0x1a'),_0x34b276,JSON['stringify'](_0xc2e71));_0x310b0d(_0xc2e71);})[_0xfaa3('0x19')](function(_0x1ece24){logger[_0xfaa3('0x16')](_0xfaa3('0x1a'),_0x1ece24[_0xfaa3('0x18')],_0x34b276);_0x1dd053(_0x1c32dd[_0xfaa3('0x16')](0x1f4,_0x1ece24[_0xfaa3('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index 86717eb..98afc5c 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 _0x1cb9=['update','emit','removeListener','register','length','./voiceExtension.events','remove'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x1cb9,0x14e));var _0x91cb=function(_0x3461f8,_0x18e152){_0x3461f8=_0x3461f8-0x0;var _0x14586d=_0x1cb9[_0x3461f8];return _0x14586d;};'use strict';var VoiceExtensionEvents=require(_0x91cb('0x0'));var events=['save',_0x91cb('0x1'),_0x91cb('0x2')];function createListener(_0x2b1894,_0x351bdb){return function(_0x57ea48){_0x351bdb[_0x91cb('0x3')](_0x2b1894,_0x57ea48);};}function removeListener(_0x2b7314,_0x5652cd){return function(){VoiceExtensionEvents[_0x91cb('0x4')](_0x2b7314,_0x5652cd);};}exports[_0x91cb('0x5')]=function(_0x186dc3){for(var _0x28543e=0x0,_0x3b9d98=events[_0x91cb('0x6')];_0x28543e<_0x3b9d98;_0x28543e++){var _0x4c1f56=events[_0x28543e];var _0x15c517=createListener('voiceExtension:'+_0x4c1f56,_0x186dc3);VoiceExtensionEvents['on'](_0x4c1f56,_0x15c517);}}; \ No newline at end of file +var _0x5fc3=['./voiceExtension.events','save','update','emit','removeListener','register','voiceExtension:'];(function(_0x56aac6,_0x5bd6f0){var _0x448cb3=function(_0x5e6435){while(--_0x5e6435){_0x56aac6['push'](_0x56aac6['shift']());}};_0x448cb3(++_0x5bd6f0);}(_0x5fc3,0xa8));var _0x35fc=function(_0x3a8db5,_0x31cff7){_0x3a8db5=_0x3a8db5-0x0;var _0x2c03cd=_0x5fc3[_0x3a8db5];return _0x2c03cd;};'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 c2abcba..4a482b7 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 _0xb091=['getMessages','post','create','put','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','fs-extra','../../config/environment','./voiceMail.controller','isAuthenticated','index','get','show','/:id/messages'];(function(_0x4bb94b,_0x50628a){var _0x36dcc6=function(_0x3ea436){while(--_0x3ea436){_0x4bb94b['push'](_0x4bb94b['shift']());}};_0x36dcc6(++_0x50628a);}(_0xb091,0x16e));var _0x1b09=function(_0x9620cd,_0x5a371d){_0x9620cd=_0x9620cd-0x0;var _0x3d1788=_0xb091[_0x9620cd];return _0x3d1788;};'use strict';var multer=require('multer');var util=require(_0x1b09('0x0'));var path=require(_0x1b09('0x1'));var timeout=require(_0x1b09('0x2'));var express=require(_0x1b09('0x3'));var router=express['Router']();var fs_extra=require(_0x1b09('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x1b09('0x5'));var controller=require(_0x1b09('0x6'));router['get']('/',auth[_0x1b09('0x7')](),controller[_0x1b09('0x8')]);router[_0x1b09('0x9')]('/:id',auth[_0x1b09('0x7')](),controller[_0x1b09('0xa')]);router[_0x1b09('0x9')](_0x1b09('0xb'),auth[_0x1b09('0x7')](),controller[_0x1b09('0xc')]);router[_0x1b09('0xd')]('/',auth[_0x1b09('0x7')](),controller[_0x1b09('0xe')]);router[_0x1b09('0xf')](_0x1b09('0x10'),auth['isAuthenticated'](),controller[_0x1b09('0x11')]);router[_0x1b09('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x1b09('0x13')]);module[_0x1b09('0x14')]=router; \ No newline at end of file +var _0x33af=['fs-extra','../../components/auth/service','../../components/interaction/service','./voiceMail.controller','get','index','/:id','isAuthenticated','show','getMessages','post','create','put','update','delete','destroy','util','connect-timeout','express','Router'];(function(_0x276b85,_0x5a9c7f){var _0x81b8b=function(_0x5502e3){while(--_0x5502e3){_0x276b85['push'](_0x276b85['shift']());}};_0x81b8b(++_0x5a9c7f);}(_0x33af,0xec));var _0xf33a=function(_0x2fdce0,_0x496242){_0x2fdce0=_0x2fdce0-0x0;var _0x36f07e=_0x33af[_0x2fdce0];return _0x36f07e;};'use strict';var multer=require('multer');var util=require(_0xf33a('0x0'));var path=require('path');var timeout=require(_0xf33a('0x1'));var express=require(_0xf33a('0x2'));var router=express[_0xf33a('0x3')]();var fs_extra=require(_0xf33a('0x4'));var auth=require(_0xf33a('0x5'));var interaction=require(_0xf33a('0x6'));var config=require('../../config/environment');var controller=require(_0xf33a('0x7'));router[_0xf33a('0x8')]('/',auth['isAuthenticated'](),controller[_0xf33a('0x9')]);router[_0xf33a('0x8')](_0xf33a('0xa'),auth[_0xf33a('0xb')](),controller[_0xf33a('0xc')]);router[_0xf33a('0x8')]('/:id/messages',auth[_0xf33a('0xb')](),controller[_0xf33a('0xd')]);router[_0xf33a('0xe')]('/',auth[_0xf33a('0xb')](),controller[_0xf33a('0xf')]);router[_0xf33a('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xf33a('0x11')]);router[_0xf33a('0x12')](_0xf33a('0xa'),auth[_0xf33a('0xb')](),controller[_0xf33a('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index 9a075c5..c502318 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 _0xb051=['INTEGER','VIRTUAL','getDataValue','\x20-\x20','mailbox','exports','STRING','from-voicemail','contest_mailbox','setDataValue','email','string','trim','central','ENUM','yes','TINYINT(4)','TIMESTAMP'];(function(_0x546201,_0x49ee3e){var _0x57e598=function(_0x54403f){while(--_0x54403f){_0x546201['push'](_0x546201['shift']());}};_0x57e598(++_0x49ee3e);}(_0xb051,0x191));var _0x1b05=function(_0x32f9ca,_0x2fa8bc){_0x32f9ca=_0x32f9ca-0x0;var _0x52e083=_0xb051[_0x32f9ca];return _0x52e083;};'use strict';var Sequelize=require('sequelize');module[_0x1b05('0x0')]={'customer_id':{'type':Sequelize[_0x1b05('0x1')]},'context':{'type':Sequelize[_0x1b05('0x1')],'defaultValue':_0x1b05('0x2'),'unique':_0x1b05('0x3')},'mailbox':{'type':Sequelize[_0x1b05('0x1')],'defaultValue':'','allowNull':![],'unique':_0x1b05('0x3')},'password':{'type':Sequelize['STRING']},'fullname':{'type':Sequelize[_0x1b05('0x1')]},'email':{'type':Sequelize[_0x1b05('0x1')],'validate':{'isEmail':!![]},'set':function(_0x391235){this[_0x1b05('0x4')](_0x1b05('0x5'),typeof _0x391235===_0x1b05('0x6')&&_0x391235[_0x1b05('0x7')]()?_0x391235[_0x1b05('0x7')]():null);}},'pager':{'type':Sequelize[_0x1b05('0x1')]},'tz':{'type':Sequelize[_0x1b05('0x1')],'defaultValue':_0x1b05('0x8')},'attach':{'type':Sequelize[_0x1b05('0x9')](_0x1b05('0xa'),'no'),'defaultValue':_0x1b05('0xa'),'allowNull':![]},'saycid':{'type':Sequelize[_0x1b05('0x9')]('yes','no'),'defaultValue':'yes','allowNull':![]},'dialout':{'type':Sequelize[_0x1b05('0x1')]},'callback':{'type':Sequelize[_0x1b05('0x1')]},'review':{'type':Sequelize[_0x1b05('0x9')](_0x1b05('0xa'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x1b05('0x9')](_0x1b05('0xa'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x1b05('0x9')](_0x1b05('0xa'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize['ENUM'](_0x1b05('0xa'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x1b05('0xb'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x1b05('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x1b05('0x9')](_0x1b05('0xa'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x1b05('0x9')](_0x1b05('0xa'),'no'),'defaultValue':'yes','allowNull':![]},'forcename':{'type':Sequelize[_0x1b05('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x1b05('0x9')](_0x1b05('0xa'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x1b05('0x9')](_0x1b05('0xa'),'no'),'defaultValue':'yes','allowNull':![]},'stamp':{'type':_0x1b05('0xc')},'emailsubject':{'type':Sequelize[_0x1b05('0x1')]},'emailbody':{'type':Sequelize['STRING']},'maxsecs':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x1b05('0xd')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x1b05('0xe')],'get':function(){return this[_0x1b05('0xf')]('fullname')+_0x1b05('0x10')+this[_0x1b05('0xf')](_0x1b05('0x11'));}}}; \ No newline at end of file +var _0x6138=['sequelize','exports','from-voicemail','contest_mailbox','STRING','setDataValue','string','central','yes','ENUM','TINYINT(4)','TIMESTAMP','INTEGER','getDataValue','fullname'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6138,0xe1));var _0x8613=function(_0x164eca,_0x555e28){_0x164eca=_0x164eca-0x0;var _0x2ce562=_0x6138[_0x164eca];return _0x2ce562;};'use strict';var Sequelize=require(_0x8613('0x0'));module[_0x8613('0x1')]={'customer_id':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING'],'defaultValue':_0x8613('0x2'),'unique':_0x8613('0x3')},'mailbox':{'type':Sequelize[_0x8613('0x4')],'defaultValue':'','allowNull':![],'unique':'contest_mailbox'},'password':{'type':Sequelize[_0x8613('0x4')]},'fullname':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x8613('0x4')],'validate':{'isEmail':!![]},'set':function(_0x41e40d){this[_0x8613('0x5')]('email',typeof _0x41e40d===_0x8613('0x6')&&_0x41e40d['trim']()?_0x41e40d['trim']():null);}},'pager':{'type':Sequelize[_0x8613('0x4')]},'tz':{'type':Sequelize[_0x8613('0x4')],'defaultValue':_0x8613('0x7')},'attach':{'type':Sequelize['ENUM'](_0x8613('0x8'),'no'),'defaultValue':_0x8613('0x8'),'allowNull':![]},'saycid':{'type':Sequelize[_0x8613('0x9')](_0x8613('0x8'),'no'),'defaultValue':_0x8613('0x8'),'allowNull':![]},'dialout':{'type':Sequelize[_0x8613('0x4')]},'callback':{'type':Sequelize['STRING']},'review':{'type':Sequelize[_0x8613('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x8613('0x9')](_0x8613('0x8'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x8613('0x9')](_0x8613('0x8'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x8613('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x8613('0xa'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x8613('0x9')](_0x8613('0x8'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize['ENUM'](_0x8613('0x8'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x8613('0x9')](_0x8613('0x8'),'no'),'defaultValue':_0x8613('0x8'),'allowNull':![]},'forcename':{'type':Sequelize[_0x8613('0x9')](_0x8613('0x8'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x8613('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize['ENUM'](_0x8613('0x8'),'no'),'defaultValue':_0x8613('0x8'),'allowNull':![]},'stamp':{'type':_0x8613('0xb')},'emailsubject':{'type':Sequelize['STRING']},'emailbody':{'type':Sequelize[_0x8613('0x4')]},'maxsecs':{'type':Sequelize[_0x8613('0xc')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x8613('0xc')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x8613('0xd')](_0x8613('0xe'))+'\x20-\x20'+this[_0x8613('0xd')]('mailbox');}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index 99fe1a1..db7f3e8 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 _0x2547=['key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','filter','merge','map','options','includeAll','findAll','rows','catch','params','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getMessages','findOne','VoiceMailMessage','sort','pick','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','Voicemails','error','stack','name','send','VoiceMail','rawAttributes','fieldName','type'];(function(_0x4879e0,_0x292f9b){var _0x4028c9=function(_0x32657d){while(--_0x32657d){_0x4879e0['push'](_0x4879e0['shift']());}};_0x4028c9(++_0x292f9b);}(_0x2547,0x1cd));var _0x7254=function(_0xc6a024,_0x4a3064){_0xc6a024=_0xc6a024-0x0;var _0x1f3af4=_0x2547[_0xc6a024];return _0x1f3af4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7254('0x0'));var zipdir=require(_0x7254('0x1'));var jsonpatch=require(_0x7254('0x2'));var rp=require(_0x7254('0x3'));var moment=require(_0x7254('0x4'));var BPromise=require(_0x7254('0x5'));var Mustache=require(_0x7254('0x6'));var util=require(_0x7254('0x7'));var path=require('path');var sox=require(_0x7254('0x8'));var csv=require(_0x7254('0x9'));var ejs=require(_0x7254('0xa'));var fs=require('fs');var fs_extra=require(_0x7254('0xb'));var _=require('lodash');var squel=require(_0x7254('0xc'));var crypto=require(_0x7254('0xd'));var jsforce=require(_0x7254('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x7254('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x7254('0xf'));var qs=require(_0x7254('0x10'));var as=require(_0x7254('0x11'));var hardwareService=require(_0x7254('0x12'));var logger=require(_0x7254('0x13'))(_0x7254('0x14'));var utils=require('../../config/utils');var config=require(_0x7254('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x7254('0x16'))['db'];function respondWithStatusCode(_0x53fc4f,_0x16c08e){_0x16c08e=_0x16c08e||0xcc;return function(_0x2bfff8){if(_0x2bfff8){return _0x53fc4f[_0x7254('0x17')](_0x16c08e);}return _0x53fc4f[_0x7254('0x18')](_0x16c08e)[_0x7254('0x19')]();};}function respondWithResult(_0x395a8a,_0x124192){_0x124192=_0x124192||0xc8;return function(_0x21cecc){if(_0x21cecc){return _0x395a8a[_0x7254('0x18')](_0x124192)[_0x7254('0x1a')](_0x21cecc);}};}function respondWithFilteredResult(_0x38a99c,_0x1ee5cb){return function(_0x163c8c){if(_0x163c8c){var _0x535065=typeof _0x1ee5cb[_0x7254('0x1b')]===_0x7254('0x1c')&&typeof _0x1ee5cb[_0x7254('0x1d')]===_0x7254('0x1c');var _0x3b5f06=_0x163c8c[_0x7254('0x1e')];var _0x2737e0=_0x535065?0x0:_0x1ee5cb['offset'];var _0x1f48f6=_0x535065?_0x163c8c[_0x7254('0x1e')]:_0x1ee5cb[_0x7254('0x1b')]+_0x1ee5cb[_0x7254('0x1d')];var _0x2a1ddc;if(_0x1f48f6>=_0x3b5f06){_0x1f48f6=_0x3b5f06;_0x2a1ddc=0xc8;}else{_0x2a1ddc=0xce;}_0x38a99c[_0x7254('0x18')](_0x2a1ddc);return _0x38a99c[_0x7254('0x1f')](_0x7254('0x20'),_0x2737e0+'-'+_0x1f48f6+'/'+_0x3b5f06)[_0x7254('0x1a')](_0x163c8c);}return null;};}function patchUpdates(_0x3b6cb6){return function(_0x2594b8){try{jsonpatch[_0x7254('0x21')](_0x2594b8,_0x3b6cb6,!![]);}catch(_0xc617b6){return BPromise[_0x7254('0x22')](_0xc617b6);}return _0x2594b8[_0x7254('0x23')]();};}function saveUpdates(_0x95ceaa,_0x2bb2fe){return function(_0x46c0a2){if(_0x46c0a2){return _0x46c0a2[_0x7254('0x24')](_0x95ceaa)[_0x7254('0x25')](function(_0x1be69b){return _0x1be69b;});}return null;};}function removeEntity(_0x50c34b,_0x493bfd){return function(_0x136ea3){if(_0x136ea3){return _0x136ea3[_0x7254('0x26')]()[_0x7254('0x25')](function(){var _0x54dace=_0x136ea3[_0x7254('0x27')]({'plain':!![]});var _0x36b5d5=_0x7254('0x28');return db['UserProfileResource'][_0x7254('0x26')]({'where':{'type':_0x36b5d5,'resourceId':_0x54dace['id']}})[_0x7254('0x25')](function(){return _0x136ea3;});})[_0x7254('0x25')](function(){_0x50c34b['status'](0xcc)[_0x7254('0x19')]();});}};}function handleEntityNotFound(_0x594a63,_0x1bb6a7){return function(_0x134a9e){if(!_0x134a9e){_0x594a63['sendStatus'](0x194);}return _0x134a9e;};}function handleError(_0x17bb46,_0x158356){_0x158356=_0x158356||0x1f4;return function(_0x4f684c){logger[_0x7254('0x29')](_0x4f684c[_0x7254('0x2a')]);if(_0x4f684c[_0x7254('0x2b')]){delete _0x4f684c[_0x7254('0x2b')];}_0x17bb46[_0x7254('0x18')](_0x158356)[_0x7254('0x2c')](_0x4f684c);};}exports['index']=function(_0x146028,_0x2dba3f){var _0x5569be={},_0x2f75ea={},_0x1279cd={'count':0x0,'rows':[]};var _0x2be5fc=_['map'](db[_0x7254('0x2d')][_0x7254('0x2e')],function(_0x354305){return{'name':_0x354305[_0x7254('0x2f')],'type':_0x354305[_0x7254('0x30')][_0x7254('0x31')]};});_0x2f75ea[_0x7254('0x32')]=_['map'](_0x2be5fc,_0x7254('0x2b'));_0x2f75ea['query']=_['keys'](_0x146028[_0x7254('0x33')]);_0x2f75ea[_0x7254('0x34')]=_[_0x7254('0x35')](_0x2f75ea[_0x7254('0x32')],_0x2f75ea[_0x7254('0x33')]);_0x5569be[_0x7254('0x36')]=_[_0x7254('0x35')](_0x2f75ea[_0x7254('0x32')],qs[_0x7254('0x37')](_0x146028[_0x7254('0x33')][_0x7254('0x37')]));_0x5569be[_0x7254('0x36')]=_0x5569be[_0x7254('0x36')][_0x7254('0x38')]?_0x5569be['attributes']:_0x2f75ea[_0x7254('0x32')];if(!_0x146028[_0x7254('0x33')][_0x7254('0x39')](_0x7254('0x3a'))){_0x5569be[_0x7254('0x1d')]=qs['limit'](_0x146028[_0x7254('0x33')]['limit']);_0x5569be[_0x7254('0x1b')]=qs[_0x7254('0x1b')](_0x146028[_0x7254('0x33')][_0x7254('0x1b')]);}_0x5569be[_0x7254('0x3b')]=qs['sort'](_0x146028[_0x7254('0x33')]['sort']);_0x5569be[_0x7254('0x3c')]=qs[_0x7254('0x34')](_['pick'](_0x146028[_0x7254('0x33')],_0x2f75ea[_0x7254('0x34')]),_0x2be5fc);if(_0x146028[_0x7254('0x33')][_0x7254('0x3d')]){_0x5569be[_0x7254('0x3c')]=_[_0x7254('0x3e')](_0x5569be['where'],{'$or':_[_0x7254('0x3f')](_0x2be5fc,function(_0x102d87){if(_0x102d87[_0x7254('0x30')]!=='VIRTUAL'){var _0x3fbad7={};_0x3fbad7[_0x102d87[_0x7254('0x2b')]]={'$like':'%'+_0x146028[_0x7254('0x33')]['filter']+'%'};return _0x3fbad7;}})});}_0x5569be=_[_0x7254('0x3e')]({},_0x5569be,_0x146028[_0x7254('0x40')]);var _0x18a918={'where':_0x5569be[_0x7254('0x3c')]};return db[_0x7254('0x2d')]['count'](_0x18a918)['then'](function(_0x25004f){_0x1279cd[_0x7254('0x1e')]=_0x25004f;if(_0x146028[_0x7254('0x33')][_0x7254('0x41')]){_0x5569be['include']=[{'all':!![]}];}return db['VoiceMail'][_0x7254('0x42')](_0x5569be);})['then'](function(_0x2ae22e){_0x1279cd[_0x7254('0x43')]=_0x2ae22e;return _0x1279cd;})[_0x7254('0x25')](respondWithFilteredResult(_0x2dba3f,_0x5569be))[_0x7254('0x44')](handleError(_0x2dba3f,null));};exports['show']=function(_0x4adf34,_0x467f31){var _0x3f6ead={'raw':!![],'where':{'id':_0x4adf34[_0x7254('0x45')]['id']}},_0x29b90c={};_0x29b90c[_0x7254('0x32')]=_['keys'](db['VoiceMail'][_0x7254('0x2e')]);_0x29b90c[_0x7254('0x33')]=_[_0x7254('0x46')](_0x4adf34['query']);_0x29b90c[_0x7254('0x34')]=_[_0x7254('0x35')](_0x29b90c['model'],_0x29b90c[_0x7254('0x33')]);_0x3f6ead[_0x7254('0x36')]=_[_0x7254('0x35')](_0x29b90c[_0x7254('0x32')],qs['fields'](_0x4adf34[_0x7254('0x33')][_0x7254('0x37')]));_0x3f6ead['attributes']=_0x3f6ead[_0x7254('0x36')][_0x7254('0x38')]?_0x3f6ead[_0x7254('0x36')]:_0x29b90c['model'];if(_0x4adf34[_0x7254('0x33')][_0x7254('0x41')]){_0x3f6ead['include']=[{'all':!![]}];}_0x3f6ead=_['merge']({},_0x3f6ead,_0x4adf34[_0x7254('0x40')]);return db['VoiceMail'][_0x7254('0x47')](_0x3f6ead)[_0x7254('0x25')](handleEntityNotFound(_0x467f31,null))['then'](respondWithResult(_0x467f31,null))['catch'](handleError(_0x467f31,null));};exports[_0x7254('0x48')]=function(_0xc40bc5,_0x38bcd5){return db[_0x7254('0x2d')][_0x7254('0x48')](_0xc40bc5[_0x7254('0x49')],{})['then'](function(_0x245213){var _0x5ef7f9=_0xc40bc5[_0x7254('0x4a')][_0x7254('0x27')]({'plain':!![]});if(!_0x5ef7f9)throw new Error(_0x7254('0x4b'));if(_0x5ef7f9['role']===_0x7254('0x4a')){var _0x1c1a0e=_0x245213[_0x7254('0x27')]({'plain':!![]});var _0x5b3b6e=_0x7254('0x28');return db[_0x7254('0x4c')][_0x7254('0x47')]({'where':{'name':_0x5b3b6e,'userProfileId':_0x5ef7f9[_0x7254('0x4d')]},'raw':!![]})[_0x7254('0x25')](function(_0x4e1e38){if(_0x4e1e38&&_0x4e1e38['autoAssociation']===0x0){return db[_0x7254('0x4e')][_0x7254('0x48')]({'name':_0x1c1a0e[_0x7254('0x2b')],'resourceId':_0x1c1a0e['id'],'type':_0x4e1e38[_0x7254('0x2b')],'sectionId':_0x4e1e38['id']},{})[_0x7254('0x25')](function(){return _0x245213;});}else{return _0x245213;}})['catch'](function(_0x5a44fb){logger[_0x7254('0x29')](_0x7254('0x4f'),_0x5a44fb);throw _0x5a44fb;});}return _0x245213;})[_0x7254('0x25')](respondWithResult(_0x38bcd5,0xc9))[_0x7254('0x44')](handleError(_0x38bcd5,null));};exports['update']=function(_0xaf6d3d,_0x3e3d09){if(_0xaf6d3d['body']['id']){delete _0xaf6d3d[_0x7254('0x49')]['id'];}return db['VoiceMail'][_0x7254('0x47')]({'where':{'id':_0xaf6d3d['params']['id']}})[_0x7254('0x25')](handleEntityNotFound(_0x3e3d09,null))['then'](saveUpdates(_0xaf6d3d['body'],null))[_0x7254('0x25')](respondWithResult(_0x3e3d09,null))[_0x7254('0x44')](handleError(_0x3e3d09,null));};exports[_0x7254('0x26')]=function(_0x1122e8,_0x4f6c9f){return db[_0x7254('0x2d')]['find']({'where':{'id':_0x1122e8[_0x7254('0x45')]['id']}})[_0x7254('0x25')](handleEntityNotFound(_0x4f6c9f,null))[_0x7254('0x25')](removeEntity(_0x4f6c9f,null))[_0x7254('0x44')](handleError(_0x4f6c9f,null));};exports[_0x7254('0x50')]=function(_0x283da0,_0x48b69a,_0x1ca394){return db[_0x7254('0x2d')][_0x7254('0x51')]({'where':{'id':_0x283da0[_0x7254('0x45')]['id']}})[_0x7254('0x25')](handleEntityNotFound(_0x48b69a,null))[_0x7254('0x25')](function(_0x556cad){var _0x2fe0b2;var _0x457f71={},_0x215304={};_0x215304[_0x7254('0x32')]=_[_0x7254('0x46')](db[_0x7254('0x52')][_0x7254('0x2e')]);_0x215304['query']=_['keys'](_0x283da0[_0x7254('0x33')]);_0x215304['filters']=_['intersection'](_0x215304[_0x7254('0x32')],_0x215304[_0x7254('0x33')]);_0x457f71[_0x7254('0x36')]=_['intersection'](_0x215304[_0x7254('0x32')],qs['fields'](_0x283da0[_0x7254('0x33')][_0x7254('0x37')]));_0x457f71[_0x7254('0x36')]=_0x457f71[_0x7254('0x36')][_0x7254('0x38')]?_0x457f71['attributes']:_0x215304[_0x7254('0x32')];if(!_0x283da0[_0x7254('0x33')][_0x7254('0x39')](_0x7254('0x3a'))){_0x457f71['limit']=qs['limit'](_0x283da0[_0x7254('0x33')][_0x7254('0x1d')]);_0x457f71[_0x7254('0x1b')]=qs[_0x7254('0x1b')](_0x283da0[_0x7254('0x33')][_0x7254('0x1b')]);}_0x457f71[_0x7254('0x3b')]=qs[_0x7254('0x53')](_0x283da0[_0x7254('0x33')][_0x7254('0x53')]);_0x457f71[_0x7254('0x3c')]=qs[_0x7254('0x34')](_[_0x7254('0x54')](_0x283da0['query'],_0x215304[_0x7254('0x34')]));if(_0x283da0[_0x7254('0x33')][_0x7254('0x3d')]){_0x457f71['where']=_[_0x7254('0x3e')](_0x457f71[_0x7254('0x3c')],{'$or':_[_0x7254('0x3f')](_0x457f71[_0x7254('0x36')],function(_0x49f62d){var _0x1d9238={};_0x1d9238[_0x49f62d]={'$like':'%'+_0x283da0['query'][_0x7254('0x3d')]+'%'};return _0x1d9238;})});}_0x457f71[_0x7254('0x3c')]=_[_0x7254('0x3e')](_0x457f71[_0x7254('0x3c')],{'mailboxuser':_0x556cad['mailbox']});_0x457f71=_[_0x7254('0x3e')]({},_0x457f71,_0x283da0['options']);return db[_0x7254('0x52')]['findAndCountAll'](_0x457f71)[_0x7254('0x25')](respondWithFilteredResult(_0x48b69a,_0x457f71));})[_0x7254('0x44')](handleError(_0x48b69a,null));}; \ No newline at end of file +var _0x0972=['find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getMessages','findOne','pick','mailbox','rimraf','fast-json-patch','moment','bluebird','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','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','update','then','destroy','get','Voicemails','error','stack','name','index','map','VoiceMail','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','include','findAll','rows','catch','params','length','options'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x0972,0x64));var _0x2097=function(_0x56cec4,_0x25edc1){_0x56cec4=_0x56cec4-0x0;var _0x24fc54=_0x0972[_0x56cec4];return _0x24fc54;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2097('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2097('0x1'));var rp=require('request-promise');var moment=require(_0x2097('0x2'));var BPromise=require(_0x2097('0x3'));var Mustache=require('mustache');var util=require(_0x2097('0x4'));var path=require(_0x2097('0x5'));var sox=require(_0x2097('0x6'));var csv=require(_0x2097('0x7'));var ejs=require(_0x2097('0x8'));var fs=require('fs');var fs_extra=require(_0x2097('0x9'));var _=require(_0x2097('0xa'));var squel=require('squel');var crypto=require(_0x2097('0xb'));var jsforce=require(_0x2097('0xc'));var deskjs=require(_0x2097('0xd'));var toCsv=require(_0x2097('0x7'));var querystring=require(_0x2097('0xe'));var Papa=require('papaparse');var Redis=require(_0x2097('0xf'));var authService=require(_0x2097('0x10'));var qs=require(_0x2097('0x11'));var as=require(_0x2097('0x12'));var hardwareService=require(_0x2097('0x13'));var logger=require(_0x2097('0x14'))(_0x2097('0x15'));var utils=require(_0x2097('0x16'));var config=require(_0x2097('0x17'));var licenseUtil=require(_0x2097('0x18'));var db=require(_0x2097('0x19'))['db'];function respondWithStatusCode(_0x3b2f94,_0x170005){_0x170005=_0x170005||0xcc;return function(_0x16871b){if(_0x16871b){return _0x3b2f94[_0x2097('0x1a')](_0x170005);}return _0x3b2f94[_0x2097('0x1b')](_0x170005)[_0x2097('0x1c')]();};}function respondWithResult(_0x1c9ef9,_0x2c3e41){_0x2c3e41=_0x2c3e41||0xc8;return function(_0x354387){if(_0x354387){return _0x1c9ef9['status'](_0x2c3e41)[_0x2097('0x1d')](_0x354387);}};}function respondWithFilteredResult(_0x35c062,_0x4d31bc){return function(_0x4eec05){if(_0x4eec05){var _0x4fc8c5=typeof _0x4d31bc[_0x2097('0x1e')]==='undefined'&&typeof _0x4d31bc[_0x2097('0x1f')]===_0x2097('0x20');var _0x43fec9=_0x4eec05[_0x2097('0x21')];var _0x44c584=_0x4fc8c5?0x0:_0x4d31bc['offset'];var _0x324652=_0x4fc8c5?_0x4eec05[_0x2097('0x21')]:_0x4d31bc[_0x2097('0x1e')]+_0x4d31bc[_0x2097('0x1f')];var _0x1d3804;if(_0x324652>=_0x43fec9){_0x324652=_0x43fec9;_0x1d3804=0xc8;}else{_0x1d3804=0xce;}_0x35c062[_0x2097('0x1b')](_0x1d3804);return _0x35c062[_0x2097('0x22')](_0x2097('0x23'),_0x44c584+'-'+_0x324652+'/'+_0x43fec9)['json'](_0x4eec05);}return null;};}function patchUpdates(_0x4d957e){return function(_0xf65dc6){try{jsonpatch['apply'](_0xf65dc6,_0x4d957e,!![]);}catch(_0x227c00){return BPromise[_0x2097('0x24')](_0x227c00);}return _0xf65dc6['save']();};}function saveUpdates(_0x442db7,_0x5b0582){return function(_0x2e17c8){if(_0x2e17c8){return _0x2e17c8[_0x2097('0x25')](_0x442db7)[_0x2097('0x26')](function(_0x20b93a){return _0x20b93a;});}return null;};}function removeEntity(_0x36b15e,_0x35047b){return function(_0x56390a){if(_0x56390a){return _0x56390a[_0x2097('0x27')]()['then'](function(){var _0x3f9279=_0x56390a[_0x2097('0x28')]({'plain':!![]});var _0x345875=_0x2097('0x29');return db['UserProfileResource'][_0x2097('0x27')]({'where':{'type':_0x345875,'resourceId':_0x3f9279['id']}})[_0x2097('0x26')](function(){return _0x56390a;});})['then'](function(){_0x36b15e[_0x2097('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x29b879,_0x48ae06){return function(_0xbc0339){if(!_0xbc0339){_0x29b879[_0x2097('0x1a')](0x194);}return _0xbc0339;};}function handleError(_0x407a2a,_0x7eefb4){_0x7eefb4=_0x7eefb4||0x1f4;return function(_0x410afa){logger[_0x2097('0x2a')](_0x410afa[_0x2097('0x2b')]);if(_0x410afa['name']){delete _0x410afa[_0x2097('0x2c')];}_0x407a2a[_0x2097('0x1b')](_0x7eefb4)['send'](_0x410afa);};}exports[_0x2097('0x2d')]=function(_0x41487d,_0x59fb84){var _0x4d0916={},_0x312c77={},_0x11b051={'count':0x0,'rows':[]};var _0x1649c8=_[_0x2097('0x2e')](db[_0x2097('0x2f')][_0x2097('0x30')],function(_0x56c538){return{'name':_0x56c538[_0x2097('0x31')],'type':_0x56c538['type'][_0x2097('0x32')]};});_0x312c77[_0x2097('0x33')]=_[_0x2097('0x2e')](_0x1649c8,_0x2097('0x2c'));_0x312c77[_0x2097('0x34')]=_[_0x2097('0x35')](_0x41487d[_0x2097('0x34')]);_0x312c77[_0x2097('0x36')]=_[_0x2097('0x37')](_0x312c77['model'],_0x312c77[_0x2097('0x34')]);_0x4d0916[_0x2097('0x38')]=_[_0x2097('0x37')](_0x312c77['model'],qs[_0x2097('0x39')](_0x41487d[_0x2097('0x34')][_0x2097('0x39')]));_0x4d0916[_0x2097('0x38')]=_0x4d0916['attributes']['length']?_0x4d0916['attributes']:_0x312c77[_0x2097('0x33')];if(!_0x41487d[_0x2097('0x34')][_0x2097('0x3a')](_0x2097('0x3b'))){_0x4d0916[_0x2097('0x1f')]=qs[_0x2097('0x1f')](_0x41487d['query'][_0x2097('0x1f')]);_0x4d0916[_0x2097('0x1e')]=qs[_0x2097('0x1e')](_0x41487d[_0x2097('0x34')][_0x2097('0x1e')]);}_0x4d0916[_0x2097('0x3c')]=qs['sort'](_0x41487d[_0x2097('0x34')][_0x2097('0x3d')]);_0x4d0916[_0x2097('0x3e')]=qs['filters'](_['pick'](_0x41487d[_0x2097('0x34')],_0x312c77[_0x2097('0x36')]),_0x1649c8);if(_0x41487d[_0x2097('0x34')][_0x2097('0x3f')]){_0x4d0916[_0x2097('0x3e')]=_[_0x2097('0x40')](_0x4d0916[_0x2097('0x3e')],{'$or':_[_0x2097('0x2e')](_0x1649c8,function(_0x23c4a5){if(_0x23c4a5[_0x2097('0x41')]!==_0x2097('0x42')){var _0x1ef92a={};_0x1ef92a[_0x23c4a5['name']]={'$like':'%'+_0x41487d[_0x2097('0x34')][_0x2097('0x3f')]+'%'};return _0x1ef92a;}})});}_0x4d0916=_[_0x2097('0x40')]({},_0x4d0916,_0x41487d['options']);var _0x1394df={'where':_0x4d0916[_0x2097('0x3e')]};return db[_0x2097('0x2f')][_0x2097('0x21')](_0x1394df)[_0x2097('0x26')](function(_0xd4d89e){_0x11b051[_0x2097('0x21')]=_0xd4d89e;if(_0x41487d[_0x2097('0x34')]['includeAll']){_0x4d0916[_0x2097('0x43')]=[{'all':!![]}];}return db[_0x2097('0x2f')][_0x2097('0x44')](_0x4d0916);})[_0x2097('0x26')](function(_0x12e0e2){_0x11b051[_0x2097('0x45')]=_0x12e0e2;return _0x11b051;})[_0x2097('0x26')](respondWithFilteredResult(_0x59fb84,_0x4d0916))[_0x2097('0x46')](handleError(_0x59fb84,null));};exports['show']=function(_0x3fc3fe,_0x5869d8){var _0x3e0739={'raw':!![],'where':{'id':_0x3fc3fe[_0x2097('0x47')]['id']}},_0x298e49={};_0x298e49[_0x2097('0x33')]=_[_0x2097('0x35')](db['VoiceMail'][_0x2097('0x30')]);_0x298e49[_0x2097('0x34')]=_[_0x2097('0x35')](_0x3fc3fe[_0x2097('0x34')]);_0x298e49[_0x2097('0x36')]=_['intersection'](_0x298e49[_0x2097('0x33')],_0x298e49[_0x2097('0x34')]);_0x3e0739[_0x2097('0x38')]=_[_0x2097('0x37')](_0x298e49[_0x2097('0x33')],qs[_0x2097('0x39')](_0x3fc3fe[_0x2097('0x34')][_0x2097('0x39')]));_0x3e0739['attributes']=_0x3e0739[_0x2097('0x38')][_0x2097('0x48')]?_0x3e0739[_0x2097('0x38')]:_0x298e49[_0x2097('0x33')];if(_0x3fc3fe['query']['includeAll']){_0x3e0739['include']=[{'all':!![]}];}_0x3e0739=_[_0x2097('0x40')]({},_0x3e0739,_0x3fc3fe[_0x2097('0x49')]);return db['VoiceMail'][_0x2097('0x4a')](_0x3e0739)[_0x2097('0x26')](handleEntityNotFound(_0x5869d8,null))['then'](respondWithResult(_0x5869d8,null))['catch'](handleError(_0x5869d8,null));};exports[_0x2097('0x4b')]=function(_0x21829d,_0x1b4de6){return db['VoiceMail'][_0x2097('0x4b')](_0x21829d[_0x2097('0x4c')],{})['then'](function(_0x86a05a){var _0x2682a9=_0x21829d[_0x2097('0x4d')][_0x2097('0x28')]({'plain':!![]});if(!_0x2682a9)throw new Error(_0x2097('0x4e'));if(_0x2682a9['role']==='user'){var _0x140b41=_0x86a05a[_0x2097('0x28')]({'plain':!![]});var _0x329632='Voicemails';return db['UserProfileSection'][_0x2097('0x4a')]({'where':{'name':_0x329632,'userProfileId':_0x2682a9[_0x2097('0x4f')]},'raw':!![]})['then'](function(_0x41cd90){if(_0x41cd90&&_0x41cd90[_0x2097('0x50')]===0x0){return db[_0x2097('0x51')][_0x2097('0x4b')]({'name':_0x140b41[_0x2097('0x2c')],'resourceId':_0x140b41['id'],'type':_0x41cd90['name'],'sectionId':_0x41cd90['id']},{})[_0x2097('0x26')](function(){return _0x86a05a;});}else{return _0x86a05a;}})[_0x2097('0x46')](function(_0x190859){logger['error'](_0x2097('0x52'),_0x190859);throw _0x190859;});}return _0x86a05a;})[_0x2097('0x26')](respondWithResult(_0x1b4de6,0xc9))['catch'](handleError(_0x1b4de6,null));};exports[_0x2097('0x25')]=function(_0x4d6ed6,_0x30b4cd){if(_0x4d6ed6['body']['id']){delete _0x4d6ed6['body']['id'];}return db['VoiceMail'][_0x2097('0x4a')]({'where':{'id':_0x4d6ed6['params']['id']}})['then'](handleEntityNotFound(_0x30b4cd,null))[_0x2097('0x26')](saveUpdates(_0x4d6ed6['body'],null))[_0x2097('0x26')](respondWithResult(_0x30b4cd,null))[_0x2097('0x46')](handleError(_0x30b4cd,null));};exports['destroy']=function(_0x3e799f,_0x3e2e45){return db[_0x2097('0x2f')][_0x2097('0x4a')]({'where':{'id':_0x3e799f[_0x2097('0x47')]['id']}})['then'](handleEntityNotFound(_0x3e2e45,null))[_0x2097('0x26')](removeEntity(_0x3e2e45,null))['catch'](handleError(_0x3e2e45,null));};exports[_0x2097('0x53')]=function(_0x140e43,_0x24f166,_0x55e3cd){return db[_0x2097('0x2f')][_0x2097('0x54')]({'where':{'id':_0x140e43[_0x2097('0x47')]['id']}})[_0x2097('0x26')](handleEntityNotFound(_0x24f166,null))[_0x2097('0x26')](function(_0x56cfbf){var _0x5b9fa2;var _0x265eac={},_0x275578={};_0x275578['model']=_['keys'](db['VoiceMailMessage']['rawAttributes']);_0x275578[_0x2097('0x34')]=_['keys'](_0x140e43[_0x2097('0x34')]);_0x275578[_0x2097('0x36')]=_['intersection'](_0x275578[_0x2097('0x33')],_0x275578[_0x2097('0x34')]);_0x265eac[_0x2097('0x38')]=_[_0x2097('0x37')](_0x275578[_0x2097('0x33')],qs[_0x2097('0x39')](_0x140e43[_0x2097('0x34')][_0x2097('0x39')]));_0x265eac[_0x2097('0x38')]=_0x265eac['attributes'][_0x2097('0x48')]?_0x265eac[_0x2097('0x38')]:_0x275578[_0x2097('0x33')];if(!_0x140e43[_0x2097('0x34')][_0x2097('0x3a')](_0x2097('0x3b'))){_0x265eac['limit']=qs[_0x2097('0x1f')](_0x140e43[_0x2097('0x34')][_0x2097('0x1f')]);_0x265eac[_0x2097('0x1e')]=qs[_0x2097('0x1e')](_0x140e43['query'][_0x2097('0x1e')]);}_0x265eac[_0x2097('0x3c')]=qs['sort'](_0x140e43['query']['sort']);_0x265eac[_0x2097('0x3e')]=qs[_0x2097('0x36')](_[_0x2097('0x55')](_0x140e43[_0x2097('0x34')],_0x275578[_0x2097('0x36')]));if(_0x140e43[_0x2097('0x34')][_0x2097('0x3f')]){_0x265eac[_0x2097('0x3e')]=_[_0x2097('0x40')](_0x265eac['where'],{'$or':_['map'](_0x265eac[_0x2097('0x38')],function(_0x34d832){var _0x1eeb30={};_0x1eeb30[_0x34d832]={'$like':'%'+_0x140e43[_0x2097('0x34')][_0x2097('0x3f')]+'%'};return _0x1eeb30;})});}_0x265eac[_0x2097('0x3e')]=_['merge'](_0x265eac[_0x2097('0x3e')],{'mailboxuser':_0x56cfbf[_0x2097('0x56')]});_0x265eac=_[_0x2097('0x40')]({},_0x265eac,_0x140e43[_0x2097('0x49')]);return db['VoiceMailMessage']['findAndCountAll'](_0x265eac)[_0x2097('0x26')](respondWithFilteredResult(_0x24f166,_0x265eac));})[_0x2097('0x46')](handleError(_0x24f166,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index a9de769..2f8ac49 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 _0x8593=['rimraf','../../config/environment','exports','define','voice_voicemail','mailbox_context','lodash','../../config/logger'];(function(_0x59376a,_0x7baa6e){var _0x4196c8=function(_0x4d7c65){while(--_0x4d7c65){_0x59376a['push'](_0x59376a['shift']());}};_0x4196c8(++_0x7baa6e);}(_0x8593,0xee));var _0x3859=function(_0x13b02f,_0x462a53){_0x13b02f=_0x13b02f-0x0;var _0x12e9a6=_0x8593[_0x13b02f];return _0x12e9a6;};'use strict';var _=require(_0x3859('0x0'));var util=require('util');var logger=require(_0x3859('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x3859('0x2'));var config=require(_0x3859('0x3'));var attributes=require('./voiceMail.attributes');module[_0x3859('0x4')]=function(_0x30919a,_0x2b231c){return _0x30919a[_0x3859('0x5')]('VoiceMail',attributes,{'tableName':_0x3859('0x6'),'paranoid':![],'indexes':[{'name':_0x3859('0x7'),'fields':['mailbox','context']}],'timestamps':!![]});}; \ No newline at end of file +var _0x36e3=['bluebird','request-promise','path','rimraf','../../config/environment','./voiceMail.attributes','exports','define','voice_voicemail','mailbox','util','../../config/logger','api','moment'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x36e3,0x1bc));var _0x336e=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0x36e3[_0x187ee1];return _0x388160;};'use strict';var _=require('lodash');var util=require(_0x336e('0x0'));var logger=require(_0x336e('0x1'))(_0x336e('0x2'));var moment=require(_0x336e('0x3'));var BPromise=require(_0x336e('0x4'));var rp=require(_0x336e('0x5'));var fs=require('fs');var path=require(_0x336e('0x6'));var rimraf=require(_0x336e('0x7'));var config=require(_0x336e('0x8'));var attributes=require(_0x336e('0x9'));module[_0x336e('0xa')]=function(_0xbb557,_0x1d571e){return _0xbb557[_0x336e('0xb')]('VoiceMail',attributes,{'tableName':_0x336e('0xc'),'paranoid':![],'indexes':[{'name':'mailbox_context','fields':[_0x336e('0xd'),'context']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index 5b5df30..6460c56 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 _0xf7b1=['stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s'];(function(_0xe695fa,_0x387982){var _0x48660b=function(_0x53cda4){while(--_0x53cda4){_0xe695fa['push'](_0xe695fa['shift']());}};_0x48660b(++_0x387982);}(_0xf7b1,0x1e9));var _0x1f7b=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0xf7b1[_0x8de54f];return _0x14cba4;};'use strict';var _=require(_0x1f7b('0x0'));var util=require(_0x1f7b('0x1'));var moment=require(_0x1f7b('0x2'));var BPromise=require(_0x1f7b('0x3'));var rs=require(_0x1f7b('0x4'));var fs=require('fs');var Redis=require(_0x1f7b('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x1f7b('0x6'))(_0x1f7b('0x7'));var config=require(_0x1f7b('0x8'));var jayson=require(_0x1f7b('0x9'));var client=jayson[_0x1f7b('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2acae7,_0x3768f3,_0x466230){return new BPromise(function(_0x2ffd99,_0x41ed2f){return client[_0x1f7b('0xb')](_0x2acae7,_0x466230)['then'](function(_0x237654){logger[_0x1f7b('0xc')](_0x1f7b('0xd'),_0x3768f3,_0x1f7b('0xe'));logger[_0x1f7b('0xf')](_0x1f7b('0x10'),_0x3768f3,_0x1f7b('0xe'),JSON[_0x1f7b('0x11')](_0x237654));if(_0x237654[_0x1f7b('0x12')]){if(_0x237654[_0x1f7b('0x12')][_0x1f7b('0x13')]===0x1f4){logger[_0x1f7b('0x12')](_0x1f7b('0xd'),_0x3768f3,_0x237654[_0x1f7b('0x12')][_0x1f7b('0x14')]);return _0x41ed2f(_0x237654[_0x1f7b('0x12')][_0x1f7b('0x14')]);}logger[_0x1f7b('0x12')](_0x1f7b('0xd'),_0x3768f3,_0x237654['error'][_0x1f7b('0x14')]);return _0x2ffd99(_0x237654[_0x1f7b('0x12')]['message']);}else{logger[_0x1f7b('0xc')](_0x1f7b('0xd'),_0x3768f3,_0x1f7b('0xe'));_0x2ffd99(_0x237654[_0x1f7b('0x15')][_0x1f7b('0x14')]);}})[_0x1f7b('0x16')](function(_0x62239c){logger[_0x1f7b('0x12')](_0x1f7b('0xd'),_0x3768f3,_0x62239c);_0x41ed2f(_0x62239c);});});} \ No newline at end of file +var _0xeedd=['VoiceMail,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x24915b,_0x5e84dc){var _0x4f025e=function(_0x5d0777){while(--_0x5d0777){_0x24915b['push'](_0x24915b['shift']());}};_0x4f025e(++_0x5e84dc);}(_0xeedd,0x18e));var _0xdeed=function(_0x1de1ec,_0x404b86){_0x1de1ec=_0x1de1ec-0x0;var _0x3c472b=_0xeedd[_0x1de1ec];return _0x3c472b;};'use strict';var _=require(_0xdeed('0x0'));var util=require(_0xdeed('0x1'));var moment=require(_0xdeed('0x2'));var BPromise=require(_0xdeed('0x3'));var rs=require(_0xdeed('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdeed('0x5'))['db'];var utils=require(_0xdeed('0x6'));var logger=require(_0xdeed('0x7'))(_0xdeed('0x8'));var config=require(_0xdeed('0x9'));var jayson=require(_0xdeed('0xa'));var client=jayson[_0xdeed('0xb')][_0xdeed('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x57b332,_0x3f1177,_0x200dc8){return new BPromise(function(_0xd64e8a,_0x21d5b0){return client[_0xdeed('0xd')](_0x57b332,_0x200dc8)[_0xdeed('0xe')](function(_0x237001){logger[_0xdeed('0xf')](_0xdeed('0x10'),_0x3f1177,_0xdeed('0x11'));logger[_0xdeed('0x12')]('VoiceMail,\x20%s,\x20%s,\x20%s',_0x3f1177,_0xdeed('0x11'),JSON['stringify'](_0x237001));if(_0x237001['error']){if(_0x237001[_0xdeed('0x13')][_0xdeed('0x14')]===0x1f4){logger[_0xdeed('0x13')](_0xdeed('0x10'),_0x3f1177,_0x237001[_0xdeed('0x13')][_0xdeed('0x15')]);return _0x21d5b0(_0x237001[_0xdeed('0x13')][_0xdeed('0x15')]);}logger[_0xdeed('0x13')](_0xdeed('0x10'),_0x3f1177,_0x237001['error'][_0xdeed('0x15')]);return _0xd64e8a(_0x237001[_0xdeed('0x13')][_0xdeed('0x15')]);}else{logger[_0xdeed('0xf')](_0xdeed('0x10'),_0x3f1177,_0xdeed('0x11'));_0xd64e8a(_0x237001[_0xdeed('0x16')][_0xdeed('0x15')]);}})['catch'](function(_0x5af97d){logger['error']('VoiceMail,\x20%s,\x20%s',_0x3f1177,_0x5af97d);_0x21d5b0(_0x5af97d);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index ef001f2..8b4546a 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 _0x7bde=['isAuthenticated','index','/:id','show','/:id/download','download','post','create','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','get'];(function(_0x315bd5,_0x2419be){var _0x2a2207=function(_0x408742){while(--_0x408742){_0x315bd5['push'](_0x315bd5['shift']());}};_0x2a2207(++_0x2419be);}(_0x7bde,0x82));var _0xe7bd=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0x7bde[_0x3b5250];return _0xc844a1;};'use strict';var multer=require(_0xe7bd('0x0'));var util=require(_0xe7bd('0x1'));var path=require('path');var timeout=require(_0xe7bd('0x2'));var express=require(_0xe7bd('0x3'));var router=express[_0xe7bd('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xe7bd('0x5'));var interaction=require(_0xe7bd('0x6'));var config=require(_0xe7bd('0x7'));var controller=require(_0xe7bd('0x8'));router[_0xe7bd('0x9')]('/',auth[_0xe7bd('0xa')](),controller[_0xe7bd('0xb')]);router[_0xe7bd('0x9')](_0xe7bd('0xc'),auth[_0xe7bd('0xa')](),controller[_0xe7bd('0xd')]);router[_0xe7bd('0x9')](_0xe7bd('0xe'),auth[_0xe7bd('0xa')](),controller[_0xe7bd('0xf')]);router[_0xe7bd('0x10')]('/',auth['isAuthenticated'](),controller[_0xe7bd('0x11')]);router['put'](_0xe7bd('0xc'),auth[_0xe7bd('0xa')](),controller['update']);router['delete'](_0xe7bd('0xc'),auth[_0xe7bd('0xa')](),controller[_0xe7bd('0x12')]);module[_0xe7bd('0x13')]=router; \ No newline at end of file +var _0xc176=['fs-extra','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','get','isAuthenticated','index','show','/:id/download','post','create','put','/:id','update','destroy','multer','util','path','Router'];(function(_0x30691f,_0x3399df){var _0xa31f5a=function(_0x5a1179){while(--_0x5a1179){_0x30691f['push'](_0x30691f['shift']());}};_0xa31f5a(++_0x3399df);}(_0xc176,0xa7));var _0x6c17=function(_0x2261ce,_0x9ed8b6){_0x2261ce=_0x2261ce-0x0;var _0x524640=_0xc176[_0x2261ce];return _0x524640;};'use strict';var multer=require(_0x6c17('0x0'));var util=require(_0x6c17('0x1'));var path=require(_0x6c17('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x6c17('0x3')]();var fs_extra=require(_0x6c17('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x6c17('0x5'));var config=require(_0x6c17('0x6'));var controller=require(_0x6c17('0x7'));router[_0x6c17('0x8')]('/',auth[_0x6c17('0x9')](),controller[_0x6c17('0xa')]);router[_0x6c17('0x8')]('/:id',auth[_0x6c17('0x9')](),controller[_0x6c17('0xb')]);router[_0x6c17('0x8')](_0x6c17('0xc'),auth['isAuthenticated'](),controller['download']);router[_0x6c17('0xd')]('/',auth[_0x6c17('0x9')](),controller[_0x6c17('0xe')]);router[_0x6c17('0xf')](_0x6c17('0x10'),auth['isAuthenticated'](),controller[_0x6c17('0x11')]);router['delete'](_0x6c17('0x10'),auth[_0x6c17('0x9')](),controller[_0x6c17('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index 839e108..9a21299 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 _0xacb3=['getDataValue','INTEGER','STRING','BLOB','long','TIMESTAMP','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','exports','VIRTUAL'];(function(_0x598122,_0x5eab29){var _0x2b817f=function(_0x496e0e){while(--_0x496e0e){_0x598122['push'](_0x598122['shift']());}};_0x2b817f(++_0x5eab29);}(_0xacb3,0x1ec));var _0x3acb=function(_0x52d74f,_0x4b101e){_0x52d74f=_0x52d74f-0x0;var _0x5a59f3=_0xacb3[_0x52d74f];return _0x5a59f3;};'use strict';var Sequelize=require(_0x3acb('0x0'));module[_0x3acb('0x1')]={'name':{'type':Sequelize[_0x3acb('0x2')],'get':function(_0x12cffb){return this[_0x3acb('0x3')]('id');}},'msgnum':{'type':Sequelize[_0x3acb('0x4')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x3acb('0x5')],'defaultValue':''},'context':{'type':Sequelize[_0x3acb('0x5')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x3acb('0x5')],'defaultValue':''},'callerid':{'type':Sequelize[_0x3acb('0x5')],'defaultValue':''},'origtime':{'type':Sequelize[_0x3acb('0x5')],'defaultValue':''},'duration':{'type':Sequelize[_0x3acb('0x5')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x3acb('0x5')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x3acb('0x5')],'defaultValue':''},'recording':{'type':Sequelize[_0x3acb('0x6')](_0x3acb('0x7')),'defaultValue':null},'flag':{'type':Sequelize[_0x3acb('0x5')],'defaultValue':''},'msg_id':{'type':Sequelize[_0x3acb('0x5')],'defaultValue':''},'stamp':{'type':_0x3acb('0x8'),'defaultValue':Sequelize[_0x3acb('0x9')](_0x3acb('0xa'))}}; \ No newline at end of file +var _0xda3e=['STRING','BLOB','long','TIMESTAMP','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','exports','VIRTUAL','getDataValue','INTEGER'];(function(_0x317333,_0x24651f){var _0x30bb0a=function(_0x20a2de){while(--_0x20a2de){_0x317333['push'](_0x317333['shift']());}};_0x30bb0a(++_0x24651f);}(_0xda3e,0xa5));var _0xeda3=function(_0x369adf,_0x52a17a){_0x369adf=_0x369adf-0x0;var _0x1da81c=_0xda3e[_0x369adf];return _0x1da81c;};'use strict';var Sequelize=require(_0xeda3('0x0'));module[_0xeda3('0x1')]={'name':{'type':Sequelize[_0xeda3('0x2')],'get':function(_0x2e4d3e){return this[_0xeda3('0x3')]('id');}},'msgnum':{'type':Sequelize[_0xeda3('0x4')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xeda3('0x5')],'defaultValue':''},'context':{'type':Sequelize['STRING'],'defaultValue':''},'macrocontext':{'type':Sequelize[_0xeda3('0x5')],'defaultValue':''},'callerid':{'type':Sequelize[_0xeda3('0x5')],'defaultValue':''},'origtime':{'type':Sequelize['STRING'],'defaultValue':''},'duration':{'type':Sequelize[_0xeda3('0x5')],'defaultValue':''},'mailboxuser':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0xeda3('0x5')],'defaultValue':''},'recording':{'type':Sequelize[_0xeda3('0x6')](_0xeda3('0x7')),'defaultValue':null},'flag':{'type':Sequelize[_0xeda3('0x5')],'defaultValue':''},'msg_id':{'type':Sequelize[_0xeda3('0x5')],'defaultValue':''},'stamp':{'type':_0xeda3('0x8'),'defaultValue':Sequelize['literal'](_0xeda3('0x9'))}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index 672f5ba..b7cdf86 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 _0x4e18=['filter','merge','type','VIRTUAL','options','then','includeAll','params','include','find','catch','update','body','download','recording','Sequelize','ValidationError','msg_id','Content-Disposition','.wav\x22','send','eml-format','zip-dir','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','save','destroy','error','stack','name','index','map','VoiceMailMessage','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where'];(function(_0xcee930,_0x198600){var _0x2d2d07=function(_0xd529b9){while(--_0xd529b9){_0xcee930['push'](_0xcee930['shift']());}};_0x2d2d07(++_0x198600);}(_0x4e18,0x105));var _0x84e1=function(_0x2d34d6,_0x397ff9){_0x2d34d6=_0x2d34d6-0x0;var _0x1d3d12=_0x4e18[_0x2d34d6];return _0x1d3d12;};'use strict';var emlformat=require(_0x84e1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x84e1('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x84e1('0x2'));var moment=require(_0x84e1('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x84e1('0x4'));var util=require(_0x84e1('0x5'));var path=require(_0x84e1('0x6'));var sox=require('sox');var csv=require(_0x84e1('0x7'));var ejs=require(_0x84e1('0x8'));var fs=require('fs');var fs_extra=require(_0x84e1('0x9'));var _=require(_0x84e1('0xa'));var squel=require(_0x84e1('0xb'));var crypto=require(_0x84e1('0xc'));var jsforce=require(_0x84e1('0xd'));var deskjs=require(_0x84e1('0xe'));var toCsv=require('to-csv');var querystring=require(_0x84e1('0xf'));var Papa=require('papaparse');var Redis=require(_0x84e1('0x10'));var authService=require(_0x84e1('0x11'));var qs=require(_0x84e1('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x84e1('0x13'));var logger=require(_0x84e1('0x14'))(_0x84e1('0x15'));var utils=require(_0x84e1('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x84e1('0x17'));var db=require(_0x84e1('0x18'))['db'];function respondWithStatusCode(_0x5cf8c6,_0x56f880){_0x56f880=_0x56f880||0xcc;return function(_0x110af1){if(_0x110af1){return _0x5cf8c6[_0x84e1('0x19')](_0x56f880);}return _0x5cf8c6['status'](_0x56f880)[_0x84e1('0x1a')]();};}function respondWithResult(_0x2cfe1c,_0x2a1b84){_0x2a1b84=_0x2a1b84||0xc8;return function(_0x240a87){if(_0x240a87){return _0x2cfe1c['status'](_0x2a1b84)[_0x84e1('0x1b')](_0x240a87);}};}function respondWithFilteredResult(_0x445404,_0x57a9a3){return function(_0x140610){if(_0x140610){var _0xffe155=typeof _0x57a9a3[_0x84e1('0x1c')]===_0x84e1('0x1d')&&typeof _0x57a9a3[_0x84e1('0x1e')]===_0x84e1('0x1d');var _0x15eb4c=_0x140610[_0x84e1('0x1f')];var _0x3edc8e=_0xffe155?0x0:_0x57a9a3['offset'];var _0x82422c=_0xffe155?_0x140610['count']:_0x57a9a3['offset']+_0x57a9a3[_0x84e1('0x1e')];var _0x49e14e;if(_0x82422c>=_0x15eb4c){_0x82422c=_0x15eb4c;_0x49e14e=0xc8;}else{_0x49e14e=0xce;}_0x445404[_0x84e1('0x20')](_0x49e14e);return _0x445404[_0x84e1('0x21')](_0x84e1('0x22'),_0x3edc8e+'-'+_0x82422c+'/'+_0x15eb4c)[_0x84e1('0x1b')](_0x140610);}return null;};}function patchUpdates(_0x365248){return function(_0x4bf169){try{jsonpatch[_0x84e1('0x23')](_0x4bf169,_0x365248,!![]);}catch(_0x5cb735){return BPromise['reject'](_0x5cb735);}return _0x4bf169[_0x84e1('0x24')]();};}function saveUpdates(_0x531d85,_0x5848ba){return function(_0x489895){if(_0x489895){return _0x489895['update'](_0x531d85)['then'](function(_0xe16ac3){return _0xe16ac3;});}return null;};}function removeEntity(_0x3de432,_0x37ac15){return function(_0x52d479){if(_0x52d479){return _0x52d479[_0x84e1('0x25')]()['then'](function(){_0x3de432['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4b8293,_0x1b46ff){return function(_0x232b5){if(!_0x232b5){_0x4b8293[_0x84e1('0x19')](0x194);}return _0x232b5;};}function handleError(_0x22c44a,_0x1d9e8d){_0x1d9e8d=_0x1d9e8d||0x1f4;return function(_0x46efca){logger[_0x84e1('0x26')](_0x46efca[_0x84e1('0x27')]);if(_0x46efca[_0x84e1('0x28')]){delete _0x46efca['name'];}_0x22c44a[_0x84e1('0x20')](_0x1d9e8d)['send'](_0x46efca);};}exports[_0x84e1('0x29')]=function(_0xe0260,_0x473ba7){var _0x45ea92={},_0xc0c9ca={},_0x143d63={'count':0x0,'rows':[]};var _0x526302=_[_0x84e1('0x2a')](db[_0x84e1('0x2b')][_0x84e1('0x2c')],function(_0x2cc716){return{'name':_0x2cc716[_0x84e1('0x2d')],'type':_0x2cc716['type'][_0x84e1('0x2e')]};});_0xc0c9ca[_0x84e1('0x2f')]=_['differenceBy'](_[_0x84e1('0x2a')](_0x526302,_0x84e1('0x28')),[_0x84e1('0x28')]);_0xc0c9ca[_0x84e1('0x30')]=_[_0x84e1('0x31')](_0xe0260[_0x84e1('0x30')]);_0xc0c9ca[_0x84e1('0x32')]=_[_0x84e1('0x33')](_0xc0c9ca['model'],_0xc0c9ca[_0x84e1('0x30')]);_0x45ea92[_0x84e1('0x34')]=_[_0x84e1('0x33')](_0xc0c9ca['model'],qs[_0x84e1('0x35')](_0xe0260[_0x84e1('0x30')][_0x84e1('0x35')]));_0x45ea92[_0x84e1('0x34')]=_0x45ea92[_0x84e1('0x34')][_0x84e1('0x36')]?_0x45ea92[_0x84e1('0x34')]:_0xc0c9ca['model'];if(!_0xe0260['query'][_0x84e1('0x37')](_0x84e1('0x38'))){_0x45ea92[_0x84e1('0x1e')]=qs['limit'](_0xe0260[_0x84e1('0x30')][_0x84e1('0x1e')]);_0x45ea92[_0x84e1('0x1c')]=qs[_0x84e1('0x1c')](_0xe0260['query'][_0x84e1('0x1c')]);}_0x45ea92['order']=qs['sort'](_0xe0260[_0x84e1('0x30')][_0x84e1('0x39')]);_0x45ea92[_0x84e1('0x3a')]=qs[_0x84e1('0x32')](_['pick'](_0xe0260['query'],_0xc0c9ca[_0x84e1('0x32')]),_0x526302);if(_0xe0260[_0x84e1('0x30')][_0x84e1('0x3b')]){_0x45ea92[_0x84e1('0x3a')]=_[_0x84e1('0x3c')](_0x45ea92[_0x84e1('0x3a')],{'$or':_[_0x84e1('0x2a')](_0x526302,function(_0x1c3d06){if(_0x1c3d06[_0x84e1('0x3d')]!==_0x84e1('0x3e')){var _0x39fd9f={};_0x39fd9f[_0x1c3d06[_0x84e1('0x28')]]={'$like':'%'+_0xe0260[_0x84e1('0x30')][_0x84e1('0x3b')]+'%'};return _0x39fd9f;}})});}_0x45ea92=_[_0x84e1('0x3c')]({},_0x45ea92,_0xe0260[_0x84e1('0x3f')]);var _0x116744={'where':_0x45ea92[_0x84e1('0x3a')]};return db[_0x84e1('0x2b')]['count'](_0x116744)[_0x84e1('0x40')](function(_0x56a102){_0x143d63[_0x84e1('0x1f')]=_0x56a102;if(_0xe0260[_0x84e1('0x30')][_0x84e1('0x41')]){_0x45ea92['include']=[{'all':!![]}];}return db[_0x84e1('0x2b')]['findAll'](_0x45ea92);})[_0x84e1('0x40')](function(_0x441ef8){_0x143d63['rows']=_0x441ef8;return _0x143d63;})['then'](respondWithFilteredResult(_0x473ba7,_0x45ea92))['catch'](handleError(_0x473ba7,null));};exports['show']=function(_0x2b8fdd,_0x311bdf){var _0x386726={'raw':!![],'where':{'id':_0x2b8fdd[_0x84e1('0x42')]['id']}},_0x242496={};_0x242496[_0x84e1('0x2f')]=_[_0x84e1('0x31')](db[_0x84e1('0x2b')][_0x84e1('0x2c')]);_0x242496[_0x84e1('0x30')]=_['keys'](_0x2b8fdd['query']);_0x242496[_0x84e1('0x32')]=_[_0x84e1('0x33')](_0x242496[_0x84e1('0x2f')],_0x242496[_0x84e1('0x30')]);_0x386726[_0x84e1('0x34')]=_[_0x84e1('0x33')](_0x242496[_0x84e1('0x2f')],qs['fields'](_0x2b8fdd['query'][_0x84e1('0x35')]));_0x386726[_0x84e1('0x34')]=_0x386726[_0x84e1('0x34')][_0x84e1('0x36')]?_0x386726[_0x84e1('0x34')]:_0x242496['model'];if(_0x2b8fdd[_0x84e1('0x30')][_0x84e1('0x41')]){_0x386726[_0x84e1('0x43')]=[{'all':!![]}];}_0x386726=_[_0x84e1('0x3c')]({},_0x386726,_0x2b8fdd[_0x84e1('0x3f')]);return db[_0x84e1('0x2b')][_0x84e1('0x44')](_0x386726)['then'](handleEntityNotFound(_0x311bdf,null))[_0x84e1('0x40')](respondWithResult(_0x311bdf,null))[_0x84e1('0x45')](handleError(_0x311bdf,null));};exports['create']=function(_0x4d6bd5,_0x3fa696){return db[_0x84e1('0x2b')]['create'](_0x4d6bd5['body'],{})['then'](respondWithResult(_0x3fa696,0xc9))[_0x84e1('0x45')](handleError(_0x3fa696,null));};exports[_0x84e1('0x46')]=function(_0x34510c,_0x12d5a1){if(_0x34510c['body']['id']){delete _0x34510c[_0x84e1('0x47')]['id'];}return db[_0x84e1('0x2b')][_0x84e1('0x44')]({'where':{'id':_0x34510c[_0x84e1('0x42')]['id']}})['then'](handleEntityNotFound(_0x12d5a1,null))[_0x84e1('0x40')](saveUpdates(_0x34510c['body'],null))['then'](respondWithResult(_0x12d5a1,null))['catch'](handleError(_0x12d5a1,null));};exports[_0x84e1('0x25')]=function(_0x311ce5,_0x2c4075){return db[_0x84e1('0x2b')][_0x84e1('0x44')]({'where':{'id':_0x311ce5[_0x84e1('0x42')]['id']}})[_0x84e1('0x40')](handleEntityNotFound(_0x2c4075,null))['then'](removeEntity(_0x2c4075,null))[_0x84e1('0x45')](handleError(_0x2c4075,null));};exports[_0x84e1('0x48')]=function(_0x3b2969,_0xdd9f3c,_0x4034cd){return db[_0x84e1('0x2b')][_0x84e1('0x44')]({'where':{'id':_0x3b2969[_0x84e1('0x42')]['id']},'attributes':['id',_0x84e1('0x49'),'msg_id']})[_0x84e1('0x40')](handleEntityNotFound(_0xdd9f3c,null))[_0x84e1('0x40')](function(_0x6590d3){if(_0x6590d3){if(!_0x6590d3['recording']){throw new db[(_0x84e1('0x4a'))][(_0x84e1('0x4b'))]('VoiceMailMessage\x20not\x20found');}var _0x2ccb80={'Content-Type':'audio/wav','Content-Disposition':'attachment'};if(_0x6590d3[_0x84e1('0x4c')]){_0x2ccb80[_0x84e1('0x4d')]='attachment;\x20filename=\x22'+_0x6590d3['msg_id']+_0x84e1('0x4e');}_0xdd9f3c[_0x84e1('0x21')](_0x2ccb80);return _0xdd9f3c[_0x84e1('0x4f')](new Buffer(_0x6590d3[_0x84e1('0x49')]));}})[_0x84e1('0x45')](handleError(_0xdd9f3c,null));}; \ No newline at end of file +var _0x8bbd=['zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','fs-extra','lodash','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','destroy','then','end','stack','name','send','index','VoiceMailMessage','rawAttributes','fieldName','type','key','model','differenceBy','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','includeAll','findAll','rows','show','params','include','options','find','catch','create','body','download','recording','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment','msg_id','attachment;\x20filename=\x22','.wav\x22','eml-format'];(function(_0x18bca7,_0x13ccb8){var _0x1158e5=function(_0x323ba2){while(--_0x323ba2){_0x18bca7['push'](_0x18bca7['shift']());}};_0x1158e5(++_0x13ccb8);}(_0x8bbd,0x1b2));var _0xd8bb=function(_0xc30849,_0x2f0f1a){_0xc30849=_0xc30849-0x0;var _0x9eb24f=_0x8bbd[_0xc30849];return _0x9eb24f;};'use strict';var emlformat=require(_0xd8bb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd8bb('0x1'));var jsonpatch=require(_0xd8bb('0x2'));var rp=require(_0xd8bb('0x3'));var moment=require(_0xd8bb('0x4'));var BPromise=require(_0xd8bb('0x5'));var Mustache=require(_0xd8bb('0x6'));var util=require('util');var path=require(_0xd8bb('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd8bb('0x8'));var _=require(_0xd8bb('0x9'));var squel=require('squel');var crypto=require(_0xd8bb('0xa'));var jsforce=require(_0xd8bb('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xd8bb('0xc'));var querystring=require(_0xd8bb('0xd'));var Papa=require(_0xd8bb('0xe'));var Redis=require(_0xd8bb('0xf'));var authService=require(_0xd8bb('0x10'));var qs=require(_0xd8bb('0x11'));var as=require(_0xd8bb('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd8bb('0x13'))(_0xd8bb('0x14'));var utils=require(_0xd8bb('0x15'));var config=require(_0xd8bb('0x16'));var licenseUtil=require(_0xd8bb('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x492eb4,_0x6f3440){_0x6f3440=_0x6f3440||0xcc;return function(_0x2d2a48){if(_0x2d2a48){return _0x492eb4[_0xd8bb('0x18')](_0x6f3440);}return _0x492eb4[_0xd8bb('0x19')](_0x6f3440)['end']();};}function respondWithResult(_0x314589,_0x5b4b59){_0x5b4b59=_0x5b4b59||0xc8;return function(_0x32215d){if(_0x32215d){return _0x314589[_0xd8bb('0x19')](_0x5b4b59)['json'](_0x32215d);}};}function respondWithFilteredResult(_0x107402,_0x2c8262){return function(_0x447486){if(_0x447486){var _0x3e0669=typeof _0x2c8262[_0xd8bb('0x1a')]===_0xd8bb('0x1b')&&typeof _0x2c8262[_0xd8bb('0x1c')]==='undefined';var _0x89559a=_0x447486['count'];var _0x13c911=_0x3e0669?0x0:_0x2c8262[_0xd8bb('0x1a')];var _0x18bdb5=_0x3e0669?_0x447486[_0xd8bb('0x1d')]:_0x2c8262['offset']+_0x2c8262['limit'];var _0x17b9ae;if(_0x18bdb5>=_0x89559a){_0x18bdb5=_0x89559a;_0x17b9ae=0xc8;}else{_0x17b9ae=0xce;}_0x107402[_0xd8bb('0x19')](_0x17b9ae);return _0x107402[_0xd8bb('0x1e')](_0xd8bb('0x1f'),_0x13c911+'-'+_0x18bdb5+'/'+_0x89559a)[_0xd8bb('0x20')](_0x447486);}return null;};}function patchUpdates(_0xe2cafe){return function(_0x42fd27){try{jsonpatch[_0xd8bb('0x21')](_0x42fd27,_0xe2cafe,!![]);}catch(_0x5beea5){return BPromise[_0xd8bb('0x22')](_0x5beea5);}return _0x42fd27['save']();};}function saveUpdates(_0x45a991,_0x514ff8){return function(_0x4b17db){if(_0x4b17db){return _0x4b17db[_0xd8bb('0x23')](_0x45a991)['then'](function(_0x33b48e){return _0x33b48e;});}return null;};}function removeEntity(_0x2e2c90,_0x38b21f){return function(_0x13ca2c){if(_0x13ca2c){return _0x13ca2c[_0xd8bb('0x24')]()[_0xd8bb('0x25')](function(){_0x2e2c90[_0xd8bb('0x19')](0xcc)[_0xd8bb('0x26')]();});}};}function handleEntityNotFound(_0x49b1e3,_0x1994f9){return function(_0x32d760){if(!_0x32d760){_0x49b1e3['sendStatus'](0x194);}return _0x32d760;};}function handleError(_0x3b8e99,_0x2bf150){_0x2bf150=_0x2bf150||0x1f4;return function(_0x546341){logger['error'](_0x546341[_0xd8bb('0x27')]);if(_0x546341[_0xd8bb('0x28')]){delete _0x546341[_0xd8bb('0x28')];}_0x3b8e99['status'](_0x2bf150)[_0xd8bb('0x29')](_0x546341);};}exports[_0xd8bb('0x2a')]=function(_0x58413a,_0x7b62d6){var _0xd9edec={},_0x583ed9={},_0x1e0228={'count':0x0,'rows':[]};var _0x70ce8b=_['map'](db[_0xd8bb('0x2b')][_0xd8bb('0x2c')],function(_0x4d1b40){return{'name':_0x4d1b40[_0xd8bb('0x2d')],'type':_0x4d1b40[_0xd8bb('0x2e')][_0xd8bb('0x2f')]};});_0x583ed9[_0xd8bb('0x30')]=_[_0xd8bb('0x31')](_[_0xd8bb('0x32')](_0x70ce8b,'name'),[_0xd8bb('0x28')]);_0x583ed9[_0xd8bb('0x33')]=_[_0xd8bb('0x34')](_0x58413a['query']);_0x583ed9[_0xd8bb('0x35')]=_[_0xd8bb('0x36')](_0x583ed9[_0xd8bb('0x30')],_0x583ed9[_0xd8bb('0x33')]);_0xd9edec[_0xd8bb('0x37')]=_[_0xd8bb('0x36')](_0x583ed9[_0xd8bb('0x30')],qs['fields'](_0x58413a['query'][_0xd8bb('0x38')]));_0xd9edec['attributes']=_0xd9edec['attributes'][_0xd8bb('0x39')]?_0xd9edec[_0xd8bb('0x37')]:_0x583ed9['model'];if(!_0x58413a['query'][_0xd8bb('0x3a')](_0xd8bb('0x3b'))){_0xd9edec[_0xd8bb('0x1c')]=qs[_0xd8bb('0x1c')](_0x58413a['query']['limit']);_0xd9edec[_0xd8bb('0x1a')]=qs['offset'](_0x58413a[_0xd8bb('0x33')][_0xd8bb('0x1a')]);}_0xd9edec[_0xd8bb('0x3c')]=qs[_0xd8bb('0x3d')](_0x58413a[_0xd8bb('0x33')][_0xd8bb('0x3d')]);_0xd9edec[_0xd8bb('0x3e')]=qs[_0xd8bb('0x35')](_['pick'](_0x58413a['query'],_0x583ed9['filters']),_0x70ce8b);if(_0x58413a[_0xd8bb('0x33')][_0xd8bb('0x3f')]){_0xd9edec[_0xd8bb('0x3e')]=_['merge'](_0xd9edec[_0xd8bb('0x3e')],{'$or':_[_0xd8bb('0x32')](_0x70ce8b,function(_0x25a736){if(_0x25a736[_0xd8bb('0x2e')]!==_0xd8bb('0x40')){var _0x430d4e={};_0x430d4e[_0x25a736[_0xd8bb('0x28')]]={'$like':'%'+_0x58413a[_0xd8bb('0x33')]['filter']+'%'};return _0x430d4e;}})});}_0xd9edec=_[_0xd8bb('0x41')]({},_0xd9edec,_0x58413a['options']);var _0x1466dd={'where':_0xd9edec['where']};return db[_0xd8bb('0x2b')][_0xd8bb('0x1d')](_0x1466dd)[_0xd8bb('0x25')](function(_0x585c1a){_0x1e0228[_0xd8bb('0x1d')]=_0x585c1a;if(_0x58413a[_0xd8bb('0x33')][_0xd8bb('0x42')]){_0xd9edec['include']=[{'all':!![]}];}return db[_0xd8bb('0x2b')][_0xd8bb('0x43')](_0xd9edec);})[_0xd8bb('0x25')](function(_0x1b2cd2){_0x1e0228[_0xd8bb('0x44')]=_0x1b2cd2;return _0x1e0228;})[_0xd8bb('0x25')](respondWithFilteredResult(_0x7b62d6,_0xd9edec))['catch'](handleError(_0x7b62d6,null));};exports[_0xd8bb('0x45')]=function(_0x39faa0,_0x580cea){var _0x58a965={'raw':!![],'where':{'id':_0x39faa0[_0xd8bb('0x46')]['id']}},_0x454612={};_0x454612[_0xd8bb('0x30')]=_[_0xd8bb('0x34')](db[_0xd8bb('0x2b')][_0xd8bb('0x2c')]);_0x454612['query']=_[_0xd8bb('0x34')](_0x39faa0[_0xd8bb('0x33')]);_0x454612['filters']=_[_0xd8bb('0x36')](_0x454612[_0xd8bb('0x30')],_0x454612[_0xd8bb('0x33')]);_0x58a965[_0xd8bb('0x37')]=_[_0xd8bb('0x36')](_0x454612[_0xd8bb('0x30')],qs['fields'](_0x39faa0[_0xd8bb('0x33')][_0xd8bb('0x38')]));_0x58a965[_0xd8bb('0x37')]=_0x58a965['attributes'][_0xd8bb('0x39')]?_0x58a965[_0xd8bb('0x37')]:_0x454612[_0xd8bb('0x30')];if(_0x39faa0['query'][_0xd8bb('0x42')]){_0x58a965[_0xd8bb('0x47')]=[{'all':!![]}];}_0x58a965=_['merge']({},_0x58a965,_0x39faa0[_0xd8bb('0x48')]);return db[_0xd8bb('0x2b')][_0xd8bb('0x49')](_0x58a965)['then'](handleEntityNotFound(_0x580cea,null))['then'](respondWithResult(_0x580cea,null))[_0xd8bb('0x4a')](handleError(_0x580cea,null));};exports[_0xd8bb('0x4b')]=function(_0x48c2ce,_0x3631da){return db[_0xd8bb('0x2b')][_0xd8bb('0x4b')](_0x48c2ce[_0xd8bb('0x4c')],{})[_0xd8bb('0x25')](respondWithResult(_0x3631da,0xc9))[_0xd8bb('0x4a')](handleError(_0x3631da,null));};exports[_0xd8bb('0x23')]=function(_0x41a2ec,_0x5bde7a){if(_0x41a2ec[_0xd8bb('0x4c')]['id']){delete _0x41a2ec[_0xd8bb('0x4c')]['id'];}return db[_0xd8bb('0x2b')]['find']({'where':{'id':_0x41a2ec[_0xd8bb('0x46')]['id']}})[_0xd8bb('0x25')](handleEntityNotFound(_0x5bde7a,null))[_0xd8bb('0x25')](saveUpdates(_0x41a2ec[_0xd8bb('0x4c')],null))[_0xd8bb('0x25')](respondWithResult(_0x5bde7a,null))[_0xd8bb('0x4a')](handleError(_0x5bde7a,null));};exports[_0xd8bb('0x24')]=function(_0x3d0400,_0x26892f){return db[_0xd8bb('0x2b')][_0xd8bb('0x49')]({'where':{'id':_0x3d0400[_0xd8bb('0x46')]['id']}})['then'](handleEntityNotFound(_0x26892f,null))[_0xd8bb('0x25')](removeEntity(_0x26892f,null))[_0xd8bb('0x4a')](handleError(_0x26892f,null));};exports[_0xd8bb('0x4d')]=function(_0x15690f,_0x4653ee,_0x30faa0){return db[_0xd8bb('0x2b')][_0xd8bb('0x49')]({'where':{'id':_0x15690f[_0xd8bb('0x46')]['id']},'attributes':['id',_0xd8bb('0x4e'),'msg_id']})[_0xd8bb('0x25')](handleEntityNotFound(_0x4653ee,null))[_0xd8bb('0x25')](function(_0x32f87a){if(_0x32f87a){if(!_0x32f87a[_0xd8bb('0x4e')]){throw new db[(_0xd8bb('0x4f'))][(_0xd8bb('0x50'))](_0xd8bb('0x51'));}var _0x1c2ca0={'Content-Type':_0xd8bb('0x52'),'Content-Disposition':_0xd8bb('0x53')};if(_0x32f87a[_0xd8bb('0x54')]){_0x1c2ca0['Content-Disposition']=_0xd8bb('0x55')+_0x32f87a[_0xd8bb('0x54')]+_0xd8bb('0x56');}_0x4653ee[_0xd8bb('0x1e')](_0x1c2ca0);return _0x4653ee[_0xd8bb('0x29')](new Buffer(_0x32f87a[_0xd8bb('0x4e')]));}})[_0xd8bb('0x4a')](handleError(_0x4653ee,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 602789d..25270e3 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 _0xc504=['./voiceMailMessage.attributes','exports','voice_voicemail_messages','lodash','../../config/logger','api','moment','request-promise','rimraf'];(function(_0x2d8fc2,_0x1c461d){var _0x3a9e53=function(_0x18941c){while(--_0x18941c){_0x2d8fc2['push'](_0x2d8fc2['shift']());}};_0x3a9e53(++_0x1c461d);}(_0xc504,0x9c));var _0x4c50=function(_0xb3ac4b,_0x1cc36e){_0xb3ac4b=_0xb3ac4b-0x0;var _0x435c70=_0xc504[_0xb3ac4b];return _0x435c70;};'use strict';var _=require(_0x4c50('0x0'));var util=require('util');var logger=require(_0x4c50('0x1'))(_0x4c50('0x2'));var moment=require(_0x4c50('0x3'));var BPromise=require('bluebird');var rp=require(_0x4c50('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4c50('0x5'));var config=require('../../config/environment');var attributes=require(_0x4c50('0x6'));module[_0x4c50('0x7')]=function(_0xa1cee,_0x37cdae){return _0xa1cee['define']('VoiceMailMessage',attributes,{'tableName':_0x4c50('0x8'),'paranoid':![],'indexes':[{'name':'dir','fields':['dir']}],'timestamps':![]});}; \ No newline at end of file +var _0xc605=['VoiceMailMessage','dir','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./voiceMailMessage.attributes'];(function(_0x248c78,_0x282c82){var _0x50b4d3=function(_0xff1eb8){while(--_0xff1eb8){_0x248c78['push'](_0x248c78['shift']());}};_0x50b4d3(++_0x282c82);}(_0xc605,0x1a6));var _0x5c60=function(_0x3cc165,_0x1f80ad){_0x3cc165=_0x3cc165-0x0;var _0x1a0abe=_0xc605[_0x3cc165];return _0x1a0abe;};'use strict';var _=require(_0x5c60('0x0'));var util=require(_0x5c60('0x1'));var logger=require(_0x5c60('0x2'))(_0x5c60('0x3'));var moment=require(_0x5c60('0x4'));var BPromise=require(_0x5c60('0x5'));var rp=require(_0x5c60('0x6'));var fs=require('fs');var path=require(_0x5c60('0x7'));var rimraf=require('rimraf');var config=require(_0x5c60('0x8'));var attributes=require(_0x5c60('0x9'));module['exports']=function(_0x391f07,_0x2e1cc2){return _0x391f07['define'](_0x5c60('0xa'),attributes,{'tableName':'voice_voicemail_messages','paranoid':![],'indexes':[{'name':_0x5c60('0xb'),'fields':[_0x5c60('0xb')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index f9122c2..e4234b8 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 _0xfdad=['rpc','../../config/environment','jayson/promise','http','request','then','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','error','message','result','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0xfdad,0x1c7));var _0xdfda=function(_0x1a2b4d,_0x4ba7ad){_0x1a2b4d=_0x1a2b4d-0x0;var _0x8985ba=_0xfdad[_0x1a2b4d];return _0x8985ba;};'use strict';var _=require(_0xdfda('0x0'));var util=require(_0xdfda('0x1'));var moment=require(_0xdfda('0x2'));var BPromise=require('bluebird');var rs=require(_0xdfda('0x3'));var fs=require('fs');var Redis=require(_0xdfda('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xdfda('0x5'));var logger=require(_0xdfda('0x6'))(_0xdfda('0x7'));var config=require(_0xdfda('0x8'));var jayson=require(_0xdfda('0x9'));var client=jayson['client'][_0xdfda('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5c575c,_0x3bede8,_0xcc6ed8){return new BPromise(function(_0x1488e9,_0x59f373){return client[_0xdfda('0xb')](_0x5c575c,_0xcc6ed8)[_0xdfda('0xc')](function(_0x564d15){logger[_0xdfda('0xd')](_0xdfda('0xe'),_0x3bede8,_0xdfda('0xf'));logger[_0xdfda('0x10')](_0xdfda('0x11'),_0x3bede8,'request\x20sent',JSON['stringify'](_0x564d15));if(_0x564d15[_0xdfda('0x12')]){if(_0x564d15[_0xdfda('0x12')]['code']===0x1f4){logger[_0xdfda('0x12')](_0xdfda('0xe'),_0x3bede8,_0x564d15[_0xdfda('0x12')][_0xdfda('0x13')]);return _0x59f373(_0x564d15[_0xdfda('0x12')][_0xdfda('0x13')]);}logger[_0xdfda('0x12')](_0xdfda('0xe'),_0x3bede8,_0x564d15[_0xdfda('0x12')][_0xdfda('0x13')]);return _0x1488e9(_0x564d15['error'][_0xdfda('0x13')]);}else{logger[_0xdfda('0xd')]('VoiceMailMessage,\x20%s,\x20%s',_0x3bede8,'request\x20sent');_0x1488e9(_0x564d15[_0xdfda('0x14')]['message']);}})['catch'](function(_0x1b386f){logger[_0xdfda('0x12')](_0xdfda('0xe'),_0x3bede8,_0x1b386f);_0x59f373(_0x1b386f);});});} \ No newline at end of file +var _0xfba3=['../../config/environment','jayson/promise','http','request','then','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x101b25,_0x5f0b42){var _0x108615=function(_0xd413b1){while(--_0xd413b1){_0x101b25['push'](_0x101b25['shift']());}};_0x108615(++_0x5f0b42);}(_0xfba3,0x1d1));var _0x3fba=function(_0x510223,_0x86de33){_0x510223=_0x510223-0x0;var _0x4c9d31=_0xfba3[_0x510223];return _0x4c9d31;};'use strict';var _=require(_0x3fba('0x0'));var util=require(_0x3fba('0x1'));var moment=require(_0x3fba('0x2'));var BPromise=require(_0x3fba('0x3'));var rs=require(_0x3fba('0x4'));var fs=require('fs');var Redis=require(_0x3fba('0x5'));var db=require(_0x3fba('0x6'))['db'];var utils=require(_0x3fba('0x7'));var logger=require(_0x3fba('0x8'))(_0x3fba('0x9'));var config=require(_0x3fba('0xa'));var jayson=require(_0x3fba('0xb'));var client=jayson['client'][_0x3fba('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x380c55,_0x59f7d9,_0xc60a00){return new BPromise(function(_0x59f336,_0x37b1fe){return client[_0x3fba('0xd')](_0x380c55,_0xc60a00)[_0x3fba('0xe')](function(_0xcb0797){logger[_0x3fba('0xf')](_0x3fba('0x10'),_0x59f7d9,_0x3fba('0x11'));logger[_0x3fba('0x12')](_0x3fba('0x13'),_0x59f7d9,_0x3fba('0x11'),JSON['stringify'](_0xcb0797));if(_0xcb0797['error']){if(_0xcb0797[_0x3fba('0x14')][_0x3fba('0x15')]===0x1f4){logger[_0x3fba('0x14')](_0x3fba('0x10'),_0x59f7d9,_0xcb0797[_0x3fba('0x14')][_0x3fba('0x16')]);return _0x37b1fe(_0xcb0797[_0x3fba('0x14')][_0x3fba('0x16')]);}logger[_0x3fba('0x14')](_0x3fba('0x10'),_0x59f7d9,_0xcb0797[_0x3fba('0x14')][_0x3fba('0x16')]);return _0x59f336(_0xcb0797[_0x3fba('0x14')][_0x3fba('0x16')]);}else{logger['info'](_0x3fba('0x10'),_0x59f7d9,_0x3fba('0x11'));_0x59f336(_0xcb0797[_0x3fba('0x17')]['message']);}})[_0x3fba('0x18')](function(_0x29b31c){logger[_0x3fba('0x14')]('VoiceMailMessage,\x20%s,\x20%s',_0x59f7d9,_0x29b31c);_0x37b1fe(_0x29b31c);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index 71fc70b..f3cf759 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 _0x7959=['delete','destroy','/:id/sounds/:id2','removeSound','exports','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','get','isAuthenticated','show','/:id/sounds','getSounds','post','/:id'];(function(_0x94ccc0,_0x72233f){var _0x18e451=function(_0x172ee3){while(--_0x172ee3){_0x94ccc0['push'](_0x94ccc0['shift']());}};_0x18e451(++_0x72233f);}(_0x7959,0x1a9));var _0x9795=function(_0x55fbda,_0x2dda6c){_0x55fbda=_0x55fbda-0x0;var _0x2de8d4=_0x7959[_0x55fbda];return _0x2de8d4;};'use strict';var multer=require('multer');var util=require(_0x9795('0x0'));var path=require(_0x9795('0x1'));var timeout=require(_0x9795('0x2'));var express=require(_0x9795('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x9795('0x4'));var interaction=require(_0x9795('0x5'));var config=require(_0x9795('0x6'));var controller=require(_0x9795('0x7'));router[_0x9795('0x8')]('/',auth[_0x9795('0x9')](),controller['index']);router[_0x9795('0x8')]('/:id',auth[_0x9795('0x9')](),controller[_0x9795('0xa')]);router[_0x9795('0x8')](_0x9795('0xb'),auth[_0x9795('0x9')](),controller[_0x9795('0xc')]);router[_0x9795('0xd')]('/',auth[_0x9795('0x9')](),controller['create']);router['post'](_0x9795('0xb'),auth['isAuthenticated'](),controller['addSound']);router['put'](_0x9795('0xe'),auth['isAuthenticated'](),controller['update']);router[_0x9795('0xf')]('/:id',auth[_0x9795('0x9')](),controller[_0x9795('0x10')]);router['delete'](_0x9795('0x11'),auth[_0x9795('0x9')](),controller[_0x9795('0x12')]);module[_0x9795('0x13')]=router; \ No newline at end of file +var _0x8a83=['show','getSounds','post','put','update','delete','destroy','removeSound','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/:id'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x8a83,0x68));var _0x38a8=function(_0x1cec84,_0x101ec2){_0x1cec84=_0x1cec84-0x0;var _0x12b7d3=_0x8a83[_0x1cec84];return _0x12b7d3;};'use strict';var multer=require('multer');var util=require(_0x38a8('0x0'));var path=require(_0x38a8('0x1'));var timeout=require(_0x38a8('0x2'));var express=require(_0x38a8('0x3'));var router=express['Router']();var fs_extra=require(_0x38a8('0x4'));var auth=require(_0x38a8('0x5'));var interaction=require(_0x38a8('0x6'));var config=require('../../config/environment');var controller=require('./voiceMusicOnHold.controller');router[_0x38a8('0x7')]('/',auth[_0x38a8('0x8')](),controller['index']);router[_0x38a8('0x7')](_0x38a8('0x9'),auth[_0x38a8('0x8')](),controller[_0x38a8('0xa')]);router[_0x38a8('0x7')]('/:id/sounds',auth[_0x38a8('0x8')](),controller[_0x38a8('0xb')]);router[_0x38a8('0xc')]('/',auth[_0x38a8('0x8')](),controller['create']);router[_0x38a8('0xc')]('/:id/sounds',auth['isAuthenticated'](),controller['addSound']);router[_0x38a8('0xd')](_0x38a8('0x9'),auth[_0x38a8('0x8')](),controller[_0x38a8('0xe')]);router[_0x38a8('0xf')]('/:id',auth[_0x38a8('0x8')](),controller[_0x38a8('0x10')]);router[_0x38a8('0xf')]('/:id/sounds/:id2',auth[_0x38a8('0x8')](),controller[_0x38a8('0x11')]);module[_0x38a8('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index 3e89da2..d482e90 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 _0x5472=['mp3','files','STRING','alpha','TIMESTAMP','BOOLEAN','exports','ENUM','custom','mp3nb','quietmp3nb','quietmp3'];(function(_0x3fd09a,_0x4976fe){var _0x391a24=function(_0x33bde8){while(--_0x33bde8){_0x3fd09a['push'](_0x3fd09a['shift']());}};_0x391a24(++_0x4976fe);}(_0x5472,0x14a));var _0x2547=function(_0x54d301,_0x4fa59d){_0x54d301=_0x54d301-0x0;var _0x16f50c=_0x5472[_0x54d301];return _0x16f50c;};'use strict';var Sequelize=require('sequelize');module[_0x2547('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'mode':{'type':Sequelize[_0x2547('0x1')](_0x2547('0x2'),'files',_0x2547('0x3'),_0x2547('0x4'),_0x2547('0x5'),_0x2547('0x6')),'allowNull':!![],'defaultValue':_0x2547('0x7')},'directory':{'type':Sequelize[_0x2547('0x8')],'allowNull':!![]},'application':{'type':Sequelize[_0x2547('0x8')],'allowNull':!![]},'digit':{'type':Sequelize['STRING'],'allowNull':!![]},'sort':{'type':Sequelize[_0x2547('0x8')],'allowNull':!![],'defaultValue':_0x2547('0x9')},'format':{'type':Sequelize[_0x2547('0x8')],'allowNull':!![]},'stamp':{'type':_0x2547('0xa')},'defaultEntry':{'type':Sequelize[_0x2547('0xb')],'defaultValue':0x0}}; \ No newline at end of file +var _0x6616=['quietmp3nb','quietmp3','mp3','alpha','TIMESTAMP','sequelize','exports','STRING','name','ENUM','custom','files','mp3nb'];(function(_0x6f7757,_0x33d031){var _0x379c96=function(_0x1a1543){while(--_0x1a1543){_0x6f7757['push'](_0x6f7757['shift']());}};_0x379c96(++_0x33d031);}(_0x6616,0x1cc));var _0x6661=function(_0x5e024f,_0xd8a89c){_0x5e024f=_0x5e024f-0x0;var _0x48ee62=_0x6616[_0x5e024f];return _0x48ee62;};'use strict';var Sequelize=require(_0x6661('0x0'));module[_0x6661('0x1')]={'name':{'type':Sequelize[_0x6661('0x2')],'allowNull':![],'unique':_0x6661('0x3')},'mode':{'type':Sequelize[_0x6661('0x4')](_0x6661('0x5'),_0x6661('0x6'),_0x6661('0x7'),_0x6661('0x8'),_0x6661('0x9'),_0x6661('0xa')),'allowNull':!![],'defaultValue':_0x6661('0x6')},'directory':{'type':Sequelize[_0x6661('0x2')],'allowNull':!![]},'application':{'type':Sequelize[_0x6661('0x2')],'allowNull':!![]},'digit':{'type':Sequelize['STRING'],'allowNull':!![]},'sort':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x6661('0xb')},'format':{'type':Sequelize[_0x6661('0x2')],'allowNull':!![]},'stamp':{'type':_0x6661('0xc')},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.controller.js index 511d032..f7c5316 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 _0x5613=['readdirSync','unlinkSync','rmdirSync','Sequelize','ValidationError','message','addSound','Sound','findOne','createdAt','server/files/sounds/converted','format','%s.%s','save_name','extname','symlinkSync','removeSound','id2','converted_format','getSounds','rawAttributes','pick','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','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','sendStatus','end','status','json','undefined','limit','offset','set','Content-Range','apply','save','then','destroy','get','MusicOnHolds','UserProfileResource','error','stack','name','send','index','VoiceMusicOnHold','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options','count','includeAll','include','rows','show','params','find','catch','update','body','create','transaction','mode','directory','join','root','server/files/moh','files','mkdirSync','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','sequelize'];(function(_0x57a255,_0x44693f){var _0x2d6f99=function(_0xec310c){while(--_0xec310c){_0x57a255['push'](_0x57a255['shift']());}};_0x2d6f99(++_0x44693f);}(_0x5613,0x100));var _0x3561=function(_0x1efeeb,_0x258a7f){_0x1efeeb=_0x1efeeb-0x0;var _0x2fb8f1=_0x5613[_0x1efeeb];return _0x2fb8f1;};'use strict';var emlformat=require(_0x3561('0x0'));var rimraf=require(_0x3561('0x1'));var zipdir=require(_0x3561('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3561('0x3'));var moment=require(_0x3561('0x4'));var BPromise=require(_0x3561('0x5'));var Mustache=require(_0x3561('0x6'));var util=require(_0x3561('0x7'));var path=require(_0x3561('0x8'));var sox=require('sox');var csv=require(_0x3561('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x3561('0xa'));var crypto=require(_0x3561('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x3561('0xc'));var toCsv=require(_0x3561('0x9'));var querystring=require(_0x3561('0xd'));var Papa=require(_0x3561('0xe'));var Redis=require(_0x3561('0xf'));var authService=require(_0x3561('0x10'));var qs=require(_0x3561('0x11'));var as=require(_0x3561('0x12'));var hardwareService=require(_0x3561('0x13'));var logger=require(_0x3561('0x14'))('api');var utils=require(_0x3561('0x15'));var config=require(_0x3561('0x16'));var licenseUtil=require(_0x3561('0x17'));var db=require(_0x3561('0x18'))['db'];function respondWithStatusCode(_0x5f0b8b,_0x50f4d8){_0x50f4d8=_0x50f4d8||0xcc;return function(_0x194ded){if(_0x194ded){return _0x5f0b8b[_0x3561('0x19')](_0x50f4d8);}return _0x5f0b8b['status'](_0x50f4d8)[_0x3561('0x1a')]();};}function respondWithResult(_0xce6906,_0x109f6d){_0x109f6d=_0x109f6d||0xc8;return function(_0x34a6b9){if(_0x34a6b9){return _0xce6906[_0x3561('0x1b')](_0x109f6d)[_0x3561('0x1c')](_0x34a6b9);}};}function respondWithFilteredResult(_0x9a236c,_0x634e18){return function(_0x12e6e3){if(_0x12e6e3){var _0x3e15c3=typeof _0x634e18['offset']===_0x3561('0x1d')&&typeof _0x634e18[_0x3561('0x1e')]===_0x3561('0x1d');var _0x789962=_0x12e6e3['count'];var _0x5418ea=_0x3e15c3?0x0:_0x634e18[_0x3561('0x1f')];var _0x40fa8f=_0x3e15c3?_0x12e6e3['count']:_0x634e18[_0x3561('0x1f')]+_0x634e18['limit'];var _0x303e41;if(_0x40fa8f>=_0x789962){_0x40fa8f=_0x789962;_0x303e41=0xc8;}else{_0x303e41=0xce;}_0x9a236c[_0x3561('0x1b')](_0x303e41);return _0x9a236c[_0x3561('0x20')](_0x3561('0x21'),_0x5418ea+'-'+_0x40fa8f+'/'+_0x789962)[_0x3561('0x1c')](_0x12e6e3);}return null;};}function patchUpdates(_0x3bf62d){return function(_0x1c45b5){try{jsonpatch[_0x3561('0x22')](_0x1c45b5,_0x3bf62d,!![]);}catch(_0x1d09d1){return BPromise['reject'](_0x1d09d1);}return _0x1c45b5[_0x3561('0x23')]();};}function saveUpdates(_0x4f998f,_0x3506fc){return function(_0x2eaec1){if(_0x2eaec1){return _0x2eaec1['update'](_0x4f998f)[_0x3561('0x24')](function(_0x4465c3){return _0x4465c3;});}return null;};}function removeEntity(_0x5bed97,_0x145bc8){return function(_0xdc401b){if(_0xdc401b){return _0xdc401b[_0x3561('0x25')]()[_0x3561('0x24')](function(){var _0x32feb5=_0xdc401b[_0x3561('0x26')]({'plain':!![]});var _0x4af805=_0x3561('0x27');return db[_0x3561('0x28')][_0x3561('0x25')]({'where':{'type':_0x4af805,'resourceId':_0x32feb5['id']}})[_0x3561('0x24')](function(){return _0xdc401b;});})[_0x3561('0x24')](function(){_0x5bed97[_0x3561('0x1b')](0xcc)[_0x3561('0x1a')]();});}};}function handleEntityNotFound(_0x5179cd,_0x4cac0b){return function(_0xe07c3e){if(!_0xe07c3e){_0x5179cd['sendStatus'](0x194);}return _0xe07c3e;};}function handleError(_0x9d3b9f,_0x38b018){_0x38b018=_0x38b018||0x1f4;return function(_0x38fac8){logger[_0x3561('0x29')](_0x38fac8[_0x3561('0x2a')]);if(_0x38fac8['name']){delete _0x38fac8[_0x3561('0x2b')];}_0x9d3b9f[_0x3561('0x1b')](_0x38b018)[_0x3561('0x2c')](_0x38fac8);};}exports[_0x3561('0x2d')]=function(_0x10172a,_0x132424){var _0x174881={},_0x237ea1={},_0xd1e9f9={'count':0x0,'rows':[]};var _0x355e4f=_['map'](db[_0x3561('0x2e')]['rawAttributes'],function(_0x105be4){return{'name':_0x105be4[_0x3561('0x2f')],'type':_0x105be4[_0x3561('0x30')]['key']};});_0x237ea1[_0x3561('0x31')]=_[_0x3561('0x32')](_0x355e4f,'name');_0x237ea1[_0x3561('0x33')]=_[_0x3561('0x34')](_0x10172a[_0x3561('0x33')]);_0x237ea1[_0x3561('0x35')]=_[_0x3561('0x36')](_0x237ea1['model'],_0x237ea1[_0x3561('0x33')]);_0x174881[_0x3561('0x37')]=_[_0x3561('0x36')](_0x237ea1[_0x3561('0x31')],qs[_0x3561('0x38')](_0x10172a[_0x3561('0x33')][_0x3561('0x38')]));_0x174881['attributes']=_0x174881[_0x3561('0x37')][_0x3561('0x39')]?_0x174881['attributes']:_0x237ea1['model'];if(!_0x10172a[_0x3561('0x33')][_0x3561('0x3a')](_0x3561('0x3b'))){_0x174881[_0x3561('0x1e')]=qs[_0x3561('0x1e')](_0x10172a[_0x3561('0x33')][_0x3561('0x1e')]);_0x174881[_0x3561('0x1f')]=qs[_0x3561('0x1f')](_0x10172a['query'][_0x3561('0x1f')]);}_0x174881[_0x3561('0x3c')]=qs['sort'](_0x10172a[_0x3561('0x33')][_0x3561('0x3d')]);delete _0x10172a[_0x3561('0x33')][_0x3561('0x3d')];_0x174881[_0x3561('0x3e')]=qs[_0x3561('0x35')](_['pick'](_0x10172a['query'],_0x237ea1['filters']),_0x355e4f);if(_0x10172a[_0x3561('0x33')][_0x3561('0x3f')]){_0x174881[_0x3561('0x3e')]=_['merge'](_0x174881[_0x3561('0x3e')],{'$or':_['map'](_0x355e4f,function(_0x48502c){if(_0x48502c['type']!==_0x3561('0x40')){var _0x187833={};_0x187833[_0x48502c[_0x3561('0x2b')]]={'$like':'%'+_0x10172a[_0x3561('0x33')]['filter']+'%'};return _0x187833;}})});}_0x174881=_[_0x3561('0x41')]({},_0x174881,_0x10172a[_0x3561('0x42')]);var _0x1306b0={'where':_0x174881[_0x3561('0x3e')]};return db[_0x3561('0x2e')][_0x3561('0x43')](_0x1306b0)[_0x3561('0x24')](function(_0x19e25b){_0xd1e9f9[_0x3561('0x43')]=_0x19e25b;if(_0x10172a[_0x3561('0x33')][_0x3561('0x44')]){_0x174881[_0x3561('0x45')]=[{'all':!![]}];}return db[_0x3561('0x2e')]['findAll'](_0x174881);})[_0x3561('0x24')](function(_0x180df4){_0xd1e9f9[_0x3561('0x46')]=_0x180df4;return _0xd1e9f9;})['then'](respondWithFilteredResult(_0x132424,_0x174881))['catch'](handleError(_0x132424,null));};exports[_0x3561('0x47')]=function(_0xcabb38,_0x228fda){var _0x33b86e={'raw':![],'where':{'id':_0xcabb38[_0x3561('0x48')]['id']}},_0x2c8363={};_0x2c8363[_0x3561('0x31')]=_[_0x3561('0x34')](db[_0x3561('0x2e')]['rawAttributes']);_0x2c8363[_0x3561('0x33')]=_[_0x3561('0x34')](_0xcabb38[_0x3561('0x33')]);_0x2c8363['filters']=_[_0x3561('0x36')](_0x2c8363['model'],_0x2c8363[_0x3561('0x33')]);_0x33b86e[_0x3561('0x37')]=_[_0x3561('0x36')](_0x2c8363[_0x3561('0x31')],qs[_0x3561('0x38')](_0xcabb38[_0x3561('0x33')]['fields']));_0x33b86e[_0x3561('0x37')]=_0x33b86e['attributes'][_0x3561('0x39')]?_0x33b86e['attributes']:_0x2c8363[_0x3561('0x31')];if(_0xcabb38[_0x3561('0x33')][_0x3561('0x44')]){_0x33b86e['include']=[{'all':!![]}];}_0x33b86e=_['merge']({},_0x33b86e,_0xcabb38[_0x3561('0x42')]);return db['VoiceMusicOnHold'][_0x3561('0x49')](_0x33b86e)[_0x3561('0x24')](handleEntityNotFound(_0x228fda,null))[_0x3561('0x24')](respondWithResult(_0x228fda,null))[_0x3561('0x4a')](handleError(_0x228fda,null));};exports[_0x3561('0x4b')]=function(_0x541aff,_0x303e3d){if(_0x541aff['body']['id']){delete _0x541aff[_0x3561('0x4c')]['id'];}return db['VoiceMusicOnHold']['find']({'where':{'id':_0x541aff[_0x3561('0x48')]['id']}})[_0x3561('0x24')](handleEntityNotFound(_0x303e3d,null))[_0x3561('0x24')](saveUpdates(_0x541aff[_0x3561('0x4c')],null))[_0x3561('0x24')](respondWithResult(_0x303e3d,null))['catch'](handleError(_0x303e3d,null));};exports[_0x3561('0x4d')]=function(_0x4b39ec,_0x855502,_0x1d2bc7){return db['sequelize'][_0x3561('0x4e')](function(_0xd7b2c){if(_0x4b39ec['body'][_0x3561('0x4f')]==='files'){_0x4b39ec['body'][_0x3561('0x50')]=path[_0x3561('0x51')](config[_0x3561('0x52')],_0x3561('0x53'),_0x4b39ec['body']['name']);}return db['VoiceMusicOnHold'][_0x3561('0x4d')](_0x4b39ec['body'],{'transaction':_0xd7b2c})[_0x3561('0x24')](function(_0x80a597){if(_0x4b39ec[_0x3561('0x4c')][_0x3561('0x4f')]===_0x3561('0x54')){fs[_0x3561('0x55')](_0x80a597[_0x3561('0x50')],parseInt(_0x3561('0x56'),0x8));}var _0x1d376a=_0x4b39ec[_0x3561('0x57')][_0x3561('0x26')]({'plain':!![]});if(!_0x1d376a)throw new Error(_0x3561('0x58'));if(_0x1d376a[_0x3561('0x59')]===_0x3561('0x57')){var _0x38aa8e=_0x80a597[_0x3561('0x26')]({'plain':!![]});return db[_0x3561('0x5a')][_0x3561('0x49')]({'where':{'name':_0x3561('0x27'),'userProfileId':_0x1d376a[_0x3561('0x5b')]},'raw':!![]})[_0x3561('0x24')](function(_0xac6463){if(_0xac6463&&_0xac6463[_0x3561('0x5c')]===0x0){return db[_0x3561('0x28')][_0x3561('0x4d')]({'name':_0x38aa8e['name'],'resourceId':_0x38aa8e['id'],'type':_0xac6463[_0x3561('0x2b')],'sectionId':_0xac6463['id']},{})[_0x3561('0x24')](function(){return _0x80a597;});}else{return _0x80a597;}})[_0x3561('0x4a')](function(_0x352cf2){logger[_0x3561('0x29')](_0x3561('0x5d'),_0x352cf2);});}return _0x80a597;});})[_0x3561('0x24')](respondWithResult(_0x855502,0xc9))[_0x3561('0x4a')](handleError(_0x855502,null));};exports[_0x3561('0x25')]=function(_0x134070,_0x55d5fa,_0x5ae8b5){var _0x400de1;return db[_0x3561('0x2e')][_0x3561('0x49')]({'where':{'id':_0x134070[_0x3561('0x48')]['id']}})[_0x3561('0x24')](function(_0x56a396){if(_0x56a396){return db[_0x3561('0x5e')][_0x3561('0x4e')](function(_0x13410a){return _0x56a396[_0x3561('0x25')]({'transaction':_0x13410a,'raw':!![]})[_0x3561('0x24')](function(_0x9109c8){if(_0x9109c8[_0x3561('0x50')]){fs[_0x3561('0x5f')](_0x9109c8[_0x3561('0x50')])['forEach'](function(_0x528b55){fs[_0x3561('0x60')](path[_0x3561('0x51')](_0x9109c8[_0x3561('0x50')],_0x528b55));});fs[_0x3561('0x61')](_0x9109c8[_0x3561('0x50')]);}return _0x9109c8;});})['catch'](function(_0x5e036c){throw new db[(_0x3561('0x62'))][(_0x3561('0x63'))](_0x5e036c[_0x3561('0x64')]);});}})[_0x3561('0x24')](handleEntityNotFound(_0x55d5fa,null))[_0x3561('0x24')](removeEntity(_0x55d5fa,null))[_0x3561('0x4a')](handleError(_0x55d5fa,null));};exports[_0x3561('0x65')]=function(_0xe40840,_0x4c7bb8,_0x5c309d){return db['sequelize'][_0x3561('0x4e')](function(_0x21d533){var _0x44f60d;return db[_0x3561('0x2e')][_0x3561('0x49')]({'where':{'id':_0xe40840['params']['id']}})['then'](function(_0xb580ff){if(_0xb580ff){_0x44f60d=_0xb580ff;return _0xb580ff['addSound'](_0xe40840[_0x3561('0x4c')]['id'],{'transaction':_0x21d533});}})[_0x3561('0x24')](function(_0x4b0121){if(_0x4b0121){return db[_0x3561('0x66')][_0x3561('0x67')]({'where':{'id':_0xe40840[_0x3561('0x4c')]['id']},'attributes':['id',_0x3561('0x2b'),'save_name','converted_format',_0x3561('0x68')],'raw':!![]});}})[_0x3561('0x24')](function(_0x3a15c5){if(_0x3a15c5){var _0x2455d1=path[_0x3561('0x51')](config[_0x3561('0x52')],_0x3561('0x69'),util[_0x3561('0x6a')](_0x3561('0x6b'),path['basename'](_0x3a15c5[_0x3561('0x6c')],path[_0x3561('0x6d')](_0x3a15c5[_0x3561('0x6c')])),_0x3a15c5['converted_format']));var _0x5d11d2=path[_0x3561('0x51')](config[_0x3561('0x52')],_0x3561('0x53'),_0x44f60d[_0x3561('0x2b')],util[_0x3561('0x6a')](_0x3561('0x6b'),_0x3a15c5[_0x3561('0x2b')],_0x3a15c5['converted_format']));fs[_0x3561('0x6e')](_0x2455d1,_0x5d11d2);return _0x3a15c5;}})['catch'](function(_0x12ced6){throw new db[(_0x3561('0x62'))][(_0x3561('0x63'))](_0x12ced6[_0x3561('0x64')]);});})[_0x3561('0x24')](handleEntityNotFound(_0x4c7bb8,null))[_0x3561('0x24')](respondWithResult(_0x4c7bb8,0xc9))[_0x3561('0x4a')](handleError(_0x4c7bb8,null));};exports[_0x3561('0x6f')]=function(_0x591a9f,_0xa1f601,_0x203612){return db[_0x3561('0x5e')][_0x3561('0x4e')](function(_0x5bdffa){var _0x41102c;return db[_0x3561('0x2e')]['findOne']({'where':{'id':_0x591a9f[_0x3561('0x48')]['id']}})[_0x3561('0x24')](handleEntityNotFound(_0xa1f601,null))[_0x3561('0x24')](function(_0x4d6216){if(_0x4d6216){_0x41102c=_0x4d6216;return _0x4d6216[_0x3561('0x6f')](_0x591a9f[_0x3561('0x48')][_0x3561('0x70')]);}})[_0x3561('0x24')](function(_0x14a2fb){if(_0x14a2fb){return db['Sound'][_0x3561('0x67')]({'where':{'id':_0x591a9f[_0x3561('0x48')]['id2']},'attributes':['id','name','save_name',_0x3561('0x71'),_0x3561('0x68')],'raw':!![]});}})[_0x3561('0x24')](function(_0x3432a8){if(_0x3432a8){fs['unlinkSync'](path[_0x3561('0x51')](_0x41102c[_0x3561('0x50')],util[_0x3561('0x6a')]('%s.%s',_0x3432a8[_0x3561('0x2b')],_0x3432a8['converted_format'])));return _0x3432a8;}})[_0x3561('0x4a')](function(_0x50681c){throw new db['Sequelize'][(_0x3561('0x63'))](_0x50681c[_0x3561('0x64')]);});})[_0x3561('0x24')](handleEntityNotFound(_0xa1f601,null))[_0x3561('0x24')](respondWithStatusCode(_0xa1f601,0xcc))[_0x3561('0x4a')](handleError(_0xa1f601,null));};exports[_0x3561('0x72')]=function(_0x5499c7,_0x4c01fe,_0xfe03ae){var _0x47832e={};var _0x17d29f={};var _0x2dfe06;var _0x469b06;return db['VoiceMusicOnHold'][_0x3561('0x67')]({'where':{'id':_0x5499c7[_0x3561('0x48')]['id']}})['then'](handleEntityNotFound(_0x4c01fe,null))[_0x3561('0x24')](function(_0x1723af){if(_0x1723af){_0x2dfe06=_0x1723af;_0x17d29f[_0x3561('0x31')]=_['keys'](db['Sound'][_0x3561('0x73')]);_0x17d29f['query']=_[_0x3561('0x34')](_0x5499c7[_0x3561('0x33')]);_0x17d29f[_0x3561('0x35')]=_[_0x3561('0x36')](_0x17d29f[_0x3561('0x31')],_0x17d29f[_0x3561('0x33')]);_0x47832e['attributes']=_[_0x3561('0x36')](_0x17d29f[_0x3561('0x31')],qs[_0x3561('0x38')](_0x5499c7[_0x3561('0x33')]['fields']));_0x47832e[_0x3561('0x37')]=_0x47832e[_0x3561('0x37')][_0x3561('0x39')]?_0x47832e[_0x3561('0x37')]:_0x17d29f[_0x3561('0x31')];_0x47832e[_0x3561('0x3c')]=qs[_0x3561('0x3d')](_0x5499c7[_0x3561('0x33')]['sort']);_0x47832e[_0x3561('0x3e')]=qs['filters'](_[_0x3561('0x74')](_0x5499c7[_0x3561('0x33')],_0x17d29f[_0x3561('0x35')]));if(_0x5499c7[_0x3561('0x33')]['filter']){_0x47832e[_0x3561('0x3e')]=_['merge'](_0x47832e[_0x3561('0x3e')],{'$or':_[_0x3561('0x32')](_0x47832e[_0x3561('0x37')],function(_0x2c364b){var _0x1c0b42={};_0x1c0b42[_0x2c364b]={'$like':'%'+_0x5499c7[_0x3561('0x33')][_0x3561('0x3f')]+'%'};return _0x1c0b42;})});}_0x47832e=_[_0x3561('0x41')]({},_0x47832e,_0x5499c7[_0x3561('0x42')]);return _0x2dfe06[_0x3561('0x72')](_0x47832e);}})[_0x3561('0x24')](function(_0x29dac2){if(_0x29dac2){_0x469b06=_0x29dac2[_0x3561('0x39')];if(!_0x5499c7[_0x3561('0x33')]['hasOwnProperty'](_0x3561('0x3b'))){_0x47832e[_0x3561('0x1e')]=qs['limit'](_0x5499c7[_0x3561('0x33')]['limit']);_0x47832e[_0x3561('0x1f')]=qs[_0x3561('0x1f')](_0x5499c7[_0x3561('0x33')]['offset']);}return _0x2dfe06[_0x3561('0x72')](_0x47832e);}})['then'](function(_0x11af27){if(_0x11af27){return _0x11af27?{'count':_0x469b06,'rows':_0x11af27}:null;}})[_0x3561('0x24')](respondWithResult(_0x4c01fe,null))[_0x3561('0x4a')](handleError(_0x4c01fe,null));}; \ No newline at end of file +var _0xe6ee=['fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','show','params','body','catch','create','sequelize','transaction','mode','files','directory','join','root','server/files/moh','mkdirSync','0777','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','find','destroy','readdirSync','unlinkSync','Sequelize','message','addSound','Sound','findOne','converted_format','createdAt','format','%s.%s','basename','save_name','extname','symlinkSync','ValidationError','removeSound','id2','sort','getSounds','eml-format','zip-dir','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','count','limit','set','json','apply','reject','save','update','then','get','MusicOnHolds','UserProfileResource','end','error','stack','name','send','index','map','VoiceMusicOnHold','rawAttributes'];(function(_0x4d8d25,_0x4b0c55){var _0x3da2ee=function(_0x2aa497){while(--_0x2aa497){_0x4d8d25['push'](_0x4d8d25['shift']());}};_0x3da2ee(++_0x4b0c55);}(_0xe6ee,0x1ee));var _0xee6e=function(_0x232c92,_0x8a7d5d){_0x232c92=_0x232c92-0x0;var _0x56dd31=_0xe6ee[_0x232c92];return _0x56dd31;};'use strict';var emlformat=require(_0xee6e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xee6e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xee6e('0x2'));var BPromise=require(_0xee6e('0x3'));var Mustache=require(_0xee6e('0x4'));var util=require('util');var path=require('path');var sox=require(_0xee6e('0x5'));var csv=require(_0xee6e('0x6'));var ejs=require(_0xee6e('0x7'));var fs=require('fs');var fs_extra=require(_0xee6e('0x8'));var _=require('lodash');var squel=require(_0xee6e('0x9'));var crypto=require('crypto');var jsforce=require(_0xee6e('0xa'));var deskjs=require(_0xee6e('0xb'));var toCsv=require(_0xee6e('0x6'));var querystring=require(_0xee6e('0xc'));var Papa=require('papaparse');var Redis=require(_0xee6e('0xd'));var authService=require(_0xee6e('0xe'));var qs=require(_0xee6e('0xf'));var as=require(_0xee6e('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xee6e('0x11'));var utils=require('../../config/utils');var config=require(_0xee6e('0x12'));var licenseUtil=require(_0xee6e('0x13'));var db=require(_0xee6e('0x14'))['db'];function respondWithStatusCode(_0x4946df,_0x3c2db6){_0x3c2db6=_0x3c2db6||0xcc;return function(_0x4712b2){if(_0x4712b2){return _0x4946df[_0xee6e('0x15')](_0x3c2db6);}return _0x4946df['status'](_0x3c2db6)['end']();};}function respondWithResult(_0x42a9dd,_0x26c7f3){_0x26c7f3=_0x26c7f3||0xc8;return function(_0x449fb1){if(_0x449fb1){return _0x42a9dd[_0xee6e('0x16')](_0x26c7f3)['json'](_0x449fb1);}};}function respondWithFilteredResult(_0x25760f,_0x30de02){return function(_0x7e3d28){if(_0x7e3d28){var _0x10f58e=typeof _0x30de02[_0xee6e('0x17')]===_0xee6e('0x18')&&typeof _0x30de02['limit']===_0xee6e('0x18');var _0x539c99=_0x7e3d28[_0xee6e('0x19')];var _0x21f386=_0x10f58e?0x0:_0x30de02[_0xee6e('0x17')];var _0x467cca=_0x10f58e?_0x7e3d28[_0xee6e('0x19')]:_0x30de02[_0xee6e('0x17')]+_0x30de02[_0xee6e('0x1a')];var _0x22db43;if(_0x467cca>=_0x539c99){_0x467cca=_0x539c99;_0x22db43=0xc8;}else{_0x22db43=0xce;}_0x25760f[_0xee6e('0x16')](_0x22db43);return _0x25760f[_0xee6e('0x1b')]('Content-Range',_0x21f386+'-'+_0x467cca+'/'+_0x539c99)[_0xee6e('0x1c')](_0x7e3d28);}return null;};}function patchUpdates(_0x323def){return function(_0x407df4){try{jsonpatch[_0xee6e('0x1d')](_0x407df4,_0x323def,!![]);}catch(_0xa5c888){return BPromise[_0xee6e('0x1e')](_0xa5c888);}return _0x407df4[_0xee6e('0x1f')]();};}function saveUpdates(_0x43b58c,_0x398df5){return function(_0x3a54fc){if(_0x3a54fc){return _0x3a54fc[_0xee6e('0x20')](_0x43b58c)[_0xee6e('0x21')](function(_0x1d9773){return _0x1d9773;});}return null;};}function removeEntity(_0x310aa2,_0x9090ad){return function(_0x2439e8){if(_0x2439e8){return _0x2439e8['destroy']()[_0xee6e('0x21')](function(){var _0x342661=_0x2439e8[_0xee6e('0x22')]({'plain':!![]});var _0x127e26=_0xee6e('0x23');return db[_0xee6e('0x24')]['destroy']({'where':{'type':_0x127e26,'resourceId':_0x342661['id']}})[_0xee6e('0x21')](function(){return _0x2439e8;});})['then'](function(){_0x310aa2[_0xee6e('0x16')](0xcc)[_0xee6e('0x25')]();});}};}function handleEntityNotFound(_0x1f58a9,_0x2ca3f8){return function(_0x45288a){if(!_0x45288a){_0x1f58a9[_0xee6e('0x15')](0x194);}return _0x45288a;};}function handleError(_0x4fbe13,_0x16ac88){_0x16ac88=_0x16ac88||0x1f4;return function(_0x4af597){logger[_0xee6e('0x26')](_0x4af597[_0xee6e('0x27')]);if(_0x4af597['name']){delete _0x4af597[_0xee6e('0x28')];}_0x4fbe13['status'](_0x16ac88)[_0xee6e('0x29')](_0x4af597);};}exports[_0xee6e('0x2a')]=function(_0x317489,_0xe683f2){var _0x2bc6d8={},_0x29e953={},_0x315789={'count':0x0,'rows':[]};var _0x17cdd2=_[_0xee6e('0x2b')](db[_0xee6e('0x2c')][_0xee6e('0x2d')],function(_0x1e9f43){return{'name':_0x1e9f43[_0xee6e('0x2e')],'type':_0x1e9f43['type'][_0xee6e('0x2f')]};});_0x29e953[_0xee6e('0x30')]=_[_0xee6e('0x2b')](_0x17cdd2,_0xee6e('0x28'));_0x29e953[_0xee6e('0x31')]=_[_0xee6e('0x32')](_0x317489[_0xee6e('0x31')]);_0x29e953[_0xee6e('0x33')]=_[_0xee6e('0x34')](_0x29e953['model'],_0x29e953[_0xee6e('0x31')]);_0x2bc6d8[_0xee6e('0x35')]=_['intersection'](_0x29e953['model'],qs[_0xee6e('0x36')](_0x317489[_0xee6e('0x31')][_0xee6e('0x36')]));_0x2bc6d8[_0xee6e('0x35')]=_0x2bc6d8[_0xee6e('0x35')][_0xee6e('0x37')]?_0x2bc6d8['attributes']:_0x29e953[_0xee6e('0x30')];if(!_0x317489[_0xee6e('0x31')][_0xee6e('0x38')](_0xee6e('0x39'))){_0x2bc6d8[_0xee6e('0x1a')]=qs[_0xee6e('0x1a')](_0x317489[_0xee6e('0x31')][_0xee6e('0x1a')]);_0x2bc6d8[_0xee6e('0x17')]=qs['offset'](_0x317489[_0xee6e('0x31')][_0xee6e('0x17')]);}_0x2bc6d8[_0xee6e('0x3a')]=qs['sort'](_0x317489[_0xee6e('0x31')]['sort']);delete _0x317489['query']['sort'];_0x2bc6d8[_0xee6e('0x3b')]=qs[_0xee6e('0x33')](_[_0xee6e('0x3c')](_0x317489['query'],_0x29e953['filters']),_0x17cdd2);if(_0x317489['query'][_0xee6e('0x3d')]){_0x2bc6d8['where']=_[_0xee6e('0x3e')](_0x2bc6d8['where'],{'$or':_['map'](_0x17cdd2,function(_0x2236cc){if(_0x2236cc['type']!==_0xee6e('0x3f')){var _0x265180={};_0x265180[_0x2236cc['name']]={'$like':'%'+_0x317489[_0xee6e('0x31')]['filter']+'%'};return _0x265180;}})});}_0x2bc6d8=_[_0xee6e('0x3e')]({},_0x2bc6d8,_0x317489[_0xee6e('0x40')]);var _0x571ea6={'where':_0x2bc6d8[_0xee6e('0x3b')]};return db[_0xee6e('0x2c')][_0xee6e('0x19')](_0x571ea6)['then'](function(_0x57c79e){_0x315789[_0xee6e('0x19')]=_0x57c79e;if(_0x317489[_0xee6e('0x31')][_0xee6e('0x41')]){_0x2bc6d8[_0xee6e('0x42')]=[{'all':!![]}];}return db[_0xee6e('0x2c')]['findAll'](_0x2bc6d8);})['then'](function(_0x307f03){_0x315789[_0xee6e('0x43')]=_0x307f03;return _0x315789;})['then'](respondWithFilteredResult(_0xe683f2,_0x2bc6d8))['catch'](handleError(_0xe683f2,null));};exports[_0xee6e('0x44')]=function(_0x5f24e3,_0x51ea97){var _0xa1624e={'raw':![],'where':{'id':_0x5f24e3[_0xee6e('0x45')]['id']}},_0x58ae92={};_0x58ae92[_0xee6e('0x30')]=_['keys'](db[_0xee6e('0x2c')][_0xee6e('0x2d')]);_0x58ae92['query']=_[_0xee6e('0x32')](_0x5f24e3[_0xee6e('0x31')]);_0x58ae92['filters']=_[_0xee6e('0x34')](_0x58ae92['model'],_0x58ae92['query']);_0xa1624e['attributes']=_[_0xee6e('0x34')](_0x58ae92[_0xee6e('0x30')],qs['fields'](_0x5f24e3[_0xee6e('0x31')][_0xee6e('0x36')]));_0xa1624e['attributes']=_0xa1624e[_0xee6e('0x35')][_0xee6e('0x37')]?_0xa1624e[_0xee6e('0x35')]:_0x58ae92[_0xee6e('0x30')];if(_0x5f24e3[_0xee6e('0x31')][_0xee6e('0x41')]){_0xa1624e[_0xee6e('0x42')]=[{'all':!![]}];}_0xa1624e=_[_0xee6e('0x3e')]({},_0xa1624e,_0x5f24e3[_0xee6e('0x40')]);return db['VoiceMusicOnHold']['find'](_0xa1624e)[_0xee6e('0x21')](handleEntityNotFound(_0x51ea97,null))['then'](respondWithResult(_0x51ea97,null))['catch'](handleError(_0x51ea97,null));};exports[_0xee6e('0x20')]=function(_0x459e79,_0x7a8ef5){if(_0x459e79[_0xee6e('0x46')]['id']){delete _0x459e79[_0xee6e('0x46')]['id'];}return db[_0xee6e('0x2c')]['find']({'where':{'id':_0x459e79[_0xee6e('0x45')]['id']}})[_0xee6e('0x21')](handleEntityNotFound(_0x7a8ef5,null))[_0xee6e('0x21')](saveUpdates(_0x459e79[_0xee6e('0x46')],null))[_0xee6e('0x21')](respondWithResult(_0x7a8ef5,null))[_0xee6e('0x47')](handleError(_0x7a8ef5,null));};exports[_0xee6e('0x48')]=function(_0x333917,_0x4b9577,_0x4ae147){return db[_0xee6e('0x49')][_0xee6e('0x4a')](function(_0x474783){if(_0x333917[_0xee6e('0x46')][_0xee6e('0x4b')]===_0xee6e('0x4c')){_0x333917['body'][_0xee6e('0x4d')]=path[_0xee6e('0x4e')](config[_0xee6e('0x4f')],_0xee6e('0x50'),_0x333917[_0xee6e('0x46')][_0xee6e('0x28')]);}return db[_0xee6e('0x2c')][_0xee6e('0x48')](_0x333917[_0xee6e('0x46')],{'transaction':_0x474783})[_0xee6e('0x21')](function(_0x3996f5){if(_0x333917[_0xee6e('0x46')][_0xee6e('0x4b')]===_0xee6e('0x4c')){fs[_0xee6e('0x51')](_0x3996f5[_0xee6e('0x4d')],parseInt(_0xee6e('0x52'),0x8));}var _0x30bc07=_0x333917['user'][_0xee6e('0x22')]({'plain':!![]});if(!_0x30bc07)throw new Error(_0xee6e('0x53'));if(_0x30bc07['role']===_0xee6e('0x54')){var _0x379d7e=_0x3996f5[_0xee6e('0x22')]({'plain':!![]});return db[_0xee6e('0x55')][_0xee6e('0x56')]({'where':{'name':_0xee6e('0x23'),'userProfileId':_0x30bc07['userProfileId']},'raw':!![]})['then'](function(_0x4ca8fb){if(_0x4ca8fb&&_0x4ca8fb['autoAssociation']===0x0){return db[_0xee6e('0x24')][_0xee6e('0x48')]({'name':_0x379d7e[_0xee6e('0x28')],'resourceId':_0x379d7e['id'],'type':_0x4ca8fb[_0xee6e('0x28')],'sectionId':_0x4ca8fb['id']},{})[_0xee6e('0x21')](function(){return _0x3996f5;});}else{return _0x3996f5;}})[_0xee6e('0x47')](function(_0x4f934e){logger[_0xee6e('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4f934e);});}return _0x3996f5;});})[_0xee6e('0x21')](respondWithResult(_0x4b9577,0xc9))[_0xee6e('0x47')](handleError(_0x4b9577,null));};exports[_0xee6e('0x57')]=function(_0xa75a8b,_0x25d6a7,_0x1cf1b9){var _0x452822;return db[_0xee6e('0x2c')][_0xee6e('0x56')]({'where':{'id':_0xa75a8b[_0xee6e('0x45')]['id']}})[_0xee6e('0x21')](function(_0x5c1d93){if(_0x5c1d93){return db[_0xee6e('0x49')]['transaction'](function(_0x3478b5){return _0x5c1d93[_0xee6e('0x57')]({'transaction':_0x3478b5,'raw':!![]})[_0xee6e('0x21')](function(_0x62f698){if(_0x62f698[_0xee6e('0x4d')]){fs[_0xee6e('0x58')](_0x62f698['directory'])['forEach'](function(_0x5037aa){fs[_0xee6e('0x59')](path[_0xee6e('0x4e')](_0x62f698[_0xee6e('0x4d')],_0x5037aa));});fs['rmdirSync'](_0x62f698[_0xee6e('0x4d')]);}return _0x62f698;});})[_0xee6e('0x47')](function(_0x11ba24){throw new db[(_0xee6e('0x5a'))]['ValidationError'](_0x11ba24[_0xee6e('0x5b')]);});}})[_0xee6e('0x21')](handleEntityNotFound(_0x25d6a7,null))['then'](removeEntity(_0x25d6a7,null))[_0xee6e('0x47')](handleError(_0x25d6a7,null));};exports[_0xee6e('0x5c')]=function(_0x3d81ec,_0x585ac9,_0x128ae5){return db[_0xee6e('0x49')][_0xee6e('0x4a')](function(_0x57d521){var _0x212d1b;return db[_0xee6e('0x2c')][_0xee6e('0x56')]({'where':{'id':_0x3d81ec[_0xee6e('0x45')]['id']}})['then'](function(_0x37a5b5){if(_0x37a5b5){_0x212d1b=_0x37a5b5;return _0x37a5b5[_0xee6e('0x5c')](_0x3d81ec['body']['id'],{'transaction':_0x57d521});}})[_0xee6e('0x21')](function(_0x4a7222){if(_0x4a7222){return db[_0xee6e('0x5d')][_0xee6e('0x5e')]({'where':{'id':_0x3d81ec[_0xee6e('0x46')]['id']},'attributes':['id',_0xee6e('0x28'),'save_name',_0xee6e('0x5f'),_0xee6e('0x60')],'raw':!![]});}})['then'](function(_0x27ac28){if(_0x27ac28){var _0x325a82=path[_0xee6e('0x4e')](config[_0xee6e('0x4f')],'server/files/sounds/converted',util[_0xee6e('0x61')](_0xee6e('0x62'),path[_0xee6e('0x63')](_0x27ac28[_0xee6e('0x64')],path[_0xee6e('0x65')](_0x27ac28[_0xee6e('0x64')])),_0x27ac28[_0xee6e('0x5f')]));var _0x267cc1=path[_0xee6e('0x4e')](config[_0xee6e('0x4f')],_0xee6e('0x50'),_0x212d1b['name'],util['format'](_0xee6e('0x62'),_0x27ac28[_0xee6e('0x28')],_0x27ac28[_0xee6e('0x5f')]));fs[_0xee6e('0x66')](_0x325a82,_0x267cc1);return _0x27ac28;}})['catch'](function(_0x41875e){throw new db['Sequelize'][(_0xee6e('0x67'))](_0x41875e[_0xee6e('0x5b')]);});})[_0xee6e('0x21')](handleEntityNotFound(_0x585ac9,null))[_0xee6e('0x21')](respondWithResult(_0x585ac9,0xc9))[_0xee6e('0x47')](handleError(_0x585ac9,null));};exports[_0xee6e('0x68')]=function(_0x5bb21e,_0x5945b0,_0x3096bf){return db[_0xee6e('0x49')][_0xee6e('0x4a')](function(_0x20b114){var _0x2e3518;return db['VoiceMusicOnHold'][_0xee6e('0x5e')]({'where':{'id':_0x5bb21e[_0xee6e('0x45')]['id']}})[_0xee6e('0x21')](handleEntityNotFound(_0x5945b0,null))[_0xee6e('0x21')](function(_0x38f70c){if(_0x38f70c){_0x2e3518=_0x38f70c;return _0x38f70c['removeSound'](_0x5bb21e[_0xee6e('0x45')][_0xee6e('0x69')]);}})['then'](function(_0x5dfab0){if(_0x5dfab0){return db['Sound'][_0xee6e('0x5e')]({'where':{'id':_0x5bb21e[_0xee6e('0x45')][_0xee6e('0x69')]},'attributes':['id',_0xee6e('0x28'),'save_name','converted_format','createdAt'],'raw':!![]});}})[_0xee6e('0x21')](function(_0x356247){if(_0x356247){fs[_0xee6e('0x59')](path[_0xee6e('0x4e')](_0x2e3518['directory'],util[_0xee6e('0x61')](_0xee6e('0x62'),_0x356247[_0xee6e('0x28')],_0x356247['converted_format'])));return _0x356247;}})[_0xee6e('0x47')](function(_0x1ad03e){throw new db['Sequelize'][(_0xee6e('0x67'))](_0x1ad03e[_0xee6e('0x5b')]);});})[_0xee6e('0x21')](handleEntityNotFound(_0x5945b0,null))[_0xee6e('0x21')](respondWithStatusCode(_0x5945b0,0xcc))[_0xee6e('0x47')](handleError(_0x5945b0,null));};exports['getSounds']=function(_0x566157,_0x433056,_0xa36942){var _0x9682={};var _0x5ae950={};var _0x1c5c15;var _0x519845;return db[_0xee6e('0x2c')]['findOne']({'where':{'id':_0x566157[_0xee6e('0x45')]['id']}})[_0xee6e('0x21')](handleEntityNotFound(_0x433056,null))[_0xee6e('0x21')](function(_0x4f613e){if(_0x4f613e){_0x1c5c15=_0x4f613e;_0x5ae950['model']=_[_0xee6e('0x32')](db[_0xee6e('0x5d')]['rawAttributes']);_0x5ae950[_0xee6e('0x31')]=_[_0xee6e('0x32')](_0x566157[_0xee6e('0x31')]);_0x5ae950[_0xee6e('0x33')]=_[_0xee6e('0x34')](_0x5ae950[_0xee6e('0x30')],_0x5ae950['query']);_0x9682[_0xee6e('0x35')]=_[_0xee6e('0x34')](_0x5ae950[_0xee6e('0x30')],qs[_0xee6e('0x36')](_0x566157[_0xee6e('0x31')][_0xee6e('0x36')]));_0x9682[_0xee6e('0x35')]=_0x9682[_0xee6e('0x35')]['length']?_0x9682[_0xee6e('0x35')]:_0x5ae950[_0xee6e('0x30')];_0x9682[_0xee6e('0x3a')]=qs[_0xee6e('0x6a')](_0x566157[_0xee6e('0x31')][_0xee6e('0x6a')]);_0x9682['where']=qs[_0xee6e('0x33')](_[_0xee6e('0x3c')](_0x566157['query'],_0x5ae950[_0xee6e('0x33')]));if(_0x566157['query'][_0xee6e('0x3d')]){_0x9682[_0xee6e('0x3b')]=_[_0xee6e('0x3e')](_0x9682[_0xee6e('0x3b')],{'$or':_[_0xee6e('0x2b')](_0x9682[_0xee6e('0x35')],function(_0x12ed3c){var _0x2ed9ab={};_0x2ed9ab[_0x12ed3c]={'$like':'%'+_0x566157[_0xee6e('0x31')]['filter']+'%'};return _0x2ed9ab;})});}_0x9682=_[_0xee6e('0x3e')]({},_0x9682,_0x566157[_0xee6e('0x40')]);return _0x1c5c15[_0xee6e('0x6b')](_0x9682);}})[_0xee6e('0x21')](function(_0x4f107d){if(_0x4f107d){_0x519845=_0x4f107d['length'];if(!_0x566157[_0xee6e('0x31')][_0xee6e('0x38')](_0xee6e('0x39'))){_0x9682[_0xee6e('0x1a')]=qs[_0xee6e('0x1a')](_0x566157[_0xee6e('0x31')][_0xee6e('0x1a')]);_0x9682[_0xee6e('0x17')]=qs[_0xee6e('0x17')](_0x566157[_0xee6e('0x31')][_0xee6e('0x17')]);}return _0x1c5c15[_0xee6e('0x6b')](_0x9682);}})[_0xee6e('0x21')](function(_0x1c3876){if(_0x1c3876){return _0x1c3876?{'count':_0x519845,'rows':_0x1c3876}:null;}})[_0xee6e('0x21')](respondWithResult(_0x433056,null))[_0xee6e('0x47')](handleError(_0x433056,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 91a7515..295c4ba 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 _0xd623=['path','rimraf','../../config/environment','./voiceMusicOnHold.attributes','exports','voice_musiconhold','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0xab11ff,_0x4777e4){var _0x1d43e5=function(_0x5410fa){while(--_0x5410fa){_0xab11ff['push'](_0xab11ff['shift']());}};_0x1d43e5(++_0x4777e4);}(_0xd623,0xf6));var _0x3d62=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xd623[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0x3d62('0x0'));var util=require(_0x3d62('0x1'));var logger=require(_0x3d62('0x2'))(_0x3d62('0x3'));var moment=require(_0x3d62('0x4'));var BPromise=require('bluebird');var rp=require(_0x3d62('0x5'));var fs=require('fs');var path=require(_0x3d62('0x6'));var rimraf=require(_0x3d62('0x7'));var config=require(_0x3d62('0x8'));var attributes=require(_0x3d62('0x9'));module[_0x3d62('0xa')]=function(_0x4dfd58,_0x52a691){return _0x4dfd58['define']('VoiceMusicOnHold',attributes,{'tableName':_0x3d62('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd654=['lodash','util','../../config/logger','moment','request-promise','path','rimraf','./voiceMusicOnHold.attributes','exports','VoiceMusicOnHold','voice_musiconhold'];(function(_0x3d977d,_0x57ef08){var _0x194216=function(_0x566b97){while(--_0x566b97){_0x3d977d['push'](_0x3d977d['shift']());}};_0x194216(++_0x57ef08);}(_0xd654,0xbb));var _0x4d65=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd654[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x4d65('0x0'));var util=require(_0x4d65('0x1'));var logger=require(_0x4d65('0x2'))('api');var moment=require(_0x4d65('0x3'));var BPromise=require('bluebird');var rp=require(_0x4d65('0x4'));var fs=require('fs');var path=require(_0x4d65('0x5'));var rimraf=require(_0x4d65('0x6'));var config=require('../../config/environment');var attributes=require(_0x4d65('0x7'));module[_0x4d65('0x8')]=function(_0x5dfb17,_0x415ea7){return _0x5dfb17['define'](_0x4d65('0x9'),attributes,{'tableName':_0x4d65('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 d4b34b7..eee5ad9 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 _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(_0x18053a,_0x57dd18){var _0x17c58c=function(_0x2a8f3b){while(--_0x2a8f3b){_0x18053a['push'](_0x18053a['shift']());}};_0x17c58c(++_0x57dd18);}(_0x70e0,0x17b));var _0x070e=function(_0x49b567,_0x2811f2){_0x49b567=_0x49b567-0x0;var _0x5b3a35=_0x70e0[_0x49b567];return _0x5b3a35;};'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 +var _0x34e8=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x4631d8,_0x55550f){var _0x4a06d5=function(_0x33f6e5){while(--_0x33f6e5){_0x4631d8['push'](_0x4631d8['shift']());}};_0x4a06d5(++_0x55550f);}(_0x34e8,0x12c));var _0x834e=function(_0x1c5093,_0x252f2a){_0x1c5093=_0x1c5093-0x0;var _0x2680c3=_0x34e8[_0x1c5093];return _0x2680c3;};'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')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x3e16d2,_0x834e('0x10'));_0x3a3ef6(_0x363786[_0x834e('0x17')]['message']);}})[_0x834e('0x18')](function(_0x22106e){logger[_0x834e('0x14')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x3e16d2,_0x22106e);_0x2e69e2(_0x22106e);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index 6ab5797..91e8b97 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 _0x4989=['update','delete','destroy','removeAgents','removeTeams','exports','multer','connect-timeout','express','Router','fs-extra','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','/:id/users','/:id/teams','post','addAgents','addTeams'];(function(_0x1bbd58,_0x3015e6){var _0x50fd62=function(_0x376108){while(--_0x376108){_0x1bbd58['push'](_0x1bbd58['shift']());}};_0x50fd62(++_0x3015e6);}(_0x4989,0x79));var _0x9498=function(_0x2b9ac8,_0xf820cb){_0x2b9ac8=_0x2b9ac8-0x0;var _0x3ceea9=_0x4989[_0x2b9ac8];return _0x3ceea9;};'use strict';var multer=require(_0x9498('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x9498('0x1'));var express=require(_0x9498('0x2'));var router=express[_0x9498('0x3')]();var fs_extra=require(_0x9498('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x9498('0x5'));var controller=require('./voicePrefix.controller');router[_0x9498('0x6')]('/',auth[_0x9498('0x7')](),controller['index']);router[_0x9498('0x6')](_0x9498('0x8'),auth[_0x9498('0x7')](),controller[_0x9498('0x9')]);router[_0x9498('0x6')](_0x9498('0xa'),auth[_0x9498('0x7')](),controller[_0x9498('0xb')]);router[_0x9498('0x6')](_0x9498('0xc'),auth[_0x9498('0x7')](),controller['getAgents']);router[_0x9498('0x6')](_0x9498('0xd'),auth[_0x9498('0x7')](),controller['getTeams']);router[_0x9498('0xe')]('/',auth[_0x9498('0x7')](),controller['create']);router['post']('/:id/users',auth[_0x9498('0x7')](),controller[_0x9498('0xf')]);router[_0x9498('0xe')](_0x9498('0xd'),auth[_0x9498('0x7')](),controller[_0x9498('0x10')]);router['put'](_0x9498('0xa'),auth[_0x9498('0x7')](),controller[_0x9498('0x11')]);router[_0x9498('0x12')](_0x9498('0xa'),auth[_0x9498('0x7')](),controller[_0x9498('0x13')]);router[_0x9498('0x12')](_0x9498('0xc'),auth[_0x9498('0x7')](),controller[_0x9498('0x14')]);router[_0x9498('0x12')](_0x9498('0xd'),auth[_0x9498('0x7')](),controller[_0x9498('0x15')]);module[_0x9498('0x16')]=router; \ No newline at end of file +var _0xfb92=['/:id','update','destroy','removeAgents','delete','removeTeams','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voicePrefix.controller','get','isAuthenticated','describe','show','/:id/users','post','create','addAgents','/:id/teams','addTeams','put'];(function(_0x9d1ff,_0x5d9a5e){var _0x4ccdff=function(_0x3cec5c){while(--_0x3cec5c){_0x9d1ff['push'](_0x9d1ff['shift']());}};_0x4ccdff(++_0x5d9a5e);}(_0xfb92,0x1e3));var _0x2fb9=function(_0x3327ee,_0x3ef963){_0x3327ee=_0x3327ee-0x0;var _0x18aeb6=_0xfb92[_0x3327ee];return _0x18aeb6;};'use strict';var multer=require(_0x2fb9('0x0'));var util=require('util');var path=require(_0x2fb9('0x1'));var timeout=require(_0x2fb9('0x2'));var express=require(_0x2fb9('0x3'));var router=express[_0x2fb9('0x4')]();var fs_extra=require(_0x2fb9('0x5'));var auth=require(_0x2fb9('0x6'));var interaction=require(_0x2fb9('0x7'));var config=require(_0x2fb9('0x8'));var controller=require(_0x2fb9('0x9'));router[_0x2fb9('0xa')]('/',auth[_0x2fb9('0xb')](),controller['index']);router['get']('/describe',auth[_0x2fb9('0xb')](),controller[_0x2fb9('0xc')]);router[_0x2fb9('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x2fb9('0xd')]);router[_0x2fb9('0xa')](_0x2fb9('0xe'),auth[_0x2fb9('0xb')](),controller['getAgents']);router[_0x2fb9('0xa')]('/:id/teams',auth['isAuthenticated'](),controller['getTeams']);router[_0x2fb9('0xf')]('/',auth[_0x2fb9('0xb')](),controller[_0x2fb9('0x10')]);router[_0x2fb9('0xf')](_0x2fb9('0xe'),auth[_0x2fb9('0xb')](),controller[_0x2fb9('0x11')]);router[_0x2fb9('0xf')](_0x2fb9('0x12'),auth['isAuthenticated'](),controller[_0x2fb9('0x13')]);router[_0x2fb9('0x14')](_0x2fb9('0x15'),auth['isAuthenticated'](),controller[_0x2fb9('0x16')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x2fb9('0x17')]);router['delete']('/:id/users',auth['isAuthenticated'](),controller[_0x2fb9('0x18')]);router[_0x2fb9('0x19')](_0x2fb9('0x12'),auth[_0x2fb9('0xb')](),controller[_0x2fb9('0x1a')]);module[_0x2fb9('0x1b')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index 471d03b..f3c4e78 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 _0x8fb5=['exports','STRING','system-','getDataValue','name'];(function(_0x82b3c0,_0x32d9b6){var _0x5d1fb2=function(_0x39a842){while(--_0x39a842){_0x82b3c0['push'](_0x82b3c0['shift']());}};_0x5d1fb2(++_0x32d9b6);}(_0x8fb5,0xc8));var _0x58fb=function(_0x2ec7f2,_0xe24da3){_0x2ec7f2=_0x2ec7f2-0x0;var _0x29de00=_0x8fb5[_0x2ec7f2];return _0x29de00;};'use strict';var Sequelize=require('sequelize');module[_0x58fb('0x0')]={'name':{'type':Sequelize[_0x58fb('0x1')],'allowNull':![],'unique':'name'},'prefix':{'type':Sequelize['VIRTUAL'],'get':function(_0x517cfa){return _0x58fb('0x2')+this[_0x58fb('0x3')](_0x58fb('0x4'))+'-';}},'description':{'type':Sequelize[_0x58fb('0x1')]},'callerIdAll':{'type':Sequelize[_0x58fb('0x1')]},'VoiceExtensionId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x3f1d=['name','sequelize','exports','STRING','VIRTUAL','system-','getDataValue'];(function(_0x14a2de,_0xb6f4fa){var _0x5f2d6c=function(_0x34d62d){while(--_0x34d62d){_0x14a2de['push'](_0x14a2de['shift']());}};_0x5f2d6c(++_0xb6f4fa);}(_0x3f1d,0x112));var _0xd3f1=function(_0x1b941a,_0x5df292){_0x1b941a=_0x1b941a-0x0;var _0x335598=_0x3f1d[_0x1b941a];return _0x335598;};'use strict';var Sequelize=require(_0xd3f1('0x0'));module[_0xd3f1('0x1')]={'name':{'type':Sequelize[_0xd3f1('0x2')],'allowNull':![],'unique':'name'},'prefix':{'type':Sequelize[_0xd3f1('0x3')],'get':function(_0x4fe501){return _0xd3f1('0x4')+this[_0xd3f1('0x5')](_0xd3f1('0x6'))+'-';}},'description':{'type':Sequelize[_0xd3f1('0x2')]},'callerIdAll':{'type':Sequelize[_0xd3f1('0x2')]},'VoiceExtensionId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index c8e02c1..9811c31 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 _0x0972=['filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','catch','params','keys','include','find','create','sequelize','transaction','body','VoiceExtension','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','VoicePrefixes','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','exten','system','Voice\x20Prefix\x20Extension','priority','appdata','NoOp','Voice\x20Prefix','VoicePrefixId','get','Extensions\x20creation\x20failed','prefix','push','callerIdAll','Set','PREFIX-CALLERIDALL=','No\x20callerid\x20available','goto','length','charAt','system-','VoiceExtensionId','findById','addAgents','ids','spread','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','getAgents','findOne','User','getTeams','addTeams','Team','findAll','Agents','online','voicePause','interface','each','TeamVoicePrefix','upsert','UserVoicePrefix','findOrCreate','forEach','removeTeams','select','field','team_has_voice_prefixes','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','clone','ut.UserId\x20=\x20?','QueryTypes','every','TeamId','includes','all','union','value','isEmpty','rimraf','fast-json-patch','moment','bluebird','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','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','UserProfileResource','end','name','send','index','map','VoicePrefix','rawAttributes','fieldName','type','key','query'];(function(_0x5e08bc,_0x3108bf){var _0x36e3a6=function(_0x57e8ba){while(--_0x57e8ba){_0x5e08bc['push'](_0x5e08bc['shift']());}};_0x36e3a6(++_0x3108bf);}(_0x0972,0x64));var _0x2097=function(_0x36762b,_0x452757){_0x36762b=_0x36762b-0x0;var _0x2795d5=_0x0972[_0x36762b];return _0x2795d5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2097('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2097('0x1'));var rp=require('request-promise');var moment=require(_0x2097('0x2'));var BPromise=require(_0x2097('0x3'));var Mustache=require('mustache');var util=require(_0x2097('0x4'));var path=require(_0x2097('0x5'));var sox=require(_0x2097('0x6'));var csv=require(_0x2097('0x7'));var ejs=require(_0x2097('0x8'));var fs=require('fs');var fs_extra=require(_0x2097('0x9'));var _=require(_0x2097('0xa'));var squel=require('squel');var crypto=require(_0x2097('0xb'));var jsforce=require(_0x2097('0xc'));var deskjs=require(_0x2097('0xd'));var toCsv=require(_0x2097('0x7'));var querystring=require(_0x2097('0xe'));var Papa=require('papaparse');var Redis=require(_0x2097('0xf'));var authService=require(_0x2097('0x10'));var qs=require(_0x2097('0x11'));var as=require(_0x2097('0x12'));var hardwareService=require(_0x2097('0x13'));var logger=require(_0x2097('0x14'))(_0x2097('0x15'));var utils=require(_0x2097('0x16'));var config=require(_0x2097('0x17'));var licenseUtil=require(_0x2097('0x18'));var db=require(_0x2097('0x19'))['db'];config[_0x2097('0x1a')]=_[_0x2097('0x1b')](config[_0x2097('0x1a')],{'host':_0x2097('0x1c'),'port':0x18eb});var socket=require(_0x2097('0x1d'))(new Redis(config[_0x2097('0x1a')]));require(_0x2097('0x1e'))[_0x2097('0x1f')](socket);function respondWithStatusCode(_0x354387,_0x5d0a43){_0x5d0a43=_0x5d0a43||0xcc;return function(_0x639c14){if(_0x639c14){return _0x354387[_0x2097('0x20')](_0x5d0a43);}return _0x354387['status'](_0x5d0a43)['end']();};}function respondWithResult(_0x4fc8c5,_0x409deb){_0x409deb=_0x409deb||0xc8;return function(_0x588396){if(_0x588396){return _0x4fc8c5[_0x2097('0x21')](_0x409deb)[_0x2097('0x22')](_0x588396);}};}function respondWithFilteredResult(_0x43fec9,_0x1347e4){return function(_0x44c584){if(_0x44c584){var _0x53e2b4=typeof _0x1347e4[_0x2097('0x23')]===_0x2097('0x24')&&typeof _0x1347e4[_0x2097('0x25')]===_0x2097('0x24');var _0x1d3804=_0x44c584[_0x2097('0x26')];var _0x253f5d=_0x53e2b4?0x0:_0x1347e4[_0x2097('0x23')];var _0x5d8b9e=_0x53e2b4?_0x44c584['count']:_0x1347e4[_0x2097('0x23')]+_0x1347e4['limit'];var _0x227c00;if(_0x5d8b9e>=_0x1d3804){_0x5d8b9e=_0x1d3804;_0x227c00=0xc8;}else{_0x227c00=0xce;}_0x43fec9[_0x2097('0x21')](_0x227c00);return _0x43fec9['set'](_0x2097('0x27'),_0x253f5d+'-'+_0x5d8b9e+'/'+_0x1d3804)['json'](_0x44c584);}return null;};}function patchUpdates(_0x2e17c8){return function(_0xf32d3f){try{jsonpatch[_0x2097('0x28')](_0xf32d3f,_0x2e17c8,!![]);}catch(_0x20b93a){return BPromise[_0x2097('0x29')](_0x20b93a);}return _0xf32d3f[_0x2097('0x2a')]();};}function saveUpdates(_0x56390a,_0xae5f9){return function(_0x500234){if(_0x500234){return _0x500234[_0x2097('0x2b')](_0x56390a)[_0x2097('0x2c')](function(_0x345875){return _0x345875;});}return null;};}function removeEntity(_0x9f59bc,_0x499988){return function(_0x2d683a){if(_0x2d683a){return _0x2d683a[_0x2097('0x2d')]()['then'](function(){var _0x1229fc=_0x2d683a['get']({'plain':!![]});var _0x29b879='VoicePrefixes';return db[_0x2097('0x2e')][_0x2097('0x2d')]({'where':{'type':_0x29b879,'resourceId':_0x1229fc['id']}})[_0x2097('0x2c')](function(){return _0x2d683a;});})[_0x2097('0x2c')](function(){_0x9f59bc[_0x2097('0x21')](0xcc)[_0x2097('0x2f')]();});}};}function handleEntityNotFound(_0x450e0b,_0x4b443d){return function(_0x11242f){if(!_0x11242f){_0x450e0b[_0x2097('0x20')](0x194);}return _0x11242f;};}function handleError(_0x5cce55,_0x1398d0){_0x1398d0=_0x1398d0||0x1f4;return function(_0x41487d){logger['error'](_0x41487d['stack']);if(_0x41487d[_0x2097('0x30')]){delete _0x41487d[_0x2097('0x30')];}_0x5cce55[_0x2097('0x21')](_0x1398d0)[_0x2097('0x31')](_0x41487d);};}exports[_0x2097('0x32')]=function(_0x180654,_0x56c538){var _0xe1a381={},_0x56bb42={},_0x193160={'count':0x0,'rows':[]};var _0x3c36d3=_[_0x2097('0x33')](db[_0x2097('0x34')][_0x2097('0x35')],function(_0x395d9f){return{'name':_0x395d9f[_0x2097('0x36')],'type':_0x395d9f[_0x2097('0x37')][_0x2097('0x38')]};});_0x56bb42['model']=_[_0x2097('0x33')](_0x3c36d3,_0x2097('0x30'));_0x56bb42[_0x2097('0x39')]=_['keys'](_0x180654[_0x2097('0x39')]);_0x56bb42[_0x2097('0x3a')]=_[_0x2097('0x3b')](_0x56bb42[_0x2097('0x3c')],_0x56bb42['query']);_0xe1a381['attributes']=_['intersection'](_0x56bb42[_0x2097('0x3c')],qs[_0x2097('0x3d')](_0x180654[_0x2097('0x39')][_0x2097('0x3d')]));_0xe1a381[_0x2097('0x3e')]=_0xe1a381[_0x2097('0x3e')]['length']?_0xe1a381[_0x2097('0x3e')]:_0x56bb42[_0x2097('0x3c')];if(!_0x180654[_0x2097('0x39')][_0x2097('0x3f')](_0x2097('0x40'))){_0xe1a381[_0x2097('0x25')]=qs['limit'](_0x180654[_0x2097('0x39')][_0x2097('0x25')]);_0xe1a381[_0x2097('0x23')]=qs['offset'](_0x180654['query'][_0x2097('0x23')]);}_0xe1a381[_0x2097('0x41')]=qs[_0x2097('0x42')](_0x180654[_0x2097('0x39')][_0x2097('0x42')]);_0xe1a381[_0x2097('0x43')]=qs[_0x2097('0x3a')](_[_0x2097('0x44')](_0x180654[_0x2097('0x39')],_0x56bb42[_0x2097('0x3a')]),_0x3c36d3);if(_0x180654[_0x2097('0x39')][_0x2097('0x45')]){_0xe1a381['where']=_[_0x2097('0x46')](_0xe1a381[_0x2097('0x43')],{'$or':_[_0x2097('0x33')](_0x3c36d3,function(_0x483900){if(_0x483900[_0x2097('0x37')]!==_0x2097('0x47')){var _0x26d448={};_0x26d448[_0x483900[_0x2097('0x30')]]={'$like':'%'+_0x180654[_0x2097('0x39')][_0x2097('0x45')]+'%'};return _0x26d448;}})});}_0xe1a381=_[_0x2097('0x46')]({},_0xe1a381,_0x180654[_0x2097('0x48')]);var _0x5ab893={'where':_0xe1a381[_0x2097('0x43')]};return db[_0x2097('0x34')][_0x2097('0x26')](_0x5ab893)[_0x2097('0x2c')](function(_0x12e0e2){_0x193160[_0x2097('0x26')]=_0x12e0e2;if(_0x180654[_0x2097('0x39')][_0x2097('0x49')]){_0xe1a381['include']=[{'all':!![]}];}return db[_0x2097('0x34')]['findAll'](_0xe1a381);})[_0x2097('0x2c')](function(_0x298e49){_0x193160[_0x2097('0x4a')]=_0x298e49;return _0x193160;})[_0x2097('0x2c')](respondWithFilteredResult(_0x56c538,_0xe1a381))[_0x2097('0x4b')](handleError(_0x56c538,null));};exports['show']=function(_0x2cf34e,_0x46ccbb){var _0x113c3b={'raw':![],'where':{'id':_0x2cf34e[_0x2097('0x4c')]['id']}},_0x39e0a4={};_0x39e0a4['model']=_[_0x2097('0x4d')](db[_0x2097('0x34')][_0x2097('0x35')]);_0x39e0a4[_0x2097('0x39')]=_[_0x2097('0x4d')](_0x2cf34e[_0x2097('0x39')]);_0x39e0a4[_0x2097('0x3a')]=_[_0x2097('0x3b')](_0x39e0a4['model'],_0x39e0a4[_0x2097('0x39')]);_0x113c3b[_0x2097('0x3e')]=_[_0x2097('0x3b')](_0x39e0a4[_0x2097('0x3c')],qs['fields'](_0x2cf34e['query']['fields']));_0x113c3b[_0x2097('0x3e')]=_0x113c3b[_0x2097('0x3e')]['length']?_0x113c3b[_0x2097('0x3e')]:_0x39e0a4[_0x2097('0x3c')];if(_0x2cf34e['query']['includeAll']){_0x113c3b[_0x2097('0x4e')]=[{'all':!![]}];}_0x113c3b=_[_0x2097('0x46')]({},_0x113c3b,_0x2cf34e[_0x2097('0x48')]);return db['VoicePrefix'][_0x2097('0x4f')](_0x113c3b)[_0x2097('0x2c')](handleEntityNotFound(_0x46ccbb,null))['then'](respondWithResult(_0x46ccbb,null))[_0x2097('0x4b')](handleError(_0x46ccbb,null));};exports[_0x2097('0x2d')]=function(_0xdfea21,_0xba6ef0){return db[_0x2097('0x34')]['find']({'where':{'id':_0xdfea21['params']['id']}})[_0x2097('0x2c')](handleEntityNotFound(_0xba6ef0,null))[_0x2097('0x2c')](removeEntity(_0xba6ef0,null))[_0x2097('0x4b')](handleError(_0xba6ef0,null));};exports['describe']=function(_0x5c1739,_0x144719){return db[_0x2097('0x34')]['describe']()[_0x2097('0x2c')](respondWithResult(_0x144719,null))[_0x2097('0x4b')](handleError(_0x144719,null));};exports[_0x2097('0x50')]=function(_0x33490e,_0x390a52){var _0x4a709a;return db[_0x2097('0x51')][_0x2097('0x52')](function(_0x190859){return db['VoicePrefix'][_0x2097('0x50')](_0x33490e[_0x2097('0x53')],{'transaction':_0x190859})['then'](function(_0x12ba76){_0x4a709a=_0x12ba76['get']({'plain':!![]});return db[_0x2097('0x54')]['find']({'where':{'id':_0x4a709a['VoiceExtensionId']},'raw':!![]})['then'](function(_0x40cbe1){return createVoicePrefixExtensions(_0x4a709a,_0x40cbe1,_0x190859);});});})['then'](function(){var _0x54bea1=_0x33490e[_0x2097('0x55')]['get']({'plain':!![]});if(!_0x54bea1)throw new Error(_0x2097('0x56'));if(_0x54bea1[_0x2097('0x57')]==='user'){var _0x3e799f=_0x4a709a;return db[_0x2097('0x58')][_0x2097('0x4f')]({'where':{'name':_0x2097('0x59'),'userProfileId':_0x54bea1[_0x2097('0x5a')]},'raw':!![]})['then'](function(_0x2117e3){if(_0x2117e3&&_0x2117e3['autoAssociation']===0x0){return db[_0x2097('0x2e')][_0x2097('0x50')]({'name':_0x3e799f[_0x2097('0x30')],'resourceId':_0x3e799f['id'],'type':_0x2117e3['name'],'sectionId':_0x2117e3['id']},{})[_0x2097('0x2c')](function(){return _0x4a709a;});}else{return _0x4a709a;}})[_0x2097('0x4b')](function(_0x2f5016){logger[_0x2097('0x5b')](_0x2097('0x5c'),_0x2f5016);throw _0x2f5016;});}return _0x4a709a;})['then'](respondWithResult(_0x390a52,null))['catch'](handleError(_0x390a52,null));};function Extension(_0x265eac,_0x275578,_0x4cc782,_0x4ddb4b){this['context']='from-sip';this[_0x2097('0x5d')]=_0x265eac;this['app']=_0x4cc782;this[_0x2097('0x37')]=_0x2097('0x5e');this['description']=_0x2097('0x5f');this[_0x2097('0x60')]=_0x275578;this[_0x2097('0x61')]=_0x4ddb4b;}function createVoicePrefixExtensions(_0x103756,_0x2a2673,_0x60332a){return new BPromise(function(_0x15aa91,_0x8f7aaa){var _0x2ec365=new Extension(formatPrefixName(_0x103756['prefix']),0x1,_0x2097('0x62'),_0x2097('0x63'));_0x2ec365[_0x2097('0x64')]=_0x103756['id'];return db[_0x2097('0x54')][_0x2097('0x50')](_0x2ec365,{'transaction':_0x60332a})[_0x2097('0x2c')](function(_0x4befa9){var _0x43071d=_0x4befa9[_0x2097('0x65')]({'plain':!![]});var _0xcabda7=_[_0x2097('0x33')](addVoicePrefixExtensions(_0x103756,_0x2a2673),function(_0x1c4156){_0x1c4156['VoiceExtensionId']=_0x43071d['id'];_0x1c4156[_0x2097('0x64')]=_0x103756['id'];return _0x1c4156;});return db[_0x2097('0x54')]['bulkCreate'](_0xcabda7,{'transaction':_0x60332a})['then'](function(_0x580c1e){if(!_0x580c1e){return _0x8f7aaa(_0x2097('0x66'));}else{return _0x15aa91(_0x580c1e);}})[_0x2097('0x4b')](function(_0x319d3b){return _0x8f7aaa(_0x319d3b);});});;});};function addVoicePrefixExtensions(_0x3edb3e,_0x168703){var _0x18d90a=[];var _0x2e287b=formatPrefixName(_0x3edb3e[_0x2097('0x67')]);_0x18d90a[_0x2097('0x68')](new Extension(_0x2e287b,0x2,'Set','CDR(prefix)='+_0x3edb3e[_0x2097('0x30')]));if(_0x3edb3e[_0x2097('0x69')]){_0x18d90a[_0x2097('0x68')](new Extension(_0x2e287b,0x3,_0x2097('0x6a'),_0x2097('0x6b')+_0x3edb3e[_0x2097('0x69')]));}else{_0x18d90a['push'](new Extension(_0x2e287b,0x3,_0x2097('0x62'),_0x2097('0x6c')));}_0x18d90a[_0x2097('0x68')](new Extension(_0x2e287b,0x4,_0x2097('0x6d'),_0x168703['context']+','+'${EXTEN:'+(0x8+_0x3edb3e[_0x2097('0x30')][_0x2097('0x6e')])+'}'+','+0x1));return _0x18d90a;}function formatPrefixName(_0x487f1f){var _0x3707da='_';for(var _0x426290=0x0;_0x426290<_0x487f1f[_0x2097('0x6e')];_0x426290++){if(_0x487f1f[_0x2097('0x6f')](_0x426290)=='-'){_0x3707da+=_0x487f1f[_0x2097('0x6f')](_0x426290);}else{_0x3707da+='['+_0x487f1f[_0x2097('0x6f')](_0x426290)+']';}}_0x3707da+='.';return _0x3707da;}exports[_0x2097('0x2b')]=function(_0x2c6f24,_0x54159e,_0x4533fd){var _0x283e2b=_0x2c6f24['body'];_0x283e2b[_0x2097('0x67')]=_0x2097('0x70')+_0x283e2b[_0x2097('0x30')]+'-';return db[_0x2097('0x51')][_0x2097('0x52')](function(_0x46d6b5){return db[_0x2097('0x34')][_0x2097('0x2b')](_0x283e2b,{'where':{'id':_0x283e2b['id']},'transaction':_0x46d6b5})[_0x2097('0x2c')](function(){return db[_0x2097('0x54')][_0x2097('0x2d')]({'where':{'VoicePrefixId':_0x283e2b['id']},'transaction':_0x46d6b5})['then'](function(){return db[_0x2097('0x54')][_0x2097('0x4f')]({'where':{'id':_0x283e2b[_0x2097('0x71')]},'raw':!![]})[_0x2097('0x2c')](function(_0x3c9e03){return createVoicePrefixExtensions(_0x283e2b,_0x3c9e03,_0x46d6b5);});});});})['then'](function(){return db[_0x2097('0x34')][_0x2097('0x72')](_0x283e2b['id']);})[_0x2097('0x2c')](respondWithResult(_0x54159e,null))['catch'](handleError(_0x54159e,null));};exports[_0x2097('0x73')]=function(_0x545cd9,_0x364d3a,_0x4dcd9c){return db[_0x2097('0x34')]['find']({'where':{'id':_0x545cd9[_0x2097('0x4c')]['id']}})['then'](handleEntityNotFound(_0x364d3a,null))[_0x2097('0x2c')](function(_0x3dba80){if(_0x3dba80){return _0x3dba80[_0x2097('0x73')](_0x545cd9[_0x2097('0x53')][_0x2097('0x74')],_['omit'](_0x545cd9[_0x2097('0x53')],[_0x2097('0x74'),'id'])||{})[_0x2097('0x75')](function(_0x1f733c){for(var _0xa8416a=0x0;_0xa8416a<_0x545cd9[_0x2097('0x53')][_0x2097('0x74')][_0x2097('0x6e')];_0xa8416a+=0x1){socket[_0x2097('0x76')](_0x2097('0x77'),{'UserId':Number(_0x545cd9[_0x2097('0x53')][_0x2097('0x74')][_0xa8416a]),'VoicePrefixId':Number(_0x545cd9[_0x2097('0x4c')]['id'])});}return _0x1f733c;});}})[_0x2097('0x2c')](respondWithResult(_0x364d3a,null))[_0x2097('0x4b')](handleError(_0x364d3a,null));};exports[_0x2097('0x78')]=function(_0x57a31e,_0x1a81de,_0x4bd44d){return db['VoicePrefix'][_0x2097('0x4f')]({'where':{'id':_0x57a31e[_0x2097('0x4c')]['id']}})[_0x2097('0x2c')](handleEntityNotFound(_0x1a81de,null))['then'](function(_0x34b687){if(_0x34b687){return _0x34b687[_0x2097('0x78')](_0x57a31e[_0x2097('0x39')][_0x2097('0x74')])['then'](function(){if(_[_0x2097('0x79')](_0x57a31e['query'][_0x2097('0x74')])){for(var _0x385551=0x0;_0x385551<_0x57a31e[_0x2097('0x39')][_0x2097('0x74')]['length'];_0x385551+=0x1){socket[_0x2097('0x76')](_0x2097('0x7a'),{'UserId':Number(_0x57a31e[_0x2097('0x39')]['ids'][_0x385551]),'VoicePrefixId':Number(_0x57a31e[_0x2097('0x4c')]['id'])});}}else{socket[_0x2097('0x76')](_0x2097('0x7a'),{'UserId':Number(_0x57a31e['query'][_0x2097('0x74')]),'VoicePrefixId':Number(_0x57a31e[_0x2097('0x4c')]['id'])});}});}})[_0x2097('0x2c')](respondWithStatusCode(_0x1a81de,null))[_0x2097('0x4b')](handleError(_0x1a81de,null));};exports[_0x2097('0x7b')]=function(_0x5efe1e,_0x5d181f,_0x56d4c0){var _0xc7481d={};var _0x3f510d={};var _0x4213d0;var _0x16451c;return db[_0x2097('0x34')][_0x2097('0x7c')]({'where':{'id':_0x5efe1e['params']['id']}})[_0x2097('0x2c')](handleEntityNotFound(_0x5d181f,null))[_0x2097('0x2c')](function(_0x164ad3){if(_0x164ad3){_0x4213d0=_0x164ad3;_0x3f510d[_0x2097('0x3c')]=_[_0x2097('0x4d')](db[_0x2097('0x7d')][_0x2097('0x35')]);_0x3f510d['query']=_[_0x2097('0x4d')](_0x5efe1e[_0x2097('0x39')]);_0x3f510d[_0x2097('0x3a')]=_[_0x2097('0x3b')](_0x3f510d[_0x2097('0x3c')],_0x3f510d[_0x2097('0x39')]);_0xc7481d['attributes']=_['intersection'](_0x3f510d[_0x2097('0x3c')],qs['fields'](_0x5efe1e['query'][_0x2097('0x3d')]));_0xc7481d[_0x2097('0x3e')]=_0xc7481d[_0x2097('0x3e')][_0x2097('0x6e')]?_0xc7481d[_0x2097('0x3e')]:_0x3f510d[_0x2097('0x3c')];_0xc7481d[_0x2097('0x41')]=qs[_0x2097('0x42')](_0x5efe1e['query'][_0x2097('0x42')]);_0xc7481d[_0x2097('0x43')]=qs[_0x2097('0x3a')](_[_0x2097('0x44')](_0x5efe1e[_0x2097('0x39')],_0x3f510d['filters']));if(_0x5efe1e[_0x2097('0x39')][_0x2097('0x45')]){_0xc7481d[_0x2097('0x43')]=_[_0x2097('0x46')](_0xc7481d[_0x2097('0x43')],{'$or':_[_0x2097('0x33')](_0xc7481d['attributes'],function(_0x33b0c0){var _0x79f858={};_0x79f858[_0x33b0c0]={'$like':'%'+_0x5efe1e['query']['filter']+'%'};return _0x79f858;})});}_0xc7481d=_['merge']({},_0xc7481d,_0x5efe1e['options']);return _0x4213d0[_0x2097('0x7b')](_0xc7481d);}})[_0x2097('0x2c')](function(_0x3fe29e){if(_0x3fe29e){_0x16451c=_0x3fe29e[_0x2097('0x6e')];if(!_0x5efe1e[_0x2097('0x39')]['hasOwnProperty'](_0x2097('0x40'))){_0xc7481d[_0x2097('0x25')]=qs[_0x2097('0x25')](_0x5efe1e[_0x2097('0x39')][_0x2097('0x25')]);_0xc7481d[_0x2097('0x23')]=qs['offset'](_0x5efe1e[_0x2097('0x39')][_0x2097('0x23')]);}return _0x4213d0['getAgents'](_0xc7481d);}})[_0x2097('0x2c')](function(_0x358bc3){if(_0x358bc3){return _0x358bc3?{'count':_0x16451c,'rows':_0x358bc3}:null;}})[_0x2097('0x2c')](respondWithResult(_0x5d181f,null))[_0x2097('0x4b')](handleError(_0x5d181f,null));};exports[_0x2097('0x7e')]=function(_0x498a91,_0x3a7959,_0x35570d){var _0x86f89={};var _0x26a3e5={};var _0x25bb03;var _0x429c9e;return db[_0x2097('0x34')][_0x2097('0x7c')]({'where':{'id':_0x498a91[_0x2097('0x4c')]['id']}})[_0x2097('0x2c')](handleEntityNotFound(_0x3a7959,null))[_0x2097('0x2c')](function(_0x299a3e){if(_0x299a3e){_0x25bb03=_0x299a3e;_0x26a3e5[_0x2097('0x3c')]=_['keys'](db['Team'][_0x2097('0x35')]);_0x26a3e5['query']=_['keys'](_0x498a91[_0x2097('0x39')]);_0x26a3e5[_0x2097('0x3a')]=_[_0x2097('0x3b')](_0x26a3e5[_0x2097('0x3c')],_0x26a3e5[_0x2097('0x39')]);_0x86f89['attributes']=_['intersection'](_0x26a3e5[_0x2097('0x3c')],qs['fields'](_0x498a91[_0x2097('0x39')]['fields']));_0x86f89['attributes']=_0x86f89['attributes']['length']?_0x86f89['attributes']:_0x26a3e5[_0x2097('0x3c')];_0x86f89[_0x2097('0x41')]=qs[_0x2097('0x42')](_0x498a91[_0x2097('0x39')][_0x2097('0x42')]);_0x86f89[_0x2097('0x43')]=qs[_0x2097('0x3a')](_[_0x2097('0x44')](_0x498a91[_0x2097('0x39')],_0x26a3e5[_0x2097('0x3a')]));if(_0x498a91[_0x2097('0x39')][_0x2097('0x45')]){_0x86f89[_0x2097('0x43')]=_[_0x2097('0x46')](_0x86f89[_0x2097('0x43')],{'$or':_[_0x2097('0x33')](_0x86f89[_0x2097('0x3e')],function(_0x5e49bc){var _0x1e30c5={};_0x1e30c5[_0x5e49bc]={'$like':'%'+_0x498a91[_0x2097('0x39')][_0x2097('0x45')]+'%'};return _0x1e30c5;})});}_0x86f89=_[_0x2097('0x46')]({},_0x86f89,_0x498a91[_0x2097('0x48')]);return _0x25bb03[_0x2097('0x7e')](_0x86f89);}})[_0x2097('0x2c')](function(_0x1c5ec7){if(_0x1c5ec7){_0x429c9e=_0x1c5ec7[_0x2097('0x6e')];if(!_0x498a91[_0x2097('0x39')][_0x2097('0x3f')]('nolimit')){_0x86f89[_0x2097('0x25')]=qs[_0x2097('0x25')](_0x498a91[_0x2097('0x39')][_0x2097('0x25')]);_0x86f89[_0x2097('0x23')]=qs[_0x2097('0x23')](_0x498a91['query']['offset']);}return _0x25bb03[_0x2097('0x7e')](_0x86f89);}})[_0x2097('0x2c')](function(_0x2beb7a){if(_0x2beb7a){return _0x2beb7a?{'count':_0x429c9e,'rows':_0x2beb7a}:null;}})['then'](respondWithResult(_0x3a7959,null))[_0x2097('0x4b')](handleError(_0x3a7959,null));};exports[_0x2097('0x7f')]=function(_0x4eeac1,_0x459585,_0x436533){var _0x16405f=_0x4eeac1[_0x2097('0x53')][_0x2097('0x74')];var _0x41f718;return db[_0x2097('0x80')][_0x2097('0x81')]({'where':{'id':_0x16405f},'attributes':['id'],'include':[{'model':db[_0x2097('0x7d')],'as':_0x2097('0x82'),'attributes':['id',_0x2097('0x30'),_0x2097('0x83'),_0x2097('0x84'),_0x2097('0x85')],'raw':!![]}]})[_0x2097('0x2c')](function(_0x44661a){if(_0x44661a){_0x41f718=_0x44661a;var _0x39e21f=_['flatMap'](_0x44661a,function(_0x2d211b){var _0x1ab39a=_0x2d211b[_0x2097('0x65')]({'plain':!![]});return _0x1ab39a[_0x2097('0x82')];});return db[_0x2097('0x34')][_0x2097('0x4f')]({'where':{'id':_0x4eeac1[_0x2097('0x4c')]['id']}})[_0x2097('0x2c')](function(_0xecd4fc){return db[_0x2097('0x51')]['transaction'](function(_0x2fb539){return _0xecd4fc[_0x2097('0x7f')](_0x16405f,{'transaction':_0x2fb539})[_0x2097('0x2c')](function(){return BPromise[_0x2097('0x86')](_0x41f718,function(_0x17c494){return db[_0x2097('0x87')][_0x2097('0x88')]({'TeamId':_0x17c494['id'],'VoicePrefixId':_0x4eeac1[_0x2097('0x4c')]['id']},{'transaction':_0x2fb539});});})['then'](function(){return BPromise[_0x2097('0x86')](_0x39e21f,function(_0x239570){return db[_0x2097('0x89')][_0x2097('0x8a')]({'where':{'UserId':_0x239570['id'],'VoicePrefixId':_0x4eeac1[_0x2097('0x4c')]['id']},'transaction':_0x2fb539});});})[_0x2097('0x2c')](function(){_0x39e21f[_0x2097('0x8b')](function(_0x51bb2f){socket[_0x2097('0x76')](_0x2097('0x77'),{'UserId':_0x51bb2f['id'],'VoicePrefixId':_0xecd4fc['id']});});});});});}})['then'](respondWithStatusCode(_0x459585,null))[_0x2097('0x4b')](handleError(_0x459585,null));};exports[_0x2097('0x8c')]=function(_0x568de5,_0x473a54,_0x53a5ed){return db[_0x2097('0x80')][_0x2097('0x81')]({'where':{'id':_0x568de5['query']['ids']},'attributes':['id'],'include':[{'model':db[_0x2097('0x7d')],'as':_0x2097('0x82'),'attributes':['id'],'raw':!![]}]})[_0x2097('0x2c')](handleEntityNotFound(_0x473a54,null))[_0x2097('0x2c')](function(_0x1909d8){var _0x2de4=_[_0x2097('0x33')](_0x1909d8,'id');var _0x43a1f8=[];var _0xb53629=[];var _0x516ed6=squel[_0x2097('0x8d')]();_0x516ed6[_0x2097('0x8e')]('tq.TeamId')['from'](_0x2097('0x8f'),'tq')[_0x2097('0x90')](_0x2097('0x91'),'ut',_0x2097('0x92'))[_0x2097('0x43')](_0x2097('0x93'),_0x568de5[_0x2097('0x4c')]['id']);for(var _0x5626f0=0x0;_0x5626f0<_0x1909d8[_0x2097('0x6e')];_0x5626f0+=0x1){let _0x45bbca=_0x1909d8[_0x5626f0];for(var _0x46fc92=0x0;_0x46fc92<_0x45bbca[_0x2097('0x82')][_0x2097('0x6e')];_0x46fc92+=0x1){let _0x357a5b=_0x45bbca[_0x2097('0x82')][_0x46fc92];var _0x3fcedc=_0x516ed6[_0x2097('0x94')]();_0x3fcedc[_0x2097('0x43')](_0x2097('0x95'),_0x357a5b['id']);_0xb53629['push'](db[_0x2097('0x51')][_0x2097('0x39')](_0x3fcedc['toString'](),{'type':db[_0x2097('0x51')][_0x2097('0x96')]['SELECT']})[_0x2097('0x2c')](function(_0xbe052f){if(_0xbe052f['length']===0x1){return _0x357a5b['id'];}else{var _0x32c5f1=_[_0x2097('0x97')](_[_0x2097('0x33')](_0xbe052f,_0x2097('0x98')),function(_0x456633){return _[_0x2097('0x99')](_0x2de4,_0x456633);});if(_0x32c5f1){return _0x357a5b['id'];}}}));}}return BPromise[_0x2097('0x9a')](_0xb53629)[_0x2097('0x2c')](function(_0x124d8f){_0x43a1f8=_(_0x43a1f8)[_0x2097('0x9b')](_0x124d8f)['compact']()[_0x2097('0x9c')]();return db[_0x2097('0x34')][_0x2097('0x4f')]({'where':{'id':_0x568de5[_0x2097('0x4c')]['id']}})['then'](function(_0x1b555e){return db['sequelize'][_0x2097('0x52')](function(_0x1ab515){return _0x1b555e[_0x2097('0x8c')](_0x568de5[_0x2097('0x39')][_0x2097('0x74')],{'transaction':_0x1ab515})[_0x2097('0x2c')](function(){if(!_[_0x2097('0x9d')](_0x43a1f8)){return _0x1b555e[_0x2097('0x78')](_0x43a1f8,{'transaction':_0x1ab515});}})[_0x2097('0x2c')](function(){_0x43a1f8['forEach'](function(_0x22fa5d){socket['emit']('userVoicePrefix:remove',{'UserId':_0x22fa5d,'VoicePrefixId':_0x1b555e['id']});});});});});});})['then'](respondWithStatusCode(_0x473a54,null))['catch'](handleError(_0x473a54,null));}; \ No newline at end of file +var _0x47c5=['Set','PREFIX-CALLERIDALL=','NoOp','No\x20callerid\x20available','goto','context','${EXTEN:','charAt','body','system-','sequelize','findById','addAgents','ids','omit','emit','userVoicePrefix:save','removeAgents','userVoicePrefix:remove','getAgents','findOne','User','getTeams','Team','addTeams','online','voicePause','flatMap','Agents','each','upsert','UserVoicePrefix','findOrCreate','forEach','removeTeams','select','tq.TeamId','from','team_has_voice_prefixes','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','compact','value','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./voicePrefix.socket','register','sendStatus','status','end','json','offset','limit','undefined','set','reject','save','update','then','UserProfileResource','error','stack','name','map','VoicePrefix','rawAttributes','fieldName','type','key','model','filters','intersection','query','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','findAll','catch','show','params','keys','include','find','destroy','describe','transaction','create','get','VoiceExtension','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','VoicePrefixes','userProfileId','autoAssociation','from-sip','exten','app','system','description','Voice\x20Prefix\x20Extension','bulkCreate','Extensions\x20creation\x20failed','prefix','push'];(function(_0x2c37a9,_0x5ec2c4){var _0xf73ce1=function(_0x2e3b92){while(--_0x2e3b92){_0x2c37a9['push'](_0x2c37a9['shift']());}};_0xf73ce1(++_0x5ec2c4);}(_0x47c5,0x165));var _0x547c=function(_0x218adb,_0x144ffc){_0x218adb=_0x218adb-0x0;var _0x15e8eb=_0x47c5[_0x218adb];return _0x15e8eb;};'use strict';var emlformat=require(_0x547c('0x0'));var rimraf=require(_0x547c('0x1'));var zipdir=require(_0x547c('0x2'));var jsonpatch=require(_0x547c('0x3'));var rp=require(_0x547c('0x4'));var moment=require(_0x547c('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x547c('0x6'));var util=require(_0x547c('0x7'));var path=require('path');var sox=require(_0x547c('0x8'));var csv=require(_0x547c('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x547c('0xa'));var _=require(_0x547c('0xb'));var squel=require(_0x547c('0xc'));var crypto=require(_0x547c('0xd'));var jsforce=require(_0x547c('0xe'));var deskjs=require(_0x547c('0xf'));var toCsv=require(_0x547c('0x9'));var querystring=require(_0x547c('0x10'));var Papa=require(_0x547c('0x11'));var Redis=require(_0x547c('0x12'));var authService=require(_0x547c('0x13'));var qs=require(_0x547c('0x14'));var as=require(_0x547c('0x15'));var hardwareService=require(_0x547c('0x16'));var logger=require(_0x547c('0x17'))(_0x547c('0x18'));var utils=require(_0x547c('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x547c('0x1a'));var db=require(_0x547c('0x1b'))['db'];config['redis']=_[_0x547c('0x1c')](config[_0x547c('0x1d')],{'host':_0x547c('0x1e'),'port':0x18eb});var socket=require(_0x547c('0x1f'))(new Redis(config[_0x547c('0x1d')]));require(_0x547c('0x20'))[_0x547c('0x21')](socket);function respondWithStatusCode(_0xa3c7b0,_0x255aa6){_0x255aa6=_0x255aa6||0xcc;return function(_0x161991){if(_0x161991){return _0xa3c7b0[_0x547c('0x22')](_0x255aa6);}return _0xa3c7b0[_0x547c('0x23')](_0x255aa6)[_0x547c('0x24')]();};}function respondWithResult(_0x23644b,_0x2d5331){_0x2d5331=_0x2d5331||0xc8;return function(_0xf32cdd){if(_0xf32cdd){return _0x23644b[_0x547c('0x23')](_0x2d5331)[_0x547c('0x25')](_0xf32cdd);}};}function respondWithFilteredResult(_0x49acca,_0x4a6c57){return function(_0x23fa9e){if(_0x23fa9e){var _0x199e4f=typeof _0x4a6c57[_0x547c('0x26')]==='undefined'&&typeof _0x4a6c57[_0x547c('0x27')]===_0x547c('0x28');var _0x1ddbd3=_0x23fa9e['count'];var _0x4511d3=_0x199e4f?0x0:_0x4a6c57[_0x547c('0x26')];var _0x496c38=_0x199e4f?_0x23fa9e['count']:_0x4a6c57[_0x547c('0x26')]+_0x4a6c57[_0x547c('0x27')];var _0x4f20c1;if(_0x496c38>=_0x1ddbd3){_0x496c38=_0x1ddbd3;_0x4f20c1=0xc8;}else{_0x4f20c1=0xce;}_0x49acca[_0x547c('0x23')](_0x4f20c1);return _0x49acca[_0x547c('0x29')]('Content-Range',_0x4511d3+'-'+_0x496c38+'/'+_0x1ddbd3)[_0x547c('0x25')](_0x23fa9e);}return null;};}function patchUpdates(_0x17fd97){return function(_0x436e67){try{jsonpatch['apply'](_0x436e67,_0x17fd97,!![]);}catch(_0x3a55a0){return BPromise[_0x547c('0x2a')](_0x3a55a0);}return _0x436e67[_0x547c('0x2b')]();};}function saveUpdates(_0x26823c,_0x1f3581){return function(_0x2663bc){if(_0x2663bc){return _0x2663bc[_0x547c('0x2c')](_0x26823c)[_0x547c('0x2d')](function(_0x507895){return _0x507895;});}return null;};}function removeEntity(_0x39c5f9,_0x4c66b9){return function(_0x5b05f2){if(_0x5b05f2){return _0x5b05f2['destroy']()['then'](function(){var _0x2c725d=_0x5b05f2['get']({'plain':!![]});var _0x93985c='VoicePrefixes';return db[_0x547c('0x2e')]['destroy']({'where':{'type':_0x93985c,'resourceId':_0x2c725d['id']}})[_0x547c('0x2d')](function(){return _0x5b05f2;});})[_0x547c('0x2d')](function(){_0x39c5f9[_0x547c('0x23')](0xcc)[_0x547c('0x24')]();});}};}function handleEntityNotFound(_0x198afb,_0x569924){return function(_0x575c74){if(!_0x575c74){_0x198afb[_0x547c('0x22')](0x194);}return _0x575c74;};}function handleError(_0x54de6f,_0x303b57){_0x303b57=_0x303b57||0x1f4;return function(_0xed2d39){logger[_0x547c('0x2f')](_0xed2d39[_0x547c('0x30')]);if(_0xed2d39[_0x547c('0x31')]){delete _0xed2d39[_0x547c('0x31')];}_0x54de6f[_0x547c('0x23')](_0x303b57)['send'](_0xed2d39);};}exports['index']=function(_0x41445b,_0x422609){var _0x1e4313={},_0x26850a={},_0x1b8c17={'count':0x0,'rows':[]};var _0x18d7c1=_[_0x547c('0x32')](db[_0x547c('0x33')][_0x547c('0x34')],function(_0x31026e){return{'name':_0x31026e[_0x547c('0x35')],'type':_0x31026e[_0x547c('0x36')][_0x547c('0x37')]};});_0x26850a[_0x547c('0x38')]=_['map'](_0x18d7c1,_0x547c('0x31'));_0x26850a['query']=_['keys'](_0x41445b['query']);_0x26850a[_0x547c('0x39')]=_[_0x547c('0x3a')](_0x26850a[_0x547c('0x38')],_0x26850a[_0x547c('0x3b')]);_0x1e4313[_0x547c('0x3c')]=_[_0x547c('0x3a')](_0x26850a['model'],qs['fields'](_0x41445b['query'][_0x547c('0x3d')]));_0x1e4313[_0x547c('0x3c')]=_0x1e4313[_0x547c('0x3c')][_0x547c('0x3e')]?_0x1e4313[_0x547c('0x3c')]:_0x26850a[_0x547c('0x38')];if(!_0x41445b['query'][_0x547c('0x3f')]('nolimit')){_0x1e4313[_0x547c('0x27')]=qs[_0x547c('0x27')](_0x41445b['query'][_0x547c('0x27')]);_0x1e4313['offset']=qs['offset'](_0x41445b[_0x547c('0x3b')][_0x547c('0x26')]);}_0x1e4313[_0x547c('0x40')]=qs[_0x547c('0x41')](_0x41445b['query']['sort']);_0x1e4313[_0x547c('0x42')]=qs[_0x547c('0x39')](_[_0x547c('0x43')](_0x41445b['query'],_0x26850a[_0x547c('0x39')]),_0x18d7c1);if(_0x41445b[_0x547c('0x3b')][_0x547c('0x44')]){_0x1e4313['where']=_[_0x547c('0x45')](_0x1e4313[_0x547c('0x42')],{'$or':_[_0x547c('0x32')](_0x18d7c1,function(_0x59ae8a){if(_0x59ae8a[_0x547c('0x36')]!==_0x547c('0x46')){var _0x4906ae={};_0x4906ae[_0x59ae8a[_0x547c('0x31')]]={'$like':'%'+_0x41445b[_0x547c('0x3b')][_0x547c('0x44')]+'%'};return _0x4906ae;}})});}_0x1e4313=_['merge']({},_0x1e4313,_0x41445b[_0x547c('0x47')]);var _0x4f2859={'where':_0x1e4313[_0x547c('0x42')]};return db['VoicePrefix'][_0x547c('0x48')](_0x4f2859)[_0x547c('0x2d')](function(_0x3d37d7){_0x1b8c17[_0x547c('0x48')]=_0x3d37d7;if(_0x41445b[_0x547c('0x3b')][_0x547c('0x49')]){_0x1e4313['include']=[{'all':!![]}];}return db['VoicePrefix'][_0x547c('0x4a')](_0x1e4313);})[_0x547c('0x2d')](function(_0x372083){_0x1b8c17['rows']=_0x372083;return _0x1b8c17;})[_0x547c('0x2d')](respondWithFilteredResult(_0x422609,_0x1e4313))[_0x547c('0x4b')](handleError(_0x422609,null));};exports[_0x547c('0x4c')]=function(_0xce7876,_0x1e4ab7){var _0x41ca7f={'raw':![],'where':{'id':_0xce7876[_0x547c('0x4d')]['id']}},_0x4adb6f={};_0x4adb6f[_0x547c('0x38')]=_[_0x547c('0x4e')](db['VoicePrefix'][_0x547c('0x34')]);_0x4adb6f[_0x547c('0x3b')]=_[_0x547c('0x4e')](_0xce7876[_0x547c('0x3b')]);_0x4adb6f['filters']=_[_0x547c('0x3a')](_0x4adb6f['model'],_0x4adb6f[_0x547c('0x3b')]);_0x41ca7f['attributes']=_[_0x547c('0x3a')](_0x4adb6f[_0x547c('0x38')],qs['fields'](_0xce7876[_0x547c('0x3b')][_0x547c('0x3d')]));_0x41ca7f[_0x547c('0x3c')]=_0x41ca7f[_0x547c('0x3c')]['length']?_0x41ca7f[_0x547c('0x3c')]:_0x4adb6f['model'];if(_0xce7876['query'][_0x547c('0x49')]){_0x41ca7f[_0x547c('0x4f')]=[{'all':!![]}];}_0x41ca7f=_[_0x547c('0x45')]({},_0x41ca7f,_0xce7876[_0x547c('0x47')]);return db[_0x547c('0x33')][_0x547c('0x50')](_0x41ca7f)[_0x547c('0x2d')](handleEntityNotFound(_0x1e4ab7,null))[_0x547c('0x2d')](respondWithResult(_0x1e4ab7,null))[_0x547c('0x4b')](handleError(_0x1e4ab7,null));};exports[_0x547c('0x51')]=function(_0x25b267,_0x38b2bc){return db['VoicePrefix']['find']({'where':{'id':_0x25b267[_0x547c('0x4d')]['id']}})[_0x547c('0x2d')](handleEntityNotFound(_0x38b2bc,null))['then'](removeEntity(_0x38b2bc,null))[_0x547c('0x4b')](handleError(_0x38b2bc,null));};exports[_0x547c('0x52')]=function(_0x3ab131,_0x4abae7){return db[_0x547c('0x33')][_0x547c('0x52')]()['then'](respondWithResult(_0x4abae7,null))[_0x547c('0x4b')](handleError(_0x4abae7,null));};exports['create']=function(_0x2e5c9f,_0x1c40e2){var _0x1bdaf0;return db['sequelize'][_0x547c('0x53')](function(_0x5abce0){return db[_0x547c('0x33')][_0x547c('0x54')](_0x2e5c9f['body'],{'transaction':_0x5abce0})[_0x547c('0x2d')](function(_0x1d0f04){_0x1bdaf0=_0x1d0f04[_0x547c('0x55')]({'plain':!![]});return db[_0x547c('0x56')][_0x547c('0x50')]({'where':{'id':_0x1bdaf0[_0x547c('0x57')]},'raw':!![]})[_0x547c('0x2d')](function(_0x4a42d1){return createVoicePrefixExtensions(_0x1bdaf0,_0x4a42d1,_0x5abce0);});});})[_0x547c('0x2d')](function(){var _0x55dee9=_0x2e5c9f[_0x547c('0x58')][_0x547c('0x55')]({'plain':!![]});if(!_0x55dee9)throw new Error(_0x547c('0x59'));if(_0x55dee9[_0x547c('0x5a')]===_0x547c('0x58')){var _0x506ef6=_0x1bdaf0;return db[_0x547c('0x5b')]['find']({'where':{'name':_0x547c('0x5c'),'userProfileId':_0x55dee9[_0x547c('0x5d')]},'raw':!![]})[_0x547c('0x2d')](function(_0x2b14e0){if(_0x2b14e0&&_0x2b14e0[_0x547c('0x5e')]===0x0){return db['UserProfileResource'][_0x547c('0x54')]({'name':_0x506ef6[_0x547c('0x31')],'resourceId':_0x506ef6['id'],'type':_0x2b14e0['name'],'sectionId':_0x2b14e0['id']},{})[_0x547c('0x2d')](function(){return _0x1bdaf0;});}else{return _0x1bdaf0;}})[_0x547c('0x4b')](function(_0x22e016){logger[_0x547c('0x2f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x22e016);throw _0x22e016;});}return _0x1bdaf0;})['then'](respondWithResult(_0x1c40e2,null))['catch'](handleError(_0x1c40e2,null));};function Extension(_0x188363,_0x455467,_0x5e0e21,_0x36fd4c){this['context']=_0x547c('0x5f');this[_0x547c('0x60')]=_0x188363;this[_0x547c('0x61')]=_0x5e0e21;this[_0x547c('0x36')]=_0x547c('0x62');this[_0x547c('0x63')]=_0x547c('0x64');this['priority']=_0x455467;this['appdata']=_0x36fd4c;}function createVoicePrefixExtensions(_0x43df25,_0x235fe8,_0x3105cb){return new BPromise(function(_0x64bf1e,_0xd3b584){var _0x50582e=new Extension(formatPrefixName(_0x43df25['prefix']),0x1,'NoOp','Voice\x20Prefix');_0x50582e['VoicePrefixId']=_0x43df25['id'];return db[_0x547c('0x56')][_0x547c('0x54')](_0x50582e,{'transaction':_0x3105cb})[_0x547c('0x2d')](function(_0x55197e){var _0x4540a5=_0x55197e[_0x547c('0x55')]({'plain':!![]});var _0x1d9666=_[_0x547c('0x32')](addVoicePrefixExtensions(_0x43df25,_0x235fe8),function(_0x4d83e5){_0x4d83e5['VoiceExtensionId']=_0x4540a5['id'];_0x4d83e5['VoicePrefixId']=_0x43df25['id'];return _0x4d83e5;});return db[_0x547c('0x56')][_0x547c('0x65')](_0x1d9666,{'transaction':_0x3105cb})[_0x547c('0x2d')](function(_0x32b3fe){if(!_0x32b3fe){return _0xd3b584(_0x547c('0x66'));}else{return _0x64bf1e(_0x32b3fe);}})['catch'](function(_0x4e0da1){return _0xd3b584(_0x4e0da1);});});;});};function addVoicePrefixExtensions(_0x1e2826,_0x1f589b){var _0x1ac2ea=[];var _0x70451=formatPrefixName(_0x1e2826[_0x547c('0x67')]);_0x1ac2ea['push'](new Extension(_0x70451,0x2,'Set','CDR(prefix)='+_0x1e2826[_0x547c('0x31')]));if(_0x1e2826['callerIdAll']){_0x1ac2ea[_0x547c('0x68')](new Extension(_0x70451,0x3,_0x547c('0x69'),_0x547c('0x6a')+_0x1e2826['callerIdAll']));}else{_0x1ac2ea['push'](new Extension(_0x70451,0x3,_0x547c('0x6b'),_0x547c('0x6c')));}_0x1ac2ea[_0x547c('0x68')](new Extension(_0x70451,0x4,_0x547c('0x6d'),_0x1f589b[_0x547c('0x6e')]+','+_0x547c('0x6f')+(0x8+_0x1e2826[_0x547c('0x31')]['length'])+'}'+','+0x1));return _0x1ac2ea;}function formatPrefixName(_0x310243){var _0x233b3b='_';for(var _0x3277ba=0x0;_0x3277ba<_0x310243[_0x547c('0x3e')];_0x3277ba++){if(_0x310243[_0x547c('0x70')](_0x3277ba)=='-'){_0x233b3b+=_0x310243[_0x547c('0x70')](_0x3277ba);}else{_0x233b3b+='['+_0x310243[_0x547c('0x70')](_0x3277ba)+']';}}_0x233b3b+='.';return _0x233b3b;}exports[_0x547c('0x2c')]=function(_0x49dc3c,_0x1fa11a,_0x284fb7){var _0x1dedca=_0x49dc3c[_0x547c('0x71')];_0x1dedca['prefix']=_0x547c('0x72')+_0x1dedca[_0x547c('0x31')]+'-';return db[_0x547c('0x73')]['transaction'](function(_0x52cccd){return db['VoicePrefix'][_0x547c('0x2c')](_0x1dedca,{'where':{'id':_0x1dedca['id']},'transaction':_0x52cccd})[_0x547c('0x2d')](function(){return db[_0x547c('0x56')]['destroy']({'where':{'VoicePrefixId':_0x1dedca['id']},'transaction':_0x52cccd})[_0x547c('0x2d')](function(){return db[_0x547c('0x56')][_0x547c('0x50')]({'where':{'id':_0x1dedca[_0x547c('0x57')]},'raw':!![]})['then'](function(_0x482afb){return createVoicePrefixExtensions(_0x1dedca,_0x482afb,_0x52cccd);});});});})[_0x547c('0x2d')](function(){return db['VoicePrefix'][_0x547c('0x74')](_0x1dedca['id']);})[_0x547c('0x2d')](respondWithResult(_0x1fa11a,null))['catch'](handleError(_0x1fa11a,null));};exports[_0x547c('0x75')]=function(_0x4edded,_0x1566d6,_0x240b54){return db['VoicePrefix'][_0x547c('0x50')]({'where':{'id':_0x4edded[_0x547c('0x4d')]['id']}})[_0x547c('0x2d')](handleEntityNotFound(_0x1566d6,null))[_0x547c('0x2d')](function(_0x4c7e53){if(_0x4c7e53){return _0x4c7e53['addAgents'](_0x4edded[_0x547c('0x71')][_0x547c('0x76')],_[_0x547c('0x77')](_0x4edded[_0x547c('0x71')],['ids','id'])||{})['spread'](function(_0x1a68ec){for(var _0x1f2886=0x0;_0x1f2886<_0x4edded[_0x547c('0x71')][_0x547c('0x76')][_0x547c('0x3e')];_0x1f2886+=0x1){socket[_0x547c('0x78')](_0x547c('0x79'),{'UserId':Number(_0x4edded[_0x547c('0x71')][_0x547c('0x76')][_0x1f2886]),'VoicePrefixId':Number(_0x4edded[_0x547c('0x4d')]['id'])});}return _0x1a68ec;});}})[_0x547c('0x2d')](respondWithResult(_0x1566d6,null))[_0x547c('0x4b')](handleError(_0x1566d6,null));};exports[_0x547c('0x7a')]=function(_0x4e038b,_0x5acb5f,_0x575357){return db[_0x547c('0x33')]['find']({'where':{'id':_0x4e038b['params']['id']}})[_0x547c('0x2d')](handleEntityNotFound(_0x5acb5f,null))['then'](function(_0x5723f1){if(_0x5723f1){return _0x5723f1[_0x547c('0x7a')](_0x4e038b[_0x547c('0x3b')][_0x547c('0x76')])[_0x547c('0x2d')](function(){if(_['isArray'](_0x4e038b[_0x547c('0x3b')][_0x547c('0x76')])){for(var _0x480c8a=0x0;_0x480c8a<_0x4e038b['query'][_0x547c('0x76')][_0x547c('0x3e')];_0x480c8a+=0x1){socket[_0x547c('0x78')](_0x547c('0x7b'),{'UserId':Number(_0x4e038b[_0x547c('0x3b')][_0x547c('0x76')][_0x480c8a]),'VoicePrefixId':Number(_0x4e038b[_0x547c('0x4d')]['id'])});}}else{socket[_0x547c('0x78')]('userVoicePrefix:remove',{'UserId':Number(_0x4e038b[_0x547c('0x3b')][_0x547c('0x76')]),'VoicePrefixId':Number(_0x4e038b[_0x547c('0x4d')]['id'])});}});}})['then'](respondWithStatusCode(_0x5acb5f,null))[_0x547c('0x4b')](handleError(_0x5acb5f,null));};exports[_0x547c('0x7c')]=function(_0x2cb2ff,_0x1fa904,_0x6db976){var _0x10c1a7={};var _0xcfcefe={};var _0x1ac5a0;var _0x3b245b;return db[_0x547c('0x33')][_0x547c('0x7d')]({'where':{'id':_0x2cb2ff[_0x547c('0x4d')]['id']}})[_0x547c('0x2d')](handleEntityNotFound(_0x1fa904,null))[_0x547c('0x2d')](function(_0x5146a6){if(_0x5146a6){_0x1ac5a0=_0x5146a6;_0xcfcefe[_0x547c('0x38')]=_[_0x547c('0x4e')](db[_0x547c('0x7e')]['rawAttributes']);_0xcfcefe[_0x547c('0x3b')]=_[_0x547c('0x4e')](_0x2cb2ff[_0x547c('0x3b')]);_0xcfcefe[_0x547c('0x39')]=_[_0x547c('0x3a')](_0xcfcefe[_0x547c('0x38')],_0xcfcefe[_0x547c('0x3b')]);_0x10c1a7[_0x547c('0x3c')]=_[_0x547c('0x3a')](_0xcfcefe[_0x547c('0x38')],qs[_0x547c('0x3d')](_0x2cb2ff[_0x547c('0x3b')][_0x547c('0x3d')]));_0x10c1a7['attributes']=_0x10c1a7['attributes']['length']?_0x10c1a7['attributes']:_0xcfcefe['model'];_0x10c1a7['order']=qs[_0x547c('0x41')](_0x2cb2ff[_0x547c('0x3b')][_0x547c('0x41')]);_0x10c1a7[_0x547c('0x42')]=qs['filters'](_[_0x547c('0x43')](_0x2cb2ff[_0x547c('0x3b')],_0xcfcefe[_0x547c('0x39')]));if(_0x2cb2ff['query'][_0x547c('0x44')]){_0x10c1a7[_0x547c('0x42')]=_[_0x547c('0x45')](_0x10c1a7['where'],{'$or':_['map'](_0x10c1a7['attributes'],function(_0x1a5445){var _0x51c1d8={};_0x51c1d8[_0x1a5445]={'$like':'%'+_0x2cb2ff[_0x547c('0x3b')][_0x547c('0x44')]+'%'};return _0x51c1d8;})});}_0x10c1a7=_['merge']({},_0x10c1a7,_0x2cb2ff[_0x547c('0x47')]);return _0x1ac5a0[_0x547c('0x7c')](_0x10c1a7);}})[_0x547c('0x2d')](function(_0x3f54cf){if(_0x3f54cf){_0x3b245b=_0x3f54cf[_0x547c('0x3e')];if(!_0x2cb2ff['query'][_0x547c('0x3f')]('nolimit')){_0x10c1a7[_0x547c('0x27')]=qs[_0x547c('0x27')](_0x2cb2ff[_0x547c('0x3b')][_0x547c('0x27')]);_0x10c1a7['offset']=qs[_0x547c('0x26')](_0x2cb2ff['query'][_0x547c('0x26')]);}return _0x1ac5a0[_0x547c('0x7c')](_0x10c1a7);}})['then'](function(_0x348ef8){if(_0x348ef8){return _0x348ef8?{'count':_0x3b245b,'rows':_0x348ef8}:null;}})['then'](respondWithResult(_0x1fa904,null))[_0x547c('0x4b')](handleError(_0x1fa904,null));};exports[_0x547c('0x7f')]=function(_0x17f2cf,_0x1753b2,_0x55411b){var _0xe7f35={};var _0x311cb8={};var _0xea441b;var _0x4732f4;return db[_0x547c('0x33')]['findOne']({'where':{'id':_0x17f2cf[_0x547c('0x4d')]['id']}})[_0x547c('0x2d')](handleEntityNotFound(_0x1753b2,null))[_0x547c('0x2d')](function(_0x5337d5){if(_0x5337d5){_0xea441b=_0x5337d5;_0x311cb8[_0x547c('0x38')]=_[_0x547c('0x4e')](db[_0x547c('0x80')][_0x547c('0x34')]);_0x311cb8['query']=_[_0x547c('0x4e')](_0x17f2cf['query']);_0x311cb8[_0x547c('0x39')]=_['intersection'](_0x311cb8[_0x547c('0x38')],_0x311cb8[_0x547c('0x3b')]);_0xe7f35[_0x547c('0x3c')]=_[_0x547c('0x3a')](_0x311cb8[_0x547c('0x38')],qs[_0x547c('0x3d')](_0x17f2cf['query']['fields']));_0xe7f35['attributes']=_0xe7f35[_0x547c('0x3c')][_0x547c('0x3e')]?_0xe7f35[_0x547c('0x3c')]:_0x311cb8[_0x547c('0x38')];_0xe7f35['order']=qs[_0x547c('0x41')](_0x17f2cf['query'][_0x547c('0x41')]);_0xe7f35[_0x547c('0x42')]=qs[_0x547c('0x39')](_[_0x547c('0x43')](_0x17f2cf[_0x547c('0x3b')],_0x311cb8[_0x547c('0x39')]));if(_0x17f2cf['query'][_0x547c('0x44')]){_0xe7f35['where']=_[_0x547c('0x45')](_0xe7f35[_0x547c('0x42')],{'$or':_['map'](_0xe7f35[_0x547c('0x3c')],function(_0x141f89){var _0x1dbacb={};_0x1dbacb[_0x141f89]={'$like':'%'+_0x17f2cf[_0x547c('0x3b')][_0x547c('0x44')]+'%'};return _0x1dbacb;})});}_0xe7f35=_[_0x547c('0x45')]({},_0xe7f35,_0x17f2cf[_0x547c('0x47')]);return _0xea441b['getTeams'](_0xe7f35);}})[_0x547c('0x2d')](function(_0x1e242f){if(_0x1e242f){_0x4732f4=_0x1e242f[_0x547c('0x3e')];if(!_0x17f2cf['query'][_0x547c('0x3f')]('nolimit')){_0xe7f35[_0x547c('0x27')]=qs['limit'](_0x17f2cf[_0x547c('0x3b')][_0x547c('0x27')]);_0xe7f35[_0x547c('0x26')]=qs[_0x547c('0x26')](_0x17f2cf['query'][_0x547c('0x26')]);}return _0xea441b[_0x547c('0x7f')](_0xe7f35);}})[_0x547c('0x2d')](function(_0x358ca1){if(_0x358ca1){return _0x358ca1?{'count':_0x4732f4,'rows':_0x358ca1}:null;}})['then'](respondWithResult(_0x1753b2,null))['catch'](handleError(_0x1753b2,null));};exports[_0x547c('0x81')]=function(_0xfcc93f,_0x5d1a46,_0xaa9401){var _0x503787=_0xfcc93f['body']['ids'];var _0x25bf01;return db[_0x547c('0x80')][_0x547c('0x4a')]({'where':{'id':_0x503787},'attributes':['id'],'include':[{'model':db[_0x547c('0x7e')],'as':'Agents','attributes':['id',_0x547c('0x31'),_0x547c('0x82'),_0x547c('0x83'),'interface'],'raw':!![]}]})[_0x547c('0x2d')](function(_0x47bd31){if(_0x47bd31){_0x25bf01=_0x47bd31;var _0x90de50=_[_0x547c('0x84')](_0x47bd31,function(_0xc648f4){var _0x509a61=_0xc648f4[_0x547c('0x55')]({'plain':!![]});return _0x509a61[_0x547c('0x85')];});return db['VoicePrefix'][_0x547c('0x50')]({'where':{'id':_0xfcc93f[_0x547c('0x4d')]['id']}})[_0x547c('0x2d')](function(_0x2fb055){return db[_0x547c('0x73')][_0x547c('0x53')](function(_0x203c1e){return _0x2fb055[_0x547c('0x81')](_0x503787,{'transaction':_0x203c1e})[_0x547c('0x2d')](function(){return BPromise[_0x547c('0x86')](_0x25bf01,function(_0x55a927){return db['TeamVoicePrefix'][_0x547c('0x87')]({'TeamId':_0x55a927['id'],'VoicePrefixId':_0xfcc93f['params']['id']},{'transaction':_0x203c1e});});})[_0x547c('0x2d')](function(){return BPromise['each'](_0x90de50,function(_0x66a70c){return db[_0x547c('0x88')][_0x547c('0x89')]({'where':{'UserId':_0x66a70c['id'],'VoicePrefixId':_0xfcc93f[_0x547c('0x4d')]['id']},'transaction':_0x203c1e});});})[_0x547c('0x2d')](function(){_0x90de50[_0x547c('0x8a')](function(_0x37b28d){socket['emit'](_0x547c('0x79'),{'UserId':_0x37b28d['id'],'VoicePrefixId':_0x2fb055['id']});});});});});}})[_0x547c('0x2d')](respondWithStatusCode(_0x5d1a46,null))[_0x547c('0x4b')](handleError(_0x5d1a46,null));};exports[_0x547c('0x8b')]=function(_0x2d56df,_0x3fa33c,_0x340e4){return db[_0x547c('0x80')][_0x547c('0x4a')]({'where':{'id':_0x2d56df[_0x547c('0x3b')][_0x547c('0x76')]},'attributes':['id'],'include':[{'model':db[_0x547c('0x7e')],'as':_0x547c('0x85'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x3fa33c,null))[_0x547c('0x2d')](function(_0x18bb7e){var _0x1d43c7=_[_0x547c('0x32')](_0x18bb7e,'id');var _0x23da9d=[];var _0x11e9fd=[];var _0x35b426=squel[_0x547c('0x8c')]();_0x35b426['field'](_0x547c('0x8d'))[_0x547c('0x8e')](_0x547c('0x8f'),'tq')['join']('user_has_teams','ut',_0x547c('0x90'))[_0x547c('0x42')](_0x547c('0x91'),_0x2d56df[_0x547c('0x4d')]['id']);for(var _0x443680=0x0;_0x443680<_0x18bb7e[_0x547c('0x3e')];_0x443680+=0x1){let _0x230b46=_0x18bb7e[_0x443680];for(var _0xb541a7=0x0;_0xb541a7<_0x230b46['Agents'][_0x547c('0x3e')];_0xb541a7+=0x1){let _0x3895c6=_0x230b46['Agents'][_0xb541a7];var _0x139ce3=_0x35b426[_0x547c('0x92')]();_0x139ce3[_0x547c('0x42')](_0x547c('0x93'),_0x3895c6['id']);_0x11e9fd['push'](db[_0x547c('0x73')][_0x547c('0x3b')](_0x139ce3[_0x547c('0x94')](),{'type':db[_0x547c('0x73')][_0x547c('0x95')][_0x547c('0x96')]})[_0x547c('0x2d')](function(_0x50d13b){if(_0x50d13b[_0x547c('0x3e')]===0x1){return _0x3895c6['id'];}else{var _0x1564b8=_[_0x547c('0x97')](_[_0x547c('0x32')](_0x50d13b,'TeamId'),function(_0x298277){return _['includes'](_0x1d43c7,_0x298277);});if(_0x1564b8){return _0x3895c6['id'];}}}));}}return BPromise['all'](_0x11e9fd)[_0x547c('0x2d')](function(_0xea58fd){_0x23da9d=_(_0x23da9d)['union'](_0xea58fd)[_0x547c('0x98')]()[_0x547c('0x99')]();return db[_0x547c('0x33')]['find']({'where':{'id':_0x2d56df['params']['id']}})[_0x547c('0x2d')](function(_0x54ff1f){return db[_0x547c('0x73')][_0x547c('0x53')](function(_0x421ebb){return _0x54ff1f[_0x547c('0x8b')](_0x2d56df['query'][_0x547c('0x76')],{'transaction':_0x421ebb})[_0x547c('0x2d')](function(){if(!_['isEmpty'](_0x23da9d)){return _0x54ff1f[_0x547c('0x7a')](_0x23da9d,{'transaction':_0x421ebb});}})[_0x547c('0x2d')](function(){_0x23da9d['forEach'](function(_0x1764f2){socket[_0x547c('0x78')](_0x547c('0x7b'),{'UserId':_0x1764f2,'VoicePrefixId':_0x54ff1f['id']});});});});});});})['then'](respondWithStatusCode(_0x3fa33c,null))[_0x547c('0x4b')](handleError(_0x3fa33c,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 5c6ff41..34310bd 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 _0x20ae=['emit','hasOwnProperty','exports','events','../../mysqldb','VoicePrefix','setMaxListeners','save','remove'];(function(_0x3bc304,_0x1dd725){var _0x29124e=function(_0x568862){while(--_0x568862){_0x3bc304['push'](_0x3bc304['shift']());}};_0x29124e(++_0x1dd725);}(_0x20ae,0x147));var _0xe20a=function(_0x2064e5,_0x4f6fa2){_0x2064e5=_0x2064e5-0x0;var _0x21a233=_0x20ae[_0x2064e5];return _0x21a233;};'use strict';var EventEmitter=require(_0xe20a('0x0'));var VoicePrefix=require(_0xe20a('0x1'))['db'][_0xe20a('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0xe20a('0x3')](0x0);var events={'afterCreate':_0xe20a('0x4'),'afterUpdate':'update','afterDestroy':_0xe20a('0x5')};function emitEvent(_0x5c895c){return function(_0x14c0d7,_0x31950d,_0x46529a){VoicePrefixEvents['emit'](_0x5c895c+':'+_0x14c0d7['id'],_0x14c0d7);VoicePrefixEvents[_0xe20a('0x6')](_0x5c895c,_0x14c0d7);_0x46529a(null);};}for(var e in events){if(events[_0xe20a('0x7')](e)){var event=events[e];VoicePrefix['hook'](e,emitEvent(event));}}module[_0xe20a('0x8')]=VoicePrefixEvents; \ No newline at end of file +var _0x0d0c=['exports','../../mysqldb','VoicePrefix','setMaxListeners','update','remove','emit','hasOwnProperty','hook'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x0d0c,0x91));var _0xc0d0=function(_0x7c675a,_0x3835a4){_0x7c675a=_0x7c675a-0x0;var _0xbaabd3=_0x0d0c[_0x7c675a];return _0xbaabd3;};'use strict';var EventEmitter=require('events');var VoicePrefix=require(_0xc0d0('0x0'))['db'][_0xc0d0('0x1')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0xc0d0('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xc0d0('0x3'),'afterDestroy':_0xc0d0('0x4')};function emitEvent(_0x544a1c){return function(_0x2a3cd3,_0xa277f3,_0x43872d){VoicePrefixEvents[_0xc0d0('0x5')](_0x544a1c+':'+_0x2a3cd3['id'],_0x2a3cd3);VoicePrefixEvents[_0xc0d0('0x5')](_0x544a1c,_0x2a3cd3);_0x43872d(null);};}for(var e in events){if(events[_0xc0d0('0x6')](e)){var event=events[e];VoicePrefix[_0xc0d0('0x7')](e,emitEvent(event));}}module[_0xc0d0('0x8')]=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index ac6cc2b..2ed4a03 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 _0xf0e7=['bluebird','request-promise','path','rimraf','../../config/environment','exports','define','voice_prefixes','../../config/logger','moment'];(function(_0x10e4de,_0x4dbd0e){var _0xc5ba2f=function(_0x5a2a99){while(--_0x5a2a99){_0x10e4de['push'](_0x10e4de['shift']());}};_0xc5ba2f(++_0x4dbd0e);}(_0xf0e7,0x10c));var _0x7f0e=function(_0x23b57c,_0xdc7f98){_0x23b57c=_0x23b57c-0x0;var _0x4c3b1d=_0xf0e7[_0x23b57c];return _0x4c3b1d;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x7f0e('0x0'))('api');var moment=require(_0x7f0e('0x1'));var BPromise=require(_0x7f0e('0x2'));var rp=require(_0x7f0e('0x3'));var fs=require('fs');var path=require(_0x7f0e('0x4'));var rimraf=require(_0x7f0e('0x5'));var config=require(_0x7f0e('0x6'));var attributes=require('./voicePrefix.attributes');module[_0x7f0e('0x7')]=function(_0x48bb31,_0x4779ad){return _0x48bb31[_0x7f0e('0x8')]('VoicePrefix',attributes,{'tableName':_0x7f0e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3a48=['util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./voicePrefix.attributes','exports','lodash'];(function(_0x5ab577,_0x4244e5){var _0x2ba417=function(_0x23b9bc){while(--_0x23b9bc){_0x5ab577['push'](_0x5ab577['shift']());}};_0x2ba417(++_0x4244e5);}(_0x3a48,0xa9));var _0x83a4=function(_0x263971,_0x1b2641){_0x263971=_0x263971-0x0;var _0x2dab23=_0x3a48[_0x263971];return _0x2dab23;};'use strict';var _=require(_0x83a4('0x0'));var util=require(_0x83a4('0x1'));var logger=require(_0x83a4('0x2'))(_0x83a4('0x3'));var moment=require('moment');var BPromise=require(_0x83a4('0x4'));var rp=require(_0x83a4('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x83a4('0x6'));var config=require(_0x83a4('0x7'));var attributes=require(_0x83a4('0x8'));module[_0x83a4('0x9')]=function(_0x5a28b2,_0x495e61){return _0x5a28b2['define']('VoicePrefix',attributes,{'tableName':'voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.rpc.js b/server/api/voicePrefix/voicePrefix.rpc.js index 4a3de58..77e24fe 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 _0x2d72=['stringify','error','code','message','info','request\x20sent','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','socket.io-emitter','./voicePrefix.socket','register','request','then','VoicePrefix,\x20%s,\x20%s','debug','VoicePrefix,\x20%s,\x20%s,\x20%s'];(function(_0x54bd92,_0x13e8ae){var _0x331f7=function(_0x472679){while(--_0x472679){_0x54bd92['push'](_0x54bd92['shift']());}};_0x331f7(++_0x13e8ae);}(_0x2d72,0xa8));var _0x22d7=function(_0xe30f7c,_0x359ffd){_0xe30f7c=_0xe30f7c-0x0;var _0x142b6a=_0x2d72[_0xe30f7c];return _0x142b6a;};'use strict';var _=require(_0x22d7('0x0'));var util=require(_0x22d7('0x1'));var moment=require(_0x22d7('0x2'));var BPromise=require(_0x22d7('0x3'));var rs=require(_0x22d7('0x4'));var fs=require('fs');var Redis=require(_0x22d7('0x5'));var db=require(_0x22d7('0x6'))['db'];var utils=require(_0x22d7('0x7'));var logger=require(_0x22d7('0x8'))(_0x22d7('0x9'));var config=require(_0x22d7('0xa'));var jayson=require(_0x22d7('0xb'));var client=jayson[_0x22d7('0xc')][_0x22d7('0xd')]({'port':0x232a});config['redis']=_[_0x22d7('0xe')](config[_0x22d7('0xf')],{'host':'localhost','port':0x18eb});var socket=require(_0x22d7('0x10'))(new Redis(config[_0x22d7('0xf')]));require(_0x22d7('0x11'))[_0x22d7('0x12')](socket);function respondWithRpcPromise(_0x49f7e1,_0x5f56eb,_0x1810b8){return new BPromise(function(_0x257c85,_0x233c0b){return client[_0x22d7('0x13')](_0x49f7e1,_0x1810b8)[_0x22d7('0x14')](function(_0x4db5dd){logger['info'](_0x22d7('0x15'),_0x5f56eb,'request\x20sent');logger[_0x22d7('0x16')](_0x22d7('0x17'),_0x5f56eb,'request\x20sent',JSON[_0x22d7('0x18')](_0x4db5dd));if(_0x4db5dd[_0x22d7('0x19')]){if(_0x4db5dd[_0x22d7('0x19')][_0x22d7('0x1a')]===0x1f4){logger[_0x22d7('0x19')](_0x22d7('0x15'),_0x5f56eb,_0x4db5dd[_0x22d7('0x19')][_0x22d7('0x1b')]);return _0x233c0b(_0x4db5dd['error'][_0x22d7('0x1b')]);}logger[_0x22d7('0x19')](_0x22d7('0x15'),_0x5f56eb,_0x4db5dd['error']['message']);return _0x257c85(_0x4db5dd['error'][_0x22d7('0x1b')]);}else{logger[_0x22d7('0x1c')](_0x22d7('0x15'),_0x5f56eb,_0x22d7('0x1d'));_0x257c85(_0x4db5dd[_0x22d7('0x1e')]['message']);}})[_0x22d7('0x1f')](function(_0x75affd){logger[_0x22d7('0x19')]('VoicePrefix,\x20%s,\x20%s',_0x5f56eb,_0x75affd);_0x233c0b(_0x75affd);});});} \ No newline at end of file +var _0xf1c6=['VoicePrefix,\x20%s,\x20%s','error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','request','info','request\x20sent','stringify','code'];(function(_0x3fa50f,_0x11c479){var _0x4e81c7=function(_0x296fc8){while(--_0x296fc8){_0x3fa50f['push'](_0x3fa50f['shift']());}};_0x4e81c7(++_0x11c479);}(_0xf1c6,0xf4));var _0x6f1c=function(_0x404dc6,_0x2f567d){_0x404dc6=_0x404dc6-0x0;var _0x4caa6d=_0xf1c6[_0x404dc6];return _0x4caa6d;};'use strict';var _=require(_0x6f1c('0x0'));var util=require(_0x6f1c('0x1'));var moment=require(_0x6f1c('0x2'));var BPromise=require(_0x6f1c('0x3'));var rs=require(_0x6f1c('0x4'));var fs=require('fs');var Redis=require(_0x6f1c('0x5'));var db=require(_0x6f1c('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x6f1c('0x7'))(_0x6f1c('0x8'));var config=require(_0x6f1c('0x9'));var jayson=require(_0x6f1c('0xa'));var client=jayson['client']['http']({'port':0x232a});config[_0x6f1c('0xb')]=_[_0x6f1c('0xc')](config[_0x6f1c('0xb')],{'host':_0x6f1c('0xd'),'port':0x18eb});var socket=require(_0x6f1c('0xe'))(new Redis(config[_0x6f1c('0xb')]));require('./voicePrefix.socket')['register'](socket);function respondWithRpcPromise(_0x424895,_0x33459a,_0xed1cca){return new BPromise(function(_0x1d6a01,_0x1421aa){return client[_0x6f1c('0xf')](_0x424895,_0xed1cca)['then'](function(_0x2c8881){logger[_0x6f1c('0x10')]('VoicePrefix,\x20%s,\x20%s',_0x33459a,_0x6f1c('0x11'));logger['debug']('VoicePrefix,\x20%s,\x20%s,\x20%s',_0x33459a,_0x6f1c('0x11'),JSON[_0x6f1c('0x12')](_0x2c8881));if(_0x2c8881['error']){if(_0x2c8881['error'][_0x6f1c('0x13')]===0x1f4){logger['error'](_0x6f1c('0x14'),_0x33459a,_0x2c8881[_0x6f1c('0x15')][_0x6f1c('0x16')]);return _0x1421aa(_0x2c8881[_0x6f1c('0x15')][_0x6f1c('0x16')]);}logger[_0x6f1c('0x15')](_0x6f1c('0x14'),_0x33459a,_0x2c8881['error'][_0x6f1c('0x16')]);return _0x1d6a01(_0x2c8881['error'][_0x6f1c('0x16')]);}else{logger['info'](_0x6f1c('0x14'),_0x33459a,_0x6f1c('0x11'));_0x1d6a01(_0x2c8881['result']['message']);}})[_0x6f1c('0x17')](function(_0x842773){logger[_0x6f1c('0x15')]('VoicePrefix,\x20%s,\x20%s',_0x33459a,_0x842773);_0x1421aa(_0x842773);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 613b025..8b94da1 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 _0x2e31=['./voicePrefix.events','save','remove','removeListener','voicePrefix:'];(function(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0x2e31,0x145));var _0x12e3=function(_0x50bde3,_0x22d043){_0x50bde3=_0x50bde3-0x0;var _0x2ec486=_0x2e31[_0x50bde3];return _0x2ec486;};'use strict';var VoicePrefixEvents=require(_0x12e3('0x0'));var events=[_0x12e3('0x1'),_0x12e3('0x2'),'update'];function createListener(_0x152c5f,_0x217ada){return function(_0x503380){_0x217ada['emit'](_0x152c5f,_0x503380);};}function removeListener(_0x146b6b,_0x3d2ac0){return function(){VoicePrefixEvents[_0x12e3('0x3')](_0x146b6b,_0x3d2ac0);};}exports['register']=function(_0x3173f9){for(var _0x16ed6b=0x0,_0x5aefcf=events['length'];_0x16ed6b<_0x5aefcf;_0x16ed6b++){var _0x37f287=events[_0x16ed6b];var _0x403cc5=createListener(_0x12e3('0x4')+_0x37f287,_0x3173f9);VoicePrefixEvents['on'](_0x37f287,_0x403cc5);}}; \ No newline at end of file +var _0x90db=['save','remove','update','removeListener','register','length','voicePrefix:'];(function(_0x2cd832,_0x6a0705){var _0x4f052e=function(_0x32f03e){while(--_0x32f03e){_0x2cd832['push'](_0x2cd832['shift']());}};_0x4f052e(++_0x6a0705);}(_0x90db,0x1c0));var _0xb90d=function(_0x42f009,_0x5e27b1){_0x42f009=_0x42f009-0x0;var _0x22a1e0=_0x90db[_0x42f009];return _0x22a1e0;};'use strict';var VoicePrefixEvents=require('./voicePrefix.events');var events=[_0xb90d('0x0'),_0xb90d('0x1'),_0xb90d('0x2')];function createListener(_0x5050f4,_0x4fc4c2){return function(_0x4faf3d){_0x4fc4c2['emit'](_0x5050f4,_0x4faf3d);};}function removeListener(_0x4aaef1,_0x17e9b9){return function(){VoicePrefixEvents[_0xb90d('0x3')](_0x4aaef1,_0x17e9b9);};}exports[_0xb90d('0x4')]=function(_0x380149){for(var _0x1e7a52=0x0,_0x2d8398=events[_0xb90d('0x5')];_0x1e7a52<_0x2d8398;_0x1e7a52++){var _0x126e17=events[_0x1e7a52];var _0x2ef5e6=createListener(_0xb90d('0x6')+_0x126e17,_0x380149);VoicePrefixEvents['on'](_0x126e17,_0x2ef5e6);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index 583768a..3b881e5 100644 --- a/server/api/voiceQueue/index.js +++ b/server/api/voiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','isAuthenticated','show','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperBlacks','/:id/teams','getTeams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','/:id/blacklists','getBlackLists','post','create','/:id/clone','addTeams','addAgents','addLists','addBlackLists','put','/:id','update','delete','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','path','connect-timeout'];(function(_0x152678,_0x11e0ac){var _0x311a9=function(_0x4f5291){while(--_0x4f5291){_0x152678['push'](_0x152678['shift']());}};_0x311a9(++_0x11e0ac);}(_0xb10b,0x12a));var _0xbb10=function(_0x1602ef,_0x447aba){_0x1602ef=_0x1602ef-0x0;var _0x5870ee=_0xb10b[_0x1602ef];return _0x5870ee;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0x9')](_0xbb10('0xf'),auth['isAuthenticated'](),controller['getHopperHistories']);router[_0xbb10('0x9')](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller['getHopperFinals']);router[_0xbb10('0x9')]('/:id/hopper_black',auth[_0xbb10('0xb')](),controller[_0xbb10('0x11')]);router[_0xbb10('0x9')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x13')]);router['get'](_0xbb10('0x14'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x15')]);router[_0xbb10('0x9')](_0xbb10('0x16'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x17')]);router[_0xbb10('0x9')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller['getLists']);router[_0xbb10('0x9')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1a')]);router[_0xbb10('0x1b')]('/',auth[_0xbb10('0xb')](),controller[_0xbb10('0x1c')]);router[_0xbb10('0x1b')](_0xbb10('0x1d'),auth[_0xbb10('0xb')](),controller['clone']);router[_0xbb10('0x1b')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1e')]);router[_0xbb10('0x1b')](_0xbb10('0x14'),auth['isAuthenticated'](),controller[_0xbb10('0x1f')]);router[_0xbb10('0x1b')]('/:id/lists',auth['isAuthenticated'](),controller[_0xbb10('0x20')]);router[_0xbb10('0x1b')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x21')]);router[_0xbb10('0x22')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x24')]);router[_0xbb10('0x25')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller['destroy']);router['delete']('/:id/teams',auth[_0xbb10('0xb')](),controller[_0xbb10('0x26')]);router[_0xbb10('0x25')]('/:id/users',auth[_0xbb10('0xb')](),controller[_0xbb10('0x27')]);router[_0xbb10('0x25')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x28')]);router[_0xbb10('0x25')]('/:id/blacklists',auth[_0xbb10('0xb')](),controller[_0xbb10('0x29')]);module[_0xbb10('0x2a')]=router; \ No newline at end of file +var _0xa9e0=['addAgents','/:id/blacklists','addBlackLists','update','delete','destroy','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','/:id','getHoppers','/:id/hopper_histories','isAuthenticated','getHopperHistories','/:id/hopper_black','getHopperBlacks','/:id/teams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','getLists','post','create','/:id/clone','clone','addTeams'];(function(_0x1be61f,_0x4b5624){var _0x4d80cf=function(_0x3837f9){while(--_0x3837f9){_0x1be61f['push'](_0x1be61f['shift']());}};_0x4d80cf(++_0x4b5624);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b828b,_0x344400){_0x1b828b=_0x1b828b-0x0;var _0x98da1a=_0xa9e0[_0x1b828b];return _0x98da1a;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/hoppers',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/hopper_finals',auth['isAuthenticated'](),controller['getHopperFinals']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getTeams']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x8')]('/:id/blacklists',auth[_0x0a9e('0xd')](),controller['getBlackLists']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/users',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller['addLists']);router[_0x0a9e('0x18')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x22')]);router['delete']('/:id/teams',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router[_0x0a9e('0x21')](_0x0a9e('0x12'),auth['isAuthenticated'](),controller[_0x0a9e('0x24')]);router['delete'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x25')]);router[_0x0a9e('0x21')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x26')]);module[_0x0a9e('0x27')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index c94ea4c..0e7ffac 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 _0xe67b=['ENUM','outbound','default','ringall','leastrecent','fewestcalls','rrmemory','linear','wrandom','rrordered','setDataValue','getDataValue','dialMethod','strategy','preview','booked','roundrobin','INTEGER','all','yes','once','TEXT','periodic_announce','join','split','joinempty','leavewhenempty','BOOLEAN','acw','wrapuptime','Active/Disactive\x20Campaign','progressive','power','predictive','Dial\x20Method.','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','07:00-22:00,*,*,*','onlyIfOpen','always','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','ASC','DESC','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)','#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)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDisposition','sequelize','exports','STRING','name'];(function(_0x5a19fc,_0x58f9f4){var _0x34b413=function(_0x344feb){while(--_0x344feb){_0x5a19fc['push'](_0x5a19fc['shift']());}};_0x34b413(++_0x58f9f4);}(_0xe67b,0x1e2));var _0xbe67=function(_0x5ce8b9,_0x5cded8){_0x5ce8b9=_0x5ce8b9-0x0;var _0xe34be0=_0xe67b[_0x5ce8b9];return _0xe34be0;};'use strict';var Sequelize=require(_0xbe67('0x0'));module[_0xbe67('0x1')]={'name':{'type':Sequelize[_0xbe67('0x2')],'allowNull':![],'unique':_0xbe67('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xbe67('0x4')]('inbound',_0xbe67('0x5')),'allowNull':![],'defaultValue':'inbound'},'musiconhold':{'type':Sequelize[_0xbe67('0x2')],'defaultValue':_0xbe67('0x6')},'announce':{'type':Sequelize[_0xbe67('0x2')],'defaultValue':''},'strategy':{'type':Sequelize['ENUM']('rr',_0xbe67('0x7'),_0xbe67('0x8'),_0xbe67('0x9'),'random',_0xbe67('0xa'),_0xbe67('0xb'),_0xbe67('0xc'),_0xbe67('0xd')),'allowNull':![],'defaultValue':_0xbe67('0x7'),'set':function(_0x2f4786){this[_0xbe67('0xe')]('strategy',_0x2f4786?_0x2f4786:_0xbe67('0xa'));},'get':function(){var _0x12dec1=this['getDataValue']('type');var _0x1ba7d2=this[_0xbe67('0xf')](_0xbe67('0x10'));var _0x1d642a=this[_0xbe67('0xf')](_0xbe67('0x11'));if(_0x12dec1===_0xbe67('0x5')){if(_0x1ba7d2===_0xbe67('0x12')){return null;}if(_0x1ba7d2===_0xbe67('0x13')&&![_0xbe67('0xa'),_0xbe67('0x14')]['includes'](_0x1d642a)){this[_0xbe67('0xe')](_0xbe67('0x11'),'rrmemory');}}return _0x1d642a;}},'servicelevel':{'type':Sequelize[_0xbe67('0x15')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0xbe67('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0xbe67('0x15')](0xb)},'timeout':{'type':Sequelize[_0xbe67('0x15')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0xbe67('0x15')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0xbe67('0x2')]},'weight':{'type':Sequelize[_0xbe67('0x15')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0xbe67('0x4')]('yes','no'),'defaultValue':'yes'},'autopause':{'type':Sequelize['ENUM']('yes','no',_0xbe67('0x16')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0xbe67('0x15')](0xb)},'autopausebusy':{'type':Sequelize[_0xbe67('0x4')](_0xbe67('0x17'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0xbe67('0x4')](_0xbe67('0x17'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize['ENUM'](_0xbe67('0x17'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize['ENUM'](_0xbe67('0x17'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0xbe67('0x4')]('yes','no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0xbe67('0x4')](_0xbe67('0x17'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0xbe67('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize['STRING'],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0xbe67('0x15')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0xbe67('0x15')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0xbe67('0x4')](_0xbe67('0x17'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0xbe67('0x4')]('yes','no'),'defaultValue':_0xbe67('0x17')},'announce_holdtime':{'type':Sequelize[_0xbe67('0x4')]('yes','no',_0xbe67('0x18')),'defaultValue':'no'},'announce_position':{'type':Sequelize['STRING'],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0xbe67('0x4')](_0xbe67('0x17'),'no')},'announce_position_limit':{'type':Sequelize['INTEGER'](0xb)},'announce_round_seconds':{'type':Sequelize['ENUM']('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize['STRING'],'defaultValue':''},'monitor_type':{'type':Sequelize[_0xbe67('0x2')]},'queue_youarenext':{'type':Sequelize[_0xbe67('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0xbe67('0x2')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0xbe67('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize['STRING'],'defaultValue':null},'queue_minute':{'type':Sequelize[_0xbe67('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0xbe67('0x2')],'defaultValue':null},'queue_seconds':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0xbe67('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize['STRING']},'queue_quantity1':{'type':Sequelize[_0xbe67('0x2')]},'queue_quantity2':{'type':Sequelize[_0xbe67('0x2')]},'queue_periodic_announce':{'type':Sequelize['STRING']},'queue_less_than':{'type':Sequelize[_0xbe67('0x2')]},'periodic_announce':{'type':Sequelize[_0xbe67('0x19')],'set':function(_0xfd2078){this[_0xbe67('0xe')](_0xbe67('0x1a'),_0xfd2078?_0xfd2078[_0xbe67('0x1b')](','):[]);},'get':function(){return this[_0xbe67('0xf')]('periodic_announce')?this[_0xbe67('0xf')](_0xbe67('0x1a'))[_0xbe67('0x1c')](','):[];}},'joinempty':{'type':Sequelize['STRING'],'defaultValue':_0xbe67('0x17'),'set':function(_0x163309){this[_0xbe67('0xe')](_0xbe67('0x1d'),_0x163309?_0x163309[_0xbe67('0x1b')](','):undefined);},'get':function(){return this['getDataValue']('joinempty')?this['getDataValue'](_0xbe67('0x1d'))[_0xbe67('0x1c')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0xbe67('0x2')],'defaultValue':'no','set':function(_0x109293){this['setDataValue'](_0xbe67('0x1e'),_0x109293?_0x109293[_0xbe67('0x1b')](','):undefined);},'get':function(){return this[_0xbe67('0xf')](_0xbe67('0x1e'))?this['getDataValue'](_0xbe67('0x1e'))[_0xbe67('0x1c')](','):undefined;}},'reportholdtime':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0xbe67('0x4')](_0xbe67('0x17'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0xbe67('0x15')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0xbe67('0x4')](_0xbe67('0x17'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0xbe67('0x2')]},'description':{'type':Sequelize[_0xbe67('0x2')]},'acw':{'type':Sequelize[_0xbe67('0x1f')],'defaultValue':0x0,'set':function(_0x8f5f14){this['setDataValue'](_0xbe67('0x20'),_0x8f5f14);if(_0x8f5f14){if(this[_0xbe67('0xf')]('wrapuptime')<0x2){this[_0xbe67('0xe')](_0xbe67('0x21'),0x2);}}}},'acwTimeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0xbe67('0x1f')],'defaultValue':0x0,'comment':_0xbe67('0x22')},'dialMethod':{'type':Sequelize[_0xbe67('0x4')]('preview',_0xbe67('0x23'),_0xbe67('0x24'),_0xbe67('0x25'),_0xbe67('0x13')),'defaultValue':'progressive','comment':_0xbe67('0x26')},'dialLimitChannel':{'type':Sequelize['INTEGER'](0x4)[_0xbe67('0x27')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xbe67('0x28')},'dialLimitQueue':{'type':Sequelize['INTEGER'](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.'},'dialPowerLevel':{'type':Sequelize[_0xbe67('0x29')](0x2)[_0xbe67('0x27')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0xbe67('0x2a')},'dialPredictiveOptimization':{'type':Sequelize[_0xbe67('0x4')](_0xbe67('0x2b'),_0xbe67('0x2c')),'defaultValue':_0xbe67('0x2c'),'comment':'Only\x20for\x20predictive\x20method.'},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0xbe67('0x29')](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0xbe67('0x2d')},'dialPredictiveInterval':{'type':Sequelize[_0xbe67('0x15')](0x3)[_0xbe67('0x27')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0xbe67('0x2e')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xbe67('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0xbe67('0x15')](0x3)[_0xbe67('0x27')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xbe67('0x2f')},'dialQueueOptions':{'type':Sequelize['STRING'],'defaultValue':'tTxX','comment':_0xbe67('0x30')},'dialQueueTimeout':{'type':Sequelize['INTEGER'](0x3)[_0xbe67('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xbe67('0x31')},'dialQueueProject':{'type':Sequelize[_0xbe67('0x2')],'comment':_0xbe67('0x32')},'dialCongestionMaxRetry':{'type':Sequelize[_0xbe67('0x15')](0x3)[_0xbe67('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xbe67('0x33')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xbe67('0x15')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xbe67('0x34')},'dialBusyMaxRetry':{'type':Sequelize[_0xbe67('0x15')](0x3)[_0xbe67('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0xbe67('0x15')](0x5)[_0xbe67('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xbe67('0x35')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xbe67('0x15')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0xbe67('0x36')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xbe67('0x15')](0x5)[_0xbe67('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xbe67('0x37')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xbe67('0x27')],'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['STRING'],'defaultValue':_0xbe67('0x38')},'dialPrefix':{'type':Sequelize[_0xbe67('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0xbe67('0x4')]('always','never',_0xbe67('0x39')),'defaultValue':_0xbe67('0x3a')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0xbe67('0x3b')},'dialAMDInitialSilence':{'type':Sequelize[_0xbe67('0x15')](0x9)[_0xbe67('0x27')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xbe67('0x3c')},'dialAMDGreeting':{'type':Sequelize[_0xbe67('0x15')](0x9)[_0xbe67('0x27')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xbe67('0x3d')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xbe67('0x15')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0xbe67('0x27')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xbe67('0x3e')},'dialAMDMinWordLength':{'type':Sequelize[_0xbe67('0x15')](0x9)[_0xbe67('0x27')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xbe67('0x3f')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0xbe67('0x27')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0xbe67('0x27')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xbe67('0x40')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xbe67('0x15')](0x5)[_0xbe67('0x27')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xbe67('0x41')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xbe67('0x15')](0x9)[_0xbe67('0x27')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialRecallMeTimeout':{'type':Sequelize[_0xbe67('0x15')](0x5)[_0xbe67('0x27')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0xbe67('0x42')},'dialRecallInQueue':{'type':Sequelize[_0xbe67('0x1f')],'defaultValue':0x0,'comment':_0xbe67('0x43')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM']('DESC',_0xbe67('0x44')),'defaultValue':_0xbe67('0x45')},'dialQueueProject2':{'type':Sequelize[_0xbe67('0x2')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialAgiAfterHangupClient':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0xbe67('0x1f')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xbe67('0x15')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xbe67('0x46')},'dialCutDigit':{'type':Sequelize[_0xbe67('0x15')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xbe67('0x47')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xbe67('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xbe67('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xbe67('0x48')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xbe67('0x49')},'dialDropRetryFrequency':{'type':Sequelize[_0xbe67('0x15')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xbe67('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize[_0xbe67('0x15')](0x3)[_0xbe67('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xbe67('0x4a')},'dialMachineRetryFrequency':{'type':Sequelize[_0xbe67('0x15')](0x5)[_0xbe67('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xbe67('0x4b')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xbe67('0x15')](0x3)[_0xbe67('0x27')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xbe67('0x4c')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xbe67('0x15')](0x5)[_0xbe67('0x27')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xbe67('0x4d')},'mandatoryDispositionPauseId':{'type':Sequelize[_0xbe67('0x15')],'allowNull':!![],'comment':_0xbe67('0x4e')},'mandatoryDisposition':{'type':Sequelize[_0xbe67('0x1f')],'defaultValue':![],'comment':_0xbe67('0x4f'),'set':function(_0x295ee3){if(!_0x295ee3)this[_0xbe67('0xe')]('mandatoryDispositionPauseId',null);this['setDataValue'](_0xbe67('0x50'),_0x295ee3);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0xbe67('0x15')](0x3)[_0xbe67('0x27')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0xbe67('0x15')](0x3)[_0xbe67('0x27')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0xbe67('0x15')](0x3)['UNSIGNED'],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0xbe67('0x1f')],'defaultValue':![]}}; \ No newline at end of file +var _0xa8c1=['Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','name','ENUM','inbound','outbound','default','leastrecent','fewestcalls','random','rrmemory','linear','wrandom','rrordered','ringall','setDataValue','strategy','getDataValue','type','dialMethod','booked','roundrobin','INTEGER','yes','all','once','TEXT','periodic_announce','join','joinempty','split','leavewhenempty','BOOLEAN','acw','wrapuptime','Active/Disactive\x20Campaign','progressive','power','predictive','Dial\x20Method.','Max\x209999\x20channels,\x200\x20means\x20unlimited.','UNSIGNED','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','agentBusyFactor','dropRate','Only\x20for\x20predictive\x20method.','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','tTxX','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','#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)','#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)'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xa8c1,0x1c0));var _0x1a8c=function(_0x1bfcfc,_0x140f5b){_0x1bfcfc=_0x1bfcfc-0x0;var _0x1041ff=_0xa8c1[_0x1bfcfc];return _0x1041ff;};'use strict';var Sequelize=require(_0x1a8c('0x0'));module[_0x1a8c('0x1')]={'name':{'type':Sequelize[_0x1a8c('0x2')],'allowNull':![],'unique':_0x1a8c('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x1a8c('0x4')](_0x1a8c('0x5'),_0x1a8c('0x6')),'allowNull':![],'defaultValue':_0x1a8c('0x5')},'musiconhold':{'type':Sequelize['STRING'],'defaultValue':_0x1a8c('0x7')},'announce':{'type':Sequelize[_0x1a8c('0x2')],'defaultValue':''},'strategy':{'type':Sequelize[_0x1a8c('0x4')]('rr','ringall',_0x1a8c('0x8'),_0x1a8c('0x9'),_0x1a8c('0xa'),_0x1a8c('0xb'),_0x1a8c('0xc'),_0x1a8c('0xd'),_0x1a8c('0xe')),'allowNull':![],'defaultValue':_0x1a8c('0xf'),'set':function(_0x224208){this[_0x1a8c('0x10')](_0x1a8c('0x11'),_0x224208?_0x224208:_0x1a8c('0xb'));},'get':function(){var _0x19ea36=this[_0x1a8c('0x12')](_0x1a8c('0x13'));var _0x16f462=this['getDataValue'](_0x1a8c('0x14'));var _0x56a0ff=this[_0x1a8c('0x12')](_0x1a8c('0x11'));if(_0x19ea36===_0x1a8c('0x6')){if(_0x16f462==='preview'){return null;}if(_0x16f462===_0x1a8c('0x15')&&![_0x1a8c('0xb'),_0x1a8c('0x16')]['includes'](_0x56a0ff)){this['setDataValue']('strategy',_0x1a8c('0xb'));}}return _0x56a0ff;}},'servicelevel':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x1a8c('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize['INTEGER'](0xb)},'timeout':{'type':Sequelize[_0x1a8c('0x17')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x1a8c('0x2')]},'weight':{'type':Sequelize[_0x1a8c('0x17')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x1a8c('0x17')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x1a8c('0x4')](_0x1a8c('0x18'),'no'),'defaultValue':_0x1a8c('0x18')},'autopause':{'type':Sequelize[_0x1a8c('0x4')](_0x1a8c('0x18'),'no',_0x1a8c('0x19')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x1a8c('0x17')](0xb)},'autopausebusy':{'type':Sequelize[_0x1a8c('0x4')](_0x1a8c('0x18'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x1a8c('0x4')](_0x1a8c('0x18'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x1a8c('0x4')](_0x1a8c('0x18'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x1a8c('0x4')](_0x1a8c('0x18'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x1a8c('0x4')](_0x1a8c('0x18'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x1a8c('0x4')](_0x1a8c('0x18'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x1a8c('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x1a8c('0x2')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x1a8c('0x17')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x1a8c('0x17')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x1a8c('0x17')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x1a8c('0x4')](_0x1a8c('0x18'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize['ENUM'](_0x1a8c('0x18'),'no'),'defaultValue':'yes'},'announce_holdtime':{'type':Sequelize[_0x1a8c('0x4')](_0x1a8c('0x18'),'no',_0x1a8c('0x1a')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x1a8c('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x1a8c('0x4')](_0x1a8c('0x18'),'no')},'announce_position_limit':{'type':Sequelize['INTEGER'](0xb)},'announce_round_seconds':{'type':Sequelize[_0x1a8c('0x4')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x1a8c('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize['STRING']},'queue_youarenext':{'type':Sequelize[_0x1a8c('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize['STRING'],'defaultValue':null},'queue_callswaiting':{'type':Sequelize['STRING'],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x1a8c('0x2')],'defaultValue':null},'queue_minute':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x1a8c('0x2')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x1a8c('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize['STRING'],'defaultValue':null},'queue_reporthold':{'type':Sequelize['STRING']},'queue_quantity1':{'type':Sequelize['STRING']},'queue_quantity2':{'type':Sequelize[_0x1a8c('0x2')]},'queue_periodic_announce':{'type':Sequelize[_0x1a8c('0x2')]},'queue_less_than':{'type':Sequelize[_0x1a8c('0x2')]},'periodic_announce':{'type':Sequelize[_0x1a8c('0x1b')],'set':function(_0x14ff5c){this[_0x1a8c('0x10')](_0x1a8c('0x1c'),_0x14ff5c?_0x14ff5c[_0x1a8c('0x1d')](','):[]);},'get':function(){return this[_0x1a8c('0x12')](_0x1a8c('0x1c'))?this[_0x1a8c('0x12')](_0x1a8c('0x1c'))['split'](','):[];}},'joinempty':{'type':Sequelize[_0x1a8c('0x2')],'defaultValue':_0x1a8c('0x18'),'set':function(_0xd5e3fa){this[_0x1a8c('0x10')](_0x1a8c('0x1e'),_0xd5e3fa?_0xd5e3fa['join'](','):undefined);},'get':function(){return this[_0x1a8c('0x12')](_0x1a8c('0x1e'))?this[_0x1a8c('0x12')](_0x1a8c('0x1e'))[_0x1a8c('0x1f')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x1a8c('0x2')],'defaultValue':'no','set':function(_0x5eec47){this[_0x1a8c('0x10')](_0x1a8c('0x20'),_0x5eec47?_0x5eec47['join'](','):undefined);},'get':function(){return this[_0x1a8c('0x12')](_0x1a8c('0x20'))?this[_0x1a8c('0x12')]('leavewhenempty')[_0x1a8c('0x1f')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x1a8c('0x4')]('yes','no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x1a8c('0x4')](_0x1a8c('0x18'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x1a8c('0x17')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize['ENUM'](_0x1a8c('0x18'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x1a8c('0x2')]},'description':{'type':Sequelize['STRING']},'acw':{'type':Sequelize[_0x1a8c('0x21')],'defaultValue':0x0,'set':function(_0x39c27c){this[_0x1a8c('0x10')](_0x1a8c('0x22'),_0x39c27c);if(_0x39c27c){if(this[_0x1a8c('0x12')](_0x1a8c('0x23'))<0x2){this[_0x1a8c('0x10')](_0x1a8c('0x23'),0x2);}}}},'acwTimeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x1a8c('0x21')],'defaultValue':0x0,'comment':_0x1a8c('0x24')},'dialMethod':{'type':Sequelize['ENUM']('preview',_0x1a8c('0x25'),_0x1a8c('0x26'),_0x1a8c('0x27'),_0x1a8c('0x15')),'defaultValue':_0x1a8c('0x25'),'comment':_0x1a8c('0x28')},'dialLimitChannel':{'type':Sequelize['INTEGER'](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x1a8c('0x29')},'dialLimitQueue':{'type':Sequelize[_0x1a8c('0x17')](0x4)[_0x1a8c('0x2a')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x1a8c('0x2b')},'dialPowerLevel':{'type':Sequelize[_0x1a8c('0x2c')](0x2)[_0x1a8c('0x2a')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':'Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).'},'dialPredictiveOptimization':{'type':Sequelize['ENUM'](_0x1a8c('0x2d'),'dropRate'),'defaultValue':_0x1a8c('0x2e'),'comment':_0x1a8c('0x2f')},'dialPredictiveOptimizationPercentage':{'type':Sequelize['FLOAT'](0x2)[_0x1a8c('0x2a')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x1a8c('0x30')},'dialPredictiveInterval':{'type':Sequelize[_0x1a8c('0x17')](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x1a8c('0x31')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x1a8c('0x2')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':'Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'},'dialQueueOptions':{'type':Sequelize['STRING'],'defaultValue':_0x1a8c('0x32'),'comment':'https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue'},'dialQueueTimeout':{'type':Sequelize[_0x1a8c('0x17')](0x3)[_0x1a8c('0x2a')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1a8c('0x33')},'dialQueueProject':{'type':Sequelize[_0x1a8c('0x2')],'comment':_0x1a8c('0x34')},'dialCongestionMaxRetry':{'type':Sequelize[_0x1a8c('0x17')](0x3)[_0x1a8c('0x2a')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1a8c('0x35')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x1a8c('0x17')](0x5)[_0x1a8c('0x2a')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1a8c('0x36')},'dialBusyMaxRetry':{'type':Sequelize[_0x1a8c('0x17')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1a8c('0x37')},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x1a8c('0x2a')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1a8c('0x38')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x1a8c('0x17')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x1a8c('0x17')](0x5)[_0x1a8c('0x2a')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1a8c('0x39')},'dialGlobalMaxRetry':{'type':Sequelize[_0x1a8c('0x17')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x1a8c('0x3a')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x1a8c('0x2')],'defaultValue':_0x1a8c('0x3b')},'dialPrefix':{'type':Sequelize[_0x1a8c('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0x1a8c('0x3c'),_0x1a8c('0x3d'),_0x1a8c('0x3e')),'defaultValue':_0x1a8c('0x3c')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x1a8c('0x3f')},'dialAMDInitialSilence':{'type':Sequelize[_0x1a8c('0x17')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x1a8c('0x40')},'dialAMDGreeting':{'type':Sequelize[_0x1a8c('0x17')](0x9)[_0x1a8c('0x2a')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x1a8c('0x41')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x1a8c('0x17')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x1a8c('0x42')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x1a8c('0x17')](0x9)[_0x1a8c('0x2a')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x1a8c('0x43')},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x1a8c('0x44')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x1a8c('0x17')](0x9)[_0x1a8c('0x2a')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x1a8c('0x45')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x1a8c('0x17')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x1a8c('0x46')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0x1a8c('0x2a')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x1a8c('0x47')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x1a8c('0x17')](0x9)[_0x1a8c('0x2a')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x1a8c('0x48')},'dialRecallMeTimeout':{'type':Sequelize[_0x1a8c('0x17')](0x5)['UNSIGNED'],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x1a8c('0x49')},'dialRecallInQueue':{'type':Sequelize[_0x1a8c('0x21')],'defaultValue':0x0,'comment':'Active/Disactive\x20Recall\x20In\x20Queue'},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0x1a8c('0x4a'),_0x1a8c('0x4b')),'defaultValue':_0x1a8c('0x4a')},'dialQueueProject2':{'type':Sequelize[_0x1a8c('0x2')],'comment':_0x1a8c('0x34')},'dialAgiAfterHangupClient':{'type':Sequelize[_0x1a8c('0x21')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x1a8c('0x21')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x1a8c('0x4c')},'dialCutDigit':{'type':Sequelize[_0x1a8c('0x17')](0x3)[_0x1a8c('0x2a')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x1a8c('0x4d')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x1a8c('0x2a')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1a8c('0x4e')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x1a8c('0x17')](0x5)[_0x1a8c('0x2a')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1a8c('0x4f')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x1a8c('0x2a')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize[_0x1a8c('0x17')](0x3)[_0x1a8c('0x2a')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1a8c('0x50')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x1a8c('0x17')](0x5)[_0x1a8c('0x2a')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1a8c('0x51')},'dialMachineMaxRetry':{'type':Sequelize[_0x1a8c('0x17')](0x3)[_0x1a8c('0x2a')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1a8c('0x52')},'dialMachineRetryFrequency':{'type':Sequelize[_0x1a8c('0x17')](0x5)[_0x1a8c('0x2a')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1a8c('0x53')},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x1a8c('0x2a')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1a8c('0x54')},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1a8c('0x55')},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x1a8c('0x21')],'defaultValue':![],'comment':_0x1a8c('0x56'),'set':function(_0x4f14ee){if(!_0x4f14ee)this[_0x1a8c('0x10')](_0x1a8c('0x57'),null);this[_0x1a8c('0x10')](_0x1a8c('0x58'),_0x4f14ee);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x1a8c('0x17')](0x3)[_0x1a8c('0x2a')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x1a8c('0x17')](0x3)[_0x1a8c('0x2a')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0x1a8c('0x21')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0x1a8c('0x17')](0x3)[_0x1a8c('0x2a')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0x1a8c('0x21')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index 04b8f3b..3a2500d 100644 --- a/server/api/voiceQueue/voiceQueue.controller.js +++ b/server/api/voiceQueue/voiceQueue.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6aa7=['ListId\x20=\x20?','CmListId','phone\x20IS\x20NOT\x20NULL','deletedAt\x20IS\x20NULL','cm_hopper_additional_phones','CmHopperId','OrderBy','ci.item','ci.OrderBy+1','cm_contact_has_items','h.ContactId=ci.CmContactId','h.scheduledat=?','ci.ItemClass=?','PHONE','getBlackLists','CmList','addBlackLists','cm_hopper_black','NOW()','removeBlackLists','moment','util','lodash','squel','ioredis','../../config/logger','api','../../config/environment','defaults','localhost','socket.io-emitter','redis','register','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','update','then','get','VoiceQueues','inbound','QueueCampaigns','outbound','ignore','map','value','includes','type','find','name','UserProfileResource','destroy','error','stack','index','VoiceQueue','rawAttributes','fieldName','getOptions','where','include','rows','show','model','keys','query','attributes','intersection','fields','length','includeAll','merge','options','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','omit','updatedAt','createdAt','getHoppers','findOne','filters','nolimit','order','sort','pick','VoiceQueueId','filter','CmHopper','findAll','getHopperHistories','CmHopperHistory','CmHopperFinal','hasOwnProperty','CmHopperBlack','getTeams','Team','addTeams','teams','User','online','voicePause','interface','flatMap','forEach','penalty','Agents','sequelize','transaction','each','TeamVoiceQueue','upsert','findOrCreate','UserVoiceQueueRt','isNil','format','SIP/%s','emit','userVoiceQueue:save','removeTeams','ids','field','tq.TeamId','from','team_has_voice_queues','join','user_has_teams','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','SELECT','every','TeamId','compact','isEmpty','removeAgents','addAgents','spread','all','isArray','userVoiceQueue:remove','getAgents','getMembers','getLists','addLists','YYYY-MM-DD\x20HH:mm:ss','dialCheckDuplicateType','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','toString','cm_contacts','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','onlyIfOpen','select'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0x6aa7,0x178));var _0x76aa=function(_0x194cf3,_0x269bd6){_0x194cf3=_0x194cf3-0x0;var _0x37b8da=_0x6aa7[_0x194cf3];return _0x37b8da;};'use strict';var moment=require(_0x76aa('0x0'));var BPromise=require('bluebird');var util=require(_0x76aa('0x1'));var _=require(_0x76aa('0x2'));var squel=require(_0x76aa('0x3'));var Redis=require(_0x76aa('0x4'));var qs=require('../../components/parsers/qs');var logger=require(_0x76aa('0x5'))(_0x76aa('0x6'));var config=require(_0x76aa('0x7'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x76aa('0x8')](config['redis'],{'host':_0x76aa('0x9'),'port':0x18eb});var socket=require(_0x76aa('0xa'))(new Redis(config[_0x76aa('0xb')]));require('./voiceQueue.socket')[_0x76aa('0xc')](socket);function respondWithStatusCode(_0x266bd5,_0x3a3f36){_0x3a3f36=_0x3a3f36||0xcc;return function(_0x557d69){if(_0x557d69){return _0x266bd5[_0x76aa('0xd')](_0x3a3f36);}return _0x266bd5[_0x76aa('0xe')](_0x3a3f36)[_0x76aa('0xf')]();};}function respondWithResult(_0x16cb50,_0x37f1ab){_0x37f1ab=_0x37f1ab||0xc8;return function(_0x128435){if(_0x128435){return _0x16cb50[_0x76aa('0xe')](_0x37f1ab)[_0x76aa('0x10')](_0x128435);}};}function respondWithFilteredResult(_0xd6327,_0x17a417){return function(_0x5e5f47){if(_0x5e5f47){var _0x112c39=typeof _0x17a417['offset']===_0x76aa('0x11')&&typeof _0x17a417[_0x76aa('0x12')]===_0x76aa('0x11');var _0x8e44ed=_0x5e5f47[_0x76aa('0x13')];var _0x4e309f=_0x112c39?0x0:_0x17a417['offset'];var _0x2b3b4f=_0x112c39?_0x5e5f47['count']:_0x17a417[_0x76aa('0x14')]+_0x17a417[_0x76aa('0x12')];var _0x5cf594;if(_0x2b3b4f>=_0x8e44ed){_0x2b3b4f=_0x8e44ed;_0x5cf594=0xc8;}else{_0x5cf594=0xce;}_0xd6327[_0x76aa('0xe')](_0x5cf594);return _0xd6327['set'](_0x76aa('0x15'),_0x4e309f+'-'+_0x2b3b4f+'/'+_0x8e44ed)['json'](_0x5e5f47);}return null;};}function saveUpdates(_0x1515e9){return function(_0x413cf6){if(_0x413cf6){return _0x413cf6[_0x76aa('0x16')](_0x1515e9)[_0x76aa('0x17')](function(_0xa1bc7){return _0xa1bc7;});}return null;};}function removeEntity(_0x3ead3f){return function(_0x496902){if(_0x496902){return _0x496902['destroy']()[_0x76aa('0x17')](function(){var _0x454dd3=_0x496902[_0x76aa('0x18')]({'plain':!![]});var _0x15b931=[{'name':_0x76aa('0x19'),'value':_0x76aa('0x1a'),'ignore':![]},{'name':_0x76aa('0x1b'),'value':_0x76aa('0x1c'),'ignore':![]}];var _0x385157=_(_0x15b931)['filter'](_0x76aa('0x1d'))[_0x76aa('0x1e')](_0x76aa('0x1f'))['value']();if(_[_0x76aa('0x20')](_0x385157,_0x454dd3[_0x76aa('0x21')])){return;}var _0x31252f=_[_0x76aa('0x22')](_0x15b931,[_0x76aa('0x1f'),_0x454dd3[_0x76aa('0x21')]])[_0x76aa('0x23')];return db[_0x76aa('0x24')][_0x76aa('0x25')]({'where':{'type':_0x31252f,'resourceId':_0x454dd3['id']}})[_0x76aa('0x17')](function(){return _0x496902;});})[_0x76aa('0x17')](function(){_0x3ead3f[_0x76aa('0xe')](0xcc)[_0x76aa('0xf')]();});}};}function handleEntityNotFound(_0x4ef9b0){return function(_0xb5e8a9){if(!_0xb5e8a9){_0x4ef9b0[_0x76aa('0xd')](0x194);}return _0xb5e8a9;};}function handleError(_0x25c614,_0x2e7ab4){_0x2e7ab4=_0x2e7ab4||0x1f4;return function(_0xa1e6){logger[_0x76aa('0x26')](_0xa1e6[_0x76aa('0x27')]);if(_0xa1e6[_0x76aa('0x23')]){delete _0xa1e6[_0x76aa('0x23')];}_0x25c614[_0x76aa('0xe')](_0x2e7ab4)['send'](_0xa1e6);};}exports[_0x76aa('0x28')]=function(_0x5a8030,_0x994550){var _0x365ff8={};var _0x2dec94={'count':0x0,'rows':[]};var _0x1e90b9=_[_0x76aa('0x1e')](db[_0x76aa('0x29')][_0x76aa('0x2a')],function(_0x3827ec){return{'name':_0x3827ec[_0x76aa('0x2b')],'type':_0x3827ec[_0x76aa('0x21')]['key']};});_0x365ff8=qs[_0x76aa('0x2c')](_0x1e90b9,_0x5a8030);var _0x5532c7={'where':_0x365ff8[_0x76aa('0x2d')]};return db[_0x76aa('0x29')][_0x76aa('0x13')](_0x5532c7)[_0x76aa('0x17')](function(_0x35a705){_0x2dec94['count']=_0x35a705;_0x365ff8[_0x76aa('0x2e')]=qs[_0x76aa('0x2e')](_0x5a8030['query']);return db[_0x76aa('0x29')]['findAll'](_0x365ff8);})[_0x76aa('0x17')](function(_0x4c90b6){_0x2dec94[_0x76aa('0x2f')]=_0x4c90b6;return _0x2dec94;})['then'](respondWithFilteredResult(_0x994550,_0x365ff8))['catch'](handleError(_0x994550,null));};exports[_0x76aa('0x30')]=function(_0x282c56,_0x198fcb){var _0x37dfab={'raw':![],'where':{'id':_0x282c56['params']['id']}},_0x595a0f={};_0x595a0f[_0x76aa('0x31')]=_[_0x76aa('0x32')](db[_0x76aa('0x29')][_0x76aa('0x2a')]);_0x595a0f[_0x76aa('0x33')]=_['keys'](_0x282c56[_0x76aa('0x33')]);_0x595a0f['filters']=_['intersection'](_0x595a0f[_0x76aa('0x31')],_0x595a0f[_0x76aa('0x33')]);_0x37dfab[_0x76aa('0x34')]=_[_0x76aa('0x35')](_0x595a0f['model'],qs[_0x76aa('0x36')](_0x282c56[_0x76aa('0x33')][_0x76aa('0x36')]));_0x37dfab['attributes']=_0x37dfab[_0x76aa('0x34')][_0x76aa('0x37')]?_0x37dfab[_0x76aa('0x34')]:_0x595a0f[_0x76aa('0x31')];if(_0x282c56[_0x76aa('0x33')][_0x76aa('0x38')]){_0x37dfab[_0x76aa('0x2e')]=[{'all':!![]}];}_0x37dfab=_[_0x76aa('0x39')]({},_0x37dfab,_0x282c56[_0x76aa('0x3a')]);return db['VoiceQueue'][_0x76aa('0x22')](_0x37dfab)[_0x76aa('0x17')](handleEntityNotFound(_0x198fcb,null))[_0x76aa('0x17')](respondWithResult(_0x198fcb,null))[_0x76aa('0x3b')](handleError(_0x198fcb,null));};exports[_0x76aa('0x3c')]=function(_0x2957aa,_0x572fdb){return db['VoiceQueue'][_0x76aa('0x3c')](_0x2957aa[_0x76aa('0x3d')],{})[_0x76aa('0x17')](function(_0x365612){var _0x50599f=_0x2957aa[_0x76aa('0x3e')][_0x76aa('0x18')]({'plain':!![]});if(!_0x50599f)throw new Error(_0x76aa('0x3f'));if(_0x50599f[_0x76aa('0x40')]===_0x76aa('0x3e')){var _0x4aa2f3=_0x365612[_0x76aa('0x18')]({'plain':!![]});var _0x556f59=[{'name':_0x76aa('0x19'),'value':'inbound'},{'name':'QueueCampaigns','value':'outbound'}];var _0x144f0a=_['find'](_0x556f59,['value',_0x4aa2f3['type']])[_0x76aa('0x23')];return db[_0x76aa('0x41')][_0x76aa('0x22')]({'where':{'name':_0x144f0a,'userProfileId':_0x50599f[_0x76aa('0x42')]},'raw':!![]})[_0x76aa('0x17')](function(_0x47b0c8){if(_0x47b0c8&&_0x47b0c8[_0x76aa('0x43')]===0x0){return db[_0x76aa('0x24')][_0x76aa('0x3c')]({'name':_0x4aa2f3[_0x76aa('0x23')],'resourceId':_0x4aa2f3['id'],'type':_0x47b0c8[_0x76aa('0x23')],'sectionId':_0x47b0c8['id']},{})['then'](function(){return _0x365612;});}else{return _0x365612;}})[_0x76aa('0x3b')](function(_0x1c62a9){logger['error'](_0x76aa('0x44'),_0x1c62a9);throw _0x1c62a9;});}return _0x365612;})['then'](respondWithResult(_0x572fdb,0xc9))[_0x76aa('0x3b')](handleError(_0x572fdb,null));};exports[_0x76aa('0x45')]=function(_0x31930b,_0x18fd3e){var _0x2d0bc4={'where':{'id':_0x31930b[_0x76aa('0x46')]['id']}},_0x3e0315={};_0x3e0315[_0x76aa('0x31')]=_[_0x76aa('0x32')](db[_0x76aa('0x29')]['rawAttributes']);_0x2d0bc4[_0x76aa('0x34')]=_['intersection'](_0x3e0315[_0x76aa('0x31')],qs[_0x76aa('0x36')](_0x31930b[_0x76aa('0x33')][_0x76aa('0x36')]));_0x2d0bc4['attributes']=_0x2d0bc4['attributes'][_0x76aa('0x37')]?_0x2d0bc4['attributes']:_0x3e0315[_0x76aa('0x31')];if(_0x31930b[_0x76aa('0x33')][_0x76aa('0x38')]){_0x2d0bc4[_0x76aa('0x2e')]=[{'all':!![]}];}_0x2d0bc4=_[_0x76aa('0x39')]({},_0x2d0bc4,_0x31930b[_0x76aa('0x3a')]);return db['VoiceQueue']['find'](_0x2d0bc4)[_0x76aa('0x17')](handleEntityNotFound(_0x18fd3e,null))[_0x76aa('0x17')](function(_0x1708d4){if(_0x1708d4){var _0x40e8ff=_0x1708d4[_0x76aa('0x18')]({'plain':!![]});_0x40e8ff=qs[_0x76aa('0x47')](_0x40e8ff,['id','createdAt',_0x76aa('0x48')]);_0x31930b[_0x76aa('0x3d')]=_[_0x76aa('0x47')](_0x31930b['body'],['id',_0x76aa('0x49'),'updatedAt']);return db[_0x76aa('0x29')]['create'](_[_0x76aa('0x39')](_0x40e8ff,_0x31930b[_0x76aa('0x3d')]),{'include':_0x31930b[_0x76aa('0x33')][_0x76aa('0x38')]?[{'all':!![]}]:undefined})[_0x76aa('0x17')](function(_0x316de3){var _0x953726=_0x31930b['user'][_0x76aa('0x18')]({'plain':!![]});if(!_0x953726)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x953726[_0x76aa('0x40')]===_0x76aa('0x3e')){var _0x288151=_0x316de3[_0x76aa('0x18')]({'plain':!![]});var _0x3fa7ec=[{'name':_0x76aa('0x19'),'value':_0x76aa('0x1a')},{'name':'QueueCampaigns','value':_0x76aa('0x1c')}];var _0x281f73=_[_0x76aa('0x22')](_0x3fa7ec,[_0x76aa('0x1f'),_0x288151['type']])[_0x76aa('0x23')];return db[_0x76aa('0x41')][_0x76aa('0x22')]({'where':{'name':_0x281f73,'userProfileId':_0x953726[_0x76aa('0x42')]},'raw':!![]})[_0x76aa('0x17')](function(_0xf7732){if(_0xf7732&&_0xf7732['autoAssociation']===0x0){return db[_0x76aa('0x24')][_0x76aa('0x3c')]({'name':_0x288151[_0x76aa('0x23')],'resourceId':_0x288151['id'],'type':_0xf7732[_0x76aa('0x23')],'sectionId':_0xf7732['id']},{})[_0x76aa('0x17')](function(){return _0x316de3;});}else{return _0x316de3;}})[_0x76aa('0x3b')](function(_0x37babe){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x37babe);throw _0x37babe;});}return _0x316de3;});}})[_0x76aa('0x17')](respondWithResult(_0x18fd3e,0xc9))[_0x76aa('0x3b')](handleError(_0x18fd3e,null));};exports['update']=function(_0x3d7802,_0x1e6f3c){if(_0x3d7802['body']['id']){delete _0x3d7802[_0x76aa('0x3d')]['id'];}return db[_0x76aa('0x29')][_0x76aa('0x22')]({'where':{'id':_0x3d7802[_0x76aa('0x46')]['id']}})[_0x76aa('0x17')](handleEntityNotFound(_0x1e6f3c,null))[_0x76aa('0x17')](saveUpdates(_0x3d7802[_0x76aa('0x3d')],null))[_0x76aa('0x17')](respondWithResult(_0x1e6f3c,null))[_0x76aa('0x3b')](handleError(_0x1e6f3c,null));};exports['destroy']=function(_0xd337f0,_0x49156c){return db[_0x76aa('0x29')][_0x76aa('0x22')]({'where':{'id':_0xd337f0[_0x76aa('0x46')]['id']}})[_0x76aa('0x17')](handleEntityNotFound(_0x49156c,null))[_0x76aa('0x17')](removeEntity(_0x49156c,null))[_0x76aa('0x3b')](handleError(_0x49156c,null));};exports[_0x76aa('0x4a')]=function(_0x431d1c,_0x2f1263){var _0x5eceba={'raw':![],'where':{}};var _0x267fcf={};var _0x3d4025={'count':0x0,'rows':[]};return db[_0x76aa('0x29')][_0x76aa('0x4b')]({'where':{'id':_0x431d1c[_0x76aa('0x46')]['id']}})[_0x76aa('0x17')](handleEntityNotFound(_0x2f1263,null))[_0x76aa('0x17')](function(_0x157540){if(_0x157540){_0x267fcf['model']=_[_0x76aa('0x32')](db['CmHopper'][_0x76aa('0x2a')]);_0x267fcf[_0x76aa('0x33')]=_[_0x76aa('0x32')](_0x431d1c[_0x76aa('0x33')]);_0x267fcf[_0x76aa('0x4c')]=_[_0x76aa('0x35')](_0x267fcf[_0x76aa('0x31')],_0x267fcf['query']);_0x5eceba[_0x76aa('0x34')]=_[_0x76aa('0x35')](_0x267fcf['model'],qs['fields'](_0x431d1c[_0x76aa('0x33')][_0x76aa('0x36')]));_0x5eceba['attributes']=_0x5eceba[_0x76aa('0x34')][_0x76aa('0x37')]?_0x5eceba[_0x76aa('0x34')]:_0x267fcf['model'];if(!_0x431d1c[_0x76aa('0x33')]['hasOwnProperty'](_0x76aa('0x4d'))){_0x5eceba[_0x76aa('0x12')]=qs[_0x76aa('0x12')](_0x431d1c[_0x76aa('0x33')]['limit']);_0x5eceba['offset']=qs[_0x76aa('0x14')](_0x431d1c['query'][_0x76aa('0x14')]);}_0x5eceba[_0x76aa('0x4e')]=qs[_0x76aa('0x4f')](_0x431d1c[_0x76aa('0x33')][_0x76aa('0x4f')]);_0x5eceba[_0x76aa('0x2d')]=qs[_0x76aa('0x4c')](_[_0x76aa('0x50')](_0x431d1c[_0x76aa('0x33')],_0x267fcf['filters']));_0x5eceba[_0x76aa('0x2d')][_0x76aa('0x51')]=_0x157540['id'];if(_0x431d1c[_0x76aa('0x33')][_0x76aa('0x52')]){_0x5eceba['where']=_['merge'](_0x5eceba['where'],{'$or':_[_0x76aa('0x1e')](_0x5eceba['attributes'],function(_0xb61e5){var _0x256195={};_0x256195[_0xb61e5]={'$like':'%'+_0x431d1c[_0x76aa('0x33')][_0x76aa('0x52')]+'%'};return _0x256195;})});}_0x5eceba=_['merge']({},_0x5eceba,_0x431d1c[_0x76aa('0x3a')]);return db['CmHopper'][_0x76aa('0x13')]({'where':_0x5eceba[_0x76aa('0x2d')]})[_0x76aa('0x17')](function(_0x11d602){_0x3d4025[_0x76aa('0x13')]=_0x11d602;if(_0x431d1c['query'][_0x76aa('0x38')]){_0x5eceba[_0x76aa('0x2e')]=[{'all':!![]}];}return db[_0x76aa('0x53')][_0x76aa('0x54')](_0x5eceba);})[_0x76aa('0x17')](function(_0x22432d){_0x3d4025[_0x76aa('0x2f')]=_0x22432d;return _0x3d4025;});}})[_0x76aa('0x17')](respondWithFilteredResult(_0x2f1263,_0x5eceba))['catch'](handleError(_0x2f1263,null));};exports[_0x76aa('0x55')]=function(_0x381f44,_0x48136a){var _0x3c1b98={'raw':!![],'where':{}};var _0x215463={};var _0x325487={'count':0x0,'rows':[]};return db[_0x76aa('0x29')][_0x76aa('0x4b')]({'where':{'id':_0x381f44[_0x76aa('0x46')]['id']}})[_0x76aa('0x17')](handleEntityNotFound(_0x48136a,null))['then'](function(_0xdb821b){if(_0xdb821b){_0x215463['model']=_['keys'](db[_0x76aa('0x56')][_0x76aa('0x2a')]);_0x215463['query']=_['keys'](_0x381f44[_0x76aa('0x33')]);_0x215463[_0x76aa('0x4c')]=_[_0x76aa('0x35')](_0x215463['model'],_0x215463['query']);_0x3c1b98[_0x76aa('0x34')]=_[_0x76aa('0x35')](_0x215463[_0x76aa('0x31')],qs['fields'](_0x381f44[_0x76aa('0x33')]['fields']));_0x3c1b98[_0x76aa('0x34')]=_0x3c1b98[_0x76aa('0x34')][_0x76aa('0x37')]?_0x3c1b98[_0x76aa('0x34')]:_0x215463[_0x76aa('0x31')];if(!_0x381f44['query']['hasOwnProperty'](_0x76aa('0x4d'))){_0x3c1b98[_0x76aa('0x12')]=qs[_0x76aa('0x12')](_0x381f44['query'][_0x76aa('0x12')]);_0x3c1b98[_0x76aa('0x14')]=qs[_0x76aa('0x14')](_0x381f44[_0x76aa('0x33')][_0x76aa('0x14')]);}_0x3c1b98['order']=qs[_0x76aa('0x4f')](_0x381f44['query'][_0x76aa('0x4f')]);_0x3c1b98[_0x76aa('0x2d')]=qs[_0x76aa('0x4c')](_[_0x76aa('0x50')](_0x381f44[_0x76aa('0x33')],_0x215463[_0x76aa('0x4c')]));_0x3c1b98['where']['VoiceQueueId']=_0xdb821b['id'];if(_0x381f44['query']['filter']){_0x3c1b98['where']=_[_0x76aa('0x39')](_0x3c1b98[_0x76aa('0x2d')],{'$or':_['map'](_0x3c1b98['attributes'],function(_0x4f01e9){var _0x3a6326={};_0x3a6326[_0x4f01e9]={'$like':'%'+_0x381f44[_0x76aa('0x33')][_0x76aa('0x52')]+'%'};return _0x3a6326;})});}_0x3c1b98=_['merge']({},_0x3c1b98,_0x381f44['options']);return db[_0x76aa('0x56')][_0x76aa('0x13')]({'where':_0x3c1b98[_0x76aa('0x2d')]})[_0x76aa('0x17')](function(_0x354c7b){_0x325487['count']=_0x354c7b;if(_0x381f44['query'][_0x76aa('0x38')]){_0x3c1b98['include']=[{'all':!![]}];}return db['CmHopperHistory']['findAll'](_0x3c1b98);})[_0x76aa('0x17')](function(_0xbb1ccd){_0x325487['rows']=_0xbb1ccd;return _0x325487;});}})[_0x76aa('0x17')](respondWithFilteredResult(_0x48136a,_0x3c1b98))[_0x76aa('0x3b')](handleError(_0x48136a,null));};exports['getHopperFinals']=function(_0x22063f,_0x24331a){var _0x11d91f={'raw':!![],'where':{}};var _0x258e5a={};var _0x1fa86b={'count':0x0,'rows':[]};return db[_0x76aa('0x29')][_0x76aa('0x4b')]({'where':{'id':_0x22063f[_0x76aa('0x46')]['id']}})[_0x76aa('0x17')](handleEntityNotFound(_0x24331a,null))['then'](function(_0x84bc91){if(_0x84bc91){_0x258e5a[_0x76aa('0x31')]=_['keys'](db[_0x76aa('0x57')][_0x76aa('0x2a')]);_0x258e5a[_0x76aa('0x33')]=_['keys'](_0x22063f[_0x76aa('0x33')]);_0x258e5a[_0x76aa('0x4c')]=_['intersection'](_0x258e5a[_0x76aa('0x31')],_0x258e5a[_0x76aa('0x33')]);_0x11d91f[_0x76aa('0x34')]=_['intersection'](_0x258e5a[_0x76aa('0x31')],qs[_0x76aa('0x36')](_0x22063f['query']['fields']));_0x11d91f['attributes']=_0x11d91f[_0x76aa('0x34')][_0x76aa('0x37')]?_0x11d91f[_0x76aa('0x34')]:_0x258e5a[_0x76aa('0x31')];if(!_0x22063f['query']['hasOwnProperty']('nolimit')){_0x11d91f[_0x76aa('0x12')]=qs['limit'](_0x22063f[_0x76aa('0x33')][_0x76aa('0x12')]);_0x11d91f['offset']=qs[_0x76aa('0x14')](_0x22063f[_0x76aa('0x33')]['offset']);}_0x11d91f[_0x76aa('0x4e')]=qs[_0x76aa('0x4f')](_0x22063f[_0x76aa('0x33')][_0x76aa('0x4f')]);_0x11d91f[_0x76aa('0x2d')]=qs[_0x76aa('0x4c')](_['pick'](_0x22063f[_0x76aa('0x33')],_0x258e5a['filters']));_0x11d91f['where']['VoiceQueueId']=_0x84bc91['id'];if(_0x22063f['query']['filter']){_0x11d91f[_0x76aa('0x2d')]=_[_0x76aa('0x39')](_0x11d91f[_0x76aa('0x2d')],{'$or':_[_0x76aa('0x1e')](_0x11d91f['attributes'],function(_0x447103){var _0x2192ed={};_0x2192ed[_0x447103]={'$like':'%'+_0x22063f[_0x76aa('0x33')][_0x76aa('0x52')]+'%'};return _0x2192ed;})});}_0x11d91f=_[_0x76aa('0x39')]({},_0x11d91f,_0x22063f['options']);return db[_0x76aa('0x57')][_0x76aa('0x13')]({'where':_0x11d91f[_0x76aa('0x2d')]})[_0x76aa('0x17')](function(_0x13be70){_0x1fa86b[_0x76aa('0x13')]=_0x13be70;if(_0x22063f[_0x76aa('0x33')]['includeAll']){_0x11d91f[_0x76aa('0x2e')]=[{'all':!![]}];}return db[_0x76aa('0x57')]['findAll'](_0x11d91f);})['then'](function(_0x216e87){_0x1fa86b[_0x76aa('0x2f')]=_0x216e87;return _0x1fa86b;});}})['then'](respondWithFilteredResult(_0x24331a,_0x11d91f))[_0x76aa('0x3b')](handleError(_0x24331a,null));};exports['getHopperBlacks']=function(_0x28ec11,_0x5cc005){var _0x28b439={'raw':!![],'where':{}};var _0x583924={};var _0x45227e={'count':0x0,'rows':[]};return db[_0x76aa('0x29')][_0x76aa('0x4b')]({'where':{'id':_0x28ec11['params']['id']}})[_0x76aa('0x17')](handleEntityNotFound(_0x5cc005,null))['then'](function(_0x1af32e){if(_0x1af32e){_0x583924[_0x76aa('0x31')]=_['keys'](db['CmHopperBlack'][_0x76aa('0x2a')]);_0x583924[_0x76aa('0x33')]=_[_0x76aa('0x32')](_0x28ec11[_0x76aa('0x33')]);_0x583924['filters']=_['intersection'](_0x583924[_0x76aa('0x31')],_0x583924['query']);_0x28b439[_0x76aa('0x34')]=_['intersection'](_0x583924[_0x76aa('0x31')],qs[_0x76aa('0x36')](_0x28ec11['query'][_0x76aa('0x36')]));_0x28b439['attributes']=_0x28b439['attributes'][_0x76aa('0x37')]?_0x28b439[_0x76aa('0x34')]:_0x583924['model'];if(!_0x28ec11[_0x76aa('0x33')][_0x76aa('0x58')](_0x76aa('0x4d'))){_0x28b439['limit']=qs[_0x76aa('0x12')](_0x28ec11[_0x76aa('0x33')][_0x76aa('0x12')]);_0x28b439[_0x76aa('0x14')]=qs[_0x76aa('0x14')](_0x28ec11[_0x76aa('0x33')][_0x76aa('0x14')]);}_0x28b439[_0x76aa('0x4e')]=qs[_0x76aa('0x4f')](_0x28ec11[_0x76aa('0x33')][_0x76aa('0x4f')]);_0x28b439[_0x76aa('0x2d')]=qs['filters'](_[_0x76aa('0x50')](_0x28ec11[_0x76aa('0x33')],_0x583924['filters']));_0x28b439[_0x76aa('0x2d')][_0x76aa('0x51')]=_0x1af32e['id'];if(_0x28ec11['query']['filter']){_0x28b439[_0x76aa('0x2d')]=_[_0x76aa('0x39')](_0x28b439['where'],{'$or':_[_0x76aa('0x1e')](_0x28b439[_0x76aa('0x34')],function(_0x24af48){var _0x5010c8={};_0x5010c8[_0x24af48]={'$like':'%'+_0x28ec11[_0x76aa('0x33')][_0x76aa('0x52')]+'%'};return _0x5010c8;})});}_0x28b439=_['merge']({},_0x28b439,_0x28ec11[_0x76aa('0x3a')]);return db[_0x76aa('0x59')][_0x76aa('0x13')]({'where':_0x28b439[_0x76aa('0x2d')]})[_0x76aa('0x17')](function(_0x42543c){_0x45227e['count']=_0x42543c;if(_0x28ec11[_0x76aa('0x33')]['includeAll']){_0x28b439[_0x76aa('0x2e')]=[{'all':!![]}];}return db[_0x76aa('0x59')][_0x76aa('0x54')](_0x28b439);})['then'](function(_0x4c5f54){_0x45227e[_0x76aa('0x2f')]=_0x4c5f54;return _0x45227e;});}})[_0x76aa('0x17')](respondWithFilteredResult(_0x5cc005,_0x28b439))[_0x76aa('0x3b')](handleError(_0x5cc005,null));};exports[_0x76aa('0x5a')]=function(_0x1a81fd,_0x1eb8f2){var _0x4f7dd4={};var _0x5a4c03={};var _0x2565a2;var _0x109bd3;return db[_0x76aa('0x29')][_0x76aa('0x4b')]({'where':{'id':_0x1a81fd['params']['id']}})[_0x76aa('0x17')](handleEntityNotFound(_0x1eb8f2,null))['then'](function(_0x54d530){if(_0x54d530){_0x2565a2=_0x54d530;_0x5a4c03[_0x76aa('0x31')]=_[_0x76aa('0x32')](db[_0x76aa('0x5b')]['rawAttributes']);_0x5a4c03[_0x76aa('0x33')]=_[_0x76aa('0x32')](_0x1a81fd[_0x76aa('0x33')]);_0x5a4c03[_0x76aa('0x4c')]=_[_0x76aa('0x35')](_0x5a4c03[_0x76aa('0x31')],_0x5a4c03[_0x76aa('0x33')]);_0x4f7dd4['attributes']=_[_0x76aa('0x35')](_0x5a4c03[_0x76aa('0x31')],qs[_0x76aa('0x36')](_0x1a81fd[_0x76aa('0x33')][_0x76aa('0x36')]));_0x4f7dd4[_0x76aa('0x34')]=_0x4f7dd4['attributes'][_0x76aa('0x37')]?_0x4f7dd4[_0x76aa('0x34')]:_0x5a4c03[_0x76aa('0x31')];_0x4f7dd4[_0x76aa('0x4e')]=qs['sort'](_0x1a81fd[_0x76aa('0x33')][_0x76aa('0x4f')]);_0x4f7dd4[_0x76aa('0x2d')]=qs[_0x76aa('0x4c')](_[_0x76aa('0x50')](_0x1a81fd['query'],_0x5a4c03[_0x76aa('0x4c')]));if(_0x1a81fd[_0x76aa('0x33')]['filter']){_0x4f7dd4['where']=_[_0x76aa('0x39')](_0x4f7dd4[_0x76aa('0x2d')],{'$or':_[_0x76aa('0x1e')](_0x4f7dd4[_0x76aa('0x34')],function(_0x46f098){var _0x293221={};_0x293221[_0x46f098]={'$like':'%'+_0x1a81fd['query'][_0x76aa('0x52')]+'%'};return _0x293221;})});}_0x4f7dd4=_[_0x76aa('0x39')]({},_0x4f7dd4,_0x1a81fd[_0x76aa('0x3a')]);return _0x2565a2[_0x76aa('0x5a')](_0x4f7dd4);}})[_0x76aa('0x17')](function(_0x2e7bb7){if(_0x2e7bb7){_0x109bd3=_0x2e7bb7['length'];if(!_0x1a81fd[_0x76aa('0x33')][_0x76aa('0x58')](_0x76aa('0x4d'))){_0x4f7dd4[_0x76aa('0x12')]=qs[_0x76aa('0x12')](_0x1a81fd[_0x76aa('0x33')]['limit']);_0x4f7dd4[_0x76aa('0x14')]=qs['offset'](_0x1a81fd[_0x76aa('0x33')]['offset']);}return _0x2565a2[_0x76aa('0x5a')](_0x4f7dd4);}})[_0x76aa('0x17')](function(_0x56d6af){if(_0x56d6af){return _0x56d6af?{'count':_0x109bd3,'rows':_0x56d6af}:null;}})[_0x76aa('0x17')](respondWithResult(_0x1eb8f2,null))[_0x76aa('0x3b')](handleError(_0x1eb8f2,null));};exports[_0x76aa('0x5c')]=function(_0x57636c,_0x3ae5e8){var _0x46c818=_0x57636c['body'][_0x76aa('0x5d')];var _0xfe926d=_[_0x76aa('0x1e')](_0x46c818,'id');return db[_0x76aa('0x5b')][_0x76aa('0x54')]({'where':{'id':_0xfe926d},'attributes':['id'],'include':[{'model':db[_0x76aa('0x5e')],'as':'Agents','attributes':['id',_0x76aa('0x23'),_0x76aa('0x5f'),_0x76aa('0x60'),_0x76aa('0x61')],'raw':!![]}]})[_0x76aa('0x17')](function(_0x28e1a4){if(_0x28e1a4){var _0x8bb516=_[_0x76aa('0x62')](_0x28e1a4,function(_0xf9f670){var _0x1359f9=_0xf9f670[_0x76aa('0x18')]({'plain':!![]});_0x1359f9['Agents'][_0x76aa('0x63')](function(_0x58cd0c){_0x58cd0c[_0x76aa('0x64')]=_[_0x76aa('0x22')](_0x46c818,{'id':_0x1359f9['id']})[_0x76aa('0x64')];});return _0x1359f9[_0x76aa('0x65')];});return db[_0x76aa('0x29')][_0x76aa('0x22')]({'where':{'id':_0x57636c['params']['id']}})[_0x76aa('0x17')](function(_0x53090c){return db[_0x76aa('0x66')][_0x76aa('0x67')](function(_0x2045a2){return _0x53090c['addTeams'](_0xfe926d,{'transaction':_0x2045a2})[_0x76aa('0x17')](function(){return BPromise[_0x76aa('0x68')](_0x46c818,function(_0x228968){return db[_0x76aa('0x69')][_0x76aa('0x6a')]({'TeamId':_0x228968['id'],'VoiceQueueId':_0x57636c['params']['id'],'penalty':_0x228968[_0x76aa('0x64')]},{'transaction':_0x2045a2});});})['then'](function(){return BPromise[_0x76aa('0x68')](_0x8bb516,function(_0x1bc764){return db['UserVoiceQueue'][_0x76aa('0x6b')]({'where':{'UserId':_0x1bc764['id'],'VoiceQueueId':_0x57636c[_0x76aa('0x46')]['id']},'defaults':{'penalty':_0x1bc764[_0x76aa('0x64')]},'transaction':_0x2045a2});});})[_0x76aa('0x17')](function(){return BPromise[_0x76aa('0x68')](_[_0x76aa('0x52')](_0x8bb516,{'online':!![]}),function(_0x245af7){return db[_0x76aa('0x6c')]['upsert']({'membername':_0x245af7[_0x76aa('0x23')],'UserId':_0x245af7['id'],'queue_name':_0x53090c[_0x76aa('0x23')],'VoiceQueueId':_0x53090c['id'],'interface':_[_0x76aa('0x6d')](_0x245af7[_0x76aa('0x61')])?util[_0x76aa('0x6e')](_0x76aa('0x6f'),_0x245af7[_0x76aa('0x23')]):_0x245af7[_0x76aa('0x61')],'paused':_0x245af7['voicePause']||![],'penalty':_0x245af7[_0x76aa('0x64')]},{'transaction':_0x2045a2});});})[_0x76aa('0x17')](function(){_0x8bb516[_0x76aa('0x63')](function(_0x54e450){socket[_0x76aa('0x70')](_0x76aa('0x71'),{'UserId':_0x54e450['id'],'VoiceQueueId':_0x53090c['id']});});});});});}})[_0x76aa('0x17')](respondWithStatusCode(_0x3ae5e8,null))[_0x76aa('0x3b')](handleError(_0x3ae5e8,null));};exports[_0x76aa('0x72')]=function(_0x5db8d8,_0x21fd43){return db['Team'][_0x76aa('0x54')]({'where':{'id':_0x5db8d8[_0x76aa('0x33')][_0x76aa('0x73')]},'attributes':['id'],'include':[{'model':db[_0x76aa('0x5e')],'as':_0x76aa('0x65'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x21fd43,null))[_0x76aa('0x17')](function(_0x4920fa){var _0x577463=_[_0x76aa('0x1e')](_0x4920fa,'id');var _0x20ba92=[];var _0x533080=[];var _0x3cd088=squel['select']();_0x3cd088[_0x76aa('0x74')](_0x76aa('0x75'))[_0x76aa('0x76')](_0x76aa('0x77'),'tq')[_0x76aa('0x78')](_0x76aa('0x79'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x76aa('0x2d')](_0x76aa('0x7a'),_0x5db8d8[_0x76aa('0x46')]['id']);for(var _0x3ebe91=0x0;_0x3ebe91<_0x4920fa[_0x76aa('0x37')];_0x3ebe91+=0x1){let _0x14318c=_0x4920fa[_0x3ebe91];for(var _0xbfa5f8=0x0;_0xbfa5f8<_0x14318c[_0x76aa('0x65')][_0x76aa('0x37')];_0xbfa5f8+=0x1){let _0x46772f=_0x14318c[_0x76aa('0x65')][_0xbfa5f8];var _0x40df44=_0x3cd088[_0x76aa('0x45')]();_0x40df44[_0x76aa('0x2d')](_0x76aa('0x7b'),_0x46772f['id']);_0x533080[_0x76aa('0x7c')](db[_0x76aa('0x66')][_0x76aa('0x33')](_0x40df44['toString'](),{'type':db[_0x76aa('0x66')]['QueryTypes'][_0x76aa('0x7d')]})[_0x76aa('0x17')](function(_0x4a093b){if(_0x4a093b[_0x76aa('0x37')]===0x1){return _0x46772f['id'];}else{var _0x5305f1=_[_0x76aa('0x7e')](_[_0x76aa('0x1e')](_0x4a093b,_0x76aa('0x7f')),function(_0x5ceae2){return _[_0x76aa('0x20')](_0x577463,_0x5ceae2);});if(_0x5305f1){return _0x46772f['id'];}}}));}}return BPromise['all'](_0x533080)['then'](function(_0x3c9841){_0x20ba92=_(_0x20ba92)['union'](_0x3c9841)[_0x76aa('0x80')]()['value']();return db['VoiceQueue'][_0x76aa('0x22')]({'where':{'id':_0x5db8d8[_0x76aa('0x46')]['id']}})[_0x76aa('0x17')](function(_0x3f4ded){return db[_0x76aa('0x66')][_0x76aa('0x67')](function(_0x434634){return _0x3f4ded[_0x76aa('0x72')](_0x5db8d8[_0x76aa('0x33')][_0x76aa('0x73')],{'transaction':_0x434634})[_0x76aa('0x17')](function(){if(!_[_0x76aa('0x81')](_0x20ba92)){return _0x3f4ded[_0x76aa('0x82')](_0x20ba92,{'transaction':_0x434634})[_0x76aa('0x17')](function(){return db['UserVoiceQueueRt'][_0x76aa('0x25')]({'where':{'VoiceQueueId':_0x5db8d8[_0x76aa('0x46')]['id'],'UserId':_0x20ba92},'transaction':_0x434634});});}})[_0x76aa('0x17')](function(){_0x20ba92[_0x76aa('0x63')](function(_0x540bf3){socket[_0x76aa('0x70')]('userVoiceQueue:remove',{'UserId':_0x540bf3,'VoiceQueueId':_0x3f4ded['id']});});});});});});})[_0x76aa('0x17')](respondWithStatusCode(_0x21fd43,null))['catch'](handleError(_0x21fd43,null));};exports[_0x76aa('0x83')]=function(_0x5427f0,_0x3e9153){var _0x490090,_0x31b7a8;return db['VoiceQueue'][_0x76aa('0x22')]({'where':{'id':_0x5427f0[_0x76aa('0x46')]['id']}})['then'](handleEntityNotFound(_0x3e9153,null))[_0x76aa('0x17')](function(_0x51feca){if(_0x51feca){_0x31b7a8=_0x51feca;return _0x51feca[_0x76aa('0x83')](_0x5427f0['body'][_0x76aa('0x73')],_['omit'](_0x5427f0['body'],[_0x76aa('0x73'),'id'])||{})[_0x76aa('0x84')](function(_0x38b6aa){for(var _0x395501=0x0;_0x395501<_0x5427f0[_0x76aa('0x3d')][_0x76aa('0x73')][_0x76aa('0x37')];_0x395501+=0x1){socket[_0x76aa('0x70')](_0x76aa('0x71'),{'UserId':Number(_0x5427f0[_0x76aa('0x3d')]['ids'][_0x395501]),'VoiceQueueId':Number(_0x5427f0[_0x76aa('0x46')]['id'])});}return _0x38b6aa;});}})[_0x76aa('0x17')](function(_0x3d969f){_0x490090=_0x3d969f||[];if(_0x31b7a8){return db[_0x76aa('0x5e')][_0x76aa('0x54')]({'where':{'id':_0x5427f0[_0x76aa('0x3d')][_0x76aa('0x73')]},'attributes':['id',_0x76aa('0x23'),_0x76aa('0x5f'),_0x76aa('0x60'),_0x76aa('0x61')],'raw':!![]});}})[_0x76aa('0x17')](function(_0x3274a9){if(!_[_0x76aa('0x81')](_0x3274a9)){var _0x5c0268=[];for(var _0x5c5a6f=0x0;_0x5c5a6f<_0x3274a9[_0x76aa('0x37')];_0x5c5a6f++){if(_0x3274a9[_0x5c5a6f][_0x76aa('0x5f')]){_0x5c0268[_0x76aa('0x7c')](db['UserVoiceQueueRt']['upsert']({'membername':_0x3274a9[_0x5c5a6f][_0x76aa('0x23')],'UserId':_0x3274a9[_0x5c5a6f]['id'],'queue_name':_0x31b7a8[_0x76aa('0x23')],'VoiceQueueId':_0x31b7a8['id'],'interface':_[_0x76aa('0x6d')](_0x3274a9[_0x5c5a6f]['interface'])?util[_0x76aa('0x6e')](_0x76aa('0x6f'),_0x3274a9[_0x5c5a6f]['name']):_0x3274a9[_0x5c5a6f]['interface'],'paused':_0x3274a9[_0x5c5a6f]['voicePause']||![],'penalty':_0x5427f0[_0x76aa('0x3d')][_0x76aa('0x64')]||0x0}));}}return BPromise[_0x76aa('0x85')](_0x5c0268);}})['then'](function(){return _0x490090;})[_0x76aa('0x17')](respondWithResult(_0x3e9153,null))[_0x76aa('0x3b')](handleError(_0x3e9153,null));};exports['removeAgents']=function(_0x5433dc,_0x328d1a){return db[_0x76aa('0x29')][_0x76aa('0x22')]({'where':{'id':_0x5433dc['params']['id']}})[_0x76aa('0x17')](handleEntityNotFound(_0x328d1a,null))[_0x76aa('0x17')](function(_0x546770){if(_0x546770){return _0x546770[_0x76aa('0x82')](_0x5433dc[_0x76aa('0x33')]['ids'])[_0x76aa('0x17')](function(){if(_[_0x76aa('0x86')](_0x5433dc['query'][_0x76aa('0x73')])){for(var _0x4df504=0x0;_0x4df504<_0x5433dc['query'][_0x76aa('0x73')][_0x76aa('0x37')];_0x4df504+=0x1){socket[_0x76aa('0x70')](_0x76aa('0x87'),{'UserId':Number(_0x5433dc[_0x76aa('0x33')][_0x76aa('0x73')][_0x4df504]),'VoiceQueueId':Number(_0x5433dc[_0x76aa('0x46')]['id'])});}}else{socket[_0x76aa('0x70')](_0x76aa('0x87'),{'UserId':Number(_0x5433dc[_0x76aa('0x33')]['ids']),'VoiceQueueId':Number(_0x5433dc['params']['id'])});}});}})[_0x76aa('0x17')](function(_0x2726da){return db[_0x76aa('0x6c')][_0x76aa('0x25')]({'where':{'VoiceQueueId':_0x5433dc[_0x76aa('0x46')]['id'],'UserId':_0x5433dc[_0x76aa('0x33')]['ids']}})[_0x76aa('0x17')](function(){return _0x2726da;});})[_0x76aa('0x17')](respondWithStatusCode(_0x328d1a,null))[_0x76aa('0x3b')](handleError(_0x328d1a,null));};exports[_0x76aa('0x88')]=function(_0x38694d,_0xf0b932){var _0x1c8cf5={};var _0x5a8d0f={};var _0x5f513d;var _0x54e70c;return db[_0x76aa('0x29')][_0x76aa('0x4b')]({'where':{'id':_0x38694d[_0x76aa('0x46')]['id']}})[_0x76aa('0x17')](handleEntityNotFound(_0xf0b932,null))[_0x76aa('0x17')](function(_0x4afe13){if(_0x4afe13){_0x5f513d=_0x4afe13;_0x5a8d0f['model']=_[_0x76aa('0x32')](db[_0x76aa('0x5e')][_0x76aa('0x2a')]);_0x5a8d0f[_0x76aa('0x33')]=_[_0x76aa('0x32')](_0x38694d['query']);_0x5a8d0f[_0x76aa('0x4c')]=_['intersection'](_0x5a8d0f[_0x76aa('0x31')],_0x5a8d0f['query']);_0x1c8cf5['attributes']=_[_0x76aa('0x35')](_0x5a8d0f['model'],qs[_0x76aa('0x36')](_0x38694d[_0x76aa('0x33')][_0x76aa('0x36')]));_0x1c8cf5[_0x76aa('0x34')]=_0x1c8cf5[_0x76aa('0x34')][_0x76aa('0x37')]?_0x1c8cf5[_0x76aa('0x34')]:_0x5a8d0f[_0x76aa('0x31')];_0x1c8cf5['order']=qs[_0x76aa('0x4f')](_0x38694d[_0x76aa('0x33')][_0x76aa('0x4f')]);_0x1c8cf5[_0x76aa('0x2d')]=qs[_0x76aa('0x4c')](_['pick'](_0x38694d[_0x76aa('0x33')],_0x5a8d0f['filters']));if(_0x38694d[_0x76aa('0x33')]['filter']){_0x1c8cf5[_0x76aa('0x2d')]=_['merge'](_0x1c8cf5[_0x76aa('0x2d')],{'$or':_['map'](_0x1c8cf5[_0x76aa('0x34')],function(_0x8b2ee1){var _0x279be2={};_0x279be2[_0x8b2ee1]={'$like':'%'+_0x38694d['query']['filter']+'%'};return _0x279be2;})});}_0x1c8cf5=_[_0x76aa('0x39')]({},_0x1c8cf5,_0x38694d['options']);return _0x5f513d[_0x76aa('0x88')](_0x1c8cf5);}})[_0x76aa('0x17')](function(_0x1b99d8){if(_0x1b99d8){_0x54e70c=_0x1b99d8['length'];if(!_0x38694d['query']['hasOwnProperty']('nolimit')){_0x1c8cf5[_0x76aa('0x12')]=qs[_0x76aa('0x12')](_0x38694d[_0x76aa('0x33')][_0x76aa('0x12')]);_0x1c8cf5[_0x76aa('0x14')]=qs[_0x76aa('0x14')](_0x38694d[_0x76aa('0x33')][_0x76aa('0x14')]);}return _0x5f513d[_0x76aa('0x88')](_0x1c8cf5);}})[_0x76aa('0x17')](function(_0x2484fd){if(_0x2484fd){return _0x2484fd?{'count':_0x54e70c,'rows':_0x2484fd}:null;}})[_0x76aa('0x17')](respondWithResult(_0xf0b932,null))[_0x76aa('0x3b')](handleError(_0xf0b932,null));};exports['getMembers']=function(_0x2b12e9,_0x4e697b){var _0x1e902d={};var _0x3a7658={};var _0x1b1f85;var _0x3fb275;return db[_0x76aa('0x29')][_0x76aa('0x4b')]({'where':{'id':_0x2b12e9[_0x76aa('0x46')]['id']}})[_0x76aa('0x17')](handleEntityNotFound(_0x4e697b,null))[_0x76aa('0x17')](function(_0x1bdc5c){if(_0x1bdc5c){_0x1b1f85=_0x1bdc5c;_0x3a7658[_0x76aa('0x31')]=_['keys'](db['UserVoiceQueueRt'][_0x76aa('0x2a')]);_0x3a7658[_0x76aa('0x33')]=_['keys'](_0x2b12e9[_0x76aa('0x33')]);_0x3a7658[_0x76aa('0x4c')]=_[_0x76aa('0x35')](_0x3a7658[_0x76aa('0x31')],_0x3a7658[_0x76aa('0x33')]);_0x1e902d[_0x76aa('0x34')]=_[_0x76aa('0x35')](_0x3a7658['model'],qs[_0x76aa('0x36')](_0x2b12e9[_0x76aa('0x33')]['fields']));_0x1e902d['attributes']=_0x1e902d[_0x76aa('0x34')][_0x76aa('0x37')]?_0x1e902d[_0x76aa('0x34')]:_0x3a7658[_0x76aa('0x31')];_0x1e902d[_0x76aa('0x4e')]=qs[_0x76aa('0x4f')](_0x2b12e9[_0x76aa('0x33')][_0x76aa('0x4f')]);_0x1e902d[_0x76aa('0x2d')]=qs[_0x76aa('0x4c')](_[_0x76aa('0x50')](_0x2b12e9[_0x76aa('0x33')],_0x3a7658[_0x76aa('0x4c')]));if(_0x2b12e9['query']['filter']){_0x1e902d[_0x76aa('0x2d')]=_[_0x76aa('0x39')](_0x1e902d[_0x76aa('0x2d')],{'$or':_[_0x76aa('0x1e')](_0x1e902d['attributes'],function(_0x5f3819){var _0x2a8410={};_0x2a8410[_0x5f3819]={'$like':'%'+_0x2b12e9[_0x76aa('0x33')][_0x76aa('0x52')]+'%'};return _0x2a8410;})});}_0x1e902d=_['merge']({},_0x1e902d,_0x2b12e9['options']);return _0x1b1f85['getMembers'](_0x1e902d);}})[_0x76aa('0x17')](function(_0x4df872){if(_0x4df872){_0x3fb275=_0x4df872[_0x76aa('0x37')];if(!_0x2b12e9[_0x76aa('0x33')][_0x76aa('0x58')](_0x76aa('0x4d'))){_0x1e902d[_0x76aa('0x12')]=qs[_0x76aa('0x12')](_0x2b12e9[_0x76aa('0x33')][_0x76aa('0x12')]);_0x1e902d[_0x76aa('0x14')]=qs[_0x76aa('0x14')](_0x2b12e9[_0x76aa('0x33')][_0x76aa('0x14')]);}return _0x1b1f85[_0x76aa('0x89')](_0x1e902d);}})[_0x76aa('0x17')](function(_0x3b1f33){return _0x3b1f33?{'count':_0x3fb275,'rows':_0x3b1f33}:null;})[_0x76aa('0x17')](respondWithResult(_0x4e697b,null))['catch'](handleError(_0x4e697b,null));};exports[_0x76aa('0x8a')]=function(_0x5e8cec,_0x1a37e9){var _0x58932f={};var _0x17bd1a={};var _0x5d7a2b;var _0x363c45;return db['VoiceQueue']['findOne']({'where':{'id':_0x5e8cec[_0x76aa('0x46')]['id']}})[_0x76aa('0x17')](handleEntityNotFound(_0x1a37e9,null))[_0x76aa('0x17')](function(_0x44668d){if(_0x44668d){_0x5d7a2b=_0x44668d;_0x17bd1a[_0x76aa('0x31')]=_[_0x76aa('0x32')](db['CmList'][_0x76aa('0x2a')]);_0x17bd1a[_0x76aa('0x33')]=_[_0x76aa('0x32')](_0x5e8cec[_0x76aa('0x33')]);_0x17bd1a['filters']=_[_0x76aa('0x35')](_0x17bd1a[_0x76aa('0x31')],_0x17bd1a[_0x76aa('0x33')]);_0x58932f[_0x76aa('0x34')]=_[_0x76aa('0x35')](_0x17bd1a[_0x76aa('0x31')],qs[_0x76aa('0x36')](_0x5e8cec[_0x76aa('0x33')][_0x76aa('0x36')]));_0x58932f[_0x76aa('0x34')]=_0x58932f[_0x76aa('0x34')][_0x76aa('0x37')]?_0x58932f['attributes']:_0x17bd1a['model'];_0x58932f[_0x76aa('0x4e')]=qs[_0x76aa('0x4f')](_0x5e8cec[_0x76aa('0x33')][_0x76aa('0x4f')]);_0x58932f[_0x76aa('0x2d')]=qs[_0x76aa('0x4c')](_[_0x76aa('0x50')](_0x5e8cec[_0x76aa('0x33')],_0x17bd1a[_0x76aa('0x4c')]));if(_0x5e8cec[_0x76aa('0x33')][_0x76aa('0x52')]){_0x58932f['where']=_[_0x76aa('0x39')](_0x58932f['where'],{'$or':_[_0x76aa('0x1e')](_0x58932f[_0x76aa('0x34')],function(_0x278bac){var _0x14256c={};_0x14256c[_0x278bac]={'$like':'%'+_0x5e8cec[_0x76aa('0x33')]['filter']+'%'};return _0x14256c;})});}_0x58932f=_['merge']({},_0x58932f,_0x5e8cec[_0x76aa('0x3a')]);return _0x5d7a2b['getLists'](_0x58932f);}})[_0x76aa('0x17')](function(_0xb760ca){if(_0xb760ca){_0x363c45=_0xb760ca[_0x76aa('0x37')];if(!_0x5e8cec[_0x76aa('0x33')][_0x76aa('0x58')]('nolimit')){_0x58932f['limit']=qs[_0x76aa('0x12')](_0x5e8cec[_0x76aa('0x33')][_0x76aa('0x12')]);_0x58932f[_0x76aa('0x14')]=qs[_0x76aa('0x14')](_0x5e8cec[_0x76aa('0x33')][_0x76aa('0x14')]);}return _0x5d7a2b[_0x76aa('0x8a')](_0x58932f);}})[_0x76aa('0x17')](function(_0x33644d){if(_0x33644d){return _0x33644d?{'count':_0x363c45,'rows':_0x33644d}:null;}})['then'](respondWithResult(_0x1a37e9,null))[_0x76aa('0x3b')](handleError(_0x1a37e9,null));};exports[_0x76aa('0x8b')]=function(_0x4830ea,_0x20638f){var _0x2b2f27=moment()[_0x76aa('0x6e')](_0x76aa('0x8c'));var _0x1a5297,_0x487c28;return db[_0x76aa('0x29')]['find']({'where':{'id':_0x4830ea[_0x76aa('0x46')]['id']}})[_0x76aa('0x17')](handleEntityNotFound(_0x20638f,null))[_0x76aa('0x17')](function(_0x2f2a27){if(_0x2f2a27){_0x487c28=_0x2f2a27;return _0x2f2a27['addLists'](_0x4830ea[_0x76aa('0x3d')][_0x76aa('0x73')],_[_0x76aa('0x47')](_0x4830ea[_0x76aa('0x3d')],[_0x76aa('0x73'),'id'])||{});}return null;})[_0x76aa('0x84')](function(_0xca12fa){var _0xb0a4e1;_0x1a5297=_0xca12fa||[];var _0x1f7f1d=[];if(_0xca12fa){for(var _0x413528=0x0;_0x413528<_0xca12fa[_0x76aa('0x37')];_0x413528+=0x1){var _0x39de41=_0xca12fa[_0x413528][_0x76aa('0x18')]({'plain':!![]});_0x487c28[_0x76aa('0x8d')]=_0x4830ea['body']['dialCheckDuplicateType']?_0x4830ea[_0x76aa('0x3d')][_0x76aa('0x8d')]:_0x487c28['dialCheckDuplicateType'];switch(_0x487c28[_0x76aa('0x8d')]){case'always':_0xb0a4e1=squel[_0x76aa('0x8e')]()[_0x76aa('0x8f')](_0x76aa('0x90'))[_0x76aa('0x91')]([_0x76aa('0x92'),_0x76aa('0x93'),_0x76aa('0x94'),_0x76aa('0x95'),'VoiceQueueId',_0x76aa('0x49'),_0x76aa('0x48')],squel['select']()['field'](_0x76aa('0x92'),_0x76aa('0x92'))[_0x76aa('0x74')]('\x27'+_0x2b2f27+'\x27',_0x76aa('0x93'))[_0x76aa('0x74')]('id','ContactId')[_0x76aa('0x74')](_0x39de41['CmListId'][_0x76aa('0x96')](),_0x76aa('0x95'))[_0x76aa('0x74')](_0x4830ea[_0x76aa('0x46')]['id'][_0x76aa('0x96')](),_0x76aa('0x51'))[_0x76aa('0x74')]('\x27'+_0x2b2f27+'\x27',_0x76aa('0x49'))[_0x76aa('0x74')]('\x27'+_0x2b2f27+'\x27',_0x76aa('0x48'))[_0x76aa('0x76')](_0x76aa('0x97'))[_0x76aa('0x2d')]('deletedAt\x20IS\x20NULL')[_0x76aa('0x2d')]('ListId\x20=\x20?',_0x39de41['CmListId']['toString']())[_0x76aa('0x2d')]('phone\x20IS\x20NOT\x20NULL')['where']('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x76aa('0x74')](_0x76aa('0x98'))['from'](_0x76aa('0x99'))[_0x76aa('0x2d')](_0x76aa('0x7a'),_0x4830ea['params']['id']['toString']()))['where'](_0x76aa('0x9a'),squel['select']()[_0x76aa('0x74')](_0x76aa('0x9b'))['from'](_0x76aa('0x90'))[_0x76aa('0x2d')]('VoiceQueueId\x20=\x20?',_0x4830ea[_0x76aa('0x46')]['id'][_0x76aa('0x96')]())))[_0x76aa('0x96')]();break;case _0x76aa('0x9c'):_0xb0a4e1=squel[_0x76aa('0x8e')]()[_0x76aa('0x8f')](_0x76aa('0x90'))[_0x76aa('0x91')](['phone',_0x76aa('0x93'),_0x76aa('0x94'),_0x76aa('0x95'),_0x76aa('0x51'),_0x76aa('0x49'),_0x76aa('0x48')],squel[_0x76aa('0x9d')]()[_0x76aa('0x74')](_0x76aa('0x92'),_0x76aa('0x92'))['field']('\x27'+_0x2b2f27+'\x27',_0x76aa('0x93'))[_0x76aa('0x74')]('id',_0x76aa('0x94'))['field'](_0x39de41['CmListId']['toString'](),_0x76aa('0x95'))[_0x76aa('0x74')](_0x4830ea['params']['id'][_0x76aa('0x96')](),'VoiceQueueId')['field']('\x27'+_0x2b2f27+'\x27',_0x76aa('0x49'))[_0x76aa('0x74')]('\x27'+_0x2b2f27+'\x27','updatedAt')[_0x76aa('0x76')](_0x76aa('0x97'))[_0x76aa('0x2d')]('deletedAt\x20IS\x20NULL')[_0x76aa('0x2d')](_0x76aa('0x9e'),_0x39de41[_0x76aa('0x9f')][_0x76aa('0x96')]())[_0x76aa('0x2d')](_0x76aa('0xa0'))[_0x76aa('0x2d')](_0x76aa('0x9a'),squel[_0x76aa('0x9d')]()[_0x76aa('0x74')](_0x76aa('0x9b'))['from'](_0x76aa('0x90'))[_0x76aa('0x2d')](_0x76aa('0x7a'),_0x4830ea['params']['id']['toString']())))[_0x76aa('0x96')]();break;default:_0xb0a4e1=squel[_0x76aa('0x8e')]()[_0x76aa('0x8f')]('cm_hopper')[_0x76aa('0x91')]([_0x76aa('0x92'),_0x76aa('0x93'),_0x76aa('0x94'),_0x76aa('0x95'),_0x76aa('0x51'),_0x76aa('0x49'),_0x76aa('0x48')],squel[_0x76aa('0x9d')]()[_0x76aa('0x74')](_0x76aa('0x92'),_0x76aa('0x92'))[_0x76aa('0x74')]('\x27'+_0x2b2f27+'\x27',_0x76aa('0x93'))['field']('id',_0x76aa('0x94'))['field'](_0x39de41[_0x76aa('0x9f')]['toString'](),_0x76aa('0x95'))[_0x76aa('0x74')](_0x4830ea[_0x76aa('0x46')]['id']['toString'](),_0x76aa('0x51'))[_0x76aa('0x74')]('\x27'+_0x2b2f27+'\x27',_0x76aa('0x49'))[_0x76aa('0x74')]('\x27'+_0x2b2f27+'\x27',_0x76aa('0x48'))[_0x76aa('0x76')]('cm_contacts')['where'](_0x76aa('0xa1'))[_0x76aa('0x2d')](_0x76aa('0x9e'),_0x39de41['CmListId']['toString']())[_0x76aa('0x2d')](_0x76aa('0xa0')))[_0x76aa('0x96')]();}_0x1f7f1d['push'](db['sequelize'][_0x76aa('0x33')](_0xb0a4e1));}return BPromise[_0x76aa('0x85')](_0x1f7f1d);}})[_0x76aa('0x17')](function(){var _0xbb19e4=[];var _0x226b44=squel[_0x76aa('0x8e')]()[_0x76aa('0x8f')](_0x76aa('0xa2'))['fromQuery']([_0x76aa('0xa3'),_0x76aa('0x92'),_0x76aa('0xa4'),'createdAt',_0x76aa('0x48')],squel[_0x76aa('0x9d')]()[_0x76aa('0x74')]('h.id')['field'](_0x76aa('0xa5'))['field'](_0x76aa('0xa6'))[_0x76aa('0x74')]('\x27'+_0x2b2f27+'\x27',_0x76aa('0x49'))[_0x76aa('0x74')]('\x27'+_0x2b2f27+'\x27','updatedAt')['from'](_0x76aa('0xa7'),'ci')[_0x76aa('0x78')](_0x76aa('0x90'),'h',_0x76aa('0xa8'))[_0x76aa('0x2d')](_0x76aa('0xa9'),_0x2b2f27)['where'](_0x76aa('0xaa'),_0x76aa('0xab')))[_0x76aa('0x96')]();_0xbb19e4['push'](db[_0x76aa('0x66')][_0x76aa('0x33')](_0x226b44));return BPromise[_0x76aa('0x85')](_0xbb19e4);})['then'](function(){return _0x1a5297;})[_0x76aa('0x17')](respondWithResult(_0x20638f,null))['catch'](handleError(_0x20638f,null));};exports['removeLists']=function(_0xef9ea7,_0x45f21f){return db[_0x76aa('0x29')]['find']({'where':{'id':_0xef9ea7[_0x76aa('0x46')]['id']}})['then'](handleEntityNotFound(_0x45f21f,null))[_0x76aa('0x17')](function(_0x113e70){if(_0x113e70){return _0x113e70['removeLists'](_0xef9ea7[_0x76aa('0x33')]['ids']);}})['then'](function(_0x583d68){if(_0x583d68){return db[_0x76aa('0x53')]['destroy']({'where':{'ListId':_0xef9ea7[_0x76aa('0x33')]['ids'],'VoiceQueueId':_0xef9ea7['params']['id']}})[_0x76aa('0x17')](function(){return _0x583d68;});}})['then'](respondWithStatusCode(_0x45f21f,null))['catch'](handleError(_0x45f21f,null));};exports[_0x76aa('0xac')]=function(_0x3b7370,_0x1c3431){var _0x865a1b={};var _0x132d60={};var _0x1a3074;var _0x3184a2;return db['VoiceQueue']['findOne']({'where':{'id':_0x3b7370[_0x76aa('0x46')]['id']}})[_0x76aa('0x17')](handleEntityNotFound(_0x1c3431,null))[_0x76aa('0x17')](function(_0x274356){if(_0x274356){_0x1a3074=_0x274356;_0x132d60[_0x76aa('0x31')]=_[_0x76aa('0x32')](db[_0x76aa('0xad')][_0x76aa('0x2a')]);_0x132d60[_0x76aa('0x33')]=_['keys'](_0x3b7370['query']);_0x132d60[_0x76aa('0x4c')]=_[_0x76aa('0x35')](_0x132d60[_0x76aa('0x31')],_0x132d60[_0x76aa('0x33')]);_0x865a1b['attributes']=_['intersection'](_0x132d60[_0x76aa('0x31')],qs['fields'](_0x3b7370[_0x76aa('0x33')][_0x76aa('0x36')]));_0x865a1b['attributes']=_0x865a1b[_0x76aa('0x34')][_0x76aa('0x37')]?_0x865a1b[_0x76aa('0x34')]:_0x132d60[_0x76aa('0x31')];_0x865a1b[_0x76aa('0x4e')]=qs['sort'](_0x3b7370[_0x76aa('0x33')][_0x76aa('0x4f')]);_0x865a1b['where']=qs['filters'](_[_0x76aa('0x50')](_0x3b7370[_0x76aa('0x33')],_0x132d60[_0x76aa('0x4c')]));if(_0x3b7370[_0x76aa('0x33')][_0x76aa('0x52')]){_0x865a1b[_0x76aa('0x2d')]=_[_0x76aa('0x39')](_0x865a1b[_0x76aa('0x2d')],{'$or':_[_0x76aa('0x1e')](_0x865a1b[_0x76aa('0x34')],function(_0xbb0ea3){var _0x4978dd={};_0x4978dd[_0xbb0ea3]={'$like':'%'+_0x3b7370[_0x76aa('0x33')][_0x76aa('0x52')]+'%'};return _0x4978dd;})});}_0x865a1b=_[_0x76aa('0x39')]({},_0x865a1b,_0x3b7370[_0x76aa('0x3a')]);return _0x1a3074['getBlackLists'](_0x865a1b);}})['then'](function(_0x4ee1d3){if(_0x4ee1d3){_0x3184a2=_0x4ee1d3['length'];if(!_0x3b7370[_0x76aa('0x33')][_0x76aa('0x58')](_0x76aa('0x4d'))){_0x865a1b[_0x76aa('0x12')]=qs[_0x76aa('0x12')](_0x3b7370[_0x76aa('0x33')][_0x76aa('0x12')]);_0x865a1b['offset']=qs['offset'](_0x3b7370[_0x76aa('0x33')]['offset']);}return _0x1a3074[_0x76aa('0xac')](_0x865a1b);}})[_0x76aa('0x17')](function(_0x3bc149){if(_0x3bc149){return _0x3bc149?{'count':_0x3184a2,'rows':_0x3bc149}:null;}})['then'](respondWithResult(_0x1c3431,null))[_0x76aa('0x3b')](handleError(_0x1c3431,null));};exports[_0x76aa('0xae')]=function(_0x29e112,_0x3fd683){var _0x5c2c4d;return db[_0x76aa('0x29')][_0x76aa('0x22')]({'where':{'id':_0x29e112[_0x76aa('0x46')]['id']}})['then'](handleEntityNotFound(_0x3fd683,null))[_0x76aa('0x17')](function(_0xcb041d){if(_0xcb041d){return _0xcb041d[_0x76aa('0xae')](_0x29e112[_0x76aa('0x3d')][_0x76aa('0x73')],_[_0x76aa('0x47')](_0x29e112[_0x76aa('0x3d')],['ids','id'])||{});}return null;})['spread'](function(_0x72b9a){var _0x29db0f;_0x5c2c4d=_0x72b9a||[];var _0x28a212=[];if(_0x72b9a){for(var _0x242cd6=0x0;_0x242cd6<_0x72b9a[_0x76aa('0x37')];_0x242cd6+=0x1){var _0xeb428a=_0x72b9a[_0x242cd6][_0x76aa('0x18')]({'plain':!![]});_0x29db0f=squel[_0x76aa('0x8e')]()[_0x76aa('0x8f')](_0x76aa('0xaf'))[_0x76aa('0x91')]([_0x76aa('0x92'),_0x76aa('0x94'),_0x76aa('0x95'),_0x76aa('0x51'),_0x76aa('0x49'),_0x76aa('0x48')],squel[_0x76aa('0x9d')]()[_0x76aa('0x74')](_0x76aa('0x92'),_0x76aa('0x92'))[_0x76aa('0x74')]('id',_0x76aa('0x94'))[_0x76aa('0x74')](_0xeb428a[_0x76aa('0x9f')][_0x76aa('0x96')](),_0x76aa('0x95'))[_0x76aa('0x74')](_0x29e112['params']['id'][_0x76aa('0x96')](),_0x76aa('0x51'))[_0x76aa('0x74')](_0x76aa('0xb0'),'createdAt')[_0x76aa('0x74')](_0x76aa('0xb0'),_0x76aa('0x48'))['from'](_0x76aa('0x97'))[_0x76aa('0x2d')]('deletedAt\x20IS\x20NULL')[_0x76aa('0x2d')]('ListId\x20=\x20?',_0xeb428a[_0x76aa('0x9f')][_0x76aa('0x96')]())[_0x76aa('0x2d')](_0x76aa('0xa0')))['toString']();_0x28a212[_0x76aa('0x7c')](db['sequelize'][_0x76aa('0x33')](_0x29db0f));}return BPromise['all'](_0x28a212);}})[_0x76aa('0x17')](function(){return _0x5c2c4d;})['then'](respondWithResult(_0x3fd683,null))[_0x76aa('0x3b')](handleError(_0x3fd683,null));};exports[_0x76aa('0xb1')]=function(_0x140ee1,_0x3d9e9e){return db[_0x76aa('0x29')][_0x76aa('0x22')]({'where':{'id':_0x140ee1['params']['id']}})[_0x76aa('0x17')](handleEntityNotFound(_0x3d9e9e,null))[_0x76aa('0x17')](function(_0x139e67){if(_0x139e67){return _0x139e67[_0x76aa('0xb1')](_0x140ee1['query'][_0x76aa('0x73')]);}})[_0x76aa('0x17')](function(_0x506cad){if(_0x506cad){return db['CmHopperBlack'][_0x76aa('0x25')]({'where':{'ListId':_0x140ee1[_0x76aa('0x33')][_0x76aa('0x73')],'VoiceQueueId':_0x140ee1[_0x76aa('0x46')]['id']}})['then'](function(){return _0x506cad;});}})['then'](respondWithStatusCode(_0x3d9e9e,null))[_0x76aa('0x3b')](handleError(_0x3d9e9e,null));}; \ No newline at end of file +var _0xf3cd=['CmHopperFinal','nolimit','getHopperBlacks','CmHopperBlack','getTeams','addTeams','User','online','flatMap','Agents','penalty','transaction','each','TeamVoiceQueue','findOrCreate','UserVoiceQueueRt','upsert','isNil','interface','SIP/%s','voicePause','forEach','emit','removeTeams','Team','ids','select','field','from','team_has_voice_queues','join','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','sequelize','QueryTypes','all','union','removeAgents','userVoiceQueue:remove','addAgents','spread','isEmpty','getAgents','getMembers','getLists','CmList','format','YYYY-MM-DD\x20HH:mm:ss','addLists','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','scheduledAt','ContactId','ListId','phone','CmListId','toString','cm_contacts','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','cm_hopper_final','COALESCE(phone,\x27\x27)','onlyIfOpen','phone\x20NOT\x20IN\x20(?)','ListId\x20=\x20?','cm_hopper_additional_phones','CmHopperId','OrderBy','h.id','ci.OrderBy+1','cm_contact_has_items','h.scheduledat=?','ci.ItemClass=?','PHONE','removeLists','getBlackLists','addBlackLists','cm_hopper_black','NOW()','removeBlackLists','moment','bluebird','util','lodash','squel','ioredis','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','register','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','get','VoiceQueues','inbound','QueueCampaigns','filter','map','value','includes','type','name','UserProfileResource','VoiceQueue','fieldName','key','where','include','query','findAll','rows','catch','params','keys','filters','intersection','attributes','model','fields','length','includeAll','options','find','create','body','user','role','outbound','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','rawAttributes','merge','omit','updatedAt','createdAt','getHoppers','findOne','hasOwnProperty','order','sort','pick','VoiceQueueId','CmHopper','getHopperHistories','CmHopperHistory','getHopperFinals'];(function(_0x48bbff,_0x1d1360){var _0x4f85a3=function(_0x17286c){while(--_0x17286c){_0x48bbff['push'](_0x48bbff['shift']());}};_0x4f85a3(++_0x1d1360);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x42ab91,_0x2a0179){_0x42ab91=_0x42ab91-0x0;var _0x259d35=_0xf3cd[_0x42ab91];return _0x259d35;};'use strict';var moment=require(_0xdf3c('0x0'));var BPromise=require(_0xdf3c('0x1'));var util=require(_0xdf3c('0x2'));var _=require(_0xdf3c('0x3'));var squel=require(_0xdf3c('0x4'));var Redis=require(_0xdf3c('0x5'));var qs=require('../../components/parsers/qs');var logger=require(_0xdf3c('0x6'))(_0xdf3c('0x7'));var config=require(_0xdf3c('0x8'));var db=require('../../mysqldb')['db'];config[_0xdf3c('0x9')]=_[_0xdf3c('0xa')](config[_0xdf3c('0x9')],{'host':_0xdf3c('0xb'),'port':0x18eb});var socket=require(_0xdf3c('0xc'))(new Redis(config[_0xdf3c('0x9')]));require('./voiceQueue.socket')[_0xdf3c('0xd')](socket);function respondWithStatusCode(_0x52cf30,_0x52f855){_0x52f855=_0x52f855||0xcc;return function(_0x22d8ae){if(_0x22d8ae){return _0x52cf30[_0xdf3c('0xe')](_0x52f855);}return _0x52cf30['status'](_0x52f855)[_0xdf3c('0xf')]();};}function respondWithResult(_0x205f33,_0x2d420c){_0x2d420c=_0x2d420c||0xc8;return function(_0x21a6e5){if(_0x21a6e5){return _0x205f33[_0xdf3c('0x10')](_0x2d420c)[_0xdf3c('0x11')](_0x21a6e5);}};}function respondWithFilteredResult(_0xf7da9d,_0x32d2db){return function(_0x5e8925){if(_0x5e8925){var _0x1d483c=typeof _0x32d2db[_0xdf3c('0x12')]===_0xdf3c('0x13')&&typeof _0x32d2db[_0xdf3c('0x14')]==='undefined';var _0x2ae4ad=_0x5e8925[_0xdf3c('0x15')];var _0x13ea5f=_0x1d483c?0x0:_0x32d2db['offset'];var _0x18aafa=_0x1d483c?_0x5e8925[_0xdf3c('0x15')]:_0x32d2db[_0xdf3c('0x12')]+_0x32d2db[_0xdf3c('0x14')];var _0x21e587;if(_0x18aafa>=_0x2ae4ad){_0x18aafa=_0x2ae4ad;_0x21e587=0xc8;}else{_0x21e587=0xce;}_0xf7da9d[_0xdf3c('0x10')](_0x21e587);return _0xf7da9d[_0xdf3c('0x16')](_0xdf3c('0x17'),_0x13ea5f+'-'+_0x18aafa+'/'+_0x2ae4ad)[_0xdf3c('0x11')](_0x5e8925);}return null;};}function saveUpdates(_0x5d3991){return function(_0x54cdd4){if(_0x54cdd4){return _0x54cdd4[_0xdf3c('0x18')](_0x5d3991)[_0xdf3c('0x19')](function(_0xf1da1f){return _0xf1da1f;});}return null;};}function removeEntity(_0x18d4ec){return function(_0x1e2690){if(_0x1e2690){return _0x1e2690[_0xdf3c('0x1a')]()[_0xdf3c('0x19')](function(){var _0x3ee0af=_0x1e2690[_0xdf3c('0x1b')]({'plain':!![]});var _0x18fb5f=[{'name':_0xdf3c('0x1c'),'value':_0xdf3c('0x1d'),'ignore':![]},{'name':_0xdf3c('0x1e'),'value':'outbound','ignore':![]}];var _0x4d620f=_(_0x18fb5f)[_0xdf3c('0x1f')]('ignore')[_0xdf3c('0x20')](_0xdf3c('0x21'))[_0xdf3c('0x21')]();if(_[_0xdf3c('0x22')](_0x4d620f,_0x3ee0af[_0xdf3c('0x23')])){return;}var _0x36ba1c=_['find'](_0x18fb5f,[_0xdf3c('0x21'),_0x3ee0af[_0xdf3c('0x23')]])[_0xdf3c('0x24')];return db[_0xdf3c('0x25')][_0xdf3c('0x1a')]({'where':{'type':_0x36ba1c,'resourceId':_0x3ee0af['id']}})[_0xdf3c('0x19')](function(){return _0x1e2690;});})[_0xdf3c('0x19')](function(){_0x18d4ec[_0xdf3c('0x10')](0xcc)[_0xdf3c('0xf')]();});}};}function handleEntityNotFound(_0x1adee4){return function(_0x4c076c){if(!_0x4c076c){_0x1adee4[_0xdf3c('0xe')](0x194);}return _0x4c076c;};}function handleError(_0x153daa,_0x4b57a4){_0x4b57a4=_0x4b57a4||0x1f4;return function(_0xdc8962){logger['error'](_0xdc8962['stack']);if(_0xdc8962['name']){delete _0xdc8962[_0xdf3c('0x24')];}_0x153daa[_0xdf3c('0x10')](_0x4b57a4)['send'](_0xdc8962);};}exports['index']=function(_0x37ecfd,_0x1f2ce4){var _0xd3cfcb={};var _0x1ccdd4={'count':0x0,'rows':[]};var _0x5c98a2=_[_0xdf3c('0x20')](db[_0xdf3c('0x26')]['rawAttributes'],function(_0x51e0a4){return{'name':_0x51e0a4[_0xdf3c('0x27')],'type':_0x51e0a4[_0xdf3c('0x23')][_0xdf3c('0x28')]};});_0xd3cfcb=qs['getOptions'](_0x5c98a2,_0x37ecfd);var _0x2355f6={'where':_0xd3cfcb[_0xdf3c('0x29')]};return db[_0xdf3c('0x26')][_0xdf3c('0x15')](_0x2355f6)['then'](function(_0xda0de0){_0x1ccdd4[_0xdf3c('0x15')]=_0xda0de0;_0xd3cfcb['include']=qs[_0xdf3c('0x2a')](_0x37ecfd[_0xdf3c('0x2b')]);return db[_0xdf3c('0x26')][_0xdf3c('0x2c')](_0xd3cfcb);})['then'](function(_0x33632f){_0x1ccdd4[_0xdf3c('0x2d')]=_0x33632f;return _0x1ccdd4;})[_0xdf3c('0x19')](respondWithFilteredResult(_0x1f2ce4,_0xd3cfcb))[_0xdf3c('0x2e')](handleError(_0x1f2ce4,null));};exports['show']=function(_0x474564,_0x3e7a4b){var _0x5ddd21={'raw':![],'where':{'id':_0x474564[_0xdf3c('0x2f')]['id']}},_0x4f68f9={};_0x4f68f9['model']=_[_0xdf3c('0x30')](db['VoiceQueue']['rawAttributes']);_0x4f68f9['query']=_[_0xdf3c('0x30')](_0x474564[_0xdf3c('0x2b')]);_0x4f68f9[_0xdf3c('0x31')]=_[_0xdf3c('0x32')](_0x4f68f9['model'],_0x4f68f9['query']);_0x5ddd21[_0xdf3c('0x33')]=_['intersection'](_0x4f68f9[_0xdf3c('0x34')],qs[_0xdf3c('0x35')](_0x474564[_0xdf3c('0x2b')][_0xdf3c('0x35')]));_0x5ddd21[_0xdf3c('0x33')]=_0x5ddd21[_0xdf3c('0x33')][_0xdf3c('0x36')]?_0x5ddd21[_0xdf3c('0x33')]:_0x4f68f9[_0xdf3c('0x34')];if(_0x474564['query'][_0xdf3c('0x37')]){_0x5ddd21['include']=[{'all':!![]}];}_0x5ddd21=_['merge']({},_0x5ddd21,_0x474564[_0xdf3c('0x38')]);return db['VoiceQueue'][_0xdf3c('0x39')](_0x5ddd21)['then'](handleEntityNotFound(_0x3e7a4b,null))[_0xdf3c('0x19')](respondWithResult(_0x3e7a4b,null))[_0xdf3c('0x2e')](handleError(_0x3e7a4b,null));};exports[_0xdf3c('0x3a')]=function(_0x1349a4,_0x3098cb){return db[_0xdf3c('0x26')][_0xdf3c('0x3a')](_0x1349a4[_0xdf3c('0x3b')],{})[_0xdf3c('0x19')](function(_0xa65478){var _0x424acf=_0x1349a4[_0xdf3c('0x3c')]['get']({'plain':!![]});if(!_0x424acf)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x424acf[_0xdf3c('0x3d')]==='user'){var _0x3a6527=_0xa65478[_0xdf3c('0x1b')]({'plain':!![]});var _0x46194d=[{'name':_0xdf3c('0x1c'),'value':'inbound'},{'name':'QueueCampaigns','value':_0xdf3c('0x3e')}];var _0x33edab=_[_0xdf3c('0x39')](_0x46194d,['value',_0x3a6527[_0xdf3c('0x23')]])[_0xdf3c('0x24')];return db[_0xdf3c('0x3f')][_0xdf3c('0x39')]({'where':{'name':_0x33edab,'userProfileId':_0x424acf['userProfileId']},'raw':!![]})[_0xdf3c('0x19')](function(_0x3e9be9){if(_0x3e9be9&&_0x3e9be9[_0xdf3c('0x40')]===0x0){return db[_0xdf3c('0x25')][_0xdf3c('0x3a')]({'name':_0x3a6527['name'],'resourceId':_0x3a6527['id'],'type':_0x3e9be9[_0xdf3c('0x24')],'sectionId':_0x3e9be9['id']},{})[_0xdf3c('0x19')](function(){return _0xa65478;});}else{return _0xa65478;}})[_0xdf3c('0x2e')](function(_0x2456cf){logger[_0xdf3c('0x41')](_0xdf3c('0x42'),_0x2456cf);throw _0x2456cf;});}return _0xa65478;})['then'](respondWithResult(_0x3098cb,0xc9))['catch'](handleError(_0x3098cb,null));};exports[_0xdf3c('0x43')]=function(_0x2be86d,_0x5a4443){var _0x5c9885={'where':{'id':_0x2be86d[_0xdf3c('0x2f')]['id']}},_0x269723={};_0x269723[_0xdf3c('0x34')]=_[_0xdf3c('0x30')](db[_0xdf3c('0x26')][_0xdf3c('0x44')]);_0x5c9885[_0xdf3c('0x33')]=_[_0xdf3c('0x32')](_0x269723[_0xdf3c('0x34')],qs['fields'](_0x2be86d[_0xdf3c('0x2b')][_0xdf3c('0x35')]));_0x5c9885[_0xdf3c('0x33')]=_0x5c9885[_0xdf3c('0x33')][_0xdf3c('0x36')]?_0x5c9885[_0xdf3c('0x33')]:_0x269723[_0xdf3c('0x34')];if(_0x2be86d['query'][_0xdf3c('0x37')]){_0x5c9885['include']=[{'all':!![]}];}_0x5c9885=_[_0xdf3c('0x45')]({},_0x5c9885,_0x2be86d['options']);return db[_0xdf3c('0x26')][_0xdf3c('0x39')](_0x5c9885)[_0xdf3c('0x19')](handleEntityNotFound(_0x5a4443,null))[_0xdf3c('0x19')](function(_0x5eef94){if(_0x5eef94){var _0x55da0f=_0x5eef94['get']({'plain':!![]});_0x55da0f=qs[_0xdf3c('0x46')](_0x55da0f,['id','createdAt',_0xdf3c('0x47')]);_0x2be86d[_0xdf3c('0x3b')]=_[_0xdf3c('0x46')](_0x2be86d[_0xdf3c('0x3b')],['id',_0xdf3c('0x48'),'updatedAt']);return db['VoiceQueue'][_0xdf3c('0x3a')](_[_0xdf3c('0x45')](_0x55da0f,_0x2be86d['body']),{'include':_0x2be86d[_0xdf3c('0x2b')][_0xdf3c('0x37')]?[{'all':!![]}]:undefined})[_0xdf3c('0x19')](function(_0x3fda0a){var _0x38de63=_0x2be86d[_0xdf3c('0x3c')][_0xdf3c('0x1b')]({'plain':!![]});if(!_0x38de63)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x38de63['role']===_0xdf3c('0x3c')){var _0x28030e=_0x3fda0a[_0xdf3c('0x1b')]({'plain':!![]});var _0x1ad771=[{'name':_0xdf3c('0x1c'),'value':_0xdf3c('0x1d')},{'name':_0xdf3c('0x1e'),'value':_0xdf3c('0x3e')}];var _0x143d01=_[_0xdf3c('0x39')](_0x1ad771,[_0xdf3c('0x21'),_0x28030e['type']])[_0xdf3c('0x24')];return db['UserProfileSection']['find']({'where':{'name':_0x143d01,'userProfileId':_0x38de63['userProfileId']},'raw':!![]})['then'](function(_0x541c57){if(_0x541c57&&_0x541c57[_0xdf3c('0x40')]===0x0){return db[_0xdf3c('0x25')]['create']({'name':_0x28030e[_0xdf3c('0x24')],'resourceId':_0x28030e['id'],'type':_0x541c57[_0xdf3c('0x24')],'sectionId':_0x541c57['id']},{})['then'](function(){return _0x3fda0a;});}else{return _0x3fda0a;}})[_0xdf3c('0x2e')](function(_0x28f935){logger[_0xdf3c('0x41')](_0xdf3c('0x42'),_0x28f935);throw _0x28f935;});}return _0x3fda0a;});}})[_0xdf3c('0x19')](respondWithResult(_0x5a4443,0xc9))[_0xdf3c('0x2e')](handleError(_0x5a4443,null));};exports[_0xdf3c('0x18')]=function(_0xdc859,_0x42efa2){if(_0xdc859[_0xdf3c('0x3b')]['id']){delete _0xdc859[_0xdf3c('0x3b')]['id'];}return db['VoiceQueue'][_0xdf3c('0x39')]({'where':{'id':_0xdc859[_0xdf3c('0x2f')]['id']}})[_0xdf3c('0x19')](handleEntityNotFound(_0x42efa2,null))['then'](saveUpdates(_0xdc859[_0xdf3c('0x3b')],null))[_0xdf3c('0x19')](respondWithResult(_0x42efa2,null))[_0xdf3c('0x2e')](handleError(_0x42efa2,null));};exports['destroy']=function(_0x1effdb,_0x13bf69){return db['VoiceQueue'][_0xdf3c('0x39')]({'where':{'id':_0x1effdb['params']['id']}})[_0xdf3c('0x19')](handleEntityNotFound(_0x13bf69,null))[_0xdf3c('0x19')](removeEntity(_0x13bf69,null))[_0xdf3c('0x2e')](handleError(_0x13bf69,null));};exports[_0xdf3c('0x49')]=function(_0xed2a78,_0x30e6e1){var _0x3fca95={'raw':![],'where':{}};var _0x2a1559={};var _0x2922d8={'count':0x0,'rows':[]};return db[_0xdf3c('0x26')][_0xdf3c('0x4a')]({'where':{'id':_0xed2a78[_0xdf3c('0x2f')]['id']}})[_0xdf3c('0x19')](handleEntityNotFound(_0x30e6e1,null))[_0xdf3c('0x19')](function(_0x204110){if(_0x204110){_0x2a1559[_0xdf3c('0x34')]=_[_0xdf3c('0x30')](db['CmHopper']['rawAttributes']);_0x2a1559[_0xdf3c('0x2b')]=_[_0xdf3c('0x30')](_0xed2a78[_0xdf3c('0x2b')]);_0x2a1559['filters']=_[_0xdf3c('0x32')](_0x2a1559['model'],_0x2a1559['query']);_0x3fca95[_0xdf3c('0x33')]=_[_0xdf3c('0x32')](_0x2a1559[_0xdf3c('0x34')],qs[_0xdf3c('0x35')](_0xed2a78[_0xdf3c('0x2b')][_0xdf3c('0x35')]));_0x3fca95[_0xdf3c('0x33')]=_0x3fca95[_0xdf3c('0x33')][_0xdf3c('0x36')]?_0x3fca95[_0xdf3c('0x33')]:_0x2a1559[_0xdf3c('0x34')];if(!_0xed2a78[_0xdf3c('0x2b')][_0xdf3c('0x4b')]('nolimit')){_0x3fca95[_0xdf3c('0x14')]=qs[_0xdf3c('0x14')](_0xed2a78[_0xdf3c('0x2b')][_0xdf3c('0x14')]);_0x3fca95[_0xdf3c('0x12')]=qs['offset'](_0xed2a78[_0xdf3c('0x2b')][_0xdf3c('0x12')]);}_0x3fca95[_0xdf3c('0x4c')]=qs[_0xdf3c('0x4d')](_0xed2a78[_0xdf3c('0x2b')][_0xdf3c('0x4d')]);_0x3fca95[_0xdf3c('0x29')]=qs[_0xdf3c('0x31')](_[_0xdf3c('0x4e')](_0xed2a78[_0xdf3c('0x2b')],_0x2a1559['filters']));_0x3fca95[_0xdf3c('0x29')][_0xdf3c('0x4f')]=_0x204110['id'];if(_0xed2a78[_0xdf3c('0x2b')][_0xdf3c('0x1f')]){_0x3fca95[_0xdf3c('0x29')]=_[_0xdf3c('0x45')](_0x3fca95[_0xdf3c('0x29')],{'$or':_['map'](_0x3fca95[_0xdf3c('0x33')],function(_0x662fd5){var _0x4e1b77={};_0x4e1b77[_0x662fd5]={'$like':'%'+_0xed2a78['query'][_0xdf3c('0x1f')]+'%'};return _0x4e1b77;})});}_0x3fca95=_[_0xdf3c('0x45')]({},_0x3fca95,_0xed2a78[_0xdf3c('0x38')]);return db[_0xdf3c('0x50')][_0xdf3c('0x15')]({'where':_0x3fca95[_0xdf3c('0x29')]})[_0xdf3c('0x19')](function(_0x38af90){_0x2922d8['count']=_0x38af90;if(_0xed2a78[_0xdf3c('0x2b')][_0xdf3c('0x37')]){_0x3fca95[_0xdf3c('0x2a')]=[{'all':!![]}];}return db['CmHopper'][_0xdf3c('0x2c')](_0x3fca95);})[_0xdf3c('0x19')](function(_0x43d299){_0x2922d8['rows']=_0x43d299;return _0x2922d8;});}})[_0xdf3c('0x19')](respondWithFilteredResult(_0x30e6e1,_0x3fca95))[_0xdf3c('0x2e')](handleError(_0x30e6e1,null));};exports[_0xdf3c('0x51')]=function(_0x1b279f,_0xe01538){var _0x12f737={'raw':!![],'where':{}};var _0x560348={};var _0x50753f={'count':0x0,'rows':[]};return db['VoiceQueue']['findOne']({'where':{'id':_0x1b279f['params']['id']}})[_0xdf3c('0x19')](handleEntityNotFound(_0xe01538,null))[_0xdf3c('0x19')](function(_0xf66fae){if(_0xf66fae){_0x560348['model']=_[_0xdf3c('0x30')](db[_0xdf3c('0x52')][_0xdf3c('0x44')]);_0x560348['query']=_['keys'](_0x1b279f[_0xdf3c('0x2b')]);_0x560348['filters']=_[_0xdf3c('0x32')](_0x560348['model'],_0x560348[_0xdf3c('0x2b')]);_0x12f737[_0xdf3c('0x33')]=_[_0xdf3c('0x32')](_0x560348[_0xdf3c('0x34')],qs['fields'](_0x1b279f['query'][_0xdf3c('0x35')]));_0x12f737[_0xdf3c('0x33')]=_0x12f737[_0xdf3c('0x33')][_0xdf3c('0x36')]?_0x12f737[_0xdf3c('0x33')]:_0x560348[_0xdf3c('0x34')];if(!_0x1b279f['query'][_0xdf3c('0x4b')]('nolimit')){_0x12f737[_0xdf3c('0x14')]=qs[_0xdf3c('0x14')](_0x1b279f[_0xdf3c('0x2b')][_0xdf3c('0x14')]);_0x12f737[_0xdf3c('0x12')]=qs['offset'](_0x1b279f[_0xdf3c('0x2b')][_0xdf3c('0x12')]);}_0x12f737[_0xdf3c('0x4c')]=qs['sort'](_0x1b279f['query']['sort']);_0x12f737['where']=qs[_0xdf3c('0x31')](_[_0xdf3c('0x4e')](_0x1b279f[_0xdf3c('0x2b')],_0x560348[_0xdf3c('0x31')]));_0x12f737[_0xdf3c('0x29')][_0xdf3c('0x4f')]=_0xf66fae['id'];if(_0x1b279f['query'][_0xdf3c('0x1f')]){_0x12f737['where']=_[_0xdf3c('0x45')](_0x12f737[_0xdf3c('0x29')],{'$or':_[_0xdf3c('0x20')](_0x12f737[_0xdf3c('0x33')],function(_0x320452){var _0x3a221d={};_0x3a221d[_0x320452]={'$like':'%'+_0x1b279f[_0xdf3c('0x2b')][_0xdf3c('0x1f')]+'%'};return _0x3a221d;})});}_0x12f737=_[_0xdf3c('0x45')]({},_0x12f737,_0x1b279f[_0xdf3c('0x38')]);return db[_0xdf3c('0x52')][_0xdf3c('0x15')]({'where':_0x12f737[_0xdf3c('0x29')]})[_0xdf3c('0x19')](function(_0x55fd73){_0x50753f[_0xdf3c('0x15')]=_0x55fd73;if(_0x1b279f[_0xdf3c('0x2b')][_0xdf3c('0x37')]){_0x12f737[_0xdf3c('0x2a')]=[{'all':!![]}];}return db['CmHopperHistory'][_0xdf3c('0x2c')](_0x12f737);})[_0xdf3c('0x19')](function(_0x54b7b8){_0x50753f['rows']=_0x54b7b8;return _0x50753f;});}})[_0xdf3c('0x19')](respondWithFilteredResult(_0xe01538,_0x12f737))[_0xdf3c('0x2e')](handleError(_0xe01538,null));};exports[_0xdf3c('0x53')]=function(_0x1aaf8b,_0x44dd2a){var _0x56fc77={'raw':!![],'where':{}};var _0x50105b={};var _0x471d8f={'count':0x0,'rows':[]};return db[_0xdf3c('0x26')][_0xdf3c('0x4a')]({'where':{'id':_0x1aaf8b[_0xdf3c('0x2f')]['id']}})[_0xdf3c('0x19')](handleEntityNotFound(_0x44dd2a,null))['then'](function(_0x30235e){if(_0x30235e){_0x50105b[_0xdf3c('0x34')]=_[_0xdf3c('0x30')](db[_0xdf3c('0x54')][_0xdf3c('0x44')]);_0x50105b['query']=_['keys'](_0x1aaf8b['query']);_0x50105b[_0xdf3c('0x31')]=_[_0xdf3c('0x32')](_0x50105b[_0xdf3c('0x34')],_0x50105b[_0xdf3c('0x2b')]);_0x56fc77[_0xdf3c('0x33')]=_[_0xdf3c('0x32')](_0x50105b[_0xdf3c('0x34')],qs[_0xdf3c('0x35')](_0x1aaf8b['query'][_0xdf3c('0x35')]));_0x56fc77[_0xdf3c('0x33')]=_0x56fc77[_0xdf3c('0x33')][_0xdf3c('0x36')]?_0x56fc77[_0xdf3c('0x33')]:_0x50105b[_0xdf3c('0x34')];if(!_0x1aaf8b['query'][_0xdf3c('0x4b')](_0xdf3c('0x55'))){_0x56fc77['limit']=qs['limit'](_0x1aaf8b[_0xdf3c('0x2b')]['limit']);_0x56fc77[_0xdf3c('0x12')]=qs[_0xdf3c('0x12')](_0x1aaf8b['query'][_0xdf3c('0x12')]);}_0x56fc77[_0xdf3c('0x4c')]=qs[_0xdf3c('0x4d')](_0x1aaf8b[_0xdf3c('0x2b')][_0xdf3c('0x4d')]);_0x56fc77[_0xdf3c('0x29')]=qs['filters'](_[_0xdf3c('0x4e')](_0x1aaf8b[_0xdf3c('0x2b')],_0x50105b[_0xdf3c('0x31')]));_0x56fc77[_0xdf3c('0x29')][_0xdf3c('0x4f')]=_0x30235e['id'];if(_0x1aaf8b[_0xdf3c('0x2b')][_0xdf3c('0x1f')]){_0x56fc77['where']=_['merge'](_0x56fc77[_0xdf3c('0x29')],{'$or':_[_0xdf3c('0x20')](_0x56fc77[_0xdf3c('0x33')],function(_0x5b6419){var _0x38c374={};_0x38c374[_0x5b6419]={'$like':'%'+_0x1aaf8b['query']['filter']+'%'};return _0x38c374;})});}_0x56fc77=_[_0xdf3c('0x45')]({},_0x56fc77,_0x1aaf8b[_0xdf3c('0x38')]);return db['CmHopperFinal'][_0xdf3c('0x15')]({'where':_0x56fc77['where']})[_0xdf3c('0x19')](function(_0x4b35ff){_0x471d8f[_0xdf3c('0x15')]=_0x4b35ff;if(_0x1aaf8b[_0xdf3c('0x2b')][_0xdf3c('0x37')]){_0x56fc77[_0xdf3c('0x2a')]=[{'all':!![]}];}return db[_0xdf3c('0x54')][_0xdf3c('0x2c')](_0x56fc77);})[_0xdf3c('0x19')](function(_0x2dc0d2){_0x471d8f[_0xdf3c('0x2d')]=_0x2dc0d2;return _0x471d8f;});}})[_0xdf3c('0x19')](respondWithFilteredResult(_0x44dd2a,_0x56fc77))[_0xdf3c('0x2e')](handleError(_0x44dd2a,null));};exports[_0xdf3c('0x56')]=function(_0x10528d,_0x1acc47){var _0x5b3aa5={'raw':!![],'where':{}};var _0x3cf465={};var _0x22bacf={'count':0x0,'rows':[]};return db[_0xdf3c('0x26')]['findOne']({'where':{'id':_0x10528d[_0xdf3c('0x2f')]['id']}})[_0xdf3c('0x19')](handleEntityNotFound(_0x1acc47,null))[_0xdf3c('0x19')](function(_0x6e1899){if(_0x6e1899){_0x3cf465[_0xdf3c('0x34')]=_[_0xdf3c('0x30')](db[_0xdf3c('0x57')][_0xdf3c('0x44')]);_0x3cf465[_0xdf3c('0x2b')]=_[_0xdf3c('0x30')](_0x10528d[_0xdf3c('0x2b')]);_0x3cf465['filters']=_[_0xdf3c('0x32')](_0x3cf465[_0xdf3c('0x34')],_0x3cf465[_0xdf3c('0x2b')]);_0x5b3aa5[_0xdf3c('0x33')]=_[_0xdf3c('0x32')](_0x3cf465[_0xdf3c('0x34')],qs[_0xdf3c('0x35')](_0x10528d[_0xdf3c('0x2b')][_0xdf3c('0x35')]));_0x5b3aa5[_0xdf3c('0x33')]=_0x5b3aa5[_0xdf3c('0x33')][_0xdf3c('0x36')]?_0x5b3aa5['attributes']:_0x3cf465[_0xdf3c('0x34')];if(!_0x10528d[_0xdf3c('0x2b')][_0xdf3c('0x4b')](_0xdf3c('0x55'))){_0x5b3aa5[_0xdf3c('0x14')]=qs[_0xdf3c('0x14')](_0x10528d[_0xdf3c('0x2b')]['limit']);_0x5b3aa5[_0xdf3c('0x12')]=qs[_0xdf3c('0x12')](_0x10528d[_0xdf3c('0x2b')][_0xdf3c('0x12')]);}_0x5b3aa5['order']=qs[_0xdf3c('0x4d')](_0x10528d[_0xdf3c('0x2b')]['sort']);_0x5b3aa5[_0xdf3c('0x29')]=qs['filters'](_[_0xdf3c('0x4e')](_0x10528d[_0xdf3c('0x2b')],_0x3cf465['filters']));_0x5b3aa5[_0xdf3c('0x29')][_0xdf3c('0x4f')]=_0x6e1899['id'];if(_0x10528d[_0xdf3c('0x2b')]['filter']){_0x5b3aa5['where']=_[_0xdf3c('0x45')](_0x5b3aa5['where'],{'$or':_[_0xdf3c('0x20')](_0x5b3aa5[_0xdf3c('0x33')],function(_0x161604){var _0x91dd6e={};_0x91dd6e[_0x161604]={'$like':'%'+_0x10528d['query'][_0xdf3c('0x1f')]+'%'};return _0x91dd6e;})});}_0x5b3aa5=_[_0xdf3c('0x45')]({},_0x5b3aa5,_0x10528d['options']);return db[_0xdf3c('0x57')]['count']({'where':_0x5b3aa5[_0xdf3c('0x29')]})[_0xdf3c('0x19')](function(_0x5429b6){_0x22bacf['count']=_0x5429b6;if(_0x10528d[_0xdf3c('0x2b')]['includeAll']){_0x5b3aa5[_0xdf3c('0x2a')]=[{'all':!![]}];}return db[_0xdf3c('0x57')][_0xdf3c('0x2c')](_0x5b3aa5);})[_0xdf3c('0x19')](function(_0x19a723){_0x22bacf[_0xdf3c('0x2d')]=_0x19a723;return _0x22bacf;});}})[_0xdf3c('0x19')](respondWithFilteredResult(_0x1acc47,_0x5b3aa5))[_0xdf3c('0x2e')](handleError(_0x1acc47,null));};exports[_0xdf3c('0x58')]=function(_0x3d8ff0,_0x2a2f03){var _0x55975e={};var _0x4299d1={};var _0x132c27;var _0x52a641;return db[_0xdf3c('0x26')][_0xdf3c('0x4a')]({'where':{'id':_0x3d8ff0[_0xdf3c('0x2f')]['id']}})[_0xdf3c('0x19')](handleEntityNotFound(_0x2a2f03,null))[_0xdf3c('0x19')](function(_0x12576e){if(_0x12576e){_0x132c27=_0x12576e;_0x4299d1['model']=_[_0xdf3c('0x30')](db['Team'][_0xdf3c('0x44')]);_0x4299d1[_0xdf3c('0x2b')]=_[_0xdf3c('0x30')](_0x3d8ff0[_0xdf3c('0x2b')]);_0x4299d1[_0xdf3c('0x31')]=_[_0xdf3c('0x32')](_0x4299d1['model'],_0x4299d1[_0xdf3c('0x2b')]);_0x55975e[_0xdf3c('0x33')]=_['intersection'](_0x4299d1[_0xdf3c('0x34')],qs[_0xdf3c('0x35')](_0x3d8ff0[_0xdf3c('0x2b')][_0xdf3c('0x35')]));_0x55975e[_0xdf3c('0x33')]=_0x55975e[_0xdf3c('0x33')][_0xdf3c('0x36')]?_0x55975e[_0xdf3c('0x33')]:_0x4299d1['model'];_0x55975e['order']=qs[_0xdf3c('0x4d')](_0x3d8ff0[_0xdf3c('0x2b')][_0xdf3c('0x4d')]);_0x55975e[_0xdf3c('0x29')]=qs['filters'](_['pick'](_0x3d8ff0[_0xdf3c('0x2b')],_0x4299d1['filters']));if(_0x3d8ff0[_0xdf3c('0x2b')]['filter']){_0x55975e[_0xdf3c('0x29')]=_[_0xdf3c('0x45')](_0x55975e[_0xdf3c('0x29')],{'$or':_['map'](_0x55975e[_0xdf3c('0x33')],function(_0x142cd0){var _0x5bf9a9={};_0x5bf9a9[_0x142cd0]={'$like':'%'+_0x3d8ff0['query'][_0xdf3c('0x1f')]+'%'};return _0x5bf9a9;})});}_0x55975e=_[_0xdf3c('0x45')]({},_0x55975e,_0x3d8ff0[_0xdf3c('0x38')]);return _0x132c27[_0xdf3c('0x58')](_0x55975e);}})[_0xdf3c('0x19')](function(_0x294682){if(_0x294682){_0x52a641=_0x294682[_0xdf3c('0x36')];if(!_0x3d8ff0['query']['hasOwnProperty'](_0xdf3c('0x55'))){_0x55975e[_0xdf3c('0x14')]=qs[_0xdf3c('0x14')](_0x3d8ff0[_0xdf3c('0x2b')][_0xdf3c('0x14')]);_0x55975e[_0xdf3c('0x12')]=qs[_0xdf3c('0x12')](_0x3d8ff0[_0xdf3c('0x2b')][_0xdf3c('0x12')]);}return _0x132c27[_0xdf3c('0x58')](_0x55975e);}})[_0xdf3c('0x19')](function(_0x322cf5){if(_0x322cf5){return _0x322cf5?{'count':_0x52a641,'rows':_0x322cf5}:null;}})[_0xdf3c('0x19')](respondWithResult(_0x2a2f03,null))[_0xdf3c('0x2e')](handleError(_0x2a2f03,null));};exports[_0xdf3c('0x59')]=function(_0x199ff0,_0x244bf0){var _0x1a0d61=_0x199ff0[_0xdf3c('0x3b')]['teams'];var _0x4c6615=_[_0xdf3c('0x20')](_0x1a0d61,'id');return db['Team']['findAll']({'where':{'id':_0x4c6615},'attributes':['id'],'include':[{'model':db[_0xdf3c('0x5a')],'as':'Agents','attributes':['id',_0xdf3c('0x24'),_0xdf3c('0x5b'),'voicePause','interface'],'raw':!![]}]})['then'](function(_0x1c7b50){if(_0x1c7b50){var _0x3e0a0f=_[_0xdf3c('0x5c')](_0x1c7b50,function(_0x4d5216){var _0x197b8a=_0x4d5216['get']({'plain':!![]});_0x197b8a[_0xdf3c('0x5d')]['forEach'](function(_0x5b0101){_0x5b0101[_0xdf3c('0x5e')]=_[_0xdf3c('0x39')](_0x1a0d61,{'id':_0x197b8a['id']})[_0xdf3c('0x5e')];});return _0x197b8a[_0xdf3c('0x5d')];});return db[_0xdf3c('0x26')][_0xdf3c('0x39')]({'where':{'id':_0x199ff0['params']['id']}})['then'](function(_0x128a4e){return db['sequelize'][_0xdf3c('0x5f')](function(_0x14244a){return _0x128a4e[_0xdf3c('0x59')](_0x4c6615,{'transaction':_0x14244a})[_0xdf3c('0x19')](function(){return BPromise[_0xdf3c('0x60')](_0x1a0d61,function(_0x619c66){return db[_0xdf3c('0x61')]['upsert']({'TeamId':_0x619c66['id'],'VoiceQueueId':_0x199ff0['params']['id'],'penalty':_0x619c66[_0xdf3c('0x5e')]},{'transaction':_0x14244a});});})[_0xdf3c('0x19')](function(){return BPromise[_0xdf3c('0x60')](_0x3e0a0f,function(_0x13a882){return db['UserVoiceQueue'][_0xdf3c('0x62')]({'where':{'UserId':_0x13a882['id'],'VoiceQueueId':_0x199ff0[_0xdf3c('0x2f')]['id']},'defaults':{'penalty':_0x13a882[_0xdf3c('0x5e')]},'transaction':_0x14244a});});})[_0xdf3c('0x19')](function(){return BPromise[_0xdf3c('0x60')](_[_0xdf3c('0x1f')](_0x3e0a0f,{'online':!![]}),function(_0x524482){return db[_0xdf3c('0x63')][_0xdf3c('0x64')]({'membername':_0x524482['name'],'UserId':_0x524482['id'],'queue_name':_0x128a4e[_0xdf3c('0x24')],'VoiceQueueId':_0x128a4e['id'],'interface':_[_0xdf3c('0x65')](_0x524482[_0xdf3c('0x66')])?util['format'](_0xdf3c('0x67'),_0x524482[_0xdf3c('0x24')]):_0x524482[_0xdf3c('0x66')],'paused':_0x524482[_0xdf3c('0x68')]||![],'penalty':_0x524482[_0xdf3c('0x5e')]},{'transaction':_0x14244a});});})[_0xdf3c('0x19')](function(){_0x3e0a0f[_0xdf3c('0x69')](function(_0x12ffd3){socket[_0xdf3c('0x6a')]('userVoiceQueue:save',{'UserId':_0x12ffd3['id'],'VoiceQueueId':_0x128a4e['id']});});});});});}})[_0xdf3c('0x19')](respondWithStatusCode(_0x244bf0,null))['catch'](handleError(_0x244bf0,null));};exports[_0xdf3c('0x6b')]=function(_0x160568,_0xfcf42f){return db[_0xdf3c('0x6c')][_0xdf3c('0x2c')]({'where':{'id':_0x160568[_0xdf3c('0x2b')][_0xdf3c('0x6d')]},'attributes':['id'],'include':[{'model':db[_0xdf3c('0x5a')],'as':_0xdf3c('0x5d'),'attributes':['id'],'raw':!![]}]})[_0xdf3c('0x19')](handleEntityNotFound(_0xfcf42f,null))[_0xdf3c('0x19')](function(_0x5f09a0){var _0x379996=_[_0xdf3c('0x20')](_0x5f09a0,'id');var _0x5f1b51=[];var _0x323058=[];var _0x8fd9e4=squel[_0xdf3c('0x6e')]();_0x8fd9e4[_0xdf3c('0x6f')]('tq.TeamId')[_0xdf3c('0x70')](_0xdf3c('0x71'),'tq')[_0xdf3c('0x72')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0xdf3c('0x73'),_0x160568[_0xdf3c('0x2f')]['id']);for(var _0x403ac5=0x0;_0x403ac5<_0x5f09a0[_0xdf3c('0x36')];_0x403ac5+=0x1){let _0x44d862=_0x5f09a0[_0x403ac5];for(var _0x33132b=0x0;_0x33132b<_0x44d862[_0xdf3c('0x5d')][_0xdf3c('0x36')];_0x33132b+=0x1){let _0x49c29e=_0x44d862[_0xdf3c('0x5d')][_0x33132b];var _0x5e868a=_0x8fd9e4[_0xdf3c('0x43')]();_0x5e868a[_0xdf3c('0x29')](_0xdf3c('0x74'),_0x49c29e['id']);_0x323058[_0xdf3c('0x75')](db[_0xdf3c('0x76')][_0xdf3c('0x2b')](_0x5e868a['toString'](),{'type':db[_0xdf3c('0x76')][_0xdf3c('0x77')]['SELECT']})[_0xdf3c('0x19')](function(_0x270353){if(_0x270353[_0xdf3c('0x36')]===0x1){return _0x49c29e['id'];}else{var _0x3f6df9=_['every'](_[_0xdf3c('0x20')](_0x270353,'TeamId'),function(_0x7d9a0f){return _[_0xdf3c('0x22')](_0x379996,_0x7d9a0f);});if(_0x3f6df9){return _0x49c29e['id'];}}}));}}return BPromise[_0xdf3c('0x78')](_0x323058)[_0xdf3c('0x19')](function(_0x17669f){_0x5f1b51=_(_0x5f1b51)[_0xdf3c('0x79')](_0x17669f)['compact']()['value']();return db['VoiceQueue'][_0xdf3c('0x39')]({'where':{'id':_0x160568[_0xdf3c('0x2f')]['id']}})['then'](function(_0x528c97){return db[_0xdf3c('0x76')]['transaction'](function(_0x58a2d8){return _0x528c97['removeTeams'](_0x160568[_0xdf3c('0x2b')][_0xdf3c('0x6d')],{'transaction':_0x58a2d8})[_0xdf3c('0x19')](function(){if(!_['isEmpty'](_0x5f1b51)){return _0x528c97[_0xdf3c('0x7a')](_0x5f1b51,{'transaction':_0x58a2d8})['then'](function(){return db[_0xdf3c('0x63')][_0xdf3c('0x1a')]({'where':{'VoiceQueueId':_0x160568[_0xdf3c('0x2f')]['id'],'UserId':_0x5f1b51},'transaction':_0x58a2d8});});}})[_0xdf3c('0x19')](function(){_0x5f1b51[_0xdf3c('0x69')](function(_0x467090){socket[_0xdf3c('0x6a')](_0xdf3c('0x7b'),{'UserId':_0x467090,'VoiceQueueId':_0x528c97['id']});});});});});});})[_0xdf3c('0x19')](respondWithStatusCode(_0xfcf42f,null))['catch'](handleError(_0xfcf42f,null));};exports[_0xdf3c('0x7c')]=function(_0x4652af,_0x5e08bc){var _0x2702ca,_0x1e8646;return db['VoiceQueue'][_0xdf3c('0x39')]({'where':{'id':_0x4652af['params']['id']}})[_0xdf3c('0x19')](handleEntityNotFound(_0x5e08bc,null))[_0xdf3c('0x19')](function(_0x3ea47d){if(_0x3ea47d){_0x1e8646=_0x3ea47d;return _0x3ea47d[_0xdf3c('0x7c')](_0x4652af[_0xdf3c('0x3b')][_0xdf3c('0x6d')],_[_0xdf3c('0x46')](_0x4652af[_0xdf3c('0x3b')],[_0xdf3c('0x6d'),'id'])||{})[_0xdf3c('0x7d')](function(_0xfdb4e2){for(var _0x1c31ee=0x0;_0x1c31ee<_0x4652af[_0xdf3c('0x3b')][_0xdf3c('0x6d')][_0xdf3c('0x36')];_0x1c31ee+=0x1){socket[_0xdf3c('0x6a')]('userVoiceQueue:save',{'UserId':Number(_0x4652af[_0xdf3c('0x3b')][_0xdf3c('0x6d')][_0x1c31ee]),'VoiceQueueId':Number(_0x4652af['params']['id'])});}return _0xfdb4e2;});}})[_0xdf3c('0x19')](function(_0xf39067){_0x2702ca=_0xf39067||[];if(_0x1e8646){return db[_0xdf3c('0x5a')][_0xdf3c('0x2c')]({'where':{'id':_0x4652af['body'][_0xdf3c('0x6d')]},'attributes':['id',_0xdf3c('0x24'),'online',_0xdf3c('0x68'),_0xdf3c('0x66')],'raw':!![]});}})['then'](function(_0x59c8f9){if(!_[_0xdf3c('0x7e')](_0x59c8f9)){var _0x388f8d=[];for(var _0x1c4964=0x0;_0x1c4964<_0x59c8f9['length'];_0x1c4964++){if(_0x59c8f9[_0x1c4964][_0xdf3c('0x5b')]){_0x388f8d['push'](db[_0xdf3c('0x63')][_0xdf3c('0x64')]({'membername':_0x59c8f9[_0x1c4964][_0xdf3c('0x24')],'UserId':_0x59c8f9[_0x1c4964]['id'],'queue_name':_0x1e8646[_0xdf3c('0x24')],'VoiceQueueId':_0x1e8646['id'],'interface':_[_0xdf3c('0x65')](_0x59c8f9[_0x1c4964][_0xdf3c('0x66')])?util['format'](_0xdf3c('0x67'),_0x59c8f9[_0x1c4964]['name']):_0x59c8f9[_0x1c4964][_0xdf3c('0x66')],'paused':_0x59c8f9[_0x1c4964][_0xdf3c('0x68')]||![],'penalty':_0x4652af[_0xdf3c('0x3b')]['penalty']||0x0}));}}return BPromise[_0xdf3c('0x78')](_0x388f8d);}})['then'](function(){return _0x2702ca;})[_0xdf3c('0x19')](respondWithResult(_0x5e08bc,null))[_0xdf3c('0x2e')](handleError(_0x5e08bc,null));};exports['removeAgents']=function(_0x153bce,_0x4185f0){return db[_0xdf3c('0x26')][_0xdf3c('0x39')]({'where':{'id':_0x153bce['params']['id']}})[_0xdf3c('0x19')](handleEntityNotFound(_0x4185f0,null))[_0xdf3c('0x19')](function(_0xa61c3f){if(_0xa61c3f){return _0xa61c3f[_0xdf3c('0x7a')](_0x153bce[_0xdf3c('0x2b')][_0xdf3c('0x6d')])[_0xdf3c('0x19')](function(){if(_['isArray'](_0x153bce[_0xdf3c('0x2b')][_0xdf3c('0x6d')])){for(var _0x26251d=0x0;_0x26251d<_0x153bce[_0xdf3c('0x2b')][_0xdf3c('0x6d')][_0xdf3c('0x36')];_0x26251d+=0x1){socket[_0xdf3c('0x6a')](_0xdf3c('0x7b'),{'UserId':Number(_0x153bce[_0xdf3c('0x2b')][_0xdf3c('0x6d')][_0x26251d]),'VoiceQueueId':Number(_0x153bce[_0xdf3c('0x2f')]['id'])});}}else{socket['emit'](_0xdf3c('0x7b'),{'UserId':Number(_0x153bce[_0xdf3c('0x2b')][_0xdf3c('0x6d')]),'VoiceQueueId':Number(_0x153bce['params']['id'])});}});}})[_0xdf3c('0x19')](function(_0x109153){return db[_0xdf3c('0x63')][_0xdf3c('0x1a')]({'where':{'VoiceQueueId':_0x153bce[_0xdf3c('0x2f')]['id'],'UserId':_0x153bce['query'][_0xdf3c('0x6d')]}})[_0xdf3c('0x19')](function(){return _0x109153;});})['then'](respondWithStatusCode(_0x4185f0,null))[_0xdf3c('0x2e')](handleError(_0x4185f0,null));};exports[_0xdf3c('0x7f')]=function(_0x38c6f3,_0xb39cc){var _0xcc2f18={};var _0x13ee9b={};var _0x8d7c0c;var _0x3d9041;return db[_0xdf3c('0x26')]['findOne']({'where':{'id':_0x38c6f3[_0xdf3c('0x2f')]['id']}})[_0xdf3c('0x19')](handleEntityNotFound(_0xb39cc,null))['then'](function(_0x39bc51){if(_0x39bc51){_0x8d7c0c=_0x39bc51;_0x13ee9b[_0xdf3c('0x34')]=_['keys'](db['User'][_0xdf3c('0x44')]);_0x13ee9b[_0xdf3c('0x2b')]=_[_0xdf3c('0x30')](_0x38c6f3[_0xdf3c('0x2b')]);_0x13ee9b[_0xdf3c('0x31')]=_[_0xdf3c('0x32')](_0x13ee9b[_0xdf3c('0x34')],_0x13ee9b[_0xdf3c('0x2b')]);_0xcc2f18['attributes']=_[_0xdf3c('0x32')](_0x13ee9b[_0xdf3c('0x34')],qs[_0xdf3c('0x35')](_0x38c6f3[_0xdf3c('0x2b')]['fields']));_0xcc2f18[_0xdf3c('0x33')]=_0xcc2f18[_0xdf3c('0x33')][_0xdf3c('0x36')]?_0xcc2f18[_0xdf3c('0x33')]:_0x13ee9b['model'];_0xcc2f18[_0xdf3c('0x4c')]=qs[_0xdf3c('0x4d')](_0x38c6f3[_0xdf3c('0x2b')]['sort']);_0xcc2f18['where']=qs[_0xdf3c('0x31')](_[_0xdf3c('0x4e')](_0x38c6f3[_0xdf3c('0x2b')],_0x13ee9b['filters']));if(_0x38c6f3[_0xdf3c('0x2b')][_0xdf3c('0x1f')]){_0xcc2f18[_0xdf3c('0x29')]=_[_0xdf3c('0x45')](_0xcc2f18[_0xdf3c('0x29')],{'$or':_['map'](_0xcc2f18['attributes'],function(_0x1cd1a7){var _0x48141c={};_0x48141c[_0x1cd1a7]={'$like':'%'+_0x38c6f3[_0xdf3c('0x2b')][_0xdf3c('0x1f')]+'%'};return _0x48141c;})});}_0xcc2f18=_[_0xdf3c('0x45')]({},_0xcc2f18,_0x38c6f3[_0xdf3c('0x38')]);return _0x8d7c0c[_0xdf3c('0x7f')](_0xcc2f18);}})[_0xdf3c('0x19')](function(_0x5a56b5){if(_0x5a56b5){_0x3d9041=_0x5a56b5[_0xdf3c('0x36')];if(!_0x38c6f3[_0xdf3c('0x2b')][_0xdf3c('0x4b')](_0xdf3c('0x55'))){_0xcc2f18['limit']=qs[_0xdf3c('0x14')](_0x38c6f3[_0xdf3c('0x2b')][_0xdf3c('0x14')]);_0xcc2f18['offset']=qs['offset'](_0x38c6f3[_0xdf3c('0x2b')][_0xdf3c('0x12')]);}return _0x8d7c0c['getAgents'](_0xcc2f18);}})[_0xdf3c('0x19')](function(_0x5eebe3){if(_0x5eebe3){return _0x5eebe3?{'count':_0x3d9041,'rows':_0x5eebe3}:null;}})[_0xdf3c('0x19')](respondWithResult(_0xb39cc,null))[_0xdf3c('0x2e')](handleError(_0xb39cc,null));};exports[_0xdf3c('0x80')]=function(_0x1961cd,_0x30659d){var _0x27f25a={};var _0x5e5dad={};var _0x19ce27;var _0x2c24b7;return db[_0xdf3c('0x26')][_0xdf3c('0x4a')]({'where':{'id':_0x1961cd[_0xdf3c('0x2f')]['id']}})[_0xdf3c('0x19')](handleEntityNotFound(_0x30659d,null))[_0xdf3c('0x19')](function(_0x1dee13){if(_0x1dee13){_0x19ce27=_0x1dee13;_0x5e5dad[_0xdf3c('0x34')]=_[_0xdf3c('0x30')](db[_0xdf3c('0x63')]['rawAttributes']);_0x5e5dad[_0xdf3c('0x2b')]=_[_0xdf3c('0x30')](_0x1961cd['query']);_0x5e5dad[_0xdf3c('0x31')]=_[_0xdf3c('0x32')](_0x5e5dad[_0xdf3c('0x34')],_0x5e5dad[_0xdf3c('0x2b')]);_0x27f25a[_0xdf3c('0x33')]=_['intersection'](_0x5e5dad[_0xdf3c('0x34')],qs[_0xdf3c('0x35')](_0x1961cd[_0xdf3c('0x2b')][_0xdf3c('0x35')]));_0x27f25a[_0xdf3c('0x33')]=_0x27f25a[_0xdf3c('0x33')][_0xdf3c('0x36')]?_0x27f25a[_0xdf3c('0x33')]:_0x5e5dad[_0xdf3c('0x34')];_0x27f25a[_0xdf3c('0x4c')]=qs[_0xdf3c('0x4d')](_0x1961cd[_0xdf3c('0x2b')][_0xdf3c('0x4d')]);_0x27f25a['where']=qs[_0xdf3c('0x31')](_[_0xdf3c('0x4e')](_0x1961cd['query'],_0x5e5dad[_0xdf3c('0x31')]));if(_0x1961cd[_0xdf3c('0x2b')][_0xdf3c('0x1f')]){_0x27f25a[_0xdf3c('0x29')]=_[_0xdf3c('0x45')](_0x27f25a[_0xdf3c('0x29')],{'$or':_[_0xdf3c('0x20')](_0x27f25a[_0xdf3c('0x33')],function(_0xc3b6a1){var _0x3d9a1e={};_0x3d9a1e[_0xc3b6a1]={'$like':'%'+_0x1961cd['query'][_0xdf3c('0x1f')]+'%'};return _0x3d9a1e;})});}_0x27f25a=_[_0xdf3c('0x45')]({},_0x27f25a,_0x1961cd['options']);return _0x19ce27[_0xdf3c('0x80')](_0x27f25a);}})['then'](function(_0x330ee0){if(_0x330ee0){_0x2c24b7=_0x330ee0['length'];if(!_0x1961cd[_0xdf3c('0x2b')]['hasOwnProperty'](_0xdf3c('0x55'))){_0x27f25a[_0xdf3c('0x14')]=qs[_0xdf3c('0x14')](_0x1961cd[_0xdf3c('0x2b')][_0xdf3c('0x14')]);_0x27f25a[_0xdf3c('0x12')]=qs[_0xdf3c('0x12')](_0x1961cd[_0xdf3c('0x2b')]['offset']);}return _0x19ce27[_0xdf3c('0x80')](_0x27f25a);}})[_0xdf3c('0x19')](function(_0x1b3daa){return _0x1b3daa?{'count':_0x2c24b7,'rows':_0x1b3daa}:null;})['then'](respondWithResult(_0x30659d,null))[_0xdf3c('0x2e')](handleError(_0x30659d,null));};exports[_0xdf3c('0x81')]=function(_0x30e5ab,_0x465c59){var _0x571f14={};var _0x55a4fa={};var _0x4f7b39;var _0x5e5af3;return db[_0xdf3c('0x26')][_0xdf3c('0x4a')]({'where':{'id':_0x30e5ab[_0xdf3c('0x2f')]['id']}})[_0xdf3c('0x19')](handleEntityNotFound(_0x465c59,null))[_0xdf3c('0x19')](function(_0x323d9b){if(_0x323d9b){_0x4f7b39=_0x323d9b;_0x55a4fa[_0xdf3c('0x34')]=_['keys'](db[_0xdf3c('0x82')]['rawAttributes']);_0x55a4fa[_0xdf3c('0x2b')]=_[_0xdf3c('0x30')](_0x30e5ab[_0xdf3c('0x2b')]);_0x55a4fa[_0xdf3c('0x31')]=_[_0xdf3c('0x32')](_0x55a4fa[_0xdf3c('0x34')],_0x55a4fa[_0xdf3c('0x2b')]);_0x571f14[_0xdf3c('0x33')]=_['intersection'](_0x55a4fa[_0xdf3c('0x34')],qs[_0xdf3c('0x35')](_0x30e5ab[_0xdf3c('0x2b')][_0xdf3c('0x35')]));_0x571f14[_0xdf3c('0x33')]=_0x571f14['attributes']['length']?_0x571f14[_0xdf3c('0x33')]:_0x55a4fa[_0xdf3c('0x34')];_0x571f14[_0xdf3c('0x4c')]=qs[_0xdf3c('0x4d')](_0x30e5ab[_0xdf3c('0x2b')][_0xdf3c('0x4d')]);_0x571f14[_0xdf3c('0x29')]=qs[_0xdf3c('0x31')](_[_0xdf3c('0x4e')](_0x30e5ab[_0xdf3c('0x2b')],_0x55a4fa[_0xdf3c('0x31')]));if(_0x30e5ab['query'][_0xdf3c('0x1f')]){_0x571f14[_0xdf3c('0x29')]=_[_0xdf3c('0x45')](_0x571f14[_0xdf3c('0x29')],{'$or':_[_0xdf3c('0x20')](_0x571f14[_0xdf3c('0x33')],function(_0x184a55){var _0x4e8ad8={};_0x4e8ad8[_0x184a55]={'$like':'%'+_0x30e5ab[_0xdf3c('0x2b')]['filter']+'%'};return _0x4e8ad8;})});}_0x571f14=_[_0xdf3c('0x45')]({},_0x571f14,_0x30e5ab['options']);return _0x4f7b39[_0xdf3c('0x81')](_0x571f14);}})[_0xdf3c('0x19')](function(_0x54d975){if(_0x54d975){_0x5e5af3=_0x54d975['length'];if(!_0x30e5ab[_0xdf3c('0x2b')][_0xdf3c('0x4b')](_0xdf3c('0x55'))){_0x571f14[_0xdf3c('0x14')]=qs[_0xdf3c('0x14')](_0x30e5ab['query'][_0xdf3c('0x14')]);_0x571f14[_0xdf3c('0x12')]=qs[_0xdf3c('0x12')](_0x30e5ab[_0xdf3c('0x2b')][_0xdf3c('0x12')]);}return _0x4f7b39['getLists'](_0x571f14);}})[_0xdf3c('0x19')](function(_0x55a593){if(_0x55a593){return _0x55a593?{'count':_0x5e5af3,'rows':_0x55a593}:null;}})[_0xdf3c('0x19')](respondWithResult(_0x465c59,null))['catch'](handleError(_0x465c59,null));};exports['addLists']=function(_0x42d720,_0x2da908){var _0x3e2a89=moment()[_0xdf3c('0x83')](_0xdf3c('0x84'));var _0x4f4afd,_0xd3d760;return db[_0xdf3c('0x26')]['find']({'where':{'id':_0x42d720[_0xdf3c('0x2f')]['id']}})[_0xdf3c('0x19')](handleEntityNotFound(_0x2da908,null))[_0xdf3c('0x19')](function(_0x386a3b){if(_0x386a3b){_0xd3d760=_0x386a3b;return _0x386a3b[_0xdf3c('0x85')](_0x42d720['body'][_0xdf3c('0x6d')],_[_0xdf3c('0x46')](_0x42d720[_0xdf3c('0x3b')],[_0xdf3c('0x6d'),'id'])||{});}return null;})[_0xdf3c('0x7d')](function(_0x511630){var _0x2cf46;_0x4f4afd=_0x511630||[];var _0x43fc55=[];if(_0x511630){for(var _0x81b8dd=0x0;_0x81b8dd<_0x511630[_0xdf3c('0x36')];_0x81b8dd+=0x1){var _0xb852c5=_0x511630[_0x81b8dd][_0xdf3c('0x1b')]({'plain':!![]});_0xd3d760[_0xdf3c('0x86')]=_0x42d720[_0xdf3c('0x3b')][_0xdf3c('0x86')]?_0x42d720[_0xdf3c('0x3b')][_0xdf3c('0x86')]:_0xd3d760[_0xdf3c('0x86')];switch(_0xd3d760[_0xdf3c('0x86')]){case _0xdf3c('0x87'):_0x2cf46=squel[_0xdf3c('0x88')]()[_0xdf3c('0x89')](_0xdf3c('0x8a'))[_0xdf3c('0x8b')](['phone',_0xdf3c('0x8c'),_0xdf3c('0x8d'),_0xdf3c('0x8e'),'VoiceQueueId',_0xdf3c('0x48'),'updatedAt'],squel[_0xdf3c('0x6e')]()['field'](_0xdf3c('0x8f'),_0xdf3c('0x8f'))[_0xdf3c('0x6f')]('\x27'+_0x3e2a89+'\x27',_0xdf3c('0x8c'))[_0xdf3c('0x6f')]('id',_0xdf3c('0x8d'))[_0xdf3c('0x6f')](_0xb852c5[_0xdf3c('0x90')][_0xdf3c('0x91')](),'ListId')[_0xdf3c('0x6f')](_0x42d720[_0xdf3c('0x2f')]['id'][_0xdf3c('0x91')](),_0xdf3c('0x4f'))['field']('\x27'+_0x3e2a89+'\x27','createdAt')[_0xdf3c('0x6f')]('\x27'+_0x3e2a89+'\x27',_0xdf3c('0x47'))[_0xdf3c('0x70')](_0xdf3c('0x92'))['where'](_0xdf3c('0x93'))['where']('ListId\x20=\x20?',_0xb852c5[_0xdf3c('0x90')][_0xdf3c('0x91')]())['where'](_0xdf3c('0x94'))[_0xdf3c('0x29')]('phone\x20NOT\x20IN\x20(?)',squel[_0xdf3c('0x6e')]()[_0xdf3c('0x6f')]('COALESCE(calleridnum,\x27\x27)')[_0xdf3c('0x70')](_0xdf3c('0x95'))[_0xdf3c('0x29')](_0xdf3c('0x73'),_0x42d720[_0xdf3c('0x2f')]['id'][_0xdf3c('0x91')]()))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0xdf3c('0x6e')]()[_0xdf3c('0x6f')](_0xdf3c('0x96'))[_0xdf3c('0x70')](_0xdf3c('0x8a'))[_0xdf3c('0x29')]('VoiceQueueId\x20=\x20?',_0x42d720[_0xdf3c('0x2f')]['id'][_0xdf3c('0x91')]())))[_0xdf3c('0x91')]();break;case _0xdf3c('0x97'):_0x2cf46=squel['insert']()[_0xdf3c('0x89')](_0xdf3c('0x8a'))['fromQuery']([_0xdf3c('0x8f'),_0xdf3c('0x8c'),_0xdf3c('0x8d'),_0xdf3c('0x8e'),'VoiceQueueId',_0xdf3c('0x48'),_0xdf3c('0x47')],squel[_0xdf3c('0x6e')]()[_0xdf3c('0x6f')]('phone','phone')[_0xdf3c('0x6f')]('\x27'+_0x3e2a89+'\x27',_0xdf3c('0x8c'))[_0xdf3c('0x6f')]('id',_0xdf3c('0x8d'))[_0xdf3c('0x6f')](_0xb852c5[_0xdf3c('0x90')][_0xdf3c('0x91')](),_0xdf3c('0x8e'))['field'](_0x42d720[_0xdf3c('0x2f')]['id'][_0xdf3c('0x91')](),'VoiceQueueId')[_0xdf3c('0x6f')]('\x27'+_0x3e2a89+'\x27',_0xdf3c('0x48'))['field']('\x27'+_0x3e2a89+'\x27',_0xdf3c('0x47'))['from'](_0xdf3c('0x92'))[_0xdf3c('0x29')](_0xdf3c('0x93'))[_0xdf3c('0x29')]('ListId\x20=\x20?',_0xb852c5['CmListId']['toString']())[_0xdf3c('0x29')](_0xdf3c('0x94'))[_0xdf3c('0x29')](_0xdf3c('0x98'),squel[_0xdf3c('0x6e')]()[_0xdf3c('0x6f')](_0xdf3c('0x96'))['from'](_0xdf3c('0x8a'))[_0xdf3c('0x29')]('VoiceQueueId\x20=\x20?',_0x42d720[_0xdf3c('0x2f')]['id']['toString']())))[_0xdf3c('0x91')]();break;default:_0x2cf46=squel[_0xdf3c('0x88')]()[_0xdf3c('0x89')]('cm_hopper')[_0xdf3c('0x8b')]([_0xdf3c('0x8f'),_0xdf3c('0x8c'),_0xdf3c('0x8d'),_0xdf3c('0x8e'),'VoiceQueueId',_0xdf3c('0x48'),_0xdf3c('0x47')],squel[_0xdf3c('0x6e')]()[_0xdf3c('0x6f')](_0xdf3c('0x8f'),_0xdf3c('0x8f'))[_0xdf3c('0x6f')]('\x27'+_0x3e2a89+'\x27','scheduledAt')[_0xdf3c('0x6f')]('id',_0xdf3c('0x8d'))[_0xdf3c('0x6f')](_0xb852c5['CmListId'][_0xdf3c('0x91')](),'ListId')[_0xdf3c('0x6f')](_0x42d720[_0xdf3c('0x2f')]['id']['toString'](),_0xdf3c('0x4f'))[_0xdf3c('0x6f')]('\x27'+_0x3e2a89+'\x27',_0xdf3c('0x48'))[_0xdf3c('0x6f')]('\x27'+_0x3e2a89+'\x27',_0xdf3c('0x47'))[_0xdf3c('0x70')](_0xdf3c('0x92'))[_0xdf3c('0x29')](_0xdf3c('0x93'))[_0xdf3c('0x29')](_0xdf3c('0x99'),_0xb852c5[_0xdf3c('0x90')]['toString']())[_0xdf3c('0x29')]('phone\x20IS\x20NOT\x20NULL'))['toString']();}_0x43fc55['push'](db['sequelize'][_0xdf3c('0x2b')](_0x2cf46));}return BPromise[_0xdf3c('0x78')](_0x43fc55);}})[_0xdf3c('0x19')](function(){var _0x1eb736=[];var _0x321ff1=squel[_0xdf3c('0x88')]()['into'](_0xdf3c('0x9a'))['fromQuery']([_0xdf3c('0x9b'),_0xdf3c('0x8f'),_0xdf3c('0x9c'),_0xdf3c('0x48'),_0xdf3c('0x47')],squel[_0xdf3c('0x6e')]()[_0xdf3c('0x6f')](_0xdf3c('0x9d'))[_0xdf3c('0x6f')]('ci.item')[_0xdf3c('0x6f')](_0xdf3c('0x9e'))[_0xdf3c('0x6f')]('\x27'+_0x3e2a89+'\x27',_0xdf3c('0x48'))['field']('\x27'+_0x3e2a89+'\x27','updatedAt')[_0xdf3c('0x70')](_0xdf3c('0x9f'),'ci')[_0xdf3c('0x72')](_0xdf3c('0x8a'),'h','h.ContactId=ci.CmContactId')[_0xdf3c('0x29')](_0xdf3c('0xa0'),_0x3e2a89)[_0xdf3c('0x29')](_0xdf3c('0xa1'),_0xdf3c('0xa2')))[_0xdf3c('0x91')]();_0x1eb736[_0xdf3c('0x75')](db['sequelize'][_0xdf3c('0x2b')](_0x321ff1));return BPromise[_0xdf3c('0x78')](_0x1eb736);})[_0xdf3c('0x19')](function(){return _0x4f4afd;})[_0xdf3c('0x19')](respondWithResult(_0x2da908,null))[_0xdf3c('0x2e')](handleError(_0x2da908,null));};exports[_0xdf3c('0xa3')]=function(_0x51404d,_0x4cfc67){return db[_0xdf3c('0x26')][_0xdf3c('0x39')]({'where':{'id':_0x51404d[_0xdf3c('0x2f')]['id']}})[_0xdf3c('0x19')](handleEntityNotFound(_0x4cfc67,null))[_0xdf3c('0x19')](function(_0x5e06a2){if(_0x5e06a2){return _0x5e06a2[_0xdf3c('0xa3')](_0x51404d[_0xdf3c('0x2b')][_0xdf3c('0x6d')]);}})[_0xdf3c('0x19')](function(_0x2cab31){if(_0x2cab31){return db[_0xdf3c('0x50')]['destroy']({'where':{'ListId':_0x51404d[_0xdf3c('0x2b')][_0xdf3c('0x6d')],'VoiceQueueId':_0x51404d['params']['id']}})[_0xdf3c('0x19')](function(){return _0x2cab31;});}})['then'](respondWithStatusCode(_0x4cfc67,null))[_0xdf3c('0x2e')](handleError(_0x4cfc67,null));};exports[_0xdf3c('0xa4')]=function(_0xa6fa19,_0x16b173){var _0x578e41={};var _0x4815ee={};var _0xa523c8;var _0x52ae27;return db[_0xdf3c('0x26')][_0xdf3c('0x4a')]({'where':{'id':_0xa6fa19[_0xdf3c('0x2f')]['id']}})['then'](handleEntityNotFound(_0x16b173,null))[_0xdf3c('0x19')](function(_0x148785){if(_0x148785){_0xa523c8=_0x148785;_0x4815ee[_0xdf3c('0x34')]=_[_0xdf3c('0x30')](db['CmList']['rawAttributes']);_0x4815ee[_0xdf3c('0x2b')]=_['keys'](_0xa6fa19[_0xdf3c('0x2b')]);_0x4815ee[_0xdf3c('0x31')]=_[_0xdf3c('0x32')](_0x4815ee[_0xdf3c('0x34')],_0x4815ee[_0xdf3c('0x2b')]);_0x578e41['attributes']=_[_0xdf3c('0x32')](_0x4815ee[_0xdf3c('0x34')],qs[_0xdf3c('0x35')](_0xa6fa19['query'][_0xdf3c('0x35')]));_0x578e41[_0xdf3c('0x33')]=_0x578e41[_0xdf3c('0x33')][_0xdf3c('0x36')]?_0x578e41[_0xdf3c('0x33')]:_0x4815ee[_0xdf3c('0x34')];_0x578e41[_0xdf3c('0x4c')]=qs['sort'](_0xa6fa19['query'][_0xdf3c('0x4d')]);_0x578e41['where']=qs[_0xdf3c('0x31')](_[_0xdf3c('0x4e')](_0xa6fa19[_0xdf3c('0x2b')],_0x4815ee[_0xdf3c('0x31')]));if(_0xa6fa19['query'][_0xdf3c('0x1f')]){_0x578e41['where']=_[_0xdf3c('0x45')](_0x578e41['where'],{'$or':_[_0xdf3c('0x20')](_0x578e41[_0xdf3c('0x33')],function(_0x36fb96){var _0x2ac2ca={};_0x2ac2ca[_0x36fb96]={'$like':'%'+_0xa6fa19[_0xdf3c('0x2b')][_0xdf3c('0x1f')]+'%'};return _0x2ac2ca;})});}_0x578e41=_[_0xdf3c('0x45')]({},_0x578e41,_0xa6fa19['options']);return _0xa523c8[_0xdf3c('0xa4')](_0x578e41);}})[_0xdf3c('0x19')](function(_0x25d312){if(_0x25d312){_0x52ae27=_0x25d312[_0xdf3c('0x36')];if(!_0xa6fa19['query'][_0xdf3c('0x4b')](_0xdf3c('0x55'))){_0x578e41[_0xdf3c('0x14')]=qs[_0xdf3c('0x14')](_0xa6fa19[_0xdf3c('0x2b')]['limit']);_0x578e41['offset']=qs['offset'](_0xa6fa19[_0xdf3c('0x2b')]['offset']);}return _0xa523c8[_0xdf3c('0xa4')](_0x578e41);}})['then'](function(_0xbbc217){if(_0xbbc217){return _0xbbc217?{'count':_0x52ae27,'rows':_0xbbc217}:null;}})[_0xdf3c('0x19')](respondWithResult(_0x16b173,null))[_0xdf3c('0x2e')](handleError(_0x16b173,null));};exports['addBlackLists']=function(_0x47d44e,_0x4dd133){var _0x2b8425;return db[_0xdf3c('0x26')]['find']({'where':{'id':_0x47d44e[_0xdf3c('0x2f')]['id']}})[_0xdf3c('0x19')](handleEntityNotFound(_0x4dd133,null))[_0xdf3c('0x19')](function(_0x4009e0){if(_0x4009e0){return _0x4009e0[_0xdf3c('0xa5')](_0x47d44e[_0xdf3c('0x3b')][_0xdf3c('0x6d')],_[_0xdf3c('0x46')](_0x47d44e['body'],[_0xdf3c('0x6d'),'id'])||{});}return null;})[_0xdf3c('0x7d')](function(_0x37e578){var _0x11436f;_0x2b8425=_0x37e578||[];var _0x1d66b6=[];if(_0x37e578){for(var _0x4b4bab=0x0;_0x4b4bab<_0x37e578[_0xdf3c('0x36')];_0x4b4bab+=0x1){var _0x290778=_0x37e578[_0x4b4bab][_0xdf3c('0x1b')]({'plain':!![]});_0x11436f=squel[_0xdf3c('0x88')]()[_0xdf3c('0x89')](_0xdf3c('0xa6'))['fromQuery']([_0xdf3c('0x8f'),'ContactId',_0xdf3c('0x8e'),_0xdf3c('0x4f'),_0xdf3c('0x48'),_0xdf3c('0x47')],squel[_0xdf3c('0x6e')]()[_0xdf3c('0x6f')](_0xdf3c('0x8f'),_0xdf3c('0x8f'))[_0xdf3c('0x6f')]('id','ContactId')[_0xdf3c('0x6f')](_0x290778[_0xdf3c('0x90')][_0xdf3c('0x91')](),'ListId')[_0xdf3c('0x6f')](_0x47d44e['params']['id'][_0xdf3c('0x91')](),_0xdf3c('0x4f'))[_0xdf3c('0x6f')](_0xdf3c('0xa7'),_0xdf3c('0x48'))[_0xdf3c('0x6f')](_0xdf3c('0xa7'),_0xdf3c('0x47'))[_0xdf3c('0x70')](_0xdf3c('0x92'))[_0xdf3c('0x29')](_0xdf3c('0x93'))['where']('ListId\x20=\x20?',_0x290778['CmListId'][_0xdf3c('0x91')]())[_0xdf3c('0x29')](_0xdf3c('0x94')))[_0xdf3c('0x91')]();_0x1d66b6[_0xdf3c('0x75')](db[_0xdf3c('0x76')][_0xdf3c('0x2b')](_0x11436f));}return BPromise[_0xdf3c('0x78')](_0x1d66b6);}})[_0xdf3c('0x19')](function(){return _0x2b8425;})[_0xdf3c('0x19')](respondWithResult(_0x4dd133,null))[_0xdf3c('0x2e')](handleError(_0x4dd133,null));};exports[_0xdf3c('0xa8')]=function(_0xc5ac78,_0x567748){return db['VoiceQueue'][_0xdf3c('0x39')]({'where':{'id':_0xc5ac78[_0xdf3c('0x2f')]['id']}})[_0xdf3c('0x19')](handleEntityNotFound(_0x567748,null))['then'](function(_0x290a39){if(_0x290a39){return _0x290a39['removeBlackLists'](_0xc5ac78[_0xdf3c('0x2b')][_0xdf3c('0x6d')]);}})['then'](function(_0xabf05c){if(_0xabf05c){return db[_0xdf3c('0x57')][_0xdf3c('0x1a')]({'where':{'ListId':_0xc5ac78[_0xdf3c('0x2b')][_0xdf3c('0x6d')],'VoiceQueueId':_0xc5ac78[_0xdf3c('0x2f')]['id']}})[_0xdf3c('0x19')](function(){return _0xabf05c;});}})[_0xdf3c('0x19')](respondWithStatusCode(_0x567748,null))['catch'](handleError(_0x567748,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 63052dd..8796939 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 _0x3071=['remove','emit','exports','../../mysqldb','VoiceQueue','setMaxListeners','save','update'];(function(_0x1787ce,_0x4cbc90){var _0x150c53=function(_0x7ffaaf){while(--_0x7ffaaf){_0x1787ce['push'](_0x1787ce['shift']());}};_0x150c53(++_0x4cbc90);}(_0x3071,0x10b));var _0x1307=function(_0x1ee351,_0x54261b){_0x1ee351=_0x1ee351-0x0;var _0x245aaf=_0x3071[_0x1ee351];return _0x245aaf;};'use strict';var EventEmitter=require('events');var VoiceQueue=require(_0x1307('0x0'))['db'][_0x1307('0x1')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x1307('0x2')](0x0);var events={'afterCreate':_0x1307('0x3'),'afterUpdate':_0x1307('0x4'),'afterDestroy':_0x1307('0x5')};function emitEvent(_0x5d6b4b){return function(_0xb7ea51,_0x378de1,_0x481c3e){VoiceQueueEvents[_0x1307('0x6')](_0x5d6b4b+':'+_0xb7ea51['id'],_0xb7ea51);VoiceQueueEvents[_0x1307('0x6')](_0x5d6b4b,_0xb7ea51);_0x481c3e(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueue['hook'](e,emitEvent(event));}}module[_0x1307('0x7')]=VoiceQueueEvents; \ No newline at end of file +var _0xf596=['VoiceQueue','setMaxListeners','save','update','remove','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x3c3fa9,_0x287f28){var _0x3f3eaf=function(_0x3dd872){while(--_0x3dd872){_0x3c3fa9['push'](_0x3c3fa9['shift']());}};_0x3f3eaf(++_0x287f28);}(_0xf596,0x1a5));var _0x6f59=function(_0x51de2e,_0x15ae65){_0x51de2e=_0x51de2e-0x0;var _0x4f59c4=_0xf596[_0x51de2e];return _0x4f59c4;};'use strict';var EventEmitter=require(_0x6f59('0x0'));var VoiceQueue=require(_0x6f59('0x1'))['db'][_0x6f59('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x6f59('0x3')](0x0);var events={'afterCreate':_0x6f59('0x4'),'afterUpdate':_0x6f59('0x5'),'afterDestroy':_0x6f59('0x6')};function emitEvent(_0x485a42){return function(_0x40b1c9,_0x3b1c76,_0x4b9ba2){VoiceQueueEvents['emit'](_0x485a42+':'+_0x40b1c9['id'],_0x40b1c9);VoiceQueueEvents['emit'](_0x485a42,_0x40b1c9);_0x4b9ba2(null);};}for(var e in events){if(events[_0x6f59('0x7')](e)){var event=events[e];VoiceQueue[_0x6f59('0x8')](e,emitEvent(event));}}module['exports']=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index 4542f30..e699732 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 _0xa9e0=['../../config/environment','./voiceQueue.attributes','exports','define','VoiceQueue','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x22118c,_0x316449){var _0x1f7712=function(_0x1e237d){while(--_0x1e237d){_0x22118c['push'](_0x22118c['shift']());}};_0x1f7712(++_0x316449);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0xa9e0[_0x3054be];return _0x3df150;};'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':'voice_queues','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(_0x5933fb,_0x9115ad){var _0x44d988=function(_0x295228){while(--_0x295228){_0x5933fb['push'](_0x5933fb['shift']());}};_0x44d988(++_0x9115ad);}(_0x008c,0x188));var _0xc008=function(_0x3a6930,_0x1d329e){_0x3a6930=_0x3a6930-0x0;var _0x9ebbe8=_0x008c[_0x3a6930];return _0x9ebbe8;};'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 358fb4f..50f284e 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 _0xb886=['redis','defaults','register','request','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetVoiceQueue','VoiceQueue','findAll','options','where','limit','include','map','model','attributes','then','ShowVoiceQueue','find','raw','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x9be508,_0x10c8ba){var _0x16f3c3=function(_0x35c330){while(--_0x35c330){_0x9be508['push'](_0x9be508['shift']());}};_0x16f3c3(++_0x10c8ba);}(_0xb886,0x126));var _0x6b88=function(_0x1cd0a1,_0x3c3281){_0x1cd0a1=_0x1cd0a1-0x0;var _0x18c4ec=_0xb886[_0x1cd0a1];return _0x18c4ec;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x6b88('0x0'));var BPromise=require('bluebird');var rs=require(_0x6b88('0x1'));var fs=require('fs');var Redis=require(_0x6b88('0x2'));var db=require(_0x6b88('0x3'))['db'];var utils=require(_0x6b88('0x4'));var logger=require(_0x6b88('0x5'))(_0x6b88('0x6'));var config=require(_0x6b88('0x7'));var jayson=require(_0x6b88('0x8'));var client=jayson['client'][_0x6b88('0x9')]({'port':0x232a});config[_0x6b88('0xa')]=_[_0x6b88('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6b88('0xa')]));require('./voiceQueue.socket')[_0x6b88('0xc')](socket);function respondWithRpcPromise(_0x57e3ad,_0x239072,_0x4cebdf){return new BPromise(function(_0x9b5f8e,_0xb7547c){return client[_0x6b88('0xd')](_0x57e3ad,_0x4cebdf)['then'](function(_0x1e389d){logger[_0x6b88('0xe')](_0x6b88('0xf'),_0x239072,_0x6b88('0x10'));logger[_0x6b88('0x11')](_0x6b88('0x12'),_0x239072,_0x6b88('0x10'),JSON[_0x6b88('0x13')](_0x1e389d));if(_0x1e389d[_0x6b88('0x14')]){if(_0x1e389d['error'][_0x6b88('0x15')]===0x1f4){logger['error']('VoiceQueue,\x20%s,\x20%s',_0x239072,_0x1e389d['error']['message']);return _0xb7547c(_0x1e389d[_0x6b88('0x14')][_0x6b88('0x16')]);}logger[_0x6b88('0x14')](_0x6b88('0xf'),_0x239072,_0x1e389d[_0x6b88('0x14')]['message']);return _0x9b5f8e(_0x1e389d['error']['message']);}else{logger['info'](_0x6b88('0xf'),_0x239072,_0x6b88('0x10'));_0x9b5f8e(_0x1e389d['result'][_0x6b88('0x16')]);}})[_0x6b88('0x17')](function(_0x4e0ce4){logger[_0x6b88('0x14')]('VoiceQueue,\x20%s,\x20%s',_0x239072,_0x4e0ce4);_0xb7547c(_0x4e0ce4);});});}exports[_0x6b88('0x18')]=function(_0x5b46b3){var _0x595244=this;return new Promise(function(_0x42d7f0,_0x282e3e){return db[_0x6b88('0x19')][_0x6b88('0x1a')]({'raw':_0x5b46b3['options']?_0x5b46b3['options']['raw']===undefined?!![]:![]:!![],'where':_0x5b46b3[_0x6b88('0x1b')]?_0x5b46b3['options'][_0x6b88('0x1c')]||null:null,'attributes':_0x5b46b3[_0x6b88('0x1b')]?_0x5b46b3[_0x6b88('0x1b')]['attributes']||null:null,'limit':_0x5b46b3[_0x6b88('0x1b')]?_0x5b46b3[_0x6b88('0x1b')][_0x6b88('0x1d')]||null:null,'include':_0x5b46b3[_0x6b88('0x1b')]?_0x5b46b3[_0x6b88('0x1b')][_0x6b88('0x1e')]?_[_0x6b88('0x1f')](_0x5b46b3['options'][_0x6b88('0x1e')],function(_0x21bd8f){return{'model':db[_0x21bd8f[_0x6b88('0x20')]],'as':_0x21bd8f['as'],'attributes':_0x21bd8f[_0x6b88('0x21')],'include':_0x21bd8f[_0x6b88('0x1e')]?_['map'](_0x21bd8f['include'],function(_0x212ebc){return{'model':db[_0x212ebc[_0x6b88('0x20')]],'as':_0x212ebc['as'],'attributes':_0x212ebc[_0x6b88('0x21')],'include':_0x212ebc[_0x6b88('0x1e')]?_[_0x6b88('0x1f')](_0x212ebc[_0x6b88('0x1e')],function(_0x35042f){return{'model':db[_0x35042f[_0x6b88('0x20')]],'as':_0x35042f['as'],'attributes':_0x35042f['attributes']};}):[]};}):[]};}):[]:[]})[_0x6b88('0x22')](function(_0x15c657){logger['info'](_0x6b88('0x18'),_0x5b46b3);logger['debug'](_0x6b88('0x18'),_0x5b46b3,JSON['stringify'](_0x15c657));_0x42d7f0(_0x15c657);})[_0x6b88('0x17')](function(_0x3fc7c5){logger[_0x6b88('0x14')](_0x6b88('0x18'),_0x3fc7c5['message'],_0x5b46b3);_0x282e3e(_0x595244['error'](0x1f4,_0x3fc7c5[_0x6b88('0x16')]));});});};exports[_0x6b88('0x23')]=function(_0xed206e){var _0x551d57=this;return new Promise(function(_0x1d3c79,_0x30ab7f){return db['VoiceQueue'][_0x6b88('0x24')]({'raw':_0xed206e[_0x6b88('0x1b')]?_0xed206e[_0x6b88('0x1b')][_0x6b88('0x25')]===undefined?!![]:![]:!![],'where':_0xed206e[_0x6b88('0x1b')]?_0xed206e[_0x6b88('0x1b')][_0x6b88('0x1c')]||null:null,'attributes':_0xed206e[_0x6b88('0x1b')]?_0xed206e[_0x6b88('0x1b')][_0x6b88('0x21')]||null:null,'include':_0xed206e[_0x6b88('0x1b')]?_0xed206e['options'][_0x6b88('0x1e')]?_[_0x6b88('0x1f')](_0xed206e[_0x6b88('0x1b')][_0x6b88('0x1e')],function(_0x446d32){return{'model':db[_0x446d32[_0x6b88('0x20')]],'as':_0x446d32['as'],'attributes':_0x446d32[_0x6b88('0x21')],'include':_0x446d32[_0x6b88('0x1e')]?_[_0x6b88('0x1f')](_0x446d32[_0x6b88('0x1e')],function(_0x1c693d){return{'model':db[_0x1c693d[_0x6b88('0x20')]],'as':_0x1c693d['as'],'attributes':_0x1c693d[_0x6b88('0x21')],'include':_0x1c693d['include']?_[_0x6b88('0x1f')](_0x1c693d['include'],function(_0x3f1171){return{'model':db[_0x3f1171['model']],'as':_0x3f1171['as'],'attributes':_0x3f1171[_0x6b88('0x21')]};}):[]};}):[]};}):[]:[]})[_0x6b88('0x22')](function(_0x597ca6){logger[_0x6b88('0xe')](_0x6b88('0x23'),_0xed206e);logger['debug'](_0x6b88('0x23'),_0xed206e,JSON[_0x6b88('0x13')](_0x597ca6));_0x1d3c79(_0x597ca6);})[_0x6b88('0x17')](function(_0x5c6247){logger[_0x6b88('0x14')](_0x6b88('0x23'),_0x5c6247[_0x6b88('0x16')],_0xed206e);_0x30ab7f(_0x551d57[_0x6b88('0x14')](0x1f4,_0x5c6247['message']));});});}; \ No newline at end of file +var _0x6d57=['request','then','info','VoiceQueue,\x20%s,\x20%s','VoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','GetVoiceQueue','VoiceQueue','findAll','options','where','limit','map','include','model','attributes','debug','catch','ShowVoiceQueue','find','raw','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','defaults','redis','socket.io-emitter','./voiceQueue.socket','register'];(function(_0x246f0a,_0x12a607){var _0x37afed=function(_0x196e04){while(--_0x196e04){_0x246f0a['push'](_0x246f0a['shift']());}};_0x37afed(++_0x12a607);}(_0x6d57,0xbe));var _0x76d5=function(_0x44a750,_0x1b9410){_0x44a750=_0x44a750-0x0;var _0x17e920=_0x6d57[_0x44a750];return _0x17e920;};'use strict';var _=require(_0x76d5('0x0'));var util=require('util');var moment=require(_0x76d5('0x1'));var BPromise=require(_0x76d5('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x76d5('0x3'));var db=require(_0x76d5('0x4'))['db'];var utils=require(_0x76d5('0x5'));var logger=require(_0x76d5('0x6'))('rpc');var config=require(_0x76d5('0x7'));var jayson=require(_0x76d5('0x8'));var client=jayson[_0x76d5('0x9')]['http']({'port':0x232a});config['redis']=_[_0x76d5('0xa')](config[_0x76d5('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x76d5('0xc'))(new Redis(config[_0x76d5('0xb')]));require(_0x76d5('0xd'))[_0x76d5('0xe')](socket);function respondWithRpcPromise(_0x105380,_0x1be3ae,_0x8f85a7){return new BPromise(function(_0x529743,_0x279326){return client[_0x76d5('0xf')](_0x105380,_0x8f85a7)[_0x76d5('0x10')](function(_0x2f604b){logger[_0x76d5('0x11')](_0x76d5('0x12'),_0x1be3ae,'request\x20sent');logger['debug'](_0x76d5('0x13'),_0x1be3ae,_0x76d5('0x14'),JSON[_0x76d5('0x15')](_0x2f604b));if(_0x2f604b[_0x76d5('0x16')]){if(_0x2f604b[_0x76d5('0x16')][_0x76d5('0x17')]===0x1f4){logger['error'](_0x76d5('0x12'),_0x1be3ae,_0x2f604b[_0x76d5('0x16')]['message']);return _0x279326(_0x2f604b['error'][_0x76d5('0x18')]);}logger[_0x76d5('0x16')](_0x76d5('0x12'),_0x1be3ae,_0x2f604b[_0x76d5('0x16')][_0x76d5('0x18')]);return _0x529743(_0x2f604b[_0x76d5('0x16')]['message']);}else{logger[_0x76d5('0x11')](_0x76d5('0x12'),_0x1be3ae,_0x76d5('0x14'));_0x529743(_0x2f604b[_0x76d5('0x19')][_0x76d5('0x18')]);}})['catch'](function(_0x1f48dc){logger[_0x76d5('0x16')]('VoiceQueue,\x20%s,\x20%s',_0x1be3ae,_0x1f48dc);_0x279326(_0x1f48dc);});});}exports[_0x76d5('0x1a')]=function(_0x276572){var _0x74adbf=this;return new Promise(function(_0x4125cb,_0x391973){return db[_0x76d5('0x1b')][_0x76d5('0x1c')]({'raw':_0x276572['options']?_0x276572['options']['raw']===undefined?!![]:![]:!![],'where':_0x276572[_0x76d5('0x1d')]?_0x276572['options'][_0x76d5('0x1e')]||null:null,'attributes':_0x276572['options']?_0x276572[_0x76d5('0x1d')]['attributes']||null:null,'limit':_0x276572[_0x76d5('0x1d')]?_0x276572[_0x76d5('0x1d')][_0x76d5('0x1f')]||null:null,'include':_0x276572[_0x76d5('0x1d')]?_0x276572[_0x76d5('0x1d')]['include']?_[_0x76d5('0x20')](_0x276572[_0x76d5('0x1d')][_0x76d5('0x21')],function(_0x3da38f){return{'model':db[_0x3da38f[_0x76d5('0x22')]],'as':_0x3da38f['as'],'attributes':_0x3da38f[_0x76d5('0x23')],'include':_0x3da38f[_0x76d5('0x21')]?_[_0x76d5('0x20')](_0x3da38f[_0x76d5('0x21')],function(_0x44403d){return{'model':db[_0x44403d[_0x76d5('0x22')]],'as':_0x44403d['as'],'attributes':_0x44403d[_0x76d5('0x23')],'include':_0x44403d[_0x76d5('0x21')]?_[_0x76d5('0x20')](_0x44403d[_0x76d5('0x21')],function(_0x5b058a){return{'model':db[_0x5b058a['model']],'as':_0x5b058a['as'],'attributes':_0x5b058a['attributes']};}):[]};}):[]};}):[]:[]})[_0x76d5('0x10')](function(_0x180649){logger[_0x76d5('0x11')](_0x76d5('0x1a'),_0x276572);logger[_0x76d5('0x24')](_0x76d5('0x1a'),_0x276572,JSON[_0x76d5('0x15')](_0x180649));_0x4125cb(_0x180649);})[_0x76d5('0x25')](function(_0x3f0ee3){logger['error'](_0x76d5('0x1a'),_0x3f0ee3[_0x76d5('0x18')],_0x276572);_0x391973(_0x74adbf['error'](0x1f4,_0x3f0ee3['message']));});});};exports[_0x76d5('0x26')]=function(_0x3e6b6d){var _0xcd3688=this;return new Promise(function(_0x6625e6,_0x444d02){return db[_0x76d5('0x1b')][_0x76d5('0x27')]({'raw':_0x3e6b6d[_0x76d5('0x1d')]?_0x3e6b6d[_0x76d5('0x1d')][_0x76d5('0x28')]===undefined?!![]:![]:!![],'where':_0x3e6b6d['options']?_0x3e6b6d[_0x76d5('0x1d')][_0x76d5('0x1e')]||null:null,'attributes':_0x3e6b6d['options']?_0x3e6b6d[_0x76d5('0x1d')][_0x76d5('0x23')]||null:null,'include':_0x3e6b6d[_0x76d5('0x1d')]?_0x3e6b6d[_0x76d5('0x1d')][_0x76d5('0x21')]?_[_0x76d5('0x20')](_0x3e6b6d[_0x76d5('0x1d')][_0x76d5('0x21')],function(_0x6c002c){return{'model':db[_0x6c002c[_0x76d5('0x22')]],'as':_0x6c002c['as'],'attributes':_0x6c002c['attributes'],'include':_0x6c002c[_0x76d5('0x21')]?_[_0x76d5('0x20')](_0x6c002c[_0x76d5('0x21')],function(_0x265b17){return{'model':db[_0x265b17[_0x76d5('0x22')]],'as':_0x265b17['as'],'attributes':_0x265b17[_0x76d5('0x23')],'include':_0x265b17[_0x76d5('0x21')]?_[_0x76d5('0x20')](_0x265b17[_0x76d5('0x21')],function(_0x5ac87a){return{'model':db[_0x5ac87a[_0x76d5('0x22')]],'as':_0x5ac87a['as'],'attributes':_0x5ac87a[_0x76d5('0x23')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3f11c9){logger[_0x76d5('0x11')](_0x76d5('0x26'),_0x3e6b6d);logger[_0x76d5('0x24')](_0x76d5('0x26'),_0x3e6b6d,JSON[_0x76d5('0x15')](_0x3f11c9));_0x6625e6(_0x3f11c9);})['catch'](function(_0x4d17aa){logger['error']('ShowVoiceQueue',_0x4d17aa[_0x76d5('0x18')],_0x3e6b6d);_0x444d02(_0xcd3688[_0x76d5('0x16')](0x1f4,_0x4d17aa['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 9b03c3b..8a78960 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 _0x0d5b=['length','./voiceQueue.events','save','remove','update','removeListener','register'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x0d5b,0x189));var _0xb0d5=function(_0x24259d,_0x64a194){_0x24259d=_0x24259d-0x0;var _0x5a701=_0x0d5b[_0x24259d];return _0x5a701;};'use strict';var VoiceQueueEvents=require(_0xb0d5('0x0'));var events=[_0xb0d5('0x1'),_0xb0d5('0x2'),_0xb0d5('0x3')];function createListener(_0x3ffca6,_0x187b99){return function(_0x3d05bf){_0x187b99['emit'](_0x3ffca6,_0x3d05bf);};}function removeListener(_0x16acff,_0x389fef){return function(){VoiceQueueEvents[_0xb0d5('0x4')](_0x16acff,_0x389fef);};}exports[_0xb0d5('0x5')]=function(_0x3c2070){for(var _0x4a2858=0x0,_0x5e2a66=events[_0xb0d5('0x6')];_0x4a2858<_0x5e2a66;_0x4a2858++){var _0x5c3ed9=events[_0x4a2858];var _0xf15c08=createListener('voiceQueue:'+_0x5c3ed9,_0x3c2070);VoiceQueueEvents['on'](_0x5c3ed9,_0xf15c08);}}; \ No newline at end of file +var _0xd7d7=['voiceQueue:','./voiceQueue.events','save','remove','update','register','length'];(function(_0x182ef5,_0x3439f8){var _0x3e1d9a=function(_0x129bd5){while(--_0x129bd5){_0x182ef5['push'](_0x182ef5['shift']());}};_0x3e1d9a(++_0x3439f8);}(_0xd7d7,0x15f));var _0x7d7d=function(_0x169f28,_0x22f5ab){_0x169f28=_0x169f28-0x0;var _0x266fd4=_0xd7d7[_0x169f28];return _0x266fd4;};'use strict';var VoiceQueueEvents=require(_0x7d7d('0x0'));var events=[_0x7d7d('0x1'),_0x7d7d('0x2'),_0x7d7d('0x3')];function createListener(_0x2a9fa1,_0x1f76ea){return function(_0x24e8af){_0x1f76ea['emit'](_0x2a9fa1,_0x24e8af);};}function removeListener(_0x2444c6,_0x1c51b8){return function(){VoiceQueueEvents['removeListener'](_0x2444c6,_0x1c51b8);};}exports[_0x7d7d('0x4')]=function(_0xcb84a1){for(var _0x217c6e=0x0,_0x397ed8=events[_0x7d7d('0x5')];_0x217c6e<_0x397ed8;_0x217c6e++){var _0x50a3c3=events[_0x217c6e];var _0x1311bc=createListener(_0x7d7d('0x6')+_0x50a3c3,_0xcb84a1);VoiceQueueEvents['on'](_0x50a3c3,_0x1311bc);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index b61d3c2..0d31feb 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 _0x7d78=['connect-timeout','../../components/auth/service','../../components/interaction/service','./voiceQueueReport.controller','get','isAuthenticated','index','/describe','describe','/index','/:id','show','post','put','update','destroy','exports','multer','util','path'];(function(_0x226558,_0x434119){var _0x4d177b=function(_0x1f911f){while(--_0x1f911f){_0x226558['push'](_0x226558['shift']());}};_0x4d177b(++_0x434119);}(_0x7d78,0x129));var _0x87d7=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x7d78[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x87d7('0x0'));var util=require(_0x87d7('0x1'));var path=require(_0x87d7('0x2'));var timeout=require(_0x87d7('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x87d7('0x4'));var interaction=require(_0x87d7('0x5'));var config=require('../../config/environment');var controller=require(_0x87d7('0x6'));router[_0x87d7('0x7')]('/',auth[_0x87d7('0x8')](),controller[_0x87d7('0x9')]);router['get'](_0x87d7('0xa'),auth[_0x87d7('0x8')](),controller[_0x87d7('0xb')]);router[_0x87d7('0x7')](_0x87d7('0xc'),auth[_0x87d7('0x8')](),controller['getVoiceQueuesReport']);router[_0x87d7('0x7')](_0x87d7('0xd'),auth['isAuthenticated'](),controller[_0x87d7('0xe')]);router[_0x87d7('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0x87d7('0x10')]('/:id',auth[_0x87d7('0x8')](),controller[_0x87d7('0x11')]);router['delete']('/:id',auth[_0x87d7('0x8')](),controller[_0x87d7('0x12')]);module[_0x87d7('0x13')]=router; \ No newline at end of file +var _0xf71d=['/index','/:id','show','post','create','put','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe'];(function(_0x548826,_0x1e5817){var _0x2c9018=function(_0x37722c){while(--_0x37722c){_0x548826['push'](_0x548826['shift']());}};_0x2c9018(++_0x1e5817);}(_0xf71d,0x169));var _0xdf71=function(_0xc0a3d3,_0x2c8d00){_0xc0a3d3=_0xc0a3d3-0x0;var _0x3386e8=_0xf71d[_0xc0a3d3];return _0x3386e8;};'use strict';var multer=require('multer');var util=require(_0xdf71('0x0'));var path=require(_0xdf71('0x1'));var timeout=require(_0xdf71('0x2'));var express=require(_0xdf71('0x3'));var router=express[_0xdf71('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xdf71('0x5'));var interaction=require(_0xdf71('0x6'));var config=require(_0xdf71('0x7'));var controller=require('./voiceQueueReport.controller');router[_0xdf71('0x8')]('/',auth[_0xdf71('0x9')](),controller[_0xdf71('0xa')]);router['get'](_0xdf71('0xb'),auth[_0xdf71('0x9')](),controller[_0xdf71('0xc')]);router[_0xdf71('0x8')](_0xdf71('0xd'),auth[_0xdf71('0x9')](),controller['getVoiceQueuesReport']);router[_0xdf71('0x8')](_0xdf71('0xe'),auth[_0xdf71('0x9')](),controller[_0xdf71('0xf')]);router[_0xdf71('0x10')]('/',auth[_0xdf71('0x9')](),controller[_0xdf71('0x11')]);router[_0xdf71('0x12')](_0xdf71('0xe'),auth['isAuthenticated'](),controller['update']);router[_0xdf71('0x13')](_0xdf71('0xe'),auth[_0xdf71('0x9')](),controller[_0xdf71('0x14')]);module[_0xdf71('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index c08a3ee..745f374 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 _0xa289=['BOOLEAN','INTEGER','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','exports','STRING','DATE','getDataValue','queuecallerjoinAt','format','diff','seconds','setDataValue','holdtime'];(function(_0x1e24ed,_0x15ba65){var _0xc158c1=function(_0x4e3643){while(--_0x4e3643){_0x1e24ed['push'](_0x1e24ed['shift']());}};_0xc158c1(++_0x15ba65);}(_0xa289,0x13e));var _0x9a28=function(_0x27a87f,_0x2f33f4){_0x27a87f=_0x27a87f-0x0;var _0x3322ac=_0xa289[_0x27a87f];return _0x3322ac;};'use strict';var Sequelize=require(_0x9a28('0x0'));var moment=require(_0x9a28('0x1'));module[_0x9a28('0x2')]={'type':{'type':Sequelize[_0x9a28('0x3')]},'uniqueid':{'type':Sequelize[_0x9a28('0x3')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x9a28('0x3')]},'queuecallerjoinAt':{'type':Sequelize[_0x9a28('0x4')]},'queuecallerleaveAt':{'type':Sequelize[_0x9a28('0x4')],'set':function(_0x21e6de){var _0x30324b=moment(_0x21e6de);var _0x2bc879=moment(this[_0x9a28('0x5')](_0x9a28('0x6')))[_0x9a28('0x7')]('YYYY-MM-DD\x20HH:mm:ss');var _0x450051=_0x30324b[_0x9a28('0x8')](_0x2bc879,_0x9a28('0x9'));this[_0x9a28('0xa')]('queuecallerleaveAt',_0x21e6de);this[_0x9a28('0xa')](_0x9a28('0xb'),_0x450051||null);}},'position':{'type':Sequelize['INTEGER']},'count':{'type':Sequelize['INTEGER']},'queuecallerabandon':{'type':Sequelize[_0x9a28('0xc')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x9a28('0x4')]},'queuecallercomplete':{'type':Sequelize[_0x9a28('0xc')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x9a28('0x4')]},'queuecallerexit':{'type':Sequelize[_0x9a28('0xc')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x9a28('0x4')]},'queuecallerexitreason':{'type':Sequelize[_0x9a28('0x3')],'comment':'COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'},'originalposition':{'type':Sequelize['INTEGER']},'channel':{'type':Sequelize[_0x9a28('0x3')]},'connectedlinenum':{'type':Sequelize[_0x9a28('0x3')]},'connectedlinename':{'type':Sequelize[_0x9a28('0x3')]},'accountcode':{'type':Sequelize[_0x9a28('0x3')]},'context':{'type':Sequelize[_0x9a28('0x3')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x9a28('0x3')]},'holdtime':{'type':Sequelize[_0x9a28('0xd')]},'mohtime':{'type':Sequelize[_0x9a28('0xd')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x9a28('0xc')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x9a28('0x3')]},'transfer':{'type':Sequelize[_0x9a28('0xc')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x9a28('0x3')],'comment':_0x9a28('0xe')},'transferexten':{'type':Sequelize[_0x9a28('0x3')]},'transferuniqueid':{'type':Sequelize[_0x9a28('0x3')]},'disposition':{'type':Sequelize[_0x9a28('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'queuecallerenterreason':{'type':Sequelize[_0x9a28('0xd')],'defaultValue':0x0},'note':{'type':Sequelize[_0x9a28('0x3')]}}; \ No newline at end of file +var _0x9ef1=['INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','moment','exports','STRING','DATE','getDataValue','queuecallerjoinAt','format','diff','seconds','queuecallerleaveAt','setDataValue','holdtime'];(function(_0x50146e,_0x1ddf0e){var _0x25611a=function(_0x1768a6){while(--_0x1768a6){_0x50146e['push'](_0x50146e['shift']());}};_0x25611a(++_0x1ddf0e);}(_0x9ef1,0xd5));var _0x19ef=function(_0x233067,_0x43c492){_0x233067=_0x233067-0x0;var _0x108074=_0x9ef1[_0x233067];return _0x108074;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x19ef('0x0'));module[_0x19ef('0x1')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x19ef('0x2')]},'calleridnum':{'type':Sequelize[_0x19ef('0x2')]},'calleridname':{'type':Sequelize[_0x19ef('0x2')]},'queue':{'type':Sequelize[_0x19ef('0x2')]},'queuecallerjoinAt':{'type':Sequelize['DATE']},'queuecallerleaveAt':{'type':Sequelize[_0x19ef('0x3')],'set':function(_0x51e42b){var _0xbce08e=moment(_0x51e42b);var _0x1f1730=moment(this[_0x19ef('0x4')](_0x19ef('0x5')))[_0x19ef('0x6')]('YYYY-MM-DD\x20HH:mm:ss');var _0x4e9416=_0xbce08e[_0x19ef('0x7')](_0x1f1730,_0x19ef('0x8'));this['setDataValue'](_0x19ef('0x9'),_0x51e42b);this[_0x19ef('0xa')](_0x19ef('0xb'),_0x4e9416||null);}},'position':{'type':Sequelize['INTEGER']},'count':{'type':Sequelize[_0x19ef('0xc')]},'queuecallerabandon':{'type':Sequelize[_0x19ef('0xd')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x19ef('0x3')]},'queuecallercomplete':{'type':Sequelize[_0x19ef('0xd')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x19ef('0x3')]},'queuecallerexit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x19ef('0x3')]},'queuecallerexitreason':{'type':Sequelize[_0x19ef('0x2')],'comment':'COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'},'originalposition':{'type':Sequelize[_0x19ef('0xc')]},'channel':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x19ef('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x19ef('0x2')]},'context':{'type':Sequelize[_0x19ef('0x2')]},'exten':{'type':Sequelize[_0x19ef('0x2')]},'priority':{'type':Sequelize['STRING']},'holdtime':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x19ef('0xd')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x19ef('0x2')]},'transfer':{'type':Sequelize[_0x19ef('0xd')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0x19ef('0xe')},'transferexten':{'type':Sequelize[_0x19ef('0x2')]},'transferuniqueid':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x19ef('0x2')]},'thirdDisposition':{'type':Sequelize['STRING']},'queuecallerenterreason':{'type':Sequelize[_0x19ef('0xc')],'defaultValue':0x0},'note':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index 5fe2a71..1552f31 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 _0x88d8=['querystring','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','status','json','offset','undefined','limit','count','Content-Range','apply','reject','update','destroy','end','sendStatus','error','stack','name','send','index','map','VoiceQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','then','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','getVoiceQueuesReport','hasOwnProperty','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js'];(function(_0x527fb9,_0x4620a0){var _0x12c752=function(_0x20d259){while(--_0x20d259){_0x527fb9['push'](_0x527fb9['shift']());}};_0x12c752(++_0x4620a0);}(_0x88d8,0xef));var _0x888d=function(_0x2dfea4,_0x36872d){_0x2dfea4=_0x2dfea4-0x0;var _0x583188=_0x88d8[_0x2dfea4];return _0x583188;};'use strict';var emlformat=require(_0x888d('0x0'));var rimraf=require(_0x888d('0x1'));var zipdir=require(_0x888d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x888d('0x3'));var moment=require(_0x888d('0x4'));var BPromise=require(_0x888d('0x5'));var Mustache=require(_0x888d('0x6'));var util=require(_0x888d('0x7'));var path=require(_0x888d('0x8'));var sox=require(_0x888d('0x9'));var csv=require(_0x888d('0xa'));var ejs=require(_0x888d('0xb'));var fs=require('fs');var fs_extra=require(_0x888d('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x888d('0xd'));var jsforce=require(_0x888d('0xe'));var deskjs=require(_0x888d('0xf'));var toCsv=require(_0x888d('0xa'));var querystring=require(_0x888d('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x888d('0x11'));var qs=require(_0x888d('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x888d('0x13'))(_0x888d('0x14'));var utils=require(_0x888d('0x15'));var config=require(_0x888d('0x16'));var licenseUtil=require(_0x888d('0x17'));var db=require('../../mysqldb')['db'];config[_0x888d('0x18')]=_[_0x888d('0x19')](config[_0x888d('0x18')],{'host':_0x888d('0x1a'),'port':0x18eb});var socket=require(_0x888d('0x1b'))(new Redis(config[_0x888d('0x18')]));require(_0x888d('0x1c'))[_0x888d('0x1d')](socket);function respondWithStatusCode(_0x183921,_0xada5a0){_0xada5a0=_0xada5a0||0xcc;return function(_0x1a5d78){if(_0x1a5d78){return _0x183921['sendStatus'](_0xada5a0);}return _0x183921['status'](_0xada5a0)['end']();};}function respondWithResult(_0x3f3670,_0x4e549d){_0x4e549d=_0x4e549d||0xc8;return function(_0x35747e){if(_0x35747e){return _0x3f3670[_0x888d('0x1e')](_0x4e549d)[_0x888d('0x1f')](_0x35747e);}};}function respondWithFilteredResult(_0xb97dda,_0xfc176b){return function(_0x1a63d3){if(_0x1a63d3){var _0x51861a=typeof _0xfc176b[_0x888d('0x20')]===_0x888d('0x21')&&typeof _0xfc176b[_0x888d('0x22')]===_0x888d('0x21');var _0x2b9ac2=_0x1a63d3[_0x888d('0x23')];var _0x1faa2c=_0x51861a?0x0:_0xfc176b[_0x888d('0x20')];var _0x2be17f=_0x51861a?_0x1a63d3[_0x888d('0x23')]:_0xfc176b['offset']+_0xfc176b[_0x888d('0x22')];var _0x2496dd;if(_0x2be17f>=_0x2b9ac2){_0x2be17f=_0x2b9ac2;_0x2496dd=0xc8;}else{_0x2496dd=0xce;}_0xb97dda['status'](_0x2496dd);return _0xb97dda['set'](_0x888d('0x24'),_0x1faa2c+'-'+_0x2be17f+'/'+_0x2b9ac2)[_0x888d('0x1f')](_0x1a63d3);}return null;};}function patchUpdates(_0x6b6673){return function(_0x464be2){try{jsonpatch[_0x888d('0x25')](_0x464be2,_0x6b6673,!![]);}catch(_0xf01167){return BPromise[_0x888d('0x26')](_0xf01167);}return _0x464be2['save']();};}function saveUpdates(_0x308eba,_0x257c5c){return function(_0x24dd80){if(_0x24dd80){return _0x24dd80[_0x888d('0x27')](_0x308eba)['then'](function(_0x255e44){return _0x255e44;});}return null;};}function removeEntity(_0x391c67,_0x24f00b){return function(_0x4c64a4){if(_0x4c64a4){return _0x4c64a4[_0x888d('0x28')]()['then'](function(){_0x391c67[_0x888d('0x1e')](0xcc)[_0x888d('0x29')]();});}};}function handleEntityNotFound(_0x30d3d4,_0x315e19){return function(_0x37cfde){if(!_0x37cfde){_0x30d3d4[_0x888d('0x2a')](0x194);}return _0x37cfde;};}function handleError(_0x10feeb,_0x295725){_0x295725=_0x295725||0x1f4;return function(_0x3e583f){logger[_0x888d('0x2b')](_0x3e583f[_0x888d('0x2c')]);if(_0x3e583f[_0x888d('0x2d')]){delete _0x3e583f['name'];}_0x10feeb['status'](_0x295725)[_0x888d('0x2e')](_0x3e583f);};}exports[_0x888d('0x2f')]=function(_0x590fd4,_0x5d457a){var _0x46271b={},_0x316a7e={},_0x194997={'count':0x0,'rows':[]};var _0x5ba4f4=_[_0x888d('0x30')](db[_0x888d('0x31')][_0x888d('0x32')],function(_0x15fb70){return{'name':_0x15fb70[_0x888d('0x33')],'type':_0x15fb70[_0x888d('0x34')][_0x888d('0x35')]};});_0x316a7e[_0x888d('0x36')]=_[_0x888d('0x30')](_0x5ba4f4,_0x888d('0x2d'));_0x316a7e[_0x888d('0x37')]=_[_0x888d('0x38')](_0x590fd4[_0x888d('0x37')]);_0x316a7e[_0x888d('0x39')]=_[_0x888d('0x3a')](_0x316a7e[_0x888d('0x36')],_0x316a7e['query']);_0x46271b[_0x888d('0x3b')]=_[_0x888d('0x3a')](_0x316a7e['model'],qs[_0x888d('0x3c')](_0x590fd4[_0x888d('0x37')]['fields']));_0x46271b[_0x888d('0x3b')]=_0x46271b[_0x888d('0x3b')][_0x888d('0x3d')]?_0x46271b[_0x888d('0x3b')]:_0x316a7e['model'];if(!_0x590fd4[_0x888d('0x37')]['hasOwnProperty'](_0x888d('0x3e'))){_0x46271b[_0x888d('0x22')]=qs[_0x888d('0x22')](_0x590fd4[_0x888d('0x37')]['limit']);_0x46271b[_0x888d('0x20')]=qs[_0x888d('0x20')](_0x590fd4[_0x888d('0x37')]['offset']);}_0x46271b[_0x888d('0x3f')]=qs[_0x888d('0x40')](_0x590fd4['query'][_0x888d('0x40')]);_0x46271b[_0x888d('0x41')]=qs[_0x888d('0x39')](_[_0x888d('0x42')](_0x590fd4['query'],_0x316a7e[_0x888d('0x39')]),_0x5ba4f4);if(_0x590fd4[_0x888d('0x37')][_0x888d('0x43')]){_0x46271b['where']=_[_0x888d('0x44')](_0x46271b[_0x888d('0x41')],{'$or':_[_0x888d('0x30')](_0x5ba4f4,function(_0x5b8737){if(_0x5b8737['type']!==_0x888d('0x45')){var _0x3407c6={};_0x3407c6[_0x5b8737['name']]={'$like':'%'+_0x590fd4[_0x888d('0x37')][_0x888d('0x43')]+'%'};return _0x3407c6;}})});}_0x46271b=_[_0x888d('0x44')]({},_0x46271b,_0x590fd4[_0x888d('0x46')]);var _0x464b25={'where':_0x46271b[_0x888d('0x41')]};return db[_0x888d('0x31')][_0x888d('0x23')](_0x464b25)[_0x888d('0x47')](function(_0x251519){_0x194997[_0x888d('0x23')]=_0x251519;if(_0x590fd4[_0x888d('0x37')][_0x888d('0x48')]){_0x46271b[_0x888d('0x49')]=[{'all':!![]}];}return db[_0x888d('0x31')][_0x888d('0x4a')](_0x46271b);})['then'](function(_0x47b01d){_0x194997[_0x888d('0x4b')]=_0x47b01d;return _0x194997;})[_0x888d('0x47')](respondWithFilteredResult(_0x5d457a,_0x46271b))[_0x888d('0x4c')](handleError(_0x5d457a,null));};exports[_0x888d('0x4d')]=function(_0x1b4b40,_0x3713e7){var _0x427312={'raw':![],'where':{'id':_0x1b4b40[_0x888d('0x4e')]['id']}},_0x344aa8={};_0x344aa8[_0x888d('0x36')]=_[_0x888d('0x38')](db['VoiceQueueReport']['rawAttributes']);_0x344aa8['query']=_[_0x888d('0x38')](_0x1b4b40['query']);_0x344aa8[_0x888d('0x39')]=_[_0x888d('0x3a')](_0x344aa8['model'],_0x344aa8[_0x888d('0x37')]);_0x427312['attributes']=_[_0x888d('0x3a')](_0x344aa8[_0x888d('0x36')],qs[_0x888d('0x3c')](_0x1b4b40['query'][_0x888d('0x3c')]));_0x427312[_0x888d('0x3b')]=_0x427312['attributes'][_0x888d('0x3d')]?_0x427312[_0x888d('0x3b')]:_0x344aa8[_0x888d('0x36')];if(_0x1b4b40['query'][_0x888d('0x48')]){_0x427312[_0x888d('0x49')]=[{'all':!![]}];}_0x427312=_['merge']({},_0x427312,_0x1b4b40[_0x888d('0x46')]);return db['VoiceQueueReport'][_0x888d('0x4f')](_0x427312)[_0x888d('0x47')](handleEntityNotFound(_0x3713e7,null))['then'](respondWithResult(_0x3713e7,null))[_0x888d('0x4c')](handleError(_0x3713e7,null));};exports[_0x888d('0x50')]=function(_0x2a435d,_0x1e7877){return db[_0x888d('0x31')][_0x888d('0x50')](_0x2a435d[_0x888d('0x51')],{})[_0x888d('0x47')](respondWithResult(_0x1e7877,0xc9))[_0x888d('0x4c')](handleError(_0x1e7877,null));};exports[_0x888d('0x27')]=function(_0xc89d64,_0x2465c5){if(_0xc89d64[_0x888d('0x51')]['id']){delete _0xc89d64[_0x888d('0x51')]['id'];}return db[_0x888d('0x31')][_0x888d('0x4f')]({'where':{'id':_0xc89d64[_0x888d('0x4e')]['id']}})['then'](handleEntityNotFound(_0x2465c5,null))[_0x888d('0x47')](saveUpdates(_0xc89d64[_0x888d('0x51')],null))[_0x888d('0x47')](respondWithResult(_0x2465c5,null))[_0x888d('0x4c')](handleError(_0x2465c5,null));};exports['destroy']=function(_0xccbe82,_0x15a724){return db['VoiceQueueReport'][_0x888d('0x4f')]({'where':{'id':_0xccbe82[_0x888d('0x4e')]['id']}})[_0x888d('0x47')](handleEntityNotFound(_0x15a724,null))[_0x888d('0x47')](removeEntity(_0x15a724,null))[_0x888d('0x4c')](handleError(_0x15a724,null));};exports[_0x888d('0x52')]=function(_0x47c6cd,_0x5a52ea){return db[_0x888d('0x31')][_0x888d('0x52')]()[_0x888d('0x47')](respondWithResult(_0x5a52ea,null))[_0x888d('0x4c')](handleError(_0x5a52ea,null));};exports[_0x888d('0x53')]=function(_0x1c1e85,_0x58972e){var _0x557caf={},_0x1c573b={},_0x564d67={'count':0x0,'rows':[]};_0x1c573b[_0x888d('0x36')]=_[_0x888d('0x38')](db[_0x888d('0x31')][_0x888d('0x32')]);_0x1c573b[_0x888d('0x37')]=_[_0x888d('0x38')](_0x1c1e85[_0x888d('0x37')]);_0x1c573b[_0x888d('0x39')]=_[_0x888d('0x3a')](_0x1c573b[_0x888d('0x36')],_0x1c573b['query']);_0x557caf[_0x888d('0x3b')]=_[_0x888d('0x3a')](_0x1c573b[_0x888d('0x36')],qs['fields'](_0x1c1e85['query'][_0x888d('0x3c')]));_0x557caf['attributes']=_0x557caf[_0x888d('0x3b')][_0x888d('0x3d')]?_0x557caf['attributes']:_0x1c573b[_0x888d('0x36')];if(!_0x1c1e85['query'][_0x888d('0x54')](_0x888d('0x3e'))){_0x557caf[_0x888d('0x22')]=qs[_0x888d('0x22')](_0x1c1e85['query'][_0x888d('0x22')]);_0x557caf[_0x888d('0x20')]=qs[_0x888d('0x20')](_0x1c1e85['query'][_0x888d('0x20')]);}_0x557caf['order']=qs[_0x888d('0x40')](_0x1c1e85['query'][_0x888d('0x40')]);_0x557caf[_0x888d('0x41')]=qs[_0x888d('0x39')](_[_0x888d('0x42')](_0x1c1e85[_0x888d('0x37')],_0x1c573b['filters']));if(_0x1c1e85[_0x888d('0x37')]['filter']){_0x557caf[_0x888d('0x41')]=_['merge'](_0x557caf['where'],{'$or':_[_0x888d('0x30')](_0x557caf[_0x888d('0x3b')],function(_0x3d1911){var _0x5b7e34={};_0x5b7e34[_0x3d1911]={'$like':'%'+_0x1c1e85[_0x888d('0x37')][_0x888d('0x43')]+'%'};return _0x5b7e34;})});}_0x557caf=_[_0x888d('0x44')]({},_0x557caf,_0x1c1e85['options']);var _0x22e1fb={'where':_0x557caf[_0x888d('0x41')]};return db[_0x888d('0x31')]['count'](_0x22e1fb)[_0x888d('0x47')](function(_0x5ee3d6){_0x564d67['count']=_0x5ee3d6;if(_0x1c1e85[_0x888d('0x37')][_0x888d('0x48')]){_0x557caf['include']=[{'all':!![]}];}return db['VoiceQueueReport'][_0x888d('0x4a')](_0x557caf);})[_0x888d('0x47')](function(_0x2d7bcd){_0x564d67[_0x888d('0x4b')]=_0x2d7bcd;return _0x564d67;})[_0x888d('0x47')](respondWithFilteredResult(_0x58972e,_0x557caf,'getVoiceQueuesReport'))['catch'](handleError(_0x58972e,null,_0x888d('0x53')));}; \ No newline at end of file +var _0x10d3=['rimraf','zip-dir','fast-json-patch','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','sendStatus','error','stack','name','send','index','map','VoiceQueueReport','rawAttributes','fieldName','type','key','query','keys','model','attributes','intersection','fields','hasOwnProperty','sort','where','filters','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','length','includeAll','find','body','destroy','describe','nolimit','pick','getVoiceQueuesReport','eml-format'];(function(_0x5435ce,_0x39c44a){var _0x2b116b=function(_0x13dae9){while(--_0x13dae9){_0x5435ce['push'](_0x5435ce['shift']());}};_0x2b116b(++_0x39c44a);}(_0x10d3,0xa3));var _0x310d=function(_0x444acf,_0x50fb23){_0x444acf=_0x444acf-0x0;var _0x308b94=_0x10d3[_0x444acf];return _0x308b94;};'use strict';var emlformat=require(_0x310d('0x0'));var rimraf=require(_0x310d('0x1'));var zipdir=require(_0x310d('0x2'));var jsonpatch=require(_0x310d('0x3'));var rp=require('request-promise');var moment=require(_0x310d('0x4'));var BPromise=require(_0x310d('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x310d('0x6'));var sox=require(_0x310d('0x7'));var csv=require(_0x310d('0x8'));var ejs=require(_0x310d('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x310d('0xa'));var squel=require(_0x310d('0xb'));var crypto=require('crypto');var jsforce=require(_0x310d('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x310d('0x8'));var querystring=require(_0x310d('0xd'));var Papa=require('papaparse');var Redis=require(_0x310d('0xe'));var authService=require(_0x310d('0xf'));var qs=require(_0x310d('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x310d('0x11'));var logger=require(_0x310d('0x12'))(_0x310d('0x13'));var utils=require(_0x310d('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x310d('0x15'));var db=require(_0x310d('0x16'))['db'];config[_0x310d('0x17')]=_[_0x310d('0x18')](config[_0x310d('0x17')],{'host':_0x310d('0x19'),'port':0x18eb});var socket=require(_0x310d('0x1a'))(new Redis(config[_0x310d('0x17')]));require('./voiceQueueReport.socket')['register'](socket);function respondWithStatusCode(_0x407048,_0x3de159){_0x3de159=_0x3de159||0xcc;return function(_0xf8a1ec){if(_0xf8a1ec){return _0x407048['sendStatus'](_0x3de159);}return _0x407048['status'](_0x3de159)[_0x310d('0x1b')]();};}function respondWithResult(_0x3a5aaa,_0x20f53a){_0x20f53a=_0x20f53a||0xc8;return function(_0x219c17){if(_0x219c17){return _0x3a5aaa[_0x310d('0x1c')](_0x20f53a)[_0x310d('0x1d')](_0x219c17);}};}function respondWithFilteredResult(_0x423224,_0x487458){return function(_0x25a565){if(_0x25a565){var _0x572377=typeof _0x487458[_0x310d('0x1e')]==='undefined'&&typeof _0x487458[_0x310d('0x1f')]===_0x310d('0x20');var _0x1120f0=_0x25a565[_0x310d('0x21')];var _0x269a15=_0x572377?0x0:_0x487458[_0x310d('0x1e')];var _0xf36c0=_0x572377?_0x25a565[_0x310d('0x21')]:_0x487458['offset']+_0x487458['limit'];var _0x372b94;if(_0xf36c0>=_0x1120f0){_0xf36c0=_0x1120f0;_0x372b94=0xc8;}else{_0x372b94=0xce;}_0x423224[_0x310d('0x1c')](_0x372b94);return _0x423224[_0x310d('0x22')](_0x310d('0x23'),_0x269a15+'-'+_0xf36c0+'/'+_0x1120f0)[_0x310d('0x1d')](_0x25a565);}return null;};}function patchUpdates(_0x4df386){return function(_0x4c5c80){try{jsonpatch[_0x310d('0x24')](_0x4c5c80,_0x4df386,!![]);}catch(_0x61e2a){return BPromise[_0x310d('0x25')](_0x61e2a);}return _0x4c5c80[_0x310d('0x26')]();};}function saveUpdates(_0x83b8b0,_0x191cb3){return function(_0x24daff){if(_0x24daff){return _0x24daff[_0x310d('0x27')](_0x83b8b0)[_0x310d('0x28')](function(_0x10d84d){return _0x10d84d;});}return null;};}function removeEntity(_0x5b5857,_0x365b2a){return function(_0x395d9c){if(_0x395d9c){return _0x395d9c['destroy']()['then'](function(){_0x5b5857['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x30a676,_0xa46ec2){return function(_0x32b692){if(!_0x32b692){_0x30a676[_0x310d('0x29')](0x194);}return _0x32b692;};}function handleError(_0x40acd3,_0x1e290d){_0x1e290d=_0x1e290d||0x1f4;return function(_0x3f87a1){logger[_0x310d('0x2a')](_0x3f87a1[_0x310d('0x2b')]);if(_0x3f87a1[_0x310d('0x2c')]){delete _0x3f87a1[_0x310d('0x2c')];}_0x40acd3[_0x310d('0x1c')](_0x1e290d)[_0x310d('0x2d')](_0x3f87a1);};}exports[_0x310d('0x2e')]=function(_0x3de5c3,_0x5ecfad){var _0x2c004e={},_0x29edd3={},_0xde7f6c={'count':0x0,'rows':[]};var _0x51e13b=_[_0x310d('0x2f')](db[_0x310d('0x30')][_0x310d('0x31')],function(_0x125cdf){return{'name':_0x125cdf[_0x310d('0x32')],'type':_0x125cdf[_0x310d('0x33')][_0x310d('0x34')]};});_0x29edd3['model']=_[_0x310d('0x2f')](_0x51e13b,_0x310d('0x2c'));_0x29edd3[_0x310d('0x35')]=_[_0x310d('0x36')](_0x3de5c3[_0x310d('0x35')]);_0x29edd3['filters']=_['intersection'](_0x29edd3[_0x310d('0x37')],_0x29edd3[_0x310d('0x35')]);_0x2c004e[_0x310d('0x38')]=_[_0x310d('0x39')](_0x29edd3['model'],qs['fields'](_0x3de5c3[_0x310d('0x35')][_0x310d('0x3a')]));_0x2c004e[_0x310d('0x38')]=_0x2c004e[_0x310d('0x38')]['length']?_0x2c004e[_0x310d('0x38')]:_0x29edd3[_0x310d('0x37')];if(!_0x3de5c3['query'][_0x310d('0x3b')]('nolimit')){_0x2c004e[_0x310d('0x1f')]=qs[_0x310d('0x1f')](_0x3de5c3['query'][_0x310d('0x1f')]);_0x2c004e[_0x310d('0x1e')]=qs[_0x310d('0x1e')](_0x3de5c3['query']['offset']);}_0x2c004e['order']=qs[_0x310d('0x3c')](_0x3de5c3[_0x310d('0x35')]['sort']);_0x2c004e[_0x310d('0x3d')]=qs['filters'](_['pick'](_0x3de5c3[_0x310d('0x35')],_0x29edd3[_0x310d('0x3e')]),_0x51e13b);if(_0x3de5c3[_0x310d('0x35')][_0x310d('0x3f')]){_0x2c004e[_0x310d('0x3d')]=_[_0x310d('0x40')](_0x2c004e[_0x310d('0x3d')],{'$or':_[_0x310d('0x2f')](_0x51e13b,function(_0x472665){if(_0x472665[_0x310d('0x33')]!==_0x310d('0x41')){var _0x16e5f8={};_0x16e5f8[_0x472665[_0x310d('0x2c')]]={'$like':'%'+_0x3de5c3[_0x310d('0x35')][_0x310d('0x3f')]+'%'};return _0x16e5f8;}})});}_0x2c004e=_[_0x310d('0x40')]({},_0x2c004e,_0x3de5c3[_0x310d('0x42')]);var _0x3ea2a9={'where':_0x2c004e[_0x310d('0x3d')]};return db['VoiceQueueReport'][_0x310d('0x21')](_0x3ea2a9)[_0x310d('0x28')](function(_0x5f2d30){_0xde7f6c[_0x310d('0x21')]=_0x5f2d30;if(_0x3de5c3[_0x310d('0x35')]['includeAll']){_0x2c004e[_0x310d('0x43')]=[{'all':!![]}];}return db['VoiceQueueReport'][_0x310d('0x44')](_0x2c004e);})['then'](function(_0x5148ef){_0xde7f6c[_0x310d('0x45')]=_0x5148ef;return _0xde7f6c;})[_0x310d('0x28')](respondWithFilteredResult(_0x5ecfad,_0x2c004e))[_0x310d('0x46')](handleError(_0x5ecfad,null));};exports[_0x310d('0x47')]=function(_0x24a541,_0x2714bc){var _0x268bd1={'raw':![],'where':{'id':_0x24a541[_0x310d('0x48')]['id']}},_0x1d60a8={};_0x1d60a8[_0x310d('0x37')]=_[_0x310d('0x36')](db[_0x310d('0x30')]['rawAttributes']);_0x1d60a8[_0x310d('0x35')]=_[_0x310d('0x36')](_0x24a541[_0x310d('0x35')]);_0x1d60a8[_0x310d('0x3e')]=_[_0x310d('0x39')](_0x1d60a8[_0x310d('0x37')],_0x1d60a8['query']);_0x268bd1[_0x310d('0x38')]=_['intersection'](_0x1d60a8[_0x310d('0x37')],qs[_0x310d('0x3a')](_0x24a541[_0x310d('0x35')][_0x310d('0x3a')]));_0x268bd1[_0x310d('0x38')]=_0x268bd1[_0x310d('0x38')][_0x310d('0x49')]?_0x268bd1['attributes']:_0x1d60a8[_0x310d('0x37')];if(_0x24a541[_0x310d('0x35')][_0x310d('0x4a')]){_0x268bd1[_0x310d('0x43')]=[{'all':!![]}];}_0x268bd1=_[_0x310d('0x40')]({},_0x268bd1,_0x24a541[_0x310d('0x42')]);return db['VoiceQueueReport'][_0x310d('0x4b')](_0x268bd1)['then'](handleEntityNotFound(_0x2714bc,null))[_0x310d('0x28')](respondWithResult(_0x2714bc,null))['catch'](handleError(_0x2714bc,null));};exports['create']=function(_0x39da7e,_0x2b51bd){return db['VoiceQueueReport']['create'](_0x39da7e[_0x310d('0x4c')],{})[_0x310d('0x28')](respondWithResult(_0x2b51bd,0xc9))[_0x310d('0x46')](handleError(_0x2b51bd,null));};exports[_0x310d('0x27')]=function(_0xc29ff2,_0x4ad018){if(_0xc29ff2['body']['id']){delete _0xc29ff2['body']['id'];}return db[_0x310d('0x30')][_0x310d('0x4b')]({'where':{'id':_0xc29ff2['params']['id']}})[_0x310d('0x28')](handleEntityNotFound(_0x4ad018,null))['then'](saveUpdates(_0xc29ff2[_0x310d('0x4c')],null))['then'](respondWithResult(_0x4ad018,null))['catch'](handleError(_0x4ad018,null));};exports[_0x310d('0x4d')]=function(_0x2e4878,_0x191bb2){return db[_0x310d('0x30')][_0x310d('0x4b')]({'where':{'id':_0x2e4878[_0x310d('0x48')]['id']}})[_0x310d('0x28')](handleEntityNotFound(_0x191bb2,null))[_0x310d('0x28')](removeEntity(_0x191bb2,null))[_0x310d('0x46')](handleError(_0x191bb2,null));};exports['describe']=function(_0xee9f93,_0x19d240){return db[_0x310d('0x30')][_0x310d('0x4e')]()[_0x310d('0x28')](respondWithResult(_0x19d240,null))[_0x310d('0x46')](handleError(_0x19d240,null));};exports['getVoiceQueuesReport']=function(_0x4025eb,_0x48933f){var _0x1d2c3c={},_0x17f372={},_0x2d0413={'count':0x0,'rows':[]};_0x17f372[_0x310d('0x37')]=_[_0x310d('0x36')](db[_0x310d('0x30')][_0x310d('0x31')]);_0x17f372['query']=_[_0x310d('0x36')](_0x4025eb[_0x310d('0x35')]);_0x17f372[_0x310d('0x3e')]=_[_0x310d('0x39')](_0x17f372[_0x310d('0x37')],_0x17f372[_0x310d('0x35')]);_0x1d2c3c['attributes']=_['intersection'](_0x17f372[_0x310d('0x37')],qs[_0x310d('0x3a')](_0x4025eb['query'][_0x310d('0x3a')]));_0x1d2c3c['attributes']=_0x1d2c3c[_0x310d('0x38')][_0x310d('0x49')]?_0x1d2c3c[_0x310d('0x38')]:_0x17f372[_0x310d('0x37')];if(!_0x4025eb['query']['hasOwnProperty'](_0x310d('0x4f'))){_0x1d2c3c[_0x310d('0x1f')]=qs[_0x310d('0x1f')](_0x4025eb[_0x310d('0x35')][_0x310d('0x1f')]);_0x1d2c3c['offset']=qs[_0x310d('0x1e')](_0x4025eb['query'][_0x310d('0x1e')]);}_0x1d2c3c['order']=qs[_0x310d('0x3c')](_0x4025eb[_0x310d('0x35')][_0x310d('0x3c')]);_0x1d2c3c[_0x310d('0x3d')]=qs[_0x310d('0x3e')](_[_0x310d('0x50')](_0x4025eb[_0x310d('0x35')],_0x17f372['filters']));if(_0x4025eb[_0x310d('0x35')]['filter']){_0x1d2c3c[_0x310d('0x3d')]=_[_0x310d('0x40')](_0x1d2c3c[_0x310d('0x3d')],{'$or':_[_0x310d('0x2f')](_0x1d2c3c[_0x310d('0x38')],function(_0x37ddd8){var _0x36ed05={};_0x36ed05[_0x37ddd8]={'$like':'%'+_0x4025eb[_0x310d('0x35')]['filter']+'%'};return _0x36ed05;})});}_0x1d2c3c=_[_0x310d('0x40')]({},_0x1d2c3c,_0x4025eb['options']);var _0xa6cc9b={'where':_0x1d2c3c[_0x310d('0x3d')]};return db['VoiceQueueReport']['count'](_0xa6cc9b)['then'](function(_0x51b59d){_0x2d0413[_0x310d('0x21')]=_0x51b59d;if(_0x4025eb[_0x310d('0x35')][_0x310d('0x4a')]){_0x1d2c3c['include']=[{'all':!![]}];}return db['VoiceQueueReport']['findAll'](_0x1d2c3c);})[_0x310d('0x28')](function(_0x857c5f){_0x2d0413[_0x310d('0x45')]=_0x857c5f;return _0x2d0413;})['then'](respondWithFilteredResult(_0x48933f,_0x1d2c3c,_0x310d('0x51')))[_0x310d('0x46')](handleError(_0x48933f,null,_0x310d('0x51')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index 4870527..0f7798d 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 _0x82f4=['save','update','remove','emit','hook','exports','events','../../mysqldb','setMaxListeners'];(function(_0x3438fb,_0xde4967){var _0x2606b1=function(_0xc61246){while(--_0xc61246){_0x3438fb['push'](_0x3438fb['shift']());}};_0x2606b1(++_0xde4967);}(_0x82f4,0x1bf));var _0x482f=function(_0x172d0,_0x4b8d19){_0x172d0=_0x172d0-0x0;var _0xea4df7=_0x82f4[_0x172d0];return _0xea4df7;};'use strict';var EventEmitter=require(_0x482f('0x0'));var VoiceQueueReport=require(_0x482f('0x1'))['db']['VoiceQueueReport'];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x482f('0x2')](0x0);var events={'afterCreate':_0x482f('0x3'),'afterUpdate':_0x482f('0x4'),'afterDestroy':_0x482f('0x5')};function emitEvent(_0x3288fe){return function(_0x1a293d,_0x58ec4b,_0x105440){VoiceQueueReportEvents[_0x482f('0x6')](_0x3288fe+':'+_0x1a293d['id'],_0x1a293d);VoiceQueueReportEvents[_0x482f('0x6')](_0x3288fe,_0x1a293d);_0x105440(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueueReport[_0x482f('0x7')](e,emitEvent(event));}}module[_0x482f('0x8')]=VoiceQueueReportEvents; \ No newline at end of file +var _0xe021=['emit','hook','events','../../mysqldb','VoiceQueueReport','setMaxListeners','update'];(function(_0x543d30,_0x4664f1){var _0x10d109=function(_0x49341f){while(--_0x49341f){_0x543d30['push'](_0x543d30['shift']());}};_0x10d109(++_0x4664f1);}(_0xe021,0xfe));var _0x1e02=function(_0xd01121,_0xec2163){_0xd01121=_0xd01121-0x0;var _0x12780f=_0xe021[_0xd01121];return _0x12780f;};'use strict';var EventEmitter=require(_0x1e02('0x0'));var VoiceQueueReport=require(_0x1e02('0x1'))['db'][_0x1e02('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x1e02('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x1e02('0x4'),'afterDestroy':'remove'};function emitEvent(_0x24f24e){return function(_0x5549f4,_0x102688,_0x5cb7d5){VoiceQueueReportEvents[_0x1e02('0x5')](_0x24f24e+':'+_0x5549f4['id'],_0x5549f4);VoiceQueueReportEvents['emit'](_0x24f24e,_0x5549f4);_0x5cb7d5(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueueReport[_0x1e02('0x6')](e,emitEvent(event));}}module['exports']=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index 3510208..2fc2204 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 _0x5f81=['VoiceQueueReport','report_queue','uniqueid','calleridnum','lodash','util','../../config/logger','api','moment','bluebird','rimraf','exports'];(function(_0x47e0e6,_0x3b7442){var _0x63c42e=function(_0x1f0fe9){while(--_0x1f0fe9){_0x47e0e6['push'](_0x47e0e6['shift']());}};_0x63c42e(++_0x3b7442);}(_0x5f81,0x1d8));var _0x15f8=function(_0x5b181e,_0x2a2741){_0x5b181e=_0x5b181e-0x0;var _0x10bd8a=_0x5f81[_0x5b181e];return _0x10bd8a;};'use strict';var _=require(_0x15f8('0x0'));var util=require(_0x15f8('0x1'));var logger=require(_0x15f8('0x2'))(_0x15f8('0x3'));var moment=require(_0x15f8('0x4'));var BPromise=require(_0x15f8('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x15f8('0x6'));var config=require('../../config/environment');var attributes=require('./voiceQueueReport.attributes');module[_0x15f8('0x7')]=function(_0x23b023,_0x4d6528){return _0x23b023['define'](_0x15f8('0x8'),attributes,{'tableName':_0x15f8('0x9'),'paranoid':![],'indexes':[{'fields':[_0x15f8('0xa')]},{'fields':[_0x15f8('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa68b=['uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','../../config/environment','./voiceQueueReport.attributes','exports','VoiceQueueReport','report_queue'];(function(_0x1d2b0c,_0x501964){var _0x1b6a32=function(_0x513c00){while(--_0x513c00){_0x1d2b0c['push'](_0x1d2b0c['shift']());}};_0x1b6a32(++_0x501964);}(_0xa68b,0x6d));var _0xba68=function(_0x132558,_0x521d93){_0x132558=_0x132558-0x0;var _0x34f138=_0xa68b[_0x132558];return _0x34f138;};'use strict';var _=require(_0xba68('0x0'));var util=require(_0xba68('0x1'));var logger=require(_0xba68('0x2'))(_0xba68('0x3'));var moment=require('moment');var BPromise=require(_0xba68('0x4'));var rp=require(_0xba68('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xba68('0x6'));var attributes=require(_0xba68('0x7'));module[_0xba68('0x8')]=function(_0x414e4f,_0x25bd30){return _0x414e4f['define'](_0xba68('0x9'),attributes,{'tableName':_0xba68('0xa'),'paranoid':![],'indexes':[{'fields':[_0xba68('0xb')]},{'fields':['calleridnum']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index 4710bed..a21b133 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 _0x546d=['lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','./voiceQueueReport.socket','request','then','info','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','error','VoiceQueueReport,\x20%s,\x20%s','message','catch','options','raw','where','limit','include','map','model','attributes','GetVoiceQueueReport','stringify','CreateVoiceQueueReport','VoiceQueueReport','create','UpdateVoiceQueueReport','update','body'];(function(_0x290b22,_0xeed456){var _0x3a8240=function(_0x219aba){while(--_0x219aba){_0x290b22['push'](_0x290b22['shift']());}};_0x3a8240(++_0xeed456);}(_0x546d,0x190));var _0xd546=function(_0x1bfef0,_0x2aac69){_0x1bfef0=_0x1bfef0-0x0;var _0x2e1218=_0x546d[_0x1bfef0];return _0x2e1218;};'use strict';var _=require(_0xd546('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xd546('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd546('0x2'));var db=require(_0xd546('0x3'))['db'];var utils=require(_0xd546('0x4'));var logger=require(_0xd546('0x5'))(_0xd546('0x6'));var config=require(_0xd546('0x7'));var jayson=require(_0xd546('0x8'));var client=jayson[_0xd546('0x9')][_0xd546('0xa')]({'port':0x232a});config['redis']=_[_0xd546('0xb')](config[_0xd546('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xd546('0xd'))['register'](socket);function respondWithRpcPromise(_0x50d973,_0x47235a,_0x18544f){return new BPromise(function(_0x321cb8,_0x35f26e){return client[_0xd546('0xe')](_0x50d973,_0x18544f)[_0xd546('0xf')](function(_0x53d010){logger[_0xd546('0x10')]('VoiceQueueReport,\x20%s,\x20%s',_0x47235a,_0xd546('0x11'));logger[_0xd546('0x12')](_0xd546('0x13'),_0x47235a,_0xd546('0x11'),JSON['stringify'](_0x53d010));if(_0x53d010[_0xd546('0x14')]){if(_0x53d010[_0xd546('0x14')]['code']===0x1f4){logger[_0xd546('0x14')](_0xd546('0x15'),_0x47235a,_0x53d010[_0xd546('0x14')][_0xd546('0x16')]);return _0x35f26e(_0x53d010['error'][_0xd546('0x16')]);}logger[_0xd546('0x14')](_0xd546('0x15'),_0x47235a,_0x53d010['error'][_0xd546('0x16')]);return _0x321cb8(_0x53d010[_0xd546('0x14')][_0xd546('0x16')]);}else{logger['info'](_0xd546('0x15'),_0x47235a,'request\x20sent');_0x321cb8(_0x53d010['result']['message']);}})[_0xd546('0x17')](function(_0x2b1028){logger[_0xd546('0x14')]('VoiceQueueReport,\x20%s,\x20%s',_0x47235a,_0x2b1028);_0x35f26e(_0x2b1028);});});}exports['GetVoiceQueueReport']=function(_0x3a8483){var _0x15316c=this;return new Promise(function(_0x594caa,_0x27cd18){return db['VoiceQueueReport']['findAll']({'raw':_0x3a8483[_0xd546('0x18')]?_0x3a8483[_0xd546('0x18')][_0xd546('0x19')]===undefined?!![]:![]:!![],'where':_0x3a8483[_0xd546('0x18')]?_0x3a8483[_0xd546('0x18')][_0xd546('0x1a')]||null:null,'attributes':_0x3a8483[_0xd546('0x18')]?_0x3a8483[_0xd546('0x18')]['attributes']||null:null,'limit':_0x3a8483['options']?_0x3a8483[_0xd546('0x18')][_0xd546('0x1b')]||null:null,'include':_0x3a8483['options']?_0x3a8483['options'][_0xd546('0x1c')]?_[_0xd546('0x1d')](_0x3a8483[_0xd546('0x18')][_0xd546('0x1c')],function(_0xf0e914){return{'model':db[_0xf0e914[_0xd546('0x1e')]],'as':_0xf0e914['as'],'attributes':_0xf0e914[_0xd546('0x1f')],'include':_0xf0e914[_0xd546('0x1c')]?_[_0xd546('0x1d')](_0xf0e914[_0xd546('0x1c')],function(_0x57e3b7){return{'model':db[_0x57e3b7[_0xd546('0x1e')]],'as':_0x57e3b7['as'],'attributes':_0x57e3b7[_0xd546('0x1f')],'include':_0x57e3b7[_0xd546('0x1c')]?_[_0xd546('0x1d')](_0x57e3b7[_0xd546('0x1c')],function(_0x58dd32){return{'model':db[_0x58dd32[_0xd546('0x1e')]],'as':_0x58dd32['as'],'attributes':_0x58dd32[_0xd546('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xd546('0xf')](function(_0x150be3){logger['info']('GetVoiceQueueReport',_0x3a8483);logger[_0xd546('0x12')](_0xd546('0x20'),_0x3a8483,JSON[_0xd546('0x21')](_0x150be3));_0x594caa(_0x150be3);})[_0xd546('0x17')](function(_0x1fb0ac){logger[_0xd546('0x14')](_0xd546('0x20'),_0x1fb0ac[_0xd546('0x16')],_0x3a8483);_0x27cd18(_0x15316c[_0xd546('0x14')](0x1f4,_0x1fb0ac['message']));});});};exports[_0xd546('0x22')]=function(_0x567917){var _0x3d010f=this;return new Promise(function(_0x1a6a3f,_0x46c4d2){return db[_0xd546('0x23')][_0xd546('0x24')](_0x567917['body'],{'raw':_0x567917[_0xd546('0x18')]?_0x567917['options'][_0xd546('0x19')]===undefined?!![]:![]:!![]})[_0xd546('0xf')](function(_0x2bde19){logger[_0xd546('0x10')](_0xd546('0x22'),_0x567917);logger[_0xd546('0x12')](_0xd546('0x22'),_0x567917,JSON['stringify'](_0x2bde19));_0x1a6a3f(_0x2bde19);})['catch'](function(_0x49fed3){logger[_0xd546('0x14')]('CreateVoiceQueueReport',_0x49fed3[_0xd546('0x16')],_0x567917);_0x46c4d2(_0x3d010f[_0xd546('0x14')](0x1f4,_0x49fed3['message']));});});};exports[_0xd546('0x25')]=function(_0x337bbb){var _0x5131ad=this;return new Promise(function(_0x35d1f3,_0x3c2c67){return db['VoiceQueueReport'][_0xd546('0x26')](_0x337bbb[_0xd546('0x27')],{'raw':_0x337bbb[_0xd546('0x18')]?_0x337bbb[_0xd546('0x18')][_0xd546('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x337bbb[_0xd546('0x18')]?_0x337bbb[_0xd546('0x18')]['where']||null:null,'attributes':_0x337bbb['options']?_0x337bbb['options'][_0xd546('0x1f')]||null:null,'limit':_0x337bbb[_0xd546('0x18')]?_0x337bbb['options'][_0xd546('0x1b')]||null:null})[_0xd546('0xf')](function(_0x3e3519){logger[_0xd546('0x10')]('UpdateVoiceQueueReport',_0x337bbb);logger[_0xd546('0x12')](_0xd546('0x25'),_0x337bbb,JSON[_0xd546('0x21')](_0x3e3519));_0x35d1f3(_0x3e3519);})[_0xd546('0x17')](function(_0x5511bf){logger[_0xd546('0x14')](_0xd546('0x25'),_0x5511bf[_0xd546('0x16')],_0x337bbb);_0x3c2c67(_0x5131ad[_0xd546('0x14')](0x1f4,_0x5511bf[_0xd546('0x16')]));});});}; \ No newline at end of file +var _0x8e89=['VoiceQueueReport','findAll','options','raw','where','attributes','limit','map','include','model','catch','CreateVoiceQueueReport','create','body','UpdateVoiceQueueReport','update','moment','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','register','request','then','VoiceQueueReport,\x20%s,\x20%s','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','GetVoiceQueueReport'];(function(_0x31c798,_0x2f1872){var _0x5e508d=function(_0x1da7ea){while(--_0x1da7ea){_0x31c798['push'](_0x31c798['shift']());}};_0x5e508d(++_0x2f1872);}(_0x8e89,0x106));var _0x98e8=function(_0x47cfa0,_0x176b87){_0x47cfa0=_0x47cfa0-0x0;var _0x386b1d=_0x8e89[_0x47cfa0];return _0x386b1d;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x98e8('0x0'));var BPromise=require('bluebird');var rs=require(_0x98e8('0x1'));var fs=require('fs');var Redis=require(_0x98e8('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x98e8('0x3'))(_0x98e8('0x4'));var config=require(_0x98e8('0x5'));var jayson=require(_0x98e8('0x6'));var client=jayson[_0x98e8('0x7')][_0x98e8('0x8')]({'port':0x232a});config[_0x98e8('0x9')]=_[_0x98e8('0xa')](config[_0x98e8('0x9')],{'host':_0x98e8('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x98e8('0x9')]));require('./voiceQueueReport.socket')[_0x98e8('0xc')](socket);function respondWithRpcPromise(_0x15a6ba,_0x5bd45d,_0x4c83bf){return new BPromise(function(_0x52aec9,_0x175bb3){return client[_0x98e8('0xd')](_0x15a6ba,_0x4c83bf)[_0x98e8('0xe')](function(_0x4f34a9){logger['info'](_0x98e8('0xf'),_0x5bd45d,'request\x20sent');logger[_0x98e8('0x10')](_0x98e8('0x11'),_0x5bd45d,_0x98e8('0x12'),JSON[_0x98e8('0x13')](_0x4f34a9));if(_0x4f34a9[_0x98e8('0x14')]){if(_0x4f34a9['error'][_0x98e8('0x15')]===0x1f4){logger[_0x98e8('0x14')]('VoiceQueueReport,\x20%s,\x20%s',_0x5bd45d,_0x4f34a9[_0x98e8('0x14')][_0x98e8('0x16')]);return _0x175bb3(_0x4f34a9[_0x98e8('0x14')][_0x98e8('0x16')]);}logger[_0x98e8('0x14')](_0x98e8('0xf'),_0x5bd45d,_0x4f34a9['error'][_0x98e8('0x16')]);return _0x52aec9(_0x4f34a9[_0x98e8('0x14')][_0x98e8('0x16')]);}else{logger[_0x98e8('0x17')](_0x98e8('0xf'),_0x5bd45d,_0x98e8('0x12'));_0x52aec9(_0x4f34a9['result'][_0x98e8('0x16')]);}})['catch'](function(_0x22820d){logger['error']('VoiceQueueReport,\x20%s,\x20%s',_0x5bd45d,_0x22820d);_0x175bb3(_0x22820d);});});}exports[_0x98e8('0x18')]=function(_0x21c95a){var _0x2bf7f8=this;return new Promise(function(_0x377f1c,_0x4dacf3){return db[_0x98e8('0x19')][_0x98e8('0x1a')]({'raw':_0x21c95a[_0x98e8('0x1b')]?_0x21c95a[_0x98e8('0x1b')][_0x98e8('0x1c')]===undefined?!![]:![]:!![],'where':_0x21c95a[_0x98e8('0x1b')]?_0x21c95a[_0x98e8('0x1b')][_0x98e8('0x1d')]||null:null,'attributes':_0x21c95a[_0x98e8('0x1b')]?_0x21c95a[_0x98e8('0x1b')][_0x98e8('0x1e')]||null:null,'limit':_0x21c95a[_0x98e8('0x1b')]?_0x21c95a[_0x98e8('0x1b')][_0x98e8('0x1f')]||null:null,'include':_0x21c95a[_0x98e8('0x1b')]?_0x21c95a[_0x98e8('0x1b')]['include']?_[_0x98e8('0x20')](_0x21c95a[_0x98e8('0x1b')][_0x98e8('0x21')],function(_0x7cf3c8){return{'model':db[_0x7cf3c8['model']],'as':_0x7cf3c8['as'],'attributes':_0x7cf3c8[_0x98e8('0x1e')],'include':_0x7cf3c8[_0x98e8('0x21')]?_[_0x98e8('0x20')](_0x7cf3c8[_0x98e8('0x21')],function(_0xe290b7){return{'model':db[_0xe290b7['model']],'as':_0xe290b7['as'],'attributes':_0xe290b7[_0x98e8('0x1e')],'include':_0xe290b7[_0x98e8('0x21')]?_[_0x98e8('0x20')](_0xe290b7['include'],function(_0x45b61f){return{'model':db[_0x45b61f[_0x98e8('0x22')]],'as':_0x45b61f['as'],'attributes':_0x45b61f[_0x98e8('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x22dd1c){logger[_0x98e8('0x17')](_0x98e8('0x18'),_0x21c95a);logger[_0x98e8('0x10')](_0x98e8('0x18'),_0x21c95a,JSON[_0x98e8('0x13')](_0x22dd1c));_0x377f1c(_0x22dd1c);})[_0x98e8('0x23')](function(_0x1e24ee){logger[_0x98e8('0x14')](_0x98e8('0x18'),_0x1e24ee[_0x98e8('0x16')],_0x21c95a);_0x4dacf3(_0x2bf7f8['error'](0x1f4,_0x1e24ee['message']));});});};exports[_0x98e8('0x24')]=function(_0x176d00){var _0x25f0ac=this;return new Promise(function(_0x1f5924,_0x19eaef){return db[_0x98e8('0x19')][_0x98e8('0x25')](_0x176d00[_0x98e8('0x26')],{'raw':_0x176d00[_0x98e8('0x1b')]?_0x176d00['options']['raw']===undefined?!![]:![]:!![]})[_0x98e8('0xe')](function(_0x109ef5){logger[_0x98e8('0x17')](_0x98e8('0x24'),_0x176d00);logger[_0x98e8('0x10')](_0x98e8('0x24'),_0x176d00,JSON[_0x98e8('0x13')](_0x109ef5));_0x1f5924(_0x109ef5);})[_0x98e8('0x23')](function(_0x3a9ee3){logger[_0x98e8('0x14')](_0x98e8('0x24'),_0x3a9ee3[_0x98e8('0x16')],_0x176d00);_0x19eaef(_0x25f0ac['error'](0x1f4,_0x3a9ee3[_0x98e8('0x16')]));});});};exports[_0x98e8('0x27')]=function(_0x4352a4){var _0x261df5=this;return new Promise(function(_0x1660d8,_0x260309){return db[_0x98e8('0x19')][_0x98e8('0x28')](_0x4352a4['body'],{'raw':_0x4352a4[_0x98e8('0x1b')]?_0x4352a4[_0x98e8('0x1b')][_0x98e8('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4352a4['options']?_0x4352a4[_0x98e8('0x1b')][_0x98e8('0x1d')]||null:null,'attributes':_0x4352a4['options']?_0x4352a4['options']['attributes']||null:null,'limit':_0x4352a4[_0x98e8('0x1b')]?_0x4352a4[_0x98e8('0x1b')][_0x98e8('0x1f')]||null:null})['then'](function(_0x498a6c){logger[_0x98e8('0x17')]('UpdateVoiceQueueReport',_0x4352a4);logger['debug']('UpdateVoiceQueueReport',_0x4352a4,JSON[_0x98e8('0x13')](_0x498a6c));_0x1660d8(_0x498a6c);})['catch'](function(_0x518188){logger['error'](_0x98e8('0x27'),_0x518188[_0x98e8('0x16')],_0x4352a4);_0x260309(_0x261df5['error'](0x1f4,_0x518188[_0x98e8('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 40ad3cc..55cd73c 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 _0x56a4=['removeListener','register','voiceQueueReport:','./voiceQueueReport.events','save','update','emit'];(function(_0xf099c6,_0x570f63){var _0x575964=function(_0x4646ca){while(--_0x4646ca){_0xf099c6['push'](_0xf099c6['shift']());}};_0x575964(++_0x570f63);}(_0x56a4,0x11b));var _0x456a=function(_0x2b8388,_0x246b8f){_0x2b8388=_0x2b8388-0x0;var _0x3ba12a=_0x56a4[_0x2b8388];return _0x3ba12a;};'use strict';var VoiceQueueReportEvents=require(_0x456a('0x0'));var events=[_0x456a('0x1'),'remove',_0x456a('0x2')];function createListener(_0x93d98f,_0x5f3fe1){return function(_0x478cac){_0x5f3fe1[_0x456a('0x3')](_0x93d98f,_0x478cac);};}function removeListener(_0x3a11ee,_0x143999){return function(){VoiceQueueReportEvents[_0x456a('0x4')](_0x3a11ee,_0x143999);};}exports[_0x456a('0x5')]=function(_0x4b8eec){for(var _0x3b0145=0x0,_0x52b38d=events['length'];_0x3b0145<_0x52b38d;_0x3b0145++){var _0x2b6329=events[_0x3b0145];var _0x20c8e0=createListener(_0x456a('0x6')+_0x2b6329,_0x4b8eec);VoiceQueueReportEvents['on'](_0x2b6329,_0x20c8e0);}}; \ No newline at end of file +var _0xa8ca=['remove','emit','register','length','./voiceQueueReport.events'];(function(_0x2069e3,_0x1c0c98){var _0xc29a80=function(_0x841d4f){while(--_0x841d4f){_0x2069e3['push'](_0x2069e3['shift']());}};_0xc29a80(++_0x1c0c98);}(_0xa8ca,0x12b));var _0xaa8c=function(_0x108c60,_0x1f1c1d){_0x108c60=_0x108c60-0x0;var _0xf3b2ff=_0xa8ca[_0x108c60];return _0xf3b2ff;};'use strict';var VoiceQueueReportEvents=require(_0xaa8c('0x0'));var events=['save',_0xaa8c('0x1'),'update'];function createListener(_0x45c417,_0x4278c6){return function(_0x1b7588){_0x4278c6[_0xaa8c('0x2')](_0x45c417,_0x1b7588);};}function removeListener(_0x2c993f,_0x3b6002){return function(){VoiceQueueReportEvents['removeListener'](_0x2c993f,_0x3b6002);};}exports[_0xaa8c('0x3')]=function(_0x25dfbc){for(var _0x57a316=0x0,_0x47a6e4=events[_0xaa8c('0x4')];_0x57a316<_0x47a6e4;_0x57a316++){var _0x736ba3=events[_0x57a316];var _0x5e8f2d=createListener('voiceQueueReport:'+_0x736ba3,_0x25dfbc);VoiceQueueReportEvents['on'](_0x736ba3,_0x5e8f2d);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index 821100e..cead37b 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 _0x1333=['destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','show','post','isAuthenticated','create','put','update','delete'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x1333,0x167));var _0x3133=function(_0x4ca4f8,_0x50fd06){_0x4ca4f8=_0x4ca4f8-0x0;var _0x1a246c=_0x1333[_0x4ca4f8];return _0x1a246c;};'use strict';var multer=require(_0x3133('0x0'));var util=require(_0x3133('0x1'));var path=require(_0x3133('0x2'));var timeout=require(_0x3133('0x3'));var express=require(_0x3133('0x4'));var router=express['Router']();var fs_extra=require(_0x3133('0x5'));var auth=require(_0x3133('0x6'));var interaction=require(_0x3133('0x7'));var config=require(_0x3133('0x8'));var controller=require('./voiceQueuesLog.controller');router[_0x3133('0x9')]('/',auth['isAuthenticated'](),controller[_0x3133('0xa')]);router['get'](_0x3133('0xb'),auth['isAuthenticated'](),controller[_0x3133('0xc')]);router[_0x3133('0xd')]('/',auth[_0x3133('0xe')](),controller[_0x3133('0xf')]);router[_0x3133('0x10')](_0x3133('0xb'),auth['isAuthenticated'](),controller[_0x3133('0x11')]);router[_0x3133('0x12')](_0x3133('0xb'),auth[_0x3133('0xe')](),controller[_0x3133('0x13')]);module[_0x3133('0x14')]=router; \ No newline at end of file +var _0xe674=['show','create','put','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./voiceQueuesLog.controller','get','isAuthenticated','index','/:id'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xe674,0x84));var _0x4e67=function(_0x363240,_0x535a6c){_0x363240=_0x363240-0x0;var _0x5c3ab8=_0xe674[_0x363240];return _0x5c3ab8;};'use strict';var multer=require('multer');var util=require(_0x4e67('0x0'));var path=require(_0x4e67('0x1'));var timeout=require(_0x4e67('0x2'));var express=require(_0x4e67('0x3'));var router=express[_0x4e67('0x4')]();var fs_extra=require(_0x4e67('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x4e67('0x6'));var config=require('../../config/environment');var controller=require(_0x4e67('0x7'));router[_0x4e67('0x8')]('/',auth[_0x4e67('0x9')](),controller[_0x4e67('0xa')]);router[_0x4e67('0x8')](_0x4e67('0xb'),auth[_0x4e67('0x9')](),controller[_0x4e67('0xc')]);router['post']('/',auth[_0x4e67('0x9')](),controller[_0x4e67('0xd')]);router[_0x4e67('0xe')](_0x4e67('0xb'),auth[_0x4e67('0x9')](),controller['update']);router[_0x4e67('0xf')]('/:id',auth[_0x4e67('0x9')](),controller[_0x4e67('0x10')]);module[_0x4e67('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index 7c5aa0f..6fbb428 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 _0xc1ef=['STRING','literal','sequelize'];(function(_0x158bb8,_0x5f129b){var _0x3a643f=function(_0x2ee764){while(--_0x2ee764){_0x158bb8['push'](_0x158bb8['shift']());}};_0x3a643f(++_0x5f129b);}(_0xc1ef,0x116));var _0xfc1e=function(_0x551c7c,_0x47e998){_0x551c7c=_0x551c7c-0x0;var _0x3f044a=_0xc1ef[_0x551c7c];return _0x3f044a;};'use strict';var Sequelize=require(_0xfc1e('0x0'));var moment=require('moment');module['exports']={'time':{'type':Sequelize[_0xfc1e('0x1')]},'callid':{'type':Sequelize[_0xfc1e('0x1')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0xfc1e('0x1')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0xfc1e('0x1')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0xfc1e('0x1')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0xfc1e('0x1')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0xfc1e('0x1')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0xfc1e('0x1')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0xfc1e('0x1')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0xfc1e('0x1')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0xfc1e('0x2')]('CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP')}}; \ No newline at end of file +var _0xb12f=['exports','STRING','DATE','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb12f,0x65));var _0xfb12=function(_0x464a78,_0x3a5ddc){_0x464a78=_0x464a78-0x0;var _0x5bc170=_0xb12f[_0x464a78];return _0x5bc170;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xfb12('0x0'));module[_0xfb12('0x1')]={'time':{'type':Sequelize[_0xfb12('0x2')]},'callid':{'type':Sequelize[_0xfb12('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0xfb12('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0xfb12('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0xfb12('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0xfb12('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0xfb12('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0xfb12('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0xfb12('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0xfb12('0x3')],'allowNull':![],'defaultValue':Sequelize[_0xfb12('0x4')](_0xfb12('0x5'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index 39bf134..1f2e774 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 _0x1c96=['keys','query','filters','model','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','include','findAll','catch','show','params','rawAttributes','intersection','includeAll','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','undefined','limit','count','offset','Content-Range','json','apply','reject','save','update','destroy','then','sendStatus','error','stack','name','send','index','map','VoiceQueuesLog','fieldName','type','key'];(function(_0x14596a,_0x2ed823){var _0x235ea5=function(_0x996da7){while(--_0x996da7){_0x14596a['push'](_0x14596a['shift']());}};_0x235ea5(++_0x2ed823);}(_0x1c96,0x105));var _0x61c9=function(_0x519756,_0x288785){_0x519756=_0x519756-0x0;var _0x37047e=_0x1c96[_0x519756];return _0x37047e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x61c9('0x0'));var zipdir=require(_0x61c9('0x1'));var jsonpatch=require(_0x61c9('0x2'));var rp=require(_0x61c9('0x3'));var moment=require('moment');var BPromise=require(_0x61c9('0x4'));var Mustache=require('mustache');var util=require(_0x61c9('0x5'));var path=require(_0x61c9('0x6'));var sox=require(_0x61c9('0x7'));var csv=require(_0x61c9('0x8'));var ejs=require(_0x61c9('0x9'));var fs=require('fs');var fs_extra=require(_0x61c9('0xa'));var _=require('lodash');var squel=require(_0x61c9('0xb'));var crypto=require(_0x61c9('0xc'));var jsforce=require(_0x61c9('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x61c9('0x8'));var querystring=require(_0x61c9('0xe'));var Papa=require(_0x61c9('0xf'));var Redis=require(_0x61c9('0x10'));var authService=require(_0x61c9('0x11'));var qs=require(_0x61c9('0x12'));var as=require(_0x61c9('0x13'));var hardwareService=require(_0x61c9('0x14'));var logger=require(_0x61c9('0x15'))(_0x61c9('0x16'));var utils=require(_0x61c9('0x17'));var config=require(_0x61c9('0x18'));var licenseUtil=require(_0x61c9('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4336f9,_0x48d231){_0x48d231=_0x48d231||0xcc;return function(_0x47b76d){if(_0x47b76d){return _0x4336f9['sendStatus'](_0x48d231);}return _0x4336f9[_0x61c9('0x1a')](_0x48d231)[_0x61c9('0x1b')]();};}function respondWithResult(_0x5b2c11,_0x1be50f){_0x1be50f=_0x1be50f||0xc8;return function(_0x3a93b8){if(_0x3a93b8){return _0x5b2c11[_0x61c9('0x1a')](_0x1be50f)['json'](_0x3a93b8);}};}function respondWithFilteredResult(_0x2cb4a0,_0x1be953){return function(_0x4823df){if(_0x4823df){var _0x44b0c0=typeof _0x1be953['offset']===_0x61c9('0x1c')&&typeof _0x1be953[_0x61c9('0x1d')]===_0x61c9('0x1c');var _0x716b3e=_0x4823df[_0x61c9('0x1e')];var _0x596db5=_0x44b0c0?0x0:_0x1be953[_0x61c9('0x1f')];var _0x1efc7d=_0x44b0c0?_0x4823df[_0x61c9('0x1e')]:_0x1be953[_0x61c9('0x1f')]+_0x1be953['limit'];var _0x1a0543;if(_0x1efc7d>=_0x716b3e){_0x1efc7d=_0x716b3e;_0x1a0543=0xc8;}else{_0x1a0543=0xce;}_0x2cb4a0['status'](_0x1a0543);return _0x2cb4a0['set'](_0x61c9('0x20'),_0x596db5+'-'+_0x1efc7d+'/'+_0x716b3e)[_0x61c9('0x21')](_0x4823df);}return null;};}function patchUpdates(_0x3175f6){return function(_0x2c0bf4){try{jsonpatch[_0x61c9('0x22')](_0x2c0bf4,_0x3175f6,!![]);}catch(_0x244694){return BPromise[_0x61c9('0x23')](_0x244694);}return _0x2c0bf4[_0x61c9('0x24')]();};}function saveUpdates(_0x5a0fa4,_0x4d5e19){return function(_0x1518b6){if(_0x1518b6){return _0x1518b6[_0x61c9('0x25')](_0x5a0fa4)['then'](function(_0x4e5d88){return _0x4e5d88;});}return null;};}function removeEntity(_0x3101ee,_0x1113f0){return function(_0x485e0a){if(_0x485e0a){return _0x485e0a[_0x61c9('0x26')]()[_0x61c9('0x27')](function(){_0x3101ee[_0x61c9('0x1a')](0xcc)[_0x61c9('0x1b')]();});}};}function handleEntityNotFound(_0x3b4dfa,_0x8efc4a){return function(_0x40dc9a){if(!_0x40dc9a){_0x3b4dfa[_0x61c9('0x28')](0x194);}return _0x40dc9a;};}function handleError(_0x264085,_0x3a1408){_0x3a1408=_0x3a1408||0x1f4;return function(_0x4e46df){logger[_0x61c9('0x29')](_0x4e46df[_0x61c9('0x2a')]);if(_0x4e46df[_0x61c9('0x2b')]){delete _0x4e46df[_0x61c9('0x2b')];}_0x264085[_0x61c9('0x1a')](_0x3a1408)[_0x61c9('0x2c')](_0x4e46df);};}exports[_0x61c9('0x2d')]=function(_0x4308df,_0x41b037){var _0x8c304={},_0x5a327d={},_0x3132e8={'count':0x0,'rows':[]};var _0x44e95e=_[_0x61c9('0x2e')](db[_0x61c9('0x2f')]['rawAttributes'],function(_0x2d92d7){return{'name':_0x2d92d7[_0x61c9('0x30')],'type':_0x2d92d7[_0x61c9('0x31')][_0x61c9('0x32')]};});_0x5a327d['model']=_[_0x61c9('0x2e')](_0x44e95e,'name');_0x5a327d['query']=_[_0x61c9('0x33')](_0x4308df[_0x61c9('0x34')]);_0x5a327d[_0x61c9('0x35')]=_['intersection'](_0x5a327d[_0x61c9('0x36')],_0x5a327d[_0x61c9('0x34')]);_0x8c304[_0x61c9('0x37')]=_['intersection'](_0x5a327d['model'],qs[_0x61c9('0x38')](_0x4308df[_0x61c9('0x34')][_0x61c9('0x38')]));_0x8c304['attributes']=_0x8c304['attributes'][_0x61c9('0x39')]?_0x8c304[_0x61c9('0x37')]:_0x5a327d[_0x61c9('0x36')];if(!_0x4308df[_0x61c9('0x34')][_0x61c9('0x3a')](_0x61c9('0x3b'))){_0x8c304[_0x61c9('0x1d')]=qs['limit'](_0x4308df[_0x61c9('0x34')][_0x61c9('0x1d')]);_0x8c304[_0x61c9('0x1f')]=qs[_0x61c9('0x1f')](_0x4308df[_0x61c9('0x34')]['offset']);}_0x8c304['order']=qs[_0x61c9('0x3c')](_0x4308df[_0x61c9('0x34')][_0x61c9('0x3c')]);_0x8c304['where']=qs[_0x61c9('0x35')](_[_0x61c9('0x3d')](_0x4308df[_0x61c9('0x34')],_0x5a327d[_0x61c9('0x35')]),_0x44e95e);if(_0x4308df[_0x61c9('0x34')][_0x61c9('0x3e')]){_0x8c304[_0x61c9('0x3f')]=_[_0x61c9('0x40')](_0x8c304[_0x61c9('0x3f')],{'$or':_[_0x61c9('0x2e')](_0x44e95e,function(_0x1e94fe){if(_0x1e94fe['type']!==_0x61c9('0x41')){var _0x21fa85={};_0x21fa85[_0x1e94fe[_0x61c9('0x2b')]]={'$like':'%'+_0x4308df[_0x61c9('0x34')][_0x61c9('0x3e')]+'%'};return _0x21fa85;}})});}_0x8c304=_[_0x61c9('0x40')]({},_0x8c304,_0x4308df[_0x61c9('0x42')]);var _0x32e788={'where':_0x8c304['where']};return db[_0x61c9('0x2f')][_0x61c9('0x1e')](_0x32e788)['then'](function(_0x341861){_0x3132e8[_0x61c9('0x1e')]=_0x341861;if(_0x4308df['query']['includeAll']){_0x8c304[_0x61c9('0x43')]=[{'all':!![]}];}return db[_0x61c9('0x2f')][_0x61c9('0x44')](_0x8c304);})['then'](function(_0x1c644a){_0x3132e8['rows']=_0x1c644a;return _0x3132e8;})[_0x61c9('0x27')](respondWithFilteredResult(_0x41b037,_0x8c304))[_0x61c9('0x45')](handleError(_0x41b037,null));};exports[_0x61c9('0x46')]=function(_0x2100ae,_0x5346fc){var _0x8794fb={'raw':!![],'where':{'id':_0x2100ae[_0x61c9('0x47')]['id']}},_0x46f5cf={};_0x46f5cf[_0x61c9('0x36')]=_[_0x61c9('0x33')](db[_0x61c9('0x2f')][_0x61c9('0x48')]);_0x46f5cf[_0x61c9('0x34')]=_[_0x61c9('0x33')](_0x2100ae['query']);_0x46f5cf[_0x61c9('0x35')]=_['intersection'](_0x46f5cf['model'],_0x46f5cf[_0x61c9('0x34')]);_0x8794fb[_0x61c9('0x37')]=_[_0x61c9('0x49')](_0x46f5cf[_0x61c9('0x36')],qs[_0x61c9('0x38')](_0x2100ae[_0x61c9('0x34')][_0x61c9('0x38')]));_0x8794fb[_0x61c9('0x37')]=_0x8794fb[_0x61c9('0x37')][_0x61c9('0x39')]?_0x8794fb['attributes']:_0x46f5cf[_0x61c9('0x36')];if(_0x2100ae['query'][_0x61c9('0x4a')]){_0x8794fb[_0x61c9('0x43')]=[{'all':!![]}];}_0x8794fb=_[_0x61c9('0x40')]({},_0x8794fb,_0x2100ae[_0x61c9('0x42')]);return db['VoiceQueuesLog'][_0x61c9('0x4b')](_0x8794fb)[_0x61c9('0x27')](handleEntityNotFound(_0x5346fc,null))['then'](respondWithResult(_0x5346fc,null))['catch'](handleError(_0x5346fc,null));};exports[_0x61c9('0x4c')]=function(_0x4c7734,_0xd2a9e0){return db['VoiceQueuesLog'][_0x61c9('0x4c')](_0x4c7734[_0x61c9('0x4d')],{})[_0x61c9('0x27')](respondWithResult(_0xd2a9e0,0xc9))['catch'](handleError(_0xd2a9e0,null));};exports[_0x61c9('0x25')]=function(_0x187a92,_0x2ed6bf){if(_0x187a92[_0x61c9('0x4d')]['id']){delete _0x187a92[_0x61c9('0x4d')]['id'];}return db[_0x61c9('0x2f')][_0x61c9('0x4b')]({'where':{'id':_0x187a92[_0x61c9('0x47')]['id']}})[_0x61c9('0x27')](handleEntityNotFound(_0x2ed6bf,null))[_0x61c9('0x27')](saveUpdates(_0x187a92[_0x61c9('0x4d')],null))[_0x61c9('0x27')](respondWithResult(_0x2ed6bf,null))[_0x61c9('0x45')](handleError(_0x2ed6bf,null));};exports[_0x61c9('0x26')]=function(_0x2a3796,_0x20b69d){return db[_0x61c9('0x2f')][_0x61c9('0x4b')]({'where':{'id':_0x2a3796[_0x61c9('0x47')]['id']}})['then'](handleEntityNotFound(_0x20b69d,null))[_0x61c9('0x27')](removeEntity(_0x20b69d,null))['catch'](handleError(_0x20b69d,null));}; \ No newline at end of file +var _0xee70=['set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','map','rawAttributes','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','merge','type','VIRTUAL','filter','options','include','VoiceQueuesLog','findAll','rows','catch','show','params','includeAll','create','body','find','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','end','offset','undefined','limit','count','status'];(function(_0x34843e,_0x4c4224){var _0x598f7f=function(_0x12a44c){while(--_0x12a44c){_0x34843e['push'](_0x34843e['shift']());}};_0x598f7f(++_0x4c4224);}(_0xee70,0x7b));var _0x0ee7=function(_0x2a739e,_0x251cf6){_0x2a739e=_0x2a739e-0x0;var _0x1d2cd5=_0xee70[_0x2a739e];return _0x1d2cd5;};'use strict';var emlformat=require(_0x0ee7('0x0'));var rimraf=require(_0x0ee7('0x1'));var zipdir=require(_0x0ee7('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0ee7('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0ee7('0x4'));var util=require(_0x0ee7('0x5'));var path=require(_0x0ee7('0x6'));var sox=require(_0x0ee7('0x7'));var csv=require(_0x0ee7('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0ee7('0x9'));var _=require(_0x0ee7('0xa'));var squel=require(_0x0ee7('0xb'));var crypto=require(_0x0ee7('0xc'));var jsforce=require(_0x0ee7('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x0ee7('0x8'));var querystring=require(_0x0ee7('0xe'));var Papa=require(_0x0ee7('0xf'));var Redis=require(_0x0ee7('0x10'));var authService=require(_0x0ee7('0x11'));var qs=require(_0x0ee7('0x12'));var as=require(_0x0ee7('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0ee7('0x14'))(_0x0ee7('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0ee7('0x16'));var db=require(_0x0ee7('0x17'))['db'];function respondWithStatusCode(_0x1ddc39,_0x1a65ec){_0x1a65ec=_0x1a65ec||0xcc;return function(_0x495e3a){if(_0x495e3a){return _0x1ddc39[_0x0ee7('0x18')](_0x1a65ec);}return _0x1ddc39['status'](_0x1a65ec)[_0x0ee7('0x19')]();};}function respondWithResult(_0x411f9e,_0xcce7dc){_0xcce7dc=_0xcce7dc||0xc8;return function(_0x321bc6){if(_0x321bc6){return _0x411f9e['status'](_0xcce7dc)['json'](_0x321bc6);}};}function respondWithFilteredResult(_0x5bbb1c,_0x343a95){return function(_0x235a0f){if(_0x235a0f){var _0x2c2f3d=typeof _0x343a95[_0x0ee7('0x1a')]===_0x0ee7('0x1b')&&typeof _0x343a95[_0x0ee7('0x1c')]===_0x0ee7('0x1b');var _0x15e927=_0x235a0f[_0x0ee7('0x1d')];var _0x154e24=_0x2c2f3d?0x0:_0x343a95[_0x0ee7('0x1a')];var _0x605477=_0x2c2f3d?_0x235a0f[_0x0ee7('0x1d')]:_0x343a95[_0x0ee7('0x1a')]+_0x343a95[_0x0ee7('0x1c')];var _0x5db12f;if(_0x605477>=_0x15e927){_0x605477=_0x15e927;_0x5db12f=0xc8;}else{_0x5db12f=0xce;}_0x5bbb1c[_0x0ee7('0x1e')](_0x5db12f);return _0x5bbb1c[_0x0ee7('0x1f')](_0x0ee7('0x20'),_0x154e24+'-'+_0x605477+'/'+_0x15e927)[_0x0ee7('0x21')](_0x235a0f);}return null;};}function patchUpdates(_0x2e0976){return function(_0xa90d79){try{jsonpatch[_0x0ee7('0x22')](_0xa90d79,_0x2e0976,!![]);}catch(_0x588162){return BPromise[_0x0ee7('0x23')](_0x588162);}return _0xa90d79[_0x0ee7('0x24')]();};}function saveUpdates(_0x53a13e,_0xe72894){return function(_0x3b3354){if(_0x3b3354){return _0x3b3354[_0x0ee7('0x25')](_0x53a13e)[_0x0ee7('0x26')](function(_0x56dd07){return _0x56dd07;});}return null;};}function removeEntity(_0x5706ec,_0x9f7131){return function(_0x486f33){if(_0x486f33){return _0x486f33[_0x0ee7('0x27')]()['then'](function(){_0x5706ec['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x14fae6,_0x2694ea){return function(_0xac2603){if(!_0xac2603){_0x14fae6[_0x0ee7('0x18')](0x194);}return _0xac2603;};}function handleError(_0x1d84c3,_0x4047b0){_0x4047b0=_0x4047b0||0x1f4;return function(_0x162aaa){logger[_0x0ee7('0x28')](_0x162aaa[_0x0ee7('0x29')]);if(_0x162aaa[_0x0ee7('0x2a')]){delete _0x162aaa['name'];}_0x1d84c3[_0x0ee7('0x1e')](_0x4047b0)[_0x0ee7('0x2b')](_0x162aaa);};}exports['index']=function(_0x28d674,_0x4bdad){var _0x227ab2={},_0x2ecffc={},_0x1fa4bd={'count':0x0,'rows':[]};var _0x535707=_[_0x0ee7('0x2c')](db['VoiceQueuesLog'][_0x0ee7('0x2d')],function(_0x285418){return{'name':_0x285418['fieldName'],'type':_0x285418['type'][_0x0ee7('0x2e')]};});_0x2ecffc[_0x0ee7('0x2f')]=_[_0x0ee7('0x2c')](_0x535707,_0x0ee7('0x2a'));_0x2ecffc[_0x0ee7('0x30')]=_[_0x0ee7('0x31')](_0x28d674[_0x0ee7('0x30')]);_0x2ecffc['filters']=_[_0x0ee7('0x32')](_0x2ecffc[_0x0ee7('0x2f')],_0x2ecffc['query']);_0x227ab2[_0x0ee7('0x33')]=_[_0x0ee7('0x32')](_0x2ecffc[_0x0ee7('0x2f')],qs[_0x0ee7('0x34')](_0x28d674['query'][_0x0ee7('0x34')]));_0x227ab2[_0x0ee7('0x33')]=_0x227ab2[_0x0ee7('0x33')][_0x0ee7('0x35')]?_0x227ab2[_0x0ee7('0x33')]:_0x2ecffc['model'];if(!_0x28d674[_0x0ee7('0x30')][_0x0ee7('0x36')](_0x0ee7('0x37'))){_0x227ab2[_0x0ee7('0x1c')]=qs[_0x0ee7('0x1c')](_0x28d674[_0x0ee7('0x30')]['limit']);_0x227ab2[_0x0ee7('0x1a')]=qs[_0x0ee7('0x1a')](_0x28d674[_0x0ee7('0x30')][_0x0ee7('0x1a')]);}_0x227ab2[_0x0ee7('0x38')]=qs[_0x0ee7('0x39')](_0x28d674['query'][_0x0ee7('0x39')]);_0x227ab2[_0x0ee7('0x3a')]=qs['filters'](_[_0x0ee7('0x3b')](_0x28d674[_0x0ee7('0x30')],_0x2ecffc[_0x0ee7('0x3c')]),_0x535707);if(_0x28d674['query']['filter']){_0x227ab2[_0x0ee7('0x3a')]=_[_0x0ee7('0x3d')](_0x227ab2[_0x0ee7('0x3a')],{'$or':_[_0x0ee7('0x2c')](_0x535707,function(_0x3aac27){if(_0x3aac27[_0x0ee7('0x3e')]!==_0x0ee7('0x3f')){var _0x35e4d9={};_0x35e4d9[_0x3aac27[_0x0ee7('0x2a')]]={'$like':'%'+_0x28d674[_0x0ee7('0x30')][_0x0ee7('0x40')]+'%'};return _0x35e4d9;}})});}_0x227ab2=_['merge']({},_0x227ab2,_0x28d674[_0x0ee7('0x41')]);var _0x21547f={'where':_0x227ab2['where']};return db['VoiceQueuesLog'][_0x0ee7('0x1d')](_0x21547f)[_0x0ee7('0x26')](function(_0x5609e0){_0x1fa4bd[_0x0ee7('0x1d')]=_0x5609e0;if(_0x28d674[_0x0ee7('0x30')]['includeAll']){_0x227ab2[_0x0ee7('0x42')]=[{'all':!![]}];}return db[_0x0ee7('0x43')][_0x0ee7('0x44')](_0x227ab2);})['then'](function(_0x5403a8){_0x1fa4bd[_0x0ee7('0x45')]=_0x5403a8;return _0x1fa4bd;})[_0x0ee7('0x26')](respondWithFilteredResult(_0x4bdad,_0x227ab2))[_0x0ee7('0x46')](handleError(_0x4bdad,null));};exports[_0x0ee7('0x47')]=function(_0x83827e,_0x4a44e1){var _0x2d573d={'raw':!![],'where':{'id':_0x83827e[_0x0ee7('0x48')]['id']}},_0x2a7031={};_0x2a7031['model']=_['keys'](db[_0x0ee7('0x43')][_0x0ee7('0x2d')]);_0x2a7031[_0x0ee7('0x30')]=_['keys'](_0x83827e[_0x0ee7('0x30')]);_0x2a7031[_0x0ee7('0x3c')]=_[_0x0ee7('0x32')](_0x2a7031[_0x0ee7('0x2f')],_0x2a7031[_0x0ee7('0x30')]);_0x2d573d['attributes']=_[_0x0ee7('0x32')](_0x2a7031['model'],qs[_0x0ee7('0x34')](_0x83827e['query']['fields']));_0x2d573d[_0x0ee7('0x33')]=_0x2d573d[_0x0ee7('0x33')][_0x0ee7('0x35')]?_0x2d573d['attributes']:_0x2a7031['model'];if(_0x83827e[_0x0ee7('0x30')][_0x0ee7('0x49')]){_0x2d573d[_0x0ee7('0x42')]=[{'all':!![]}];}_0x2d573d=_[_0x0ee7('0x3d')]({},_0x2d573d,_0x83827e[_0x0ee7('0x41')]);return db[_0x0ee7('0x43')]['find'](_0x2d573d)[_0x0ee7('0x26')](handleEntityNotFound(_0x4a44e1,null))[_0x0ee7('0x26')](respondWithResult(_0x4a44e1,null))[_0x0ee7('0x46')](handleError(_0x4a44e1,null));};exports[_0x0ee7('0x4a')]=function(_0x480093,_0x57f01f){return db[_0x0ee7('0x43')][_0x0ee7('0x4a')](_0x480093[_0x0ee7('0x4b')],{})[_0x0ee7('0x26')](respondWithResult(_0x57f01f,0xc9))[_0x0ee7('0x46')](handleError(_0x57f01f,null));};exports[_0x0ee7('0x25')]=function(_0x5630a1,_0x2b5c79){if(_0x5630a1[_0x0ee7('0x4b')]['id']){delete _0x5630a1['body']['id'];}return db[_0x0ee7('0x43')][_0x0ee7('0x4c')]({'where':{'id':_0x5630a1['params']['id']}})[_0x0ee7('0x26')](handleEntityNotFound(_0x2b5c79,null))[_0x0ee7('0x26')](saveUpdates(_0x5630a1[_0x0ee7('0x4b')],null))['then'](respondWithResult(_0x2b5c79,null))[_0x0ee7('0x46')](handleError(_0x2b5c79,null));};exports[_0x0ee7('0x27')]=function(_0x242ab5,_0x4a71aa){return db['VoiceQueuesLog']['find']({'where':{'id':_0x242ab5['params']['id']}})[_0x0ee7('0x26')](handleEntityNotFound(_0x4a71aa,null))[_0x0ee7('0x26')](removeEntity(_0x4a71aa,null))[_0x0ee7('0x46')](handleError(_0x4a71aa,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index 494fa1b..4415d04 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 _0xe13e=['bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueuesLog.attributes','exports','define','VoiceQueuesLog','voice_queues_log','event_dtm','dtm','../../config/logger','api','moment'];(function(_0x1ddedd,_0x485606){var _0xa3e1ac=function(_0x580444){while(--_0x580444){_0x1ddedd['push'](_0x1ddedd['shift']());}};_0xa3e1ac(++_0x485606);}(_0xe13e,0xde));var _0xee13=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe13e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xee13('0x0'))(_0xee13('0x1'));var moment=require(_0xee13('0x2'));var BPromise=require(_0xee13('0x3'));var rp=require(_0xee13('0x4'));var fs=require('fs');var path=require(_0xee13('0x5'));var rimraf=require(_0xee13('0x6'));var config=require(_0xee13('0x7'));var attributes=require(_0xee13('0x8'));module[_0xee13('0x9')]=function(_0x43cfb0,_0x48e7b0){return _0x43cfb0[_0xee13('0xa')](_0xee13('0xb'),attributes,{'tableName':_0xee13('0xc'),'paranoid':![],'indexes':[{'name':_0xee13('0xd'),'fields':['event',_0xee13('0xe')]}],'timestamps':![]});}; \ No newline at end of file +var _0x6931=['bluebird','request-promise','rimraf','../../config/environment','./voiceQueuesLog.attributes','define','VoiceQueuesLog','voice_queues_log','event_dtm','event','dtm','lodash','util','moment'];(function(_0x2e1777,_0x446b82){var _0x394259=function(_0x3271a7){while(--_0x3271a7){_0x2e1777['push'](_0x2e1777['shift']());}};_0x394259(++_0x446b82);}(_0x6931,0xa5));var _0x1693=function(_0x5dfaad,_0x21941b){_0x5dfaad=_0x5dfaad-0x0;var _0x296fae=_0x6931[_0x5dfaad];return _0x296fae;};'use strict';var _=require(_0x1693('0x0'));var util=require(_0x1693('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x1693('0x2'));var BPromise=require(_0x1693('0x3'));var rp=require(_0x1693('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1693('0x5'));var config=require(_0x1693('0x6'));var attributes=require(_0x1693('0x7'));module['exports']=function(_0x361381,_0x4bd166){return _0x361381[_0x1693('0x8')](_0x1693('0x9'),attributes,{'tableName':_0x1693('0xa'),'paranoid':![],'indexes':[{'name':_0x1693('0xb'),'fields':[_0x1693('0xc'),_0x1693('0xd')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index 5a2f4c0..b9f3f6f 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 _0x894f=['jayson/promise','request','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/environment'];(function(_0x564d65,_0x16321b){var _0x100f18=function(_0x549dd8){while(--_0x549dd8){_0x564d65['push'](_0x564d65['shift']());}};_0x100f18(++_0x16321b);}(_0x894f,0x14d));var _0xf894=function(_0x5a2151,_0x241ab6){_0x5a2151=_0x5a2151-0x0;var _0xa4eec1=_0x894f[_0x5a2151];return _0xa4eec1;};'use strict';var _=require(_0xf894('0x0'));var util=require(_0xf894('0x1'));var moment=require(_0xf894('0x2'));var BPromise=require(_0xf894('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf894('0x4'))['db'];var utils=require(_0xf894('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xf894('0x6'));var jayson=require(_0xf894('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x23a9fc,_0x371f86,_0x56d9d6){return new BPromise(function(_0x190cb1,_0x3d8f21){return client[_0xf894('0x8')](_0x23a9fc,_0x56d9d6)[_0xf894('0x9')](function(_0x10bb84){logger[_0xf894('0xa')](_0xf894('0xb'),_0x371f86,_0xf894('0xc'));logger[_0xf894('0xd')](_0xf894('0xe'),_0x371f86,_0xf894('0xc'),JSON[_0xf894('0xf')](_0x10bb84));if(_0x10bb84[_0xf894('0x10')]){if(_0x10bb84[_0xf894('0x10')][_0xf894('0x11')]===0x1f4){logger[_0xf894('0x10')](_0xf894('0xb'),_0x371f86,_0x10bb84[_0xf894('0x10')][_0xf894('0x12')]);return _0x3d8f21(_0x10bb84[_0xf894('0x10')][_0xf894('0x12')]);}logger[_0xf894('0x10')]('VoiceQueuesLog,\x20%s,\x20%s',_0x371f86,_0x10bb84[_0xf894('0x10')]['message']);return _0x190cb1(_0x10bb84['error'][_0xf894('0x12')]);}else{logger[_0xf894('0xa')](_0xf894('0xb'),_0x371f86,_0xf894('0xc'));_0x190cb1(_0x10bb84[_0xf894('0x13')]['message']);}})['catch'](function(_0x1865be){logger['error']('VoiceQueuesLog,\x20%s,\x20%s',_0x371f86,_0x1865be);_0x3d8f21(_0x1865be);});});} \ No newline at end of file +var _0x5aba=['VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceQueuesLog,\x20%s,\x20%s','message','catch','lodash','bluebird','ioredis','../../config/utils','../../config/logger','rpc','request\x20sent'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x5aba,0x69));var _0xa5ab=function(_0x2642cb,_0x4b917f){_0x2642cb=_0x2642cb-0x0;var _0xe6e41=_0x5aba[_0x2642cb];return _0xe6e41;};'use strict';var _=require(_0xa5ab('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xa5ab('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa5ab('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xa5ab('0x3'));var logger=require(_0xa5ab('0x4'))(_0xa5ab('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x101d38,_0x5616e5,_0x475fd7){return new BPromise(function(_0x38f46e,_0xa6631c){return client['request'](_0x101d38,_0x475fd7)['then'](function(_0x5658fb){logger['info']('VoiceQueuesLog,\x20%s,\x20%s',_0x5616e5,_0xa5ab('0x6'));logger['debug'](_0xa5ab('0x7'),_0x5616e5,'request\x20sent',JSON[_0xa5ab('0x8')](_0x5658fb));if(_0x5658fb[_0xa5ab('0x9')]){if(_0x5658fb[_0xa5ab('0x9')][_0xa5ab('0xa')]===0x1f4){logger['error'](_0xa5ab('0xb'),_0x5616e5,_0x5658fb[_0xa5ab('0x9')][_0xa5ab('0xc')]);return _0xa6631c(_0x5658fb[_0xa5ab('0x9')][_0xa5ab('0xc')]);}logger[_0xa5ab('0x9')](_0xa5ab('0xb'),_0x5616e5,_0x5658fb['error']['message']);return _0x38f46e(_0x5658fb[_0xa5ab('0x9')][_0xa5ab('0xc')]);}else{logger['info'](_0xa5ab('0xb'),_0x5616e5,_0xa5ab('0x6'));_0x38f46e(_0x5658fb['result']['message']);}})[_0xa5ab('0xd')](function(_0x57233d){logger[_0xa5ab('0x9')](_0xa5ab('0xb'),_0x5616e5,_0x57233d);_0xa6631c(_0x57233d);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 19643a9..f4533f1 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 _0x4c3b=['../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','/:id/downloads','downloads','/:id/transcribe','create','post','runTranscribe','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x14a709,_0x2ea79b){var _0x3b0094=function(_0x573959){while(--_0x573959){_0x14a709['push'](_0x14a709['shift']());}};_0x3b0094(++_0x2ea79b);}(_0x4c3b,0xe8));var _0xb4c3=function(_0x4309aa,_0x2089ef){_0x4309aa=_0x4309aa-0x0;var _0x222d21=_0x4c3b[_0x4309aa];return _0x222d21;};'use strict';var multer=require(_0xb4c3('0x0'));var util=require(_0xb4c3('0x1'));var path=require(_0xb4c3('0x2'));var timeout=require(_0xb4c3('0x3'));var express=require(_0xb4c3('0x4'));var router=express[_0xb4c3('0x5')]();var fs_extra=require(_0xb4c3('0x6'));var auth=require(_0xb4c3('0x7'));var interaction=require(_0xb4c3('0x8'));var config=require(_0xb4c3('0x9'));var controller=require('./voiceRecording.controller');router[_0xb4c3('0xa')]('/',auth['isAuthenticated'](),controller[_0xb4c3('0xb')]);router[_0xb4c3('0xa')](_0xb4c3('0xc'),auth[_0xb4c3('0xd')](),controller[_0xb4c3('0xe')]);router['get'](_0xb4c3('0xf'),auth['isAuthenticated'](),controller['show']);router[_0xb4c3('0xa')]('/:id/download',auth[_0xb4c3('0xd')](),controller['download']);router[_0xb4c3('0xa')](_0xb4c3('0x10'),controller[_0xb4c3('0x11')]);router[_0xb4c3('0xa')](_0xb4c3('0x12'),auth[_0xb4c3('0xd')](),controller['downloadTranscribe']);router['post']('/',auth['isAuthenticated'](),controller[_0xb4c3('0x13')]);router[_0xb4c3('0x14')](_0xb4c3('0x12'),auth[_0xb4c3('0xd')](),controller[_0xb4c3('0x15')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0xb4c3('0x16')]('/:id',auth[_0xb4c3('0xd')](),controller[_0xb4c3('0x17')]);module['exports']=router; \ No newline at end of file +var _0x01ad=['update','delete','destroy','exports','multer','util','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceRecording.controller','get','isAuthenticated','describe','/:id','/:id/download','download','/:id/downloads','downloads','/:id/transcribe','downloadTranscribe','post','create','runTranscribe','put'];(function(_0x289d26,_0xf18091){var _0x15492e=function(_0xd6e151){while(--_0xd6e151){_0x289d26['push'](_0x289d26['shift']());}};_0x15492e(++_0xf18091);}(_0x01ad,0x170));var _0xd01a=function(_0xf48d35,_0x2044f4){_0xf48d35=_0xf48d35-0x0;var _0x23522=_0x01ad[_0xf48d35];return _0x23522;};'use strict';var multer=require(_0xd01a('0x0'));var util=require(_0xd01a('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xd01a('0x2'));var router=express['Router']();var fs_extra=require(_0xd01a('0x3'));var auth=require(_0xd01a('0x4'));var interaction=require(_0xd01a('0x5'));var config=require(_0xd01a('0x6'));var controller=require(_0xd01a('0x7'));router[_0xd01a('0x8')]('/',auth[_0xd01a('0x9')](),controller['index']);router[_0xd01a('0x8')]('/describe',auth[_0xd01a('0x9')](),controller[_0xd01a('0xa')]);router['get'](_0xd01a('0xb'),auth[_0xd01a('0x9')](),controller['show']);router[_0xd01a('0x8')](_0xd01a('0xc'),auth['isAuthenticated'](),controller[_0xd01a('0xd')]);router[_0xd01a('0x8')](_0xd01a('0xe'),controller[_0xd01a('0xf')]);router[_0xd01a('0x8')](_0xd01a('0x10'),auth[_0xd01a('0x9')](),controller[_0xd01a('0x11')]);router[_0xd01a('0x12')]('/',auth[_0xd01a('0x9')](),controller[_0xd01a('0x13')]);router['post'](_0xd01a('0x10'),auth['isAuthenticated'](),controller[_0xd01a('0x14')]);router[_0xd01a('0x15')](_0xd01a('0xb'),auth[_0xd01a('0x9')](),controller[_0xd01a('0x16')]);router[_0xd01a('0x17')](_0xd01a('0xb'),auth[_0xd01a('0x9')](),controller[_0xd01a('0x18')]);module[_0xd01a('0x19')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index a7d18a8..1a3a157 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(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xa9e0[_0x1facfa];return _0x9ec701;};'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(_0x45d3f0,_0x4be53f){var _0x314b79=function(_0x563d32){while(--_0x563d32){_0x45d3f0['push'](_0x45d3f0['shift']());}};_0x314b79(++_0x4be53f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x18a79d,_0x57bd2c){_0x18a79d=_0x18a79d-0x0;var _0x4f8848=_0xa9e0[_0x18a79d];return _0x4f8848;};'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 9b0d4e0..e257026 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 _0x08b8=['count','limit','reject','save','update','then','destroy','error','stack','name','send','index','map','VoiceRecording','rawAttributes','fieldName','model','format','query','keys','filters','attributes','fields','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','findAll','rows','params','intersection','length','include','options','find','catch','create','body','describe','download','../../components/encryptor','uniqueid','value','%s.cypher','decryptFile','recording','existsSync','Sequelize','filename','extname','unlink','message','VoiceRecording\x20not\x20found','Not\x20found','downloads','sequelize','MD5','token','$and','secrets','ValidationError','isNil','Entity\x20not\x20found','info','File:\x20\x22','unlinkSync','listBuckets','createBucket','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeName','transcribeStatus','TranscriptionJobStatus','findOne','Voice\x20Recording\x20not\x20found','transcribeAccountId','transcribeRegion','language','runSentiment','sentiment','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','updateAttributes','writeFile','fileText','root','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','eml-format','rimraf','zip-dir','request-promise','moment','mustache','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined'];(function(_0xccc860,_0x32f954){var _0x54f922=function(_0x1de4d6){while(--_0x1de4d6){_0xccc860['push'](_0xccc860['shift']());}};_0x54f922(++_0x32f954);}(_0x08b8,0x19b));var _0x808b=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x08b8[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0x808b('0x0'));var rimraf=require(_0x808b('0x1'));var zipdir=require(_0x808b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x808b('0x3'));var moment=require(_0x808b('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x808b('0x5'));var util=require('util');var path=require(_0x808b('0x6'));var sox=require(_0x808b('0x7'));var csv=require(_0x808b('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x808b('0x9'));var _=require(_0x808b('0xa'));var squel=require(_0x808b('0xb'));var crypto=require('crypto');var jsforce=require(_0x808b('0xc'));var deskjs=require(_0x808b('0xd'));var toCsv=require(_0x808b('0x8'));var querystring=require(_0x808b('0xe'));var Papa=require(_0x808b('0xf'));var AWS=require('aws-sdk');var uuidv4=require('uuid/v4');var Redis=require(_0x808b('0x10'));var authService=require(_0x808b('0x11'));var qs=require(_0x808b('0x12'));var as=require(_0x808b('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x808b('0x14'))(_0x808b('0x15'));var utils=require(_0x808b('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x808b('0x17'));var db=require(_0x808b('0x18'))['db'];function respondWithStatusCode(_0x1a5b57,_0x1ff1f6){_0x1ff1f6=_0x1ff1f6||0xcc;return function(_0xdf0d0c){if(_0xdf0d0c){return _0x1a5b57[_0x808b('0x19')](_0x1ff1f6);}return _0x1a5b57[_0x808b('0x1a')](_0x1ff1f6)[_0x808b('0x1b')]();};}function respondWithResult(_0x322ee5,_0x243033){_0x243033=_0x243033||0xc8;return function(_0x1280a8){if(_0x1280a8){return _0x322ee5['status'](_0x243033)['json'](_0x1280a8);}};}function respondWithFilteredResult(_0x201c99,_0x2b4b43){return function(_0x1cb0ff){if(_0x1cb0ff){var _0x5eab9c=typeof _0x2b4b43[_0x808b('0x1c')]===_0x808b('0x1d')&&typeof _0x2b4b43['limit']===_0x808b('0x1d');var _0x22bf76=_0x1cb0ff['count'];var _0x42d82b=_0x5eab9c?0x0:_0x2b4b43[_0x808b('0x1c')];var _0x1967e4=_0x5eab9c?_0x1cb0ff[_0x808b('0x1e')]:_0x2b4b43[_0x808b('0x1c')]+_0x2b4b43[_0x808b('0x1f')];var _0x4e0490;if(_0x1967e4>=_0x22bf76){_0x1967e4=_0x22bf76;_0x4e0490=0xc8;}else{_0x4e0490=0xce;}_0x201c99[_0x808b('0x1a')](_0x4e0490);return _0x201c99['set']('Content-Range',_0x42d82b+'-'+_0x1967e4+'/'+_0x22bf76)['json'](_0x1cb0ff);}return null;};}function patchUpdates(_0x514bbc){return function(_0x90db7a){try{jsonpatch['apply'](_0x90db7a,_0x514bbc,!![]);}catch(_0x15c215){return BPromise[_0x808b('0x20')](_0x15c215);}return _0x90db7a[_0x808b('0x21')]();};}function saveUpdates(_0x51a1e7,_0x16940d){return function(_0x16b860){if(_0x16b860){return _0x16b860[_0x808b('0x22')](_0x51a1e7)[_0x808b('0x23')](function(_0x5ba385){return _0x5ba385;});}return null;};}function removeEntity(_0x3e972b,_0x4db5be){return function(_0x59a0dd){if(_0x59a0dd){return _0x59a0dd[_0x808b('0x24')]()['then'](function(){_0x3e972b[_0x808b('0x1a')](0xcc)[_0x808b('0x1b')]();});}};}function handleEntityNotFound(_0x19d70b,_0x3ddddf){return function(_0x513988){if(!_0x513988){_0x19d70b[_0x808b('0x19')](0x194);}return _0x513988;};}function handleError(_0x263706,_0x102fb9){_0x102fb9=_0x102fb9||0x1f4;return function(_0xe6ae84){logger[_0x808b('0x25')](_0xe6ae84[_0x808b('0x26')]);if(_0xe6ae84[_0x808b('0x27')]){delete _0xe6ae84[_0x808b('0x27')];}_0x263706[_0x808b('0x1a')](_0x102fb9)[_0x808b('0x28')](_0xe6ae84);};}exports[_0x808b('0x29')]=function(_0x4d587b,_0x4f2a85){var _0x34cb17={},_0x183f03={},_0x34a2da={'count':0x0,'rows':[]};var _0x3ce5b6=_[_0x808b('0x2a')](db[_0x808b('0x2b')][_0x808b('0x2c')],function(_0x14c6a7){return{'name':_0x14c6a7[_0x808b('0x2d')],'type':_0x14c6a7['type']['key']};});_0x183f03[_0x808b('0x2e')]=_['differenceBy'](_[_0x808b('0x2a')](_0x3ce5b6,_0x808b('0x27')),[_0x808b('0x2f')]);_0x183f03[_0x808b('0x30')]=_[_0x808b('0x31')](_0x4d587b[_0x808b('0x30')]);_0x183f03[_0x808b('0x32')]=_['intersection'](_0x183f03[_0x808b('0x2e')],_0x183f03[_0x808b('0x30')]);_0x34cb17[_0x808b('0x33')]=_['intersection'](_0x183f03[_0x808b('0x2e')],qs[_0x808b('0x34')](_0x4d587b[_0x808b('0x30')][_0x808b('0x34')]));_0x34cb17['attributes']=_0x34cb17[_0x808b('0x33')]['length']?_0x34cb17[_0x808b('0x33')]:_0x183f03[_0x808b('0x2e')];if(!_0x4d587b['query']['hasOwnProperty'](_0x808b('0x35'))){_0x34cb17[_0x808b('0x1f')]=qs['limit'](_0x4d587b[_0x808b('0x30')][_0x808b('0x1f')]);_0x34cb17[_0x808b('0x1c')]=qs[_0x808b('0x1c')](_0x4d587b[_0x808b('0x30')][_0x808b('0x1c')]);}_0x34cb17['order']=qs[_0x808b('0x36')](_0x4d587b['query'][_0x808b('0x36')]);_0x34cb17[_0x808b('0x37')]=qs[_0x808b('0x32')](_[_0x808b('0x38')](_0x4d587b[_0x808b('0x30')],_0x183f03[_0x808b('0x32')]),_0x3ce5b6);if(_0x4d587b[_0x808b('0x30')][_0x808b('0x39')]){_0x34cb17[_0x808b('0x37')]=_[_0x808b('0x3a')](_0x34cb17['where'],{'$or':_[_0x808b('0x2a')](_0x3ce5b6,function(_0x41474a){if(_0x41474a[_0x808b('0x3b')]!==_0x808b('0x3c')){var _0x2eeb4e={};_0x2eeb4e[_0x41474a[_0x808b('0x27')]]={'$like':'%'+_0x4d587b[_0x808b('0x30')]['filter']+'%'};return _0x2eeb4e;}})});}_0x34cb17=_[_0x808b('0x3a')]({},_0x34cb17,_0x4d587b['options']);var _0x288ba4={'where':_0x34cb17[_0x808b('0x37')]};return db[_0x808b('0x2b')][_0x808b('0x1e')](_0x288ba4)[_0x808b('0x23')](function(_0x41e161){_0x34a2da[_0x808b('0x1e')]=_0x41e161;if(_0x4d587b['query'][_0x808b('0x3d')]){_0x34cb17['include']=[{'all':!![]}];}return db[_0x808b('0x2b')][_0x808b('0x3e')](_0x34cb17);})[_0x808b('0x23')](function(_0x2a5e5d){_0x34a2da[_0x808b('0x3f')]=_0x2a5e5d;return _0x34a2da;})['then'](respondWithFilteredResult(_0x4f2a85,_0x34cb17))['catch'](handleError(_0x4f2a85,null));};exports['show']=function(_0x44c568,_0x136f9b){var _0x308c4b={'raw':![],'where':{'id':_0x44c568[_0x808b('0x40')]['id']}},_0x4e0bc6={};_0x4e0bc6[_0x808b('0x2e')]=_[_0x808b('0x31')](db['VoiceRecording'][_0x808b('0x2c')]);_0x4e0bc6[_0x808b('0x30')]=_['keys'](_0x44c568['query']);_0x4e0bc6[_0x808b('0x32')]=_[_0x808b('0x41')](_0x4e0bc6[_0x808b('0x2e')],_0x4e0bc6[_0x808b('0x30')]);_0x308c4b[_0x808b('0x33')]=_['intersection'](_0x4e0bc6[_0x808b('0x2e')],qs[_0x808b('0x34')](_0x44c568[_0x808b('0x30')][_0x808b('0x34')]));_0x308c4b[_0x808b('0x33')]=_0x308c4b['attributes'][_0x808b('0x42')]?_0x308c4b['attributes']:_0x4e0bc6['model'];if(_0x44c568['query']['includeAll']){_0x308c4b[_0x808b('0x43')]=[{'all':!![]}];}_0x308c4b=_[_0x808b('0x3a')]({},_0x308c4b,_0x44c568[_0x808b('0x44')]);return db[_0x808b('0x2b')][_0x808b('0x45')](_0x308c4b)['then'](handleEntityNotFound(_0x136f9b,null))[_0x808b('0x23')](respondWithResult(_0x136f9b,null))[_0x808b('0x46')](handleError(_0x136f9b,null));};exports['create']=function(_0x1b1318,_0xd82de5){return db['VoiceRecording'][_0x808b('0x47')](_0x1b1318[_0x808b('0x48')],{})['then'](respondWithResult(_0xd82de5,0xc9))[_0x808b('0x46')](handleError(_0xd82de5,null));};exports[_0x808b('0x22')]=function(_0x43fad6,_0x2ea489){if(_0x43fad6['body']['id']){delete _0x43fad6[_0x808b('0x48')]['id'];}return db[_0x808b('0x2b')][_0x808b('0x45')]({'where':{'id':_0x43fad6[_0x808b('0x40')]['id']}})['then'](handleEntityNotFound(_0x2ea489,null))[_0x808b('0x23')](saveUpdates(_0x43fad6[_0x808b('0x48')],null))['then'](respondWithResult(_0x2ea489,null))['catch'](handleError(_0x2ea489,null));};exports[_0x808b('0x49')]=function(_0x205eb6,_0x3a6694){return db[_0x808b('0x2b')][_0x808b('0x49')]()['then'](respondWithResult(_0x3a6694,null))['catch'](handleError(_0x3a6694,null));};exports[_0x808b('0x4a')]=function(_0x928da9,_0x259177,_0x407878){var _0x391b69=require(_0x808b('0x4b'));var _0x5e7fc8=![];var _0x41a1e0={};if(_0x928da9[_0x808b('0x30')][_0x808b('0x3b')]&&_0x928da9[_0x808b('0x30')][_0x808b('0x3b')]===_0x808b('0x4c')){_0x41a1e0['uniqueid']=_0x928da9[_0x808b('0x40')]['id'];}else{_0x41a1e0['id']=_0x928da9[_0x808b('0x40')]['id'];}return db[_0x808b('0x2b')]['find']({'where':_0x41a1e0,'attributes':['id',_0x808b('0x4d')],'raw':!![]})[_0x808b('0x23')](handleEntityNotFound(_0x259177,null))[_0x808b('0x23')](function(_0x4fb1f9){if(_0x4fb1f9){var _0x15df1c=_0x4fb1f9[_0x808b('0x4d')];var _0x130274=util[_0x808b('0x2f')](_0x808b('0x4e'),_0x15df1c);if(fs['existsSync'](_0x130274)){_0x5e7fc8=!![];return _0x391b69[_0x808b('0x4f')](_0x130274,_0x15df1c,config['secrets'][_0x808b('0x50')])[_0x808b('0x23')](function(){return _0x4fb1f9;});}return _0x4fb1f9;}})[_0x808b('0x23')](function(_0x169ce6){if(_0x169ce6){var _0x1f5197=_0x169ce6[_0x808b('0x4d')];if(!fs[_0x808b('0x51')](_0x1f5197)){throw new db[(_0x808b('0x52'))]['ValidationError']('VoiceRecording\x20not\x20found');}if(_0x169ce6[_0x808b('0x53')]){return _0x259177[_0x808b('0x4a')](_0x1f5197,_0x169ce6[_0x808b('0x53')]+path[_0x808b('0x54')](_0x1f5197),function(){if(_0x5e7fc8){fs[_0x808b('0x55')](_0x1f5197);}});}else{return _0x259177[_0x808b('0x4a')](_0x1f5197,function(_0x3803f3){if(_0x5e7fc8){fs['unlink'](_0x1f5197);}});}}})[_0x808b('0x46')](function(_0x525531){if(_0x525531[_0x808b('0x56')]===_0x808b('0x57')){_0x259177['status'](0x194)[_0x808b('0x28')](_0x808b('0x58'));}else{return handleError(_0x259177,null);}});};exports[_0x808b('0x59')]=function(_0x447001,_0x32d4ef,_0x3a0c69){var _0x1e2b49=require(_0x808b('0x4b'));var _0xf94eb6=![];var _0x4aae5f={'$and':[db['sequelize'][_0x808b('0x37')](db[_0x808b('0x5a')]['fn'](_0x808b('0x5b'),db[_0x808b('0x5a')]['col']('uniqueid')),_0x447001['query'][_0x808b('0x5c')])]};if(_0x447001[_0x808b('0x30')][_0x808b('0x3b')]&&_0x447001['query'][_0x808b('0x3b')]===_0x808b('0x4c')){_0x4aae5f['$and']['push']({'uniqueid':_0x447001[_0x808b('0x40')]['id']});}else{_0x4aae5f[_0x808b('0x5d')]['push']({'id':_0x447001['params']['id']});}return db['VoiceRecording']['find']({'where':_0x4aae5f,'attributes':['id',_0x808b('0x4d')],'raw':!![]})[_0x808b('0x23')](handleEntityNotFound(_0x32d4ef,null))[_0x808b('0x23')](function(_0x248137){if(_0x248137){var _0x4cf2d8=util[_0x808b('0x2f')]('%s.cypher',_0x248137['value']);if(fs[_0x808b('0x51')](_0x4cf2d8)){_0xf94eb6=!![];return _0x1e2b49['decryptFile'](_0x4cf2d8,_0x248137[_0x808b('0x4d')],config[_0x808b('0x5e')]['recording'])['then'](function(){return _0x248137;});}return _0x248137;}})[_0x808b('0x23')](function(_0x2b97d3){if(_0x2b97d3){if(!fs[_0x808b('0x51')](_0x2b97d3[_0x808b('0x4d')])){throw new db[(_0x808b('0x52'))][(_0x808b('0x5f'))](_0x808b('0x57'));}if(_0x2b97d3[_0x808b('0x53')]){return _0x32d4ef[_0x808b('0x4a')](_0x2b97d3[_0x808b('0x4d')],_0x2b97d3[_0x808b('0x53')]+path[_0x808b('0x54')](_0x2b97d3[_0x808b('0x4d')]),function(){if(_0xf94eb6){fs[_0x808b('0x55')](_0x2b97d3[_0x808b('0x4d')]);}});}else{return _0x32d4ef[_0x808b('0x4a')](_0x2b97d3[_0x808b('0x4d')],function(_0x2a8e1c){if(_0xf94eb6){fs['unlink'](_0x2b97d3[_0x808b('0x4d')]);}});}}})['catch'](handleError(_0x32d4ef,null));};exports['destroy']=function(_0x5dd67e,_0x1a272e){return db['VoiceRecording'][_0x808b('0x45')]({'where':{'id':_0x5dd67e[_0x808b('0x40')]['id']}})[_0x808b('0x23')](function(_0x13ed66){if(_[_0x808b('0x60')](_0x13ed66)){throw new ReferenceError(_0x808b('0x61'));}return _0x13ed66;})[_0x808b('0x23')](function(_0x57e326){var _0x5ee268=_0x57e326[_0x808b('0x4d')];logger[_0x808b('0x62')]('cancellazione\x20fisica\x20documento\x20%s',_0x5ee268);if(!_[_0x808b('0x60')](_0x57e326[_0x808b('0x4d')])&&fs[_0x808b('0x51')](_0x5ee268)){logger[_0x808b('0x62')](_0x808b('0x63')+_0x5ee268+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x808b('0x64')](_0x5ee268);}_0x5ee268=_0x5ee268+'.cypher';if(!_['isNil'](_0x57e326[_0x808b('0x4d')])&&fs[_0x808b('0x51')](_0x5ee268)){logger['info'](_0x808b('0x63')+_0x5ee268+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x808b('0x64')](_0x5ee268);}return _0x57e326;})['then'](function(_0x3a4f3b){if(!_0x3a4f3b)throw new InternalError();return _0x3a4f3b['destroy']();})[_0x808b('0x23')](function(){_0x1a272e[_0x808b('0x1a')](0xcc)['end']();})[_0x808b('0x46')](handleError(_0x1a272e,null));};function getBucketslist(_0x253299,_0x38fe14,_0x4b74f0){return new Promise(function(_0x426596,_0x174de2){var _0x4bdc37=new AWS['S3']({'accessKeyId':_0x38fe14,'secretAccessKey':_0x253299,'region':_0x4b74f0});_0x4bdc37[_0x808b('0x65')]({},function(_0x4a0ddc,_0x18bd44){if(_0x4a0ddc){return _0x174de2(_0x4a0ddc);}else{return _0x426596(_0x18bd44);}});});}function createBucket(_0x5d2a59,_0x1b0cdf,_0x3a60d9,_0x316cb8){return new Promise(function(_0x28df6b,_0x177d35){var _0x2e7a27=new AWS['S3']({'accessKeyId':_0x1b0cdf,'secretAccessKey':_0x5d2a59,'region':_0x3a60d9});_0x2e7a27[_0x808b('0x66')]({'Bucket':_0x316cb8},function(_0x5f534c,_0x31dbff){if(_0x5f534c){return _0x177d35(_0x5f534c);}else{return _0x28df6b(_0x31dbff);}});});}function uploadFile(_0x19bf8c,_0x34939c,_0x45ade8,_0x3af450,_0x2018d2,_0x5ea448){return new Promise(function(_0xd5246e,_0x5d496e){var _0x2b7d85=new AWS['S3']({'accessKeyId':_0x34939c,'secretAccessKey':_0x19bf8c,'region':_0x45ade8});_0x2b7d85['upload']({'Bucket':_0x3af450,'Key':_0x2018d2,'Body':_0x5ea448},function(_0x21c8a6,_0x761d10){if(_0x21c8a6){return _0x5d496e(_0x21c8a6);}else{return _0xd5246e(_0x761d10);}});});}function startTranscribe(_0x2c883b,_0x19cd13,_0x426c87,_0x30b141,_0x48021f,_0x1da399){return new Promise(function(_0x3164bd,_0x44f47c){var _0x5c8420=new AWS[(_0x808b('0x67'))]({'accessKeyId':_0x19cd13,'secretAccessKey':_0x2c883b,'region':_0x426c87});_0x5c8420[_0x808b('0x68')]({'TranscriptionJobName':_0x30b141,'LanguageCode':_0x48021f,'Media':{'MediaFileUri':_0x1da399}},function(_0x29d870,_0x22cc8f){if(_0x29d870){return _0x44f47c(_0x29d870);}else{return _0x3164bd(_0x22cc8f);}});});}function transcribe(_0x1bdfbf,_0x364cb4,_0x1b78e2,_0x4ec8f0,_0x28533c,_0x1d540c,_0x5a024d){return new Promise(function(_0x16d236,_0x3d3361){var _0x409883={};logger[_0x808b('0x62')](util[_0x808b('0x2f')](_0x808b('0x69'),_0x1bdfbf,_0x28533c));return uploadFile(_0x364cb4,_0x1b78e2,_0x4ec8f0,_0x28533c,path[_0x808b('0x6a')](_0x1d540c),fs[_0x808b('0x6b')](_0x1d540c))[_0x808b('0x23')](function(_0x506326){logger[_0x808b('0x62')](util[_0x808b('0x2f')](_0x808b('0x6c'),_0x1bdfbf,_0x28533c,_0x506326[_0x808b('0x6d')]));_0x409883[_0x808b('0x6e')]=_0x506326['Bucket'];_0x409883['location']=_0x506326[_0x808b('0x6d')];logger[_0x808b('0x62')](util[_0x808b('0x2f')](_0x808b('0x6f'),_0x1bdfbf));return startTranscribe(_0x364cb4,_0x1b78e2,_0x4ec8f0,uuidv4(),_0x5a024d,_0x506326['Location']);})[_0x808b('0x23')](function(_0x38cee4){logger[_0x808b('0x62')](util['format'](_0x808b('0x70'),_0x1bdfbf,_0x38cee4[_0x808b('0x71')][_0x808b('0x72')]));_0x409883[_0x808b('0x73')]=_0x38cee4['TranscriptionJob'][_0x808b('0x72')];_0x409883[_0x808b('0x74')]=_0x38cee4[_0x808b('0x71')][_0x808b('0x75')];return _0x16d236(_0x409883);})[_0x808b('0x46')](function(_0x1466c0){return _0x3d3361(_0x1466c0);});});}exports['runTranscribe']=function(_0x497dd1,_0x114430,_0x152ee8){var _0x33d449;var _0x43ff0e;var _0x43aea7;var _0x58b93d=require(_0x808b('0x4b'));return db['VoiceRecording'][_0x808b('0x76')]({'where':{'id':_0x497dd1[_0x808b('0x40')]['id']}})['then'](function(_0x16d22a){if(_0x16d22a){var _0x2e8b56=util['format']('%s.cypher',_0x16d22a[_0x808b('0x4d')]);if(fs['existsSync'](_0x2e8b56)){cypher=!![];return _0x58b93d[_0x808b('0x4f')](_0x2e8b56,_0x16d22a['value'],config[_0x808b('0x5e')][_0x808b('0x50')])[_0x808b('0x23')](function(){return _0x16d22a;});}return _0x16d22a;}})[_0x808b('0x23')](function(_0x38ef9a){if(!_0x38ef9a){throw new db['Sequelize']['ValidationError'](_0x808b('0x77'));}_0x43ff0e=_0x38ef9a;return db['Setting'][_0x808b('0x76')]({'where':{'id':0x1}});})[_0x808b('0x23')](handleEntityNotFound(_0x114430,null))[_0x808b('0x23')](function(_0x62c6c8){if(_0x62c6c8){_0x33d449=_0x62c6c8;if(!_0x33d449['transcribe']||!_0x33d449[_0x808b('0x78')]||!_0x33d449[_0x808b('0x79')]||!_0x33d449[_0x808b('0x7a')]||!_0x33d449['bucket']){throw new db['Sequelize']['ValidationError']('Transcribe\x20not\x20configured');}if(_0x497dd1['body'][_0x808b('0x7b')]&&(!_0x33d449[_0x808b('0x7c')]||!_0x33d449[_0x808b('0x7d')]||!_0x33d449[_0x808b('0x7e')]||!_0x33d449['language']||!_0x33d449[_0x808b('0x6e')])){throw new db[(_0x808b('0x52'))][(_0x808b('0x5f'))](_0x808b('0x7f'));}return db[_0x808b('0x80')][_0x808b('0x76')]({'where':{'id':_0x33d449[_0x808b('0x78')]}});}})[_0x808b('0x23')](function(_0x5e0fa6){if(!_0x5e0fa6){throw new db['Sequelize']['ValidationError']('Cloud\x20Provider\x20not\x20available');}if(!_0x5e0fa6[_0x808b('0x81')]||!_0x5e0fa6[_0x808b('0x82')]){throw new db[(_0x808b('0x52'))][(_0x808b('0x5f'))](_0x808b('0x83'));}_0x43aea7=_0x5e0fa6;return getBucketslist(_0x43aea7[_0x808b('0x81')],_0x43aea7[_0x808b('0x82')],_0x33d449['transcribeRegion']);})[_0x808b('0x23')](function(_0x5e4d6b){if(_0x5e4d6b&&_0x5e4d6b['Buckets']){var _0x14da90=_[_0x808b('0x45')](_0x5e4d6b[_0x808b('0x84')],function(_0x3bb464){return _0x3bb464[_0x808b('0x85')]===_0x33d449['bucket'];});if(!_0x14da90){logger['info'](util[_0x808b('0x2f')](_0x808b('0x86'),_0x497dd1[_0x808b('0x40')]['id'],_0x33d449[_0x808b('0x6e')]));return createBucket(_0x43aea7[_0x808b('0x81')],_0x43aea7[_0x808b('0x82')],_0x33d449[_0x808b('0x79')],_0x33d449[_0x808b('0x6e')]);}logger[_0x808b('0x62')](util[_0x808b('0x2f')](_0x808b('0x87'),_0x497dd1[_0x808b('0x40')]['id'],_0x33d449[_0x808b('0x6e')]));return;}})[_0x808b('0x23')](function(_0x2c4396){if(_0x43ff0e[_0x808b('0x74')]===_0x808b('0x88')){return transcribe(_0x497dd1[_0x808b('0x40')]['id'],_0x43aea7[_0x808b('0x81')],_0x43aea7[_0x808b('0x82')],_0x33d449['transcribeRegion'],_0x33d449[_0x808b('0x6e')],_0x43ff0e['value'],_0x33d449[_0x808b('0x7a')]);}else{logger['info'](util['format'](_0x808b('0x89'),_0x497dd1['params']['id']));return{'transcribeStatus':_0x808b('0x8a')};}})[_0x808b('0x23')](function(_0x4ed0ef){if(_0x4ed0ef){_0x4ed0ef[_0x808b('0x8b')]=_0x497dd1[_0x808b('0x48')][_0x808b('0x7b')];return _0x43ff0e[_0x808b('0x8c')](_0x4ed0ef);}})['then'](respondWithResult(_0x114430,null))[_0x808b('0x46')](handleError(_0x114430,null));};function writeFile(_0x5d2a64,_0x3c5958){return new Promise(function(_0x5a4df6,_0x40a14e){fs[_0x808b('0x8d')](_0x3c5958,_0x5d2a64,function(_0x3d88f5,_0x489044){if(_0x3d88f5){return _0x40a14e(_0x3d88f5);}else{return _0x5a4df6(_0x489044);}});});}exports['downloadTranscribe']=function(_0x51efd8,_0x51cf8e,_0x3ebbd2){return db[_0x808b('0x2b')]['findOne']({'where':{'id':_0x51efd8[_0x808b('0x40')]['id']}})[_0x808b('0x23')](handleEntityNotFound(_0x51cf8e))[_0x808b('0x23')](function(_0x4d5880){if(_0x4d5880&&_0x4d5880['fileText']){var _0x4f021e=_0x4d5880[_0x808b('0x8e')];var _0x47c7a6=config[_0x808b('0x8f')]+_0x808b('0x90')+_0x4d5880['id']+_0x808b('0x91');if(fs[_0x808b('0x51')](_0x47c7a6)){return _0x47c7a6;}return writeFile(_0x4f021e,_0x47c7a6)[_0x808b('0x23')](function(){return _0x47c7a6;});}else{throw new db[(_0x808b('0x52'))]['ValidationError'](_0x808b('0x92'));}})['then'](function(_0x3b9871){return _0x51cf8e[_0x808b('0x4a')](_0x3b9871);})[_0x808b('0x46')](handleError(_0x51cf8e));}; \ No newline at end of file +var _0x4ede=['then','end','sendStatus','error','stack','name','send','index','rawAttributes','type','key','model','differenceBy','format','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','VoiceRecording','includeAll','include','findAll','catch','show','params','create','body','find','describe','../../components/encryptor','uniqueid','value','%s.cypher','decryptFile','secrets','recording','existsSync','Sequelize','ValidationError','filename','download','extname','unlink','message','VoiceRecording\x20not\x20found','downloads','sequelize','col','token','$and','push','destroy','isNil','Entity\x20not\x20found','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','listBuckets','createBucket','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','readFileSync','Location','bucket','Bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','transcribeName','TranscriptionJobName','transcribeStatus','TranscriptionJob','TranscriptionJobStatus','findOne','Voice\x20Recording\x20not\x20found','Setting','transcribe','language','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','transcribeAccountId','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','transcribeRegion','Buckets','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','tempSentiment','writeFile','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','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','../../mysqldb','status','undefined','limit','count','offset','set','apply','reject','save','update'];(function(_0x10ee69,_0x5e35bd){var _0x3be30a=function(_0x143827){while(--_0x143827){_0x10ee69['push'](_0x10ee69['shift']());}};_0x3be30a(++_0x5e35bd);}(_0x4ede,0x74));var _0xe4ed=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x4ede[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0xe4ed('0x0'));var rimraf=require(_0xe4ed('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe4ed('0x2'));var rp=require(_0xe4ed('0x3'));var moment=require(_0xe4ed('0x4'));var BPromise=require(_0xe4ed('0x5'));var Mustache=require(_0xe4ed('0x6'));var util=require(_0xe4ed('0x7'));var path=require('path');var sox=require(_0xe4ed('0x8'));var csv=require('to-csv');var ejs=require(_0xe4ed('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe4ed('0xa'));var squel=require(_0xe4ed('0xb'));var crypto=require(_0xe4ed('0xc'));var jsforce=require(_0xe4ed('0xd'));var deskjs=require(_0xe4ed('0xe'));var toCsv=require(_0xe4ed('0xf'));var querystring=require(_0xe4ed('0x10'));var Papa=require(_0xe4ed('0x11'));var AWS=require('aws-sdk');var uuidv4=require('uuid/v4');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xe4ed('0x12'));var as=require(_0xe4ed('0x13'));var hardwareService=require(_0xe4ed('0x14'));var logger=require(_0xe4ed('0x15'))(_0xe4ed('0x16'));var utils=require(_0xe4ed('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xe4ed('0x18'))['db'];function respondWithStatusCode(_0x3ea38a,_0x4dc795){_0x4dc795=_0x4dc795||0xcc;return function(_0x20cfe3){if(_0x20cfe3){return _0x3ea38a['sendStatus'](_0x4dc795);}return _0x3ea38a['status'](_0x4dc795)['end']();};}function respondWithResult(_0x22b2b2,_0x50e338){_0x50e338=_0x50e338||0xc8;return function(_0x434e29){if(_0x434e29){return _0x22b2b2[_0xe4ed('0x19')](_0x50e338)['json'](_0x434e29);}};}function respondWithFilteredResult(_0x5b878c,_0x5e0e39){return function(_0xb857ab){if(_0xb857ab){var _0x349e94=typeof _0x5e0e39['offset']===_0xe4ed('0x1a')&&typeof _0x5e0e39[_0xe4ed('0x1b')]==='undefined';var _0x4d1a21=_0xb857ab[_0xe4ed('0x1c')];var _0x30486e=_0x349e94?0x0:_0x5e0e39[_0xe4ed('0x1d')];var _0x137c58=_0x349e94?_0xb857ab['count']:_0x5e0e39[_0xe4ed('0x1d')]+_0x5e0e39[_0xe4ed('0x1b')];var _0x2b9191;if(_0x137c58>=_0x4d1a21){_0x137c58=_0x4d1a21;_0x2b9191=0xc8;}else{_0x2b9191=0xce;}_0x5b878c[_0xe4ed('0x19')](_0x2b9191);return _0x5b878c[_0xe4ed('0x1e')]('Content-Range',_0x30486e+'-'+_0x137c58+'/'+_0x4d1a21)['json'](_0xb857ab);}return null;};}function patchUpdates(_0x33de79){return function(_0x2148b4){try{jsonpatch[_0xe4ed('0x1f')](_0x2148b4,_0x33de79,!![]);}catch(_0x25b054){return BPromise[_0xe4ed('0x20')](_0x25b054);}return _0x2148b4[_0xe4ed('0x21')]();};}function saveUpdates(_0x37c1c5,_0x441ff0){return function(_0x2c859f){if(_0x2c859f){return _0x2c859f[_0xe4ed('0x22')](_0x37c1c5)['then'](function(_0x1d15b5){return _0x1d15b5;});}return null;};}function removeEntity(_0x156c96,_0x52049c){return function(_0x326365){if(_0x326365){return _0x326365['destroy']()[_0xe4ed('0x23')](function(){_0x156c96['status'](0xcc)[_0xe4ed('0x24')]();});}};}function handleEntityNotFound(_0x4d0c04,_0x29f9d0){return function(_0x2bbf20){if(!_0x2bbf20){_0x4d0c04[_0xe4ed('0x25')](0x194);}return _0x2bbf20;};}function handleError(_0x4b16b2,_0x4c8774){_0x4c8774=_0x4c8774||0x1f4;return function(_0x55f095){logger[_0xe4ed('0x26')](_0x55f095[_0xe4ed('0x27')]);if(_0x55f095['name']){delete _0x55f095[_0xe4ed('0x28')];}_0x4b16b2[_0xe4ed('0x19')](_0x4c8774)[_0xe4ed('0x29')](_0x55f095);};}exports[_0xe4ed('0x2a')]=function(_0x3746d9,_0x4411f7){var _0x398c91={},_0x2f3d6b={},_0x5e1e3b={'count':0x0,'rows':[]};var _0x45bef3=_['map'](db['VoiceRecording'][_0xe4ed('0x2b')],function(_0x577fff){return{'name':_0x577fff['fieldName'],'type':_0x577fff[_0xe4ed('0x2c')][_0xe4ed('0x2d')]};});_0x2f3d6b[_0xe4ed('0x2e')]=_[_0xe4ed('0x2f')](_['map'](_0x45bef3,'name'),[_0xe4ed('0x30')]);_0x2f3d6b[_0xe4ed('0x31')]=_[_0xe4ed('0x32')](_0x3746d9[_0xe4ed('0x31')]);_0x2f3d6b[_0xe4ed('0x33')]=_[_0xe4ed('0x34')](_0x2f3d6b[_0xe4ed('0x2e')],_0x2f3d6b['query']);_0x398c91[_0xe4ed('0x35')]=_[_0xe4ed('0x34')](_0x2f3d6b[_0xe4ed('0x2e')],qs['fields'](_0x3746d9[_0xe4ed('0x31')][_0xe4ed('0x36')]));_0x398c91[_0xe4ed('0x35')]=_0x398c91['attributes'][_0xe4ed('0x37')]?_0x398c91[_0xe4ed('0x35')]:_0x2f3d6b['model'];if(!_0x3746d9[_0xe4ed('0x31')]['hasOwnProperty'](_0xe4ed('0x38'))){_0x398c91['limit']=qs[_0xe4ed('0x1b')](_0x3746d9[_0xe4ed('0x31')][_0xe4ed('0x1b')]);_0x398c91[_0xe4ed('0x1d')]=qs[_0xe4ed('0x1d')](_0x3746d9['query']['offset']);}_0x398c91[_0xe4ed('0x39')]=qs[_0xe4ed('0x3a')](_0x3746d9['query'][_0xe4ed('0x3a')]);_0x398c91['where']=qs[_0xe4ed('0x33')](_[_0xe4ed('0x3b')](_0x3746d9[_0xe4ed('0x31')],_0x2f3d6b[_0xe4ed('0x33')]),_0x45bef3);if(_0x3746d9[_0xe4ed('0x31')][_0xe4ed('0x3c')]){_0x398c91[_0xe4ed('0x3d')]=_[_0xe4ed('0x3e')](_0x398c91[_0xe4ed('0x3d')],{'$or':_['map'](_0x45bef3,function(_0xdcf8bd){if(_0xdcf8bd[_0xe4ed('0x2c')]!==_0xe4ed('0x3f')){var _0x3589ac={};_0x3589ac[_0xdcf8bd[_0xe4ed('0x28')]]={'$like':'%'+_0x3746d9[_0xe4ed('0x31')][_0xe4ed('0x3c')]+'%'};return _0x3589ac;}})});}_0x398c91=_['merge']({},_0x398c91,_0x3746d9[_0xe4ed('0x40')]);var _0x424997={'where':_0x398c91[_0xe4ed('0x3d')]};return db[_0xe4ed('0x41')][_0xe4ed('0x1c')](_0x424997)[_0xe4ed('0x23')](function(_0x32f050){_0x5e1e3b[_0xe4ed('0x1c')]=_0x32f050;if(_0x3746d9[_0xe4ed('0x31')][_0xe4ed('0x42')]){_0x398c91[_0xe4ed('0x43')]=[{'all':!![]}];}return db[_0xe4ed('0x41')][_0xe4ed('0x44')](_0x398c91);})[_0xe4ed('0x23')](function(_0x387050){_0x5e1e3b['rows']=_0x387050;return _0x5e1e3b;})[_0xe4ed('0x23')](respondWithFilteredResult(_0x4411f7,_0x398c91))[_0xe4ed('0x45')](handleError(_0x4411f7,null));};exports[_0xe4ed('0x46')]=function(_0x55976c,_0x3ab368){var _0x59e109={'raw':![],'where':{'id':_0x55976c[_0xe4ed('0x47')]['id']}},_0x5096a2={};_0x5096a2[_0xe4ed('0x2e')]=_['keys'](db[_0xe4ed('0x41')][_0xe4ed('0x2b')]);_0x5096a2[_0xe4ed('0x31')]=_[_0xe4ed('0x32')](_0x55976c[_0xe4ed('0x31')]);_0x5096a2[_0xe4ed('0x33')]=_[_0xe4ed('0x34')](_0x5096a2[_0xe4ed('0x2e')],_0x5096a2[_0xe4ed('0x31')]);_0x59e109[_0xe4ed('0x35')]=_['intersection'](_0x5096a2['model'],qs['fields'](_0x55976c[_0xe4ed('0x31')][_0xe4ed('0x36')]));_0x59e109[_0xe4ed('0x35')]=_0x59e109[_0xe4ed('0x35')][_0xe4ed('0x37')]?_0x59e109[_0xe4ed('0x35')]:_0x5096a2[_0xe4ed('0x2e')];if(_0x55976c[_0xe4ed('0x31')]['includeAll']){_0x59e109['include']=[{'all':!![]}];}_0x59e109=_[_0xe4ed('0x3e')]({},_0x59e109,_0x55976c[_0xe4ed('0x40')]);return db[_0xe4ed('0x41')]['find'](_0x59e109)[_0xe4ed('0x23')](handleEntityNotFound(_0x3ab368,null))[_0xe4ed('0x23')](respondWithResult(_0x3ab368,null))[_0xe4ed('0x45')](handleError(_0x3ab368,null));};exports['create']=function(_0x55eed1,_0x24bab2){return db[_0xe4ed('0x41')][_0xe4ed('0x48')](_0x55eed1['body'],{})['then'](respondWithResult(_0x24bab2,0xc9))['catch'](handleError(_0x24bab2,null));};exports[_0xe4ed('0x22')]=function(_0x322ce4,_0x327c94){if(_0x322ce4['body']['id']){delete _0x322ce4[_0xe4ed('0x49')]['id'];}return db[_0xe4ed('0x41')][_0xe4ed('0x4a')]({'where':{'id':_0x322ce4[_0xe4ed('0x47')]['id']}})[_0xe4ed('0x23')](handleEntityNotFound(_0x327c94,null))[_0xe4ed('0x23')](saveUpdates(_0x322ce4[_0xe4ed('0x49')],null))[_0xe4ed('0x23')](respondWithResult(_0x327c94,null))[_0xe4ed('0x45')](handleError(_0x327c94,null));};exports[_0xe4ed('0x4b')]=function(_0x194387,_0xe8e0af){return db['VoiceRecording'][_0xe4ed('0x4b')]()['then'](respondWithResult(_0xe8e0af,null))[_0xe4ed('0x45')](handleError(_0xe8e0af,null));};exports['download']=function(_0x9dfe44,_0x56e597,_0x4927b1){var _0x5ce959=require(_0xe4ed('0x4c'));var _0x487dbf=![];var _0x186ae3={};if(_0x9dfe44[_0xe4ed('0x31')][_0xe4ed('0x2c')]&&_0x9dfe44[_0xe4ed('0x31')][_0xe4ed('0x2c')]===_0xe4ed('0x4d')){_0x186ae3['uniqueid']=_0x9dfe44[_0xe4ed('0x47')]['id'];}else{_0x186ae3['id']=_0x9dfe44['params']['id'];}return db[_0xe4ed('0x41')][_0xe4ed('0x4a')]({'where':_0x186ae3,'attributes':['id',_0xe4ed('0x4e')],'raw':!![]})['then'](handleEntityNotFound(_0x56e597,null))['then'](function(_0x358079){if(_0x358079){var _0x27b7d6=_0x358079['value'];var _0x35bef0=util[_0xe4ed('0x30')](_0xe4ed('0x4f'),_0x27b7d6);if(fs['existsSync'](_0x35bef0)){_0x487dbf=!![];return _0x5ce959[_0xe4ed('0x50')](_0x35bef0,_0x27b7d6,config[_0xe4ed('0x51')][_0xe4ed('0x52')])['then'](function(){return _0x358079;});}return _0x358079;}})[_0xe4ed('0x23')](function(_0x478eb8){if(_0x478eb8){var _0x2d06a3=_0x478eb8['value'];if(!fs[_0xe4ed('0x53')](_0x2d06a3)){throw new db[(_0xe4ed('0x54'))][(_0xe4ed('0x55'))]('VoiceRecording\x20not\x20found');}if(_0x478eb8[_0xe4ed('0x56')]){return _0x56e597[_0xe4ed('0x57')](_0x2d06a3,_0x478eb8[_0xe4ed('0x56')]+path[_0xe4ed('0x58')](_0x2d06a3),function(){if(_0x487dbf){fs['unlink'](_0x2d06a3);}});}else{return _0x56e597['download'](_0x2d06a3,function(_0x22f428){if(_0x487dbf){fs[_0xe4ed('0x59')](_0x2d06a3);}});}}})[_0xe4ed('0x45')](function(_0x570106){if(_0x570106[_0xe4ed('0x5a')]===_0xe4ed('0x5b')){_0x56e597[_0xe4ed('0x19')](0x194)[_0xe4ed('0x29')]('Not\x20found');}else{return handleError(_0x56e597,null);}});};exports[_0xe4ed('0x5c')]=function(_0x1d0dec,_0x4909ab,_0x44ea6b){var _0x2486cb=require(_0xe4ed('0x4c'));var _0x199f81=![];var _0x5d2032={'$and':[db[_0xe4ed('0x5d')][_0xe4ed('0x3d')](db[_0xe4ed('0x5d')]['fn']('MD5',db[_0xe4ed('0x5d')][_0xe4ed('0x5e')](_0xe4ed('0x4d'))),_0x1d0dec[_0xe4ed('0x31')][_0xe4ed('0x5f')])]};if(_0x1d0dec['query'][_0xe4ed('0x2c')]&&_0x1d0dec['query'][_0xe4ed('0x2c')]===_0xe4ed('0x4d')){_0x5d2032[_0xe4ed('0x60')][_0xe4ed('0x61')]({'uniqueid':_0x1d0dec[_0xe4ed('0x47')]['id']});}else{_0x5d2032[_0xe4ed('0x60')][_0xe4ed('0x61')]({'id':_0x1d0dec[_0xe4ed('0x47')]['id']});}return db['VoiceRecording'][_0xe4ed('0x4a')]({'where':_0x5d2032,'attributes':['id',_0xe4ed('0x4e')],'raw':!![]})[_0xe4ed('0x23')](handleEntityNotFound(_0x4909ab,null))['then'](function(_0x375251){if(_0x375251){var _0x257cd6=util[_0xe4ed('0x30')](_0xe4ed('0x4f'),_0x375251[_0xe4ed('0x4e')]);if(fs[_0xe4ed('0x53')](_0x257cd6)){_0x199f81=!![];return _0x2486cb['decryptFile'](_0x257cd6,_0x375251[_0xe4ed('0x4e')],config[_0xe4ed('0x51')][_0xe4ed('0x52')])[_0xe4ed('0x23')](function(){return _0x375251;});}return _0x375251;}})['then'](function(_0x5bf6b9){if(_0x5bf6b9){if(!fs[_0xe4ed('0x53')](_0x5bf6b9[_0xe4ed('0x4e')])){throw new db['Sequelize'][(_0xe4ed('0x55'))](_0xe4ed('0x5b'));}if(_0x5bf6b9[_0xe4ed('0x56')]){return _0x4909ab[_0xe4ed('0x57')](_0x5bf6b9['value'],_0x5bf6b9[_0xe4ed('0x56')]+path[_0xe4ed('0x58')](_0x5bf6b9[_0xe4ed('0x4e')]),function(){if(_0x199f81){fs[_0xe4ed('0x59')](_0x5bf6b9[_0xe4ed('0x4e')]);}});}else{return _0x4909ab[_0xe4ed('0x57')](_0x5bf6b9['value'],function(_0x31eab6){if(_0x199f81){fs[_0xe4ed('0x59')](_0x5bf6b9[_0xe4ed('0x4e')]);}});}}})[_0xe4ed('0x45')](handleError(_0x4909ab,null));};exports[_0xe4ed('0x62')]=function(_0x2ea22f,_0x251af4){return db['VoiceRecording'][_0xe4ed('0x4a')]({'where':{'id':_0x2ea22f['params']['id']}})[_0xe4ed('0x23')](function(_0x376a18){if(_[_0xe4ed('0x63')](_0x376a18)){throw new ReferenceError(_0xe4ed('0x64'));}return _0x376a18;})[_0xe4ed('0x23')](function(_0x46a63d){var _0x577cc7=_0x46a63d[_0xe4ed('0x4e')];logger['info']('cancellazione\x20fisica\x20documento\x20%s',_0x577cc7);if(!_['isNil'](_0x46a63d['value'])&&fs[_0xe4ed('0x53')](_0x577cc7)){logger[_0xe4ed('0x65')](_0xe4ed('0x66')+_0x577cc7+_0xe4ed('0x67'));fs['unlinkSync'](_0x577cc7);}_0x577cc7=_0x577cc7+'.cypher';if(!_[_0xe4ed('0x63')](_0x46a63d[_0xe4ed('0x4e')])&&fs[_0xe4ed('0x53')](_0x577cc7)){logger[_0xe4ed('0x65')](_0xe4ed('0x66')+_0x577cc7+_0xe4ed('0x67'));fs[_0xe4ed('0x68')](_0x577cc7);}return _0x46a63d;})[_0xe4ed('0x23')](function(_0x8a5cec){if(!_0x8a5cec)throw new InternalError();return _0x8a5cec[_0xe4ed('0x62')]();})[_0xe4ed('0x23')](function(){_0x251af4[_0xe4ed('0x19')](0xcc)[_0xe4ed('0x24')]();})[_0xe4ed('0x45')](handleError(_0x251af4,null));};function getBucketslist(_0x452ae6,_0x260d42,_0x285324){return new Promise(function(_0x2def64,_0x5385b5){var _0x16ca84=new AWS['S3']({'accessKeyId':_0x260d42,'secretAccessKey':_0x452ae6,'region':_0x285324});_0x16ca84[_0xe4ed('0x69')]({},function(_0x29c0ae,_0x294e52){if(_0x29c0ae){return _0x5385b5(_0x29c0ae);}else{return _0x2def64(_0x294e52);}});});}function createBucket(_0x37bcca,_0x48ce16,_0x5d14ba,_0x8298f7){return new Promise(function(_0x48b53f,_0x370049){var _0x2a99d9=new AWS['S3']({'accessKeyId':_0x48ce16,'secretAccessKey':_0x37bcca,'region':_0x5d14ba});_0x2a99d9[_0xe4ed('0x6a')]({'Bucket':_0x8298f7},function(_0x13a1ac,_0xc619af){if(_0x13a1ac){return _0x370049(_0x13a1ac);}else{return _0x48b53f(_0xc619af);}});});}function uploadFile(_0x14eb45,_0x40399f,_0x1adca8,_0x227940,_0xda7e36,_0x16452e){return new Promise(function(_0x1228d4,_0x2ddf25){var _0x2500f0=new AWS['S3']({'accessKeyId':_0x40399f,'secretAccessKey':_0x14eb45,'region':_0x1adca8});_0x2500f0['upload']({'Bucket':_0x227940,'Key':_0xda7e36,'Body':_0x16452e},function(_0x1f69ff,_0x2f11ba){if(_0x1f69ff){return _0x2ddf25(_0x1f69ff);}else{return _0x1228d4(_0x2f11ba);}});});}function startTranscribe(_0x3750a1,_0x29639b,_0x475ddc,_0x48dfcf,_0x48e8d7,_0x1f762f){return new Promise(function(_0x25eb72,_0xf34e68){var _0x3ae9b4=new AWS['TranscribeService']({'accessKeyId':_0x29639b,'secretAccessKey':_0x3750a1,'region':_0x475ddc});_0x3ae9b4['startTranscriptionJob']({'TranscriptionJobName':_0x48dfcf,'LanguageCode':_0x48e8d7,'Media':{'MediaFileUri':_0x1f762f}},function(_0x2e32d8,_0x14952f){if(_0x2e32d8){return _0xf34e68(_0x2e32d8);}else{return _0x25eb72(_0x14952f);}});});}function transcribe(_0xb5e8fe,_0x744578,_0x36b9db,_0x50b1e3,_0x9fbab9,_0x404b05,_0xf96c0c){return new Promise(function(_0x1a6f8b,_0x4961e9){var _0x3c5d07={};logger[_0xe4ed('0x65')](util['format'](_0xe4ed('0x6b'),_0xb5e8fe,_0x9fbab9));return uploadFile(_0x744578,_0x36b9db,_0x50b1e3,_0x9fbab9,path['basename'](_0x404b05),fs[_0xe4ed('0x6c')](_0x404b05))['then'](function(_0xb9e112){logger[_0xe4ed('0x65')](util['format']('[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)',_0xb5e8fe,_0x9fbab9,_0xb9e112[_0xe4ed('0x6d')]));_0x3c5d07[_0xe4ed('0x6e')]=_0xb9e112[_0xe4ed('0x6f')];_0x3c5d07[_0xe4ed('0x70')]=_0xb9e112[_0xe4ed('0x6d')];logger[_0xe4ed('0x65')](util[_0xe4ed('0x30')](_0xe4ed('0x71'),_0xb5e8fe));return startTranscribe(_0x744578,_0x36b9db,_0x50b1e3,uuidv4(),_0xf96c0c,_0xb9e112['Location']);})['then'](function(_0x16b9a0){logger[_0xe4ed('0x65')](util['format'](_0xe4ed('0x72'),_0xb5e8fe,_0x16b9a0['TranscriptionJob']['TranscriptionJobName']));_0x3c5d07[_0xe4ed('0x73')]=_0x16b9a0['TranscriptionJob'][_0xe4ed('0x74')];_0x3c5d07[_0xe4ed('0x75')]=_0x16b9a0[_0xe4ed('0x76')][_0xe4ed('0x77')];return _0x1a6f8b(_0x3c5d07);})[_0xe4ed('0x45')](function(_0x47b346){return _0x4961e9(_0x47b346);});});}exports['runTranscribe']=function(_0x82554f,_0x60771e,_0x5ae201){var _0x120d26;var _0x32c78a;var _0x50c0cf;var _0x1e64ff=require(_0xe4ed('0x4c'));return db[_0xe4ed('0x41')][_0xe4ed('0x78')]({'where':{'id':_0x82554f['params']['id']}})[_0xe4ed('0x23')](function(_0xa3898d){if(_0xa3898d){var _0x6c923d=util[_0xe4ed('0x30')]('%s.cypher',_0xa3898d[_0xe4ed('0x4e')]);if(fs['existsSync'](_0x6c923d)){cypher=!![];return _0x1e64ff[_0xe4ed('0x50')](_0x6c923d,_0xa3898d['value'],config['secrets'][_0xe4ed('0x52')])['then'](function(){return _0xa3898d;});}return _0xa3898d;}})[_0xe4ed('0x23')](function(_0x5175f2){if(!_0x5175f2){throw new db[(_0xe4ed('0x54'))][(_0xe4ed('0x55'))](_0xe4ed('0x79'));}_0x32c78a=_0x5175f2;return db[_0xe4ed('0x7a')]['findOne']({'where':{'id':0x1}});})[_0xe4ed('0x23')](handleEntityNotFound(_0x60771e,null))[_0xe4ed('0x23')](function(_0x149e21){if(_0x149e21){_0x120d26=_0x149e21;if(!_0x120d26[_0xe4ed('0x7b')]||!_0x120d26['transcribeAccountId']||!_0x120d26['transcribeRegion']||!_0x120d26[_0xe4ed('0x7c')]||!_0x120d26['bucket']){throw new db[(_0xe4ed('0x54'))][(_0xe4ed('0x55'))](_0xe4ed('0x7d'));}if(_0x82554f[_0xe4ed('0x49')][_0xe4ed('0x7e')]&&(!_0x120d26[_0xe4ed('0x7f')]||!_0x120d26[_0xe4ed('0x80')]||!_0x120d26[_0xe4ed('0x81')]||!_0x120d26[_0xe4ed('0x7c')]||!_0x120d26[_0xe4ed('0x6e')])){throw new db['Sequelize'][(_0xe4ed('0x55'))](_0xe4ed('0x82'));}return db[_0xe4ed('0x83')][_0xe4ed('0x78')]({'where':{'id':_0x120d26[_0xe4ed('0x84')]}});}})['then'](function(_0x5e03be){if(!_0x5e03be){throw new db[(_0xe4ed('0x54'))][(_0xe4ed('0x55'))](_0xe4ed('0x85'));}if(!_0x5e03be[_0xe4ed('0x86')]||!_0x5e03be[_0xe4ed('0x87')]){throw new db[(_0xe4ed('0x54'))][(_0xe4ed('0x55'))](_0xe4ed('0x88'));}_0x50c0cf=_0x5e03be;return getBucketslist(_0x50c0cf[_0xe4ed('0x86')],_0x50c0cf['data2'],_0x120d26[_0xe4ed('0x89')]);})[_0xe4ed('0x23')](function(_0x2cc297){if(_0x2cc297&&_0x2cc297[_0xe4ed('0x8a')]){var _0x4399ee=_['find'](_0x2cc297[_0xe4ed('0x8a')],function(_0x5f5861){return _0x5f5861['Name']===_0x120d26[_0xe4ed('0x6e')];});if(!_0x4399ee){logger['info'](util[_0xe4ed('0x30')](_0xe4ed('0x8b'),_0x82554f[_0xe4ed('0x47')]['id'],_0x120d26['bucket']));return createBucket(_0x50c0cf[_0xe4ed('0x86')],_0x50c0cf[_0xe4ed('0x87')],_0x120d26[_0xe4ed('0x89')],_0x120d26['bucket']);}logger[_0xe4ed('0x65')](util[_0xe4ed('0x30')](_0xe4ed('0x8c'),_0x82554f[_0xe4ed('0x47')]['id'],_0x120d26['bucket']));return;}})['then'](function(_0x37c30b){if(_0x32c78a['transcribeStatus']===_0xe4ed('0x8d')){return transcribe(_0x82554f[_0xe4ed('0x47')]['id'],_0x50c0cf[_0xe4ed('0x86')],_0x50c0cf['data2'],_0x120d26[_0xe4ed('0x89')],_0x120d26[_0xe4ed('0x6e')],_0x32c78a[_0xe4ed('0x4e')],_0x120d26[_0xe4ed('0x7c')]);}else{logger[_0xe4ed('0x65')](util[_0xe4ed('0x30')](_0xe4ed('0x8e'),_0x82554f[_0xe4ed('0x47')]['id']));return{'transcribeStatus':'IN_PROGRESS'};}})[_0xe4ed('0x23')](function(_0x544499){if(_0x544499){_0x544499[_0xe4ed('0x8f')]=_0x82554f[_0xe4ed('0x49')][_0xe4ed('0x7e')];return _0x32c78a['updateAttributes'](_0x544499);}})[_0xe4ed('0x23')](respondWithResult(_0x60771e,null))['catch'](handleError(_0x60771e,null));};function writeFile(_0x81d80d,_0x7697d3){return new Promise(function(_0x5f3a14,_0x8bac5a){fs[_0xe4ed('0x90')](_0x7697d3,_0x81d80d,function(_0xd27c9f,_0xcd99ab){if(_0xd27c9f){return _0x8bac5a(_0xd27c9f);}else{return _0x5f3a14(_0xcd99ab);}});});}exports[_0xe4ed('0x91')]=function(_0x1bffc4,_0x4c6c84,_0x32ff0b){return db[_0xe4ed('0x41')][_0xe4ed('0x78')]({'where':{'id':_0x1bffc4[_0xe4ed('0x47')]['id']}})[_0xe4ed('0x23')](handleEntityNotFound(_0x4c6c84))[_0xe4ed('0x23')](function(_0x3e8741){if(_0x3e8741&&_0x3e8741[_0xe4ed('0x92')]){var _0x289e67=_0x3e8741[_0xe4ed('0x92')];var _0x27588c=config[_0xe4ed('0x93')]+_0xe4ed('0x94')+_0x3e8741['id']+_0xe4ed('0x95');if(fs[_0xe4ed('0x53')](_0x27588c)){return _0x27588c;}return writeFile(_0x289e67,_0x27588c)[_0xe4ed('0x23')](function(){return _0x27588c;});}else{throw new db[(_0xe4ed('0x54'))]['ValidationError'](_0xe4ed('0x96'));}})[_0xe4ed('0x23')](function(_0x75557e){return _0x4c6c84[_0xe4ed('0x57')](_0x75557e);})['catch'](handleError(_0x4c6c84));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index a0e35c2..e933391 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 _0x8d9b=['./voiceRecording.attributes','exports','define','uniqueid','transcribeStatus'];(function(_0x3d5cc8,_0x239b42){var _0x51eeaf=function(_0xef5444){while(--_0xef5444){_0x3d5cc8['push'](_0x3d5cc8['shift']());}};_0x51eeaf(++_0x239b42);}(_0x8d9b,0x104));var _0xb8d9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8d9b[_0x3dd15e];return _0x231fd0;};'use strict';var attributes=require(_0xb8d9('0x0'));module[_0xb8d9('0x1')]=function(_0x2a3616,_0x8360b6){return _0x2a3616[_0xb8d9('0x2')]('VoiceRecording',attributes,{'tableName':'voice_recordings','paranoid':![],'indexes':[{'name':_0xb8d9('0x3'),'fields':['uniqueid']},{'name':_0xb8d9('0x4'),'fields':[_0xb8d9('0x4')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xeb0d=['transcribeStatus','./voiceRecording.attributes','define','VoiceRecording','uniqueid'];(function(_0x4fbdb6,_0x2ddb97){var _0x12b424=function(_0x252168){while(--_0x252168){_0x4fbdb6['push'](_0x4fbdb6['shift']());}};_0x12b424(++_0x2ddb97);}(_0xeb0d,0xe2));var _0xdeb0=function(_0x40d8d6,_0x1cc157){_0x40d8d6=_0x40d8d6-0x0;var _0xbc384f=_0xeb0d[_0x40d8d6];return _0xbc384f;};'use strict';var attributes=require(_0xdeb0('0x0'));module['exports']=function(_0x501863,_0x515f56){return _0x501863[_0xdeb0('0x1')](_0xdeb0('0x2'),attributes,{'tableName':'voice_recordings','paranoid':![],'indexes':[{'name':_0xdeb0('0x3'),'fields':[_0xdeb0('0x3')]},{'name':_0xdeb0('0x4'),'fields':[_0xdeb0('0x4')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index dad98ff..d88ab7b 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 _0x955f=['randomstring','../../mysqldb','rpc','jayson/promise','client','http','request','then','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','update','body','options','raw','where','attributes','limit','debug','UpdateVoiceRecording','CreateVoiceRecording','../../components/encryptor','Setting','findOne','callRecordingEncryption','VoiceRecording','create','existsSync','%s.cypher','value','encryptFile','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','lodash','util','moment','bluebird'];(function(_0x47b7bb,_0x17e6d8){var _0x5c47a0=function(_0x35347a){while(--_0x35347a){_0x47b7bb['push'](_0x47b7bb['shift']());}};_0x5c47a0(++_0x17e6d8);}(_0x955f,0x1eb));var _0xf955=function(_0x25b64a,_0x3640a8){_0x25b64a=_0x25b64a-0x0;var _0x479b01=_0x955f[_0x25b64a];return _0x479b01;};'use strict';var _=require(_0xf955('0x0'));var util=require(_0xf955('0x1'));var moment=require(_0xf955('0x2'));var BPromise=require(_0xf955('0x3'));var rs=require(_0xf955('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf955('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xf955('0x6'));var config=require('../../config/environment');var jayson=require(_0xf955('0x7'));var client=jayson[_0xf955('0x8')][_0xf955('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x59d5b3,_0x18432f,_0x20c096){return new BPromise(function(_0x4f58fb,_0x254b38){return client[_0xf955('0xa')](_0x59d5b3,_0x20c096)[_0xf955('0xb')](function(_0x38b190){logger[_0xf955('0xc')](_0xf955('0xd'),_0x18432f,_0xf955('0xe'));logger['debug'](_0xf955('0xf'),_0x18432f,'request\x20sent',JSON[_0xf955('0x10')](_0x38b190));if(_0x38b190[_0xf955('0x11')]){if(_0x38b190[_0xf955('0x11')]['code']===0x1f4){logger[_0xf955('0x11')]('VoiceRecording,\x20%s,\x20%s',_0x18432f,_0x38b190[_0xf955('0x11')]['message']);return _0x254b38(_0x38b190[_0xf955('0x11')][_0xf955('0x12')]);}logger[_0xf955('0x11')](_0xf955('0xd'),_0x18432f,_0x38b190[_0xf955('0x11')][_0xf955('0x12')]);return _0x4f58fb(_0x38b190[_0xf955('0x11')][_0xf955('0x12')]);}else{logger[_0xf955('0xc')](_0xf955('0xd'),_0x18432f,'request\x20sent');_0x4f58fb(_0x38b190[_0xf955('0x13')]['message']);}})[_0xf955('0x14')](function(_0x3a814f){logger[_0xf955('0x11')](_0xf955('0xd'),_0x18432f,_0x3a814f);_0x254b38(_0x3a814f);});});}exports['UpdateVoiceRecording']=function(_0x5ac6cb){var _0x1e20d1=this;return new Promise(function(_0xe6de5c,_0x3c49c0){return db['VoiceRecording'][_0xf955('0x15')](_0x5ac6cb[_0xf955('0x16')],{'raw':_0x5ac6cb[_0xf955('0x17')]?_0x5ac6cb[_0xf955('0x17')][_0xf955('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5ac6cb['options']?_0x5ac6cb[_0xf955('0x17')][_0xf955('0x19')]||null:null,'attributes':_0x5ac6cb[_0xf955('0x17')]?_0x5ac6cb['options'][_0xf955('0x1a')]||null:null,'limit':_0x5ac6cb['options']?_0x5ac6cb[_0xf955('0x17')][_0xf955('0x1b')]||null:null})[_0xf955('0xb')](function(_0xa4ebb4){logger[_0xf955('0xc')]('UpdateVoiceRecording',_0x5ac6cb);logger[_0xf955('0x1c')](_0xf955('0x1d'),_0x5ac6cb,JSON[_0xf955('0x10')](_0xa4ebb4));_0xe6de5c(_0xa4ebb4);})[_0xf955('0x14')](function(_0x17dec2){logger[_0xf955('0x11')](_0xf955('0x1d'),_0x17dec2['message'],_0x5ac6cb);_0x3c49c0(_0x1e20d1[_0xf955('0x11')](0x1f4,_0x17dec2[_0xf955('0x12')]));});});};exports[_0xf955('0x1e')]=function(_0x406632){var _0x2dcd55=this;return new Promise(function(_0x13a86d,_0x3796f7){var _0x51f3ab=require(_0xf955('0x1f'));var _0x145098;return db[_0xf955('0x20')][_0xf955('0x21')]({'attributes':['id',_0xf955('0x22')],'where':{'id':0x1},'raw':!![]})[_0xf955('0xb')](function(_0x4d4af0){_0x145098=_0x4d4af0;return db[_0xf955('0x23')][_0xf955('0x24')](_0x406632['body']);})[_0xf955('0xb')](function(_0x2c8df1){if(_0x145098[_0xf955('0x22')]&&fs[_0xf955('0x25')](_0x2c8df1['value'])){var _0x3a951c=util['format'](_0xf955('0x26'),_0x2c8df1[_0xf955('0x27')]);return _0x51f3ab[_0xf955('0x28')](_0x2c8df1[_0xf955('0x27')],_0x3a951c,config[_0xf955('0x29')][_0xf955('0x2a')])[_0xf955('0xb')](function(){fs[_0xf955('0x2b')](_0x2c8df1['value']);logger[_0xf955('0xc')](_0xf955('0x2c'));return _0x2c8df1;});}return _0x2c8df1;})[_0xf955('0xb')](function(_0x2046c8){logger['info'](_0xf955('0x1e'),_0x406632);logger[_0xf955('0x1c')](_0xf955('0x1e'),_0x406632,JSON[_0xf955('0x10')](_0x2046c8));_0x13a86d(_0x2046c8);})[_0xf955('0x14')](function(_0x4eb2c3){logger['error']('CreateVoiceRecording',_0x4eb2c3[_0xf955('0x12')],_0x406632);_0x3796f7(_0x2dcd55[_0xf955('0x11')](0x1f4,_0x4eb2c3[_0xf955('0x12')]));});});}; \ No newline at end of file +var _0x68b3=['../../components/encryptor','Setting','findOne','callRecordingEncryption','existsSync','format','%s.cypher','value','encryptFile','secrets','recording','unlink','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','UpdateVoiceRecording','VoiceRecording','update','body','options','raw','where','attributes','limit','CreateVoiceRecording'];(function(_0x452c06,_0x2d6a45){var _0x3c4e54=function(_0x4ad95c){while(--_0x4ad95c){_0x452c06['push'](_0x452c06['shift']());}};_0x3c4e54(++_0x2d6a45);}(_0x68b3,0x1d8));var _0x368b=function(_0x214c24,_0x2d6657){_0x214c24=_0x214c24-0x0;var _0x4a97fa=_0x68b3[_0x214c24];return _0x4a97fa;};'use strict';var _=require(_0x368b('0x0'));var util=require(_0x368b('0x1'));var moment=require(_0x368b('0x2'));var BPromise=require(_0x368b('0x3'));var rs=require(_0x368b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x368b('0x5'))['db'];var utils=require(_0x368b('0x6'));var logger=require(_0x368b('0x7'))(_0x368b('0x8'));var config=require('../../config/environment');var jayson=require(_0x368b('0x9'));var client=jayson[_0x368b('0xa')][_0x368b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x23584a,_0x4406c8,_0x127c1e){return new BPromise(function(_0x2dec1c,_0x142d05){return client[_0x368b('0xc')](_0x23584a,_0x127c1e)[_0x368b('0xd')](function(_0x2a7b9f){logger['info'](_0x368b('0xe'),_0x4406c8,_0x368b('0xf'));logger[_0x368b('0x10')]('VoiceRecording,\x20%s,\x20%s,\x20%s',_0x4406c8,_0x368b('0xf'),JSON[_0x368b('0x11')](_0x2a7b9f));if(_0x2a7b9f[_0x368b('0x12')]){if(_0x2a7b9f['error'][_0x368b('0x13')]===0x1f4){logger[_0x368b('0x12')]('VoiceRecording,\x20%s,\x20%s',_0x4406c8,_0x2a7b9f[_0x368b('0x12')][_0x368b('0x14')]);return _0x142d05(_0x2a7b9f[_0x368b('0x12')][_0x368b('0x14')]);}logger[_0x368b('0x12')]('VoiceRecording,\x20%s,\x20%s',_0x4406c8,_0x2a7b9f[_0x368b('0x12')][_0x368b('0x14')]);return _0x2dec1c(_0x2a7b9f['error'][_0x368b('0x14')]);}else{logger[_0x368b('0x15')](_0x368b('0xe'),_0x4406c8,'request\x20sent');_0x2dec1c(_0x2a7b9f[_0x368b('0x16')][_0x368b('0x14')]);}})[_0x368b('0x17')](function(_0x4d6d9d){logger[_0x368b('0x12')](_0x368b('0xe'),_0x4406c8,_0x4d6d9d);_0x142d05(_0x4d6d9d);});});}exports[_0x368b('0x18')]=function(_0x540f57){var _0x5d543e=this;return new Promise(function(_0x3e2e9f,_0x27d2a0){return db[_0x368b('0x19')][_0x368b('0x1a')](_0x540f57[_0x368b('0x1b')],{'raw':_0x540f57['options']?_0x540f57[_0x368b('0x1c')][_0x368b('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x540f57[_0x368b('0x1c')]?_0x540f57[_0x368b('0x1c')][_0x368b('0x1e')]||null:null,'attributes':_0x540f57[_0x368b('0x1c')]?_0x540f57[_0x368b('0x1c')][_0x368b('0x1f')]||null:null,'limit':_0x540f57['options']?_0x540f57[_0x368b('0x1c')][_0x368b('0x20')]||null:null})[_0x368b('0xd')](function(_0xc0f7af){logger[_0x368b('0x15')]('UpdateVoiceRecording',_0x540f57);logger[_0x368b('0x10')](_0x368b('0x18'),_0x540f57,JSON[_0x368b('0x11')](_0xc0f7af));_0x3e2e9f(_0xc0f7af);})[_0x368b('0x17')](function(_0x77a269){logger[_0x368b('0x12')](_0x368b('0x18'),_0x77a269[_0x368b('0x14')],_0x540f57);_0x27d2a0(_0x5d543e[_0x368b('0x12')](0x1f4,_0x77a269[_0x368b('0x14')]));});});};exports[_0x368b('0x21')]=function(_0x344d8a){var _0xceec4b=this;return new Promise(function(_0x376e61,_0x4636f4){var _0x23a83a=require(_0x368b('0x22'));var _0x9f192e;return db[_0x368b('0x23')][_0x368b('0x24')]({'attributes':['id',_0x368b('0x25')],'where':{'id':0x1},'raw':!![]})[_0x368b('0xd')](function(_0x107d2f){_0x9f192e=_0x107d2f;return db[_0x368b('0x19')]['create'](_0x344d8a['body']);})[_0x368b('0xd')](function(_0x2f1d52){if(_0x9f192e[_0x368b('0x25')]&&fs[_0x368b('0x26')](_0x2f1d52['value'])){var _0x12ae59=util[_0x368b('0x27')](_0x368b('0x28'),_0x2f1d52[_0x368b('0x29')]);return _0x23a83a[_0x368b('0x2a')](_0x2f1d52['value'],_0x12ae59,config[_0x368b('0x2b')][_0x368b('0x2c')])[_0x368b('0xd')](function(){fs[_0x368b('0x2d')](_0x2f1d52['value']);logger['info']('CreateVoiceRecording\x20file\x20encrypted');return _0x2f1d52;});}return _0x2f1d52;})[_0x368b('0xd')](function(_0x2bc363){logger[_0x368b('0x15')](_0x368b('0x21'),_0x344d8a);logger[_0x368b('0x10')]('CreateVoiceRecording',_0x344d8a,JSON[_0x368b('0x11')](_0x2bc363));_0x376e61(_0x2bc363);})[_0x368b('0x17')](function(_0x54e7e5){logger[_0x368b('0x12')](_0x368b('0x21'),_0x54e7e5['message'],_0x344d8a);_0x4636f4(_0xceec4b[_0x368b('0x12')](0x1f4,_0x54e7e5[_0x368b('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index 8629f16..a8dd44e 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 _0xb57e=['../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create','put','update','delete','destroy','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x5a2d95,_0xb362e5){var _0x2c3986=function(_0x5cce7c){while(--_0x5cce7c){_0x5a2d95['push'](_0x5a2d95['shift']());}};_0x2c3986(++_0xb362e5);}(_0xb57e,0x94));var _0xeb57=function(_0x18871c,_0x28b8a6){_0x18871c=_0x18871c-0x0;var _0x141c8c=_0xb57e[_0x18871c];return _0x141c8c;};'use strict';var multer=require('multer');var util=require(_0xeb57('0x0'));var path=require(_0xeb57('0x1'));var timeout=require(_0xeb57('0x2'));var express=require(_0xeb57('0x3'));var router=express[_0xeb57('0x4')]();var fs_extra=require(_0xeb57('0x5'));var auth=require(_0xeb57('0x6'));var interaction=require(_0xeb57('0x7'));var config=require(_0xeb57('0x8'));var controller=require(_0xeb57('0x9'));router[_0xeb57('0xa')]('/',auth[_0xeb57('0xb')](),controller['index']);router[_0xeb57('0xa')](_0xeb57('0xc'),auth[_0xeb57('0xb')](),controller[_0xeb57('0xd')]);router[_0xeb57('0xa')](_0xeb57('0xe'),auth[_0xeb57('0xb')](),controller[_0xeb57('0xf')]);router[_0xeb57('0x10')]('/',auth[_0xeb57('0xb')](),controller[_0xeb57('0x11')]);router[_0xeb57('0x12')]('/:id',auth['isAuthenticated'](),controller[_0xeb57('0x13')]);router[_0xeb57('0x14')]('/:id',auth[_0xeb57('0xb')](),controller[_0xeb57('0x15')]);module['exports']=router; \ No newline at end of file +var _0x4924=['create','put','update','delete','exports','multer','util','path','express','../../components/auth/service','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x23e4a1,_0x535a6f){var _0x5e53c9=function(_0x2bf4e5){while(--_0x2bf4e5){_0x23e4a1['push'](_0x23e4a1['shift']());}};_0x5e53c9(++_0x535a6f);}(_0x4924,0xb5));var _0x4492=function(_0x511bd1,_0x223e5b){_0x511bd1=_0x511bd1-0x0;var _0x4c48ec=_0x4924[_0x511bd1];return _0x4c48ec;};'use strict';var multer=require(_0x4492('0x0'));var util=require(_0x4492('0x1'));var path=require(_0x4492('0x2'));var timeout=require('connect-timeout');var express=require(_0x4492('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x4492('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./voiceTransferReport.controller');router[_0x4492('0x5')]('/',auth[_0x4492('0x6')](),controller[_0x4492('0x7')]);router['get'](_0x4492('0x8'),auth[_0x4492('0x6')](),controller[_0x4492('0x9')]);router[_0x4492('0x5')](_0x4492('0xa'),auth[_0x4492('0x6')](),controller['show']);router['post']('/',auth[_0x4492('0x6')](),controller[_0x4492('0xb')]);router[_0x4492('0xc')](_0x4492('0xa'),auth['isAuthenticated'](),controller[_0x4492('0xd')]);router[_0x4492('0xe')](_0x4492('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x4492('0xf')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index 042cada..8af2afa 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 _0x3fe3=['ENUM','blind','attended','STRING','Yes','sequelize','moment','exports'];(function(_0x33a14b,_0x1de680){var _0x295c8c=function(_0x29e815){while(--_0x29e815){_0x33a14b['push'](_0x33a14b['shift']());}};_0x295c8c(++_0x1de680);}(_0x3fe3,0x135));var _0x33fe=function(_0x5b2a25,_0x5b8cab){_0x5b2a25=_0x5b2a25-0x0;var _0x522228=_0x3fe3[_0x5b2a25];return _0x522228;};'use strict';var Sequelize=require(_0x33fe('0x0'));var moment=require(_0x33fe('0x1'));module[_0x33fe('0x2')]={'type':{'type':Sequelize[_0x33fe('0x3')](_0x33fe('0x4'),_0x33fe('0x5'))},'result':{'type':Sequelize['STRING']},'transfererchannel':{'type':Sequelize[_0x33fe('0x6')]},'transferercalleridnum':{'type':Sequelize[_0x33fe('0x6')]},'transferercalleridname':{'type':Sequelize['STRING']},'transfererconnectedlinenum':{'type':Sequelize[_0x33fe('0x6')]},'transfererconnectedlinename':{'type':Sequelize[_0x33fe('0x6')]},'transfereraccountcode':{'type':Sequelize[_0x33fe('0x6')]},'transferercontext':{'type':Sequelize[_0x33fe('0x6')]},'transfererexten':{'type':Sequelize[_0x33fe('0x6')]},'transfererlinkedid':{'type':Sequelize['STRING']},'transfereechannel':{'type':Sequelize[_0x33fe('0x6')]},'transfereecalleridnum':{'type':Sequelize['STRING']},'transfereecalleridname':{'type':Sequelize[_0x33fe('0x6')]},'transfereeconnectedlinenum':{'type':Sequelize['STRING']},'transfereeconnectedlinename':{'type':Sequelize[_0x33fe('0x6')]},'transfereeaccountcode':{'type':Sequelize[_0x33fe('0x6')]},'transfereecontext':{'type':Sequelize[_0x33fe('0x6')]},'transfereeexten':{'type':Sequelize[_0x33fe('0x6')]},'transfereelinkedid':{'type':Sequelize[_0x33fe('0x6')]},'isexternal':{'type':Sequelize[_0x33fe('0x3')](_0x33fe('0x7'),'No')},'context':{'type':Sequelize[_0x33fe('0x6')]},'extension':{'type':Sequelize[_0x33fe('0x6')]}}; \ No newline at end of file +var _0x3770=['ENUM','blind','attended','STRING','Yes','sequelize'];(function(_0x425c54,_0x42dcca){var _0x101bb7=function(_0x516164){while(--_0x516164){_0x425c54['push'](_0x425c54['shift']());}};_0x101bb7(++_0x42dcca);}(_0x3770,0x179));var _0x0377=function(_0x13daf4,_0x420a83){_0x13daf4=_0x13daf4-0x0;var _0x4a6af9=_0x3770[_0x13daf4];return _0x4a6af9;};'use strict';var Sequelize=require(_0x0377('0x0'));var moment=require('moment');module['exports']={'type':{'type':Sequelize[_0x0377('0x1')](_0x0377('0x2'),_0x0377('0x3'))},'result':{'type':Sequelize[_0x0377('0x4')]},'transfererchannel':{'type':Sequelize[_0x0377('0x4')]},'transferercalleridnum':{'type':Sequelize[_0x0377('0x4')]},'transferercalleridname':{'type':Sequelize[_0x0377('0x4')]},'transfererconnectedlinenum':{'type':Sequelize['STRING']},'transfererconnectedlinename':{'type':Sequelize[_0x0377('0x4')]},'transfereraccountcode':{'type':Sequelize[_0x0377('0x4')]},'transferercontext':{'type':Sequelize[_0x0377('0x4')]},'transfererexten':{'type':Sequelize[_0x0377('0x4')]},'transfererlinkedid':{'type':Sequelize[_0x0377('0x4')]},'transfereechannel':{'type':Sequelize[_0x0377('0x4')]},'transfereecalleridnum':{'type':Sequelize[_0x0377('0x4')]},'transfereecalleridname':{'type':Sequelize[_0x0377('0x4')]},'transfereeconnectedlinenum':{'type':Sequelize['STRING']},'transfereeconnectedlinename':{'type':Sequelize[_0x0377('0x4')]},'transfereeaccountcode':{'type':Sequelize[_0x0377('0x4')]},'transfereecontext':{'type':Sequelize[_0x0377('0x4')]},'transfereeexten':{'type':Sequelize[_0x0377('0x4')]},'transfereelinkedid':{'type':Sequelize[_0x0377('0x4')]},'isexternal':{'type':Sequelize[_0x0377('0x1')](_0x0377('0x5'),'No')},'context':{'type':Sequelize[_0x0377('0x4')]},'extension':{'type':Sequelize[_0x0377('0x4')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index 3c01f8c..e0d7947 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 _0x0daf=['Content-Range','apply','reject','save','then','destroy','end','error','name','send','index','map','rawAttributes','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','VoiceTransferReport','includeAll','include','findAll','rows','catch','show','find','create','body','update','params','describe','eml-format','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set'];(function(_0x30e890,_0x50ccf5){var _0x28f17a=function(_0xc8b8dd){while(--_0xc8b8dd){_0x30e890['push'](_0x30e890['shift']());}};_0x28f17a(++_0x50ccf5);}(_0x0daf,0x1a9));var _0xf0da=function(_0x131050,_0x3aa020){_0x131050=_0x131050-0x0;var _0x4e9e65=_0x0daf[_0x131050];return _0x4e9e65;};'use strict';var emlformat=require(_0xf0da('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xf0da('0x1'));var BPromise=require(_0xf0da('0x2'));var Mustache=require(_0xf0da('0x3'));var util=require(_0xf0da('0x4'));var path=require(_0xf0da('0x5'));var sox=require(_0xf0da('0x6'));var csv=require(_0xf0da('0x7'));var ejs=require(_0xf0da('0x8'));var fs=require('fs');var fs_extra=require(_0xf0da('0x9'));var _=require(_0xf0da('0xa'));var squel=require('squel');var crypto=require(_0xf0da('0xb'));var jsforce=require(_0xf0da('0xc'));var deskjs=require(_0xf0da('0xd'));var toCsv=require('to-csv');var querystring=require(_0xf0da('0xe'));var Papa=require(_0xf0da('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xf0da('0x10'));var as=require(_0xf0da('0x11'));var hardwareService=require(_0xf0da('0x12'));var logger=require(_0xf0da('0x13'))(_0xf0da('0x14'));var utils=require(_0xf0da('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf0da('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x37984a,_0x564ccb){_0x564ccb=_0x564ccb||0xcc;return function(_0x1c6a33){if(_0x1c6a33){return _0x37984a[_0xf0da('0x17')](_0x564ccb);}return _0x37984a[_0xf0da('0x18')](_0x564ccb)['end']();};}function respondWithResult(_0x5d0901,_0x53cab2){_0x53cab2=_0x53cab2||0xc8;return function(_0x50ddff){if(_0x50ddff){return _0x5d0901[_0xf0da('0x18')](_0x53cab2)[_0xf0da('0x19')](_0x50ddff);}};}function respondWithFilteredResult(_0x46565d,_0x679f91){return function(_0x24148f){if(_0x24148f){var _0x175239=typeof _0x679f91[_0xf0da('0x1a')]===_0xf0da('0x1b')&&typeof _0x679f91[_0xf0da('0x1c')]===_0xf0da('0x1b');var _0x4a6bee=_0x24148f[_0xf0da('0x1d')];var _0x219583=_0x175239?0x0:_0x679f91[_0xf0da('0x1a')];var _0x2fbc6f=_0x175239?_0x24148f[_0xf0da('0x1d')]:_0x679f91[_0xf0da('0x1a')]+_0x679f91[_0xf0da('0x1c')];var _0x6e2db9;if(_0x2fbc6f>=_0x4a6bee){_0x2fbc6f=_0x4a6bee;_0x6e2db9=0xc8;}else{_0x6e2db9=0xce;}_0x46565d[_0xf0da('0x18')](_0x6e2db9);return _0x46565d[_0xf0da('0x1e')](_0xf0da('0x1f'),_0x219583+'-'+_0x2fbc6f+'/'+_0x4a6bee)[_0xf0da('0x19')](_0x24148f);}return null;};}function patchUpdates(_0x3f106e){return function(_0xd4da8){try{jsonpatch[_0xf0da('0x20')](_0xd4da8,_0x3f106e,!![]);}catch(_0x10209e){return BPromise[_0xf0da('0x21')](_0x10209e);}return _0xd4da8[_0xf0da('0x22')]();};}function saveUpdates(_0x31e8c3,_0x3d194f){return function(_0x5efcf3){if(_0x5efcf3){return _0x5efcf3['update'](_0x31e8c3)[_0xf0da('0x23')](function(_0x24bd52){return _0x24bd52;});}return null;};}function removeEntity(_0x28b9fd,_0x5afd1c){return function(_0x2588d8){if(_0x2588d8){return _0x2588d8[_0xf0da('0x24')]()['then'](function(){_0x28b9fd[_0xf0da('0x18')](0xcc)[_0xf0da('0x25')]();});}};}function handleEntityNotFound(_0x11e83e,_0x504355){return function(_0x48a8c1){if(!_0x48a8c1){_0x11e83e[_0xf0da('0x17')](0x194);}return _0x48a8c1;};}function handleError(_0x59bf53,_0x23305c){_0x23305c=_0x23305c||0x1f4;return function(_0x531aaa){logger[_0xf0da('0x26')](_0x531aaa['stack']);if(_0x531aaa[_0xf0da('0x27')]){delete _0x531aaa[_0xf0da('0x27')];}_0x59bf53[_0xf0da('0x18')](_0x23305c)[_0xf0da('0x28')](_0x531aaa);};}exports[_0xf0da('0x29')]=function(_0xf340a0,_0x268827){var _0x1e918d={},_0x237cdb={},_0x35d7cc={'count':0x0,'rows':[]};var _0x2d74a9=_[_0xf0da('0x2a')](db['VoiceTransferReport'][_0xf0da('0x2b')],function(_0x29d3a5){return{'name':_0x29d3a5['fieldName'],'type':_0x29d3a5[_0xf0da('0x2c')]['key']};});_0x237cdb[_0xf0da('0x2d')]=_[_0xf0da('0x2a')](_0x2d74a9,'name');_0x237cdb[_0xf0da('0x2e')]=_[_0xf0da('0x2f')](_0xf340a0[_0xf0da('0x2e')]);_0x237cdb[_0xf0da('0x30')]=_['intersection'](_0x237cdb[_0xf0da('0x2d')],_0x237cdb[_0xf0da('0x2e')]);_0x1e918d['attributes']=_[_0xf0da('0x31')](_0x237cdb[_0xf0da('0x2d')],qs[_0xf0da('0x32')](_0xf340a0['query'][_0xf0da('0x32')]));_0x1e918d[_0xf0da('0x33')]=_0x1e918d[_0xf0da('0x33')][_0xf0da('0x34')]?_0x1e918d[_0xf0da('0x33')]:_0x237cdb[_0xf0da('0x2d')];if(!_0xf340a0[_0xf0da('0x2e')][_0xf0da('0x35')](_0xf0da('0x36'))){_0x1e918d['limit']=qs[_0xf0da('0x1c')](_0xf340a0[_0xf0da('0x2e')][_0xf0da('0x1c')]);_0x1e918d[_0xf0da('0x1a')]=qs[_0xf0da('0x1a')](_0xf340a0[_0xf0da('0x2e')][_0xf0da('0x1a')]);}_0x1e918d[_0xf0da('0x37')]=qs['sort'](_0xf340a0[_0xf0da('0x2e')][_0xf0da('0x38')]);_0x1e918d[_0xf0da('0x39')]=qs[_0xf0da('0x30')](_[_0xf0da('0x3a')](_0xf340a0[_0xf0da('0x2e')],_0x237cdb['filters']),_0x2d74a9);if(_0xf340a0[_0xf0da('0x2e')]['filter']){_0x1e918d['where']=_[_0xf0da('0x3b')](_0x1e918d[_0xf0da('0x39')],{'$or':_['map'](_0x2d74a9,function(_0x2703a4){if(_0x2703a4[_0xf0da('0x2c')]!==_0xf0da('0x3c')){var _0x3e2835={};_0x3e2835[_0x2703a4[_0xf0da('0x27')]]={'$like':'%'+_0xf340a0['query'][_0xf0da('0x3d')]+'%'};return _0x3e2835;}})});}_0x1e918d=_[_0xf0da('0x3b')]({},_0x1e918d,_0xf340a0[_0xf0da('0x3e')]);var _0x21f4b0={'where':_0x1e918d[_0xf0da('0x39')]};return db[_0xf0da('0x3f')]['count'](_0x21f4b0)[_0xf0da('0x23')](function(_0x1cf3a5){_0x35d7cc[_0xf0da('0x1d')]=_0x1cf3a5;if(_0xf340a0['query'][_0xf0da('0x40')]){_0x1e918d[_0xf0da('0x41')]=[{'all':!![]}];}return db[_0xf0da('0x3f')][_0xf0da('0x42')](_0x1e918d);})[_0xf0da('0x23')](function(_0x1762c7){_0x35d7cc[_0xf0da('0x43')]=_0x1762c7;return _0x35d7cc;})['then'](respondWithFilteredResult(_0x268827,_0x1e918d))[_0xf0da('0x44')](handleError(_0x268827,null));};exports[_0xf0da('0x45')]=function(_0x871214,_0x424345){var _0x480eb2={'raw':!![],'where':{'id':_0x871214['params']['id']}},_0x418970={};_0x418970[_0xf0da('0x2d')]=_[_0xf0da('0x2f')](db[_0xf0da('0x3f')][_0xf0da('0x2b')]);_0x418970[_0xf0da('0x2e')]=_[_0xf0da('0x2f')](_0x871214['query']);_0x418970[_0xf0da('0x30')]=_['intersection'](_0x418970[_0xf0da('0x2d')],_0x418970[_0xf0da('0x2e')]);_0x480eb2[_0xf0da('0x33')]=_[_0xf0da('0x31')](_0x418970[_0xf0da('0x2d')],qs[_0xf0da('0x32')](_0x871214[_0xf0da('0x2e')][_0xf0da('0x32')]));_0x480eb2[_0xf0da('0x33')]=_0x480eb2[_0xf0da('0x33')][_0xf0da('0x34')]?_0x480eb2[_0xf0da('0x33')]:_0x418970['model'];if(_0x871214[_0xf0da('0x2e')][_0xf0da('0x40')]){_0x480eb2[_0xf0da('0x41')]=[{'all':!![]}];}_0x480eb2=_[_0xf0da('0x3b')]({},_0x480eb2,_0x871214[_0xf0da('0x3e')]);return db['VoiceTransferReport'][_0xf0da('0x46')](_0x480eb2)['then'](handleEntityNotFound(_0x424345,null))['then'](respondWithResult(_0x424345,null))[_0xf0da('0x44')](handleError(_0x424345,null));};exports[_0xf0da('0x47')]=function(_0x372e2e,_0x5db2b9){return db[_0xf0da('0x3f')]['create'](_0x372e2e[_0xf0da('0x48')],{})[_0xf0da('0x23')](respondWithResult(_0x5db2b9,0xc9))[_0xf0da('0x44')](handleError(_0x5db2b9,null));};exports[_0xf0da('0x49')]=function(_0x40b6d4,_0x1d0893){if(_0x40b6d4[_0xf0da('0x48')]['id']){delete _0x40b6d4[_0xf0da('0x48')]['id'];}return db['VoiceTransferReport']['find']({'where':{'id':_0x40b6d4[_0xf0da('0x4a')]['id']}})[_0xf0da('0x23')](handleEntityNotFound(_0x1d0893,null))['then'](saveUpdates(_0x40b6d4[_0xf0da('0x48')],null))[_0xf0da('0x23')](respondWithResult(_0x1d0893,null))[_0xf0da('0x44')](handleError(_0x1d0893,null));};exports[_0xf0da('0x24')]=function(_0x1c8b6f,_0x18a311){return db[_0xf0da('0x3f')][_0xf0da('0x46')]({'where':{'id':_0x1c8b6f[_0xf0da('0x4a')]['id']}})['then'](handleEntityNotFound(_0x18a311,null))[_0xf0da('0x23')](removeEntity(_0x18a311,null))[_0xf0da('0x44')](handleError(_0x18a311,null));};exports[_0xf0da('0x4b')]=function(_0x8c00ac,_0x3683a1){return db[_0xf0da('0x3f')]['describe']()['then'](respondWithResult(_0x3683a1,null))[_0xf0da('0x44')](handleError(_0x3683a1,null));}; \ No newline at end of file +var _0xb10c=['body','describe','eml-format','fast-json-patch','request-promise','moment','bluebird','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','destroy','then','error','stack','name','send','map','VoiceTransferReport','rawAttributes','fieldName','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filters','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','params','options','find'];(function(_0x3d9c75,_0x5f1f9f){var _0x163a09=function(_0x1585c9){while(--_0x1585c9){_0x3d9c75['push'](_0x3d9c75['shift']());}};_0x163a09(++_0x5f1f9f);}(_0xb10c,0x8c));var _0xcb10=function(_0x1ac77b,_0x10ee7a){_0x1ac77b=_0x1ac77b-0x0;var _0x161584=_0xb10c[_0x1ac77b];return _0x161584;};'use strict';var emlformat=require(_0xcb10('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xcb10('0x1'));var rp=require(_0xcb10('0x2'));var moment=require(_0xcb10('0x3'));var BPromise=require(_0xcb10('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xcb10('0x5'));var sox=require('sox');var csv=require(_0xcb10('0x6'));var ejs=require(_0xcb10('0x7'));var fs=require('fs');var fs_extra=require(_0xcb10('0x8'));var _=require(_0xcb10('0x9'));var squel=require('squel');var crypto=require(_0xcb10('0xa'));var jsforce=require(_0xcb10('0xb'));var deskjs=require(_0xcb10('0xc'));var toCsv=require(_0xcb10('0x6'));var querystring=require(_0xcb10('0xd'));var Papa=require(_0xcb10('0xe'));var Redis=require('ioredis');var authService=require(_0xcb10('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcb10('0x10'));var logger=require(_0xcb10('0x11'))(_0xcb10('0x12'));var utils=require(_0xcb10('0x13'));var config=require(_0xcb10('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1abc97,_0x2fdc6a){_0x2fdc6a=_0x2fdc6a||0xcc;return function(_0x259fb9){if(_0x259fb9){return _0x1abc97[_0xcb10('0x15')](_0x2fdc6a);}return _0x1abc97[_0xcb10('0x16')](_0x2fdc6a)[_0xcb10('0x17')]();};}function respondWithResult(_0x142d6b,_0x361afe){_0x361afe=_0x361afe||0xc8;return function(_0x918375){if(_0x918375){return _0x142d6b[_0xcb10('0x16')](_0x361afe)[_0xcb10('0x18')](_0x918375);}};}function respondWithFilteredResult(_0x5866e7,_0x3d19af){return function(_0x17bb05){if(_0x17bb05){var _0x21eae6=typeof _0x3d19af[_0xcb10('0x19')]===_0xcb10('0x1a')&&typeof _0x3d19af[_0xcb10('0x1b')]===_0xcb10('0x1a');var _0x2f5469=_0x17bb05[_0xcb10('0x1c')];var _0x37b5b8=_0x21eae6?0x0:_0x3d19af[_0xcb10('0x19')];var _0x423bf2=_0x21eae6?_0x17bb05[_0xcb10('0x1c')]:_0x3d19af[_0xcb10('0x19')]+_0x3d19af[_0xcb10('0x1b')];var _0xeb3439;if(_0x423bf2>=_0x2f5469){_0x423bf2=_0x2f5469;_0xeb3439=0xc8;}else{_0xeb3439=0xce;}_0x5866e7[_0xcb10('0x16')](_0xeb3439);return _0x5866e7[_0xcb10('0x1d')](_0xcb10('0x1e'),_0x37b5b8+'-'+_0x423bf2+'/'+_0x2f5469)[_0xcb10('0x18')](_0x17bb05);}return null;};}function patchUpdates(_0x1cd5d5){return function(_0x1ef550){try{jsonpatch[_0xcb10('0x1f')](_0x1ef550,_0x1cd5d5,!![]);}catch(_0x244f69){return BPromise[_0xcb10('0x20')](_0x244f69);}return _0x1ef550['save']();};}function saveUpdates(_0x5e4012,_0x19598a){return function(_0xa8d02d){if(_0xa8d02d){return _0xa8d02d['update'](_0x5e4012)['then'](function(_0x4efd96){return _0x4efd96;});}return null;};}function removeEntity(_0x3904d9,_0x16ffc1){return function(_0x5a1eae){if(_0x5a1eae){return _0x5a1eae[_0xcb10('0x21')]()[_0xcb10('0x22')](function(){_0x3904d9[_0xcb10('0x16')](0xcc)[_0xcb10('0x17')]();});}};}function handleEntityNotFound(_0x13090e,_0x17363f){return function(_0x37c8fb){if(!_0x37c8fb){_0x13090e['sendStatus'](0x194);}return _0x37c8fb;};}function handleError(_0x2f0cbf,_0x4bf317){_0x4bf317=_0x4bf317||0x1f4;return function(_0x27ceb8){logger[_0xcb10('0x23')](_0x27ceb8[_0xcb10('0x24')]);if(_0x27ceb8[_0xcb10('0x25')]){delete _0x27ceb8[_0xcb10('0x25')];}_0x2f0cbf['status'](_0x4bf317)[_0xcb10('0x26')](_0x27ceb8);};}exports['index']=function(_0x47ac47,_0x5d51a4){var _0x4fd5f1={},_0x132245={},_0x229ea3={'count':0x0,'rows':[]};var _0x43e38b=_[_0xcb10('0x27')](db[_0xcb10('0x28')][_0xcb10('0x29')],function(_0x35e9c9){return{'name':_0x35e9c9[_0xcb10('0x2a')],'type':_0x35e9c9['type'][_0xcb10('0x2b')]};});_0x132245[_0xcb10('0x2c')]=_[_0xcb10('0x27')](_0x43e38b,_0xcb10('0x25'));_0x132245[_0xcb10('0x2d')]=_[_0xcb10('0x2e')](_0x47ac47['query']);_0x132245['filters']=_[_0xcb10('0x2f')](_0x132245[_0xcb10('0x2c')],_0x132245['query']);_0x4fd5f1['attributes']=_[_0xcb10('0x2f')](_0x132245['model'],qs['fields'](_0x47ac47['query'][_0xcb10('0x30')]));_0x4fd5f1[_0xcb10('0x31')]=_0x4fd5f1[_0xcb10('0x31')][_0xcb10('0x32')]?_0x4fd5f1[_0xcb10('0x31')]:_0x132245[_0xcb10('0x2c')];if(!_0x47ac47['query'][_0xcb10('0x33')]('nolimit')){_0x4fd5f1[_0xcb10('0x1b')]=qs[_0xcb10('0x1b')](_0x47ac47[_0xcb10('0x2d')]['limit']);_0x4fd5f1[_0xcb10('0x19')]=qs[_0xcb10('0x19')](_0x47ac47['query'][_0xcb10('0x19')]);}_0x4fd5f1[_0xcb10('0x34')]=qs[_0xcb10('0x35')](_0x47ac47[_0xcb10('0x2d')][_0xcb10('0x35')]);_0x4fd5f1[_0xcb10('0x36')]=qs[_0xcb10('0x37')](_['pick'](_0x47ac47[_0xcb10('0x2d')],_0x132245[_0xcb10('0x37')]),_0x43e38b);if(_0x47ac47['query'][_0xcb10('0x38')]){_0x4fd5f1[_0xcb10('0x36')]=_[_0xcb10('0x39')](_0x4fd5f1[_0xcb10('0x36')],{'$or':_[_0xcb10('0x27')](_0x43e38b,function(_0x13955c){if(_0x13955c['type']!==_0xcb10('0x3a')){var _0x13d3ad={};_0x13d3ad[_0x13955c[_0xcb10('0x25')]]={'$like':'%'+_0x47ac47['query'][_0xcb10('0x38')]+'%'};return _0x13d3ad;}})});}_0x4fd5f1=_[_0xcb10('0x39')]({},_0x4fd5f1,_0x47ac47['options']);var _0x5b4f0d={'where':_0x4fd5f1[_0xcb10('0x36')]};return db[_0xcb10('0x28')]['count'](_0x5b4f0d)[_0xcb10('0x22')](function(_0x5016a1){_0x229ea3[_0xcb10('0x1c')]=_0x5016a1;if(_0x47ac47[_0xcb10('0x2d')][_0xcb10('0x3b')]){_0x4fd5f1[_0xcb10('0x3c')]=[{'all':!![]}];}return db[_0xcb10('0x28')][_0xcb10('0x3d')](_0x4fd5f1);})['then'](function(_0x383e1d){_0x229ea3[_0xcb10('0x3e')]=_0x383e1d;return _0x229ea3;})[_0xcb10('0x22')](respondWithFilteredResult(_0x5d51a4,_0x4fd5f1))[_0xcb10('0x3f')](handleError(_0x5d51a4,null));};exports['show']=function(_0x2cf8a3,_0x3a1c2e){var _0x1b4a3a={'raw':!![],'where':{'id':_0x2cf8a3[_0xcb10('0x40')]['id']}},_0x1801b0={};_0x1801b0[_0xcb10('0x2c')]=_[_0xcb10('0x2e')](db[_0xcb10('0x28')]['rawAttributes']);_0x1801b0[_0xcb10('0x2d')]=_[_0xcb10('0x2e')](_0x2cf8a3[_0xcb10('0x2d')]);_0x1801b0['filters']=_[_0xcb10('0x2f')](_0x1801b0[_0xcb10('0x2c')],_0x1801b0[_0xcb10('0x2d')]);_0x1b4a3a[_0xcb10('0x31')]=_['intersection'](_0x1801b0['model'],qs[_0xcb10('0x30')](_0x2cf8a3[_0xcb10('0x2d')][_0xcb10('0x30')]));_0x1b4a3a[_0xcb10('0x31')]=_0x1b4a3a['attributes'][_0xcb10('0x32')]?_0x1b4a3a[_0xcb10('0x31')]:_0x1801b0[_0xcb10('0x2c')];if(_0x2cf8a3[_0xcb10('0x2d')][_0xcb10('0x3b')]){_0x1b4a3a[_0xcb10('0x3c')]=[{'all':!![]}];}_0x1b4a3a=_['merge']({},_0x1b4a3a,_0x2cf8a3[_0xcb10('0x41')]);return db[_0xcb10('0x28')][_0xcb10('0x42')](_0x1b4a3a)[_0xcb10('0x22')](handleEntityNotFound(_0x3a1c2e,null))[_0xcb10('0x22')](respondWithResult(_0x3a1c2e,null))[_0xcb10('0x3f')](handleError(_0x3a1c2e,null));};exports['create']=function(_0x5a9521,_0x584205){return db['VoiceTransferReport']['create'](_0x5a9521[_0xcb10('0x43')],{})['then'](respondWithResult(_0x584205,0xc9))[_0xcb10('0x3f')](handleError(_0x584205,null));};exports['update']=function(_0x5a5887,_0x56725e){if(_0x5a5887[_0xcb10('0x43')]['id']){delete _0x5a5887[_0xcb10('0x43')]['id'];}return db['VoiceTransferReport'][_0xcb10('0x42')]({'where':{'id':_0x5a5887['params']['id']}})[_0xcb10('0x22')](handleEntityNotFound(_0x56725e,null))['then'](saveUpdates(_0x5a5887[_0xcb10('0x43')],null))[_0xcb10('0x22')](respondWithResult(_0x56725e,null))[_0xcb10('0x3f')](handleError(_0x56725e,null));};exports[_0xcb10('0x21')]=function(_0x34076b,_0x1ac622){return db[_0xcb10('0x28')][_0xcb10('0x42')]({'where':{'id':_0x34076b[_0xcb10('0x40')]['id']}})['then'](handleEntityNotFound(_0x1ac622,null))[_0xcb10('0x22')](removeEntity(_0x1ac622,null))[_0xcb10('0x3f')](handleError(_0x1ac622,null));};exports[_0xcb10('0x44')]=function(_0x23bd06,_0x566c5e){return db[_0xcb10('0x28')]['describe']()[_0xcb10('0x22')](respondWithResult(_0x566c5e,null))['catch'](handleError(_0x566c5e,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index dce2eaf..8cfd7a4 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 _0x8f89=['util','api','moment','bluebird','rimraf','./voiceTransferReport.attributes','exports','VoiceTransferReport','report_call_transfer'];(function(_0x398c23,_0x294a30){var _0x5392c0=function(_0x4dc9b3){while(--_0x4dc9b3){_0x398c23['push'](_0x398c23['shift']());}};_0x5392c0(++_0x294a30);}(_0x8f89,0x144));var _0x98f8=function(_0x1b8b12,_0x2f8c1b){_0x1b8b12=_0x1b8b12-0x0;var _0x1e6d56=_0x8f89[_0x1b8b12];return _0x1e6d56;};'use strict';var _=require('lodash');var util=require(_0x98f8('0x0'));var logger=require('../../config/logger')(_0x98f8('0x1'));var moment=require(_0x98f8('0x2'));var BPromise=require(_0x98f8('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x98f8('0x4'));var config=require('../../config/environment');var attributes=require(_0x98f8('0x5'));module[_0x98f8('0x6')]=function(_0x3a05ec,_0x411a05){return _0x3a05ec['define'](_0x98f8('0x7'),attributes,{'tableName':_0x98f8('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0728=['exports','VoiceTransferReport','lodash','../../config/logger','api','moment','../../config/environment','./voiceTransferReport.attributes'];(function(_0x5d03d2,_0x34737a){var _0x6542ed=function(_0x449ed0){while(--_0x449ed0){_0x5d03d2['push'](_0x5d03d2['shift']());}};_0x6542ed(++_0x34737a);}(_0x0728,0xea));var _0x8072=function(_0x5ee2b7,_0x34790f){_0x5ee2b7=_0x5ee2b7-0x0;var _0x43842d=_0x0728[_0x5ee2b7];return _0x43842d;};'use strict';var _=require(_0x8072('0x0'));var util=require('util');var logger=require(_0x8072('0x1'))(_0x8072('0x2'));var moment=require(_0x8072('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x8072('0x4'));var attributes=require(_0x8072('0x5'));module[_0x8072('0x6')]=function(_0x4ed2e3,_0x4d8609){return _0x4ed2e3['define'](_0x8072('0x7'),attributes,{'tableName':'report_call_transfer','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.rpc.js b/server/api/voiceTransferReport/voiceTransferReport.rpc.js index 96cfa1e..930e149 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 _0xf195=['VoiceTransferReport','create','body','options','raw','CreateVoiceTransferReport','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch'];(function(_0xc4001c,_0x1bf8f0){var _0x49f7bc=function(_0x1059b8){while(--_0x1059b8){_0xc4001c['push'](_0xc4001c['shift']());}};_0x49f7bc(++_0x1bf8f0);}(_0xf195,0x156));var _0x5f19=function(_0x4e9628,_0x250573){_0x4e9628=_0x4e9628-0x0;var _0x27bc8c=_0xf195[_0x4e9628];return _0x27bc8c;};'use strict';var _=require('lodash');var util=require(_0x5f19('0x0'));var moment=require(_0x5f19('0x1'));var BPromise=require(_0x5f19('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5f19('0x3'));var db=require(_0x5f19('0x4'))['db'];var utils=require(_0x5f19('0x5'));var logger=require(_0x5f19('0x6'))(_0x5f19('0x7'));var config=require(_0x5f19('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x5f19('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x367372,_0x13e087,_0x2613cc){return new BPromise(function(_0x454450,_0x33b99a){return client[_0x5f19('0xa')](_0x367372,_0x2613cc)[_0x5f19('0xb')](function(_0x391e47){logger[_0x5f19('0xc')](_0x5f19('0xd'),_0x13e087,_0x5f19('0xe'));logger[_0x5f19('0xf')](_0x5f19('0x10'),_0x13e087,_0x5f19('0xe'),JSON[_0x5f19('0x11')](_0x391e47));if(_0x391e47['error']){if(_0x391e47[_0x5f19('0x12')][_0x5f19('0x13')]===0x1f4){logger[_0x5f19('0x12')](_0x5f19('0xd'),_0x13e087,_0x391e47[_0x5f19('0x12')][_0x5f19('0x14')]);return _0x33b99a(_0x391e47[_0x5f19('0x12')][_0x5f19('0x14')]);}logger[_0x5f19('0x12')]('VoiceTransferReport,\x20%s,\x20%s',_0x13e087,_0x391e47[_0x5f19('0x12')]['message']);return _0x454450(_0x391e47[_0x5f19('0x12')][_0x5f19('0x14')]);}else{logger[_0x5f19('0xc')]('VoiceTransferReport,\x20%s,\x20%s',_0x13e087,'request\x20sent');_0x454450(_0x391e47['result']['message']);}})[_0x5f19('0x15')](function(_0x3247e8){logger['error'](_0x5f19('0xd'),_0x13e087,_0x3247e8);_0x33b99a(_0x3247e8);});});}exports['CreateVoiceTransferReport']=function(_0x3fadf8){var _0x597862=this;return new Promise(function(_0x4f7a93,_0x5974a0){return db[_0x5f19('0x16')][_0x5f19('0x17')](_0x3fadf8[_0x5f19('0x18')],{'raw':_0x3fadf8[_0x5f19('0x19')]?_0x3fadf8[_0x5f19('0x19')][_0x5f19('0x1a')]===undefined?!![]:![]:!![]})[_0x5f19('0xb')](function(_0x2ebc89){logger[_0x5f19('0xc')](_0x5f19('0x1b'),_0x3fadf8);logger[_0x5f19('0xf')](_0x5f19('0x1b'),_0x3fadf8,JSON['stringify'](_0x2ebc89));_0x4f7a93(_0x2ebc89);})[_0x5f19('0x15')](function(_0x46ff20){logger['error'](_0x5f19('0x1b'),_0x46ff20[_0x5f19('0x14')],_0x3fadf8);_0x5974a0(_0x597862['error'](0x1f4,_0x46ff20[_0x5f19('0x14')]));});});}; \ No newline at end of file +var _0x29e1=['body','options','raw','debug','stringify','lodash','util','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','http','then','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','VoiceTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','CreateVoiceTransferReport','create'];(function(_0x72f1ba,_0x525cce){var _0x485fae=function(_0x3ae4f6){while(--_0x3ae4f6){_0x72f1ba['push'](_0x72f1ba['shift']());}};_0x485fae(++_0x525cce);}(_0x29e1,0xdd));var _0x129e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x29e1[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x129e('0x0'));var util=require(_0x129e('0x1'));var moment=require('moment');var BPromise=require(_0x129e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x129e('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x129e('0x4'))(_0x129e('0x5'));var config=require(_0x129e('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x129e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1d1dd1,_0x37fa89,_0x237afa){return new BPromise(function(_0x419fb2,_0x2f762b){return client['request'](_0x1d1dd1,_0x237afa)[_0x129e('0x8')](function(_0x39b68f){logger[_0x129e('0x9')](_0x129e('0xa'),_0x37fa89,_0x129e('0xb'));logger['debug'](_0x129e('0xc'),_0x37fa89,_0x129e('0xb'),JSON['stringify'](_0x39b68f));if(_0x39b68f[_0x129e('0xd')]){if(_0x39b68f['error'][_0x129e('0xe')]===0x1f4){logger[_0x129e('0xd')](_0x129e('0xa'),_0x37fa89,_0x39b68f[_0x129e('0xd')][_0x129e('0xf')]);return _0x2f762b(_0x39b68f[_0x129e('0xd')][_0x129e('0xf')]);}logger[_0x129e('0xd')](_0x129e('0xa'),_0x37fa89,_0x39b68f[_0x129e('0xd')][_0x129e('0xf')]);return _0x419fb2(_0x39b68f[_0x129e('0xd')]['message']);}else{logger['info'](_0x129e('0xa'),_0x37fa89,_0x129e('0xb'));_0x419fb2(_0x39b68f['result'][_0x129e('0xf')]);}})[_0x129e('0x10')](function(_0x64fd9b){logger[_0x129e('0xd')]('VoiceTransferReport,\x20%s,\x20%s',_0x37fa89,_0x64fd9b);_0x2f762b(_0x64fd9b);});});}exports[_0x129e('0x11')]=function(_0xa8496){var _0x46ac44=this;return new Promise(function(_0x3cdd11,_0x38aeaf){return db['VoiceTransferReport'][_0x129e('0x12')](_0xa8496[_0x129e('0x13')],{'raw':_0xa8496[_0x129e('0x14')]?_0xa8496['options'][_0x129e('0x15')]===undefined?!![]:![]:!![]})['then'](function(_0x174cd9){logger[_0x129e('0x9')](_0x129e('0x11'),_0xa8496);logger[_0x129e('0x16')](_0x129e('0x11'),_0xa8496,JSON[_0x129e('0x17')](_0x174cd9));_0x3cdd11(_0x174cd9);})[_0x129e('0x10')](function(_0x51756a){logger[_0x129e('0xd')](_0x129e('0x11'),_0x51756a['message'],_0xa8496);_0x38aeaf(_0x46ac44[_0x129e('0xd')](0x1f4,_0x51756a['message']));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index 5a410c6..8870865 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 _0xb43b=['/transfer','transfer','express','Router','./webbar.controller','post','/originate','isWebrtcLicence','originate','/hangup','hangup','/answer','isAuthenticated','answer','/unhold','unhold'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0xb43b,0x1b2));var _0xbb43=function(_0x32379b,_0x225ece){_0x32379b=_0x32379b-0x0;var _0x407e7f=_0xb43b[_0x32379b];return _0x407e7f;};'use strict';var express=require(_0xbb43('0x0'));var router=express[_0xbb43('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0xbb43('0x2'));router[_0xbb43('0x3')](_0xbb43('0x4'),auth['isAuthenticated'](),auth[_0xbb43('0x5')](),controller[_0xbb43('0x6')]);router[_0xbb43('0x3')](_0xbb43('0x7'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller[_0xbb43('0x8')]);router['post'](_0xbb43('0x9'),auth[_0xbb43('0xa')](),auth[_0xbb43('0x5')](),controller[_0xbb43('0xb')]);router[_0xbb43('0x3')]('/hold',auth[_0xbb43('0xa')](),auth[_0xbb43('0x5')](),controller['hold']);router[_0xbb43('0x3')](_0xbb43('0xc'),auth[_0xbb43('0xa')](),auth[_0xbb43('0x5')](),controller[_0xbb43('0xd')]);router[_0xbb43('0x3')]('/calls',auth[_0xbb43('0xa')](),auth[_0xbb43('0x5')](),controller['calls']);router['post'](_0xbb43('0xe'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller[_0xbb43('0xf')]);module['exports']=router; \ No newline at end of file +var _0xdace=['unhold','calls','/transfer','transfer','exports','express','../../components/auth/service','./webbar.controller','post','isAuthenticated','isWebrtcLicence','originate','hangup','/answer','/hold','/unhold'];(function(_0x1bbe79,_0x1707f5){var _0x4da933=function(_0x3fb5be){while(--_0x3fb5be){_0x1bbe79['push'](_0x1bbe79['shift']());}};_0x4da933(++_0x1707f5);}(_0xdace,0xc5));var _0xedac=function(_0x1b5aea,_0x3f04b7){_0x1b5aea=_0x1b5aea-0x0;var _0x15cfc6=_0xdace[_0x1b5aea];return _0x15cfc6;};'use strict';var express=require(_0xedac('0x0'));var router=express['Router']();var auth=require(_0xedac('0x1'));var controller=require(_0xedac('0x2'));router[_0xedac('0x3')]('/originate',auth[_0xedac('0x4')](),auth[_0xedac('0x5')](),controller[_0xedac('0x6')]);router[_0xedac('0x3')]('/hangup',auth[_0xedac('0x4')](),auth[_0xedac('0x5')](),controller[_0xedac('0x7')]);router['post'](_0xedac('0x8'),auth[_0xedac('0x4')](),auth[_0xedac('0x5')](),controller['answer']);router[_0xedac('0x3')](_0xedac('0x9'),auth[_0xedac('0x4')](),auth['isWebrtcLicence'](),controller['hold']);router[_0xedac('0x3')](_0xedac('0xa'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller[_0xedac('0xb')]);router[_0xedac('0x3')]('/calls',auth[_0xedac('0x4')](),auth['isWebrtcLicence'](),controller[_0xedac('0xc')]);router[_0xedac('0x3')](_0xedac('0xd'),auth[_0xedac('0x4')](),auth[_0xedac('0x5')](),controller[_0xedac('0xe')]);module[_0xedac('0xf')]=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index a82a47c..9ed61c1 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 _0x3651=['sessionId\x20','\x20not\x20found!','originate\x20fired:','json','body','callerId','entityFound:','format','user:%s','webbar:originate','originate\x20executed!','hangup','userId','webbar:hangup','hangup\x20executed!','answer','answer\x20fired:','webbar:answer','answer\x20executed!','hold','hold\x20fired:','hold\x20executed!','unhold','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls','calls\x20fired:','conference','conference\x20fired:','webbar:conference','conference\x20executed!','transfer','transfer\x20fired:','transferNumber','transfer\x20executed!','path','../../mysqldb','../../config/environment','bluebird','jayson/promise','http','webbarapi','ioredis','redis','localhost','socket.io-emitter','validate','userId\x20is\x20required','string','callNumber\x20is\x20required','number','transferNumber\x20is\x20required','info','stringify','emit','handleError:','error','stack','name','status','send','NotFound','request','then','code','message','result','catch','User','findOne','agent','VoiceChannels','all','filter','rows','UserId','sessionId','length'];(function(_0x56598b,_0x38bdb3){var _0x172135=function(_0x49074e){while(--_0x49074e){_0x56598b['push'](_0x56598b['shift']());}};_0x172135(++_0x38bdb3);}(_0x3651,0x160));var _0x1365=function(_0x583690,_0x31bc5c){_0x583690=_0x583690-0x0;var _0x2ca9ce=_0x3651[_0x583690];return _0x2ca9ce;};'use strict';var path=require(_0x1365('0x0'));var fs=require('fs');var _=require('lodash');var db=require(_0x1365('0x1'))['db'];var config=require(_0x1365('0x2'));var util=require('util');var BPromise=require(_0x1365('0x3'));var jayson=require(_0x1365('0x4'));var amiClient=jayson['client'][_0x1365('0x5')]({'port':0x232a});var logger=require('../../config/logger')(_0x1365('0x6'));var Redis=require(_0x1365('0x7'));config[_0x1365('0x8')]=_['defaults'](config[_0x1365('0x8')],{'host':_0x1365('0x9'),'port':0x18eb});var io=require(_0x1365('0xa'))(new Redis(config['redis']));var Schema=require(_0x1365('0xb'));var originateValidation=new Schema({'userId':{'type':'number','required':[!![],_0x1365('0xc')]},'callNumber':{'type':_0x1365('0xd'),'required':[!![],_0x1365('0xe')]},'callerId':{'type':_0x1365('0xd')},'callbackUrl':{'type':_0x1365('0xd')}});var hangupValidation=new Schema({'userId':{'type':_0x1365('0xf'),'required':[!![],_0x1365('0xc')]},'sessionId':{'type':_0x1365('0xd'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x1365('0xf'),'required':[!![],_0x1365('0xc')]},'sessionId':{'type':_0x1365('0xd'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x1365('0xf'),'required':[!![],_0x1365('0xc')]},'sessionId':{'type':_0x1365('0xd'),'required':[!![],'sessionId\x20is\x20required']},'transferNumber':{'type':_0x1365('0xd'),'required':[!![],_0x1365('0x10')]}});var holdValidation=new Schema({'userId':{'type':'number','required':[!![],_0x1365('0xc')]},'sessionId':{'type':_0x1365('0xd'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x1365('0xf'),'required':[!![],_0x1365('0xc')]},'sessionId':{'type':_0x1365('0xd'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x1365('0xf'),'required':[!![],_0x1365('0xc')]}});var conferenceValidation=new Schema({'userId':{'type':_0x1365('0xf'),'required':[!![],_0x1365('0xc')]}});function emit(_0x5913b9,_0x12475f,_0x265013){logger[_0x1365('0x11')](_0x5913b9,_0x12475f,JSON[_0x1365('0x12')](_0x265013));io['to'](_0x5913b9)[_0x1365('0x13')](_0x12475f,_0x265013);}function handleError(_0x28d283){return function(_0x489385){console['log'](_0x1365('0x14'),_0x489385,_0x489385 instanceof RangeError);logger[_0x1365('0x15')](_0x489385[_0x1365('0x16')]);if(_0x489385 instanceof RangeError){if(_0x489385[_0x1365('0x17')]){delete _0x489385[_0x1365('0x17')];}_0x28d283[_0x1365('0x18')](0x194)['send'](_0x489385);}else{if(_0x489385[_0x1365('0x17')]){delete _0x489385['name'];}_0x28d283['status'](0x1f4)[_0x1365('0x19')](_0x489385);}};}function checkError(){return function(_0x56b5ee){if(!_0x56b5ee){throw new RangeError(_0x1365('0x1a'));}return _0x56b5ee;};}function respondWithRpcPromise(_0x5f2368,_0x5223e7){return new BPromise(function(_0x520990,_0x3ac0b2){var _0xa6bdc8=amiClient;return _0xa6bdc8[_0x1365('0x1b')](_0x5f2368,_0x5223e7)[_0x1365('0x1c')](function(_0x1d2f05){if(_0x1d2f05[_0x1365('0x15')]){if(_0x1d2f05[_0x1365('0x15')][_0x1365('0x1d')]===0x1f4){return _0x3ac0b2(_0x1d2f05[_0x1365('0x15')][_0x1365('0x1e')]);}return _0x520990(_0x1d2f05['error'][_0x1365('0x1e')]);}else{_0x520990(_0x1d2f05[_0x1365('0x1f')]);}})[_0x1365('0x20')](function(_0x2c0d43){_0x3ac0b2(_0x2c0d43);});});}function getAgent(_0x31c5d3){return db[_0x1365('0x21')][_0x1365('0x22')]({'where':{'id':_0x31c5d3,'role':_0x1365('0x23')}})[_0x1365('0x1c')](checkError());}function getAgentCheckSession(_0x405cac,_0x20b1da){return new BPromise(function(_0x4ce08b,_0xc611e5){var _0x1a4b7c=respondWithRpcPromise(_0x1365('0x24'));var _0x58c063=getAgent(_0x405cac);Promise[_0x1365('0x25')]([_0x1a4b7c,_0x58c063])[_0x1365('0x1c')](function(_0xe4f5fc){var _0x31310d=_0xe4f5fc[0x0];var _0x411fc=_0xe4f5fc[0x1];var _0x17a68f=_[_0x1365('0x26')](_0x31310d[_0x1365('0x27')],function(_0x2581d8){return _0x2581d8[_0x1365('0x28')]==_0x411fc['id']&&_0x2581d8[_0x1365('0x29')]==_0x20b1da;});if(_0x17a68f[_0x1365('0x2a')]==0x1){_0x4ce08b(_0x411fc);}else{_0xc611e5(new RangeError(_0x1365('0x2b')+_0x20b1da+_0x1365('0x2c')));}});});}exports['originate']=function(_0x7407d5,_0xe7b649){logger[_0x1365('0x11')](_0x1365('0x2d'),_0x7407d5['body']);var _0x9eac3b=originateValidation[_0x1365('0xb')](_0x7407d5['body']);if(_0x9eac3b['length']>0x0){return _0xe7b649[_0x1365('0x18')](0x190)[_0x1365('0x2e')](_0x9eac3b);}var _0x5173af=_0x7407d5['body']['userId'];var _0x49e04f=_0x7407d5[_0x1365('0x2f')]['callNumber'];var _0x5ea9b5=_0x7407d5[_0x1365('0x2f')][_0x1365('0x30')];var _0x5f54b4=_0x7407d5[_0x1365('0x2f')]['callbackUrl'];return getAgent(_0x5173af)['then'](function(_0x121f03){logger[_0x1365('0x11')](_0x1365('0x31'),_0x121f03[_0x1365('0x17')]);emit(util[_0x1365('0x32')](_0x1365('0x33'),_0x121f03[_0x1365('0x17')]),_0x1365('0x34'),{'callNumber':_0x49e04f,'callerId':_0x5ea9b5,'callbackUrl':_0x5f54b4});return _0xe7b649['status'](0xc8)[_0x1365('0x2e')]({'error':![],'message':_0x1365('0x35')});})[_0x1365('0x20')](handleError(_0xe7b649));};exports[_0x1365('0x36')]=function(_0x1e0960,_0x1c5768){logger[_0x1365('0x11')]('hangup\x20fired:',_0x1e0960['body']);var _0x47048d=hangupValidation[_0x1365('0xb')](_0x1e0960[_0x1365('0x2f')]);if(_0x47048d[_0x1365('0x2a')]>0x0){return _0x1c5768['status'](0x190)['json'](_0x47048d);}var _0x17255c=_0x1e0960[_0x1365('0x2f')][_0x1365('0x37')];var _0x5be80a=_0x1e0960[_0x1365('0x2f')][_0x1365('0x29')];return getAgent(_0x17255c)['then'](function(_0x1d72cb){logger[_0x1365('0x11')](_0x1365('0x31'),_0x1d72cb[_0x1365('0x17')]);emit(util[_0x1365('0x32')]('user:%s',_0x1d72cb[_0x1365('0x17')]),_0x1365('0x38'),{'sessionId':_0x5be80a});return _0x1c5768['status'](0xc8)['json']({'error':![],'message':_0x1365('0x39')});})[_0x1365('0x20')](handleError(_0x1c5768));};exports[_0x1365('0x3a')]=function(_0x40b232,_0x306fda){logger[_0x1365('0x11')](_0x1365('0x3b'),_0x40b232['body']);var _0x2e160d=answerValidation[_0x1365('0xb')](_0x40b232[_0x1365('0x2f')]);if(_0x2e160d[_0x1365('0x2a')]>0x0){return _0x306fda[_0x1365('0x18')](0x190)[_0x1365('0x2e')](_0x2e160d);}var _0x2d29c7=_0x40b232[_0x1365('0x2f')][_0x1365('0x37')];var _0x17120a=_0x40b232[_0x1365('0x2f')][_0x1365('0x29')];return getAgent(_0x2d29c7)[_0x1365('0x1c')](function(_0x34d427){logger[_0x1365('0x11')](_0x1365('0x31'),_0x34d427['name']);emit(util[_0x1365('0x32')](_0x1365('0x33'),_0x34d427[_0x1365('0x17')]),_0x1365('0x3c'),{'sessionId':_0x17120a});return _0x306fda[_0x1365('0x18')](0xc8)['json']({'error':![],'message':_0x1365('0x3d')});})[_0x1365('0x20')](handleError(_0x306fda));};exports[_0x1365('0x3e')]=function(_0x185f21,_0x4a1c1b){logger[_0x1365('0x11')](_0x1365('0x3f'),_0x185f21[_0x1365('0x2f')]);var _0x34c9a0=holdValidation['validate'](_0x185f21[_0x1365('0x2f')]);if(_0x34c9a0[_0x1365('0x2a')]>0x0){return _0x4a1c1b[_0x1365('0x18')](0x190)['json'](_0x34c9a0);}var _0x27f5f2=_0x185f21[_0x1365('0x2f')][_0x1365('0x37')];var _0x5b2ef1=_0x185f21[_0x1365('0x2f')][_0x1365('0x29')];return getAgent(_0x27f5f2)[_0x1365('0x1c')](function(_0x403dbb){logger[_0x1365('0x11')]('entityFound:',_0x403dbb[_0x1365('0x17')]);emit(util[_0x1365('0x32')](_0x1365('0x33'),_0x403dbb[_0x1365('0x17')]),'webbar:hold',{'sessionId':_0x5b2ef1});return _0x4a1c1b[_0x1365('0x18')](0xc8)[_0x1365('0x2e')]({'error':![],'message':_0x1365('0x40')});})[_0x1365('0x20')](handleError(_0x4a1c1b));};exports[_0x1365('0x41')]=function(_0x21db35,_0xdfabf5){logger['info'](_0x1365('0x42'),_0x21db35[_0x1365('0x2f')]);var _0x3c50b3=unholdValidation[_0x1365('0xb')](_0x21db35[_0x1365('0x2f')]);if(_0x3c50b3[_0x1365('0x2a')]>0x0){return _0xdfabf5['status'](0x190)[_0x1365('0x2e')](_0x3c50b3);}var _0x449b31=_0x21db35['body'][_0x1365('0x37')];var _0x162c13=_0x21db35[_0x1365('0x2f')][_0x1365('0x29')];return getAgent(_0x449b31)[_0x1365('0x1c')](function(_0x523911){logger[_0x1365('0x11')]('entityFound:',_0x523911[_0x1365('0x17')]);emit(util[_0x1365('0x32')]('user:%s',_0x523911[_0x1365('0x17')]),_0x1365('0x43'),{'sessionId':_0x162c13});return _0xdfabf5[_0x1365('0x18')](0xc8)['json']({'error':![],'message':_0x1365('0x44')});})[_0x1365('0x20')](handleError(_0xdfabf5));};exports[_0x1365('0x45')]=function(_0x2ffd1c,_0x4bbd6c){logger['info'](_0x1365('0x46'),_0x4bbd6c[_0x1365('0x2f')]);var _0x4ed176=callsValidation[_0x1365('0xb')](_0x2ffd1c[_0x1365('0x2f')]);if(_0x4ed176[_0x1365('0x2a')]>0x0){return _0x4bbd6c[_0x1365('0x18')](0x190)[_0x1365('0x2e')](_0x4ed176);}var _0x2c6897=_0x2ffd1c[_0x1365('0x2f')][_0x1365('0x37')];var _0x5e8999=respondWithRpcPromise('VoiceChannels');var _0x1d50e8=getAgent(_0x2c6897);return Promise[_0x1365('0x25')]([_0x5e8999,_0x1d50e8])[_0x1365('0x1c')](function(_0x2dd3c8){var _0x1f0259=_0x2dd3c8[0x0];var _0x25a111=_0x2dd3c8[0x1];var _0x2a72b0=_['filter'](_0x1f0259['rows'],function(_0x3adc9f){return _0x3adc9f['UserId']==_0x25a111['id'];});return _0x4bbd6c[_0x1365('0x18')](0xc8)[_0x1365('0x2e')]({'count':_0x2a72b0[_0x1365('0x2a')],'rows':_0x2a72b0});})[_0x1365('0x20')](handleError(_0x4bbd6c));};exports[_0x1365('0x47')]=function(_0x2d0f83,_0x5bab){logger[_0x1365('0x11')](_0x1365('0x48'),_0x2d0f83[_0x1365('0x2f')]);var _0x38f1ba=conferenceValidation['validate'](_0x2d0f83[_0x1365('0x2f')]);if(_0x38f1ba['length']>0x0){return _0x5bab[_0x1365('0x18')](0x190)[_0x1365('0x2e')](_0x38f1ba);}var _0x192298=_0x2d0f83[_0x1365('0x2f')][_0x1365('0x37')];return getAgent(_0x192298)[_0x1365('0x1c')](function(_0x232a1a){logger[_0x1365('0x11')]('entityFound:',_0x232a1a[_0x1365('0x17')]);emit(util[_0x1365('0x32')](_0x1365('0x33'),_0x232a1a[_0x1365('0x17')]),_0x1365('0x49'));return _0x5bab[_0x1365('0x18')](0xc8)[_0x1365('0x2e')]({'error':![],'message':_0x1365('0x4a')});})[_0x1365('0x20')](handleError(_0x5bab));};exports[_0x1365('0x4b')]=function(_0xa0bffe,_0x2dcec8){logger['info'](_0x1365('0x4c'),_0xa0bffe[_0x1365('0x2f')]);var _0xaa130e=transferValidation[_0x1365('0xb')](_0xa0bffe[_0x1365('0x2f')]);if(_0xaa130e['length']>0x0){return _0x2dcec8['status'](0x190)[_0x1365('0x2e')](_0xaa130e);}var _0x30523c=_0xa0bffe[_0x1365('0x2f')][_0x1365('0x37')];var _0x519cef=_0xa0bffe[_0x1365('0x2f')][_0x1365('0x29')];var _0x2d1e2c=_0xa0bffe['body'][_0x1365('0x4d')];return getAgent(_0x30523c)['then'](function(_0x447eb1){logger[_0x1365('0x11')](_0x1365('0x31'),_0x447eb1[_0x1365('0x17')]);emit(util[_0x1365('0x32')](_0x1365('0x33'),_0x447eb1[_0x1365('0x17')]),'webbar:transfer',{'sessionId':_0x519cef,'transferNumber':_0x2d1e2c});return _0x2dcec8[_0x1365('0x18')](0xc8)[_0x1365('0x2e')]({'error':![],'message':_0x1365('0x4e')});})['catch'](handleError(_0x2dcec8));}; \ No newline at end of file +var _0x9039=['sessionId','length','\x20not\x20found!','originate','body','json','userId','callNumber','callbackUrl','entityFound:','format','user:%s','originate\x20executed!','hangup','hangup\x20fired:','webbar:hangup','hangup\x20executed!','answer','webbar:answer','answer\x20executed!','hold','hold\x20fired:','webbar:hold','unhold','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls','calls\x20fired:','conference','conference\x20fired:','conference\x20executed!','transfer\x20fired:','transferNumber','transfer\x20executed!','path','../../mysqldb','../../config/environment','util','bluebird','jayson/promise','client','http','redis','localhost','socket.io-emitter','validate','number','userId\x20is\x20required','string','callNumber\x20is\x20required','sessionId\x20is\x20required','info','stringify','emit','log','handleError:','error','stack','name','status','send','NotFound','request','message','catch','User','agent','then','VoiceChannels','all','filter','rows','UserId'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x9039,0xb7));var _0x9903=function(_0x1de606,_0x2c7427){_0x1de606=_0x1de606-0x0;var _0x15b373=_0x9039[_0x1de606];return _0x15b373;};'use strict';var path=require(_0x9903('0x0'));var fs=require('fs');var _=require('lodash');var db=require(_0x9903('0x1'))['db'];var config=require(_0x9903('0x2'));var util=require(_0x9903('0x3'));var BPromise=require(_0x9903('0x4'));var jayson=require(_0x9903('0x5'));var amiClient=jayson[_0x9903('0x6')][_0x9903('0x7')]({'port':0x232a});var logger=require('../../config/logger')('webbarapi');var Redis=require('ioredis');config['redis']=_['defaults'](config[_0x9903('0x8')],{'host':_0x9903('0x9'),'port':0x18eb});var io=require(_0x9903('0xa'))(new Redis(config[_0x9903('0x8')]));var Schema=require(_0x9903('0xb'));var originateValidation=new Schema({'userId':{'type':_0x9903('0xc'),'required':[!![],_0x9903('0xd')]},'callNumber':{'type':_0x9903('0xe'),'required':[!![],_0x9903('0xf')]},'callerId':{'type':_0x9903('0xe')},'callbackUrl':{'type':_0x9903('0xe')}});var hangupValidation=new Schema({'userId':{'type':_0x9903('0xc'),'required':[!![],_0x9903('0xd')]},'sessionId':{'type':_0x9903('0xe'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x9903('0xc'),'required':[!![],_0x9903('0xd')]},'sessionId':{'type':_0x9903('0xe'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x9903('0xc'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x9903('0xe'),'required':[!![],_0x9903('0x10')]},'transferNumber':{'type':_0x9903('0xe'),'required':[!![],'transferNumber\x20is\x20required']}});var holdValidation=new Schema({'userId':{'type':'number','required':[!![],_0x9903('0xd')]},'sessionId':{'type':_0x9903('0xe'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':'number','required':[!![],_0x9903('0xd')]},'sessionId':{'type':_0x9903('0xe'),'required':![]}});var callsValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']}});var conferenceValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']}});function emit(_0x5341b9,_0x293765,_0x2ae1df){logger[_0x9903('0x11')](_0x5341b9,_0x293765,JSON[_0x9903('0x12')](_0x2ae1df));io['to'](_0x5341b9)[_0x9903('0x13')](_0x293765,_0x2ae1df);}function handleError(_0x508dad){return function(_0x28ccc1){console[_0x9903('0x14')](_0x9903('0x15'),_0x28ccc1,_0x28ccc1 instanceof RangeError);logger[_0x9903('0x16')](_0x28ccc1[_0x9903('0x17')]);if(_0x28ccc1 instanceof RangeError){if(_0x28ccc1[_0x9903('0x18')]){delete _0x28ccc1[_0x9903('0x18')];}_0x508dad[_0x9903('0x19')](0x194)[_0x9903('0x1a')](_0x28ccc1);}else{if(_0x28ccc1[_0x9903('0x18')]){delete _0x28ccc1['name'];}_0x508dad[_0x9903('0x19')](0x1f4)[_0x9903('0x1a')](_0x28ccc1);}};}function checkError(){return function(_0x455cef){if(!_0x455cef){throw new RangeError(_0x9903('0x1b'));}return _0x455cef;};}function respondWithRpcPromise(_0x352bb5,_0x2a9f9b){return new BPromise(function(_0x586500,_0xb51e0){var _0x55e4a1=amiClient;return _0x55e4a1[_0x9903('0x1c')](_0x352bb5,_0x2a9f9b)['then'](function(_0x11e541){if(_0x11e541[_0x9903('0x16')]){if(_0x11e541['error']['code']===0x1f4){return _0xb51e0(_0x11e541['error'][_0x9903('0x1d')]);}return _0x586500(_0x11e541[_0x9903('0x16')]['message']);}else{_0x586500(_0x11e541['result']);}})[_0x9903('0x1e')](function(_0x407ddf){_0xb51e0(_0x407ddf);});});}function getAgent(_0x4bf280){return db[_0x9903('0x1f')]['findOne']({'where':{'id':_0x4bf280,'role':_0x9903('0x20')}})[_0x9903('0x21')](checkError());}function getAgentCheckSession(_0x2ad0e0,_0x4cee5f){return new BPromise(function(_0xaddcd3,_0xee800c){var _0x9e7c58=respondWithRpcPromise(_0x9903('0x22'));var _0x2b14d1=getAgent(_0x2ad0e0);Promise[_0x9903('0x23')]([_0x9e7c58,_0x2b14d1])[_0x9903('0x21')](function(_0x17bb0e){var _0x2e667b=_0x17bb0e[0x0];var _0x3b568f=_0x17bb0e[0x1];var _0x49413b=_[_0x9903('0x24')](_0x2e667b[_0x9903('0x25')],function(_0x2cba50){return _0x2cba50[_0x9903('0x26')]==_0x3b568f['id']&&_0x2cba50[_0x9903('0x27')]==_0x4cee5f;});if(_0x49413b[_0x9903('0x28')]==0x1){_0xaddcd3(_0x3b568f);}else{_0xee800c(new RangeError('sessionId\x20'+_0x4cee5f+_0x9903('0x29')));}});});}exports[_0x9903('0x2a')]=function(_0x52c339,_0x16b227){logger[_0x9903('0x11')]('originate\x20fired:',_0x52c339[_0x9903('0x2b')]);var _0x3f5000=originateValidation['validate'](_0x52c339[_0x9903('0x2b')]);if(_0x3f5000[_0x9903('0x28')]>0x0){return _0x16b227[_0x9903('0x19')](0x190)[_0x9903('0x2c')](_0x3f5000);}var _0x23eb04=_0x52c339[_0x9903('0x2b')][_0x9903('0x2d')];var _0x4171be=_0x52c339['body'][_0x9903('0x2e')];var _0xf38b25=_0x52c339[_0x9903('0x2b')]['callerId'];var _0x3c3a18=_0x52c339[_0x9903('0x2b')][_0x9903('0x2f')];return getAgent(_0x23eb04)[_0x9903('0x21')](function(_0x2b1d45){logger['info'](_0x9903('0x30'),_0x2b1d45[_0x9903('0x18')]);emit(util[_0x9903('0x31')](_0x9903('0x32'),_0x2b1d45[_0x9903('0x18')]),'webbar:originate',{'callNumber':_0x4171be,'callerId':_0xf38b25,'callbackUrl':_0x3c3a18});return _0x16b227[_0x9903('0x19')](0xc8)[_0x9903('0x2c')]({'error':![],'message':_0x9903('0x33')});})[_0x9903('0x1e')](handleError(_0x16b227));};exports[_0x9903('0x34')]=function(_0x437b68,_0x4c5d39){logger[_0x9903('0x11')](_0x9903('0x35'),_0x437b68[_0x9903('0x2b')]);var _0x29dfe5=hangupValidation['validate'](_0x437b68[_0x9903('0x2b')]);if(_0x29dfe5[_0x9903('0x28')]>0x0){return _0x4c5d39[_0x9903('0x19')](0x190)['json'](_0x29dfe5);}var _0x150655=_0x437b68['body'][_0x9903('0x2d')];var _0x27672d=_0x437b68[_0x9903('0x2b')][_0x9903('0x27')];return getAgent(_0x150655)[_0x9903('0x21')](function(_0x23f61a){logger[_0x9903('0x11')](_0x9903('0x30'),_0x23f61a[_0x9903('0x18')]);emit(util[_0x9903('0x31')](_0x9903('0x32'),_0x23f61a[_0x9903('0x18')]),_0x9903('0x36'),{'sessionId':_0x27672d});return _0x4c5d39[_0x9903('0x19')](0xc8)['json']({'error':![],'message':_0x9903('0x37')});})[_0x9903('0x1e')](handleError(_0x4c5d39));};exports[_0x9903('0x38')]=function(_0x40d415,_0x26e387){logger['info']('answer\x20fired:',_0x40d415['body']);var _0x596381=answerValidation['validate'](_0x40d415[_0x9903('0x2b')]);if(_0x596381[_0x9903('0x28')]>0x0){return _0x26e387[_0x9903('0x19')](0x190)['json'](_0x596381);}var _0x2d5fd5=_0x40d415['body'][_0x9903('0x2d')];var _0x51014a=_0x40d415['body'][_0x9903('0x27')];return getAgent(_0x2d5fd5)['then'](function(_0x903842){logger[_0x9903('0x11')](_0x9903('0x30'),_0x903842['name']);emit(util[_0x9903('0x31')](_0x9903('0x32'),_0x903842[_0x9903('0x18')]),_0x9903('0x39'),{'sessionId':_0x51014a});return _0x26e387['status'](0xc8)[_0x9903('0x2c')]({'error':![],'message':_0x9903('0x3a')});})[_0x9903('0x1e')](handleError(_0x26e387));};exports[_0x9903('0x3b')]=function(_0x1b5984,_0x4cd72c){logger[_0x9903('0x11')](_0x9903('0x3c'),_0x1b5984[_0x9903('0x2b')]);var _0xb3d8fc=holdValidation[_0x9903('0xb')](_0x1b5984[_0x9903('0x2b')]);if(_0xb3d8fc[_0x9903('0x28')]>0x0){return _0x4cd72c[_0x9903('0x19')](0x190)['json'](_0xb3d8fc);}var _0x1e877b=_0x1b5984[_0x9903('0x2b')][_0x9903('0x2d')];var _0x584690=_0x1b5984[_0x9903('0x2b')][_0x9903('0x27')];return getAgent(_0x1e877b)[_0x9903('0x21')](function(_0x366bdf){logger[_0x9903('0x11')]('entityFound:',_0x366bdf[_0x9903('0x18')]);emit(util[_0x9903('0x31')](_0x9903('0x32'),_0x366bdf[_0x9903('0x18')]),_0x9903('0x3d'),{'sessionId':_0x584690});return _0x4cd72c[_0x9903('0x19')](0xc8)[_0x9903('0x2c')]({'error':![],'message':'hold\x20executed!'});})[_0x9903('0x1e')](handleError(_0x4cd72c));};exports[_0x9903('0x3e')]=function(_0x33658e,_0x1a0cf4){logger[_0x9903('0x11')](_0x9903('0x3f'),_0x33658e[_0x9903('0x2b')]);var _0xba17bc=unholdValidation[_0x9903('0xb')](_0x33658e[_0x9903('0x2b')]);if(_0xba17bc[_0x9903('0x28')]>0x0){return _0x1a0cf4[_0x9903('0x19')](0x190)[_0x9903('0x2c')](_0xba17bc);}var _0x4d7826=_0x33658e[_0x9903('0x2b')][_0x9903('0x2d')];var _0x4f91f7=_0x33658e[_0x9903('0x2b')]['sessionId'];return getAgent(_0x4d7826)[_0x9903('0x21')](function(_0x42d12f){logger['info']('entityFound:',_0x42d12f[_0x9903('0x18')]);emit(util[_0x9903('0x31')](_0x9903('0x32'),_0x42d12f[_0x9903('0x18')]),_0x9903('0x40'),{'sessionId':_0x4f91f7});return _0x1a0cf4['status'](0xc8)[_0x9903('0x2c')]({'error':![],'message':_0x9903('0x41')});})[_0x9903('0x1e')](handleError(_0x1a0cf4));};exports[_0x9903('0x42')]=function(_0x312429,_0x225bc0){logger[_0x9903('0x11')](_0x9903('0x43'),_0x225bc0[_0x9903('0x2b')]);var _0xbd9b69=callsValidation[_0x9903('0xb')](_0x312429[_0x9903('0x2b')]);if(_0xbd9b69[_0x9903('0x28')]>0x0){return _0x225bc0[_0x9903('0x19')](0x190)[_0x9903('0x2c')](_0xbd9b69);}var _0x5ecce2=_0x312429[_0x9903('0x2b')][_0x9903('0x2d')];var _0x2d678b=respondWithRpcPromise(_0x9903('0x22'));var _0x3e2f97=getAgent(_0x5ecce2);return Promise['all']([_0x2d678b,_0x3e2f97])[_0x9903('0x21')](function(_0x2f02cf){var _0xb7fd94=_0x2f02cf[0x0];var _0x1c042f=_0x2f02cf[0x1];var _0x4a58ec=_[_0x9903('0x24')](_0xb7fd94['rows'],function(_0x5d3129){return _0x5d3129[_0x9903('0x26')]==_0x1c042f['id'];});return _0x225bc0[_0x9903('0x19')](0xc8)['json']({'count':_0x4a58ec[_0x9903('0x28')],'rows':_0x4a58ec});})['catch'](handleError(_0x225bc0));};exports[_0x9903('0x44')]=function(_0x142020,_0x22cdc6){logger[_0x9903('0x11')](_0x9903('0x45'),_0x142020['body']);var _0x5efb86=conferenceValidation[_0x9903('0xb')](_0x142020[_0x9903('0x2b')]);if(_0x5efb86['length']>0x0){return _0x22cdc6[_0x9903('0x19')](0x190)['json'](_0x5efb86);}var _0x12e461=_0x142020[_0x9903('0x2b')][_0x9903('0x2d')];return getAgent(_0x12e461)[_0x9903('0x21')](function(_0x59f750){logger['info']('entityFound:',_0x59f750['name']);emit(util[_0x9903('0x31')]('user:%s',_0x59f750[_0x9903('0x18')]),'webbar:conference');return _0x22cdc6[_0x9903('0x19')](0xc8)[_0x9903('0x2c')]({'error':![],'message':_0x9903('0x46')});})[_0x9903('0x1e')](handleError(_0x22cdc6));};exports['transfer']=function(_0x3560b5,_0x1a706a){logger[_0x9903('0x11')](_0x9903('0x47'),_0x3560b5[_0x9903('0x2b')]);var _0x5a14ea=transferValidation[_0x9903('0xb')](_0x3560b5[_0x9903('0x2b')]);if(_0x5a14ea['length']>0x0){return _0x1a706a[_0x9903('0x19')](0x190)[_0x9903('0x2c')](_0x5a14ea);}var _0x18e012=_0x3560b5[_0x9903('0x2b')][_0x9903('0x2d')];var _0x4c4b89=_0x3560b5[_0x9903('0x2b')][_0x9903('0x27')];var _0x3c29fb=_0x3560b5[_0x9903('0x2b')][_0x9903('0x48')];return getAgent(_0x18e012)[_0x9903('0x21')](function(_0x543b46){logger['info'](_0x9903('0x30'),_0x543b46[_0x9903('0x18')]);emit(util[_0x9903('0x31')](_0x9903('0x32'),_0x543b46[_0x9903('0x18')]),'webbar:transfer',{'sessionId':_0x4c4b89,'transferNumber':_0x3c29fb});return _0x1a706a[_0x9903('0x19')](0xc8)[_0x9903('0x2c')]({'error':![],'message':_0x9903('0x49')});})[_0x9903('0x1e')](handleError(_0x1a706a));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index fd1d600..b937bb9 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 _0xf319=['/:id','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','getAgents','post','create','addDisposition','addAnswer','/:id/users','/:id/applications','addApplications','/:id/notify','put','update','delete','destroy','removeAnswers','removeAgents','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe'];(function(_0x494cdb,_0x5ede79){var _0x56364b=function(_0x4e6613){while(--_0x4e6613){_0x494cdb['push'](_0x494cdb['shift']());}};_0x56364b(++_0x5ede79);}(_0xf319,0x1c2));var _0x9f31=function(_0x19e8e9,_0x81ad6f){_0x19e8e9=_0x19e8e9-0x0;var _0x3ceac5=_0xf319[_0x19e8e9];return _0x3ceac5;};'use strict';var multer=require(_0x9f31('0x0'));var util=require(_0x9f31('0x1'));var path=require(_0x9f31('0x2'));var timeout=require('connect-timeout');var express=require(_0x9f31('0x3'));var router=express[_0x9f31('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x9f31('0x5'));var interaction=require(_0x9f31('0x6'));var config=require('../../config/environment');var controller=require('./whatsappAccount.controller');router[_0x9f31('0x7')]('/',auth[_0x9f31('0x8')](),controller[_0x9f31('0x9')]);router[_0x9f31('0x7')](_0x9f31('0xa'),auth['isAuthenticated'](),controller[_0x9f31('0xb')]);router[_0x9f31('0x7')](_0x9f31('0xc'),auth[_0x9f31('0x8')](),controller['show']);router[_0x9f31('0x7')](_0x9f31('0xd'),auth[_0x9f31('0x8')](),controller[_0x9f31('0xe')]);router[_0x9f31('0x7')](_0x9f31('0xf'),auth[_0x9f31('0x8')](),controller[_0x9f31('0x10')]);router[_0x9f31('0x7')]('/:id/users',auth['isAuthenticated'](),controller[_0x9f31('0x11')]);router[_0x9f31('0x7')]('/:id/applications',auth[_0x9f31('0x8')](),controller['getApplications']);router[_0x9f31('0x12')]('/',auth[_0x9f31('0x8')](),controller[_0x9f31('0x13')]);router[_0x9f31('0x12')](_0x9f31('0xd'),auth[_0x9f31('0x8')](),controller[_0x9f31('0x14')]);router[_0x9f31('0x12')](_0x9f31('0xf'),auth[_0x9f31('0x8')](),controller[_0x9f31('0x15')]);router[_0x9f31('0x12')](_0x9f31('0x16'),auth[_0x9f31('0x8')](),controller['addAgents']);router[_0x9f31('0x12')](_0x9f31('0x17'),auth[_0x9f31('0x8')](),controller[_0x9f31('0x18')]);router[_0x9f31('0x12')](_0x9f31('0x19'),controller['notify']);router[_0x9f31('0x12')]('/:id/send',auth['isAuthenticated'](),controller['send']);router[_0x9f31('0x1a')](_0x9f31('0xc'),auth[_0x9f31('0x8')](),controller[_0x9f31('0x1b')]);router[_0x9f31('0x1c')]('/:id',auth[_0x9f31('0x8')](),controller[_0x9f31('0x1d')]);router[_0x9f31('0x1c')](_0x9f31('0xd'),auth[_0x9f31('0x8')](),controller['removeDispositions']);router[_0x9f31('0x1c')]('/:id/canned_answers',auth[_0x9f31('0x8')](),controller[_0x9f31('0x1e')]);router[_0x9f31('0x1c')](_0x9f31('0x16'),auth[_0x9f31('0x8')](),controller[_0x9f31('0x1f')]);module[_0x9f31('0x20')]=router; \ No newline at end of file +var _0xef48=['isAuthenticated','describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/users','getAgents','/:id/applications','getApplications','create','post','addDisposition','addAgents','addApplications','/:id/notify','notify','send','put','update','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','connect-timeout','express','Router','./whatsappAccount.controller','get'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xef48,0xf9));var _0x8ef4=function(_0x16568a,_0x4a3768){_0x16568a=_0x16568a-0x0;var _0x4f109c=_0xef48[_0x16568a];return _0x4f109c;};'use strict';var multer=require(_0x8ef4('0x0'));var util=require(_0x8ef4('0x1'));var path=require('path');var timeout=require(_0x8ef4('0x2'));var express=require(_0x8ef4('0x3'));var router=express[_0x8ef4('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x8ef4('0x5'));router[_0x8ef4('0x6')]('/',auth[_0x8ef4('0x7')](),controller['index']);router[_0x8ef4('0x6')]('/describe',auth[_0x8ef4('0x7')](),controller[_0x8ef4('0x8')]);router[_0x8ef4('0x6')]('/:id',auth['isAuthenticated'](),controller[_0x8ef4('0x9')]);router[_0x8ef4('0x6')](_0x8ef4('0xa'),auth[_0x8ef4('0x7')](),controller[_0x8ef4('0xb')]);router[_0x8ef4('0x6')](_0x8ef4('0xc'),auth['isAuthenticated'](),controller['getAnswers']);router['get'](_0x8ef4('0xd'),auth[_0x8ef4('0x7')](),controller[_0x8ef4('0xe')]);router['get'](_0x8ef4('0xf'),auth['isAuthenticated'](),controller[_0x8ef4('0x10')]);router['post']('/',auth[_0x8ef4('0x7')](),controller[_0x8ef4('0x11')]);router[_0x8ef4('0x12')](_0x8ef4('0xa'),auth[_0x8ef4('0x7')](),controller[_0x8ef4('0x13')]);router['post'](_0x8ef4('0xc'),auth['isAuthenticated'](),controller['addAnswer']);router[_0x8ef4('0x12')](_0x8ef4('0xd'),auth[_0x8ef4('0x7')](),controller[_0x8ef4('0x14')]);router[_0x8ef4('0x12')](_0x8ef4('0xf'),auth[_0x8ef4('0x7')](),controller[_0x8ef4('0x15')]);router[_0x8ef4('0x12')](_0x8ef4('0x16'),controller[_0x8ef4('0x17')]);router[_0x8ef4('0x12')]('/:id/send',auth[_0x8ef4('0x7')](),controller[_0x8ef4('0x18')]);router[_0x8ef4('0x19')]('/:id',auth['isAuthenticated'](),controller[_0x8ef4('0x1a')]);router[_0x8ef4('0x1b')]('/:id',auth['isAuthenticated'](),controller['destroy']);router[_0x8ef4('0x1b')](_0x8ef4('0xa'),auth[_0x8ef4('0x7')](),controller[_0x8ef4('0x1c')]);router['delete']('/:id/canned_answers',auth[_0x8ef4('0x7')](),controller[_0x8ef4('0x1d')]);router['delete'](_0x8ef4('0xd'),auth[_0x8ef4('0x7')](),controller[_0x8ef4('0x1e')]);module[_0x8ef4('0x1f')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index 584ae87..da80ada 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 _0x35e5=['sequelize','STRING','name','generate','ENUM','twilio','sinch','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue'];(function(_0x386574,_0x4f92e9){var _0x1f8da8=function(_0x35bd24){while(--_0x35bd24){_0x386574['push'](_0x386574['shift']());}};_0x1f8da8(++_0x4f92e9);}(_0x35e5,0xc4));var _0x535e=function(_0x5a2ff1,_0x3136b1){_0x5a2ff1=_0x5a2ff1-0x0;var _0x4ad3a7=_0x35e5[_0x5a2ff1];return _0x4ad3a7;};'use strict';var Sequelize=require(_0x535e('0x0'));var rs=require('randomstring');module['exports']={'name':{'type':Sequelize[_0x535e('0x1')],'unique':_0x535e('0x2'),'allowNull':![]},'key':{'type':Sequelize[_0x535e('0x1')],'allowNull':![]},'remote':{'type':Sequelize[_0x535e('0x1')],'allowNull':![]},'token':{'type':Sequelize[_0x535e('0x1')],'defaultValue':function(){return rs[_0x535e('0x3')]();}},'phone':{'type':Sequelize[_0x535e('0x1')]},'type':{'type':Sequelize[_0x535e('0x4')](_0x535e('0x5'),_0x535e('0x6'))},'accountSid':{'type':Sequelize[_0x535e('0x1')]},'baseUrl':{'type':Sequelize[_0x535e('0x1')]},'authToken':{'type':Sequelize[_0x535e('0x1')]},'notificationTemplate':{'type':Sequelize[_0x535e('0x7')],'defaultValue':function(){return _0x535e('0x8');}},'notificationSound':{'type':Sequelize[_0x535e('0x9')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x535e('0x9')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x535e('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x535e('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x535e('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x535e('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x535e('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x535e('0xa')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x535e('0xb'),'set':function(_0xdee563){if(!_0xdee563){this['setDataValue'](_0x535e('0xc'),null);}this[_0x535e('0xd')]('mandatoryDisposition',_0xdee563);}},'description':{'type':Sequelize[_0x535e('0x1')]}}; \ No newline at end of file +var _0x8dfa=['mandatoryDisposition','sequelize','randomstring','exports','STRING','name','ENUM','twilio','sinch','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId'];(function(_0x4e6bd4,_0x53ba4b){var _0x10a077=function(_0x245ccc){while(--_0x245ccc){_0x4e6bd4['push'](_0x4e6bd4['shift']());}};_0x10a077(++_0x53ba4b);}(_0x8dfa,0x155));var _0xa8df=function(_0xdaf736,_0xd8c667){_0xdaf736=_0xdaf736-0x0;var _0x1090b3=_0x8dfa[_0xdaf736];return _0x1090b3;};'use strict';var Sequelize=require(_0xa8df('0x0'));var rs=require(_0xa8df('0x1'));module[_0xa8df('0x2')]={'name':{'type':Sequelize[_0xa8df('0x3')],'unique':_0xa8df('0x4'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0xa8df('0x3')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0xa8df('0x3')]},'type':{'type':Sequelize[_0xa8df('0x5')](_0xa8df('0x6'),_0xa8df('0x7'))},'accountSid':{'type':Sequelize[_0xa8df('0x3')]},'baseUrl':{'type':Sequelize[_0xa8df('0x3')]},'authToken':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0xa8df('0x8')],'defaultValue':function(){return _0xa8df('0x9');}},'notificationSound':{'type':Sequelize[_0xa8df('0xa')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0xa8df('0xa')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xa8df('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xa8df('0xa')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'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[_0xa8df('0xb')],'comment':_0xa8df('0xc')},'mandatoryDisposition':{'type':Sequelize[_0xa8df('0xa')],'defaultValue':![],'comment':_0xa8df('0xd'),'set':function(_0x1d3a16){if(!_0x1d3a16){this[_0xa8df('0xe')](_0xa8df('0xf'),null);}this[_0xa8df('0xe')](_0xa8df('0x10'),_0x1d3a16);}},'description':{'type':Sequelize[_0xa8df('0x3')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 68b0845..b3a811c 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 _0xabc1=['filter','merge','options','WhatsappAccount','include','catch','params','mandatoryDispositionPause','length','includeAll','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','update','describe','WhatsappAccountId','Disposition','getDispositions','findOne','hasOwnProperty','pick','findAll','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','rows','removeAnswers','addAgents','omit','emit','userWhatsappAccount:save','removeAgents','userWhatsappAccount:remove','getAgents','User','addApplications','transaction','sequelize','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','findAndCountAll','priority','finally','send','getApplications','notify','whatsapp','Applications','account','sinch','statuses','state','read','WhatsappMessage','timestamp','applications','orderBy','asc','CmContact','Sequelize','ValidationError','difference','createdAt','updatedAt','CompanyId','ListId','mobile','from','whatsapp:','Body','messageId','MessageSid','notifications','message_id','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','Contacts','list','defaults','contact','WhatsappInteraction','interaction','autoclose','close','unmanaged','*,*,*,*','created','ContactId','UserId','unshift','agent','waitForTheAssignedAgent','queueId','WhatsappQueue','queue','startRouting','WhatsappAccount,\x20%s,\x20%s,\x20%s','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','twilio','\x0a','to\x20is\x20mandatory','CmList','List','DESC','out','dataValues','Messages','push','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./whatsappAccount.socket','register','jayson/promise','client','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','destroy','then','get','UserProfileResource','name','index','Pause','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','VIRTUAL'];(function(_0x15526e,_0x223176){var _0x2c2005=function(_0x236bb2){while(--_0x236bb2){_0x15526e['push'](_0x15526e['shift']());}};_0x2c2005(++_0x223176);}(_0xabc1,0x13e));var _0x1abc=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xabc1[_0x2641f9];return _0x585741;};'use strict';var emlformat=require(_0x1abc('0x0'));var rimraf=require(_0x1abc('0x1'));var zipdir=require(_0x1abc('0x2'));var jsonpatch=require(_0x1abc('0x3'));var rp=require(_0x1abc('0x4'));var moment=require(_0x1abc('0x5'));var BPromise=require(_0x1abc('0x6'));var Mustache=require(_0x1abc('0x7'));var util=require(_0x1abc('0x8'));var path=require('path');var sox=require(_0x1abc('0x9'));var csv=require(_0x1abc('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1abc('0xb'));var _=require(_0x1abc('0xc'));var squel=require('squel');var crypto=require(_0x1abc('0xd'));var jsforce=require(_0x1abc('0xe'));var deskjs=require(_0x1abc('0xf'));var toCsv=require(_0x1abc('0xa'));var querystring=require(_0x1abc('0x10'));var Papa=require(_0x1abc('0x11'));var Redis=require('ioredis');var authService=require(_0x1abc('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x1abc('0x13'));var hardwareService=require(_0x1abc('0x14'));var logger=require(_0x1abc('0x15'))(_0x1abc('0x16'));var utils=require(_0x1abc('0x17'));var config=require(_0x1abc('0x18'));var licenseUtil=require(_0x1abc('0x19'));var db=require(_0x1abc('0x1a'))['db'];config[_0x1abc('0x1b')]=_['defaults'](config[_0x1abc('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0x1abc('0x1c'))(new Redis(config['redis']));require(_0x1abc('0x1d'))[_0x1abc('0x1e')](socket);var jayson=require(_0x1abc('0x1f'));var client=jayson[_0x1abc('0x20')]['http']({'port':0x232c});function respondWithRpcPromise(_0x200679,_0x1da77e,_0x3cf25d,_0x25ef18){return new BPromise(function(_0x2de5f3,_0x1fe950){var _0xd6736c=_0x25ef18||client;return _0xd6736c['request'](_0x200679,_0x3cf25d)['then'](function(_0xdc1ed7){logger[_0x1abc('0x21')](_0x1abc('0x22'),_0x1da77e,_0x1abc('0x23'));logger[_0x1abc('0x24')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x1da77e,_0x1abc('0x23'),JSON[_0x1abc('0x25')](_0xdc1ed7));if(_0xdc1ed7[_0x1abc('0x26')]){if(_0xdc1ed7[_0x1abc('0x26')][_0x1abc('0x27')]===0x1f4){logger[_0x1abc('0x26')]('WhatsappAccount,\x20%s,\x20%s',_0x1da77e,_0xdc1ed7[_0x1abc('0x26')][_0x1abc('0x28')]);return _0x1fe950(_0xdc1ed7[_0x1abc('0x26')]['message']);}logger[_0x1abc('0x26')](_0x1abc('0x22'),_0x1da77e,_0xdc1ed7['error']['message']);return _0x2de5f3(_0xdc1ed7[_0x1abc('0x26')][_0x1abc('0x28')]);}else{logger[_0x1abc('0x21')](_0x1abc('0x22'),_0x1da77e,_0x1abc('0x23'));_0x2de5f3(_0xdc1ed7[_0x1abc('0x29')][_0x1abc('0x28')]);}})['catch'](function(_0x3088e7){logger[_0x1abc('0x26')](_0x1abc('0x22'),_0x1da77e,_0x3088e7);_0x1fe950(_0x3088e7);});});}function respondWithStatusCode(_0x2ab40b,_0x4fe01e){_0x4fe01e=_0x4fe01e||0xcc;return function(_0x323d83){if(_0x323d83){return _0x2ab40b[_0x1abc('0x2a')](_0x4fe01e);}return _0x2ab40b['status'](_0x4fe01e)[_0x1abc('0x2b')]();};}function respondWithResult(_0x40b588,_0x3fb129){_0x3fb129=_0x3fb129||0xc8;return function(_0x4dc297){if(_0x4dc297){return _0x40b588[_0x1abc('0x2c')](_0x3fb129)[_0x1abc('0x2d')](_0x4dc297);}};}function respondWithFilteredResult(_0x179585,_0x1b5ea5){return function(_0x2c0bdd){if(_0x2c0bdd){var _0x1a105b=typeof _0x1b5ea5['offset']===_0x1abc('0x2e')&&typeof _0x1b5ea5[_0x1abc('0x2f')]===_0x1abc('0x2e');var _0x57f0a7=_0x2c0bdd[_0x1abc('0x30')];var _0x29328a=_0x1a105b?0x0:_0x1b5ea5[_0x1abc('0x31')];var _0x3d63ea=_0x1a105b?_0x2c0bdd[_0x1abc('0x30')]:_0x1b5ea5[_0x1abc('0x31')]+_0x1b5ea5[_0x1abc('0x2f')];var _0xcf3107;if(_0x3d63ea>=_0x57f0a7){_0x3d63ea=_0x57f0a7;_0xcf3107=0xc8;}else{_0xcf3107=0xce;}_0x179585['status'](_0xcf3107);return _0x179585[_0x1abc('0x32')](_0x1abc('0x33'),_0x29328a+'-'+_0x3d63ea+'/'+_0x57f0a7)[_0x1abc('0x2d')](_0x2c0bdd);}return null;};}function patchUpdates(_0x4b08be){return function(_0x562fa0){try{jsonpatch['apply'](_0x562fa0,_0x4b08be,!![]);}catch(_0x1af8fd){return BPromise['reject'](_0x1af8fd);}return _0x562fa0['save']();};}function saveUpdates(_0x464837,_0x415a25){return function(_0x252ce9){if(_0x252ce9){return _0x252ce9['update'](_0x464837)['then'](function(_0x6d32c8){return _0x6d32c8;});}return null;};}function removeEntity(_0x55c7ca,_0x318c40){return function(_0x514e9f){if(_0x514e9f){return _0x514e9f[_0x1abc('0x34')]()[_0x1abc('0x35')](function(){var _0x26ffc5=_0x514e9f[_0x1abc('0x36')]({'plain':!![]});var _0x4cf725='WhatsappAccounts';return db[_0x1abc('0x37')]['destroy']({'where':{'type':_0x4cf725,'resourceId':_0x26ffc5['id']}})[_0x1abc('0x35')](function(){return _0x514e9f;});})[_0x1abc('0x35')](function(){_0x55c7ca[_0x1abc('0x2c')](0xcc)[_0x1abc('0x2b')]();});}};}function handleEntityNotFound(_0x2c6ffa,_0x219ea3){return function(_0x13b32c){if(!_0x13b32c){_0x2c6ffa['sendStatus'](0x194);}return _0x13b32c;};}function handleError(_0x14dc41,_0x271f46){_0x271f46=_0x271f46||0x1f4;return function(_0x44062a){logger[_0x1abc('0x26')](_0x44062a['stack']);if(_0x44062a[_0x1abc('0x38')]){delete _0x44062a[_0x1abc('0x38')];}_0x14dc41[_0x1abc('0x2c')](_0x271f46)['send'](_0x44062a);};}exports[_0x1abc('0x39')]=function(_0x3e3398,_0x433cfb){var _0x597486={'include':[{'model':db[_0x1abc('0x3a')],'as':'mandatoryDispositionPause'}]},_0x5edc9e={},_0x187083={'count':0x0,'rows':[]};var _0x130884=_[_0x1abc('0x3b')](db['WhatsappAccount'][_0x1abc('0x3c')],function(_0x31a816){return{'name':_0x31a816[_0x1abc('0x3d')],'type':_0x31a816[_0x1abc('0x3e')][_0x1abc('0x3f')]};});_0x5edc9e[_0x1abc('0x40')]=_[_0x1abc('0x3b')](_0x130884,_0x1abc('0x38'));_0x5edc9e[_0x1abc('0x41')]=_[_0x1abc('0x42')](_0x3e3398[_0x1abc('0x41')]);_0x5edc9e[_0x1abc('0x43')]=_[_0x1abc('0x44')](_0x5edc9e['model'],_0x5edc9e[_0x1abc('0x41')]);_0x597486[_0x1abc('0x45')]=_[_0x1abc('0x44')](_0x5edc9e[_0x1abc('0x40')],qs['fields'](_0x3e3398[_0x1abc('0x41')][_0x1abc('0x46')]));_0x597486['attributes']=_0x597486[_0x1abc('0x45')]['length']?_0x597486[_0x1abc('0x45')]:_0x5edc9e[_0x1abc('0x40')];if(!_0x3e3398[_0x1abc('0x41')]['hasOwnProperty'](_0x1abc('0x47'))){_0x597486[_0x1abc('0x2f')]=qs[_0x1abc('0x2f')](_0x3e3398['query'][_0x1abc('0x2f')]);_0x597486[_0x1abc('0x31')]=qs[_0x1abc('0x31')](_0x3e3398[_0x1abc('0x41')]['offset']);}_0x597486[_0x1abc('0x48')]=qs[_0x1abc('0x49')](_0x3e3398[_0x1abc('0x41')]['sort']);_0x597486[_0x1abc('0x4a')]=qs[_0x1abc('0x43')](_['pick'](_0x3e3398['query'],_0x5edc9e[_0x1abc('0x43')]),_0x130884);if(_0x3e3398[_0x1abc('0x41')]['filter']){_0x597486[_0x1abc('0x4a')]=_['merge'](_0x597486[_0x1abc('0x4a')],{'$or':_['map'](_0x130884,function(_0xd96136){if(_0xd96136[_0x1abc('0x3e')]!==_0x1abc('0x4b')){var _0x223a26={};_0x223a26[_0xd96136[_0x1abc('0x38')]]={'$like':'%'+_0x3e3398[_0x1abc('0x41')][_0x1abc('0x4c')]+'%'};return _0x223a26;}})});}_0x597486=_[_0x1abc('0x4d')]({},_0x597486,_0x3e3398[_0x1abc('0x4e')]);var _0x39054d={'where':_0x597486[_0x1abc('0x4a')]};return db[_0x1abc('0x4f')][_0x1abc('0x30')](_0x39054d)[_0x1abc('0x35')](function(_0x41ea01){_0x187083[_0x1abc('0x30')]=_0x41ea01;if(_0x3e3398[_0x1abc('0x41')]['includeAll']){_0x597486[_0x1abc('0x50')]=[{'all':!![]}];}return db[_0x1abc('0x4f')]['findAll'](_0x597486);})['then'](function(_0xcfbccd){_0x187083['rows']=_0xcfbccd;return _0x187083;})[_0x1abc('0x35')](respondWithFilteredResult(_0x433cfb,_0x597486))[_0x1abc('0x51')](handleError(_0x433cfb,null));};exports['show']=function(_0x23e319,_0xff237d){var _0x5394ea={'raw':![],'where':{'id':_0x23e319[_0x1abc('0x52')]['id']},'include':[{'model':db[_0x1abc('0x3a')],'as':_0x1abc('0x53')}]},_0xf14738={};_0xf14738['model']=_[_0x1abc('0x42')](db[_0x1abc('0x4f')][_0x1abc('0x3c')]);_0xf14738['query']=_[_0x1abc('0x42')](_0x23e319[_0x1abc('0x41')]);_0xf14738[_0x1abc('0x43')]=_[_0x1abc('0x44')](_0xf14738[_0x1abc('0x40')],_0xf14738[_0x1abc('0x41')]);_0x5394ea[_0x1abc('0x45')]=_[_0x1abc('0x44')](_0xf14738[_0x1abc('0x40')],qs[_0x1abc('0x46')](_0x23e319[_0x1abc('0x41')][_0x1abc('0x46')]));_0x5394ea[_0x1abc('0x45')]=_0x5394ea[_0x1abc('0x45')][_0x1abc('0x54')]?_0x5394ea[_0x1abc('0x45')]:_0xf14738[_0x1abc('0x40')];if(_0x23e319[_0x1abc('0x41')][_0x1abc('0x55')]){_0x5394ea['include']=[{'all':!![]}];}_0x5394ea=_[_0x1abc('0x4d')]({},_0x5394ea,_0x23e319[_0x1abc('0x4e')]);return db['WhatsappAccount'][_0x1abc('0x56')](_0x5394ea)['then'](handleEntityNotFound(_0xff237d,null))[_0x1abc('0x35')](respondWithResult(_0xff237d,null))[_0x1abc('0x51')](handleError(_0xff237d,null));};exports[_0x1abc('0x57')]=function(_0x23c21e,_0x38108f){return db[_0x1abc('0x4f')][_0x1abc('0x57')](_0x23c21e[_0x1abc('0x58')],{})[_0x1abc('0x35')](function(_0x19cbae){var _0xd7b01a=_0x23c21e['user'][_0x1abc('0x36')]({'plain':!![]});if(!_0xd7b01a)throw new Error(_0x1abc('0x59'));if(_0xd7b01a[_0x1abc('0x5a')]===_0x1abc('0x5b')){var _0x43b17f=_0x19cbae['get']({'plain':!![]});var _0x2da371='WhatsappAccounts';return db[_0x1abc('0x5c')]['find']({'where':{'name':_0x2da371,'userProfileId':_0xd7b01a[_0x1abc('0x5d')]},'raw':!![]})[_0x1abc('0x35')](function(_0x4266b9){if(_0x4266b9&&_0x4266b9[_0x1abc('0x5e')]===0x0){return db[_0x1abc('0x37')][_0x1abc('0x57')]({'name':_0x43b17f[_0x1abc('0x38')],'resourceId':_0x43b17f['id'],'type':_0x4266b9[_0x1abc('0x38')],'sectionId':_0x4266b9['id']},{})[_0x1abc('0x35')](function(){return _0x19cbae;});}else{return _0x19cbae;}})[_0x1abc('0x51')](function(_0x357499){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x357499);throw _0x357499;});}return _0x19cbae;})[_0x1abc('0x35')](respondWithResult(_0x38108f,0xc9))[_0x1abc('0x51')](handleError(_0x38108f,null));};exports[_0x1abc('0x5f')]=function(_0x435840,_0x395aeb){if(_0x435840[_0x1abc('0x58')]['id']){delete _0x435840[_0x1abc('0x58')]['id'];}return db[_0x1abc('0x4f')]['find']({'where':{'id':_0x435840[_0x1abc('0x52')]['id']},'include':[{'model':db[_0x1abc('0x3a')],'as':_0x1abc('0x53')}]})[_0x1abc('0x35')](handleEntityNotFound(_0x395aeb,null))[_0x1abc('0x35')](saveUpdates(_0x435840['body'],null))['then'](respondWithResult(_0x395aeb,null))[_0x1abc('0x51')](handleError(_0x395aeb,null));};exports[_0x1abc('0x34')]=function(_0x55dce9,_0xa31bcc){return db['WhatsappAccount'][_0x1abc('0x56')]({'where':{'id':_0x55dce9[_0x1abc('0x52')]['id']}})[_0x1abc('0x35')](handleEntityNotFound(_0xa31bcc,null))[_0x1abc('0x35')](removeEntity(_0xa31bcc,null))[_0x1abc('0x51')](handleError(_0xa31bcc,null));};exports[_0x1abc('0x60')]=function(_0x4706c2,_0x127562){return db['WhatsappAccount'][_0x1abc('0x60')]()[_0x1abc('0x35')](respondWithResult(_0x127562,null))[_0x1abc('0x51')](handleError(_0x127562,null));};exports['addDisposition']=function(_0x5bf521,_0x22c951,_0x152491){if(_0x5bf521[_0x1abc('0x58')]['id']){delete _0x5bf521[_0x1abc('0x58')]['id'];}return db['WhatsappAccount'][_0x1abc('0x56')]({'where':{'id':_0x5bf521[_0x1abc('0x52')]['id']}})['then'](handleEntityNotFound(_0x22c951,null))[_0x1abc('0x35')](function(_0x16861e){if(_0x16861e){_0x5bf521['body'][_0x1abc('0x61')]=_0x16861e['id'];return db[_0x1abc('0x62')][_0x1abc('0x57')](_0x5bf521['body']);}})['then'](respondWithResult(_0x22c951,null))[_0x1abc('0x51')](handleError(_0x22c951,null));};exports[_0x1abc('0x63')]=function(_0x3477f1,_0x171e4a,_0x20808b){var _0x2c1011={'raw':![],'where':{}};var _0x4c0256={};var _0x42b466={'count':0x0,'rows':[]};return db[_0x1abc('0x4f')][_0x1abc('0x64')]({'where':{'id':_0x3477f1[_0x1abc('0x52')]['id']}})['then'](handleEntityNotFound(_0x171e4a,null))['then'](function(_0x421505){if(_0x421505){_0x4c0256[_0x1abc('0x40')]=_[_0x1abc('0x42')](db[_0x1abc('0x62')][_0x1abc('0x3c')]);_0x4c0256[_0x1abc('0x41')]=_[_0x1abc('0x42')](_0x3477f1['query']);_0x4c0256[_0x1abc('0x43')]=_['intersection'](_0x4c0256['model'],_0x4c0256[_0x1abc('0x41')]);_0x2c1011[_0x1abc('0x45')]=_[_0x1abc('0x44')](_0x4c0256[_0x1abc('0x40')],qs[_0x1abc('0x46')](_0x3477f1[_0x1abc('0x41')][_0x1abc('0x46')]));_0x2c1011[_0x1abc('0x45')]=_0x2c1011[_0x1abc('0x45')][_0x1abc('0x54')]?_0x2c1011[_0x1abc('0x45')]:_0x4c0256[_0x1abc('0x40')];if(!_0x3477f1[_0x1abc('0x41')][_0x1abc('0x65')](_0x1abc('0x47'))){_0x2c1011[_0x1abc('0x2f')]=qs['limit'](_0x3477f1[_0x1abc('0x41')][_0x1abc('0x2f')]);_0x2c1011[_0x1abc('0x31')]=qs[_0x1abc('0x31')](_0x3477f1['query'][_0x1abc('0x31')]);}_0x2c1011[_0x1abc('0x48')]=qs[_0x1abc('0x49')](_0x3477f1[_0x1abc('0x41')]['sort']);_0x2c1011[_0x1abc('0x4a')]=qs[_0x1abc('0x43')](_[_0x1abc('0x66')](_0x3477f1['query'],_0x4c0256[_0x1abc('0x43')]));_0x2c1011[_0x1abc('0x4a')][_0x1abc('0x61')]=_0x421505['id'];if(_0x3477f1[_0x1abc('0x41')][_0x1abc('0x4c')]){_0x2c1011[_0x1abc('0x4a')]=_[_0x1abc('0x4d')](_0x2c1011[_0x1abc('0x4a')],{'$or':_[_0x1abc('0x3b')](_0x2c1011[_0x1abc('0x45')],function(_0x4a3a4e){var _0x44fe09={};_0x44fe09[_0x4a3a4e]={'$like':'%'+_0x3477f1[_0x1abc('0x41')][_0x1abc('0x4c')]+'%'};return _0x44fe09;})});}_0x2c1011=_[_0x1abc('0x4d')]({},_0x2c1011,_0x3477f1[_0x1abc('0x4e')]);return db[_0x1abc('0x62')][_0x1abc('0x30')]({'where':_0x2c1011[_0x1abc('0x4a')]})[_0x1abc('0x35')](function(_0x2ddfb6){_0x42b466[_0x1abc('0x30')]=_0x2ddfb6;if(_0x3477f1[_0x1abc('0x41')][_0x1abc('0x55')]){_0x2c1011[_0x1abc('0x50')]=[{'all':!![]}];}return db[_0x1abc('0x62')][_0x1abc('0x67')](_0x2c1011);})[_0x1abc('0x35')](function(_0x4f36aa){_0x42b466['rows']=_0x4f36aa;return _0x42b466;});}})[_0x1abc('0x35')](respondWithFilteredResult(_0x171e4a,_0x2c1011))['catch'](handleError(_0x171e4a,null));};exports[_0x1abc('0x68')]=function(_0x59ce35,_0x3d9dd2,_0x43c883){return db[_0x1abc('0x4f')][_0x1abc('0x56')]({'where':{'id':_0x59ce35[_0x1abc('0x52')]['id']}})['then'](handleEntityNotFound(_0x3d9dd2,null))[_0x1abc('0x35')](function(_0x556c4a){if(_0x556c4a){return _0x556c4a[_0x1abc('0x68')](_0x59ce35[_0x1abc('0x41')][_0x1abc('0x69')]);}})[_0x1abc('0x35')](respondWithStatusCode(_0x3d9dd2,null))[_0x1abc('0x51')](handleError(_0x3d9dd2,null));};exports[_0x1abc('0x6a')]=function(_0x58bd14,_0x5a2e97,_0x22b046){if(_0x58bd14[_0x1abc('0x58')]['id']){delete _0x58bd14[_0x1abc('0x58')]['id'];}return db[_0x1abc('0x4f')][_0x1abc('0x56')]({'where':{'id':_0x58bd14[_0x1abc('0x52')]['id']}})['then'](handleEntityNotFound(_0x5a2e97,null))[_0x1abc('0x35')](function(_0x51e525){if(_0x51e525){_0x58bd14[_0x1abc('0x58')]['WhatsappAccountId']=_0x51e525['id'];return db[_0x1abc('0x6b')][_0x1abc('0x57')](_0x58bd14[_0x1abc('0x58')]);}})[_0x1abc('0x35')](respondWithResult(_0x5a2e97,null))[_0x1abc('0x51')](handleError(_0x5a2e97,null));};exports[_0x1abc('0x6c')]=function(_0x16719f,_0x1dbc8b,_0x5cd536){var _0x4f079b={'raw':![],'where':{}};var _0x411f0a={};var _0x499086={'count':0x0,'rows':[]};return db[_0x1abc('0x4f')][_0x1abc('0x64')]({'where':{'id':_0x16719f[_0x1abc('0x52')]['id']}})['then'](handleEntityNotFound(_0x1dbc8b,null))[_0x1abc('0x35')](function(_0x55b5a9){if(_0x55b5a9){_0x411f0a['model']=_['keys'](db[_0x1abc('0x6b')][_0x1abc('0x3c')]);_0x411f0a['query']=_[_0x1abc('0x42')](_0x16719f['query']);_0x411f0a['filters']=_[_0x1abc('0x44')](_0x411f0a[_0x1abc('0x40')],_0x411f0a[_0x1abc('0x41')]);_0x4f079b['attributes']=_[_0x1abc('0x44')](_0x411f0a[_0x1abc('0x40')],qs[_0x1abc('0x46')](_0x16719f[_0x1abc('0x41')][_0x1abc('0x46')]));_0x4f079b[_0x1abc('0x45')]=_0x4f079b[_0x1abc('0x45')][_0x1abc('0x54')]?_0x4f079b[_0x1abc('0x45')]:_0x411f0a[_0x1abc('0x40')];if(!_0x16719f[_0x1abc('0x41')]['hasOwnProperty'](_0x1abc('0x47'))){_0x4f079b[_0x1abc('0x2f')]=qs[_0x1abc('0x2f')](_0x16719f[_0x1abc('0x41')][_0x1abc('0x2f')]);_0x4f079b[_0x1abc('0x31')]=qs['offset'](_0x16719f[_0x1abc('0x41')][_0x1abc('0x31')]);}_0x4f079b[_0x1abc('0x48')]=qs['sort'](_0x16719f['query'][_0x1abc('0x49')]);_0x4f079b[_0x1abc('0x4a')]=qs[_0x1abc('0x43')](_[_0x1abc('0x66')](_0x16719f[_0x1abc('0x41')],_0x411f0a[_0x1abc('0x43')]));_0x4f079b['where']['WhatsappAccountId']=_0x55b5a9['id'];if(_0x16719f['query']['filter']){_0x4f079b[_0x1abc('0x4a')]=_[_0x1abc('0x4d')](_0x4f079b[_0x1abc('0x4a')],{'$or':_['map'](_0x4f079b[_0x1abc('0x45')],function(_0x592961){var _0x1f8572={};_0x1f8572[_0x592961]={'$like':'%'+_0x16719f[_0x1abc('0x41')][_0x1abc('0x4c')]+'%'};return _0x1f8572;})});}_0x4f079b=_[_0x1abc('0x4d')]({},_0x4f079b,_0x16719f[_0x1abc('0x4e')]);return db[_0x1abc('0x6b')][_0x1abc('0x30')]({'where':_0x4f079b[_0x1abc('0x4a')]})[_0x1abc('0x35')](function(_0x304892){_0x499086['count']=_0x304892;if(_0x16719f[_0x1abc('0x41')][_0x1abc('0x55')]){_0x4f079b['include']=[{'all':!![]}];}return db[_0x1abc('0x6b')][_0x1abc('0x67')](_0x4f079b);})[_0x1abc('0x35')](function(_0x3b4c47){_0x499086[_0x1abc('0x6d')]=_0x3b4c47;return _0x499086;});}})[_0x1abc('0x35')](respondWithFilteredResult(_0x1dbc8b,_0x4f079b))[_0x1abc('0x51')](handleError(_0x1dbc8b,null));};exports[_0x1abc('0x6e')]=function(_0x54f60f,_0x5cb7d3,_0x78094a){return db[_0x1abc('0x4f')][_0x1abc('0x56')]({'where':{'id':_0x54f60f[_0x1abc('0x52')]['id']}})[_0x1abc('0x35')](handleEntityNotFound(_0x5cb7d3,null))[_0x1abc('0x35')](function(_0x4d4b96){if(_0x4d4b96){return _0x4d4b96[_0x1abc('0x6e')](_0x54f60f[_0x1abc('0x41')][_0x1abc('0x69')]);}})['then'](respondWithStatusCode(_0x5cb7d3,null))[_0x1abc('0x51')](handleError(_0x5cb7d3,null));};exports[_0x1abc('0x6f')]=function(_0x303fa2,_0x29f2d7,_0x12bc16){return db[_0x1abc('0x4f')]['find']({'where':{'id':_0x303fa2['params']['id']}})['then'](handleEntityNotFound(_0x29f2d7,null))[_0x1abc('0x35')](function(_0x489c0f){if(_0x489c0f){return _0x489c0f[_0x1abc('0x6f')](_0x303fa2['body'][_0x1abc('0x69')],_[_0x1abc('0x70')](_0x303fa2[_0x1abc('0x58')],[_0x1abc('0x69'),'id'])||{})['spread'](function(_0x2bdfd6){for(var _0x4dbbed=0x0;_0x4dbbed<_0x303fa2[_0x1abc('0x58')][_0x1abc('0x69')][_0x1abc('0x54')];_0x4dbbed+=0x1){socket[_0x1abc('0x71')](_0x1abc('0x72'),{'UserId':Number(_0x303fa2[_0x1abc('0x58')]['ids'][_0x4dbbed]),'WhatsappAccountId':Number(_0x303fa2['params']['id'])});}return _0x2bdfd6;});}})['then'](respondWithResult(_0x29f2d7,null))[_0x1abc('0x51')](handleError(_0x29f2d7,null));};exports[_0x1abc('0x73')]=function(_0x24aa40,_0x1977aa,_0x2a7122){return db[_0x1abc('0x4f')][_0x1abc('0x56')]({'where':{'id':_0x24aa40[_0x1abc('0x52')]['id']}})[_0x1abc('0x35')](handleEntityNotFound(_0x1977aa,null))['then'](function(_0x4c8bfa){if(_0x4c8bfa){return _0x4c8bfa[_0x1abc('0x73')](_0x24aa40[_0x1abc('0x41')][_0x1abc('0x69')])[_0x1abc('0x35')](function(){if(_['isArray'](_0x24aa40[_0x1abc('0x41')][_0x1abc('0x69')])){for(var _0x1a2c1f=0x0;_0x1a2c1f<_0x24aa40[_0x1abc('0x41')][_0x1abc('0x69')]['length'];_0x1a2c1f+=0x1){socket[_0x1abc('0x71')](_0x1abc('0x74'),{'UserId':Number(_0x24aa40[_0x1abc('0x41')][_0x1abc('0x69')][_0x1a2c1f]),'WhatsappAccountId':Number(_0x24aa40[_0x1abc('0x52')]['id'])});}}else{socket[_0x1abc('0x71')](_0x1abc('0x74'),{'UserId':Number(_0x24aa40[_0x1abc('0x41')][_0x1abc('0x69')]),'WhatsappAccountId':Number(_0x24aa40['params']['id'])});}});}})[_0x1abc('0x35')](respondWithStatusCode(_0x1977aa,null))['catch'](handleError(_0x1977aa,null));};exports[_0x1abc('0x75')]=function(_0x19751e,_0x3f3288,_0x8041d8){var _0x183e7e={};var _0x2b6916={};var _0x596e99;var _0x48685f;return db[_0x1abc('0x4f')]['findOne']({'where':{'id':_0x19751e[_0x1abc('0x52')]['id']}})[_0x1abc('0x35')](handleEntityNotFound(_0x3f3288,null))['then'](function(_0x4446eb){if(_0x4446eb){_0x596e99=_0x4446eb;_0x2b6916[_0x1abc('0x40')]=_[_0x1abc('0x42')](db[_0x1abc('0x76')][_0x1abc('0x3c')]);_0x2b6916[_0x1abc('0x41')]=_['keys'](_0x19751e['query']);_0x2b6916['filters']=_['intersection'](_0x2b6916[_0x1abc('0x40')],_0x2b6916[_0x1abc('0x41')]);_0x183e7e['attributes']=_['intersection'](_0x2b6916['model'],qs[_0x1abc('0x46')](_0x19751e['query'][_0x1abc('0x46')]));_0x183e7e[_0x1abc('0x45')]=_0x183e7e['attributes'][_0x1abc('0x54')]?_0x183e7e[_0x1abc('0x45')]:_0x2b6916['model'];_0x183e7e[_0x1abc('0x48')]=qs[_0x1abc('0x49')](_0x19751e[_0x1abc('0x41')][_0x1abc('0x49')]);_0x183e7e[_0x1abc('0x4a')]=qs[_0x1abc('0x43')](_[_0x1abc('0x66')](_0x19751e['query'],_0x2b6916[_0x1abc('0x43')]));if(_0x19751e[_0x1abc('0x41')][_0x1abc('0x4c')]){_0x183e7e['where']=_[_0x1abc('0x4d')](_0x183e7e[_0x1abc('0x4a')],{'$or':_[_0x1abc('0x3b')](_0x183e7e[_0x1abc('0x45')],function(_0x32b4db){var _0x258556={};_0x258556[_0x32b4db]={'$like':'%'+_0x19751e[_0x1abc('0x41')][_0x1abc('0x4c')]+'%'};return _0x258556;})});}_0x183e7e=_[_0x1abc('0x4d')]({},_0x183e7e,_0x19751e['options']);return _0x596e99[_0x1abc('0x75')](_0x183e7e);}})['then'](function(_0x28b5a8){if(_0x28b5a8){_0x48685f=_0x28b5a8[_0x1abc('0x54')];if(!_0x19751e['query'][_0x1abc('0x65')]('nolimit')){_0x183e7e[_0x1abc('0x2f')]=qs[_0x1abc('0x2f')](_0x19751e[_0x1abc('0x41')]['limit']);_0x183e7e[_0x1abc('0x31')]=qs[_0x1abc('0x31')](_0x19751e[_0x1abc('0x41')][_0x1abc('0x31')]);}return _0x596e99[_0x1abc('0x75')](_0x183e7e);}})[_0x1abc('0x35')](function(_0x4ba44b){if(_0x4ba44b){return _0x4ba44b?{'count':_0x48685f,'rows':_0x4ba44b}:null;}})['then'](respondWithResult(_0x3f3288,null))[_0x1abc('0x51')](handleError(_0x3f3288,null));};exports[_0x1abc('0x77')]=function(_0x223407,_0x378a2e){var _0x1abe88=_0x223407[_0x1abc('0x52')]['id'];var _0x2d8a5f=_0x223407[_0x1abc('0x58')];var _0x1c6448=0xc8;var _0x41588d=null;return db['sequelize'][_0x1abc('0x78')]({'isolationLevel':db[_0x1abc('0x79')]['Transaction'][_0x1abc('0x7a')][_0x1abc('0x7b')]},function(_0xe6df2){return db[_0x1abc('0x4f')]['findOne']({'where':{'id':_0x1abe88},'transaction':_0xe6df2})[_0x1abc('0x35')](function(_0x3ae8ef){if(_0x3ae8ef){return db[_0x1abc('0x7c')][_0x1abc('0x34')]({'where':{'WhatsappAccountId':_0x1abe88},'transaction':_0xe6df2})[_0x1abc('0x35')](function(){var _0x3707e0=_[_0x1abc('0x3b')](_0x2d8a5f,function(_0x45a633){_0x45a633[_0x1abc('0x61')]=_0x1abe88;return _0x45a633;});return db[_0x1abc('0x7c')]['bulkCreate'](_0x3707e0,{'transaction':_0xe6df2});});}else{_0x1c6448=0x194;_0x41588d=[];}});})[_0x1abc('0x35')](function(){if(_0x1c6448!==0x194){return db[_0x1abc('0x7c')][_0x1abc('0x7d')]({'where':{'WhatsappAccountId':_0x1abe88},'order':_0x1abc('0x7e')})[_0x1abc('0x35')](function(_0x1596d8){_0x41588d=_0x1596d8;});}})[_0x1abc('0x51')](function(_0x4c0417){_0x1c6448=0x1f4;logger[_0x1abc('0x26')](_0x4c0417['stack']);if(_0x4c0417['name']){delete _0x4c0417[_0x1abc('0x38')];}_0x41588d=_0x4c0417;})[_0x1abc('0x7f')](function(){if(_0x41588d===null){_0x378a2e['sendStatus'](_0x1c6448);}else{if(_0x1c6448===0x1f4){_0x378a2e['status'](_0x1c6448)[_0x1abc('0x80')](_0x41588d);}else{_0x378a2e['status'](_0x1c6448)['json'](_0x41588d);}}});};exports[_0x1abc('0x81')]=function(_0x60726e,_0x50e39d,_0x23d033){var _0x2e9543={};var _0x258b14={};var _0x3f3435;var _0x165e41;return db[_0x1abc('0x4f')]['findOne']({'where':{'id':_0x60726e[_0x1abc('0x52')]['id']}})[_0x1abc('0x35')](handleEntityNotFound(_0x50e39d,null))[_0x1abc('0x35')](function(_0xd421fd){if(_0xd421fd){_0x3f3435=_0xd421fd;_0x258b14[_0x1abc('0x40')]=_[_0x1abc('0x42')](db[_0x1abc('0x7c')][_0x1abc('0x3c')]);_0x258b14[_0x1abc('0x41')]=_[_0x1abc('0x42')](_0x60726e[_0x1abc('0x41')]);_0x258b14[_0x1abc('0x43')]=_[_0x1abc('0x44')](_0x258b14[_0x1abc('0x40')],_0x258b14[_0x1abc('0x41')]);_0x2e9543[_0x1abc('0x45')]=_['intersection'](_0x258b14[_0x1abc('0x40')],qs[_0x1abc('0x46')](_0x60726e[_0x1abc('0x41')][_0x1abc('0x46')]));_0x2e9543[_0x1abc('0x45')]=_0x2e9543['attributes'][_0x1abc('0x54')]?_0x2e9543[_0x1abc('0x45')]:_0x258b14[_0x1abc('0x40')];_0x2e9543[_0x1abc('0x48')]=qs[_0x1abc('0x49')](_0x60726e[_0x1abc('0x41')][_0x1abc('0x49')]);_0x2e9543[_0x1abc('0x4a')]=qs[_0x1abc('0x43')](_['pick'](_0x60726e['query'],_0x258b14[_0x1abc('0x43')]));if(_0x60726e['query'][_0x1abc('0x4c')]){_0x2e9543[_0x1abc('0x4a')]=_[_0x1abc('0x4d')](_0x2e9543[_0x1abc('0x4a')],{'$or':_[_0x1abc('0x3b')](_0x2e9543[_0x1abc('0x45')],function(_0x11cddc){var _0x1d39c9={};_0x1d39c9[_0x11cddc]={'$like':'%'+_0x60726e['query'][_0x1abc('0x4c')]+'%'};return _0x1d39c9;})});}_0x2e9543=_[_0x1abc('0x4d')]({},_0x2e9543,_0x60726e[_0x1abc('0x4e')]);return _0x3f3435[_0x1abc('0x81')](_0x2e9543);}})[_0x1abc('0x35')](function(_0x134540){if(_0x134540){_0x165e41=_0x134540['length'];if(!_0x60726e[_0x1abc('0x41')][_0x1abc('0x65')]('nolimit')){_0x2e9543[_0x1abc('0x2f')]=qs[_0x1abc('0x2f')](_0x60726e[_0x1abc('0x41')][_0x1abc('0x2f')]);_0x2e9543[_0x1abc('0x31')]=qs[_0x1abc('0x31')](_0x60726e['query'][_0x1abc('0x31')]);}return _0x3f3435[_0x1abc('0x81')](_0x2e9543);}})[_0x1abc('0x35')](function(_0x3312bf){if(_0x3312bf){return _0x3312bf?{'count':_0x165e41,'rows':_0x3312bf}:null;}})['then'](respondWithResult(_0x50e39d,null))[_0x1abc('0x51')](handleError(_0x50e39d,null));};exports[_0x1abc('0x82')]=function(_0x2ffe48,_0x46f956,_0x27865d){var _0x165610={'channel':_0x1abc('0x83')};var _0xe9db25=[];var _0x32789b=[];var _0x15f11b={};return db['WhatsappAccount'][_0x1abc('0x56')]({'where':{'id':_0x2ffe48['params']['id']},'include':[{'model':db['WhatsappApplication'],'as':_0x1abc('0x84')}]})['then'](handleEntityNotFound(_0x46f956,null))['then'](function(_0x511236){_0x165610['account']=_0x511236;if(_0x165610[_0x1abc('0x85')]&&_0x165610[_0x1abc('0x85')]['type']===_0x1abc('0x86')&&_0x2ffe48[_0x1abc('0x58')][_0x1abc('0x87')]){if(_0x2ffe48['body']['statuses'][_0x1abc('0x54')]===0x0)return;if(_0x2ffe48[_0x1abc('0x58')][_0x1abc('0x87')][0x0][_0x1abc('0x88')]!==_0x1abc('0x89'))return;return db[_0x1abc('0x8a')][_0x1abc('0x5f')]({'read':!![],'readAt':_0x2ffe48[_0x1abc('0x58')][_0x1abc('0x87')][0x0][_0x1abc('0x8b')]},{'where':{'messageId':_0x2ffe48[_0x1abc('0x58')][_0x1abc('0x87')][0x0]['message_id']},'individualHooks':!![]})[_0x1abc('0x35')](function(_0x1e689b){return _0x46f956[_0x1abc('0x2c')](0xc8)['json'](_0x1e689b);});}_0x165610[_0x1abc('0x8c')]=_[_0x1abc('0x8d')](_0x511236[_0x1abc('0x84')],['priority'],[_0x1abc('0x8e')]);if(_0x165610[_0x1abc('0x85')]['Applications']){delete _0x165610['account'][_0x1abc('0x84')];}return db[_0x1abc('0x8f')][_0x1abc('0x60')]()[_0x1abc('0x35')](function(_0xdf621b){if(!_0xdf621b){throw new db[(_0x1abc('0x90'))][(_0x1abc('0x91'))]('no\x20available\x20attributes');}_0xe9db25=_[_0x1abc('0x92')](_['keys'](_0xdf621b),[_0x1abc('0x93'),_0x1abc('0x94')]);_0x32789b=_[_0x1abc('0x92')](_[_0x1abc('0x42')](_0xdf621b),[_0x1abc('0x93'),_0x1abc('0x94'),_0x1abc('0x95'),_0x1abc('0x96')]);_0x165610[_0x1abc('0x58')]={'mapKey':_0x1abc('0x97')};if(_0x165610[_0x1abc('0x85')]&&_0x165610[_0x1abc('0x85')][_0x1abc('0x3e')]==='twilio'){_0x165610[_0x1abc('0x58')][_0x1abc('0x98')]=_0x2ffe48[_0x1abc('0x58')]['From']['replace'](_0x1abc('0x99'),'');_0x165610[_0x1abc('0x58')][_0x1abc('0x58')]=_0x2ffe48[_0x1abc('0x58')][_0x1abc('0x9a')];_0x165610[_0x1abc('0x58')][_0x1abc('0x9b')]=_0x2ffe48[_0x1abc('0x58')][_0x1abc('0x9c')];}if(_0x165610['account']&&_0x165610['account'][_0x1abc('0x3e')]===_0x1abc('0x86')){_0x165610[_0x1abc('0x58')][_0x1abc('0x98')]=_0x2ffe48['body'][_0x1abc('0x9d')][0x0][_0x1abc('0x98')];_0x165610[_0x1abc('0x58')][_0x1abc('0x58')]=_0x2ffe48[_0x1abc('0x58')][_0x1abc('0x9d')][0x0][_0x1abc('0x28')][_0x1abc('0x58')];_0x165610[_0x1abc('0x58')]['messageId']=_0x2ffe48[_0x1abc('0x58')][_0x1abc('0x9d')][0x0][_0x1abc('0x9e')];}if(_0x165610[_0x1abc('0x58')]['id']){delete _0x165610['body']['id'];}if(_[_0x1abc('0x9f')](_0x165610[_0x1abc('0x58')][_0x1abc('0x98')])){throw new db[(_0x1abc('0x90'))][(_0x1abc('0x91'))](_0x1abc('0xa0'));}if(_[_0x1abc('0x9f')](_0x165610[_0x1abc('0x58')][_0x1abc('0x58')])||_0x165610[_0x1abc('0x58')][_0x1abc('0x58')]===''){throw new db[(_0x1abc('0x90'))][(_0x1abc('0x91'))](_0x1abc('0xa1'));}if(_[_0x1abc('0x9f')](_0x165610[_0x1abc('0x58')][_0x1abc('0xa2')])){throw new db[(_0x1abc('0x90'))][(_0x1abc('0x91'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x32789b);}if(!_[_0x1abc('0xa3')](_0x32789b,_0x165610[_0x1abc('0x58')][_0x1abc('0xa2')])){throw new db['Sequelize'][(_0x1abc('0x91'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x32789b);}_0x15f11b[_0x165610[_0x1abc('0x58')]['mapKey']]=_0x165610[_0x1abc('0x58')]['from'];return db['CmList'][_0x1abc('0x56')]({'where':{'id':_0x165610[_0x1abc('0x85')]['ListId']},'include':[{'model':db[_0x1abc('0x8f')],'as':_0x1abc('0xa4'),'where':_0x15f11b,'limit':0x1,'order':[[_0x1abc('0x94'),'DESC']]}]});})['then'](handleEntityNotFound(_0x46f956,null))[_0x1abc('0x35')](function(_0xe5233){if(_0xe5233){_0x165610[_0x1abc('0xa5')]=_[_0x1abc('0x70')](_0xe5233,[_0x1abc('0xa4')]);if(_0xe5233[_0x1abc('0xa4')][_0x1abc('0x54')]){return _0xe5233['Contacts'][0x0];}var _0x3e2bcc=_[_0x1abc('0xa6')](_0x165610[_0x1abc('0x58')],{'firstName':_0x165610[_0x1abc('0x58')][_0x1abc('0x98')],'ListId':_0xe5233['id']});_0x3e2bcc[_0x165610[_0x1abc('0x58')][_0x1abc('0xa2')]]=_0x165610['body'][_0x1abc('0x98')];return db[_0x1abc('0x8f')][_0x1abc('0x57')](_0x3e2bcc,{'fields':_0xe9db25,'raw':!![]});}})[_0x1abc('0x35')](handleEntityNotFound(_0x46f956,null))[_0x1abc('0x35')](function(_0x537ece){if(_0x537ece){_0x165610[_0x1abc('0xa7')]=_0x537ece;var _0x574950={'ContactId':_0x537ece['id'],'phone':_0x165610['body'][_0x1abc('0x98')],'WhatsappAccountId':_0x2ffe48['params']['id']};var _0x448072={'ContactId':_0x537ece['id'],'WhatsappAccountId':_0x2ffe48[_0x1abc('0x52')]['id'],'closed':![]};return db[_0x1abc('0xa8')][_0x1abc('0x56')]({'where':_0x448072})[_0x1abc('0x35')](function(_0x5c0fe5){if(_0x5c0fe5){return[_0x5c0fe5,![]];}return db[_0x1abc('0xa8')][_0x1abc('0x57')](_0x574950)['then'](function(_0x5ae193){return[_0x5ae193,!![]];});});}})['spread'](function(_0x4ca5b8,_0x255908){_0x165610[_0x1abc('0xa9')]=_0x4ca5b8[_0x1abc('0x36')]({'plain':!![]});_0x165610['interaction']['created']=![];if(_0x255908){if(_0x165610[_0x1abc('0x85')][_0x1abc('0xaa')]){_0x165610[_0x1abc('0x8c')]['push']({'id':0x0,'priority':_0x165610[_0x1abc('0x8c')]['length']+0x1,'app':_0x1abc('0xab'),'appdata':_0x1abc('0xac'),'interval':_0x1abc('0xad')});}_0x165610['interaction'][_0x1abc('0xae')]=!![];}return db[_0x1abc('0x8a')][_0x1abc('0x57')]({'phone':_0x165610[_0x1abc('0x58')][_0x1abc('0x98')],'messageId':_0x165610[_0x1abc('0x58')][_0x1abc('0x9b')],'body':_0x165610[_0x1abc('0x58')][_0x1abc('0x58')],'WhatsappAccountId':_0x2ffe48[_0x1abc('0x52')]['id'],'WhatsappInteractionId':_0x4ca5b8['id'],'direction':'in','ContactId':_0x4ca5b8[_0x1abc('0xaf')],'AttachmentId':_0x165610[_0x1abc('0x58')]['AttachmentId']});})['then'](function(_0x315088){_0x165610['message']=_0x315088;if(!_0x165610[_0x1abc('0xa9')][_0x1abc('0xb0')])return;return db['User'][_0x1abc('0x56')]({'attributes':['id',_0x1abc('0x38')],'where':{'id':_0x165610[_0x1abc('0xa9')][_0x1abc('0xb0')]}});})[_0x1abc('0x35')](function(_0x2ecfc7){if(_0x2ecfc7){_0x165610[_0x1abc('0x8c')][_0x1abc('0xb1')]({'id':0x0,'priority':0x0,'app':_0x1abc('0xb2'),'appdata':_0x2ecfc7['name']+','+(_0x165610[_0x1abc('0x85')][_0x1abc('0xb3')]||0xa),'interval':_0x1abc('0xad')});}if(!_0x165610['interaction'][_0x1abc('0xb4')])return;return db[_0x1abc('0xb5')][_0x1abc('0x56')]({'attributes':['id','name'],'where':{'id':_0x165610['interaction']['queueId']}});})[_0x1abc('0x35')](function(_0x14034f){if(_0x14034f){_0x165610[_0x1abc('0x8c')][_0x1abc('0xb1')]({'id':0x0,'priority':0x1,'app':_0x1abc('0xb6'),'appdata':_0x14034f['name']+','+(_0x165610[_0x1abc('0x85')]['waitForTheAssignedQueue']||0x12c),'interval':_0x1abc('0xad')});}return respondWithRpcPromise('Start',_0x1abc('0xb7'),_0x165610);})[_0x1abc('0x35')](function(_0x3a0f27){if(_0x3a0f27){var _0x469d33=0xc8;var _0x2a2ab0='receiveMessage';logger['info'](_0x1abc('0xb8'),_0x2a2ab0,_0x469d33,_0x1abc('0xb9'));logger[_0x1abc('0x24')](_0x1abc('0xba'),_0x2a2ab0,_0x469d33,_0x1abc('0xb9'),JSON[_0x1abc('0x25')](_0x3a0f27));if(_0x165610[_0x1abc('0x85')][_0x1abc('0x3e')]===_0x1abc('0xbb')){return _0x46f956[_0x1abc('0x2c')](_0x469d33)[_0x1abc('0x32')]('Content-Type','text/xml')['send'](_0x1abc('0xbc'));}else{return _0x46f956[_0x1abc('0x2c')](_0x469d33)[_0x1abc('0x2d')](_0x3a0f27);}}});})[_0x1abc('0x51')](handleError(_0x46f956,null));};exports['send']=function(_0x4e9fe7,_0x1b94b2,_0xa4077){var _0x5b4534,_0x9dffc8,_0x5eb4ba;if(_[_0x1abc('0x9f')](_0x4e9fe7[_0x1abc('0x58')]['body'])||_0x4e9fe7[_0x1abc('0x58')][_0x1abc('0x58')]===''){throw new db['Sequelize'][(_0x1abc('0x91'))](_0x1abc('0xa1'));}if(_['isNil'](_0x4e9fe7[_0x1abc('0x58')]['to'])){throw new db[(_0x1abc('0x90'))][(_0x1abc('0x91'))](_0x1abc('0xbd'));}_0x5b4534=_0x4e9fe7[_0x1abc('0x58')]['to'];return db['WhatsappAccount'][_0x1abc('0x56')]({'where':{'id':_0x4e9fe7[_0x1abc('0x52')]['id']},'include':[{'model':db[_0x1abc('0xbe')],'as':_0x1abc('0xbf'),'include':[{'model':db[_0x1abc('0x8f')],'as':'Contacts','where':{'mobile':_0x5b4534},'limit':0x1,'order':[[_0x1abc('0x94'),_0x1abc('0xc0')]]}]}]})[_0x1abc('0x35')](handleEntityNotFound(_0x1b94b2,null))[_0x1abc('0x35')](function(_0x59f75d){if(_0x59f75d&&_0x59f75d[_0x1abc('0xbf')]){_0x9dffc8=_0x59f75d[_0x1abc('0x36')]({'plain':!![]});if(_0x9dffc8['List']&&_0x9dffc8[_0x1abc('0xbf')][_0x1abc('0xa4')]['length']){return _0x9dffc8[_0x1abc('0xbf')][_0x1abc('0xa4')][0x0];}return db[_0x1abc('0x8f')]['create'](_[_0x1abc('0xa6')](_0x4e9fe7['body'],{'firstName':_0x5b4534,'mobile':_0x5b4534,'phone':_0x5b4534,'ListId':_0x9dffc8[_0x1abc('0x96')]}));}})['then'](handleEntityNotFound(_0x1b94b2,null))[_0x1abc('0x35')](function(_0x567a8a){if(_0x567a8a){_0x5eb4ba=_0x567a8a;return db[_0x1abc('0xa8')][_0x1abc('0x56')]({'where':{'ContactId':_0x5eb4ba['id'],'closed':![],'WhatsappAccountId':_0x9dffc8['id']}})[_0x1abc('0x35')](function(_0x3cfec0){if(_0x3cfec0){return[_0x3cfec0,![]];}return db[_0x1abc('0xa8')][_0x1abc('0x57')]({'UserId':_0x4e9fe7['user']['id'],'ContactId':_0x5eb4ba['id'],'WhatsappAccountId':_0x9dffc8['id'],'phone':_0x5b4534,'firstMsgDirection':_0x1abc('0xc1'),'Messages':[_['merge'](_0x4e9fe7['body'],{'read':![],'body':_0x4e9fe7[_0x1abc('0x58')][_0x1abc('0x58')],'phone':_0x5b4534,'WhatsappAccountId':_0x9dffc8['id'],'UserId':_0x4e9fe7[_0x1abc('0x5b')]['id'],'ContactId':_0x5eb4ba['id']})]},{'include':[{'model':db[_0x1abc('0x8a')],'as':'Messages'}]})[_0x1abc('0x35')](function(_0x41b545){return[_0x41b545,!![]];});});}})['spread'](function(_0x167e4c,_0x316b60){if(_0x316b60){return _0x167e4c;}return db[_0x1abc('0x8a')][_0x1abc('0x57')](_[_0x1abc('0x4d')](_0x4e9fe7[_0x1abc('0x58')],{'read':![],'body':_0x4e9fe7[_0x1abc('0x58')]['body'],'phone':_0x5b4534,'WhatsappAccountId':_0x9dffc8['id'],'WhatsappInteractionId':_0x167e4c['id'],'UserId':_0x4e9fe7[_0x1abc('0x5b')]['id'],'ContactId':_0x5eb4ba['id']}))[_0x1abc('0x35')](function(_0x527852){_0x167e4c[_0x1abc('0xc2')][_0x1abc('0xc3')]=[];_0x167e4c[_0x1abc('0xc2')][_0x1abc('0xc3')][_0x1abc('0xc4')](_0x527852[_0x1abc('0xc2')]);return _0x167e4c;});})[_0x1abc('0x35')](respondWithResult(_0x1b94b2,null))[_0x1abc('0x51')](handleError(_0x1b94b2,null));}; \ No newline at end of file +var _0xd325=['unshift','queueId','startRouting','receiveMessage','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','text/xml','\x0a','to\x20is\x20mandatory','List','out','dataValues','Messages','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','register','jayson/promise','client','request','then','info','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','update','destroy','get','WhatsappAccounts','UserProfileResource','stack','name','send','Pause','mandatoryDispositionPause','map','WhatsappAccount','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','nolimit','order','sort','pick','where','type','merge','includeAll','rows','show','params','length','include','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','WhatsappAccountId','findOne','fields','hasOwnProperty','filter','Disposition','findAll','removeDispositions','ids','CannedAnswer','getAnswers','removeAnswers','addAgents','omit','spread','emit','userWhatsappAccount:save','isArray','userWhatsappAccount:remove','getAgents','User','addApplications','transaction','Transaction','WhatsappApplication','bulkCreate','findAndCountAll','finally','getApplications','notify','whatsapp','account','statuses','read','message_id','applications','orderBy','priority','asc','Applications','CmContact','Sequelize','ValidationError','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','from','From','replace','whatsapp:','Body','messageId','MessageSid','notifications','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','list','defaults','contact','WhatsappInteraction','interaction','created','autoclose','push','*,*,*,*','WhatsappMessage','ContactId','UserId'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0xd325,0x18d));var _0x5d32=function(_0x258fb0,_0x5362dc){_0x258fb0=_0x258fb0-0x0;var _0x4d1afe=_0xd325[_0x258fb0];return _0x4d1afe;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5d32('0x0'));var zipdir=require(_0x5d32('0x1'));var jsonpatch=require(_0x5d32('0x2'));var rp=require(_0x5d32('0x3'));var moment=require(_0x5d32('0x4'));var BPromise=require(_0x5d32('0x5'));var Mustache=require(_0x5d32('0x6'));var util=require(_0x5d32('0x7'));var path=require(_0x5d32('0x8'));var sox=require(_0x5d32('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5d32('0xa'));var _=require(_0x5d32('0xb'));var squel=require('squel');var crypto=require(_0x5d32('0xc'));var jsforce=require(_0x5d32('0xd'));var deskjs=require(_0x5d32('0xe'));var toCsv=require(_0x5d32('0xf'));var querystring=require('querystring');var Papa=require(_0x5d32('0x10'));var Redis=require(_0x5d32('0x11'));var authService=require(_0x5d32('0x12'));var qs=require(_0x5d32('0x13'));var as=require(_0x5d32('0x14'));var hardwareService=require(_0x5d32('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x5d32('0x16'));var config=require(_0x5d32('0x17'));var licenseUtil=require(_0x5d32('0x18'));var db=require('../../mysqldb')['db'];config[_0x5d32('0x19')]=_['defaults'](config[_0x5d32('0x19')],{'host':_0x5d32('0x1a'),'port':0x18eb});var socket=require(_0x5d32('0x1b'))(new Redis(config[_0x5d32('0x19')]));require('./whatsappAccount.socket')[_0x5d32('0x1c')](socket);var jayson=require(_0x5d32('0x1d'));var client=jayson[_0x5d32('0x1e')]['http']({'port':0x232c});function respondWithRpcPromise(_0x118d5c,_0x4214d2,_0x499c9a,_0x5be7c7){return new BPromise(function(_0x4b5a1f,_0x2a8f74){var _0x94c524=_0x5be7c7||client;return _0x94c524[_0x5d32('0x1f')](_0x118d5c,_0x499c9a)[_0x5d32('0x20')](function(_0x1e2212){logger[_0x5d32('0x21')]('WhatsappAccount,\x20%s,\x20%s',_0x4214d2,_0x5d32('0x22'));logger[_0x5d32('0x23')](_0x5d32('0x24'),_0x4214d2,_0x5d32('0x22'),JSON[_0x5d32('0x25')](_0x1e2212));if(_0x1e2212[_0x5d32('0x26')]){if(_0x1e2212['error'][_0x5d32('0x27')]===0x1f4){logger['error'](_0x5d32('0x28'),_0x4214d2,_0x1e2212[_0x5d32('0x26')]['message']);return _0x2a8f74(_0x1e2212[_0x5d32('0x26')][_0x5d32('0x29')]);}logger[_0x5d32('0x26')](_0x5d32('0x28'),_0x4214d2,_0x1e2212[_0x5d32('0x26')][_0x5d32('0x29')]);return _0x4b5a1f(_0x1e2212[_0x5d32('0x26')][_0x5d32('0x29')]);}else{logger[_0x5d32('0x21')]('WhatsappAccount,\x20%s,\x20%s',_0x4214d2,_0x5d32('0x22'));_0x4b5a1f(_0x1e2212[_0x5d32('0x2a')]['message']);}})[_0x5d32('0x2b')](function(_0x469e7d){logger[_0x5d32('0x26')](_0x5d32('0x28'),_0x4214d2,_0x469e7d);_0x2a8f74(_0x469e7d);});});}function respondWithStatusCode(_0x8fae0e,_0x39b71a){_0x39b71a=_0x39b71a||0xcc;return function(_0x4c142e){if(_0x4c142e){return _0x8fae0e[_0x5d32('0x2c')](_0x39b71a);}return _0x8fae0e[_0x5d32('0x2d')](_0x39b71a)[_0x5d32('0x2e')]();};}function respondWithResult(_0x3bc0a2,_0x1e6ad4){_0x1e6ad4=_0x1e6ad4||0xc8;return function(_0xd893a7){if(_0xd893a7){return _0x3bc0a2[_0x5d32('0x2d')](_0x1e6ad4)[_0x5d32('0x2f')](_0xd893a7);}};}function respondWithFilteredResult(_0x787fdc,_0x19aefb){return function(_0xfbf95d){if(_0xfbf95d){var _0x31d26c=typeof _0x19aefb[_0x5d32('0x30')]===_0x5d32('0x31')&&typeof _0x19aefb[_0x5d32('0x32')]===_0x5d32('0x31');var _0x21da87=_0xfbf95d['count'];var _0x53f62a=_0x31d26c?0x0:_0x19aefb[_0x5d32('0x30')];var _0x487396=_0x31d26c?_0xfbf95d[_0x5d32('0x33')]:_0x19aefb[_0x5d32('0x30')]+_0x19aefb[_0x5d32('0x32')];var _0x1e3e9a;if(_0x487396>=_0x21da87){_0x487396=_0x21da87;_0x1e3e9a=0xc8;}else{_0x1e3e9a=0xce;}_0x787fdc[_0x5d32('0x2d')](_0x1e3e9a);return _0x787fdc[_0x5d32('0x34')]('Content-Range',_0x53f62a+'-'+_0x487396+'/'+_0x21da87)[_0x5d32('0x2f')](_0xfbf95d);}return null;};}function patchUpdates(_0x1b7ab7){return function(_0x50d4e3){try{jsonpatch[_0x5d32('0x35')](_0x50d4e3,_0x1b7ab7,!![]);}catch(_0x4462b4){return BPromise[_0x5d32('0x36')](_0x4462b4);}return _0x50d4e3['save']();};}function saveUpdates(_0x5bf89d,_0x551581){return function(_0x34b1e7){if(_0x34b1e7){return _0x34b1e7[_0x5d32('0x37')](_0x5bf89d)[_0x5d32('0x20')](function(_0x1d9dd4){return _0x1d9dd4;});}return null;};}function removeEntity(_0x2604fd,_0x3aaec3){return function(_0x6beb28){if(_0x6beb28){return _0x6beb28[_0x5d32('0x38')]()[_0x5d32('0x20')](function(){var _0x3bfe59=_0x6beb28[_0x5d32('0x39')]({'plain':!![]});var _0x3d5398=_0x5d32('0x3a');return db[_0x5d32('0x3b')]['destroy']({'where':{'type':_0x3d5398,'resourceId':_0x3bfe59['id']}})[_0x5d32('0x20')](function(){return _0x6beb28;});})[_0x5d32('0x20')](function(){_0x2604fd[_0x5d32('0x2d')](0xcc)[_0x5d32('0x2e')]();});}};}function handleEntityNotFound(_0x336ba1,_0x1ee9bc){return function(_0x2af580){if(!_0x2af580){_0x336ba1[_0x5d32('0x2c')](0x194);}return _0x2af580;};}function handleError(_0x18e7b8,_0x439cb9){_0x439cb9=_0x439cb9||0x1f4;return function(_0x21e0f0){logger[_0x5d32('0x26')](_0x21e0f0[_0x5d32('0x3c')]);if(_0x21e0f0[_0x5d32('0x3d')]){delete _0x21e0f0[_0x5d32('0x3d')];}_0x18e7b8[_0x5d32('0x2d')](_0x439cb9)[_0x5d32('0x3e')](_0x21e0f0);};}exports['index']=function(_0x46d134,_0x331cf5){var _0x535d99={'include':[{'model':db[_0x5d32('0x3f')],'as':_0x5d32('0x40')}]},_0x44c477={},_0x2c9131={'count':0x0,'rows':[]};var _0x442376=_[_0x5d32('0x41')](db[_0x5d32('0x42')][_0x5d32('0x43')],function(_0x570c2d){return{'name':_0x570c2d[_0x5d32('0x44')],'type':_0x570c2d['type'][_0x5d32('0x45')]};});_0x44c477[_0x5d32('0x46')]=_[_0x5d32('0x41')](_0x442376,_0x5d32('0x3d'));_0x44c477[_0x5d32('0x47')]=_[_0x5d32('0x48')](_0x46d134[_0x5d32('0x47')]);_0x44c477[_0x5d32('0x49')]=_[_0x5d32('0x4a')](_0x44c477[_0x5d32('0x46')],_0x44c477['query']);_0x535d99[_0x5d32('0x4b')]=_['intersection'](_0x44c477[_0x5d32('0x46')],qs['fields'](_0x46d134[_0x5d32('0x47')]['fields']));_0x535d99[_0x5d32('0x4b')]=_0x535d99[_0x5d32('0x4b')]['length']?_0x535d99[_0x5d32('0x4b')]:_0x44c477[_0x5d32('0x46')];if(!_0x46d134[_0x5d32('0x47')]['hasOwnProperty'](_0x5d32('0x4c'))){_0x535d99[_0x5d32('0x32')]=qs[_0x5d32('0x32')](_0x46d134[_0x5d32('0x47')][_0x5d32('0x32')]);_0x535d99[_0x5d32('0x30')]=qs[_0x5d32('0x30')](_0x46d134[_0x5d32('0x47')][_0x5d32('0x30')]);}_0x535d99[_0x5d32('0x4d')]=qs[_0x5d32('0x4e')](_0x46d134[_0x5d32('0x47')][_0x5d32('0x4e')]);_0x535d99['where']=qs[_0x5d32('0x49')](_[_0x5d32('0x4f')](_0x46d134[_0x5d32('0x47')],_0x44c477[_0x5d32('0x49')]),_0x442376);if(_0x46d134[_0x5d32('0x47')]['filter']){_0x535d99[_0x5d32('0x50')]=_['merge'](_0x535d99['where'],{'$or':_['map'](_0x442376,function(_0x341a47){if(_0x341a47[_0x5d32('0x51')]!=='VIRTUAL'){var _0x772ef7={};_0x772ef7[_0x341a47[_0x5d32('0x3d')]]={'$like':'%'+_0x46d134['query']['filter']+'%'};return _0x772ef7;}})});}_0x535d99=_[_0x5d32('0x52')]({},_0x535d99,_0x46d134['options']);var _0x1c7ca8={'where':_0x535d99[_0x5d32('0x50')]};return db[_0x5d32('0x42')][_0x5d32('0x33')](_0x1c7ca8)[_0x5d32('0x20')](function(_0x5619d9){_0x2c9131[_0x5d32('0x33')]=_0x5619d9;if(_0x46d134[_0x5d32('0x47')][_0x5d32('0x53')]){_0x535d99['include']=[{'all':!![]}];}return db[_0x5d32('0x42')]['findAll'](_0x535d99);})[_0x5d32('0x20')](function(_0x3d2683){_0x2c9131[_0x5d32('0x54')]=_0x3d2683;return _0x2c9131;})[_0x5d32('0x20')](respondWithFilteredResult(_0x331cf5,_0x535d99))[_0x5d32('0x2b')](handleError(_0x331cf5,null));};exports[_0x5d32('0x55')]=function(_0x4e4709,_0x550782){var _0x523b15={'raw':![],'where':{'id':_0x4e4709[_0x5d32('0x56')]['id']},'include':[{'model':db[_0x5d32('0x3f')],'as':_0x5d32('0x40')}]},_0x4ec7ef={};_0x4ec7ef[_0x5d32('0x46')]=_[_0x5d32('0x48')](db[_0x5d32('0x42')][_0x5d32('0x43')]);_0x4ec7ef[_0x5d32('0x47')]=_[_0x5d32('0x48')](_0x4e4709[_0x5d32('0x47')]);_0x4ec7ef[_0x5d32('0x49')]=_['intersection'](_0x4ec7ef[_0x5d32('0x46')],_0x4ec7ef[_0x5d32('0x47')]);_0x523b15[_0x5d32('0x4b')]=_[_0x5d32('0x4a')](_0x4ec7ef[_0x5d32('0x46')],qs['fields'](_0x4e4709['query']['fields']));_0x523b15[_0x5d32('0x4b')]=_0x523b15[_0x5d32('0x4b')][_0x5d32('0x57')]?_0x523b15['attributes']:_0x4ec7ef['model'];if(_0x4e4709[_0x5d32('0x47')][_0x5d32('0x53')]){_0x523b15[_0x5d32('0x58')]=[{'all':!![]}];}_0x523b15=_[_0x5d32('0x52')]({},_0x523b15,_0x4e4709[_0x5d32('0x59')]);return db[_0x5d32('0x42')][_0x5d32('0x5a')](_0x523b15)[_0x5d32('0x20')](handleEntityNotFound(_0x550782,null))[_0x5d32('0x20')](respondWithResult(_0x550782,null))[_0x5d32('0x2b')](handleError(_0x550782,null));};exports[_0x5d32('0x5b')]=function(_0x40b0c9,_0x1b78d7){return db['WhatsappAccount'][_0x5d32('0x5b')](_0x40b0c9[_0x5d32('0x5c')],{})[_0x5d32('0x20')](function(_0x13ba1b){var _0x510cac=_0x40b0c9[_0x5d32('0x5d')][_0x5d32('0x39')]({'plain':!![]});if(!_0x510cac)throw new Error(_0x5d32('0x5e'));if(_0x510cac[_0x5d32('0x5f')]===_0x5d32('0x5d')){var _0x425947=_0x13ba1b[_0x5d32('0x39')]({'plain':!![]});var _0x34b4db=_0x5d32('0x3a');return db['UserProfileSection']['find']({'where':{'name':_0x34b4db,'userProfileId':_0x510cac['userProfileId']},'raw':!![]})[_0x5d32('0x20')](function(_0x1e8b00){if(_0x1e8b00&&_0x1e8b00['autoAssociation']===0x0){return db[_0x5d32('0x3b')]['create']({'name':_0x425947[_0x5d32('0x3d')],'resourceId':_0x425947['id'],'type':_0x1e8b00[_0x5d32('0x3d')],'sectionId':_0x1e8b00['id']},{})['then'](function(){return _0x13ba1b;});}else{return _0x13ba1b;}})[_0x5d32('0x2b')](function(_0x1d2057){logger[_0x5d32('0x26')](_0x5d32('0x60'),_0x1d2057);throw _0x1d2057;});}return _0x13ba1b;})[_0x5d32('0x20')](respondWithResult(_0x1b78d7,0xc9))[_0x5d32('0x2b')](handleError(_0x1b78d7,null));};exports[_0x5d32('0x37')]=function(_0x37b5bf,_0x87d379){if(_0x37b5bf[_0x5d32('0x5c')]['id']){delete _0x37b5bf[_0x5d32('0x5c')]['id'];}return db['WhatsappAccount']['find']({'where':{'id':_0x37b5bf[_0x5d32('0x56')]['id']},'include':[{'model':db[_0x5d32('0x3f')],'as':_0x5d32('0x40')}]})[_0x5d32('0x20')](handleEntityNotFound(_0x87d379,null))[_0x5d32('0x20')](saveUpdates(_0x37b5bf['body'],null))[_0x5d32('0x20')](respondWithResult(_0x87d379,null))[_0x5d32('0x2b')](handleError(_0x87d379,null));};exports[_0x5d32('0x38')]=function(_0xe562f2,_0x31fffa){return db[_0x5d32('0x42')]['find']({'where':{'id':_0xe562f2[_0x5d32('0x56')]['id']}})['then'](handleEntityNotFound(_0x31fffa,null))['then'](removeEntity(_0x31fffa,null))['catch'](handleError(_0x31fffa,null));};exports[_0x5d32('0x61')]=function(_0x44abfa,_0x2a295){return db['WhatsappAccount'][_0x5d32('0x61')]()[_0x5d32('0x20')](respondWithResult(_0x2a295,null))['catch'](handleError(_0x2a295,null));};exports[_0x5d32('0x62')]=function(_0x1c6712,_0x86dabf,_0x45899b){if(_0x1c6712[_0x5d32('0x5c')]['id']){delete _0x1c6712[_0x5d32('0x5c')]['id'];}return db[_0x5d32('0x42')][_0x5d32('0x5a')]({'where':{'id':_0x1c6712[_0x5d32('0x56')]['id']}})[_0x5d32('0x20')](handleEntityNotFound(_0x86dabf,null))[_0x5d32('0x20')](function(_0x21ccc4){if(_0x21ccc4){_0x1c6712[_0x5d32('0x5c')][_0x5d32('0x63')]=_0x21ccc4['id'];return db['Disposition']['create'](_0x1c6712[_0x5d32('0x5c')]);}})[_0x5d32('0x20')](respondWithResult(_0x86dabf,null))[_0x5d32('0x2b')](handleError(_0x86dabf,null));};exports['getDispositions']=function(_0x5b85cf,_0x11e5aa,_0x384d48){var _0xee4faa={'raw':![],'where':{}};var _0x11fe74={};var _0x3191d0={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0x5d32('0x64')]({'where':{'id':_0x5b85cf[_0x5d32('0x56')]['id']}})[_0x5d32('0x20')](handleEntityNotFound(_0x11e5aa,null))['then'](function(_0x33d4b3){if(_0x33d4b3){_0x11fe74['model']=_[_0x5d32('0x48')](db['Disposition'][_0x5d32('0x43')]);_0x11fe74[_0x5d32('0x47')]=_['keys'](_0x5b85cf[_0x5d32('0x47')]);_0x11fe74['filters']=_[_0x5d32('0x4a')](_0x11fe74[_0x5d32('0x46')],_0x11fe74[_0x5d32('0x47')]);_0xee4faa['attributes']=_[_0x5d32('0x4a')](_0x11fe74[_0x5d32('0x46')],qs[_0x5d32('0x65')](_0x5b85cf[_0x5d32('0x47')][_0x5d32('0x65')]));_0xee4faa['attributes']=_0xee4faa[_0x5d32('0x4b')][_0x5d32('0x57')]?_0xee4faa['attributes']:_0x11fe74[_0x5d32('0x46')];if(!_0x5b85cf['query'][_0x5d32('0x66')](_0x5d32('0x4c'))){_0xee4faa['limit']=qs[_0x5d32('0x32')](_0x5b85cf['query'][_0x5d32('0x32')]);_0xee4faa['offset']=qs[_0x5d32('0x30')](_0x5b85cf[_0x5d32('0x47')][_0x5d32('0x30')]);}_0xee4faa[_0x5d32('0x4d')]=qs[_0x5d32('0x4e')](_0x5b85cf[_0x5d32('0x47')][_0x5d32('0x4e')]);_0xee4faa['where']=qs['filters'](_[_0x5d32('0x4f')](_0x5b85cf[_0x5d32('0x47')],_0x11fe74[_0x5d32('0x49')]));_0xee4faa[_0x5d32('0x50')][_0x5d32('0x63')]=_0x33d4b3['id'];if(_0x5b85cf[_0x5d32('0x47')][_0x5d32('0x67')]){_0xee4faa[_0x5d32('0x50')]=_[_0x5d32('0x52')](_0xee4faa[_0x5d32('0x50')],{'$or':_[_0x5d32('0x41')](_0xee4faa[_0x5d32('0x4b')],function(_0x4f95d4){var _0xcb97b5={};_0xcb97b5[_0x4f95d4]={'$like':'%'+_0x5b85cf[_0x5d32('0x47')][_0x5d32('0x67')]+'%'};return _0xcb97b5;})});}_0xee4faa=_[_0x5d32('0x52')]({},_0xee4faa,_0x5b85cf[_0x5d32('0x59')]);return db[_0x5d32('0x68')][_0x5d32('0x33')]({'where':_0xee4faa[_0x5d32('0x50')]})['then'](function(_0xdb525c){_0x3191d0[_0x5d32('0x33')]=_0xdb525c;if(_0x5b85cf[_0x5d32('0x47')][_0x5d32('0x53')]){_0xee4faa[_0x5d32('0x58')]=[{'all':!![]}];}return db[_0x5d32('0x68')][_0x5d32('0x69')](_0xee4faa);})['then'](function(_0x560ce2){_0x3191d0[_0x5d32('0x54')]=_0x560ce2;return _0x3191d0;});}})[_0x5d32('0x20')](respondWithFilteredResult(_0x11e5aa,_0xee4faa))[_0x5d32('0x2b')](handleError(_0x11e5aa,null));};exports[_0x5d32('0x6a')]=function(_0x1c8f52,_0x5b9d61,_0x39181b){return db[_0x5d32('0x42')][_0x5d32('0x5a')]({'where':{'id':_0x1c8f52[_0x5d32('0x56')]['id']}})['then'](handleEntityNotFound(_0x5b9d61,null))['then'](function(_0xf147b1){if(_0xf147b1){return _0xf147b1['removeDispositions'](_0x1c8f52['query'][_0x5d32('0x6b')]);}})[_0x5d32('0x20')](respondWithStatusCode(_0x5b9d61,null))[_0x5d32('0x2b')](handleError(_0x5b9d61,null));};exports['addAnswer']=function(_0xf1a7e6,_0x5764c6,_0x2d5970){if(_0xf1a7e6[_0x5d32('0x5c')]['id']){delete _0xf1a7e6[_0x5d32('0x5c')]['id'];}return db[_0x5d32('0x42')][_0x5d32('0x5a')]({'where':{'id':_0xf1a7e6['params']['id']}})[_0x5d32('0x20')](handleEntityNotFound(_0x5764c6,null))[_0x5d32('0x20')](function(_0x503b4b){if(_0x503b4b){_0xf1a7e6[_0x5d32('0x5c')][_0x5d32('0x63')]=_0x503b4b['id'];return db[_0x5d32('0x6c')][_0x5d32('0x5b')](_0xf1a7e6[_0x5d32('0x5c')]);}})['then'](respondWithResult(_0x5764c6,null))[_0x5d32('0x2b')](handleError(_0x5764c6,null));};exports[_0x5d32('0x6d')]=function(_0x75dd52,_0x37a6a1,_0x415548){var _0x8577d1={'raw':![],'where':{}};var _0x517f7f={};var _0x15bfbc={'count':0x0,'rows':[]};return db[_0x5d32('0x42')]['findOne']({'where':{'id':_0x75dd52['params']['id']}})['then'](handleEntityNotFound(_0x37a6a1,null))[_0x5d32('0x20')](function(_0x17a6db){if(_0x17a6db){_0x517f7f['model']=_['keys'](db[_0x5d32('0x6c')][_0x5d32('0x43')]);_0x517f7f[_0x5d32('0x47')]=_[_0x5d32('0x48')](_0x75dd52[_0x5d32('0x47')]);_0x517f7f[_0x5d32('0x49')]=_[_0x5d32('0x4a')](_0x517f7f['model'],_0x517f7f[_0x5d32('0x47')]);_0x8577d1[_0x5d32('0x4b')]=_[_0x5d32('0x4a')](_0x517f7f[_0x5d32('0x46')],qs['fields'](_0x75dd52[_0x5d32('0x47')][_0x5d32('0x65')]));_0x8577d1[_0x5d32('0x4b')]=_0x8577d1[_0x5d32('0x4b')][_0x5d32('0x57')]?_0x8577d1[_0x5d32('0x4b')]:_0x517f7f['model'];if(!_0x75dd52[_0x5d32('0x47')][_0x5d32('0x66')]('nolimit')){_0x8577d1['limit']=qs[_0x5d32('0x32')](_0x75dd52['query']['limit']);_0x8577d1[_0x5d32('0x30')]=qs[_0x5d32('0x30')](_0x75dd52[_0x5d32('0x47')][_0x5d32('0x30')]);}_0x8577d1[_0x5d32('0x4d')]=qs[_0x5d32('0x4e')](_0x75dd52['query']['sort']);_0x8577d1[_0x5d32('0x50')]=qs[_0x5d32('0x49')](_[_0x5d32('0x4f')](_0x75dd52['query'],_0x517f7f['filters']));_0x8577d1[_0x5d32('0x50')][_0x5d32('0x63')]=_0x17a6db['id'];if(_0x75dd52['query']['filter']){_0x8577d1[_0x5d32('0x50')]=_['merge'](_0x8577d1[_0x5d32('0x50')],{'$or':_[_0x5d32('0x41')](_0x8577d1[_0x5d32('0x4b')],function(_0x4cd929){var _0x132a99={};_0x132a99[_0x4cd929]={'$like':'%'+_0x75dd52[_0x5d32('0x47')][_0x5d32('0x67')]+'%'};return _0x132a99;})});}_0x8577d1=_[_0x5d32('0x52')]({},_0x8577d1,_0x75dd52[_0x5d32('0x59')]);return db['CannedAnswer']['count']({'where':_0x8577d1['where']})[_0x5d32('0x20')](function(_0x401b35){_0x15bfbc[_0x5d32('0x33')]=_0x401b35;if(_0x75dd52[_0x5d32('0x47')][_0x5d32('0x53')]){_0x8577d1['include']=[{'all':!![]}];}return db[_0x5d32('0x6c')][_0x5d32('0x69')](_0x8577d1);})[_0x5d32('0x20')](function(_0x40879d){_0x15bfbc[_0x5d32('0x54')]=_0x40879d;return _0x15bfbc;});}})['then'](respondWithFilteredResult(_0x37a6a1,_0x8577d1))['catch'](handleError(_0x37a6a1,null));};exports[_0x5d32('0x6e')]=function(_0xb09526,_0x3bb13e,_0x4982b5){return db[_0x5d32('0x42')]['find']({'where':{'id':_0xb09526[_0x5d32('0x56')]['id']}})['then'](handleEntityNotFound(_0x3bb13e,null))[_0x5d32('0x20')](function(_0x15dc9e){if(_0x15dc9e){return _0x15dc9e[_0x5d32('0x6e')](_0xb09526[_0x5d32('0x47')]['ids']);}})[_0x5d32('0x20')](respondWithStatusCode(_0x3bb13e,null))[_0x5d32('0x2b')](handleError(_0x3bb13e,null));};exports[_0x5d32('0x6f')]=function(_0x4850a6,_0x2a3cf5,_0x35c06a){return db[_0x5d32('0x42')][_0x5d32('0x5a')]({'where':{'id':_0x4850a6['params']['id']}})['then'](handleEntityNotFound(_0x2a3cf5,null))[_0x5d32('0x20')](function(_0x348f30){if(_0x348f30){return _0x348f30['addAgents'](_0x4850a6[_0x5d32('0x5c')][_0x5d32('0x6b')],_[_0x5d32('0x70')](_0x4850a6[_0x5d32('0x5c')],['ids','id'])||{})[_0x5d32('0x71')](function(_0x341f5a){for(var _0x4d3a46=0x0;_0x4d3a46<_0x4850a6[_0x5d32('0x5c')][_0x5d32('0x6b')][_0x5d32('0x57')];_0x4d3a46+=0x1){socket[_0x5d32('0x72')](_0x5d32('0x73'),{'UserId':Number(_0x4850a6[_0x5d32('0x5c')][_0x5d32('0x6b')][_0x4d3a46]),'WhatsappAccountId':Number(_0x4850a6[_0x5d32('0x56')]['id'])});}return _0x341f5a;});}})['then'](respondWithResult(_0x2a3cf5,null))['catch'](handleError(_0x2a3cf5,null));};exports['removeAgents']=function(_0x3a4eb5,_0x485d62,_0xab9bee){return db[_0x5d32('0x42')][_0x5d32('0x5a')]({'where':{'id':_0x3a4eb5['params']['id']}})[_0x5d32('0x20')](handleEntityNotFound(_0x485d62,null))[_0x5d32('0x20')](function(_0x48b6e7){if(_0x48b6e7){return _0x48b6e7['removeAgents'](_0x3a4eb5[_0x5d32('0x47')][_0x5d32('0x6b')])[_0x5d32('0x20')](function(){if(_[_0x5d32('0x74')](_0x3a4eb5[_0x5d32('0x47')][_0x5d32('0x6b')])){for(var _0x1adc21=0x0;_0x1adc21<_0x3a4eb5[_0x5d32('0x47')][_0x5d32('0x6b')][_0x5d32('0x57')];_0x1adc21+=0x1){socket[_0x5d32('0x72')](_0x5d32('0x75'),{'UserId':Number(_0x3a4eb5[_0x5d32('0x47')][_0x5d32('0x6b')][_0x1adc21]),'WhatsappAccountId':Number(_0x3a4eb5[_0x5d32('0x56')]['id'])});}}else{socket[_0x5d32('0x72')](_0x5d32('0x75'),{'UserId':Number(_0x3a4eb5[_0x5d32('0x47')][_0x5d32('0x6b')]),'WhatsappAccountId':Number(_0x3a4eb5[_0x5d32('0x56')]['id'])});}});}})[_0x5d32('0x20')](respondWithStatusCode(_0x485d62,null))[_0x5d32('0x2b')](handleError(_0x485d62,null));};exports[_0x5d32('0x76')]=function(_0x25f70e,_0x1ce188,_0x1bffd7){var _0x33caa7={};var _0x460cab={};var _0x4e768a;var _0x42d152;return db[_0x5d32('0x42')]['findOne']({'where':{'id':_0x25f70e[_0x5d32('0x56')]['id']}})[_0x5d32('0x20')](handleEntityNotFound(_0x1ce188,null))[_0x5d32('0x20')](function(_0x17e101){if(_0x17e101){_0x4e768a=_0x17e101;_0x460cab[_0x5d32('0x46')]=_[_0x5d32('0x48')](db[_0x5d32('0x77')][_0x5d32('0x43')]);_0x460cab[_0x5d32('0x47')]=_[_0x5d32('0x48')](_0x25f70e[_0x5d32('0x47')]);_0x460cab['filters']=_[_0x5d32('0x4a')](_0x460cab['model'],_0x460cab['query']);_0x33caa7[_0x5d32('0x4b')]=_[_0x5d32('0x4a')](_0x460cab[_0x5d32('0x46')],qs[_0x5d32('0x65')](_0x25f70e['query'][_0x5d32('0x65')]));_0x33caa7[_0x5d32('0x4b')]=_0x33caa7[_0x5d32('0x4b')][_0x5d32('0x57')]?_0x33caa7[_0x5d32('0x4b')]:_0x460cab[_0x5d32('0x46')];_0x33caa7[_0x5d32('0x4d')]=qs['sort'](_0x25f70e[_0x5d32('0x47')]['sort']);_0x33caa7['where']=qs[_0x5d32('0x49')](_[_0x5d32('0x4f')](_0x25f70e['query'],_0x460cab[_0x5d32('0x49')]));if(_0x25f70e['query'][_0x5d32('0x67')]){_0x33caa7[_0x5d32('0x50')]=_[_0x5d32('0x52')](_0x33caa7[_0x5d32('0x50')],{'$or':_[_0x5d32('0x41')](_0x33caa7[_0x5d32('0x4b')],function(_0x4c7099){var _0x237e34={};_0x237e34[_0x4c7099]={'$like':'%'+_0x25f70e[_0x5d32('0x47')][_0x5d32('0x67')]+'%'};return _0x237e34;})});}_0x33caa7=_['merge']({},_0x33caa7,_0x25f70e['options']);return _0x4e768a['getAgents'](_0x33caa7);}})[_0x5d32('0x20')](function(_0xacd73b){if(_0xacd73b){_0x42d152=_0xacd73b[_0x5d32('0x57')];if(!_0x25f70e[_0x5d32('0x47')][_0x5d32('0x66')](_0x5d32('0x4c'))){_0x33caa7[_0x5d32('0x32')]=qs[_0x5d32('0x32')](_0x25f70e[_0x5d32('0x47')]['limit']);_0x33caa7[_0x5d32('0x30')]=qs[_0x5d32('0x30')](_0x25f70e[_0x5d32('0x47')]['offset']);}return _0x4e768a['getAgents'](_0x33caa7);}})[_0x5d32('0x20')](function(_0x2a66b6){if(_0x2a66b6){return _0x2a66b6?{'count':_0x42d152,'rows':_0x2a66b6}:null;}})[_0x5d32('0x20')](respondWithResult(_0x1ce188,null))[_0x5d32('0x2b')](handleError(_0x1ce188,null));};exports[_0x5d32('0x78')]=function(_0x4a6967,_0x5d1145){var _0x392668=_0x4a6967[_0x5d32('0x56')]['id'];var _0x33a5b2=_0x4a6967[_0x5d32('0x5c')];var _0x316426=0xc8;var _0x2ff232=null;return db['sequelize'][_0x5d32('0x79')]({'isolationLevel':db['sequelize'][_0x5d32('0x7a')]['ISOLATION_LEVELS']['READ_COMMITTED']},function(_0x363977){return db[_0x5d32('0x42')][_0x5d32('0x64')]({'where':{'id':_0x392668},'transaction':_0x363977})[_0x5d32('0x20')](function(_0x19d8b9){if(_0x19d8b9){return db[_0x5d32('0x7b')][_0x5d32('0x38')]({'where':{'WhatsappAccountId':_0x392668},'transaction':_0x363977})[_0x5d32('0x20')](function(){var _0x209635=_[_0x5d32('0x41')](_0x33a5b2,function(_0x32bbda){_0x32bbda[_0x5d32('0x63')]=_0x392668;return _0x32bbda;});return db[_0x5d32('0x7b')][_0x5d32('0x7c')](_0x209635,{'transaction':_0x363977});});}else{_0x316426=0x194;_0x2ff232=[];}});})[_0x5d32('0x20')](function(){if(_0x316426!==0x194){return db[_0x5d32('0x7b')][_0x5d32('0x7d')]({'where':{'WhatsappAccountId':_0x392668},'order':'priority'})[_0x5d32('0x20')](function(_0x27b4d5){_0x2ff232=_0x27b4d5;});}})[_0x5d32('0x2b')](function(_0x8d5e23){_0x316426=0x1f4;logger['error'](_0x8d5e23[_0x5d32('0x3c')]);if(_0x8d5e23['name']){delete _0x8d5e23['name'];}_0x2ff232=_0x8d5e23;})[_0x5d32('0x7e')](function(){if(_0x2ff232===null){_0x5d1145['sendStatus'](_0x316426);}else{if(_0x316426===0x1f4){_0x5d1145[_0x5d32('0x2d')](_0x316426)['send'](_0x2ff232);}else{_0x5d1145['status'](_0x316426)[_0x5d32('0x2f')](_0x2ff232);}}});};exports[_0x5d32('0x7f')]=function(_0x1e58d7,_0x1108b9,_0x3efcbc){var _0x2abb1c={};var _0x2b4088={};var _0x57cc92;var _0x56bd8f;return db[_0x5d32('0x42')][_0x5d32('0x64')]({'where':{'id':_0x1e58d7['params']['id']}})[_0x5d32('0x20')](handleEntityNotFound(_0x1108b9,null))['then'](function(_0x51593e){if(_0x51593e){_0x57cc92=_0x51593e;_0x2b4088['model']=_[_0x5d32('0x48')](db[_0x5d32('0x7b')][_0x5d32('0x43')]);_0x2b4088['query']=_[_0x5d32('0x48')](_0x1e58d7['query']);_0x2b4088[_0x5d32('0x49')]=_['intersection'](_0x2b4088['model'],_0x2b4088[_0x5d32('0x47')]);_0x2abb1c['attributes']=_[_0x5d32('0x4a')](_0x2b4088[_0x5d32('0x46')],qs[_0x5d32('0x65')](_0x1e58d7[_0x5d32('0x47')][_0x5d32('0x65')]));_0x2abb1c[_0x5d32('0x4b')]=_0x2abb1c[_0x5d32('0x4b')][_0x5d32('0x57')]?_0x2abb1c[_0x5d32('0x4b')]:_0x2b4088[_0x5d32('0x46')];_0x2abb1c[_0x5d32('0x4d')]=qs[_0x5d32('0x4e')](_0x1e58d7[_0x5d32('0x47')]['sort']);_0x2abb1c[_0x5d32('0x50')]=qs['filters'](_[_0x5d32('0x4f')](_0x1e58d7[_0x5d32('0x47')],_0x2b4088[_0x5d32('0x49')]));if(_0x1e58d7[_0x5d32('0x47')]['filter']){_0x2abb1c[_0x5d32('0x50')]=_[_0x5d32('0x52')](_0x2abb1c[_0x5d32('0x50')],{'$or':_[_0x5d32('0x41')](_0x2abb1c[_0x5d32('0x4b')],function(_0x2464ca){var _0x336e28={};_0x336e28[_0x2464ca]={'$like':'%'+_0x1e58d7[_0x5d32('0x47')][_0x5d32('0x67')]+'%'};return _0x336e28;})});}_0x2abb1c=_['merge']({},_0x2abb1c,_0x1e58d7['options']);return _0x57cc92['getApplications'](_0x2abb1c);}})[_0x5d32('0x20')](function(_0x5e7039){if(_0x5e7039){_0x56bd8f=_0x5e7039[_0x5d32('0x57')];if(!_0x1e58d7[_0x5d32('0x47')][_0x5d32('0x66')](_0x5d32('0x4c'))){_0x2abb1c[_0x5d32('0x32')]=qs['limit'](_0x1e58d7[_0x5d32('0x47')][_0x5d32('0x32')]);_0x2abb1c[_0x5d32('0x30')]=qs[_0x5d32('0x30')](_0x1e58d7[_0x5d32('0x47')][_0x5d32('0x30')]);}return _0x57cc92[_0x5d32('0x7f')](_0x2abb1c);}})['then'](function(_0x112e36){if(_0x112e36){return _0x112e36?{'count':_0x56bd8f,'rows':_0x112e36}:null;}})['then'](respondWithResult(_0x1108b9,null))[_0x5d32('0x2b')](handleError(_0x1108b9,null));};exports[_0x5d32('0x80')]=function(_0x51c579,_0x42cd60,_0x20cea4){var _0x8e1270={'channel':_0x5d32('0x81')};var _0x9f4b0a=[];var _0x5254ed=[];var _0x3ca8e3={};return db[_0x5d32('0x42')][_0x5d32('0x5a')]({'where':{'id':_0x51c579[_0x5d32('0x56')]['id']},'include':[{'model':db[_0x5d32('0x7b')],'as':'Applications'}]})[_0x5d32('0x20')](handleEntityNotFound(_0x42cd60,null))['then'](function(_0x3b4c97){_0x8e1270[_0x5d32('0x82')]=_0x3b4c97;if(_0x8e1270[_0x5d32('0x82')]&&_0x8e1270[_0x5d32('0x82')][_0x5d32('0x51')]==='sinch'&&_0x51c579[_0x5d32('0x5c')][_0x5d32('0x83')]){if(_0x51c579[_0x5d32('0x5c')][_0x5d32('0x83')][_0x5d32('0x57')]===0x0)return;if(_0x51c579['body']['statuses'][0x0]['state']!==_0x5d32('0x84'))return;return db['WhatsappMessage'][_0x5d32('0x37')]({'read':!![],'readAt':_0x51c579[_0x5d32('0x5c')][_0x5d32('0x83')][0x0]['timestamp']},{'where':{'messageId':_0x51c579[_0x5d32('0x5c')]['statuses'][0x0][_0x5d32('0x85')]},'individualHooks':!![]})[_0x5d32('0x20')](function(_0x530bec){return _0x42cd60['status'](0xc8)[_0x5d32('0x2f')](_0x530bec);});}_0x8e1270[_0x5d32('0x86')]=_[_0x5d32('0x87')](_0x3b4c97['Applications'],[_0x5d32('0x88')],[_0x5d32('0x89')]);if(_0x8e1270['account'][_0x5d32('0x8a')]){delete _0x8e1270[_0x5d32('0x82')][_0x5d32('0x8a')];}return db[_0x5d32('0x8b')][_0x5d32('0x61')]()['then'](function(_0x2f4b7d){if(!_0x2f4b7d){throw new db[(_0x5d32('0x8c'))][(_0x5d32('0x8d'))]('no\x20available\x20attributes');}_0x9f4b0a=_[_0x5d32('0x8e')](_[_0x5d32('0x48')](_0x2f4b7d),[_0x5d32('0x8f'),_0x5d32('0x90')]);_0x5254ed=_[_0x5d32('0x8e')](_[_0x5d32('0x48')](_0x2f4b7d),[_0x5d32('0x8f'),_0x5d32('0x90'),_0x5d32('0x91'),_0x5d32('0x92')]);_0x8e1270[_0x5d32('0x5c')]={'mapKey':_0x5d32('0x93')};if(_0x8e1270[_0x5d32('0x82')]&&_0x8e1270['account'][_0x5d32('0x51')]===_0x5d32('0x94')){_0x8e1270['body'][_0x5d32('0x95')]=_0x51c579[_0x5d32('0x5c')][_0x5d32('0x96')][_0x5d32('0x97')](_0x5d32('0x98'),'');_0x8e1270[_0x5d32('0x5c')][_0x5d32('0x5c')]=_0x51c579[_0x5d32('0x5c')][_0x5d32('0x99')];_0x8e1270[_0x5d32('0x5c')][_0x5d32('0x9a')]=_0x51c579[_0x5d32('0x5c')][_0x5d32('0x9b')];}if(_0x8e1270[_0x5d32('0x82')]&&_0x8e1270['account'][_0x5d32('0x51')]==='sinch'){_0x8e1270[_0x5d32('0x5c')]['from']=_0x51c579[_0x5d32('0x5c')][_0x5d32('0x9c')][0x0]['from'];_0x8e1270['body'][_0x5d32('0x5c')]=_0x51c579[_0x5d32('0x5c')]['notifications'][0x0][_0x5d32('0x29')][_0x5d32('0x5c')];_0x8e1270['body']['messageId']=_0x51c579[_0x5d32('0x5c')][_0x5d32('0x9c')][0x0][_0x5d32('0x85')];}if(_0x8e1270[_0x5d32('0x5c')]['id']){delete _0x8e1270[_0x5d32('0x5c')]['id'];}if(_[_0x5d32('0x9d')](_0x8e1270[_0x5d32('0x5c')][_0x5d32('0x95')])){throw new db[(_0x5d32('0x8c'))][(_0x5d32('0x8d'))](_0x5d32('0x9e'));}if(_[_0x5d32('0x9d')](_0x8e1270['body'][_0x5d32('0x5c')])||_0x8e1270['body'][_0x5d32('0x5c')]===''){throw new db[(_0x5d32('0x8c'))][(_0x5d32('0x8d'))](_0x5d32('0x9f'));}if(_[_0x5d32('0x9d')](_0x8e1270[_0x5d32('0x5c')][_0x5d32('0xa0')])){throw new db[(_0x5d32('0x8c'))]['ValidationError'](_0x5d32('0xa1')+_0x5254ed);}if(!_[_0x5d32('0xa2')](_0x5254ed,_0x8e1270[_0x5d32('0x5c')][_0x5d32('0xa0')])){throw new db[(_0x5d32('0x8c'))][(_0x5d32('0x8d'))](_0x5d32('0xa3')+_0x5254ed);}_0x3ca8e3[_0x8e1270['body'][_0x5d32('0xa0')]]=_0x8e1270['body']['from'];return db[_0x5d32('0xa4')][_0x5d32('0x5a')]({'where':{'id':_0x8e1270['account'][_0x5d32('0x92')]},'include':[{'model':db['CmContact'],'as':_0x5d32('0xa5'),'where':_0x3ca8e3,'limit':0x1,'order':[[_0x5d32('0x90'),_0x5d32('0xa6')]]}]});})[_0x5d32('0x20')](handleEntityNotFound(_0x42cd60,null))[_0x5d32('0x20')](function(_0x14db4e){if(_0x14db4e){_0x8e1270[_0x5d32('0xa7')]=_[_0x5d32('0x70')](_0x14db4e,['Contacts']);if(_0x14db4e[_0x5d32('0xa5')][_0x5d32('0x57')]){return _0x14db4e[_0x5d32('0xa5')][0x0];}var _0x10d3c6=_[_0x5d32('0xa8')](_0x8e1270['body'],{'firstName':_0x8e1270[_0x5d32('0x5c')][_0x5d32('0x95')],'ListId':_0x14db4e['id']});_0x10d3c6[_0x8e1270[_0x5d32('0x5c')]['mapKey']]=_0x8e1270[_0x5d32('0x5c')][_0x5d32('0x95')];return db[_0x5d32('0x8b')][_0x5d32('0x5b')](_0x10d3c6,{'fields':_0x9f4b0a,'raw':!![]});}})[_0x5d32('0x20')](handleEntityNotFound(_0x42cd60,null))['then'](function(_0x408d5d){if(_0x408d5d){_0x8e1270[_0x5d32('0xa9')]=_0x408d5d;var _0x2b5375={'ContactId':_0x408d5d['id'],'phone':_0x8e1270[_0x5d32('0x5c')][_0x5d32('0x95')],'WhatsappAccountId':_0x51c579['params']['id']};var _0x573c66={'ContactId':_0x408d5d['id'],'WhatsappAccountId':_0x51c579[_0x5d32('0x56')]['id'],'closed':![]};return db[_0x5d32('0xaa')][_0x5d32('0x5a')]({'where':_0x573c66})['then'](function(_0x2f0e07){if(_0x2f0e07){return[_0x2f0e07,![]];}return db[_0x5d32('0xaa')][_0x5d32('0x5b')](_0x2b5375)[_0x5d32('0x20')](function(_0x3910c1){return[_0x3910c1,!![]];});});}})[_0x5d32('0x71')](function(_0x5e9b60,_0x259fca){_0x8e1270[_0x5d32('0xab')]=_0x5e9b60[_0x5d32('0x39')]({'plain':!![]});_0x8e1270[_0x5d32('0xab')][_0x5d32('0xac')]=![];if(_0x259fca){if(_0x8e1270[_0x5d32('0x82')][_0x5d32('0xad')]){_0x8e1270[_0x5d32('0x86')][_0x5d32('0xae')]({'id':0x0,'priority':_0x8e1270[_0x5d32('0x86')][_0x5d32('0x57')]+0x1,'app':'close','appdata':'unmanaged','interval':_0x5d32('0xaf')});}_0x8e1270[_0x5d32('0xab')][_0x5d32('0xac')]=!![];}return db[_0x5d32('0xb0')][_0x5d32('0x5b')]({'phone':_0x8e1270['body'][_0x5d32('0x95')],'messageId':_0x8e1270[_0x5d32('0x5c')][_0x5d32('0x9a')],'body':_0x8e1270[_0x5d32('0x5c')]['body'],'WhatsappAccountId':_0x51c579['params']['id'],'WhatsappInteractionId':_0x5e9b60['id'],'direction':'in','ContactId':_0x5e9b60[_0x5d32('0xb1')],'AttachmentId':_0x8e1270['body']['AttachmentId']});})[_0x5d32('0x20')](function(_0x305478){_0x8e1270[_0x5d32('0x29')]=_0x305478;if(!_0x8e1270['interaction'][_0x5d32('0xb2')])return;return db[_0x5d32('0x77')]['find']({'attributes':['id','name'],'where':{'id':_0x8e1270[_0x5d32('0xab')][_0x5d32('0xb2')]}});})[_0x5d32('0x20')](function(_0x120845){if(_0x120845){_0x8e1270[_0x5d32('0x86')][_0x5d32('0xb3')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x120845['name']+','+(_0x8e1270[_0x5d32('0x82')]['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});}if(!_0x8e1270[_0x5d32('0xab')][_0x5d32('0xb4')])return;return db['WhatsappQueue'][_0x5d32('0x5a')]({'attributes':['id','name'],'where':{'id':_0x8e1270['interaction'][_0x5d32('0xb4')]}});})[_0x5d32('0x20')](function(_0x36f8b6){if(_0x36f8b6){_0x8e1270[_0x5d32('0x86')][_0x5d32('0xb3')]({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x36f8b6[_0x5d32('0x3d')]+','+(_0x8e1270[_0x5d32('0x82')]['waitForTheAssignedQueue']||0x12c),'interval':_0x5d32('0xaf')});}return respondWithRpcPromise('Start',_0x5d32('0xb5'),_0x8e1270);})[_0x5d32('0x20')](function(_0xb055cf){if(_0xb055cf){var _0x1391f7=0xc8;var _0x235680=_0x5d32('0xb6');logger['info'](_0x5d32('0x24'),_0x235680,_0x1391f7,_0x5d32('0xb7'));logger[_0x5d32('0x23')](_0x5d32('0xb8'),_0x235680,_0x1391f7,_0x5d32('0xb7'),JSON[_0x5d32('0x25')](_0xb055cf));if(_0x8e1270['account'][_0x5d32('0x51')]===_0x5d32('0x94')){return _0x42cd60[_0x5d32('0x2d')](_0x1391f7)[_0x5d32('0x34')]('Content-Type',_0x5d32('0xb9'))['send'](_0x5d32('0xba'));}else{return _0x42cd60[_0x5d32('0x2d')](_0x1391f7)[_0x5d32('0x2f')](_0xb055cf);}}});})[_0x5d32('0x2b')](handleError(_0x42cd60,null));};exports['send']=function(_0x18cf3d,_0x5d7a16,_0x546bbb){var _0x37d8a5,_0x4b4fa8,_0x2a24fd;if(_[_0x5d32('0x9d')](_0x18cf3d[_0x5d32('0x5c')][_0x5d32('0x5c')])||_0x18cf3d[_0x5d32('0x5c')][_0x5d32('0x5c')]===''){throw new db[(_0x5d32('0x8c'))][(_0x5d32('0x8d'))](_0x5d32('0x9f'));}if(_['isNil'](_0x18cf3d['body']['to'])){throw new db[(_0x5d32('0x8c'))][(_0x5d32('0x8d'))](_0x5d32('0xbb'));}_0x37d8a5=_0x18cf3d[_0x5d32('0x5c')]['to'];return db['WhatsappAccount']['find']({'where':{'id':_0x18cf3d[_0x5d32('0x56')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db['CmContact'],'as':_0x5d32('0xa5'),'where':{'mobile':_0x37d8a5},'limit':0x1,'order':[[_0x5d32('0x90'),_0x5d32('0xa6')]]}]}]})[_0x5d32('0x20')](handleEntityNotFound(_0x5d7a16,null))[_0x5d32('0x20')](function(_0x30f369){if(_0x30f369&&_0x30f369['List']){_0x4b4fa8=_0x30f369[_0x5d32('0x39')]({'plain':!![]});if(_0x4b4fa8[_0x5d32('0xbc')]&&_0x4b4fa8['List']['Contacts']['length']){return _0x4b4fa8[_0x5d32('0xbc')][_0x5d32('0xa5')][0x0];}return db[_0x5d32('0x8b')]['create'](_['defaults'](_0x18cf3d['body'],{'firstName':_0x37d8a5,'mobile':_0x37d8a5,'phone':_0x37d8a5,'ListId':_0x4b4fa8[_0x5d32('0x92')]}));}})['then'](handleEntityNotFound(_0x5d7a16,null))['then'](function(_0x4a6fec){if(_0x4a6fec){_0x2a24fd=_0x4a6fec;return db[_0x5d32('0xaa')][_0x5d32('0x5a')]({'where':{'ContactId':_0x2a24fd['id'],'closed':![],'WhatsappAccountId':_0x4b4fa8['id']}})[_0x5d32('0x20')](function(_0x38ac63){if(_0x38ac63){return[_0x38ac63,![]];}return db[_0x5d32('0xaa')][_0x5d32('0x5b')]({'UserId':_0x18cf3d[_0x5d32('0x5d')]['id'],'ContactId':_0x2a24fd['id'],'WhatsappAccountId':_0x4b4fa8['id'],'phone':_0x37d8a5,'firstMsgDirection':_0x5d32('0xbd'),'Messages':[_[_0x5d32('0x52')](_0x18cf3d['body'],{'read':![],'body':_0x18cf3d['body'][_0x5d32('0x5c')],'phone':_0x37d8a5,'WhatsappAccountId':_0x4b4fa8['id'],'UserId':_0x18cf3d[_0x5d32('0x5d')]['id'],'ContactId':_0x2a24fd['id']})]},{'include':[{'model':db[_0x5d32('0xb0')],'as':'Messages'}]})[_0x5d32('0x20')](function(_0x19eeea){return[_0x19eeea,!![]];});});}})[_0x5d32('0x71')](function(_0x2aa670,_0x50016c){if(_0x50016c){return _0x2aa670;}return db[_0x5d32('0xb0')]['create'](_[_0x5d32('0x52')](_0x18cf3d[_0x5d32('0x5c')],{'read':![],'body':_0x18cf3d[_0x5d32('0x5c')][_0x5d32('0x5c')],'phone':_0x37d8a5,'WhatsappAccountId':_0x4b4fa8['id'],'WhatsappInteractionId':_0x2aa670['id'],'UserId':_0x18cf3d[_0x5d32('0x5d')]['id'],'ContactId':_0x2a24fd['id']}))[_0x5d32('0x20')](function(_0x4baae2){_0x2aa670[_0x5d32('0xbe')][_0x5d32('0xbf')]=[];_0x2aa670[_0x5d32('0xbe')][_0x5d32('0xbf')][_0x5d32('0xae')](_0x4baae2[_0x5d32('0xbe')]);return _0x2aa670;});})[_0x5d32('0x20')](respondWithResult(_0x5d7a16,null))[_0x5d32('0x2b')](handleError(_0x5d7a16,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index ebb2fc6..59762bc 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 _0x39bb=['hasOwnProperty','hook','exports','../../mysqldb','WhatsappAccount','setMaxListeners','save','update','remove','emit'];(function(_0x484e36,_0x4482d8){var _0xafc85d=function(_0xaba9c8){while(--_0xaba9c8){_0x484e36['push'](_0x484e36['shift']());}};_0xafc85d(++_0x4482d8);}(_0x39bb,0x1d9));var _0xb39b=function(_0x9db5d3,_0x4eea5e){_0x9db5d3=_0x9db5d3-0x0;var _0x477a81=_0x39bb[_0x9db5d3];return _0x477a81;};'use strict';var EventEmitter=require('events');var WhatsappAccount=require(_0xb39b('0x0'))['db'][_0xb39b('0x1')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0xb39b('0x2')](0x0);var events={'afterCreate':_0xb39b('0x3'),'afterUpdate':_0xb39b('0x4'),'afterDestroy':_0xb39b('0x5')};function emitEvent(_0x5baa54){return function(_0x1166b7,_0x48b09a,_0x2e1488){WhatsappAccountEvents[_0xb39b('0x6')](_0x5baa54+':'+_0x1166b7['id'],_0x1166b7);WhatsappAccountEvents[_0xb39b('0x6')](_0x5baa54,_0x1166b7);_0x2e1488(null);};}for(var e in events){if(events[_0xb39b('0x7')](e)){var event=events[e];WhatsappAccount[_0xb39b('0x8')](e,emitEvent(event));}}module[_0xb39b('0x9')]=WhatsappAccountEvents; \ No newline at end of file +var _0xee9f=['emit','hasOwnProperty','exports','events','../../mysqldb','WhatsappAccount','setMaxListeners','save','update'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xee9f,0xf6));var _0xfee9=function(_0x8da88d,_0x111ff0){_0x8da88d=_0x8da88d-0x0;var _0x2ffe7b=_0xee9f[_0x8da88d];return _0x2ffe7b;};'use strict';var EventEmitter=require(_0xfee9('0x0'));var WhatsappAccount=require(_0xfee9('0x1'))['db'][_0xfee9('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0xfee9('0x3')](0x0);var events={'afterCreate':_0xfee9('0x4'),'afterUpdate':_0xfee9('0x5'),'afterDestroy':'remove'};function emitEvent(_0x303538){return function(_0xd0400,_0x50a71a,_0x1585ff){WhatsappAccountEvents[_0xfee9('0x6')](_0x303538+':'+_0xd0400['id'],_0xd0400);WhatsappAccountEvents[_0xfee9('0x6')](_0x303538,_0xd0400);_0x1585ff(null);};}for(var e in events){if(events[_0xfee9('0x7')](e)){var event=events[e];WhatsappAccount['hook'](e,emitEvent(event));}}module[_0xfee9('0x8')]=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index 81af61d..5458ce2 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 _0xcf15=['exports','define','whatsapp_accounts','util','../../config/logger','bluebird','request-promise','path','../../config/environment','./whatsappAccount.attributes'];(function(_0x54b8dd,_0x300e08){var _0x2448b5=function(_0x52f62f){while(--_0x52f62f){_0x54b8dd['push'](_0x54b8dd['shift']());}};_0x2448b5(++_0x300e08);}(_0xcf15,0x193));var _0x5cf1=function(_0x13d778,_0x18efe8){_0x13d778=_0x13d778-0x0;var _0x1bed63=_0xcf15[_0x13d778];return _0x1bed63;};'use strict';var _=require('lodash');var util=require(_0x5cf1('0x0'));var logger=require(_0x5cf1('0x1'))('api');var moment=require('moment');var BPromise=require(_0x5cf1('0x2'));var rp=require(_0x5cf1('0x3'));var fs=require('fs');var path=require(_0x5cf1('0x4'));var rimraf=require('rimraf');var config=require(_0x5cf1('0x5'));var attributes=require(_0x5cf1('0x6'));module[_0x5cf1('0x7')]=function(_0xeb93,_0x73b36){return _0xeb93[_0x5cf1('0x8')]('WhatsappAccount',attributes,{'tableName':_0x5cf1('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xeeac=['moment','bluebird','request-promise','path','rimraf','./whatsappAccount.attributes','define','WhatsappAccount','lodash','util','api'];(function(_0x15874f,_0x5cfc6f){var _0x1e707b=function(_0x3f5cfd){while(--_0x3f5cfd){_0x15874f['push'](_0x15874f['shift']());}};_0x1e707b(++_0x5cfc6f);}(_0xeeac,0x81));var _0xceea=function(_0x5d6270,_0x83b57a){_0x5d6270=_0x5d6270-0x0;var _0x168f26=_0xeeac[_0x5d6270];return _0x168f26;};'use strict';var _=require(_0xceea('0x0'));var util=require(_0xceea('0x1'));var logger=require('../../config/logger')(_0xceea('0x2'));var moment=require(_0xceea('0x3'));var BPromise=require(_0xceea('0x4'));var rp=require(_0xceea('0x5'));var fs=require('fs');var path=require(_0xceea('0x6'));var rimraf=require(_0xceea('0x7'));var config=require('../../config/environment');var attributes=require(_0xceea('0x8'));module['exports']=function(_0x55fba8,_0x309724){return _0x55fba8[_0xceea('0x9')](_0xceea('0xa'),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 5c6e74e..eb91671 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 _0xb98b=['ShowWhatsappAccount','WhatsappAccount','find','options','raw','where','attributes','include','model','map','catch','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','register','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result'];(function(_0x1006d4,_0x158a87){var _0x24b3c7=function(_0x1d4c96){while(--_0x1d4c96){_0x1006d4['push'](_0x1006d4['shift']());}};_0x24b3c7(++_0x158a87);}(_0xb98b,0x13b));var _0xbb98=function(_0x365515,_0x176d70){_0x365515=_0x365515-0x0;var _0x3c37fd=_0xb98b[_0x365515];return _0x3c37fd;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xbb98('0x0'));var rs=require(_0xbb98('0x1'));var fs=require('fs');var Redis=require(_0xbb98('0x2'));var db=require(_0xbb98('0x3'))['db'];var utils=require(_0xbb98('0x4'));var logger=require(_0xbb98('0x5'))(_0xbb98('0x6'));var config=require(_0xbb98('0x7'));var jayson=require(_0xbb98('0x8'));var client=jayson['client'][_0xbb98('0x9')]({'port':0x232a});config[_0xbb98('0xa')]=_[_0xbb98('0xb')](config[_0xbb98('0xa')],{'host':_0xbb98('0xc'),'port':0x18eb});var socket=require(_0xbb98('0xd'))(new Redis(config[_0xbb98('0xa')]));require(_0xbb98('0xe'))[_0xbb98('0xf')](socket);function respondWithRpcPromise(_0x2d7216,_0x547327,_0x160193){return new BPromise(function(_0x909310,_0x18ab85){return client[_0xbb98('0x10')](_0x2d7216,_0x160193)[_0xbb98('0x11')](function(_0x12e3d3){logger[_0xbb98('0x12')](_0xbb98('0x13'),_0x547327,_0xbb98('0x14'));logger[_0xbb98('0x15')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x547327,_0xbb98('0x14'),JSON[_0xbb98('0x16')](_0x12e3d3));if(_0x12e3d3[_0xbb98('0x17')]){if(_0x12e3d3['error'][_0xbb98('0x18')]===0x1f4){logger[_0xbb98('0x17')](_0xbb98('0x13'),_0x547327,_0x12e3d3['error'][_0xbb98('0x19')]);return _0x18ab85(_0x12e3d3['error'][_0xbb98('0x19')]);}logger[_0xbb98('0x17')](_0xbb98('0x13'),_0x547327,_0x12e3d3[_0xbb98('0x17')][_0xbb98('0x19')]);return _0x909310(_0x12e3d3[_0xbb98('0x17')][_0xbb98('0x19')]);}else{logger[_0xbb98('0x12')](_0xbb98('0x13'),_0x547327,_0xbb98('0x14'));_0x909310(_0x12e3d3[_0xbb98('0x1a')][_0xbb98('0x19')]);}})['catch'](function(_0x149455){logger['error'](_0xbb98('0x13'),_0x547327,_0x149455);_0x18ab85(_0x149455);});});}exports[_0xbb98('0x1b')]=function(_0x475d84){var _0x219f24=this;return new Promise(function(_0x42e69d,_0xe3d597){return db[_0xbb98('0x1c')][_0xbb98('0x1d')]({'raw':_0x475d84[_0xbb98('0x1e')]?_0x475d84['options'][_0xbb98('0x1f')]===undefined?!![]:![]:!![],'where':_0x475d84['options']?_0x475d84[_0xbb98('0x1e')][_0xbb98('0x20')]||null:null,'attributes':_0x475d84['options']?_0x475d84[_0xbb98('0x1e')][_0xbb98('0x21')]||null:null,'include':_0x475d84[_0xbb98('0x1e')]?_0x475d84[_0xbb98('0x1e')][_0xbb98('0x22')]?_['map'](_0x475d84['options']['include'],function(_0x2a7a3e){return{'model':db[_0x2a7a3e[_0xbb98('0x23')]],'as':_0x2a7a3e['as'],'attributes':_0x2a7a3e[_0xbb98('0x21')],'include':_0x2a7a3e[_0xbb98('0x22')]?_[_0xbb98('0x24')](_0x2a7a3e['include'],function(_0x5db6f3){return{'model':db[_0x5db6f3[_0xbb98('0x23')]],'as':_0x5db6f3['as'],'attributes':_0x5db6f3[_0xbb98('0x21')],'include':_0x5db6f3[_0xbb98('0x22')]?_[_0xbb98('0x24')](_0x5db6f3[_0xbb98('0x22')],function(_0x949c22){return{'model':db[_0x949c22['model']],'as':_0x949c22['as'],'attributes':_0x949c22[_0xbb98('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2b6e37){logger[_0xbb98('0x12')]('ShowWhatsappAccount',_0x475d84);logger[_0xbb98('0x15')](_0xbb98('0x1b'),_0x475d84,JSON['stringify'](_0x2b6e37));_0x42e69d(_0x2b6e37);})[_0xbb98('0x25')](function(_0xe9f905){logger['error'](_0xbb98('0x1b'),_0xe9f905[_0xbb98('0x19')],_0x475d84);_0xe3d597(_0x219f24[_0xbb98('0x17')](0x1f4,_0xe9f905[_0xbb98('0x19')]));});});}; \ No newline at end of file +var _0x004d=['options','raw','where','attributes','include','map','model','stringify','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','./whatsappAccount.socket','register','request','then','info','WhatsappAccount,\x20%s,\x20%s','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','ShowWhatsappAccount','find'];(function(_0x4ad63f,_0x45201c){var _0x30a71b=function(_0x15cf9b){while(--_0x15cf9b){_0x4ad63f['push'](_0x4ad63f['shift']());}};_0x30a71b(++_0x45201c);}(_0x004d,0xc1));var _0xd004=function(_0x5acb44,_0x1d2f98){_0x5acb44=_0x5acb44-0x0;var _0x5dca0f=_0x004d[_0x5acb44];return _0x5dca0f;};'use strict';var _=require(_0xd004('0x0'));var util=require('util');var moment=require(_0xd004('0x1'));var BPromise=require(_0xd004('0x2'));var rs=require(_0xd004('0x3'));var fs=require('fs');var Redis=require(_0xd004('0x4'));var db=require(_0xd004('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xd004('0x6'))(_0xd004('0x7'));var config=require(_0xd004('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd004('0x9')][_0xd004('0xa')]({'port':0x232a});config[_0xd004('0xb')]=_['defaults'](config['redis'],{'host':_0xd004('0xc'),'port':0x18eb});var socket=require(_0xd004('0xd'))(new Redis(config[_0xd004('0xb')]));require(_0xd004('0xe'))[_0xd004('0xf')](socket);function respondWithRpcPromise(_0x527347,_0x50f39b,_0x452948){return new BPromise(function(_0x96943d,_0x330fd5){return client[_0xd004('0x10')](_0x527347,_0x452948)[_0xd004('0x11')](function(_0x49f4ee){logger[_0xd004('0x12')](_0xd004('0x13'),_0x50f39b,'request\x20sent');logger[_0xd004('0x14')](_0xd004('0x15'),_0x50f39b,_0xd004('0x16'),JSON['stringify'](_0x49f4ee));if(_0x49f4ee[_0xd004('0x17')]){if(_0x49f4ee[_0xd004('0x17')][_0xd004('0x18')]===0x1f4){logger[_0xd004('0x17')](_0xd004('0x13'),_0x50f39b,_0x49f4ee[_0xd004('0x17')][_0xd004('0x19')]);return _0x330fd5(_0x49f4ee['error'][_0xd004('0x19')]);}logger[_0xd004('0x17')]('WhatsappAccount,\x20%s,\x20%s',_0x50f39b,_0x49f4ee['error'][_0xd004('0x19')]);return _0x96943d(_0x49f4ee['error'][_0xd004('0x19')]);}else{logger[_0xd004('0x12')](_0xd004('0x13'),_0x50f39b,_0xd004('0x16'));_0x96943d(_0x49f4ee['result'][_0xd004('0x19')]);}})[_0xd004('0x1a')](function(_0x4bfc82){logger['error'](_0xd004('0x13'),_0x50f39b,_0x4bfc82);_0x330fd5(_0x4bfc82);});});}exports[_0xd004('0x1b')]=function(_0x5dce28){var _0x1ea205=this;return new Promise(function(_0x3a6443,_0x101ee1){return db['WhatsappAccount'][_0xd004('0x1c')]({'raw':_0x5dce28[_0xd004('0x1d')]?_0x5dce28['options'][_0xd004('0x1e')]===undefined?!![]:![]:!![],'where':_0x5dce28[_0xd004('0x1d')]?_0x5dce28[_0xd004('0x1d')][_0xd004('0x1f')]||null:null,'attributes':_0x5dce28[_0xd004('0x1d')]?_0x5dce28[_0xd004('0x1d')][_0xd004('0x20')]||null:null,'include':_0x5dce28[_0xd004('0x1d')]?_0x5dce28[_0xd004('0x1d')][_0xd004('0x21')]?_[_0xd004('0x22')](_0x5dce28[_0xd004('0x1d')][_0xd004('0x21')],function(_0x2cb7de){return{'model':db[_0x2cb7de[_0xd004('0x23')]],'as':_0x2cb7de['as'],'attributes':_0x2cb7de['attributes'],'include':_0x2cb7de[_0xd004('0x21')]?_['map'](_0x2cb7de[_0xd004('0x21')],function(_0x43593f){return{'model':db[_0x43593f[_0xd004('0x23')]],'as':_0x43593f['as'],'attributes':_0x43593f['attributes'],'include':_0x43593f[_0xd004('0x21')]?_[_0xd004('0x22')](_0x43593f['include'],function(_0x3f9879){return{'model':db[_0x3f9879[_0xd004('0x23')]],'as':_0x3f9879['as'],'attributes':_0x3f9879[_0xd004('0x20')]};}):[]};}):[]};}):[]:[]})[_0xd004('0x11')](function(_0x329023){logger[_0xd004('0x12')](_0xd004('0x1b'),_0x5dce28);logger['debug'](_0xd004('0x1b'),_0x5dce28,JSON[_0xd004('0x24')](_0x329023));_0x3a6443(_0x329023);})[_0xd004('0x1a')](function(_0x16766b){logger[_0xd004('0x17')]('ShowWhatsappAccount',_0x16766b['message'],_0x5dce28);_0x101ee1(_0x1ea205[_0xd004('0x17')](0x1f4,_0x16766b[_0xd004('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 72b3d98..db47e61 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 _0x975a=['update','emit','removeListener','register','whatsappAccount:','./whatsappAccount.events','save'];(function(_0x17adff,_0x1e2b1c){var _0x384dde=function(_0x213a45){while(--_0x213a45){_0x17adff['push'](_0x17adff['shift']());}};_0x384dde(++_0x1e2b1c);}(_0x975a,0x17f));var _0xa975=function(_0x435c01,_0x2d8d13){_0x435c01=_0x435c01-0x0;var _0x1c9031=_0x975a[_0x435c01];return _0x1c9031;};'use strict';var WhatsappAccountEvents=require(_0xa975('0x0'));var events=[_0xa975('0x1'),'remove',_0xa975('0x2')];function createListener(_0x466fe6,_0x3507b0){return function(_0x3f130e){_0x3507b0[_0xa975('0x3')](_0x466fe6,_0x3f130e);};}function removeListener(_0x3c87ca,_0x5a07b3){return function(){WhatsappAccountEvents[_0xa975('0x4')](_0x3c87ca,_0x5a07b3);};}exports[_0xa975('0x5')]=function(_0x387f2b){for(var _0x5202cc=0x0,_0x241224=events['length'];_0x5202cc<_0x241224;_0x5202cc++){var _0x427b07=events[_0x5202cc];var _0x59fe35=createListener(_0xa975('0x6')+_0x427b07,_0x387f2b);WhatsappAccountEvents['on'](_0x427b07,_0x59fe35);}}; \ No newline at end of file +var _0x4671=['whatsappAccount:','./whatsappAccount.events','remove','update','removeListener','register'];(function(_0x16dd47,_0xbdbafe){var _0xfc2bff=function(_0x15aa91){while(--_0x15aa91){_0x16dd47['push'](_0x16dd47['shift']());}};_0xfc2bff(++_0xbdbafe);}(_0x4671,0x97));var _0x1467=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x4671[_0xa464c9];return _0x3d73c4;};'use strict';var WhatsappAccountEvents=require(_0x1467('0x0'));var events=['save',_0x1467('0x1'),_0x1467('0x2')];function createListener(_0x528ea4,_0x4a4091){return function(_0x4bb63a){_0x4a4091['emit'](_0x528ea4,_0x4bb63a);};}function removeListener(_0x11c572,_0x9ee828){return function(){WhatsappAccountEvents[_0x1467('0x3')](_0x11c572,_0x9ee828);};}exports[_0x1467('0x4')]=function(_0x4eebde){for(var _0x24da17=0x0,_0x3672ec=events['length'];_0x24da17<_0x3672ec;_0x24da17++){var _0x414b8e=events[_0x24da17];var _0x2de754=createListener(_0x1467('0x5')+_0x414b8e,_0x4eebde);WhatsappAccountEvents['on'](_0x414b8e,_0x2de754);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index 943217d..bb0ba61 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 _0x6bd2=['path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get','isAuthenticated','index','/:id','show','post','create','update','delete','destroy','exports','multer','util'];(function(_0x3c39be,_0x270302){var _0x4fe58f=function(_0x3f7dbe){while(--_0x3f7dbe){_0x3c39be['push'](_0x3c39be['shift']());}};_0x4fe58f(++_0x270302);}(_0x6bd2,0xf5));var _0x26bd=function(_0x17a743,_0x108a32){_0x17a743=_0x17a743-0x0;var _0x2a27a9=_0x6bd2[_0x17a743];return _0x2a27a9;};'use strict';var multer=require(_0x26bd('0x0'));var util=require(_0x26bd('0x1'));var path=require(_0x26bd('0x2'));var timeout=require(_0x26bd('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x26bd('0x4'));var interaction=require(_0x26bd('0x5'));var config=require(_0x26bd('0x6'));var controller=require(_0x26bd('0x7'));router[_0x26bd('0x8')]('/',auth[_0x26bd('0x9')](),controller[_0x26bd('0xa')]);router[_0x26bd('0x8')](_0x26bd('0xb'),auth['isAuthenticated'](),controller[_0x26bd('0xc')]);router[_0x26bd('0xd')]('/',auth['isAuthenticated'](),controller[_0x26bd('0xe')]);router['put'](_0x26bd('0xb'),auth['isAuthenticated'](),controller[_0x26bd('0xf')]);router[_0x26bd('0x10')](_0x26bd('0xb'),auth[_0x26bd('0x9')](),controller[_0x26bd('0x11')]);module[_0x26bd('0x12')]=router; \ No newline at end of file +var _0x904a=['util','connect-timeout','express','Router','../../config/environment','./whatsappApplication.controller','get','isAuthenticated','/:id','show','post','create','put','update','delete','exports','multer'];(function(_0x580ca6,_0x536e6d){var _0x429112=function(_0xecf6be){while(--_0xecf6be){_0x580ca6['push'](_0x580ca6['shift']());}};_0x429112(++_0x536e6d);}(_0x904a,0x65));var _0xa904=function(_0x4c1db4,_0x5548b7){_0x4c1db4=_0x4c1db4-0x0;var _0x3b463b=_0x904a[_0x4c1db4];return _0x3b463b;};'use strict';var multer=require(_0xa904('0x0'));var util=require(_0xa904('0x1'));var path=require('path');var timeout=require(_0xa904('0x2'));var express=require(_0xa904('0x3'));var router=express[_0xa904('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xa904('0x5'));var controller=require(_0xa904('0x6'));router[_0xa904('0x7')]('/',auth[_0xa904('0x8')](),controller['index']);router['get'](_0xa904('0x9'),auth[_0xa904('0x8')](),controller[_0xa904('0xa')]);router[_0xa904('0xb')]('/',auth[_0xa904('0x8')](),controller[_0xa904('0xc')]);router[_0xa904('0xd')]('/:id',auth[_0xa904('0x8')](),controller[_0xa904('0xe')]);router[_0xa904('0xf')](_0xa904('0x9'),auth[_0xa904('0x8')](),controller['destroy']);module[_0xa904('0x10')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index f5d9ce3..551c283 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 _0x26ac=['*,*,*,*','exports','INTEGER','noop','TEXT','STRING'];(function(_0x2ab14d,_0x2fc77e){var _0x5e2744=function(_0x241415){while(--_0x241415){_0x2ab14d['push'](_0x2ab14d['shift']());}};_0x5e2744(++_0x2fc77e);}(_0x26ac,0xeb));var _0xc26a=function(_0x3824f0,_0x168078){_0x3824f0=_0x3824f0-0x0;var _0x6cfd0e=_0x26ac[_0x3824f0];return _0x6cfd0e;};'use strict';var Sequelize=require('sequelize');module[_0xc26a('0x0')]={'priority':{'type':Sequelize[_0xc26a('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xc26a('0x2')},'appdata':{'type':Sequelize[_0xc26a('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xc26a('0x4')],'defaultValue':_0xc26a('0x5')}}; \ No newline at end of file +var _0xb73d=['sequelize','exports','INTEGER','STRING','noop','TEXT','*,*,*,*'];(function(_0x489793,_0x593d18){var _0x1b1858=function(_0x26b908){while(--_0x26b908){_0x489793['push'](_0x489793['shift']());}};_0x1b1858(++_0x593d18);}(_0xb73d,0xcb));var _0xdb73=function(_0x4ac743,_0x5bd1a6){_0x4ac743=_0x4ac743-0x0;var _0x150cf0=_0xb73d[_0x4ac743];return _0x150cf0;};'use strict';var Sequelize=require(_0xdb73('0x0'));module[_0xdb73('0x1')]={'priority':{'type':Sequelize[_0xdb73('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xdb73('0x3')],'allowNull':![],'defaultValue':_0xdb73('0x4')},'appdata':{'type':Sequelize[_0xdb73('0x5')]()},'description':{'type':Sequelize[_0xdb73('0x3')]},'interval':{'type':Sequelize[_0xdb73('0x3')],'defaultValue':_0xdb73('0x6')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 610d844..9d0d5e7 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 _0x7d37=['set','Content-Range','apply','reject','update','then','error','stack','name','send','index','map','WhatsappApplication','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','type','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','catch','show','rawAttributes','keys','find','create','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','to-csv','fs-extra','squel','crypto','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit'];(function(_0x3671e1,_0x2384cd){var _0x40eda6=function(_0xbba00f){while(--_0xbba00f){_0x3671e1['push'](_0x3671e1['shift']());}};_0x40eda6(++_0x2384cd);}(_0x7d37,0x1db));var _0x77d3=function(_0x4c1d61,_0x3d1cc0){_0x4c1d61=_0x4c1d61-0x0;var _0x3b470f=_0x7d37[_0x4c1d61];return _0x3b470f;};'use strict';var emlformat=require(_0x77d3('0x0'));var rimraf=require(_0x77d3('0x1'));var zipdir=require(_0x77d3('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x77d3('0x3'));var moment=require(_0x77d3('0x4'));var BPromise=require(_0x77d3('0x5'));var Mustache=require('mustache');var util=require(_0x77d3('0x6'));var path=require(_0x77d3('0x7'));var sox=require('sox');var csv=require(_0x77d3('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x77d3('0x9'));var _=require('lodash');var squel=require(_0x77d3('0xa'));var crypto=require(_0x77d3('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x77d3('0x8'));var querystring=require(_0x77d3('0xc'));var Papa=require('papaparse');var Redis=require(_0x77d3('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x77d3('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x77d3('0xf'));var logger=require('../../config/logger')(_0x77d3('0x10'));var utils=require(_0x77d3('0x11'));var config=require(_0x77d3('0x12'));var licenseUtil=require(_0x77d3('0x13'));var db=require(_0x77d3('0x14'))['db'];function respondWithStatusCode(_0xe69786,_0x34446e){_0x34446e=_0x34446e||0xcc;return function(_0x136304){if(_0x136304){return _0xe69786[_0x77d3('0x15')](_0x34446e);}return _0xe69786['status'](_0x34446e)[_0x77d3('0x16')]();};}function respondWithResult(_0x4a621e,_0x4f40fb){_0x4f40fb=_0x4f40fb||0xc8;return function(_0x5a9cdb){if(_0x5a9cdb){return _0x4a621e[_0x77d3('0x17')](_0x4f40fb)[_0x77d3('0x18')](_0x5a9cdb);}};}function respondWithFilteredResult(_0x2c722b,_0xb17484){return function(_0x891f26){if(_0x891f26){var _0x4d98a4=typeof _0xb17484[_0x77d3('0x19')]===_0x77d3('0x1a')&&typeof _0xb17484['limit']==='undefined';var _0xfe320e=_0x891f26[_0x77d3('0x1b')];var _0x60173f=_0x4d98a4?0x0:_0xb17484[_0x77d3('0x19')];var _0x144656=_0x4d98a4?_0x891f26[_0x77d3('0x1b')]:_0xb17484[_0x77d3('0x19')]+_0xb17484[_0x77d3('0x1c')];var _0x3e7203;if(_0x144656>=_0xfe320e){_0x144656=_0xfe320e;_0x3e7203=0xc8;}else{_0x3e7203=0xce;}_0x2c722b[_0x77d3('0x17')](_0x3e7203);return _0x2c722b[_0x77d3('0x1d')](_0x77d3('0x1e'),_0x60173f+'-'+_0x144656+'/'+_0xfe320e)[_0x77d3('0x18')](_0x891f26);}return null;};}function patchUpdates(_0x1af8a4){return function(_0x4366b6){try{jsonpatch[_0x77d3('0x1f')](_0x4366b6,_0x1af8a4,!![]);}catch(_0xc9008d){return BPromise[_0x77d3('0x20')](_0xc9008d);}return _0x4366b6['save']();};}function saveUpdates(_0x2acc21,_0x17d3a3){return function(_0x1504c7){if(_0x1504c7){return _0x1504c7[_0x77d3('0x21')](_0x2acc21)[_0x77d3('0x22')](function(_0x1541c1){return _0x1541c1;});}return null;};}function removeEntity(_0x12c085,_0x17e9f9){return function(_0x2c0861){if(_0x2c0861){return _0x2c0861['destroy']()[_0x77d3('0x22')](function(){_0x12c085['status'](0xcc)[_0x77d3('0x16')]();});}};}function handleEntityNotFound(_0x443aa6,_0x1f03a3){return function(_0x2a02c8){if(!_0x2a02c8){_0x443aa6[_0x77d3('0x15')](0x194);}return _0x2a02c8;};}function handleError(_0x18eb30,_0x5481cd){_0x5481cd=_0x5481cd||0x1f4;return function(_0x17c6c6){logger[_0x77d3('0x23')](_0x17c6c6[_0x77d3('0x24')]);if(_0x17c6c6[_0x77d3('0x25')]){delete _0x17c6c6[_0x77d3('0x25')];}_0x18eb30[_0x77d3('0x17')](_0x5481cd)[_0x77d3('0x26')](_0x17c6c6);};}exports[_0x77d3('0x27')]=function(_0x275eb5,_0x41b79d){var _0x59c650={},_0x3add49={},_0x35d7d6={'count':0x0,'rows':[]};var _0x5809d2=_[_0x77d3('0x28')](db[_0x77d3('0x29')]['rawAttributes'],function(_0x524f89){return{'name':_0x524f89[_0x77d3('0x2a')],'type':_0x524f89['type'][_0x77d3('0x2b')]};});_0x3add49[_0x77d3('0x2c')]=_[_0x77d3('0x28')](_0x5809d2,'name');_0x3add49['query']=_['keys'](_0x275eb5[_0x77d3('0x2d')]);_0x3add49[_0x77d3('0x2e')]=_[_0x77d3('0x2f')](_0x3add49[_0x77d3('0x2c')],_0x3add49[_0x77d3('0x2d')]);_0x59c650[_0x77d3('0x30')]=_[_0x77d3('0x2f')](_0x3add49[_0x77d3('0x2c')],qs['fields'](_0x275eb5['query'][_0x77d3('0x31')]));_0x59c650[_0x77d3('0x30')]=_0x59c650['attributes'][_0x77d3('0x32')]?_0x59c650['attributes']:_0x3add49[_0x77d3('0x2c')];if(!_0x275eb5[_0x77d3('0x2d')][_0x77d3('0x33')](_0x77d3('0x34'))){_0x59c650[_0x77d3('0x1c')]=qs['limit'](_0x275eb5['query'][_0x77d3('0x1c')]);_0x59c650[_0x77d3('0x19')]=qs[_0x77d3('0x19')](_0x275eb5[_0x77d3('0x2d')][_0x77d3('0x19')]);}_0x59c650[_0x77d3('0x35')]=qs[_0x77d3('0x36')](_0x275eb5[_0x77d3('0x2d')][_0x77d3('0x36')]);_0x59c650[_0x77d3('0x37')]=qs['filters'](_['pick'](_0x275eb5[_0x77d3('0x2d')],_0x3add49['filters']),_0x5809d2);if(_0x275eb5[_0x77d3('0x2d')]['filter']){_0x59c650[_0x77d3('0x37')]=_['merge'](_0x59c650[_0x77d3('0x37')],{'$or':_[_0x77d3('0x28')](_0x5809d2,function(_0x578ddb){if(_0x578ddb[_0x77d3('0x38')]!==_0x77d3('0x39')){var _0x519e80={};_0x519e80[_0x578ddb[_0x77d3('0x25')]]={'$like':'%'+_0x275eb5[_0x77d3('0x2d')][_0x77d3('0x3a')]+'%'};return _0x519e80;}})});}_0x59c650=_[_0x77d3('0x3b')]({},_0x59c650,_0x275eb5[_0x77d3('0x3c')]);var _0x412cb5={'where':_0x59c650[_0x77d3('0x37')]};return db[_0x77d3('0x29')]['count'](_0x412cb5)[_0x77d3('0x22')](function(_0x2ca4eb){_0x35d7d6[_0x77d3('0x1b')]=_0x2ca4eb;if(_0x275eb5[_0x77d3('0x2d')][_0x77d3('0x3d')]){_0x59c650[_0x77d3('0x3e')]=[{'all':!![]}];}return db[_0x77d3('0x29')][_0x77d3('0x3f')](_0x59c650);})[_0x77d3('0x22')](function(_0x28223f){_0x35d7d6[_0x77d3('0x40')]=_0x28223f;return _0x35d7d6;})[_0x77d3('0x22')](respondWithFilteredResult(_0x41b79d,_0x59c650))[_0x77d3('0x41')](handleError(_0x41b79d,null));};exports[_0x77d3('0x42')]=function(_0x553215,_0x316441){var _0x37ea08={'raw':!![],'where':{'id':_0x553215['params']['id']}},_0x17fd69={};_0x17fd69['model']=_['keys'](db[_0x77d3('0x29')][_0x77d3('0x43')]);_0x17fd69[_0x77d3('0x2d')]=_[_0x77d3('0x44')](_0x553215[_0x77d3('0x2d')]);_0x17fd69[_0x77d3('0x2e')]=_['intersection'](_0x17fd69['model'],_0x17fd69[_0x77d3('0x2d')]);_0x37ea08[_0x77d3('0x30')]=_[_0x77d3('0x2f')](_0x17fd69['model'],qs['fields'](_0x553215[_0x77d3('0x2d')][_0x77d3('0x31')]));_0x37ea08['attributes']=_0x37ea08[_0x77d3('0x30')]['length']?_0x37ea08['attributes']:_0x17fd69[_0x77d3('0x2c')];if(_0x553215[_0x77d3('0x2d')][_0x77d3('0x3d')]){_0x37ea08[_0x77d3('0x3e')]=[{'all':!![]}];}_0x37ea08=_[_0x77d3('0x3b')]({},_0x37ea08,_0x553215[_0x77d3('0x3c')]);return db[_0x77d3('0x29')][_0x77d3('0x45')](_0x37ea08)['then'](handleEntityNotFound(_0x316441,null))[_0x77d3('0x22')](respondWithResult(_0x316441,null))[_0x77d3('0x41')](handleError(_0x316441,null));};exports[_0x77d3('0x46')]=function(_0x1e2d39,_0x42b113){return db[_0x77d3('0x29')][_0x77d3('0x46')](_0x1e2d39[_0x77d3('0x47')],{})[_0x77d3('0x22')](respondWithResult(_0x42b113,0xc9))[_0x77d3('0x41')](handleError(_0x42b113,null));};exports['update']=function(_0x1ff0d5,_0x37e2f7){if(_0x1ff0d5['body']['id']){delete _0x1ff0d5['body']['id'];}return db['WhatsappApplication'][_0x77d3('0x45')]({'where':{'id':_0x1ff0d5['params']['id']}})[_0x77d3('0x22')](handleEntityNotFound(_0x37e2f7,null))[_0x77d3('0x22')](saveUpdates(_0x1ff0d5[_0x77d3('0x47')],null))[_0x77d3('0x22')](respondWithResult(_0x37e2f7,null))[_0x77d3('0x41')](handleError(_0x37e2f7,null));};exports['destroy']=function(_0x1b8917,_0x514688){return db[_0x77d3('0x29')]['find']({'where':{'id':_0x1b8917['params']['id']}})[_0x77d3('0x22')](handleEntityNotFound(_0x514688,null))['then'](removeEntity(_0x514688,null))[_0x77d3('0x41')](handleError(_0x514688,null));}; \ No newline at end of file +var _0x7d8a=['send','map','rawAttributes','key','model','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','WhatsappApplication','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','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/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','reject','save','update','then','destroy','end'];(function(_0x5c7c31,_0x22aa86){var _0x193fdf=function(_0x271ade){while(--_0x271ade){_0x5c7c31['push'](_0x5c7c31['shift']());}};_0x193fdf(++_0x22aa86);}(_0x7d8a,0x1ca));var _0xa7d8=function(_0x308213,_0x224541){_0x308213=_0x308213-0x0;var _0x2e1619=_0x7d8a[_0x308213];return _0x2e1619;};'use strict';var emlformat=require(_0xa7d8('0x0'));var rimraf=require(_0xa7d8('0x1'));var zipdir=require(_0xa7d8('0x2'));var jsonpatch=require(_0xa7d8('0x3'));var rp=require(_0xa7d8('0x4'));var moment=require(_0xa7d8('0x5'));var BPromise=require(_0xa7d8('0x6'));var Mustache=require(_0xa7d8('0x7'));var util=require(_0xa7d8('0x8'));var path=require(_0xa7d8('0x9'));var sox=require(_0xa7d8('0xa'));var csv=require(_0xa7d8('0xb'));var ejs=require(_0xa7d8('0xc'));var fs=require('fs');var fs_extra=require(_0xa7d8('0xd'));var _=require('lodash');var squel=require(_0xa7d8('0xe'));var crypto=require(_0xa7d8('0xf'));var jsforce=require(_0xa7d8('0x10'));var deskjs=require(_0xa7d8('0x11'));var toCsv=require(_0xa7d8('0xb'));var querystring=require('querystring');var Papa=require(_0xa7d8('0x12'));var Redis=require('ioredis');var authService=require(_0xa7d8('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xa7d8('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa7d8('0x15'))(_0xa7d8('0x16'));var utils=require('../../config/utils');var config=require(_0xa7d8('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xa7d8('0x18'))['db'];function respondWithStatusCode(_0x161829,_0x133a94){_0x133a94=_0x133a94||0xcc;return function(_0x47c76b){if(_0x47c76b){return _0x161829[_0xa7d8('0x19')](_0x133a94);}return _0x161829[_0xa7d8('0x1a')](_0x133a94)['end']();};}function respondWithResult(_0x5bfb1a,_0x5080d6){_0x5080d6=_0x5080d6||0xc8;return function(_0x379f6c){if(_0x379f6c){return _0x5bfb1a[_0xa7d8('0x1a')](_0x5080d6)[_0xa7d8('0x1b')](_0x379f6c);}};}function respondWithFilteredResult(_0x2d126b,_0x3452d0){return function(_0x2ae530){if(_0x2ae530){var _0x2bbaf4=typeof _0x3452d0[_0xa7d8('0x1c')]===_0xa7d8('0x1d')&&typeof _0x3452d0[_0xa7d8('0x1e')]===_0xa7d8('0x1d');var _0x5624d3=_0x2ae530[_0xa7d8('0x1f')];var _0x50d6a6=_0x2bbaf4?0x0:_0x3452d0[_0xa7d8('0x1c')];var _0x3af212=_0x2bbaf4?_0x2ae530['count']:_0x3452d0[_0xa7d8('0x1c')]+_0x3452d0[_0xa7d8('0x1e')];var _0x1236d9;if(_0x3af212>=_0x5624d3){_0x3af212=_0x5624d3;_0x1236d9=0xc8;}else{_0x1236d9=0xce;}_0x2d126b[_0xa7d8('0x1a')](_0x1236d9);return _0x2d126b['set'](_0xa7d8('0x20'),_0x50d6a6+'-'+_0x3af212+'/'+_0x5624d3)['json'](_0x2ae530);}return null;};}function patchUpdates(_0x33f117){return function(_0xa6614a){try{jsonpatch['apply'](_0xa6614a,_0x33f117,!![]);}catch(_0x381fca){return BPromise[_0xa7d8('0x21')](_0x381fca);}return _0xa6614a[_0xa7d8('0x22')]();};}function saveUpdates(_0x426a20,_0x46d9a9){return function(_0x488f7e){if(_0x488f7e){return _0x488f7e[_0xa7d8('0x23')](_0x426a20)[_0xa7d8('0x24')](function(_0x5e8acb){return _0x5e8acb;});}return null;};}function removeEntity(_0x2c33f8,_0x31afb8){return function(_0x4a3fd6){if(_0x4a3fd6){return _0x4a3fd6[_0xa7d8('0x25')]()[_0xa7d8('0x24')](function(){_0x2c33f8[_0xa7d8('0x1a')](0xcc)[_0xa7d8('0x26')]();});}};}function handleEntityNotFound(_0x1f49f6,_0x3f7bd7){return function(_0x2d3f0d){if(!_0x2d3f0d){_0x1f49f6['sendStatus'](0x194);}return _0x2d3f0d;};}function handleError(_0x2aed5b,_0x4a325b){_0x4a325b=_0x4a325b||0x1f4;return function(_0x1dcb71){logger['error'](_0x1dcb71['stack']);if(_0x1dcb71['name']){delete _0x1dcb71['name'];}_0x2aed5b[_0xa7d8('0x1a')](_0x4a325b)[_0xa7d8('0x27')](_0x1dcb71);};}exports['index']=function(_0x3fb24f,_0x23ca78){var _0x31b73d={},_0x54676b={},_0x4ea479={'count':0x0,'rows':[]};var _0xceee5a=_[_0xa7d8('0x28')](db['WhatsappApplication'][_0xa7d8('0x29')],function(_0x35b5e2){return{'name':_0x35b5e2['fieldName'],'type':_0x35b5e2['type'][_0xa7d8('0x2a')]};});_0x54676b[_0xa7d8('0x2b')]=_[_0xa7d8('0x28')](_0xceee5a,'name');_0x54676b['query']=_['keys'](_0x3fb24f[_0xa7d8('0x2c')]);_0x54676b[_0xa7d8('0x2d')]=_['intersection'](_0x54676b[_0xa7d8('0x2b')],_0x54676b['query']);_0x31b73d[_0xa7d8('0x2e')]=_['intersection'](_0x54676b[_0xa7d8('0x2b')],qs[_0xa7d8('0x2f')](_0x3fb24f[_0xa7d8('0x2c')]['fields']));_0x31b73d[_0xa7d8('0x2e')]=_0x31b73d[_0xa7d8('0x2e')][_0xa7d8('0x30')]?_0x31b73d[_0xa7d8('0x2e')]:_0x54676b[_0xa7d8('0x2b')];if(!_0x3fb24f[_0xa7d8('0x2c')][_0xa7d8('0x31')](_0xa7d8('0x32'))){_0x31b73d[_0xa7d8('0x1e')]=qs[_0xa7d8('0x1e')](_0x3fb24f[_0xa7d8('0x2c')]['limit']);_0x31b73d[_0xa7d8('0x1c')]=qs[_0xa7d8('0x1c')](_0x3fb24f[_0xa7d8('0x2c')][_0xa7d8('0x1c')]);}_0x31b73d[_0xa7d8('0x33')]=qs['sort'](_0x3fb24f[_0xa7d8('0x2c')][_0xa7d8('0x34')]);_0x31b73d[_0xa7d8('0x35')]=qs[_0xa7d8('0x2d')](_[_0xa7d8('0x36')](_0x3fb24f[_0xa7d8('0x2c')],_0x54676b[_0xa7d8('0x2d')]),_0xceee5a);if(_0x3fb24f[_0xa7d8('0x2c')][_0xa7d8('0x37')]){_0x31b73d[_0xa7d8('0x35')]=_[_0xa7d8('0x38')](_0x31b73d[_0xa7d8('0x35')],{'$or':_['map'](_0xceee5a,function(_0x5d5e73){if(_0x5d5e73[_0xa7d8('0x39')]!=='VIRTUAL'){var _0x25875b={};_0x25875b[_0x5d5e73['name']]={'$like':'%'+_0x3fb24f[_0xa7d8('0x2c')][_0xa7d8('0x37')]+'%'};return _0x25875b;}})});}_0x31b73d=_[_0xa7d8('0x38')]({},_0x31b73d,_0x3fb24f[_0xa7d8('0x3a')]);var _0x177164={'where':_0x31b73d['where']};return db[_0xa7d8('0x3b')]['count'](_0x177164)[_0xa7d8('0x24')](function(_0x53c436){_0x4ea479[_0xa7d8('0x1f')]=_0x53c436;if(_0x3fb24f[_0xa7d8('0x2c')][_0xa7d8('0x3c')]){_0x31b73d[_0xa7d8('0x3d')]=[{'all':!![]}];}return db[_0xa7d8('0x3b')][_0xa7d8('0x3e')](_0x31b73d);})[_0xa7d8('0x24')](function(_0x1b5e33){_0x4ea479[_0xa7d8('0x3f')]=_0x1b5e33;return _0x4ea479;})[_0xa7d8('0x24')](respondWithFilteredResult(_0x23ca78,_0x31b73d))[_0xa7d8('0x40')](handleError(_0x23ca78,null));};exports[_0xa7d8('0x41')]=function(_0x2a322f,_0x5181a9){var _0x506efa={'raw':!![],'where':{'id':_0x2a322f[_0xa7d8('0x42')]['id']}},_0x1e8896={};_0x1e8896[_0xa7d8('0x2b')]=_[_0xa7d8('0x43')](db[_0xa7d8('0x3b')]['rawAttributes']);_0x1e8896[_0xa7d8('0x2c')]=_[_0xa7d8('0x43')](_0x2a322f[_0xa7d8('0x2c')]);_0x1e8896[_0xa7d8('0x2d')]=_['intersection'](_0x1e8896['model'],_0x1e8896['query']);_0x506efa[_0xa7d8('0x2e')]=_['intersection'](_0x1e8896[_0xa7d8('0x2b')],qs[_0xa7d8('0x2f')](_0x2a322f[_0xa7d8('0x2c')]['fields']));_0x506efa['attributes']=_0x506efa[_0xa7d8('0x2e')][_0xa7d8('0x30')]?_0x506efa[_0xa7d8('0x2e')]:_0x1e8896[_0xa7d8('0x2b')];if(_0x2a322f[_0xa7d8('0x2c')][_0xa7d8('0x3c')]){_0x506efa[_0xa7d8('0x3d')]=[{'all':!![]}];}_0x506efa=_[_0xa7d8('0x38')]({},_0x506efa,_0x2a322f[_0xa7d8('0x3a')]);return db[_0xa7d8('0x3b')][_0xa7d8('0x44')](_0x506efa)[_0xa7d8('0x24')](handleEntityNotFound(_0x5181a9,null))['then'](respondWithResult(_0x5181a9,null))[_0xa7d8('0x40')](handleError(_0x5181a9,null));};exports['create']=function(_0xd09bfd,_0x5666e6){return db[_0xa7d8('0x3b')][_0xa7d8('0x45')](_0xd09bfd[_0xa7d8('0x46')],{})[_0xa7d8('0x24')](respondWithResult(_0x5666e6,0xc9))[_0xa7d8('0x40')](handleError(_0x5666e6,null));};exports[_0xa7d8('0x23')]=function(_0x5e1f8d,_0x193e54){if(_0x5e1f8d[_0xa7d8('0x46')]['id']){delete _0x5e1f8d['body']['id'];}return db['WhatsappApplication']['find']({'where':{'id':_0x5e1f8d['params']['id']}})[_0xa7d8('0x24')](handleEntityNotFound(_0x193e54,null))['then'](saveUpdates(_0x5e1f8d[_0xa7d8('0x46')],null))[_0xa7d8('0x24')](respondWithResult(_0x193e54,null))[_0xa7d8('0x40')](handleError(_0x193e54,null));};exports['destroy']=function(_0x5c164d,_0x5c3ee3){return db[_0xa7d8('0x3b')][_0xa7d8('0x44')]({'where':{'id':_0x5c164d[_0xa7d8('0x42')]['id']}})[_0xa7d8('0x24')](handleEntityNotFound(_0x5c3ee3,null))[_0xa7d8('0x24')](removeEntity(_0x5c3ee3,null))[_0xa7d8('0x40')](handleError(_0x5c3ee3,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index 115e038..0047c61 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 _0xca9e=['WhatsappApplication','whatsapp_applications','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappApplication.attributes','exports'];(function(_0x483e3a,_0x568361){var _0x43fca9=function(_0x273d7e){while(--_0x273d7e){_0x483e3a['push'](_0x483e3a['shift']());}};_0x43fca9(++_0x568361);}(_0xca9e,0x136));var _0xeca9=function(_0xa55c47,_0x41fd11){_0xa55c47=_0xa55c47-0x0;var _0xbf49b5=_0xca9e[_0xa55c47];return _0xbf49b5;};'use strict';var _=require(_0xeca9('0x0'));var util=require(_0xeca9('0x1'));var logger=require(_0xeca9('0x2'))(_0xeca9('0x3'));var moment=require(_0xeca9('0x4'));var BPromise=require(_0xeca9('0x5'));var rp=require(_0xeca9('0x6'));var fs=require('fs');var path=require(_0xeca9('0x7'));var rimraf=require(_0xeca9('0x8'));var config=require(_0xeca9('0x9'));var attributes=require(_0xeca9('0xa'));module[_0xeca9('0xb')]=function(_0x186a47,_0x305dc5){return _0x186a47['define'](_0xeca9('0xc'),attributes,{'tableName':_0xeca9('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xb2b5=['utf8mb4_unicode_ci','moment','bluebird','rimraf','../../config/environment','./whatsappApplication.attributes','exports','define','utf8mb4'];(function(_0x208ff7,_0x12129a){var _0x266751=function(_0xc816a1){while(--_0xc816a1){_0x208ff7['push'](_0x208ff7['shift']());}};_0x266751(++_0x12129a);}(_0xb2b5,0xa3));var _0x5b2b=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0xb2b5[_0x1694f5];return _0x5b4321;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x5b2b('0x0'));var BPromise=require(_0x5b2b('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x5b2b('0x2'));var config=require(_0x5b2b('0x3'));var attributes=require(_0x5b2b('0x4'));module[_0x5b2b('0x5')]=function(_0x49d9f6,_0x30c3e2){return _0x49d9f6[_0x5b2b('0x6')]('WhatsappApplication',attributes,{'tableName':'whatsapp_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x5b2b('0x7'),'collate':_0x5b2b('0x8')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index 91da43f..3df685d 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 _0xdace=['request\x20sent','debug','stringify','error','code','WhatsappApplication,\x20%s,\x20%s','message','info','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdace,0xc5));var _0xedac=function(_0x1d24eb,_0x12295b){_0x1d24eb=_0x1d24eb-0x0;var _0x1dc576=_0xdace[_0x1d24eb];return _0x1dc576;};'use strict';var _=require(_0xedac('0x0'));var util=require('util');var moment=require(_0xedac('0x1'));var BPromise=require(_0xedac('0x2'));var rs=require(_0xedac('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xedac('0x4'))['db'];var utils=require(_0xedac('0x5'));var logger=require(_0xedac('0x6'))(_0xedac('0x7'));var config=require('../../config/environment');var jayson=require(_0xedac('0x8'));var client=jayson[_0xedac('0x9')][_0xedac('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5ecbd3,_0x4081c6,_0x21440e){return new BPromise(function(_0x162eea,_0x53fa43){return client[_0xedac('0xb')](_0x5ecbd3,_0x21440e)[_0xedac('0xc')](function(_0xc98887){logger['info']('WhatsappApplication,\x20%s,\x20%s',_0x4081c6,_0xedac('0xd'));logger[_0xedac('0xe')]('WhatsappApplication,\x20%s,\x20%s,\x20%s',_0x4081c6,'request\x20sent',JSON[_0xedac('0xf')](_0xc98887));if(_0xc98887[_0xedac('0x10')]){if(_0xc98887['error'][_0xedac('0x11')]===0x1f4){logger['error'](_0xedac('0x12'),_0x4081c6,_0xc98887[_0xedac('0x10')][_0xedac('0x13')]);return _0x53fa43(_0xc98887[_0xedac('0x10')][_0xedac('0x13')]);}logger[_0xedac('0x10')](_0xedac('0x12'),_0x4081c6,_0xc98887[_0xedac('0x10')]['message']);return _0x162eea(_0xc98887[_0xedac('0x10')][_0xedac('0x13')]);}else{logger[_0xedac('0x14')](_0xedac('0x12'),_0x4081c6,_0xedac('0xd'));_0x162eea(_0xc98887['result'][_0xedac('0x13')]);}})['catch'](function(_0xddc7b8){logger[_0xedac('0x10')](_0xedac('0x12'),_0x4081c6,_0xddc7b8);_0x53fa43(_0xddc7b8);});});} \ No newline at end of file +var _0x70e0=['code','WhatsappApplication,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x18759e,_0x5d04d4){var _0x19bb77=function(_0x4b45ca){while(--_0x4b45ca){_0x18759e['push'](_0x18759e['shift']());}};_0x19bb77(++_0x5d04d4);}(_0x70e0,0x17b));var _0x070e=function(_0x127123,_0x25fcb){_0x127123=_0x127123-0x0;var _0x403166=_0x70e0[_0x127123];return _0x403166;};'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')]('WhatsappApplication,\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')]('WhatsappApplication,\x20%s,\x20%s',_0x5032e5,_0x68a09e['error']['message']);return _0x1e11f0(_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);}else{logger['info']('WhatsappApplication,\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/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index 81a857e..111e232 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 _0x9505=['describe','/:id','show','/:id/messages','/:id/download','post','create','addMessage','/:id/tags','tracked','whatsapp','whatsappinteraction:addtags','addTags','put','whatsappinteraction:update','update','whatsappinteraction:destroy','destroy','removeTags','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','./whatsappInteraction.controller','get','isAuthenticated','index'];(function(_0x17e143,_0x5e21d2){var _0x5b8c89=function(_0x51df2d){while(--_0x51df2d){_0x17e143['push'](_0x17e143['shift']());}};_0x5b8c89(++_0x5e21d2);}(_0x9505,0x1e5));var _0x5950=function(_0x68b1e,_0x5d8768){_0x68b1e=_0x68b1e-0x0;var _0x25361b=_0x9505[_0x68b1e];return _0x25361b;};'use strict';var multer=require(_0x5950('0x0'));var util=require(_0x5950('0x1'));var path=require('path');var timeout=require(_0x5950('0x2'));var express=require(_0x5950('0x3'));var router=express[_0x5950('0x4')]();var fs_extra=require(_0x5950('0x5'));var auth=require(_0x5950('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x5950('0x7'));router[_0x5950('0x8')]('/',auth[_0x5950('0x9')](),controller[_0x5950('0xa')]);router['get']('/describe',auth[_0x5950('0x9')](),controller[_0x5950('0xb')]);router[_0x5950('0x8')](_0x5950('0xc'),auth[_0x5950('0x9')](),controller[_0x5950('0xd')]);router[_0x5950('0x8')](_0x5950('0xe'),auth[_0x5950('0x9')](),controller['getMessages']);router[_0x5950('0x8')](_0x5950('0xf'),auth['isAuthenticated'](),controller['download']);router[_0x5950('0x10')]('/',auth[_0x5950('0x9')](),controller[_0x5950('0x11')]);router[_0x5950('0x10')](_0x5950('0xe'),auth[_0x5950('0x9')](),controller[_0x5950('0x12')]);router[_0x5950('0x10')](_0x5950('0x13'),auth[_0x5950('0x9')](),interaction[_0x5950('0x14')](_0x5950('0x15'),_0x5950('0x16')),controller[_0x5950('0x17')]);router[_0x5950('0x18')](_0x5950('0xc'),auth[_0x5950('0x9')](),interaction[_0x5950('0x14')](_0x5950('0x15'),_0x5950('0x19')),controller[_0x5950('0x1a')]);router['delete']('/:id',auth[_0x5950('0x9')](),interaction[_0x5950('0x14')](_0x5950('0x15'),_0x5950('0x1b')),controller[_0x5950('0x1c')]);router['delete']('/:id/tags',auth[_0x5950('0x9')](),controller[_0x5950('0x1d')]);module[_0x5950('0x1e')]=router; \ No newline at end of file +var _0x39e6=['/describe','describe','/:id','show','/:id/messages','getMessages','download','post','create','/:id/tags','tracked','whatsapp','whatsappinteraction:addtags','put','whatsappinteraction:update','delete','whatsappinteraction:destroy','removeTags','multer','path','Router','fs-extra','../../components/interaction/service','../../config/environment','./whatsappInteraction.controller','get','isAuthenticated','index'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x39e6,0x9e));var _0x639e=function(_0x2ff9ae,_0x53aaa3){_0x2ff9ae=_0x2ff9ae-0x0;var _0x546ca2=_0x39e6[_0x2ff9ae];return _0x546ca2;};'use strict';var multer=require(_0x639e('0x0'));var util=require('util');var path=require(_0x639e('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x639e('0x2')]();var fs_extra=require(_0x639e('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x639e('0x4'));var config=require(_0x639e('0x5'));var controller=require(_0x639e('0x6'));router[_0x639e('0x7')]('/',auth[_0x639e('0x8')](),controller[_0x639e('0x9')]);router[_0x639e('0x7')](_0x639e('0xa'),auth[_0x639e('0x8')](),controller[_0x639e('0xb')]);router[_0x639e('0x7')](_0x639e('0xc'),auth[_0x639e('0x8')](),controller[_0x639e('0xd')]);router[_0x639e('0x7')](_0x639e('0xe'),auth[_0x639e('0x8')](),controller[_0x639e('0xf')]);router['get']('/:id/download',auth[_0x639e('0x8')](),controller[_0x639e('0x10')]);router[_0x639e('0x11')]('/',auth[_0x639e('0x8')](),controller[_0x639e('0x12')]);router[_0x639e('0x11')](_0x639e('0xe'),auth['isAuthenticated'](),controller['addMessage']);router[_0x639e('0x11')](_0x639e('0x13'),auth[_0x639e('0x8')](),interaction[_0x639e('0x14')](_0x639e('0x15'),_0x639e('0x16')),controller['addTags']);router[_0x639e('0x17')](_0x639e('0xc'),auth[_0x639e('0x8')](),interaction[_0x639e('0x14')]('whatsapp',_0x639e('0x18')),controller['update']);router[_0x639e('0x19')](_0x639e('0xc'),auth[_0x639e('0x8')](),interaction[_0x639e('0x14')](_0x639e('0x15'),_0x639e('0x1a')),controller['destroy']);router[_0x639e('0x19')](_0x639e('0x13'),auth[_0x639e('0x8')](),controller[_0x639e('0x1b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index 65f2154..448c6a0 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 _0x9582=['BOOLEAN','DATE','STRING','ENUM','out','sequelize','moment','exports'];(function(_0x406518,_0x1df24f){var _0x1e17e9=function(_0x1d8819){while(--_0x1d8819){_0x406518['push'](_0x406518['shift']());}};_0x1e17e9(++_0x1df24f);}(_0x9582,0x95));var _0x2958=function(_0x4ae99e,_0x1a3cf9){_0x4ae99e=_0x4ae99e-0x0;var _0x2ab569=_0x9582[_0x4ae99e];return _0x2ab569;};'use strict';var Sequelize=require(_0x2958('0x0'));var moment=require(_0x2958('0x1'));module[_0x2958('0x2')]={'closed':{'type':Sequelize[_0x2958('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x2958('0x4')]},'disposition':{'type':Sequelize[_0x2958('0x5')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x2958('0x5')]},'note':{'type':Sequelize[_0x2958('0x5')]},'phone':{'type':Sequelize[_0x2958('0x5')]},'read1stAt':{'type':Sequelize[_0x2958('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x2958('0x6')]('in',_0x2958('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x2958('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x2958('0x6')]('in',_0x2958('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x2958('0x3')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xd824=['DATE','STRING','out','BOOLEAN','INTEGER','sequelize','moment'];(function(_0x1cb384,_0x59c92d){var _0x10e25e=function(_0x274ca7){while(--_0x274ca7){_0x1cb384['push'](_0x1cb384['shift']());}};_0x10e25e(++_0x59c92d);}(_0xd824,0xc2));var _0x4d82=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xd824[_0xfae23b];return _0x200640;};'use strict';var Sequelize=require(_0x4d82('0x0'));var moment=require(_0x4d82('0x1'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x4d82('0x2')]},'disposition':{'type':Sequelize[_0x4d82('0x3')]},'secondDisposition':{'type':Sequelize[_0x4d82('0x3')]},'thirdDisposition':{'type':Sequelize[_0x4d82('0x3')]},'note':{'type':Sequelize[_0x4d82('0x3')]},'phone':{'type':Sequelize[_0x4d82('0x3')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x4d82('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x4d82('0x4')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x4d82('0x5')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x4d82('0x6')]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index 4169553..b90a7ea 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 _0xfcb9=['whatsapp','query','user','catch','show','params','model','keys','filters','intersection','attributes','fields','length','options','find','body','describe','addMessage','WhatsappMessage','omit','getMessages','hasOwnProperty','nolimit','order','sort','where','WhatsappInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','merge','includeAll','include','rows','Tag','color','ids','emit','whatsappInteractionTags:save','removeTags','download','unix','join','root','server','tmp','files','push','User','fullname','CmContact','Contact','firstName','lastName','attachments','Attachment','Messages','direction','secret','read','WhatsappAccount','Account','get','mkdirSync','Whatsapp','Owner','toString','disposition','basename','existsSync','createReadStream','pipe','out','System','value','views','downloadInteraction.ejs','transcript-','createPdfFromHTML','log','err','unlinkSync','rimraf','zip-dir','moment','bluebird','util','path','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../mysqldb','redis','localhost','socket.io-emitter','./whatsappInteraction.socket','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','error','stack','name','index','map','WhatsappInteraction','rawAttributes','fieldName','type','findAll'];(function(_0x1a931c,_0x33016c){var _0x257e3e=function(_0x2f94af){while(--_0x2f94af){_0x1a931c['push'](_0x1a931c['shift']());}};_0x257e3e(++_0x33016c);}(_0xfcb9,0x14e));var _0x9fcb=function(_0x34b50f,_0x13863e){_0x34b50f=_0x34b50f-0x0;var _0x112b6f=_0xfcb9[_0x34b50f];return _0x112b6f;};'use strict';var rimraf=require(_0x9fcb('0x0'));var zipdir=require(_0x9fcb('0x1'));var moment=require(_0x9fcb('0x2'));var BPromise=require(_0x9fcb('0x3'));var util=require(_0x9fcb('0x4'));var path=require(_0x9fcb('0x5'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x9fcb('0x6'));var Redis=require(_0x9fcb('0x7'));var interaction=require(_0x9fcb('0x8'));var qs=require(_0x9fcb('0x9'));var pdf=require(_0x9fcb('0xa'));var logger=require(_0x9fcb('0xb'))(_0x9fcb('0xc'));var config=require('../../config/environment');var db=require(_0x9fcb('0xd'))['db'];config['redis']=_['defaults'](config[_0x9fcb('0xe')],{'host':_0x9fcb('0xf'),'port':0x18eb});var socket=require(_0x9fcb('0x10'))(new Redis(config['redis']));require(_0x9fcb('0x11'))['register'](socket);function respondWithStatusCode(_0x223ae2,_0x3d2205){_0x3d2205=_0x3d2205||0xcc;return function(_0x5f30a7){if(_0x5f30a7){return _0x223ae2[_0x9fcb('0x12')](_0x3d2205);}return _0x223ae2[_0x9fcb('0x13')](_0x3d2205)[_0x9fcb('0x14')]();};}function respondWithResult(_0x5b9d9f,_0xc20283){_0xc20283=_0xc20283||0xc8;return function(_0x151d1b){if(_0x151d1b){return _0x5b9d9f[_0x9fcb('0x13')](_0xc20283)[_0x9fcb('0x15')](_0x151d1b);}};}function respondWithFilteredResult(_0x11700f,_0x3b4975){return function(_0x241d22){if(_0x241d22){var _0x41b296=typeof _0x3b4975[_0x9fcb('0x16')]===_0x9fcb('0x17')&&typeof _0x3b4975[_0x9fcb('0x18')]===_0x9fcb('0x17');var _0x29cce9=_0x241d22[_0x9fcb('0x19')];var _0x91e0b4=_0x41b296?0x0:_0x3b4975[_0x9fcb('0x16')];var _0x28a764=_0x41b296?_0x241d22[_0x9fcb('0x19')]:_0x3b4975[_0x9fcb('0x16')]+_0x3b4975['limit'];var _0x3e3e78;if(_0x28a764>=_0x29cce9){_0x28a764=_0x29cce9;_0x3e3e78=0xc8;}else{_0x3e3e78=0xce;}_0x11700f['status'](_0x3e3e78);return _0x11700f[_0x9fcb('0x1a')](_0x9fcb('0x1b'),_0x91e0b4+'-'+_0x28a764+'/'+_0x29cce9)['json'](_0x241d22);}return null;};}function saveUpdates(_0xdb05de){return function(_0xf2af1f){if(_0xf2af1f){return _0xf2af1f[_0x9fcb('0x1c')](_0xdb05de)[_0x9fcb('0x1d')](function(_0x20fe65){return _0x20fe65;});}return null;};}function removeEntity(_0x1c24a2){return function(_0x426757){if(_0x426757){return _0x426757[_0x9fcb('0x1e')]()[_0x9fcb('0x1d')](function(){_0x1c24a2['status'](0xcc)[_0x9fcb('0x14')]();});}};}function handleEntityNotFound(_0x56833f){return function(_0xd0a7b7){if(!_0xd0a7b7){_0x56833f[_0x9fcb('0x12')](0x194);}return _0xd0a7b7;};}function handleError(_0x54d216,_0x2d43a7){_0x2d43a7=_0x2d43a7||0x1f4;return function(_0x5ba168){logger[_0x9fcb('0x1f')](_0x5ba168[_0x9fcb('0x20')]);if(_0x5ba168[_0x9fcb('0x21')]){delete _0x5ba168[_0x9fcb('0x21')];}_0x54d216[_0x9fcb('0x13')](_0x2d43a7)['send'](_0x5ba168);};}exports[_0x9fcb('0x22')]=function(_0x182d66,_0x3cb677){var _0x2189df={};var _0x5d8386=_[_0x9fcb('0x23')](db[_0x9fcb('0x24')][_0x9fcb('0x25')],function(_0x38418a){return{'name':_0x38418a[_0x9fcb('0x26')],'type':_0x38418a[_0x9fcb('0x27')]['key']};});_0x2189df=qs['getOptions'](_0x5d8386,_0x182d66);return interaction[_0x9fcb('0x28')](_0x9fcb('0x29'),_0x182d66[_0x9fcb('0x2a')],_0x182d66[_0x9fcb('0x2b')],_0x2189df,_0x5d8386)[_0x9fcb('0x1d')](respondWithFilteredResult(_0x3cb677,_0x2189df))[_0x9fcb('0x2c')](handleError(_0x3cb677,null));};exports[_0x9fcb('0x2d')]=function(_0x57fb7b,_0x18447a){var _0x127f0e={'raw':![],'where':{'id':_0x57fb7b[_0x9fcb('0x2e')]['id']}},_0x321d0c={};_0x321d0c[_0x9fcb('0x2f')]=_[_0x9fcb('0x30')](db[_0x9fcb('0x24')][_0x9fcb('0x25')]);_0x321d0c['query']=_[_0x9fcb('0x30')](_0x57fb7b[_0x9fcb('0x2a')]);_0x321d0c[_0x9fcb('0x31')]=_[_0x9fcb('0x32')](_0x321d0c[_0x9fcb('0x2f')],_0x321d0c[_0x9fcb('0x2a')]);_0x127f0e[_0x9fcb('0x33')]=_[_0x9fcb('0x32')](_0x321d0c[_0x9fcb('0x2f')],qs[_0x9fcb('0x34')](_0x57fb7b[_0x9fcb('0x2a')][_0x9fcb('0x34')]));_0x127f0e[_0x9fcb('0x33')]=_0x127f0e[_0x9fcb('0x33')][_0x9fcb('0x35')]?_0x127f0e[_0x9fcb('0x33')]:_0x321d0c[_0x9fcb('0x2f')];if(_0x57fb7b[_0x9fcb('0x2a')]['includeAll']){_0x127f0e['include']=[{'all':!![]}];}_0x127f0e=_['merge']({},_0x127f0e,_0x57fb7b[_0x9fcb('0x36')]);return db[_0x9fcb('0x24')][_0x9fcb('0x37')](_0x127f0e)[_0x9fcb('0x1d')](handleEntityNotFound(_0x18447a,null))[_0x9fcb('0x1d')](respondWithResult(_0x18447a,null))[_0x9fcb('0x2c')](handleError(_0x18447a,null));};exports['create']=function(_0x446eda,_0x1647b4){return db[_0x9fcb('0x24')]['create'](_0x446eda[_0x9fcb('0x38')],{})['then'](respondWithResult(_0x1647b4,0xc9))['catch'](handleError(_0x1647b4,null));};exports['update']=function(_0x2b58ef,_0x27be16){if(_0x2b58ef[_0x9fcb('0x38')]['id']){delete _0x2b58ef[_0x9fcb('0x38')]['id'];}return db[_0x9fcb('0x24')][_0x9fcb('0x37')]({'where':{'id':_0x2b58ef[_0x9fcb('0x2e')]['id']}})[_0x9fcb('0x1d')](handleEntityNotFound(_0x27be16,null))[_0x9fcb('0x1d')](saveUpdates(_0x2b58ef['body'],null))[_0x9fcb('0x1d')](respondWithResult(_0x27be16,null))[_0x9fcb('0x2c')](handleError(_0x27be16,null));};exports[_0x9fcb('0x1e')]=function(_0x30053e,_0x2619db){return db[_0x9fcb('0x24')]['find']({'where':{'id':_0x30053e[_0x9fcb('0x2e')]['id']}})[_0x9fcb('0x1d')](handleEntityNotFound(_0x2619db,null))[_0x9fcb('0x1d')](removeEntity(_0x2619db,null))[_0x9fcb('0x2c')](handleError(_0x2619db,null));};exports[_0x9fcb('0x39')]=function(_0x5a2872,_0x153104){return db['WhatsappInteraction'][_0x9fcb('0x39')]()['then'](respondWithResult(_0x153104,null))[_0x9fcb('0x2c')](handleError(_0x153104,null));};exports[_0x9fcb('0x3a')]=function(_0x73365c,_0x35ead2){return db[_0x9fcb('0x3b')][_0x9fcb('0x37')]({'where':{'id':_0x73365c[_0x9fcb('0x2e')]['id']}})['then'](handleEntityNotFound(_0x35ead2,null))[_0x9fcb('0x1d')](function(_0x585da7){if(_0x585da7){return _0x585da7[_0x9fcb('0x3a')](_0x73365c[_0x9fcb('0x38')]['ids'],_[_0x9fcb('0x3c')](_0x73365c[_0x9fcb('0x38')],['ids','id'])||{});}})[_0x9fcb('0x1d')](respondWithResult(_0x35ead2,null))[_0x9fcb('0x2c')](handleError(_0x35ead2,null));};exports[_0x9fcb('0x3d')]=function(_0x21c3d7,_0x381c9e){var _0x38405e={'raw':![],'where':{}};var _0x4f3262={};var _0x2d7cdc={'count':0x0,'rows':[]};return db[_0x9fcb('0x24')]['findOne']({'where':{'id':_0x21c3d7[_0x9fcb('0x2e')]['id']}})[_0x9fcb('0x1d')](handleEntityNotFound(_0x381c9e,null))[_0x9fcb('0x1d')](function(_0x190b9a){if(_0x190b9a){_0x4f3262[_0x9fcb('0x2f')]=_[_0x9fcb('0x30')](db[_0x9fcb('0x3b')][_0x9fcb('0x25')]);_0x4f3262[_0x9fcb('0x2a')]=_['keys'](_0x21c3d7[_0x9fcb('0x2a')]);_0x4f3262[_0x9fcb('0x31')]=_[_0x9fcb('0x32')](_0x4f3262[_0x9fcb('0x2f')],_0x4f3262[_0x9fcb('0x2a')]);_0x38405e[_0x9fcb('0x33')]=_[_0x9fcb('0x32')](_0x4f3262[_0x9fcb('0x2f')],qs['fields'](_0x21c3d7['query'][_0x9fcb('0x34')]));_0x38405e[_0x9fcb('0x33')]=_0x38405e[_0x9fcb('0x33')][_0x9fcb('0x35')]?_0x38405e[_0x9fcb('0x33')]:_0x4f3262[_0x9fcb('0x2f')];if(!_0x21c3d7[_0x9fcb('0x2a')][_0x9fcb('0x3e')](_0x9fcb('0x3f'))){_0x38405e[_0x9fcb('0x18')]=qs[_0x9fcb('0x18')](_0x21c3d7[_0x9fcb('0x2a')][_0x9fcb('0x18')]);_0x38405e[_0x9fcb('0x16')]=qs[_0x9fcb('0x16')](_0x21c3d7[_0x9fcb('0x2a')][_0x9fcb('0x16')]);}_0x38405e[_0x9fcb('0x40')]=qs[_0x9fcb('0x41')](_0x21c3d7[_0x9fcb('0x2a')][_0x9fcb('0x41')]);_0x38405e[_0x9fcb('0x42')]=qs[_0x9fcb('0x31')](_['pick'](_0x21c3d7[_0x9fcb('0x2a')],_0x4f3262[_0x9fcb('0x31')]));_0x38405e[_0x9fcb('0x42')][_0x9fcb('0x43')]=_0x190b9a['id'];if(_0x21c3d7['query'][_0x9fcb('0x44')]){_0x38405e['where']=_['merge'](_0x38405e[_0x9fcb('0x42')],{'$or':_[_0x9fcb('0x23')](_0x38405e[_0x9fcb('0x33')],function(_0x3a34dc){var _0xcab9a1={};_0xcab9a1[_0x3a34dc]={'$like':'%'+_0x21c3d7['query'][_0x9fcb('0x44')]+'%'};return _0xcab9a1;})});}if(_0x21c3d7['query'][_0x9fcb('0x45')]){var _0x468a95=_0x21c3d7[_0x9fcb('0x2a')][_0x9fcb('0x45')][_0x9fcb('0x46')](',');var _0x5d0b79={};_0x5d0b79[_0x468a95[0x0]]={'$gte':moment(_0x468a95[0x1])[_0x9fcb('0x47')](_0x9fcb('0x48'))};_0x38405e[_0x9fcb('0x42')]=_[_0x9fcb('0x49')](_0x38405e[_0x9fcb('0x42')],_0x5d0b79);}_0x38405e=_['merge']({},_0x38405e,_0x21c3d7[_0x9fcb('0x36')]);return db[_0x9fcb('0x3b')][_0x9fcb('0x19')]({'where':_0x38405e[_0x9fcb('0x42')]})[_0x9fcb('0x1d')](function(_0x428209){_0x2d7cdc[_0x9fcb('0x19')]=_0x428209;if(_0x21c3d7['query'][_0x9fcb('0x4a')]){_0x38405e[_0x9fcb('0x4b')]=[{'all':!![]}];}return db[_0x9fcb('0x3b')]['findAll'](_0x38405e);})[_0x9fcb('0x1d')](function(_0x3fb6a1){_0x2d7cdc[_0x9fcb('0x4c')]=_0x3fb6a1;return _0x2d7cdc;});}})[_0x9fcb('0x1d')](respondWithFilteredResult(_0x381c9e,_0x38405e))[_0x9fcb('0x2c')](handleError(_0x381c9e,null));};exports['addTags']=function(_0x17fc91,_0x598413){return db[_0x9fcb('0x24')][_0x9fcb('0x37')]({'where':{'id':_0x17fc91[_0x9fcb('0x2e')]['id']}})[_0x9fcb('0x1d')](handleEntityNotFound(_0x598413,null))[_0x9fcb('0x1d')](function(_0x47cb49){if(_0x47cb49){return _0x47cb49['setTags'](_0x17fc91[_0x9fcb('0x38')]['ids'],_[_0x9fcb('0x3c')](_0x17fc91[_0x9fcb('0x38')],['ids','id'])||{})['spread'](function(){return db[_0x9fcb('0x4d')][_0x9fcb('0x28')]({'attributes':['id','name',_0x9fcb('0x4e')],'where':{'id':_0x17fc91[_0x9fcb('0x38')][_0x9fcb('0x4f')]}});})['then'](function(_0x5876cd){socket[_0x9fcb('0x50')](_0x9fcb('0x51'),{'id':Number(_0x17fc91['params']['id']),'tags':_0x5876cd||[]});return{'id':Number(_0x17fc91['params']['id']),'tags':_0x5876cd||[]};});}})[_0x9fcb('0x1d')](respondWithResult(_0x598413,null))[_0x9fcb('0x2c')](handleError(_0x598413,null));};exports[_0x9fcb('0x52')]=function(_0x2e14db,_0x39f386){return db[_0x9fcb('0x24')]['find']({'where':{'id':_0x2e14db[_0x9fcb('0x2e')]['id']}})['then'](handleEntityNotFound(_0x39f386,null))['then'](function(_0x28e714){if(_0x28e714){return _0x28e714[_0x9fcb('0x52')](_0x2e14db[_0x9fcb('0x2a')]['ids']);}})[_0x9fcb('0x1d')](respondWithStatusCode(_0x39f386,null))['catch'](handleError(_0x39f386,null));};exports[_0x9fcb('0x53')]=function(_0xdae167,_0x3a48b4){var _0x1e402d=moment()[_0x9fcb('0x54')]()['toString']();var _0x1cfcb8=path[_0x9fcb('0x55')](config[_0x9fcb('0x56')],_0x9fcb('0x57'),'files',_0x9fcb('0x58'));var _0x457492=path['join'](config['root'],_0x9fcb('0x57'),_0x9fcb('0x59'),'attachments');var _0x3069f8=path[_0x9fcb('0x55')](_0x1cfcb8,_0x1e402d);var _0x7467a=util['format']('transcript-%d-%s.zip',_0xdae167[_0x9fcb('0x2e')]['id'],_0x1e402d);var _0x1ed393=path[_0x9fcb('0x55')](_0x1cfcb8,_0x7467a);var _0x404bfe=[];_0x404bfe[_0x9fcb('0x5a')]({'model':db[_0x9fcb('0x5b')],'as':_0x9fcb('0x5b'),'attributes':['id',_0x9fcb('0x5c')],'raw':!![]});_0x404bfe[_0x9fcb('0x5a')]({'model':db[_0x9fcb('0x5d')],'as':_0x9fcb('0x5e'),'attributes':['id',_0x9fcb('0x5f'),_0x9fcb('0x60')],'raw':!![]});if(_0xdae167['query'][_0x9fcb('0x61')]){_0x404bfe[_0x9fcb('0x5a')]({'model':db[_0x9fcb('0x62')],'as':_0x9fcb('0x62'),'raw':!![]});}var _0xd09bf3=[{'model':db[_0x9fcb('0x3b')],'as':_0x9fcb('0x63'),'attributes':['id',_0x9fcb('0x38'),'createdAt',_0x9fcb('0x64'),_0x9fcb('0x65'),_0x9fcb('0x66')],'include':_0x404bfe}];_0xd09bf3[_0x9fcb('0x5a')]({'model':db[_0x9fcb('0x67')],'as':_0x9fcb('0x68'),'attributes':['id',_0x9fcb('0x21')]});_0xd09bf3[_0x9fcb('0x5a')]({'model':db[_0x9fcb('0x5b')],'as':'Owner','attributes':['id',_0x9fcb('0x5c')]});return db['WhatsappInteraction'][_0x9fcb('0x37')]({'where':{'id':_0xdae167[_0x9fcb('0x2e')]['id']},'include':_0xd09bf3})[_0x9fcb('0x1d')](handleEntityNotFound(_0x3a48b4,null))[_0x9fcb('0x1d')](function(_0x506ba1){if(_0x506ba1){var _0x287a45=_0x506ba1[_0x9fcb('0x69')]({'plain':!![]});fs[_0x9fcb('0x6a')](_0x3069f8);var _0x1af7ef={'channel':_0x9fcb('0x6b'),'account':_0x287a45[_0x9fcb('0x68')][_0x9fcb('0x21')],'agent':_0x287a45[_0x9fcb('0x6c')]?_0x287a45[_0x9fcb('0x6c')][_0x9fcb('0x5c')]:'N.A.','createdAt':moment(_0x287a45['createdAt'])['format'](_0x9fcb('0x48'))[_0x9fcb('0x6d')](),'closedAt':_0x287a45['closed']?moment(_0x287a45['closedAt'])['format'](_0x9fcb('0x48'))['toString']():'','disposition':_0x287a45[_0x9fcb('0x6e')],'messages':_(_0x287a45['Messages'])[_0x9fcb('0x44')]({'secret':![]})[_0x9fcb('0x23')](function(_0x5d4c8d){if(_0x5d4c8d[_0x9fcb('0x62')]){var _0x324098=path[_0x9fcb('0x55')](_0x457492,_0x5d4c8d[_0x9fcb('0x62')][_0x9fcb('0x6f')]);if(fs[_0x9fcb('0x70')](_0x324098)){fs[_0x9fcb('0x71')](_0x324098)[_0x9fcb('0x72')](fs['createWriteStream'](path[_0x9fcb('0x55')](_0x3069f8,_0x5d4c8d[_0x9fcb('0x62')][_0x9fcb('0x6f')])));}}return{'date':moment(_0x5d4c8d['createdAt'])[_0x9fcb('0x47')](_0x9fcb('0x48'))[_0x9fcb('0x6d')](),'sender':_0x5d4c8d[_0x9fcb('0x64')]===_0x9fcb('0x73')?_0x5d4c8d[_0x9fcb('0x5b')]?_0x5d4c8d['User'][_0x9fcb('0x5c')]:_0x9fcb('0x74'):_0x5d4c8d['Contact'][_0x9fcb('0x5f')]+(_0x5d4c8d[_0x9fcb('0x5e')][_0x9fcb('0x60')]?'\x20'+_0x5d4c8d[_0x9fcb('0x5e')][_0x9fcb('0x60')]:''),'body':_0x5d4c8d[_0x9fcb('0x62')]?_0x5d4c8d['Attachment'][_0x9fcb('0x6f')]:_0x5d4c8d[_0x9fcb('0x38')],'direction':_0x5d4c8d[_0x9fcb('0x64')]==='out'?'A':'C','secret':_0x5d4c8d['secret'],'read':_0x5d4c8d[_0x9fcb('0x66')],'attachment':_0x5d4c8d['Attachment']};})[_0x9fcb('0x75')]()};return ejs['renderFile'](path[_0x9fcb('0x55')](config[_0x9fcb('0x56')],_0x9fcb('0x57'),_0x9fcb('0x76'),_0x9fcb('0x77')),{'interaction':_0x1af7ef})['then'](function(_0x1389ba){var _0x763db0=path[_0x9fcb('0x55')](_0x3069f8,_0x9fcb('0x78')+_0x287a45['id']+'-'+_0x1e402d+'.pdf');var _0x47a932={'path':_0x763db0,'channel':_0x9fcb('0x6b'),'interactionId':_0x287a45['id']};return pdf[_0x9fcb('0x79')](_0x1389ba,_0x47a932);})['then'](function(){return new BPromise(function(_0x285c96,_0x90059d){zipdir(_0x3069f8,{'saveTo':_0x1ed393},function(_0x41fc9e,_0x5bf21d){if(_0x41fc9e)return _0x90059d(_0x41fc9e);return _0x285c96(_0x5bf21d);});})[_0x9fcb('0x1d')](function(){return new BPromise(function(_0x3ec629,_0x468fba){rimraf(_0x3069f8,function(_0x401efe){if(_0x401efe)_0x468fba(_0x401efe);return _0x3ec629();});});})[_0x9fcb('0x1d')](function(){return _0x3a48b4[_0x9fcb('0x53')](_0x1ed393,_0x7467a,function(_0x2bea8b){if(_0x2bea8b){console[_0x9fcb('0x7a')](_0x9fcb('0x7b'),_0x2bea8b);}else{fs[_0x9fcb('0x7c')](_0x1ed393);}});});});}else{return _0x3a48b4['sendStatus'](0xc8);}})[_0x9fcb('0x2c')](handleError(_0x3a48b4,null));}; \ No newline at end of file +var _0x40fb=['unix','toString','root','server','files','attachments','join','format','transcript-%d-%s.zip','User','fullname','push','CmContact','Contact','firstName','lastName','Attachment','Messages','direction','secret','read','WhatsappAccount','Owner','mkdirSync','Whatsapp','Account','N.A.','createdAt','closed','closedAt','disposition','basename','existsSync','createReadStream','pipe','System','value','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','log','err','unlinkSync','rimraf','zip-dir','bluebird','util','path','ejs','ioredis','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./whatsappInteraction.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','update','destroy','then','error','name','send','index','map','WhatsappInteraction','rawAttributes','fieldName','key','getOptions','findAll','whatsapp','query','user','show','params','model','filters','intersection','fields','attributes','length','includeAll','options','find','catch','create','body','describe','addMessage','WhatsappMessage','ids','omit','getMessages','findOne','keys','hasOwnProperty','nolimit','order','sort','where','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','merge','rows','addTags','setTags','spread','Tag','color','emit','removeTags','download'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x40fb,0xb1));var _0xb40f=function(_0xf8a7f,_0x19433f){_0xf8a7f=_0xf8a7f-0x0;var _0x51ecff=_0x40fb[_0xf8a7f];return _0x51ecff;};'use strict';var rimraf=require(_0xb40f('0x0'));var zipdir=require(_0xb40f('0x1'));var moment=require('moment');var BPromise=require(_0xb40f('0x2'));var util=require(_0xb40f('0x3'));var path=require(_0xb40f('0x4'));var ejs=require(_0xb40f('0x5'));var fs=require('fs');var _=require('lodash');var Redis=require(_0xb40f('0x6'));var interaction=require('../../components/interaction/service');var qs=require(_0xb40f('0x7'));var pdf=require(_0xb40f('0x8'));var logger=require(_0xb40f('0x9'))(_0xb40f('0xa'));var config=require(_0xb40f('0xb'));var db=require(_0xb40f('0xc'))['db'];config[_0xb40f('0xd')]=_[_0xb40f('0xe')](config[_0xb40f('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0xb40f('0xf'))(new Redis(config['redis']));require(_0xb40f('0x10'))[_0xb40f('0x11')](socket);function respondWithStatusCode(_0x4b245b,_0x14681f){_0x14681f=_0x14681f||0xcc;return function(_0x595784){if(_0x595784){return _0x4b245b[_0xb40f('0x12')](_0x14681f);}return _0x4b245b[_0xb40f('0x13')](_0x14681f)[_0xb40f('0x14')]();};}function respondWithResult(_0x213aaf,_0xdd15){_0xdd15=_0xdd15||0xc8;return function(_0x48f6ae){if(_0x48f6ae){return _0x213aaf[_0xb40f('0x13')](_0xdd15)['json'](_0x48f6ae);}};}function respondWithFilteredResult(_0x5e4938,_0x5a3acf){return function(_0x19e6b6){if(_0x19e6b6){var _0x8d722f=typeof _0x5a3acf[_0xb40f('0x15')]===_0xb40f('0x16')&&typeof _0x5a3acf[_0xb40f('0x17')]==='undefined';var _0x33262a=_0x19e6b6[_0xb40f('0x18')];var _0x2221b4=_0x8d722f?0x0:_0x5a3acf[_0xb40f('0x15')];var _0xd98d12=_0x8d722f?_0x19e6b6[_0xb40f('0x18')]:_0x5a3acf[_0xb40f('0x15')]+_0x5a3acf[_0xb40f('0x17')];var _0x573043;if(_0xd98d12>=_0x33262a){_0xd98d12=_0x33262a;_0x573043=0xc8;}else{_0x573043=0xce;}_0x5e4938[_0xb40f('0x13')](_0x573043);return _0x5e4938[_0xb40f('0x19')](_0xb40f('0x1a'),_0x2221b4+'-'+_0xd98d12+'/'+_0x33262a)['json'](_0x19e6b6);}return null;};}function saveUpdates(_0x3ee368){return function(_0xa0143c){if(_0xa0143c){return _0xa0143c[_0xb40f('0x1b')](_0x3ee368)['then'](function(_0x13ce05){return _0x13ce05;});}return null;};}function removeEntity(_0x424576){return function(_0x182336){if(_0x182336){return _0x182336[_0xb40f('0x1c')]()[_0xb40f('0x1d')](function(){_0x424576[_0xb40f('0x13')](0xcc)[_0xb40f('0x14')]();});}};}function handleEntityNotFound(_0x5339de){return function(_0x3fbcd2){if(!_0x3fbcd2){_0x5339de[_0xb40f('0x12')](0x194);}return _0x3fbcd2;};}function handleError(_0x42bcb1,_0x540441){_0x540441=_0x540441||0x1f4;return function(_0x266573){logger[_0xb40f('0x1e')](_0x266573['stack']);if(_0x266573[_0xb40f('0x1f')]){delete _0x266573['name'];}_0x42bcb1[_0xb40f('0x13')](_0x540441)[_0xb40f('0x20')](_0x266573);};}exports[_0xb40f('0x21')]=function(_0x25abde,_0x3d791f){var _0x8df9ef={};var _0x29bc1b=_[_0xb40f('0x22')](db[_0xb40f('0x23')][_0xb40f('0x24')],function(_0x3b3bc3){return{'name':_0x3b3bc3[_0xb40f('0x25')],'type':_0x3b3bc3['type'][_0xb40f('0x26')]};});_0x8df9ef=qs[_0xb40f('0x27')](_0x29bc1b,_0x25abde);return interaction[_0xb40f('0x28')](_0xb40f('0x29'),_0x25abde[_0xb40f('0x2a')],_0x25abde[_0xb40f('0x2b')],_0x8df9ef,_0x29bc1b)['then'](respondWithFilteredResult(_0x3d791f,_0x8df9ef))['catch'](handleError(_0x3d791f,null));};exports[_0xb40f('0x2c')]=function(_0x4bb0a3,_0x5543ca){var _0x470b72={'raw':![],'where':{'id':_0x4bb0a3[_0xb40f('0x2d')]['id']}},_0x24f62f={};_0x24f62f[_0xb40f('0x2e')]=_['keys'](db[_0xb40f('0x23')][_0xb40f('0x24')]);_0x24f62f[_0xb40f('0x2a')]=_['keys'](_0x4bb0a3[_0xb40f('0x2a')]);_0x24f62f[_0xb40f('0x2f')]=_['intersection'](_0x24f62f[_0xb40f('0x2e')],_0x24f62f[_0xb40f('0x2a')]);_0x470b72['attributes']=_[_0xb40f('0x30')](_0x24f62f[_0xb40f('0x2e')],qs[_0xb40f('0x31')](_0x4bb0a3['query'][_0xb40f('0x31')]));_0x470b72[_0xb40f('0x32')]=_0x470b72[_0xb40f('0x32')][_0xb40f('0x33')]?_0x470b72[_0xb40f('0x32')]:_0x24f62f[_0xb40f('0x2e')];if(_0x4bb0a3[_0xb40f('0x2a')][_0xb40f('0x34')]){_0x470b72['include']=[{'all':!![]}];}_0x470b72=_['merge']({},_0x470b72,_0x4bb0a3[_0xb40f('0x35')]);return db[_0xb40f('0x23')][_0xb40f('0x36')](_0x470b72)['then'](handleEntityNotFound(_0x5543ca,null))[_0xb40f('0x1d')](respondWithResult(_0x5543ca,null))[_0xb40f('0x37')](handleError(_0x5543ca,null));};exports[_0xb40f('0x38')]=function(_0x566248,_0x10de71){return db[_0xb40f('0x23')][_0xb40f('0x38')](_0x566248[_0xb40f('0x39')],{})[_0xb40f('0x1d')](respondWithResult(_0x10de71,0xc9))[_0xb40f('0x37')](handleError(_0x10de71,null));};exports[_0xb40f('0x1b')]=function(_0x1f6756,_0x1533c7){if(_0x1f6756[_0xb40f('0x39')]['id']){delete _0x1f6756[_0xb40f('0x39')]['id'];}return db[_0xb40f('0x23')][_0xb40f('0x36')]({'where':{'id':_0x1f6756[_0xb40f('0x2d')]['id']}})[_0xb40f('0x1d')](handleEntityNotFound(_0x1533c7,null))[_0xb40f('0x1d')](saveUpdates(_0x1f6756[_0xb40f('0x39')],null))['then'](respondWithResult(_0x1533c7,null))[_0xb40f('0x37')](handleError(_0x1533c7,null));};exports[_0xb40f('0x1c')]=function(_0x5625ae,_0x28bba8){return db[_0xb40f('0x23')][_0xb40f('0x36')]({'where':{'id':_0x5625ae['params']['id']}})[_0xb40f('0x1d')](handleEntityNotFound(_0x28bba8,null))['then'](removeEntity(_0x28bba8,null))[_0xb40f('0x37')](handleError(_0x28bba8,null));};exports[_0xb40f('0x3a')]=function(_0x2d3377,_0x2f6057){return db['WhatsappInteraction'][_0xb40f('0x3a')]()[_0xb40f('0x1d')](respondWithResult(_0x2f6057,null))['catch'](handleError(_0x2f6057,null));};exports[_0xb40f('0x3b')]=function(_0x3cbac1,_0x24e3cd){return db[_0xb40f('0x3c')][_0xb40f('0x36')]({'where':{'id':_0x3cbac1[_0xb40f('0x2d')]['id']}})[_0xb40f('0x1d')](handleEntityNotFound(_0x24e3cd,null))[_0xb40f('0x1d')](function(_0x355a9a){if(_0x355a9a){return _0x355a9a['addMessage'](_0x3cbac1[_0xb40f('0x39')][_0xb40f('0x3d')],_[_0xb40f('0x3e')](_0x3cbac1[_0xb40f('0x39')],[_0xb40f('0x3d'),'id'])||{});}})['then'](respondWithResult(_0x24e3cd,null))['catch'](handleError(_0x24e3cd,null));};exports[_0xb40f('0x3f')]=function(_0x37af49,_0x309cdf){var _0x3a3a5b={'raw':![],'where':{}};var _0x1a0f79={};var _0x1f2ca1={'count':0x0,'rows':[]};return db[_0xb40f('0x23')][_0xb40f('0x40')]({'where':{'id':_0x37af49[_0xb40f('0x2d')]['id']}})[_0xb40f('0x1d')](handleEntityNotFound(_0x309cdf,null))['then'](function(_0x2c4f22){if(_0x2c4f22){_0x1a0f79[_0xb40f('0x2e')]=_['keys'](db[_0xb40f('0x3c')][_0xb40f('0x24')]);_0x1a0f79['query']=_[_0xb40f('0x41')](_0x37af49['query']);_0x1a0f79['filters']=_[_0xb40f('0x30')](_0x1a0f79[_0xb40f('0x2e')],_0x1a0f79[_0xb40f('0x2a')]);_0x3a3a5b[_0xb40f('0x32')]=_[_0xb40f('0x30')](_0x1a0f79[_0xb40f('0x2e')],qs[_0xb40f('0x31')](_0x37af49[_0xb40f('0x2a')][_0xb40f('0x31')]));_0x3a3a5b['attributes']=_0x3a3a5b[_0xb40f('0x32')]['length']?_0x3a3a5b[_0xb40f('0x32')]:_0x1a0f79[_0xb40f('0x2e')];if(!_0x37af49['query'][_0xb40f('0x42')](_0xb40f('0x43'))){_0x3a3a5b[_0xb40f('0x17')]=qs[_0xb40f('0x17')](_0x37af49[_0xb40f('0x2a')][_0xb40f('0x17')]);_0x3a3a5b['offset']=qs[_0xb40f('0x15')](_0x37af49[_0xb40f('0x2a')]['offset']);}_0x3a3a5b[_0xb40f('0x44')]=qs[_0xb40f('0x45')](_0x37af49[_0xb40f('0x2a')][_0xb40f('0x45')]);_0x3a3a5b[_0xb40f('0x46')]=qs[_0xb40f('0x2f')](_['pick'](_0x37af49[_0xb40f('0x2a')],_0x1a0f79['filters']));_0x3a3a5b[_0xb40f('0x46')]['WhatsappInteractionId']=_0x2c4f22['id'];if(_0x37af49[_0xb40f('0x2a')]['filter']){_0x3a3a5b['where']=_['merge'](_0x3a3a5b['where'],{'$or':_[_0xb40f('0x22')](_0x3a3a5b['attributes'],function(_0x1998f5){var _0x253395={};_0x253395[_0x1998f5]={'$like':'%'+_0x37af49[_0xb40f('0x2a')][_0xb40f('0x47')]+'%'};return _0x253395;})});}if(_0x37af49[_0xb40f('0x2a')]['$gte']){var _0x3f3c7a=_0x37af49[_0xb40f('0x2a')][_0xb40f('0x48')][_0xb40f('0x49')](',');var _0x315005={};_0x315005[_0x3f3c7a[0x0]]={'$gte':moment(_0x3f3c7a[0x1])['format'](_0xb40f('0x4a'))};_0x3a3a5b[_0xb40f('0x46')]=_['merge'](_0x3a3a5b[_0xb40f('0x46')],_0x315005);}_0x3a3a5b=_[_0xb40f('0x4b')]({},_0x3a3a5b,_0x37af49[_0xb40f('0x35')]);return db['WhatsappMessage'][_0xb40f('0x18')]({'where':_0x3a3a5b[_0xb40f('0x46')]})[_0xb40f('0x1d')](function(_0x21039d){_0x1f2ca1['count']=_0x21039d;if(_0x37af49[_0xb40f('0x2a')][_0xb40f('0x34')]){_0x3a3a5b['include']=[{'all':!![]}];}return db[_0xb40f('0x3c')][_0xb40f('0x28')](_0x3a3a5b);})[_0xb40f('0x1d')](function(_0x44db2e){_0x1f2ca1[_0xb40f('0x4c')]=_0x44db2e;return _0x1f2ca1;});}})['then'](respondWithFilteredResult(_0x309cdf,_0x3a3a5b))[_0xb40f('0x37')](handleError(_0x309cdf,null));};exports[_0xb40f('0x4d')]=function(_0x1d2f5e,_0x5f51ea){return db[_0xb40f('0x23')][_0xb40f('0x36')]({'where':{'id':_0x1d2f5e[_0xb40f('0x2d')]['id']}})[_0xb40f('0x1d')](handleEntityNotFound(_0x5f51ea,null))[_0xb40f('0x1d')](function(_0x4d4cb0){if(_0x4d4cb0){return _0x4d4cb0[_0xb40f('0x4e')](_0x1d2f5e[_0xb40f('0x39')][_0xb40f('0x3d')],_[_0xb40f('0x3e')](_0x1d2f5e[_0xb40f('0x39')],[_0xb40f('0x3d'),'id'])||{})[_0xb40f('0x4f')](function(){return db[_0xb40f('0x50')][_0xb40f('0x28')]({'attributes':['id',_0xb40f('0x1f'),_0xb40f('0x51')],'where':{'id':_0x1d2f5e[_0xb40f('0x39')][_0xb40f('0x3d')]}});})[_0xb40f('0x1d')](function(_0x3e89b5){socket[_0xb40f('0x52')]('whatsappInteractionTags:save',{'id':Number(_0x1d2f5e['params']['id']),'tags':_0x3e89b5||[]});return{'id':Number(_0x1d2f5e[_0xb40f('0x2d')]['id']),'tags':_0x3e89b5||[]};});}})[_0xb40f('0x1d')](respondWithResult(_0x5f51ea,null))[_0xb40f('0x37')](handleError(_0x5f51ea,null));};exports[_0xb40f('0x53')]=function(_0x5b49cd,_0x3c1e23){return db[_0xb40f('0x23')]['find']({'where':{'id':_0x5b49cd[_0xb40f('0x2d')]['id']}})[_0xb40f('0x1d')](handleEntityNotFound(_0x3c1e23,null))[_0xb40f('0x1d')](function(_0x532d65){if(_0x532d65){return _0x532d65[_0xb40f('0x53')](_0x5b49cd['query'][_0xb40f('0x3d')]);}})[_0xb40f('0x1d')](respondWithStatusCode(_0x3c1e23,null))[_0xb40f('0x37')](handleError(_0x3c1e23,null));};exports[_0xb40f('0x54')]=function(_0x1d0998,_0x2b9d61){var _0x2bcf4b=moment()[_0xb40f('0x55')]()[_0xb40f('0x56')]();var _0x229cbd=path['join'](config[_0xb40f('0x57')],'server','files','tmp');var _0x371435=path['join'](config[_0xb40f('0x57')],_0xb40f('0x58'),_0xb40f('0x59'),_0xb40f('0x5a'));var _0x4d9b78=path[_0xb40f('0x5b')](_0x229cbd,_0x2bcf4b);var _0x5a8f73=util[_0xb40f('0x5c')](_0xb40f('0x5d'),_0x1d0998[_0xb40f('0x2d')]['id'],_0x2bcf4b);var _0x3b84b4=path[_0xb40f('0x5b')](_0x229cbd,_0x5a8f73);var _0x2e6557=[];_0x2e6557['push']({'model':db['User'],'as':_0xb40f('0x5e'),'attributes':['id',_0xb40f('0x5f')],'raw':!![]});_0x2e6557[_0xb40f('0x60')]({'model':db[_0xb40f('0x61')],'as':_0xb40f('0x62'),'attributes':['id',_0xb40f('0x63'),_0xb40f('0x64')],'raw':!![]});if(_0x1d0998[_0xb40f('0x2a')][_0xb40f('0x5a')]){_0x2e6557[_0xb40f('0x60')]({'model':db['Attachment'],'as':_0xb40f('0x65'),'raw':!![]});}var _0x385118=[{'model':db[_0xb40f('0x3c')],'as':_0xb40f('0x66'),'attributes':['id','body','createdAt',_0xb40f('0x67'),_0xb40f('0x68'),_0xb40f('0x69')],'include':_0x2e6557}];_0x385118[_0xb40f('0x60')]({'model':db[_0xb40f('0x6a')],'as':'Account','attributes':['id',_0xb40f('0x1f')]});_0x385118[_0xb40f('0x60')]({'model':db['User'],'as':_0xb40f('0x6b'),'attributes':['id',_0xb40f('0x5f')]});return db[_0xb40f('0x23')]['find']({'where':{'id':_0x1d0998['params']['id']},'include':_0x385118})[_0xb40f('0x1d')](handleEntityNotFound(_0x2b9d61,null))[_0xb40f('0x1d')](function(_0x54ef39){if(_0x54ef39){var _0x567d43=_0x54ef39['get']({'plain':!![]});fs[_0xb40f('0x6c')](_0x4d9b78);var _0x3e57e8={'channel':_0xb40f('0x6d'),'account':_0x567d43[_0xb40f('0x6e')][_0xb40f('0x1f')],'agent':_0x567d43['Owner']?_0x567d43[_0xb40f('0x6b')]['fullname']:_0xb40f('0x6f'),'createdAt':moment(_0x567d43[_0xb40f('0x70')])[_0xb40f('0x5c')]('YYYY-MM-DD\x20HH:mm:ss')[_0xb40f('0x56')](),'closedAt':_0x567d43[_0xb40f('0x71')]?moment(_0x567d43[_0xb40f('0x72')])[_0xb40f('0x5c')](_0xb40f('0x4a'))['toString']():'','disposition':_0x567d43[_0xb40f('0x73')],'messages':_(_0x567d43['Messages'])['filter']({'secret':![]})[_0xb40f('0x22')](function(_0x2afdc5){if(_0x2afdc5[_0xb40f('0x65')]){var _0x24c519=path[_0xb40f('0x5b')](_0x371435,_0x2afdc5[_0xb40f('0x65')][_0xb40f('0x74')]);if(fs[_0xb40f('0x75')](_0x24c519)){fs[_0xb40f('0x76')](_0x24c519)[_0xb40f('0x77')](fs['createWriteStream'](path['join'](_0x4d9b78,_0x2afdc5[_0xb40f('0x65')][_0xb40f('0x74')])));}}return{'date':moment(_0x2afdc5[_0xb40f('0x70')])['format'](_0xb40f('0x4a'))[_0xb40f('0x56')](),'sender':_0x2afdc5[_0xb40f('0x67')]==='out'?_0x2afdc5['User']?_0x2afdc5[_0xb40f('0x5e')][_0xb40f('0x5f')]:_0xb40f('0x78'):_0x2afdc5[_0xb40f('0x62')][_0xb40f('0x63')]+(_0x2afdc5[_0xb40f('0x62')][_0xb40f('0x64')]?'\x20'+_0x2afdc5[_0xb40f('0x62')][_0xb40f('0x64')]:''),'body':_0x2afdc5[_0xb40f('0x65')]?_0x2afdc5[_0xb40f('0x65')][_0xb40f('0x74')]:_0x2afdc5[_0xb40f('0x39')],'direction':_0x2afdc5['direction']==='out'?'A':'C','secret':_0x2afdc5[_0xb40f('0x68')],'read':_0x2afdc5[_0xb40f('0x69')],'attachment':_0x2afdc5[_0xb40f('0x65')]};})[_0xb40f('0x79')]()};return ejs[_0xb40f('0x7a')](path['join'](config[_0xb40f('0x57')],_0xb40f('0x58'),_0xb40f('0x7b'),_0xb40f('0x7c')),{'interaction':_0x3e57e8})[_0xb40f('0x1d')](function(_0x50d96b){var _0x5e2227=path['join'](_0x4d9b78,_0xb40f('0x7d')+_0x567d43['id']+'-'+_0x2bcf4b+_0xb40f('0x7e'));var _0x1db554={'path':_0x5e2227,'channel':_0xb40f('0x6d'),'interactionId':_0x567d43['id']};return pdf[_0xb40f('0x7f')](_0x50d96b,_0x1db554);})[_0xb40f('0x1d')](function(){return new BPromise(function(_0x39b95c,_0x3f2401){zipdir(_0x4d9b78,{'saveTo':_0x3b84b4},function(_0x6e84a4,_0x88d3e4){if(_0x6e84a4)return _0x3f2401(_0x6e84a4);return _0x39b95c(_0x88d3e4);});})[_0xb40f('0x1d')](function(){return new BPromise(function(_0x585b11,_0x5e559e){rimraf(_0x4d9b78,function(_0x511b9){if(_0x511b9)_0x5e559e(_0x511b9);return _0x585b11();});});})[_0xb40f('0x1d')](function(){return _0x2b9d61[_0xb40f('0x54')](_0x3b84b4,_0x5a8f73,function(_0xbbcff8){if(_0xbbcff8){console[_0xb40f('0x80')](_0xb40f('0x81'),_0xbbcff8);}else{fs[_0xb40f('0x82')](_0x3b84b4);}});});});}else{return _0x2b9d61[_0xb40f('0x12')](0xc8);}})[_0xb40f('0x37')](handleError(_0x2b9d61,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index 84aac76..e13c8ce 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 _0xefe3=['unreadMessages','length','emit','hook','exports','events','WhatsappMessage','setMaxListeners','save','update','getUsers','then','setDataValue','Users','map','findAll'];(function(_0x3aa5f5,_0x55d7d7){var _0x399bc9=function(_0x233dd1){while(--_0x233dd1){_0x3aa5f5['push'](_0x3aa5f5['shift']());}};_0x399bc9(++_0x55d7d7);}(_0xefe3,0xf5));var _0x3efe=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xefe3[_0x321bb2];return _0x9c12ed;};'use strict';var EventEmitter=require(_0x3efe('0x0'));var WhatsappInteraction=require('../../mysqldb')['db']['WhatsappInteraction'];var WhatsappMessage=require('../../mysqldb')['db'][_0x3efe('0x1')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x3efe('0x2')](0x0);var events={'afterCreate':_0x3efe('0x3'),'afterUpdate':_0x3efe('0x4'),'afterDestroy':'remove'};function emitEvent(_0x11125f){return function(_0x58e1bb,_0x89aaa1,_0x4b5006){_0x58e1bb[_0x3efe('0x5')]({'attributes':['id'],'raw':!![]})[_0x3efe('0x6')](function(_0x1f697b){_0x58e1bb[_0x3efe('0x7')](_0x3efe('0x8'),_0x1f697b[_0x3efe('0x9')](function(_0x4b9766){return{'id':_0x4b9766['id']};}));return WhatsappMessage[_0x3efe('0xa')]({'where':{'WhatsappInteractionId':_0x58e1bb['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x1edce8){_0x58e1bb[_0x3efe('0x7')](_0x3efe('0xb'),_0x1edce8[_0x3efe('0xc')]);WhatsappInteractionEvents[_0x3efe('0xd')](_0x11125f+':'+_0x58e1bb['id'],_0x58e1bb);WhatsappInteractionEvents[_0x3efe('0xd')](_0x11125f,_0x58e1bb);_0x4b5006(null);})['catch'](_0x4b5006(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappInteraction[_0x3efe('0xe')](e,emitEvent(event));}}module[_0x3efe('0xf')]=WhatsappInteractionEvents; \ No newline at end of file +var _0x1094=['catch','hasOwnProperty','exports','events','../../mysqldb','setMaxListeners','save','update','remove','getUsers','then','setDataValue','map','findAll','length','emit'];(function(_0x40da26,_0x23369c){var _0x2a49a7=function(_0x3faa99){while(--_0x3faa99){_0x40da26['push'](_0x40da26['shift']());}};_0x2a49a7(++_0x23369c);}(_0x1094,0x143));var _0x4109=function(_0x4969d0,_0x4a5788){_0x4969d0=_0x4969d0-0x0;var _0x754944=_0x1094[_0x4969d0];return _0x754944;};'use strict';var EventEmitter=require(_0x4109('0x0'));var WhatsappInteraction=require(_0x4109('0x1'))['db']['WhatsappInteraction'];var WhatsappMessage=require(_0x4109('0x1'))['db']['WhatsappMessage'];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x4109('0x2')](0x0);var events={'afterCreate':_0x4109('0x3'),'afterUpdate':_0x4109('0x4'),'afterDestroy':_0x4109('0x5')};function emitEvent(_0x36e917){return function(_0x5684ce,_0x1cf079,_0x12fdda){_0x5684ce[_0x4109('0x6')]({'attributes':['id'],'raw':!![]})[_0x4109('0x7')](function(_0xd2df16){_0x5684ce[_0x4109('0x8')]('Users',_0xd2df16[_0x4109('0x9')](function(_0x175d5e){return{'id':_0x175d5e['id']};}));return WhatsappMessage[_0x4109('0xa')]({'where':{'WhatsappInteractionId':_0x5684ce['id'],'direction':'in','read':![]},'raw':!![]});})[_0x4109('0x7')](function(_0x1b7798){_0x5684ce['setDataValue']('unreadMessages',_0x1b7798[_0x4109('0xb')]);WhatsappInteractionEvents['emit'](_0x36e917+':'+_0x5684ce['id'],_0x5684ce);WhatsappInteractionEvents[_0x4109('0xc')](_0x36e917,_0x5684ce);_0x12fdda(null);})[_0x4109('0xd')](_0x12fdda(null));};}for(var e in events){if(events[_0x4109('0xe')](e)){var event=events[e];WhatsappInteraction['hook'](e,emitEvent(event));}}module[_0x4109('0xf')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index b6b9259..6372e32 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 _0xa92a=['lodash','api','moment','bluebird','path','define','WhatsappInteraction','whatsapp_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0xa92a,0x1c7));var _0xaa92=function(_0xe8129c,_0x2fb03c){_0xe8129c=_0xe8129c-0x0;var _0x709fc5=_0xa92a[_0xe8129c];return _0x709fc5;};'use strict';var _=require(_0xaa92('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xaa92('0x1'));var moment=require(_0xaa92('0x2'));var BPromise=require(_0xaa92('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xaa92('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./whatsappInteraction.attributes');module['exports']=function(_0x18bbf3,_0x321a7e){return _0x18bbf3[_0xaa92('0x5')](_0xaa92('0x6'),attributes,{'tableName':_0xaa92('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2fa9df,_0x5a930e,_0x1fc54b){if(_0x2fa9df[_0xaa92('0x8')](_0xaa92('0x9'))){_0x2fa9df[_0xaa92('0xa')]=moment()[_0xaa92('0xb')](_0xaa92('0xc'));}_0x1fc54b(null,_0x2fa9df);}}});}; \ No newline at end of file +var _0x3970=['changed','closed','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','WhatsappInteraction','whatsapp_interactions'];(function(_0x24a470,_0x5a1d49){var _0x3a0b54=function(_0x15867e){while(--_0x15867e){_0x24a470['push'](_0x24a470['shift']());}};_0x3a0b54(++_0x5a1d49);}(_0x3970,0x1d4));var _0x0397=function(_0x386525,_0xefae6){_0x386525=_0x386525-0x0;var _0x14d015=_0x3970[_0x386525];return _0x14d015;};'use strict';var _=require(_0x0397('0x0'));var util=require(_0x0397('0x1'));var logger=require('../../config/logger')(_0x0397('0x2'));var moment=require('moment');var BPromise=require(_0x0397('0x3'));var rp=require(_0x0397('0x4'));var fs=require('fs');var path=require(_0x0397('0x5'));var rimraf=require(_0x0397('0x6'));var config=require(_0x0397('0x7'));var attributes=require('./whatsappInteraction.attributes');module[_0x0397('0x8')]=function(_0xc638c0,_0x15dbbe){return _0xc638c0[_0x0397('0x9')](_0x0397('0xa'),attributes,{'tableName':_0x0397('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5429c5,_0x54ddf0,_0xaef240){if(_0x5429c5[_0x0397('0xc')](_0x0397('0xd'))){_0x5429c5['closedAt']=moment()[_0x0397('0xe')](_0x0397('0xf'));}_0xaef240(null,_0x5429c5);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index 024f5fe..d3caf79 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 _0xc281=['WhatsappInteraction','update','body','options','raw','where','attributes','debug','catch','find','addTags','omit','spread','AddTags','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','redis','socket.io-emitter','./whatsappInteraction.socket','register','request','then','info','WhatsappInteraction,\x20%s,\x20%s','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','UpdateWhatsappInteraction'];(function(_0x2cde0a,_0x1f9695){var _0x260610=function(_0x179089){while(--_0x179089){_0x2cde0a['push'](_0x2cde0a['shift']());}};_0x260610(++_0x1f9695);}(_0xc281,0x17f));var _0x1c28=function(_0x12e747,_0x33ab29){_0x12e747=_0x12e747-0x0;var _0x54adb6=_0xc281[_0x12e747];return _0x54adb6;};'use strict';var _=require(_0x1c28('0x0'));var util=require(_0x1c28('0x1'));var moment=require(_0x1c28('0x2'));var BPromise=require(_0x1c28('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1c28('0x4'));var db=require(_0x1c28('0x5'))['db'];var utils=require(_0x1c28('0x6'));var logger=require(_0x1c28('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x1c28('0x8'));var client=jayson[_0x1c28('0x9')][_0x1c28('0xa')]({'port':0x232a});config['redis']=_['defaults'](config[_0x1c28('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x1c28('0xc'))(new Redis(config[_0x1c28('0xb')]));require(_0x1c28('0xd'))[_0x1c28('0xe')](socket);function respondWithRpcPromise(_0x11ebbd,_0x42c0a9,_0x202cf9){return new BPromise(function(_0x1d8ad4,_0x57d2de){return client[_0x1c28('0xf')](_0x11ebbd,_0x202cf9)[_0x1c28('0x10')](function(_0x5b1f8c){logger[_0x1c28('0x11')](_0x1c28('0x12'),_0x42c0a9,'request\x20sent');logger['debug'](_0x1c28('0x13'),_0x42c0a9,'request\x20sent',JSON[_0x1c28('0x14')](_0x5b1f8c));if(_0x5b1f8c[_0x1c28('0x15')]){if(_0x5b1f8c[_0x1c28('0x15')][_0x1c28('0x16')]===0x1f4){logger[_0x1c28('0x15')](_0x1c28('0x12'),_0x42c0a9,_0x5b1f8c[_0x1c28('0x15')][_0x1c28('0x17')]);return _0x57d2de(_0x5b1f8c[_0x1c28('0x15')][_0x1c28('0x17')]);}logger[_0x1c28('0x15')](_0x1c28('0x12'),_0x42c0a9,_0x5b1f8c[_0x1c28('0x15')][_0x1c28('0x17')]);return _0x1d8ad4(_0x5b1f8c[_0x1c28('0x15')]['message']);}else{logger['info']('WhatsappInteraction,\x20%s,\x20%s',_0x42c0a9,_0x1c28('0x18'));_0x1d8ad4(_0x5b1f8c[_0x1c28('0x19')][_0x1c28('0x17')]);}})['catch'](function(_0x2b4ee1){logger[_0x1c28('0x15')]('WhatsappInteraction,\x20%s,\x20%s',_0x42c0a9,_0x2b4ee1);_0x57d2de(_0x2b4ee1);});});}exports[_0x1c28('0x1a')]=function(_0x194d03){var _0x5bb6a6=this;return new Promise(function(_0x174c07,_0x1b9204){return db[_0x1c28('0x1b')][_0x1c28('0x1c')](_0x194d03[_0x1c28('0x1d')],{'raw':_0x194d03[_0x1c28('0x1e')]?_0x194d03[_0x1c28('0x1e')][_0x1c28('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x194d03[_0x1c28('0x1e')]?_0x194d03[_0x1c28('0x1e')][_0x1c28('0x20')]||null:null,'attributes':_0x194d03['options']?_0x194d03[_0x1c28('0x1e')][_0x1c28('0x21')]||null:null,'limit':_0x194d03[_0x1c28('0x1e')]?_0x194d03['options']['limit']||null:null})[_0x1c28('0x10')](function(_0x53105c){logger[_0x1c28('0x11')](_0x1c28('0x1a'),_0x194d03);logger[_0x1c28('0x22')](_0x1c28('0x1a'),_0x194d03,JSON[_0x1c28('0x14')](_0x53105c));_0x174c07(_0x53105c);})[_0x1c28('0x23')](function(_0x44b68d){logger[_0x1c28('0x15')](_0x1c28('0x1a'),_0x44b68d[_0x1c28('0x17')],_0x194d03);_0x1b9204(_0x5bb6a6[_0x1c28('0x15')](0x1f4,_0x44b68d[_0x1c28('0x17')]));});});};exports['AddTagsToWhatsappInteraction']=function(_0x5a4bb3){return new Promise(function(_0x1888e1,_0x5b99a3){return db[_0x1c28('0x1b')][_0x1c28('0x24')]({'where':_0x5a4bb3[_0x1c28('0x1e')]?_0x5a4bb3['options'][_0x1c28('0x20')]||null:null})[_0x1c28('0x10')](function(_0x2f76ae){if(_0x2f76ae){return _0x2f76ae[_0x1c28('0x25')](_0x5a4bb3[_0x1c28('0x1d')]['ids'],_[_0x1c28('0x26')](_0x5a4bb3['body'],['ids','id'])||{});}})[_0x1c28('0x27')](function(_0x2e9a19){logger['info'](_0x1c28('0x28'),_0x5a4bb3);logger[_0x1c28('0x22')]('AddTags',_0x5a4bb3,JSON[_0x1c28('0x14')](_0x2e9a19));_0x1888e1(_0x2e9a19);})['catch'](function(_0x326691){logger['error'](_0x1c28('0x28'),_0x326691[_0x1c28('0x17')],_0x5a4bb3);_0x5b99a3(_this['error'](0x1f4,_0x326691[_0x1c28('0x17')]));});});}; \ No newline at end of file +var _0x7d64=['catch','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','request','then','info','debug','request\x20sent','stringify','error','code','WhatsappInteraction,\x20%s,\x20%s','message','result','UpdateWhatsappInteraction','WhatsappInteraction','update','body','options','raw','where','limit','addTags','ids','omit','spread','AddTags'];(function(_0x4bc4c8,_0x3139d3){var _0x3bb121=function(_0x95ad12){while(--_0x95ad12){_0x4bc4c8['push'](_0x4bc4c8['shift']());}};_0x3bb121(++_0x3139d3);}(_0x7d64,0x1c4));var _0x47d6=function(_0xbc286f,_0x46b514){_0xbc286f=_0xbc286f-0x0;var _0x5e48c6=_0x7d64[_0xbc286f];return _0x5e48c6;};'use strict';var _=require(_0x47d6('0x0'));var util=require('util');var moment=require(_0x47d6('0x1'));var BPromise=require('bluebird');var rs=require(_0x47d6('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x47d6('0x3'))['db'];var utils=require(_0x47d6('0x4'));var logger=require(_0x47d6('0x5'))('rpc');var config=require(_0x47d6('0x6'));var jayson=require(_0x47d6('0x7'));var client=jayson[_0x47d6('0x8')][_0x47d6('0x9')]({'port':0x232a});config[_0x47d6('0xa')]=_[_0x47d6('0xb')](config[_0x47d6('0xa')],{'host':_0x47d6('0xc'),'port':0x18eb});var socket=require(_0x47d6('0xd'))(new Redis(config[_0x47d6('0xa')]));require(_0x47d6('0xe'))[_0x47d6('0xf')](socket);function respondWithRpcPromise(_0x47ca64,_0xdcb050,_0x15ac02){return new BPromise(function(_0x16f178,_0x57c750){return client[_0x47d6('0x10')](_0x47ca64,_0x15ac02)[_0x47d6('0x11')](function(_0x369ff9){logger[_0x47d6('0x12')]('WhatsappInteraction,\x20%s,\x20%s',_0xdcb050,'request\x20sent');logger[_0x47d6('0x13')]('WhatsappInteraction,\x20%s,\x20%s,\x20%s',_0xdcb050,_0x47d6('0x14'),JSON[_0x47d6('0x15')](_0x369ff9));if(_0x369ff9[_0x47d6('0x16')]){if(_0x369ff9[_0x47d6('0x16')][_0x47d6('0x17')]===0x1f4){logger[_0x47d6('0x16')](_0x47d6('0x18'),_0xdcb050,_0x369ff9[_0x47d6('0x16')][_0x47d6('0x19')]);return _0x57c750(_0x369ff9['error'][_0x47d6('0x19')]);}logger[_0x47d6('0x16')](_0x47d6('0x18'),_0xdcb050,_0x369ff9[_0x47d6('0x16')]['message']);return _0x16f178(_0x369ff9[_0x47d6('0x16')]['message']);}else{logger['info']('WhatsappInteraction,\x20%s,\x20%s',_0xdcb050,'request\x20sent');_0x16f178(_0x369ff9[_0x47d6('0x1a')]['message']);}})['catch'](function(_0x4687e3){logger['error'](_0x47d6('0x18'),_0xdcb050,_0x4687e3);_0x57c750(_0x4687e3);});});}exports[_0x47d6('0x1b')]=function(_0x46a4bf){var _0x27c8f6=this;return new Promise(function(_0x183380,_0x30a659){return db[_0x47d6('0x1c')][_0x47d6('0x1d')](_0x46a4bf[_0x47d6('0x1e')],{'raw':_0x46a4bf[_0x47d6('0x1f')]?_0x46a4bf['options'][_0x47d6('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x46a4bf[_0x47d6('0x1f')]?_0x46a4bf['options'][_0x47d6('0x21')]||null:null,'attributes':_0x46a4bf[_0x47d6('0x1f')]?_0x46a4bf[_0x47d6('0x1f')]['attributes']||null:null,'limit':_0x46a4bf[_0x47d6('0x1f')]?_0x46a4bf[_0x47d6('0x1f')][_0x47d6('0x22')]||null:null})[_0x47d6('0x11')](function(_0xcc43b6){logger['info'](_0x47d6('0x1b'),_0x46a4bf);logger['debug']('UpdateWhatsappInteraction',_0x46a4bf,JSON[_0x47d6('0x15')](_0xcc43b6));_0x183380(_0xcc43b6);})['catch'](function(_0x179aaf){logger['error'](_0x47d6('0x1b'),_0x179aaf[_0x47d6('0x19')],_0x46a4bf);_0x30a659(_0x27c8f6['error'](0x1f4,_0x179aaf[_0x47d6('0x19')]));});});};exports['AddTagsToWhatsappInteraction']=function(_0x11be9c){return new Promise(function(_0x215a2f,_0x2dd427){return db[_0x47d6('0x1c')]['find']({'where':_0x11be9c[_0x47d6('0x1f')]?_0x11be9c[_0x47d6('0x1f')][_0x47d6('0x21')]||null:null})[_0x47d6('0x11')](function(_0x3819d0){if(_0x3819d0){return _0x3819d0[_0x47d6('0x23')](_0x11be9c['body'][_0x47d6('0x24')],_[_0x47d6('0x25')](_0x11be9c[_0x47d6('0x1e')],['ids','id'])||{});}})[_0x47d6('0x26')](function(_0x12f3e6){logger[_0x47d6('0x12')](_0x47d6('0x27'),_0x11be9c);logger[_0x47d6('0x13')]('AddTags',_0x11be9c,JSON['stringify'](_0x12f3e6));_0x215a2f(_0x12f3e6);})[_0x47d6('0x28')](function(_0x826d5a){logger['error'](_0x47d6('0x27'),_0x826d5a[_0x47d6('0x19')],_0x11be9c);_0x2dd427(_this[_0x47d6('0x16')](0x1f4,_0x826d5a[_0x47d6('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index 1e9e447..68e550c 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 _0x2fba=['./whatsappInteraction.events','save','remove','removeListener','register','length','whatsappInteraction:'];(function(_0x2641cb,_0x290c82){var _0x5bd87c=function(_0x38149f){while(--_0x38149f){_0x2641cb['push'](_0x2641cb['shift']());}};_0x5bd87c(++_0x290c82);}(_0x2fba,0xa1));var _0xa2fb=function(_0x4d4298,_0xa728df){_0x4d4298=_0x4d4298-0x0;var _0x2f8aa2=_0x2fba[_0x4d4298];return _0x2f8aa2;};'use strict';var WhatsappInteractionEvents=require(_0xa2fb('0x0'));var events=[_0xa2fb('0x1'),_0xa2fb('0x2'),'update'];function createListener(_0x4f546f,_0x3c4518){return function(_0x8cf074){_0x3c4518['emit'](_0x4f546f,_0x8cf074);};}function removeListener(_0x426ee4,_0x4610a2){return function(){WhatsappInteractionEvents[_0xa2fb('0x3')](_0x426ee4,_0x4610a2);};}exports[_0xa2fb('0x4')]=function(_0x14f5cf){for(var _0x31218c=0x0,_0x1a8de7=events[_0xa2fb('0x5')];_0x31218c<_0x1a8de7;_0x31218c++){var _0x21fd83=events[_0x31218c];var _0x1194fa=createListener(_0xa2fb('0x6')+_0x21fd83,_0x14f5cf);WhatsappInteractionEvents['on'](_0x21fd83,_0x1194fa);}}; \ No newline at end of file +var _0xd955=['removeListener','register','length','./whatsappInteraction.events','save','remove'];(function(_0x36b037,_0x2b234e){var _0x409194=function(_0xddc9dc){while(--_0xddc9dc){_0x36b037['push'](_0x36b037['shift']());}};_0x409194(++_0x2b234e);}(_0xd955,0x17d));var _0x5d95=function(_0x1d2267,_0xfda152){_0x1d2267=_0x1d2267-0x0;var _0x47dbd0=_0xd955[_0x1d2267];return _0x47dbd0;};'use strict';var WhatsappInteractionEvents=require(_0x5d95('0x0'));var events=[_0x5d95('0x1'),_0x5d95('0x2'),'update'];function createListener(_0x3adb9f,_0x37512e){return function(_0x236475){_0x37512e['emit'](_0x3adb9f,_0x236475);};}function removeListener(_0x512609,_0x3b821b){return function(){WhatsappInteractionEvents[_0x5d95('0x3')](_0x512609,_0x3b821b);};}exports[_0x5d95('0x4')]=function(_0x5d7077){for(var _0x28780a=0x0,_0x436ba2=events[_0x5d95('0x5')];_0x28780a<_0x436ba2;_0x28780a++){var _0x250b0f=events[_0x28780a];var _0x1bb8bb=createListener('whatsappInteraction:'+_0x250b0f,_0x5d7077);WhatsappInteractionEvents['on'](_0x250b0f,_0x1bb8bb);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index 9d0e3ac..9923b02 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 _0x8d1b=['/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','isAuthenticated','get','/describe','describe','/:id','show','post','whatsapp','/:id/status','put','update'];(function(_0x468a77,_0x1382be){var _0x2d1c33=function(_0x2f2e83){while(--_0x2f2e83){_0x468a77['push'](_0x468a77['shift']());}};_0x2d1c33(++_0x1382be);}(_0x8d1b,0x18f));var _0xb8d1=function(_0x1f529b,_0x53d52c){_0x1f529b=_0x1f529b-0x0;var _0x34e01f=_0x8d1b[_0x1f529b];return _0x34e01f;};'use strict';var multer=require(_0xb8d1('0x0'));var util=require(_0xb8d1('0x1'));var path=require(_0xb8d1('0x2'));var timeout=require(_0xb8d1('0x3'));var express=require('express');var router=express[_0xb8d1('0x4')]();var fs_extra=require(_0xb8d1('0x5'));var auth=require(_0xb8d1('0x6'));var interaction=require(_0xb8d1('0x7'));var config=require(_0xb8d1('0x8'));var controller=require(_0xb8d1('0x9'));router['get']('/',auth[_0xb8d1('0xa')](),controller['index']);router[_0xb8d1('0xb')](_0xb8d1('0xc'),auth['isAuthenticated'](),controller[_0xb8d1('0xd')]);router[_0xb8d1('0xb')](_0xb8d1('0xe'),auth[_0xb8d1('0xa')](),controller[_0xb8d1('0xf')]);router[_0xb8d1('0x10')]('/',auth[_0xb8d1('0xa')](),interaction['tracked'](_0xb8d1('0x11'),'whatsappmessage:create'),controller['create']);router[_0xb8d1('0x10')](_0xb8d1('0x12'),controller['status']);router[_0xb8d1('0x13')](_0xb8d1('0xe'),auth[_0xb8d1('0xa')](),controller[_0xb8d1('0x14')]);router[_0xb8d1('0x13')](_0xb8d1('0x15'),auth[_0xb8d1('0xa')](),controller[_0xb8d1('0x16')]);router[_0xb8d1('0x13')](_0xb8d1('0x17'),auth[_0xb8d1('0xa')](),controller[_0xb8d1('0x18')]);router[_0xb8d1('0x19')]('/:id',auth[_0xb8d1('0xa')](),controller[_0xb8d1('0x1a')]);module[_0xb8d1('0x1b')]=router; \ No newline at end of file +var _0xf15a=['get','index','/describe','isAuthenticated','/:id','show','post','tracked','whatsapp','whatsappmessage:create','create','/:id/status','status','put','update','/:id/accept','/:id/reject','reject','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./whatsappMessage.controller'];(function(_0x503d79,_0x3fed1c){var _0x480159=function(_0x19eda3){while(--_0x19eda3){_0x503d79['push'](_0x503d79['shift']());}};_0x480159(++_0x3fed1c);}(_0xf15a,0x119));var _0xaf15=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xf15a[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require('multer');var util=require(_0xaf15('0x0'));var path=require(_0xaf15('0x1'));var timeout=require(_0xaf15('0x2'));var express=require(_0xaf15('0x3'));var router=express[_0xaf15('0x4')]();var fs_extra=require(_0xaf15('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xaf15('0x6'));var config=require(_0xaf15('0x7'));var controller=require(_0xaf15('0x8'));router[_0xaf15('0x9')]('/',auth['isAuthenticated'](),controller[_0xaf15('0xa')]);router['get'](_0xaf15('0xb'),auth[_0xaf15('0xc')](),controller['describe']);router[_0xaf15('0x9')](_0xaf15('0xd'),auth[_0xaf15('0xc')](),controller[_0xaf15('0xe')]);router[_0xaf15('0xf')]('/',auth['isAuthenticated'](),interaction[_0xaf15('0x10')](_0xaf15('0x11'),_0xaf15('0x12')),controller[_0xaf15('0x13')]);router[_0xaf15('0xf')](_0xaf15('0x14'),controller[_0xaf15('0x15')]);router[_0xaf15('0x16')](_0xaf15('0xd'),auth[_0xaf15('0xc')](),controller[_0xaf15('0x17')]);router[_0xaf15('0x16')](_0xaf15('0x18'),auth['isAuthenticated'](),controller['accept']);router['put'](_0xaf15('0x19'),auth[_0xaf15('0xc')](),controller[_0xaf15('0x1a')]);router[_0xaf15('0x1b')](_0xaf15('0xd'),auth['isAuthenticated'](),controller[_0xaf15('0x1c')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index f6c4ce1..e92dc82 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 _0x7dfd=['sequelize','exports','TEXT','medium','BOOLEAN','ENUM','out','STRING','DATE'];(function(_0x25b5c1,_0x15f706){var _0x15cb0d=function(_0x269d4e){while(--_0x269d4e){_0x25b5c1['push'](_0x25b5c1['shift']());}};_0x15cb0d(++_0x15f706);}(_0x7dfd,0x1c2));var _0xd7df=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7dfd[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xd7df('0x0'));module[_0xd7df('0x1')]={'body':{'type':Sequelize[_0xd7df('0x2')](_0xd7df('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xd7df('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xd7df('0x5')]('in',_0xd7df('0x6')),'defaultValue':_0xd7df('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0xd7df('0x7')](0xbe)},'phone':{'type':Sequelize[_0xd7df('0x7')]},'readAt':{'type':Sequelize[_0xd7df('0x8')]},'secret':{'type':Sequelize[_0xd7df('0x4')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xd7df('0x7')]},'providerResponse':{'type':Sequelize[_0xd7df('0x2')]}}; \ No newline at end of file +var _0x4ba1=['BOOLEAN','TEXT','exports','medium','out','STRING','DATE'];(function(_0x468836,_0x429d6d){var _0xcc2189=function(_0x8e61d1){while(--_0x8e61d1){_0x468836['push'](_0x468836['shift']());}};_0xcc2189(++_0x429d6d);}(_0x4ba1,0x79));var _0x14ba=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x4ba1[_0x167cc1];return _0x10bc4b;};'use strict';var Sequelize=require('sequelize');module[_0x14ba('0x0')]={'body':{'type':Sequelize['TEXT'](_0x14ba('0x1')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x14ba('0x2')),'defaultValue':_0x14ba('0x2'),'allowNull':![]},'messageId':{'type':Sequelize[_0x14ba('0x3')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0x14ba('0x4')]},'secret':{'type':Sequelize[_0x14ba('0x5')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x14ba('0x3')]},'providerResponse':{'type':Sequelize[_0x14ba('0x6')]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index 784ee72..263c3b5 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 _0x2313=['model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','includeAll','include','rows','catch','show','params','options','find','create','body','../../config/logger','whatsapp-interactions','accept','whatsapp','readAt','format','UserId','agent','get','WhatsappInteraction','WhatsappInteractionId','isNil','read1stAt','interaction','[WHATSAPPMESSAGE: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','User','fullname','email','internal','channel','motionChannel','EventManager','acceptmessage','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','interface','SIP/%s','event','rejectmessage','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','MessageStatus','read','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','./whatsappMessage.socket','register','jayson/promise','client','http','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','status','json','undefined','limit','offset','count','apply','reject','save','update','then','destroy','end','sendStatus','stack','name','index','WhatsappMessage','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection'];(function(_0x2ec333,_0x17a07e){var _0x4cd294=function(_0x2cba8e){while(--_0x2cba8e){_0x2ec333['push'](_0x2ec333['shift']());}};_0x4cd294(++_0x17a07e);}(_0x2313,0x1e6));var _0x3231=function(_0x32d16b,_0x54bacb){_0x32d16b=_0x32d16b-0x0;var _0x5b4441=_0x2313[_0x32d16b];return _0x5b4441;};'use strict';var emlformat=require(_0x3231('0x0'));var rimraf=require(_0x3231('0x1'));var zipdir=require(_0x3231('0x2'));var jsonpatch=require(_0x3231('0x3'));var rp=require(_0x3231('0x4'));var moment=require('moment');var BPromise=require(_0x3231('0x5'));var Mustache=require(_0x3231('0x6'));var util=require(_0x3231('0x7'));var path=require(_0x3231('0x8'));var sox=require(_0x3231('0x9'));var csv=require('to-csv');var ejs=require(_0x3231('0xa'));var fs=require('fs');var fs_extra=require(_0x3231('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3231('0xc'));var toCsv=require('to-csv');var querystring=require(_0x3231('0xd'));var Papa=require(_0x3231('0xe'));var Redis=require(_0x3231('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x3231('0x10'));var as=require(_0x3231('0x11'));var hardwareService=require(_0x3231('0x12'));var logger=require('../../config/logger')(_0x3231('0x13'));var utils=require(_0x3231('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x3231('0x15'));var db=require(_0x3231('0x16'))['db'];config[_0x3231('0x17')]=_[_0x3231('0x18')](config[_0x3231('0x17')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x3231('0x19'))[_0x3231('0x1a')](socket);var jayson=require(_0x3231('0x1b'));var client=jayson[_0x3231('0x1c')][_0x3231('0x1d')]({'port':0x232c});var client9002=jayson[_0x3231('0x1c')][_0x3231('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x27a31f,_0x583dd7,_0x46fed6,_0x16029d){return new BPromise(function(_0x42c8d8,_0x4f58a0){var _0x2b3213=_0x16029d||client;return _0x2b3213['request'](_0x27a31f,_0x46fed6)['then'](function(_0x17ac51){logger[_0x3231('0x1e')](_0x3231('0x1f'),_0x583dd7,_0x3231('0x20'));logger[_0x3231('0x21')](_0x3231('0x22'),_0x583dd7,_0x3231('0x20'),JSON[_0x3231('0x23')](_0x17ac51));if(_0x17ac51[_0x3231('0x24')]){if(_0x17ac51[_0x3231('0x24')]['code']===0x1f4){logger[_0x3231('0x24')](_0x3231('0x1f'),_0x583dd7,_0x17ac51[_0x3231('0x24')][_0x3231('0x25')]);return _0x4f58a0(_0x17ac51[_0x3231('0x24')][_0x3231('0x25')]);}logger[_0x3231('0x24')]('WhatsappMessage,\x20%s,\x20%s',_0x583dd7,_0x17ac51['error']['message']);return _0x42c8d8(_0x17ac51[_0x3231('0x24')][_0x3231('0x25')]);}else{logger[_0x3231('0x1e')]('WhatsappMessage,\x20%s,\x20%s',_0x583dd7,_0x3231('0x20'));_0x42c8d8(_0x17ac51[_0x3231('0x26')][_0x3231('0x25')]);}})['catch'](function(_0x298121){logger[_0x3231('0x24')](_0x3231('0x1f'),_0x583dd7,_0x298121);_0x4f58a0(_0x298121);});});}function respondWithStatusCode(_0x56ae9c,_0x4c35cf){_0x4c35cf=_0x4c35cf||0xcc;return function(_0x23b819){if(_0x23b819){return _0x56ae9c['sendStatus'](_0x4c35cf);}return _0x56ae9c[_0x3231('0x27')](_0x4c35cf)['end']();};}function respondWithResult(_0x4505f6,_0x5b0b9a){_0x5b0b9a=_0x5b0b9a||0xc8;return function(_0x38c80f){if(_0x38c80f){return _0x4505f6[_0x3231('0x27')](_0x5b0b9a)[_0x3231('0x28')](_0x38c80f);}};}function respondWithFilteredResult(_0x11c1fc,_0x228db8){return function(_0x5889eb){if(_0x5889eb){var _0x51ec1b=typeof _0x228db8['offset']===_0x3231('0x29')&&typeof _0x228db8[_0x3231('0x2a')]===_0x3231('0x29');var _0x49b02e=_0x5889eb['count'];var _0x5a86c2=_0x51ec1b?0x0:_0x228db8[_0x3231('0x2b')];var _0x598a16=_0x51ec1b?_0x5889eb[_0x3231('0x2c')]:_0x228db8[_0x3231('0x2b')]+_0x228db8['limit'];var _0xb90939;if(_0x598a16>=_0x49b02e){_0x598a16=_0x49b02e;_0xb90939=0xc8;}else{_0xb90939=0xce;}_0x11c1fc[_0x3231('0x27')](_0xb90939);return _0x11c1fc['set']('Content-Range',_0x5a86c2+'-'+_0x598a16+'/'+_0x49b02e)['json'](_0x5889eb);}return null;};}function patchUpdates(_0x39e888){return function(_0x5de050){try{jsonpatch[_0x3231('0x2d')](_0x5de050,_0x39e888,!![]);}catch(_0x503e74){return BPromise[_0x3231('0x2e')](_0x503e74);}return _0x5de050[_0x3231('0x2f')]();};}function saveUpdates(_0x377ba3,_0x562a61){return function(_0x16095e){if(_0x16095e){return _0x16095e[_0x3231('0x30')](_0x377ba3)[_0x3231('0x31')](function(_0x2c2763){return _0x2c2763;});}return null;};}function removeEntity(_0x936de0,_0x46cd27){return function(_0x2097d9){if(_0x2097d9){return _0x2097d9[_0x3231('0x32')]()[_0x3231('0x31')](function(){_0x936de0['status'](0xcc)[_0x3231('0x33')]();});}};}function handleEntityNotFound(_0x158e53,_0x23bf25){return function(_0x11b8a4){if(!_0x11b8a4){_0x158e53[_0x3231('0x34')](0x194);}return _0x11b8a4;};}function handleError(_0x582281,_0x3b3b06){_0x3b3b06=_0x3b3b06||0x1f4;return function(_0x13a7c1){logger['error'](_0x13a7c1[_0x3231('0x35')]);if(_0x13a7c1[_0x3231('0x36')]){delete _0x13a7c1[_0x3231('0x36')];}_0x582281[_0x3231('0x27')](_0x3b3b06)['send'](_0x13a7c1);};}exports[_0x3231('0x37')]=function(_0x95df20,_0x22b08){var _0x356111={},_0xa97838={},_0x2fca59={'count':0x0,'rows':[]};var _0x4ea02a=_['map'](db[_0x3231('0x38')][_0x3231('0x39')],function(_0x3e04d8){return{'name':_0x3e04d8[_0x3231('0x3a')],'type':_0x3e04d8[_0x3231('0x3b')][_0x3231('0x3c')]};});_0xa97838['model']=_[_0x3231('0x3d')](_0x4ea02a,'name');_0xa97838[_0x3231('0x3e')]=_[_0x3231('0x3f')](_0x95df20[_0x3231('0x3e')]);_0xa97838[_0x3231('0x40')]=_[_0x3231('0x41')](_0xa97838[_0x3231('0x42')],_0xa97838[_0x3231('0x3e')]);_0x356111[_0x3231('0x43')]=_['intersection'](_0xa97838[_0x3231('0x42')],qs[_0x3231('0x44')](_0x95df20[_0x3231('0x3e')][_0x3231('0x44')]));_0x356111[_0x3231('0x43')]=_0x356111['attributes'][_0x3231('0x45')]?_0x356111[_0x3231('0x43')]:_0xa97838[_0x3231('0x42')];if(!_0x95df20['query'][_0x3231('0x46')]('nolimit')){_0x356111[_0x3231('0x2a')]=qs[_0x3231('0x2a')](_0x95df20['query'][_0x3231('0x2a')]);_0x356111[_0x3231('0x2b')]=qs[_0x3231('0x2b')](_0x95df20[_0x3231('0x3e')]['offset']);}_0x356111[_0x3231('0x47')]=qs['sort'](_0x95df20[_0x3231('0x3e')][_0x3231('0x48')]);_0x356111[_0x3231('0x49')]=qs[_0x3231('0x40')](_[_0x3231('0x4a')](_0x95df20['query'],_0xa97838[_0x3231('0x40')]),_0x4ea02a);if(_0x95df20['query'][_0x3231('0x4b')]){_0x356111[_0x3231('0x49')]=_[_0x3231('0x4c')](_0x356111[_0x3231('0x49')],{'$or':_[_0x3231('0x3d')](_0x4ea02a,function(_0xcb7188){if(_0xcb7188['type']!=='VIRTUAL'){var _0x20af1d={};_0x20af1d[_0xcb7188[_0x3231('0x36')]]={'$like':'%'+_0x95df20[_0x3231('0x3e')][_0x3231('0x4b')]+'%'};return _0x20af1d;}})});}_0x356111=_[_0x3231('0x4c')]({},_0x356111,_0x95df20['options']);var _0x1c4e0b={'where':_0x356111['where']};return db[_0x3231('0x38')][_0x3231('0x2c')](_0x1c4e0b)['then'](function(_0x2739ab){_0x2fca59[_0x3231('0x2c')]=_0x2739ab;if(_0x95df20[_0x3231('0x3e')][_0x3231('0x4d')]){_0x356111[_0x3231('0x4e')]=[{'all':!![]}];}return db[_0x3231('0x38')]['findAll'](_0x356111);})['then'](function(_0x4d6903){_0x2fca59[_0x3231('0x4f')]=_0x4d6903;return _0x2fca59;})['then'](respondWithFilteredResult(_0x22b08,_0x356111))[_0x3231('0x50')](handleError(_0x22b08,null));};exports[_0x3231('0x51')]=function(_0x1bd665,_0x38d4af){var _0x58e751={'raw':!![],'where':{'id':_0x1bd665[_0x3231('0x52')]['id']}},_0x532f3f={};_0x532f3f[_0x3231('0x42')]=_[_0x3231('0x3f')](db['WhatsappMessage'][_0x3231('0x39')]);_0x532f3f[_0x3231('0x3e')]=_[_0x3231('0x3f')](_0x1bd665[_0x3231('0x3e')]);_0x532f3f[_0x3231('0x40')]=_[_0x3231('0x41')](_0x532f3f['model'],_0x532f3f[_0x3231('0x3e')]);_0x58e751['attributes']=_['intersection'](_0x532f3f[_0x3231('0x42')],qs[_0x3231('0x44')](_0x1bd665[_0x3231('0x3e')][_0x3231('0x44')]));_0x58e751[_0x3231('0x43')]=_0x58e751['attributes']['length']?_0x58e751[_0x3231('0x43')]:_0x532f3f[_0x3231('0x42')];if(_0x1bd665[_0x3231('0x3e')][_0x3231('0x4d')]){_0x58e751['include']=[{'all':!![]}];}_0x58e751=_[_0x3231('0x4c')]({},_0x58e751,_0x1bd665[_0x3231('0x53')]);return db['WhatsappMessage'][_0x3231('0x54')](_0x58e751)[_0x3231('0x31')](handleEntityNotFound(_0x38d4af,null))[_0x3231('0x31')](respondWithResult(_0x38d4af,null))[_0x3231('0x50')](handleError(_0x38d4af,null));};exports[_0x3231('0x55')]=function(_0x5542e2,_0x5d5687){return db[_0x3231('0x38')][_0x3231('0x55')](_0x5542e2[_0x3231('0x56')],{})[_0x3231('0x31')](respondWithResult(_0x5d5687,0xc9))[_0x3231('0x50')](handleError(_0x5d5687,null));};exports[_0x3231('0x30')]=function(_0x1c2ca7,_0x4a9c78){if(_0x1c2ca7[_0x3231('0x56')]['id']){delete _0x1c2ca7[_0x3231('0x56')]['id'];}return db[_0x3231('0x38')]['find']({'where':{'id':_0x1c2ca7['params']['id']}})[_0x3231('0x31')](handleEntityNotFound(_0x4a9c78,null))[_0x3231('0x31')](saveUpdates(_0x1c2ca7[_0x3231('0x56')],null))[_0x3231('0x31')](respondWithResult(_0x4a9c78,null))[_0x3231('0x50')](handleError(_0x4a9c78,null));};exports['destroy']=function(_0x1280ad,_0x56280e){return db['WhatsappMessage'][_0x3231('0x54')]({'where':{'id':_0x1280ad[_0x3231('0x52')]['id']}})['then'](handleEntityNotFound(_0x56280e,null))[_0x3231('0x31')](removeEntity(_0x56280e,null))[_0x3231('0x50')](handleError(_0x56280e,null));};exports['describe']=function(_0x678743,_0x5c9c14){return db[_0x3231('0x38')]['describe']()[_0x3231('0x31')](respondWithResult(_0x5c9c14,null))['catch'](handleError(_0x5c9c14,null));};var interaction_log=require(_0x3231('0x57'))(_0x3231('0x58'));exports[_0x3231('0x59')]=function(_0x371f73,_0x30c65d,_0x34f27e){var _0x3e50b7={'agent':{},'channel':_0x3231('0x5a')};if(_0x371f73[_0x3231('0x56')]['id']){delete _0x371f73['body']['id'];}_0x371f73['body']['read']=!![];_0x371f73['body'][_0x3231('0x5b')]=moment()[_0x3231('0x5c')]('YYYY-MM-DD\x20HH:mm:ss');_0x371f73['body'][_0x3231('0x5d')]=_0x371f73[_0x3231('0x56')][_0x3231('0x5d')]||_0x371f73['user']['id'];_0x3e50b7[_0x3231('0x5e')]['id']=_0x371f73['body'][_0x3231('0x5d')];return db[_0x3231('0x38')]['find']({'where':{'id':_0x371f73[_0x3231('0x52')]['id'],'UserId':null}})[_0x3231('0x31')](handleEntityNotFound(_0x30c65d,null))['then'](saveUpdates(_0x371f73['body'],null))[_0x3231('0x31')](function(_0x3af29e){if(_0x3af29e){_0x3e50b7[_0x3231('0x25')]=_0x3af29e[_0x3231('0x5f')]({'plain':!![]});return db[_0x3231('0x60')][_0x3231('0x54')]({'where':{'id':_0x3af29e[_0x3231('0x61')]}});}return null;})[_0x3231('0x31')](handleEntityNotFound(_0x30c65d,null))['then'](function(_0x48138a){if(_0x48138a){return _0x48138a[_0x3231('0x30')]({'UserId':_0x371f73['body']['UserId'],'read1stAt':_[_0x3231('0x62')](_0x48138a[_0x3231('0x63')])?moment()[_0x3231('0x5c')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x3231('0x31')](function(_0x1624af){if(_0x1624af){_0x3e50b7[_0x3231('0x64')]=_0x1624af['get']({'plain':!![]});interaction_log[_0x3231('0x1e')](_0x3231('0x65'),_0x371f73[_0x3231('0x66')]['id'],_0x371f73['user'][_0x3231('0x36')],_0x371f73[_0x3231('0x66')][_0x3231('0x67')],_0x3e50b7[_0x3231('0x64')]['id'],_0x371f73[_0x3231('0x56')]?JSON[_0x3231('0x23')](_0x371f73[_0x3231('0x56')]):_0x3231('0x68'));return respondWithRpcPromise(_0x3231('0x69'),_0x3231('0x6a'),_0x3e50b7);}return null;})['then'](function(_0x38c288){var _0x2831f0=_0x3231('0x6b')+_0x38c288[_0x3231('0x25')][_0x3231('0x6c')];return db[_0x3231('0x6d')][_0x3231('0x3e')](_0x2831f0,{'type':db[_0x3231('0x6e')][_0x3231('0x6f')][_0x3231('0x70')],'raw':!![]})['then'](function(_0x153a82){return _0x153a82;});})[_0x3231('0x31')](function(_0x2b876d){if(_0x2b876d){_0x3e50b7[_0x3231('0x25')][_0x3231('0x71')]=_0x2b876d[0x0];if(!_0x371f73[_0x3231('0x56')][_0x3231('0x5d')])return;return db[_0x3231('0x72')][_0x3231('0x54')]({'where':{'id':_0x371f73[_0x3231('0x56')][_0x3231('0x5d')],'role':_0x3231('0x5e')},'attributes':['id',_0x3231('0x36'),_0x3231('0x73'),_0x3231('0x74'),_0x3231('0x75')],'raw':!![]});}return null;})['then'](function(_0x355c0d){if(!_0x355c0d)return null;_0x3e50b7[_0x3231('0x25')]['agent']=_0x355c0d;return _0x3e50b7;})[_0x3231('0x31')](function(_0x4ffbdf){if(_0x4ffbdf){if(_0x371f73['body']['manual']){_0x3e50b7[_0x3231('0x25')]['interface']=util['format']('SIP/%s',_0x371f73[_0x3231('0x66')][_0x3231('0x36')]);_0x3e50b7[_0x3231('0x25')][_0x3231('0x76')]=_0x3e50b7[_0x3231('0x76')];_0x3e50b7['message'][_0x3231('0x77')]=_0x3e50b7[_0x3231('0x76')];_0x3e50b7[_0x3231('0x25')]['event']=_0x3231('0x59');return respondWithRpcPromise('EventManager',_0x3231('0x78'),{'event':_0x3231('0x79'),'message':_0x3e50b7[_0x3231('0x25')]},client9002)[_0x3231('0x31')](function(){return _0x3e50b7;});}return _0x3e50b7;}return null;})[_0x3231('0x31')](respondWithResult(_0x30c65d,null))['catch'](handleError(_0x30c65d,null));};var interaction_log=require('../../config/logger')(_0x3231('0x58'));exports[_0x3231('0x2e')]=function(_0x5c2d09,_0x293d72,_0x4f6713){var _0x32c5bd={'agent':{},'channel':_0x3231('0x5a')};if(_0x5c2d09[_0x3231('0x56')]['id']){delete _0x5c2d09[_0x3231('0x56')]['id'];}_0x5c2d09[_0x3231('0x56')]['UserId']=_0x5c2d09[_0x3231('0x56')][_0x3231('0x5d')]||_0x5c2d09[_0x3231('0x66')]['id'];_0x32c5bd['agent']['id']=_0x5c2d09[_0x3231('0x56')][_0x3231('0x5d')];return db['WhatsappMessage'][_0x3231('0x54')]({'where':{'id':_0x5c2d09[_0x3231('0x52')]['id'],'UserId':null}})[_0x3231('0x31')](handleEntityNotFound(_0x293d72,null))['then'](function(_0x1282f2){if(_0x1282f2){_0x32c5bd[_0x3231('0x25')]=_0x1282f2[_0x3231('0x5f')]({'plain':!![]});return db[_0x3231('0x60')]['find']({'where':{'id':_0x1282f2[_0x3231('0x61')]}});}return null;})[_0x3231('0x31')](handleEntityNotFound(_0x293d72,null))[_0x3231('0x31')](function(_0x14d554){if(_0x14d554){_0x32c5bd[_0x3231('0x64')]=_0x14d554[_0x3231('0x5f')]({'plain':!![]});interaction_log[_0x3231('0x1e')](_0x3231('0x7a'),_0x5c2d09[_0x3231('0x66')]['id'],_0x5c2d09[_0x3231('0x66')][_0x3231('0x36')],_0x5c2d09[_0x3231('0x66')][_0x3231('0x67')],_0x32c5bd[_0x3231('0x64')]['id'],_0x5c2d09[_0x3231('0x56')]?JSON[_0x3231('0x23')](_0x5c2d09[_0x3231('0x56')]):_0x3231('0x68'));return respondWithRpcPromise(_0x3231('0x7b'),_0x3231('0x7c'),_0x32c5bd);}return null;})[_0x3231('0x31')](function(_0xd23975){var _0x2a8ee5='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0xd23975[_0x3231('0x25')]['ContactId'];return db[_0x3231('0x6d')]['query'](_0x2a8ee5,{'type':db['Sequelize'][_0x3231('0x6f')][_0x3231('0x70')],'raw':!![]})['then'](function(_0x33f120){return _0x33f120;});})[_0x3231('0x31')](function(_0x3d0330){if(_0x3d0330){_0x32c5bd[_0x3231('0x25')][_0x3231('0x71')]=_0x3d0330[0x0];if(!_0x5c2d09[_0x3231('0x56')][_0x3231('0x5d')])return;return db[_0x3231('0x72')][_0x3231('0x54')]({'where':{'id':_0x5c2d09['body']['UserId'],'role':'agent'},'attributes':['id','name',_0x3231('0x73'),_0x3231('0x74'),'internal'],'raw':!![]});}return null;})['then'](function(_0x12fe54){if(!_0x12fe54)return null;_0x32c5bd[_0x3231('0x25')]['agent']=_0x12fe54;return _0x32c5bd;})[_0x3231('0x31')](function(_0x34c33b){if(_0x34c33b){_0x34c33b[_0x3231('0x25')][_0x3231('0x7d')]=util[_0x3231('0x5c')](_0x3231('0x7e'),_0x5c2d09[_0x3231('0x66')][_0x3231('0x36')]);_0x34c33b[_0x3231('0x25')][_0x3231('0x76')]=_0x32c5bd[_0x3231('0x76')];_0x34c33b[_0x3231('0x25')][_0x3231('0x77')]=_0x32c5bd[_0x3231('0x76')];_0x34c33b['message'][_0x3231('0x7f')]='reject';respondWithRpcPromise('EventManager',_0x3231('0x78'),{'event':_0x3231('0x80'),'message':_0x34c33b['message']},client9002);return _0x32c5bd;}return null;})[_0x3231('0x31')](respondWithResult(_0x293d72,null))['catch'](handleError(_0x293d72,null));};exports[_0x3231('0x27')]=function(_0x383c5f,_0x49859d,_0x30e0b0){if(_0x383c5f['body']['id']){delete _0x383c5f[_0x3231('0x56')]['id'];}var _0x3b2417;return db['WhatsappMessage'][_0x3231('0x54')]({'where':{'id':_0x383c5f['params']['id']}})[_0x3231('0x31')](handleEntityNotFound(_0x49859d,null))['then'](function(_0x5dcc1d){if(_0x5dcc1d){_0x3b2417=_0x5dcc1d;return db[_0x3231('0x81')]['find']({'where':{'id':_0x5dcc1d[_0x3231('0x82')]}});}})['then'](handleEntityNotFound(_0x49859d,null))[_0x3231('0x31')](function(_0x49089e){if(_0x49089e){logger['debug'](_0x3231('0x83'),_0x3231('0x27'),_0x3231('0x84'),_0x49089e[_0x3231('0x3b')],util[_0x3231('0x85')](_0x383c5f[_0x3231('0x56')],{'showHidden':![],'depth':null}));switch(_0x49089e[_0x3231('0x3b')]){case _0x3231('0x86'):if(_0x383c5f[_0x3231('0x56')]['MessageSid']&&_0x383c5f['body'][_0x3231('0x87')]===_0x3b2417['messageId']&&_0x383c5f[_0x3231('0x56')][_0x3231('0x88')]&&_0x383c5f['body']['MessageStatus']===_0x3231('0x89')){return _0x3b2417['update']({'read':!![]});}else{logger[_0x3231('0x24')]('WhatsappAccount,\x20%s,\x20%s,\x20%s','status',_0x3231('0x86'),util[_0x3231('0x85')](_0x383c5f[_0x3231('0x56')],{'showHidden':![],'depth':null}));}break;}return _0x3b2417;}})[_0x3231('0x31')](respondWithResult(_0x49859d,null))['catch'](handleError(_0x49859d,null));}; \ No newline at end of file +var _0x1a43=['redis','localhost','socket.io-emitter','register','jayson/promise','client','http','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','status','end','offset','undefined','count','reject','save','update','destroy','stack','name','send','WhatsappMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','map','VIRTUAL','merge','includeAll','include','findAll','show','params','options','catch','create','body','find','describe','accept','whatsapp','read','readAt','format','UserId','user','agent','get','WhatsappInteraction','WhatsappInteractionId','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','internal','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','whatsapp-interactions','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','ContactId','email','motionChannel','rejectmessage','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','twilio','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','defaults'];(function(_0xaa3e87,_0x6faec1){var _0x1e01f6=function(_0x5c3066){while(--_0x5c3066){_0xaa3e87['push'](_0xaa3e87['shift']());}};_0x1e01f6(++_0x6faec1);}(_0x1a43,0x17c));var _0x31a4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1a43[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x31a4('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x31a4('0x1'));var rp=require(_0x31a4('0x2'));var moment=require('moment');var BPromise=require(_0x31a4('0x3'));var Mustache=require(_0x31a4('0x4'));var util=require(_0x31a4('0x5'));var path=require(_0x31a4('0x6'));var sox=require(_0x31a4('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x31a4('0x8'));var squel=require(_0x31a4('0x9'));var crypto=require(_0x31a4('0xa'));var jsforce=require(_0x31a4('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x31a4('0xc'));var querystring=require(_0x31a4('0xd'));var Papa=require(_0x31a4('0xe'));var Redis=require('ioredis');var authService=require(_0x31a4('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x31a4('0x10'))(_0x31a4('0x11'));var utils=require(_0x31a4('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x31a4('0x13'));var db=require(_0x31a4('0x14'))['db'];config['redis']=_[_0x31a4('0x15')](config[_0x31a4('0x16')],{'host':_0x31a4('0x17'),'port':0x18eb});var socket=require(_0x31a4('0x18'))(new Redis(config[_0x31a4('0x16')]));require('./whatsappMessage.socket')[_0x31a4('0x19')](socket);var jayson=require(_0x31a4('0x1a'));var client=jayson[_0x31a4('0x1b')][_0x31a4('0x1c')]({'port':0x232c});var client9002=jayson[_0x31a4('0x1b')][_0x31a4('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x57be33,_0x4fff23,_0x312009,_0x547b24){return new BPromise(function(_0x29b8de,_0x128dac){var _0x595ebd=_0x547b24||client;return _0x595ebd[_0x31a4('0x1d')](_0x57be33,_0x312009)[_0x31a4('0x1e')](function(_0x47e7c0){logger[_0x31a4('0x1f')](_0x31a4('0x20'),_0x4fff23,_0x31a4('0x21'));logger['debug'](_0x31a4('0x22'),_0x4fff23,_0x31a4('0x21'),JSON[_0x31a4('0x23')](_0x47e7c0));if(_0x47e7c0[_0x31a4('0x24')]){if(_0x47e7c0['error']['code']===0x1f4){logger[_0x31a4('0x24')]('WhatsappMessage,\x20%s,\x20%s',_0x4fff23,_0x47e7c0[_0x31a4('0x24')][_0x31a4('0x25')]);return _0x128dac(_0x47e7c0['error'][_0x31a4('0x25')]);}logger[_0x31a4('0x24')](_0x31a4('0x20'),_0x4fff23,_0x47e7c0[_0x31a4('0x24')][_0x31a4('0x25')]);return _0x29b8de(_0x47e7c0[_0x31a4('0x24')][_0x31a4('0x25')]);}else{logger[_0x31a4('0x1f')](_0x31a4('0x20'),_0x4fff23,_0x31a4('0x21'));_0x29b8de(_0x47e7c0[_0x31a4('0x26')]['message']);}})['catch'](function(_0x57f834){logger[_0x31a4('0x24')](_0x31a4('0x20'),_0x4fff23,_0x57f834);_0x128dac(_0x57f834);});});}function respondWithStatusCode(_0x37891f,_0x3e063b){_0x3e063b=_0x3e063b||0xcc;return function(_0x558ff0){if(_0x558ff0){return _0x37891f['sendStatus'](_0x3e063b);}return _0x37891f[_0x31a4('0x27')](_0x3e063b)[_0x31a4('0x28')]();};}function respondWithResult(_0x23158c,_0x5ebfb8){_0x5ebfb8=_0x5ebfb8||0xc8;return function(_0x473c7d){if(_0x473c7d){return _0x23158c[_0x31a4('0x27')](_0x5ebfb8)['json'](_0x473c7d);}};}function respondWithFilteredResult(_0x1a9a41,_0x38f927){return function(_0x743519){if(_0x743519){var _0x4fe700=typeof _0x38f927[_0x31a4('0x29')]===_0x31a4('0x2a')&&typeof _0x38f927['limit']===_0x31a4('0x2a');var _0x2b1789=_0x743519[_0x31a4('0x2b')];var _0x53ee5=_0x4fe700?0x0:_0x38f927[_0x31a4('0x29')];var _0x86866c=_0x4fe700?_0x743519[_0x31a4('0x2b')]:_0x38f927[_0x31a4('0x29')]+_0x38f927['limit'];var _0x1261e4;if(_0x86866c>=_0x2b1789){_0x86866c=_0x2b1789;_0x1261e4=0xc8;}else{_0x1261e4=0xce;}_0x1a9a41[_0x31a4('0x27')](_0x1261e4);return _0x1a9a41['set']('Content-Range',_0x53ee5+'-'+_0x86866c+'/'+_0x2b1789)['json'](_0x743519);}return null;};}function patchUpdates(_0x4649ce){return function(_0x521026){try{jsonpatch['apply'](_0x521026,_0x4649ce,!![]);}catch(_0x45acbf){return BPromise[_0x31a4('0x2c')](_0x45acbf);}return _0x521026[_0x31a4('0x2d')]();};}function saveUpdates(_0x1838a1,_0x2e032e){return function(_0x3d752c){if(_0x3d752c){return _0x3d752c[_0x31a4('0x2e')](_0x1838a1)[_0x31a4('0x1e')](function(_0x52cdd0){return _0x52cdd0;});}return null;};}function removeEntity(_0x4ffc2a,_0x49d14a){return function(_0x51c24c){if(_0x51c24c){return _0x51c24c[_0x31a4('0x2f')]()[_0x31a4('0x1e')](function(){_0x4ffc2a['status'](0xcc)[_0x31a4('0x28')]();});}};}function handleEntityNotFound(_0x150384,_0xf1373c){return function(_0x395f46){if(!_0x395f46){_0x150384['sendStatus'](0x194);}return _0x395f46;};}function handleError(_0x11c656,_0x29bb8b){_0x29bb8b=_0x29bb8b||0x1f4;return function(_0x420d6e){logger['error'](_0x420d6e[_0x31a4('0x30')]);if(_0x420d6e[_0x31a4('0x31')]){delete _0x420d6e['name'];}_0x11c656['status'](_0x29bb8b)[_0x31a4('0x32')](_0x420d6e);};}exports['index']=function(_0x110def,_0x53f90c){var _0x2bc9c1={},_0x32f55e={},_0x4dc936={'count':0x0,'rows':[]};var _0x135087=_['map'](db[_0x31a4('0x33')][_0x31a4('0x34')],function(_0x33576e){return{'name':_0x33576e[_0x31a4('0x35')],'type':_0x33576e[_0x31a4('0x36')][_0x31a4('0x37')]};});_0x32f55e[_0x31a4('0x38')]=_['map'](_0x135087,_0x31a4('0x31'));_0x32f55e[_0x31a4('0x39')]=_[_0x31a4('0x3a')](_0x110def['query']);_0x32f55e[_0x31a4('0x3b')]=_[_0x31a4('0x3c')](_0x32f55e[_0x31a4('0x38')],_0x32f55e[_0x31a4('0x39')]);_0x2bc9c1[_0x31a4('0x3d')]=_[_0x31a4('0x3c')](_0x32f55e['model'],qs['fields'](_0x110def[_0x31a4('0x39')][_0x31a4('0x3e')]));_0x2bc9c1[_0x31a4('0x3d')]=_0x2bc9c1[_0x31a4('0x3d')][_0x31a4('0x3f')]?_0x2bc9c1[_0x31a4('0x3d')]:_0x32f55e[_0x31a4('0x38')];if(!_0x110def[_0x31a4('0x39')][_0x31a4('0x40')](_0x31a4('0x41'))){_0x2bc9c1[_0x31a4('0x42')]=qs['limit'](_0x110def[_0x31a4('0x39')][_0x31a4('0x42')]);_0x2bc9c1['offset']=qs['offset'](_0x110def['query'][_0x31a4('0x29')]);}_0x2bc9c1['order']=qs['sort'](_0x110def[_0x31a4('0x39')][_0x31a4('0x43')]);_0x2bc9c1[_0x31a4('0x44')]=qs[_0x31a4('0x3b')](_[_0x31a4('0x45')](_0x110def[_0x31a4('0x39')],_0x32f55e[_0x31a4('0x3b')]),_0x135087);if(_0x110def['query'][_0x31a4('0x46')]){_0x2bc9c1[_0x31a4('0x44')]=_['merge'](_0x2bc9c1[_0x31a4('0x44')],{'$or':_[_0x31a4('0x47')](_0x135087,function(_0x9ecd6e){if(_0x9ecd6e[_0x31a4('0x36')]!==_0x31a4('0x48')){var _0xb98d05={};_0xb98d05[_0x9ecd6e[_0x31a4('0x31')]]={'$like':'%'+_0x110def[_0x31a4('0x39')][_0x31a4('0x46')]+'%'};return _0xb98d05;}})});}_0x2bc9c1=_[_0x31a4('0x49')]({},_0x2bc9c1,_0x110def['options']);var _0x540a5f={'where':_0x2bc9c1['where']};return db[_0x31a4('0x33')][_0x31a4('0x2b')](_0x540a5f)[_0x31a4('0x1e')](function(_0x5a1277){_0x4dc936[_0x31a4('0x2b')]=_0x5a1277;if(_0x110def[_0x31a4('0x39')][_0x31a4('0x4a')]){_0x2bc9c1[_0x31a4('0x4b')]=[{'all':!![]}];}return db['WhatsappMessage'][_0x31a4('0x4c')](_0x2bc9c1);})[_0x31a4('0x1e')](function(_0x32b3f7){_0x4dc936['rows']=_0x32b3f7;return _0x4dc936;})[_0x31a4('0x1e')](respondWithFilteredResult(_0x53f90c,_0x2bc9c1))['catch'](handleError(_0x53f90c,null));};exports[_0x31a4('0x4d')]=function(_0x54a774,_0x2b890d){var _0x35435a={'raw':!![],'where':{'id':_0x54a774[_0x31a4('0x4e')]['id']}},_0x56664b={};_0x56664b[_0x31a4('0x38')]=_[_0x31a4('0x3a')](db[_0x31a4('0x33')][_0x31a4('0x34')]);_0x56664b[_0x31a4('0x39')]=_[_0x31a4('0x3a')](_0x54a774[_0x31a4('0x39')]);_0x56664b[_0x31a4('0x3b')]=_['intersection'](_0x56664b[_0x31a4('0x38')],_0x56664b[_0x31a4('0x39')]);_0x35435a[_0x31a4('0x3d')]=_['intersection'](_0x56664b[_0x31a4('0x38')],qs['fields'](_0x54a774[_0x31a4('0x39')]['fields']));_0x35435a[_0x31a4('0x3d')]=_0x35435a['attributes'][_0x31a4('0x3f')]?_0x35435a['attributes']:_0x56664b[_0x31a4('0x38')];if(_0x54a774['query']['includeAll']){_0x35435a['include']=[{'all':!![]}];}_0x35435a=_[_0x31a4('0x49')]({},_0x35435a,_0x54a774[_0x31a4('0x4f')]);return db[_0x31a4('0x33')]['find'](_0x35435a)[_0x31a4('0x1e')](handleEntityNotFound(_0x2b890d,null))['then'](respondWithResult(_0x2b890d,null))[_0x31a4('0x50')](handleError(_0x2b890d,null));};exports[_0x31a4('0x51')]=function(_0xb2223e,_0xafaaf1){return db['WhatsappMessage'][_0x31a4('0x51')](_0xb2223e[_0x31a4('0x52')],{})['then'](respondWithResult(_0xafaaf1,0xc9))[_0x31a4('0x50')](handleError(_0xafaaf1,null));};exports['update']=function(_0x599554,_0x3b1f8e){if(_0x599554[_0x31a4('0x52')]['id']){delete _0x599554[_0x31a4('0x52')]['id'];}return db[_0x31a4('0x33')][_0x31a4('0x53')]({'where':{'id':_0x599554[_0x31a4('0x4e')]['id']}})[_0x31a4('0x1e')](handleEntityNotFound(_0x3b1f8e,null))[_0x31a4('0x1e')](saveUpdates(_0x599554[_0x31a4('0x52')],null))['then'](respondWithResult(_0x3b1f8e,null))[_0x31a4('0x50')](handleError(_0x3b1f8e,null));};exports[_0x31a4('0x2f')]=function(_0x418bab,_0x29c183){return db[_0x31a4('0x33')][_0x31a4('0x53')]({'where':{'id':_0x418bab[_0x31a4('0x4e')]['id']}})[_0x31a4('0x1e')](handleEntityNotFound(_0x29c183,null))[_0x31a4('0x1e')](removeEntity(_0x29c183,null))[_0x31a4('0x50')](handleError(_0x29c183,null));};exports[_0x31a4('0x54')]=function(_0x331b95,_0x4c9724){return db[_0x31a4('0x33')][_0x31a4('0x54')]()[_0x31a4('0x1e')](respondWithResult(_0x4c9724,null))['catch'](handleError(_0x4c9724,null));};var interaction_log=require(_0x31a4('0x10'))('whatsapp-interactions');exports[_0x31a4('0x55')]=function(_0x3b93f6,_0xaa8c44,_0x760b72){var _0xbefb96={'agent':{},'channel':_0x31a4('0x56')};if(_0x3b93f6[_0x31a4('0x52')]['id']){delete _0x3b93f6['body']['id'];}_0x3b93f6[_0x31a4('0x52')][_0x31a4('0x57')]=!![];_0x3b93f6[_0x31a4('0x52')][_0x31a4('0x58')]=moment()[_0x31a4('0x59')]('YYYY-MM-DD\x20HH:mm:ss');_0x3b93f6['body'][_0x31a4('0x5a')]=_0x3b93f6[_0x31a4('0x52')]['UserId']||_0x3b93f6[_0x31a4('0x5b')]['id'];_0xbefb96[_0x31a4('0x5c')]['id']=_0x3b93f6[_0x31a4('0x52')][_0x31a4('0x5a')];return db[_0x31a4('0x33')][_0x31a4('0x53')]({'where':{'id':_0x3b93f6[_0x31a4('0x4e')]['id'],'UserId':null}})[_0x31a4('0x1e')](handleEntityNotFound(_0xaa8c44,null))[_0x31a4('0x1e')](saveUpdates(_0x3b93f6[_0x31a4('0x52')],null))[_0x31a4('0x1e')](function(_0x5d9696){if(_0x5d9696){_0xbefb96[_0x31a4('0x25')]=_0x5d9696[_0x31a4('0x5d')]({'plain':!![]});return db[_0x31a4('0x5e')][_0x31a4('0x53')]({'where':{'id':_0x5d9696[_0x31a4('0x5f')]}});}return null;})[_0x31a4('0x1e')](handleEntityNotFound(_0xaa8c44,null))[_0x31a4('0x1e')](function(_0x1e9434){if(_0x1e9434){return _0x1e9434['update']({'UserId':_0x3b93f6['body']['UserId'],'read1stAt':_['isNil'](_0x1e9434[_0x31a4('0x60')])?moment()[_0x31a4('0x59')](_0x31a4('0x61')):undefined});}return null;})[_0x31a4('0x1e')](function(_0xe70258){if(_0xe70258){_0xbefb96[_0x31a4('0x62')]=_0xe70258['get']({'plain':!![]});interaction_log['info'](_0x31a4('0x63'),_0x3b93f6[_0x31a4('0x5b')]['id'],_0x3b93f6[_0x31a4('0x5b')][_0x31a4('0x31')],_0x3b93f6[_0x31a4('0x5b')][_0x31a4('0x64')],_0xbefb96[_0x31a4('0x62')]['id'],_0x3b93f6[_0x31a4('0x52')]?JSON[_0x31a4('0x23')](_0x3b93f6['body']):_0x31a4('0x65'));return respondWithRpcPromise(_0x31a4('0x66'),'acceptMessage',_0xbefb96);}return null;})[_0x31a4('0x1e')](function(_0x520944){var _0x547c23=_0x31a4('0x67')+_0x520944[_0x31a4('0x25')]['ContactId'];return db[_0x31a4('0x68')]['query'](_0x547c23,{'type':db[_0x31a4('0x69')][_0x31a4('0x6a')][_0x31a4('0x6b')],'raw':!![]})[_0x31a4('0x1e')](function(_0x397407){return _0x397407;});})[_0x31a4('0x1e')](function(_0x407798){if(_0x407798){_0xbefb96[_0x31a4('0x25')][_0x31a4('0x6c')]=_0x407798[0x0];if(!_0x3b93f6[_0x31a4('0x52')][_0x31a4('0x5a')])return;return db[_0x31a4('0x6d')]['find']({'where':{'id':_0x3b93f6[_0x31a4('0x52')][_0x31a4('0x5a')],'role':_0x31a4('0x5c')},'attributes':['id',_0x31a4('0x31'),_0x31a4('0x6e'),'email',_0x31a4('0x6f')],'raw':!![]});}return null;})[_0x31a4('0x1e')](function(_0x4d3968){if(!_0x4d3968)return null;_0xbefb96['message']['agent']=_0x4d3968;return _0xbefb96;})[_0x31a4('0x1e')](function(_0x24448d){if(_0x24448d){if(_0x3b93f6['body'][_0x31a4('0x70')]){_0xbefb96['message'][_0x31a4('0x71')]=util[_0x31a4('0x59')](_0x31a4('0x72'),_0x3b93f6[_0x31a4('0x5b')]['name']);_0xbefb96[_0x31a4('0x25')][_0x31a4('0x73')]=_0xbefb96[_0x31a4('0x73')];_0xbefb96[_0x31a4('0x25')]['motionChannel']=_0xbefb96[_0x31a4('0x73')];_0xbefb96[_0x31a4('0x25')][_0x31a4('0x74')]='accept';return respondWithRpcPromise(_0x31a4('0x75'),_0x31a4('0x75'),{'event':_0x31a4('0x76'),'message':_0xbefb96['message']},client9002)['then'](function(){return _0xbefb96;});}return _0xbefb96;}return null;})[_0x31a4('0x1e')](respondWithResult(_0xaa8c44,null))[_0x31a4('0x50')](handleError(_0xaa8c44,null));};var interaction_log=require(_0x31a4('0x10'))(_0x31a4('0x77'));exports[_0x31a4('0x2c')]=function(_0x5455a3,_0x3e4ce9,_0x1492b1){var _0x501590={'agent':{},'channel':_0x31a4('0x56')};if(_0x5455a3[_0x31a4('0x52')]['id']){delete _0x5455a3[_0x31a4('0x52')]['id'];}_0x5455a3[_0x31a4('0x52')][_0x31a4('0x5a')]=_0x5455a3['body']['UserId']||_0x5455a3[_0x31a4('0x5b')]['id'];_0x501590[_0x31a4('0x5c')]['id']=_0x5455a3[_0x31a4('0x52')]['UserId'];return db[_0x31a4('0x33')][_0x31a4('0x53')]({'where':{'id':_0x5455a3['params']['id'],'UserId':null}})[_0x31a4('0x1e')](handleEntityNotFound(_0x3e4ce9,null))['then'](function(_0x205595){if(_0x205595){_0x501590['message']=_0x205595[_0x31a4('0x5d')]({'plain':!![]});return db[_0x31a4('0x5e')][_0x31a4('0x53')]({'where':{'id':_0x205595[_0x31a4('0x5f')]}});}return null;})[_0x31a4('0x1e')](handleEntityNotFound(_0x3e4ce9,null))[_0x31a4('0x1e')](function(_0x2a88c3){if(_0x2a88c3){_0x501590[_0x31a4('0x62')]=_0x2a88c3['get']({'plain':!![]});interaction_log['info'](_0x31a4('0x78'),_0x5455a3[_0x31a4('0x5b')]['id'],_0x5455a3[_0x31a4('0x5b')]['name'],_0x5455a3[_0x31a4('0x5b')]['role'],_0x501590[_0x31a4('0x62')]['id'],_0x5455a3[_0x31a4('0x52')]?JSON['stringify'](_0x5455a3[_0x31a4('0x52')]):_0x31a4('0x65'));return respondWithRpcPromise('RejectMessage',_0x31a4('0x79'),_0x501590);}return null;})['then'](function(_0x15b0a8){var _0x220554=_0x31a4('0x67')+_0x15b0a8[_0x31a4('0x25')][_0x31a4('0x7a')];return db[_0x31a4('0x68')][_0x31a4('0x39')](_0x220554,{'type':db['Sequelize'][_0x31a4('0x6a')][_0x31a4('0x6b')],'raw':!![]})['then'](function(_0x543845){return _0x543845;});})['then'](function(_0x20e449){if(_0x20e449){_0x501590[_0x31a4('0x25')][_0x31a4('0x6c')]=_0x20e449[0x0];if(!_0x5455a3[_0x31a4('0x52')][_0x31a4('0x5a')])return;return db[_0x31a4('0x6d')][_0x31a4('0x53')]({'where':{'id':_0x5455a3[_0x31a4('0x52')][_0x31a4('0x5a')],'role':_0x31a4('0x5c')},'attributes':['id',_0x31a4('0x31'),_0x31a4('0x6e'),_0x31a4('0x7b'),_0x31a4('0x6f')],'raw':!![]});}return null;})['then'](function(_0x59de92){if(!_0x59de92)return null;_0x501590[_0x31a4('0x25')][_0x31a4('0x5c')]=_0x59de92;return _0x501590;})[_0x31a4('0x1e')](function(_0x4f3b0f){if(_0x4f3b0f){_0x4f3b0f['message']['interface']=util[_0x31a4('0x59')](_0x31a4('0x72'),_0x5455a3[_0x31a4('0x5b')][_0x31a4('0x31')]);_0x4f3b0f['message'][_0x31a4('0x73')]=_0x501590[_0x31a4('0x73')];_0x4f3b0f[_0x31a4('0x25')][_0x31a4('0x7c')]=_0x501590['channel'];_0x4f3b0f[_0x31a4('0x25')][_0x31a4('0x74')]='reject';respondWithRpcPromise(_0x31a4('0x75'),'EventManager',{'event':_0x31a4('0x7d'),'message':_0x4f3b0f[_0x31a4('0x25')]},client9002);return _0x501590;}return null;})['then'](respondWithResult(_0x3e4ce9,null))[_0x31a4('0x50')](handleError(_0x3e4ce9,null));};exports['status']=function(_0x42e854,_0x5120f9,_0x13ac24){if(_0x42e854[_0x31a4('0x52')]['id']){delete _0x42e854[_0x31a4('0x52')]['id'];}var _0x5e625b;return db[_0x31a4('0x33')][_0x31a4('0x53')]({'where':{'id':_0x42e854['params']['id']}})[_0x31a4('0x1e')](handleEntityNotFound(_0x5120f9,null))[_0x31a4('0x1e')](function(_0x4aca77){if(_0x4aca77){_0x5e625b=_0x4aca77;return db['WhatsappAccount'][_0x31a4('0x53')]({'where':{'id':_0x4aca77[_0x31a4('0x7e')]}});}})[_0x31a4('0x1e')](handleEntityNotFound(_0x5120f9,null))[_0x31a4('0x1e')](function(_0xd47cc2){if(_0xd47cc2){logger['debug'](_0x31a4('0x7f'),_0x31a4('0x27'),_0x31a4('0x80'),_0xd47cc2[_0x31a4('0x36')],util['inspect'](_0x42e854[_0x31a4('0x52')],{'showHidden':![],'depth':null}));switch(_0xd47cc2['type']){case _0x31a4('0x81'):if(_0x42e854[_0x31a4('0x52')][_0x31a4('0x82')]&&_0x42e854[_0x31a4('0x52')]['MessageSid']===_0x5e625b[_0x31a4('0x83')]&&_0x42e854[_0x31a4('0x52')]['MessageStatus']&&_0x42e854['body'][_0x31a4('0x84')]==='read'){return _0x5e625b[_0x31a4('0x2e')]({'read':!![]});}else{logger['error'](_0x31a4('0x85'),_0x31a4('0x27'),_0x31a4('0x81'),util['inspect'](_0x42e854[_0x31a4('0x52')],{'showHidden':![],'depth':null}));}break;}return _0x5e625b;}})[_0x31a4('0x1e')](respondWithResult(_0x5120f9,null))['catch'](handleError(_0x5120f9,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index cbe9ed8..c7957b0 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 _0x44a3=['emit','hasOwnProperty','events','../../mysqldb','WhatsappMessage','setMaxListeners','save','update','remove'];(function(_0x1a0724,_0x122b92){var _0x470a96=function(_0x5894fd){while(--_0x5894fd){_0x1a0724['push'](_0x1a0724['shift']());}};_0x470a96(++_0x122b92);}(_0x44a3,0x1a9));var _0x344a=function(_0x49d7c8,_0x52d9a3){_0x49d7c8=_0x49d7c8-0x0;var _0x450089=_0x44a3[_0x49d7c8];return _0x450089;};'use strict';var EventEmitter=require(_0x344a('0x0'));var WhatsappMessage=require(_0x344a('0x1'))['db'][_0x344a('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x344a('0x3')](0x0);var events={'afterCreate':_0x344a('0x4'),'afterUpdate':_0x344a('0x5'),'afterDestroy':_0x344a('0x6')};function emitEvent(_0x212a39){return function(_0x528a13,_0x23004c,_0x1bc716){WhatsappMessageEvents[_0x344a('0x7')](_0x212a39+':'+_0x528a13['id'],_0x528a13);WhatsappMessageEvents[_0x344a('0x7')](_0x212a39,_0x528a13);_0x1bc716(null);};}for(var e in events){if(events[_0x344a('0x8')](e)){var event=events[e];WhatsappMessage['hook'](e,emitEvent(event));}}module['exports']=WhatsappMessageEvents; \ No newline at end of file +var _0x9c5e=['save','emit','hasOwnProperty','hook','events','../../mysqldb','WhatsappMessage','setMaxListeners'];(function(_0x4491d9,_0x5856ec){var _0x3e9dba=function(_0x2a6302){while(--_0x2a6302){_0x4491d9['push'](_0x4491d9['shift']());}};_0x3e9dba(++_0x5856ec);}(_0x9c5e,0x9c));var _0xe9c5=function(_0x355806,_0x22db75){_0x355806=_0x355806-0x0;var _0x735940=_0x9c5e[_0x355806];return _0x735940;};'use strict';var EventEmitter=require(_0xe9c5('0x0'));var WhatsappMessage=require(_0xe9c5('0x1'))['db'][_0xe9c5('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0xe9c5('0x3')](0x0);var events={'afterCreate':_0xe9c5('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x595373){return function(_0x120d2f,_0x13d5d7,_0x4fa4c5){WhatsappMessageEvents[_0xe9c5('0x5')](_0x595373+':'+_0x120d2f['id'],_0x120d2f);WhatsappMessageEvents[_0xe9c5('0x5')](_0x595373,_0x120d2f);_0x4fa4c5(null);};}for(var e in events){if(events[_0xe9c5('0x6')](e)){var event=events[e];WhatsappMessage[_0xe9c5('0x7')](e,emitEvent(event));}}module['exports']=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index 062913f..97aa70e 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 _0x2516=['catch','WhatsappAccount','find','WhatsappAccountId','type','twilio','authToken','phone','accountSid','messages','whatsapp:','remote','/status?token=','token','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','inspect','afterCreate','sinch','/whatsapp/v1/','/messages/','text','POST','Bearer\x20','application/json','statuses','message_id','err','WhatsappMessage,\x20%s','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','node-fetch','path','rimraf','../../config/environment','./whatsappMessage.attributes','exports','define','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','WhatsappInteraction','findOne','then','update','createdAt'];(function(_0x43e6a5,_0x2b55d3){var _0x4c79e5=function(_0x435f9d){while(--_0x435f9d){_0x43e6a5['push'](_0x43e6a5['shift']());}};_0x4c79e5(++_0x2b55d3);}(_0x2516,0x9d));var _0x6251=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x2516[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x6251('0x0'));var util=require(_0x6251('0x1'));var logger=require(_0x6251('0x2'))(_0x6251('0x3'));var moment=require(_0x6251('0x4'));var BPromise=require('bluebird');var rp=require(_0x6251('0x5'));var fetch=require(_0x6251('0x6'));var fs=require('fs');var path=require(_0x6251('0x7'));var rimraf=require(_0x6251('0x8'));var config=require(_0x6251('0x9'));var attributes=require(_0x6251('0xa'));module[_0x6251('0xb')]=function(_0x3be691,_0x279080){return _0x3be691[_0x6251('0xc')](_0x6251('0xd'),attributes,{'tableName':_0x6251('0xe'),'paranoid':![],'indexes':[{'name':_0x6251('0xf'),'fields':[_0x6251('0xf')]},{'name':_0x6251('0x10'),'fields':[_0x6251('0x11')],'type':_0x6251('0x12')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4cd925,_0x2e981b,_0x41694c){var _0x424c73=_0x3be691[_0x6251('0x13')];var _0x2ae66c=_0x4cd925[_0x6251('0x14')]({'plain':!![]});if(_0x2ae66c[_0x6251('0x15')]['toLowerCase']()==='in'||_0x2ae66c[_0x6251('0x15')][_0x6251('0x16')]()===_0x6251('0x17')&&!_0x2ae66c[_0x6251('0x18')]&&!_[_0x6251('0x19')](_0x2ae66c[_0x6251('0x1a')])){_0x424c73[_0x6251('0x1b')][_0x6251('0x1c')]({'where':{'id':_0x2ae66c['WhatsappInteractionId']}})[_0x6251('0x1d')](function(_0x34e438){if(_0x34e438){_0x34e438[_0x6251('0x1e')]({'lastMsgAt':_0x2ae66c[_0x6251('0x1f')],'lastMsgDirection':_0x2ae66c[_0x6251('0x15')]['toLowerCase']()});}})[_0x6251('0x20')](function(_0x3d8231){console['error'](_0x3d8231);});}if(_0x2ae66c[_0x6251('0x15')]===_0x6251('0x17')&&!_0x2ae66c[_0x6251('0x18')]){var _0xff6a9f;_0x424c73[_0x6251('0x21')][_0x6251('0x22')]({'where':{'id':_0x2ae66c[_0x6251('0x23')]},'raw':!![]})['then'](function(_0x18a395){_0xff6a9f=_0x18a395;if(_0xff6a9f&&_0xff6a9f[_0x6251('0x24')]){switch(_0xff6a9f[_0x6251('0x24')]){case _0x6251('0x25'):var _0x1e92ee=require('twilio');if(_0xff6a9f['accountSid']&&_0xff6a9f[_0x6251('0x26')]&&_0xff6a9f[_0x6251('0x27')]){var _0x11a64f=new _0x1e92ee(_0xff6a9f[_0x6251('0x28')],_0xff6a9f[_0x6251('0x26')]);_0x11a64f[_0x6251('0x29')]['create']({'body':_0x2ae66c[_0x6251('0x11')],'to':_0x6251('0x2a')+_0x2ae66c[_0x6251('0x27')],'from':'whatsapp:'+_0xff6a9f[_0x6251('0x27')],'statusCallback':_0xff6a9f[_0x6251('0x2b')]+'/api/whatsapp/messages/'+_0x2ae66c['id']+_0x6251('0x2c')+_0xff6a9f[_0x6251('0x2d')]})[_0x6251('0x1d')](function(_0x1a6043){if(_0x1a6043[_0x6251('0x2e')]){return _0x4cd925[_0x6251('0x1e')]({'messageId':_0x1a6043[_0x6251('0x2e')]});}})[_0x6251('0x20')](function(_0x40fdd9){logger['error'](_0x6251('0x2f'),'afterCreate',_0x6251('0x25'),util[_0x6251('0x30')](_0x40fdd9,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x6251('0x2f'),_0x6251('0x31'),_0x6251('0x25'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0x6251('0x32'):var _0x10b85f=_0xff6a9f['accountSid'];var _0x1799f0=_0xff6a9f[_0x6251('0x26')];var _0x317a01=_0xff6a9f['baseUrl']+_0x6251('0x33')+_0x10b85f+_0x6251('0x34');var _0x2e0ac9={'to':[_0x2ae66c[_0x6251('0x27')]],'message':{'type':_0x6251('0x35'),'text':_0x2ae66c[_0x6251('0x11')]}};var _0x17f8dd={'method':_0x6251('0x36'),'uri':_0x317a01,'headers':{'Authorization':_0x6251('0x37')+_0x1799f0,'Content-Type':_0x6251('0x38')},'body':_0x2e0ac9,'json':!![]};rp(_0x17f8dd)['then'](function(_0x1d685a){if(_0x1d685a[_0x6251('0x39')][0x0][_0x6251('0x3a')]){return _0x4cd925[_0x6251('0x1e')]({'messageId':_0x1d685a[_0x6251('0x39')][0x0][_0x6251('0x3a')]});}})[_0x6251('0x20')](function(_0x5c4497){logger[_0x6251('0x3b')](_0x6251('0x3c'),_0x5c4497);});break;}}})['finally'](function(){_0x41694c();});}else{_0x41694c();}}},'charset':_0x6251('0x3d'),'collate':_0x6251('0x3e')});}; \ No newline at end of file +var _0xca2f=['then','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','baseUrl','/whatsapp/v1/','Bearer\x20','application/json','statuses','message_id','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','./whatsappMessage.attributes','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','body','FULLTEXT','models','get','toLowerCase','direction','out','secret','isNil','UserId','WhatsappInteraction','findOne','WhatsappInteractionId','update','createdAt','catch','error','type','twilio','accountSid','authToken','phone','create','whatsapp:','remote','/api/whatsapp/messages/','token'];(function(_0x279d37,_0x14de3f){var _0x530173=function(_0x37fc79){while(--_0x37fc79){_0x279d37['push'](_0x279d37['shift']());}};_0x530173(++_0x14de3f);}(_0xca2f,0x11c));var _0xfca2=function(_0x422a30,_0x4db3ff){_0x422a30=_0x422a30-0x0;var _0x2747ed=_0xca2f[_0x422a30];return _0x2747ed;};'use strict';var _=require(_0xfca2('0x0'));var util=require(_0xfca2('0x1'));var logger=require(_0xfca2('0x2'))(_0xfca2('0x3'));var moment=require(_0xfca2('0x4'));var BPromise=require(_0xfca2('0x5'));var rp=require(_0xfca2('0x6'));var fetch=require('node-fetch');var fs=require('fs');var path=require(_0xfca2('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xfca2('0x8'));module['exports']=function(_0x2f4d18,_0x59718b){return _0x2f4d18['define'](_0xfca2('0x9'),attributes,{'tableName':_0xfca2('0xa'),'paranoid':![],'indexes':[{'name':_0xfca2('0xb'),'fields':[_0xfca2('0xb')]},{'name':_0xfca2('0xc'),'fields':[_0xfca2('0xd')],'type':_0xfca2('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4dee3a,_0x5be795,_0x38b04d){var _0x17e589=_0x2f4d18[_0xfca2('0xf')];var _0x138e21=_0x4dee3a[_0xfca2('0x10')]({'plain':!![]});if(_0x138e21['direction'][_0xfca2('0x11')]()==='in'||_0x138e21[_0xfca2('0x12')][_0xfca2('0x11')]()===_0xfca2('0x13')&&!_0x138e21[_0xfca2('0x14')]&&!_[_0xfca2('0x15')](_0x138e21[_0xfca2('0x16')])){_0x17e589[_0xfca2('0x17')][_0xfca2('0x18')]({'where':{'id':_0x138e21[_0xfca2('0x19')]}})['then'](function(_0x17d35e){if(_0x17d35e){_0x17d35e[_0xfca2('0x1a')]({'lastMsgAt':_0x138e21[_0xfca2('0x1b')],'lastMsgDirection':_0x138e21[_0xfca2('0x12')]['toLowerCase']()});}})[_0xfca2('0x1c')](function(_0x234ccd){console[_0xfca2('0x1d')](_0x234ccd);});}if(_0x138e21[_0xfca2('0x12')]==='out'&&!_0x138e21['secret']){var _0x31f0f3;_0x17e589['WhatsappAccount']['find']({'where':{'id':_0x138e21['WhatsappAccountId']},'raw':!![]})['then'](function(_0x4a2ef){_0x31f0f3=_0x4a2ef;if(_0x31f0f3&&_0x31f0f3[_0xfca2('0x1e')]){switch(_0x31f0f3[_0xfca2('0x1e')]){case _0xfca2('0x1f'):var _0x35a1b7=require(_0xfca2('0x1f'));if(_0x31f0f3[_0xfca2('0x20')]&&_0x31f0f3[_0xfca2('0x21')]&&_0x31f0f3[_0xfca2('0x22')]){var _0x55c4a6=new _0x35a1b7(_0x31f0f3[_0xfca2('0x20')],_0x31f0f3[_0xfca2('0x21')]);_0x55c4a6['messages'][_0xfca2('0x23')]({'body':_0x138e21[_0xfca2('0xd')],'to':_0xfca2('0x24')+_0x138e21[_0xfca2('0x22')],'from':_0xfca2('0x24')+_0x31f0f3[_0xfca2('0x22')],'statusCallback':_0x31f0f3[_0xfca2('0x25')]+_0xfca2('0x26')+_0x138e21['id']+'/status?token='+_0x31f0f3[_0xfca2('0x27')]})[_0xfca2('0x28')](function(_0x4e644b){if(_0x4e644b['sid']){return _0x4dee3a[_0xfca2('0x1a')]({'messageId':_0x4e644b[_0xfca2('0x29')]});}})[_0xfca2('0x1c')](function(_0x4952f1){logger[_0xfca2('0x1d')](_0xfca2('0x2a'),_0xfca2('0x2b'),'twilio',util['inspect'](_0x4952f1,{'showHidden':![],'depth':null}));});}else{logger[_0xfca2('0x1d')](_0xfca2('0x2a'),'afterCreate',_0xfca2('0x1f'),_0xfca2('0x2c'));}break;case'sinch':var _0x106bc8=_0x31f0f3[_0xfca2('0x20')];var _0x31b841=_0x31f0f3[_0xfca2('0x21')];var _0x16fb58=_0x31f0f3[_0xfca2('0x2d')]+_0xfca2('0x2e')+_0x106bc8+'/messages/';var _0x2483ed={'to':[_0x138e21[_0xfca2('0x22')]],'message':{'type':'text','text':_0x138e21[_0xfca2('0xd')]}};var _0x1583fa={'method':'POST','uri':_0x16fb58,'headers':{'Authorization':_0xfca2('0x2f')+_0x31b841,'Content-Type':_0xfca2('0x30')},'body':_0x2483ed,'json':!![]};rp(_0x1583fa)[_0xfca2('0x28')](function(_0x43ffa0){if(_0x43ffa0[_0xfca2('0x31')][0x0][_0xfca2('0x32')]){return _0x4dee3a[_0xfca2('0x1a')]({'messageId':_0x43ffa0[_0xfca2('0x31')][0x0][_0xfca2('0x32')]});}})[_0xfca2('0x1c')](function(_0x41a8cf){logger['err']('WhatsappMessage,\x20%s',_0x41a8cf);});break;}}})[_0xfca2('0x33')](function(){_0x38b04d();});}else{_0x38b04d();}}},'charset':_0xfca2('0x34'),'collate':_0xfca2('0x35')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index 119f941..648e41c 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 _0x6833=['randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client','http','redis','localhost','./whatsappMessage.socket','register','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateWhatsappMessage','WhatsappMessage','options','raw','lodash','util','moment','bluebird'];(function(_0xa2c0a3,_0x5bbac0){var _0x52c618=function(_0x20f7fd){while(--_0x20f7fd){_0xa2c0a3['push'](_0xa2c0a3['shift']());}};_0x52c618(++_0x5bbac0);}(_0x6833,0x13c));var _0x3683=function(_0x5e0710,_0x554f39){_0x5e0710=_0x5e0710-0x0;var _0x3dbb1c=_0x6833[_0x5e0710];return _0x3dbb1c;};'use strict';var _=require(_0x3683('0x0'));var util=require(_0x3683('0x1'));var moment=require(_0x3683('0x2'));var BPromise=require(_0x3683('0x3'));var rs=require(_0x3683('0x4'));var fs=require('fs');var Redis=require(_0x3683('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x3683('0x6'));var logger=require(_0x3683('0x7'))('rpc');var config=require(_0x3683('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x3683('0x9')][_0x3683('0xa')]({'port':0x232a});config[_0x3683('0xb')]=_['defaults'](config[_0x3683('0xb')],{'host':_0x3683('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x3683('0xd'))[_0x3683('0xe')](socket);function respondWithRpcPromise(_0x5b8c26,_0x5c2f81,_0x552ee5){return new BPromise(function(_0x1a7980,_0x5aea4f){return client[_0x3683('0xf')](_0x5b8c26,_0x552ee5)[_0x3683('0x10')](function(_0x5b9139){logger[_0x3683('0x11')](_0x3683('0x12'),_0x5c2f81,_0x3683('0x13'));logger[_0x3683('0x14')](_0x3683('0x15'),_0x5c2f81,_0x3683('0x13'),JSON[_0x3683('0x16')](_0x5b9139));if(_0x5b9139[_0x3683('0x17')]){if(_0x5b9139['error'][_0x3683('0x18')]===0x1f4){logger['error'](_0x3683('0x12'),_0x5c2f81,_0x5b9139['error']['message']);return _0x5aea4f(_0x5b9139[_0x3683('0x17')][_0x3683('0x19')]);}logger[_0x3683('0x17')](_0x3683('0x12'),_0x5c2f81,_0x5b9139['error'][_0x3683('0x19')]);return _0x1a7980(_0x5b9139[_0x3683('0x17')][_0x3683('0x19')]);}else{logger['info']('WhatsappMessage,\x20%s,\x20%s',_0x5c2f81,_0x3683('0x13'));_0x1a7980(_0x5b9139[_0x3683('0x1a')][_0x3683('0x19')]);}})[_0x3683('0x1b')](function(_0x3d50e6){logger['error'](_0x3683('0x12'),_0x5c2f81,_0x3d50e6);_0x5aea4f(_0x3d50e6);});});}exports[_0x3683('0x1c')]=function(_0x29076a){var _0x1ec4cb=this;return new Promise(function(_0x5922c9,_0x9c0b2b){return db[_0x3683('0x1d')]['create'](_0x29076a['body'],{'raw':_0x29076a[_0x3683('0x1e')]?_0x29076a[_0x3683('0x1e')][_0x3683('0x1f')]===undefined?!![]:![]:!![]})[_0x3683('0x10')](function(_0x18d6de){logger[_0x3683('0x11')](_0x3683('0x1c'),_0x29076a);logger['debug']('CreateWhatsappMessage',_0x29076a,JSON[_0x3683('0x16')](_0x18d6de));_0x5922c9(_0x18d6de);})[_0x3683('0x1b')](function(_0x5db061){logger[_0x3683('0x17')](_0x3683('0x1c'),_0x5db061[_0x3683('0x19')],_0x29076a);_0x9c0b2b(_0x1ec4cb[_0x3683('0x17')](0x1f4,_0x5db061[_0x3683('0x19')]));});});}; \ No newline at end of file +var _0x636c=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','http','redis','defaults','./whatsappMessage.socket','register','request','then','info','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','error','code','WhatsappMessage,\x20%s,\x20%s','message','result','catch','CreateWhatsappMessage','create','body','options','raw','stringify','lodash'];(function(_0x27c59f,_0x31a1a9){var _0x448e6d=function(_0x176413){while(--_0x176413){_0x27c59f['push'](_0x27c59f['shift']());}};_0x448e6d(++_0x31a1a9);}(_0x636c,0xdf));var _0xc636=function(_0x708066,_0x195fd5){_0x708066=_0x708066-0x0;var _0x12e788=_0x636c[_0x708066];return _0x12e788;};'use strict';var _=require(_0xc636('0x0'));var util=require(_0xc636('0x1'));var moment=require('moment');var BPromise=require(_0xc636('0x2'));var rs=require(_0xc636('0x3'));var fs=require('fs');var Redis=require(_0xc636('0x4'));var db=require(_0xc636('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc636('0x6'))('rpc');var config=require(_0xc636('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xc636('0x8')][_0xc636('0x9')]({'port':0x232a});config[_0xc636('0xa')]=_[_0xc636('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc636('0xa')]));require(_0xc636('0xc'))[_0xc636('0xd')](socket);function respondWithRpcPromise(_0x434e25,_0x5195df,_0x2a56d8){return new BPromise(function(_0x40544d,_0x20a106){return client[_0xc636('0xe')](_0x434e25,_0x2a56d8)[_0xc636('0xf')](function(_0x3476ee){logger[_0xc636('0x10')]('WhatsappMessage,\x20%s,\x20%s',_0x5195df,_0xc636('0x11'));logger[_0xc636('0x12')](_0xc636('0x13'),_0x5195df,_0xc636('0x11'),JSON['stringify'](_0x3476ee));if(_0x3476ee[_0xc636('0x14')]){if(_0x3476ee[_0xc636('0x14')][_0xc636('0x15')]===0x1f4){logger[_0xc636('0x14')](_0xc636('0x16'),_0x5195df,_0x3476ee[_0xc636('0x14')][_0xc636('0x17')]);return _0x20a106(_0x3476ee[_0xc636('0x14')][_0xc636('0x17')]);}logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x5195df,_0x3476ee[_0xc636('0x14')][_0xc636('0x17')]);return _0x40544d(_0x3476ee['error']['message']);}else{logger[_0xc636('0x10')](_0xc636('0x16'),_0x5195df,_0xc636('0x11'));_0x40544d(_0x3476ee[_0xc636('0x18')][_0xc636('0x17')]);}})[_0xc636('0x19')](function(_0x2ea04c){logger[_0xc636('0x14')](_0xc636('0x16'),_0x5195df,_0x2ea04c);_0x20a106(_0x2ea04c);});});}exports[_0xc636('0x1a')]=function(_0xf47f76){var _0x133ad9=this;return new Promise(function(_0x83df8b,_0x221a77){return db['WhatsappMessage'][_0xc636('0x1b')](_0xf47f76[_0xc636('0x1c')],{'raw':_0xf47f76[_0xc636('0x1d')]?_0xf47f76['options'][_0xc636('0x1e')]===undefined?!![]:![]:!![]})[_0xc636('0xf')](function(_0x41ff52){logger[_0xc636('0x10')](_0xc636('0x1a'),_0xf47f76);logger[_0xc636('0x12')](_0xc636('0x1a'),_0xf47f76,JSON[_0xc636('0x1f')](_0x41ff52));_0x83df8b(_0x41ff52);})['catch'](function(_0x18da33){logger[_0xc636('0x14')]('CreateWhatsappMessage',_0x18da33[_0xc636('0x17')],_0xf47f76);_0x221a77(_0x133ad9['error'](0x1f4,_0x18da33['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 5e27ced..2a3b1d7 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 _0x96f9=['whatsappMessage:','./whatsappMessage.events','remove','update','removeListener','register','length'];(function(_0x22e2f8,_0x18b284){var _0x2fbb76=function(_0x396c4a){while(--_0x396c4a){_0x22e2f8['push'](_0x22e2f8['shift']());}};_0x2fbb76(++_0x18b284);}(_0x96f9,0x120));var _0x996f=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x96f9[_0x4565bf];return _0x5610ba;};'use strict';var WhatsappMessageEvents=require(_0x996f('0x0'));var events=['save',_0x996f('0x1'),_0x996f('0x2')];function createListener(_0xe8e7f6,_0x4bc981){return function(_0x4d9315){_0x4bc981['emit'](_0xe8e7f6,_0x4d9315);};}function removeListener(_0x1fbd89,_0x225097){return function(){WhatsappMessageEvents[_0x996f('0x3')](_0x1fbd89,_0x225097);};}exports[_0x996f('0x4')]=function(_0xe3a626){for(var _0x1ad511=0x0,_0x4babb2=events[_0x996f('0x5')];_0x1ad511<_0x4babb2;_0x1ad511++){var _0x3728b6=events[_0x1ad511];var _0x3b1131=createListener(_0x996f('0x6')+_0x3728b6,_0xe3a626);WhatsappMessageEvents['on'](_0x3728b6,_0x3b1131);}}; \ No newline at end of file +var _0x6221=['remove','emit','register','./whatsappMessage.events','save'];(function(_0x11460e,_0x4e8040){var _0x1cd3a3=function(_0x2051f0){while(--_0x2051f0){_0x11460e['push'](_0x11460e['shift']());}};_0x1cd3a3(++_0x4e8040);}(_0x6221,0xc6));var _0x1622=function(_0x311909,_0x414bf7){_0x311909=_0x311909-0x0;var _0x8d3163=_0x6221[_0x311909];return _0x8d3163;};'use strict';var WhatsappMessageEvents=require(_0x1622('0x0'));var events=[_0x1622('0x1'),_0x1622('0x2'),'update'];function createListener(_0x1c4a0b,_0x2214bf){return function(_0x2fcc6a){_0x2214bf[_0x1622('0x3')](_0x1c4a0b,_0x2fcc6a);};}function removeListener(_0x3c82ed,_0x37d6ac){return function(){WhatsappMessageEvents['removeListener'](_0x3c82ed,_0x37d6ac);};}exports[_0x1622('0x4')]=function(_0x56fdb5){for(var _0x2c6b3e=0x0,_0x57c36b=events['length'];_0x2c6b3e<_0x57c36b;_0x2c6b3e++){var _0x17044e=events[_0x2c6b3e];var _0x2d8c71=createListener('whatsappMessage:'+_0x17044e,_0x56fdb5);WhatsappMessageEvents['on'](_0x17044e,_0x2d8c71);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index 7fc5d79..1d6e8e7 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 _0x2fd0=['/describe','describe','/:id','show','getMembers','/:id/users','create','post','/:id/teams','addAgents','put','delete','destroy','removeTeams','exports','util','connect-timeout','express','Router','fs-extra','../../config/environment','./whatsappQueue.controller','isAuthenticated','index','get'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x2fd0,0x13b));var _0x02fd=function(_0x3e1415,_0x2ad5ee){_0x3e1415=_0x3e1415-0x0;var _0x2e1ec7=_0x2fd0[_0x3e1415];return _0x2e1ec7;};'use strict';var multer=require('multer');var util=require(_0x02fd('0x0'));var path=require('path');var timeout=require(_0x02fd('0x1'));var express=require(_0x02fd('0x2'));var router=express[_0x02fd('0x3')]();var fs_extra=require(_0x02fd('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x02fd('0x5'));var controller=require(_0x02fd('0x6'));router['get']('/',auth[_0x02fd('0x7')](),controller[_0x02fd('0x8')]);router[_0x02fd('0x9')](_0x02fd('0xa'),auth[_0x02fd('0x7')](),controller[_0x02fd('0xb')]);router[_0x02fd('0x9')](_0x02fd('0xc'),auth[_0x02fd('0x7')](),controller[_0x02fd('0xd')]);router['get']('/:id/members',auth[_0x02fd('0x7')](),controller[_0x02fd('0xe')]);router['get']('/:id/teams',auth['isAuthenticated'](),controller['getTeams']);router[_0x02fd('0x9')](_0x02fd('0xf'),auth[_0x02fd('0x7')](),controller['getAgents']);router['post']('/',auth[_0x02fd('0x7')](),controller[_0x02fd('0x10')]);router[_0x02fd('0x11')](_0x02fd('0x12'),auth['isAuthenticated'](),controller['addTeams']);router['post']('/:id/users',auth[_0x02fd('0x7')](),controller[_0x02fd('0x13')]);router[_0x02fd('0x14')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x02fd('0x15')]('/:id',auth[_0x02fd('0x7')](),controller[_0x02fd('0x16')]);router[_0x02fd('0x15')]('/:id/teams',auth[_0x02fd('0x7')](),controller[_0x02fd('0x17')]);router[_0x02fd('0x15')](_0x02fd('0xf'),auth['isAuthenticated'](),controller['removeAgents']);module[_0x02fd('0x18')]=router; \ No newline at end of file +var _0x9001=['show','getMembers','getTeams','/:id/users','getAgents','post','create','/:id/teams','addTeams','addAgents','put','update','delete','destroy','removeTeams','exports','connect-timeout','express','Router','../../config/environment','./whatsappQueue.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x206338,_0x2d800b){var _0x2b87f2=function(_0x436c1c){while(--_0x436c1c){_0x206338['push'](_0x206338['shift']());}};_0x2b87f2(++_0x2d800b);}(_0x9001,0x154));var _0x1900=function(_0x32d11c,_0x4447c8){_0x32d11c=_0x32d11c-0x0;var _0x5f423d=_0x9001[_0x32d11c];return _0x5f423d;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x1900('0x0'));var express=require(_0x1900('0x1'));var router=express[_0x1900('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x1900('0x3'));var controller=require(_0x1900('0x4'));router[_0x1900('0x5')]('/',auth[_0x1900('0x6')](),controller[_0x1900('0x7')]);router[_0x1900('0x5')](_0x1900('0x8'),auth[_0x1900('0x6')](),controller[_0x1900('0x9')]);router[_0x1900('0x5')](_0x1900('0xa'),auth[_0x1900('0x6')](),controller[_0x1900('0xb')]);router['get']('/:id/members',auth['isAuthenticated'](),controller[_0x1900('0xc')]);router[_0x1900('0x5')]('/:id/teams',auth[_0x1900('0x6')](),controller[_0x1900('0xd')]);router['get'](_0x1900('0xe'),auth[_0x1900('0x6')](),controller[_0x1900('0xf')]);router[_0x1900('0x10')]('/',auth['isAuthenticated'](),controller[_0x1900('0x11')]);router[_0x1900('0x10')](_0x1900('0x12'),auth[_0x1900('0x6')](),controller[_0x1900('0x13')]);router[_0x1900('0x10')](_0x1900('0xe'),auth[_0x1900('0x6')](),controller[_0x1900('0x14')]);router[_0x1900('0x15')]('/:id',auth[_0x1900('0x6')](),controller[_0x1900('0x16')]);router[_0x1900('0x17')]('/:id',auth[_0x1900('0x6')](),controller[_0x1900('0x18')]);router[_0x1900('0x17')](_0x1900('0x12'),auth[_0x1900('0x6')](),controller[_0x1900('0x19')]);router['delete'](_0x1900('0xe'),auth['isAuthenticated'](),controller['removeAgents']);module[_0x1900('0x1a')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index 212b302..20b63de 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 _0xc831=['rrmemory','beepall','roundrobin','exports','STRING','name','INTEGER','ENUM'];(function(_0x1e3bd3,_0x380bf2){var _0x110df1=function(_0x3bac27){while(--_0x3bac27){_0x1e3bd3['push'](_0x1e3bd3['shift']());}};_0x110df1(++_0x380bf2);}(_0xc831,0x103));var _0x1c83=function(_0x449679,_0x5080f9){_0x449679=_0x449679-0x0;var _0x2b48b7=_0xc831[_0x449679];return _0x2b48b7;};'use strict';var Sequelize=require('sequelize');module[_0x1c83('0x0')]={'name':{'type':Sequelize[_0x1c83('0x1')],'unique':_0x1c83('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x1c83('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x1c83('0x4')](_0x1c83('0x5'),_0x1c83('0x6'),_0x1c83('0x7'))},'description':{'type':Sequelize[_0x1c83('0x1')]}}; \ No newline at end of file +var _0xaefc=['ENUM','roundrobin','sequelize','exports','STRING','INTEGER'];(function(_0x15233e,_0x23eda8){var _0x2449fb=function(_0x319a91){while(--_0x319a91){_0x15233e['push'](_0x15233e['shift']());}};_0x2449fb(++_0x23eda8);}(_0xaefc,0xc8));var _0xcaef=function(_0x2d7116,_0x37bee1){_0x2d7116=_0x2d7116-0x0;var _0x522d5a=_0xaefc[_0x2d7116];return _0x522d5a;};'use strict';var Sequelize=require(_0xcaef('0x0'));module[_0xcaef('0x1')]={'name':{'type':Sequelize[_0xcaef('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0xcaef('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xcaef('0x4')]('rrmemory','beepall',_0xcaef('0x5'))},'description':{'type':Sequelize[_0xcaef('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index 47a792c..30e89a7 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 _0x368c=['all','value','isEmpty','removeAgents','userWhatsappQueue:remove','addAgents','spread','isArray','getAgents','bluebird','util','lodash','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','then','get','UserProfileResource','destroy','end','error','stack','name','send','index','map','WhatsappQueue','fieldName','type','key','getOptions','include','findAll','rows','catch','show','params','model','keys','rawAttributes','query','filters','intersection','fields','attributes','includeAll','merge','find','create','body','role','WhatsappQueues','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','getMembers','findOne','UserWhatsappQueue','length','hasOwnProperty','nolimit','order','sort','where','pick','WhatsappQueueId','filter','options','findAndCountAll','UserId','agent','whatsappPause','updatedAt','createdAt','format','%s/%s','getTeams','Team','addTeams','ids','online','voicePause','interface','flatMap','transaction','each','findOrCreate','forEach','emit','userWhatsappQueue:save','removeTeams','User','Agents','tq.TeamId','team_has_whatsapp_queues','join','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','sequelize','toString','QueryTypes','SELECT','every','TeamId','includes'];(function(_0x5f1cf8,_0x5e0923){var _0x27d0fa=function(_0x3f1171){while(--_0x3f1171){_0x5f1cf8['push'](_0x5f1cf8['shift']());}};_0x27d0fa(++_0x5e0923);}(_0x368c,0x105));var _0xc368=function(_0x45044d,_0x3c82e5){_0x45044d=_0x45044d-0x0;var _0x23833a=_0x368c[_0x45044d];return _0x23833a;};'use strict';var BPromise=require(_0xc368('0x0'));var util=require(_0xc368('0x1'));var _=require(_0xc368('0x2'));var squel=require('squel');var Redis=require('ioredis');var qs=require(_0xc368('0x3'));var logger=require(_0xc368('0x4'))(_0xc368('0x5'));var config=require('../../config/environment');var db=require(_0xc368('0x6'))['db'];config[_0xc368('0x7')]=_[_0xc368('0x8')](config['redis'],{'host':_0xc368('0x9'),'port':0x18eb});var socket=require(_0xc368('0xa'))(new Redis(config[_0xc368('0x7')]));require(_0xc368('0xb'))[_0xc368('0xc')](socket);function respondWithStatusCode(_0x46ea75,_0x455d5f){_0x455d5f=_0x455d5f||0xcc;return function(_0x15fea9){if(_0x15fea9){return _0x46ea75[_0xc368('0xd')](_0x455d5f);}return _0x46ea75[_0xc368('0xe')](_0x455d5f)['end']();};}function respondWithResult(_0x8ba142,_0x35c692){_0x35c692=_0x35c692||0xc8;return function(_0x29bdc1){if(_0x29bdc1){return _0x8ba142[_0xc368('0xe')](_0x35c692)[_0xc368('0xf')](_0x29bdc1);}};}function respondWithFilteredResult(_0x55a1f6,_0x3a9305){return function(_0x367c95){if(_0x367c95){var _0x2c4f2b=typeof _0x3a9305[_0xc368('0x10')]===_0xc368('0x11')&&typeof _0x3a9305['limit']===_0xc368('0x11');var _0x3ab202=_0x367c95[_0xc368('0x12')];var _0x5bd84b=_0x2c4f2b?0x0:_0x3a9305[_0xc368('0x10')];var _0x224e41=_0x2c4f2b?_0x367c95['count']:_0x3a9305[_0xc368('0x10')]+_0x3a9305[_0xc368('0x13')];var _0x5e66ac;if(_0x224e41>=_0x3ab202){_0x224e41=_0x3ab202;_0x5e66ac=0xc8;}else{_0x5e66ac=0xce;}_0x55a1f6[_0xc368('0xe')](_0x5e66ac);return _0x55a1f6[_0xc368('0x14')](_0xc368('0x15'),_0x5bd84b+'-'+_0x224e41+'/'+_0x3ab202)[_0xc368('0xf')](_0x367c95);}return null;};}function saveUpdates(_0x38fce8){return function(_0x5080c6){if(_0x5080c6){return _0x5080c6['update'](_0x38fce8)[_0xc368('0x16')](function(_0x1882ed){return _0x1882ed;});}return null;};}function removeEntity(_0x12fc5b){return function(_0x5e2665){if(_0x5e2665){return _0x5e2665['destroy']()[_0xc368('0x16')](function(){var _0x1ef20e=_0x5e2665[_0xc368('0x17')]({'plain':!![]});var _0x59b286='WhatsappQueues';return db[_0xc368('0x18')][_0xc368('0x19')]({'where':{'type':_0x59b286,'resourceId':_0x1ef20e['id']}})[_0xc368('0x16')](function(){return _0x5e2665;});})[_0xc368('0x16')](function(){_0x12fc5b[_0xc368('0xe')](0xcc)[_0xc368('0x1a')]();});}};}function handleEntityNotFound(_0xe6b272){return function(_0x33b686){if(!_0x33b686){_0xe6b272['sendStatus'](0x194);}return _0x33b686;};}function handleError(_0x507f12,_0x40634f){_0x40634f=_0x40634f||0x1f4;return function(_0x1b398c){logger[_0xc368('0x1b')](_0x1b398c[_0xc368('0x1c')]);if(_0x1b398c['name']){delete _0x1b398c[_0xc368('0x1d')];}_0x507f12[_0xc368('0xe')](_0x40634f)[_0xc368('0x1e')](_0x1b398c);};}exports[_0xc368('0x1f')]=function(_0xce9a2,_0x30389b){var _0x4b3581={};var _0x27ec75={'count':0x0,'rows':[]};var _0x4a86aa=_[_0xc368('0x20')](db[_0xc368('0x21')]['rawAttributes'],function(_0x3968c4){return{'name':_0x3968c4[_0xc368('0x22')],'type':_0x3968c4[_0xc368('0x23')][_0xc368('0x24')]};});_0x4b3581=qs[_0xc368('0x25')](_0x4a86aa,_0xce9a2);var _0x3e3deb={'where':_0x4b3581['where']};return db[_0xc368('0x21')][_0xc368('0x12')](_0x3e3deb)['then'](function(_0x3dd01a){_0x27ec75['count']=_0x3dd01a;_0x4b3581[_0xc368('0x26')]=qs['include'](_0xce9a2['query']);return db['WhatsappQueue'][_0xc368('0x27')](_0x4b3581);})[_0xc368('0x16')](function(_0x1184a9){_0x27ec75[_0xc368('0x28')]=_0x1184a9;return _0x27ec75;})['then'](respondWithFilteredResult(_0x30389b,_0x4b3581))[_0xc368('0x29')](handleError(_0x30389b,null));};exports[_0xc368('0x2a')]=function(_0x272eb5,_0x5620a2){var _0x2fe7ad={'raw':!![],'where':{'id':_0x272eb5[_0xc368('0x2b')]['id']}},_0x258f11={};_0x258f11[_0xc368('0x2c')]=_[_0xc368('0x2d')](db[_0xc368('0x21')][_0xc368('0x2e')]);_0x258f11['query']=_['keys'](_0x272eb5[_0xc368('0x2f')]);_0x258f11[_0xc368('0x30')]=_[_0xc368('0x31')](_0x258f11[_0xc368('0x2c')],_0x258f11[_0xc368('0x2f')]);_0x2fe7ad['attributes']=_[_0xc368('0x31')](_0x258f11[_0xc368('0x2c')],qs[_0xc368('0x32')](_0x272eb5[_0xc368('0x2f')][_0xc368('0x32')]));_0x2fe7ad[_0xc368('0x33')]=_0x2fe7ad['attributes']['length']?_0x2fe7ad[_0xc368('0x33')]:_0x258f11['model'];if(_0x272eb5[_0xc368('0x2f')][_0xc368('0x34')]){_0x2fe7ad['include']=[{'all':!![]}];}_0x2fe7ad=_[_0xc368('0x35')]({},_0x2fe7ad,_0x272eb5['options']);return db[_0xc368('0x21')][_0xc368('0x36')](_0x2fe7ad)[_0xc368('0x16')](handleEntityNotFound(_0x5620a2,null))[_0xc368('0x16')](respondWithResult(_0x5620a2,null))[_0xc368('0x29')](handleError(_0x5620a2,null));};exports[_0xc368('0x37')]=function(_0x332b97,_0x5e99ba){return db[_0xc368('0x21')][_0xc368('0x37')](_0x332b97[_0xc368('0x38')],{})[_0xc368('0x16')](function(_0x2badb8){var _0x22e6f2=_0x332b97['user'][_0xc368('0x17')]({'plain':!![]});if(!_0x22e6f2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x22e6f2[_0xc368('0x39')]==='user'){var _0x3bd007=_0x2badb8[_0xc368('0x17')]({'plain':!![]});var _0x7197da=_0xc368('0x3a');return db[_0xc368('0x3b')][_0xc368('0x36')]({'where':{'name':_0x7197da,'userProfileId':_0x22e6f2[_0xc368('0x3c')]},'raw':!![]})[_0xc368('0x16')](function(_0x30143c){if(_0x30143c&&_0x30143c[_0xc368('0x3d')]===0x0){return db[_0xc368('0x18')][_0xc368('0x37')]({'name':_0x3bd007[_0xc368('0x1d')],'resourceId':_0x3bd007['id'],'type':_0x30143c[_0xc368('0x1d')],'sectionId':_0x30143c['id']},{})[_0xc368('0x16')](function(){return _0x2badb8;});}else{return _0x2badb8;}})[_0xc368('0x29')](function(_0x4563aa){logger[_0xc368('0x1b')](_0xc368('0x3e'),_0x4563aa);throw _0x4563aa;});}return _0x2badb8;})['then'](respondWithResult(_0x5e99ba,0xc9))[_0xc368('0x29')](handleError(_0x5e99ba,null));};exports[_0xc368('0x3f')]=function(_0x6f660b,_0x35ce0b){if(_0x6f660b[_0xc368('0x38')]['id']){delete _0x6f660b[_0xc368('0x38')]['id'];}return db[_0xc368('0x21')][_0xc368('0x36')]({'where':{'id':_0x6f660b['params']['id']}})[_0xc368('0x16')](handleEntityNotFound(_0x35ce0b,null))[_0xc368('0x16')](saveUpdates(_0x6f660b[_0xc368('0x38')],null))['then'](respondWithResult(_0x35ce0b,null))[_0xc368('0x29')](handleError(_0x35ce0b,null));};exports['destroy']=function(_0x55e5b6,_0xb4e382){return db[_0xc368('0x21')][_0xc368('0x36')]({'where':{'id':_0x55e5b6['params']['id']}})[_0xc368('0x16')](handleEntityNotFound(_0xb4e382,null))[_0xc368('0x16')](removeEntity(_0xb4e382,null))['catch'](handleError(_0xb4e382,null));};exports[_0xc368('0x40')]=function(_0x5917f4,_0x1af038){return db[_0xc368('0x21')][_0xc368('0x40')]()[_0xc368('0x16')](respondWithResult(_0x1af038,null))[_0xc368('0x29')](handleError(_0x1af038,null));};exports[_0xc368('0x41')]=function(_0x19b689,_0x382a49){var _0x25bef4={'raw':!![],'where':{}},_0x5bc7fb={},_0x184409;return db['WhatsappQueue'][_0xc368('0x42')]({'where':{'id':_0x19b689[_0xc368('0x2b')]['id']}})[_0xc368('0x16')](handleEntityNotFound(_0x382a49,null))['then'](function(_0x41a512){if(_0x41a512){_0x184409=_0x41a512['get']({'plain':!![]});_0x5bc7fb[_0xc368('0x2c')]=_[_0xc368('0x2d')](db[_0xc368('0x43')][_0xc368('0x2e')]);_0x5bc7fb[_0xc368('0x2f')]=_[_0xc368('0x2d')](_0x19b689[_0xc368('0x2f')]);_0x5bc7fb[_0xc368('0x30')]=_[_0xc368('0x31')](_0x5bc7fb['model'],_0x5bc7fb[_0xc368('0x2f')]);_0x25bef4[_0xc368('0x33')]=_[_0xc368('0x31')](_0x5bc7fb[_0xc368('0x2c')],qs[_0xc368('0x32')](_0x19b689[_0xc368('0x2f')]['fields']));_0x25bef4['attributes']=_0x25bef4[_0xc368('0x33')][_0xc368('0x44')]?_0x25bef4[_0xc368('0x33')]:_0x5bc7fb[_0xc368('0x2c')];if(!_0x19b689[_0xc368('0x2f')][_0xc368('0x45')](_0xc368('0x46'))){_0x25bef4[_0xc368('0x13')]=qs[_0xc368('0x13')](_0x19b689['query'][_0xc368('0x13')]);_0x25bef4[_0xc368('0x10')]=qs[_0xc368('0x10')](_0x19b689[_0xc368('0x2f')][_0xc368('0x10')]);}_0x25bef4[_0xc368('0x47')]=qs[_0xc368('0x48')](_0x19b689[_0xc368('0x2f')][_0xc368('0x48')]);_0x25bef4[_0xc368('0x49')]=qs['filters'](_[_0xc368('0x4a')](_0x19b689[_0xc368('0x2f')],_0x5bc7fb['filters']));_0x25bef4[_0xc368('0x49')][_0xc368('0x4b')]=_0x41a512['id'];if(_0x19b689[_0xc368('0x2f')][_0xc368('0x4c')]){_0x25bef4[_0xc368('0x49')]=_['merge'](_0x25bef4['where'],{'$or':_['map'](_0x25bef4[_0xc368('0x33')],function(_0x4b7742){var _0x385be2={};_0x385be2[_0x4b7742]={'$like':'%'+_0x19b689['query']['filter']+'%'};return _0x385be2;})});}_0x25bef4=_['merge']({},_0x25bef4,_0x19b689[_0xc368('0x4d')]);return db[_0xc368('0x43')]['findAll'](_0x25bef4);}})[_0xc368('0x16')](function(_0x1af076){if(_0x1af076){return db['User'][_0xc368('0x4e')]({'where':{'id':_['map'](_0x1af076,_0xc368('0x4f')),'role':_0xc368('0x50')},'attributes':['id',_0xc368('0x1d'),_0xc368('0x51'),_0xc368('0x52'),_0xc368('0x53')]});}})[_0xc368('0x16')](function(_0x5e2e6a){if(_0x5e2e6a){return{'count':_0x5e2e6a[_0xc368('0x12')],'rows':_[_0xc368('0x20')](_0x5e2e6a['rows'],function(_0x68ae50){return{'membername':_0x68ae50[_0xc368('0x1d')],'UserId':_0x68ae50['id'],'queue_name':_0x184409['name'],'WhatsappQueueId':_0x184409['id'],'interface':util[_0xc368('0x54')](_0xc368('0x55'),'SIP',_0x68ae50[_0xc368('0x1d')]),'penalty':0x0,'paused':_0x68ae50['whatsappPause'],'createdAt':_0x68ae50['createdAt'],'updatedAt':_0x68ae50['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x382a49,_0x25bef4))[_0xc368('0x29')](handleError(_0x382a49,null));};exports[_0xc368('0x56')]=function(_0x2dbfb9,_0x1f57ca){var _0x269496={};var _0x3907b3={};var _0x4e6ce1;var _0x35791d;return db[_0xc368('0x21')][_0xc368('0x42')]({'where':{'id':_0x2dbfb9['params']['id']}})[_0xc368('0x16')](handleEntityNotFound(_0x1f57ca,null))[_0xc368('0x16')](function(_0x4daaaa){if(_0x4daaaa){_0x4e6ce1=_0x4daaaa;_0x3907b3[_0xc368('0x2c')]=_['keys'](db[_0xc368('0x57')][_0xc368('0x2e')]);_0x3907b3['query']=_[_0xc368('0x2d')](_0x2dbfb9['query']);_0x3907b3[_0xc368('0x30')]=_[_0xc368('0x31')](_0x3907b3[_0xc368('0x2c')],_0x3907b3[_0xc368('0x2f')]);_0x269496[_0xc368('0x33')]=_[_0xc368('0x31')](_0x3907b3['model'],qs['fields'](_0x2dbfb9[_0xc368('0x2f')][_0xc368('0x32')]));_0x269496[_0xc368('0x33')]=_0x269496[_0xc368('0x33')][_0xc368('0x44')]?_0x269496[_0xc368('0x33')]:_0x3907b3['model'];_0x269496[_0xc368('0x47')]=qs[_0xc368('0x48')](_0x2dbfb9[_0xc368('0x2f')][_0xc368('0x48')]);_0x269496['where']=qs[_0xc368('0x30')](_[_0xc368('0x4a')](_0x2dbfb9['query'],_0x3907b3[_0xc368('0x30')]));if(_0x2dbfb9[_0xc368('0x2f')][_0xc368('0x4c')]){_0x269496[_0xc368('0x49')]=_[_0xc368('0x35')](_0x269496[_0xc368('0x49')],{'$or':_[_0xc368('0x20')](_0x269496['attributes'],function(_0x51e6ac){var _0x185dbb={};_0x185dbb[_0x51e6ac]={'$like':'%'+_0x2dbfb9[_0xc368('0x2f')][_0xc368('0x4c')]+'%'};return _0x185dbb;})});}_0x269496=_[_0xc368('0x35')]({},_0x269496,_0x2dbfb9[_0xc368('0x4d')]);return _0x4e6ce1[_0xc368('0x56')](_0x269496);}})[_0xc368('0x16')](function(_0x3c4e9a){if(_0x3c4e9a){_0x35791d=_0x3c4e9a[_0xc368('0x44')];if(!_0x2dbfb9['query'][_0xc368('0x45')](_0xc368('0x46'))){_0x269496[_0xc368('0x13')]=qs[_0xc368('0x13')](_0x2dbfb9[_0xc368('0x2f')]['limit']);_0x269496['offset']=qs['offset'](_0x2dbfb9[_0xc368('0x2f')][_0xc368('0x10')]);}return _0x4e6ce1[_0xc368('0x56')](_0x269496);}})[_0xc368('0x16')](function(_0x466b7e){if(_0x466b7e){return _0x466b7e?{'count':_0x35791d,'rows':_0x466b7e}:null;}})['then'](respondWithResult(_0x1f57ca,null))[_0xc368('0x29')](handleError(_0x1f57ca,null));};exports[_0xc368('0x58')]=function(_0x90c192,_0xbb0d6d){var _0xa1aff0=_0x90c192[_0xc368('0x38')][_0xc368('0x59')];return db['Team'][_0xc368('0x27')]({'where':{'id':_0xa1aff0},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0xc368('0x1d'),_0xc368('0x5a'),_0xc368('0x5b'),_0xc368('0x5c')],'raw':!![]}]})['then'](function(_0x53deff){if(_0x53deff){var _0x5c997e=_[_0xc368('0x5d')](_0x53deff,function(_0x4c5ac4){var _0x575b4b=_0x4c5ac4[_0xc368('0x17')]({'plain':!![]});return _0x575b4b['Agents'];});return db[_0xc368('0x21')][_0xc368('0x36')]({'where':{'id':_0x90c192[_0xc368('0x2b')]['id']}})['then'](function(_0x2ec6e7){return db['sequelize'][_0xc368('0x5e')](function(_0x448c02){return _0x2ec6e7[_0xc368('0x58')](_0xa1aff0,{'transaction':_0x448c02})[_0xc368('0x16')](function(){return BPromise[_0xc368('0x5f')](_0x5c997e,function(_0x261d37){return db[_0xc368('0x43')][_0xc368('0x60')]({'where':{'UserId':_0x261d37['id'],'WhatsappQueueId':_0x90c192[_0xc368('0x2b')]['id']},'transaction':_0x448c02});});})[_0xc368('0x16')](function(){_0x5c997e[_0xc368('0x61')](function(_0x280add){socket[_0xc368('0x62')](_0xc368('0x63'),{'UserId':_0x280add['id'],'WhatsappQueueId':_0x2ec6e7['id']});});});});});}})[_0xc368('0x16')](respondWithStatusCode(_0xbb0d6d,null))[_0xc368('0x29')](handleError(_0xbb0d6d,null));};exports[_0xc368('0x64')]=function(_0x50cca4,_0x3ca749){return db[_0xc368('0x57')]['findAll']({'where':{'id':_0x50cca4[_0xc368('0x2f')][_0xc368('0x59')]},'attributes':['id'],'include':[{'model':db[_0xc368('0x65')],'as':_0xc368('0x66'),'attributes':['id'],'raw':!![]}]})[_0xc368('0x16')](handleEntityNotFound(_0x3ca749,null))[_0xc368('0x16')](function(_0x223fe5){var _0x135963=_[_0xc368('0x20')](_0x223fe5,'id');var _0x3ed3db=[];var _0x41585d=[];var _0x200b81=squel['select']();_0x200b81['field'](_0xc368('0x67'))['from'](_0xc368('0x68'),'tq')[_0xc368('0x69')]('user_has_teams','ut',_0xc368('0x6a'))[_0xc368('0x49')]('WhatsappQueueId\x20=\x20?',_0x50cca4['params']['id']);for(var _0x325beb=0x0;_0x325beb<_0x223fe5[_0xc368('0x44')];_0x325beb+=0x1){let _0x2b1619=_0x223fe5[_0x325beb];for(var _0x45eae1=0x0;_0x45eae1<_0x2b1619['Agents']['length'];_0x45eae1+=0x1){let _0x46cad7=_0x2b1619['Agents'][_0x45eae1];var _0x24842c=_0x200b81[_0xc368('0x6b')]();_0x24842c[_0xc368('0x49')](_0xc368('0x6c'),_0x46cad7['id']);_0x41585d[_0xc368('0x6d')](db[_0xc368('0x6e')][_0xc368('0x2f')](_0x24842c[_0xc368('0x6f')](),{'type':db[_0xc368('0x6e')][_0xc368('0x70')][_0xc368('0x71')]})['then'](function(_0x231dd3){if(_0x231dd3[_0xc368('0x44')]===0x1){return _0x46cad7['id'];}else{var _0x5f3aa5=_[_0xc368('0x72')](_[_0xc368('0x20')](_0x231dd3,_0xc368('0x73')),function(_0x40721c){return _[_0xc368('0x74')](_0x135963,_0x40721c);});if(_0x5f3aa5){return _0x46cad7['id'];}}}));}}return BPromise[_0xc368('0x75')](_0x41585d)[_0xc368('0x16')](function(_0x5338ea){_0x3ed3db=_(_0x3ed3db)['union'](_0x5338ea)['compact']()[_0xc368('0x76')]();return db[_0xc368('0x21')]['find']({'where':{'id':_0x50cca4['params']['id']}})[_0xc368('0x16')](function(_0xa3cc81){return db[_0xc368('0x6e')][_0xc368('0x5e')](function(_0x104fcf){return _0xa3cc81[_0xc368('0x64')](_0x50cca4['query'][_0xc368('0x59')],{'transaction':_0x104fcf})[_0xc368('0x16')](function(){if(!_[_0xc368('0x77')](_0x3ed3db)){return _0xa3cc81[_0xc368('0x78')](_0x3ed3db,{'transaction':_0x104fcf});}})['then'](function(){_0x3ed3db['forEach'](function(_0x2dff67){socket[_0xc368('0x62')](_0xc368('0x79'),{'UserId':_0x2dff67,'WhatsappQueueId':_0xa3cc81['id']});});});});});});})['then'](respondWithStatusCode(_0x3ca749,null))[_0xc368('0x29')](handleError(_0x3ca749,null));};exports[_0xc368('0x7a')]=function(_0x25324d,_0x1e9745){return db[_0xc368('0x21')][_0xc368('0x36')]({'where':{'id':_0x25324d[_0xc368('0x2b')]['id']}})[_0xc368('0x16')](handleEntityNotFound(_0x1e9745,null))[_0xc368('0x16')](function(_0x23cddb){if(_0x23cddb){return _0x23cddb[_0xc368('0x7a')](_0x25324d[_0xc368('0x38')][_0xc368('0x59')],_['omit'](_0x25324d['body'],['ids','id'])||{})[_0xc368('0x7b')](function(_0x82e6e2){for(var _0xb5cafa=0x0;_0xb5cafa<_0x25324d[_0xc368('0x38')][_0xc368('0x59')]['length'];_0xb5cafa+=0x1){socket[_0xc368('0x62')]('userWhatsappQueue:save',{'UserId':Number(_0x25324d['body'][_0xc368('0x59')][_0xb5cafa]),'WhatsappQueueId':Number(_0x25324d[_0xc368('0x2b')]['id'])});}return _0x82e6e2;});}})['then'](respondWithResult(_0x1e9745,null))['catch'](handleError(_0x1e9745,null));};exports[_0xc368('0x78')]=function(_0x1e7450,_0x36df2c){return db[_0xc368('0x21')][_0xc368('0x36')]({'where':{'id':_0x1e7450[_0xc368('0x2b')]['id']}})['then'](handleEntityNotFound(_0x36df2c,null))[_0xc368('0x16')](function(_0x429dcd){if(_0x429dcd){return _0x429dcd['removeAgents'](_0x1e7450[_0xc368('0x2f')][_0xc368('0x59')])[_0xc368('0x16')](function(){if(_[_0xc368('0x7c')](_0x1e7450[_0xc368('0x2f')][_0xc368('0x59')])){for(var _0x217752=0x0;_0x217752<_0x1e7450[_0xc368('0x2f')][_0xc368('0x59')][_0xc368('0x44')];_0x217752+=0x1){socket[_0xc368('0x62')](_0xc368('0x79'),{'UserId':Number(_0x1e7450[_0xc368('0x2f')][_0xc368('0x59')][_0x217752]),'WhatsappQueueId':Number(_0x1e7450[_0xc368('0x2b')]['id'])});}}else{socket[_0xc368('0x62')](_0xc368('0x79'),{'UserId':Number(_0x1e7450['query'][_0xc368('0x59')]),'WhatsappQueueId':Number(_0x1e7450[_0xc368('0x2b')]['id'])});}});}})[_0xc368('0x16')](respondWithStatusCode(_0x36df2c,null))[_0xc368('0x29')](handleError(_0x36df2c,null));};exports[_0xc368('0x7d')]=function(_0x211779,_0x41a60e){var _0xad78dd={};var _0x237f7e={};var _0x1788d9;var _0x1da77d;return db[_0xc368('0x21')][_0xc368('0x42')]({'where':{'id':_0x211779[_0xc368('0x2b')]['id']}})['then'](handleEntityNotFound(_0x41a60e,null))[_0xc368('0x16')](function(_0x1f8ef5){if(_0x1f8ef5){_0x1788d9=_0x1f8ef5;_0x237f7e[_0xc368('0x2c')]=_[_0xc368('0x2d')](db[_0xc368('0x65')][_0xc368('0x2e')]);_0x237f7e[_0xc368('0x2f')]=_[_0xc368('0x2d')](_0x211779['query']);_0x237f7e[_0xc368('0x30')]=_['intersection'](_0x237f7e[_0xc368('0x2c')],_0x237f7e['query']);_0xad78dd['attributes']=_['intersection'](_0x237f7e['model'],qs[_0xc368('0x32')](_0x211779[_0xc368('0x2f')]['fields']));_0xad78dd['attributes']=_0xad78dd['attributes'][_0xc368('0x44')]?_0xad78dd[_0xc368('0x33')]:_0x237f7e[_0xc368('0x2c')];_0xad78dd[_0xc368('0x47')]=qs[_0xc368('0x48')](_0x211779[_0xc368('0x2f')][_0xc368('0x48')]);_0xad78dd[_0xc368('0x49')]=qs[_0xc368('0x30')](_[_0xc368('0x4a')](_0x211779['query'],_0x237f7e[_0xc368('0x30')]));if(_0x211779['query'][_0xc368('0x4c')]){_0xad78dd[_0xc368('0x49')]=_[_0xc368('0x35')](_0xad78dd['where'],{'$or':_['map'](_0xad78dd[_0xc368('0x33')],function(_0x419225){var _0x4a6b6f={};_0x4a6b6f[_0x419225]={'$like':'%'+_0x211779[_0xc368('0x2f')]['filter']+'%'};return _0x4a6b6f;})});}_0xad78dd=_[_0xc368('0x35')]({},_0xad78dd,_0x211779['options']);return _0x1788d9[_0xc368('0x7d')](_0xad78dd);}})[_0xc368('0x16')](function(_0x993390){if(_0x993390){_0x1da77d=_0x993390['length'];if(!_0x211779['query'][_0xc368('0x45')]('nolimit')){_0xad78dd[_0xc368('0x13')]=qs[_0xc368('0x13')](_0x211779[_0xc368('0x2f')][_0xc368('0x13')]);_0xad78dd[_0xc368('0x10')]=qs[_0xc368('0x10')](_0x211779[_0xc368('0x2f')]['offset']);}return _0x1788d9[_0xc368('0x7d')](_0xad78dd);}})['then'](function(_0x2833d8){if(_0x2833d8){return _0x2833d8?{'count':_0x1da77d,'rows':_0x2833d8}:null;}})[_0xc368('0x16')](respondWithResult(_0x41a60e,null))[_0xc368('0x29')](handleError(_0x41a60e,null));}; \ No newline at end of file +var _0x38a2=['end','json','offset','undefined','limit','count','set','Content-Range','then','get','WhatsappQueues','destroy','error','name','index','map','WhatsappQueue','rawAttributes','fieldName','type','getOptions','where','include','query','findAll','rows','catch','show','params','model','keys','intersection','attributes','length','includeAll','merge','options','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','findOne','UserWhatsappQueue','filters','fields','hasOwnProperty','order','sort','WhatsappQueueId','filter','User','findAndCountAll','agent','whatsappPause','updatedAt','createdAt','format','%s/%s','getTeams','Team','addTeams','ids','online','interface','Agents','sequelize','each','findOrCreate','forEach','userWhatsappQueue:save','tq.TeamId','team_has_whatsapp_queues','user_has_teams','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','TeamId','union','compact','value','transaction','removeTeams','isEmpty','removeAgents','emit','userWhatsappQueue:remove','addAgents','omit','isArray','getAgents','pick','nolimit','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','sendStatus','status'];(function(_0x4d11d5,_0x4ffbcd){var _0x1f2ad1=function(_0x4c424d){while(--_0x4c424d){_0x4d11d5['push'](_0x4d11d5['shift']());}};_0x1f2ad1(++_0x4ffbcd);}(_0x38a2,0x15a));var _0x238a=function(_0x578d5b,_0x2f7faf){_0x578d5b=_0x578d5b-0x0;var _0x5bf675=_0x38a2[_0x578d5b];return _0x5bf675;};'use strict';var BPromise=require(_0x238a('0x0'));var util=require(_0x238a('0x1'));var _=require(_0x238a('0x2'));var squel=require(_0x238a('0x3'));var Redis=require(_0x238a('0x4'));var qs=require(_0x238a('0x5'));var logger=require(_0x238a('0x6'))(_0x238a('0x7'));var config=require(_0x238a('0x8'));var db=require(_0x238a('0x9'))['db'];config[_0x238a('0xa')]=_[_0x238a('0xb')](config['redis'],{'host':_0x238a('0xc'),'port':0x18eb});var socket=require(_0x238a('0xd'))(new Redis(config[_0x238a('0xa')]));require(_0x238a('0xe'))['register'](socket);function respondWithStatusCode(_0x5da40a,_0x5eeb17){_0x5eeb17=_0x5eeb17||0xcc;return function(_0x42ebdd){if(_0x42ebdd){return _0x5da40a[_0x238a('0xf')](_0x5eeb17);}return _0x5da40a[_0x238a('0x10')](_0x5eeb17)[_0x238a('0x11')]();};}function respondWithResult(_0x32a217,_0x478546){_0x478546=_0x478546||0xc8;return function(_0x2f3859){if(_0x2f3859){return _0x32a217[_0x238a('0x10')](_0x478546)[_0x238a('0x12')](_0x2f3859);}};}function respondWithFilteredResult(_0x108175,_0x22e20a){return function(_0xe44a8){if(_0xe44a8){var _0x1a71b2=typeof _0x22e20a[_0x238a('0x13')]===_0x238a('0x14')&&typeof _0x22e20a[_0x238a('0x15')]===_0x238a('0x14');var _0x17683d=_0xe44a8[_0x238a('0x16')];var _0xf31e7c=_0x1a71b2?0x0:_0x22e20a['offset'];var _0x28d11b=_0x1a71b2?_0xe44a8[_0x238a('0x16')]:_0x22e20a[_0x238a('0x13')]+_0x22e20a[_0x238a('0x15')];var _0x487050;if(_0x28d11b>=_0x17683d){_0x28d11b=_0x17683d;_0x487050=0xc8;}else{_0x487050=0xce;}_0x108175[_0x238a('0x10')](_0x487050);return _0x108175[_0x238a('0x17')](_0x238a('0x18'),_0xf31e7c+'-'+_0x28d11b+'/'+_0x17683d)[_0x238a('0x12')](_0xe44a8);}return null;};}function saveUpdates(_0x181737){return function(_0x4b4a30){if(_0x4b4a30){return _0x4b4a30['update'](_0x181737)[_0x238a('0x19')](function(_0x1ae965){return _0x1ae965;});}return null;};}function removeEntity(_0x4441d6){return function(_0x361336){if(_0x361336){return _0x361336['destroy']()[_0x238a('0x19')](function(){var _0x20b8e3=_0x361336[_0x238a('0x1a')]({'plain':!![]});var _0x3710b6=_0x238a('0x1b');return db['UserProfileResource'][_0x238a('0x1c')]({'where':{'type':_0x3710b6,'resourceId':_0x20b8e3['id']}})[_0x238a('0x19')](function(){return _0x361336;});})['then'](function(){_0x4441d6[_0x238a('0x10')](0xcc)[_0x238a('0x11')]();});}};}function handleEntityNotFound(_0x8d6da1){return function(_0x23621b){if(!_0x23621b){_0x8d6da1[_0x238a('0xf')](0x194);}return _0x23621b;};}function handleError(_0x184fe2,_0x38f95f){_0x38f95f=_0x38f95f||0x1f4;return function(_0x5b4339){logger[_0x238a('0x1d')](_0x5b4339['stack']);if(_0x5b4339['name']){delete _0x5b4339[_0x238a('0x1e')];}_0x184fe2[_0x238a('0x10')](_0x38f95f)['send'](_0x5b4339);};}exports[_0x238a('0x1f')]=function(_0x51c80f,_0x51ebc7){var _0x2a7435={};var _0x54b0b1={'count':0x0,'rows':[]};var _0x5eb105=_[_0x238a('0x20')](db[_0x238a('0x21')][_0x238a('0x22')],function(_0x373a8c){return{'name':_0x373a8c[_0x238a('0x23')],'type':_0x373a8c[_0x238a('0x24')]['key']};});_0x2a7435=qs[_0x238a('0x25')](_0x5eb105,_0x51c80f);var _0x12b384={'where':_0x2a7435[_0x238a('0x26')]};return db[_0x238a('0x21')]['count'](_0x12b384)[_0x238a('0x19')](function(_0x528a71){_0x54b0b1['count']=_0x528a71;_0x2a7435['include']=qs[_0x238a('0x27')](_0x51c80f[_0x238a('0x28')]);return db[_0x238a('0x21')][_0x238a('0x29')](_0x2a7435);})[_0x238a('0x19')](function(_0x212957){_0x54b0b1[_0x238a('0x2a')]=_0x212957;return _0x54b0b1;})[_0x238a('0x19')](respondWithFilteredResult(_0x51ebc7,_0x2a7435))[_0x238a('0x2b')](handleError(_0x51ebc7,null));};exports[_0x238a('0x2c')]=function(_0x2e8bff,_0x79fd0d){var _0x279df9={'raw':!![],'where':{'id':_0x2e8bff[_0x238a('0x2d')]['id']}},_0x4b1524={};_0x4b1524[_0x238a('0x2e')]=_[_0x238a('0x2f')](db['WhatsappQueue'][_0x238a('0x22')]);_0x4b1524[_0x238a('0x28')]=_[_0x238a('0x2f')](_0x2e8bff[_0x238a('0x28')]);_0x4b1524['filters']=_[_0x238a('0x30')](_0x4b1524['model'],_0x4b1524[_0x238a('0x28')]);_0x279df9['attributes']=_[_0x238a('0x30')](_0x4b1524[_0x238a('0x2e')],qs['fields'](_0x2e8bff['query']['fields']));_0x279df9[_0x238a('0x31')]=_0x279df9[_0x238a('0x31')][_0x238a('0x32')]?_0x279df9[_0x238a('0x31')]:_0x4b1524[_0x238a('0x2e')];if(_0x2e8bff['query'][_0x238a('0x33')]){_0x279df9['include']=[{'all':!![]}];}_0x279df9=_[_0x238a('0x34')]({},_0x279df9,_0x2e8bff[_0x238a('0x35')]);return db['WhatsappQueue'][_0x238a('0x36')](_0x279df9)[_0x238a('0x19')](handleEntityNotFound(_0x79fd0d,null))[_0x238a('0x19')](respondWithResult(_0x79fd0d,null))[_0x238a('0x2b')](handleError(_0x79fd0d,null));};exports['create']=function(_0x441ae0,_0x3d6488){return db[_0x238a('0x21')]['create'](_0x441ae0[_0x238a('0x37')],{})['then'](function(_0x25e468){var _0x2f9c48=_0x441ae0[_0x238a('0x38')][_0x238a('0x1a')]({'plain':!![]});if(!_0x2f9c48)throw new Error(_0x238a('0x39'));if(_0x2f9c48[_0x238a('0x3a')]===_0x238a('0x38')){var _0x598043=_0x25e468['get']({'plain':!![]});var _0x2477b7='WhatsappQueues';return db[_0x238a('0x3b')]['find']({'where':{'name':_0x2477b7,'userProfileId':_0x2f9c48[_0x238a('0x3c')]},'raw':!![]})[_0x238a('0x19')](function(_0x4100ca){if(_0x4100ca&&_0x4100ca[_0x238a('0x3d')]===0x0){return db[_0x238a('0x3e')][_0x238a('0x3f')]({'name':_0x598043[_0x238a('0x1e')],'resourceId':_0x598043['id'],'type':_0x4100ca[_0x238a('0x1e')],'sectionId':_0x4100ca['id']},{})[_0x238a('0x19')](function(){return _0x25e468;});}else{return _0x25e468;}})['catch'](function(_0x421035){logger[_0x238a('0x1d')](_0x238a('0x40'),_0x421035);throw _0x421035;});}return _0x25e468;})['then'](respondWithResult(_0x3d6488,0xc9))[_0x238a('0x2b')](handleError(_0x3d6488,null));};exports[_0x238a('0x41')]=function(_0x204391,_0x4d3abc){if(_0x204391[_0x238a('0x37')]['id']){delete _0x204391['body']['id'];}return db['WhatsappQueue'][_0x238a('0x36')]({'where':{'id':_0x204391[_0x238a('0x2d')]['id']}})['then'](handleEntityNotFound(_0x4d3abc,null))[_0x238a('0x19')](saveUpdates(_0x204391[_0x238a('0x37')],null))[_0x238a('0x19')](respondWithResult(_0x4d3abc,null))[_0x238a('0x2b')](handleError(_0x4d3abc,null));};exports[_0x238a('0x1c')]=function(_0x27f2d9,_0x580646){return db[_0x238a('0x21')][_0x238a('0x36')]({'where':{'id':_0x27f2d9[_0x238a('0x2d')]['id']}})[_0x238a('0x19')](handleEntityNotFound(_0x580646,null))[_0x238a('0x19')](removeEntity(_0x580646,null))[_0x238a('0x2b')](handleError(_0x580646,null));};exports[_0x238a('0x42')]=function(_0x27e93b,_0x4acdb6){return db['WhatsappQueue'][_0x238a('0x42')]()['then'](respondWithResult(_0x4acdb6,null))['catch'](handleError(_0x4acdb6,null));};exports['getMembers']=function(_0x1f77fe,_0x32532c){var _0x56db62={'raw':!![],'where':{}},_0x490ebc={},_0x115b9b;return db[_0x238a('0x21')][_0x238a('0x43')]({'where':{'id':_0x1f77fe[_0x238a('0x2d')]['id']}})[_0x238a('0x19')](handleEntityNotFound(_0x32532c,null))[_0x238a('0x19')](function(_0x14419f){if(_0x14419f){_0x115b9b=_0x14419f[_0x238a('0x1a')]({'plain':!![]});_0x490ebc[_0x238a('0x2e')]=_[_0x238a('0x2f')](db[_0x238a('0x44')][_0x238a('0x22')]);_0x490ebc['query']=_[_0x238a('0x2f')](_0x1f77fe[_0x238a('0x28')]);_0x490ebc[_0x238a('0x45')]=_[_0x238a('0x30')](_0x490ebc[_0x238a('0x2e')],_0x490ebc[_0x238a('0x28')]);_0x56db62['attributes']=_[_0x238a('0x30')](_0x490ebc['model'],qs[_0x238a('0x46')](_0x1f77fe[_0x238a('0x28')][_0x238a('0x46')]));_0x56db62[_0x238a('0x31')]=_0x56db62[_0x238a('0x31')][_0x238a('0x32')]?_0x56db62['attributes']:_0x490ebc[_0x238a('0x2e')];if(!_0x1f77fe[_0x238a('0x28')][_0x238a('0x47')]('nolimit')){_0x56db62[_0x238a('0x15')]=qs[_0x238a('0x15')](_0x1f77fe['query'][_0x238a('0x15')]);_0x56db62[_0x238a('0x13')]=qs['offset'](_0x1f77fe[_0x238a('0x28')][_0x238a('0x13')]);}_0x56db62[_0x238a('0x48')]=qs[_0x238a('0x49')](_0x1f77fe['query']['sort']);_0x56db62[_0x238a('0x26')]=qs['filters'](_['pick'](_0x1f77fe['query'],_0x490ebc['filters']));_0x56db62[_0x238a('0x26')][_0x238a('0x4a')]=_0x14419f['id'];if(_0x1f77fe[_0x238a('0x28')][_0x238a('0x4b')]){_0x56db62[_0x238a('0x26')]=_[_0x238a('0x34')](_0x56db62[_0x238a('0x26')],{'$or':_[_0x238a('0x20')](_0x56db62[_0x238a('0x31')],function(_0x199929){var _0x89305f={};_0x89305f[_0x199929]={'$like':'%'+_0x1f77fe[_0x238a('0x28')]['filter']+'%'};return _0x89305f;})});}_0x56db62=_[_0x238a('0x34')]({},_0x56db62,_0x1f77fe[_0x238a('0x35')]);return db[_0x238a('0x44')][_0x238a('0x29')](_0x56db62);}})['then'](function(_0x419765){if(_0x419765){return db[_0x238a('0x4c')][_0x238a('0x4d')]({'where':{'id':_[_0x238a('0x20')](_0x419765,'UserId'),'role':_0x238a('0x4e')},'attributes':['id',_0x238a('0x1e'),_0x238a('0x4f'),_0x238a('0x50'),_0x238a('0x51')]});}})[_0x238a('0x19')](function(_0x3a210d){if(_0x3a210d){return{'count':_0x3a210d[_0x238a('0x16')],'rows':_['map'](_0x3a210d['rows'],function(_0x3aaf60){return{'membername':_0x3aaf60[_0x238a('0x1e')],'UserId':_0x3aaf60['id'],'queue_name':_0x115b9b[_0x238a('0x1e')],'WhatsappQueueId':_0x115b9b['id'],'interface':util[_0x238a('0x52')](_0x238a('0x53'),'SIP',_0x3aaf60[_0x238a('0x1e')]),'penalty':0x0,'paused':_0x3aaf60['whatsappPause'],'createdAt':_0x3aaf60[_0x238a('0x51')],'updatedAt':_0x3aaf60['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x238a('0x19')](respondWithFilteredResult(_0x32532c,_0x56db62))[_0x238a('0x2b')](handleError(_0x32532c,null));};exports[_0x238a('0x54')]=function(_0x1e6f6c,_0x4f5ec7){var _0x352182={};var _0x10d0ff={};var _0xf7b265;var _0x164479;return db[_0x238a('0x21')][_0x238a('0x43')]({'where':{'id':_0x1e6f6c['params']['id']}})[_0x238a('0x19')](handleEntityNotFound(_0x4f5ec7,null))['then'](function(_0x3a5b4e){if(_0x3a5b4e){_0xf7b265=_0x3a5b4e;_0x10d0ff['model']=_[_0x238a('0x2f')](db[_0x238a('0x55')][_0x238a('0x22')]);_0x10d0ff['query']=_[_0x238a('0x2f')](_0x1e6f6c[_0x238a('0x28')]);_0x10d0ff['filters']=_[_0x238a('0x30')](_0x10d0ff[_0x238a('0x2e')],_0x10d0ff[_0x238a('0x28')]);_0x352182[_0x238a('0x31')]=_[_0x238a('0x30')](_0x10d0ff['model'],qs[_0x238a('0x46')](_0x1e6f6c['query'][_0x238a('0x46')]));_0x352182[_0x238a('0x31')]=_0x352182['attributes'][_0x238a('0x32')]?_0x352182[_0x238a('0x31')]:_0x10d0ff[_0x238a('0x2e')];_0x352182['order']=qs[_0x238a('0x49')](_0x1e6f6c[_0x238a('0x28')][_0x238a('0x49')]);_0x352182[_0x238a('0x26')]=qs[_0x238a('0x45')](_['pick'](_0x1e6f6c['query'],_0x10d0ff[_0x238a('0x45')]));if(_0x1e6f6c[_0x238a('0x28')][_0x238a('0x4b')]){_0x352182[_0x238a('0x26')]=_[_0x238a('0x34')](_0x352182[_0x238a('0x26')],{'$or':_[_0x238a('0x20')](_0x352182[_0x238a('0x31')],function(_0x5ba8c2){var _0x286756={};_0x286756[_0x5ba8c2]={'$like':'%'+_0x1e6f6c[_0x238a('0x28')][_0x238a('0x4b')]+'%'};return _0x286756;})});}_0x352182=_['merge']({},_0x352182,_0x1e6f6c[_0x238a('0x35')]);return _0xf7b265[_0x238a('0x54')](_0x352182);}})[_0x238a('0x19')](function(_0x7b7083){if(_0x7b7083){_0x164479=_0x7b7083[_0x238a('0x32')];if(!_0x1e6f6c['query'][_0x238a('0x47')]('nolimit')){_0x352182['limit']=qs[_0x238a('0x15')](_0x1e6f6c[_0x238a('0x28')]['limit']);_0x352182[_0x238a('0x13')]=qs[_0x238a('0x13')](_0x1e6f6c[_0x238a('0x28')][_0x238a('0x13')]);}return _0xf7b265['getTeams'](_0x352182);}})[_0x238a('0x19')](function(_0x1f62f9){if(_0x1f62f9){return _0x1f62f9?{'count':_0x164479,'rows':_0x1f62f9}:null;}})[_0x238a('0x19')](respondWithResult(_0x4f5ec7,null))['catch'](handleError(_0x4f5ec7,null));};exports[_0x238a('0x56')]=function(_0x3b3f02,_0x544e98){var _0x47d760=_0x3b3f02[_0x238a('0x37')][_0x238a('0x57')];return db['Team']['findAll']({'where':{'id':_0x47d760},'attributes':['id'],'include':[{'model':db[_0x238a('0x4c')],'as':'Agents','attributes':['id',_0x238a('0x1e'),_0x238a('0x58'),'voicePause',_0x238a('0x59')],'raw':!![]}]})[_0x238a('0x19')](function(_0x9f5f76){if(_0x9f5f76){var _0x196bc1=_['flatMap'](_0x9f5f76,function(_0x50b7c0){var _0x474a74=_0x50b7c0[_0x238a('0x1a')]({'plain':!![]});return _0x474a74[_0x238a('0x5a')];});return db[_0x238a('0x21')][_0x238a('0x36')]({'where':{'id':_0x3b3f02[_0x238a('0x2d')]['id']}})[_0x238a('0x19')](function(_0x1dc953){return db[_0x238a('0x5b')]['transaction'](function(_0xa05746){return _0x1dc953[_0x238a('0x56')](_0x47d760,{'transaction':_0xa05746})[_0x238a('0x19')](function(){return BPromise[_0x238a('0x5c')](_0x196bc1,function(_0x38bd35){return db[_0x238a('0x44')][_0x238a('0x5d')]({'where':{'UserId':_0x38bd35['id'],'WhatsappQueueId':_0x3b3f02[_0x238a('0x2d')]['id']},'transaction':_0xa05746});});})[_0x238a('0x19')](function(){_0x196bc1[_0x238a('0x5e')](function(_0x4ae625){socket['emit'](_0x238a('0x5f'),{'UserId':_0x4ae625['id'],'WhatsappQueueId':_0x1dc953['id']});});});});});}})[_0x238a('0x19')](respondWithStatusCode(_0x544e98,null))['catch'](handleError(_0x544e98,null));};exports['removeTeams']=function(_0x4ea610,_0x3535cc){return db[_0x238a('0x55')][_0x238a('0x29')]({'where':{'id':_0x4ea610[_0x238a('0x28')][_0x238a('0x57')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x238a('0x5a'),'attributes':['id'],'raw':!![]}]})[_0x238a('0x19')](handleEntityNotFound(_0x3535cc,null))[_0x238a('0x19')](function(_0x550096){var _0x53106d=_[_0x238a('0x20')](_0x550096,'id');var _0x5159fd=[];var _0x3b3ae8=[];var _0x1ff50d=squel['select']();_0x1ff50d['field'](_0x238a('0x60'))['from'](_0x238a('0x61'),'tq')['join'](_0x238a('0x62'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x238a('0x26')](_0x238a('0x63'),_0x4ea610[_0x238a('0x2d')]['id']);for(var _0x46ffd8=0x0;_0x46ffd8<_0x550096[_0x238a('0x32')];_0x46ffd8+=0x1){let _0x1795d0=_0x550096[_0x46ffd8];for(var _0x2c370b=0x0;_0x2c370b<_0x1795d0[_0x238a('0x5a')]['length'];_0x2c370b+=0x1){let _0x116916=_0x1795d0['Agents'][_0x2c370b];var _0xbf6728=_0x1ff50d[_0x238a('0x64')]();_0xbf6728[_0x238a('0x26')](_0x238a('0x65'),_0x116916['id']);_0x3b3ae8[_0x238a('0x66')](db[_0x238a('0x5b')][_0x238a('0x28')](_0xbf6728[_0x238a('0x67')](),{'type':db['sequelize'][_0x238a('0x68')]['SELECT']})[_0x238a('0x19')](function(_0x175187){if(_0x175187['length']===0x1){return _0x116916['id'];}else{var _0x4e9300=_['every'](_[_0x238a('0x20')](_0x175187,_0x238a('0x69')),function(_0x37bf9c){return _['includes'](_0x53106d,_0x37bf9c);});if(_0x4e9300){return _0x116916['id'];}}}));}}return BPromise['all'](_0x3b3ae8)['then'](function(_0x26fca8){_0x5159fd=_(_0x5159fd)[_0x238a('0x6a')](_0x26fca8)[_0x238a('0x6b')]()[_0x238a('0x6c')]();return db[_0x238a('0x21')][_0x238a('0x36')]({'where':{'id':_0x4ea610[_0x238a('0x2d')]['id']}})[_0x238a('0x19')](function(_0x4d3a6f){return db['sequelize'][_0x238a('0x6d')](function(_0x453ce8){return _0x4d3a6f[_0x238a('0x6e')](_0x4ea610[_0x238a('0x28')][_0x238a('0x57')],{'transaction':_0x453ce8})[_0x238a('0x19')](function(){if(!_[_0x238a('0x6f')](_0x5159fd)){return _0x4d3a6f[_0x238a('0x70')](_0x5159fd,{'transaction':_0x453ce8});}})[_0x238a('0x19')](function(){_0x5159fd[_0x238a('0x5e')](function(_0x4ecef9){socket[_0x238a('0x71')](_0x238a('0x72'),{'UserId':_0x4ecef9,'WhatsappQueueId':_0x4d3a6f['id']});});});});});});})['then'](respondWithStatusCode(_0x3535cc,null))[_0x238a('0x2b')](handleError(_0x3535cc,null));};exports[_0x238a('0x73')]=function(_0x2afb5e,_0x85aa57){return db[_0x238a('0x21')][_0x238a('0x36')]({'where':{'id':_0x2afb5e[_0x238a('0x2d')]['id']}})[_0x238a('0x19')](handleEntityNotFound(_0x85aa57,null))['then'](function(_0x5b4d96){if(_0x5b4d96){return _0x5b4d96[_0x238a('0x73')](_0x2afb5e[_0x238a('0x37')][_0x238a('0x57')],_[_0x238a('0x74')](_0x2afb5e[_0x238a('0x37')],[_0x238a('0x57'),'id'])||{})['spread'](function(_0x6a9970){for(var _0x371f08=0x0;_0x371f08<_0x2afb5e[_0x238a('0x37')][_0x238a('0x57')][_0x238a('0x32')];_0x371f08+=0x1){socket[_0x238a('0x71')](_0x238a('0x5f'),{'UserId':Number(_0x2afb5e[_0x238a('0x37')][_0x238a('0x57')][_0x371f08]),'WhatsappQueueId':Number(_0x2afb5e[_0x238a('0x2d')]['id'])});}return _0x6a9970;});}})[_0x238a('0x19')](respondWithResult(_0x85aa57,null))[_0x238a('0x2b')](handleError(_0x85aa57,null));};exports[_0x238a('0x70')]=function(_0x37736f,_0x337eb7){return db['WhatsappQueue'][_0x238a('0x36')]({'where':{'id':_0x37736f[_0x238a('0x2d')]['id']}})[_0x238a('0x19')](handleEntityNotFound(_0x337eb7,null))['then'](function(_0x5bdc83){if(_0x5bdc83){return _0x5bdc83[_0x238a('0x70')](_0x37736f['query'][_0x238a('0x57')])['then'](function(){if(_[_0x238a('0x75')](_0x37736f['query'][_0x238a('0x57')])){for(var _0x1d3d7a=0x0;_0x1d3d7a<_0x37736f[_0x238a('0x28')][_0x238a('0x57')][_0x238a('0x32')];_0x1d3d7a+=0x1){socket[_0x238a('0x71')](_0x238a('0x72'),{'UserId':Number(_0x37736f[_0x238a('0x28')]['ids'][_0x1d3d7a]),'WhatsappQueueId':Number(_0x37736f[_0x238a('0x2d')]['id'])});}}else{socket[_0x238a('0x71')]('userWhatsappQueue:remove',{'UserId':Number(_0x37736f[_0x238a('0x28')][_0x238a('0x57')]),'WhatsappQueueId':Number(_0x37736f[_0x238a('0x2d')]['id'])});}});}})[_0x238a('0x19')](respondWithStatusCode(_0x337eb7,null))[_0x238a('0x2b')](handleError(_0x337eb7,null));};exports[_0x238a('0x76')]=function(_0x1050f9,_0x4a9c40){var _0x1d35f6={};var _0x47af6d={};var _0x1f88ab;var _0x38e28e;return db['WhatsappQueue']['findOne']({'where':{'id':_0x1050f9['params']['id']}})['then'](handleEntityNotFound(_0x4a9c40,null))['then'](function(_0x3de28b){if(_0x3de28b){_0x1f88ab=_0x3de28b;_0x47af6d[_0x238a('0x2e')]=_[_0x238a('0x2f')](db[_0x238a('0x4c')][_0x238a('0x22')]);_0x47af6d['query']=_[_0x238a('0x2f')](_0x1050f9[_0x238a('0x28')]);_0x47af6d['filters']=_[_0x238a('0x30')](_0x47af6d['model'],_0x47af6d[_0x238a('0x28')]);_0x1d35f6[_0x238a('0x31')]=_[_0x238a('0x30')](_0x47af6d[_0x238a('0x2e')],qs[_0x238a('0x46')](_0x1050f9['query'][_0x238a('0x46')]));_0x1d35f6[_0x238a('0x31')]=_0x1d35f6['attributes'][_0x238a('0x32')]?_0x1d35f6[_0x238a('0x31')]:_0x47af6d[_0x238a('0x2e')];_0x1d35f6[_0x238a('0x48')]=qs[_0x238a('0x49')](_0x1050f9[_0x238a('0x28')][_0x238a('0x49')]);_0x1d35f6[_0x238a('0x26')]=qs[_0x238a('0x45')](_[_0x238a('0x77')](_0x1050f9[_0x238a('0x28')],_0x47af6d[_0x238a('0x45')]));if(_0x1050f9['query'][_0x238a('0x4b')]){_0x1d35f6[_0x238a('0x26')]=_[_0x238a('0x34')](_0x1d35f6['where'],{'$or':_['map'](_0x1d35f6['attributes'],function(_0x3a86f5){var _0x45b211={};_0x45b211[_0x3a86f5]={'$like':'%'+_0x1050f9[_0x238a('0x28')][_0x238a('0x4b')]+'%'};return _0x45b211;})});}_0x1d35f6=_[_0x238a('0x34')]({},_0x1d35f6,_0x1050f9[_0x238a('0x35')]);return _0x1f88ab[_0x238a('0x76')](_0x1d35f6);}})['then'](function(_0x39cb0a){if(_0x39cb0a){_0x38e28e=_0x39cb0a[_0x238a('0x32')];if(!_0x1050f9['query'][_0x238a('0x47')](_0x238a('0x78'))){_0x1d35f6[_0x238a('0x15')]=qs['limit'](_0x1050f9[_0x238a('0x28')][_0x238a('0x15')]);_0x1d35f6[_0x238a('0x13')]=qs[_0x238a('0x13')](_0x1050f9[_0x238a('0x28')][_0x238a('0x13')]);}return _0x1f88ab[_0x238a('0x76')](_0x1d35f6);}})[_0x238a('0x19')](function(_0x398363){if(_0x398363){return _0x398363?{'count':_0x38e28e,'rows':_0x398363}:null;}})[_0x238a('0x19')](respondWithResult(_0x4a9c40,null))['catch'](handleError(_0x4a9c40,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index d84dceb..b974946 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 _0x22b6=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappQueue','save','update','remove'];(function(_0x1280ce,_0x3c779a){var _0x13d2e7=function(_0x40ee0a){while(--_0x40ee0a){_0x1280ce['push'](_0x1280ce['shift']());}};_0x13d2e7(++_0x3c779a);}(_0x22b6,0x180));var _0x622b=function(_0x5aafe4,_0x6b5bd3){_0x5aafe4=_0x5aafe4-0x0;var _0x84f41b=_0x22b6[_0x5aafe4];return _0x84f41b;};'use strict';var EventEmitter=require(_0x622b('0x0'));var WhatsappQueue=require(_0x622b('0x1'))['db'][_0x622b('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x622b('0x3'),'afterUpdate':_0x622b('0x4'),'afterDestroy':_0x622b('0x5')};function emitEvent(_0x5c0307){return function(_0x68f54e,_0x25a5d9,_0x2794bc){WhatsappQueueEvents[_0x622b('0x6')](_0x5c0307+':'+_0x68f54e['id'],_0x68f54e);WhatsappQueueEvents[_0x622b('0x6')](_0x5c0307,_0x68f54e);_0x2794bc(null);};}for(var e in events){if(events[_0x622b('0x7')](e)){var event=events[e];WhatsappQueue[_0x622b('0x8')](e,emitEvent(event));}}module[_0x622b('0x9')]=WhatsappQueueEvents; \ No newline at end of file +var _0x4125=['hasOwnProperty','exports','events','WhatsappQueue','setMaxListeners','remove'];(function(_0x2d41c4,_0x739e01){var _0x5ef075=function(_0x5f575c){while(--_0x5f575c){_0x2d41c4['push'](_0x2d41c4['shift']());}};_0x5ef075(++_0x739e01);}(_0x4125,0x1a6));var _0x5412=function(_0xc44970,_0x5093cc){_0xc44970=_0xc44970-0x0;var _0xbc5fd3=_0x4125[_0xc44970];return _0xbc5fd3;};'use strict';var EventEmitter=require(_0x5412('0x0'));var WhatsappQueue=require('../../mysqldb')['db'][_0x5412('0x1')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x5412('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x5412('0x3')};function emitEvent(_0x3d0096){return function(_0x24f112,_0x358340,_0x82e937){WhatsappQueueEvents['emit'](_0x3d0096+':'+_0x24f112['id'],_0x24f112);WhatsappQueueEvents['emit'](_0x3d0096,_0x24f112);_0x82e937(null);};}for(var e in events){if(events[_0x5412('0x4')](e)){var event=events[e];WhatsappQueue['hook'](e,emitEvent(event));}}module[_0x5412('0x5')]=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index 6b909c7..f4d279f 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 _0x973b=['path','../../config/environment','./whatsappQueue.attributes','exports','define','WhatsappQueue','whatsapp_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x51864f,_0x14f917){var _0x22dda3=function(_0x2c060e){while(--_0x2c060e){_0x51864f['push'](_0x51864f['shift']());}};_0x22dda3(++_0x14f917);}(_0x973b,0x93));var _0xb973=function(_0x285bb8,_0x4d2705){_0x285bb8=_0x285bb8-0x0;var _0x32138d=_0x973b[_0x285bb8];return _0x32138d;};'use strict';var _=require(_0xb973('0x0'));var util=require(_0xb973('0x1'));var logger=require(_0xb973('0x2'))(_0xb973('0x3'));var moment=require(_0xb973('0x4'));var BPromise=require(_0xb973('0x5'));var rp=require(_0xb973('0x6'));var fs=require('fs');var path=require(_0xb973('0x7'));var rimraf=require('rimraf');var config=require(_0xb973('0x8'));var attributes=require(_0xb973('0x9'));module[_0xb973('0xa')]=function(_0x30250d,_0x18a45a){return _0x30250d[_0xb973('0xb')](_0xb973('0xc'),attributes,{'tableName':_0xb973('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe941=['WhatsappQueue','whatsapp_queues','lodash','moment','bluebird','request-promise','path','rimraf','./whatsappQueue.attributes','exports','define'];(function(_0x3c5af1,_0xc304e1){var _0x51df3b=function(_0xbb915a){while(--_0xbb915a){_0x3c5af1['push'](_0x3c5af1['shift']());}};_0x51df3b(++_0xc304e1);}(_0xe941,0x115));var _0x1e94=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xe941[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require(_0x1e94('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x1e94('0x1'));var BPromise=require(_0x1e94('0x2'));var rp=require(_0x1e94('0x3'));var fs=require('fs');var path=require(_0x1e94('0x4'));var rimraf=require(_0x1e94('0x5'));var config=require('../../config/environment');var attributes=require(_0x1e94('0x6'));module[_0x1e94('0x7')]=function(_0x452709,_0x187a23){return _0x452709[_0x1e94('0x8')](_0x1e94('0x9'),attributes,{'tableName':_0x1e94('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 70c3476..9622aa8 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 _0x6fbb=['include','model','map','GetWhatsappQueue','find','ShowWhatsappQueue','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./whatsappQueue.socket','register','request','then','info','WhatsappQueue,\x20%s,\x20%s','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','catch','WhatsappQueue','findAll','options','raw','where','attributes'];(function(_0x1c7743,_0x7e59f9){var _0x168347=function(_0x886a9b){while(--_0x886a9b){_0x1c7743['push'](_0x1c7743['shift']());}};_0x168347(++_0x7e59f9);}(_0x6fbb,0x1be));var _0xb6fb=function(_0x530a71,_0xeca2c2){_0x530a71=_0x530a71-0x0;var _0x16d1f8=_0x6fbb[_0x530a71];return _0x16d1f8;};'use strict';var _=require('lodash');var util=require(_0xb6fb('0x0'));var moment=require(_0xb6fb('0x1'));var BPromise=require(_0xb6fb('0x2'));var rs=require(_0xb6fb('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xb6fb('0x4'));var logger=require(_0xb6fb('0x5'))(_0xb6fb('0x6'));var config=require(_0xb6fb('0x7'));var jayson=require(_0xb6fb('0x8'));var client=jayson[_0xb6fb('0x9')][_0xb6fb('0xa')]({'port':0x232a});config[_0xb6fb('0xb')]=_[_0xb6fb('0xc')](config[_0xb6fb('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xb6fb('0xd'))(new Redis(config[_0xb6fb('0xb')]));require(_0xb6fb('0xe'))[_0xb6fb('0xf')](socket);function respondWithRpcPromise(_0x2827b6,_0x32a447,_0x5cc6e0){return new BPromise(function(_0x42e91b,_0xeba902){return client[_0xb6fb('0x10')](_0x2827b6,_0x5cc6e0)[_0xb6fb('0x11')](function(_0x2860df){logger[_0xb6fb('0x12')](_0xb6fb('0x13'),_0x32a447,'request\x20sent');logger[_0xb6fb('0x14')](_0xb6fb('0x15'),_0x32a447,_0xb6fb('0x16'),JSON[_0xb6fb('0x17')](_0x2860df));if(_0x2860df['error']){if(_0x2860df['error'][_0xb6fb('0x18')]===0x1f4){logger[_0xb6fb('0x19')]('WhatsappQueue,\x20%s,\x20%s',_0x32a447,_0x2860df['error'][_0xb6fb('0x1a')]);return _0xeba902(_0x2860df[_0xb6fb('0x19')]['message']);}logger[_0xb6fb('0x19')]('WhatsappQueue,\x20%s,\x20%s',_0x32a447,_0x2860df[_0xb6fb('0x19')][_0xb6fb('0x1a')]);return _0x42e91b(_0x2860df[_0xb6fb('0x19')][_0xb6fb('0x1a')]);}else{logger[_0xb6fb('0x12')](_0xb6fb('0x13'),_0x32a447,'request\x20sent');_0x42e91b(_0x2860df['result'][_0xb6fb('0x1a')]);}})[_0xb6fb('0x1b')](function(_0x51da0e){logger[_0xb6fb('0x19')](_0xb6fb('0x13'),_0x32a447,_0x51da0e);_0xeba902(_0x51da0e);});});}exports['GetWhatsappQueue']=function(_0x3ee67e){var _0x76399b=this;return new Promise(function(_0x3be8c4,_0x553e5c){return db[_0xb6fb('0x1c')][_0xb6fb('0x1d')]({'raw':_0x3ee67e['options']?_0x3ee67e[_0xb6fb('0x1e')][_0xb6fb('0x1f')]===undefined?!![]:![]:!![],'where':_0x3ee67e['options']?_0x3ee67e[_0xb6fb('0x1e')][_0xb6fb('0x20')]||null:null,'attributes':_0x3ee67e[_0xb6fb('0x1e')]?_0x3ee67e[_0xb6fb('0x1e')][_0xb6fb('0x21')]||null:null,'limit':_0x3ee67e[_0xb6fb('0x1e')]?_0x3ee67e[_0xb6fb('0x1e')]['limit']||null:null,'include':_0x3ee67e['options']?_0x3ee67e[_0xb6fb('0x1e')]['include']?_['map'](_0x3ee67e[_0xb6fb('0x1e')][_0xb6fb('0x22')],function(_0x540644){return{'model':db[_0x540644[_0xb6fb('0x23')]],'as':_0x540644['as'],'attributes':_0x540644[_0xb6fb('0x21')],'include':_0x540644['include']?_['map'](_0x540644['include'],function(_0x1f0ff7){return{'model':db[_0x1f0ff7[_0xb6fb('0x23')]],'as':_0x1f0ff7['as'],'attributes':_0x1f0ff7[_0xb6fb('0x21')],'include':_0x1f0ff7['include']?_[_0xb6fb('0x24')](_0x1f0ff7[_0xb6fb('0x22')],function(_0x157f60){return{'model':db[_0x157f60[_0xb6fb('0x23')]],'as':_0x157f60['as'],'attributes':_0x157f60[_0xb6fb('0x21')]};}):[]};}):[]};}):[]:[]})[_0xb6fb('0x11')](function(_0x1c54e4){logger[_0xb6fb('0x12')](_0xb6fb('0x25'),_0x3ee67e);logger[_0xb6fb('0x14')](_0xb6fb('0x25'),_0x3ee67e,JSON['stringify'](_0x1c54e4));_0x3be8c4(_0x1c54e4);})[_0xb6fb('0x1b')](function(_0x4e2fca){logger[_0xb6fb('0x19')](_0xb6fb('0x25'),_0x4e2fca[_0xb6fb('0x1a')],_0x3ee67e);_0x553e5c(_0x76399b['error'](0x1f4,_0x4e2fca[_0xb6fb('0x1a')]));});});};exports['ShowWhatsappQueue']=function(_0x3128b6){var _0x10477c=this;return new Promise(function(_0x2b09eb,_0x1c974e){return db[_0xb6fb('0x1c')][_0xb6fb('0x26')]({'raw':_0x3128b6[_0xb6fb('0x1e')]?_0x3128b6['options'][_0xb6fb('0x1f')]===undefined?!![]:![]:!![],'where':_0x3128b6[_0xb6fb('0x1e')]?_0x3128b6['options'][_0xb6fb('0x20')]||null:null,'attributes':_0x3128b6[_0xb6fb('0x1e')]?_0x3128b6[_0xb6fb('0x1e')]['attributes']||null:null,'include':_0x3128b6[_0xb6fb('0x1e')]?_0x3128b6[_0xb6fb('0x1e')]['include']?_[_0xb6fb('0x24')](_0x3128b6['options']['include'],function(_0x56e924){return{'model':db[_0x56e924['model']],'as':_0x56e924['as'],'attributes':_0x56e924[_0xb6fb('0x21')],'include':_0x56e924[_0xb6fb('0x22')]?_[_0xb6fb('0x24')](_0x56e924[_0xb6fb('0x22')],function(_0x31f691){return{'model':db[_0x31f691[_0xb6fb('0x23')]],'as':_0x31f691['as'],'attributes':_0x31f691['attributes'],'include':_0x31f691[_0xb6fb('0x22')]?_[_0xb6fb('0x24')](_0x31f691[_0xb6fb('0x22')],function(_0x3a95ba){return{'model':db[_0x3a95ba[_0xb6fb('0x23')]],'as':_0x3a95ba['as'],'attributes':_0x3a95ba['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x220460){logger[_0xb6fb('0x12')](_0xb6fb('0x27'),_0x3128b6);logger[_0xb6fb('0x14')](_0xb6fb('0x27'),_0x3128b6,JSON[_0xb6fb('0x17')](_0x220460));_0x2b09eb(_0x220460);})[_0xb6fb('0x1b')](function(_0x576044){logger['error'](_0xb6fb('0x27'),_0x576044[_0xb6fb('0x1a')],_0x3128b6);_0x1c974e(_0x10477c[_0xb6fb('0x19')](0x1f4,_0x576044[_0xb6fb('0x1a')]));});});}; \ No newline at end of file +var _0x113b=['moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','redis','localhost','socket.io-emitter','./whatsappQueue.socket','request','then','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','GetWhatsappQueue','WhatsappQueue','options','raw','attributes','limit','include','map','model','catch','ShowWhatsappQueue','find','where','lodash'];(function(_0x127438,_0x5456b7){var _0x588c31=function(_0x1d8451){while(--_0x1d8451){_0x127438['push'](_0x127438['shift']());}};_0x588c31(++_0x5456b7);}(_0x113b,0x93));var _0xb113=function(_0x300fbb,_0x126c68){_0x300fbb=_0x300fbb-0x0;var _0xe923cb=_0x113b[_0x300fbb];return _0xe923cb;};'use strict';var _=require(_0xb113('0x0'));var util=require('util');var moment=require(_0xb113('0x1'));var BPromise=require(_0xb113('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb113('0x3'));var db=require(_0xb113('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xb113('0x5'))(_0xb113('0x6'));var config=require(_0xb113('0x7'));var jayson=require(_0xb113('0x8'));var client=jayson['client']['http']({'port':0x232a});config[_0xb113('0x9')]=_['defaults'](config[_0xb113('0x9')],{'host':_0xb113('0xa'),'port':0x18eb});var socket=require(_0xb113('0xb'))(new Redis(config[_0xb113('0x9')]));require(_0xb113('0xc'))['register'](socket);function respondWithRpcPromise(_0x34e646,_0x17f144,_0x48e23b){return new BPromise(function(_0x88d3f7,_0x5c9163){return client[_0xb113('0xd')](_0x34e646,_0x48e23b)[_0xb113('0xe')](function(_0x4fd48d){logger[_0xb113('0xf')](_0xb113('0x10'),_0x17f144,_0xb113('0x11'));logger[_0xb113('0x12')](_0xb113('0x13'),_0x17f144,_0xb113('0x11'),JSON[_0xb113('0x14')](_0x4fd48d));if(_0x4fd48d[_0xb113('0x15')]){if(_0x4fd48d[_0xb113('0x15')]['code']===0x1f4){logger[_0xb113('0x15')](_0xb113('0x10'),_0x17f144,_0x4fd48d[_0xb113('0x15')][_0xb113('0x16')]);return _0x5c9163(_0x4fd48d[_0xb113('0x15')][_0xb113('0x16')]);}logger['error'](_0xb113('0x10'),_0x17f144,_0x4fd48d[_0xb113('0x15')]['message']);return _0x88d3f7(_0x4fd48d['error'][_0xb113('0x16')]);}else{logger['info'](_0xb113('0x10'),_0x17f144,_0xb113('0x11'));_0x88d3f7(_0x4fd48d[_0xb113('0x17')][_0xb113('0x16')]);}})['catch'](function(_0x4478b5){logger[_0xb113('0x15')](_0xb113('0x10'),_0x17f144,_0x4478b5);_0x5c9163(_0x4478b5);});});}exports[_0xb113('0x18')]=function(_0x5e389a){var _0x3066a9=this;return new Promise(function(_0x4068c4,_0x2b82dd){return db[_0xb113('0x19')]['findAll']({'raw':_0x5e389a[_0xb113('0x1a')]?_0x5e389a['options'][_0xb113('0x1b')]===undefined?!![]:![]:!![],'where':_0x5e389a[_0xb113('0x1a')]?_0x5e389a[_0xb113('0x1a')]['where']||null:null,'attributes':_0x5e389a[_0xb113('0x1a')]?_0x5e389a['options'][_0xb113('0x1c')]||null:null,'limit':_0x5e389a[_0xb113('0x1a')]?_0x5e389a[_0xb113('0x1a')][_0xb113('0x1d')]||null:null,'include':_0x5e389a[_0xb113('0x1a')]?_0x5e389a[_0xb113('0x1a')][_0xb113('0x1e')]?_[_0xb113('0x1f')](_0x5e389a[_0xb113('0x1a')]['include'],function(_0x3d4e6f){return{'model':db[_0x3d4e6f['model']],'as':_0x3d4e6f['as'],'attributes':_0x3d4e6f[_0xb113('0x1c')],'include':_0x3d4e6f[_0xb113('0x1e')]?_[_0xb113('0x1f')](_0x3d4e6f[_0xb113('0x1e')],function(_0x5d9c81){return{'model':db[_0x5d9c81[_0xb113('0x20')]],'as':_0x5d9c81['as'],'attributes':_0x5d9c81[_0xb113('0x1c')],'include':_0x5d9c81[_0xb113('0x1e')]?_[_0xb113('0x1f')](_0x5d9c81['include'],function(_0x4c95c3){return{'model':db[_0x4c95c3['model']],'as':_0x4c95c3['as'],'attributes':_0x4c95c3[_0xb113('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xb113('0xe')](function(_0x5875a8){logger[_0xb113('0xf')]('GetWhatsappQueue',_0x5e389a);logger['debug'](_0xb113('0x18'),_0x5e389a,JSON[_0xb113('0x14')](_0x5875a8));_0x4068c4(_0x5875a8);})[_0xb113('0x21')](function(_0x181f3b){logger[_0xb113('0x15')](_0xb113('0x18'),_0x181f3b[_0xb113('0x16')],_0x5e389a);_0x2b82dd(_0x3066a9['error'](0x1f4,_0x181f3b['message']));});});};exports[_0xb113('0x22')]=function(_0x516691){var _0x5ba967=this;return new Promise(function(_0x55e899,_0x1f3ffc){return db[_0xb113('0x19')][_0xb113('0x23')]({'raw':_0x516691[_0xb113('0x1a')]?_0x516691[_0xb113('0x1a')][_0xb113('0x1b')]===undefined?!![]:![]:!![],'where':_0x516691['options']?_0x516691['options'][_0xb113('0x24')]||null:null,'attributes':_0x516691[_0xb113('0x1a')]?_0x516691[_0xb113('0x1a')]['attributes']||null:null,'include':_0x516691[_0xb113('0x1a')]?_0x516691[_0xb113('0x1a')][_0xb113('0x1e')]?_[_0xb113('0x1f')](_0x516691[_0xb113('0x1a')][_0xb113('0x1e')],function(_0xc10766){return{'model':db[_0xc10766[_0xb113('0x20')]],'as':_0xc10766['as'],'attributes':_0xc10766[_0xb113('0x1c')],'include':_0xc10766[_0xb113('0x1e')]?_[_0xb113('0x1f')](_0xc10766[_0xb113('0x1e')],function(_0x3a157a){return{'model':db[_0x3a157a[_0xb113('0x20')]],'as':_0x3a157a['as'],'attributes':_0x3a157a[_0xb113('0x1c')],'include':_0x3a157a[_0xb113('0x1e')]?_['map'](_0x3a157a[_0xb113('0x1e')],function(_0x218d1){return{'model':db[_0x218d1['model']],'as':_0x218d1['as'],'attributes':_0x218d1[_0xb113('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xb113('0xe')](function(_0x555b13){logger['info'](_0xb113('0x22'),_0x516691);logger[_0xb113('0x12')]('ShowWhatsappQueue',_0x516691,JSON[_0xb113('0x14')](_0x555b13));_0x55e899(_0x555b13);})[_0xb113('0x21')](function(_0xf7ef20){logger['error'](_0xb113('0x22'),_0xf7ef20[_0xb113('0x16')],_0x516691);_0x1f3ffc(_0x5ba967[_0xb113('0x15')](0x1f4,_0xf7ef20[_0xb113('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index be45fff..2e70d89 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 _0x2ea3=['./whatsappQueue.events','save','emit','length','whatsappQueue:'];(function(_0x561473,_0x2de58){var _0xce5446=function(_0x155270){while(--_0x155270){_0x561473['push'](_0x561473['shift']());}};_0xce5446(++_0x2de58);}(_0x2ea3,0x1d1));var _0x32ea=function(_0x5d6fa8,_0x5612d6){_0x5d6fa8=_0x5d6fa8-0x0;var _0x465f7d=_0x2ea3[_0x5d6fa8];return _0x465f7d;};'use strict';var WhatsappQueueEvents=require(_0x32ea('0x0'));var events=[_0x32ea('0x1'),'remove','update'];function createListener(_0x3d6642,_0x3a1c67){return function(_0x181f90){_0x3a1c67[_0x32ea('0x2')](_0x3d6642,_0x181f90);};}function removeListener(_0x222f05,_0x5b581e){return function(){WhatsappQueueEvents['removeListener'](_0x222f05,_0x5b581e);};}exports['register']=function(_0x7698ed){for(var _0xda4157=0x0,_0x874dc1=events[_0x32ea('0x3')];_0xda4157<_0x874dc1;_0xda4157++){var _0x15c74e=events[_0xda4157];var _0x4bba51=createListener(_0x32ea('0x4')+_0x15c74e,_0x7698ed);WhatsappQueueEvents['on'](_0x15c74e,_0x4bba51);}}; \ No newline at end of file +var _0x69a4=['register','length','whatsappQueue:','./whatsappQueue.events','save','remove','emit','removeListener'];(function(_0x76acdc,_0x1f5910){var _0x49aa08=function(_0x131d41){while(--_0x131d41){_0x76acdc['push'](_0x76acdc['shift']());}};_0x49aa08(++_0x1f5910);}(_0x69a4,0x163));var _0x469a=function(_0x362160,_0x5654c8){_0x362160=_0x362160-0x0;var _0xe41be0=_0x69a4[_0x362160];return _0xe41be0;};'use strict';var WhatsappQueueEvents=require(_0x469a('0x0'));var events=[_0x469a('0x1'),_0x469a('0x2'),'update'];function createListener(_0x82ff23,_0x10cb71){return function(_0xc68744){_0x10cb71[_0x469a('0x3')](_0x82ff23,_0xc68744);};}function removeListener(_0x17d478,_0x3e86a0){return function(){WhatsappQueueEvents[_0x469a('0x4')](_0x17d478,_0x3e86a0);};}exports[_0x469a('0x5')]=function(_0x4e3ae3){for(var _0xc88899=0x0,_0x57e141=events[_0x469a('0x6')];_0xc88899<_0x57e141;_0xc88899++){var _0x28471e=events[_0xc88899];var _0x5388e8=createListener(_0x469a('0x7')+_0x28471e,_0x4e3ae3);WhatsappQueueEvents['on'](_0x28471e,_0x5388e8);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index 4b5ca8a..177be60 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 _0xb237=['../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0xf35fd1,_0x2d3ca8){var _0x2dba2d=function(_0x5af2a8){while(--_0x5af2a8){_0xf35fd1['push'](_0xf35fd1['shift']());}};_0x2dba2d(++_0x2d3ca8);}(_0xb237,0x1d5));var _0x7b23=function(_0x17d870,_0x2b8a18){_0x17d870=_0x17d870-0x0;var _0x4dcb4d=_0xb237[_0x17d870];return _0x4dcb4d;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x7b23('0x0'));var timeout=require(_0x7b23('0x1'));var express=require(_0x7b23('0x2'));var router=express[_0x7b23('0x3')]();var fs_extra=require(_0x7b23('0x4'));var auth=require(_0x7b23('0x5'));var interaction=require(_0x7b23('0x6'));var config=require(_0x7b23('0x7'));var controller=require(_0x7b23('0x8'));router[_0x7b23('0x9')]('/',auth['isAuthenticated'](),controller[_0x7b23('0xa')]);router[_0x7b23('0x9')](_0x7b23('0xb'),auth[_0x7b23('0xc')](),controller[_0x7b23('0xd')]);router[_0x7b23('0x9')](_0x7b23('0xe'),auth[_0x7b23('0xc')](),controller[_0x7b23('0xf')]);router[_0x7b23('0x10')]('/',auth[_0x7b23('0xc')](),controller['create']);router['put']('/:id',auth[_0x7b23('0xc')](),controller['update']);router['delete'](_0x7b23('0xe'),auth[_0x7b23('0xc')](),controller[_0x7b23('0x11')]);module[_0x7b23('0x12')]=router; \ No newline at end of file +var _0xb3fd=['create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post'];(function(_0x14e157,_0xdbc918){var _0x55cbc5=function(_0x359cb4){while(--_0x359cb4){_0x14e157['push'](_0x14e157['shift']());}};_0x55cbc5(++_0xdbc918);}(_0xb3fd,0xc6));var _0xdb3f=function(_0x59bf45,_0x29533a){_0x59bf45=_0x59bf45-0x0;var _0x5d7e9f=_0xb3fd[_0x59bf45];return _0x5d7e9f;};'use strict';var multer=require(_0xdb3f('0x0'));var util=require(_0xdb3f('0x1'));var path=require('path');var timeout=require(_0xdb3f('0x2'));var express=require(_0xdb3f('0x3'));var router=express[_0xdb3f('0x4')]();var fs_extra=require(_0xdb3f('0x5'));var auth=require(_0xdb3f('0x6'));var interaction=require(_0xdb3f('0x7'));var config=require(_0xdb3f('0x8'));var controller=require(_0xdb3f('0x9'));router[_0xdb3f('0xa')]('/',auth[_0xdb3f('0xb')](),controller[_0xdb3f('0xc')]);router['get'](_0xdb3f('0xd'),auth['isAuthenticated'](),controller[_0xdb3f('0xe')]);router['get'](_0xdb3f('0xf'),auth[_0xdb3f('0xb')](),controller[_0xdb3f('0x10')]);router[_0xdb3f('0x11')]('/',auth['isAuthenticated'](),controller[_0xdb3f('0x12')]);router[_0xdb3f('0x13')](_0xdb3f('0xf'),auth['isAuthenticated'](),controller[_0xdb3f('0x14')]);router[_0xdb3f('0x15')](_0xdb3f('0xf'),auth[_0xdb3f('0xb')](),controller[_0xdb3f('0x16')]);module[_0xdb3f('0x17')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index 1c28d8b..c35a583 100644 --- a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js +++ b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['exports','STRING','DATE','sequelize'];(function(_0x25a227,_0x31b7ea){var _0x530206=function(_0x322ea3){while(--_0x322ea3){_0x25a227['push'](_0x25a227['shift']());}};_0x530206(++_0x31b7ea);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'uniqueid':{'type':Sequelize[_0x7995('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x7995('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x7995('0x3')]},'acceptAt':{'type':Sequelize[_0x7995('0x3')]},'exitAt':{'type':Sequelize[_0x7995('0x3')]},'reason':{'type':Sequelize[_0x7995('0x2')]}}; \ No newline at end of file +var _0x7a54=['STRING','DATE','sequelize','exports'];(function(_0x44f812,_0xa458ab){var _0x1cc4a0=function(_0x46504f){while(--_0x46504f){_0x44f812['push'](_0x44f812['shift']());}};_0x1cc4a0(++_0xa458ab);}(_0x7a54,0x106));var _0x47a5=function(_0x3111b7,_0x43470f){_0x3111b7=_0x3111b7-0x0;var _0x82ed05=_0x7a54[_0x3111b7];return _0x82ed05;};'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 00b4c29..19b2939 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 _0xfff0=['length','include','body','find','describe','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','filter','options','WhatsappQueueReport','includeAll','findAll','catch','params'];(function(_0xa1de8d,_0x1399a8){var _0x478b44=function(_0x3c8db7){while(--_0x3c8db7){_0xa1de8d['push'](_0xa1de8d['shift']());}};_0x478b44(++_0x1399a8);}(_0xfff0,0x139));var _0x0fff=function(_0x13bd63,_0x33a84a){_0x13bd63=_0x13bd63-0x0;var _0x11c5e8=_0xfff0[_0x13bd63];return _0x11c5e8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0fff('0x0'));var zipdir=require(_0x0fff('0x1'));var jsonpatch=require(_0x0fff('0x2'));var rp=require('request-promise');var moment=require(_0x0fff('0x3'));var BPromise=require(_0x0fff('0x4'));var Mustache=require(_0x0fff('0x5'));var util=require('util');var path=require(_0x0fff('0x6'));var sox=require(_0x0fff('0x7'));var csv=require('to-csv');var ejs=require(_0x0fff('0x8'));var fs=require('fs');var fs_extra=require(_0x0fff('0x9'));var _=require(_0x0fff('0xa'));var squel=require('squel');var crypto=require(_0x0fff('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x0fff('0xc'));var toCsv=require('to-csv');var querystring=require(_0x0fff('0xd'));var Papa=require(_0x0fff('0xe'));var Redis=require('ioredis');var authService=require(_0x0fff('0xf'));var qs=require(_0x0fff('0x10'));var as=require(_0x0fff('0x11'));var hardwareService=require(_0x0fff('0x12'));var logger=require(_0x0fff('0x13'))(_0x0fff('0x14'));var utils=require(_0x0fff('0x15'));var config=require(_0x0fff('0x16'));var licenseUtil=require(_0x0fff('0x17'));var db=require(_0x0fff('0x18'))['db'];function respondWithStatusCode(_0x13f768,_0x5abecd){_0x5abecd=_0x5abecd||0xcc;return function(_0x1fb243){if(_0x1fb243){return _0x13f768['sendStatus'](_0x5abecd);}return _0x13f768[_0x0fff('0x19')](_0x5abecd)[_0x0fff('0x1a')]();};}function respondWithResult(_0x38fc82,_0x2c0322){_0x2c0322=_0x2c0322||0xc8;return function(_0x55e5fa){if(_0x55e5fa){return _0x38fc82['status'](_0x2c0322)[_0x0fff('0x1b')](_0x55e5fa);}};}function respondWithFilteredResult(_0x50a9e4,_0x5636fd){return function(_0x51ceea){if(_0x51ceea){var _0x1fb430=typeof _0x5636fd[_0x0fff('0x1c')]==='undefined'&&typeof _0x5636fd[_0x0fff('0x1d')]===_0x0fff('0x1e');var _0x540a67=_0x51ceea['count'];var _0x48f36d=_0x1fb430?0x0:_0x5636fd[_0x0fff('0x1c')];var _0x606792=_0x1fb430?_0x51ceea[_0x0fff('0x1f')]:_0x5636fd[_0x0fff('0x1c')]+_0x5636fd[_0x0fff('0x1d')];var _0xe89b4a;if(_0x606792>=_0x540a67){_0x606792=_0x540a67;_0xe89b4a=0xc8;}else{_0xe89b4a=0xce;}_0x50a9e4['status'](_0xe89b4a);return _0x50a9e4[_0x0fff('0x20')](_0x0fff('0x21'),_0x48f36d+'-'+_0x606792+'/'+_0x540a67)[_0x0fff('0x1b')](_0x51ceea);}return null;};}function patchUpdates(_0x49d211){return function(_0x5e27df){try{jsonpatch[_0x0fff('0x22')](_0x5e27df,_0x49d211,!![]);}catch(_0x330e29){return BPromise[_0x0fff('0x23')](_0x330e29);}return _0x5e27df[_0x0fff('0x24')]();};}function saveUpdates(_0x502393,_0x155132){return function(_0x2f8665){if(_0x2f8665){return _0x2f8665[_0x0fff('0x25')](_0x502393)[_0x0fff('0x26')](function(_0x16e7f4){return _0x16e7f4;});}return null;};}function removeEntity(_0x17fba6,_0x580b8e){return function(_0x6a116c){if(_0x6a116c){return _0x6a116c[_0x0fff('0x27')]()[_0x0fff('0x26')](function(){_0x17fba6[_0x0fff('0x19')](0xcc)[_0x0fff('0x1a')]();});}};}function handleEntityNotFound(_0x23d9f8,_0x482e1e){return function(_0x2c9725){if(!_0x2c9725){_0x23d9f8[_0x0fff('0x28')](0x194);}return _0x2c9725;};}function handleError(_0x2d1610,_0x440f56){_0x440f56=_0x440f56||0x1f4;return function(_0x36d268){logger[_0x0fff('0x29')](_0x36d268[_0x0fff('0x2a')]);if(_0x36d268[_0x0fff('0x2b')]){delete _0x36d268[_0x0fff('0x2b')];}_0x2d1610[_0x0fff('0x19')](_0x440f56)[_0x0fff('0x2c')](_0x36d268);};}exports[_0x0fff('0x2d')]=function(_0x495734,_0x7046a3){var _0x2d1800={},_0x17ab6f={},_0x42441e={'count':0x0,'rows':[]};var _0x1f643d=_[_0x0fff('0x2e')](db['WhatsappQueueReport'][_0x0fff('0x2f')],function(_0xa16c29){return{'name':_0xa16c29[_0x0fff('0x30')],'type':_0xa16c29['type'][_0x0fff('0x31')]};});_0x17ab6f[_0x0fff('0x32')]=_['map'](_0x1f643d,_0x0fff('0x2b'));_0x17ab6f[_0x0fff('0x33')]=_[_0x0fff('0x34')](_0x495734[_0x0fff('0x33')]);_0x17ab6f[_0x0fff('0x35')]=_[_0x0fff('0x36')](_0x17ab6f[_0x0fff('0x32')],_0x17ab6f[_0x0fff('0x33')]);_0x2d1800[_0x0fff('0x37')]=_[_0x0fff('0x36')](_0x17ab6f['model'],qs[_0x0fff('0x38')](_0x495734[_0x0fff('0x33')][_0x0fff('0x38')]));_0x2d1800[_0x0fff('0x37')]=_0x2d1800[_0x0fff('0x37')]['length']?_0x2d1800['attributes']:_0x17ab6f[_0x0fff('0x32')];if(!_0x495734[_0x0fff('0x33')][_0x0fff('0x39')](_0x0fff('0x3a'))){_0x2d1800['limit']=qs[_0x0fff('0x1d')](_0x495734[_0x0fff('0x33')][_0x0fff('0x1d')]);_0x2d1800[_0x0fff('0x1c')]=qs['offset'](_0x495734[_0x0fff('0x33')][_0x0fff('0x1c')]);}_0x2d1800[_0x0fff('0x3b')]=qs[_0x0fff('0x3c')](_0x495734[_0x0fff('0x33')][_0x0fff('0x3c')]);_0x2d1800[_0x0fff('0x3d')]=qs[_0x0fff('0x35')](_[_0x0fff('0x3e')](_0x495734[_0x0fff('0x33')],_0x17ab6f[_0x0fff('0x35')]),_0x1f643d);if(_0x495734[_0x0fff('0x33')]['filter']){_0x2d1800[_0x0fff('0x3d')]=_[_0x0fff('0x3f')](_0x2d1800[_0x0fff('0x3d')],{'$or':_[_0x0fff('0x2e')](_0x1f643d,function(_0xd65638){if(_0xd65638[_0x0fff('0x40')]!=='VIRTUAL'){var _0x10ff9d={};_0x10ff9d[_0xd65638[_0x0fff('0x2b')]]={'$like':'%'+_0x495734[_0x0fff('0x33')][_0x0fff('0x41')]+'%'};return _0x10ff9d;}})});}_0x2d1800=_[_0x0fff('0x3f')]({},_0x2d1800,_0x495734[_0x0fff('0x42')]);var _0x3dc0b8={'where':_0x2d1800[_0x0fff('0x3d')]};return db[_0x0fff('0x43')]['count'](_0x3dc0b8)[_0x0fff('0x26')](function(_0x4d89c0){_0x42441e[_0x0fff('0x1f')]=_0x4d89c0;if(_0x495734[_0x0fff('0x33')][_0x0fff('0x44')]){_0x2d1800['include']=[{'all':!![]}];}return db['WhatsappQueueReport'][_0x0fff('0x45')](_0x2d1800);})[_0x0fff('0x26')](function(_0x311348){_0x42441e['rows']=_0x311348;return _0x42441e;})['then'](respondWithFilteredResult(_0x7046a3,_0x2d1800))[_0x0fff('0x46')](handleError(_0x7046a3,null));};exports['show']=function(_0xd6ebeb,_0x957265){var _0x8352c1={'raw':!![],'where':{'id':_0xd6ebeb[_0x0fff('0x47')]['id']}},_0x309d75={};_0x309d75[_0x0fff('0x32')]=_['keys'](db[_0x0fff('0x43')][_0x0fff('0x2f')]);_0x309d75[_0x0fff('0x33')]=_[_0x0fff('0x34')](_0xd6ebeb[_0x0fff('0x33')]);_0x309d75[_0x0fff('0x35')]=_[_0x0fff('0x36')](_0x309d75['model'],_0x309d75[_0x0fff('0x33')]);_0x8352c1[_0x0fff('0x37')]=_[_0x0fff('0x36')](_0x309d75['model'],qs[_0x0fff('0x38')](_0xd6ebeb[_0x0fff('0x33')][_0x0fff('0x38')]));_0x8352c1[_0x0fff('0x37')]=_0x8352c1[_0x0fff('0x37')][_0x0fff('0x48')]?_0x8352c1[_0x0fff('0x37')]:_0x309d75[_0x0fff('0x32')];if(_0xd6ebeb[_0x0fff('0x33')][_0x0fff('0x44')]){_0x8352c1[_0x0fff('0x49')]=[{'all':!![]}];}_0x8352c1=_['merge']({},_0x8352c1,_0xd6ebeb[_0x0fff('0x42')]);return db[_0x0fff('0x43')]['find'](_0x8352c1)[_0x0fff('0x26')](handleEntityNotFound(_0x957265,null))[_0x0fff('0x26')](respondWithResult(_0x957265,null))[_0x0fff('0x46')](handleError(_0x957265,null));};exports['create']=function(_0x502037,_0x2a0b10){return db['WhatsappQueueReport']['create'](_0x502037[_0x0fff('0x4a')],{})[_0x0fff('0x26')](respondWithResult(_0x2a0b10,0xc9))[_0x0fff('0x46')](handleError(_0x2a0b10,null));};exports[_0x0fff('0x25')]=function(_0x3b4b8e,_0x1a7677){if(_0x3b4b8e['body']['id']){delete _0x3b4b8e[_0x0fff('0x4a')]['id'];}return db[_0x0fff('0x43')][_0x0fff('0x4b')]({'where':{'id':_0x3b4b8e[_0x0fff('0x47')]['id']}})[_0x0fff('0x26')](handleEntityNotFound(_0x1a7677,null))[_0x0fff('0x26')](saveUpdates(_0x3b4b8e['body'],null))[_0x0fff('0x26')](respondWithResult(_0x1a7677,null))[_0x0fff('0x46')](handleError(_0x1a7677,null));};exports['destroy']=function(_0x1fc872,_0x4bae35){return db['WhatsappQueueReport']['find']({'where':{'id':_0x1fc872[_0x0fff('0x47')]['id']}})[_0x0fff('0x26')](handleEntityNotFound(_0x4bae35,null))[_0x0fff('0x26')](removeEntity(_0x4bae35,null))[_0x0fff('0x46')](handleError(_0x4bae35,null));};exports[_0x0fff('0x4c')]=function(_0x4bf98d,_0x2524ad){return db[_0x0fff('0x43')][_0x0fff('0x4c')]()[_0x0fff('0x26')](respondWithResult(_0x2524ad,null))[_0x0fff('0x46')](handleError(_0x2524ad,null));}; \ No newline at end of file +var _0xf4f4=['crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','end','sendStatus','error','stack','name','send','index','map','WhatsappQueueReport','fieldName','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','rawAttributes','length','find','create','body','params','destroy','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel'];(function(_0x1afeb1,_0x4ef5e7){var _0x397155=function(_0x1c040b){while(--_0x1c040b){_0x1afeb1['push'](_0x1afeb1['shift']());}};_0x397155(++_0x4ef5e7);}(_0xf4f4,0xe3));var _0x4f4f=function(_0x182ccb,_0x2c0bba){_0x182ccb=_0x182ccb-0x0;var _0x51b581=_0xf4f4[_0x182ccb];return _0x51b581;};'use strict';var emlformat=require(_0x4f4f('0x0'));var rimraf=require(_0x4f4f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4f4f('0x2'));var rp=require(_0x4f4f('0x3'));var moment=require(_0x4f4f('0x4'));var BPromise=require(_0x4f4f('0x5'));var Mustache=require(_0x4f4f('0x6'));var util=require('util');var path=require(_0x4f4f('0x7'));var sox=require('sox');var csv=require(_0x4f4f('0x8'));var ejs=require(_0x4f4f('0x9'));var fs=require('fs');var fs_extra=require(_0x4f4f('0xa'));var _=require(_0x4f4f('0xb'));var squel=require(_0x4f4f('0xc'));var crypto=require(_0x4f4f('0xd'));var jsforce=require(_0x4f4f('0xe'));var deskjs=require(_0x4f4f('0xf'));var toCsv=require('to-csv');var querystring=require(_0x4f4f('0x10'));var Papa=require(_0x4f4f('0x11'));var Redis=require(_0x4f4f('0x12'));var authService=require(_0x4f4f('0x13'));var qs=require(_0x4f4f('0x14'));var as=require(_0x4f4f('0x15'));var hardwareService=require(_0x4f4f('0x16'));var logger=require(_0x4f4f('0x17'))('api');var utils=require('../../config/utils');var config=require(_0x4f4f('0x18'));var licenseUtil=require(_0x4f4f('0x19'));var db=require(_0x4f4f('0x1a'))['db'];function respondWithStatusCode(_0x1b54b0,_0x282031){_0x282031=_0x282031||0xcc;return function(_0x1d7575){if(_0x1d7575){return _0x1b54b0['sendStatus'](_0x282031);}return _0x1b54b0[_0x4f4f('0x1b')](_0x282031)['end']();};}function respondWithResult(_0x216ba8,_0xe7c2d5){_0xe7c2d5=_0xe7c2d5||0xc8;return function(_0x3e16e9){if(_0x3e16e9){return _0x216ba8[_0x4f4f('0x1b')](_0xe7c2d5)['json'](_0x3e16e9);}};}function respondWithFilteredResult(_0x19f2fd,_0x4c68f4){return function(_0x47ab66){if(_0x47ab66){var _0x58de77=typeof _0x4c68f4[_0x4f4f('0x1c')]===_0x4f4f('0x1d')&&typeof _0x4c68f4[_0x4f4f('0x1e')]===_0x4f4f('0x1d');var _0x2d5e5d=_0x47ab66[_0x4f4f('0x1f')];var _0x1245c4=_0x58de77?0x0:_0x4c68f4[_0x4f4f('0x1c')];var _0x929a0b=_0x58de77?_0x47ab66[_0x4f4f('0x1f')]:_0x4c68f4[_0x4f4f('0x1c')]+_0x4c68f4[_0x4f4f('0x1e')];var _0x499277;if(_0x929a0b>=_0x2d5e5d){_0x929a0b=_0x2d5e5d;_0x499277=0xc8;}else{_0x499277=0xce;}_0x19f2fd[_0x4f4f('0x1b')](_0x499277);return _0x19f2fd[_0x4f4f('0x20')](_0x4f4f('0x21'),_0x1245c4+'-'+_0x929a0b+'/'+_0x2d5e5d)[_0x4f4f('0x22')](_0x47ab66);}return null;};}function patchUpdates(_0x302a79){return function(_0x460b4d){try{jsonpatch[_0x4f4f('0x23')](_0x460b4d,_0x302a79,!![]);}catch(_0x3e33d5){return BPromise[_0x4f4f('0x24')](_0x3e33d5);}return _0x460b4d[_0x4f4f('0x25')]();};}function saveUpdates(_0x469a1d,_0x17832f){return function(_0x17984d){if(_0x17984d){return _0x17984d[_0x4f4f('0x26')](_0x469a1d)['then'](function(_0x4f7261){return _0x4f7261;});}return null;};}function removeEntity(_0x525529,_0x272125){return function(_0x43e661){if(_0x43e661){return _0x43e661['destroy']()[_0x4f4f('0x27')](function(){_0x525529[_0x4f4f('0x1b')](0xcc)[_0x4f4f('0x28')]();});}};}function handleEntityNotFound(_0x2ec92a,_0x113ff7){return function(_0x31b30e){if(!_0x31b30e){_0x2ec92a[_0x4f4f('0x29')](0x194);}return _0x31b30e;};}function handleError(_0x50a8ce,_0x39fb9f){_0x39fb9f=_0x39fb9f||0x1f4;return function(_0x237cf9){logger[_0x4f4f('0x2a')](_0x237cf9[_0x4f4f('0x2b')]);if(_0x237cf9[_0x4f4f('0x2c')]){delete _0x237cf9['name'];}_0x50a8ce[_0x4f4f('0x1b')](_0x39fb9f)[_0x4f4f('0x2d')](_0x237cf9);};}exports[_0x4f4f('0x2e')]=function(_0x5deda9,_0x534075){var _0x4c2490={},_0x73b8bb={},_0x5b4f6a={'count':0x0,'rows':[]};var _0x354266=_[_0x4f4f('0x2f')](db[_0x4f4f('0x30')]['rawAttributes'],function(_0x460546){return{'name':_0x460546[_0x4f4f('0x31')],'type':_0x460546['type'][_0x4f4f('0x32')]};});_0x73b8bb[_0x4f4f('0x33')]=_[_0x4f4f('0x2f')](_0x354266,'name');_0x73b8bb[_0x4f4f('0x34')]=_[_0x4f4f('0x35')](_0x5deda9['query']);_0x73b8bb['filters']=_[_0x4f4f('0x36')](_0x73b8bb[_0x4f4f('0x33')],_0x73b8bb[_0x4f4f('0x34')]);_0x4c2490[_0x4f4f('0x37')]=_[_0x4f4f('0x36')](_0x73b8bb[_0x4f4f('0x33')],qs[_0x4f4f('0x38')](_0x5deda9[_0x4f4f('0x34')][_0x4f4f('0x38')]));_0x4c2490[_0x4f4f('0x37')]=_0x4c2490['attributes']['length']?_0x4c2490[_0x4f4f('0x37')]:_0x73b8bb['model'];if(!_0x5deda9[_0x4f4f('0x34')][_0x4f4f('0x39')](_0x4f4f('0x3a'))){_0x4c2490[_0x4f4f('0x1e')]=qs[_0x4f4f('0x1e')](_0x5deda9[_0x4f4f('0x34')][_0x4f4f('0x1e')]);_0x4c2490[_0x4f4f('0x1c')]=qs[_0x4f4f('0x1c')](_0x5deda9[_0x4f4f('0x34')][_0x4f4f('0x1c')]);}_0x4c2490[_0x4f4f('0x3b')]=qs['sort'](_0x5deda9[_0x4f4f('0x34')][_0x4f4f('0x3c')]);_0x4c2490[_0x4f4f('0x3d')]=qs[_0x4f4f('0x3e')](_[_0x4f4f('0x3f')](_0x5deda9[_0x4f4f('0x34')],_0x73b8bb[_0x4f4f('0x3e')]),_0x354266);if(_0x5deda9[_0x4f4f('0x34')][_0x4f4f('0x40')]){_0x4c2490['where']=_[_0x4f4f('0x41')](_0x4c2490[_0x4f4f('0x3d')],{'$or':_[_0x4f4f('0x2f')](_0x354266,function(_0x5eb174){if(_0x5eb174['type']!==_0x4f4f('0x42')){var _0x95a296={};_0x95a296[_0x5eb174[_0x4f4f('0x2c')]]={'$like':'%'+_0x5deda9[_0x4f4f('0x34')][_0x4f4f('0x40')]+'%'};return _0x95a296;}})});}_0x4c2490=_[_0x4f4f('0x41')]({},_0x4c2490,_0x5deda9[_0x4f4f('0x43')]);var _0x1ff7f3={'where':_0x4c2490[_0x4f4f('0x3d')]};return db[_0x4f4f('0x30')][_0x4f4f('0x1f')](_0x1ff7f3)[_0x4f4f('0x27')](function(_0x4e352e){_0x5b4f6a[_0x4f4f('0x1f')]=_0x4e352e;if(_0x5deda9[_0x4f4f('0x34')][_0x4f4f('0x44')]){_0x4c2490[_0x4f4f('0x45')]=[{'all':!![]}];}return db[_0x4f4f('0x30')]['findAll'](_0x4c2490);})['then'](function(_0x134710){_0x5b4f6a[_0x4f4f('0x46')]=_0x134710;return _0x5b4f6a;})[_0x4f4f('0x27')](respondWithFilteredResult(_0x534075,_0x4c2490))[_0x4f4f('0x47')](handleError(_0x534075,null));};exports['show']=function(_0x1aaf2c,_0x480919){var _0x10de24={'raw':!![],'where':{'id':_0x1aaf2c['params']['id']}},_0x5a7c94={};_0x5a7c94[_0x4f4f('0x33')]=_['keys'](db[_0x4f4f('0x30')][_0x4f4f('0x48')]);_0x5a7c94['query']=_[_0x4f4f('0x35')](_0x1aaf2c[_0x4f4f('0x34')]);_0x5a7c94['filters']=_[_0x4f4f('0x36')](_0x5a7c94[_0x4f4f('0x33')],_0x5a7c94[_0x4f4f('0x34')]);_0x10de24[_0x4f4f('0x37')]=_[_0x4f4f('0x36')](_0x5a7c94[_0x4f4f('0x33')],qs[_0x4f4f('0x38')](_0x1aaf2c[_0x4f4f('0x34')][_0x4f4f('0x38')]));_0x10de24[_0x4f4f('0x37')]=_0x10de24[_0x4f4f('0x37')][_0x4f4f('0x49')]?_0x10de24[_0x4f4f('0x37')]:_0x5a7c94[_0x4f4f('0x33')];if(_0x1aaf2c[_0x4f4f('0x34')]['includeAll']){_0x10de24[_0x4f4f('0x45')]=[{'all':!![]}];}_0x10de24=_['merge']({},_0x10de24,_0x1aaf2c['options']);return db[_0x4f4f('0x30')][_0x4f4f('0x4a')](_0x10de24)['then'](handleEntityNotFound(_0x480919,null))[_0x4f4f('0x27')](respondWithResult(_0x480919,null))[_0x4f4f('0x47')](handleError(_0x480919,null));};exports[_0x4f4f('0x4b')]=function(_0x2721b5,_0x222511){return db['WhatsappQueueReport'][_0x4f4f('0x4b')](_0x2721b5[_0x4f4f('0x4c')],{})[_0x4f4f('0x27')](respondWithResult(_0x222511,0xc9))[_0x4f4f('0x47')](handleError(_0x222511,null));};exports[_0x4f4f('0x26')]=function(_0x433787,_0x29314b){if(_0x433787[_0x4f4f('0x4c')]['id']){delete _0x433787[_0x4f4f('0x4c')]['id'];}return db['WhatsappQueueReport'][_0x4f4f('0x4a')]({'where':{'id':_0x433787[_0x4f4f('0x4d')]['id']}})['then'](handleEntityNotFound(_0x29314b,null))['then'](saveUpdates(_0x433787['body'],null))[_0x4f4f('0x27')](respondWithResult(_0x29314b,null))[_0x4f4f('0x47')](handleError(_0x29314b,null));};exports[_0x4f4f('0x4e')]=function(_0x5c5077,_0x389ec6){return db['WhatsappQueueReport'][_0x4f4f('0x4a')]({'where':{'id':_0x5c5077[_0x4f4f('0x4d')]['id']}})[_0x4f4f('0x27')](handleEntityNotFound(_0x389ec6,null))[_0x4f4f('0x27')](removeEntity(_0x389ec6,null))[_0x4f4f('0x47')](handleError(_0x389ec6,null));};exports[_0x4f4f('0x4f')]=function(_0x21408b,_0x88054a){return db[_0x4f4f('0x30')]['describe']()['then'](respondWithResult(_0x88054a,null))[_0x4f4f('0x47')](handleError(_0x88054a,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index c2851c7..fc36adc 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 _0x692a=['request-promise','path','rimraf','../../config/environment','./whatsappQueueReport.attributes','report_whatsapp_queue','lodash','util','api','bluebird'];(function(_0x5b216b,_0x17fd85){var _0x591848=function(_0x1152ba){while(--_0x1152ba){_0x5b216b['push'](_0x5b216b['shift']());}};_0x591848(++_0x17fd85);}(_0x692a,0x11e));var _0xa692=function(_0x3f57d6,_0x45b6ee){_0x3f57d6=_0x3f57d6-0x0;var _0x3b2054=_0x692a[_0x3f57d6];return _0x3b2054;};'use strict';var _=require(_0xa692('0x0'));var util=require(_0xa692('0x1'));var logger=require('../../config/logger')(_0xa692('0x2'));var moment=require('moment');var BPromise=require(_0xa692('0x3'));var rp=require(_0xa692('0x4'));var fs=require('fs');var path=require(_0xa692('0x5'));var rimraf=require(_0xa692('0x6'));var config=require(_0xa692('0x7'));var attributes=require(_0xa692('0x8'));module['exports']=function(_0x2c7440,_0x13bc51){return _0x2c7440['define']('WhatsappQueueReport',attributes,{'tableName':_0xa692('0x9'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x460e=['path','../../config/environment','./whatsappQueueReport.attributes','define','WhatsappQueueReport','uniqueid','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x1b6bf1,_0x12a1d4){var _0x4911a5=function(_0x3605a8){while(--_0x3605a8){_0x1b6bf1['push'](_0x1b6bf1['shift']());}};_0x4911a5(++_0x12a1d4);}(_0x460e,0x96));var _0xe460=function(_0x34a8c8,_0x31e259){_0x34a8c8=_0x34a8c8-0x0;var _0x1fe6e5=_0x460e[_0x34a8c8];return _0x1fe6e5;};'use strict';var _=require(_0xe460('0x0'));var util=require(_0xe460('0x1'));var logger=require(_0xe460('0x2'))('api');var moment=require(_0xe460('0x3'));var BPromise=require(_0xe460('0x4'));var rp=require(_0xe460('0x5'));var fs=require('fs');var path=require(_0xe460('0x6'));var rimraf=require('rimraf');var config=require(_0xe460('0x7'));var attributes=require(_0xe460('0x8'));module['exports']=function(_0x13cbd8,_0x3421c9){return _0x13cbd8[_0xe460('0x9')](_0xe460('0xa'),attributes,{'tableName':'report_whatsapp_queue','paranoid':![],'indexes':[{'name':_0xe460('0xb'),'fields':[_0xe460('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index 16650cf..953fb64 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 _0xebfc=['rpc','jayson/promise','client','http','request','request\x20sent','debug','stringify','error','code','WhatsappQueueReport,\x20%s,\x20%s','message','info','result','catch','CreateWhatsappQueueReport','WhatsappQueueReport','create','body','options','then','update','where','attributes','limit','UpdateWhatsappQueueReport','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x55af95,_0x4c0dd6){var _0x397e00=function(_0x31ce84){while(--_0x31ce84){_0x55af95['push'](_0x55af95['shift']());}};_0x397e00(++_0x4c0dd6);}(_0xebfc,0xbf));var _0xcebf=function(_0x57d13b,_0x52d8cb){_0x57d13b=_0x57d13b-0x0;var _0x467696=_0xebfc[_0x57d13b];return _0x467696;};'use strict';var _=require(_0xcebf('0x0'));var util=require(_0xcebf('0x1'));var moment=require('moment');var BPromise=require(_0xcebf('0x2'));var rs=require(_0xcebf('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcebf('0x4'))['db'];var utils=require(_0xcebf('0x5'));var logger=require(_0xcebf('0x6'))(_0xcebf('0x7'));var config=require('../../config/environment');var jayson=require(_0xcebf('0x8'));var client=jayson[_0xcebf('0x9')][_0xcebf('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x10d0e1,_0x1c6434,_0x4774d8){return new BPromise(function(_0x4fe9f7,_0x8d5697){return client[_0xcebf('0xb')](_0x10d0e1,_0x4774d8)['then'](function(_0x35fe9a){logger['info']('WhatsappQueueReport,\x20%s,\x20%s',_0x1c6434,_0xcebf('0xc'));logger[_0xcebf('0xd')]('WhatsappQueueReport,\x20%s,\x20%s,\x20%s',_0x1c6434,_0xcebf('0xc'),JSON[_0xcebf('0xe')](_0x35fe9a));if(_0x35fe9a[_0xcebf('0xf')]){if(_0x35fe9a[_0xcebf('0xf')][_0xcebf('0x10')]===0x1f4){logger[_0xcebf('0xf')](_0xcebf('0x11'),_0x1c6434,_0x35fe9a['error'][_0xcebf('0x12')]);return _0x8d5697(_0x35fe9a['error']['message']);}logger[_0xcebf('0xf')](_0xcebf('0x11'),_0x1c6434,_0x35fe9a[_0xcebf('0xf')][_0xcebf('0x12')]);return _0x4fe9f7(_0x35fe9a[_0xcebf('0xf')][_0xcebf('0x12')]);}else{logger[_0xcebf('0x13')](_0xcebf('0x11'),_0x1c6434,_0xcebf('0xc'));_0x4fe9f7(_0x35fe9a[_0xcebf('0x14')][_0xcebf('0x12')]);}})[_0xcebf('0x15')](function(_0x25ecd1){logger[_0xcebf('0xf')](_0xcebf('0x11'),_0x1c6434,_0x25ecd1);_0x8d5697(_0x25ecd1);});});}exports[_0xcebf('0x16')]=function(_0x2cd9a9){var _0x509aa1=this;return new Promise(function(_0x4d6936,_0x2b743a){return db[_0xcebf('0x17')][_0xcebf('0x18')](_0x2cd9a9[_0xcebf('0x19')],{'raw':_0x2cd9a9[_0xcebf('0x1a')]?_0x2cd9a9[_0xcebf('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0xcebf('0x1b')](function(_0x44295b){logger[_0xcebf('0x13')](_0xcebf('0x16'),_0x2cd9a9);logger['debug'](_0xcebf('0x16'),_0x2cd9a9,JSON[_0xcebf('0xe')](_0x44295b));_0x4d6936(_0x44295b);})['catch'](function(_0x22c294){logger[_0xcebf('0xf')](_0xcebf('0x16'),_0x22c294[_0xcebf('0x12')],_0x2cd9a9);_0x2b743a(_0x509aa1[_0xcebf('0xf')](0x1f4,_0x22c294[_0xcebf('0x12')]));});});};exports['UpdateWhatsappQueueReport']=function(_0x71aede){var _0x52c6f7=this;return new Promise(function(_0x27c5bc,_0x82be68){return db[_0xcebf('0x17')][_0xcebf('0x1c')](_0x71aede[_0xcebf('0x19')],{'raw':_0x71aede[_0xcebf('0x1a')]?_0x71aede[_0xcebf('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x71aede[_0xcebf('0x1a')]?_0x71aede[_0xcebf('0x1a')][_0xcebf('0x1d')]||null:null,'attributes':_0x71aede[_0xcebf('0x1a')]?_0x71aede['options'][_0xcebf('0x1e')]||null:null,'limit':_0x71aede['options']?_0x71aede[_0xcebf('0x1a')][_0xcebf('0x1f')]||null:null})[_0xcebf('0x1b')](function(_0x5ae503){logger[_0xcebf('0x13')]('UpdateWhatsappQueueReport',_0x71aede);logger[_0xcebf('0xd')](_0xcebf('0x20'),_0x71aede,JSON[_0xcebf('0xe')](_0x5ae503));_0x27c5bc(_0x5ae503);})['catch'](function(_0x2e1fd5){logger[_0xcebf('0xf')](_0xcebf('0x20'),_0x2e1fd5[_0xcebf('0x12')],_0x71aede);_0x82be68(_0x52c6f7[_0xcebf('0xf')](0x1f4,_0x2e1fd5['message']));});});}; \ No newline at end of file +var _0xe5e4=['http','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateWhatsappQueueReport','WhatsappQueueReport','create','body','options','raw','debug','catch','where','attributes','limit','info','UpdateWhatsappQueueReport','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','jayson/promise','client'];(function(_0x1504b5,_0x1b1d18){var _0x36a608=function(_0x2fc652){while(--_0x2fc652){_0x1504b5['push'](_0x1504b5['shift']());}};_0x36a608(++_0x1b1d18);}(_0xe5e4,0x1c8));var _0x4e5e=function(_0x5cee97,_0x49448b){_0x5cee97=_0x5cee97-0x0;var _0x4e52e2=_0xe5e4[_0x5cee97];return _0x4e52e2;};'use strict';var _=require(_0x4e5e('0x0'));var util=require(_0x4e5e('0x1'));var moment=require(_0x4e5e('0x2'));var BPromise=require(_0x4e5e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4e5e('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x4e5e('0x5'))(_0x4e5e('0x6'));var config=require('../../config/environment');var jayson=require(_0x4e5e('0x7'));var client=jayson[_0x4e5e('0x8')][_0x4e5e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3c9262,_0x31eb88,_0x5db6e1){return new BPromise(function(_0x37507b,_0x45b8d2){return client['request'](_0x3c9262,_0x5db6e1)['then'](function(_0x125fe3){logger['info'](_0x4e5e('0xa'),_0x31eb88,_0x4e5e('0xb'));logger['debug'](_0x4e5e('0xc'),_0x31eb88,_0x4e5e('0xb'),JSON[_0x4e5e('0xd')](_0x125fe3));if(_0x125fe3[_0x4e5e('0xe')]){if(_0x125fe3[_0x4e5e('0xe')][_0x4e5e('0xf')]===0x1f4){logger[_0x4e5e('0xe')](_0x4e5e('0xa'),_0x31eb88,_0x125fe3['error']['message']);return _0x45b8d2(_0x125fe3[_0x4e5e('0xe')][_0x4e5e('0x10')]);}logger[_0x4e5e('0xe')](_0x4e5e('0xa'),_0x31eb88,_0x125fe3[_0x4e5e('0xe')]['message']);return _0x37507b(_0x125fe3['error'][_0x4e5e('0x10')]);}else{logger['info'](_0x4e5e('0xa'),_0x31eb88,'request\x20sent');_0x37507b(_0x125fe3[_0x4e5e('0x11')]['message']);}})['catch'](function(_0x11ac03){logger['error']('WhatsappQueueReport,\x20%s,\x20%s',_0x31eb88,_0x11ac03);_0x45b8d2(_0x11ac03);});});}exports[_0x4e5e('0x12')]=function(_0x3353fb){var _0x5c26c8=this;return new Promise(function(_0x56413d,_0x4135d3){return db[_0x4e5e('0x13')][_0x4e5e('0x14')](_0x3353fb[_0x4e5e('0x15')],{'raw':_0x3353fb[_0x4e5e('0x16')]?_0x3353fb['options'][_0x4e5e('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x5d4558){logger['info'](_0x4e5e('0x12'),_0x3353fb);logger[_0x4e5e('0x18')]('CreateWhatsappQueueReport',_0x3353fb,JSON[_0x4e5e('0xd')](_0x5d4558));_0x56413d(_0x5d4558);})[_0x4e5e('0x19')](function(_0x365abf){logger['error'](_0x4e5e('0x12'),_0x365abf[_0x4e5e('0x10')],_0x3353fb);_0x4135d3(_0x5c26c8[_0x4e5e('0xe')](0x1f4,_0x365abf[_0x4e5e('0x10')]));});});};exports['UpdateWhatsappQueueReport']=function(_0x175aa5){var _0x54cc20=this;return new Promise(function(_0x33a7c9,_0x4cc3b2){return db[_0x4e5e('0x13')]['update'](_0x175aa5[_0x4e5e('0x15')],{'raw':_0x175aa5[_0x4e5e('0x16')]?_0x175aa5[_0x4e5e('0x16')][_0x4e5e('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x175aa5[_0x4e5e('0x16')]?_0x175aa5[_0x4e5e('0x16')][_0x4e5e('0x1a')]||null:null,'attributes':_0x175aa5['options']?_0x175aa5[_0x4e5e('0x16')][_0x4e5e('0x1b')]||null:null,'limit':_0x175aa5[_0x4e5e('0x16')]?_0x175aa5['options'][_0x4e5e('0x1c')]||null:null})['then'](function(_0x12b1d7){logger[_0x4e5e('0x1d')]('UpdateWhatsappQueueReport',_0x175aa5);logger[_0x4e5e('0x18')]('UpdateWhatsappQueueReport',_0x175aa5,JSON[_0x4e5e('0xd')](_0x12b1d7));_0x33a7c9(_0x12b1d7);})[_0x4e5e('0x19')](function(_0x5d5a40){logger['error'](_0x4e5e('0x1e'),_0x5d5a40[_0x4e5e('0x10')],_0x175aa5);_0x4cc3b2(_0x54cc20['error'](0x1f4,_0x5d5a40[_0x4e5e('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 9a6fae8..cd386bf 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 _0xd343=['multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','get','index','/describe','isAuthenticated','describe','show','post','/:id','update','delete','exports'];(function(_0x25dc76,_0xfae587){var _0x478c85=function(_0x263ae8){while(--_0x263ae8){_0x25dc76['push'](_0x25dc76['shift']());}};_0x478c85(++_0xfae587);}(_0xd343,0x1cc));var _0x3d34=function(_0x2736e1,_0x15f462){_0x2736e1=_0x2736e1-0x0;var _0x458828=_0xd343[_0x2736e1];return _0x458828;};'use strict';var multer=require(_0x3d34('0x0'));var util=require('util');var path=require(_0x3d34('0x1'));var timeout=require('connect-timeout');var express=require(_0x3d34('0x2'));var router=express[_0x3d34('0x3')]();var fs_extra=require(_0x3d34('0x4'));var auth=require(_0x3d34('0x5'));var interaction=require(_0x3d34('0x6'));var config=require(_0x3d34('0x7'));var controller=require(_0x3d34('0x8'));router[_0x3d34('0x9')]('/',auth['isAuthenticated'](),controller[_0x3d34('0xa')]);router[_0x3d34('0x9')](_0x3d34('0xb'),auth[_0x3d34('0xc')](),controller[_0x3d34('0xd')]);router[_0x3d34('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x3d34('0xe')]);router[_0x3d34('0xf')]('/',auth[_0x3d34('0xc')](),controller['create']);router['put'](_0x3d34('0x10'),auth['isAuthenticated'](),controller[_0x3d34('0x11')]);router[_0x3d34('0x12')](_0x3d34('0x10'),auth['isAuthenticated'](),controller['destroy']);module[_0x3d34('0x13')]=router; \ No newline at end of file +var _0x2fe7=['../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x29db36,_0x410ae9){var _0x234e87=function(_0x48697b){while(--_0x48697b){_0x29db36['push'](_0x29db36['shift']());}};_0x234e87(++_0x410ae9);}(_0x2fe7,0x19b));var _0x72fe=function(_0x110bcd,_0xf8636f){_0x110bcd=_0x110bcd-0x0;var _0xaf16fe=_0x2fe7[_0x110bcd];return _0xaf16fe;};'use strict';var multer=require(_0x72fe('0x0'));var util=require(_0x72fe('0x1'));var path=require(_0x72fe('0x2'));var timeout=require('connect-timeout');var express=require(_0x72fe('0x3'));var router=express[_0x72fe('0x4')]();var fs_extra=require(_0x72fe('0x5'));var auth=require(_0x72fe('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x72fe('0x7'));var controller=require('./whatsappTransferReport.controller');router[_0x72fe('0x8')]('/',auth[_0x72fe('0x9')](),controller[_0x72fe('0xa')]);router[_0x72fe('0x8')](_0x72fe('0xb'),auth[_0x72fe('0x9')](),controller[_0x72fe('0xc')]);router['get'](_0x72fe('0xd'),auth[_0x72fe('0x9')](),controller[_0x72fe('0xe')]);router[_0x72fe('0xf')]('/',auth[_0x72fe('0x9')](),controller[_0x72fe('0x10')]);router[_0x72fe('0x11')]('/:id',auth[_0x72fe('0x9')](),controller[_0x72fe('0x12')]);router[_0x72fe('0x13')]('/:id',auth[_0x72fe('0x9')](),controller[_0x72fe('0x14')]);module[_0x72fe('0x15')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index 69f37c8..098c4e7 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 _0x29b1=['DATE','sequelize','exports','STRING','ENUM','account','queue'];(function(_0xc0a3d3,_0x2c8d00){var _0x3386e8=function(_0x3f9df4){while(--_0x3f9df4){_0xc0a3d3['push'](_0xc0a3d3['shift']());}};_0x3386e8(++_0x2c8d00);}(_0x29b1,0x16d));var _0x129b=function(_0x513aa5,_0x1fba79){_0x513aa5=_0x513aa5-0x0;var _0x1a1a7c=_0x29b1[_0x513aa5];return _0x1a1a7c;};'use strict';var Sequelize=require(_0x129b('0x0'));module[_0x129b('0x1')]={'uniqueid':{'type':Sequelize[_0x129b('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x129b('0x3')](_0x129b('0x4'),'agent',_0x129b('0x5')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x129b('0x6')]}}; \ No newline at end of file +var _0x693f=['agent','queue','DATE','sequelize','exports','STRING','ENUM'];(function(_0xf50820,_0x56f041){var _0x2a9b10=function(_0x33f0f4){while(--_0x33f0f4){_0xf50820['push'](_0xf50820['shift']());}};_0x2a9b10(++_0x56f041);}(_0x693f,0x9d));var _0xf693=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x693f[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0xf693('0x0'));module[_0xf693('0x1')]={'uniqueid':{'type':Sequelize[_0xf693('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xf693('0x3')]('account',_0xf693('0x4'),_0xf693('0x5')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xf693('0x6')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index 83ace9e..3cfed5e 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 _0x84c4=['send','index','map','WhatsappTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','length','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','status','limit','undefined','count','offset','set','Content-Range','json','apply','save','update','destroy','then','sendStatus','error','stack','name'];(function(_0x5b860b,_0x2b96d9){var _0x5d0d2a=function(_0x47c179){while(--_0x47c179){_0x5b860b['push'](_0x5b860b['shift']());}};_0x5d0d2a(++_0x2b96d9);}(_0x84c4,0x157));var _0x484c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x84c4[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x484c('0x0'));var rimraf=require(_0x484c('0x1'));var zipdir=require(_0x484c('0x2'));var jsonpatch=require(_0x484c('0x3'));var rp=require(_0x484c('0x4'));var moment=require(_0x484c('0x5'));var BPromise=require(_0x484c('0x6'));var Mustache=require(_0x484c('0x7'));var util=require(_0x484c('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0x484c('0x9'));var ejs=require(_0x484c('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x484c('0xb'));var squel=require('squel');var crypto=require(_0x484c('0xc'));var jsforce=require(_0x484c('0xd'));var deskjs=require(_0x484c('0xe'));var toCsv=require('to-csv');var querystring=require(_0x484c('0xf'));var Papa=require(_0x484c('0x10'));var Redis=require(_0x484c('0x11'));var authService=require(_0x484c('0x12'));var qs=require(_0x484c('0x13'));var as=require(_0x484c('0x14'));var hardwareService=require(_0x484c('0x15'));var logger=require('../../config/logger')(_0x484c('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x484c('0x17'));var db=require(_0x484c('0x18'))['db'];function respondWithStatusCode(_0x1a0247,_0x1e9683){_0x1e9683=_0x1e9683||0xcc;return function(_0x193af8){if(_0x193af8){return _0x1a0247['sendStatus'](_0x1e9683);}return _0x1a0247['status'](_0x1e9683)['end']();};}function respondWithResult(_0xf3d82f,_0x42d179){_0x42d179=_0x42d179||0xc8;return function(_0x5105ee){if(_0x5105ee){return _0xf3d82f[_0x484c('0x19')](_0x42d179)['json'](_0x5105ee);}};}function respondWithFilteredResult(_0x1874af,_0x401263){return function(_0x487dc6){if(_0x487dc6){var _0x579464=typeof _0x401263['offset']==='undefined'&&typeof _0x401263[_0x484c('0x1a')]===_0x484c('0x1b');var _0x489221=_0x487dc6[_0x484c('0x1c')];var _0x4567f8=_0x579464?0x0:_0x401263[_0x484c('0x1d')];var _0x2fccc3=_0x579464?_0x487dc6[_0x484c('0x1c')]:_0x401263[_0x484c('0x1d')]+_0x401263['limit'];var _0x1105ca;if(_0x2fccc3>=_0x489221){_0x2fccc3=_0x489221;_0x1105ca=0xc8;}else{_0x1105ca=0xce;}_0x1874af[_0x484c('0x19')](_0x1105ca);return _0x1874af[_0x484c('0x1e')](_0x484c('0x1f'),_0x4567f8+'-'+_0x2fccc3+'/'+_0x489221)[_0x484c('0x20')](_0x487dc6);}return null;};}function patchUpdates(_0x1dddc8){return function(_0x17e013){try{jsonpatch[_0x484c('0x21')](_0x17e013,_0x1dddc8,!![]);}catch(_0x3dc482){return BPromise['reject'](_0x3dc482);}return _0x17e013[_0x484c('0x22')]();};}function saveUpdates(_0x5c4fb4,_0x38564b){return function(_0xca8eee){if(_0xca8eee){return _0xca8eee[_0x484c('0x23')](_0x5c4fb4)['then'](function(_0x284ea5){return _0x284ea5;});}return null;};}function removeEntity(_0xaa0f22,_0x103a32){return function(_0x571f76){if(_0x571f76){return _0x571f76[_0x484c('0x24')]()[_0x484c('0x25')](function(){_0xaa0f22['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x23a3ce,_0x4dc2f6){return function(_0x5335ff){if(!_0x5335ff){_0x23a3ce[_0x484c('0x26')](0x194);}return _0x5335ff;};}function handleError(_0x8ee389,_0x5dd200){_0x5dd200=_0x5dd200||0x1f4;return function(_0x2e2fd9){logger[_0x484c('0x27')](_0x2e2fd9[_0x484c('0x28')]);if(_0x2e2fd9[_0x484c('0x29')]){delete _0x2e2fd9[_0x484c('0x29')];}_0x8ee389['status'](_0x5dd200)[_0x484c('0x2a')](_0x2e2fd9);};}exports[_0x484c('0x2b')]=function(_0x1ac937,_0x2157d9){var _0x31af1f={},_0x413e91={},_0x438b1a={'count':0x0,'rows':[]};var _0xf6c409=_[_0x484c('0x2c')](db[_0x484c('0x2d')][_0x484c('0x2e')],function(_0x3c98af){return{'name':_0x3c98af[_0x484c('0x2f')],'type':_0x3c98af[_0x484c('0x30')][_0x484c('0x31')]};});_0x413e91[_0x484c('0x32')]=_[_0x484c('0x2c')](_0xf6c409,_0x484c('0x29'));_0x413e91[_0x484c('0x33')]=_[_0x484c('0x34')](_0x1ac937[_0x484c('0x33')]);_0x413e91[_0x484c('0x35')]=_[_0x484c('0x36')](_0x413e91[_0x484c('0x32')],_0x413e91['query']);_0x31af1f[_0x484c('0x37')]=_[_0x484c('0x36')](_0x413e91[_0x484c('0x32')],qs[_0x484c('0x38')](_0x1ac937[_0x484c('0x33')]['fields']));_0x31af1f[_0x484c('0x37')]=_0x31af1f[_0x484c('0x37')]['length']?_0x31af1f[_0x484c('0x37')]:_0x413e91[_0x484c('0x32')];if(!_0x1ac937[_0x484c('0x33')][_0x484c('0x39')]('nolimit')){_0x31af1f[_0x484c('0x1a')]=qs['limit'](_0x1ac937[_0x484c('0x33')][_0x484c('0x1a')]);_0x31af1f[_0x484c('0x1d')]=qs[_0x484c('0x1d')](_0x1ac937[_0x484c('0x33')]['offset']);}_0x31af1f[_0x484c('0x3a')]=qs[_0x484c('0x3b')](_0x1ac937[_0x484c('0x33')]['sort']);_0x31af1f[_0x484c('0x3c')]=qs[_0x484c('0x35')](_[_0x484c('0x3d')](_0x1ac937[_0x484c('0x33')],_0x413e91['filters']),_0xf6c409);if(_0x1ac937[_0x484c('0x33')][_0x484c('0x3e')]){_0x31af1f[_0x484c('0x3c')]=_[_0x484c('0x3f')](_0x31af1f['where'],{'$or':_[_0x484c('0x2c')](_0xf6c409,function(_0x1f002b){if(_0x1f002b[_0x484c('0x30')]!==_0x484c('0x40')){var _0x512442={};_0x512442[_0x1f002b[_0x484c('0x29')]]={'$like':'%'+_0x1ac937[_0x484c('0x33')][_0x484c('0x3e')]+'%'};return _0x512442;}})});}_0x31af1f=_[_0x484c('0x3f')]({},_0x31af1f,_0x1ac937[_0x484c('0x41')]);var _0x2395fe={'where':_0x31af1f[_0x484c('0x3c')]};return db['WhatsappTransferReport'][_0x484c('0x1c')](_0x2395fe)[_0x484c('0x25')](function(_0x2fef62){_0x438b1a['count']=_0x2fef62;if(_0x1ac937['query'][_0x484c('0x42')]){_0x31af1f[_0x484c('0x43')]=[{'all':!![]}];}return db['WhatsappTransferReport'][_0x484c('0x44')](_0x31af1f);})[_0x484c('0x25')](function(_0x311dd8){_0x438b1a[_0x484c('0x45')]=_0x311dd8;return _0x438b1a;})['then'](respondWithFilteredResult(_0x2157d9,_0x31af1f))[_0x484c('0x46')](handleError(_0x2157d9,null));};exports['show']=function(_0x271eb9,_0x4ff111){var _0x5b9dd3={'raw':!![],'where':{'id':_0x271eb9[_0x484c('0x47')]['id']}},_0x38adf1={};_0x38adf1[_0x484c('0x32')]=_[_0x484c('0x34')](db[_0x484c('0x2d')]['rawAttributes']);_0x38adf1[_0x484c('0x33')]=_['keys'](_0x271eb9[_0x484c('0x33')]);_0x38adf1[_0x484c('0x35')]=_[_0x484c('0x36')](_0x38adf1['model'],_0x38adf1['query']);_0x5b9dd3['attributes']=_[_0x484c('0x36')](_0x38adf1[_0x484c('0x32')],qs[_0x484c('0x38')](_0x271eb9[_0x484c('0x33')][_0x484c('0x38')]));_0x5b9dd3[_0x484c('0x37')]=_0x5b9dd3[_0x484c('0x37')][_0x484c('0x48')]?_0x5b9dd3[_0x484c('0x37')]:_0x38adf1[_0x484c('0x32')];if(_0x271eb9['query'][_0x484c('0x42')]){_0x5b9dd3[_0x484c('0x43')]=[{'all':!![]}];}_0x5b9dd3=_[_0x484c('0x3f')]({},_0x5b9dd3,_0x271eb9[_0x484c('0x41')]);return db[_0x484c('0x2d')][_0x484c('0x49')](_0x5b9dd3)[_0x484c('0x25')](handleEntityNotFound(_0x4ff111,null))[_0x484c('0x25')](respondWithResult(_0x4ff111,null))[_0x484c('0x46')](handleError(_0x4ff111,null));};exports[_0x484c('0x4a')]=function(_0x56a1af,_0x461dbe){return db[_0x484c('0x2d')][_0x484c('0x4a')](_0x56a1af[_0x484c('0x4b')],{})[_0x484c('0x25')](respondWithResult(_0x461dbe,0xc9))[_0x484c('0x46')](handleError(_0x461dbe,null));};exports[_0x484c('0x23')]=function(_0x38cedc,_0x5784d1){if(_0x38cedc[_0x484c('0x4b')]['id']){delete _0x38cedc[_0x484c('0x4b')]['id'];}return db['WhatsappTransferReport'][_0x484c('0x49')]({'where':{'id':_0x38cedc[_0x484c('0x47')]['id']}})['then'](handleEntityNotFound(_0x5784d1,null))[_0x484c('0x25')](saveUpdates(_0x38cedc[_0x484c('0x4b')],null))[_0x484c('0x25')](respondWithResult(_0x5784d1,null))['catch'](handleError(_0x5784d1,null));};exports[_0x484c('0x24')]=function(_0x518492,_0xeac332){return db[_0x484c('0x2d')]['find']({'where':{'id':_0x518492[_0x484c('0x47')]['id']}})[_0x484c('0x25')](handleEntityNotFound(_0xeac332,null))[_0x484c('0x25')](removeEntity(_0xeac332,null))[_0x484c('0x46')](handleError(_0xeac332,null));};exports[_0x484c('0x4c')]=function(_0x46fc10,_0x4e737b){return db['WhatsappTransferReport'][_0x484c('0x4c')]()['then'](respondWithResult(_0x4e737b,null))['catch'](handleError(_0x4e737b,null));}; \ No newline at end of file +var _0x794b=['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','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','map','fieldName','type','key','query','keys','filters','model','intersection','fields','attributes','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','WhatsappTransferReport','rows','show','params','rawAttributes','includeAll','catch','create','body','find','describe','eml-format','rimraf','fast-json-patch','request-promise','mustache','util'];(function(_0x20819b,_0x1d425c){var _0x4acc14=function(_0x33aea4){while(--_0x33aea4){_0x20819b['push'](_0x20819b['shift']());}};_0x4acc14(++_0x1d425c);}(_0x794b,0x1c2));var _0xb794=function(_0x5a297a,_0x4eef1a){_0x5a297a=_0x5a297a-0x0;var _0x54beb4=_0x794b[_0x5a297a];return _0x54beb4;};'use strict';var emlformat=require(_0xb794('0x0'));var rimraf=require(_0xb794('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb794('0x2'));var rp=require(_0xb794('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xb794('0x4'));var util=require(_0xb794('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0xb794('0x6'));var ejs=require(_0xb794('0x7'));var fs=require('fs');var fs_extra=require(_0xb794('0x8'));var _=require(_0xb794('0x9'));var squel=require(_0xb794('0xa'));var crypto=require(_0xb794('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xb794('0xc'));var toCsv=require(_0xb794('0x6'));var querystring=require(_0xb794('0xd'));var Papa=require(_0xb794('0xe'));var Redis=require(_0xb794('0xf'));var authService=require(_0xb794('0x10'));var qs=require(_0xb794('0x11'));var as=require(_0xb794('0x12'));var hardwareService=require(_0xb794('0x13'));var logger=require(_0xb794('0x14'))(_0xb794('0x15'));var utils=require(_0xb794('0x16'));var config=require(_0xb794('0x17'));var licenseUtil=require(_0xb794('0x18'));var db=require(_0xb794('0x19'))['db'];function respondWithStatusCode(_0xe8442a,_0x3900f0){_0x3900f0=_0x3900f0||0xcc;return function(_0x3be436){if(_0x3be436){return _0xe8442a[_0xb794('0x1a')](_0x3900f0);}return _0xe8442a[_0xb794('0x1b')](_0x3900f0)[_0xb794('0x1c')]();};}function respondWithResult(_0x57c750,_0x44e714){_0x44e714=_0x44e714||0xc8;return function(_0x14927e){if(_0x14927e){return _0x57c750[_0xb794('0x1b')](_0x44e714)[_0xb794('0x1d')](_0x14927e);}};}function respondWithFilteredResult(_0xac1f87,_0x469618){return function(_0x558bc1){if(_0x558bc1){var _0x43bf13=typeof _0x469618[_0xb794('0x1e')]==='undefined'&&typeof _0x469618[_0xb794('0x1f')]===_0xb794('0x20');var _0x53788b=_0x558bc1[_0xb794('0x21')];var _0xdf55d7=_0x43bf13?0x0:_0x469618[_0xb794('0x1e')];var _0x518d3d=_0x43bf13?_0x558bc1[_0xb794('0x21')]:_0x469618[_0xb794('0x1e')]+_0x469618['limit'];var _0x10d905;if(_0x518d3d>=_0x53788b){_0x518d3d=_0x53788b;_0x10d905=0xc8;}else{_0x10d905=0xce;}_0xac1f87[_0xb794('0x1b')](_0x10d905);return _0xac1f87[_0xb794('0x22')](_0xb794('0x23'),_0xdf55d7+'-'+_0x518d3d+'/'+_0x53788b)[_0xb794('0x1d')](_0x558bc1);}return null;};}function patchUpdates(_0x4fbb1c){return function(_0x24811c){try{jsonpatch[_0xb794('0x24')](_0x24811c,_0x4fbb1c,!![]);}catch(_0x4c2156){return BPromise[_0xb794('0x25')](_0x4c2156);}return _0x24811c[_0xb794('0x26')]();};}function saveUpdates(_0x29d308,_0x1b93dd){return function(_0x31bd91){if(_0x31bd91){return _0x31bd91[_0xb794('0x27')](_0x29d308)[_0xb794('0x28')](function(_0x45ddac){return _0x45ddac;});}return null;};}function removeEntity(_0x425a47,_0x43e077){return function(_0x4236fe){if(_0x4236fe){return _0x4236fe[_0xb794('0x29')]()[_0xb794('0x28')](function(){_0x425a47['status'](0xcc)[_0xb794('0x1c')]();});}};}function handleEntityNotFound(_0x3f6b71,_0xeebf12){return function(_0x47e38c){if(!_0x47e38c){_0x3f6b71['sendStatus'](0x194);}return _0x47e38c;};}function handleError(_0x1675ea,_0x536444){_0x536444=_0x536444||0x1f4;return function(_0xdb29d7){logger[_0xb794('0x2a')](_0xdb29d7['stack']);if(_0xdb29d7['name']){delete _0xdb29d7[_0xb794('0x2b')];}_0x1675ea[_0xb794('0x1b')](_0x536444)[_0xb794('0x2c')](_0xdb29d7);};}exports['index']=function(_0x59236a,_0x35fbd0){var _0x2db412={},_0x45d4d0={},_0x2ed6bc={'count':0x0,'rows':[]};var _0x3ec2f0=_[_0xb794('0x2d')](db['WhatsappTransferReport']['rawAttributes'],function(_0x54d796){return{'name':_0x54d796[_0xb794('0x2e')],'type':_0x54d796[_0xb794('0x2f')][_0xb794('0x30')]};});_0x45d4d0['model']=_[_0xb794('0x2d')](_0x3ec2f0,'name');_0x45d4d0[_0xb794('0x31')]=_[_0xb794('0x32')](_0x59236a['query']);_0x45d4d0[_0xb794('0x33')]=_['intersection'](_0x45d4d0[_0xb794('0x34')],_0x45d4d0[_0xb794('0x31')]);_0x2db412['attributes']=_[_0xb794('0x35')](_0x45d4d0[_0xb794('0x34')],qs[_0xb794('0x36')](_0x59236a[_0xb794('0x31')][_0xb794('0x36')]));_0x2db412[_0xb794('0x37')]=_0x2db412[_0xb794('0x37')]['length']?_0x2db412[_0xb794('0x37')]:_0x45d4d0['model'];if(!_0x59236a[_0xb794('0x31')]['hasOwnProperty'](_0xb794('0x38'))){_0x2db412[_0xb794('0x1f')]=qs[_0xb794('0x1f')](_0x59236a['query']['limit']);_0x2db412[_0xb794('0x1e')]=qs[_0xb794('0x1e')](_0x59236a[_0xb794('0x31')]['offset']);}_0x2db412[_0xb794('0x39')]=qs[_0xb794('0x3a')](_0x59236a[_0xb794('0x31')][_0xb794('0x3a')]);_0x2db412[_0xb794('0x3b')]=qs['filters'](_[_0xb794('0x3c')](_0x59236a[_0xb794('0x31')],_0x45d4d0[_0xb794('0x33')]),_0x3ec2f0);if(_0x59236a[_0xb794('0x31')]['filter']){_0x2db412[_0xb794('0x3b')]=_[_0xb794('0x3d')](_0x2db412[_0xb794('0x3b')],{'$or':_['map'](_0x3ec2f0,function(_0x583f4f){if(_0x583f4f[_0xb794('0x2f')]!==_0xb794('0x3e')){var _0x4928b9={};_0x4928b9[_0x583f4f[_0xb794('0x2b')]]={'$like':'%'+_0x59236a[_0xb794('0x31')][_0xb794('0x3f')]+'%'};return _0x4928b9;}})});}_0x2db412=_['merge']({},_0x2db412,_0x59236a[_0xb794('0x40')]);var _0xb9ad03={'where':_0x2db412[_0xb794('0x3b')]};return db[_0xb794('0x41')][_0xb794('0x21')](_0xb9ad03)[_0xb794('0x28')](function(_0x3f856a){_0x2ed6bc[_0xb794('0x21')]=_0x3f856a;if(_0x59236a[_0xb794('0x31')]['includeAll']){_0x2db412['include']=[{'all':!![]}];}return db[_0xb794('0x41')]['findAll'](_0x2db412);})[_0xb794('0x28')](function(_0x2265b7){_0x2ed6bc[_0xb794('0x42')]=_0x2265b7;return _0x2ed6bc;})[_0xb794('0x28')](respondWithFilteredResult(_0x35fbd0,_0x2db412))['catch'](handleError(_0x35fbd0,null));};exports[_0xb794('0x43')]=function(_0x5f2a0a,_0x12c344){var _0x8240e1={'raw':!![],'where':{'id':_0x5f2a0a[_0xb794('0x44')]['id']}},_0x27794d={};_0x27794d[_0xb794('0x34')]=_['keys'](db[_0xb794('0x41')][_0xb794('0x45')]);_0x27794d[_0xb794('0x31')]=_[_0xb794('0x32')](_0x5f2a0a[_0xb794('0x31')]);_0x27794d[_0xb794('0x33')]=_[_0xb794('0x35')](_0x27794d[_0xb794('0x34')],_0x27794d[_0xb794('0x31')]);_0x8240e1[_0xb794('0x37')]=_[_0xb794('0x35')](_0x27794d[_0xb794('0x34')],qs['fields'](_0x5f2a0a['query']['fields']));_0x8240e1['attributes']=_0x8240e1[_0xb794('0x37')]['length']?_0x8240e1[_0xb794('0x37')]:_0x27794d[_0xb794('0x34')];if(_0x5f2a0a[_0xb794('0x31')][_0xb794('0x46')]){_0x8240e1['include']=[{'all':!![]}];}_0x8240e1=_['merge']({},_0x8240e1,_0x5f2a0a[_0xb794('0x40')]);return db['WhatsappTransferReport']['find'](_0x8240e1)['then'](handleEntityNotFound(_0x12c344,null))['then'](respondWithResult(_0x12c344,null))[_0xb794('0x47')](handleError(_0x12c344,null));};exports[_0xb794('0x48')]=function(_0x620576,_0x6c8365){return db[_0xb794('0x41')][_0xb794('0x48')](_0x620576[_0xb794('0x49')],{})[_0xb794('0x28')](respondWithResult(_0x6c8365,0xc9))['catch'](handleError(_0x6c8365,null));};exports['update']=function(_0x3dc181,_0x4bff19){if(_0x3dc181[_0xb794('0x49')]['id']){delete _0x3dc181[_0xb794('0x49')]['id'];}return db[_0xb794('0x41')][_0xb794('0x4a')]({'where':{'id':_0x3dc181['params']['id']}})[_0xb794('0x28')](handleEntityNotFound(_0x4bff19,null))['then'](saveUpdates(_0x3dc181['body'],null))[_0xb794('0x28')](respondWithResult(_0x4bff19,null))['catch'](handleError(_0x4bff19,null));};exports['destroy']=function(_0x1c5609,_0x36ba32){return db[_0xb794('0x41')]['find']({'where':{'id':_0x1c5609['params']['id']}})['then'](handleEntityNotFound(_0x36ba32,null))[_0xb794('0x28')](removeEntity(_0x36ba32,null))['catch'](handleError(_0x36ba32,null));};exports[_0xb794('0x4b')]=function(_0x52d50d,_0x13b665){return db[_0xb794('0x41')][_0xb794('0x4b')]()[_0xb794('0x28')](respondWithResult(_0x13b665,null))[_0xb794('0x47')](handleError(_0x13b665,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index a93cba7..d1e723a 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 _0xf368=['../../config/logger','api','bluebird','request-promise','path','rimraf','define','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','lodash','util'];(function(_0x4febd5,_0x4be25a){var _0x31199e=function(_0x13fbab){while(--_0x13fbab){_0x4febd5['push'](_0x4febd5['shift']());}};_0x31199e(++_0x4be25a);}(_0xf368,0xbe));var _0x8f36=function(_0x3510f1,_0x491d6a){_0x3510f1=_0x3510f1-0x0;var _0x7ddb81=_0xf368[_0x3510f1];return _0x7ddb81;};'use strict';var _=require(_0x8f36('0x0'));var util=require(_0x8f36('0x1'));var logger=require(_0x8f36('0x2'))(_0x8f36('0x3'));var moment=require('moment');var BPromise=require(_0x8f36('0x4'));var rp=require(_0x8f36('0x5'));var fs=require('fs');var path=require(_0x8f36('0x6'));var rimraf=require(_0x8f36('0x7'));var config=require('../../config/environment');var attributes=require('./whatsappTransferReport.attributes');module['exports']=function(_0x2b33e3,_0x53ab90){return _0x2b33e3[_0x8f36('0x8')](_0x8f36('0x9'),attributes,{'tableName':_0x8f36('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x8f36('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xcf3f=['request-promise','path','rimraf','../../config/environment','./whatsappTransferReport.attributes','exports','define','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','../../config/logger','moment','bluebird'];(function(_0x5db767,_0x54d04d){var _0x27abf3=function(_0x3dc123){while(--_0x3dc123){_0x5db767['push'](_0x5db767['shift']());}};_0x27abf3(++_0x54d04d);}(_0xcf3f,0x72));var _0xfcf3=function(_0x2c2ef7,_0x4700b7){_0x2c2ef7=_0x2c2ef7-0x0;var _0x392bc8=_0xcf3f[_0x2c2ef7];return _0x392bc8;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xfcf3('0x0'))('api');var moment=require(_0xfcf3('0x1'));var BPromise=require(_0xfcf3('0x2'));var rp=require(_0xfcf3('0x3'));var fs=require('fs');var path=require(_0xfcf3('0x4'));var rimraf=require(_0xfcf3('0x5'));var config=require(_0xfcf3('0x6'));var attributes=require(_0xfcf3('0x7'));module[_0xfcf3('0x8')]=function(_0x51d087,_0x4d0ed7){return _0x51d087[_0xfcf3('0x9')](_0xfcf3('0xa'),attributes,{'tableName':_0xfcf3('0xb'),'paranoid':![],'indexes':[{'name':_0xfcf3('0xc'),'fields':[_0xfcf3('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 8eff63d..6a41d22 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 _0x0e13=['WhatsappTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','WhatsappTransferReport,\x20%s,\x20%s'];(function(_0x53824f,_0x244804){var _0x5643c2=function(_0x6af996){while(--_0x6af996){_0x53824f['push'](_0x53824f['shift']());}};_0x5643c2(++_0x244804);}(_0x0e13,0x159));var _0x30e1=function(_0x44039a,_0x2ac8a8){_0x44039a=_0x44039a-0x0;var _0x525de5=_0x0e13[_0x44039a];return _0x525de5;};'use strict';var _=require(_0x30e1('0x0'));var util=require(_0x30e1('0x1'));var moment=require('moment');var BPromise=require(_0x30e1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x30e1('0x3'));var db=require(_0x30e1('0x4'))['db'];var utils=require(_0x30e1('0x5'));var logger=require(_0x30e1('0x6'))(_0x30e1('0x7'));var config=require('../../config/environment');var jayson=require(_0x30e1('0x8'));var client=jayson[_0x30e1('0x9')][_0x30e1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xa0e8eb,_0x2a5328,_0x295ed2){return new BPromise(function(_0x4e58e7,_0x2b492e){return client[_0x30e1('0xb')](_0xa0e8eb,_0x295ed2)[_0x30e1('0xc')](function(_0x3f2f8e){logger[_0x30e1('0xd')](_0x30e1('0xe'),_0x2a5328,'request\x20sent');logger['debug'](_0x30e1('0xf'),_0x2a5328,'request\x20sent',JSON['stringify'](_0x3f2f8e));if(_0x3f2f8e['error']){if(_0x3f2f8e[_0x30e1('0x10')][_0x30e1('0x11')]===0x1f4){logger[_0x30e1('0x10')]('WhatsappTransferReport,\x20%s,\x20%s',_0x2a5328,_0x3f2f8e['error']['message']);return _0x2b492e(_0x3f2f8e['error']['message']);}logger['error'](_0x30e1('0xe'),_0x2a5328,_0x3f2f8e[_0x30e1('0x10')][_0x30e1('0x12')]);return _0x4e58e7(_0x3f2f8e[_0x30e1('0x10')][_0x30e1('0x12')]);}else{logger[_0x30e1('0xd')](_0x30e1('0xe'),_0x2a5328,'request\x20sent');_0x4e58e7(_0x3f2f8e['result'][_0x30e1('0x12')]);}})[_0x30e1('0x13')](function(_0x374d1a){logger['error']('WhatsappTransferReport,\x20%s,\x20%s',_0x2a5328,_0x374d1a);_0x2b492e(_0x374d1a);});});} \ No newline at end of file +var _0x408e=['request\x20sent','stringify','error','message','result','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','WhatsappTransferReport,\x20%s,\x20%s'];(function(_0x1a4f8b,_0x3e26c7){var _0x456a14=function(_0x420161){while(--_0x420161){_0x1a4f8b['push'](_0x1a4f8b['shift']());}};_0x456a14(++_0x3e26c7);}(_0x408e,0x7d));var _0xe408=function(_0x5759e0,_0x31984b){_0x5759e0=_0x5759e0-0x0;var _0x1a64cd=_0x408e[_0x5759e0];return _0x1a64cd;};'use strict';var _=require(_0xe408('0x0'));var util=require('util');var moment=require(_0xe408('0x1'));var BPromise=require(_0xe408('0x2'));var rs=require(_0xe408('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe408('0x4'))['db'];var utils=require(_0xe408('0x5'));var logger=require(_0xe408('0x6'))(_0xe408('0x7'));var config=require(_0xe408('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xe408('0x9')][_0xe408('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x458afe,_0x4c9f7f,_0x53f4d2){return new BPromise(function(_0x4eb614,_0x3d6e8d){return client[_0xe408('0xb')](_0x458afe,_0x53f4d2)[_0xe408('0xc')](function(_0x10fbd9){logger[_0xe408('0xd')](_0xe408('0xe'),_0x4c9f7f,_0xe408('0xf'));logger['debug']('WhatsappTransferReport,\x20%s,\x20%s,\x20%s',_0x4c9f7f,_0xe408('0xf'),JSON[_0xe408('0x10')](_0x10fbd9));if(_0x10fbd9[_0xe408('0x11')]){if(_0x10fbd9[_0xe408('0x11')]['code']===0x1f4){logger['error'](_0xe408('0xe'),_0x4c9f7f,_0x10fbd9[_0xe408('0x11')][_0xe408('0x12')]);return _0x3d6e8d(_0x10fbd9[_0xe408('0x11')][_0xe408('0x12')]);}logger[_0xe408('0x11')](_0xe408('0xe'),_0x4c9f7f,_0x10fbd9[_0xe408('0x11')][_0xe408('0x12')]);return _0x4eb614(_0x10fbd9[_0xe408('0x11')][_0xe408('0x12')]);}else{logger[_0xe408('0xd')](_0xe408('0xe'),_0x4c9f7f,_0xe408('0xf'));_0x4eb614(_0x10fbd9[_0xe408('0x13')][_0xe408('0x12')]);}})['catch'](function(_0x10e06b){logger['error'](_0xe408('0xe'),_0x4c9f7f,_0x10e06b);_0x3d6e8d(_0x10e06b);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index 7f17981..4535ff5 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb7a7=['./mysqldb','./config/seedDB','./config/license','./rpc','app','./config/pm2','./config/pm2/config','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe','./config/schedule/cloud-provider','sequelize','sync','then','seedDB','default','listen','info','start','filter','exitCode','length','\x20processes\x20failed\x20at\x20startup:\x20','map','pm2_env','Online\x20apps:','online','name','join','Offline\x20apps:','None','App\x20Ready!','catch','log','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','exit','lodash'];(function(_0x3f9ac2,_0x1b670b){var _0xe6a436=function(_0x1f3ea5){while(--_0x1f3ea5){_0x3f9ac2['push'](_0x3f9ac2['shift']());}};_0xe6a436(++_0x1b670b);}(_0xb7a7,0x6e));var _0x7b7a=function(_0xb1fed1,_0x1259fb){_0xb1fed1=_0xb1fed1-0x0;var _0x4e15ed=_0xb7a7[_0xb1fed1];return _0x4e15ed;};'use strict';var _=require(_0x7b7a('0x0'));var db=require(_0x7b7a('0x1'))['db'];var seedDb=require(_0x7b7a('0x2'));var checkLicense=require(_0x7b7a('0x3'));var rpc=require(_0x7b7a('0x4'));var config=require('./config/environment');var logger=require('./config/logger')(_0x7b7a('0x5'));var pm2=require(_0x7b7a('0x6'));var pm2Config=require(_0x7b7a('0x7'));var schedule=require('./config/schedule');var chat=require(_0x7b7a('0x8'));var whatsapp=require(_0x7b7a('0x9'));var transcribe=require(_0x7b7a('0xa'));var provider=require(_0x7b7a('0xb'));function main(){return db[_0x7b7a('0xc')][_0x7b7a('0xd')]()[_0x7b7a('0xe')](function(){if(config[_0x7b7a('0xf')]){return seedDb[_0x7b7a('0x10')]();}})['then'](function(){return checkLicense[_0x7b7a('0x10')]();})['then'](function(){return rpc[_0x7b7a('0x11')]();})[_0x7b7a('0xe')](function(_0x3f563e){logger[_0x7b7a('0x12')](_0x3f563e);return chat[_0x7b7a('0x13')]();})['then'](function(){return whatsapp['start']();})['then'](function(){return schedule['start']();})[_0x7b7a('0xe')](function(){return transcribe[_0x7b7a('0x13')]();})['then'](function(){return provider[_0x7b7a('0x13')]();})[_0x7b7a('0xe')](function(_0x318b50){logger[_0x7b7a('0x12')](_0x318b50);return pm2[_0x7b7a('0x13')](pm2Config);})[_0x7b7a('0xe')](function(_0x2a8585){var _0x2e36dd=_0x2a8585[_0x7b7a('0x14')](function(_0x3b1998){return typeof _0x3b1998['exitCode']==='number'&&_0x3b1998[_0x7b7a('0x15')]>=0x0;});if(_0x2e36dd[_0x7b7a('0x16')]>0x0){throw new Error(_0x2e36dd[_0x7b7a('0x16')]+_0x7b7a('0x17')+_[_0x7b7a('0x18')](_0x2e36dd,function(_0x5bc717){return'\x22'+_0x5bc717[_0x7b7a('0x19')]['name']+'\x22';}));}logger[_0x7b7a('0x12')](_0x7b7a('0x1a'),_[_0x7b7a('0x18')](_[_0x7b7a('0x14')](_0x2a8585,{'status':_0x7b7a('0x1b')}),_0x7b7a('0x1c'))[_0x7b7a('0x1d')]());logger[_0x7b7a('0x12')](_0x7b7a('0x1e'),_[_0x7b7a('0x18')](_[_0x7b7a('0x14')](_0x2a8585,function(_0x402794){return _0x402794['status']!=='online';}),_0x7b7a('0x1c'))[_0x7b7a('0x1d')]()||_0x7b7a('0x1f'));console['log'](_0x7b7a('0x20'));})[_0x7b7a('0x21')](function(_0x558198){console[_0x7b7a('0x22')](_0x7b7a('0x23'),_0x558198);logger['error']('Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s',_0x558198);process[_0x7b7a('0x24')](0x1);});}main(); \ No newline at end of file +var _0xd2bb=['exitCode','number','length','map','pm2_env','name','Online\x20apps:','online','Offline\x20apps:','status','log','catch','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','./mysqldb','./config/license','./rpc','./config/environment','./config/logger','app','./config/pm2','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe','./config/schedule/cloud-provider','sequelize','sync','then','seedDB','default','listen','info','start','filter'];(function(_0x2abcd1,_0x19e17e){var _0xc4ba73=function(_0x2b43ef){while(--_0x2b43ef){_0x2abcd1['push'](_0x2abcd1['shift']());}};_0xc4ba73(++_0x19e17e);}(_0xd2bb,0x9a));var _0xbd2b=function(_0x12b681,_0x57f4eb){_0x12b681=_0x12b681-0x0;var _0x5785f9=_0xd2bb[_0x12b681];return _0x5785f9;};'use strict';var _=require('lodash');var db=require(_0xbd2b('0x0'))['db'];var seedDb=require('./config/seedDB');var checkLicense=require(_0xbd2b('0x1'));var rpc=require(_0xbd2b('0x2'));var config=require(_0xbd2b('0x3'));var logger=require(_0xbd2b('0x4'))(_0xbd2b('0x5'));var pm2=require(_0xbd2b('0x6'));var pm2Config=require('./config/pm2/config');var schedule=require(_0xbd2b('0x7'));var chat=require(_0xbd2b('0x8'));var whatsapp=require(_0xbd2b('0x9'));var transcribe=require(_0xbd2b('0xa'));var provider=require(_0xbd2b('0xb'));function main(){return db[_0xbd2b('0xc')][_0xbd2b('0xd')]()[_0xbd2b('0xe')](function(){if(config[_0xbd2b('0xf')]){return seedDb[_0xbd2b('0x10')]();}})['then'](function(){return checkLicense[_0xbd2b('0x10')]();})['then'](function(){return rpc[_0xbd2b('0x11')]();})[_0xbd2b('0xe')](function(_0x4e9572){logger[_0xbd2b('0x12')](_0x4e9572);return chat[_0xbd2b('0x13')]();})[_0xbd2b('0xe')](function(){return whatsapp[_0xbd2b('0x13')]();})[_0xbd2b('0xe')](function(){return schedule[_0xbd2b('0x13')]();})[_0xbd2b('0xe')](function(){return transcribe[_0xbd2b('0x13')]();})['then'](function(){return provider[_0xbd2b('0x13')]();})[_0xbd2b('0xe')](function(_0x44d283){logger[_0xbd2b('0x12')](_0x44d283);return pm2[_0xbd2b('0x13')](pm2Config);})['then'](function(_0x1ccc21){var _0x6c2877=_0x1ccc21[_0xbd2b('0x14')](function(_0x1018dc){return typeof _0x1018dc[_0xbd2b('0x15')]===_0xbd2b('0x16')&&_0x1018dc[_0xbd2b('0x15')]>=0x0;});if(_0x6c2877[_0xbd2b('0x17')]>0x0){throw new Error(_0x6c2877[_0xbd2b('0x17')]+'\x20processes\x20failed\x20at\x20startup:\x20'+_[_0xbd2b('0x18')](_0x6c2877,function(_0x268025){return'\x22'+_0x268025[_0xbd2b('0x19')][_0xbd2b('0x1a')]+'\x22';}));}logger[_0xbd2b('0x12')](_0xbd2b('0x1b'),_[_0xbd2b('0x18')](_[_0xbd2b('0x14')](_0x1ccc21,{'status':_0xbd2b('0x1c')}),_0xbd2b('0x1a'))['join']());logger[_0xbd2b('0x12')](_0xbd2b('0x1d'),_[_0xbd2b('0x18')](_[_0xbd2b('0x14')](_0x1ccc21,function(_0xc1ce31){return _0xc1ce31[_0xbd2b('0x1e')]!==_0xbd2b('0x1c');}),'name')['join']()||'None');console[_0xbd2b('0x1f')]('App\x20Ready!');})[_0xbd2b('0x20')](function(_0x3efc8a){console['log']('Server\x20failed\x20to\x20start\x20due\x20to\x20error!',_0x3efc8a);logger[_0xbd2b('0x21')](_0xbd2b('0x22'),_0x3efc8a);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 56e66c8..0bb1ac7 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 _0x4fbd=['use','user','ChatInteraction','findOne','params','closed','disposition','query','status','unmanaged','json','Unmanaged.','Forbidden.','catch','startsWith','headers','authorization','Basic','User','then','authenticate','pass','Wrong\x20credentials.','Bearer','Unknown\x20authorization\x20format','apikey','getUuid','find','Setting','allowedLoginAttempts','blockDuration','isEqual','apiKeyNonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','Invalid\x20API\x20access\x20key','blocked','add','minutes','User\x20not\x20found.','User\x20object\x20not\x20found.','getLicense','update','Forbidden','isWebrtcLicence','webrtc','isMiddleware','signToken','role','cookie','motion.token','redirect','send','isNil','apiKeyIat','generateApiKey','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','toLowerCase','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','unshift','encryptString','join','sign','secret','options','promisify','verify','randomBytes','hex','floor','toString','HS512','../../config/environment','../../config/license/hardware','../../config/license/util','../encryptor','lodash','jsonwebtoken','express-jwt','composable-middleware','crypto','util','moment','secrets','fullname','name','internal','email','permissions','md5secret','voicePause','chatPause','mailPause','faxPause','smsPause','pauseType','showWebBar','lastLoginAt','crudPermissions','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswerDelay','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','interface','userProfileId','settingsEnabled','wssPort','downloadVoiceRecordings','downloadAttachments','ignorePauseForPreviewCalls','selectRecallMeCampaign','chatAutoanswer','chatAutoanswerDelay','emailAutoanswer','emailAutoanswerDelay','smsAutoanswer','openchannelAutoanswerDelay','faxAutoanswer','faxAutoanswerDelay','whatsappAutoanswer','whatsappAutoanswerDelay','messengerSoundNotification','isChatInteractionAuthorized','isAuthenticated'];(function(_0x54e196,_0x36d442){var _0x4832ff=function(_0x350fe2){while(--_0x350fe2){_0x54e196['push'](_0x54e196['shift']());}};_0x4832ff(++_0x36d442);}(_0x4fbd,0x163));var _0xd4fb=function(_0x44d65d,_0x5d35aa){_0x44d65d=_0x44d65d-0x0;var _0x539405=_0x4fbd[_0x44d65d];return _0x539405;};'use strict';var db=require('../../mysqldb')['db'];var config=require(_0xd4fb('0x0'));var hardwareConf=require(_0xd4fb('0x1'));var licenseUtil=require(_0xd4fb('0x2'));var encryptor=require(_0xd4fb('0x3'));var _=require(_0xd4fb('0x4'));var jwt=require(_0xd4fb('0x5'));var expressJwt=require(_0xd4fb('0x6'));var compose=require(_0xd4fb('0x7'));var basicAuth=require('basic-auth');var crypto=require(_0xd4fb('0x8'));var BPromise=require('bluebird');var util=require(_0xd4fb('0x9'));var moment=require(_0xd4fb('0xa'));var validateJwt=expressJwt({'secret':config[_0xd4fb('0xb')]['session']});var userAttributes=['id','role',_0xd4fb('0xc'),_0xd4fb('0xd'),_0xd4fb('0xe'),_0xd4fb('0xf'),'userpic',_0xd4fb('0x10'),_0xd4fb('0x11'),_0xd4fb('0x12'),_0xd4fb('0x13'),_0xd4fb('0x14'),_0xd4fb('0x15'),_0xd4fb('0x16'),'openchannelPause',_0xd4fb('0x17'),_0xd4fb('0x18'),_0xd4fb('0x19'),'lastPauseAt',_0xd4fb('0x1a'),_0xd4fb('0x1b'),_0xd4fb('0x1c'),_0xd4fb('0x1d'),'phoneBarAutoAnswer',_0xd4fb('0x1e'),'phoneBarDnd',_0xd4fb('0x1f'),_0xd4fb('0x20'),_0xd4fb('0x21'),_0xd4fb('0x22'),_0xd4fb('0x23'),_0xd4fb('0x24'),_0xd4fb('0x25'),'hotdesk',_0xd4fb('0x26'),_0xd4fb('0x27'),'privacyEnabled',_0xd4fb('0x28'),_0xd4fb('0x29'),_0xd4fb('0x2a'),'downloadOmnichannelInteractions',_0xd4fb('0x2b'),_0xd4fb('0x2c'),_0xd4fb('0x2d'),_0xd4fb('0x2e'),_0xd4fb('0x2f'),_0xd4fb('0x30'),_0xd4fb('0x31'),_0xd4fb('0x32'),'smsAutoanswerDelay','openchannelAutoanswer',_0xd4fb('0x33'),_0xd4fb('0x34'),_0xd4fb('0x35'),_0xd4fb('0x36'),_0xd4fb('0x37'),_0xd4fb('0x38')];exports[_0xd4fb('0x39')]=function(){return this[_0xd4fb('0x3a')](!![])[_0xd4fb('0x3b')](function(_0x1cb5a1,_0x24be56,_0x1da447){if(_0x1cb5a1[_0xd4fb('0x3c')]){_0x1da447();}else{return db[_0xd4fb('0x3d')][_0xd4fb('0x3e')]({'where':{'id':_0x1cb5a1[_0xd4fb('0x3f')]['id']},'attributes':['id',_0xd4fb('0x40'),_0xd4fb('0x41')],'raw':!![]})['then'](function(_0x35facb){if(_0x35facb&&_0x35facb[_0xd4fb('0x40')]&&!_0x1cb5a1[_0xd4fb('0x42')]['forceDownload']){return _0x24be56[_0xd4fb('0x43')](_0x35facb[_0xd4fb('0x41')]===_0xd4fb('0x44')?0x195:0x193)[_0xd4fb('0x45')]({'message':_0x35facb[_0xd4fb('0x41')]==='unmanaged'?_0xd4fb('0x46'):_0xd4fb('0x47')});}else{_0x1da447();}})[_0xd4fb('0x48')](function(_0x179fdd){_0x1da447(_0x179fdd);});}});};exports['isAuthenticated']=function isAuthenticated(_0x52872c){return compose()[_0xd4fb('0x3b')](function(_0x315262,_0x1e7c37,_0x11c6ad){var _0xe3fd88;if(_0x315262['headers']['authorization']){if(_[_0xd4fb('0x49')](_0x315262[_0xd4fb('0x4a')][_0xd4fb('0x4b')],_0xd4fb('0x4c'))){var _0x590907=basicAuth(_0x315262);db[_0xd4fb('0x4d')]['find']({'where':{'name':_0x590907[_0xd4fb('0xd')]}})[_0xd4fb('0x4e')](function(_0x2ebcaf){if(!_0x2ebcaf||!_0x2ebcaf[_0xd4fb('0x4f')](_0x590907[_0xd4fb('0x50')])){return _0x1e7c37[_0xd4fb('0x43')](0x191)[_0xd4fb('0x45')]({'message':_0xd4fb('0x51')});}_0x315262[_0xd4fb('0x3c')]={'id':_0x2ebcaf['id']};_0x11c6ad();})['catch'](function(_0x46224e){_0x11c6ad(_0x46224e);});}else if(_[_0xd4fb('0x49')](_0x315262['headers'][_0xd4fb('0x4b')],_0xd4fb('0x52'))){validateJwt(_0x315262,_0x1e7c37,_0x11c6ad);}else{if(_0x52872c){_0x11c6ad();}else{return _0x1e7c37[_0xd4fb('0x43')](0x193)[_0xd4fb('0x45')]({'message':_0xd4fb('0x53')});}}}else if(_0x315262[_0xd4fb('0x42')][_0xd4fb('0x54')]){try{var _0x3c9cfb={'audience':hardwareConf[_0xd4fb('0x55')](),'issuer':hardwareConf[_0xd4fb('0x55')]()};verifyJwt(_0x315262['query']['apikey'],_0x3c9cfb)[_0xd4fb('0x4e')](function(_0x41cf14){return db[_0xd4fb('0x4d')][_0xd4fb('0x56')]({'where':{'id':_0x41cf14['sub']}})['then'](function(_0x1cd117){_0xe3fd88=_0x1cd117;return db[_0xd4fb('0x57')][_0xd4fb('0x3e')]({'where':{'id':0x1},'attributes':[_0xd4fb('0x58'),_0xd4fb('0x59')],'raw':!![]});})[_0xd4fb('0x4e')](function(_0x2168a6){if(!_0xe3fd88||!_[_0xd4fb('0x5a')](_0xe3fd88[_0xd4fb('0x5b')],_0x41cf14['nonce'])){return _0x1e7c37[_0xd4fb('0x43')](0x191)[_0xd4fb('0x45')]({'message':_0xd4fb('0x5c')});}if(_0xe3fd88['disabled']){return _0x1e7c37[_0xd4fb('0x43')](0x191)[_0xd4fb('0x45')]({'message':_0xd4fb('0x5d')});}if(_0xe3fd88[_0xd4fb('0x5e')]){if(_0x2168a6[_0xd4fb('0x59')]>0x0){if(moment(_0xe3fd88['blockedAt'])[_0xd4fb('0x5f')](_0x2168a6['blockDuration'],_0xd4fb('0x60'))>moment()){return _0x1e7c37['status'](0x191)[_0xd4fb('0x45')]({'message':_0xd4fb('0x5d')});}}else{return _0x1e7c37[_0xd4fb('0x43')](0x191)[_0xd4fb('0x45')]({'message':_0xd4fb('0x5d')});}}_0x315262[_0xd4fb('0x3c')]={'id':_0xe3fd88['id']};_0x11c6ad();});})[_0xd4fb('0x48')](function(){return _0x1e7c37['status'](0x191)[_0xd4fb('0x45')]({'message':_0xd4fb('0x5d')});});}catch(_0x568647){_0x11c6ad(_0x568647);}}else if(_0x52872c){_0x11c6ad();}else{return _0x1e7c37['status'](0x193)[_0xd4fb('0x45')]({'message':_0xd4fb('0x53')});}})[_0xd4fb('0x3b')](function(_0x4c81f6,_0x9650ca,_0xa112c7){if(_0x4c81f6[_0xd4fb('0x3c')]){db[_0xd4fb('0x4d')][_0xd4fb('0x56')]({'where':{'id':_0x4c81f6[_0xd4fb('0x3c')]['id']},'attributes':userAttributes})[_0xd4fb('0x4e')](function(_0x4e3aac){if(!_0x4e3aac){return _0x9650ca[_0xd4fb('0x43')](0x194)[_0xd4fb('0x45')]({'message':_0xd4fb('0x61')});}_0x4c81f6[_0xd4fb('0x3c')]=_0x4e3aac;_0xa112c7();})[_0xd4fb('0x48')](function(_0x40cdf3){_0xa112c7(_0x40cdf3);});}else if(_0x52872c){_0xa112c7();}else{return _0x9650ca[_0xd4fb('0x43')](0x194)[_0xd4fb('0x45')]({'message':_0xd4fb('0x62')});}});};exports['canUpdate']=function canUpdate(){return compose()[_0xd4fb('0x3b')](function(_0x4bfde8,_0x4e1695,_0x3e41f0){return licenseUtil[_0xd4fb('0x63')]()[_0xd4fb('0x4e')](function(_0x48f946){if(_0x48f946[_0xd4fb('0x64')]){_0x3e41f0();}else{return _0x4e1695[_0xd4fb('0x43')](0x193)[_0xd4fb('0x45')]({'message':_0xd4fb('0x65')});}})[_0xd4fb('0x48')](function(_0x4d2aff){_0x3e41f0(_0x4d2aff);});});};exports[_0xd4fb('0x66')]=function isWebrtcLicence(){return compose()[_0xd4fb('0x3b')](function(_0x530e1d,_0x5b7707,_0x206eb7){return licenseUtil[_0xd4fb('0x63')]()['then'](function(_0x3678fb){if(_0x3678fb[_0xd4fb('0x67')]){_0x206eb7();}else{return _0x5b7707[_0xd4fb('0x43')](0x193)['json']({'message':_0xd4fb('0x65')});}})[_0xd4fb('0x48')](function(_0x1893e1){_0x206eb7(_0x1893e1);});});};exports[_0xd4fb('0x68')]=function(_0x440596,_0x398365,_0x3ec84b){_0x440596[_0xd4fb('0x68')]=!![];return _0x3ec84b();};exports[_0xd4fb('0x69')]=function signToken(_0x43a294){return signJwt(_0x43a294);};exports['setTokenCookie']=function(_0x5d9b25,_0x2ca6e9){if(!_0x5d9b25[_0xd4fb('0x3c')]){return _0x2ca6e9[_0xd4fb('0x43')](0x194)[_0xd4fb('0x45')]({'message':'It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.'});}var _0x63dc0e={'payload':{'id':_0x5d9b25[_0xd4fb('0x3c')]['id'],'role':_0x5d9b25[_0xd4fb('0x3c')][_0xd4fb('0x6a')]},'options':{'expiresIn':0x15180}};return signJwt(_0x63dc0e)[_0xd4fb('0x4e')](function(_0x5bd4d4){_0x2ca6e9[_0xd4fb('0x6b')](_0xd4fb('0x6c'),_0x5bd4d4);_0x2ca6e9[_0xd4fb('0x6d')]('/dashboards/general');})[_0xd4fb('0x48')](function(_0x55fa08){return _0x2ca6e9[_0xd4fb('0x43')](0x1f4)[_0xd4fb('0x6e')](_0x55fa08);});};exports['retrieveApiKey']=function(_0x46b942){if(_[_0xd4fb('0x6f')](_0x46b942['apiKeyNonce'])||_['isNil'](_0x46b942[_0xd4fb('0x70')])){return null;}else{return createJwt(_0x46b942);}};exports[_0xd4fb('0x71')]=function(_0x24fde3){_0x24fde3[_0xd4fb('0x5b')]=generateNonce();_0x24fde3[_0xd4fb('0x70')]=generateIssuedAt();return createJwt(_0x24fde3);};exports['regenerateApiKey']=function(_0x3a971c,_0x2465d7){var _0x3a1856=_0x3a971c[_0xd4fb('0x42')][_0xd4fb('0x54')];if(_0x3a1856){var _0x12bb9c={'nonce':_0x2465d7['apiKeyNonce'],'iat':_0x2465d7[_0xd4fb('0x70')],'audience':hardwareConf[_0xd4fb('0x55')](),'issuer':hardwareConf[_0xd4fb('0x55')]()};return verifyJwt(_0x3a1856,_0x12bb9c)[_0xd4fb('0x4e')](function(){return generateApiKey(_0x2465d7);});}else{throw{'message':_0xd4fb('0x72')};}};exports[_0xd4fb('0x73')]=function(_0x5a8a60){var _0x5ac99e=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x5ac99e[_0xd4fb('0x74')](_0x5a8a60))throw new db[(_0xd4fb('0x75'))][(_0xd4fb('0x76'))](_0xd4fb('0x77'));return;};exports[_0xd4fb('0x78')]=function(_0x56e092,_0x545ed0,_0x3d4f61){var _0x206afa=encryptor[_0xd4fb('0x79')](_0x545ed0)['split'](',');for(var _0x1064d6=0x0;_0x1064d6<_0x3d4f61;_0x1064d6++){if(!_0x206afa[_0x1064d6])break;if(_0x56e092[_0xd4fb('0x7a')]()===_0x206afa[_0x1064d6]['toLowerCase']()){var _0x567cd2=util['format'](_0xd4fb('0x7b'),_0x3d4f61);if(_0x3d4f61===0x1){_0x567cd2='The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.';}throw new db[(_0xd4fb('0x75'))][(_0xd4fb('0x76'))](_0x567cd2);}}return;};exports[_0xd4fb('0x7c')]=function(_0x45f263,_0x2d0dde){var _0x1f94f2=_0x2d0dde?encryptor[_0xd4fb('0x79')](_0x2d0dde)['split'](','):[];if(_0x1f94f2['length']===0x5){_0x1f94f2['splice'](-0x1,0x1);}_0x1f94f2[_0xd4fb('0x7d')](_0x45f263);return encryptor[_0xd4fb('0x7e')](_0x1f94f2[_0xd4fb('0x7f')](','));};function signJwt(_0xbd25a8){var _0x52030b=BPromise['promisify'](jwt[_0xd4fb('0x80')],{'context':jwt});var _0x232610=_0xbd25a8[_0xd4fb('0x81')]||config['secrets']['session'];return new BPromise(function(_0x3acfb6,_0x55e018){_0x52030b(_0xbd25a8['payload'],_0x232610,_0xbd25a8[_0xd4fb('0x82')])['then'](function(_0x173030){_0x3acfb6(_0x173030);})['catch'](function(_0x36f4b8){_0x55e018(_0x36f4b8);});});}function verifyJwt(_0x4e46c9,_0x3ba167,_0x54c64b){var _0x207edb=BPromise[_0xd4fb('0x83')](jwt[_0xd4fb('0x84')],{'context':jwt});var _0x8733a3=_0x54c64b||config[_0xd4fb('0xb')]['session'];return new BPromise(function(_0x49cc41,_0x15598b){_0x207edb(_0x4e46c9,_0x8733a3,_0x3ba167)['then'](function(_0x366c5a){_0x49cc41(_0x366c5a);})['catch'](function(_0x183f8b){_0x15598b(_0x183f8b);});});}function generateNonce(){return crypto[_0xd4fb('0x85')](0x10)['toString'](_0xd4fb('0x86'));}function generateIssuedAt(){return Math[_0xd4fb('0x87')](Date['now']()/0x3e8)[_0xd4fb('0x88')]();}function createJwt(_0x577fd5){var _0x1146c7={'payload':{'iat':_0x577fd5[_0xd4fb('0x70')],'nonce':_0x577fd5[_0xd4fb('0x5b')]},'options':{'algorithm':_0xd4fb('0x89'),'subject':_0x577fd5['id'][_0xd4fb('0x88')](),'issuer':hardwareConf['getUuid'](),'audience':hardwareConf[_0xd4fb('0x55')]()}};return signJwt(_0x1146c7)[_0xd4fb('0x4e')](function(_0x496fb9){return{'iat':_0x577fd5[_0xd4fb('0x70')],'nonce':_0x577fd5['apiKeyNonce'],'token':_0x496fb9};});} \ No newline at end of file +var _0x041a=['moment','secrets','session','role','fullname','name','internal','email','userpic','permissions','md5secret','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','pauseType','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','interface','userProfileId','privacyEnabled','settingsEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','ignorePauseForPreviewCalls','selectRecallMeCampaign','chatAutoanswer','chatAutoanswerDelay','emailAutoanswer','emailAutoanswerDelay','smsAutoanswer','smsAutoanswerDelay','openchannelAutoanswer','openchannelAutoanswerDelay','faxAutoanswerDelay','whatsappAutoanswer','whatsappAutoanswerDelay','isChatInteractionAuthorized','isAuthenticated','user','ChatInteraction','disposition','closed','query','forceDownload','status','json','unmanaged','Unmanaged.','Forbidden.','catch','use','headers','startsWith','find','authenticate','pass','Wrong\x20credentials.','Bearer','Unknown\x20authorization\x20format','apikey','getUuid','then','User','Setting','findOne','allowedLoginAttempts','blockDuration','isEqual','apiKeyNonce','nonce','disabled','Invalid\x20API\x20access\x20key','blocked','blockedAt','add','minutes','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','getLicense','Forbidden','webrtc','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','redirect','/dashboards/general','send','retrieveApiKey','isNil','apiKeyIat','generateApiKey','regenerateApiKey','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~!@#$%^&-_=+[{]}.','toLowerCase','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','decryptString','split','length','splice','encryptString','join','promisify','secret','payload','options','verify','randomBytes','toString','hex','floor','now','../../mysqldb','../../config/license/hardware','../../config/license/util','../encryptor','lodash','jsonwebtoken','express-jwt','composable-middleware','basic-auth','crypto','util'];(function(_0x546b26,_0x4976a0){var _0x227467=function(_0x3693a0){while(--_0x3693a0){_0x546b26['push'](_0x546b26['shift']());}};_0x227467(++_0x4976a0);}(_0x041a,0x125));var _0xa041=function(_0x305cf2,_0x1d6c49){_0x305cf2=_0x305cf2-0x0;var _0x129d08=_0x041a[_0x305cf2];return _0x129d08;};'use strict';var db=require(_0xa041('0x0'))['db'];var config=require('../../config/environment');var hardwareConf=require(_0xa041('0x1'));var licenseUtil=require(_0xa041('0x2'));var encryptor=require(_0xa041('0x3'));var _=require(_0xa041('0x4'));var jwt=require(_0xa041('0x5'));var expressJwt=require(_0xa041('0x6'));var compose=require(_0xa041('0x7'));var basicAuth=require(_0xa041('0x8'));var crypto=require(_0xa041('0x9'));var BPromise=require('bluebird');var util=require(_0xa041('0xa'));var moment=require(_0xa041('0xb'));var validateJwt=expressJwt({'secret':config[_0xa041('0xc')][_0xa041('0xd')]});var userAttributes=['id',_0xa041('0xe'),_0xa041('0xf'),_0xa041('0x10'),_0xa041('0x11'),_0xa041('0x12'),_0xa041('0x13'),_0xa041('0x14'),_0xa041('0x15'),_0xa041('0x16'),_0xa041('0x17'),_0xa041('0x18'),_0xa041('0x19'),_0xa041('0x1a'),_0xa041('0x1b'),_0xa041('0x1c'),_0xa041('0x1d'),_0xa041('0x1e'),_0xa041('0x1f'),_0xa041('0x20'),_0xa041('0x21'),_0xa041('0x22'),_0xa041('0x23'),_0xa041('0x24'),_0xa041('0x25'),_0xa041('0x26'),_0xa041('0x27'),'phoneBarEnableDtmfTone',_0xa041('0x28'),_0xa041('0x29'),_0xa041('0x2a'),_0xa041('0x2b'),_0xa041('0x2c'),_0xa041('0x2d'),_0xa041('0x2e'),_0xa041('0x2f'),_0xa041('0x30'),_0xa041('0x31'),_0xa041('0x32'),_0xa041('0x33'),_0xa041('0x34'),_0xa041('0x35'),_0xa041('0x36'),_0xa041('0x37'),_0xa041('0x38'),_0xa041('0x39'),_0xa041('0x3a'),_0xa041('0x3b'),_0xa041('0x3c'),_0xa041('0x3d'),_0xa041('0x3e'),_0xa041('0x3f'),'faxAutoanswer',_0xa041('0x40'),_0xa041('0x41'),_0xa041('0x42'),'messengerSoundNotification'];exports[_0xa041('0x43')]=function(){return this[_0xa041('0x44')](!![])['use'](function(_0x4664a7,_0x51cbb7,_0x588c75){if(_0x4664a7[_0xa041('0x45')]){_0x588c75();}else{return db[_0xa041('0x46')]['findOne']({'where':{'id':_0x4664a7['params']['id']},'attributes':['id','closed',_0xa041('0x47')],'raw':!![]})['then'](function(_0x5e93aa){if(_0x5e93aa&&_0x5e93aa[_0xa041('0x48')]&&!_0x4664a7[_0xa041('0x49')][_0xa041('0x4a')]){return _0x51cbb7[_0xa041('0x4b')](_0x5e93aa['disposition']==='unmanaged'?0x195:0x193)[_0xa041('0x4c')]({'message':_0x5e93aa['disposition']===_0xa041('0x4d')?_0xa041('0x4e'):_0xa041('0x4f')});}else{_0x588c75();}})[_0xa041('0x50')](function(_0xbbcc52){_0x588c75(_0xbbcc52);});}});};exports[_0xa041('0x44')]=function isAuthenticated(_0x4cc0e6){return compose()[_0xa041('0x51')](function(_0x58dded,_0x2853f3,_0x5e3e1b){var _0x11fcd5;if(_0x58dded[_0xa041('0x52')]['authorization']){if(_[_0xa041('0x53')](_0x58dded[_0xa041('0x52')]['authorization'],'Basic')){var _0x5005a6=basicAuth(_0x58dded);db['User'][_0xa041('0x54')]({'where':{'name':_0x5005a6['name']}})['then'](function(_0x4153a3){if(!_0x4153a3||!_0x4153a3[_0xa041('0x55')](_0x5005a6[_0xa041('0x56')])){return _0x2853f3[_0xa041('0x4b')](0x191)['json']({'message':_0xa041('0x57')});}_0x58dded['user']={'id':_0x4153a3['id']};_0x5e3e1b();})['catch'](function(_0x216c31){_0x5e3e1b(_0x216c31);});}else if(_['startsWith'](_0x58dded[_0xa041('0x52')]['authorization'],_0xa041('0x58'))){validateJwt(_0x58dded,_0x2853f3,_0x5e3e1b);}else{if(_0x4cc0e6){_0x5e3e1b();}else{return _0x2853f3['status'](0x193)['json']({'message':_0xa041('0x59')});}}}else if(_0x58dded[_0xa041('0x49')][_0xa041('0x5a')]){try{var _0x32f291={'audience':hardwareConf[_0xa041('0x5b')](),'issuer':hardwareConf[_0xa041('0x5b')]()};verifyJwt(_0x58dded[_0xa041('0x49')]['apikey'],_0x32f291)[_0xa041('0x5c')](function(_0xbfa1bb){return db[_0xa041('0x5d')][_0xa041('0x54')]({'where':{'id':_0xbfa1bb['sub']}})[_0xa041('0x5c')](function(_0x36de60){_0x11fcd5=_0x36de60;return db[_0xa041('0x5e')][_0xa041('0x5f')]({'where':{'id':0x1},'attributes':[_0xa041('0x60'),_0xa041('0x61')],'raw':!![]});})['then'](function(_0x2f4d41){if(!_0x11fcd5||!_[_0xa041('0x62')](_0x11fcd5[_0xa041('0x63')],_0xbfa1bb[_0xa041('0x64')])){return _0x2853f3[_0xa041('0x4b')](0x191)['json']({'message':'API\x20access\x20key\x20is\x20not\x20valid\x20anymore'});}if(_0x11fcd5[_0xa041('0x65')]){return _0x2853f3['status'](0x191)[_0xa041('0x4c')]({'message':_0xa041('0x66')});}if(_0x11fcd5[_0xa041('0x67')]){if(_0x2f4d41[_0xa041('0x61')]>0x0){if(moment(_0x11fcd5[_0xa041('0x68')])[_0xa041('0x69')](_0x2f4d41['blockDuration'],_0xa041('0x6a'))>moment()){return _0x2853f3[_0xa041('0x4b')](0x191)[_0xa041('0x4c')]({'message':_0xa041('0x66')});}}else{return _0x2853f3[_0xa041('0x4b')](0x191)[_0xa041('0x4c')]({'message':_0xa041('0x66')});}}_0x58dded[_0xa041('0x45')]={'id':_0x11fcd5['id']};_0x5e3e1b();});})[_0xa041('0x50')](function(){return _0x2853f3[_0xa041('0x4b')](0x191)[_0xa041('0x4c')]({'message':_0xa041('0x66')});});}catch(_0x327094){_0x5e3e1b(_0x327094);}}else if(_0x4cc0e6){_0x5e3e1b();}else{return _0x2853f3[_0xa041('0x4b')](0x193)[_0xa041('0x4c')]({'message':_0xa041('0x59')});}})[_0xa041('0x51')](function(_0x31fac0,_0x4f1675,_0x45dd7e){if(_0x31fac0['user']){db[_0xa041('0x5d')][_0xa041('0x54')]({'where':{'id':_0x31fac0[_0xa041('0x45')]['id']},'attributes':userAttributes})[_0xa041('0x5c')](function(_0x5ca2d2){if(!_0x5ca2d2){return _0x4f1675['status'](0x194)[_0xa041('0x4c')]({'message':_0xa041('0x6b')});}_0x31fac0['user']=_0x5ca2d2;_0x45dd7e();})[_0xa041('0x50')](function(_0x4d3f97){_0x45dd7e(_0x4d3f97);});}else if(_0x4cc0e6){_0x45dd7e();}else{return _0x4f1675[_0xa041('0x4b')](0x194)['json']({'message':_0xa041('0x6c')});}});};exports[_0xa041('0x6d')]=function canUpdate(){return compose()[_0xa041('0x51')](function(_0x16cfea,_0x57582b,_0xbd19bf){return licenseUtil[_0xa041('0x6e')]()[_0xa041('0x5c')](function(_0x540072){if(_0x540072['update']){_0xbd19bf();}else{return _0x57582b[_0xa041('0x4b')](0x193)['json']({'message':_0xa041('0x6f')});}})[_0xa041('0x50')](function(_0x3a9e64){_0xbd19bf(_0x3a9e64);});});};exports['isWebrtcLicence']=function isWebrtcLicence(){return compose()[_0xa041('0x51')](function(_0x4c7657,_0x5f2b2f,_0x544f8b){return licenseUtil[_0xa041('0x6e')]()[_0xa041('0x5c')](function(_0x5a674f){if(_0x5a674f[_0xa041('0x70')]){_0x544f8b();}else{return _0x5f2b2f['status'](0x193)[_0xa041('0x4c')]({'message':_0xa041('0x6f')});}})[_0xa041('0x50')](function(_0x1971a2){_0x544f8b(_0x1971a2);});});};exports[_0xa041('0x71')]=function(_0x30afa5,_0xac8f5f,_0x525e69){_0x30afa5[_0xa041('0x71')]=!![];return _0x525e69();};exports[_0xa041('0x72')]=function signToken(_0x20c207){return signJwt(_0x20c207);};exports[_0xa041('0x73')]=function(_0xe9c6c9,_0x2317c8){if(!_0xe9c6c9[_0xa041('0x45')]){return _0x2317c8[_0xa041('0x4b')](0x194)['json']({'message':_0xa041('0x74')});}var _0x5c84d2={'payload':{'id':_0xe9c6c9[_0xa041('0x45')]['id'],'role':_0xe9c6c9[_0xa041('0x45')][_0xa041('0xe')]},'options':{'expiresIn':0x15180}};return signJwt(_0x5c84d2)[_0xa041('0x5c')](function(_0x4f9dc9){_0x2317c8[_0xa041('0x75')](_0xa041('0x76'),_0x4f9dc9);_0x2317c8[_0xa041('0x77')](_0xa041('0x78'));})[_0xa041('0x50')](function(_0x1dbc82){return _0x2317c8['status'](0x1f4)[_0xa041('0x79')](_0x1dbc82);});};exports[_0xa041('0x7a')]=function(_0x512673){if(_['isNil'](_0x512673[_0xa041('0x63')])||_[_0xa041('0x7b')](_0x512673[_0xa041('0x7c')])){return null;}else{return createJwt(_0x512673);}};exports[_0xa041('0x7d')]=function(_0x3af308){_0x3af308[_0xa041('0x63')]=generateNonce();_0x3af308[_0xa041('0x7c')]=generateIssuedAt();return createJwt(_0x3af308);};exports[_0xa041('0x7e')]=function(_0x3edfc9,_0x280069){var _0x34593b=_0x3edfc9[_0xa041('0x49')][_0xa041('0x5a')];if(_0x34593b){var _0x21e01e={'nonce':_0x280069[_0xa041('0x63')],'iat':_0x280069['apiKeyIat'],'audience':hardwareConf['getUuid'](),'issuer':hardwareConf['getUuid']()};return verifyJwt(_0x34593b,_0x21e01e)['then'](function(){return generateApiKey(_0x280069);});}else{throw{'message':'Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one'};}};exports[_0xa041('0x7f')]=function(_0x501308){var _0x490c06=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x490c06[_0xa041('0x80')](_0x501308))throw new db[(_0xa041('0x81'))][(_0xa041('0x82'))](_0xa041('0x83'));return;};exports['validatePasswordHistory']=function(_0x3e7c1e,_0x4aba56,_0x260424){var _0x44be56=encryptor['decryptString'](_0x4aba56)['split'](',');for(var _0x7dbd31=0x0;_0x7dbd31<_0x260424;_0x7dbd31++){if(!_0x44be56[_0x7dbd31])break;if(_0x3e7c1e[_0xa041('0x84')]()===_0x44be56[_0x7dbd31][_0xa041('0x84')]()){var _0x2298ea=util['format'](_0xa041('0x85'),_0x260424);if(_0x260424===0x1){_0x2298ea=_0xa041('0x86');}throw new db['Sequelize'][(_0xa041('0x82'))](_0x2298ea);}}return;};exports[_0xa041('0x87')]=function(_0x101129,_0x409aab){var _0x187eff=_0x409aab?encryptor[_0xa041('0x88')](_0x409aab)[_0xa041('0x89')](','):[];if(_0x187eff[_0xa041('0x8a')]===0x5){_0x187eff[_0xa041('0x8b')](-0x1,0x1);}_0x187eff['unshift'](_0x101129);return encryptor[_0xa041('0x8c')](_0x187eff[_0xa041('0x8d')](','));};function signJwt(_0x341af0){var _0xf29cd4=BPromise[_0xa041('0x8e')](jwt['sign'],{'context':jwt});var _0x5861da=_0x341af0[_0xa041('0x8f')]||config[_0xa041('0xc')][_0xa041('0xd')];return new BPromise(function(_0x29e513,_0x1d2645){_0xf29cd4(_0x341af0[_0xa041('0x90')],_0x5861da,_0x341af0[_0xa041('0x91')])['then'](function(_0x47e8a4){_0x29e513(_0x47e8a4);})[_0xa041('0x50')](function(_0x42d482){_0x1d2645(_0x42d482);});});}function verifyJwt(_0x2f6455,_0x5d37be,_0x3f93f9){var _0x27743d=BPromise[_0xa041('0x8e')](jwt[_0xa041('0x92')],{'context':jwt});var _0x532683=_0x3f93f9||config[_0xa041('0xc')][_0xa041('0xd')];return new BPromise(function(_0x49ef38,_0x3a4d99){_0x27743d(_0x2f6455,_0x532683,_0x5d37be)[_0xa041('0x5c')](function(_0x5db4f3){_0x49ef38(_0x5db4f3);})['catch'](function(_0x55609f){_0x3a4d99(_0x55609f);});});}function generateNonce(){return crypto[_0xa041('0x93')](0x10)[_0xa041('0x94')](_0xa041('0x95'));}function generateIssuedAt(){return Math[_0xa041('0x96')](Date[_0xa041('0x97')]()/0x3e8)[_0xa041('0x94')]();}function createJwt(_0x38e4a0){var _0x18e4d0={'payload':{'iat':_0x38e4a0[_0xa041('0x7c')],'nonce':_0x38e4a0[_0xa041('0x63')]},'options':{'algorithm':'HS512','subject':_0x38e4a0['id'][_0xa041('0x94')](),'issuer':hardwareConf[_0xa041('0x5b')](),'audience':hardwareConf['getUuid']()}};return signJwt(_0x18e4d0)[_0xa041('0x5c')](function(_0x510ea0){return{'iat':_0x38e4a0[_0xa041('0x7c')],'nonce':_0x38e4a0[_0xa041('0x63')],'token':_0x510ea0};});} \ No newline at end of file diff --git a/server/components/contacts/index.js b/server/components/contacts/index.js index 4de949b..191a558 100644 --- a/server/components/contacts/index.js +++ b/server/components/contacts/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x60e3=['search','tag','countFilteredContacts','count','User','buildContactsQuery','clause','getFilteredContacts','rows','catch','describe','CmContact','keys','cf_','map','CmCustomField','findOne','slice','all','length','fieldType','type','./sql-utils','../../mysqldb','findAll','skipContactsQuery','getContactsSubquery','resolve','then','parseAdvancedSearchFilter','where','default','fields','filter','user','tags','checkListsRestrictions'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0x60e3,0x1ad));var _0x360e=function(_0xed90b5,_0x43f4e4){_0xed90b5=_0xed90b5-0x0;var _0x3a2ef0=_0x60e3[_0xed90b5];return _0x3a2ef0;};'use strict';var _=require('lodash');var sqlUtils=require(_0x360e('0x0'));var db=require(_0x360e('0x1'))['db'];exports[_0x360e('0x2')]=function(_0x2d7813,_0x269968,_0x490c0c,_0x176262){var _0x16f2df={'count':0x0,'rows':[]};var _0x2b6f57=sqlUtils[_0x360e('0x3')](_0x269968,_0x2d7813);if(_0x2b6f57){return Promise['resolve'](_0x16f2df);}var _0x3238fd=sqlUtils[_0x360e('0x4')]();var _0x1bfb0c={};var _0x2415ad=![];var _0x5b5b76=![];return Promise[_0x360e('0x5')]()[_0x360e('0x6')](function(){if(_0x2d7813['search']){return sqlUtils[_0x360e('0x7')](_0x2d7813['search'],_0x176262);}else{return sqlUtils['parseQueryParameters'](_0x2d7813,_0x176262);}})[_0x360e('0x6')](function(_0x4c8ef3){_0x3238fd[_0x360e('0x8')](_0x4c8ef3[_0x360e('0x9')]);_0x3238fd['where'](_0x4c8ef3[_0x360e('0xa')]);_0x3238fd['where'](_0x4c8ef3[_0x360e('0xb')]);_0x3238fd[_0x360e('0x8')](_0x4c8ef3[_0x360e('0xc')]['clause']);_0x1bfb0c=_0x4c8ef3[_0x360e('0xd')];_0x5b5b76=_0x4c8ef3[_0x360e('0xc')]['skip'];return sqlUtils[_0x360e('0xe')](_0x269968,_0x2d7813,_0x5b5b76);})['then'](function(_0x382b50){_0x3238fd['where'](_0x382b50);var _0x439723=_0x2d7813[_0x360e('0xf')]?_0x1bfb0c['ids']:_0x2d7813[_0x360e('0x10')];_0x2415ad=_0x439723?!![]:![];return sqlUtils[_0x360e('0x11')](_0x3238fd,_0x439723);})[_0x360e('0x6')](function(_0x44c4fa){_0x16f2df[_0x360e('0x12')]=_0x44c4fa;if(_0x16f2df[_0x360e('0x12')]===0x0){return;}if(_0x2d7813[_0x360e('0x13')]){_0x5b5b76=!![];}return sqlUtils[_0x360e('0x14')](_0x3238fd,_0x2d7813[_0x360e('0xa')],_0x490c0c,_0x2415ad,_0x1bfb0c[_0x360e('0x15')],_0x5b5b76);})[_0x360e('0x6')](function(_0x428e54){if(!_0x428e54){return[];}return sqlUtils[_0x360e('0x16')](_0x428e54,_0x2d7813,_0x490c0c);})[_0x360e('0x6')](function(_0x2cfa6b){_0x16f2df[_0x360e('0x17')]=_0x2cfa6b;return _0x16f2df;})[_0x360e('0x18')](function(_0x3a27ff){throw _0x3a27ff;});};exports[_0x360e('0x19')]=function(){var _0x2e14fe={};var _0x316728=[];return db[_0x360e('0x1a')][_0x360e('0x19')]()['then'](function(_0x2a03ff){_0x2e14fe=_0x2a03ff;var _0xededdb=Object[_0x360e('0x1b')](_0x2e14fe)[_0x360e('0xb')](function(_0x5d94fb){return _['startsWith'](_0x5d94fb,_0x360e('0x1c'))?_0x5d94fb:undefined;});var _0x4283e0=_0xededdb[_0x360e('0x1d')](function(_0x3ae346){return db[_0x360e('0x1e')][_0x360e('0x1f')]({'where':{'id':_0x3ae346[_0x360e('0x20')](0x3)},'raw':!![]});});return Promise[_0x360e('0x21')](_0x4283e0);})['then'](function(_0x3683bd){for(var _0x1737d=0x0;_0x1737d<_0x3683bd[_0x360e('0x22')];_0x1737d++){if(_0x3683bd[_0x1737d]){var _0xd5aaf2=_0x360e('0x1c')+_0x3683bd[_0x1737d]['id'];_0x2e14fe[_0xd5aaf2][_0x360e('0x23')]=_0x3683bd[_0x1737d][_0x360e('0x24')];}}_0x316728=_[_0x360e('0x1d')](Object[_0x360e('0x1b')](_0x2e14fe),function(_0x1ef8ec){return{'name':_0x1ef8ec,'type':_0x2e14fe[_0x1ef8ec][_0x360e('0x24')]};});return _0x316728;})[_0x360e('0x18')](function(_0x58faa4){throw _0x58faa4;});}; \ No newline at end of file +var _0x084e=['rows','catch','describe','CmContact','keys','startsWith','cf_','map','CmCustomField','findOne','all','length','fieldType','type','getContactsSubquery','resolve','then','search','parseAdvancedSearchFilter','parseQueryParameters','where','default','filter','user','skip','checkListsRestrictions','ids','tag','countFilteredContacts','count','User','clause','getFilteredContacts'];(function(_0x530f38,_0x516868){var _0x568fd6=function(_0x36c109){while(--_0x36c109){_0x530f38['push'](_0x530f38['shift']());}};_0x568fd6(++_0x516868);}(_0x084e,0x1dc));var _0xe084=function(_0x166acc,_0x111e4e){_0x166acc=_0x166acc-0x0;var _0x209f4d=_0x084e[_0x166acc];return _0x209f4d;};'use strict';var _=require('lodash');var sqlUtils=require('./sql-utils');var db=require('../../mysqldb')['db'];exports['findAll']=function(_0x52a3a7,_0x2d1442,_0x1ed9d5,_0x5661fb){var _0x3cc369={'count':0x0,'rows':[]};var _0x36684d=sqlUtils['skipContactsQuery'](_0x2d1442,_0x52a3a7);if(_0x36684d){return Promise['resolve'](_0x3cc369);}var _0xf8b2dc=sqlUtils[_0xe084('0x0')]();var _0x11494d={};var _0x33318d=![];var _0x4dd0d5=![];return Promise[_0xe084('0x1')]()[_0xe084('0x2')](function(){if(_0x52a3a7[_0xe084('0x3')]){return sqlUtils[_0xe084('0x4')](_0x52a3a7[_0xe084('0x3')],_0x5661fb);}else{return sqlUtils[_0xe084('0x5')](_0x52a3a7,_0x5661fb);}})[_0xe084('0x2')](function(_0x46f5a9){_0xf8b2dc[_0xe084('0x6')](_0x46f5a9[_0xe084('0x7')]);_0xf8b2dc[_0xe084('0x6')](_0x46f5a9['fields']);_0xf8b2dc[_0xe084('0x6')](_0x46f5a9[_0xe084('0x8')]);_0xf8b2dc[_0xe084('0x6')](_0x46f5a9[_0xe084('0x9')]['clause']);_0x11494d=_0x46f5a9['tags'];_0x4dd0d5=_0x46f5a9[_0xe084('0x9')][_0xe084('0xa')];return sqlUtils[_0xe084('0xb')](_0x2d1442,_0x52a3a7,_0x4dd0d5);})[_0xe084('0x2')](function(_0x489dd3){_0xf8b2dc[_0xe084('0x6')](_0x489dd3);var _0x373251=_0x52a3a7['search']?_0x11494d[_0xe084('0xc')]:_0x52a3a7[_0xe084('0xd')];_0x33318d=_0x373251?!![]:![];return sqlUtils[_0xe084('0xe')](_0xf8b2dc,_0x373251);})[_0xe084('0x2')](function(_0x46b374){_0x3cc369[_0xe084('0xf')]=_0x46b374;if(_0x3cc369['count']===0x0){return;}if(_0x52a3a7[_0xe084('0x10')]){_0x4dd0d5=!![];}return sqlUtils['buildContactsQuery'](_0xf8b2dc,_0x52a3a7['fields'],_0x1ed9d5,_0x33318d,_0x11494d[_0xe084('0x11')],_0x4dd0d5);})[_0xe084('0x2')](function(_0x24c3c7){if(!_0x24c3c7){return[];}return sqlUtils[_0xe084('0x12')](_0x24c3c7,_0x52a3a7,_0x1ed9d5);})[_0xe084('0x2')](function(_0x195965){_0x3cc369[_0xe084('0x13')]=_0x195965;return _0x3cc369;})[_0xe084('0x14')](function(_0x1e79ee){throw _0x1e79ee;});};exports[_0xe084('0x15')]=function(){var _0x1d2f6a={};var _0x46eb73=[];return db[_0xe084('0x16')]['describe']()[_0xe084('0x2')](function(_0x2a1ffa){_0x1d2f6a=_0x2a1ffa;var _0x1b1edd=Object[_0xe084('0x17')](_0x1d2f6a)['filter'](function(_0x76fac9){return _[_0xe084('0x18')](_0x76fac9,_0xe084('0x19'))?_0x76fac9:undefined;});var _0x4a23a4=_0x1b1edd[_0xe084('0x1a')](function(_0x38cfa5){return db[_0xe084('0x1b')][_0xe084('0x1c')]({'where':{'id':_0x38cfa5['slice'](0x3)},'raw':!![]});});return Promise[_0xe084('0x1d')](_0x4a23a4);})[_0xe084('0x2')](function(_0xe90fd7){for(var _0x2bbc26=0x0;_0x2bbc26<_0xe90fd7[_0xe084('0x1e')];_0x2bbc26++){if(_0xe90fd7[_0x2bbc26]){var _0x36890c=_0xe084('0x19')+_0xe90fd7[_0x2bbc26]['id'];_0x1d2f6a[_0x36890c][_0xe084('0x1f')]=_0xe90fd7[_0x2bbc26][_0xe084('0x20')];}}_0x46eb73=_[_0xe084('0x1a')](Object[_0xe084('0x17')](_0x1d2f6a),function(_0xb3be10){return{'name':_0xb3be10,'type':_0x1d2f6a[_0xb3be10][_0xe084('0x20')]};});return _0x46eb73;})[_0xe084('0x14')](function(_0x4327cc){throw _0x4327cc;});}; \ No newline at end of file diff --git a/server/components/contacts/sql-utils.js b/server/components/contacts/sql-utils.js index e27fc5a..f890be5 100644 --- a/server/components/contacts/sql-utils.js +++ b/server/components/contacts/sql-utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5d05=['../interaction/utils','agent','autocomplete','true','select','where','c.deletedAt\x20IS\x20NULL','subqry','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20','.id','ct.CmContactId\x20=\x20','tools_tags','lastName','mobile','fax','ListId','CompanyId','updatedAt','deletedAt','TagIds','includes','forEach','GROUP_CONCAT(DISTINCT\x20t.id)','field','expr','getSelectedTags','CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','replace','split','length','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','isNumeric','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','parseSearch','sqlOperator','conditions','find','name','dateOfBirth','fieldType','datetime','castTo','buildExpression','type','default','value','start','end','Tag','map','tags','clause','ids','User','user','and','keys','some','compact','Contact','c.ListId\x20IN\x20?','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','uc.UserId\x20=\x20?','\x20=\x20?','resolve','then','fields','tag','filter','getLists','c.ListId\x20IS\x20NULL','attributes','group','c.id','limit','offset','subqry.id','having','order','DESC','subqry.','from','findAll','color','keyBy','Sequelize','query','toString','Tags','clone','COUNT(*)','isEmpty','t.id\x20IN\x20?','QueryTypes','SELECT','sequelize','exports','lodash','../parsers/advancedSearch','../parsers/qs'];(function(_0x2b9b7f,_0x4d47df){var _0x4ed19a=function(_0x72b5ff){while(--_0x72b5ff){_0x2b9b7f['push'](_0x2b9b7f['shift']());}};_0x4ed19a(++_0x4d47df);}(_0x5d05,0xd3));var _0x55d0=function(_0x3fc31d,_0x432bc9){_0x3fc31d=_0x3fc31d-0x0;var _0x31bb91=_0x5d05[_0x3fc31d];return _0x31bb91;};'use strict';var _=require(_0x55d0('0x0'));var squel=require('squel');var as=require(_0x55d0('0x1'));var qs=require(_0x55d0('0x2'));var utils=require(_0x55d0('0x3'));var db=require('../../mysqldb')['db'];function skipContactsQuery(_0x388a95,_0x1d8634){var _0x18ba43=![];if(_0x388a95['role']===_0x55d0('0x4')&&!_0x1d8634['search']&&!_0x1d8634['ListId']&&_0x1d8634[_0x55d0('0x5')]!==_0x55d0('0x6')){_0x18ba43=!![];}return _0x18ba43;}function getContactsSubquery(){return squel[_0x55d0('0x7')]()['from']('cm_contacts','c')[_0x55d0('0x8')](_0x55d0('0x9'));}function applyJoinClauses(_0x1481b6,_0x2f23cf){var _0x437dcb=_0x2f23cf?'c':_0x55d0('0xa');_0x1481b6[_0x55d0('0xb')](_0x55d0('0xc'),'uc',_0x55d0('0xd')+_0x437dcb+_0x55d0('0xe'))['left_join']('cm_contact_has_tags','ct',_0x55d0('0xf')+_0x437dcb+_0x55d0('0xe'))[_0x55d0('0xb')](_0x55d0('0x10'),'t','t.id\x20=\x20ct.TagId');return _0x1481b6;}function addFieldsToQuery(_0x43c676,_0x1cd871,_0x54596f,_0x32ec5b,_0x30f1ee){var _0x15e062=_0x30f1ee?'c':_0x55d0('0xa');if(!_0x1cd871){_0x1cd871=['id','firstName',_0x55d0('0x11'),'phone',_0x55d0('0x12'),_0x55d0('0x13'),'email',_0x55d0('0x14'),_0x55d0('0x15'),'createdAt',_0x55d0('0x16'),_0x55d0('0x17'),_0x55d0('0x18')];}else if(!_0x1cd871[_0x55d0('0x19')]('id')){_0x1cd871['push']('id');}var _0x4f3570=_0x54596f&&_0x30f1ee||!_0x54596f&&!_0x30f1ee;if(_0x32ec5b){_0x4f3570=_0x32ec5b&&_0x30f1ee||!_0x32ec5b&&!_0x30f1ee;}_0x1cd871[_0x55d0('0x1a')](function(_0x1cf3af){if(_0x1cf3af===_0x55d0('0x18')){if(_0x4f3570){_0x43c676['field'](_0x55d0('0x1b'),_0x1cf3af);}else if(_0x54596f||_0x32ec5b){_0x43c676['field'](_0x15e062+'.'+_0x1cf3af);}}else{_0x43c676[_0x55d0('0x1c')](_0x15e062+'.'+_0x1cf3af);}});return _0x43c676;}function getSqlClauses(){var _0x4cfa08={'default':squel[_0x55d0('0x1d')](),'fields':squel[_0x55d0('0x1d')](),'filter':squel[_0x55d0('0x1d')](),'tags':{'clause':squel[_0x55d0('0x1d')](),'ids':null},'user':{'clause':squel[_0x55d0('0x1d')](),'skip':![]}};return _0x4cfa08;}function parseTagParameter(_0x157dda){var _0x3ea409=squel['expr']();if(_0x157dda){var _0x3e92de=utils[_0x55d0('0x1e')](_0x157dda);_0x3e92de['forEach'](function(_0xcc2cd2){_0x3ea409['or'](_0x55d0('0x1f'),'%,'+_0xcc2cd2+',%');});}return _0x3ea409;}function parseSearchFilter(_0x3b01c0){var _0x583260=squel[_0x55d0('0x1d')]();if(_0x3b01c0){var _0x8d0066=_0x3b01c0[_0x55d0('0x20')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(_0x8d0066[_0x55d0('0x21')]('\x20')[_0x55d0('0x22')]>0x1){_0x583260['or'](_0x55d0('0x23'),qs['getFullTextValue'](_0x8d0066,!![]),null);}else{if(qs[_0x55d0('0x24')](_0x8d0066)){_0x583260['or'](_0x55d0('0x25'),_0x8d0066+'%');_0x583260['or'](_0x55d0('0x26'),_0x8d0066+'%');_0x583260['or'](_0x55d0('0x27'),_0x8d0066+'%');_0x583260['or']('c.fax\x20LIKE\x20?',_0x8d0066+'%');}else if(qs[_0x55d0('0x28')](_0x8d0066)){_0x583260['or'](_0x55d0('0x29'),_0x8d0066+'%');}else{_0x583260['or']('c.firstName\x20LIKE\x20?','%'+_0x8d0066+'%');_0x583260['or']('c.lastName\x20LIKE\x20?','%'+_0x8d0066+'%');_0x583260['or'](_0x55d0('0x29'),'%'+_0x8d0066+'%');}}}return _0x583260;}function parseAdvancedSearchFilter(_0x1b2ed0,_0x4c2bea){var _0x311305=getSqlClauses();var _0x53543e=as[_0x55d0('0x2a')](_0x1b2ed0);var _0x3ee0cc=_0x53543e[_0x55d0('0x2b')];for(var _0x16ab13=0x0;_0x16ab13<_0x53543e[_0x55d0('0x2c')][_0x55d0('0x22')];_0x16ab13++){var _0x332367=_0x53543e[_0x55d0('0x2c')][_0x16ab13];var _0x21fe86='c';var _0x24646a=_[_0x55d0('0x2d')](_0x4c2bea,[_0x55d0('0x2e'),_0x332367[_0x55d0('0x1c')]]);if(_0x24646a){if(_0x332367[_0x55d0('0x1c')]===_0x55d0('0x2f')||_0x24646a[_0x55d0('0x30')]===_0x55d0('0x31')){_0x332367[_0x55d0('0x32')]='DATE';}var _0x4e579f=as[_0x55d0('0x33')](_0x21fe86,_0x24646a[_0x55d0('0x34')],_0x332367);_0x311305[_0x55d0('0x35')][_0x3ee0cc](_0x4e579f['text'],_0x4e579f[_0x55d0('0x36')][_0x55d0('0x37')],_0x4e579f[_0x55d0('0x36')][_0x55d0('0x38')]);}else{if(_0x332367['field']===_0x55d0('0x39')){var _0x19aa51=_0x332367[_0x55d0('0x36')][_0x55d0('0x21')](',')[_0x55d0('0x3a')](function(_0x1664e0){return Number(_0x1664e0);});var _0x18af3d=parseTagParameter(_0x19aa51);_0x311305[_0x55d0('0x3b')][_0x55d0('0x3c')]['and'](_0x18af3d);_0x311305[_0x55d0('0x3b')][_0x55d0('0x3d')]=_0x19aa51;}else if(_0x332367['field']===_0x55d0('0x3e')){_0x311305[_0x55d0('0x3f')][_0x55d0('0x3c')][_0x55d0('0x40')]('uc.UserId\x20=\x20?',_0x332367[_0x55d0('0x36')]);_0x311305['user']['skip']=!![];}}}return _0x311305;}function parseModelFields(_0x336f35,_0xbc3efa){var _0x3f8299=squel[_0x55d0('0x1d')]();var _0x3d1893=_(_0x336f35)[_0x55d0('0x41')]()[_0x55d0('0x3a')](function(_0x144e6a){return _[_0x55d0('0x42')](_0xbc3efa,['name',_0x144e6a])?_0x144e6a:undefined;})[_0x55d0('0x43')]()[_0x55d0('0x36')]();if(_0x336f35[_0x55d0('0x44')]){_0x3d1893['push'](_0x55d0('0x44'));}if(_0x336f35[_0x55d0('0x3e')]){_0x3d1893['push'](_0x55d0('0x3e'));}if(_0x3d1893[_0x55d0('0x22')]>0x0){_0x3d1893[_0x55d0('0x1a')](function(_0x3ffc06){if(_0x3ffc06===_0x55d0('0x14')){_0x3f8299[_0x55d0('0x40')](_0x55d0('0x45'),[][_0x55d0('0x46')](_0x336f35[_0x3ffc06]));}else if(_0x3ffc06===_0x55d0('0x44')){var _0x380a59='%'+_0x336f35[_0x3ffc06]+'%';_0x3f8299[_0x55d0('0x40')](_0x55d0('0x47'),_0x380a59);}else if(_0x3ffc06===_0x55d0('0x3e')){_0x3f8299[_0x55d0('0x40')](_0x55d0('0x48'),_0x336f35[_0x3ffc06]);}else{_0x3f8299[_0x55d0('0x40')]('c.'+_0x3ffc06+_0x55d0('0x49'),_0x336f35[_0x3ffc06]);}});}return _0x3f8299;}function parseQueryParameters(_0x1c9ae9,_0x45da8a){var _0x24889f=getSqlClauses();return Promise[_0x55d0('0x4a')]()[_0x55d0('0x4b')](function(){return parseModelFields(_0x1c9ae9,_0x45da8a);})[_0x55d0('0x4b')](function(_0x28c50c){_0x24889f[_0x55d0('0x4c')][_0x55d0('0x40')](_0x28c50c);return parseTagParameter(_0x1c9ae9[_0x55d0('0x4d')]);})[_0x55d0('0x4b')](function(_0x2b0597){_0x24889f[_0x55d0('0x3b')]['clause']['and'](_0x2b0597);return parseSearchFilter(_0x1c9ae9[_0x55d0('0x4e')]);})[_0x55d0('0x4b')](function(_0x39427b){_0x24889f[_0x55d0('0x4e')]=_0x39427b;return _0x24889f;});}function checkListsRestrictions(_0x5aa4df,_0x105d38,_0x44a06c){var _0x3aab25=squel[_0x55d0('0x1d')]();return Promise['resolve']()[_0x55d0('0x4b')](function(){if(_0x105d38['search']&&_0x5aa4df['role']==='agent'&&!_0x44a06c){return _0x5aa4df[_0x55d0('0x4f')]({'attributes':['id'],'raw':!![]});}})[_0x55d0('0x4b')](function(_0x308bac){if(_0x308bac){if(_0x308bac[_0x55d0('0x22')]===0x0){_0x3aab25[_0x55d0('0x40')](_0x55d0('0x50'));}else{_0x3aab25[_0x55d0('0x40')](_0x55d0('0x45'),_[_0x55d0('0x3a')](_0x308bac,'id'));}}})[_0x55d0('0x4b')](function(){return _0x3aab25;});}function buildContactsQuery(_0x41ee72,_0x5b9de2,_0x111c25,_0x48269d,_0x5ec98f,_0x58ea00){if(_0x5b9de2){_0x5b9de2=_0x111c25[_0x55d0('0x51')];}_0x41ee72=addFieldsToQuery(_0x41ee72,_0x5b9de2,_0x48269d,_0x58ea00,!![]);var _0x313f49=squel[_0x55d0('0x7')]();_0x313f49=addFieldsToQuery(_0x313f49,_0x5b9de2,_0x48269d,_0x58ea00,![]);if(_0x48269d||_0x58ea00){_0x41ee72=applyJoinClauses(_0x41ee72,!![]);_0x41ee72[_0x55d0('0x52')](_0x55d0('0x53'));if(_0x111c25[_0x55d0('0x54')]){_0x313f49[_0x55d0('0x54')](_0x111c25[_0x55d0('0x54')]);}if(_0x111c25[_0x55d0('0x55')]){_0x313f49[_0x55d0('0x55')](_0x111c25[_0x55d0('0x55')]);}}else{_0x313f49=applyJoinClauses(_0x313f49,![]);_0x313f49[_0x55d0('0x52')](_0x55d0('0x56'));if(_0x111c25[_0x55d0('0x54')]){_0x41ee72['limit'](_0x111c25[_0x55d0('0x54')]);}if(_0x111c25['offset']){_0x41ee72[_0x55d0('0x55')](_0x111c25[_0x55d0('0x55')]);}}_0x313f49[_0x55d0('0x57')](_0x5ec98f);if(_0x111c25[_0x55d0('0x58')]){_0x111c25[_0x55d0('0x58')][_0x55d0('0x1a')](function(_0x28a3e1){_0x41ee72['order']('c.'+_0x28a3e1[0x0],_0x28a3e1[0x1]===_0x55d0('0x59')?![]:!![]);_0x313f49[_0x55d0('0x58')](_0x55d0('0x5a')+_0x28a3e1[0x0],_0x28a3e1[0x1]==='DESC'?![]:!![]);});}_0x313f49[_0x55d0('0x5b')](_0x41ee72,'subqry');return _0x313f49;}function getFilteredContacts(_0x2cd7ef){var _0x3e3d79=[];return db['Tag'][_0x55d0('0x5c')]({'attributes':['id',_0x55d0('0x2e'),_0x55d0('0x5d')],'raw':!![]})[_0x55d0('0x4b')](function(_0x16917f){_0x3e3d79=_[_0x55d0('0x5e')](_0x16917f,'id');var _0x3b4e99={'type':db[_0x55d0('0x5f')]['QueryTypes']['SELECT'],'model':db['CmContact'],'mapToModel':!![],'nest':!![],'raw':!![]};return db['sequelize'][_0x55d0('0x60')](_0x2cd7ef[_0x55d0('0x61')](),_0x3b4e99);})['then'](function(_0x4a417b){_0x4a417b[_0x55d0('0x1a')](function(_0x26454e){if(_0x26454e['TagIds']){_0x26454e[_0x55d0('0x62')]=[];_0x26454e[_0x55d0('0x18')][_0x55d0('0x21')](',')['forEach'](function(_0x5b2e9c){_0x26454e[_0x55d0('0x62')]['push'](_0x3e3d79[_0x5b2e9c]);});}delete _0x26454e[_0x55d0('0x18')];});return _0x4a417b;});}function countFilteredContacts(_0x50b942,_0x281dde){var _0x263bad=_0x50b942[_0x55d0('0x63')]();_0x263bad[_0x55d0('0x1c')](_0x55d0('0x64'));_0x263bad=applyJoinClauses(_0x263bad,!![]);_0x50b942[_0x55d0('0x52')]('c.id');var _0x2d4b25=utils['getSelectedTags'](_0x281dde);if(!_[_0x55d0('0x65')](_0x2d4b25)){_0x263bad[_0x55d0('0x8')](_0x55d0('0x66'),_0x2d4b25);}var _0x2c5f95={'type':db[_0x55d0('0x5f')][_0x55d0('0x67')][_0x55d0('0x68')],'raw':!![]};return db[_0x55d0('0x69')][_0x55d0('0x60')](_0x263bad['toString'](),_0x2c5f95)[_0x55d0('0x4b')](function(_0x31b444){return _0x31b444[0x0][_0x55d0('0x64')];});}module[_0x55d0('0x6a')]={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery}; \ No newline at end of file +var _0x1866=['conditions','find','dateOfBirth','fieldType','datetime','castTo','DATE','buildExpression','type','text','value','end','Tag','map','tags','clause','and','ids','user','uc.UserId\x20=\x20?','skip','keys','some','name','Contact','push','User','c.ListId\x20IN\x20?','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','resolve','then','fields','tag','search','attributes','c.id','limit','offset','group','subqry.id','having','order','DESC','subqry.','keyBy','SELECT','CmContact','query','toString','Tags','COUNT(*)','isEmpty','Sequelize','QueryTypes','sequelize','exports','lodash','squel','../parsers/advancedSearch','../parsers/qs','../interaction/utils','../../mysqldb','role','agent','autocomplete','true','select','from','cm_contacts','where','c.deletedAt\x20IS\x20NULL','left_join','uc.CmContactId\x20=\x20','ct.CmContactId\x20=\x20','.id','tools_tags','t.id\x20=\x20ct.TagId','subqry','firstName','lastName','phone','mobile','fax','email','ListId','CompanyId','createdAt','updatedAt','deletedAt','TagIds','includes','forEach','GROUP_CONCAT(DISTINCT\x20t.id)','field','expr','getSelectedTags','CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','replace','split','length','getFullTextValue','c.id\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','sqlOperator'];(function(_0x376f19,_0x539869){var _0x48886d=function(_0x234c62){while(--_0x234c62){_0x376f19['push'](_0x376f19['shift']());}};_0x48886d(++_0x539869);}(_0x1866,0xa5));var _0x6186=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x1866[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0x6186('0x0'));var squel=require(_0x6186('0x1'));var as=require(_0x6186('0x2'));var qs=require(_0x6186('0x3'));var utils=require(_0x6186('0x4'));var db=require(_0x6186('0x5'))['db'];function skipContactsQuery(_0x4d1849,_0x2b15d7){var _0x1442bc=![];if(_0x4d1849[_0x6186('0x6')]===_0x6186('0x7')&&!_0x2b15d7['search']&&!_0x2b15d7['ListId']&&_0x2b15d7[_0x6186('0x8')]!==_0x6186('0x9')){_0x1442bc=!![];}return _0x1442bc;}function getContactsSubquery(){return squel[_0x6186('0xa')]()[_0x6186('0xb')](_0x6186('0xc'),'c')[_0x6186('0xd')](_0x6186('0xe'));}function applyJoinClauses(_0x2172df,_0x3112d8){var _0x4f66d1=_0x3112d8?'c':'subqry';_0x2172df[_0x6186('0xf')]('cm_user_has_contacts','uc',_0x6186('0x10')+_0x4f66d1+'.id')['left_join']('cm_contact_has_tags','ct',_0x6186('0x11')+_0x4f66d1+_0x6186('0x12'))[_0x6186('0xf')](_0x6186('0x13'),'t',_0x6186('0x14'));return _0x2172df;}function addFieldsToQuery(_0x5bfbeb,_0x55fb35,_0x54c4b5,_0x361bc8,_0x1b0586){var _0x39034a=_0x1b0586?'c':_0x6186('0x15');if(!_0x55fb35){_0x55fb35=['id',_0x6186('0x16'),_0x6186('0x17'),_0x6186('0x18'),_0x6186('0x19'),_0x6186('0x1a'),_0x6186('0x1b'),_0x6186('0x1c'),_0x6186('0x1d'),_0x6186('0x1e'),_0x6186('0x1f'),_0x6186('0x20'),_0x6186('0x21')];}else if(!_0x55fb35[_0x6186('0x22')]('id')){_0x55fb35['push']('id');}var _0x433c20=_0x54c4b5&&_0x1b0586||!_0x54c4b5&&!_0x1b0586;if(_0x361bc8){_0x433c20=_0x361bc8&&_0x1b0586||!_0x361bc8&&!_0x1b0586;}_0x55fb35[_0x6186('0x23')](function(_0x4296bb){if(_0x4296bb===_0x6186('0x21')){if(_0x433c20){_0x5bfbeb['field'](_0x6186('0x24'),_0x4296bb);}else if(_0x54c4b5||_0x361bc8){_0x5bfbeb[_0x6186('0x25')](_0x39034a+'.'+_0x4296bb);}}else{_0x5bfbeb[_0x6186('0x25')](_0x39034a+'.'+_0x4296bb);}});return _0x5bfbeb;}function getSqlClauses(){var _0x49b28f={'default':squel[_0x6186('0x26')](),'fields':squel['expr'](),'filter':squel[_0x6186('0x26')](),'tags':{'clause':squel[_0x6186('0x26')](),'ids':null},'user':{'clause':squel[_0x6186('0x26')](),'skip':![]}};return _0x49b28f;}function parseTagParameter(_0x24532b){var _0x3dfd87=squel['expr']();if(_0x24532b){var _0x4ef32c=utils[_0x6186('0x27')](_0x24532b);_0x4ef32c[_0x6186('0x23')](function(_0x56fc47){_0x3dfd87['or'](_0x6186('0x28'),'%,'+_0x56fc47+',%');});}return _0x3dfd87;}function parseSearchFilter(_0x5bc75f){var _0x21790e=squel['expr']();if(_0x5bc75f){var _0x1e81ab=_0x5bc75f[_0x6186('0x29')]('\x5c','\x5c\x5c')[_0x6186('0x29')](/'/g,'\x27\x27');if(_0x1e81ab[_0x6186('0x2a')]('\x20')[_0x6186('0x2b')]>0x1){_0x21790e['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x6186('0x2c')](_0x1e81ab,!![]),null);}else{if(qs['isNumeric'](_0x1e81ab)){_0x21790e['or'](_0x6186('0x2d'),_0x1e81ab+'%');_0x21790e['or']('c.phone\x20LIKE\x20?',_0x1e81ab+'%');_0x21790e['or'](_0x6186('0x2e'),_0x1e81ab+'%');_0x21790e['or']('c.fax\x20LIKE\x20?',_0x1e81ab+'%');}else if(qs['isEmail'](_0x1e81ab)){_0x21790e['or'](_0x6186('0x2f'),_0x1e81ab+'%');}else{_0x21790e['or'](_0x6186('0x30'),'%'+_0x1e81ab+'%');_0x21790e['or'](_0x6186('0x31'),'%'+_0x1e81ab+'%');_0x21790e['or'](_0x6186('0x2f'),'%'+_0x1e81ab+'%');}}}return _0x21790e;}function parseAdvancedSearchFilter(_0x4bd38c,_0x1da20f){var _0x4b2bca=getSqlClauses();var _0x5415c1=as['parseSearch'](_0x4bd38c);var _0x5d5468=_0x5415c1[_0x6186('0x32')];for(var _0x4e8590=0x0;_0x4e8590<_0x5415c1[_0x6186('0x33')][_0x6186('0x2b')];_0x4e8590++){var _0x5743b7=_0x5415c1[_0x6186('0x33')][_0x4e8590];var _0x42fd58='c';var _0x35cae3=_[_0x6186('0x34')](_0x1da20f,['name',_0x5743b7['field']]);if(_0x35cae3){if(_0x5743b7[_0x6186('0x25')]===_0x6186('0x35')||_0x35cae3[_0x6186('0x36')]===_0x6186('0x37')){_0x5743b7[_0x6186('0x38')]=_0x6186('0x39');}var _0x122768=as[_0x6186('0x3a')](_0x42fd58,_0x35cae3[_0x6186('0x3b')],_0x5743b7);_0x4b2bca['default'][_0x5d5468](_0x122768[_0x6186('0x3c')],_0x122768[_0x6186('0x3d')]['start'],_0x122768[_0x6186('0x3d')][_0x6186('0x3e')]);}else{if(_0x5743b7[_0x6186('0x25')]===_0x6186('0x3f')){var _0x1ef79c=_0x5743b7['value'][_0x6186('0x2a')](',')[_0x6186('0x40')](function(_0x5cbdd1){return Number(_0x5cbdd1);});var _0x20b8a8=parseTagParameter(_0x1ef79c);_0x4b2bca[_0x6186('0x41')][_0x6186('0x42')][_0x6186('0x43')](_0x20b8a8);_0x4b2bca[_0x6186('0x41')][_0x6186('0x44')]=_0x1ef79c;}else if(_0x5743b7['field']==='User'){_0x4b2bca[_0x6186('0x45')][_0x6186('0x42')][_0x6186('0x43')](_0x6186('0x46'),_0x5743b7[_0x6186('0x3d')]);_0x4b2bca[_0x6186('0x45')][_0x6186('0x47')]=!![];}}}return _0x4b2bca;}function parseModelFields(_0x4e1fe3,_0x28cf67){var _0x5bc616=squel['expr']();var _0x3a57d5=_(_0x4e1fe3)[_0x6186('0x48')]()[_0x6186('0x40')](function(_0x42f3ee){return _[_0x6186('0x49')](_0x28cf67,[_0x6186('0x4a'),_0x42f3ee])?_0x42f3ee:undefined;})['compact']()['value']();if(_0x4e1fe3[_0x6186('0x4b')]){_0x3a57d5[_0x6186('0x4c')](_0x6186('0x4b'));}if(_0x4e1fe3[_0x6186('0x4d')]){_0x3a57d5[_0x6186('0x4c')]('User');}if(_0x3a57d5[_0x6186('0x2b')]>0x0){_0x3a57d5[_0x6186('0x23')](function(_0x4b026f){if(_0x4b026f===_0x6186('0x1c')){_0x5bc616[_0x6186('0x43')](_0x6186('0x4e'),[]['concat'](_0x4e1fe3[_0x4b026f]));}else if(_0x4b026f==='Contact'){var _0x4989ec='%'+_0x4e1fe3[_0x4b026f]+'%';_0x5bc616[_0x6186('0x43')](_0x6186('0x4f'),_0x4989ec);}else if(_0x4b026f===_0x6186('0x4d')){_0x5bc616[_0x6186('0x43')]('uc.UserId\x20=\x20?',_0x4e1fe3[_0x4b026f]);}else{_0x5bc616['and']('c.'+_0x4b026f+_0x6186('0x50'),_0x4e1fe3[_0x4b026f]);}});}return _0x5bc616;}function parseQueryParameters(_0x17bef3,_0xd71da6){var _0x40e227=getSqlClauses();return Promise[_0x6186('0x51')]()[_0x6186('0x52')](function(){return parseModelFields(_0x17bef3,_0xd71da6);})[_0x6186('0x52')](function(_0x150a1b){_0x40e227[_0x6186('0x53')][_0x6186('0x43')](_0x150a1b);return parseTagParameter(_0x17bef3[_0x6186('0x54')]);})[_0x6186('0x52')](function(_0x1f191b){_0x40e227[_0x6186('0x41')][_0x6186('0x42')][_0x6186('0x43')](_0x1f191b);return parseSearchFilter(_0x17bef3['filter']);})[_0x6186('0x52')](function(_0x54ab49){_0x40e227['filter']=_0x54ab49;return _0x40e227;});}function checkListsRestrictions(_0x468894,_0x14fef7,_0x20da20){var _0x3d56ed=squel['expr']();return Promise[_0x6186('0x51')]()[_0x6186('0x52')](function(){if(_0x14fef7[_0x6186('0x55')]&&_0x468894['role']==='agent'&&!_0x20da20){return _0x468894['getLists']({'attributes':['id'],'raw':!![]});}})[_0x6186('0x52')](function(_0x2fec7b){if(_0x2fec7b){if(_0x2fec7b[_0x6186('0x2b')]===0x0){_0x3d56ed['and']('c.ListId\x20IS\x20NULL');}else{_0x3d56ed[_0x6186('0x43')]('c.ListId\x20IN\x20?',_[_0x6186('0x40')](_0x2fec7b,'id'));}}})[_0x6186('0x52')](function(){return _0x3d56ed;});}function buildContactsQuery(_0x7100ec,_0x3bc82e,_0x5e84a0,_0x570b2e,_0x3957cf,_0x3cfc49){if(_0x3bc82e){_0x3bc82e=_0x5e84a0[_0x6186('0x56')];}_0x7100ec=addFieldsToQuery(_0x7100ec,_0x3bc82e,_0x570b2e,_0x3cfc49,!![]);var _0x43fa24=squel[_0x6186('0xa')]();_0x43fa24=addFieldsToQuery(_0x43fa24,_0x3bc82e,_0x570b2e,_0x3cfc49,![]);if(_0x570b2e||_0x3cfc49){_0x7100ec=applyJoinClauses(_0x7100ec,!![]);_0x7100ec['group'](_0x6186('0x57'));if(_0x5e84a0[_0x6186('0x58')]){_0x43fa24[_0x6186('0x58')](_0x5e84a0[_0x6186('0x58')]);}if(_0x5e84a0[_0x6186('0x59')]){_0x43fa24[_0x6186('0x59')](_0x5e84a0[_0x6186('0x59')]);}}else{_0x43fa24=applyJoinClauses(_0x43fa24,![]);_0x43fa24[_0x6186('0x5a')](_0x6186('0x5b'));if(_0x5e84a0['limit']){_0x7100ec[_0x6186('0x58')](_0x5e84a0['limit']);}if(_0x5e84a0[_0x6186('0x59')]){_0x7100ec[_0x6186('0x59')](_0x5e84a0[_0x6186('0x59')]);}}_0x43fa24[_0x6186('0x5c')](_0x3957cf);if(_0x5e84a0['order']){_0x5e84a0['order']['forEach'](function(_0xccc7a3){_0x7100ec[_0x6186('0x5d')]('c.'+_0xccc7a3[0x0],_0xccc7a3[0x1]===_0x6186('0x5e')?![]:!![]);_0x43fa24[_0x6186('0x5d')](_0x6186('0x5f')+_0xccc7a3[0x0],_0xccc7a3[0x1]===_0x6186('0x5e')?![]:!![]);});}_0x43fa24[_0x6186('0xb')](_0x7100ec,_0x6186('0x15'));return _0x43fa24;}function getFilteredContacts(_0x961ca2){var _0x2ae55e=[];return db['Tag']['findAll']({'attributes':['id',_0x6186('0x4a'),'color'],'raw':!![]})[_0x6186('0x52')](function(_0x19cfe9){_0x2ae55e=_[_0x6186('0x60')](_0x19cfe9,'id');var _0x872da3={'type':db['Sequelize']['QueryTypes'][_0x6186('0x61')],'model':db[_0x6186('0x62')],'mapToModel':!![],'nest':!![],'raw':!![]};return db['sequelize'][_0x6186('0x63')](_0x961ca2[_0x6186('0x64')](),_0x872da3);})['then'](function(_0x516ae1){_0x516ae1[_0x6186('0x23')](function(_0x166885){if(_0x166885[_0x6186('0x21')]){_0x166885[_0x6186('0x65')]=[];_0x166885[_0x6186('0x21')][_0x6186('0x2a')](',')['forEach'](function(_0x511576){_0x166885['Tags'][_0x6186('0x4c')](_0x2ae55e[_0x511576]);});}delete _0x166885[_0x6186('0x21')];});return _0x516ae1;});}function countFilteredContacts(_0xe27f86,_0x350cea){var _0x22b46d=_0xe27f86['clone']();_0x22b46d[_0x6186('0x25')](_0x6186('0x66'));_0x22b46d=applyJoinClauses(_0x22b46d,!![]);_0xe27f86['group'](_0x6186('0x57'));var _0x20c922=utils[_0x6186('0x27')](_0x350cea);if(!_[_0x6186('0x67')](_0x20c922)){_0x22b46d['where']('t.id\x20IN\x20?',_0x20c922);}var _0x1501fe={'type':db[_0x6186('0x68')][_0x6186('0x69')][_0x6186('0x61')],'raw':!![]};return db[_0x6186('0x6a')][_0x6186('0x63')](_0x22b46d[_0x6186('0x64')](),_0x1501fe)[_0x6186('0x52')](function(_0x4bab9a){return _0x4bab9a[0x0][_0x6186('0x66')];});}module[_0x6186('0x6b')]={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery}; \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index 511a8c3..709a1a5 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 _0x1384=['encryptFile','createWriteStream','createCipher','data','update','binary','write','end','unlink','decryptFile','final','close','encryptString','secret','base64','decryptString','createDecipher','crypto','lodash','../../config/environment','secrets','session','aes-256-ctr','aes192','encrypt','algorithm','join','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','getCiphers','filter','indexOf','hasOwnProperty'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x1384,0x1df));var _0x4138=function(_0x8a1b95,_0x713451){_0x8a1b95=_0x8a1b95-0x0;var _0x3ec530=_0x1384[_0x8a1b95];return _0x3ec530;};'use strict';var crypto=require(_0x4138('0x0'));var fs=require('fs');var BPromise=require('bluebird');var _=require(_0x4138('0x1'));var config=require(_0x4138('0x2'));var logger=require('../../config/logger')('app');const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x4138('0x3')][_0x4138('0x4')],'algorithm':_0x4138('0x5')};const fileOptions={'algorithm':_0x4138('0x6')};if(config[_0x4138('0x7')]&&config['encrypt'][_0x4138('0x8')]){var isSupported=isAlgorithmSupported(config[_0x4138('0x7')][_0x4138('0x8')]);if(isSupported){fileOptions[_0x4138('0x8')]=config[_0x4138('0x7')][_0x4138('0x8')];}else{var supportedAlgorithms=getSupportedCiphers()[_0x4138('0x9')](',\x20');logger['error'](config[_0x4138('0x7')][_0x4138('0x8')],_0x4138('0xa'),supportedAlgorithms);}}function isASupportedCipher(_0x142a7e){return AES_SUPPORTED_RX[_0x4138('0xb')](_0x142a7e);}function getSupportedCiphers(){return crypto[_0x4138('0xc')]()[_0x4138('0xd')](isASupportedCipher);}function isAlgorithmSupported(_0x4a7e51){return getSupportedCiphers()[_0x4138('0xe')](_0x4a7e51)>-0x1;}function combineOptions(_0x54fe92){var _0x533856={};for(var _0x47abdf in fileOptions){if(fileOptions[_0x4138('0xf')](_0x47abdf)){_0x533856[_0x47abdf]=fileOptions[_0x47abdf];}}if(_0x54fe92){for(var _0x13f8b7 in _0x54fe92){if(_0x54fe92[_0x4138('0xf')](_0x13f8b7)){_0x533856[_0x13f8b7]=_0x54fe92[_0x13f8b7];}}}return _0x533856;}exports[_0x4138('0x10')]=function(_0xc9d229,_0x59e088,_0x811c69,_0x240459){return new BPromise(function(_0x24bae6,_0x42892d){_0x240459=combineOptions(_0x240459);var _0x3783cf=new Buffer(_0x811c69);var _0x5994f6=fs['createReadStream'](_0xc9d229);var _0x25a4ac=fs[_0x4138('0x11')](_0x59e088);var _0x209c2b=crypto[_0x4138('0x12')](_0x240459['algorithm'],_0x3783cf);_0x5994f6['on'](_0x4138('0x13'),function(_0x47d6c4){var _0x383a94=new Buffer(_0x209c2b[_0x4138('0x14')](_0x47d6c4),_0x4138('0x15'));_0x25a4ac[_0x4138('0x16')](_0x383a94);});_0x5994f6['on'](_0x4138('0x17'),function(){try{var _0x1961e7=new Buffer(_0x209c2b['final']('binary'),_0x4138('0x15'));_0x25a4ac[_0x4138('0x16')](_0x1961e7);_0x25a4ac[_0x4138('0x17')]();_0x25a4ac['on']('close',function(){return _0x24bae6(_0x59e088);});}catch(_0x51ca4a){fs[_0x4138('0x18')](_0x59e088);return _0x42892d(_0x51ca4a);}});});};exports[_0x4138('0x19')]=function(_0x25d3eb,_0x4a2da9,_0x1d6608,_0x2882cf){return new BPromise(function(_0x134232,_0x5da8da){_0x2882cf=combineOptions(_0x2882cf);var _0x3ecc93=new Buffer(_0x1d6608);var _0x19d756=fs['createReadStream'](_0x25d3eb);var _0xad64d1=fs['createWriteStream'](_0x4a2da9);var _0x1bbdb3=crypto['createDecipher'](_0x2882cf[_0x4138('0x8')],_0x3ecc93);_0x19d756['on'](_0x4138('0x13'),function(_0x4878a9){var _0x40e932=new Buffer(_0x1bbdb3[_0x4138('0x14')](_0x4878a9),_0x4138('0x15'));_0xad64d1['write'](_0x40e932);});_0x19d756['on'](_0x4138('0x17'),function(){try{var _0x5db07c=new Buffer(_0x1bbdb3[_0x4138('0x1a')](_0x4138('0x15')),'binary');_0xad64d1[_0x4138('0x16')](_0x5db07c);_0xad64d1[_0x4138('0x17')]();_0xad64d1['on'](_0x4138('0x1b'),function(){return _0x134232(_0x4a2da9);});}catch(_0x4084e3){fs[_0x4138('0x18')](_0x4a2da9);return _0x5da8da(_0x4084e3);}});});};exports[_0x4138('0x1c')]=function(_0x421db7,_0x171128,_0x50a29f){var _0x4ca4e7=_0x50a29f||stringOptions[_0x4138('0x8')];var _0x15f9ee=_0x171128||stringOptions[_0x4138('0x1d')];var _0x1da0be=crypto[_0x4138('0x12')](_0x4ca4e7,_0x15f9ee);var _0x4e1d88=_0x1da0be[_0x4138('0x14')](_0x421db7,'utf8',_0x4138('0x1e'));_0x4e1d88+=_0x1da0be[_0x4138('0x1a')](_0x4138('0x1e'));return _0x4e1d88;};exports[_0x4138('0x1f')]=function(_0x3beb5f,_0x338e8e,_0x211a29){var _0x385350=_0x211a29||stringOptions[_0x4138('0x8')];var _0x35918e=_0x338e8e||stringOptions[_0x4138('0x1d')];var _0x220a61=crypto[_0x4138('0x20')](_0x385350,_0x35918e);var _0x55a75a=_0x220a61[_0x4138('0x14')](_0x3beb5f,'base64','utf8');_0x55a75a+=_0x220a61[_0x4138('0x1a')]('utf8');return _0x55a75a;}; \ No newline at end of file +var _0xaa8e=['createReadStream','createDecipher','close','unlink','encryptString','secret','base64','decryptString','utf8','bluebird','lodash','../../config/logger','app','secrets','aes-256-ctr','algorithm','encrypt','join','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','getCiphers','filter','indexOf','hasOwnProperty','createWriteStream','data','update','binary','end','final','write','decryptFile'];(function(_0x45bb0b,_0xfbcfb6){var _0x201167=function(_0x3cae62){while(--_0x3cae62){_0x45bb0b['push'](_0x45bb0b['shift']());}};_0x201167(++_0xfbcfb6);}(_0xaa8e,0xa9));var _0xeaa8=function(_0x40178f,_0x396ac7){_0x40178f=_0x40178f-0x0;var _0x5066bf=_0xaa8e[_0x40178f];return _0x5066bf;};'use strict';var crypto=require('crypto');var fs=require('fs');var BPromise=require(_0xeaa8('0x0'));var _=require(_0xeaa8('0x1'));var config=require('../../config/environment');var logger=require(_0xeaa8('0x2'))(_0xeaa8('0x3'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0xeaa8('0x4')]['session'],'algorithm':_0xeaa8('0x5')};const fileOptions={'algorithm':'aes192'};if(config['encrypt']&&config['encrypt'][_0xeaa8('0x6')]){var isSupported=isAlgorithmSupported(config[_0xeaa8('0x7')]['algorithm']);if(isSupported){fileOptions[_0xeaa8('0x6')]=config[_0xeaa8('0x7')][_0xeaa8('0x6')];}else{var supportedAlgorithms=getSupportedCiphers()[_0xeaa8('0x8')](',\x20');logger['error'](config[_0xeaa8('0x7')][_0xeaa8('0x6')],_0xeaa8('0x9'),supportedAlgorithms);}}function isASupportedCipher(_0x2c427b){return AES_SUPPORTED_RX[_0xeaa8('0xa')](_0x2c427b);}function getSupportedCiphers(){return crypto[_0xeaa8('0xb')]()[_0xeaa8('0xc')](isASupportedCipher);}function isAlgorithmSupported(_0x1a5c12){return getSupportedCiphers()[_0xeaa8('0xd')](_0x1a5c12)>-0x1;}function combineOptions(_0x3bd771){var _0x16b3dc={};for(var _0x1a5364 in fileOptions){if(fileOptions[_0xeaa8('0xe')](_0x1a5364)){_0x16b3dc[_0x1a5364]=fileOptions[_0x1a5364];}}if(_0x3bd771){for(var _0x3f5c48 in _0x3bd771){if(_0x3bd771[_0xeaa8('0xe')](_0x3f5c48)){_0x16b3dc[_0x3f5c48]=_0x3bd771[_0x3f5c48];}}}return _0x16b3dc;}exports['encryptFile']=function(_0x282ea0,_0x23808a,_0x408ef7,_0x7b1847){return new BPromise(function(_0x4b542b,_0x2c6010){_0x7b1847=combineOptions(_0x7b1847);var _0x2e3b65=new Buffer(_0x408ef7);var _0x345a52=fs['createReadStream'](_0x282ea0);var _0x447fd1=fs[_0xeaa8('0xf')](_0x23808a);var _0x111bb4=crypto['createCipher'](_0x7b1847[_0xeaa8('0x6')],_0x2e3b65);_0x345a52['on'](_0xeaa8('0x10'),function(_0x4e6b68){var _0x5b2600=new Buffer(_0x111bb4[_0xeaa8('0x11')](_0x4e6b68),_0xeaa8('0x12'));_0x447fd1['write'](_0x5b2600);});_0x345a52['on'](_0xeaa8('0x13'),function(){try{var _0x3762bc=new Buffer(_0x111bb4[_0xeaa8('0x14')]('binary'),_0xeaa8('0x12'));_0x447fd1[_0xeaa8('0x15')](_0x3762bc);_0x447fd1[_0xeaa8('0x13')]();_0x447fd1['on']('close',function(){return _0x4b542b(_0x23808a);});}catch(_0x1ddef7){fs['unlink'](_0x23808a);return _0x2c6010(_0x1ddef7);}});});};exports[_0xeaa8('0x16')]=function(_0x569f99,_0x39d1de,_0x70d355,_0x3cde6b){return new BPromise(function(_0x2abc2b,_0x2a399a){_0x3cde6b=combineOptions(_0x3cde6b);var _0x349a73=new Buffer(_0x70d355);var _0x438e63=fs[_0xeaa8('0x17')](_0x569f99);var _0x33f904=fs[_0xeaa8('0xf')](_0x39d1de);var _0x592c0e=crypto[_0xeaa8('0x18')](_0x3cde6b[_0xeaa8('0x6')],_0x349a73);_0x438e63['on']('data',function(_0x3aed95){var _0x4377c8=new Buffer(_0x592c0e[_0xeaa8('0x11')](_0x3aed95),'binary');_0x33f904[_0xeaa8('0x15')](_0x4377c8);});_0x438e63['on'](_0xeaa8('0x13'),function(){try{var _0x44d944=new Buffer(_0x592c0e[_0xeaa8('0x14')](_0xeaa8('0x12')),_0xeaa8('0x12'));_0x33f904[_0xeaa8('0x15')](_0x44d944);_0x33f904[_0xeaa8('0x13')]();_0x33f904['on'](_0xeaa8('0x19'),function(){return _0x2abc2b(_0x39d1de);});}catch(_0x6b4980){fs[_0xeaa8('0x1a')](_0x39d1de);return _0x2a399a(_0x6b4980);}});});};exports[_0xeaa8('0x1b')]=function(_0x2c1d46,_0x1c6e51,_0x377478){var _0x18ea82=_0x377478||stringOptions['algorithm'];var _0x35a079=_0x1c6e51||stringOptions[_0xeaa8('0x1c')];var _0x1b09b9=crypto['createCipher'](_0x18ea82,_0x35a079);var _0x35c0fc=_0x1b09b9[_0xeaa8('0x11')](_0x2c1d46,'utf8',_0xeaa8('0x1d'));_0x35c0fc+=_0x1b09b9['final'](_0xeaa8('0x1d'));return _0x35c0fc;};exports[_0xeaa8('0x1e')]=function(_0x51248e,_0x593bf2,_0x4087a4){var _0x45e9ef=_0x4087a4||stringOptions[_0xeaa8('0x6')];var _0x5e9419=_0x593bf2||stringOptions[_0xeaa8('0x1c')];var _0x550095=crypto[_0xeaa8('0x18')](_0x45e9ef,_0x5e9419);var _0x5930ac=_0x550095['update'](_0x51248e,'base64','utf8');_0x5930ac+=_0x550095[_0xeaa8('0x14')](_0xeaa8('0x1f'));return _0x5930ac;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 88ef0a2..dfadcc2 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 _0x4f1c=['sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','Empty','length','range','isInteger','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.csv','existsSync','join','each','%s%d.%s','csv','%s.%s','writeFileSync','zip','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','CSV','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','finally','exit','util','path','to-csv','zip-dir','rimraf','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Setting','find','split','splitSizeCsv','then'];(function(_0x52dbe6,_0x29f5c8){var _0x3d7c62=function(_0x262298){while(--_0x262298){_0x52dbe6['push'](_0x52dbe6['shift']());}};_0x3d7c62(++_0x29f5c8);}(_0x4f1c,0xe3));var _0xc4f1=function(_0x4cc136,_0x186d2f){_0x4cc136=_0x4cc136-0x0;var _0x1488a6=_0x4f1c[_0x4cc136];return _0x1488a6;};'use strict';var util=require(_0xc4f1('0x0'));var path=require(_0xc4f1('0x1'));var _=require('lodash');var csv=require(_0xc4f1('0x2'));var fs=require('fs');var BPromise=require('bluebird');var zipdir=require(_0xc4f1('0x3'));var rimraf=require(_0xc4f1('0x4'));var db=require('../../mysqldb')['db'];var dbH=require('../../mysqldb')['dbH'];var logger=require(_0xc4f1('0x5'))(_0xc4f1('0x6'));var EXTRACTED_REPORT_ID=Number(process[_0xc4f1('0x7')][0x2]);var QUERY=process[_0xc4f1('0x7')][0x3];var PATH=process[_0xc4f1('0x7')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x39cadf,_0xf8bcad){var _0x435b98={'status':_0x39cadf};var _0x219453={'where':{'id':EXTRACTED_REPORT_ID}};if(_0xf8bcad){_0x435b98[_0xc4f1('0x8')]=_0xf8bcad;}return db[_0xc4f1('0x9')][_0xc4f1('0xa')](_0x435b98,_0x219453);}function main(){var _0x541cbf=0x1388;var _0x29968c;logger['info'](util[_0xc4f1('0xb')](_0xc4f1('0xc'),EXTRACTED_REPORT_ID,'CSV'));return db[_0xc4f1('0xd')][_0xc4f1('0xe')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xc4f1('0xf'),_0xc4f1('0x10')]})[_0xc4f1('0x11')](function(_0x5c04f5){if(_0x5c04f5){_0x29968c=_0x5c04f5;_0x541cbf=_0x29968c[_0xc4f1('0x10')]||0x1388;}})[_0xc4f1('0x11')](function(){return dbH[_0xc4f1('0x12')][_0xc4f1('0x13')](util[_0xc4f1('0xb')](_0xc4f1('0x14'),QUERY),{'type':dbH[_0xc4f1('0x12')][_0xc4f1('0x15')][_0xc4f1('0x16')]});})[_0xc4f1('0x11')](function(_0x2c8d10){if(!_0x2c8d10[0x0][_0xc4f1('0x17')]){return analyticExtractedReport(_0xc4f1('0x18'));}var _0x127b03=[];var _0x147009=0x0;if(_0x29968c[_0xc4f1('0xf')]){if(_0x2c8d10&&_0x2c8d10[_0xc4f1('0x19')]){var _0x27b86f=_[_0xc4f1('0x1a')](_0x2c8d10[0x0][_0xc4f1('0x17')]/_0x541cbf);var _0x55ceea=Number[_0xc4f1('0x1b')](_0x2c8d10[0x0][_0xc4f1('0x17')]/_0x541cbf)?_0x2c8d10[0x0]['num']%_0x541cbf:0x0;_0x27b86f['forEach'](function(_0x275847){if(_0x275847>0x0){_0x147009+=_0x541cbf;}_0x127b03[_0xc4f1('0x1c')](dbH[_0xc4f1('0x12')][_0xc4f1('0x13')](util[_0xc4f1('0xb')](_0xc4f1('0x1d'),QUERY,_0x541cbf,_0x147009),{'type':dbH[_0xc4f1('0x12')][_0xc4f1('0x15')][_0xc4f1('0x16')]}));});if(_0x55ceea>0x0){_0x147009+=_0x541cbf;_0x127b03[_0xc4f1('0x1c')](dbH[_0xc4f1('0x12')][_0xc4f1('0x13')](util[_0xc4f1('0xb')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x55ceea,_0x147009),{'type':dbH[_0xc4f1('0x12')][_0xc4f1('0x15')][_0xc4f1('0x16')]}));}}}else{_0x127b03[_0xc4f1('0x1c')](dbH['sequelize'][_0xc4f1('0x13')](QUERY,{'type':dbH[_0xc4f1('0x12')][_0xc4f1('0x15')][_0xc4f1('0x16')]}));}var _0x1e6e0=path[_0xc4f1('0x1e')](PATH);var _0x4e34d5=path[_0xc4f1('0x1f')](PATH,_0xc4f1('0x20'));var _0x514ab9=_0x29968c['split']&&_0x127b03['length']>0x1;var _0x46b46f=[];if(!fs[_0xc4f1('0x21')](path[_0xc4f1('0x22')](_0x1e6e0,_0x4e34d5))&&_0x514ab9){fs['mkdirSync'](path['join'](_0x1e6e0,_0x4e34d5));}return BPromise[_0xc4f1('0x23')](_0x127b03,function(_0x26eb4b){_0x46b46f[_0xc4f1('0x1c')](_0x26eb4b);})[_0xc4f1('0x11')](function(){for(var _0x1a9282=0x0;_0x1a9282<_0x46b46f[_0xc4f1('0x19')];_0x1a9282+=0x1){var _0x1169e4;var _0x3bac8a=_0x46b46f[_0x1a9282];if(_0x514ab9){_0x1169e4=path[_0xc4f1('0x22')](_0x1e6e0,_0x4e34d5,util[_0xc4f1('0xb')](_0xc4f1('0x24'),_0x4e34d5,_0x1a9282,_0xc4f1('0x25')));}else{_0x1169e4=path[_0xc4f1('0x22')](_0x1e6e0,util[_0xc4f1('0xb')](_0xc4f1('0x26'),_0x4e34d5,_0xc4f1('0x25')));}fs[_0xc4f1('0x27')](_0x1169e4,csv(_0x3bac8a));}})[_0xc4f1('0x11')](function(){if(_0x514ab9){return new Promise(function(_0x140cb7){zipdir(path[_0xc4f1('0x22')](_0x1e6e0,_0x4e34d5),{'saveTo':path[_0xc4f1('0x22')](_0x1e6e0,util[_0xc4f1('0xb')](_0xc4f1('0x26'),_0x4e34d5,_0xc4f1('0x28')))},function(_0x204e2d,_0x36715d){rimraf(path['join'](_0x1e6e0,_0x4e34d5),function(){});_0x140cb7('zip\x20finished');});});}})[_0xc4f1('0x11')](function(){logger[_0xc4f1('0x29')](util[_0xc4f1('0xb')](_0xc4f1('0x2a'),EXTRACTED_REPORT_ID,_0xc4f1('0x2b')));return analyticExtractedReport('Completed',_0x514ab9?util[_0xc4f1('0xb')](_0xc4f1('0x26'),_0x4e34d5,_0x514ab9?_0xc4f1('0x28'):'csv'):null);});})[_0xc4f1('0x2c')](function(_0x14b4bd){logger[_0xc4f1('0x29')](util[_0xc4f1('0xb')](_0xc4f1('0x2d'),EXTRACTED_REPORT_ID,'CSV'),util['inspect'](_0x14b4bd,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xc4f1('0x2e'));})[_0xc4f1('0x2f')](function(){process[_0xc4f1('0x30')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x0c2e=['sequelize','query','format','SELECT','Empty','split','length','num','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','dirname','basename','.csv','mkdirSync','each','join','csv','%s.%s','zip','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','path','lodash','to-csv','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','update','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','find','then'];(function(_0x38a9a5,_0x227908){var _0x454740=function(_0x1fdc35){while(--_0x1fdc35){_0x38a9a5['push'](_0x38a9a5['shift']());}};_0x454740(++_0x227908);}(_0x0c2e,0x13e));var _0xe0c2=function(_0x5677f,_0xef1562){_0x5677f=_0x5677f-0x0;var _0x83fc31=_0x0c2e[_0x5677f];return _0x83fc31;};'use strict';var util=require('util');var path=require(_0xe0c2('0x0'));var _=require(_0xe0c2('0x1'));var csv=require(_0xe0c2('0x2'));var fs=require('fs');var BPromise=require(_0xe0c2('0x3'));var zipdir=require(_0xe0c2('0x4'));var rimraf=require(_0xe0c2('0x5'));var db=require(_0xe0c2('0x6'))['db'];var dbH=require('../../mysqldb')[_0xe0c2('0x7')];var logger=require(_0xe0c2('0x8'))(_0xe0c2('0x9'));var EXTRACTED_REPORT_ID=Number(process[_0xe0c2('0xa')][0x2]);var QUERY=process['argv'][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x4019d6,_0x25cd08){var _0x5aac83={'status':_0x4019d6};var _0x22d28e={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x25cd08){_0x5aac83[_0xe0c2('0xb')]=_0x25cd08;}return db['AnalyticExtractedReport'][_0xe0c2('0xc')](_0x5aac83,_0x22d28e);}function main(){var _0x51c346=0x1388;var _0x4eba80;logger['info'](util['format'](_0xe0c2('0xd'),EXTRACTED_REPORT_ID,_0xe0c2('0xe')));return db[_0xe0c2('0xf')][_0xe0c2('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split','splitSizeCsv']})['then'](function(_0x50a345){if(_0x50a345){_0x4eba80=_0x50a345;_0x51c346=_0x4eba80['splitSizeCsv']||0x1388;}})[_0xe0c2('0x11')](function(){return dbH[_0xe0c2('0x12')][_0xe0c2('0x13')](util[_0xe0c2('0x14')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH['sequelize']['QueryTypes'][_0xe0c2('0x15')]});})[_0xe0c2('0x11')](function(_0x250225){if(!_0x250225[0x0]['num']){return analyticExtractedReport(_0xe0c2('0x16'));}var _0x16b499=[];var _0x5e6ec2=0x0;if(_0x4eba80[_0xe0c2('0x17')]){if(_0x250225&&_0x250225[_0xe0c2('0x18')]){var _0x4c6948=_['range'](_0x250225[0x0][_0xe0c2('0x19')]/_0x51c346);var _0xaaec81=Number[_0xe0c2('0x1a')](_0x250225[0x0][_0xe0c2('0x19')]/_0x51c346)?_0x250225[0x0][_0xe0c2('0x19')]%_0x51c346:0x0;_0x4c6948[_0xe0c2('0x1b')](function(_0x3a51d7){if(_0x3a51d7>0x0){_0x5e6ec2+=_0x51c346;}_0x16b499[_0xe0c2('0x1c')](dbH[_0xe0c2('0x12')][_0xe0c2('0x13')](util[_0xe0c2('0x14')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x51c346,_0x5e6ec2),{'type':dbH['sequelize']['QueryTypes'][_0xe0c2('0x15')]}));});if(_0xaaec81>0x0){_0x5e6ec2+=_0x51c346;_0x16b499[_0xe0c2('0x1c')](dbH['sequelize']['query'](util['format'](_0xe0c2('0x1d'),QUERY,_0xaaec81,_0x5e6ec2),{'type':dbH['sequelize'][_0xe0c2('0x1e')][_0xe0c2('0x15')]}));}}}else{_0x16b499[_0xe0c2('0x1c')](dbH[_0xe0c2('0x12')][_0xe0c2('0x13')](QUERY,{'type':dbH[_0xe0c2('0x12')][_0xe0c2('0x1e')][_0xe0c2('0x15')]}));}var _0x116427=path[_0xe0c2('0x1f')](PATH);var _0x3798fd=path[_0xe0c2('0x20')](PATH,_0xe0c2('0x21'));var _0x4ef09e=_0x4eba80[_0xe0c2('0x17')]&&_0x16b499[_0xe0c2('0x18')]>0x1;var _0x45b4a7=[];if(!fs['existsSync'](path['join'](_0x116427,_0x3798fd))&&_0x4ef09e){fs[_0xe0c2('0x22')](path['join'](_0x116427,_0x3798fd));}return BPromise[_0xe0c2('0x23')](_0x16b499,function(_0x130aab){_0x45b4a7[_0xe0c2('0x1c')](_0x130aab);})[_0xe0c2('0x11')](function(){for(var _0x385d30=0x0;_0x385d30<_0x45b4a7['length'];_0x385d30+=0x1){var _0xcb86d4;var _0x4a864f=_0x45b4a7[_0x385d30];if(_0x4ef09e){_0xcb86d4=path[_0xe0c2('0x24')](_0x116427,_0x3798fd,util[_0xe0c2('0x14')]('%s%d.%s',_0x3798fd,_0x385d30,_0xe0c2('0x25')));}else{_0xcb86d4=path[_0xe0c2('0x24')](_0x116427,util[_0xe0c2('0x14')](_0xe0c2('0x26'),_0x3798fd,_0xe0c2('0x25')));}fs['writeFileSync'](_0xcb86d4,csv(_0x4a864f));}})['then'](function(){if(_0x4ef09e){return new Promise(function(_0x25d2b0){zipdir(path['join'](_0x116427,_0x3798fd),{'saveTo':path[_0xe0c2('0x24')](_0x116427,util[_0xe0c2('0x14')]('%s.%s',_0x3798fd,_0xe0c2('0x27')))},function(_0x29f14e,_0x3912f1){rimraf(path[_0xe0c2('0x24')](_0x116427,_0x3798fd),function(){});_0x25d2b0('zip\x20finished');});});}})['then'](function(){logger[_0xe0c2('0x28')](util['format'](_0xe0c2('0x29'),EXTRACTED_REPORT_ID,_0xe0c2('0xe')));return analyticExtractedReport(_0xe0c2('0x2a'),_0x4ef09e?util[_0xe0c2('0x14')]('%s.%s',_0x3798fd,_0x4ef09e?_0xe0c2('0x27'):_0xe0c2('0x25')):null);});})['catch'](function(_0x49e9eb){logger[_0xe0c2('0x28')](util[_0xe0c2('0x14')](_0xe0c2('0x2b'),EXTRACTED_REPORT_ID,_0xe0c2('0xe')),util[_0xe0c2('0x2c')](_0x49e9eb,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xe0c2('0x2d'));})[_0xe0c2('0x2e')](function(){process[_0xe0c2('0x2f')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index a1cb96b..a4e273d 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 _0x7a86=['exit','/fonts/arial-regular.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','channel','interactionId','center','Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','footer','pipe','finish','error','createPdfFromHTML','path','catch','lodash','util','pdfmake/src/printer','zip-dir','rimraf','jsdom','window','bluebird','../../mysqldb','../../config/logger','analytics','argv','savename','map','pick','toString','value','fill','length','auto','body','push','concat','keys','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','header','pageBreak','before','margin','landscape','Arial','black','right','num','find','then','split','isInteger','forEach','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','sequelize','dirname','basename','existsSync','join','mkdirSync','flatten','createPdfKitDocument','%s%d.%s','pdf','all','%s.%s','zip','info','Completed','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','PDF','AnalyticExtractedReport','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','inspect','Failed'];(function(_0x2afd3e,_0x6d310a){var _0x184f97=function(_0x5b0c4c){while(--_0x5b0c4c){_0x2afd3e['push'](_0x2afd3e['shift']());}};_0x184f97(++_0x6d310a);}(_0x7a86,0x64));var _0x67a8=function(_0x3918c8,_0xde688c){_0x3918c8=_0x3918c8-0x0;var _0x5a1a72=_0x7a86[_0x3918c8];return _0x5a1a72;};'use strict';var _=require(_0x67a8('0x0'));var fs=require('fs');var util=require(_0x67a8('0x1'));var path=require('path');var moment=require('moment');var htmlToPdfmake=require('html-to-pdfmake');var PdfPrinter=require(_0x67a8('0x2'));var zipdir=require(_0x67a8('0x3'));var rimraf=require(_0x67a8('0x4'));var JSDOM=require(_0x67a8('0x5'))['JSDOM'];var window=new JSDOM('')[_0x67a8('0x6')];var BPromise=require(_0x67a8('0x7'));var db=require(_0x67a8('0x8'))['db'];var dbH=require(_0x67a8('0x8'))['dbH'];var logger=require(_0x67a8('0x9'))(_0x67a8('0xa'));var EXTRACTED_REPORT_ID=Number(process[_0x67a8('0xb')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x67a8('0xb')][0x4];var NAME=process['argv'][0x5];var FORMAT='MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a';var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x48abf2,_0x4b13b3){var _0x4d563e={'status':_0x48abf2};var _0x5c3bff={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x4b13b3){_0x4d563e[_0x67a8('0xc')]=_0x4b13b3;}return db['AnalyticExtractedReport']['update'](_0x4d563e,_0x5c3bff);}function getHeaders(_0x2aa07f){return _[_0x67a8('0xd')](_0x2aa07f,function(_0x51dfb9){return{'text':_0x51dfb9,'style':'tableHeader'};});}function getRows(_0x178b88,_0x1e7cd2){return _[_0x67a8('0xd')](_0x1e7cd2,function(_0x53d685){return _(_0x53d685)[_0x67a8('0xe')](_0x178b88)['map'](function(_0x356f7d){return _0x356f7d?_[_0x67a8('0xf')](_0x356f7d):'';})[_0x67a8('0x10')]();});}function createTable(_0x529327,_0x95c2e6){var _0x25e978={'widths':_[_0x67a8('0x11')](Array(_0x529327[_0x67a8('0x12')]),0x91),'heights':function(_0x509669){return _0x509669===0x0?_0x67a8('0x13'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x3f05ba=getHeaders(_0x529327);_0x25e978[_0x67a8('0x14')][_0x67a8('0x15')](_0x3f05ba);var _0x2559be=getRows(_0x529327,_0x95c2e6);_0x25e978['body']=_0x25e978[_0x67a8('0x14')][_0x67a8('0x16')](_0x2559be);return _0x25e978;}function createTables(_0x177590){var _0x13e1c0=[];var _0x369442=_['chunk'](Object[_0x67a8('0x17')](_0x177590[0x0]),0x5);_0x369442['forEach'](function(_0x281178){_0x13e1c0[_0x67a8('0x15')](createTable(_0x281178,_0x177590));});return _0x13e1c0;}function getPDFDocDefinition(_0x58cacf){var _0x2b2e69=util[_0x67a8('0x18')](_0x67a8('0x19'),NAME,EXTRACTED_REPORT[_0x67a8('0x1a')],moment(EXTRACTED_REPORT[_0x67a8('0x1b')])['format'](FORMAT),moment(EXTRACTED_REPORT['endDate'])[_0x67a8('0x18')](FORMAT));var _0x5e0ae3=[];for(var _0x1b9aa8=0x0;_0x1b9aa8<_0x58cacf[_0x67a8('0x12')];_0x1b9aa8++){var _0x279eda=[];if(_0x1b9aa8===0x0){_0x279eda[_0x67a8('0x15')]({'text':_0x2b2e69,'style':_0x67a8('0x1c')});}var _0x45635e={'table':_0x58cacf[_0x1b9aa8]};if(_0x1b9aa8>0x0){_0x45635e[_0x67a8('0x1d')]=_0x67a8('0x1e');_0x45635e[_0x67a8('0x1f')]=[0x0,0x46,0x0,0x0];}_0x279eda[_0x67a8('0x15')](_0x45635e);_0x5e0ae3[_0x67a8('0x15')](_0x279eda);}return{'pageSize':'A4','pageOrientation':_0x67a8('0x20'),'content':_0x5e0ae3,'footer':function(_0x283873,_0x4d662f){return{'text':_0x283873[_0x67a8('0xf')]()+'\x20/\x20'+_0x4d662f,'style':'footer'};},'defaultStyle':{'font':_0x67a8('0x21')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x67a8('0x22')},'footer':{'alignment':_0x67a8('0x23'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x32a5fc){var _0x310fe8=0x1388;var _0x1a3be2;if(!_0x32a5fc[0x0][_0x67a8('0x24')]){return analyticExtractedReport('Empty');}return db['Setting'][_0x67a8('0x25')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split','splitSizePdf']})['then'](function(_0x140479){if(_0x140479){_0x1a3be2=_0x140479;_0x310fe8=_0x1a3be2['splitSizePdf']||0x3e8;}})[_0x67a8('0x26')](function(){var _0x54b88a=[];var _0x135374=0x0;if(_0x1a3be2[_0x67a8('0x27')]){if(_0x32a5fc&&_0x32a5fc['length']){var _0x44a756=_['range'](_0x32a5fc[0x0][_0x67a8('0x24')]/_0x310fe8);var _0x105043=Number[_0x67a8('0x28')](_0x32a5fc[0x0][_0x67a8('0x24')]/_0x310fe8)?_0x32a5fc[0x0]['num']%_0x310fe8:0x0;_0x44a756[_0x67a8('0x29')](function(_0xd2216f){if(_0xd2216f>0x0){_0x135374+=_0x310fe8;}_0x54b88a[_0x67a8('0x15')](dbH['sequelize'][_0x67a8('0x2a')](util[_0x67a8('0x18')](_0x67a8('0x2b'),QUERY,_0x310fe8,_0x135374),{'type':dbH['sequelize'][_0x67a8('0x2c')][_0x67a8('0x2d')]}));});if(_0x105043>0x0){_0x135374+=_0x310fe8;_0x54b88a[_0x67a8('0x15')](dbH[_0x67a8('0x2e')][_0x67a8('0x2a')](util[_0x67a8('0x18')](_0x67a8('0x2b'),QUERY,_0x105043,_0x135374),{'type':dbH[_0x67a8('0x2e')][_0x67a8('0x2c')][_0x67a8('0x2d')]}));}}}else{_0x54b88a[_0x67a8('0x15')](dbH[_0x67a8('0x2e')][_0x67a8('0x2a')](QUERY,{'type':dbH[_0x67a8('0x2e')][_0x67a8('0x2c')][_0x67a8('0x2d')]}));}var _0x2d5fa7=path[_0x67a8('0x2f')](PATH);var _0x1b3a39=path[_0x67a8('0x30')](PATH,'.pdf');var _0x30b3c3=_0x1a3be2[_0x67a8('0x27')]&&_0x54b88a[_0x67a8('0x12')]>0x1;var _0x422123=[];if(!fs[_0x67a8('0x31')](path[_0x67a8('0x32')](_0x2d5fa7,_0x1b3a39))&&_0x30b3c3){fs[_0x67a8('0x33')](path[_0x67a8('0x32')](_0x2d5fa7,_0x1b3a39));}return BPromise['each'](_0x54b88a,function(_0x575667){_0x422123[_0x67a8('0x15')](_0x575667);})['then'](function(){var _0x3bf5f6=[];for(var _0x59e693=0x0;_0x59e693<_0x422123[_0x67a8('0x12')];_0x59e693+=0x1){var _0x3f59b1=_0x422123[_0x59e693];var _0x1a8d96=createTables(_[_0x67a8('0x34')](_0x3f59b1));var _0x13a0e7;var _0x485cc4=getPDFDocDefinition(_0x1a8d96);var _0x4a8a73=getPDFPrinter();var _0x1e5b35=_0x4a8a73[_0x67a8('0x35')](_0x485cc4);if(_0x30b3c3){_0x13a0e7=path[_0x67a8('0x32')](_0x2d5fa7,_0x1b3a39,util[_0x67a8('0x18')](_0x67a8('0x36'),_0x1b3a39,_0x59e693,_0x67a8('0x37')));}else{_0x13a0e7=path['join'](_0x2d5fa7,util[_0x67a8('0x18')]('%s.%s',_0x1b3a39,_0x67a8('0x37')));}_0x3bf5f6['push'](writePDFDocument(_0x1e5b35,_0x13a0e7));}return Promise[_0x67a8('0x38')](_0x3bf5f6);})[_0x67a8('0x26')](function(){if(_0x30b3c3){return new Promise(function(_0x1cd050){zipdir(path[_0x67a8('0x32')](_0x2d5fa7,_0x1b3a39),{'saveTo':path[_0x67a8('0x32')](_0x2d5fa7,util['format'](_0x67a8('0x39'),_0x1b3a39,_0x67a8('0x3a')))},function(){rimraf(path[_0x67a8('0x32')](_0x2d5fa7,_0x1b3a39),function(){});_0x1cd050('zip\x20finished');});});}})['then'](function(){if(!_0x30b3c3)return;rimraf(path[_0x67a8('0x32')](_0x2d5fa7,_0x1b3a39),function(){});})[_0x67a8('0x26')](function(){logger[_0x67a8('0x3b')](util[_0x67a8('0x18')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,'PDF'));return analyticExtractedReport(_0x67a8('0x3c'),_0x30b3c3?util[_0x67a8('0x18')](_0x67a8('0x39'),_0x1b3a39,_0x30b3c3?_0x67a8('0x3a'):_0x67a8('0x37')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x67a8('0x3b')](util['format'](_0x67a8('0x3d'),EXTRACTED_REPORT_ID,_0x67a8('0x3e')));return db[_0x67a8('0x3f')][_0x67a8('0x40')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0x67a8('0x26')](function(_0x36030e){EXTRACTED_REPORT=_0x36030e;return dbH[_0x67a8('0x2e')][_0x67a8('0x2a')](util[_0x67a8('0x18')](_0x67a8('0x41'),QUERY),{'type':dbH[_0x67a8('0x2e')]['QueryTypes']['SELECT']});})['then'](extractReport)['catch'](function(_0x51b8eb){logger[_0x67a8('0x3b')](util[_0x67a8('0x18')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x67a8('0x3e')),util[_0x67a8('0x42')](_0x51b8eb,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x67a8('0x43'));})['finally'](function(){process[_0x67a8('0x44')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x363d3b=new PdfPrinter({'Arial':{'normal':__dirname+_0x67a8('0x45'),'bold':__dirname+'/fonts/arial-bold.ttf','italics':__dirname+_0x67a8('0x46'),'bolditalics':__dirname+_0x67a8('0x47')}});return _0x363d3b;}function getPDFDocDefinitionFromHTML(_0x4aa6c6,_0x381d0e){var _0x98277f=util[_0x67a8('0x18')]('%s\x20#%d',_0x381d0e[_0x67a8('0x48')],_0x381d0e[_0x67a8('0x49')]);var _0x30dbf2=moment()[_0x67a8('0x18')]('YYYY-MM-DD')[_0x67a8('0xf')]();var _0x44bd50=htmlToPdfmake(_0x4aa6c6,{'window':window,'tableAutoSize':!![]});return{'content':[_0x44bd50],'defaultStyle':{'font':_0x67a8('0x21')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x67a8('0x4a'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x67a8('0x4a'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x67a8('0x4a')}},'header':function(){return[{'text':_0x67a8('0x4b'),'style':_0x67a8('0x1c')}];},'footer':function(_0x5f3374,_0xdf6c25){return[{'text':util['format'](_0x67a8('0x4c'),_0x98277f,_0x5f3374,_0xdf6c25,_0x30dbf2),'style':_0x67a8('0x4d')}];}};}function writePDFDocument(_0x540da8,_0x49685a){return new Promise(function(_0x40db0c,_0x480d4e){var _0xd2a216=_0x540da8[_0x67a8('0x4e')](fs['createWriteStream'](_0x49685a));_0xd2a216['on'](_0x67a8('0x4f'),function(){_0x40db0c(_0x67a8('0x4f'));});_0xd2a216['on'](_0x67a8('0x50'),function(_0x4015bb){_0x480d4e(_0x4015bb);});_0x540da8['end']();});}exports[_0x67a8('0x51')]=function(_0x3376b8,_0x3f0af5){var _0x13cde0=getPDFPrinter();var _0x1115e1=getPDFDocDefinitionFromHTML(_0x3376b8,_0x3f0af5);var _0x189d18=_0x13cde0['createPdfKitDocument'](_0x1115e1);return writePDFDocument(_0x189d18,_0x3f0af5[_0x67a8('0x52')])[_0x67a8('0x53')](function(_0x44bc04){throw _0x44bc04;});}; \ No newline at end of file +var _0x5246=['bluebird','../../mysqldb','dbH','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','tableHeader','map','pick','toString','value','fill','length','auto','body','push','concat','chunk','forEach','format','name','startDate','endDate','header','margin','landscape','footer','Arial','num','Empty','Setting','then','split','range','isInteger','%s\x20limit\x20%d\x20OFFSET\x20%d','sequelize','QueryTypes','SELECT','query','basename','.pdf','existsSync','join','mkdirSync','each','flatten','createPdfKitDocument','pdf','%s.%s','zip','info','PDF','findOne','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','finally','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','interactionId','YYYY-MM-DD','center','Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','pipe','createWriteStream','finish','error','createPdfFromHTML','lodash','util','path','html-to-pdfmake','pdfmake/src/printer','rimraf','jsdom','JSDOM','window'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0x5246,0x1e9));var _0x6524=function(_0xbe881f,_0x20deda){_0xbe881f=_0xbe881f-0x0;var _0x1c4ab5=_0x5246[_0xbe881f];return _0x1c4ab5;};'use strict';var _=require(_0x6524('0x0'));var fs=require('fs');var util=require(_0x6524('0x1'));var path=require(_0x6524('0x2'));var moment=require('moment');var htmlToPdfmake=require(_0x6524('0x3'));var PdfPrinter=require(_0x6524('0x4'));var zipdir=require('zip-dir');var rimraf=require(_0x6524('0x5'));var JSDOM=require(_0x6524('0x6'))[_0x6524('0x7')];var window=new JSDOM('')[_0x6524('0x8')];var BPromise=require(_0x6524('0x9'));var db=require('../../mysqldb')['db'];var dbH=require(_0x6524('0xa'))[_0x6524('0xb')];var logger=require(_0x6524('0xc'))(_0x6524('0xd'));var EXTRACTED_REPORT_ID=Number(process[_0x6524('0xe')][0x2]);var QUERY=process[_0x6524('0xe')][0x3];var PATH=process[_0x6524('0xe')][0x4];var NAME=process[_0x6524('0xe')][0x5];var FORMAT=_0x6524('0xf');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x5b72b7,_0x2780b7){var _0x4faa0b={'status':_0x5b72b7};var _0x4777c7={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x2780b7){_0x4faa0b[_0x6524('0x10')]=_0x2780b7;}return db[_0x6524('0x11')]['update'](_0x4faa0b,_0x4777c7);}function getHeaders(_0x1196dc){return _['map'](_0x1196dc,function(_0x3d43d0){return{'text':_0x3d43d0,'style':_0x6524('0x12')};});}function getRows(_0x4e81d3,_0x1a432a){return _[_0x6524('0x13')](_0x1a432a,function(_0x292bb8){return _(_0x292bb8)[_0x6524('0x14')](_0x4e81d3)[_0x6524('0x13')](function(_0xe6cf0f){return _0xe6cf0f?_[_0x6524('0x15')](_0xe6cf0f):'';})[_0x6524('0x16')]();});}function createTable(_0x466248,_0x279ab6){var _0x1fb393={'widths':_[_0x6524('0x17')](Array(_0x466248[_0x6524('0x18')]),0x91),'heights':function(_0x3742c7){return _0x3742c7===0x0?_0x6524('0x19'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x5780f9=getHeaders(_0x466248);_0x1fb393[_0x6524('0x1a')][_0x6524('0x1b')](_0x5780f9);var _0x679617=getRows(_0x466248,_0x279ab6);_0x1fb393[_0x6524('0x1a')]=_0x1fb393[_0x6524('0x1a')][_0x6524('0x1c')](_0x679617);return _0x1fb393;}function createTables(_0x38b633){var _0x4acac6=[];var _0x4c73c2=_[_0x6524('0x1d')](Object['keys'](_0x38b633[0x0]),0x5);_0x4c73c2[_0x6524('0x1e')](function(_0x27b484){_0x4acac6[_0x6524('0x1b')](createTable(_0x27b484,_0x38b633));});return _0x4acac6;}function getPDFDocDefinition(_0x4cbe4b){var _0x4fa350=util[_0x6524('0x1f')]('Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s',NAME,EXTRACTED_REPORT[_0x6524('0x20')],moment(EXTRACTED_REPORT[_0x6524('0x21')])[_0x6524('0x1f')](FORMAT),moment(EXTRACTED_REPORT[_0x6524('0x22')])['format'](FORMAT));var _0x37a87c=[];for(var _0x26ffc5=0x0;_0x26ffc5<_0x4cbe4b[_0x6524('0x18')];_0x26ffc5++){var _0x1396fa=[];if(_0x26ffc5===0x0){_0x1396fa[_0x6524('0x1b')]({'text':_0x4fa350,'style':_0x6524('0x23')});}var _0x161988={'table':_0x4cbe4b[_0x26ffc5]};if(_0x26ffc5>0x0){_0x161988['pageBreak']='before';_0x161988[_0x6524('0x24')]=[0x0,0x46,0x0,0x0];}_0x1396fa[_0x6524('0x1b')](_0x161988);_0x37a87c[_0x6524('0x1b')](_0x1396fa);}return{'pageSize':'A4','pageOrientation':_0x6524('0x25'),'content':_0x37a87c,'footer':function(_0x55ff4a,_0x15f0e4){return{'text':_0x55ff4a[_0x6524('0x15')]()+'\x20/\x20'+_0x15f0e4,'style':_0x6524('0x26')};},'defaultStyle':{'font':_0x6524('0x27')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':'black'},'footer':{'alignment':'right','margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x400de2){var _0x348c7a=0x1388;var _0x5af111;if(!_0x400de2[0x0][_0x6524('0x28')]){return analyticExtractedReport(_0x6524('0x29'));}return db[_0x6524('0x2a')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id','split','splitSizePdf']})[_0x6524('0x2b')](function(_0x2c1741){if(_0x2c1741){_0x5af111=_0x2c1741;_0x348c7a=_0x5af111['splitSizePdf']||0x3e8;}})[_0x6524('0x2b')](function(){var _0x43ee4b=[];var _0x4288d4=0x0;if(_0x5af111[_0x6524('0x2c')]){if(_0x400de2&&_0x400de2[_0x6524('0x18')]){var _0x38ce77=_[_0x6524('0x2d')](_0x400de2[0x0][_0x6524('0x28')]/_0x348c7a);var _0x467528=Number[_0x6524('0x2e')](_0x400de2[0x0][_0x6524('0x28')]/_0x348c7a)?_0x400de2[0x0][_0x6524('0x28')]%_0x348c7a:0x0;_0x38ce77[_0x6524('0x1e')](function(_0x45cdbf){if(_0x45cdbf>0x0){_0x4288d4+=_0x348c7a;}_0x43ee4b[_0x6524('0x1b')](dbH['sequelize']['query'](util[_0x6524('0x1f')](_0x6524('0x2f'),QUERY,_0x348c7a,_0x4288d4),{'type':dbH[_0x6524('0x30')][_0x6524('0x31')][_0x6524('0x32')]}));});if(_0x467528>0x0){_0x4288d4+=_0x348c7a;_0x43ee4b['push'](dbH[_0x6524('0x30')][_0x6524('0x33')](util[_0x6524('0x1f')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x467528,_0x4288d4),{'type':dbH[_0x6524('0x30')]['QueryTypes'][_0x6524('0x32')]}));}}}else{_0x43ee4b[_0x6524('0x1b')](dbH[_0x6524('0x30')][_0x6524('0x33')](QUERY,{'type':dbH[_0x6524('0x30')][_0x6524('0x31')][_0x6524('0x32')]}));}var _0x50f803=path['dirname'](PATH);var _0x357402=path[_0x6524('0x34')](PATH,_0x6524('0x35'));var _0x2d260e=_0x5af111[_0x6524('0x2c')]&&_0x43ee4b[_0x6524('0x18')]>0x1;var _0x59612f=[];if(!fs[_0x6524('0x36')](path[_0x6524('0x37')](_0x50f803,_0x357402))&&_0x2d260e){fs[_0x6524('0x38')](path['join'](_0x50f803,_0x357402));}return BPromise[_0x6524('0x39')](_0x43ee4b,function(_0x2b34ef){_0x59612f[_0x6524('0x1b')](_0x2b34ef);})['then'](function(){var _0x5ed24c=[];for(var _0x48d8e7=0x0;_0x48d8e7<_0x59612f[_0x6524('0x18')];_0x48d8e7+=0x1){var _0x2cc6ab=_0x59612f[_0x48d8e7];var _0x30b0ee=createTables(_[_0x6524('0x3a')](_0x2cc6ab));var _0x1ed8e8;var _0x250e4f=getPDFDocDefinition(_0x30b0ee);var _0x29322c=getPDFPrinter();var _0x3d8167=_0x29322c[_0x6524('0x3b')](_0x250e4f);if(_0x2d260e){_0x1ed8e8=path['join'](_0x50f803,_0x357402,util['format']('%s%d.%s',_0x357402,_0x48d8e7,_0x6524('0x3c')));}else{_0x1ed8e8=path[_0x6524('0x37')](_0x50f803,util[_0x6524('0x1f')](_0x6524('0x3d'),_0x357402,_0x6524('0x3c')));}_0x5ed24c['push'](writePDFDocument(_0x3d8167,_0x1ed8e8));}return Promise['all'](_0x5ed24c);})[_0x6524('0x2b')](function(){if(_0x2d260e){return new Promise(function(_0x1481bc){zipdir(path[_0x6524('0x37')](_0x50f803,_0x357402),{'saveTo':path[_0x6524('0x37')](_0x50f803,util[_0x6524('0x1f')](_0x6524('0x3d'),_0x357402,_0x6524('0x3e')))},function(){rimraf(path[_0x6524('0x37')](_0x50f803,_0x357402),function(){});_0x1481bc('zip\x20finished');});});}})['then'](function(){if(!_0x2d260e)return;rimraf(path[_0x6524('0x37')](_0x50f803,_0x357402),function(){});})[_0x6524('0x2b')](function(){logger[_0x6524('0x3f')](util[_0x6524('0x1f')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x6524('0x40')));return analyticExtractedReport('Completed',_0x2d260e?util[_0x6524('0x1f')]('%s.%s',_0x357402,_0x2d260e?'zip':_0x6524('0x3c')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger['info'](util[_0x6524('0x1f')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x6524('0x40')));return db['AnalyticExtractedReport'][_0x6524('0x41')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0x6524('0x2b')](function(_0x29d54f){EXTRACTED_REPORT=_0x29d54f;return dbH[_0x6524('0x30')][_0x6524('0x33')](util[_0x6524('0x1f')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x6524('0x30')][_0x6524('0x31')][_0x6524('0x32')]});})[_0x6524('0x2b')](extractReport)['catch'](function(_0x1a825f){logger[_0x6524('0x3f')](util[_0x6524('0x1f')](_0x6524('0x42'),EXTRACTED_REPORT_ID,_0x6524('0x40')),util['inspect'](_0x1a825f,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x6524('0x43'));})[_0x6524('0x44')](function(){process['exit'](EXIT_CODE);});}main();function getPDFPrinter(){var _0x384069=new PdfPrinter({'Arial':{'normal':__dirname+'/fonts/arial-regular.ttf','bold':__dirname+_0x6524('0x45'),'italics':__dirname+_0x6524('0x46'),'bolditalics':__dirname+_0x6524('0x47')}});return _0x384069;}function getPDFDocDefinitionFromHTML(_0x1bad5,_0x91cbf9){var _0xca0fc9=util['format'](_0x6524('0x48'),_0x91cbf9['channel'],_0x91cbf9[_0x6524('0x49')]);var _0x3cee21=moment()[_0x6524('0x1f')](_0x6524('0x4a'))[_0x6524('0x15')]();var _0x190f5b=htmlToPdfmake(_0x1bad5,{'window':window,'tableAutoSize':!![]});return{'content':[_0x190f5b],'defaultStyle':{'font':_0x6524('0x27')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x6524('0x4b'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x6524('0x4b'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x6524('0x4b')}},'header':function(){return[{'text':_0x6524('0x4c'),'style':_0x6524('0x23')}];},'footer':function(_0x49476b,_0x31e887){return[{'text':util['format'](_0x6524('0x4d'),_0xca0fc9,_0x49476b,_0x31e887,_0x3cee21),'style':_0x6524('0x26')}];}};}function writePDFDocument(_0x333b48,_0x4fe093){return new Promise(function(_0x2a19d9,_0x1a435b){var _0x3dbcce=_0x333b48[_0x6524('0x4e')](fs[_0x6524('0x4f')](_0x4fe093));_0x3dbcce['on'](_0x6524('0x50'),function(){_0x2a19d9(_0x6524('0x50'));});_0x3dbcce['on'](_0x6524('0x51'),function(_0x35af5c){_0x1a435b(_0x35af5c);});_0x333b48['end']();});}exports[_0x6524('0x52')]=function(_0x109e85,_0x1365f5){var _0x1b9a45=getPDFPrinter();var _0xb2408c=getPDFDocDefinitionFromHTML(_0x109e85,_0x1365f5);var _0x3342da=_0x1b9a45[_0x6524('0x3b')](_0xb2408c);return writePDFDocument(_0x3342da,_0x1365f5[_0x6524('0x2')])['catch'](function(_0x215f7d){throw _0x215f7d;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index ff28de8..6242c5c 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 _0x2d12=['../../config/logger','argv','AnalyticExtractedReport','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','find','split','splitSizeXlsx','then','sequelize','query','QueryTypes','SELECT','num','length','range','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','basename','.xlsx','existsSync','join','each','%s%d.%s','xlsx','%s.%s','writeFileSync','binary','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','zip','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','finally','exit','path','bluebird','zip-dir','rimraf','../../mysqldb','dbH'];(function(_0x55c09e,_0x395bfa){var _0xa1d143=function(_0x218e80){while(--_0x218e80){_0x55c09e['push'](_0x55c09e['shift']());}};_0xa1d143(++_0x395bfa);}(_0x2d12,0x198));var _0x22d1=function(_0x29bca4,_0x5f5512){_0x29bca4=_0x29bca4-0x0;var _0xe8cc31=_0x2d12[_0x29bca4];return _0xe8cc31;};'use strict';var util=require('util');var path=require(_0x22d1('0x0'));var _=require('lodash');var fs=require('fs');var json2xls=require('json2xls');var BPromise=require(_0x22d1('0x1'));var zipdir=require(_0x22d1('0x2'));var rimraf=require(_0x22d1('0x3'));var db=require(_0x22d1('0x4'))['db'];var dbH=require(_0x22d1('0x4'))[_0x22d1('0x5')];var logger=require(_0x22d1('0x6'))('analytics');var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x22d1('0x7')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x18511a,_0x50a020){var _0x54a4a4={'status':_0x18511a};var _0x437599={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x50a020){_0x54a4a4['savename']=_0x50a020;}return db[_0x22d1('0x8')]['update'](_0x54a4a4,_0x437599);}function main(){var _0x585e96=0x1388;var _0x4a1a7c;logger[_0x22d1('0x9')](util[_0x22d1('0xa')](_0x22d1('0xb'),EXTRACTED_REPORT_ID,_0x22d1('0xc')));return db['Setting'][_0x22d1('0xd')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x22d1('0xe'),_0x22d1('0xf')]})['then'](function(_0xbb8b2b){if(_0xbb8b2b){_0x4a1a7c=_0xbb8b2b;_0x585e96=_0x4a1a7c['splitSizeXlsx']||0x1388;}})[_0x22d1('0x10')](function(){return dbH[_0x22d1('0x11')][_0x22d1('0x12')](util['format']('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x22d1('0x11')][_0x22d1('0x13')][_0x22d1('0x14')]});})[_0x22d1('0x10')](function(_0x1ea202){if(!_0x1ea202[0x0][_0x22d1('0x15')]){return analyticExtractedReport('Empty');}var _0x372094=[];var _0x2563d7=0x0;if(_0x4a1a7c[_0x22d1('0xe')]){if(_0x1ea202&&_0x1ea202[_0x22d1('0x16')]){var _0x2f5b0d=_[_0x22d1('0x17')](_0x1ea202[0x0][_0x22d1('0x15')]/_0x585e96);var _0x13dcf8=Number[_0x22d1('0x18')](_0x1ea202[0x0]['num']/_0x585e96)?_0x1ea202[0x0]['num']%_0x585e96:0x0;_0x2f5b0d[_0x22d1('0x19')](function(_0x3536ee){if(_0x3536ee>0x0){_0x2563d7+=_0x585e96;}_0x372094[_0x22d1('0x1a')](dbH[_0x22d1('0x11')]['query'](util[_0x22d1('0xa')](_0x22d1('0x1b'),QUERY,_0x585e96,_0x2563d7),{'type':dbH[_0x22d1('0x11')]['QueryTypes'][_0x22d1('0x14')]}));});if(_0x13dcf8>0x0){_0x2563d7+=_0x585e96;_0x372094[_0x22d1('0x1a')](dbH[_0x22d1('0x11')][_0x22d1('0x12')](util['format'](_0x22d1('0x1b'),QUERY,_0x13dcf8,_0x2563d7),{'type':dbH[_0x22d1('0x11')]['QueryTypes']['SELECT']}));}}}else{_0x372094['push'](dbH['sequelize']['query'](QUERY,{'type':dbH['sequelize'][_0x22d1('0x13')]['SELECT']}));}var _0x425b29=path['dirname'](PATH);var _0x39ce77=path[_0x22d1('0x1c')](PATH,_0x22d1('0x1d'));var _0x37d1fa=_0x4a1a7c[_0x22d1('0xe')]&&_0x372094['length']>0x1;var _0x30eb14=[];if(!fs[_0x22d1('0x1e')](path[_0x22d1('0x1f')](_0x425b29,_0x39ce77))&&_0x37d1fa){fs['mkdirSync'](path[_0x22d1('0x1f')](_0x425b29,_0x39ce77));}return BPromise[_0x22d1('0x20')](_0x372094,function(_0x963bf1){_0x30eb14[_0x22d1('0x1a')](_0x963bf1);})[_0x22d1('0x10')](function(){for(var _0x35353c=0x0;_0x35353c<_0x30eb14['length'];_0x35353c+=0x1){var _0x1c0e2e;var _0x4dcc5a=_0x30eb14[_0x35353c];if(_0x37d1fa){_0x1c0e2e=path['join'](_0x425b29,_0x39ce77,util[_0x22d1('0xa')](_0x22d1('0x21'),_0x39ce77,_0x35353c,_0x22d1('0x22')));}else{_0x1c0e2e=path[_0x22d1('0x1f')](_0x425b29,util[_0x22d1('0xa')](_0x22d1('0x23'),_0x39ce77,_0x22d1('0x22')));}fs[_0x22d1('0x24')](_0x1c0e2e,json2xls(_0x4dcc5a),_0x22d1('0x25'));}})['then'](function(){if(_0x37d1fa){return new Promise(function(_0x26b9cf){zipdir(path[_0x22d1('0x1f')](_0x425b29,_0x39ce77),{'saveTo':path['join'](_0x425b29,util['format'](_0x22d1('0x23'),_0x39ce77,'zip'))},function(_0x58fe17,_0x1af44d){rimraf(path[_0x22d1('0x1f')](_0x425b29,_0x39ce77),function(){});_0x26b9cf('zip\x20finished');});});}})[_0x22d1('0x10')](function(){logger['info'](util[_0x22d1('0xa')](_0x22d1('0x26'),EXTRACTED_REPORT_ID,_0x22d1('0xc')));return analyticExtractedReport(_0x22d1('0x27'),_0x37d1fa?util[_0x22d1('0xa')](_0x22d1('0x23'),_0x39ce77,_0x37d1fa?_0x22d1('0x28'):_0x22d1('0x22')):null);});})[_0x22d1('0x29')](function(_0x34dffc){logger[_0x22d1('0x9')](util[_0x22d1('0xa')](_0x22d1('0x2a'),EXTRACTED_REPORT_ID,_0x22d1('0xc')),util['inspect'](_0x34dffc,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x22d1('0x2b'));})[_0x22d1('0x2c')](function(){process[_0x22d1('0x2d')](EXIT_CODE);});}main(); \ No newline at end of file +var _0xe9ab=['lodash','json2xls','bluebird','zip-dir','rimraf','../../mysqldb','dbH','analytics','argv','savename','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','find','splitSizeXlsx','then','sequelize','query','QueryTypes','SELECT','Empty','split','length','range','isInteger','num','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','mkdirSync','each','%s%d.%s','xlsx','join','%s.%s','writeFileSync','zip\x20finished','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','util'];(function(_0x11b1e3,_0x42ce67){var _0x4b52ce=function(_0xe347d0){while(--_0xe347d0){_0x11b1e3['push'](_0x11b1e3['shift']());}};_0x4b52ce(++_0x42ce67);}(_0xe9ab,0xc3));var _0xbe9a=function(_0x6082f8,_0x118948){_0x6082f8=_0x6082f8-0x0;var _0x963c8e=_0xe9ab[_0x6082f8];return _0x963c8e;};'use strict';var util=require(_0xbe9a('0x0'));var path=require('path');var _=require(_0xbe9a('0x1'));var fs=require('fs');var json2xls=require(_0xbe9a('0x2'));var BPromise=require(_0xbe9a('0x3'));var zipdir=require(_0xbe9a('0x4'));var rimraf=require(_0xbe9a('0x5'));var db=require('../../mysqldb')['db'];var dbH=require(_0xbe9a('0x6'))[_0xbe9a('0x7')];var logger=require('../../config/logger')(_0xbe9a('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0xbe9a('0x9')][0x2]);var QUERY=process[_0xbe9a('0x9')][0x3];var PATH=process[_0xbe9a('0x9')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x2b620e,_0x868f02){var _0x31638c={'status':_0x2b620e};var _0x1d5d14={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x868f02){_0x31638c[_0xbe9a('0xa')]=_0x868f02;}return db['AnalyticExtractedReport'][_0xbe9a('0xb')](_0x31638c,_0x1d5d14);}function main(){var _0x1a6a52=0x1388;var _0x2bef57;logger[_0xbe9a('0xc')](util[_0xbe9a('0xd')](_0xbe9a('0xe'),EXTRACTED_REPORT_ID,_0xbe9a('0xf')));return db['Setting'][_0xbe9a('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0xbe9a('0x11')]})[_0xbe9a('0x12')](function(_0x3e071d){if(_0x3e071d){_0x2bef57=_0x3e071d;_0x1a6a52=_0x2bef57[_0xbe9a('0x11')]||0x1388;}})[_0xbe9a('0x12')](function(){return dbH[_0xbe9a('0x13')][_0xbe9a('0x14')](util['format']('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH['sequelize'][_0xbe9a('0x15')][_0xbe9a('0x16')]});})[_0xbe9a('0x12')](function(_0x506290){if(!_0x506290[0x0]['num']){return analyticExtractedReport(_0xbe9a('0x17'));}var _0x2a1987=[];var _0x236d25=0x0;if(_0x2bef57[_0xbe9a('0x18')]){if(_0x506290&&_0x506290[_0xbe9a('0x19')]){var _0x1c9902=_[_0xbe9a('0x1a')](_0x506290[0x0]['num']/_0x1a6a52);var _0x251768=Number[_0xbe9a('0x1b')](_0x506290[0x0][_0xbe9a('0x1c')]/_0x1a6a52)?_0x506290[0x0][_0xbe9a('0x1c')]%_0x1a6a52:0x0;_0x1c9902[_0xbe9a('0x1d')](function(_0x3010f6){if(_0x3010f6>0x0){_0x236d25+=_0x1a6a52;}_0x2a1987[_0xbe9a('0x1e')](dbH[_0xbe9a('0x13')]['query'](util['format'](_0xbe9a('0x1f'),QUERY,_0x1a6a52,_0x236d25),{'type':dbH[_0xbe9a('0x13')][_0xbe9a('0x15')][_0xbe9a('0x16')]}));});if(_0x251768>0x0){_0x236d25+=_0x1a6a52;_0x2a1987[_0xbe9a('0x1e')](dbH['sequelize'][_0xbe9a('0x14')](util[_0xbe9a('0xd')](_0xbe9a('0x1f'),QUERY,_0x251768,_0x236d25),{'type':dbH[_0xbe9a('0x13')][_0xbe9a('0x15')]['SELECT']}));}}}else{_0x2a1987[_0xbe9a('0x1e')](dbH['sequelize'][_0xbe9a('0x14')](QUERY,{'type':dbH[_0xbe9a('0x13')][_0xbe9a('0x15')]['SELECT']}));}var _0x1ace54=path[_0xbe9a('0x20')](PATH);var _0x133a63=path[_0xbe9a('0x21')](PATH,'.xlsx');var _0x61a2b4=_0x2bef57[_0xbe9a('0x18')]&&_0x2a1987[_0xbe9a('0x19')]>0x1;var _0x3adb3d=[];if(!fs['existsSync'](path['join'](_0x1ace54,_0x133a63))&&_0x61a2b4){fs[_0xbe9a('0x22')](path['join'](_0x1ace54,_0x133a63));}return BPromise[_0xbe9a('0x23')](_0x2a1987,function(_0x48ecb3){_0x3adb3d[_0xbe9a('0x1e')](_0x48ecb3);})[_0xbe9a('0x12')](function(){for(var _0x532399=0x0;_0x532399<_0x3adb3d['length'];_0x532399+=0x1){var _0x2e4cd5;var _0x59f52d=_0x3adb3d[_0x532399];if(_0x61a2b4){_0x2e4cd5=path['join'](_0x1ace54,_0x133a63,util['format'](_0xbe9a('0x24'),_0x133a63,_0x532399,_0xbe9a('0x25')));}else{_0x2e4cd5=path[_0xbe9a('0x26')](_0x1ace54,util[_0xbe9a('0xd')](_0xbe9a('0x27'),_0x133a63,_0xbe9a('0x25')));}fs[_0xbe9a('0x28')](_0x2e4cd5,json2xls(_0x59f52d),'binary');}})[_0xbe9a('0x12')](function(){if(_0x61a2b4){return new Promise(function(_0x35071a){zipdir(path[_0xbe9a('0x26')](_0x1ace54,_0x133a63),{'saveTo':path[_0xbe9a('0x26')](_0x1ace54,util[_0xbe9a('0xd')](_0xbe9a('0x27'),_0x133a63,'zip'))},function(_0x20cbc9,_0x1319d9){rimraf(path[_0xbe9a('0x26')](_0x1ace54,_0x133a63),function(){});_0x35071a(_0xbe9a('0x29'));});});}})['then'](function(){logger['info'](util['format']('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0xbe9a('0xf')));return analyticExtractedReport(_0xbe9a('0x2a'),_0x61a2b4?util[_0xbe9a('0xd')](_0xbe9a('0x27'),_0x133a63,_0x61a2b4?'zip':_0xbe9a('0x25')):null);});})[_0xbe9a('0x2b')](function(_0x4e3987){logger['info'](util[_0xbe9a('0xd')](_0xbe9a('0x2c'),EXTRACTED_REPORT_ID,_0xbe9a('0xf')),util[_0xbe9a('0x2d')](_0x4e3987,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xbe9a('0x2e'));})[_0xbe9a('0x2f')](function(){process[_0xbe9a('0x30')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index 4aaaf7a..45b3393 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 _0x9231=['filter','groupBy','queue','playback','hasOwnProperty','priority','extensions','Set','format','type','VoiceExtensionId','inbound','push','CDR(routeid)=','context','CDR(destination)=','extension','cutdigits','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=noprefix','recordingFormat','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','updatedAt','*,*,*,*','interval','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','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','concat','Hangup','transaction','VoiceExtension','destroy','bulkCreate','sortBy','catch','error','rewrite','lodash','models','Interval','findAll','then','intervals','map','exten','CAST(priority\x20AS\x20UNSIGNED)'];(function(_0x134248,_0x2946f6){var _0x3a4a05=function(_0x3b773e){while(--_0x3b773e){_0x134248['push'](_0x134248['shift']());}};_0x3a4a05(++_0x2946f6);}(_0x9231,0x195));var _0x1923=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9231[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x1923('0x0'));var util=require('util');function rewrite(_0x5c8789,_0x1522bb){var _0xd289d6=this;return _0x5c8789[_0x1923('0x1')][_0x1923('0x2')][_0x1923('0x3')]({'raw':!![]})[_0x1923('0x4')](function(_0x2cf8e5){_0xd289d6[_0x1923('0x5')]=_0x2cf8e5;return _0x5c8789[_0x1923('0x1')]['VoiceExtension'][_0x1923('0x3')]({'where':{'IntervalId':_0x1522bb['IntervalId']},'raw':!![]});})[_0x1923('0x4')](function(_0x56ea53){return _0x5c8789['models']['VoiceExtension'][_0x1923('0x3')]({'where':{'exten':{'$in':_['uniq'](_[_0x1923('0x6')](_0x56ea53,_0x1923('0x7')))}},'order':[{'raw':_0x1923('0x8')}],'raw':!![]});})[_0x1923('0x4')](function(_0x1fa3a4){var _0x489d82=_['filter'](_0x1fa3a4,{'priority':'1'});var _0x37a370=_[_0x1923('0x9')](_0x1fa3a4,{'isApp':0x1});var _0x3fdb41=_[_0x1923('0xa')](_0x37a370,_0x1923('0x7'));var _0x47f245=[_0x1923('0xb'),_0x1923('0xc')];var _0xe42e23=[];var _0x60b578=[];for(var _0x39be7c in _0x3fdb41){if(_0x3fdb41[_0x1923('0xd')](_0x39be7c)){_0xd289d6[_0x1923('0xe')]=0x2;_0xd289d6[_0x1923('0xf')]=[];_0xd289d6['extension']=_['find'](_0x489d82,{'exten':_0x3fdb41[_0x39be7c][0x0][_0x1923('0x7')]});_0xd289d6['extensions']['push']({'type':_0x3fdb41[_0x39be7c][0x0]['type'],'app':_0x1923('0x10'),'appdata':util[_0x1923('0x11')]('CDR(type)=%s',_0x3fdb41[_0x39be7c][0x0][_0x1923('0x12')]),'context':_0x3fdb41[_0x39be7c][0x0]['context'],'exten':_0x3fdb41[_0x39be7c][0x0]['exten'],'priority':_0xd289d6[_0x1923('0xe')]++,'VoiceExtensionId':_0x3fdb41[_0x39be7c][0x0][_0x1923('0x13')]});if(_0x3fdb41[_0x39be7c][0x0]['type']===_0x1923('0x14')){_0xd289d6[_0x1923('0xf')][_0x1923('0x15')]({'type':_0x3fdb41[_0x39be7c][0x0][_0x1923('0x12')],'app':_0x1923('0x10'),'appdata':_0x1923('0x16')+_0x3fdb41[_0x39be7c][0x0]['VoiceExtensionId'],'context':_0x3fdb41[_0x39be7c][0x0][_0x1923('0x17')],'exten':_0x3fdb41[_0x39be7c][0x0][_0x1923('0x7')],'priority':_0xd289d6[_0x1923('0xe')]++,'VoiceExtensionId':_0x3fdb41[_0x39be7c][0x0][_0x1923('0x13')]});}else if(_0x3fdb41[_0x39be7c][0x0][_0x1923('0x12')]==='outbound'){if(_0xd289d6['extension']){_0xd289d6[_0x1923('0xf')][_0x1923('0x15')]({'type':_0x3fdb41[_0x39be7c][0x0]['type'],'app':_0x1923('0x10'),'appdata':_0x1923('0x18')+(_0xd289d6[_0x1923('0x19')][_0x1923('0x1a')]?'${EXTEN:'+_0xd289d6[_0x1923('0x19')][_0x1923('0x1a')]+'}':_0x1923('0x1b')),'context':_0x3fdb41[_0x39be7c][0x0][_0x1923('0x17')],'exten':_0x3fdb41[_0x39be7c][0x0][_0x1923('0x7')],'priority':_0xd289d6[_0x1923('0xe')]++,'VoiceExtensionId':_0x3fdb41[_0x39be7c][0x0]['VoiceExtensionId']});}_0xd289d6[_0x1923('0xf')][_0x1923('0x15')]({'type':_0x3fdb41[_0x39be7c][0x0][_0x1923('0x12')],'app':'Set','appdata':_0x1923('0x16')+_0x3fdb41[_0x39be7c][0x0]['VoiceExtensionId'],'context':_0x3fdb41[_0x39be7c][0x0][_0x1923('0x17')],'exten':_0x3fdb41[_0x39be7c][0x0][_0x1923('0x7')],'priority':_0xd289d6['priority']++,'VoiceExtensionId':_0x3fdb41[_0x39be7c][0x0][_0x1923('0x13')]});var _0x49834c=_0xd289d6[_0x1923('0xe')]++;_0xd289d6[_0x1923('0xf')][_0x1923('0x15')]({'type':_0x3fdb41[_0x39be7c][0x0][_0x1923('0x12')],'app':_0x1923('0x1c'),'appdata':_0x1923('0x1d')+(_0x49834c+0x2)+'):Goto('+(_0x49834c+0x1)+')','context':_0x3fdb41[_0x39be7c][0x0][_0x1923('0x17')],'exten':_0x3fdb41[_0x39be7c][0x0][_0x1923('0x7')],'priority':_0x49834c,'VoiceExtensionId':_0x3fdb41[_0x39be7c][0x0][_0x1923('0x13')]});if(_0xd289d6[_0x1923('0x19')]){_0xd289d6[_0x1923('0xf')][_0x1923('0x15')]({'type':_0x3fdb41[_0x39be7c][0x0][_0x1923('0x12')],'app':_0x1923('0x10'),'appdata':_0xd289d6['extension'][_0x1923('0x1a')]?'CDR(prefix)=${EXTEN:0:'+_0xd289d6[_0x1923('0x19')][_0x1923('0x1a')]+'}':_0x1923('0x1e'),'context':_0x3fdb41[_0x39be7c][0x0][_0x1923('0x17')],'exten':_0x3fdb41[_0x39be7c][0x0][_0x1923('0x7')],'priority':_0xd289d6[_0x1923('0xe')]++,'VoiceExtensionId':_0x3fdb41[_0x39be7c][0x0]['VoiceExtensionId']});}_0xd289d6[_0x1923('0xf')][_0x1923('0x15')]({'type':_0x3fdb41[_0x39be7c][0x0]['type'],'app':_0x1923('0x10'),'appdata':'outboundrouteid='+_0x3fdb41[_0x39be7c][0x0][_0x1923('0x13')],'context':_0x3fdb41[_0x39be7c][0x0][_0x1923('0x17')],'exten':_0x3fdb41[_0x39be7c][0x0][_0x1923('0x7')],'priority':_0xd289d6[_0x1923('0xe')]++,'VoiceExtensionId':_0x3fdb41[_0x39be7c][0x0][_0x1923('0x13')]});if(_0xd289d6[_0x1923('0x19')]&&_0xd289d6[_0x1923('0x19')][_0x1923('0xd')]('recordingFormat')&&_0xd289d6[_0x1923('0x19')][_0x1923('0x1f')]!=='none'){_0xd289d6[_0x1923('0xf')][_0x1923('0x15')]({'type':_0x3fdb41[_0x39be7c][0x0][_0x1923('0x12')],'app':_0x1923('0x10'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0x3fdb41[_0x39be7c][0x0][_0x1923('0x17')],'exten':_0x3fdb41[_0x39be7c][0x0][_0x1923('0x7')],'priority':_0xd289d6[_0x1923('0xe')]++,'VoiceExtensionId':_0x3fdb41[_0x39be7c][0x0]['VoiceExtensionId']});_0xd289d6['extensions'][_0x1923('0x15')]({'type':_0x3fdb41[_0x39be7c][0x0][_0x1923('0x12')],'app':_0x1923('0x10'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0xd289d6['extension'][_0x1923('0x1f')]||_0x1923('0x20'),'context':_0x3fdb41[_0x39be7c][0x0]['context'],'exten':_0x3fdb41[_0x39be7c][0x0][_0x1923('0x7')],'priority':_0xd289d6[_0x1923('0xe')]++,'VoiceExtensionId':_0x3fdb41[_0x39be7c][0x0][_0x1923('0x13')]});}}_0xd289d6['extensions']['push']({'type':_0x3fdb41[_0x39be7c][0x0]['type'],'app':_0x1923('0x10'),'appdata':_0x1923('0x21'),'context':_0x3fdb41[_0x39be7c][0x0][_0x1923('0x17')],'exten':_0x3fdb41[_0x39be7c][0x0]['exten'],'priority':_0xd289d6[_0x1923('0xe')]++,'VoiceExtensionId':_0x3fdb41[_0x39be7c][0x0][_0x1923('0x13')]});_0xd289d6[_0x1923('0xf')]['push']({'type':_0x3fdb41[_0x39be7c][0x0]['type'],'app':_0x1923('0x10'),'appdata':_0x1923('0x22'),'context':_0x3fdb41[_0x39be7c][0x0][_0x1923('0x17')],'exten':_0x3fdb41[_0x39be7c][0x0][_0x1923('0x7')],'priority':_0xd289d6[_0x1923('0xe')]++,'VoiceExtensionId':_0x3fdb41[_0x39be7c][0x0]['VoiceExtensionId']});_0xd289d6[_0x1923('0xf')][_0x1923('0x15')]({'type':_0x3fdb41[_0x39be7c][0x0][_0x1923('0x12')],'app':'Set','appdata':_0x1923('0x23'),'context':_0x3fdb41[_0x39be7c][0x0][_0x1923('0x17')],'exten':_0x3fdb41[_0x39be7c][0x0][_0x1923('0x7')],'priority':_0xd289d6[_0x1923('0xe')]++,'VoiceExtensionId':_0x3fdb41[_0x39be7c][0x0][_0x1923('0x13')]});for(var _0x1842ec=0x0,_0x197538=0x0;_0x1842ec<_0x3fdb41[_0x39be7c][_0x1923('0x24')];_0x1842ec+=0x1,_0x197538=0x0){var _0x5a1d96=_0x3fdb41[_0x39be7c][_0x1842ec];if(_0x5a1d96['type']){_0x5a1d96[_0x1923('0x12')]=_0x5a1d96[_0x1923('0x12')][_0x1923('0x25')]();}var _0x15363e=[];var _0x20371f=[];delete _0x5a1d96['id'];delete _0x5a1d96['createdAt'];delete _0x5a1d96[_0x1923('0x26')];var _0x3ca541=_0x5a1d96['interval']!==_0x1923('0x27')?[_0x5a1d96[_0x1923('0x28')]]:_0x5a1d96['IntervalId']?_[_0x1923('0x6')](_['filter'](_0xd289d6['intervals'],{'IntervalId':_0x5a1d96['IntervalId']}),_0x1923('0x28')):[];if(_0x5a1d96[_0x1923('0xd')](_0x1923('0x29'))){if(_0x5a1d96[_0x1923('0x29')]&&_0x5a1d96['tag']!=='--'){_0x15363e[_0x1923('0x15')]({'type':_0x5a1d96['type'],'app':_0x1923('0x10'),'appdata':_0x1923('0x2a')+_0x5a1d96['tag'],'context':_0x5a1d96[_0x1923('0x17')],'exten':_0x5a1d96[_0x1923('0x7')],'priority':_0x3ca541[_0x1923('0x24')]+_0xd289d6[_0x1923('0xe')]+_0x197538++,'VoiceExtensionId':_0x5a1d96['VoiceExtensionId']});}}if(_0x5a1d96['type']==='outbound'&&_0x5a1d96[_0x1923('0xd')](_0x1923('0x2b'))){if(_0x5a1d96[_0x1923('0x2b')]){_0x15363e[_0x1923('0x15')]({'type':_0x5a1d96['type'],'app':_0x1923('0x1c'),'appdata':_0x1923('0x2c')+_0x5a1d96[_0x1923('0x2b')]+')','context':_0x5a1d96[_0x1923('0x17')],'exten':_0x5a1d96[_0x1923('0x7')],'priority':_0x3ca541[_0x1923('0x24')]+_0xd289d6['priority']+_0x197538++,'VoiceExtensionId':_0x5a1d96[_0x1923('0x13')]});}else{_0x15363e[_0x1923('0x15')]({'type':_0x5a1d96[_0x1923('0x12')],'app':'ExecIf','appdata':_0x1923('0x2d'),'context':_0x5a1d96[_0x1923('0x17')],'exten':_0x5a1d96['exten'],'priority':_0x3ca541[_0x1923('0x24')]+_0xd289d6[_0x1923('0xe')]+_0x197538++,'VoiceExtensionId':_0x5a1d96['VoiceExtensionId']});}}if(_0x5a1d96[_0x1923('0xd')](_0x1923('0x2e'))){if(_0x47f245[_0x1923('0x2f')](_0x5a1d96[_0x1923('0x30')][_0x1923('0x25')]())>=0x0&&_0x5a1d96[_0x1923('0x31')]!==_0x1923('0x32')){if(_0x5a1d96['answer']){_0x15363e['push']({'type':_0x5a1d96[_0x1923('0x12')],'app':'ExecIf','appdata':_0x1923('0x33'),'context':_0x5a1d96[_0x1923('0x17')],'exten':_0x5a1d96[_0x1923('0x7')],'priority':_0x3ca541[_0x1923('0x24')]+_0xd289d6[_0x1923('0xe')]+_0x197538++,'VoiceExtensionId':_0x5a1d96[_0x1923('0x13')]});_0x15363e[_0x1923('0x15')]({'type':_0x5a1d96['type'],'app':_0x1923('0x10'),'appdata':_0x1923('0x34'),'context':_0x5a1d96[_0x1923('0x17')],'exten':_0x5a1d96['exten'],'priority':_0x3ca541['length']+_0xd289d6[_0x1923('0xe')]+_0x197538++,'VoiceExtensionId':_0x5a1d96[_0x1923('0x13')]});}else{_0x15363e[_0x1923('0x15')]({'type':_0x5a1d96['type'],'app':_0x1923('0x1c'),'appdata':_0x1923('0x35'),'context':_0x5a1d96[_0x1923('0x17')],'exten':_0x5a1d96[_0x1923('0x7')],'priority':_0x3ca541[_0x1923('0x24')]+_0xd289d6[_0x1923('0xe')]+_0x197538++,'VoiceExtensionId':_0x5a1d96[_0x1923('0x13')]});_0x15363e[_0x1923('0x15')]({'type':_0x5a1d96[_0x1923('0x12')],'app':_0x1923('0x10'),'appdata':_0x1923('0x36'),'context':_0x5a1d96[_0x1923('0x17')],'exten':_0x5a1d96['exten'],'priority':_0x3ca541[_0x1923('0x24')]+_0xd289d6[_0x1923('0xe')]+_0x197538++,'VoiceExtensionId':_0x5a1d96['VoiceExtensionId']});}}}for(var _0x512127=0x0;_0x512127<_0x3ca541[_0x1923('0x24')];_0x512127+=0x1){var _0x5fa95a=_0xd289d6['priority']+_0x3ca541['length'];var _0x582f87=_0x512127===_0x3ca541['length']-0x1?_0xd289d6['priority']+_0x15363e[_0x1923('0x24')]+_0x20371f[_0x1923('0x24')]+0x2:_0xd289d6['priority']+_0x512127+0x1;_0x15363e[_0x1923('0x37')](_0x512127,0x0,{'type':_0x5a1d96['type'],'app':_0x1923('0x38'),'appdata':_0x3ca541[_0x512127]+'?'+_0x5a1d96[_0x1923('0x17')]+',${EXTEN},'+_0x5fa95a+':'+_0x5a1d96[_0x1923('0x17')]+_0x1923('0x39')+_0x582f87,'exten':_0x5a1d96[_0x1923('0x7')],'context':_0x5a1d96[_0x1923('0x17')],'priority':_0xd289d6['priority']+_0x512127,'VoiceExtensionId':_0x3fdb41[_0x39be7c][0x0]['VoiceExtensionId']});}_0x5a1d96['priority']=_0x15363e[_0x1923('0x24')]?_[_0x1923('0x3a')](_0x15363e)[_0x1923('0xe')]+0x1:_0xd289d6[_0x1923('0xe')];_0xd289d6['priority']=(_0x20371f[_0x1923('0x24')]?_['last'](_0x20371f)[_0x1923('0xe')]:_0x5a1d96[_0x1923('0xe')])+0x1;_0xd289d6[_0x1923('0xf')]=_[_0x1923('0x3b')](_0xd289d6[_0x1923('0xf')],_0x15363e,[_0x5a1d96],_0x20371f);}_0xd289d6[_0x1923('0xf')][_0x1923('0x15')]({'type':_0x3fdb41[_0x39be7c][0x0][_0x1923('0x12')],'app':_0x1923('0x3c'),'exten':_0x3fdb41[_0x39be7c][0x0][_0x1923('0x7')],'context':_0x3fdb41[_0x39be7c][0x0][_0x1923('0x17')],'priority':_0xd289d6[_0x1923('0xe')],'VoiceExtensionId':_0x3fdb41[_0x39be7c][0x0][_0x1923('0x13')]});_0xe42e23[_0x1923('0x15')](_0x3fdb41[_0x39be7c][0x0][_0x1923('0x13')]);_0x60b578=_['concat'](_0x60b578,_0xd289d6[_0x1923('0xf')]);}}return _0x5c8789[_0x1923('0x3d')](function(_0x1be5d4){return _0x5c8789[_0x1923('0x1')][_0x1923('0x3e')][_0x1923('0x3f')]({'where':{'VoiceExtensionId':{'$in':_0xe42e23}},'transaction':_0x1be5d4})[_0x1923('0x4')](function(_0x36a516){return _0x5c8789['models'][_0x1923('0x3e')][_0x1923('0x40')](_[_0x1923('0x41')](_0x60b578,_0x1923('0xe')),{'transaction':_0x1be5d4});});});})[_0x1923('0x42')](function(_0x16f87c){console[_0x1923('0x43')](_0x16f87c);});}exports[_0x1923('0x44')]=rewrite; \ No newline at end of file +var _0x01f4=['CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-PROGRESS=0','length','toLowerCase','updatedAt','interval','IntervalId','tag','CDR(tag)=','outbound','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','app','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','GotoIfTime',',${EXTEN},','last','concat','transaction','destroy','sortBy','catch','error','rewrite','lodash','models','Interval','findAll','then','intervals','VoiceExtension','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','queue','playback','hasOwnProperty','extensions','find','type','Set','CDR(type)=%s','context','priority','VoiceExtensionId','inbound','push','CDR(routeid)=','extension','${EXTEN:','cutdigits','${EXTEN}','ExecIf','):Goto('];(function(_0x3ce170,_0x45bc4){var _0x25a116=function(_0x4bc4a1){while(--_0x4bc4a1){_0x3ce170['push'](_0x3ce170['shift']());}};_0x25a116(++_0x45bc4);}(_0x01f4,0x16c));var _0x401f=function(_0x562ee4,_0x78312c){_0x562ee4=_0x562ee4-0x0;var _0x63e933=_0x01f4[_0x562ee4];return _0x63e933;};'use strict';var _=require(_0x401f('0x0'));var util=require('util');function rewrite(_0x48e640,_0x3eadb9){var _0x162640=this;return _0x48e640[_0x401f('0x1')][_0x401f('0x2')][_0x401f('0x3')]({'raw':!![]})[_0x401f('0x4')](function(_0x894811){_0x162640[_0x401f('0x5')]=_0x894811;return _0x48e640[_0x401f('0x1')]['VoiceExtension'][_0x401f('0x3')]({'where':{'IntervalId':_0x3eadb9['IntervalId']},'raw':!![]});})['then'](function(_0x2de83c){return _0x48e640['models'][_0x401f('0x6')][_0x401f('0x3')]({'where':{'exten':{'$in':_['uniq'](_[_0x401f('0x7')](_0x2de83c,_0x401f('0x8')))}},'order':[{'raw':_0x401f('0x9')}],'raw':!![]});})[_0x401f('0x4')](function(_0x630438){var _0x4b4e38=_['filter'](_0x630438,{'priority':'1'});var _0x2bc3bc=_[_0x401f('0xa')](_0x630438,{'isApp':0x1});var _0x52de4f=_[_0x401f('0xb')](_0x2bc3bc,'exten');var _0x418dcf=[_0x401f('0xc'),_0x401f('0xd')];var _0x5d5380=[];var _0x4e174=[];for(var _0x532f91 in _0x52de4f){if(_0x52de4f[_0x401f('0xe')](_0x532f91)){_0x162640['priority']=0x2;_0x162640[_0x401f('0xf')]=[];_0x162640['extension']=_[_0x401f('0x10')](_0x4b4e38,{'exten':_0x52de4f[_0x532f91][0x0]['exten']});_0x162640['extensions']['push']({'type':_0x52de4f[_0x532f91][0x0][_0x401f('0x11')],'app':_0x401f('0x12'),'appdata':util['format'](_0x401f('0x13'),_0x52de4f[_0x532f91][0x0][_0x401f('0x11')]),'context':_0x52de4f[_0x532f91][0x0][_0x401f('0x14')],'exten':_0x52de4f[_0x532f91][0x0][_0x401f('0x8')],'priority':_0x162640[_0x401f('0x15')]++,'VoiceExtensionId':_0x52de4f[_0x532f91][0x0][_0x401f('0x16')]});if(_0x52de4f[_0x532f91][0x0][_0x401f('0x11')]===_0x401f('0x17')){_0x162640[_0x401f('0xf')][_0x401f('0x18')]({'type':_0x52de4f[_0x532f91][0x0][_0x401f('0x11')],'app':_0x401f('0x12'),'appdata':_0x401f('0x19')+_0x52de4f[_0x532f91][0x0]['VoiceExtensionId'],'context':_0x52de4f[_0x532f91][0x0][_0x401f('0x14')],'exten':_0x52de4f[_0x532f91][0x0][_0x401f('0x8')],'priority':_0x162640[_0x401f('0x15')]++,'VoiceExtensionId':_0x52de4f[_0x532f91][0x0][_0x401f('0x16')]});}else if(_0x52de4f[_0x532f91][0x0][_0x401f('0x11')]==='outbound'){if(_0x162640[_0x401f('0x1a')]){_0x162640['extensions']['push']({'type':_0x52de4f[_0x532f91][0x0][_0x401f('0x11')],'app':_0x401f('0x12'),'appdata':'CDR(destination)='+(_0x162640[_0x401f('0x1a')]['cutdigits']?_0x401f('0x1b')+_0x162640[_0x401f('0x1a')][_0x401f('0x1c')]+'}':_0x401f('0x1d')),'context':_0x52de4f[_0x532f91][0x0]['context'],'exten':_0x52de4f[_0x532f91][0x0][_0x401f('0x8')],'priority':_0x162640[_0x401f('0x15')]++,'VoiceExtensionId':_0x52de4f[_0x532f91][0x0][_0x401f('0x16')]});}_0x162640[_0x401f('0xf')]['push']({'type':_0x52de4f[_0x532f91][0x0]['type'],'app':'Set','appdata':_0x401f('0x19')+_0x52de4f[_0x532f91][0x0]['VoiceExtensionId'],'context':_0x52de4f[_0x532f91][0x0][_0x401f('0x14')],'exten':_0x52de4f[_0x532f91][0x0][_0x401f('0x8')],'priority':_0x162640[_0x401f('0x15')]++,'VoiceExtensionId':_0x52de4f[_0x532f91][0x0][_0x401f('0x16')]});var _0x32e1af=_0x162640['priority']++;_0x162640[_0x401f('0xf')][_0x401f('0x18')]({'type':_0x52de4f[_0x532f91][0x0][_0x401f('0x11')],'app':_0x401f('0x1e'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x32e1af+0x2)+_0x401f('0x1f')+(_0x32e1af+0x1)+')','context':_0x52de4f[_0x532f91][0x0]['context'],'exten':_0x52de4f[_0x532f91][0x0][_0x401f('0x8')],'priority':_0x32e1af,'VoiceExtensionId':_0x52de4f[_0x532f91][0x0]['VoiceExtensionId']});if(_0x162640[_0x401f('0x1a')]){_0x162640[_0x401f('0xf')][_0x401f('0x18')]({'type':_0x52de4f[_0x532f91][0x0]['type'],'app':'Set','appdata':_0x162640[_0x401f('0x1a')][_0x401f('0x1c')]?_0x401f('0x20')+_0x162640['extension'][_0x401f('0x1c')]+'}':_0x401f('0x21'),'context':_0x52de4f[_0x532f91][0x0][_0x401f('0x14')],'exten':_0x52de4f[_0x532f91][0x0][_0x401f('0x8')],'priority':_0x162640[_0x401f('0x15')]++,'VoiceExtensionId':_0x52de4f[_0x532f91][0x0][_0x401f('0x16')]});}_0x162640[_0x401f('0xf')][_0x401f('0x18')]({'type':_0x52de4f[_0x532f91][0x0][_0x401f('0x11')],'app':_0x401f('0x12'),'appdata':_0x401f('0x22')+_0x52de4f[_0x532f91][0x0][_0x401f('0x16')],'context':_0x52de4f[_0x532f91][0x0][_0x401f('0x14')],'exten':_0x52de4f[_0x532f91][0x0][_0x401f('0x8')],'priority':_0x162640[_0x401f('0x15')]++,'VoiceExtensionId':_0x52de4f[_0x532f91][0x0]['VoiceExtensionId']});if(_0x162640['extension']&&_0x162640[_0x401f('0x1a')][_0x401f('0xe')](_0x401f('0x23'))&&_0x162640[_0x401f('0x1a')][_0x401f('0x23')]!=='none'){_0x162640[_0x401f('0xf')][_0x401f('0x18')]({'type':_0x52de4f[_0x532f91][0x0][_0x401f('0x11')],'app':_0x401f('0x12'),'appdata':_0x401f('0x24'),'context':_0x52de4f[_0x532f91][0x0][_0x401f('0x14')],'exten':_0x52de4f[_0x532f91][0x0][_0x401f('0x8')],'priority':_0x162640['priority']++,'VoiceExtensionId':_0x52de4f[_0x532f91][0x0]['VoiceExtensionId']});_0x162640[_0x401f('0xf')]['push']({'type':_0x52de4f[_0x532f91][0x0][_0x401f('0x11')],'app':'Set','appdata':_0x401f('0x25')+_0x162640['extension'][_0x401f('0x23')]||_0x401f('0x26'),'context':_0x52de4f[_0x532f91][0x0][_0x401f('0x14')],'exten':_0x52de4f[_0x532f91][0x0][_0x401f('0x8')],'priority':_0x162640[_0x401f('0x15')]++,'VoiceExtensionId':_0x52de4f[_0x532f91][0x0][_0x401f('0x16')]});}}_0x162640[_0x401f('0xf')][_0x401f('0x18')]({'type':_0x52de4f[_0x532f91][0x0]['type'],'app':_0x401f('0x12'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x52de4f[_0x532f91][0x0][_0x401f('0x14')],'exten':_0x52de4f[_0x532f91][0x0]['exten'],'priority':_0x162640[_0x401f('0x15')]++,'VoiceExtensionId':_0x52de4f[_0x532f91][0x0][_0x401f('0x16')]});_0x162640[_0x401f('0xf')][_0x401f('0x18')]({'type':_0x52de4f[_0x532f91][0x0][_0x401f('0x11')],'app':_0x401f('0x12'),'appdata':_0x401f('0x27'),'context':_0x52de4f[_0x532f91][0x0][_0x401f('0x14')],'exten':_0x52de4f[_0x532f91][0x0][_0x401f('0x8')],'priority':_0x162640[_0x401f('0x15')]++,'VoiceExtensionId':_0x52de4f[_0x532f91][0x0]['VoiceExtensionId']});_0x162640[_0x401f('0xf')][_0x401f('0x18')]({'type':_0x52de4f[_0x532f91][0x0][_0x401f('0x11')],'app':_0x401f('0x12'),'appdata':'MONITOR_OPTIONS=ab','context':_0x52de4f[_0x532f91][0x0][_0x401f('0x14')],'exten':_0x52de4f[_0x532f91][0x0][_0x401f('0x8')],'priority':_0x162640[_0x401f('0x15')]++,'VoiceExtensionId':_0x52de4f[_0x532f91][0x0][_0x401f('0x16')]});for(var _0x42d89b=0x0,_0x59a3dc=0x0;_0x42d89b<_0x52de4f[_0x532f91][_0x401f('0x28')];_0x42d89b+=0x1,_0x59a3dc=0x0){var _0x32de15=_0x52de4f[_0x532f91][_0x42d89b];if(_0x32de15['type']){_0x32de15[_0x401f('0x11')]=_0x32de15[_0x401f('0x11')][_0x401f('0x29')]();}var _0x5f0e7f=[];var _0x212046=[];delete _0x32de15['id'];delete _0x32de15['createdAt'];delete _0x32de15[_0x401f('0x2a')];var _0x47717b=_0x32de15[_0x401f('0x2b')]!=='*,*,*,*'?[_0x32de15[_0x401f('0x2b')]]:_0x32de15[_0x401f('0x2c')]?_[_0x401f('0x7')](_['filter'](_0x162640[_0x401f('0x5')],{'IntervalId':_0x32de15['IntervalId']}),_0x401f('0x2b')):[];if(_0x32de15['hasOwnProperty'](_0x401f('0x2d'))){if(_0x32de15[_0x401f('0x2d')]&&_0x32de15[_0x401f('0x2d')]!=='--'){_0x5f0e7f[_0x401f('0x18')]({'type':_0x32de15['type'],'app':_0x401f('0x12'),'appdata':_0x401f('0x2e')+_0x32de15[_0x401f('0x2d')],'context':_0x32de15[_0x401f('0x14')],'exten':_0x32de15[_0x401f('0x8')],'priority':_0x47717b[_0x401f('0x28')]+_0x162640[_0x401f('0x15')]+_0x59a3dc++,'VoiceExtensionId':_0x32de15[_0x401f('0x16')]});}}if(_0x32de15[_0x401f('0x11')]===_0x401f('0x2f')&&_0x32de15['hasOwnProperty'](_0x401f('0x30'))){if(_0x32de15['callerID']){_0x5f0e7f['push']({'type':_0x32de15[_0x401f('0x11')],'app':'ExecIf','appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)='+_0x32de15[_0x401f('0x30')]+')','context':_0x32de15['context'],'exten':_0x32de15['exten'],'priority':_0x47717b[_0x401f('0x28')]+_0x162640[_0x401f('0x15')]+_0x59a3dc++,'VoiceExtensionId':_0x32de15[_0x401f('0x16')]});}else{_0x5f0e7f[_0x401f('0x18')]({'type':_0x32de15[_0x401f('0x11')],'app':_0x401f('0x1e'),'appdata':_0x401f('0x31'),'context':_0x32de15[_0x401f('0x14')],'exten':_0x32de15[_0x401f('0x8')],'priority':_0x47717b[_0x401f('0x28')]+_0x162640[_0x401f('0x15')]+_0x59a3dc++,'VoiceExtensionId':_0x32de15[_0x401f('0x16')]});}}if(_0x32de15[_0x401f('0xe')](_0x401f('0x32'))){if(_0x418dcf[_0x401f('0x33')](_0x32de15[_0x401f('0x34')][_0x401f('0x29')]())>=0x0&&_0x32de15['appType']!==_0x401f('0x35')){if(_0x32de15['answer']){_0x5f0e7f['push']({'type':_0x32de15[_0x401f('0x11')],'app':_0x401f('0x1e'),'appdata':_0x401f('0x36'),'context':_0x32de15['context'],'exten':_0x32de15['exten'],'priority':_0x47717b['length']+_0x162640[_0x401f('0x15')]+_0x59a3dc++,'VoiceExtensionId':_0x32de15[_0x401f('0x16')]});_0x5f0e7f[_0x401f('0x18')]({'type':_0x32de15[_0x401f('0x11')],'app':_0x401f('0x12'),'appdata':_0x401f('0x37'),'context':_0x32de15['context'],'exten':_0x32de15[_0x401f('0x8')],'priority':_0x47717b[_0x401f('0x28')]+_0x162640[_0x401f('0x15')]+_0x59a3dc++,'VoiceExtensionId':_0x32de15['VoiceExtensionId']});}else{_0x5f0e7f[_0x401f('0x18')]({'type':_0x32de15['type'],'app':_0x401f('0x1e'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x32de15['context'],'exten':_0x32de15['exten'],'priority':_0x47717b[_0x401f('0x28')]+_0x162640['priority']+_0x59a3dc++,'VoiceExtensionId':_0x32de15[_0x401f('0x16')]});_0x5f0e7f[_0x401f('0x18')]({'type':_0x32de15[_0x401f('0x11')],'app':_0x401f('0x12'),'appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x32de15[_0x401f('0x14')],'exten':_0x32de15[_0x401f('0x8')],'priority':_0x47717b[_0x401f('0x28')]+_0x162640[_0x401f('0x15')]+_0x59a3dc++,'VoiceExtensionId':_0x32de15[_0x401f('0x16')]});}}}for(var _0x149af0=0x0;_0x149af0<_0x47717b['length'];_0x149af0+=0x1){var _0xbf9d56=_0x162640[_0x401f('0x15')]+_0x47717b[_0x401f('0x28')];var _0x410c01=_0x149af0===_0x47717b[_0x401f('0x28')]-0x1?_0x162640[_0x401f('0x15')]+_0x5f0e7f[_0x401f('0x28')]+_0x212046[_0x401f('0x28')]+0x2:_0x162640[_0x401f('0x15')]+_0x149af0+0x1;_0x5f0e7f['splice'](_0x149af0,0x0,{'type':_0x32de15[_0x401f('0x11')],'app':_0x401f('0x38'),'appdata':_0x47717b[_0x149af0]+'?'+_0x32de15['context']+_0x401f('0x39')+_0xbf9d56+':'+_0x32de15[_0x401f('0x14')]+_0x401f('0x39')+_0x410c01,'exten':_0x32de15[_0x401f('0x8')],'context':_0x32de15[_0x401f('0x14')],'priority':_0x162640[_0x401f('0x15')]+_0x149af0,'VoiceExtensionId':_0x52de4f[_0x532f91][0x0][_0x401f('0x16')]});}_0x32de15[_0x401f('0x15')]=_0x5f0e7f[_0x401f('0x28')]?_[_0x401f('0x3a')](_0x5f0e7f)[_0x401f('0x15')]+0x1:_0x162640['priority'];_0x162640['priority']=(_0x212046[_0x401f('0x28')]?_[_0x401f('0x3a')](_0x212046)[_0x401f('0x15')]:_0x32de15[_0x401f('0x15')])+0x1;_0x162640['extensions']=_[_0x401f('0x3b')](_0x162640['extensions'],_0x5f0e7f,[_0x32de15],_0x212046);}_0x162640['extensions'][_0x401f('0x18')]({'type':_0x52de4f[_0x532f91][0x0][_0x401f('0x11')],'app':'Hangup','exten':_0x52de4f[_0x532f91][0x0][_0x401f('0x8')],'context':_0x52de4f[_0x532f91][0x0][_0x401f('0x14')],'priority':_0x162640[_0x401f('0x15')],'VoiceExtensionId':_0x52de4f[_0x532f91][0x0][_0x401f('0x16')]});_0x5d5380[_0x401f('0x18')](_0x52de4f[_0x532f91][0x0][_0x401f('0x16')]);_0x4e174=_['concat'](_0x4e174,_0x162640['extensions']);}}return _0x48e640[_0x401f('0x3c')](function(_0x42b7cd){return _0x48e640[_0x401f('0x1')][_0x401f('0x6')][_0x401f('0x3d')]({'where':{'VoiceExtensionId':{'$in':_0x5d5380}},'transaction':_0x42b7cd})[_0x401f('0x4')](function(_0x33da0b){return _0x48e640[_0x401f('0x1')][_0x401f('0x6')]['bulkCreate'](_[_0x401f('0x3e')](_0x4e174,'priority'),{'transaction':_0x42b7cd});});});})[_0x401f('0x3f')](function(_0x2df8e5){console[_0x401f('0x40')](_0x2df8e5);});}exports[_0x401f('0x41')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index 5f9b5e8..f97df6d 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 _0x8164=['squel','papaparse','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','api','redis','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','argv','undefined','Missing\x20filepath\x20parameter!','null','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20socket_timestamp\x20parameter!','contact','index','test','error','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','map','message','join','hasOwnProperty','data','firstName\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','length','find','duplicate','Duplicate\x20Contact','CmContact','keys','push','catch','Error\x20while\x20creating\x20contact:\x20','cmContact','checkHopper','insert','into','cm_hopper','phone','scheduledAt','ContactId','updatedAt','select','field','NOW()','createdAt','from','cm_contacts','where','deletedAt\x20IS\x20NULL','phone\x20NOT\x20IN\x20(?)','toString','fromQuery','ListId\x20=\x20?','id\x20IN\x20?','str','phone\x20IS\x20NOT\x20NULL','calleridnum','cm_hopper_final','\x20=\x20?','cm_hopper_black','VoiceQueue','findAll','outbound','dialCheckDuplicateType','CmList','Lists','then','always','sequelize','query','VoiceQueueId','onlyIfOpen','all','BlackLists','get','Campaign','CampaignId','generalCheckHopper','Error\x20processing\x20rows\x20block:','stringify','finally','contact:csv_','resolve','unlinkSync','exit','SIGINT','info','CSV\x20import\x20process\x20stopped!','createReadStream','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','bluebird','util','lodash'];(function(_0x235152,_0x2c9454){var _0x21d93c=function(_0x5e4860){while(--_0x5e4860){_0x235152['push'](_0x235152['shift']());}};_0x21d93c(++_0x2c9454);}(_0x8164,0x14a));var _0x4816=function(_0x46aebd,_0x488973){_0x46aebd=_0x46aebd-0x0;var _0x549577=_0x8164[_0x46aebd];return _0x549577;};'use strict';var BPromise=require(_0x4816('0x0'));var util=require(_0x4816('0x1'));var _=require(_0x4816('0x2'));var fs=require('fs');var squel=require(_0x4816('0x3'));var Papa=require(_0x4816('0x4'));var Redis=require(_0x4816('0x5'));var db=require(_0x4816('0x6'))['db'];var config=require(_0x4816('0x7'));var logger=require(_0x4816('0x8'))(_0x4816('0x9'));config[_0x4816('0xa')]=_['defaults'](config['redis'],{'host':_0x4816('0xb'),'port':0x18eb});var socket=require(_0x4816('0xc'))(new Redis(config[_0x4816('0xa')]));require(_0x4816('0xd'))['register'](socket);try{if(!process['argv'][0x2]||process[_0x4816('0xe')][0x2]===_0x4816('0xf')||process[_0x4816('0xe')][0x2]==='null'){throw new Error(_0x4816('0x10'));}var FILEPATH=process['argv'][0x2];if(!process[_0x4816('0xe')][0x3]||process[_0x4816('0xe')][0x3]===_0x4816('0xf')||process[_0x4816('0xe')][0x3]==='null'||!process[_0x4816('0xe')][0x4]||process['argv'][0x4]===_0x4816('0xf')||process[_0x4816('0xe')][0x4]===_0x4816('0x11')){throw new Error(_0x4816('0x12'));}var FIELDS=_[_0x4816('0x13')](process[_0x4816('0xe')][0x3][_0x4816('0x14')](','),process[_0x4816('0xe')][0x4]['split'](','));if(!process[_0x4816('0xe')][0x5]||process[_0x4816('0xe')][0x5]===_0x4816('0xf')||process[_0x4816('0xe')][0x5]==='null'){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process['argv'][0x5];var COMPANYID=process[_0x4816('0xe')][0x6]&&process[_0x4816('0xe')][0x6]!==_0x4816('0xf')&&process[_0x4816('0xe')][0x6]!=='null'?process[_0x4816('0xe')][0x6]:null;var DUPLICATES=process['argv'][0x7]&&process['argv'][0x7]!==_0x4816('0xf')&&process['argv'][0x7]!==_0x4816('0x11')?process[_0x4816('0xe')][0x7]:null;if(!process[_0x4816('0xe')][0x8]||process['argv'][0x8]===_0x4816('0xf')||process['argv'][0x8]===_0x4816('0x11')){throw new Error(_0x4816('0x15'));}var SOCKET_TIMESTAMP=process[_0x4816('0xe')][0x8];}catch(_0x2e3062){logger['error'](_0x2e3062);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(_0x2e7d8f,_0x20b2b1,_0x2a1118,_0x23e06c){var _0x5c5e05={'message':_0x20b2b1};_0x5c5e05[_0x2e7d8f]=!![];if(_0x2a1118){_0x5c5e05[_0x4816('0x16')]=_0x2a1118;}if(_0x23e06c){_0x5c5e05[_0x4816('0x17')]=_0x23e06c;}return _0x5c5e05;}function isEmail(_0x1fe2de){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))*$/[_0x4816('0x18')](_0x1fe2de);}function checkRow(_0x523d69,_0x338415,_0x5db8e5){return new BPromise(function(_0x37fa37,_0x247a19){if(_['isNil'](_0x523d69)){return _0x247a19(handleCheckRowError(_0x4816('0x19'),_0x4816('0x1a'),null,_0x5db8e5));}if(_0x523d69[_0x4816('0x1b')]&&_0x523d69[_0x4816('0x1b')]['length']){var _0x3f60b1=_[_0x4816('0x1c')](_0x523d69[_0x4816('0x1b')],_0x4816('0x1d'))[_0x4816('0x1e')](';');return _0x247a19(handleCheckRowError(_0x4816('0x19'),_0x3f60b1,null,_0x5db8e5));}var _0x25a4b4={};for(var _0x31973a in FIELDS){if(FIELDS[_0x4816('0x1f')](_0x31973a)&&FIELDS[_0x31973a]){_0x25a4b4[_0x31973a]=_0x523d69['data'][0x0][FIELDS[_0x31973a]]||_0x523d69[_0x4816('0x20')][0x0]['\ufeff'+FIELDS[_0x31973a]];}}if(!_0x25a4b4['firstName']){return _0x247a19(handleCheckRowError('error',_0x4816('0x21'),null,_0x5db8e5));}if(!_0x25a4b4['phone']){return _0x247a19(handleCheckRowError(_0x4816('0x19'),'phone\x20not\x20specified!',null,_0x5db8e5));}if(_0x25a4b4[_0x4816('0x22')]){var _0x236e7c=moment(_0x25a4b4[_0x4816('0x22')],_0x4816('0x23'));if(!_0x236e7c[_0x4816('0x24')]()){return _0x247a19(handleCheckRowError(_0x4816('0x19'),_0x4816('0x25'),null,_0x5db8e5));}}if(_0x25a4b4[_0x4816('0x26')]){if(!isEmail(_0x25a4b4[_0x4816('0x26')])){return _0x247a19(handleCheckRowError(_0x4816('0x19'),_0x4816('0x27'),null,_0x5db8e5));}}_0x25a4b4[_0x4816('0x28')]=LISTID;_0x25a4b4[_0x4816('0x29')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES['length']&&_0x338415){var _0x44c34d={};for(var _0x5ab71f=0x0,_0x3c5e5a=DUPLICATES[_0x4816('0x2a')];_0x5ab71f<_0x3c5e5a;_0x5ab71f+=0x1){_0x44c34d[DUPLICATES[_0x5ab71f]]=_0x25a4b4[DUPLICATES[_0x5ab71f]];}var _0x454f8a=_[_0x4816('0x2b')](_0x338415,_0x44c34d);if(_0x454f8a){return _0x247a19(handleCheckRowError(_0x4816('0x2c'),_0x4816('0x2d'),_0x454f8a,_0x5db8e5));}}return db[_0x4816('0x2e')]['create'](_0x25a4b4,{'raw':!![],'hooks':![],'fields':_[_0x4816('0x2f')](_0x25a4b4)})['then'](function(_0x1ad97a){if(DUPLICATES&&DUPLICATES[_0x4816('0x2a')]&&_0x338415){_0x338415[_0x4816('0x30')](_['pick'](_0x25a4b4,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x1ad97a['id'];return _0x37fa37();})[_0x4816('0x31')](function(_0x38202d){return _0x247a19(handleCheckRowError(_0x4816('0x19'),_0x4816('0x32')+(_0x38202d[_0x4816('0x1d')]||JSON['stringify'](_0x38202d)),null,_0x5db8e5));});});}function checkHopper(){function _0x2a3669(){return function(_0x36233d){logger['error'](_0x4816('0x33'),_0x4816('0x34'),util['inspect'](_0x36233d,{'showHidden':![],'depth':null}));};}var _0x26f4bc=function(_0x10056f,_0x2573fc){var _0x1a3f64=squel[_0x4816('0x35')]()[_0x4816('0x36')](_0x4816('0x37'))['fromQuery']([_0x4816('0x38'),_0x4816('0x39'),_0x4816('0x3a'),'ListId',_0x2573fc,'createdAt',_0x4816('0x3b')],squel[_0x4816('0x3c')]()[_0x4816('0x3d')](_0x4816('0x38'),_0x4816('0x38'))['field'](_0x4816('0x3e'),_0x4816('0x39'))[_0x4816('0x3d')]('id',_0x4816('0x3a'))['field'](LISTID['toString'](),_0x4816('0x28'))['field'](_0x10056f['id']['toString'](),_0x2573fc)[_0x4816('0x3d')]('NOW()',_0x4816('0x3f'))[_0x4816('0x3d')]('NOW()',_0x4816('0x3b'))[_0x4816('0x40')](_0x4816('0x41'))[_0x4816('0x42')](_0x4816('0x43'))[_0x4816('0x42')]('ListId\x20=\x20?',LISTID['toString']())[_0x4816('0x42')]('phone\x20IS\x20NOT\x20NULL')[_0x4816('0x42')](_0x4816('0x44'),squel['select']()[_0x4816('0x3d')](_0x4816('0x38'))[_0x4816('0x40')](_0x4816('0x37'))[_0x4816('0x42')](_0x2573fc+'\x20=\x20?',_0x10056f['id'][_0x4816('0x45')]())))[_0x4816('0x45')]();return _0x1a3f64;};var _0xe9839d=function(_0x2166a8,_0x228b17){var _0x24de5c=squel[_0x4816('0x35')]()[_0x4816('0x36')](_0x4816('0x37'))[_0x4816('0x46')](['phone',_0x4816('0x39'),'ContactId','ListId',_0x228b17,_0x4816('0x3f'),_0x4816('0x3b')],squel['select']()[_0x4816('0x3d')](_0x4816('0x38'),_0x4816('0x38'))['field'](_0x4816('0x3e'),_0x4816('0x39'))[_0x4816('0x3d')]('id',_0x4816('0x3a'))[_0x4816('0x3d')](LISTID[_0x4816('0x45')](),'ListId')[_0x4816('0x3d')](_0x2166a8['id'][_0x4816('0x45')](),_0x228b17)['field'](_0x4816('0x3e'),_0x4816('0x3f'))['field'](_0x4816('0x3e'),_0x4816('0x3b'))[_0x4816('0x40')]('cm_contacts')[_0x4816('0x42')](_0x4816('0x43'))['where'](_0x4816('0x47'),LISTID[_0x4816('0x45')]())[_0x4816('0x42')](_0x4816('0x48'),squel[_0x4816('0x49')](hopperContacts))['where'](_0x4816('0x4a'))['where'](_0x4816('0x44'),squel[_0x4816('0x3c')]()[_0x4816('0x3d')](_0x4816('0x4b'))[_0x4816('0x40')](_0x4816('0x4c'))['where'](_0x228b17+_0x4816('0x4d'),_0x2166a8['id'][_0x4816('0x45')]()))[_0x4816('0x42')](_0x4816('0x44'),squel[_0x4816('0x3c')]()['field'](_0x4816('0x38'))[_0x4816('0x40')](_0x4816('0x37'))['where'](_0x228b17+_0x4816('0x4d'),_0x2166a8['id']['toString']())))['toString']();return _0x24de5c;};function _0x7f6716(_0x11b092,_0x2fa180){var _0x2fc050=squel[_0x4816('0x35')]()[_0x4816('0x36')](_0x4816('0x37'))[_0x4816('0x46')]([_0x4816('0x38'),'scheduledAt',_0x4816('0x3a'),_0x4816('0x28'),_0x2fa180,_0x4816('0x3f'),'updatedAt'],squel[_0x4816('0x3c')]()[_0x4816('0x3d')](_0x4816('0x38'),_0x4816('0x38'))[_0x4816('0x3d')](_0x4816('0x3e'),'scheduledAt')[_0x4816('0x3d')]('id','ContactId')['field'](LISTID[_0x4816('0x45')](),'ListId')['field'](_0x11b092['id'][_0x4816('0x45')](),_0x2fa180)[_0x4816('0x3d')](_0x4816('0x3e'),_0x4816('0x3f'))[_0x4816('0x3d')](_0x4816('0x3e'),'updatedAt')[_0x4816('0x40')](_0x4816('0x41'))[_0x4816('0x42')](_0x4816('0x43'))[_0x4816('0x42')](_0x4816('0x47'),LISTID[_0x4816('0x45')]())[_0x4816('0x42')]('id\x20IN\x20?',squel['str'](hopperContacts))[_0x4816('0x42')](_0x4816('0x4a')))[_0x4816('0x45')]();return _0x2fc050;}function _0x5e00f2(_0x615905,_0x3eb8f7){var _0x2567f6=squel[_0x4816('0x35')]()[_0x4816('0x36')](_0x4816('0x4e'))[_0x4816('0x46')]([_0x4816('0x38'),'ContactId',_0x4816('0x28'),_0x3eb8f7,_0x4816('0x3f'),_0x4816('0x3b')],squel['select']()[_0x4816('0x3d')]('phone',_0x4816('0x38'))[_0x4816('0x3d')]('id','ContactId')[_0x4816('0x3d')](LISTID['toString'](),_0x4816('0x28'))[_0x4816('0x3d')](_0x615905['id'][_0x4816('0x45')](),_0x3eb8f7)[_0x4816('0x3d')](_0x4816('0x3e'),_0x4816('0x3f'))[_0x4816('0x3d')]('NOW()',_0x4816('0x3b'))[_0x4816('0x40')](_0x4816('0x41'))[_0x4816('0x42')](_0x4816('0x43'))[_0x4816('0x42')](_0x4816('0x47'),LISTID[_0x4816('0x45')]())[_0x4816('0x42')]('id\x20IN\x20?',squel[_0x4816('0x49')](hopperContacts))[_0x4816('0x42')](_0x4816('0x4a')))[_0x4816('0x45')]();return _0x2567f6;}return db[_0x4816('0x4f')][_0x4816('0x50')]({'where':{'type':_0x4816('0x51')},'attributes':['id',_0x4816('0x52')],'include':[{'model':db[_0x4816('0x53')],'as':_0x4816('0x54'),'where':{'id':LISTID}}]})[_0x4816('0x55')](function(_0x258c43){var _0x38e02b=[];if(_0x258c43){var _0x393788;for(var _0x503a20=0x0,_0x2b89a4;_0x503a20<_0x258c43[_0x4816('0x2a')];_0x503a20+=0x1){_0x2b89a4=_0x258c43[_0x503a20]['get']({'plain':!![]});switch(_0x2b89a4['dialCheckDuplicateType']){case _0x4816('0x56'):_0x38e02b[_0x4816('0x30')](db[_0x4816('0x57')][_0x4816('0x58')](_0xe9839d(_0x2b89a4,_0x4816('0x59')))[_0x4816('0x55')](function(){})['catch'](_0x2a3669()));break;case _0x4816('0x5a'):_0x38e02b['push'](db[_0x4816('0x57')][_0x4816('0x58')](_0x26f4bc(_0x2b89a4,_0x4816('0x59')))[_0x4816('0x55')](function(){})[_0x4816('0x31')](_0x2a3669()));break;default:_0x38e02b[_0x4816('0x30')](db['sequelize'][_0x4816('0x58')](_0x7f6716(_0x2b89a4,'VoiceQueueId'))[_0x4816('0x55')](function(){})[_0x4816('0x31')](_0x2a3669()));}}}return _0x38e02b;})[_0x4816('0x5b')]()[_0x4816('0x55')](function(){return db['VoiceQueue']['findAll']({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':db[_0x4816('0x53')],'as':_0x4816('0x5c'),'where':{'id':LISTID}}]})[_0x4816('0x55')](function(_0x485a17){var _0xf5343a=[];if(_0x485a17){var _0x226796;for(var _0x467160=0x0,_0x554a2f;_0x467160<_0x485a17['length'];_0x467160+=0x1){_0x554a2f=_0x485a17[_0x467160][_0x4816('0x5d')]({'plain':!![]});_0xf5343a['push'](db[_0x4816('0x57')][_0x4816('0x58')](_0x5e00f2(_0x554a2f,_0x4816('0x59')))[_0x4816('0x55')](function(){})[_0x4816('0x31')](_0x2a3669()));}}return _0xf5343a;})[_0x4816('0x5b')]();})[_0x4816('0x55')](function(){return db[_0x4816('0x5e')][_0x4816('0x50')]({'attributes':['id',_0x4816('0x52')],'include':[{'model':db['CmList'],'as':_0x4816('0x54'),'where':{'id':LISTID}}]})[_0x4816('0x55')](function(_0xcaaebd){var _0x55ed8c=[];if(_0xcaaebd){for(var _0x406261=0x0,_0xe1e404;_0x406261<_0xcaaebd[_0x4816('0x2a')];_0x406261+=0x1){_0xe1e404=_0xcaaebd[_0x406261][_0x4816('0x5d')]({'plain':!![]});switch(_0xe1e404['dialCheckDuplicateType']){case'always':_0x55ed8c['push'](db[_0x4816('0x57')][_0x4816('0x58')](_0xe9839d(_0xe1e404,'CampaignId'))['then'](function(){})[_0x4816('0x31')](_0x2a3669()));break;case _0x4816('0x5a'):_0x55ed8c[_0x4816('0x30')](db['sequelize'][_0x4816('0x58')](_0x26f4bc(_0xe1e404,_0x4816('0x5f')))[_0x4816('0x55')](function(){})[_0x4816('0x31')](_0x2a3669()));break;default:_0x55ed8c['push'](db['sequelize']['query'](_0x7f6716(_0xe1e404,_0x4816('0x5f')))[_0x4816('0x55')](function(){})['catch'](_0x2a3669()));}}}return _0x55ed8c;})[_0x4816('0x5b')]();})[_0x4816('0x55')](function(){return db[_0x4816('0x5e')][_0x4816('0x50')]({'attributes':['id'],'include':[{'model':db['CmList'],'as':'BlackLists','where':{'id':LISTID}}]})['then'](function(_0x14ae85){var _0x5a1c80=[];if(_0x14ae85){for(var _0x6a6a04=0x0,_0x434a64;_0x6a6a04<_0x14ae85[_0x4816('0x2a')];_0x6a6a04+=0x1){_0x434a64=_0x14ae85[_0x6a6a04][_0x4816('0x5d')]({'plain':!![]});_0x5a1c80['push'](db[_0x4816('0x57')][_0x4816('0x58')](_0x5e00f2(_0x434a64,'CampaignId'))[_0x4816('0x55')](function(){})[_0x4816('0x31')](_0x2a3669()));}}return _0x5a1c80;})['all']();})[_0x4816('0x31')](function(_0x355c72){logger['error']('cmContact,\x20%s,\x20%s',_0x4816('0x60'),_0x355c72['message']);});}var processPromises=function(_0x3cf681){return BPromise[_0x4816('0x5b')](promises)[_0x4816('0x55')](function(_0xf004c4){})[_0x4816('0x31')](function(_0x10b977){logger[_0x4816('0x19')](_0x4816('0x61'),JSON[_0x4816('0x62')](_0x10b977));})[_0x4816('0x63')](function(){socket['emit'](_0x4816('0x64')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x3cf681){return _0x3cf681['resume']();}});};var endCsv=function(){return BPromise[_0x4816('0x65')]()[_0x4816('0x55')](function(){if(hopperContacts){return checkHopper();}})['then'](function(){socket['emit']('contact:csv_'+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x4816('0x66')](FILEPATH);}catch(_0x2e6ec4){logger[_0x4816('0x19')]('Unable\x20to\x20delete\x20temp\x20file:',JSON[_0x4816('0x62')](_0x2e6ec4));}finally{process[_0x4816('0x67')](0x0);}});};process['on'](_0x4816('0x68'),function(){logger[_0x4816('0x69')](_0x4816('0x6a'));endCsv();});function main(){return BPromise[_0x4816('0x65')]()['then'](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x4816('0x14')](',');return db[_0x4816('0x2e')][_0x4816('0x50')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x4816('0x55')](function(_0x2063fb){var _0x4bc15e=fs[_0x4816('0x6b')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa['parse'](_0x4bc15e,{'header':!![],'skipEmptyLines':!![],'step':function(_0x2997b9,_0x1264d2){total+=0x1;var _0x2453f5=total;promises[_0x4816('0x30')](checkRow(_0x2997b9,_0x2063fb,_0x2453f5)[_0x4816('0x55')](function(){success+=0x1;})[_0x4816('0x31')](function(_0x49599b){if(_0x49599b[_0x4816('0x19')]){errors+=0x1;delete _0x49599b[_0x4816('0x19')];}else if(_0x49599b[_0x4816('0x2c')]){duplicates+=0x1;delete _0x49599b[_0x4816('0x2c')];}rows[_0x4816('0x30')](_0x49599b);}));if(total%0xc8===0x0){_0x1264d2[_0x4816('0x6c')]();return processPromises(_0x1264d2);}},'complete':function(){return processPromises()['then'](function(){logger['info'](_0x4816('0x6d'));endCsv();});},'error':function(_0x368f8c,_0x2c1eba){logger[_0x4816('0x69')](_0x4816('0x6e'),JSON[_0x4816('0x62')](_0x368f8c));endCsv();}});})['catch'](function(_0x2b6d33){logger['error']('Error\x20executing\x20contact\x20csv\x20import:',JSON[_0x4816('0x62')](_0x2b6d33));});}main(); \ No newline at end of file +var _0x055d=['resume','resolve','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','SIGINT','info','CSV\x20import\x20process\x20stopped!','CmContact','createReadStream','parse','pause','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','squel','papaparse','ioredis','../../../mysqldb','../../../config/logger','localhost','socket.io-emitter','redis','../../../api/cmContact/cmContact.socket','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','split','Missing\x20ListId\x20parameter!','error','index','test','errors','length','map','join','data','firstName','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','find','duplicate','keys','pick','catch','message','stringify','checkHopper','inspect','into','fromQuery','scheduledAt','ContactId','createdAt','updatedAt','select','field','NOW()','toString','from','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','cm_hopper','id\x20IN\x20?','str','insert','phone\x20IS\x20NOT\x20NULL','VoiceQueue','findAll','outbound','dialCheckDuplicateType','Lists','then','always','push','sequelize','query','VoiceQueueId','onlyIfOpen','all','Campaign','CmList','get','CampaignId','BlackLists','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','finally','emit'];(function(_0x4112f5,_0x304bfe){var _0x44b7e6=function(_0x4946d6){while(--_0x4946d6){_0x4112f5['push'](_0x4112f5['shift']());}};_0x44b7e6(++_0x304bfe);}(_0x055d,0x76));var _0xd055=function(_0x579a0d,_0x3a6de9){_0x579a0d=_0x579a0d-0x0;var _0xebbbb8=_0x055d[_0x579a0d];return _0xebbbb8;};'use strict';var BPromise=require(_0xd055('0x0'));var util=require(_0xd055('0x1'));var _=require('lodash');var fs=require('fs');var squel=require(_0xd055('0x2'));var Papa=require(_0xd055('0x3'));var Redis=require(_0xd055('0x4'));var db=require(_0xd055('0x5'))['db'];var config=require('../../../config/environment');var logger=require(_0xd055('0x6'))('api');config['redis']=_['defaults'](config['redis'],{'host':_0xd055('0x7'),'port':0x18eb});var socket=require(_0xd055('0x8'))(new Redis(config[_0xd055('0x9')]));require(_0xd055('0xa'))['register'](socket);try{if(!process[_0xd055('0xb')][0x2]||process['argv'][0x2]===_0xd055('0xc')||process[_0xd055('0xb')][0x2]===_0xd055('0xd')){throw new Error(_0xd055('0xe'));}var FILEPATH=process['argv'][0x2];if(!process[_0xd055('0xb')][0x3]||process[_0xd055('0xb')][0x3]==='undefined'||process[_0xd055('0xb')][0x3]==='null'||!process['argv'][0x4]||process[_0xd055('0xb')][0x4]===_0xd055('0xc')||process[_0xd055('0xb')][0x4]===_0xd055('0xd')){throw new Error(_0xd055('0xf'));}var FIELDS=_['zipObject'](process[_0xd055('0xb')][0x3][_0xd055('0x10')](','),process[_0xd055('0xb')][0x4][_0xd055('0x10')](','));if(!process[_0xd055('0xb')][0x5]||process[_0xd055('0xb')][0x5]==='undefined'||process[_0xd055('0xb')][0x5]===_0xd055('0xd')){throw new Error(_0xd055('0x11'));}var LISTID=process[_0xd055('0xb')][0x5];var COMPANYID=process[_0xd055('0xb')][0x6]&&process[_0xd055('0xb')][0x6]!==_0xd055('0xc')&&process[_0xd055('0xb')][0x6]!=='null'?process['argv'][0x6]:null;var DUPLICATES=process['argv'][0x7]&&process['argv'][0x7]!=='undefined'&&process['argv'][0x7]!==_0xd055('0xd')?process[_0xd055('0xb')][0x7]:null;if(!process[_0xd055('0xb')][0x8]||process['argv'][0x8]===_0xd055('0xc')||process[_0xd055('0xb')][0x8]===_0xd055('0xd')){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process[_0xd055('0xb')][0x8];}catch(_0x576701){logger[_0xd055('0x12')](_0x576701);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(_0x2cd4f9,_0x2a4acb,_0x5e8eab,_0x456c3e){var _0x36c54a={'message':_0x2a4acb};_0x36c54a[_0x2cd4f9]=!![];if(_0x5e8eab){_0x36c54a['contact']=_0x5e8eab;}if(_0x456c3e){_0x36c54a[_0xd055('0x13')]=_0x456c3e;}return _0x36c54a;}function isEmail(_0xf6148b){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))*$/[_0xd055('0x14')](_0xf6148b);}function checkRow(_0x1adc63,_0x45580e,_0xfce87c){return new BPromise(function(_0x20ed03,_0x328dde){if(_['isNil'](_0x1adc63)){return _0x328dde(handleCheckRowError(_0xd055('0x12'),'The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!',null,_0xfce87c));}if(_0x1adc63[_0xd055('0x15')]&&_0x1adc63[_0xd055('0x15')][_0xd055('0x16')]){var _0x440ff5=_[_0xd055('0x17')](_0x1adc63[_0xd055('0x15')],'message')[_0xd055('0x18')](';');return _0x328dde(handleCheckRowError(_0xd055('0x12'),_0x440ff5,null,_0xfce87c));}var _0x20f32d={};for(var _0x3a55af in FIELDS){if(FIELDS['hasOwnProperty'](_0x3a55af)&&FIELDS[_0x3a55af]){_0x20f32d[_0x3a55af]=_0x1adc63['data'][0x0][FIELDS[_0x3a55af]]||_0x1adc63[_0xd055('0x19')][0x0]['\ufeff'+FIELDS[_0x3a55af]];}}if(!_0x20f32d[_0xd055('0x1a')]){return _0x328dde(handleCheckRowError(_0xd055('0x12'),_0xd055('0x1b'),null,_0xfce87c));}if(!_0x20f32d[_0xd055('0x1c')]){return _0x328dde(handleCheckRowError(_0xd055('0x12'),_0xd055('0x1d'),null,_0xfce87c));}if(_0x20f32d[_0xd055('0x1e')]){var _0x50c519=moment(_0x20f32d[_0xd055('0x1e')],_0xd055('0x1f'));if(!_0x50c519[_0xd055('0x20')]()){return _0x328dde(handleCheckRowError(_0xd055('0x12'),_0xd055('0x21'),null,_0xfce87c));}}if(_0x20f32d['email']){if(!isEmail(_0x20f32d[_0xd055('0x22')])){return _0x328dde(handleCheckRowError(_0xd055('0x12'),_0xd055('0x23'),null,_0xfce87c));}}_0x20f32d[_0xd055('0x24')]=LISTID;_0x20f32d[_0xd055('0x25')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES['length']&&_0x45580e){var _0x5b0fac={};for(var _0x4137db=0x0,_0x1626e9=DUPLICATES[_0xd055('0x16')];_0x4137db<_0x1626e9;_0x4137db+=0x1){_0x5b0fac[DUPLICATES[_0x4137db]]=_0x20f32d[DUPLICATES[_0x4137db]];}var _0x349423=_[_0xd055('0x26')](_0x45580e,_0x5b0fac);if(_0x349423){return _0x328dde(handleCheckRowError(_0xd055('0x27'),'Duplicate\x20Contact',_0x349423,_0xfce87c));}}return db['CmContact']['create'](_0x20f32d,{'raw':!![],'hooks':![],'fields':_[_0xd055('0x28')](_0x20f32d)})['then'](function(_0x590996){if(DUPLICATES&&DUPLICATES[_0xd055('0x16')]&&_0x45580e){_0x45580e['push'](_[_0xd055('0x29')](_0x20f32d,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x590996['id'];return _0x20ed03();})[_0xd055('0x2a')](function(_0x372965){return _0x328dde(handleCheckRowError('error','Error\x20while\x20creating\x20contact:\x20'+(_0x372965[_0xd055('0x2b')]||JSON[_0xd055('0x2c')](_0x372965)),null,_0xfce87c));});});}function checkHopper(){function _0x18634b(){return function(_0x42488f){logger[_0xd055('0x12')]('cmContact',_0xd055('0x2d'),util[_0xd055('0x2e')](_0x42488f,{'showHidden':![],'depth':null}));};}var _0x1db59b=function(_0x15096a,_0x4611a6){var _0x9d7ab4=squel['insert']()[_0xd055('0x2f')]('cm_hopper')[_0xd055('0x30')]([_0xd055('0x1c'),_0xd055('0x31'),_0xd055('0x32'),'ListId',_0x4611a6,_0xd055('0x33'),_0xd055('0x34')],squel[_0xd055('0x35')]()[_0xd055('0x36')](_0xd055('0x1c'),'phone')[_0xd055('0x36')](_0xd055('0x37'),'scheduledAt')[_0xd055('0x36')]('id',_0xd055('0x32'))[_0xd055('0x36')](LISTID['toString'](),_0xd055('0x24'))['field'](_0x15096a['id'][_0xd055('0x38')](),_0x4611a6)[_0xd055('0x36')](_0xd055('0x37'),'createdAt')[_0xd055('0x36')]('NOW()',_0xd055('0x34'))[_0xd055('0x39')](_0xd055('0x3a'))[_0xd055('0x3b')](_0xd055('0x3c'))[_0xd055('0x3b')](_0xd055('0x3d'),LISTID[_0xd055('0x38')]())[_0xd055('0x3b')]('phone\x20IS\x20NOT\x20NULL')[_0xd055('0x3b')](_0xd055('0x3e'),squel['select']()['field'](_0xd055('0x1c'))[_0xd055('0x39')]('cm_hopper')[_0xd055('0x3b')](_0x4611a6+_0xd055('0x3f'),_0x15096a['id'][_0xd055('0x38')]())))[_0xd055('0x38')]();return _0x9d7ab4;};var _0x1dad82=function(_0xa3bcd6,_0x5e3a62){var _0x29faa4=squel['insert']()[_0xd055('0x2f')](_0xd055('0x40'))[_0xd055('0x30')](['phone',_0xd055('0x31'),'ContactId',_0xd055('0x24'),_0x5e3a62,'createdAt',_0xd055('0x34')],squel[_0xd055('0x35')]()[_0xd055('0x36')]('phone','phone')['field']('NOW()',_0xd055('0x31'))['field']('id',_0xd055('0x32'))[_0xd055('0x36')](LISTID[_0xd055('0x38')](),_0xd055('0x24'))['field'](_0xa3bcd6['id'][_0xd055('0x38')](),_0x5e3a62)[_0xd055('0x36')](_0xd055('0x37'),_0xd055('0x33'))[_0xd055('0x36')](_0xd055('0x37'),_0xd055('0x34'))[_0xd055('0x39')]('cm_contacts')[_0xd055('0x3b')](_0xd055('0x3c'))[_0xd055('0x3b')](_0xd055('0x3d'),LISTID[_0xd055('0x38')]())[_0xd055('0x3b')](_0xd055('0x41'),squel[_0xd055('0x42')](hopperContacts))['where']('phone\x20IS\x20NOT\x20NULL')[_0xd055('0x3b')]('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0xd055('0x36')]('calleridnum')[_0xd055('0x39')]('cm_hopper_final')[_0xd055('0x3b')](_0x5e3a62+_0xd055('0x3f'),_0xa3bcd6['id'][_0xd055('0x38')]()))[_0xd055('0x3b')](_0xd055('0x3e'),squel[_0xd055('0x35')]()[_0xd055('0x36')](_0xd055('0x1c'))['from'](_0xd055('0x40'))[_0xd055('0x3b')](_0x5e3a62+_0xd055('0x3f'),_0xa3bcd6['id'][_0xd055('0x38')]())))['toString']();return _0x29faa4;};function _0x3651ac(_0x2524dc,_0x279a22){var _0x19c63f=squel[_0xd055('0x43')]()[_0xd055('0x2f')](_0xd055('0x40'))[_0xd055('0x30')]([_0xd055('0x1c'),_0xd055('0x31'),'ContactId',_0xd055('0x24'),_0x279a22,_0xd055('0x33'),_0xd055('0x34')],squel['select']()['field'](_0xd055('0x1c'),_0xd055('0x1c'))['field'](_0xd055('0x37'),_0xd055('0x31'))['field']('id',_0xd055('0x32'))['field'](LISTID[_0xd055('0x38')](),_0xd055('0x24'))['field'](_0x2524dc['id'][_0xd055('0x38')](),_0x279a22)[_0xd055('0x36')](_0xd055('0x37'),'createdAt')[_0xd055('0x36')](_0xd055('0x37'),_0xd055('0x34'))[_0xd055('0x39')]('cm_contacts')[_0xd055('0x3b')](_0xd055('0x3c'))[_0xd055('0x3b')]('ListId\x20=\x20?',LISTID[_0xd055('0x38')]())[_0xd055('0x3b')](_0xd055('0x41'),squel[_0xd055('0x42')](hopperContacts))[_0xd055('0x3b')](_0xd055('0x44')))[_0xd055('0x38')]();return _0x19c63f;}function _0x2faeeb(_0x342c0f,_0xc8e8fc){var _0x5a6ba8=squel[_0xd055('0x43')]()[_0xd055('0x2f')]('cm_hopper_black')['fromQuery']([_0xd055('0x1c'),_0xd055('0x32'),_0xd055('0x24'),_0xc8e8fc,_0xd055('0x33'),_0xd055('0x34')],squel['select']()[_0xd055('0x36')](_0xd055('0x1c'),_0xd055('0x1c'))[_0xd055('0x36')]('id',_0xd055('0x32'))[_0xd055('0x36')](LISTID[_0xd055('0x38')](),_0xd055('0x24'))['field'](_0x342c0f['id'][_0xd055('0x38')](),_0xc8e8fc)[_0xd055('0x36')](_0xd055('0x37'),_0xd055('0x33'))['field']('NOW()',_0xd055('0x34'))['from'](_0xd055('0x3a'))['where'](_0xd055('0x3c'))[_0xd055('0x3b')](_0xd055('0x3d'),LISTID[_0xd055('0x38')]())[_0xd055('0x3b')](_0xd055('0x41'),squel['str'](hopperContacts))[_0xd055('0x3b')](_0xd055('0x44')))[_0xd055('0x38')]();return _0x5a6ba8;}return db[_0xd055('0x45')][_0xd055('0x46')]({'where':{'type':_0xd055('0x47')},'attributes':['id',_0xd055('0x48')],'include':[{'model':db['CmList'],'as':_0xd055('0x49'),'where':{'id':LISTID}}]})[_0xd055('0x4a')](function(_0x1bbe4f){var _0x936d28=[];if(_0x1bbe4f){var _0x580769;for(var _0x16f70a=0x0,_0x5c7117;_0x16f70a<_0x1bbe4f[_0xd055('0x16')];_0x16f70a+=0x1){_0x5c7117=_0x1bbe4f[_0x16f70a]['get']({'plain':!![]});switch(_0x5c7117[_0xd055('0x48')]){case _0xd055('0x4b'):_0x936d28[_0xd055('0x4c')](db[_0xd055('0x4d')][_0xd055('0x4e')](_0x1dad82(_0x5c7117,_0xd055('0x4f')))[_0xd055('0x4a')](function(){})[_0xd055('0x2a')](_0x18634b()));break;case _0xd055('0x50'):_0x936d28[_0xd055('0x4c')](db[_0xd055('0x4d')]['query'](_0x1db59b(_0x5c7117,_0xd055('0x4f')))[_0xd055('0x4a')](function(){})['catch'](_0x18634b()));break;default:_0x936d28[_0xd055('0x4c')](db['sequelize'][_0xd055('0x4e')](_0x3651ac(_0x5c7117,_0xd055('0x4f')))[_0xd055('0x4a')](function(){})[_0xd055('0x2a')](_0x18634b()));}}}return _0x936d28;})[_0xd055('0x51')]()[_0xd055('0x4a')](function(){return db[_0xd055('0x45')][_0xd055('0x46')]({'where':{'type':_0xd055('0x47')},'attributes':['id'],'include':[{'model':db['CmList'],'as':'BlackLists','where':{'id':LISTID}}]})[_0xd055('0x4a')](function(_0x34314f){var _0x68c1fa=[];if(_0x34314f){var _0x2ff8b;for(var _0x5c82db=0x0,_0x6d5384;_0x5c82db<_0x34314f[_0xd055('0x16')];_0x5c82db+=0x1){_0x6d5384=_0x34314f[_0x5c82db]['get']({'plain':!![]});_0x68c1fa[_0xd055('0x4c')](db['sequelize'][_0xd055('0x4e')](_0x2faeeb(_0x6d5384,_0xd055('0x4f')))[_0xd055('0x4a')](function(){})['catch'](_0x18634b()));}}return _0x68c1fa;})['all']();})[_0xd055('0x4a')](function(){return db[_0xd055('0x52')][_0xd055('0x46')]({'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0xd055('0x53')],'as':_0xd055('0x49'),'where':{'id':LISTID}}]})['then'](function(_0x1d6cd0){var _0x2f6458=[];if(_0x1d6cd0){for(var _0x2a8e37=0x0,_0x2f0bb8;_0x2a8e37<_0x1d6cd0[_0xd055('0x16')];_0x2a8e37+=0x1){_0x2f0bb8=_0x1d6cd0[_0x2a8e37][_0xd055('0x54')]({'plain':!![]});switch(_0x2f0bb8[_0xd055('0x48')]){case _0xd055('0x4b'):_0x2f6458[_0xd055('0x4c')](db[_0xd055('0x4d')][_0xd055('0x4e')](_0x1dad82(_0x2f0bb8,_0xd055('0x55')))[_0xd055('0x4a')](function(){})['catch'](_0x18634b()));break;case _0xd055('0x50'):_0x2f6458['push'](db['sequelize'][_0xd055('0x4e')](_0x1db59b(_0x2f0bb8,_0xd055('0x55')))['then'](function(){})[_0xd055('0x2a')](_0x18634b()));break;default:_0x2f6458[_0xd055('0x4c')](db[_0xd055('0x4d')]['query'](_0x3651ac(_0x2f0bb8,_0xd055('0x55')))[_0xd055('0x4a')](function(){})[_0xd055('0x2a')](_0x18634b()));}}}return _0x2f6458;})[_0xd055('0x51')]();})[_0xd055('0x4a')](function(){return db[_0xd055('0x52')][_0xd055('0x46')]({'attributes':['id'],'include':[{'model':db[_0xd055('0x53')],'as':_0xd055('0x56'),'where':{'id':LISTID}}]})[_0xd055('0x4a')](function(_0x3ead13){var _0x48627b=[];if(_0x3ead13){for(var _0x44cdfd=0x0,_0x208383;_0x44cdfd<_0x3ead13[_0xd055('0x16')];_0x44cdfd+=0x1){_0x208383=_0x3ead13[_0x44cdfd][_0xd055('0x54')]({'plain':!![]});_0x48627b[_0xd055('0x4c')](db['sequelize'][_0xd055('0x4e')](_0x2faeeb(_0x208383,'CampaignId'))['then'](function(){})['catch'](_0x18634b()));}}return _0x48627b;})[_0xd055('0x51')]();})[_0xd055('0x2a')](function(_0x319c8a){logger[_0xd055('0x12')](_0xd055('0x57'),_0xd055('0x58'),_0x319c8a[_0xd055('0x2b')]);});}var processPromises=function(_0x4d8e8d){return BPromise[_0xd055('0x51')](promises)['then'](function(_0x37351d){})['catch'](function(_0x1c4e23){logger[_0xd055('0x12')](_0xd055('0x59'),JSON[_0xd055('0x2c')](_0x1c4e23));})[_0xd055('0x5a')](function(){socket[_0xd055('0x5b')]('contact:csv_'+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x4d8e8d){return _0x4d8e8d[_0xd055('0x5c')]();}});};var endCsv=function(){return BPromise[_0xd055('0x5d')]()[_0xd055('0x4a')](function(){if(hopperContacts){return checkHopper();}})['then'](function(){socket[_0xd055('0x5b')]('contact:csv_'+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0xd055('0x5e')](FILEPATH);}catch(_0x1cf41e){logger['error'](_0xd055('0x5f'),JSON['stringify'](_0x1cf41e));}finally{process['exit'](0x0);}});};process['on'](_0xd055('0x60'),function(){logger[_0xd055('0x61')](_0xd055('0x62'));endCsv();});function main(){return BPromise[_0xd055('0x5d')]()[_0xd055('0x4a')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES['split'](',');return db[_0xd055('0x63')]['findAll']({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0xd055('0x4a')](function(_0x5b7167){var _0x27029c=fs[_0xd055('0x64')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0xd055('0x65')](_0x27029c,{'header':!![],'skipEmptyLines':!![],'step':function(_0x24d211,_0x15b2f7){total+=0x1;var _0x5a57bb=total;promises[_0xd055('0x4c')](checkRow(_0x24d211,_0x5b7167,_0x5a57bb)['then'](function(){success+=0x1;})['catch'](function(_0x405f3c){if(_0x405f3c['error']){errors+=0x1;delete _0x405f3c[_0xd055('0x12')];}else if(_0x405f3c['duplicate']){duplicates+=0x1;delete _0x405f3c[_0xd055('0x27')];}rows[_0xd055('0x4c')](_0x405f3c);}));if(total%0xc8===0x0){_0x15b2f7[_0xd055('0x66')]();return processPromises(_0x15b2f7);}},'complete':function(){return processPromises()['then'](function(){logger[_0xd055('0x61')]('CSV\x20parsed\x20correctly!');endCsv();});},'error':function(_0x1c6f24,_0x62c258){logger[_0xd055('0x61')](_0xd055('0x67'),JSON[_0xd055('0x2c')](_0x1c6f24));endCsv();}});})['catch'](function(_0x13de48){logger['error'](_0xd055('0x68'),JSON[_0xd055('0x2c')](_0x13de48));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 248c3a5..420a865 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 _0x67a2=['ContactId','ListId','createdAt','updatedAt','UserId','fields','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','\x22always\x22','\x22onlyIfOpen\x22','cm_contacts.phone\x20NOT\x20IN\x20(?)','cm_contacts.createdAt','cm_contacts','cm_hopper_black','toString','date_add(cm_contacts.scheduledat,interval\x20','.offset-cm_contacts.utcOffset\x20minute)','scheduledat','priority','recallme','ListId\x20=\x20?','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','CmHopperId','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_hopper.ListId\x20=\x20?','concat','keys',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','MIN(id)','min_id','Received\x20SIGINT','error','message','exit','code','info','sequelize','campaigns.id','campaigns.dialTimezone','campaigns_has_cm_lists','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','catch','voice_queues.id','voice_queues.dialTimezone','voice_queues','voice_queues_has_cm_lists','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','voice_queues_has_cm_lists.CmListId=','query','spread','utcOffset','set','dialTimezone','main','stringify','send','binding','clone','root','server/files/tmp','.csv','includes','header','ContactItemType','name','_description','writeFileSync','parse','createReadStream','data','errors','find','hasOwnProperty','trim','replace','isValid','isNaN','isNumber','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','timezones','firstName','\x20not\x20specified','itemTypeId','description','rows','contact:import:','abort','SystemError','step','duplicates','cm_contacts_','\x20LIKE\x20cm_contacts;','campaigns_','CREATE\x20TABLE\x20','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','each',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','contactTypeId','orderBy','VoiceQueueId','voice_queues_has_cm_blacklists','CampaignId','campaigns_has_cm_blacklists','campaigns','finish','affectedRows','unlink','complete','argv','arguments\x20\x20\x20','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','SIGINT','path','lodash','papaparse','util','bluebird','moment','ioredis','../../../mysqldb','../../../config/environment','../../../config/environment/shared','../../../config/logger','import','defaults','redis','format','YYYY-MM-DD\x20HH:mm:ss','test','select','field','phone','from','join','.id\x20=\x20','\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','findAll','AdditionalPhones','length','push','then','split','all','isNil','filter','CmContactHasItem','findOne','update','updated','create','PHONE','inserted','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.updatedAt','cm_contacts.UserId','insert','into','cm_hopper','fromQuery'];(function(_0x540dcb,_0x4eacb6){var _0x49353c=function(_0x449bb1){while(--_0x449bb1){_0x540dcb['push'](_0x540dcb['shift']());}};_0x49353c(++_0x4eacb6);}(_0x67a2,0x134));var _0x267a=function(_0x4c5bf2,_0x49b334){_0x4c5bf2=_0x4c5bf2-0x0;var _0x84df47=_0x67a2[_0x4c5bf2];return _0x84df47;};'use strict';var fs=require('fs');var path=require(_0x267a('0x0'));var _=require(_0x267a('0x1'));var Papa=require(_0x267a('0x2'));var util=require(_0x267a('0x3'));var BPromise=require(_0x267a('0x4'));var moment=require(_0x267a('0x5'));var squel=require('squel');var Redis=require(_0x267a('0x6'));var db=require(_0x267a('0x7'))['db'];var config=require(_0x267a('0x8'));var shared=require(_0x267a('0x9'));var logger=require(_0x267a('0xa'))(_0x267a('0xb'));config['redis']=_[_0x267a('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x267a('0xd')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0x267a('0xe')](_0x267a('0xf'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0x267a('0xe')](_0x267a('0xf'));function isEmail(_0x538bd4){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))*$/[_0x267a('0x10')](_0x538bd4);}function selectNotIn(_0x1145a1,_0x2c2317,_0x4042af,_0x34261b,_0x4fd763){return squel[_0x267a('0x11')]()[_0x267a('0x12')](_0x267a('0x13'))[_0x267a('0x14')](_0x34261b)[_0x267a('0x15')](_0x2c2317,null,_0x2c2317+_0x267a('0x16')+_0x34261b+'.'+_0x4042af)['where'](_0x34261b+'.'+_0x4042af+_0x267a('0x17')+_0x1145a1+'.'+_0x4042af)[_0x267a('0x18')](_0x2c2317+_0x267a('0x19')+_0x4fd763[_0x267a('0x15')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x241fb6,_0x4a5514){promisesAdditionalPhones=[];return db['CmContact'][_0x267a('0x1a')]({'raw':!![],'attributes':['id',_0x267a('0x1b')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})['then'](function(_0x5093d1){if(_0x5093d1!==null){var _0x1cbfe1=[];for(var _0x189dc6=0x0;_0x189dc6<_0x5093d1[_0x267a('0x1c')];_0x189dc6++){var _0x352cdf=_0x5093d1[_0x189dc6];_0x1cbfe1[_0x267a('0x1d')](insertAdditionalPhones(_0x352cdf));}}Promise['all'](_0x1cbfe1)[_0x267a('0x1e')](function(){_0x241fb6({'val':0x1});});});});}function insertAdditionalPhones(_0x5d87a3){return new Promise(function(_0x49cfa2,_0x82ee7){var _0x4530e8=_0x5d87a3[_0x267a('0x1b')];var _0x2d889d=_0x4530e8[_0x267a('0x1f')](';');var _0x1f5003=[];orderBy=0x0;for(var _0x475993=0x0;_0x475993<_0x2d889d[_0x267a('0x1c')];_0x475993++){_0x1f5003[_0x267a('0x1d')](splitAdditionalPhone(_0x5d87a3['id'],_0x2d889d[_0x475993]));}Promise[_0x267a('0x20')](_0x1f5003)['then'](function(){_0x49cfa2({'val':_0x2d889d[_0x267a('0x1c')]});});});}function splitAdditionalPhone(_0x21efda,_0x487d42){return new Promise(function(_0x5ec818,_0x1ebd70){var _0x3d0943=_0x487d42[_0x267a('0x1f')](':');var _0x478523=_0x3d0943[0x0];var _0x3622fd=_0x3d0943[0x1];if(!_[_0x267a('0x21')](_0x3622fd)){var _0x205487=_0x3622fd[_0x267a('0x1f')]('|');var _0x1da75a=[];for(var _0x26dac2=0x0;_0x26dac2<_0x205487[_0x267a('0x1c')];_0x26dac2++){if(_0x205487[_0x26dac2]!==''){var _0x9d9121=_[_0x267a('0x22')](promisesAdditionalPhones,{'contactId':_0x21efda,'phone':_0x205487[_0x26dac2]});if(_0x9d9121[_0x267a('0x1c')]==0x0){orderBy++;promisesAdditionalPhones[_0x267a('0x1d')]({'contactId':_0x21efda,'contactTypeId':_0x478523,'phone':_0x205487[_0x26dac2],'orderBy':orderBy});}}}_0x5ec818({'ok':0x1});}else _0x5ec818({'res':0x0});});}function createAdditionalPhone(_0x5ee87d,_0x191972,_0x35d8d5,_0x5aebbd){var _0x4d2304='';var _0x5d8a05='';var _0x2a4039=_0x35d8d5[_0x267a('0x1f')]('§');_0x4d2304=_0x2a4039[0x0];if(_0x2a4039[_0x267a('0x1c')]==0x2)_0x5d8a05=_0x2a4039[0x1];return new Promise(function(_0x3e1ddd,_0x3ff671){return db[_0x267a('0x23')][_0x267a('0x24')]({'where':{'CmContactId':_0x5ee87d,'item':_0x4d2304}})[_0x267a('0x1e')](function(_0x2d3cf1){if(_0x2d3cf1){return db['CmContactHasItem'][_0x267a('0x25')]({'ItemTypeId':_0x191972,'description':_0x5d8a05,'OrderBy':_0x5aebbd},{'where':{'CmContactId':_0x5ee87d,'item':_0x4d2304}})[_0x267a('0x1e')](function(_0x180d37){_0x3e1ddd({'res':_0x267a('0x26')});});}else{return db['CmContactHasItem'][_0x267a('0x27')]({'CmContactId':_0x5ee87d,'item':_0x4d2304,'description':_0x5d8a05,'ItemTypeId':_0x191972,'OrderBy':_0x5aebbd,'ItemClass':_0x267a('0x28')})['then'](function(_0x2f4fcd){_0x3e1ddd({'res':_0x267a('0x29')});});}});});}function insertCmHopper(_0x5bf1cf,_0x369e3f,_0x57eda1,_0x495696,_0x44db13){var _0x167a22=[_0x267a('0x2a'),_0x267a('0x2b'),_0x267a('0x2c'),_0x267a('0x2d'),_0x369e3f+'.'+_0x495696,'cm_contacts.createdAt',_0x267a('0x2e'),'cm_contacts.priority',_0x267a('0x2f'),'\x22'+_0x44db13+'\x22'];return squel[_0x267a('0x30')]()[_0x267a('0x31')](_0x267a('0x32'))[_0x267a('0x33')]([_0x267a('0x13'),'scheduledat',_0x267a('0x34'),_0x267a('0x35'),_0x495696,_0x267a('0x36'),_0x267a('0x37'),'priority',_0x267a('0x38'),'recallme'],squel['select']()[_0x267a('0x39')](_0x167a22)[_0x267a('0x14')](_0x369e3f)[_0x267a('0x15')]('cm_contacts',null,_0x267a('0x3a')+_0x369e3f+_0x267a('0x3b'))[_0x267a('0x15')](_0x57eda1,null,_0x57eda1+_0x267a('0x16')+_0x369e3f+'.'+_0x495696)[_0x267a('0x18')](_0x369e3f+_0x267a('0x3c'),_0x5bf1cf)[_0x267a('0x18')](_0x267a('0x3d'),NOW)[_0x267a('0x18')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x369e3f,_0x57eda1,_0x495696,_0x267a('0x32'),[_0x267a('0x3e'),_0x267a('0x3f')]))[_0x267a('0x18')](_0x267a('0x40'),selectNotIn(_0x369e3f,_0x57eda1,_0x495696,_0x267a('0x32'),['\x22always\x22'])))['toString']();}function insertCmHopperBlack(_0x177459,_0x11536a,_0x32bc13,_0x55ad0a){var _0x4a160c=[_0x267a('0x2a'),_0x267a('0x2c'),_0x267a('0x2d'),_0x11536a+'.'+_0x55ad0a,_0x267a('0x41'),_0x267a('0x2e')];return squel[_0x267a('0x30')]()['into']('cm_hopper_black')['fromQuery'](['phone',_0x267a('0x34'),_0x267a('0x35'),_0x55ad0a,'createdAt',_0x267a('0x37')],squel[_0x267a('0x11')]()['fields'](_0x4a160c)[_0x267a('0x14')](_0x11536a)[_0x267a('0x15')](_0x267a('0x42'),null,_0x267a('0x3a')+_0x11536a+'.CmListId')[_0x267a('0x15')](_0x32bc13,null,_0x32bc13+_0x267a('0x16')+_0x11536a+'.'+_0x55ad0a)[_0x267a('0x18')](_0x11536a+_0x267a('0x3c'),_0x177459)[_0x267a('0x18')](_0x267a('0x3d'),NOW)[_0x267a('0x18')](_0x267a('0x40'),squel[_0x267a('0x11')]()['field'](_0x267a('0x13'))['from'](_0x267a('0x43'))[_0x267a('0x18')]('ListId\x20=\x20?',_0x177459)[_0x267a('0x18')](_0x55ad0a+'\x20=\x20'+_0x11536a+'.'+_0x55ad0a)))[_0x267a('0x44')]();}function insertTzCmHopper(_0x1fc4ec,_0x1a51ac,_0x5705e8,_0x3550fc,_0x4c8b74,_0x52afe5){var _0x21c737=[_0x267a('0x2a'),_0x267a('0x45')+_0x52afe5+_0x267a('0x46'),_0x267a('0x2c'),_0x267a('0x2d'),_0x1a51ac+'.'+_0x3550fc,'cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority',_0x267a('0x2f'),'\x22'+_0x4c8b74+'\x22'];var _0x303b54=squel['insert']()[_0x267a('0x31')](_0x267a('0x32'))[_0x267a('0x33')]([_0x267a('0x13'),_0x267a('0x47'),_0x267a('0x34'),'ListId',_0x3550fc,_0x267a('0x36'),_0x267a('0x37'),_0x267a('0x48'),_0x267a('0x38'),_0x267a('0x49')],squel[_0x267a('0x11')]()[_0x267a('0x39')](_0x21c737)[_0x267a('0x14')](_0x1a51ac)[_0x267a('0x15')](_0x267a('0x42'),null,_0x267a('0x3a')+_0x1a51ac+_0x267a('0x3b'))[_0x267a('0x15')](_0x5705e8,null,_0x5705e8+_0x267a('0x16')+_0x1a51ac+'.'+_0x3550fc)[_0x267a('0x15')](_0x52afe5,null,_0x52afe5+_0x267a('0x16')+_0x1a51ac+'.'+_0x3550fc)[_0x267a('0x18')](_0x1a51ac+_0x267a('0x3c'),_0x1fc4ec)[_0x267a('0x18')](_0x267a('0x3d'),NOW)['where'](_0x267a('0x40'),selectNotIn(_0x1a51ac,_0x5705e8,_0x3550fc,_0x267a('0x32'),[_0x267a('0x3e'),_0x267a('0x3f')]))[_0x267a('0x18')](_0x267a('0x40'),selectNotIn(_0x1a51ac,_0x5705e8,_0x3550fc,_0x267a('0x32'),[_0x267a('0x3e')])))['toString']();return _0x303b54;}function insertTzCmHopperBlack(_0x1d74d7,_0x73491,_0x44555d,_0x46237e){var _0x2fd997=[_0x267a('0x2a'),_0x267a('0x2c'),'cm_contacts.ListId',_0x73491+'.'+_0x46237e,'cm_contacts.createdAt',_0x267a('0x2e')];return squel[_0x267a('0x30')]()[_0x267a('0x31')]('cm_hopper_black')['fromQuery'](['phone','ContactId',_0x267a('0x35'),_0x46237e,_0x267a('0x36'),_0x267a('0x37')],squel[_0x267a('0x11')]()['fields'](_0x2fd997)[_0x267a('0x14')](_0x73491)['join'](_0x267a('0x42'),null,_0x267a('0x3a')+_0x73491+'.CmListId')['join'](_0x44555d,null,_0x44555d+'.id\x20=\x20'+_0x73491+'.'+_0x46237e)[_0x267a('0x18')](_0x73491+_0x267a('0x3c'),_0x1d74d7)[_0x267a('0x18')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x267a('0x18')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0x267a('0x11')]()[_0x267a('0x12')](_0x267a('0x13'))['from']('cm_hopper_black')[_0x267a('0x18')](_0x267a('0x4a'),_0x1d74d7)[_0x267a('0x18')](_0x46237e+_0x267a('0x17')+_0x73491+'.'+_0x46237e)))['toString']();}function insertCmHopperAdditionalPhones(_0x2cf10c){var _0x2d055d=['cm_hopper.id',_0x267a('0x4b'),_0x267a('0x4c'),_0x267a('0x4d'),'cm_contact_has_items.updatedAt'];return squel['insert']()['into']('cm_hopper_additional_phones')[_0x267a('0x33')]([_0x267a('0x4e'),'phone',_0x267a('0x4f'),_0x267a('0x36'),'updatedAt'],squel[_0x267a('0x11')]()[_0x267a('0x39')](_0x2d055d)[_0x267a('0x14')](_0x267a('0x32'))[_0x267a('0x15')]('cm_contacts',null,_0x267a('0x50'))['join']('cm_contact_has_items',null,'cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId')[_0x267a('0x18')](_0x267a('0x51'),_0x2cf10c)['where']('cm_contacts.createdAt\x20=\x20?',NOW))[_0x267a('0x44')]();}function insertCmContact(_0xc6c2e,_0x34d792,_0x34a740,_0x372714){var _0x5cbc51=_[_0x267a('0x52')](_[_0x267a('0x53')](_0x372714),[_0x267a('0x35'),'CompanyId',_0x267a('0x36'),_0x267a('0x37'),'scheduledAt']);return squel[_0x267a('0x30')]()[_0x267a('0x31')](_0x267a('0x42'))['fromQuery'](_0x5cbc51,squel[_0x267a('0x11')]()[_0x267a('0x39')](_0x5cbc51)['from'](_0x34d792)[_0x267a('0x18')]('('+_0x34a740[_0x267a('0x15')](',')+_0x267a('0x54'),squel[_0x267a('0x11')]()['fields'](_0x34a740)[_0x267a('0x14')](_0x267a('0x42'))['where']('ListId\x20=\x20?',_0xc6c2e)[_0x267a('0x18')](_0x267a('0x55')))[_0x267a('0x18')]('id\x20IN\x20?',squel[_0x267a('0x11')]()[_0x267a('0x12')](_0x267a('0x56'),_0x267a('0x57'))[_0x267a('0x14')](_0x34d792)['group'](_0x34a740['join'](','))))[_0x267a('0x44')]();}function handleStop(){logger['info'](_0x267a('0x58'));stopped=!![];}function handleUncaughtException(_0x1d073c){logger[_0x267a('0x59')](_0x1d073c[_0x267a('0x5a')]);process[_0x267a('0x5b')](0x1);}function handleError(_0xacb8cb,_0x5b5616){stats['errors'][_0x267a('0x1d')]({'name':_0x5b5616[_0x267a('0x5c')],'message':_0x5b5616[_0x267a('0x5a')],'row':_0xacb8cb});}function handleQuery(_0x5465cf){logger[_0x267a('0x5d')](_0x5465cf);return db[_0x267a('0x5e')]['query'](_0x5465cf)['spread'](function(_0x3ef698){results['push'](_0x3ef698);})['catch'](function(_0x3f5ddc){logger[_0x267a('0x59')](_0x3f5ddc[_0x267a('0x5a')]);});}function updateTzCampaigns(_0x2210c3){return new Promise(function(_0x59aa1a,_0x305be9){var _0x566dfd=squel[_0x267a('0x11')]()[_0x267a('0x39')]([_0x267a('0x5f'),_0x267a('0x60')])[_0x267a('0x14')]('campaigns')[_0x267a('0x15')](_0x267a('0x61'),null,_0x267a('0x62'))['where']('campaigns_has_cm_lists.CmListId='+_0x2210c3);db[_0x267a('0x5e')]['query'](_0x566dfd[_0x267a('0x44')]())['spread'](function(_0x2a6d3f){var _0x4950f3=[];for(var _0x353179=0x0;_0x353179<_0x2a6d3f['length'];_0x353179++){_0x4950f3[_0x267a('0x1d')](getTimezoneData(_0x2a6d3f[_0x353179],tmp_campaigns));}BPromise[_0x267a('0x20')](_0x4950f3)[_0x267a('0x1e')](function(){_0x59aa1a({'val':0x1});});})[_0x267a('0x63')](function(_0x1a2e80){logger['error'](_0x1a2e80[_0x267a('0x5a')]);_0x59aa1a({'val':0x0});});});}function updateTzVoiceQueues(_0x2af63b){return new Promise(function(_0x19cc31,_0x4f146c){var _0x52e554=squel[_0x267a('0x11')]()[_0x267a('0x39')]([_0x267a('0x64'),_0x267a('0x65')])['from'](_0x267a('0x66'))[_0x267a('0x15')](_0x267a('0x67'),null,_0x267a('0x68'))[_0x267a('0x18')](_0x267a('0x69')+_0x2af63b);db[_0x267a('0x5e')][_0x267a('0x6a')](_0x52e554['toString']())[_0x267a('0x6b')](function(_0x163eb5){var _0x4cf1a4=[];for(var _0xe44ed4=0x0;_0xe44ed4<_0x163eb5[_0x267a('0x1c')];_0xe44ed4++){_0x4cf1a4[_0x267a('0x1d')](getTimezoneData(_0x163eb5[_0xe44ed4],tmp_voice_queues));}BPromise[_0x267a('0x20')](_0x4cf1a4)[_0x267a('0x1e')](function(){_0x19cc31({'val':0x1});});})['catch'](function(_0x43df34){logger[_0x267a('0x59')](_0x43df34[_0x267a('0x5a')]);_0x19cc31({'val':0x0});});});}function getTimezoneData(_0xf3b8c4,_0x3f7f64){return new Promise(function(_0x22dae0,_0x2f27d7){var _0x36e4c9=shared['timezones'];var _0x164b00=_0x36e4c9[_0xf3b8c4['dialTimezone']];if(_[_0x267a('0x21')](_0x164b00)){_0x22dae0({'ret':0x1});}else{var _0x204395=_0x164b00[_0x267a('0x6c')];var _0x4fd8f8=squel['insert']()[_0x267a('0x31')](_0x3f7f64)['set']('id',_0xf3b8c4['id'])[_0x267a('0x6d')]('offset',_0x204395)[_0x267a('0x6d')](_0x267a('0x6e'),_0xf3b8c4['dialTimezone'])[_0x267a('0x44')]();return db[_0x267a('0x5e')][_0x267a('0x6a')](_0x4fd8f8)['spread'](function(_0x3577db){_0x22dae0({'ret':0x1});})[_0x267a('0x63')](function(_0x273d8c){logger[_0x267a('0x59')](_0x273d8c['message']);_0x2f27d7({'ret':0x1});});}});}function handleTZQuery(_0x38061c){logger['info'](_0x38061c);return db['sequelize'][_0x267a('0x6a')](_0x38061c)[_0x267a('0x6b')](function(_0x2fb287){})['catch'](function(_0x26d955){logger[_0x267a('0x59')](_0x26d955[_0x267a('0x5a')]);});}function main(_0x40e725,_0x16990f,_0xd5e04f,_0x592633){logger[_0x267a('0x5d')](_0x267a('0x6f'),_0x40e725,JSON[_0x267a('0x70')](_0x16990f));process[_0x267a('0x71')]('start');var _0xd8d149=_0x16990f[_0x267a('0x72')];var _0x13769d=_[_0x267a('0x73')](_0xd8d149);var _0x48bc95=_0x16990f['socket_timestamp'];var _0x58b451=path[_0x267a('0x15')](config[_0x267a('0x74')],_0x267a('0x75'),_0x48bc95+_0x267a('0x76'));hasTZ=_[_0x267a('0x53')](_0xd8d149)[_0x267a('0x77')](_0x267a('0x6e'));var _0x26cd6a=_[_0x267a('0x53')](_0xd8d149)['join']();logger[_0x267a('0x5d')](_0x267a('0x78'),_0x26cd6a);db[_0x267a('0x79')][_0x267a('0x1a')]({'raw':!![],'attributes':['id',_0x267a('0x7a')]})[_0x267a('0x1e')](function(_0x2c8251){for(var _0x24a05e=0x0;_0x24a05e<_0x2c8251[_0x267a('0x1c')];_0x24a05e++){if(_0x2c8251[_0x24a05e][_0x267a('0x7a')]in _0xd8d149){contactItemTypes[_0x267a('0x1d')](_0x2c8251[_0x24a05e]);delete _0x13769d[_0x2c8251[_0x24a05e][_0x267a('0x7a')]];hasAdditionalPhones=!![];}for(var _0x57ce71 in _0xd8d149){if(_0x2c8251[_0x24a05e]['name']+_0x267a('0x7b')===_0x57ce71){phoneDescriptions[_0x267a('0x1d')]({'itemTypeId':_0x2c8251[_0x24a05e]['id'],'description':_0x57ce71});delete _0x13769d[_0x57ce71];}}}if(hasAdditionalPhones)_0x13769d['AdditionalPhones']='';var _0x159c38=_['keys'](_0x13769d)[_0x267a('0x15')]();logger[_0x267a('0x5d')](_0x267a('0x78'),_0x159c38);fs[_0x267a('0x7c')](_0x58b451,_0x159c38+'\x0a');Papa[_0x267a('0x7d')](fs[_0x267a('0x7e')](_0x40e725),{'header':!![],'skipEmptyLines':!![],'step':function(_0x46813a,_0x32b358){try{for(var _0x2ece70=0x0,_0x264339=[];_0x2ece70<_0x46813a[_0x267a('0x7f')][_0x267a('0x1c')];_0x2ece70++){stats['rows']+=0x1;if(_0x46813a['errors'][_0x2ece70]){handleError(_0x46813a[_0x267a('0x7f')][_0x2ece70],_0x46813a[_0x267a('0x80')][_0x2ece70]);}else{var _0x179656=[];var _0x2bf601=[];var _0x460816={};for(var _0xb8e522 in _0xd8d149){let _0x3dff16=contactItemTypes[_0x267a('0x81')](_0x4c7e79=>_0x4c7e79['name']===_0xb8e522);let _0x26bfc8=contactItemTypes[_0x267a('0x81')](_0x23143b=>_0x23143b[_0x267a('0x7a')]+_0x267a('0x7b')===_0xb8e522);if(_[_0x267a('0x21')](_0x3dff16)&&_[_0x267a('0x21')](_0x26bfc8)){if(_0xd8d149[_0x267a('0x82')](_0xb8e522)){if(_0x46813a[_0x267a('0x7f')][_0x2ece70][_0xd8d149[_0xb8e522]]){var _0x344a21=_[_0x267a('0x83')](_0x46813a[_0x267a('0x7f')][_0x2ece70][_0xd8d149[_0xb8e522]][_0x267a('0x84')](/"/g,'\x27'));switch(_0xb8e522){case _0x267a('0x47'):var _0x17a79f=moment(_0x344a21,_0x267a('0xf'),!![]);if(_0x17a79f[_0x267a('0x85')]()){_0x264339['push']('\x22'+_0x344a21+'\x22');}else{_0x179656['push']('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case _0x267a('0x48'):var _0x1feeb1=parseInt(_0x344a21);_0x344a21=_[_0x267a('0x86')](_0x1feeb1)||_0x1feeb1<0x0||_0x1feeb1>0x4?_0x592633?0x3:0x2:_0x1feeb1;_0x264339[_0x267a('0x1d')]('\x22'+_0x344a21+'\x22');break;case _0x267a('0x38'):var _0x2870fe=parseInt(_0x344a21);if(_[_0x267a('0x87')](_0x2870fe)&&_[_0x267a('0x77')](_0xd5e04f,_0x2870fe)){_0x264339[_0x267a('0x1d')]('\x22'+_0x2870fe+'\x22');}else{_0x179656[_0x267a('0x1d')]('agent\x20not\x20exists');}break;case _0x267a('0x88'):if(isEmail(_0x344a21)){_0x264339[_0x267a('0x1d')]('\x22'+_0x344a21+'\x22');}else{_0x179656[_0x267a('0x1d')](_0x267a('0x89'));}break;case _0x267a('0x8a'):var _0x60ac5c=moment(_0x344a21,_0x267a('0x8b'),!![]);if(_0x60ac5c['isValid']()){_0x264339[_0x267a('0x1d')]('\x22'+_0x344a21+'\x22');}else{_0x179656['push'](_0x267a('0x8c'));}break;case _0x267a('0x6e'):var _0x5118de=shared[_0x267a('0x8d')];var _0x40935a=_0x5118de[_0x344a21];if(!_[_0x267a('0x21')](_0x40935a)){var _0x428c72=_0x40935a[_0x267a('0x6c')];_0x264339[_0x267a('0x1d')]('\x22'+_0x344a21+'\x22');_0x264339['push']('\x22'+_0x428c72+'\x22');}break;default:_0x264339[_0x267a('0x1d')]('\x22'+_0x344a21+'\x22');}}else{switch(_0xb8e522){case _0x267a('0x8e'):case _0x267a('0x13'):_0x179656['push'](_0xb8e522+_0x267a('0x8f'));break;default:_0x264339[_0x267a('0x1d')]('\x22\x22');}}}}else{var _0x9648c1='';if(!_[_0x267a('0x21')](_0x3dff16)){if(!_0x460816['hasOwnProperty'](_0x3dff16['id'])){if(!_['isNil'](_0x46813a[_0x267a('0x7f')][_0x2ece70][_0xd8d149[_0xb8e522]])){var _0x344a21=_['trim'](_0x46813a[_0x267a('0x7f')][_0x2ece70][_0xd8d149[_0xb8e522]]['replace'](/"/g,'\x27'));var _0x554750=phoneDescriptions['find'](_0x532e81=>_0x532e81[_0x267a('0x90')]===_0x3dff16['id']);if(!_['isNil'](_0x554750)){var _0x7efd57=_[_0x267a('0x83')](_0x46813a[_0x267a('0x7f')][_0x2ece70][_0xd8d149[_0x554750[_0x267a('0x91')]]]['replace'](/"/g,'\x27'));if(!_[_0x267a('0x21')](_0x7efd57))_0x344a21=_0x344a21+'§'+_0x7efd57;}if(_0x9648c1=='')_0x9648c1=_0x344a21;else _0x9648c1+='|'+_0x344a21;}_0x2bf601[_0x267a('0x1d')](_0x3dff16['id']+':'+_0x9648c1);_0x460816[_0x3dff16['id']]=0x1;}}}}if(hasAdditionalPhones){_0x264339[_0x267a('0x1d')]('\x22'+_0x2bf601[_0x267a('0x15')](';')+'\x22');}if(_0x179656[_0x267a('0x1c')]){handleError(_0x46813a[_0x267a('0x7f')][_0x2ece70],{'code':'SystemRow','message':_0x179656[_0x267a('0x15')]()});}else{fs['appendFileSync'](_0x58b451,_0x264339[_0x267a('0x15')]()+'\x0a');}_0x264339=[];}if(!(stats[_0x267a('0x92')]%0xc8)){socket['emit'](_0x267a('0x93')+_0x48bc95,stats);stats['errors']=[];}}if(stopped){logger[_0x267a('0x5d')]('Abort\x20parser');_0x32b358[_0x267a('0x94')]();}}catch(_0x5a6718){handleError(_0x46813a[_0x267a('0x7f')][_0x2ece70],{'code':_0x267a('0x95'),'message':_0x5a6718[_0x267a('0x5a')]});logger[_0x267a('0x59')](_0x267a('0x96'),_0x5a6718[_0x267a('0x5a')]);}},'complete':function(){try{var _0x26796f=[];var _0x5b47d4=[];var _0x50253a=_0x267a('0x42');if(_0x16990f[_0x267a('0x97')]&&_0x16990f[_0x267a('0x97')][_0x267a('0x1c')]){_0x50253a=_0x267a('0x98')+_0x48bc95;_0x26796f[_0x267a('0x1d')]('CREATE\x20TABLE\x20'+_0x50253a+_0x267a('0x99'));}tmp_campaigns=_0x267a('0x9a')+_0x48bc95;tmp_voice_queues='voice_queues_'+_0x48bc95;_0x5b47d4[_0x267a('0x1d')](_0x267a('0x9b')+tmp_campaigns+_0x267a('0x9c'));_0x5b47d4[_0x267a('0x1d')](_0x267a('0x9b')+tmp_voice_queues+_0x267a('0x9c'));BPromise[_0x267a('0x9d')](_0x5b47d4,handleTZQuery)[_0x267a('0x1e')](function(_0x227a8f){updateTzCampaigns(_0x16990f[_0x267a('0x35')])[_0x267a('0x1e')](function(_0x1a6c01){updateTzVoiceQueues(_0x16990f['ListId'])[_0x267a('0x1e')](function(_0x48b063){if(hasTZ)_0x159c38=_0x159c38[_0x267a('0x84')](_0x267a('0x6e'),'dialTimezone,utcOffset');var _0x5cb7c2=util['format']('LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',_0x58b451,_0x50253a,_0x159c38,_0x16990f['ListId'],_0x16990f['CompanyId']||null,NOW,NOW);if(_[_0x267a('0x21')](_0xd8d149[_0x267a('0x47')])){_0x5cb7c2+=_0x267a('0x9e');}_0x26796f['push'](_0x5cb7c2);if(_0x16990f['duplicates']&&_0x16990f[_0x267a('0x97')][_0x267a('0x1c')]){_0x26796f[_0x267a('0x1d')](insertCmContact(_0x16990f[_0x267a('0x35')],_0x50253a,_0x16990f['duplicates'],_0xd8d149));_0x26796f[_0x267a('0x1d')](_0x267a('0x9f')+_0x50253a+';');}BPromise['each'](_0x26796f,handleQuery)['then'](function(_0x8d8e8c){BPromise[_0x267a('0x20')]([handleAdditionalPhones()])[_0x267a('0x1e')](function(){_0x26796f=[];for(var _0x4bbdf6=0x0;_0x4bbdf6_0x4bbd85['name']===_0x233e4a);let _0x8d8f79=contactItemTypes[_0xf57b('0x85')](_0x122191=>_0x122191[_0xf57b('0x7f')]+'_description'===_0x233e4a);if(_['isNil'](_0x30d4fc)&&_[_0xf57b('0x20')](_0x8d8f79)){if(_0x21c3d2['hasOwnProperty'](_0x233e4a)){if(_0x17c1b1[_0xf57b('0x83')][_0xebcbcd][_0x21c3d2[_0x233e4a]]){var _0x12e708=_[_0xf57b('0x86')](_0x17c1b1[_0xf57b('0x83')][_0xebcbcd][_0x21c3d2[_0x233e4a]][_0xf57b('0x87')](/"/g,'\x27'));switch(_0x233e4a){case _0xf57b('0x49'):var _0x4a805a=moment(_0x12e708,_0xf57b('0xe'),!![]);if(_0x4a805a[_0xf57b('0x88')]()){_0x4ef80b[_0xf57b('0x1e')]('\x22'+_0x12e708+'\x22');}else{_0x2c950c['push'](_0xf57b('0x89'));}break;case _0xf57b('0x34'):var _0xedcc40=parseInt(_0x12e708);_0x12e708=_[_0xf57b('0x8a')](_0xedcc40)||_0xedcc40<0x0||_0xedcc40>0x4?_0x5c7544?0x3:0x2:_0xedcc40;_0x4ef80b['push']('\x22'+_0x12e708+'\x22');break;case _0xf57b('0x35'):var _0x952804=parseInt(_0x12e708);if(_[_0xf57b('0x8b')](_0x952804)&&_['includes'](_0x4dd84c,_0x952804)){_0x4ef80b[_0xf57b('0x1e')]('\x22'+_0x952804+'\x22');}else{_0x2c950c[_0xf57b('0x1e')]('agent\x20not\x20exists');}break;case _0xf57b('0x8c'):if(isEmail(_0x12e708)){_0x4ef80b[_0xf57b('0x1e')]('\x22'+_0x12e708+'\x22');}else{_0x2c950c[_0xf57b('0x1e')]('email\x20wrong\x20format');}break;case'dateOfBirth':var _0x20024b=moment(_0x12e708,_0xf57b('0x8d'),!![]);if(_0x20024b[_0xf57b('0x88')]()){_0x4ef80b['push']('\x22'+_0x12e708+'\x22');}else{_0x2c950c['push'](_0xf57b('0x8e'));}break;case _0xf57b('0x71'):var _0x3f6039=shared[_0xf57b('0x70')];var _0xab3b9e=_0x3f6039[_0x12e708];if(!_[_0xf57b('0x20')](_0xab3b9e)){var _0x35c6ff=_0xab3b9e[_0xf57b('0x72')];_0x4ef80b[_0xf57b('0x1e')]('\x22'+_0x12e708+'\x22');_0x4ef80b['push']('\x22'+_0x35c6ff+'\x22');}break;default:_0x4ef80b['push']('\x22'+_0x12e708+'\x22');}}else{switch(_0x233e4a){case _0xf57b('0x8f'):case'phone':_0x2c950c[_0xf57b('0x1e')](_0x233e4a+_0xf57b('0x90'));break;default:_0x4ef80b[_0xf57b('0x1e')]('\x22\x22');}}}}else{var _0x166105='';if(!_['isNil'](_0x30d4fc)){if(!_0x493cd1[_0xf57b('0x91')](_0x30d4fc['id'])){if(!_[_0xf57b('0x20')](_0x17c1b1[_0xf57b('0x83')][_0xebcbcd][_0x21c3d2[_0x233e4a]])){var _0x12e708=_[_0xf57b('0x86')](_0x17c1b1[_0xf57b('0x83')][_0xebcbcd][_0x21c3d2[_0x233e4a]][_0xf57b('0x87')](/"/g,'\x27'));var _0x51550f=phoneDescriptions[_0xf57b('0x85')](_0x3faecf=>_0x3faecf['itemTypeId']===_0x30d4fc['id']);if(!_['isNil'](_0x51550f)){var _0x5511f4=_[_0xf57b('0x86')](_0x17c1b1[_0xf57b('0x83')][_0xebcbcd][_0x21c3d2[_0x51550f[_0xf57b('0x92')]]]['replace'](/"/g,'\x27'));if(!_[_0xf57b('0x20')](_0x5511f4))_0x12e708=_0x12e708+'§'+_0x5511f4;}if(_0x166105=='')_0x166105=_0x12e708;else _0x166105+='|'+_0x12e708;}_0x36920a[_0xf57b('0x1e')](_0x30d4fc['id']+':'+_0x166105);_0x493cd1[_0x30d4fc['id']]=0x1;}}}}if(hasAdditionalPhones){_0x4ef80b['push']('\x22'+_0x36920a[_0xf57b('0x13')](';')+'\x22');}if(_0x2c950c[_0xf57b('0x1d')]){handleError(_0x17c1b1[_0xf57b('0x83')][_0xebcbcd],{'code':'SystemRow','message':_0x2c950c['join']()});}else{fs[_0xf57b('0x93')](_0x20e970,_0x4ef80b[_0xf57b('0x13')]()+'\x0a');}_0x4ef80b=[];}if(!(stats[_0xf57b('0x84')]%0xc8)){socket[_0xf57b('0x94')](_0xf57b('0x95')+_0x3e2cb0,stats);stats[_0xf57b('0x5f')]=[];}}if(stopped){logger[_0xf57b('0x5a')](_0xf57b('0x96'));_0x1bd3ce[_0xf57b('0x97')]();}}catch(_0x5bcde5){handleError(_0x17c1b1[_0xf57b('0x83')][_0xebcbcd],{'code':_0xf57b('0x98'),'message':_0x5bcde5['message']});logger['error'](_0xf57b('0x99'),_0x5bcde5[_0xf57b('0x5d')]);}},'complete':function(){try{var _0x226ab2=[];var _0x25cba5=[];var _0x2a4a9e=_0xf57b('0x38');if(_0x39a860[_0xf57b('0x9a')]&&_0x39a860[_0xf57b('0x9a')][_0xf57b('0x1d')]){_0x2a4a9e='cm_contacts_'+_0x3e2cb0;_0x226ab2[_0xf57b('0x1e')](_0xf57b('0x9b')+_0x2a4a9e+'\x20LIKE\x20cm_contacts;');}tmp_campaigns=_0xf57b('0x9c')+_0x3e2cb0;tmp_voice_queues='voice_queues_'+_0x3e2cb0;_0x25cba5[_0xf57b('0x1e')]('CREATE\x20TABLE\x20'+tmp_campaigns+_0xf57b('0x9d'));_0x25cba5[_0xf57b('0x1e')](_0xf57b('0x9b')+tmp_voice_queues+_0xf57b('0x9d'));BPromise[_0xf57b('0x9e')](_0x25cba5,handleTZQuery)[_0xf57b('0x1b')](function(_0xcf2e1f){updateTzCampaigns(_0x39a860['ListId'])['then'](function(_0x55b772){updateTzVoiceQueues(_0x39a860['ListId'])['then'](function(_0x5754e6){if(hasTZ)_0x2b3a14=_0x2b3a14['replace']('dialTimezone','dialTimezone,utcOffset');var _0x58549d=util['format'](_0xf57b('0x9f'),_0x20e970,_0x2a4a9e,_0x2b3a14,_0x39a860[_0xf57b('0x32')],_0x39a860[_0xf57b('0x56')]||null,NOW,NOW);if(_['isNil'](_0x21c3d2[_0xf57b('0x49')])){_0x58549d+=_0xf57b('0xa0');}_0x226ab2[_0xf57b('0x1e')](_0x58549d);if(_0x39a860[_0xf57b('0x9a')]&&_0x39a860[_0xf57b('0x9a')]['length']){_0x226ab2[_0xf57b('0x1e')](insertCmContact(_0x39a860[_0xf57b('0x32')],_0x2a4a9e,_0x39a860[_0xf57b('0x9a')],_0x21c3d2));_0x226ab2[_0xf57b('0x1e')]('DROP\x20TABLE\x20'+_0x2a4a9e+';');}BPromise['each'](_0x226ab2,handleQuery)['then'](function(_0x14b20a){BPromise[_0xf57b('0x1c')]([handleAdditionalPhones()])[_0xf57b('0x1b')](function(){_0x226ab2=[];for(var _0x1455de=0x0;_0x1455de\x20\x20');}var _0x46f1d5=path[_0xf57b('0x13')](config['root'],_0xf57b('0xae'),process['argv'][0x2]);if(!fs[_0xf57b('0xaf')](_0x46f1d5)){throw new Error(_0xf57b('0xb0'));}var _0x19b35f={};try{_0x19b35f=JSON[_0xf57b('0x81')](process[_0xf57b('0xad')][0x3]);if(!_0x19b35f[_0xf57b('0x78')]){throw new Error('binding\x20doesn\x27t\x20exists');}if(!_0x19b35f[_0xf57b('0x78')][_0xf57b('0x12')]){throw new Error('phone\x20is\x20mandatory');}if(!_0x19b35f[_0xf57b('0x78')][_0xf57b('0x8f')]){throw new Error(_0xf57b('0xb1'));}var _0x5f5cac=0x0;if(_0x19b35f['binding'][_0xf57b('0x35')]){_0x5f5cac=0x1;}if(!_0x19b35f[_0xf57b('0x32')]){throw new Error('ListId\x20is\x20mandatory');}}catch(_0x1bf325){throw new Error(_0xf57b('0xb2'));}var _0x2297b4=[];try{_0x2297b4=_[_0xf57b('0xb3')](JSON[_0xf57b('0x81')](process[_0xf57b('0xad')][0x4]),'id');}catch(_0x3bc57d){logger['info'](_0xf57b('0xb4'));}main(_0x46f1d5,_0x19b35f,_0x2297b4,_0x5f5cac);}validate();process['on'](_0xf57b('0xb5'),handleStop);process['on'](_0xf57b('0xb6'),handleUncaughtException); \ No newline at end of file diff --git a/server/components/import/cm/csvUpdates.js b/server/components/import/cm/csvUpdates.js index e2334b2..23ee5f4 100644 --- a/server/components/import/cm/csvUpdates.js +++ b/server/components/import/cm/csvUpdates.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x94c9=['cm_contacts.phone','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.priority','cm_contacts.UserId','insert','into','fromQuery','scheduledat','ContactId','ListId','updatedAt','priority','UserId','recallme','fields','cm_contacts.ListId\x20=\x20','.CmListId','where','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_hopper','\x22always\x22','\x22onlyIfOpen\x22','cm_contacts.phone\x20NOT\x20IN\x20(?)','toString','cm_contacts.updatedAt','cm_hopper_black','createdAt','ListId\x20=\x20?','\x20=\x20?','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','OrderBy','cm_contacts','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','concat','CompanyId','MIN(id)','min_id','group','Received\x20SIGINT','exit','errors','code','message','info','sequelize','catch','send','binding','clone','root','.csv','body','ContactItemType','findAll','name','_description','keys','header','writeFileSync','parse','createReadStream','data','rows','find','hasOwnProperty','trim','replace','YYYY-MM-DD\x20HH:mm:ss','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','itemTypeId','description','SystemRow','appendFileSync','emit','contact:import:','abort','SystemError','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','CIS\x20len','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',',\x20scheduledAt\x20=\x20NOW()','each','contact','contactTypeId','orderBy','DROP\x20TABLE\x20','affectedRows','unlink','complete','argv','server/files/tmp','existsSync','file\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','SIGINT','bluebird','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','import','redis','localhost','format','cm_contacts_temp_','YYYYMMDDHHmmss','select','field','phone','from','join','.id\x20=\x20','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','query','select\x20*\x20from\x20','spread','length','isNil','AdditionalPhones','push','all','then','error','split','filter','CmContactHasItem','findOne','update','create','PHONE','inserted','CmContact','CmHopper'];(function(_0x573f88,_0x1e0023){var _0x12acc0=function(_0x485b0f){while(--_0x485b0f){_0x573f88['push'](_0x573f88['shift']());}};_0x12acc0(++_0x1e0023);}(_0x94c9,0x1b5));var _0x994c=function(_0x2d865e,_0x1f0e3e){_0x2d865e=_0x2d865e-0x0;var _0x48f8f5=_0x94c9[_0x2d865e];return _0x48f8f5;};'use strict';var fs=require('fs');var path=require('path');var _=require('lodash');var Papa=require('papaparse');var util=require('util');var BPromise=require(_0x994c('0x0'));var moment=require('moment');var squel=require(_0x994c('0x1'));var Redis=require(_0x994c('0x2'));var db=require(_0x994c('0x3'))['db'];var config=require(_0x994c('0x4'));var logger=require(_0x994c('0x5'))(_0x994c('0x6'));config['redis']=_['defaults'](config[_0x994c('0x7')],{'host':_0x994c('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x994c('0x7')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()[_0x994c('0x9')]('YYYY-MM-DD\x20HH:mm:ss');var tempTableName=_0x994c('0xa')+moment()[_0x994c('0x9')](_0x994c('0xb'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x1f7ff0){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'](_0x1f7ff0);}function selectNotIn(_0x3a57be,_0x26fddf,_0x2980ce,_0x4828b5,_0x484e01){return squel[_0x994c('0xc')]()[_0x994c('0xd')](_0x994c('0xe'))[_0x994c('0xf')](_0x4828b5)[_0x994c('0x10')](_0x26fddf,null,_0x26fddf+_0x994c('0x11')+_0x4828b5+'.'+_0x2980ce)['where'](_0x4828b5+'.'+_0x2980ce+_0x994c('0x12')+_0x3a57be+'.'+_0x2980ce)['where'](_0x26fddf+_0x994c('0x13')+_0x484e01[_0x994c('0x10')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x127091,_0x4c46f0){promisesAdditionalPhones=[];promisesContact=[];return db['sequelize'][_0x994c('0x14')](_0x994c('0x15')+tempTableName)[_0x994c('0x16')](function(_0x44db3e){if(_0x44db3e!==null){var _0xa1e966=[];for(var _0x4a8ec3=0x0;_0x4a8ec3<_0x44db3e[_0x994c('0x17')];_0x4a8ec3++){var _0x22b2b1=_0x44db3e[_0x4a8ec3];if(!_[_0x994c('0x18')](_0x22b2b1[_0x994c('0xe')])){if(!_[_0x994c('0x18')](_0x22b2b1[_0x994c('0x19')]))_0xa1e966['push'](insertAdditionalPhones(_0x22b2b1));promisesContact[_0x994c('0x1a')]({'contact':_0x22b2b1});}}}Promise[_0x994c('0x1b')](_0xa1e966)[_0x994c('0x1c')](function(){_0x127091({'val':0x1});});})['catch'](function(_0x20c1d7){logger[_0x994c('0x1d')](_0x20c1d7['message']);});});}function insertAdditionalPhones(_0x49fa50){return new Promise(function(_0x508886,_0x334a23){var _0xf57211=_0x49fa50[_0x994c('0x19')];if(_['isNil'](_0xf57211))_0x334a23({'val':0x0});else{var _0x4ea555=_0xf57211[_0x994c('0x1e')](';');var _0x2403d2=[];orderBy=0x0;for(var _0x34e5bf=0x0;_0x34e5bf<_0x4ea555['length'];_0x34e5bf++){_0x2403d2[_0x994c('0x1a')](splitAdditionalPhone(_0x49fa50['id'],_0x4ea555[_0x34e5bf]));}Promise[_0x994c('0x1b')](_0x2403d2)['then'](function(){_0x508886({'val':_0x4ea555['length']});});}});}function splitAdditionalPhone(_0x3118fa,_0x128589){return new Promise(function(_0x2bee37,_0x4d341f){var _0x37ca8f=_0x128589['split'](':');var _0xc13f11=_0x37ca8f[0x0];var _0x311f81=_0x37ca8f[0x1];if(_0x311f81!==''){var _0x4fa616=_0x311f81[_0x994c('0x1e')]('|');var _0x11c1a8=[];for(var _0x23613f=0x0;_0x23613f<_0x4fa616[_0x994c('0x17')];_0x23613f++){if(_0x4fa616[_0x23613f]!==''){var _0x8ff02e=_[_0x994c('0x1f')](promisesAdditionalPhones,{'contactId':_0x3118fa,'phone':_0x4fa616[_0x23613f]});if(_0x8ff02e[_0x994c('0x17')]==0x0){orderBy++;promisesAdditionalPhones[_0x994c('0x1a')]({'contactId':_0x3118fa,'contactTypeId':_0xc13f11,'phone':_0x4fa616[_0x23613f],'orderBy':orderBy});}}}_0x2bee37({'ok':0x1});}else _0x2bee37({'res':0x0});});}function createAdditionalPhone(_0x3d52f4,_0x3931e8,_0x10de08,_0x18014b){var _0x58c71b='';var _0x41533b='';var _0x3cffb9=_0x10de08[_0x994c('0x1e')]('§');_0x58c71b=_0x3cffb9[0x0];if(_0x3cffb9[_0x994c('0x17')]==0x2)_0x41533b=_0x3cffb9[0x1];return new Promise(function(_0x2865d2,_0x327b94){return db[_0x994c('0x20')][_0x994c('0x21')]({'where':{'CmContactId':_0x3d52f4,'item':_0x58c71b}})[_0x994c('0x1c')](function(_0xdfab08){if(_0xdfab08){return db[_0x994c('0x20')][_0x994c('0x22')]({'ItemTypeId':_0x3931e8,'description':_0x41533b,'OrderBy':_0x18014b},{'where':{'CmContactId':_0x3d52f4,'item':_0x58c71b}})[_0x994c('0x1c')](function(_0x4a3e9a){_0x2865d2({'res':'updated'});});}else{return db[_0x994c('0x20')][_0x994c('0x23')]({'CmContactId':_0x3d52f4,'item':_0x58c71b,'ItemTypeId':_0x3931e8,'description':_0x41533b,'OrderBy':_0x18014b,'ItemClass':_0x994c('0x24')})[_0x994c('0x1c')](function(_0x5c76e5){_0x2865d2({'res':_0x994c('0x25')});});}});});}function updateContact(_0x32c502){return new Promise(function(_0x1be4c8,_0x2d314e){var _0x1230da=_0x32c502['id'];delete _0x32c502['id'];return db[_0x994c('0x26')]['update'](_0x32c502,{'where':{'id':_0x1230da}})[_0x994c('0x1c')](function(_0x392847){updatedRows+=0x1;return db[_0x994c('0x27')][_0x994c('0x22')]({'phone':_0x32c502[_0x994c('0xe')]},{'where':{'ContactId':_0x1230da}})[_0x994c('0x1c')](function(_0x508152){_0x1be4c8({'ret':'OK'});});});});}function insertCmHopper(_0x147ccc,_0x2e621b,_0x3c7229,_0x2b9b08,_0x5385fb){var _0x621b70=[_0x994c('0x28'),'cm_contacts.scheduledat',_0x994c('0x29'),_0x994c('0x2a'),_0x2e621b+'.'+_0x2b9b08,_0x994c('0x2b'),'cm_contacts.updatedAt',_0x994c('0x2c'),_0x994c('0x2d'),'\x22'+_0x5385fb+'\x22'];return squel[_0x994c('0x2e')]()[_0x994c('0x2f')]('cm_hopper')[_0x994c('0x30')]([_0x994c('0xe'),_0x994c('0x31'),_0x994c('0x32'),_0x994c('0x33'),_0x2b9b08,'createdAt',_0x994c('0x34'),_0x994c('0x35'),_0x994c('0x36'),_0x994c('0x37')],squel[_0x994c('0xc')]()[_0x994c('0x38')](_0x621b70)[_0x994c('0xf')](_0x2e621b)['join']('cm_contacts',null,_0x994c('0x39')+_0x2e621b+_0x994c('0x3a'))[_0x994c('0x10')](_0x3c7229,null,_0x3c7229+_0x994c('0x11')+_0x2e621b+'.'+_0x2b9b08)[_0x994c('0x3b')](_0x2e621b+_0x994c('0x3c'),_0x147ccc)[_0x994c('0x3b')](_0x994c('0x3d'),NOW)[_0x994c('0x3b')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x2e621b,_0x3c7229,_0x2b9b08,_0x994c('0x3e'),[_0x994c('0x3f'),_0x994c('0x40')]))['where'](_0x994c('0x41'),selectNotIn(_0x2e621b,_0x3c7229,_0x2b9b08,'cm_hopper',[_0x994c('0x3f')])))[_0x994c('0x42')]();}function insertCmHopperBlack(_0x14f35d,_0x440e8b,_0x2e3a2d,_0x347b2d){var _0xe6407a=[_0x994c('0x28'),'cm_contacts.id',_0x994c('0x2a'),_0x440e8b+'.'+_0x347b2d,_0x994c('0x2b'),_0x994c('0x43')];return squel['insert']()[_0x994c('0x2f')](_0x994c('0x44'))['fromQuery']([_0x994c('0xe'),'ContactId',_0x994c('0x33'),_0x347b2d,_0x994c('0x45'),'updatedAt'],squel[_0x994c('0xc')]()[_0x994c('0x38')](_0xe6407a)[_0x994c('0xf')](_0x440e8b)[_0x994c('0x10')]('cm_contacts',null,_0x994c('0x39')+_0x440e8b+_0x994c('0x3a'))[_0x994c('0x10')](_0x2e3a2d,null,_0x2e3a2d+_0x994c('0x11')+_0x440e8b+'.'+_0x347b2d)[_0x994c('0x3b')](_0x440e8b+_0x994c('0x3c'),_0x14f35d)[_0x994c('0x3b')]('cm_contacts.createdAt\x20=\x20?',NOW)[_0x994c('0x3b')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0x994c('0xc')]()[_0x994c('0xd')](_0x994c('0xe'))[_0x994c('0xf')]('cm_hopper_black')[_0x994c('0x3b')](_0x994c('0x46'),_0x14f35d)[_0x994c('0x3b')](_0x347b2d+_0x994c('0x47'),_0x440e8b+'.'+_0x347b2d)))['toString']();}function insertCmHopperAdditionalPhones(_0x33bc10){var _0x224ba1=[_0x994c('0x48'),_0x994c('0x49'),_0x994c('0x4a'),_0x994c('0x4b'),_0x994c('0x4c')];return squel[_0x994c('0x2e')]()['into'](_0x994c('0x4d'))[_0x994c('0x30')](['CmHopperId',_0x994c('0xe'),_0x994c('0x4e'),_0x994c('0x45'),_0x994c('0x34')],squel[_0x994c('0xc')]()[_0x994c('0x38')](_0x224ba1)[_0x994c('0xf')]('cm_hopper')[_0x994c('0x10')](_0x994c('0x4f'),null,_0x994c('0x50'))['join'](_0x994c('0x51'),null,_0x994c('0x52'))[_0x994c('0x3b')](_0x994c('0x53'),_0x33bc10)[_0x994c('0x3b')]('cm_contacts.createdAt\x20=\x20?',NOW))[_0x994c('0x42')]();}function insertCmContact(_0x5766b2,_0x15fb3b,_0x17ba6f,_0x33265f){var _0x4d672f=_[_0x994c('0x54')](_['keys'](_0x33265f),[_0x994c('0x33'),_0x994c('0x55'),_0x994c('0x45'),_0x994c('0x34')]);return squel[_0x994c('0x2e')]()[_0x994c('0x2f')](_0x994c('0x4f'))['fromQuery'](_0x4d672f,squel[_0x994c('0xc')]()[_0x994c('0x38')](_0x4d672f)['from'](_0x15fb3b)[_0x994c('0x3b')]('('+_0x17ba6f[_0x994c('0x10')](',')+')\x20NOT\x20IN\x20?',squel[_0x994c('0xc')]()[_0x994c('0x38')](_0x17ba6f)['from'](_0x994c('0x4f'))[_0x994c('0x3b')](_0x994c('0x46'),_0x5766b2))[_0x994c('0x3b')]('id\x20IN\x20?',squel['select']()[_0x994c('0xd')](_0x994c('0x56'),_0x994c('0x57'))[_0x994c('0xf')](_0x15fb3b)[_0x994c('0x58')](_0x17ba6f[_0x994c('0x10')](','))))['toString']();}function handleStop(){logger['info'](_0x994c('0x59'));stopped=!![];}function handleUncaughtException(_0x4c12bb){logger['error'](_0x4c12bb['message']);process[_0x994c('0x5a')](0x1);}function handleError(_0x5b12a3,_0x452609){stats[_0x994c('0x5b')][_0x994c('0x1a')]({'name':_0x452609[_0x994c('0x5c')],'message':_0x452609[_0x994c('0x5d')],'row':_0x5b12a3});}function handleQuery(_0x4e9a0b){logger[_0x994c('0x5e')](_0x4e9a0b);return db[_0x994c('0x5f')][_0x994c('0x14')](_0x4e9a0b)[_0x994c('0x16')](function(_0x419c9d){results[_0x994c('0x1a')](_0x419c9d);})[_0x994c('0x60')](function(_0x252df1){logger[_0x994c('0x1d')](_0x252df1[_0x994c('0x5d')]);});}function main(_0x4753c7,_0x84bd69,_0x264cd6,_0x204ced){logger[_0x994c('0x5e')]('main',_0x4753c7,JSON['stringify'](_0x84bd69));process[_0x994c('0x61')]('start');var _0x48988a=_0x84bd69[_0x994c('0x62')];var _0x596b9b=_[_0x994c('0x63')](_0x48988a);var _0x2c9d69=_0x84bd69['socket_timestamp'];var _0x22d1e1=path[_0x994c('0x10')](config[_0x994c('0x64')],'server/files/tmp',_0x2c9d69+_0x994c('0x65'));logger[_0x994c('0x5e')](_0x994c('0x66'),_0x84bd69);db[_0x994c('0x67')][_0x994c('0x68')]({'raw':!![],'attributes':['id',_0x994c('0x69')]})[_0x994c('0x1c')](function(_0x5569e5){for(var _0x57dd4a=0x0;_0x57dd4a<_0x5569e5['length'];_0x57dd4a++){if(_0x5569e5[_0x57dd4a][_0x994c('0x69')]in _0x48988a){contactItemTypes[_0x994c('0x1a')](_0x5569e5[_0x57dd4a]);delete _0x596b9b[_0x5569e5[_0x57dd4a][_0x994c('0x69')]];hasAdditionalPhones=!![];}for(var _0x4a8f79 in _0x48988a){if(_0x5569e5[_0x57dd4a][_0x994c('0x69')]+_0x994c('0x6a')===_0x4a8f79){phoneDescriptions['push']({'itemTypeId':_0x5569e5[_0x57dd4a]['id'],'description':_0x4a8f79});delete _0x596b9b[_0x4a8f79];}}}if(hasAdditionalPhones)_0x596b9b['AdditionalPhones']='';var _0x131e0f=_[_0x994c('0x6b')](_0x596b9b)[_0x994c('0x10')]();logger[_0x994c('0x5e')](_0x994c('0x6c'),_0x131e0f);fs[_0x994c('0x6d')](_0x22d1e1,_0x131e0f+'\x0a');Papa[_0x994c('0x6e')](fs[_0x994c('0x6f')](_0x4753c7),{'header':!![],'skipEmptyLines':!![],'step':function(_0x31e6d5,_0x54c6f3){try{for(var _0x3c33a8=0x0,_0x45274a=[];_0x3c33a8<_0x31e6d5[_0x994c('0x70')][_0x994c('0x17')];_0x3c33a8++){stats[_0x994c('0x71')]+=0x1;if(_0x31e6d5[_0x994c('0x5b')][_0x3c33a8]){handleError(_0x31e6d5[_0x994c('0x70')][_0x3c33a8],_0x31e6d5[_0x994c('0x5b')][_0x3c33a8]);}else{var _0x379218=[];var _0x13789e=[];var _0x3c6207={};for(var _0x225762 in _0x48988a){let _0x32657c=contactItemTypes[_0x994c('0x72')](_0xe7e40c=>_0xe7e40c[_0x994c('0x69')]===_0x225762);let _0x1c4b8e=contactItemTypes[_0x994c('0x72')](_0x3eea61=>_0x3eea61[_0x994c('0x69')]+_0x994c('0x6a')===_0x225762);if(_[_0x994c('0x18')](_0x32657c)&&_[_0x994c('0x18')](_0x1c4b8e)){if(_0x48988a[_0x994c('0x73')](_0x225762)){if(_0x31e6d5[_0x994c('0x70')][_0x3c33a8][_0x48988a[_0x225762]]){var _0x23e30f=_[_0x994c('0x74')](_0x31e6d5[_0x994c('0x70')][_0x3c33a8][_0x48988a[_0x225762]][_0x994c('0x75')](/"/g,'\x27'));switch(_0x225762){case _0x994c('0x31'):var _0x200c75=moment(_0x23e30f,_0x994c('0x76'),!![]);if(_0x200c75[_0x994c('0x77')]()){_0x45274a['push']('\x22'+_0x23e30f+'\x22');}else{_0x379218[_0x994c('0x1a')](_0x994c('0x78'));}break;case _0x994c('0x35'):var _0x1b8abe=parseInt(_0x23e30f);_0x23e30f=_[_0x994c('0x79')](_0x1b8abe)||_0x1b8abe<0x0||_0x1b8abe>0x4?_0x204ced?0x3:0x2:_0x1b8abe;_0x45274a[_0x994c('0x1a')]('\x22'+_0x23e30f+'\x22');break;case _0x994c('0x36'):var _0x776873=parseInt(_0x23e30f);if(_[_0x994c('0x7a')](_0x776873)&&_['includes'](_0x264cd6,_0x776873)){_0x45274a[_0x994c('0x1a')]('\x22'+_0x776873+'\x22');}else{_0x379218[_0x994c('0x1a')]('agent\x20not\x20exists');}break;case _0x994c('0x7b'):if(isEmail(_0x23e30f)){_0x45274a[_0x994c('0x1a')]('\x22'+_0x23e30f+'\x22');}else{_0x379218[_0x994c('0x1a')](_0x994c('0x7c'));}break;case _0x994c('0x7d'):var _0x14d4cb=moment(_0x23e30f,_0x994c('0x7e'),!![]);if(_0x14d4cb[_0x994c('0x77')]()){_0x45274a['push']('\x22'+_0x23e30f+'\x22');}else{_0x379218['push'](_0x994c('0x7f'));}break;default:_0x45274a[_0x994c('0x1a')]('\x22'+_0x23e30f+'\x22');}}else{switch(_0x225762){case _0x994c('0x80'):case _0x994c('0xe'):_0x379218[_0x994c('0x1a')](_0x225762+_0x994c('0x81'));break;default:_0x45274a[_0x994c('0x1a')]('\x22\x22');}}}}else{var _0x6fcd52='';if(!_[_0x994c('0x18')](_0x32657c)){if(!_0x3c6207[_0x994c('0x73')](_0x32657c['id'])){for(var _0x5c7555=0x0;_0x5c7555<_0x48988a[_0x225762][_0x994c('0x17')];_0x5c7555++){var _0x23e30f=_[_0x994c('0x74')](_0x31e6d5[_0x994c('0x70')][_0x3c33a8][_0x48988a[_0x225762][_0x5c7555]]['replace'](/"/g,'\x27'));var _0x79e895=phoneDescriptions['find'](_0x2825ae=>_0x2825ae[_0x994c('0x82')]===_0x32657c['id']);if(!_[_0x994c('0x18')](_0x79e895)){var _0x1bb164=_[_0x994c('0x74')](_0x31e6d5['data'][_0x3c33a8][_0x48988a[_0x79e895[_0x994c('0x83')]][0x0]]['replace'](/"/g,'\x27'));if(!_[_0x994c('0x18')](_0x1bb164))_0x23e30f=_0x23e30f+'§'+_0x1bb164;}if(_0x6fcd52=='')_0x6fcd52=_0x23e30f;else _0x6fcd52+='|'+_0x23e30f;}_0x13789e[_0x994c('0x1a')](_0x32657c['id']+':'+_0x6fcd52);_0x3c6207[_0x32657c['id']]=0x1;}}}}if(hasAdditionalPhones){_0x45274a[_0x994c('0x1a')]('\x22'+_0x13789e[_0x994c('0x10')](';')+'\x22');}if(_0x379218[_0x994c('0x17')]){handleError(_0x31e6d5[_0x994c('0x70')][_0x3c33a8],{'code':_0x994c('0x84'),'message':_0x379218[_0x994c('0x10')]()});}else{fs[_0x994c('0x85')](_0x22d1e1,_0x45274a['join']()+'\x0a');}_0x45274a=[];}if(!(stats['rows']%0xc8)){socket[_0x994c('0x86')](_0x994c('0x87')+_0x2c9d69,stats);stats[_0x994c('0x5b')]=[];}}if(stopped){logger[_0x994c('0x5e')]('Abort\x20parser');_0x54c6f3[_0x994c('0x88')]();}}catch(_0x3f6494){handleError(_0x31e6d5['data'][_0x3c33a8],{'code':_0x994c('0x89'),'message':_0x3f6494[_0x994c('0x5d')]});logger['error']('step',_0x3f6494[_0x994c('0x5d')]);}},'complete':function(){try{var _0x280bd8=[];var _0x2827db=tempTableName;_0x280bd8[_0x994c('0x1a')](_0x994c('0x8a')+_0x2827db+_0x994c('0x8b'));logger['info'](_0x994c('0x8c'),contactItemTypes[_0x994c('0x17')]);var _0xf533eb=util['format'](_0x994c('0x8d'),_0x22d1e1,_0x2827db,_0x131e0f,_0x84bd69['ListId'],_0x84bd69[_0x994c('0x55')]||null,NOW,NOW);if(_[_0x994c('0x18')](_0x48988a['scheduledat'])){_0xf533eb+=_0x994c('0x8e');}_0x280bd8['push'](_0xf533eb);BPromise[_0x994c('0x8f')](_0x280bd8,handleQuery)['then'](function(_0x580dd8){BPromise[_0x994c('0x1b')]([handleAdditionalPhones()])[_0x994c('0x1c')](function(){_0x280bd8=[];for(var _0x205893=0x0;_0x205893\x20\x20');}var _0x4e06ea=path[_0x994c('0x10')](config[_0x994c('0x64')],_0x994c('0x98'),process['argv'][0x2]);if(!fs[_0x994c('0x99')](_0x4e06ea)){throw new Error(_0x994c('0x9a'));}var _0x1a23cf={};try{_0x1a23cf=JSON[_0x994c('0x6e')](process['argv'][0x3]);if(!_0x1a23cf['binding']){throw new Error('binding\x20doesn\x27t\x20exists');}var _0x1ee1e5=0x0;if(_0x1a23cf['binding'][_0x994c('0x36')]){_0x1ee1e5=0x1;}if(!_0x1a23cf['ListId']){throw new Error(_0x994c('0x9b'));}}catch(_0x3f404f){throw new Error(_0x994c('0x9c'));}var _0x32fa0b=[];try{_0x32fa0b=_[_0x994c('0x9d')](JSON['parse'](process[_0x994c('0x97')][0x4]),'id');}catch(_0x43fe40){logger[_0x994c('0x5e')]('No\x20agent\x20available');}main(_0x4e06ea,_0x1a23cf,_0x32fa0b,_0x1ee1e5);}validate();process['on'](_0x994c('0x9e'),handleStop);process['on']('uncaughtException',handleUncaughtException); \ No newline at end of file +var _0xc210=['inserted','CmContact','CmHopper','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','scheduledat','ContactId','ListId','createdAt','priority','UserId','recallme','select','fields','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22onlyIfOpen\x22','\x22always\x22','toString','cm_contacts.updatedAt','cm_hopper_black','updatedAt','cm_contacts','field','ListId\x20=\x20?','\x20=\x20?','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','CmHopperId','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','keys','CompanyId','id\x20IN\x20?','MIN(id)','group','info','Received\x20SIGINT','errors','code','sequelize','message','main','stringify','send','binding','socket_timestamp','root','server/files/tmp','.csv','body','findAll','name','_description','AdditionalPhones','writeFileSync','parse','createReadStream','find','hasOwnProperty','trim','data','replace','YYYY-MM-DD\x20HH:mm:ss','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','includes','agent\x20not\x20exists','email','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','description','SystemRow','appendFileSync','rows','emit','contact:import:','Abort\x20parser','step','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','CIS\x20len',',\x20scheduledAt\x20=\x20NOW()','each','contact','contactId','contactTypeId','orderBy','DROP\x20TABLE\x20','finish','affectedRows','unlink','catch','exit','complete','argv','arguments\x20\x20\x20','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','uncaughtException','path','lodash','util','bluebird','moment','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','import','redis','defaults','localhost','cm_contacts_temp_','format','YYYYMMDDHHmmss','test','phone','from','join','.id\x20=\x20','\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','query','select\x20*\x20from\x20','spread','isNil','push','then','error','split','all','length','CmContactHasItem','update','updated','PHONE'];(function(_0x55c0ab,_0x17b334){var _0xaa8efd=function(_0x3b332e){while(--_0x3b332e){_0x55c0ab['push'](_0x55c0ab['shift']());}};_0xaa8efd(++_0x17b334);}(_0xc210,0x7c));var _0x0c21=function(_0x46728b,_0x376bc6){_0x46728b=_0x46728b-0x0;var _0x5aa8e2=_0xc210[_0x46728b];return _0x5aa8e2;};'use strict';var fs=require('fs');var path=require(_0x0c21('0x0'));var _=require(_0x0c21('0x1'));var Papa=require('papaparse');var util=require(_0x0c21('0x2'));var BPromise=require(_0x0c21('0x3'));var moment=require(_0x0c21('0x4'));var squel=require(_0x0c21('0x5'));var Redis=require(_0x0c21('0x6'));var db=require(_0x0c21('0x7'))['db'];var config=require(_0x0c21('0x8'));var logger=require(_0x0c21('0x9'))(_0x0c21('0xa'));config[_0x0c21('0xb')]=_[_0x0c21('0xc')](config[_0x0c21('0xb')],{'host':_0x0c21('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0c21('0xb')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');var tempTableName=_0x0c21('0xe')+moment()[_0x0c21('0xf')](_0x0c21('0x10'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x10d648){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))*$/[_0x0c21('0x11')](_0x10d648);}function selectNotIn(_0x122c13,_0xbadf75,_0x5f5863,_0x15a6c0,_0x10cbb7){return squel['select']()['field'](_0x0c21('0x12'))[_0x0c21('0x13')](_0x15a6c0)[_0x0c21('0x14')](_0xbadf75,null,_0xbadf75+_0x0c21('0x15')+_0x15a6c0+'.'+_0x5f5863)['where'](_0x15a6c0+'.'+_0x5f5863+_0x0c21('0x16')+_0x122c13+'.'+_0x5f5863)[_0x0c21('0x17')](_0xbadf75+_0x0c21('0x18')+_0x10cbb7[_0x0c21('0x14')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x1e6991,_0x522612){promisesAdditionalPhones=[];promisesContact=[];return db['sequelize'][_0x0c21('0x19')](_0x0c21('0x1a')+tempTableName)[_0x0c21('0x1b')](function(_0x50f86f){if(_0x50f86f!==null){var _0xd3fa93=[];for(var _0x2ea818=0x0;_0x2ea818<_0x50f86f['length'];_0x2ea818++){var _0x409bde=_0x50f86f[_0x2ea818];if(!_[_0x0c21('0x1c')](_0x409bde[_0x0c21('0x12')])){if(!_['isNil'](_0x409bde['AdditionalPhones']))_0xd3fa93[_0x0c21('0x1d')](insertAdditionalPhones(_0x409bde));promisesContact[_0x0c21('0x1d')]({'contact':_0x409bde});}}}Promise['all'](_0xd3fa93)[_0x0c21('0x1e')](function(){_0x1e6991({'val':0x1});});})['catch'](function(_0x3b902a){logger[_0x0c21('0x1f')](_0x3b902a['message']);});});}function insertAdditionalPhones(_0x27a80b){return new Promise(function(_0x46b8fd,_0x4ffa33){var _0x199622=_0x27a80b['AdditionalPhones'];if(_[_0x0c21('0x1c')](_0x199622))_0x4ffa33({'val':0x0});else{var _0x36e1d0=_0x199622[_0x0c21('0x20')](';');var _0x2459e1=[];orderBy=0x0;for(var _0x3b71e3=0x0;_0x3b71e3<_0x36e1d0['length'];_0x3b71e3++){_0x2459e1['push'](splitAdditionalPhone(_0x27a80b['id'],_0x36e1d0[_0x3b71e3]));}Promise[_0x0c21('0x21')](_0x2459e1)[_0x0c21('0x1e')](function(){_0x46b8fd({'val':_0x36e1d0[_0x0c21('0x22')]});});}});}function splitAdditionalPhone(_0x2ef9f0,_0x136cd5){return new Promise(function(_0x3f9e91,_0x4279e0){var _0x33f131=_0x136cd5['split'](':');var _0x147b6c=_0x33f131[0x0];var _0x1950a2=_0x33f131[0x1];if(_0x1950a2!==''){var _0x56114f=_0x1950a2[_0x0c21('0x20')]('|');var _0x42984d=[];for(var _0x3b9f37=0x0;_0x3b9f37<_0x56114f[_0x0c21('0x22')];_0x3b9f37++){if(_0x56114f[_0x3b9f37]!==''){var _0xfd0479=_['filter'](promisesAdditionalPhones,{'contactId':_0x2ef9f0,'phone':_0x56114f[_0x3b9f37]});if(_0xfd0479[_0x0c21('0x22')]==0x0){orderBy++;promisesAdditionalPhones['push']({'contactId':_0x2ef9f0,'contactTypeId':_0x147b6c,'phone':_0x56114f[_0x3b9f37],'orderBy':orderBy});}}}_0x3f9e91({'ok':0x1});}else _0x3f9e91({'res':0x0});});}function createAdditionalPhone(_0x2b8b14,_0x40ddf8,_0x48b6f1,_0x1586bb){var _0x2ab69a='';var _0x4444a6='';var _0x2a8b6e=_0x48b6f1['split']('§');_0x2ab69a=_0x2a8b6e[0x0];if(_0x2a8b6e['length']==0x2)_0x4444a6=_0x2a8b6e[0x1];return new Promise(function(_0x42400d,_0x2e0a39){return db[_0x0c21('0x23')]['findOne']({'where':{'CmContactId':_0x2b8b14,'item':_0x2ab69a}})[_0x0c21('0x1e')](function(_0x2b5ad8){if(_0x2b5ad8){return db[_0x0c21('0x23')][_0x0c21('0x24')]({'ItemTypeId':_0x40ddf8,'description':_0x4444a6,'OrderBy':_0x1586bb},{'where':{'CmContactId':_0x2b8b14,'item':_0x2ab69a}})[_0x0c21('0x1e')](function(_0x5f4aef){_0x42400d({'res':_0x0c21('0x25')});});}else{return db[_0x0c21('0x23')]['create']({'CmContactId':_0x2b8b14,'item':_0x2ab69a,'ItemTypeId':_0x40ddf8,'description':_0x4444a6,'OrderBy':_0x1586bb,'ItemClass':_0x0c21('0x26')})['then'](function(_0x3cc59b){_0x42400d({'res':_0x0c21('0x27')});});}});});}function updateContact(_0x50d395){return new Promise(function(_0x4d2253,_0x32b54a){var _0x5aab8c=_0x50d395['id'];delete _0x50d395['id'];return db[_0x0c21('0x28')][_0x0c21('0x24')](_0x50d395,{'where':{'id':_0x5aab8c}})['then'](function(_0x1b74fa){updatedRows+=0x1;return db[_0x0c21('0x29')][_0x0c21('0x24')]({'phone':_0x50d395[_0x0c21('0x12')]},{'where':{'ContactId':_0x5aab8c}})[_0x0c21('0x1e')](function(_0x492a34){_0x4d2253({'ret':'OK'});});});});}function insertCmHopper(_0x20237e,_0x36a7ee,_0x524d70,_0x1d001b,_0x20f299){var _0x1b7134=[_0x0c21('0x2a'),_0x0c21('0x2b'),_0x0c21('0x2c'),_0x0c21('0x2d'),_0x36a7ee+'.'+_0x1d001b,_0x0c21('0x2e'),'cm_contacts.updatedAt',_0x0c21('0x2f'),_0x0c21('0x30'),'\x22'+_0x20f299+'\x22'];return squel[_0x0c21('0x31')]()[_0x0c21('0x32')](_0x0c21('0x33'))[_0x0c21('0x34')](['phone',_0x0c21('0x35'),_0x0c21('0x36'),_0x0c21('0x37'),_0x1d001b,_0x0c21('0x38'),'updatedAt',_0x0c21('0x39'),_0x0c21('0x3a'),_0x0c21('0x3b')],squel[_0x0c21('0x3c')]()[_0x0c21('0x3d')](_0x1b7134)['from'](_0x36a7ee)[_0x0c21('0x14')]('cm_contacts',null,_0x0c21('0x3e')+_0x36a7ee+_0x0c21('0x3f'))[_0x0c21('0x14')](_0x524d70,null,_0x524d70+_0x0c21('0x15')+_0x36a7ee+'.'+_0x1d001b)[_0x0c21('0x17')](_0x36a7ee+_0x0c21('0x40'),_0x20237e)[_0x0c21('0x17')](_0x0c21('0x41'),NOW)['where'](_0x0c21('0x42'),selectNotIn(_0x36a7ee,_0x524d70,_0x1d001b,_0x0c21('0x33'),['\x22always\x22',_0x0c21('0x43')]))[_0x0c21('0x17')](_0x0c21('0x42'),selectNotIn(_0x36a7ee,_0x524d70,_0x1d001b,'cm_hopper',[_0x0c21('0x44')])))[_0x0c21('0x45')]();}function insertCmHopperBlack(_0x14284c,_0x59cff8,_0xc9f5f2,_0x5989e8){var _0x39ed5f=['cm_contacts.phone',_0x0c21('0x2c'),'cm_contacts.ListId',_0x59cff8+'.'+_0x5989e8,'cm_contacts.createdAt',_0x0c21('0x46')];return squel[_0x0c21('0x31')]()[_0x0c21('0x32')](_0x0c21('0x47'))[_0x0c21('0x34')]([_0x0c21('0x12'),'ContactId',_0x0c21('0x37'),_0x5989e8,'createdAt',_0x0c21('0x48')],squel[_0x0c21('0x3c')]()[_0x0c21('0x3d')](_0x39ed5f)[_0x0c21('0x13')](_0x59cff8)[_0x0c21('0x14')](_0x0c21('0x49'),null,'cm_contacts.ListId\x20=\x20'+_0x59cff8+'.CmListId')[_0x0c21('0x14')](_0xc9f5f2,null,_0xc9f5f2+_0x0c21('0x15')+_0x59cff8+'.'+_0x5989e8)[_0x0c21('0x17')](_0x59cff8+_0x0c21('0x40'),_0x14284c)['where'](_0x0c21('0x41'),NOW)[_0x0c21('0x17')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel[_0x0c21('0x3c')]()[_0x0c21('0x4a')]('phone')[_0x0c21('0x13')]('cm_hopper_black')[_0x0c21('0x17')](_0x0c21('0x4b'),_0x14284c)[_0x0c21('0x17')](_0x5989e8+_0x0c21('0x4c'),_0x59cff8+'.'+_0x5989e8)))[_0x0c21('0x45')]();}function insertCmHopperAdditionalPhones(_0x1956d9){var _0x2d441d=[_0x0c21('0x4d'),_0x0c21('0x4e'),'cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt',_0x0c21('0x4f')];return squel['insert']()[_0x0c21('0x32')](_0x0c21('0x50'))[_0x0c21('0x34')]([_0x0c21('0x51'),_0x0c21('0x12'),_0x0c21('0x52'),_0x0c21('0x38'),'updatedAt'],squel[_0x0c21('0x3c')]()[_0x0c21('0x3d')](_0x2d441d)[_0x0c21('0x13')](_0x0c21('0x33'))[_0x0c21('0x14')](_0x0c21('0x49'),null,_0x0c21('0x53'))['join'](_0x0c21('0x54'),null,_0x0c21('0x55'))[_0x0c21('0x17')](_0x0c21('0x56'),_0x1956d9)['where']('cm_contacts.createdAt\x20=\x20?',NOW))[_0x0c21('0x45')]();}function insertCmContact(_0x3d02ef,_0x544725,_0x1f3bd3,_0x5b90ee){var _0x47b12d=_['concat'](_[_0x0c21('0x57')](_0x5b90ee),[_0x0c21('0x37'),_0x0c21('0x58'),_0x0c21('0x38'),'updatedAt']);return squel[_0x0c21('0x31')]()[_0x0c21('0x32')](_0x0c21('0x49'))[_0x0c21('0x34')](_0x47b12d,squel['select']()[_0x0c21('0x3d')](_0x47b12d)[_0x0c21('0x13')](_0x544725)[_0x0c21('0x17')]('('+_0x1f3bd3['join'](',')+')\x20NOT\x20IN\x20?',squel[_0x0c21('0x3c')]()[_0x0c21('0x3d')](_0x1f3bd3)[_0x0c21('0x13')](_0x0c21('0x49'))[_0x0c21('0x17')]('ListId\x20=\x20?',_0x3d02ef))[_0x0c21('0x17')](_0x0c21('0x59'),squel[_0x0c21('0x3c')]()['field'](_0x0c21('0x5a'),'min_id')[_0x0c21('0x13')](_0x544725)[_0x0c21('0x5b')](_0x1f3bd3['join'](','))))[_0x0c21('0x45')]();}function handleStop(){logger[_0x0c21('0x5c')](_0x0c21('0x5d'));stopped=!![];}function handleUncaughtException(_0x1a6667){logger[_0x0c21('0x1f')](_0x1a6667['message']);process['exit'](0x1);}function handleError(_0x552d63,_0x4a211d){stats[_0x0c21('0x5e')][_0x0c21('0x1d')]({'name':_0x4a211d[_0x0c21('0x5f')],'message':_0x4a211d['message'],'row':_0x552d63});}function handleQuery(_0x4a5980){logger[_0x0c21('0x5c')](_0x4a5980);return db[_0x0c21('0x60')][_0x0c21('0x19')](_0x4a5980)[_0x0c21('0x1b')](function(_0x5e1836){results[_0x0c21('0x1d')](_0x5e1836);})['catch'](function(_0x1d2dd5){logger[_0x0c21('0x1f')](_0x1d2dd5[_0x0c21('0x61')]);});}function main(_0x3f0364,_0x498cf2,_0xc6761c,_0x3a2a7d){logger['info'](_0x0c21('0x62'),_0x3f0364,JSON[_0x0c21('0x63')](_0x498cf2));process[_0x0c21('0x64')]('start');var _0x4ccb1d=_0x498cf2[_0x0c21('0x65')];var _0x5ed677=_['clone'](_0x4ccb1d);var _0x50f853=_0x498cf2[_0x0c21('0x66')];var _0xae9e4f=path[_0x0c21('0x14')](config[_0x0c21('0x67')],_0x0c21('0x68'),_0x50f853+_0x0c21('0x69'));logger[_0x0c21('0x5c')](_0x0c21('0x6a'),_0x498cf2);db['ContactItemType'][_0x0c21('0x6b')]({'raw':!![],'attributes':['id',_0x0c21('0x6c')]})['then'](function(_0x569240){for(var _0xba2ce8=0x0;_0xba2ce8<_0x569240[_0x0c21('0x22')];_0xba2ce8++){if(_0x569240[_0xba2ce8][_0x0c21('0x6c')]in _0x4ccb1d){contactItemTypes[_0x0c21('0x1d')](_0x569240[_0xba2ce8]);delete _0x5ed677[_0x569240[_0xba2ce8]['name']];hasAdditionalPhones=!![];}for(var _0xceb615 in _0x4ccb1d){if(_0x569240[_0xba2ce8]['name']+_0x0c21('0x6d')===_0xceb615){phoneDescriptions['push']({'itemTypeId':_0x569240[_0xba2ce8]['id'],'description':_0xceb615});delete _0x5ed677[_0xceb615];}}}if(hasAdditionalPhones)_0x5ed677[_0x0c21('0x6e')]='';var _0x6459ae=_[_0x0c21('0x57')](_0x5ed677)['join']();logger['info']('header',_0x6459ae);fs[_0x0c21('0x6f')](_0xae9e4f,_0x6459ae+'\x0a');Papa[_0x0c21('0x70')](fs[_0x0c21('0x71')](_0x3f0364),{'header':!![],'skipEmptyLines':!![],'step':function(_0x544eff,_0x9c9363){try{for(var _0x4fddc7=0x0,_0x398427=[];_0x4fddc7<_0x544eff['data'][_0x0c21('0x22')];_0x4fddc7++){stats['rows']+=0x1;if(_0x544eff[_0x0c21('0x5e')][_0x4fddc7]){handleError(_0x544eff['data'][_0x4fddc7],_0x544eff['errors'][_0x4fddc7]);}else{var _0x42a243=[];var _0x4e6d51=[];var _0x33ce2f={};for(var _0x4163ac in _0x4ccb1d){let _0x2c3395=contactItemTypes[_0x0c21('0x72')](_0x8a0882=>_0x8a0882[_0x0c21('0x6c')]===_0x4163ac);let _0x454f69=contactItemTypes[_0x0c21('0x72')](_0xc706ae=>_0xc706ae[_0x0c21('0x6c')]+_0x0c21('0x6d')===_0x4163ac);if(_[_0x0c21('0x1c')](_0x2c3395)&&_[_0x0c21('0x1c')](_0x454f69)){if(_0x4ccb1d[_0x0c21('0x73')](_0x4163ac)){if(_0x544eff['data'][_0x4fddc7][_0x4ccb1d[_0x4163ac]]){var _0x194cc1=_[_0x0c21('0x74')](_0x544eff[_0x0c21('0x75')][_0x4fddc7][_0x4ccb1d[_0x4163ac]][_0x0c21('0x76')](/"/g,'\x27'));switch(_0x4163ac){case'scheduledat':var _0x57da8e=moment(_0x194cc1,_0x0c21('0x77'),!![]);if(_0x57da8e[_0x0c21('0x78')]()){_0x398427[_0x0c21('0x1d')]('\x22'+_0x194cc1+'\x22');}else{_0x42a243['push'](_0x0c21('0x79'));}break;case _0x0c21('0x39'):var _0x2d4517=parseInt(_0x194cc1);_0x194cc1=_[_0x0c21('0x7a')](_0x2d4517)||_0x2d4517<0x0||_0x2d4517>0x4?_0x3a2a7d?0x3:0x2:_0x2d4517;_0x398427['push']('\x22'+_0x194cc1+'\x22');break;case _0x0c21('0x3a'):var _0x224a58=parseInt(_0x194cc1);if(_[_0x0c21('0x7b')](_0x224a58)&&_[_0x0c21('0x7c')](_0xc6761c,_0x224a58)){_0x398427[_0x0c21('0x1d')]('\x22'+_0x224a58+'\x22');}else{_0x42a243[_0x0c21('0x1d')](_0x0c21('0x7d'));}break;case _0x0c21('0x7e'):if(isEmail(_0x194cc1)){_0x398427[_0x0c21('0x1d')]('\x22'+_0x194cc1+'\x22');}else{_0x42a243[_0x0c21('0x1d')]('email\x20wrong\x20format');}break;case _0x0c21('0x7f'):var _0x5f4e68=moment(_0x194cc1,_0x0c21('0x80'),!![]);if(_0x5f4e68[_0x0c21('0x78')]()){_0x398427[_0x0c21('0x1d')]('\x22'+_0x194cc1+'\x22');}else{_0x42a243[_0x0c21('0x1d')](_0x0c21('0x81'));}break;default:_0x398427[_0x0c21('0x1d')]('\x22'+_0x194cc1+'\x22');}}else{switch(_0x4163ac){case'firstName':case _0x0c21('0x12'):_0x42a243[_0x0c21('0x1d')](_0x4163ac+'\x20not\x20specified');break;default:_0x398427[_0x0c21('0x1d')]('\x22\x22');}}}}else{var _0x3ee7b8='';if(!_['isNil'](_0x2c3395)){if(!_0x33ce2f[_0x0c21('0x73')](_0x2c3395['id'])){for(var _0x13206f=0x0;_0x13206f<_0x4ccb1d[_0x4163ac]['length'];_0x13206f++){var _0x194cc1=_[_0x0c21('0x74')](_0x544eff['data'][_0x4fddc7][_0x4ccb1d[_0x4163ac][_0x13206f]][_0x0c21('0x76')](/"/g,'\x27'));var _0x3e95b9=phoneDescriptions[_0x0c21('0x72')](_0x19193a=>_0x19193a['itemTypeId']===_0x2c3395['id']);if(!_[_0x0c21('0x1c')](_0x3e95b9)){var _0x3e208c=_['trim'](_0x544eff[_0x0c21('0x75')][_0x4fddc7][_0x4ccb1d[_0x3e95b9[_0x0c21('0x82')]][0x0]][_0x0c21('0x76')](/"/g,'\x27'));if(!_[_0x0c21('0x1c')](_0x3e208c))_0x194cc1=_0x194cc1+'§'+_0x3e208c;}if(_0x3ee7b8=='')_0x3ee7b8=_0x194cc1;else _0x3ee7b8+='|'+_0x194cc1;}_0x4e6d51['push'](_0x2c3395['id']+':'+_0x3ee7b8);_0x33ce2f[_0x2c3395['id']]=0x1;}}}}if(hasAdditionalPhones){_0x398427[_0x0c21('0x1d')]('\x22'+_0x4e6d51[_0x0c21('0x14')](';')+'\x22');}if(_0x42a243[_0x0c21('0x22')]){handleError(_0x544eff[_0x0c21('0x75')][_0x4fddc7],{'code':_0x0c21('0x83'),'message':_0x42a243[_0x0c21('0x14')]()});}else{fs[_0x0c21('0x84')](_0xae9e4f,_0x398427[_0x0c21('0x14')]()+'\x0a');}_0x398427=[];}if(!(stats[_0x0c21('0x85')]%0xc8)){socket[_0x0c21('0x86')](_0x0c21('0x87')+_0x50f853,stats);stats[_0x0c21('0x5e')]=[];}}if(stopped){logger[_0x0c21('0x5c')](_0x0c21('0x88'));_0x9c9363['abort']();}}catch(_0x501efd){handleError(_0x544eff['data'][_0x4fddc7],{'code':'SystemError','message':_0x501efd[_0x0c21('0x61')]});logger['error'](_0x0c21('0x89'),_0x501efd[_0x0c21('0x61')]);}},'complete':function(){try{var _0x22797c=[];var _0x4a491e=tempTableName;_0x22797c[_0x0c21('0x1d')](_0x0c21('0x8a')+_0x4a491e+_0x0c21('0x8b'));logger[_0x0c21('0x5c')](_0x0c21('0x8c'),contactItemTypes[_0x0c21('0x22')]);var _0x12df7e=util[_0x0c21('0xf')]('LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',_0xae9e4f,_0x4a491e,_0x6459ae,_0x498cf2[_0x0c21('0x37')],_0x498cf2['CompanyId']||null,NOW,NOW);if(_[_0x0c21('0x1c')](_0x4ccb1d[_0x0c21('0x35')])){_0x12df7e+=_0x0c21('0x8d');}_0x22797c[_0x0c21('0x1d')](_0x12df7e);BPromise[_0x0c21('0x8e')](_0x22797c,handleQuery)[_0x0c21('0x1e')](function(_0x1169fb){BPromise['all']([handleAdditionalPhones()])[_0x0c21('0x1e')](function(){_0x22797c=[];for(var _0x413994=0x0;_0x413994\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.id','i.createdAt','i.closed','i.closedAt','i.lastMsgDirection','i.subject','i.thirdDisposition','i.to','i.ContactId','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','Contact.firstName','c.lastName','c.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','limit','offset'];(function(_0x20469,_0x3282b7){var _0x3f4e53=function(_0x354bf0){while(--_0x354bf0){_0x20469['push'](_0x20469['shift']());}};_0x3f4e53(++_0x3282b7);}(_0xe38e,0xa4));var _0xee38=function(_0x11ab70,_0x5b931f){_0x11ab70=_0x11ab70-0x0;var _0x5da3e6=_0xe38e[_0x11ab70];return _0x5da3e6;};'use strict';var _=require(_0xee38('0x0'));var squel=require('squel');var as=require(_0xee38('0x1'));var qs=require(_0xee38('0x2'));var updateInteraction=require(_0xee38('0x3'))[_0xee38('0x4')];var utils=require('./utils');var db=require('../../mysqldb')['db'];function skipInteractionsQuery(_0x234ed1,_0x1d6056,_0x34ff53){var _0x36a1ba=![];var _0x1a37be=utils[_0xee38('0x5')](_0x234ed1);if(_0x1d6056[_0xee38('0x6')]===_0xee38('0x7')&&!_0x34ff53[_0xee38('0x8')]&&!_0x34ff53[_0x1a37be]){_0x36a1ba=!![];}return _0x36a1ba;}function getTagsQuery(){return squel['select']()[_0xee38('0x9')]('id')[_0xee38('0x9')](_0xee38('0xa'))['field'](_0xee38('0xb'))[_0xee38('0xc')]('tools_tags');}function getUsersQuery(_0x20603a,_0xec306f){var _0x2347fc=utils[_0xee38('0xd')](_0x20603a);var _0xc485bd=_0xee38('0xe')+_0x20603a+'_interactions';var _0x553494=squel[_0xee38('0xf')]()[_0xee38('0x9')](_0xee38('0x10'))[_0xee38('0x9')]('u.fullname')['field'](_0xee38('0x11')+_0x2347fc)[_0xee38('0xc')](_0xc485bd,'ui')[_0xee38('0x12')](_0xee38('0x13'),'u',_0xee38('0x14'));if(_0xec306f[_0xee38('0x15')]>0x0){_0x553494[_0xee38('0x16')](_0xee38('0x11')+_0x2347fc+_0xee38('0x17'),_[_0xee38('0x18')](_0xec306f,'id'));}return _0x553494;}function getInteractionsQuery(_0x4aeb20){var _0x438cd8=utils[_0xee38('0x19')](_0x4aeb20);var _0x4f32bb=utils['getAccountFK'](_0x4aeb20);var _0x5b57f1=utils[_0xee38('0xd')](_0x4aeb20);return squel[_0xee38('0xf')]()[_0xee38('0xc')](_0x438cd8[_0xee38('0x1a')],'i')[_0xee38('0x12')]('cm_contacts','c',_0xee38('0x1b'))[_0xee38('0x12')](_0xee38('0x13'),'o',_0xee38('0x1c'))[_0xee38('0x12')](_0x438cd8['accounts'],'a',_0xee38('0x1d')+_0x4f32bb)[_0xee38('0x12')](_0x438cd8['messages'],'me',_0xee38('0x1e')+_0x5b57f1+_0xee38('0x1f'))[_0xee38('0x12')](_0x438cd8['interactionsTags'],'it',_0xee38('0x20')+_0x5b57f1+_0xee38('0x1f'))['left_join'](_0xee38('0x21'),'t',_0xee38('0x22'));}function getSqlClauses(){var _0x33fbe4={'body':squel[_0xee38('0x23')](),'contact':squel[_0xee38('0x23')](),'default':squel[_0xee38('0x23')](),'fields':squel[_0xee38('0x23')](),'filter':squel[_0xee38('0x23')](),'read':squel['expr'](),'tags':{'clause':squel[_0xee38('0x23')](),'ids':null},'user':squel[_0xee38('0x23')]()};return _0x33fbe4;}function parseTagParameter(_0x2b6f56){var _0x271057=squel[_0xee38('0x23')]();if(_0x2b6f56){var _0x251273=utils['getSelectedTags'](_0x2b6f56);_0x251273[_0xee38('0x24')](function(_0x4f4878){_0x271057['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x4f4878+',%');});}return _0x271057;}function parseReadParameter(_0xcc81b3){var _0x7aae41='';if(_0xcc81b3){_0x7aae41='unreadMessages\x20{OPERATOR}\x200';if(_0xcc81b3==='1'){_0x7aae41=_0x7aae41['replace'](_0xee38('0x25'),'=');}else{_0x7aae41=_0x7aae41[_0xee38('0x26')]('{OPERATOR}','>');}}return _0x7aae41;}function parseSearchFilter(_0x462524,_0x1e4153){var _0x320fec=squel[_0xee38('0x23')]();if(_0x1e4153){var _0x43c55c=_0x1e4153[_0xee38('0x26')]('\x5c','\x5c\x5c')[_0xee38('0x26')](/'/g,'\x27\x27');if(qs[_0xee38('0x27')](_0x43c55c)){_0x320fec['or']('i.id\x20LIKE\x20?',_0x43c55c+'%');if([_0xee38('0x28'),'whatsapp'][_0xee38('0x29')](_0x462524)){_0x320fec['or'](_0xee38('0x2a'),_0x43c55c+'%');}else if(_0x462524===_0xee38('0x2b')){_0x320fec['or'](_0xee38('0x2c'),_0x43c55c+'%');}else if(_0x462524===_0xee38('0x2d')){_0x320fec['or']('i.from\x20LIKE\x20?',_0x43c55c+'%');}}else if(_0x462524===_0xee38('0x2e')&&qs['isEmail'](_0x43c55c)){_0x320fec['or'](_0xee38('0x2f'),_0x43c55c+'%');}else{if(_0x462524===_0xee38('0x2e')){_0x320fec['or'](_0xee38('0x30'),qs[_0xee38('0x31')](_0x43c55c,!![]))['or']('MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xee38('0x31')](_0x43c55c));}else if(_0x462524!==_0xee38('0x2b')){_0x320fec['or'](_0xee38('0x32'),qs[_0xee38('0x31')](_0x43c55c));}_0x320fec['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xee38('0x31')](_0x43c55c,!![]),null);}}return _0x320fec;}function parseAdvancedSearchFilter(_0x532fba,_0x397436){var _0x2f4064=getSqlClauses();var _0x100430=as['parseSearch'](_0x532fba);var _0xc4d39b=_0x100430[_0xee38('0x33')];for(var _0x51c107=0x0;_0x51c107<_0x100430['conditions'][_0xee38('0x15')];_0x51c107++){var _0x4466bc=_0x100430['conditions'][_0x51c107];var _0x91aad6='i';var _0x36c2dc=_[_0xee38('0x34')](_0x397436,[_0xee38('0xa'),_0x4466bc[_0xee38('0x9')]]);if(_0x36c2dc){var _0x22e2c5=as[_0xee38('0x35')](_0x91aad6,_0x36c2dc[_0xee38('0x36')],_0x4466bc);_0x2f4064[_0xee38('0x37')][_0xc4d39b](_0x22e2c5['text'],_0x22e2c5[_0xee38('0x38')][_0xee38('0x39')],_0x22e2c5['value'][_0xee38('0x3a')]);}else{switch(_0x4466bc['field']){case _0xee38('0x3b'):var _0x4ad8b2=parseReadParameter(_0x4466bc['value']);_0x2f4064[_0xee38('0x3c')]['and'](_0x4ad8b2);break;case _0xee38('0x3d'):if(_0x4466bc[_0xee38('0x3e')]==='$substring'){if(_0x4466bc[_0xee38('0x38')][_0xee38('0x3f')]('\x20')[_0xee38('0x15')]>0x1){_0x2f4064[_0xee38('0x40')][_0xc4d39b](_0xee38('0x41'),qs[_0xee38('0x31')](_0x4466bc['value'],!![]),null);}else{var _0x4a55cf='%'+_0x4466bc[_0xee38('0x38')]+'%';_0x2f4064[_0xee38('0x40')][_0xc4d39b](_0xee38('0x42'),_0x4a55cf,_0x4a55cf,_0x4a55cf);}}else{_0x36c2dc=_[_0xee38('0x34')](_0x397436,[_0xee38('0xa'),_0xee38('0x43')]);_0x4466bc[_0xee38('0x9')]=_0xee38('0x43');_0x22e2c5=as[_0xee38('0x35')](_0x91aad6,_0x36c2dc[_0xee38('0x36')],_0x4466bc);_0x2f4064[_0xee38('0x40')][_0xc4d39b](_0x22e2c5[_0xee38('0x44')],_0x22e2c5[_0xee38('0x38')][_0xee38('0x39')],_0x22e2c5[_0xee38('0x38')][_0xee38('0x3a')]);}break;case'Tag':var _0x4db0e2=_0x4466bc['value']['split'](',')['map'](function(_0x5423e6){return Number(_0x5423e6);});var _0x100284=parseTagParameter(_0x4db0e2);_0x2f4064[_0xee38('0x45')][_0xee38('0x46')][_0xee38('0x47')](_0x100284);_0x2f4064['tags'][_0xee38('0x48')]=_0x4db0e2;break;case _0xee38('0x49'):if(_0x4466bc[_0xee38('0x3e')]===_0xee38('0x4a')){_0x2f4064[_0xee38('0x4b')][_0xc4d39b]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x4466bc[_0xee38('0x38')]+'%',null);}else{_0x36c2dc=_['find'](_0x397436,[_0xee38('0xa'),_0xee38('0x4c')]);_0x4466bc[_0xee38('0x9')]=_0xee38('0x4c');_0x22e2c5=as[_0xee38('0x35')](_0x91aad6,_0x36c2dc[_0xee38('0x36')],_0x4466bc);_0x2f4064['user'][_0xc4d39b](_0x22e2c5[_0xee38('0x44')],_0x22e2c5[_0xee38('0x38')][_0xee38('0x39')],_0x22e2c5[_0xee38('0x38')][_0xee38('0x3a')]);}break;case _0xee38('0x4d'):case _0xee38('0x4e'):_0x22e2c5=as[_0xee38('0x35')]('me',null,_0x4466bc);_0x2f4064[_0xee38('0x4d')][_0xc4d39b](_0x22e2c5['text'],_0x22e2c5[_0xee38('0x38')][_0xee38('0x39')],_0x22e2c5[_0xee38('0x38')][_0xee38('0x3a')]);break;}}}return _0x2f4064;}function parseModelFields(_0x589212,_0xc0d64,_0x2cf1e6){var _0x5c8e7b=utils[_0xee38('0x5')](_0x589212);var _0x38b9d0=squel['expr']();var _0x52c20f=_(_0xc0d64)['keys']()[_0xee38('0x18')](function(_0x46077b){return _[_0xee38('0x4f')](_0x2cf1e6,[_0xee38('0xa'),_0x46077b])?_0x46077b:undefined;})[_0xee38('0x50')]()[_0xee38('0x38')]();if(_0x52c20f[_0xee38('0x15')]>0x0){_0x52c20f[_0xee38('0x24')](function(_0x5a0478){if(_0x5a0478===_0x5c8e7b){_0x38b9d0['and']('i.'+_0x5c8e7b+_0xee38('0x17'),[][_0xee38('0x51')](_0xc0d64[_0x5a0478]));}else if(_0x5a0478===_0xee38('0x52')){var _0x54929e=JSON[_0xee38('0x53')](_0xc0d64[_0x5a0478])[_0xee38('0x54')];var _0x16aa83=JSON[_0xee38('0x53')](_0xc0d64[_0x5a0478])[_0xee38('0x55')];_0x38b9d0[_0xee38('0x47')](_0xee38('0x56'),_0x54929e,_0x16aa83);}else{if(_0xc0d64[_0x5a0478]===_0xee38('0x57')){_0x38b9d0[_0xee38('0x47')]('i.'+_0x5a0478+_0xee38('0x58'));}else{_0x38b9d0[_0xee38('0x47')]('i.'+_0x5a0478+_0xee38('0x59'),_0xc0d64[_0x5a0478]);}}});}return _0x38b9d0;}function parseQueryParameters(_0x32cc24,_0x39f042,_0xc9c93f){var _0x525b1f=getSqlClauses();return Promise[_0xee38('0x5a')]()[_0xee38('0x5b')](function(){return parseModelFields(_0x32cc24,_0x39f042,_0xc9c93f);})[_0xee38('0x5b')](function(_0x72b12e){_0x525b1f[_0xee38('0x5c')][_0xee38('0x47')](_0x72b12e);return parseReadParameter(_0x39f042[_0xee38('0x3c')]);})[_0xee38('0x5b')](function(_0x481976){_0x525b1f[_0xee38('0x3c')][_0xee38('0x47')](_0x481976);return parseTagParameter(_0x39f042[_0xee38('0x5d')]);})[_0xee38('0x5b')](function(_0x5915eb){_0x525b1f[_0xee38('0x45')][_0xee38('0x46')]['and'](_0x5915eb);return parseSearchFilter(_0x32cc24,_0x39f042['filter']);})['then'](function(_0xbab433){_0x525b1f['filter']=_0xbab433;return _0x525b1f;});}function checkAccountsRestrictions(_0x8e98bb,_0xc34191,_0x54aac0){var _0x222e68=utils[_0xee38('0x5')](_0x8e98bb);var _0x103f01='get'+_[_0xee38('0x5e')](_0x8e98bb)+(_0x8e98bb===_0xee38('0x5f')?_0xee38('0x60'):_0xee38('0x61'));var _0x2638d9=squel[_0xee38('0x23')]();return Promise[_0xee38('0x5a')]()['then'](function(){if(_0x54aac0[_0xee38('0x8')]&&_0xc34191[_0xee38('0x6')]===_0xee38('0x7')){return _0xc34191[_0x103f01]({'attributes':['id'],'raw':!![]});}})[_0xee38('0x5b')](function(_0x1a9a29){if(_0x1a9a29){if(_0x1a9a29[_0xee38('0x15')]===0x0){_0x2638d9[_0xee38('0x47')]('i.'+_0x222e68+_0xee38('0x58'));}else{_0x2638d9[_0xee38('0x47')]('i.'+_0x222e68+_0xee38('0x17'),_[_0xee38('0x18')](_0x1a9a29,'id'));}}else if(!_0x54aac0[_0x222e68]){_0x2638d9[_0xee38('0x47')]('i.'+_0x222e68+'\x20IS\x20NOT\x20NULL');}})[_0xee38('0x5b')](function(){return _0x2638d9;});}function getClosedOrderClause(_0x1468bb,_0x2bcfab){var _0x318eac='';var _0x428c69=['i.thirdDisposition','i.secondDisposition',_0xee38('0x62')];if(_0x1468bb===_0xee38('0x2e')){_0x428c69[_0xee38('0x63')]('i.substatus');}if(_0x2bcfab[_0xee38('0x64')]==='0'&&_0x1468bb===_0xee38('0x2e')){_0x318eac=_0xee38('0x65');}else{if(_0x2bcfab[_0xee38('0x64')]==='1'){_0x428c69[_0xee38('0x66')]();}_0x318eac=_0xee38('0x67')+_0x428c69[_0xee38('0x68')](',\x20')+')';}return _0x318eac;}function getFilteredInteractions(_0xadf310,_0x224539,_0x3da887,_0x4579af){var _0x38fecc=utils[_0xee38('0xd')](_0xadf310);var _0x1a299b=_[_0xee38('0x5e')](_0xadf310)+'Interaction';var _0x3a8cd9=[];var _0x2a679a=getTagsQuery();var _0x4f2bb4={'type':db['Sequelize'][_0xee38('0x69')]['SELECT'],'raw':!![]};var _0x272c52=[];var _0x72d212=[];return db[_0xee38('0x6a')][_0xee38('0x6b')](_0x2a679a[_0xee38('0x6c')](),_0x4f2bb4)['then'](function(_0x4c87b2){_0x3a8cd9=_[_0xee38('0x6d')](_0x4c87b2,'id');_0x4f2bb4=_[_0xee38('0x6e')](_0x4f2bb4,{'model':db[_0x1a299b],'mapToModel':!![],'nest':!![]});if(_0x3da887[_0xee38('0x5c')]){_0x4579af[_0xee38('0x6f')][_0xee38('0x24')](function(_0x40bf72){_0x224539[_0xee38('0x9')]('i.'+_0x40bf72);});}else{_0x224539['field'](_0xee38('0x70'),_0xee38('0x3b'));_0x224539['field'](_0xee38('0x71'),_0xee38('0x72'));_0x224539[_0xee38('0x9')]('a.mandatoryDisposition','Account.mandatoryDisposition');if(_0xadf310===_0xee38('0x2e')){_0x224539[_0xee38('0x9')](_0xee38('0x73'),_0xee38('0x74'));_0x224539['field'](_0xee38('0x75'),_0xee38('0x76'));_0x224539[_0xee38('0x9')](_0xee38('0x77'));_0x224539[_0xee38('0x9')](_0xee38('0x78'));_0x224539[_0xee38('0x9')]('i.updatedAt');_0x224539[_0xee38('0x9')](_0xee38('0x79'));_0x224539[_0xee38('0x9')](_0xee38('0x7a'));_0x224539[_0xee38('0x9')]('i.attach');_0x224539[_0xee38('0x9')]('i.lastMsgAt');_0x224539[_0xee38('0x9')](_0xee38('0x7b'));_0x224539[_0xee38('0x9')](_0xee38('0x7c'));_0x224539[_0xee38('0x9')](_0xee38('0x62'));_0x224539[_0xee38('0x9')]('i.secondDisposition');_0x224539[_0xee38('0x9')](_0xee38('0x7d'));_0x224539[_0xee38('0x9')](_0xee38('0x65'));_0x224539[_0xee38('0x9')](_0xee38('0x7e'));_0x224539[_0xee38('0x9')](_0xee38('0x7f'));_0x224539[_0xee38('0x9')]('i.MailAccountId');_0x224539[_0xee38('0x9')]('i.UserId');}else if(_0xadf310==='openchannel'){_0x224539[_0xee38('0x9')](_0xee38('0x80'),_0xee38('0x76'));}else{_0x224539[_0xee38('0x9')](_0xee38('0x81'),'contactName');}if(_0xadf310!==_0xee38('0x2e')){_0x224539['field'](_0xee38('0x82'));}_0x224539[_0xee38('0x9')](_0xee38('0x83'),_0xee38('0x84'));_0x224539[_0xee38('0x9')](_0xee38('0x85'),'Contact.lastName');_0x224539[_0xee38('0x9')](_0xee38('0x86'),'Contact.email');_0x224539['field'](_0xee38('0x87'),_0xee38('0x88'));_0x224539[_0xee38('0x9')](_0xee38('0x89'),_0xee38('0x8a'));_0x224539[_0xee38('0x9')](_0xee38('0x8b'),'Contact.fax');_0x224539['field'](_0xee38('0x8c'),_0xee38('0x8d'));_0x224539[_0xee38('0x9')](_0xee38('0x8e'),_0xee38('0x8f'));_0x224539['field'](_0xee38('0x90'),_0xee38('0x91'));}if(_0x4579af['limit']){_0x224539[_0xee38('0x92')](_0x4579af[_0xee38('0x92')]);}if(_0x4579af[_0xee38('0x93')]){_0x224539['offset'](_0x4579af[_0xee38('0x93')]);}return db['sequelize'][_0xee38('0x6b')](_0x224539[_0xee38('0x6c')](),_0x4f2bb4);})[_0xee38('0x5b')](function(_0x4f9513){_0x272c52=_0x4f9513;var _0x50d402=getUsersQuery(_0xadf310,_0x272c52);return db[_0xee38('0x6a')][_0xee38('0x6b')](_0x50d402[_0xee38('0x6c')](),_0x4f2bb4);})[_0xee38('0x5b')](function(_0x19dff4){_0x72d212=_[_0xee38('0x94')](_0x19dff4,_0x38fecc);if(_0xadf310===_0xee38('0x2e')){return db['Setting'][_0xee38('0x95')]({'attributes':[_0xee38('0x96')],'raw':!![]});}})[_0xee38('0x5b')](function(_0x5c2fd1){var _0x4d0ace=_0x5c2fd1?_0x5c2fd1[_0xee38('0x96')]:undefined;var _0x4d1fa2=_0x272c52['map'](function(_0x29d175){return updateInteraction(_0x29d175,_0x3a8cd9,_0x72d212,_0x4d0ace);});return Promise[_0xee38('0x97')](_0x4d1fa2);});}function countFilteredInteractions(_0x2ee475,_0x5cfb5e){var _0x88c396=_0x2ee475['clone']();_0x88c396['field']('COUNT(*)');_0x88c396['field'](_0xee38('0x70'),_0xee38('0x3b'));var _0x548b89=utils[_0xee38('0x98')](_0x5cfb5e);if(!_[_0xee38('0x99')](_0x548b89)){_0x88c396[_0xee38('0x16')](_0xee38('0x9a'),_0x548b89);}var _0x32b5e6={'type':db[_0xee38('0x9b')]['QueryTypes']['SELECT'],'raw':!![]};return db[_0xee38('0x6a')][_0xee38('0x6b')](_0x88c396['toString'](),_0x32b5e6);}module['exports']={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery}; \ No newline at end of file +var _0x3cd4=['u.id','u.fullname','ui.','from','users','where','\x20IN\x20?','map','interactions','left_join','o.id\x20=\x20i.UserId','me.','\x20=\x20i.id','interactionsTags','it.','tools_tags','t.id\x20=\x20it.TagId','expr','getSelectedTags','forEach','unreadMessages\x20{OPERATOR}\x200','replace','{OPERATOR}','isNumeric','i.id\x20LIKE\x20?','sms','whatsapp','i.phone\x20LIKE\x20?','mail','isEmail','c.email\x20LIKE\x20?','getFullTextValue','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','fax','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','parseSearch','conditions','length','buildExpression','type','default','value','start','end','unreadMessages','read','and','Contact','operator','split','contact','find','ContactId','tags','clause','ids','User','$substring','user','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','text','plainBody','body','keys','some','parse','$gte','$lte','null','\x20IS\x20NULL','\x20=\x20?','then','fields','get','capitalize','chat','Websites','resolve','\x20IS\x20NOT\x20NULL','i.thirdDisposition','i.secondDisposition','i.disposition','unshift','i.substatus','closed','join','Interaction','Sequelize','QueryTypes','SELECT','sequelize','toString','merge','attributes','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','a.email','Account.email','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.id','i.createdAt','i.updatedAt','i.closed','i.closedAt','i.attach','i.lastMsgAt','i.lastMsgDirection','i.subject','i.to','i.ContactId','i.MailAccountId','i.UserId','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.*','c.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','limit','offset','query','Setting','findOne','enableEmailPreview','clone','COUNT(*)','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','isEmpty','t.id\x20IN\x20?','exports','lodash','squel','../parsers/advancedSearch','../parsers/qs','updateInteraction','./utils','../../mysqldb','getAccountFK','role','agent','search','field','name','getInteractionFK','user_has_','_interactions','select'];(function(_0x1e2ecc,_0x2a4c82){var _0x47abe2=function(_0x35d680){while(--_0x35d680){_0x1e2ecc['push'](_0x1e2ecc['shift']());}};_0x47abe2(++_0x2a4c82);}(_0x3cd4,0x1d8));var _0x43cd=function(_0x31260c,_0x1e21f1){_0x31260c=_0x31260c-0x0;var _0x1e3cb4=_0x3cd4[_0x31260c];return _0x1e3cb4;};'use strict';var _=require(_0x43cd('0x0'));var squel=require(_0x43cd('0x1'));var as=require(_0x43cd('0x2'));var qs=require(_0x43cd('0x3'));var updateInteraction=require('./update-interaction')[_0x43cd('0x4')];var utils=require(_0x43cd('0x5'));var db=require(_0x43cd('0x6'))['db'];function skipInteractionsQuery(_0x1c60f9,_0xc2275e,_0xf6588){var _0x50a8f6=![];var _0x411050=utils[_0x43cd('0x7')](_0x1c60f9);if(_0xc2275e[_0x43cd('0x8')]===_0x43cd('0x9')&&!_0xf6588[_0x43cd('0xa')]&&!_0xf6588[_0x411050]){_0x50a8f6=!![];}return _0x50a8f6;}function getTagsQuery(){return squel['select']()[_0x43cd('0xb')]('id')[_0x43cd('0xb')](_0x43cd('0xc'))[_0x43cd('0xb')]('color')['from']('tools_tags');}function getUsersQuery(_0x3a4e99,_0x528d01){var _0x17cc75=utils[_0x43cd('0xd')](_0x3a4e99);var _0x993491=_0x43cd('0xe')+_0x3a4e99+_0x43cd('0xf');var _0x456a74=squel[_0x43cd('0x10')]()[_0x43cd('0xb')](_0x43cd('0x11'))[_0x43cd('0xb')](_0x43cd('0x12'))['field'](_0x43cd('0x13')+_0x17cc75)[_0x43cd('0x14')](_0x993491,'ui')['left_join'](_0x43cd('0x15'),'u','u.id\x20=\x20ui.UserId');if(_0x528d01['length']>0x0){_0x456a74[_0x43cd('0x16')]('ui.'+_0x17cc75+_0x43cd('0x17'),_[_0x43cd('0x18')](_0x528d01,'id'));}return _0x456a74;}function getInteractionsQuery(_0x304cb2){var _0x412b65=utils['getInteractionsTables'](_0x304cb2);var _0x197be3=utils[_0x43cd('0x7')](_0x304cb2);var _0x27b251=utils[_0x43cd('0xd')](_0x304cb2);return squel[_0x43cd('0x10')]()[_0x43cd('0x14')](_0x412b65[_0x43cd('0x19')],'i')[_0x43cd('0x1a')]('cm_contacts','c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')['left_join'](_0x43cd('0x15'),'o',_0x43cd('0x1b'))[_0x43cd('0x1a')](_0x412b65['accounts'],'a','a.id\x20=\x20i.'+_0x197be3)[_0x43cd('0x1a')](_0x412b65['messages'],'me',_0x43cd('0x1c')+_0x27b251+_0x43cd('0x1d'))[_0x43cd('0x1a')](_0x412b65[_0x43cd('0x1e')],'it',_0x43cd('0x1f')+_0x27b251+'\x20=\x20i.id')[_0x43cd('0x1a')](_0x43cd('0x20'),'t',_0x43cd('0x21'));}function getSqlClauses(){var _0x329ee3={'body':squel['expr'](),'contact':squel[_0x43cd('0x22')](),'default':squel[_0x43cd('0x22')](),'fields':squel[_0x43cd('0x22')](),'filter':squel[_0x43cd('0x22')](),'read':squel[_0x43cd('0x22')](),'tags':{'clause':squel[_0x43cd('0x22')](),'ids':null},'user':squel[_0x43cd('0x22')]()};return _0x329ee3;}function parseTagParameter(_0x4fbd4d){var _0x56c58e=squel[_0x43cd('0x22')]();if(_0x4fbd4d){var _0x435c96=utils[_0x43cd('0x23')](_0x4fbd4d);_0x435c96[_0x43cd('0x24')](function(_0x429e0b){_0x56c58e['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x429e0b+',%');});}return _0x56c58e;}function parseReadParameter(_0x33209a){var _0x7d2962='';if(_0x33209a){_0x7d2962=_0x43cd('0x25');if(_0x33209a==='1'){_0x7d2962=_0x7d2962[_0x43cd('0x26')](_0x43cd('0x27'),'=');}else{_0x7d2962=_0x7d2962[_0x43cd('0x26')](_0x43cd('0x27'),'>');}}return _0x7d2962;}function parseSearchFilter(_0x44fb9c,_0xe3ebd8){var _0x571c84=squel[_0x43cd('0x22')]();if(_0xe3ebd8){var _0x343a80=_0xe3ebd8['replace']('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x43cd('0x28')](_0x343a80)){_0x571c84['or'](_0x43cd('0x29'),_0x343a80+'%');if([_0x43cd('0x2a'),_0x43cd('0x2b')]['includes'](_0x44fb9c)){_0x571c84['or'](_0x43cd('0x2c'),_0x343a80+'%');}else if(_0x44fb9c==='fax'){_0x571c84['or']('i.fax\x20LIKE\x20?',_0x343a80+'%');}else if(_0x44fb9c==='openchannel'){_0x571c84['or']('i.from\x20LIKE\x20?',_0x343a80+'%');}}else if(_0x44fb9c===_0x43cd('0x2d')&&qs[_0x43cd('0x2e')](_0x343a80)){_0x571c84['or'](_0x43cd('0x2f'),_0x343a80+'%');}else{if(_0x44fb9c===_0x43cd('0x2d')){_0x571c84['or']('MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x43cd('0x30')](_0x343a80,!![]))['or'](_0x43cd('0x31'),qs[_0x43cd('0x30')](_0x343a80));}else if(_0x44fb9c!==_0x43cd('0x32')){_0x571c84['or'](_0x43cd('0x33'),qs[_0x43cd('0x30')](_0x343a80));}_0x571c84['or'](_0x43cd('0x34'),qs['getFullTextValue'](_0x343a80,!![]),null);}}return _0x571c84;}function parseAdvancedSearchFilter(_0x2a91b3,_0x5edcae){var _0x5eb5f4=getSqlClauses();var _0x283efd=as[_0x43cd('0x35')](_0x2a91b3);var _0x5c2c9b=_0x283efd['sqlOperator'];for(var _0x4d29be=0x0;_0x4d29be<_0x283efd[_0x43cd('0x36')][_0x43cd('0x37')];_0x4d29be++){var _0xe1aa64=_0x283efd[_0x43cd('0x36')][_0x4d29be];var _0x5e1444='i';var _0x4c9782=_['find'](_0x5edcae,[_0x43cd('0xc'),_0xe1aa64['field']]);if(_0x4c9782){var _0x2d274f=as[_0x43cd('0x38')](_0x5e1444,_0x4c9782[_0x43cd('0x39')],_0xe1aa64);_0x5eb5f4[_0x43cd('0x3a')][_0x5c2c9b](_0x2d274f['text'],_0x2d274f[_0x43cd('0x3b')][_0x43cd('0x3c')],_0x2d274f[_0x43cd('0x3b')][_0x43cd('0x3d')]);}else{switch(_0xe1aa64[_0x43cd('0xb')]){case _0x43cd('0x3e'):var _0x507f76=parseReadParameter(_0xe1aa64[_0x43cd('0x3b')]);_0x5eb5f4[_0x43cd('0x3f')][_0x43cd('0x40')](_0x507f76);break;case _0x43cd('0x41'):if(_0xe1aa64[_0x43cd('0x42')]==='$substring'){if(_0xe1aa64['value'][_0x43cd('0x43')]('\x20')['length']>0x1){_0x5eb5f4[_0x43cd('0x44')][_0x5c2c9b](_0x43cd('0x34'),qs[_0x43cd('0x30')](_0xe1aa64[_0x43cd('0x3b')],!![]),null);}else{var _0x4eafe1='%'+_0xe1aa64[_0x43cd('0x3b')]+'%';_0x5eb5f4[_0x43cd('0x44')][_0x5c2c9b]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x4eafe1,_0x4eafe1,_0x4eafe1);}}else{_0x4c9782=_[_0x43cd('0x45')](_0x5edcae,[_0x43cd('0xc'),_0x43cd('0x46')]);_0xe1aa64['field']=_0x43cd('0x46');_0x2d274f=as[_0x43cd('0x38')](_0x5e1444,_0x4c9782['type'],_0xe1aa64);_0x5eb5f4[_0x43cd('0x44')][_0x5c2c9b](_0x2d274f['text'],_0x2d274f[_0x43cd('0x3b')]['start'],_0x2d274f[_0x43cd('0x3b')][_0x43cd('0x3d')]);}break;case'Tag':var _0x2751bf=_0xe1aa64[_0x43cd('0x3b')][_0x43cd('0x43')](',')[_0x43cd('0x18')](function(_0x4220b8){return Number(_0x4220b8);});var _0x141b17=parseTagParameter(_0x2751bf);_0x5eb5f4[_0x43cd('0x47')][_0x43cd('0x48')][_0x43cd('0x40')](_0x141b17);_0x5eb5f4['tags'][_0x43cd('0x49')]=_0x2751bf;break;case _0x43cd('0x4a'):if(_0xe1aa64[_0x43cd('0x42')]===_0x43cd('0x4b')){_0x5eb5f4[_0x43cd('0x4c')][_0x5c2c9b](_0x43cd('0x4d'),'%'+_0xe1aa64[_0x43cd('0x3b')]+'%',null);}else{_0x4c9782=_[_0x43cd('0x45')](_0x5edcae,[_0x43cd('0xc'),_0x43cd('0x4e')]);_0xe1aa64[_0x43cd('0xb')]='UserId';_0x2d274f=as[_0x43cd('0x38')](_0x5e1444,_0x4c9782[_0x43cd('0x39')],_0xe1aa64);_0x5eb5f4[_0x43cd('0x4c')][_0x5c2c9b](_0x2d274f[_0x43cd('0x4f')],_0x2d274f[_0x43cd('0x3b')][_0x43cd('0x3c')],_0x2d274f[_0x43cd('0x3b')]['end']);}break;case'body':case _0x43cd('0x50'):_0x2d274f=as[_0x43cd('0x38')]('me',null,_0xe1aa64);_0x5eb5f4[_0x43cd('0x51')][_0x5c2c9b](_0x2d274f[_0x43cd('0x4f')],_0x2d274f[_0x43cd('0x3b')]['start'],_0x2d274f[_0x43cd('0x3b')][_0x43cd('0x3d')]);break;}}}return _0x5eb5f4;}function parseModelFields(_0x5cc66c,_0x336156,_0x50996e){var _0xde7af6=utils[_0x43cd('0x7')](_0x5cc66c);var _0x17b85b=squel[_0x43cd('0x22')]();var _0x5dd2e8=_(_0x336156)[_0x43cd('0x52')]()[_0x43cd('0x18')](function(_0x2768fd){return _[_0x43cd('0x53')](_0x50996e,[_0x43cd('0xc'),_0x2768fd])?_0x2768fd:undefined;})['compact']()[_0x43cd('0x3b')]();if(_0x5dd2e8[_0x43cd('0x37')]>0x0){_0x5dd2e8[_0x43cd('0x24')](function(_0x9bc645){if(_0x9bc645===_0xde7af6){_0x17b85b[_0x43cd('0x40')]('i.'+_0xde7af6+_0x43cd('0x17'),[]['concat'](_0x336156[_0x9bc645]));}else if(_0x9bc645==='createdAt'){var _0x491a55=JSON[_0x43cd('0x54')](_0x336156[_0x9bc645])[_0x43cd('0x55')];var _0x300d61=JSON['parse'](_0x336156[_0x9bc645])[_0x43cd('0x56')];_0x17b85b['and']('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x491a55,_0x300d61);}else{if(_0x336156[_0x9bc645]===_0x43cd('0x57')){_0x17b85b[_0x43cd('0x40')]('i.'+_0x9bc645+_0x43cd('0x58'));}else{_0x17b85b[_0x43cd('0x40')]('i.'+_0x9bc645+_0x43cd('0x59'),_0x336156[_0x9bc645]);}}});}return _0x17b85b;}function parseQueryParameters(_0x3a0a5f,_0xc68587,_0x4eeabd){var _0x9bc2e0=getSqlClauses();return Promise['resolve']()[_0x43cd('0x5a')](function(){return parseModelFields(_0x3a0a5f,_0xc68587,_0x4eeabd);})[_0x43cd('0x5a')](function(_0x381522){_0x9bc2e0[_0x43cd('0x5b')][_0x43cd('0x40')](_0x381522);return parseReadParameter(_0xc68587[_0x43cd('0x3f')]);})[_0x43cd('0x5a')](function(_0x2ed3f5){_0x9bc2e0[_0x43cd('0x3f')][_0x43cd('0x40')](_0x2ed3f5);return parseTagParameter(_0xc68587['tag']);})[_0x43cd('0x5a')](function(_0xe1ed28){_0x9bc2e0[_0x43cd('0x47')]['clause']['and'](_0xe1ed28);return parseSearchFilter(_0x3a0a5f,_0xc68587['filter']);})[_0x43cd('0x5a')](function(_0x4c6ec9){_0x9bc2e0['filter']=_0x4c6ec9;return _0x9bc2e0;});}function checkAccountsRestrictions(_0x541030,_0x15c091,_0x17ea74){var _0x235d4a=utils['getAccountFK'](_0x541030);var _0x51d0f9=_0x43cd('0x5c')+_[_0x43cd('0x5d')](_0x541030)+(_0x541030===_0x43cd('0x5e')?_0x43cd('0x5f'):'Accounts');var _0x2b00cb=squel[_0x43cd('0x22')]();return Promise[_0x43cd('0x60')]()[_0x43cd('0x5a')](function(){if(_0x17ea74['search']&&_0x15c091['role']===_0x43cd('0x9')){return _0x15c091[_0x51d0f9]({'attributes':['id'],'raw':!![]});}})[_0x43cd('0x5a')](function(_0x2e8329){if(_0x2e8329){if(_0x2e8329[_0x43cd('0x37')]===0x0){_0x2b00cb[_0x43cd('0x40')]('i.'+_0x235d4a+_0x43cd('0x58'));}else{_0x2b00cb[_0x43cd('0x40')]('i.'+_0x235d4a+'\x20IN\x20?',_[_0x43cd('0x18')](_0x2e8329,'id'));}}else if(!_0x17ea74[_0x235d4a]){_0x2b00cb[_0x43cd('0x40')]('i.'+_0x235d4a+_0x43cd('0x61'));}})['then'](function(){return _0x2b00cb;});}function getClosedOrderClause(_0x13c111,_0x199461){var _0x24e034='';var _0x235c7f=[_0x43cd('0x62'),_0x43cd('0x63'),_0x43cd('0x64')];if(_0x13c111==='mail'){_0x235c7f[_0x43cd('0x65')](_0x43cd('0x66'));}if(_0x199461[_0x43cd('0x67')]==='0'&&_0x13c111===_0x43cd('0x2d')){_0x24e034=_0x43cd('0x66');}else{if(_0x199461['closed']==='1'){_0x235c7f['shift']();}_0x24e034='CONCAT_WS(\x27\x27,\x20'+_0x235c7f[_0x43cd('0x68')](',\x20')+')';}return _0x24e034;}function getFilteredInteractions(_0x13905e,_0x5416a,_0x3f6c18,_0x53bb02){var _0xd1fa84=utils['getInteractionFK'](_0x13905e);var _0x1cc5cb=_[_0x43cd('0x5d')](_0x13905e)+_0x43cd('0x69');var _0x202ee4=[];var _0x9ceb33=getTagsQuery();var _0x200b16={'type':db[_0x43cd('0x6a')][_0x43cd('0x6b')][_0x43cd('0x6c')],'raw':!![]};var _0x538810=[];var _0x21e14c=[];return db[_0x43cd('0x6d')]['query'](_0x9ceb33[_0x43cd('0x6e')](),_0x200b16)[_0x43cd('0x5a')](function(_0x2d999f){_0x202ee4=_['keyBy'](_0x2d999f,'id');_0x200b16=_[_0x43cd('0x6f')](_0x200b16,{'model':db[_0x1cc5cb],'mapToModel':!![],'nest':!![]});if(_0x3f6c18[_0x43cd('0x5b')]){_0x53bb02[_0x43cd('0x70')][_0x43cd('0x24')](function(_0x76018c){_0x5416a[_0x43cd('0xb')]('i.'+_0x76018c);});}else{_0x5416a[_0x43cd('0xb')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');_0x5416a[_0x43cd('0xb')]('a.key',_0x43cd('0x71'));_0x5416a['field'](_0x43cd('0x72'),_0x43cd('0x73'));if(_0x13905e===_0x43cd('0x2d')){_0x5416a['field'](_0x43cd('0x74'),_0x43cd('0x75'));_0x5416a[_0x43cd('0xb')](_0x43cd('0x76'),_0x43cd('0x77'));_0x5416a[_0x43cd('0xb')](_0x43cd('0x78'));_0x5416a[_0x43cd('0xb')](_0x43cd('0x79'));_0x5416a[_0x43cd('0xb')](_0x43cd('0x7a'));_0x5416a[_0x43cd('0xb')](_0x43cd('0x7b'));_0x5416a[_0x43cd('0xb')](_0x43cd('0x7c'));_0x5416a[_0x43cd('0xb')](_0x43cd('0x7d'));_0x5416a[_0x43cd('0xb')](_0x43cd('0x7e'));_0x5416a[_0x43cd('0xb')](_0x43cd('0x7f'));_0x5416a['field'](_0x43cd('0x80'));_0x5416a['field']('i.disposition');_0x5416a[_0x43cd('0xb')](_0x43cd('0x63'));_0x5416a['field'](_0x43cd('0x62'));_0x5416a[_0x43cd('0xb')](_0x43cd('0x66'));_0x5416a[_0x43cd('0xb')](_0x43cd('0x81'));_0x5416a[_0x43cd('0xb')](_0x43cd('0x82'));_0x5416a[_0x43cd('0xb')](_0x43cd('0x83'));_0x5416a[_0x43cd('0xb')](_0x43cd('0x84'));}else if(_0x13905e==='openchannel'){_0x5416a[_0x43cd('0xb')](_0x43cd('0x85'),_0x43cd('0x77'));}else{_0x5416a['field']('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',_0x43cd('0x77'));}if(_0x13905e!==_0x43cd('0x2d')){_0x5416a[_0x43cd('0xb')](_0x43cd('0x86'));}_0x5416a['field'](_0x43cd('0x87'),'Contact.firstName');_0x5416a[_0x43cd('0xb')](_0x43cd('0x88'),_0x43cd('0x89'));_0x5416a[_0x43cd('0xb')](_0x43cd('0x8a'),_0x43cd('0x8b'));_0x5416a[_0x43cd('0xb')](_0x43cd('0x8c'),_0x43cd('0x8d'));_0x5416a[_0x43cd('0xb')](_0x43cd('0x8e'),'Contact.mobile');_0x5416a['field'](_0x43cd('0x8f'),_0x43cd('0x90'));_0x5416a[_0x43cd('0xb')](_0x43cd('0x91'),_0x43cd('0x92'));_0x5416a[_0x43cd('0xb')](_0x43cd('0x93'),_0x43cd('0x94'));_0x5416a[_0x43cd('0xb')](_0x43cd('0x95'),_0x43cd('0x96'));}if(_0x53bb02[_0x43cd('0x97')]){_0x5416a[_0x43cd('0x97')](_0x53bb02[_0x43cd('0x97')]);}if(_0x53bb02['offset']){_0x5416a[_0x43cd('0x98')](_0x53bb02['offset']);}return db[_0x43cd('0x6d')][_0x43cd('0x99')](_0x5416a[_0x43cd('0x6e')](),_0x200b16);})[_0x43cd('0x5a')](function(_0x27792b){_0x538810=_0x27792b;var _0x2a85b8=getUsersQuery(_0x13905e,_0x538810);return db['sequelize'][_0x43cd('0x99')](_0x2a85b8['toString'](),_0x200b16);})[_0x43cd('0x5a')](function(_0x3e7336){_0x21e14c=_['groupBy'](_0x3e7336,_0xd1fa84);if(_0x13905e===_0x43cd('0x2d')){return db[_0x43cd('0x9a')][_0x43cd('0x9b')]({'attributes':[_0x43cd('0x9c')],'raw':!![]});}})[_0x43cd('0x5a')](function(_0x2ec4fb){var _0x5514de=_0x2ec4fb?_0x2ec4fb[_0x43cd('0x9c')]:undefined;var _0x4033f9=_0x538810[_0x43cd('0x18')](function(_0x2e7c79){return updateInteraction(_0x2e7c79,_0x202ee4,_0x21e14c,_0x5514de);});return Promise['all'](_0x4033f9);});}function countFilteredInteractions(_0x3b2e33,_0x10d428){var _0x2837cd=_0x3b2e33[_0x43cd('0x9d')]();_0x2837cd[_0x43cd('0xb')](_0x43cd('0x9e'));_0x2837cd[_0x43cd('0xb')](_0x43cd('0x9f'),_0x43cd('0x3e'));var _0x55182e=utils['getSelectedTags'](_0x10d428);if(!_[_0x43cd('0xa0')](_0x55182e)){_0x2837cd[_0x43cd('0x16')](_0x43cd('0xa1'),_0x55182e);}var _0x38eea7={'type':db[_0x43cd('0x6a')][_0x43cd('0x6b')]['SELECT'],'raw':!![]};return db[_0x43cd('0x6d')][_0x43cd('0x99')](_0x2837cd[_0x43cd('0x6e')](),_0x38eea7);}module[_0x43cd('0xa2')]={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery}; \ No newline at end of file diff --git a/server/components/interaction/update-interaction.js b/server/components/interaction/update-interaction.js index 132c0ca..2fd21c9 100644 --- a/server/components/interaction/update-interaction.js +++ b/server/components/interaction/update-interaction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0702=['Tags','../../mysqldb','map','split','forEach','push','waiting','talking','answered','unmanaged','abandoned','total','closed','disposition','UserId','out','-id','then','lastMsgText','plainBody','catch','updateInteraction','Users','TagIds'];(function(_0x1bc2bd,_0xbe98b6){var _0x55f818=function(_0xdc642){while(--_0xdc642){_0x1bc2bd['push'](_0x1bc2bd['shift']());}};_0x55f818(++_0xbe98b6);}(_0x0702,0x199));var _0x2070=function(_0xc8c728,_0x34a614){_0xc8c728=_0xc8c728-0x0;var _0x221646=_0x0702[_0xc8c728];return _0x221646;};'use strict';var _=require('lodash');var db=require(_0x2070('0x0'))['db'];function getInteractionUsers(_0x450a96,_0x205958){return new Promise(function(_0x1dea24,_0xf1247c){try{var _0x3f0540=[];if(_0x205958[_0x450a96]){_0x3f0540=_0x205958[_0x450a96][_0x2070('0x1')](function(_0x4e078e){return{'id':_0x4e078e['id'],'fullname':_0x4e078e['fullname']};});}return _0x1dea24(_0x3f0540);}catch(_0x2efb41){_0xf1247c(_0x2efb41);}});}function getInteractionTags(_0x59ca9b,_0x26ad08){var _0x767475=[];if(_0x59ca9b){_0x59ca9b[_0x2070('0x2')](',')[_0x2070('0x3')](function(_0x343488){_0x767475[_0x2070('0x4')](_0x26ad08[_0x343488]);});}return _0x767475;}function updateWaitingCounter(_0x2c550b){if(_0x2c550b[_0x2070('0x5')]){_0x2c550b[_0x2070('0x5')]-=0x1;}}function updateInteractionCounters(_0x10668d){_0x10668d[_0x2070('0x5')]=0x0;_0x10668d[_0x2070('0x6')]=0x0;_0x10668d[_0x2070('0x7')]=0x0;_0x10668d[_0x2070('0x8')]=0x0;_0x10668d[_0x2070('0x9')]=0x0;_0x10668d[_0x2070('0xa')]=0x0;if(_0x10668d[_0x2070('0xb')]){if(_0x10668d[_0x2070('0xc')]===_0x2070('0x9')){_0x10668d['abandoned']+=0x1;updateWaitingCounter(_0x10668d);}if(_0x10668d['UserId']){_0x10668d[_0x2070('0x7')]+=0x1;if(_0x10668d[_0x2070('0x6')]){_0x10668d['talking']-=0x1;}}else{if(_0x10668d[_0x2070('0xc')]){_0x10668d[_0x2070('0x8')]+=0x1;updateWaitingCounter(_0x10668d);}}}else{if(!_0x10668d[_0x2070('0xd')]){_0x10668d[_0x2070('0x5')]+=0x1;}if(_0x10668d[_0x2070('0xd')]){_0x10668d[_0x2070('0x6')]+=0x1;updateWaitingCounter(_0x10668d);}}_0x10668d['total']+=0x1;return _0x10668d;}function getLastMessageText(_0x52fd17){return db['MailMessage']['findOne']({'where':{'$and':[{'MailInteractionId':_0x52fd17['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x2070('0xe')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':['plainBody'],'order':_0x2070('0xf'),'raw':!![]})[_0x2070('0x10')](function(_0x15522f){if(_0x15522f&&_0x15522f['plainBody']){_0x52fd17[_0x2070('0x11')]=_['trimStart'](_0x15522f[_0x2070('0x12')]);}return _0x52fd17;})[_0x2070('0x13')](function(_0x1838f5){throw _0x1838f5;});}exports[_0x2070('0x14')]=function(_0x49fe93,_0x345453,_0x1ec732,_0x54811a){return new Promise(function(_0x92e71e,_0x447d25){return getInteractionUsers(_0x49fe93['id'],_0x1ec732)[_0x2070('0x10')](function(_0x2647f5){_0x49fe93[_0x2070('0x15')]=_0x2647f5;return getInteractionTags(_0x49fe93[_0x2070('0x16')],_0x345453);})['then'](function(_0x357761){_0x49fe93[_0x2070('0x17')]=_0x357761;delete _0x49fe93['TagIds'];return updateInteractionCounters(_0x49fe93);})[_0x2070('0x10')](function(_0x412aa2){if(_0x54811a){return getLastMessageText(_0x412aa2);}else{return _0x412aa2;}})['then'](function(_0x198a4f){_0x92e71e(_0x198a4f);})['catch'](function(_0x3f58a8){_0x447d25(_0x3f58a8);});});}; \ No newline at end of file +var _0xe2d8=['plainBody','lastMsgText','trimStart','catch','Users','Tags','TagIds','lodash','../../mysqldb','fullname','split','forEach','push','waiting','talking','unmanaged','abandoned','total','closed','disposition','UserId','answered','MailMessage','findOne','-id','then'];(function(_0x2c59ee,_0x11b976){var _0x50f49d=function(_0x19d49f){while(--_0x19d49f){_0x2c59ee['push'](_0x2c59ee['shift']());}};_0x50f49d(++_0x11b976);}(_0xe2d8,0x18d));var _0x8e2d=function(_0xd809d4,_0x440bcc){_0xd809d4=_0xd809d4-0x0;var _0x49f222=_0xe2d8[_0xd809d4];return _0x49f222;};'use strict';var _=require(_0x8e2d('0x0'));var db=require(_0x8e2d('0x1'))['db'];function getInteractionUsers(_0x2717a1,_0x2f7da9){return new Promise(function(_0x3ebe46,_0x45bfe0){try{var _0x1914e7=[];if(_0x2f7da9[_0x2717a1]){_0x1914e7=_0x2f7da9[_0x2717a1]['map'](function(_0x14b255){return{'id':_0x14b255['id'],'fullname':_0x14b255[_0x8e2d('0x2')]};});}return _0x3ebe46(_0x1914e7);}catch(_0x6eee7d){_0x45bfe0(_0x6eee7d);}});}function getInteractionTags(_0x1fc7f3,_0x15a52f){var _0x3c0f8a=[];if(_0x1fc7f3){_0x1fc7f3[_0x8e2d('0x3')](',')[_0x8e2d('0x4')](function(_0x81f45c){_0x3c0f8a[_0x8e2d('0x5')](_0x15a52f[_0x81f45c]);});}return _0x3c0f8a;}function updateWaitingCounter(_0x17e4d5){if(_0x17e4d5[_0x8e2d('0x6')]){_0x17e4d5['waiting']-=0x1;}}function updateInteractionCounters(_0x2ef635){_0x2ef635[_0x8e2d('0x6')]=0x0;_0x2ef635[_0x8e2d('0x7')]=0x0;_0x2ef635['answered']=0x0;_0x2ef635[_0x8e2d('0x8')]=0x0;_0x2ef635[_0x8e2d('0x9')]=0x0;_0x2ef635[_0x8e2d('0xa')]=0x0;if(_0x2ef635[_0x8e2d('0xb')]){if(_0x2ef635[_0x8e2d('0xc')]===_0x8e2d('0x9')){_0x2ef635['abandoned']+=0x1;updateWaitingCounter(_0x2ef635);}if(_0x2ef635[_0x8e2d('0xd')]){_0x2ef635[_0x8e2d('0xe')]+=0x1;if(_0x2ef635[_0x8e2d('0x7')]){_0x2ef635['talking']-=0x1;}}else{if(_0x2ef635['disposition']){_0x2ef635[_0x8e2d('0x8')]+=0x1;updateWaitingCounter(_0x2ef635);}}}else{if(!_0x2ef635['UserId']){_0x2ef635[_0x8e2d('0x6')]+=0x1;}if(_0x2ef635[_0x8e2d('0xd')]){_0x2ef635['talking']+=0x1;updateWaitingCounter(_0x2ef635);}}_0x2ef635['total']+=0x1;return _0x2ef635;}function getLastMessageText(_0x53f1cd){return db[_0x8e2d('0xf')][_0x8e2d('0x10')]({'where':{'$and':[{'MailInteractionId':_0x53f1cd['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':'out'},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':['plainBody'],'order':_0x8e2d('0x11'),'raw':!![]})[_0x8e2d('0x12')](function(_0x2e0b78){if(_0x2e0b78&&_0x2e0b78[_0x8e2d('0x13')]){_0x53f1cd[_0x8e2d('0x14')]=_[_0x8e2d('0x15')](_0x2e0b78[_0x8e2d('0x13')]);}return _0x53f1cd;})[_0x8e2d('0x16')](function(_0x273c83){throw _0x273c83;});}exports['updateInteraction']=function(_0x5af3fd,_0x4ff962,_0x1e445c,_0x251990){return new Promise(function(_0x35cb4e,_0x2817eb){return getInteractionUsers(_0x5af3fd['id'],_0x1e445c)[_0x8e2d('0x12')](function(_0x18c72e){_0x5af3fd[_0x8e2d('0x17')]=_0x18c72e;return getInteractionTags(_0x5af3fd['TagIds'],_0x4ff962);})[_0x8e2d('0x12')](function(_0x4f1a5e){_0x5af3fd[_0x8e2d('0x18')]=_0x4f1a5e;delete _0x5af3fd[_0x8e2d('0x19')];return updateInteractionCounters(_0x5af3fd);})[_0x8e2d('0x12')](function(_0x2b0a8d){if(_0x251990){return getLastMessageText(_0x2b0a8d);}else{return _0x2b0a8d;}})[_0x8e2d('0x12')](function(_0x7dcb1f){_0x35cb4e(_0x7dcb1f);})['catch'](function(_0x26e8f9){_0x2817eb(_0x26e8f9);});});}; \ No newline at end of file diff --git a/server/components/interaction/utils.js b/server/components/interaction/utils.js index 32c3f4e..3065481 100644 --- a/server/components/interaction/utils.js +++ b/server/components/interaction/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5a32=['chat','accounts','_interaction_has_tags','user_has_','_interactions','isArray','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','role','stringify','null','Interaction','findOne','then','info','error','exports','lodash','../../config/logger','openchannel-interactions','mail-interactions','fax-interactions','sms-interactions','chat-interactions','capitalize','Website','InteractionId','upperFirst','unknown'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5a32,0xec));var _0x25a3=function(_0x15de82,_0x355f97){_0x15de82=_0x15de82-0x0;var _0x527132=_0x5a32[_0x15de82];return _0x527132;};'use strict';var _=require(_0x25a3('0x0'));var db=require('../../mysqldb')['db'];var loggers={'openchannel':require(_0x25a3('0x1'))(_0x25a3('0x2')),'mail':require(_0x25a3('0x1'))(_0x25a3('0x3')),'fax':require('../../config/logger')(_0x25a3('0x4')),'sms':require(_0x25a3('0x1'))(_0x25a3('0x5')),'chat':require(_0x25a3('0x1'))(_0x25a3('0x6')),'whatsapp':require(_0x25a3('0x1'))('whatsapp-interactions')};function getAccountFK(_0x30f630){return _[_0x25a3('0x7')](_0x30f630)+(_0x30f630==='chat'?_0x25a3('0x8'):'Account')+'Id';}function getInteractionFK(_0x3e1ad3){return _['capitalize'](_0x3e1ad3)+_0x25a3('0x9');}function getInteractionId(_0x9c2336,_0x2feb70,_0x260fb7){if(_0x9c2336&&_0x9c2336[_[_0x25a3('0xa')](_0x260fb7)+_0x25a3('0x9')]){return _0x9c2336[_[_0x25a3('0xa')](_0x260fb7)+_0x25a3('0x9')];}else if(_0x9c2336&&_0x9c2336['id']){return _0x9c2336['id'];}else if(_0x2feb70&&_0x2feb70['id']){return _0x2feb70['id'];}else{return _0x25a3('0xb');}}function getInteractionsTables(_0x66886){return{'accounts':_0x66886+'_'+(_0x66886===_0x25a3('0xc')?'websites':_0x25a3('0xd')),'interactions':_0x66886+'_interactions','interactionsTags':_0x66886+_0x25a3('0xe'),'messages':_0x66886+'_messages','userInteractions':_0x25a3('0xf')+_0x66886+_0x25a3('0x10')};}function getSelectedTags(_0x267ee2){var _0x446038=[];if(_0x267ee2){_0x446038=Array[_0x25a3('0x11')](_0x267ee2)?_0x267ee2:[_0x267ee2];}return _0x446038;}function log(_0x209f8b,_0x529e0e,_0x9c9aa2,_0x25dd4a,_0xd1b033,_0x35d5e1){loggers[_0xd1b033[_0x25a3('0x12')]()][_0x209f8b](_0x25a3('0x13'),_0x35d5e1[_0x25a3('0x14')](),_0x529e0e?_0x529e0e['id']:null,_0x529e0e?_0x529e0e[_0x25a3('0x15')]:null,_0x529e0e?_0x529e0e[_0x25a3('0x16')]:null,getInteractionId(_0x9c9aa2,_0x25dd4a,_0xd1b033),_0x9c9aa2?JSON[_0x25a3('0x17')](_0x9c9aa2):_0x25a3('0x18'));}function updateUser(_0x99a2c7,_0x1af681,_0x7616d6,_0x98c688,_0x4343dc){db[_[_0x25a3('0xa')](_0x98c688)+_0x25a3('0x19')][_0x25a3('0x1a')]({'where':{'id':getInteractionId(_0x1af681,_0x7616d6,_0x98c688)}})[_0x25a3('0x1b')](function(_0x10be94){if(_0x10be94){return _0x10be94['update']({'UserId':_0x99a2c7?_0x99a2c7['id']:null});}})[_0x25a3('0x1b')](function(_0x6f0edf){if(_0x6f0edf){log(_0x25a3('0x1c'),_0x99a2c7,_0x1af681,_0x7616d6,_0x98c688,_0x4343dc);}})['catch'](function(){log(_0x25a3('0x1d'),_0x99a2c7,_0x1af681,_0x7616d6,_0x98c688,_0x4343dc);});}module[_0x25a3('0x1e')]={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'updateUser':updateUser}; \ No newline at end of file +var _0xe9a2=['error','lodash','openchannel-interactions','mail-interactions','../../config/logger','sms-interactions','chat-interactions','whatsapp-interactions','capitalize','chat','Website','Account','upperFirst','InteractionId','unknown','websites','_interactions','_interaction_has_tags','_messages','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','role','stringify','null','findOne','then','catch'];(function(_0x17464b,_0x20b1b2){var _0x26870f=function(_0x16317b){while(--_0x16317b){_0x17464b['push'](_0x17464b['shift']());}};_0x26870f(++_0x20b1b2);}(_0xe9a2,0x16d));var _0x2e9a=function(_0x10355c,_0x2fa311){_0x10355c=_0x10355c-0x0;var _0x2f4675=_0xe9a2[_0x10355c];return _0x2f4675;};'use strict';var _=require(_0x2e9a('0x0'));var db=require('../../mysqldb')['db'];var loggers={'openchannel':require('../../config/logger')(_0x2e9a('0x1')),'mail':require('../../config/logger')(_0x2e9a('0x2')),'fax':require(_0x2e9a('0x3'))('fax-interactions'),'sms':require(_0x2e9a('0x3'))(_0x2e9a('0x4')),'chat':require('../../config/logger')(_0x2e9a('0x5')),'whatsapp':require('../../config/logger')(_0x2e9a('0x6'))};function getAccountFK(_0x361ab6){return _[_0x2e9a('0x7')](_0x361ab6)+(_0x361ab6===_0x2e9a('0x8')?_0x2e9a('0x9'):_0x2e9a('0xa'))+'Id';}function getInteractionFK(_0x371b82){return _[_0x2e9a('0x7')](_0x371b82)+'InteractionId';}function getInteractionId(_0x5226a5,_0x8311f3,_0x449295){if(_0x5226a5&&_0x5226a5[_[_0x2e9a('0xb')](_0x449295)+'InteractionId']){return _0x5226a5[_[_0x2e9a('0xb')](_0x449295)+_0x2e9a('0xc')];}else if(_0x5226a5&&_0x5226a5['id']){return _0x5226a5['id'];}else if(_0x8311f3&&_0x8311f3['id']){return _0x8311f3['id'];}else{return _0x2e9a('0xd');}}function getInteractionsTables(_0x11b3b7){return{'accounts':_0x11b3b7+'_'+(_0x11b3b7==='chat'?_0x2e9a('0xe'):'accounts'),'interactions':_0x11b3b7+_0x2e9a('0xf'),'interactionsTags':_0x11b3b7+_0x2e9a('0x10'),'messages':_0x11b3b7+_0x2e9a('0x11'),'userInteractions':'user_has_'+_0x11b3b7+_0x2e9a('0xf')};}function getSelectedTags(_0x2df843){var _0x562d1e=[];if(_0x2df843){_0x562d1e=Array['isArray'](_0x2df843)?_0x2df843:[_0x2df843];}return _0x562d1e;}function log(_0x1ecec4,_0x2bf3e6,_0x6cee02,_0x410c55,_0x3bd81f,_0xd683fb){loggers[_0x3bd81f['toLowerCase']()][_0x1ecec4](_0x2e9a('0x12'),_0xd683fb[_0x2e9a('0x13')](),_0x2bf3e6?_0x2bf3e6['id']:null,_0x2bf3e6?_0x2bf3e6[_0x2e9a('0x14')]:null,_0x2bf3e6?_0x2bf3e6[_0x2e9a('0x15')]:null,getInteractionId(_0x6cee02,_0x410c55,_0x3bd81f),_0x6cee02?JSON[_0x2e9a('0x16')](_0x6cee02):_0x2e9a('0x17'));}function updateUser(_0x9bffc8,_0x381507,_0x3a2aa1,_0x4ef1b1,_0x3dd308){db[_[_0x2e9a('0xb')](_0x4ef1b1)+'Interaction'][_0x2e9a('0x18')]({'where':{'id':getInteractionId(_0x381507,_0x3a2aa1,_0x4ef1b1)}})[_0x2e9a('0x19')](function(_0x76d9c0){if(_0x76d9c0){return _0x76d9c0['update']({'UserId':_0x9bffc8?_0x9bffc8['id']:null});}})[_0x2e9a('0x19')](function(_0x12f164){if(_0x12f164){log('info',_0x9bffc8,_0x381507,_0x3a2aa1,_0x4ef1b1,_0x3dd308);}})[_0x2e9a('0x1a')](function(){log(_0x2e9a('0x1b'),_0x9bffc8,_0x381507,_0x3a2aa1,_0x4ef1b1,_0x3dd308);});}module['exports']={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'updateUser':updateUser}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index 58254bd..ffbe597 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 _0x097e=['../../mysqldb','../../config/environment','data1','license','createDecipher','aes-256-ctr','format','%s:%s:%s','update','base64','utf8','final','parse','hasOwnProperty','use','License','findOne','then','count','status','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','admin','user','isUserLimit','crypto','util','composable-middleware'];(function(_0x4cd90c,_0x4bb9f3){var _0x3ce429=function(_0x32c213){while(--_0x32c213){_0x4cd90c['push'](_0x4cd90c['shift']());}};_0x3ce429(++_0x4bb9f3);}(_0x097e,0x1dd));var _0xe097=function(_0x2dc6d1,_0x5dcfa3){_0x2dc6d1=_0x2dc6d1-0x0;var _0x1811f9=_0x097e[_0x2dc6d1];return _0x1811f9;};'use strict';var crypto=require(_0xe097('0x0'));var util=require(_0xe097('0x1'));var compose=require(_0xe097('0x2'));var db=require(_0xe097('0x3'))['db'];var config=require(_0xe097('0x4'));function getValueFromLicense(_0x5429ee,_0x32f0bd){if(_0x5429ee&&_0x32f0bd){if(_0x32f0bd[_0xe097('0x5')]&&_0x32f0bd['license']){var _0x41afd8=_0x32f0bd['data1'];var _0x8bae32=_0x32f0bd[_0xe097('0x6')];var _0x2b04ce=_0x41afd8['split']('-')[0x4];var _0x260925=_0x41afd8['split']('-')[0x0];var _0x9526bc=crypto[_0xe097('0x7')](_0xe097('0x8'),util[_0xe097('0x9')](_0xe097('0xa'),_0x2b04ce,_0x41afd8,_0x260925));var _0x2b13ec=_0x9526bc[_0xe097('0xb')](_0x8bae32,_0xe097('0xc'),_0xe097('0xd'));_0x2b13ec+=_0x9526bc[_0xe097('0xe')](_0xe097('0xd'));var _0x47d5cd=JSON[_0xe097('0xf')](_0x2b13ec);return _0x47d5cd[_0xe097('0x10')](_0x5429ee)?_0x47d5cd[_0x5429ee]:null;}}return null;}function isLimit(_0x3382ff,_0x291622,_0x223c57,_0x2867f0){var _0x38d9c8=_0x291622;return compose()[_0xe097('0x11')](function(_0x4ded9f,_0x4e1a8a,_0x2f77d3){return db[_0xe097('0x12')][_0xe097('0x13')]({'where':{'id':0x1},'raw':!![]})[_0xe097('0x14')](function(_0x540f00){var _0x392c14=getValueFromLicense(_0x3382ff,_0x540f00);return _0x392c14?_0x392c14:_0x38d9c8;})[_0xe097('0x14')](function(_0x22fe5b){_0x38d9c8=_0x22fe5b;return _0x223c57[_0xe097('0x15')](_0x2867f0);})['then'](function(_0x3e2121){if(_0x3e2121>=_0x38d9c8){return _0x4e1a8a[_0xe097('0x16')](0x193)[_0xe097('0x17')]({'message':util['format'](_0xe097('0x18'),_0x3382ff)});}_0x2f77d3();})[_0xe097('0x19')](function(_0x520000){_0x2f77d3(_0x520000);});});}function isUserLimit(){return isLimit(_0xe097('0x1a'),0x1,db['User'],{'where':{'$or':[{'role':_0xe097('0x1b')},{'role':_0xe097('0x1c')}]}});}exports[_0xe097('0x1d')]=isUserLimit; \ No newline at end of file +var _0xbcf6=['format','%s:%s:%s','update','utf8','parse','hasOwnProperty','use','License','findOne','then','count','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','user','isUserLimit','crypto','util','composable-middleware','../../mysqldb','../../config/environment','data1','license','createDecipher'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xbcf6,0x88));var _0x6bcf=function(_0x4ed786,_0x74f270){_0x4ed786=_0x4ed786-0x0;var _0x2f0243=_0xbcf6[_0x4ed786];return _0x2f0243;};'use strict';var crypto=require(_0x6bcf('0x0'));var util=require(_0x6bcf('0x1'));var compose=require(_0x6bcf('0x2'));var db=require(_0x6bcf('0x3'))['db'];var config=require(_0x6bcf('0x4'));function getValueFromLicense(_0x41c231,_0xb9724f){if(_0x41c231&&_0xb9724f){if(_0xb9724f[_0x6bcf('0x5')]&&_0xb9724f['license']){var _0x46eeb3=_0xb9724f[_0x6bcf('0x5')];var _0x3b74b4=_0xb9724f[_0x6bcf('0x6')];var _0x54c52e=_0x46eeb3['split']('-')[0x4];var _0x466b25=_0x46eeb3['split']('-')[0x0];var _0x9f3da=crypto[_0x6bcf('0x7')]('aes-256-ctr',util[_0x6bcf('0x8')](_0x6bcf('0x9'),_0x54c52e,_0x46eeb3,_0x466b25));var _0x1a1219=_0x9f3da[_0x6bcf('0xa')](_0x3b74b4,'base64',_0x6bcf('0xb'));_0x1a1219+=_0x9f3da['final'](_0x6bcf('0xb'));var _0x430d68=JSON[_0x6bcf('0xc')](_0x1a1219);return _0x430d68[_0x6bcf('0xd')](_0x41c231)?_0x430d68[_0x41c231]:null;}}return null;}function isLimit(_0x1ce552,_0x301eab,_0x3634df,_0x56a8bf){var _0x429fdd=_0x301eab;return compose()[_0x6bcf('0xe')](function(_0x70d650,_0x1e2c81,_0x1b310e){return db[_0x6bcf('0xf')][_0x6bcf('0x10')]({'where':{'id':0x1},'raw':!![]})[_0x6bcf('0x11')](function(_0x3e35cc){var _0x1d5412=getValueFromLicense(_0x1ce552,_0x3e35cc);return _0x1d5412?_0x1d5412:_0x429fdd;})[_0x6bcf('0x11')](function(_0x8fca2f){_0x429fdd=_0x8fca2f;return _0x3634df[_0x6bcf('0x12')](_0x56a8bf);})[_0x6bcf('0x11')](function(_0x2d2cb4){if(_0x2d2cb4>=_0x429fdd){return _0x1e2c81['status'](0x193)[_0x6bcf('0x13')]({'message':util[_0x6bcf('0x8')](_0x6bcf('0x14'),_0x1ce552)});}_0x1b310e();})[_0x6bcf('0x15')](function(_0x7f3d1f){_0x1b310e(_0x7f3d1f);});});}function isUserLimit(){return isLimit('users',0x1,db['User'],{'where':{'$or':[{'role':'admin'},{'role':_0x6bcf('0x16')}]}});}exports[_0x6bcf('0x17')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 111c600..8c25e76 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 _0x4d6d=['filter','indexOf','map','conditions','push','buildExpression','DATE','operator','$between','value','includes','days','format','YYYY-MM-DD','CAST(','field','\x20AS\x20','text','$ne','\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','$notIn','NOT\x20IN\x20?','$eq','<>\x20?','$substring','$startsWith','LIKE\x20?','$lt','<\x20?','>\x20?','$lte','<=\x20?','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','$endsWith','pop','utcOffset','add','hours','minutes','startsWith','[$or]','and','replace','[$and]','split','length','forEach','shift','match'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x4d6d,0x1a6));var _0xd4d6=function(_0x87883d,_0x5aaa87){_0x87883d=_0x87883d-0x0;var _0x271f1b=_0x4d6d[_0x87883d];return _0x271f1b;};'use strict';var _=require('lodash');var moment=require('moment');exports['parseSearch']=function(_0x2fec9c){var _0x199f95={'conditions':[]};_0x199f95['sqlOperator']=_[_0xd4d6('0x0')](_0x2fec9c,_0xd4d6('0x1'))?'or':_0xd4d6('0x2');var _0x4c8040=_0x2fec9c[_0xd4d6('0x3')](_0xd4d6('0x4'),'')[_0xd4d6('0x3')]('[$or]','')[_0xd4d6('0x5')]('||');for(var _0x16eb8d=0x0;_0x16eb8d<_0x4c8040[_0xd4d6('0x6')];_0x16eb8d++){var _0x1bb337=_0x4c8040[_0x16eb8d][_0xd4d6('0x5')](':=');var _0x9fd7b1=_0x1bb337[0x0];var _0x1a7d2f=_0x1bb337['slice'](0x1);_0x1a7d2f[_0xd4d6('0x7')](function(_0x5f4040){var _0x363411=_0x5f4040[_0xd4d6('0x5')]('[')[_0xd4d6('0x8')]();var _0x3f20d8=_0x5f4040[_0xd4d6('0x9')](/\[(.*?)\]/g);_0x3f20d8[_0xd4d6('0x7')](function(_0x24e49f){var _0x4b8b26=_0x24e49f['split']('[')[_0xd4d6('0xa')](function(_0x46c4e0){return _0x46c4e0[_0xd4d6('0xb')](']')>-0x1;})[_0xd4d6('0xc')](function(_0x8fcee3){return _0x8fcee3['split'](']')[0x0];})[0x0];_0x199f95[_0xd4d6('0xd')][_0xd4d6('0xe')]({'field':_0x9fd7b1,'operator':_0x363411,'value':_0x4b8b26});});});}return _0x199f95;};exports[_0xd4d6('0xf')]=function(_0x2f3da4,_0x5c8eba,_0x5ec3e3){var _0x55f1aa={};if(_0x5c8eba===_0xd4d6('0x10')){if(_0x5ec3e3[_0xd4d6('0x11')]==='$eq'){_0x5ec3e3['operator']=_0xd4d6('0x12');_0x5ec3e3[_0xd4d6('0x13')]+=','+_0x5ec3e3[_0xd4d6('0x13')];}else if(_[_0xd4d6('0x14')](['$gt','$lte'],_0x5ec3e3[_0xd4d6('0x11')])){_0x5ec3e3[_0xd4d6('0x13')]=moment(_0x5ec3e3[_0xd4d6('0x13')])['add'](0x1,_0xd4d6('0x15'))[_0xd4d6('0x16')](_0xd4d6('0x17'));}}if(_0x5ec3e3['castTo']){_0x5c8eba=_0x5ec3e3['castTo'];_0x55f1aa['text']=_0xd4d6('0x18')+_0x2f3da4+'.'+_0x5ec3e3[_0xd4d6('0x19')]+_0xd4d6('0x1a')+_0x5ec3e3['castTo']+')\x20'+parseOperator(_0x5ec3e3[_0xd4d6('0x11')]);}else{_0x55f1aa[_0xd4d6('0x1b')]=_0x2f3da4+'.'+_0x5ec3e3[_0xd4d6('0x19')]+'\x20'+parseOperator(_0x5ec3e3[_0xd4d6('0x11')]);}if(_[_0xd4d6('0x14')]([_0xd4d6('0x1c'),'$notIn'],_0x5ec3e3['operator']))_0x55f1aa[_0xd4d6('0x1b')]='('+_0x55f1aa[_0xd4d6('0x1b')]+_0xd4d6('0x1d')+_0x2f3da4+'.'+_0x5ec3e3['field']+_0xd4d6('0x1e');_0x55f1aa[_0xd4d6('0x13')]=parseValue(_0x5c8eba,_0x5ec3e3[_0xd4d6('0x11')],_0x5ec3e3['value']);return _0x55f1aa;};function parseOperator(_0x2c0c0d){var _0x3e26ab;switch(_0x2c0c0d){case _0xd4d6('0x1f'):_0x3e26ab=_0xd4d6('0x20');break;case _0xd4d6('0x21'):_0x3e26ab=_0xd4d6('0x22');break;case _0xd4d6('0x23'):_0x3e26ab='=\x20?';break;case'$ne':_0x3e26ab=_0xd4d6('0x24');break;case _0xd4d6('0x25'):case _0xd4d6('0x26'):case'$endsWith':_0x3e26ab=_0xd4d6('0x27');break;case _0xd4d6('0x28'):_0x3e26ab=_0xd4d6('0x29');break;case'$gt':_0x3e26ab=_0xd4d6('0x2a');break;case _0xd4d6('0x2b'):_0x3e26ab=_0xd4d6('0x2c');break;case'$gte':_0x3e26ab=_0xd4d6('0x2d');break;case _0xd4d6('0x12'):_0x3e26ab=_0xd4d6('0x2e');break;}return _0x3e26ab;}function parseValue(_0x355156,_0x9f28fd,_0x1adf5a){var _0x483c7a={'start':undefined,'end':undefined};switch(_0x9f28fd){case'$in':case _0xd4d6('0x21'):_0x483c7a[_0xd4d6('0x2f')]=_0x1adf5a[_0xd4d6('0x5')](',');break;case _0xd4d6('0x25'):_0x483c7a['start']='%'+_0x1adf5a+'%';break;case _0xd4d6('0x26'):_0x483c7a['start']=_0x1adf5a+'%';break;case _0xd4d6('0x30'):_0x483c7a[_0xd4d6('0x2f')]='%'+_0x1adf5a;break;case'$between':var _0x353e82=_0x1adf5a[_0xd4d6('0x5')](',');var _0x1adf5a=_0x353e82[_0xd4d6('0x8')]();var _0x3b266c=_0x353e82[_0xd4d6('0x31')]();if(_0x355156===_0xd4d6('0x10')){_0x1adf5a=moment(_0x1adf5a)[_0xd4d6('0x32')](0x0,!![])[_0xd4d6('0x16')]();_0x3b266c=moment(_0x3b266c)[_0xd4d6('0x32')](0x0,!![])[_0xd4d6('0x33')](0x17,_0xd4d6('0x34'))[_0xd4d6('0x33')](0x3b,_0xd4d6('0x35'))[_0xd4d6('0x33')](0x3b,'seconds')[_0xd4d6('0x16')]();}_0x483c7a={'start':_0x1adf5a,'end':_0x3b266c};break;default:_0x483c7a[_0xd4d6('0x2f')]=_0x1adf5a;break;}return _0x483c7a;} \ No newline at end of file +var _0x5be0=['$between','value','includes','$gt','$lte','add','days','format','YYYY-MM-DD','castTo','text','CAST(','field','$ne','$notIn','\x20OR\x20','$in','<>\x20?','$startsWith','$lt','<\x20?','>\x20?','$gte','start','$substring','pop','utcOffset','hours','minutes','seconds','lodash','moment','sqlOperator','startsWith','[$or]','and','replace','[$and]','split','length','slice','forEach','shift','match','filter','indexOf','map','conditions','push','DATE','$eq','operator'];(function(_0x5304c4,_0x417b55){var _0x2b446f=function(_0x86331b){while(--_0x86331b){_0x5304c4['push'](_0x5304c4['shift']());}};_0x2b446f(++_0x417b55);}(_0x5be0,0x1f2));var _0x05be=function(_0xfadccd,_0x290136){_0xfadccd=_0xfadccd-0x0;var _0x482ac4=_0x5be0[_0xfadccd];return _0x482ac4;};'use strict';var _=require(_0x05be('0x0'));var moment=require(_0x05be('0x1'));exports['parseSearch']=function(_0x245ca9){var _0x1160ce={'conditions':[]};_0x1160ce[_0x05be('0x2')]=_[_0x05be('0x3')](_0x245ca9,_0x05be('0x4'))?'or':_0x05be('0x5');var _0x3029b3=_0x245ca9[_0x05be('0x6')](_0x05be('0x7'),'')['replace'](_0x05be('0x4'),'')[_0x05be('0x8')]('||');for(var _0x4de35f=0x0;_0x4de35f<_0x3029b3[_0x05be('0x9')];_0x4de35f++){var _0x2d14e0=_0x3029b3[_0x4de35f][_0x05be('0x8')](':=');var _0x53d576=_0x2d14e0[0x0];var _0x459d19=_0x2d14e0[_0x05be('0xa')](0x1);_0x459d19[_0x05be('0xb')](function(_0x4ee8a9){var _0x4ff6ce=_0x4ee8a9[_0x05be('0x8')]('[')[_0x05be('0xc')]();var _0x37728b=_0x4ee8a9[_0x05be('0xd')](/\[(.*?)\]/g);_0x37728b[_0x05be('0xb')](function(_0x35722b){var _0x4aae46=_0x35722b[_0x05be('0x8')]('[')[_0x05be('0xe')](function(_0x439d04){return _0x439d04[_0x05be('0xf')](']')>-0x1;})[_0x05be('0x10')](function(_0x1bb413){return _0x1bb413[_0x05be('0x8')](']')[0x0];})[0x0];_0x1160ce[_0x05be('0x11')][_0x05be('0x12')]({'field':_0x53d576,'operator':_0x4ff6ce,'value':_0x4aae46});});});}return _0x1160ce;};exports['buildExpression']=function(_0x200cf9,_0x2b7549,_0x5e4f46){var _0x3f2ea4={};if(_0x2b7549===_0x05be('0x13')){if(_0x5e4f46['operator']===_0x05be('0x14')){_0x5e4f46[_0x05be('0x15')]=_0x05be('0x16');_0x5e4f46[_0x05be('0x17')]+=','+_0x5e4f46['value'];}else if(_[_0x05be('0x18')]([_0x05be('0x19'),_0x05be('0x1a')],_0x5e4f46[_0x05be('0x15')])){_0x5e4f46[_0x05be('0x17')]=moment(_0x5e4f46[_0x05be('0x17')])[_0x05be('0x1b')](0x1,_0x05be('0x1c'))[_0x05be('0x1d')](_0x05be('0x1e'));}}if(_0x5e4f46[_0x05be('0x1f')]){_0x2b7549=_0x5e4f46['castTo'];_0x3f2ea4[_0x05be('0x20')]=_0x05be('0x21')+_0x200cf9+'.'+_0x5e4f46[_0x05be('0x22')]+'\x20AS\x20'+_0x5e4f46[_0x05be('0x1f')]+')\x20'+parseOperator(_0x5e4f46[_0x05be('0x15')]);}else{_0x3f2ea4[_0x05be('0x20')]=_0x200cf9+'.'+_0x5e4f46[_0x05be('0x22')]+'\x20'+parseOperator(_0x5e4f46[_0x05be('0x15')]);}if(_['includes']([_0x05be('0x23'),_0x05be('0x24')],_0x5e4f46['operator']))_0x3f2ea4[_0x05be('0x20')]='('+_0x3f2ea4[_0x05be('0x20')]+_0x05be('0x25')+_0x200cf9+'.'+_0x5e4f46[_0x05be('0x22')]+'\x20IS\x20NULL)';_0x3f2ea4[_0x05be('0x17')]=parseValue(_0x2b7549,_0x5e4f46[_0x05be('0x15')],_0x5e4f46['value']);return _0x3f2ea4;};function parseOperator(_0x29a188){var _0x3aa3d2;switch(_0x29a188){case _0x05be('0x26'):_0x3aa3d2='IN\x20?';break;case _0x05be('0x24'):_0x3aa3d2='NOT\x20IN\x20?';break;case'$eq':_0x3aa3d2='=\x20?';break;case _0x05be('0x23'):_0x3aa3d2=_0x05be('0x27');break;case'$substring':case _0x05be('0x28'):case'$endsWith':_0x3aa3d2='LIKE\x20?';break;case _0x05be('0x29'):_0x3aa3d2=_0x05be('0x2a');break;case _0x05be('0x19'):_0x3aa3d2=_0x05be('0x2b');break;case _0x05be('0x1a'):_0x3aa3d2='<=\x20?';break;case _0x05be('0x2c'):_0x3aa3d2='>=\x20?';break;case _0x05be('0x16'):_0x3aa3d2='BETWEEN\x20?\x20AND\x20?';break;}return _0x3aa3d2;}function parseValue(_0x239d12,_0x37c488,_0x475ace){var _0x4c7785={'start':undefined,'end':undefined};switch(_0x37c488){case _0x05be('0x26'):case _0x05be('0x24'):_0x4c7785[_0x05be('0x2d')]=_0x475ace['split'](',');break;case _0x05be('0x2e'):_0x4c7785[_0x05be('0x2d')]='%'+_0x475ace+'%';break;case _0x05be('0x28'):_0x4c7785[_0x05be('0x2d')]=_0x475ace+'%';break;case'$endsWith':_0x4c7785[_0x05be('0x2d')]='%'+_0x475ace;break;case'$between':var _0x50bda7=_0x475ace[_0x05be('0x8')](',');var _0x475ace=_0x50bda7['shift']();var _0x454fad=_0x50bda7[_0x05be('0x2f')]();if(_0x239d12==='DATE'){_0x475ace=moment(_0x475ace)[_0x05be('0x30')](0x0,!![])['format']();_0x454fad=moment(_0x454fad)[_0x05be('0x30')](0x0,!![])[_0x05be('0x1b')](0x17,_0x05be('0x31'))[_0x05be('0x1b')](0x3b,_0x05be('0x32'))[_0x05be('0x1b')](0x3b,_0x05be('0x33'))[_0x05be('0x1d')]();}_0x4c7785={'start':_0x475ace,'end':_0x454fad};break;default:_0x4c7785['start']=_0x475ace;break;}return _0x4c7785;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 30fe2c0..789e45b 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 _0xb66c=['unsigned','ASC','omit','length','isObject','isString','unset','isNumeric','match','^[+]?[0-9]*$','isEmail','getFullTextValue','\x22{EXPR}\x22','{EXPR}','replace','push','getOptions','query','$id','name','intersection','attributes','hasOwnProperty','nolimit','limit','order','sort','where','filter','object','columns','value','merge','VIRTUAL','col','lower','options','include','lodash','moment','keys','includes','parse','model','alias','fields','raw','split','filters','isEmpty','forOwn','find','type','isPlainObject','$gte','utc','format','$lte','subtract','uniqueid','isArray','offset','map','indexOf','priority','cast','DESC'];(function(_0x318fe8,_0x503fd1){var _0x453aee=function(_0x4f3862){while(--_0x4f3862){_0x318fe8['push'](_0x318fe8['shift']());}};_0x453aee(++_0x503fd1);}(_0xb66c,0x175));var _0xcb66=function(_0x1ba341,_0x54f621){_0x1ba341=_0x1ba341-0x0;var _0x56ad90=_0xb66c[_0x1ba341];return _0x56ad90;};'use strict';var _=require(_0xcb66('0x0'));var sequelize=require('sequelize');var moment=require(_0xcb66('0x1'));var db=require('../../mysqldb')['db'];var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x2afcb8){var _0x24ea13=['ne'];try{var _0xf7ccc5=JSON['parse'](_0x2afcb8);var _0x35d439=Object[_0xcb66('0x2')](_0xf7ccc5)[0x0];return _0x24ea13[_0xcb66('0x3')](_0x35d439);}catch(_0x21be55){return![];}}function getOperatorValue(_0x5d766d){var _0x518163=JSON[_0xcb66('0x4')](_0x5d766d);var _0x1b6852=Object[_0xcb66('0x2')](_0x518163)[0x0];var _0x439f3d=_0x518163[_0x1b6852];return{['$'+_0x1b6852]:_0x439f3d};}function parseIncludeModel(_0xf7bc39){var _0x58582b=JSON[_0xcb66('0x4')](_0xf7bc39);return{'model':db[_0x58582b[_0xcb66('0x5')]],'as':_0x58582b[_0xcb66('0x6')],'attributes':_0x58582b[_0xcb66('0x7')],'raw':_0x58582b[_0xcb66('0x8')]};}exports['fields']=function(_0x393bde){var _0x2b32ec=null;if(_0x393bde){_0x2b32ec=_0x393bde[_0xcb66('0x9')](',');}return _0x2b32ec;};exports[_0xcb66('0xa')]=function(_0x4841e4,_0x9eda68){var _0x3471f3={};if(!_[_0xcb66('0xb')](_0x4841e4)){_[_0xcb66('0xc')](_0x4841e4,function(_0x582523,_0x4079ae){try{if(_0x9eda68){var _0x40c810=_[_0xcb66('0xd')](_0x9eda68,{'name':_0x4079ae})||{};if(hasSequelizeOperator(_0x582523)){_0x3471f3[_0x4079ae]=getOperatorValue(_0x582523);}else if(_0x40c810[_0xcb66('0xe')]==='DATE'&&_[_0xcb66('0xf')](_0x582523)){var _0x540e7e=JSON[_0xcb66('0x4')](_0x582523);var _0x52b058={'$gte':moment(moment(_0x540e7e[_0xcb66('0x10')])['format']('YYYY-MM-DD'))[_0xcb66('0x11')]()[_0xcb66('0x12')](),'$lte':moment(moment(_0x540e7e[_0xcb66('0x13')])[_0xcb66('0x12')]('YYYY-MM-DD'))[_0xcb66('0x11')]()[_0xcb66('0x14')](0x1,'s')[_0xcb66('0x12')]()};_0x3471f3[_0x4079ae]=_0x52b058;}else if(_0x40c810['name']===_0xcb66('0x15')){_0x3471f3[_0x4079ae]=_0x582523;}else{_0x3471f3[_0x4079ae]=_['isArray'](_0x582523)?_0x582523:JSON[_0xcb66('0x4')](_0x582523);}}else{_0x3471f3[_0x4079ae]=_[_0xcb66('0x16')](_0x582523)?_0x582523:JSON[_0xcb66('0x4')](_0x582523);}}catch(_0x1ccb71){_0x3471f3[_0x4079ae]=_0x582523['split'](',');}});}return _0x3471f3;};exports['limit']=function(_0x4d9690){_0x4d9690=parseInt(_0x4d9690,0xa);if(!_0x4d9690||_0x4d9690<0x0){_0x4d9690=LIMIT_VALUE;}return _0x4d9690;};exports[_0xcb66('0x17')]=function(_0x4b13d4){_0x4b13d4=parseInt(_0x4b13d4,0xa);if(!_0x4b13d4||_0x4b13d4<0x0){_0x4b13d4=0x0;}return _0x4b13d4;};exports['sort']=function(_0x419540){var _0x507d5a,_0x1c1219=null;if(_0x419540){_0x507d5a=_0x419540[_0xcb66('0x9')](',');_0x1c1219=_[_0xcb66('0x18')](_0x507d5a,function(_0x433909){if(_0x433909[_0xcb66('0x19')]('-')===0x0){return[_0x433909===_0xcb66('0x1a')?sequelize[_0xcb66('0x1b')](sequelize['col'](_0xcb66('0x1a')),'unsigned'):_0x433909['substr'](0x1),_0xcb66('0x1c')];}else{return[_0x433909===_0xcb66('0x1a')?sequelize[_0xcb66('0x1b')](sequelize['col'](_0xcb66('0x1a')),_0xcb66('0x1d')):_0x433909,_0xcb66('0x1e')];}});}return _0x1c1219;};exports[_0xcb66('0x1f')]=function(_0x5affdb,_0x6661c4){if(_[_0xcb66('0xb')](_0x5affdb)){return _0x5affdb;}if(_[_0xcb66('0x16')](_0x5affdb)){for(var _0x293711=0x0;_0x293711<_0x5affdb[_0xcb66('0x20')];_0x293711+=0x1){_0x5affdb[_0x293711]=this[_0xcb66('0x1f')](_0x5affdb[_0x293711],_0x6661c4);}return _0x5affdb;}if(!_[_0xcb66('0x21')](_0x5affdb)){return _0x5affdb;}if(_[_0xcb66('0x22')](_0x6661c4)){_0x6661c4=[_0x6661c4];}if(!_[_0xcb66('0x16')](_0x6661c4)){return _0x5affdb;}for(var _0x178a06=0x0;_0x178a06<_0x6661c4['length'];_0x178a06+=0x1){_[_0xcb66('0x23')](_0x5affdb,_0x6661c4[_0x178a06]);}for(var _0x5b7cf2 in _0x5affdb){if(_0x5affdb['hasOwnProperty'](_0x5b7cf2)){_0x5affdb[_0x5b7cf2]=this['omit'](_0x5affdb[_0x5b7cf2],_0x6661c4);}}return _0x5affdb;};exports[_0xcb66('0x24')]=function(_0x4ca8b4){return _0x4ca8b4[_0xcb66('0x25')](RegExp(_0xcb66('0x26')))?!![]:![];};exports[_0xcb66('0x27')]=function(_0x5d3fb5){return _0x5d3fb5[_0xcb66('0x25')](/^\S+@\S+$/)?!![]:![];};exports[_0xcb66('0x28')]=function(_0x266862,_0x311ede){var _0xa411e3=[];var _0x375636=/[ `!@#$%^&*()_\-?~]/;var _0x2a5e56=_0x311ede?_0xcb66('0x29'):_0xcb66('0x2a');_0x266862[_0xcb66('0x9')](/[ ,]+/)['forEach'](function(_0x4529e8){_0x4529e8=_0x4529e8[_0xcb66('0x2b')](/([^:]")"+/g,'$1');_0x4529e8='+'+_0x4529e8+'*';var _0xeba0d1=_0x4529e8[_0xcb66('0x25')](_0x375636);if(_0xeba0d1){_0x4529e8='\x22'+_0x4529e8+'\x22';}_0xa411e3[_0xcb66('0x2c')](_0x4529e8);});_0x2a5e56=_0x2a5e56[_0xcb66('0x2b')](_0xcb66('0x2a'),_0xa411e3['join']('\x20'));return _0x2a5e56;};exports[_0xcb66('0x2d')]=function(_0x331305,_0x216072,_0x37f522){var _0x4c97b4={},_0x1a9545={};if(_0x216072[_0xcb66('0x2e')][_0xcb66('0x2f')]){_0x216072[_0xcb66('0x2e')]['id']=_0x216072[_0xcb66('0x2e')][_0xcb66('0x2f')];delete _0x216072[_0xcb66('0x2e')][_0xcb66('0x2f')];}_0x4c97b4[_0xcb66('0x5')]=_[_0xcb66('0x18')](_0x331305,_0xcb66('0x30'));_0x4c97b4[_0xcb66('0x2e')]=_['keys'](_0x216072['query']);_0x4c97b4['filters']=_[_0xcb66('0x31')](_0x4c97b4[_0xcb66('0x5')],_0x4c97b4[_0xcb66('0x2e')]);_0x1a9545[_0xcb66('0x32')]=_[_0xcb66('0x31')](_0x4c97b4[_0xcb66('0x5')],this['fields'](_0x216072[_0xcb66('0x2e')]['fields']));_0x1a9545['attributes']=_0x1a9545['attributes'][_0xcb66('0x20')]?_0x1a9545[_0xcb66('0x32')]:_0x4c97b4[_0xcb66('0x5')];if(!_0x216072[_0xcb66('0x2e')][_0xcb66('0x33')](_0xcb66('0x34'))){_0x1a9545[_0xcb66('0x35')]=this[_0xcb66('0x35')](_0x216072[_0xcb66('0x2e')]['limit']);_0x1a9545[_0xcb66('0x17')]=this[_0xcb66('0x17')](_0x216072[_0xcb66('0x2e')]['offset']);}_0x1a9545[_0xcb66('0x36')]=this[_0xcb66('0x37')](_0x216072['query']['sort']);_0x1a9545[_0xcb66('0x38')]=this['filters'](_['pick'](_0x216072[_0xcb66('0x2e')],_0x4c97b4[_0xcb66('0xa')]),_0x331305);if(_0x216072[_0xcb66('0x2e')][_0xcb66('0x39')]){var _0x99229=_0x331305;var _0x235862=_0x216072[_0xcb66('0x2e')][_0xcb66('0x39')];if(typeof _0x235862===_0xcb66('0x3a')){_0x99229=_['filter'](_0x331305,function(_0x5ac7a6){return _['includes'](_0x235862[_0xcb66('0x3b')],_0x5ac7a6['name']);});_0x235862=_0x235862[_0xcb66('0x3c')];}_0x1a9545['where']=_[_0xcb66('0x3d')](_0x1a9545[_0xcb66('0x38')],{'$or':_[_0xcb66('0x18')](_0x99229,function(_0x11c2f3){if(_0x11c2f3[_0xcb66('0xe')]!==_0xcb66('0x3e')){if(_0x37f522){return sequelize['where'](sequelize['fn']('lower',sequelize[_0xcb66('0x3f')](_0x11c2f3[_0xcb66('0x30')])),{'$like':sequelize['fn'](_0xcb66('0x40'),'%'+_0x216072[_0xcb66('0x2e')][_0xcb66('0x39')]+'%')});}else{var _0x1c149b={};_0x1c149b[_0x11c2f3[_0xcb66('0x30')]]={'$like':'%'+_0x216072[_0xcb66('0x2e')][_0xcb66('0x39')]+'%'};return _0x1c149b;}}})});}_0x1a9545=_['merge']({},_0x1a9545,_0x216072[_0xcb66('0x41')]);return _0x1a9545;};exports[_0xcb66('0x42')]=function(_0x4370ff){var _0x346379=[];if(_0x4370ff['includeAll']){_0x346379[_0xcb66('0x2c')]({'all':!![]});}else if(_0x4370ff[_0xcb66('0x42')]){if(Array[_0xcb66('0x16')](_0x4370ff['include'])){_0x346379=Object[_0xcb66('0x2')](_0x4370ff[_0xcb66('0x42')])[_0xcb66('0x18')](function(_0x3a8192){return parseIncludeModel(_0x4370ff['include'][_0x3a8192]);});}else{var _0x43e0e0=parseIncludeModel(_0x4370ff[_0xcb66('0x42')]);_0x346379[_0xcb66('0x2c')](_0x43e0e0);}}return _0x346379;}; \ No newline at end of file +var _0x12af=['lodash','sequelize','moment','../../mysqldb','parse','keys','model','alias','fields','raw','split','isEmpty','forOwn','type','DATE','format','YYYY-MM-DD','$lte','utc','subtract','isArray','limit','offset','sort','map','priority','col','unsigned','substr','DESC','cast','ASC','omit','length','isObject','isString','unset','hasOwnProperty','match','^[+]?[0-9]*$','isEmail','getFullTextValue','\x22{EXPR}\x22','{EXPR}','forEach','replace','push','query','$id','name','filters','intersection','attributes','nolimit','order','where','filter','object','includes','columns','value','merge','VIRTUAL','lower','include','includeAll'];(function(_0x2d18f3,_0x206e86){var _0x3138af=function(_0x2f4ea2){while(--_0x2f4ea2){_0x2d18f3['push'](_0x2d18f3['shift']());}};_0x3138af(++_0x206e86);}(_0x12af,0x84));var _0xf12a=function(_0x56f927,_0x301301){_0x56f927=_0x56f927-0x0;var _0x1b23f2=_0x12af[_0x56f927];return _0x1b23f2;};'use strict';var _=require(_0xf12a('0x0'));var sequelize=require(_0xf12a('0x1'));var moment=require(_0xf12a('0x2'));var db=require(_0xf12a('0x3'))['db'];var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x2ae1c5){var _0x2e57f0=['ne'];try{var _0x17dde3=JSON[_0xf12a('0x4')](_0x2ae1c5);var _0x3acec1=Object['keys'](_0x17dde3)[0x0];return _0x2e57f0['includes'](_0x3acec1);}catch(_0x1e4eed){return![];}}function getOperatorValue(_0x52084a){var _0xdf6545=JSON[_0xf12a('0x4')](_0x52084a);var _0x33109b=Object[_0xf12a('0x5')](_0xdf6545)[0x0];var _0x5424b1=_0xdf6545[_0x33109b];return{['$'+_0x33109b]:_0x5424b1};}function parseIncludeModel(_0x1dad9d){var _0x293855=JSON['parse'](_0x1dad9d);return{'model':db[_0x293855[_0xf12a('0x6')]],'as':_0x293855[_0xf12a('0x7')],'attributes':_0x293855[_0xf12a('0x8')],'raw':_0x293855[_0xf12a('0x9')]};}exports[_0xf12a('0x8')]=function(_0x1516bc){var _0x3c8dc2=null;if(_0x1516bc){_0x3c8dc2=_0x1516bc[_0xf12a('0xa')](',');}return _0x3c8dc2;};exports['filters']=function(_0x5a661c,_0x23e1d1){var _0x3852b8={};if(!_[_0xf12a('0xb')](_0x5a661c)){_[_0xf12a('0xc')](_0x5a661c,function(_0x2e9049,_0xdaab39){try{if(_0x23e1d1){var _0x543ee5=_['find'](_0x23e1d1,{'name':_0xdaab39})||{};if(hasSequelizeOperator(_0x2e9049)){_0x3852b8[_0xdaab39]=getOperatorValue(_0x2e9049);}else if(_0x543ee5[_0xf12a('0xd')]===_0xf12a('0xe')&&_['isPlainObject'](_0x2e9049)){var _0x4b777d=JSON['parse'](_0x2e9049);var _0x44ef7f={'$gte':moment(moment(_0x4b777d['$gte'])[_0xf12a('0xf')](_0xf12a('0x10')))['utc']()[_0xf12a('0xf')](),'$lte':moment(moment(_0x4b777d[_0xf12a('0x11')])[_0xf12a('0xf')](_0xf12a('0x10')))[_0xf12a('0x12')]()[_0xf12a('0x13')](0x1,'s')['format']()};_0x3852b8[_0xdaab39]=_0x44ef7f;}else if(_0x543ee5['name']==='uniqueid'){_0x3852b8[_0xdaab39]=_0x2e9049;}else{_0x3852b8[_0xdaab39]=_[_0xf12a('0x14')](_0x2e9049)?_0x2e9049:JSON[_0xf12a('0x4')](_0x2e9049);}}else{_0x3852b8[_0xdaab39]=_['isArray'](_0x2e9049)?_0x2e9049:JSON[_0xf12a('0x4')](_0x2e9049);}}catch(_0x216f18){_0x3852b8[_0xdaab39]=_0x2e9049[_0xf12a('0xa')](',');}});}return _0x3852b8;};exports[_0xf12a('0x15')]=function(_0x32ef9a){_0x32ef9a=parseInt(_0x32ef9a,0xa);if(!_0x32ef9a||_0x32ef9a<0x0){_0x32ef9a=LIMIT_VALUE;}return _0x32ef9a;};exports[_0xf12a('0x16')]=function(_0x4cbcdc){_0x4cbcdc=parseInt(_0x4cbcdc,0xa);if(!_0x4cbcdc||_0x4cbcdc<0x0){_0x4cbcdc=0x0;}return _0x4cbcdc;};exports[_0xf12a('0x17')]=function(_0x10a6b2){var _0x2fb90e,_0x3e9efd=null;if(_0x10a6b2){_0x2fb90e=_0x10a6b2[_0xf12a('0xa')](',');_0x3e9efd=_[_0xf12a('0x18')](_0x2fb90e,function(_0x518d6d){if(_0x518d6d['indexOf']('-')===0x0){return[_0x518d6d===_0xf12a('0x19')?sequelize['cast'](sequelize[_0xf12a('0x1a')](_0xf12a('0x19')),_0xf12a('0x1b')):_0x518d6d[_0xf12a('0x1c')](0x1),_0xf12a('0x1d')];}else{return[_0x518d6d===_0xf12a('0x19')?sequelize[_0xf12a('0x1e')](sequelize[_0xf12a('0x1a')](_0xf12a('0x19')),_0xf12a('0x1b')):_0x518d6d,_0xf12a('0x1f')];}});}return _0x3e9efd;};exports[_0xf12a('0x20')]=function(_0x5f93c4,_0x7490f5){if(_[_0xf12a('0xb')](_0x5f93c4)){return _0x5f93c4;}if(_[_0xf12a('0x14')](_0x5f93c4)){for(var _0x36382d=0x0;_0x36382d<_0x5f93c4[_0xf12a('0x21')];_0x36382d+=0x1){_0x5f93c4[_0x36382d]=this[_0xf12a('0x20')](_0x5f93c4[_0x36382d],_0x7490f5);}return _0x5f93c4;}if(!_[_0xf12a('0x22')](_0x5f93c4)){return _0x5f93c4;}if(_[_0xf12a('0x23')](_0x7490f5)){_0x7490f5=[_0x7490f5];}if(!_[_0xf12a('0x14')](_0x7490f5)){return _0x5f93c4;}for(var _0x466055=0x0;_0x466055<_0x7490f5[_0xf12a('0x21')];_0x466055+=0x1){_[_0xf12a('0x24')](_0x5f93c4,_0x7490f5[_0x466055]);}for(var _0x10efa2 in _0x5f93c4){if(_0x5f93c4[_0xf12a('0x25')](_0x10efa2)){_0x5f93c4[_0x10efa2]=this[_0xf12a('0x20')](_0x5f93c4[_0x10efa2],_0x7490f5);}}return _0x5f93c4;};exports['isNumeric']=function(_0x19c37a){return _0x19c37a[_0xf12a('0x26')](RegExp(_0xf12a('0x27')))?!![]:![];};exports[_0xf12a('0x28')]=function(_0x44594a){return _0x44594a[_0xf12a('0x26')](/^\S+@\S+$/)?!![]:![];};exports[_0xf12a('0x29')]=function(_0x5132ec,_0x4005ed){var _0x354cc7=[];var _0x9c9fd=/[ `!@#$%^&*()_\-?~]/;var _0x160840=_0x4005ed?_0xf12a('0x2a'):_0xf12a('0x2b');_0x5132ec['split'](/[ ,]+/)[_0xf12a('0x2c')](function(_0x538d2b){_0x538d2b=_0x538d2b[_0xf12a('0x2d')](/([^:]")"+/g,'$1');_0x538d2b='+'+_0x538d2b+'*';var _0x21f987=_0x538d2b[_0xf12a('0x26')](_0x9c9fd);if(_0x21f987){_0x538d2b='\x22'+_0x538d2b+'\x22';}_0x354cc7[_0xf12a('0x2e')](_0x538d2b);});_0x160840=_0x160840['replace']('{EXPR}',_0x354cc7['join']('\x20'));return _0x160840;};exports['getOptions']=function(_0x2623c4,_0x33cb44,_0x19c883){var _0x203925={},_0x36f224={};if(_0x33cb44[_0xf12a('0x2f')][_0xf12a('0x30')]){_0x33cb44['query']['id']=_0x33cb44[_0xf12a('0x2f')][_0xf12a('0x30')];delete _0x33cb44['query'][_0xf12a('0x30')];}_0x203925[_0xf12a('0x6')]=_['map'](_0x2623c4,_0xf12a('0x31'));_0x203925['query']=_[_0xf12a('0x5')](_0x33cb44['query']);_0x203925[_0xf12a('0x32')]=_[_0xf12a('0x33')](_0x203925[_0xf12a('0x6')],_0x203925['query']);_0x36f224[_0xf12a('0x34')]=_['intersection'](_0x203925['model'],this[_0xf12a('0x8')](_0x33cb44[_0xf12a('0x2f')][_0xf12a('0x8')]));_0x36f224['attributes']=_0x36f224[_0xf12a('0x34')][_0xf12a('0x21')]?_0x36f224['attributes']:_0x203925[_0xf12a('0x6')];if(!_0x33cb44[_0xf12a('0x2f')][_0xf12a('0x25')](_0xf12a('0x35'))){_0x36f224[_0xf12a('0x15')]=this['limit'](_0x33cb44[_0xf12a('0x2f')][_0xf12a('0x15')]);_0x36f224[_0xf12a('0x16')]=this[_0xf12a('0x16')](_0x33cb44[_0xf12a('0x2f')][_0xf12a('0x16')]);}_0x36f224[_0xf12a('0x36')]=this[_0xf12a('0x17')](_0x33cb44[_0xf12a('0x2f')]['sort']);_0x36f224[_0xf12a('0x37')]=this['filters'](_['pick'](_0x33cb44[_0xf12a('0x2f')],_0x203925[_0xf12a('0x32')]),_0x2623c4);if(_0x33cb44[_0xf12a('0x2f')]['filter']){var _0xa1af02=_0x2623c4;var _0x18b1a1=_0x33cb44[_0xf12a('0x2f')][_0xf12a('0x38')];if(typeof _0x18b1a1===_0xf12a('0x39')){_0xa1af02=_[_0xf12a('0x38')](_0x2623c4,function(_0x37f4e3){return _[_0xf12a('0x3a')](_0x18b1a1[_0xf12a('0x3b')],_0x37f4e3[_0xf12a('0x31')]);});_0x18b1a1=_0x18b1a1[_0xf12a('0x3c')];}_0x36f224['where']=_[_0xf12a('0x3d')](_0x36f224[_0xf12a('0x37')],{'$or':_['map'](_0xa1af02,function(_0x1efd29){if(_0x1efd29[_0xf12a('0xd')]!==_0xf12a('0x3e')){if(_0x19c883){return sequelize[_0xf12a('0x37')](sequelize['fn']('lower',sequelize['col'](_0x1efd29[_0xf12a('0x31')])),{'$like':sequelize['fn'](_0xf12a('0x3f'),'%'+_0x33cb44[_0xf12a('0x2f')][_0xf12a('0x38')]+'%')});}else{var _0x407043={};_0x407043[_0x1efd29[_0xf12a('0x31')]]={'$like':'%'+_0x33cb44['query']['filter']+'%'};return _0x407043;}}})});}_0x36f224=_[_0xf12a('0x3d')]({},_0x36f224,_0x33cb44['options']);return _0x36f224;};exports[_0xf12a('0x40')]=function(_0x290072){var _0x3062d6=[];if(_0x290072[_0xf12a('0x41')]){_0x3062d6[_0xf12a('0x2e')]({'all':!![]});}else if(_0x290072['include']){if(Array[_0xf12a('0x14')](_0x290072[_0xf12a('0x40')])){_0x3062d6=Object[_0xf12a('0x5')](_0x290072[_0xf12a('0x40')])[_0xf12a('0x18')](function(_0x13f730){return parseIncludeModel(_0x290072['include'][_0x13f730]);});}else{var _0x3d0302=parseIncludeModel(_0x290072[_0xf12a('0x40')]);_0x3062d6[_0xf12a('0x2e')](_0x3d0302);}}return _0x3062d6;}; \ No newline at end of file diff --git a/server/components/realtime/agents.js b/server/components/realtime/agents.js index b5fdef8..eb3b43c 100644 --- a/server/components/realtime/agents.js +++ b/server/components/realtime/agents.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaa64=['ASC','getUpdatedSortOptions','fullname,internal','internal','substring','indexOf','validateSortParameter','sort','toLowerCase','sortAgentsByStatus','userpic','lastPauseAt','address','chatCapacity','openchannelCapacity','mailCapacity','smsCapacity','whatsappCapacity','faxCapacity','mailCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','mailStatus','smsStatus','chatStatusTime','openchannelStatusTime','mailStatusTime','whatsappStatusTime','faxStatusTime','queue','screenrecording','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','online','omit','filterAgentAttributes','name','role','voiceStatusTime','chatCurrentCapacity','faxCurrentCapacity','openchannelCurrentCapacity','onhold','lodash','jayson/promise','client','http','chatPause','faxPause','mailPause','openchannelPause','smsPause','voicePause','filter','length','idle','unknown','unavailable','isNil','voiceStatus','pause','every','chatStatus','faxStatus','openchannelStatus','whatsappStatus','request','Agents','then','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','result','merge','catch','getRealtimeAgents','*pause','busy','getAgentStatus','isArray','startCase','Queue','findOne','getAgents','all','map','uniq','value','getAgentIdsByQueues','includes','getAgentIdsByStatus','resolve','User','fullname','whatsappPause','pauseType','find','globalStatus','getSortedAgentsIdsByStatus','fields','order','DESC'];(function(_0x3bc7bd,_0x1e7bbc){var _0x2f3d89=function(_0x516f01){while(--_0x516f01){_0x3bc7bd['push'](_0x3bc7bd['shift']());}};_0x2f3d89(++_0x1e7bbc);}(_0xaa64,0xf7));var _0x4aa6=function(_0x46bdee,_0x3c3738){_0x46bdee=_0x46bdee-0x0;var _0x5a3fae=_0xaa64[_0x46bdee];return _0x5a3fae;};'use strict';var _=require(_0x4aa6('0x0'));var jayson=require(_0x4aa6('0x1'));var db=require('../../mysqldb')['db'];var amiClient=jayson[_0x4aa6('0x2')]['http']({'port':0x232a});var routingClient=jayson[_0x4aa6('0x2')][_0x4aa6('0x3')]({'port':0x232c});function isAgentPaused(_0x5277d1,_0x5797c8){var _0x17dfbb=[_0x5277d1[_0x4aa6('0x4')],_0x5277d1[_0x4aa6('0x5')],_0x5277d1[_0x4aa6('0x6')],_0x5277d1[_0x4aa6('0x7')],_0x5277d1[_0x4aa6('0x8')],_0x5277d1[_0x4aa6('0x9')],_0x5277d1['whatsappPause']];if(!_0x5797c8)return _['every'](_0x17dfbb);var _0xee21ba=_[_0x4aa6('0xa')](_0x17dfbb);return _0xee21ba['length']>0x0&&_0xee21ba[_0x4aa6('0xb')]<_0x17dfbb['length']?!![]:![];}function isIdle(_0x1df231){return _0x1df231===_0x4aa6('0xc')||_0x1df231===_0x4aa6('0xd')||_0x1df231===_0x4aa6('0xe')||_0x1df231==='ringing'||_[_0x4aa6('0xf')](_0x1df231);}function isAgentIdle(_0x1d23d2){if(_0x1d23d2[_0x4aa6('0x10')]!==_0x4aa6('0xc')&&_0x1d23d2[_0x4aa6('0x9')]){_0x1d23d2[_0x4aa6('0x10')]=_0x4aa6('0x11');return![];}return _[_0x4aa6('0x12')]([_0x1d23d2[_0x4aa6('0x13')],_0x1d23d2[_0x4aa6('0x14')],_0x1d23d2['mailStatus'],_0x1d23d2[_0x4aa6('0x15')],_0x1d23d2['smsStatus'],_0x1d23d2['voiceStatus'],_0x1d23d2[_0x4aa6('0x16')]],isIdle);}function getRealtimeAgents(){return amiClient[_0x4aa6('0x17')](_0x4aa6('0x18'),{})[_0x4aa6('0x19')](function(_0x375c09){if(_0x375c09[_0x4aa6('0x1a')]){throw new Error(_0x4aa6('0x1b'));}var _0x2c5c66=_0x375c09['result'];return routingClient[_0x4aa6('0x17')]('Agents',{})[_0x4aa6('0x19')](function(_0x5c6d3c){if(_0x5c6d3c['error']){throw new Error(_0x4aa6('0x1c'));}var _0x15f5e6=_0x5c6d3c[_0x4aa6('0x1d')];return _[_0x4aa6('0x1e')]({},_0x2c5c66,_0x15f5e6);});})[_0x4aa6('0x1f')](function(_0x1dfd4e){throw _0x1dfd4e;});}exports[_0x4aa6('0x20')]=getRealtimeAgents;function getAgentStatus(_0x10a2e7){var _0x15365e='unknown';if(isAgentPaused(_0x10a2e7))_0x15365e=_0x4aa6('0x11');else if(isAgentPaused(_0x10a2e7,!![]))_0x15365e=_0x4aa6('0x21');else if(isAgentIdle(_0x10a2e7))_0x15365e=_0x4aa6('0xc');else _0x15365e=_0x4aa6('0x22');return _0x15365e;}exports[_0x4aa6('0x23')]=getAgentStatus;function getAgentIdsByQueues(_0x1e121f,_0x594665){var _0xa0f5be=_[_0x4aa6('0x24')](_0x1e121f)?_0x1e121f:[_0x1e121f];var _0x3802d8=_[_0x4aa6('0x25')](_0x594665)+_0x4aa6('0x26');var _0x44d151=_['map'](_0xa0f5be,function(_0x2f4943){return db[_0x3802d8][_0x4aa6('0x27')]({'where':{'id':_0x2f4943}})['then'](function(_0x5947c4){if(!_0x5947c4)return[];return _0x5947c4[_0x4aa6('0x28')]({'attributes':['id'],'raw':!![]});});});return Promise[_0x4aa6('0x29')](_0x44d151)[_0x4aa6('0x19')](function(_0x3425df){var _0x2001ce=_(_0x3425df)['flatten']()[_0x4aa6('0x2a')]('id')[_0x4aa6('0x2b')]()[_0x4aa6('0x2c')]();return _0x2001ce;});}exports[_0x4aa6('0x2d')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x45a9e3,_0x256342,_0x57a3cc){try{if(_0x256342[_0x4aa6('0xb')]>0x0){_0x45a9e3=_0x45a9e3[_0x4aa6('0xa')](function(_0x5bc756){return _0x256342[_0x4aa6('0x2e')](_0x5bc756['id']);});}var _0x121b97=_0x45a9e3[_0x4aa6('0xa')](function(_0x1fe9cb){var _0x4d4b60=_0x4aa6('0x22');if(isAgentIdle(_0x1fe9cb)){_0x4d4b60=_0x4aa6('0xc');}return _0x4d4b60===_0x57a3cc;});return _[_0x4aa6('0x2a')](_0x121b97,'id');}catch(_0x52b038){throw _0x52b038;}}exports[_0x4aa6('0x2f')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x29f31a,_0x27da7e,_0x58d768){return Promise[_0x4aa6('0x30')]()[_0x4aa6('0x19')](function(){if(_0x27da7e['length']>0x0){_0x29f31a=_0x29f31a[_0x4aa6('0xa')](function(_0x426f15){return _0x27da7e[_0x4aa6('0x2e')](_0x426f15['id']);});}return _0x29f31a;})[_0x4aa6('0x19')](function(){return db[_0x4aa6('0x31')]['findAll']({'attributes':['id','name',_0x4aa6('0x32'),_0x4aa6('0x4'),_0x4aa6('0x5'),'mailPause','openchannelPause',_0x4aa6('0x8'),_0x4aa6('0x9'),_0x4aa6('0x33'),_0x4aa6('0x34')],'where':{'id':{'$in':_[_0x4aa6('0x2a')](_0x29f31a,'id')}},'raw':!![]});})[_0x4aa6('0x19')](function(_0xcbcf3a){return _0xcbcf3a[_0x4aa6('0x2a')](function(_0x546ea1){var _0x892482=_[_0x4aa6('0x35')](_0x29f31a,['id',_0x546ea1['id']]);var _0x2ae741=filterAgentAttributes(_0x892482);_[_0x4aa6('0x1e')](_0x546ea1,_0x2ae741);_0x546ea1[_0x4aa6('0x36')]=getAgentStatus(_0x546ea1);return _0x546ea1;});})[_0x4aa6('0x19')](function(_0x4ab55d){var _0x223616=sortAgentsByStatus(_0x4ab55d,_0x58d768);return _[_0x4aa6('0x2a')](_0x223616,'id');})['catch'](function(_0x20e396){throw _0x20e396;});}exports[_0x4aa6('0x37')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x381c2b){var _0x3b2a65={'fields':[],'order':null};var _0x49d445=_0x381c2b['split'](',');_0x3b2a65[_0x4aa6('0x38')]=_[_0x4aa6('0xa')](_0x49d445,function(_0x306bc1){if(!_0x306bc1['includes'](_0x4aa6('0x36'))){return!![];}_0x3b2a65[_0x4aa6('0x39')]=_['startsWith'](_0x306bc1,'-')?_0x4aa6('0x3a'):_0x4aa6('0x3b');return![];});return _0x3b2a65;}exports[_0x4aa6('0x3c')]=getUpdatedSortOptions;function validateSortParameter(_0x365329){if(!_0x365329){_0x365329=_0x4aa6('0x3d');}if(_0x365329[_0x4aa6('0x2e')]('fullname')&&!_0x365329['includes'](_0x4aa6('0x3e'))){var _0x356d75=_0x365329[_0x4aa6('0x3f')](0x0,_0x365329[_0x4aa6('0x40')](_0x4aa6('0x32')));_0x365329+=','+_0x356d75+'internal';}return _0x365329;}exports[_0x4aa6('0x41')]=validateSortParameter;function sortAgentsByStatus(_0xed3b87,_0x5d349f){var _0x13fcc8=_0xed3b87[_0x4aa6('0x42')](function(_0x269146,_0x47787d){if(_0x269146[_0x4aa6('0x36')]===_0x47787d['globalStatus']){if(_0x269146[_0x4aa6('0x36')]===_0x4aa6('0x11')){if(_0x5d349f==='DESC'){return(_0x269146[_0x4aa6('0x34')]||'')<(_0x47787d[_0x4aa6('0x34')]||'')||_0x269146['fullname'][_0x4aa6('0x43')]()>_0x47787d[_0x4aa6('0x32')]['toLowerCase']()?0x1:-0x1;}else{return(_0x269146[_0x4aa6('0x34')]||'')<(_0x47787d[_0x4aa6('0x34')]||'')||_0x269146[_0x4aa6('0x32')][_0x4aa6('0x43')]()>_0x47787d[_0x4aa6('0x32')][_0x4aa6('0x43')]()?-0x1:0x1;}}else{if(_0x5d349f===_0x4aa6('0x3a')){return _0x269146['fullname'][_0x4aa6('0x43')]()<_0x47787d[_0x4aa6('0x32')][_0x4aa6('0x43')]()?0x1:-0x1;}else{return _0x269146[_0x4aa6('0x32')][_0x4aa6('0x43')]()<_0x47787d[_0x4aa6('0x32')][_0x4aa6('0x43')]()?-0x1:0x1;}}}else{if(_0x5d349f===_0x4aa6('0x3a')){return _0x269146['globalStatus']<_0x47787d[_0x4aa6('0x36')]?0x1:-0x1;}else{return _0x269146['globalStatus']<_0x47787d[_0x4aa6('0x36')]?-0x1:0x1;}}});return _0x13fcc8;}exports[_0x4aa6('0x44')]=sortAgentsByStatus;function filterAgentAttributes(_0x1a988f){var _0x523fa5=[_0x4aa6('0x45'),'online','lastLoginAt',_0x4aa6('0x46'),_0x4aa6('0x34'),'lastPauseAt',_0x4aa6('0x3e'),_0x4aa6('0x47'),'chatPause',_0x4aa6('0x7'),'mailPause','smsPause',_0x4aa6('0x33'),'faxPause',_0x4aa6('0x9'),_0x4aa6('0x48'),_0x4aa6('0x49'),_0x4aa6('0x4a'),_0x4aa6('0x4b'),_0x4aa6('0x4c'),_0x4aa6('0x4d'),'chatCurrentCapacity','openchannelCurrentCapacity',_0x4aa6('0x4e'),_0x4aa6('0x4f'),_0x4aa6('0x50'),'faxCurrentCapacity',_0x4aa6('0x13'),_0x4aa6('0x15'),_0x4aa6('0x51'),_0x4aa6('0x52'),'whatsappStatus','faxStatus',_0x4aa6('0x10'),_0x4aa6('0x53'),_0x4aa6('0x54'),_0x4aa6('0x55'),'smsStatusTime',_0x4aa6('0x56'),_0x4aa6('0x57'),'voiceStatusTime',_0x4aa6('0x58'),'destconnectedlinenum',_0x4aa6('0x59'),_0x4aa6('0x5a'),_0x4aa6('0x5b')];var _0x1a0860=['chatPause',_0x4aa6('0x7'),_0x4aa6('0x6'),_0x4aa6('0x8'),'whatsappPause','faxPause',_0x4aa6('0x9'),_0x4aa6('0x5c')];var _0x38c442=_(_0x1a988f)[_0x4aa6('0x5d')](_0x1a0860)['pick'](_0x523fa5)[_0x4aa6('0x2c')]();return _0x38c442;}exports[_0x4aa6('0x5e')]=filterAgentAttributes;function getRealtimeAgentsQueryFields(){return['id',_0x4aa6('0x5f'),_0x4aa6('0x32'),_0x4aa6('0x60'),_0x4aa6('0x3e'),_0x4aa6('0x5c'),'globalStatus',_0x4aa6('0x45'),'lastLoginAt','pauseType','lastPauseAt',_0x4aa6('0x5'),_0x4aa6('0x4'),_0x4aa6('0x6'),'openchannelPause',_0x4aa6('0x8'),_0x4aa6('0x9'),_0x4aa6('0x33'),'chatStatus',_0x4aa6('0x14'),_0x4aa6('0x51'),_0x4aa6('0x15'),_0x4aa6('0x52'),_0x4aa6('0x10'),_0x4aa6('0x16'),_0x4aa6('0x53'),_0x4aa6('0x57'),_0x4aa6('0x55'),_0x4aa6('0x54'),'smsStatusTime',_0x4aa6('0x61'),_0x4aa6('0x56'),'chatCapacity',_0x4aa6('0x4d'),'mailCapacity',_0x4aa6('0x49'),_0x4aa6('0x4b'),_0x4aa6('0x4c'),_0x4aa6('0x62'),_0x4aa6('0x63'),'mailCurrentCapacity',_0x4aa6('0x64'),_0x4aa6('0x4f'),_0x4aa6('0x50'),_0x4aa6('0x5a'),_0x4aa6('0x5b'),'destconnectedlinenum',_0x4aa6('0x65'),_0x4aa6('0x58'),_0x4aa6('0x59')];}exports['getRealtimeAgentsQueryFields']=getRealtimeAgentsQueryFields; \ No newline at end of file +var _0x4808=['getAgentStatus','isArray','startCase','findOne','all','map','uniq','value','getAgentIdsByQueues','includes','getAgentIdsByStatus','User','findAll','name','fullname','mailPause','smsPause','whatsappPause','pauseType','find','globalStatus','catch','getSortedAgentsIdsByStatus','split','startsWith','DESC','fullname,internal','internal','substring','indexOf','validateSortParameter','sort','toLowerCase','sortAgentsByStatus','online','lastLoginAt','lastPauseAt','openchannelCapacity','mailCapacity','faxCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','whatsappStatus','chatStatusTime','openchannelStatusTime','mailStatusTime','whatsappStatusTime','faxStatusTime','voiceStatusTime','screenrecording','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','omit','filterAgentAttributes','role','userpic','smsStatusTime','smsCapacity','destconnectedlinenum','onhold','getRealtimeAgentsQueryFields','lodash','jayson/promise','../../mysqldb','http','chatPause','faxPause','openchannelPause','voicePause','every','filter','length','idle','unknown','unavailable','ringing','isNil','voiceStatus','pause','chatStatus','faxStatus','mailStatus','openchannelStatus','smsStatus','request','Agents','then','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','merge','*pause','busy'];(function(_0x712cc9,_0x5bef20){var _0x494edf=function(_0x2f289b){while(--_0x2f289b){_0x712cc9['push'](_0x712cc9['shift']());}};_0x494edf(++_0x5bef20);}(_0x4808,0x160));var _0x8480=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x4808[_0x465a0c];return _0x1e202e;};'use strict';var _=require(_0x8480('0x0'));var jayson=require(_0x8480('0x1'));var db=require(_0x8480('0x2'))['db'];var amiClient=jayson['client'][_0x8480('0x3')]({'port':0x232a});var routingClient=jayson['client'][_0x8480('0x3')]({'port':0x232c});function isAgentPaused(_0xdd3ed9,_0x643456){var _0x4b2e34=[_0xdd3ed9[_0x8480('0x4')],_0xdd3ed9[_0x8480('0x5')],_0xdd3ed9['mailPause'],_0xdd3ed9[_0x8480('0x6')],_0xdd3ed9['smsPause'],_0xdd3ed9[_0x8480('0x7')],_0xdd3ed9['whatsappPause']];if(!_0x643456)return _[_0x8480('0x8')](_0x4b2e34);var _0x2b1ffb=_[_0x8480('0x9')](_0x4b2e34);return _0x2b1ffb[_0x8480('0xa')]>0x0&&_0x2b1ffb[_0x8480('0xa')]<_0x4b2e34['length']?!![]:![];}function isIdle(_0x27b6d6){return _0x27b6d6===_0x8480('0xb')||_0x27b6d6===_0x8480('0xc')||_0x27b6d6===_0x8480('0xd')||_0x27b6d6===_0x8480('0xe')||_[_0x8480('0xf')](_0x27b6d6);}function isAgentIdle(_0x1bb2a5){if(_0x1bb2a5[_0x8480('0x10')]!==_0x8480('0xb')&&_0x1bb2a5[_0x8480('0x7')]){_0x1bb2a5[_0x8480('0x10')]=_0x8480('0x11');return![];}return _[_0x8480('0x8')]([_0x1bb2a5[_0x8480('0x12')],_0x1bb2a5[_0x8480('0x13')],_0x1bb2a5[_0x8480('0x14')],_0x1bb2a5[_0x8480('0x15')],_0x1bb2a5[_0x8480('0x16')],_0x1bb2a5[_0x8480('0x10')],_0x1bb2a5['whatsappStatus']],isIdle);}function getRealtimeAgents(){return amiClient[_0x8480('0x17')](_0x8480('0x18'),{})[_0x8480('0x19')](function(_0x5d2ee2){if(_0x5d2ee2[_0x8480('0x1a')]){throw new Error(_0x8480('0x1b'));}var _0x118b2c=_0x5d2ee2[_0x8480('0x1c')];return routingClient[_0x8480('0x17')](_0x8480('0x18'),{})[_0x8480('0x19')](function(_0x484e41){if(_0x484e41[_0x8480('0x1a')]){throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)');}var _0x5eaeb9=_0x484e41['result'];return _[_0x8480('0x1d')]({},_0x118b2c,_0x5eaeb9);});})['catch'](function(_0x3e3827){throw _0x3e3827;});}exports['getRealtimeAgents']=getRealtimeAgents;function getAgentStatus(_0x56028){var _0x4445d8=_0x8480('0xc');if(isAgentPaused(_0x56028))_0x4445d8='pause';else if(isAgentPaused(_0x56028,!![]))_0x4445d8=_0x8480('0x1e');else if(isAgentIdle(_0x56028))_0x4445d8=_0x8480('0xb');else _0x4445d8=_0x8480('0x1f');return _0x4445d8;}exports[_0x8480('0x20')]=getAgentStatus;function getAgentIdsByQueues(_0x4ca713,_0x5480c3){var _0x37f38f=_[_0x8480('0x21')](_0x4ca713)?_0x4ca713:[_0x4ca713];var _0x3dd0f3=_[_0x8480('0x22')](_0x5480c3)+'Queue';var _0x17b84f=_['map'](_0x37f38f,function(_0x560ea2){return db[_0x3dd0f3][_0x8480('0x23')]({'where':{'id':_0x560ea2}})[_0x8480('0x19')](function(_0x3413a6){if(!_0x3413a6)return[];return _0x3413a6['getAgents']({'attributes':['id'],'raw':!![]});});});return Promise[_0x8480('0x24')](_0x17b84f)['then'](function(_0x19f056){var _0x304d17=_(_0x19f056)['flatten']()[_0x8480('0x25')]('id')[_0x8480('0x26')]()[_0x8480('0x27')]();return _0x304d17;});}exports[_0x8480('0x28')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0xd3e0d8,_0x4e6577,_0x350df6){try{if(_0x4e6577[_0x8480('0xa')]>0x0){_0xd3e0d8=_0xd3e0d8['filter'](function(_0x845033){return _0x4e6577[_0x8480('0x29')](_0x845033['id']);});}var _0x203981=_0xd3e0d8[_0x8480('0x9')](function(_0x4a9a87){var _0x5ad205='busy';if(isAgentIdle(_0x4a9a87)){_0x5ad205='idle';}return _0x5ad205===_0x350df6;});return _[_0x8480('0x25')](_0x203981,'id');}catch(_0x145319){throw _0x145319;}}exports[_0x8480('0x2a')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x2286b7,_0x5352a3,_0x475c80){return Promise['resolve']()[_0x8480('0x19')](function(){if(_0x5352a3['length']>0x0){_0x2286b7=_0x2286b7[_0x8480('0x9')](function(_0x310687){return _0x5352a3[_0x8480('0x29')](_0x310687['id']);});}return _0x2286b7;})[_0x8480('0x19')](function(){return db[_0x8480('0x2b')][_0x8480('0x2c')]({'attributes':['id',_0x8480('0x2d'),_0x8480('0x2e'),_0x8480('0x4'),_0x8480('0x5'),_0x8480('0x2f'),_0x8480('0x6'),_0x8480('0x30'),_0x8480('0x7'),_0x8480('0x31'),_0x8480('0x32')],'where':{'id':{'$in':_[_0x8480('0x25')](_0x2286b7,'id')}},'raw':!![]});})[_0x8480('0x19')](function(_0x3bceb){return _0x3bceb[_0x8480('0x25')](function(_0xb00b86){var _0x50d045=_[_0x8480('0x33')](_0x2286b7,['id',_0xb00b86['id']]);var _0xb6284f=filterAgentAttributes(_0x50d045);_[_0x8480('0x1d')](_0xb00b86,_0xb6284f);_0xb00b86[_0x8480('0x34')]=getAgentStatus(_0xb00b86);return _0xb00b86;});})[_0x8480('0x19')](function(_0x150bdb){var _0x36fc10=sortAgentsByStatus(_0x150bdb,_0x475c80);return _[_0x8480('0x25')](_0x36fc10,'id');})[_0x8480('0x35')](function(_0xd34dc9){throw _0xd34dc9;});}exports[_0x8480('0x36')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x277eba){var _0x2168f7={'fields':[],'order':null};var _0x22c065=_0x277eba[_0x8480('0x37')](',');_0x2168f7['fields']=_['filter'](_0x22c065,function(_0x3038e4){if(!_0x3038e4['includes']('globalStatus')){return!![];}_0x2168f7['order']=_[_0x8480('0x38')](_0x3038e4,'-')?_0x8480('0x39'):'ASC';return![];});return _0x2168f7;}exports['getUpdatedSortOptions']=getUpdatedSortOptions;function validateSortParameter(_0x391e16){if(!_0x391e16){_0x391e16=_0x8480('0x3a');}if(_0x391e16[_0x8480('0x29')](_0x8480('0x2e'))&&!_0x391e16[_0x8480('0x29')](_0x8480('0x3b'))){var _0x59bca1=_0x391e16[_0x8480('0x3c')](0x0,_0x391e16[_0x8480('0x3d')](_0x8480('0x2e')));_0x391e16+=','+_0x59bca1+_0x8480('0x3b');}return _0x391e16;}exports[_0x8480('0x3e')]=validateSortParameter;function sortAgentsByStatus(_0xbaaf62,_0x41e0e3){var _0x24f15c=_0xbaaf62[_0x8480('0x3f')](function(_0x7b6d69,_0x5a14c6){if(_0x7b6d69[_0x8480('0x34')]===_0x5a14c6['globalStatus']){if(_0x7b6d69['globalStatus']===_0x8480('0x11')){if(_0x41e0e3==='DESC'){return(_0x7b6d69[_0x8480('0x32')]||'')<(_0x5a14c6[_0x8480('0x32')]||'')||_0x7b6d69[_0x8480('0x2e')]['toLowerCase']()>_0x5a14c6[_0x8480('0x2e')][_0x8480('0x40')]()?0x1:-0x1;}else{return(_0x7b6d69[_0x8480('0x32')]||'')<(_0x5a14c6['pauseType']||'')||_0x7b6d69[_0x8480('0x2e')]['toLowerCase']()>_0x5a14c6[_0x8480('0x2e')][_0x8480('0x40')]()?-0x1:0x1;}}else{if(_0x41e0e3===_0x8480('0x39')){return _0x7b6d69['fullname']['toLowerCase']()<_0x5a14c6[_0x8480('0x2e')][_0x8480('0x40')]()?0x1:-0x1;}else{return _0x7b6d69[_0x8480('0x2e')][_0x8480('0x40')]()<_0x5a14c6['fullname'][_0x8480('0x40')]()?-0x1:0x1;}}}else{if(_0x41e0e3===_0x8480('0x39')){return _0x7b6d69['globalStatus']<_0x5a14c6[_0x8480('0x34')]?0x1:-0x1;}else{return _0x7b6d69[_0x8480('0x34')]<_0x5a14c6['globalStatus']?-0x1:0x1;}}});return _0x24f15c;}exports[_0x8480('0x41')]=sortAgentsByStatus;function filterAgentAttributes(_0x4ead2e){var _0x1c7b3c=['userpic',_0x8480('0x42'),_0x8480('0x43'),_0x8480('0x44'),_0x8480('0x32'),_0x8480('0x44'),'internal','address','chatPause',_0x8480('0x6'),_0x8480('0x2f'),_0x8480('0x30'),_0x8480('0x31'),'faxPause',_0x8480('0x7'),'chatCapacity',_0x8480('0x45'),_0x8480('0x46'),'smsCapacity','whatsappCapacity',_0x8480('0x47'),'chatCurrentCapacity',_0x8480('0x48'),_0x8480('0x49'),_0x8480('0x4a'),_0x8480('0x4b'),_0x8480('0x4c'),_0x8480('0x12'),_0x8480('0x15'),_0x8480('0x14'),_0x8480('0x16'),_0x8480('0x4d'),_0x8480('0x13'),_0x8480('0x10'),_0x8480('0x4e'),_0x8480('0x4f'),_0x8480('0x50'),'smsStatusTime',_0x8480('0x51'),_0x8480('0x52'),_0x8480('0x53'),'queue','destconnectedlinenum',_0x8480('0x54'),_0x8480('0x55'),_0x8480('0x56')];var _0x32d873=[_0x8480('0x4'),_0x8480('0x6'),'mailPause',_0x8480('0x30'),_0x8480('0x31'),'faxPause',_0x8480('0x7'),_0x8480('0x42')];var _0x35d6f6=_(_0x4ead2e)[_0x8480('0x57')](_0x32d873)['pick'](_0x1c7b3c)[_0x8480('0x27')]();return _0x35d6f6;}exports[_0x8480('0x58')]=filterAgentAttributes;function getRealtimeAgentsQueryFields(){return['id',_0x8480('0x2d'),_0x8480('0x2e'),_0x8480('0x59'),_0x8480('0x3b'),_0x8480('0x42'),_0x8480('0x34'),_0x8480('0x5a'),_0x8480('0x43'),'pauseType',_0x8480('0x44'),_0x8480('0x5'),_0x8480('0x4'),'mailPause',_0x8480('0x6'),'smsPause',_0x8480('0x7'),_0x8480('0x31'),_0x8480('0x12'),_0x8480('0x13'),_0x8480('0x14'),_0x8480('0x15'),'smsStatus',_0x8480('0x10'),'whatsappStatus',_0x8480('0x4e'),_0x8480('0x52'),_0x8480('0x50'),_0x8480('0x4f'),_0x8480('0x5b'),_0x8480('0x53'),_0x8480('0x51'),'chatCapacity','faxCapacity','mailCapacity','openchannelCapacity',_0x8480('0x5c'),'whatsappCapacity','chatCurrentCapacity',_0x8480('0x4c'),_0x8480('0x49'),_0x8480('0x48'),_0x8480('0x4a'),'whatsappCurrentCapacity',_0x8480('0x55'),_0x8480('0x56'),_0x8480('0x5d'),_0x8480('0x5e'),'queue',_0x8480('0x54')];}exports[_0x8480('0x5f')]=getRealtimeAgentsQueryFields; \ No newline at end of file diff --git a/server/components/realtime/queues.js b/server/components/realtime/queues.js index 7e39102..4968060 100644 --- a/server/components/realtime/queues.js +++ b/server/components/realtime/queues.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8363=['notInUse','onHold','ringing','ringInUse','talking','unavailable','pTalking','dialActive','dialMethod','startProgressive','erlangCalls','erlangBusyFactor','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgTalktime','voice','request','startCase','Queues','then','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','catch','getRealtimeQueues','inbound','concat','outbound','map','get','loggedIn','waiting','originated','find','merge','pick','initializeQueues','lodash','jayson/promise','client','http','available','paused','invalid','loggedInDb'];(function(_0x460ed1,_0x9819f5){var _0x36c9b1=function(_0x19a58a){while(--_0x19a58a){_0x460ed1['push'](_0x460ed1['shift']());}};_0x36c9b1(++_0x9819f5);}(_0x8363,0x180));var _0x3836=function(_0x1cdfff,_0x480413){_0x1cdfff=_0x1cdfff-0x0;var _0x1de48f=_0x8363[_0x1cdfff];return _0x1de48f;};'use strict';var _=require(_0x3836('0x0'));var jayson=require(_0x3836('0x1'));var util=require('util');var amiClient=jayson[_0x3836('0x2')]['http']({'port':0x232a});var routingClient=jayson[_0x3836('0x2')][_0x3836('0x3')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0x3836('0x4'),'loggedIn',_0x3836('0x5'),'waiting'];var VOICE_QUEUE_ATTRIBUTES=['busy','inUse',_0x3836('0x6'),_0x3836('0x7'),_0x3836('0x8'),_0x3836('0x9'),_0x3836('0xa'),_0x3836('0xb'),_0x3836('0xc'),_0x3836('0xd'),'unknown'];var OUTBOUND_QUEUE_ATTRIBUTES=[_0x3836('0xe'),'originated','message','statusMessage',_0x3836('0xf'),_0x3836('0x10'),'Trunk','startPredictive',_0x3836('0x11'),_0x3836('0x12'),'erlangCallToSecond','erlangAbandonmentRate',_0x3836('0x13'),'dialPredictiveInterval','dialPredictiveIntervalMaxThreshold',_0x3836('0x14'),_0x3836('0x15'),_0x3836('0x16'),_0x3836('0x17'),_0x3836('0x18'),_0x3836('0x19'),'predictiveIntervalAvgHoldtime',_0x3836('0x1a')];function getRealtimeQueues(_0x10a67f,_0x21a651){var _0x219078=_0x21a651===_0x3836('0x1b')?amiClient:routingClient;return _0x219078[_0x3836('0x1c')](_[_0x3836('0x1d')](_0x21a651)+_0x3836('0x1e'),_0x10a67f)[_0x3836('0x1f')](function(_0x3fdcb9){if(_0x3fdcb9['error'])throw new Error(util[_0x3836('0x20')](_0x3836('0x21'),_0x21a651));return _0x3fdcb9[_0x3836('0x22')];})[_0x3836('0x23')](function(_0x113199){throw _0x113199;});}exports[_0x3836('0x24')]=getRealtimeQueues;function initializeQueues(_0x571c89,_0x73eee7,_0x478fa2,_0x254d97){var _0x19c7a1=DEFAULT_QUEUE_ATTRIBUTES;if(_0x478fa2===_0x3836('0x1b')){if(_0x254d97===_0x3836('0x25')){_0x19c7a1=_0x19c7a1[_0x3836('0x26')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x254d97===_0x3836('0x27')){_0x19c7a1=_0x19c7a1[_0x3836('0x26')](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x571c89[_0x3836('0x28')](function(_0x12b220){var _0x1c9505=_0x12b220[_0x3836('0x29')]({'plain':!![]});_0x1c9505[_0x3836('0x5')]=0x0;_0x1c9505[_0x3836('0x7')]=0x0;_0x1c9505[_0x3836('0x2a')]=0x0;_0x1c9505['available']=0x0;_0x1c9505[_0x3836('0x2b')]=0x0;if(_0x478fa2===_0x3836('0x1b')){_0x1c9505[_0x3836('0xc')]=0x0;_0x1c9505['busy']=0x0;if(_0x254d97==='outbound'){_0x1c9505[_0x3836('0xe')]=0x0;_0x1c9505[_0x3836('0x2c')]=0x0;}}var _0x28c10a=_[_0x3836('0x2d')](_0x73eee7,['id',_0x1c9505['id']]);if(_0x28c10a){_[_0x3836('0x2e')](_0x1c9505,_[_0x3836('0x2f')](_0x28c10a,_0x19c7a1));}return _0x1c9505;});}exports[_0x3836('0x30')]=initializeQueues; \ No newline at end of file +var _0xaf60=['lodash','jayson/promise','util','client','http','available','loggedIn','waiting','busy','loggedInDb','onHold','ringing','unavailable','unknown','statusMessage','dialMethod','Trunk','startPredictive','startProgressive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','dialPredictiveInterval','predictiveIntervalAvailable','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','voice','request','startCase','Queues','then','error','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','getRealtimeQueues','inbound','concat','outbound','get','paused','talking','pTalking','originated','find','merge','pick','initializeQueues'];(function(_0x222a33,_0x31b77e){var _0x4f5b72=function(_0x16977f){while(--_0x16977f){_0x222a33['push'](_0x222a33['shift']());}};_0x4f5b72(++_0x31b77e);}(_0xaf60,0x64));var _0x0af6=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0xaf60[_0x187ee1];return _0x388160;};'use strict';var _=require(_0x0af6('0x0'));var jayson=require(_0x0af6('0x1'));var util=require(_0x0af6('0x2'));var amiClient=jayson[_0x0af6('0x3')][_0x0af6('0x4')]({'port':0x232a});var routingClient=jayson[_0x0af6('0x3')][_0x0af6('0x4')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0x0af6('0x5'),_0x0af6('0x6'),'paused',_0x0af6('0x7')];var VOICE_QUEUE_ATTRIBUTES=[_0x0af6('0x8'),'inUse','invalid',_0x0af6('0x9'),'notInUse',_0x0af6('0xa'),_0x0af6('0xb'),'ringInUse','talking',_0x0af6('0xc'),_0x0af6('0xd')];var OUTBOUND_QUEUE_ATTRIBUTES=['pTalking','originated','message',_0x0af6('0xe'),'dialActive',_0x0af6('0xf'),_0x0af6('0x10'),_0x0af6('0x11'),_0x0af6('0x12'),_0x0af6('0x13'),_0x0af6('0x14'),_0x0af6('0x15'),'erlangBusyFactor',_0x0af6('0x16'),'dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold',_0x0af6('0x17'),'predictiveIntervalTotalCalls',_0x0af6('0x18'),_0x0af6('0x19'),_0x0af6('0x1a'),_0x0af6('0x1b'),_0x0af6('0x1c')];function getRealtimeQueues(_0x319af2,_0x53539a){var _0xbefa67=_0x53539a===_0x0af6('0x1d')?amiClient:routingClient;return _0xbefa67[_0x0af6('0x1e')](_[_0x0af6('0x1f')](_0x53539a)+_0x0af6('0x20'),_0x319af2)[_0x0af6('0x21')](function(_0x3cc7ba){if(_0x3cc7ba[_0x0af6('0x22')])throw new Error(util[_0x0af6('0x23')](_0x0af6('0x24'),_0x53539a));return _0x3cc7ba['result'];})['catch'](function(_0x40a33d){throw _0x40a33d;});}exports[_0x0af6('0x25')]=getRealtimeQueues;function initializeQueues(_0x489291,_0x484c0b,_0x2d1dc,_0x37960f){var _0x1b7c7d=DEFAULT_QUEUE_ATTRIBUTES;if(_0x2d1dc===_0x0af6('0x1d')){if(_0x37960f===_0x0af6('0x26')){_0x1b7c7d=_0x1b7c7d[_0x0af6('0x27')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x37960f===_0x0af6('0x28')){_0x1b7c7d=_0x1b7c7d[_0x0af6('0x27')](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x489291['map'](function(_0x106f6d){var _0x7ed2ef=_0x106f6d[_0x0af6('0x29')]({'plain':!![]});_0x7ed2ef[_0x0af6('0x2a')]=0x0;_0x7ed2ef[_0x0af6('0x9')]=0x0;_0x7ed2ef[_0x0af6('0x6')]=0x0;_0x7ed2ef['available']=0x0;_0x7ed2ef[_0x0af6('0x7')]=0x0;if(_0x2d1dc===_0x0af6('0x1d')){_0x7ed2ef[_0x0af6('0x2b')]=0x0;_0x7ed2ef[_0x0af6('0x8')]=0x0;if(_0x37960f==='outbound'){_0x7ed2ef[_0x0af6('0x2c')]=0x0;_0x7ed2ef[_0x0af6('0x2d')]=0x0;}}var _0x11618e=_[_0x0af6('0x2e')](_0x484c0b,['id',_0x7ed2ef['id']]);if(_0x11618e){_[_0x0af6('0x2f')](_0x7ed2ef,_[_0x0af6('0x30')](_0x11618e,_0x1b7c7d));}return _0x7ed2ef;});}exports[_0x0af6('0x31')]=initializeQueues; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index 40284db..2b10d78 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['root','public','test','join','client','use','json\x20replacer','toISOString','split','static','/server/views','engine','html','ejs','renderFile','view\x20engine','urlencoded','json','50mb','express','method-override','cookie-parser','errorhandler','passport','cors','./environment','default','get','env','production','set','appPath'];(function(_0x5bb4e8,_0x44b756){var _0x2a86f2=function(_0x279ab2){while(--_0x279ab2){_0x5bb4e8['push'](_0x5bb4e8['shift']());}};_0x2a86f2(++_0x44b756);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var express=require(_0x7995('0x0'));var methodOverride=require(_0x7995('0x1'));var cookieParser=require(_0x7995('0x2'));var errorHandler=require(_0x7995('0x3'));var path=require('path');var passport=require(_0x7995('0x4'));var cors=require(_0x7995('0x5'));var config=require(_0x7995('0x6'));exports[_0x7995('0x7')]=function(_0x576d89){var _0x744bea=_0x576d89[_0x7995('0x8')](_0x7995('0x9'));if(_0x744bea===_0x7995('0xa')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path['join'](config[_0x7995('0xd')],_0x7995('0xe')));}if(_0x744bea==='development'||_0x744bea===_0x7995('0xf')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path[_0x7995('0x10')](config[_0x7995('0xd')],_0x7995('0x11')));_0x576d89[_0x7995('0x12')](errorHandler());}_0x576d89['set'](_0x7995('0x13'),function(_0x41c652,_0x581f22){if(this[_0x41c652]instanceof Date){_0x581f22=this[_0x41c652][_0x7995('0x14')]()[_0x7995('0x15')]('.')[0x0]+'Z';}return _0x581f22;});_0x576d89[_0x7995('0x12')](express[_0x7995('0x16')](_0x576d89[_0x7995('0x8')](_0x7995('0xc'))));_0x576d89[_0x7995('0xb')]('views',config['root']+_0x7995('0x17'));_0x576d89[_0x7995('0x18')](_0x7995('0x19'),require(_0x7995('0x1a'))[_0x7995('0x1b')]);_0x576d89[_0x7995('0xb')](_0x7995('0x1c'),_0x7995('0x19'));_0x576d89['use'](express[_0x7995('0x1d')]({'limit':'50mb','extended':!![]}));_0x576d89[_0x7995('0x12')](express[_0x7995('0x1e')]({'limit':_0x7995('0x1f')}));_0x576d89[_0x7995('0x12')](cors());_0x576d89[_0x7995('0x12')](methodOverride());_0x576d89[_0x7995('0x12')](cookieParser());_0x576d89['use'](passport['initialize']());}; \ No newline at end of file +var _0xa9e0=['get','production','set','appPath','public','join','root','client','use','toISOString','split','static','views','/server/views','engine','html','ejs','urlencoded','50mb','json','initialize','express','method-override','cookie-parser','passport','./environment','default'];(function(_0x266618,_0x18f637){var _0x54dbf5=function(_0x1f7985){while(--_0x1f7985){_0x266618['push'](_0x266618['shift']());}};_0x54dbf5(++_0x18f637);}(_0xa9e0,0x123));var _0x0a9e=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0xa9e0[_0x92c450];return _0x2a9599;};'use strict';var express=require(_0x0a9e('0x0'));var methodOverride=require(_0x0a9e('0x1'));var cookieParser=require(_0x0a9e('0x2'));var errorHandler=require('errorhandler');var path=require('path');var passport=require(_0x0a9e('0x3'));var cors=require('cors');var config=require(_0x0a9e('0x4'));exports[_0x0a9e('0x5')]=function(_0x2ab90b){var _0x991246=_0x2ab90b[_0x0a9e('0x6')]('env');if(_0x991246===_0x0a9e('0x7')){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path['join'](config['root'],_0x0a9e('0xa')));}if(_0x991246==='development'||_0x991246==='test'){_0x2ab90b[_0x0a9e('0x8')](_0x0a9e('0x9'),path[_0x0a9e('0xb')](config[_0x0a9e('0xc')],_0x0a9e('0xd')));_0x2ab90b[_0x0a9e('0xe')](errorHandler());}_0x2ab90b['set']('json\x20replacer',function(_0x527cdd,_0x4cfe67){if(this[_0x527cdd]instanceof Date){_0x4cfe67=this[_0x527cdd][_0x0a9e('0xf')]()[_0x0a9e('0x10')]('.')[0x0]+'Z';}return _0x4cfe67;});_0x2ab90b[_0x0a9e('0xe')](express[_0x0a9e('0x11')](_0x2ab90b[_0x0a9e('0x6')](_0x0a9e('0x9'))));_0x2ab90b['set'](_0x0a9e('0x12'),config[_0x0a9e('0xc')]+_0x0a9e('0x13'));_0x2ab90b[_0x0a9e('0x14')](_0x0a9e('0x15'),require(_0x0a9e('0x16'))['renderFile']);_0x2ab90b[_0x0a9e('0x8')]('view\x20engine',_0x0a9e('0x15'));_0x2ab90b['use'](express[_0x0a9e('0x17')]({'limit':_0x0a9e('0x18'),'extended':!![]}));_0x2ab90b['use'](express[_0x0a9e('0x19')]({'limit':'50mb'}));_0x2ab90b[_0x0a9e('0xe')](cors());_0x2ab90b[_0x0a9e('0xe')](methodOverride());_0x2ab90b[_0x0a9e('0xe')](cookieParser());_0x2ab90b[_0x0a9e('0xe')](passport[_0x0a9e('0x1a')]());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index a0f57ff..3df7852 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 _0xd762=['filter','family','IPv4','head','mac','00:00:00:00:00:00','address','getFirstInterface','model','join','createHash','md5','update','digest','hex','getUuid','test','licenseToken','win32','utf8','replace','hostname','macAddress','substring','lodash','bimedia-machine-uuid','child_process','execSync','../environment','networkInterfaces','orderBy','length'];(function(_0x5ce268,_0x1835b6){var _0x28c96a=function(_0x18c1d6){while(--_0x18c1d6){_0x5ce268['push'](_0x5ce268['shift']());}};_0x28c96a(++_0x1835b6);}(_0xd762,0x158));var _0x2d76=function(_0x38c6f4,_0x1463ed){_0x38c6f4=_0x38c6f4-0x0;var _0x4919e9=_0xd762[_0x38c6f4];return _0x4919e9;};'use strict';var _=require(_0x2d76('0x0'));var os=require('os');var crypto=require('crypto');var machine=require(_0x2d76('0x1'));var exec=require(_0x2d76('0x2'))[_0x2d76('0x3')];var config=require(_0x2d76('0x4'));function getInterfaces(){var _0x10f8ba=[];var _0x584da2=os[_0x2d76('0x5')]();var _0x5b530c=_[_0x2d76('0x6')](_['keys'](_0x584da2));for(var _0x1ebb6b=0x0;_0x1ebb6b<_0x5b530c[_0x2d76('0x7')];_0x1ebb6b++){var _0x2414ce=_0x584da2[_0x5b530c[_0x1ebb6b]][_0x2d76('0x8')](function(_0xa89f05){return _0xa89f05[_0x2d76('0x9')]===_0x2d76('0xa')&&_0xa89f05['internal']===![];});_0x10f8ba=_0x10f8ba['concat'](_0x2414ce);}return _0x10f8ba;}function getFirstInterface(){var _0x5b0adb=_[_0x2d76('0xb')](getInterfaces());return{'macAddress':_0x5b0adb&&_0x5b0adb[_0x2d76('0xc')]?_0x5b0adb[_0x2d76('0xc')]:_0x2d76('0xd'),'ipAddress':_0x5b0adb&&_0x5b0adb[_0x2d76('0xe')]?_0x5b0adb[_0x2d76('0xe')]:'127.0.0.1'};}exports[_0x2d76('0xf')]=getFirstInterface;function getCPUhash(){var _0x13bc41=_[_0x2d76('0x6')](os['cpus']()['map'](function(_0x212d2e){return _0x212d2e[_0x2d76('0x10')];}))[_0x2d76('0x11')](':');return crypto[_0x2d76('0x12')](_0x2d76('0x13'))[_0x2d76('0x14')](_0x13bc41)[_0x2d76('0x15')](_0x2d76('0x16'));}exports[_0x2d76('0x17')]=function(){var _0x2a5afe=os['platform']();var _0x255e39=/[0-9a-f-]{36}/;if(config['licenseToken']&&_0x255e39[_0x2d76('0x18')](config[_0x2d76('0x19')])){return config[_0x2d76('0x19')];}else if(_0x2a5afe===_0x2d76('0x1a')){return exec('dmidecode\x20--string\x20system-uuid',{'encoding':_0x2d76('0x1b')})[_0x2d76('0x1c')]('\x0d\x0a','');}else{var _0x1c4fba=getFirstInterface();var _0x24a3ef=getCPUhash();var _0x45cd3f=_0x24a3ef+'|'+os[_0x2d76('0x1d')]()+'|'+_0x1c4fba[_0x2d76('0x1e')]+'|'+_0x1c4fba['ipAddress'];var _0x1e57a5=crypto[_0x2d76('0x12')](_0x2d76('0x13'))[_0x2d76('0x14')](_0x45cd3f)[_0x2d76('0x15')](_0x2d76('0x16'));return _0x1e57a5['substring'](0x0,0x8)+'-'+_0x1e57a5['substring'](0x8,0xc)+'-'+_0x1e57a5['substring'](0xc,0x10)+'-'+_0x1e57a5[_0x2d76('0x1f')](0x10,0x14)+'-'+_0x1e57a5[_0x2d76('0x1f')](0x14);}}; \ No newline at end of file +var _0xbc33=['createHash','update','digest','hex','platform','licenseToken','win32','dmidecode\x20--string\x20system-uuid','utf8','replace','macAddress','ipAddress','md5','substring','lodash','crypto','bimedia-machine-uuid','child_process','../environment','networkInterfaces','orderBy','keys','length','filter','family','internal','concat','head','mac','00:00:00:00:00:00','address','getFirstInterface','cpus','map','model','join'];(function(_0x1e1020,_0xd64a27){var _0x464719=function(_0x376ffa){while(--_0x376ffa){_0x1e1020['push'](_0x1e1020['shift']());}};_0x464719(++_0xd64a27);}(_0xbc33,0x7a));var _0x3bc3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbc33[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x3bc3('0x0'));var os=require('os');var crypto=require(_0x3bc3('0x1'));var machine=require(_0x3bc3('0x2'));var exec=require(_0x3bc3('0x3'))['execSync'];var config=require(_0x3bc3('0x4'));function getInterfaces(){var _0x30e9a9=[];var _0x455746=os[_0x3bc3('0x5')]();var _0x2cfae2=_[_0x3bc3('0x6')](_[_0x3bc3('0x7')](_0x455746));for(var _0x1bf983=0x0;_0x1bf983<_0x2cfae2[_0x3bc3('0x8')];_0x1bf983++){var _0x3e10c5=_0x455746[_0x2cfae2[_0x1bf983]][_0x3bc3('0x9')](function(_0x5b8724){return _0x5b8724[_0x3bc3('0xa')]==='IPv4'&&_0x5b8724[_0x3bc3('0xb')]===![];});_0x30e9a9=_0x30e9a9[_0x3bc3('0xc')](_0x3e10c5);}return _0x30e9a9;}function getFirstInterface(){var _0x39646f=_[_0x3bc3('0xd')](getInterfaces());return{'macAddress':_0x39646f&&_0x39646f[_0x3bc3('0xe')]?_0x39646f['mac']:_0x3bc3('0xf'),'ipAddress':_0x39646f&&_0x39646f[_0x3bc3('0x10')]?_0x39646f[_0x3bc3('0x10')]:'127.0.0.1'};}exports[_0x3bc3('0x11')]=getFirstInterface;function getCPUhash(){var _0x503cc2=_[_0x3bc3('0x6')](os[_0x3bc3('0x12')]()[_0x3bc3('0x13')](function(_0x103f30){return _0x103f30[_0x3bc3('0x14')];}))[_0x3bc3('0x15')](':');return crypto[_0x3bc3('0x16')]('md5')[_0x3bc3('0x17')](_0x503cc2)[_0x3bc3('0x18')](_0x3bc3('0x19'));}exports['getUuid']=function(){var _0x5a9337=os[_0x3bc3('0x1a')]();var _0x45312d=/[0-9a-f-]{36}/;if(config['licenseToken']&&_0x45312d['test'](config[_0x3bc3('0x1b')])){return config[_0x3bc3('0x1b')];}else if(_0x5a9337===_0x3bc3('0x1c')){return exec(_0x3bc3('0x1d'),{'encoding':_0x3bc3('0x1e')})[_0x3bc3('0x1f')]('\x0d\x0a','');}else{var _0x2a9a34=getFirstInterface();var _0x2ed28e=getCPUhash();var _0x121846=_0x2ed28e+'|'+os['hostname']()+'|'+_0x2a9a34[_0x3bc3('0x20')]+'|'+_0x2a9a34[_0x3bc3('0x21')];var _0x5cd2c8=crypto['createHash'](_0x3bc3('0x22'))[_0x3bc3('0x17')](_0x121846)['digest'](_0x3bc3('0x19'));return _0x5cd2c8[_0x3bc3('0x23')](0x0,0x8)+'-'+_0x5cd2c8['substring'](0x8,0xc)+'-'+_0x5cd2c8[_0x3bc3('0x23')](0xc,0x10)+'-'+_0x5cd2c8[_0x3bc3('0x23')](0x10,0x14)+'-'+_0x5cd2c8[_0x3bc3('0x23')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index 59685ec..d59b117 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 _0x12fc=['request-promise','pkginfo','../../mysqldb','../../components/encryptor','../logger','license','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','%s/api/servers/%s/check?version=%s&oldtoken=%s','version','GET','then','catch','data1','data2','active','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','toUpperCase','encryptString','diff','decryptString','DEMO\x20START\x20AT\x20%s','error','message','finally','getUuid','License','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','default','moment'];(function(_0x32b56b,_0x2ff149){var _0x856a25=function(_0x23991e){while(--_0x23991e){_0x32b56b['push'](_0x32b56b['shift']());}};_0x856a25(++_0x2ff149);}(_0x12fc,0x1b7));var _0xc12f=function(_0x31d052,_0x6ff1a3){_0x31d052=_0x31d052-0x0;var _0x21e3f7=_0x12fc[_0x31d052];return _0x21e3f7;};'use strict';var util=require('util');var moment=require(_0xc12f('0x0'));var rp=require(_0xc12f('0x1'));var BPromise=require('bluebird');var pkginfo=require(_0xc12f('0x2'))(module,'version');var db=require(_0xc12f('0x3'))['db'];var encryptor=require(_0xc12f('0x4'));var hardware=require('./hardware');var logger=require(_0xc12f('0x5'))(_0xc12f('0x6'));var HOST=_0xc12f('0x7');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x2de66b){return new BPromise(function(_0x91ea5a,_0x302365){var _0x21fa24=util[_0xc12f('0x8')](_0xc12f('0x9'),HOST,_0x2de66b,module['exports']['version']);if(oldToken){_0x21fa24=util[_0xc12f('0x8')](_0xc12f('0xa'),HOST,_0x2de66b,module['exports'][_0xc12f('0xb')],oldToken);}var _0x27ebdb={'uri':_0x21fa24,'method':_0xc12f('0xc'),'timeout':0xea60,'json':!![]};return rp(_0x27ebdb)[_0xc12f('0xd')](function(_0x3d420a){_0x91ea5a(_0x3d420a);})[_0xc12f('0xe')](function(_0x10feaa){_0x302365(_0x10feaa);});});}function manageLicense(_0x177848,_0x6663e4){var _0x1c9fba=_0x6663e4['get']({'plain':!![]});if(!isOldTokenSent&&_0x1c9fba[_0xc12f('0xf')]!==_0x177848&&!_0x1c9fba[_0xc12f('0x10')]){oldToken=_0x1c9fba[_0xc12f('0xf')];}httpRequest(_0x177848)[_0xc12f('0xd')](function(_0x42f05b){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x42f05b[_0xc12f('0x11')]){isOldTokenSent=![];if(!_0x1c9fba['license']&&_0x1c9fba[_0xc12f('0x6')]!=_0x42f05b[_0xc12f('0x6')]||_0x1c9fba['license']&&_0x1c9fba[_0xc12f('0x10')]){logger[_0xc12f('0x12')](_0xc12f('0x13'));}if(_0x1c9fba[_0xc12f('0x6')]&&!_0x1c9fba[_0xc12f('0x10')]&&_0x1c9fba[_0xc12f('0x6')]!=_0x42f05b['license']){logger['info'](_0xc12f('0x14'));}if(_0x1c9fba[_0xc12f('0x6')]&&!_0x1c9fba[_0xc12f('0x10')]&&_0x1c9fba[_0xc12f('0x6')]==_0x42f05b[_0xc12f('0x6')]){return _0x6663e4;}return _0x6663e4[_0xc12f('0x15')]({'data1':_0x177848,'data2':null,'license':_0x42f05b[_0xc12f('0x6')]});}else{if(_0x42f05b[_0xc12f('0x6')]||_0x1c9fba[_0xc12f('0x6')]){if(!_0x1c9fba['data2']){if(_0x1c9fba[_0xc12f('0xf')]==_0x177848){GRAY_PERIOD_REASON=_0xc12f('0x16');logger[_0xc12f('0x12')](_0xc12f('0x17'));}else{GRAY_PERIOD_REASON=_0xc12f('0x18');logger[_0xc12f('0x12')](_0xc12f('0x19'),_0x1c9fba[_0xc12f('0xf')],_0x177848);}logger[_0xc12f('0x12')]('%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s',GRAY_PERIOD_REASON[_0xc12f('0x1a')](),moment()['format']('YYYY-MM-DD\x20HH:mm'));return _0x6663e4[_0xc12f('0x15')]({'data2':encryptor[_0xc12f('0x1b')](moment()[_0xc12f('0x8')]('YYYY-MM-DD\x20HH:mm'))});}else{if(moment()[_0xc12f('0x1c')](encryptor[_0xc12f('0x1d')](_0x1c9fba[_0xc12f('0x10')]),'days')>DAYS){logger['info'](_0xc12f('0x1e'),moment()[_0xc12f('0x8')]('YYYY-MM-DD\x20HH:mm'));isOldTokenSent=![];return _0x6663e4[_0xc12f('0x15')]({'data1':_0x177848,'data2':null,'license':null});}}}else{if(_0x1c9fba[_0xc12f('0xf')]!=_0x177848){logger[_0xc12f('0x12')](_0xc12f('0x19'),_0x1c9fba[_0xc12f('0xf')],_0x177848);return _0x6663e4[_0xc12f('0x15')]({'data1':_0x177848,'data2':null,'license':null});}}}return _0x6663e4;})['then'](function(_0x3e5228){_0x6663e4=_0x3e5228;})[_0xc12f('0xe')](function(_0x3b7100){logger[_0xc12f('0x1f')](_0x3b7100[_0xc12f('0x20')]);})[_0xc12f('0x21')](function(){setTimeout(function(){manageLicense(hardware[_0xc12f('0x22')](),_0x6663e4);},TIME);});}function defaultLicense(){var _0xd5c5f0=hardware[_0xc12f('0x22')]();if(_0xd5c5f0){return db[_0xc12f('0x23')][_0xc12f('0x24')]({'where':{'id':0x1},'defaults':{'data1':_0xd5c5f0}})[_0xc12f('0x25')](function(_0x2f869b,_0x31ccfa){logger['info'](_0xc12f('0x26'),_0xd5c5f0);manageLicense(_0xd5c5f0,_0x2f869b);})[_0xc12f('0xe')](function(_0x3020c3){logger['error'](_0x3020c3[_0xc12f('0x20')]);});}}exports[_0xc12f('0x27')]=defaultLicense; \ No newline at end of file +var _0xf8d3=['data1','data2','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','encryptString','diff','decryptString','days','error','message','finally','getUuid','License','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','default','pkginfo','version','../../mysqldb','../../components/encryptor','./hardware','license','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','then','catch','get'];(function(_0x575479,_0x515c31){var _0x367a3f=function(_0x3eccc1){while(--_0x3eccc1){_0x575479['push'](_0x575479['shift']());}};_0x367a3f(++_0x515c31);}(_0xf8d3,0x122));var _0x3f8d=function(_0x530f66,_0x41bcb7){_0x530f66=_0x530f66-0x0;var _0x23a441=_0xf8d3[_0x530f66];return _0x23a441;};'use strict';var util=require('util');var moment=require('moment');var rp=require('request-promise');var BPromise=require('bluebird');var pkginfo=require(_0x3f8d('0x0'))(module,_0x3f8d('0x1'));var db=require(_0x3f8d('0x2'))['db'];var encryptor=require(_0x3f8d('0x3'));var hardware=require(_0x3f8d('0x4'));var logger=require('../logger')(_0x3f8d('0x5'));var HOST=_0x3f8d('0x6');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x5944a4){return new BPromise(function(_0xb46ac1,_0xe8887c){var _0x45aab1=util[_0x3f8d('0x7')](_0x3f8d('0x8'),HOST,_0x5944a4,module[_0x3f8d('0x9')][_0x3f8d('0x1')]);if(oldToken){_0x45aab1=util[_0x3f8d('0x7')](_0x3f8d('0xa'),HOST,_0x5944a4,module[_0x3f8d('0x9')][_0x3f8d('0x1')],oldToken);}var _0x154015={'uri':_0x45aab1,'method':'GET','timeout':0xea60,'json':!![]};return rp(_0x154015)[_0x3f8d('0xb')](function(_0x291cc8){_0xb46ac1(_0x291cc8);})[_0x3f8d('0xc')](function(_0x5bcb3a){_0xe8887c(_0x5bcb3a);});});}function manageLicense(_0x3f07f7,_0x182af0){var _0x77f390=_0x182af0[_0x3f8d('0xd')]({'plain':!![]});if(!isOldTokenSent&&_0x77f390[_0x3f8d('0xe')]!==_0x3f07f7&&!_0x77f390[_0x3f8d('0xf')]){oldToken=_0x77f390[_0x3f8d('0xe')];}httpRequest(_0x3f07f7)[_0x3f8d('0xb')](function(_0x5c2a1d){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x5c2a1d['active']){isOldTokenSent=![];if(!_0x77f390['license']&&_0x77f390['license']!=_0x5c2a1d[_0x3f8d('0x5')]||_0x77f390['license']&&_0x77f390[_0x3f8d('0xf')]){logger[_0x3f8d('0x10')](_0x3f8d('0x11'));}if(_0x77f390[_0x3f8d('0x5')]&&!_0x77f390[_0x3f8d('0xf')]&&_0x77f390[_0x3f8d('0x5')]!=_0x5c2a1d[_0x3f8d('0x5')]){logger['info'](_0x3f8d('0x12'));}if(_0x77f390[_0x3f8d('0x5')]&&!_0x77f390[_0x3f8d('0xf')]&&_0x77f390['license']==_0x5c2a1d[_0x3f8d('0x5')]){return _0x182af0;}return _0x182af0[_0x3f8d('0x13')]({'data1':_0x3f07f7,'data2':null,'license':_0x5c2a1d[_0x3f8d('0x5')]});}else{if(_0x5c2a1d[_0x3f8d('0x5')]||_0x77f390['license']){if(!_0x77f390[_0x3f8d('0xf')]){if(_0x77f390[_0x3f8d('0xe')]==_0x3f07f7){GRAY_PERIOD_REASON='Disabled';logger['info']('THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED');}else{GRAY_PERIOD_REASON=_0x3f8d('0x14');logger[_0x3f8d('0x10')](_0x3f8d('0x15'),_0x77f390['data1'],_0x3f07f7);}logger[_0x3f8d('0x10')](_0x3f8d('0x16'),GRAY_PERIOD_REASON[_0x3f8d('0x17')](),moment()['format'](_0x3f8d('0x18')));return _0x182af0[_0x3f8d('0x13')]({'data2':encryptor[_0x3f8d('0x19')](moment()['format']('YYYY-MM-DD\x20HH:mm'))});}else{if(moment()[_0x3f8d('0x1a')](encryptor[_0x3f8d('0x1b')](_0x77f390[_0x3f8d('0xf')]),_0x3f8d('0x1c'))>DAYS){logger['info']('DEMO\x20START\x20AT\x20%s',moment()[_0x3f8d('0x7')](_0x3f8d('0x18')));isOldTokenSent=![];return _0x182af0[_0x3f8d('0x13')]({'data1':_0x3f07f7,'data2':null,'license':null});}}}else{if(_0x77f390['data1']!=_0x3f07f7){logger[_0x3f8d('0x10')](_0x3f8d('0x15'),_0x77f390[_0x3f8d('0xe')],_0x3f07f7);return _0x182af0[_0x3f8d('0x13')]({'data1':_0x3f07f7,'data2':null,'license':null});}}}return _0x182af0;})[_0x3f8d('0xb')](function(_0x49fd5c){_0x182af0=_0x49fd5c;})['catch'](function(_0x197f04){logger[_0x3f8d('0x1d')](_0x197f04[_0x3f8d('0x1e')]);})[_0x3f8d('0x1f')](function(){setTimeout(function(){manageLicense(hardware[_0x3f8d('0x20')](),_0x182af0);},TIME);});}function defaultLicense(){var _0x484152=hardware[_0x3f8d('0x20')]();if(_0x484152){return db[_0x3f8d('0x21')][_0x3f8d('0x22')]({'where':{'id':0x1},'defaults':{'data1':_0x484152}})[_0x3f8d('0x23')](function(_0x1bd94f,_0x324e65){logger[_0x3f8d('0x10')](_0x3f8d('0x24'),_0x484152);manageLicense(_0x484152,_0x1bd94f);})[_0x3f8d('0xc')](function(_0x1ab730){logger[_0x3f8d('0x1d')](_0x1ab730[_0x3f8d('0x1e')]);});}}exports[_0x3f8d('0x25')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index 58a046d..10e27eb 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 _0x0659=['isEmpty','License\x20key\x20value\x20not\x20found','data2','split','format','demo','uuid','machineUuid','decryptString','gray','deadline','add','days','grayReason','changed','disabled','message','User','sequelize','COUNT','role','count','admin','telephone','user','pick','countBy','License\x20limit\x20reached\x20for\x20users','util','moment','bluebird','./hardware','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','find','defaults','then','catch','data1','license'];(function(_0x1a4e80,_0x2b65e7){var _0x1f3ee0=function(_0x94bb0f){while(--_0x94bb0f){_0x1a4e80['push'](_0x1a4e80['shift']());}};_0x1f3ee0(++_0x2b65e7);}(_0x0659,0x11e));var _0x9065=function(_0x456e47,_0x1bfc8f){_0x456e47=_0x456e47-0x0;var _0x45cdc7=_0x0659[_0x456e47];return _0x45cdc7;};'use strict';var util=require(_0x9065('0x0'));var _=require('lodash');var moment=require(_0x9065('0x1'));var BPromise=require(_0x9065('0x2'));var hardware=require(_0x9065('0x3'));var encryptor=require(_0x9065('0x4'));var db=require(_0x9065('0x5'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x9065('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x9065('0x7'),'machineUuid':hardware[_0x9065('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x9065('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':'Breaking\x20license','machineUuid':hardware[_0x9065('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x58db55){return new BPromise(function(_0x3a8a42,_0x4b0ffc){return db['License'][_0x9065('0x9')](_[_0x9065('0xa')](_0x58db55,{'raw':!![],'where':{'id':0x1}}))[_0x9065('0xb')](function(_0x4e0ceb){return checkLicense(_0x4e0ceb,null);})[_0x9065('0xb')](function(_0x307dfc){_0x3a8a42(_0x307dfc);return;})[_0x9065('0xc')](function(_0x37f143){_0x4b0ffc(_0x37f143);});});}function checkLicense(_0x596607,_0x19133e){if(!_0x596607){demoLicense['uuid']=_0x596607[_0x9065('0xd')];return demoLicense;}try{var _0x33214c=_0x19133e||_0x596607[_0x9065('0xe')];if(_[_0x9065('0xf')](_0x33214c)){throw new Error(_0x9065('0x10'));}var _0x3bbd9d=_0x596607[_0x9065('0xd')];var _0x7804f0=_0x596607[_0x9065('0x11')];var _0x4e1e9e=_0x3bbd9d[_0x9065('0x12')]('-')[0x4];var _0x288cc6=_0x3bbd9d[_0x9065('0x12')]('-')[0x0];var _0x1c9eef=encryptor['decryptString'](_0x33214c,util[_0x9065('0x13')]('%s:%s:%s',_0x4e1e9e,_0x3bbd9d,_0x288cc6));var _0x3b9389=JSON['parse'](_0x1c9eef);_0x3b9389[_0x9065('0x14')]=![];_0x3b9389[_0x9065('0x15')]=_0x3bbd9d;_0x3b9389[_0x9065('0x16')]=hardware['getUuid']();if(_0x7804f0){var _0x3ece19=encryptor[_0x9065('0x17')](_0x7804f0);_0x3b9389[_0x9065('0x18')]=_0x3ece19;_0x3b9389[_0x9065('0x19')]=moment(_0x3ece19)[_0x9065('0x1a')](0x7,_0x9065('0x1b'))[_0x9065('0x13')]();_0x3b9389[_0x9065('0x1c')]=_0x3b9389[_0x9065('0x15')]!=_0x3b9389[_0x9065('0x16')]?_0x9065('0x1d'):_0x9065('0x1e');}return _0x3b9389;}catch(_0x249e37){breakingLicense[_0x9065('0x15')]=_0x596607[_0x9065('0xd')];breakingLicense['message']=_0x249e37[_0x9065('0x1f')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x244d4b,_0x13b3b7){getLicense()['then'](function(_0x27baa2){return db[_0x9065('0x20')]['findAll']({'attributes':['role',[db[_0x9065('0x21')]['fn'](_0x9065('0x22'),db[_0x9065('0x21')]['col'](_0x9065('0x23'))),_0x9065('0x24')]],'group':_0x9065('0x23'),'where':{'role':{'$or':[_0x9065('0x25'),'user',_0x9065('0x26')]}},'raw':!![]})[_0x9065('0xb')](function(_0x27ba72){var _0x8c75ed={'user':_0x27baa2['users']||0x0,'telephone':_0x27baa2['telephones']||0x0};_0x27ba72['forEach'](function(_0x59eed4){var _0x5195db=_0x59eed4[_0x9065('0x23')]==='admin'?_0x9065('0x27'):_0x59eed4[_0x9065('0x23')];_0x8c75ed[_0x5195db]-=_0x59eed4['count'];if(_0x8c75ed[_0x5195db]<0x0)_0x8c75ed[_0x5195db]=0x0;});_0x244d4b(_0x8c75ed);return;});})[_0x9065('0xc')](function(_0x4b9bf6){_0x13b3b7(_0x4b9bf6);});});}function checkUserLimits(_0x11f39c){return new BPromise(function(_0x18fddc,_0x13829f){getLimits()[_0x9065('0xb')](function(_0x17af3f){var _0x4f7954=_[_0x9065('0x28')](_[_0x9065('0x29')](_0x11f39c,'role'),[_0x9065('0x25'),_0x9065('0x27'),'telephone']);var _0x2eefa0=(_0x4f7954[_0x9065('0x25')]||0x0)+(_0x4f7954[_0x9065('0x27')]||0x0);var _0xcb5e0a=_0x4f7954[_0x9065('0x26')]||0x0;if(_0x2eefa0>_0x17af3f[_0x9065('0x27')])return _0x13829f(_0x9065('0x2a'));if(_0xcb5e0a>_0x17af3f[_0x9065('0x26')])return _0x13829f('License\x20limit\x20reached\x20for\x20telephones');return _0x18fddc();})['catch'](function(_0x5c144e){_0x13829f(_0x5c144e);});});}module['exports']={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0xf139=['uuid','disabled','message','User','findAll','role','sequelize','COUNT','count','admin','user','telephone','users','telephones','forEach','pick','countBy','License\x20limit\x20reached\x20for\x20users','exports','util','moment','bluebird','./hardware','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','Breaking\x20license','License','find','defaults','then','catch','data1','license','isEmpty','License\x20key\x20value\x20not\x20found','data2','split','decryptString','format','%s:%s:%s','parse','demo','machineUuid','gray','add','days'];(function(_0x3c76fc,_0x39e116){var _0x4755f5=function(_0x493e01){while(--_0x493e01){_0x3c76fc['push'](_0x3c76fc['shift']());}};_0x4755f5(++_0x39e116);}(_0xf139,0x19b));var _0x9f13=function(_0x144a06,_0x3efa35){_0x144a06=_0x144a06-0x0;var _0x4e3388=_0xf139[_0x144a06];return _0x4e3388;};'use strict';var util=require(_0x9f13('0x0'));var _=require('lodash');var moment=require(_0x9f13('0x1'));var BPromise=require(_0x9f13('0x2'));var hardware=require(_0x9f13('0x3'));var encryptor=require(_0x9f13('0x4'));var db=require(_0x9f13('0x5'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x9f13('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x9f13('0x7'),'machineUuid':hardware[_0x9f13('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x9f13('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x9f13('0x9'),'machineUuid':hardware[_0x9f13('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x5621e1){return new BPromise(function(_0x56de53,_0x78500e){return db[_0x9f13('0xa')][_0x9f13('0xb')](_[_0x9f13('0xc')](_0x5621e1,{'raw':!![],'where':{'id':0x1}}))[_0x9f13('0xd')](function(_0x564663){return checkLicense(_0x564663,null);})['then'](function(_0x57aaff){_0x56de53(_0x57aaff);return;})[_0x9f13('0xe')](function(_0x49323a){_0x78500e(_0x49323a);});});}function checkLicense(_0x4efab2,_0x4f5064){if(!_0x4efab2){demoLicense['uuid']=_0x4efab2[_0x9f13('0xf')];return demoLicense;}try{var _0x4f092e=_0x4f5064||_0x4efab2[_0x9f13('0x10')];if(_[_0x9f13('0x11')](_0x4f092e)){throw new Error(_0x9f13('0x12'));}var _0x58af5c=_0x4efab2['data1'];var _0x3a4340=_0x4efab2[_0x9f13('0x13')];var _0x4555ea=_0x58af5c[_0x9f13('0x14')]('-')[0x4];var _0x48fac2=_0x58af5c[_0x9f13('0x14')]('-')[0x0];var _0x7f2962=encryptor[_0x9f13('0x15')](_0x4f092e,util[_0x9f13('0x16')](_0x9f13('0x17'),_0x4555ea,_0x58af5c,_0x48fac2));var _0x17bba6=JSON[_0x9f13('0x18')](_0x7f2962);_0x17bba6[_0x9f13('0x19')]=![];_0x17bba6['uuid']=_0x58af5c;_0x17bba6[_0x9f13('0x1a')]=hardware[_0x9f13('0x8')]();if(_0x3a4340){var _0x5a9b82=encryptor[_0x9f13('0x15')](_0x3a4340);_0x17bba6[_0x9f13('0x1b')]=_0x5a9b82;_0x17bba6['deadline']=moment(_0x5a9b82)[_0x9f13('0x1c')](0x7,_0x9f13('0x1d'))[_0x9f13('0x16')]();_0x17bba6['grayReason']=_0x17bba6[_0x9f13('0x1e')]!=_0x17bba6[_0x9f13('0x1a')]?'changed':_0x9f13('0x1f');}return _0x17bba6;}catch(_0x5bc41b){breakingLicense[_0x9f13('0x1e')]=_0x4efab2[_0x9f13('0xf')];breakingLicense['message']=_0x5bc41b[_0x9f13('0x20')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x57f240,_0x2cde58){getLicense()[_0x9f13('0xd')](function(_0x22d9a5){return db[_0x9f13('0x21')][_0x9f13('0x22')]({'attributes':[_0x9f13('0x23'),[db[_0x9f13('0x24')]['fn'](_0x9f13('0x25'),db['sequelize']['col'](_0x9f13('0x23'))),_0x9f13('0x26')]],'group':_0x9f13('0x23'),'where':{'role':{'$or':[_0x9f13('0x27'),_0x9f13('0x28'),_0x9f13('0x29')]}},'raw':!![]})[_0x9f13('0xd')](function(_0x24f1e6){var _0x2c7f98={'user':_0x22d9a5[_0x9f13('0x2a')]||0x0,'telephone':_0x22d9a5[_0x9f13('0x2b')]||0x0};_0x24f1e6[_0x9f13('0x2c')](function(_0x331be8){var _0x1cc563=_0x331be8[_0x9f13('0x23')]===_0x9f13('0x27')?_0x9f13('0x28'):_0x331be8[_0x9f13('0x23')];_0x2c7f98[_0x1cc563]-=_0x331be8[_0x9f13('0x26')];if(_0x2c7f98[_0x1cc563]<0x0)_0x2c7f98[_0x1cc563]=0x0;});_0x57f240(_0x2c7f98);return;});})[_0x9f13('0xe')](function(_0x4ea5ee){_0x2cde58(_0x4ea5ee);});});}function checkUserLimits(_0x41448d){return new BPromise(function(_0x416b67,_0x58ea4f){getLimits()[_0x9f13('0xd')](function(_0x48bbe5){var _0xce70b0=_[_0x9f13('0x2d')](_[_0x9f13('0x2e')](_0x41448d,_0x9f13('0x23')),[_0x9f13('0x27'),_0x9f13('0x28'),_0x9f13('0x29')]);var _0x34d58f=(_0xce70b0['admin']||0x0)+(_0xce70b0[_0x9f13('0x28')]||0x0);var _0x35328a=_0xce70b0['telephone']||0x0;if(_0x34d58f>_0x48bbe5[_0x9f13('0x28')])return _0x58ea4f(_0x9f13('0x2f'));if(_0x35328a>_0x48bbe5['telephone'])return _0x58ea4f('License\x20limit\x20reached\x20for\x20telephones');return _0x416b67();})['catch'](function(_0x409754){_0x58ea4f(_0x409754);});});}module[_0x9f13('0x30')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file diff --git a/server/config/local.env.js b/server/config/local.env.js index a8a639f..dd642cb 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 _0x8f4c=['exports','http://localhost:9000','myappanuglar-secret','app-id','secret'];(function(_0x2d85c6,_0x542a2b){var _0xa232f8=function(_0x5caf87){while(--_0x5caf87){_0x2d85c6['push'](_0x2d85c6['shift']());}};_0xa232f8(++_0x542a2b);}(_0x8f4c,0x113));var _0xc8f4=function(_0x206de1,_0x42247b){_0x206de1=_0x206de1-0x0;var _0x5bd6a8=_0x8f4c[_0x206de1];return _0x5bd6a8;};'use strict';module[_0xc8f4('0x0')]={'DOMAIN':_0xc8f4('0x1'),'SESSION_SECRET':_0xc8f4('0x2'),'GOOGLE_ID':_0xc8f4('0x3'),'GOOGLE_SECRET':_0xc8f4('0x4'),'DEBUG':''}; \ No newline at end of file +var _0xbbbc=['secret','exports','http://localhost:9000','myappanuglar-secret','app-id'];(function(_0x31721d,_0x3c722c){var _0x343a41=function(_0x42dff8){while(--_0x42dff8){_0x31721d['push'](_0x31721d['shift']());}};_0x343a41(++_0x3c722c);}(_0xbbbc,0xf6));var _0xcbbb=function(_0x3a77ce,_0x486ee8){_0x3a77ce=_0x3a77ce-0x0;var _0xe885c7=_0xbbbc[_0x3a77ce];return _0xe885c7;};'use strict';module[_0xcbbb('0x0')]={'DOMAIN':_0xcbbb('0x1'),'SESSION_SECRET':_0xcbbb('0x2'),'GOOGLE_ID':_0xcbbb('0x3'),'GOOGLE_SECRET':_0xcbbb('0x4'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 0bc60c5..42b3e73 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2997=['exports','../utils/loggers'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x2997,0x17b));var _0x7299=function(_0x3c1099,_0x4cd808){_0x3c1099=_0x3c1099-0x0;var _0x1ae4bf=_0x2997[_0x3c1099];return _0x1ae4bf;};'use strict';var fileLogger=require(_0x7299('0x0'))['fileLogger'];module[_0x7299('0x1')]=fileLogger; \ No newline at end of file +var _0xfe7f=['fileLogger','exports'];(function(_0x34bc94,_0x74f0fd){var _0xee41e7=function(_0x424111){while(--_0x424111){_0x34bc94['push'](_0x34bc94['shift']());}};_0xee41e7(++_0x74f0fd);}(_0xfe7f,0x1e4));var _0xffe7=function(_0x139d53,_0x2fb64a){_0x139d53=_0x139d53-0x0;var _0x5ad7a7=_0xfe7f[_0x139d53];return _0x5ad7a7;};'use strict';var fileLogger=require('../utils/loggers')[_0xffe7('0x0')];module[_0xffe7('0x1')]=fileLogger; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index 279c07e..9de5600 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 _0x1310=['path','../../config/environment','resolve','join','root','legacy-libs','../../services/express/index.js','ami','../../services/ami/index.js','agi','../../services/agi/index.js','email','../../services/email/index.js','../../services/routing/index.js','xdr','../../services/xdr/index.js','exports'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x1310,0x1ed));var _0x0131=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x1310[_0x321bb2];return _0x9c12ed;};'use strict';var path=require(_0x0131('0x0'));var cfg=require(_0x0131('0x1'));var env={'NODE_PATH':path[_0x0131('0x2')](path[_0x0131('0x3')](cfg[_0x0131('0x4')],_0x0131('0x5')))};var pm2config={'apps':[{'name':'express','script':path[_0x0131('0x3')](__dirname,_0x0131('0x6')),'env':env},{'name':_0x0131('0x7'),'script':path['join'](__dirname,_0x0131('0x8')),'env':env},{'name':_0x0131('0x9'),'script':path[_0x0131('0x3')](__dirname,_0x0131('0xa')),'env':env},{'name':_0x0131('0xb'),'script':path[_0x0131('0x3')](__dirname,_0x0131('0xc')),'env':env},{'name':'routing','script':path[_0x0131('0x3')](__dirname,_0x0131('0xd')),'env':env},{'name':_0x0131('0xe'),'script':path[_0x0131('0x3')](__dirname,_0x0131('0xf')),'env':env}]};module[_0x0131('0x10')]=pm2config; \ No newline at end of file +var _0xf7a4=['join','../../services/ami/index.js','email','../../services/email/index.js','routing','../../services/routing/index.js','xdr','../../services/xdr/index.js','exports','path','../../config/environment','resolve','legacy-libs','express','ami'];(function(_0x3747ae,_0x408e61){var _0x339035=function(_0x83be87){while(--_0x83be87){_0x3747ae['push'](_0x3747ae['shift']());}};_0x339035(++_0x408e61);}(_0xf7a4,0x9f));var _0x4f7a=function(_0x101e7b,_0x4ef05b){_0x101e7b=_0x101e7b-0x0;var _0x4995c0=_0xf7a4[_0x101e7b];return _0x4995c0;};'use strict';var path=require(_0x4f7a('0x0'));var cfg=require(_0x4f7a('0x1'));var env={'NODE_PATH':path[_0x4f7a('0x2')](path['join'](cfg['root'],_0x4f7a('0x3')))};var pm2config={'apps':[{'name':_0x4f7a('0x4'),'script':path['join'](__dirname,'../../services/express/index.js'),'env':env},{'name':_0x4f7a('0x5'),'script':path[_0x4f7a('0x6')](__dirname,_0x4f7a('0x7')),'env':env},{'name':'agi','script':path[_0x4f7a('0x6')](__dirname,'../../services/agi/index.js'),'env':env},{'name':_0x4f7a('0x8'),'script':path['join'](__dirname,_0x4f7a('0x9')),'env':env},{'name':_0x4f7a('0xa'),'script':path[_0x4f7a('0x6')](__dirname,_0x4f7a('0xb')),'env':env},{'name':_0x4f7a('0xc'),'script':path[_0x4f7a('0x6')](__dirname,_0x4f7a('0xd')),'env':env}]};module[_0x4f7a('0xe')]=pm2config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 3ca59f0..ff841c0 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 _0x4d62=['disconnect','then','restart','list','delete','dump','saved','pm2','bluebird','./config','connect','connected','start'];(function(_0x2ae408,_0x3f70b6){var _0x4fc988=function(_0x4d7f01){while(--_0x4d7f01){_0x2ae408['push'](_0x2ae408['shift']());}};_0x4fc988(++_0x3f70b6);}(_0x4d62,0x10b));var _0x24d6=function(_0x3fe613,_0x6f7d4d){_0x3fe613=_0x3fe613-0x0;var _0x14d091=_0x4d62[_0x3fe613];return _0x14d091;};'use strict';var pm2=require(_0x24d6('0x0'));var BPromise=require(_0x24d6('0x1'));var config=require(_0x24d6('0x2'));function connect(){return new BPromise(function(_0x536ddd,_0x5c17e9){return pm2[_0x24d6('0x3')](function(_0x843a28){if(_0x843a28){return _0x5c17e9(_0x843a28);}return _0x536ddd(_0x24d6('0x4'));});});};exports['start']=function(_0x53253a){return connect()['then'](function(){return new BPromise(function(_0x3a5350,_0x20171e){return pm2[_0x24d6('0x5')](_0x53253a,function(_0x11dcaa,_0xdb1c10){if(_0x11dcaa){return _0x20171e(_0x11dcaa);}pm2[_0x24d6('0x6')]();return _0x3a5350(_0xdb1c10);});});});};exports['stop']=function(_0x50e336){return connect()[_0x24d6('0x7')](function(){return new BPromise(function(_0x1747c2,_0x29a5af){return pm2['stop'](_0x50e336,function(_0x2ce371,_0x24ede0){if(_0x2ce371){return _0x29a5af(_0x2ce371);}pm2['disconnect']();return _0x1747c2(_0x24ede0);});});});};exports[_0x24d6('0x8')]=function(_0x420b74){return connect()['then'](function(){return new BPromise(function(_0x306477,_0x5c231d){return pm2[_0x24d6('0x8')](_0x420b74,function(_0x568a93,_0x373952){if(_0x568a93){return _0x5c231d(_0x568a93);}pm2[_0x24d6('0x6')]();return _0x306477(_0x373952);});});});};exports[_0x24d6('0x9')]=function(){return connect()[_0x24d6('0x7')](function(){return new BPromise(function(_0x3477bf,_0x5c95df){return pm2[_0x24d6('0x9')](function(_0x3db6d2,_0x3e8c5a){if(_0x3db6d2){return _0x5c95df(_0x3db6d2);}pm2[_0x24d6('0x6')]();return _0x3477bf(_0x3e8c5a);});});});};exports['describe']=function(_0x2a731d){return connect()[_0x24d6('0x7')](function(){return new BPromise(function(_0x14079e,_0x1c59c5){return pm2['describe'](_0x2a731d,function(_0x2f3b8b,_0x17d22e){if(_0x2f3b8b){return _0x1c59c5(_0x2f3b8b);}pm2[_0x24d6('0x6')]();return _0x14079e(_0x17d22e);});});});};exports[_0x24d6('0xa')]=function(_0x50d641){return connect()[_0x24d6('0x7')](function(){return new BPromise(function(_0x191b58,_0x188796){return pm2[_0x24d6('0xa')](_0x50d641,function(_0x34746a,_0x541dfc){if(_0x34746a){return _0x188796(_0x34746a);}pm2['disconnect']();return _0x191b58(_0x541dfc);});});});};exports[_0x24d6('0xb')]=function(){return connect()['then'](function(){return new BPromise(function(_0x3a6236,_0x196fcc){return pm2[_0x24d6('0xb')](function(_0x5178c3){if(_0x5178c3){return _0x196fcc(_0x5178c3);}return _0x3a6236(_0x24d6('0xc'));});});});}; \ No newline at end of file +var _0x917c=['saved','./config','connected','then','start','disconnect','stop','restart','list','describe','dump'];(function(_0x159eab,_0x22d972){var _0x47e933=function(_0x58e802){while(--_0x58e802){_0x159eab['push'](_0x159eab['shift']());}};_0x47e933(++_0x22d972);}(_0x917c,0x1ae));var _0xc917=function(_0x5586a7,_0x276a61){_0x5586a7=_0x5586a7-0x0;var _0x379a38=_0x917c[_0x5586a7];return _0x379a38;};'use strict';var pm2=require('pm2');var BPromise=require('bluebird');var config=require(_0xc917('0x0'));function connect(){return new BPromise(function(_0x2b51d9,_0x1e7909){return pm2['connect'](function(_0x46e04d){if(_0x46e04d){return _0x1e7909(_0x46e04d);}return _0x2b51d9(_0xc917('0x1'));});});};exports['start']=function(_0xc88e7d){return connect()[_0xc917('0x2')](function(){return new BPromise(function(_0x825e57,_0xdfab1d){return pm2[_0xc917('0x3')](_0xc88e7d,function(_0x33faa7,_0x4cccce){if(_0x33faa7){return _0xdfab1d(_0x33faa7);}pm2[_0xc917('0x4')]();return _0x825e57(_0x4cccce);});});});};exports[_0xc917('0x5')]=function(_0x4ed111){return connect()[_0xc917('0x2')](function(){return new BPromise(function(_0xefd09c,_0x4ce6cc){return pm2[_0xc917('0x5')](_0x4ed111,function(_0x26e5b4,_0x253c2a){if(_0x26e5b4){return _0x4ce6cc(_0x26e5b4);}pm2['disconnect']();return _0xefd09c(_0x253c2a);});});});};exports[_0xc917('0x6')]=function(_0x1a9bd1){return connect()[_0xc917('0x2')](function(){return new BPromise(function(_0x1763f3,_0x4b3d12){return pm2['restart'](_0x1a9bd1,function(_0x4faebc,_0xf7b318){if(_0x4faebc){return _0x4b3d12(_0x4faebc);}pm2['disconnect']();return _0x1763f3(_0xf7b318);});});});};exports['list']=function(){return connect()[_0xc917('0x2')](function(){return new BPromise(function(_0x1fcfbc,_0x15f158){return pm2[_0xc917('0x7')](function(_0x1f2814,_0x4d5bce){if(_0x1f2814){return _0x15f158(_0x1f2814);}pm2[_0xc917('0x4')]();return _0x1fcfbc(_0x4d5bce);});});});};exports[_0xc917('0x8')]=function(_0xbd29bb){return connect()[_0xc917('0x2')](function(){return new BPromise(function(_0x324495,_0x4eb705){return pm2[_0xc917('0x8')](_0xbd29bb,function(_0x2dcda2,_0x16ed31){if(_0x2dcda2){return _0x4eb705(_0x2dcda2);}pm2[_0xc917('0x4')]();return _0x324495(_0x16ed31);});});});};exports['delete']=function(_0x4e7c86){return connect()['then'](function(){return new BPromise(function(_0x23a1ca,_0x1a43f4){return pm2['delete'](_0x4e7c86,function(_0x13987f,_0x5ae340){if(_0x13987f){return _0x1a43f4(_0x13987f);}pm2[_0xc917('0x4')]();return _0x23a1ca(_0x5ae340);});});});};exports[_0xc917('0x9')]=function(){return connect()[_0xc917('0x2')](function(){return new BPromise(function(_0x4db39d,_0xb79741){return pm2[_0xc917('0x9')](function(_0x25ae22){if(_0x25ae22){return _0xb79741(_0x25ae22);}return _0x4db39d(_0xc917('0xa'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 64e38ca..f70ecdc 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 _0xecb3=['../../config/environment','../../mysqldb','../logger','redis','defaults','localhost','socket.io-emitter','find','chatTimeout','then','ChatInteraction','findAll','lastMsgAt','subtract','length','info','[CHAT]\x20Interactions\x20to\x20close:','join','update','system','timeout','format','catch','error','inspect','start','lodash','moment','ioredis'];(function(_0x2fa78e,_0x1c8d34){var _0x3e6353=function(_0x1469c1){while(--_0x1469c1){_0x2fa78e['push'](_0x2fa78e['shift']());}};_0x3e6353(++_0x1c8d34);}(_0xecb3,0x1b0));var _0x3ecb=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xecb3[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x3ecb('0x0'));var moment=require(_0x3ecb('0x1'));var Redis=require(_0x3ecb('0x2'));var util=require('util');var config=require(_0x3ecb('0x3'));var db=require(_0x3ecb('0x4'))['db'];var logger=require(_0x3ecb('0x5'))('schedule');config[_0x3ecb('0x6')]=_[_0x3ecb('0x7')](config['redis'],{'host':_0x3ecb('0x8'),'port':0x18eb});var io=require(_0x3ecb('0x9'))(new Redis(config['redis']));function closeInteractions(){var _0x1ff94c=0x0;var _0x3fe21d=[];return db['Setting'][_0x3ecb('0xa')]({'raw':!![],'attributes':['id',_0x3ecb('0xb')],'where':{'id':0x1}})[_0x3ecb('0xc')](function(_0x4debd5){_0x1ff94c=_0x4debd5[_0x3ecb('0xb')];if(_0x1ff94c){return db[_0x3ecb('0xd')][_0x3ecb('0xe')]({'raw':!![],'attributes':['id',_0x3ecb('0xf')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x3ecb('0x10')](_0x4debd5['chatTimeout'],'minutes')}}});}else{return[];}})[_0x3ecb('0xc')](function(_0x52b0f6){if(_0x52b0f6&&_0x52b0f6[_0x3ecb('0x11')]){_0x3fe21d=_['map'](_0x52b0f6||[],'id');logger[_0x3ecb('0x12')](_0x3ecb('0x13'),_0x3fe21d[_0x3ecb('0x14')]());return db['ChatInteraction'][_0x3ecb('0x15')]({'closeReason':_0x3ecb('0x16'),'disposition':_0x3ecb('0x17'),'closed':!![],'closedAt':moment()[_0x3ecb('0x18')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x3fe21d}});}})[_0x3ecb('0xc')](function(){if(_0x3fe21d&&_0x3fe21d[_0x3ecb('0x11')]){logger[_0x3ecb('0x12')]('[CHAT]\x20Sending\x20updates\x20for\x20interactions:',_0x3fe21d[_0x3ecb('0x14')]());for(var _0x944d0d=0x0;_0x944d0d<_0x3fe21d[_0x3ecb('0x11')];_0x944d0d++){io['emit']('chatInteraction:update',{'id':_0x3fe21d[_0x944d0d],'closed':!![]});}}})[_0x3ecb('0x19')](function(_0x2bf6dc){logger[_0x3ecb('0x1a')]('[CHAT]\x20Error\x20closing\x20interactions',_0x2bf6dc?util[_0x3ecb('0x1b')](_0x2bf6dc,{'showHidden':![],'depth':null}):'');});}exports[_0x3ecb('0x1c')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xb64c=['[CHAT]\x20Interactions\x20to\x20close:','update','system','timeout','format','then','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','join','emit','catch','[CHAT]\x20Error\x20closing\x20interactions','start','lodash','moment','util','../../config/environment','../../mysqldb','schedule','redis','defaults','localhost','Setting','find','chatTimeout','ChatInteraction','findAll','lastMsgAt','subtract','minutes','length','info'];(function(_0x18425e,_0x2de6de){var _0x334a95=function(_0x2168ed){while(--_0x2168ed){_0x18425e['push'](_0x18425e['shift']());}};_0x334a95(++_0x2de6de);}(_0xb64c,0xa7));var _0xcb64=function(_0x1098ec,_0x2afc61){_0x1098ec=_0x1098ec-0x0;var _0x35b0ca=_0xb64c[_0x1098ec];return _0x35b0ca;};'use strict';var _=require(_0xcb64('0x0'));var moment=require(_0xcb64('0x1'));var Redis=require('ioredis');var util=require(_0xcb64('0x2'));var config=require(_0xcb64('0x3'));var db=require(_0xcb64('0x4'))['db'];var logger=require('../logger')(_0xcb64('0x5'));config[_0xcb64('0x6')]=_[_0xcb64('0x7')](config[_0xcb64('0x6')],{'host':_0xcb64('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xcb64('0x6')]));function closeInteractions(){var _0x2d2bc0=0x0;var _0x7444dc=[];return db[_0xcb64('0x9')][_0xcb64('0xa')]({'raw':!![],'attributes':['id','chatTimeout'],'where':{'id':0x1}})['then'](function(_0x3ccbe5){_0x2d2bc0=_0x3ccbe5[_0xcb64('0xb')];if(_0x2d2bc0){return db[_0xcb64('0xc')][_0xcb64('0xd')]({'raw':!![],'attributes':['id',_0xcb64('0xe')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0xcb64('0xf')](_0x3ccbe5['chatTimeout'],_0xcb64('0x10'))}}});}else{return[];}})['then'](function(_0x1ab56a){if(_0x1ab56a&&_0x1ab56a[_0xcb64('0x11')]){_0x7444dc=_['map'](_0x1ab56a||[],'id');logger[_0xcb64('0x12')](_0xcb64('0x13'),_0x7444dc['join']());return db[_0xcb64('0xc')][_0xcb64('0x14')]({'closeReason':_0xcb64('0x15'),'disposition':_0xcb64('0x16'),'closed':!![],'closedAt':moment()[_0xcb64('0x17')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x7444dc}});}})[_0xcb64('0x18')](function(){if(_0x7444dc&&_0x7444dc[_0xcb64('0x11')]){logger[_0xcb64('0x12')](_0xcb64('0x19'),_0x7444dc[_0xcb64('0x1a')]());for(var _0x52e568=0x0;_0x52e568<_0x7444dc['length'];_0x52e568++){io[_0xcb64('0x1b')]('chatInteraction:update',{'id':_0x7444dc[_0x52e568],'closed':!![]});}}})[_0xcb64('0x1c')](function(_0x340615){logger['error'](_0xcb64('0x1d'),_0x340615?util['inspect'](_0x340615,{'showHidden':![],'depth':null}):'');});}exports[_0xcb64('0x1e')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/schedule/cloud-provider.js b/server/config/schedule/cloud-provider.js index fcbeee3..2c4b7ea 100644 --- a/server/config/schedule/cloud-provider.js +++ b/server/config/schedule/cloud-provider.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3f31=['startAllRefreshIntervals','exports','../../api/cloudProvider/cloudProvider.oauth.js'];(function(_0x56825b,_0x172b8d){var _0x69ce77=function(_0x348a1c){while(--_0x348a1c){_0x56825b['push'](_0x56825b['shift']());}};_0x69ce77(++_0x172b8d);}(_0x3f31,0xa1));var _0x13f3=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x3f31[_0xa464c9];return _0x3d73c4;};'use strict';function start(){var _0x3a91e9=require(_0x13f3('0x0'));return _0x3a91e9[_0x13f3('0x1')]();}module[_0x13f3('0x2')]={'intervals':{},'start':start}; \ No newline at end of file +'use strict';function start(){var _0x40ef2f=require('../../api/cloudProvider/cloudProvider.oauth.js');return _0x40ef2f['startAllRefreshIntervals']();}module['exports']={'intervals':{},'start':start}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index 07b689c..0aed5c0 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 _0xe75e=['../logger','schedule','../../mysqldb','retry','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','number','AnalyticExtractedReport','findOne','then','catch','error','info','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','getSmtpOptions','format','\x22%s\x22\x20<%s>','name','Smtp','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','subtractUnit','join','savename','basename','extname','existsSync','message','attachments','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','status','Sent','Empty','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','Loading','Report\x20still\x20running\x20after\x20timeout.\x0aYou\x20can\x20find\x20the\x20report\x20when\x20it\x20will\x20be\x20completed\x20in\x20Analytics\x20->\x20Extracted\x20Reports.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','Completed','Report\x20file\x20creation\x20still\x20running\x20after\x20timeout.\x0aYou\x20can\x20find\x20the\x20report\x20when\x20it\x20will\x20be\x20completed\x20in\x20Analytics\x20->\x20Extracted\x20Reports.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','[handleSendEmail]\x20Unrecognized\x20status:','request','error\x20mail','email\x20sent','stringify','currentAttempt','retryOptions','retries','job','data','operation','stop','still\x20loading','case\x20completed','case\x20empty','case\x20failed','entity','attempt','\x20Attempt\x20#:','report\x20status:','dataValues','sendMail','isNil','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','exec\x20defaul\x20report\x20id:%s','DefaultReportId','CustomReportId','exec\x20custom\x20report\x20id:%s','no\x20report\x20id','findAll','MailServerOut','CloudProvider','keys','map','toString','keyBy','difference','intersection','exists','deleteJob','delete\x20cron','toRun','resolve','active','endAt','add','start','add\x20cron','stop\x20cron','cron','isBetween','update','update\x20cron','path','lodash','cron-job-manager','jayson/promise','bluebird'];(function(_0x187ee1,_0x3fd1e6){var _0x388160=function(_0x542dd2){while(--_0x542dd2){_0x187ee1['push'](_0x187ee1['shift']());}};_0x388160(++_0x3fd1e6);}(_0xe75e,0x65));var _0xee75=function(_0x45c48f,_0x4aa891){_0x45c48f=_0x45c48f-0x0;var _0xaf5037=_0xe75e[_0x45c48f];return _0xaf5037;};'use strict';var fs=require('fs');var util=require('util');var path=require(_0xee75('0x0'));var _=require(_0xee75('0x1'));var moment=require('moment');var CronJobManager=require(_0xee75('0x2'));var jayson=require(_0xee75('0x3'));var BPromise=require(_0xee75('0x4'));var logger=require(_0xee75('0x5'))(_0xee75('0x6'));var db=require(_0xee75('0x7'))['db'];const retry=require(_0xee75('0x8'));var analyticCustomReportController=require(_0xee75('0x9'));var analyticDefaultReportController=require(_0xee75('0xa'));var client=jayson[_0xee75('0xb')][_0xee75('0xc')]({'port':0x232b});var manager=new CronJobManager();function getReportData(_0x44fdd7){const _0x3b8f82={};if(typeof _0x44fdd7===_0xee75('0xd')){_0x3b8f82['id']=_0x44fdd7;}return db[_0xee75('0xe')][_0xee75('0xf')]({'where':_0x3b8f82})[_0xee75('0x10')](function(_0x286461){return _0x286461;})[_0xee75('0x11')](function(_0x1c0dcd){logger[_0xee75('0x12')](_0x1c0dcd);});}function handleSendEmail(_0x45d0b0,_0x34f12d){logger[_0xee75('0x13')](_0xee75('0x14'),_0x45d0b0[_0xee75('0x15')]);var _0x573667=!![];var _0x3da81e=_0x45d0b0[_0xee75('0x16')][_0xee75('0x17')]();var _0x376774={'account':_0x3da81e,'message':{'from':util[_0xee75('0x18')](_0xee75('0x19'),_0x45d0b0['MailAccount'][_0xee75('0x1a')],_0x45d0b0['MailAccount']['email']||_0x45d0b0[_0xee75('0x16')][_0xee75('0x1b')]['user']),'to':_0x45d0b0['email'],'cc':_0x45d0b0['cc'],'bcc':_0x45d0b0[_0xee75('0x1c')],'subject':util[_0xee75('0x18')](_0xee75('0x1d'),_0x34f12d[_0xee75('0x1a')],_0x45d0b0[_0xee75('0x1e')],_0x45d0b0[_0xee75('0x1f')])}};var _0xc7f1aa=path[_0xee75('0x20')](__dirname,'../../files/reports');var _0x210040=_0x34f12d[_0xee75('0x21')];var _0x23903f=util[_0xee75('0x18')]('%s.%s',path[_0xee75('0x22')](_0x34f12d[_0xee75('0x21')],path[_0xee75('0x23')](_0x34f12d[_0xee75('0x21')])),'zip');var _0x1f52b0=path[_0xee75('0x20')](_0xc7f1aa,_0x210040);var _0x3991f1=path['join'](_0xc7f1aa,_0x23903f);if(fs[_0xee75('0x24')](_0x1f52b0)){_0x34f12d['status']='Sent';_0x376774[_0xee75('0x25')][_0xee75('0x26')]=[{'filename':_0x210040,'path':_0x1f52b0}];_0x376774[_0xee75('0x25')][_0xee75('0x27')]=util[_0xee75('0x18')](_0xee75('0x28'),JSON['stringify'](_0x34f12d,null,0x2));}else if(fs['existsSync'](_0x3991f1)){_0x34f12d[_0xee75('0x29')]=_0xee75('0x2a');_0x376774[_0xee75('0x25')]['attachments']=[{'filename':_0x23903f,'path':_0x3991f1}];}else{if(_0x34f12d[_0xee75('0x29')]===_0xee75('0x2b')){_0x376774[_0xee75('0x25')][_0xee75('0x27')]=_0xee75('0x2c');if(!_0x45d0b0[_0xee75('0x2d')]){_0x573667=![];logger['info'](_0xee75('0x2e'));}}else if(_0x34f12d[_0xee75('0x29')]===_0xee75('0x2f')){_0x376774[_0xee75('0x25')]['text']=_0xee75('0x30');}else if(_0x34f12d[_0xee75('0x29')]===_0xee75('0x31')){_0x376774[_0xee75('0x25')][_0xee75('0x27')]=_0xee75('0x32');}else if(_0x34f12d['status']==='Failed'){_0x376774['message'][_0xee75('0x27')]='Report\x20extraction\x20procedure\x20has\x20run\x20into\x20an\x20unexpected\x20error.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';}else{logger['error'](_0xee75('0x33'),_0x34f12d[_0xee75('0x29')]);}}if(_0x573667){return client[_0xee75('0x34')]('SendMail',_0x376774)[_0xee75('0x10')](function(_0x5d5d0b){if(_0x5d5d0b[_0xee75('0x12')]){return logger['error'](_0xee75('0x35'),JSON['stringify'](_0x5d5d0b));}return logger[_0xee75('0x13')](_0xee75('0x36'));})[_0xee75('0x11')](function(_0x59b6eb){return logger[_0xee75('0x12')](_0xee75('0x35'),JSON[_0xee75('0x37')](_0x59b6eb));});}}function handleError(){return function(_0x26c763){return logger['error'](JSON['stringify'](_0x26c763));};}function loading(_0x34e146){logger[_0xee75('0x13')]('case\x20loading');if(_0x34e146[_0xee75('0x38')]===_0x34e146[_0xee75('0x39')][_0xee75('0x3a')]){handleSendEmail(_0x34e146[_0xee75('0x3b')],_0x34e146[_0xee75('0x3c')]);_0x34e146[_0xee75('0x3d')][_0xee75('0x3e')]();}else{_0x34e146['operation'][_0xee75('0x8')](_0xee75('0x3f'));}}function completed(_0x17c17e){logger[_0xee75('0x13')](_0xee75('0x40'));handleSendEmail(_0x17c17e[_0xee75('0x3b')],_0x17c17e['data']);_0x17c17e['operation'][_0xee75('0x3e')]();}function empty(_0x470083){logger[_0xee75('0x13')](_0xee75('0x41'));handleSendEmail(_0x470083[_0xee75('0x3b')],_0x470083['data']);_0x470083[_0xee75('0x3d')][_0xee75('0x3e')]();}function failed(_0x115554){logger['info'](_0xee75('0x42'));handleSendEmail(_0x115554['job'],_0x115554[_0xee75('0x3c')]);_0x115554[_0xee75('0x3d')][_0xee75('0x3e')]();}function urecognized(_0x483c72){logger[_0xee75('0x12')]('Unrecognized\x20status:',_0x483c72[_0xee75('0x43')]['dataValues'][_0xee75('0x29')]);_0x483c72['operation'][_0xee75('0x3e')]();}const reportStatusStrategies={'Loading':loading,'Completed':completed,'Empty':empty,'Failed':failed,'Unrecognized':urecognized};function retryer(_0x572540,_0x3eb394){const _0x4b0ba7={'retries':0x3,'factor':0x2,'minTimeout':0x5b*0x3e8,'maxTimeout':0xa*0x3c*0x3e8};const _0x5c5f50=retry[_0xee75('0x3d')](_0x4b0ba7);_0x5c5f50[_0xee75('0x44')](_0x21712d=>{logger[_0xee75('0x13')]('Job\x20ID\x20'+_0x572540['id']+_0xee75('0x45')+_0x21712d);try{getReportData(_0x3eb394['id'])[_0xee75('0x10')](function(_0x559da0){_0x3eb394=_0x559da0;logger[_0xee75('0x13')](_0xee75('0x46'),_0x559da0[_0xee75('0x47')][_0xee75('0x29')]);if(!reportStatusStrategies[_0x559da0[_0xee75('0x47')][_0xee75('0x29')]]){logger[_0xee75('0x12')]('report\x20status:',_0x559da0[_0xee75('0x47')][_0xee75('0x29')]);_0x5c5f50[_0xee75('0x8')]();}reportStatusStrategies[_0x559da0[_0xee75('0x47')][_0xee75('0x29')]]({'operation':_0x5c5f50,'currentAttempt':_0x21712d,'retryOptions':_0x4b0ba7,'job':_0x572540,'data':_0x3eb394,'entity':_0x559da0});});}catch(_0x379241){_0x5c5f50[_0xee75('0x8')](_0x379241);}});}function handleResult(_0x549468){return function(_0x335f65){if(_0x549468[_0xee75('0x48')]&&_0x549468[_0xee75('0x16')]&&_0x549468['MailAccount']['Smtp']&&!_[_0xee75('0x49')](_0x549468['email'])){retryer(_0x549468,_0x335f65);}};}function handleJob(_0x1fdcab){return function(){try{if(_[_0xee75('0x49')](_0x1fdcab[_0xee75('0x1e')])){return logger['info']('subtractNumber\x20null\x20or\x20undefined');}if(_[_0xee75('0x49')](_0x1fdcab[_0xee75('0x1f')])){return logger[_0xee75('0x13')]('subtractUnit\x20null\x20or\x20undefined');}var _0x15b38c={'startDate':moment()['subtract'](_0x1fdcab[_0xee75('0x1e')],_0x1fdcab[_0xee75('0x1f')])['format'](_0xee75('0x4a')),'endDate':moment()[_0xee75('0x18')](_0xee75('0x4a')),'type':_0xee75('0x4b'),'output':_0x1fdcab[_0xee75('0x4c')],'name':_0x1fdcab[_0xee75('0x1a')]};if(!_[_0xee75('0x49')](_0x1fdcab['DefaultReportId'])){logger[_0xee75('0x13')](_0xee75('0x4d'),_0x1fdcab['DefaultReportId']);return analyticDefaultReportController['runReport']({'id':_0x1fdcab[_0xee75('0x4e')]},_0x15b38c)[_0xee75('0x10')](handleResult(_0x1fdcab))[_0xee75('0x11')](handleError());}if(!_['isNil'](_0x1fdcab[_0xee75('0x4f')])){logger[_0xee75('0x13')](_0xee75('0x50'),_0x1fdcab[_0xee75('0x4f')]);return analyticCustomReportController['runReport']({'id':_0x1fdcab[_0xee75('0x4f')]},_0x15b38c)[_0xee75('0x10')](handleResult(_0x1fdcab))[_0xee75('0x11')](handleError());}}catch(_0x5503c9){logger[_0xee75('0x12')](JSON['stringify'](_0x5503c9));}return logger[_0xee75('0x13')](_0xee75('0x51'));};}function getJobs(_0x456088){var _0x182bdc={};if(_0x456088){_0x182bdc['id']=_0x456088;}return db['Schedule'][_0xee75('0x52')]({'where':_0x182bdc,'include':[{'model':db[_0xee75('0x16')],'attributes':['id',_0xee75('0x1a'),_0xee75('0x15')],'include':[{'model':db[_0xee75('0x53')],'as':_0xee75('0x1b'),'include':[{'model':db[_0xee75('0x54')],'as':_0xee75('0x54')}]}]}]})[_0xee75('0x10')](function(_0xa6fb92){var _0x378894=_[_0xee75('0x55')](manager['jobs']);var _0x5ccd11=_[_0xee75('0x56')](_0xa6fb92,function(_0x219dbc){return _0x219dbc['id'][_0xee75('0x57')]();});var _0x5db9a0=_[_0xee75('0x58')](_0xa6fb92,function(_0xa4473e){return _0xa4473e['id'][_0xee75('0x57')]();});var _0x16b1bd=_0x456088?_0x5ccd11:_[_0xee75('0x59')](_0x5ccd11,_0x378894);var _0x3f58c9=_[_0xee75('0x5a')](_0x5ccd11,_0x378894);var _0x4e9295=_['difference'](_0x378894,_0x5ccd11);var _0x5b16c7;var _0x4e5295;for(_0x5b16c7=0x0;_0x5b16c7<_0x4e9295['length']&&!_0x456088;_0x5b16c7+=0x1){_0x4e5295=_0x4e9295[_0x5b16c7][_0xee75('0x57')]();if(manager[_0xee75('0x5b')](_0x4e5295)){manager['stop'](_0x4e5295);manager[_0xee75('0x5c')](_0x4e5295);logger[_0xee75('0x13')](_0xee75('0x5d'),_0x4e5295);}}logger[_0xee75('0x13')](_0xee75('0x5e'),JSON[_0xee75('0x37')](_0x16b1bd));for(_0x5b16c7=0x0;_0x5b16c7<_0x16b1bd['length'];_0x5b16c7+=0x1){_0x4e5295=_0x16b1bd[_0x5b16c7][_0xee75('0x57')]();if(_0x456088){logger[_0xee75('0x13')](JSON[_0xee75('0x37')](_0x5db9a0[_0x4e5295]));BPromise[_0xee75('0x5f')]()[_0xee75('0x10')](handleJob(_0x5db9a0[_0x4e5295]));logger[_0xee75('0x13')]('run\x20job',_0x5db9a0[_0x4e5295][_0xee75('0x1a')],_0x5db9a0[_0x4e5295]['cron']);}else if(_0x5db9a0[_0x4e5295]['cron']&&_0x5db9a0[_0x4e5295][_0xee75('0x60')]&&moment()['isBetween'](_0x5db9a0[_0x4e5295]['startAt'],_0x5db9a0[_0x4e5295][_0xee75('0x61')])){manager[_0xee75('0x62')](_0x4e5295,_0x5db9a0[_0x4e5295]['cron'],handleJob(_0x5db9a0[_0x4e5295]));manager[_0xee75('0x63')](_0x4e5295);logger[_0xee75('0x13')](_0xee75('0x64'),_0x5db9a0[_0x4e5295][_0xee75('0x1a')],_0x5db9a0[_0x4e5295]['cron']);}else if(manager[_0xee75('0x5b')](_0x4e5295)){manager['stop'](_0x4e5295);manager[_0xee75('0x5c')](_0x4e5295);logger[_0xee75('0x13')](_0xee75('0x65'),_0x5db9a0[_0x4e5295][_0xee75('0x1a')],_0x5db9a0[_0x4e5295][_0xee75('0x66')]);}}for(_0x5b16c7=0x0,_0x4e5295;_0x5b16c7<_0x3f58c9['length']&&!_0x456088;_0x5b16c7+=0x1){_0x4e5295=_0x3f58c9[_0x5b16c7][_0xee75('0x57')]();if(manager[_0xee75('0x5b')](_0x4e5295)){if(_0x5db9a0[_0x4e5295]['cron']&&_0x5db9a0[_0x4e5295]['active']&&moment()[_0xee75('0x67')](_0x5db9a0[_0x4e5295]['startAt'],_0x5db9a0[_0x4e5295][_0xee75('0x61')])){manager[_0xee75('0x68')](_0x4e5295,_0x5db9a0[_0x4e5295][_0xee75('0x66')],handleJob(_0x5db9a0[_0x4e5295]));logger['info'](_0xee75('0x69'),_0x5db9a0[_0x4e5295]['name'],_0x5db9a0[_0x4e5295][_0xee75('0x66')]);}else{manager[_0xee75('0x3e')](_0x4e5295);manager[_0xee75('0x5c')](_0x4e5295);logger[_0xee75('0x13')]('stop\x20cron',_0x5db9a0[_0x4e5295][_0xee75('0x1a')],_0x5db9a0[_0x4e5295][_0xee75('0x66')]);}}}})[_0xee75('0x11')](function(_0x1cb154){logger[_0xee75('0x12')](JSON[_0xee75('0x37')](_0x1cb154));});}exports['run']=function(_0x4b2f61){return getJobs(_0x4b2f61);};exports['start']=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0x0490=['Report\x20extraction\x20procedure\x20has\x20run\x20into\x20an\x20unexpected\x20error.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','[handleSendEmail]\x20Unrecognized\x20status:','request','error\x20mail','email\x20sent','retryOptions','retries','data','operation','stop','still\x20loading','case\x20completed','job','case\x20empty','entity','attempt','Job\x20ID\x20','\x20Attempt\x20#:','then','report\x20status:','dataValues','sendMail','isNil','subtractNumber','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','DefaultReportId','exec\x20defaul\x20report\x20id:%s','CustomReportId','exec\x20custom\x20report\x20id:%s','no\x20report\x20id','Schedule','findAll','MailServerOut','jobs','map','toString','keyBy','intersection','length','exists','deleteJob','toRun','resolve','run\x20job','cron','startAt','endAt','add','start','stop\x20cron','active','update','update\x20cron','run','util','jayson/promise','bluebird','../logger','retry','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','number','AnalyticExtractedReport','findOne','catch','error','info','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','format','\x22%s\x22\x20<%s>','Smtp','user','bcc','name','subtractUnit','join','../../files/reports','savename','%s.%s','basename','extname','zip','existsSync','status','Sent','attachments','message','text','stringify','Empty','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','Report\x20still\x20running\x20after\x20timeout.\x0aYou\x20can\x20find\x20the\x20report\x20when\x20it\x20will\x20be\x20completed\x20in\x20Analytics\x20->\x20Extracted\x20Reports.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a'];(function(_0xa60623,_0x2d4e4f){var _0x4a6487=function(_0xba6cbe){while(--_0xba6cbe){_0xa60623['push'](_0xa60623['shift']());}};_0x4a6487(++_0x2d4e4f);}(_0x0490,0xfe));var _0x0049=function(_0x554215,_0x314bca){_0x554215=_0x554215-0x0;var _0xe6fc09=_0x0490[_0x554215];return _0xe6fc09;};'use strict';var fs=require('fs');var util=require(_0x0049('0x0'));var path=require('path');var _=require('lodash');var moment=require('moment');var CronJobManager=require('cron-job-manager');var jayson=require(_0x0049('0x1'));var BPromise=require(_0x0049('0x2'));var logger=require(_0x0049('0x3'))('schedule');var db=require('../../mysqldb')['db'];const retry=require(_0x0049('0x4'));var analyticCustomReportController=require(_0x0049('0x5'));var analyticDefaultReportController=require(_0x0049('0x6'));var client=jayson[_0x0049('0x7')][_0x0049('0x8')]({'port':0x232b});var manager=new CronJobManager();function getReportData(_0x474916){const _0x2e1195={};if(typeof _0x474916===_0x0049('0x9')){_0x2e1195['id']=_0x474916;}return db[_0x0049('0xa')][_0x0049('0xb')]({'where':_0x2e1195})['then'](function(_0x3dd36b){return _0x3dd36b;})[_0x0049('0xc')](function(_0x2c51ce){logger[_0x0049('0xd')](_0x2c51ce);});}function handleSendEmail(_0x4342cf,_0x25bc62){logger[_0x0049('0xe')](_0x0049('0xf'),_0x4342cf[_0x0049('0x10')]);var _0x4db061=!![];var _0x4bcbb6=_0x4342cf[_0x0049('0x11')]['getSmtpOptions']();var _0x3c3aad={'account':_0x4bcbb6,'message':{'from':util[_0x0049('0x12')](_0x0049('0x13'),_0x4342cf[_0x0049('0x11')]['name'],_0x4342cf['MailAccount'][_0x0049('0x10')]||_0x4342cf[_0x0049('0x11')][_0x0049('0x14')][_0x0049('0x15')]),'to':_0x4342cf['email'],'cc':_0x4342cf['cc'],'bcc':_0x4342cf[_0x0049('0x16')],'subject':util['format']('Report\x20%s\x20last\x20%s\x20%s',_0x25bc62[_0x0049('0x17')],_0x4342cf['subtractNumber'],_0x4342cf[_0x0049('0x18')])}};var _0x4951cf=path[_0x0049('0x19')](__dirname,_0x0049('0x1a'));var _0x1bcf88=_0x25bc62[_0x0049('0x1b')];var _0x26640e=util[_0x0049('0x12')](_0x0049('0x1c'),path[_0x0049('0x1d')](_0x25bc62['savename'],path[_0x0049('0x1e')](_0x25bc62[_0x0049('0x1b')])),_0x0049('0x1f'));var _0x1e67b3=path[_0x0049('0x19')](_0x4951cf,_0x1bcf88);var _0xdffdde=path[_0x0049('0x19')](_0x4951cf,_0x26640e);if(fs[_0x0049('0x20')](_0x1e67b3)){_0x25bc62[_0x0049('0x21')]=_0x0049('0x22');_0x3c3aad['message'][_0x0049('0x23')]=[{'filename':_0x1bcf88,'path':_0x1e67b3}];_0x3c3aad[_0x0049('0x24')][_0x0049('0x25')]=util[_0x0049('0x12')]('Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a',JSON[_0x0049('0x26')](_0x25bc62,null,0x2));}else if(fs[_0x0049('0x20')](_0xdffdde)){_0x25bc62[_0x0049('0x21')]=_0x0049('0x22');_0x3c3aad[_0x0049('0x24')][_0x0049('0x23')]=[{'filename':_0x26640e,'path':_0xdffdde}];}else{if(_0x25bc62['status']===_0x0049('0x27')){_0x3c3aad[_0x0049('0x24')]['text']=_0x0049('0x28');if(!_0x4342cf[_0x0049('0x29')]){_0x4db061=![];logger[_0x0049('0xe')]('empty\x20file,\x20email\x20not\x20sent');}}else if(_0x25bc62[_0x0049('0x21')]==='Loading'){_0x3c3aad['message'][_0x0049('0x25')]=_0x0049('0x2a');}else if(_0x25bc62['status']==='Completed'){_0x3c3aad[_0x0049('0x24')]['text']='Report\x20file\x20creation\x20still\x20running\x20after\x20timeout.\x0aYou\x20can\x20find\x20the\x20report\x20when\x20it\x20will\x20be\x20completed\x20in\x20Analytics\x20->\x20Extracted\x20Reports.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';}else if(_0x25bc62[_0x0049('0x21')]==='Failed'){_0x3c3aad['message'][_0x0049('0x25')]=_0x0049('0x2b');}else{logger['error'](_0x0049('0x2c'),_0x25bc62[_0x0049('0x21')]);}}if(_0x4db061){return client[_0x0049('0x2d')]('SendMail',_0x3c3aad)['then'](function(_0x18d63c){if(_0x18d63c['error']){return logger[_0x0049('0xd')](_0x0049('0x2e'),JSON['stringify'](_0x18d63c));}return logger['info'](_0x0049('0x2f'));})['catch'](function(_0x4deeb3){return logger['error'](_0x0049('0x2e'),JSON[_0x0049('0x26')](_0x4deeb3));});}}function handleError(){return function(_0xf1d279){return logger[_0x0049('0xd')](JSON[_0x0049('0x26')](_0xf1d279));};}function loading(_0x2a68dd){logger[_0x0049('0xe')]('case\x20loading');if(_0x2a68dd['currentAttempt']===_0x2a68dd[_0x0049('0x30')][_0x0049('0x31')]){handleSendEmail(_0x2a68dd['job'],_0x2a68dd[_0x0049('0x32')]);_0x2a68dd[_0x0049('0x33')][_0x0049('0x34')]();}else{_0x2a68dd[_0x0049('0x33')][_0x0049('0x4')](_0x0049('0x35'));}}function completed(_0x30155f){logger[_0x0049('0xe')](_0x0049('0x36'));handleSendEmail(_0x30155f[_0x0049('0x37')],_0x30155f[_0x0049('0x32')]);_0x30155f[_0x0049('0x33')][_0x0049('0x34')]();}function empty(_0x5f2ced){logger[_0x0049('0xe')](_0x0049('0x38'));handleSendEmail(_0x5f2ced[_0x0049('0x37')],_0x5f2ced[_0x0049('0x32')]);_0x5f2ced[_0x0049('0x33')]['stop']();}function failed(_0x23c1a6){logger['info']('case\x20failed');handleSendEmail(_0x23c1a6[_0x0049('0x37')],_0x23c1a6[_0x0049('0x32')]);_0x23c1a6[_0x0049('0x33')]['stop']();}function urecognized(_0x2e6805){logger[_0x0049('0xd')]('Unrecognized\x20status:',_0x2e6805[_0x0049('0x39')]['dataValues'][_0x0049('0x21')]);_0x2e6805[_0x0049('0x33')][_0x0049('0x34')]();}const reportStatusStrategies={'Loading':loading,'Completed':completed,'Empty':empty,'Failed':failed,'Unrecognized':urecognized};function retryer(_0xac2260,_0x14eb5f){const _0x532a16={'retries':0x3,'factor':0x2,'minTimeout':0x5b*0x3e8,'maxTimeout':0xa*0x3c*0x3e8};const _0x231b74=retry[_0x0049('0x33')](_0x532a16);_0x231b74[_0x0049('0x3a')](_0x5c97af=>{logger['info'](_0x0049('0x3b')+_0xac2260['id']+_0x0049('0x3c')+_0x5c97af);try{getReportData(_0x14eb5f['id'])[_0x0049('0x3d')](function(_0x32ea05){_0x14eb5f=_0x32ea05;logger['info'](_0x0049('0x3e'),_0x32ea05['dataValues']['status']);if(!reportStatusStrategies[_0x32ea05[_0x0049('0x3f')][_0x0049('0x21')]]){logger[_0x0049('0xd')](_0x0049('0x3e'),_0x32ea05[_0x0049('0x3f')]['status']);_0x231b74[_0x0049('0x4')]();}reportStatusStrategies[_0x32ea05['dataValues']['status']]({'operation':_0x231b74,'currentAttempt':_0x5c97af,'retryOptions':_0x532a16,'job':_0xac2260,'data':_0x14eb5f,'entity':_0x32ea05});});}catch(_0x2fd6a5){_0x231b74['retry'](_0x2fd6a5);}});}function handleResult(_0x37401e){return function(_0x53ecdd){if(_0x37401e[_0x0049('0x40')]&&_0x37401e[_0x0049('0x11')]&&_0x37401e[_0x0049('0x11')][_0x0049('0x14')]&&!_[_0x0049('0x41')](_0x37401e[_0x0049('0x10')])){retryer(_0x37401e,_0x53ecdd);}};}function handleJob(_0x15e63f){return function(){try{if(_[_0x0049('0x41')](_0x15e63f[_0x0049('0x42')])){return logger[_0x0049('0xe')]('subtractNumber\x20null\x20or\x20undefined');}if(_['isNil'](_0x15e63f[_0x0049('0x18')])){return logger[_0x0049('0xe')](_0x0049('0x43'));}var _0x677854={'startDate':moment()[_0x0049('0x44')](_0x15e63f[_0x0049('0x42')],_0x15e63f[_0x0049('0x18')])[_0x0049('0x12')](_0x0049('0x45')),'endDate':moment()[_0x0049('0x12')]('YYYY-MM-DD\x20HH:mm:ss'),'type':'scheduled','output':_0x15e63f['output'],'name':_0x15e63f[_0x0049('0x17')]};if(!_['isNil'](_0x15e63f[_0x0049('0x46')])){logger['info'](_0x0049('0x47'),_0x15e63f[_0x0049('0x46')]);return analyticDefaultReportController['runReport']({'id':_0x15e63f[_0x0049('0x46')]},_0x677854)['then'](handleResult(_0x15e63f))['catch'](handleError());}if(!_[_0x0049('0x41')](_0x15e63f[_0x0049('0x48')])){logger['info'](_0x0049('0x49'),_0x15e63f[_0x0049('0x48')]);return analyticCustomReportController['runReport']({'id':_0x15e63f[_0x0049('0x48')]},_0x677854)[_0x0049('0x3d')](handleResult(_0x15e63f))[_0x0049('0xc')](handleError());}}catch(_0xc730d){logger[_0x0049('0xd')](JSON[_0x0049('0x26')](_0xc730d));}return logger[_0x0049('0xe')](_0x0049('0x4a'));};}function getJobs(_0x2e559e){var _0x24a4c7={};if(_0x2e559e){_0x24a4c7['id']=_0x2e559e;}return db[_0x0049('0x4b')][_0x0049('0x4c')]({'where':_0x24a4c7,'include':[{'model':db['MailAccount'],'attributes':['id',_0x0049('0x17'),_0x0049('0x10')],'include':[{'model':db[_0x0049('0x4d')],'as':_0x0049('0x14'),'include':[{'model':db['CloudProvider'],'as':'CloudProvider'}]}]}]})[_0x0049('0x3d')](function(_0x5118de){var _0x4a2776=_['keys'](manager[_0x0049('0x4e')]);var _0x455cdd=_[_0x0049('0x4f')](_0x5118de,function(_0x45c449){return _0x45c449['id'][_0x0049('0x50')]();});var _0x28cf26=_[_0x0049('0x51')](_0x5118de,function(_0x5c2d05){return _0x5c2d05['id'][_0x0049('0x50')]();});var _0x1055a4=_0x2e559e?_0x455cdd:_['difference'](_0x455cdd,_0x4a2776);var _0x1bdd07=_[_0x0049('0x52')](_0x455cdd,_0x4a2776);var _0x36d562=_['difference'](_0x4a2776,_0x455cdd);var _0x1d0d18;var _0x581cb1;for(_0x1d0d18=0x0;_0x1d0d18<_0x36d562[_0x0049('0x53')]&&!_0x2e559e;_0x1d0d18+=0x1){_0x581cb1=_0x36d562[_0x1d0d18][_0x0049('0x50')]();if(manager[_0x0049('0x54')](_0x581cb1)){manager[_0x0049('0x34')](_0x581cb1);manager[_0x0049('0x55')](_0x581cb1);logger['info']('delete\x20cron',_0x581cb1);}}logger['info'](_0x0049('0x56'),JSON[_0x0049('0x26')](_0x1055a4));for(_0x1d0d18=0x0;_0x1d0d18<_0x1055a4[_0x0049('0x53')];_0x1d0d18+=0x1){_0x581cb1=_0x1055a4[_0x1d0d18][_0x0049('0x50')]();if(_0x2e559e){logger[_0x0049('0xe')](JSON[_0x0049('0x26')](_0x28cf26[_0x581cb1]));BPromise[_0x0049('0x57')]()['then'](handleJob(_0x28cf26[_0x581cb1]));logger[_0x0049('0xe')](_0x0049('0x58'),_0x28cf26[_0x581cb1][_0x0049('0x17')],_0x28cf26[_0x581cb1]['cron']);}else if(_0x28cf26[_0x581cb1][_0x0049('0x59')]&&_0x28cf26[_0x581cb1]['active']&&moment()['isBetween'](_0x28cf26[_0x581cb1][_0x0049('0x5a')],_0x28cf26[_0x581cb1][_0x0049('0x5b')])){manager[_0x0049('0x5c')](_0x581cb1,_0x28cf26[_0x581cb1]['cron'],handleJob(_0x28cf26[_0x581cb1]));manager[_0x0049('0x5d')](_0x581cb1);logger[_0x0049('0xe')]('add\x20cron',_0x28cf26[_0x581cb1][_0x0049('0x17')],_0x28cf26[_0x581cb1][_0x0049('0x59')]);}else if(manager[_0x0049('0x54')](_0x581cb1)){manager[_0x0049('0x34')](_0x581cb1);manager['deleteJob'](_0x581cb1);logger[_0x0049('0xe')](_0x0049('0x5e'),_0x28cf26[_0x581cb1]['name'],_0x28cf26[_0x581cb1]['cron']);}}for(_0x1d0d18=0x0,_0x581cb1;_0x1d0d18<_0x1bdd07['length']&&!_0x2e559e;_0x1d0d18+=0x1){_0x581cb1=_0x1bdd07[_0x1d0d18][_0x0049('0x50')]();if(manager['exists'](_0x581cb1)){if(_0x28cf26[_0x581cb1][_0x0049('0x59')]&&_0x28cf26[_0x581cb1][_0x0049('0x5f')]&&moment()['isBetween'](_0x28cf26[_0x581cb1][_0x0049('0x5a')],_0x28cf26[_0x581cb1]['endAt'])){manager[_0x0049('0x60')](_0x581cb1,_0x28cf26[_0x581cb1][_0x0049('0x59')],handleJob(_0x28cf26[_0x581cb1]));logger[_0x0049('0xe')](_0x0049('0x61'),_0x28cf26[_0x581cb1]['name'],_0x28cf26[_0x581cb1]['cron']);}else{manager[_0x0049('0x34')](_0x581cb1);manager[_0x0049('0x55')](_0x581cb1);logger[_0x0049('0xe')](_0x0049('0x5e'),_0x28cf26[_0x581cb1][_0x0049('0x17')],_0x28cf26[_0x581cb1][_0x0049('0x59')]);}}}})[_0x0049('0xc')](function(_0x128f8b){logger[_0x0049('0xd')](JSON[_0x0049('0x26')](_0x128f8b));});}exports[_0x0049('0x62')]=function(_0xbc5dc9){return getJobs(_0xbc5dc9);};exports[_0x0049('0x5d')]=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 b33d7c4..85bd670 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 _0xd7ab=['transcribe','forEach','push','start','lodash','aws-sdk','request-promise','util','bluebird','../../mysqldb','../../config/logger','TranscribeService','detectSentiment','substring','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data2','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','then','results','transcripts','length','fileText','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentRegion','language','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','sentimentAccountId','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','data1','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Positive','SentimentScore','Negative','Mixed','Neutral','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','bucket','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','Setting'];(function(_0x3cd078,_0x2921f4){var _0x10b5ff=function(_0xccaf91){while(--_0xccaf91){_0x3cd078['push'](_0x3cd078['shift']());}};_0x10b5ff(++_0x2921f4);}(_0xd7ab,0x14e));var _0xbd7a=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xd7ab[_0x14add3];return _0x4a174f;};var _=require(_0xbd7a('0x0'));var AWS=require(_0xbd7a('0x1'));var rp=require(_0xbd7a('0x2'));var util=require(_0xbd7a('0x3'));var BPromise=require(_0xbd7a('0x4'));var db=require(_0xbd7a('0x5'))['db'];var logger=require(_0xbd7a('0x6'))('transcribe');function getTranscriptionJob(_0x5104f2,_0x5a7dc8,_0x2b1d52,_0x599057){return new Promise(function(_0x480cb0,_0x458cda){var _0x331bcb=new AWS[(_0xbd7a('0x7'))]({'accessKeyId':_0x5a7dc8,'secretAccessKey':_0x5104f2,'region':_0x2b1d52});_0x331bcb['getTranscriptionJob']({'TranscriptionJobName':_0x599057},function(_0x3eb09d,_0x2aa782){if(_0x3eb09d){return _0x458cda(_0x3eb09d);}else{return _0x480cb0(_0x2aa782);}});});}function sentiment(_0x50e9ce,_0x186c88,_0x5c8abe,_0x220d97,_0x4dfbd9){return new Promise(function(_0x4c4d89,_0x2b6a14){var _0x4a4006=new AWS['Comprehend']({'accessKeyId':_0x186c88,'secretAccessKey':_0x50e9ce,'region':_0x5c8abe});_0x4a4006[_0xbd7a('0x8')]({'Text':_0x220d97,'LanguageCode':_0x4dfbd9[_0xbd7a('0x9')](0x0,0x2)},function(_0x21544b,_0x275d16){if(_0x21544b){return _0x2b6a14(_0x21544b);}else{return _0x4c4d89(_0x275d16);}});});}function checkTranscribeJob(_0x3294cd,_0x5aaa2d,_0x2133eb){var _0x5393ee;return new BPromise(function(_0xdfa6e6,_0x194935){logger[_0xbd7a('0xa')](util[_0xbd7a('0xb')](_0xbd7a('0xc'),_0x3294cd['id'],_0x3294cd[_0xbd7a('0xd')]));return getTranscriptionJob(_0x2133eb['data1'],_0x2133eb[_0xbd7a('0xe')],_0x5aaa2d['transcribeRegion'],_0x3294cd[_0xbd7a('0xd')])['then'](function(_0x3fb8f4){logger[_0xbd7a('0xa')](util[_0xbd7a('0xb')](_0xbd7a('0xf'),_0x3294cd['id'],_0x3294cd[_0xbd7a('0xd')],_0x3fb8f4[_0xbd7a('0x10')][_0xbd7a('0x11')]));if(!_0x3294cd['fileText']){switch(_0x3fb8f4['TranscriptionJob']['TranscriptionJobStatus']){case _0xbd7a('0x12'):var _0x1699ca={'transcribeStatus':_0x3fb8f4['TranscriptionJob'][_0xbd7a('0x11')],'fileUri':_0x3fb8f4[_0xbd7a('0x10')][_0xbd7a('0x13')][_0xbd7a('0x14')]};logger[_0xbd7a('0xa')](util[_0xbd7a('0xb')](_0xbd7a('0x15'),_0x3294cd['id']));return rp({'uri':_0x3fb8f4[_0xbd7a('0x10')][_0xbd7a('0x13')]['TranscriptFileUri'],'json':!![]})[_0xbd7a('0x16')](function(_0x5ad9c6){logger['info'](util['format']('[RECORDING:%d]\x20Transcript\x20downloaded',_0x3294cd['id']));if(_0x5ad9c6&&_0x5ad9c6[_0xbd7a('0x17')]&&_0x5ad9c6[_0xbd7a('0x17')][_0xbd7a('0x18')]&&_0x5ad9c6[_0xbd7a('0x17')][_0xbd7a('0x18')][_0xbd7a('0x19')]){_0x1699ca['fileText']='';for(var _0x1e5ad6=0x0;_0x1e5ad6<_0x5ad9c6[_0xbd7a('0x17')][_0xbd7a('0x18')]['length'];_0x1e5ad6++){_0x1699ca[_0xbd7a('0x1a')]+=_0x5ad9c6['results'][_0xbd7a('0x18')][_0x1e5ad6]['transcript']+'';}}return _0x3294cd[_0xbd7a('0x1b')](_0x1699ca);})[_0xbd7a('0x16')](function(){logger['info'](util[_0xbd7a('0xb')](_0xbd7a('0x1c'),_0x3294cd['id']));if(!_0x3294cd[_0xbd7a('0x1d')]){throw new db[(_0xbd7a('0x1e'))][(_0xbd7a('0x1f'))](_0xbd7a('0x20'));}if(!_0x5aaa2d[_0xbd7a('0x21')]||!_0x5aaa2d['sentimentAccountId']||!_0x5aaa2d[_0xbd7a('0x22')]||!_0x5aaa2d[_0xbd7a('0x23')]||!_0x5aaa2d['bucket']){throw new db[(_0xbd7a('0x1e'))][(_0xbd7a('0x1f'))](_0xbd7a('0x24'));}if(!_0x1699ca[_0xbd7a('0x1a')]){throw new Error(_0xbd7a('0x25'));}if(_0x5aaa2d[_0xbd7a('0x26')]===_0x2133eb['id']){return _0x2133eb;}else{return db[_0xbd7a('0x27')][_0xbd7a('0x28')]({'where':{'id':_settings[_0xbd7a('0x26')]}});}})[_0xbd7a('0x16')](function(_0x32b095){if(!_0x32b095){throw new db[(_0xbd7a('0x1e'))][(_0xbd7a('0x1f'))](_0xbd7a('0x29'));}if(!_0x32b095[_0xbd7a('0x2a')]||!_0x32b095[_0xbd7a('0xe')]){throw new db[(_0xbd7a('0x1e'))]['ValidationError'](_0xbd7a('0x2b'));}_0x5393ee=_0x32b095;logger[_0xbd7a('0xa')](util[_0xbd7a('0xb')](_0xbd7a('0x2c'),_0x3294cd['id']));return sentiment(_0x5393ee[_0xbd7a('0x2a')],_0x5393ee['data2'],_0x5aaa2d[_0xbd7a('0x22')],_0x1699ca[_0xbd7a('0x1a')],_0x5aaa2d[_0xbd7a('0x23')]);})['then'](function(_0x2bc18c){logger['info'](util[_0xbd7a('0xb')](_0xbd7a('0x2d'),_0x3294cd['id']));return _0x3294cd[_0xbd7a('0x1b')]({'sentiment':_0x2bc18c['Sentiment'],'sPositive':_0x2bc18c['SentimentScore'][_0xbd7a('0x2e')],'sNegative':_0x2bc18c[_0xbd7a('0x2f')][_0xbd7a('0x30')],'sMixed':_0x2bc18c[_0xbd7a('0x2f')][_0xbd7a('0x31')],'sNeutral':_0x2bc18c[_0xbd7a('0x2f')][_0xbd7a('0x32')]});})[_0xbd7a('0x16')](function(){logger[_0xbd7a('0xa')](util[_0xbd7a('0xb')](_0xbd7a('0x1c'),_0x3294cd['id']));_0xdfa6e6();});case _0xbd7a('0x33'):return _0x3294cd[_0xbd7a('0x1b')]({'transcribeStatus':_0xbd7a('0x33'),'failureReason':_0x3fb8f4[_0xbd7a('0x10')][_0xbd7a('0x34')]})['then'](function(){logger[_0xbd7a('0xa')](util[_0xbd7a('0xb')](_0xbd7a('0x1c'),_0x3294cd['id']));_0xdfa6e6();});default:logger['info'](util[_0xbd7a('0xb')](_0xbd7a('0x35'),_0x3294cd['id']));break;}}else{return BPromise['resolve']()[_0xbd7a('0x16')](function(){if(!_0x3294cd[_0xbd7a('0x1d')]){throw new db[(_0xbd7a('0x1e'))]['ValidationError'](_0xbd7a('0x20'));}if(!_0x5aaa2d['sentiment']||!_0x5aaa2d[_0xbd7a('0x26')]||!_0x5aaa2d[_0xbd7a('0x22')]||!_0x5aaa2d[_0xbd7a('0x23')]||!_0x5aaa2d[_0xbd7a('0x36')]){throw new db[(_0xbd7a('0x1e'))]['ValidationError'](_0xbd7a('0x24'));}if(!_0x3294cd[_0xbd7a('0x1a')]){throw new Error(_0xbd7a('0x25'));}if(_0x5aaa2d['sentimentAccountId']===_0x2133eb['id']){return _0x2133eb;}else{return db['CloudProvider']['findOne']({'where':{'id':_settings[_0xbd7a('0x26')]}});}})[_0xbd7a('0x16')](function(_0x5b86cd){if(!_0x5b86cd){throw new db[(_0xbd7a('0x1e'))][(_0xbd7a('0x1f'))](_0xbd7a('0x29'));}if(!_0x5b86cd[_0xbd7a('0x2a')]||!_0x5b86cd[_0xbd7a('0xe')]){throw new db['Sequelize'][(_0xbd7a('0x1f'))](_0xbd7a('0x2b'));}_0x5393ee=_0x5b86cd;logger['info'](util[_0xbd7a('0xb')](_0xbd7a('0x2c'),_0x3294cd['id']));return sentiment(_0x5393ee[_0xbd7a('0x2a')],_0x5393ee[_0xbd7a('0xe')],_0x5aaa2d['sentimentRegion'],_0x3294cd[_0xbd7a('0x1a')],_0x5aaa2d['language']);})['then'](function(_0x5346d6){logger[_0xbd7a('0xa')](util[_0xbd7a('0xb')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x3294cd['id']));return _0x3294cd[_0xbd7a('0x1b')]({'sentiment':_0x5346d6['Sentiment'],'sPositive':_0x5346d6[_0xbd7a('0x2f')][_0xbd7a('0x2e')],'sNegative':_0x5346d6[_0xbd7a('0x2f')][_0xbd7a('0x30')],'sMixed':_0x5346d6[_0xbd7a('0x2f')][_0xbd7a('0x31')],'sNeutral':_0x5346d6[_0xbd7a('0x2f')][_0xbd7a('0x32')],'transcribeStatus':_0xbd7a('0x12')});})[_0xbd7a('0x16')](function(){logger['info'](util[_0xbd7a('0xb')](_0xbd7a('0x1c'),_0x3294cd['id']));_0xdfa6e6();});}})['catch'](function(_0x5d5d48){if(_0x5d5d48){if(!_0x5d5d48[_0xbd7a('0x37')]||_0x5d5d48[_0xbd7a('0x37')]!==_0xbd7a('0x38')){logger[_0xbd7a('0x39')](util[_0xbd7a('0xb')](_0xbd7a('0x3a'),_0x3294cd['id']),util[_0xbd7a('0x3b')](_0x5d5d48,{'showHidden':![],'depth':null}));}}_0xdfa6e6();});});}function checkTranscribe(){var _0x2e3672;var _0x2ba9e7;var _0x526ce5;return db[_0xbd7a('0x3c')]['findAll']({'where':{'transcribeStatus':'IN_PROGRESS'}})['then'](function(_0x3bd3c2){if(!_0x3bd3c2||!_0x3bd3c2['length']){throw new db[(_0xbd7a('0x1e'))][(_0xbd7a('0x1f'))]('No\x20transcribe\x20job\x20to\x20check');}_0x2e3672=_0x3bd3c2;return db[_0xbd7a('0x3d')][_0xbd7a('0x28')]({'where':{'id':0x1}});})['then'](function(_0x455acc){if(!_0x455acc){throw new db[(_0xbd7a('0x1e'))]['ValidationError']('Settings\x20not\x20available');}_0x2ba9e7=_0x455acc;if(!_0x2ba9e7[_0xbd7a('0x3e')]||!_0x2ba9e7['transcribeAccountId']||!_0x2ba9e7['transcribeRegion']||!_0x2ba9e7[_0xbd7a('0x23')]||!_0x2ba9e7[_0xbd7a('0x36')]){throw new db[(_0xbd7a('0x1e'))]['ValidationError']('Transcribe\x20not\x20configured');}return db['CloudProvider'][_0xbd7a('0x28')]({'where':{'id':_0x2ba9e7['transcribeAccountId']}});})[_0xbd7a('0x16')](function(_0x2af4cd){if(!_0x2af4cd){throw new db[(_0xbd7a('0x1e'))][(_0xbd7a('0x1f'))](_0xbd7a('0x29'));}if(!_0x2af4cd[_0xbd7a('0x2a')]||!_0x2af4cd[_0xbd7a('0xe')]){throw new db['Sequelize']['ValidationError']('Cloud\x20Provider\x20not\x20configured');}_0x526ce5=_0x2af4cd;var _0x301c56=[];_0x2e3672[_0xbd7a('0x3f')](function(_0x54bd38){_0x301c56[_0xbd7a('0x40')](checkTranscribeJob(_0x54bd38,_0x2ba9e7,_0x526ce5));});return BPromise['all'](_0x301c56);})['catch'](function(_0x55d960){if(_0x55d960){if(!_0x55d960['name']||_0x55d960[_0xbd7a('0x37')]!==_0xbd7a('0x38')){logger[_0xbd7a('0x39')](util[_0xbd7a('0x3b')](_0x55d960,{'showHidden':![],'depth':null}));}}});}exports[_0xbd7a('0x41')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0x21f8=['TranscriptFileUri','Transcript','results','transcripts','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','language','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','findOne','then','Cloud\x20Provider\x20not\x20available','Sequelize','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','Sentiment','SentimentScore','Negative','Mixed','Neutral','FAILED','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','CloudProvider','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','name','SequelizeValidationError','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','IN_PROGRESS','Setting','Settings\x20not\x20available','transcribeAccountId','bucket','push','all','catch','lodash','aws-sdk','request-promise','util','bluebird','../../mysqldb','../../config/logger','TranscribeService','getTranscriptionJob','Comprehend','detectSentiment','substring','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','data2','transcribeRegion','TranscriptionJob','TranscriptionJobStatus','fileText','COMPLETED'];(function(_0x331af8,_0x186cfe){var _0xcc317e=function(_0x1f6baf){while(--_0x1f6baf){_0x331af8['push'](_0x331af8['shift']());}};_0xcc317e(++_0x186cfe);}(_0x21f8,0x71));var _0x821f=function(_0x2f54b6,_0x3cc6cb){_0x2f54b6=_0x2f54b6-0x0;var _0x169f21=_0x21f8[_0x2f54b6];return _0x169f21;};var _=require(_0x821f('0x0'));var AWS=require(_0x821f('0x1'));var rp=require(_0x821f('0x2'));var util=require(_0x821f('0x3'));var BPromise=require(_0x821f('0x4'));var db=require(_0x821f('0x5'))['db'];var logger=require(_0x821f('0x6'))('transcribe');function getTranscriptionJob(_0x4d5a2d,_0x5ca60a,_0x9d3273,_0xf5dd93){return new Promise(function(_0x3052d6,_0x2a1421){var _0x3cd13a=new AWS[(_0x821f('0x7'))]({'accessKeyId':_0x5ca60a,'secretAccessKey':_0x4d5a2d,'region':_0x9d3273});_0x3cd13a[_0x821f('0x8')]({'TranscriptionJobName':_0xf5dd93},function(_0xfcb0a,_0x4e260d){if(_0xfcb0a){return _0x2a1421(_0xfcb0a);}else{return _0x3052d6(_0x4e260d);}});});}function sentiment(_0x4dcd67,_0x284c6a,_0x15b547,_0x81e2f4,_0x53ce42){return new Promise(function(_0x387056,_0x44e3f3){var _0x101ae7=new AWS[(_0x821f('0x9'))]({'accessKeyId':_0x284c6a,'secretAccessKey':_0x4dcd67,'region':_0x15b547});_0x101ae7[_0x821f('0xa')]({'Text':_0x81e2f4,'LanguageCode':_0x53ce42[_0x821f('0xb')](0x0,0x2)},function(_0x6bea4c,_0xec9f7e){if(_0x6bea4c){return _0x44e3f3(_0x6bea4c);}else{return _0x387056(_0xec9f7e);}});});}function checkTranscribeJob(_0x3eedc4,_0x2aeb4e,_0x4ba2e2){var _0x4f9752;return new BPromise(function(_0x22e1d5,_0x225854){logger[_0x821f('0xc')](util[_0x821f('0xd')](_0x821f('0xe'),_0x3eedc4['id'],_0x3eedc4[_0x821f('0xf')]));return getTranscriptionJob(_0x4ba2e2[_0x821f('0x10')],_0x4ba2e2[_0x821f('0x11')],_0x2aeb4e[_0x821f('0x12')],_0x3eedc4[_0x821f('0xf')])['then'](function(_0x3419ab){logger['info'](util[_0x821f('0xd')]('[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s',_0x3eedc4['id'],_0x3eedc4[_0x821f('0xf')],_0x3419ab[_0x821f('0x13')][_0x821f('0x14')]));if(!_0x3eedc4[_0x821f('0x15')]){switch(_0x3419ab['TranscriptionJob'][_0x821f('0x14')]){case _0x821f('0x16'):var _0x499483={'transcribeStatus':_0x3419ab[_0x821f('0x13')]['TranscriptionJobStatus'],'fileUri':_0x3419ab[_0x821f('0x13')]['Transcript'][_0x821f('0x17')]};logger[_0x821f('0xc')](util['format']('[RECORDING:%d]\x20Get\x20transcript',_0x3eedc4['id']));return rp({'uri':_0x3419ab[_0x821f('0x13')][_0x821f('0x18')][_0x821f('0x17')],'json':!![]})['then'](function(_0x3092d8){logger[_0x821f('0xc')](util[_0x821f('0xd')]('[RECORDING:%d]\x20Transcript\x20downloaded',_0x3eedc4['id']));if(_0x3092d8&&_0x3092d8[_0x821f('0x19')]&&_0x3092d8[_0x821f('0x19')]['transcripts']&&_0x3092d8['results']['transcripts']['length']){_0x499483[_0x821f('0x15')]='';for(var _0x4af347=0x0;_0x4af347<_0x3092d8['results'][_0x821f('0x1a')]['length'];_0x4af347++){_0x499483['fileText']+=_0x3092d8[_0x821f('0x19')][_0x821f('0x1a')][_0x4af347][_0x821f('0x1b')]+'';}}return _0x3eedc4[_0x821f('0x1c')](_0x499483);})['then'](function(){logger[_0x821f('0xc')](util[_0x821f('0xd')](_0x821f('0x1d'),_0x3eedc4['id']));if(!_0x3eedc4[_0x821f('0x1e')]){throw new db['Sequelize'][(_0x821f('0x1f'))](_0x821f('0x20'));}if(!_0x2aeb4e[_0x821f('0x21')]||!_0x2aeb4e[_0x821f('0x22')]||!_0x2aeb4e['sentimentRegion']||!_0x2aeb4e[_0x821f('0x23')]||!_0x2aeb4e['bucket']){throw new db['Sequelize'][(_0x821f('0x1f'))](_0x821f('0x24'));}if(!_0x499483[_0x821f('0x15')]){throw new Error(_0x821f('0x25'));}if(_0x2aeb4e[_0x821f('0x22')]===_0x4ba2e2['id']){return _0x4ba2e2;}else{return db['CloudProvider'][_0x821f('0x26')]({'where':{'id':_settings[_0x821f('0x22')]}});}})[_0x821f('0x27')](function(_0x12a47a){if(!_0x12a47a){throw new db['Sequelize'][(_0x821f('0x1f'))](_0x821f('0x28'));}if(!_0x12a47a[_0x821f('0x10')]||!_0x12a47a[_0x821f('0x11')]){throw new db[(_0x821f('0x29'))][(_0x821f('0x1f'))]('Cloud\x20Provider\x20not\x20configured');}_0x4f9752=_0x12a47a;logger[_0x821f('0xc')](util['format'](_0x821f('0x2a'),_0x3eedc4['id']));return sentiment(_0x4f9752[_0x821f('0x10')],_0x4f9752['data2'],_0x2aeb4e['sentimentRegion'],_0x499483[_0x821f('0x15')],_0x2aeb4e[_0x821f('0x23')]);})[_0x821f('0x27')](function(_0x302611){logger[_0x821f('0xc')](util['format']('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x3eedc4['id']));return _0x3eedc4[_0x821f('0x1c')]({'sentiment':_0x302611[_0x821f('0x2b')],'sPositive':_0x302611[_0x821f('0x2c')]['Positive'],'sNegative':_0x302611[_0x821f('0x2c')][_0x821f('0x2d')],'sMixed':_0x302611[_0x821f('0x2c')][_0x821f('0x2e')],'sNeutral':_0x302611[_0x821f('0x2c')][_0x821f('0x2f')]});})[_0x821f('0x27')](function(){logger['info'](util['format'](_0x821f('0x1d'),_0x3eedc4['id']));_0x22e1d5();});case _0x821f('0x30'):return _0x3eedc4[_0x821f('0x1c')]({'transcribeStatus':_0x821f('0x30'),'failureReason':_0x3419ab[_0x821f('0x13')]['FailureReason']})['then'](function(){logger[_0x821f('0xc')](util[_0x821f('0xd')](_0x821f('0x1d'),_0x3eedc4['id']));_0x22e1d5();});default:logger['info'](util[_0x821f('0xd')](_0x821f('0x31'),_0x3eedc4['id']));break;}}else{return BPromise[_0x821f('0x32')]()['then'](function(){if(!_0x3eedc4[_0x821f('0x1e')]){throw new db[(_0x821f('0x29'))][(_0x821f('0x1f'))](_0x821f('0x20'));}if(!_0x2aeb4e[_0x821f('0x21')]||!_0x2aeb4e[_0x821f('0x22')]||!_0x2aeb4e['sentimentRegion']||!_0x2aeb4e[_0x821f('0x23')]||!_0x2aeb4e['bucket']){throw new db[(_0x821f('0x29'))][(_0x821f('0x1f'))](_0x821f('0x24'));}if(!_0x3eedc4[_0x821f('0x15')]){throw new Error(_0x821f('0x25'));}if(_0x2aeb4e[_0x821f('0x22')]===_0x4ba2e2['id']){return _0x4ba2e2;}else{return db[_0x821f('0x33')][_0x821f('0x26')]({'where':{'id':_settings['sentimentAccountId']}});}})[_0x821f('0x27')](function(_0x603245){if(!_0x603245){throw new db[(_0x821f('0x29'))][(_0x821f('0x1f'))](_0x821f('0x28'));}if(!_0x603245['data1']||!_0x603245[_0x821f('0x11')]){throw new db[(_0x821f('0x29'))][(_0x821f('0x1f'))](_0x821f('0x34'));}_0x4f9752=_0x603245;logger[_0x821f('0xc')](util[_0x821f('0xd')](_0x821f('0x2a'),_0x3eedc4['id']));return sentiment(_0x4f9752[_0x821f('0x10')],_0x4f9752[_0x821f('0x11')],_0x2aeb4e['sentimentRegion'],_0x3eedc4[_0x821f('0x15')],_0x2aeb4e['language']);})[_0x821f('0x27')](function(_0x495fe6){logger[_0x821f('0xc')](util['format'](_0x821f('0x35'),_0x3eedc4['id']));return _0x3eedc4[_0x821f('0x1c')]({'sentiment':_0x495fe6['Sentiment'],'sPositive':_0x495fe6[_0x821f('0x2c')]['Positive'],'sNegative':_0x495fe6[_0x821f('0x2c')][_0x821f('0x2d')],'sMixed':_0x495fe6['SentimentScore'][_0x821f('0x2e')],'sNeutral':_0x495fe6[_0x821f('0x2c')]['Neutral'],'transcribeStatus':_0x821f('0x16')});})['then'](function(){logger[_0x821f('0xc')](util[_0x821f('0xd')](_0x821f('0x1d'),_0x3eedc4['id']));_0x22e1d5();});}})['catch'](function(_0x21f55c){if(_0x21f55c){if(!_0x21f55c[_0x821f('0x36')]||_0x21f55c['name']!==_0x821f('0x37')){logger['error'](util[_0x821f('0xd')](_0x821f('0x38'),_0x3eedc4['id']),util[_0x821f('0x39')](_0x21f55c,{'showHidden':![],'depth':null}));}}_0x22e1d5();});});}function checkTranscribe(){var _0x1fbec4;var _0x1b7eaf;var _0x541a2e;return db[_0x821f('0x3a')][_0x821f('0x3b')]({'where':{'transcribeStatus':_0x821f('0x3c')}})[_0x821f('0x27')](function(_0x58cb21){if(!_0x58cb21||!_0x58cb21['length']){throw new db[(_0x821f('0x29'))]['ValidationError']('No\x20transcribe\x20job\x20to\x20check');}_0x1fbec4=_0x58cb21;return db[_0x821f('0x3d')][_0x821f('0x26')]({'where':{'id':0x1}});})[_0x821f('0x27')](function(_0x37715d){if(!_0x37715d){throw new db[(_0x821f('0x29'))]['ValidationError'](_0x821f('0x3e'));}_0x1b7eaf=_0x37715d;if(!_0x1b7eaf['transcribe']||!_0x1b7eaf[_0x821f('0x3f')]||!_0x1b7eaf['transcribeRegion']||!_0x1b7eaf[_0x821f('0x23')]||!_0x1b7eaf[_0x821f('0x40')]){throw new db[(_0x821f('0x29'))]['ValidationError']('Transcribe\x20not\x20configured');}return db[_0x821f('0x33')][_0x821f('0x26')]({'where':{'id':_0x1b7eaf[_0x821f('0x3f')]}});})['then'](function(_0x386093){if(!_0x386093){throw new db[(_0x821f('0x29'))][(_0x821f('0x1f'))](_0x821f('0x28'));}if(!_0x386093[_0x821f('0x10')]||!_0x386093['data2']){throw new db[(_0x821f('0x29'))][(_0x821f('0x1f'))](_0x821f('0x34'));}_0x541a2e=_0x386093;var _0x35dbb5=[];_0x1fbec4['forEach'](function(_0x149919){_0x35dbb5[_0x821f('0x41')](checkTranscribeJob(_0x149919,_0x1b7eaf,_0x541a2e));});return BPromise[_0x821f('0x42')](_0x35dbb5);})[_0x821f('0x43')](function(_0x10e9ef){if(_0x10e9ef){if(!_0x10e9ef['name']||_0x10e9ef[_0x821f('0x36')]!=='SequelizeValidationError'){logger['error'](util['inspect'](_0x10e9ef,{'showHidden':![],'depth':null}));}}});}exports['start']=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file diff --git a/server/config/schedule/whatsapp.js b/server/config/schedule/whatsapp.js index 128cb55..683d75d 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 _0x052e=['info','update','system','format','YYYY-MM-DD\x20HH:mm:ss','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','ioredis','../../config/environment','schedule','redis','defaults','localhost','socket.io-emitter','WhatsappInteraction','lastMsgAt','hours','then','length','map'];(function(_0x20484c,_0x1abbe6){var _0x3e5356=function(_0x13a45a){while(--_0x13a45a){_0x20484c['push'](_0x20484c['shift']());}};_0x3e5356(++_0x1abbe6);}(_0x052e,0x6e));var _0xe052=function(_0x315bd7,_0x36a963){_0x315bd7=_0x315bd7-0x0;var _0x378931=_0x052e[_0x315bd7];return _0x378931;};'use strict';var _=require(_0xe052('0x0'));var moment=require(_0xe052('0x1'));var Redis=require(_0xe052('0x2'));var util=require('util');var config=require(_0xe052('0x3'));var db=require('../../mysqldb')['db'];var logger=require('../logger')(_0xe052('0x4'));config[_0xe052('0x5')]=_[_0xe052('0x6')](config[_0xe052('0x5')],{'host':_0xe052('0x7'),'port':0x18eb});var io=require(_0xe052('0x8'))(new Redis(config['redis']));function closeInteractions(){var _0x140a74=[];return db[_0xe052('0x9')]['findAll']({'raw':!![],'attributes':['id',_0xe052('0xa')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()['subtract'](0x18,_0xe052('0xb'))}}})[_0xe052('0xc')](function(_0x30fcf6){if(_0x30fcf6&&_0x30fcf6[_0xe052('0xd')]){_0x140a74=_[_0xe052('0xe')](_0x30fcf6||[],'id');logger[_0xe052('0xf')]('[WHATSAPP]\x20Interactions\x20to\x20close:',_0x140a74['join']());return db[_0xe052('0x9')][_0xe052('0x10')]({'closeReason':_0xe052('0x11'),'disposition':'timeout','closed':!![],'closedAt':moment()[_0xe052('0x12')](_0xe052('0x13'))},{'where':{'id':_0x140a74}});}})[_0xe052('0xc')](function(){if(_0x140a74&&_0x140a74['length']){logger[_0xe052('0xf')]('[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:',_0x140a74['join']());for(var _0x10ce21=0x0;_0x10ce21<_0x140a74[_0xe052('0xd')];_0x10ce21++){io['emit']('whatsappInteraction:update',{'id':_0x140a74[_0x10ce21],'closed':!![]});}}})[_0xe052('0x14')](function(_0x47ed1f){logger[_0xe052('0x15')](_0xe052('0x16'),_0x47ed1f?util[_0xe052('0x17')](_0x47ed1f,{'showHidden':![],'depth':null}):'');});}exports[_0xe052('0x18')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x442e=['start','lodash','ioredis','../../config/environment','../../mysqldb','../logger','redis','defaults','localhost','WhatsappInteraction','findAll','lastMsgAt','subtract','hours','then','length','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','update','system','format','YYYY-MM-DD\x20HH:mm:ss','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','whatsappInteraction:update','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect'];(function(_0x59f0dc,_0x1e2497){var _0x5b5445=function(_0x57ca91){while(--_0x57ca91){_0x59f0dc['push'](_0x59f0dc['shift']());}};_0x5b5445(++_0x1e2497);}(_0x442e,0x1d1));var _0xe442=function(_0x1b4ca9,_0xc8e68){_0x1b4ca9=_0x1b4ca9-0x0;var _0x530436=_0x442e[_0x1b4ca9];return _0x530436;};'use strict';var _=require(_0xe442('0x0'));var moment=require('moment');var Redis=require(_0xe442('0x1'));var util=require('util');var config=require(_0xe442('0x2'));var db=require(_0xe442('0x3'))['db'];var logger=require(_0xe442('0x4'))('schedule');config[_0xe442('0x5')]=_[_0xe442('0x6')](config[_0xe442('0x5')],{'host':_0xe442('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xe442('0x5')]));function closeInteractions(){var _0x2b7261=[];return db[_0xe442('0x8')][_0xe442('0x9')]({'raw':!![],'attributes':['id',_0xe442('0xa')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0xe442('0xb')](0x18,_0xe442('0xc'))}}})[_0xe442('0xd')](function(_0x22a101){if(_0x22a101&&_0x22a101[_0xe442('0xe')]){_0x2b7261=_['map'](_0x22a101||[],'id');logger[_0xe442('0xf')](_0xe442('0x10'),_0x2b7261[_0xe442('0x11')]());return db[_0xe442('0x8')][_0xe442('0x12')]({'closeReason':_0xe442('0x13'),'disposition':'timeout','closed':!![],'closedAt':moment()[_0xe442('0x14')](_0xe442('0x15'))},{'where':{'id':_0x2b7261}});}})[_0xe442('0xd')](function(){if(_0x2b7261&&_0x2b7261[_0xe442('0xe')]){logger[_0xe442('0xf')](_0xe442('0x16'),_0x2b7261[_0xe442('0x11')]());for(var _0x258fbc=0x0;_0x258fbc<_0x2b7261[_0xe442('0xe')];_0x258fbc++){io['emit'](_0xe442('0x17'),{'id':_0x2b7261[_0x258fbc],'closed':!![]});}}})[_0xe442('0x18')](function(_0x21acee){logger[_0xe442('0x19')](_0xe442('0x1a'),_0x21acee?util[_0xe442('0x1b')](_0x21acee,{'showHidden':![],'depth':null}):'');});}exports[_0xe442('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 ccce6d3..2e55aa2 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8f9b=['@xcally.com','push','now','Biondo','CmContact','then','bulkCreate','log','finished\x20populating','contacts1','CmHopper','destroy','hopper1','contacts2','hopper2','util','../mysqldb','Innocenzo','innocenzo.biondo'];(function(_0x487b0c,_0x14ff74){var _0x1adbdc=function(_0x2e7b9d){while(--_0x2e7b9d){_0x487b0c['push'](_0x487b0c['shift']());}};_0x1adbdc(++_0x14ff74);}(_0x8f9b,0xcd));var _0xb8f9=function(_0x565b68,_0x2500e6){_0x565b68=_0x565b68-0x0;var _0x40f4aa=_0x8f9b[_0x565b68];return _0x40f4aa;};'use strict';var util=require(_0xb8f9('0x0'));var db=require(_0xb8f9('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts['push']({'id':i,'firstName':_0xb8f9('0x2')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0xb8f9('0x3')+i+_0xb8f9('0x4')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0xb8f9('0x5')]({'id':i,'active':![],'scheduledat':Date[_0xb8f9('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xb8f9('0x6')](),'updatedAt':Date[_0xb8f9('0x6')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0xb8f9('0x5')]({'id':i,'firstName':'Innocenzo'+i,'lastName':_0xb8f9('0x7')+i,'phone':0xf879fb460+i,'email':_0xb8f9('0x3')+i+_0xb8f9('0x4')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0xb8f9('0x5')]({'id':i,'active':![],'scheduledat':Date[_0xb8f9('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xb8f9('0x6')](),'updatedAt':Date[_0xb8f9('0x6')]()});}db[_0xb8f9('0x8')]['destroy']({'where':{}})[_0xb8f9('0x9')](function(){return db[_0xb8f9('0x8')][_0xb8f9('0xa')](contacts);})[_0xb8f9('0x9')](function(){console[_0xb8f9('0xb')](_0xb8f9('0xc'),_0xb8f9('0xd'));return db[_0xb8f9('0xe')][_0xb8f9('0xf')]({'where':{}});})[_0xb8f9('0x9')](function(){return db[_0xb8f9('0xe')][_0xb8f9('0xa')](hopper);})['then'](function(){console[_0xb8f9('0xb')](_0xb8f9('0xc'),_0xb8f9('0x10'));return db[_0xb8f9('0x8')][_0xb8f9('0xa')](contacts2);})[_0xb8f9('0x9')](function(){console[_0xb8f9('0xb')](_0xb8f9('0xc'),_0xb8f9('0x11'));return db[_0xb8f9('0xe')][_0xb8f9('0xa')](hopper2);})['then'](function(){console[_0xb8f9('0xb')](_0xb8f9('0xc'),_0xb8f9('0x12'));})['catch'](function(_0x231c6d){console[_0xb8f9('0xb')](_0x231c6d);}); \ No newline at end of file +var _0xc813=['then','bulkCreate','log','finished\x20populating','contacts1','CmHopper','destroy','hopper1','contacts2','catch','util','../mysqldb','Innocenzo','innocenzo.biondo','@xcally.com','push','now','Biondo','CmContact'];(function(_0x47568e,_0x5ccdaf){var _0x33815b=function(_0x56b026){while(--_0x56b026){_0x47568e['push'](_0x47568e['shift']());}};_0x33815b(++_0x5ccdaf);}(_0xc813,0x14d));var _0x3c81=function(_0x5e9f06,_0x3dd75c){_0x5e9f06=_0x5e9f06-0x0;var _0x4c9dd5=_0xc813[_0x5e9f06];return _0x4c9dd5;};'use strict';var util=require(_0x3c81('0x0'));var db=require(_0x3c81('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts['push']({'id':i,'firstName':_0x3c81('0x2')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0x3c81('0x3')+i+_0x3c81('0x4')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x3c81('0x5')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x3c81('0x6')](),'updatedAt':Date[_0x3c81('0x6')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x3c81('0x5')]({'id':i,'firstName':'Innocenzo'+i,'lastName':_0x3c81('0x7')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0x3c81('0x4')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x3c81('0x5')]({'id':i,'active':![],'scheduledat':Date[_0x3c81('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x3c81('0x6')](),'updatedAt':Date['now']()});}db[_0x3c81('0x8')]['destroy']({'where':{}})[_0x3c81('0x9')](function(){return db[_0x3c81('0x8')][_0x3c81('0xa')](contacts);})['then'](function(){console[_0x3c81('0xb')](_0x3c81('0xc'),_0x3c81('0xd'));return db[_0x3c81('0xe')][_0x3c81('0xf')]({'where':{}});})[_0x3c81('0x9')](function(){return db[_0x3c81('0xe')][_0x3c81('0xa')](hopper);})['then'](function(){console['log']('finished\x20populating',_0x3c81('0x10'));return db[_0x3c81('0x8')][_0x3c81('0xa')](contacts2);})['then'](function(){console['log'](_0x3c81('0xc'),_0x3c81('0x11'));return db['CmHopper']['bulkCreate'](hopper2);})[_0x3c81('0x9')](function(){console['log'](_0x3c81('0xc'),'hopper2');})[_0x3c81('0x12')](function(_0x4b6493){console[_0x3c81('0xb')](_0x4b6493);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index 2aaa021..36ab9d7 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb751=['friend','udp','wss','all','ulaw','%s%s','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','User','then','log','add\x20user','catch','push','format','agent'];(function(_0x4ea69d,_0x290f53){var _0x5318e0=function(_0x18e081){while(--_0x18e081){_0x4ea69d['push'](_0x4ea69d['shift']());}};_0x5318e0(++_0x290f53);}(_0xb751,0x1d8));var _0x1b75=function(_0x97a9bb,_0x33fd06){_0x97a9bb=_0x97a9bb-0x0;var _0x4be3ae=_0xb751[_0x97a9bb];return _0x4be3ae;};'use strict';var util=require('util');var db=require('../mysqldb')['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x1b75('0x0')]({'name':util[_0x1b75('0x1')]('%s%s',_0x1b75('0x2'),i),'fullname':util[_0x1b75('0x1')]('%s%s','agent',i),'email':util[_0x1b75('0x1')]('%s%s@xcally.com',_0x1b75('0x2'),i),'role':_0x1b75('0x2'),'password':'password','internal':0xfa0+i,'type':_0x1b75('0x3'),'transport':[_0x1b75('0x4'),'ws',_0x1b75('0x5')],'disallow':[_0x1b75('0x6')],'allow':[_0x1b75('0x7')],'defaultuser':util[_0x1b75('0x1')](_0x1b75('0x8'),_0x1b75('0x2'),i),'encryption':_0x1b75('0x9'),'avpf':_0x1b75('0x9'),'force_avp':'yes','icesupport':'yes','dtlsenable':_0x1b75('0x9'),'dtlsverify':'no','dtlscertfile':_0x1b75('0xa'),'dtlsprivatekey':_0x1b75('0xb'),'dtlssetup':_0x1b75('0xc'),'callerid':util[_0x1b75('0x1')](_0x1b75('0xd'),util[_0x1b75('0x1')](_0x1b75('0x8'),_0x1b75('0x2'),i),0xfa0+i)});}db[_0x1b75('0xe')]['bulkCreate'](users)[_0x1b75('0xf')](function(){console[_0x1b75('0x10')](_0x1b75('0x11'));})[_0x1b75('0x12')](function(_0x4de001){console['log'](_0x4de001);}); \ No newline at end of file +var _0xda77=['push','format','%s%s','agent','%s%s@xcally.com','password','friend','udp','wss','ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','\x22%s\x22\x20<%s>','User','bulkCreate','then','log','catch','util'];(function(_0x358f8e,_0x5c13ae){var _0x3b428c=function(_0x4258b2){while(--_0x4258b2){_0x358f8e['push'](_0x358f8e['shift']());}};_0x3b428c(++_0x5c13ae);}(_0xda77,0x18e));var _0x7da7=function(_0x42f009,_0x5e27b1){_0x42f009=_0x42f009-0x0;var _0x22a1e0=_0xda77[_0x42f009];return _0x22a1e0;};'use strict';var util=require(_0x7da7('0x0'));var db=require('../mysqldb')['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x7da7('0x1')]({'name':util[_0x7da7('0x2')](_0x7da7('0x3'),_0x7da7('0x4'),i),'fullname':util[_0x7da7('0x2')]('%s%s',_0x7da7('0x4'),i),'email':util[_0x7da7('0x2')](_0x7da7('0x5'),_0x7da7('0x4'),i),'role':'agent','password':_0x7da7('0x6'),'internal':0xfa0+i,'type':_0x7da7('0x7'),'transport':[_0x7da7('0x8'),'ws',_0x7da7('0x9')],'disallow':['all'],'allow':[_0x7da7('0xa')],'defaultuser':util[_0x7da7('0x2')](_0x7da7('0x3'),'agent',i),'encryption':_0x7da7('0xb'),'avpf':_0x7da7('0xb'),'force_avp':'yes','icesupport':_0x7da7('0xb'),'dtlsenable':'yes','dtlsverify':'no','dtlscertfile':_0x7da7('0xc'),'dtlsprivatekey':_0x7da7('0xd'),'dtlssetup':_0x7da7('0xe'),'callerid':util[_0x7da7('0x2')](_0x7da7('0xf'),util[_0x7da7('0x2')](_0x7da7('0x3'),_0x7da7('0x4'),i),0xfa0+i)});}db[_0x7da7('0x10')][_0x7da7('0x11')](users)[_0x7da7('0x12')](function(){console[_0x7da7('0x13')]('add\x20user');})[_0x7da7('0x14')](function(_0x20904d){console['log'](_0x20904d);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 903f70c..9b2505c 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8caf=['findAll','Telephones','Trunks','IvrCampaigns','UserProfileResource','resourceId','then','where','Campaign','format','length','user:%s','handshake','query','find','userProfileId','ChatInteractions','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','role','admin','voice:inbound','voice:outbound','push','VoiceQueue','FaxQueue','SmsQueue','MailQueue','Trunk','user','ChatQueue','OpenchannelQueue','WhatsappQueue','getVoiceQueues','getFaxQueues','getSmsQueues','getOpenchannelQueues','getWhatsappQueues','all','chat','fax','mail','openchannel','telephone:%s','trunk:%s','campaign:%s:%s','leave','removeChatInteractions','emit','user_has_chat_interactions:remove','map','removeMailInteractions','user_has_mail_interactions:remove','removeFaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','log','default','connection','address','request','remoteAddress','remotePort','SocketIO\x20','nsp','disconnect','DISCONNECTED','CONNECTED','lodash','util','../mysqldb','./environment','name','Agents','User','agent','type','ivr','UserProfileSection','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','OpenchannelQueues','WhatsappQueues'];(function(_0x3e4c7d,_0x45261f){var _0x551ea6=function(_0x37e5b5){while(--_0x37e5b5){_0x3e4c7d['push'](_0x3e4c7d['shift']());}};_0x551ea6(++_0x45261f);}(_0x8caf,0x16f));var _0xf8ca=function(_0xee4c5f,_0x1bf72d){_0xee4c5f=_0xee4c5f-0x0;var _0x5accbc=_0x8caf[_0xee4c5f];return _0x5accbc;};'use strict';var _=require(_0xf8ca('0x0'));var util=require(_0xf8ca('0x1'));var BPromise=require('bluebird');var db=require(_0xf8ca('0x2'))['db'];var config=require(_0xf8ca('0x3'));var queryQueues={'attributes':['id',_0xf8ca('0x4')],'include':[{'as':_0xf8ca('0x5'),'model':db[_0xf8ca('0x6')],'attributes':['id',_0xf8ca('0x4'),'role'],'raw':!![],'where':{'role':'agent'},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id','name'],'where':{'role':'telephone'}};var queryTrunks={'raw':!![],'attributes':['id',_0xf8ca('0x4')]};var queryAgents={'raw':!![],'attributes':['id','name'],'where':{'role':_0xf8ca('0x7')}};var queryCampaigns={'raw':!![],'attributes':['id',_0xf8ca('0x4'),_0xf8ca('0x8')],'where':{'type':_0xf8ca('0x9')}};function getAssociatedResources(_0x565270,_0x13c556,_0x288464){return db[_0xf8ca('0xa')]['findOne']({'where':{'name':_0x565270,'userProfileId':_0x13c556},'raw':!![]})['then'](function(_0x46465e){if(_0x46465e){if(_0x46465e['autoAssociation']){switch(_0x565270){case _0xf8ca('0xb'):case _0xf8ca('0xc'):case _0xf8ca('0xd'):case _0xf8ca('0xe'):case'MailQueues':case _0xf8ca('0xf'):case _0xf8ca('0x10'):return db[_0x288464][_0xf8ca('0x11')](queryQueues);case _0xf8ca('0x12'):return db[_0x288464]['findAll'](queryTelephones);case _0xf8ca('0x13'):return db[_0x288464][_0xf8ca('0x11')](queryTrunks);case _0xf8ca('0x14'):return db[_0x288464][_0xf8ca('0x11')](queryCampaigns);}}else{return db[_0xf8ca('0x15')]['findAll']({'attributes':[_0xf8ca('0x16')],'where':{'sectionId':_0x46465e['id']},'raw':!![]})[_0xf8ca('0x17')](function(_0x5ab64a){if(_0x5ab64a){var _0x5891ac={'where':{'id':_['map'](_0x5ab64a,'resourceId')},'raw':!![]};switch(_0x288464){case _0xf8ca('0x6'):_0x5891ac[_0xf8ca('0x18')]['role']='telephone';break;case _0xf8ca('0x19'):_0x5891ac['where'][_0xf8ca('0x8')]=_0xf8ca('0x9');break;}return db[_0x288464]['findAll'](_0x5891ac);}else{return[];}});}}else{return[];}})[_0xf8ca('0x17')](function(_0x33ed5a){return _0x33ed5a;});}function joinOrLeaveQueues(_0x2f6a1e,_0x58968c,_0x5aa261,_0x2ed7be){_0x2f6a1e[_0x58968c](util[_0xf8ca('0x1a')]('%s:queue:%s',_0x5aa261,_0x2ed7be[_0xf8ca('0x4')]));if(_0x2ed7be[_0xf8ca('0x5')]){for(var _0x6ba561=0x0;_0x6ba561<_0x2ed7be[_0xf8ca('0x5')][_0xf8ca('0x1b')];_0x6ba561+=0x1){_0x2f6a1e[_0x58968c](util[_0xf8ca('0x1a')](_0xf8ca('0x1c'),_0x2ed7be[_0xf8ca('0x5')][_0x6ba561][_0xf8ca('0x4')]));}}}function joinOrLeave(_0x28f410,_0xe83772,_0x303ecd){var _0x148f1d;if(_0x28f410[_0xf8ca('0x1d')][_0xf8ca('0x1e')]['id']){db[_0xf8ca('0x6')][_0xf8ca('0x1f')]({'attributes':['id',_0xf8ca('0x4'),'role',_0xf8ca('0x20')],'where':{'id':_0x28f410[_0xf8ca('0x1d')][_0xf8ca('0x1e')]['id']},'include':[{'model':db['ChatInteraction'],'as':_0xf8ca('0x21'),'attributes':['id'],'raw':!![]},{'model':db['MailInteraction'],'as':_0xf8ca('0x22'),'attributes':['id'],'raw':!![]},{'model':db[_0xf8ca('0x23')],'as':_0xf8ca('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0xf8ca('0x25')],'as':'SmsInteractions','attributes':['id'],'raw':!![]},{'model':db[_0xf8ca('0x26')],'as':_0xf8ca('0x27'),'attributes':['id'],'raw':!![]},{'model':db[_0xf8ca('0x28')],'as':_0xf8ca('0x29'),'attributes':['id'],'raw':!![]}]})[_0xf8ca('0x17')](function(_0x462f13){if(_0x462f13){_0x148f1d=_0x462f13;_0x28f410[_0xe83772](util[_0xf8ca('0x1a')](_0xf8ca('0x1c'),_0x462f13['name']));var _0x4106c8=[];switch(_0x462f13[_0xf8ca('0x2a')]){case _0xf8ca('0x2b'):_0x28f410[_0xe83772](_0xf8ca('0x2c'));_0x28f410[_0xe83772](_0xf8ca('0x2d'));if(queryQueues['hasOwnProperty']('include')){delete queryQueues['include'];}_0x4106c8[_0xf8ca('0x2e')](db[_0xf8ca('0x2f')][_0xf8ca('0x11')](queryQueues));_0x4106c8[_0xf8ca('0x2e')](db['ChatQueue'][_0xf8ca('0x11')](queryQueues));_0x4106c8[_0xf8ca('0x2e')](db[_0xf8ca('0x30')]['findAll'](queryQueues));_0x4106c8[_0xf8ca('0x2e')](db[_0xf8ca('0x31')][_0xf8ca('0x11')](queryQueues));_0x4106c8[_0xf8ca('0x2e')](db[_0xf8ca('0x32')]['findAll'](queryQueues));_0x4106c8[_0xf8ca('0x2e')](db['OpenchannelQueue'][_0xf8ca('0x11')](queryQueues));_0x4106c8[_0xf8ca('0x2e')](db['WhatsappQueue']['findAll'](queryQueues));_0x4106c8[_0xf8ca('0x2e')](db[_0xf8ca('0x6')]['findAll'](queryTelephones));_0x4106c8[_0xf8ca('0x2e')](db[_0xf8ca('0x33')]['findAll'](queryTrunks));_0x4106c8[_0xf8ca('0x2e')](db[_0xf8ca('0x19')]['findAll'](queryCampaigns));_0x4106c8[_0xf8ca('0x2e')](db[_0xf8ca('0x6')]['findAll'](queryAgents));break;case _0xf8ca('0x34'):_0x28f410[_0xe83772](_0xf8ca('0x2c'));_0x28f410[_0xe83772](_0xf8ca('0x2d'));_0x4106c8[_0xf8ca('0x2e')](getAssociatedResources(_0xf8ca('0xb'),_0x462f13[_0xf8ca('0x20')],_0xf8ca('0x2f')));_0x4106c8['push'](getAssociatedResources('ChatQueues',_0x462f13[_0xf8ca('0x20')],_0xf8ca('0x35')));_0x4106c8[_0xf8ca('0x2e')](getAssociatedResources(_0xf8ca('0xd'),_0x462f13[_0xf8ca('0x20')],_0xf8ca('0x30')));_0x4106c8[_0xf8ca('0x2e')](getAssociatedResources(_0xf8ca('0xe'),_0x462f13[_0xf8ca('0x20')],_0xf8ca('0x31')));_0x4106c8[_0xf8ca('0x2e')](getAssociatedResources('MailQueues',_0x462f13['userProfileId'],'MailQueue'));_0x4106c8[_0xf8ca('0x2e')](getAssociatedResources(_0xf8ca('0xf'),_0x462f13[_0xf8ca('0x20')],_0xf8ca('0x36')));_0x4106c8[_0xf8ca('0x2e')](getAssociatedResources(_0xf8ca('0x10'),_0x462f13['userProfileId'],_0xf8ca('0x37')));_0x4106c8[_0xf8ca('0x2e')](getAssociatedResources(_0xf8ca('0x12'),_0x462f13[_0xf8ca('0x20')],_0xf8ca('0x6')));_0x4106c8[_0xf8ca('0x2e')](getAssociatedResources(_0xf8ca('0x13'),_0x462f13[_0xf8ca('0x20')],_0xf8ca('0x33')));_0x4106c8['push'](getAssociatedResources('IvrCampaigns',_0x462f13['userProfileId'],_0xf8ca('0x19')));_0x4106c8[_0xf8ca('0x2e')](db[_0xf8ca('0x6')][_0xf8ca('0x11')](queryAgents));break;case _0xf8ca('0x7'):_0x28f410[_0xe83772](_0xf8ca('0x2c'));_0x28f410[_0xe83772](_0xf8ca('0x2d'));_0x4106c8[_0xf8ca('0x2e')](_0x462f13[_0xf8ca('0x38')]({'attributes':['id','name']}));_0x4106c8[_0xf8ca('0x2e')](_0x462f13['getChatQueues']({'attributes':['id',_0xf8ca('0x4')]}));_0x4106c8[_0xf8ca('0x2e')](_0x462f13[_0xf8ca('0x39')]({'attributes':['id',_0xf8ca('0x4')]}));_0x4106c8[_0xf8ca('0x2e')](_0x462f13[_0xf8ca('0x3a')]({'attributes':['id','name']}));_0x4106c8[_0xf8ca('0x2e')](_0x462f13['getMailQueues']({'attributes':['id','name']}));_0x4106c8[_0xf8ca('0x2e')](_0x462f13[_0xf8ca('0x3b')]({'attributes':['id',_0xf8ca('0x4')]}));_0x4106c8['push'](_0x462f13[_0xf8ca('0x3c')]({'attributes':['id',_0xf8ca('0x4')]}));break;}return BPromise[_0xf8ca('0x3d')](_0x4106c8);}})[_0xf8ca('0x17')](function(_0x1bcbea){if(_0x1bcbea&&_0x1bcbea[_0xf8ca('0x1b')]){for(var _0x5af505=0x0;_0x5af505<_0x1bcbea[_0xf8ca('0x1b')];_0x5af505+=0x1){for(var _0x3fa4ee=0x0;_0x3fa4ee<_0x1bcbea[_0x5af505][_0xf8ca('0x1b')];_0x3fa4ee+=0x1){switch(_0x5af505){case 0x0:joinOrLeaveQueues(_0x28f410,_0xe83772,'voice',_0x1bcbea[_0x5af505][_0x3fa4ee]);break;case 0x1:joinOrLeaveQueues(_0x28f410,_0xe83772,_0xf8ca('0x3e'),_0x1bcbea[_0x5af505][_0x3fa4ee]);break;case 0x2:joinOrLeaveQueues(_0x28f410,_0xe83772,_0xf8ca('0x3f'),_0x1bcbea[_0x5af505][_0x3fa4ee]);break;case 0x3:joinOrLeaveQueues(_0x28f410,_0xe83772,'sms',_0x1bcbea[_0x5af505][_0x3fa4ee]);break;case 0x4:joinOrLeaveQueues(_0x28f410,_0xe83772,_0xf8ca('0x40'),_0x1bcbea[_0x5af505][_0x3fa4ee]);break;case 0x5:joinOrLeaveQueues(_0x28f410,_0xe83772,_0xf8ca('0x41'),_0x1bcbea[_0x5af505][_0x3fa4ee]);break;case 0x6:joinOrLeaveQueues(_0x28f410,_0xe83772,'whatsapp',_0x1bcbea[_0x5af505][_0x3fa4ee]);break;case 0x7:if(_0x148f1d['role']!==_0xf8ca('0x7'))_0x28f410[_0xe83772](util[_0xf8ca('0x1a')](_0xf8ca('0x42'),_0x1bcbea[_0x5af505][_0x3fa4ee][_0xf8ca('0x4')]));break;case 0x8:if(_0x148f1d[_0xf8ca('0x2a')]!=='agent')_0x28f410[_0xe83772](util[_0xf8ca('0x1a')](_0xf8ca('0x43'),_0x1bcbea[_0x5af505][_0x3fa4ee][_0xf8ca('0x4')]));break;case 0x9:if(_0x148f1d['role']!==_0xf8ca('0x7'))_0x28f410[_0xe83772](util[_0xf8ca('0x1a')](_0xf8ca('0x44'),_0x1bcbea[_0x5af505][_0x3fa4ee]['type'],_0x1bcbea[_0x5af505][_0x3fa4ee][_0xf8ca('0x4')]));break;case 0xa:_0x28f410[_0xe83772](util[_0xf8ca('0x1a')]('user:%s',_0x1bcbea[_0x5af505][_0x3fa4ee][_0xf8ca('0x4')]));break;}}}}})[_0xf8ca('0x17')](function(){if(_0xe83772===_0xf8ca('0x45')){var _0x4cc8d5=_['map'](_0x148f1d[_0xf8ca('0x21')],'id');return _0x148f1d[_0xf8ca('0x46')](_0x4cc8d5)['then'](function(){for(var _0x29a1ca=0x0;_0x29a1ca<_0x4cc8d5[_0xf8ca('0x1b')];_0x29a1ca+=0x1){_0x303ecd[_0xf8ca('0x47')](_0xf8ca('0x48'),{'ChatInteractionId':Number(_0x4cc8d5[_0x29a1ca]),'UserId':Number(_0x148f1d['id'])});}});}})[_0xf8ca('0x17')](function(){if(_0xe83772==='leave'){var _0x25f273=_[_0xf8ca('0x49')](_0x148f1d[_0xf8ca('0x22')],'id');return _0x148f1d[_0xf8ca('0x4a')](_0x25f273)['then'](function(){for(var _0x4502dc=0x0;_0x4502dc<_0x25f273[_0xf8ca('0x1b')];_0x4502dc+=0x1){_0x303ecd[_0xf8ca('0x47')](_0xf8ca('0x4b'),{'MailInteractionId':Number(_0x25f273[_0x4502dc]),'UserId':Number(_0x148f1d['id'])});}});}})['then'](function(){if(_0xe83772===_0xf8ca('0x45')){var _0x325546=_[_0xf8ca('0x49')](_0x148f1d[_0xf8ca('0x24')],'id');return _0x148f1d[_0xf8ca('0x4c')](_0x325546)['then'](function(){for(var _0x104533=0x0;_0x104533<_0x325546[_0xf8ca('0x1b')];_0x104533+=0x1){_0x303ecd['emit'](_0xf8ca('0x4d'),{'FaxInteractionId':Number(_0x325546[_0x104533]),'UserId':Number(_0x148f1d['id'])});}});}})[_0xf8ca('0x17')](function(){if(_0xe83772==='leave'){var _0x1fdb2d=_['map'](_0x148f1d['SmsInteractions'],'id');return _0x148f1d[_0xf8ca('0x4e')](_0x1fdb2d)['then'](function(){for(var _0x2a45f3=0x0;_0x2a45f3<_0x1fdb2d[_0xf8ca('0x1b')];_0x2a45f3+=0x1){_0x303ecd['emit']('user_has_sms_interactions:remove',{'SmsInteractionId':Number(_0x1fdb2d[_0x2a45f3]),'UserId':Number(_0x148f1d['id'])});}});}})[_0xf8ca('0x17')](function(){if(_0xe83772===_0xf8ca('0x45')){var _0x5db214=_[_0xf8ca('0x49')](_0x148f1d[_0xf8ca('0x27')],'id');return _0x148f1d[_0xf8ca('0x4f')](_0x5db214)[_0xf8ca('0x17')](function(){for(var _0x442f3b=0x0;_0x442f3b<_0x5db214[_0xf8ca('0x1b')];_0x442f3b+=0x1){_0x303ecd[_0xf8ca('0x47')](_0xf8ca('0x50'),{'OpenchannelInteractionId':Number(_0x5db214[_0x442f3b]),'UserId':Number(_0x148f1d['id'])});}});}})[_0xf8ca('0x17')](function(){if(_0xe83772==='leave'){var _0xa37d07=_[_0xf8ca('0x49')](_0x148f1d[_0xf8ca('0x29')],'id');return _0x148f1d[_0xf8ca('0x51')](_0xa37d07)['then'](function(){for(var _0x4648fb=0x0;_0x4648fb<_0xa37d07[_0xf8ca('0x1b')];_0x4648fb+=0x1){_0x303ecd[_0xf8ca('0x47')](_0xf8ca('0x52'),{'WhatsappInteractionId':Number(_0xa37d07[_0x4648fb]),'UserId':Number(_0x148f1d['id'])});}});}})[_0xf8ca('0x53')](function(_0x4640a4){_0x28f410[_0xf8ca('0x54')](_0x4640a4);});}}function onDisconnect(_0x38c1b1,_0x1f29e9){joinOrLeave(_0x38c1b1,_0xf8ca('0x45'),_0x1f29e9);}function onConnect(_0x5759ca){joinOrLeave(_0x5759ca,'join');}exports[_0xf8ca('0x55')]=function(_0x9eec49){_0x9eec49['on'](_0xf8ca('0x56'),function(_0x3992b6){_0x3992b6['setMaxListeners'](0x0);_0x3992b6[_0xf8ca('0x57')]=_0x3992b6[_0xf8ca('0x58')][_0xf8ca('0x56')][_0xf8ca('0x59')]+':'+_0x3992b6['request'][_0xf8ca('0x56')][_0xf8ca('0x5a')];_0x3992b6['connectedAt']=new Date();_0x3992b6[_0xf8ca('0x54')]=function(_0x3a12c2){console[_0xf8ca('0x54')](_0xf8ca('0x5b')+_0x3992b6[_0xf8ca('0x5c')][_0xf8ca('0x4')]+'['+_0x3992b6['address']+']',_0x3a12c2);};_0x3992b6['on'](_0xf8ca('0x5d'),function(){onDisconnect(_0x3992b6,_0x9eec49);_0x3992b6['log'](_0xf8ca('0x5e'));});onConnect(_0x3992b6);_0x3992b6[_0xf8ca('0x54')](_0xf8ca('0x5f'));});}; \ No newline at end of file +var _0xdadc=['user_has_chat_interactions:remove','map','MailInteractions','user_has_mail_interactions:remove','removeFaxInteractions','user_has_fax_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','log','join','default','connection','address','request','remotePort','connectedAt','nsp','disconnect','DISCONNECTED','CONNECTED','lodash','../mysqldb','./environment','name','Agents','User','role','telephone','type','ivr','UserProfileSection','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','MailQueues','OpenchannelQueues','WhatsappQueues','findAll','Trunks','IvrCampaigns','UserProfileResource','resourceId','then','where','format','%s:queue:%s','length','user:%s','handshake','query','find','userProfileId','ChatInteractions','MailInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','admin','voice:inbound','hasOwnProperty','include','VoiceQueue','push','FaxQueue','SmsQueue','OpenchannelQueue','Trunk','user','WhatsappQueue','Telephones','agent','voice:outbound','getVoiceQueues','getChatQueues','getSmsQueues','getMailQueues','getWhatsappQueues','voice','fax','mail','telephone:%s','trunk:%s','campaign:%s:%s','leave','removeChatInteractions','emit'];(function(_0x1c80e8,_0x10847d){var _0x49b989=function(_0x3028af){while(--_0x3028af){_0x1c80e8['push'](_0x1c80e8['shift']());}};_0x49b989(++_0x10847d);}(_0xdadc,0x75));var _0xcdad=function(_0x2f4633,_0x1a8e86){_0x2f4633=_0x2f4633-0x0;var _0x2b56c0=_0xdadc[_0x2f4633];return _0x2b56c0;};'use strict';var _=require(_0xcdad('0x0'));var util=require('util');var BPromise=require('bluebird');var db=require(_0xcdad('0x1'))['db'];var config=require(_0xcdad('0x2'));var queryQueues={'attributes':['id',_0xcdad('0x3')],'include':[{'as':_0xcdad('0x4'),'model':db[_0xcdad('0x5')],'attributes':['id',_0xcdad('0x3'),_0xcdad('0x6')],'raw':!![],'where':{'role':'agent'},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0xcdad('0x3')],'where':{'role':_0xcdad('0x7')}};var queryTrunks={'raw':!![],'attributes':['id',_0xcdad('0x3')]};var queryAgents={'raw':!![],'attributes':['id','name'],'where':{'role':'agent'}};var queryCampaigns={'raw':!![],'attributes':['id',_0xcdad('0x3'),_0xcdad('0x8')],'where':{'type':_0xcdad('0x9')}};function getAssociatedResources(_0x558169,_0x2c502b,_0x194878){return db[_0xcdad('0xa')]['findOne']({'where':{'name':_0x558169,'userProfileId':_0x2c502b},'raw':!![]})['then'](function(_0x49f4ca){if(_0x49f4ca){if(_0x49f4ca[_0xcdad('0xb')]){switch(_0x558169){case _0xcdad('0xc'):case _0xcdad('0xd'):case _0xcdad('0xe'):case _0xcdad('0xf'):case _0xcdad('0x10'):case _0xcdad('0x11'):case _0xcdad('0x12'):return db[_0x194878]['findAll'](queryQueues);case'Telephones':return db[_0x194878][_0xcdad('0x13')](queryTelephones);case _0xcdad('0x14'):return db[_0x194878]['findAll'](queryTrunks);case _0xcdad('0x15'):return db[_0x194878][_0xcdad('0x13')](queryCampaigns);}}else{return db[_0xcdad('0x16')][_0xcdad('0x13')]({'attributes':[_0xcdad('0x17')],'where':{'sectionId':_0x49f4ca['id']},'raw':!![]})[_0xcdad('0x18')](function(_0x1b7cab){if(_0x1b7cab){var _0x53eb63={'where':{'id':_['map'](_0x1b7cab,'resourceId')},'raw':!![]};switch(_0x194878){case _0xcdad('0x5'):_0x53eb63[_0xcdad('0x19')]['role']=_0xcdad('0x7');break;case'Campaign':_0x53eb63[_0xcdad('0x19')][_0xcdad('0x8')]=_0xcdad('0x9');break;}return db[_0x194878][_0xcdad('0x13')](_0x53eb63);}else{return[];}});}}else{return[];}})['then'](function(_0x15be0e){return _0x15be0e;});}function joinOrLeaveQueues(_0x229730,_0x367829,_0x290661,_0x26c7af){_0x229730[_0x367829](util[_0xcdad('0x1a')](_0xcdad('0x1b'),_0x290661,_0x26c7af[_0xcdad('0x3')]));if(_0x26c7af[_0xcdad('0x4')]){for(var _0x916ed=0x0;_0x916ed<_0x26c7af['Agents'][_0xcdad('0x1c')];_0x916ed+=0x1){_0x229730[_0x367829](util[_0xcdad('0x1a')](_0xcdad('0x1d'),_0x26c7af[_0xcdad('0x4')][_0x916ed][_0xcdad('0x3')]));}}}function joinOrLeave(_0x265166,_0x5ace1f,_0x26005e){var _0x566e94;if(_0x265166[_0xcdad('0x1e')][_0xcdad('0x1f')]['id']){db['User'][_0xcdad('0x20')]({'attributes':['id',_0xcdad('0x3'),_0xcdad('0x6'),_0xcdad('0x21')],'where':{'id':_0x265166[_0xcdad('0x1e')]['query']['id']},'include':[{'model':db['ChatInteraction'],'as':_0xcdad('0x22'),'attributes':['id'],'raw':!![]},{'model':db[_0xcdad('0x23')],'as':'MailInteractions','attributes':['id'],'raw':!![]},{'model':db['FaxInteraction'],'as':_0xcdad('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0xcdad('0x25')],'as':_0xcdad('0x26'),'attributes':['id'],'raw':!![]},{'model':db['OpenchannelInteraction'],'as':_0xcdad('0x27'),'attributes':['id'],'raw':!![]},{'model':db[_0xcdad('0x28')],'as':_0xcdad('0x29'),'attributes':['id'],'raw':!![]}]})[_0xcdad('0x18')](function(_0x285e42){if(_0x285e42){_0x566e94=_0x285e42;_0x265166[_0x5ace1f](util[_0xcdad('0x1a')](_0xcdad('0x1d'),_0x285e42[_0xcdad('0x3')]));var _0x15340a=[];switch(_0x285e42[_0xcdad('0x6')]){case _0xcdad('0x2a'):_0x265166[_0x5ace1f](_0xcdad('0x2b'));_0x265166[_0x5ace1f]('voice:outbound');if(queryQueues[_0xcdad('0x2c')](_0xcdad('0x2d'))){delete queryQueues['include'];}_0x15340a['push'](db[_0xcdad('0x2e')][_0xcdad('0x13')](queryQueues));_0x15340a[_0xcdad('0x2f')](db['ChatQueue'][_0xcdad('0x13')](queryQueues));_0x15340a[_0xcdad('0x2f')](db[_0xcdad('0x30')][_0xcdad('0x13')](queryQueues));_0x15340a['push'](db[_0xcdad('0x31')][_0xcdad('0x13')](queryQueues));_0x15340a['push'](db['MailQueue'][_0xcdad('0x13')](queryQueues));_0x15340a[_0xcdad('0x2f')](db[_0xcdad('0x32')][_0xcdad('0x13')](queryQueues));_0x15340a['push'](db['WhatsappQueue']['findAll'](queryQueues));_0x15340a[_0xcdad('0x2f')](db[_0xcdad('0x5')][_0xcdad('0x13')](queryTelephones));_0x15340a[_0xcdad('0x2f')](db[_0xcdad('0x33')][_0xcdad('0x13')](queryTrunks));_0x15340a[_0xcdad('0x2f')](db['Campaign'][_0xcdad('0x13')](queryCampaigns));_0x15340a[_0xcdad('0x2f')](db[_0xcdad('0x5')]['findAll'](queryAgents));break;case _0xcdad('0x34'):_0x265166[_0x5ace1f]('voice:inbound');_0x265166[_0x5ace1f]('voice:outbound');_0x15340a[_0xcdad('0x2f')](getAssociatedResources(_0xcdad('0xc'),_0x285e42[_0xcdad('0x21')],'VoiceQueue'));_0x15340a[_0xcdad('0x2f')](getAssociatedResources(_0xcdad('0xd'),_0x285e42['userProfileId'],'ChatQueue'));_0x15340a['push'](getAssociatedResources(_0xcdad('0xe'),_0x285e42[_0xcdad('0x21')],_0xcdad('0x30')));_0x15340a[_0xcdad('0x2f')](getAssociatedResources(_0xcdad('0xf'),_0x285e42['userProfileId'],_0xcdad('0x31')));_0x15340a['push'](getAssociatedResources(_0xcdad('0x10'),_0x285e42[_0xcdad('0x21')],'MailQueue'));_0x15340a[_0xcdad('0x2f')](getAssociatedResources(_0xcdad('0x11'),_0x285e42[_0xcdad('0x21')],_0xcdad('0x32')));_0x15340a[_0xcdad('0x2f')](getAssociatedResources(_0xcdad('0x12'),_0x285e42[_0xcdad('0x21')],_0xcdad('0x35')));_0x15340a[_0xcdad('0x2f')](getAssociatedResources(_0xcdad('0x36'),_0x285e42[_0xcdad('0x21')],'User'));_0x15340a[_0xcdad('0x2f')](getAssociatedResources(_0xcdad('0x14'),_0x285e42[_0xcdad('0x21')],_0xcdad('0x33')));_0x15340a[_0xcdad('0x2f')](getAssociatedResources(_0xcdad('0x15'),_0x285e42['userProfileId'],'Campaign'));_0x15340a[_0xcdad('0x2f')](db[_0xcdad('0x5')]['findAll'](queryAgents));break;case _0xcdad('0x37'):_0x265166[_0x5ace1f](_0xcdad('0x2b'));_0x265166[_0x5ace1f](_0xcdad('0x38'));_0x15340a[_0xcdad('0x2f')](_0x285e42[_0xcdad('0x39')]({'attributes':['id',_0xcdad('0x3')]}));_0x15340a[_0xcdad('0x2f')](_0x285e42[_0xcdad('0x3a')]({'attributes':['id','name']}));_0x15340a[_0xcdad('0x2f')](_0x285e42['getFaxQueues']({'attributes':['id',_0xcdad('0x3')]}));_0x15340a[_0xcdad('0x2f')](_0x285e42[_0xcdad('0x3b')]({'attributes':['id','name']}));_0x15340a['push'](_0x285e42[_0xcdad('0x3c')]({'attributes':['id',_0xcdad('0x3')]}));_0x15340a[_0xcdad('0x2f')](_0x285e42['getOpenchannelQueues']({'attributes':['id',_0xcdad('0x3')]}));_0x15340a[_0xcdad('0x2f')](_0x285e42[_0xcdad('0x3d')]({'attributes':['id',_0xcdad('0x3')]}));break;}return BPromise['all'](_0x15340a);}})[_0xcdad('0x18')](function(_0x2a67cb){if(_0x2a67cb&&_0x2a67cb[_0xcdad('0x1c')]){for(var _0x19ea59=0x0;_0x19ea59<_0x2a67cb['length'];_0x19ea59+=0x1){for(var _0x2d4bd0=0x0;_0x2d4bd0<_0x2a67cb[_0x19ea59][_0xcdad('0x1c')];_0x2d4bd0+=0x1){switch(_0x19ea59){case 0x0:joinOrLeaveQueues(_0x265166,_0x5ace1f,_0xcdad('0x3e'),_0x2a67cb[_0x19ea59][_0x2d4bd0]);break;case 0x1:joinOrLeaveQueues(_0x265166,_0x5ace1f,'chat',_0x2a67cb[_0x19ea59][_0x2d4bd0]);break;case 0x2:joinOrLeaveQueues(_0x265166,_0x5ace1f,_0xcdad('0x3f'),_0x2a67cb[_0x19ea59][_0x2d4bd0]);break;case 0x3:joinOrLeaveQueues(_0x265166,_0x5ace1f,'sms',_0x2a67cb[_0x19ea59][_0x2d4bd0]);break;case 0x4:joinOrLeaveQueues(_0x265166,_0x5ace1f,_0xcdad('0x40'),_0x2a67cb[_0x19ea59][_0x2d4bd0]);break;case 0x5:joinOrLeaveQueues(_0x265166,_0x5ace1f,'openchannel',_0x2a67cb[_0x19ea59][_0x2d4bd0]);break;case 0x6:joinOrLeaveQueues(_0x265166,_0x5ace1f,'whatsapp',_0x2a67cb[_0x19ea59][_0x2d4bd0]);break;case 0x7:if(_0x566e94[_0xcdad('0x6')]!=='agent')_0x265166[_0x5ace1f](util['format'](_0xcdad('0x41'),_0x2a67cb[_0x19ea59][_0x2d4bd0][_0xcdad('0x3')]));break;case 0x8:if(_0x566e94[_0xcdad('0x6')]!==_0xcdad('0x37'))_0x265166[_0x5ace1f](util[_0xcdad('0x1a')](_0xcdad('0x42'),_0x2a67cb[_0x19ea59][_0x2d4bd0][_0xcdad('0x3')]));break;case 0x9:if(_0x566e94[_0xcdad('0x6')]!==_0xcdad('0x37'))_0x265166[_0x5ace1f](util[_0xcdad('0x1a')](_0xcdad('0x43'),_0x2a67cb[_0x19ea59][_0x2d4bd0]['type'],_0x2a67cb[_0x19ea59][_0x2d4bd0][_0xcdad('0x3')]));break;case 0xa:_0x265166[_0x5ace1f](util[_0xcdad('0x1a')](_0xcdad('0x1d'),_0x2a67cb[_0x19ea59][_0x2d4bd0]['name']));break;}}}}})[_0xcdad('0x18')](function(){if(_0x5ace1f===_0xcdad('0x44')){var _0x557357=_['map'](_0x566e94[_0xcdad('0x22')],'id');return _0x566e94[_0xcdad('0x45')](_0x557357)[_0xcdad('0x18')](function(){for(var _0x2abd2d=0x0;_0x2abd2d<_0x557357[_0xcdad('0x1c')];_0x2abd2d+=0x1){_0x26005e[_0xcdad('0x46')](_0xcdad('0x47'),{'ChatInteractionId':Number(_0x557357[_0x2abd2d]),'UserId':Number(_0x566e94['id'])});}});}})[_0xcdad('0x18')](function(){if(_0x5ace1f===_0xcdad('0x44')){var _0x5d6603=_[_0xcdad('0x48')](_0x566e94[_0xcdad('0x49')],'id');return _0x566e94['removeMailInteractions'](_0x5d6603)['then'](function(){for(var _0x56f7aa=0x0;_0x56f7aa<_0x5d6603[_0xcdad('0x1c')];_0x56f7aa+=0x1){_0x26005e['emit'](_0xcdad('0x4a'),{'MailInteractionId':Number(_0x5d6603[_0x56f7aa]),'UserId':Number(_0x566e94['id'])});}});}})[_0xcdad('0x18')](function(){if(_0x5ace1f==='leave'){var _0x5e9927=_[_0xcdad('0x48')](_0x566e94[_0xcdad('0x24')],'id');return _0x566e94[_0xcdad('0x4b')](_0x5e9927)[_0xcdad('0x18')](function(){for(var _0x2ed450=0x0;_0x2ed450<_0x5e9927['length'];_0x2ed450+=0x1){_0x26005e[_0xcdad('0x46')](_0xcdad('0x4c'),{'FaxInteractionId':Number(_0x5e9927[_0x2ed450]),'UserId':Number(_0x566e94['id'])});}});}})[_0xcdad('0x18')](function(){if(_0x5ace1f===_0xcdad('0x44')){var _0x390380=_[_0xcdad('0x48')](_0x566e94[_0xcdad('0x26')],'id');return _0x566e94['removeSmsInteractions'](_0x390380)[_0xcdad('0x18')](function(){for(var _0x9a95cc=0x0;_0x9a95cc<_0x390380[_0xcdad('0x1c')];_0x9a95cc+=0x1){_0x26005e[_0xcdad('0x46')]('user_has_sms_interactions:remove',{'SmsInteractionId':Number(_0x390380[_0x9a95cc]),'UserId':Number(_0x566e94['id'])});}});}})[_0xcdad('0x18')](function(){if(_0x5ace1f===_0xcdad('0x44')){var _0x2903ca=_[_0xcdad('0x48')](_0x566e94['OpenchannelInteractions'],'id');return _0x566e94[_0xcdad('0x4d')](_0x2903ca)[_0xcdad('0x18')](function(){for(var _0x305e7e=0x0;_0x305e7e<_0x2903ca[_0xcdad('0x1c')];_0x305e7e+=0x1){_0x26005e['emit'](_0xcdad('0x4e'),{'OpenchannelInteractionId':Number(_0x2903ca[_0x305e7e]),'UserId':Number(_0x566e94['id'])});}});}})[_0xcdad('0x18')](function(){if(_0x5ace1f==='leave'){var _0x3cc571=_['map'](_0x566e94[_0xcdad('0x29')],'id');return _0x566e94[_0xcdad('0x4f')](_0x3cc571)['then'](function(){for(var _0x1aa3e1=0x0;_0x1aa3e1<_0x3cc571[_0xcdad('0x1c')];_0x1aa3e1+=0x1){_0x26005e[_0xcdad('0x46')](_0xcdad('0x50'),{'WhatsappInteractionId':Number(_0x3cc571[_0x1aa3e1]),'UserId':Number(_0x566e94['id'])});}});}})[_0xcdad('0x51')](function(_0xa2e007){_0x265166[_0xcdad('0x52')](_0xa2e007);});}}function onDisconnect(_0x361ec9,_0x285959){joinOrLeave(_0x361ec9,_0xcdad('0x44'),_0x285959);}function onConnect(_0x2fb0c7){joinOrLeave(_0x2fb0c7,_0xcdad('0x53'));}exports[_0xcdad('0x54')]=function(_0x7a2c57){_0x7a2c57['on'](_0xcdad('0x55'),function(_0x588406){_0x588406['setMaxListeners'](0x0);_0x588406[_0xcdad('0x56')]=_0x588406[_0xcdad('0x57')][_0xcdad('0x55')]['remoteAddress']+':'+_0x588406[_0xcdad('0x57')][_0xcdad('0x55')][_0xcdad('0x58')];_0x588406[_0xcdad('0x59')]=new Date();_0x588406[_0xcdad('0x52')]=function(_0x13bcca){console[_0xcdad('0x52')]('SocketIO\x20'+_0x588406[_0xcdad('0x5a')][_0xcdad('0x3')]+'['+_0x588406[_0xcdad('0x56')]+']',_0x13bcca);};_0x588406['on'](_0xcdad('0x5b'),function(){onDisconnect(_0x588406,_0x7a2c57);_0x588406['log'](_0xcdad('0x5c'));});onConnect(_0x588406);_0x588406[_0xcdad('0x52')](_0xcdad('0x5d'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index b292d02..31e3437 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 _0xa99e=['Trigger,\x20%s','error','code','catch','channel','motionChannel','event','direction','resolve','ContactId','undefined','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','SELECT','contact','UserId','interface','format','SIP/%s','name','agent','incomingmessage','get','opened','changed','closed','substatus','query','AfterUpdate','User','find','fullname','internal','default','length','hasOwnProperty','model','hook','toLowerCase','util','../../mysqldb','jayson/promise','../logger','triggers','client','http','Chat','ChatInteraction','afterCreate','newinteraction','closedinteraction','ChatMessage','newmessage','ChatOfflineMessage','Sms','SmsInteraction','afterUpdate','SmsMessage','WhatsappInteraction','WhatsappMessage','Fax','FaxInteraction','FaxMessage','Mail','MailInteraction','MailMessage','Openchannel','OpenchannelInteraction','OpenchannelMessage','request','EventManager','then','info'];(function(_0x4203fb,_0x30ff4a){var _0x5a8f96=function(_0x170816){while(--_0x170816){_0x4203fb['push'](_0x4203fb['shift']());}};_0x5a8f96(++_0x30ff4a);}(_0xa99e,0x155));var _0xea99=function(_0x164bb6,_0x2d70b7){_0x164bb6=_0x164bb6-0x0;var _0x5c338a=_0xa99e[_0x164bb6];return _0x5c338a;};'use strict';var util=require(_0xea99('0x0'));var db=require(_0xea99('0x1'))['db'];var jayson=require(_0xea99('0x2'));var logger=require(_0xea99('0x3'))(_0xea99('0x4'));var client=jayson[_0xea99('0x5')][_0xea99('0x6')]({'port':0x232a});var triggers=[{'channel':_0xea99('0x7'),'model':_0xea99('0x8'),'event':_0xea99('0x9'),'condition':_0xea99('0xa'),'callback':afterCreate},{'channel':_0xea99('0x7'),'model':_0xea99('0x8'),'event':'afterUpdate','condition':_0xea99('0xb'),'callback':afterUpdate},{'channel':_0xea99('0x7'),'model':_0xea99('0xc'),'event':_0xea99('0x9'),'condition':_0xea99('0xd'),'callback':afterCreateMessage},{'channel':_0xea99('0x7'),'model':_0xea99('0xe'),'event':_0xea99('0x9'),'condition':_0xea99('0xd'),'callback':afterCreateOfflineMessage},{'channel':_0xea99('0xf'),'model':_0xea99('0x10'),'event':_0xea99('0x9'),'condition':_0xea99('0xa'),'callback':afterCreate},{'channel':'Sms','model':_0xea99('0x10'),'event':_0xea99('0x11'),'condition':_0xea99('0xb'),'callback':afterUpdate},{'channel':_0xea99('0xf'),'model':_0xea99('0x12'),'event':_0xea99('0x9'),'condition':_0xea99('0xd'),'callback':afterCreateMessage},{'channel':'Whatsapp','model':_0xea99('0x13'),'event':_0xea99('0x9'),'condition':_0xea99('0xa'),'callback':afterCreate},{'channel':'Whatsapp','model':_0xea99('0x13'),'event':_0xea99('0x11'),'condition':_0xea99('0xb'),'callback':afterUpdate},{'channel':'Whatsapp','model':_0xea99('0x14'),'event':_0xea99('0x9'),'condition':_0xea99('0xd'),'callback':afterCreateMessage},{'channel':_0xea99('0x15'),'model':_0xea99('0x16'),'event':_0xea99('0x9'),'condition':_0xea99('0xa'),'callback':afterCreate},{'channel':_0xea99('0x15'),'model':_0xea99('0x16'),'event':'afterUpdate','condition':_0xea99('0xb'),'callback':afterUpdate},{'channel':_0xea99('0x15'),'model':_0xea99('0x17'),'event':_0xea99('0x9'),'condition':_0xea99('0xd'),'callback':afterCreateMessage},{'channel':_0xea99('0x18'),'model':_0xea99('0x19'),'event':_0xea99('0x9'),'condition':_0xea99('0xa'),'callback':afterCreate},{'channel':'Mail','model':_0xea99('0x19'),'event':_0xea99('0x11'),'condition':_0xea99('0xb'),'callback':afterUpdate},{'channel':_0xea99('0x18'),'model':_0xea99('0x1a'),'event':_0xea99('0x9'),'condition':_0xea99('0xd'),'callback':afterCreateMessage},{'channel':_0xea99('0x1b'),'model':'OpenchannelInteraction','event':_0xea99('0x9'),'condition':'newinteraction','callback':afterCreate},{'channel':_0xea99('0x1b'),'model':_0xea99('0x1c'),'event':_0xea99('0x11'),'condition':'closedinteraction','callback':afterUpdate},{'channel':_0xea99('0x1b'),'model':_0xea99('0x1d'),'event':_0xea99('0x9'),'condition':_0xea99('0xd'),'callback':afterCreateMessage}];function request(_0x1a96db){return client[_0xea99('0x1e')](_0xea99('0x1f'),_0x1a96db)[_0xea99('0x20')](function(_0x4205b6){logger[_0xea99('0x21')](_0xea99('0x22'),_0xea99('0x1f'),_0x4205b6);if(_0x4205b6['error']){if(_0x4205b6[_0xea99('0x23')][_0xea99('0x24')]===0x1f4){logger['error'](_0xea99('0x22'),_0xea99('0x1f'),_0x4205b6['error']);}}})[_0xea99('0x25')](function(_0x4b15f1){logger[_0xea99('0x23')](_0xea99('0x22'),_0xea99('0x1f'),_0x4b15f1);});}function afterCreateMessage(_0x41f01b){return function(_0x35594b){_0x35594b=_0x35594b['get']({'plain':!![]});_0x35594b[_0xea99('0x26')]=_0x41f01b;_0x35594b[_0xea99('0x27')]=_0x41f01b;_0x35594b[_0xea99('0x28')]=_0x35594b[_0xea99('0x29')];Promise[_0xea99('0x2a')]()['then'](function(){if(typeof _0x35594b[_0xea99('0x2b')]===_0xea99('0x2c'))return null;var _0x12edd2=_0xea99('0x2d')+_0x35594b[_0xea99('0x2b')];return db[_0xea99('0x2e')]['query'](_0x12edd2,{'type':db[_0xea99('0x2f')][_0xea99('0x30')][_0xea99('0x31')],'raw':!![]});})[_0xea99('0x20')](function(_0x570d9f){if(_0x570d9f){_0x35594b[_0xea99('0x32')]=_0x570d9f[0x0];}if(typeof _0x35594b['UserId']===_0xea99('0x2c'))return;return getAgent(_0x35594b[_0xea99('0x33')]);})[_0xea99('0x20')](function(_0x1d0cf4){if(_0x1d0cf4){_0x35594b[_0xea99('0x34')]=util[_0xea99('0x35')](_0xea99('0x36'),_0x1d0cf4[_0xea99('0x37')]);_0x35594b[_0xea99('0x38')]=_0x1d0cf4;_0x35594b[_0xea99('0x26')]=_0x41f01b;return request({'event':_0xea99('0x39'),'message':_0x35594b});}else{return request({'event':'outgoingmessage','message':_0x35594b});}})[_0xea99('0x25')](function(_0x11acc0){logger[_0xea99('0x23')](_0xea99('0x22'),'AfterCreateMessage',_0x11acc0);});};}function afterCreateOfflineMessage(_0x554774){return function(_0x12a67b){_0x12a67b=_0x12a67b[_0xea99('0x3a')]({'plain':!![]});_0x12a67b['channel']=_0x554774;_0x12a67b[_0xea99('0x27')]=_0x554774;_0x12a67b['event']='offlineMessage';return request({'event':_0x12a67b[_0xea99('0x28')],'message':_0x12a67b});};}function afterCreate(_0x50408c,_0x46432f){return function(_0x299faf){_0x299faf=_0x299faf[_0xea99('0x3a')]({'plain':!![]});_0x299faf[_0xea99('0x26')]=_0x50408c;_0x299faf[_0xea99('0x27')]=_0x50408c;_0x299faf['event']=_0xea99('0x3b');Promise['resolve']()[_0xea99('0x20')](function(){var _0x48c98c=_0xea99('0x2d')+_0x299faf['ContactId'];return db[_0xea99('0x2e')]['query'](_0x48c98c,{'type':db[_0xea99('0x2f')][_0xea99('0x30')]['SELECT'],'raw':!![]});})[_0xea99('0x20')](function(_0x53fcc8){if(_0x53fcc8){_0x299faf[_0xea99('0x32')]=_0x53fcc8[0x0];}if(typeof _0x299faf[_0xea99('0x33')]==='undefined')return;return getAgent(_0x299faf['UserId']);})[_0xea99('0x20')](function(_0x1c3939){if(_0x1c3939){_0x299faf[_0xea99('0x34')]=util[_0xea99('0x35')](_0xea99('0x36'),_0x1c3939[_0xea99('0x37')]);_0x299faf[_0xea99('0x38')]=_0x1c3939;}return request({'event':_0x46432f,'message':_0x299faf});})[_0xea99('0x25')](function(_0x5706ce){logger[_0xea99('0x23')]('Trigger,\x20%s','AfterCreate',_0x5706ce);});};}function afterUpdate(_0x45d256){return function(_0x31975b){var _0x2c6775=_0x31975b[_0xea99('0x3c')](_0xea99('0x3d'))&&_0x31975b[_0xea99('0x3d')];var _0x40a32c=_0x31975b['changed'](_0xea99('0x3e'));if(_0x2c6775||_0x40a32c){var _0x10616e=_0x2c6775?_0xea99('0xb'):_0xea99('0x3e');var _0x354918=_0x31975b['get']({'plain':!![]});_0x354918[_0xea99('0x26')]=_0x45d256;_0x354918[_0xea99('0x27')]=_0x45d256;_0x354918['event']=_0x2c6775?'closed':_0xea99('0x3e');var _0x32a66f='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x354918[_0xea99('0x2b')];return db[_0xea99('0x2e')][_0xea99('0x3f')](_0x32a66f,{'type':db[_0xea99('0x2f')][_0xea99('0x30')][_0xea99('0x31')],'raw':!![]})['then'](function(_0x2cbf9e){if(_0x2cbf9e){_0x354918[_0xea99('0x32')]=_0x2cbf9e[0x0];}if(typeof _0x354918['UserId']==='undefined')return;return getAgent(_0x354918['UserId']);})[_0xea99('0x20')](function(_0x3efc92){if(_0x3efc92){_0x354918[_0xea99('0x34')]=util[_0xea99('0x35')]('SIP/%s',_0x3efc92[_0xea99('0x37')]);_0x354918[_0xea99('0x38')]=_0x3efc92;}return request({'event':_0x10616e,'message':_0x354918});})[_0xea99('0x25')](function(_0x43a356){logger[_0xea99('0x23')](_0xea99('0x22'),_0xea99('0x40'),_0x43a356);});}};}function getAgent(_0x30450e){return db[_0xea99('0x41')][_0xea99('0x42')]({'where':{'id':_0x30450e},'attributes':['id',_0xea99('0x37'),_0xea99('0x43'),'email',_0xea99('0x44')],'raw':!![]})[_0xea99('0x20')](function(_0x274fd5){return _0x274fd5;});}exports[_0xea99('0x45')]=function(){for(var _0x34d076=0x0;_0x34d076=_0x27884c[_0x4a02('0x13')]){throw Error(_0x4a02('0x14'));}_0x4c7ff0(_0x576380);})[_0x4a02('0x15')](function(_0x2482ce){_0x4ab9f1(_0x2482ce);});});}; \ No newline at end of file +var _0xdda7=['mail','chat','fax','sms','whatsapp','openchannel','getChannels','includes','isUndefined','getLicense','agent','User','then','agents','Maximum\x20login\x20has\x20been\x20reached','catch','lodash','../mysqldb','./license/util','voice'];(function(_0x38d405,_0x285127){var _0xb357f7=function(_0x391b95){while(--_0x391b95){_0x38d405['push'](_0x38d405['shift']());}};_0xb357f7(++_0x285127);}(_0xdda7,0x1a0));var _0x7dda=function(_0xf07f30,_0x566b61){_0xf07f30=_0xf07f30-0x0;var _0x2c2d78=_0xdda7[_0xf07f30];return _0x2c2d78;};'use strict';var _=require(_0x7dda('0x0'));var BPromise=require('bluebird');var db=require(_0x7dda('0x1'))['db'];var util=require(_0x7dda('0x2'));var channels=[_0x7dda('0x3'),_0x7dda('0x4'),_0x7dda('0x5'),_0x7dda('0x6'),_0x7dda('0x7'),_0x7dda('0x8'),_0x7dda('0x9')];exports[_0x7dda('0xa')]=function(){return channels;};exports['isValidChannel']=function(_0x2d9cad){_0x2d9cad=_0x2d9cad['toLowerCase']();return _[_0x7dda('0xb')](channels,_0x2d9cad);};exports['clearBlockUser']=function(_0x4eb47d,_0x587f7f,_0x1f2e2a,_0x365331){var _0x32436f={'loginAttempts':_0x587f7f,'blocked':_0x1f2e2a};if(!_[_0x7dda('0xc')](_0x365331)){_0x32436f['blockedAt']=_0x365331;}return _0x4eb47d['updateAttributes'](_0x32436f);};exports[_0x7dda('0xd')]=function(_0x25efc5){return new BPromise(function(_0x649130,_0x4f60e8){var _0x219486=0x0;if(_0x25efc5['role']!==_0x7dda('0xe')){_0x649130(_0x25efc5);}db[_0x7dda('0xf')]['count']({'where':{'role':'agent','online':!![],'id':{'$ne':_0x25efc5['id']}}})[_0x7dda('0x10')](function(_0x47df0e){_0x219486=_0x47df0e;return util['getLicense']();})[_0x7dda('0x10')](function(_0x433811){if(_0x433811&&_0x433811[_0x7dda('0x11')]&&_0x219486>=_0x433811[_0x7dda('0x11')]){throw Error(_0x7dda('0x12'));}_0x649130(_0x25efc5);})[_0x7dda('0x13')](function(_0x240353){_0x4f60e8(_0x240353);});});}; \ No newline at end of file diff --git a/server/errors/api.js b/server/errors/api.js index 1512622..0a5c1bc 100644 --- a/server/errors/api.js +++ b/server/errors/api.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd9b4=['Message\x20sent\x20outside\x20a\x20valid\x20interval','Out\x20Of\x20Interval','code','details','OutOfInterval','Conflict','error','stack','status','exports','util','../config/logger','api','message','name','Error','inherits','Bad\x20Request','Forbidden','Entity\x20not\x20found','Not\x20Found'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0xd9b4,0x88));var _0x4d9b=function(_0x5dd721,_0x12d33c){_0x5dd721=_0x5dd721-0x0;var _0x592748=_0xd9b4[_0x5dd721];return _0x592748;};'use strict';var util=require(_0x4d9b('0x0'));var logger=require(_0x4d9b('0x1'))(_0x4d9b('0x2'));var APIError=function(_0x3b6509,_0x2fcbe7){this[_0x4d9b('0x3')]=_0x3b6509||'Internal\x20Server\x20Error';this[_0x4d9b('0x4')]=_0x2fcbe7||_0x4d9b('0x5');util[_0x4d9b('0x6')](APIError,Error);};var APIBadRequestError=function(_0x99405a){this[_0x4d9b('0x3')]=_0x99405a||'Bad\x20Request';this[_0x4d9b('0x4')]=_0x4d9b('0x7');util['inherits'](APIBadRequestError,APIError);};var APIForbiddenError=function(_0x175f12){this[_0x4d9b('0x3')]=_0x175f12||_0x4d9b('0x8');this[_0x4d9b('0x4')]=_0x4d9b('0x8');util['inherits'](APIForbiddenError,APIError);};var APINotFoundError=function(_0x1b92a5){this[_0x4d9b('0x3')]=_0x1b92a5||_0x4d9b('0x9');this[_0x4d9b('0x4')]=_0x4d9b('0xa');util[_0x4d9b('0x6')](APINotFoundError,APIError);};var APIOutOfIntervalError=function(_0x315144){this['message']=_0x315144||_0x4d9b('0xb');this[_0x4d9b('0x4')]=_0x4d9b('0xc');this[_0x4d9b('0xd')]=0x193;this[_0x4d9b('0xe')]={'type':_0x4d9b('0xf')};util[_0x4d9b('0x6')](APIOutOfIntervalError,APIError);};var APIConflictError=function(_0x193a65){this[_0x4d9b('0x3')]=_0x193a65||'Resource\x20Conflict';this[_0x4d9b('0x4')]=_0x4d9b('0x10');util[_0x4d9b('0x6')](APIBadRequestError,APIError);};function getStatusCode(_0xc9a5bd){switch(_0xc9a5bd){case _0x4d9b('0x7'):return 0x190;case _0x4d9b('0x8'),_0x4d9b('0xc'):return 0x193;case _0x4d9b('0xa'):return 0x194;case _0x4d9b('0x10'):return 0x199;default:return 0x1f4;}}function getCustomStatusMessage(_0x81eef3){if(_0x81eef3==='Out\x20Of\x20Interval')return _0x81eef3;return null;}function handleError(_0x12d2da){return function(_0xb91d22){logger[_0x4d9b('0x11')](_0xb91d22[_0x4d9b('0x12')]);var _0x344680=getStatusCode(_0xb91d22[_0x4d9b('0x4')]);var _0x33d89=getCustomStatusMessage(_0xb91d22[_0x4d9b('0x4')]);if(_0xb91d22[_0x4d9b('0x4')]){delete _0xb91d22[_0x4d9b('0x4')];}if(_0x33d89){_0x12d2da['statusMessage']=_0x33d89;}return _0x12d2da[_0x4d9b('0x13')](_0x344680)['send'](_0xb91d22);};}module[_0x4d9b('0x14')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APIForbiddenError':APIForbiddenError,'APINotFoundError':APINotFoundError,'APIOutOfIntervalError':APIOutOfIntervalError,'APIConflict':APIConflictError,'handleError':handleError}; \ No newline at end of file +var _0x74ea=['../config/logger','api','Internal\x20Server\x20Error','name','Error','inherits','Bad\x20Request','Forbidden','Entity\x20not\x20found','Not\x20Found','message','code','Resource\x20Conflict','Conflict','Out\x20Of\x20Interval','error','stack','exports','util'];(function(_0x31aedc,_0x4986a3){var _0x250c26=function(_0x4ff949){while(--_0x4ff949){_0x31aedc['push'](_0x31aedc['shift']());}};_0x250c26(++_0x4986a3);}(_0x74ea,0x109));var _0xa74e=function(_0x549ff8,_0x3b8d82){_0x549ff8=_0x549ff8-0x0;var _0x144219=_0x74ea[_0x549ff8];return _0x144219;};'use strict';var util=require(_0xa74e('0x0'));var logger=require(_0xa74e('0x1'))(_0xa74e('0x2'));var APIError=function(_0x4030a3,_0x501e2d){this['message']=_0x4030a3||_0xa74e('0x3');this[_0xa74e('0x4')]=_0x501e2d||_0xa74e('0x5');util[_0xa74e('0x6')](APIError,Error);};var APIBadRequestError=function(_0x5738fe){this['message']=_0x5738fe||_0xa74e('0x7');this[_0xa74e('0x4')]=_0xa74e('0x7');util[_0xa74e('0x6')](APIBadRequestError,APIError);};var APIForbiddenError=function(_0x463cc7){this['message']=_0x463cc7||_0xa74e('0x8');this[_0xa74e('0x4')]=_0xa74e('0x8');util[_0xa74e('0x6')](APIForbiddenError,APIError);};var APINotFoundError=function(_0x46116b){this['message']=_0x46116b||_0xa74e('0x9');this[_0xa74e('0x4')]=_0xa74e('0xa');util[_0xa74e('0x6')](APINotFoundError,APIError);};var APIOutOfIntervalError=function(_0x3dbde3){this[_0xa74e('0xb')]=_0x3dbde3||'Message\x20sent\x20outside\x20a\x20valid\x20interval';this[_0xa74e('0x4')]='Out\x20Of\x20Interval';this[_0xa74e('0xc')]=0x193;this['details']={'type':'OutOfInterval'};util['inherits'](APIOutOfIntervalError,APIError);};var APIConflictError=function(_0x2234c3){this[_0xa74e('0xb')]=_0x2234c3||_0xa74e('0xd');this['name']=_0xa74e('0xe');util[_0xa74e('0x6')](APIBadRequestError,APIError);};function getStatusCode(_0x4e5df7){switch(_0x4e5df7){case _0xa74e('0x7'):return 0x190;case'Forbidden',_0xa74e('0xf'):return 0x193;case _0xa74e('0xa'):return 0x194;case _0xa74e('0xe'):return 0x199;default:return 0x1f4;}}function getCustomStatusMessage(_0x1cc060){if(_0x1cc060==='Out\x20Of\x20Interval')return _0x1cc060;return null;}function handleError(_0x264563){return function(_0x5bd446){logger[_0xa74e('0x10')](_0x5bd446[_0xa74e('0x11')]);var _0x6d22c5=getStatusCode(_0x5bd446[_0xa74e('0x4')]);var _0x27d40a=getCustomStatusMessage(_0x5bd446[_0xa74e('0x4')]);if(_0x5bd446['name']){delete _0x5bd446[_0xa74e('0x4')];}if(_0x27d40a){_0x264563['statusMessage']=_0x27d40a;}return _0x264563['status'](_0x6d22c5)['send'](_0x5bd446);};}module[_0xa74e('0x12')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APIForbiddenError':APIForbiddenError,'APINotFoundError':APINotFoundError,'APIOutOfIntervalError':APIOutOfIntervalError,'APIConflict':APIConflictError,'handleError':handleError}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index e2bdca5..2ed884b 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x82ee=['404','status','render','json','send'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x82ee,0xeb));var _0xe82e=function(_0x517996,_0xb4336d){_0x517996=_0x517996-0x0;var _0x47eac5=_0x82ee[_0x517996];return _0x47eac5;};'use strict';module['exports'][0x194]=function pageNotFound(_0x39c062,_0x455578){var _0x4ef2f5=_0xe82e('0x0');var _0xa424e8=0x194;var _0x1dcd9c={'status':_0xa424e8};_0x455578[_0xe82e('0x1')](_0x1dcd9c[_0xe82e('0x1')]);_0x455578[_0xe82e('0x2')](_0x4ef2f5,{},function(_0x6ba557,_0x10d486){if(_0x6ba557){return _0x455578[_0xe82e('0x1')](_0x1dcd9c['status'])[_0xe82e('0x3')](_0x1dcd9c);}_0x455578[_0xe82e('0x4')](_0x10d486);});}; \ No newline at end of file +var _0x896a=['status','exports'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x896a,0x117));var _0xa896=function(_0x11715a,_0x526b76){_0x11715a=_0x11715a-0x0;var _0x7012fa=_0x896a[_0x11715a];return _0x7012fa;};'use strict';module[_0xa896('0x0')][0x194]=function pageNotFound(_0x5df9b3,_0x1d5295){var _0x748a47='404';var _0x432152=0x194;var _0x537467={'status':_0x432152};_0x1d5295[_0xa896('0x1')](_0x537467[_0xa896('0x1')]);_0x1d5295['render'](_0x748a47,{},function(_0xff3d49,_0x4b2f04){if(_0xff3d49){return _0x1d5295[_0xa896('0x1')](_0x537467[_0xa896('0x1')])['json'](_0x537467);}_0x1d5295['send'](_0x4b2f04);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index 1ae2e77..0a98b95 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x281d=['../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','../api/cmCustomField/cmCustomField.model','Action','../api/action/action.model','Automation','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','Condition','../api/condition/condition.model','Interval','../api/interval/interval.model','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','ContactItemType','../api/contactItemType/contactItemType.model','CmContactHasItem','../api/cmContactHasItem/cmContactHasItem.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','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','DeskAccount','../api/intDeskAccount/intDeskAccount.model','../api/intDeskConfiguration/intDeskConfiguration.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','ZendeskConfiguration','ZendeskField','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','Dynamics365Field','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','Network','../api/network/network.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','JscriptySessionReport','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','../api/squareReport/squareReport.model','SquareDetailsReport','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','License','../api/license/license.model','Campaign','../api/campaign/campaign.model','Migration','../api/migration/migration.model','Attachment','Plugin','../api/plugin/plugin.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','../api/chatTransferReport/chatTransferReport.model','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','UserNotification','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/user-setting/user-setting.model','MailInteractionHasTag','../api/mailInteractionHasTag/mailInteractionHasTag.model','UserId','hasOne','UserSetting','cascade','hasMany','Recordings','VoiceQueuesRt','VoiceExtension','Extensions','HopperFinals','HopperHistory','ChatInteraction','FaxInteraction','FaxInteractions','MailInteractions','UserNotifications','SenderId','SET\x20NULL','Groups','chat_group_has_users','belongsToMany','Contacts','Lists','cm_user_has_lists','user_has_teams','user_has_mail_interactions','user_has_chat_interactions','user_has_fax_interactions','user_has_sms_interactions','OpenchannelInteractions','WhatsappInteractions','user_has_whatsapp_interactions','VoiceQueues','UserVoiceQueue','VoicePrefixes','MailQueues','ChatQueues','SmsQueues','OpenchannelQueues','WhatsappQueue','WhatsappQueues','UserWhatsappQueue','ChatWebsites','user_has_chat_websites','FaxAccounts','user_has_fax_accounts','MailAccount','MailAccounts','OpenchannelAccount','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_whatsapp_accounts','ChanSpyId','Applications','Sounds','moh_has_sounds','Members','Hoppers','VoiceQueueId','HopperBlacks','JscriptySessions','belongsTo','TrunkBackup','TrunkBackupId','IntervalId','Pause','voice_queues_has_cm_lists','Agents','Teams','BlackLists','voice_queues_has_cm_blacklists','Messages','mailboxuser','QueueCalls','uniqueid','AgentReports','Contact','ContactId','MailAccountId','CloudProviderId','restrict','Imap','Smtp','Dispositions','Answers','Interactions','MailApplication','ListId','mandatoryDispositionPause','user_has_mail_accounts','Account','Owner','mail_interaction_has_tags','Tags','Users','MailInteractionId','Attachments','Interaction','ChatWebsiteId','ChatOfflineMessage','MailQueueReport','List','FaxAccountId','Exntensions','mandatoryDispositionPauseId','TagId','fax_interaction_has_tags','ThroughTags','FaxInteractionId','team_has_fax_queues','SmsAccountId','SmsApplication','sms_interaction_has_tags','SmsInteractionId','SmsQueueId','OpenchannelAccountId','OpenchannelMessage','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','user_has_openchannel_interactions','AttachmentId','ProactiveActions','Agent','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','ChatOfflineMessageId','team_has_chat_queues','ChatGroupId','CompanyId','Phones','HopperHistories','ChatInteractions','SmsInteractions','Company','cm_user_has_contacts','cm_contact_has_tags','CmHopperAdditionalPhone','CampaignId','All','OneAll','AutomationAllId','Any','OneAny','ParentId','Intervals','SmsApplications','Schedule','DefaultReportId','CustomReportId','Mohs','whatsapp_interaction_has_tags','ItemType','ItemTypeId','CmHopperId','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','Actions','TriggerId','Fields','MetricId','SalesforceAccount','Configurations','AccountId','SubjectId','Subject','Description','DescriptionId','Field','VariableId','Subjects','Descriptions','FieldId','DeskConfiguration','DeskField','int_desk_configuration_has_tags','ZohoConfiguration','ZendeskAccount','int_zendesk_configuration_has_tags','FreshdeskField','FreshdeskAccount','int_freshdesk_configuration_has_tags','ServicenowConfiguration','FreshsalesConfiguration','ChatQueueReport','FromId','ToId','SessionId','ProjectId','team_has_mail_queues','FaxQueues','team_has_sms_queues','team_has_openchannel_queues','team_has_whatsapp_queues','VoicePrefix','SquareProject','SquareProjectId','FromMailAccountId','FromAccount','FromUserId','FromAgent','ToAgent','ToQueue','ToMailAccountId','ChatTransferReport','ToUserId','ToChatQueueId','ToChatWebsiteId','ToAccount','FaxTransferReport','FromFaxAccountId','ToFaxAccountId','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','FromSmsAccountId','CustomFields','Queues','userProfileId','Resources','sectionId','WhatsappMessage','WhatsappAccountId','WhatsappInteractionId','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','user','exports','../config/environment','sequelize','jstz','determine','defaultsDeep','xC@LL1234','127.0.0.1','mysql','utf8mb4','utf8','sequelizeHistory','motion2','xcall','utf8_general_ci','database','password','username','options','User','import','../api/user/user.model','VoiceChanSpy','VoiceContext','../api/voiceContext/voiceContext.model','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserChatQueue','UserMailQueue','../api/userMailQueue/userMailQueue.model','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','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','MailMessage','../api/mailMessage/mailMessage.model','../api/mailApplication/mailApplication.model','../api/mailQueueReport/mailQueueReport.model','Dashboard','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','OpenchannelQueue','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack'];(function(_0x4050e4,_0x22cea8){var _0x3ffeac=function(_0x1d7e36){while(--_0x1d7e36){_0x4050e4['push'](_0x4050e4['shift']());}};_0x3ffeac(++_0x22cea8);}(_0x281d,0x195));var _0xd281=function(_0xfff6f6,_0x54e118){_0xfff6f6=_0xfff6f6-0x0;var _0x28766e=_0x281d[_0xfff6f6];return _0x28766e;};'use strict';var config=require(_0xd281('0x0'));var Sequelize=require(_0xd281('0x1'));var _=require('lodash');var jstz=require(_0xd281('0x2'));var timezone=jstz[_0xd281('0x3')]();config[_0xd281('0x1')]=_[_0xd281('0x4')](config[_0xd281('0x1')],{'database':'motion2','username':'xcall','password':_0xd281('0x5'),'options':{'host':_0xd281('0x6'),'port':0xcea,'dialect':_0xd281('0x7'),'dialectOptions':{'charset':_0xd281('0x8')},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0xd281('0x9'),'collate':'utf8_general_ci'}}});config[_0xd281('0xa')]=_[_0xd281('0x4')](config[_0xd281('0xa')],{'database':_0xd281('0xb'),'username':_0xd281('0xc'),'password':_0xd281('0x5'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':_0xd281('0x7'),'dialectOptions':{'charset':_0xd281('0x8')},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0xd281('0x9'),'collate':_0xd281('0xd')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xd281('0x1')][_0xd281('0xe')],config[_0xd281('0x1')]['username'],config[_0xd281('0x1')][_0xd281('0xf')],config[_0xd281('0x1')]['options'])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xd281('0xa')][_0xd281('0xe')],config[_0xd281('0xa')][_0xd281('0x10')],config['sequelizeHistory'][_0xd281('0xf')],config[_0xd281('0xa')][_0xd281('0x11')])};db[_0xd281('0x12')]=db[_0xd281('0x1')][_0xd281('0x13')](_0xd281('0x14'));db[_0xd281('0x15')]=db[_0xd281('0x1')][_0xd281('0x13')]('../api/voiceChanSpy/voiceChanSpy.model');db[_0xd281('0x16')]=db['sequelize'][_0xd281('0x13')](_0xd281('0x17'));db['VoiceExtension']=db[_0xd281('0x1')][_0xd281('0x13')](_0xd281('0x18'));db[_0xd281('0x19')]=db[_0xd281('0x1')][_0xd281('0x13')]('../api/voiceMusicOnHold/voiceMusicOnHold.model');db[_0xd281('0x1a')]=db[_0xd281('0x1')][_0xd281('0x13')](_0xd281('0x1b'));db[_0xd281('0x1c')]=db['sequelize'][_0xd281('0x13')]('../api/voiceRecording/voiceRecording.model');db[_0xd281('0x1d')]=db[_0xd281('0x1')][_0xd281('0x13')](_0xd281('0x1e'));db[_0xd281('0x1f')]=db[_0xd281('0x1')][_0xd281('0x13')](_0xd281('0x20'));db[_0xd281('0x21')]=db[_0xd281('0x1')][_0xd281('0x13')]('../api/voiceMailMessage/voiceMailMessage.model');db[_0xd281('0x22')]=db[_0xd281('0x1')][_0xd281('0x13')](_0xd281('0x23'));db['VoiceDialReport']=db[_0xd281('0x1')][_0xd281('0x13')](_0xd281('0x24'));db[_0xd281('0x25')]=db[_0xd281('0x1')]['import']('../api/voiceAgentReport/voiceAgentReport.model');db[_0xd281('0x26')]=db[_0xd281('0x1')][_0xd281('0x13')](_0xd281('0x27'));db['MemberReport']=db[_0xd281('0x1')][_0xd281('0x13')](_0xd281('0x28'));db[_0xd281('0x29')]=db[_0xd281('0x1')]['import'](_0xd281('0x2a'));db['VoiceTransferReport']=db['sequelize'][_0xd281('0x13')](_0xd281('0x2b'));db[_0xd281('0x2c')]=db[_0xd281('0x1')]['import'](_0xd281('0x2d'));db['UserVoiceQueue']=db[_0xd281('0x1')][_0xd281('0x13')]('../api/userVoiceQueue/userVoiceQueue.model');db[_0xd281('0x2e')]=db[_0xd281('0x1')][_0xd281('0x13')]('../api/userChatQueue/userChatQueue.model');db[_0xd281('0x2f')]=db[_0xd281('0x1')][_0xd281('0x13')](_0xd281('0x30'));db[_0xd281('0x31')]=db[_0xd281('0x1')]['import'](_0xd281('0x32'));db[_0xd281('0x33')]=db[_0xd281('0x1')][_0xd281('0x13')](_0xd281('0x34'));db[_0xd281('0x35')]=db['sequelize'][_0xd281('0x13')](_0xd281('0x36'));db['UserWhatsappQueue']=db[_0xd281('0x1')][_0xd281('0x13')]('../api/userWhatsappQueue/userWhatsappQueue.model');db[_0xd281('0x37')]=db[_0xd281('0x1')]['import'](_0xd281('0x38'));db[_0xd281('0x39')]=db[_0xd281('0x1')]['import'](_0xd281('0x3a'));db['MailAccount']=db[_0xd281('0x1')][_0xd281('0x13')]('../api/mailAccount/mailAccount.model');db[_0xd281('0x3b')]=db['sequelize'][_0xd281('0x13')](_0xd281('0x3c'));db[_0xd281('0x3d')]=db[_0xd281('0x1')][_0xd281('0x13')](_0xd281('0x3e'));db[_0xd281('0x3f')]=db[_0xd281('0x1')][_0xd281('0x13')]('../api/mailInteraction/mailInteraction.model');db[_0xd281('0x40')]=db['sequelize'][_0xd281('0x13')](_0xd281('0x41'));db['MailApplication']=db[_0xd281('0x1')][_0xd281('0x13')](_0xd281('0x42'));db['MailQueueReport']=db[_0xd281('0x1')][_0xd281('0x13')](_0xd281('0x43'));db[_0xd281('0x44')]=db[_0xd281('0x1')][_0xd281('0x13')]('../api/dashboard/dashboard.model');db[_0xd281('0x45')]=db['sequelize'][_0xd281('0x13')](_0xd281('0x46'));db[_0xd281('0x47')]=db[_0xd281('0x1')]['import'](_0xd281('0x48'));db[_0xd281('0x49')]=db[_0xd281('0x1')]['import']('../api/faxApplication/faxApplication.model');db['FaxInteraction']=db['sequelize'][_0xd281('0x13')](_0xd281('0x4a'));db[_0xd281('0x4b')]=db[_0xd281('0x1')]['import'](_0xd281('0x4c'));db[_0xd281('0x4d')]=db[_0xd281('0x1')]['import'](_0xd281('0x4e'));db[_0xd281('0x4f')]=db[_0xd281('0x1')][_0xd281('0x13')](_0xd281('0x50'));db[_0xd281('0x51')]=db[_0xd281('0x1')][_0xd281('0x13')](_0xd281('0x52'));db['SmsApplication']=db[_0xd281('0x1')]['import'](_0xd281('0x53'));db[_0xd281('0x54')]=db[_0xd281('0x1')][_0xd281('0x13')](_0xd281('0x55'));db[_0xd281('0x56')]=db['sequelize']['import'](_0xd281('0x57'));db[_0xd281('0x58')]=db[_0xd281('0x1')][_0xd281('0x13')](_0xd281('0x59'));db['OpenchannelAccount']=db[_0xd281('0x1')][_0xd281('0x13')](_0xd281('0x5a'));db[_0xd281('0x5b')]=db[_0xd281('0x1')][_0xd281('0x13')](_0xd281('0x5c'));db[_0xd281('0x5d')]=db[_0xd281('0x1')][_0xd281('0x13')]('../api/openchannelInteraction/openchannelInteraction.model');db['OpenchannelMessage']=db['sequelize']['import']('../api/openchannelMessage/openchannelMessage.model');db[_0xd281('0x5e')]=db[_0xd281('0x1')][_0xd281('0x13')]('../api/openchannelQueue/openchannelQueue.model');db[_0xd281('0x5f')]=db['sequelize'][_0xd281('0x13')](_0xd281('0x60'));db[_0xd281('0x61')]=db[_0xd281('0x1')][_0xd281('0x13')](_0xd281('0x62'));db[_0xd281('0x63')]=db[_0xd281('0x1')][_0xd281('0x13')](_0xd281('0x64'));db['ChatInteraction']=db[_0xd281('0x1')]['import'](_0xd281('0x65'));db[_0xd281('0x66')]=db[_0xd281('0x1')][_0xd281('0x13')](_0xd281('0x67'));db['ChatOfflineMessage']=db['sequelize']['import'](_0xd281('0x68'));db[_0xd281('0x69')]=db[_0xd281('0x1')][_0xd281('0x13')](_0xd281('0x6a'));db[_0xd281('0x6b')]=db[_0xd281('0x1')]['import'](_0xd281('0x6c'));db[_0xd281('0x6d')]=db[_0xd281('0x1')]['import'](_0xd281('0x6e'));db[_0xd281('0x6f')]=db[_0xd281('0x1')][_0xd281('0x13')](_0xd281('0x70'));db[_0xd281('0x71')]=db['sequelize'][_0xd281('0x13')](_0xd281('0x72'));db[_0xd281('0x73')]=db['sequelize'][_0xd281('0x13')](_0xd281('0x74'));db[_0xd281('0x75')]=db[_0xd281('0x1')][_0xd281('0x13')](_0xd281('0x76'));db[_0xd281('0x77')]=db[_0xd281('0x1')][_0xd281('0x13')]('../api/cmHopperFinal/cmHopperFinal.model');db[_0xd281('0x78')]=db[_0xd281('0x1')][_0xd281('0x13')](_0xd281('0x79'));db[_0xd281('0x7a')]=db[_0xd281('0x1')]['import'](_0xd281('0x7b'));db['CmCustomField']=db[_0xd281('0x1')][_0xd281('0x13')](_0xd281('0x7c'));db[_0xd281('0x7d')]=db['sequelize'][_0xd281('0x13')](_0xd281('0x7e'));db[_0xd281('0x7f')]=db['sequelize'][_0xd281('0x13')](_0xd281('0x80'));db[_0xd281('0x81')]=db[_0xd281('0x1')][_0xd281('0x13')](_0xd281('0x82'));db[_0xd281('0x83')]=db[_0xd281('0x1')][_0xd281('0x13')]('../api/disposition/disposition.model');db[_0xd281('0x84')]=db[_0xd281('0x1')][_0xd281('0x13')](_0xd281('0x85'));db[_0xd281('0x86')]=db[_0xd281('0x1')][_0xd281('0x13')](_0xd281('0x87'));db['Pause']=db[_0xd281('0x1')]['import'](_0xd281('0x88'));db[_0xd281('0x89')]=db['sequelize'][_0xd281('0x13')](_0xd281('0x8a'));db[_0xd281('0x8b')]=db[_0xd281('0x1')]['import'](_0xd281('0x8c'));db['Schedule']=db[_0xd281('0x1')][_0xd281('0x13')]('../api/schedule/schedule.model');db[_0xd281('0x8d')]=db[_0xd281('0x1')][_0xd281('0x13')](_0xd281('0x8e'));db[_0xd281('0x8f')]=db[_0xd281('0x1')][_0xd281('0x13')](_0xd281('0x90'));db[_0xd281('0x91')]=db['sequelize'][_0xd281('0x13')](_0xd281('0x92'));db[_0xd281('0x93')]=db['sequelize'][_0xd281('0x13')](_0xd281('0x94'));db['CmHopperAdditionalPhone']=db[_0xd281('0x1')][_0xd281('0x13')]('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model');db[_0xd281('0x95')]=db[_0xd281('0x1')][_0xd281('0x13')](_0xd281('0x96'));db[_0xd281('0x97')]=db['sequelize'][_0xd281('0x13')](_0xd281('0x98'));db[_0xd281('0x99')]=db[_0xd281('0x1')][_0xd281('0x13')](_0xd281('0x9a'));db[_0xd281('0x9b')]=db['sequelize'][_0xd281('0x13')](_0xd281('0x9c'));db[_0xd281('0x9d')]=db[_0xd281('0x1')]['import'](_0xd281('0x9e'));db[_0xd281('0x9f')]=db['sequelize']['import'](_0xd281('0xa0'));db[_0xd281('0xa1')]=db['sequelize'][_0xd281('0x13')](_0xd281('0xa2'));db[_0xd281('0xa3')]=db[_0xd281('0x1')][_0xd281('0x13')](_0xd281('0xa4'));db[_0xd281('0xa5')]=db['sequelize'][_0xd281('0x13')]('../api/analyticMetric/analyticMetric.model');db[_0xd281('0xa6')]=db[_0xd281('0x1')][_0xd281('0x13')](_0xd281('0xa7'));db[_0xd281('0xa8')]=db[_0xd281('0x1')][_0xd281('0x13')](_0xd281('0xa9'));db['SalesforceAccount']=db[_0xd281('0x1')][_0xd281('0x13')](_0xd281('0xaa'));db[_0xd281('0xab')]=db[_0xd281('0x1')][_0xd281('0x13')](_0xd281('0xac'));db[_0xd281('0xad')]=db[_0xd281('0x1')]['import'](_0xd281('0xae'));db[_0xd281('0xaf')]=db[_0xd281('0x1')][_0xd281('0x13')](_0xd281('0xb0'));db[_0xd281('0xb1')]=db[_0xd281('0x1')][_0xd281('0x13')](_0xd281('0xb2'));db[_0xd281('0xb3')]=db['sequelize'][_0xd281('0x13')]('../api/intSugarcrmField/intSugarcrmField.model');db[_0xd281('0xb4')]=db[_0xd281('0x1')][_0xd281('0x13')](_0xd281('0xb5'));db['DeskConfiguration']=db['sequelize'][_0xd281('0x13')](_0xd281('0xb6'));db['DeskField']=db[_0xd281('0x1')][_0xd281('0x13')]('../api/intDeskField/intDeskField.model');db[_0xd281('0xb7')]=db[_0xd281('0x1')][_0xd281('0x13')](_0xd281('0xb8'));db['ZohoConfiguration']=db['sequelize']['import'](_0xd281('0xb9'));db[_0xd281('0xba')]=db['sequelize'][_0xd281('0x13')](_0xd281('0xbb'));db['ZendeskAccount']=db[_0xd281('0x1')]['import']('../api/intZendeskAccount/intZendeskAccount.model');db[_0xd281('0xbc')]=db[_0xd281('0x1')]['import']('../api/intZendeskConfiguration/intZendeskConfiguration.model');db[_0xd281('0xbd')]=db[_0xd281('0x1')][_0xd281('0x13')]('../api/intZendeskField/intZendeskField.model');db['FreshdeskAccount']=db[_0xd281('0x1')][_0xd281('0x13')](_0xd281('0xbe'));db[_0xd281('0xbf')]=db[_0xd281('0x1')][_0xd281('0x13')](_0xd281('0xc0'));db['FreshdeskField']=db[_0xd281('0x1')][_0xd281('0x13')](_0xd281('0xc1'));db[_0xd281('0xc2')]=db[_0xd281('0x1')][_0xd281('0x13')](_0xd281('0xc3'));db[_0xd281('0xc4')]=db['sequelize'][_0xd281('0x13')](_0xd281('0xc5'));db[_0xd281('0xc6')]=db[_0xd281('0x1')][_0xd281('0x13')](_0xd281('0xc7'));db[_0xd281('0xc8')]=db['sequelize'][_0xd281('0x13')](_0xd281('0xc9'));db['ServicenowConfiguration']=db[_0xd281('0x1')][_0xd281('0x13')](_0xd281('0xca'));db[_0xd281('0xcb')]=db[_0xd281('0x1')]['import'](_0xd281('0xcc'));db[_0xd281('0xcd')]=db['sequelize']['import'](_0xd281('0xce'));db[_0xd281('0xcf')]=db['sequelize'][_0xd281('0x13')]('../api/intDynamics365Configuration/intDynamics365Configuration.model');db[_0xd281('0xd0')]=db[_0xd281('0x1')][_0xd281('0x13')]('../api/intDynamics365Field/intDynamics365Field.model');db[_0xd281('0xd1')]=db['sequelize'][_0xd281('0x13')](_0xd281('0xd2'));db['FreshsalesConfiguration']=db[_0xd281('0x1')]['import'](_0xd281('0xd3'));db[_0xd281('0xd4')]=db['sequelize'][_0xd281('0x13')](_0xd281('0xd5'));db[_0xd281('0x9b')]=db[_0xd281('0x1')][_0xd281('0x13')]('../api/integration/integration.model');db[_0xd281('0xd6')]=db[_0xd281('0x1')]['import'](_0xd281('0xd7'));db['ChatQueueReport']=db[_0xd281('0x1')][_0xd281('0x13')]('../api/chatQueueReport/chatQueueReport.model');db[_0xd281('0xd8')]=db[_0xd281('0x1')]['import'](_0xd281('0xd9'));db[_0xd281('0xda')]=db[_0xd281('0x1')][_0xd281('0x13')](_0xd281('0xdb'));db[_0xd281('0xdc')]=db[_0xd281('0x1')][_0xd281('0x13')]('../api/jscriptyQuestionReport/jscriptyQuestionReport.model');db[_0xd281('0xdd')]=db['sequelize'][_0xd281('0x13')]('../api/jscriptySessionReport/jscriptySessionReport.model');db[_0xd281('0xde')]=db[_0xd281('0x1')]['import'](_0xd281('0xdf'));db['SquareReport']=db[_0xd281('0x1')][_0xd281('0x13')](_0xd281('0xe0'));db[_0xd281('0xe1')]=db[_0xd281('0x1')][_0xd281('0x13')]('../api/squareReportDetail/squareReportDetail.model');db[_0xd281('0xe2')]=db[_0xd281('0x1')][_0xd281('0x13')](_0xd281('0xe3'));db[_0xd281('0xe4')]=db[_0xd281('0x1')][_0xd281('0x13')](_0xd281('0xe5'));db[_0xd281('0xe6')]=db['sequelize'][_0xd281('0x13')](_0xd281('0xe7'));db['SquareProject']=db[_0xd281('0x1')][_0xd281('0x13')](_0xd281('0xe8'));db[_0xd281('0xe9')]=db['sequelize'][_0xd281('0x13')](_0xd281('0xea'));db[_0xd281('0xeb')]=db[_0xd281('0x1')][_0xd281('0x13')](_0xd281('0xec'));db[_0xd281('0xed')]=db[_0xd281('0x1')]['import'](_0xd281('0xee'));db[_0xd281('0xef')]=db[_0xd281('0x1')][_0xd281('0x13')](_0xd281('0xf0'));db[_0xd281('0xf1')]=db['sequelize'][_0xd281('0x13')](_0xd281('0xf2'));db[_0xd281('0xf3')]=db[_0xd281('0x1')]['import'](_0xd281('0xf4'));db[_0xd281('0xf5')]=db['sequelize'][_0xd281('0x13')]('../api/attachment/attachment.model');db[_0xd281('0xf6')]=db[_0xd281('0x1')][_0xd281('0x13')](_0xd281('0xf7'));db[_0xd281('0xf8')]=db[_0xd281('0x1')][_0xd281('0x13')](_0xd281('0xf9'));db['ChatTransferReport']=db[_0xd281('0x1')]['import'](_0xd281('0xfa'));db['FaxTransferReport']=db['sequelize'][_0xd281('0x13')](_0xd281('0xfb'));db[_0xd281('0xfc')]=db[_0xd281('0x1')][_0xd281('0x13')](_0xd281('0xfd'));db[_0xd281('0xfe')]=db['sequelize'][_0xd281('0x13')](_0xd281('0xff'));db[_0xd281('0x100')]=db[_0xd281('0x1')][_0xd281('0x13')](_0xd281('0x101'));db['VoicePrefix']=db['sequelize']['import'](_0xd281('0x102'));db[_0xd281('0x103')]=db[_0xd281('0x1')]['import'](_0xd281('0x104'));db[_0xd281('0x105')]=db[_0xd281('0x1')][_0xd281('0x13')](_0xd281('0x106'));db[_0xd281('0x107')]=db[_0xd281('0x1')][_0xd281('0x13')](_0xd281('0x108'));db[_0xd281('0x109')]=db['sequelize'][_0xd281('0x13')]('../api/userNotification/userNotification.model');db[_0xd281('0x10a')]=db['sequelize']['import'](_0xd281('0x10b'));db[_0xd281('0x10c')]=db[_0xd281('0x1')][_0xd281('0x13')](_0xd281('0x10d'));db[_0xd281('0x10e')]=db[_0xd281('0x1')][_0xd281('0x13')](_0xd281('0x10f'));db['WhatsappMessage']=db[_0xd281('0x1')][_0xd281('0x13')](_0xd281('0x110'));db[_0xd281('0x111')]=db['sequelize'][_0xd281('0x13')](_0xd281('0x112'));db[_0xd281('0x113')]=db['sequelize']['import'](_0xd281('0x114'));db['WhatsappQueue']=db[_0xd281('0x1')][_0xd281('0x13')](_0xd281('0x115'));db[_0xd281('0x116')]=db[_0xd281('0x1')]['import'](_0xd281('0x117'));db[_0xd281('0x118')]=db[_0xd281('0x1')][_0xd281('0x13')]('../api/teamVoiceQueue/teamVoiceQueue.model');db[_0xd281('0x119')]=db[_0xd281('0x1')]['import'](_0xd281('0x11a'));db[_0xd281('0x11b')]=db['sequelize'][_0xd281('0x13')]('../api/userVoicePrefix/userVoicePrefix.model');db['UserSetting']=db[_0xd281('0x1')][_0xd281('0x13')](_0xd281('0x11c'));db[_0xd281('0x11d')]=db[_0xd281('0x1')]['import'](_0xd281('0x11e'));db[_0xd281('0x12')]['hasOne'](db[_0xd281('0x1f')],{'as':_0xd281('0x1f'),'onDelete':'cascade','foreignKey':_0xd281('0x11f')});db['User'][_0xd281('0x120')](db[_0xd281('0x121')],{'as':'userSetting','onDelete':_0xd281('0x122'),'foreignKey':'UserId'});db[_0xd281('0x12')][_0xd281('0x123')](db['VoiceRecording'],{'as':_0xd281('0x124'),'foreignKey':_0xd281('0x11f')});db[_0xd281('0x12')][_0xd281('0x123')](db['UserVoiceQueueRt'],{'as':_0xd281('0x125'),'foreignKey':'UserId'});db[_0xd281('0x12')][_0xd281('0x123')](db[_0xd281('0x126')],{'as':_0xd281('0x127'),'onDelete':_0xd281('0x122'),'hooks':!![]});db[_0xd281('0x12')][_0xd281('0x123')](db['CmHopperFinal'],{'as':_0xd281('0x128'),'foreignKey':'UserId'});db['User']['hasMany'](db['CmHopperHistory'],{'as':_0xd281('0x129'),'foreignKey':_0xd281('0x11f')});db[_0xd281('0x12')]['hasMany'](db[_0xd281('0x7a')],{'as':'ReportAgentPreview','foreignKey':_0xd281('0x11f')});db[_0xd281('0x12')]['hasMany'](db['OpenchannelInteraction'],{'as':'OpenchannelInteractions','foreignKey':'UserId'});db[_0xd281('0x12')][_0xd281('0x123')](db[_0xd281('0x12a')],{'as':'ChatInteractions','foreignKey':_0xd281('0x11f')});db[_0xd281('0x12')][_0xd281('0x123')](db['SmsInteraction'],{'as':'SmsInteractions','foreignKey':'UserId'});db[_0xd281('0x12')][_0xd281('0x123')](db[_0xd281('0x12b')],{'as':_0xd281('0x12c'),'foreignKey':_0xd281('0x11f')});db['User'][_0xd281('0x123')](db['MailInteraction'],{'as':_0xd281('0x12d'),'foreignKey':_0xd281('0x11f')});db[_0xd281('0x12')]['hasMany'](db[_0xd281('0x10e')],{'as':'WhatsappInteractions','foreignKey':'UserId'});db[_0xd281('0x12')][_0xd281('0x123')](db[_0xd281('0x109')],{'as':_0xd281('0x12e'),'foreignKey':_0xd281('0x12f')});db[_0xd281('0x12')]['hasMany'](db[_0xd281('0x73')],{'as':'Hoppers','foreignKey':_0xd281('0x11f'),'onDelete':_0xd281('0x130')});db[_0xd281('0x12')]['belongsTo'](db[_0xd281('0x103')],{'as':_0xd281('0x103'),'foreignKey':'userProfileId'});db['User']['belongsToMany'](db[_0xd281('0x6b')],{'as':_0xd281('0x131'),'through':_0xd281('0x132')});db[_0xd281('0x12')][_0xd281('0x133')](db[_0xd281('0x71')],{'as':_0xd281('0x134'),'through':'cm_user_has_contacts'});db[_0xd281('0x12')]['belongsToMany'](db['CmList'],{'as':_0xd281('0x135'),'through':_0xd281('0x136')});db['User'][_0xd281('0x133')](db['Team'],{'through':_0xd281('0x137')});db[_0xd281('0x12')][_0xd281('0x133')](db[_0xd281('0x3f')],{'as':_0xd281('0x12d'),'through':_0xd281('0x138')});db['User'][_0xd281('0x133')](db[_0xd281('0x12a')],{'as':'ChatInteractions','through':_0xd281('0x139')});db[_0xd281('0x12')][_0xd281('0x133')](db[_0xd281('0x12b')],{'as':_0xd281('0x12c'),'through':_0xd281('0x13a')});db['User']['belongsToMany'](db[_0xd281('0x54')],{'as':'SmsInteractions','through':_0xd281('0x13b')});db[_0xd281('0x12')]['belongsToMany'](db[_0xd281('0x5d')],{'as':_0xd281('0x13c'),'through':'user_has_openchannel_interactions'});db[_0xd281('0x12')][_0xd281('0x133')](db[_0xd281('0x10e')],{'as':_0xd281('0x13d'),'through':_0xd281('0x13e')});db[_0xd281('0x12')][_0xd281('0x133')](db[_0xd281('0x1a')],{'as':_0xd281('0x13f'),'through':_0xd281('0x140'),'required':![]});db[_0xd281('0x12')][_0xd281('0x133')](db['VoicePrefix'],{'as':_0xd281('0x141'),'through':'UserVoicePrefix','required':![]});db[_0xd281('0x12')][_0xd281('0x133')](db[_0xd281('0x3b')],{'as':_0xd281('0x142'),'through':_0xd281('0x2f'),'required':![]});db[_0xd281('0x12')][_0xd281('0x133')](db['ChatQueue'],{'as':_0xd281('0x143'),'through':_0xd281('0x2e'),'required':![],'hooks':!![]});db[_0xd281('0x12')][_0xd281('0x133')](db['FaxQueue'],{'as':'FaxQueues','through':_0xd281('0x31'),'required':![]});db[_0xd281('0x12')][_0xd281('0x133')](db[_0xd281('0x58')],{'as':_0xd281('0x144'),'through':_0xd281('0x33'),'required':![]});db[_0xd281('0x12')][_0xd281('0x133')](db[_0xd281('0x5e')],{'as':_0xd281('0x145'),'through':'UserOpenchannelQueue','required':![]});db['User'][_0xd281('0x133')](db[_0xd281('0x146')],{'as':_0xd281('0x147'),'through':_0xd281('0x148'),'required':![]});db[_0xd281('0x12')][_0xd281('0x133')](db[_0xd281('0x100')],{'through':_0xd281('0x136')});db['User']['belongsToMany'](db[_0xd281('0x5f')],{'as':_0xd281('0x149'),'through':_0xd281('0x14a')});db['User'][_0xd281('0x133')](db['FaxAccount'],{'as':_0xd281('0x14b'),'through':_0xd281('0x14c')});db[_0xd281('0x12')][_0xd281('0x133')](db[_0xd281('0x14d')],{'as':_0xd281('0x14e'),'through':'user_has_mail_accounts'});db['User']['belongsToMany'](db[_0xd281('0x14f')],{'as':_0xd281('0x150'),'through':_0xd281('0x151')});db[_0xd281('0x12')][_0xd281('0x133')](db[_0xd281('0x51')],{'as':_0xd281('0x152'),'through':'user_has_sms_accounts'});db[_0xd281('0x12')][_0xd281('0x133')](db[_0xd281('0x10a')],{'as':'WhatsappAccounts','through':_0xd281('0x153')});db['VoiceChanSpy'][_0xd281('0x123')](db['VoiceExtension'],{'as':'SpiedAgents','onDelete':_0xd281('0x122'),'foreignKey':_0xd281('0x154')});db[_0xd281('0x16')][_0xd281('0x123')](db[_0xd281('0x126')],{'onDelete':_0xd281('0x122')});db[_0xd281('0x126')][_0xd281('0x123')](db[_0xd281('0x126')],{'as':_0xd281('0x155'),'onDelete':_0xd281('0x122')});db['VoiceMusicOnHold'][_0xd281('0x133')](db[_0xd281('0x8d')],{'as':_0xd281('0x156'),'through':_0xd281('0x157')});db[_0xd281('0x1a')][_0xd281('0x123')](db[_0xd281('0x2c')],{'as':_0xd281('0x158'),'foreignKey':'VoiceQueueId'});db['VoiceQueue']['hasMany'](db[_0xd281('0x73')],{'as':_0xd281('0x159'),'foreignKey':_0xd281('0x15a')});db[_0xd281('0x1a')][_0xd281('0x123')](db[_0xd281('0x77')],{'as':_0xd281('0x128'),'foreignKey':'VoiceQueueId'});db[_0xd281('0x1a')][_0xd281('0x123')](db[_0xd281('0x78')],{'as':'HopperHistories','foreignKey':'VoiceQueueId'});db[_0xd281('0x1a')][_0xd281('0x123')](db[_0xd281('0x7a')],{'as':_0xd281('0x7a'),'foreignKey':_0xd281('0x15a')});db[_0xd281('0x1a')][_0xd281('0x123')](db[_0xd281('0x75')],{'as':_0xd281('0x15b'),'foreignKey':'VoiceQueueId'});db[_0xd281('0x1a')][_0xd281('0x123')](db[_0xd281('0xdd')],{'as':_0xd281('0x15c'),'foreignKey':_0xd281('0x15a')});db['VoiceQueue'][_0xd281('0x15d')](db[_0xd281('0x29')],{'as':_0xd281('0x29'),'foreignKey':'TrunkId'});db[_0xd281('0x1a')][_0xd281('0x15d')](db[_0xd281('0x29')],{'as':_0xd281('0x15e'),'foreignKey':_0xd281('0x15f')});db[_0xd281('0x1a')][_0xd281('0x15d')](db[_0xd281('0x86')],{'as':'Interval','foreignKey':_0xd281('0x160')});db[_0xd281('0x1a')]['belongsTo'](db[_0xd281('0x161')],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db['VoiceQueue'][_0xd281('0x133')](db[_0xd281('0x100')],{'as':_0xd281('0x135'),'through':_0xd281('0x162')});db[_0xd281('0x1a')][_0xd281('0x133')](db[_0xd281('0x12')],{'as':_0xd281('0x163'),'through':_0xd281('0x140')});db['VoiceQueue'][_0xd281('0x133')](db[_0xd281('0xed')],{'as':_0xd281('0x164'),'through':'TeamVoiceQueue'});db['VoiceQueue'][_0xd281('0x133')](db['CmList'],{'as':_0xd281('0x165'),'through':_0xd281('0x166')});db[_0xd281('0x1c')][_0xd281('0x15d')](db['User'],{'as':_0xd281('0x12'),'foreignKey':_0xd281('0x11f')});db['ScreenRecording']['belongsTo'](db[_0xd281('0x12')],{'as':_0xd281('0x12'),'foreignKey':'UserId'});db['VoiceMail']['hasMany'](db[_0xd281('0x21')],{'as':_0xd281('0x167'),'onDelete':_0xd281('0x122'),'foreignKey':_0xd281('0x168'),'sourceKey':'mailbox'});db[_0xd281('0x21')][_0xd281('0x15d')](db['VoiceMail'],{'foreignKey':'mailboxuser','targetKey':'mailbox'});db[_0xd281('0x22')][_0xd281('0x123')](db[_0xd281('0x26')],{'as':_0xd281('0x169'),'foreignKey':_0xd281('0x16a'),'constraints':![]});db[_0xd281('0x22')][_0xd281('0x123')](db[_0xd281('0x25')],{'as':_0xd281('0x16b'),'foreignKey':'uniqueid','constraints':![]});db[_0xd281('0x22')][_0xd281('0x15d')](db[_0xd281('0x12')],{'as':_0xd281('0x12'),'foreignKey':_0xd281('0x11f')});db[_0xd281('0x22')]['belongsTo'](db[_0xd281('0x71')],{'as':_0xd281('0x16c'),'foreignKey':_0xd281('0x16d')});db[_0xd281('0x37')][_0xd281('0x15d')](db['MailAccount'],{'as':_0xd281('0x14d'),'foreignKey':_0xd281('0x16e')});db[_0xd281('0x37')]['belongsTo'](db['CloudProvider'],{'as':_0xd281('0x116'),'foreignKey':_0xd281('0x16f'),'onDelete':_0xd281('0x170')});db['MailServerOut'][_0xd281('0x15d')](db[_0xd281('0x14d')],{'as':_0xd281('0x14d'),'foreignKey':_0xd281('0x16e')});db[_0xd281('0x39')][_0xd281('0x15d')](db[_0xd281('0x116')],{'as':'CloudProvider','foreignKey':_0xd281('0x16f'),'onDelete':_0xd281('0x170')});db['MailAccount'][_0xd281('0x120')](db['MailServerIn'],{'as':_0xd281('0x171'),'onDelete':_0xd281('0x122')});db[_0xd281('0x14d')][_0xd281('0x120')](db[_0xd281('0x39')],{'as':_0xd281('0x172'),'onDelete':_0xd281('0x122')});db[_0xd281('0x14d')][_0xd281('0x123')](db[_0xd281('0x83')],{'as':_0xd281('0x173'),'foreignKey':'MailAccountId','onDelete':'cascade'});db['MailAccount'][_0xd281('0x123')](db[_0xd281('0x81')],{'as':_0xd281('0x174'),'foreignKey':'MailAccountId'});db[_0xd281('0x14d')][_0xd281('0x123')](db[_0xd281('0x40')],{'as':_0xd281('0x167'),'foreignKey':_0xd281('0x16e')});db[_0xd281('0x14d')][_0xd281('0x123')](db['MailInteraction'],{'as':_0xd281('0x175')});db['MailAccount'][_0xd281('0x123')](db[_0xd281('0x176')],{'as':_0xd281('0x155'),'foreignKey':_0xd281('0x16e'),'onDelete':'cascade'});db['MailAccount'][_0xd281('0x15d')](db['CmList'],{'as':'List','foreignKey':_0xd281('0x177')});db[_0xd281('0x14d')][_0xd281('0x15d')](db[_0xd281('0x95')],{'as':_0xd281('0x95'),'foreignKey':'TemplateId'});db[_0xd281('0x14d')][_0xd281('0x15d')](db['Pause'],{'as':_0xd281('0x178'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xd281('0x14d')][_0xd281('0x133')](db[_0xd281('0x12')],{'as':'Agents','through':_0xd281('0x179')});db['MailQueue'][_0xd281('0x133')](db[_0xd281('0x12')],{'as':'Agents','through':_0xd281('0x2f')});db['MailQueue'][_0xd281('0x133')](db[_0xd281('0xed')],{'through':'team_has_mail_queues','as':_0xd281('0x164')});db[_0xd281('0x3f')][_0xd281('0x123')](db[_0xd281('0x40')],{'as':'Messages','onDelete':_0xd281('0x122'),'foreignKey':'MailInteractionId'});db[_0xd281('0x3f')][_0xd281('0x15d')](db[_0xd281('0x14d')],{'as':_0xd281('0x17a'),'foreignKey':_0xd281('0x16e')});db[_0xd281('0x3f')][_0xd281('0x15d')](db['CmContact'],{'as':'Contact','foreignKey':_0xd281('0x16d')});db[_0xd281('0x3f')][_0xd281('0x15d')](db[_0xd281('0x12')],{'as':_0xd281('0x17b'),'foreignKey':_0xd281('0x11f')});db['MailInteraction'][_0xd281('0x133')](db[_0xd281('0x8f')],{'through':_0xd281('0x17c'),'as':_0xd281('0x17d')});db[_0xd281('0x3f')]['belongsToMany'](db[_0xd281('0x8f')],{'through':'mail_interaction_has_tags','as':'ThroughTags'});db[_0xd281('0x3f')][_0xd281('0x133')](db[_0xd281('0x12')],{'as':_0xd281('0x17e'),'through':_0xd281('0x138'),'foreignKey':_0xd281('0x17f')});db['MailMessage']['hasMany'](db[_0xd281('0xf5')],{'as':_0xd281('0x180'),'onDelete':_0xd281('0x122')});db[_0xd281('0x40')][_0xd281('0x15d')](db['User'],{'as':_0xd281('0x12')});db[_0xd281('0x40')]['belongsTo'](db['CmContact'],{'onDelete':_0xd281('0x122'),'as':_0xd281('0x16c')});db[_0xd281('0x40')]['belongsTo'](db[_0xd281('0x3f')],{'as':_0xd281('0x181'),'foreignKey':_0xd281('0x17f')});db[_0xd281('0x40')][_0xd281('0x15d')](db['MailAccount'],{'as':_0xd281('0x17a'),'foreignKey':_0xd281('0x16e')});db[_0xd281('0x40')][_0xd281('0x15d')](db[_0xd281('0x5f')],{'as':'ChatWebsite','foreignKey':_0xd281('0x182')});db['MailMessage'][_0xd281('0x15d')](db['ChatOfflineMessage'],{'as':_0xd281('0x183'),'foreignKey':'ChatOfflineMessageId'});db[_0xd281('0x176')][_0xd281('0x15d')](db[_0xd281('0x12')],{'onDelete':_0xd281('0x170')});db[_0xd281('0x176')][_0xd281('0x15d')](db[_0xd281('0x3b')],{'onDelete':'restrict'});db[_0xd281('0x176')]['belongsTo'](db[_0xd281('0x14d')],{'onDelete':_0xd281('0x170')});db[_0xd281('0x176')][_0xd281('0x15d')](db[_0xd281('0x86')],{'onDelete':_0xd281('0x170'),'foreignKey':_0xd281('0x160')});db[_0xd281('0x176')][_0xd281('0x15d')](db[_0xd281('0x8f')],{'onDelete':_0xd281('0x170'),'foreignKey':'TagId'});db[_0xd281('0x184')]['belongsTo'](db[_0xd281('0x14d')],{});db[_0xd281('0x184')]['belongsTo'](db[_0xd281('0x100')],{'as':_0xd281('0x185'),'foreignKey':_0xd281('0x177')});db[_0xd281('0x184')]['belongsTo'](db[_0xd281('0x71')],{'as':_0xd281('0x16c'),'foreignKey':'ContactId'});db[_0xd281('0x184')]['belongsTo'](db[_0xd281('0x3f')],{});db[_0xd281('0x184')][_0xd281('0x15d')](db['MailMessage'],{});db['MailQueueReport'][_0xd281('0x15d')](db['User'],{});db['MailQueueReport'][_0xd281('0x15d')](db[_0xd281('0x3b')],{});db['Dashboard'][_0xd281('0x123')](db['DashboardItem'],{'as':'Items','onDelete':_0xd281('0x122')});db[_0xd281('0x47')][_0xd281('0x123')](db['Disposition'],{'as':'Dispositions','foreignKey':_0xd281('0x186'),'onDelete':'cascade'});db[_0xd281('0x47')]['hasMany'](db[_0xd281('0x81')],{'as':_0xd281('0x174'),'foreignKey':_0xd281('0x186')});db[_0xd281('0x47')][_0xd281('0x123')](db[_0xd281('0x12b')],{'as':_0xd281('0x175')});db[_0xd281('0x47')][_0xd281('0x123')](db[_0xd281('0x49')],{'as':_0xd281('0x155'),'foreignKey':_0xd281('0x186'),'onDelete':_0xd281('0x122')});db[_0xd281('0x47')][_0xd281('0x123')](db[_0xd281('0x126')],{'as':_0xd281('0x187'),'onDelete':_0xd281('0x122')});db[_0xd281('0x47')][_0xd281('0x123')](db[_0xd281('0x4b')],{'as':'Messages'});db[_0xd281('0x47')][_0xd281('0x15d')](db['Trunk'],{'as':'Trunk'});db[_0xd281('0x47')][_0xd281('0x15d')](db[_0xd281('0x100')],{'as':_0xd281('0x185'),'foreignKey':_0xd281('0x177')});db[_0xd281('0x47')][_0xd281('0x15d')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0xd281('0x188')});db[_0xd281('0x47')][_0xd281('0x133')](db[_0xd281('0x12')],{'as':'Agents','through':_0xd281('0x14c')});db[_0xd281('0x49')][_0xd281('0x15d')](db['User'],{'onDelete':_0xd281('0x170')});db['FaxApplication'][_0xd281('0x15d')](db['FaxQueue'],{'onDelete':'restrict'});db[_0xd281('0x49')][_0xd281('0x15d')](db[_0xd281('0x47')],{'onDelete':_0xd281('0x170')});db['FaxApplication']['belongsTo'](db[_0xd281('0x8f')],{'onDelete':_0xd281('0x170'),'foreignKey':_0xd281('0x189')});db['FaxInteraction']['hasMany'](db[_0xd281('0x4b')],{'as':_0xd281('0x167'),'onDelete':_0xd281('0x122'),'foreignKey':'FaxInteractionId'});db[_0xd281('0x12b')][_0xd281('0x15d')](db[_0xd281('0x47')],{'as':_0xd281('0x17a'),'foreignKey':_0xd281('0x186')});db[_0xd281('0x12b')][_0xd281('0x15d')](db[_0xd281('0x71')],{'as':_0xd281('0x16c'),'foreignKey':_0xd281('0x16d')});db[_0xd281('0x12b')]['belongsTo'](db[_0xd281('0x12')],{'as':_0xd281('0x17b'),'foreignKey':_0xd281('0x11f')});db[_0xd281('0x12b')][_0xd281('0x133')](db[_0xd281('0x8f')],{'through':'fax_interaction_has_tags','as':_0xd281('0x17d')});db[_0xd281('0x12b')][_0xd281('0x133')](db[_0xd281('0x8f')],{'through':_0xd281('0x18a'),'as':_0xd281('0x18b')});db[_0xd281('0x12b')][_0xd281('0x133')](db[_0xd281('0x12')],{'as':_0xd281('0x17e'),'through':_0xd281('0x13a'),'foreignKey':'FaxInteractionId'});db[_0xd281('0x4b')][_0xd281('0x15d')](db[_0xd281('0x12')],{'onDelete':_0xd281('0x122'),'as':_0xd281('0x12')});db['FaxMessage'][_0xd281('0x15d')](db[_0xd281('0x12b')],{'as':_0xd281('0x181'),'foreignKey':_0xd281('0x18c')});db[_0xd281('0x4b')]['belongsTo'](db[_0xd281('0x71')],{'onDelete':_0xd281('0x122'),'as':_0xd281('0x16c')});db[_0xd281('0x4b')]['belongsTo'](db['Attachment'],{'as':'Attachment','foreignKey':'AttachmentId'});db[_0xd281('0x4b')]['belongsTo'](db[_0xd281('0x47')],{'as':_0xd281('0x17a'),'foreignKey':_0xd281('0x186')});db[_0xd281('0x4d')][_0xd281('0x133')](db[_0xd281('0x12')],{'as':_0xd281('0x163'),'through':_0xd281('0x31')});db[_0xd281('0x4d')]['belongsToMany'](db[_0xd281('0xed')],{'through':_0xd281('0x18d'),'as':_0xd281('0x164')});db[_0xd281('0x4f')][_0xd281('0x15d')](db[_0xd281('0x47')],{});db[_0xd281('0x4f')][_0xd281('0x15d')](db[_0xd281('0x100')],{'as':_0xd281('0x185'),'foreignKey':'ListId'});db[_0xd281('0x4f')][_0xd281('0x15d')](db[_0xd281('0x71')],{'as':_0xd281('0x16c'),'foreignKey':_0xd281('0x16d')});db[_0xd281('0x4f')][_0xd281('0x15d')](db[_0xd281('0x12b')],{});db[_0xd281('0x4f')][_0xd281('0x15d')](db[_0xd281('0x4b')],{});db[_0xd281('0x4f')][_0xd281('0x15d')](db[_0xd281('0x12')],{});db[_0xd281('0x4f')][_0xd281('0x15d')](db[_0xd281('0x4d')],{});db['SmsAccount'][_0xd281('0x123')](db[_0xd281('0x83')],{'as':_0xd281('0x173'),'foreignKey':_0xd281('0x18e'),'onDelete':_0xd281('0x122')});db[_0xd281('0x51')]['hasMany'](db[_0xd281('0x81')],{'as':_0xd281('0x174'),'foreignKey':'SmsAccountId'});db['SmsAccount'][_0xd281('0x123')](db[_0xd281('0x56')],{'as':_0xd281('0x167'),'foreignKey':'SmsAccountId'});db[_0xd281('0x51')]['hasMany'](db['SmsInteraction'],{'as':'Interactions'});db['SmsAccount'][_0xd281('0x123')](db[_0xd281('0x18f')],{'as':'Applications','foreignKey':_0xd281('0x18e'),'onDelete':_0xd281('0x122')});db[_0xd281('0x51')][_0xd281('0x15d')](db['CmList'],{'as':_0xd281('0x185'),'foreignKey':_0xd281('0x177')});db['SmsAccount'][_0xd281('0x15d')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0xd281('0x188')});db[_0xd281('0x51')][_0xd281('0x133')](db[_0xd281('0x12')],{'as':_0xd281('0x163'),'through':'user_has_sms_accounts'});db[_0xd281('0x18f')][_0xd281('0x15d')](db[_0xd281('0x12')],{'onDelete':_0xd281('0x170')});db[_0xd281('0x18f')][_0xd281('0x15d')](db[_0xd281('0x58')],{'onDelete':'restrict'});db[_0xd281('0x18f')]['belongsTo'](db['SmsAccount'],{'onDelete':_0xd281('0x170')});db[_0xd281('0x18f')]['belongsTo'](db[_0xd281('0x86')],{'onDelete':_0xd281('0x170'),'foreignKey':_0xd281('0x160')});db[_0xd281('0x18f')][_0xd281('0x15d')](db[_0xd281('0x8f')],{'onDelete':_0xd281('0x170'),'foreignKey':_0xd281('0x189')});db['SmsInteraction'][_0xd281('0x123')](db[_0xd281('0x56')],{'as':_0xd281('0x167'),'onDelete':_0xd281('0x122'),'foreignKey':'SmsInteractionId'});db[_0xd281('0x54')][_0xd281('0x15d')](db[_0xd281('0x51')],{'as':_0xd281('0x17a'),'foreignKey':_0xd281('0x18e')});db[_0xd281('0x54')][_0xd281('0x15d')](db[_0xd281('0x71')],{'as':_0xd281('0x16c'),'foreignKey':'ContactId'});db['SmsInteraction'][_0xd281('0x15d')](db[_0xd281('0x12')],{'as':'Owner','foreignKey':_0xd281('0x11f')});db[_0xd281('0x54')][_0xd281('0x133')](db[_0xd281('0x8f')],{'through':_0xd281('0x190'),'as':_0xd281('0x17d')});db[_0xd281('0x54')]['belongsToMany'](db['Tag'],{'through':_0xd281('0x190'),'as':_0xd281('0x18b')});db[_0xd281('0x54')][_0xd281('0x133')](db[_0xd281('0x12')],{'as':_0xd281('0x17e'),'through':_0xd281('0x13b'),'foreignKey':_0xd281('0x191')});db[_0xd281('0x56')][_0xd281('0x15d')](db[_0xd281('0x12')],{'as':_0xd281('0x12')});db['SmsMessage']['belongsTo'](db[_0xd281('0x71')],{'onDelete':_0xd281('0x122'),'as':'Contact'});db[_0xd281('0x56')]['belongsTo'](db[_0xd281('0x54')],{'onDelete':_0xd281('0x122'),'as':_0xd281('0x181'),'foreignKey':_0xd281('0x191')});db['SmsMessage'][_0xd281('0x15d')](db[_0xd281('0x51')],{'as':'Account','foreignKey':_0xd281('0x18e')});db['SmsQueue'][_0xd281('0x133')](db[_0xd281('0x12')],{'as':_0xd281('0x163'),'through':_0xd281('0x33'),'foreignKey':_0xd281('0x192')});db[_0xd281('0x58')][_0xd281('0x133')](db[_0xd281('0xed')],{'through':'team_has_sms_queues','as':'Teams'});db[_0xd281('0x14f')]['hasMany'](db['Disposition'],{'as':'Dispositions','foreignKey':'OpenchannelAccountId','onDelete':'cascade'});db[_0xd281('0x14f')]['hasMany'](db[_0xd281('0x81')],{'as':_0xd281('0x174'),'foreignKey':_0xd281('0x193')});db['OpenchannelAccount'][_0xd281('0x123')](db[_0xd281('0x5d')],{'as':_0xd281('0x175'),'foreignKey':_0xd281('0x193')});db[_0xd281('0x14f')][_0xd281('0x123')](db[_0xd281('0x194')],{'as':_0xd281('0x167'),'foreignKey':'OpenchannelAccountId'});db[_0xd281('0x14f')]['hasMany'](db[_0xd281('0x5b')],{'as':_0xd281('0x155'),'foreignKey':'OpenchannelAccountId','onDelete':_0xd281('0x122')});db['OpenchannelAccount']['belongsTo'](db[_0xd281('0x100')],{'as':_0xd281('0x185'),'foreignKey':_0xd281('0x177')});db[_0xd281('0x14f')]['belongsTo'](db[_0xd281('0x161')],{'as':_0xd281('0x178'),'foreignKey':_0xd281('0x188')});db[_0xd281('0x14f')][_0xd281('0x133')](db[_0xd281('0x12')],{'as':_0xd281('0x163'),'through':_0xd281('0x151')});db[_0xd281('0x5b')][_0xd281('0x15d')](db[_0xd281('0x12')],{'onDelete':_0xd281('0x170')});db[_0xd281('0x5b')]['belongsTo'](db['OpenchannelQueue'],{'onDelete':_0xd281('0x170'),'foreignKey':_0xd281('0x195')});db[_0xd281('0x5b')][_0xd281('0x15d')](db[_0xd281('0x14f')],{'onDelete':_0xd281('0x170'),'foreignKey':_0xd281('0x193')});db[_0xd281('0x5b')][_0xd281('0x15d')](db[_0xd281('0x86')],{'onDelete':_0xd281('0x170'),'foreignKey':_0xd281('0x160')});db['OpenchannelApplication']['belongsTo'](db[_0xd281('0x8f')],{'onDelete':_0xd281('0x170'),'foreignKey':'TagId'});db[_0xd281('0x5d')][_0xd281('0x123')](db[_0xd281('0x194')],{'as':_0xd281('0x167'),'onDelete':_0xd281('0x122'),'foreignKey':_0xd281('0x196')});db[_0xd281('0x5d')][_0xd281('0x15d')](db[_0xd281('0x14f')],{'as':_0xd281('0x17a'),'foreignKey':'OpenchannelAccountId'});db[_0xd281('0x5d')]['belongsTo'](db[_0xd281('0x71')],{'as':_0xd281('0x16c'),'foreignKey':_0xd281('0x16d')});db[_0xd281('0x5d')][_0xd281('0x15d')](db['User'],{'as':'Owner','foreignKey':'UserId'});db[_0xd281('0x5d')][_0xd281('0x133')](db[_0xd281('0x8f')],{'through':_0xd281('0x197'),'as':_0xd281('0x17d')});db[_0xd281('0x5d')][_0xd281('0x133')](db[_0xd281('0x8f')],{'through':_0xd281('0x197'),'as':_0xd281('0x18b')});db[_0xd281('0x5d')][_0xd281('0x133')](db[_0xd281('0x12')],{'as':_0xd281('0x17e'),'through':_0xd281('0x198'),'foreignKey':'OpenchannelInteractionId'});db[_0xd281('0x194')][_0xd281('0x15d')](db[_0xd281('0x12')],{'onDelete':_0xd281('0x122'),'as':_0xd281('0x12')});db[_0xd281('0x194')]['belongsTo'](db[_0xd281('0x71')],{'onDelete':_0xd281('0x122'),'as':_0xd281('0x16c')});db['OpenchannelMessage']['belongsTo'](db[_0xd281('0x5d')],{'onDelete':_0xd281('0x122'),'as':_0xd281('0x181'),'foreignKey':_0xd281('0x196')});db[_0xd281('0x194')]['belongsTo'](db['Attachment'],{'as':_0xd281('0xf5'),'foreignKey':_0xd281('0x199')});db['OpenchannelMessage']['belongsTo'](db[_0xd281('0x14f')],{'as':_0xd281('0x17a'),'foreignKey':_0xd281('0x193')});db['OpenchannelQueue'][_0xd281('0x133')](db[_0xd281('0x12')],{'as':_0xd281('0x163'),'through':'UserOpenchannelQueue','foreignKey':_0xd281('0x195')});db[_0xd281('0x5e')]['belongsToMany'](db['Team'],{'through':'team_has_openchannel_queues','as':_0xd281('0x164')});db[_0xd281('0x5f')][_0xd281('0x123')](db[_0xd281('0x83')],{'as':_0xd281('0x173'),'foreignKey':_0xd281('0x182'),'onDelete':'cascade'});db[_0xd281('0x5f')][_0xd281('0x123')](db[_0xd281('0x81')],{'as':_0xd281('0x174'),'foreignKey':_0xd281('0x182')});db[_0xd281('0x5f')][_0xd281('0x123')](db[_0xd281('0x6d')],{'as':_0xd281('0x19a')});db[_0xd281('0x5f')][_0xd281('0x123')](db[_0xd281('0x12a')],{'as':_0xd281('0x175')});db[_0xd281('0x5f')][_0xd281('0x123')](db[_0xd281('0x63')],{'as':'Applications','foreignKey':'ChatWebsiteId','onDelete':_0xd281('0x122')});db['ChatWebsite']['hasMany'](db[_0xd281('0x66')],{'as':_0xd281('0x167')});db[_0xd281('0x5f')][_0xd281('0x15d')](db['CmList'],{'as':'List','foreignKey':_0xd281('0x177')});db['ChatWebsite'][_0xd281('0x15d')](db[_0xd281('0x86')],{'as':_0xd281('0x86'),'foreignKey':_0xd281('0x160')});db[_0xd281('0x5f')][_0xd281('0x15d')](db[_0xd281('0x14d')],{'as':_0xd281('0x14d'),'foreignKey':_0xd281('0x16e')});db[_0xd281('0x5f')]['belongsTo'](db[_0xd281('0x161')],{'as':_0xd281('0x178'),'foreignKey':_0xd281('0x188')});db[_0xd281('0x5f')][_0xd281('0x133')](db[_0xd281('0x12')],{'as':_0xd281('0x163'),'through':_0xd281('0x14a')});db[_0xd281('0x61')]['belongsTo'](db['OpenchannelAccount'],{});db[_0xd281('0x61')][_0xd281('0x15d')](db[_0xd281('0x100')],{'as':'List','foreignKey':'ListId'});db['OpenchannelQueueReport']['belongsTo'](db['CmContact'],{'as':'Contact','foreignKey':_0xd281('0x16d')});db['OpenchannelQueueReport'][_0xd281('0x15d')](db[_0xd281('0x5d')],{});db[_0xd281('0x61')]['belongsTo'](db[_0xd281('0x194')],{});db[_0xd281('0x61')][_0xd281('0x15d')](db['User'],{});db[_0xd281('0x61')][_0xd281('0x15d')](db['OpenchannelQueue'],{});db['ChatApplication']['belongsTo'](db[_0xd281('0x12')],{'as':_0xd281('0x19b'),'foreignKey':_0xd281('0x11f'),'onDelete':_0xd281('0x170')});db[_0xd281('0x63')][_0xd281('0x15d')](db[_0xd281('0x69')],{'as':_0xd281('0x19c'),'foreignKey':_0xd281('0x19d'),'onDelete':'restrict'});db[_0xd281('0x63')]['belongsTo'](db[_0xd281('0x5f')],{'as':_0xd281('0x19e'),'foreignKey':_0xd281('0x182'),'onDelete':_0xd281('0x170')});db['ChatApplication'][_0xd281('0x15d')](db[_0xd281('0x8f')],{'onDelete':_0xd281('0x170'),'foreignKey':_0xd281('0x189')});db['ChatInteraction'][_0xd281('0x123')](db[_0xd281('0x66')],{'as':_0xd281('0x167'),'onDelete':_0xd281('0x122'),'foreignKey':_0xd281('0x19f')});db[_0xd281('0x12a')]['belongsTo'](db[_0xd281('0x5f')],{'as':'Account','foreignKey':_0xd281('0x182')});db[_0xd281('0x12a')][_0xd281('0x15d')](db[_0xd281('0x71')],{'as':'Contact','foreignKey':_0xd281('0x16d')});db[_0xd281('0x12a')]['belongsTo'](db[_0xd281('0x12')],{'as':_0xd281('0x17b'),'foreignKey':_0xd281('0x11f')});db['ChatInteraction']['belongsToMany'](db[_0xd281('0x8f')],{'through':_0xd281('0x1a0'),'as':_0xd281('0x17d')});db[_0xd281('0x12a')]['belongsToMany'](db[_0xd281('0x8f')],{'through':'chat_interaction_has_tags','as':_0xd281('0x18b')});db[_0xd281('0x12a')][_0xd281('0x133')](db['User'],{'as':'Users','through':_0xd281('0x139'),'foreignKey':_0xd281('0x19f')});db[_0xd281('0x66')][_0xd281('0x15d')](db[_0xd281('0x12')],{'onDelete':_0xd281('0x122'),'as':_0xd281('0x12')});db[_0xd281('0x66')][_0xd281('0x15d')](db[_0xd281('0x71')],{'onDelete':'cascade','as':'Contact','foreignKey':'ContactId'});db[_0xd281('0x66')][_0xd281('0x15d')](db[_0xd281('0x12a')],{'onDelete':_0xd281('0x122'),'as':_0xd281('0x181'),'foreignKey':_0xd281('0x19f')});db[_0xd281('0x66')][_0xd281('0x15d')](db['Attachment'],{'as':'Attachment','foreignKey':_0xd281('0x199')});db[_0xd281('0x66')]['belongsTo'](db[_0xd281('0x5f')],{'as':_0xd281('0x17a'),'foreignKey':_0xd281('0x182')});db['ChatOfflineMessage'][_0xd281('0x123')](db[_0xd281('0xf5')],{'as':_0xd281('0x180'),'foreignKey':_0xd281('0x1a1'),'onDelete':_0xd281('0x122'),'hooks':!![]});db[_0xd281('0x183')]['belongsTo'](db[_0xd281('0x71')],{'onDelete':_0xd281('0x122'),'as':_0xd281('0x16c'),'foreignKey':_0xd281('0x16d')});db[_0xd281('0x183')][_0xd281('0x15d')](db[_0xd281('0x5f')],{'as':_0xd281('0x17a'),'foreignKey':_0xd281('0x182')});db[_0xd281('0x69')][_0xd281('0x133')](db['User'],{'as':_0xd281('0x163'),'through':'UserChatQueue','hooks':!![]});db['ChatQueue'][_0xd281('0x133')](db[_0xd281('0xed')],{'through':_0xd281('0x1a2'),'as':'Teams'});db['ChatGroup'][_0xd281('0x123')](db[_0xd281('0xd8')],{'as':_0xd281('0x167'),'foreignKey':_0xd281('0x1a3'),'onDelete':_0xd281('0x122')});db[_0xd281('0x6b')][_0xd281('0x133')](db[_0xd281('0x12')],{'as':'Members','through':'chat_group_has_users'});db[_0xd281('0x6d')]['belongsTo'](db[_0xd281('0x5f')],{'as':_0xd281('0x19e'),'foreignKey':_0xd281('0x182')});db[_0xd281('0x6f')]['hasMany'](db[_0xd281('0x71')],{'as':_0xd281('0x134'),'foreignKey':_0xd281('0x1a4')});db[_0xd281('0x71')][_0xd281('0x123')](db[_0xd281('0x93')],{'as':_0xd281('0x1a5'),'foreignKey':'CmContactId'});db[_0xd281('0x71')][_0xd281('0x123')](db[_0xd281('0x73')],{'as':'Hoppers','foreignKey':_0xd281('0x16d')});db[_0xd281('0x71')][_0xd281('0x123')](db[_0xd281('0x77')],{'as':'HopperFinals','foreignKey':_0xd281('0x16d')});db['CmContact']['hasMany'](db['CmHopperHistory'],{'as':_0xd281('0x1a6'),'foreignKey':_0xd281('0x16d')});db['CmContact'][_0xd281('0x123')](db[_0xd281('0x7a')],{'as':_0xd281('0x7a'),'foreignKey':_0xd281('0x16d')});db[_0xd281('0x71')][_0xd281('0x123')](db['JscriptySessionReport'],{'as':_0xd281('0x15c'),'foreignKey':'ContactId'});db['CmContact'][_0xd281('0x123')](db[_0xd281('0x5d')],{'as':_0xd281('0x13c'),'foreignKey':'ContactId','onDelete':_0xd281('0x170')});db[_0xd281('0x71')][_0xd281('0x123')](db[_0xd281('0x12a')],{'as':_0xd281('0x1a7'),'foreignKey':_0xd281('0x16d'),'onDelete':_0xd281('0x170')});db[_0xd281('0x71')][_0xd281('0x123')](db[_0xd281('0x54')],{'as':_0xd281('0x1a8'),'foreignKey':_0xd281('0x16d'),'onDelete':'restrict'});db[_0xd281('0x71')][_0xd281('0x123')](db[_0xd281('0x12b')],{'as':'FaxInteractions','foreignKey':_0xd281('0x16d'),'onDelete':_0xd281('0x170')});db['CmContact'][_0xd281('0x123')](db[_0xd281('0x3f')],{'as':_0xd281('0x12d'),'foreignKey':_0xd281('0x16d'),'onDelete':_0xd281('0x170')});db[_0xd281('0x71')][_0xd281('0x15d')](db['CmCompany'],{'as':_0xd281('0x1a9'),'foreignKey':'CompanyId'});db[_0xd281('0x71')]['belongsTo'](db[_0xd281('0x100')],{'as':_0xd281('0x185'),'foreignKey':_0xd281('0x177'),'onDelete':'cascade'});db[_0xd281('0x71')][_0xd281('0x133')](db['User'],{'as':'Users','through':_0xd281('0x1aa')});db[_0xd281('0x71')]['belongsToMany'](db['Tag'],{'as':_0xd281('0x17d'),'through':_0xd281('0x1ab')});db['CmContact'][_0xd281('0x133')](db[_0xd281('0x8f')],{'through':'cm_contact_has_tags','as':_0xd281('0x18b')});db[_0xd281('0x73')][_0xd281('0x123')](db[_0xd281('0x1ac')],{'as':'AdditionalPhones','foreignKey':'CmHopperId'});db[_0xd281('0x73')][_0xd281('0x15d')](db[_0xd281('0x71')],{'as':_0xd281('0x16c'),'foreignKey':_0xd281('0x16d'),'onDelete':_0xd281('0x122')});db[_0xd281('0x73')][_0xd281('0x15d')](db[_0xd281('0x100')],{'as':_0xd281('0x185'),'foreignKey':_0xd281('0x177'),'onDelete':_0xd281('0x122')});db[_0xd281('0x73')]['belongsTo'](db[_0xd281('0x12')],{'as':_0xd281('0x19b'),'foreignKey':_0xd281('0x11f')});db['CmHopper'][_0xd281('0x15d')](db[_0xd281('0x1a')],{'as':'Queue','foreignKey':'VoiceQueueId','onDelete':_0xd281('0x122')});db['CmHopper']['belongsTo'](db[_0xd281('0xf1')],{'as':'Campaign','foreignKey':_0xd281('0x1ad'),'onDelete':'cascade'});db[_0xd281('0x73')]['belongsTo'](db['User'],{'as':'Owner','foreignKey':'OwnerId'});db['CmHopperBlack'][_0xd281('0x15d')](db[_0xd281('0x71')],{'as':_0xd281('0x16c'),'foreignKey':_0xd281('0x16d'),'onDelete':'cascade'});db[_0xd281('0x75')]['belongsTo'](db[_0xd281('0x100')],{'as':'List','foreignKey':_0xd281('0x177'),'onDelete':_0xd281('0x122')});db[_0xd281('0x75')]['belongsTo'](db[_0xd281('0x1a')],{'as':_0xd281('0x19c'),'foreignKey':_0xd281('0x15a'),'onDelete':_0xd281('0x122')});db['CmHopperBlack'][_0xd281('0x15d')](db[_0xd281('0xf1')],{'as':'Campaign','foreignKey':'CampaignId','onDelete':_0xd281('0x122')});db[_0xd281('0x7f')]['hasMany'](db[_0xd281('0x84')],{'as':{'plural':_0xd281('0x1ae'),'singular':_0xd281('0x1af')},'foreignKey':_0xd281('0x1b0'),'onDelete':_0xd281('0x122'),'hooks':!![]});db['Automation'][_0xd281('0x123')](db['Condition'],{'as':{'plural':_0xd281('0x1b1'),'singular':_0xd281('0x1b2')},'foreignKey':'AutomationAnyId','onDelete':_0xd281('0x122'),'hooks':!![]});db[_0xd281('0x7f')]['hasMany'](db[_0xd281('0x7d')],{'as':'Actions','foreignKey':'AutomationId','onDelete':_0xd281('0x122'),'hooks':!![]});db[_0xd281('0x83')][_0xd281('0x123')](db[_0xd281('0x83')],{'as':'Dispositions','foreignKey':_0xd281('0x1b3'),'onDelete':_0xd281('0x122')});db[_0xd281('0x86')][_0xd281('0x123')](db[_0xd281('0x86')],{'as':_0xd281('0x1b4'),'foreignKey':_0xd281('0x160'),'onDelete':_0xd281('0x122'),'hooks':!![],'required':![]});db['Interval'][_0xd281('0x123')](db['VoiceExtension'],{'as':_0xd281('0x127'),'foreignKey':_0xd281('0x160'),'onDelete':_0xd281('0x170')});db[_0xd281('0x86')][_0xd281('0x123')](db[_0xd281('0x176')],{'as':'MailApplications','foreignKey':_0xd281('0x160')});db['Interval'][_0xd281('0x123')](db[_0xd281('0x63')],{'as':'ChatApplications','foreignKey':_0xd281('0x160')});db[_0xd281('0x86')][_0xd281('0x123')](db['FaxApplication'],{'as':'FaxApplications','foreignKey':_0xd281('0x160')});db[_0xd281('0x86')][_0xd281('0x123')](db['SmsApplication'],{'as':_0xd281('0x1b5'),'foreignKey':_0xd281('0x160')});db[_0xd281('0x1b6')][_0xd281('0x15d')](db[_0xd281('0x14d')],{});db['Schedule'][_0xd281('0x15d')](db['AnalyticDefaultReport'],{'foreignKey':_0xd281('0x1b7')});db['Schedule'][_0xd281('0x15d')](db[_0xd281('0x9f')],{'foreignKey':_0xd281('0x1b8')});db[_0xd281('0x8d')][_0xd281('0x133')](db[_0xd281('0x19')],{'as':_0xd281('0x1b9'),'through':_0xd281('0x157'),'onDelete':_0xd281('0x170')});db[_0xd281('0x8f')][_0xd281('0x133')](db['CmContact'],{'through':_0xd281('0x1ab')});db[_0xd281('0x8f')]['belongsToMany'](db[_0xd281('0x12a')],{'through':_0xd281('0x1a0')});db[_0xd281('0x8f')][_0xd281('0x133')](db[_0xd281('0x3f')],{'through':_0xd281('0x17c')});db[_0xd281('0x8f')]['belongsToMany'](db[_0xd281('0x54')],{'through':_0xd281('0x190')});db[_0xd281('0x8f')][_0xd281('0x133')](db[_0xd281('0x12b')],{'through':_0xd281('0x18a')});db[_0xd281('0x8f')][_0xd281('0x133')](db['OpenchannelInteraction'],{'through':_0xd281('0x197')});db[_0xd281('0x8f')][_0xd281('0x133')](db['WhatsappInteraction'],{'through':_0xd281('0x1ba')});db['CmContactHasItem'][_0xd281('0x15d')](db[_0xd281('0x91')],{'as':_0xd281('0x1bb'),'foreignKey':_0xd281('0x1bc')});db['CmHopperAdditionalPhone'][_0xd281('0x15d')](db['CmHopper'],{'as':'Hopper','foreignKey':_0xd281('0x1bd')});db['CmContactHasItem']['belongsTo'](db[_0xd281('0x71')],{'as':'Contact','foreignKey':'CmContactId'});db[_0xd281('0x97')][_0xd281('0x123')](db[_0xd281('0x84')],{'as':{'plural':_0xd281('0x1be'),'singular':_0xd281('0x1bf')},'foreignKey':_0xd281('0x1c0'),'onDelete':_0xd281('0x122'),'hooks':!![]});db[_0xd281('0x97')][_0xd281('0x123')](db[_0xd281('0x84')],{'as':{'plural':_0xd281('0x1c1'),'singular':_0xd281('0x1c2')},'foreignKey':'TriggerAnyId','onDelete':'cascade','hooks':!![]});db['Trigger']['hasMany'](db[_0xd281('0x7d')],{'as':_0xd281('0x1c3'),'foreignKey':_0xd281('0x1c4'),'onDelete':_0xd281('0x122'),'hooks':!![]});db['AnalyticCustomReport']['hasMany'](db[_0xd281('0xa6')],{'as':_0xd281('0x1c5'),'onDelete':_0xd281('0x122'),'foreignKey':_0xd281('0x1b8'),'hooks':!![]});db['AnalyticDefaultReport'][_0xd281('0x123')](db[_0xd281('0xa6')],{'as':_0xd281('0x1c5'),'onDelete':'cascade','foreignKey':_0xd281('0x1b7')});db[_0xd281('0xa5')]['hasMany'](db['AnalyticFieldReport'],{'as':_0xd281('0x1c5'),'onDelete':_0xd281('0x122'),'foreignKey':_0xd281('0x1c6')});db[_0xd281('0xa6')][_0xd281('0x15d')](db['AnalyticMetric'],{'foreignKey':_0xd281('0x1c6')});db[_0xd281('0x1c7')]['hasMany'](db['SalesforceConfiguration'],{'as':_0xd281('0x1c8'),'onDelete':'cascade','foreignKey':_0xd281('0x1c9')});db[_0xd281('0xab')][_0xd281('0x123')](db[_0xd281('0xad')],{'as':'Subjects','onDelete':_0xd281('0x122'),'foreignKey':_0xd281('0x1ca')});db[_0xd281('0xab')][_0xd281('0x123')](db[_0xd281('0xad')],{'as':'Descriptions','onDelete':_0xd281('0x122'),'foreignKey':'DescriptionId'});db[_0xd281('0xab')][_0xd281('0x123')](db[_0xd281('0xad')],{'as':_0xd281('0x1c5'),'onDelete':_0xd281('0x122'),'foreignKey':'FieldId'});db['SalesforceConfiguration']['belongsTo'](db['SalesforceAccount'],{'as':_0xd281('0x17a'),'foreignKey':_0xd281('0x1c9')});db['SalesforceField'][_0xd281('0x123')](db['SalesforceField'],{'as':_0xd281('0x1cb'),'foreignKey':_0xd281('0x1ca')});db[_0xd281('0xad')][_0xd281('0x123')](db['SalesforceField'],{'as':_0xd281('0x1cc'),'foreignKey':_0xd281('0x1cd')});db[_0xd281('0xad')][_0xd281('0x123')](db[_0xd281('0xad')],{'as':_0xd281('0x1ce'),'foreignKey':'FieldId'});db[_0xd281('0xad')][_0xd281('0x15d')](db[_0xd281('0x99')],{'as':_0xd281('0x99'),'foreignKey':_0xd281('0x1cf')});db[_0xd281('0xaf')][_0xd281('0x123')](db[_0xd281('0xb1')],{'as':'Configurations','onDelete':_0xd281('0x122'),'foreignKey':_0xd281('0x1c9')});db[_0xd281('0xb1')][_0xd281('0x123')](db['SugarcrmField'],{'as':_0xd281('0x1d0'),'onDelete':_0xd281('0x122'),'foreignKey':'SubjectId'});db[_0xd281('0xb1')][_0xd281('0x123')](db[_0xd281('0xb3')],{'as':_0xd281('0x1d1'),'onDelete':_0xd281('0x122'),'foreignKey':_0xd281('0x1cd')});db[_0xd281('0xb1')]['hasMany'](db[_0xd281('0xb3')],{'as':_0xd281('0x1c5'),'onDelete':_0xd281('0x122'),'foreignKey':_0xd281('0x1d2')});db['SugarcrmConfiguration']['belongsTo'](db[_0xd281('0xaf')],{'as':_0xd281('0x17a'),'foreignKey':_0xd281('0x1c9')});db[_0xd281('0xb3')][_0xd281('0x123')](db[_0xd281('0xb3')],{'as':'Subject','foreignKey':'SubjectId'});db[_0xd281('0xb3')]['hasMany'](db[_0xd281('0xb3')],{'as':_0xd281('0x1cc'),'foreignKey':_0xd281('0x1cd')});db[_0xd281('0xb3')]['hasMany'](db['SugarcrmField'],{'as':_0xd281('0x1ce'),'foreignKey':_0xd281('0x1d2')});db['SugarcrmField'][_0xd281('0x15d')](db['Variable'],{'as':_0xd281('0x99'),'foreignKey':_0xd281('0x1cf')});db['DeskAccount'][_0xd281('0x123')](db[_0xd281('0x1d3')],{'as':_0xd281('0x1c8'),'onDelete':_0xd281('0x122'),'foreignKey':_0xd281('0x1c9')});db[_0xd281('0x1d3')][_0xd281('0x123')](db[_0xd281('0x1d4')],{'as':_0xd281('0x1d0'),'onDelete':_0xd281('0x122'),'foreignKey':_0xd281('0x1ca')});db[_0xd281('0x1d3')][_0xd281('0x123')](db[_0xd281('0x1d4')],{'as':_0xd281('0x1d1'),'onDelete':_0xd281('0x122'),'foreignKey':_0xd281('0x1cd')});db['DeskConfiguration'][_0xd281('0x123')](db[_0xd281('0x1d4')],{'as':'Fields','onDelete':_0xd281('0x122'),'foreignKey':_0xd281('0x1d2')});db[_0xd281('0x1d3')]['belongsTo'](db[_0xd281('0xb4')],{'as':_0xd281('0x17a'),'foreignKey':'AccountId'});db[_0xd281('0x1d3')][_0xd281('0x133')](db[_0xd281('0x8f')],{'through':_0xd281('0x1d5')});db['DeskField'][_0xd281('0x123')](db[_0xd281('0x1d4')],{'as':_0xd281('0x1cb'),'foreignKey':_0xd281('0x1ca')});db[_0xd281('0x1d4')][_0xd281('0x123')](db[_0xd281('0x1d4')],{'as':_0xd281('0x1cc'),'foreignKey':_0xd281('0x1cd')});db['DeskField'][_0xd281('0x123')](db['DeskField'],{'as':'Field','foreignKey':'FieldId'});db[_0xd281('0x1d4')][_0xd281('0x15d')](db[_0xd281('0x99')],{'as':_0xd281('0x99'),'foreignKey':_0xd281('0x1cf')});db[_0xd281('0xb7')][_0xd281('0x123')](db['ZohoConfiguration'],{'as':_0xd281('0x1c8'),'onDelete':_0xd281('0x122'),'foreignKey':_0xd281('0x1c9')});db['ZohoConfiguration']['hasMany'](db['ZohoField'],{'as':_0xd281('0x1d0'),'onDelete':_0xd281('0x122'),'foreignKey':_0xd281('0x1ca')});db[_0xd281('0x1d6')]['hasMany'](db['ZohoField'],{'as':_0xd281('0x1d1'),'onDelete':_0xd281('0x122'),'foreignKey':_0xd281('0x1cd')});db[_0xd281('0x1d6')][_0xd281('0x123')](db[_0xd281('0xba')],{'as':'Fields','onDelete':_0xd281('0x122'),'foreignKey':'FieldId'});db[_0xd281('0x1d6')]['belongsTo'](db['ZohoAccount'],{'as':_0xd281('0x17a'),'foreignKey':_0xd281('0x1c9')});db[_0xd281('0xba')][_0xd281('0x123')](db[_0xd281('0xba')],{'as':_0xd281('0x1cb'),'foreignKey':'SubjectId'});db[_0xd281('0xba')][_0xd281('0x123')](db['ZohoField'],{'as':_0xd281('0x1cc'),'foreignKey':_0xd281('0x1cd')});db[_0xd281('0xba')][_0xd281('0x123')](db[_0xd281('0xba')],{'as':_0xd281('0x1ce'),'foreignKey':_0xd281('0x1d2')});db[_0xd281('0xba')][_0xd281('0x15d')](db[_0xd281('0x99')],{'as':_0xd281('0x99'),'foreignKey':_0xd281('0x1cf')});db[_0xd281('0x1d7')][_0xd281('0x123')](db[_0xd281('0xbc')],{'as':'Configurations','onDelete':_0xd281('0x122'),'foreignKey':_0xd281('0x1c9')});db[_0xd281('0xbc')][_0xd281('0x123')](db[_0xd281('0xbd')],{'as':_0xd281('0x1d0'),'foreignKey':_0xd281('0x1ca')});db[_0xd281('0xbc')][_0xd281('0x123')](db[_0xd281('0xbd')],{'as':_0xd281('0x1d1'),'foreignKey':_0xd281('0x1cd')});db[_0xd281('0xbc')]['hasMany'](db[_0xd281('0xbd')],{'as':_0xd281('0x1c5'),'foreignKey':_0xd281('0x1d2')});db[_0xd281('0xbc')][_0xd281('0x15d')](db[_0xd281('0x1d7')],{'as':'Account','foreignKey':_0xd281('0x1c9')});db[_0xd281('0xbc')]['belongsToMany'](db[_0xd281('0x8f')],{'through':_0xd281('0x1d8')});db['ZendeskField'][_0xd281('0x123')](db[_0xd281('0xbd')],{'as':_0xd281('0x1cb'),'foreignKey':'SubjectId'});db['ZendeskField']['hasMany'](db[_0xd281('0xbd')],{'as':'Description','foreignKey':_0xd281('0x1cd')});db[_0xd281('0xbd')][_0xd281('0x123')](db[_0xd281('0xbd')],{'as':_0xd281('0x1ce'),'foreignKey':_0xd281('0x1d2')});db[_0xd281('0xbd')][_0xd281('0x15d')](db[_0xd281('0x99')],{'as':_0xd281('0x99'),'foreignKey':_0xd281('0x1cf')});db['FreshdeskAccount'][_0xd281('0x123')](db[_0xd281('0xbf')],{'as':_0xd281('0x1c8'),'onDelete':_0xd281('0x122'),'foreignKey':_0xd281('0x1c9')});db['FreshdeskConfiguration']['hasMany'](db[_0xd281('0x1d9')],{'as':_0xd281('0x1d0'),'onDelete':'cascade','foreignKey':_0xd281('0x1ca')});db[_0xd281('0xbf')][_0xd281('0x123')](db[_0xd281('0x1d9')],{'as':_0xd281('0x1d1'),'onDelete':_0xd281('0x122'),'foreignKey':_0xd281('0x1cd')});db[_0xd281('0xbf')]['hasMany'](db[_0xd281('0x1d9')],{'as':_0xd281('0x1c5'),'onDelete':_0xd281('0x122'),'foreignKey':'FieldId'});db['FreshdeskConfiguration'][_0xd281('0x15d')](db[_0xd281('0x1da')],{'as':_0xd281('0x17a'),'foreignKey':_0xd281('0x1c9')});db['FreshdeskConfiguration']['belongsToMany'](db[_0xd281('0x8f')],{'through':_0xd281('0x1db')});db[_0xd281('0x1d9')]['hasMany'](db[_0xd281('0x1d9')],{'as':_0xd281('0x1cb'),'foreignKey':'SubjectId'});db[_0xd281('0x1d9')][_0xd281('0x123')](db[_0xd281('0x1d9')],{'as':_0xd281('0x1cc'),'foreignKey':'DescriptionId'});db[_0xd281('0x1d9')][_0xd281('0x123')](db[_0xd281('0x1d9')],{'as':_0xd281('0x1ce'),'foreignKey':'FieldId'});db[_0xd281('0x1d9')][_0xd281('0x15d')](db[_0xd281('0x99')],{'as':_0xd281('0x99'),'foreignKey':_0xd281('0x1cf')});db[_0xd281('0xc2')][_0xd281('0x123')](db[_0xd281('0xc4')],{'as':'Configurations','onDelete':_0xd281('0x122'),'foreignKey':'AccountId'});db[_0xd281('0xc4')][_0xd281('0x123')](db[_0xd281('0xc6')],{'as':_0xd281('0x1d0'),'foreignKey':_0xd281('0x1ca')});db[_0xd281('0xc4')]['hasMany'](db[_0xd281('0xc6')],{'as':_0xd281('0x1d1'),'foreignKey':_0xd281('0x1cd')});db[_0xd281('0xc4')][_0xd281('0x123')](db['VtigerField'],{'as':'Fields','foreignKey':_0xd281('0x1d2')});db[_0xd281('0xc4')][_0xd281('0x15d')](db[_0xd281('0xc2')],{'as':_0xd281('0x17a'),'foreignKey':_0xd281('0x1c9')});db[_0xd281('0xc6')][_0xd281('0x123')](db[_0xd281('0xc6')],{'as':_0xd281('0x1cb'),'foreignKey':_0xd281('0x1ca')});db[_0xd281('0xc6')][_0xd281('0x123')](db[_0xd281('0xc6')],{'as':_0xd281('0x1cc'),'foreignKey':'DescriptionId'});db[_0xd281('0xc6')][_0xd281('0x123')](db[_0xd281('0xc6')],{'as':_0xd281('0x1ce'),'foreignKey':_0xd281('0x1d2')});db[_0xd281('0xc6')][_0xd281('0x15d')](db[_0xd281('0x99')],{'as':_0xd281('0x99'),'foreignKey':_0xd281('0x1cf')});db[_0xd281('0xc8')]['hasMany'](db[_0xd281('0x1dc')],{'as':_0xd281('0x1c8'),'onDelete':_0xd281('0x122'),'foreignKey':_0xd281('0x1c9')});db[_0xd281('0x1dc')][_0xd281('0x123')](db[_0xd281('0xcb')],{'as':'Subjects','foreignKey':'SubjectId'});db['ServicenowConfiguration'][_0xd281('0x123')](db['ServicenowField'],{'as':_0xd281('0x1d1'),'foreignKey':_0xd281('0x1cd')});db[_0xd281('0x1dc')]['hasMany'](db['ServicenowField'],{'as':_0xd281('0x1c5'),'foreignKey':_0xd281('0x1d2')});db[_0xd281('0x1dc')][_0xd281('0x15d')](db['ServicenowAccount'],{'as':'Account','foreignKey':_0xd281('0x1c9')});db['ServicenowField']['hasMany'](db[_0xd281('0xcb')],{'as':_0xd281('0x1cb'),'foreignKey':_0xd281('0x1ca')});db['ServicenowField'][_0xd281('0x123')](db[_0xd281('0xcb')],{'as':_0xd281('0x1cc'),'foreignKey':_0xd281('0x1cd')});db[_0xd281('0xcb')]['hasMany'](db[_0xd281('0xcb')],{'as':_0xd281('0x1ce'),'foreignKey':_0xd281('0x1d2')});db[_0xd281('0xcb')][_0xd281('0x15d')](db[_0xd281('0x99')],{'as':_0xd281('0x99'),'foreignKey':_0xd281('0x1cf')});db[_0xd281('0xcd')]['hasMany'](db[_0xd281('0xcf')],{'as':'Configurations','onDelete':_0xd281('0x122'),'foreignKey':'AccountId'});db[_0xd281('0xcd')][_0xd281('0x15d')](db['CloudProvider'],{'as':_0xd281('0x116'),'foreignKey':_0xd281('0x16f')});db[_0xd281('0xcf')][_0xd281('0x123')](db[_0xd281('0xd0')],{'as':_0xd281('0x1d0'),'onDelete':_0xd281('0x122'),'foreignKey':_0xd281('0x1ca')});db['Dynamics365Configuration']['hasMany'](db[_0xd281('0xd0')],{'as':_0xd281('0x1d1'),'onDelete':_0xd281('0x122'),'foreignKey':_0xd281('0x1cd')});db[_0xd281('0xcf')][_0xd281('0x123')](db[_0xd281('0xd0')],{'as':'Fields','onDelete':_0xd281('0x122'),'foreignKey':_0xd281('0x1d2')});db[_0xd281('0xcf')][_0xd281('0x15d')](db[_0xd281('0xcd')],{'as':_0xd281('0x17a'),'foreignKey':_0xd281('0x1c9')});db[_0xd281('0xd0')][_0xd281('0x123')](db[_0xd281('0xd0')],{'as':'Subject','foreignKey':_0xd281('0x1ca')});db['Dynamics365Field'][_0xd281('0x123')](db[_0xd281('0xd0')],{'as':_0xd281('0x1cc'),'foreignKey':'DescriptionId'});db['Dynamics365Field'][_0xd281('0x123')](db['Dynamics365Field'],{'as':_0xd281('0x1ce'),'foreignKey':_0xd281('0x1d2')});db[_0xd281('0xd0')][_0xd281('0x15d')](db[_0xd281('0x99')],{'as':_0xd281('0x99'),'foreignKey':'VariableId'});db[_0xd281('0xd1')][_0xd281('0x123')](db[_0xd281('0x1dd')],{'as':_0xd281('0x1c8'),'onDelete':_0xd281('0x122'),'foreignKey':_0xd281('0x1c9')});db[_0xd281('0x1dd')]['hasMany'](db[_0xd281('0xd4')],{'as':_0xd281('0x1d0'),'foreignKey':_0xd281('0x1ca')});db['FreshsalesConfiguration']['hasMany'](db['FreshsalesField'],{'as':'Descriptions','foreignKey':_0xd281('0x1cd')});db[_0xd281('0x1dd')][_0xd281('0x123')](db[_0xd281('0xd4')],{'as':_0xd281('0x1c5'),'foreignKey':'FieldId'});db['FreshsalesConfiguration'][_0xd281('0x15d')](db[_0xd281('0xd1')],{'as':_0xd281('0x17a'),'foreignKey':_0xd281('0x1c9')});db['FreshsalesField'][_0xd281('0x123')](db['FreshsalesField'],{'as':_0xd281('0x1cb'),'foreignKey':_0xd281('0x1ca')});db['FreshsalesField']['hasMany'](db[_0xd281('0xd4')],{'as':_0xd281('0x1cc'),'foreignKey':_0xd281('0x1cd')});db[_0xd281('0xd4')][_0xd281('0x123')](db[_0xd281('0xd4')],{'as':_0xd281('0x1ce'),'foreignKey':_0xd281('0x1d2')});db[_0xd281('0xd4')]['belongsTo'](db['Variable'],{'as':_0xd281('0x99'),'foreignKey':_0xd281('0x1cf')});db[_0xd281('0x1de')][_0xd281('0x15d')](db[_0xd281('0x5f')],{});db[_0xd281('0x1de')][_0xd281('0x15d')](db['CmList'],{'as':_0xd281('0x185'),'foreignKey':_0xd281('0x177')});db[_0xd281('0x1de')][_0xd281('0x15d')](db[_0xd281('0x71')],{'as':_0xd281('0x16c'),'foreignKey':_0xd281('0x16d')});db[_0xd281('0x1de')][_0xd281('0x15d')](db[_0xd281('0x12a')],{});db['ChatQueueReport'][_0xd281('0x15d')](db['ChatMessage'],{});db[_0xd281('0x1de')][_0xd281('0x15d')](db['User'],{});db[_0xd281('0x1de')]['belongsTo'](db[_0xd281('0x69')],{});db[_0xd281('0xd8')]['belongsTo'](db[_0xd281('0x12')],{'onDelete':_0xd281('0x122'),'foreignKey':_0xd281('0x1df')});db[_0xd281('0xd8')][_0xd281('0x15d')](db[_0xd281('0x12')],{'onDelete':_0xd281('0x122'),'foreignKey':_0xd281('0x1e0')});db['JscriptySessionReport'][_0xd281('0x123')](db[_0xd281('0xdc')],{'foreignKey':_0xd281('0x1e1'),'onDelete':_0xd281('0x122')});db['JscriptySessionReport'][_0xd281('0x123')](db[_0xd281('0xda')],{'foreignKey':_0xd281('0x1e1'),'onDelete':_0xd281('0x122')});db['SmsQueueReport'][_0xd281('0x15d')](db[_0xd281('0x51')],{});db['SmsQueueReport'][_0xd281('0x15d')](db[_0xd281('0x100')],{'as':'List','foreignKey':'ListId'});db[_0xd281('0xde')][_0xd281('0x15d')](db[_0xd281('0x71')],{'as':_0xd281('0x16c'),'foreignKey':_0xd281('0x16d')});db[_0xd281('0xde')][_0xd281('0x15d')](db['SmsInteraction'],{});db[_0xd281('0xde')]['belongsTo'](db[_0xd281('0x56')],{});db['SmsQueueReport']['belongsTo'](db[_0xd281('0x12')],{});db[_0xd281('0xde')][_0xd281('0x15d')](db['SmsQueue'],{});db[_0xd281('0xe2')][_0xd281('0x123')](db[_0xd281('0xdd')],{'foreignKey':_0xd281('0x1e2')});db[_0xd281('0xe2')]['hasMany'](db[_0xd281('0xdc')],{'foreignKey':_0xd281('0x1e2')});db[_0xd281('0xe2')][_0xd281('0x123')](db[_0xd281('0xda')],{'foreignKey':_0xd281('0x1e2')});db[_0xd281('0xed')][_0xd281('0x133')](db[_0xd281('0x12')],{'as':_0xd281('0x163'),'through':'user_has_teams'});db[_0xd281('0xed')][_0xd281('0x133')](db[_0xd281('0x1a')],{'through':_0xd281('0x118'),'as':_0xd281('0x13f')});db['Team']['belongsToMany'](db[_0xd281('0x3b')],{'through':_0xd281('0x1e3'),'as':'MailQueues'});db[_0xd281('0xed')][_0xd281('0x133')](db[_0xd281('0x69')],{'through':'team_has_chat_queues','as':_0xd281('0x143')});db['Team']['belongsToMany'](db[_0xd281('0x4d')],{'through':'team_has_fax_queues','as':_0xd281('0x1e4')});db[_0xd281('0xed')]['belongsToMany'](db['SmsQueue'],{'through':_0xd281('0x1e5'),'as':'SmsQueues'});db[_0xd281('0xed')][_0xd281('0x133')](db[_0xd281('0x5e')],{'through':_0xd281('0x1e6'),'as':_0xd281('0x145')});db[_0xd281('0xed')][_0xd281('0x133')](db['WhatsappQueue'],{'through':_0xd281('0x1e7'),'as':_0xd281('0x147')});db[_0xd281('0xed')][_0xd281('0x133')](db[_0xd281('0x1e8')],{'through':_0xd281('0x119'),'as':_0xd281('0x141')});db[_0xd281('0xf1')]['hasMany'](db[_0xd281('0x73')],{'as':'Hoppers','foreignKey':'CampaignId'});db[_0xd281('0xf1')]['hasMany'](db['CmHopperFinal'],{'as':'HopperFinals','foreignKey':_0xd281('0x1ad')});db[_0xd281('0xf1')][_0xd281('0x123')](db[_0xd281('0x78')],{'as':_0xd281('0x1a6'),'foreignKey':_0xd281('0x1ad')});db[_0xd281('0xf1')][_0xd281('0x123')](db[_0xd281('0x75')],{'as':_0xd281('0x15b'),'foreignKey':_0xd281('0x1ad')});db[_0xd281('0xf1')][_0xd281('0x15d')](db[_0xd281('0x29')],{'as':'Trunk','foreignKey':'TrunkId'});db[_0xd281('0xf1')][_0xd281('0x15d')](db[_0xd281('0x29')],{'as':_0xd281('0x15e'),'foreignKey':_0xd281('0x15f')});db[_0xd281('0xf1')][_0xd281('0x15d')](db[_0xd281('0x86')],{'as':_0xd281('0x86'),'foreignKey':_0xd281('0x160')});db[_0xd281('0xf1')]['belongsTo'](db[_0xd281('0x1e9')],{'as':_0xd281('0x1e9'),'foreignKey':_0xd281('0x1ea')});db['Campaign'][_0xd281('0x133')](db['CmList'],{'as':_0xd281('0x135'),'through':'campaigns_has_cm_lists'});db['Campaign'][_0xd281('0x133')](db[_0xd281('0x100')],{'as':_0xd281('0x165'),'through':'campaigns_has_cm_blacklists'});db[_0xd281('0xf5')][_0xd281('0x15d')](db[_0xd281('0x183')],{'as':_0xd281('0x183'),'foreignKey':_0xd281('0x1a1')});db[_0xd281('0xf8')][_0xd281('0x15d')](db[_0xd281('0x40')],{});db[_0xd281('0xf8')]['belongsTo'](db[_0xd281('0x3f')],{});db[_0xd281('0xf8')]['belongsTo'](db['MailAccount'],{'foreignKey':_0xd281('0x1eb'),'as':_0xd281('0x1ec')});db[_0xd281('0xf8')]['belongsTo'](db['User'],{'foreignKey':_0xd281('0x1ed'),'as':_0xd281('0x1ee')});db['MailTransferReport'][_0xd281('0x15d')](db[_0xd281('0x12')],{'foreignKey':'ToUserId','as':_0xd281('0x1ef')});db[_0xd281('0xf8')][_0xd281('0x15d')](db['MailQueue'],{'foreignKey':'ToMailQueueId','as':_0xd281('0x1f0')});db['MailTransferReport'][_0xd281('0x15d')](db[_0xd281('0x14d')],{'foreignKey':_0xd281('0x1f1'),'as':'ToAccount'});db[_0xd281('0x1f2')][_0xd281('0x15d')](db[_0xd281('0x66')],{});db['ChatTransferReport'][_0xd281('0x15d')](db['ChatInteraction'],{});db['ChatTransferReport'][_0xd281('0x15d')](db[_0xd281('0x5f')],{'foreignKey':'FromChatWebsiteId','as':_0xd281('0x1ec')});db[_0xd281('0x1f2')][_0xd281('0x15d')](db[_0xd281('0x12')],{'foreignKey':_0xd281('0x1ed'),'as':_0xd281('0x1ee')});db[_0xd281('0x1f2')]['belongsTo'](db['User'],{'foreignKey':_0xd281('0x1f3'),'as':_0xd281('0x1ef')});db[_0xd281('0x1f2')][_0xd281('0x15d')](db[_0xd281('0x69')],{'foreignKey':_0xd281('0x1f4'),'as':'ToQueue'});db['ChatTransferReport'][_0xd281('0x15d')](db[_0xd281('0x5f')],{'foreignKey':_0xd281('0x1f5'),'as':_0xd281('0x1f6')});db[_0xd281('0x1f7')]['belongsTo'](db[_0xd281('0x4b')],{});db['FaxTransferReport'][_0xd281('0x15d')](db['FaxInteraction'],{});db[_0xd281('0x1f7')][_0xd281('0x15d')](db[_0xd281('0x47')],{'foreignKey':_0xd281('0x1f8'),'as':'FromAccount'});db[_0xd281('0x1f7')][_0xd281('0x15d')](db[_0xd281('0x12')],{'foreignKey':_0xd281('0x1ed'),'as':'FromAgent'});db['FaxTransferReport'][_0xd281('0x15d')](db[_0xd281('0x12')],{'foreignKey':_0xd281('0x1f3'),'as':_0xd281('0x1ef')});db['FaxTransferReport'][_0xd281('0x15d')](db[_0xd281('0x4d')],{'foreignKey':'ToFaxQueueId','as':_0xd281('0x1f0')});db['FaxTransferReport']['belongsTo'](db[_0xd281('0x47')],{'foreignKey':_0xd281('0x1f9'),'as':_0xd281('0x1f6')});db[_0xd281('0xfc')]['belongsTo'](db[_0xd281('0x194')],{});db['OpenchannelTransferReport'][_0xd281('0x15d')](db[_0xd281('0x5d')],{});db[_0xd281('0xfc')]['belongsTo'](db['OpenchannelAccount'],{'foreignKey':_0xd281('0x1fa'),'as':_0xd281('0x1ec')});db['OpenchannelTransferReport'][_0xd281('0x15d')](db[_0xd281('0x12')],{'foreignKey':_0xd281('0x1ed'),'as':_0xd281('0x1ee')});db[_0xd281('0xfc')][_0xd281('0x15d')](db['User'],{'foreignKey':_0xd281('0x1f3'),'as':_0xd281('0x1ef')});db[_0xd281('0xfc')]['belongsTo'](db[_0xd281('0x5e')],{'foreignKey':_0xd281('0x1fb'),'as':_0xd281('0x1f0')});db[_0xd281('0xfc')][_0xd281('0x15d')](db[_0xd281('0x14f')],{'foreignKey':_0xd281('0x1fc'),'as':'ToAccount'});db['SmsTransferReport'][_0xd281('0x15d')](db[_0xd281('0x56')],{});db[_0xd281('0xfe')][_0xd281('0x15d')](db['SmsInteraction'],{});db[_0xd281('0xfe')][_0xd281('0x15d')](db[_0xd281('0x51')],{'foreignKey':_0xd281('0x1fd'),'as':_0xd281('0x1ec')});db[_0xd281('0xfe')]['belongsTo'](db[_0xd281('0x12')],{'foreignKey':_0xd281('0x1ed'),'as':'FromAgent'});db[_0xd281('0xfe')]['belongsTo'](db[_0xd281('0x12')],{'foreignKey':_0xd281('0x1f3'),'as':_0xd281('0x1ef')});db['SmsTransferReport']['belongsTo'](db[_0xd281('0x58')],{'foreignKey':'ToSmsQueueId','as':_0xd281('0x1f0')});db[_0xd281('0xfe')][_0xd281('0x15d')](db[_0xd281('0x51')],{'foreignKey':'ToSmsAccountId','as':_0xd281('0x1f6')});db[_0xd281('0x100')][_0xd281('0x123')](db[_0xd281('0x83')],{'as':_0xd281('0x173'),'foreignKey':_0xd281('0x177'),'onDelete':_0xd281('0x122')});db[_0xd281('0x100')][_0xd281('0x123')](db['CmCustomField'],{'as':_0xd281('0x1fe'),'foreignKey':_0xd281('0x177')});db[_0xd281('0x100')]['hasMany'](db[_0xd281('0x71')],{'as':_0xd281('0x134'),'onDelete':_0xd281('0x122'),'foreignKey':_0xd281('0x177')});db[_0xd281('0x100')]['hasMany'](db[_0xd281('0x77')],{'as':_0xd281('0x128'),'foreignKey':'ListId'});db['CmList'][_0xd281('0x123')](db[_0xd281('0x78')],{'as':_0xd281('0x129'),'foreignKey':_0xd281('0x177')});db[_0xd281('0x100')][_0xd281('0x123')](db['ReportAgentPreview'],{'as':'ReportAgentPreview','foreignKey':'ListId'});db[_0xd281('0x100')][_0xd281('0x133')](db[_0xd281('0x1a')],{'as':_0xd281('0x1ff'),'through':_0xd281('0x162')});db['CmList']['belongsToMany'](db[_0xd281('0x12')],{'as':_0xd281('0x163'),'through':_0xd281('0x136')});db[_0xd281('0x1e8')][_0xd281('0x123')](db['VoiceExtension'],{'as':_0xd281('0x127'),'onDelete':_0xd281('0x122')});db['VoicePrefix'][_0xd281('0x133')](db[_0xd281('0x12')],{'as':_0xd281('0x163'),'through':_0xd281('0x11b')});db[_0xd281('0x1e8')][_0xd281('0x133')](db[_0xd281('0xed')],{'through':_0xd281('0x119'),'as':_0xd281('0x164')});db[_0xd281('0x103')]['hasMany'](db[_0xd281('0x12')],{'as':_0xd281('0x17e'),'foreignKey':_0xd281('0x200')});db[_0xd281('0x103')][_0xd281('0x123')](db[_0xd281('0x105')],{'as':'UserProfileSections','foreignKey':_0xd281('0x200'),'onDelete':_0xd281('0x122')});db[_0xd281('0x105')][_0xd281('0x123')](db[_0xd281('0x107')],{'as':_0xd281('0x201'),'foreignKey':_0xd281('0x202'),'onDelete':_0xd281('0x122')});db[_0xd281('0x10a')][_0xd281('0x123')](db[_0xd281('0x83')],{'as':_0xd281('0x173'),'foreignKey':'WhatsappAccountId','onDelete':_0xd281('0x122')});db[_0xd281('0x10a')][_0xd281('0x123')](db[_0xd281('0x81')],{'as':_0xd281('0x174'),'foreignKey':'WhatsappAccountId'});db[_0xd281('0x10a')][_0xd281('0x123')](db[_0xd281('0x203')],{'as':'Messages','foreignKey':_0xd281('0x204')});db[_0xd281('0x10a')][_0xd281('0x123')](db['WhatsappInteraction'],{'as':'Interactions'});db['WhatsappAccount'][_0xd281('0x123')](db[_0xd281('0x10c')],{'as':_0xd281('0x155'),'foreignKey':_0xd281('0x204'),'onDelete':_0xd281('0x122')});db['WhatsappAccount']['belongsTo'](db['CmList'],{'as':_0xd281('0x185'),'foreignKey':_0xd281('0x177')});db['WhatsappAccount'][_0xd281('0x15d')](db[_0xd281('0x161')],{'as':_0xd281('0x178'),'foreignKey':_0xd281('0x188')});db[_0xd281('0x10a')][_0xd281('0x133')](db[_0xd281('0x12')],{'as':'Agents','through':_0xd281('0x153')});db[_0xd281('0x10c')][_0xd281('0x15d')](db[_0xd281('0x12')],{'onDelete':'restrict'});db[_0xd281('0x10c')][_0xd281('0x15d')](db[_0xd281('0x146')],{'onDelete':_0xd281('0x170')});db[_0xd281('0x10c')][_0xd281('0x15d')](db[_0xd281('0x10a')],{'onDelete':_0xd281('0x170')});db['WhatsappApplication'][_0xd281('0x15d')](db[_0xd281('0x86')],{'onDelete':'restrict','foreignKey':_0xd281('0x160')});db[_0xd281('0x10c')][_0xd281('0x15d')](db['Tag'],{'onDelete':_0xd281('0x170'),'foreignKey':_0xd281('0x189')});db[_0xd281('0x10e')][_0xd281('0x123')](db[_0xd281('0x203')],{'as':'Messages','onDelete':_0xd281('0x122'),'foreignKey':'WhatsappInteractionId'});db[_0xd281('0x10e')][_0xd281('0x15d')](db['WhatsappAccount'],{'as':_0xd281('0x17a'),'foreignKey':_0xd281('0x204')});db[_0xd281('0x10e')][_0xd281('0x15d')](db[_0xd281('0x71')],{'as':_0xd281('0x16c'),'foreignKey':_0xd281('0x16d')});db['WhatsappInteraction'][_0xd281('0x15d')](db[_0xd281('0x12')],{'as':_0xd281('0x17b'),'foreignKey':_0xd281('0x11f')});db[_0xd281('0x10e')][_0xd281('0x133')](db[_0xd281('0x8f')],{'through':'whatsapp_interaction_has_tags','as':_0xd281('0x17d')});db[_0xd281('0x10e')]['belongsToMany'](db[_0xd281('0x8f')],{'through':_0xd281('0x1ba'),'as':'ThroughTags'});db[_0xd281('0x10e')][_0xd281('0x133')](db[_0xd281('0x12')],{'as':_0xd281('0x17e'),'through':_0xd281('0x13e'),'foreignKey':_0xd281('0x205')});db[_0xd281('0x203')][_0xd281('0x15d')](db[_0xd281('0x12')],{'as':_0xd281('0x12')});db[_0xd281('0x203')]['belongsTo'](db['CmContact'],{'onDelete':_0xd281('0x122'),'as':_0xd281('0x16c')});db[_0xd281('0x203')]['belongsTo'](db[_0xd281('0x10e')],{'onDelete':_0xd281('0x122'),'as':_0xd281('0x181'),'foreignKey':_0xd281('0x205')});db[_0xd281('0x203')][_0xd281('0x15d')](db[_0xd281('0x10a')],{'as':'Account','foreignKey':_0xd281('0x204')});db['WhatsappQueueReport'][_0xd281('0x15d')](db[_0xd281('0x10a')],{});db[_0xd281('0x111')][_0xd281('0x15d')](db['CmList'],{'as':_0xd281('0x185'),'foreignKey':_0xd281('0x177')});db[_0xd281('0x111')][_0xd281('0x15d')](db[_0xd281('0x71')],{'as':_0xd281('0x16c'),'foreignKey':_0xd281('0x16d')});db[_0xd281('0x111')][_0xd281('0x15d')](db[_0xd281('0x10e')],{});db[_0xd281('0x111')][_0xd281('0x15d')](db['WhatsappQueue'],{});db[_0xd281('0x111')][_0xd281('0x15d')](db[_0xd281('0x203')],{});db[_0xd281('0x111')][_0xd281('0x15d')](db[_0xd281('0x12')],{});db[_0xd281('0x113')][_0xd281('0x15d')](db['WhatsappMessage'],{});db[_0xd281('0x113')]['belongsTo'](db['WhatsappInteraction'],{});db['WhatsappTransferReport'][_0xd281('0x15d')](db['WhatsappAccount'],{'foreignKey':_0xd281('0x206'),'as':_0xd281('0x1ec')});db['WhatsappTransferReport']['belongsTo'](db['WhatsappAccount'],{'foreignKey':_0xd281('0x207'),'as':_0xd281('0x1f6')});db[_0xd281('0x113')][_0xd281('0x15d')](db[_0xd281('0x146')],{'foreignKey':_0xd281('0x208'),'as':'ToQueue'});db[_0xd281('0x113')][_0xd281('0x15d')](db[_0xd281('0x12')],{'foreignKey':_0xd281('0x1ed'),'as':_0xd281('0x1ee')});db[_0xd281('0x113')]['belongsTo'](db[_0xd281('0x12')],{'foreignKey':_0xd281('0x1f3'),'as':_0xd281('0x1ef')});db[_0xd281('0x146')][_0xd281('0x133')](db[_0xd281('0x12')],{'as':_0xd281('0x163'),'through':'UserWhatsappQueue','foreignKey':'WhatsappQueueId'});db[_0xd281('0x146')][_0xd281('0x133')](db[_0xd281('0xed')],{'through':_0xd281('0x1e7'),'as':'Teams'});db[_0xd281('0x121')]['belongsTo'](db[_0xd281('0x12')],{'as':_0xd281('0x209'),'foreignKey':_0xd281('0x11f'),'onDelete':_0xd281('0x122'),'hooks':!![]});db[_0xd281('0x116')][_0xd281('0x120')](db[_0xd281('0xcd')],{'as':_0xd281('0xcd'),'onDelete':_0xd281('0x170')});db[_0xd281('0x116')]['hasOne'](db[_0xd281('0x37')],{'as':_0xd281('0x171'),'onDelete':_0xd281('0x170')});db['CloudProvider'][_0xd281('0x120')](db['MailServerOut'],{'as':_0xd281('0x172'),'onDelete':_0xd281('0x170')});module[_0xd281('0x20a')]={'db':db,'dbH':dbH}; \ No newline at end of file +var _0x1b55=['UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','UserSmsQueue','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailServerOut/mailServerOut.model','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','MailMessage','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboard/dashboard.model','../api/dashboardItem/dashboardItem.model','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','../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/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','ChatWebsite','OpenchannelQueueReport','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','../api/chatProactiveAction/chatProactiveAction.model','../api/cmCompany/cmCompany.model','CmContact','CmHopper','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','CmHopperHistory','ReportAgentPreview','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/interval/interval.model','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','Sound','../api/sound/sound.model','Tag','ContactItemType','../api/contactItemType/contactItemType.model','CmContactHasItem','CmHopperAdditionalPhone','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model','../api/template/template.model','Trigger','Variable','Integration','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','FreshsalesConfiguration','../api/intFreshsalesField/intFreshsalesField.model','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','JscriptySessionReport','SquareReport','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','Setting','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','License','../api/license/license.model','Campaign','../api/campaign/campaign.model','Migration','../api/migration/migration.model','../api/attachment/attachment.model','../api/plugin/plugin.model','../api/mailTransferReport/mailTransferReport.model','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','../api/userProfileResource/userProfileResource.model','UserNotification','../api/userNotification/userNotification.model','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','../api/userVoicePrefix/userVoicePrefix.model','UserSetting','../api/user-setting/user-setting.model','../api/mailInteractionHasTag/mailInteractionHasTag.model','hasOne','userSetting','cascade','UserId','hasMany','Recordings','VoiceQueuesRt','Extensions','HopperHistory','OpenchannelInteraction','OpenchannelInteractions','ChatInteractions','SmsInteraction','SmsInteractions','FaxInteractions','WhatsappInteractions','UserNotifications','SenderId','belongsTo','userProfileId','Groups','chat_group_has_users','Contacts','cm_user_has_contacts','belongsToMany','Lists','cm_user_has_lists','Team','user_has_teams','user_has_mail_interactions','user_has_chat_interactions','user_has_fax_interactions','user_has_sms_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueues','VoicePrefixes','UserVoicePrefix','FaxQueues','OpenchannelQueues','ChatWebsites','FaxAccount','user_has_fax_accounts','MailAccount','MailAccounts','user_has_mail_accounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccount','WhatsappAccounts','user_has_whatsapp_accounts','VoiceChanSpy','SpiedAgents','ChanSpyId','Applications','VoiceMusicOnHold','Sounds','moh_has_sounds','Members','VoiceQueueId','HopperFinals','HopperBlacks','JscriptySessions','TrunkId','Interval','IntervalId','mandatoryDispositionPause','mandatoryDispositionPauseId','Teams','Messages','mailboxuser','mailbox','QueueCalls','uniqueid','AgentReports','Contact','MailAccountId','CloudProviderId','restrict','Dispositions','Answers','Interactions','List','ListId','Template','Agents','team_has_mail_queues','MailInteractionId','Account','Owner','Tags','mail_interaction_has_tags','ThroughTags','Attachment','ChatOfflineMessageId','Items','FaxAccountId','CannedAnswer','Exntensions','TagId','FaxInteractionId','ContactId','fax_interaction_has_tags','Users','AttachmentId','team_has_fax_queues','SmsAccountId','SmsApplication','SmsInteractionId','sms_interaction_has_tags','Interaction','team_has_sms_queues','OpenchannelAccountId','openchannel_interaction_has_tags','OpenchannelInteractionId','OpenchannelQueueId','team_has_openchannel_queues','ChatWebsiteId','user_has_chat_websites','Agent','Queue','ChatQueueId','ChatApplication','Website','chat_interaction_has_tags','ChatInteractionId','team_has_chat_queues','ChatGroupId','ChatProactiveAction','CmCompany','CompanyId','Phones','Hoppers','HopperHistories','MailInteractions','Company','cm_contact_has_tags','CmHopperId','CampaignId','OwnerId','All','OneAll','Any','OneAny','AutomationAnyId','ParentId','Intervals','ChatApplications','FaxApplications','SmsApplications','DefaultReportId','CustomReportId','Mohs','whatsapp_interaction_has_tags','ItemType','ItemTypeId','CmContactId','AllConditions','AllCondition','TriggerAllId','AnyCondition','TriggerAnyId','Actions','Fields','MetricId','Configurations','AccountId','Subjects','Descriptions','DescriptionId','FieldId','SalesforceConfiguration','Subject','Description','Field','VariableId','SugarcrmAccount','SugarcrmField','SubjectId','int_desk_configuration_has_tags','ZendeskConfiguration','int_zendesk_configuration_has_tags','int_freshdesk_configuration_has_tags','VtigerAccount','ServicenowField','Dynamics365Account','FreshsalesField','FromId','ToId','SessionId','SmsQueueReport','ProjectId','team_has_whatsapp_queues','WhatsappQueues','TrunkBackup','SquareProjectId','BlackLists','campaigns_has_cm_blacklists','MailTransferReport','FromMailAccountId','FromUserId','FromAgent','ToUserId','ToAgent','ToMailQueueId','ToQueue','ToMailAccountId','ChatTransferReport','FromChatWebsiteId','FromAccount','ToChatQueueId','ToAccount','FromFaxAccountId','ToFaxQueueId','ToOpenchannelQueueId','ToOpenchannelAccountId','ToSmsQueueId','ToSmsAccountId','CustomFields','Queues','voice_queues_has_cm_lists','UserProfileSection','sectionId','WhatsappAccountId','WhatsappInteractionId','ToWhatsappAccountId','ToQueueId','user','Imap','Smtp','exports','../config/environment','sequelize','lodash','jstz','defaultsDeep','motion2','xC@LL1234','127.0.0.1','mysql','utf8mb4','utf8','utf8_general_ci','sequelizeHistory','xcall','name','password','options','User','../api/user/user.model','import','VoiceContext','../api/voiceContext/voiceContext.model','VoiceExtension','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','ScreenRecording','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceAgentReport','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','Trunk','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue'];(function(_0x3d210e,_0x4ac492){var _0x3cc2a3=function(_0x5cbc71){while(--_0x5cbc71){_0x3d210e['push'](_0x3d210e['shift']());}};_0x3cc2a3(++_0x4ac492);}(_0x1b55,0x1ca));var _0x51b5=function(_0x5af305,_0xaf3cf8){_0x5af305=_0x5af305-0x0;var _0x4d9831=_0x1b55[_0x5af305];return _0x4d9831;};'use strict';var config=require(_0x51b5('0x0'));var Sequelize=require(_0x51b5('0x1'));var _=require(_0x51b5('0x2'));var jstz=require(_0x51b5('0x3'));var timezone=jstz['determine']();config[_0x51b5('0x1')]=_[_0x51b5('0x4')](config[_0x51b5('0x1')],{'database':_0x51b5('0x5'),'username':'xcall','password':_0x51b5('0x6'),'options':{'host':_0x51b5('0x7'),'port':0xcea,'dialect':_0x51b5('0x8'),'dialectOptions':{'charset':_0x51b5('0x9')},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0x51b5('0xa'),'collate':_0x51b5('0xb')}}});config['sequelizeHistory']=_[_0x51b5('0x4')](config[_0x51b5('0xc')],{'database':_0x51b5('0x5'),'username':_0x51b5('0xd'),'password':_0x51b5('0x6'),'options':{'host':_0x51b5('0x7'),'port':0xcea,'dialect':_0x51b5('0x8'),'dialectOptions':{'charset':_0x51b5('0x9')},'logging':![],'timezone':timezone[_0x51b5('0xe')](),'define':{'charset':_0x51b5('0xa'),'collate':_0x51b5('0xb')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x51b5('0x1')]['database'],config[_0x51b5('0x1')]['username'],config['sequelize'][_0x51b5('0xf')],config[_0x51b5('0x1')][_0x51b5('0x10')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x51b5('0xc')]['database'],config[_0x51b5('0xc')]['username'],config[_0x51b5('0xc')][_0x51b5('0xf')],config[_0x51b5('0xc')][_0x51b5('0x10')])};db[_0x51b5('0x11')]=db[_0x51b5('0x1')]['import'](_0x51b5('0x12'));db['VoiceChanSpy']=db[_0x51b5('0x1')][_0x51b5('0x13')]('../api/voiceChanSpy/voiceChanSpy.model');db[_0x51b5('0x14')]=db[_0x51b5('0x1')][_0x51b5('0x13')](_0x51b5('0x15'));db[_0x51b5('0x16')]=db['sequelize']['import']('../api/voiceExtension/voiceExtension.model');db['VoiceMusicOnHold']=db[_0x51b5('0x1')]['import']('../api/voiceMusicOnHold/voiceMusicOnHold.model');db[_0x51b5('0x17')]=db[_0x51b5('0x1')]['import'](_0x51b5('0x18'));db[_0x51b5('0x19')]=db['sequelize'][_0x51b5('0x13')](_0x51b5('0x1a'));db[_0x51b5('0x1b')]=db[_0x51b5('0x1')][_0x51b5('0x13')]('../api/screenRecording/screenRecording.model');db[_0x51b5('0x1c')]=db['sequelize'][_0x51b5('0x13')](_0x51b5('0x1d'));db[_0x51b5('0x1e')]=db['sequelize']['import'](_0x51b5('0x1f'));db[_0x51b5('0x20')]=db[_0x51b5('0x1')]['import'](_0x51b5('0x21'));db['VoiceDialReport']=db['sequelize']['import']('../api/voiceDialReport/voiceDialReport.model');db[_0x51b5('0x22')]=db[_0x51b5('0x1')]['import']('../api/voiceAgentReport/voiceAgentReport.model');db[_0x51b5('0x23')]=db[_0x51b5('0x1')]['import'](_0x51b5('0x24'));db[_0x51b5('0x25')]=db['sequelize']['import'](_0x51b5('0x26'));db[_0x51b5('0x27')]=db[_0x51b5('0x1')][_0x51b5('0x13')]('../api/trunk/trunk.model');db['VoiceTransferReport']=db['sequelize']['import'](_0x51b5('0x28'));db[_0x51b5('0x29')]=db[_0x51b5('0x1')][_0x51b5('0x13')](_0x51b5('0x2a'));db[_0x51b5('0x2b')]=db['sequelize'][_0x51b5('0x13')]('../api/userVoiceQueue/userVoiceQueue.model');db[_0x51b5('0x2c')]=db[_0x51b5('0x1')][_0x51b5('0x13')](_0x51b5('0x2d'));db[_0x51b5('0x2e')]=db[_0x51b5('0x1')][_0x51b5('0x13')](_0x51b5('0x2f'));db[_0x51b5('0x30')]=db['sequelize'][_0x51b5('0x13')]('../api/userFaxQueue/userFaxQueue.model');db[_0x51b5('0x31')]=db[_0x51b5('0x1')][_0x51b5('0x13')]('../api/userSmsQueue/userSmsQueue.model');db[_0x51b5('0x32')]=db[_0x51b5('0x1')][_0x51b5('0x13')](_0x51b5('0x33'));db[_0x51b5('0x34')]=db[_0x51b5('0x1')][_0x51b5('0x13')](_0x51b5('0x35'));db[_0x51b5('0x36')]=db[_0x51b5('0x1')][_0x51b5('0x13')](_0x51b5('0x37'));db[_0x51b5('0x38')]=db[_0x51b5('0x1')][_0x51b5('0x13')](_0x51b5('0x39'));db['MailAccount']=db['sequelize'][_0x51b5('0x13')](_0x51b5('0x3a'));db[_0x51b5('0x3b')]=db['sequelize'][_0x51b5('0x13')](_0x51b5('0x3c'));db[_0x51b5('0x3d')]=db[_0x51b5('0x1')][_0x51b5('0x13')](_0x51b5('0x3e'));db[_0x51b5('0x3f')]=db[_0x51b5('0x1')]['import']('../api/mailInteraction/mailInteraction.model');db[_0x51b5('0x40')]=db[_0x51b5('0x1')][_0x51b5('0x13')]('../api/mailMessage/mailMessage.model');db[_0x51b5('0x41')]=db[_0x51b5('0x1')]['import'](_0x51b5('0x42'));db[_0x51b5('0x43')]=db[_0x51b5('0x1')][_0x51b5('0x13')](_0x51b5('0x44'));db[_0x51b5('0x45')]=db[_0x51b5('0x1')][_0x51b5('0x13')](_0x51b5('0x46'));db['DashboardItem']=db[_0x51b5('0x1')][_0x51b5('0x13')](_0x51b5('0x47'));db['FaxAccount']=db[_0x51b5('0x1')][_0x51b5('0x13')]('../api/faxAccount/faxAccount.model');db[_0x51b5('0x48')]=db[_0x51b5('0x1')][_0x51b5('0x13')](_0x51b5('0x49'));db[_0x51b5('0x4a')]=db[_0x51b5('0x1')]['import']('../api/faxInteraction/faxInteraction.model');db[_0x51b5('0x4b')]=db[_0x51b5('0x1')][_0x51b5('0x13')](_0x51b5('0x4c'));db[_0x51b5('0x4d')]=db[_0x51b5('0x1')][_0x51b5('0x13')](_0x51b5('0x4e'));db[_0x51b5('0x4f')]=db['sequelize']['import'](_0x51b5('0x50'));db[_0x51b5('0x51')]=db[_0x51b5('0x1')][_0x51b5('0x13')](_0x51b5('0x52'));db['SmsApplication']=db[_0x51b5('0x1')][_0x51b5('0x13')](_0x51b5('0x53'));db['SmsInteraction']=db[_0x51b5('0x1')][_0x51b5('0x13')](_0x51b5('0x54'));db[_0x51b5('0x55')]=db[_0x51b5('0x1')][_0x51b5('0x13')](_0x51b5('0x56'));db[_0x51b5('0x57')]=db[_0x51b5('0x1')][_0x51b5('0x13')](_0x51b5('0x58'));db[_0x51b5('0x59')]=db['sequelize'][_0x51b5('0x13')](_0x51b5('0x5a'));db[_0x51b5('0x5b')]=db[_0x51b5('0x1')]['import']('../api/openchannelApplication/openchannelApplication.model');db['OpenchannelInteraction']=db[_0x51b5('0x1')][_0x51b5('0x13')](_0x51b5('0x5c'));db[_0x51b5('0x5d')]=db['sequelize'][_0x51b5('0x13')](_0x51b5('0x5e'));db[_0x51b5('0x5f')]=db[_0x51b5('0x1')][_0x51b5('0x13')]('../api/openchannelQueue/openchannelQueue.model');db[_0x51b5('0x60')]=db[_0x51b5('0x1')]['import']('../api/chatWebsite/chatWebsite.model');db[_0x51b5('0x61')]=db[_0x51b5('0x1')][_0x51b5('0x13')]('../api/openchannelQueueReport/openchannelQueueReport.model');db['ChatApplication']=db['sequelize']['import'](_0x51b5('0x62'));db[_0x51b5('0x63')]=db[_0x51b5('0x1')][_0x51b5('0x13')](_0x51b5('0x64'));db[_0x51b5('0x65')]=db[_0x51b5('0x1')]['import'](_0x51b5('0x66'));db[_0x51b5('0x67')]=db[_0x51b5('0x1')][_0x51b5('0x13')](_0x51b5('0x68'));db[_0x51b5('0x69')]=db[_0x51b5('0x1')][_0x51b5('0x13')](_0x51b5('0x6a'));db[_0x51b5('0x6b')]=db[_0x51b5('0x1')]['import'](_0x51b5('0x6c'));db['ChatProactiveAction']=db[_0x51b5('0x1')][_0x51b5('0x13')](_0x51b5('0x6d'));db['CmCompany']=db[_0x51b5('0x1')][_0x51b5('0x13')](_0x51b5('0x6e'));db[_0x51b5('0x6f')]=db[_0x51b5('0x1')][_0x51b5('0x13')]('../api/cmContact/cmContact.model');db[_0x51b5('0x70')]=db[_0x51b5('0x1')][_0x51b5('0x13')]('../api/cmHopper/cmHopper.model');db[_0x51b5('0x71')]=db[_0x51b5('0x1')][_0x51b5('0x13')](_0x51b5('0x72'));db[_0x51b5('0x73')]=db['sequelize'][_0x51b5('0x13')]('../api/cmHopperFinal/cmHopperFinal.model');db[_0x51b5('0x74')]=db[_0x51b5('0x1')]['import']('../api/cmHopperHistory/cmHopperHistory.model');db[_0x51b5('0x75')]=db['sequelize'][_0x51b5('0x13')]('../api/reportAgentPreview/reportAgentPreview.model');db[_0x51b5('0x76')]=db[_0x51b5('0x1')][_0x51b5('0x13')](_0x51b5('0x77'));db[_0x51b5('0x78')]=db[_0x51b5('0x1')][_0x51b5('0x13')](_0x51b5('0x79'));db[_0x51b5('0x7a')]=db['sequelize']['import'](_0x51b5('0x7b'));db['CannedAnswer']=db[_0x51b5('0x1')][_0x51b5('0x13')](_0x51b5('0x7c'));db[_0x51b5('0x7d')]=db[_0x51b5('0x1')][_0x51b5('0x13')](_0x51b5('0x7e'));db[_0x51b5('0x7f')]=db[_0x51b5('0x1')][_0x51b5('0x13')]('../api/condition/condition.model');db['Interval']=db['sequelize'][_0x51b5('0x13')](_0x51b5('0x80'));db[_0x51b5('0x81')]=db[_0x51b5('0x1')][_0x51b5('0x13')](_0x51b5('0x82'));db[_0x51b5('0x83')]=db[_0x51b5('0x1')][_0x51b5('0x13')](_0x51b5('0x84'));db[_0x51b5('0x85')]=db[_0x51b5('0x1')]['import'](_0x51b5('0x86'));db[_0x51b5('0x87')]=db[_0x51b5('0x1')][_0x51b5('0x13')]('../api/schedule/schedule.model');db[_0x51b5('0x88')]=db[_0x51b5('0x1')][_0x51b5('0x13')](_0x51b5('0x89'));db[_0x51b5('0x8a')]=db[_0x51b5('0x1')]['import']('../api/tag/tag.model');db[_0x51b5('0x8b')]=db[_0x51b5('0x1')][_0x51b5('0x13')](_0x51b5('0x8c'));db[_0x51b5('0x8d')]=db[_0x51b5('0x1')][_0x51b5('0x13')]('../api/cmContactHasItem/cmContactHasItem.model');db[_0x51b5('0x8e')]=db['sequelize'][_0x51b5('0x13')](_0x51b5('0x8f'));db['Template']=db['sequelize'][_0x51b5('0x13')](_0x51b5('0x90'));db[_0x51b5('0x91')]=db['sequelize'][_0x51b5('0x13')]('../api/trigger/trigger.model');db[_0x51b5('0x92')]=db[_0x51b5('0x1')][_0x51b5('0x13')]('../api/variable/variable.model');db[_0x51b5('0x93')]=db['sequelize'][_0x51b5('0x13')]('../api/integration/integration.model');db[_0x51b5('0x94')]=db['sequelize'][_0x51b5('0x13')](_0x51b5('0x95'));db[_0x51b5('0x96')]=db[_0x51b5('0x1')][_0x51b5('0x13')]('../api/analyticCustomReport/analyticCustomReport.model');db[_0x51b5('0x97')]=db['sequelize'][_0x51b5('0x13')](_0x51b5('0x98'));db[_0x51b5('0x99')]=db[_0x51b5('0x1')][_0x51b5('0x13')]('../api/analyticExtractedReport/analyticExtractedReport.model');db[_0x51b5('0x9a')]=db[_0x51b5('0x1')][_0x51b5('0x13')](_0x51b5('0x9b'));db[_0x51b5('0x9c')]=db[_0x51b5('0x1')][_0x51b5('0x13')](_0x51b5('0x9d'));db['AnalyticTreeReport']=db[_0x51b5('0x1')][_0x51b5('0x13')](_0x51b5('0x9e'));db[_0x51b5('0x9f')]=db[_0x51b5('0x1')][_0x51b5('0x13')](_0x51b5('0xa0'));db['SalesforceConfiguration']=db[_0x51b5('0x1')][_0x51b5('0x13')](_0x51b5('0xa1'));db[_0x51b5('0xa2')]=db[_0x51b5('0x1')][_0x51b5('0x13')](_0x51b5('0xa3'));db['SugarcrmAccount']=db[_0x51b5('0x1')][_0x51b5('0x13')](_0x51b5('0xa4'));db[_0x51b5('0xa5')]=db[_0x51b5('0x1')][_0x51b5('0x13')]('../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model');db['SugarcrmField']=db['sequelize'][_0x51b5('0x13')]('../api/intSugarcrmField/intSugarcrmField.model');db[_0x51b5('0xa6')]=db[_0x51b5('0x1')][_0x51b5('0x13')](_0x51b5('0xa7'));db[_0x51b5('0xa8')]=db[_0x51b5('0x1')][_0x51b5('0x13')](_0x51b5('0xa9'));db[_0x51b5('0xaa')]=db[_0x51b5('0x1')][_0x51b5('0x13')](_0x51b5('0xab'));db[_0x51b5('0xac')]=db[_0x51b5('0x1')][_0x51b5('0x13')](_0x51b5('0xad'));db[_0x51b5('0xae')]=db[_0x51b5('0x1')]['import'](_0x51b5('0xaf'));db[_0x51b5('0xb0')]=db[_0x51b5('0x1')][_0x51b5('0x13')](_0x51b5('0xb1'));db[_0x51b5('0xb2')]=db['sequelize']['import']('../api/intZendeskAccount/intZendeskAccount.model');db['ZendeskConfiguration']=db['sequelize']['import'](_0x51b5('0xb3'));db[_0x51b5('0xb4')]=db['sequelize'][_0x51b5('0x13')](_0x51b5('0xb5'));db[_0x51b5('0xb6')]=db[_0x51b5('0x1')]['import'](_0x51b5('0xb7'));db[_0x51b5('0xb8')]=db['sequelize'][_0x51b5('0x13')](_0x51b5('0xb9'));db[_0x51b5('0xba')]=db[_0x51b5('0x1')]['import'](_0x51b5('0xbb'));db['VtigerAccount']=db[_0x51b5('0x1')][_0x51b5('0x13')](_0x51b5('0xbc'));db[_0x51b5('0xbd')]=db['sequelize'][_0x51b5('0x13')](_0x51b5('0xbe'));db[_0x51b5('0xbf')]=db[_0x51b5('0x1')][_0x51b5('0x13')](_0x51b5('0xc0'));db[_0x51b5('0xc1')]=db[_0x51b5('0x1')][_0x51b5('0x13')](_0x51b5('0xc2'));db[_0x51b5('0xc3')]=db['sequelize'][_0x51b5('0x13')]('../api/intServicenowConfiguration/intServicenowConfiguration.model');db['ServicenowField']=db[_0x51b5('0x1')]['import']('../api/intServicenowField/intServicenowField.model');db['Dynamics365Account']=db[_0x51b5('0x1')]['import'](_0x51b5('0xc4'));db[_0x51b5('0xc5')]=db[_0x51b5('0x1')][_0x51b5('0x13')]('../api/intDynamics365Configuration/intDynamics365Configuration.model');db[_0x51b5('0xc6')]=db[_0x51b5('0x1')]['import'](_0x51b5('0xc7'));db[_0x51b5('0xc8')]=db[_0x51b5('0x1')][_0x51b5('0x13')]('../api/intFreshsalesAccount/intFreshsalesAccount.model');db[_0x51b5('0xc9')]=db[_0x51b5('0x1')]['import']('../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model');db['FreshsalesField']=db[_0x51b5('0x1')]['import'](_0x51b5('0xca'));db['Integration']=db['sequelize'][_0x51b5('0x13')]('../api/integration/integration.model');db['Network']=db['sequelize'][_0x51b5('0x13')](_0x51b5('0xcb'));db[_0x51b5('0xcc')]=db[_0x51b5('0x1')][_0x51b5('0x13')](_0x51b5('0xcd'));db[_0x51b5('0xce')]=db[_0x51b5('0x1')]['import'](_0x51b5('0xcf'));db[_0x51b5('0xd0')]=db[_0x51b5('0x1')][_0x51b5('0x13')](_0x51b5('0xd1'));db[_0x51b5('0xd2')]=db[_0x51b5('0x1')][_0x51b5('0x13')]('../api/jscriptyQuestionReport/jscriptyQuestionReport.model');db[_0x51b5('0xd3')]=db[_0x51b5('0x1')][_0x51b5('0x13')]('../api/jscriptySessionReport/jscriptySessionReport.model');db['SmsQueueReport']=db[_0x51b5('0x1')]['import']('../api/smsQueueReport/smsQueueReport.model');db[_0x51b5('0xd4')]=db[_0x51b5('0x1')][_0x51b5('0x13')]('../api/squareReport/squareReport.model');db[_0x51b5('0xd5')]=db[_0x51b5('0x1')][_0x51b5('0x13')](_0x51b5('0xd6'));db[_0x51b5('0xd7')]=db['sequelize'][_0x51b5('0x13')]('../api/jscriptyProject/jscriptyProject.model');db[_0x51b5('0xd8')]=db['sequelize']['import'](_0x51b5('0xd9'));db[_0x51b5('0xda')]=db[_0x51b5('0x1')][_0x51b5('0x13')](_0x51b5('0xdb'));db[_0x51b5('0xdc')]=db[_0x51b5('0x1')][_0x51b5('0x13')](_0x51b5('0xdd'));db['SquareRecording']=db['sequelize'][_0x51b5('0x13')](_0x51b5('0xde'));db[_0x51b5('0xdf')]=db[_0x51b5('0x1')]['import'](_0x51b5('0xe0'));db['Team']=db['sequelize']['import']('../api/team/team.model');db[_0x51b5('0xe1')]=db[_0x51b5('0x1')][_0x51b5('0x13')](_0x51b5('0xe2'));db[_0x51b5('0xe3')]=db[_0x51b5('0x1')][_0x51b5('0x13')](_0x51b5('0xe4'));db[_0x51b5('0xe5')]=db[_0x51b5('0x1')]['import'](_0x51b5('0xe6'));db['Attachment']=db[_0x51b5('0x1')]['import'](_0x51b5('0xe7'));db['Plugin']=db['sequelize'][_0x51b5('0x13')](_0x51b5('0xe8'));db['MailTransferReport']=db[_0x51b5('0x1')][_0x51b5('0x13')](_0x51b5('0xe9'));db['ChatTransferReport']=db[_0x51b5('0x1')][_0x51b5('0x13')](_0x51b5('0xea'));db[_0x51b5('0xeb')]=db['sequelize'][_0x51b5('0x13')](_0x51b5('0xec'));db[_0x51b5('0xed')]=db[_0x51b5('0x1')]['import'](_0x51b5('0xee'));db[_0x51b5('0xef')]=db[_0x51b5('0x1')][_0x51b5('0x13')](_0x51b5('0xf0'));db[_0x51b5('0xf1')]=db[_0x51b5('0x1')][_0x51b5('0x13')]('../api/cmList/cmList.model');db[_0x51b5('0xf2')]=db[_0x51b5('0x1')][_0x51b5('0x13')](_0x51b5('0xf3'));db[_0x51b5('0xf4')]=db['sequelize'][_0x51b5('0x13')](_0x51b5('0xf5'));db['UserProfileSection']=db[_0x51b5('0x1')][_0x51b5('0x13')]('../api/userProfileSection/userProfileSection.model');db['UserProfileResource']=db[_0x51b5('0x1')][_0x51b5('0x13')](_0x51b5('0xf6'));db[_0x51b5('0xf7')]=db['sequelize'][_0x51b5('0x13')](_0x51b5('0xf8'));db['WhatsappAccount']=db['sequelize']['import'](_0x51b5('0xf9'));db[_0x51b5('0xfa')]=db['sequelize']['import'](_0x51b5('0xfb'));db[_0x51b5('0xfc')]=db[_0x51b5('0x1')][_0x51b5('0x13')]('../api/whatsappInteraction/whatsappInteraction.model');db[_0x51b5('0xfd')]=db[_0x51b5('0x1')][_0x51b5('0x13')](_0x51b5('0xfe'));db[_0x51b5('0xff')]=db[_0x51b5('0x1')][_0x51b5('0x13')](_0x51b5('0x100'));db[_0x51b5('0x101')]=db[_0x51b5('0x1')][_0x51b5('0x13')](_0x51b5('0x102'));db[_0x51b5('0x103')]=db['sequelize']['import']('../api/whatsappQueue/whatsappQueue.model');db[_0x51b5('0x104')]=db[_0x51b5('0x1')][_0x51b5('0x13')](_0x51b5('0x105'));db[_0x51b5('0x106')]=db[_0x51b5('0x1')][_0x51b5('0x13')](_0x51b5('0x107'));db[_0x51b5('0x108')]=db[_0x51b5('0x1')][_0x51b5('0x13')](_0x51b5('0x109'));db['UserVoicePrefix']=db[_0x51b5('0x1')][_0x51b5('0x13')](_0x51b5('0x10a'));db[_0x51b5('0x10b')]=db[_0x51b5('0x1')][_0x51b5('0x13')](_0x51b5('0x10c'));db['MailInteractionHasTag']=db[_0x51b5('0x1')][_0x51b5('0x13')](_0x51b5('0x10d'));db[_0x51b5('0x11')][_0x51b5('0x10e')](db[_0x51b5('0x1c')],{'as':_0x51b5('0x1c'),'onDelete':'cascade','foreignKey':'UserId'});db[_0x51b5('0x11')][_0x51b5('0x10e')](db[_0x51b5('0x10b')],{'as':_0x51b5('0x10f'),'onDelete':_0x51b5('0x110'),'foreignKey':_0x51b5('0x111')});db['User'][_0x51b5('0x112')](db[_0x51b5('0x19')],{'as':_0x51b5('0x113'),'foreignKey':_0x51b5('0x111')});db[_0x51b5('0x11')][_0x51b5('0x112')](db[_0x51b5('0x29')],{'as':_0x51b5('0x114'),'foreignKey':'UserId'});db['User']['hasMany'](db[_0x51b5('0x16')],{'as':_0x51b5('0x115'),'onDelete':_0x51b5('0x110'),'hooks':!![]});db[_0x51b5('0x11')][_0x51b5('0x112')](db[_0x51b5('0x73')],{'as':'HopperFinals','foreignKey':_0x51b5('0x111')});db[_0x51b5('0x11')]['hasMany'](db[_0x51b5('0x74')],{'as':_0x51b5('0x116'),'foreignKey':'UserId'});db[_0x51b5('0x11')][_0x51b5('0x112')](db[_0x51b5('0x75')],{'as':_0x51b5('0x75'),'foreignKey':_0x51b5('0x111')});db[_0x51b5('0x11')][_0x51b5('0x112')](db[_0x51b5('0x117')],{'as':_0x51b5('0x118'),'foreignKey':'UserId'});db[_0x51b5('0x11')][_0x51b5('0x112')](db['ChatInteraction'],{'as':_0x51b5('0x119'),'foreignKey':_0x51b5('0x111')});db['User'][_0x51b5('0x112')](db[_0x51b5('0x11a')],{'as':_0x51b5('0x11b'),'foreignKey':'UserId'});db[_0x51b5('0x11')]['hasMany'](db[_0x51b5('0x4a')],{'as':_0x51b5('0x11c'),'foreignKey':_0x51b5('0x111')});db[_0x51b5('0x11')]['hasMany'](db[_0x51b5('0x3f')],{'as':'MailInteractions','foreignKey':_0x51b5('0x111')});db['User'][_0x51b5('0x112')](db[_0x51b5('0xfc')],{'as':_0x51b5('0x11d'),'foreignKey':_0x51b5('0x111')});db[_0x51b5('0x11')][_0x51b5('0x112')](db[_0x51b5('0xf7')],{'as':_0x51b5('0x11e'),'foreignKey':_0x51b5('0x11f')});db[_0x51b5('0x11')][_0x51b5('0x112')](db[_0x51b5('0x70')],{'as':'Hoppers','foreignKey':_0x51b5('0x111'),'onDelete':'SET\x20NULL'});db[_0x51b5('0x11')][_0x51b5('0x120')](db['UserProfile'],{'as':_0x51b5('0xf4'),'foreignKey':_0x51b5('0x121')});db[_0x51b5('0x11')]['belongsToMany'](db[_0x51b5('0x6b')],{'as':_0x51b5('0x122'),'through':_0x51b5('0x123')});db[_0x51b5('0x11')]['belongsToMany'](db[_0x51b5('0x6f')],{'as':_0x51b5('0x124'),'through':_0x51b5('0x125')});db[_0x51b5('0x11')][_0x51b5('0x126')](db[_0x51b5('0xf1')],{'as':_0x51b5('0x127'),'through':_0x51b5('0x128')});db[_0x51b5('0x11')]['belongsToMany'](db[_0x51b5('0x129')],{'through':_0x51b5('0x12a')});db[_0x51b5('0x11')][_0x51b5('0x126')](db[_0x51b5('0x3f')],{'as':'MailInteractions','through':_0x51b5('0x12b')});db[_0x51b5('0x11')][_0x51b5('0x126')](db[_0x51b5('0x63')],{'as':_0x51b5('0x119'),'through':_0x51b5('0x12c')});db[_0x51b5('0x11')][_0x51b5('0x126')](db[_0x51b5('0x4a')],{'as':_0x51b5('0x11c'),'through':_0x51b5('0x12d')});db[_0x51b5('0x11')][_0x51b5('0x126')](db['SmsInteraction'],{'as':_0x51b5('0x11b'),'through':_0x51b5('0x12e')});db[_0x51b5('0x11')][_0x51b5('0x126')](db[_0x51b5('0x117')],{'as':_0x51b5('0x118'),'through':_0x51b5('0x12f')});db[_0x51b5('0x11')][_0x51b5('0x126')](db['WhatsappInteraction'],{'as':_0x51b5('0x11d'),'through':_0x51b5('0x130')});db['User'][_0x51b5('0x126')](db[_0x51b5('0x17')],{'as':_0x51b5('0x131'),'through':_0x51b5('0x2b'),'required':![]});db[_0x51b5('0x11')][_0x51b5('0x126')](db['VoicePrefix'],{'as':_0x51b5('0x132'),'through':_0x51b5('0x133'),'required':![]});db[_0x51b5('0x11')]['belongsToMany'](db[_0x51b5('0x3b')],{'as':'MailQueues','through':_0x51b5('0x2e'),'required':![]});db[_0x51b5('0x11')]['belongsToMany'](db[_0x51b5('0x69')],{'as':'ChatQueues','through':'UserChatQueue','required':![],'hooks':!![]});db[_0x51b5('0x11')]['belongsToMany'](db[_0x51b5('0x4d')],{'as':_0x51b5('0x134'),'through':_0x51b5('0x30'),'required':![]});db[_0x51b5('0x11')][_0x51b5('0x126')](db[_0x51b5('0x57')],{'as':'SmsQueues','through':_0x51b5('0x31'),'required':![]});db[_0x51b5('0x11')][_0x51b5('0x126')](db[_0x51b5('0x5f')],{'as':_0x51b5('0x135'),'through':_0x51b5('0x32'),'required':![]});db[_0x51b5('0x11')][_0x51b5('0x126')](db['WhatsappQueue'],{'as':'WhatsappQueues','through':'UserWhatsappQueue','required':![]});db['User'][_0x51b5('0x126')](db[_0x51b5('0xf1')],{'through':_0x51b5('0x128')});db[_0x51b5('0x11')][_0x51b5('0x126')](db[_0x51b5('0x60')],{'as':_0x51b5('0x136'),'through':'user_has_chat_websites'});db[_0x51b5('0x11')]['belongsToMany'](db[_0x51b5('0x137')],{'as':'FaxAccounts','through':_0x51b5('0x138')});db['User']['belongsToMany'](db[_0x51b5('0x139')],{'as':_0x51b5('0x13a'),'through':_0x51b5('0x13b')});db[_0x51b5('0x11')][_0x51b5('0x126')](db['OpenchannelAccount'],{'as':'OpenchannelAccounts','through':_0x51b5('0x13c')});db[_0x51b5('0x11')]['belongsToMany'](db[_0x51b5('0x51')],{'as':_0x51b5('0x13d'),'through':_0x51b5('0x13e')});db[_0x51b5('0x11')]['belongsToMany'](db[_0x51b5('0x13f')],{'as':_0x51b5('0x140'),'through':_0x51b5('0x141')});db[_0x51b5('0x142')]['hasMany'](db[_0x51b5('0x16')],{'as':_0x51b5('0x143'),'onDelete':_0x51b5('0x110'),'foreignKey':_0x51b5('0x144')});db[_0x51b5('0x14')][_0x51b5('0x112')](db['VoiceExtension'],{'onDelete':_0x51b5('0x110')});db[_0x51b5('0x16')]['hasMany'](db[_0x51b5('0x16')],{'as':_0x51b5('0x145'),'onDelete':_0x51b5('0x110')});db[_0x51b5('0x146')]['belongsToMany'](db[_0x51b5('0x88')],{'as':_0x51b5('0x147'),'through':_0x51b5('0x148')});db['VoiceQueue'][_0x51b5('0x112')](db[_0x51b5('0x29')],{'as':_0x51b5('0x149'),'foreignKey':_0x51b5('0x14a')});db[_0x51b5('0x17')][_0x51b5('0x112')](db[_0x51b5('0x70')],{'as':'Hoppers','foreignKey':_0x51b5('0x14a')});db[_0x51b5('0x17')][_0x51b5('0x112')](db['CmHopperFinal'],{'as':_0x51b5('0x14b'),'foreignKey':_0x51b5('0x14a')});db[_0x51b5('0x17')][_0x51b5('0x112')](db[_0x51b5('0x74')],{'as':'HopperHistories','foreignKey':_0x51b5('0x14a')});db[_0x51b5('0x17')][_0x51b5('0x112')](db[_0x51b5('0x75')],{'as':_0x51b5('0x75'),'foreignKey':'VoiceQueueId'});db[_0x51b5('0x17')][_0x51b5('0x112')](db[_0x51b5('0x71')],{'as':_0x51b5('0x14c'),'foreignKey':_0x51b5('0x14a')});db[_0x51b5('0x17')][_0x51b5('0x112')](db[_0x51b5('0xd3')],{'as':_0x51b5('0x14d'),'foreignKey':'VoiceQueueId'});db[_0x51b5('0x17')][_0x51b5('0x120')](db[_0x51b5('0x27')],{'as':_0x51b5('0x27'),'foreignKey':_0x51b5('0x14e')});db[_0x51b5('0x17')]['belongsTo'](db[_0x51b5('0x27')],{'as':'TrunkBackup','foreignKey':'TrunkBackupId'});db['VoiceQueue']['belongsTo'](db[_0x51b5('0x14f')],{'as':_0x51b5('0x14f'),'foreignKey':_0x51b5('0x150')});db[_0x51b5('0x17')][_0x51b5('0x120')](db['Pause'],{'as':_0x51b5('0x151'),'foreignKey':_0x51b5('0x152')});db[_0x51b5('0x17')][_0x51b5('0x126')](db[_0x51b5('0xf1')],{'as':_0x51b5('0x127'),'through':'voice_queues_has_cm_lists'});db[_0x51b5('0x17')]['belongsToMany'](db[_0x51b5('0x11')],{'as':'Agents','through':_0x51b5('0x2b')});db[_0x51b5('0x17')][_0x51b5('0x126')](db[_0x51b5('0x129')],{'as':_0x51b5('0x153'),'through':'TeamVoiceQueue'});db[_0x51b5('0x17')][_0x51b5('0x126')](db['CmList'],{'as':'BlackLists','through':'voice_queues_has_cm_blacklists'});db['VoiceRecording'][_0x51b5('0x120')](db['User'],{'as':_0x51b5('0x11'),'foreignKey':'UserId'});db[_0x51b5('0x1b')][_0x51b5('0x120')](db['User'],{'as':_0x51b5('0x11'),'foreignKey':_0x51b5('0x111')});db[_0x51b5('0x1c')][_0x51b5('0x112')](db[_0x51b5('0x1e')],{'as':_0x51b5('0x154'),'onDelete':_0x51b5('0x110'),'foreignKey':_0x51b5('0x155'),'sourceKey':_0x51b5('0x156')});db[_0x51b5('0x1e')]['belongsTo'](db[_0x51b5('0x1c')],{'foreignKey':'mailboxuser','targetKey':_0x51b5('0x156')});db[_0x51b5('0x20')][_0x51b5('0x112')](db[_0x51b5('0x23')],{'as':_0x51b5('0x157'),'foreignKey':_0x51b5('0x158'),'constraints':![]});db[_0x51b5('0x20')][_0x51b5('0x112')](db['VoiceAgentReport'],{'as':_0x51b5('0x159'),'foreignKey':'uniqueid','constraints':![]});db['VoiceCallReport'][_0x51b5('0x120')](db[_0x51b5('0x11')],{'as':_0x51b5('0x11'),'foreignKey':_0x51b5('0x111')});db[_0x51b5('0x20')][_0x51b5('0x120')](db['CmContact'],{'as':_0x51b5('0x15a'),'foreignKey':'ContactId'});db[_0x51b5('0x36')][_0x51b5('0x120')](db[_0x51b5('0x139')],{'as':'MailAccount','foreignKey':_0x51b5('0x15b')});db[_0x51b5('0x36')]['belongsTo'](db['CloudProvider'],{'as':_0x51b5('0x104'),'foreignKey':_0x51b5('0x15c'),'onDelete':_0x51b5('0x15d')});db[_0x51b5('0x38')]['belongsTo'](db[_0x51b5('0x139')],{'as':'MailAccount','foreignKey':_0x51b5('0x15b')});db[_0x51b5('0x38')][_0x51b5('0x120')](db['CloudProvider'],{'as':'CloudProvider','foreignKey':_0x51b5('0x15c'),'onDelete':_0x51b5('0x15d')});db['MailAccount'][_0x51b5('0x10e')](db[_0x51b5('0x36')],{'as':'Imap','onDelete':'cascade'});db[_0x51b5('0x139')][_0x51b5('0x10e')](db[_0x51b5('0x38')],{'as':'Smtp','onDelete':'cascade'});db[_0x51b5('0x139')][_0x51b5('0x112')](db['Disposition'],{'as':_0x51b5('0x15e'),'foreignKey':'MailAccountId','onDelete':_0x51b5('0x110')});db[_0x51b5('0x139')][_0x51b5('0x112')](db['CannedAnswer'],{'as':_0x51b5('0x15f'),'foreignKey':'MailAccountId'});db[_0x51b5('0x139')][_0x51b5('0x112')](db[_0x51b5('0x40')],{'as':'Messages','foreignKey':_0x51b5('0x15b')});db[_0x51b5('0x139')]['hasMany'](db[_0x51b5('0x3f')],{'as':_0x51b5('0x160')});db[_0x51b5('0x139')][_0x51b5('0x112')](db[_0x51b5('0x41')],{'as':_0x51b5('0x145'),'foreignKey':'MailAccountId','onDelete':_0x51b5('0x110')});db['MailAccount']['belongsTo'](db[_0x51b5('0xf1')],{'as':_0x51b5('0x161'),'foreignKey':_0x51b5('0x162')});db[_0x51b5('0x139')][_0x51b5('0x120')](db[_0x51b5('0x163')],{'as':_0x51b5('0x163'),'foreignKey':'TemplateId'});db['MailAccount'][_0x51b5('0x120')](db[_0x51b5('0x81')],{'as':'mandatoryDispositionPause','foreignKey':_0x51b5('0x152')});db[_0x51b5('0x139')][_0x51b5('0x126')](db['User'],{'as':'Agents','through':_0x51b5('0x13b')});db[_0x51b5('0x3b')][_0x51b5('0x126')](db[_0x51b5('0x11')],{'as':_0x51b5('0x164'),'through':_0x51b5('0x2e')});db[_0x51b5('0x3b')]['belongsToMany'](db['Team'],{'through':_0x51b5('0x165'),'as':_0x51b5('0x153')});db['MailInteraction'][_0x51b5('0x112')](db[_0x51b5('0x40')],{'as':_0x51b5('0x154'),'onDelete':_0x51b5('0x110'),'foreignKey':_0x51b5('0x166')});db[_0x51b5('0x3f')]['belongsTo'](db[_0x51b5('0x139')],{'as':_0x51b5('0x167'),'foreignKey':_0x51b5('0x15b')});db[_0x51b5('0x3f')][_0x51b5('0x120')](db[_0x51b5('0x6f')],{'as':'Contact','foreignKey':'ContactId'});db[_0x51b5('0x3f')][_0x51b5('0x120')](db['User'],{'as':_0x51b5('0x168'),'foreignKey':_0x51b5('0x111')});db[_0x51b5('0x3f')][_0x51b5('0x126')](db[_0x51b5('0x8a')],{'through':'mail_interaction_has_tags','as':_0x51b5('0x169')});db[_0x51b5('0x3f')][_0x51b5('0x126')](db[_0x51b5('0x8a')],{'through':_0x51b5('0x16a'),'as':_0x51b5('0x16b')});db['MailInteraction'][_0x51b5('0x126')](db[_0x51b5('0x11')],{'as':'Users','through':_0x51b5('0x12b'),'foreignKey':_0x51b5('0x166')});db[_0x51b5('0x40')][_0x51b5('0x112')](db[_0x51b5('0x16c')],{'as':'Attachments','onDelete':'cascade'});db[_0x51b5('0x40')][_0x51b5('0x120')](db['User'],{'as':_0x51b5('0x11')});db[_0x51b5('0x40')][_0x51b5('0x120')](db[_0x51b5('0x6f')],{'onDelete':'cascade','as':'Contact'});db[_0x51b5('0x40')][_0x51b5('0x120')](db[_0x51b5('0x3f')],{'as':'Interaction','foreignKey':_0x51b5('0x166')});db[_0x51b5('0x40')]['belongsTo'](db['MailAccount'],{'as':_0x51b5('0x167'),'foreignKey':_0x51b5('0x15b')});db['MailMessage']['belongsTo'](db[_0x51b5('0x60')],{'as':_0x51b5('0x60'),'foreignKey':'ChatWebsiteId'});db[_0x51b5('0x40')]['belongsTo'](db['ChatOfflineMessage'],{'as':_0x51b5('0x67'),'foreignKey':_0x51b5('0x16d')});db['MailApplication'][_0x51b5('0x120')](db[_0x51b5('0x11')],{'onDelete':'restrict'});db[_0x51b5('0x41')]['belongsTo'](db[_0x51b5('0x3b')],{'onDelete':_0x51b5('0x15d')});db[_0x51b5('0x41')]['belongsTo'](db[_0x51b5('0x139')],{'onDelete':_0x51b5('0x15d')});db[_0x51b5('0x41')][_0x51b5('0x120')](db[_0x51b5('0x14f')],{'onDelete':'restrict','foreignKey':_0x51b5('0x150')});db[_0x51b5('0x41')][_0x51b5('0x120')](db[_0x51b5('0x8a')],{'onDelete':_0x51b5('0x15d'),'foreignKey':'TagId'});db[_0x51b5('0x43')][_0x51b5('0x120')](db[_0x51b5('0x139')],{});db['MailQueueReport']['belongsTo'](db[_0x51b5('0xf1')],{'as':_0x51b5('0x161'),'foreignKey':'ListId'});db[_0x51b5('0x43')][_0x51b5('0x120')](db[_0x51b5('0x6f')],{'as':_0x51b5('0x15a'),'foreignKey':'ContactId'});db[_0x51b5('0x43')]['belongsTo'](db[_0x51b5('0x3f')],{});db[_0x51b5('0x43')][_0x51b5('0x120')](db['MailMessage'],{});db['MailQueueReport'][_0x51b5('0x120')](db[_0x51b5('0x11')],{});db['MailQueueReport']['belongsTo'](db['MailQueue'],{});db['Dashboard'][_0x51b5('0x112')](db['DashboardItem'],{'as':_0x51b5('0x16e'),'onDelete':'cascade'});db[_0x51b5('0x137')][_0x51b5('0x112')](db[_0x51b5('0x7d')],{'as':_0x51b5('0x15e'),'foreignKey':_0x51b5('0x16f'),'onDelete':_0x51b5('0x110')});db['FaxAccount']['hasMany'](db[_0x51b5('0x170')],{'as':_0x51b5('0x15f'),'foreignKey':_0x51b5('0x16f')});db[_0x51b5('0x137')]['hasMany'](db[_0x51b5('0x4a')],{'as':_0x51b5('0x160')});db[_0x51b5('0x137')]['hasMany'](db[_0x51b5('0x48')],{'as':'Applications','foreignKey':'FaxAccountId','onDelete':_0x51b5('0x110')});db[_0x51b5('0x137')][_0x51b5('0x112')](db[_0x51b5('0x16')],{'as':_0x51b5('0x171'),'onDelete':_0x51b5('0x110')});db[_0x51b5('0x137')][_0x51b5('0x112')](db[_0x51b5('0x4b')],{'as':_0x51b5('0x154')});db[_0x51b5('0x137')][_0x51b5('0x120')](db['Trunk'],{'as':_0x51b5('0x27')});db['FaxAccount']['belongsTo'](db[_0x51b5('0xf1')],{'as':_0x51b5('0x161'),'foreignKey':'ListId'});db[_0x51b5('0x137')][_0x51b5('0x120')](db['Pause'],{'as':_0x51b5('0x151'),'foreignKey':_0x51b5('0x152')});db[_0x51b5('0x137')][_0x51b5('0x126')](db[_0x51b5('0x11')],{'as':_0x51b5('0x164'),'through':_0x51b5('0x138')});db['FaxApplication'][_0x51b5('0x120')](db[_0x51b5('0x11')],{'onDelete':_0x51b5('0x15d')});db[_0x51b5('0x48')][_0x51b5('0x120')](db[_0x51b5('0x4d')],{'onDelete':'restrict'});db[_0x51b5('0x48')][_0x51b5('0x120')](db[_0x51b5('0x137')],{'onDelete':_0x51b5('0x15d')});db['FaxApplication'][_0x51b5('0x120')](db[_0x51b5('0x8a')],{'onDelete':_0x51b5('0x15d'),'foreignKey':_0x51b5('0x172')});db[_0x51b5('0x4a')][_0x51b5('0x112')](db[_0x51b5('0x4b')],{'as':_0x51b5('0x154'),'onDelete':'cascade','foreignKey':_0x51b5('0x173')});db[_0x51b5('0x4a')][_0x51b5('0x120')](db[_0x51b5('0x137')],{'as':_0x51b5('0x167'),'foreignKey':_0x51b5('0x16f')});db['FaxInteraction'][_0x51b5('0x120')](db[_0x51b5('0x6f')],{'as':'Contact','foreignKey':_0x51b5('0x174')});db[_0x51b5('0x4a')]['belongsTo'](db[_0x51b5('0x11')],{'as':_0x51b5('0x168'),'foreignKey':'UserId'});db[_0x51b5('0x4a')]['belongsToMany'](db[_0x51b5('0x8a')],{'through':_0x51b5('0x175'),'as':_0x51b5('0x169')});db['FaxInteraction'][_0x51b5('0x126')](db[_0x51b5('0x8a')],{'through':_0x51b5('0x175'),'as':'ThroughTags'});db['FaxInteraction']['belongsToMany'](db[_0x51b5('0x11')],{'as':_0x51b5('0x176'),'through':_0x51b5('0x12d'),'foreignKey':'FaxInteractionId'});db[_0x51b5('0x4b')]['belongsTo'](db[_0x51b5('0x11')],{'onDelete':_0x51b5('0x110'),'as':'User'});db[_0x51b5('0x4b')][_0x51b5('0x120')](db[_0x51b5('0x4a')],{'as':'Interaction','foreignKey':_0x51b5('0x173')});db[_0x51b5('0x4b')][_0x51b5('0x120')](db[_0x51b5('0x6f')],{'onDelete':'cascade','as':_0x51b5('0x15a')});db[_0x51b5('0x4b')][_0x51b5('0x120')](db[_0x51b5('0x16c')],{'as':_0x51b5('0x16c'),'foreignKey':_0x51b5('0x177')});db[_0x51b5('0x4b')][_0x51b5('0x120')](db[_0x51b5('0x137')],{'as':_0x51b5('0x167'),'foreignKey':'FaxAccountId'});db[_0x51b5('0x4d')][_0x51b5('0x126')](db[_0x51b5('0x11')],{'as':'Agents','through':_0x51b5('0x30')});db[_0x51b5('0x4d')][_0x51b5('0x126')](db[_0x51b5('0x129')],{'through':_0x51b5('0x178'),'as':_0x51b5('0x153')});db['FaxQueueReport'][_0x51b5('0x120')](db[_0x51b5('0x137')],{});db[_0x51b5('0x4f')][_0x51b5('0x120')](db[_0x51b5('0xf1')],{'as':_0x51b5('0x161'),'foreignKey':_0x51b5('0x162')});db[_0x51b5('0x4f')][_0x51b5('0x120')](db['CmContact'],{'as':_0x51b5('0x15a'),'foreignKey':'ContactId'});db[_0x51b5('0x4f')][_0x51b5('0x120')](db[_0x51b5('0x4a')],{});db[_0x51b5('0x4f')][_0x51b5('0x120')](db[_0x51b5('0x4b')],{});db['FaxQueueReport']['belongsTo'](db['User'],{});db['FaxQueueReport'][_0x51b5('0x120')](db[_0x51b5('0x4d')],{});db[_0x51b5('0x51')][_0x51b5('0x112')](db[_0x51b5('0x7d')],{'as':_0x51b5('0x15e'),'foreignKey':_0x51b5('0x179'),'onDelete':_0x51b5('0x110')});db[_0x51b5('0x51')][_0x51b5('0x112')](db[_0x51b5('0x170')],{'as':_0x51b5('0x15f'),'foreignKey':_0x51b5('0x179')});db['SmsAccount'][_0x51b5('0x112')](db['SmsMessage'],{'as':_0x51b5('0x154'),'foreignKey':_0x51b5('0x179')});db['SmsAccount'][_0x51b5('0x112')](db['SmsInteraction'],{'as':_0x51b5('0x160')});db[_0x51b5('0x51')][_0x51b5('0x112')](db[_0x51b5('0x17a')],{'as':_0x51b5('0x145'),'foreignKey':'SmsAccountId','onDelete':'cascade'});db[_0x51b5('0x51')][_0x51b5('0x120')](db[_0x51b5('0xf1')],{'as':_0x51b5('0x161'),'foreignKey':_0x51b5('0x162')});db[_0x51b5('0x51')][_0x51b5('0x120')](db[_0x51b5('0x81')],{'as':_0x51b5('0x151'),'foreignKey':_0x51b5('0x152')});db['SmsAccount']['belongsToMany'](db[_0x51b5('0x11')],{'as':'Agents','through':_0x51b5('0x13e')});db[_0x51b5('0x17a')][_0x51b5('0x120')](db[_0x51b5('0x11')],{'onDelete':_0x51b5('0x15d')});db[_0x51b5('0x17a')]['belongsTo'](db[_0x51b5('0x57')],{'onDelete':_0x51b5('0x15d')});db[_0x51b5('0x17a')][_0x51b5('0x120')](db[_0x51b5('0x51')],{'onDelete':'restrict'});db[_0x51b5('0x17a')][_0x51b5('0x120')](db['Interval'],{'onDelete':'restrict','foreignKey':'IntervalId'});db[_0x51b5('0x17a')][_0x51b5('0x120')](db[_0x51b5('0x8a')],{'onDelete':'restrict','foreignKey':_0x51b5('0x172')});db[_0x51b5('0x11a')]['hasMany'](db['SmsMessage'],{'as':_0x51b5('0x154'),'onDelete':_0x51b5('0x110'),'foreignKey':_0x51b5('0x17b')});db[_0x51b5('0x11a')]['belongsTo'](db[_0x51b5('0x51')],{'as':'Account','foreignKey':_0x51b5('0x179')});db['SmsInteraction'][_0x51b5('0x120')](db['CmContact'],{'as':_0x51b5('0x15a'),'foreignKey':_0x51b5('0x174')});db['SmsInteraction'][_0x51b5('0x120')](db[_0x51b5('0x11')],{'as':_0x51b5('0x168'),'foreignKey':_0x51b5('0x111')});db['SmsInteraction'][_0x51b5('0x126')](db['Tag'],{'through':_0x51b5('0x17c'),'as':_0x51b5('0x169')});db[_0x51b5('0x11a')][_0x51b5('0x126')](db['Tag'],{'through':_0x51b5('0x17c'),'as':_0x51b5('0x16b')});db['SmsInteraction']['belongsToMany'](db[_0x51b5('0x11')],{'as':_0x51b5('0x176'),'through':'user_has_sms_interactions','foreignKey':_0x51b5('0x17b')});db['SmsMessage'][_0x51b5('0x120')](db[_0x51b5('0x11')],{'as':_0x51b5('0x11')});db['SmsMessage'][_0x51b5('0x120')](db[_0x51b5('0x6f')],{'onDelete':_0x51b5('0x110'),'as':'Contact'});db[_0x51b5('0x55')][_0x51b5('0x120')](db['SmsInteraction'],{'onDelete':_0x51b5('0x110'),'as':_0x51b5('0x17d'),'foreignKey':_0x51b5('0x17b')});db[_0x51b5('0x55')][_0x51b5('0x120')](db[_0x51b5('0x51')],{'as':_0x51b5('0x167'),'foreignKey':'SmsAccountId'});db['SmsQueue'][_0x51b5('0x126')](db[_0x51b5('0x11')],{'as':'Agents','through':_0x51b5('0x31'),'foreignKey':'SmsQueueId'});db[_0x51b5('0x57')][_0x51b5('0x126')](db[_0x51b5('0x129')],{'through':_0x51b5('0x17e'),'as':_0x51b5('0x153')});db['OpenchannelAccount'][_0x51b5('0x112')](db['Disposition'],{'as':_0x51b5('0x15e'),'foreignKey':'OpenchannelAccountId','onDelete':_0x51b5('0x110')});db[_0x51b5('0x59')][_0x51b5('0x112')](db[_0x51b5('0x170')],{'as':_0x51b5('0x15f'),'foreignKey':'OpenchannelAccountId'});db[_0x51b5('0x59')][_0x51b5('0x112')](db[_0x51b5('0x117')],{'as':_0x51b5('0x160'),'foreignKey':_0x51b5('0x17f')});db[_0x51b5('0x59')][_0x51b5('0x112')](db[_0x51b5('0x5d')],{'as':_0x51b5('0x154'),'foreignKey':_0x51b5('0x17f')});db[_0x51b5('0x59')][_0x51b5('0x112')](db[_0x51b5('0x5b')],{'as':_0x51b5('0x145'),'foreignKey':_0x51b5('0x17f'),'onDelete':_0x51b5('0x110')});db[_0x51b5('0x59')][_0x51b5('0x120')](db['CmList'],{'as':_0x51b5('0x161'),'foreignKey':'ListId'});db['OpenchannelAccount'][_0x51b5('0x120')](db[_0x51b5('0x81')],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db['OpenchannelAccount'][_0x51b5('0x126')](db[_0x51b5('0x11')],{'as':_0x51b5('0x164'),'through':_0x51b5('0x13c')});db[_0x51b5('0x5b')][_0x51b5('0x120')](db['User'],{'onDelete':_0x51b5('0x15d')});db['OpenchannelApplication']['belongsTo'](db['OpenchannelQueue'],{'onDelete':'restrict','foreignKey':'OpenchannelQueueId'});db[_0x51b5('0x5b')][_0x51b5('0x120')](db[_0x51b5('0x59')],{'onDelete':'restrict','foreignKey':_0x51b5('0x17f')});db[_0x51b5('0x5b')]['belongsTo'](db['Interval'],{'onDelete':_0x51b5('0x15d'),'foreignKey':'IntervalId'});db[_0x51b5('0x5b')][_0x51b5('0x120')](db['Tag'],{'onDelete':_0x51b5('0x15d'),'foreignKey':'TagId'});db['OpenchannelInteraction']['hasMany'](db[_0x51b5('0x5d')],{'as':'Messages','onDelete':_0x51b5('0x110'),'foreignKey':'OpenchannelInteractionId'});db['OpenchannelInteraction'][_0x51b5('0x120')](db[_0x51b5('0x59')],{'as':_0x51b5('0x167'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelInteraction']['belongsTo'](db[_0x51b5('0x6f')],{'as':'Contact','foreignKey':_0x51b5('0x174')});db[_0x51b5('0x117')][_0x51b5('0x120')](db[_0x51b5('0x11')],{'as':_0x51b5('0x168'),'foreignKey':'UserId'});db[_0x51b5('0x117')][_0x51b5('0x126')](db[_0x51b5('0x8a')],{'through':_0x51b5('0x180'),'as':'Tags'});db['OpenchannelInteraction']['belongsToMany'](db[_0x51b5('0x8a')],{'through':_0x51b5('0x180'),'as':_0x51b5('0x16b')});db[_0x51b5('0x117')][_0x51b5('0x126')](db[_0x51b5('0x11')],{'as':_0x51b5('0x176'),'through':_0x51b5('0x12f'),'foreignKey':_0x51b5('0x181')});db[_0x51b5('0x5d')][_0x51b5('0x120')](db['User'],{'onDelete':_0x51b5('0x110'),'as':_0x51b5('0x11')});db[_0x51b5('0x5d')][_0x51b5('0x120')](db[_0x51b5('0x6f')],{'onDelete':_0x51b5('0x110'),'as':'Contact'});db['OpenchannelMessage']['belongsTo'](db[_0x51b5('0x117')],{'onDelete':'cascade','as':'Interaction','foreignKey':'OpenchannelInteractionId'});db['OpenchannelMessage'][_0x51b5('0x120')](db[_0x51b5('0x16c')],{'as':'Attachment','foreignKey':_0x51b5('0x177')});db['OpenchannelMessage'][_0x51b5('0x120')](db['OpenchannelAccount'],{'as':'Account','foreignKey':_0x51b5('0x17f')});db['OpenchannelQueue'][_0x51b5('0x126')](db[_0x51b5('0x11')],{'as':'Agents','through':_0x51b5('0x32'),'foreignKey':_0x51b5('0x182')});db[_0x51b5('0x5f')][_0x51b5('0x126')](db['Team'],{'through':_0x51b5('0x183'),'as':_0x51b5('0x153')});db[_0x51b5('0x60')][_0x51b5('0x112')](db[_0x51b5('0x7d')],{'as':_0x51b5('0x15e'),'foreignKey':_0x51b5('0x184'),'onDelete':_0x51b5('0x110')});db[_0x51b5('0x60')][_0x51b5('0x112')](db[_0x51b5('0x170')],{'as':_0x51b5('0x15f'),'foreignKey':_0x51b5('0x184')});db['ChatWebsite'][_0x51b5('0x112')](db['ChatProactiveAction'],{'as':'ProactiveActions'});db[_0x51b5('0x60')]['hasMany'](db['ChatInteraction'],{'as':_0x51b5('0x160')});db[_0x51b5('0x60')][_0x51b5('0x112')](db['ChatApplication'],{'as':_0x51b5('0x145'),'foreignKey':_0x51b5('0x184'),'onDelete':_0x51b5('0x110')});db['ChatWebsite']['hasMany'](db['ChatMessage'],{'as':'Messages'});db[_0x51b5('0x60')][_0x51b5('0x120')](db[_0x51b5('0xf1')],{'as':_0x51b5('0x161'),'foreignKey':'ListId'});db[_0x51b5('0x60')][_0x51b5('0x120')](db[_0x51b5('0x14f')],{'as':_0x51b5('0x14f'),'foreignKey':_0x51b5('0x150')});db[_0x51b5('0x60')]['belongsTo'](db[_0x51b5('0x139')],{'as':'MailAccount','foreignKey':_0x51b5('0x15b')});db[_0x51b5('0x60')][_0x51b5('0x120')](db[_0x51b5('0x81')],{'as':_0x51b5('0x151'),'foreignKey':'mandatoryDispositionPauseId'});db['ChatWebsite'][_0x51b5('0x126')](db['User'],{'as':_0x51b5('0x164'),'through':_0x51b5('0x185')});db[_0x51b5('0x61')]['belongsTo'](db[_0x51b5('0x59')],{});db[_0x51b5('0x61')]['belongsTo'](db[_0x51b5('0xf1')],{'as':_0x51b5('0x161'),'foreignKey':_0x51b5('0x162')});db[_0x51b5('0x61')]['belongsTo'](db[_0x51b5('0x6f')],{'as':'Contact','foreignKey':_0x51b5('0x174')});db[_0x51b5('0x61')][_0x51b5('0x120')](db[_0x51b5('0x117')],{});db[_0x51b5('0x61')][_0x51b5('0x120')](db['OpenchannelMessage'],{});db[_0x51b5('0x61')][_0x51b5('0x120')](db[_0x51b5('0x11')],{});db[_0x51b5('0x61')][_0x51b5('0x120')](db['OpenchannelQueue'],{});db['ChatApplication'][_0x51b5('0x120')](db[_0x51b5('0x11')],{'as':_0x51b5('0x186'),'foreignKey':_0x51b5('0x111'),'onDelete':'restrict'});db['ChatApplication']['belongsTo'](db[_0x51b5('0x69')],{'as':_0x51b5('0x187'),'foreignKey':_0x51b5('0x188'),'onDelete':_0x51b5('0x15d')});db[_0x51b5('0x189')][_0x51b5('0x120')](db[_0x51b5('0x60')],{'as':_0x51b5('0x18a'),'foreignKey':'ChatWebsiteId','onDelete':_0x51b5('0x15d')});db[_0x51b5('0x189')][_0x51b5('0x120')](db[_0x51b5('0x8a')],{'onDelete':_0x51b5('0x15d'),'foreignKey':_0x51b5('0x172')});db[_0x51b5('0x63')][_0x51b5('0x112')](db[_0x51b5('0x65')],{'as':_0x51b5('0x154'),'onDelete':_0x51b5('0x110'),'foreignKey':'ChatInteractionId'});db[_0x51b5('0x63')][_0x51b5('0x120')](db[_0x51b5('0x60')],{'as':'Account','foreignKey':_0x51b5('0x184')});db[_0x51b5('0x63')][_0x51b5('0x120')](db['CmContact'],{'as':'Contact','foreignKey':'ContactId'});db[_0x51b5('0x63')]['belongsTo'](db[_0x51b5('0x11')],{'as':_0x51b5('0x168'),'foreignKey':_0x51b5('0x111')});db[_0x51b5('0x63')][_0x51b5('0x126')](db['Tag'],{'through':_0x51b5('0x18b'),'as':_0x51b5('0x169')});db['ChatInteraction']['belongsToMany'](db[_0x51b5('0x8a')],{'through':_0x51b5('0x18b'),'as':_0x51b5('0x16b')});db[_0x51b5('0x63')]['belongsToMany'](db[_0x51b5('0x11')],{'as':_0x51b5('0x176'),'through':_0x51b5('0x12c'),'foreignKey':_0x51b5('0x18c')});db[_0x51b5('0x65')][_0x51b5('0x120')](db['User'],{'onDelete':_0x51b5('0x110'),'as':_0x51b5('0x11')});db[_0x51b5('0x65')][_0x51b5('0x120')](db[_0x51b5('0x6f')],{'onDelete':_0x51b5('0x110'),'as':'Contact','foreignKey':_0x51b5('0x174')});db[_0x51b5('0x65')]['belongsTo'](db['ChatInteraction'],{'onDelete':'cascade','as':'Interaction','foreignKey':_0x51b5('0x18c')});db['ChatMessage']['belongsTo'](db[_0x51b5('0x16c')],{'as':_0x51b5('0x16c'),'foreignKey':_0x51b5('0x177')});db[_0x51b5('0x65')][_0x51b5('0x120')](db['ChatWebsite'],{'as':_0x51b5('0x167'),'foreignKey':'ChatWebsiteId'});db[_0x51b5('0x67')][_0x51b5('0x112')](db[_0x51b5('0x16c')],{'as':'Attachments','foreignKey':_0x51b5('0x16d'),'onDelete':_0x51b5('0x110'),'hooks':!![]});db[_0x51b5('0x67')]['belongsTo'](db[_0x51b5('0x6f')],{'onDelete':_0x51b5('0x110'),'as':_0x51b5('0x15a'),'foreignKey':_0x51b5('0x174')});db[_0x51b5('0x67')][_0x51b5('0x120')](db[_0x51b5('0x60')],{'as':_0x51b5('0x167'),'foreignKey':_0x51b5('0x184')});db[_0x51b5('0x69')][_0x51b5('0x126')](db[_0x51b5('0x11')],{'as':_0x51b5('0x164'),'through':'UserChatQueue','hooks':!![]});db['ChatQueue'][_0x51b5('0x126')](db['Team'],{'through':_0x51b5('0x18d'),'as':_0x51b5('0x153')});db[_0x51b5('0x6b')][_0x51b5('0x112')](db[_0x51b5('0xce')],{'as':_0x51b5('0x154'),'foreignKey':_0x51b5('0x18e'),'onDelete':_0x51b5('0x110')});db['ChatGroup'][_0x51b5('0x126')](db[_0x51b5('0x11')],{'as':'Members','through':'chat_group_has_users'});db[_0x51b5('0x18f')][_0x51b5('0x120')](db['ChatWebsite'],{'as':_0x51b5('0x18a'),'foreignKey':'ChatWebsiteId'});db[_0x51b5('0x190')][_0x51b5('0x112')](db[_0x51b5('0x6f')],{'as':_0x51b5('0x124'),'foreignKey':_0x51b5('0x191')});db[_0x51b5('0x6f')][_0x51b5('0x112')](db[_0x51b5('0x8d')],{'as':_0x51b5('0x192'),'foreignKey':'CmContactId'});db[_0x51b5('0x6f')][_0x51b5('0x112')](db['CmHopper'],{'as':_0x51b5('0x193'),'foreignKey':_0x51b5('0x174')});db[_0x51b5('0x6f')][_0x51b5('0x112')](db[_0x51b5('0x73')],{'as':_0x51b5('0x14b'),'foreignKey':_0x51b5('0x174')});db[_0x51b5('0x6f')]['hasMany'](db['CmHopperHistory'],{'as':_0x51b5('0x194'),'foreignKey':'ContactId'});db[_0x51b5('0x6f')][_0x51b5('0x112')](db['ReportAgentPreview'],{'as':'ReportAgentPreview','foreignKey':_0x51b5('0x174')});db[_0x51b5('0x6f')][_0x51b5('0x112')](db[_0x51b5('0xd3')],{'as':_0x51b5('0x14d'),'foreignKey':_0x51b5('0x174')});db[_0x51b5('0x6f')][_0x51b5('0x112')](db['OpenchannelInteraction'],{'as':_0x51b5('0x118'),'foreignKey':_0x51b5('0x174'),'onDelete':_0x51b5('0x15d')});db[_0x51b5('0x6f')][_0x51b5('0x112')](db['ChatInteraction'],{'as':_0x51b5('0x119'),'foreignKey':'ContactId','onDelete':_0x51b5('0x15d')});db['CmContact'][_0x51b5('0x112')](db[_0x51b5('0x11a')],{'as':_0x51b5('0x11b'),'foreignKey':_0x51b5('0x174'),'onDelete':_0x51b5('0x15d')});db['CmContact'][_0x51b5('0x112')](db[_0x51b5('0x4a')],{'as':_0x51b5('0x11c'),'foreignKey':_0x51b5('0x174'),'onDelete':_0x51b5('0x15d')});db[_0x51b5('0x6f')][_0x51b5('0x112')](db[_0x51b5('0x3f')],{'as':_0x51b5('0x195'),'foreignKey':_0x51b5('0x174'),'onDelete':_0x51b5('0x15d')});db[_0x51b5('0x6f')][_0x51b5('0x120')](db[_0x51b5('0x190')],{'as':_0x51b5('0x196'),'foreignKey':_0x51b5('0x191')});db[_0x51b5('0x6f')][_0x51b5('0x120')](db[_0x51b5('0xf1')],{'as':_0x51b5('0x161'),'foreignKey':'ListId','onDelete':'cascade'});db[_0x51b5('0x6f')][_0x51b5('0x126')](db[_0x51b5('0x11')],{'as':_0x51b5('0x176'),'through':_0x51b5('0x125')});db[_0x51b5('0x6f')][_0x51b5('0x126')](db[_0x51b5('0x8a')],{'as':'Tags','through':_0x51b5('0x197')});db[_0x51b5('0x6f')][_0x51b5('0x126')](db['Tag'],{'through':'cm_contact_has_tags','as':_0x51b5('0x16b')});db[_0x51b5('0x70')][_0x51b5('0x112')](db[_0x51b5('0x8e')],{'as':'AdditionalPhones','foreignKey':_0x51b5('0x198')});db[_0x51b5('0x70')]['belongsTo'](db[_0x51b5('0x6f')],{'as':'Contact','foreignKey':_0x51b5('0x174'),'onDelete':_0x51b5('0x110')});db[_0x51b5('0x70')][_0x51b5('0x120')](db[_0x51b5('0xf1')],{'as':_0x51b5('0x161'),'foreignKey':_0x51b5('0x162'),'onDelete':_0x51b5('0x110')});db['CmHopper'][_0x51b5('0x120')](db['User'],{'as':'Agent','foreignKey':'UserId'});db[_0x51b5('0x70')][_0x51b5('0x120')](db[_0x51b5('0x17')],{'as':_0x51b5('0x187'),'foreignKey':'VoiceQueueId','onDelete':'cascade'});db[_0x51b5('0x70')][_0x51b5('0x120')](db[_0x51b5('0xe3')],{'as':_0x51b5('0xe3'),'foreignKey':_0x51b5('0x199'),'onDelete':'cascade'});db[_0x51b5('0x70')][_0x51b5('0x120')](db['User'],{'as':_0x51b5('0x168'),'foreignKey':_0x51b5('0x19a')});db[_0x51b5('0x71')][_0x51b5('0x120')](db['CmContact'],{'as':_0x51b5('0x15a'),'foreignKey':_0x51b5('0x174'),'onDelete':_0x51b5('0x110')});db[_0x51b5('0x71')][_0x51b5('0x120')](db[_0x51b5('0xf1')],{'as':_0x51b5('0x161'),'foreignKey':_0x51b5('0x162'),'onDelete':_0x51b5('0x110')});db[_0x51b5('0x71')][_0x51b5('0x120')](db['VoiceQueue'],{'as':'Queue','foreignKey':'VoiceQueueId','onDelete':'cascade'});db['CmHopperBlack'][_0x51b5('0x120')](db[_0x51b5('0xe3')],{'as':'Campaign','foreignKey':_0x51b5('0x199'),'onDelete':_0x51b5('0x110')});db[_0x51b5('0x7a')][_0x51b5('0x112')](db[_0x51b5('0x7f')],{'as':{'plural':_0x51b5('0x19b'),'singular':_0x51b5('0x19c')},'foreignKey':'AutomationAllId','onDelete':'cascade','hooks':!![]});db['Automation'][_0x51b5('0x112')](db['Condition'],{'as':{'plural':_0x51b5('0x19d'),'singular':_0x51b5('0x19e')},'foreignKey':_0x51b5('0x19f'),'onDelete':_0x51b5('0x110'),'hooks':!![]});db[_0x51b5('0x7a')]['hasMany'](db[_0x51b5('0x78')],{'as':'Actions','foreignKey':'AutomationId','onDelete':_0x51b5('0x110'),'hooks':!![]});db[_0x51b5('0x7d')][_0x51b5('0x112')](db['Disposition'],{'as':_0x51b5('0x15e'),'foreignKey':_0x51b5('0x1a0'),'onDelete':_0x51b5('0x110')});db['Interval'][_0x51b5('0x112')](db[_0x51b5('0x14f')],{'as':_0x51b5('0x1a1'),'foreignKey':_0x51b5('0x150'),'onDelete':'cascade','hooks':!![],'required':![]});db[_0x51b5('0x14f')][_0x51b5('0x112')](db[_0x51b5('0x16')],{'as':'Extensions','foreignKey':_0x51b5('0x150'),'onDelete':_0x51b5('0x15d')});db[_0x51b5('0x14f')][_0x51b5('0x112')](db['MailApplication'],{'as':'MailApplications','foreignKey':_0x51b5('0x150')});db[_0x51b5('0x14f')]['hasMany'](db[_0x51b5('0x189')],{'as':_0x51b5('0x1a2'),'foreignKey':_0x51b5('0x150')});db['Interval'][_0x51b5('0x112')](db[_0x51b5('0x48')],{'as':_0x51b5('0x1a3'),'foreignKey':_0x51b5('0x150')});db['Interval'][_0x51b5('0x112')](db[_0x51b5('0x17a')],{'as':_0x51b5('0x1a4'),'foreignKey':_0x51b5('0x150')});db[_0x51b5('0x87')][_0x51b5('0x120')](db[_0x51b5('0x139')],{});db[_0x51b5('0x87')]['belongsTo'](db[_0x51b5('0x97')],{'foreignKey':_0x51b5('0x1a5')});db[_0x51b5('0x87')]['belongsTo'](db[_0x51b5('0x96')],{'foreignKey':_0x51b5('0x1a6')});db[_0x51b5('0x88')]['belongsToMany'](db[_0x51b5('0x146')],{'as':_0x51b5('0x1a7'),'through':_0x51b5('0x148'),'onDelete':_0x51b5('0x15d')});db[_0x51b5('0x8a')][_0x51b5('0x126')](db[_0x51b5('0x6f')],{'through':_0x51b5('0x197')});db[_0x51b5('0x8a')][_0x51b5('0x126')](db[_0x51b5('0x63')],{'through':_0x51b5('0x18b')});db[_0x51b5('0x8a')]['belongsToMany'](db[_0x51b5('0x3f')],{'through':_0x51b5('0x16a')});db['Tag'][_0x51b5('0x126')](db[_0x51b5('0x11a')],{'through':_0x51b5('0x17c')});db[_0x51b5('0x8a')][_0x51b5('0x126')](db[_0x51b5('0x4a')],{'through':_0x51b5('0x175')});db[_0x51b5('0x8a')][_0x51b5('0x126')](db[_0x51b5('0x117')],{'through':_0x51b5('0x180')});db[_0x51b5('0x8a')][_0x51b5('0x126')](db[_0x51b5('0xfc')],{'through':_0x51b5('0x1a8')});db[_0x51b5('0x8d')][_0x51b5('0x120')](db['ContactItemType'],{'as':_0x51b5('0x1a9'),'foreignKey':_0x51b5('0x1aa')});db[_0x51b5('0x8e')]['belongsTo'](db[_0x51b5('0x70')],{'as':'Hopper','foreignKey':_0x51b5('0x198')});db[_0x51b5('0x8d')][_0x51b5('0x120')](db[_0x51b5('0x6f')],{'as':_0x51b5('0x15a'),'foreignKey':_0x51b5('0x1ab')});db[_0x51b5('0x91')][_0x51b5('0x112')](db[_0x51b5('0x7f')],{'as':{'plural':_0x51b5('0x1ac'),'singular':_0x51b5('0x1ad')},'foreignKey':_0x51b5('0x1ae'),'onDelete':_0x51b5('0x110'),'hooks':!![]});db[_0x51b5('0x91')][_0x51b5('0x112')](db[_0x51b5('0x7f')],{'as':{'plural':'AnyConditions','singular':_0x51b5('0x1af')},'foreignKey':_0x51b5('0x1b0'),'onDelete':_0x51b5('0x110'),'hooks':!![]});db['Trigger'][_0x51b5('0x112')](db['Action'],{'as':_0x51b5('0x1b1'),'foreignKey':'TriggerId','onDelete':'cascade','hooks':!![]});db['AnalyticCustomReport']['hasMany'](db['AnalyticFieldReport'],{'as':'Fields','onDelete':_0x51b5('0x110'),'foreignKey':'CustomReportId','hooks':!![]});db['AnalyticDefaultReport'][_0x51b5('0x112')](db[_0x51b5('0x9c')],{'as':_0x51b5('0x1b2'),'onDelete':'cascade','foreignKey':_0x51b5('0x1a5')});db[_0x51b5('0x9a')][_0x51b5('0x112')](db['AnalyticFieldReport'],{'as':_0x51b5('0x1b2'),'onDelete':_0x51b5('0x110'),'foreignKey':_0x51b5('0x1b3')});db['AnalyticFieldReport'][_0x51b5('0x120')](db[_0x51b5('0x9a')],{'foreignKey':_0x51b5('0x1b3')});db[_0x51b5('0x9f')][_0x51b5('0x112')](db['SalesforceConfiguration'],{'as':_0x51b5('0x1b4'),'onDelete':'cascade','foreignKey':_0x51b5('0x1b5')});db['SalesforceConfiguration'][_0x51b5('0x112')](db[_0x51b5('0xa2')],{'as':_0x51b5('0x1b6'),'onDelete':_0x51b5('0x110'),'foreignKey':'SubjectId'});db['SalesforceConfiguration']['hasMany'](db[_0x51b5('0xa2')],{'as':_0x51b5('0x1b7'),'onDelete':'cascade','foreignKey':_0x51b5('0x1b8')});db['SalesforceConfiguration'][_0x51b5('0x112')](db[_0x51b5('0xa2')],{'as':'Fields','onDelete':_0x51b5('0x110'),'foreignKey':_0x51b5('0x1b9')});db[_0x51b5('0x1ba')][_0x51b5('0x120')](db[_0x51b5('0x9f')],{'as':_0x51b5('0x167'),'foreignKey':_0x51b5('0x1b5')});db[_0x51b5('0xa2')][_0x51b5('0x112')](db['SalesforceField'],{'as':_0x51b5('0x1bb'),'foreignKey':'SubjectId'});db[_0x51b5('0xa2')][_0x51b5('0x112')](db[_0x51b5('0xa2')],{'as':_0x51b5('0x1bc'),'foreignKey':'DescriptionId'});db['SalesforceField'][_0x51b5('0x112')](db['SalesforceField'],{'as':_0x51b5('0x1bd'),'foreignKey':_0x51b5('0x1b9')});db[_0x51b5('0xa2')][_0x51b5('0x120')](db[_0x51b5('0x92')],{'as':_0x51b5('0x92'),'foreignKey':_0x51b5('0x1be')});db[_0x51b5('0x1bf')][_0x51b5('0x112')](db[_0x51b5('0xa5')],{'as':_0x51b5('0x1b4'),'onDelete':'cascade','foreignKey':_0x51b5('0x1b5')});db['SugarcrmConfiguration'][_0x51b5('0x112')](db[_0x51b5('0x1c0')],{'as':_0x51b5('0x1b6'),'onDelete':'cascade','foreignKey':_0x51b5('0x1c1')});db[_0x51b5('0xa5')][_0x51b5('0x112')](db[_0x51b5('0x1c0')],{'as':_0x51b5('0x1b7'),'onDelete':_0x51b5('0x110'),'foreignKey':_0x51b5('0x1b8')});db[_0x51b5('0xa5')][_0x51b5('0x112')](db[_0x51b5('0x1c0')],{'as':'Fields','onDelete':_0x51b5('0x110'),'foreignKey':_0x51b5('0x1b9')});db[_0x51b5('0xa5')][_0x51b5('0x120')](db[_0x51b5('0x1bf')],{'as':_0x51b5('0x167'),'foreignKey':'AccountId'});db[_0x51b5('0x1c0')][_0x51b5('0x112')](db[_0x51b5('0x1c0')],{'as':_0x51b5('0x1bb'),'foreignKey':'SubjectId'});db[_0x51b5('0x1c0')][_0x51b5('0x112')](db[_0x51b5('0x1c0')],{'as':_0x51b5('0x1bc'),'foreignKey':_0x51b5('0x1b8')});db[_0x51b5('0x1c0')][_0x51b5('0x112')](db[_0x51b5('0x1c0')],{'as':_0x51b5('0x1bd'),'foreignKey':_0x51b5('0x1b9')});db['SugarcrmField']['belongsTo'](db[_0x51b5('0x92')],{'as':'Variable','foreignKey':_0x51b5('0x1be')});db[_0x51b5('0xa6')][_0x51b5('0x112')](db[_0x51b5('0xa8')],{'as':'Configurations','onDelete':'cascade','foreignKey':_0x51b5('0x1b5')});db[_0x51b5('0xa8')][_0x51b5('0x112')](db['DeskField'],{'as':'Subjects','onDelete':_0x51b5('0x110'),'foreignKey':'SubjectId'});db[_0x51b5('0xa8')][_0x51b5('0x112')](db[_0x51b5('0xaa')],{'as':'Descriptions','onDelete':_0x51b5('0x110'),'foreignKey':_0x51b5('0x1b8')});db['DeskConfiguration'][_0x51b5('0x112')](db[_0x51b5('0xaa')],{'as':_0x51b5('0x1b2'),'onDelete':_0x51b5('0x110'),'foreignKey':_0x51b5('0x1b9')});db['DeskConfiguration'][_0x51b5('0x120')](db[_0x51b5('0xa6')],{'as':_0x51b5('0x167'),'foreignKey':_0x51b5('0x1b5')});db['DeskConfiguration'][_0x51b5('0x126')](db[_0x51b5('0x8a')],{'through':_0x51b5('0x1c2')});db[_0x51b5('0xaa')][_0x51b5('0x112')](db[_0x51b5('0xaa')],{'as':_0x51b5('0x1bb'),'foreignKey':_0x51b5('0x1c1')});db['DeskField']['hasMany'](db[_0x51b5('0xaa')],{'as':_0x51b5('0x1bc'),'foreignKey':_0x51b5('0x1b8')});db[_0x51b5('0xaa')]['hasMany'](db[_0x51b5('0xaa')],{'as':'Field','foreignKey':_0x51b5('0x1b9')});db[_0x51b5('0xaa')][_0x51b5('0x120')](db[_0x51b5('0x92')],{'as':'Variable','foreignKey':_0x51b5('0x1be')});db[_0x51b5('0xac')][_0x51b5('0x112')](db['ZohoConfiguration'],{'as':_0x51b5('0x1b4'),'onDelete':'cascade','foreignKey':_0x51b5('0x1b5')});db[_0x51b5('0xae')][_0x51b5('0x112')](db[_0x51b5('0xb0')],{'as':_0x51b5('0x1b6'),'onDelete':'cascade','foreignKey':_0x51b5('0x1c1')});db[_0x51b5('0xae')][_0x51b5('0x112')](db[_0x51b5('0xb0')],{'as':_0x51b5('0x1b7'),'onDelete':_0x51b5('0x110'),'foreignKey':'DescriptionId'});db['ZohoConfiguration']['hasMany'](db[_0x51b5('0xb0')],{'as':'Fields','onDelete':'cascade','foreignKey':_0x51b5('0x1b9')});db[_0x51b5('0xae')][_0x51b5('0x120')](db[_0x51b5('0xac')],{'as':_0x51b5('0x167'),'foreignKey':_0x51b5('0x1b5')});db[_0x51b5('0xb0')][_0x51b5('0x112')](db[_0x51b5('0xb0')],{'as':_0x51b5('0x1bb'),'foreignKey':_0x51b5('0x1c1')});db['ZohoField'][_0x51b5('0x112')](db['ZohoField'],{'as':_0x51b5('0x1bc'),'foreignKey':_0x51b5('0x1b8')});db['ZohoField']['hasMany'](db[_0x51b5('0xb0')],{'as':'Field','foreignKey':_0x51b5('0x1b9')});db[_0x51b5('0xb0')][_0x51b5('0x120')](db[_0x51b5('0x92')],{'as':_0x51b5('0x92'),'foreignKey':_0x51b5('0x1be')});db[_0x51b5('0xb2')][_0x51b5('0x112')](db[_0x51b5('0x1c3')],{'as':_0x51b5('0x1b4'),'onDelete':_0x51b5('0x110'),'foreignKey':_0x51b5('0x1b5')});db[_0x51b5('0x1c3')]['hasMany'](db[_0x51b5('0xb4')],{'as':_0x51b5('0x1b6'),'foreignKey':_0x51b5('0x1c1')});db[_0x51b5('0x1c3')][_0x51b5('0x112')](db[_0x51b5('0xb4')],{'as':_0x51b5('0x1b7'),'foreignKey':_0x51b5('0x1b8')});db[_0x51b5('0x1c3')]['hasMany'](db['ZendeskField'],{'as':_0x51b5('0x1b2'),'foreignKey':'FieldId'});db[_0x51b5('0x1c3')][_0x51b5('0x120')](db[_0x51b5('0xb2')],{'as':_0x51b5('0x167'),'foreignKey':_0x51b5('0x1b5')});db[_0x51b5('0x1c3')][_0x51b5('0x126')](db[_0x51b5('0x8a')],{'through':_0x51b5('0x1c4')});db[_0x51b5('0xb4')][_0x51b5('0x112')](db[_0x51b5('0xb4')],{'as':_0x51b5('0x1bb'),'foreignKey':_0x51b5('0x1c1')});db[_0x51b5('0xb4')]['hasMany'](db[_0x51b5('0xb4')],{'as':_0x51b5('0x1bc'),'foreignKey':'DescriptionId'});db[_0x51b5('0xb4')][_0x51b5('0x112')](db[_0x51b5('0xb4')],{'as':_0x51b5('0x1bd'),'foreignKey':_0x51b5('0x1b9')});db[_0x51b5('0xb4')][_0x51b5('0x120')](db['Variable'],{'as':'Variable','foreignKey':_0x51b5('0x1be')});db[_0x51b5('0xb6')][_0x51b5('0x112')](db['FreshdeskConfiguration'],{'as':_0x51b5('0x1b4'),'onDelete':_0x51b5('0x110'),'foreignKey':_0x51b5('0x1b5')});db[_0x51b5('0xb8')][_0x51b5('0x112')](db[_0x51b5('0xba')],{'as':_0x51b5('0x1b6'),'onDelete':_0x51b5('0x110'),'foreignKey':_0x51b5('0x1c1')});db[_0x51b5('0xb8')][_0x51b5('0x112')](db[_0x51b5('0xba')],{'as':_0x51b5('0x1b7'),'onDelete':_0x51b5('0x110'),'foreignKey':_0x51b5('0x1b8')});db[_0x51b5('0xb8')][_0x51b5('0x112')](db[_0x51b5('0xba')],{'as':_0x51b5('0x1b2'),'onDelete':_0x51b5('0x110'),'foreignKey':_0x51b5('0x1b9')});db['FreshdeskConfiguration'][_0x51b5('0x120')](db[_0x51b5('0xb6')],{'as':_0x51b5('0x167'),'foreignKey':_0x51b5('0x1b5')});db[_0x51b5('0xb8')][_0x51b5('0x126')](db[_0x51b5('0x8a')],{'through':_0x51b5('0x1c5')});db[_0x51b5('0xba')][_0x51b5('0x112')](db[_0x51b5('0xba')],{'as':'Subject','foreignKey':_0x51b5('0x1c1')});db[_0x51b5('0xba')][_0x51b5('0x112')](db[_0x51b5('0xba')],{'as':'Description','foreignKey':_0x51b5('0x1b8')});db[_0x51b5('0xba')]['hasMany'](db[_0x51b5('0xba')],{'as':_0x51b5('0x1bd'),'foreignKey':_0x51b5('0x1b9')});db['FreshdeskField'][_0x51b5('0x120')](db[_0x51b5('0x92')],{'as':_0x51b5('0x92'),'foreignKey':_0x51b5('0x1be')});db[_0x51b5('0x1c6')]['hasMany'](db[_0x51b5('0xbd')],{'as':'Configurations','onDelete':_0x51b5('0x110'),'foreignKey':_0x51b5('0x1b5')});db[_0x51b5('0xbd')][_0x51b5('0x112')](db[_0x51b5('0xbf')],{'as':_0x51b5('0x1b6'),'foreignKey':_0x51b5('0x1c1')});db[_0x51b5('0xbd')][_0x51b5('0x112')](db['VtigerField'],{'as':_0x51b5('0x1b7'),'foreignKey':'DescriptionId'});db[_0x51b5('0xbd')]['hasMany'](db[_0x51b5('0xbf')],{'as':'Fields','foreignKey':'FieldId'});db[_0x51b5('0xbd')][_0x51b5('0x120')](db[_0x51b5('0x1c6')],{'as':_0x51b5('0x167'),'foreignKey':_0x51b5('0x1b5')});db[_0x51b5('0xbf')][_0x51b5('0x112')](db[_0x51b5('0xbf')],{'as':_0x51b5('0x1bb'),'foreignKey':_0x51b5('0x1c1')});db['VtigerField']['hasMany'](db[_0x51b5('0xbf')],{'as':_0x51b5('0x1bc'),'foreignKey':_0x51b5('0x1b8')});db['VtigerField'][_0x51b5('0x112')](db['VtigerField'],{'as':_0x51b5('0x1bd'),'foreignKey':_0x51b5('0x1b9')});db[_0x51b5('0xbf')]['belongsTo'](db[_0x51b5('0x92')],{'as':_0x51b5('0x92'),'foreignKey':_0x51b5('0x1be')});db[_0x51b5('0xc1')]['hasMany'](db[_0x51b5('0xc3')],{'as':_0x51b5('0x1b4'),'onDelete':_0x51b5('0x110'),'foreignKey':_0x51b5('0x1b5')});db[_0x51b5('0xc3')][_0x51b5('0x112')](db[_0x51b5('0x1c7')],{'as':_0x51b5('0x1b6'),'foreignKey':_0x51b5('0x1c1')});db['ServicenowConfiguration'][_0x51b5('0x112')](db['ServicenowField'],{'as':'Descriptions','foreignKey':_0x51b5('0x1b8')});db['ServicenowConfiguration'][_0x51b5('0x112')](db[_0x51b5('0x1c7')],{'as':_0x51b5('0x1b2'),'foreignKey':_0x51b5('0x1b9')});db['ServicenowConfiguration'][_0x51b5('0x120')](db[_0x51b5('0xc1')],{'as':_0x51b5('0x167'),'foreignKey':_0x51b5('0x1b5')});db[_0x51b5('0x1c7')][_0x51b5('0x112')](db[_0x51b5('0x1c7')],{'as':_0x51b5('0x1bb'),'foreignKey':_0x51b5('0x1c1')});db[_0x51b5('0x1c7')][_0x51b5('0x112')](db[_0x51b5('0x1c7')],{'as':_0x51b5('0x1bc'),'foreignKey':_0x51b5('0x1b8')});db[_0x51b5('0x1c7')][_0x51b5('0x112')](db['ServicenowField'],{'as':'Field','foreignKey':_0x51b5('0x1b9')});db[_0x51b5('0x1c7')][_0x51b5('0x120')](db[_0x51b5('0x92')],{'as':_0x51b5('0x92'),'foreignKey':'VariableId'});db[_0x51b5('0x1c8')][_0x51b5('0x112')](db[_0x51b5('0xc5')],{'as':_0x51b5('0x1b4'),'onDelete':_0x51b5('0x110'),'foreignKey':_0x51b5('0x1b5')});db[_0x51b5('0x1c8')][_0x51b5('0x120')](db['CloudProvider'],{'as':_0x51b5('0x104'),'foreignKey':_0x51b5('0x15c')});db[_0x51b5('0xc5')]['hasMany'](db[_0x51b5('0xc6')],{'as':_0x51b5('0x1b6'),'onDelete':_0x51b5('0x110'),'foreignKey':_0x51b5('0x1c1')});db[_0x51b5('0xc5')][_0x51b5('0x112')](db[_0x51b5('0xc6')],{'as':_0x51b5('0x1b7'),'onDelete':_0x51b5('0x110'),'foreignKey':'DescriptionId'});db[_0x51b5('0xc5')][_0x51b5('0x112')](db[_0x51b5('0xc6')],{'as':'Fields','onDelete':_0x51b5('0x110'),'foreignKey':_0x51b5('0x1b9')});db[_0x51b5('0xc5')]['belongsTo'](db[_0x51b5('0x1c8')],{'as':'Account','foreignKey':_0x51b5('0x1b5')});db[_0x51b5('0xc6')][_0x51b5('0x112')](db[_0x51b5('0xc6')],{'as':_0x51b5('0x1bb'),'foreignKey':_0x51b5('0x1c1')});db[_0x51b5('0xc6')]['hasMany'](db[_0x51b5('0xc6')],{'as':_0x51b5('0x1bc'),'foreignKey':_0x51b5('0x1b8')});db['Dynamics365Field'][_0x51b5('0x112')](db[_0x51b5('0xc6')],{'as':_0x51b5('0x1bd'),'foreignKey':_0x51b5('0x1b9')});db[_0x51b5('0xc6')]['belongsTo'](db[_0x51b5('0x92')],{'as':_0x51b5('0x92'),'foreignKey':_0x51b5('0x1be')});db[_0x51b5('0xc8')]['hasMany'](db[_0x51b5('0xc9')],{'as':'Configurations','onDelete':'cascade','foreignKey':'AccountId'});db['FreshsalesConfiguration']['hasMany'](db[_0x51b5('0x1c9')],{'as':_0x51b5('0x1b6'),'foreignKey':'SubjectId'});db[_0x51b5('0xc9')]['hasMany'](db[_0x51b5('0x1c9')],{'as':_0x51b5('0x1b7'),'foreignKey':_0x51b5('0x1b8')});db[_0x51b5('0xc9')][_0x51b5('0x112')](db['FreshsalesField'],{'as':_0x51b5('0x1b2'),'foreignKey':_0x51b5('0x1b9')});db['FreshsalesConfiguration'][_0x51b5('0x120')](db[_0x51b5('0xc8')],{'as':_0x51b5('0x167'),'foreignKey':_0x51b5('0x1b5')});db['FreshsalesField'][_0x51b5('0x112')](db[_0x51b5('0x1c9')],{'as':_0x51b5('0x1bb'),'foreignKey':'SubjectId'});db['FreshsalesField'][_0x51b5('0x112')](db['FreshsalesField'],{'as':_0x51b5('0x1bc'),'foreignKey':_0x51b5('0x1b8')});db[_0x51b5('0x1c9')][_0x51b5('0x112')](db['FreshsalesField'],{'as':_0x51b5('0x1bd'),'foreignKey':_0x51b5('0x1b9')});db[_0x51b5('0x1c9')][_0x51b5('0x120')](db[_0x51b5('0x92')],{'as':_0x51b5('0x92'),'foreignKey':_0x51b5('0x1be')});db['ChatQueueReport'][_0x51b5('0x120')](db[_0x51b5('0x60')],{});db[_0x51b5('0xcc')][_0x51b5('0x120')](db[_0x51b5('0xf1')],{'as':_0x51b5('0x161'),'foreignKey':_0x51b5('0x162')});db[_0x51b5('0xcc')]['belongsTo'](db[_0x51b5('0x6f')],{'as':_0x51b5('0x15a'),'foreignKey':_0x51b5('0x174')});db[_0x51b5('0xcc')][_0x51b5('0x120')](db[_0x51b5('0x63')],{});db[_0x51b5('0xcc')][_0x51b5('0x120')](db['ChatMessage'],{});db['ChatQueueReport'][_0x51b5('0x120')](db[_0x51b5('0x11')],{});db[_0x51b5('0xcc')][_0x51b5('0x120')](db[_0x51b5('0x69')],{});db[_0x51b5('0xce')][_0x51b5('0x120')](db[_0x51b5('0x11')],{'onDelete':_0x51b5('0x110'),'foreignKey':_0x51b5('0x1ca')});db[_0x51b5('0xce')][_0x51b5('0x120')](db[_0x51b5('0x11')],{'onDelete':_0x51b5('0x110'),'foreignKey':_0x51b5('0x1cb')});db[_0x51b5('0xd3')][_0x51b5('0x112')](db[_0x51b5('0xd2')],{'foreignKey':_0x51b5('0x1cc'),'onDelete':_0x51b5('0x110')});db[_0x51b5('0xd3')][_0x51b5('0x112')](db['JscriptyAnswerReport'],{'foreignKey':_0x51b5('0x1cc'),'onDelete':'cascade'});db[_0x51b5('0x1cd')]['belongsTo'](db[_0x51b5('0x51')],{});db[_0x51b5('0x1cd')][_0x51b5('0x120')](db['CmList'],{'as':_0x51b5('0x161'),'foreignKey':_0x51b5('0x162')});db[_0x51b5('0x1cd')]['belongsTo'](db['CmContact'],{'as':_0x51b5('0x15a'),'foreignKey':_0x51b5('0x174')});db['SmsQueueReport'][_0x51b5('0x120')](db[_0x51b5('0x11a')],{});db[_0x51b5('0x1cd')]['belongsTo'](db[_0x51b5('0x55')],{});db['SmsQueueReport'][_0x51b5('0x120')](db['User'],{});db[_0x51b5('0x1cd')][_0x51b5('0x120')](db[_0x51b5('0x57')],{});db[_0x51b5('0xd7')][_0x51b5('0x112')](db[_0x51b5('0xd3')],{'foreignKey':_0x51b5('0x1ce')});db[_0x51b5('0xd7')][_0x51b5('0x112')](db['JscriptyQuestionReport'],{'foreignKey':_0x51b5('0x1ce')});db[_0x51b5('0xd7')]['hasMany'](db[_0x51b5('0xd0')],{'foreignKey':_0x51b5('0x1ce')});db[_0x51b5('0x129')][_0x51b5('0x126')](db[_0x51b5('0x11')],{'as':'Agents','through':_0x51b5('0x12a')});db['Team'][_0x51b5('0x126')](db['VoiceQueue'],{'through':_0x51b5('0x106'),'as':_0x51b5('0x131')});db[_0x51b5('0x129')][_0x51b5('0x126')](db[_0x51b5('0x3b')],{'through':_0x51b5('0x165'),'as':'MailQueues'});db[_0x51b5('0x129')][_0x51b5('0x126')](db['ChatQueue'],{'through':_0x51b5('0x18d'),'as':'ChatQueues'});db[_0x51b5('0x129')]['belongsToMany'](db[_0x51b5('0x4d')],{'through':_0x51b5('0x178'),'as':_0x51b5('0x134')});db[_0x51b5('0x129')][_0x51b5('0x126')](db['SmsQueue'],{'through':'team_has_sms_queues','as':'SmsQueues'});db[_0x51b5('0x129')][_0x51b5('0x126')](db[_0x51b5('0x5f')],{'through':_0x51b5('0x183'),'as':'OpenchannelQueues'});db[_0x51b5('0x129')][_0x51b5('0x126')](db[_0x51b5('0x103')],{'through':_0x51b5('0x1cf'),'as':_0x51b5('0x1d0')});db[_0x51b5('0x129')][_0x51b5('0x126')](db[_0x51b5('0xf2')],{'through':_0x51b5('0x108'),'as':'VoicePrefixes'});db[_0x51b5('0xe3')][_0x51b5('0x112')](db[_0x51b5('0x70')],{'as':_0x51b5('0x193'),'foreignKey':_0x51b5('0x199')});db[_0x51b5('0xe3')]['hasMany'](db[_0x51b5('0x73')],{'as':_0x51b5('0x14b'),'foreignKey':_0x51b5('0x199')});db['Campaign'][_0x51b5('0x112')](db['CmHopperHistory'],{'as':_0x51b5('0x194'),'foreignKey':_0x51b5('0x199')});db['Campaign'][_0x51b5('0x112')](db[_0x51b5('0x71')],{'as':_0x51b5('0x14c'),'foreignKey':'CampaignId'});db[_0x51b5('0xe3')]['belongsTo'](db[_0x51b5('0x27')],{'as':'Trunk','foreignKey':_0x51b5('0x14e')});db[_0x51b5('0xe3')][_0x51b5('0x120')](db[_0x51b5('0x27')],{'as':_0x51b5('0x1d1'),'foreignKey':'TrunkBackupId'});db[_0x51b5('0xe3')][_0x51b5('0x120')](db[_0x51b5('0x14f')],{'as':'Interval','foreignKey':_0x51b5('0x150')});db[_0x51b5('0xe3')][_0x51b5('0x120')](db['SquareProject'],{'as':_0x51b5('0xdc'),'foreignKey':_0x51b5('0x1d2')});db[_0x51b5('0xe3')][_0x51b5('0x126')](db['CmList'],{'as':'Lists','through':'campaigns_has_cm_lists'});db[_0x51b5('0xe3')][_0x51b5('0x126')](db['CmList'],{'as':_0x51b5('0x1d3'),'through':_0x51b5('0x1d4')});db[_0x51b5('0x16c')][_0x51b5('0x120')](db['ChatOfflineMessage'],{'as':_0x51b5('0x67'),'foreignKey':_0x51b5('0x16d')});db['MailTransferReport'][_0x51b5('0x120')](db[_0x51b5('0x40')],{});db[_0x51b5('0x1d5')][_0x51b5('0x120')](db[_0x51b5('0x3f')],{});db[_0x51b5('0x1d5')][_0x51b5('0x120')](db[_0x51b5('0x139')],{'foreignKey':_0x51b5('0x1d6'),'as':'FromAccount'});db[_0x51b5('0x1d5')]['belongsTo'](db['User'],{'foreignKey':_0x51b5('0x1d7'),'as':_0x51b5('0x1d8')});db[_0x51b5('0x1d5')][_0x51b5('0x120')](db[_0x51b5('0x11')],{'foreignKey':_0x51b5('0x1d9'),'as':_0x51b5('0x1da')});db['MailTransferReport']['belongsTo'](db['MailQueue'],{'foreignKey':_0x51b5('0x1db'),'as':_0x51b5('0x1dc')});db['MailTransferReport'][_0x51b5('0x120')](db[_0x51b5('0x139')],{'foreignKey':_0x51b5('0x1dd'),'as':'ToAccount'});db[_0x51b5('0x1de')][_0x51b5('0x120')](db[_0x51b5('0x65')],{});db['ChatTransferReport'][_0x51b5('0x120')](db['ChatInteraction'],{});db[_0x51b5('0x1de')][_0x51b5('0x120')](db[_0x51b5('0x60')],{'foreignKey':_0x51b5('0x1df'),'as':_0x51b5('0x1e0')});db[_0x51b5('0x1de')]['belongsTo'](db[_0x51b5('0x11')],{'foreignKey':_0x51b5('0x1d7'),'as':_0x51b5('0x1d8')});db[_0x51b5('0x1de')][_0x51b5('0x120')](db[_0x51b5('0x11')],{'foreignKey':_0x51b5('0x1d9'),'as':_0x51b5('0x1da')});db[_0x51b5('0x1de')][_0x51b5('0x120')](db[_0x51b5('0x69')],{'foreignKey':_0x51b5('0x1e1'),'as':_0x51b5('0x1dc')});db[_0x51b5('0x1de')]['belongsTo'](db[_0x51b5('0x60')],{'foreignKey':'ToChatWebsiteId','as':_0x51b5('0x1e2')});db[_0x51b5('0xeb')][_0x51b5('0x120')](db['FaxMessage'],{});db[_0x51b5('0xeb')][_0x51b5('0x120')](db[_0x51b5('0x4a')],{});db[_0x51b5('0xeb')][_0x51b5('0x120')](db[_0x51b5('0x137')],{'foreignKey':_0x51b5('0x1e3'),'as':_0x51b5('0x1e0')});db[_0x51b5('0xeb')][_0x51b5('0x120')](db['User'],{'foreignKey':_0x51b5('0x1d7'),'as':_0x51b5('0x1d8')});db[_0x51b5('0xeb')][_0x51b5('0x120')](db[_0x51b5('0x11')],{'foreignKey':_0x51b5('0x1d9'),'as':_0x51b5('0x1da')});db[_0x51b5('0xeb')][_0x51b5('0x120')](db[_0x51b5('0x4d')],{'foreignKey':_0x51b5('0x1e4'),'as':_0x51b5('0x1dc')});db['FaxTransferReport']['belongsTo'](db[_0x51b5('0x137')],{'foreignKey':'ToFaxAccountId','as':_0x51b5('0x1e2')});db[_0x51b5('0xed')][_0x51b5('0x120')](db[_0x51b5('0x5d')],{});db[_0x51b5('0xed')][_0x51b5('0x120')](db[_0x51b5('0x117')],{});db[_0x51b5('0xed')]['belongsTo'](db[_0x51b5('0x59')],{'foreignKey':'FromOpenchannelAccountId','as':'FromAccount'});db[_0x51b5('0xed')][_0x51b5('0x120')](db[_0x51b5('0x11')],{'foreignKey':_0x51b5('0x1d7'),'as':'FromAgent'});db[_0x51b5('0xed')][_0x51b5('0x120')](db[_0x51b5('0x11')],{'foreignKey':_0x51b5('0x1d9'),'as':'ToAgent'});db['OpenchannelTransferReport'][_0x51b5('0x120')](db[_0x51b5('0x5f')],{'foreignKey':_0x51b5('0x1e5'),'as':'ToQueue'});db[_0x51b5('0xed')][_0x51b5('0x120')](db[_0x51b5('0x59')],{'foreignKey':_0x51b5('0x1e6'),'as':_0x51b5('0x1e2')});db[_0x51b5('0xef')][_0x51b5('0x120')](db[_0x51b5('0x55')],{});db['SmsTransferReport']['belongsTo'](db[_0x51b5('0x11a')],{});db[_0x51b5('0xef')]['belongsTo'](db[_0x51b5('0x51')],{'foreignKey':'FromSmsAccountId','as':'FromAccount'});db[_0x51b5('0xef')]['belongsTo'](db['User'],{'foreignKey':_0x51b5('0x1d7'),'as':_0x51b5('0x1d8')});db[_0x51b5('0xef')][_0x51b5('0x120')](db['User'],{'foreignKey':_0x51b5('0x1d9'),'as':_0x51b5('0x1da')});db[_0x51b5('0xef')][_0x51b5('0x120')](db['SmsQueue'],{'foreignKey':_0x51b5('0x1e7'),'as':_0x51b5('0x1dc')});db[_0x51b5('0xef')]['belongsTo'](db[_0x51b5('0x51')],{'foreignKey':_0x51b5('0x1e8'),'as':'ToAccount'});db[_0x51b5('0xf1')][_0x51b5('0x112')](db[_0x51b5('0x7d')],{'as':_0x51b5('0x15e'),'foreignKey':'ListId','onDelete':'cascade'});db['CmList'][_0x51b5('0x112')](db[_0x51b5('0x76')],{'as':_0x51b5('0x1e9'),'foreignKey':_0x51b5('0x162')});db[_0x51b5('0xf1')][_0x51b5('0x112')](db[_0x51b5('0x6f')],{'as':_0x51b5('0x124'),'onDelete':_0x51b5('0x110'),'foreignKey':'ListId'});db[_0x51b5('0xf1')]['hasMany'](db['CmHopperFinal'],{'as':_0x51b5('0x14b'),'foreignKey':'ListId'});db[_0x51b5('0xf1')][_0x51b5('0x112')](db[_0x51b5('0x74')],{'as':_0x51b5('0x116'),'foreignKey':_0x51b5('0x162')});db['CmList']['hasMany'](db['ReportAgentPreview'],{'as':_0x51b5('0x75'),'foreignKey':_0x51b5('0x162')});db[_0x51b5('0xf1')][_0x51b5('0x126')](db[_0x51b5('0x17')],{'as':_0x51b5('0x1ea'),'through':_0x51b5('0x1eb')});db[_0x51b5('0xf1')][_0x51b5('0x126')](db[_0x51b5('0x11')],{'as':_0x51b5('0x164'),'through':_0x51b5('0x128')});db[_0x51b5('0xf2')][_0x51b5('0x112')](db['VoiceExtension'],{'as':'Extensions','onDelete':_0x51b5('0x110')});db[_0x51b5('0xf2')]['belongsToMany'](db[_0x51b5('0x11')],{'as':_0x51b5('0x164'),'through':_0x51b5('0x133')});db[_0x51b5('0xf2')][_0x51b5('0x126')](db['Team'],{'through':_0x51b5('0x108'),'as':'Teams'});db[_0x51b5('0xf4')][_0x51b5('0x112')](db[_0x51b5('0x11')],{'as':_0x51b5('0x176'),'foreignKey':_0x51b5('0x121')});db['UserProfile'][_0x51b5('0x112')](db[_0x51b5('0x1ec')],{'as':'UserProfileSections','foreignKey':_0x51b5('0x121'),'onDelete':_0x51b5('0x110')});db['UserProfileSection']['hasMany'](db['UserProfileResource'],{'as':'Resources','foreignKey':_0x51b5('0x1ed'),'onDelete':_0x51b5('0x110')});db[_0x51b5('0x13f')]['hasMany'](db[_0x51b5('0x7d')],{'as':_0x51b5('0x15e'),'foreignKey':_0x51b5('0x1ee'),'onDelete':_0x51b5('0x110')});db[_0x51b5('0x13f')][_0x51b5('0x112')](db[_0x51b5('0x170')],{'as':_0x51b5('0x15f'),'foreignKey':'WhatsappAccountId'});db['WhatsappAccount']['hasMany'](db[_0x51b5('0xfd')],{'as':'Messages','foreignKey':_0x51b5('0x1ee')});db['WhatsappAccount'][_0x51b5('0x112')](db[_0x51b5('0xfc')],{'as':_0x51b5('0x160')});db['WhatsappAccount']['hasMany'](db[_0x51b5('0xfa')],{'as':_0x51b5('0x145'),'foreignKey':_0x51b5('0x1ee'),'onDelete':_0x51b5('0x110')});db[_0x51b5('0x13f')][_0x51b5('0x120')](db[_0x51b5('0xf1')],{'as':_0x51b5('0x161'),'foreignKey':'ListId'});db[_0x51b5('0x13f')][_0x51b5('0x120')](db['Pause'],{'as':_0x51b5('0x151'),'foreignKey':_0x51b5('0x152')});db[_0x51b5('0x13f')][_0x51b5('0x126')](db[_0x51b5('0x11')],{'as':_0x51b5('0x164'),'through':_0x51b5('0x141')});db[_0x51b5('0xfa')]['belongsTo'](db[_0x51b5('0x11')],{'onDelete':_0x51b5('0x15d')});db['WhatsappApplication'][_0x51b5('0x120')](db[_0x51b5('0x103')],{'onDelete':_0x51b5('0x15d')});db[_0x51b5('0xfa')][_0x51b5('0x120')](db['WhatsappAccount'],{'onDelete':_0x51b5('0x15d')});db['WhatsappApplication']['belongsTo'](db[_0x51b5('0x14f')],{'onDelete':'restrict','foreignKey':'IntervalId'});db[_0x51b5('0xfa')]['belongsTo'](db[_0x51b5('0x8a')],{'onDelete':_0x51b5('0x15d'),'foreignKey':'TagId'});db[_0x51b5('0xfc')]['hasMany'](db[_0x51b5('0xfd')],{'as':'Messages','onDelete':_0x51b5('0x110'),'foreignKey':'WhatsappInteractionId'});db['WhatsappInteraction']['belongsTo'](db[_0x51b5('0x13f')],{'as':'Account','foreignKey':_0x51b5('0x1ee')});db[_0x51b5('0xfc')][_0x51b5('0x120')](db[_0x51b5('0x6f')],{'as':_0x51b5('0x15a'),'foreignKey':_0x51b5('0x174')});db[_0x51b5('0xfc')][_0x51b5('0x120')](db[_0x51b5('0x11')],{'as':'Owner','foreignKey':_0x51b5('0x111')});db[_0x51b5('0xfc')][_0x51b5('0x126')](db[_0x51b5('0x8a')],{'through':'whatsapp_interaction_has_tags','as':_0x51b5('0x169')});db['WhatsappInteraction'][_0x51b5('0x126')](db[_0x51b5('0x8a')],{'through':_0x51b5('0x1a8'),'as':_0x51b5('0x16b')});db['WhatsappInteraction'][_0x51b5('0x126')](db['User'],{'as':'Users','through':_0x51b5('0x130'),'foreignKey':'WhatsappInteractionId'});db[_0x51b5('0xfd')]['belongsTo'](db[_0x51b5('0x11')],{'as':_0x51b5('0x11')});db[_0x51b5('0xfd')][_0x51b5('0x120')](db[_0x51b5('0x6f')],{'onDelete':'cascade','as':_0x51b5('0x15a')});db[_0x51b5('0xfd')][_0x51b5('0x120')](db[_0x51b5('0xfc')],{'onDelete':_0x51b5('0x110'),'as':_0x51b5('0x17d'),'foreignKey':_0x51b5('0x1ef')});db[_0x51b5('0xfd')][_0x51b5('0x120')](db['WhatsappAccount'],{'as':_0x51b5('0x167'),'foreignKey':_0x51b5('0x1ee')});db['WhatsappQueueReport'][_0x51b5('0x120')](db['WhatsappAccount'],{});db[_0x51b5('0xff')][_0x51b5('0x120')](db['CmList'],{'as':_0x51b5('0x161'),'foreignKey':_0x51b5('0x162')});db[_0x51b5('0xff')][_0x51b5('0x120')](db[_0x51b5('0x6f')],{'as':'Contact','foreignKey':'ContactId'});db['WhatsappQueueReport'][_0x51b5('0x120')](db[_0x51b5('0xfc')],{});db['WhatsappQueueReport'][_0x51b5('0x120')](db[_0x51b5('0x103')],{});db[_0x51b5('0xff')][_0x51b5('0x120')](db[_0x51b5('0xfd')],{});db['WhatsappQueueReport'][_0x51b5('0x120')](db[_0x51b5('0x11')],{});db['WhatsappTransferReport'][_0x51b5('0x120')](db[_0x51b5('0xfd')],{});db['WhatsappTransferReport']['belongsTo'](db[_0x51b5('0xfc')],{});db[_0x51b5('0x101')][_0x51b5('0x120')](db['WhatsappAccount'],{'foreignKey':'FromWhatsappAccountId','as':_0x51b5('0x1e0')});db[_0x51b5('0x101')][_0x51b5('0x120')](db[_0x51b5('0x13f')],{'foreignKey':_0x51b5('0x1f0'),'as':'ToAccount'});db[_0x51b5('0x101')][_0x51b5('0x120')](db[_0x51b5('0x103')],{'foreignKey':_0x51b5('0x1f1'),'as':_0x51b5('0x1dc')});db[_0x51b5('0x101')][_0x51b5('0x120')](db[_0x51b5('0x11')],{'foreignKey':_0x51b5('0x1d7'),'as':_0x51b5('0x1d8')});db[_0x51b5('0x101')][_0x51b5('0x120')](db[_0x51b5('0x11')],{'foreignKey':'ToUserId','as':_0x51b5('0x1da')});db[_0x51b5('0x103')][_0x51b5('0x126')](db['User'],{'as':_0x51b5('0x164'),'through':_0x51b5('0x34'),'foreignKey':'WhatsappQueueId'});db['WhatsappQueue'][_0x51b5('0x126')](db[_0x51b5('0x129')],{'through':_0x51b5('0x1cf'),'as':_0x51b5('0x153')});db['UserSetting']['belongsTo'](db[_0x51b5('0x11')],{'as':_0x51b5('0x1f2'),'foreignKey':'UserId','onDelete':'cascade','hooks':!![]});db[_0x51b5('0x104')][_0x51b5('0x10e')](db[_0x51b5('0x1c8')],{'as':_0x51b5('0x1c8'),'onDelete':_0x51b5('0x15d')});db[_0x51b5('0x104')][_0x51b5('0x10e')](db['MailServerIn'],{'as':_0x51b5('0x1f3'),'onDelete':_0x51b5('0x15d')});db[_0x51b5('0x104')]['hasOne'](db[_0x51b5('0x38')],{'as':_0x51b5('0x1f4'),'onDelete':_0x51b5('0x15d')});module[_0x51b5('0x1f5')]={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index 87a430a..41f0b95 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x48f0=['/api/integrations','./api/integration','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','/api/analytics/extracted_reports','/api/analytics/metrics','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','./api/intSalesforceField','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./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','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','/api/integrations/dynamics365/fields','/api/integrations/freshsales/accounts','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','/api/square/reports','./api/squareReport','./api/squareReportDetail','./api/setting','/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','./api/license','/api/campaigns','./api/campaign','/api/migrations','/api/plugins','./api/plugin','/api/mail/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','./api/whatsappApplication','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','/api/whatsapp/queues','/api/cloudProviders','./api/cloudProvider','/api/realtime','./api/realtime','./api/user-setting','./api/mailInteractionHasTag','/api/auth/local','./api/authLocal','/api/auth/google','/api/auth/activedirectory','./api/jira','/api/rpc','./api/rpc','/api/version','./api/version','/api/system','./api/system','/api/pm2','./api/pm2','/api/webbar','./api/webbar','/api/logs','static','join','/apidoc','/www','root','/demo','/snippet','snippet','3.9.0','/plugins','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','appPath','path','express','./errors','./utils/client-side-logger','default','then','use','/api/users','./api/user','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/extensions','./api/voiceExtension','./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/voice/dials/reports','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','/api/trunks','./api/trunk','/api/voice/transfers/reports','/api/mail/out_servers','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/interactions','./api/mailInteraction','./api/mailMessage','/api/mail/applications','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','./api/dashboard','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','./api/faxMessage','/api/fax/queues','./api/faxQueue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','./api/smsApplication','./api/smsInteraction','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','./api/openchannelInteraction','/api/openchannel/messages','/api/openchannel/queues','./api/chatWebsite','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/messages','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/action','/api/automations','./api/automation','./api/cannedAnswer','/api/dispositions','./api/disposition','/api/conditions','./api/condition','/api/intervals','./api/interval','/api/pauses','/api/cdr','./api/cdr','/api/schedules','./api/schedule','./api/sound','/api/tags','/api/contact_item_types','./api/contactItemType','./api/cmContactHasItem','/api/cm_hopper_additional_phones','./api/cmHopperAdditionalPhone','/api/templates','./api/template','/api/triggers','./api/trigger','/api/variables','./api/variable'];(function(_0x287ba7,_0x369db8){var _0x5dbf5f=function(_0x2c8310){while(--_0x2c8310){_0x287ba7['push'](_0x287ba7['shift']());}};_0x5dbf5f(++_0x369db8);}(_0x48f0,0x1ab));var _0x048f=function(_0x32efc1,_0xa4152f){_0x32efc1=_0x32efc1-0x0;var _0x245da7=_0x48f0[_0x32efc1];return _0x245da7;};'use strict';var path=require(_0x048f('0x0'));var express=require(_0x048f('0x1'));var errors=require(_0x048f('0x2'));var config=require('./config/environment');var setupLoggers=require(_0x048f('0x3'))['setupLoggers'];var clientSideLogs=require('./api/client-side-logs');exports[_0x048f('0x4')]=function(_0x33c097){return setupLoggers(_0x33c097)[_0x048f('0x5')](function(){_0x33c097[_0x048f('0x6')](_0x048f('0x7'),require(_0x048f('0x8')));_0x33c097[_0x048f('0x6')](_0x048f('0x9'),require(_0x048f('0xa')));_0x33c097['use'](_0x048f('0xb'),require(_0x048f('0xc')));_0x33c097[_0x048f('0x6')](_0x048f('0xd'),require(_0x048f('0xe')));_0x33c097[_0x048f('0x6')]('/api/voice/mohs',require(_0x048f('0xf')));_0x33c097[_0x048f('0x6')](_0x048f('0x10'),require(_0x048f('0x11')));_0x33c097[_0x048f('0x6')](_0x048f('0x12'),require(_0x048f('0x13')));_0x33c097[_0x048f('0x6')](_0x048f('0x14'),require(_0x048f('0x15')));_0x33c097[_0x048f('0x6')]('/api/voice/mails',require(_0x048f('0x16')));_0x33c097[_0x048f('0x6')](_0x048f('0x17'),require(_0x048f('0x18')));_0x33c097[_0x048f('0x6')](_0x048f('0x19'),require('./api/voiceCallReport'));_0x33c097[_0x048f('0x6')](_0x048f('0x1a'),require('./api/voiceDialReport'));_0x33c097['use']('/api/voice/agents/reports',require('./api/voiceAgentReport'));_0x33c097['use'](_0x048f('0x1b'),require(_0x048f('0x1c')));_0x33c097[_0x048f('0x6')](_0x048f('0x1d'),require('./api/memberReport'));_0x33c097[_0x048f('0x6')](_0x048f('0x1e'),require(_0x048f('0x1f')));_0x33c097[_0x048f('0x6')](_0x048f('0x20'),require('./api/voiceTransferReport'));_0x33c097[_0x048f('0x6')](_0x048f('0x21'),require('./api/mailServerOut'));_0x33c097[_0x048f('0x6')](_0x048f('0x22'),require(_0x048f('0x23')));_0x33c097['use'](_0x048f('0x24'),require(_0x048f('0x25')));_0x33c097[_0x048f('0x6')]('/api/mail/substatuses',require('./api/mailSubstatus'));_0x33c097[_0x048f('0x6')](_0x048f('0x26'),require(_0x048f('0x27')));_0x33c097[_0x048f('0x6')]('/api/mail/messages',require(_0x048f('0x28')));_0x33c097[_0x048f('0x6')](_0x048f('0x29'),require('./api/mailApplication'));_0x33c097['use'](_0x048f('0x2a'),require(_0x048f('0x2b')));_0x33c097[_0x048f('0x6')](_0x048f('0x2c'),require(_0x048f('0x2d')));_0x33c097[_0x048f('0x6')](_0x048f('0x2e'),require(_0x048f('0x2f')));_0x33c097[_0x048f('0x6')](_0x048f('0x30'),require(_0x048f('0x31')));_0x33c097[_0x048f('0x6')]('/api/fax/applications',require(_0x048f('0x32')));_0x33c097[_0x048f('0x6')](_0x048f('0x33'),require(_0x048f('0x34')));_0x33c097[_0x048f('0x6')]('/api/fax/messages',require(_0x048f('0x35')));_0x33c097[_0x048f('0x6')](_0x048f('0x36'),require(_0x048f('0x37')));_0x33c097[_0x048f('0x6')]('/api/fax/reports/queue',require(_0x048f('0x38')));_0x33c097[_0x048f('0x6')](_0x048f('0x39'),require(_0x048f('0x3a')));_0x33c097[_0x048f('0x6')]('/api/sms/applications',require(_0x048f('0x3b')));_0x33c097[_0x048f('0x6')]('/api/sms/interactions',require(_0x048f('0x3c')));_0x33c097[_0x048f('0x6')](_0x048f('0x3d'),require(_0x048f('0x3e')));_0x33c097[_0x048f('0x6')](_0x048f('0x3f'),require(_0x048f('0x40')));_0x33c097[_0x048f('0x6')](_0x048f('0x41'),require(_0x048f('0x42')));_0x33c097[_0x048f('0x6')]('/api/openchannel/applications',require('./api/openchannelApplication'));_0x33c097[_0x048f('0x6')]('/api/openchannel/interactions',require(_0x048f('0x43')));_0x33c097[_0x048f('0x6')](_0x048f('0x44'),require('./api/openchannelMessage'));_0x33c097['use'](_0x048f('0x45'),require('./api/openchannelQueue'));_0x33c097[_0x048f('0x6')]('/api/chat/websites',require(_0x048f('0x46')));_0x33c097[_0x048f('0x6')]('/api/openchannel/reports/queue',require(_0x048f('0x47')));_0x33c097['use'](_0x048f('0x48'),require(_0x048f('0x49')));_0x33c097[_0x048f('0x6')]('/api/chat/interactions',require('./api/chatInteraction'));_0x33c097[_0x048f('0x6')](_0x048f('0x4a'),require('./api/chatMessage'));_0x33c097[_0x048f('0x6')](_0x048f('0x4b'),require(_0x048f('0x4c')));_0x33c097[_0x048f('0x6')](_0x048f('0x4d'),require('./api/chatQueue'));_0x33c097['use'](_0x048f('0x4e'),require(_0x048f('0x4f')));_0x33c097[_0x048f('0x6')](_0x048f('0x50'),require(_0x048f('0x51')));_0x33c097[_0x048f('0x6')](_0x048f('0x52'),require(_0x048f('0x53')));_0x33c097[_0x048f('0x6')](_0x048f('0x54'),require('./api/cmContact'));_0x33c097['use'](_0x048f('0x55'),require(_0x048f('0x56')));_0x33c097[_0x048f('0x6')](_0x048f('0x57'),require(_0x048f('0x58')));_0x33c097[_0x048f('0x6')](_0x048f('0x59'),require('./api/cmHopperFinal'));_0x33c097[_0x048f('0x6')](_0x048f('0x5a'),require(_0x048f('0x5b')));_0x33c097[_0x048f('0x6')](_0x048f('0x5c'),require(_0x048f('0x5d')));_0x33c097[_0x048f('0x6')](_0x048f('0x5e'),require(_0x048f('0x5f')));_0x33c097['use'](_0x048f('0x60'),require(_0x048f('0x61')));_0x33c097['use']('/api/canned_answers',require(_0x048f('0x62')));_0x33c097[_0x048f('0x6')](_0x048f('0x63'),require(_0x048f('0x64')));_0x33c097['use'](_0x048f('0x65'),require(_0x048f('0x66')));_0x33c097[_0x048f('0x6')](_0x048f('0x67'),require(_0x048f('0x68')));_0x33c097[_0x048f('0x6')](_0x048f('0x69'),require('./api/pause'));_0x33c097[_0x048f('0x6')](_0x048f('0x6a'),require(_0x048f('0x6b')));_0x33c097[_0x048f('0x6')]('/api/voiceQueuesLog',require('./api/voiceQueuesLog'));_0x33c097[_0x048f('0x6')](_0x048f('0x6c'),require(_0x048f('0x6d')));_0x33c097[_0x048f('0x6')]('/api/sounds',require(_0x048f('0x6e')));_0x33c097[_0x048f('0x6')](_0x048f('0x6f'),require('./api/tag'));_0x33c097['use'](_0x048f('0x70'),require(_0x048f('0x71')));_0x33c097['use']('/api/cm_contact_has_items',require(_0x048f('0x72')));_0x33c097[_0x048f('0x6')](_0x048f('0x73'),require(_0x048f('0x74')));_0x33c097[_0x048f('0x6')](_0x048f('0x75'),require(_0x048f('0x76')));_0x33c097[_0x048f('0x6')](_0x048f('0x77'),require(_0x048f('0x78')));_0x33c097[_0x048f('0x6')](_0x048f('0x79'),require(_0x048f('0x7a')));_0x33c097['use'](_0x048f('0x7b'),require(_0x048f('0x7c')));_0x33c097[_0x048f('0x6')]('/api/integrations/reports',require(_0x048f('0x7d')));_0x33c097['use'](_0x048f('0x7e'),require(_0x048f('0x7f')));_0x33c097[_0x048f('0x6')](_0x048f('0x80'),require('./api/analyticDefaultReport'));_0x33c097[_0x048f('0x6')](_0x048f('0x81'),require('./api/analyticExtractedReport'));_0x33c097['use'](_0x048f('0x82'),require('./api/analyticMetric'));_0x33c097[_0x048f('0x6')](_0x048f('0x83'),require(_0x048f('0x84')));_0x33c097['use'](_0x048f('0x85'),require(_0x048f('0x86')));_0x33c097[_0x048f('0x6')](_0x048f('0x87'),require(_0x048f('0x88')));_0x33c097[_0x048f('0x6')](_0x048f('0x89'),require(_0x048f('0x8a')));_0x33c097['use']('/api/integrations/salesforce/fields',require(_0x048f('0x8b')));_0x33c097[_0x048f('0x6')]('/api/integrations/sugarcrm/accounts',require(_0x048f('0x8c')));_0x33c097[_0x048f('0x6')](_0x048f('0x8d'),require(_0x048f('0x8e')));_0x33c097[_0x048f('0x6')](_0x048f('0x8f'),require(_0x048f('0x90')));_0x33c097['use'](_0x048f('0x91'),require(_0x048f('0x92')));_0x33c097['use'](_0x048f('0x93'),require(_0x048f('0x94')));_0x33c097[_0x048f('0x6')](_0x048f('0x95'),require(_0x048f('0x96')));_0x33c097[_0x048f('0x6')](_0x048f('0x97'),require(_0x048f('0x98')));_0x33c097[_0x048f('0x6')](_0x048f('0x99'),require(_0x048f('0x9a')));_0x33c097[_0x048f('0x6')](_0x048f('0x9b'),require(_0x048f('0x9c')));_0x33c097['use'](_0x048f('0x9d'),require(_0x048f('0x9e')));_0x33c097[_0x048f('0x6')](_0x048f('0x9f'),require('./api/intZendeskConfiguration'));_0x33c097[_0x048f('0x6')]('/api/integrations/zendesk/fields',require(_0x048f('0xa0')));_0x33c097['use'](_0x048f('0xa1'),require('./api/intFreshdeskAccount'));_0x33c097[_0x048f('0x6')](_0x048f('0xa2'),require(_0x048f('0xa3')));_0x33c097[_0x048f('0x6')](_0x048f('0xa4'),require('./api/intFreshdeskField'));_0x33c097['use'](_0x048f('0xa5'),require(_0x048f('0xa6')));_0x33c097[_0x048f('0x6')](_0x048f('0xa7'),require(_0x048f('0xa8')));_0x33c097[_0x048f('0x6')](_0x048f('0xa9'),require('./api/intVtigerField'));_0x33c097[_0x048f('0x6')](_0x048f('0xaa'),require(_0x048f('0xab')));_0x33c097[_0x048f('0x6')]('/api/integrations/servicenow/configurations',require('./api/intServicenowConfiguration'));_0x33c097[_0x048f('0x6')](_0x048f('0xac'),require(_0x048f('0xad')));_0x33c097[_0x048f('0x6')](_0x048f('0xae'),require(_0x048f('0xaf')));_0x33c097['use'](_0x048f('0xb0'),require('./api/intDynamics365Configuration'));_0x33c097[_0x048f('0x6')](_0x048f('0xb1'),require('./api/intDynamics365Field'));_0x33c097['use'](_0x048f('0xb2'),require('./api/intFreshsalesAccount'));_0x33c097['use']('/api/integrations/freshsales/configurations',require(_0x048f('0xb3')));_0x33c097['use'](_0x048f('0xb4'),require(_0x048f('0xb5')));_0x33c097[_0x048f('0x6')](_0x048f('0xb6'),require('./api/network'));_0x33c097['use']('/api/chat/reports/queue',require(_0x048f('0xb7')));_0x33c097[_0x048f('0x6')](_0x048f('0xb8'),require(_0x048f('0xb9')));_0x33c097['use'](_0x048f('0xba'),require('./api/jscriptyAnswerReport'));_0x33c097[_0x048f('0x6')](_0x048f('0xbb'),require(_0x048f('0xbc')));_0x33c097[_0x048f('0x6')](_0x048f('0xbd'),require(_0x048f('0xbe')));_0x33c097[_0x048f('0x6')](_0x048f('0xbf'),require('./api/smsQueueReport'));_0x33c097[_0x048f('0x6')](_0x048f('0xc0'),require(_0x048f('0xc1')));_0x33c097[_0x048f('0x6')]('/api/square/details/reports',require(_0x048f('0xc2')));_0x33c097['use']('/api/jscripty/projects',require('./api/jscriptyProject'));_0x33c097['use']('/api/settings',require(_0x048f('0xc3')));_0x33c097[_0x048f('0x6')](_0x048f('0xc4'),require(_0x048f('0xc5')));_0x33c097['use'](_0x048f('0xc6'),require(_0x048f('0xc7')));_0x33c097[_0x048f('0x6')](_0x048f('0xc8'),require(_0x048f('0xc9')));_0x33c097[_0x048f('0x6')](_0x048f('0xca'),require(_0x048f('0xcb')));_0x33c097[_0x048f('0x6')]('/api/teams',require('./api/team'));_0x33c097[_0x048f('0x6')]('/api/license',require(_0x048f('0xcc')));_0x33c097[_0x048f('0x6')](_0x048f('0xcd'),require(_0x048f('0xce')));_0x33c097[_0x048f('0x6')](_0x048f('0xcf'),require('./api/migration'));_0x33c097[_0x048f('0x6')]('/api/attachments',require('./api/attachment'));_0x33c097[_0x048f('0x6')](_0x048f('0xd0'),require(_0x048f('0xd1')));_0x33c097[_0x048f('0x6')](_0x048f('0xd2'),require('./api/mailTransferReport'));_0x33c097['use']('/api/chat/reports/transfer',require(_0x048f('0xd3')));_0x33c097[_0x048f('0x6')](_0x048f('0xd4'),require(_0x048f('0xd5')));_0x33c097['use'](_0x048f('0xd6'),require(_0x048f('0xd7')));_0x33c097['use'](_0x048f('0xd8'),require(_0x048f('0xd9')));_0x33c097[_0x048f('0x6')](_0x048f('0xda'),require('./api/cmList'));_0x33c097[_0x048f('0x6')]('/api/voice/prefixes',require(_0x048f('0xdb')));_0x33c097[_0x048f('0x6')](_0x048f('0xdc'),require(_0x048f('0xdd')));_0x33c097[_0x048f('0x6')](_0x048f('0xde'),require(_0x048f('0xdf')));_0x33c097[_0x048f('0x6')](_0x048f('0xe0'),require(_0x048f('0xe1')));_0x33c097[_0x048f('0x6')](_0x048f('0xe2'),require(_0x048f('0xe3')));_0x33c097[_0x048f('0x6')](_0x048f('0xe4'),require(_0x048f('0xe5')));_0x33c097[_0x048f('0x6')]('/api/whatsapp/applications',require(_0x048f('0xe6')));_0x33c097[_0x048f('0x6')]('/api/whatsapp/interactions',require(_0x048f('0xe7')));_0x33c097['use'](_0x048f('0xe8'),require(_0x048f('0xe9')));_0x33c097[_0x048f('0x6')](_0x048f('0xea'),require(_0x048f('0xeb')));_0x33c097['use'](_0x048f('0xec'),require('./api/whatsappTransferReport'));_0x33c097[_0x048f('0x6')](_0x048f('0xed'),require('./api/whatsappQueue'));_0x33c097['use'](_0x048f('0xee'),require(_0x048f('0xef')));_0x33c097[_0x048f('0x6')](_0x048f('0xf0'),require(_0x048f('0xf1')));_0x33c097[_0x048f('0x6')]('/api/user-settings',require(_0x048f('0xf2')));_0x33c097[_0x048f('0x6')]('/api/mail_interaction_has_tags',require(_0x048f('0xf3')));_0x33c097[_0x048f('0x6')](_0x048f('0xf4'),require(_0x048f('0xf5')));_0x33c097[_0x048f('0x6')](_0x048f('0xf6'),require('./api/authGoogle'));_0x33c097[_0x048f('0x6')](_0x048f('0xf7'),require('./api/authActiveDirectory'));_0x33c097[_0x048f('0x6')]('/api/jira',require(_0x048f('0xf8')));_0x33c097[_0x048f('0x6')](_0x048f('0xf9'),require(_0x048f('0xfa')));_0x33c097['use'](_0x048f('0xfb'),require(_0x048f('0xfc')));_0x33c097[_0x048f('0x6')](_0x048f('0xfd'),require(_0x048f('0xfe')));_0x33c097[_0x048f('0x6')](_0x048f('0xff'),require(_0x048f('0x100')));_0x33c097['use'](_0x048f('0x101'),require(_0x048f('0x102')));_0x33c097[_0x048f('0x6')](_0x048f('0x103'),clientSideLogs);_0x33c097[_0x048f('0x6')]('/apidoc',express[_0x048f('0x104')](path[_0x048f('0x105')](config['root'],_0x048f('0x106'))));_0x33c097[_0x048f('0x6')](_0x048f('0x107'),express['static'](path[_0x048f('0x105')](config[_0x048f('0x108')],_0x048f('0x107'))));_0x33c097[_0x048f('0x6')](_0x048f('0x109'),express[_0x048f('0x104')](path[_0x048f('0x105')](config[_0x048f('0x108')],_0x048f('0x109'))));_0x33c097[_0x048f('0x6')](_0x048f('0x10a'),express[_0x048f('0x104')](path[_0x048f('0x105')](config['root'],_0x048f('0x10b'),_0x048f('0x10c'))));_0x33c097['use'](_0x048f('0x10d'),express[_0x048f('0x104')](path[_0x048f('0x105')](config[_0x048f('0x108')],_0x048f('0x10e'))));_0x33c097[_0x048f('0x10f')](_0x048f('0x110'))[_0x048f('0x111')](errors[0x194]);_0x33c097['route']('/*')[_0x048f('0x111')](function(_0x4fd7d2,_0x53fc6c){_0x53fc6c['sendFile'](path['resolve'](_0x33c097[_0x048f('0x111')](_0x048f('0x112'))+'/index.html'));});return _0x33c097;});}; \ No newline at end of file +var _0x50eb=['/api/sms/accounts','./api/smsAccount','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','./api/smsMessage','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','./api/openchannelInteraction','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','/api/openchannel/reports/queue','/api/chat/applications','./api/chatApplication','./api/chatInteraction','/api/chat/messages','./api/chatMessage','./api/chatOfflineMessage','/api/chat/queues','/api/chat/groups','./api/chatGroup','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','/api/actions','/api/automations','./api/automation','/api/canned_answers','/api/dispositions','./api/disposition','/api/conditions','./api/condition','./api/interval','/api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','/api/tags','./api/tag','/api/contact_item_types','./api/contactItemType','/api/cm_contact_has_items','./api/cmContactHasItem','/api/cm_hopper_additional_phones','./api/cmHopperAdditionalPhone','/api/templates','./api/template','/api/triggers','./api/trigger','./api/variable','/api/integrations','./api/integration','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','/api/integrations/vtiger/configurations','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','/api/integrations/servicenow/fields','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Field','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','./api/intFreshsalesField','/api/networks','./api/network','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','/api/jscripty/sessions/reports','./api/jscriptySessionReport','./api/smsQueueReport','/api/square/reports','/api/jscripty/projects','./api/jscriptyProject','/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/recordings','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/teams','./api/team','/api/license','/api/campaigns','/api/migrations','./api/attachment','/api/plugins','./api/plugin','./api/mailTransferReport','/api/chat/reports/transfer','/api/fax/reports/transfer','./api/faxTransferReport','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','/api/whatsapp/applications','./api/whatsappInteraction','/api/whatsapp/messages','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','/api/realtime','./api/realtime','/api/user-settings','./api/user-setting','/api/mail_interaction_has_tags','/api/auth/local','./api/authGoogle','/api/auth/activedirectory','./api/authActiveDirectory','/api/jira','./api/jira','/api/rpc','./api/rpc','/api/version','./api/system','/api/pm2','./api/pm2','./api/webbar','/api/logs','/apidoc','static','join','root','/www','/demo','/snippet','snippet','3.9.0','/plugins','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','resolve','appPath','/index.html','path','express','./errors','./utils/client-side-logger','setupLoggers','./api/client-side-logs','default','use','/api/users','./api/user','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/extensions','./api/voiceExtension','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','/api/members/reports','./api/memberReport','/api/trunks','./api/trunk','./api/voiceTransferReport','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','./api/mailMessage','/api/dashboards','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','/api/fax/applications','/api/fax/interactions','./api/faxInteraction','./api/faxMessage','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport'];(function(_0x1af9e4,_0x3ef67f){var _0xd94287=function(_0x2cfb0a){while(--_0x2cfb0a){_0x1af9e4['push'](_0x1af9e4['shift']());}};_0xd94287(++_0x3ef67f);}(_0x50eb,0x1e8));var _0xb50e=function(_0x5cb1af,_0x4bdc8c){_0x5cb1af=_0x5cb1af-0x0;var _0x8d7940=_0x50eb[_0x5cb1af];return _0x8d7940;};'use strict';var path=require(_0xb50e('0x0'));var express=require(_0xb50e('0x1'));var errors=require(_0xb50e('0x2'));var config=require('./config/environment');var setupLoggers=require(_0xb50e('0x3'))[_0xb50e('0x4')];var clientSideLogs=require(_0xb50e('0x5'));exports[_0xb50e('0x6')]=function(_0x1a8daa){return setupLoggers(_0x1a8daa)['then'](function(){_0x1a8daa[_0xb50e('0x7')](_0xb50e('0x8'),require(_0xb50e('0x9')));_0x1a8daa[_0xb50e('0x7')](_0xb50e('0xa'),require(_0xb50e('0xb')));_0x1a8daa[_0xb50e('0x7')]('/api/voice/contexts',require('./api/voiceContext'));_0x1a8daa[_0xb50e('0x7')](_0xb50e('0xc'),require(_0xb50e('0xd')));_0x1a8daa[_0xb50e('0x7')]('/api/voice/mohs',require(_0xb50e('0xe')));_0x1a8daa[_0xb50e('0x7')](_0xb50e('0xf'),require(_0xb50e('0x10')));_0x1a8daa[_0xb50e('0x7')](_0xb50e('0x11'),require(_0xb50e('0x12')));_0x1a8daa[_0xb50e('0x7')](_0xb50e('0x13'),require(_0xb50e('0x14')));_0x1a8daa[_0xb50e('0x7')](_0xb50e('0x15'),require(_0xb50e('0x16')));_0x1a8daa[_0xb50e('0x7')](_0xb50e('0x17'),require(_0xb50e('0x18')));_0x1a8daa['use'](_0xb50e('0x19'),require('./api/voiceCallReport'));_0x1a8daa['use']('/api/voice/dials/reports',require(_0xb50e('0x1a')));_0x1a8daa[_0xb50e('0x7')](_0xb50e('0x1b'),require(_0xb50e('0x1c')));_0x1a8daa[_0xb50e('0x7')](_0xb50e('0x1d'),require('./api/voiceQueueReport'));_0x1a8daa['use'](_0xb50e('0x1e'),require(_0xb50e('0x1f')));_0x1a8daa[_0xb50e('0x7')](_0xb50e('0x20'),require(_0xb50e('0x21')));_0x1a8daa[_0xb50e('0x7')]('/api/voice/transfers/reports',require(_0xb50e('0x22')));_0x1a8daa[_0xb50e('0x7')]('/api/mail/out_servers',require('./api/mailServerOut'));_0x1a8daa[_0xb50e('0x7')](_0xb50e('0x23'),require(_0xb50e('0x24')));_0x1a8daa['use'](_0xb50e('0x25'),require(_0xb50e('0x26')));_0x1a8daa[_0xb50e('0x7')](_0xb50e('0x27'),require(_0xb50e('0x28')));_0x1a8daa[_0xb50e('0x7')](_0xb50e('0x29'),require(_0xb50e('0x2a')));_0x1a8daa[_0xb50e('0x7')](_0xb50e('0x2b'),require(_0xb50e('0x2c')));_0x1a8daa[_0xb50e('0x7')]('/api/mail/applications',require('./api/mailApplication'));_0x1a8daa['use']('/api/mail/reports/queue',require('./api/mailQueueReport'));_0x1a8daa[_0xb50e('0x7')](_0xb50e('0x2d'),require('./api/dashboard'));_0x1a8daa[_0xb50e('0x7')](_0xb50e('0x2e'),require(_0xb50e('0x2f')));_0x1a8daa[_0xb50e('0x7')](_0xb50e('0x30'),require(_0xb50e('0x31')));_0x1a8daa[_0xb50e('0x7')](_0xb50e('0x32'),require('./api/faxApplication'));_0x1a8daa['use'](_0xb50e('0x33'),require(_0xb50e('0x34')));_0x1a8daa['use']('/api/fax/messages',require(_0xb50e('0x35')));_0x1a8daa[_0xb50e('0x7')](_0xb50e('0x36'),require(_0xb50e('0x37')));_0x1a8daa[_0xb50e('0x7')](_0xb50e('0x38'),require(_0xb50e('0x39')));_0x1a8daa[_0xb50e('0x7')](_0xb50e('0x3a'),require(_0xb50e('0x3b')));_0x1a8daa['use']('/api/sms/applications',require(_0xb50e('0x3c')));_0x1a8daa[_0xb50e('0x7')](_0xb50e('0x3d'),require(_0xb50e('0x3e')));_0x1a8daa[_0xb50e('0x7')]('/api/sms/messages',require(_0xb50e('0x3f')));_0x1a8daa['use']('/api/sms/queues',require(_0xb50e('0x40')));_0x1a8daa[_0xb50e('0x7')](_0xb50e('0x41'),require(_0xb50e('0x42')));_0x1a8daa[_0xb50e('0x7')](_0xb50e('0x43'),require(_0xb50e('0x44')));_0x1a8daa['use']('/api/openchannel/interactions',require(_0xb50e('0x45')));_0x1a8daa['use']('/api/openchannel/messages',require('./api/openchannelMessage'));_0x1a8daa['use'](_0xb50e('0x46'),require(_0xb50e('0x47')));_0x1a8daa[_0xb50e('0x7')](_0xb50e('0x48'),require('./api/chatWebsite'));_0x1a8daa['use'](_0xb50e('0x49'),require('./api/openchannelQueueReport'));_0x1a8daa[_0xb50e('0x7')](_0xb50e('0x4a'),require(_0xb50e('0x4b')));_0x1a8daa[_0xb50e('0x7')]('/api/chat/interactions',require(_0xb50e('0x4c')));_0x1a8daa[_0xb50e('0x7')](_0xb50e('0x4d'),require(_0xb50e('0x4e')));_0x1a8daa['use']('/api/chat/offline_messages',require(_0xb50e('0x4f')));_0x1a8daa['use'](_0xb50e('0x50'),require('./api/chatQueue'));_0x1a8daa['use'](_0xb50e('0x51'),require(_0xb50e('0x52')));_0x1a8daa[_0xb50e('0x7')]('/api/chat/proactive_actions',require(_0xb50e('0x53')));_0x1a8daa[_0xb50e('0x7')](_0xb50e('0x54'),require(_0xb50e('0x55')));_0x1a8daa[_0xb50e('0x7')](_0xb50e('0x56'),require('./api/cmContact'));_0x1a8daa['use'](_0xb50e('0x57'),require(_0xb50e('0x58')));_0x1a8daa['use'](_0xb50e('0x59'),require('./api/cmHopperBlack'));_0x1a8daa[_0xb50e('0x7')](_0xb50e('0x5a'),require(_0xb50e('0x5b')));_0x1a8daa[_0xb50e('0x7')](_0xb50e('0x5c'),require(_0xb50e('0x5d')));_0x1a8daa[_0xb50e('0x7')](_0xb50e('0x5e'),require('./api/cmCustomField'));_0x1a8daa[_0xb50e('0x7')](_0xb50e('0x5f'),require('./api/action'));_0x1a8daa[_0xb50e('0x7')](_0xb50e('0x60'),require(_0xb50e('0x61')));_0x1a8daa[_0xb50e('0x7')](_0xb50e('0x62'),require('./api/cannedAnswer'));_0x1a8daa[_0xb50e('0x7')](_0xb50e('0x63'),require(_0xb50e('0x64')));_0x1a8daa['use'](_0xb50e('0x65'),require(_0xb50e('0x66')));_0x1a8daa[_0xb50e('0x7')]('/api/intervals',require(_0xb50e('0x67')));_0x1a8daa[_0xb50e('0x7')]('/api/pauses',require('./api/pause'));_0x1a8daa[_0xb50e('0x7')](_0xb50e('0x68'),require('./api/cdr'));_0x1a8daa['use'](_0xb50e('0x69'),require(_0xb50e('0x6a')));_0x1a8daa[_0xb50e('0x7')](_0xb50e('0x6b'),require(_0xb50e('0x6c')));_0x1a8daa[_0xb50e('0x7')](_0xb50e('0x6d'),require('./api/sound'));_0x1a8daa[_0xb50e('0x7')](_0xb50e('0x6e'),require(_0xb50e('0x6f')));_0x1a8daa[_0xb50e('0x7')](_0xb50e('0x70'),require(_0xb50e('0x71')));_0x1a8daa[_0xb50e('0x7')](_0xb50e('0x72'),require(_0xb50e('0x73')));_0x1a8daa[_0xb50e('0x7')](_0xb50e('0x74'),require(_0xb50e('0x75')));_0x1a8daa['use'](_0xb50e('0x76'),require(_0xb50e('0x77')));_0x1a8daa[_0xb50e('0x7')](_0xb50e('0x78'),require(_0xb50e('0x79')));_0x1a8daa[_0xb50e('0x7')]('/api/variables',require(_0xb50e('0x7a')));_0x1a8daa[_0xb50e('0x7')](_0xb50e('0x7b'),require(_0xb50e('0x7c')));_0x1a8daa[_0xb50e('0x7')]('/api/integrations/reports',require('./api/integrationReport'));_0x1a8daa[_0xb50e('0x7')]('/api/analytics/custom_reports',require('./api/analyticCustomReport'));_0x1a8daa['use']('/api/analytics/default_reports',require(_0xb50e('0x7d')));_0x1a8daa[_0xb50e('0x7')](_0xb50e('0x7e'),require(_0xb50e('0x7f')));_0x1a8daa[_0xb50e('0x7')](_0xb50e('0x80'),require(_0xb50e('0x81')));_0x1a8daa[_0xb50e('0x7')](_0xb50e('0x82'),require(_0xb50e('0x83')));_0x1a8daa[_0xb50e('0x7')](_0xb50e('0x84'),require(_0xb50e('0x85')));_0x1a8daa[_0xb50e('0x7')]('/api/integrations/salesforce/accounts',require(_0xb50e('0x86')));_0x1a8daa[_0xb50e('0x7')](_0xb50e('0x87'),require(_0xb50e('0x88')));_0x1a8daa['use']('/api/integrations/salesforce/fields',require(_0xb50e('0x89')));_0x1a8daa[_0xb50e('0x7')](_0xb50e('0x8a'),require('./api/intSugarcrmAccount'));_0x1a8daa[_0xb50e('0x7')](_0xb50e('0x8b'),require(_0xb50e('0x8c')));_0x1a8daa[_0xb50e('0x7')](_0xb50e('0x8d'),require(_0xb50e('0x8e')));_0x1a8daa[_0xb50e('0x7')](_0xb50e('0x8f'),require(_0xb50e('0x90')));_0x1a8daa['use'](_0xb50e('0x91'),require(_0xb50e('0x92')));_0x1a8daa[_0xb50e('0x7')](_0xb50e('0x93'),require(_0xb50e('0x94')));_0x1a8daa[_0xb50e('0x7')](_0xb50e('0x95'),require(_0xb50e('0x96')));_0x1a8daa[_0xb50e('0x7')](_0xb50e('0x97'),require(_0xb50e('0x98')));_0x1a8daa[_0xb50e('0x7')]('/api/integrations/zoho/fields',require('./api/intZohoField'));_0x1a8daa[_0xb50e('0x7')](_0xb50e('0x99'),require(_0xb50e('0x9a')));_0x1a8daa[_0xb50e('0x7')](_0xb50e('0x9b'),require(_0xb50e('0x9c')));_0x1a8daa[_0xb50e('0x7')](_0xb50e('0x9d'),require(_0xb50e('0x9e')));_0x1a8daa['use']('/api/integrations/freshdesk/accounts',require('./api/intFreshdeskAccount'));_0x1a8daa[_0xb50e('0x7')](_0xb50e('0x9f'),require(_0xb50e('0xa0')));_0x1a8daa['use'](_0xb50e('0xa1'),require(_0xb50e('0xa2')));_0x1a8daa[_0xb50e('0x7')](_0xb50e('0xa3'),require('./api/intVtigerAccount'));_0x1a8daa[_0xb50e('0x7')](_0xb50e('0xa4'),require('./api/intVtigerConfiguration'));_0x1a8daa[_0xb50e('0x7')](_0xb50e('0xa5'),require(_0xb50e('0xa6')));_0x1a8daa[_0xb50e('0x7')](_0xb50e('0xa7'),require(_0xb50e('0xa8')));_0x1a8daa['use'](_0xb50e('0xa9'),require('./api/intServicenowConfiguration'));_0x1a8daa['use'](_0xb50e('0xaa'),require(_0xb50e('0xab')));_0x1a8daa[_0xb50e('0x7')](_0xb50e('0xac'),require(_0xb50e('0xad')));_0x1a8daa[_0xb50e('0x7')](_0xb50e('0xae'),require('./api/intDynamics365Configuration'));_0x1a8daa[_0xb50e('0x7')]('/api/integrations/dynamics365/fields',require(_0xb50e('0xaf')));_0x1a8daa[_0xb50e('0x7')]('/api/integrations/freshsales/accounts',require(_0xb50e('0xb0')));_0x1a8daa[_0xb50e('0x7')](_0xb50e('0xb1'),require(_0xb50e('0xb2')));_0x1a8daa[_0xb50e('0x7')]('/api/integrations/freshsales/fields',require(_0xb50e('0xb3')));_0x1a8daa[_0xb50e('0x7')](_0xb50e('0xb4'),require(_0xb50e('0xb5')));_0x1a8daa[_0xb50e('0x7')](_0xb50e('0xb6'),require(_0xb50e('0xb7')));_0x1a8daa[_0xb50e('0x7')](_0xb50e('0xb8'),require(_0xb50e('0xb9')));_0x1a8daa[_0xb50e('0x7')](_0xb50e('0xba'),require(_0xb50e('0xbb')));_0x1a8daa[_0xb50e('0x7')](_0xb50e('0xbc'),require('./api/jscriptyQuestionReport'));_0x1a8daa[_0xb50e('0x7')](_0xb50e('0xbd'),require(_0xb50e('0xbe')));_0x1a8daa['use']('/api/sms/reports/queue',require(_0xb50e('0xbf')));_0x1a8daa[_0xb50e('0x7')](_0xb50e('0xc0'),require('./api/squareReport'));_0x1a8daa[_0xb50e('0x7')]('/api/square/details/reports',require('./api/squareReportDetail'));_0x1a8daa[_0xb50e('0x7')](_0xb50e('0xc1'),require(_0xb50e('0xc2')));_0x1a8daa[_0xb50e('0x7')]('/api/settings',require('./api/setting'));_0x1a8daa[_0xb50e('0x7')](_0xb50e('0xc3'),require(_0xb50e('0xc4')));_0x1a8daa[_0xb50e('0x7')](_0xb50e('0xc5'),require(_0xb50e('0xc6')));_0x1a8daa[_0xb50e('0x7')](_0xb50e('0xc7'),require(_0xb50e('0xc8')));_0x1a8daa[_0xb50e('0x7')](_0xb50e('0xc9'),require(_0xb50e('0xca')));_0x1a8daa[_0xb50e('0x7')](_0xb50e('0xcb'),require(_0xb50e('0xcc')));_0x1a8daa[_0xb50e('0x7')](_0xb50e('0xcd'),require('./api/license'));_0x1a8daa[_0xb50e('0x7')](_0xb50e('0xce'),require('./api/campaign'));_0x1a8daa['use'](_0xb50e('0xcf'),require('./api/migration'));_0x1a8daa['use']('/api/attachments',require(_0xb50e('0xd0')));_0x1a8daa[_0xb50e('0x7')](_0xb50e('0xd1'),require(_0xb50e('0xd2')));_0x1a8daa[_0xb50e('0x7')]('/api/mail/reports/transfer',require(_0xb50e('0xd3')));_0x1a8daa['use'](_0xb50e('0xd4'),require('./api/chatTransferReport'));_0x1a8daa[_0xb50e('0x7')](_0xb50e('0xd5'),require(_0xb50e('0xd6')));_0x1a8daa['use']('/api/openchannel/reports/transfer',require(_0xb50e('0xd7')));_0x1a8daa[_0xb50e('0x7')](_0xb50e('0xd8'),require('./api/smsTransferReport'));_0x1a8daa[_0xb50e('0x7')]('/api/cm/lists',require(_0xb50e('0xd9')));_0x1a8daa[_0xb50e('0x7')](_0xb50e('0xda'),require(_0xb50e('0xdb')));_0x1a8daa[_0xb50e('0x7')](_0xb50e('0xdc'),require(_0xb50e('0xdd')));_0x1a8daa['use'](_0xb50e('0xde'),require(_0xb50e('0xdf')));_0x1a8daa[_0xb50e('0x7')](_0xb50e('0xe0'),require(_0xb50e('0xe1')));_0x1a8daa[_0xb50e('0x7')](_0xb50e('0xe2'),require(_0xb50e('0xe3')));_0x1a8daa[_0xb50e('0x7')](_0xb50e('0xe4'),require('./api/whatsappAccount'));_0x1a8daa[_0xb50e('0x7')](_0xb50e('0xe5'),require('./api/whatsappApplication'));_0x1a8daa[_0xb50e('0x7')]('/api/whatsapp/interactions',require(_0xb50e('0xe6')));_0x1a8daa[_0xb50e('0x7')](_0xb50e('0xe7'),require('./api/whatsappMessage'));_0x1a8daa[_0xb50e('0x7')](_0xb50e('0xe8'),require(_0xb50e('0xe9')));_0x1a8daa[_0xb50e('0x7')](_0xb50e('0xea'),require(_0xb50e('0xeb')));_0x1a8daa[_0xb50e('0x7')](_0xb50e('0xec'),require('./api/whatsappQueue'));_0x1a8daa[_0xb50e('0x7')]('/api/cloudProviders',require('./api/cloudProvider'));_0x1a8daa[_0xb50e('0x7')](_0xb50e('0xed'),require(_0xb50e('0xee')));_0x1a8daa[_0xb50e('0x7')](_0xb50e('0xef'),require(_0xb50e('0xf0')));_0x1a8daa[_0xb50e('0x7')](_0xb50e('0xf1'),require('./api/mailInteractionHasTag'));_0x1a8daa['use'](_0xb50e('0xf2'),require('./api/authLocal'));_0x1a8daa[_0xb50e('0x7')]('/api/auth/google',require(_0xb50e('0xf3')));_0x1a8daa['use'](_0xb50e('0xf4'),require(_0xb50e('0xf5')));_0x1a8daa[_0xb50e('0x7')](_0xb50e('0xf6'),require(_0xb50e('0xf7')));_0x1a8daa['use'](_0xb50e('0xf8'),require(_0xb50e('0xf9')));_0x1a8daa['use'](_0xb50e('0xfa'),require('./api/version'));_0x1a8daa[_0xb50e('0x7')]('/api/system',require(_0xb50e('0xfb')));_0x1a8daa[_0xb50e('0x7')](_0xb50e('0xfc'),require(_0xb50e('0xfd')));_0x1a8daa['use']('/api/webbar',require(_0xb50e('0xfe')));_0x1a8daa[_0xb50e('0x7')](_0xb50e('0xff'),clientSideLogs);_0x1a8daa[_0xb50e('0x7')](_0xb50e('0x100'),express[_0xb50e('0x101')](path[_0xb50e('0x102')](config[_0xb50e('0x103')],_0xb50e('0x100'))));_0x1a8daa[_0xb50e('0x7')](_0xb50e('0x104'),express[_0xb50e('0x101')](path[_0xb50e('0x102')](config[_0xb50e('0x103')],_0xb50e('0x104'))));_0x1a8daa[_0xb50e('0x7')](_0xb50e('0x105'),express[_0xb50e('0x101')](path['join'](config[_0xb50e('0x103')],_0xb50e('0x105'))));_0x1a8daa['use'](_0xb50e('0x106'),express[_0xb50e('0x101')](path['join'](config[_0xb50e('0x103')],_0xb50e('0x107'),_0xb50e('0x108'))));_0x1a8daa[_0xb50e('0x7')](_0xb50e('0x109'),express[_0xb50e('0x101')](path[_0xb50e('0x102')](config[_0xb50e('0x103')],_0xb50e('0x10a'))));_0x1a8daa[_0xb50e('0x10b')](_0xb50e('0x10c'))[_0xb50e('0x10d')](errors[0x194]);_0x1a8daa[_0xb50e('0x10b')]('/*')[_0xb50e('0x10d')](function(_0x1dbe99,_0x7ab91e){_0x7ab91e['sendFile'](path[_0xb50e('0x10e')](_0x1a8daa[_0xb50e('0x10d')](_0xb50e('0x10f'))+_0xb50e('0x110')));});return _0x1a8daa;});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 697ab5c..5b9eb7f 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbb27=['../api/voiceQueueReport/voiceQueueReport.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/faxAccount/faxAccount.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/smsAccount/smsAccount.rpc','../api/smsMessage/smsMessage.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareMessage/squareMessage.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','rpc','port','localhost','error','../config/triggers','default','RPC\x20listening\x20on\x20','jayson/promise','lodash','listen','merge','../api/voiceExtension/voiceExtension.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbb27,0x1cd));var _0x7bb2=function(_0x30b631,_0x2603ac){_0x30b631=_0x30b631-0x0;var _0x5d4397=_0xbb27[_0x30b631];return _0x5d4397;};'use strict';var jayson=require(_0x7bb2('0x0'));var _=require(_0x7bb2('0x1'));var config=require('../config/environment');exports[_0x7bb2('0x2')]=function(){return new Promise(function(_0x4255ae,_0x4c2226){var _0xddd883={};_0xddd883=_[_0x7bb2('0x3')](_0xddd883,require('../api/user/user.rpc'));_0xddd883=_[_0x7bb2('0x3')](_0xddd883,require(_0x7bb2('0x4')));_0xddd883=_[_0x7bb2('0x3')](_0xddd883,require('../api/voiceQueue/voiceQueue.rpc'));_0xddd883=_[_0x7bb2('0x3')](_0xddd883,require(_0x7bb2('0x5')));_0xddd883=_[_0x7bb2('0x3')](_0xddd883,require(_0x7bb2('0x6')));_0xddd883=_[_0x7bb2('0x3')](_0xddd883,require(_0x7bb2('0x7')));_0xddd883=_['merge'](_0xddd883,require('../api/voiceAgentReport/voiceAgentReport.rpc'));_0xddd883=_[_0x7bb2('0x3')](_0xddd883,require(_0x7bb2('0x8')));_0xddd883=_[_0x7bb2('0x3')](_0xddd883,require('../api/memberReport/memberReport.rpc'));_0xddd883=_[_0x7bb2('0x3')](_0xddd883,require('../api/trunk/trunk.rpc'));_0xddd883=_[_0x7bb2('0x3')](_0xddd883,require(_0x7bb2('0x9')));_0xddd883=_[_0x7bb2('0x3')](_0xddd883,require(_0x7bb2('0xa')));_0xddd883=_[_0x7bb2('0x3')](_0xddd883,require(_0x7bb2('0xb')));_0xddd883=_['merge'](_0xddd883,require(_0x7bb2('0xc')));_0xddd883=_['merge'](_0xddd883,require('../api/mailQueue/mailQueue.rpc'));_0xddd883=_['merge'](_0xddd883,require(_0x7bb2('0xd')));_0xddd883=_['merge'](_0xddd883,require(_0x7bb2('0xe')));_0xddd883=_[_0x7bb2('0x3')](_0xddd883,require(_0x7bb2('0xf')));_0xddd883=_['merge'](_0xddd883,require('../api/mailQueueReport/mailQueueReport.rpc'));_0xddd883=_[_0x7bb2('0x3')](_0xddd883,require(_0x7bb2('0x10')));_0xddd883=_[_0x7bb2('0x3')](_0xddd883,require('../api/faxApplication/faxApplication.rpc'));_0xddd883=_[_0x7bb2('0x3')](_0xddd883,require(_0x7bb2('0x11')));_0xddd883=_['merge'](_0xddd883,require(_0x7bb2('0x12')));_0xddd883=_[_0x7bb2('0x3')](_0xddd883,require(_0x7bb2('0x13')));_0xddd883=_['merge'](_0xddd883,require('../api/faxQueueReport/faxQueueReport.rpc'));_0xddd883=_[_0x7bb2('0x3')](_0xddd883,require(_0x7bb2('0x14')));_0xddd883=_[_0x7bb2('0x3')](_0xddd883,require('../api/smsInteraction/smsInteraction.rpc'));_0xddd883=_[_0x7bb2('0x3')](_0xddd883,require(_0x7bb2('0x15')));_0xddd883=_[_0x7bb2('0x3')](_0xddd883,require('../api/smsQueue/smsQueue.rpc'));_0xddd883=_['merge'](_0xddd883,require(_0x7bb2('0x16')));_0xddd883=_['merge'](_0xddd883,require(_0x7bb2('0x17')));_0xddd883=_[_0x7bb2('0x3')](_0xddd883,require('../api/openchannelMessage/openchannelMessage.rpc'));_0xddd883=_[_0x7bb2('0x3')](_0xddd883,require('../api/openchannelQueue/openchannelQueue.rpc'));_0xddd883=_[_0x7bb2('0x3')](_0xddd883,require(_0x7bb2('0x18')));_0xddd883=_[_0x7bb2('0x3')](_0xddd883,require(_0x7bb2('0x19')));_0xddd883=_[_0x7bb2('0x3')](_0xddd883,require(_0x7bb2('0x1a')));_0xddd883=_[_0x7bb2('0x3')](_0xddd883,require(_0x7bb2('0x1b')));_0xddd883=_[_0x7bb2('0x3')](_0xddd883,require('../api/cmContact/cmContact.rpc'));_0xddd883=_[_0x7bb2('0x3')](_0xddd883,require(_0x7bb2('0x1c')));_0xddd883=_[_0x7bb2('0x3')](_0xddd883,require(_0x7bb2('0x1d')));_0xddd883=_[_0x7bb2('0x3')](_0xddd883,require(_0x7bb2('0x1e')));_0xddd883=_['merge'](_0xddd883,require('../api/cmHopperHistory/cmHopperHistory.rpc'));_0xddd883=_[_0x7bb2('0x3')](_0xddd883,require(_0x7bb2('0x1f')));_0xddd883=_['merge'](_0xddd883,require(_0x7bb2('0x20')));_0xddd883=_[_0x7bb2('0x3')](_0xddd883,require(_0x7bb2('0x21')));_0xddd883=_['merge'](_0xddd883,require('../api/sound/sound.rpc'));_0xddd883=_['merge'](_0xddd883,require(_0x7bb2('0x22')));_0xddd883=_[_0x7bb2('0x3')](_0xddd883,require(_0x7bb2('0x23')));_0xddd883=_['merge'](_0xddd883,require(_0x7bb2('0x24')));_0xddd883=_[_0x7bb2('0x3')](_0xddd883,require('../api/variable/variable.rpc'));_0xddd883=_[_0x7bb2('0x3')](_0xddd883,require(_0x7bb2('0x25')));_0xddd883=_[_0x7bb2('0x3')](_0xddd883,require(_0x7bb2('0x26')));_0xddd883=_[_0x7bb2('0x3')](_0xddd883,require(_0x7bb2('0x27')));_0xddd883=_[_0x7bb2('0x3')](_0xddd883,require(_0x7bb2('0x28')));_0xddd883=_[_0x7bb2('0x3')](_0xddd883,require(_0x7bb2('0x29')));_0xddd883=_[_0x7bb2('0x3')](_0xddd883,require(_0x7bb2('0x2a')));_0xddd883=_[_0x7bb2('0x3')](_0xddd883,require(_0x7bb2('0x2b')));_0xddd883=_[_0x7bb2('0x3')](_0xddd883,require(_0x7bb2('0x2c')));_0xddd883=_[_0x7bb2('0x3')](_0xddd883,require(_0x7bb2('0x2d')));_0xddd883=_[_0x7bb2('0x3')](_0xddd883,require(_0x7bb2('0x2e')));_0xddd883=_[_0x7bb2('0x3')](_0xddd883,require(_0x7bb2('0x2f')));_0xddd883=_[_0x7bb2('0x3')](_0xddd883,require('../api/smsQueueReport/smsQueueReport.rpc'));_0xddd883=_[_0x7bb2('0x3')](_0xddd883,require(_0x7bb2('0x30')));_0xddd883=_['merge'](_0xddd883,require(_0x7bb2('0x31')));_0xddd883=_[_0x7bb2('0x3')](_0xddd883,require('../api/setting/setting.rpc'));_0xddd883=_['merge'](_0xddd883,require(_0x7bb2('0x32')));_0xddd883=_['merge'](_0xddd883,require(_0x7bb2('0x33')));_0xddd883=_[_0x7bb2('0x3')](_0xddd883,require('../api/squareRecording/squareRecording.rpc'));_0xddd883=_['merge'](_0xddd883,require(_0x7bb2('0x34')));_0xddd883=_[_0x7bb2('0x3')](_0xddd883,require('../api/campaign/campaign.rpc'));_0xddd883=_[_0x7bb2('0x3')](_0xddd883,require(_0x7bb2('0x35')));_0xddd883=_[_0x7bb2('0x3')](_0xddd883,require(_0x7bb2('0x36')));_0xddd883=_['merge'](_0xddd883,require('../api/whatsappAccount/whatsappAccount.rpc'));_0xddd883=_[_0x7bb2('0x3')](_0xddd883,require(_0x7bb2('0x37')));_0xddd883=_[_0x7bb2('0x3')](_0xddd883,require(_0x7bb2('0x38')));_0xddd883=_['merge'](_0xddd883,require(_0x7bb2('0x39')));_0xddd883=_[_0x7bb2('0x3')](_0xddd883,require(_0x7bb2('0x3a')));var _0x315886=jayson[_0x7bb2('0x3b')](_0xddd883)['http']();var _0x260d42=config[_0x7bb2('0x3c')]['port']||config[_0x7bb2('0x3d')]+0x1;var _0x5c8323=config[_0x7bb2('0x3c')]['ip']||_0x7bb2('0x3e');_0x315886['on'](_0x7bb2('0x3f'),function(_0x4a00bf){return _0x4c2226(_0x4a00bf);});_0x315886[_0x7bb2('0x2')](_0x260d42,_0x5c8323,function(){console['log']('Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!',_0x5c8323,_0x260d42);require(_0x7bb2('0x40'))[_0x7bb2('0x41')]();return _0x4255ae(_0x7bb2('0x42')+_0x5c8323+':'+_0x260d42);});});}; \ No newline at end of file +var _0x4d33=['../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.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/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','port','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','RPC\x20listening\x20on\x20','jayson/promise','lodash','listen','merge','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailApplication/mailApplication.rpc','../api/faxAccount/faxAccount.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelMessage/openchannelMessage.rpc'];(function(_0x568801,_0x3dda0a){var _0x156d12=function(_0x41f223){while(--_0x41f223){_0x568801['push'](_0x568801['shift']());}};_0x156d12(++_0x3dda0a);}(_0x4d33,0x140));var _0x34d3=function(_0x14d896,_0x53578b){_0x14d896=_0x14d896-0x0;var _0x28679a=_0x4d33[_0x14d896];return _0x28679a;};'use strict';var jayson=require(_0x34d3('0x0'));var _=require(_0x34d3('0x1'));var config=require('../config/environment');exports[_0x34d3('0x2')]=function(){return new Promise(function(_0x3201e1,_0x3fc108){var _0x244b14={};_0x244b14=_[_0x34d3('0x3')](_0x244b14,require('../api/user/user.rpc'));_0x244b14=_['merge'](_0x244b14,require(_0x34d3('0x4')));_0x244b14=_[_0x34d3('0x3')](_0x244b14,require(_0x34d3('0x5')));_0x244b14=_[_0x34d3('0x3')](_0x244b14,require('../api/voiceRecording/voiceRecording.rpc'));_0x244b14=_[_0x34d3('0x3')](_0x244b14,require(_0x34d3('0x6')));_0x244b14=_['merge'](_0x244b14,require(_0x34d3('0x7')));_0x244b14=_[_0x34d3('0x3')](_0x244b14,require('../api/voiceAgentReport/voiceAgentReport.rpc'));_0x244b14=_['merge'](_0x244b14,require(_0x34d3('0x8')));_0x244b14=_['merge'](_0x244b14,require('../api/memberReport/memberReport.rpc'));_0x244b14=_['merge'](_0x244b14,require(_0x34d3('0x9')));_0x244b14=_[_0x34d3('0x3')](_0x244b14,require(_0x34d3('0xa')));_0x244b14=_['merge'](_0x244b14,require(_0x34d3('0xb')));_0x244b14=_[_0x34d3('0x3')](_0x244b14,require(_0x34d3('0xc')));_0x244b14=_['merge'](_0x244b14,require('../api/mailAccount/mailAccount.rpc'));_0x244b14=_[_0x34d3('0x3')](_0x244b14,require(_0x34d3('0xd')));_0x244b14=_['merge'](_0x244b14,require(_0x34d3('0xe')));_0x244b14=_[_0x34d3('0x3')](_0x244b14,require('../api/mailMessage/mailMessage.rpc'));_0x244b14=_['merge'](_0x244b14,require(_0x34d3('0xf')));_0x244b14=_['merge'](_0x244b14,require('../api/mailQueueReport/mailQueueReport.rpc'));_0x244b14=_[_0x34d3('0x3')](_0x244b14,require(_0x34d3('0x10')));_0x244b14=_[_0x34d3('0x3')](_0x244b14,require('../api/faxApplication/faxApplication.rpc'));_0x244b14=_[_0x34d3('0x3')](_0x244b14,require(_0x34d3('0x11')));_0x244b14=_[_0x34d3('0x3')](_0x244b14,require(_0x34d3('0x12')));_0x244b14=_[_0x34d3('0x3')](_0x244b14,require('../api/faxQueue/faxQueue.rpc'));_0x244b14=_['merge'](_0x244b14,require('../api/faxQueueReport/faxQueueReport.rpc'));_0x244b14=_[_0x34d3('0x3')](_0x244b14,require(_0x34d3('0x13')));_0x244b14=_[_0x34d3('0x3')](_0x244b14,require(_0x34d3('0x14')));_0x244b14=_[_0x34d3('0x3')](_0x244b14,require(_0x34d3('0x15')));_0x244b14=_[_0x34d3('0x3')](_0x244b14,require(_0x34d3('0x16')));_0x244b14=_[_0x34d3('0x3')](_0x244b14,require(_0x34d3('0x17')));_0x244b14=_['merge'](_0x244b14,require('../api/openchannelInteraction/openchannelInteraction.rpc'));_0x244b14=_[_0x34d3('0x3')](_0x244b14,require(_0x34d3('0x18')));_0x244b14=_[_0x34d3('0x3')](_0x244b14,require(_0x34d3('0x19')));_0x244b14=_[_0x34d3('0x3')](_0x244b14,require(_0x34d3('0x1a')));_0x244b14=_[_0x34d3('0x3')](_0x244b14,require('../api/chatInteraction/chatInteraction.rpc'));_0x244b14=_['merge'](_0x244b14,require(_0x34d3('0x1b')));_0x244b14=_[_0x34d3('0x3')](_0x244b14,require(_0x34d3('0x1c')));_0x244b14=_[_0x34d3('0x3')](_0x244b14,require(_0x34d3('0x1d')));_0x244b14=_[_0x34d3('0x3')](_0x244b14,require(_0x34d3('0x1e')));_0x244b14=_[_0x34d3('0x3')](_0x244b14,require(_0x34d3('0x1f')));_0x244b14=_[_0x34d3('0x3')](_0x244b14,require(_0x34d3('0x20')));_0x244b14=_[_0x34d3('0x3')](_0x244b14,require(_0x34d3('0x21')));_0x244b14=_[_0x34d3('0x3')](_0x244b14,require('../api/reportAgentPreview/reportAgentPreview.rpc'));_0x244b14=_[_0x34d3('0x3')](_0x244b14,require(_0x34d3('0x22')));_0x244b14=_[_0x34d3('0x3')](_0x244b14,require(_0x34d3('0x23')));_0x244b14=_[_0x34d3('0x3')](_0x244b14,require(_0x34d3('0x24')));_0x244b14=_['merge'](_0x244b14,require(_0x34d3('0x25')));_0x244b14=_['merge'](_0x244b14,require(_0x34d3('0x26')));_0x244b14=_[_0x34d3('0x3')](_0x244b14,require(_0x34d3('0x27')));_0x244b14=_[_0x34d3('0x3')](_0x244b14,require(_0x34d3('0x28')));_0x244b14=_[_0x34d3('0x3')](_0x244b14,require(_0x34d3('0x29')));_0x244b14=_['merge'](_0x244b14,require(_0x34d3('0x2a')));_0x244b14=_[_0x34d3('0x3')](_0x244b14,require(_0x34d3('0x2b')));_0x244b14=_[_0x34d3('0x3')](_0x244b14,require(_0x34d3('0x2c')));_0x244b14=_[_0x34d3('0x3')](_0x244b14,require('../api/intZendeskAccount/intZendeskAccount.rpc'));_0x244b14=_[_0x34d3('0x3')](_0x244b14,require('../api/intFreshdeskAccount/intFreshdeskAccount.rpc'));_0x244b14=_[_0x34d3('0x3')](_0x244b14,require(_0x34d3('0x2d')));_0x244b14=_[_0x34d3('0x3')](_0x244b14,require(_0x34d3('0x2e')));_0x244b14=_['merge'](_0x244b14,require(_0x34d3('0x2f')));_0x244b14=_[_0x34d3('0x3')](_0x244b14,require('../api/intFreshsalesAccount/intFreshsalesAccount.rpc'));_0x244b14=_[_0x34d3('0x3')](_0x244b14,require(_0x34d3('0x30')));_0x244b14=_[_0x34d3('0x3')](_0x244b14,require(_0x34d3('0x31')));_0x244b14=_[_0x34d3('0x3')](_0x244b14,require('../api/squareReport/squareReport.rpc'));_0x244b14=_[_0x34d3('0x3')](_0x244b14,require(_0x34d3('0x32')));_0x244b14=_[_0x34d3('0x3')](_0x244b14,require(_0x34d3('0x33')));_0x244b14=_[_0x34d3('0x3')](_0x244b14,require(_0x34d3('0x34')));_0x244b14=_['merge'](_0x244b14,require(_0x34d3('0x35')));_0x244b14=_[_0x34d3('0x3')](_0x244b14,require(_0x34d3('0x36')));_0x244b14=_[_0x34d3('0x3')](_0x244b14,require(_0x34d3('0x37')));_0x244b14=_[_0x34d3('0x3')](_0x244b14,require(_0x34d3('0x38')));_0x244b14=_[_0x34d3('0x3')](_0x244b14,require(_0x34d3('0x39')));_0x244b14=_[_0x34d3('0x3')](_0x244b14,require(_0x34d3('0x3a')));_0x244b14=_[_0x34d3('0x3')](_0x244b14,require(_0x34d3('0x3b')));_0x244b14=_[_0x34d3('0x3')](_0x244b14,require(_0x34d3('0x3c')));_0x244b14=_[_0x34d3('0x3')](_0x244b14,require('../api/whatsappMessage/whatsappMessage.rpc'));_0x244b14=_[_0x34d3('0x3')](_0x244b14,require(_0x34d3('0x3d')));_0x244b14=_[_0x34d3('0x3')](_0x244b14,require(_0x34d3('0x3e')));var _0x36cbab=jayson[_0x34d3('0x3f')](_0x244b14)['http']();var _0x13fbe9=config['rpc']['port']||config[_0x34d3('0x40')]+0x1;var _0x5618b9=config['rpc']['ip']||'localhost';_0x36cbab['on']('error',function(_0x599bba){return _0x3fc108(_0x599bba);});_0x36cbab['listen'](_0x13fbe9,_0x5618b9,function(){console['log'](_0x34d3('0x41'),_0x5618b9,_0x13fbe9);require(_0x34d3('0x42'))[_0x34d3('0x43')]();return _0x3201e1(_0x34d3('0x44')+_0x5618b9+':'+_0x13fbe9);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index 97bfa5a..2bc4ddd 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 _0xecb2=['SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','isBoolean','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','SAY\x20NUMBER\x20%s\x20%s','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','extension','GET\x20VARIABLE\x20\x22%s\x22','recordFile','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','AGI','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','util','EventEmitter','call','setEncoding','utf8','headers','ready','line','hangup','emit','substring','520-Invalid','520\x20End\x20of\x20proper','function','no\x20code','replace','result=','substr','indexOf','startsWith','split','length','match','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','command','write','inherits','prototype','answer','sendRequest','ANSWER','getData','beep','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','setContext','setExtension'];(function(_0x416305,_0x4af117){var _0x2279ee=function(_0x3ca419){while(--_0x3ca419){_0x416305['push'](_0x416305['shift']());}};_0x2279ee(++_0x4af117);}(_0xecb2,0xf6));var _0x2ecb=function(_0x5bf03b,_0x5dea4b){_0x5bf03b=_0x5bf03b-0x0;var _0x58d957=_0xecb2[_0x5bf03b];return _0x58d957;};'use strict';var util=require(_0x2ecb('0x0'));var _=require('lodash');var EventEmitter=require('events')[_0x2ecb('0x1')];var AGIReply=require('./reply');var AGIError=require('./error');function AGIChannel(_0x1bb230){var _0x2f3639=this,_0x393e7c=new AGIReply(),_0x2a4fe5=![],_0x1d007c={};EventEmitter[_0x2ecb('0x2')](_0x2f3639);_0x1bb230['setEncoding']('utf8');_0x1bb230['setTimeout'](0x8*0x3c*0x3c*0x3e8);_0x393e7c[_0x2ecb('0x3')](_0x2ecb('0x4'));_0x393e7c['on'](_0x2ecb('0x5'),function(_0x3bd683){for(var _0x40d20a in _0x3bd683){_0x2f3639[_0x40d20a]=_0x3bd683[_0x40d20a];}_0x2f3639['emit'](_0x2ecb('0x6'));});_0x393e7c['on'](_0x2ecb('0x7'),function(_0x35755){if(_0x35755['toLowerCase']()==_0x2ecb('0x8')){_0x2f3639[_0x2ecb('0x9')](_0x2ecb('0x8'));return;}if(_0x35755[_0x2ecb('0xa')](0x0,0xb)==_0x2ecb('0xb')){_0x2a4fe5=!![];}if(_0x2a4fe5){_0x1d007c['rx']+=_0x35755+'\x0a';if(_0x35755['search'](_0x2ecb('0xc'))!=-0x1){_0x2a4fe5=![];}}else{_0x1d007c['rx']=_0x35755;}if(_0x2a4fe5){return;}if(typeof _0x1d007c['cb']==_0x2ecb('0xd')){var _0x3d74b3=_0x1d007c['rx'][_0x2ecb('0xa')](0x0,0x3),_0x29cb3d=null,_0x59568c=null;_0x3d74b3=parseInt(_0x3d74b3);if(isNaN(_0x3d74b3)){_0x1d007c['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x2ecb('0xe')});return;}if(_0x3d74b3!=0xc8){_0x1d007c['cb'](null,{'code':_0x3d74b3,'result':-0x1,'extra':'KO'});return;}_0x29cb3d=_0x1d007c['rx']['substring'](0x4)[_0x2ecb('0xf')](_0x2ecb('0x10'),'');if(_0x29cb3d['indexOf']('\x20')!=-0x1){_0x29cb3d=_0x29cb3d[_0x2ecb('0x11')](0x0,_0x29cb3d[_0x2ecb('0x12')]('\x20'));}if(_[_0x2ecb('0x13')](_0x29cb3d,'-1')){_0x29cb3d=parseInt(_0x29cb3d);}_0x59568c=_0x1d007c['rx'][_0x2ecb('0x14')]('\x20');if(_0x59568c[_0x2ecb('0x15')]==0x3){_0x59568c=_0x59568c[0x2][_0x2ecb('0xa')](0x1,_0x59568c[0x2][_0x2ecb('0x15')]-0x1);}else if(_0x59568c[_0x2ecb('0x15')]>0x3){var _0x662ef2=/\((.+)\)/;var _0x5ade76=_0x1d007c['rx'][_0x2ecb('0x16')](_0x662ef2);if(_0x5ade76){_0x59568c=_0x5ade76[0x1];}else{_0x59568c=null;}}else{_0x59568c=null;}_0x1d007c['cb'](null,{'code':_0x3d74b3,'result':_0x29cb3d,'extra':_0x59568c});}});_0x1bb230['on'](_0x2ecb('0x17'),function(_0x5a1d41){_0x2f3639[_0x2ecb('0x9')]('error',new AGIError(_0x2ecb('0x18'),_0x5a1d41[_0x2ecb('0x19')]));});_0x1bb230['on'](_0x2ecb('0x1a'),function(){_0x2f3639[_0x2ecb('0x9')](_0x2ecb('0x1a'),new AGIError(_0x2ecb('0x1b')));});_0x1bb230['on'](_0x2ecb('0x1c'),function(){_0x2f3639['emit'](_0x2ecb('0x1c'),new AGIError(_0x2ecb('0x1d')));_0x1bb230[_0x2ecb('0x1e')]();});_0x1bb230['pipe'](_0x393e7c);this[_0x2ecb('0x1f')]=function(_0x2b7aae,_0x4e3d3c){var _0x2b7aae=_0x2b7aae||'',_0x4e3d3c=typeof _0x4e3d3c=='function'?_0x4e3d3c:new Function();_0x1d007c={'tx':_0x2b7aae,'rx':'','cb':_0x4e3d3c};_0x1bb230[_0x2ecb('0x20')](_0x2b7aae+'\x0a');},this[_0x2ecb('0x1a')]=function(){_0x1bb230[_0x2ecb('0x1e')]();};}util[_0x2ecb('0x21')](AGIChannel,EventEmitter);AGIChannel[_0x2ecb('0x22')]['sendRequest']=function(_0x5208f2){return this[_0x2ecb('0x1f')]['sync'](this,_0x5208f2);};AGIChannel[_0x2ecb('0x22')][_0x2ecb('0x23')]=function(){return this[_0x2ecb('0x24')](_0x2ecb('0x25'));};AGIChannel[_0x2ecb('0x22')][_0x2ecb('0x26')]=function(_0x171259,_0x33695a,_0x28ee7a){_0x171259=_0x171259===undefined?_0x2ecb('0x27'):_0x171259;_0x33695a=_0x33695a===undefined?'5':_0x33695a;_0x28ee7a=_0x28ee7a===undefined?'1':_0x28ee7a;return this[_0x2ecb('0x24')](util[_0x2ecb('0x28')](_0x2ecb('0x29'),_0x171259,_0x33695a*0x3e8,_0x28ee7a));};AGIChannel[_0x2ecb('0x22')][_0x2ecb('0x2a')]=function(_0x45059a){_0x45059a=_0x45059a||_0x2ecb('0x2b');return this[_0x2ecb('0x24')](util[_0x2ecb('0x28')](_0x2ecb('0x2c'),_0x45059a));};AGIChannel[_0x2ecb('0x22')][_0x2ecb('0x2d')]=function(_0x4cfa56,_0x52f9f4){if(_[_0x2ecb('0x2e')](_0x52f9f4)){return this[_0x2ecb('0x24')](util[_0x2ecb('0x28')](_0x2ecb('0x2f'),_0x4cfa56,_0x52f9f4['join'](',')));}return this[_0x2ecb('0x24')](util[_0x2ecb('0x28')](_0x2ecb('0x2f'),_0x4cfa56,_0x52f9f4));};AGIChannel[_0x2ecb('0x22')][_0x2ecb('0x30')]=function(_0x1d6b16){return this['sendRequest'](util[_0x2ecb('0x28')]('SET\x20CONTEXT\x20%s',_0x1d6b16));};AGIChannel[_0x2ecb('0x22')][_0x2ecb('0x31')]=function(_0x1db70c){return this[_0x2ecb('0x24')](util[_0x2ecb('0x28')](_0x2ecb('0x32'),_0x1db70c));};AGIChannel[_0x2ecb('0x22')][_0x2ecb('0x33')]=function(_0x2132ec){return this['sendRequest'](util[_0x2ecb('0x28')](_0x2ecb('0x34'),_0x2132ec));};AGIChannel[_0x2ecb('0x22')]['hangup']=function(){return this[_0x2ecb('0x24')](_0x2ecb('0x35'));};AGIChannel[_0x2ecb('0x22')]['setVariable']=function(_0x1f75b7,_0x527e16){var _0x2a98b3=_[_0x2ecb('0x36')](_0x527e16)||_[_0x2ecb('0x37')](_0x527e16)?_0x527e16[_0x2ecb('0x38')]():_0x527e16;return this[_0x2ecb('0x24')](util[_0x2ecb('0x28')](_0x2ecb('0x39'),_0x1f75b7,_0x2a98b3?_0x2a98b3[_0x2ecb('0x38')]()['replace'](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x2ecb('0x22')]['sayNumber']=function(_0x119049,_0xb51d2c){return this[_0x2ecb('0x24')](util[_0x2ecb('0x28')](_0x2ecb('0x3a'),_0x119049,_0xb51d2c));};AGIChannel[_0x2ecb('0x22')]['sayDigits']=function(_0x259c6b,_0x2f8f8c){return this[_0x2ecb('0x24')](util[_0x2ecb('0x28')](_0x2ecb('0x3b'),_0x259c6b,_0x2f8f8c));};AGIChannel[_0x2ecb('0x22')][_0x2ecb('0x3c')]=function(_0x361bde,_0x45e208){return this[_0x2ecb('0x24')](util[_0x2ecb('0x28')](_0x2ecb('0x3d'),_0x361bde,_0x45e208));};AGIChannel[_0x2ecb('0x22')]['continueAt']=function(_0x466e71,_0x5944a0,_0x4a8899){_0x5944a0=_0x5944a0||this[_0x2ecb('0x3e')];_0x4a8899=_0x4a8899||0x1;this[_0x2ecb('0x30')](_0x466e71);this[_0x2ecb('0x31')](_0x5944a0);this[_0x2ecb('0x33')](_0x4a8899);return this['noop'](util['format']('GOTO\x20%s\x20%s\x20%s',_0x466e71,_0x5944a0,_0x4a8899));};AGIChannel[_0x2ecb('0x22')]['getVariable']=function(_0x5d566e){return this[_0x2ecb('0x24')](util[_0x2ecb('0x28')](_0x2ecb('0x3f'),_0x5d566e));};AGIChannel[_0x2ecb('0x22')][_0x2ecb('0x40')]=function(_0x2298c9,_0xfcdbbb,_0x35001f,_0x227c25,_0xaa3890,_0x2060f3){_0xfcdbbb=_0xfcdbbb||'wav';_0x35001f=_0x35001f||'';_0x227c25=_0x227c25===undefined?-0x1:_0x227c25==='-1'?-0x1:_0x227c25*0x3e8;_0xaa3890=_0xaa3890===undefined?'':'s='+_0xaa3890;_0x2060f3=_0x2060f3?_0x2ecb('0x41'):'';return this[_0x2ecb('0x24')](util['format'](_0x2ecb('0x42'),_0x2298c9,_0xfcdbbb,_0x35001f,_0x227c25,_0x2060f3,_0xaa3890));};AGIChannel[_0x2ecb('0x22')][_0x2ecb('0x43')]=function(_0x4cf017,_0x504a32){_0x504a32=_0x504a32||'';return this[_0x2ecb('0x24')](util[_0x2ecb('0x28')](_0x2ecb('0x44'),_0x4cf017,_0x504a32));};AGIChannel[_0x2ecb('0x22')]['agi']=function(_0x18f322){return this[_0x2ecb('0x2d')](_0x2ecb('0x45'),_0x18f322);};AGIChannel[_0x2ecb('0x22')][_0x2ecb('0x46')]=function(_0x4f15dc){return this[_0x2ecb('0x2d')](_0x2ecb('0x47'),_0x4f15dc);};AGIChannel[_0x2ecb('0x22')][_0x2ecb('0x17')]=function(_0x58a788,_0x6cb307){this['noop'](util[_0x2ecb('0x28')](_0x2ecb('0x48'),_0x58a788['id'],_0x58a788[_0x2ecb('0x49')],_0x6cb307));return{'code':0x1f4,'result':'-1','extra':''};};module['exports']=AGIChannel; \ No newline at end of file +var _0x22e3=['GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','agi','exec','AGI','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','util','lodash','events','./reply','./error','call','utf8','setTimeout','setEncoding','headers','emit','ready','toLowerCase','search','520\x20End\x20of\x20proper','no\x20code','substring','replace','result=','indexOf','startsWith','length','match','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','command','function','inherits','prototype','answer','sendRequest','getData','beep','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','isArray','EXEC\x20%s\x20%s','setContext','setExtension','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','GOTO\x20%s\x20%s\x20%s','getVariable'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x22e3,0xf3));var _0x322e=function(_0x561101,_0x4fc7fc){_0x561101=_0x561101-0x0;var _0x3a587a=_0x22e3[_0x561101];return _0x3a587a;};'use strict';var util=require(_0x322e('0x0'));var _=require(_0x322e('0x1'));var EventEmitter=require(_0x322e('0x2'))['EventEmitter'];var AGIReply=require(_0x322e('0x3'));var AGIError=require(_0x322e('0x4'));function AGIChannel(_0x4b9e7f){var _0x3f16fd=this,_0x2d8822=new AGIReply(),_0x115e3c=![],_0x371172={};EventEmitter[_0x322e('0x5')](_0x3f16fd);_0x4b9e7f['setEncoding'](_0x322e('0x6'));_0x4b9e7f[_0x322e('0x7')](0x8*0x3c*0x3c*0x3e8);_0x2d8822[_0x322e('0x8')](_0x322e('0x6'));_0x2d8822['on'](_0x322e('0x9'),function(_0x3cbb57){for(var _0x17cf99 in _0x3cbb57){_0x3f16fd[_0x17cf99]=_0x3cbb57[_0x17cf99];}_0x3f16fd[_0x322e('0xa')](_0x322e('0xb'));});_0x2d8822['on']('line',function(_0x4efb79){if(_0x4efb79[_0x322e('0xc')]()=='hangup'){_0x3f16fd[_0x322e('0xa')]('hangup');return;}if(_0x4efb79['substring'](0x0,0xb)=='520-Invalid'){_0x115e3c=!![];}if(_0x115e3c){_0x371172['rx']+=_0x4efb79+'\x0a';if(_0x4efb79[_0x322e('0xd')](_0x322e('0xe'))!=-0x1){_0x115e3c=![];}}else{_0x371172['rx']=_0x4efb79;}if(_0x115e3c){return;}if(typeof _0x371172['cb']=='function'){var _0x3f4694=_0x371172['rx']['substring'](0x0,0x3),_0x43937a=null,_0xe93e0d=null;_0x3f4694=parseInt(_0x3f4694);if(isNaN(_0x3f4694)){_0x371172['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x322e('0xf')});return;}if(_0x3f4694!=0xc8){_0x371172['cb'](null,{'code':_0x3f4694,'result':-0x1,'extra':'KO'});return;}_0x43937a=_0x371172['rx'][_0x322e('0x10')](0x4)[_0x322e('0x11')](_0x322e('0x12'),'');if(_0x43937a['indexOf']('\x20')!=-0x1){_0x43937a=_0x43937a['substr'](0x0,_0x43937a[_0x322e('0x13')]('\x20'));}if(_[_0x322e('0x14')](_0x43937a,'-1')){_0x43937a=parseInt(_0x43937a);}_0xe93e0d=_0x371172['rx']['split']('\x20');if(_0xe93e0d[_0x322e('0x15')]==0x3){_0xe93e0d=_0xe93e0d[0x2][_0x322e('0x10')](0x1,_0xe93e0d[0x2][_0x322e('0x15')]-0x1);}else if(_0xe93e0d[_0x322e('0x15')]>0x3){var _0x119c2b=/\((.+)\)/;var _0x5b9e16=_0x371172['rx'][_0x322e('0x16')](_0x119c2b);if(_0x5b9e16){_0xe93e0d=_0x5b9e16[0x1];}else{_0xe93e0d=null;}}else{_0xe93e0d=null;}_0x371172['cb'](null,{'code':_0x3f4694,'result':_0x43937a,'extra':_0xe93e0d});}});_0x4b9e7f['on'](_0x322e('0x17'),function(_0x340f78){_0x3f16fd[_0x322e('0xa')]('error',new AGIError(_0x322e('0x18'),_0x340f78[_0x322e('0x19')]));});_0x4b9e7f['on'](_0x322e('0x1a'),function(){_0x3f16fd[_0x322e('0xa')](_0x322e('0x1a'),new AGIError(_0x322e('0x1b')));});_0x4b9e7f['on'](_0x322e('0x1c'),function(){_0x3f16fd[_0x322e('0xa')]('timeout',new AGIError(_0x322e('0x1d')));_0x4b9e7f[_0x322e('0x1e')]();});_0x4b9e7f[_0x322e('0x1f')](_0x2d8822);this[_0x322e('0x20')]=function(_0x2e1ea7,_0x8a7a7f){var _0x2e1ea7=_0x2e1ea7||'',_0x8a7a7f=typeof _0x8a7a7f==_0x322e('0x21')?_0x8a7a7f:new Function();_0x371172={'tx':_0x2e1ea7,'rx':'','cb':_0x8a7a7f};_0x4b9e7f['write'](_0x2e1ea7+'\x0a');},this[_0x322e('0x1a')]=function(){_0x4b9e7f[_0x322e('0x1e')]();};}util[_0x322e('0x22')](AGIChannel,EventEmitter);AGIChannel[_0x322e('0x23')]['sendRequest']=function(_0xb1dcc2){return this['command']['sync'](this,_0xb1dcc2);};AGIChannel['prototype'][_0x322e('0x24')]=function(){return this[_0x322e('0x25')]('ANSWER');};AGIChannel[_0x322e('0x23')][_0x322e('0x26')]=function(_0x5e1590,_0x176d0d,_0x3fa050){_0x5e1590=_0x5e1590===undefined?_0x322e('0x27'):_0x5e1590;_0x176d0d=_0x176d0d===undefined?'5':_0x176d0d;_0x3fa050=_0x3fa050===undefined?'1':_0x3fa050;return this[_0x322e('0x25')](util[_0x322e('0x28')](_0x322e('0x29'),_0x5e1590,_0x176d0d*0x3e8,_0x3fa050));};AGIChannel[_0x322e('0x23')][_0x322e('0x2a')]=function(_0x4da8e0){_0x4da8e0=_0x4da8e0||_0x322e('0x2b');return this['sendRequest'](util[_0x322e('0x28')](_0x322e('0x2c'),_0x4da8e0));};AGIChannel[_0x322e('0x23')]['exec']=function(_0x309ef6,_0x1a0f88){if(_[_0x322e('0x2d')](_0x1a0f88)){return this['sendRequest'](util[_0x322e('0x28')](_0x322e('0x2e'),_0x309ef6,_0x1a0f88['join'](',')));}return this[_0x322e('0x25')](util['format']('EXEC\x20%s\x20%s',_0x309ef6,_0x1a0f88));};AGIChannel[_0x322e('0x23')][_0x322e('0x2f')]=function(_0x37b016){return this[_0x322e('0x25')](util[_0x322e('0x28')]('SET\x20CONTEXT\x20%s',_0x37b016));};AGIChannel[_0x322e('0x23')][_0x322e('0x30')]=function(_0x5d6c47){return this[_0x322e('0x25')](util[_0x322e('0x28')](_0x322e('0x31'),_0x5d6c47));};AGIChannel['prototype'][_0x322e('0x32')]=function(_0x4f5623){return this[_0x322e('0x25')](util['format'](_0x322e('0x33'),_0x4f5623));};AGIChannel[_0x322e('0x23')]['hangup']=function(){return this[_0x322e('0x25')](_0x322e('0x34'));};AGIChannel[_0x322e('0x23')][_0x322e('0x35')]=function(_0x520caa,_0xf2152c){var _0x57be1e=_['isBoolean'](_0xf2152c)||_[_0x322e('0x36')](_0xf2152c)?_0xf2152c[_0x322e('0x37')]():_0xf2152c;return this[_0x322e('0x25')](util[_0x322e('0x28')](_0x322e('0x38'),_0x520caa,_0x57be1e?_0x57be1e[_0x322e('0x37')]()[_0x322e('0x11')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel['prototype'][_0x322e('0x39')]=function(_0x124eb3,_0x2e310b){return this[_0x322e('0x25')](util['format'](_0x322e('0x3a'),_0x124eb3,_0x2e310b));};AGIChannel[_0x322e('0x23')]['sayDigits']=function(_0x4989d9,_0x1a8774){return this[_0x322e('0x25')](util['format']('SAY\x20DIGITS\x20%s\x20%s',_0x4989d9,_0x1a8774));};AGIChannel['prototype'][_0x322e('0x3b')]=function(_0x1e8007,_0xd2dec1){return this['sendRequest'](util[_0x322e('0x28')](_0x322e('0x3c'),_0x1e8007,_0xd2dec1));};AGIChannel[_0x322e('0x23')][_0x322e('0x3d')]=function(_0x4cd267,_0x26798b,_0x3ae3df){_0x26798b=_0x26798b||this[_0x322e('0x3e')];_0x3ae3df=_0x3ae3df||0x1;this['setContext'](_0x4cd267);this[_0x322e('0x30')](_0x26798b);this['setPriority'](_0x3ae3df);return this[_0x322e('0x2a')](util[_0x322e('0x28')](_0x322e('0x3f'),_0x4cd267,_0x26798b,_0x3ae3df));};AGIChannel['prototype'][_0x322e('0x40')]=function(_0x2ab2e1){return this[_0x322e('0x25')](util[_0x322e('0x28')](_0x322e('0x41'),_0x2ab2e1));};AGIChannel[_0x322e('0x23')][_0x322e('0x42')]=function(_0x5cf4b2,_0x52057b,_0x4cb94c,_0x189386,_0x31f032,_0x152196){_0x52057b=_0x52057b||_0x322e('0x43');_0x4cb94c=_0x4cb94c||'';_0x189386=_0x189386===undefined?-0x1:_0x189386==='-1'?-0x1:_0x189386*0x3e8;_0x31f032=_0x31f032===undefined?'':'s='+_0x31f032;_0x152196=_0x152196?_0x322e('0x44'):'';return this[_0x322e('0x25')](util['format'](_0x322e('0x45'),_0x5cf4b2,_0x52057b,_0x4cb94c,_0x189386,_0x152196,_0x31f032));};AGIChannel[_0x322e('0x23')]['streamFile']=function(_0x4382e8,_0xf1c32d){_0xf1c32d=_0xf1c32d||'';return this[_0x322e('0x25')](util[_0x322e('0x28')]('STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22',_0x4382e8,_0xf1c32d));};AGIChannel[_0x322e('0x23')][_0x322e('0x46')]=function(_0x1471da){return this[_0x322e('0x47')](_0x322e('0x48'),_0x1471da);};AGIChannel[_0x322e('0x23')][_0x322e('0x49')]=function(_0x34bdf4){return this[_0x322e('0x47')](_0x322e('0x4a'),_0x34bdf4);};AGIChannel[_0x322e('0x23')][_0x322e('0x17')]=function(_0x5729d7,_0x51ea74){this[_0x322e('0x2a')](util['format'](_0x322e('0x4b'),_0x5729d7['id'],_0x5729d7[_0x322e('0x4c')],_0x51ea74));return{'code':0x1f4,'result':'-1','extra':''};};module['exports']=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 6ce8ede..d431a3a 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 _0xc866=['Missing\x20\x27ivr.agi_network_script\x27.','push','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.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.'];(function(_0x138f59,_0x1b53fb){var _0x3d114d=function(_0x1f9461){while(--_0x1f9461){_0x138f59['push'](_0x138f59['shift']());}};_0x3d114d(++_0x1b53fb);}(_0xc866,0x1a5));var _0x6c86=function(_0x15a130,_0x9fc057){_0x15a130=_0x15a130-0x0;var _0xd8f37c=_0xc866[_0x15a130];return _0xd8f37c;};'use strict';var util=require(_0x6c86('0x0'));var error={'E_AGI_UNDEFINED':_0x6c86('0x1'),'E_AGI_ARGUMENT_PORT':_0x6c86('0x2'),'E_AGI_SERVER_ERROR':_0x6c86('0x3'),'E_AGI_SERVER_CLOSE':_0x6c86('0x4'),'E_AGI_SERVER_MAXCONNECTION':_0x6c86('0x5'),'E_AGI_SERVER_VOICE_DISABLED':_0x6c86('0x6'),'E_AGI_SOCKET_ERROR':_0x6c86('0x7'),'E_AGI_SOCKET_CLOSE':_0x6c86('0x8'),'E_AGI_SOCKET_TIMEOUT':_0x6c86('0x9'),'E_AGI_COMMAND_EMPTY':_0x6c86('0xa'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x6c86('0xb'),'E_AGI_IVR_ENTRY':'Missing\x20\x27ivr.entry\x27\x20menu.'};function AGIError(_0x14ffd0){var _0x14ffd0=_0x14ffd0||null,_0x277314=_0x277314||[],_0x5d8cff=0x1,_0x506bf3='';if(!error[_0x14ffd0]){_0x14ffd0='E_AGI_UNDEFINED';}_0x277314[_0x6c86('0xc')](error[_0x14ffd0]);while(arguments[_0x5d8cff]){_0x277314[_0x6c86('0xc')](arguments[_0x5d8cff]);_0x5d8cff++;}_0x506bf3=util[_0x6c86('0xd')][_0x6c86('0xe')](util,_0x277314);this[_0x6c86('0xf')]=_0x506bf3;this[_0x6c86('0x10')]=_0x14ffd0;}module[_0x6c86('0x11')]=AGIError; \ No newline at end of file +var _0x9a53=['message','name','util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','push','apply'];(function(_0x10070c,_0x2228c5){var _0xe4f14b=function(_0x79205e){while(--_0x79205e){_0x10070c['push'](_0x10070c['shift']());}};_0xe4f14b(++_0x2228c5);}(_0x9a53,0x16e));var _0x39a5=function(_0x306ab4,_0x1b39a6){_0x306ab4=_0x306ab4-0x0;var _0x593c44=_0x9a53[_0x306ab4];return _0x593c44;};'use strict';var util=require(_0x39a5('0x0'));var error={'E_AGI_UNDEFINED':_0x39a5('0x1'),'E_AGI_ARGUMENT_PORT':_0x39a5('0x2'),'E_AGI_SERVER_ERROR':_0x39a5('0x3'),'E_AGI_SERVER_CLOSE':'Server\x20closed.','E_AGI_SERVER_MAXCONNECTION':'[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','E_AGI_SERVER_VOICE_DISABLED':_0x39a5('0x4'),'E_AGI_SOCKET_ERROR':_0x39a5('0x5'),'E_AGI_SOCKET_CLOSE':'Socket\x20closed.','E_AGI_SOCKET_TIMEOUT':_0x39a5('0x6'),'E_AGI_COMMAND_EMPTY':_0x39a5('0x7'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x39a5('0x8'),'E_AGI_IVR_ENTRY':_0x39a5('0x9')};function AGIError(_0x4330da){var _0x4330da=_0x4330da||null,_0x32be5c=_0x32be5c||[],_0x4ec66b=0x1,_0x1e8f87='';if(!error[_0x4330da]){_0x4330da='E_AGI_UNDEFINED';}_0x32be5c[_0x39a5('0xa')](error[_0x4330da]);while(arguments[_0x4ec66b]){_0x32be5c[_0x39a5('0xa')](arguments[_0x4ec66b]);_0x4ec66b++;}_0x1e8f87=util['format'][_0x39a5('0xb')](util,_0x32be5c);this[_0x39a5('0xc')]=_0x1e8f87;this[_0x39a5('0xd')]=_0x4330da;}module['exports']=AGIError; \ No newline at end of file diff --git a/server/services/agi/events.js b/server/services/agi/events.js index 2ea8ae9..fb970d2 100644 --- a/server/services/agi/events.js +++ b/server/services/agi/events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7b00=['projectUpdate','exports','events','../../config/environment','redis','subscribe','agi','E_AGI_SERVER_ERROR','parse','emit'];(function(_0x5b7c48,_0x51cc75){var _0x281824=function(_0x394f64){while(--_0x394f64){_0x5b7c48['push'](_0x5b7c48['shift']());}};_0x281824(++_0x51cc75);}(_0x7b00,0x160));var _0x07b0=function(_0x2c8e83,_0x272b88){_0x2c8e83=_0x2c8e83-0x0;var _0x28696e=_0x7b00[_0x2c8e83];return _0x28696e;};'use strict';var _=require('lodash');var EventEmitter=require(_0x07b0('0x0'))['EventEmitter'];var Redis=require('ioredis');var AGIError=require('./error');var config=require(_0x07b0('0x1'));config[_0x07b0('0x2')]=_['defaults'](config[_0x07b0('0x2')],{'host':'localhost','port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0x07b0('0x2')]);sub[_0x07b0('0x3')](_0x07b0('0x4'),function(_0xabf1c2){if(_0xabf1c2)return eventEmitter['emit']('error',new AGIError(_0x07b0('0x5'),_0xabf1c2));});sub['on']('message',function(_0x1853f3,_0x3ec50d){if(_0x1853f3!=='agi')return;try{var _0x906741=JSON[_0x07b0('0x6')](_0x3ec50d);eventEmitter[_0x07b0('0x7')](_0x07b0('0x8'),_0x906741);}catch(_0x93aab3){eventEmitter['emit']('error',new AGIError(_0x07b0('0x5'),_0x93aab3));}});module[_0x07b0('0x9')]={'EventEmitter':eventEmitter}; \ No newline at end of file +var _0x91cc=['exports','events','ioredis','./error','redis','defaults','localhost','subscribe','agi','emit','E_AGI_SERVER_ERROR','message','projectUpdate','error'];(function(_0x488102,_0x4c1053){var _0x62017c=function(_0x4a339f){while(--_0x4a339f){_0x488102['push'](_0x488102['shift']());}};_0x62017c(++_0x4c1053);}(_0x91cc,0xb7));var _0xc91c=function(_0x68ee8b,_0x3cc6c5){_0x68ee8b=_0x68ee8b-0x0;var _0x5148f7=_0x91cc[_0x68ee8b];return _0x5148f7;};'use strict';var _=require('lodash');var EventEmitter=require(_0xc91c('0x0'))['EventEmitter'];var Redis=require(_0xc91c('0x1'));var AGIError=require(_0xc91c('0x2'));var config=require('../../config/environment');config[_0xc91c('0x3')]=_[_0xc91c('0x4')](config[_0xc91c('0x3')],{'host':_0xc91c('0x5'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0xc91c('0x3')]);sub[_0xc91c('0x6')](_0xc91c('0x7'),function(_0x28a023){if(_0x28a023)return eventEmitter[_0xc91c('0x8')]('error',new AGIError(_0xc91c('0x9'),_0x28a023));});sub['on'](_0xc91c('0xa'),function(_0x9e7a6f,_0x428693){if(_0x9e7a6f!==_0xc91c('0x7'))return;try{var _0x36be63=JSON['parse'](_0x428693);eventEmitter[_0xc91c('0x8')](_0xc91c('0xb'),_0x36be63);}catch(_0x1559aa){eventEmitter[_0xc91c('0x8')](_0xc91c('0xc'),new AGIError(_0xc91c('0x9'),_0x1559aa));}});module[_0xc91c('0xd')]={'EventEmitter':eventEmitter}; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index 5ccdb4c..958918c 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 _0x07e4=['vswitch','default','agicommand','target','invalid','default\x20on\x20switch\x20not\x20found','includes','max\x20retry\x20reach','condition\x20not\x20found','exports','lodash','../../../config/logger','menu','getdigits','getsecretdigits','vertices','edges','prototype','addVertex','addEdge','relations','getVertex','traverseBFS','info','no\x20vertex\x20found','stop\x20traverse','length','no\x20edge/s\x20available','condition'];(function(_0x39aea6,_0x303982){var _0x3772f2=function(_0x485d01){while(--_0x485d01){_0x39aea6['push'](_0x39aea6['shift']());}};_0x3772f2(++_0x303982);}(_0x07e4,0x1da));var _0x407e=function(_0x2f4ad2,_0x38ef52){_0x2f4ad2=_0x2f4ad2-0x0;var _0x5aed3d=_0x07e4[_0x2f4ad2];return _0x5aed3d;};'use strict';var _=require(_0x407e('0x0'));var logger=require(_0x407e('0x1'))('agi');var verticesWithRetry=[_0x407e('0x2'),_0x407e('0x3'),_0x407e('0x4')];var Graph=function(){this[_0x407e('0x5')]={};this[_0x407e('0x6')]={};this['numberOfEdges']=0x0;};Graph[_0x407e('0x7')][_0x407e('0x8')]=function(_0x126ea0){this[_0x407e('0x5')][_0x126ea0['id']]=_0x126ea0;this[_0x407e('0x6')][_0x126ea0['id']]=[];};Graph[_0x407e('0x7')][_0x407e('0x9')]=function(_0x39cc90,_0x24501f,_0x5db6be){this[_0x407e('0x6')][_0x39cc90]['push']({'target':_0x24501f,'condition':_0x5db6be});this['numberOfEdges']+=0x1;};Graph['prototype']['size']=function(){return _['size'](this[_0x407e('0x5')]);};Graph[_0x407e('0x7')][_0x407e('0xa')]=function(){return this['numberOfEdges'];};Graph[_0x407e('0x7')][_0x407e('0xb')]=function(_0x55680f){return this[_0x407e('0x5')][_0x55680f];};Graph[_0x407e('0x7')][_0x407e('0xc')]=function(_0x432f8b,_0xbaaa87){if(!this[_0x407e('0x5')][_0x432f8b]){return logger[_0x407e('0xd')](_0x407e('0xe'));}var _0x54714c=_0xbaaa87(this[_0x407e('0x5')][_0x432f8b]);if(!_0x54714c){return logger[_0x407e('0xd')](_0x407e('0xf'));}if(this[_0x407e('0x6')][_0x432f8b][_0x407e('0x10')]===0x0){return logger[_0x407e('0xd')](_0x407e('0x11'));}for(var _0x308eb0=0x0,_0x41d23f=[],_0x51d03c=![];_0x308eb0\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','uniqueid','info','dnid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','createSquareReport','then','catch','hasOwnProperty','indexOf','agi_','substring','variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','hangup','find','handleNotFound','production','handleUnpublished','initialize','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','getAll','finally','./server','listening','connection','syncho','util','../../config/logger','agi','../../config/license/util','./rpc','./project','defaults','127.0.0.1','projectUpdate','nextTick','error','findIndex','deleted','splice','push'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xe695,0x1e0));var _0x5e69=function(_0x24a2a3,_0x2add7d){_0x24a2a3=_0x24a2a3-0x0;var _0x42be31=_0xe695[_0x24a2a3];return _0x42be31;};'use strict';var _=require('lodash');var syncho=require(_0x5e69('0x0'));var util=require(_0x5e69('0x1'));var config=require('../../config/environment');var logger=require(_0x5e69('0x2'))(_0x5e69('0x3'));var utilLicense=require(_0x5e69('0x4'));var rpc=require(_0x5e69('0x5'));var Project=require(_0x5e69('0x6'));var AGIEmitter=require('./events')['EventEmitter'];var projects=[];config[_0x5e69('0x3')]=_[_0x5e69('0x7')](config['agi'],{'ip':_0x5e69('0x8'),'port':0x11dd});AGIEmitter['on'](_0x5e69('0x9'),projectUpdateHandler);function connectionHandler(_0x291b0e){process[_0x5e69('0xa')](function(){syncho(function(){try{setChannelVariables(_0x291b0e);agiHandler(_0x291b0e);}catch(_0x2b067f){logger[_0x5e69('0xb')](_0x2b067f['stack']);}});});}function projectUpdateHandler(_0x2a2897){try{var _0x51651c=_[_0x5e69('0xc')](projects,['id',_0x2a2897['id']]);if(_0x51651c>-0x1){if(_0x2a2897[_0x5e69('0xd')]===!![]){projects[_0x5e69('0xe')](_0x51651c,0x1);}else{projects[_0x51651c]=_0x2a2897;}}else{projects[_0x5e69('0xf')](_0x2a2897);}}catch(_0x308aa3){logger[_0x5e69('0xb')](_0x308aa3['stack']);}}function listeningHandler(){console[_0x5e69('0x10')](_0x5e69('0x11'),config[_0x5e69('0x3')][_0x5e69('0x12')]);logger['info'](util['format'](_0x5e69('0x13'),config[_0x5e69('0x3')]['ip'],config[_0x5e69('0x3')][_0x5e69('0x12')]));}function errorHandler(_0x58b500){if(_0x58b500&&_0x58b500[_0x5e69('0x14')]&&_0x58b500['message']){logger[_0x5e69('0xb')](util[_0x5e69('0x15')](_0x5e69('0x16'),_0x58b500['name'],_0x58b500['message']));}else{logger['error'](util[_0x5e69('0x15')](_0x5e69('0x17'),_0x58b500[_0x5e69('0x18')]));}}function closeHandler(){logger['info'](util[_0x5e69('0x15')](_0x5e69('0x19'),this[_0x5e69('0x1a')],this[_0x5e69('0x1b')],this[_0x5e69('0x1c')],this['dnid'],this[_0x5e69('0x1d')]));try{createSquareReport(this);}catch(_0x561796){logger[_0x5e69('0xb')](_0x561796[_0x5e69('0x18')]);}}function timeoutHandler(){logger[_0x5e69('0x1e')](util[_0x5e69('0x15')]('[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x5e69('0x1a')],this[_0x5e69('0x1b')],this['callerid'],this[_0x5e69('0x1f')],this[_0x5e69('0x1d')]));}function hangupHandler(){logger['info'](util[_0x5e69('0x15')](_0x5e69('0x20'),this[_0x5e69('0x1a')],this['calleridname'],this[_0x5e69('0x1c')],this[_0x5e69('0x1f')],this[_0x5e69('0x1d')]));this['evtHangup']=!![];}function createSquareReport(_0x21ea0b,_0x510411){rpc[_0x5e69('0x21')](_0x21ea0b)[_0x5e69('0x22')](function(_0x1924f4){if(_0x510411){_0x510411(null,_0x1924f4);}})[_0x5e69('0x23')](function(_0x1730ac){if(_0x510411){_0x510411(null,_0x1730ac);}});}function setChannelVariables(_0x111f8d){for(var _0x5ba2ad in _0x111f8d){if(_0x111f8d[_0x5e69('0x24')](_0x5ba2ad)){if(_0x5ba2ad[_0x5e69('0x25')](_0x5e69('0x26'))===0x0){_0x111f8d[_0x5ba2ad[_0x5e69('0x27')](0x4)]=_0x111f8d[_0x5ba2ad];delete _0x111f8d[_0x5ba2ad];}}}}function agiHandler(_0x150ca5){logger['debug'](_0x5e69('0x28'),JSON[_0x5e69('0x29')](_0x150ca5,null,0x2));logger[_0x5e69('0x1e')](util['format'](_0x5e69('0x2a'),_0x150ca5['arg_1'],_0x150ca5[_0x5e69('0x1b')],_0x150ca5[_0x5e69('0x1c')],_0x150ca5['dnid'],_0x150ca5['uniqueid']));_0x150ca5['on']('error',errorHandler);_0x150ca5['on'](_0x5e69('0x2b'),closeHandler);_0x150ca5['on'](_0x5e69('0x2c'),timeoutHandler);_0x150ca5['evtHangup']=![];_0x150ca5['on'](_0x5e69('0x2d'),hangupHandler);var _0x168ddb=_[_0x5e69('0x2e')](projects,['name',_0x150ca5[_0x5e69('0x1a')]]);if(!_0x168ddb)return Project[_0x5e69('0x2f')](_0x150ca5);if(!_0x168ddb[_0x5e69('0x30')])return Project[_0x5e69('0x31')](_0x150ca5);return Project[_0x5e69('0x32')](_0x168ddb,_0x150ca5);}function main(){var _0x100f7a;return utilLicense[_0x5e69('0x33')]()[_0x5e69('0x22')](function(_0x12d386){if(!_0x12d386)return;if(_0x12d386[_0x5e69('0x34')]){if(_0x12d386[_0x5e69('0x35')]&&_0x12d386[_0x5e69('0x35')]>0x0){logger[_0x5e69('0x1e')](util['format'](_0x5e69('0x36'),_0x12d386[_0x5e69('0x35')]));_0x100f7a=_0x12d386[_0x5e69('0x35')];}else{logger[_0x5e69('0x1e')](_0x5e69('0x37'));}}else{logger[_0x5e69('0x1e')](_0x5e69('0x38'));_0x100f7a=-0x1;}})[_0x5e69('0x22')](function(){return Project[_0x5e69('0x39')]();})[_0x5e69('0x22')](function(_0x326abf){projects=_0x326abf;return;})[_0x5e69('0x23')](function(_0x447c2e){logger[_0x5e69('0xb')]('[LICENSE]',_0x447c2e['stack']);})[_0x5e69('0x3a')](function(){var _0x55ce3b=require(_0x5e69('0x3b'))(config[_0x5e69('0x3')][_0x5e69('0x12')],config[_0x5e69('0x3')]['ip'],_0x100f7a);_0x55ce3b['on'](_0x5e69('0xb'),errorHandler);_0x55ce3b['on'](_0x5e69('0x3c'),listeningHandler);_0x55ce3b['on'](_0x5e69('0x3d'),connectionHandler);_0x55ce3b['on'](_0x5e69('0x2b'),closeHandler);});}main(); \ No newline at end of file +var _0x41f4=['[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','then','getAll','[LICENSE]','finally','./server','listening','connection','lodash','util','../../config/environment','../../config/logger','./rpc','./project','./events','EventEmitter','agi','127.0.0.1','projectUpdate','nextTick','error','stack','findIndex','deleted','splice','push','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info','name','message','format','[%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','catch','hasOwnProperty','indexOf','agi_','debug','variables','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','hangup','handleNotFound','production','handleUnpublished','voice','callysquare'];(function(_0x1d8d20,_0x16d26c){var _0x1e4422=function(_0xc17490){while(--_0xc17490){_0x1d8d20['push'](_0x1d8d20['shift']());}};_0x1e4422(++_0x16d26c);}(_0x41f4,0x7f));var _0x441f=function(_0x49c4a9,_0x134c50){_0x49c4a9=_0x49c4a9-0x0;var _0xd517c8=_0x41f4[_0x49c4a9];return _0xd517c8;};'use strict';var _=require(_0x441f('0x0'));var syncho=require('syncho');var util=require(_0x441f('0x1'));var config=require(_0x441f('0x2'));var logger=require(_0x441f('0x3'))('agi');var utilLicense=require('../../config/license/util');var rpc=require(_0x441f('0x4'));var Project=require(_0x441f('0x5'));var AGIEmitter=require(_0x441f('0x6'))[_0x441f('0x7')];var projects=[];config[_0x441f('0x8')]=_['defaults'](config[_0x441f('0x8')],{'ip':_0x441f('0x9'),'port':0x11dd});AGIEmitter['on'](_0x441f('0xa'),projectUpdateHandler);function connectionHandler(_0x3b5d72){process[_0x441f('0xb')](function(){syncho(function(){try{setChannelVariables(_0x3b5d72);agiHandler(_0x3b5d72);}catch(_0x2f3c19){logger[_0x441f('0xc')](_0x2f3c19[_0x441f('0xd')]);}});});}function projectUpdateHandler(_0x3c0a62){try{var _0x13d557=_[_0x441f('0xe')](projects,['id',_0x3c0a62['id']]);if(_0x13d557>-0x1){if(_0x3c0a62[_0x441f('0xf')]===!![]){projects[_0x441f('0x10')](_0x13d557,0x1);}else{projects[_0x13d557]=_0x3c0a62;}}else{projects[_0x441f('0x11')](_0x3c0a62);}}catch(_0x121121){logger[_0x441f('0xc')](_0x121121['stack']);}}function listeningHandler(){console['log'](_0x441f('0x12'),config[_0x441f('0x8')][_0x441f('0x13')]);logger[_0x441f('0x14')](util['format']('[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d',config[_0x441f('0x8')]['ip'],config[_0x441f('0x8')]['port']));}function errorHandler(_0x4c5f41){if(_0x4c5f41&&_0x4c5f41[_0x441f('0x15')]&&_0x4c5f41[_0x441f('0x16')]){logger[_0x441f('0xc')](util[_0x441f('0x17')](_0x441f('0x18'),_0x4c5f41[_0x441f('0x15')],_0x4c5f41[_0x441f('0x16')]));}else{logger[_0x441f('0xc')](util['format'](_0x441f('0x19'),_0x4c5f41[_0x441f('0xd')]));}}function closeHandler(){logger['info'](util['format'](_0x441f('0x1a'),this[_0x441f('0x1b')],this['calleridname'],this[_0x441f('0x1c')],this[_0x441f('0x1d')],this[_0x441f('0x1e')]));try{createSquareReport(this);}catch(_0x44ffd6){logger[_0x441f('0xc')](_0x44ffd6[_0x441f('0xd')]);}}function timeoutHandler(){logger[_0x441f('0x14')](util['format'](_0x441f('0x1f'),this[_0x441f('0x1b')],this[_0x441f('0x20')],this[_0x441f('0x1c')],this[_0x441f('0x1d')],this[_0x441f('0x1e')]));}function hangupHandler(){logger[_0x441f('0x14')](util[_0x441f('0x17')](_0x441f('0x21'),this['arg_1'],this[_0x441f('0x20')],this[_0x441f('0x1c')],this[_0x441f('0x1d')],this[_0x441f('0x1e')]));this[_0x441f('0x22')]=!![];}function createSquareReport(_0x46a217,_0x4e8d33){rpc['createSquareReport'](_0x46a217)['then'](function(_0x4e8b9){if(_0x4e8d33){_0x4e8d33(null,_0x4e8b9);}})[_0x441f('0x23')](function(_0x3d26c7){if(_0x4e8d33){_0x4e8d33(null,_0x3d26c7);}});}function setChannelVariables(_0x4c804b){for(var _0x1d261a in _0x4c804b){if(_0x4c804b[_0x441f('0x24')](_0x1d261a)){if(_0x1d261a[_0x441f('0x25')](_0x441f('0x26'))===0x0){_0x4c804b[_0x1d261a['substring'](0x4)]=_0x4c804b[_0x1d261a];delete _0x4c804b[_0x1d261a];}}}}function agiHandler(_0x3a8ca0){logger[_0x441f('0x27')](_0x441f('0x28'),JSON['stringify'](_0x3a8ca0,null,0x2));logger[_0x441f('0x14')](util[_0x441f('0x17')](_0x441f('0x29'),_0x3a8ca0['arg_1'],_0x3a8ca0[_0x441f('0x20')],_0x3a8ca0[_0x441f('0x1c')],_0x3a8ca0[_0x441f('0x1d')],_0x3a8ca0[_0x441f('0x1e')]));_0x3a8ca0['on'](_0x441f('0xc'),errorHandler);_0x3a8ca0['on'](_0x441f('0x2a'),closeHandler);_0x3a8ca0['on'](_0x441f('0x2b'),timeoutHandler);_0x3a8ca0[_0x441f('0x22')]=![];_0x3a8ca0['on'](_0x441f('0x2c'),hangupHandler);var _0x37b1ac=_['find'](projects,['name',_0x3a8ca0[_0x441f('0x1b')]]);if(!_0x37b1ac)return Project[_0x441f('0x2d')](_0x3a8ca0);if(!_0x37b1ac[_0x441f('0x2e')])return Project[_0x441f('0x2f')](_0x3a8ca0);return Project['initialize'](_0x37b1ac,_0x3a8ca0);}function main(){var _0xe8848c;return utilLicense['getLicense']()['then'](function(_0x467cf8){if(!_0x467cf8)return;if(_0x467cf8[_0x441f('0x30')]){if(_0x467cf8[_0x441f('0x31')]&&_0x467cf8[_0x441f('0x31')]>0x0){logger['info'](util[_0x441f('0x17')]('[LICENSE]\x20CHANNELS:\x20%s',_0x467cf8['callysquare']));_0xe8848c=_0x467cf8[_0x441f('0x31')];}else{logger[_0x441f('0x14')](_0x441f('0x32'));}}else{logger[_0x441f('0x14')](_0x441f('0x33'));_0xe8848c=-0x1;}})[_0x441f('0x34')](function(){return Project[_0x441f('0x35')]();})[_0x441f('0x34')](function(_0x4f4e8e){projects=_0x4f4e8e;return;})[_0x441f('0x23')](function(_0x5d9c0e){logger[_0x441f('0xc')](_0x441f('0x36'),_0x5d9c0e[_0x441f('0xd')]);})[_0x441f('0x37')](function(){var _0x355545=require(_0x441f('0x38'))(config[_0x441f('0x8')]['port'],config['agi']['ip'],_0xe8848c);_0x355545['on'](_0x441f('0xc'),errorHandler);_0x355545['on'](_0x441f('0x39'),listeningHandler);_0x355545['on'](_0x441f('0x3a'),connectionHandler);_0x355545['on'](_0x441f('0x2a'),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 49034c6..9c7879e 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 _0xd0e3=['then','message','result','catch','bluebird','client','request'];(function(_0x19d350,_0x3c843f){var _0x3bfc8d=function(_0xd89003){while(--_0xd89003){_0x19d350['push'](_0x19d350['shift']());}};_0x3bfc8d(++_0x3c843f);}(_0xd0e3,0x138));var _0x3d0e=function(_0x7ceb4d,_0x3ead06){_0x7ceb4d=_0x7ceb4d-0x0;var _0x259b55=_0xd0e3[_0x7ceb4d];return _0x259b55;};'use strict';var BPromise=require(_0x3d0e('0x0'));var jayson=require('jayson/promise');var client=jayson[_0x3d0e('0x1')]['http']({'port':0x232b});function request(_0x17a002,_0x580511){return new BPromise(function(_0xf3bb01,_0x2a74f4){return client[_0x3d0e('0x2')](_0x17a002,_0x580511)[_0x3d0e('0x3')](function(_0x2e59ab){if(_0x2e59ab['error']){return _0x2a74f4(_0x2e59ab['error'][_0x3d0e('0x4')]);}else{return _0xf3bb01(_0x2e59ab[_0x3d0e('0x5')]);}})[_0x3d0e('0x6')](function(_0x50bdf8){return _0x2a74f4(_0x50bdf8);});});}exports['sendMailMessage']=function(_0x355440,_0x1c4eca){return request('SendMail',{'account':_0x355440,'message':_0x1c4eca});}; \ No newline at end of file +var _0x9f83=['request','then','error','result','sendMailMessage','SendMail','client','http'];(function(_0x46a658,_0x10935a){var _0x490b36=function(_0x373221){while(--_0x373221){_0x46a658['push'](_0x46a658['shift']());}};_0x490b36(++_0x10935a);}(_0x9f83,0x1ce));var _0x39f8=function(_0x468f43,_0x8c9b9a){_0x468f43=_0x468f43-0x0;var _0x22dfe3=_0x9f83[_0x468f43];return _0x22dfe3;};'use strict';var BPromise=require('bluebird');var jayson=require('jayson/promise');var client=jayson[_0x39f8('0x0')][_0x39f8('0x1')]({'port':0x232b});function request(_0x5c8804,_0x3eebc3){return new BPromise(function(_0x4e10d3,_0x1a3779){return client[_0x39f8('0x2')](_0x5c8804,_0x3eebc3)[_0x39f8('0x3')](function(_0x402e33){if(_0x402e33[_0x39f8('0x4')]){return _0x1a3779(_0x402e33[_0x39f8('0x4')]['message']);}else{return _0x4e10d3(_0x402e33[_0x39f8('0x5')]);}})['catch'](function(_0x239c27){return _0x1a3779(_0x239c27);});});}exports[_0x39f8('0x6')]=function(_0x295322,_0x473bb0){return request(_0x39f8('0x7'),{'account':_0x295322,'message':_0x473bb0});}; \ No newline at end of file diff --git a/server/services/agi/project.js b/server/services/agi/project.js index 71abbda..53bdc3f 100644 --- a/server/services/agi/project.js +++ b/server/services/agi/project.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6ed5=['joinAt','YYYY-MM-DD\x20HH:mm:ss','format','arg_1','clear','stringify','gotoc','info','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code','result','evtHangup','isUndefined','stack','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','callerid','dnid','uniqueid','traverseBFS','finally','vertex','toString','agicommand\x20not\x20found','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','close','Project\x20%s\x20not\x20published','exports','lodash','xml2json','util','../../config/logger','agi','./rpc','./graph','./vertices','getSquareProjects','catch','error','Unable\x20to\x20download\x20CallySquare\x20projects','agicommand','retry','maxRetry','addVertex','omit','mxCell','hasOwnProperty','isArray','length','source','addEdge','target','value','root','inspect','debug'];(function(_0x3826ad,_0x49a30d){var _0x17b900=function(_0x38474f){while(--_0x38474f){_0x3826ad['push'](_0x3826ad['shift']());}};_0x17b900(++_0x49a30d);}(_0x6ed5,0x158));var _0x56ed=function(_0x5e4952,_0x5a8f35){_0x5e4952=_0x5e4952-0x0;var _0xdd0cf7=_0x6ed5[_0x5e4952];return _0xdd0cf7;};'use strict';var _=require(_0x56ed('0x0'));var moment=require('moment');var parser=require(_0x56ed('0x1'));var util=require(_0x56ed('0x2'));var logger=require(_0x56ed('0x3'))(_0x56ed('0x4'));var rpc=require(_0x56ed('0x5'));var mailRpc=require('./mailRpc');var Graph=require(_0x56ed('0x6'));var Vertices=require(_0x56ed('0x7'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0x56ed('0x8')]()[_0x56ed('0x9')](function(_0x13a22b){logger[_0x56ed('0xa')](_0x56ed('0xb'),_0x13a22b['stack']);return[];});}function addVertex(_0x319b12,_0x4f11fc,_0xe4bed){_0x4f11fc[_0x56ed('0xc')]=_0xe4bed;if(_0x4f11fc['hasOwnProperty'](_0x56ed('0xd'))){_0x4f11fc[_0x56ed('0xe')]=parseInt(_0x4f11fc[_0x56ed('0xd')],0xa);}_0x319b12[_0x56ed('0xf')](_[_0x56ed('0x10')](_0x4f11fc,_0x56ed('0x11')));}function initGraph(_0x287fda,_0x2f561a){var _0x14d058=new Graph();for(var _0x1a8f27 in _0x287fda){if(_0x287fda[_0x56ed('0x12')](_0x1a8f27)){if(_[_0x56ed('0x13')](_0x287fda[_0x1a8f27])){for(var _0x4dd581=0x0;_0x4dd581<_0x287fda[_0x1a8f27][_0x56ed('0x14')];_0x4dd581+=0x1){addVertex(_0x14d058,_0x287fda[_0x1a8f27][_0x4dd581],_0x1a8f27);}}else{addVertex(_0x14d058,_0x287fda[_0x1a8f27],_0x1a8f27);}}}for(var _0x5805d3=0x0;_0x5805d3<_0x2f561a[_0x56ed('0x14')];_0x5805d3+=0x1){if(_0x2f561a[_0x5805d3][_0x56ed('0x15')]&&_0x2f561a[_0x5805d3]['target']){_0x14d058[_0x56ed('0x16')](_0x2f561a[_0x5805d3][_0x56ed('0x15')],_0x2f561a[_0x5805d3][_0x56ed('0x17')],_0x2f561a[_0x5805d3][_0x56ed('0x18')]);}}return _0x14d058;}function getRoot(_0x50a97a){return parser['toJson'](_0x50a97a,{'object':!![]})['mxGraphModel'][_0x56ed('0x19')];}function inspect(_0x2de447){return util[_0x56ed('0x1a')](_0x2de447,{'showHidden':![],'depth':null});}function initialize(_0x437d48,_0x4485c9){var _0x30df55=getRoot(_0x437d48['production']);if(!_0x30df55||!_0x30df55['start'])return;var _0x3e03c7,_0x50e8c1,_0x2a5872;logger[_0x56ed('0x1b')](_0x56ed('0x19'),JSON['stringify'](_0x30df55,null,0x2));_0x4485c9[_0x56ed('0x1c')]=moment()['format'](_0x56ed('0x1d'));_0x3e03c7=initGraph(_[_0x56ed('0x10')](_0x30df55,_0x56ed('0x11')),_0x30df55[_0x56ed('0x11')]);_0x50e8c1=new Vertices(_0x4485c9,rpc,mailRpc);logger['info'](util[_0x56ed('0x1e')]('[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x4485c9[_0x56ed('0x1f')],_0x4485c9['calleridname'],_0x4485c9['callerid'],_0x4485c9['dnid'],_0x4485c9['uniqueid']));_0x3e03c7['traverseBFS'](_0x30df55['start']['id'],function(_0x511e9b){try{_0x511e9b=_0x50e8c1[_0x56ed('0x20')](_0x511e9b);logger[_0x56ed('0x1b')]('vertex',JSON[_0x56ed('0x21')](_0x511e9b,null,0x2));if(_0x511e9b[_0x56ed('0xc')]===_0x56ed('0x22')){logger[_0x56ed('0x23')](_0x56ed('0x24'));_0x4485c9['context']=_0x511e9b[_0x56ed('0x25')]||_0x4485c9['context'];_0x4485c9['extension']=_0x511e9b[_0x56ed('0x26')];_0x4485c9['priority']=_0x511e9b['priority']?_0x511e9b[_0x56ed('0x27')]-0x1:0x1;return null;}else if(_0x511e9b&&_0x50e8c1[_0x511e9b['agicommand']]){_0x2a5872=_0x50e8c1[_0x511e9b[_0x56ed('0xc')]](_0x511e9b);logger['info'](_0x56ed('0x28'),JSON[_0x56ed('0x21')](_0x2a5872,null,0x2));if(_0x2a5872&&_0x2a5872[_0x56ed('0x29')]===AGI_CODE_SUCCESS&&_0x2a5872[_0x56ed('0x2a')]!==AGI_RESULT_ERROR&&!_0x4485c9[_0x56ed('0x2b')]){logger['debug'](_0x56ed('0x28'),inspect(_0x2a5872));return _[_0x56ed('0x2c')](_0x2a5872[_0x56ed('0x2a')])?null:_0x2a5872[_0x56ed('0x2a')]['toString']();}else{logger[_0x56ed('0xa')](_0x56ed('0x28'),inspect(_0x2a5872));return null;}}else{logger[_0x56ed('0xa')]('agicommand\x20not\x20found');return null;}}catch(_0xcd7a9){logger[_0x56ed('0xa')](_0xcd7a9[_0x56ed('0x2d')]);return null;}});if(_0x30df55['finally']){logger['info'](util[_0x56ed('0x1e')](_0x56ed('0x2e'),_0x4485c9['arg_1'],_0x4485c9['calleridname'],_0x4485c9[_0x56ed('0x2f')],_0x4485c9[_0x56ed('0x30')],_0x4485c9[_0x56ed('0x31')]));_0x3e03c7[_0x56ed('0x32')](_0x30df55[_0x56ed('0x33')]['id'],function(_0x2d6990){try{_0x2d6990=_0x50e8c1[_0x56ed('0x20')](_0x2d6990);logger[_0x56ed('0x1b')](_0x56ed('0x34'),JSON['stringify'](_0x2d6990,null,0x2));if(_0x2d6990&&_0x50e8c1[_0x2d6990[_0x56ed('0xc')]]){_0x2a5872=_0x50e8c1[_0x2d6990[_0x56ed('0xc')]](_0x2d6990);if(_0x2a5872){logger[_0x56ed('0x1b')]('response',inspect(_0x2a5872));return _[_0x56ed('0x2c')](_0x2a5872[_0x56ed('0x2a')])?null:_0x2a5872['result'][_0x56ed('0x35')]();}else{logger[_0x56ed('0xa')]('response',inspect(_0x2a5872));return null;}}else{logger[_0x56ed('0xa')](_0x56ed('0x36'));return null;}}catch(_0x2a7a89){logger[_0x56ed('0xa')](_0x2a7a89[_0x56ed('0x2d')]);return null;}});}logger[_0x56ed('0x23')](util['format'](_0x56ed('0x37'),_0x4485c9[_0x56ed('0x1f')],_0x4485c9[_0x56ed('0x38')],_0x4485c9[_0x56ed('0x2f')],_0x4485c9[_0x56ed('0x30')],_0x4485c9[_0x56ed('0x31')]));logger[_0x56ed('0x23')](util['format'](_0x56ed('0x39'),_0x4485c9[_0x56ed('0x25')],_0x4485c9['extension'],parseInt(_0x4485c9[_0x56ed('0x27')],0xa)+0x1));_0x4485c9[_0x56ed('0x3a')](_0x4485c9['context'],_0x4485c9['extension'],parseInt(_0x4485c9['priority'],0xa)+0x1);_0x4485c9[_0x56ed('0x3b')]();}function handleNotFound(_0x419e87){logger['error'](util[_0x56ed('0x1e')]('Project\x20%s\x20not\x20found',_0x419e87[_0x56ed('0x1f')]));_0x419e87[_0x56ed('0x3a')](_0x419e87[_0x56ed('0x25')],_0x419e87['extension'],parseInt(_0x419e87['priority'],0xa)+0x1);_0x419e87['close']();}function handleUnpublished(_0x121517){logger[_0x56ed('0xa')](util[_0x56ed('0x1e')](_0x56ed('0x3c'),_0x121517['arg_1']));_0x121517['continueAt'](_0x121517[_0x56ed('0x25')],_0x121517[_0x56ed('0x26')],parseInt(_0x121517[_0x56ed('0x27')],0xa)+0x1);_0x121517['close']();}module[_0x56ed('0x3d')]={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file +var _0x142b=['format','YYYY-MM-DD\x20HH:mm:ss','mxCell','info','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','traverseBFS','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','result','evtHangup','agicommand\x20not\x20found','stack','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','calleridname','callerid','dnid','finally','vertex','toString','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','close','Project\x20%s\x20not\x20found','Project\x20%s\x20not\x20published','continueAt','exports','moment','xml2json','util','agi','./rpc','./mailRpc','./graph','./vertices','error','Unable\x20to\x20download\x20CallySquare\x20projects','agicommand','hasOwnProperty','retry','maxRetry','addVertex','omit','isArray','length','source','addEdge','target','value','toJson','mxGraphModel','root','inspect','start','debug','stringify'];(function(_0x1fb673,_0x1bb83f){var _0x5e9953=function(_0x5cc1a5){while(--_0x5cc1a5){_0x1fb673['push'](_0x1fb673['shift']());}};_0x5e9953(++_0x1bb83f);}(_0x142b,0xcb));var _0xb142=function(_0xefeca0,_0x5c5f7f){_0xefeca0=_0xefeca0-0x0;var _0x277764=_0x142b[_0xefeca0];return _0x277764;};'use strict';var _=require('lodash');var moment=require(_0xb142('0x0'));var parser=require(_0xb142('0x1'));var util=require(_0xb142('0x2'));var logger=require('../../config/logger')(_0xb142('0x3'));var rpc=require(_0xb142('0x4'));var mailRpc=require(_0xb142('0x5'));var Graph=require(_0xb142('0x6'));var Vertices=require(_0xb142('0x7'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc['getSquareProjects']()['catch'](function(_0x162308){logger[_0xb142('0x8')](_0xb142('0x9'),_0x162308['stack']);return[];});}function addVertex(_0x1c8c4f,_0x5bf879,_0x46e96f){_0x5bf879[_0xb142('0xa')]=_0x46e96f;if(_0x5bf879[_0xb142('0xb')](_0xb142('0xc'))){_0x5bf879[_0xb142('0xd')]=parseInt(_0x5bf879[_0xb142('0xc')],0xa);}_0x1c8c4f[_0xb142('0xe')](_[_0xb142('0xf')](_0x5bf879,'mxCell'));}function initGraph(_0x2ff910,_0x39f2ef){var _0x502884=new Graph();for(var _0xc9d02b in _0x2ff910){if(_0x2ff910[_0xb142('0xb')](_0xc9d02b)){if(_[_0xb142('0x10')](_0x2ff910[_0xc9d02b])){for(var _0x3e68ed=0x0;_0x3e68ed<_0x2ff910[_0xc9d02b][_0xb142('0x11')];_0x3e68ed+=0x1){addVertex(_0x502884,_0x2ff910[_0xc9d02b][_0x3e68ed],_0xc9d02b);}}else{addVertex(_0x502884,_0x2ff910[_0xc9d02b],_0xc9d02b);}}}for(var _0x416279=0x0;_0x416279<_0x39f2ef[_0xb142('0x11')];_0x416279+=0x1){if(_0x39f2ef[_0x416279][_0xb142('0x12')]&&_0x39f2ef[_0x416279]['target']){_0x502884[_0xb142('0x13')](_0x39f2ef[_0x416279][_0xb142('0x12')],_0x39f2ef[_0x416279][_0xb142('0x14')],_0x39f2ef[_0x416279][_0xb142('0x15')]);}}return _0x502884;}function getRoot(_0x4bdbff){return parser[_0xb142('0x16')](_0x4bdbff,{'object':!![]})[_0xb142('0x17')][_0xb142('0x18')];}function inspect(_0x28c1b8){return util[_0xb142('0x19')](_0x28c1b8,{'showHidden':![],'depth':null});}function initialize(_0x5e4268,_0x7850df){var _0x5cf2d8=getRoot(_0x5e4268['production']);if(!_0x5cf2d8||!_0x5cf2d8[_0xb142('0x1a')])return;var _0x48d956,_0x3393c4,_0x2c499b;logger[_0xb142('0x1b')](_0xb142('0x18'),JSON[_0xb142('0x1c')](_0x5cf2d8,null,0x2));_0x7850df['joinAt']=moment()[_0xb142('0x1d')](_0xb142('0x1e'));_0x48d956=initGraph(_[_0xb142('0xf')](_0x5cf2d8,'mxCell'),_0x5cf2d8[_0xb142('0x1f')]);_0x3393c4=new Vertices(_0x7850df,rpc,mailRpc);logger[_0xb142('0x20')](util['format'](_0xb142('0x21'),_0x7850df[_0xb142('0x22')],_0x7850df['calleridname'],_0x7850df['callerid'],_0x7850df['dnid'],_0x7850df['uniqueid']));_0x48d956[_0xb142('0x23')](_0x5cf2d8['start']['id'],function(_0x228e8d){try{_0x228e8d=_0x3393c4['clear'](_0x228e8d);logger[_0xb142('0x1b')]('vertex',JSON[_0xb142('0x1c')](_0x228e8d,null,0x2));if(_0x228e8d[_0xb142('0xa')]==='gotoc'){logger[_0xb142('0x20')](_0xb142('0x24'));_0x7850df[_0xb142('0x25')]=_0x228e8d[_0xb142('0x25')]||_0x7850df[_0xb142('0x25')];_0x7850df[_0xb142('0x26')]=_0x228e8d[_0xb142('0x26')];_0x7850df[_0xb142('0x27')]=_0x228e8d[_0xb142('0x27')]?_0x228e8d[_0xb142('0x27')]-0x1:0x1;return null;}else if(_0x228e8d&&_0x3393c4[_0x228e8d[_0xb142('0xa')]]){_0x2c499b=_0x3393c4[_0x228e8d[_0xb142('0xa')]](_0x228e8d);logger[_0xb142('0x20')](_0xb142('0x28'),JSON['stringify'](_0x2c499b,null,0x2));if(_0x2c499b&&_0x2c499b['code']===AGI_CODE_SUCCESS&&_0x2c499b[_0xb142('0x29')]!==AGI_RESULT_ERROR&&!_0x7850df[_0xb142('0x2a')]){logger['debug'](_0xb142('0x28'),inspect(_0x2c499b));return _['isUndefined'](_0x2c499b['result'])?null:_0x2c499b[_0xb142('0x29')]['toString']();}else{logger[_0xb142('0x8')](_0xb142('0x28'),inspect(_0x2c499b));return null;}}else{logger[_0xb142('0x8')](_0xb142('0x2b'));return null;}}catch(_0x4d38f4){logger['error'](_0x4d38f4[_0xb142('0x2c')]);return null;}});if(_0x5cf2d8['finally']){logger['info'](util[_0xb142('0x1d')](_0xb142('0x2d'),_0x7850df[_0xb142('0x22')],_0x7850df[_0xb142('0x2e')],_0x7850df[_0xb142('0x2f')],_0x7850df[_0xb142('0x30')],_0x7850df['uniqueid']));_0x48d956[_0xb142('0x23')](_0x5cf2d8[_0xb142('0x31')]['id'],function(_0x1ea7ec){try{_0x1ea7ec=_0x3393c4['clear'](_0x1ea7ec);logger[_0xb142('0x1b')](_0xb142('0x32'),JSON['stringify'](_0x1ea7ec,null,0x2));if(_0x1ea7ec&&_0x3393c4[_0x1ea7ec['agicommand']]){_0x2c499b=_0x3393c4[_0x1ea7ec[_0xb142('0xa')]](_0x1ea7ec);if(_0x2c499b){logger['debug']('response',inspect(_0x2c499b));return _['isUndefined'](_0x2c499b[_0xb142('0x29')])?null:_0x2c499b[_0xb142('0x29')][_0xb142('0x33')]();}else{logger['error'](_0xb142('0x28'),inspect(_0x2c499b));return null;}}else{logger[_0xb142('0x8')](_0xb142('0x2b'));return null;}}catch(_0x3d7c9d){logger[_0xb142('0x8')](_0x3d7c9d[_0xb142('0x2c')]);return null;}});}logger[_0xb142('0x20')](util[_0xb142('0x1d')]('[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x7850df[_0xb142('0x22')],_0x7850df[_0xb142('0x2e')],_0x7850df['callerid'],_0x7850df[_0xb142('0x30')],_0x7850df['uniqueid']));logger['info'](util[_0xb142('0x1d')](_0xb142('0x34'),_0x7850df['context'],_0x7850df['extension'],parseInt(_0x7850df['priority'],0xa)+0x1));_0x7850df['continueAt'](_0x7850df[_0xb142('0x25')],_0x7850df[_0xb142('0x26')],parseInt(_0x7850df[_0xb142('0x27')],0xa)+0x1);_0x7850df[_0xb142('0x35')]();}function handleNotFound(_0x18ab8b){logger['error'](util['format'](_0xb142('0x36'),_0x18ab8b[_0xb142('0x22')]));_0x18ab8b['continueAt'](_0x18ab8b[_0xb142('0x25')],_0x18ab8b[_0xb142('0x26')],parseInt(_0x18ab8b[_0xb142('0x27')],0xa)+0x1);_0x18ab8b[_0xb142('0x35')]();}function handleUnpublished(_0x3e2f21){logger['error'](util[_0xb142('0x1d')](_0xb142('0x37'),_0x3e2f21[_0xb142('0x22')]));_0x3e2f21[_0xb142('0x38')](_0x3e2f21[_0xb142('0x25')],_0x3e2f21[_0xb142('0x26')],parseInt(_0x3e2f21['priority'],0xa)+0x1);_0x3e2f21['close']();}module[_0xb142('0x39')]={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index 33c94c3..851617e 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 _0x8b69=['substring','split','indexOf','trim','length','emit','headers','_inBody','line','exports','util','Transform','_localBuffer','inherits','_transform'];(function(_0x2bee30,_0x1bff03){var _0x60eb16=function(_0x2c9a93){while(--_0x2c9a93){_0x2bee30['push'](_0x2bee30['shift']());}};_0x60eb16(++_0x1bff03);}(_0x8b69,0x145));var _0x98b6=function(_0x9c445a,_0x36ccb1){_0x9c445a=_0x9c445a-0x0;var _0x48b216=_0x8b69[_0x9c445a];return _0x48b216;};'use strict';var util=require(_0x98b6('0x0'));var Transform=require('stream')[_0x98b6('0x1')];function AGIReply(_0x44ca81){Transform['call'](this,_0x44ca81);this[_0x98b6('0x2')]='';this['_inBody']=![];}util[_0x98b6('0x3')](AGIReply,Transform);AGIReply['prototype'][_0x98b6('0x4')]=function(_0x5e7e6e,_0x1a7190,_0x378d8b){var _0x312f14='\x0a',_0x344a33=['\x0a\x0a','\x0d\x0a\x0d\x0a'],_0xd35f38=-0x1,_0x4d9ca9=-0x1,_0x160e3b='',_0x1e104b=0x0,_0x37c20a='',_0x352c16='';this[_0x98b6('0x2')]+=_0x5e7e6e['toString']();_0x37c20a=this[_0x98b6('0x2')];if(!this['_inBody']){_0x1e104b=0x0;while(_0x344a33[_0x1e104b]){while((_0x4d9ca9=_0x37c20a['indexOf'](_0x344a33[_0x1e104b]))!=-0x1){_0x160e3b=_0x344a33[_0x1e104b];_0x352c16=_0x37c20a[_0x98b6('0x5')](0x0,_0x4d9ca9);_0x37c20a=_0x37c20a[_0x98b6('0x5')](_0x4d9ca9+_0x160e3b['length']);var _0x3914a3=_0x352c16[_0x98b6('0x6')](_0x312f14),_0x287714=0x0,_0x3e70a7={},_0x528fe6='',_0x11395b='',_0x28c473=-0x1;while(_0x3914a3[_0x287714]){_0x28c473=_0x3914a3[_0x287714][_0x98b6('0x7')](':');if(_0x28c473!=-0x1){_0x528fe6=_0x3914a3[_0x287714]['slice'](0x0,_0x28c473)[_0x98b6('0x8')]();_0x11395b=_0x3914a3[_0x287714]['slice'](_0x28c473+0x1)[_0x98b6('0x8')]();if(_0x528fe6[_0x98b6('0x9')]>0x0){_0x3e70a7[_0x528fe6]=_0x11395b;}}else{}_0x287714++;}this[_0x98b6('0xa')](_0x98b6('0xb'),_0x3e70a7);this[_0x98b6('0xc')]=!![];}_0x1e104b++;}this[_0x98b6('0x2')]=_0x37c20a;}else{while((_0xd35f38=_0x37c20a[_0x98b6('0x7')](_0x312f14))!=-0x1){_0x352c16=_0x37c20a['substring'](0x0,_0xd35f38);this[_0x98b6('0xa')](_0x98b6('0xd'),_0x352c16);_0x37c20a=_0x37c20a['substring'](_0xd35f38+_0x312f14['length']);}this[_0x98b6('0x2')]=_0x37c20a;}_0x378d8b();};module[_0x98b6('0xe')]=AGIReply; \ No newline at end of file +var _0xc1aa=['toString','indexOf','substring','length','split','slice','trim','emit','line','util','Transform','call','_inBody','inherits','_transform','_localBuffer'];(function(_0x5dbda5,_0x4bdb31){var _0x1d588d=function(_0x3a1403){while(--_0x3a1403){_0x5dbda5['push'](_0x5dbda5['shift']());}};_0x1d588d(++_0x4bdb31);}(_0xc1aa,0xa9));var _0xac1a=function(_0x19ba45,_0x48a601){_0x19ba45=_0x19ba45-0x0;var _0x22f7b2=_0xc1aa[_0x19ba45];return _0x22f7b2;};'use strict';var util=require(_0xac1a('0x0'));var Transform=require('stream')[_0xac1a('0x1')];function AGIReply(_0x2a91e8){Transform[_0xac1a('0x2')](this,_0x2a91e8);this['_localBuffer']='';this[_0xac1a('0x3')]=![];}util[_0xac1a('0x4')](AGIReply,Transform);AGIReply['prototype'][_0xac1a('0x5')]=function(_0x571359,_0x5bf521,_0x558a66){var _0x2b389a='\x0a',_0x115030=['\x0a\x0a','\x0d\x0a\x0d\x0a'],_0xcf0e5c=-0x1,_0x2231c8=-0x1,_0x1f070b='',_0x4a761f=0x0,_0x4882fc='',_0x130d6e='';this[_0xac1a('0x6')]+=_0x571359[_0xac1a('0x7')]();_0x4882fc=this[_0xac1a('0x6')];if(!this[_0xac1a('0x3')]){_0x4a761f=0x0;while(_0x115030[_0x4a761f]){while((_0x2231c8=_0x4882fc[_0xac1a('0x8')](_0x115030[_0x4a761f]))!=-0x1){_0x1f070b=_0x115030[_0x4a761f];_0x130d6e=_0x4882fc[_0xac1a('0x9')](0x0,_0x2231c8);_0x4882fc=_0x4882fc['substring'](_0x2231c8+_0x1f070b[_0xac1a('0xa')]);var _0xd155bd=_0x130d6e[_0xac1a('0xb')](_0x2b389a),_0x51d67e=0x0,_0x32ca0d={},_0x27c607='',_0x36b324='',_0x5cfba5=-0x1;while(_0xd155bd[_0x51d67e]){_0x5cfba5=_0xd155bd[_0x51d67e]['indexOf'](':');if(_0x5cfba5!=-0x1){_0x27c607=_0xd155bd[_0x51d67e][_0xac1a('0xc')](0x0,_0x5cfba5)[_0xac1a('0xd')]();_0x36b324=_0xd155bd[_0x51d67e][_0xac1a('0xc')](_0x5cfba5+0x1)[_0xac1a('0xd')]();if(_0x27c607[_0xac1a('0xa')]>0x0){_0x32ca0d[_0x27c607]=_0x36b324;}}else{}_0x51d67e++;}this[_0xac1a('0xe')]('headers',_0x32ca0d);this[_0xac1a('0x3')]=!![];}_0x4a761f++;}this[_0xac1a('0x6')]=_0x4882fc;}else{while((_0xcf0e5c=_0x4882fc['indexOf'](_0x2b389a))!=-0x1){_0x130d6e=_0x4882fc[_0xac1a('0x9')](0x0,_0xcf0e5c);this['emit'](_0xac1a('0xf'),_0x130d6e);_0x4882fc=_0x4882fc[_0xac1a('0x9')](_0xcf0e5c+_0x2b389a['length']);}this['_localBuffer']=_0x4882fc;}_0x558a66();};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 afc279b..23c5c71 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 _0xc368=['agentLogin','LoginUser','agentPause','PauseUser','agentUnpause','UnpauseUser','agentLogout','moment','client','http','request','then','error','result','catch','getSquareProjects','GetSquareProjects','name','ShowSquareProject','production','ShowMailAccount','MailServerOut','Smtp','CloudProvider','email','getSquareProjectById','getVoiceQueueById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','dsn','getUserById','getContactByPhone','GetContactByPhone','phone','ShowTrunk','getSoundById','ShowSound','save_name','getIntervalById','ShowInterval','Interval','Intervals','getSmsAccountById','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','createSquareMessage','ShowCmHopper','ListId','ShowPause'];(function(_0x5e424e,_0x4268f9){var _0x47e0c1=function(_0x1fdd87){while(--_0x1fdd87){_0x5e424e['push'](_0x5e424e['shift']());}};_0x47e0c1(++_0x4268f9);}(_0xc368,0x7b));var _0x8c36=function(_0x375103,_0x296882){_0x375103=_0x375103-0x0;var _0x1c8dea=_0xc368[_0x375103];return _0x1c8dea;};'use strict';var _=require('lodash');var moment=require(_0x8c36('0x0'));var jayson=require('jayson/promise');var client=jayson[_0x8c36('0x1')][_0x8c36('0x2')]({'port':0x2329});function request(_0x20e697,_0x2640c5){return new Promise(function(_0x288b85,_0x5d3b27){return client[_0x8c36('0x3')](_0x20e697,_0x2640c5)[_0x8c36('0x4')](function(_0x912acb){if(_0x912acb[_0x8c36('0x5')]){return _0x5d3b27(_0x912acb['error']['message']);}else{return _0x288b85(_0x912acb[_0x8c36('0x6')]);}})[_0x8c36('0x7')](function(_0x3e76be){return _0x5d3b27(_0x3e76be);});});}exports[_0x8c36('0x8')]=function(){return request(_0x8c36('0x9'),{'options':{'raw':![],'attributes':['id',_0x8c36('0xa'),'production']}});};exports['getSquareProject']=function(_0x49f227){return request(_0x8c36('0xb'),{'options':{'raw':![],'where':{'name':_0x49f227},'attributes':[_0x8c36('0xc')]}});};exports['getMailAccountById']=function(_0x36cb13){return request(_0x8c36('0xd'),{'options':{'raw':![],'where':{'id':_0x36cb13},'include':[{'model':_0x8c36('0xe'),'as':_0x8c36('0xf'),'include':[{'model':_0x8c36('0x10'),'as':_0x8c36('0x10')}]}],'attributes':['id',_0x8c36('0xa'),_0x8c36('0x11')],'smtp':!![]}});};exports[_0x8c36('0x12')]=function(_0x11f8fa){return request(_0x8c36('0xb'),{'options':{'where':{'id':_0x11f8fa},'attributes':[_0x8c36('0xa')]}});};exports[_0x8c36('0x13')]=function(_0x220f18){return request('ShowVoiceQueue',{'options':{'where':{'id':_0x220f18},'attributes':[_0x8c36('0xa')]}});};exports['getVariableById']=function(_0xea7509){return request(_0x8c36('0x14'),{'options':{'where':{'id':_0xea7509},'attributes':[_0x8c36('0xa')]}});};exports[_0x8c36('0x15')]=function(_0xcfdbf7){return request(_0x8c36('0x16'),{'options':{'where':{'id':_0xcfdbf7},'attributes':[_0x8c36('0x17')]}});};exports[_0x8c36('0x18')]=function(_0x30229e){return request('ShowUser',{'options':{'where':{'id':_0x30229e},'attributes':[_0x8c36('0xa')]}});};exports[_0x8c36('0x19')]=function(_0x47832a){return request(_0x8c36('0x1a'),{'options':{'where':{'phone':_0x47832a[_0x8c36('0x1b')]},'attributes':['id']}});};exports['getTrunkById']=function(_0x15100f){return request(_0x8c36('0x1c'),{'options':{'where':{'id':_0x15100f},'attributes':[_0x8c36('0xa')]}});};exports[_0x8c36('0x1d')]=function(_0xc30310){return request(_0x8c36('0x1e'),{'options':{'where':{'id':_0xc30310},'attributes':[_0x8c36('0x1f')]}});};exports[_0x8c36('0x20')]=function(_0x153735){return request(_0x8c36('0x21'),{'options':{'raw':![],'where':{'id':_0x153735},'include':[{'model':_0x8c36('0x22'),'as':_0x8c36('0x23')}]}});};exports[_0x8c36('0x24')]=function(_0x51fd6c){return request('ShowSmsAccount',{'options':{'where':{'id':_0x51fd6c},'attributes':['id','name']}});};exports['createSmsMessage']=function(_0x2269f5){return request(_0x8c36('0x25'),{'body':_0x2269f5});};exports[_0x8c36('0x26')]=function(_0x2c9e9a){return request(_0x8c36('0x27'),{'body':_0x2c9e9a});};exports[_0x8c36('0x28')]=function(_0x4bf4c2){return request(_0x8c36('0x29'),{'body':_['merge'](_0x4bf4c2,{'project_name':_0x4bf4c2[_0x8c36('0x2a')],'prev_project_name':_0x4bf4c2['arg_2']||'','is_subproject':_0x4bf4c2[_0x8c36('0x2b')]?!![]:![],'leaveAt':moment()[_0x8c36('0x2c')](_0x8c36('0x2d'))})});};exports[_0x8c36('0x2e')]=function(_0x50aa48){return request('CreateSquareRecording',{'body':_0x50aa48});};exports[_0x8c36('0x2f')]=function(_0x28fa76){return request('CreateSquareMessage',{'body':_0x28fa76});};exports['createCmContact']=function(_0x418663){return request(_0x8c36('0x30'),{'options':{'raw':![],'where':{'phone':_0x418663['phone'],'ListId':_0x418663[_0x8c36('0x31')]}}})[_0x8c36('0x4')](function(_0x3ca98e){if(_0x3ca98e){return _0x3ca98e;}return request('CreateCmContact',{'body':_0x418663});});};exports['getPauseById']=function(_0x46b72f){return request(_0x8c36('0x32'),{'options':{'where':{'id':_0x46b72f},'attributes':[_0x8c36('0xa')]}});};exports[_0x8c36('0x33')]=function(_0x3ae970,_0x2e8855){return request(_0x8c36('0x34'),{'body':{'interface':_0x2e8855},'options':{'where':_0x3ae970}});};exports[_0x8c36('0x35')]=function(_0xda4e74,_0x2d6476,_0x35a349){return request(_0x8c36('0x36'),{'body':{'type':_0x2d6476,'uniqueid':_0x35a349},'options':{'where':_0xda4e74}});};exports[_0x8c36('0x37')]=function(_0x178fe5){return request(_0x8c36('0x38'),{'body':{},'options':{'where':_0x178fe5}});};exports[_0x8c36('0x39')]=function(_0x2e6b95){return request('LogoutUser',{'body':{},'options':{'where':_0x2e6b95}});}; \ No newline at end of file +var _0x19da=['ShowMailAccount','CloudProvider','getSquareProjectById','getVoiceQueueById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','dsn','getUserById','ShowUser','getContactByPhone','GetContactByPhone','phone','getTrunkById','ShowTrunk','getSoundById','ShowSound','save_name','getIntervalById','ShowInterval','Interval','Intervals','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','ShowCmHopper','ListId','then','getPauseById','ShowPause','LoginUser','agentUnpause','agentLogout','LogoutUser','moment','client','request','error','message','result','catch','GetSquareProjects','name','production','ShowSquareProject','getMailAccountById'];(function(_0x48c04c,_0x338592){var _0x494584=function(_0x5bc498){while(--_0x5bc498){_0x48c04c['push'](_0x48c04c['shift']());}};_0x494584(++_0x338592);}(_0x19da,0x9f));var _0xa19d=function(_0x52e0ee,_0x52f7c1){_0x52e0ee=_0x52e0ee-0x0;var _0x32534c=_0x19da[_0x52e0ee];return _0x32534c;};'use strict';var _=require('lodash');var moment=require(_0xa19d('0x0'));var jayson=require('jayson/promise');var client=jayson[_0xa19d('0x1')]['http']({'port':0x2329});function request(_0x3a48f4,_0x17f1c6){return new Promise(function(_0x504a2c,_0x179db7){return client[_0xa19d('0x2')](_0x3a48f4,_0x17f1c6)['then'](function(_0x22aec0){if(_0x22aec0[_0xa19d('0x3')]){return _0x179db7(_0x22aec0[_0xa19d('0x3')][_0xa19d('0x4')]);}else{return _0x504a2c(_0x22aec0[_0xa19d('0x5')]);}})[_0xa19d('0x6')](function(_0x197c4e){return _0x179db7(_0x197c4e);});});}exports['getSquareProjects']=function(){return request(_0xa19d('0x7'),{'options':{'raw':![],'attributes':['id',_0xa19d('0x8'),_0xa19d('0x9')]}});};exports['getSquareProject']=function(_0x2087d1){return request(_0xa19d('0xa'),{'options':{'raw':![],'where':{'name':_0x2087d1},'attributes':[_0xa19d('0x9')]}});};exports[_0xa19d('0xb')]=function(_0x463515){return request(_0xa19d('0xc'),{'options':{'raw':![],'where':{'id':_0x463515},'include':[{'model':'MailServerOut','as':'Smtp','include':[{'model':_0xa19d('0xd'),'as':_0xa19d('0xd')}]}],'attributes':['id','name','email'],'smtp':!![]}});};exports[_0xa19d('0xe')]=function(_0xf675b1){return request('ShowSquareProject',{'options':{'where':{'id':_0xf675b1},'attributes':[_0xa19d('0x8')]}});};exports[_0xa19d('0xf')]=function(_0x464b54){return request('ShowVoiceQueue',{'options':{'where':{'id':_0x464b54},'attributes':[_0xa19d('0x8')]}});};exports['getVariableById']=function(_0x3347d8){return request(_0xa19d('0x10'),{'options':{'where':{'id':_0x3347d8},'attributes':[_0xa19d('0x8')]}});};exports[_0xa19d('0x11')]=function(_0x30b1a2){return request(_0xa19d('0x12'),{'options':{'where':{'id':_0x30b1a2},'attributes':[_0xa19d('0x13')]}});};exports[_0xa19d('0x14')]=function(_0x521f95){return request(_0xa19d('0x15'),{'options':{'where':{'id':_0x521f95},'attributes':['name']}});};exports[_0xa19d('0x16')]=function(_0xe493f1){return request(_0xa19d('0x17'),{'options':{'where':{'phone':_0xe493f1[_0xa19d('0x18')]},'attributes':['id']}});};exports[_0xa19d('0x19')]=function(_0x4591ab){return request(_0xa19d('0x1a'),{'options':{'where':{'id':_0x4591ab},'attributes':['name']}});};exports[_0xa19d('0x1b')]=function(_0x3d9b03){return request(_0xa19d('0x1c'),{'options':{'where':{'id':_0x3d9b03},'attributes':[_0xa19d('0x1d')]}});};exports[_0xa19d('0x1e')]=function(_0x281df7){return request(_0xa19d('0x1f'),{'options':{'raw':![],'where':{'id':_0x281df7},'include':[{'model':_0xa19d('0x20'),'as':_0xa19d('0x21')}]}});};exports['getSmsAccountById']=function(_0x3d9afb){return request('ShowSmsAccount',{'options':{'where':{'id':_0x3d9afb},'attributes':['id',_0xa19d('0x8')]}});};exports[_0xa19d('0x22')]=function(_0x23efc1){return request(_0xa19d('0x23'),{'body':_0x23efc1});};exports[_0xa19d('0x24')]=function(_0x1b15b3){return request(_0xa19d('0x25'),{'body':_0x1b15b3});};exports[_0xa19d('0x26')]=function(_0x39127e){return request(_0xa19d('0x27'),{'body':_[_0xa19d('0x28')](_0x39127e,{'project_name':_0x39127e[_0xa19d('0x29')],'prev_project_name':_0x39127e[_0xa19d('0x2a')]||'','is_subproject':_0x39127e[_0xa19d('0x2a')]?!![]:![],'leaveAt':moment()[_0xa19d('0x2b')](_0xa19d('0x2c'))})});};exports[_0xa19d('0x2d')]=function(_0x1e1306){return request(_0xa19d('0x2e'),{'body':_0x1e1306});};exports[_0xa19d('0x2f')]=function(_0x36552d){return request('CreateSquareMessage',{'body':_0x36552d});};exports['createCmContact']=function(_0x5c6537){return request(_0xa19d('0x30'),{'options':{'raw':![],'where':{'phone':_0x5c6537[_0xa19d('0x18')],'ListId':_0x5c6537[_0xa19d('0x31')]}}})[_0xa19d('0x32')](function(_0x110b29){if(_0x110b29){return _0x110b29;}return request('CreateCmContact',{'body':_0x5c6537});});};exports[_0xa19d('0x33')]=function(_0xe1bb86){return request(_0xa19d('0x34'),{'options':{'where':{'id':_0xe1bb86},'attributes':[_0xa19d('0x8')]}});};exports['agentLogin']=function(_0x340ca4,_0x31c621){return request(_0xa19d('0x35'),{'body':{'interface':_0x31c621},'options':{'where':_0x340ca4}});};exports['agentPause']=function(_0x500297,_0x2e11ef,_0x124df6){return request('PauseUser',{'body':{'type':_0x2e11ef,'uniqueid':_0x124df6},'options':{'where':_0x500297}});};exports[_0xa19d('0x36')]=function(_0x30eba5){return request('UnpauseUser',{'body':{},'options':{'where':_0x30eba5}});};exports[_0xa19d('0x37')]=function(_0x1495a8){return request(_0xa19d('0x38'),{'body':{},'options':{'where':_0x1495a8}});}; \ 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 bd0a528..94d8c66 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 _0xd9a8=['./polly','./lex','exports'];(function(_0x327015,_0x49075e){var _0xf1fe39=function(_0x41b2b3){while(--_0x41b2b3){_0x327015['push'](_0x327015['shift']());}};_0xf1fe39(++_0x49075e);}(_0xd9a8,0xc3));var _0x8d9a=function(_0x12bff1,_0x44144d){_0x12bff1=_0x12bff1-0x0;var _0x4790bb=_0xd9a8[_0x12bff1];return _0x4790bb;};var polly=require(_0x8d9a('0x0'));var lex=require(_0x8d9a('0x1'));module[_0x8d9a('0x2')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0x9829=['exports','./polly','./lex'];(function(_0x5f18ff,_0x288a1f){var _0x169625=function(_0x1c5589){while(--_0x1c5589){_0x5f18ff['push'](_0x5f18ff['shift']());}};_0x169625(++_0x288a1f);}(_0x9829,0xc4));var _0x9982=function(_0x3ec122,_0x55150a){_0x3ec122=_0x3ec122-0x0;var _0x4ecf41=_0x9829[_0x3ec122];return _0x4ecf41;};var polly=require(_0x9982('0x0'));var lex=require(_0x9982('0x1'));module[_0x9982('0x2')]={'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 6c6d4a1..7c3aa4e 100644 --- a/server/services/agi/scripts/aws/lex/index.js +++ b/server/services/agi/scripts/aws/lex/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -'use strict';var lex=require('./lib/api');module['exports']=function(_0x352a8d,_0x2a91b2,_0x4611be,_0x20aa4b,_0x447096,_0x192d48){return lex(_0x352a8d,_0x2a91b2,_0x4611be,_0x20aa4b,_0x447096,_0x192d48);}; \ No newline at end of file +var _0x6f0d=['exports'];(function(_0x3d3aaa,_0x58bd33){var _0x198b86=function(_0x1107a6){while(--_0x1107a6){_0x3d3aaa['push'](_0x3d3aaa['shift']());}};_0x198b86(++_0x58bd33);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x1d2122,_0x1d2c8){_0x1d2122=_0x1d2122-0x0;var _0x5d6dc5=_0x6f0d[_0x1d2122];return _0x5d6dc5;};'use strict';var lex=require('./lib/api');module[_0xd6f0('0x0')]=function(_0x64ebf2,_0xd1480,_0x107a8c,_0x573473,_0x275230,_0x135a93){return lex(_0x64ebf2,_0xd1480,_0x107a8c,_0x573473,_0x275230,_0x135a93);}; \ 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 dd91616..324bb1b 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(_0x301747,_0x290dbe){var _0x2bed99=function(_0x34715c){while(--_0x34715c){_0x301747['push'](_0x301747['shift']());}};_0x2bed99(++_0x290dbe);}(_0xa9e0,0x123));var _0x0a9e=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0xa9e0[_0xae7c2f];return _0x5d7001;};'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(_0x5ac209,_0x5ca986){var _0x3e1ca9=function(_0x5bd0d9){while(--_0x5bd0d9){_0x5ac209['push'](_0x5ac209['shift']());}};_0x3e1ca9(++_0x5ca986);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0xa9e0[_0xbe200f];return _0x192597;};'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 744c09e..db0a932 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 _0x77ef=['./lib/api','exports'];(function(_0x24a37f,_0x54d074){var _0x2374b2=function(_0x5148e8){while(--_0x5148e8){_0x24a37f['push'](_0x24a37f['shift']());}};_0x2374b2(++_0x54d074);}(_0x77ef,0x1c8));var _0xf77e=function(_0x2c00d1,_0x5425fc){_0x2c00d1=_0x2c00d1-0x0;var _0x5a7f2f=_0x77ef[_0x2c00d1];return _0x5a7f2f;};'use strict';var polly=require(_0xf77e('0x0'));module[_0xf77e('0x1')]=function(_0x4612ef,_0x2c1d08,_0x54e857,_0x3ac3af,_0x241ffd,_0x100c3b,_0x88219e){return polly(_0x4612ef,_0x2c1d08,_0x54e857,_0x3ac3af,_0x241ffd,_0x100c3b,_0x88219e);}; \ No newline at end of file +var _0xaea4=['exports','./lib/api'];(function(_0x4f9ef1,_0x3cead7){var _0x3d3573=function(_0x188b68){while(--_0x188b68){_0x4f9ef1['push'](_0x4f9ef1['shift']());}};_0x3d3573(++_0x3cead7);}(_0xaea4,0x137));var _0x4aea=function(_0x5a2089,_0xeddc7e){_0x5a2089=_0x5a2089-0x0;var _0x40c8f9=_0xaea4[_0x5a2089];return _0x40c8f9;};'use strict';var polly=require(_0x4aea('0x0'));module[_0x4aea('0x1')]=function(_0x4201e8,_0x1ff22c,_0x5e1a0b,_0xb3bd74,_0x397ad9,_0x856bef,_0x185192){return polly(_0x4201e8,_0x1ff22c,_0x5e1a0b,_0xb3bd74,_0x397ad9,_0x856bef,_0x185192);}; \ 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 a92f45f..3633203 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 _0x8761=['exports','Polly','text','mp3','path','bluebird','randomstring','synthesizeSpeech','AudioStream','writeFile'];(function(_0x369bb1,_0x4bc373){var _0x3d9dd9=function(_0x2d1168){while(--_0x2d1168){_0x369bb1['push'](_0x369bb1['shift']());}};_0x3d9dd9(++_0x4bc373);}(_0x8761,0x68));var _0x1876=function(_0x1a937a,_0x227d6c){_0x1a937a=_0x1a937a-0x0;var _0x5443eb=_0x8761[_0x1a937a];return _0x5443eb;};'use strict';var fs=require('fs');var path=require(_0x1876('0x0'));var BPromise=require(_0x1876('0x1'));var rs=require(_0x1876('0x2'));var AWS=require('aws-sdk');function pollyResult(_0x520d54,_0x5dc6fc,_0x50bc0b){return new BPromise(function(_0x492fd1,_0x3b044e){_0x520d54[_0x1876('0x3')](_0x5dc6fc,function(_0x313cf1,_0x1aecd5){if(_0x313cf1){_0x3b044e(_0x313cf1);}else if(_0x1aecd5){if(_0x1aecd5[_0x1876('0x4')]instanceof Buffer){fs[_0x1876('0x5')](_0x50bc0b,_0x1aecd5[_0x1876('0x4')],function(_0x4868bd){if(_0x4868bd){_0x3b044e(_0x4868bd);}else{_0x492fd1();}});}else{_0x3b044e(new Error('Invalid\x20data\x20response\x20from\x20aws\x20Polly!'));}}else{_0x3b044e(new Error('No\x20data\x20response\x20from\x20aws\x20Polly!'));}});});}module[_0x1876('0x6')]=function(_0x5c8686,_0x145ffa,_0xdcdf66,_0xcf1139,_0x304d90,_0x165c26,_0xdcc2d5){var _0x2f2fa4=new AWS[(_0x1876('0x7'))]({'accessKeyId':_0x5c8686,'secretAccessKey':_0x145ffa,'region':_0xdcdf66});var _0xb3da05={'Text':_0x304d90,'TextType':_0x165c26||_0x1876('0x8'),'OutputFormat':_0x1876('0x9'),'VoiceId':_0xcf1139};return pollyResult(_0x2f2fa4,_0xb3da05,_0xdcc2d5);}; \ No newline at end of file +var _0x4b8c=['Polly','mp3','bluebird','aws-sdk','synthesizeSpeech','AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','exports'];(function(_0x217ff6,_0x36f75d){var _0x417c93=function(_0x4787d2){while(--_0x4787d2){_0x217ff6['push'](_0x217ff6['shift']());}};_0x417c93(++_0x36f75d);}(_0x4b8c,0xb6));var _0xc4b8=function(_0x234157,_0x1a543a){_0x234157=_0x234157-0x0;var _0x27919c=_0x4b8c[_0x234157];return _0x27919c;};'use strict';var fs=require('fs');var path=require('path');var BPromise=require(_0xc4b8('0x0'));var rs=require('randomstring');var AWS=require(_0xc4b8('0x1'));function pollyResult(_0x1f2b4d,_0x5d188d,_0x16f393){return new BPromise(function(_0x58ec55,_0x11fe98){_0x1f2b4d[_0xc4b8('0x2')](_0x5d188d,function(_0x948be7,_0x3c4e4b){if(_0x948be7){_0x11fe98(_0x948be7);}else if(_0x3c4e4b){if(_0x3c4e4b[_0xc4b8('0x3')]instanceof Buffer){fs[_0xc4b8('0x4')](_0x16f393,_0x3c4e4b[_0xc4b8('0x3')],function(_0x21b90d){if(_0x21b90d){_0x11fe98(_0x21b90d);}else{_0x58ec55();}});}else{_0x11fe98(new Error(_0xc4b8('0x5')));}}else{_0x11fe98(new Error('No\x20data\x20response\x20from\x20aws\x20Polly!'));}});});}module[_0xc4b8('0x6')]=function(_0x226ac9,_0x17f7be,_0xbb3173,_0x4e73b9,_0x3ea468,_0x51a28d,_0x5be275){var _0x2f37a5=new AWS[(_0xc4b8('0x7'))]({'accessKeyId':_0x226ac9,'secretAccessKey':_0x17f7be,'region':_0xbb3173});var _0x59d9d1={'Text':_0x3ea468,'TextType':_0x51a28d||'text','OutputFormat':_0xc4b8('0x8'),'VoiceId':_0x4e73b9};return pollyResult(_0x2f37a5,_0x59d9d1,_0x5be275);}; \ 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 29aee94..eed6f79 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 _0xdf2c=['exports'];(function(_0x531682,_0x22c0c1){var _0x16bbe4=function(_0x1fbbd7){while(--_0x1fbbd7){_0x531682['push'](_0x531682['shift']());}};_0x16bbe4(++_0x22c0c1);}(_0xdf2c,0xaf));var _0xcdf2=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0xdf2c[_0x2be8c2];return _0x97f531;};'use strict';var asr=require('./lib/api');module[_0xcdf2('0x0')]=function(_0x52906a,_0x2227a1,_0x337bbb,_0x171e03){return asr(_0x52906a,_0x2227a1,_0x337bbb);}; \ No newline at end of file +var _0xa3c8=['./lib/api','exports'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xa3c8,0x1b8));var _0x8a3c=function(_0x18c987,_0x50c8a8){_0x18c987=_0x18c987-0x0;var _0x4ea52a=_0xa3c8[_0x18c987];return _0x4ea52a;};'use strict';var asr=require(_0x8a3c('0x0'));module[_0x8a3c('0x1')]=function(_0x58d8c0,_0x57a5fc,_0x3db0bf,_0x4d4a59){return asr(_0x58d8c0,_0x57a5fc,_0x3db0bf);}; \ 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 f925977..0831e51 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 _0xb28a=['string','length','filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string','lang\x20should\x20be\x20a\x20string','readFileSync','toString','base64','/v1/speech:recognize?key=','8000','bluebird','https://speech.googleapis.com'];(function(_0x3801fc,_0x386ced){var _0x44eab7=function(_0x4331d2){while(--_0x4331d2){_0x3801fc['push'](_0x3801fc['shift']());}};_0x44eab7(++_0x386ced);}(_0xb28a,0x166));var _0xab28=function(_0x17736b,_0x58c164){_0x17736b=_0x17736b-0x0;var _0x484ec4=_0xb28a[_0x17736b];return _0x484ec4;};'use strict';var url=require('url');var BPromise=require(_0xab28('0x0'));var fs=require('fs');var host=_0xab28('0x1');module['exports']=function(_0x45d26d,_0x4cb73b,_0x5ae2aa){return new BPromise(function(_0x4b013a,_0x451fc9){var _0x1cdc41;if(typeof _0x45d26d!==_0xab28('0x2')||_0x45d26d[_0xab28('0x3')]===0x0){return _0x451fc9(_0xab28('0x4'));}if(typeof _0x4cb73b!==_0xab28('0x2')||_0x4cb73b[_0xab28('0x3')]===0x0){return _0x451fc9(_0xab28('0x5'));}if(typeof _0x5ae2aa!=='undefined'&&(typeof _0x5ae2aa!=='string'||_0x5ae2aa[_0xab28('0x3')]===0x0)){return _0x451fc9(_0xab28('0x6'));}try{_0x1cdc41=fs[_0xab28('0x7')](_0x45d26d)[_0xab28('0x8')](_0xab28('0x9'));}catch(_0x2ac052){return _0x451fc9(_0x2ac052);}return _0x4b013a({'method':'POST','uri':host+_0xab28('0xa')+_0x4cb73b,'body':{'config':{'encoding':'LINEAR16','sampleRateHertz':_0xab28('0xb'),'languageCode':_0x5ae2aa},'audio':{'content':_0x1cdc41}},'json':!![]});});}; \ No newline at end of file +var _0x6e16=['base64','POST','/v1/speech:recognize?key=','LINEAR16','8000','https://speech.googleapis.com','length','filepath\x20should\x20be\x20a\x20string','string','key\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','readFileSync','toString'];(function(_0x492841,_0x41e322){var _0x30b646=function(_0xfb2dc1){while(--_0xfb2dc1){_0x492841['push'](_0x492841['shift']());}};_0x30b646(++_0x41e322);}(_0x6e16,0x1d3));var _0x66e1=function(_0x4415a1,_0x1b1bc1){_0x4415a1=_0x4415a1-0x0;var _0x33c40e=_0x6e16[_0x4415a1];return _0x33c40e;};'use strict';var url=require('url');var BPromise=require('bluebird');var fs=require('fs');var host=_0x66e1('0x0');module['exports']=function(_0xac185,_0x4e3854,_0x4f811b){return new BPromise(function(_0x45d429,_0x491345){var _0x892e60;if(typeof _0xac185!=='string'||_0xac185[_0x66e1('0x1')]===0x0){return _0x491345(_0x66e1('0x2'));}if(typeof _0x4e3854!==_0x66e1('0x3')||_0x4e3854['length']===0x0){return _0x491345(_0x66e1('0x4'));}if(typeof _0x4f811b!==_0x66e1('0x5')&&(typeof _0x4f811b!==_0x66e1('0x3')||_0x4f811b[_0x66e1('0x1')]===0x0)){return _0x491345(_0x66e1('0x6'));}try{_0x892e60=fs[_0x66e1('0x7')](_0xac185)[_0x66e1('0x8')](_0x66e1('0x9'));}catch(_0x9cba7){return _0x491345(_0x9cba7);}return _0x45d429({'method':_0x66e1('0xa'),'uri':host+_0x66e1('0xb')+_0x4e3854,'body':{'config':{'encoding':_0x66e1('0xc'),'sampleRateHertz':_0x66e1('0xd'),'languageCode':_0x4f811b},'audio':{'content':_0x892e60}},'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 1166580..a22fc8a 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 _0x7b8e=['exports','./asr'];(function(_0x422905,_0x3bce3a){var _0x33dc6c=function(_0x4852c9){while(--_0x4852c9){_0x422905['push'](_0x422905['shift']());}};_0x33dc6c(++_0x3bce3a);}(_0x7b8e,0x129));var _0xe7b8=function(_0x31163b,_0x520919){_0x31163b=_0x31163b-0x0;var _0x5f2597=_0x7b8e[_0x31163b];return _0x5f2597;};var asr=require(_0xe7b8('0x0'));module[_0xe7b8('0x1')]={'asr':asr}; \ No newline at end of file +var _0x9f4a=['./asr'];(function(_0x5488a3,_0x12c342){var _0x4faea4=function(_0x609679){while(--_0x609679){_0x5488a3['push'](_0x5488a3['shift']());}};_0x4faea4(++_0x12c342);}(_0x9f4a,0x103));var _0xa9f4=function(_0x79f93f,_0x196849){_0x79f93f=_0x79f93f-0x0;var _0x489d80=_0x9f4a[_0x79f93f];return _0x489d80;};var asr=require(_0xa9f4('0x0'));module['exports']={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/scripts/index.js b/server/services/agi/scripts/index.js index 679293e..97c89f5 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 _0x116c=['length','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','boolValue','intent','displayName','languageCode','responseId','fulfillmentText','tildeASR','asr','Tilde\x20ASR\x20confidence','awsPolly','polly','lex','ispeechTTS','format','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','nda','text','channelData','CustomAction','CustomActionData','AudioFromTts','audiofile','dirName','apiai-promise','bluebird','dialogflow','https','md5','path','querystring','request-promise','sox','google-tts-api','url','parse','util','./aws','./google','./sestek','./tilde','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','https:','host','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusCode','statusMessage','createWriteStream','info','finish\x20download\x20file','close','error','unlink','download\x20error','pipe','get','data','end','transcode','wav','start','tmp','.wav','base64','chmodSync','777','split','toString','https://texttospeech.googleapis.com/v1/','?key=','input','voice','audioConfig','MP3','text:synthesize','POST','resolve','.mp3','from','audioContent','writeFile','generate','then','googleCloudTTS\x20path','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','application/x-www-form-urlencoded','f.req=','stringify','null','slice','parse\x20response\x20failed:\x0a','text\x20length\x20limit\x20reached','writeFileSync','goggleTTS\x20path','googleASR','uri','results','alternatives','transcript','join','map','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s','name','googleDialogflow','textRequest','result','source','resolvedQuery','action','actionIncomplete','fulfillment','speech','score','status','code','metadata','isFallbackIntent','googleDialogflowV2','SessionsClient','sessionPath','detectIntent'];(function(_0x493e36,_0x3aad0e){var _0x20f72c=function(_0x5029d4){while(--_0x5029d4){_0x493e36['push'](_0x493e36['shift']());}};_0x20f72c(++_0x3aad0e);}(_0x116c,0xa9));var _0xc116=function(_0x2b3757,_0x432e14){_0x2b3757=_0x2b3757-0x0;var _0x1fc53b=_0x116c[_0x2b3757];return _0x1fc53b;};'use strict';var apiai=require(_0xc116('0x0'));var BPromise=require(_0xc116('0x1'));var dialogflow=require(_0xc116('0x2'));var fs=require('fs');var http=require('http');var https=require(_0xc116('0x3'));var md5=require(_0xc116('0x4'));var path=require(_0xc116('0x5'));var querystring=require(_0xc116('0x6'));var rp=require(_0xc116('0x7'));var rs=require('randomstring');var sox=require(_0xc116('0x8'));var tts=require(_0xc116('0x9'));var urlParse=require(_0xc116('0xa'))[_0xc116('0xb')];var util=require(_0xc116('0xc'));var aws=require(_0xc116('0xd'));var google=require(_0xc116('0xe'));var sestek=require(_0xc116('0xf'));var tilde=require(_0xc116('0x10'));var logger=require(_0xc116('0x11'))(_0xc116('0x12'));var ISPEECH_API=_0xc116('0x13');function downloadFile(_0xcdf9ed,_0x5d392f){return new BPromise(function(_0xea1d60,_0x459426){var _0x18bb0f=urlParse(_0xcdf9ed);var _0xc162a=_0x18bb0f[_0xc116('0x14')]===_0xc116('0x15')?https:http;var _0x171b43={'host':_0x18bb0f[_0xc116('0x16')],'path':_0x18bb0f[_0xc116('0x5')],'headers':{'user-agent':'WHAT_EVER'}};_0xc162a['get'](_0x171b43,function(_0x504c46){if(_0x504c46['statusCode']!==0xc8){logger['error'](_0xc116('0x17')+_0xcdf9ed+_0xc116('0x18')+_0x504c46[_0xc116('0x19')]+'\x20('+_0x504c46[_0xc116('0x1a')]+')');_0x459426(new Error(_0xc116('0x17')+_0xcdf9ed+_0xc116('0x18')+_0x504c46['statusCode']+'\x20('+_0x504c46[_0xc116('0x1a')]+')'));return;}var _0x579e59=fs[_0xc116('0x1b')](_0x5d392f);_0x579e59['on']('finish',function(){logger[_0xc116('0x1c')](_0xc116('0x1d'));_0x579e59[_0xc116('0x1e')](_0xea1d60);});_0x579e59['on'](_0xc116('0x1f'),function(_0x48efd0){fs[_0xc116('0x20')](_0x5d392f);logger[_0xc116('0x1f')](_0xc116('0x21'),_0x48efd0);_0x459426(_0x48efd0);});_0x504c46[_0xc116('0x22')](_0x579e59);})['on'](_0xc116('0x1f'),function(_0x33a2fd){logger[_0xc116('0x1f')](_0x33a2fd);_0x459426(_0x33a2fd);})['end']();});}function uploadFile(_0x2157fb){return new BPromise(function(_0x3299d8,_0x136815){var _0x2a7974=urlParse(_0x2157fb);var _0x148912=_0x2a7974[_0xc116('0x14')]===_0xc116('0x15')?https:http;var _0x2c1a7b={'host':_0x2a7974[_0xc116('0x16')],'path':_0x2a7974['path'],'headers':{'user-agent':'WHAT_EVER'}};_0x148912[_0xc116('0x23')](_0x2c1a7b,function(_0x2cc997){if(_0x2cc997['statusCode']!==0xc8){_0x136815(new Error(_0xc116('0x17')+_0x2157fb+_0xc116('0x18')+_0x2cc997[_0xc116('0x19')]+'\x20('+_0x2cc997[_0xc116('0x1a')]+')'));return;}var _0x1b1255='';_0x2cc997['on'](_0xc116('0x24'),function(_0x4a88ca){_0x1b1255+=_0x4a88ca;});_0x2cc997['on'](_0xc116('0x25'),function(){_0x3299d8(_0x1b1255);});})['on']('error',function(_0x292be5){_0x136815(_0x292be5);})[_0xc116('0x25')]();});}function convertFile(_0x48bc4d,_0x111856){return new BPromise(function(_0x3a2bf7,_0x504411){var _0x2acd47=sox[_0xc116('0x26')](_0x48bc4d,_0x111856,{'sampleRate':0x1f40,'format':_0xc116('0x27'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x2acd47['on'](_0xc116('0x1f'),function(_0x43c245){logger[_0xc116('0x1f')]('error\x20convert',_0x43c245);_0x504411(_0x43c245);});_0x2acd47['on']('end',function(){logger[_0xc116('0x1c')]('finish\x20to\x20convert');_0x3a2bf7();});_0x2acd47[_0xc116('0x28')]();});}function base64Decode(_0x316c9e,_0x5ad6e9){var _0x53134b=path['resolve'](__dirname,_0xc116('0x29'),rs['generate'](0x4)+_0xc116('0x2a'));fs['writeFileSync'](_0x53134b,_0x316c9e,_0xc116('0x2b'));return convertFile(_0x53134b,_0x5ad6e9)['then'](function(){try{fs[_0xc116('0x20')](_0x53134b);fs[_0xc116('0x2c')](_0x5ad6e9,_0xc116('0x2d'));}catch(_0x2777ee){logger[_0xc116('0x1f')](_0x2777ee);}return _0x5ad6e9[_0xc116('0x2e')]('.')[0x0];});}function base64Encode(_0x3f0d2b){var _0x585c61=fs['readFileSync'](_0x3f0d2b);return new Buffer(_0x585c61)[_0xc116('0x2f')]('base64');}exports['googleCloudTTS']=function(_0x1020a3,_0x52074e,_0x2a7e7c,_0x46c55b,_0x11b0ad,_0x87a175){var _0x129e77,_0x18f5ed;var _0x16f739=_0xc116('0x30');var _0x5baa65=_0xc116('0x31')+_0x1020a3;var _0x1612ae={};if(_0x52074e==='ssml'){_0x1612ae['input']={'ssml':_0x2a7e7c};}else{_0x1612ae[_0xc116('0x32')]={'text':_0x2a7e7c};};_0x1612ae[_0xc116('0x33')]={'languageCode':_0x46c55b,'ssmlGender':_0x11b0ad};_0x1612ae[_0xc116('0x34')]={'audioEncoding':_0xc116('0x35'),'sampleRateHertz':0x1f40};var _0x593a5a={'url':_0x16f739+_0xc116('0x36')+_0x5baa65,'method':_0xc116('0x37'),'json':!![],'body':_0x1612ae};return rp(_0x593a5a)['then'](function(_0x53f478){return new BPromise(function(_0x321562,_0x4baf41){_0x129e77=path[_0xc116('0x38')](__dirname,'tmp',rs['generate'](0x4)+_0xc116('0x39'));var _0xf0cf2a=Buffer[_0xc116('0x3a')](_0x53f478[_0xc116('0x3b')],_0xc116('0x2b'));return fs[_0xc116('0x3c')](_0x129e77,_0xf0cf2a,function(_0x14b9e3){_0x4baf41(_0x14b9e3);},function(_0x3a4e98){fs[_0xc116('0x2c')](_0x129e77,'777');_0x321562(_0x3a4e98);});});})['then'](function(_0x1a8f0d){_0x18f5ed=path[_0xc116('0x38')](__dirname,_0xc116('0x29'),rs[_0xc116('0x3d')](0x4)+_0xc116('0x2a'));return convertFile(_0x129e77,_0x18f5ed);})[_0xc116('0x3e')](function(){try{fs[_0xc116('0x20')](_0x129e77);fs['chmodSync'](_0x18f5ed,_0xc116('0x2d'));}catch(_0x5c4ab8){logger[_0xc116('0x1f')](_0x5c4ab8);}logger[_0xc116('0x1c')](_0xc116('0x3f'),_0x18f5ed[_0xc116('0x2e')]('.')[0x0]);return _0x18f5ed['split']('.')[0x0];});};exports[_0xc116('0x40')]=function(_0x5cd296,_0x47ebea){var _0x24de37=_0xc116('0x41');var _0x420540,_0x254bcd;var _0xa7d779;var _0x5e71e1={'encoding':_0xc116('0x42'),'method':_0xc116('0x37'),'timeout':0x2710,'url':_0x24de37,'headers':{'Content-Type':_0xc116('0x43')},'body':_0xc116('0x44')+encodeURIComponent(JSON[_0xc116('0x45')]([[['jQ1olc',JSON[_0xc116('0x45')]([_0x5cd296,_0x47ebea||'en',![],_0xc116('0x46')]),null,'generic']]]))};return rp(_0x5e71e1)[_0xc116('0x3e')](function(_0xdded50){try{_0xa7d779=eval(_0xdded50[_0xc116('0x47')](0x5))[0x0][0x2];}catch(_0x4b2cce){throw new Error(_0xc116('0x48')+_0xdded50[_0xc116('0x24')]);}if(!_0xa7d779){if(_0x5cd296['length']>0xc8){throw new Error(_0xc116('0x49'));}else{throw new Error('lang\x20\x22'+_0x47ebea+'\x22\x20might\x20not\x20exist');}}try{_0xa7d779=eval(_0xa7d779)[0x0];}catch(_0x229ef3){throw new Error('parse\x20response\x20failed:\x0a'+res['data']);}const _0x17ae11=_0xa7d779;_0x420540=path['resolve'](__dirname,_0xc116('0x29'),rs[_0xc116('0x3d')](0x4)+_0xc116('0x39'));fs[_0xc116('0x4a')](_0x420540,_0xa7d779,{'encoding':_0xc116('0x2b')});_0x254bcd=path[_0xc116('0x38')](__dirname,_0xc116('0x29'),rs[_0xc116('0x3d')](0x4)+_0xc116('0x2a'));return convertFile(_0x420540,_0x254bcd);})[_0xc116('0x3e')](function(){try{fs[_0xc116('0x20')](_0x420540);fs[_0xc116('0x2c')](_0x254bcd,_0xc116('0x2d'));}catch(_0x565566){logger[_0xc116('0x1f')](_0x565566);}logger[_0xc116('0x1c')](_0xc116('0x4b'),_0x254bcd[_0xc116('0x2e')]('.')[0x0]);return _0x254bcd[_0xc116('0x2e')]('.')[0x0];});};exports[_0xc116('0x4c')]=function(_0x4bfba5,_0x4aa55b,_0x489918){return google['asr'](_0x4bfba5,_0x4aa55b,_0x489918)[_0xc116('0x3e')](function(_0x16c7b2){logger[_0xc116('0x1c')](_0x16c7b2[_0xc116('0x4d')]);return rp(_0x16c7b2);})['then'](function(_0x41eb94){var _0x2416e5='';var _0x26157e=0x0;try{fs[_0xc116('0x20')](_0x4bfba5);}catch(_0x521019){logger['error'](_0x521019);}if(_0x41eb94&&_0x41eb94[_0xc116('0x4e')]){_0x2416e5=_0x41eb94[_0xc116('0x4e')]['map'](function(_0x521971){return _0x521971&&_0x521971[_0xc116('0x4f')][0x0]&&_0x521971['alternatives'][0x0][_0xc116('0x50')]?_0x521971[_0xc116('0x4f')][0x0][_0xc116('0x50')]:'';})[_0xc116('0x51')]('\x0a');_0x26157e=_0x41eb94[_0xc116('0x4e')][_0xc116('0x52')](function(_0x30ba34){return _0x30ba34&&_0x30ba34['alternatives'][0x0]&&_0x30ba34[_0xc116('0x4f')][0x0][_0xc116('0x53')]?_0x30ba34[_0xc116('0x4f')][0x0][_0xc116('0x53')]:0x0;})[_0xc116('0x51')]('\x0a');}logger[_0xc116('0x1c')](_0xc116('0x54'),_0x2416e5);logger[_0xc116('0x1c')](_0xc116('0x55'),_0x26157e);return{'transcript':_0x2416e5,'confidence':_0x26157e};})[_0xc116('0x56')](function(_0x5c6c7){logger[_0xc116('0x1f')](_0xc116('0x57'),_0x5c6c7[_0xc116('0x19')],_0x5c6c7[_0xc116('0x58')],_0x5c6c7['message']);});};exports[_0xc116('0x59')]=function(_0x38e432,_0x2132a2,_0x180ba0,_0x10fcc3){var _0x534470=apiai(_0x2132a2,{'language':_0x10fcc3||'en'});return _0x534470[_0xc116('0x5a')](_0x180ba0,{'sessionId':md5(_0x38e432)})[_0xc116('0x3e')](function(_0x5c7a23){logger[_0xc116('0x1c')](JSON[_0xc116('0x45')](_0x5c7a23));return{'source':_0x5c7a23[_0xc116('0x5b')][_0xc116('0x5c')],'resolvedQuery':_0x5c7a23[_0xc116('0x5b')][_0xc116('0x5d')],'action':_0x5c7a23[_0xc116('0x5b')][_0xc116('0x5e')],'actionIncomplete':_0x5c7a23[_0xc116('0x5b')][_0xc116('0x5f')],'speech':_0x5c7a23[_0xc116('0x5b')][_0xc116('0x60')][_0xc116('0x61')],'score':_0x5c7a23[_0xc116('0x5b')][_0xc116('0x62')],'statusCode':_0x5c7a23[_0xc116('0x63')][_0xc116('0x64')],'endConversation':_0x5c7a23['result'][_0xc116('0x65')]['endConversation']||![],'isFallbackIntent':_0x5c7a23[_0xc116('0x5b')][_0xc116('0x65')][_0xc116('0x66')]};});};exports[_0xc116('0x67')]=function(_0x73b9cb,_0x5093bf,_0x4e0198,_0x110553,_0x29cc10,_0x3615b8){var _0x5c2927=_0x110553['replace'](/\\n/g,'\x0a');var _0x3cf616={'credentials':{'private_key':_0x5c2927,'client_email':_0x4e0198}};var _0x9ef50e=new dialogflow[(_0xc116('0x68'))](_0x3cf616);var _0x1594f3=_0x9ef50e[_0xc116('0x69')](_0x5093bf,md5(_0x73b9cb));var _0x4440d8={'session':_0x1594f3,'queryInput':{'text':{'text':_0x29cc10,'languageCode':_0x3615b8}}};return _0x9ef50e[_0xc116('0x6a')](_0x4440d8)['then'](function(_0x5f1d40){if(_0x5f1d40&&_0x5f1d40[_0xc116('0x6b')]){logger[_0xc116('0x1c')]('Dialogflow\x20V2\x20response:',JSON[_0xc116('0x45')](_0x5f1d40));var _0x36b862=_0x5f1d40[0x0];if(_0x36b862){var _0x5f441b={'action':_0x36b862[_0xc116('0x6c')]['action'],'allRequiredParamsPresent':_0x36b862[_0xc116('0x6c')][_0xc116('0x6d')],'endConversation':_0x36b862[_0xc116('0x6c')]['diagnosticInfo']&&_0x36b862['queryResult']['diagnosticInfo']['fields']?_0x36b862[_0xc116('0x6c')][_0xc116('0x6e')][_0xc116('0x6f')][_0xc116('0x70')][_0xc116('0x71')]:![],'fulfillmentText':_0x36b862[_0xc116('0x6c')]['fulfillmentText'],'intentName':_0x36b862[_0xc116('0x6c')][_0xc116('0x72')][_0xc116('0x58')],'intentDisplayName':_0x36b862[_0xc116('0x6c')][_0xc116('0x72')][_0xc116('0x73')],'isFallbackIntent':_0x36b862[_0xc116('0x6c')][_0xc116('0x72')]['isFallback'],'languageCode':_0x36b862[_0xc116('0x6c')][_0xc116('0x74')],'queryText':_0x36b862['queryResult']['queryText'],'responseId':_0x36b862[_0xc116('0x75')],'score':_0x36b862[_0xc116('0x6c')]['intentDetectionConfidence'],'speech':_0x36b862[_0xc116('0x6c')][_0xc116('0x76')],'providerResponse':JSON[_0xc116('0x45')](_0x5f1d40)};return _0x5f441b;}}});};exports[_0xc116('0x77')]=function(_0x3ae1ed,_0x3c8116,_0xeb21ce,_0x116281){return tilde[_0xc116('0x78')](_0x3ae1ed,_0x3c8116,_0xeb21ce,_0x116281)[_0xc116('0x3e')](function(_0x1ca3cf){try{fs[_0xc116('0x20')](_0x3ae1ed);}catch(_0x74c67d){logger[_0xc116('0x1f')](_0x74c67d);}logger[_0xc116('0x1c')]('Tilde\x20ASR\x20transcription',_0x1ca3cf[_0xc116('0x50')]);logger[_0xc116('0x1c')](_0xc116('0x79'),_0x1ca3cf[_0xc116('0x53')]);return _0x1ca3cf;});};exports[_0xc116('0x7a')]=function(_0x490cca,_0x17f7c6,_0x18b375,_0x4ee145,_0x5a271a,_0x112e83){var _0x162df0=path[_0xc116('0x38')](__dirname,_0xc116('0x29'),rs[_0xc116('0x3d')](0x4)+_0xc116('0x39'));var _0x551ee9;return aws[_0xc116('0x7b')](_0x490cca,_0x17f7c6,_0x18b375,_0x4ee145,_0x5a271a,_0x112e83,_0x162df0)[_0xc116('0x3e')](function(){_0x551ee9=path[_0xc116('0x38')](__dirname,_0xc116('0x29'),rs[_0xc116('0x3d')](0x4)+_0xc116('0x2a'));return convertFile(_0x162df0,_0x551ee9);})['then'](function(){try{fs['unlink'](_0x162df0);fs[_0xc116('0x2c')](_0x551ee9,'777');}catch(_0x4c65b9){logger['error'](_0x4c65b9);}return _0x551ee9['split']('.')[0x0];});};exports['awsLex']=function(_0x17638f,_0xbdc0a,_0x220e69,_0x1c765f,_0x13396d,_0x392ae3){return aws[_0xc116('0x7c')](_0x17638f,_0xbdc0a,_0x220e69,_0x1c765f,_0x13396d,_0x392ae3)['then'](function(_0x44081b){logger[_0xc116('0x1c')](JSON['stringify'](_0x44081b));return _0x44081b;});};exports[_0xc116('0x7d')]=function(_0x4501cc,_0x36239a,_0x30409e,_0x34597e){var _0x587536=util[_0xc116('0x7e')]('%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3',ISPEECH_API,_0x4501cc,encodeURIComponent(_0x36239a),_0x30409e,_0x34597e);var _0x4fe640=path[_0xc116('0x38')](__dirname,'tmp',rs[_0xc116('0x3d')](0x4)+_0xc116('0x39'));var _0x4a9fa5;return downloadFile(_0x587536,_0x4fe640)[_0xc116('0x3e')](function(){_0x4a9fa5=path[_0xc116('0x38')](__dirname,_0xc116('0x29'),rs[_0xc116('0x3d')](0x4)+'.wav');return convertFile(_0x4fe640,_0x4a9fa5);})[_0xc116('0x3e')](function(){try{fs[_0xc116('0x20')](_0x4fe640);fs[_0xc116('0x2c')](_0x4a9fa5,_0xc116('0x2d'));}catch(_0x1088c9){logger[_0xc116('0x1f')](_0x1088c9);}return _0x4a9fa5[_0xc116('0x2e')]('.')[0x0];});};exports[_0xc116('0x7f')]=function(_0xcc92ae,_0x15d051,_0x1cd225,_0x5177d5){var _0x542204=util[_0xc116('0x7e')](_0xc116('0x80'),ISPEECH_API,_0x15d051,_0x1cd225,base64Encode(_0xcc92ae),_0x5177d5?util['format'](_0xc116('0x81'),encodeURIComponent(_0x5177d5)):'freeform=3');return uploadFile(_0x542204)[_0xc116('0x3e')](function(_0x572107){return querystring[_0xc116('0xb')](_0x572107);});};exports['sestekNDA']=function(_0xad469,_0x2d0a78){return sestek[_0xc116('0x82')](_0xad469,_0x2d0a78)['then'](function(_0x5d23c0){logger[_0xc116('0x1c')](JSON[_0xc116('0x45')](_0x5d23c0));var _0x5a5898={'speech':_0x5d23c0[_0xc116('0x83')],'action':_0x5d23c0[_0xc116('0x84')]?_0x5d23c0[_0xc116('0x84')][_0xc116('0x85')]:undefined,'actiondata':_0x5d23c0['channelData']?_0x5d23c0['channelData'][_0xc116('0x86')]:undefined};if(_0x5d23c0[_0xc116('0x84')]&&_0x5d23c0[_0xc116('0x84')][_0xc116('0x87')]){return base64Decode(_0x5d23c0[_0xc116('0x84')][_0xc116('0x87')]['Data'],path[_0xc116('0x38')](__dirname,_0xc116('0x29'),rs['generate'](0x4)+_0xc116('0x2a')))[_0xc116('0x3e')](function(_0x378147){_0x5a5898[_0xc116('0x88')]=_0x378147;return _0x5a5898;});}return _0x5a5898;});};exports[_0xc116('0x89')]=function(){return __dirname;}; \ No newline at end of file +var _0x2663=['catch','name','message','textRequest','result','resolvedQuery','action','actionIncomplete','status','code','metadata','endConversation','isFallbackIntent','googleDialogflowV2','replace','SessionsClient','sessionPath','detectIntent','Dialogflow\x20V2\x20response:','queryResult','allRequiredParamsPresent','fields','end_conversation','intent','displayName','isFallback','queryText','intentDetectionConfidence','fulfillmentText','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','lex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','freeform=3','sestekNDA','nda','text','channelData','CustomAction','AudioFromTts','Data','audiofile','dirName','apiai-promise','bluebird','dialogflow','http','md5','path','querystring','request-promise','randomstring','google-tts-api','parse','./google','./sestek','./tilde','agi','https://api.ispeech.org/api/rest','protocol','get','statusCode','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','finish','info','finish\x20download\x20file','unlink','download\x20error','pipe','end','https:','host','transcode','wav','error\x20convert','finish\x20to\x20convert','start','resolve','tmp','generate','.wav','writeFileSync','base64','then','chmodSync','777','readFileSync','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','voice','audioConfig','MP3','POST','.mp3','from','audioContent','googleCloudTTS\x20path','split','googleTTS','utf8','application/x-www-form-urlencoded','stringify','jQ1olc','null','generic','parse\x20response\x20failed:\x0a','length','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','goggleTTS\x20path','asr','uri','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription','googleASR\x20confidence'];(function(_0x13988c,_0x5bf95e){var _0x2617a2=function(_0x4b363f){while(--_0x4b363f){_0x13988c['push'](_0x13988c['shift']());}};_0x2617a2(++_0x5bf95e);}(_0x2663,0xb7));var _0x3266=function(_0x3f0c06,_0x3d0ecf){_0x3f0c06=_0x3f0c06-0x0;var _0x507d9f=_0x2663[_0x3f0c06];return _0x507d9f;};'use strict';var apiai=require(_0x3266('0x0'));var BPromise=require(_0x3266('0x1'));var dialogflow=require(_0x3266('0x2'));var fs=require('fs');var http=require(_0x3266('0x3'));var https=require('https');var md5=require(_0x3266('0x4'));var path=require(_0x3266('0x5'));var querystring=require(_0x3266('0x6'));var rp=require(_0x3266('0x7'));var rs=require(_0x3266('0x8'));var sox=require('sox');var tts=require(_0x3266('0x9'));var urlParse=require('url')[_0x3266('0xa')];var util=require('util');var aws=require('./aws');var google=require(_0x3266('0xb'));var sestek=require(_0x3266('0xc'));var tilde=require(_0x3266('0xd'));var logger=require('../../../config/logger')(_0x3266('0xe'));var ISPEECH_API=_0x3266('0xf');function downloadFile(_0x4f6d59,_0x1f8892){return new BPromise(function(_0x296cbf,_0x3bb0d8){var _0x5b1790=urlParse(_0x4f6d59);var _0x12c960=_0x5b1790[_0x3266('0x10')]==='https:'?https:http;var _0x23e9a3={'host':_0x5b1790['host'],'path':_0x5b1790[_0x3266('0x5')],'headers':{'user-agent':'WHAT_EVER'}};_0x12c960[_0x3266('0x11')](_0x23e9a3,function(_0x2c38e7){if(_0x2c38e7[_0x3266('0x12')]!==0xc8){logger[_0x3266('0x13')](_0x3266('0x14')+_0x4f6d59+_0x3266('0x15')+_0x2c38e7[_0x3266('0x12')]+'\x20('+_0x2c38e7[_0x3266('0x16')]+')');_0x3bb0d8(new Error(_0x3266('0x14')+_0x4f6d59+_0x3266('0x15')+_0x2c38e7[_0x3266('0x12')]+'\x20('+_0x2c38e7[_0x3266('0x16')]+')'));return;}var _0x2e09ce=fs['createWriteStream'](_0x1f8892);_0x2e09ce['on'](_0x3266('0x17'),function(){logger[_0x3266('0x18')](_0x3266('0x19'));_0x2e09ce['close'](_0x296cbf);});_0x2e09ce['on'](_0x3266('0x13'),function(_0x52e1dd){fs[_0x3266('0x1a')](_0x1f8892);logger['error'](_0x3266('0x1b'),_0x52e1dd);_0x3bb0d8(_0x52e1dd);});_0x2c38e7[_0x3266('0x1c')](_0x2e09ce);})['on'](_0x3266('0x13'),function(_0x56daf3){logger['error'](_0x56daf3);_0x3bb0d8(_0x56daf3);})[_0x3266('0x1d')]();});}function uploadFile(_0x583acc){return new BPromise(function(_0x4673d6,_0x5587c9){var _0x54af0f=urlParse(_0x583acc);var _0x83e8f3=_0x54af0f[_0x3266('0x10')]===_0x3266('0x1e')?https:http;var _0x392ffb={'host':_0x54af0f[_0x3266('0x1f')],'path':_0x54af0f[_0x3266('0x5')],'headers':{'user-agent':'WHAT_EVER'}};_0x83e8f3[_0x3266('0x11')](_0x392ffb,function(_0x372bbc){if(_0x372bbc['statusCode']!==0xc8){_0x5587c9(new Error(_0x3266('0x14')+_0x583acc+_0x3266('0x15')+_0x372bbc[_0x3266('0x12')]+'\x20('+_0x372bbc['statusMessage']+')'));return;}var _0x562f32='';_0x372bbc['on']('data',function(_0x39a204){_0x562f32+=_0x39a204;});_0x372bbc['on'](_0x3266('0x1d'),function(){_0x4673d6(_0x562f32);});})['on'](_0x3266('0x13'),function(_0x500fe3){_0x5587c9(_0x500fe3);})[_0x3266('0x1d')]();});}function convertFile(_0x2b23a4,_0x5d8adb){return new BPromise(function(_0x339f77,_0x301acd){var _0x8f5cf7=sox[_0x3266('0x20')](_0x2b23a4,_0x5d8adb,{'sampleRate':0x1f40,'format':_0x3266('0x21'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x8f5cf7['on'](_0x3266('0x13'),function(_0x59605f){logger[_0x3266('0x13')](_0x3266('0x22'),_0x59605f);_0x301acd(_0x59605f);});_0x8f5cf7['on'](_0x3266('0x1d'),function(){logger[_0x3266('0x18')](_0x3266('0x23'));_0x339f77();});_0x8f5cf7[_0x3266('0x24')]();});}function base64Decode(_0x366e7b,_0x3fb804){var _0x2d8fc0=path[_0x3266('0x25')](__dirname,_0x3266('0x26'),rs[_0x3266('0x27')](0x4)+_0x3266('0x28'));fs[_0x3266('0x29')](_0x2d8fc0,_0x366e7b,_0x3266('0x2a'));return convertFile(_0x2d8fc0,_0x3fb804)[_0x3266('0x2b')](function(){try{fs[_0x3266('0x1a')](_0x2d8fc0);fs[_0x3266('0x2c')](_0x3fb804,_0x3266('0x2d'));}catch(_0x1f34c7){logger[_0x3266('0x13')](_0x1f34c7);}return _0x3fb804['split']('.')[0x0];});}function base64Encode(_0xc4be9f){var _0xc3c882=fs[_0x3266('0x2e')](_0xc4be9f);return new Buffer(_0xc3c882)[_0x3266('0x2f')]('base64');}exports[_0x3266('0x30')]=function(_0x3fd865,_0x806e08,_0x5d7922,_0x3db332,_0xc1e96c,_0x158e5e){var _0x1dd819,_0x554178;var _0x510dbb=_0x3266('0x31');var _0x29deb7=_0x3266('0x32')+_0x3fd865;var _0x4d7df5={};if(_0x806e08===_0x3266('0x33')){_0x4d7df5[_0x3266('0x34')]={'ssml':_0x5d7922};}else{_0x4d7df5[_0x3266('0x34')]={'text':_0x5d7922};};_0x4d7df5[_0x3266('0x35')]={'languageCode':_0x3db332,'ssmlGender':_0xc1e96c};_0x4d7df5[_0x3266('0x36')]={'audioEncoding':_0x3266('0x37'),'sampleRateHertz':0x1f40};var _0x1ccfb5={'url':_0x510dbb+'text:synthesize'+_0x29deb7,'method':_0x3266('0x38'),'json':!![],'body':_0x4d7df5};return rp(_0x1ccfb5)[_0x3266('0x2b')](function(_0x1317ba){return new BPromise(function(_0x34d77a,_0x1d6689){_0x1dd819=path[_0x3266('0x25')](__dirname,_0x3266('0x26'),rs[_0x3266('0x27')](0x4)+_0x3266('0x39'));var _0x3e82ec=Buffer[_0x3266('0x3a')](_0x1317ba[_0x3266('0x3b')],_0x3266('0x2a'));return fs['writeFile'](_0x1dd819,_0x3e82ec,function(_0x5b3985){_0x1d6689(_0x5b3985);},function(_0x562247){fs['chmodSync'](_0x1dd819,_0x3266('0x2d'));_0x34d77a(_0x562247);});});})[_0x3266('0x2b')](function(_0x18a632){_0x554178=path[_0x3266('0x25')](__dirname,_0x3266('0x26'),rs[_0x3266('0x27')](0x4)+'.wav');return convertFile(_0x1dd819,_0x554178);})[_0x3266('0x2b')](function(){try{fs[_0x3266('0x1a')](_0x1dd819);fs['chmodSync'](_0x554178,_0x3266('0x2d'));}catch(_0x599f68){logger['error'](_0x599f68);}logger[_0x3266('0x18')](_0x3266('0x3c'),_0x554178[_0x3266('0x3d')]('.')[0x0]);return _0x554178[_0x3266('0x3d')]('.')[0x0];});};exports[_0x3266('0x3e')]=function(_0x37e29d,_0x186232){var _0x15f94a='https://translate.google.com/_/TranslateWebserverUi/data/batchexecute';var _0x403882,_0x2d12f7;var _0x2745ee;var _0x53a50f={'encoding':_0x3266('0x3f'),'method':_0x3266('0x38'),'timeout':0x2710,'url':_0x15f94a,'headers':{'Content-Type':_0x3266('0x40')},'body':'f.req='+encodeURIComponent(JSON[_0x3266('0x41')]([[[_0x3266('0x42'),JSON[_0x3266('0x41')]([_0x37e29d,_0x186232||'en',![],_0x3266('0x43')]),null,_0x3266('0x44')]]]))};return rp(_0x53a50f)[_0x3266('0x2b')](function(_0x4c7fe1){try{_0x2745ee=eval(_0x4c7fe1['slice'](0x5))[0x0][0x2];}catch(_0xc7a6fa){throw new Error(_0x3266('0x45')+_0x4c7fe1['data']);}if(!_0x2745ee){if(_0x37e29d[_0x3266('0x46')]>0xc8){throw new Error(_0x3266('0x47'));}else{throw new Error(_0x3266('0x48')+_0x186232+_0x3266('0x49'));}}try{_0x2745ee=eval(_0x2745ee)[0x0];}catch(_0x47863f){throw new Error('parse\x20response\x20failed:\x0a'+res['data']);}const _0x5394b4=_0x2745ee;_0x403882=path[_0x3266('0x25')](__dirname,_0x3266('0x26'),rs[_0x3266('0x27')](0x4)+_0x3266('0x39'));fs[_0x3266('0x29')](_0x403882,_0x2745ee,{'encoding':_0x3266('0x2a')});_0x2d12f7=path[_0x3266('0x25')](__dirname,_0x3266('0x26'),rs['generate'](0x4)+_0x3266('0x28'));return convertFile(_0x403882,_0x2d12f7);})[_0x3266('0x2b')](function(){try{fs[_0x3266('0x1a')](_0x403882);fs['chmodSync'](_0x2d12f7,_0x3266('0x2d'));}catch(_0x47e35d){logger[_0x3266('0x13')](_0x47e35d);}logger['info'](_0x3266('0x4a'),_0x2d12f7[_0x3266('0x3d')]('.')[0x0]);return _0x2d12f7['split']('.')[0x0];});};exports['googleASR']=function(_0x4bcb4f,_0x42c483,_0x19610c){return google[_0x3266('0x4b')](_0x4bcb4f,_0x42c483,_0x19610c)['then'](function(_0x2dae33){logger[_0x3266('0x18')](_0x2dae33[_0x3266('0x4c')]);return rp(_0x2dae33);})[_0x3266('0x2b')](function(_0x3119ad){var _0x1f2114='';var _0x3687d9=0x0;try{fs['unlink'](_0x4bcb4f);}catch(_0x469eb6){logger['error'](_0x469eb6);}if(_0x3119ad&&_0x3119ad[_0x3266('0x4d')]){_0x1f2114=_0x3119ad[_0x3266('0x4d')][_0x3266('0x4e')](function(_0x1eeeb9){return _0x1eeeb9&&_0x1eeeb9['alternatives'][0x0]&&_0x1eeeb9[_0x3266('0x4f')][0x0][_0x3266('0x50')]?_0x1eeeb9[_0x3266('0x4f')][0x0][_0x3266('0x50')]:'';})[_0x3266('0x51')]('\x0a');_0x3687d9=_0x3119ad[_0x3266('0x4d')]['map'](function(_0x5400e2){return _0x5400e2&&_0x5400e2[_0x3266('0x4f')][0x0]&&_0x5400e2[_0x3266('0x4f')][0x0][_0x3266('0x52')]?_0x5400e2['alternatives'][0x0][_0x3266('0x52')]:0x0;})[_0x3266('0x51')]('\x0a');}logger[_0x3266('0x18')](_0x3266('0x53'),_0x1f2114);logger[_0x3266('0x18')](_0x3266('0x54'),_0x3687d9);return{'transcript':_0x1f2114,'confidence':_0x3687d9};})[_0x3266('0x55')](function(_0x295837){logger[_0x3266('0x13')]('[%s]\x20%s:%s',_0x295837[_0x3266('0x12')],_0x295837[_0x3266('0x56')],_0x295837[_0x3266('0x57')]);});};exports['googleDialogflow']=function(_0x3e0e45,_0x3862dc,_0x36126d,_0x43cb35){var _0x2a4dfa=apiai(_0x3862dc,{'language':_0x43cb35||'en'});return _0x2a4dfa[_0x3266('0x58')](_0x36126d,{'sessionId':md5(_0x3e0e45)})[_0x3266('0x2b')](function(_0x4839bb){logger[_0x3266('0x18')](JSON['stringify'](_0x4839bb));return{'source':_0x4839bb['result']['source'],'resolvedQuery':_0x4839bb[_0x3266('0x59')][_0x3266('0x5a')],'action':_0x4839bb['result'][_0x3266('0x5b')],'actionIncomplete':_0x4839bb['result'][_0x3266('0x5c')],'speech':_0x4839bb['result']['fulfillment']['speech'],'score':_0x4839bb['result']['score'],'statusCode':_0x4839bb[_0x3266('0x5d')][_0x3266('0x5e')],'endConversation':_0x4839bb['result'][_0x3266('0x5f')][_0x3266('0x60')]||![],'isFallbackIntent':_0x4839bb[_0x3266('0x59')][_0x3266('0x5f')][_0x3266('0x61')]};});};exports[_0x3266('0x62')]=function(_0x26a469,_0x354dfa,_0x4108fa,_0x4c9b44,_0x342b65,_0x55a0f0){var _0x15b6d6=_0x4c9b44[_0x3266('0x63')](/\\n/g,'\x0a');var _0x2917ac={'credentials':{'private_key':_0x15b6d6,'client_email':_0x4108fa}};var _0x48140e=new dialogflow[(_0x3266('0x64'))](_0x2917ac);var _0x2dc80f=_0x48140e[_0x3266('0x65')](_0x354dfa,md5(_0x26a469));var _0x4435de={'session':_0x2dc80f,'queryInput':{'text':{'text':_0x342b65,'languageCode':_0x55a0f0}}};return _0x48140e[_0x3266('0x66')](_0x4435de)['then'](function(_0x105f68){if(_0x105f68&&_0x105f68[_0x3266('0x46')]){logger['info'](_0x3266('0x67'),JSON[_0x3266('0x41')](_0x105f68));var _0x1c61f7=_0x105f68[0x0];if(_0x1c61f7){var _0x1c95a0={'action':_0x1c61f7[_0x3266('0x68')]['action'],'allRequiredParamsPresent':_0x1c61f7[_0x3266('0x68')][_0x3266('0x69')],'endConversation':_0x1c61f7[_0x3266('0x68')]['diagnosticInfo']&&_0x1c61f7[_0x3266('0x68')]['diagnosticInfo']['fields']?_0x1c61f7[_0x3266('0x68')]['diagnosticInfo'][_0x3266('0x6a')][_0x3266('0x6b')]['boolValue']:![],'fulfillmentText':_0x1c61f7['queryResult']['fulfillmentText'],'intentName':_0x1c61f7['queryResult']['intent'][_0x3266('0x56')],'intentDisplayName':_0x1c61f7[_0x3266('0x68')][_0x3266('0x6c')][_0x3266('0x6d')],'isFallbackIntent':_0x1c61f7[_0x3266('0x68')][_0x3266('0x6c')][_0x3266('0x6e')],'languageCode':_0x1c61f7['queryResult']['languageCode'],'queryText':_0x1c61f7[_0x3266('0x68')][_0x3266('0x6f')],'responseId':_0x1c61f7['responseId'],'score':_0x1c61f7[_0x3266('0x68')][_0x3266('0x70')],'speech':_0x1c61f7['queryResult'][_0x3266('0x71')],'providerResponse':JSON[_0x3266('0x41')](_0x105f68)};return _0x1c95a0;}}});};exports[_0x3266('0x72')]=function(_0x2f1ed6,_0x487c82,_0x2f6e54,_0x216222){return tilde[_0x3266('0x4b')](_0x2f1ed6,_0x487c82,_0x2f6e54,_0x216222)[_0x3266('0x2b')](function(_0x2aaf4a){try{fs[_0x3266('0x1a')](_0x2f1ed6);}catch(_0x34654d){logger['error'](_0x34654d);}logger[_0x3266('0x18')](_0x3266('0x73'),_0x2aaf4a[_0x3266('0x50')]);logger[_0x3266('0x18')](_0x3266('0x74'),_0x2aaf4a[_0x3266('0x52')]);return _0x2aaf4a;});};exports[_0x3266('0x75')]=function(_0x39e6b7,_0x337b19,_0xb156e6,_0x2d0dee,_0x157e58,_0x8f35b0){var _0x3866aa=path[_0x3266('0x25')](__dirname,_0x3266('0x26'),rs[_0x3266('0x27')](0x4)+'.mp3');var _0x13b664;return aws['polly'](_0x39e6b7,_0x337b19,_0xb156e6,_0x2d0dee,_0x157e58,_0x8f35b0,_0x3866aa)[_0x3266('0x2b')](function(){_0x13b664=path['resolve'](__dirname,_0x3266('0x26'),rs[_0x3266('0x27')](0x4)+_0x3266('0x28'));return convertFile(_0x3866aa,_0x13b664);})[_0x3266('0x2b')](function(){try{fs[_0x3266('0x1a')](_0x3866aa);fs[_0x3266('0x2c')](_0x13b664,_0x3266('0x2d'));}catch(_0x126cb5){logger[_0x3266('0x13')](_0x126cb5);}return _0x13b664[_0x3266('0x3d')]('.')[0x0];});};exports['awsLex']=function(_0x19cad9,_0x2848c9,_0x221196,_0x9777d2,_0x26ec0c,_0x41380a){return aws[_0x3266('0x76')](_0x19cad9,_0x2848c9,_0x221196,_0x9777d2,_0x26ec0c,_0x41380a)[_0x3266('0x2b')](function(_0x5532ab){logger['info'](JSON[_0x3266('0x41')](_0x5532ab));return _0x5532ab;});};exports[_0x3266('0x77')]=function(_0x269b02,_0x29604c,_0x134cb3,_0xa570dd){var _0x141f1b=util[_0x3266('0x78')](_0x3266('0x79'),ISPEECH_API,_0x269b02,encodeURIComponent(_0x29604c),_0x134cb3,_0xa570dd);var _0x4427a7=path[_0x3266('0x25')](__dirname,'tmp',rs[_0x3266('0x27')](0x4)+_0x3266('0x39'));var _0x214c27;return downloadFile(_0x141f1b,_0x4427a7)[_0x3266('0x2b')](function(){_0x214c27=path[_0x3266('0x25')](__dirname,_0x3266('0x26'),rs[_0x3266('0x27')](0x4)+_0x3266('0x28'));return convertFile(_0x4427a7,_0x214c27);})['then'](function(){try{fs[_0x3266('0x1a')](_0x4427a7);fs[_0x3266('0x2c')](_0x214c27,_0x3266('0x2d'));}catch(_0x1b3d14){logger[_0x3266('0x13')](_0x1b3d14);}return _0x214c27[_0x3266('0x3d')]('.')[0x0];});};exports['ispeechASR']=function(_0x403671,_0x430ca5,_0x1f58ab,_0x168ad2){var _0x55ee55=util[_0x3266('0x78')](_0x3266('0x7a'),ISPEECH_API,_0x430ca5,_0x1f58ab,base64Encode(_0x403671),_0x168ad2?util[_0x3266('0x78')](_0x3266('0x7b'),encodeURIComponent(_0x168ad2)):_0x3266('0x7c'));return uploadFile(_0x55ee55)[_0x3266('0x2b')](function(_0x22cdcd){return querystring[_0x3266('0xa')](_0x22cdcd);});};exports[_0x3266('0x7d')]=function(_0x12b173,_0x33290e){return sestek[_0x3266('0x7e')](_0x12b173,_0x33290e)[_0x3266('0x2b')](function(_0x44bdbc){logger[_0x3266('0x18')](JSON[_0x3266('0x41')](_0x44bdbc));var _0x427da0={'speech':_0x44bdbc[_0x3266('0x7f')],'action':_0x44bdbc[_0x3266('0x80')]?_0x44bdbc[_0x3266('0x80')][_0x3266('0x81')]:undefined,'actiondata':_0x44bdbc['channelData']?_0x44bdbc['channelData']['CustomActionData']:undefined};if(_0x44bdbc['channelData']&&_0x44bdbc[_0x3266('0x80')][_0x3266('0x82')]){return base64Decode(_0x44bdbc[_0x3266('0x80')][_0x3266('0x82')][_0x3266('0x83')],path[_0x3266('0x25')](__dirname,'tmp',rs['generate'](0x4)+_0x3266('0x28')))['then'](function(_0x2d8864){_0x427da0[_0x3266('0x84')]=_0x2d8864;return _0x427da0;});}return _0x427da0;});};exports[_0x3266('0x85')]=function(){return __dirname;}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/index.js b/server/services/agi/scripts/sestek/index.js index 7e21e9a..f2937a3 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 _0x10ca=['./nda','exports'];(function(_0x3a9690,_0x5e06e8){var _0x146bef=function(_0x28f514){while(--_0x28f514){_0x3a9690['push'](_0x3a9690['shift']());}};_0x146bef(++_0x5e06e8);}(_0x10ca,0x146));var _0xa10c=function(_0x133673,_0x3b50c9){_0x133673=_0x133673-0x0;var _0x6ac4cc=_0x10ca[_0x133673];return _0x6ac4cc;};var nda=require(_0xa10c('0x0'));module[_0xa10c('0x1')]={'nda':nda}; \ No newline at end of file +var _0xea71=['exports','./nda'];(function(_0x4c78b6,_0x568d7a){var _0x4318d6=function(_0x502e7d){while(--_0x502e7d){_0x4c78b6['push'](_0x4c78b6['shift']());}};_0x4318d6(++_0x568d7a);}(_0xea71,0xa3));var _0x1ea7=function(_0x1df2f6,_0x3397a4){_0x1df2f6=_0x1df2f6-0x0;var _0x5755cf=_0xea71[_0x1df2f6];return _0x5755cf;};var nda=require(_0x1ea7('0x0'));module[_0x1ea7('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 5565e54..973b314 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 _0x1752=['custom_action_data','info','stringify','url','../../../../../config/logger','agi','exports','POST','resolve','ndauth_url','/token','password','username','then','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','calleridname','access_token','body','channelData','project','ndagenerate_audio','AudioOutputSettings','audio/wav','custom_action'];(function(_0x5cb1af,_0x4bdc8c){var _0x8d7940=function(_0x3db70a){while(--_0x3db70a){_0x5cb1af['push'](_0x5cb1af['shift']());}};_0x8d7940(++_0x4bdc8c);}(_0x1752,0xa5));var _0x2175=function(_0x4ad7bb,_0x5cfbf2){_0x4ad7bb=_0x4ad7bb-0x0;var _0x48b3a5=_0x1752[_0x4ad7bb];return _0x48b3a5;};'use strict';var rp=require('request-promise');var url=require(_0x2175('0x0'));var logger=require(_0x2175('0x1'))(_0x2175('0x2'));module[_0x2175('0x3')]=function(_0x1b2344,_0xe2453c){var _0x56c315={'method':_0x2175('0x4'),'uri':url[_0x2175('0x5')](_0xe2453c[_0x2175('0x6')],_0x2175('0x7')),'form':{'grant_type':_0x2175('0x8'),'username':_0xe2453c[_0x2175('0x9')],'password':_0xe2453c[_0x2175('0x8')]},'json':!![]};return rp(_0x56c315)[_0x2175('0xa')](function(_0x339e4d){var _0x672ff1={'method':'POST','uri':url[_0x2175('0x5')](_0xe2453c[_0x2175('0xb')],_0x2175('0xc')),'body':{'type':_0xe2453c[_0x2175('0xd')]||_0x2175('0xe'),'channelId':'Nda','conversation':{'id':_0x1b2344['uniqueid']},'from':{'id':_0x1b2344['callerid'],'name':_0x1b2344[_0x2175('0xf')]},'recipient':{'id':_0x1b2344['dnid'],'name':_0x1b2344['extension']},'text':_0xe2453c['text'],'channelData':{}},'headers':{'Authorization':'Bearer\x20'+_0x339e4d[_0x2175('0x10')]},'json':!![]};if(_0xe2453c['project']){_0x672ff1[_0x2175('0x11')][_0x2175('0x12')]['ProjectName']=_0xe2453c[_0x2175('0x13')];}if(_0xe2453c[_0x2175('0x14')]=='1'){_0x672ff1[_0x2175('0x11')][_0x2175('0x12')][_0x2175('0x15')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x2175('0x16')};}if(_0xe2453c[_0x2175('0x17')]){_0x672ff1[_0x2175('0x11')]['channelData']['CustomAction']=_0xe2453c[_0x2175('0x17')];if(_0xe2453c[_0x2175('0x18')]){_0x672ff1[_0x2175('0x11')]['channelData']['CustomActionData']=_0xe2453c['custom_action_data'];}}logger[_0x2175('0x19')](JSON[_0x2175('0x1a')](_0x672ff1));return rp(_0x672ff1);});}; \ No newline at end of file +var _0x5f6a=['request-promise','agi','exports','POST','resolve','ndauth_url','/token','password','username','then','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','uniqueid','calleridname','dnid','text','access_token','body','channelData','project','ndagenerate_audio','audio/wav','custom_action','CustomAction','custom_action_data','info'];(function(_0x67b075,_0x43557d){var _0x39d030=function(_0x4f25e1){while(--_0x4f25e1){_0x67b075['push'](_0x67b075['shift']());}};_0x39d030(++_0x43557d);}(_0x5f6a,0xc4));var _0xa5f6=function(_0x40c33c,_0x234585){_0x40c33c=_0x40c33c-0x0;var _0x1ec5a4=_0x5f6a[_0x40c33c];return _0x1ec5a4;};'use strict';var rp=require(_0xa5f6('0x0'));var url=require('url');var logger=require('../../../../../config/logger')(_0xa5f6('0x1'));module[_0xa5f6('0x2')]=function(_0x2e23f3,_0x1ec17a){var _0x53c913={'method':_0xa5f6('0x3'),'uri':url[_0xa5f6('0x4')](_0x1ec17a[_0xa5f6('0x5')],_0xa5f6('0x6')),'form':{'grant_type':_0xa5f6('0x7'),'username':_0x1ec17a[_0xa5f6('0x8')],'password':_0x1ec17a[_0xa5f6('0x7')]},'json':!![]};return rp(_0x53c913)[_0xa5f6('0x9')](function(_0x2505d7){var _0x135782={'method':'POST','uri':url['resolve'](_0x1ec17a['ndassistant_url'],_0xa5f6('0xa')),'body':{'type':_0x1ec17a[_0xa5f6('0xb')]||_0xa5f6('0xc'),'channelId':_0xa5f6('0xd'),'conversation':{'id':_0x2e23f3[_0xa5f6('0xe')]},'from':{'id':_0x2e23f3['callerid'],'name':_0x2e23f3[_0xa5f6('0xf')]},'recipient':{'id':_0x2e23f3[_0xa5f6('0x10')],'name':_0x2e23f3['extension']},'text':_0x1ec17a[_0xa5f6('0x11')],'channelData':{}},'headers':{'Authorization':'Bearer\x20'+_0x2505d7[_0xa5f6('0x12')]},'json':!![]};if(_0x1ec17a['project']){_0x135782[_0xa5f6('0x13')][_0xa5f6('0x14')]['ProjectName']=_0x1ec17a[_0xa5f6('0x15')];}if(_0x1ec17a[_0xa5f6('0x16')]=='1'){_0x135782[_0xa5f6('0x13')][_0xa5f6('0x14')]['AudioOutputSettings']={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0xa5f6('0x17')};}if(_0x1ec17a[_0xa5f6('0x18')]){_0x135782[_0xa5f6('0x13')]['channelData'][_0xa5f6('0x19')]=_0x1ec17a[_0xa5f6('0x18')];if(_0x1ec17a[_0xa5f6('0x1a')]){_0x135782[_0xa5f6('0x13')][_0xa5f6('0x14')]['CustomActionData']=_0x1ec17a[_0xa5f6('0x1a')];}}logger[_0xa5f6('0x1b')](JSON['stringify'](_0x135782));return rp(_0x135782);});}; \ 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 8d6489a..e963b06 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 _0x04f4=['./lib/api','exports'];(function(_0x5df760,_0x1fa2d6){var _0x3b9406=function(_0x56f060){while(--_0x56f060){_0x5df760['push'](_0x5df760['shift']());}};_0x3b9406(++_0x1fa2d6);}(_0x04f4,0x9c));var _0x404f=function(_0x3ccd99,_0x337b62){_0x3ccd99=_0x3ccd99-0x0;var _0x153cb3=_0x04f4[_0x3ccd99];return _0x153cb3;};'use strict';var asr=require(_0x404f('0x0'));module[_0x404f('0x1')]=function(_0x6f7be2,_0x114286,_0x1dd53b,_0xab0e34){return asr(_0x6f7be2,_0x114286,_0x1dd53b,_0xab0e34);}; \ No newline at end of file +var _0x11bd=['./lib/api','exports'];(function(_0x4b1636,_0x3dba81){var _0x5970fc=function(_0x3fc6d8){while(--_0x3fc6d8){_0x4b1636['push'](_0x4b1636['shift']());}};_0x5970fc(++_0x3dba81);}(_0x11bd,0x8e));var _0xd11b=function(_0x35fccd,_0x46570e){_0x35fccd=_0x35fccd-0x0;var _0x449ab9=_0x11bd[_0x35fccd];return _0x449ab9;};'use strict';var asr=require(_0xd11b('0x0'));module[_0xd11b('0x1')]=function(_0x561ca9,_0x452551,_0x58a45,_0x4545f2){return asr(_0x561ca9,_0x452551,_0x58a45,_0x4545f2);}; \ 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 edb3947..051f903 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 _0x722a=['agi','exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','createHash','sha1','update','digest','hex','unix','send','createReadStream','EOS','error','Tilde\x20ASR\x20send\x20error','stringify','terminate','parse','status','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','likelihood','Success.','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isObject','message','close','bluebird','lodash','moment','crypto','../../../../../../config/logger'];(function(_0x7280e8,_0x5ab5f2){var _0x446442=function(_0x272b74){while(--_0x272b74){_0x7280e8['push'](_0x7280e8['shift']());}};_0x446442(++_0x5ab5f2);}(_0x722a,0xc8));var _0xa722=function(_0x5efd5c,_0x1b2130){_0x5efd5c=_0x5efd5c-0x0;var _0x527cbc=_0x722a[_0x5efd5c];return _0x527cbc;};'use strict';var BPromise=require(_0xa722('0x0'));var _=require(_0xa722('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0xa722('0x2'));var crypto=require(_0xa722('0x3'));var logger=require(_0xa722('0x4'))(_0xa722('0x5'));module[_0xa722('0x6')]=function(_0x3909fc,_0x48836a,_0x22902c,_0x87dc1a){return new BPromise(function(_0x218e7f,_0x352a16){logger[_0xa722('0x7')](_0xa722('0x8'),_0x87dc1a||_0xa722('0x9'));var _0x5b7ecb=new WebSocket(_0x87dc1a||_0xa722('0x9'),{'perMessageDeflate':![]});var _0x309d97='';var _0x1c20c1='0';var _0x2220e2='1';var _0x586dca='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';function _0x520cbb(_0x5cd3a8){var _0xde16d4=crypto[_0xa722('0xa')](_0xa722('0xb'));_0xde16d4[_0xa722('0xc')](_0x5cd3a8);return _0xde16d4[_0xa722('0xd')](_0xa722('0xe'));}function _0x1a0d69(){try{logger[_0xa722('0x7')]('Open\x20Tilde\x20ASR\x20socket');var _0x28702e=moment()[_0xa722('0xf')]();var _0x4dccad=_0x520cbb(_0x28702e+_0x48836a+_0x22902c);_0x5b7ecb[_0xa722('0x10')](JSON['stringify']({'appID':_0x48836a,'timestamp':_0x28702e,'appKey':_0x4dccad}));var _0x29b08a=fs[_0xa722('0x11')](_0x3909fc);_0x29b08a['on']('data',function(_0x4be54f){_0x5b7ecb[_0xa722('0x10')](_0x4be54f);});_0x29b08a['on']('close',function(){_0x5b7ecb[_0xa722('0x10')](_0xa722('0x12'));});}catch(_0x31a78d){logger[_0xa722('0x13')](_0xa722('0x14'),JSON[_0xa722('0x15')](_0x31a78d));_0x5b7ecb[_0xa722('0x16')]();}}function _0x1ee74b(_0x28a9f5){try{if(_0x28a9f5){var _0x5c4de4=JSON[_0xa722('0x17')](_0x28a9f5);switch(_0x5c4de4[_0xa722('0x18')]){case 0x0:if(_0x5c4de4['result']){if(_0x5c4de4[_0xa722('0x19')][_0xa722('0x1a')]){logger[_0xa722('0x7')](_0xa722('0x1b'),JSON[_0xa722('0x15')](_0x5c4de4[_0xa722('0x19')]['hypotheses']));_0x309d97=_0x5c4de4[_0xa722('0x19')][_0xa722('0x1c')][0x0]['transcript'];_0x1c20c1=_0x5c4de4[_0xa722('0x19')]['hypotheses'][0x0][_0xa722('0x1d')];_0x2220e2='0';_0x586dca=_0xa722('0x1e');_0x5b7ecb[_0xa722('0x16')]();}}break;case 0x1:logger[_0xa722('0x7')]('No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech');_0x2220e2='1';_0x586dca=_0xa722('0x1f');break;case 0x2:logger[_0xa722('0x7')](_0xa722('0x20'));_0x2220e2='2';_0x586dca='Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.';break;case 0x9:logger['info']('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0x2220e2='9';_0x586dca=_0xa722('0x21');break;case 0xa:logger['info'](_0xa722('0x22'));_0x2220e2='10';_0x586dca='Authentication\x20failed.';break;case 0xb:logger['info'](_0xa722('0x23'));_0x2220e2='11';_0x586dca=_0xa722('0x23');}}}catch(_0x6f124e){logger['error']('Tilde\x20ASR\x20parse\x20error',JSON[_0xa722('0x15')](_0x6f124e));_0x5b7ecb[_0xa722('0x16')]();}}function _0x1fc8db(){logger[_0xa722('0x7')](_0xa722('0x24'));_0x218e7f({'transcript':_0x309d97,'confidence':_0x1c20c1,'status':_0x2220e2,'status_message':_0x586dca});}function _0x17d505(_0x3b643f){logger[_0xa722('0x13')](_0xa722('0x25'));if(!_['isNil'](_0x3b643f)){logger[_0xa722('0x13')](_[_0xa722('0x26')](_0x3b643f)?JSON[_0xa722('0x15')](_0x3b643f):_0x3b643f);}}_0x5b7ecb['on']('open',_0x1a0d69);_0x5b7ecb['on'](_0xa722('0x27'),_0x1ee74b);_0x5b7ecb['on'](_0xa722('0x28'),_0x1fc8db);_0x5b7ecb['on'](_0xa722('0x13'),_0x17d505);});}; \ No newline at end of file +var _0x591c=['lodash','moment','../../../../../../config/logger','agi','exports','info','createHash','sha1','digest','hex','unix','send','stringify','createReadStream','data','close','EOS','error','status','result','Tilde\x20ASR\x20hypoteses','hypotheses','likelihood','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.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Close\x20Tilde\x20ASR\x20socket','isNil','isObject','message'];(function(_0x5aedbc,_0x41eab8){var _0xc9a701=function(_0x3e965e){while(--_0x3e965e){_0x5aedbc['push'](_0x5aedbc['shift']());}};_0xc9a701(++_0x41eab8);}(_0x591c,0x18c));var _0xc591=function(_0x5779c3,_0x4ca84b){_0x5779c3=_0x5779c3-0x0;var _0x3a6cd6=_0x591c[_0x5779c3];return _0x3a6cd6;};'use strict';var BPromise=require('bluebird');var _=require(_0xc591('0x0'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0xc591('0x1'));var crypto=require('crypto');var logger=require(_0xc591('0x2'))(_0xc591('0x3'));module[_0xc591('0x4')]=function(_0x210638,_0x133aec,_0x3e8f24,_0x26de52){return new BPromise(function(_0x195c3d,_0x2439b9){logger[_0xc591('0x5')]('Tilde\x20URI',_0x26de52||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE');var _0x447e5e=new WebSocket(_0x26de52||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE',{'perMessageDeflate':![]});var _0xa2d132='';var _0x443cab='0';var _0x273239='1';var _0xdce31c='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';function _0x43fbfd(_0x5b8452){var _0x12bda9=crypto[_0xc591('0x6')](_0xc591('0x7'));_0x12bda9['update'](_0x5b8452);return _0x12bda9[_0xc591('0x8')](_0xc591('0x9'));}function _0x20dbbb(){try{logger[_0xc591('0x5')]('Open\x20Tilde\x20ASR\x20socket');var _0x5ad9c0=moment()[_0xc591('0xa')]();var _0x118b89=_0x43fbfd(_0x5ad9c0+_0x133aec+_0x3e8f24);_0x447e5e[_0xc591('0xb')](JSON[_0xc591('0xc')]({'appID':_0x133aec,'timestamp':_0x5ad9c0,'appKey':_0x118b89}));var _0x53af26=fs[_0xc591('0xd')](_0x210638);_0x53af26['on'](_0xc591('0xe'),function(_0x4cefcd){_0x447e5e['send'](_0x4cefcd);});_0x53af26['on'](_0xc591('0xf'),function(){_0x447e5e[_0xc591('0xb')](_0xc591('0x10'));});}catch(_0x1ae7a1){logger[_0xc591('0x11')]('Tilde\x20ASR\x20send\x20error',JSON[_0xc591('0xc')](_0x1ae7a1));_0x447e5e['terminate']();}}function _0x54ee91(_0x4b6ac7){try{if(_0x4b6ac7){var _0xe1f538=JSON['parse'](_0x4b6ac7);switch(_0xe1f538[_0xc591('0x12')]){case 0x0:if(_0xe1f538[_0xc591('0x13')]){if(_0xe1f538[_0xc591('0x13')]['final']){logger[_0xc591('0x5')](_0xc591('0x14'),JSON[_0xc591('0xc')](_0xe1f538[_0xc591('0x13')]['hypotheses']));_0xa2d132=_0xe1f538[_0xc591('0x13')][_0xc591('0x15')][0x0]['transcript'];_0x443cab=_0xe1f538[_0xc591('0x13')][_0xc591('0x15')][0x0][_0xc591('0x16')];_0x273239='0';_0xdce31c='Success.';_0x447e5e[_0xc591('0x17')]();}}break;case 0x1:logger['info'](_0xc591('0x18'));_0x273239='1';_0xdce31c=_0xc591('0x18');break;case 0x2:logger[_0xc591('0x5')](_0xc591('0x19'));_0x273239='2';_0xdce31c=_0xc591('0x19');break;case 0x9:logger[_0xc591('0x5')](_0xc591('0x1a'));_0x273239='9';_0xdce31c=_0xc591('0x1a');break;case 0xa:logger[_0xc591('0x5')]('Authentication\x20failed.');_0x273239='10';_0xdce31c=_0xc591('0x1b');break;case 0xb:logger[_0xc591('0x5')](_0xc591('0x1c'));_0x273239='11';_0xdce31c=_0xc591('0x1c');}}}catch(_0xfc4224){logger[_0xc591('0x11')]('Tilde\x20ASR\x20parse\x20error',JSON[_0xc591('0xc')](_0xfc4224));_0x447e5e[_0xc591('0x17')]();}}function _0x2e0dc9(){logger[_0xc591('0x5')](_0xc591('0x1d'));_0x195c3d({'transcript':_0xa2d132,'confidence':_0x443cab,'status':_0x273239,'status_message':_0xdce31c});}function _0x51ac6d(_0x1c076d){logger[_0xc591('0x11')]('Error\x20Tilde\x20ASR\x20socket');if(!_[_0xc591('0x1e')](_0x1c076d)){logger['error'](_[_0xc591('0x1f')](_0x1c076d)?JSON[_0xc591('0xc')](_0x1c076d):_0x1c076d);}}_0x447e5e['on']('open',_0x20dbbb);_0x447e5e['on'](_0xc591('0x20'),_0x54ee91);_0x447e5e['on'](_0xc591('0xf'),_0x2e0dc9);_0x447e5e['on'](_0xc591('0x11'),_0x51ac6d);});}; \ 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 afcc405..0c61ee5 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 _0xde55=['./asr'];(function(_0x275f26,_0x49f050){var _0x326d04=function(_0x46209e){while(--_0x46209e){_0x275f26['push'](_0x275f26['shift']());}};_0x326d04(++_0x49f050);}(_0xde55,0xc1));var _0x5de5=function(_0x3c7e8f,_0x2c5c57){_0x3c7e8f=_0x3c7e8f-0x0;var _0xd095c6=_0xde55[_0x3c7e8f];return _0xd095c6;};var asr=require(_0x5de5('0x0'));module['exports']={'asr':asr}; \ No newline at end of file +var _0x6678=['exports'];(function(_0x3946de,_0x15ed4a){var _0xab007b=function(_0x271daa){while(--_0x271daa){_0x3946de['push'](_0x3946de['shift']());}};_0xab007b(++_0x15ed4a);}(_0x6678,0x146));var _0x8667=function(_0x2a67fe,_0x295c09){_0x2a67fe=_0x2a67fe-0x0;var _0x57e726=_0x6678[_0x2a67fe];return _0x57e726;};var asr=require('./asr');module[_0x8667('0x0')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index e0200af..78f90cb 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 _0xa9e0=['ready','E_AGI_SERVER_ERROR','close','E_AGI_SERVER_CLOSE','inherits','exports','util','net','events','./channel','call','emit','createServer','listening','connection','getConnections','error','E_AGI_SERVER_VOICE_DISABLED','destroy'];(function(_0x7c0074,_0x1ffdcf){var _0x13e95b=function(_0x521212){while(--_0x521212){_0x7c0074['push'](_0x7c0074['shift']());}};_0x13e95b(++_0x1ffdcf);}(_0xa9e0,0x123));var _0x0a9e=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0xa9e0[_0x311c35];return _0x5cc50c;};'use strict';var util=require(_0x0a9e('0x0'));var net=require(_0x0a9e('0x1'));var EventEmitter=require(_0x0a9e('0x2'))['EventEmitter'];var AGIError=require('./error');var AGIChannel=require(_0x0a9e('0x3'));var AGIServer=function(_0x4ce2f1,_0x333808,_0x432180){var _0x2ab90b=this;var _0x991246=null;var _0x981158=0x0;if(!_0x4ce2f1)_0x4ce2f1=0x11dd;if(!_0x333808)_0x333808='127.0.0.1';EventEmitter[_0x0a9e('0x4')](_0x2ab90b);function _0x441e3a(){if(!_0x4ce2f1){_0x2ab90b[_0x0a9e('0x5')]('error',new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x991246=net[_0x0a9e('0x6')]();_0x991246['listen'](_0x4ce2f1,_0x333808);_0x991246['on']('listening',function(){_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0x7'));});_0x991246['on'](_0x0a9e('0x8'),function(_0x3ab53f){_0x991246[_0x0a9e('0x9')](function(_0xbd1168,_0x4a4c56){if(_0xbd1168){_0x2ab90b['emit']('error',new AGIError('E_AGI_SERVER_ERROR',_0xbd1168));}else if(_0x432180&&_0x432180<0x0){_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0xa'),new AGIError(_0x0a9e('0xb')));_0x3ab53f[_0x0a9e('0xc')]();}else if(_0x432180&&_0x432180>0x0&&_0x432180<_0x4a4c56){_0x981158+=0x1;_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0xa'),new AGIError('E_AGI_SERVER_MAXCONNECTION',_0x981158));_0x3ab53f[_0x0a9e('0xc')]();}else{var _0x239b12=new AGIChannel(_0x3ab53f);_0x239b12['on'](_0x0a9e('0xd'),function(){_0x2ab90b[_0x0a9e('0x5')](_0x0a9e('0x8'),_0x239b12);});}});});_0x991246['on'](_0x0a9e('0xa'),function(_0x52a03d){_0x2ab90b[_0x0a9e('0x5')]('error',new AGIError(_0x0a9e('0xe'),_0x52a03d['code']));});_0x991246['on'](_0x0a9e('0xf'),function(){_0x2ab90b[_0x0a9e('0x5')]('close',new AGIError(_0x0a9e('0x10')));});}process['nextTick'](function(){_0x441e3a();});};util[_0x0a9e('0x11')](AGIServer,EventEmitter);module[_0x0a9e('0x12')]=function(_0x106033,_0x205fd6,_0x31b1ca){return new AGIServer(_0x106033,_0x205fd6,_0x31b1ca);}; \ No newline at end of file +var _0xe706=['connection','getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','close','nextTick','exports','util','net','events','./error','./channel','127.0.0.1','call','emit','error','E_AGI_ARGUMENT_PORT','createServer','listen','listening'];(function(_0x5161fc,_0x37c5f6){var _0x38490b=function(_0x49ebd8){while(--_0x49ebd8){_0x5161fc['push'](_0x5161fc['shift']());}};_0x38490b(++_0x37c5f6);}(_0xe706,0xa3));var _0x6e70=function(_0x430936,_0x2a6e66){_0x430936=_0x430936-0x0;var _0x470994=_0xe706[_0x430936];return _0x470994;};'use strict';var util=require(_0x6e70('0x0'));var net=require(_0x6e70('0x1'));var EventEmitter=require(_0x6e70('0x2'))['EventEmitter'];var AGIError=require(_0x6e70('0x3'));var AGIChannel=require(_0x6e70('0x4'));var AGIServer=function(_0x2ca810,_0x7dfbc3,_0x142c27){var _0x2164a4=this;var _0x376a8d=null;var _0x506db9=0x0;if(!_0x2ca810)_0x2ca810=0x11dd;if(!_0x7dfbc3)_0x7dfbc3=_0x6e70('0x5');EventEmitter[_0x6e70('0x6')](_0x2164a4);function _0x36357b(){if(!_0x2ca810){_0x2164a4[_0x6e70('0x7')](_0x6e70('0x8'),new AGIError(_0x6e70('0x9')));return![];}_0x376a8d=net[_0x6e70('0xa')]();_0x376a8d[_0x6e70('0xb')](_0x2ca810,_0x7dfbc3);_0x376a8d['on'](_0x6e70('0xc'),function(){_0x2164a4[_0x6e70('0x7')](_0x6e70('0xc'));});_0x376a8d['on'](_0x6e70('0xd'),function(_0x743eb5){_0x376a8d[_0x6e70('0xe')](function(_0x37b3e0,_0x4600f9){if(_0x37b3e0){_0x2164a4['emit']('error',new AGIError(_0x6e70('0xf'),_0x37b3e0));}else if(_0x142c27&&_0x142c27<0x0){_0x2164a4[_0x6e70('0x7')](_0x6e70('0x8'),new AGIError(_0x6e70('0x10')));_0x743eb5[_0x6e70('0x11')]();}else if(_0x142c27&&_0x142c27>0x0&&_0x142c27<_0x4600f9){_0x506db9+=0x1;_0x2164a4[_0x6e70('0x7')](_0x6e70('0x8'),new AGIError(_0x6e70('0x12'),_0x506db9));_0x743eb5['destroy']();}else{var _0x52737e=new AGIChannel(_0x743eb5);_0x52737e['on']('ready',function(){_0x2164a4[_0x6e70('0x7')]('connection',_0x52737e);});}});});_0x376a8d['on']('error',function(_0x304716){_0x2164a4[_0x6e70('0x7')]('error',new AGIError(_0x6e70('0xf'),_0x304716['code']));});_0x376a8d['on'](_0x6e70('0x13'),function(){_0x2164a4[_0x6e70('0x7')]('close',new AGIError('E_AGI_SERVER_CLOSE'));});}process[_0x6e70('0x14')](function(){_0x36357b();});};util['inherits'](AGIServer,EventEmitter);module[_0x6e70('0x15')]=function(_0x173afe,_0x53acdc,_0x497d61){return new AGIServer(_0x173afe,_0x53acdc,_0x497d61);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index dd64305..c1e0b9f 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 _0xb647=['providerResponse','out','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','password','ndassistant_url','Sestek\x20NDA\x20%s\x20file\x20created','audiofile','unlink','.wav','SestekNDA\x20Result\x20%s','Enter\x20in\x20END\x20(%s)\x20block','end','ext_dial','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','SIP/%s/%s','finally','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','no\x20file\x20audio\x20found','getData','response','test','mindigit','hiddendigitsnum','substr','generate','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','goalname','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','Trying\x20aws\x20Polly\x20%s','streamFile','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','wav','beep','NOBEEP','recordFile','intKey','google\x20%s\x20file\x20created','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','appsecret','no\x20appsecret\x20configured','%s/recordings/%s','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','false','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','IFTIME(%s?true:false)','true','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','FIND\x20AGENT\x20%s\x20BY\x20%s','findBy','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','no\x20find\x20by\x20configured','math','operation','math\x20%s','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','getSound','digit','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','playback','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','getVoiceQueue','no\x20queue\x20found','indexOf','toLowerCase','QUEUE','macro','gosub','position','record','recordingFormat','%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','Response:','inspect','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','replace','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','getMailAccount','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','user','subject','template_id','sendMail\x20message','smtpOptions','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','XMCS-UNIQUEID','Answer','Skipped\x20Answer','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','getSquareProject','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','host','127.0.0.1','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','shellCommand','command','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','google_cloud_tts','apiKey','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','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','exports','util','lodash','shelljs','odbc','randomstring','moment','mustache','request-promise','agi','./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','menu','getdigits','getsecretdigits','channel','mailRpc','getVariableById','then','name','catch','prototype','getVoiceQueueById','rpc','getSquareProjectById','getSquareOdbc','getSquareOdbcById','dsn','getUserById','getTrunk','getTrunkById','getSoundById','getSoundPath','save_name','getMailAccountById','sendMailMessage','getIntervals','IntervalId','interval','map','format','%s/sounds/converted/%s','getQueryOdbc','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','query','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','uniqueid','label','arg_1','callerid','createSquareRecording','calleridname','context','extension','priority','dnid','file','createSquareMessage','createCmContact','isEmpty','isNil','callback_','random','lastName','list_id','scheduledAt','Callback\x20scheduled\x20at\x20','callback_priority','getPause','agentPause','agentUnpause','agent','agentLogout','agentLogin','internal','%s/%s@from-sip/n','LOCAL','trim','googleCloudTTS','google_cloud_tts_text_type','text','ssmlGender','MALE','MP3','googleTTS','google_tts_language','restAPI','url','method','number','timeout','POST','PUT','toUpperCase','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','render','headers','stringify','body','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','client_email','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','en-US','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_region','aws_polly_voice','Amy','aws_text_type','awsLex','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','uri','clear','clone','isString','includes','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','hasOwnProperty','isArray','length','isPlainObject','saveRestApiResult','%s.%s','setVariable','split','replaceAll','toString','getVariable','result','extra','maxRetry','createSquareDetailsReport','sync','retry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','no\x20text\x20configured','exec','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','no\x20grammar\x20configured','grammar','MRCPRecog','getAndSetVariable','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','RECOG_INSTANCE()','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','callback','Enter\x20in\x20CALLBACK\x20(%s)\x20block','delay','add','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_TRANSCRIPT','Executed\x20command\x20MRCPRecog\x20%s','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','no\x20query\x20configured','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','keys','%s[%s][%s]','variable\x20%s\x20set','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','getUser','DIAL','SIP/%s','opts','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','no\x20client_email\x20configured','private_key','no\x20private_key\x20configured','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s'];(function(_0x547fe3,_0x5bbc1a){var _0x5391b7=function(_0x2b0612){while(--_0x2b0612){_0x547fe3['push'](_0x547fe3['shift']());}};_0x5391b7(++_0x5bbc1a);}(_0xb647,0xdb));var _0x7b64=function(_0x4217dd,_0x2767d1){_0x4217dd=_0x4217dd-0x0;var _0x5a3ee7=_0xb647[_0x4217dd];return _0x5a3ee7;};'use strict';var fs=require('fs');var util=require(_0x7b64('0x0'));var _=require(_0x7b64('0x1'));var sh=require(_0x7b64('0x2'));var odbc=require(_0x7b64('0x3'))();var rs=require(_0x7b64('0x4'));var moment=require(_0x7b64('0x5'));var Mustache=require(_0x7b64('0x6'));var rp=require(_0x7b64('0x7'));var logger=require('../../config/logger')(_0x7b64('0x8'));var config=require('../../config/environment');var scripts=require(_0x7b64('0x9'));var FILES_PATH=_0x7b64('0xa');var recursiveMapAttributes=[_0x7b64('0xb'),_0x7b64('0xc')];var verticesWithRetry=[_0x7b64('0xd'),_0x7b64('0xe'),_0x7b64('0xf')];var AGIVertices=function(_0x2ff650,_0x432ced,_0x5784fb){this[_0x7b64('0x10')]=_0x2ff650;this['rpc']=_0x432ced;this[_0x7b64('0x11')]=_0x5784fb;};AGIVertices['prototype']['getVariable']=function(_0x35ed61,_0xa72761){this['rpc'][_0x7b64('0x12')](_0x35ed61)[_0x7b64('0x13')](function(_0xd9e5ca){_0xa72761(null,_0xd9e5ca?_0xd9e5ca[_0x7b64('0x14')]:![]);})[_0x7b64('0x15')](function(_0x432626){_0xa72761(_0x432626);});};AGIVertices[_0x7b64('0x16')]['getVoiceQueue']=function(_0x212438,_0x56899c){this['rpc'][_0x7b64('0x17')](_0x212438)[_0x7b64('0x13')](function(_0x1d256d){_0x56899c(null,_0x1d256d?_0x1d256d[_0x7b64('0x14')]:![]);})[_0x7b64('0x15')](function(_0x437ddc){_0x56899c(_0x437ddc);});};AGIVertices[_0x7b64('0x16')]['getSquareProject']=function(_0xca026a,_0x40066b){this[_0x7b64('0x18')][_0x7b64('0x19')](_0xca026a)[_0x7b64('0x13')](function(_0x4aa38d){_0x40066b(null,_0x4aa38d?_0x4aa38d[_0x7b64('0x14')]:![]);})[_0x7b64('0x15')](function(_0x58517e){_0x40066b(_0x58517e);});};AGIVertices[_0x7b64('0x16')][_0x7b64('0x1a')]=function(_0x5ef53f,_0x23845e){this[_0x7b64('0x18')][_0x7b64('0x1b')](_0x5ef53f)[_0x7b64('0x13')](function(_0x47cef5){_0x23845e(null,_0x47cef5?_0x47cef5[_0x7b64('0x1c')]:![]);})[_0x7b64('0x15')](function(_0x4a7549){_0x23845e(_0x4a7549);});};AGIVertices[_0x7b64('0x16')]['getUser']=function(_0x2d2d9a,_0x587da6){this[_0x7b64('0x18')][_0x7b64('0x1d')](_0x2d2d9a)[_0x7b64('0x13')](function(_0x379e90){_0x587da6(null,_0x379e90?_0x379e90[_0x7b64('0x14')]:![]);})[_0x7b64('0x15')](function(_0x215ea9){_0x587da6(_0x215ea9);});};AGIVertices[_0x7b64('0x16')][_0x7b64('0x1e')]=function(_0x78a6d1,_0xec557c){this[_0x7b64('0x18')][_0x7b64('0x1f')](_0x78a6d1)[_0x7b64('0x13')](function(_0x50d06c){_0xec557c(null,_0x50d06c?_0x50d06c[_0x7b64('0x14')]:![]);})['catch'](function(_0x1580d0){_0xec557c(_0x1580d0);});};AGIVertices[_0x7b64('0x16')]['getSound']=function(_0x5acdb3,_0x38738c){var _0x1e1ba7=this;this[_0x7b64('0x18')][_0x7b64('0x20')](_0x5acdb3)[_0x7b64('0x13')](function(_0x3c9fad){_0x38738c(null,_0x3c9fad?_0x1e1ba7[_0x7b64('0x21')](_0x3c9fad[_0x7b64('0x22')]):![]);})['catch'](function(_0x1616c9){_0x38738c(_0x1616c9);});};AGIVertices[_0x7b64('0x16')]['getMailAccount']=function(_0x6b1d0,_0x2bcefa){this[_0x7b64('0x18')][_0x7b64('0x23')](_0x6b1d0)[_0x7b64('0x13')](function(_0x38a059){_0x2bcefa(null,_0x38a059?_0x38a059:![]);})['catch'](function(_0x5bf639){_0x2bcefa(_0x5bf639);});};AGIVertices[_0x7b64('0x16')][_0x7b64('0x24')]=function(_0x49e402,_0x508c6d,_0x345664){this['mailRpc'][_0x7b64('0x24')](_0x49e402,_0x508c6d)['then'](function(){_0x345664(null);})['catch'](function(_0x5a80b2){_0x345664(_0x5a80b2);});};AGIVertices[_0x7b64('0x16')][_0x7b64('0x25')]=function(_0x120a84,_0x58ffdb){this[_0x7b64('0x18')]['getIntervalById'](_0x120a84)[_0x7b64('0x13')](function(_0x7e1083){if(_0x7e1083){if(_0x7e1083[_0x7b64('0x26')]){_0x58ffdb(null,[_0x7e1083[_0x7b64('0x27')]]);}else{_0x58ffdb(null,_[_0x7b64('0x28')](_0x7e1083['Intervals'],_0x7b64('0x27')));}}else{_0x58ffdb(null,![]);}})[_0x7b64('0x15')](function(_0x2d0e9){_0x58ffdb(_0x2d0e9);});};AGIVertices[_0x7b64('0x16')]['getSoundPath']=function(_0x1855c5){return util[_0x7b64('0x29')](_0x7b64('0x2a'),FILES_PATH,_0x1855c5);};AGIVertices[_0x7b64('0x16')][_0x7b64('0x2b')]=function(_0x27e008,_0x1c0be6,_0x526389){odbc['open'](_0x27e008,function(_0xe9eac){if(_0xe9eac){logger[_0x7b64('0x2c')](_0x7b64('0x2d'),_0xe9eac);_0x526389(_0xe9eac);}else{logger[_0x7b64('0x2e')](_0x7b64('0x2f'));odbc[_0x7b64('0x30')](_0x1c0be6,function(_0x36c606,_0x3c3d77){if(_0x36c606){logger[_0x7b64('0x2e')]('Error\x20executing\x20query\x20%s',_0x1c0be6);_0x526389(_0x36c606);}else{logger[_0x7b64('0x2e')](_0x7b64('0x31'),_0x1c0be6);odbc[_0x7b64('0x32')](function(_0x40787f){if(_0x40787f){logger[_0x7b64('0x2c')](_0x7b64('0x33'),_0x40787f);}_0x526389(null,_0x3c3d77);});}});}});};AGIVertices[_0x7b64('0x16')][_0x7b64('0x34')]=function(_0x3c4467,_0x47012c){this[_0x7b64('0x18')][_0x7b64('0x35')](_0x3c4467)[_0x7b64('0x13')](function(_0x36cfce){_0x47012c(null,_0x36cfce?_0x36cfce:![]);})[_0x7b64('0x15')](function(_0x42cc06){_0x47012c(_0x42cc06);});};AGIVertices[_0x7b64('0x16')][_0x7b64('0x36')]=function(_0x8739ec,_0x355e8a){this['rpc'][_0x7b64('0x36')](_0x8739ec)[_0x7b64('0x13')](function(_0x163580){_0x355e8a(null,_0x163580);})['catch'](function(_0x11abbc){_0x355e8a(_0x11abbc);});};AGIVertices[_0x7b64('0x16')]['createSquareDetailsReport']=function(_0x216c58,_0xf0d4a1,_0x54d7d2){this[_0x7b64('0x18')]['createSquareDetailsReport']({'uniqueid':this[_0x7b64('0x10')][_0x7b64('0x37')],'node':_0x216c58[_0x7b64('0x38')],'application':_0x216c58['agicommand'],'data':_0xf0d4a1||null,'project_name':this[_0x7b64('0x10')][_0x7b64('0x39')],'callerid':this[_0x7b64('0x10')][_0x7b64('0x3a')]})[_0x7b64('0x13')](function(_0x284e1a){if(_0x54d7d2){_0x54d7d2(null,_0x284e1a);}})['catch'](function(_0x20accc){if(_0x54d7d2){_0x54d7d2(_0x20accc);}});};AGIVertices[_0x7b64('0x16')][_0x7b64('0x3b')]=function(_0x1dd7a9,_0xdcca4e,_0x54e89a,_0x531354){this['rpc']['createSquareRecording']({'uniqueid':this[_0x7b64('0x10')][_0x7b64('0x37')],'callerid':this[_0x7b64('0x10')][_0x7b64('0x3a')],'calleridname':this[_0x7b64('0x10')][_0x7b64('0x3c')],'context':this[_0x7b64('0x10')][_0x7b64('0x3d')],'extension':this[_0x7b64('0x10')][_0x7b64('0x3e')],'priority':this[_0x7b64('0x10')][_0x7b64('0x3f')],'accountcode':this['channel']['accountcode'],'dnid':this[_0x7b64('0x10')][_0x7b64('0x40')],'projectName':this[_0x7b64('0x10')][_0x7b64('0x39')],'saveName':_0xdcca4e,'filename':_0x1dd7a9[_0x7b64('0x41')]||_0xdcca4e,'savePath':_0x54e89a})['then'](function(_0x3e5321){_0x531354(null,_0x3e5321);})[_0x7b64('0x15')](function(_0x476890){_0x531354(_0x476890);});};AGIVertices['prototype'][_0x7b64('0x42')]=function(_0x214a45,_0x27c9f9,_0x64b24a,_0x18c5b0,_0x572713){this[_0x7b64('0x18')][_0x7b64('0x42')]({'uniqueid':this['channel'][_0x7b64('0x37')],'body':_0x214a45,'direction':_0x27c9f9,'providerName':_0x64b24a,'providerResponse':_0x18c5b0})[_0x7b64('0x13')](function(_0x5ed33c){if(_0x572713){_0x572713(null,_0x5ed33c);}})[_0x7b64('0x15')](function(_0x2c6d00){if(_0x572713){_0x572713(_0x2c6d00);}});};AGIVertices[_0x7b64('0x16')][_0x7b64('0x43')]=function(_0x383190,_0x79cbc9){this[_0x7b64('0x18')][_0x7b64('0x43')]({'firstName':_[_0x7b64('0x44')](_0x383190[_0x7b64('0x14')])||_[_0x7b64('0x45')](_0x383190[_0x7b64('0x14')])?_0x7b64('0x46')+Math[_0x7b64('0x47')]():_0x383190[_0x7b64('0x14')],'lastName':_[_0x7b64('0x44')](_0x383190[_0x7b64('0x48')])||_[_0x7b64('0x45')](_0x383190['lastName'])?null:_0x383190[_0x7b64('0x48')],'phone':_0x383190['phone'],'ListId':_0x383190[_0x7b64('0x49')],'scheduledat':_0x383190[_0x7b64('0x4a')],'callbackUniqueid':this[_0x7b64('0x10')]['uniqueid'],'tags':'callback','description':_0x7b64('0x4b')+_0x383190['scheduledAt']['toString'](),'priority':_0x383190[_0x7b64('0x4c')]})[_0x7b64('0x13')](function(_0x1e1cd3){_0x79cbc9(null,_0x1e1cd3);})['catch'](function(_0x1fd98a){_0x79cbc9(_0x1fd98a);});};AGIVertices[_0x7b64('0x16')][_0x7b64('0x4d')]=function(_0x32ba5d,_0x3724a7){this['rpc']['getPauseById'](_0x32ba5d)[_0x7b64('0x13')](function(_0xe47998){_0x3724a7(null,_0xe47998?_0xe47998[_0x7b64('0x14')]:![]);})[_0x7b64('0x15')](function(_0x59df96){_0x3724a7(_0x59df96);});};AGIVertices[_0x7b64('0x16')][_0x7b64('0x4e')]=function(_0x18ef41,_0x1049da,_0x4999c3){var _0x463433={'role':'agent'};_0x463433[_0x18ef41]=this[_0x7b64('0x10')]['callerid'];this['rpc']['agentPause'](_0x463433,_0x1049da,this['channel'][_0x7b64('0x37')])[_0x7b64('0x13')](function(_0x5c9a7e){_0x4999c3(null,_[_0x7b64('0x45')](_0x5c9a7e)?![]:!![]);})[_0x7b64('0x15')](function(_0x3dd757){logger['error'](_0x3dd757);_0x4999c3(null,![]);});};AGIVertices[_0x7b64('0x16')][_0x7b64('0x4f')]=function(_0x5e6f02,_0x51b944){var _0x1c2bdf={'role':'agent'};_0x1c2bdf[_0x5e6f02]=this['channel'][_0x7b64('0x3a')];this[_0x7b64('0x18')]['agentUnpause'](_0x1c2bdf)['then'](function(_0x28002e){_0x51b944(null,_[_0x7b64('0x45')](_0x28002e)?![]:!![]);})['catch'](function(_0x86ddde){logger['error'](_0x86ddde);_0x51b944(null,![]);});};AGIVertices[_0x7b64('0x16')]['agentLogout']=function(_0x117d52,_0x293e73){var _0x2ad554={'role':_0x7b64('0x50')};_0x2ad554[_0x117d52]=this[_0x7b64('0x10')]['callerid'];this[_0x7b64('0x18')][_0x7b64('0x51')](_0x2ad554)[_0x7b64('0x13')](function(_0x201d1b){_0x293e73(null,_['isNil'](_0x201d1b)?![]:!![]);})[_0x7b64('0x15')](function(_0x323c06){logger[_0x7b64('0x2c')](_0x323c06);_0x293e73(null,![]);});};AGIVertices['prototype'][_0x7b64('0x52')]=function(_0x4e7764,_0x1996f9){var _0x2dc0ea={'role':'agent'};_0x2dc0ea[_0x4e7764]=this['channel'][_0x7b64('0x3a')];var _0x5f1706=_0x4e7764!=_0x7b64('0x53')?util[_0x7b64('0x29')](_0x7b64('0x54'),_0x7b64('0x55'),this[_0x7b64('0x10')][_0x7b64('0x3a')]):undefined;this[_0x7b64('0x18')][_0x7b64('0x52')](_0x2dc0ea,_0x5f1706)['then'](function(_0x37239c){_0x1996f9(null,_[_0x7b64('0x45')](_0x37239c)?![]:!![]);})['catch'](function(_0x5f127c){logger[_0x7b64('0x2c')](_0x5f127c);_0x1996f9(null,![]);});};AGIVertices[_0x7b64('0x16')]['shellCommand']=function(_0x17f511,_0x2a7d8a){sh['exec'](_[_0x7b64('0x56')](_0x17f511),function(_0xb02c35,_0x4962bf){var _0x47c76e=_0x4962bf['replace'](/(\r\n|\n|\r)/gm,'');_0x2a7d8a(null,_0x47c76e);});};AGIVertices[_0x7b64('0x16')]['googleCloudTTS']=function(_0x1c170e,_0x12bf8a){scripts[_0x7b64('0x57')](_0x1c170e['apiKey'],_0x1c170e[_0x7b64('0x58')]||_0x7b64('0x59'),_0x1c170e[_0x7b64('0x59')],_0x1c170e['languageCode']||'en-US',_0x1c170e[_0x7b64('0x5a')]||_0x7b64('0x5b'),_0x1c170e['audioEncoding']||_0x7b64('0x5c'))[_0x7b64('0x13')](function(_0x47b3bc){_0x12bf8a(null,_0x47b3bc);})[_0x7b64('0x15')](function(_0x2e92a5){_0x12bf8a(_0x2e92a5);});};AGIVertices['prototype'][_0x7b64('0x5d')]=function(_0x8941d9,_0x2e7053){scripts[_0x7b64('0x5d')](_0x8941d9[_0x7b64('0x59')],_0x8941d9[_0x7b64('0x5e')]||'en',0x1)['then'](function(_0x4ac9b9){_0x2e7053(null,_0x4ac9b9);})[_0x7b64('0x15')](function(_0x622a7f){_0x2e7053(_0x622a7f);});};AGIVertices['prototype'][_0x7b64('0x5f')]=function(_0x13e09a,_0x26d94d){var _0x511816={'uri':_0x13e09a[_0x7b64('0x60')],'method':_0x13e09a[_0x7b64('0x61')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x13e09a['timeout'])===_0x7b64('0x62')&&parseInt(_0x13e09a['timeout'])>=0x1?parseInt(_0x13e09a[_0x7b64('0x63')])*0x3e8:0x5*0x3e8};if(_['includes']([_0x7b64('0x64'),_0x7b64('0x65')],_0x511816['method'][_0x7b64('0x66')]())){try{_0x511816['body']=_0x13e09a[_0x7b64('0xc')]?JSON[_0x7b64('0x67')](_0x13e09a['rawBody']):{};}catch(_0x433ec0){logger[_0x7b64('0x2c')](_0x7b64('0x68'),_0x433ec0);}}try{_0x511816['headers']=_0x13e09a[_0x7b64('0xb')]?JSON['parse'](_0x13e09a['rawHeaders']):{};}catch(_0x4c9a99){logger[_0x7b64('0x2c')](_0x7b64('0x69'),_0x4c9a99);}if(_0x13e09a[_0x7b64('0x6a')]){try{var _0x648cbc=require(_0x13e09a[_0x7b64('0x6a')])['sync'](this,_0x511816);_0x511816['uri']=Mustache[_0x7b64('0x6b')](_0x13e09a[_0x7b64('0x60')],_0x648cbc,{},['$$','$$']);if(_0x511816[_0x7b64('0x6c')]){_0x511816[_0x7b64('0x6c')]=JSON[_0x7b64('0x67')](Mustache['render'](JSON[_0x7b64('0x6d')](_0x511816['headers']),_0x648cbc,{},['$$','$$']));}if(_0x511816[_0x7b64('0x6e')]){_0x511816[_0x7b64('0x6e')]=JSON[_0x7b64('0x67')](Mustache['render'](JSON[_0x7b64('0x6d')](_0x511816['body']),_0x648cbc,{},['$$','$$']));}}catch(_0x36e460){logger[_0x7b64('0x2c')]('An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function',_0x36e460);}}rp(_0x511816)[_0x7b64('0x13')](function(_0x2d0dbd){var _0x360a6b={'statusCode':_0x2d0dbd[_0x7b64('0x6f')]||0xc8,'statusMessage':_0x2d0dbd[_0x7b64('0x70')]||'OK','headers':_0x2d0dbd[_0x7b64('0x6c')]||{},'body':_0x2d0dbd[_0x7b64('0x6e')]||{}};_0x26d94d(null,_0x360a6b);})['catch'](function(_0x41819b){var _0x5d75ae={'statusCode':_0x41819b[_0x7b64('0x6f')]||0x1f4,'statusMessage':_0x41819b[_0x7b64('0x71')]||_0x7b64('0x72'),'headers':_0x41819b[_0x7b64('0x73')][_0x7b64('0x6c')]||{},'body':_0x41819b[_0x7b64('0x73')][_0x7b64('0x6e')]||{}};_0x26d94d(null,_0x5d75ae);});};AGIVertices['prototype']['googleDialogflow']=function(_0x1cadbf,_0x1aeeec){scripts[_0x7b64('0x74')](this[_0x7b64('0x10')][_0x7b64('0x37')],_0x1cadbf[_0x7b64('0x75')],_0x1cadbf[_0x7b64('0x59')],_0x1cadbf[_0x7b64('0x76')]||'en')[_0x7b64('0x13')](function(_0x502b8a){_0x1aeeec(null,_0x502b8a);})[_0x7b64('0x15')](function(_0x1b4cf8){_0x1aeeec(_0x1b4cf8);});};AGIVertices[_0x7b64('0x16')][_0x7b64('0x77')]=function(_0x5c1e4f,_0x212723){scripts[_0x7b64('0x77')](this[_0x7b64('0x10')]['uniqueid'],_0x5c1e4f[_0x7b64('0x78')],_0x5c1e4f[_0x7b64('0x79')],_0x5c1e4f['private_key'],_0x5c1e4f[_0x7b64('0x59')],_0x5c1e4f[_0x7b64('0x7a')]||'en')[_0x7b64('0x13')](function(_0x3cf3e4){_0x212723(null,_0x3cf3e4);})[_0x7b64('0x15')](function(_0x4dbb60){_0x212723(_0x4dbb60);});};AGIVertices[_0x7b64('0x16')][_0x7b64('0x7b')]=function(_0x58fb41,_0x4627e4){scripts[_0x7b64('0x7b')](this[_0x7b64('0x10')],_0x58fb41)[_0x7b64('0x13')](function(_0x5e2e1b){_0x4627e4(null,_0x5e2e1b);})[_0x7b64('0x15')](function(_0x14dfc1){_0x4627e4(_0x14dfc1);});};AGIVertices[_0x7b64('0x16')][_0x7b64('0x7c')]=function(_0x1180b2,_0x217a13){scripts[_0x7b64('0x7c')](_0x1180b2[_0x7b64('0x75')],_0x1180b2['text'],_0x1180b2[_0x7b64('0x7d')]||_0x7b64('0x7e'),_0x1180b2[_0x7b64('0x7f')])[_0x7b64('0x13')](function(_0x533ce1){_0x217a13(null,_0x533ce1);})[_0x7b64('0x15')](function(_0x4efbc2){_0x217a13(_0x4efbc2);});};AGIVertices[_0x7b64('0x16')][_0x7b64('0x80')]=function(_0x35fbce,_0x556031,_0x59d017){scripts[_0x7b64('0x80')](_0x556031,_0x35fbce[_0x7b64('0x75')],_0x35fbce[_0x7b64('0x81')]||_0x7b64('0x7e'),this[_0x7b64('0x82')](_0x35fbce[_0x7b64('0x83')])?_0x35fbce['model']:undefined)[_0x7b64('0x13')](function(_0x503a65){_0x59d017(null,_0x503a65);})[_0x7b64('0x15')](function(_0x5d8cea){_0x59d017(_0x5d8cea);});};AGIVertices[_0x7b64('0x16')][_0x7b64('0x84')]=function(_0xb5cae6,_0xb3d6e9){scripts['awsPolly'](_0xb5cae6[_0x7b64('0x85')],_0xb5cae6[_0x7b64('0x86')],_0xb5cae6[_0x7b64('0x87')],_0xb5cae6[_0x7b64('0x88')]||_0x7b64('0x89'),_0xb5cae6[_0x7b64('0x59')],_0xb5cae6[_0x7b64('0x8a')]||_0x7b64('0x59'))[_0x7b64('0x13')](function(_0x40d118){_0xb3d6e9(null,_0x40d118);})[_0x7b64('0x15')](function(_0x4d089c){_0xb3d6e9(_0x4d089c);});};AGIVertices[_0x7b64('0x16')][_0x7b64('0x8b')]=function(_0x411eb1,_0x41269d){scripts[_0x7b64('0x8b')](this[_0x7b64('0x10')][_0x7b64('0x37')],_0x411eb1['aws_access_key_id'],_0x411eb1[_0x7b64('0x86')],_0x411eb1[_0x7b64('0x8c')],_0x411eb1[_0x7b64('0x59')],_0x411eb1[_0x7b64('0x8d')])[_0x7b64('0x13')](function(_0x3e06da){_0x41269d(null,_0x3e06da);})['catch'](function(_0x453ca8){_0x41269d(_0x453ca8);});};AGIVertices[_0x7b64('0x16')][_0x7b64('0x8e')]=function(_0x268c57,_0x3c96c9,_0x170321){scripts[_0x7b64('0x8e')](_0x3c96c9,_0x268c57['key'],_0x268c57[_0x7b64('0x8f')]||_0x7b64('0x7e'))[_0x7b64('0x13')](function(_0x4e8350){_0x170321(null,_0x4e8350);})[_0x7b64('0x15')](function(_0x1c0861){_0x170321(_0x1c0861);});};AGIVertices[_0x7b64('0x16')][_0x7b64('0x90')]=function(_0x32533b,_0x1363c2,_0x369d6d){scripts['tildeASR'](_0x1363c2,_0x32533b[_0x7b64('0x91')],_0x32533b['appsecret'],_0x32533b[_0x7b64('0x92')])[_0x7b64('0x13')](function(_0x1012d7){_0x369d6d(null,_0x1012d7);})[_0x7b64('0x15')](function(_0xa66a6a){_0x369d6d(_0xa66a6a);});};AGIVertices[_0x7b64('0x16')][_0x7b64('0x93')]=function(_0x54790a){var _0x385691=_['includes'](verticesWithRetry,_0x54790a['agicommand'])?_0x54790a:_[_0x7b64('0x94')](_0x54790a);for(var _0x119cf2 in _0x385691){if(_0x385691['hasOwnProperty'](_0x119cf2)){if(_0x385691[_0x119cf2]&&_[_0x7b64('0x95')](_0x385691[_0x119cf2])){if(_[_0x7b64('0x96')](recursiveMapAttributes,_0x119cf2)){_0x385691[_0x119cf2]=this[_0x7b64('0x97')](_0x385691[_0x119cf2]);}else{_0x385691[_0x119cf2]=this[_0x7b64('0x98')](_0x385691[_0x119cf2]);}}}}return _0x385691;};AGIVertices[_0x7b64('0x16')][_0x7b64('0x99')]=function(_0x46c88c){for(var _0x2b8547 in _0x46c88c){if(_0x46c88c[_0x7b64('0x9a')](_0x2b8547)){if(_['isPlainObject'](_0x46c88c[_0x2b8547])){this[_0x7b64('0x99')](_0x46c88c[_0x2b8547]);}else if(_[_0x7b64('0x9b')](_0x46c88c[_0x2b8547])){for(var _0x563e09=0x0;_0x563e09<_0x46c88c[_0x2b8547][_0x7b64('0x9c')];_0x563e09++){this['recursiveNodeIndex'](_0x46c88c[_0x2b8547][_0x563e09]);}}else if(_[_0x7b64('0x95')](_0x46c88c[_0x2b8547])){_0x46c88c[_0x2b8547]=this['replaceAllVariables'](_0x46c88c[_0x2b8547]);}}}};AGIVertices['prototype']['saveRestApiResult']=function(_0xabb851,_0x1d6d27){for(var _0x370cda in _0xabb851){if(_0xabb851[_0x7b64('0x9a')](_0x370cda)){if(_[_0x7b64('0x9d')](_0xabb851[_0x370cda])){if(!_['isEmpty'](_0xabb851[_0x370cda])){this[_0x7b64('0x9e')](_0xabb851[_0x370cda],util['format'](_0x7b64('0x9f'),_0x1d6d27,_0x370cda));}}else if(_[_0x7b64('0x9b')](_0xabb851[_0x370cda])){for(var _0x1480b0=0x0;_0x1480b0<_0xabb851[_0x370cda]['length'];_0x1480b0++){this[_0x7b64('0x9e')](_0xabb851[_0x370cda][_0x1480b0],util[_0x7b64('0x29')](_0x7b64('0x9f'),_0x1d6d27,_0x370cda+'['+_0x1480b0+']'));}}else{if(!_[_0x7b64('0x45')](_0xabb851[_0x370cda])){this[_0x7b64('0x10')][_0x7b64('0xa0')](util[_0x7b64('0x29')](_0x7b64('0x9f'),_0x1d6d27,_0x370cda),_0xabb851[_0x370cda]);}}}}};AGIVertices[_0x7b64('0x16')]['replaceObjectAllVariables']=function(_0x41e506){try{var _0x1761a9=JSON[_0x7b64('0x67')](_0x41e506);this['recursiveNodeIndex'](_0x1761a9);return JSON['stringify'](_0x1761a9);}catch(_0x40c378){return this[_0x7b64('0x98')](_0x41e506);}};AGIVertices[_0x7b64('0x16')][_0x7b64('0x98')]=function(_0x8bc40f){var _0x5d06ce=_0x8bc40f[_0x7b64('0xa1')]('{');for(var _0x21c02e=0x1;_0x21c02e<_0x5d06ce[_0x7b64('0x9c')];_0x21c02e+=0x1){var _0x5c2b0f=_0x5d06ce[_0x21c02e][_0x7b64('0xa1')]('}');if(_0x5c2b0f[_0x7b64('0x9c')]>0x1){_0x8bc40f=_0x8bc40f[_0x7b64('0xa2')]('{'+_0x5c2b0f[0x0]+'}',this[_0x7b64('0x10')]['getVariable'](_0x5c2b0f[0x0])['extra']||_0x5c2b0f[0x0]);}}if(_0x5d06ce[_0x7b64('0x9c')]===0x1){return _0x8bc40f[_0x7b64('0xa3')]();}return this[_0x7b64('0x98')](_0x8bc40f);};AGIVertices['prototype']['getAndSetVariable']=function(_0x160708,_0x4d1a8b){var _0x5a0575=this[_0x7b64('0x10')][_0x7b64('0xa4')](_0x160708);if(_0x5a0575[_0x7b64('0xa5')]===-0x1){return _0x5a0575;}logger[_0x7b64('0x2e')](util[_0x7b64('0x29')]('The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s',_0x4d1a8b,_0x5a0575[_0x7b64('0xa6')]));return this[_0x7b64('0x10')][_0x7b64('0xa0')](_0x4d1a8b,_0x5a0575[_0x7b64('0xa6')]);};AGIVertices[_0x7b64('0x16')]['isConfigured']=function(_0x381c1a){return _0x381c1a&&_0x381c1a!=='0'&&_0x381c1a!=='-1'&&_0x381c1a!=='';};AGIVertices[_0x7b64('0x16')][_0x7b64('0xa7')]=function(_0x71f120){this[_0x7b64('0xa8')][_0x7b64('0xa9')](this,_0x71f120,'-');_0x71f120[_0x7b64('0xaa')]=_0x71f120[_0x7b64('0xa7')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x7b64('0x16')][_0x7b64('0xab')]=function(_0x39bc65){logger[_0x7b64('0x2e')](util[_0x7b64('0x29')](_0x7b64('0xac'),_0x39bc65['label']));if(!this[_0x7b64('0x82')](_0x39bc65[_0x7b64('0x59')])){return this[_0x7b64('0x10')][_0x7b64('0xad')](_0x7b64('0xae'));}var _0x108d1a='\x22'+_0x39bc65[_0x7b64('0x59')]+'\x22';if(this[_0x7b64('0x82')](_0x39bc65[_0x7b64('0x73')])){_0x108d1a+=','+_0x39bc65[_0x7b64('0x73')];}var _0x1a4e3b=this[_0x7b64('0x10')][_0x7b64('0xaf')](_0x7b64('0xb0'),_0x108d1a);if(_0x1a4e3b[_0x7b64('0xa5')]===-0x1){return _0x1a4e3b;}return this[_0x7b64('0x10')]['noop'](util[_0x7b64('0x29')](_0x7b64('0xb1'),_0x108d1a));};AGIVertices[_0x7b64('0x16')]['mrcprecog']=function(_0x57153f){logger[_0x7b64('0x2e')](util[_0x7b64('0x29')](_0x7b64('0xb2'),_0x57153f[_0x7b64('0x38')]));if(!this[_0x7b64('0x82')](_0x57153f['grammar'])){return this[_0x7b64('0x10')][_0x7b64('0xad')](_0x7b64('0xb3'));}var _0x548847=_0x57153f[_0x7b64('0xb4')];if(this[_0x7b64('0x82')](_0x57153f[_0x7b64('0x73')])){_0x548847+=','+_0x57153f[_0x7b64('0x73')];}var _0x4f4fe8=this[_0x7b64('0x10')][_0x7b64('0xaf')](_0x7b64('0xb5'),_0x548847);if(_0x4f4fe8[_0x7b64('0xa5')]===-0x1){return _0x4f4fe8;}var _0x438ea3=this[_0x7b64('0xb6')](_0x7b64('0xb7'),_0x7b64('0xb8'));if(_0x438ea3[_0x7b64('0xa5')]===-0x1){return _0x438ea3;}var _0x1e1568=this[_0x7b64('0xb6')](_0x7b64('0xb9'),'MRCP_RECOG_TRANSCRIPT');if(_0x1e1568[_0x7b64('0xa5')]===-0x1){return _0x1e1568;}var _0x4c0c6c=this[_0x7b64('0xb6')](_0x7b64('0xba'),'MRCP_RECOG_INSTANCE');if(_0x4c0c6c[_0x7b64('0xa5')]===-0x1){return _0x4c0c6c;}return this[_0x7b64('0x10')][_0x7b64('0xad')](util[_0x7b64('0x29')]('Executed\x20command\x20MRCPRecog\x20%s',_0x548847));};AGIVertices[_0x7b64('0x16')]['agi']=function(_0x49f84e){logger[_0x7b64('0x2e')](util[_0x7b64('0x29')]('Enter\x20in\x20AGI\x20(%s)\x20block',_0x49f84e[_0x7b64('0x38')]));return this[_0x7b64('0x10')]['agi']([_0x49f84e['command'],_0x49f84e['args']]);};AGIVertices[_0x7b64('0x16')][_0x7b64('0xbb')]=function(_0x23b248){logger[_0x7b64('0x2e')](util['format'](_0x7b64('0xbc'),_0x23b248['label']));if(this[_0x7b64('0x82')](_0x23b248['timeout'])){logger['info'](util['format'](_0x7b64('0xbd'),_0x23b248[_0x7b64('0x63')]));var _0x9a093=this[_0x7b64('0x10')][_0x7b64('0xbe')](_0x23b248[_0x7b64('0x63')]);if(_0x9a093[_0x7b64('0xa5')]===-0x1){return _0x9a093;}}return this['channel'][_0x7b64('0xbb')]();};AGIVertices[_0x7b64('0x16')][_0x7b64('0xbf')]=function(_0x4a5159){logger[_0x7b64('0x2e')](util[_0x7b64('0x29')](_0x7b64('0xc0'),_0x4a5159[_0x7b64('0x38')]));if(!this[_0x7b64('0x82')](_0x4a5159[_0x7b64('0x49')])){return this[_0x7b64('0x10')]['error'](_0x4a5159,'no\x20list\x20selected');}_0x4a5159[_0x7b64('0x4a')]=moment();if(this[_0x7b64('0x82')](_0x4a5159[_0x7b64('0xc1')])){_0x4a5159[_0x7b64('0x4a')]=moment()[_0x7b64('0xc2')](_0x4a5159['delay'],_0x7b64('0xc3'));}if(!this[_0x7b64('0x82')](_0x4a5159[_0x7b64('0x4c')])){_0x4a5159['callback_priority']=0x2;}this['createCmContact']['sync'](this,_0x4a5159);return this[_0x7b64('0x10')][_0x7b64('0xad')](util[_0x7b64('0x29')](_0x7b64('0xc4'),_0x4a5159['phone'],_0x4a5159['list_id'],_0x4a5159[_0x7b64('0x4a')]));};AGIVertices['prototype']['custom_app']=function(_0x33f819){logger[_0x7b64('0x2e')](util[_0x7b64('0x29')](_0x7b64('0xc5'),_0x33f819[_0x7b64('0x38')]));var _0x2bcdb8=this[_0x7b64('0x10')][_0x7b64('0xaf')](_0x33f819[_0x7b64('0xc6')],_0x33f819[_0x7b64('0x73')]);if(_0x2bcdb8['result']===-0x1){return _0x2bcdb8;}return this['channel'][_0x7b64('0xad')](util['format'](_0x7b64('0xc7'),_0x33f819['application'],_0x33f819['options']));};AGIVertices[_0x7b64('0x16')]['lumenvoxtts']=function(_0x14f871){logger['info'](util[_0x7b64('0x29')](_0x7b64('0xc8'),_0x14f871[_0x7b64('0x38')]));if(!this[_0x7b64('0x82')](_0x14f871['text'])){return this[_0x7b64('0x10')]['noop'](_0x7b64('0xae'));}var _0x5e4226='\x22'+_0x14f871['text']+'\x22';if(this[_0x7b64('0x82')](_0x14f871['options'])){_0x5e4226+=','+_0x14f871['options'];}var _0x3b7409=this['channel']['exec'](_0x7b64('0xb0'),_0x5e4226);if(_0x3b7409[_0x7b64('0xa5')]===-0x1){return _0x3b7409;}return this[_0x7b64('0x10')][_0x7b64('0xad')](util[_0x7b64('0x29')](_0x7b64('0xb1'),_0x5e4226));};AGIVertices[_0x7b64('0x16')][_0x7b64('0xc9')]=function(_0x1e9710){logger['info'](util[_0x7b64('0x29')](_0x7b64('0xca'),_0x1e9710[_0x7b64('0x38')]));if(!this[_0x7b64('0x82')](_0x1e9710['text'])){return this[_0x7b64('0x10')][_0x7b64('0xad')]('no\x20text\x20configured');}var _0xdf5026='\x22'+_0x1e9710['text']+'\x22';if(this[_0x7b64('0x82')](_0x1e9710[_0x7b64('0x73')])){_0xdf5026+=','+_0x1e9710[_0x7b64('0x73')];}var _0x44c450=this[_0x7b64('0x10')][_0x7b64('0xaf')](_0x7b64('0xb0'),_0xdf5026);if(_0x44c450[_0x7b64('0xa5')]===-0x1){return _0x44c450;}return this['channel'][_0x7b64('0xad')](util[_0x7b64('0x29')]('Executed\x20command\x20MRCPSynth\x20%s',_0xdf5026));};AGIVertices[_0x7b64('0x16')][_0x7b64('0xcb')]=function(_0x539aec){logger[_0x7b64('0x2e')](util[_0x7b64('0x29')]('Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block',_0x539aec[_0x7b64('0x38')]));if(!this[_0x7b64('0x82')](_0x539aec[_0x7b64('0xb4')])){return this[_0x7b64('0x10')][_0x7b64('0xad')](_0x7b64('0xb3'));}var _0xbc6155=_0x539aec['grammar'];if(this[_0x7b64('0x82')](_0x539aec['options'])){_0xbc6155+=','+_0x539aec['options'];}var _0xb94da1=this[_0x7b64('0x10')][_0x7b64('0xaf')](_0x7b64('0xb5'),_0xbc6155);if(_0xb94da1[_0x7b64('0xa5')]===-0x1){return _0xb94da1;}var _0x7fc3e4=this[_0x7b64('0xb6')](_0x7b64('0xb7'),_0x7b64('0xcc'));if(_0x7fc3e4[_0x7b64('0xa5')]===-0x1){return _0x7fc3e4;}var _0x48efbc=this['getAndSetVariable'](_0x7b64('0xb9'),_0x7b64('0xcd'));if(_0x48efbc[_0x7b64('0xa5')]===-0x1){return _0x48efbc;}var _0x5633bf=this[_0x7b64('0xb6')]('RECOG_INSTANCE()','LUMENVOX_ASR_INSTANCE');if(_0x5633bf[_0x7b64('0xa5')]===-0x1){return _0x5633bf;}return this[_0x7b64('0x10')]['noop'](util[_0x7b64('0x29')](_0x7b64('0xce'),_0xbc6155));};AGIVertices['prototype'][_0x7b64('0xcf')]=function(_0x3f8728){logger[_0x7b64('0x2e')](util[_0x7b64('0x29')](_0x7b64('0xd0'),_0x3f8728[_0x7b64('0x38')]));if(!this[_0x7b64('0x82')](_0x3f8728[_0x7b64('0xb4')])){return this[_0x7b64('0x10')][_0x7b64('0xad')](_0x7b64('0xb3'));}var _0x5e1aa9=_0x3f8728['grammar'];if(this['isConfigured'](_0x3f8728[_0x7b64('0x73')])){_0x5e1aa9+=','+_0x3f8728[_0x7b64('0x73')];}var _0x1fa92a=this[_0x7b64('0x10')][_0x7b64('0xaf')]('MRCPRecog',_0x5e1aa9);if(_0x1fa92a[_0x7b64('0xa5')]===-0x1){return _0x1fa92a;}var _0x5948fa=this[_0x7b64('0xb6')](_0x7b64('0xb7'),_0x7b64('0xd1'));if(_0x5948fa['result']===-0x1){return _0x5948fa;}var _0x2ab919=this[_0x7b64('0xb6')](_0x7b64('0xb9'),_0x7b64('0xd2'));if(_0x2ab919[_0x7b64('0xa5')]===-0x1){return _0x2ab919;}var _0x41a860=this['getAndSetVariable'](_0x7b64('0xba'),'SESTEK_ASR_INSTANCE');if(_0x41a860[_0x7b64('0xa5')]===-0x1){return _0x41a860;}return this[_0x7b64('0x10')][_0x7b64('0xad')](util[_0x7b64('0x29')](_0x7b64('0xce'),_0x5e1aa9));};AGIVertices['prototype'][_0x7b64('0xd3')]=function(_0x5648f4){logger[_0x7b64('0x2e')](util[_0x7b64('0x29')](_0x7b64('0xd4'),_0x5648f4[_0x7b64('0x38')]));if(!this['isConfigured'](_0x5648f4[_0x7b64('0xd5')])){return this[_0x7b64('0x10')][_0x7b64('0x2c')](_0x5648f4,_0x7b64('0xd6'));}var _0x2b4570=this['getSquareOdbc'][_0x7b64('0xa9')](this,_0x5648f4[_0x7b64('0xd5')]);if(!_0x2b4570){return this[_0x7b64('0x10')]['error'](_0x5648f4,'no\x20odbc\x20database\x20found');}if(!this['isConfigured'](_0x5648f4[_0x7b64('0x30')])){return this[_0x7b64('0x10')][_0x7b64('0x2c')](_0x5648f4,_0x7b64('0xd7'));}var _0x5eddd8=_0x5648f4['query']['replace'](/(\r\n|\n|\r)/gm,'\x20');this[_0x7b64('0x10')]['noop'](util['format'](_0x7b64('0xd8'),_0x5eddd8));var _0x3455e2=this[_0x7b64('0x2b')][_0x7b64('0xa9')](this,_0x2b4570,_0x5eddd8);this[_0x7b64('0xa8')][_0x7b64('0xa9')](this,_0x5648f4,_0x5eddd8);if(!this[_0x7b64('0x82')](_0x5648f4[_0x7b64('0xd9')])){return this[_0x7b64('0x10')]['noop'](_0x7b64('0xda'));}var _0x48c575=this['getVariable'][_0x7b64('0xa9')](this,_0x5648f4['variable_id']);if(!_0x48c575){return this[_0x7b64('0x10')][_0x7b64('0x2c')](_0x5648f4,_0x7b64('0xdb'));}var _0x16b023=this;_0x3455e2[_0x7b64('0xdc')](function(_0x5b7091,_0x5c2235){Object[_0x7b64('0xdd')](_0x5b7091)[_0x7b64('0xdc')](function(_0x53fd8c){_0x16b023[_0x7b64('0x10')][_0x7b64('0xa0')](util[_0x7b64('0x29')](_0x7b64('0xde'),_0x48c575,_0x5c2235,_0x53fd8c),_0x5b7091[_0x53fd8c]);});});this[_0x7b64('0x10')]['setVariable'](util[_0x7b64('0x29')]('%s_ROWS_COUNT',_0x48c575),_0x3455e2[_0x7b64('0x9c')]);return this['channel']['noop'](util[_0x7b64('0x29')](_0x7b64('0xdf'),_0x48c575));};AGIVertices['prototype']['dial']=function(_0xc9fe3f){logger[_0x7b64('0xe0')](util[_0x7b64('0x29')](_0x7b64('0xe1'),_0xc9fe3f[_0x7b64('0x38')]));if(!this['isConfigured'](_0xc9fe3f[_0x7b64('0xe2')])){return this[_0x7b64('0x10')][_0x7b64('0x2c')](_0xc9fe3f,_0x7b64('0xe3'));}var _0x32d040=this[_0x7b64('0xe4')][_0x7b64('0xa9')](this,_0xc9fe3f[_0x7b64('0xe2')]);if(!_0x32d040){return this[_0x7b64('0x10')]['error'](_0xc9fe3f,'no\x20user\x20found');}var _0x52c8b8=this[_0x7b64('0x10')]['exec'](_0x7b64('0xe5'),[util[_0x7b64('0x29')](_0x7b64('0xe6'),_0x32d040),_0xc9fe3f[_0x7b64('0x63')],_0xc9fe3f[_0x7b64('0xe7')],_0xc9fe3f['url']]);if(_0x52c8b8[_0x7b64('0xa5')]===-0x1){return _0x52c8b8;}return this[_0x7b64('0x10')][_0x7b64('0xad')](util[_0x7b64('0x29')](_0x7b64('0xe8'),'DIAL'));};AGIVertices[_0x7b64('0x16')][_0x7b64('0xe9')]=function(_0x8fc78a){logger[_0x7b64('0x2e')](util[_0x7b64('0x29')](_0x7b64('0xea'),_0x8fc78a[_0x7b64('0x38')]));if(!this[_0x7b64('0x82')](_0x8fc78a[_0x7b64('0x75')])){return this[_0x7b64('0x10')]['noop'](_0x7b64('0xeb'));}if(!this[_0x7b64('0x82')](_0x8fc78a[_0x7b64('0x59')])){return this[_0x7b64('0x10')][_0x7b64('0xad')](_0x7b64('0xae'));}this[_0x7b64('0x10')][_0x7b64('0xec')]=!![];this['createSquareDetailsReport'](_0x8fc78a);this[_0x7b64('0x42')](_0x8fc78a[_0x7b64('0x59')],'in','','');this[_0x7b64('0x10')][_0x7b64('0xad')](util['format'](_0x7b64('0xed'),_0x8fc78a['text']));var _0x4a7a44=this['googleDialogflow']['sync'](this,_0x8fc78a);if(_0x4a7a44){for(var _0x2e46a3 in _0x4a7a44){if(_0x4a7a44['hasOwnProperty'](_0x2e46a3)){this[_0x7b64('0x10')][_0x7b64('0xa0')](util[_0x7b64('0x29')](_0x7b64('0xee'),_0x2e46a3[_0x7b64('0x66')]()),_0x4a7a44[_0x2e46a3]);}}this[_0x7b64('0x42')](_0x4a7a44[_0x7b64('0xef')],'out',_0x7b64('0xe9'),'');return this[_0x7b64('0x10')][_0x7b64('0xad')](util[_0x7b64('0x29')](_0x7b64('0xf0'),_0x4a7a44['speech']));}return this['channel']['error'](_0x8fc78a,_0x7b64('0xf1'));};AGIVertices['prototype'][_0x7b64('0xf2')]=function(_0x4f76d7){logger['info'](util[_0x7b64('0x29')](_0x7b64('0xf3'),_0x4f76d7[_0x7b64('0x38')]));if(!this[_0x7b64('0x82')](_0x4f76d7['dialogflowV2_project_id'])){return this[_0x7b64('0x10')][_0x7b64('0xad')](_0x7b64('0xf4'));}if(!this[_0x7b64('0x82')](_0x4f76d7[_0x7b64('0x79')])){return this['channel']['noop'](_0x7b64('0xf5'));}if(!this['isConfigured'](_0x4f76d7[_0x7b64('0xf6')])){return this[_0x7b64('0x10')][_0x7b64('0xad')](_0x7b64('0xf7'));}if(!this[_0x7b64('0x82')](_0x4f76d7[_0x7b64('0x7a')])){return this[_0x7b64('0x10')][_0x7b64('0xad')](_0x7b64('0xf8'));}if(!this[_0x7b64('0x82')](_0x4f76d7['text'])){return this[_0x7b64('0x10')][_0x7b64('0xad')]('no\x20text\x20configured');}this[_0x7b64('0x10')][_0x7b64('0xec')]=!![];this[_0x7b64('0xa8')](_0x4f76d7);this[_0x7b64('0x42')](_0x4f76d7['text'],'in','','');this[_0x7b64('0x10')][_0x7b64('0xad')](util[_0x7b64('0x29')](_0x7b64('0xf9'),_0x4f76d7[_0x7b64('0x59')]));var _0x165312=this['googleDialogflowV2'][_0x7b64('0xa9')](this,_0x4f76d7);if(_0x165312){for(var _0x148356 in _0x165312){if(_0x165312[_0x7b64('0x9a')](_0x148356)){if(_0x148356!==_0x7b64('0xfa')){this['channel']['setVariable'](util[_0x7b64('0x29')]('DIALOGFLOW_%s',_0x148356['toUpperCase']()),_0x165312[_0x148356]);}}}this[_0x7b64('0x42')](_0x165312['speech'],_0x7b64('0xfb'),'dialogflowV2',_0x165312[_0x7b64('0xfa')]);return this[_0x7b64('0x10')]['noop'](util['format'](_0x7b64('0xfc'),_0x165312[_0x7b64('0xef')]));}return this[_0x7b64('0x10')][_0x7b64('0x2c')](_0x4f76d7,_0x7b64('0xfd'));};AGIVertices[_0x7b64('0x16')][_0x7b64('0xfe')]=function(_0x2ae65){logger[_0x7b64('0x2e')](util[_0x7b64('0x29')]('Enter\x20in\x20SESTEKNDA\x20(%s)\x20block',_0x2ae65['label']));if(!this[_0x7b64('0x82')](_0x2ae65['ndauth_url'])){return this[_0x7b64('0x10')][_0x7b64('0xad')](_0x7b64('0xff'));}if(!this[_0x7b64('0x82')](_0x2ae65[_0x7b64('0x100')])){return this[_0x7b64('0x10')][_0x7b64('0xad')](_0x7b64('0x101'));}if(!this[_0x7b64('0x82')](_0x2ae65[_0x7b64('0x102')])){return this['channel'][_0x7b64('0xad')]('no\x20password\x20configured');}if(!this[_0x7b64('0x82')](_0x2ae65[_0x7b64('0x103')])){return this[_0x7b64('0x10')][_0x7b64('0xad')](_0x7b64('0xae'));}this[_0x7b64('0x10')][_0x7b64('0xec')]=!![];this['createSquareDetailsReport'](_0x2ae65);this[_0x7b64('0x42')](_0x2ae65[_0x7b64('0x59')],'in','','');this[_0x7b64('0x10')][_0x7b64('0xad')](util[_0x7b64('0x29')]('Trying\x20SestekNDA:\x20%s',_0x2ae65[_0x7b64('0x59')]));var _0x4383c7=this['sestekNDA'][_0x7b64('0xa9')](this,_0x2ae65);if(_0x4383c7){for(var _0x308483 in _0x4383c7){if(_0x4383c7[_0x7b64('0x9a')](_0x308483)){this[_0x7b64('0x10')][_0x7b64('0xa0')](util['format']('SESTEK_NDA_%s',_0x308483[_0x7b64('0x66')]()),_0x4383c7[_0x308483]);}}this[_0x7b64('0x42')](_0x4383c7[_0x7b64('0xef')],'out',_0x7b64('0xfe'),'');if(_0x4383c7['audiofile']){this['channel'][_0x7b64('0xad')](util[_0x7b64('0x29')](_0x7b64('0x104'),_0x4383c7[_0x7b64('0x105')]));var _0x59b911=this[_0x7b64('0x10')]['streamFile'](_0x4383c7[_0x7b64('0x105')]);try{fs[_0x7b64('0x106')](_0x4383c7[_0x7b64('0x105')]+_0x7b64('0x107'));}catch(_0xecfee2){logger[_0x7b64('0x2c')](_0xecfee2);}return _0x59b911;}else{return this[_0x7b64('0x10')][_0x7b64('0xad')](util[_0x7b64('0x29')](_0x7b64('0x108'),_0x4383c7['speech']));}}return this[_0x7b64('0x10')][_0x7b64('0x2c')](_0x2ae65,'SestekNDA\x20is\x20unreachable');};AGIVertices[_0x7b64('0x16')]['end']=function(_0x5089c1){logger[_0x7b64('0x2e')](util[_0x7b64('0x29')](_0x7b64('0x109'),_0x5089c1[_0x7b64('0x38')]));return this[_0x7b64('0x10')][_0x7b64('0xad')](_0x7b64('0x10a'));};AGIVertices[_0x7b64('0x16')][_0x7b64('0x10b')]=function(_0x4a2250){logger['info'](util[_0x7b64('0x29')]('Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block',_0x4a2250['label']));var _0x54d2a2='';if(_0x4a2250['trunk_id']){if(!this['isConfigured'](_0x4a2250[_0x7b64('0x10c')])){return this[_0x7b64('0x10')][_0x7b64('0x2c')](_0x4a2250,_0x7b64('0x10d'));}else{var _0x166b40=parseInt(_0x4a2250[_0x7b64('0x10c')],0xa);if(isNaN(_0x166b40)){_0x54d2a2=_0x4a2250['trunk_id'];}else{_0x54d2a2=this[_0x7b64('0x1e')]['sync'](this,_0x4a2250[_0x7b64('0x10c')]);if(!_0x54d2a2){return this[_0x7b64('0x10')][_0x7b64('0x2c')](_0x4a2250,_0x7b64('0x10e'));}}}}else if(_0x4a2250['trunk_name']){_0x54d2a2=_0x4a2250[_0x7b64('0x10f')];}else{return this[_0x7b64('0x10')][_0x7b64('0x2c')](_0x4a2250,_0x7b64('0x10d'));}var _0x155146=this[_0x7b64('0x10')][_0x7b64('0xaf')]('DIAL',[util[_0x7b64('0x29')](_0x7b64('0x110'),_0x54d2a2,_0x4a2250['phone']),_0x4a2250[_0x7b64('0x63')],_0x4a2250[_0x7b64('0xe7')],_0x4a2250[_0x7b64('0x60')]]);if(_0x155146[_0x7b64('0xa5')]===-0x1){return _0x155146;}return this[_0x7b64('0x10')]['noop'](util[_0x7b64('0x29')](_0x7b64('0xe8'),_0x7b64('0xe5')));};AGIVertices[_0x7b64('0x16')]['finally']=function(_0x491c5a){logger[_0x7b64('0x2e')](util['format']('Enter\x20in\x20FINALLY\x20(%s)\x20block',_0x491c5a[_0x7b64('0x38')]));return this['channel'][_0x7b64('0xad')](_0x7b64('0x111'));};AGIVertices[_0x7b64('0x16')][_0x7b64('0xe')]=function(_0x12274f){logger['info'](util[_0x7b64('0x29')](_0x7b64('0x112'),_0x12274f['label']));if(_0x12274f[_0x7b64('0xaa')]===0x0){return this[_0x7b64('0xa7')](_0x12274f);}_0x12274f[_0x7b64('0xaa')]-=0x1;if(!this[_0x7b64('0x82')](_0x12274f[_0x7b64('0x113')])){return this[_0x7b64('0x10')][_0x7b64('0x2c')](_0x12274f,_0x7b64('0x114'));}var _0x3a1911=this['getSound']['sync'](this,_0x12274f[_0x7b64('0x113')]);if(!_0x3a1911){return this[_0x7b64('0x10')][_0x7b64('0x2c')](_0x12274f,_0x7b64('0x115'));}if(!this[_0x7b64('0x82')](_0x12274f[_0x7b64('0xd9')])){return this[_0x7b64('0x10')][_0x7b64('0x2c')](_0x7b64('0xda'));}var _0x104b5e=this[_0x7b64('0x10')][_0x7b64('0x116')](_0x3a1911,_0x12274f[_0x7b64('0x117')],_0x12274f['maxdigit']);var _0x132d2a=_0x104b5e[_0x7b64('0xa5')]?_0x104b5e[_0x7b64('0xa5')][_0x7b64('0xa3')]():'';logger[_0x7b64('0x2e')](_0x7b64('0x118'),JSON[_0x7b64('0x6d')](_0x104b5e));if(_0x104b5e['result']===-0x1){this[_0x7b64('0xa8')][_0x7b64('0xa9')](this,_0x12274f,_0x132d2a);return _0x104b5e;}else if(_0x104b5e[_0x7b64('0xa6')]===_0x7b64('0x63')){_0x104b5e[_0x7b64('0xa5')]=_0x132d2a['length']>=parseInt(_0x12274f[_0x7b64('0x119')])?'x':'i';}else{_0x104b5e['result']=_0x132d2a[_0x7b64('0x9c')]>=parseInt(_0x12274f[_0x7b64('0x119')])&&_0x132d2a['length']<=parseInt(_0x12274f['maxdigit'])?'x':'i';}var _0x5c92dd=this['getVariable'][_0x7b64('0xa9')](this,_0x12274f[_0x7b64('0xd9')]);if(!_0x5c92dd){return this['channel'][_0x7b64('0x2c')](_0x12274f,_0x7b64('0xdb'));}this[_0x7b64('0x10')][_0x7b64('0xa0')](_0x5c92dd,_0x132d2a);if(this[_0x7b64('0x82')](_0x12274f[_0x7b64('0x11a')])){var _0x14690d=parseInt(_0x12274f[_0x7b64('0x11a')],0xa);var _0xebdeda=rs['generate']({'charset':'*','length':_0x14690d});var _0x29cab3=_0x132d2a[_0x7b64('0x9c')];if(_0x29cab3>0x0){if(_0x29cab3>_0x14690d){this[_0x7b64('0xa8')][_0x7b64('0xa9')](this,_0x12274f,_0x12274f['hiddendigitspos']==='first'?_0xebdeda+_0x132d2a[_0x7b64('0x11b')](_0x14690d):_0x132d2a['substr'](0x0,_0x29cab3-_0x14690d)+_0xebdeda);}else{this['createSquareDetailsReport'][_0x7b64('0xa9')](this,_0x12274f,rs[_0x7b64('0x11c')]({'charset':'*','length':_0x29cab3}));}}else{this[_0x7b64('0xa8')][_0x7b64('0xa9')](this,_0x12274f,'');}}else{this['createSquareDetailsReport'][_0x7b64('0xa9')](this,_0x12274f,_0x132d2a);}return _0x104b5e;};AGIVertices[_0x7b64('0x16')]['getsecretdigits']=function(_0x535aba){logger[_0x7b64('0x2e')](util['format'](_0x7b64('0x11d'),_0x535aba[_0x7b64('0x38')]));return this[_0x7b64('0xe')](_0x535aba);};AGIVertices[_0x7b64('0x16')][_0x7b64('0x11e')]=function(_0x4e5824){logger[_0x7b64('0x2e')](util['format']('Enter\x20in\x20GOAL\x20(%s)\x20block',_0x4e5824[_0x7b64('0x38')]));this[_0x7b64('0xa8')][_0x7b64('0xa9')](this,_0x4e5824,_0x4e5824[_0x7b64('0x11f')]);return this[_0x7b64('0x10')][_0x7b64('0xad')](util['format'](_0x7b64('0x120'),_0x4e5824[_0x7b64('0x11f')]));};AGIVertices[_0x7b64('0x16')][_0x7b64('0x121')]=function(_0x19cb0d){logger[_0x7b64('0x2e')](util['format'](_0x7b64('0x122'),_0x19cb0d['label']));if(!this[_0x7b64('0x82')](_0x19cb0d[_0x7b64('0x85')])||!this['isConfigured'](_0x19cb0d[_0x7b64('0x86')])){return this[_0x7b64('0x10')][_0x7b64('0xad')]('no\x20valid\x20credentials\x20configured');}if(!this[_0x7b64('0x82')](_0x19cb0d[_0x7b64('0x59')])){return this['channel']['noop']('no\x20text\x20configured');}this[_0x7b64('0x10')][_0x7b64('0xad')](util['format'](_0x7b64('0x123'),_0x19cb0d['text']));var _0x5eb4b2=this[_0x7b64('0x84')][_0x7b64('0xa9')](this,_0x19cb0d);if(_0x5eb4b2){this[_0x7b64('0x10')][_0x7b64('0xad')](util[_0x7b64('0x29')]('aws\x20Polly\x20%s\x20file\x20created',_0x5eb4b2));var _0x4a6a20=this[_0x7b64('0x10')][_0x7b64('0x124')](_0x5eb4b2);try{fs[_0x7b64('0x106')](_0x5eb4b2+_0x7b64('0x107'));}catch(_0x479ffb){logger['error'](_0x479ffb);}return _0x4a6a20;}return this['channel'][_0x7b64('0x2c')](_0x19cb0d,_0x7b64('0x125'));};AGIVertices[_0x7b64('0x16')][_0x7b64('0x126')]=function(_0x6bd02f){logger[_0x7b64('0x2e')](util[_0x7b64('0x29')](_0x7b64('0x127'),_0x6bd02f[_0x7b64('0x38')]));if(!this[_0x7b64('0x82')](_0x6bd02f['aws_access_key_id'])||!this['isConfigured'](_0x6bd02f[_0x7b64('0x86')])){return this['channel']['noop'](_0x7b64('0x128'));}if(!this['isConfigured'](_0x6bd02f[_0x7b64('0x8d')])){return this[_0x7b64('0x10')][_0x7b64('0xad')](_0x7b64('0x129'));}if(!this['isConfigured'](_0x6bd02f[_0x7b64('0x59')])){return this[_0x7b64('0x10')][_0x7b64('0xad')]('no\x20text\x20configured');}this[_0x7b64('0x10')][_0x7b64('0xec')]=!![];this[_0x7b64('0xa8')](_0x6bd02f);this['createSquareMessage'](_0x6bd02f[_0x7b64('0x59')],'in','','');this[_0x7b64('0x10')][_0x7b64('0xad')](util['format'](_0x7b64('0x12a'),_0x6bd02f['text']));var _0x533940=this[_0x7b64('0x8b')][_0x7b64('0xa9')](this,_0x6bd02f);if(_0x533940){for(var _0x40e194 in _0x533940){if(_0x533940['hasOwnProperty'](_0x40e194)&&_[_0x7b64('0x95')](_0x533940[_0x40e194])){this[_0x7b64('0x10')][_0x7b64('0xa0')](util[_0x7b64('0x29')](_0x7b64('0x12b'),_0x40e194['toUpperCase']()),_0x533940[_0x40e194]);}}if(_['isNil'](_0x533940[_0x7b64('0x71')])){return this[_0x7b64('0x10')]['noop']('Amazon\x20Lex\x20ready\x20for\x20fulfillment');}else{this[_0x7b64('0x42')](_0x533940[_0x7b64('0x71')],_0x7b64('0xfb'),'amazonlex','');return this[_0x7b64('0x10')]['noop'](util['format']('Amazon\x20Lex\x20Result\x20%s',_0x533940[_0x7b64('0x71')]));}}return this[_0x7b64('0x10')]['error'](_0x6bd02f,_0x7b64('0x12c'));};AGIVertices[_0x7b64('0x16')][_0x7b64('0x12d')]=function(_0x134981){logger['info'](util[_0x7b64('0x29')]('Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s',_0x134981[_0x7b64('0x38')],_0x134981[_0x7b64('0x63')]));if(!this['isConfigured'](_0x134981['key'])){return this[_0x7b64('0x10')][_0x7b64('0xad')]('no\x20key\x20configured');}var _0x4d8d69=_0x7b64('0x12e');var _0x2ce963=util['format']('%s/recordings/%s',FILES_PATH,rs['generate'](0x4));var _0x1eed06=util['format'](_0x7b64('0x9f'),_0x2ce963,_0x4d8d69);var _0x32b3b6=!![];if(_0x134981[_0x7b64('0x12f')]===_0x7b64('0x130')){_0x32b3b6=![];}var _0x33dfe3=this['channel'][_0x7b64('0x131')](_0x2ce963,_0x4d8d69,_0x134981[_0x7b64('0x132')],_0x134981[_0x7b64('0x63')],undefined,_0x32b3b6);if(_0x33dfe3[_0x7b64('0xa5')]!==-0x1){this[_0x7b64('0x10')][_0x7b64('0xad')](util[_0x7b64('0x29')](_0x7b64('0x133'),_0x1eed06));var _0x2e6d30=this[_0x7b64('0x8e')]['sync'](this,_0x134981,_0x1eed06);if(_0x2e6d30){for(var _0x5a3e3b in _0x2e6d30){if(_0x2e6d30[_0x7b64('0x9a')](_0x5a3e3b)){this[_0x7b64('0x10')]['setVariable'](util[_0x7b64('0x29')]('GOOGLE_ASR_%s',_0x5a3e3b[_0x7b64('0x66')]()),_0x2e6d30[_0x5a3e3b]);}}return this[_0x7b64('0x10')][_0x7b64('0xad')](util[_0x7b64('0x29')](_0x7b64('0x134'),JSON[_0x7b64('0x6d')](_0x2e6d30)));}}return _0x33dfe3;};AGIVertices[_0x7b64('0x16')][_0x7b64('0x135')]=function(_0x1b0a69){logger[_0x7b64('0x2e')](util[_0x7b64('0x29')](_0x7b64('0x136'),_0x1b0a69['label']));if(!this[_0x7b64('0x82')](_0x1b0a69[_0x7b64('0x91')])){return this[_0x7b64('0x10')][_0x7b64('0xad')](_0x7b64('0x137'));}if(!this[_0x7b64('0x82')](_0x1b0a69[_0x7b64('0x138')])){return this[_0x7b64('0x10')][_0x7b64('0xad')](_0x7b64('0x139'));}var _0x342a12=_0x7b64('0x12e');var _0x4916dc=util[_0x7b64('0x29')](_0x7b64('0x13a'),FILES_PATH,rs[_0x7b64('0x11c')](0x4));var _0x36ab58=util[_0x7b64('0x29')](_0x7b64('0x9f'),_0x4916dc,_0x342a12);var _0x4f9da6=!![];if(_0x1b0a69[_0x7b64('0x12f')]===_0x7b64('0x130')){_0x4f9da6=![];}var _0x120a65=this[_0x7b64('0x10')][_0x7b64('0x131')](_0x4916dc,_0x342a12,_0x1b0a69[_0x7b64('0x132')],_0x1b0a69[_0x7b64('0x63')],undefined,_0x4f9da6);if(_0x120a65[_0x7b64('0xa5')]!==-0x1){this[_0x7b64('0x10')][_0x7b64('0xad')](util['format'](_0x7b64('0x13b'),_0x36ab58));var _0x2e8f75=this[_0x7b64('0x90')][_0x7b64('0xa9')](this,_0x1b0a69,_0x36ab58);if(_0x2e8f75){for(var _0x21b575 in _0x2e8f75){if(_0x2e8f75['hasOwnProperty'](_0x21b575)){this['channel'][_0x7b64('0xa0')](util['format'](_0x7b64('0x13c'),_0x21b575[_0x7b64('0x66')]()),_0x2e8f75[_0x21b575]);}}return this['channel']['noop'](util[_0x7b64('0x29')](_0x7b64('0x13d'),JSON[_0x7b64('0x6d')](_0x2e8f75)));}}return _0x120a65;};AGIVertices[_0x7b64('0x16')][_0x7b64('0x13e')]=function(_0x1d65da){logger[_0x7b64('0x2e')](util[_0x7b64('0x29')](_0x7b64('0x13f'),_0x1d65da[_0x7b64('0x38')]));return this[_0x7b64('0x10')][_0x7b64('0x140')](_0x1d65da[_0x7b64('0x3d')],_0x1d65da[_0x7b64('0x3e')],_0x1d65da[_0x7b64('0x3f')]);};AGIVertices[_0x7b64('0x16')][_0x7b64('0x141')]=function(_0x4341ed){logger[_0x7b64('0x2e')](util['format'](_0x7b64('0x142'),_0x4341ed[_0x7b64('0x38')]));if(!this[_0x7b64('0x82')](_0x4341ed[_0x7b64('0x143')])){return this[_0x7b64('0x10')]['error'](_0x4341ed,_0x7b64('0x144'));}try{var _0x5181f0=eval(_0x4341ed['condition'])?'true':'false';this[_0x7b64('0x10')][_0x7b64('0xad')](util[_0x7b64('0x29')]('EVAL\x20CONDITION\x20%s\x20%s',_0x4341ed['condition'],_0x5181f0));return{'code':0xc8,'result':_0x5181f0};}catch(_0x5d22fd){return{'code':0xc8,'result':_0x7b64('0x145')};}};AGIVertices[_0x7b64('0x16')]['gotoiftime']=function(_0x4ad1a8){logger[_0x7b64('0x2e')](util[_0x7b64('0x29')](_0x7b64('0x146'),_0x4ad1a8[_0x7b64('0x38')]));if(!this[_0x7b64('0x82')](_0x4ad1a8[_0x7b64('0x147')])){return this[_0x7b64('0x10')][_0x7b64('0x2c')](_0x4ad1a8,_0x7b64('0x148'));}var _0x137900=this[_0x7b64('0x25')][_0x7b64('0xa9')](this,_0x4ad1a8[_0x7b64('0x147')]);if(!_0x137900){return this[_0x7b64('0x10')][_0x7b64('0x2c')](_0x4ad1a8,'no\x20intervals\x20found');}for(var _0x45516b=0x0;_0x45516b<_0x137900[_0x7b64('0x9c')];_0x45516b+=0x1){var _0x2331a4=this[_0x7b64('0x10')][_0x7b64('0xa4')](util['format'](_0x7b64('0x149'),_0x137900[_0x45516b]));if(_0x2331a4[_0x7b64('0xa5')]===-0x1){return _0x2331a4;}logger['info'](util['format']('IFTIME\x20%s\x20%s',_0x137900[_0x45516b],_0x2331a4[_0x7b64('0xa6')]));if(_0x2331a4[_0x7b64('0xa6')]===_0x7b64('0x14a')){logger[_0x7b64('0x2e')](util[_0x7b64('0x29')](_0x7b64('0x14b'),_0x137900[_0x45516b],_0x7b64('0x14a')));this[_0x7b64('0x10')][_0x7b64('0xad')](util[_0x7b64('0x29')](_0x7b64('0x14b'),_0x137900[_0x45516b],_0x7b64('0x14a')));return{'code':0xc8,'result':_0x7b64('0x14a')};}else{logger[_0x7b64('0x2e')](util[_0x7b64('0x29')](_0x7b64('0x14b'),_0x137900[_0x45516b],'false'));this[_0x7b64('0x10')]['noop'](util[_0x7b64('0x29')](_0x7b64('0x14b'),_0x137900[_0x45516b],_0x7b64('0x145')));}}return{'code':0xc8,'result':_0x7b64('0x145')};};AGIVertices[_0x7b64('0x16')][_0x7b64('0x14c')]=function(_0x58aa62){logger[_0x7b64('0x2e')](util[_0x7b64('0x29')](_0x7b64('0x14d'),_0x58aa62['label']));return this['channel']['hangup']();};AGIVertices[_0x7b64('0x16')][_0x7b64('0x14e')]=function(_0x4ee634){logger[_0x7b64('0x2e')](util[_0x7b64('0x29')](_0x7b64('0x14f'),_0x4ee634[_0x7b64('0x38')]));if(!this[_0x7b64('0x82')](_0x4ee634[_0x7b64('0x75')])){return this[_0x7b64('0x10')]['noop'](_0x7b64('0xeb'));}var _0x2a13f9=_0x7b64('0x12e');var _0x21752f=util[_0x7b64('0x29')](_0x7b64('0x13a'),FILES_PATH,rs['generate'](0x4));var _0x31dcd2=util[_0x7b64('0x29')](_0x7b64('0x9f'),_0x21752f,_0x2a13f9);var _0x44e0ae=!![];if(_0x4ee634[_0x7b64('0x12f')]===_0x7b64('0x130')){_0x44e0ae=![];}var _0x28ab50=this[_0x7b64('0x10')][_0x7b64('0x131')](_0x21752f,_0x2a13f9,_0x4ee634[_0x7b64('0x132')],_0x4ee634[_0x7b64('0x63')],undefined,_0x44e0ae);if(_0x28ab50[_0x7b64('0xa5')]!==-0x1){this['channel']['noop'](util['format'](_0x7b64('0x150'),_0x31dcd2));var _0x1340e6=this[_0x7b64('0x80')][_0x7b64('0xa9')](this,_0x4ee634,_0x31dcd2);if(_0x1340e6){for(var _0x5134f3 in _0x1340e6){if(_0x1340e6[_0x7b64('0x9a')](_0x5134f3)){this[_0x7b64('0x10')]['setVariable'](util[_0x7b64('0x29')]('ISPEECH_ASR_%s',_0x5134f3[_0x7b64('0x66')]()),_0x1340e6[_0x5134f3]);}}return this[_0x7b64('0x10')][_0x7b64('0xad')](util['format']('IspeechASR\x20Result\x20%s',JSON[_0x7b64('0x6d')](_0x1340e6)));}}return _0x28ab50;};AGIVertices[_0x7b64('0x16')][_0x7b64('0x151')]=function(_0x19c83a){logger['info'](util[_0x7b64('0x29')](_0x7b64('0x152'),_0x19c83a[_0x7b64('0x38')]));if(!this[_0x7b64('0x82')](_0x19c83a[_0x7b64('0x75')])){return this[_0x7b64('0x10')][_0x7b64('0xad')](_0x7b64('0xeb'));}if(!this['isConfigured'](_0x19c83a[_0x7b64('0x59')])){return this[_0x7b64('0x10')][_0x7b64('0xad')](_0x7b64('0xae'));}this[_0x7b64('0x10')]['noop'](util[_0x7b64('0x29')](_0x7b64('0x153'),_0x19c83a[_0x7b64('0x59')]));var _0x1f7e21=this[_0x7b64('0x7c')][_0x7b64('0xa9')](this,_0x19c83a);if(_0x1f7e21){this['channel'][_0x7b64('0xad')](util[_0x7b64('0x29')]('ispeech\x20%s\x20file\x20created',_0x1f7e21));var _0x36ec06=this['channel'][_0x7b64('0x124')](_0x1f7e21,_0x19c83a['intKey']);try{fs[_0x7b64('0x106')](_0x1f7e21+'.wav');}catch(_0x1fb44b){logger['error'](_0x1fb44b);}return _0x36ec06;}return this[_0x7b64('0x10')][_0x7b64('0x2c')](_0x19c83a,_0x7b64('0x154'));};AGIVertices[_0x7b64('0x16')][_0x7b64('0x155')]=function(_0x32cb74){logger[_0x7b64('0x2e')](util[_0x7b64('0x29')](_0x7b64('0x156'),_0x32cb74[_0x7b64('0x38')]));if(!this[_0x7b64('0x82')](_0x32cb74['findBy'])){return this[_0x7b64('0x10')][_0x7b64('0x2c')](_0x32cb74,'no\x20find\x20by\x20configured');}logger[_0x7b64('0x2e')](util[_0x7b64('0x29')](_0x7b64('0x157'),this[_0x7b64('0x10')]['callerid'],_0x32cb74[_0x7b64('0x158')]));var _0xa3c52=this[_0x7b64('0x52')][_0x7b64('0xa9')](this,_0x32cb74['findBy']);if(_0xa3c52){logger['info'](util['format'](_0x7b64('0x159'),this[_0x7b64('0x10')][_0x7b64('0x3a')],_0x32cb74['findBy']));this[_0x7b64('0x10')]['noop'](util[_0x7b64('0x29')](_0x7b64('0x159'),this[_0x7b64('0x10')][_0x7b64('0x3a')],_0x32cb74[_0x7b64('0x158')]));return{'code':0xc8,'result':_0x7b64('0x15a')};}else{logger[_0x7b64('0x2e')](util['format'](_0x7b64('0x15b'),this[_0x7b64('0x10')][_0x7b64('0x3a')],_0x32cb74[_0x7b64('0x158')]));this[_0x7b64('0x10')]['noop'](util['format'](_0x7b64('0x15b'),this[_0x7b64('0x10')][_0x7b64('0x3a')],_0x32cb74[_0x7b64('0x158')]));return{'code':0xc8,'result':_0x7b64('0x15c')};}};AGIVertices[_0x7b64('0x16')][_0x7b64('0x15d')]=function(_0x44146d){logger[_0x7b64('0x2e')](util[_0x7b64('0x29')](_0x7b64('0x15e'),_0x44146d[_0x7b64('0x38')]));if(!this['isConfigured'](_0x44146d[_0x7b64('0x158')])){return this[_0x7b64('0x10')]['error'](_0x44146d,_0x7b64('0x15f'));}logger[_0x7b64('0x2e')](util[_0x7b64('0x29')](_0x7b64('0x157'),this[_0x7b64('0x10')][_0x7b64('0x3a')],_0x44146d[_0x7b64('0x158')]));var _0x237891=this[_0x7b64('0x51')][_0x7b64('0xa9')](this,_0x44146d['findBy']);if(_0x237891){logger[_0x7b64('0x2e')](util['format'](_0x7b64('0x159'),this[_0x7b64('0x10')]['callerid'],_0x44146d[_0x7b64('0x158')]));this[_0x7b64('0x10')]['noop'](util['format'](_0x7b64('0x159'),this[_0x7b64('0x10')][_0x7b64('0x3a')],_0x44146d['findBy']));return{'code':0xc8,'result':_0x7b64('0x15a')};}else{logger['info'](util[_0x7b64('0x29')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x7b64('0x10')]['callerid'],_0x44146d['findBy']));this[_0x7b64('0x10')][_0x7b64('0xad')](util[_0x7b64('0x29')](_0x7b64('0x15b'),this[_0x7b64('0x10')][_0x7b64('0x3a')],_0x44146d['findBy']));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x7b64('0x16')][_0x7b64('0x160')]=function(_0x560152){logger['info'](util[_0x7b64('0x29')]('Enter\x20in\x20MATH\x20(%s)\x20block',_0x560152['label']));if(!this[_0x7b64('0x82')](_0x560152[_0x7b64('0x161')])){return this[_0x7b64('0x10')][_0x7b64('0x2c')](_0x560152,'no\x20operation\x20configured');}this[_0x7b64('0x10')]['noop'](util[_0x7b64('0x29')](_0x7b64('0x162'),_0x560152[_0x7b64('0x161')]));var _0x517a79=eval(_0x560152[_0x7b64('0x161')]);if(!this[_0x7b64('0x82')](_0x560152[_0x7b64('0xd9')])){return this[_0x7b64('0x10')]['noop'](_0x7b64('0xda'));}var _0xdb98f3=this['getVariable'][_0x7b64('0xa9')](this,_0x560152[_0x7b64('0xd9')]);if(!_0xdb98f3){return this['channel'][_0x7b64('0x2c')](_0x560152,_0x7b64('0xdb'));}if(_[_0x7b64('0x9b')](_0x517a79)){var _0x54ff27=this;_0x517a79[_0x7b64('0xdc')](function(_0x4dfed7,_0x325235){_0x54ff27['channel'][_0x7b64('0xa0')](util[_0x7b64('0x29')](_0x7b64('0x163'),_0xdb98f3,_0x325235),_0x4dfed7);});return this[_0x7b64('0x10')][_0x7b64('0xad')](util[_0x7b64('0x29')](_0x7b64('0x164'),_0xdb98f3));}else{return this[_0x7b64('0x10')][_0x7b64('0xa0')](_0xdb98f3,_0x517a79);}};AGIVertices[_0x7b64('0x16')][_0x7b64('0xd')]=function(_0x40d0cc){logger[_0x7b64('0x2e')](util['format'](_0x7b64('0x165'),_0x40d0cc[_0x7b64('0x38')]));if(_0x40d0cc[_0x7b64('0xaa')]===0x0){return this[_0x7b64('0xa7')](_0x40d0cc);}_0x40d0cc[_0x7b64('0xaa')]-=0x1;if(!this['isConfigured'](_0x40d0cc[_0x7b64('0x113')])){return this[_0x7b64('0x10')][_0x7b64('0x2c')](_0x40d0cc,_0x7b64('0x114'));}var _0x35aa14=this[_0x7b64('0x166')][_0x7b64('0xa9')](this,_0x40d0cc[_0x7b64('0x113')]);if(!_0x35aa14){return this['channel'][_0x7b64('0x2c')](_0x40d0cc,'no\x20file\x20audio\x20found');}var _0x82915b=this[_0x7b64('0x10')][_0x7b64('0x116')](_0x35aa14,_0x40d0cc[_0x7b64('0x117')],_0x40d0cc[_0x7b64('0x167')]);var _0xe51ed8=_0x82915b['result'];if(_0x82915b[_0x7b64('0xa5')]===-0x1){this['createSquareDetailsReport'][_0x7b64('0xa9')](this,_0x40d0cc,'-1');return _0x82915b;}else if(_0x82915b['extra']===_0x7b64('0x63')){_0x82915b[_0x7b64('0xa5')]=_0x82915b[_0x7b64('0xa5')][_0x7b64('0x9c')]>0x0?_0x82915b[_0x7b64('0xa5')]:'t';}else if(_[_0x7b64('0x44')](_0x82915b[_0x7b64('0xa5')])){_0x82915b[_0x7b64('0xa5')]='#';_0xe51ed8='#';}if(!this[_0x7b64('0x82')](_0x40d0cc['variable_id'])){this[_0x7b64('0x10')][_0x7b64('0xad')]('no\x20variable\x20selected\x20for\x20the\x20result');}else{var _0x43a841=this[_0x7b64('0xa4')][_0x7b64('0xa9')](this,_0x40d0cc[_0x7b64('0xd9')]);if(!_0x43a841){return this[_0x7b64('0x10')][_0x7b64('0x2c')](_0x40d0cc,_0x7b64('0xdb'));}this[_0x7b64('0x10')][_0x7b64('0xa0')](_0x43a841,_0xe51ed8);}this[_0x7b64('0xa8')][_0x7b64('0xa9')](this,_0x40d0cc,_0xe51ed8);return _0x82915b;};AGIVertices[_0x7b64('0x16')]['noop']=function(_0x360e5e){logger[_0x7b64('0x2e')](util[_0x7b64('0x29')]('Enter\x20in\x20NOOP\x20(%s)\x20block',_0x360e5e[_0x7b64('0x38')]));return this[_0x7b64('0x10')]['noop'](_0x360e5e[_0x7b64('0x168')]||_0x360e5e[_0x7b64('0x38')]);};AGIVertices[_0x7b64('0x16')][_0x7b64('0x169')]=function(_0x3b0d67){logger[_0x7b64('0x2e')](util[_0x7b64('0x29')](_0x7b64('0x16a'),_0x3b0d67[_0x7b64('0x38')]));if(!this[_0x7b64('0x82')](_0x3b0d67['findBy'])){return this[_0x7b64('0x10')]['error'](_0x3b0d67,_0x7b64('0x15f'));}logger[_0x7b64('0x2e')](util[_0x7b64('0x29')](_0x7b64('0x157'),this[_0x7b64('0x10')]['callerid'],_0x3b0d67['findBy']));var _0x453cc6=this[_0x7b64('0x4d')]['sync'](this,_0x3b0d67[_0x7b64('0x16b')]);var _0x406309=this[_0x7b64('0x4e')][_0x7b64('0xa9')](this,_0x3b0d67[_0x7b64('0x158')],_0x453cc6);if(_0x406309){logger[_0x7b64('0x2e')](util[_0x7b64('0x29')](_0x7b64('0x159'),this[_0x7b64('0x10')][_0x7b64('0x3a')],_0x3b0d67[_0x7b64('0x158')]));this[_0x7b64('0x10')][_0x7b64('0xad')](util[_0x7b64('0x29')](_0x7b64('0x159'),this[_0x7b64('0x10')][_0x7b64('0x3a')],_0x3b0d67[_0x7b64('0x158')]));return{'code':0xc8,'result':_0x7b64('0x15a')};}else{logger[_0x7b64('0x2e')](util[_0x7b64('0x29')](_0x7b64('0x15b'),this[_0x7b64('0x10')][_0x7b64('0x3a')],_0x3b0d67[_0x7b64('0x158')]));this['channel'][_0x7b64('0xad')](util[_0x7b64('0x29')](_0x7b64('0x159'),this['channel'][_0x7b64('0x3a')],_0x3b0d67['findBy']));return{'code':0xc8,'result':_0x7b64('0x15c')};}};AGIVertices[_0x7b64('0x16')][_0x7b64('0x16c')]=function(_0x3f32ff){logger[_0x7b64('0x2e')](util[_0x7b64('0x29')]('Enter\x20in\x20PLAYBACK\x20(%s)\x20block',_0x3f32ff['label']));if(!this[_0x7b64('0x82')](_0x3f32ff[_0x7b64('0x113')])){return this[_0x7b64('0x10')][_0x7b64('0x2c')](_0x3f32ff,_0x7b64('0x114'));}var _0x2031b7=this[_0x7b64('0x166')][_0x7b64('0xa9')](this,_0x3f32ff[_0x7b64('0x113')]);if(!_0x2031b7){return this[_0x7b64('0x10')][_0x7b64('0x2c')](_0x3f32ff,_0x7b64('0x115'));}var _0x521030=this[_0x7b64('0x10')][_0x7b64('0xaf')](_0x7b64('0x16d'),[_0x2031b7,_0x3f32ff[_0x7b64('0xe7')]]);if(_0x521030['result']===-0x1){return _0x521030;}return this[_0x7b64('0x10')][_0x7b64('0xad')](util[_0x7b64('0x29')]('Executed\x20command\x20%s\x20%s','PLAYBACK',_0x2031b7));};AGIVertices[_0x7b64('0x16')][_0x7b64('0x16e')]=function(_0x845e8d){logger[_0x7b64('0x2e')](util[_0x7b64('0x29')](_0x7b64('0x16f'),_0x845e8d[_0x7b64('0x38')]));if(!this[_0x7b64('0x82')](_0x845e8d[_0x7b64('0x170')])){return this[_0x7b64('0x10')][_0x7b64('0x2c')](_0x845e8d,_0x7b64('0x171'));}var _0x3f18dd='';var _0x393591=parseInt(_0x845e8d['queue_id'],0xa);if(isNaN(_0x393591)){_0x3f18dd=_0x845e8d[_0x7b64('0x170')];}else{_0x3f18dd=this[_0x7b64('0x172')]['sync'](this,_0x845e8d[_0x7b64('0x170')]);if(!_0x3f18dd){return this[_0x7b64('0x10')][_0x7b64('0x2c')](_0x845e8d,_0x7b64('0x173'));}}var _0x1437a7='';if(this[_0x7b64('0x82')](_0x845e8d[_0x7b64('0x113')])){var _0x376a55=this[_0x7b64('0x166')]['sync'](this,_0x845e8d[_0x7b64('0x113')]);if(_0x376a55){_0x1437a7=_0x376a55;}}this[_0x7b64('0xa8')][_0x7b64('0xa9')](this,_0x845e8d,_0x3f18dd);if(_0x845e8d[_0x7b64('0xe7')][_0x7b64('0x174')]('x')<0x0){_0x845e8d[_0x7b64('0xe7')]+='x';}if(_0x845e8d[_0x7b64('0xe7')][_0x7b64('0x174')]('X')<0x0){_0x845e8d[_0x7b64('0xe7')]+='X';}this[_0x7b64('0x10')][_0x7b64('0xa0')]('XMCS-QUEUE',_0x3f18dd?_0x3f18dd[_0x7b64('0x175')]():'');var _0x1b7471=this[_0x7b64('0x10')]['exec'](_0x7b64('0x176'),[_0x3f18dd,_0x845e8d[_0x7b64('0xe7')],_0x845e8d[_0x7b64('0x60')],_0x1437a7,_0x845e8d[_0x7b64('0x63')],_0x845e8d[_0x7b64('0x8')],_0x845e8d[_0x7b64('0x177')],_0x845e8d[_0x7b64('0x178')],'',_0x845e8d[_0x7b64('0x179')]]);if(_0x1b7471[_0x7b64('0xa5')]===-0x1){return _0x1b7471;}return this['channel'][_0x7b64('0xad')](util[_0x7b64('0x29')]('Executed\x20command\x20%s\x20%s',_0x7b64('0x176'),_0x3f18dd));};AGIVertices[_0x7b64('0x16')][_0x7b64('0x17a')]=function(_0x4943e1){logger['info'](util[_0x7b64('0x29')]('Enter\x20in\x20RECORD\x20(%s)\x20block',_0x4943e1['label']));var _0x408f5c=_0x4943e1[_0x7b64('0x17b')]||_0x7b64('0x12e');var _0x5d17e8=util[_0x7b64('0x29')](_0x7b64('0x17c'),this[_0x7b64('0x10')][_0x7b64('0x37')],rs[_0x7b64('0x11c')](0x5));var _0xfab296=util[_0x7b64('0x29')]('%s/recordings/%s.%s',FILES_PATH,_0x5d17e8,_0x408f5c);var _0x698637=util[_0x7b64('0x29')]('%s/recordings/%s',FILES_PATH,_0x5d17e8);this[_0x7b64('0x3b')]['sync'](this,_0x4943e1,_0x5d17e8,_0xfab296);this[_0x7b64('0x10')][_0x7b64('0xa0')](_0x7b64('0x17d'),_0x5d17e8);logger[_0x7b64('0x2e')](_0x7b64('0x17e'),_0x698637,_0x408f5c,_0x4943e1[_0x7b64('0x17f')],_0x4943e1['timeout']);return this[_0x7b64('0x10')][_0x7b64('0x131')](_0x698637,_0x408f5c,_0x4943e1['escape_digits'],_0x4943e1[_0x7b64('0x63')],undefined,!![]);};AGIVertices[_0x7b64('0x16')][_0x7b64('0x180')]=function(_0x1e9b5b){logger[_0x7b64('0x2e')](util[_0x7b64('0x29')](_0x7b64('0x181'),_0x1e9b5b[_0x7b64('0x38')]));if(!this[_0x7b64('0x82')](_0x1e9b5b['url'])){return this[_0x7b64('0x10')]['noop'](_0x7b64('0x182'));}var _0x3cd531=this['restAPI'][_0x7b64('0xa9')](this,_0x1e9b5b);logger[_0x7b64('0x2e')](util[_0x7b64('0x29')](_0x7b64('0x183'),util[_0x7b64('0x184')](_0x3cd531,{'showHidden':![],'depth':null})));if(!this[_0x7b64('0x82')](_0x1e9b5b[_0x7b64('0xd9')])){return this['channel'][_0x7b64('0xad')]('no\x20variable\x20selected\x20for\x20the\x20response');}var _0x5a7fcb=this[_0x7b64('0xa4')][_0x7b64('0xa9')](this,_0x1e9b5b['variable_id']);if(!_0x5a7fcb){return this[_0x7b64('0x10')]['error'](_0x1e9b5b,_0x7b64('0xdb'));}this['channel']['setVariable'](util[_0x7b64('0x29')](_0x7b64('0x185'),_0x5a7fcb),_0x3cd531['statusCode']?_0x3cd531['statusCode']:_0x7b64('0x186'));this[_0x7b64('0x10')][_0x7b64('0xa0')](util['format'](_0x7b64('0x187'),_0x5a7fcb),_0x3cd531[_0x7b64('0x70')]?_0x3cd531[_0x7b64('0x70')]:'OK');if(_0x3cd531[_0x7b64('0x6e')]){try{this[_0x7b64('0x9e')](_0x3cd531[_0x7b64('0x6e')],_0x5a7fcb);}catch(_0x4f0f42){logger[_0x7b64('0x2c')](util[_0x7b64('0x29')](_0x7b64('0x188'),_0x5a7fcb));}}return this['channel'][_0x7b64('0xad')](util[_0x7b64('0x29')](_0x7b64('0xdf'),_0x5a7fcb));};AGIVertices[_0x7b64('0x16')]['saydigits']=function(_0x48db34){logger[_0x7b64('0x2e')](util[_0x7b64('0x29')](_0x7b64('0x189'),_0x48db34[_0x7b64('0x38')]));return this[_0x7b64('0x10')][_0x7b64('0x18a')](_0x48db34[_0x7b64('0x18b')][_0x7b64('0x18c')](/\s+/g,''),_0x48db34['escape_digits']);};AGIVertices[_0x7b64('0x16')]['saynumber']=function(_0x3b8844){logger[_0x7b64('0x2e')](util[_0x7b64('0x29')](_0x7b64('0x18d'),_0x3b8844['label']));return this[_0x7b64('0x10')][_0x7b64('0x18e')](_0x3b8844[_0x7b64('0x62')][_0x7b64('0x18c')](/\s+/g,''),_0x3b8844['escape_digits']);};AGIVertices[_0x7b64('0x16')][_0x7b64('0x18f')]=function(_0x1ad60b){logger['info'](util[_0x7b64('0x29')](_0x7b64('0x190'),_0x1ad60b['label']));return this[_0x7b64('0x10')][_0x7b64('0x191')](_0x1ad60b['text'],_0x1ad60b[_0x7b64('0x17f')]);};AGIVertices['prototype']['sendMail']=function(_0x380903){logger['info'](util[_0x7b64('0x29')](_0x7b64('0x192'),_0x380903[_0x7b64('0x38')]));if(!this[_0x7b64('0x82')](_0x380903[_0x7b64('0x193')])){return this[_0x7b64('0x10')]['noop'](_0x7b64('0x194'));}var _0x971ca9=this[_0x7b64('0x195')]['sync'](this,_0x380903[_0x7b64('0x193')]);if(!_0x971ca9||!_0x971ca9[_0x7b64('0x196')]){return this['channel'][_0x7b64('0x2c')](_0x380903,_0x7b64('0x197'));}var _0x22aa57={'from':util[_0x7b64('0x29')](_0x7b64('0x198'),_0x971ca9[_0x7b64('0x14')],_0x971ca9['email']||_0x971ca9[_0x7b64('0x196')][_0x7b64('0x199')]),'to':_0x380903['to']||'','cc':_0x380903['cc']||'','bcc':_0x380903['bcc']||'','subject':_0x380903[_0x7b64('0x19a')],'html':_0x380903[_0x7b64('0x59')],'text':_0x380903[_0x7b64('0x59')]};if(this[_0x7b64('0x82')](_0x380903[_0x7b64('0x19b')])){}logger['debug'](_0x7b64('0x19c'),JSON[_0x7b64('0x6d')](_0x22aa57));this[_0x7b64('0xa8')][_0x7b64('0xa9')](this,_0x380903,_0x380903[_0x7b64('0x193')]);this[_0x7b64('0x10')]['noop'](util['format']('Trying\x20SendMail\x20with\x20account\x20%s',_0x971ca9[_0x7b64('0x14')]));this['sendMailMessage'][_0x7b64('0xa9')](this,_0x971ca9[_0x7b64('0x19d')],_0x22aa57);return this[_0x7b64('0x10')]['noop'](_0x7b64('0x19e'));};AGIVertices[_0x7b64('0x16')][_0x7b64('0x19f')]=function(_0x5b9df1){logger[_0x7b64('0x2e')](util[_0x7b64('0x29')](_0x7b64('0x1a0'),_0x5b9df1[_0x7b64('0x38')]));return this[_0x7b64('0x10')][_0x7b64('0xad')]('SENDFAX\x20block\x20not\x20implemented');};AGIVertices[_0x7b64('0x16')][_0x7b64('0x1a1')]=function(_0xc953c2){logger[_0x7b64('0x2e')](util[_0x7b64('0x29')](_0x7b64('0x1a2'),_0xc953c2['label']));if(!this[_0x7b64('0x82')](_0xc953c2[_0x7b64('0x1a3')])){return this[_0x7b64('0x10')][_0x7b64('0xad')](_0x7b64('0x1a4'));}var _0xf3729f=this[_0x7b64('0x34')][_0x7b64('0xa9')](this,_0xc953c2['sms_account_id']);if(!_0xf3729f){return this['channel'][_0x7b64('0x2c')](_0xc953c2,_0x7b64('0x1a5'));}var _0xb68e0b={'body':_0xc953c2[_0x7b64('0x1a6')],'phone':_0xc953c2['to']||'','SmsAccountId':_0xf3729f['id']};logger['debug'](_0x7b64('0x1a7'),JSON[_0x7b64('0x6d')](_0xb68e0b));this['createSquareDetailsReport'][_0x7b64('0xa9')](this,_0xc953c2,_0xc953c2[_0x7b64('0x1a3')]);this['channel'][_0x7b64('0xad')](util[_0x7b64('0x29')](_0x7b64('0x1a8'),_0xf3729f[_0x7b64('0x14')]));this[_0x7b64('0x36')][_0x7b64('0xa9')](this,_0xb68e0b);return this[_0x7b64('0x10')]['noop']('Sms\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices['prototype'][_0x7b64('0x1a9')]=function(_0xb1e261){logger[_0x7b64('0x2e')](util[_0x7b64('0x29')](_0x7b64('0x1aa'),_0xb1e261['label']));if(!this['isConfigured'](_0xb1e261[_0x7b64('0xd9')])){return this['channel']['error'](_0xb1e261,_0x7b64('0x1ab'));}var _0x316ecd=this['getVariable'][_0x7b64('0xa9')](this,_0xb1e261[_0x7b64('0xd9')]);if(!_0x316ecd){return this[_0x7b64('0x10')][_0x7b64('0x2c')](_0xb1e261,_0x7b64('0xdb'));}return this[_0x7b64('0x10')]['setVariable'](_0x316ecd,_0xb1e261['variable_value']);};AGIVertices[_0x7b64('0x16')]['start']=function(_0x2441d7){logger[_0x7b64('0x2e')](util[_0x7b64('0x29')](_0x7b64('0x1ac'),_0x2441d7[_0x7b64('0x38')]));this['channel'][_0x7b64('0xad')](_0x7b64('0x1ad'));var _0x5d4e46=this['channel'][_0x7b64('0xa4')](_0x7b64('0x1ae'));if(!_[_0x7b64('0x44')](_0x5d4e46[_0x7b64('0xa6')])){this['channel'][_0x7b64('0x37')]=_0x5d4e46[_0x7b64('0xa6')];}if(_0x2441d7['answer']==='yes'){this[_0x7b64('0x10')][_0x7b64('0xad')](_0x7b64('0x1af'));return this[_0x7b64('0x10')]['answer']();}return this['channel'][_0x7b64('0xad')](_0x7b64('0x1b0'));};AGIVertices[_0x7b64('0x16')]['subproject']=function(_0x7d47c8){logger['info'](util[_0x7b64('0x29')](_0x7b64('0x1b1'),_0x7d47c8[_0x7b64('0x38')]));if(!this[_0x7b64('0x82')](_0x7d47c8[_0x7b64('0x1b2')])){return this[_0x7b64('0x10')][_0x7b64('0x2c')](_0x7d47c8,_0x7b64('0x1b3'));}var _0x3dce90=this[_0x7b64('0x1b4')][_0x7b64('0xa9')](this,_0x7d47c8['project_id']);if(!this['isConfigured'](_0x3dce90)){return this['channel'][_0x7b64('0x2c')](_0x7d47c8,util[_0x7b64('0x29')](_0x7b64('0x1b5'),_0x7d47c8['project_id']));}if(_0x3dce90===this['channel'][_0x7b64('0x39')]){return this[_0x7b64('0x10')][_0x7b64('0x2c')](_0x7d47c8,_0x7b64('0x1b6'));}this[_0x7b64('0xa8')][_0x7b64('0xa9')](this,_0x7d47c8,_0x3dce90);var _0x15a1e2=this[_0x7b64('0x10')][_0x7b64('0xaf')](_0x7b64('0x1b7'),util[_0x7b64('0x29')](_0x7b64('0x1b8'),config['agi'][_0x7b64('0x1b9')]||_0x7b64('0x1ba'),_0x3dce90,this[_0x7b64('0x10')]['arg_1']));if(_0x15a1e2[_0x7b64('0xa5')]===-0x1){return _0x15a1e2;}return this[_0x7b64('0x10')]['noop'](util[_0x7b64('0x29')]('Executed\x20command\x20%s\x20%s',_0x7b64('0x1b7'),_0x3dce90));};AGIVertices[_0x7b64('0x16')][_0x7b64('0x1bb')]=function(_0x9ab405){logger[_0x7b64('0x2e')](util[_0x7b64('0x29')](_0x7b64('0x1bc'),_0x9ab405['label']));var _0x4d7d11=this[_0x7b64('0x1bd')][_0x7b64('0xa9')](this,_0x9ab405[_0x7b64('0x1be')]);this[_0x7b64('0xa8')][_0x7b64('0xa9')](this,_0x9ab405,_0x9ab405[_0x7b64('0x1be')]);if(this[_0x7b64('0x82')](_0x9ab405[_0x7b64('0xd9')])){var _0x2ce64f=this[_0x7b64('0xa4')][_0x7b64('0xa9')](this,_0x9ab405['variable_id']);if(_0x2ce64f){this['channel'][_0x7b64('0xa0')](_0x2ce64f,_0x4d7d11);return this['channel'][_0x7b64('0xad')](util[_0x7b64('0x29')](_0x7b64('0x1bf'),_0x9ab405[_0x7b64('0x1be')],_0x2ce64f));}}return this[_0x7b64('0x10')][_0x7b64('0xad')](util['format']('sh\x20command:\x20%s\x20result\x20no\x20stored',_0x9ab405[_0x7b64('0x1be')]));};AGIVertices[_0x7b64('0x16')][_0x7b64('0x1c0')]=function(_0x3d7cd0){logger[_0x7b64('0x2e')](util[_0x7b64('0x29')]('Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block',_0x3d7cd0[_0x7b64('0x38')]));_0x3d7cd0['text']=_0x3d7cd0[_0x7b64('0x59')][_0x7b64('0x18c')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x3d7cd0[_0x7b64('0x1c1')])){return this[_0x7b64('0x10')]['noop'](_0x7b64('0x1c2'));}if(!this['isConfigured'](_0x3d7cd0['text'])){return this[_0x7b64('0x10')][_0x7b64('0xad')](_0x7b64('0xae'));}this['channel'][_0x7b64('0xad')](util[_0x7b64('0x29')](_0x7b64('0x1c3'),_0x3d7cd0[_0x7b64('0x59')]));var _0x490e67=this['googleCloudTTS']['sync'](this,_0x3d7cd0);if(_0x490e67){this['channel'][_0x7b64('0xad')](util[_0x7b64('0x29')](_0x7b64('0x1c4'),_0x490e67));var _0x308d80=this[_0x7b64('0x10')][_0x7b64('0x124')](_0x490e67);try{fs['unlink'](_0x490e67+'.wav');}catch(_0x31d4f8){logger[_0x7b64('0x2c')](_0x31d4f8);}return _0x308d80;}return this[_0x7b64('0x10')][_0x7b64('0x2c')](_0x3d7cd0,_0x7b64('0x1c5'));};AGIVertices[_0x7b64('0x16')][_0x7b64('0x1c6')]=function(_0x5abe72){logger[_0x7b64('0x2e')](util[_0x7b64('0x29')](_0x7b64('0x1c7'),_0x5abe72[_0x7b64('0x38')]));_0x5abe72[_0x7b64('0x59')]=_0x5abe72[_0x7b64('0x59')][_0x7b64('0x18c')](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x5abe72[_0x7b64('0x59')])){return this[_0x7b64('0x10')][_0x7b64('0xad')](_0x7b64('0xae'));}this['channel'][_0x7b64('0xad')](util['format'](_0x7b64('0x1c8'),_0x5abe72['text']));var _0x5e3627=this[_0x7b64('0x5d')][_0x7b64('0xa9')](this,_0x5abe72);if(_0x5e3627){this[_0x7b64('0x10')]['noop'](util[_0x7b64('0x29')](_0x7b64('0x1c9'),_0x5e3627));var _0x31ab17=this[_0x7b64('0x10')][_0x7b64('0x124')](_0x5e3627);try{fs[_0x7b64('0x106')](_0x5e3627+'.wav');}catch(_0x2562df){logger['error'](_0x2562df);}return _0x31ab17;}return this[_0x7b64('0x10')]['error'](_0x5abe72,_0x7b64('0x1ca'));};AGIVertices[_0x7b64('0x16')][_0x7b64('0x1cb')]=function(_0x5c7ca4){logger[_0x7b64('0x2e')](util['format'](_0x7b64('0x1cc'),_0x5c7ca4['label']));if(!this[_0x7b64('0x82')](_0x5c7ca4['findBy'])){return this[_0x7b64('0x10')][_0x7b64('0x2c')](_0x5c7ca4,_0x7b64('0x15f'));}logger[_0x7b64('0x2e')](util[_0x7b64('0x29')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x7b64('0x10')][_0x7b64('0x3a')],_0x5c7ca4[_0x7b64('0x158')]));var _0x374ad3=this[_0x7b64('0x4f')]['sync'](this,_0x5c7ca4[_0x7b64('0x158')]);if(_0x374ad3){logger[_0x7b64('0x2e')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0x7b64('0x10')][_0x7b64('0x3a')],_0x5c7ca4[_0x7b64('0x158')]));this[_0x7b64('0x10')][_0x7b64('0xad')](util[_0x7b64('0x29')](_0x7b64('0x159'),this[_0x7b64('0x10')][_0x7b64('0x3a')],_0x5c7ca4[_0x7b64('0x158')]));return{'code':0xc8,'result':'success'};}else{logger[_0x7b64('0x2e')](util[_0x7b64('0x29')](_0x7b64('0x15b'),this[_0x7b64('0x10')][_0x7b64('0x3a')],_0x5c7ca4[_0x7b64('0x158')]));this['channel'][_0x7b64('0xad')](util[_0x7b64('0x29')](_0x7b64('0x15b'),this[_0x7b64('0x10')][_0x7b64('0x3a')],_0x5c7ca4[_0x7b64('0x158')]));return{'code':0xc8,'result':_0x7b64('0x15c')};}};AGIVertices[_0x7b64('0x16')][_0x7b64('0x1cd')]=function(_0x1029a5){logger[_0x7b64('0x2e')](util[_0x7b64('0x29')](_0x7b64('0x1ce'),_0x1029a5[_0x7b64('0x38')]));var _0x1cf004=this[_0x7b64('0x10')]['exec'](_0x7b64('0x1cf'),[_0x1029a5[_0x7b64('0x1d0')],_0x1029a5['options']]);if(_0x1cf004['result']===-0x1){return _0x1cf004;}return this[_0x7b64('0x10')][_0x7b64('0xad')](util[_0x7b64('0x29')](_0x7b64('0xc7'),_0x7b64('0x1cf'),_0x1029a5[_0x7b64('0x1d0')]));};AGIVertices[_0x7b64('0x16')][_0x7b64('0x1d1')]=function(_0x5e6351){logger['info'](util['format'](_0x7b64('0x1d2'),_0x5e6351[_0x7b64('0x38')]));if(!this['isConfigured'](_0x5e6351[_0x7b64('0xd9')])){return this[_0x7b64('0x10')][_0x7b64('0x2c')](_0x5e6351,'no\x20variable\x20selected');}var _0x4c6b93=this[_0x7b64('0xa4')][_0x7b64('0xa9')](this,_0x5e6351[_0x7b64('0xd9')]);if(!_0x4c6b93){return this[_0x7b64('0x10')][_0x7b64('0x2c')](_0x5e6351,_0x7b64('0xdb'));}var _0x1e2749=this[_0x7b64('0x10')][_0x7b64('0xa4')](_0x4c6b93);return{'code':0xc8,'result':_0x1e2749[_0x7b64('0xa6')]?_0x1e2749['extra']:'-'};};String[_0x7b64('0x16')][_0x7b64('0xa2')]=function(_0x2f5db3,_0x54d4d2){return this['split'](_0x2f5db3)[_0x7b64('0x1d3')](_0x54d4d2);};module[_0x7b64('0x1d4')]=AGIVertices; \ No newline at end of file +var _0x4c4e=['dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','client_email','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_polly_region','aws_polly_voice','Amy','aws_text_type','awsLex','aws_access_key_id','aws_lex_region','aws_bot_name','googleASR','google_asr_language','appid','appsecret','clear','includes','isString','replaceObjectAllVariables','isPlainObject','recursiveNodeIndex','isArray','length','replaceAllVariables','saveRestApiResult','%s.%s','setVariable','split','extra','toString','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','retry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','label','no\x20text\x20configured','MRCPSynth','noop','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','grammar','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','args','answer','Wait\x20%s\x20seconds\x20before\x20answer','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','delay','add','minutes','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','sestektts','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','no\x20grammar\x20configured','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','Enter\x20in\x20DATABASE\x20(%s)\x20block','no\x20database\x20selected','getSquareOdbc','odbc_id','no\x20odbc\x20database\x20found','no\x20query\x20configured','query:\x20%s','getQueryOdbc','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','keys','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','SIP/%s','opts','Executed\x20command\x20%s','DIAL','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','hasOwnProperty','DIALOGFLOW_%s','speech','out','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','dialogflowV2','no\x20project_id\x20configured','no\x20client_email\x20configured','no\x20private_key\x20configured','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','Sestek\x20NDA\x20%s\x20file\x20created','audiofile','streamFile','unlink','.wav','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','trunk_id','no\x20trunk\x20selected','trunk_name','SIP/%s/%s','finally','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','no\x20file\x20audio\x20selected','getSound','no\x20file\x20audio\x20found','getData','response','maxdigit','test','hiddendigitsnum','generate','hiddendigitspos','first','substr','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','GOAL\x20%s','goalname','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','aws_secret_access_key','no\x20valid\x20credentials\x20configured','aws\x20Polly\x20%s\x20file\x20created','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','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','beep','NOBEEP','recordFile','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appsecret\x20configured','intKey','TILDE_ASR_%s','TildeASR\x20Result\x20%s','continueAt','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','true','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','Enter\x20in\x20HANGUP\x20(%s)\x20block','hangup','ispeechasr','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','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','Enter\x20in\x20LOGOUT\x20(%s)\x20block','no\x20operation\x20configured','math\x20%s','operation','forEach','%s[%s]','Enter\x20in\x20MENU\x20(%s)\x20block','file_id','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','agentPause','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','getVoiceQueue','no\x20queue\x20found','indexOf','XMCS-QUEUE','QUEUE','agi','macro','gosub','position','record','Enter\x20in\x20RECORD\x20(%s)\x20block','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','escape_digits','restapi','no\x20url\x20configured','Response:','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','number','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','account_id','Smtp','no\x20mail\x20account\x20found','email','user','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','smtpOptions','Mail\x20message\x20added\x20to\x20outgoing\x20process','Enter\x20in\x20SENDFAX\x20(%s)\x20block','sms_account_id','getSmsAccount','no\x20sms\x20account\x20found','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','start','START\x20CALLY\x20SQUARE','XMCS-UNIQUEID','yes','Answer','Skipped\x20Answer','subproject','project_id','no\x20subproject\x20found\x20with\x20id\x20%d','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','host','127.0.0.1','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','command','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','replaceAll','join','exports','util','shelljs','odbc','randomstring','mustache','request-promise','../../config/logger','../../config/environment','/var/opt/motion2/server/files','rawHeaders','rawBody','menu','getdigits','getsecretdigits','rpc','mailRpc','prototype','getVariable','getVariableById','then','name','getVoiceQueueById','catch','getSquareProject','getSquareProjectById','getSquareOdbcById','dsn','getUser','getUserById','getMailAccount','sendMailMessage','getIntervals','getIntervalById','IntervalId','interval','map','Intervals','getSoundPath','format','%s/sounds/converted/%s','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','query','Error\x20executing\x20query\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccountById','createSmsMessage','createSquareDetailsReport','channel','uniqueid','arg_1','createSquareRecording','callerid','calleridname','context','extension','priority','accountcode','dnid','file','createSquareMessage','createCmContact','isEmpty','isNil','callback_','random','lastName','phone','list_id','scheduledAt','callback','Callback\x20scheduled\x20at\x20','callback_priority','getPause','agent','agentUnpause','agentLogout','agentLogin','internal','%s/%s@from-sip/n','LOCAL','shellCommand','exec','trim','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','en-US','audioEncoding','MP3','googleTTS','google_tts_language','restAPI','url','timeout','POST','PUT','method','toUpperCase','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','render','stringify','body','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusMessage','statusCode','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key'];(function(_0xc1ce0b,_0x3b2509){var _0x8177d5=function(_0x348ea1){while(--_0x348ea1){_0xc1ce0b['push'](_0xc1ce0b['shift']());}};_0x8177d5(++_0x3b2509);}(_0x4c4e,0x152));var _0xe4c4=function(_0x255ce8,_0x390f99){_0x255ce8=_0x255ce8-0x0;var _0x10436a=_0x4c4e[_0x255ce8];return _0x10436a;};'use strict';var fs=require('fs');var util=require(_0xe4c4('0x0'));var _=require('lodash');var sh=require(_0xe4c4('0x1'));var odbc=require(_0xe4c4('0x2'))();var rs=require(_0xe4c4('0x3'));var moment=require('moment');var Mustache=require(_0xe4c4('0x4'));var rp=require(_0xe4c4('0x5'));var logger=require(_0xe4c4('0x6'))('agi');var config=require(_0xe4c4('0x7'));var scripts=require('./scripts');var FILES_PATH=_0xe4c4('0x8');var recursiveMapAttributes=[_0xe4c4('0x9'),_0xe4c4('0xa')];var verticesWithRetry=[_0xe4c4('0xb'),_0xe4c4('0xc'),_0xe4c4('0xd')];var AGIVertices=function(_0x28a42e,_0x4c185c,_0x4c953c){this['channel']=_0x28a42e;this[_0xe4c4('0xe')]=_0x4c185c;this[_0xe4c4('0xf')]=_0x4c953c;};AGIVertices[_0xe4c4('0x10')][_0xe4c4('0x11')]=function(_0x333c08,_0x2f4d5f){this['rpc'][_0xe4c4('0x12')](_0x333c08)[_0xe4c4('0x13')](function(_0x3805c5){_0x2f4d5f(null,_0x3805c5?_0x3805c5[_0xe4c4('0x14')]:![]);})['catch'](function(_0x262083){_0x2f4d5f(_0x262083);});};AGIVertices[_0xe4c4('0x10')]['getVoiceQueue']=function(_0xe485ca,_0x1a44e5){this['rpc'][_0xe4c4('0x15')](_0xe485ca)[_0xe4c4('0x13')](function(_0x5e263c){_0x1a44e5(null,_0x5e263c?_0x5e263c[_0xe4c4('0x14')]:![]);})[_0xe4c4('0x16')](function(_0x26ea05){_0x1a44e5(_0x26ea05);});};AGIVertices[_0xe4c4('0x10')][_0xe4c4('0x17')]=function(_0x882be2,_0x1f637e){this[_0xe4c4('0xe')][_0xe4c4('0x18')](_0x882be2)[_0xe4c4('0x13')](function(_0x23b7e6){_0x1f637e(null,_0x23b7e6?_0x23b7e6[_0xe4c4('0x14')]:![]);})[_0xe4c4('0x16')](function(_0x43a9ce){_0x1f637e(_0x43a9ce);});};AGIVertices[_0xe4c4('0x10')]['getSquareOdbc']=function(_0x286ab3,_0x24f946){this[_0xe4c4('0xe')][_0xe4c4('0x19')](_0x286ab3)['then'](function(_0x3d5856){_0x24f946(null,_0x3d5856?_0x3d5856[_0xe4c4('0x1a')]:![]);})[_0xe4c4('0x16')](function(_0x30d56a){_0x24f946(_0x30d56a);});};AGIVertices[_0xe4c4('0x10')][_0xe4c4('0x1b')]=function(_0x1d4597,_0x393c96){this[_0xe4c4('0xe')][_0xe4c4('0x1c')](_0x1d4597)[_0xe4c4('0x13')](function(_0x3a6d39){_0x393c96(null,_0x3a6d39?_0x3a6d39[_0xe4c4('0x14')]:![]);})[_0xe4c4('0x16')](function(_0x15873e){_0x393c96(_0x15873e);});};AGIVertices['prototype']['getTrunk']=function(_0x403a2c,_0x4dc8cc){this[_0xe4c4('0xe')]['getTrunkById'](_0x403a2c)[_0xe4c4('0x13')](function(_0x5efc4c){_0x4dc8cc(null,_0x5efc4c?_0x5efc4c[_0xe4c4('0x14')]:![]);})['catch'](function(_0xba53ef){_0x4dc8cc(_0xba53ef);});};AGIVertices['prototype']['getSound']=function(_0x4cea1f,_0x5d66ab){var _0x3221cd=this;this['rpc']['getSoundById'](_0x4cea1f)[_0xe4c4('0x13')](function(_0x11deab){_0x5d66ab(null,_0x11deab?_0x3221cd['getSoundPath'](_0x11deab['save_name']):![]);})[_0xe4c4('0x16')](function(_0x33de43){_0x5d66ab(_0x33de43);});};AGIVertices['prototype'][_0xe4c4('0x1d')]=function(_0x2d0e2,_0x3f60fc){this['rpc']['getMailAccountById'](_0x2d0e2)[_0xe4c4('0x13')](function(_0x2c5652){_0x3f60fc(null,_0x2c5652?_0x2c5652:![]);})[_0xe4c4('0x16')](function(_0x237dd6){_0x3f60fc(_0x237dd6);});};AGIVertices['prototype']['sendMailMessage']=function(_0x1731c8,_0x2e4282,_0x5d0ba5){this[_0xe4c4('0xf')][_0xe4c4('0x1e')](_0x1731c8,_0x2e4282)[_0xe4c4('0x13')](function(){_0x5d0ba5(null);})['catch'](function(_0x137f40){_0x5d0ba5(_0x137f40);});};AGIVertices['prototype'][_0xe4c4('0x1f')]=function(_0x4239ba,_0x3bb6cf){this[_0xe4c4('0xe')][_0xe4c4('0x20')](_0x4239ba)[_0xe4c4('0x13')](function(_0xb801c8){if(_0xb801c8){if(_0xb801c8[_0xe4c4('0x21')]){_0x3bb6cf(null,[_0xb801c8[_0xe4c4('0x22')]]);}else{_0x3bb6cf(null,_[_0xe4c4('0x23')](_0xb801c8[_0xe4c4('0x24')],_0xe4c4('0x22')));}}else{_0x3bb6cf(null,![]);}})['catch'](function(_0x21fce3){_0x3bb6cf(_0x21fce3);});};AGIVertices[_0xe4c4('0x10')][_0xe4c4('0x25')]=function(_0x518018){return util[_0xe4c4('0x26')](_0xe4c4('0x27'),FILES_PATH,_0x518018);};AGIVertices[_0xe4c4('0x10')]['getQueryOdbc']=function(_0x4622cc,_0xa2e734,_0x4a3644){odbc[_0xe4c4('0x28')](_0x4622cc,function(_0x413ec9){if(_0x413ec9){logger[_0xe4c4('0x29')](_0xe4c4('0x2a'),_0x413ec9);_0x4a3644(_0x413ec9);}else{logger[_0xe4c4('0x2b')](_0xe4c4('0x2c'));odbc[_0xe4c4('0x2d')](_0xa2e734,function(_0x5bb519,_0x153df2){if(_0x5bb519){logger[_0xe4c4('0x2b')](_0xe4c4('0x2e'),_0xa2e734);_0x4a3644(_0x5bb519);}else{logger[_0xe4c4('0x2b')]('Query\x20executed\x20correctly\x20%s',_0xa2e734);odbc[_0xe4c4('0x2f')](function(_0xc50508){if(_0xc50508){logger['error'](_0xe4c4('0x30'),_0xc50508);}_0x4a3644(null,_0x153df2);});}});}});};AGIVertices[_0xe4c4('0x10')]['getSmsAccount']=function(_0x433f0c,_0x3cd4d3){this[_0xe4c4('0xe')][_0xe4c4('0x31')](_0x433f0c)[_0xe4c4('0x13')](function(_0xe7a882){_0x3cd4d3(null,_0xe7a882?_0xe7a882:![]);})[_0xe4c4('0x16')](function(_0x43201e){_0x3cd4d3(_0x43201e);});};AGIVertices[_0xe4c4('0x10')][_0xe4c4('0x32')]=function(_0x221a50,_0x10b513){this['rpc'][_0xe4c4('0x32')](_0x221a50)[_0xe4c4('0x13')](function(_0x2b306d){_0x10b513(null,_0x2b306d);})[_0xe4c4('0x16')](function(_0x260141){_0x10b513(_0x260141);});};AGIVertices[_0xe4c4('0x10')]['createSquareDetailsReport']=function(_0x312a49,_0x526bef,_0xca07dc){this[_0xe4c4('0xe')][_0xe4c4('0x33')]({'uniqueid':this[_0xe4c4('0x34')][_0xe4c4('0x35')],'node':_0x312a49['label'],'application':_0x312a49['agicommand'],'data':_0x526bef||null,'project_name':this[_0xe4c4('0x34')][_0xe4c4('0x36')],'callerid':this[_0xe4c4('0x34')]['callerid']})[_0xe4c4('0x13')](function(_0x66304){if(_0xca07dc){_0xca07dc(null,_0x66304);}})[_0xe4c4('0x16')](function(_0x36e7b1){if(_0xca07dc){_0xca07dc(_0x36e7b1);}});};AGIVertices['prototype'][_0xe4c4('0x37')]=function(_0xd8e246,_0x9b049d,_0x1b9a2c,_0x6bf1ee){this[_0xe4c4('0xe')][_0xe4c4('0x37')]({'uniqueid':this[_0xe4c4('0x34')][_0xe4c4('0x35')],'callerid':this['channel'][_0xe4c4('0x38')],'calleridname':this['channel'][_0xe4c4('0x39')],'context':this[_0xe4c4('0x34')][_0xe4c4('0x3a')],'extension':this[_0xe4c4('0x34')][_0xe4c4('0x3b')],'priority':this[_0xe4c4('0x34')][_0xe4c4('0x3c')],'accountcode':this[_0xe4c4('0x34')][_0xe4c4('0x3d')],'dnid':this[_0xe4c4('0x34')][_0xe4c4('0x3e')],'projectName':this[_0xe4c4('0x34')][_0xe4c4('0x36')],'saveName':_0x9b049d,'filename':_0xd8e246[_0xe4c4('0x3f')]||_0x9b049d,'savePath':_0x1b9a2c})['then'](function(_0x4922f5){_0x6bf1ee(null,_0x4922f5);})[_0xe4c4('0x16')](function(_0x198961){_0x6bf1ee(_0x198961);});};AGIVertices['prototype'][_0xe4c4('0x40')]=function(_0x2853da,_0x1211f9,_0x10e8df,_0x1f6d78,_0x5587b2){this[_0xe4c4('0xe')][_0xe4c4('0x40')]({'uniqueid':this['channel'][_0xe4c4('0x35')],'body':_0x2853da,'direction':_0x1211f9,'providerName':_0x10e8df,'providerResponse':_0x1f6d78})[_0xe4c4('0x13')](function(_0x5a1054){if(_0x5587b2){_0x5587b2(null,_0x5a1054);}})[_0xe4c4('0x16')](function(_0x53699d){if(_0x5587b2){_0x5587b2(_0x53699d);}});};AGIVertices[_0xe4c4('0x10')][_0xe4c4('0x41')]=function(_0x2a54ef,_0x432227){this[_0xe4c4('0xe')]['createCmContact']({'firstName':_[_0xe4c4('0x42')](_0x2a54ef[_0xe4c4('0x14')])||_[_0xe4c4('0x43')](_0x2a54ef[_0xe4c4('0x14')])?_0xe4c4('0x44')+Math[_0xe4c4('0x45')]():_0x2a54ef[_0xe4c4('0x14')],'lastName':_[_0xe4c4('0x42')](_0x2a54ef[_0xe4c4('0x46')])||_[_0xe4c4('0x43')](_0x2a54ef[_0xe4c4('0x46')])?null:_0x2a54ef[_0xe4c4('0x46')],'phone':_0x2a54ef[_0xe4c4('0x47')],'ListId':_0x2a54ef[_0xe4c4('0x48')],'scheduledat':_0x2a54ef[_0xe4c4('0x49')],'callbackUniqueid':this[_0xe4c4('0x34')]['uniqueid'],'tags':_0xe4c4('0x4a'),'description':_0xe4c4('0x4b')+_0x2a54ef[_0xe4c4('0x49')]['toString'](),'priority':_0x2a54ef[_0xe4c4('0x4c')]})[_0xe4c4('0x13')](function(_0x35f750){_0x432227(null,_0x35f750);})['catch'](function(_0x45f959){_0x432227(_0x45f959);});};AGIVertices['prototype'][_0xe4c4('0x4d')]=function(_0xfbfff6,_0x1cef48){this['rpc']['getPauseById'](_0xfbfff6)[_0xe4c4('0x13')](function(_0x7d4896){_0x1cef48(null,_0x7d4896?_0x7d4896[_0xe4c4('0x14')]:![]);})['catch'](function(_0x3df49f){_0x1cef48(_0x3df49f);});};AGIVertices['prototype']['agentPause']=function(_0x5a6176,_0x4e08ec,_0x1ca931){var _0x3a06da={'role':_0xe4c4('0x4e')};_0x3a06da[_0x5a6176]=this[_0xe4c4('0x34')][_0xe4c4('0x38')];this[_0xe4c4('0xe')]['agentPause'](_0x3a06da,_0x4e08ec,this[_0xe4c4('0x34')][_0xe4c4('0x35')])[_0xe4c4('0x13')](function(_0x125652){_0x1ca931(null,_[_0xe4c4('0x43')](_0x125652)?![]:!![]);})[_0xe4c4('0x16')](function(_0x554ddb){logger['error'](_0x554ddb);_0x1ca931(null,![]);});};AGIVertices[_0xe4c4('0x10')][_0xe4c4('0x4f')]=function(_0x1986ab,_0x3c8e44){var _0x3ccf42={'role':_0xe4c4('0x4e')};_0x3ccf42[_0x1986ab]=this[_0xe4c4('0x34')][_0xe4c4('0x38')];this[_0xe4c4('0xe')]['agentUnpause'](_0x3ccf42)['then'](function(_0x5a4138){_0x3c8e44(null,_['isNil'](_0x5a4138)?![]:!![]);})[_0xe4c4('0x16')](function(_0x11ce76){logger[_0xe4c4('0x29')](_0x11ce76);_0x3c8e44(null,![]);});};AGIVertices['prototype'][_0xe4c4('0x50')]=function(_0x4e63c6,_0x3af3f0){var _0x56ead3={'role':'agent'};_0x56ead3[_0x4e63c6]=this[_0xe4c4('0x34')][_0xe4c4('0x38')];this[_0xe4c4('0xe')]['agentLogout'](_0x56ead3)['then'](function(_0x4879f9){_0x3af3f0(null,_[_0xe4c4('0x43')](_0x4879f9)?![]:!![]);})[_0xe4c4('0x16')](function(_0x57aca0){logger[_0xe4c4('0x29')](_0x57aca0);_0x3af3f0(null,![]);});};AGIVertices[_0xe4c4('0x10')][_0xe4c4('0x51')]=function(_0x5c389b,_0x4e939e){var _0x2908aa={'role':_0xe4c4('0x4e')};_0x2908aa[_0x5c389b]=this[_0xe4c4('0x34')][_0xe4c4('0x38')];var _0x375aa9=_0x5c389b!=_0xe4c4('0x52')?util['format'](_0xe4c4('0x53'),_0xe4c4('0x54'),this[_0xe4c4('0x34')]['callerid']):undefined;this[_0xe4c4('0xe')][_0xe4c4('0x51')](_0x2908aa,_0x375aa9)[_0xe4c4('0x13')](function(_0x57998c){_0x4e939e(null,_['isNil'](_0x57998c)?![]:!![]);})[_0xe4c4('0x16')](function(_0x5dbd4d){logger['error'](_0x5dbd4d);_0x4e939e(null,![]);});};AGIVertices[_0xe4c4('0x10')][_0xe4c4('0x55')]=function(_0x16c4c9,_0x49d80b){sh[_0xe4c4('0x56')](_[_0xe4c4('0x57')](_0x16c4c9),function(_0x433633,_0xbde5d6){var _0x5c1b10=_0xbde5d6[_0xe4c4('0x58')](/(\r\n|\n|\r)/gm,'');_0x49d80b(null,_0x5c1b10);});};AGIVertices[_0xe4c4('0x10')]['googleCloudTTS']=function(_0x58bb73,_0x3de25d){scripts[_0xe4c4('0x59')](_0x58bb73[_0xe4c4('0x5a')],_0x58bb73[_0xe4c4('0x5b')]||'text',_0x58bb73[_0xe4c4('0x5c')],_0x58bb73[_0xe4c4('0x5d')]||_0xe4c4('0x5e'),_0x58bb73['ssmlGender']||'MALE',_0x58bb73[_0xe4c4('0x5f')]||_0xe4c4('0x60'))[_0xe4c4('0x13')](function(_0x1857e4){_0x3de25d(null,_0x1857e4);})['catch'](function(_0x49497f){_0x3de25d(_0x49497f);});};AGIVertices[_0xe4c4('0x10')][_0xe4c4('0x61')]=function(_0xb40f8a,_0x3e5df9){scripts[_0xe4c4('0x61')](_0xb40f8a['text'],_0xb40f8a[_0xe4c4('0x62')]||'en',0x1)['then'](function(_0x380dd5){_0x3e5df9(null,_0x380dd5);})[_0xe4c4('0x16')](function(_0x4a1fc0){_0x3e5df9(_0x4a1fc0);});};AGIVertices['prototype'][_0xe4c4('0x63')]=function(_0x279075,_0x250bb8){var _0x1f880f={'uri':_0x279075[_0xe4c4('0x64')],'method':_0x279075['method'],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x279075['timeout'])==='number'&&parseInt(_0x279075[_0xe4c4('0x65')])>=0x1?parseInt(_0x279075[_0xe4c4('0x65')])*0x3e8:0x5*0x3e8};if(_['includes']([_0xe4c4('0x66'),_0xe4c4('0x67')],_0x1f880f[_0xe4c4('0x68')][_0xe4c4('0x69')]())){try{_0x1f880f['body']=_0x279075['rawBody']?JSON[_0xe4c4('0x6a')](_0x279075[_0xe4c4('0xa')]):{};}catch(_0x5ad3f5){logger[_0xe4c4('0x29')](_0xe4c4('0x6b'),_0x5ad3f5);}}try{_0x1f880f[_0xe4c4('0x6c')]=_0x279075[_0xe4c4('0x9')]?JSON['parse'](_0x279075[_0xe4c4('0x9')]):{};}catch(_0x2205a7){logger[_0xe4c4('0x29')](_0xe4c4('0x6d'),_0x2205a7);}if(_0x279075['computedVariables']){try{var _0x3f02ed=require(_0x279075[_0xe4c4('0x6e')])[_0xe4c4('0x6f')](this,_0x1f880f);_0x1f880f[_0xe4c4('0x70')]=Mustache['render'](_0x279075[_0xe4c4('0x64')],_0x3f02ed,{},['$$','$$']);if(_0x1f880f[_0xe4c4('0x6c')]){_0x1f880f['headers']=JSON['parse'](Mustache[_0xe4c4('0x71')](JSON[_0xe4c4('0x72')](_0x1f880f[_0xe4c4('0x6c')]),_0x3f02ed,{},['$$','$$']));}if(_0x1f880f[_0xe4c4('0x73')]){_0x1f880f[_0xe4c4('0x73')]=JSON[_0xe4c4('0x6a')](Mustache[_0xe4c4('0x71')](JSON[_0xe4c4('0x72')](_0x1f880f['body']),_0x3f02ed,{},['$$','$$']));}}catch(_0x5ae9f0){logger[_0xe4c4('0x29')](_0xe4c4('0x74'),_0x5ae9f0);}}rp(_0x1f880f)[_0xe4c4('0x13')](function(_0x1305f1){var _0x2ab254={'statusCode':_0x1305f1['statusCode']||0xc8,'statusMessage':_0x1305f1[_0xe4c4('0x75')]||'OK','headers':_0x1305f1[_0xe4c4('0x6c')]||{},'body':_0x1305f1[_0xe4c4('0x73')]||{}};_0x250bb8(null,_0x2ab254);})[_0xe4c4('0x16')](function(_0x33c737){var _0x699f06={'statusCode':_0x33c737[_0xe4c4('0x76')]||0x1f4,'statusMessage':_0x33c737[_0xe4c4('0x77')]||_0xe4c4('0x78'),'headers':_0x33c737[_0xe4c4('0x79')][_0xe4c4('0x6c')]||{},'body':_0x33c737[_0xe4c4('0x79')][_0xe4c4('0x73')]||{}};_0x250bb8(null,_0x699f06);});};AGIVertices[_0xe4c4('0x10')][_0xe4c4('0x7a')]=function(_0x1295a4,_0x52c3e0){scripts['googleDialogflow'](this[_0xe4c4('0x34')]['uniqueid'],_0x1295a4[_0xe4c4('0x7b')],_0x1295a4[_0xe4c4('0x5c')],_0x1295a4[_0xe4c4('0x7c')]||'en')[_0xe4c4('0x13')](function(_0x3ebc48){_0x52c3e0(null,_0x3ebc48);})[_0xe4c4('0x16')](function(_0x428611){_0x52c3e0(_0x428611);});};AGIVertices[_0xe4c4('0x10')][_0xe4c4('0x7d')]=function(_0x1579fe,_0x37bf48){scripts[_0xe4c4('0x7d')](this[_0xe4c4('0x34')]['uniqueid'],_0x1579fe[_0xe4c4('0x7e')],_0x1579fe[_0xe4c4('0x7f')],_0x1579fe[_0xe4c4('0x80')],_0x1579fe[_0xe4c4('0x5c')],_0x1579fe[_0xe4c4('0x81')]||'en')['then'](function(_0x40ca55){_0x37bf48(null,_0x40ca55);})[_0xe4c4('0x16')](function(_0x496ebc){_0x37bf48(_0x496ebc);});};AGIVertices[_0xe4c4('0x10')][_0xe4c4('0x82')]=function(_0x4f597a,_0x4b10cc){scripts['sestekNDA'](this[_0xe4c4('0x34')],_0x4f597a)['then'](function(_0x441ca8){_0x4b10cc(null,_0x441ca8);})[_0xe4c4('0x16')](function(_0xdb0c3){_0x4b10cc(_0xdb0c3);});};AGIVertices['prototype'][_0xe4c4('0x83')]=function(_0x37cb8b,_0x2cf5ad){scripts['ispeechTTS'](_0x37cb8b['key'],_0x37cb8b['text'],_0x37cb8b[_0xe4c4('0x84')]||_0xe4c4('0x5e'),_0x37cb8b[_0xe4c4('0x85')])['then'](function(_0xc28b2c){_0x2cf5ad(null,_0xc28b2c);})[_0xe4c4('0x16')](function(_0x3abfbc){_0x2cf5ad(_0x3abfbc);});};AGIVertices[_0xe4c4('0x10')][_0xe4c4('0x86')]=function(_0x5df1c3,_0x3a91f7,_0xc76d6e){scripts[_0xe4c4('0x86')](_0x3a91f7,_0x5df1c3['key'],_0x5df1c3[_0xe4c4('0x87')]||_0xe4c4('0x5e'),this[_0xe4c4('0x88')](_0x5df1c3['model'])?_0x5df1c3[_0xe4c4('0x89')]:undefined)[_0xe4c4('0x13')](function(_0x47d67d){_0xc76d6e(null,_0x47d67d);})[_0xe4c4('0x16')](function(_0x311791){_0xc76d6e(_0x311791);});};AGIVertices[_0xe4c4('0x10')][_0xe4c4('0x8a')]=function(_0x60f0fd,_0x429ba6){scripts[_0xe4c4('0x8a')](_0x60f0fd['aws_access_key_id'],_0x60f0fd['aws_secret_access_key'],_0x60f0fd[_0xe4c4('0x8b')],_0x60f0fd[_0xe4c4('0x8c')]||_0xe4c4('0x8d'),_0x60f0fd[_0xe4c4('0x5c')],_0x60f0fd[_0xe4c4('0x8e')]||'text')[_0xe4c4('0x13')](function(_0x57c4d8){_0x429ba6(null,_0x57c4d8);})[_0xe4c4('0x16')](function(_0x44a173){_0x429ba6(_0x44a173);});};AGIVertices[_0xe4c4('0x10')]['awsLex']=function(_0x562aeb,_0x4819cd){scripts[_0xe4c4('0x8f')](this[_0xe4c4('0x34')][_0xe4c4('0x35')],_0x562aeb[_0xe4c4('0x90')],_0x562aeb['aws_secret_access_key'],_0x562aeb[_0xe4c4('0x91')],_0x562aeb[_0xe4c4('0x5c')],_0x562aeb[_0xe4c4('0x92')])[_0xe4c4('0x13')](function(_0x4819fb){_0x4819cd(null,_0x4819fb);})[_0xe4c4('0x16')](function(_0x2e0475){_0x4819cd(_0x2e0475);});};AGIVertices['prototype']['googleASR']=function(_0x566ff8,_0x376859,_0xb85a78){scripts[_0xe4c4('0x93')](_0x376859,_0x566ff8[_0xe4c4('0x7b')],_0x566ff8[_0xe4c4('0x94')]||_0xe4c4('0x5e'))[_0xe4c4('0x13')](function(_0x2ed400){_0xb85a78(null,_0x2ed400);})[_0xe4c4('0x16')](function(_0xcc6a14){_0xb85a78(_0xcc6a14);});};AGIVertices['prototype']['tildeASR']=function(_0x399618,_0x2d159e,_0x2b044e){scripts['tildeASR'](_0x2d159e,_0x399618[_0xe4c4('0x95')],_0x399618[_0xe4c4('0x96')],_0x399618['uri'])[_0xe4c4('0x13')](function(_0x5c6b95){_0x2b044e(null,_0x5c6b95);})[_0xe4c4('0x16')](function(_0x534dee){_0x2b044e(_0x534dee);});};AGIVertices[_0xe4c4('0x10')][_0xe4c4('0x97')]=function(_0x1fae5a){var _0x3559c1=_[_0xe4c4('0x98')](verticesWithRetry,_0x1fae5a['agicommand'])?_0x1fae5a:_['clone'](_0x1fae5a);for(var _0x27221d in _0x3559c1){if(_0x3559c1['hasOwnProperty'](_0x27221d)){if(_0x3559c1[_0x27221d]&&_[_0xe4c4('0x99')](_0x3559c1[_0x27221d])){if(_[_0xe4c4('0x98')](recursiveMapAttributes,_0x27221d)){_0x3559c1[_0x27221d]=this[_0xe4c4('0x9a')](_0x3559c1[_0x27221d]);}else{_0x3559c1[_0x27221d]=this['replaceAllVariables'](_0x3559c1[_0x27221d]);}}}}return _0x3559c1;};AGIVertices[_0xe4c4('0x10')]['recursiveNodeIndex']=function(_0x2d6993){for(var _0x5cc465 in _0x2d6993){if(_0x2d6993['hasOwnProperty'](_0x5cc465)){if(_[_0xe4c4('0x9b')](_0x2d6993[_0x5cc465])){this[_0xe4c4('0x9c')](_0x2d6993[_0x5cc465]);}else if(_[_0xe4c4('0x9d')](_0x2d6993[_0x5cc465])){for(var _0x4ea874=0x0;_0x4ea874<_0x2d6993[_0x5cc465][_0xe4c4('0x9e')];_0x4ea874++){this[_0xe4c4('0x9c')](_0x2d6993[_0x5cc465][_0x4ea874]);}}else if(_[_0xe4c4('0x99')](_0x2d6993[_0x5cc465])){_0x2d6993[_0x5cc465]=this[_0xe4c4('0x9f')](_0x2d6993[_0x5cc465]);}}}};AGIVertices['prototype'][_0xe4c4('0xa0')]=function(_0x323dda,_0x397852){for(var _0xed191c in _0x323dda){if(_0x323dda['hasOwnProperty'](_0xed191c)){if(_['isPlainObject'](_0x323dda[_0xed191c])){if(!_[_0xe4c4('0x42')](_0x323dda[_0xed191c])){this['saveRestApiResult'](_0x323dda[_0xed191c],util[_0xe4c4('0x26')](_0xe4c4('0xa1'),_0x397852,_0xed191c));}}else if(_[_0xe4c4('0x9d')](_0x323dda[_0xed191c])){for(var _0x328e81=0x0;_0x328e81<_0x323dda[_0xed191c]['length'];_0x328e81++){this[_0xe4c4('0xa0')](_0x323dda[_0xed191c][_0x328e81],util[_0xe4c4('0x26')](_0xe4c4('0xa1'),_0x397852,_0xed191c+'['+_0x328e81+']'));}}else{if(!_[_0xe4c4('0x43')](_0x323dda[_0xed191c])){this['channel'][_0xe4c4('0xa2')](util['format']('%s.%s',_0x397852,_0xed191c),_0x323dda[_0xed191c]);}}}}};AGIVertices['prototype']['replaceObjectAllVariables']=function(_0x2c4bf5){try{var _0x3e7992=JSON['parse'](_0x2c4bf5);this[_0xe4c4('0x9c')](_0x3e7992);return JSON[_0xe4c4('0x72')](_0x3e7992);}catch(_0x2b7ebd){return this[_0xe4c4('0x9f')](_0x2c4bf5);}};AGIVertices['prototype']['replaceAllVariables']=function(_0x19f90d){var _0x393cc3=_0x19f90d[_0xe4c4('0xa3')]('{');for(var _0x2609d7=0x1;_0x2609d7<_0x393cc3['length'];_0x2609d7+=0x1){var _0xe95464=_0x393cc3[_0x2609d7][_0xe4c4('0xa3')]('}');if(_0xe95464[_0xe4c4('0x9e')]>0x1){_0x19f90d=_0x19f90d['replaceAll']('{'+_0xe95464[0x0]+'}',this[_0xe4c4('0x34')][_0xe4c4('0x11')](_0xe95464[0x0])[_0xe4c4('0xa4')]||_0xe95464[0x0]);}}if(_0x393cc3[_0xe4c4('0x9e')]===0x1){return _0x19f90d[_0xe4c4('0xa5')]();}return this[_0xe4c4('0x9f')](_0x19f90d);};AGIVertices[_0xe4c4('0x10')][_0xe4c4('0xa6')]=function(_0x541c90,_0x40b605){var _0x32153f=this[_0xe4c4('0x34')]['getVariable'](_0x541c90);if(_0x32153f[_0xe4c4('0xa7')]===-0x1){return _0x32153f;}logger[_0xe4c4('0x2b')](util['format'](_0xe4c4('0xa8'),_0x40b605,_0x32153f['extra']));return this['channel'][_0xe4c4('0xa2')](_0x40b605,_0x32153f[_0xe4c4('0xa4')]);};AGIVertices[_0xe4c4('0x10')]['isConfigured']=function(_0x2c4934){return _0x2c4934&&_0x2c4934!=='0'&&_0x2c4934!=='-1'&&_0x2c4934!=='';};AGIVertices['prototype'][_0xe4c4('0xa9')]=function(_0x115b8e){this[_0xe4c4('0x33')][_0xe4c4('0x6f')](this,_0x115b8e,'-');_0x115b8e[_0xe4c4('0xaa')]=_0x115b8e[_0xe4c4('0xa9')];return{'code':0xc8,'result':'-'};};AGIVertices['prototype'][_0xe4c4('0xab')]=function(_0x38226e){logger[_0xe4c4('0x2b')](util[_0xe4c4('0x26')](_0xe4c4('0xac'),_0x38226e[_0xe4c4('0xad')]));if(!this['isConfigured'](_0x38226e[_0xe4c4('0x5c')])){return this[_0xe4c4('0x34')]['noop'](_0xe4c4('0xae'));}var _0x16cd4d='\x22'+_0x38226e['text']+'\x22';if(this[_0xe4c4('0x88')](_0x38226e[_0xe4c4('0x79')])){_0x16cd4d+=','+_0x38226e['options'];}var _0x6d730e=this[_0xe4c4('0x34')][_0xe4c4('0x56')](_0xe4c4('0xaf'),_0x16cd4d);if(_0x6d730e['result']===-0x1){return _0x6d730e;}return this[_0xe4c4('0x34')][_0xe4c4('0xb0')](util[_0xe4c4('0x26')](_0xe4c4('0xb1'),_0x16cd4d));};AGIVertices[_0xe4c4('0x10')][_0xe4c4('0xb2')]=function(_0x129147){logger[_0xe4c4('0x2b')](util[_0xe4c4('0x26')]('Enter\x20in\x20MRCPRecog\x20(%s)\x20block',_0x129147['label']));if(!this['isConfigured'](_0x129147[_0xe4c4('0xb3')])){return this[_0xe4c4('0x34')][_0xe4c4('0xb0')]('no\x20grammar\x20configured');}var _0x33e8a7=_0x129147[_0xe4c4('0xb3')];if(this[_0xe4c4('0x88')](_0x129147[_0xe4c4('0x79')])){_0x33e8a7+=','+_0x129147[_0xe4c4('0x79')];}var _0x312088=this[_0xe4c4('0x34')][_0xe4c4('0x56')](_0xe4c4('0xb4'),_0x33e8a7);if(_0x312088['result']===-0x1){return _0x312088;}var _0x358aee=this[_0xe4c4('0xa6')](_0xe4c4('0xb5'),_0xe4c4('0xb6'));if(_0x358aee[_0xe4c4('0xa7')]===-0x1){return _0x358aee;}var _0x249246=this[_0xe4c4('0xa6')](_0xe4c4('0xb7'),_0xe4c4('0xb8'));if(_0x249246[_0xe4c4('0xa7')]===-0x1){return _0x249246;}var _0x37bffe=this['getAndSetVariable'](_0xe4c4('0xb9'),_0xe4c4('0xba'));if(_0x37bffe['result']===-0x1){return _0x37bffe;}return this[_0xe4c4('0x34')][_0xe4c4('0xb0')](util[_0xe4c4('0x26')](_0xe4c4('0xbb'),_0x33e8a7));};AGIVertices[_0xe4c4('0x10')]['agi']=function(_0x4ea739){logger[_0xe4c4('0x2b')](util[_0xe4c4('0x26')](_0xe4c4('0xbc'),_0x4ea739[_0xe4c4('0xad')]));return this[_0xe4c4('0x34')]['agi']([_0x4ea739['command'],_0x4ea739[_0xe4c4('0xbd')]]);};AGIVertices[_0xe4c4('0x10')][_0xe4c4('0xbe')]=function(_0x1ab570){logger[_0xe4c4('0x2b')](util[_0xe4c4('0x26')]('Enter\x20in\x20ANSWER\x20(%s)\x20block',_0x1ab570['label']));if(this['isConfigured'](_0x1ab570[_0xe4c4('0x65')])){logger['info'](util[_0xe4c4('0x26')](_0xe4c4('0xbf'),_0x1ab570[_0xe4c4('0x65')]));var _0x28c69e=this[_0xe4c4('0x34')][_0xe4c4('0xc0')](_0x1ab570['timeout']);if(_0x28c69e['result']===-0x1){return _0x28c69e;}}return this[_0xe4c4('0x34')][_0xe4c4('0xbe')]();};AGIVertices[_0xe4c4('0x10')]['callback']=function(_0x3fb585){logger[_0xe4c4('0x2b')](util[_0xe4c4('0x26')](_0xe4c4('0xc1'),_0x3fb585['label']));if(!this[_0xe4c4('0x88')](_0x3fb585[_0xe4c4('0x48')])){return this[_0xe4c4('0x34')]['error'](_0x3fb585,_0xe4c4('0xc2'));}_0x3fb585['scheduledAt']=moment();if(this[_0xe4c4('0x88')](_0x3fb585[_0xe4c4('0xc3')])){_0x3fb585[_0xe4c4('0x49')]=moment()[_0xe4c4('0xc4')](_0x3fb585[_0xe4c4('0xc3')],_0xe4c4('0xc5'));}if(!this['isConfigured'](_0x3fb585[_0xe4c4('0x4c')])){_0x3fb585[_0xe4c4('0x4c')]=0x2;}this[_0xe4c4('0x41')][_0xe4c4('0x6f')](this,_0x3fb585);return this[_0xe4c4('0x34')][_0xe4c4('0xb0')](util['format']('CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s',_0x3fb585[_0xe4c4('0x47')],_0x3fb585['list_id'],_0x3fb585['scheduledAt']));};AGIVertices[_0xe4c4('0x10')][_0xe4c4('0xc6')]=function(_0x5068fd){logger[_0xe4c4('0x2b')](util[_0xe4c4('0x26')](_0xe4c4('0xc7'),_0x5068fd[_0xe4c4('0xad')]));var _0x530b01=this[_0xe4c4('0x34')]['exec'](_0x5068fd[_0xe4c4('0xc8')],_0x5068fd['options']);if(_0x530b01['result']===-0x1){return _0x530b01;}return this[_0xe4c4('0x34')]['noop'](util[_0xe4c4('0x26')](_0xe4c4('0xc9'),_0x5068fd[_0xe4c4('0xc8')],_0x5068fd[_0xe4c4('0x79')]));};AGIVertices[_0xe4c4('0x10')][_0xe4c4('0xca')]=function(_0x28bbbe){logger[_0xe4c4('0x2b')](util[_0xe4c4('0x26')]('Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block',_0x28bbbe[_0xe4c4('0xad')]));if(!this['isConfigured'](_0x28bbbe[_0xe4c4('0x5c')])){return this[_0xe4c4('0x34')][_0xe4c4('0xb0')](_0xe4c4('0xae'));}var _0xb70c10='\x22'+_0x28bbbe[_0xe4c4('0x5c')]+'\x22';if(this[_0xe4c4('0x88')](_0x28bbbe['options'])){_0xb70c10+=','+_0x28bbbe['options'];}var _0x39938f=this['channel']['exec']('MRCPSynth',_0xb70c10);if(_0x39938f['result']===-0x1){return _0x39938f;}return this['channel'][_0xe4c4('0xb0')](util[_0xe4c4('0x26')](_0xe4c4('0xb1'),_0xb70c10));};AGIVertices[_0xe4c4('0x10')][_0xe4c4('0xcb')]=function(_0x336cbb){logger[_0xe4c4('0x2b')](util[_0xe4c4('0x26')]('Enter\x20in\x20SESTEKTTS\x20(%s)\x20block',_0x336cbb['label']));if(!this[_0xe4c4('0x88')](_0x336cbb[_0xe4c4('0x5c')])){return this[_0xe4c4('0x34')][_0xe4c4('0xb0')](_0xe4c4('0xae'));}var _0x3d0bcb='\x22'+_0x336cbb[_0xe4c4('0x5c')]+'\x22';if(this[_0xe4c4('0x88')](_0x336cbb[_0xe4c4('0x79')])){_0x3d0bcb+=','+_0x336cbb[_0xe4c4('0x79')];}var _0x941bb4=this[_0xe4c4('0x34')]['exec']('MRCPSynth',_0x3d0bcb);if(_0x941bb4['result']===-0x1){return _0x941bb4;}return this[_0xe4c4('0x34')][_0xe4c4('0xb0')](util[_0xe4c4('0x26')]('Executed\x20command\x20MRCPSynth\x20%s',_0x3d0bcb));};AGIVertices['prototype'][_0xe4c4('0xcc')]=function(_0x1a83d1){logger['info'](util['format'](_0xe4c4('0xcd'),_0x1a83d1[_0xe4c4('0xad')]));if(!this[_0xe4c4('0x88')](_0x1a83d1[_0xe4c4('0xb3')])){return this[_0xe4c4('0x34')]['noop'](_0xe4c4('0xce'));}var _0x3aed6e=_0x1a83d1[_0xe4c4('0xb3')];if(this[_0xe4c4('0x88')](_0x1a83d1[_0xe4c4('0x79')])){_0x3aed6e+=','+_0x1a83d1['options'];}var _0xcba7e3=this[_0xe4c4('0x34')][_0xe4c4('0x56')](_0xe4c4('0xb4'),_0x3aed6e);if(_0xcba7e3[_0xe4c4('0xa7')]===-0x1){return _0xcba7e3;}var _0x14e75f=this[_0xe4c4('0xa6')](_0xe4c4('0xb5'),'LUMENVOX_ASR_CONFIDENCE');if(_0x14e75f[_0xe4c4('0xa7')]===-0x1){return _0x14e75f;}var _0x1d1a85=this[_0xe4c4('0xa6')](_0xe4c4('0xb7'),_0xe4c4('0xcf'));if(_0x1d1a85[_0xe4c4('0xa7')]===-0x1){return _0x1d1a85;}var _0xe562ba=this[_0xe4c4('0xa6')](_0xe4c4('0xb9'),_0xe4c4('0xd0'));if(_0xe562ba['result']===-0x1){return _0xe562ba;}return this[_0xe4c4('0x34')][_0xe4c4('0xb0')](util['format']('Executed\x20command\x20MRCPRecog\x20%s',_0x3aed6e));};AGIVertices[_0xe4c4('0x10')][_0xe4c4('0xd1')]=function(_0x4e00ce){logger['info'](util[_0xe4c4('0x26')](_0xe4c4('0xd2'),_0x4e00ce['label']));if(!this[_0xe4c4('0x88')](_0x4e00ce[_0xe4c4('0xb3')])){return this[_0xe4c4('0x34')][_0xe4c4('0xb0')](_0xe4c4('0xce'));}var _0x2b3fb8=_0x4e00ce[_0xe4c4('0xb3')];if(this[_0xe4c4('0x88')](_0x4e00ce[_0xe4c4('0x79')])){_0x2b3fb8+=','+_0x4e00ce['options'];}var _0x2b660c=this[_0xe4c4('0x34')]['exec'](_0xe4c4('0xb4'),_0x2b3fb8);if(_0x2b660c[_0xe4c4('0xa7')]===-0x1){return _0x2b660c;}var _0x429a75=this[_0xe4c4('0xa6')](_0xe4c4('0xb5'),_0xe4c4('0xd3'));if(_0x429a75[_0xe4c4('0xa7')]===-0x1){return _0x429a75;}var _0x3ebb65=this['getAndSetVariable']('RECOG_INPUT()',_0xe4c4('0xd4'));if(_0x3ebb65[_0xe4c4('0xa7')]===-0x1){return _0x3ebb65;}var _0x51bf29=this['getAndSetVariable'](_0xe4c4('0xb9'),_0xe4c4('0xd5'));if(_0x51bf29[_0xe4c4('0xa7')]===-0x1){return _0x51bf29;}return this[_0xe4c4('0x34')][_0xe4c4('0xb0')](util['format'](_0xe4c4('0xbb'),_0x2b3fb8));};AGIVertices[_0xe4c4('0x10')]['database']=function(_0x3ced45){logger[_0xe4c4('0x2b')](util['format'](_0xe4c4('0xd6'),_0x3ced45[_0xe4c4('0xad')]));if(!this[_0xe4c4('0x88')](_0x3ced45['odbc_id'])){return this[_0xe4c4('0x34')]['error'](_0x3ced45,_0xe4c4('0xd7'));}var _0x442410=this[_0xe4c4('0xd8')]['sync'](this,_0x3ced45[_0xe4c4('0xd9')]);if(!_0x442410){return this[_0xe4c4('0x34')][_0xe4c4('0x29')](_0x3ced45,_0xe4c4('0xda'));}if(!this[_0xe4c4('0x88')](_0x3ced45[_0xe4c4('0x2d')])){return this[_0xe4c4('0x34')][_0xe4c4('0x29')](_0x3ced45,_0xe4c4('0xdb'));}var _0x315bbb=_0x3ced45['query'][_0xe4c4('0x58')](/(\r\n|\n|\r)/gm,'\x20');this[_0xe4c4('0x34')][_0xe4c4('0xb0')](util[_0xe4c4('0x26')](_0xe4c4('0xdc'),_0x315bbb));var _0xe1c20d=this[_0xe4c4('0xdd')][_0xe4c4('0x6f')](this,_0x442410,_0x315bbb);this[_0xe4c4('0x33')]['sync'](this,_0x3ced45,_0x315bbb);if(!this[_0xe4c4('0x88')](_0x3ced45[_0xe4c4('0xde')])){return this[_0xe4c4('0x34')][_0xe4c4('0xb0')](_0xe4c4('0xdf'));}var _0x17b5bc=this[_0xe4c4('0x11')][_0xe4c4('0x6f')](this,_0x3ced45[_0xe4c4('0xde')]);if(!_0x17b5bc){return this[_0xe4c4('0x34')][_0xe4c4('0x29')](_0x3ced45,_0xe4c4('0xe0'));}var _0x50bb6b=this;_0xe1c20d['forEach'](function(_0x5ed5b0,_0x3e1c4a){Object[_0xe4c4('0xe1')](_0x5ed5b0)['forEach'](function(_0x4f8bf1){_0x50bb6b['channel'][_0xe4c4('0xa2')](util['format'](_0xe4c4('0xe2'),_0x17b5bc,_0x3e1c4a,_0x4f8bf1),_0x5ed5b0[_0x4f8bf1]);});});this[_0xe4c4('0x34')][_0xe4c4('0xa2')](util[_0xe4c4('0x26')](_0xe4c4('0xe3'),_0x17b5bc),_0xe1c20d[_0xe4c4('0x9e')]);return this[_0xe4c4('0x34')][_0xe4c4('0xb0')](util[_0xe4c4('0x26')](_0xe4c4('0xe4'),_0x17b5bc));};AGIVertices[_0xe4c4('0x10')][_0xe4c4('0xe5')]=function(_0x4bea3e){logger[_0xe4c4('0xe6')](util[_0xe4c4('0x26')](_0xe4c4('0xe7'),_0x4bea3e['label']));if(!this[_0xe4c4('0x88')](_0x4bea3e[_0xe4c4('0xe8')])){return this['channel'][_0xe4c4('0x29')](_0x4bea3e,_0xe4c4('0xe9'));}var _0x353836=this[_0xe4c4('0x1b')][_0xe4c4('0x6f')](this,_0x4bea3e[_0xe4c4('0xe8')]);if(!_0x353836){return this[_0xe4c4('0x34')][_0xe4c4('0x29')](_0x4bea3e,'no\x20user\x20found');}var _0x4d091b=this[_0xe4c4('0x34')]['exec']('DIAL',[util[_0xe4c4('0x26')](_0xe4c4('0xea'),_0x353836),_0x4bea3e[_0xe4c4('0x65')],_0x4bea3e[_0xe4c4('0xeb')],_0x4bea3e[_0xe4c4('0x64')]]);if(_0x4d091b['result']===-0x1){return _0x4d091b;}return this['channel'][_0xe4c4('0xb0')](util[_0xe4c4('0x26')](_0xe4c4('0xec'),_0xe4c4('0xed')));};AGIVertices[_0xe4c4('0x10')][_0xe4c4('0xee')]=function(_0x570dd2){logger[_0xe4c4('0x2b')](util[_0xe4c4('0x26')](_0xe4c4('0xef'),_0x570dd2[_0xe4c4('0xad')]));if(!this[_0xe4c4('0x88')](_0x570dd2[_0xe4c4('0x7b')])){return this[_0xe4c4('0x34')][_0xe4c4('0xb0')](_0xe4c4('0xf0'));}if(!this[_0xe4c4('0x88')](_0x570dd2[_0xe4c4('0x5c')])){return this[_0xe4c4('0x34')][_0xe4c4('0xb0')](_0xe4c4('0xae'));}this[_0xe4c4('0x34')][_0xe4c4('0xf1')]=!![];this[_0xe4c4('0x33')](_0x570dd2);this[_0xe4c4('0x40')](_0x570dd2[_0xe4c4('0x5c')],'in','','');this[_0xe4c4('0x34')][_0xe4c4('0xb0')](util[_0xe4c4('0x26')](_0xe4c4('0xf2'),_0x570dd2[_0xe4c4('0x5c')]));var _0x30bbb9=this['googleDialogflow'][_0xe4c4('0x6f')](this,_0x570dd2);if(_0x30bbb9){for(var _0x129997 in _0x30bbb9){if(_0x30bbb9[_0xe4c4('0xf3')](_0x129997)){this['channel']['setVariable'](util['format'](_0xe4c4('0xf4'),_0x129997[_0xe4c4('0x69')]()),_0x30bbb9[_0x129997]);}}this[_0xe4c4('0x40')](_0x30bbb9[_0xe4c4('0xf5')],_0xe4c4('0xf6'),'dialogflow','');return this['channel'][_0xe4c4('0xb0')](util[_0xe4c4('0x26')](_0xe4c4('0xf7'),_0x30bbb9['speech']));}return this[_0xe4c4('0x34')][_0xe4c4('0x29')](_0x570dd2,_0xe4c4('0xf8'));};AGIVertices['prototype'][_0xe4c4('0xf9')]=function(_0x48ebb6){logger['info'](util[_0xe4c4('0x26')]('Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block',_0x48ebb6[_0xe4c4('0xad')]));if(!this[_0xe4c4('0x88')](_0x48ebb6[_0xe4c4('0x7e')])){return this['channel'][_0xe4c4('0xb0')](_0xe4c4('0xfa'));}if(!this[_0xe4c4('0x88')](_0x48ebb6[_0xe4c4('0x7f')])){return this[_0xe4c4('0x34')][_0xe4c4('0xb0')](_0xe4c4('0xfb'));}if(!this[_0xe4c4('0x88')](_0x48ebb6[_0xe4c4('0x80')])){return this[_0xe4c4('0x34')][_0xe4c4('0xb0')](_0xe4c4('0xfc'));}if(!this['isConfigured'](_0x48ebb6[_0xe4c4('0x81')])){return this[_0xe4c4('0x34')][_0xe4c4('0xb0')](_0xe4c4('0xfd'));}if(!this[_0xe4c4('0x88')](_0x48ebb6['text'])){return this[_0xe4c4('0x34')][_0xe4c4('0xb0')](_0xe4c4('0xae'));}this['channel'][_0xe4c4('0xf1')]=!![];this[_0xe4c4('0x33')](_0x48ebb6);this[_0xe4c4('0x40')](_0x48ebb6[_0xe4c4('0x5c')],'in','','');this[_0xe4c4('0x34')][_0xe4c4('0xb0')](util[_0xe4c4('0x26')](_0xe4c4('0xfe'),_0x48ebb6[_0xe4c4('0x5c')]));var _0x53aeaa=this[_0xe4c4('0x7d')][_0xe4c4('0x6f')](this,_0x48ebb6);if(_0x53aeaa){for(var _0x378b0b in _0x53aeaa){if(_0x53aeaa[_0xe4c4('0xf3')](_0x378b0b)){if(_0x378b0b!==_0xe4c4('0xff')){this[_0xe4c4('0x34')]['setVariable'](util[_0xe4c4('0x26')](_0xe4c4('0xf4'),_0x378b0b[_0xe4c4('0x69')]()),_0x53aeaa[_0x378b0b]);}}}this['createSquareMessage'](_0x53aeaa[_0xe4c4('0xf5')],_0xe4c4('0xf6'),_0xe4c4('0xf9'),_0x53aeaa['providerResponse']);return this['channel'][_0xe4c4('0xb0')](util[_0xe4c4('0x26')](_0xe4c4('0x100'),_0x53aeaa['speech']));}return this[_0xe4c4('0x34')][_0xe4c4('0x29')](_0x48ebb6,_0xe4c4('0x101'));};AGIVertices['prototype'][_0xe4c4('0x102')]=function(_0x23d5d5){logger[_0xe4c4('0x2b')](util[_0xe4c4('0x26')](_0xe4c4('0x103'),_0x23d5d5[_0xe4c4('0xad')]));if(!this['isConfigured'](_0x23d5d5[_0xe4c4('0x104')])){return this[_0xe4c4('0x34')][_0xe4c4('0xb0')](_0xe4c4('0x105'));}if(!this[_0xe4c4('0x88')](_0x23d5d5[_0xe4c4('0x106')])){return this[_0xe4c4('0x34')][_0xe4c4('0xb0')](_0xe4c4('0x107'));}if(!this[_0xe4c4('0x88')](_0x23d5d5['password'])){return this[_0xe4c4('0x34')]['noop'](_0xe4c4('0x108'));}if(!this['isConfigured'](_0x23d5d5[_0xe4c4('0x109')])){return this['channel']['noop'](_0xe4c4('0xae'));}this[_0xe4c4('0x34')][_0xe4c4('0xf1')]=!![];this[_0xe4c4('0x33')](_0x23d5d5);this[_0xe4c4('0x40')](_0x23d5d5[_0xe4c4('0x5c')],'in','','');this[_0xe4c4('0x34')][_0xe4c4('0xb0')](util[_0xe4c4('0x26')](_0xe4c4('0x10a'),_0x23d5d5[_0xe4c4('0x5c')]));var _0x2f5786=this[_0xe4c4('0x82')]['sync'](this,_0x23d5d5);if(_0x2f5786){for(var _0x25c8aa in _0x2f5786){if(_0x2f5786[_0xe4c4('0xf3')](_0x25c8aa)){this[_0xe4c4('0x34')]['setVariable'](util[_0xe4c4('0x26')](_0xe4c4('0x10b'),_0x25c8aa['toUpperCase']()),_0x2f5786[_0x25c8aa]);}}this[_0xe4c4('0x40')](_0x2f5786['speech'],_0xe4c4('0xf6'),_0xe4c4('0x102'),'');if(_0x2f5786['audiofile']){this[_0xe4c4('0x34')][_0xe4c4('0xb0')](util[_0xe4c4('0x26')](_0xe4c4('0x10c'),_0x2f5786[_0xe4c4('0x10d')]));var _0x257ffc=this[_0xe4c4('0x34')][_0xe4c4('0x10e')](_0x2f5786[_0xe4c4('0x10d')]);try{fs[_0xe4c4('0x10f')](_0x2f5786[_0xe4c4('0x10d')]+_0xe4c4('0x110'));}catch(_0x307198){logger[_0xe4c4('0x29')](_0x307198);}return _0x257ffc;}else{return this[_0xe4c4('0x34')][_0xe4c4('0xb0')](util['format']('SestekNDA\x20Result\x20%s',_0x2f5786[_0xe4c4('0xf5')]));}}return this[_0xe4c4('0x34')]['error'](_0x23d5d5,_0xe4c4('0x111'));};AGIVertices['prototype'][_0xe4c4('0x112')]=function(_0x4f78a6){logger[_0xe4c4('0x2b')](util[_0xe4c4('0x26')](_0xe4c4('0x113'),_0x4f78a6[_0xe4c4('0xad')]));return this[_0xe4c4('0x34')][_0xe4c4('0xb0')](_0xe4c4('0x112'));};AGIVertices[_0xe4c4('0x10')][_0xe4c4('0x114')]=function(_0x3a2f5d){logger['info'](util[_0xe4c4('0x26')]('Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block',_0x3a2f5d[_0xe4c4('0xad')]));var _0x3c04d4='';if(_0x3a2f5d[_0xe4c4('0x115')]){if(!this[_0xe4c4('0x88')](_0x3a2f5d[_0xe4c4('0x115')])){return this[_0xe4c4('0x34')][_0xe4c4('0x29')](_0x3a2f5d,_0xe4c4('0x116'));}else{var _0x3ecd64=parseInt(_0x3a2f5d[_0xe4c4('0x115')],0xa);if(isNaN(_0x3ecd64)){_0x3c04d4=_0x3a2f5d['trunk_id'];}else{_0x3c04d4=this['getTrunk']['sync'](this,_0x3a2f5d[_0xe4c4('0x115')]);if(!_0x3c04d4){return this[_0xe4c4('0x34')]['error'](_0x3a2f5d,'no\x20trunk\x20found');}}}}else if(_0x3a2f5d['trunk_name']){_0x3c04d4=_0x3a2f5d[_0xe4c4('0x117')];}else{return this[_0xe4c4('0x34')][_0xe4c4('0x29')](_0x3a2f5d,_0xe4c4('0x116'));}var _0x29f7cc=this[_0xe4c4('0x34')]['exec'](_0xe4c4('0xed'),[util['format'](_0xe4c4('0x118'),_0x3c04d4,_0x3a2f5d[_0xe4c4('0x47')]),_0x3a2f5d['timeout'],_0x3a2f5d[_0xe4c4('0xeb')],_0x3a2f5d[_0xe4c4('0x64')]]);if(_0x29f7cc[_0xe4c4('0xa7')]===-0x1){return _0x29f7cc;}return this[_0xe4c4('0x34')][_0xe4c4('0xb0')](util[_0xe4c4('0x26')](_0xe4c4('0xec'),_0xe4c4('0xed')));};AGIVertices[_0xe4c4('0x10')][_0xe4c4('0x119')]=function(_0x4da9ef){logger['info'](util[_0xe4c4('0x26')]('Enter\x20in\x20FINALLY\x20(%s)\x20block',_0x4da9ef['label']));return this[_0xe4c4('0x34')][_0xe4c4('0xb0')](_0xe4c4('0x119'));};AGIVertices[_0xe4c4('0x10')][_0xe4c4('0xc')]=function(_0x466cbd){logger[_0xe4c4('0x2b')](util['format'](_0xe4c4('0x11a'),_0x466cbd[_0xe4c4('0xad')]));if(_0x466cbd['retry']===0x0){return this[_0xe4c4('0xa9')](_0x466cbd);}_0x466cbd[_0xe4c4('0xaa')]-=0x1;if(!this[_0xe4c4('0x88')](_0x466cbd['file_id'])){return this[_0xe4c4('0x34')][_0xe4c4('0x29')](_0x466cbd,_0xe4c4('0x11b'));}var _0x299bbf=this[_0xe4c4('0x11c')]['sync'](this,_0x466cbd['file_id']);if(!_0x299bbf){return this[_0xe4c4('0x34')]['error'](_0x466cbd,_0xe4c4('0x11d'));}if(!this[_0xe4c4('0x88')](_0x466cbd[_0xe4c4('0xde')])){return this['channel']['error'](_0xe4c4('0xdf'));}var _0x34698a=this['channel'][_0xe4c4('0x11e')](_0x299bbf,_0x466cbd[_0xe4c4('0x11f')],_0x466cbd[_0xe4c4('0x120')]);var _0x44fcbc=_0x34698a[_0xe4c4('0xa7')]?_0x34698a[_0xe4c4('0xa7')][_0xe4c4('0xa5')]():'';logger[_0xe4c4('0x2b')](_0xe4c4('0x121'),JSON[_0xe4c4('0x72')](_0x34698a));if(_0x34698a[_0xe4c4('0xa7')]===-0x1){this['createSquareDetailsReport'][_0xe4c4('0x6f')](this,_0x466cbd,_0x44fcbc);return _0x34698a;}else if(_0x34698a[_0xe4c4('0xa4')]==='timeout'){_0x34698a['result']=_0x44fcbc[_0xe4c4('0x9e')]>=parseInt(_0x466cbd['mindigit'])?'x':'i';}else{_0x34698a[_0xe4c4('0xa7')]=_0x44fcbc[_0xe4c4('0x9e')]>=parseInt(_0x466cbd['mindigit'])&&_0x44fcbc[_0xe4c4('0x9e')]<=parseInt(_0x466cbd[_0xe4c4('0x120')])?'x':'i';}var _0x30a80b=this[_0xe4c4('0x11')]['sync'](this,_0x466cbd[_0xe4c4('0xde')]);if(!_0x30a80b){return this[_0xe4c4('0x34')][_0xe4c4('0x29')](_0x466cbd,_0xe4c4('0xe0'));}this[_0xe4c4('0x34')][_0xe4c4('0xa2')](_0x30a80b,_0x44fcbc);if(this['isConfigured'](_0x466cbd['hiddendigitsnum'])){var _0x496744=parseInt(_0x466cbd[_0xe4c4('0x122')],0xa);var _0x2712fa=rs[_0xe4c4('0x123')]({'charset':'*','length':_0x496744});var _0x5592fe=_0x44fcbc['length'];if(_0x5592fe>0x0){if(_0x5592fe>_0x496744){this['createSquareDetailsReport'][_0xe4c4('0x6f')](this,_0x466cbd,_0x466cbd[_0xe4c4('0x124')]===_0xe4c4('0x125')?_0x2712fa+_0x44fcbc[_0xe4c4('0x126')](_0x496744):_0x44fcbc[_0xe4c4('0x126')](0x0,_0x5592fe-_0x496744)+_0x2712fa);}else{this['createSquareDetailsReport'][_0xe4c4('0x6f')](this,_0x466cbd,rs[_0xe4c4('0x123')]({'charset':'*','length':_0x5592fe}));}}else{this[_0xe4c4('0x33')][_0xe4c4('0x6f')](this,_0x466cbd,'');}}else{this[_0xe4c4('0x33')][_0xe4c4('0x6f')](this,_0x466cbd,_0x44fcbc);}return _0x34698a;};AGIVertices[_0xe4c4('0x10')][_0xe4c4('0xd')]=function(_0x1a789c){logger[_0xe4c4('0x2b')](util[_0xe4c4('0x26')]('Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block',_0x1a789c[_0xe4c4('0xad')]));return this[_0xe4c4('0xc')](_0x1a789c);};AGIVertices[_0xe4c4('0x10')][_0xe4c4('0x127')]=function(_0x5cb031){logger['info'](util[_0xe4c4('0x26')](_0xe4c4('0x128'),_0x5cb031['label']));this[_0xe4c4('0x33')]['sync'](this,_0x5cb031,_0x5cb031['goalname']);return this[_0xe4c4('0x34')]['noop'](util[_0xe4c4('0x26')](_0xe4c4('0x129'),_0x5cb031[_0xe4c4('0x12a')]));};AGIVertices[_0xe4c4('0x10')]['awspolly']=function(_0x159193){logger[_0xe4c4('0x2b')](util[_0xe4c4('0x26')](_0xe4c4('0x12b'),_0x159193[_0xe4c4('0xad')]));if(!this['isConfigured'](_0x159193[_0xe4c4('0x90')])||!this[_0xe4c4('0x88')](_0x159193[_0xe4c4('0x12c')])){return this[_0xe4c4('0x34')]['noop'](_0xe4c4('0x12d'));}if(!this[_0xe4c4('0x88')](_0x159193[_0xe4c4('0x5c')])){return this[_0xe4c4('0x34')]['noop'](_0xe4c4('0xae'));}this[_0xe4c4('0x34')]['noop'](util['format']('Trying\x20aws\x20Polly\x20%s',_0x159193[_0xe4c4('0x5c')]));var _0x2d4e9d=this['awsPolly'][_0xe4c4('0x6f')](this,_0x159193);if(_0x2d4e9d){this[_0xe4c4('0x34')][_0xe4c4('0xb0')](util['format'](_0xe4c4('0x12e'),_0x2d4e9d));var _0x11822e=this[_0xe4c4('0x34')]['streamFile'](_0x2d4e9d);try{fs[_0xe4c4('0x10f')](_0x2d4e9d+_0xe4c4('0x110'));}catch(_0xdad7a8){logger[_0xe4c4('0x29')](_0xdad7a8);}return _0x11822e;}return this[_0xe4c4('0x34')][_0xe4c4('0x29')](_0x159193,'aws\x20Polly\x20is\x20unreachable');};AGIVertices[_0xe4c4('0x10')][_0xe4c4('0x12f')]=function(_0x2ca7ef){logger[_0xe4c4('0x2b')](util[_0xe4c4('0x26')](_0xe4c4('0x130'),_0x2ca7ef['label']));if(!this[_0xe4c4('0x88')](_0x2ca7ef['aws_access_key_id'])||!this[_0xe4c4('0x88')](_0x2ca7ef[_0xe4c4('0x12c')])){return this[_0xe4c4('0x34')][_0xe4c4('0xb0')](_0xe4c4('0x12d'));}if(!this[_0xe4c4('0x88')](_0x2ca7ef[_0xe4c4('0x92')])){return this[_0xe4c4('0x34')][_0xe4c4('0xb0')](_0xe4c4('0x131'));}if(!this['isConfigured'](_0x2ca7ef['text'])){return this[_0xe4c4('0x34')][_0xe4c4('0xb0')](_0xe4c4('0xae'));}this[_0xe4c4('0x34')][_0xe4c4('0xf1')]=!![];this[_0xe4c4('0x33')](_0x2ca7ef);this['createSquareMessage'](_0x2ca7ef[_0xe4c4('0x5c')],'in','','');this[_0xe4c4('0x34')][_0xe4c4('0xb0')](util[_0xe4c4('0x26')](_0xe4c4('0x132'),_0x2ca7ef[_0xe4c4('0x5c')]));var _0x1ca7be=this[_0xe4c4('0x8f')]['sync'](this,_0x2ca7ef);if(_0x1ca7be){for(var _0x425371 in _0x1ca7be){if(_0x1ca7be[_0xe4c4('0xf3')](_0x425371)&&_[_0xe4c4('0x99')](_0x1ca7be[_0x425371])){this[_0xe4c4('0x34')][_0xe4c4('0xa2')](util[_0xe4c4('0x26')](_0xe4c4('0x133'),_0x425371[_0xe4c4('0x69')]()),_0x1ca7be[_0x425371]);}}if(_[_0xe4c4('0x43')](_0x1ca7be[_0xe4c4('0x77')])){return this['channel']['noop'](_0xe4c4('0x134'));}else{this[_0xe4c4('0x40')](_0x1ca7be[_0xe4c4('0x77')],_0xe4c4('0xf6'),'amazonlex','');return this[_0xe4c4('0x34')][_0xe4c4('0xb0')](util['format'](_0xe4c4('0x135'),_0x1ca7be['message']));}}return this[_0xe4c4('0x34')][_0xe4c4('0x29')](_0x2ca7ef,_0xe4c4('0x136'));};AGIVertices[_0xe4c4('0x10')]['googleasr']=function(_0x125be8){logger[_0xe4c4('0x2b')](util[_0xe4c4('0x26')](_0xe4c4('0x137'),_0x125be8['label'],_0x125be8['timeout']));if(!this['isConfigured'](_0x125be8[_0xe4c4('0x7b')])){return this[_0xe4c4('0x34')][_0xe4c4('0xb0')](_0xe4c4('0xf0'));}var _0x5e7645=_0xe4c4('0x138');var _0x4cbd84=util['format'](_0xe4c4('0x139'),FILES_PATH,rs[_0xe4c4('0x123')](0x4));var _0x538772=util[_0xe4c4('0x26')](_0xe4c4('0xa1'),_0x4cbd84,_0x5e7645);var _0x11c105=!![];if(_0x125be8[_0xe4c4('0x13a')]===_0xe4c4('0x13b')){_0x11c105=![];}var _0x3219f9=this[_0xe4c4('0x34')][_0xe4c4('0x13c')](_0x4cbd84,_0x5e7645,_0x125be8['intKey'],_0x125be8[_0xe4c4('0x65')],undefined,_0x11c105);if(_0x3219f9[_0xe4c4('0xa7')]!==-0x1){this[_0xe4c4('0x34')][_0xe4c4('0xb0')](util[_0xe4c4('0x26')]('google\x20%s\x20file\x20created',_0x538772));var _0x54a110=this[_0xe4c4('0x93')][_0xe4c4('0x6f')](this,_0x125be8,_0x538772);if(_0x54a110){for(var _0x2f9531 in _0x54a110){if(_0x54a110[_0xe4c4('0xf3')](_0x2f9531)){this[_0xe4c4('0x34')][_0xe4c4('0xa2')](util['format']('GOOGLE_ASR_%s',_0x2f9531[_0xe4c4('0x69')]()),_0x54a110[_0x2f9531]);}}return this[_0xe4c4('0x34')][_0xe4c4('0xb0')](util[_0xe4c4('0x26')](_0xe4c4('0x13d'),JSON[_0xe4c4('0x72')](_0x54a110)));}}return _0x3219f9;};AGIVertices[_0xe4c4('0x10')][_0xe4c4('0x13e')]=function(_0x1d039d){logger[_0xe4c4('0x2b')](util[_0xe4c4('0x26')](_0xe4c4('0x13f'),_0x1d039d[_0xe4c4('0xad')]));if(!this[_0xe4c4('0x88')](_0x1d039d[_0xe4c4('0x95')])){return this[_0xe4c4('0x34')]['noop']('no\x20appid\x20configured');}if(!this['isConfigured'](_0x1d039d['appsecret'])){return this['channel']['noop'](_0xe4c4('0x140'));}var _0x2bda6e=_0xe4c4('0x138');var _0x4c050d=util[_0xe4c4('0x26')](_0xe4c4('0x139'),FILES_PATH,rs[_0xe4c4('0x123')](0x4));var _0x17fa1e=util[_0xe4c4('0x26')]('%s.%s',_0x4c050d,_0x2bda6e);var _0x303345=!![];if(_0x1d039d[_0xe4c4('0x13a')]==='NOBEEP'){_0x303345=![];}var _0x1b58b2=this['channel']['recordFile'](_0x4c050d,_0x2bda6e,_0x1d039d[_0xe4c4('0x141')],_0x1d039d[_0xe4c4('0x65')],undefined,_0x303345);if(_0x1b58b2[_0xe4c4('0xa7')]!==-0x1){this['channel']['noop'](util[_0xe4c4('0x26')]('tilde\x20%s\x20file\x20created',_0x17fa1e));var _0x4ba7a1=this['tildeASR'][_0xe4c4('0x6f')](this,_0x1d039d,_0x17fa1e);if(_0x4ba7a1){for(var _0x4cf36a in _0x4ba7a1){if(_0x4ba7a1['hasOwnProperty'](_0x4cf36a)){this[_0xe4c4('0x34')][_0xe4c4('0xa2')](util[_0xe4c4('0x26')](_0xe4c4('0x142'),_0x4cf36a[_0xe4c4('0x69')]()),_0x4ba7a1[_0x4cf36a]);}}return this['channel'][_0xe4c4('0xb0')](util[_0xe4c4('0x26')](_0xe4c4('0x143'),JSON[_0xe4c4('0x72')](_0x4ba7a1)));}}return _0x1b58b2;};AGIVertices[_0xe4c4('0x10')]['gotoc']=function(_0xd23315){logger[_0xe4c4('0x2b')](util[_0xe4c4('0x26')]('Enter\x20in\x20GOTO\x20(%s)\x20block',_0xd23315['label']));return this[_0xe4c4('0x34')][_0xe4c4('0x144')](_0xd23315[_0xe4c4('0x3a')],_0xd23315[_0xe4c4('0x3b')],_0xd23315[_0xe4c4('0x3c')]);};AGIVertices['prototype'][_0xe4c4('0x145')]=function(_0x3a3120){logger[_0xe4c4('0x2b')](util['format'](_0xe4c4('0x146'),_0x3a3120[_0xe4c4('0xad')]));if(!this[_0xe4c4('0x88')](_0x3a3120[_0xe4c4('0x147')])){return this['channel'][_0xe4c4('0x29')](_0x3a3120,_0xe4c4('0x148'));}try{var _0x142b7e=eval(_0x3a3120[_0xe4c4('0x147')])?_0xe4c4('0x149'):_0xe4c4('0x14a');this[_0xe4c4('0x34')][_0xe4c4('0xb0')](util['format'](_0xe4c4('0x14b'),_0x3a3120[_0xe4c4('0x147')],_0x142b7e));return{'code':0xc8,'result':_0x142b7e};}catch(_0x56d15a){return{'code':0xc8,'result':'false'};}};AGIVertices['prototype'][_0xe4c4('0x14c')]=function(_0x4a596f){logger[_0xe4c4('0x2b')](util[_0xe4c4('0x26')](_0xe4c4('0x14d'),_0x4a596f[_0xe4c4('0xad')]));if(!this[_0xe4c4('0x88')](_0x4a596f[_0xe4c4('0x14e')])){return this[_0xe4c4('0x34')][_0xe4c4('0x29')](_0x4a596f,'no\x20interval\x20configured');}var _0x398b00=this[_0xe4c4('0x1f')][_0xe4c4('0x6f')](this,_0x4a596f[_0xe4c4('0x14e')]);if(!_0x398b00){return this[_0xe4c4('0x34')]['error'](_0x4a596f,_0xe4c4('0x14f'));}for(var _0x282d8e=0x0;_0x282d8e<_0x398b00[_0xe4c4('0x9e')];_0x282d8e+=0x1){var _0x3ef65d=this[_0xe4c4('0x34')][_0xe4c4('0x11')](util[_0xe4c4('0x26')](_0xe4c4('0x150'),_0x398b00[_0x282d8e]));if(_0x3ef65d['result']===-0x1){return _0x3ef65d;}logger['info'](util[_0xe4c4('0x26')](_0xe4c4('0x151'),_0x398b00[_0x282d8e],_0x3ef65d[_0xe4c4('0xa4')]));if(_0x3ef65d[_0xe4c4('0xa4')]===_0xe4c4('0x149')){logger[_0xe4c4('0x2b')](util[_0xe4c4('0x26')](_0xe4c4('0x151'),_0x398b00[_0x282d8e],_0xe4c4('0x149')));this['channel'][_0xe4c4('0xb0')](util['format'](_0xe4c4('0x151'),_0x398b00[_0x282d8e],_0xe4c4('0x149')));return{'code':0xc8,'result':_0xe4c4('0x149')};}else{logger['info'](util[_0xe4c4('0x26')]('IFTIME\x20%s\x20%s',_0x398b00[_0x282d8e],'false'));this['channel'][_0xe4c4('0xb0')](util['format'](_0xe4c4('0x151'),_0x398b00[_0x282d8e],_0xe4c4('0x14a')));}}return{'code':0xc8,'result':_0xe4c4('0x14a')};};AGIVertices['prototype']['hangup']=function(_0x4f49bf){logger[_0xe4c4('0x2b')](util['format'](_0xe4c4('0x152'),_0x4f49bf[_0xe4c4('0xad')]));return this[_0xe4c4('0x34')][_0xe4c4('0x153')]();};AGIVertices[_0xe4c4('0x10')][_0xe4c4('0x154')]=function(_0x52c902){logger['info'](util['format']('Enter\x20in\x20ISPEECHASR\x20(%s)\x20block',_0x52c902[_0xe4c4('0xad')]));if(!this[_0xe4c4('0x88')](_0x52c902[_0xe4c4('0x7b')])){return this['channel'][_0xe4c4('0xb0')](_0xe4c4('0xf0'));}var _0x1a7307=_0xe4c4('0x138');var _0x27b024=util['format'](_0xe4c4('0x139'),FILES_PATH,rs['generate'](0x4));var _0xcb13ba=util[_0xe4c4('0x26')](_0xe4c4('0xa1'),_0x27b024,_0x1a7307);var _0x19bb8b=!![];if(_0x52c902[_0xe4c4('0x13a')]===_0xe4c4('0x13b')){_0x19bb8b=![];}var _0xd1187a=this['channel'][_0xe4c4('0x13c')](_0x27b024,_0x1a7307,_0x52c902[_0xe4c4('0x141')],_0x52c902[_0xe4c4('0x65')],undefined,_0x19bb8b);if(_0xd1187a[_0xe4c4('0xa7')]!==-0x1){this['channel'][_0xe4c4('0xb0')](util['format'](_0xe4c4('0x155'),_0xcb13ba));var _0xf95d68=this[_0xe4c4('0x86')]['sync'](this,_0x52c902,_0xcb13ba);if(_0xf95d68){for(var _0x333252 in _0xf95d68){if(_0xf95d68['hasOwnProperty'](_0x333252)){this['channel']['setVariable'](util[_0xe4c4('0x26')](_0xe4c4('0x156'),_0x333252[_0xe4c4('0x69')]()),_0xf95d68[_0x333252]);}}return this[_0xe4c4('0x34')][_0xe4c4('0xb0')](util[_0xe4c4('0x26')](_0xe4c4('0x157'),JSON[_0xe4c4('0x72')](_0xf95d68)));}}return _0xd1187a;};AGIVertices[_0xe4c4('0x10')][_0xe4c4('0x158')]=function(_0x481af5){logger[_0xe4c4('0x2b')](util[_0xe4c4('0x26')](_0xe4c4('0x159'),_0x481af5[_0xe4c4('0xad')]));if(!this['isConfigured'](_0x481af5[_0xe4c4('0x7b')])){return this[_0xe4c4('0x34')][_0xe4c4('0xb0')](_0xe4c4('0xf0'));}if(!this['isConfigured'](_0x481af5[_0xe4c4('0x5c')])){return this['channel']['noop'](_0xe4c4('0xae'));}this[_0xe4c4('0x34')]['noop'](util[_0xe4c4('0x26')](_0xe4c4('0x15a'),_0x481af5[_0xe4c4('0x5c')]));var _0x1008bf=this[_0xe4c4('0x83')][_0xe4c4('0x6f')](this,_0x481af5);if(_0x1008bf){this[_0xe4c4('0x34')][_0xe4c4('0xb0')](util[_0xe4c4('0x26')]('ispeech\x20%s\x20file\x20created',_0x1008bf));var _0x4869f2=this['channel'][_0xe4c4('0x10e')](_0x1008bf,_0x481af5[_0xe4c4('0x141')]);try{fs[_0xe4c4('0x10f')](_0x1008bf+_0xe4c4('0x110'));}catch(_0x479947){logger[_0xe4c4('0x29')](_0x479947);}return _0x4869f2;}return this[_0xe4c4('0x34')]['error'](_0x481af5,_0xe4c4('0x15b'));};AGIVertices[_0xe4c4('0x10')][_0xe4c4('0x15c')]=function(_0x5842de){logger[_0xe4c4('0x2b')](util[_0xe4c4('0x26')](_0xe4c4('0x15d'),_0x5842de[_0xe4c4('0xad')]));if(!this['isConfigured'](_0x5842de[_0xe4c4('0x15e')])){return this[_0xe4c4('0x34')][_0xe4c4('0x29')](_0x5842de,_0xe4c4('0x15f'));}logger[_0xe4c4('0x2b')](util[_0xe4c4('0x26')](_0xe4c4('0x160'),this[_0xe4c4('0x34')][_0xe4c4('0x38')],_0x5842de[_0xe4c4('0x15e')]));var _0xe49be9=this[_0xe4c4('0x51')]['sync'](this,_0x5842de[_0xe4c4('0x15e')]);if(_0xe49be9){logger[_0xe4c4('0x2b')](util[_0xe4c4('0x26')](_0xe4c4('0x161'),this['channel'][_0xe4c4('0x38')],_0x5842de[_0xe4c4('0x15e')]));this[_0xe4c4('0x34')][_0xe4c4('0xb0')](util[_0xe4c4('0x26')](_0xe4c4('0x161'),this[_0xe4c4('0x34')][_0xe4c4('0x38')],_0x5842de[_0xe4c4('0x15e')]));return{'code':0xc8,'result':_0xe4c4('0x162')};}else{logger[_0xe4c4('0x2b')](util[_0xe4c4('0x26')](_0xe4c4('0x163'),this['channel'][_0xe4c4('0x38')],_0x5842de[_0xe4c4('0x15e')]));this[_0xe4c4('0x34')][_0xe4c4('0xb0')](util[_0xe4c4('0x26')](_0xe4c4('0x163'),this[_0xe4c4('0x34')][_0xe4c4('0x38')],_0x5842de[_0xe4c4('0x15e')]));return{'code':0xc8,'result':_0xe4c4('0x164')};}};AGIVertices[_0xe4c4('0x10')]['logout']=function(_0x256ef6){logger[_0xe4c4('0x2b')](util[_0xe4c4('0x26')](_0xe4c4('0x165'),_0x256ef6['label']));if(!this[_0xe4c4('0x88')](_0x256ef6[_0xe4c4('0x15e')])){return this[_0xe4c4('0x34')][_0xe4c4('0x29')](_0x256ef6,_0xe4c4('0x15f'));}logger['info'](util['format']('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0xe4c4('0x34')][_0xe4c4('0x38')],_0x256ef6[_0xe4c4('0x15e')]));var _0x307beb=this['agentLogout'][_0xe4c4('0x6f')](this,_0x256ef6['findBy']);if(_0x307beb){logger['info'](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0xe4c4('0x34')][_0xe4c4('0x38')],_0x256ef6[_0xe4c4('0x15e')]));this[_0xe4c4('0x34')][_0xe4c4('0xb0')](util[_0xe4c4('0x26')](_0xe4c4('0x161'),this['channel'][_0xe4c4('0x38')],_0x256ef6[_0xe4c4('0x15e')]));return{'code':0xc8,'result':_0xe4c4('0x162')};}else{logger[_0xe4c4('0x2b')](util['format'](_0xe4c4('0x163'),this[_0xe4c4('0x34')][_0xe4c4('0x38')],_0x256ef6['findBy']));this[_0xe4c4('0x34')][_0xe4c4('0xb0')](util[_0xe4c4('0x26')](_0xe4c4('0x163'),this['channel']['callerid'],_0x256ef6[_0xe4c4('0x15e')]));return{'code':0xc8,'result':'failure'};}};AGIVertices['prototype']['math']=function(_0x58938f){logger[_0xe4c4('0x2b')](util[_0xe4c4('0x26')]('Enter\x20in\x20MATH\x20(%s)\x20block',_0x58938f[_0xe4c4('0xad')]));if(!this[_0xe4c4('0x88')](_0x58938f['operation'])){return this[_0xe4c4('0x34')][_0xe4c4('0x29')](_0x58938f,_0xe4c4('0x166'));}this[_0xe4c4('0x34')]['noop'](util[_0xe4c4('0x26')](_0xe4c4('0x167'),_0x58938f['operation']));var _0x49af45=eval(_0x58938f[_0xe4c4('0x168')]);if(!this[_0xe4c4('0x88')](_0x58938f[_0xe4c4('0xde')])){return this[_0xe4c4('0x34')][_0xe4c4('0xb0')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x2eeb4e=this[_0xe4c4('0x11')][_0xe4c4('0x6f')](this,_0x58938f[_0xe4c4('0xde')]);if(!_0x2eeb4e){return this[_0xe4c4('0x34')][_0xe4c4('0x29')](_0x58938f,_0xe4c4('0xe0'));}if(_['isArray'](_0x49af45)){var _0x5022e7=this;_0x49af45[_0xe4c4('0x169')](function(_0x387653,_0x23f192){_0x5022e7[_0xe4c4('0x34')]['setVariable'](util[_0xe4c4('0x26')](_0xe4c4('0x16a'),_0x2eeb4e,_0x23f192),_0x387653);});return this[_0xe4c4('0x34')]['noop'](util['format']('variable\x20%s[key]\x20set',_0x2eeb4e));}else{return this[_0xe4c4('0x34')][_0xe4c4('0xa2')](_0x2eeb4e,_0x49af45);}};AGIVertices[_0xe4c4('0x10')][_0xe4c4('0xb')]=function(_0x1e8e10){logger[_0xe4c4('0x2b')](util[_0xe4c4('0x26')](_0xe4c4('0x16b'),_0x1e8e10[_0xe4c4('0xad')]));if(_0x1e8e10['retry']===0x0){return this[_0xe4c4('0xa9')](_0x1e8e10);}_0x1e8e10[_0xe4c4('0xaa')]-=0x1;if(!this[_0xe4c4('0x88')](_0x1e8e10[_0xe4c4('0x16c')])){return this['channel']['error'](_0x1e8e10,'no\x20file\x20audio\x20selected');}var _0xccbe0e=this[_0xe4c4('0x11c')][_0xe4c4('0x6f')](this,_0x1e8e10[_0xe4c4('0x16c')]);if(!_0xccbe0e){return this[_0xe4c4('0x34')][_0xe4c4('0x29')](_0x1e8e10,'no\x20file\x20audio\x20found');}var _0x29fbc7=this['channel']['getData'](_0xccbe0e,_0x1e8e10[_0xe4c4('0x11f')],_0x1e8e10[_0xe4c4('0x16d')]);var _0x197665=_0x29fbc7['result'];if(_0x29fbc7[_0xe4c4('0xa7')]===-0x1){this[_0xe4c4('0x33')][_0xe4c4('0x6f')](this,_0x1e8e10,'-1');return _0x29fbc7;}else if(_0x29fbc7[_0xe4c4('0xa4')]===_0xe4c4('0x65')){_0x29fbc7[_0xe4c4('0xa7')]=_0x29fbc7['result'][_0xe4c4('0x9e')]>0x0?_0x29fbc7[_0xe4c4('0xa7')]:'t';}else if(_[_0xe4c4('0x42')](_0x29fbc7[_0xe4c4('0xa7')])){_0x29fbc7['result']='#';_0x197665='#';}if(!this['isConfigured'](_0x1e8e10[_0xe4c4('0xde')])){this[_0xe4c4('0x34')][_0xe4c4('0xb0')]('no\x20variable\x20selected\x20for\x20the\x20result');}else{var _0x472247=this[_0xe4c4('0x11')][_0xe4c4('0x6f')](this,_0x1e8e10[_0xe4c4('0xde')]);if(!_0x472247){return this[_0xe4c4('0x34')]['error'](_0x1e8e10,'no\x20variable\x20found');}this['channel'][_0xe4c4('0xa2')](_0x472247,_0x197665);}this['createSquareDetailsReport'][_0xe4c4('0x6f')](this,_0x1e8e10,_0x197665);return _0x29fbc7;};AGIVertices[_0xe4c4('0x10')][_0xe4c4('0xb0')]=function(_0x3ca089){logger[_0xe4c4('0x2b')](util[_0xe4c4('0x26')](_0xe4c4('0x16e'),_0x3ca089[_0xe4c4('0xad')]));return this['channel'][_0xe4c4('0xb0')](_0x3ca089[_0xe4c4('0x16f')]||_0x3ca089['label']);};AGIVertices['prototype'][_0xe4c4('0x170')]=function(_0x1fe85c){logger[_0xe4c4('0x2b')](util[_0xe4c4('0x26')](_0xe4c4('0x171'),_0x1fe85c[_0xe4c4('0xad')]));if(!this['isConfigured'](_0x1fe85c[_0xe4c4('0x15e')])){return this[_0xe4c4('0x34')][_0xe4c4('0x29')](_0x1fe85c,_0xe4c4('0x15f'));}logger[_0xe4c4('0x2b')](util[_0xe4c4('0x26')](_0xe4c4('0x160'),this[_0xe4c4('0x34')][_0xe4c4('0x38')],_0x1fe85c[_0xe4c4('0x15e')]));var _0xf0f5fd=this[_0xe4c4('0x4d')]['sync'](this,_0x1fe85c[_0xe4c4('0x172')]);var _0x5e5dfb=this[_0xe4c4('0x173')][_0xe4c4('0x6f')](this,_0x1fe85c[_0xe4c4('0x15e')],_0xf0f5fd);if(_0x5e5dfb){logger[_0xe4c4('0x2b')](util[_0xe4c4('0x26')](_0xe4c4('0x161'),this[_0xe4c4('0x34')]['callerid'],_0x1fe85c[_0xe4c4('0x15e')]));this[_0xe4c4('0x34')][_0xe4c4('0xb0')](util[_0xe4c4('0x26')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xe4c4('0x34')][_0xe4c4('0x38')],_0x1fe85c[_0xe4c4('0x15e')]));return{'code':0xc8,'result':_0xe4c4('0x162')};}else{logger[_0xe4c4('0x2b')](util[_0xe4c4('0x26')](_0xe4c4('0x163'),this[_0xe4c4('0x34')][_0xe4c4('0x38')],_0x1fe85c[_0xe4c4('0x15e')]));this['channel'][_0xe4c4('0xb0')](util[_0xe4c4('0x26')](_0xe4c4('0x161'),this[_0xe4c4('0x34')][_0xe4c4('0x38')],_0x1fe85c[_0xe4c4('0x15e')]));return{'code':0xc8,'result':_0xe4c4('0x164')};}};AGIVertices[_0xe4c4('0x10')]['playback']=function(_0x2263a5){logger[_0xe4c4('0x2b')](util['format']('Enter\x20in\x20PLAYBACK\x20(%s)\x20block',_0x2263a5[_0xe4c4('0xad')]));if(!this[_0xe4c4('0x88')](_0x2263a5[_0xe4c4('0x16c')])){return this[_0xe4c4('0x34')][_0xe4c4('0x29')](_0x2263a5,_0xe4c4('0x11b'));}var _0x42e515=this[_0xe4c4('0x11c')][_0xe4c4('0x6f')](this,_0x2263a5[_0xe4c4('0x16c')]);if(!_0x42e515){return this[_0xe4c4('0x34')][_0xe4c4('0x29')](_0x2263a5,_0xe4c4('0x11d'));}var _0x2bff4e=this[_0xe4c4('0x34')]['exec']('PLAYBACK',[_0x42e515,_0x2263a5['opts']]);if(_0x2bff4e[_0xe4c4('0xa7')]===-0x1){return _0x2bff4e;}return this[_0xe4c4('0x34')][_0xe4c4('0xb0')](util[_0xe4c4('0x26')]('Executed\x20command\x20%s\x20%s',_0xe4c4('0x174'),_0x42e515));};AGIVertices[_0xe4c4('0x10')][_0xe4c4('0x175')]=function(_0x2d6a0d){logger['info'](util[_0xe4c4('0x26')](_0xe4c4('0x176'),_0x2d6a0d[_0xe4c4('0xad')]));if(!this['isConfigured'](_0x2d6a0d['queue_id'])){return this[_0xe4c4('0x34')][_0xe4c4('0x29')](_0x2d6a0d,'no\x20queue\x20selected');}var _0x2f3721='';var _0x19fa45=parseInt(_0x2d6a0d[_0xe4c4('0x177')],0xa);if(isNaN(_0x19fa45)){_0x2f3721=_0x2d6a0d[_0xe4c4('0x177')];}else{_0x2f3721=this[_0xe4c4('0x178')][_0xe4c4('0x6f')](this,_0x2d6a0d['queue_id']);if(!_0x2f3721){return this[_0xe4c4('0x34')][_0xe4c4('0x29')](_0x2d6a0d,_0xe4c4('0x179'));}}var _0x4b42d3='';if(this['isConfigured'](_0x2d6a0d['file_id'])){var _0xa02373=this['getSound'][_0xe4c4('0x6f')](this,_0x2d6a0d['file_id']);if(_0xa02373){_0x4b42d3=_0xa02373;}}this[_0xe4c4('0x33')][_0xe4c4('0x6f')](this,_0x2d6a0d,_0x2f3721);if(_0x2d6a0d[_0xe4c4('0xeb')][_0xe4c4('0x17a')]('x')<0x0){_0x2d6a0d['opts']+='x';}if(_0x2d6a0d[_0xe4c4('0xeb')][_0xe4c4('0x17a')]('X')<0x0){_0x2d6a0d['opts']+='X';}this[_0xe4c4('0x34')]['setVariable'](_0xe4c4('0x17b'),_0x2f3721?_0x2f3721['toLowerCase']():'');var _0x2ef1d9=this[_0xe4c4('0x34')]['exec'](_0xe4c4('0x17c'),[_0x2f3721,_0x2d6a0d[_0xe4c4('0xeb')],_0x2d6a0d[_0xe4c4('0x64')],_0x4b42d3,_0x2d6a0d[_0xe4c4('0x65')],_0x2d6a0d[_0xe4c4('0x17d')],_0x2d6a0d[_0xe4c4('0x17e')],_0x2d6a0d[_0xe4c4('0x17f')],'',_0x2d6a0d[_0xe4c4('0x180')]]);if(_0x2ef1d9[_0xe4c4('0xa7')]===-0x1){return _0x2ef1d9;}return this['channel'][_0xe4c4('0xb0')](util['format'](_0xe4c4('0xc9'),_0xe4c4('0x17c'),_0x2f3721));};AGIVertices[_0xe4c4('0x10')][_0xe4c4('0x181')]=function(_0x35beb6){logger[_0xe4c4('0x2b')](util['format'](_0xe4c4('0x182'),_0x35beb6[_0xe4c4('0xad')]));var _0x32932e=_0x35beb6['recordingFormat']||_0xe4c4('0x138');var _0x2d3f43=util[_0xe4c4('0x26')](_0xe4c4('0x183'),this[_0xe4c4('0x34')]['uniqueid'],rs[_0xe4c4('0x123')](0x5));var _0x2ead1d=util['format'](_0xe4c4('0x184'),FILES_PATH,_0x2d3f43,_0x32932e);var _0xc49c04=util[_0xe4c4('0x26')](_0xe4c4('0x139'),FILES_PATH,_0x2d3f43);this['createSquareRecording'][_0xe4c4('0x6f')](this,_0x35beb6,_0x2d3f43,_0x2ead1d);this[_0xe4c4('0x34')][_0xe4c4('0xa2')](_0xe4c4('0x185'),_0x2d3f43);logger[_0xe4c4('0x2b')]('Recording\x20%s\x20%s\x20%s\x20%s',_0xc49c04,_0x32932e,_0x35beb6[_0xe4c4('0x186')],_0x35beb6[_0xe4c4('0x65')]);return this[_0xe4c4('0x34')][_0xe4c4('0x13c')](_0xc49c04,_0x32932e,_0x35beb6[_0xe4c4('0x186')],_0x35beb6[_0xe4c4('0x65')],undefined,!![]);};AGIVertices['prototype'][_0xe4c4('0x187')]=function(_0xdaa2c1){logger[_0xe4c4('0x2b')](util[_0xe4c4('0x26')]('Enter\x20in\x20RESTAPI\x20(%s)\x20block',_0xdaa2c1[_0xe4c4('0xad')]));if(!this['isConfigured'](_0xdaa2c1[_0xe4c4('0x64')])){return this[_0xe4c4('0x34')]['noop'](_0xe4c4('0x188'));}var _0x356489=this[_0xe4c4('0x63')][_0xe4c4('0x6f')](this,_0xdaa2c1);logger[_0xe4c4('0x2b')](util[_0xe4c4('0x26')](_0xe4c4('0x189'),util['inspect'](_0x356489,{'showHidden':![],'depth':null})));if(!this[_0xe4c4('0x88')](_0xdaa2c1['variable_id'])){return this[_0xe4c4('0x34')][_0xe4c4('0xb0')](_0xe4c4('0x18a'));}var _0xe1693a=this[_0xe4c4('0x11')][_0xe4c4('0x6f')](this,_0xdaa2c1['variable_id']);if(!_0xe1693a){return this[_0xe4c4('0x34')][_0xe4c4('0x29')](_0xdaa2c1,_0xe4c4('0xe0'));}this[_0xe4c4('0x34')]['setVariable'](util['format'](_0xe4c4('0x18b'),_0xe1693a),_0x356489[_0xe4c4('0x76')]?_0x356489['statusCode']:_0xe4c4('0x18c'));this[_0xe4c4('0x34')]['setVariable'](util[_0xe4c4('0x26')](_0xe4c4('0x18d'),_0xe1693a),_0x356489['statusMessage']?_0x356489[_0xe4c4('0x75')]:'OK');if(_0x356489['body']){try{this['saveRestApiResult'](_0x356489[_0xe4c4('0x73')],_0xe1693a);}catch(_0x511a5e){logger[_0xe4c4('0x29')](util[_0xe4c4('0x26')](_0xe4c4('0x18e'),_0xe1693a));}}return this[_0xe4c4('0x34')][_0xe4c4('0xb0')](util['format']('variable\x20%s\x20set',_0xe1693a));};AGIVertices[_0xe4c4('0x10')][_0xe4c4('0x18f')]=function(_0x420cbc){logger['info'](util[_0xe4c4('0x26')](_0xe4c4('0x190'),_0x420cbc['label']));return this[_0xe4c4('0x34')]['sayDigits'](_0x420cbc['digits']['replace'](/\s+/g,''),_0x420cbc[_0xe4c4('0x186')]);};AGIVertices['prototype'][_0xe4c4('0x191')]=function(_0x3d69d6){logger[_0xe4c4('0x2b')](util[_0xe4c4('0x26')](_0xe4c4('0x192'),_0x3d69d6[_0xe4c4('0xad')]));return this['channel'][_0xe4c4('0x193')](_0x3d69d6[_0xe4c4('0x194')][_0xe4c4('0x58')](/\s+/g,''),_0x3d69d6[_0xe4c4('0x186')]);};AGIVertices[_0xe4c4('0x10')]['sayphonetic']=function(_0x3aabba){logger[_0xe4c4('0x2b')](util['format'](_0xe4c4('0x195'),_0x3aabba[_0xe4c4('0xad')]));return this[_0xe4c4('0x34')][_0xe4c4('0x196')](_0x3aabba[_0xe4c4('0x5c')],_0x3aabba[_0xe4c4('0x186')]);};AGIVertices[_0xe4c4('0x10')][_0xe4c4('0x197')]=function(_0x3c2af6){logger[_0xe4c4('0x2b')](util[_0xe4c4('0x26')]('Enter\x20in\x20SENDMAIL\x20(%s)\x20block',_0x3c2af6[_0xe4c4('0xad')]));if(!this['isConfigured'](_0x3c2af6['account_id'])){return this[_0xe4c4('0x34')][_0xe4c4('0xb0')]('no\x20mail\x20account\x20configured');}var _0x40523c=this['getMailAccount'][_0xe4c4('0x6f')](this,_0x3c2af6[_0xe4c4('0x198')]);if(!_0x40523c||!_0x40523c[_0xe4c4('0x199')]){return this[_0xe4c4('0x34')][_0xe4c4('0x29')](_0x3c2af6,_0xe4c4('0x19a'));}var _0x409b09={'from':util[_0xe4c4('0x26')]('\x22%s\x22\x20<%s>',_0x40523c['name'],_0x40523c[_0xe4c4('0x19b')]||_0x40523c['Smtp'][_0xe4c4('0x19c')]),'to':_0x3c2af6['to']||'','cc':_0x3c2af6['cc']||'','bcc':_0x3c2af6['bcc']||'','subject':_0x3c2af6['subject'],'html':_0x3c2af6[_0xe4c4('0x5c')],'text':_0x3c2af6[_0xe4c4('0x5c')]};if(this[_0xe4c4('0x88')](_0x3c2af6['template_id'])){}logger[_0xe4c4('0xe6')](_0xe4c4('0x19d'),JSON[_0xe4c4('0x72')](_0x409b09));this[_0xe4c4('0x33')][_0xe4c4('0x6f')](this,_0x3c2af6,_0x3c2af6[_0xe4c4('0x198')]);this[_0xe4c4('0x34')][_0xe4c4('0xb0')](util[_0xe4c4('0x26')](_0xe4c4('0x19e'),_0x40523c['name']));this['sendMailMessage']['sync'](this,_0x40523c[_0xe4c4('0x19f')],_0x409b09);return this[_0xe4c4('0x34')][_0xe4c4('0xb0')](_0xe4c4('0x1a0'));};AGIVertices['prototype']['sendFax']=function(_0x553c33){logger[_0xe4c4('0x2b')](util[_0xe4c4('0x26')](_0xe4c4('0x1a1'),_0x553c33[_0xe4c4('0xad')]));return this[_0xe4c4('0x34')][_0xe4c4('0xb0')]('SENDFAX\x20block\x20not\x20implemented');};AGIVertices['prototype']['sendSMS']=function(_0x5ac1b0){logger[_0xe4c4('0x2b')](util['format']('Enter\x20in\x20SENDSMS\x20(%s)\x20block',_0x5ac1b0[_0xe4c4('0xad')]));if(!this[_0xe4c4('0x88')](_0x5ac1b0[_0xe4c4('0x1a2')])){return this['channel'][_0xe4c4('0xb0')]('no\x20sms\x20account\x20configured');}var _0x3154be=this[_0xe4c4('0x1a3')]['sync'](this,_0x5ac1b0['sms_account_id']);if(!_0x3154be){return this[_0xe4c4('0x34')][_0xe4c4('0x29')](_0x5ac1b0,_0xe4c4('0x1a4'));}var _0x2efd31={'body':_0x5ac1b0['sms_text'],'phone':_0x5ac1b0['to']||'','SmsAccountId':_0x3154be['id']};logger['debug']('sendSMS\x20message',JSON[_0xe4c4('0x72')](_0x2efd31));this[_0xe4c4('0x33')][_0xe4c4('0x6f')](this,_0x5ac1b0,_0x5ac1b0['sms_account_id']);this['channel'][_0xe4c4('0xb0')](util[_0xe4c4('0x26')](_0xe4c4('0x1a5'),_0x3154be[_0xe4c4('0x14')]));this[_0xe4c4('0x32')][_0xe4c4('0x6f')](this,_0x2efd31);return this[_0xe4c4('0x34')][_0xe4c4('0xb0')](_0xe4c4('0x1a6'));};AGIVertices[_0xe4c4('0x10')][_0xe4c4('0x1a7')]=function(_0x1d3854){logger[_0xe4c4('0x2b')](util[_0xe4c4('0x26')](_0xe4c4('0x1a8'),_0x1d3854[_0xe4c4('0xad')]));if(!this[_0xe4c4('0x88')](_0x1d3854['variable_id'])){return this['channel'][_0xe4c4('0x29')](_0x1d3854,_0xe4c4('0x1a9'));}var _0x677c32=this[_0xe4c4('0x11')][_0xe4c4('0x6f')](this,_0x1d3854[_0xe4c4('0xde')]);if(!_0x677c32){return this[_0xe4c4('0x34')]['error'](_0x1d3854,'no\x20variable\x20found');}return this[_0xe4c4('0x34')][_0xe4c4('0xa2')](_0x677c32,_0x1d3854[_0xe4c4('0x1aa')]);};AGIVertices['prototype'][_0xe4c4('0x1ab')]=function(_0x1ad16f){logger[_0xe4c4('0x2b')](util[_0xe4c4('0x26')]('Enter\x20in\x20START\x20(%s)\x20block',_0x1ad16f[_0xe4c4('0xad')]));this[_0xe4c4('0x34')][_0xe4c4('0xb0')](_0xe4c4('0x1ac'));var _0x6a9cad=this['channel'][_0xe4c4('0x11')](_0xe4c4('0x1ad'));if(!_['isEmpty'](_0x6a9cad['extra'])){this[_0xe4c4('0x34')][_0xe4c4('0x35')]=_0x6a9cad[_0xe4c4('0xa4')];}if(_0x1ad16f[_0xe4c4('0xbe')]===_0xe4c4('0x1ae')){this[_0xe4c4('0x34')][_0xe4c4('0xb0')](_0xe4c4('0x1af'));return this[_0xe4c4('0x34')]['answer']();}return this[_0xe4c4('0x34')][_0xe4c4('0xb0')](_0xe4c4('0x1b0'));};AGIVertices[_0xe4c4('0x10')][_0xe4c4('0x1b1')]=function(_0x50f4cf){logger[_0xe4c4('0x2b')](util['format']('Enter\x20in\x20SUBPROJECT\x20(%s)\x20block',_0x50f4cf[_0xe4c4('0xad')]));if(!this[_0xe4c4('0x88')](_0x50f4cf[_0xe4c4('0x1b2')])){return this[_0xe4c4('0x34')][_0xe4c4('0x29')](_0x50f4cf,'no\x20subproject\x20selected');}var _0x3d8030=this[_0xe4c4('0x17')][_0xe4c4('0x6f')](this,_0x50f4cf[_0xe4c4('0x1b2')]);if(!this['isConfigured'](_0x3d8030)){return this[_0xe4c4('0x34')][_0xe4c4('0x29')](_0x50f4cf,util['format'](_0xe4c4('0x1b3'),_0x50f4cf[_0xe4c4('0x1b2')]));}if(_0x3d8030===this[_0xe4c4('0x34')][_0xe4c4('0x36')]){return this[_0xe4c4('0x34')][_0xe4c4('0x29')](_0x50f4cf,'project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project');}this[_0xe4c4('0x33')][_0xe4c4('0x6f')](this,_0x50f4cf,_0x3d8030);var _0x49cb44=this[_0xe4c4('0x34')][_0xe4c4('0x56')](_0xe4c4('0x1b4'),util['format'](_0xe4c4('0x1b5'),config[_0xe4c4('0x17d')][_0xe4c4('0x1b6')]||_0xe4c4('0x1b7'),_0x3d8030,this[_0xe4c4('0x34')][_0xe4c4('0x36')]));if(_0x49cb44['result']===-0x1){return _0x49cb44;}return this[_0xe4c4('0x34')][_0xe4c4('0xb0')](util[_0xe4c4('0x26')]('Executed\x20command\x20%s\x20%s','AGI',_0x3d8030));};AGIVertices[_0xe4c4('0x10')][_0xe4c4('0x1b8')]=function(_0x3b283a){logger[_0xe4c4('0x2b')](util[_0xe4c4('0x26')](_0xe4c4('0x1b9'),_0x3b283a[_0xe4c4('0xad')]));var _0x29edce=this['shellCommand'][_0xe4c4('0x6f')](this,_0x3b283a['command']);this['createSquareDetailsReport'][_0xe4c4('0x6f')](this,_0x3b283a,_0x3b283a[_0xe4c4('0x1ba')]);if(this['isConfigured'](_0x3b283a[_0xe4c4('0xde')])){var _0x356664=this[_0xe4c4('0x11')][_0xe4c4('0x6f')](this,_0x3b283a['variable_id']);if(_0x356664){this[_0xe4c4('0x34')][_0xe4c4('0xa2')](_0x356664,_0x29edce);return this[_0xe4c4('0x34')]['noop'](util[_0xe4c4('0x26')](_0xe4c4('0x1bb'),_0x3b283a['command'],_0x356664));}}return this[_0xe4c4('0x34')][_0xe4c4('0xb0')](util[_0xe4c4('0x26')]('sh\x20command:\x20%s\x20result\x20no\x20stored',_0x3b283a[_0xe4c4('0x1ba')]));};AGIVertices[_0xe4c4('0x10')]['google_cloud_tts']=function(_0x197736){logger[_0xe4c4('0x2b')](util[_0xe4c4('0x26')](_0xe4c4('0x1bc'),_0x197736['label']));_0x197736[_0xe4c4('0x5c')]=_0x197736['text'][_0xe4c4('0x58')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xe4c4('0x88')](_0x197736[_0xe4c4('0x5a')])){return this[_0xe4c4('0x34')][_0xe4c4('0xb0')](_0xe4c4('0x1bd'));}if(!this[_0xe4c4('0x88')](_0x197736['text'])){return this['channel']['noop'](_0xe4c4('0xae'));}this[_0xe4c4('0x34')][_0xe4c4('0xb0')](util[_0xe4c4('0x26')](_0xe4c4('0x1be'),_0x197736[_0xe4c4('0x5c')]));var _0xa1dd3c=this[_0xe4c4('0x59')]['sync'](this,_0x197736);if(_0xa1dd3c){this['channel']['noop'](util['format'](_0xe4c4('0x1bf'),_0xa1dd3c));var _0x3dd540=this['channel'][_0xe4c4('0x10e')](_0xa1dd3c);try{fs[_0xe4c4('0x10f')](_0xa1dd3c+'.wav');}catch(_0x101c44){logger[_0xe4c4('0x29')](_0x101c44);}return _0x3dd540;}return this[_0xe4c4('0x34')]['error'](_0x197736,_0xe4c4('0x1c0'));};AGIVertices[_0xe4c4('0x10')][_0xe4c4('0x1c1')]=function(_0x36d2d8){logger[_0xe4c4('0x2b')](util[_0xe4c4('0x26')]('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0x36d2d8[_0xe4c4('0xad')]));_0x36d2d8['text']=_0x36d2d8['text']['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xe4c4('0x88')](_0x36d2d8[_0xe4c4('0x5c')])){return this[_0xe4c4('0x34')][_0xe4c4('0xb0')]('no\x20text\x20configured');}this[_0xe4c4('0x34')][_0xe4c4('0xb0')](util[_0xe4c4('0x26')](_0xe4c4('0x1c2'),_0x36d2d8[_0xe4c4('0x5c')]));var _0x500783=this[_0xe4c4('0x61')][_0xe4c4('0x6f')](this,_0x36d2d8);if(_0x500783){this[_0xe4c4('0x34')]['noop'](util[_0xe4c4('0x26')](_0xe4c4('0x1c3'),_0x500783));var _0x2714b6=this[_0xe4c4('0x34')]['streamFile'](_0x500783);try{fs[_0xe4c4('0x10f')](_0x500783+_0xe4c4('0x110'));}catch(_0x356a80){logger['error'](_0x356a80);}return _0x2714b6;}return this[_0xe4c4('0x34')]['error'](_0x36d2d8,_0xe4c4('0x1c4'));};AGIVertices[_0xe4c4('0x10')][_0xe4c4('0x1c5')]=function(_0x435cec){logger[_0xe4c4('0x2b')](util[_0xe4c4('0x26')]('Enter\x20in\x20UNPAUSE\x20(%s)\x20block',_0x435cec[_0xe4c4('0xad')]));if(!this[_0xe4c4('0x88')](_0x435cec['findBy'])){return this['channel'][_0xe4c4('0x29')](_0x435cec,_0xe4c4('0x15f'));}logger[_0xe4c4('0x2b')](util[_0xe4c4('0x26')](_0xe4c4('0x160'),this[_0xe4c4('0x34')]['callerid'],_0x435cec[_0xe4c4('0x15e')]));var _0x22e1d5=this['agentUnpause'][_0xe4c4('0x6f')](this,_0x435cec[_0xe4c4('0x15e')]);if(_0x22e1d5){logger[_0xe4c4('0x2b')](util[_0xe4c4('0x26')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xe4c4('0x34')]['callerid'],_0x435cec[_0xe4c4('0x15e')]));this[_0xe4c4('0x34')]['noop'](util['format']('AGENT\x20%s\x20FOUND\x20BY',this[_0xe4c4('0x34')][_0xe4c4('0x38')],_0x435cec[_0xe4c4('0x15e')]));return{'code':0xc8,'result':'success'};}else{logger[_0xe4c4('0x2b')](util[_0xe4c4('0x26')](_0xe4c4('0x163'),this[_0xe4c4('0x34')][_0xe4c4('0x38')],_0x435cec[_0xe4c4('0x15e')]));this['channel'][_0xe4c4('0xb0')](util['format'](_0xe4c4('0x163'),this[_0xe4c4('0x34')][_0xe4c4('0x38')],_0x435cec[_0xe4c4('0x15e')]));return{'code':0xc8,'result':_0xe4c4('0x164')};}};AGIVertices[_0xe4c4('0x10')]['voicemail']=function(_0x2af635){logger[_0xe4c4('0x2b')](util['format'](_0xe4c4('0x1c6'),_0x2af635[_0xe4c4('0xad')]));var _0x3e25a7=this[_0xe4c4('0x34')]['exec'](_0xe4c4('0x1c7'),[_0x2af635['mailbox'],_0x2af635[_0xe4c4('0x79')]]);if(_0x3e25a7[_0xe4c4('0xa7')]===-0x1){return _0x3e25a7;}return this[_0xe4c4('0x34')][_0xe4c4('0xb0')](util[_0xe4c4('0x26')](_0xe4c4('0xc9'),'VOICEMAIL',_0x2af635[_0xe4c4('0x1c8')]));};AGIVertices[_0xe4c4('0x10')][_0xe4c4('0x1c9')]=function(_0x238c7b){logger[_0xe4c4('0x2b')](util[_0xe4c4('0x26')](_0xe4c4('0x1ca'),_0x238c7b[_0xe4c4('0xad')]));if(!this[_0xe4c4('0x88')](_0x238c7b[_0xe4c4('0xde')])){return this[_0xe4c4('0x34')][_0xe4c4('0x29')](_0x238c7b,_0xe4c4('0x1a9'));}var _0x545152=this[_0xe4c4('0x11')][_0xe4c4('0x6f')](this,_0x238c7b[_0xe4c4('0xde')]);if(!_0x545152){return this[_0xe4c4('0x34')][_0xe4c4('0x29')](_0x238c7b,_0xe4c4('0xe0'));}var _0x3fa3b3=this[_0xe4c4('0x34')][_0xe4c4('0x11')](_0x545152);return{'code':0xc8,'result':_0x3fa3b3[_0xe4c4('0xa4')]?_0x3fa3b3['extra']:'-'};};String['prototype'][_0xe4c4('0x1cb')]=function(_0x1a992b,_0x49ce27){return this[_0xe4c4('0xa3')](_0x1a992b)[_0xe4c4('0x1cc')](_0x49ce27);};module[_0xe4c4('0x1cd')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index c86492b..dd1e59a 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 _0x1a8a=['getAgent','voicePause','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','paused','acwTimeout','stopAcw','YYYY-MM-DD\x20HH:mm:ss','error','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','[ACW][START]\x20%s','message','[%s][TIMER][STOP][AGENT:%s]','pauseType','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','acw','syncAgentConnectPreview','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','isNil','transfertargetuniqueid','secondtransfereruniqueid','origtransfereruniqueid','transfereeuniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','syncAgentRingNoAnswer','autopause','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','lodash','moment','../../../config/logger','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','syncAgentConnect','bind','hanguprequest','hangup','syncHangup','agentringnoanswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','milliseconds','diff','seconds','prototype','updateAcw','lastPauseAt','timer','update','uniqueid','then','info','[%s][UPDATE][ACWTIME:%s]','catch','[%s][UPDATE][ERRORS:%s]','finally','startAcw','interface','channels','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','name','Action','QueuePause'];(function(_0x3da8ae,_0x1dcc08){var _0x2ad8e5=function(_0x63cc39){while(--_0x63cc39){_0x3da8ae['push'](_0x3da8ae['shift']());}};_0x2ad8e5(++_0x1dcc08);}(_0x1a8a,0x191));var _0xa1a8=function(_0x26658e,_0x1bb1a9){_0x26658e=_0x26658e-0x0;var _0x572802=_0x1a8a[_0x26658e];return _0x572802;};'use strict';var _=require(_0xa1a8('0x0'));var moment=require(_0xa1a8('0x1'));var ami=require('../ami');var logger=require(_0xa1a8('0x2'))('acw');var RpcUser=require(_0xa1a8('0x3'));var RpcVoiceAgentReport=require(_0xa1a8('0x4'));function Acw(_0x21cb50){this[_0xa1a8('0x5')]=_0x21cb50[_0xa1a8('0x5')];this[_0xa1a8('0x6')]=_0x21cb50[_0xa1a8('0x6')];this[_0xa1a8('0x7')]=_0x21cb50['timers'];this['channels']={};ami['on']('agentconnect',this[_0xa1a8('0x8')][_0xa1a8('0x9')](this));ami['on'](_0xa1a8('0xa'),this['syncHangupRequest'][_0xa1a8('0x9')](this));ami['on'](_0xa1a8('0xb'),this[_0xa1a8('0xc')][_0xa1a8('0x9')](this));ami['on'](_0xa1a8('0xd'),this['syncAgentRingNoAnswer'][_0xa1a8('0x9')](this));ami['on'](_0xa1a8('0xe'),this[_0xa1a8('0xf')][_0xa1a8('0x9')](this));ami['on'](_0xa1a8('0x10'),this[_0xa1a8('0x11')][_0xa1a8('0x9')](this));ami['on'](_0xa1a8('0x12'),this['syncAgentConnectPreview'][_0xa1a8('0x9')](this));}function getDiff(_0x3c3c7a){var _0xc77051=moment()[_0xa1a8('0x13')](0x0);var _0x1b5991=moment(_0x3c3c7a)[_0xa1a8('0x13')](0x0);return _0xc77051[_0xa1a8('0x14')](_0x1b5991,_0xa1a8('0x15'));}Acw[_0xa1a8('0x16')][_0xa1a8('0x17')]=function(_0x131691,_0x12be5a){var _0x29bf64=this;var _0x2e0f12=getDiff(_0x29bf64[_0xa1a8('0x7')][_0x131691][_0xa1a8('0x18')]);clearTimeout(_0x29bf64[_0xa1a8('0x7')][_0x131691][_0xa1a8('0x19')]);_0x29bf64[_0xa1a8('0x7')][_0x131691]['timer']=![];return RpcVoiceAgentReport[_0xa1a8('0x1a')]({'acwtime':_0x2e0f12},_0x29bf64['timers'][_0x131691][_0xa1a8('0x1b')],_0x131691)[_0xa1a8('0x1c')](function(_0x2e1e78){logger[_0xa1a8('0x1d')](_0xa1a8('0x1e'),_0x12be5a,_0x2e0f12,_0x2e1e78);})[_0xa1a8('0x1f')](function(_0xb5d490){logger['error'](_0xa1a8('0x20'),_0x12be5a,_0xb5d490);})[_0xa1a8('0x21')](function(){delete _0x29bf64[_0xa1a8('0x7')][_0x131691];});};Acw['prototype'][_0xa1a8('0x22')]=function(_0x408f16){try{var _0x4e983a=this;var _0x1eb753=this['channels'][_0x408f16][_0xa1a8('0x23')];var _0x287cae=this[_0xa1a8('0x24')][_0x408f16][_0xa1a8('0x25')];var _0x25bd69=this[_0xa1a8('0x5')][_0x287cae];var _0x2b2243=![];var _0x13a6b3=_0xa1a8('0x26');if(_0x25bd69[_0xa1a8('0x27')]&&_0x25bd69[_0xa1a8('0x28')][_0xa1a8('0x29')]){_0x2b2243=!![];_0x13a6b3=_0x25bd69[_0xa1a8('0x28')]['name'];}return ami[_0xa1a8('0x2a')]({'action':_0xa1a8('0x2b'),'interface':_0x1eb753,'paused':!![],'reason':_0x13a6b3})[_0xa1a8('0x1c')](function(){if(_0x4e983a['agents'][_0x1eb753]){return RpcUser[_0xa1a8('0x2c')](_0x4e983a[_0xa1a8('0x6')][_0x1eb753]['id'])[_0xa1a8('0x1c')](function(_0x34b192){if(!_0x34b192||_0x34b192[_0xa1a8('0x2d')]){logger[_0xa1a8('0x1d')](_0xa1a8('0x2e'),_0x408f16,_0x1eb753,_0x287cae);return;}logger[_0xa1a8('0x1d')]('[%s][START][AGENT:%s][QUEUE:%s]',_0x408f16,_0x1eb753,_0x287cae);var _0x5ccdf6=_0x4e983a[_0xa1a8('0x24')][_0x408f16][_0xa1a8('0x2f')]&&_0x4e983a[_0xa1a8('0x24')][_0x408f16][_0xa1a8('0x30')]?_0x4e983a[_0xa1a8('0x24')][_0x408f16]['destlinkedid']:_0x408f16;return RpcUser[_0xa1a8('0x31')](_0x4e983a[_0xa1a8('0x6')][_0x1eb753],_0x13a6b3,_0x5ccdf6)[_0xa1a8('0x1c')](function(_0x46ac45){_0x4e983a[_0xa1a8('0x5')][_0x287cae]['available']-=0x1;_0x4e983a[_0xa1a8('0x5')][_0x287cae][_0xa1a8('0x32')]+=0x1;return _0x46ac45;});})[_0xa1a8('0x1c')](function(_0x35ef5c){if(_0x2b2243||!_0x35ef5c){return;}_0x4e983a[_0xa1a8('0x7')][_0x1eb753]={};logger[_0xa1a8('0x1d')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x408f16,_0x4e983a[_0xa1a8('0x5')][_0x287cae][_0xa1a8('0x33')],_0x1eb753,_0x287cae);_0x4e983a[_0xa1a8('0x7')][_0x1eb753][_0xa1a8('0x19')]=setTimeout(_0x4e983a[_0xa1a8('0x34')][_0xa1a8('0x9')](_0x4e983a,_0x1eb753),_0x4e983a[_0xa1a8('0x5')][_0x287cae][_0xa1a8('0x33')]*0x3e8);_0x4e983a[_0xa1a8('0x7')][_0x1eb753][_0xa1a8('0x18')]=moment()['format'](_0xa1a8('0x35'));_0x4e983a['timers'][_0x1eb753]['uniqueid']=_0x408f16;_0x4e983a[_0xa1a8('0x7')][_0x1eb753][_0xa1a8('0x25')]=_0x287cae;_0x4e983a[_0xa1a8('0x7')][_0x1eb753][_0xa1a8('0x17')]=_0x4e983a['updateAcw']['bind'](_0x4e983a,_0x1eb753,_0x408f16);});}})[_0xa1a8('0x1f')](function(){logger[_0xa1a8('0x36')](_0xa1a8('0x37'),_0x408f16,_0x4e983a[_0xa1a8('0x5')][_0x287cae][_0xa1a8('0x33')],_0x1eb753,_0x287cae);})[_0xa1a8('0x21')](function(){delete _0x4e983a[_0xa1a8('0x24')][_0x408f16];});}catch(_0x5ea0eb){logger[_0xa1a8('0x36')](_0xa1a8('0x38'),_0x5ea0eb[_0xa1a8('0x39')]);}};Acw[_0xa1a8('0x16')][_0xa1a8('0x34')]=function(_0x1934a7){try{var _0x3eff68=this;if(_0x3eff68[_0xa1a8('0x7')][_0x1934a7]){_0x3eff68['timers'][_0x1934a7][_0xa1a8('0x19')]=![];var _0x488b80=_0x3eff68['timers'][_0x1934a7][_0xa1a8('0x1b')];var _0xf6cd0a=_0x3eff68[_0xa1a8('0x7')][_0x1934a7]['queue'];var _0x5a5a6b=_0x3eff68['voiceQueues'][_0xf6cd0a]['acwTimeout'];logger['info'](_0xa1a8('0x3a'),_0x488b80,_0x1934a7);RpcUser[_0xa1a8('0x2c')](this['agents'][_0x1934a7]['id'])['then'](function(_0x189f3c){if(_0x189f3c[_0xa1a8('0x3b')]===_0xa1a8('0x26')){return RpcUser['saveUnpause'](_0x3eff68[_0xa1a8('0x6')][_0x1934a7]);}});RpcVoiceAgentReport[_0xa1a8('0x1a')]({'acwtime':_0x5a5a6b,'agentacw':!![]},_0x488b80,_0x1934a7)[_0xa1a8('0x1c')](function(_0x11f7cb){logger[_0xa1a8('0x1d')]('[%s][UPDATE][ACWTIME:%s]',_0x488b80,_0x5a5a6b,_0x11f7cb);})['catch'](function(_0x5741a6){logger[_0xa1a8('0x36')](_0xa1a8('0x20'),_0x488b80,_0x5741a6);});}else{logger[_0xa1a8('0x36')]('[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer',_0x1934a7);if(_0x3eff68[_0xa1a8('0x7')]){logger[_0xa1a8('0x1d')](_0xa1a8('0x3c'),JSON[_0xa1a8('0x3d')](_0x3eff68[_0xa1a8('0x7')]));}}}catch(_0x99afc5){logger[_0xa1a8('0x36')](_0xa1a8('0x3e'),_0x99afc5['message']);}};Acw[_0xa1a8('0x16')]['syncAgentConnect']=function(_0x3bd77d){try{if(this[_0xa1a8('0x5')][_0x3bd77d['queue']]&&(this[_0xa1a8('0x5')][_0x3bd77d[_0xa1a8('0x25')]][_0xa1a8('0x3f')]||this['voiceQueues'][_0x3bd77d[_0xa1a8('0x25')]][_0xa1a8('0x27')])){if(this[_0xa1a8('0x6')][_0x3bd77d['interface']]){this[_0xa1a8('0x24')][_0x3bd77d['uniqueid']]={'queue':_0x3bd77d[_0xa1a8('0x25')],'interface':_0x3bd77d[_0xa1a8('0x23')],'destlinkedid':_0x3bd77d[_0xa1a8('0x30')]};}}}catch(_0x4e8266){logger['error']('[ACW][syncAgentConnect]\x20%s',_0x4e8266[_0xa1a8('0x39')]);}};Acw[_0xa1a8('0x16')][_0xa1a8('0x40')]=function(_0x37d182){try{if(this[_0xa1a8('0x5')][_0x37d182[_0xa1a8('0x25')]]&&(this[_0xa1a8('0x5')][_0x37d182[_0xa1a8('0x25')]][_0xa1a8('0x3f')]||this[_0xa1a8('0x5')][_0x37d182[_0xa1a8('0x25')]]['mandatoryDisposition'])){if(this[_0xa1a8('0x6')][_0x37d182[_0xa1a8('0x23')]]){this['channels'][_0x37d182[_0xa1a8('0x1b')]]={'queue':_0x37d182[_0xa1a8('0x25')],'interface':_0x37d182[_0xa1a8('0x23')]};}}}catch(_0xb39a7e){logger[_0xa1a8('0x36')](_0xa1a8('0x41'),_0xb39a7e[_0xa1a8('0x39')]);}};Acw['prototype']['syncHangupRequest']=function(_0x401c60){try{if(this['channels'][_0x401c60[_0xa1a8('0x1b')]]&&_[_0xa1a8('0x42')](this[_0xa1a8('0x24')][_0x401c60[_0xa1a8('0x1b')]][_0xa1a8('0x2f')])){logger[_0xa1a8('0x1d')](_0xa1a8('0x43'),_0x401c60['uniqueid']);this['startAcw'](_0x401c60[_0xa1a8('0x1b')]);}else if(this[_0xa1a8('0x24')][_0x401c60[_0xa1a8('0x44')]]&&_[_0xa1a8('0x42')](this[_0xa1a8('0x24')][_0x401c60['linkedid']][_0xa1a8('0x2f')])){logger[_0xa1a8('0x1d')](_0xa1a8('0x45'),_0x401c60['linkedid']);this[_0xa1a8('0x22')](_0x401c60['linkedid']);}}catch(_0x3b8c22){logger['error'](_0xa1a8('0x46'),_0x3b8c22[_0xa1a8('0x39')]);}};Acw[_0xa1a8('0x16')][_0xa1a8('0xc')]=function(_0x31ff80){try{if(this[_0xa1a8('0x24')][_0x31ff80[_0xa1a8('0x1b')]]&&this[_0xa1a8('0x24')][_0x31ff80[_0xa1a8('0x1b')]][_0xa1a8('0x2f')]){logger[_0xa1a8('0x1d')](_0xa1a8('0x47'),_0x31ff80['uniqueid']);this[_0xa1a8('0x22')](_0x31ff80[_0xa1a8('0x1b')]);}else if(this[_0xa1a8('0x24')][_0x31ff80[_0xa1a8('0x44')]]&&this[_0xa1a8('0x24')][_0x31ff80[_0xa1a8('0x44')]]['attended']){logger[_0xa1a8('0x1d')](_0xa1a8('0x48'),_0x31ff80['linkedid']);this[_0xa1a8('0x22')](_0x31ff80['linkedid']);}}catch(_0x4768c3){logger[_0xa1a8('0x36')]('[ACW][syncHangup]\x20%s',_0x4768c3[_0xa1a8('0x39')]);}};Acw[_0xa1a8('0x16')][_0xa1a8('0xf')]=function(_0x3f333f){try{if(!_[_0xa1a8('0x49')](this[_0xa1a8('0x24')][_0x3f333f['transfereeuniqueid']])){this[_0xa1a8('0x22')](_0x3f333f['transfereeuniqueid']);if(this[_0xa1a8('0x24')][_0x3f333f['secondtransfereruniqueid']]){this[_0xa1a8('0x24')][_0x3f333f['secondtransfereruniqueid']][_0xa1a8('0x2f')]=!![];this[_0xa1a8('0x24')][_0x3f333f[_0xa1a8('0x4a')]]=this[_0xa1a8('0x24')][_0x3f333f[_0xa1a8('0x4b')]];delete this[_0xa1a8('0x24')][_0x3f333f[_0xa1a8('0x4b')]];}}else if(!_[_0xa1a8('0x49')](this[_0xa1a8('0x24')][_0x3f333f[_0xa1a8('0x4a')]])){this['startAcw'](_0x3f333f[_0xa1a8('0x4a')]);if(this['channels'][_0x3f333f[_0xa1a8('0x4c')]]){this[_0xa1a8('0x24')][_0x3f333f[_0xa1a8('0x4c')]][_0xa1a8('0x2f')]=!![];this[_0xa1a8('0x24')][_0x3f333f[_0xa1a8('0x4d')]]=this[_0xa1a8('0x24')][_0x3f333f[_0xa1a8('0x4c')]];delete this[_0xa1a8('0x24')][_0x3f333f[_0xa1a8('0x4c')]];}}}catch(_0x14e9ea){logger[_0xa1a8('0x36')](_0xa1a8('0x4e'),_0x14e9ea[_0xa1a8('0x39')]);}};Acw['prototype'][_0xa1a8('0x11')]=function(_0x2b3bfc){try{if(this[_0xa1a8('0x24')][_0x2b3bfc['transfereruniqueid']]){logger[_0xa1a8('0x1d')]('[%s][BLINDTRANSFER:UNIQUEID]',JSON[_0xa1a8('0x3d')](_0x2b3bfc[_0xa1a8('0x4f')]));this['startAcw'](_0x2b3bfc[_0xa1a8('0x4f')]);}else if(this['channels'][_0x2b3bfc[_0xa1a8('0x50')]]){logger[_0xa1a8('0x1d')](_0xa1a8('0x51'),JSON['stringify'](_0x2b3bfc['transfererlinkedid']));this[_0xa1a8('0x22')](_0x2b3bfc['transfererlinkedid']);}}catch(_0x4db156){logger[_0xa1a8('0x36')](_0xa1a8('0x52'),_0x4db156[_0xa1a8('0x39')]);}};Acw[_0xa1a8('0x16')][_0xa1a8('0x53')]=function(_0x1cd35e){try{if(this[_0xa1a8('0x5')][_0x1cd35e['queue']]&&this[_0xa1a8('0x5')][_0x1cd35e[_0xa1a8('0x25')]][_0xa1a8('0x54')]==='all'){if(this[_0xa1a8('0x6')][_0x1cd35e[_0xa1a8('0x23')]]){logger[_0xa1a8('0x1d')](_0xa1a8('0x55'),_0x1cd35e['uniqueid'],_0x1cd35e['interface'],_0x1cd35e[_0xa1a8('0x25')]);return RpcUser[_0xa1a8('0x31')](this[_0xa1a8('0x6')][_0x1cd35e['interface']],_0xa1a8('0x56'),_0x1cd35e[_0xa1a8('0x1b')]);}}}catch(_0x4af960){logger[_0xa1a8('0x36')](_0xa1a8('0x57'),_0x4af960[_0xa1a8('0x39')]);}};module[_0xa1a8('0x58')]=Acw; \ No newline at end of file +var _0x59c3=['../ami','acw','../rpc/user','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','bind','hanguprequest','syncHangupRequest','hangup','syncHangup','agentringnoanswer','attendedtransfer','syncAttendedTransfer','blindtransfer','custom:agentConnectPreview','syncAgentConnectPreview','diff','seconds','prototype','timer','update','then','info','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][UPDATE][ERRORS:%s]','interface','ACW','mandatoryDispositionPause','name','Action','getAgent','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','available','paused','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','stopAcw','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','queue','updateAcw','finally','[ACW][START]\x20%s','uniqueid','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','[ACW][TIMERS]','[ACW][STOP]\x20%s','message','mandatoryDisposition','isUndefined','startAcw','linkedid','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','syncBlindTransfer','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','stringify','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s'];(function(_0x53d729,_0x1a2198){var _0x568f90=function(_0x48bd5b){while(--_0x48bd5b){_0x53d729['push'](_0x53d729['shift']());}};_0x568f90(++_0x1a2198);}(_0x59c3,0x150));var _0x359c=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x59c3[_0x2dafbe];return _0x58a45a;};'use strict';var _=require('lodash');var moment=require('moment');var ami=require(_0x359c('0x0'));var logger=require('../../../config/logger')(_0x359c('0x1'));var RpcUser=require(_0x359c('0x2'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');function Acw(_0x6237e4){this[_0x359c('0x3')]=_0x6237e4[_0x359c('0x3')];this[_0x359c('0x4')]=_0x6237e4[_0x359c('0x4')];this[_0x359c('0x5')]=_0x6237e4['timers'];this[_0x359c('0x6')]={};ami['on'](_0x359c('0x7'),this[_0x359c('0x8')][_0x359c('0x9')](this));ami['on'](_0x359c('0xa'),this[_0x359c('0xb')][_0x359c('0x9')](this));ami['on'](_0x359c('0xc'),this[_0x359c('0xd')][_0x359c('0x9')](this));ami['on'](_0x359c('0xe'),this['syncAgentRingNoAnswer'][_0x359c('0x9')](this));ami['on'](_0x359c('0xf'),this[_0x359c('0x10')]['bind'](this));ami['on'](_0x359c('0x11'),this['syncBlindTransfer'][_0x359c('0x9')](this));ami['on'](_0x359c('0x12'),this[_0x359c('0x13')][_0x359c('0x9')](this));}function getDiff(_0x18d1fc){var _0x10508a=moment()['milliseconds'](0x0);var _0x1f7d52=moment(_0x18d1fc)['milliseconds'](0x0);return _0x10508a[_0x359c('0x14')](_0x1f7d52,_0x359c('0x15'));}Acw[_0x359c('0x16')]['updateAcw']=function(_0x1d7f12,_0x44bd37){var _0x59daa6=this;var _0x225a36=getDiff(_0x59daa6[_0x359c('0x5')][_0x1d7f12]['lastPauseAt']);clearTimeout(_0x59daa6[_0x359c('0x5')][_0x1d7f12][_0x359c('0x17')]);_0x59daa6[_0x359c('0x5')][_0x1d7f12]['timer']=![];return RpcVoiceAgentReport[_0x359c('0x18')]({'acwtime':_0x225a36},_0x59daa6[_0x359c('0x5')][_0x1d7f12]['uniqueid'],_0x1d7f12)[_0x359c('0x19')](function(_0x53236a){logger[_0x359c('0x1a')](_0x359c('0x1b'),_0x44bd37,_0x225a36,_0x53236a);})[_0x359c('0x1c')](function(_0x519476){logger[_0x359c('0x1d')](_0x359c('0x1e'),_0x44bd37,_0x519476);})['finally'](function(){delete _0x59daa6[_0x359c('0x5')][_0x1d7f12];});};Acw[_0x359c('0x16')]['startAcw']=function(_0x148f43){try{var _0x1a4a76=this;var _0x5af924=this[_0x359c('0x6')][_0x148f43][_0x359c('0x1f')];var _0x514e19=this[_0x359c('0x6')][_0x148f43]['queue'];var _0x58961e=this[_0x359c('0x3')][_0x514e19];var _0x47311d=![];var _0x4f3f8c=_0x359c('0x20');if(_0x58961e['mandatoryDisposition']&&_0x58961e[_0x359c('0x21')]['name']){_0x47311d=!![];_0x4f3f8c=_0x58961e[_0x359c('0x21')][_0x359c('0x22')];}return ami[_0x359c('0x23')]({'action':'QueuePause','interface':_0x5af924,'paused':!![],'reason':_0x4f3f8c})[_0x359c('0x19')](function(){if(_0x1a4a76['agents'][_0x5af924]){return RpcUser[_0x359c('0x24')](_0x1a4a76[_0x359c('0x4')][_0x5af924]['id'])[_0x359c('0x19')](function(_0x3e11d3){if(!_0x3e11d3||_0x3e11d3['voicePause']){logger[_0x359c('0x1a')](_0x359c('0x25'),_0x148f43,_0x5af924,_0x514e19);return;}logger[_0x359c('0x1a')](_0x359c('0x26'),_0x148f43,_0x5af924,_0x514e19);var _0x386933=_0x1a4a76[_0x359c('0x6')][_0x148f43][_0x359c('0x27')]&&_0x1a4a76[_0x359c('0x6')][_0x148f43][_0x359c('0x28')]?_0x1a4a76['channels'][_0x148f43]['destlinkedid']:_0x148f43;return RpcUser[_0x359c('0x29')](_0x1a4a76[_0x359c('0x4')][_0x5af924],_0x4f3f8c,_0x386933)[_0x359c('0x19')](function(_0x35a7c0){_0x1a4a76[_0x359c('0x3')][_0x514e19][_0x359c('0x2a')]-=0x1;_0x1a4a76['voiceQueues'][_0x514e19][_0x359c('0x2b')]+=0x1;return _0x35a7c0;});})['then'](function(_0x4e6153){if(_0x47311d||!_0x4e6153){return;}_0x1a4a76[_0x359c('0x5')][_0x5af924]={};logger[_0x359c('0x1a')](_0x359c('0x2c'),_0x148f43,_0x1a4a76['voiceQueues'][_0x514e19][_0x359c('0x2d')],_0x5af924,_0x514e19);_0x1a4a76[_0x359c('0x5')][_0x5af924][_0x359c('0x17')]=setTimeout(_0x1a4a76[_0x359c('0x2e')]['bind'](_0x1a4a76,_0x5af924),_0x1a4a76['voiceQueues'][_0x514e19][_0x359c('0x2d')]*0x3e8);_0x1a4a76['timers'][_0x5af924][_0x359c('0x2f')]=moment()[_0x359c('0x30')](_0x359c('0x31'));_0x1a4a76[_0x359c('0x5')][_0x5af924]['uniqueid']=_0x148f43;_0x1a4a76[_0x359c('0x5')][_0x5af924][_0x359c('0x32')]=_0x514e19;_0x1a4a76[_0x359c('0x5')][_0x5af924]['updateAcw']=_0x1a4a76[_0x359c('0x33')][_0x359c('0x9')](_0x1a4a76,_0x5af924,_0x148f43);});}})['catch'](function(){logger[_0x359c('0x1d')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x148f43,_0x1a4a76[_0x359c('0x3')][_0x514e19]['acwTimeout'],_0x5af924,_0x514e19);})[_0x359c('0x34')](function(){delete _0x1a4a76[_0x359c('0x6')][_0x148f43];});}catch(_0x3dc4fa){logger[_0x359c('0x1d')](_0x359c('0x35'),_0x3dc4fa['message']);}};Acw[_0x359c('0x16')][_0x359c('0x2e')]=function(_0x19f259){try{var _0x16daa5=this;if(_0x16daa5[_0x359c('0x5')][_0x19f259]){_0x16daa5[_0x359c('0x5')][_0x19f259][_0x359c('0x17')]=![];var _0x311ba9=_0x16daa5[_0x359c('0x5')][_0x19f259][_0x359c('0x36')];var _0x536375=_0x16daa5[_0x359c('0x5')][_0x19f259][_0x359c('0x32')];var _0x19a61c=_0x16daa5[_0x359c('0x3')][_0x536375][_0x359c('0x2d')];logger[_0x359c('0x1a')](_0x359c('0x37'),_0x311ba9,_0x19f259);RpcUser[_0x359c('0x24')](this[_0x359c('0x4')][_0x19f259]['id'])[_0x359c('0x19')](function(_0xce0948){if(_0xce0948['pauseType']===_0x359c('0x20')){return RpcUser[_0x359c('0x38')](_0x16daa5['agents'][_0x19f259]);}});RpcVoiceAgentReport[_0x359c('0x18')]({'acwtime':_0x19a61c,'agentacw':!![]},_0x311ba9,_0x19f259)[_0x359c('0x19')](function(_0x1b07b2){logger[_0x359c('0x1a')](_0x359c('0x1b'),_0x311ba9,_0x19a61c,_0x1b07b2);})[_0x359c('0x1c')](function(_0x311e4d){logger[_0x359c('0x1d')](_0x359c('0x1e'),_0x311ba9,_0x311e4d);});}else{logger['error']('[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer',_0x19f259);if(_0x16daa5[_0x359c('0x5')]){logger[_0x359c('0x1a')](_0x359c('0x39'),JSON['stringify'](_0x16daa5[_0x359c('0x5')]));}}}catch(_0x1abeae){logger[_0x359c('0x1d')](_0x359c('0x3a'),_0x1abeae[_0x359c('0x3b')]);}};Acw[_0x359c('0x16')][_0x359c('0x8')]=function(_0x3e5105){try{if(this[_0x359c('0x3')][_0x3e5105[_0x359c('0x32')]]&&(this[_0x359c('0x3')][_0x3e5105[_0x359c('0x32')]][_0x359c('0x1')]||this['voiceQueues'][_0x3e5105[_0x359c('0x32')]][_0x359c('0x3c')])){if(this[_0x359c('0x4')][_0x3e5105[_0x359c('0x1f')]]){this['channels'][_0x3e5105[_0x359c('0x36')]]={'queue':_0x3e5105[_0x359c('0x32')],'interface':_0x3e5105[_0x359c('0x1f')],'destlinkedid':_0x3e5105['destlinkedid']};}}}catch(_0x4bc404){logger[_0x359c('0x1d')]('[ACW][syncAgentConnect]\x20%s',_0x4bc404['message']);}};Acw[_0x359c('0x16')][_0x359c('0x13')]=function(_0x410246){try{if(this[_0x359c('0x3')][_0x410246[_0x359c('0x32')]]&&(this[_0x359c('0x3')][_0x410246[_0x359c('0x32')]][_0x359c('0x1')]||this['voiceQueues'][_0x410246[_0x359c('0x32')]]['mandatoryDisposition'])){if(this['agents'][_0x410246[_0x359c('0x1f')]]){this[_0x359c('0x6')][_0x410246['uniqueid']]={'queue':_0x410246[_0x359c('0x32')],'interface':_0x410246['interface']};}}}catch(_0x3fa065){logger[_0x359c('0x1d')]('[ACW][syncAgentConnectPreview]\x20%s',_0x3fa065[_0x359c('0x3b')]);}};Acw['prototype'][_0x359c('0xb')]=function(_0x5dba4d){try{if(this[_0x359c('0x6')][_0x5dba4d['uniqueid']]&&_[_0x359c('0x3d')](this[_0x359c('0x6')][_0x5dba4d[_0x359c('0x36')]][_0x359c('0x27')])){logger[_0x359c('0x1a')]('[%s][HANGUP:UNIQUEID]',_0x5dba4d['uniqueid']);this[_0x359c('0x3e')](_0x5dba4d[_0x359c('0x36')]);}else if(this[_0x359c('0x6')][_0x5dba4d['linkedid']]&&_[_0x359c('0x3d')](this['channels'][_0x5dba4d['linkedid']][_0x359c('0x27')])){logger[_0x359c('0x1a')]('[%s][HANGUP:LINKEDID]',_0x5dba4d[_0x359c('0x3f')]);this[_0x359c('0x3e')](_0x5dba4d[_0x359c('0x3f')]);}}catch(_0x1a4e9b){logger[_0x359c('0x1d')]('[ACW][syncHangupRequest]\x20%s',_0x1a4e9b[_0x359c('0x3b')]);}};Acw[_0x359c('0x16')][_0x359c('0xd')]=function(_0x20afb8){try{if(this['channels'][_0x20afb8['uniqueid']]&&this[_0x359c('0x6')][_0x20afb8[_0x359c('0x36')]][_0x359c('0x27')]){logger['info'](_0x359c('0x40'),_0x20afb8['uniqueid']);this['startAcw'](_0x20afb8[_0x359c('0x36')]);}else if(this[_0x359c('0x6')][_0x20afb8[_0x359c('0x3f')]]&&this[_0x359c('0x6')][_0x20afb8[_0x359c('0x3f')]]['attended']){logger[_0x359c('0x1a')](_0x359c('0x41'),_0x20afb8['linkedid']);this[_0x359c('0x3e')](_0x20afb8[_0x359c('0x3f')]);}}catch(_0x591af6){logger['error'](_0x359c('0x42'),_0x591af6['message']);}};Acw[_0x359c('0x16')]['syncAttendedTransfer']=function(_0x376bb7){try{if(!_[_0x359c('0x43')](this[_0x359c('0x6')][_0x376bb7['transfereeuniqueid']])){this[_0x359c('0x3e')](_0x376bb7[_0x359c('0x44')]);if(this[_0x359c('0x6')][_0x376bb7[_0x359c('0x45')]]){this[_0x359c('0x6')][_0x376bb7[_0x359c('0x45')]][_0x359c('0x27')]=!![];this[_0x359c('0x6')][_0x376bb7[_0x359c('0x46')]]=this['channels'][_0x376bb7['secondtransfereruniqueid']];delete this[_0x359c('0x6')][_0x376bb7[_0x359c('0x45')]];}}else if(!_[_0x359c('0x43')](this[_0x359c('0x6')][_0x376bb7['transfertargetuniqueid']])){this[_0x359c('0x3e')](_0x376bb7[_0x359c('0x46')]);if(this[_0x359c('0x6')][_0x376bb7[_0x359c('0x47')]]){this[_0x359c('0x6')][_0x376bb7[_0x359c('0x47')]][_0x359c('0x27')]=!![];this[_0x359c('0x6')][_0x376bb7[_0x359c('0x44')]]=this[_0x359c('0x6')][_0x376bb7[_0x359c('0x47')]];delete this[_0x359c('0x6')][_0x376bb7[_0x359c('0x47')]];}}}catch(_0x507aba){logger[_0x359c('0x1d')](_0x359c('0x48'),_0x507aba[_0x359c('0x3b')]);}};Acw['prototype'][_0x359c('0x49')]=function(_0x5b0707){try{if(this['channels'][_0x5b0707[_0x359c('0x4a')]]){logger[_0x359c('0x1a')](_0x359c('0x4b'),JSON[_0x359c('0x4c')](_0x5b0707[_0x359c('0x4a')]));this[_0x359c('0x3e')](_0x5b0707[_0x359c('0x4a')]);}else if(this[_0x359c('0x6')][_0x5b0707[_0x359c('0x4d')]]){logger[_0x359c('0x1a')](_0x359c('0x4e'),JSON['stringify'](_0x5b0707[_0x359c('0x4d')]));this[_0x359c('0x3e')](_0x5b0707['transfererlinkedid']);}}catch(_0x209e1f){logger[_0x359c('0x1d')](_0x359c('0x4f'),_0x209e1f['message']);}};Acw[_0x359c('0x16')]['syncAgentRingNoAnswer']=function(_0x8d6c42){try{if(this['voiceQueues'][_0x8d6c42['queue']]&&this[_0x359c('0x3')][_0x8d6c42[_0x359c('0x32')]]['autopause']===_0x359c('0x50')){if(this[_0x359c('0x4')][_0x8d6c42[_0x359c('0x1f')]]){logger[_0x359c('0x1a')](_0x359c('0x51'),_0x8d6c42[_0x359c('0x36')],_0x8d6c42[_0x359c('0x1f')],_0x8d6c42['queue']);return RpcUser[_0x359c('0x29')](this['agents'][_0x8d6c42[_0x359c('0x1f')]],_0x359c('0x52'),_0x8d6c42[_0x359c('0x36')]);}}}catch(_0x4fffd7){logger['error'](_0x359c('0x53'),_0x4fffd7[_0x359c('0x3b')]);}};module['exports']=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 844159a..22a9a75 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 _0x1731=['actionQueueSummary','catch','[ami.js][fullybooted]','close','exports','asterisk-manager','util','../../config/logger','../../config/environment','port','asterisk','username','password','keepConnected','promisify','action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','Action','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\x20\x22%s\x22\x20to\x20%s:%s','resolve','then'];(function(_0x567663,_0xe92da3){var _0x31b567=function(_0x5326a8){while(--_0x5326a8){_0x567663['push'](_0x567663['shift']());}};_0x31b567(++_0xe92da3);}(_0x1731,0xa1));var _0x1173=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1731[_0x3dd15e];return _0x231fd0;};'use strict';var Manager=require(_0x1173('0x0'));var BPromise=require('bluebird');var util=require(_0x1173('0x1'));var logger=require(_0x1173('0x2'))('ami');var config=require(_0x1173('0x3'));var ami=new Manager(config['asterisk'][_0x1173('0x4')],config[_0x1173('0x5')]['ip'],config[_0x1173('0x5')][_0x1173('0x6')],config[_0x1173('0x5')][_0x1173('0x7')],!![]);ami[_0x1173('0x8')]();ami['Action']=BPromise[_0x1173('0x9')](ami[_0x1173('0xa')]);function error(_0x488881){logger[_0x1173('0xb')](util[_0x1173('0xc')](_0x1173('0xd'),config[_0x1173('0x5')][_0x1173('0x6')],config[_0x1173('0x5')]['ip'],config[_0x1173('0x5')]['port'],util[_0x1173('0xe')](_0x488881,![],null)));}function close(){logger[_0x1173('0xb')](util['format'](_0x1173('0xf'),config[_0x1173('0x5')][_0x1173('0x6')],config[_0x1173('0x5')]['ip'],config[_0x1173('0x5')][_0x1173('0x4')]));}ami[_0x1173('0x10')]=function(){return function(){return ami[_0x1173('0x11')]({'action':_0x1173('0x12')});};};ami[_0x1173('0x13')]=function(){return function(){return ami['Action']({'action':_0x1173('0x14')});};};ami[_0x1173('0x15')]=function(){return function(){return ami['Action']({'action':_0x1173('0x16')});};};ami['actionQueueSummary']=function(){return function(){return ami[_0x1173('0x11')]({'action':_0x1173('0x17')});};};ami[_0x1173('0x18')]=function(){return function(){return ami['Action']({'action':_0x1173('0x19')});};};function connect(){logger[_0x1173('0x1a')](util[_0x1173('0xc')](_0x1173('0x1b'),config[_0x1173('0x5')][_0x1173('0x6')],config[_0x1173('0x5')]['ip'],config['asterisk'][_0x1173('0x4')]));ami[_0x1173('0x1c')](_0x1173('0xb'),error);ami[_0x1173('0x1c')]('close',close);}ami['on']('connect',connect);ami['on'](_0x1173('0x1d'),function(_0x1b7e65){logger[_0x1173('0x1a')](util[_0x1173('0xc')](_0x1173('0x1e'),config[_0x1173('0x5')]['username'],config[_0x1173('0x5')]['ip'],config[_0x1173('0x5')][_0x1173('0x4')],util[_0x1173('0xe')](_0x1b7e65,![],null)));});ami['on']('fullybooted',function(){logger[_0x1173('0x1a')](util[_0x1173('0xc')](_0x1173('0x1f'),config[_0x1173('0x5')][_0x1173('0x6')],config[_0x1173('0x5')]['ip'],config[_0x1173('0x5')][_0x1173('0x4')]));return Promise[_0x1173('0x20')]()[_0x1173('0x21')](ami[_0x1173('0x10')]())[_0x1173('0x21')](ami[_0x1173('0x13')]())[_0x1173('0x21')](ami[_0x1173('0x15')]())['then'](ami[_0x1173('0x22')]())[_0x1173('0x21')](ami[_0x1173('0x18')]())[_0x1173('0x23')](function(_0x48ec58){logger[_0x1173('0xb')](_0x1173('0x24'),util[_0x1173('0xe')](_0x48ec58,{'showHidden':![],'depth':null}));});});ami[_0x1173('0x1c')](_0x1173('0xb'),error);ami['once'](_0x1173('0x25'),close);module[_0x1173('0x26')]=ami; \ No newline at end of file +var _0x5b96=['util','../../config/logger','../../config/environment','port','asterisk','username','password','keepConnected','Action','promisify','action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','sipshowregistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','sippeerstatus','actionQueueSummary','queuesummary','actionCoreShowChannels','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','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','catch','[ami.js][fullybooted]','exports'];(function(_0x6c0a23,_0x29b948){var _0x381c87=function(_0x3c0cc0){while(--_0x3c0cc0){_0x6c0a23['push'](_0x6c0a23['shift']());}};_0x381c87(++_0x29b948);}(_0x5b96,0x15f));var _0x65b9=function(_0x4c4981,_0x178530){_0x4c4981=_0x4c4981-0x0;var _0x2dc9c1=_0x5b96[_0x4c4981];return _0x2dc9c1;};'use strict';var Manager=require('asterisk-manager');var BPromise=require('bluebird');var util=require(_0x65b9('0x0'));var logger=require(_0x65b9('0x1'))('ami');var config=require(_0x65b9('0x2'));var ami=new Manager(config['asterisk'][_0x65b9('0x3')],config[_0x65b9('0x4')]['ip'],config[_0x65b9('0x4')][_0x65b9('0x5')],config[_0x65b9('0x4')][_0x65b9('0x6')],!![]);ami[_0x65b9('0x7')]();ami[_0x65b9('0x8')]=BPromise[_0x65b9('0x9')](ami[_0x65b9('0xa')]);function error(_0x1b8fd7){logger[_0x65b9('0xb')](util[_0x65b9('0xc')](_0x65b9('0xd'),config[_0x65b9('0x4')]['username'],config['asterisk']['ip'],config[_0x65b9('0x4')]['port'],util[_0x65b9('0xe')](_0x1b8fd7,![],null)));}function close(){logger['error'](util['format'](_0x65b9('0xf'),config['asterisk']['username'],config[_0x65b9('0x4')]['ip'],config['asterisk'][_0x65b9('0x3')]));}ami[_0x65b9('0x10')]=function(){return function(){return ami[_0x65b9('0x8')]({'action':_0x65b9('0x11')});};};ami[_0x65b9('0x12')]=function(){return function(){return ami[_0x65b9('0x8')]({'action':_0x65b9('0x13')});};};ami[_0x65b9('0x14')]=function(){return function(){return ami[_0x65b9('0x8')]({'action':_0x65b9('0x15')});};};ami[_0x65b9('0x16')]=function(){return function(){return ami['Action']({'action':_0x65b9('0x17')});};};ami[_0x65b9('0x18')]=function(){return function(){return ami[_0x65b9('0x8')]({'action':'coreshowchannels'});};};function connect(){logger[_0x65b9('0x19')](util[_0x65b9('0xc')](_0x65b9('0x1a'),config[_0x65b9('0x4')][_0x65b9('0x5')],config[_0x65b9('0x4')]['ip'],config[_0x65b9('0x4')][_0x65b9('0x3')]));ami[_0x65b9('0x1b')](_0x65b9('0xb'),error);ami['once'](_0x65b9('0x1c'),close);}ami['on'](_0x65b9('0x1d'),connect);ami['on'](_0x65b9('0x1e'),function(_0x319cb6){logger[_0x65b9('0x19')](util[_0x65b9('0xc')](_0x65b9('0x1f'),config['asterisk']['username'],config[_0x65b9('0x4')]['ip'],config[_0x65b9('0x4')][_0x65b9('0x3')],util[_0x65b9('0xe')](_0x319cb6,![],null)));});ami['on'](_0x65b9('0x20'),function(){logger[_0x65b9('0x19')](util[_0x65b9('0xc')](_0x65b9('0x21'),config['asterisk'][_0x65b9('0x5')],config['asterisk']['ip'],config[_0x65b9('0x4')]['port']));return Promise[_0x65b9('0x22')]()[_0x65b9('0x23')](ami['actionSipShowRegistry']())['then'](ami['actionDeviceStateList']())[_0x65b9('0x23')](ami['actionSipPeerStatus']())[_0x65b9('0x23')](ami[_0x65b9('0x16')]())['then'](ami[_0x65b9('0x18')]())[_0x65b9('0x24')](function(_0x5a1157){logger[_0x65b9('0xb')](_0x65b9('0x25'),util['inspect'](_0x5a1157,{'showHidden':![],'depth':null}));});});ami[_0x65b9('0x1b')]('error',error);ami['once'](_0x65b9('0x1c'),close);module[_0x65b9('0x26')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 22a3a67..6302991 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 _0xcb91=['request','debug','memberReport','error','rpc','message','result','catch','exports','../../config/logger','ami','client','http'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x591a90,_0x5525b0){_0x591a90=_0x591a90-0x0;var _0x551587=_0xcb91[_0x591a90];return _0x551587;};'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 +var _0xb7e7=['exports','jayson/promise','../../config/logger','client','Request','debug','rpc','error','memberReport','message','result','catch'];(function(_0xce93c,_0x555be5){var _0x230720=function(_0x6d5428){while(--_0x6d5428){_0xce93c['push'](_0xce93c['shift']());}};_0x230720(++_0x555be5);}(_0xb7e7,0x121));var _0x7b7e=function(_0x1a36a5,_0x746928){_0x1a36a5=_0x1a36a5-0x0;var _0x746243=_0xb7e7[_0x1a36a5];return _0x746243;};'use strict';var jayson=require(_0x7b7e('0x0'));var BPromise=require('bluebird');var logger=require(_0x7b7e('0x1'))('ami');var client=jayson[_0x7b7e('0x2')]['http']({'port':0x2329});client[_0x7b7e('0x3')]=function(_0x556d68,_0x31d0ed){return new BPromise(function(_0x118577,_0x1d9384){return client['request'](_0x556d68,_0x31d0ed)['then'](function(_0x333fa4){logger[_0x7b7e('0x4')](_0x7b7e('0x5'),'memberReport',_0x556d68,_0x31d0ed,_0x333fa4);if(_0x333fa4[_0x7b7e('0x6')]){logger[_0x7b7e('0x6')](_0x7b7e('0x5'),_0x7b7e('0x7'),_0x556d68,_0x333fa4[_0x7b7e('0x6')][_0x7b7e('0x8')],_0x31d0ed);return _0x1d9384(_0x333fa4[_0x7b7e('0x6')]['message']);}else{return _0x118577(_0x333fa4[_0x7b7e('0x9')]);}})[_0x7b7e('0xa')](function(_0x10a666){logger[_0x7b7e('0x6')](_0x7b7e('0x5'),_0x7b7e('0x7'),_0x556d68,_0x10a666,_0x31d0ed);return _0x1d9384(_0x10a666);});});};module[_0x7b7e('0xb')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index af292b1..7b045b4 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 _0x9de6=['[originate][error]','originate\x20action\x20Error','countcongestionretry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','[rescheduleContact][NoSuchNumber]','dialAbandonedMaxRetry','[rescheduleContact][Abandoned]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','evt\x20is\x20undefine','outboundNoSuchCallsDay','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','dialNoSuchNumberRetryFrequency','checkRetriveMax','reason\x200\x20no\x20such\x20number....','buildNoAnswerEventPayload','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','Busy','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','outboundCongestionCallsDay','Congestion','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','[syncAgentComplete][createHistory][11]','reason\x2011\x20abandoned','outboundRejectCallsDay','AgentReject','agentreject','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','round','predictiveIntervalMaxThreshold','predictiveIntervalAvailable','talking','floor','predictiveIntervalHitRate','[startMethodPredictive][StartProgressive]','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','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','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','outboundQueuePauses','[CatchErlangB]','agentBusyFactor','loggedIn','predictiveIntervalPauses','one\x20call\x20every:','milliseconds','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','scheduledat','dialRecallMeTimeout','voicePause','[rescheduleContact][dialRecallInQueue]','QUEUE_RECALL','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALL_TIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','[Originate][historyBlacklist]','limitCalls','getContactDialerIvr','checkContactEmpty','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','Contact','emptyContact','[actionOriginate]\x20','checkIsBlackListIvr','[getContactCampaign2]','dialLimitQueue','not_inuse','reachable','getContactDialer','[countReScheduled]\x20','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','dialOrderByScheduledAt','abandonmentRate','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','erlangb','----\x20Agent\x20Busy\x20Factor\x20----','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','m\x20=\x20','Ts\x20=\x20','[busyFactor]','Umin\x20=\x20','util','uuid','moment','ioredis','./utils','./utils/hopper','../preview/util/util','dialer','../../../config/logger','booked','predictive','predictiveCalls','syncQueueSummary','../ami','redis','defaults','socket.io-emitter','../rpc/cmHopper','../rpc/setting','../rpc/interval','./models/action','./models/history','./models/agentComplete','./models/queueCallerAbandon','env','XCALLY_IP_AGI','127.0.0.1','enqueue','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','contactsId','startProgressive','ivrOriginated','queueBooked','queuesSummary','syncAgentConnect','bind','queuecallerabandon','originateresponse','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummarycomplete','syncQueueSummaryComplete','hangup','syncHangup','syncNewExten','syncVarSet','queuemember','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','getSettings','then','previewRecallmeReminderInterval','isUndefined','emit','type','outbound','inspect','voice:queue:%s','name','voice_queue:save','isEmpty','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalTotalCalls','info','predictiveIntervalAnsweredCalls','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsTimeout','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsCallersExit','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgHoldtime','---------------------------','predictiveIntervalAvgTalktime','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCalls','erlangCallToSecond','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangAbandonmentRate','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangBusyFactor','merge','getSeconds','debug','startPredictive','startPredictive\x20value\x20cleared','handlePredictive','handlePredictive\x20interval\x20cleared','error','stack','checkContactLowerLimitOriginate','temp','message','CAMPAIGN_STATUS','[getContactDialer2][ReScheduled]','contacts','NO_AVAILABLE_CONTACTS','[getContactDialer2][Empty]','state','statedesc','queueStatusComplete','[booked][unlockQueueStatus]','stringify','NULL_INTERVAL','Interval','Intervals','\x20INTERVAL_IS_NULL','isIVRCampaignActive','INACTIVE','format','campaign:ivr:%s','campaign:save','sendMessageOneNotActive','originated','is\x20not\x20active','DISACTIVED','is\x20disactive','[ifTime][Action]','isTrunkReachable','active','SIP/%s','status','prototype','checkIsTrunkReachable','Trunk','TRUNK_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTimeIvr','checkIfTimeIntervals','ifTime','Failure','\x20Intervals\x20is\x20null\x20','EMPTY_INTERVAL','timezones','UNKNOWN_TIMEZONE','isArray','length','command','iftime\x20%s,%s','interval','content','indexOf','true','catch','push','all','OVERTIME_GLOBAL_INTERVAL','OVERTIME_INTERVAL','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','resetActiveCalls','syncCampaigns','undefined','isIVRCampaign','resolve','dialTimezone','checkDialMethod','dialMethod','progressive','power','handlePower','Queue','method\x20not\x20recognized','dialGlobalInterval','Dialer::ifTime()','Voice\x20Queue\x20%s\x20$s','intervalIftime','Timezone:\x20','silly','Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:','AMI\x20IfTime','Error','queue','uniqueId','uniqueid','ivr','updateOriginated','answertime','YYYY-MM-DD\x20HH:mm:ss','outboundAnswerCallsDay','reason','agent','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','moveContactManagedDialer','[syncAgentComplete]','syncQueueCallerAbandon','droptime','responsetime','outboundDropCallsDayTimeout','predictiveIntervalErlangCallsDroppedCalls','Drop','TIMEOUT','countdropretry','countglobal','dialDropRetryFrequency','callAdditionalPhoneAfterMin','verifyAdditionalPhones','additional','dialDropMaxRetry','queueCallerAbandonCreateState','add','minutes','ContactId','ListId','VoiceQueueId','CampaignId','[rescheduleContact][Drop]','starttime','endtime','calleridname','calleridnum','createHistory','[syncAgentComplete][createHistory][10]','swapAdditionalPhones','outboundDropCallsDayCallersExit','dropreason','CALLEREXIT','countabandonedretry','rescheduleContact','dialAbandonedRetryFrequency','Abandoned','actions','channel','actionid','rrmemory','roundrobin','paused','stateinterface','locked','pick','idHopper','strategy','run','[Catch][Preview][syncQueueStatusComplete]','queueBookedRR','_rr','isNil','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','[booked][RR][finaly]','[booked][unlock]','[unlock][syncQueueStatusComplete]','[booked][unlock2]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','getQueue','response','Success','callProgressDetecting','[callProgressDetecting]\x20','variable','amdstatus','exten','xcally-motion-dialer','dialAMDActive','value','HANGUP','outboundAnswerAgiCallsDay','HangupInAMD','membername','AMD','buildObj','amd','[syncHangupInAMD][createHistory]','MACHINE','Machine','custom:amd','[syncAgentComplete][createHistory][0]','countbusyretry','countnoanswerretry','countnosuchnumberretry','countmachineretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','createStateFinal','dialMachineRetryFrequency','[rescheduleContact][Machine]','[syncHangupInAMDIvr]','reason19\x20machine....','dialMachineMaxRetry','reason\x2019\x20machine....','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','[syncHangupIvr][createHistory]','cause-txt','Normal\x20Clearing','outboundUnknownCallsDay','running','isPreviewCampaign','statusMessage','getQueueCampaignStatusMessage','available','inUse','pTalking','ACTIVE','compareToOutboundQueue','queueSummaryCountersUpdated','updateReportFromOutboundQueue','assign','[syncQueueSummary]','filter','online','handlePreviewRecallNotifications','map','Agent','user:%s','user:dialPreviewRecallReminder','checkPreviewRecallReminder','clearZombieChannels','[uniqueid]','[actions]','Action','No\x20such\x20channel','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','notFound','saveInDb','UserId','[emptyContact][createHistory]','[emptyContact]','[syncQueueCallerAbandon]\x20[Drop]','actionOriginate','object','originate','voiceQueue\x20is\x20undefine','phone','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialQueueTimeout','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','isOutboundQueue','XMD-VOICEQUEUEID','setXMDContactVariables','getCallerId','callerid','dialOriginateCallerIdName','getCallerIdRandom','dialOriginateCallerIdNumber','dialRandomLastDigitCallerIdNumber','TrunkBackup','XMD-ORIGINATECALLERIDNAME','originatecalleridname','extractCalleridName','XMD-ORIGINATECALLERIDNUM','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','dialOriginateTimeout','outboundOriginateFailureCallsDay','[originateError]:\x20%s','OriginateError'];(function(_0x40e7ed,_0x49b65a){var _0x34828a=function(_0x119a85){while(--_0x119a85){_0x40e7ed['push'](_0x40e7ed['shift']());}};_0x34828a(++_0x49b65a);}(_0x9de6,0x92));var _0x69de=function(_0x2b3baa,_0x4e06c6){_0x2b3baa=_0x2b3baa-0x0;var _0x238a4a=_0x9de6[_0x2b3baa];return _0x238a4a;};'use strict';var util=require(_0x69de('0x0'));var _=require('lodash');var uuid=require(_0x69de('0x1'));var moment=require(_0x69de('0x2'));var rr=require('rr');var Redis=require(_0x69de('0x3'));var utils=require(_0x69de('0x4'));var hopperUtils=require(_0x69de('0x5'));var ut=require(_0x69de('0x6'));var config=require('../../../config/environment/');var logger=require('../../../config/logger')(_0x69de('0x7'));var loggerBooked=require(_0x69de('0x8'))(_0x69de('0x9'));var loggerPredictive=require('../../../config/logger')(_0x69de('0xa'));var loggerPredictiveCalls=require(_0x69de('0x8'))(_0x69de('0xb'));var loggerSyncQueueSummary=require(_0x69de('0x8'))(_0x69de('0xc'));var ami=require(_0x69de('0xd'));config[_0x69de('0xe')]=_[_0x69de('0xf')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x69de('0x10'))(new Redis(config[_0x69de('0xe')]));var cmHopper=require(_0x69de('0x11'));var voiceQueueRt=require('../rpc/voiceQueueRt');var RpcSetting=require(_0x69de('0x12'));var Interval=require(_0x69de('0x13'));var Action=require(_0x69de('0x14'));var History=require(_0x69de('0x15'));var Final=require('./models/final');var AgentComplete=require(_0x69de('0x16'));var QueueCallerAbandon=require(_0x69de('0x17'));var Hangup=require('./models/hangup');var ipAgi=process[_0x69de('0x18')][_0x69de('0x19')]||_0x69de('0x1a');var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence['prototype'][_0x69de('0x1b')]=function(_0x205edf){this[_0x69de('0x1c')]=this[_0x69de('0x1c')]?this['tail'][_0x69de('0x1d')](_0x205edf):_0x205edf();};function Dialer(_0x37faea,_0x151c18){this[_0x69de('0x1e')]=new Sequence();this[_0x69de('0x1f')]=_0x151c18;this['voiceQueues']=_0x37faea[_0x69de('0x20')];this[_0x69de('0x21')]=_0x37faea[_0x69de('0x21')];this['agents']=_0x37faea[_0x69de('0x22')];this[_0x69de('0x23')]=_0x37faea[_0x69de('0x23')];this['maxNumberOriginate']=config[_0x69de('0x24')]||0x2;this[_0x69de('0x25')]={};this['actions']={};this[_0x69de('0x26')]={};this['uniqueId']={};this['optionPredictive']={};this['startPredictive']={};this[_0x69de('0x27')]={};this[_0x69de('0x28')]={};this[_0x69de('0x29')]={};this['queueBookedRR']={};this[_0x69de('0x2a')]={};ami['on']('agentconnect',this[_0x69de('0x2b')][_0x69de('0x2c')](this));ami['on'](_0x69de('0x2d'),this['syncQueueCallerAbandon'][_0x69de('0x2c')](this));ami['on'](_0x69de('0x2e'),this[_0x69de('0x2f')][_0x69de('0x2c')](this));ami['on'](_0x69de('0x30'),this[_0x69de('0x31')][_0x69de('0x2c')](this));ami['on']('custom:queuesummary',this['syncQueueSummary'][_0x69de('0x2c')](this));ami['on'](_0x69de('0x32'),this[_0x69de('0x33')][_0x69de('0x2c')](this));ami['on'](_0x69de('0x34'),this[_0x69de('0x35')][_0x69de('0x2c')](this));ami['on']('newexten',this[_0x69de('0x36')][_0x69de('0x2c')](this));ami['on']('varset',this[_0x69de('0x37')]['bind'](this));ami['on'](_0x69de('0x38'),this[_0x69de('0x39')]['bind'](this));ami['on'](_0x69de('0x3a'),this[_0x69de('0x3b')]['bind'](this));this[_0x69de('0x3c')]();this[_0x69de('0x3d')]();RpcSetting[_0x69de('0x3e')]()[_0x69de('0x3f')](function(_0x1e0a1a){previewRecallmeReminderInterval=_0x1e0a1a[_0x69de('0x40')];});}function isNotNull(_0x117598){return _0x117598!==null&&!_[_0x69de('0x41')](_0x117598);}function msgResponse(_0x477444,_0x38ab2e,_0x34c3e9){return{'action':_0x477444,'response':_0x38ab2e,'message':_0x34c3e9,'stack':_0x34c3e9};}function emit(_0x47d19b,_0xefc9a5,_0x4c29c2){io['to'](_0x47d19b)[_0x69de('0x42')](_0xefc9a5,_0x4c29c2);}function emitOutboundVoiceQueueSummary(_0x1602d7){if(_0x1602d7[_0x69de('0x43')]===_0x69de('0x44')){logger['debug']('[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:',util[_0x69de('0x45')](_0x1602d7,{'showHidden':![],'depth':null}));emit(util['format'](_0x69de('0x46'),_0x1602d7[_0x69de('0x47')]),_0x69de('0x48'),_0x1602d7);}}function checkGetDataPredictive(_0x32807c){if(isNotNull(_0x32807c)&&!_[_0x69de('0x49')](_0x32807c)){loggerPredictive['info'](_0x69de('0x4a'));loggerPredictive['info'](_0x69de('0x4b'),_0x32807c[_0x69de('0x4c')]);loggerPredictive[_0x69de('0x4d')]('Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x32807c[_0x69de('0x4e')]);loggerPredictive[_0x69de('0x4d')](_0x69de('0x4f'),_0x32807c[_0x69de('0x50')]);loggerPredictive[_0x69de('0x4d')](_0x69de('0x51'),_0x32807c[_0x69de('0x52')]);loggerPredictive[_0x69de('0x4d')](_0x69de('0x53'),_0x32807c[_0x69de('0x54')]);loggerPredictive[_0x69de('0x4d')]('AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x32807c['predictiveIntervalAvgTalktime']);loggerPredictive[_0x69de('0x4d')](_0x69de('0x55'));if(_0x32807c['predictiveIntervalTotalCalls']>0x0){if(!_[_0x69de('0x41')](_0x32807c[_0x69de('0x56')])&&_0x32807c[_0x69de('0x56')]>0x0){return!![];}loggerPredictive['info'](_0x69de('0x57'));if(!_[_0x69de('0x41')](_0x32807c[_0x69de('0x54')])&&_0x32807c[_0x69de('0x54')]>0x0){return!![];}loggerPredictive[_0x69de('0x4d')](_0x69de('0x58'));}else{loggerPredictive[_0x69de('0x4d')](_0x69de('0x59'));}}else{loggerPredictive['info']('History\x20information\x20are\x20empty');}return![];}function mergeDataErlangB(_0x4531ff){return function(_0x163694){loggerPredictive[_0x69de('0x4d')](_0x69de('0x5a'));loggerPredictive[_0x69de('0x4d')](_0x69de('0x5b'),_0x163694[_0x69de('0x5c')]);loggerPredictive[_0x69de('0x4d')]('One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x163694[_0x69de('0x5d')]);loggerPredictive[_0x69de('0x4d')](_0x69de('0x5e'),_0x163694[_0x69de('0x5f')]);loggerPredictive['info'](_0x69de('0x60'),_0x163694[_0x69de('0x61')]);loggerPredictive[_0x69de('0x4d')](_0x69de('0x5e'),_0x163694[_0x69de('0x5f')]);loggerPredictive[_0x69de('0x4d')]('---------------------------');_[_0x69de('0x62')](_0x4531ff,_0x163694);};}function ifInterval(_0x5b0bba,_0x29026a){if(_['isUndefined'](_0x29026a)){return![];}return utils[_0x69de('0x63')](undefined,_0x29026a)<_0x5b0bba*0x3c;}function clearPredictiveAttributes(_0x5d347b){if(_0x5d347b[_0x69de('0x27')]){_0x5d347b[_0x69de('0x27')]=undefined;loggerPredictive[_0x69de('0x64')](_0x5d347b['name'],'startProgressive\x20value\x20cleared');}if(_0x5d347b[_0x69de('0x65')]){_0x5d347b[_0x69de('0x65')]=undefined;loggerPredictive['debug'](_0x5d347b[_0x69de('0x47')],_0x69de('0x66'));}if(_0x5d347b[_0x69de('0x67')]){clearInterval(_0x5d347b[_0x69de('0x67')]);_0x5d347b[_0x69de('0x67')]=undefined;loggerPredictive[_0x69de('0x64')](_0x5d347b['name'],_0x69de('0x68'));}}function loggerCatchPredictive(_0xc09c92,_0xed613d){return function(_0x4cb69c){loggerPredictive[_0x69de('0x69')](_0xed613d['name'],_0xc09c92);loggerPredictive[_0x69de('0x69')](_0x4cb69c[_0x69de('0x6a')]);clearPredictiveAttributes(_0xed613d);};}function loggerCatch(_0x227047){return function(_0x53ea85){logger[_0x69de('0x69')](_0x227047,util['inspect'](_0x53ea85,{'showHidden':![],'depth':null}));};}function loggerGetContactDialer(_0x4d3b86,_0x180560,_0x35bbad){return function(_0x4deb9b){utils[_0x69de('0x6b')](_0x180560,_0x35bbad,0x0);_0x180560[_0x69de('0x6c')]=0x0;logger[_0x69de('0x69')](_0x4d3b86,util[_0x69de('0x45')](_0x4deb9b,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x40845a){return function(_0x1b98bb){if(isNotNull(_0x1b98bb)&&isNotNull(_0x1b98bb[0x0])){if(_0x1b98bb[0x0]['contactsRescheduled']>0x0){_0x40845a[_0x69de('0x6d')]=utils[_0x69de('0x6e')]['CONTACTS_RESCHEDULED'];logger[_0x69de('0x4d')](_0x69de('0x6f')+_0x40845a[_0x69de('0x47')],_0x1b98bb[0x0]['contactsRescheduled'],_0x69de('0x70'));}else{_0x40845a[_0x69de('0x6d')]=utils['CAMPAIGN_STATUS'][_0x69de('0x71')];logger[_0x69de('0x4d')](_0x69de('0x72')+_0x40845a[_0x69de('0x47')]);}}};}function createObjHistory(_0x3925b,_0x4477bc,_0x5e243c,_0x103af9,_0x11df46){_0x3925b['message']=_0x5e243c;var _0x3becfa=new Action(_0x3925b,_0x4477bc);var _0x23b0d0=new History(_0x3becfa);_0x23b0d0[_0x69de('0x73')]=_0x103af9;_0x23b0d0[_0x69de('0x74')]=_0x11df46;_0x23b0d0['endtime']=_0x3becfa['starttime'];return _0x23b0d0;}function unlockQueueStatus(_0xde52b9,_0x910187){setTimeout(function(){if(_[_0x69de('0x41')](_0xde52b9[_0x69de('0x75')])){loggerBooked[_0x69de('0x69')]('[unlockQueueStatus][undefined]',_0x910187);}_0xde52b9[_0x69de('0x75')]=!![];loggerBooked['info'](_0x69de('0x76'),_0x910187,JSON[_0x69de('0x77')](_['pick'](_0xde52b9,[_0x69de('0x47'),'queueStatusComplete'])));},0x1f3);}function checkInterval(_0x3cea85){return function(){if(!isNotNull(_0x3cea85['Interval'])){_0x3cea85[_0x69de('0x6d')]=utils[_0x69de('0x6e')][_0x69de('0x78')];throw _0x3cea85[_0x69de('0x47')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_0x3cea85[_0x69de('0x79')][_0x69de('0x7a')])){_0x3cea85[_0x69de('0x6d')]=utils[_0x69de('0x6e')][_0x69de('0x78')];throw _0x3cea85['name']+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_[_0x69de('0x49')](_0x3cea85[_0x69de('0x79')][_0x69de('0x7a')]))){_0x3cea85[_0x69de('0x6d')]=utils[_0x69de('0x6e')][_0x69de('0x78')];throw _0x3cea85[_0x69de('0x47')]+_0x69de('0x7b');}};}function checkIsIVRCampaignActive(_0xcf065){return function(){if(!utils[_0x69de('0x7c')](_0xcf065)){_0xcf065['message']=utils[_0x69de('0x6e')][_0x69de('0x7d')];throw _0xcf065[_0x69de('0x47')]+'\x20NOT\x20Active';}};}function emitCampaignSummary(_0x571731){if(utils['isIVRCampaign'](_0x571731)){emit(util[_0x69de('0x7e')](_0x69de('0x7f'),_0x571731[_0x69de('0x47')]),_0x69de('0x80'),_0x571731);}}function loggerCatchQueueSummary(_0x3391f5,_0x31d663){return function(_0x17696e){clearPredictiveAttributes(_0x31d663);emitCampaignSummary(_0x31d663);loggerSyncQueueSummary[_0x69de('0x64')](_0x3391f5,util['inspect'](_0x17696e,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x263ca0){if(_0x263ca0[_0x69de('0x81')]){if(_0x263ca0[_0x69de('0x82')]===0x0){_0x263ca0[_0x69de('0x81')]=![];_0x263ca0['message']=utils[_0x69de('0x6e')]['INACTIVE'];loggerSyncQueueSummary[_0x69de('0x64')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x263ca0['name'],_0x69de('0x83'));}else{_0x263ca0[_0x69de('0x6d')]=utils['CAMPAIGN_STATUS'][_0x69de('0x84')];loggerSyncQueueSummary[_0x69de('0x64')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x263ca0[_0x69de('0x47')],_0x69de('0x85'));}emitCampaignSummary(_0x263ca0);}}function myreject(_0x1b75f7){return function(_0x56cfcb){return _0x1b75f7(msgResponse(_0x69de('0x86'),'Error',JSON[_0x69de('0x77')](_0x56cfcb)));};}Dialer['prototype'][_0x69de('0x87')]=function(_0xd40aef){return!_[_0x69de('0x41')](_0xd40aef)&&_0xd40aef&&!_[_0x69de('0x41')](_0xd40aef[_0x69de('0x47')])&&!_[_0x69de('0x41')](_0xd40aef['active'])&&_0xd40aef[_0x69de('0x88')]&&(this['trunks'][util[_0x69de('0x7e')](_0x69de('0x89'),_0xd40aef['name'])][_0x69de('0x8a')]==='reachable'||this[_0x69de('0x23')][util[_0x69de('0x7e')](_0x69de('0x89'),_0xd40aef[_0x69de('0x47')])][_0x69de('0x8a')]==='unmonitored');};Dialer[_0x69de('0x8b')][_0x69de('0x8c')]=function(_0x2469e6){var _0x10f7c8=this;return function(){if(!_0x10f7c8['isTrunkReachable'](_0x2469e6[_0x69de('0x8d')])){if(!_0x10f7c8[_0x69de('0x87')](_0x2469e6['TrunkBackup'])){_0x2469e6['message']=utils[_0x69de('0x6e')][_0x69de('0x8e')];throw _0x2469e6[_0x69de('0x47')]+_0x69de('0x8f');}}};};Dialer[_0x69de('0x8b')][_0x69de('0x90')]=function(_0x3921fb,_0x425706,_0x5bac43,_0x3d70e4){var _0x11d8ae=this;return function(){var _0x368c30=!![];return _0x11d8ae[_0x69de('0x91')](_0x3921fb,_0x425706,_0x5bac43,_0x3d70e4,_0x368c30);};};Dialer[_0x69de('0x8b')][_0x69de('0x92')]=function(_0x5d2172,_0x3f6fc6,_0x79d504,_0x310a6e){var _0x522ffa=this;return function(){var _0x322342=![];return _0x522ffa[_0x69de('0x91')](_0x5d2172[_0x69de('0x7a')],_0x3f6fc6,_0x79d504,_0x310a6e,_0x322342);};};Dialer['prototype'][_0x69de('0x91')]=function(_0x510e36,_0x219eb4,_0x41e29a,_0x487126,_0x27ea8f){var _0x180315=[];return new Promise(function(_0x4168c2,_0x54cf9b){if(!isNotNull(_0x510e36)){_0x487126[_0x69de('0x6d')]=utils[_0x69de('0x6e')][_0x69de('0x78')];return _0x54cf9b(msgResponse(_0x69de('0x93'),_0x69de('0x94'),_0x41e29a+_0x69de('0x95')));}if(_[_0x69de('0x49')](_0x510e36)){_0x487126[_0x69de('0x6d')]=utils[_0x69de('0x6e')][_0x69de('0x96')];return _0x54cf9b(msgResponse(_0x69de('0x93'),'Failure',_0x41e29a+'\x20Intervals\x20is\x20empty\x20'));}if(_0x219eb4&&_[_0x69de('0x41')](config[_0x69de('0x97')][_0x219eb4])){_0x487126[_0x69de('0x6d')]=utils['CAMPAIGN_STATUS'][_0x69de('0x98')];return _0x54cf9b(msgResponse(_0x69de('0x93'),_0x69de('0x94'),_0x41e29a+'\x20Timezone\x20unknow\x20'+_0x219eb4));}if(_[_0x69de('0x99')](_0x510e36)){for(var _0x3c958d=0x0;_0x3c958d<_0x510e36[_0x69de('0x9a')];_0x3c958d+=0x1){_0x180315['push'](ami['Action']({'action':_0x69de('0x9b'),'command':util['format'](_0x69de('0x9c'),_0x510e36[_0x3c958d][_0x69de('0x9d')],!_[_0x69de('0x41')](config['timezones'][_0x219eb4])?_0x219eb4:'')})[_0x69de('0x3f')](function(_0x2a9b27){return _0x2a9b27[_0x69de('0x9e')][_0x69de('0x9f')](_0x69de('0xa0'))>=0x0;})[_0x69de('0xa1')](myreject(_0x54cf9b)));}}else{_0x180315[_0x69de('0xa2')](ami['Action']({'action':'command','command':util[_0x69de('0x7e')]('iftime\x20%s,%s',_0x510e36,!_[_0x69de('0x41')](config[_0x69de('0x97')][_0x219eb4])?_0x219eb4:'')})['then'](function(_0x494109){return _0x494109['content'][_0x69de('0x9f')]('true')>=0x0;})[_0x69de('0xa1')](myreject(_0x54cf9b)));}Promise[_0x69de('0xa3')](_0x180315)['then'](function(_0x51b6aa){var _0xffffe7=_['some'](_0x51b6aa);if(_0xffffe7){return _0x4168c2(_0xffffe7);}else{_0x487126[_0x69de('0x6d')]=_0x27ea8f?utils[_0x69de('0x6e')][_0x69de('0xa4')]:utils[_0x69de('0x6e')][_0x69de('0xa5')];return _0x54cf9b(msgResponse(_0x69de('0xa6'),_0x69de('0x94'),_0x69de('0xa7')+_0x27ea8f+'\x20'+_0x41e29a+_0x69de('0xa8')+util[_0x69de('0x45')](_0x510e36,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0x219eb4));}})['catch'](function(_0x282342){return _0x54cf9b(msgResponse(_0x69de('0x93'),'Failure',JSON['stringify'](_0x282342)));});});};Dialer[_0x69de('0x8b')][_0x69de('0x3c')]=function(){var _0x253ee4=this;return cmHopper[_0x69de('0xa9')]({'active':![]},{'where':{'active':!![]}})['then'](function(){setInterval(function(){_0x253ee4['syncCampaigns']();},0x3e8);});};Dialer[_0x69de('0x8b')][_0x69de('0xaa')]=function(){var _0x279588=this;var _0x40fbfa;for(var _0x3bb883 in this[_0x69de('0x21')]){if(typeof this[_0x69de('0x21')][_0x3bb883]!==_0x69de('0xab')){_0x40fbfa=this[_0x69de('0x21')][_0x3bb883];if(utils[_0x69de('0xac')](_0x40fbfa)&&utils[_0x69de('0x7c')](_0x40fbfa)){_0x40fbfa[_0x69de('0x81')]=!![];Promise[_0x69de('0xad')]()['then'](checkIsIVRCampaignActive(_0x40fbfa))[_0x69de('0x3f')](checkInterval(_0x40fbfa))['then'](_0x279588[_0x69de('0x8c')](_0x40fbfa))[_0x69de('0x3f')](_0x279588['checkIfTime'](_0x40fbfa['dialGlobalInterval'],_0x40fbfa[_0x69de('0xae')],_0x40fbfa[_0x69de('0x47')],_0x40fbfa))['then'](_0x279588[_0x69de('0x92')](_0x40fbfa[_0x69de('0x79')],_0x40fbfa[_0x69de('0xae')],_0x40fbfa[_0x69de('0x47')],_0x40fbfa))['then'](_0x279588['launchHandleIvr'](_0x40fbfa))[_0x69de('0xa1')](loggerCatchQueueSummary('[syncCampaigns]',_0x40fbfa));}else{notSendMessagesCampaign(_0x40fbfa);}}}};Dialer[_0x69de('0x8b')][_0x69de('0xaf')]=function(_0x46fb89){if(_0x46fb89[_0x69de('0xb0')]!=='predictive'){clearPredictiveAttributes(_0x46fb89);}switch(_0x46fb89[_0x69de('0xb0')]){case _0x69de('0xb1'):this['handlePower'](_0x46fb89,0x1);break;case _0x69de('0xb2'):this[_0x69de('0xb3')](_0x46fb89,_0x46fb89['dialPowerLevel']);break;case'predictive':this[_0x69de('0xa')](_0x46fb89);break;case _0x69de('0x9'):this['handlePower'](_0x46fb89,0x1);break;default:logger['error'](_0x69de('0xb4'),_0x46fb89[_0x69de('0x47')],_0x69de('0xb5'));}};Dialer['prototype'][_0x69de('0x93')]=function(_0x49745b,_0x22d3ad){var _0x4fb46=_0x49745b[_0x69de('0xae')];var _0x20500e=_0x22d3ad?_0x49745b[_0x69de('0xb6')]:_0x49745b[_0x69de('0x79')][_0x69de('0x7a')];logger['silly'](_0x69de('0xb7'),_0x20500e,_0x4fb46,_0x49745b[_0x69de('0x47')],util[_0x69de('0x7e')](_0x69de('0xb8'),_0x49745b[_0x69de('0x47')],_0x49745b['id']));var _0x4bac6c=null;return Interval[_0x69de('0xb9')](_0x20500e,_0x4fb46)[_0x69de('0x3f')](function(_0x4efdc5){if(_0x4efdc5===!![]){return _0x4efdc5;}else{_0x49745b[_0x69de('0x6d')]=_0x22d3ad?utils[_0x69de('0x6e')]['OVERTIME_GLOBAL_INTERVAL']:utils[_0x69de('0x6e')][_0x69de('0xa5')];_0x4bac6c=msgResponse(_0x69de('0xa6'),_0x69de('0x94'),_0x69de('0xa7')+_0x22d3ad+'\x20'+_0x49745b[_0x69de('0x47')]+'\x20Interval\x20is\x20overtime:\x20'+util[_0x69de('0x45')](_0x20500e,{'showHidden':![],'depth':null})+_0x69de('0xba')+_0x4fb46);}if(_0x4bac6c!==null){logger[_0x69de('0xbb')](_0x69de('0xbc'),_0x4bac6c);_0x4bac6c['isGlobal']=_0x22d3ad;throw _0x4bac6c;}})[_0x69de('0xa1')](function(_0x575e51){logger['error'](_0x69de('0xbd'),_0x575e51);throw msgResponse(_0x69de('0x86'),_0x69de('0xbe'),util['inspect'](_0x575e51,{'showHidden':![],'depth':null}));});};Dialer[_0x69de('0x8b')][_0x69de('0x2b')]=function(_0x566d89){if(this['voiceQueues'][_0x566d89[_0x69de('0xbf')]]){if(this[_0x69de('0xc0')][_0x566d89[_0x69de('0xc1')]]&&this['uniqueId'][_0x566d89[_0x69de('0xc1')]][_0x69de('0x43')]!==_0x69de('0xc2')){this[_0x69de('0xc3')](this[_0x69de('0x20')][_0x566d89[_0x69de('0xbf')]]);this['uniqueId'][_0x566d89[_0x69de('0xc1')]][_0x69de('0xc4')]=moment()[_0x69de('0x7e')](_0x69de('0xc5'));}}};Dialer[_0x69de('0x8b')]['syncAgentComplete']=function(_0x5b6497){var _0x17124d=this[_0x69de('0xc0')][_0x5b6497['uniqueid']];if(this['voiceQueues'][_0x5b6497[_0x69de('0xbf')]]){if(_0x17124d&&_0x17124d[_0x69de('0x43')]!==_0x69de('0xc2')){delete this[_0x69de('0xc0')][_0x5b6497[_0x69de('0xc1')]];this[_0x69de('0x20')][_0x5b6497[_0x69de('0xbf')]][_0x69de('0xc6')]+=0x1;var _0x3c7397=new AgentComplete(_0x17124d,_0x5b6497);if(_0x5b6497[_0x69de('0xc7')]===_0x69de('0xc8')){_0x3c7397[_0x69de('0xc9')]=this['voiceQueues'][_0x5b6497['queue']][_0x69de('0xca')]&&this[_0x69de('0x20')][_0x5b6497[_0x69de('0xbf')]][_0x69de('0xcb')]?moment()[_0x69de('0x7e')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;}hopperUtils['createHistory'](_0x3c7397)[_0x69de('0xa1')](loggerCatch(_0x69de('0xcc')));hopperUtils[_0x69de('0xcd')](_0x3c7397)[_0x69de('0xa1')](loggerCatch(_0x69de('0xce')));}}};Dialer[_0x69de('0x8b')][_0x69de('0xcf')]=function(_0x4a7841){var _0x8693ec=this['uniqueId'][_0x4a7841[_0x69de('0xc1')]];var _0x5c4aa0=this;var _0x48df44=![];var _0x50f693;var _0x37a723;if(this[_0x69de('0x20')][_0x4a7841[_0x69de('0xbf')]]){if(_0x8693ec&&_0x8693ec[_0x69de('0x43')]!==_0x69de('0xc2')){delete this['uniqueId'][_0x4a7841[_0x69de('0xc1')]];this[_0x69de('0xc3')](this['voiceQueues'][_0x4a7841[_0x69de('0xbf')]]);_0x8693ec['droptime']=moment()['format'](_0x69de('0xc5'));var _0x4f5c4f=new QueueCallerAbandon(_0x8693ec,_0x4a7841);if(utils['getSeconds'](_0x8693ec[_0x69de('0xd0')],_0x8693ec[_0x69de('0xd1')])>=_0x8693ec['dialQueueTimeout']){this[_0x69de('0x20')][_0x4a7841[_0x69de('0xbf')]][_0x69de('0x50')]+=0x1;this[_0x69de('0x20')][_0x4a7841['queue']][_0x69de('0xd2')]+=0x1;this[_0x69de('0x20')][_0x4a7841[_0x69de('0xbf')]][_0x69de('0xd3')]+=0x1;_0x4f5c4f[_0x69de('0x73')]=0xa;_0x4f5c4f[_0x69de('0x74')]=_0x69de('0xd4');_0x4f5c4f['dropreason']=_0x69de('0xd5');_0x4f5c4f['agiafterat']=this[_0x69de('0x20')][_0x4a7841['queue']][_0x69de('0xca')]?moment()[_0x69de('0x7e')](_0x69de('0xc5')):undefined;_0x4f5c4f[_0x69de('0xd6')]+=0x1;_0x4f5c4f[_0x69de('0xd7')]+=0x1;_0x50f693=this[_0x69de('0x20')][_0x4a7841[_0x69de('0xbf')]][_0x69de('0xd8')];_0x37a723=this['voiceQueues'][_0x4a7841[_0x69de('0xbf')]][_0x69de('0xd9')];hopperUtils[_0x69de('0xda')](_0x4f5c4f,_0x4f5c4f[_0x69de('0x73')],_0x8693ec['voiceQueue'])[_0x69de('0x3f')](function(_0x135489){_0x48df44=_0x135489[_0x69de('0xdb')]==0x1;if(_0x4f5c4f[_0x69de('0xd6')]>=_0x5c4aa0['voiceQueues'][_0x4a7841[_0x69de('0xbf')]][_0x69de('0xdc')]){_0x5c4aa0[_0x69de('0xdd')](_0x4f5c4f,_0x135489[_0x69de('0xdb')]);}else{hopperUtils['rescheduleContact']({'active':![],'countdropretry':_0x4f5c4f['countdropretry'],'scheduledat':moment()[_0x69de('0xde')](_0x5c4aa0['voiceQueues'][_0x4a7841[_0x69de('0xbf')]][_0x69de('0xd8')],_0x69de('0xdf'))['format'](_0x69de('0xc5')),'ContactId':_0x8693ec[_0x69de('0xe0')],'ListId':_0x8693ec[_0x69de('0xe1')],'VoiceQueueId':_0x8693ec[_0x69de('0xe2')]||undefined,'CampaignId':_0x8693ec[_0x69de('0xe3')]||undefined})[_0x69de('0xa1')](loggerCatch(_0x69de('0xe4')));var _0x4490c0=new History(_0x4f5c4f);_0x4490c0[_0x69de('0x73')]=0xa;_0x4490c0['statedesc']=_0x69de('0xd4');_0x4490c0[_0x69de('0xe5')]=moment()[_0x69de('0x7e')](_0x69de('0xc5'));_0x4490c0[_0x69de('0xe6')]=_0x4490c0[_0x69de('0xe5')];_0x4490c0['calleridname']=_0x4f5c4f[_0x69de('0xe7')];_0x4490c0['calleridnum']=_0x4f5c4f[_0x69de('0xe8')];hopperUtils[_0x69de('0xe9')](_0x4490c0)[_0x69de('0xa1')](loggerCatch(_0x69de('0xea')));}})['then'](function(){if(_0x48df44)hopperUtils[_0x69de('0xeb')](_0x4f5c4f,_0x50f693,_0x37a723)[_0x69de('0x3f')](function(){return 0x1;});});}else{this[_0x69de('0x20')][_0x4a7841[_0x69de('0xbf')]][_0x69de('0x52')]+=0x1;this[_0x69de('0x20')][_0x4a7841['queue']][_0x69de('0xec')]+=0x1;_0x4f5c4f[_0x69de('0x73')]=0xb;_0x4f5c4f['statedesc']='Abandoned';_0x4f5c4f[_0x69de('0xed')]=_0x69de('0xee');_0x4f5c4f['countabandonedretry']+=0x1;_0x4f5c4f[_0x69de('0xd7')]+=0x1;_0x50f693=this['voiceQueues'][_0x4a7841[_0x69de('0xbf')]]['dialAbandonedRetryFrequency'];_0x37a723=this[_0x69de('0x20')][_0x4a7841[_0x69de('0xbf')]][_0x69de('0xd9')];hopperUtils['verifyAdditionalPhones'](_0x4f5c4f,_0x4f5c4f[_0x69de('0x73')],_0x8693ec['voiceQueue'])['then'](function(_0x10caa5){if(_0x4f5c4f[_0x69de('0xef')]>=_0x5c4aa0[_0x69de('0x20')][_0x4a7841[_0x69de('0xbf')]]['dialAbandonedMaxRetry']){_0x5c4aa0[_0x69de('0xdd')](_0x4f5c4f,_0x10caa5[_0x69de('0xdb')]);}else{hopperUtils[_0x69de('0xf0')]({'active':![],'countabandonedretry':_0x4f5c4f[_0x69de('0xef')],'scheduledat':moment()[_0x69de('0xde')](_0x5c4aa0['voiceQueues'][_0x4a7841[_0x69de('0xbf')]][_0x69de('0xf1')],_0x69de('0xdf'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x8693ec['ContactId'],'ListId':_0x8693ec[_0x69de('0xe1')],'VoiceQueueId':_0x8693ec[_0x69de('0xe2')]||undefined,'CampaignId':_0x8693ec[_0x69de('0xe3')]||undefined})[_0x69de('0xa1')](loggerCatch('[rescheduleContact][Abandoned]'));var _0x4a11e3=new History(_0x4f5c4f);_0x4a11e3['state']=0xb;_0x4a11e3[_0x69de('0x74')]=_0x69de('0xf2');_0x4a11e3[_0x69de('0xe5')]=moment()[_0x69de('0x7e')](_0x69de('0xc5'));_0x4a11e3[_0x69de('0xe6')]=_0x4a11e3[_0x69de('0xe5')];_0x4a11e3[_0x69de('0xe7')]=_0x4f5c4f[_0x69de('0xe7')];_0x4a11e3[_0x69de('0xe8')]=_0x4f5c4f[_0x69de('0xe8')];hopperUtils['createHistory'](_0x4a11e3)[_0x69de('0xa1')](loggerCatch('[syncAgentComplete][createHistory][11]'));}})[_0x69de('0x3f')](function(){if(_0x48df44)hopperUtils[_0x69de('0xeb')](_0x4f5c4f,_0x50f693,_0x37a723)[_0x69de('0x3f')](function(){return 0x1;});});}}}};Dialer['prototype'][_0x69de('0x36')]=function(_0x2f11ed){if(this[_0x69de('0xf3')][_0x2f11ed[_0x69de('0xc1')]]){this[_0x69de('0xf3')][_0x2f11ed['uniqueid']][_0x69de('0xf4')]=_0x2f11ed['channel'];}if(this[_0x69de('0xc0')][_0x2f11ed[_0x69de('0xc1')]]){this['uniqueId'][_0x2f11ed[_0x69de('0xc1')]][_0x69de('0xf4')]=_0x2f11ed[_0x69de('0xf4')];}};Dialer['prototype'][_0x69de('0x39')]=function(_0x5cf8e3){if(!this[_0x69de('0xf3')][_0x5cf8e3[_0x69de('0xf5')]]){return;}var _0x58b763=this[_0x69de('0x20')][this[_0x69de('0xf3')][_0x5cf8e3[_0x69de('0xf5')]][_0x69de('0xbf')]]['strategy']||_0x69de('0xf6');if(_0x58b763===_0x69de('0xf7')){if(this[_0x69de('0xf3')][_0x5cf8e3[_0x69de('0xf5')]]&&_['isNil'](this[_0x69de('0xf3')][_0x5cf8e3[_0x69de('0xf5')]]['locked'])&&_0x5cf8e3['status']==='1'&&_0x5cf8e3[_0x69de('0xf8')]==='0'){if(this[_0x69de('0x22')][_0x5cf8e3[_0x69de('0xf9')]]){if(!this[_0x69de('0x22')][_0x5cf8e3[_0x69de('0xf9')]][_0x69de('0xfa')]){this[_0x69de('0x22')][_0x5cf8e3[_0x69de('0xf9')]]['locked']=!![];this['actions'][_0x5cf8e3[_0x69de('0xf5')]][_0x69de('0xfa')]=!![];this[_0x69de('0xf3')][_0x5cf8e3[_0x69de('0xf5')]][_0x69de('0xf9')]=_0x5cf8e3['stateinterface'];}}}}else if(_0x58b763===_0x69de('0xf6')){if(this[_0x69de('0xf3')][_0x5cf8e3[_0x69de('0xf5')]]){if(this[_0x69de('0x22')][_0x5cf8e3[_0x69de('0xf9')]]){this[_0x69de('0xf3')][_0x5cf8e3[_0x69de('0xf5')]][_0x69de('0xf9')]=_0x5cf8e3[_0x69de('0xf9')];if(_['isNil'](this[_0x69de('0x29')][this[_0x69de('0xf3')][_0x5cf8e3[_0x69de('0xf5')]][_0x69de('0xbf')]])){this[_0x69de('0x29')][this[_0x69de('0xf3')][_0x5cf8e3[_0x69de('0xf5')]][_0x69de('0xbf')]]=[];}this['queueBooked'][this[_0x69de('0xf3')][_0x5cf8e3[_0x69de('0xf5')]][_0x69de('0xbf')]][_0x69de('0xa2')](_[_0x69de('0x62')](_[_0x69de('0xfb')](this[_0x69de('0xf3')][_0x5cf8e3[_0x69de('0xf5')]],[_0x69de('0xfc'),_0x69de('0xf9')]),{'status':_0x5cf8e3[_0x69de('0x8a')],'paused':_0x5cf8e3[_0x69de('0xf8')]}));}}}};Dialer[_0x69de('0x8b')][_0x69de('0x3b')]=function(_0xa25c99){if(!this[_0x69de('0xf3')][_0xa25c99[_0x69de('0xf5')]]){return;}var _0x47f01c=this;var _0xe6bf71=this['voiceQueues'][this[_0x69de('0xf3')][_0xa25c99[_0x69de('0xf5')]][_0x69de('0xbf')]];var _0xe6646b=_0xe6bf71[_0x69de('0xfd')]||_0x69de('0xf6');if(_0xe6646b===_0x69de('0xf7')){if(this[_0x69de('0xf3')][_0xa25c99[_0x69de('0xf5')]]&&this['actions'][_0xa25c99[_0x69de('0xf5')]][_0x69de('0xf9')]){this[_0x69de('0x1f')][_0x69de('0xfe')](this[_0x69de('0xf3')][_0xa25c99[_0x69de('0xf5')]][_0x69de('0xfc')],this[_0x69de('0xf3')][_0xa25c99[_0x69de('0xf5')]][_0x69de('0xf9')])[_0x69de('0xa1')](function(_0x2acfa0){logger['error'](_0x69de('0xff'),util[_0x69de('0x45')](_0x2acfa0,{'showHidden':![],'depth':null}));})['finally'](function(){_0x47f01c[_0x69de('0xc3')](_0x47f01c['voiceQueues'][_0x47f01c[_0x69de('0xf3')][_0xa25c99['actionid']][_0x69de('0xbf')]]);_0x47f01c[_0x69de('0x22')][_0x47f01c[_0x69de('0xf3')][_0xa25c99['actionid']][_0x69de('0xf9')]][_0x69de('0xfa')]=![];delete _0x47f01c[_0x69de('0xf3')][_0xa25c99[_0x69de('0xf5')]];unlockQueueStatus(_0xe6bf71);});}else{this[_0x69de('0xc3')](this[_0x69de('0x20')][this['actions'][_0xa25c99['actionid']][_0x69de('0xbf')]]);hopperUtils[_0x69de('0xf0')]({'active':![],'ContactId':this['actions'][_0xa25c99['actionid']][_0x69de('0xe0')],'ListId':this[_0x69de('0xf3')][_0xa25c99['actionid']]['ListId'],'VoiceQueueId':this[_0x69de('0xf3')][_0xa25c99[_0x69de('0xf5')]][_0x69de('0xe2')]||undefined,'CampaignId':this[_0x69de('0xf3')][_0xa25c99[_0x69de('0xf5')]][_0x69de('0xe3')]||undefined})[_0x69de('0xa1')](loggerCatch('[unlock][syncQueueStatusComplete]'));delete this[_0x69de('0xf3')][_0xa25c99[_0x69de('0xf5')]];unlockQueueStatus(_0xe6bf71);}}else if(_0xe6646b===_0x69de('0xf6')){var _0x3b189c;if(this[_0x69de('0xf3')][_0xa25c99[_0x69de('0xf5')]]&&!_[_0x69de('0x49')](this['queueBooked'][this[_0x69de('0xf3')][_0xa25c99[_0x69de('0xf5')]][_0x69de('0xbf')]])){if(this['queueBookedRR'][_0x47f01c['actions'][_0xa25c99[_0x69de('0xf5')]][_0x69de('0xbf')]]){this[_0x69de('0x100')][_0x47f01c[_0x69de('0xf3')][_0xa25c99['actionid']][_0x69de('0xbf')]]=this['queueBookedRR'][this[_0x69de('0xf3')][_0xa25c99[_0x69de('0xf5')]][_0x69de('0xbf')]]?this['queueBookedRR'][this[_0x69de('0xf3')][_0xa25c99[_0x69de('0xf5')]][_0x69de('0xbf')]]:this[_0x69de('0x29')][this[_0x69de('0xf3')][_0xa25c99[_0x69de('0xf5')]][_0x69de('0xbf')]]?this['queueBooked'][this[_0x69de('0xf3')][_0xa25c99[_0x69de('0xf5')]][_0x69de('0xbf')]][_0x69de('0x101')]||0x0:0x0;}this[_0x69de('0x29')][this[_0x69de('0xf3')][_0xa25c99[_0x69de('0xf5')]][_0x69de('0xbf')]][_0x69de('0x101')]=this[_0x69de('0x100')][this[_0x69de('0xf3')][_0xa25c99['actionid']][_0x69de('0xbf')]];for(var _0x430399=0x0;_0x430399=_0x26d60a[_0x69de('0x129')]){_0x514112[_0x69de('0x12a')](_0x6610f6,_0x50c3cc,_0x1f3808,'reason19\x20machine....');}else{if(_0x6610f6[_0x69de('0x127')]>=_0x26d60a['dialMachineMaxRetry']){_0x514112[_0x69de('0x12b')](_0x6610f6,_0x50c3cc,_0x1f3808,'reason\x2019\x20machine....');}else{hopperUtils[_0x69de('0xf0')]({'active':![],'countmachineretry':_0x6610f6[_0x69de('0x127')],'scheduledat':moment()[_0x69de('0xde')](_0x26d60a[_0x69de('0x12c')],_0x69de('0xdf'))[_0x69de('0x7e')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x6610f6['ContactId'],'ListId':_0x6610f6['ListId'],'VoiceQueueId':_0x6610f6[_0x69de('0xe2')]||undefined,'CampaignId':_0x6610f6[_0x69de('0xe3')]||undefined})[_0x69de('0xa1')](loggerCatch(_0x69de('0x12d')));_0x50c3cc({'reschedule':0x1});}}});}if(_0x450ca2[_0x69de('0x43')]==='ivr'&&this[_0x69de('0x21')][_0x450ca2[_0x69de('0xbf')]]['dialAMDActive']&&_0x2a5659[_0x69de('0x117')]===_0x69de('0x118')){delete this['uniqueId'][_0x2a5659[_0x69de('0xc1')]];this['updateOriginated'](this[_0x69de('0x21')][_0x450ca2['queue']]);_0x5b7c28=new Hangup(_0x450ca2,_0x2a5659);_0x5b7c28[_0x69de('0x73')]=0x12;_0x5b7c28[_0x69de('0x74')]=_0x69de('0x11a');_0x5b7c28[_0x69de('0x11b')]=_0x69de('0x11c');ami['emit'](_0x69de('0x122'),ut[_0x69de('0x11d')](_0x5b7c28,'amd'));this['saveInDb'](_0x5b7c28,'[syncHangupInAMDIvr][createHistory]',_0x69de('0x12e'));}if(_0x450ca2[_0x69de('0x43')]===_0x69de('0xc2')&&this[_0x69de('0x21')][_0x450ca2['queue']][_0x69de('0x116')]&&_0x2a5659[_0x69de('0x117')]===_0x69de('0x120')){return new Promise(function(_0xb2c378,_0x387800){delete _0x514112[_0x69de('0xc0')][_0x2a5659[_0x69de('0xc1')]];_0x514112['updateOriginated'](_0x514112[_0x69de('0x21')][_0x450ca2[_0x69de('0xbf')]]);_0x514112[_0x69de('0x21')][_0x450ca2[_0x69de('0xbf')]]['outboundAnswerCallsDay']+=0x1;_0x514112[_0x69de('0x21')][_0x450ca2[_0x69de('0xbf')]][_0x69de('0x119')]+=0x1;var _0x2da017=_0x514112[_0x69de('0x21')][_0x450ca2[_0x69de('0xbf')]];var _0x2c9047=new Hangup(_0x450ca2,_0x2a5659);_0x2c9047[_0x69de('0x73')]=0x13;_0x2c9047['statedesc']=_0x69de('0x121');_0x2c9047[_0x69de('0x11b')]=_0x69de('0x11c');_0x2c9047[_0x69de('0x127')]+=0x1;_0x2c9047['countglobal']+=0x1;_0x2c9047[_0x69de('0x11e')]=!![];ami['emit'](_0x69de('0x122'),ut[_0x69de('0x11d')](_0x2c9047,'amd'));hopperUtils['createHistory'](_0x2c9047)[_0x69de('0xa1')](loggerCatch(_0x69de('0x123')));if(_0x2c9047[_0x69de('0x124')]+_0x2c9047['countcongestionretry']+_0x2c9047[_0x69de('0x125')]+_0x2c9047['countnosuchnumberretry']+_0x2c9047['countdropretry']+_0x2c9047[_0x69de('0xef')]+_0x2c9047[_0x69de('0x127')]+_0x2c9047[_0x69de('0x128')]>=_0x2da017['dialGlobalMaxRetry']){_0x514112[_0x69de('0x12a')](_0x2c9047,_0xb2c378,_0x387800,_0x69de('0x12f'));}else{if(_0x2c9047[_0x69de('0x127')]>=_0x2da017[_0x69de('0x130')]){_0x514112[_0x69de('0x12b')](_0x2c9047,_0xb2c378,_0x387800,_0x69de('0x131'));}else{hopperUtils[_0x69de('0xf0')]({'active':![],'countmachineretry':_0x2c9047[_0x69de('0x127')],'scheduledat':moment()['add'](_0x2da017[_0x69de('0x12c')],_0x69de('0xdf'))[_0x69de('0x7e')](_0x69de('0xc5')),'ContactId':_0x2c9047[_0x69de('0xe0')],'ListId':_0x2c9047['ListId'],'VoiceQueueId':_0x2c9047['VoiceQueueId']||undefined,'CampaignId':_0x2c9047[_0x69de('0xe3')]||undefined})[_0x69de('0xa1')](loggerCatch(_0x69de('0x12d')));_0xb2c378({'reschedule':0x1});}}});}}};Dialer[_0x69de('0x8b')]['syncHangup']=function(_0x12335d){var _0xf1c149=this[_0x69de('0xc0')][_0x12335d[_0x69de('0xc1')]];var _0x362344;if(_0xf1c149&&_0xf1c149[_0x69de('0x43')]===_0x69de('0xc2')){delete this[_0x69de('0xc0')][_0x12335d[_0x69de('0xc1')]];this[_0x69de('0xc3')](this[_0x69de('0x21')][_0xf1c149[_0x69de('0xbf')]]);this[_0x69de('0x21')][_0xf1c149[_0x69de('0xbf')]]['ivrAnswerCallsDay']+=0x1;_0x362344=new Hangup(_0xf1c149,_0x12335d);hopperUtils[_0x69de('0xe9')](_0x362344)['catch'](loggerCatch('[syncHangupIvr][createHistory]'));hopperUtils[_0x69de('0xcd')](_0x362344)[_0x69de('0xa1')](loggerCatch(_0x69de('0x132')));}if(_0xf1c149&&_0xf1c149[_0x69de('0x43')]!==_0x69de('0xc2')&&isNotNull(this['voiceQueues'][_0xf1c149[_0x69de('0xbf')]][_0x69de('0x133')])){delete this[_0x69de('0xc0')][_0x12335d['uniqueid']];this['updateOriginated'](this['voiceQueues'][_0xf1c149[_0x69de('0xbf')]]);this[_0x69de('0x20')][_0xf1c149[_0x69de('0xbf')]][_0x69de('0xc6')]+=0x1;this[_0x69de('0x20')][_0xf1c149[_0x69de('0xbf')]][_0x69de('0x119')]+=0x1;_0x362344=new Hangup(_0xf1c149,_0x12335d);_0x362344['state']=0x10;_0x362344[_0x69de('0x74')]=_0x69de('0x134');_0x362344[_0x69de('0x11b')]=_0x69de('0x135');hopperUtils[_0x69de('0xe9')](_0x362344)[_0x69de('0xa1')](loggerCatch(_0x69de('0x136')));hopperUtils['moveContactManagedDialer'](_0x362344)[_0x69de('0xa1')](loggerCatch('[syncHangupIvr]'));}if(_0xf1c149&&_0xf1c149[_0x69de('0x43')]!==_0x69de('0xc2')&&!isNotNull(this[_0x69de('0x20')][_0xf1c149[_0x69de('0xbf')]][_0x69de('0x133')])){if(_0x12335d[_0x69de('0x137')]===_0x69de('0x138')){delete this[_0x69de('0xc0')][_0x12335d['uniqueid']];this[_0x69de('0x20')][_0xf1c149[_0x69de('0xbf')]]['outboundAnswerCallsDay']+=0x1;const _0x3ba5fd=new AgentComplete(_0xf1c149,_0x12335d);_0x3ba5fd[_0x69de('0xe3')]=this['voiceQueues'][_0xf1c149[_0x69de('0xbf')]]['id'];hopperUtils['createHistory'](_0x3ba5fd)[_0x69de('0xa1')](loggerCatch(_0x69de('0xcc')));hopperUtils[_0x69de('0xcd')](_0x3ba5fd)[_0x69de('0xa1')](loggerCatch(_0x69de('0xce')));}else{delete this[_0x69de('0xc0')][_0x12335d[_0x69de('0xc1')]];this[_0x69de('0xc3')](this[_0x69de('0x20')][_0xf1c149[_0x69de('0xbf')]]);this[_0x69de('0x20')][_0xf1c149[_0x69de('0xbf')]][_0x69de('0x139')]+=0x1;_0x362344=new Hangup(_0xf1c149,_0x12335d);_0x362344[_0x69de('0x73')]=0xc;_0x362344[_0x69de('0x74')]=_0x12335d[_0x69de('0x137')];_0x362344['membername']='Unknow';hopperUtils['createHistory'](_0x362344)['catch'](loggerCatch(_0x69de('0x136')));hopperUtils['moveContactManagedDialer'](_0x362344)[_0x69de('0xa1')](loggerCatch(_0x69de('0x132')));}}};Dialer[_0x69de('0x8b')]['syncQueueSummary']=function(_0x3cd28b){var _0x1b614d=this;if(!_0x1b614d[_0x69de('0x2a')][_0x3cd28b['name']]){_0x1b614d['queuesSummary'][_0x3cd28b[_0x69de('0x47')]]={'running':![]};}else if(_0x1b614d['queuesSummary'][_0x3cd28b[_0x69de('0x47')]][_0x69de('0x13a')]===!![]){return;}else if(_0x1b614d[_0x69de('0x2a')][_0x3cd28b['name']][_0x69de('0x13a')]===![]){_0x1b614d[_0x69de('0x2a')][_0x3cd28b[_0x69de('0x47')]]['running']=!![];}var _0x434df7=_0x1b614d[_0x69de('0x20')][_0x3cd28b['name']];var _0x58cdd3=_0x434df7[_0x69de('0x6d')]!==utils[_0x69de('0x6e')][_0x69de('0x7d')];var _0x62c8ac=utils[_0x69de('0x13b')](_0x434df7);_0x434df7[_0x69de('0x13c')]=utils[_0x69de('0x13d')](_0x434df7,_0x1b614d[_0x69de('0x23')]);Promise[_0x69de('0xad')]()[_0x69de('0x3f')](function(){if(_0x434df7[_0x69de('0x13c')]===utils[_0x69de('0x6e')]['INACTIVE']){if(_0x58cdd3){clearPredictiveAttributes(_0x434df7);_0x3cd28b['startPredictive']=undefined;_0x3cd28b['startProgressive']=undefined;}if(_0x434df7['statusMessage']===utils['CAMPAIGN_STATUS'][_0x69de('0x7d')]){_0x3cd28b[_0x69de('0x13e')]=0x0;_0x3cd28b['paused']=0x0;_0x3cd28b[_0x69de('0x13f')]=0x0;_0x3cd28b['talking']=0x0;_0x3cd28b[_0x69de('0x140')]=0x0;}}else if(_0x434df7[_0x69de('0x13c')]===utils[_0x69de('0x6e')][_0x69de('0x141')]&&!_0x62c8ac){return _0x1b614d['ifTime'](_0x434df7,!![])[_0x69de('0x3f')](function(){return _0x1b614d[_0x69de('0x93')](_0x434df7,![]);})[_0x69de('0x3f')](function(){return _0x1b614d['checkDialMethod'](_0x434df7);})[_0x69de('0xa1')](function(_0x5e7e3e){loggerSyncQueueSummary[_0x69de('0x64')]('[syncQueueSummary]',util[_0x69de('0x45')](_0x5e7e3e,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x434df7);});}else{clearPredictiveAttributes(_0x434df7);}})['then'](function(){var _0x53aaea=_0x3cd28b[_0x69de('0x142')](_0x434df7);if(_0x53aaea||_0x434df7['queueSummaryCountersUpdated']){_0x434df7[_0x69de('0x143')]=![];_0x3cd28b[_0x69de('0x144')](_0x434df7);Object[_0x69de('0x145')](_0x434df7,_0x3cd28b);emitOutboundVoiceQueueSummary(_0x3cd28b);}_0x1b614d[_0x69de('0x2a')][_0x434df7[_0x69de('0x47')]][_0x69de('0x13a')]=![];})['catch'](function(_0x2b0fe3){logger[_0x69de('0x69')](_0x69de('0x146'),util['inspect'](_0x2b0fe3,{'showHidden':![],'depth':null}));_0x1b614d[_0x69de('0x2a')][_0x434df7['name']][_0x69de('0x13a')]=![];});};Dialer[_0x69de('0x8b')][_0x69de('0x33')]=_['throttle'](function(){var _0x29dead=_[_0x69de('0x147')](this[_0x69de('0x20')],function(_0x3fbb55){return _0x3fbb55['dialPreviewRecallmeReminder'];});var _0xfa2d03=_['filter'](this['agents'],function(_0x19fa73){return _0x19fa73[_0x69de('0x148')]&&_0x19fa73[_0x69de('0x8a')]==='reachable';});if(_0x29dead['length']>0x0&&_0xfa2d03['length']>0x0){return Promise[_0x69de('0xad')]()[_0x69de('0x3f')](cmHopper[_0x69de('0x149')](_[_0x69de('0x14a')](_0x29dead,'id'),previewRecallmeReminderInterval,_[_0x69de('0x14a')](_0xfa2d03,'id')))['then'](function(_0x2f2d04){for(var _0x99e4e3=0x0;_0x99e4e3<_0x2f2d04['length'];_0x99e4e3++){var _0x4fd396=_0x2f2d04[_0x99e4e3][_0x69de('0x14b')]['name'];if(_0x4fd396)io['to'](util['format'](_0x69de('0x14c'),_0x4fd396))[_0x69de('0x42')](_0x69de('0x14d'),{'hopper':_0x2f2d04[_0x99e4e3]});}})[_0x69de('0xa1')](function(_0x3519e1){logger[_0x69de('0x69')](_0x69de('0x14e'),_0x3519e1);});}},0x3c*0x3e8,{'leading':!![]});Dialer['prototype']['loopClearZombieChannels']=function(){var _0x3568ae=this;setInterval(function(){_0x3568ae[_0x69de('0x14f')](_0x3568ae[_0x69de('0xc0')],_0x69de('0x150'));_0x3568ae[_0x69de('0x14f')](_0x3568ae[_0x69de('0xf3')],_0x69de('0x151'));},0x32c8);};Dialer[_0x69de('0x8b')]['clearZombieChannels']=function(_0x57dd0a,_0x2cbe44){var _0x51c7e6=this;for(var _0x2b068e in _0x57dd0a){if(typeof _0x57dd0a[_0x2b068e]!=='undefined'){this[_0x69de('0x1e')][_0x69de('0x1b')](function(){if(!_[_0x69de('0x102')](_0x57dd0a[_0x2b068e])){return ami[_0x69de('0x152')]({'action':_0x69de('0x8a'),'channel':_0x57dd0a[_0x2b068e][_0x69de('0xf4')]})[_0x69de('0xa1')](function(_0x127abc){if(_0x127abc[_0x69de('0x6d')]===_0x69de('0x153')){setTimeout(function(){if(_0x57dd0a[_0x2b068e]&&_0x57dd0a[_0x2b068e][_0x69de('0x43')]!=='ivr'){_0x51c7e6[_0x69de('0xc3')](_0x51c7e6[_0x69de('0x20')][_0x57dd0a[_0x2b068e][_0x69de('0xbf')]]);logger[_0x69de('0x69')](_0x69de('0x154'),_0x2cbe44,_0x2b068e,_0x57dd0a[_0x2b068e][_0x69de('0xbf')]);delete _0x57dd0a[_0x2b068e];}if(_0x57dd0a[_0x2b068e]&&_0x57dd0a[_0x2b068e][_0x69de('0x43')]===_0x69de('0xc2')){_0x51c7e6[_0x69de('0xc3')](_0x51c7e6[_0x69de('0x21')][_0x57dd0a[_0x2b068e][_0x69de('0xbf')]]);logger[_0x69de('0x69')](_0x69de('0x155'),_0x2cbe44,_0x2b068e,_0x57dd0a[_0x2b068e][_0x69de('0xbf')]);delete _0x57dd0a[_0x2b068e];}},0x2328);}});}});}}};Dialer[_0x69de('0x8b')][_0x69de('0x156')]=function(_0x1b0a70){return Promise[_0x69de('0xad')]()[_0x69de('0x3f')](voiceQueueRt[_0x69de('0x156')](_0x1b0a70))[_0x69de('0xa1')](loggerCatch(_0x69de('0x157')));};Dialer[_0x69de('0x8b')][_0x69de('0xc3')]=function(_0x4d9e88){if(!_['isUndefined'](_0x4d9e88)&&_0x4d9e88!==null){if(typeof _0x4d9e88[_0x69de('0x82')]!==_0x69de('0xab')){if(_0x4d9e88['originated']>0x0){_0x4d9e88[_0x69de('0x82')]-=0x1;}else{logger['error']('[updateOriginated]\x20object\x20originated\x20is\x20negative');}}}else{logger[_0x69de('0x69')](_0x69de('0x158'));}};Dialer[_0x69de('0x8b')][_0x69de('0x159')]=function(_0x1a628a,_0x47b0aa){var _0x4af061=this;return function(_0x1a5c6e){_0x4af061['updateOriginated'](_0x47b0aa);logger[_0x69de('0x69')](_0x1a628a,util[_0x69de('0x45')](_0x1a5c6e,{'showHidden':![],'depth':null}));};};Dialer[_0x69de('0x8b')]['emptyContact']=function(_0x1d43ba,_0x40f86c,_0x1dfdd4){var _0xa728c={'state':0x19,'statedesc':_0x69de('0x15a')};this[_0x69de('0xc3')](_0x40f86c);this[_0x69de('0x15b')](_[_0x69de('0x62')](_0xa728c,_[_0x69de('0xfb')](_0x1dfdd4,[_0x69de('0xe0'),_0x69de('0xe1'),_0x69de('0x15c'),_0x69de('0xe2'),'CampaignId'])),_0x69de('0x15d'),_0x69de('0x15e'));logger['error'](_0x1d43ba);};Dialer[_0x69de('0x8b')][_0x69de('0x15b')]=function(_0x3f0205,_0x481444,_0x6574ca){hopperUtils['createHistory'](_0x3f0205)['catch'](loggerCatch(_0x481444));hopperUtils[_0x69de('0xcd')](_0x3f0205)['catch'](loggerCatch(_0x6574ca));};Dialer[_0x69de('0x8b')][_0x69de('0xdd')]=function(_0x388331,_0x5cc122){hopperUtils[_0x69de('0xe9')](_0x388331)[_0x69de('0xa1')](loggerCatch('[syncAgentComplete][createHistory]'));if(_0x5cc122==0x0){hopperUtils[_0x69de('0xcd')](_0x388331)[_0x69de('0xa1')](loggerCatch(_0x69de('0x15f')));}};Dialer[_0x69de('0x8b')][_0x69de('0x14e')]=function(_0xcaccf6){return Promise[_0x69de('0xad')]()[_0x69de('0x3f')](cmHopper['handlePreviewRecallNotifications'](_0xcaccf6['id'],previewRecallmeReminderInterval))[_0x69de('0x3f')](function(_0x37cb12){for(var _0x4e401a=0x0;_0x4e401a<_0x37cb12[_0x69de('0x9a')];_0x4e401a++){var _0x1316b6=_0x37cb12[_0x4e401a][_0x69de('0x14b')][_0x69de('0x47')];if(_0x1316b6)io['to'](util[_0x69de('0x7e')]('user:%s',_0x1316b6))[_0x69de('0x42')](_0x69de('0x14d'),{'hopper':_0x37cb12[_0x4e401a]});}})[_0x69de('0xa1')](function(){});};Dialer['prototype']['launchHandleIvr']=function(_0x48d4c9){var _0x4045b9=this;return function(){_0x4045b9['handleIvr'](_0x48d4c9);};};Dialer[_0x69de('0x8b')][_0x69de('0x160')]=function(_0x2863ea,_0x39504d){var _0xd31b61=this;var _0xc45c53=uuid['v4']();this['actions'][_0xc45c53]=new Action(_0x2863ea,_0x39504d,_0xc45c53);return new Promise(function(_0x1409a8,_0x152fcc){if(_[_0x69de('0x41')](_0x2863ea)&&typeof _0x2863ea!==_0x69de('0x161')){return _0x152fcc(msgResponse(_0x69de('0x162'),'Failure',_0x69de('0x163')));}if(_[_0x69de('0x41')](_0x39504d['phone'])||_0x39504d[_0x69de('0x164')]===null){return _0x152fcc(msgResponse(_0x69de('0x162'),_0x69de('0x94'),_0x69de('0x165')));}var _0x5eb6fe={'XMD-CALLERID':_0xd31b61[_0x69de('0xf3')][_0xc45c53][_0x69de('0x166')](),'XMD-AGI':_0x2863ea[_0x69de('0x133')]?util[_0x69de('0x7e')](_0x69de('0x167'),ipAgi,_0x2863ea[_0x69de('0x133')]):'NONE','XMD-AGIAFTER':_0x2863ea[_0x69de('0xca')]?util[_0x69de('0x7e')](_0x69de('0x167'),ipAgi,_0x2863ea['dialQueueProject2']):_0x69de('0x168'),'XMD-QUEUE':utils['isOutboundQueue'](_0x2863ea)?util[_0x69de('0x7e')](_0x69de('0x169'),_0x2863ea['name'],_0x2863ea[_0x69de('0x16a')]||'',_0x2863ea[_0x69de('0xcb')]?'c':'',_0x2863ea[_0x69de('0x16b')]||0x3):_0x69de('0x168'),'XMD-CONTACTID':_0x39504d[_0x69de('0xe0')],'XMD-CDRTYPE':_0x69de('0x7'),'CALLERID(all)':_0xd31b61[_0x69de('0xf3')][_0xc45c53][_0x69de('0x166')](),'XMD-AMD':_0x2863ea[_0x69de('0x116')]?_0x69de('0x141'):_0x69de('0x168'),'XMD-DESTINATION':'xcally-motion-dialer'};if(_0x2863ea['dialAMDActive']){_0x5eb6fe[_0x69de('0x16c')]=_0x2863ea[_0x69de('0x16d')]||0x9c4;_0x5eb6fe[_0x69de('0x16e')]=_0x2863ea[_0x69de('0x16f')]||0x5dc;_0x5eb6fe['XMD-AMDAFTERGREETINGSILENCE']=_0x2863ea[_0x69de('0x170')]||0x320;_0x5eb6fe[_0x69de('0x171')]=_0x2863ea[_0x69de('0x172')]||0x1388;_0x5eb6fe[_0x69de('0x173')]=_0x2863ea['dialAMDMinWordLength']||0x64;_0x5eb6fe[_0x69de('0x174')]=_0x2863ea[_0x69de('0x175')]||0x32;_0x5eb6fe['XMD-AMDMAXIMUMNUMBEROFWORDS']=_0x2863ea[_0x69de('0x176')]||0x3;_0x5eb6fe[_0x69de('0x177')]=_0x2863ea[_0x69de('0x178')]||0x100;_0x5eb6fe[_0x69de('0x179')]=_0x2863ea[_0x69de('0x17a')]||0x1388;}if(utils[_0x69de('0x17b')](_0x2863ea)){_0x5eb6fe[_0x69de('0x17c')]=_0x39504d[_0x69de('0xe2')];}else{_0x5eb6fe['XMD-CAMPAIGNID']=_0x39504d[_0x69de('0xe3')];}var _0x2fd52f=utils[_0x69de('0x17d')](_0x39504d['Contact']);Object[_0x69de('0x145')](_0x5eb6fe,_0x2fd52f);var _0x116872=_0xd31b61['isTrunkReachable'](_0x2863ea[_0x69de('0x8d')])?utils[_0x69de('0x17e')](_0x2863ea[_0x69de('0x8d')][_0x69de('0x17f')],_0x2863ea[_0x69de('0x180')],_0x2863ea['dialRandomLastDigitCallerIdNumber']>0x0?utils[_0x69de('0x181')](_0x2863ea[_0x69de('0x182')],_0x2863ea[_0x69de('0x183')]):_0x2863ea['dialOriginateCallerIdNumber']):utils[_0x69de('0x17e')](_[_0x69de('0x102')](_0x2863ea[_0x69de('0x184')])?_0x2863ea[_0x69de('0x8d')][_0x69de('0x17f')]:_0x2863ea[_0x69de('0x184')][_0x69de('0x17f')],_0x2863ea[_0x69de('0x180')],_0x2863ea[_0x69de('0x183')]>0x0?utils[_0x69de('0x181')](_0x2863ea[_0x69de('0x182')],_0x2863ea[_0x69de('0x183')]):_0x2863ea['dialOriginateCallerIdNumber']);if(_0x116872){_0x5eb6fe[_0x69de('0x185')]=_0xd31b61[_0x69de('0xf3')][_0xc45c53][_0x69de('0x186')]=utils[_0x69de('0x187')](_0x116872);_0x5eb6fe[_0x69de('0x188')]=_0x39504d[_0x69de('0x164')];}_0x2863ea['variables']=_0x5eb6fe;return ami[_0x69de('0x152')]({'actionid':_0xc45c53,'action':'originate','channel':_0xd31b61['isTrunkReachable'](_0x2863ea[_0x69de('0x8d')])?util['format'](_0x69de('0x189'),_0x2863ea[_0x69de('0x8d')][_0x69de('0x47')],isNotNull(_0x2863ea[_0x69de('0x18a')])?_0x2863ea[_0x69de('0x18a')][_0x69de('0x18b')]()||'':'',_0x2863ea['dialCutDigit']>0x0?_0x39504d['phone']['substring'](_0x2863ea[_0x69de('0x18c')]):_0x39504d[_0x69de('0x164')]):util[_0x69de('0x7e')](_0x69de('0x189'),_[_0x69de('0x102')](_0x2863ea[_0x69de('0x184')])?_0x2863ea[_0x69de('0x8d')][_0x69de('0x47')]:_0x2863ea[_0x69de('0x184')][_0x69de('0x47')],isNotNull(_0x2863ea[_0x69de('0x18a')])?_0x2863ea[_0x69de('0x18a')][_0x69de('0x18b')]()||'':'',_0x2863ea[_0x69de('0x18c')]>0x0?_0x39504d[_0x69de('0x164')][_0x69de('0x18d')](_0x2863ea[_0x69de('0x18c')]):_0x39504d[_0x69de('0x164')]),'callerid':_0x116872,'Exten':'xcally-motion-dialer','Context':'from-sip','Priority':'1','variable':_0x5eb6fe,'timeout':(_0x2863ea[_0x69de('0x18e')]||0x1e)*0x3e8,'async':!![],'channelid':_0xc45c53})[_0x69de('0x3f')](function(_0x15ef27){return _0x1409a8(_0x15ef27);})[_0x69de('0xa1')](function(_0x3ce7e1){_0x2863ea[_0x69de('0x18f')]+=0x1;var _0x37b705=new History(_0xd31b61[_0x69de('0xf3')][_0xc45c53]);logger[_0x69de('0x69')](util[_0x69de('0x7e')](_0x69de('0x190'),JSON['stringify'](_0x3ce7e1)));_0x37b705[_0x69de('0x73')]=0xe;_0x37b705[_0x69de('0x74')]=_0x69de('0x191');_0x37b705['starttime']=moment()[_0x69de('0x7e')](_0x69de('0xc5'));_0x37b705[_0x69de('0xe6')]=_0x37b705[_0x69de('0xe5')];hopperUtils['createHistory'](_0x37b705)[_0x69de('0xa1')](loggerCatch(_0x69de('0x192')));_0xd31b61[_0x69de('0xcd')](_0x37b705)[_0x69de('0xa1')](loggerCatch('[originate][error]'))['finally'](function(){delete _0xd31b61[_0x69de('0xf3')][_0xc45c53];return _0x152fcc(msgResponse(_0x69de('0x162'),_0x69de('0xbe'),_0x69de('0x193')));});});});};Dialer[_0x69de('0x8b')]['checkRetriveMax']=function(_0x471b52,_0xe350c3,_0x3d388f){var _0x53dfa5=new History(_0xe350c3);if(_0x53dfa5[_0x69de('0x124')]+_0x53dfa5[_0x69de('0x194')]+_0x53dfa5[_0x69de('0x125')]+_0x53dfa5[_0x69de('0x126')]+_0x53dfa5['countdropretry']+_0x53dfa5[_0x69de('0xef')]+_0x53dfa5[_0x69de('0x127')]+_0x53dfa5[_0x69de('0x128')]>=_0x3d388f[_0x69de('0x129')]-0x1){return!![];}switch(_0x471b52){case 0x3:if(_0x53dfa5[_0x69de('0x125')]>=_0x3d388f[_0x69de('0x195')]-0x1){return!![];}hopperUtils[_0x69de('0xf0')]({'active':![],'countnoanswerretry':_0x53dfa5[_0x69de('0x125')]+=0x1,'scheduledat':moment()[_0x69de('0xde')](_0x3d388f[_0x69de('0x196')],_0x69de('0xdf'))[_0x69de('0x7e')](_0x69de('0xc5')),'ContactId':_0x53dfa5[_0x69de('0xe0')],'ListId':_0x53dfa5[_0x69de('0xe1')],'VoiceQueueId':_0x53dfa5[_0x69de('0xe2')]||undefined,'CampaignId':_0x53dfa5[_0x69de('0xe3')]||undefined})[_0x69de('0xa1')](loggerCatch('[rescheduleContact][NoAnswer]'));break;case 0x5:if(_0x53dfa5[_0x69de('0x124')]>=_0x3d388f[_0x69de('0x197')]-0x1){return!![];}hopperUtils[_0x69de('0xf0')]({'active':![],'countbusyretry':_0x53dfa5[_0x69de('0x124')]+=0x1,'scheduledat':moment()['add'](_0x3d388f[_0x69de('0x198')],'minutes')[_0x69de('0x7e')](_0x69de('0xc5')),'ContactId':_0x53dfa5[_0x69de('0xe0')],'ListId':_0x53dfa5['ListId'],'VoiceQueueId':_0x53dfa5[_0x69de('0xe2')]||undefined,'CampaignId':_0x53dfa5['CampaignId']||undefined})[_0x69de('0xa1')](loggerCatch(_0x69de('0x199')));break;case 0x8:if(_0x53dfa5[_0x69de('0x194')]>=_0x3d388f[_0x69de('0x19a')]-0x1){return!![];}hopperUtils[_0x69de('0xf0')]({'active':![],'countcongestionretry':_0x53dfa5[_0x69de('0x194')]+=0x1,'scheduledat':moment()[_0x69de('0xde')](_0x3d388f[_0x69de('0x19b')],_0x69de('0xdf'))['format'](_0x69de('0xc5')),'ContactId':_0x53dfa5[_0x69de('0xe0')],'ListId':_0x53dfa5[_0x69de('0xe1')],'VoiceQueueId':_0x53dfa5['VoiceQueueId']||undefined,'CampaignId':_0x53dfa5[_0x69de('0xe3')]||undefined})[_0x69de('0xa1')](loggerCatch(_0x69de('0x19c')));break;case 0x0:if(_0x53dfa5[_0x69de('0x126')]>=_0x3d388f[_0x69de('0x19d')]-0x1){return!![];}else{hopperUtils[_0x69de('0xf0')]({'active':![],'countnosuchnumberretry':_0x53dfa5[_0x69de('0x126')]+=0x1,'scheduledat':moment()[_0x69de('0xde')](_0x3d388f['dialNoSuchNumberRetryFrequency'],'minutes')[_0x69de('0x7e')](_0x69de('0xc5')),'ContactId':_0x53dfa5[_0x69de('0xe0')],'ListId':_0x53dfa5[_0x69de('0xe1')],'VoiceQueueId':_0x53dfa5[_0x69de('0xe2')]||undefined,'CampaignId':_0x53dfa5[_0x69de('0xe3')]||undefined})['catch'](loggerCatch(_0x69de('0x19e')));}break;case 0xa:if(_0x53dfa5[_0x69de('0xd6')]>=_0x3d388f[_0x69de('0xdc')]-0x1){return!![];}hopperUtils[_0x69de('0xf0')]({'active':![],'countdropretry':_0x53dfa5[_0x69de('0xd6')]+=0x1,'scheduledat':moment()[_0x69de('0xde')](_0x3d388f[_0x69de('0xd8')],_0x69de('0xdf'))[_0x69de('0x7e')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x53dfa5[_0x69de('0xe0')],'ListId':_0x53dfa5[_0x69de('0xe1')],'VoiceQueueId':_0x53dfa5[_0x69de('0xe2')]||undefined,'CampaignId':_0x53dfa5[_0x69de('0xe3')]||undefined})[_0x69de('0xa1')](loggerCatch('[rescheduleContact][Drop]'));break;case 0xb:if(_0x53dfa5['countabandonedretry']>=_0x3d388f[_0x69de('0x19f')]-0x1){return!![];}hopperUtils[_0x69de('0xf0')]({'active':![],'countabandonedretry':_0x53dfa5[_0x69de('0xef')]+=0x1,'scheduledat':moment()[_0x69de('0xde')](_0x3d388f[_0x69de('0xf1')],_0x69de('0xdf'))['format'](_0x69de('0xc5')),'ContactId':_0x53dfa5['ContactId'],'ListId':_0x53dfa5[_0x69de('0xe1')],'VoiceQueueId':_0x53dfa5[_0x69de('0xe2')]||undefined,'CampaignId':_0x53dfa5[_0x69de('0xe3')]||undefined})[_0x69de('0xa1')](loggerCatch(_0x69de('0x1a0')));break;case 0x13:if(_0x53dfa5[_0x69de('0x127')]>=_0x3d388f[_0x69de('0x130')]-0x1){return!![];}hopperUtils[_0x69de('0xf0')]({'active':![],'countmachineretry':_0x53dfa5[_0x69de('0x127')]+=0x1,'scheduledat':moment()['add'](_0x3d388f[_0x69de('0x12c')],_0x69de('0xdf'))[_0x69de('0x7e')](_0x69de('0xc5')),'ContactId':_0x53dfa5[_0x69de('0xe0')],'ListId':_0x53dfa5[_0x69de('0xe1')],'VoiceQueueId':_0x53dfa5[_0x69de('0xe2')]||undefined,'CampaignId':_0x53dfa5[_0x69de('0xe3')]||undefined})[_0x69de('0xa1')](loggerCatch(_0x69de('0x12d')));break;case 0x14:if(_0x53dfa5[_0x69de('0x128')]>=_0x3d388f[_0x69de('0x1a1')]-0x1){return!![];}hopperUtils[_0x69de('0xf0')]({'active':![],'countagentrejectretry':_0x53dfa5['countagentrejectretry']+=0x1,'scheduledat':moment()[_0x69de('0xde')](_0x3d388f[_0x69de('0x1a2')],_0x69de('0xdf'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x53dfa5[_0x69de('0xe0')],'ListId':_0x53dfa5[_0x69de('0xe1')],'VoiceQueueId':_0x53dfa5['VoiceQueueId']||undefined,'CampaignId':_0x53dfa5['CampaignId']||undefined})[_0x69de('0xa1')](loggerCatch(_0x69de('0x1a3')));break;default:return!![];}};Dialer[_0x69de('0x8b')]['callProgressDetecting']=function(_0x10d586,_0x4503e9,_0x571e57){var _0x2eeebe=this;var _0x337818=new History(_0x10d586);var _0x2ddf64=![];var _0xd12fc9;var _0x41abf1;return new Promise(function(_0x108b2e,_0x244e6b){if(_[_0x69de('0x41')](_0x4503e9)&&typeof _0x4503e9!==_0x69de('0x161')){return _0x244e6b(msgResponse(_0x69de('0x1a4'),'Failure','entity\x20is\x20undefine'));}if(_[_0x69de('0x41')](_0x571e57)&&typeof _0x571e57!==_0x69de('0x161')){return _0x244e6b(msgResponse(_0x69de('0x1a4'),_0x69de('0x94'),_0x69de('0x1a5')));}hopperUtils['verifyAdditionalPhones'](_0x337818,_0x571e57['reason'],_0x4503e9)[_0x69de('0x3f')](function(_0x5055b9){if(_0x5055b9[_0x69de('0xdb')]==0x1)_0x2ddf64=!![];switch(_0x571e57[_0x69de('0xc7')]){case'0':_0x4503e9[_0x69de('0x1a6')]+=0x1;_0x337818[_0x69de('0x73')]=0x0;_0x337818[_0x69de('0x74')]=_0x69de('0x1a7');_0x337818[_0x69de('0x126')]+=0x1;_0x337818[_0x69de('0xd7')]+=0x1;ami[_0x69de('0x42')](_0x69de('0x1a8'),ut[_0x69de('0x11d')](_0x10d586,_0x69de('0x1a9')));_0xd12fc9=_0x4503e9[_0x69de('0x1aa')];_0x41abf1=_0x4503e9[_0x69de('0xd9')];hopperUtils[_0x69de('0xe9')](_0x337818)['catch'](loggerCatch(_0x69de('0x123')));if(_0x2eeebe[_0x69de('0x1ab')](0x0,_0x10d586,_0x4503e9)&&!_0x2ddf64){if(_0x337818['countnosuchnumberretry']>=_0x4503e9[_0x69de('0x19d')]){_0x2eeebe[_0x69de('0x12b')](_0x337818,_0x108b2e,_0x244e6b,_0x69de('0x1ac'));}else{_0x2eeebe['stateGlobal'](_0x337818,_0x108b2e,_0x244e6b,_0x69de('0x1ac'));}}break;case'3':_0x4503e9['outboundNoAnswerCallsDay']+=0x1;_0x337818[_0x69de('0x73')]=0x3;_0x337818[_0x69de('0x74')]='NoAnswer';_0x337818[_0x69de('0x125')]+=0x1;_0x337818['countglobal']+=0x1;var _0x5a1a64=ut[_0x69de('0x1ad')](_0x10d586,_0x4503e9);ami[_0x69de('0x42')]('custom:agentnoanswer',_0x5a1a64);_0xd12fc9=_0x4503e9[_0x69de('0x196')];_0x41abf1=_0x4503e9[_0x69de('0xd9')];hopperUtils['createHistory'](_0x337818)[_0x69de('0xa1')](loggerCatch('[syncAgentComplete][createHistory][3]'));if(_0x2eeebe[_0x69de('0x1ab')](0x3,_0x10d586,_0x4503e9)&&!_0x2ddf64){if(_0x337818['countnoanswerretry']>=_0x4503e9[_0x69de('0x195')]){_0x2eeebe['createStateFinal'](_0x337818,_0x108b2e,_0x244e6b,_0x69de('0x1ae'));}else{_0x2eeebe[_0x69de('0x12a')](_0x337818,_0x108b2e,_0x244e6b,_0x69de('0x1ae'));}}break;case'5':_0x4503e9[_0x69de('0x1af')]+=0x1;_0x337818[_0x69de('0x73')]=0x5;_0x337818[_0x69de('0x74')]=_0x69de('0x1b0');_0x337818[_0x69de('0x124')]+=0x1;_0x337818['countglobal']+=0x1;ami[_0x69de('0x42')](_0x69de('0x1b1'),ut[_0x69de('0x11d')](_0x10d586,_0x69de('0x1b2')));_0xd12fc9=_0x4503e9['dialBusyRetryFrequency'];_0x41abf1=_0x4503e9[_0x69de('0xd9')];hopperUtils['createHistory'](_0x337818)[_0x69de('0xa1')](loggerCatch(_0x69de('0x1b3')));if(_0x2eeebe['checkRetriveMax'](0x5,_0x10d586,_0x4503e9)&&!_0x2ddf64){if(_0x337818[_0x69de('0x124')]>=_0x4503e9[_0x69de('0x197')]){_0x2eeebe[_0x69de('0x12b')](_0x337818,_0x108b2e,_0x244e6b,_0x69de('0x1b4'));}else{_0x2eeebe[_0x69de('0x12a')](_0x337818,_0x108b2e,_0x244e6b,'reason\x205\x20busy');}}break;case'8':_0x4503e9[_0x69de('0x1b5')]+=0x1;_0x337818['state']=0x8;_0x337818['statedesc']=_0x69de('0x1b6');_0x337818['countcongestionretry']+=0x1;_0x337818[_0x69de('0xd7')]+=0x1;_0xd12fc9=_0x4503e9[_0x69de('0x19b')];_0x41abf1=_0x4503e9[_0x69de('0xd9')];ami[_0x69de('0x42')](_0x69de('0x1b7'),ut['buildObj'](_0x10d586,_0x69de('0x1b8')));hopperUtils[_0x69de('0xe9')](_0x337818)[_0x69de('0xa1')](loggerCatch(_0x69de('0x1b9')));if(_0x2eeebe[_0x69de('0x1ab')](0x8,_0x10d586,_0x4503e9)&&!_0x2ddf64){if(_0x337818[_0x69de('0x194')]>=_0x4503e9[_0x69de('0x19a')]){_0x2eeebe[_0x69de('0x12b')](_0x337818,_0x108b2e,_0x244e6b,_0x69de('0x1ba'));}else{_0x2eeebe['stateGlobal'](_0x337818,_0x108b2e,_0x244e6b,_0x69de('0x1ba'));}}break;case'11':_0x4503e9[_0x69de('0x1bb')]+=0x1;_0x337818['state']=0xb;_0x337818[_0x69de('0x74')]=_0x69de('0xf2');_0x337818['countabandonedretry']+=0x1;_0x337818[_0x69de('0xd7')]+=0x1;_0xd12fc9=_0x4503e9['dialAbandonedRetryFrequency'];_0x41abf1=_0x4503e9['callAdditionalPhoneAfterMin'];hopperUtils['createHistory'](_0x337818)[_0x69de('0xa1')](loggerCatch(_0x69de('0x1bc')));if(_0x2eeebe[_0x69de('0x1ab')](0xb,_0x10d586,_0x4503e9)&&!_0x2ddf64){if(_0x337818['countabandonedretry']>=_0x4503e9[_0x69de('0x19f')]){_0x2eeebe[_0x69de('0x12b')](_0x337818,_0x108b2e,_0x244e6b,'reason\x2011\x20abandoned');}else{_0x2eeebe['stateGlobal'](_0x337818,_0x108b2e,_0x244e6b,_0x69de('0x1bd'));}}break;case'20':_0x4503e9[_0x69de('0x1be')]+=0x1;_0x337818[_0x69de('0x73')]=0x14;_0x337818[_0x69de('0x74')]=_0x69de('0x1bf');_0x337818[_0x69de('0x128')]+=0x1;_0x337818[_0x69de('0xd7')]+=0x1;_0xd12fc9=_0x4503e9[_0x69de('0x1a2')];_0x41abf1=_0x4503e9[_0x69de('0xd9')];ami['emit']('custom:agentreject',ut['buildObj'](_0x10d586,_0x69de('0x1c0')));hopperUtils[_0x69de('0xe9')](_0x337818)[_0x69de('0xa1')](loggerCatch('[syncAgentComplete][createHistory][20]'));if(_0x2eeebe[_0x69de('0x1ab')](0x14,_0x10d586,_0x4503e9)&&!_0x2ddf64){if(_0x337818['countagentrejectretry']>=_0x4503e9[_0x69de('0x1a1')]){_0x2eeebe['createStateFinal'](_0x337818,_0x108b2e,_0x244e6b,_0x69de('0x1c1'));}else{_0x2eeebe['stateGlobal'](_0x337818,_0x108b2e,_0x244e6b,'reason\x2020\x20agentreject');}}break;default:_0x4503e9[_0x69de('0x139')]+=0x1;_0x337818[_0x69de('0x73')]=0xc;_0x337818[_0x69de('0x74')]=_0x571e57[_0x69de('0xc7')];_0xd12fc9=_0x4503e9[_0x69de('0x1a2')];_0x41abf1=_0x4503e9['callAdditionalPhoneAfterMin'];hopperUtils['createHistory'](_0x337818)['catch'](loggerCatch(_0x69de('0x1c2')));if(_0x2eeebe[_0x69de('0x1ab')](_0x571e57[_0x69de('0xc7')],_0x10d586,_0x4503e9)&&!_0x2ddf64){if(_0x337818[_0x69de('0x124')]+_0x337818[_0x69de('0x194')]+_0x337818['countnoanswerretry']+_0x337818[_0x69de('0x126')]+_0x337818[_0x69de('0xd6')]+_0x337818[_0x69de('0xef')]+_0x337818['countmachineretry']+_0x337818['countagentrejectretry']>=_0x4503e9['dialGlobalMaxRetry']){_0x2eeebe[_0x69de('0x12a')](_0x337818,_0x108b2e,_0x244e6b,_0x571e57[_0x69de('0xc7')]);}else{_0x2eeebe[_0x69de('0x12b')](_0x337818,_0x108b2e,_0x244e6b,_0x571e57['reason']);}}}})[_0x69de('0x3f')](function(){if(_0x2ddf64){hopperUtils[_0x69de('0xeb')](_0x337818,_0xd12fc9,_0x41abf1)[_0x69de('0x3f')](function(){return _0x108b2e(0x1);});}});});};Dialer[_0x69de('0x8b')][_0x69de('0x12a')]=function(_0x56b3ee,_0x1efe0f,_0x452fe3,_0x2e0474){var _0x334589=new Final(_0x56b3ee);_0x334589['state']=0xf;_0x334589[_0x69de('0x74')]=_0x69de('0x1c3');this[_0x69de('0x12b')](_0x334589,_0x1efe0f,_0x452fe3,_0x2e0474);};Dialer[_0x69de('0x8b')][_0x69de('0x12b')]=function(_0x343227,_0x4b2962,_0x1c240f,_0x224df3){hopperUtils[_0x69de('0xcd')](_0x343227)[_0x69de('0x3f')](function(){return _0x4b2962(msgResponse(_0x69de('0x1a4'),'Success',_0x224df3));})[_0x69de('0xa1')](function(){return _0x1c240f(msgResponse(_0x69de('0x1c4'),_0x69de('0x94'),_0x69de('0x1c5')));});};Dialer[_0x69de('0x8b')]['predictive']=function(_0xbff8de){var _0x12d6af=_0xbff8de['dialPredictiveOptimizationPercentage']/0x64;var _0x48cdc7=_0xbff8de[_0x69de('0xd2')]/(_0xbff8de[_0x69de('0xd2')]+_0xbff8de[_0x69de('0xc6')]);var _0x319af5=Math[_0x69de('0x1c6')](_0xbff8de['predictiveIntervalAvailable']*(_0xbff8de[_0x69de('0x1c7')]/0x64));var _0x27c5ec=Math[_0x69de('0x1c6')](_0xbff8de[_0x69de('0x1c8')]*(_0xbff8de['predictiveIntervalMinThreshold']/0x64));var _0x3fc72b=_0xbff8de[_0x69de('0x13e')]+_0xbff8de[_0x69de('0x1c9')];var _0x3ebe77=Math[_0x69de('0x1ca')](_0xbff8de[_0x69de('0x5c')]*_0xbff8de['erlangAbandonmentRate']*_0xbff8de[_0x69de('0x1cb')]*_0xbff8de['predictiveIntervalMultiplicativeFactor']);if(_[_0x69de('0x41')](_0xbff8de['startProgressive'])){if(!_['isUndefined'](_0xbff8de[_0x69de('0x65')])){_0xbff8de[_0x69de('0x65')]=undefined;loggerPredictive['error']('[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine');}if(!_[_0x69de('0x41')](_0xbff8de[_0x69de('0x67')])){loggerPredictive[_0x69de('0x69')](_0x69de('0x1cc'),'check\x20handlePredictive\x20is\x20not\x20undefine');clearInterval(_0xbff8de[_0x69de('0x67')]);_0xbff8de[_0x69de('0x67')]=undefined;}_0xbff8de['startProgressive']=moment()[_0x69de('0x7e')](_0x69de('0xc5'));loggerPredictive[_0x69de('0x4d')](_0xbff8de[_0x69de('0x47')],_0x69de('0x1cd'),_0xbff8de[_0x69de('0x27')]);this[_0x69de('0xb3')](_0xbff8de,0x1);}else if(ifInterval(_0xbff8de[_0x69de('0x1ce')],_0xbff8de[_0x69de('0x27')])){this[_0x69de('0xb3')](_0xbff8de,0x1);loggerPredictiveCalls[_0x69de('0x4d')](_0x69de('0x1cf'),_0xbff8de[_0x69de('0x27')],_0xbff8de[_0x69de('0x47')]);_0xbff8de['erlangCalls']=0x0;_0xbff8de['predictiveIntervalErlangCallsDroppedCalls']=0x0;}else if(_0x12d6af<_0x48cdc7&&_0xbff8de[_0x69de('0x1d0')]==='dropRate'){clearPredictiveAttributes(_0xbff8de);loggerPredictive['info']('[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day',_0x48cdc7,'startProgressive',_0xbff8de[_0x69de('0x47')]);}else if(_0x3ebe77<_0xbff8de[_0x69de('0xd3')]&&_0xbff8de['dialPredictiveOptimization']===_0x69de('0x1d1')){clearPredictiveAttributes(_0xbff8de);loggerPredictive['info'](_0x69de('0x1d2'),_0x69de('0x1d3'),_0x3ebe77,'Drop\x20in\x20this\x20interval',_0xbff8de[_0x69de('0xd3')],_0x69de('0x27'),_0xbff8de[_0x69de('0x47')]);}else if(!ifInterval(_0xbff8de[_0x69de('0x1ce')],_0xbff8de[_0x69de('0x27')])&&_[_0x69de('0x41')](_0xbff8de['startPredictive'])&&!_[_0x69de('0x41')](_0xbff8de['startProgressive'])){_0xbff8de['startPredictive']=moment()[_0x69de('0x7e')](_0x69de('0xc5'));loggerPredictive[_0x69de('0x4d')](_0xbff8de[_0x69de('0x47')],_0x69de('0x1d4'),_0xbff8de[_0x69de('0x65')]);hopperUtils['avgHandleTime'](_0xbff8de[_0x69de('0x1ce')])[_0x69de('0x3f')](this[_0x69de('0x1d5')](_0xbff8de))['then'](mergeDataErlangB(_0xbff8de))[_0x69de('0x3f')](this[_0x69de('0x1d6')](_0xbff8de))[_0x69de('0xa1')](loggerCatchPredictive(_0x69de('0x1d7'),_0xbff8de));}else if(!ifInterval(_0xbff8de[_0x69de('0x1ce')],_0xbff8de[_0x69de('0x65')])){_0xbff8de[_0x69de('0xd3')]=0x0;_0xbff8de['startPredictive']=moment()[_0x69de('0x7e')](_0x69de('0xc5'));loggerPredictive[_0x69de('0x4d')](_0xbff8de[_0x69de('0x47')],_0x69de('0x1d8'),_0xbff8de[_0x69de('0x65')]);clearInterval(_0xbff8de[_0x69de('0x67')]);_0xbff8de[_0x69de('0x67')]=undefined;hopperUtils['avgHandleTime'](_0xbff8de[_0x69de('0x1ce')])[_0x69de('0x3f')](this[_0x69de('0x1d5')](_0xbff8de))[_0x69de('0x3f')](mergeDataErlangB(_0xbff8de))['then'](this['startMethodPredictive'](_0xbff8de))[_0x69de('0xa1')](loggerCatchPredictive(_0x69de('0x1d9'),_0xbff8de));}else if(_0xbff8de['predictiveIntervalAvailable']&&_0x3fc72b<_0xbff8de[_0x69de('0x1c8')]-_0x27c5ec){clearPredictiveAttributes(_0xbff8de);loggerPredictive[_0x69de('0x4d')](_0xbff8de[_0x69de('0x47')],_0x69de('0x1da'),_0x3fc72b,')\x20are\x20less\x20than\x20threshold\x20(',_0xbff8de[_0x69de('0x1c8')],'-',_0x27c5ec,'=',_0xbff8de['predictiveIntervalAvailable']-_0x27c5ec,')');}else if(_0xbff8de[_0x69de('0x1c8')]&&_0x3fc72b>_0xbff8de[_0x69de('0x1c8')]+_0x319af5){clearPredictiveAttributes(_0xbff8de);loggerPredictive[_0x69de('0x4d')](_0xbff8de[_0x69de('0x47')],_0x69de('0x1da'),_0x3fc72b,_0x69de('0x1db'),_0xbff8de[_0x69de('0x1c8')],'+',_0x319af5,'=',_0xbff8de[_0x69de('0x1c8')]+_0x319af5,')');}};Dialer['prototype'][_0x69de('0x1d5')]=function(_0x533d84){var _0x81c0fb=this;return function(_0x19e29a){return new Promise(function(_0x3848ea,_0x20546e){_[_0x69de('0x62')](_0x533d84,_0x19e29a[0x0]);if(checkGetDataPredictive(_0x19e29a[0x0])){var _0x1196fa=_0x533d84[_0x69de('0x1c8')]=_0x533d84[_0x69de('0x1c9')]+_0x533d84[_0x69de('0x13e')];var _0x3c80a6=_0x533d84[_0x69de('0x1ce')]*0x3c;var _0x31b348=_0x19e29a[0x0][_0x69de('0x56')]+_0x19e29a[0x0][_0x69de('0x54')];var _0x529bff=(_0x19e29a[0x0][_0x69de('0x4e')]+_0x19e29a[0x0][_0x69de('0x50')]+_0x19e29a[0x0][_0x69de('0x52')])/_0x19e29a[0x0][_0x69de('0x4c')];_0x533d84[_0x69de('0x1cb')]=_0x529bff>0x0?_0x529bff:0x1;switch(_0x533d84[_0x69de('0x1d0')]){case _0x69de('0x1d1'):var _0x2ad32a=_0x533d84[_0x69de('0x1dc')]/0x64;return _0x81c0fb['abandonmentRate'](_0x1196fa,_0x3c80a6,_0x31b348,_0x529bff,_0x2ad32a)[_0x69de('0x3f')](function(_0x24a369){return _0x3848ea(_0x24a369);});case'agentBusyFactor':var _0x539437=_0x533d84[_0x69de('0x1dc')]/0x64;return _0x81c0fb[_0x69de('0x1dd')](_0x1196fa,_0x3c80a6,_0x31b348,_0x529bff,_0x539437)[_0x69de('0x3f')](function(_0x19afc2){return _0x3848ea(_0x19afc2);});default:return _0x20546e(msgResponse(_0x69de('0x1de'),_0x69de('0x94'),_0x69de('0x1df')));}}else{return _0x20546e(msgResponse(_0x69de('0x1de'),'Failure',_0x69de('0x1e0')));}});};};Dialer[_0x69de('0x8b')][_0x69de('0x1e1')]=function(_0x443bfa){var _0x329131=this;return function(_0x245a22){return new Promise(function(_0x5042e3,_0x4fa255){_[_0x69de('0x62')](_0x443bfa,_0x245a22[0x0]);if(checkGetDataPredictive(_0x245a22[0x0])){loggerPredictive[_0x69de('0x4d')](JSON[_0x69de('0x77')](_0x245a22[0x0]));if(_0x443bfa['dialPredictiveOptimization']===_0x69de('0x1d1')){return _0x329131[_0x69de('0x156')](_0x443bfa['id'])['then'](function(_0x52c013){var _0x214f5f=_0x443bfa['loggedIn']-_0x52c013[0x0][_0x69de('0x1e2')];var _0x766f6=_0x443bfa[_0x69de('0x1ce')]*0x3c;var _0x3ddac2=_0x245a22[0x0]['predictiveIntervalAvgTalktime']+_0x245a22[0x0][_0x69de('0x54')];var _0x588783=(_0x245a22[0x0][_0x69de('0x4e')]+_0x245a22[0x0][_0x69de('0x50')]+_0x245a22[0x0][_0x69de('0x52')])/_0x245a22[0x0][_0x69de('0x4c')];var _0x2f84ff=_0x443bfa[_0x69de('0x1dc')]/0x64;_0x443bfa['predictiveIntervalPauses']=_0x52c013[0x0][_0x69de('0x1e2')]||0x0;_0x443bfa[_0x69de('0x1cb')]=_0x588783>0x0?_0x588783:0x1;return _0x329131['abandonmentRate'](_0x214f5f,_0x766f6,_0x3ddac2,_0x588783,_0x2f84ff);})[_0x69de('0x3f')](function(_0x725a12){return _0x5042e3(_0x725a12);})[_0x69de('0xa1')](function(_0x41e0ba){return _0x4fa255(msgResponse(_0x69de('0x1e3'),_0x69de('0x94'),JSON['stringify'](_0x41e0ba)));});}if(_0x443bfa[_0x69de('0x1d0')]===_0x69de('0x1e4')){return _0x329131[_0x69de('0x156')](_0x443bfa['id'])['then'](function(_0x16cfb2){var _0x3e23af=_0x443bfa[_0x69de('0x1e5')]-_0x16cfb2[0x0][_0x69de('0x1e2')];var _0x5ca7d0=_0x443bfa[_0x69de('0x1ce')]*0x3c;var _0x1b13e1=_0x245a22[0x0][_0x69de('0x56')]+_0x245a22[0x0][_0x69de('0x54')];var _0x1d2495=(_0x245a22[0x0][_0x69de('0x4e')]+_0x245a22[0x0][_0x69de('0x50')]+_0x245a22[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x245a22[0x0][_0x69de('0x4c')];var _0x4186e9=_0x443bfa['dialPredictiveOptimizationPercentage']/0x64;_0x443bfa[_0x69de('0x1e6')]=_0x16cfb2[0x0][_0x69de('0x1e2')]||0x0;_0x443bfa[_0x69de('0x1cb')]=_0x1d2495>0x0?_0x1d2495:0x1;return _0x329131[_0x69de('0x1dd')](_0x3e23af,_0x5ca7d0,_0x1b13e1,_0x1d2495,_0x4186e9);})[_0x69de('0x3f')](function(_0x295d95){return _0x5042e3(_0x295d95);})[_0x69de('0xa1')](function(_0x966c8d){return _0x4fa255(msgResponse(_0x69de('0x1e3'),'Failure',JSON[_0x69de('0x77')](_0x966c8d)));});}}else{return _0x4fa255(msgResponse('[getDataPredictive]','Failure',_0x69de('0x1e0')));}});};};Dialer[_0x69de('0x8b')][_0x69de('0x1d6')]=function(_0x3fc3f9){var _0x220e71=this;return function(){var _0x2aee1a=0x0;var _0x49ffd4=Math[_0x69de('0x1ca')](_0x3fc3f9[_0x69de('0x5d')]*0x3e8);if(_0x49ffd4>0x0){_0x49ffd4=_0x49ffd4<0x64?0x64:_0x49ffd4;loggerPredictive[_0x69de('0x4d')](_0x3fc3f9[_0x69de('0x47')],_0x69de('0x1e7'),_0x49ffd4,_0x69de('0x1e8'));_0x3fc3f9[_0x69de('0x67')]=setInterval(function(){_0x220e71[_0x69de('0x67')](_0x3fc3f9);loggerPredictiveCalls[_0x69de('0x4d')](_0x69de('0x1e9'),_0x2aee1a+=0x1);},_0x49ffd4);}else{loggerPredictive[_0x69de('0x4d')](_0x3fc3f9[_0x69de('0x47')],_0x69de('0x1ea'));}};};Dialer['prototype'][_0x69de('0x1eb')]=function(_0x28ba1e,_0x30c522){var _0x438e69=this;return function(_0x455ece){if(_[_0x69de('0x49')](_0x455ece)){if(_[_0x69de('0x102')](_0x30c522[_0x69de('0x15c')])||!_0x30c522[_0x69de('0x1ec')]){if(_0x28ba1e['dialMethod']===_0x69de('0x9')){_0x28ba1e[_0x69de('0x75')]=_['isUndefined'](_0x28ba1e['queueStatusComplete'])?!![]:_0x28ba1e[_0x69de('0x75')];var _0x1d6115=uuid['v4']();_0x438e69['actions'][_0x1d6115]=new Action(_0x28ba1e,_0x30c522,_0x1d6115);loggerBooked[_0x69de('0x4d')](_0x69de('0x1ed'),_0x1d6115,_0x69de('0x1ee'),JSON['stringify'](_0x28ba1e[_0x69de('0x75')]),_0x69de('0x1ef'),_0x28ba1e[_0x69de('0x47')]);if(_0x28ba1e[_0x69de('0x75')]){_0x28ba1e[_0x69de('0x75')]=![];_0x438e69[_0x69de('0x29')][_0x438e69[_0x69de('0xf3')][_0x1d6115][_0x69de('0xbf')]]=[];ami[_0x69de('0x152')]({'actionid':_0x1d6115,'action':_0x69de('0x1f0'),'queue':_0x28ba1e[_0x69de('0x47')]})[_0x69de('0xa1')](function(){_0x438e69[_0x69de('0xc3')](_0x28ba1e);hopperUtils['rescheduleContact']({'active':![],'ContactId':_0x438e69['actions'][_0x1d6115][_0x69de('0xe0')],'ListId':_0x438e69['actions'][_0x1d6115][_0x69de('0xe1')],'VoiceQueueId':_0x438e69[_0x69de('0xf3')][_0x1d6115]['VoiceQueueId']||undefined,'CampaignId':_0x438e69[_0x69de('0xf3')][_0x1d6115][_0x69de('0xe3')]||undefined})['catch'](loggerCatch(_0x69de('0x1f1')));delete _0x438e69[_0x69de('0xf3')][_0x1d6115];});}else{loggerBooked['info'](_0x69de('0x1f2'),JSON[_0x69de('0x77')](_0x28ba1e['queueStatusComplete']),_0x69de('0x1ef'),_0x28ba1e[_0x69de('0x47')]);_0x438e69[_0x69de('0xc3')](_0x28ba1e);hopperUtils[_0x69de('0xf0')]({'active':![],'ContactId':_0x438e69['actions'][_0x1d6115]['ContactId'],'ListId':_0x438e69['actions'][_0x1d6115]['ListId'],'VoiceQueueId':_0x438e69[_0x69de('0xf3')][_0x1d6115][_0x69de('0xe2')]||undefined,'CampaignId':_0x438e69[_0x69de('0xf3')][_0x1d6115]['CampaignId']||undefined})[_0x69de('0xa1')](loggerCatch(_0x69de('0x1f1')));delete _0x438e69['actions'][_0x1d6115];}}else{return _0x438e69[_0x69de('0x160')](_0x28ba1e,_0x30c522);}}else{if(utils['getSeconds'](undefined,_0x30c522[_0x69de('0x1f3')])<_0x28ba1e[_0x69de('0x1f4')]*0x3c){if(_0x30c522[_0x69de('0x14b')]&&!_0x30c522[_0x69de('0x14b')][_0x69de('0x1f5')]){_0x438e69[_0x69de('0x1f')][_0x69de('0xfe')](_0x30c522['id'])[_0x69de('0x1d')](function(){_0x438e69[_0x69de('0xc3')](_0x28ba1e);});}else{hopperUtils['unlockContact']({'active':![]},_0x30c522['id'],0x1)['finally'](function(){_0x438e69[_0x69de('0xc3')](_0x28ba1e);});}}else{_0x28ba1e['outboundReCallsDay']+=0x1;_0x438e69[_0x69de('0xc3')](_0x28ba1e);if(_0x28ba1e['dialRecallInQueue']){hopperUtils['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0x30c522[_0x69de('0xe0')],'ListId':_0x30c522[_0x69de('0xe1')],'VoiceQueueId':_0x30c522[_0x69de('0xe2')]||undefined,'CampaignId':_0x30c522[_0x69de('0xe3')]||undefined})[_0x69de('0xa1')](loggerCatch(_0x69de('0x1f6')));hopperUtils['createHistory'](createObjHistory(_0x28ba1e,_0x30c522,utils[_0x69de('0x6e')][_0x69de('0x1f7')],0x17,_0x69de('0x1f8')))[_0x69de('0xa1')](loggerCatch(_0x69de('0x1f9')));}else{_0x438e69[_0x69de('0x15b')](createObjHistory(_0x28ba1e,_0x30c522,utils[_0x69de('0x6e')][_0x69de('0x1fa')],0x16,_0x69de('0x1fb')),_0x69de('0x1fc'),_0x69de('0x1fd'));}}}}else{_0x28ba1e['outboundBlacklistCallsDay']+=0x1;_0x438e69[_0x69de('0x15b')](createObjHistory(_0x28ba1e,_0x30c522,utils['CAMPAIGN_STATUS']['BLACKLIST'],0xd,'Blacklist'),_0x69de('0x1fe'),'[Originate][MoveBlacklist]');throw'inBlackList';}};};Dialer['prototype']['handleIvr']=function(_0x30ba68){var _0xf3d4ac=this;var _0x275c7f=_0x30ba68[_0x69de('0x1ff')]-_0x30ba68[_0x69de('0x82')];emitCampaignSummary(_0x30ba68);if(_0x275c7f>0x0&&_0x30ba68['temp']==0x0){if(_0x275c7f>this[_0x69de('0x24')]){_0x275c7f=this[_0x69de('0x24')];}_0x30ba68['temp']=0x1;hopperUtils[_0x69de('0x200')](_0x30ba68,_0x275c7f)[_0x69de('0x3f')](function(_0x29c3dd){_0x30ba68[_0x69de('0x6c')]=0x0;if(_0x29c3dd){if(!utils[_0x69de('0x201')](_0x29c3dd)){_0x30ba68[_0x69de('0x6d')]=utils[_0x69de('0x6e')][_0x69de('0x71')];logger[_0x69de('0x4d')](_0x69de('0x202')+_0x30ba68[_0x69de('0x47')]);}else{_0x30ba68['originated']+=_0x29c3dd[_0x69de('0x9a')];_0x30ba68[_0x69de('0x6d')]=utils[_0x69de('0x6e')][_0x69de('0x203')];for(var _0x3e6392=0x0;_0x3e6392<_0x29c3dd['length'];_0x3e6392+=0x1){_0x30ba68[_0x69de('0x204')]+=0x1;if(_['isNil'](_0x29c3dd[_0x3e6392])||_[_0x69de('0x102')](_0x29c3dd[_0x3e6392][_0x69de('0x205')])||_[_0x69de('0x102')](_0x29c3dd[_0x3e6392]['phone'])){_0xf3d4ac[_0x69de('0x206')](_0x69de('0x207'),_0x30ba68,_0x29c3dd[_0x3e6392]);}else{hopperUtils[_0x69de('0x208')](_['pick'](_0x29c3dd[_0x3e6392],[_0x69de('0xe3'),'phone']))[_0x69de('0x3f')](_0xf3d4ac[_0x69de('0x1eb')](_0x30ba68,_0x29c3dd[_0x3e6392]))['catch'](_0xf3d4ac['loggerHandler']('[actionOriginateIvr]\x20',_0x30ba68));}}}}})[_0x69de('0xa1')](loggerGetContactDialer(_0x69de('0x209'),_0x30ba68,_0x275c7f));}};Dialer[_0x69de('0x8b')][_0x69de('0xb3')]=function(_0x486fb3,_0x584d84){var _0x349fb2=this;var _0x4bfc19=[];if(_0x584d84<0x1||_0x486fb3[_0x69de('0xb0')]===_0x69de('0x9')){_0x584d84=0x1;}var _0x3d1954=Math[_0x69de('0x1ca')](_0x486fb3[_0x69de('0x13e')]*_0x584d84)-_0x486fb3['originated'];if(_0x486fb3[_0x69de('0x20a')]>0x0){var _0x304aa1=_0x486fb3[_0x69de('0x20a')]-_0x486fb3[_0x69de('0x82')]-_0x486fb3[_0x69de('0x1c9')]-_0x486fb3[_0x69de('0x140')];if(_0x3d1954>_0x304aa1){_0x3d1954=_0x304aa1;}}if(_0x3d1954>0x0&&_0x486fb3['temp']==0x0){if(_0x486fb3[_0x69de('0xb0')]==='booked'){_0x3d1954=0x1;}if(_0x3d1954>this[_0x69de('0x24')]){_0x3d1954=this['maxNumberOriginate'];}for(var _0x25218f in this[_0x69de('0x22')]){if(typeof this[_0x69de('0x22')][_0x25218f]!==_0x69de('0xab')){if(this[_0x69de('0x22')][_0x25218f][_0x69de('0x73')]===_0x69de('0x20b')&&this['agents'][_0x25218f]['status']===_0x69de('0x20c')){_0x4bfc19['push'](this[_0x69de('0x22')][_0x25218f]['id']);}}}_0x486fb3[_0x69de('0x6c')]=0x1;hopperUtils[_0x69de('0x20d')](_0x486fb3,_0x4bfc19,_0x3d1954)[_0x69de('0x3f')](function(_0x874c06){_0x486fb3['temp']=0x0;if(_0x874c06){if(!utils[_0x69de('0x201')](_0x874c06)){hopperUtils['countReScheduled'](_0x486fb3)[_0x69de('0x3f')](sendMessageReschedule(_0x486fb3))['catch'](loggerCatch(_0x69de('0x20e')));}else{_0x486fb3[_0x69de('0x82')]+=_0x874c06[_0x69de('0x9a')];_0x486fb3[_0x69de('0x6d')]=_0x486fb3[_0x69de('0xb0')]===_0x69de('0x9')?utils[_0x69de('0x6e')]['ACTIVE']:utils[_0x69de('0x6e')][_0x69de('0x203')];for(var _0x54a943=0x0;_0x54a943<_0x874c06[_0x69de('0x9a')];_0x54a943+=0x1){if(_['isNil'](_0x874c06[_0x54a943])||_[_0x69de('0x102')](_0x874c06[_0x54a943][_0x69de('0x205')])||_[_0x69de('0x102')](_0x874c06[_0x54a943][_0x69de('0x164')])){_0x349fb2['emptyContact'](_0x69de('0x207'),_0x486fb3,_0x874c06[_0x54a943]);}else{hopperUtils['checkIsBlackList'](_['pick'](_0x874c06[_0x54a943],[_0x69de('0xe2'),_0x69de('0x164')]))[_0x69de('0x3f')](_0x349fb2['checkContactBlack'](_0x486fb3,_0x874c06[_0x54a943]))[_0x69de('0xa1')](_0x349fb2['loggerHandler']('[actionOriginate]\x20',_0x486fb3));}}}}})[_0x69de('0xa1')](loggerGetContactDialer(_0x69de('0x20f'),_0x486fb3,_0x3d1954));}};Dialer[_0x69de('0x8b')][_0x69de('0x67')]=function(_0x2b4bcb){if(_0x2b4bcb[_0x69de('0x20a')]>0x0){var _0x57be90=_0x2b4bcb[_0x69de('0x20a')]-_0x2b4bcb[_0x69de('0x82')]-_0x2b4bcb[_0x69de('0x1c9')];if(_0x57be90>0x0&&_0x2b4bcb['temp']==0x0){this[_0x69de('0x210')](_0x2b4bcb);}else{loggerPredictiveCalls[_0x69de('0x4d')](_0x69de('0x211'));}}else{this['tryOriginatePredictive'](_0x2b4bcb);}};Dialer[_0x69de('0x8b')][_0x69de('0x210')]=function(_0x2dbd06){var _0x46a150=this;var _0x3d1166=[];_0x2dbd06['originated']+=0x1;for(var _0x4db2d5 in this[_0x69de('0x22')]){if(typeof this[_0x69de('0x22')][_0x4db2d5]!==_0x69de('0xab')){if(this[_0x69de('0x22')][_0x4db2d5]['state']===_0x69de('0x20b')&&this[_0x69de('0x22')][_0x4db2d5][_0x69de('0x8a')]===_0x69de('0x20c')){_0x3d1166[_0x69de('0xa2')](this[_0x69de('0x22')][_0x4db2d5]['id']);}}}_0x2dbd06[_0x69de('0x6c')]=0x1;return this[_0x69de('0x20d')](_0x2dbd06['id'],_0x3d1166,0x1,_0x2dbd06[_0x69de('0x212')],_0x2dbd06)[_0x69de('0x3f')](function(_0x219c2b){_0x2dbd06[_0x69de('0x6c')]=0x1;if(_0x219c2b){if(!utils[_0x69de('0x201')](_0x219c2b)){utils['checkContactLowerLimitOriginate'](_0x2dbd06,0x1,0x0);return hopperUtils['countReScheduled'](_0x2dbd06)[_0x69de('0x3f')](sendMessageReschedule(_0x2dbd06))['catch'](loggerCatch(_0x69de('0x20e')));}else{_0x2dbd06[_0x69de('0x6d')]=utils[_0x69de('0x6e')]['RUNNING'];if(_['isNil'](_0x219c2b[0x0])||_['isNil'](_0x219c2b[0x0]['Contact'])||_[_0x69de('0x102')](_0x219c2b[0x0][_0x69de('0x164')])){_0x46a150['emptyContact'](_0x69de('0x207'),_0x2dbd06,_0x219c2b[0x0]);}else{return hopperUtils['checkIsBlackList'](_[_0x69de('0xfb')](_0x219c2b[0x0],['VoiceQueueId',_0x69de('0x164')]))[_0x69de('0x3f')](_0x46a150[_0x69de('0x1eb')](_0x2dbd06,_0x219c2b[0x0]))['catch'](_0x46a150[_0x69de('0x159')]('[actionOriginatePredictive]\x20',_0x2dbd06));}}}})[_0x69de('0xa1')](loggerGetContactDialer('[getContactDialerPredictive]',_0x2dbd06,0x1));};Dialer[_0x69de('0x8b')][_0x69de('0x213')]=function(_0x6b974b,_0xe5e9c9,_0xe7801f,_0x497ce5,_0xe131e0,_0x2a7a64){loggerPredictive[_0x69de('0x4d')](_0x69de('0x214'));loggerPredictive['info'](_0x69de('0x215'),_0x6b974b);loggerPredictive[_0x69de('0x4d')](_0x69de('0x216'),_0xe5e9c9);loggerPredictive[_0x69de('0x4d')](_0x69de('0x217'),_0xe7801f);loggerPredictive[_0x69de('0x4d')](_0x69de('0x218'),_0x497ce5);loggerPredictive[_0x69de('0x4d')]('Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0xe131e0);loggerPredictive[_0x69de('0x4d')](_0x69de('0x55'));return new Promise(function(_0x448fd5,_0x44f7a3){if(_0x6b974b<=0x0||isNaN(_0x6b974b)){return _0x44f7a3(msgResponse(_0x69de('0x219'),_0x69de('0xbe'),'m\x20=\x20'+_0x6b974b));}if(_0xe7801f<=0x0||isNaN(_0xe7801f)){return _0x44f7a3(msgResponse(_0x69de('0x219'),_0x69de('0xbe'),'Ts\x20=\x20'+_0xe7801f));}if(_0x497ce5<=0x0||isNaN(_0x497ce5)){return _0x44f7a3(msgResponse(_0x69de('0x219'),'Error',_0x69de('0x21a')+_0x497ce5));}if(_0xe5e9c9<=0x0||isNaN(_0xe5e9c9)){return _0x44f7a3(msgResponse('[abandonmentRate]',_0x69de('0xbe'),_0x69de('0x21b')+_0xe5e9c9));}if(_0xe131e0<=0x0||isNaN(_0xe131e0)){return _0x44f7a3(msgResponse('[abandonmentRate]',_0x69de('0xbe'),_0x69de('0x21c')+_0xe131e0));}_0x2a7a64=_0x2a7a64||0x0;var _0x3cbe2a=0x1/_0xe7801f;var _0x57388a=0x0;var _0x3b3e11=0x0;var _0x3856a9=0x0;var _0x23d953=0x0;for(var _0x2c7de9=0x0;_0x3856a9<_0xe131e0;_0x2c7de9+=0x1){_0x3b3e11=_0x2c7de9/_0xe5e9c9;_0x57388a=(_0x497ce5*_0x3b3e11+_0x2a7a64)/_0x3cbe2a;_0x3856a9=utils[_0x69de('0x21d')](_0x57388a,_0x6b974b);_0x23d953=_0x57388a/_0x6b974b*(0x1-utils[_0x69de('0x21d')](_0x57388a,_0x6b974b));}return _0x448fd5({'erlangCalls':_0x2c7de9,'erlangCallToSecond':_0xe5e9c9/_0x2c7de9,'erlangAbandonmentRate':_0x3856a9,'erlangBusyFactor':_0x23d953});});};Dialer['prototype']['busyFactor']=function(_0x58b521,_0x17dedd,_0x518f3f,_0x3fa84a,_0x40c482,_0x622a5d){loggerPredictive[_0x69de('0x4d')](_0x69de('0x21e'));loggerPredictive[_0x69de('0x4d')]('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',_0x58b521);loggerPredictive['info'](_0x69de('0x216'),_0x17dedd);loggerPredictive[_0x69de('0x4d')](_0x69de('0x217'),_0x518f3f);loggerPredictive[_0x69de('0x4d')]('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',_0x3fa84a);loggerPredictive[_0x69de('0x4d')](_0x69de('0x21f'),_0x40c482);loggerPredictive['info']('---------------------------');return new Promise(function(_0x401d1c,_0x32b3b5){if(_0x58b521<=0x0||isNaN(_0x58b521)){return _0x32b3b5(msgResponse('[busyFactor]','Error',_0x69de('0x220')+_0x58b521));}if(_0x518f3f<=0x0||isNaN(_0x518f3f)){return _0x32b3b5(msgResponse('[busyFactor]',_0x69de('0xbe'),_0x69de('0x221')+_0x518f3f));}if(_0x3fa84a<=0x0||isNaN(_0x3fa84a)){return _0x32b3b5(msgResponse(_0x69de('0x222'),'Error',_0x69de('0x21a')+_0x3fa84a));}if(_0x17dedd<=0x0||isNaN(_0x17dedd)){return _0x32b3b5(msgResponse(_0x69de('0x222'),_0x69de('0xbe'),_0x69de('0x21b')+_0x17dedd));}if(_0x40c482<=0x0||isNaN(_0x40c482)){return _0x32b3b5(msgResponse(_0x69de('0x222'),_0x69de('0xbe'),_0x69de('0x223')+_0x40c482));}_0x622a5d=_0x622a5d||0x0;var _0x170f9d=0x1/_0x518f3f;var _0x4292d7=0x0;var _0x34c29b=0x0;var _0x41c950=0x0;var _0x344105=0x0;for(var _0x4b9d07=0x0;_0x344105<_0x40c482;_0x4b9d07+=0x1){_0x34c29b=_0x4b9d07/_0x17dedd;_0x4292d7=(_0x3fa84a*_0x34c29b+_0x622a5d)/_0x170f9d;_0x41c950=utils[_0x69de('0x21d')](_0x4292d7,_0x58b521);_0x344105=_0x4292d7/_0x58b521*(0x1-utils['erlangb'](_0x4292d7,_0x58b521));}return _0x401d1c({'erlangCalls':_0x4b9d07,'erlangCallToSecond':_0x17dedd/_0x4b9d07,'erlangAbandonmentRate':_0x41c950,'erlangBusyFactor':_0x344105});});};module['exports']=Dialer; \ No newline at end of file +var _0x5860=['undefined','dialGlobalInterval','dialTimezone','launchHandleIvr','[syncCampaigns]','checkDialMethod','progressive','handlePower','power','dialPowerLevel','Queue','silly','Voice\x20Queue\x20%s\x20$s','[ifTime][promiseAll]','Timezone:\x20','isGlobal','AMI\x20IfTime','uniqueid','ivr','updateOriginated','answertime','YYYY-MM-DD\x20HH:mm:ss','queue','outboundAnswerCallsDay','agent','agiafterat','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','moveContactManagedDialer','[syncAgentComplete]','droptime','responsetime','dialQueueTimeout','predictiveIntervalDroppedCallsTimeout','outboundDropCallsDayTimeout','predictiveIntervalErlangCallsDroppedCalls','statedesc','Drop','TIMEOUT','dialQueueProject2','countdropretry','dialDropRetryFrequency','callAdditionalPhoneAfterMin','verifyAdditionalPhones','additional','dialDropMaxRetry','rescheduleContact','add','ListId','VoiceQueueId','[rescheduleContact][Drop]','calleridname','calleridnum','createHistory','swapAdditionalPhones','Abandoned','dropreason','CALLEREXIT','countabandonedretry','countglobal','dialAbandonedRetryFrequency','voiceQueue','dialAbandonedMaxRetry','queueCallerAbandonCreateState','minutes','ContactId','CampaignId','[rescheduleContact][Abandoned]','channel','actionid','strategy','rrmemory','roundrobin','isNil','locked','paused','agents','stateinterface','syncQueueStatusComplete','preview','run','idHopper','[Catch][Preview][syncQueueStatusComplete]','[unlock][syncQueueStatusComplete]','queueBookedRR','_rr','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','getQueue','Success','callProgressDetecting','[callProgressDetecting]\x20','variable','amdstatus','xcally-motion-dialer','value','HANGUP','outboundAnswerAgiCallsDay','HangupInAMD','membername','AMD','custom:amd','amd','saveInDb','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','MACHINE','countmachineretry','buildObj','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','dialAMDActive','[syncHangupInAMDIvr]','Machine','dialMachineRetryFrequency','[rescheduleContact][Machine]','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','AGI','cause-txt','outboundUnknownCallsDay','running','INACTIVE','statusMessage','getQueueCampaignStatusMessage','resolve','available','talking','pTalking','ACTIVE','compareToOutboundQueue','queueSummaryCountersUpdated','updateReportFromOutboundQueue','assign','filter','dialPreviewRecallmeReminder','online','handlePreviewRecallNotifications','map','Agent','user:%s','user:dialPreviewRecallReminder','checkPreviewRecallReminder','loopClearZombieChannels','clearZombieChannels','[uniqueid]','[actions]','enqueue','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','loggerHandler','emptyContact','notFound','[emptyContact][createHistory]','[emptyContact]','[syncQueueCallerAbandon]\x20[Drop]','actionOriginate','originate','phone','contact\x20is\x20undefine','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','getCaller','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','isOutboundQueue','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','setXMDContactVariables','Contact','getCallerId','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','TrunkBackup','callerid','getCallerIdRandom','XMD-ORIGINATECALLERIDNAME','originatecalleridname','extractCalleridName','XMD-ORIGINATECALLERIDNUM','variables','SIP/%s/%s%s','dialPrefix','trim','substring','dialCutDigit','from-sip','dialOriginateTimeout','outboundOriginateFailureCallsDay','OriginateError','[originate][error]','originate\x20action\x20Error','checkRetriveMax','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyRetryFrequency','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','[rescheduleContact][NoSuchNumber]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','object','[callProgressDetecting]','reason','outboundNoSuchCallsDay','custom:agentnosuchnumber','nosuchnumber','dialNoSuchNumberRetryFrequency','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','buildNoAnswerEventPayload','custom:agentnoanswer','reason\x203\x20ringing\x20no\x20answer','Busy','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','dialBusyMaxRetry','reason\x205\x20busy','outboundCongestionCallsDay','congestion','reason\x208\x20congestion','outboundAbandonedCallsDay','[syncAgentComplete][createHistory][11]','reason\x2011\x20abandoned','AgentReject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','dialPredictiveOptimizationPercentage','round','predictiveIntervalAvailable','predictiveIntervalMinThreshold','floor','erlangCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','Dropped\x20calls\x20day','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','avgHandleTime','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','getDataPredictive','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','abandonmentRate','agentBusyFactor','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getDataPredictiveOld','loggedIn','outboundQueuePauses','predictiveIntervalPauses','[CatchErlangB]','one\x20call\x20every:','fail\x20to\x20scheduled\x20calls','checkContactBlack','UserId','recallme','dialMethod','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','scheduledat','dialRecallMeTimeout','voicePause','unlockContact','dialRecallInQueue','QUEUE_RECALL','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALL_TIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','BLACKLIST','Blacklist','[Originate][historyBlacklist]','handleIvr','limitCalls','getContactDialerIvr','checkContactEmpty','RUNNING','ivrTotalCallsDays','[actionOriginate]\x20','checkIsBlackListIvr','[actionOriginateIvr]\x20','dialLimitQueue','not_inuse','getContactDialer','countReScheduled','[countReScheduled]\x20','tryOriginatePredictive','dialOrderByScheduledAt','checkContactLowerLimitOriginate','[actionOriginatePredictive]\x20','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','m\x20=\x20','[abandonmentRate]','interval\x20=\x20','Amax\x20=\x20','erlangb','----\x20Agent\x20Busy\x20Factor\x20----','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','p\x20=\x20','Umin\x20=\x20','exports','util','lodash','uuid','moment','ioredis','./utils/hopper','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','booked','predictive','predictiveCalls','redis','defaults','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/setting','../rpc/interval','./models/final','./models/agentComplete','./models/queueCallerAbandon','env','XCALLY_IP_AGI','127.0.0.1','tail','finally','sequence','voiceQueues','campaigns','trunks','maxNumberOriginate','actions','contactsId','uniqueId','optionPredictive','startPredictive','startProgressive','queueBooked','queuesSummary','agentconnect','bind','syncQueueCallerAbandon','syncOriginateResponse','custom:queuesummary','syncQueueSummary','custom:queuesummarycomplete','syncQueueSummaryComplete','hangup','syncHangup','newexten','syncNewExten','varset','syncVarSet','queuemember','syncQueueMember','queuestatuscomplete','loopCampaigns','getSettings','previewRecallmeReminderInterval','isUndefined','emit','type','outbound','debug','inspect','voice:queue:%s','name','voice_queue:save','info','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalTotalCalls','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAnsweredCalls','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsCallersExit','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgHoldtime','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgTalktime','---------------------------','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','---------\x20ErlangB\x20---------','erlangCallToSecond','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangAbandonmentRate','merge','getSeconds','startProgressive\x20value\x20cleared','handlePredictive','handlePredictive\x20interval\x20cleared','error','temp','contactsRescheduled','message','CAMPAIGN_STATUS','contacts','NO_AVAILABLE_CONTACTS','state','endtime','starttime','queueStatusComplete','[booked][unlockQueueStatus]','stringify','pick','Interval','NULL_INTERVAL','\x20INTERVAL_IS_NULL','Intervals','isIVRCampaignActive','\x20NOT\x20Active','isIVRCampaign','format','campaign:ivr:%s','originated','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20not\x20active','DISACTIVED','is\x20disactive','[ifTime][Action]','Error','prototype','isTrunkReachable','active','SIP/%s','status','reachable','unmonitored','checkIsTrunkReachable','Trunk','TRUNK_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTimeIvr','checkIfTimeIntervals','ifTime','Failure','isEmpty','EMPTY_INTERVAL','\x20Intervals\x20is\x20empty\x20','timezones','UNKNOWN_TIMEZONE','\x20Timezone\x20unknow\x20','isArray','length','push','Action','command','iftime\x20%s,%s','interval','then','content','indexOf','true','catch','some','OVERTIME_GLOBAL_INTERVAL','OVERTIME_INTERVAL','Global:\x20','\x20Interval\x20is\x20overtime:\x20','resetActiveCalls','syncCampaigns'];(function(_0x26c19d,_0x3f7b9b){var _0x37d676=function(_0x4d091e){while(--_0x4d091e){_0x26c19d['push'](_0x26c19d['shift']());}};_0x37d676(++_0x3f7b9b);}(_0x5860,0x16d));var _0x0586=function(_0x1c0991,_0x4f22d2){_0x1c0991=_0x1c0991-0x0;var _0x5034de=_0x5860[_0x1c0991];return _0x5034de;};'use strict';var util=require(_0x0586('0x0'));var _=require(_0x0586('0x1'));var uuid=require(_0x0586('0x2'));var moment=require(_0x0586('0x3'));var rr=require('rr');var Redis=require(_0x0586('0x4'));var utils=require('./utils');var hopperUtils=require(_0x0586('0x5'));var ut=require(_0x0586('0x6'));var config=require(_0x0586('0x7'));var logger=require(_0x0586('0x8'))(_0x0586('0x9'));var loggerBooked=require(_0x0586('0x8'))(_0x0586('0xa'));var loggerPredictive=require(_0x0586('0x8'))(_0x0586('0xb'));var loggerPredictiveCalls=require('../../../config/logger')(_0x0586('0xc'));var loggerSyncQueueSummary=require('../../../config/logger')('syncQueueSummary');var ami=require('../ami');config[_0x0586('0xd')]=_[_0x0586('0xe')](config[_0x0586('0xd')],{'host':_0x0586('0xf'),'port':0x18eb});var io=require(_0x0586('0x10'))(new Redis(config[_0x0586('0xd')]));var cmHopper=require(_0x0586('0x11'));var voiceQueueRt=require('../rpc/voiceQueueRt');var RpcSetting=require(_0x0586('0x12'));var Interval=require(_0x0586('0x13'));var Action=require('./models/action');var History=require('./models/history');var Final=require(_0x0586('0x14'));var AgentComplete=require(_0x0586('0x15'));var QueueCallerAbandon=require(_0x0586('0x16'));var Hangup=require('./models/hangup');var ipAgi=process[_0x0586('0x17')][_0x0586('0x18')]||_0x0586('0x19');var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence['prototype']['enqueue']=function(_0x430282){this[_0x0586('0x1a')]=this[_0x0586('0x1a')]?this['tail'][_0x0586('0x1b')](_0x430282):_0x430282();};function Dialer(_0xd98504,_0x3a814c){this[_0x0586('0x1c')]=new Sequence();this['preview']=_0x3a814c;this['voiceQueues']=_0xd98504[_0x0586('0x1d')];this[_0x0586('0x1e')]=_0xd98504['campaigns'];this['agents']=_0xd98504['agents'];this[_0x0586('0x1f')]=_0xd98504[_0x0586('0x1f')];this[_0x0586('0x20')]=config[_0x0586('0x20')]||0x2;this['channels']={};this[_0x0586('0x21')]={};this[_0x0586('0x22')]={};this[_0x0586('0x23')]={};this[_0x0586('0x24')]={};this[_0x0586('0x25')]={};this[_0x0586('0x26')]={};this['ivrOriginated']={};this[_0x0586('0x27')]={};this['queueBookedRR']={};this[_0x0586('0x28')]={};ami['on'](_0x0586('0x29'),this['syncAgentConnect'][_0x0586('0x2a')](this));ami['on']('queuecallerabandon',this[_0x0586('0x2b')]['bind'](this));ami['on']('originateresponse',this[_0x0586('0x2c')][_0x0586('0x2a')](this));ami['on']('agentcomplete',this['syncAgentComplete'][_0x0586('0x2a')](this));ami['on'](_0x0586('0x2d'),this[_0x0586('0x2e')][_0x0586('0x2a')](this));ami['on'](_0x0586('0x2f'),this[_0x0586('0x30')][_0x0586('0x2a')](this));ami['on'](_0x0586('0x31'),this[_0x0586('0x32')][_0x0586('0x2a')](this));ami['on'](_0x0586('0x33'),this[_0x0586('0x34')][_0x0586('0x2a')](this));ami['on'](_0x0586('0x35'),this[_0x0586('0x36')][_0x0586('0x2a')](this));ami['on'](_0x0586('0x37'),this[_0x0586('0x38')][_0x0586('0x2a')](this));ami['on'](_0x0586('0x39'),this['syncQueueStatusComplete'][_0x0586('0x2a')](this));this[_0x0586('0x3a')]();this['loopClearZombieChannels']();RpcSetting[_0x0586('0x3b')]()['then'](function(_0x3e4d5e){previewRecallmeReminderInterval=_0x3e4d5e[_0x0586('0x3c')];});}function isNotNull(_0x50d583){return _0x50d583!==null&&!_[_0x0586('0x3d')](_0x50d583);}function msgResponse(_0x581133,_0x360085,_0x1c4c02){return{'action':_0x581133,'response':_0x360085,'message':_0x1c4c02,'stack':_0x1c4c02};}function emit(_0x31a363,_0x243c72,_0x24f9f6){io['to'](_0x31a363)[_0x0586('0x3e')](_0x243c72,_0x24f9f6);}function emitOutboundVoiceQueueSummary(_0x2f2e56){if(_0x2f2e56[_0x0586('0x3f')]===_0x0586('0x40')){logger[_0x0586('0x41')]('[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:',util[_0x0586('0x42')](_0x2f2e56,{'showHidden':![],'depth':null}));emit(util['format'](_0x0586('0x43'),_0x2f2e56[_0x0586('0x44')]),_0x0586('0x45'),_0x2f2e56);}}function checkGetDataPredictive(_0x401d3d){if(isNotNull(_0x401d3d)&&!_['isEmpty'](_0x401d3d)){loggerPredictive[_0x0586('0x46')]('-----\x20Stats\x20Predictive\x20---');loggerPredictive[_0x0586('0x46')](_0x0586('0x47'),_0x401d3d[_0x0586('0x48')]);loggerPredictive[_0x0586('0x46')](_0x0586('0x49'),_0x401d3d[_0x0586('0x4a')]);loggerPredictive['info'](_0x0586('0x4b'),_0x401d3d['predictiveIntervalDroppedCallsTimeout']);loggerPredictive[_0x0586('0x46')](_0x0586('0x4c'),_0x401d3d[_0x0586('0x4d')]);loggerPredictive[_0x0586('0x46')](_0x0586('0x4e'),_0x401d3d[_0x0586('0x4f')]);loggerPredictive[_0x0586('0x46')](_0x0586('0x50'),_0x401d3d[_0x0586('0x51')]);loggerPredictive['info'](_0x0586('0x52'));if(_0x401d3d[_0x0586('0x48')]>0x0){if(!_[_0x0586('0x3d')](_0x401d3d[_0x0586('0x51')])&&_0x401d3d['predictiveIntervalAvgTalktime']>0x0){return!![];}loggerPredictive[_0x0586('0x46')](_0x0586('0x53'));if(!_['isUndefined'](_0x401d3d[_0x0586('0x4f')])&&_0x401d3d[_0x0586('0x4f')]>0x0){return!![];}loggerPredictive[_0x0586('0x46')](_0x0586('0x54'));}else{loggerPredictive['info'](_0x0586('0x55'));}}else{loggerPredictive[_0x0586('0x46')]('History\x20information\x20are\x20empty');}return![];}function mergeDataErlangB(_0x1e8cd9){return function(_0xfa1530){loggerPredictive[_0x0586('0x46')](_0x0586('0x56'));loggerPredictive[_0x0586('0x46')]('Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0xfa1530['erlangCalls']);loggerPredictive[_0x0586('0x46')]('One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0xfa1530[_0x0586('0x57')]);loggerPredictive[_0x0586('0x46')](_0x0586('0x58'),_0xfa1530['erlangAbandonmentRate']);loggerPredictive['info'](_0x0586('0x59'),_0xfa1530['erlangBusyFactor']);loggerPredictive[_0x0586('0x46')](_0x0586('0x58'),_0xfa1530[_0x0586('0x5a')]);loggerPredictive[_0x0586('0x46')](_0x0586('0x52'));_[_0x0586('0x5b')](_0x1e8cd9,_0xfa1530);};}function ifInterval(_0x3e54ab,_0x4ea737){if(_[_0x0586('0x3d')](_0x4ea737)){return![];}return utils[_0x0586('0x5c')](undefined,_0x4ea737)<_0x3e54ab*0x3c;}function clearPredictiveAttributes(_0x55e162){if(_0x55e162[_0x0586('0x26')]){_0x55e162['startProgressive']=undefined;loggerPredictive[_0x0586('0x41')](_0x55e162[_0x0586('0x44')],_0x0586('0x5d'));}if(_0x55e162[_0x0586('0x25')]){_0x55e162[_0x0586('0x25')]=undefined;loggerPredictive[_0x0586('0x41')](_0x55e162['name'],'startPredictive\x20value\x20cleared');}if(_0x55e162['handlePredictive']){clearInterval(_0x55e162[_0x0586('0x5e')]);_0x55e162['handlePredictive']=undefined;loggerPredictive[_0x0586('0x41')](_0x55e162[_0x0586('0x44')],_0x0586('0x5f'));}}function loggerCatchPredictive(_0x3eefee,_0x1a1a43){return function(_0x29f949){loggerPredictive[_0x0586('0x60')](_0x1a1a43[_0x0586('0x44')],_0x3eefee);loggerPredictive['error'](_0x29f949['stack']);clearPredictiveAttributes(_0x1a1a43);};}function loggerCatch(_0x1a1adc){return function(_0xb1ae04){logger[_0x0586('0x60')](_0x1a1adc,util[_0x0586('0x42')](_0xb1ae04,{'showHidden':![],'depth':null}));};}function loggerGetContactDialer(_0x4e434c,_0x34cb4a,_0x5a7d0a){return function(_0x5d278a){utils['checkContactLowerLimitOriginate'](_0x34cb4a,_0x5a7d0a,0x0);_0x34cb4a[_0x0586('0x61')]=0x0;logger[_0x0586('0x60')](_0x4e434c,util[_0x0586('0x42')](_0x5d278a,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x212793){return function(_0x22a519){if(isNotNull(_0x22a519)&&isNotNull(_0x22a519[0x0])){if(_0x22a519[0x0][_0x0586('0x62')]>0x0){_0x212793[_0x0586('0x63')]=utils[_0x0586('0x64')]['CONTACTS_RESCHEDULED'];logger[_0x0586('0x46')]('[getContactDialer2][ReScheduled]'+_0x212793['name'],_0x22a519[0x0]['contactsRescheduled'],_0x0586('0x65'));}else{_0x212793['message']=utils[_0x0586('0x64')][_0x0586('0x66')];logger[_0x0586('0x46')]('[getContactDialer2][Empty]'+_0x212793[_0x0586('0x44')]);}}};}function createObjHistory(_0x404cd0,_0x1387d8,_0x4d6da7,_0x3babf0,_0x2e75c8){_0x404cd0['message']=_0x4d6da7;var _0x1be82e=new Action(_0x404cd0,_0x1387d8);var _0x1eebfa=new History(_0x1be82e);_0x1eebfa[_0x0586('0x67')]=_0x3babf0;_0x1eebfa['statedesc']=_0x2e75c8;_0x1eebfa[_0x0586('0x68')]=_0x1be82e[_0x0586('0x69')];return _0x1eebfa;}function unlockQueueStatus(_0x53e8d3,_0x3eeb70){setTimeout(function(){if(_[_0x0586('0x3d')](_0x53e8d3['queueStatusComplete'])){loggerBooked[_0x0586('0x60')]('[unlockQueueStatus][undefined]',_0x3eeb70);}_0x53e8d3[_0x0586('0x6a')]=!![];loggerBooked[_0x0586('0x46')](_0x0586('0x6b'),_0x3eeb70,JSON[_0x0586('0x6c')](_[_0x0586('0x6d')](_0x53e8d3,[_0x0586('0x44'),_0x0586('0x6a')])));},0x1f3);}function checkInterval(_0x3e99ee){return function(){if(!isNotNull(_0x3e99ee[_0x0586('0x6e')])){_0x3e99ee['message']=utils[_0x0586('0x64')][_0x0586('0x6f')];throw _0x3e99ee[_0x0586('0x44')]+_0x0586('0x70');}if(!isNotNull(_0x3e99ee['Interval'][_0x0586('0x71')])){_0x3e99ee[_0x0586('0x63')]=utils['CAMPAIGN_STATUS'][_0x0586('0x6f')];throw _0x3e99ee[_0x0586('0x44')]+_0x0586('0x70');}if(!isNotNull(_['isEmpty'](_0x3e99ee[_0x0586('0x6e')][_0x0586('0x71')]))){_0x3e99ee[_0x0586('0x63')]=utils[_0x0586('0x64')][_0x0586('0x6f')];throw _0x3e99ee[_0x0586('0x44')]+_0x0586('0x70');}};}function checkIsIVRCampaignActive(_0x5d9673){return function(){if(!utils[_0x0586('0x72')](_0x5d9673)){_0x5d9673[_0x0586('0x63')]=utils[_0x0586('0x64')]['INACTIVE'];throw _0x5d9673['name']+_0x0586('0x73');}};}function emitCampaignSummary(_0x459bd9){if(utils[_0x0586('0x74')](_0x459bd9)){emit(util[_0x0586('0x75')](_0x0586('0x76'),_0x459bd9[_0x0586('0x44')]),'campaign:save',_0x459bd9);}}function loggerCatchQueueSummary(_0x5c43c0,_0x2db8c2){return function(_0x5901d5){clearPredictiveAttributes(_0x2db8c2);emitCampaignSummary(_0x2db8c2);loggerSyncQueueSummary[_0x0586('0x41')](_0x5c43c0,util[_0x0586('0x42')](_0x5901d5,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x2ca381){if(_0x2ca381['sendMessageOneNotActive']){if(_0x2ca381[_0x0586('0x77')]===0x0){_0x2ca381[_0x0586('0x78')]=![];_0x2ca381[_0x0586('0x63')]=utils[_0x0586('0x64')]['INACTIVE'];loggerSyncQueueSummary['debug'](_0x0586('0x79'),_0x2ca381['name'],_0x0586('0x7a'));}else{_0x2ca381[_0x0586('0x63')]=utils[_0x0586('0x64')][_0x0586('0x7b')];loggerSyncQueueSummary[_0x0586('0x41')](_0x0586('0x79'),_0x2ca381['name'],_0x0586('0x7c'));}emitCampaignSummary(_0x2ca381);}}function myreject(_0x14d5dc){return function(_0x20c6ee){return _0x14d5dc(msgResponse(_0x0586('0x7d'),_0x0586('0x7e'),JSON[_0x0586('0x6c')](_0x20c6ee)));};}Dialer[_0x0586('0x7f')][_0x0586('0x80')]=function(_0x3909bf){return!_[_0x0586('0x3d')](_0x3909bf)&&_0x3909bf&&!_[_0x0586('0x3d')](_0x3909bf[_0x0586('0x44')])&&!_[_0x0586('0x3d')](_0x3909bf['active'])&&_0x3909bf[_0x0586('0x81')]&&(this['trunks'][util[_0x0586('0x75')](_0x0586('0x82'),_0x3909bf['name'])][_0x0586('0x83')]===_0x0586('0x84')||this[_0x0586('0x1f')][util[_0x0586('0x75')](_0x0586('0x82'),_0x3909bf[_0x0586('0x44')])][_0x0586('0x83')]===_0x0586('0x85'));};Dialer['prototype'][_0x0586('0x86')]=function(_0x1db4f6){var _0x9171f0=this;return function(){if(!_0x9171f0[_0x0586('0x80')](_0x1db4f6[_0x0586('0x87')])){if(!_0x9171f0[_0x0586('0x80')](_0x1db4f6['TrunkBackup'])){_0x1db4f6[_0x0586('0x63')]=utils['CAMPAIGN_STATUS'][_0x0586('0x88')];throw _0x1db4f6['name']+_0x0586('0x89');}}};};Dialer[_0x0586('0x7f')][_0x0586('0x8a')]=function(_0x311a3d,_0x1ef4d1,_0x35c8bc,_0x25ea3f){var _0x3e004c=this;return function(){var _0x3b14d2=!![];return _0x3e004c[_0x0586('0x8b')](_0x311a3d,_0x1ef4d1,_0x35c8bc,_0x25ea3f,_0x3b14d2);};};Dialer[_0x0586('0x7f')][_0x0586('0x8c')]=function(_0x5de8f5,_0x3b6cb2,_0x510ee0,_0x4604e0){var _0x3806d7=this;return function(){var _0x596a50=![];return _0x3806d7[_0x0586('0x8b')](_0x5de8f5['Intervals'],_0x3b6cb2,_0x510ee0,_0x4604e0,_0x596a50);};};Dialer[_0x0586('0x7f')][_0x0586('0x8b')]=function(_0x24a0b9,_0x22a730,_0x48878c,_0x4dd828,_0x195862){var _0x336870=[];return new Promise(function(_0x1ea128,_0x3a5c6c){if(!isNotNull(_0x24a0b9)){_0x4dd828[_0x0586('0x63')]=utils[_0x0586('0x64')]['NULL_INTERVAL'];return _0x3a5c6c(msgResponse(_0x0586('0x8d'),_0x0586('0x8e'),_0x48878c+'\x20Intervals\x20is\x20null\x20'));}if(_[_0x0586('0x8f')](_0x24a0b9)){_0x4dd828[_0x0586('0x63')]=utils[_0x0586('0x64')][_0x0586('0x90')];return _0x3a5c6c(msgResponse('ifTime','Failure',_0x48878c+_0x0586('0x91')));}if(_0x22a730&&_['isUndefined'](config[_0x0586('0x92')][_0x22a730])){_0x4dd828[_0x0586('0x63')]=utils[_0x0586('0x64')][_0x0586('0x93')];return _0x3a5c6c(msgResponse(_0x0586('0x8d'),_0x0586('0x8e'),_0x48878c+_0x0586('0x94')+_0x22a730));}if(_[_0x0586('0x95')](_0x24a0b9)){for(var _0x379bf5=0x0;_0x379bf5<_0x24a0b9[_0x0586('0x96')];_0x379bf5+=0x1){_0x336870[_0x0586('0x97')](ami[_0x0586('0x98')]({'action':_0x0586('0x99'),'command':util[_0x0586('0x75')](_0x0586('0x9a'),_0x24a0b9[_0x379bf5][_0x0586('0x9b')],!_[_0x0586('0x3d')](config[_0x0586('0x92')][_0x22a730])?_0x22a730:'')})[_0x0586('0x9c')](function(_0x489cb5){return _0x489cb5[_0x0586('0x9d')][_0x0586('0x9e')](_0x0586('0x9f'))>=0x0;})[_0x0586('0xa0')](myreject(_0x3a5c6c)));}}else{_0x336870['push'](ami[_0x0586('0x98')]({'action':_0x0586('0x99'),'command':util['format'](_0x0586('0x9a'),_0x24a0b9,!_['isUndefined'](config['timezones'][_0x22a730])?_0x22a730:'')})['then'](function(_0x7622a9){return _0x7622a9[_0x0586('0x9d')]['indexOf']('true')>=0x0;})[_0x0586('0xa0')](myreject(_0x3a5c6c)));}Promise['all'](_0x336870)[_0x0586('0x9c')](function(_0xec960f){var _0x1a4edf=_[_0x0586('0xa1')](_0xec960f);if(_0x1a4edf){return _0x1ea128(_0x1a4edf);}else{_0x4dd828[_0x0586('0x63')]=_0x195862?utils['CAMPAIGN_STATUS'][_0x0586('0xa2')]:utils['CAMPAIGN_STATUS'][_0x0586('0xa3')];return _0x3a5c6c(msgResponse('[ifTime][promiseAll]',_0x0586('0x8e'),_0x0586('0xa4')+_0x195862+'\x20'+_0x48878c+_0x0586('0xa5')+util[_0x0586('0x42')](_0x24a0b9,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0x22a730));}})[_0x0586('0xa0')](function(_0x59ae35){return _0x3a5c6c(msgResponse('ifTime',_0x0586('0x8e'),JSON[_0x0586('0x6c')](_0x59ae35)));});});};Dialer['prototype'][_0x0586('0x3a')]=function(){var _0x40a22a=this;return cmHopper[_0x0586('0xa6')]({'active':![]},{'where':{'active':!![]}})[_0x0586('0x9c')](function(){setInterval(function(){_0x40a22a[_0x0586('0xa7')]();},0x3e8);});};Dialer[_0x0586('0x7f')][_0x0586('0xa7')]=function(){var _0x1a296e=this;var _0x498306;for(var _0x1d9755 in this[_0x0586('0x1e')]){if(typeof this[_0x0586('0x1e')][_0x1d9755]!==_0x0586('0xa8')){_0x498306=this[_0x0586('0x1e')][_0x1d9755];if(utils[_0x0586('0x74')](_0x498306)&&utils[_0x0586('0x72')](_0x498306)){_0x498306['sendMessageOneNotActive']=!![];Promise['resolve']()[_0x0586('0x9c')](checkIsIVRCampaignActive(_0x498306))[_0x0586('0x9c')](checkInterval(_0x498306))[_0x0586('0x9c')](_0x1a296e[_0x0586('0x86')](_0x498306))[_0x0586('0x9c')](_0x1a296e[_0x0586('0x8a')](_0x498306[_0x0586('0xa9')],_0x498306[_0x0586('0xaa')],_0x498306['name'],_0x498306))['then'](_0x1a296e['checkIfTimeIntervals'](_0x498306['Interval'],_0x498306[_0x0586('0xaa')],_0x498306[_0x0586('0x44')],_0x498306))['then'](_0x1a296e[_0x0586('0xab')](_0x498306))[_0x0586('0xa0')](loggerCatchQueueSummary(_0x0586('0xac'),_0x498306));}else{notSendMessagesCampaign(_0x498306);}}}};Dialer[_0x0586('0x7f')][_0x0586('0xad')]=function(_0x5d1909){if(_0x5d1909['dialMethod']!==_0x0586('0xb')){clearPredictiveAttributes(_0x5d1909);}switch(_0x5d1909['dialMethod']){case _0x0586('0xae'):this[_0x0586('0xaf')](_0x5d1909,0x1);break;case _0x0586('0xb0'):this['handlePower'](_0x5d1909,_0x5d1909[_0x0586('0xb1')]);break;case _0x0586('0xb'):this['predictive'](_0x5d1909);break;case _0x0586('0xa'):this['handlePower'](_0x5d1909,0x1);break;default:logger[_0x0586('0x60')](_0x0586('0xb2'),_0x5d1909['name'],'method\x20not\x20recognized');}};Dialer[_0x0586('0x7f')][_0x0586('0x8d')]=function(_0x4480a1,_0x2f8787){var _0x12a94b=_0x4480a1['dialTimezone'];var _0x523557=_0x2f8787?_0x4480a1[_0x0586('0xa9')]:_0x4480a1['Interval']['Intervals'];logger[_0x0586('0xb3')]('Dialer::ifTime()',_0x523557,_0x12a94b,_0x4480a1[_0x0586('0x44')],util[_0x0586('0x75')](_0x0586('0xb4'),_0x4480a1[_0x0586('0x44')],_0x4480a1['id']));var _0x320865=null;return Interval['intervalIftime'](_0x523557,_0x12a94b)[_0x0586('0x9c')](function(_0x3df00c){if(_0x3df00c===!![]){return _0x3df00c;}else{_0x4480a1[_0x0586('0x63')]=_0x2f8787?utils[_0x0586('0x64')][_0x0586('0xa2')]:utils['CAMPAIGN_STATUS']['OVERTIME_INTERVAL'];_0x320865=msgResponse(_0x0586('0xb5'),_0x0586('0x8e'),_0x0586('0xa4')+_0x2f8787+'\x20'+_0x4480a1[_0x0586('0x44')]+_0x0586('0xa5')+util['inspect'](_0x523557,{'showHidden':![],'depth':null})+_0x0586('0xb6')+_0x12a94b);}if(_0x320865!==null){logger[_0x0586('0xb3')]('Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:',_0x320865);_0x320865[_0x0586('0xb7')]=_0x2f8787;throw _0x320865;}})['catch'](function(_0x18d860){logger[_0x0586('0x60')](_0x0586('0xb8'),_0x18d860);throw msgResponse(_0x0586('0x7d'),_0x0586('0x7e'),util[_0x0586('0x42')](_0x18d860,{'showHidden':![],'depth':null}));});};Dialer[_0x0586('0x7f')]['syncAgentConnect']=function(_0x5f12e4){if(this[_0x0586('0x1d')][_0x5f12e4['queue']]){if(this[_0x0586('0x23')][_0x5f12e4[_0x0586('0xb9')]]&&this[_0x0586('0x23')][_0x5f12e4[_0x0586('0xb9')]][_0x0586('0x3f')]!==_0x0586('0xba')){this[_0x0586('0xbb')](this[_0x0586('0x1d')][_0x5f12e4['queue']]);this[_0x0586('0x23')][_0x5f12e4['uniqueid']][_0x0586('0xbc')]=moment()[_0x0586('0x75')](_0x0586('0xbd'));}}};Dialer['prototype']['syncAgentComplete']=function(_0x473d8a){var _0x4f24fe=this[_0x0586('0x23')][_0x473d8a[_0x0586('0xb9')]];if(this['voiceQueues'][_0x473d8a[_0x0586('0xbe')]]){if(_0x4f24fe&&_0x4f24fe['type']!=='ivr'){delete this['uniqueId'][_0x473d8a[_0x0586('0xb9')]];this[_0x0586('0x1d')][_0x473d8a[_0x0586('0xbe')]][_0x0586('0xbf')]+=0x1;var _0x1f7ce9=new AgentComplete(_0x4f24fe,_0x473d8a);if(_0x473d8a['reason']===_0x0586('0xc0')){_0x1f7ce9[_0x0586('0xc1')]=this[_0x0586('0x1d')][_0x473d8a[_0x0586('0xbe')]]['dialQueueProject2']&&this[_0x0586('0x1d')][_0x473d8a[_0x0586('0xbe')]][_0x0586('0xc2')]?moment()[_0x0586('0x75')](_0x0586('0xbd')):undefined;}hopperUtils['createHistory'](_0x1f7ce9)[_0x0586('0xa0')](loggerCatch(_0x0586('0xc3')));hopperUtils[_0x0586('0xc4')](_0x1f7ce9)[_0x0586('0xa0')](loggerCatch(_0x0586('0xc5')));}}};Dialer[_0x0586('0x7f')][_0x0586('0x2b')]=function(_0x333a56){var _0x180a6c=this['uniqueId'][_0x333a56[_0x0586('0xb9')]];var _0x22fde4=this;var _0x2d55c5=![];var _0x1c584e;var _0xa6f509;if(this[_0x0586('0x1d')][_0x333a56[_0x0586('0xbe')]]){if(_0x180a6c&&_0x180a6c['type']!==_0x0586('0xba')){delete this[_0x0586('0x23')][_0x333a56['uniqueid']];this[_0x0586('0xbb')](this[_0x0586('0x1d')][_0x333a56['queue']]);_0x180a6c[_0x0586('0xc6')]=moment()['format'](_0x0586('0xbd'));var _0x5685f6=new QueueCallerAbandon(_0x180a6c,_0x333a56);if(utils[_0x0586('0x5c')](_0x180a6c[_0x0586('0xc6')],_0x180a6c[_0x0586('0xc7')])>=_0x180a6c[_0x0586('0xc8')]){this[_0x0586('0x1d')][_0x333a56[_0x0586('0xbe')]][_0x0586('0xc9')]+=0x1;this['voiceQueues'][_0x333a56[_0x0586('0xbe')]][_0x0586('0xca')]+=0x1;this[_0x0586('0x1d')][_0x333a56[_0x0586('0xbe')]][_0x0586('0xcb')]+=0x1;_0x5685f6[_0x0586('0x67')]=0xa;_0x5685f6[_0x0586('0xcc')]=_0x0586('0xcd');_0x5685f6['dropreason']=_0x0586('0xce');_0x5685f6['agiafterat']=this['voiceQueues'][_0x333a56['queue']][_0x0586('0xcf')]?moment()[_0x0586('0x75')](_0x0586('0xbd')):undefined;_0x5685f6[_0x0586('0xd0')]+=0x1;_0x5685f6['countglobal']+=0x1;_0x1c584e=this[_0x0586('0x1d')][_0x333a56[_0x0586('0xbe')]][_0x0586('0xd1')];_0xa6f509=this[_0x0586('0x1d')][_0x333a56[_0x0586('0xbe')]][_0x0586('0xd2')];hopperUtils[_0x0586('0xd3')](_0x5685f6,_0x5685f6[_0x0586('0x67')],_0x180a6c['voiceQueue'])[_0x0586('0x9c')](function(_0x18be14){_0x2d55c5=_0x18be14[_0x0586('0xd4')]==0x1;if(_0x5685f6['countdropretry']>=_0x22fde4[_0x0586('0x1d')][_0x333a56[_0x0586('0xbe')]][_0x0586('0xd5')]){_0x22fde4['queueCallerAbandonCreateState'](_0x5685f6,_0x18be14[_0x0586('0xd4')]);}else{hopperUtils[_0x0586('0xd6')]({'active':![],'countdropretry':_0x5685f6[_0x0586('0xd0')],'scheduledat':moment()[_0x0586('0xd7')](_0x22fde4['voiceQueues'][_0x333a56[_0x0586('0xbe')]][_0x0586('0xd1')],'minutes')[_0x0586('0x75')](_0x0586('0xbd')),'ContactId':_0x180a6c['ContactId'],'ListId':_0x180a6c[_0x0586('0xd8')],'VoiceQueueId':_0x180a6c[_0x0586('0xd9')]||undefined,'CampaignId':_0x180a6c['CampaignId']||undefined})['catch'](loggerCatch(_0x0586('0xda')));var _0x2ae3e9=new History(_0x5685f6);_0x2ae3e9['state']=0xa;_0x2ae3e9['statedesc']=_0x0586('0xcd');_0x2ae3e9[_0x0586('0x69')]=moment()['format'](_0x0586('0xbd'));_0x2ae3e9[_0x0586('0x68')]=_0x2ae3e9[_0x0586('0x69')];_0x2ae3e9['calleridname']=_0x5685f6[_0x0586('0xdb')];_0x2ae3e9[_0x0586('0xdc')]=_0x5685f6[_0x0586('0xdc')];hopperUtils[_0x0586('0xdd')](_0x2ae3e9)[_0x0586('0xa0')](loggerCatch('[syncAgentComplete][createHistory][10]'));}})['then'](function(){if(_0x2d55c5)hopperUtils[_0x0586('0xde')](_0x5685f6,_0x1c584e,_0xa6f509)[_0x0586('0x9c')](function(){return 0x1;});});}else{this['voiceQueues'][_0x333a56['queue']][_0x0586('0x4d')]+=0x1;this[_0x0586('0x1d')][_0x333a56[_0x0586('0xbe')]]['outboundDropCallsDayCallersExit']+=0x1;_0x5685f6[_0x0586('0x67')]=0xb;_0x5685f6[_0x0586('0xcc')]=_0x0586('0xdf');_0x5685f6[_0x0586('0xe0')]=_0x0586('0xe1');_0x5685f6[_0x0586('0xe2')]+=0x1;_0x5685f6[_0x0586('0xe3')]+=0x1;_0x1c584e=this['voiceQueues'][_0x333a56[_0x0586('0xbe')]][_0x0586('0xe4')];_0xa6f509=this[_0x0586('0x1d')][_0x333a56[_0x0586('0xbe')]][_0x0586('0xd2')];hopperUtils[_0x0586('0xd3')](_0x5685f6,_0x5685f6[_0x0586('0x67')],_0x180a6c[_0x0586('0xe5')])[_0x0586('0x9c')](function(_0x333c0b){if(_0x5685f6[_0x0586('0xe2')]>=_0x22fde4[_0x0586('0x1d')][_0x333a56[_0x0586('0xbe')]][_0x0586('0xe6')]){_0x22fde4[_0x0586('0xe7')](_0x5685f6,_0x333c0b[_0x0586('0xd4')]);}else{hopperUtils[_0x0586('0xd6')]({'active':![],'countabandonedretry':_0x5685f6['countabandonedretry'],'scheduledat':moment()['add'](_0x22fde4[_0x0586('0x1d')][_0x333a56[_0x0586('0xbe')]][_0x0586('0xe4')],_0x0586('0xe8'))[_0x0586('0x75')](_0x0586('0xbd')),'ContactId':_0x180a6c[_0x0586('0xe9')],'ListId':_0x180a6c['ListId'],'VoiceQueueId':_0x180a6c[_0x0586('0xd9')]||undefined,'CampaignId':_0x180a6c[_0x0586('0xea')]||undefined})[_0x0586('0xa0')](loggerCatch(_0x0586('0xeb')));var _0x415f19=new History(_0x5685f6);_0x415f19[_0x0586('0x67')]=0xb;_0x415f19[_0x0586('0xcc')]=_0x0586('0xdf');_0x415f19[_0x0586('0x69')]=moment()[_0x0586('0x75')](_0x0586('0xbd'));_0x415f19[_0x0586('0x68')]=_0x415f19['starttime'];_0x415f19[_0x0586('0xdb')]=_0x5685f6[_0x0586('0xdb')];_0x415f19[_0x0586('0xdc')]=_0x5685f6[_0x0586('0xdc')];hopperUtils['createHistory'](_0x415f19)['catch'](loggerCatch('[syncAgentComplete][createHistory][11]'));}})[_0x0586('0x9c')](function(){if(_0x2d55c5)hopperUtils['swapAdditionalPhones'](_0x5685f6,_0x1c584e,_0xa6f509)[_0x0586('0x9c')](function(){return 0x1;});});}}}};Dialer[_0x0586('0x7f')][_0x0586('0x34')]=function(_0x348a56){if(this[_0x0586('0x21')][_0x348a56[_0x0586('0xb9')]]){this[_0x0586('0x21')][_0x348a56[_0x0586('0xb9')]]['channel']=_0x348a56[_0x0586('0xec')];}if(this[_0x0586('0x23')][_0x348a56['uniqueid']]){this[_0x0586('0x23')][_0x348a56[_0x0586('0xb9')]]['channel']=_0x348a56[_0x0586('0xec')];}};Dialer['prototype'][_0x0586('0x38')]=function(_0x2be8a7){if(!this['actions'][_0x2be8a7['actionid']]){return;}var _0x504af9=this['voiceQueues'][this[_0x0586('0x21')][_0x2be8a7[_0x0586('0xed')]][_0x0586('0xbe')]][_0x0586('0xee')]||_0x0586('0xef');if(_0x504af9===_0x0586('0xf0')){if(this['actions'][_0x2be8a7[_0x0586('0xed')]]&&_[_0x0586('0xf1')](this['actions'][_0x2be8a7[_0x0586('0xed')]][_0x0586('0xf2')])&&_0x2be8a7['status']==='1'&&_0x2be8a7[_0x0586('0xf3')]==='0'){if(this[_0x0586('0xf4')][_0x2be8a7[_0x0586('0xf5')]]){if(!this['agents'][_0x2be8a7[_0x0586('0xf5')]]['locked']){this[_0x0586('0xf4')][_0x2be8a7['stateinterface']][_0x0586('0xf2')]=!![];this[_0x0586('0x21')][_0x2be8a7[_0x0586('0xed')]][_0x0586('0xf2')]=!![];this[_0x0586('0x21')][_0x2be8a7[_0x0586('0xed')]]['stateinterface']=_0x2be8a7[_0x0586('0xf5')];}}}}else if(_0x504af9==='rrmemory'){if(this[_0x0586('0x21')][_0x2be8a7[_0x0586('0xed')]]){if(this[_0x0586('0xf4')][_0x2be8a7[_0x0586('0xf5')]]){this[_0x0586('0x21')][_0x2be8a7['actionid']][_0x0586('0xf5')]=_0x2be8a7[_0x0586('0xf5')];if(_['isNil'](this['queueBooked'][this['actions'][_0x2be8a7[_0x0586('0xed')]][_0x0586('0xbe')]])){this[_0x0586('0x27')][this[_0x0586('0x21')][_0x2be8a7[_0x0586('0xed')]][_0x0586('0xbe')]]=[];}this[_0x0586('0x27')][this['actions'][_0x2be8a7['actionid']][_0x0586('0xbe')]][_0x0586('0x97')](_['merge'](_[_0x0586('0x6d')](this['actions'][_0x2be8a7['actionid']],['idHopper',_0x0586('0xf5')]),{'status':_0x2be8a7['status'],'paused':_0x2be8a7['paused']}));}}}};Dialer[_0x0586('0x7f')][_0x0586('0xf6')]=function(_0x534855){if(!this['actions'][_0x534855[_0x0586('0xed')]]){return;}var _0x1e9026=this;var _0x4c20b5=this['voiceQueues'][this[_0x0586('0x21')][_0x534855['actionid']]['queue']];var _0x160036=_0x4c20b5[_0x0586('0xee')]||_0x0586('0xef');if(_0x160036==='roundrobin'){if(this[_0x0586('0x21')][_0x534855[_0x0586('0xed')]]&&this[_0x0586('0x21')][_0x534855[_0x0586('0xed')]][_0x0586('0xf5')]){this[_0x0586('0xf7')][_0x0586('0xf8')](this[_0x0586('0x21')][_0x534855[_0x0586('0xed')]][_0x0586('0xf9')],this[_0x0586('0x21')][_0x534855[_0x0586('0xed')]][_0x0586('0xf5')])[_0x0586('0xa0')](function(_0x266b48){logger['error'](_0x0586('0xfa'),util[_0x0586('0x42')](_0x266b48,{'showHidden':![],'depth':null}));})[_0x0586('0x1b')](function(){_0x1e9026[_0x0586('0xbb')](_0x1e9026['voiceQueues'][_0x1e9026[_0x0586('0x21')][_0x534855[_0x0586('0xed')]][_0x0586('0xbe')]]);_0x1e9026['agents'][_0x1e9026[_0x0586('0x21')][_0x534855[_0x0586('0xed')]][_0x0586('0xf5')]]['locked']=![];delete _0x1e9026[_0x0586('0x21')][_0x534855['actionid']];unlockQueueStatus(_0x4c20b5);});}else{this[_0x0586('0xbb')](this['voiceQueues'][this[_0x0586('0x21')][_0x534855[_0x0586('0xed')]][_0x0586('0xbe')]]);hopperUtils[_0x0586('0xd6')]({'active':![],'ContactId':this['actions'][_0x534855[_0x0586('0xed')]]['ContactId'],'ListId':this[_0x0586('0x21')][_0x534855[_0x0586('0xed')]]['ListId'],'VoiceQueueId':this[_0x0586('0x21')][_0x534855['actionid']][_0x0586('0xd9')]||undefined,'CampaignId':this[_0x0586('0x21')][_0x534855[_0x0586('0xed')]]['CampaignId']||undefined})[_0x0586('0xa0')](loggerCatch(_0x0586('0xfb')));delete this['actions'][_0x534855[_0x0586('0xed')]];unlockQueueStatus(_0x4c20b5);}}else if(_0x160036==='rrmemory'){var _0x26583d;if(this[_0x0586('0x21')][_0x534855[_0x0586('0xed')]]&&!_[_0x0586('0x8f')](this['queueBooked'][this['actions'][_0x534855[_0x0586('0xed')]][_0x0586('0xbe')]])){if(this['queueBookedRR'][_0x1e9026[_0x0586('0x21')][_0x534855[_0x0586('0xed')]][_0x0586('0xbe')]]){this['queueBookedRR'][_0x1e9026[_0x0586('0x21')][_0x534855[_0x0586('0xed')]]['queue']]=this['queueBookedRR'][this['actions'][_0x534855[_0x0586('0xed')]]['queue']]?this[_0x0586('0xfc')][this[_0x0586('0x21')][_0x534855[_0x0586('0xed')]][_0x0586('0xbe')]]:this[_0x0586('0x27')][this[_0x0586('0x21')][_0x534855[_0x0586('0xed')]][_0x0586('0xbe')]]?this[_0x0586('0x27')][this[_0x0586('0x21')][_0x534855[_0x0586('0xed')]][_0x0586('0xbe')]][_0x0586('0xfd')]||0x0:0x0;}this[_0x0586('0x27')][this[_0x0586('0x21')][_0x534855[_0x0586('0xed')]]['queue']]['_rr']=this[_0x0586('0xfc')][this[_0x0586('0x21')][_0x534855[_0x0586('0xed')]][_0x0586('0xbe')]];for(var _0x578c6e=0x0;_0x578c6e=_0x2d817d[_0x0586('0x121')]){_0x5ab1ff[_0x0586('0x122')](_0x366ca3,_0x18df6e,_0x49b520,_0x0586('0x123'));}else{if(_0x366ca3[_0x0586('0x119')]>=_0x2d817d[_0x0586('0x124')]){_0x5ab1ff[_0x0586('0x125')](_0x366ca3,_0x18df6e,_0x49b520,_0x0586('0x126'));}else{hopperUtils[_0x0586('0xd6')]({'active':![],'countmachineretry':_0x366ca3[_0x0586('0x119')],'scheduledat':moment()[_0x0586('0xd7')](_0x2d817d['dialMachineRetryFrequency'],_0x0586('0xe8'))[_0x0586('0x75')](_0x0586('0xbd')),'ContactId':_0x366ca3['ContactId'],'ListId':_0x366ca3[_0x0586('0xd8')],'VoiceQueueId':_0x366ca3[_0x0586('0xd9')]||undefined,'CampaignId':_0x366ca3[_0x0586('0xea')]||undefined})['catch'](loggerCatch('[rescheduleContact][Machine]'));_0x18df6e({'reschedule':0x1});}}});}if(_0xefff14[_0x0586('0x3f')]==='ivr'&&this[_0x0586('0x1e')][_0xefff14['queue']][_0x0586('0x127')]&&_0x2674db[_0x0586('0x10d')]===_0x0586('0x10e')){delete this['uniqueId'][_0x2674db[_0x0586('0xb9')]];this[_0x0586('0xbb')](this[_0x0586('0x1e')][_0xefff14[_0x0586('0xbe')]]);_0x328bbe=new Hangup(_0xefff14,_0x2674db);_0x328bbe['state']=0x12;_0x328bbe[_0x0586('0xcc')]=_0x0586('0x110');_0x328bbe['membername']=_0x0586('0x112');ami[_0x0586('0x3e')](_0x0586('0x113'),ut['buildObj'](_0x328bbe,_0x0586('0x114')));this[_0x0586('0x115')](_0x328bbe,'[syncHangupInAMDIvr][createHistory]',_0x0586('0x128'));}if(_0xefff14['type']===_0x0586('0xba')&&this[_0x0586('0x1e')][_0xefff14['queue']][_0x0586('0x127')]&&_0x2674db[_0x0586('0x10d')]===_0x0586('0x118')){return new Promise(function(_0x519759,_0x1082d6){delete _0x5ab1ff['uniqueId'][_0x2674db['uniqueid']];_0x5ab1ff[_0x0586('0xbb')](_0x5ab1ff[_0x0586('0x1e')][_0xefff14['queue']]);_0x5ab1ff[_0x0586('0x1e')][_0xefff14[_0x0586('0xbe')]][_0x0586('0xbf')]+=0x1;_0x5ab1ff[_0x0586('0x1e')][_0xefff14[_0x0586('0xbe')]]['outboundAnswerAgiCallsDay']+=0x1;var _0x3f0cab=_0x5ab1ff[_0x0586('0x1e')][_0xefff14[_0x0586('0xbe')]];var _0x100d25=new Hangup(_0xefff14,_0x2674db);_0x100d25[_0x0586('0x67')]=0x13;_0x100d25[_0x0586('0xcc')]=_0x0586('0x129');_0x100d25[_0x0586('0x111')]=_0x0586('0x112');_0x100d25[_0x0586('0x119')]+=0x1;_0x100d25[_0x0586('0xe3')]+=0x1;_0x100d25[_0x0586('0x114')]=!![];ami[_0x0586('0x3e')](_0x0586('0x113'),ut[_0x0586('0x11a')](_0x100d25,_0x0586('0x114')));hopperUtils[_0x0586('0xdd')](_0x100d25)[_0x0586('0xa0')](loggerCatch(_0x0586('0x11b')));if(_0x100d25['countbusyretry']+_0x100d25['countcongestionretry']+_0x100d25[_0x0586('0x11e')]+_0x100d25[_0x0586('0x11f')]+_0x100d25[_0x0586('0xd0')]+_0x100d25[_0x0586('0xe2')]+_0x100d25[_0x0586('0x119')]+_0x100d25[_0x0586('0x120')]>=_0x3f0cab[_0x0586('0x121')]){_0x5ab1ff[_0x0586('0x122')](_0x100d25,_0x519759,_0x1082d6,'reason19\x20machine....');}else{if(_0x100d25[_0x0586('0x119')]>=_0x3f0cab['dialMachineMaxRetry']){_0x5ab1ff[_0x0586('0x125')](_0x100d25,_0x519759,_0x1082d6,_0x0586('0x126'));}else{hopperUtils[_0x0586('0xd6')]({'active':![],'countmachineretry':_0x100d25[_0x0586('0x119')],'scheduledat':moment()[_0x0586('0xd7')](_0x3f0cab[_0x0586('0x12a')],'minutes')['format'](_0x0586('0xbd')),'ContactId':_0x100d25[_0x0586('0xe9')],'ListId':_0x100d25[_0x0586('0xd8')],'VoiceQueueId':_0x100d25[_0x0586('0xd9')]||undefined,'CampaignId':_0x100d25[_0x0586('0xea')]||undefined})[_0x0586('0xa0')](loggerCatch(_0x0586('0x12b')));_0x519759({'reschedule':0x1});}}});}}};Dialer[_0x0586('0x7f')]['syncHangup']=function(_0x11884f){var _0xa968f3=this[_0x0586('0x23')][_0x11884f[_0x0586('0xb9')]];var _0x1a0184;if(_0xa968f3&&_0xa968f3['type']===_0x0586('0xba')){delete this[_0x0586('0x23')][_0x11884f[_0x0586('0xb9')]];this[_0x0586('0xbb')](this['campaigns'][_0xa968f3[_0x0586('0xbe')]]);this['campaigns'][_0xa968f3[_0x0586('0xbe')]][_0x0586('0x12c')]+=0x1;_0x1a0184=new Hangup(_0xa968f3,_0x11884f);hopperUtils[_0x0586('0xdd')](_0x1a0184)[_0x0586('0xa0')](loggerCatch(_0x0586('0x12d')));hopperUtils[_0x0586('0xc4')](_0x1a0184)[_0x0586('0xa0')](loggerCatch(_0x0586('0x12e')));}if(_0xa968f3&&_0xa968f3[_0x0586('0x3f')]!==_0x0586('0xba')&&isNotNull(this[_0x0586('0x1d')][_0xa968f3['queue']]['dialQueueProject'])){delete this['uniqueId'][_0x11884f[_0x0586('0xb9')]];this[_0x0586('0xbb')](this[_0x0586('0x1d')][_0xa968f3[_0x0586('0xbe')]]);this[_0x0586('0x1d')][_0xa968f3[_0x0586('0xbe')]][_0x0586('0xbf')]+=0x1;this['voiceQueues'][_0xa968f3['queue']][_0x0586('0x10f')]+=0x1;_0x1a0184=new Hangup(_0xa968f3,_0x11884f);_0x1a0184['state']=0x10;_0x1a0184[_0x0586('0xcc')]='AnswerAGI';_0x1a0184[_0x0586('0x111')]=_0x0586('0x12f');hopperUtils['createHistory'](_0x1a0184)[_0x0586('0xa0')](loggerCatch(_0x0586('0x12d')));hopperUtils[_0x0586('0xc4')](_0x1a0184)[_0x0586('0xa0')](loggerCatch(_0x0586('0x12e')));}if(_0xa968f3&&_0xa968f3[_0x0586('0x3f')]!==_0x0586('0xba')&&!isNotNull(this[_0x0586('0x1d')][_0xa968f3[_0x0586('0xbe')]]['dialQueueProject'])){if(_0x11884f[_0x0586('0x130')]==='Normal\x20Clearing'){delete this[_0x0586('0x23')][_0x11884f['uniqueid']];this[_0x0586('0x1d')][_0xa968f3[_0x0586('0xbe')]]['outboundAnswerCallsDay']+=0x1;const _0x582071=new AgentComplete(_0xa968f3,_0x11884f);_0x582071[_0x0586('0xea')]=this[_0x0586('0x1d')][_0xa968f3[_0x0586('0xbe')]]['id'];hopperUtils['createHistory'](_0x582071)[_0x0586('0xa0')](loggerCatch(_0x0586('0xc3')));hopperUtils[_0x0586('0xc4')](_0x582071)['catch'](loggerCatch(_0x0586('0xc5')));}else{delete this['uniqueId'][_0x11884f[_0x0586('0xb9')]];this[_0x0586('0xbb')](this['voiceQueues'][_0xa968f3[_0x0586('0xbe')]]);this[_0x0586('0x1d')][_0xa968f3[_0x0586('0xbe')]][_0x0586('0x131')]+=0x1;_0x1a0184=new Hangup(_0xa968f3,_0x11884f);_0x1a0184[_0x0586('0x67')]=0xc;_0x1a0184[_0x0586('0xcc')]=_0x11884f[_0x0586('0x130')];_0x1a0184[_0x0586('0x111')]='Unknow';hopperUtils['createHistory'](_0x1a0184)[_0x0586('0xa0')](loggerCatch(_0x0586('0x12d')));hopperUtils[_0x0586('0xc4')](_0x1a0184)[_0x0586('0xa0')](loggerCatch('[syncHangupIvr]'));}}};Dialer['prototype'][_0x0586('0x2e')]=function(_0x280e2f){var _0x107fe3=this;if(!_0x107fe3[_0x0586('0x28')][_0x280e2f[_0x0586('0x44')]]){_0x107fe3['queuesSummary'][_0x280e2f['name']]={'running':![]};}else if(_0x107fe3[_0x0586('0x28')][_0x280e2f[_0x0586('0x44')]]['running']===!![]){return;}else if(_0x107fe3['queuesSummary'][_0x280e2f['name']][_0x0586('0x132')]===![]){_0x107fe3[_0x0586('0x28')][_0x280e2f[_0x0586('0x44')]][_0x0586('0x132')]=!![];}var _0x148f2a=_0x107fe3['voiceQueues'][_0x280e2f['name']];var _0x478d6b=_0x148f2a[_0x0586('0x63')]!==utils['CAMPAIGN_STATUS'][_0x0586('0x133')];var _0x33496e=utils['isPreviewCampaign'](_0x148f2a);_0x148f2a[_0x0586('0x134')]=utils[_0x0586('0x135')](_0x148f2a,_0x107fe3['trunks']);Promise[_0x0586('0x136')]()[_0x0586('0x9c')](function(){if(_0x148f2a['statusMessage']===utils[_0x0586('0x64')][_0x0586('0x133')]){if(_0x478d6b){clearPredictiveAttributes(_0x148f2a);_0x280e2f['startPredictive']=undefined;_0x280e2f['startProgressive']=undefined;}if(_0x148f2a[_0x0586('0x134')]===utils['CAMPAIGN_STATUS'][_0x0586('0x133')]){_0x280e2f[_0x0586('0x137')]=0x0;_0x280e2f[_0x0586('0xf3')]=0x0;_0x280e2f['inUse']=0x0;_0x280e2f[_0x0586('0x138')]=0x0;_0x280e2f[_0x0586('0x139')]=0x0;}}else if(_0x148f2a[_0x0586('0x134')]===utils[_0x0586('0x64')][_0x0586('0x13a')]&&!_0x33496e){return _0x107fe3[_0x0586('0x8d')](_0x148f2a,!![])[_0x0586('0x9c')](function(){return _0x107fe3[_0x0586('0x8d')](_0x148f2a,![]);})['then'](function(){return _0x107fe3['checkDialMethod'](_0x148f2a);})[_0x0586('0xa0')](function(_0x12fed1){loggerSyncQueueSummary[_0x0586('0x41')]('[syncQueueSummary]',util[_0x0586('0x42')](_0x12fed1,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x148f2a);});}else{clearPredictiveAttributes(_0x148f2a);}})[_0x0586('0x9c')](function(){var _0x3746c6=_0x280e2f[_0x0586('0x13b')](_0x148f2a);if(_0x3746c6||_0x148f2a[_0x0586('0x13c')]){_0x148f2a[_0x0586('0x13c')]=![];_0x280e2f[_0x0586('0x13d')](_0x148f2a);Object[_0x0586('0x13e')](_0x148f2a,_0x280e2f);emitOutboundVoiceQueueSummary(_0x280e2f);}_0x107fe3[_0x0586('0x28')][_0x148f2a[_0x0586('0x44')]]['running']=![];})[_0x0586('0xa0')](function(_0x541143){logger[_0x0586('0x60')]('[syncQueueSummary]',util[_0x0586('0x42')](_0x541143,{'showHidden':![],'depth':null}));_0x107fe3[_0x0586('0x28')][_0x148f2a[_0x0586('0x44')]][_0x0586('0x132')]=![];});};Dialer['prototype'][_0x0586('0x30')]=_['throttle'](function(){var _0x34ec74=_[_0x0586('0x13f')](this[_0x0586('0x1d')],function(_0x242a28){return _0x242a28[_0x0586('0x140')];});var _0x3e7405=_['filter'](this[_0x0586('0xf4')],function(_0x4910a4){return _0x4910a4[_0x0586('0x141')]&&_0x4910a4[_0x0586('0x83')]===_0x0586('0x84');});if(_0x34ec74['length']>0x0&&_0x3e7405[_0x0586('0x96')]>0x0){return Promise[_0x0586('0x136')]()['then'](cmHopper[_0x0586('0x142')](_[_0x0586('0x143')](_0x34ec74,'id'),previewRecallmeReminderInterval,_[_0x0586('0x143')](_0x3e7405,'id')))['then'](function(_0x3471de){for(var _0x3b84ab=0x0;_0x3b84ab<_0x3471de[_0x0586('0x96')];_0x3b84ab++){var _0x47e8cb=_0x3471de[_0x3b84ab][_0x0586('0x144')][_0x0586('0x44')];if(_0x47e8cb)io['to'](util['format'](_0x0586('0x145'),_0x47e8cb))[_0x0586('0x3e')](_0x0586('0x146'),{'hopper':_0x3471de[_0x3b84ab]});}})['catch'](function(_0x18073d){logger[_0x0586('0x60')](_0x0586('0x147'),_0x18073d);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0x0586('0x7f')][_0x0586('0x148')]=function(){var _0x119f6e=this;setInterval(function(){_0x119f6e[_0x0586('0x149')](_0x119f6e[_0x0586('0x23')],_0x0586('0x14a'));_0x119f6e[_0x0586('0x149')](_0x119f6e[_0x0586('0x21')],_0x0586('0x14b'));},0x32c8);};Dialer['prototype'][_0x0586('0x149')]=function(_0x46edc4,_0x469be1){var _0xb40ab1=this;for(var _0x177467 in _0x46edc4){if(typeof _0x46edc4[_0x177467]!==_0x0586('0xa8')){this['sequence'][_0x0586('0x14c')](function(){if(!_[_0x0586('0xf1')](_0x46edc4[_0x177467])){return ami[_0x0586('0x98')]({'action':_0x0586('0x83'),'channel':_0x46edc4[_0x177467][_0x0586('0xec')]})[_0x0586('0xa0')](function(_0x3c3e96){if(_0x3c3e96[_0x0586('0x63')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x46edc4[_0x177467]&&_0x46edc4[_0x177467][_0x0586('0x3f')]!=='ivr'){_0xb40ab1['updateOriginated'](_0xb40ab1[_0x0586('0x1d')][_0x46edc4[_0x177467]['queue']]);logger[_0x0586('0x60')](_0x0586('0x14d'),_0x469be1,_0x177467,_0x46edc4[_0x177467][_0x0586('0xbe')]);delete _0x46edc4[_0x177467];}if(_0x46edc4[_0x177467]&&_0x46edc4[_0x177467][_0x0586('0x3f')]===_0x0586('0xba')){_0xb40ab1[_0x0586('0xbb')](_0xb40ab1['campaigns'][_0x46edc4[_0x177467][_0x0586('0xbe')]]);logger[_0x0586('0x60')](_0x0586('0x14e'),_0x469be1,_0x177467,_0x46edc4[_0x177467]['queue']);delete _0x46edc4[_0x177467];}},0x2328);}});}});}}};Dialer[_0x0586('0x7f')][_0x0586('0x14f')]=function(_0x2c0e49){return Promise[_0x0586('0x136')]()[_0x0586('0x9c')](voiceQueueRt[_0x0586('0x14f')](_0x2c0e49))['catch'](loggerCatch(_0x0586('0x150')));};Dialer[_0x0586('0x7f')][_0x0586('0xbb')]=function(_0x413c1e){if(!_[_0x0586('0x3d')](_0x413c1e)&&_0x413c1e!==null){if(typeof _0x413c1e[_0x0586('0x77')]!==_0x0586('0xa8')){if(_0x413c1e[_0x0586('0x77')]>0x0){_0x413c1e[_0x0586('0x77')]-=0x1;}else{logger['error'](_0x0586('0x151'));}}}else{logger[_0x0586('0x60')]('[updateOriginated]\x20is\x20null\x20or\x20undefined');}};Dialer[_0x0586('0x7f')][_0x0586('0x152')]=function(_0x5a07ad,_0x1cd084){var _0x3048a8=this;return function(_0xd3807){_0x3048a8[_0x0586('0xbb')](_0x1cd084);logger[_0x0586('0x60')](_0x5a07ad,util[_0x0586('0x42')](_0xd3807,{'showHidden':![],'depth':null}));};};Dialer[_0x0586('0x7f')][_0x0586('0x153')]=function(_0x303b70,_0x5c517c,_0x529e18){var _0x199d08={'state':0x19,'statedesc':_0x0586('0x154')};this['updateOriginated'](_0x5c517c);this[_0x0586('0x115')](_['merge'](_0x199d08,_['pick'](_0x529e18,[_0x0586('0xe9'),_0x0586('0xd8'),'UserId',_0x0586('0xd9'),_0x0586('0xea')])),_0x0586('0x155'),_0x0586('0x156'));logger[_0x0586('0x60')](_0x303b70);};Dialer[_0x0586('0x7f')][_0x0586('0x115')]=function(_0xd0ee75,_0x20d6bd,_0x17808a){hopperUtils[_0x0586('0xdd')](_0xd0ee75)[_0x0586('0xa0')](loggerCatch(_0x20d6bd));hopperUtils['moveContactManagedDialer'](_0xd0ee75)['catch'](loggerCatch(_0x17808a));};Dialer[_0x0586('0x7f')][_0x0586('0xe7')]=function(_0x3424f6,_0x2131d4){hopperUtils['createHistory'](_0x3424f6)[_0x0586('0xa0')](loggerCatch('[syncAgentComplete][createHistory]'));if(_0x2131d4==0x0){hopperUtils[_0x0586('0xc4')](_0x3424f6)[_0x0586('0xa0')](loggerCatch(_0x0586('0x157')));}};Dialer['prototype'][_0x0586('0x147')]=function(_0x1e032c){return Promise['resolve']()[_0x0586('0x9c')](cmHopper[_0x0586('0x142')](_0x1e032c['id'],previewRecallmeReminderInterval))[_0x0586('0x9c')](function(_0x16af0a){for(var _0x4f53ae=0x0;_0x4f53ae<_0x16af0a[_0x0586('0x96')];_0x4f53ae++){var _0x445230=_0x16af0a[_0x4f53ae][_0x0586('0x144')][_0x0586('0x44')];if(_0x445230)io['to'](util[_0x0586('0x75')](_0x0586('0x145'),_0x445230))[_0x0586('0x3e')](_0x0586('0x146'),{'hopper':_0x16af0a[_0x4f53ae]});}})[_0x0586('0xa0')](function(){});};Dialer['prototype']['launchHandleIvr']=function(_0x242478){var _0x9479c9=this;return function(){_0x9479c9['handleIvr'](_0x242478);};};Dialer[_0x0586('0x7f')][_0x0586('0x158')]=function(_0x2ed722,_0x497e93){var _0x3170c1=this;var _0x480d5d=uuid['v4']();this[_0x0586('0x21')][_0x480d5d]=new Action(_0x2ed722,_0x497e93,_0x480d5d);return new Promise(function(_0xdaedf0,_0x1fdea7){if(_[_0x0586('0x3d')](_0x2ed722)&&typeof _0x2ed722!=='object'){return _0x1fdea7(msgResponse(_0x0586('0x159'),'Failure','voiceQueue\x20is\x20undefine'));}if(_[_0x0586('0x3d')](_0x497e93[_0x0586('0x15a')])||_0x497e93[_0x0586('0x15a')]===null){return _0x1fdea7(msgResponse('originate',_0x0586('0x8e'),_0x0586('0x15b')));}var _0x3667c6={'XMD-CALLERID':_0x3170c1[_0x0586('0x21')][_0x480d5d]['getCaller'](),'XMD-AGI':_0x2ed722['dialQueueProject']?util[_0x0586('0x75')](_0x0586('0x15c'),ipAgi,_0x2ed722['dialQueueProject']):_0x0586('0x15d'),'XMD-AGIAFTER':_0x2ed722[_0x0586('0xcf')]?util[_0x0586('0x75')](_0x0586('0x15c'),ipAgi,_0x2ed722['dialQueueProject2']):_0x0586('0x15d'),'XMD-QUEUE':utils['isOutboundQueue'](_0x2ed722)?util[_0x0586('0x75')](_0x0586('0x15e'),_0x2ed722['name'],_0x2ed722['dialQueueOptions']||'',_0x2ed722['dialAgiAfterHangupAgent']?'c':'',_0x2ed722[_0x0586('0xc8')]||0x3):_0x0586('0x15d'),'XMD-CONTACTID':_0x497e93[_0x0586('0xe9')],'XMD-CDRTYPE':_0x0586('0x9'),'CALLERID(all)':_0x3170c1[_0x0586('0x21')][_0x480d5d][_0x0586('0x15f')](),'XMD-AMD':_0x2ed722['dialAMDActive']?_0x0586('0x13a'):_0x0586('0x15d'),'XMD-DESTINATION':_0x0586('0x10c')};if(_0x2ed722[_0x0586('0x127')]){_0x3667c6['XMD-AMDINITIALSILENCE']=_0x2ed722[_0x0586('0x160')]||0x9c4;_0x3667c6[_0x0586('0x161')]=_0x2ed722[_0x0586('0x162')]||0x5dc;_0x3667c6['XMD-AMDAFTERGREETINGSILENCE']=_0x2ed722['dialAMDAfterGreetingSilence']||0x320;_0x3667c6[_0x0586('0x163')]=_0x2ed722[_0x0586('0x164')]||0x1388;_0x3667c6[_0x0586('0x165')]=_0x2ed722[_0x0586('0x166')]||0x64;_0x3667c6['XMD-AMDBETWEENWORDSSILENCE']=_0x2ed722['dialAMDBetweenWordsSilence']||0x32;_0x3667c6[_0x0586('0x167')]=_0x2ed722[_0x0586('0x168')]||0x3;_0x3667c6[_0x0586('0x169')]=_0x2ed722[_0x0586('0x16a')]||0x100;_0x3667c6[_0x0586('0x16b')]=_0x2ed722[_0x0586('0x16c')]||0x1388;}if(utils[_0x0586('0x16d')](_0x2ed722)){_0x3667c6[_0x0586('0x16e')]=_0x497e93[_0x0586('0xd9')];}else{_0x3667c6[_0x0586('0x16f')]=_0x497e93[_0x0586('0xea')];}var _0x15835e=utils[_0x0586('0x170')](_0x497e93[_0x0586('0x171')]);Object['assign'](_0x3667c6,_0x15835e);var _0x4f94ee=_0x3170c1[_0x0586('0x80')](_0x2ed722[_0x0586('0x87')])?utils[_0x0586('0x172')](_0x2ed722[_0x0586('0x87')]['callerid'],_0x2ed722[_0x0586('0x173')],_0x2ed722['dialRandomLastDigitCallerIdNumber']>0x0?utils['getCallerIdRandom'](_0x2ed722['dialOriginateCallerIdNumber'],_0x2ed722[_0x0586('0x174')]):_0x2ed722[_0x0586('0x175')]):utils[_0x0586('0x172')](_[_0x0586('0xf1')](_0x2ed722[_0x0586('0x176')])?_0x2ed722['Trunk']['callerid']:_0x2ed722['TrunkBackup'][_0x0586('0x177')],_0x2ed722['dialOriginateCallerIdName'],_0x2ed722[_0x0586('0x174')]>0x0?utils[_0x0586('0x178')](_0x2ed722[_0x0586('0x175')],_0x2ed722[_0x0586('0x174')]):_0x2ed722[_0x0586('0x175')]);if(_0x4f94ee){_0x3667c6[_0x0586('0x179')]=_0x3170c1[_0x0586('0x21')][_0x480d5d][_0x0586('0x17a')]=utils[_0x0586('0x17b')](_0x4f94ee);_0x3667c6[_0x0586('0x17c')]=_0x497e93[_0x0586('0x15a')];}_0x2ed722[_0x0586('0x17d')]=_0x3667c6;return ami['Action']({'actionid':_0x480d5d,'action':_0x0586('0x159'),'channel':_0x3170c1[_0x0586('0x80')](_0x2ed722[_0x0586('0x87')])?util[_0x0586('0x75')](_0x0586('0x17e'),_0x2ed722['Trunk']['name'],isNotNull(_0x2ed722[_0x0586('0x17f')])?_0x2ed722[_0x0586('0x17f')][_0x0586('0x180')]()||'':'',_0x2ed722['dialCutDigit']>0x0?_0x497e93['phone'][_0x0586('0x181')](_0x2ed722[_0x0586('0x182')]):_0x497e93['phone']):util[_0x0586('0x75')](_0x0586('0x17e'),_[_0x0586('0xf1')](_0x2ed722[_0x0586('0x176')])?_0x2ed722[_0x0586('0x87')]['name']:_0x2ed722[_0x0586('0x176')][_0x0586('0x44')],isNotNull(_0x2ed722[_0x0586('0x17f')])?_0x2ed722['dialPrefix'][_0x0586('0x180')]()||'':'',_0x2ed722[_0x0586('0x182')]>0x0?_0x497e93[_0x0586('0x15a')][_0x0586('0x181')](_0x2ed722[_0x0586('0x182')]):_0x497e93[_0x0586('0x15a')]),'callerid':_0x4f94ee,'Exten':_0x0586('0x10c'),'Context':_0x0586('0x183'),'Priority':'1','variable':_0x3667c6,'timeout':(_0x2ed722[_0x0586('0x184')]||0x1e)*0x3e8,'async':!![],'channelid':_0x480d5d})[_0x0586('0x9c')](function(_0x41b725){return _0xdaedf0(_0x41b725);})['catch'](function(_0x1c89d8){_0x2ed722[_0x0586('0x185')]+=0x1;var _0x50bd67=new History(_0x3170c1[_0x0586('0x21')][_0x480d5d]);logger['error'](util[_0x0586('0x75')]('[originateError]:\x20%s',JSON['stringify'](_0x1c89d8)));_0x50bd67[_0x0586('0x67')]=0xe;_0x50bd67[_0x0586('0xcc')]=_0x0586('0x186');_0x50bd67[_0x0586('0x69')]=moment()[_0x0586('0x75')](_0x0586('0xbd'));_0x50bd67[_0x0586('0x68')]=_0x50bd67[_0x0586('0x69')];hopperUtils[_0x0586('0xdd')](_0x50bd67)['catch'](loggerCatch(_0x0586('0x187')));_0x3170c1[_0x0586('0xc4')](_0x50bd67)['catch'](loggerCatch(_0x0586('0x187')))[_0x0586('0x1b')](function(){delete _0x3170c1[_0x0586('0x21')][_0x480d5d];return _0x1fdea7(msgResponse(_0x0586('0x159'),'Error',_0x0586('0x188')));});});});};Dialer[_0x0586('0x7f')][_0x0586('0x189')]=function(_0x33a31d,_0x452fa2,_0x562a72){var _0x48166a=new History(_0x452fa2);if(_0x48166a['countbusyretry']+_0x48166a[_0x0586('0x11d')]+_0x48166a['countnoanswerretry']+_0x48166a[_0x0586('0x11f')]+_0x48166a[_0x0586('0xd0')]+_0x48166a['countabandonedretry']+_0x48166a[_0x0586('0x119')]+_0x48166a['countagentrejectretry']>=_0x562a72[_0x0586('0x121')]-0x1){return!![];}switch(_0x33a31d){case 0x3:if(_0x48166a[_0x0586('0x11e')]>=_0x562a72[_0x0586('0x18a')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countnoanswerretry':_0x48166a[_0x0586('0x11e')]+=0x1,'scheduledat':moment()[_0x0586('0xd7')](_0x562a72[_0x0586('0x18b')],_0x0586('0xe8'))[_0x0586('0x75')](_0x0586('0xbd')),'ContactId':_0x48166a[_0x0586('0xe9')],'ListId':_0x48166a[_0x0586('0xd8')],'VoiceQueueId':_0x48166a[_0x0586('0xd9')]||undefined,'CampaignId':_0x48166a[_0x0586('0xea')]||undefined})[_0x0586('0xa0')](loggerCatch(_0x0586('0x18c')));break;case 0x5:if(_0x48166a[_0x0586('0x11c')]>=_0x562a72['dialBusyMaxRetry']-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countbusyretry':_0x48166a[_0x0586('0x11c')]+=0x1,'scheduledat':moment()['add'](_0x562a72[_0x0586('0x18d')],_0x0586('0xe8'))[_0x0586('0x75')](_0x0586('0xbd')),'ContactId':_0x48166a['ContactId'],'ListId':_0x48166a[_0x0586('0xd8')],'VoiceQueueId':_0x48166a[_0x0586('0xd9')]||undefined,'CampaignId':_0x48166a[_0x0586('0xea')]||undefined})[_0x0586('0xa0')](loggerCatch('[rescheduleContact]\x20[Busy]'));break;case 0x8:if(_0x48166a[_0x0586('0x11d')]>=_0x562a72[_0x0586('0x18e')]-0x1){return!![];}hopperUtils[_0x0586('0xd6')]({'active':![],'countcongestionretry':_0x48166a[_0x0586('0x11d')]+=0x1,'scheduledat':moment()[_0x0586('0xd7')](_0x562a72[_0x0586('0x18f')],_0x0586('0xe8'))['format'](_0x0586('0xbd')),'ContactId':_0x48166a[_0x0586('0xe9')],'ListId':_0x48166a['ListId'],'VoiceQueueId':_0x48166a['VoiceQueueId']||undefined,'CampaignId':_0x48166a[_0x0586('0xea')]||undefined})[_0x0586('0xa0')](loggerCatch(_0x0586('0x190')));break;case 0x0:if(_0x48166a['countnosuchnumberretry']>=_0x562a72[_0x0586('0x191')]-0x1){return!![];}else{hopperUtils['rescheduleContact']({'active':![],'countnosuchnumberretry':_0x48166a['countnosuchnumberretry']+=0x1,'scheduledat':moment()['add'](_0x562a72['dialNoSuchNumberRetryFrequency'],'minutes')[_0x0586('0x75')](_0x0586('0xbd')),'ContactId':_0x48166a[_0x0586('0xe9')],'ListId':_0x48166a[_0x0586('0xd8')],'VoiceQueueId':_0x48166a[_0x0586('0xd9')]||undefined,'CampaignId':_0x48166a['CampaignId']||undefined})[_0x0586('0xa0')](loggerCatch(_0x0586('0x192')));}break;case 0xa:if(_0x48166a[_0x0586('0xd0')]>=_0x562a72[_0x0586('0xd5')]-0x1){return!![];}hopperUtils[_0x0586('0xd6')]({'active':![],'countdropretry':_0x48166a['countdropretry']+=0x1,'scheduledat':moment()[_0x0586('0xd7')](_0x562a72[_0x0586('0xd1')],_0x0586('0xe8'))['format'](_0x0586('0xbd')),'ContactId':_0x48166a[_0x0586('0xe9')],'ListId':_0x48166a[_0x0586('0xd8')],'VoiceQueueId':_0x48166a[_0x0586('0xd9')]||undefined,'CampaignId':_0x48166a[_0x0586('0xea')]||undefined})[_0x0586('0xa0')](loggerCatch('[rescheduleContact][Drop]'));break;case 0xb:if(_0x48166a[_0x0586('0xe2')]>=_0x562a72[_0x0586('0xe6')]-0x1){return!![];}hopperUtils[_0x0586('0xd6')]({'active':![],'countabandonedretry':_0x48166a['countabandonedretry']+=0x1,'scheduledat':moment()[_0x0586('0xd7')](_0x562a72[_0x0586('0xe4')],_0x0586('0xe8'))[_0x0586('0x75')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x48166a[_0x0586('0xe9')],'ListId':_0x48166a[_0x0586('0xd8')],'VoiceQueueId':_0x48166a[_0x0586('0xd9')]||undefined,'CampaignId':_0x48166a[_0x0586('0xea')]||undefined})['catch'](loggerCatch(_0x0586('0xeb')));break;case 0x13:if(_0x48166a[_0x0586('0x119')]>=_0x562a72[_0x0586('0x124')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countmachineretry':_0x48166a[_0x0586('0x119')]+=0x1,'scheduledat':moment()['add'](_0x562a72[_0x0586('0x12a')],_0x0586('0xe8'))[_0x0586('0x75')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x48166a[_0x0586('0xe9')],'ListId':_0x48166a[_0x0586('0xd8')],'VoiceQueueId':_0x48166a[_0x0586('0xd9')]||undefined,'CampaignId':_0x48166a['CampaignId']||undefined})[_0x0586('0xa0')](loggerCatch(_0x0586('0x12b')));break;case 0x14:if(_0x48166a['countagentrejectretry']>=_0x562a72[_0x0586('0x193')]-0x1){return!![];}hopperUtils[_0x0586('0xd6')]({'active':![],'countagentrejectretry':_0x48166a['countagentrejectretry']+=0x1,'scheduledat':moment()['add'](_0x562a72[_0x0586('0x194')],_0x0586('0xe8'))[_0x0586('0x75')](_0x0586('0xbd')),'ContactId':_0x48166a[_0x0586('0xe9')],'ListId':_0x48166a['ListId'],'VoiceQueueId':_0x48166a[_0x0586('0xd9')]||undefined,'CampaignId':_0x48166a[_0x0586('0xea')]||undefined})[_0x0586('0xa0')](loggerCatch(_0x0586('0x195')));break;default:return!![];}};Dialer['prototype'][_0x0586('0x108')]=function(_0x3309d2,_0x24c623,_0x113919){var _0x58def9=this;var _0x5d5723=new History(_0x3309d2);var _0x43820f=![];var _0x442242;var _0x3068f7;return new Promise(function(_0x5264a2,_0x1714bb){if(_['isUndefined'](_0x24c623)&&typeof _0x24c623!==_0x0586('0x196')){return _0x1714bb(msgResponse(_0x0586('0x197'),_0x0586('0x8e'),'entity\x20is\x20undefine'));}if(_[_0x0586('0x3d')](_0x113919)&&typeof _0x113919!==_0x0586('0x196')){return _0x1714bb(msgResponse(_0x0586('0x197'),_0x0586('0x8e'),'evt\x20is\x20undefine'));}hopperUtils[_0x0586('0xd3')](_0x5d5723,_0x113919[_0x0586('0x198')],_0x24c623)[_0x0586('0x9c')](function(_0x5e8f83){if(_0x5e8f83['additional']==0x1)_0x43820f=!![];switch(_0x113919[_0x0586('0x198')]){case'0':_0x24c623[_0x0586('0x199')]+=0x1;_0x5d5723[_0x0586('0x67')]=0x0;_0x5d5723[_0x0586('0xcc')]='NoSuchNumber';_0x5d5723['countnosuchnumberretry']+=0x1;_0x5d5723[_0x0586('0xe3')]+=0x1;ami['emit'](_0x0586('0x19a'),ut[_0x0586('0x11a')](_0x3309d2,_0x0586('0x19b')));_0x442242=_0x24c623[_0x0586('0x19c')];_0x3068f7=_0x24c623[_0x0586('0xd2')];hopperUtils[_0x0586('0xdd')](_0x5d5723)[_0x0586('0xa0')](loggerCatch(_0x0586('0x11b')));if(_0x58def9[_0x0586('0x189')](0x0,_0x3309d2,_0x24c623)&&!_0x43820f){if(_0x5d5723[_0x0586('0x11f')]>=_0x24c623[_0x0586('0x191')]){_0x58def9[_0x0586('0x125')](_0x5d5723,_0x5264a2,_0x1714bb,_0x0586('0x19d'));}else{_0x58def9[_0x0586('0x122')](_0x5d5723,_0x5264a2,_0x1714bb,'reason\x200\x20no\x20such\x20number....');}}break;case'3':_0x24c623[_0x0586('0x19e')]+=0x1;_0x5d5723['state']=0x3;_0x5d5723[_0x0586('0xcc')]='NoAnswer';_0x5d5723[_0x0586('0x11e')]+=0x1;_0x5d5723[_0x0586('0xe3')]+=0x1;var _0x3d7f2a=ut[_0x0586('0x19f')](_0x3309d2,_0x24c623);ami[_0x0586('0x3e')](_0x0586('0x1a0'),_0x3d7f2a);_0x442242=_0x24c623[_0x0586('0x18b')];_0x3068f7=_0x24c623[_0x0586('0xd2')];hopperUtils[_0x0586('0xdd')](_0x5d5723)[_0x0586('0xa0')](loggerCatch('[syncAgentComplete][createHistory][3]'));if(_0x58def9[_0x0586('0x189')](0x3,_0x3309d2,_0x24c623)&&!_0x43820f){if(_0x5d5723[_0x0586('0x11e')]>=_0x24c623[_0x0586('0x18a')]){_0x58def9[_0x0586('0x125')](_0x5d5723,_0x5264a2,_0x1714bb,'reason\x203\x20ringing\x20no\x20answer');}else{_0x58def9[_0x0586('0x122')](_0x5d5723,_0x5264a2,_0x1714bb,_0x0586('0x1a1'));}}break;case'5':_0x24c623['outboundBusyCallsDay']+=0x1;_0x5d5723[_0x0586('0x67')]=0x5;_0x5d5723[_0x0586('0xcc')]=_0x0586('0x1a2');_0x5d5723[_0x0586('0x11c')]+=0x1;_0x5d5723[_0x0586('0xe3')]+=0x1;ami[_0x0586('0x3e')](_0x0586('0x1a3'),ut[_0x0586('0x11a')](_0x3309d2,_0x0586('0x1a4')));_0x442242=_0x24c623[_0x0586('0x18d')];_0x3068f7=_0x24c623[_0x0586('0xd2')];hopperUtils[_0x0586('0xdd')](_0x5d5723)[_0x0586('0xa0')](loggerCatch(_0x0586('0x1a5')));if(_0x58def9['checkRetriveMax'](0x5,_0x3309d2,_0x24c623)&&!_0x43820f){if(_0x5d5723['countbusyretry']>=_0x24c623[_0x0586('0x1a6')]){_0x58def9[_0x0586('0x125')](_0x5d5723,_0x5264a2,_0x1714bb,_0x0586('0x1a7'));}else{_0x58def9[_0x0586('0x122')](_0x5d5723,_0x5264a2,_0x1714bb,'reason\x205\x20busy');}}break;case'8':_0x24c623[_0x0586('0x1a8')]+=0x1;_0x5d5723[_0x0586('0x67')]=0x8;_0x5d5723[_0x0586('0xcc')]='Congestion';_0x5d5723[_0x0586('0x11d')]+=0x1;_0x5d5723['countglobal']+=0x1;_0x442242=_0x24c623[_0x0586('0x18f')];_0x3068f7=_0x24c623[_0x0586('0xd2')];ami[_0x0586('0x3e')]('custom:agentcongestion',ut['buildObj'](_0x3309d2,_0x0586('0x1a9')));hopperUtils[_0x0586('0xdd')](_0x5d5723)[_0x0586('0xa0')](loggerCatch('[syncAgentComplete][createHistory][8]'));if(_0x58def9[_0x0586('0x189')](0x8,_0x3309d2,_0x24c623)&&!_0x43820f){if(_0x5d5723[_0x0586('0x11d')]>=_0x24c623['dialCongestionMaxRetry']){_0x58def9[_0x0586('0x125')](_0x5d5723,_0x5264a2,_0x1714bb,_0x0586('0x1aa'));}else{_0x58def9[_0x0586('0x122')](_0x5d5723,_0x5264a2,_0x1714bb,_0x0586('0x1aa'));}}break;case'11':_0x24c623[_0x0586('0x1ab')]+=0x1;_0x5d5723['state']=0xb;_0x5d5723[_0x0586('0xcc')]=_0x0586('0xdf');_0x5d5723['countabandonedretry']+=0x1;_0x5d5723['countglobal']+=0x1;_0x442242=_0x24c623[_0x0586('0xe4')];_0x3068f7=_0x24c623[_0x0586('0xd2')];hopperUtils[_0x0586('0xdd')](_0x5d5723)[_0x0586('0xa0')](loggerCatch(_0x0586('0x1ac')));if(_0x58def9[_0x0586('0x189')](0xb,_0x3309d2,_0x24c623)&&!_0x43820f){if(_0x5d5723['countabandonedretry']>=_0x24c623[_0x0586('0xe6')]){_0x58def9[_0x0586('0x125')](_0x5d5723,_0x5264a2,_0x1714bb,_0x0586('0x1ad'));}else{_0x58def9[_0x0586('0x122')](_0x5d5723,_0x5264a2,_0x1714bb,_0x0586('0x1ad'));}}break;case'20':_0x24c623['outboundRejectCallsDay']+=0x1;_0x5d5723['state']=0x14;_0x5d5723[_0x0586('0xcc')]=_0x0586('0x1ae');_0x5d5723['countagentrejectretry']+=0x1;_0x5d5723[_0x0586('0xe3')]+=0x1;_0x442242=_0x24c623['dialAgentRejectRetryFrequency'];_0x3068f7=_0x24c623[_0x0586('0xd2')];ami[_0x0586('0x3e')]('custom:agentreject',ut[_0x0586('0x11a')](_0x3309d2,_0x0586('0x1af')));hopperUtils[_0x0586('0xdd')](_0x5d5723)[_0x0586('0xa0')](loggerCatch(_0x0586('0x1b0')));if(_0x58def9[_0x0586('0x189')](0x14,_0x3309d2,_0x24c623)&&!_0x43820f){if(_0x5d5723['countagentrejectretry']>=_0x24c623['dialAgentRejectMaxRetry']){_0x58def9['createStateFinal'](_0x5d5723,_0x5264a2,_0x1714bb,_0x0586('0x1b1'));}else{_0x58def9['stateGlobal'](_0x5d5723,_0x5264a2,_0x1714bb,_0x0586('0x1b1'));}}break;default:_0x24c623['outboundUnknownCallsDay']+=0x1;_0x5d5723['state']=0xc;_0x5d5723[_0x0586('0xcc')]=_0x113919[_0x0586('0x198')];_0x442242=_0x24c623[_0x0586('0x194')];_0x3068f7=_0x24c623[_0x0586('0xd2')];hopperUtils[_0x0586('0xdd')](_0x5d5723)['catch'](loggerCatch(_0x0586('0x1b2')));if(_0x58def9['checkRetriveMax'](_0x113919[_0x0586('0x198')],_0x3309d2,_0x24c623)&&!_0x43820f){if(_0x5d5723[_0x0586('0x11c')]+_0x5d5723[_0x0586('0x11d')]+_0x5d5723[_0x0586('0x11e')]+_0x5d5723[_0x0586('0x11f')]+_0x5d5723[_0x0586('0xd0')]+_0x5d5723[_0x0586('0xe2')]+_0x5d5723[_0x0586('0x119')]+_0x5d5723['countagentrejectretry']>=_0x24c623['dialGlobalMaxRetry']){_0x58def9[_0x0586('0x122')](_0x5d5723,_0x5264a2,_0x1714bb,_0x113919[_0x0586('0x198')]);}else{_0x58def9['createStateFinal'](_0x5d5723,_0x5264a2,_0x1714bb,_0x113919[_0x0586('0x198')]);}}}})[_0x0586('0x9c')](function(){if(_0x43820f){hopperUtils[_0x0586('0xde')](_0x5d5723,_0x442242,_0x3068f7)['then'](function(){return _0x5264a2(0x1);});}});});};Dialer[_0x0586('0x7f')][_0x0586('0x122')]=function(_0x544a3e,_0x23cfc0,_0x5e756c,_0x4c2cb0){var _0x210181=new Final(_0x544a3e);_0x210181[_0x0586('0x67')]=0xf;_0x210181[_0x0586('0xcc')]=_0x0586('0x1b3');this['createStateFinal'](_0x210181,_0x23cfc0,_0x5e756c,_0x4c2cb0);};Dialer[_0x0586('0x7f')][_0x0586('0x125')]=function(_0x1736c1,_0x2cae1d,_0x188cd0,_0x5b03f0){hopperUtils['moveContactManagedDialer'](_0x1736c1)['then'](function(){return _0x2cae1d(msgResponse(_0x0586('0x197'),_0x0586('0x107'),_0x5b03f0));})[_0x0586('0xa0')](function(){return _0x188cd0(msgResponse(_0x0586('0x1b4'),_0x0586('0x8e'),'contact\x20not\x20moved'));});};Dialer[_0x0586('0x7f')][_0x0586('0xb')]=function(_0x303455){var _0x17d890=_0x303455[_0x0586('0x1b5')]/0x64;var _0x20fee5=_0x303455[_0x0586('0xca')]/(_0x303455['outboundDropCallsDayTimeout']+_0x303455[_0x0586('0xbf')]);var _0x535c36=Math[_0x0586('0x1b6')](_0x303455[_0x0586('0x1b7')]*(_0x303455['predictiveIntervalMaxThreshold']/0x64));var _0x524e83=Math[_0x0586('0x1b6')](_0x303455['predictiveIntervalAvailable']*(_0x303455[_0x0586('0x1b8')]/0x64));var _0x1384ed=_0x303455[_0x0586('0x137')]+_0x303455[_0x0586('0x138')];var _0x34ae2f=Math[_0x0586('0x1b9')](_0x303455[_0x0586('0x1ba')]*_0x303455[_0x0586('0x5a')]*_0x303455[_0x0586('0x1bb')]*_0x303455[_0x0586('0x1bc')]);if(_[_0x0586('0x3d')](_0x303455[_0x0586('0x26')])){if(!_[_0x0586('0x3d')](_0x303455['startPredictive'])){_0x303455[_0x0586('0x25')]=undefined;loggerPredictive[_0x0586('0x60')](_0x0586('0x1bd'),_0x0586('0x1be'));}if(!_[_0x0586('0x3d')](_0x303455[_0x0586('0x5e')])){loggerPredictive[_0x0586('0x60')](_0x0586('0x1bd'),_0x0586('0x1bf'));clearInterval(_0x303455['handlePredictive']);_0x303455[_0x0586('0x5e')]=undefined;}_0x303455[_0x0586('0x26')]=moment()[_0x0586('0x75')](_0x0586('0xbd'));loggerPredictive['info'](_0x303455[_0x0586('0x44')],_0x0586('0x1c0'),_0x303455[_0x0586('0x26')]);this[_0x0586('0xaf')](_0x303455,0x1);}else if(ifInterval(_0x303455[_0x0586('0x1c1')],_0x303455[_0x0586('0x26')])){this['handlePower'](_0x303455,0x1);loggerPredictiveCalls[_0x0586('0x46')](_0x0586('0x1c2'),_0x303455['startProgressive'],_0x303455['name']);_0x303455[_0x0586('0x1ba')]=0x0;_0x303455['predictiveIntervalErlangCallsDroppedCalls']=0x0;}else if(_0x17d890<_0x20fee5&&_0x303455[_0x0586('0x1c3')]===_0x0586('0x1c4')){clearPredictiveAttributes(_0x303455);loggerPredictive[_0x0586('0x46')]('[stopMethodPredictive][ReStartProgressive][ExceededDropDay]',_0x0586('0x1c5'),_0x20fee5,_0x0586('0x26'),_0x303455[_0x0586('0x44')]);}else if(_0x34ae2f<_0x303455['predictiveIntervalErlangCallsDroppedCalls']&&_0x303455[_0x0586('0x1c3')]===_0x0586('0x1c4')){clearPredictiveAttributes(_0x303455);loggerPredictive[_0x0586('0x46')](_0x0586('0x1c6'),_0x0586('0x1c7'),_0x34ae2f,_0x0586('0x1c8'),_0x303455[_0x0586('0xcb')],_0x0586('0x26'),_0x303455[_0x0586('0x44')]);}else if(!ifInterval(_0x303455[_0x0586('0x1c1')],_0x303455[_0x0586('0x26')])&&_[_0x0586('0x3d')](_0x303455[_0x0586('0x25')])&&!_[_0x0586('0x3d')](_0x303455['startProgressive'])){_0x303455[_0x0586('0x25')]=moment()[_0x0586('0x75')](_0x0586('0xbd'));loggerPredictive['info'](_0x303455[_0x0586('0x44')],'started\x20in\x20predictive\x20at',_0x303455[_0x0586('0x25')]);hopperUtils[_0x0586('0x1c9')](_0x303455[_0x0586('0x1c1')])[_0x0586('0x9c')](this['getDataPredictive'](_0x303455))[_0x0586('0x9c')](mergeDataErlangB(_0x303455))[_0x0586('0x9c')](this[_0x0586('0x1ca')](_0x303455))['catch'](loggerCatchPredictive(_0x0586('0x1cb'),_0x303455));}else if(!ifInterval(_0x303455[_0x0586('0x1c1')],_0x303455['startPredictive'])){_0x303455[_0x0586('0xcb')]=0x0;_0x303455[_0x0586('0x25')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x0586('0x46')](_0x303455['name'],_0x0586('0x1cc'),_0x303455[_0x0586('0x25')]);clearInterval(_0x303455[_0x0586('0x5e')]);_0x303455[_0x0586('0x5e')]=undefined;hopperUtils['avgHandleTime'](_0x303455[_0x0586('0x1c1')])['then'](this[_0x0586('0x1cd')](_0x303455))[_0x0586('0x9c')](mergeDataErlangB(_0x303455))['then'](this[_0x0586('0x1ca')](_0x303455))[_0x0586('0xa0')](loggerCatchPredictive(_0x0586('0x1ce'),_0x303455));}else if(_0x303455[_0x0586('0x1b7')]&&_0x1384ed<_0x303455[_0x0586('0x1b7')]-_0x524e83){clearPredictiveAttributes(_0x303455);loggerPredictive[_0x0586('0x46')](_0x303455[_0x0586('0x44')],_0x0586('0x1cf'),_0x1384ed,_0x0586('0x1d0'),_0x303455[_0x0586('0x1b7')],'-',_0x524e83,'=',_0x303455[_0x0586('0x1b7')]-_0x524e83,')');}else if(_0x303455[_0x0586('0x1b7')]&&_0x1384ed>_0x303455[_0x0586('0x1b7')]+_0x535c36){clearPredictiveAttributes(_0x303455);loggerPredictive[_0x0586('0x46')](_0x303455[_0x0586('0x44')],_0x0586('0x1cf'),_0x1384ed,_0x0586('0x1d1'),_0x303455[_0x0586('0x1b7')],'+',_0x535c36,'=',_0x303455[_0x0586('0x1b7')]+_0x535c36,')');}};Dialer[_0x0586('0x7f')][_0x0586('0x1cd')]=function(_0x170b1b){var _0x1df933=this;return function(_0x5663b2){return new Promise(function(_0x574863,_0x4e3d36){_[_0x0586('0x5b')](_0x170b1b,_0x5663b2[0x0]);if(checkGetDataPredictive(_0x5663b2[0x0])){var _0x19791e=_0x170b1b[_0x0586('0x1b7')]=_0x170b1b[_0x0586('0x138')]+_0x170b1b[_0x0586('0x137')];var _0x320a3e=_0x170b1b[_0x0586('0x1c1')]*0x3c;var _0x3f93f2=_0x5663b2[0x0][_0x0586('0x51')]+_0x5663b2[0x0][_0x0586('0x4f')];var _0x285581=(_0x5663b2[0x0][_0x0586('0x4a')]+_0x5663b2[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x5663b2[0x0][_0x0586('0x4d')])/_0x5663b2[0x0][_0x0586('0x48')];_0x170b1b[_0x0586('0x1bb')]=_0x285581>0x0?_0x285581:0x1;switch(_0x170b1b[_0x0586('0x1c3')]){case'dropRate':var _0x4f832e=_0x170b1b[_0x0586('0x1b5')]/0x64;return _0x1df933[_0x0586('0x1d2')](_0x19791e,_0x320a3e,_0x3f93f2,_0x285581,_0x4f832e)['then'](function(_0x2c9e51){return _0x574863(_0x2c9e51);});case _0x0586('0x1d3'):var _0x5b3d91=_0x170b1b[_0x0586('0x1b5')]/0x64;return _0x1df933[_0x0586('0x1d4')](_0x19791e,_0x320a3e,_0x3f93f2,_0x285581,_0x5b3d91)[_0x0586('0x9c')](function(_0x5c690f){return _0x574863(_0x5c690f);});default:return _0x4e3d36(msgResponse(_0x0586('0x1d5'),_0x0586('0x8e'),_0x0586('0x1d6')));}}else{return _0x4e3d36(msgResponse('[getDataPredictive]',_0x0586('0x8e'),_0x0586('0x1d7')));}});};};Dialer[_0x0586('0x7f')][_0x0586('0x1d8')]=function(_0x5abd50){var _0x233907=this;return function(_0x2db684){return new Promise(function(_0x158e89,_0x43b29a){_[_0x0586('0x5b')](_0x5abd50,_0x2db684[0x0]);if(checkGetDataPredictive(_0x2db684[0x0])){loggerPredictive[_0x0586('0x46')](JSON[_0x0586('0x6c')](_0x2db684[0x0]));if(_0x5abd50[_0x0586('0x1c3')]===_0x0586('0x1c4')){return _0x233907[_0x0586('0x14f')](_0x5abd50['id'])[_0x0586('0x9c')](function(_0x331553){var _0x56f560=_0x5abd50[_0x0586('0x1d9')]-_0x331553[0x0][_0x0586('0x1da')];var _0x50f5cd=_0x5abd50[_0x0586('0x1c1')]*0x3c;var _0x377278=_0x2db684[0x0][_0x0586('0x51')]+_0x2db684[0x0][_0x0586('0x4f')];var _0x132a3d=(_0x2db684[0x0][_0x0586('0x4a')]+_0x2db684[0x0][_0x0586('0xc9')]+_0x2db684[0x0][_0x0586('0x4d')])/_0x2db684[0x0]['predictiveIntervalTotalCalls'];var _0x3aa90a=_0x5abd50[_0x0586('0x1b5')]/0x64;_0x5abd50[_0x0586('0x1db')]=_0x331553[0x0][_0x0586('0x1da')]||0x0;_0x5abd50[_0x0586('0x1bb')]=_0x132a3d>0x0?_0x132a3d:0x1;return _0x233907['abandonmentRate'](_0x56f560,_0x50f5cd,_0x377278,_0x132a3d,_0x3aa90a);})[_0x0586('0x9c')](function(_0x1c1e1b){return _0x158e89(_0x1c1e1b);})[_0x0586('0xa0')](function(_0x5c584d){return _0x43b29a(msgResponse('[CatchErlangB]',_0x0586('0x8e'),JSON['stringify'](_0x5c584d)));});}if(_0x5abd50[_0x0586('0x1c3')]===_0x0586('0x1d3')){return _0x233907[_0x0586('0x14f')](_0x5abd50['id'])[_0x0586('0x9c')](function(_0x48b054){var _0x17eee8=_0x5abd50[_0x0586('0x1d9')]-_0x48b054[0x0]['outboundQueuePauses'];var _0xfb228d=_0x5abd50[_0x0586('0x1c1')]*0x3c;var _0x3fa8cc=_0x2db684[0x0][_0x0586('0x51')]+_0x2db684[0x0][_0x0586('0x4f')];var _0x4c7e5a=(_0x2db684[0x0]['predictiveIntervalAnsweredCalls']+_0x2db684[0x0][_0x0586('0xc9')]+_0x2db684[0x0][_0x0586('0x4d')])/_0x2db684[0x0][_0x0586('0x48')];var _0x558a31=_0x5abd50[_0x0586('0x1b5')]/0x64;_0x5abd50[_0x0586('0x1db')]=_0x48b054[0x0][_0x0586('0x1da')]||0x0;_0x5abd50[_0x0586('0x1bb')]=_0x4c7e5a>0x0?_0x4c7e5a:0x1;return _0x233907[_0x0586('0x1d4')](_0x17eee8,_0xfb228d,_0x3fa8cc,_0x4c7e5a,_0x558a31);})['then'](function(_0x4bcfea){return _0x158e89(_0x4bcfea);})[_0x0586('0xa0')](function(_0x4ab919){return _0x43b29a(msgResponse(_0x0586('0x1dc'),_0x0586('0x8e'),JSON[_0x0586('0x6c')](_0x4ab919)));});}}else{return _0x43b29a(msgResponse('[getDataPredictive]',_0x0586('0x8e'),_0x0586('0x1d7')));}});};};Dialer['prototype']['startMethodPredictive']=function(_0x22f2d3){var _0x465eee=this;return function(){var _0x5be22d=0x0;var _0x25b0bc=Math[_0x0586('0x1b9')](_0x22f2d3[_0x0586('0x57')]*0x3e8);if(_0x25b0bc>0x0){_0x25b0bc=_0x25b0bc<0x64?0x64:_0x25b0bc;loggerPredictive[_0x0586('0x46')](_0x22f2d3[_0x0586('0x44')],_0x0586('0x1dd'),_0x25b0bc,'milliseconds');_0x22f2d3['handlePredictive']=setInterval(function(){_0x465eee['handlePredictive'](_0x22f2d3);loggerPredictiveCalls[_0x0586('0x46')]('[handlePredictive]',_0x5be22d+=0x1);},_0x25b0bc);}else{loggerPredictive[_0x0586('0x46')](_0x22f2d3[_0x0586('0x44')],_0x0586('0x1de'));}};};Dialer[_0x0586('0x7f')][_0x0586('0x1df')]=function(_0x33e3a0,_0x1941c4){var _0x4a1e38=this;return function(_0x1da5c4){if(_['isEmpty'](_0x1da5c4)){if(_['isNil'](_0x1941c4[_0x0586('0x1e0')])||!_0x1941c4[_0x0586('0x1e1')]){if(_0x33e3a0[_0x0586('0x1e2')]===_0x0586('0xa')){_0x33e3a0[_0x0586('0x6a')]=_[_0x0586('0x3d')](_0x33e3a0['queueStatusComplete'])?!![]:_0x33e3a0[_0x0586('0x6a')];var _0x5829e0=uuid['v4']();_0x4a1e38[_0x0586('0x21')][_0x5829e0]=new Action(_0x33e3a0,_0x1941c4,_0x5829e0);loggerBooked[_0x0586('0x46')]('[booked][checkContactBlack]',_0x5829e0,_0x0586('0x1e3'),JSON['stringify'](_0x33e3a0[_0x0586('0x6a')]),_0x0586('0x1e4'),_0x33e3a0[_0x0586('0x44')]);if(_0x33e3a0[_0x0586('0x6a')]){_0x33e3a0[_0x0586('0x6a')]=![];_0x4a1e38[_0x0586('0x27')][_0x4a1e38[_0x0586('0x21')][_0x5829e0][_0x0586('0xbe')]]=[];ami['Action']({'actionid':_0x5829e0,'action':_0x0586('0x1e5'),'queue':_0x33e3a0[_0x0586('0x44')]})['catch'](function(){_0x4a1e38[_0x0586('0xbb')](_0x33e3a0);hopperUtils[_0x0586('0xd6')]({'active':![],'ContactId':_0x4a1e38[_0x0586('0x21')][_0x5829e0][_0x0586('0xe9')],'ListId':_0x4a1e38['actions'][_0x5829e0][_0x0586('0xd8')],'VoiceQueueId':_0x4a1e38[_0x0586('0x21')][_0x5829e0][_0x0586('0xd9')]||undefined,'CampaignId':_0x4a1e38[_0x0586('0x21')][_0x5829e0][_0x0586('0xea')]||undefined})['catch'](loggerCatch(_0x0586('0x1e6')));delete _0x4a1e38['actions'][_0x5829e0];});}else{loggerBooked['info']('[booked][checkContactBlack][else]',JSON[_0x0586('0x6c')](_0x33e3a0[_0x0586('0x6a')]),_0x0586('0x1e4'),_0x33e3a0[_0x0586('0x44')]);_0x4a1e38['updateOriginated'](_0x33e3a0);hopperUtils[_0x0586('0xd6')]({'active':![],'ContactId':_0x4a1e38[_0x0586('0x21')][_0x5829e0][_0x0586('0xe9')],'ListId':_0x4a1e38['actions'][_0x5829e0]['ListId'],'VoiceQueueId':_0x4a1e38[_0x0586('0x21')][_0x5829e0]['VoiceQueueId']||undefined,'CampaignId':_0x4a1e38[_0x0586('0x21')][_0x5829e0]['CampaignId']||undefined})[_0x0586('0xa0')](loggerCatch(_0x0586('0x1e6')));delete _0x4a1e38[_0x0586('0x21')][_0x5829e0];}}else{return _0x4a1e38[_0x0586('0x158')](_0x33e3a0,_0x1941c4);}}else{if(utils[_0x0586('0x5c')](undefined,_0x1941c4[_0x0586('0x1e7')])<_0x33e3a0[_0x0586('0x1e8')]*0x3c){if(_0x1941c4[_0x0586('0x144')]&&!_0x1941c4[_0x0586('0x144')][_0x0586('0x1e9')]){_0x4a1e38['preview'][_0x0586('0xf8')](_0x1941c4['id'])[_0x0586('0x1b')](function(){_0x4a1e38[_0x0586('0xbb')](_0x33e3a0);});}else{hopperUtils[_0x0586('0x1ea')]({'active':![]},_0x1941c4['id'],0x1)[_0x0586('0x1b')](function(){_0x4a1e38[_0x0586('0xbb')](_0x33e3a0);});}}else{_0x33e3a0['outboundReCallsDay']+=0x1;_0x4a1e38['updateOriginated'](_0x33e3a0);if(_0x33e3a0[_0x0586('0x1eb')]){hopperUtils['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0x1941c4['ContactId'],'ListId':_0x1941c4[_0x0586('0xd8')],'VoiceQueueId':_0x1941c4[_0x0586('0xd9')]||undefined,'CampaignId':_0x1941c4['CampaignId']||undefined})[_0x0586('0xa0')](loggerCatch('[rescheduleContact][dialRecallInQueue]'));hopperUtils[_0x0586('0xdd')](createObjHistory(_0x33e3a0,_0x1941c4,utils[_0x0586('0x64')][_0x0586('0x1ec')],0x17,'RecallInQueue'))[_0x0586('0xa0')](loggerCatch(_0x0586('0x1ed')));}else{_0x4a1e38[_0x0586('0x115')](createObjHistory(_0x33e3a0,_0x1941c4,utils['CAMPAIGN_STATUS'][_0x0586('0x1ee')],0x16,_0x0586('0x1ef')),_0x0586('0x1f0'),'[Originate][HistoryRecallClose]');}}}}else{_0x33e3a0['outboundBlacklistCallsDay']+=0x1;_0x4a1e38[_0x0586('0x115')](createObjHistory(_0x33e3a0,_0x1941c4,utils[_0x0586('0x64')][_0x0586('0x1f1')],0xd,_0x0586('0x1f2')),_0x0586('0x1f3'),'[Originate][MoveBlacklist]');throw'inBlackList';}};};Dialer['prototype'][_0x0586('0x1f4')]=function(_0x5bc6fd){var _0x159e64=this;var _0x1acbf2=_0x5bc6fd[_0x0586('0x1f5')]-_0x5bc6fd[_0x0586('0x77')];emitCampaignSummary(_0x5bc6fd);if(_0x1acbf2>0x0&&_0x5bc6fd['temp']==0x0){if(_0x1acbf2>this[_0x0586('0x20')]){_0x1acbf2=this[_0x0586('0x20')];}_0x5bc6fd[_0x0586('0x61')]=0x1;hopperUtils[_0x0586('0x1f6')](_0x5bc6fd,_0x1acbf2)[_0x0586('0x9c')](function(_0x59290f){_0x5bc6fd[_0x0586('0x61')]=0x0;if(_0x59290f){if(!utils[_0x0586('0x1f7')](_0x59290f)){_0x5bc6fd[_0x0586('0x63')]=utils[_0x0586('0x64')][_0x0586('0x66')];logger[_0x0586('0x46')]('[getContactCampaign2][Empty]'+_0x5bc6fd[_0x0586('0x44')]);}else{_0x5bc6fd[_0x0586('0x77')]+=_0x59290f[_0x0586('0x96')];_0x5bc6fd[_0x0586('0x63')]=utils[_0x0586('0x64')][_0x0586('0x1f8')];for(var _0xbff297=0x0;_0xbff297<_0x59290f[_0x0586('0x96')];_0xbff297+=0x1){_0x5bc6fd[_0x0586('0x1f9')]+=0x1;if(_[_0x0586('0xf1')](_0x59290f[_0xbff297])||_[_0x0586('0xf1')](_0x59290f[_0xbff297][_0x0586('0x171')])||_[_0x0586('0xf1')](_0x59290f[_0xbff297][_0x0586('0x15a')])){_0x159e64['emptyContact'](_0x0586('0x1fa'),_0x5bc6fd,_0x59290f[_0xbff297]);}else{hopperUtils[_0x0586('0x1fb')](_[_0x0586('0x6d')](_0x59290f[_0xbff297],[_0x0586('0xea'),_0x0586('0x15a')]))[_0x0586('0x9c')](_0x159e64['checkContactBlack'](_0x5bc6fd,_0x59290f[_0xbff297]))[_0x0586('0xa0')](_0x159e64['loggerHandler'](_0x0586('0x1fc'),_0x5bc6fd));}}}}})[_0x0586('0xa0')](loggerGetContactDialer('[getContactCampaign2]',_0x5bc6fd,_0x1acbf2));}};Dialer[_0x0586('0x7f')][_0x0586('0xaf')]=function(_0x4bcfd9,_0x1a26b8){var _0x32651f=this;var _0x427ec0=[];if(_0x1a26b8<0x1||_0x4bcfd9[_0x0586('0x1e2')]===_0x0586('0xa')){_0x1a26b8=0x1;}var _0x56e2f1=Math[_0x0586('0x1b9')](_0x4bcfd9[_0x0586('0x137')]*_0x1a26b8)-_0x4bcfd9[_0x0586('0x77')];if(_0x4bcfd9[_0x0586('0x1fd')]>0x0){var _0x45a772=_0x4bcfd9[_0x0586('0x1fd')]-_0x4bcfd9[_0x0586('0x77')]-_0x4bcfd9[_0x0586('0x138')]-_0x4bcfd9['pTalking'];if(_0x56e2f1>_0x45a772){_0x56e2f1=_0x45a772;}}if(_0x56e2f1>0x0&&_0x4bcfd9[_0x0586('0x61')]==0x0){if(_0x4bcfd9[_0x0586('0x1e2')]==='booked'){_0x56e2f1=0x1;}if(_0x56e2f1>this['maxNumberOriginate']){_0x56e2f1=this['maxNumberOriginate'];}for(var _0x1f4849 in this['agents']){if(typeof this[_0x0586('0xf4')][_0x1f4849]!=='undefined'){if(this[_0x0586('0xf4')][_0x1f4849]['state']===_0x0586('0x1fe')&&this['agents'][_0x1f4849][_0x0586('0x83')]==='reachable'){_0x427ec0[_0x0586('0x97')](this[_0x0586('0xf4')][_0x1f4849]['id']);}}}_0x4bcfd9[_0x0586('0x61')]=0x1;hopperUtils[_0x0586('0x1ff')](_0x4bcfd9,_0x427ec0,_0x56e2f1)[_0x0586('0x9c')](function(_0x3043fd){_0x4bcfd9[_0x0586('0x61')]=0x0;if(_0x3043fd){if(!utils['checkContactEmpty'](_0x3043fd)){hopperUtils[_0x0586('0x200')](_0x4bcfd9)[_0x0586('0x9c')](sendMessageReschedule(_0x4bcfd9))[_0x0586('0xa0')](loggerCatch(_0x0586('0x201')));}else{_0x4bcfd9[_0x0586('0x77')]+=_0x3043fd[_0x0586('0x96')];_0x4bcfd9['message']=_0x4bcfd9[_0x0586('0x1e2')]===_0x0586('0xa')?utils['CAMPAIGN_STATUS'][_0x0586('0x13a')]:utils[_0x0586('0x64')][_0x0586('0x1f8')];for(var _0x1b7153=0x0;_0x1b7153<_0x3043fd[_0x0586('0x96')];_0x1b7153+=0x1){if(_[_0x0586('0xf1')](_0x3043fd[_0x1b7153])||_[_0x0586('0xf1')](_0x3043fd[_0x1b7153][_0x0586('0x171')])||_[_0x0586('0xf1')](_0x3043fd[_0x1b7153][_0x0586('0x15a')])){_0x32651f['emptyContact'](_0x0586('0x1fa'),_0x4bcfd9,_0x3043fd[_0x1b7153]);}else{hopperUtils['checkIsBlackList'](_['pick'](_0x3043fd[_0x1b7153],['VoiceQueueId',_0x0586('0x15a')]))[_0x0586('0x9c')](_0x32651f[_0x0586('0x1df')](_0x4bcfd9,_0x3043fd[_0x1b7153]))[_0x0586('0xa0')](_0x32651f[_0x0586('0x152')](_0x0586('0x1fa'),_0x4bcfd9));}}}}})['catch'](loggerGetContactDialer('[getContactDialer2]',_0x4bcfd9,_0x56e2f1));}};Dialer[_0x0586('0x7f')]['handlePredictive']=function(_0x49d92d){if(_0x49d92d['dialLimitQueue']>0x0){var _0x338b5a=_0x49d92d['dialLimitQueue']-_0x49d92d['originated']-_0x49d92d[_0x0586('0x138')];if(_0x338b5a>0x0&&_0x49d92d[_0x0586('0x61')]==0x0){this[_0x0586('0x202')](_0x49d92d);}else{loggerPredictiveCalls[_0x0586('0x46')]('[handlePredictive][limitChannel]');}}else{this[_0x0586('0x202')](_0x49d92d);}};Dialer['prototype'][_0x0586('0x202')]=function(_0x3a2865){var _0x578d90=this;var _0x1f787a=[];_0x3a2865[_0x0586('0x77')]+=0x1;for(var _0x35cc8e in this[_0x0586('0xf4')]){if(typeof this[_0x0586('0xf4')][_0x35cc8e]!==_0x0586('0xa8')){if(this[_0x0586('0xf4')][_0x35cc8e][_0x0586('0x67')]===_0x0586('0x1fe')&&this[_0x0586('0xf4')][_0x35cc8e][_0x0586('0x83')]===_0x0586('0x84')){_0x1f787a[_0x0586('0x97')](this[_0x0586('0xf4')][_0x35cc8e]['id']);}}}_0x3a2865['temp']=0x1;return this[_0x0586('0x1ff')](_0x3a2865['id'],_0x1f787a,0x1,_0x3a2865[_0x0586('0x203')],_0x3a2865)[_0x0586('0x9c')](function(_0x8c1d14){_0x3a2865[_0x0586('0x61')]=0x1;if(_0x8c1d14){if(!utils[_0x0586('0x1f7')](_0x8c1d14)){utils[_0x0586('0x204')](_0x3a2865,0x1,0x0);return hopperUtils['countReScheduled'](_0x3a2865)[_0x0586('0x9c')](sendMessageReschedule(_0x3a2865))[_0x0586('0xa0')](loggerCatch(_0x0586('0x201')));}else{_0x3a2865['message']=utils['CAMPAIGN_STATUS'][_0x0586('0x1f8')];if(_[_0x0586('0xf1')](_0x8c1d14[0x0])||_[_0x0586('0xf1')](_0x8c1d14[0x0][_0x0586('0x171')])||_[_0x0586('0xf1')](_0x8c1d14[0x0][_0x0586('0x15a')])){_0x578d90[_0x0586('0x153')](_0x0586('0x1fa'),_0x3a2865,_0x8c1d14[0x0]);}else{return hopperUtils['checkIsBlackList'](_[_0x0586('0x6d')](_0x8c1d14[0x0],[_0x0586('0xd9'),_0x0586('0x15a')]))['then'](_0x578d90['checkContactBlack'](_0x3a2865,_0x8c1d14[0x0]))[_0x0586('0xa0')](_0x578d90[_0x0586('0x152')](_0x0586('0x205'),_0x3a2865));}}}})['catch'](loggerGetContactDialer('[getContactDialerPredictive]',_0x3a2865,0x1));};Dialer[_0x0586('0x7f')]['abandonmentRate']=function(_0x48c250,_0x4b4a10,_0x5c840e,_0x349b6f,_0x341faf,_0x5a9f0a){loggerPredictive['info']('--------\x20Drop\x20Rate\x20--------');loggerPredictive['info']('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',_0x48c250);loggerPredictive[_0x0586('0x46')](_0x0586('0x206'),_0x4b4a10);loggerPredictive[_0x0586('0x46')](_0x0586('0x207'),_0x5c840e);loggerPredictive[_0x0586('0x46')](_0x0586('0x208'),_0x349b6f);loggerPredictive['info'](_0x0586('0x209'),_0x341faf);loggerPredictive[_0x0586('0x46')](_0x0586('0x52'));return new Promise(function(_0x4e59d3,_0x3596ac){if(_0x48c250<=0x0||isNaN(_0x48c250)){return _0x3596ac(msgResponse('[abandonmentRate]','Error',_0x0586('0x20a')+_0x48c250));}if(_0x5c840e<=0x0||isNaN(_0x5c840e)){return _0x3596ac(msgResponse(_0x0586('0x20b'),_0x0586('0x7e'),'Ts\x20=\x20'+_0x5c840e));}if(_0x349b6f<=0x0||isNaN(_0x349b6f)){return _0x3596ac(msgResponse(_0x0586('0x20b'),_0x0586('0x7e'),'p\x20=\x20'+_0x349b6f));}if(_0x4b4a10<=0x0||isNaN(_0x4b4a10)){return _0x3596ac(msgResponse(_0x0586('0x20b'),'Error',_0x0586('0x20c')+_0x4b4a10));}if(_0x341faf<=0x0||isNaN(_0x341faf)){return _0x3596ac(msgResponse('[abandonmentRate]','Error',_0x0586('0x20d')+_0x341faf));}_0x5a9f0a=_0x5a9f0a||0x0;var _0x762c53=0x1/_0x5c840e;var _0x1b553a=0x0;var _0x48f440=0x0;var _0x9edf31=0x0;var _0x175244=0x0;for(var _0x33d6fa=0x0;_0x9edf31<_0x341faf;_0x33d6fa+=0x1){_0x48f440=_0x33d6fa/_0x4b4a10;_0x1b553a=(_0x349b6f*_0x48f440+_0x5a9f0a)/_0x762c53;_0x9edf31=utils[_0x0586('0x20e')](_0x1b553a,_0x48c250);_0x175244=_0x1b553a/_0x48c250*(0x1-utils[_0x0586('0x20e')](_0x1b553a,_0x48c250));}return _0x4e59d3({'erlangCalls':_0x33d6fa,'erlangCallToSecond':_0x4b4a10/_0x33d6fa,'erlangAbandonmentRate':_0x9edf31,'erlangBusyFactor':_0x175244});});};Dialer[_0x0586('0x7f')][_0x0586('0x1d4')]=function(_0x162af2,_0xb189b8,_0x9d125,_0x150f8c,_0x1e1c6d,_0x515569){loggerPredictive[_0x0586('0x46')](_0x0586('0x20f'));loggerPredictive[_0x0586('0x46')]('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',_0x162af2);loggerPredictive[_0x0586('0x46')](_0x0586('0x206'),_0xb189b8);loggerPredictive['info'](_0x0586('0x207'),_0x9d125);loggerPredictive[_0x0586('0x46')](_0x0586('0x208'),_0x150f8c);loggerPredictive['info'](_0x0586('0x210'),_0x1e1c6d);loggerPredictive['info'](_0x0586('0x52'));return new Promise(function(_0x387ef3,_0x52a80f){if(_0x162af2<=0x0||isNaN(_0x162af2)){return _0x52a80f(msgResponse(_0x0586('0x211'),_0x0586('0x7e'),_0x0586('0x20a')+_0x162af2));}if(_0x9d125<=0x0||isNaN(_0x9d125)){return _0x52a80f(msgResponse(_0x0586('0x211'),_0x0586('0x7e'),'Ts\x20=\x20'+_0x9d125));}if(_0x150f8c<=0x0||isNaN(_0x150f8c)){return _0x52a80f(msgResponse(_0x0586('0x211'),_0x0586('0x7e'),_0x0586('0x212')+_0x150f8c));}if(_0xb189b8<=0x0||isNaN(_0xb189b8)){return _0x52a80f(msgResponse('[busyFactor]',_0x0586('0x7e'),_0x0586('0x20c')+_0xb189b8));}if(_0x1e1c6d<=0x0||isNaN(_0x1e1c6d)){return _0x52a80f(msgResponse('[busyFactor]',_0x0586('0x7e'),_0x0586('0x213')+_0x1e1c6d));}_0x515569=_0x515569||0x0;var _0x47fe1e=0x1/_0x9d125;var _0x59e5a1=0x0;var _0x5c3c34=0x0;var _0x7ddeca=0x0;var _0x1ad2f7=0x0;for(var _0x400db1=0x0;_0x1ad2f7<_0x1e1c6d;_0x400db1+=0x1){_0x5c3c34=_0x400db1/_0xb189b8;_0x59e5a1=(_0x150f8c*_0x5c3c34+_0x515569)/_0x47fe1e;_0x7ddeca=utils[_0x0586('0x20e')](_0x59e5a1,_0x162af2);_0x1ad2f7=_0x59e5a1/_0x162af2*(0x1-utils['erlangb'](_0x59e5a1,_0x162af2));}return _0x387ef3({'erlangCalls':_0x400db1,'erlangCallToSecond':_0xb189b8/_0x400db1,'erlangAbandonmentRate':_0x7ddeca,'erlangBusyFactor':_0x1ad2f7});});};module[_0x0586('0x214')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/models/action.js b/server/services/ami/dialer/models/action.js index 5128109..0129752 100644 --- a/server/services/ami/dialer/models/action.js +++ b/server/services/ami/dialer/models/action.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdfdf=['exports','util','moment','isNil','string','voiceQueue','uniqueid','name','Contact','phone','lastName','number','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','ContactFirstName','firstName','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackat','recallme','originatecalleridnum','originatecalleridname','getCaller','\x22%s\x22\x20<%s>','dialCutDigit','substring','prototype','getQueue','queue'];(function(_0x53a7af,_0x1408a5){var _0x3cc7f6=function(_0x4bf101){while(--_0x4bf101){_0x53a7af['push'](_0x53a7af['shift']());}};_0x3cc7f6(++_0x1408a5);}(_0xdfdf,0x161));var _0xfdfd=function(_0x11b750,_0x12f3fc){_0x11b750=_0x11b750-0x0;var _0x440be3=_0xdfdf[_0x11b750];return _0x440be3;};'use strict';var util=require(_0xfdfd('0x0'));var _=require('lodash');var moment=require(_0xfdfd('0x1'));function checkNameSurname(_0x179b53,_0x55860f,_0x286ec6){var _0x79046c='';if(!_[_0xfdfd('0x2')](_0x55860f)&&_0xfdfd('0x3')===typeof _0x55860f){_0x79046c+=_0x55860f;}if(!_[_0xfdfd('0x2')](_0x286ec6)&&'string'===typeof _0x286ec6){_0x79046c+='\x20'+_0x286ec6;}if(_0x79046c!==''){return _0x79046c;}return _0x179b53;}function Action(_0x4e40b0,_0x20a074,_0x15e141){this[_0xfdfd('0x4')]=_0x4e40b0;this[_0xfdfd('0x5')]=_0x15e141||undefined;this[_0xfdfd('0x6')]=checkNameSurname(_0x20a074[_0xfdfd('0x7')][_0xfdfd('0x8')],_0x20a074[_0xfdfd('0x7')]['firstName'],_0x20a074[_0xfdfd('0x7')][_0xfdfd('0x9')]);this[_0xfdfd('0xa')]=_0x20a074[_0xfdfd('0x8')];this['queue']=_0x4e40b0['name'];this[_0xfdfd('0xb')]=_0x20a074[_0xfdfd('0xb')]||![];this['type']=_0x4e40b0[_0xfdfd('0xc')];this[_0xfdfd('0xd')]=_0x4e40b0[_0xfdfd('0xd')]||0x3;this[_0xfdfd('0xe')]=_0x20a074[_0xfdfd('0xe')];this['countbusyretry']=_0x20a074[_0xfdfd('0xf')];this[_0xfdfd('0x10')]=_0x20a074[_0xfdfd('0x10')];this['countnoanswerretry']=_0x20a074['countnoanswerretry'];this['countnosuchnumberretry']=_0x20a074[_0xfdfd('0x11')];this['countdropretry']=_0x20a074['countdropretry'];this[_0xfdfd('0x12')]=_0x20a074[_0xfdfd('0x12')];this[_0xfdfd('0x13')]=_0x20a074[_0xfdfd('0x13')];this[_0xfdfd('0x14')]=_0x20a074[_0xfdfd('0x14')];this[_0xfdfd('0x15')]=_0x20a074[_0xfdfd('0x15')];this[_0xfdfd('0x16')]=_0x20a074[_0xfdfd('0x16')];this[_0xfdfd('0x17')]=_0x20a074[_0xfdfd('0x17')];this[_0xfdfd('0x18')]=_0x20a074[_0xfdfd('0x18')];this[_0xfdfd('0x19')]=_0x20a074[_0xfdfd('0x19')];this['idHopper']=_0x20a074['id'];this[_0xfdfd('0x1a')]=_0x20a074['Contact'][_0xfdfd('0x1b')]||'';this[_0xfdfd('0x1c')]=moment()[_0xfdfd('0x1d')](_0xfdfd('0x1e'));this['callback']=_0x20a074[_0xfdfd('0x1f')];this['callbackuniqueid']=_0x20a074['callbackuniqueid'];this[_0xfdfd('0x20')]=_0x20a074[_0xfdfd('0x20')];this[_0xfdfd('0x21')]=_0x20a074[_0xfdfd('0x21')];this[_0xfdfd('0x22')]='';this[_0xfdfd('0x23')]='';}Action['prototype'][_0xfdfd('0x24')]=function(){return util[_0xfdfd('0x1d')](_0xfdfd('0x25'),this[_0xfdfd('0x6')],this[_0xfdfd('0x4')][_0xfdfd('0x26')]>0x0?this[_0xfdfd('0xa')][_0xfdfd('0x27')](this[_0xfdfd('0x4')][_0xfdfd('0x26')]):this[_0xfdfd('0xa')]);};Action[_0xfdfd('0x28')][_0xfdfd('0x29')]=function(){return this[_0xfdfd('0x2a')];};module[_0xfdfd('0x2b')]=Action; \ No newline at end of file +var _0xbd13=['lastName','number','name','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','\x22%s\x22\x20<%s>','dialCutDigit','substring','prototype','queue','lodash','moment','isNil','string','voiceQueue','Contact','phone','firstName'];(function(_0x486f4a,_0x478dc7){var _0x135d99=function(_0x434008){while(--_0x434008){_0x486f4a['push'](_0x486f4a['shift']());}};_0x135d99(++_0x478dc7);}(_0xbd13,0x1a6));var _0x3bd1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbd13[_0x3dd15e];return _0x231fd0;};'use strict';var util=require('util');var _=require(_0x3bd1('0x0'));var moment=require(_0x3bd1('0x1'));function checkNameSurname(_0x2949c8,_0x3f440b,_0x1d4d00){var _0x4df496='';if(!_[_0x3bd1('0x2')](_0x3f440b)&&'string'===typeof _0x3f440b){_0x4df496+=_0x3f440b;}if(!_[_0x3bd1('0x2')](_0x1d4d00)&&_0x3bd1('0x3')===typeof _0x1d4d00){_0x4df496+='\x20'+_0x1d4d00;}if(_0x4df496!==''){return _0x4df496;}return _0x2949c8;}function Action(_0x516022,_0x1918ea,_0x5bfe0e){this[_0x3bd1('0x4')]=_0x516022;this['uniqueid']=_0x5bfe0e||undefined;this['name']=checkNameSurname(_0x1918ea[_0x3bd1('0x5')][_0x3bd1('0x6')],_0x1918ea['Contact'][_0x3bd1('0x7')],_0x1918ea[_0x3bd1('0x5')][_0x3bd1('0x8')]);this[_0x3bd1('0x9')]=_0x1918ea[_0x3bd1('0x6')];this['queue']=_0x516022[_0x3bd1('0xa')];this[_0x3bd1('0xb')]=_0x1918ea[_0x3bd1('0xb')]||![];this[_0x3bd1('0xc')]=_0x516022[_0x3bd1('0xc')];this[_0x3bd1('0xd')]=_0x516022[_0x3bd1('0xd')]||0x3;this[_0x3bd1('0xe')]=_0x1918ea[_0x3bd1('0xe')];this[_0x3bd1('0xf')]=_0x1918ea['countbusyretry'];this[_0x3bd1('0x10')]=_0x1918ea[_0x3bd1('0x10')];this[_0x3bd1('0x11')]=_0x1918ea['countnoanswerretry'];this[_0x3bd1('0x12')]=_0x1918ea[_0x3bd1('0x12')];this[_0x3bd1('0x13')]=_0x1918ea[_0x3bd1('0x13')];this[_0x3bd1('0x14')]=_0x1918ea[_0x3bd1('0x14')];this['countmachineretry']=_0x1918ea[_0x3bd1('0x15')];this[_0x3bd1('0x16')]=_0x1918ea['countagentrejectretry'];this[_0x3bd1('0x17')]=_0x1918ea[_0x3bd1('0x17')];this[_0x3bd1('0x18')]=_0x1918ea[_0x3bd1('0x18')];this[_0x3bd1('0x19')]=_0x1918ea[_0x3bd1('0x19')];this[_0x3bd1('0x1a')]=_0x1918ea[_0x3bd1('0x1a')];this[_0x3bd1('0x1b')]=_0x1918ea[_0x3bd1('0x1b')];this[_0x3bd1('0x1c')]=_0x1918ea['id'];this['ContactFirstName']=_0x1918ea['Contact']['firstName']||'';this[_0x3bd1('0x1d')]=moment()[_0x3bd1('0x1e')](_0x3bd1('0x1f'));this[_0x3bd1('0x20')]=_0x1918ea[_0x3bd1('0x20')];this[_0x3bd1('0x21')]=_0x1918ea['callbackuniqueid'];this[_0x3bd1('0x22')]=_0x1918ea['callbackat'];this['recallme']=_0x1918ea[_0x3bd1('0x23')];this[_0x3bd1('0x24')]='';this[_0x3bd1('0x25')]='';}Action['prototype']['getCaller']=function(){return util[_0x3bd1('0x1e')](_0x3bd1('0x26'),this[_0x3bd1('0xa')],this[_0x3bd1('0x4')][_0x3bd1('0x27')]>0x0?this[_0x3bd1('0x9')][_0x3bd1('0x28')](this[_0x3bd1('0x4')][_0x3bd1('0x27')]):this['number']);};Action[_0x3bd1('0x29')]['getQueue']=function(){return this[_0x3bd1('0x2a')];};module['exports']=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/models/agentComplete.js b/server/services/ami/dialer/models/agentComplete.js index 8a439cc..ae77623 100644 --- a/server/services/ami/dialer/models/agentComplete.js +++ b/server/services/ami/dialer/models/agentComplete.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7351=['starttime','responsetime','answertime','endtime','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','holdtime','membername','reason','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','exports','moment','../utils','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countmachineretry','countabandonedretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number'];(function(_0x28c39c,_0x3cc0c8){var _0x145b6b=function(_0x2ae04d){while(--_0x2ae04d){_0x28c39c['push'](_0x28c39c['shift']());}};_0x145b6b(++_0x3cc0c8);}(_0x7351,0xe3));var _0x1735=function(_0x32f495,_0x7f5c11){_0x32f495=_0x32f495-0x0;var _0x42272f=_0x7351[_0x32f495];return _0x42272f;};'use strict';var moment=require(_0x1735('0x0'));var utils=require(_0x1735('0x1'));function AgentComplete(_0x1fb635,_0x3de02d){this['state']=0x4;this['statedesc']='Answer';this[_0x1735('0x2')]=_0x1fb635[_0x1735('0x2')];this[_0x1735('0x3')]=_0x1fb635['type'];this['campaigntype']=_0x1fb635[_0x1735('0x3')]===_0x1735('0x4')?_0x1735('0x5'):_0x1fb635['type'];this[_0x1735('0x6')]=_0x1fb635[_0x1735('0x6')];this['countcongestionretry']=_0x1fb635[_0x1735('0x7')];this[_0x1735('0x8')]=_0x1fb635[_0x1735('0x8')];this['countglobal']=_0x1fb635['countbusyretry']+_0x1fb635[_0x1735('0x7')]+_0x1fb635[_0x1735('0x8')]+_0x1fb635[_0x1735('0x9')]+_0x1fb635[_0x1735('0xa')]+_0x1fb635['countabandonedretry']+_0x1fb635[_0x1735('0xb')]+_0x1fb635['countagentrejectretry'];this['countnosuchnumberretry']=_0x1fb635[_0x1735('0x9')];this[_0x1735('0xa')]=_0x1fb635[_0x1735('0xa')];this[_0x1735('0xc')]=_0x1fb635[_0x1735('0xc')];this[_0x1735('0xb')]=_0x1fb635[_0x1735('0xb')];this[_0x1735('0xd')]=_0x1fb635['countagentrejectretry'];this[_0x1735('0xe')]=_0x3de02d['uniqueid'];this[_0x1735('0xf')]=_0x1fb635[_0x1735('0x10')];this[_0x1735('0x11')]=_0x1fb635[_0x1735('0x12')];this['starttime']=_0x1fb635[_0x1735('0x13')];this[_0x1735('0x14')]=_0x1fb635[_0x1735('0x14')];this[_0x1735('0x15')]=_0x1fb635[_0x1735('0x15')];this[_0x1735('0x16')]=moment()['format'](_0x1735('0x17'));this[_0x1735('0x18')]=utils[_0x1735('0x19')](_0x1fb635[_0x1735('0x14')],_0x1fb635['starttime']);this[_0x1735('0x1a')]=utils['getSeconds'](_0x1fb635[_0x1735('0x15')],_0x1fb635[_0x1735('0x14')]);this['talktime']=utils[_0x1735('0x19')](this['endtime'],_0x1fb635[_0x1735('0x15')]);this['queue']=_0x3de02d[_0x1735('0x5')];this[_0x1735('0x1b')]=_0x3de02d[_0x1735('0x1b')];this[_0x1735('0x1c')]=_0x3de02d[_0x1735('0x1c')];this['callback']=_0x1fb635['callback'];this[_0x1735('0x1d')]=_0x1fb635['callbackuniqueid'];this[_0x1735('0x1e')]=_0x1fb635[_0x1735('0x1e')];this[_0x1735('0x1f')]=_0x1fb635[_0x1735('0x1f')];this[_0x1735('0x20')]=_0x1fb635['ContactId'];this[_0x1735('0x21')]=_0x1fb635[_0x1735('0x21')];this['UserId']=_0x1fb635[_0x1735('0x22')];this[_0x1735('0x23')]=_0x1fb635[_0x1735('0x23')];this[_0x1735('0x24')]=_0x1fb635['CampaignId'];this[_0x1735('0x25')]=_0x1fb635[_0x1735('0x25')]||'';this['originatecalleridname']=_0x1fb635[_0x1735('0x26')]||'';this[_0x1735('0x27')]=_0x1fb635['agiafterat'];}module[_0x1735('0x28')]=AgentComplete; \ No newline at end of file +var _0x4d47=['exports','moment','../utils','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','countdropretry','calleridname','name','calleridnum','number','starttime','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','holdtime','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','originatecalleridnum','originatecalleridname','agiafterat'];(function(_0x2b7a41,_0x5bc454){var _0x507a13=function(_0x1942b7){while(--_0x1942b7){_0x2b7a41['push'](_0x2b7a41['shift']());}};_0x507a13(++_0x5bc454);}(_0x4d47,0x143));var _0x74d4=function(_0x1818ef,_0x2fb6f0){_0x1818ef=_0x1818ef-0x0;var _0x200bbc=_0x4d47[_0x1818ef];return _0x200bbc;};'use strict';var moment=require(_0x74d4('0x0'));var utils=require(_0x74d4('0x1'));function AgentComplete(_0x4ec7bd,_0x5e651b){this[_0x74d4('0x2')]=0x4;this[_0x74d4('0x3')]=_0x74d4('0x4');this['scheduledat']=_0x4ec7bd[_0x74d4('0x5')];this[_0x74d4('0x6')]=_0x4ec7bd[_0x74d4('0x6')];this[_0x74d4('0x7')]=_0x4ec7bd[_0x74d4('0x6')]===_0x74d4('0x8')?_0x74d4('0x9'):_0x4ec7bd[_0x74d4('0x6')];this['countbusyretry']=_0x4ec7bd[_0x74d4('0xa')];this[_0x74d4('0xb')]=_0x4ec7bd[_0x74d4('0xb')];this[_0x74d4('0xc')]=_0x4ec7bd[_0x74d4('0xc')];this[_0x74d4('0xd')]=_0x4ec7bd[_0x74d4('0xa')]+_0x4ec7bd[_0x74d4('0xb')]+_0x4ec7bd['countnoanswerretry']+_0x4ec7bd['countnosuchnumberretry']+_0x4ec7bd['countdropretry']+_0x4ec7bd[_0x74d4('0xe')]+_0x4ec7bd[_0x74d4('0xf')]+_0x4ec7bd[_0x74d4('0x10')];this[_0x74d4('0x11')]=_0x4ec7bd[_0x74d4('0x11')];this['countdropretry']=_0x4ec7bd[_0x74d4('0x12')];this[_0x74d4('0xe')]=_0x4ec7bd[_0x74d4('0xe')];this[_0x74d4('0xf')]=_0x4ec7bd[_0x74d4('0xf')];this[_0x74d4('0x10')]=_0x4ec7bd['countagentrejectretry'];this['uniqueid']=_0x5e651b['uniqueid'];this[_0x74d4('0x13')]=_0x4ec7bd[_0x74d4('0x14')];this[_0x74d4('0x15')]=_0x4ec7bd[_0x74d4('0x16')];this['starttime']=_0x4ec7bd[_0x74d4('0x17')];this[_0x74d4('0x18')]=_0x4ec7bd['responsetime'];this[_0x74d4('0x19')]=_0x4ec7bd[_0x74d4('0x19')];this[_0x74d4('0x1a')]=moment()[_0x74d4('0x1b')](_0x74d4('0x1c'));this[_0x74d4('0x1d')]=utils[_0x74d4('0x1e')](_0x4ec7bd[_0x74d4('0x18')],_0x4ec7bd[_0x74d4('0x17')]);this[_0x74d4('0x1f')]=utils['getSeconds'](_0x4ec7bd['answertime'],_0x4ec7bd['responsetime']);this[_0x74d4('0x20')]=utils[_0x74d4('0x1e')](this[_0x74d4('0x1a')],_0x4ec7bd[_0x74d4('0x19')]);this[_0x74d4('0x9')]=_0x5e651b[_0x74d4('0x9')];this[_0x74d4('0x21')]=_0x5e651b['membername'];this['reason']=_0x5e651b[_0x74d4('0x22')];this[_0x74d4('0x23')]=_0x4ec7bd[_0x74d4('0x23')];this[_0x74d4('0x24')]=_0x4ec7bd[_0x74d4('0x24')];this[_0x74d4('0x25')]=_0x4ec7bd['callbackat'];this[_0x74d4('0x26')]=_0x4ec7bd[_0x74d4('0x26')];this[_0x74d4('0x27')]=_0x4ec7bd[_0x74d4('0x27')];this[_0x74d4('0x28')]=_0x4ec7bd[_0x74d4('0x28')];this['UserId']=_0x4ec7bd[_0x74d4('0x29')];this['VoiceQueueId']=_0x4ec7bd['VoiceQueueId'];this['CampaignId']=_0x4ec7bd['CampaignId'];this[_0x74d4('0x2a')]=_0x4ec7bd[_0x74d4('0x2a')]||'';this[_0x74d4('0x2b')]=_0x4ec7bd[_0x74d4('0x2b')]||'';this[_0x74d4('0x2c')]=_0x4ec7bd[_0x74d4('0x2c')];}module[_0x74d4('0x2d')]=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/models/final.js b/server/services/ami/dialer/models/final.js index 64f4ca4..0c90f86 100644 --- a/server/services/ami/dialer/models/final.js +++ b/server/services/ami/dialer/models/final.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdcfa=['campaigntype','outbound','queue','countbusyretry','countnoanswerretry','countglobal','countcongestionretry','countnosuchnumberretry','countdropretry','countmachineretry','countabandonedretry','countagentrejectretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','VoiceQueueId','CampaignId','originatecalleridnum','state','statedesc','uniqueid','scheduledat','type'];(function(_0xe45118,_0x5dffbc){var _0x15e15d=function(_0x17eaec){while(--_0x17eaec){_0xe45118['push'](_0xe45118['shift']());}};_0x15e15d(++_0x5dffbc);}(_0xdcfa,0x126));var _0xadcf=function(_0x115d1f,_0xc8262){_0x115d1f=_0x115d1f-0x0;var _0x357a9e=_0xdcfa[_0x115d1f];return _0x357a9e;};'use strict';function Final(_0x19b7a9){this[_0xadcf('0x0')]=_0x19b7a9[_0xadcf('0x0')];this[_0xadcf('0x1')]=_0x19b7a9[_0xadcf('0x1')];this['type']=_0x19b7a9[_0xadcf('0x2')];this[_0xadcf('0x3')]=_0x19b7a9['type']===_0xadcf('0x4')?_0xadcf('0x5'):_0x19b7a9[_0xadcf('0x2')];this[_0xadcf('0x6')]=_0x19b7a9[_0xadcf('0x6')];this['countcongestionretry']=_0x19b7a9['countcongestionretry'];this[_0xadcf('0x7')]=_0x19b7a9['countnoanswerretry'];this[_0xadcf('0x8')]=_0x19b7a9[_0xadcf('0x6')]+_0x19b7a9[_0xadcf('0x9')]+_0x19b7a9[_0xadcf('0x7')]+_0x19b7a9[_0xadcf('0xa')]+_0x19b7a9[_0xadcf('0xb')]+_0x19b7a9['countabandonedretry']+_0x19b7a9[_0xadcf('0xc')]+_0x19b7a9['countagentrejectretry'];this[_0xadcf('0xa')]=_0x19b7a9[_0xadcf('0xa')];this['countdropretry']=_0x19b7a9[_0xadcf('0xb')];this[_0xadcf('0xd')]=_0x19b7a9[_0xadcf('0xd')];this[_0xadcf('0xc')]=_0x19b7a9['countmachineretry'];this[_0xadcf('0xe')]=_0x19b7a9['countagentrejectretry'];this[_0xadcf('0x5')]=_0x19b7a9[_0xadcf('0x5')];this[_0xadcf('0xf')]=_0x19b7a9[_0xadcf('0xf')];this[_0xadcf('0x10')]=_0x19b7a9['calleridnum'];this[_0xadcf('0x11')]=_0x19b7a9[_0xadcf('0x11')];this[_0xadcf('0x12')]=_0x19b7a9[_0xadcf('0x12')];this[_0xadcf('0x13')]=_0x19b7a9['responsetime'];this[_0xadcf('0x14')]=_0x19b7a9[_0xadcf('0x14')]||0x0;this['holdtime']=_0x19b7a9[_0xadcf('0x15')]||0x0;this[_0xadcf('0x16')]=_0x19b7a9[_0xadcf('0x16')]||0x0;this['callback']=_0x19b7a9[_0xadcf('0x17')];this[_0xadcf('0x18')]=_0x19b7a9[_0xadcf('0x18')];this['callbackat']=_0x19b7a9[_0xadcf('0x19')];this[_0xadcf('0x1a')]=_0x19b7a9[_0xadcf('0x1a')];this['ContactId']=_0x19b7a9[_0xadcf('0x1b')];this['ListId']=_0x19b7a9['ListId'];this['UserId']=_0x19b7a9['UserId'];this[_0xadcf('0x1c')]=_0x19b7a9[_0xadcf('0x1c')];this[_0xadcf('0x1d')]=_0x19b7a9[_0xadcf('0x1d')];this[_0xadcf('0x1e')]=_0x19b7a9['originatecalleridnum']||'';this['originatecalleridname']=_0x19b7a9['originatecalleridname']||'';this[_0xadcf('0x1f')]=_0x19b7a9[_0xadcf('0x1f')];this['statedesc']=_0x19b7a9[_0xadcf('0x20')];}module['exports']=Final; \ No newline at end of file +var _0xa4f8=['calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','uniqueid','scheduledat','type','campaigntype','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','queue','calleridname'];(function(_0x585283,_0x52ea2a){var _0x2ba206=function(_0x5a7bc5){while(--_0x5a7bc5){_0x585283['push'](_0x585283['shift']());}};_0x2ba206(++_0x52ea2a);}(_0xa4f8,0x11c));var _0x8a4f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa4f8[_0x3dd15e];return _0x231fd0;};'use strict';function Final(_0x260d70){this[_0x8a4f('0x0')]=_0x260d70[_0x8a4f('0x0')];this[_0x8a4f('0x1')]=_0x260d70[_0x8a4f('0x1')];this[_0x8a4f('0x2')]=_0x260d70[_0x8a4f('0x2')];this[_0x8a4f('0x3')]=_0x260d70[_0x8a4f('0x2')]==='outbound'?'queue':_0x260d70['type'];this[_0x8a4f('0x4')]=_0x260d70[_0x8a4f('0x4')];this[_0x8a4f('0x5')]=_0x260d70['countcongestionretry'];this[_0x8a4f('0x6')]=_0x260d70['countnoanswerretry'];this['countglobal']=_0x260d70[_0x8a4f('0x4')]+_0x260d70[_0x8a4f('0x5')]+_0x260d70[_0x8a4f('0x6')]+_0x260d70['countnosuchnumberretry']+_0x260d70[_0x8a4f('0x7')]+_0x260d70[_0x8a4f('0x8')]+_0x260d70[_0x8a4f('0x9')]+_0x260d70['countagentrejectretry'];this['countnosuchnumberretry']=_0x260d70['countnosuchnumberretry'];this[_0x8a4f('0x7')]=_0x260d70[_0x8a4f('0x7')];this[_0x8a4f('0x8')]=_0x260d70['countabandonedretry'];this[_0x8a4f('0x9')]=_0x260d70['countmachineretry'];this['countagentrejectretry']=_0x260d70[_0x8a4f('0xa')];this[_0x8a4f('0xb')]=_0x260d70[_0x8a4f('0xb')];this[_0x8a4f('0xc')]=_0x260d70[_0x8a4f('0xc')];this[_0x8a4f('0xd')]=_0x260d70['calleridnum'];this[_0x8a4f('0xe')]=_0x260d70[_0x8a4f('0xe')];this[_0x8a4f('0xf')]=_0x260d70[_0x8a4f('0xf')];this[_0x8a4f('0x10')]=_0x260d70[_0x8a4f('0xf')];this[_0x8a4f('0x11')]=_0x260d70[_0x8a4f('0x11')]||0x0;this['holdtime']=_0x260d70[_0x8a4f('0x12')]||0x0;this[_0x8a4f('0x13')]=_0x260d70[_0x8a4f('0x13')]||0x0;this['callback']=_0x260d70[_0x8a4f('0x14')];this[_0x8a4f('0x15')]=_0x260d70[_0x8a4f('0x15')];this[_0x8a4f('0x16')]=_0x260d70['callbackat'];this['recallme']=_0x260d70[_0x8a4f('0x17')];this['ContactId']=_0x260d70[_0x8a4f('0x18')];this['ListId']=_0x260d70[_0x8a4f('0x19')];this['UserId']=_0x260d70['UserId'];this['VoiceQueueId']=_0x260d70[_0x8a4f('0x1a')];this[_0x8a4f('0x1b')]=_0x260d70[_0x8a4f('0x1b')];this['originatecalleridnum']=_0x260d70[_0x8a4f('0x1c')]||'';this[_0x8a4f('0x1d')]=_0x260d70[_0x8a4f('0x1d')]||'';this[_0x8a4f('0x1e')]=_0x260d70['state'];this[_0x8a4f('0x1f')]=_0x260d70['statedesc'];}module[_0x8a4f('0x20')]=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/models/hangup.js b/server/services/ami/dialer/models/hangup.js index f513353..716afd2 100644 --- a/server/services/ami/dialer/models/hangup.js +++ b/server/services/ami/dialer/models/hangup.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbc69=['callbackat','recallme','ContactId','ListId','UserId','CampaignId','exports','moment','../utils','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','amd','countbusyretry','countnoanswerretry','countglobal','countcongestionretry','countdropretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','countabandonedretry','uniqueid','calleridname','name','calleridnum','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','IVR','reason','cause-txt','callback','callbackuniqueid'];(function(_0x236209,_0x51b840){var _0x2afd5b=function(_0x15b5d6){while(--_0x15b5d6){_0x236209['push'](_0x236209['shift']());}};_0x2afd5b(++_0x51b840);}(_0xbc69,0x88));var _0x9bc6=function(_0x5416db,_0x55683a){_0x5416db=_0x5416db-0x0;var _0x243e35=_0xbc69[_0x5416db];return _0x243e35;};'use strict';var moment=require(_0x9bc6('0x0'));var utils=require(_0x9bc6('0x1'));function Hangup(_0x10cf38,_0x4dd8cd){this[_0x9bc6('0x2')]=0x4;this[_0x9bc6('0x3')]=_0x9bc6('0x4');this['scheduledat']=_0x10cf38[_0x9bc6('0x5')];this['type']=_0x10cf38[_0x9bc6('0x6')];this[_0x9bc6('0x7')]=_0x10cf38['type']===_0x9bc6('0x8')?_0x9bc6('0x9'):_0x10cf38[_0x9bc6('0x6')];this['amd']=_0x10cf38[_0x9bc6('0xa')]||![];this[_0x9bc6('0xb')]=_0x10cf38[_0x9bc6('0xb')];this['countcongestionretry']=_0x10cf38['countcongestionretry'];this[_0x9bc6('0xc')]=_0x10cf38['countnoanswerretry'];this[_0x9bc6('0xd')]=_0x10cf38[_0x9bc6('0xb')]+_0x10cf38[_0x9bc6('0xe')]+_0x10cf38[_0x9bc6('0xc')]+_0x10cf38['countnosuchnumberretry']+_0x10cf38[_0x9bc6('0xf')]+_0x10cf38['countabandonedretry']+_0x10cf38[_0x9bc6('0x10')]+_0x10cf38[_0x9bc6('0x11')];this['countnosuchnumberretry']=_0x10cf38[_0x9bc6('0x12')];this[_0x9bc6('0xf')]=_0x10cf38[_0x9bc6('0xf')];this[_0x9bc6('0x13')]=_0x10cf38[_0x9bc6('0x13')];this['countmachineretry']=_0x10cf38['countmachineretry'];this['countagentrejectretry']=_0x10cf38[_0x9bc6('0x11')];this[_0x9bc6('0x14')]=_0x4dd8cd['uniqueid'];this[_0x9bc6('0x15')]=_0x10cf38[_0x9bc6('0x16')];this[_0x9bc6('0x17')]=_0x10cf38['number'];this[_0x9bc6('0x18')]=_0x10cf38['starttime'];this[_0x9bc6('0x19')]=_0x10cf38[_0x9bc6('0x19')];this[_0x9bc6('0x1a')]=moment()[_0x9bc6('0x1b')](_0x9bc6('0x1c'));this[_0x9bc6('0x1d')]=utils[_0x9bc6('0x1e')](_0x10cf38[_0x9bc6('0x19')],_0x10cf38[_0x9bc6('0x18')]);this['holdtime']=0x0;this['talktime']=utils[_0x9bc6('0x1e')](this[_0x9bc6('0x1a')],_0x10cf38['responsetime']);this[_0x9bc6('0x9')]=_0x10cf38[_0x9bc6('0x9')];this['membername']=_0x9bc6('0x1f');this[_0x9bc6('0x20')]=_0x4dd8cd[_0x9bc6('0x21')];this[_0x9bc6('0x22')]=_0x10cf38[_0x9bc6('0x22')];this['callbackuniqueid']=_0x10cf38[_0x9bc6('0x23')];this[_0x9bc6('0x24')]=_0x10cf38[_0x9bc6('0x24')];this[_0x9bc6('0x25')]=_0x10cf38[_0x9bc6('0x25')];this[_0x9bc6('0x26')]=_0x10cf38[_0x9bc6('0x26')];this[_0x9bc6('0x27')]=_0x10cf38[_0x9bc6('0x27')];this[_0x9bc6('0x28')]=_0x10cf38[_0x9bc6('0x28')];this['VoiceQueueId']=_0x10cf38['VoiceQueueId'];this[_0x9bc6('0x29')]=_0x10cf38[_0x9bc6('0x29')];}module[_0x9bc6('0x2a')]=Hangup; \ No newline at end of file +var _0x5d59=['VoiceQueueId','CampaignId','exports','moment','../utils','state','statedesc','Answer','scheduledat','type','outbound','queue','amd','countbusyretry','countcongestionretry','countglobal','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countdropretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','calleridnum','number','starttime','responsetime','endtime','format','ringtime','holdtime','talktime','getSeconds','IVR','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId'];(function(_0x1e5485,_0x2c33ee){var _0x1ff370=function(_0x41b908){while(--_0x41b908){_0x1e5485['push'](_0x1e5485['shift']());}};_0x1ff370(++_0x2c33ee);}(_0x5d59,0x163));var _0x95d5=function(_0x34bab7,_0xedfc66){_0x34bab7=_0x34bab7-0x0;var _0x8319f7=_0x5d59[_0x34bab7];return _0x8319f7;};'use strict';var moment=require(_0x95d5('0x0'));var utils=require(_0x95d5('0x1'));function Hangup(_0x132a47,_0x4c898b){this[_0x95d5('0x2')]=0x4;this[_0x95d5('0x3')]=_0x95d5('0x4');this['scheduledat']=_0x132a47[_0x95d5('0x5')];this[_0x95d5('0x6')]=_0x132a47['type'];this['campaigntype']=_0x132a47[_0x95d5('0x6')]===_0x95d5('0x7')?_0x95d5('0x8'):_0x132a47[_0x95d5('0x6')];this['amd']=_0x132a47[_0x95d5('0x9')]||![];this[_0x95d5('0xa')]=_0x132a47['countbusyretry'];this[_0x95d5('0xb')]=_0x132a47[_0x95d5('0xb')];this['countnoanswerretry']=_0x132a47['countnoanswerretry'];this[_0x95d5('0xc')]=_0x132a47[_0x95d5('0xa')]+_0x132a47[_0x95d5('0xb')]+_0x132a47[_0x95d5('0xd')]+_0x132a47[_0x95d5('0xe')]+_0x132a47['countdropretry']+_0x132a47[_0x95d5('0xf')]+_0x132a47['countmachineretry']+_0x132a47['countagentrejectretry'];this[_0x95d5('0xe')]=_0x132a47['countnosuchnumberretry'];this[_0x95d5('0x10')]=_0x132a47[_0x95d5('0x10')];this[_0x95d5('0xf')]=_0x132a47[_0x95d5('0xf')];this['countmachineretry']=_0x132a47[_0x95d5('0x11')];this[_0x95d5('0x12')]=_0x132a47[_0x95d5('0x12')];this[_0x95d5('0x13')]=_0x4c898b[_0x95d5('0x13')];this[_0x95d5('0x14')]=_0x132a47['name'];this[_0x95d5('0x15')]=_0x132a47[_0x95d5('0x16')];this[_0x95d5('0x17')]=_0x132a47[_0x95d5('0x17')];this[_0x95d5('0x18')]=_0x132a47[_0x95d5('0x18')];this[_0x95d5('0x19')]=moment()[_0x95d5('0x1a')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x95d5('0x1b')]=utils['getSeconds'](_0x132a47['responsetime'],_0x132a47[_0x95d5('0x17')]);this[_0x95d5('0x1c')]=0x0;this[_0x95d5('0x1d')]=utils[_0x95d5('0x1e')](this['endtime'],_0x132a47[_0x95d5('0x18')]);this[_0x95d5('0x8')]=_0x132a47['queue'];this['membername']=_0x95d5('0x1f');this[_0x95d5('0x20')]=_0x4c898b[_0x95d5('0x21')];this[_0x95d5('0x22')]=_0x132a47[_0x95d5('0x22')];this[_0x95d5('0x23')]=_0x132a47[_0x95d5('0x23')];this[_0x95d5('0x24')]=_0x132a47[_0x95d5('0x24')];this[_0x95d5('0x25')]=_0x132a47[_0x95d5('0x25')];this[_0x95d5('0x26')]=_0x132a47['ContactId'];this['ListId']=_0x132a47[_0x95d5('0x27')];this[_0x95d5('0x28')]=_0x132a47[_0x95d5('0x28')];this[_0x95d5('0x29')]=_0x132a47[_0x95d5('0x29')];this['CampaignId']=_0x132a47[_0x95d5('0x2a')];}module[_0x95d5('0x2b')]=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/models/history.js b/server/services/ami/dialer/models/history.js index d6957b3..a52098b 100644 --- a/server/services/ami/dialer/models/history.js +++ b/server/services/ami/dialer/models/history.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ded=['campaigntype','outbound','queue','type','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','name','number','starttime','responsetime','endtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','../utils','uniqueid','scheduledat'];(function(_0x11cb92,_0x534825){var _0x50e2e6=function(_0x347dce){while(--_0x347dce){_0x11cb92['push'](_0x11cb92['shift']());}};_0x50e2e6(++_0x534825);}(_0x2ded,0x1eb));var _0xd2de=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2ded[_0x3dd15e];return _0x231fd0;};'use strict';var utils=require(_0xd2de('0x0'));function History(_0x1a1883){this[_0xd2de('0x1')]=_0x1a1883[_0xd2de('0x1')];this['scheduledat']=_0x1a1883[_0xd2de('0x2')]||undefined;this['type']=_0x1a1883['type'];this[_0xd2de('0x3')]=_0x1a1883['type']===_0xd2de('0x4')?_0xd2de('0x5'):_0x1a1883[_0xd2de('0x6')];this[_0xd2de('0x7')]=_0x1a1883[_0xd2de('0x7')];this[_0xd2de('0x8')]=_0x1a1883['countcongestionretry'];this[_0xd2de('0x9')]=_0x1a1883[_0xd2de('0x9')];this[_0xd2de('0xa')]=_0x1a1883[_0xd2de('0x7')]+_0x1a1883[_0xd2de('0x8')]+_0x1a1883[_0xd2de('0x9')]+_0x1a1883[_0xd2de('0xb')]+_0x1a1883[_0xd2de('0xc')]+_0x1a1883[_0xd2de('0xd')]+_0x1a1883[_0xd2de('0xe')]+_0x1a1883[_0xd2de('0xf')];this[_0xd2de('0xb')]=_0x1a1883[_0xd2de('0xb')];this[_0xd2de('0xc')]=_0x1a1883[_0xd2de('0xc')];this[_0xd2de('0xd')]=_0x1a1883[_0xd2de('0xd')];this['countmachineretry']=_0x1a1883[_0xd2de('0xe')];this[_0xd2de('0xf')]=_0x1a1883[_0xd2de('0xf')];this[_0xd2de('0x5')]=_0x1a1883[_0xd2de('0x5')];this[_0xd2de('0x10')]=_0x1a1883[_0xd2de('0x11')];this['calleridnum']=_0x1a1883[_0xd2de('0x12')];this[_0xd2de('0x13')]=_0x1a1883[_0xd2de('0x13')];this['responsetime']=_0x1a1883[_0xd2de('0x14')];this[_0xd2de('0x15')]=_0x1a1883['responsetime'];this['ringtime']=utils['getSeconds'](_0x1a1883['responsetime'],_0x1a1883[_0xd2de('0x13')]);this[_0xd2de('0x16')]=0x0;this[_0xd2de('0x17')]=0x0;this[_0xd2de('0x18')]=_0x1a1883[_0xd2de('0x18')];this[_0xd2de('0x19')]=_0x1a1883[_0xd2de('0x19')];this[_0xd2de('0x1a')]=_0x1a1883[_0xd2de('0x1a')];this[_0xd2de('0x1b')]=_0x1a1883['recallme'];this['ContactId']=_0x1a1883[_0xd2de('0x1c')];this[_0xd2de('0x1d')]=_0x1a1883[_0xd2de('0x1d')];this[_0xd2de('0x1e')]=_0x1a1883[_0xd2de('0x1e')];this[_0xd2de('0x1f')]=_0x1a1883[_0xd2de('0x1f')];this[_0xd2de('0x20')]=_0x1a1883[_0xd2de('0x20')];this[_0xd2de('0x21')]=_0x1a1883['originatecalleridnum']||'';this[_0xd2de('0x22')]=_0x1a1883['originatecalleridname']||'';this['state']=_0x1a1883[_0xd2de('0x23')];this[_0xd2de('0x24')]=_0x1a1883[_0xd2de('0x24')];}module[_0xd2de('0x25')]=History; \ No newline at end of file +var _0x9bb1=['campaigntype','outbound','queue','countcongestionretry','countnoanswerretry','countglobal','countbusyretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','name','calleridnum','number','starttime','responsetime','endtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','../utils','uniqueid','scheduledat','type'];(function(_0x589eb4,_0xaa2019){var _0xf50816=function(_0x572fc5){while(--_0x572fc5){_0x589eb4['push'](_0x589eb4['shift']());}};_0xf50816(++_0xaa2019);}(_0x9bb1,0x152));var _0x19bb=function(_0x796610,_0xff1272){_0x796610=_0x796610-0x0;var _0x1e597b=_0x9bb1[_0x796610];return _0x1e597b;};'use strict';var utils=require(_0x19bb('0x0'));function History(_0x12fffe){this[_0x19bb('0x1')]=_0x12fffe[_0x19bb('0x1')];this[_0x19bb('0x2')]=_0x12fffe[_0x19bb('0x2')]||undefined;this[_0x19bb('0x3')]=_0x12fffe[_0x19bb('0x3')];this[_0x19bb('0x4')]=_0x12fffe[_0x19bb('0x3')]===_0x19bb('0x5')?_0x19bb('0x6'):_0x12fffe['type'];this['countbusyretry']=_0x12fffe['countbusyretry'];this['countcongestionretry']=_0x12fffe[_0x19bb('0x7')];this[_0x19bb('0x8')]=_0x12fffe[_0x19bb('0x8')];this[_0x19bb('0x9')]=_0x12fffe[_0x19bb('0xa')]+_0x12fffe[_0x19bb('0x7')]+_0x12fffe[_0x19bb('0x8')]+_0x12fffe[_0x19bb('0xb')]+_0x12fffe[_0x19bb('0xc')]+_0x12fffe[_0x19bb('0xd')]+_0x12fffe[_0x19bb('0xe')]+_0x12fffe[_0x19bb('0xf')];this[_0x19bb('0xb')]=_0x12fffe['countnosuchnumberretry'];this[_0x19bb('0xc')]=_0x12fffe[_0x19bb('0xc')];this[_0x19bb('0xd')]=_0x12fffe[_0x19bb('0xd')];this[_0x19bb('0xe')]=_0x12fffe[_0x19bb('0xe')];this[_0x19bb('0xf')]=_0x12fffe[_0x19bb('0xf')];this['queue']=_0x12fffe[_0x19bb('0x6')];this['calleridname']=_0x12fffe[_0x19bb('0x10')];this[_0x19bb('0x11')]=_0x12fffe[_0x19bb('0x12')];this[_0x19bb('0x13')]=_0x12fffe[_0x19bb('0x13')];this[_0x19bb('0x14')]=_0x12fffe[_0x19bb('0x14')];this[_0x19bb('0x15')]=_0x12fffe['responsetime'];this['ringtime']=utils['getSeconds'](_0x12fffe['responsetime'],_0x12fffe[_0x19bb('0x13')]);this[_0x19bb('0x16')]=0x0;this[_0x19bb('0x17')]=0x0;this[_0x19bb('0x18')]=_0x12fffe[_0x19bb('0x18')];this[_0x19bb('0x19')]=_0x12fffe[_0x19bb('0x19')];this[_0x19bb('0x1a')]=_0x12fffe['callbackat'];this[_0x19bb('0x1b')]=_0x12fffe[_0x19bb('0x1b')];this[_0x19bb('0x1c')]=_0x12fffe[_0x19bb('0x1c')];this[_0x19bb('0x1d')]=_0x12fffe[_0x19bb('0x1d')];this[_0x19bb('0x1e')]=_0x12fffe['UserId'];this[_0x19bb('0x1f')]=_0x12fffe['VoiceQueueId'];this['CampaignId']=_0x12fffe[_0x19bb('0x20')];this[_0x19bb('0x21')]=_0x12fffe[_0x19bb('0x21')]||'';this[_0x19bb('0x22')]=_0x12fffe['originatecalleridname']||'';this[_0x19bb('0x23')]=_0x12fffe['state'];this[_0x19bb('0x24')]=_0x12fffe[_0x19bb('0x24')];}module[_0x19bb('0x25')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/models/queueCallerAbandon.js b/server/services/ami/dialer/models/queueCallerAbandon.js index 383d0c7..dbf9276 100644 --- a/server/services/ami/dialer/models/queueCallerAbandon.js +++ b/server/services/ami/dialer/models/queueCallerAbandon.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5a28=['uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','droptime','dropreason','endtime','ringtime','getSeconds','holdtime','talktime','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','state','statedesc','exports','../utils','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry'];(function(_0x13eea8,_0x5ed8b2){var _0x255a29=function(_0x2fa27e){while(--_0x2fa27e){_0x13eea8['push'](_0x13eea8['shift']());}};_0x255a29(++_0x5ed8b2);}(_0x5a28,0x1c7));var _0x85a2=function(_0x423e4b,_0x1bb75b){_0x423e4b=_0x423e4b-0x0;var _0x626fd4=_0x5a28[_0x423e4b];return _0x626fd4;};'use strict';var utils=require(_0x85a2('0x0'));function QueueCallerAbandon(_0xdc9adc,_0x1d99cf){this[_0x85a2('0x1')]=_0xdc9adc[_0x85a2('0x1')];this['type']=_0xdc9adc[_0x85a2('0x2')];this[_0x85a2('0x3')]=_0xdc9adc[_0x85a2('0x2')]===_0x85a2('0x4')?_0x85a2('0x5'):_0xdc9adc['type'];this[_0x85a2('0x6')]=_0xdc9adc[_0x85a2('0x6')];this[_0x85a2('0x7')]=_0xdc9adc[_0x85a2('0x7')];this[_0x85a2('0x8')]=_0xdc9adc['countnoanswerretry'];this[_0x85a2('0x9')]=_0xdc9adc['countbusyretry']+_0xdc9adc[_0x85a2('0x7')]+_0xdc9adc['countnoanswerretry']+_0xdc9adc[_0x85a2('0xa')]+_0xdc9adc['countdropretry']+_0xdc9adc['countabandonedretry']+_0xdc9adc['countmachineretry']+_0xdc9adc['countagentrejectretry'];this[_0x85a2('0xa')]=_0xdc9adc[_0x85a2('0xa')];this['countdropretry']=_0xdc9adc[_0x85a2('0xb')];this[_0x85a2('0xc')]=_0xdc9adc[_0x85a2('0xc')];this[_0x85a2('0xd')]=_0xdc9adc['countmachineretry'];this['countagentrejectretry']=_0xdc9adc[_0x85a2('0xe')];this[_0x85a2('0xf')]=_0x1d99cf[_0x85a2('0xf')];this[_0x85a2('0x10')]=_0xdc9adc[_0x85a2('0x11')];this[_0x85a2('0x12')]=_0xdc9adc[_0x85a2('0x13')];this['starttime']=_0xdc9adc[_0x85a2('0x14')];this[_0x85a2('0x15')]=_0xdc9adc[_0x85a2('0x15')];this[_0x85a2('0x16')]=_0xdc9adc[_0x85a2('0x16')];this[_0x85a2('0x17')]=_0xdc9adc['dropreason'];this[_0x85a2('0x18')]=this[_0x85a2('0x16')];this[_0x85a2('0x19')]=utils[_0x85a2('0x1a')](_0xdc9adc['responsetime'],_0xdc9adc[_0x85a2('0x14')]);this[_0x85a2('0x1b')]=utils[_0x85a2('0x1a')](this['droptime'],_0xdc9adc[_0x85a2('0x15')]);this[_0x85a2('0x1c')]=0x0;this[_0x85a2('0x5')]=_0x1d99cf['queue'];this[_0x85a2('0x1d')]=_0x1d99cf[_0x85a2('0x1e')];this[_0x85a2('0x1f')]=_0x1d99cf[_0x85a2('0x1f')];this[_0x85a2('0x20')]=_0xdc9adc['callback'];this['callbackuniqueid']=_0xdc9adc[_0x85a2('0x21')];this[_0x85a2('0x22')]=_0xdc9adc['callbackat'];this['recallme']=_0xdc9adc[_0x85a2('0x23')];this[_0x85a2('0x24')]=_0xdc9adc[_0x85a2('0x24')];this[_0x85a2('0x25')]=_0xdc9adc[_0x85a2('0x25')];this['UserId']=_0xdc9adc[_0x85a2('0x26')];this[_0x85a2('0x27')]=_0xdc9adc[_0x85a2('0x27')];this[_0x85a2('0x28')]=_0xdc9adc[_0x85a2('0x28')];this[_0x85a2('0x29')]=_0xdc9adc['originatecalleridnum']||'';this[_0x85a2('0x2a')]=_0xdc9adc[_0x85a2('0x2a')]||'';this[_0x85a2('0x2b')]=_0xdc9adc[_0x85a2('0x2b')];this[_0x85a2('0x2c')]=_0xdc9adc[_0x85a2('0x2c')];this[_0x85a2('0x2d')]=_0xdc9adc[_0x85a2('0x2d')];}module[_0x85a2('0x2e')]=QueueCallerAbandon; \ No newline at end of file +var _0xbeda=['getSeconds','talktime','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','state','statedesc','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','starttime','responsetime','droptime','dropreason','endtime','ringtime'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xbeda,0xda));var _0xabed=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0xbeda[_0x37bd26];return _0xe83dc4;};'use strict';var utils=require('../utils');function QueueCallerAbandon(_0x237369,_0x3ea60b){this[_0xabed('0x0')]=_0x237369[_0xabed('0x0')];this[_0xabed('0x1')]=_0x237369[_0xabed('0x1')];this[_0xabed('0x2')]=_0x237369['type']===_0xabed('0x3')?_0xabed('0x4'):_0x237369[_0xabed('0x1')];this['countbusyretry']=_0x237369[_0xabed('0x5')];this[_0xabed('0x6')]=_0x237369[_0xabed('0x6')];this[_0xabed('0x7')]=_0x237369['countnoanswerretry'];this[_0xabed('0x8')]=_0x237369[_0xabed('0x5')]+_0x237369[_0xabed('0x6')]+_0x237369[_0xabed('0x7')]+_0x237369[_0xabed('0x9')]+_0x237369[_0xabed('0xa')]+_0x237369['countabandonedretry']+_0x237369[_0xabed('0xb')]+_0x237369['countagentrejectretry'];this[_0xabed('0x9')]=_0x237369['countnosuchnumberretry'];this['countdropretry']=_0x237369[_0xabed('0xa')];this['countabandonedretry']=_0x237369['countabandonedretry'];this['countmachineretry']=_0x237369['countmachineretry'];this[_0xabed('0xc')]=_0x237369[_0xabed('0xc')];this[_0xabed('0xd')]=_0x3ea60b[_0xabed('0xd')];this[_0xabed('0xe')]=_0x237369[_0xabed('0xf')];this['calleridnum']=_0x237369['number'];this[_0xabed('0x10')]=_0x237369[_0xabed('0x10')];this[_0xabed('0x11')]=_0x237369[_0xabed('0x11')];this[_0xabed('0x12')]=_0x237369[_0xabed('0x12')];this[_0xabed('0x13')]=_0x237369[_0xabed('0x13')];this[_0xabed('0x14')]=this[_0xabed('0x12')];this[_0xabed('0x15')]=utils[_0xabed('0x16')](_0x237369['responsetime'],_0x237369[_0xabed('0x10')]);this['holdtime']=utils[_0xabed('0x16')](this['droptime'],_0x237369['responsetime']);this[_0xabed('0x17')]=0x0;this[_0xabed('0x4')]=_0x3ea60b[_0xabed('0x4')];this['membername']=_0x3ea60b[_0xabed('0x18')];this[_0xabed('0x19')]=_0x3ea60b['reason'];this['callback']=_0x237369[_0xabed('0x1a')];this[_0xabed('0x1b')]=_0x237369[_0xabed('0x1b')];this[_0xabed('0x1c')]=_0x237369[_0xabed('0x1c')];this[_0xabed('0x1d')]=_0x237369['recallme'];this[_0xabed('0x1e')]=_0x237369[_0xabed('0x1e')];this[_0xabed('0x1f')]=_0x237369[_0xabed('0x1f')];this[_0xabed('0x20')]=_0x237369['UserId'];this['VoiceQueueId']=_0x237369[_0xabed('0x21')];this[_0xabed('0x22')]=_0x237369[_0xabed('0x22')];this[_0xabed('0x23')]=_0x237369[_0xabed('0x23')]||'';this[_0xabed('0x24')]=_0x237369[_0xabed('0x24')]||'';this[_0xabed('0x25')]=_0x237369[_0xabed('0x25')];this[_0xabed('0x26')]=_0x237369[_0xabed('0x26')];this[_0xabed('0x27')]=_0x237369[_0xabed('0x27')];}module['exports']=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/dialer/utils/hopper.js b/server/services/ami/dialer/utils/hopper.js index 91b3462..478ff6a 100644 --- a/server/services/ami/dialer/utils/hopper.js +++ b/server/services/ami/dialer/utils/hopper.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf61e=['dialer','../../rpc/cmHopper','../../rpc/cmHopperAdditionalPhone','../../rpc/cmHopperBlack','../../rpc/cmHopperHistory','inspect','dialOrderByScheduledAt','catch','temp','error','[getContactDialer]','getContactDialerIvr','[getContactDialerIvr]','countReScheduled','rescheduleContact','[unlockContact]','unlockContact','moveContactManagedDialer','[checkIsBlackList]','checkIsBlackList','checkIsBlackListIvr','[verifyAdditionalPhone]','verifyAdditionalPhones','swapAdditionalPhones','[swapAdditionalPhone]','avgHandleTime','[avgHandleTime]','createHistory','[createHistory]','util','../../../../config/logger'];(function(_0x4e9628,_0x250573){var _0x27bc8c=function(_0xb3b7ae){while(--_0xb3b7ae){_0x4e9628['push'](_0x4e9628['shift']());}};_0x27bc8c(++_0x250573);}(_0xf61e,0x191));var _0xef61=function(_0x337044,_0x55a11a){_0x337044=_0x337044-0x0;var _0x299321=_0xf61e[_0x337044];return _0x299321;};'use strict';var util=require(_0xef61('0x0'));var logger=require(_0xef61('0x1'))(_0xef61('0x2'));var cmHopper=require(_0xef61('0x3'));var cmHopperAdditionalPhone=require(_0xef61('0x4'));var cmHopperBlack=require(_0xef61('0x5'));var cmHopperHistory=require(_0xef61('0x6'));function inspectError(_0x40509e){return util[_0xef61('0x7')](_0x40509e,{'showHidden':![],'depth':null});}function getContactDialer(_0x14122a,_0x239fa9,_0x45a18d){return cmHopper['getContactDialer'](_0x14122a['id'],_0x239fa9,_0x45a18d,_0x14122a[_0xef61('0x8')])[_0xef61('0x9')](function(_0x4f0cc5){_0x14122a[_0xef61('0xa')]=0x0;logger[_0xef61('0xb')](_0xef61('0xc'),inspectError(_0x4f0cc5));});}exports['getContactDialer']=getContactDialer;function getContactDialerIvr(_0x47d0a7,_0x188894){return cmHopper[_0xef61('0xd')](_0x47d0a7['id'],_0x188894,_0x47d0a7[_0xef61('0x8')])[_0xef61('0x9')](function(_0x2af74c){_0x47d0a7[_0xef61('0xa')]=0x0;logger[_0xef61('0xb')](_0xef61('0xe'),inspectError(_0x2af74c));});}exports[_0xef61('0xd')]=getContactDialerIvr;function countReScheduled(_0x66e7b2){return cmHopper[_0xef61('0xf')](_0x66e7b2)[_0xef61('0x9')](function(_0x114e1f){logger[_0xef61('0xb')]('[countReScheduled]',inspectError(_0x114e1f));});}exports[_0xef61('0xf')]=countReScheduled;function rescheduleContact(_0x58d9a0){return cmHopper[_0xef61('0x10')](_0x58d9a0)[_0xef61('0x9')](function(_0x370ee0){logger[_0xef61('0xb')]('[rescheduleContact]',inspectError(_0x370ee0));});}exports[_0xef61('0x10')]=rescheduleContact;function unlockContact(_0x435beb,_0x1224c2,_0x78ff22){return cmHopper['unlockContact'](_0x435beb,_0x1224c2,_0x78ff22)[_0xef61('0x9')](function(_0xbe23a7){logger['error'](_0xef61('0x11'),inspectError(_0xbe23a7));});}exports[_0xef61('0x12')]=unlockContact;function moveContactManagedDialer(_0x36f558){return cmHopper[_0xef61('0x13')](_0x36f558)[_0xef61('0x9')](function(_0x28315a){logger[_0xef61('0xb')]('[moveContactManagedDialer]',inspectError(_0x28315a));});}exports[_0xef61('0x13')]=moveContactManagedDialer;function checkIsBlackList(_0x2c8dad){return cmHopperBlack['checkIsBlackList'](_0x2c8dad)[_0xef61('0x9')](function(_0x36966a){logger[_0xef61('0xb')](_0xef61('0x14'),inspectError(_0x36966a));});}exports[_0xef61('0x15')]=checkIsBlackList;function checkIsBlackListIvr(_0x2ed61e){return cmHopperBlack[_0xef61('0x16')](_0x2ed61e)['catch'](function(_0x536e9e){logger[_0xef61('0xb')]('[checkIsBlackListIvr]',inspectError(_0x536e9e));});}exports[_0xef61('0x16')]=checkIsBlackListIvr;function verifyAdditionalPhones(_0x5ae7a2,_0x488b47,_0x2f0569){return cmHopperAdditionalPhone['verifyAdditionalPhones'](_0x5ae7a2,_0x488b47,_0x2f0569)['catch'](function(_0xfbee94){logger[_0xef61('0xb')](_0xef61('0x17'),inspectError(_0xfbee94));});}exports[_0xef61('0x18')]=verifyAdditionalPhones;function swapAdditionalPhones(_0x5e56da,_0x16b144,_0x4e738f){return cmHopperAdditionalPhone[_0xef61('0x19')](_0x5e56da,_0x16b144,_0x4e738f)[_0xef61('0x9')](function(_0x2419a9){logger[_0xef61('0xb')](_0xef61('0x1a'),inspectError(_0x2419a9));});}exports[_0xef61('0x19')]=swapAdditionalPhones;function avgHandleTime(_0x258b5a){return cmHopperHistory[_0xef61('0x1b')](_0x258b5a)[_0xef61('0x9')](function(_0x1ee27b){logger[_0xef61('0xb')](_0xef61('0x1c'),inspectError(_0x1ee27b));});}exports[_0xef61('0x1b')]=avgHandleTime;function createHistory(_0x63edd4){return cmHopperHistory[_0xef61('0x1d')](_0x63edd4)[_0xef61('0x9')](function(_0x39c15e){logger[_0xef61('0xb')](_0xef61('0x1e'),inspectError(_0x39c15e));});}exports[_0xef61('0x1d')]=createHistory; \ No newline at end of file +var _0xf494=['[checkIsBlackListIvr]','verifyAdditionalPhones','swapAdditionalPhones','[swapAdditionalPhone]','avgHandleTime','[avgHandleTime]','util','../../../../config/logger','dialer','../../rpc/cmHopperAdditionalPhone','../../rpc/cmHopperBlack','../../rpc/cmHopperHistory','inspect','getContactDialer','dialOrderByScheduledAt','catch','error','[getContactDialer]','getContactDialerIvr','temp','[countReScheduled]','countReScheduled','rescheduleContact','unlockContact','moveContactManagedDialer','checkIsBlackList','[checkIsBlackList]','checkIsBlackListIvr'];(function(_0x1589dd,_0x2b9d22){var _0x1bddd1=function(_0x3687f8){while(--_0x3687f8){_0x1589dd['push'](_0x1589dd['shift']());}};_0x1bddd1(++_0x2b9d22);}(_0xf494,0x1c6));var _0x4f49=function(_0x4b34b8,_0x4b25a0){_0x4b34b8=_0x4b34b8-0x0;var _0x5c7e3a=_0xf494[_0x4b34b8];return _0x5c7e3a;};'use strict';var util=require(_0x4f49('0x0'));var logger=require(_0x4f49('0x1'))(_0x4f49('0x2'));var cmHopper=require('../../rpc/cmHopper');var cmHopperAdditionalPhone=require(_0x4f49('0x3'));var cmHopperBlack=require(_0x4f49('0x4'));var cmHopperHistory=require(_0x4f49('0x5'));function inspectError(_0x25677c){return util[_0x4f49('0x6')](_0x25677c,{'showHidden':![],'depth':null});}function getContactDialer(_0x2a15fb,_0x3267c1,_0x790e8b){return cmHopper[_0x4f49('0x7')](_0x2a15fb['id'],_0x3267c1,_0x790e8b,_0x2a15fb[_0x4f49('0x8')])[_0x4f49('0x9')](function(_0x5eb186){_0x2a15fb['temp']=0x0;logger[_0x4f49('0xa')](_0x4f49('0xb'),inspectError(_0x5eb186));});}exports[_0x4f49('0x7')]=getContactDialer;function getContactDialerIvr(_0x30ca57,_0x185174){return cmHopper[_0x4f49('0xc')](_0x30ca57['id'],_0x185174,_0x30ca57[_0x4f49('0x8')])[_0x4f49('0x9')](function(_0x53ee74){_0x30ca57[_0x4f49('0xd')]=0x0;logger[_0x4f49('0xa')]('[getContactDialerIvr]',inspectError(_0x53ee74));});}exports[_0x4f49('0xc')]=getContactDialerIvr;function countReScheduled(_0x5bbc75){return cmHopper['countReScheduled'](_0x5bbc75)[_0x4f49('0x9')](function(_0x12527d){logger['error'](_0x4f49('0xe'),inspectError(_0x12527d));});}exports[_0x4f49('0xf')]=countReScheduled;function rescheduleContact(_0x1b9145){return cmHopper[_0x4f49('0x10')](_0x1b9145)[_0x4f49('0x9')](function(_0x2f0131){logger[_0x4f49('0xa')]('[rescheduleContact]',inspectError(_0x2f0131));});}exports[_0x4f49('0x10')]=rescheduleContact;function unlockContact(_0x1f2d0d,_0x415e83,_0x5878f4){return cmHopper['unlockContact'](_0x1f2d0d,_0x415e83,_0x5878f4)[_0x4f49('0x9')](function(_0x2ecaaa){logger[_0x4f49('0xa')]('[unlockContact]',inspectError(_0x2ecaaa));});}exports[_0x4f49('0x11')]=unlockContact;function moveContactManagedDialer(_0x399be7){return cmHopper[_0x4f49('0x12')](_0x399be7)['catch'](function(_0x5bb23b){logger['error']('[moveContactManagedDialer]',inspectError(_0x5bb23b));});}exports[_0x4f49('0x12')]=moveContactManagedDialer;function checkIsBlackList(_0x1834f4){return cmHopperBlack[_0x4f49('0x13')](_0x1834f4)[_0x4f49('0x9')](function(_0x5793ac){logger[_0x4f49('0xa')](_0x4f49('0x14'),inspectError(_0x5793ac));});}exports[_0x4f49('0x13')]=checkIsBlackList;function checkIsBlackListIvr(_0xaab5e7){return cmHopperBlack[_0x4f49('0x15')](_0xaab5e7)['catch'](function(_0x3e7e28){logger[_0x4f49('0xa')](_0x4f49('0x16'),inspectError(_0x3e7e28));});}exports['checkIsBlackListIvr']=checkIsBlackListIvr;function verifyAdditionalPhones(_0x40755e,_0x1d70a7,_0x32ca7b){return cmHopperAdditionalPhone[_0x4f49('0x17')](_0x40755e,_0x1d70a7,_0x32ca7b)[_0x4f49('0x9')](function(_0x36187b){logger['error']('[verifyAdditionalPhone]',inspectError(_0x36187b));});}exports[_0x4f49('0x17')]=verifyAdditionalPhones;function swapAdditionalPhones(_0x429de7,_0x4fedbb,_0x408552){return cmHopperAdditionalPhone[_0x4f49('0x18')](_0x429de7,_0x4fedbb,_0x408552)[_0x4f49('0x9')](function(_0x525950){logger[_0x4f49('0xa')](_0x4f49('0x19'),inspectError(_0x525950));});}exports[_0x4f49('0x18')]=swapAdditionalPhones;function avgHandleTime(_0x148153){return cmHopperHistory[_0x4f49('0x1a')](_0x148153)[_0x4f49('0x9')](function(_0x4915af){logger['error'](_0x4f49('0x1b'),inspectError(_0x4915af));});}exports[_0x4f49('0x1a')]=avgHandleTime;function createHistory(_0x605c91){return cmHopperHistory['createHistory'](_0x605c91)[_0x4f49('0x9')](function(_0x206203){logger[_0x4f49('0xa')]('[createHistory]',inspectError(_0x206203));});}exports['createHistory']=createHistory; \ No newline at end of file diff --git a/server/services/ami/dialer/utils/index.js b/server/services/ami/dialer/utils/index.js index e62c0ae..e394da5 100644 --- a/server/services/ami/dialer/utils/index.js +++ b/server/services/ami/dialer/utils/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdca6=['timezones','ACTIVE','RESCHEDULED_CONTACTS','DEACTIVATED','IS_DISACTIVED','INTERVAL_IS_EMPTY','NOT_ACTIVE','AVAILABLE_CONTACTS_FINISHED','RECALLFAILEDTIMEOUT','RUNNING','TIMEZONE_UNKNOW','TRUNK_IS_NOT_REACHABLE','CAMPAIGN_STATUS','dialMethod','preview','isIVRCampaign','type','isOutboundQueue','dialActive','isQueueCampaignActive','active','milliseconds','diff','seconds','getSeconds','message','available','loggedIn','loggedInDb','talking','pTalking','waiting','inUse','originated','Trunk','name','hasQueueCampaignDataChanged','dialTimezone','dialGlobalInterval','isNil','Interval','Intervals','NULL_INTERVAL','isEmpty','EMPTY_INTERVAL','SIP/','reachable','unmonitored','status','TrunkBackup','includes','INACTIVE','DISACTIVED','NO_AGENTS_LOGGED','UNREACHABLE_TRUNK','getQueueCampaignActiveStatusMessage','match','extractCalleridName','isUndefined','string','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','getCallerId','\x5cw{0,','replace','toString','getCallerIdRandom','[decrementOriginate]\x20queue\x20originate\x20value\x20is\x20negative','decrementOriginate','length','checkContactEmpty','checkContactLowerLimitOriginate','tags','undefined','XMD-','toUpperCase','substring','lodash','util','dialer','../../../../config/environment/shared'];(function(_0x39a7b3,_0x9c5210){var _0x1e25e2=function(_0x530d86){while(--_0x530d86){_0x39a7b3['push'](_0x39a7b3['shift']());}};_0x1e25e2(++_0x9c5210);}(_0xdca6,0x1e8));var _0x6dca=function(_0x505a5c,_0x2dd55b){_0x505a5c=_0x505a5c-0x0;var _0x520802=_0xdca6[_0x505a5c];return _0x520802;};'use strict';var _=require(_0x6dca('0x0'));var moment=require('moment');var util=require(_0x6dca('0x1'));var logger=require('../../../../config/logger')(_0x6dca('0x2'));var timezones=require(_0x6dca('0x3'))[_0x6dca('0x4')];var CAMPAIGN_STATUS={'ACTIVE':_0x6dca('0x5'),'BLACKLIST':'BLACKLIST','CONTACTS_RESCHEDULED':_0x6dca('0x6'),'DEACTIVATED':_0x6dca('0x7'),'DISACTIVED':_0x6dca('0x8'),'EMPTY_INTERVAL':_0x6dca('0x9'),'INACTIVE':_0x6dca('0xa'),'NO_AGENTS_LOGGED':'AGENTS_NOT_LOGGED','NO_AVAILABLE_CONTACTS':_0x6dca('0xb'),'NULL_INTERVAL':'INTERVAL_IS_NULL','OVERTIME_INTERVAL':'INTERVAL_IS_OVERTIME','OVERTIME_GLOBAL_INTERVAL':'GLOBAL_INTERVAL_IS_OVERTIME','QUEUE_RECALL':'RECALLINQUEUE','RECALL_TIMEOUT':_0x6dca('0xc'),'RUNNING':_0x6dca('0xd'),'UNKNOWN_TIMEZONE':_0x6dca('0xe'),'UNREACHABLE_TRUNK':_0x6dca('0xf')};exports[_0x6dca('0x10')]=CAMPAIGN_STATUS;function isPreviewCampaign(_0x3554cf){return _0x3554cf[_0x6dca('0x11')]===_0x6dca('0x12');}exports['isPreviewCampaign']=isPreviewCampaign;function isIVRCampaign(_0x3b7e78){return _0x3b7e78['type']==='ivr';}exports[_0x6dca('0x13')]=isIVRCampaign;function isOutboundQueue(_0x145ab2){return _0x145ab2[_0x6dca('0x14')]==='outbound';}exports[_0x6dca('0x15')]=isOutboundQueue;function isQueueCampaignActive(_0x387fa1){return _0x387fa1[_0x6dca('0x16')];}exports[_0x6dca('0x17')]=isQueueCampaignActive;function isIVRCampaignActive(_0x108964){return _0x108964[_0x6dca('0x18')];}exports['isIVRCampaignActive']=isIVRCampaignActive;function getSeconds(_0x4ba434,_0xa384ae){var _0x14d77b=moment(_0x4ba434)[_0x6dca('0x19')](0x0);var _0x4a5faa=moment(_0xa384ae)[_0x6dca('0x19')](0x0);return _0x14d77b[_0x6dca('0x1a')](_0x4a5faa,_0x6dca('0x1b'));}exports[_0x6dca('0x1c')]=getSeconds;function hasQueueCampaignDataChanged(_0x27d13f,_0xcb3d89){var _0x226176=![];var _0x5850d9=_0x27d13f['dialMethod']!==_0xcb3d89[_0x6dca('0x11')]||_0x27d13f[_0x6dca('0x16')]!==_0xcb3d89[_0x6dca('0x16')]||_0x27d13f[_0x6dca('0x1d')]!==_0xcb3d89[_0x6dca('0x1d')];var _0x30e7dc=_0x27d13f['available']!==_0xcb3d89[_0x6dca('0x1e')]||_0x27d13f[_0x6dca('0x1f')]!==_0xcb3d89[_0x6dca('0x1f')]||_0x27d13f[_0x6dca('0x20')]!==_0xcb3d89[_0x6dca('0x20')]||_0x27d13f['paused']!==_0xcb3d89['paused']||_0x27d13f[_0x6dca('0x21')]!==_0xcb3d89[_0x6dca('0x21')]||_0x27d13f[_0x6dca('0x22')]!==_0xcb3d89[_0x6dca('0x22')]||_0x27d13f[_0x6dca('0x23')]!==_0xcb3d89[_0x6dca('0x23')]||_0x27d13f[_0x6dca('0x24')]!==_0xcb3d89[_0x6dca('0x24')]||_0x27d13f[_0x6dca('0x25')]!==_0xcb3d89[_0x6dca('0x25')];if(_0x27d13f[_0x6dca('0x26')]&&_0xcb3d89[_0x6dca('0x26')]){_0x226176=_0x27d13f[_0x6dca('0x26')][_0x6dca('0x27')]!==_0xcb3d89[_0x6dca('0x26')][_0x6dca('0x27')]||_0x27d13f[_0x6dca('0x26')][_0x6dca('0x18')]!==_0xcb3d89['Trunk'][_0x6dca('0x18')];}return _0x5850d9||_0x30e7dc||_0x226176;}exports[_0x6dca('0x28')]=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x2acb75){var _0x59eda2=null;var _0x10b516=_0x2acb75[_0x6dca('0x29')];if(_['isNil'](_0x2acb75[_0x6dca('0x2a')])||_[_0x6dca('0x2b')](_0x2acb75[_0x6dca('0x2c')])||_[_0x6dca('0x2b')](_0x2acb75['Interval'][_0x6dca('0x2d')])){_0x59eda2=CAMPAIGN_STATUS[_0x6dca('0x2e')];}else if(_[_0x6dca('0x2f')](_0x2acb75[_0x6dca('0x2a')])||_[_0x6dca('0x2f')](_0x2acb75['Interval'][_0x6dca('0x2d')])){_0x59eda2=CAMPAIGN_STATUS[_0x6dca('0x30')];}else if(_0x10b516&&!timezones[_0x10b516]){_0x59eda2=CAMPAIGN_STATUS['UNKNOWN_TIMEZONE'];}return _0x59eda2;}function checkAnyValidTrunk(_0x5b8d62,_0x1bc091){var _0x3722d8=null;var _0x31c7e6=_0x6dca('0x31');var _0x351cf2=[_0x6dca('0x32'),_0x6dca('0x33')];var _0x29ff6d=!![];if(_0x5b8d62[_0x6dca('0x26')]&&_0x5b8d62[_0x6dca('0x26')][_0x6dca('0x18')]){_0x31c7e6+=_0x5b8d62[_0x6dca('0x26')]['name'];_0x3722d8=_0x1bc091[_0x31c7e6];_0x29ff6d=_0x351cf2['includes'](_0x3722d8[_0x6dca('0x34')]);}else if(_0x5b8d62[_0x6dca('0x35')]&&_0x5b8d62[_0x6dca('0x35')][_0x6dca('0x18')]){_0x31c7e6+=_0x5b8d62['TrunkBackup'][_0x6dca('0x27')];_0x3722d8=_0x1bc091[_0x31c7e6];_0x29ff6d=_0x351cf2[_0x6dca('0x36')](_0x3722d8[_0x6dca('0x34')]);}return _0x29ff6d;}function getQueueCampaignStatusMessage(_0x2b7b20,_0x377d37){var _0x58d988=CAMPAIGN_STATUS[_0x6dca('0x5')];var _0x321d0e=isPreviewCampaign(_0x2b7b20);if(!isQueueCampaignActive(_0x2b7b20)){if(_0x321d0e){_0x58d988=CAMPAIGN_STATUS['INACTIVE'];}else{if(_0x2b7b20[_0x6dca('0x25')]===0x0&&_0x2b7b20[_0x6dca('0x21')]===0x0&&_0x2b7b20[_0x6dca('0x23')]===0x0&&(_0x2b7b20[_0x6dca('0x22')]||0x0)===0x0){_0x58d988=CAMPAIGN_STATUS[_0x6dca('0x37')];}else{_0x58d988=CAMPAIGN_STATUS[_0x6dca('0x38')];}}}else if(_0x2b7b20['loggedIn']===0x0){_0x58d988=CAMPAIGN_STATUS[_0x6dca('0x39')];}else if(!checkAnyValidTrunk(_0x2b7b20,_0x377d37)){_0x58d988=CAMPAIGN_STATUS[_0x6dca('0x3a')];}else if(!isPreviewCampaign(_0x2b7b20)){var _0x414020=checkAnyValidQueueCampaignInterval(_0x2b7b20);if(_0x414020){_0x58d988=_0x414020;}}return _0x58d988;}exports['getQueueCampaignStatusMessage']=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x238d3c){var _0x4b3bcb=CAMPAIGN_STATUS['DISACTIVED'];if(_0x238d3c[_0x6dca('0x25')]===0x0&&_0x238d3c[_0x6dca('0x21')]===0x0&&_0x238d3c[_0x6dca('0x23')]===0x0&&(_0x238d3c[_0x6dca('0x22')]||0x0)===0x0){_0x4b3bcb=CAMPAIGN_STATUS[_0x6dca('0x37')];}return _0x4b3bcb;}exports[_0x6dca('0x3b')]=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x1aa269){var _0x5093e7=_0x1aa269[_0x6dca('0x3c')](/"(.*?)"/);return _0x5093e7?_0x5093e7[0x1]:_0x1aa269;}exports[_0x6dca('0x3d')]=extractCalleridName;function getCallerId(_0x4d4bef,_0x3d38a4,_0x1b6818){if(!_[_0x6dca('0x3e')](_0x1b6818)&&typeof _0x1b6818===_0x6dca('0x3f')&&!_[_0x6dca('0x2f')](_0x1b6818)){if(!_[_0x6dca('0x3e')](_0x3d38a4)&&typeof _0x3d38a4===_0x6dca('0x3f')&&!_[_0x6dca('0x2f')](_0x3d38a4)){return util[_0x6dca('0x40')]('\x22%s\x22\x20<%s>',_0x3d38a4,_0x1b6818);}return util[_0x6dca('0x40')](_0x6dca('0x41'),_0x1b6818,_0x1b6818);}if(!_['isUndefined'](_0x4d4bef)&&typeof _0x4d4bef===_0x6dca('0x3f')&&!_[_0x6dca('0x2f')](_0x4d4bef)){return _0x4d4bef;}return _0x6dca('0x42');}exports[_0x6dca('0x43')]=getCallerId;function getCallerIdRandom(_0x2effa5,_0x3821d5){var _0x3d8ce9;var _0x1c64b2;var _0x28f264;if(_0x3821d5<=0x0){_0x3821d5=0x1;}_0x3d8ce9=new RegExp(_0x6dca('0x44')+_0x3821d5+'}$');_0x1c64b2=Math['pow'](0xa,_0x3821d5-0x1);_0x28f264=Math['pow'](0xa,_0x3821d5)-0x1;return util['format']('%s',_[_0x6dca('0x45')](_0x2effa5,_0x3d8ce9,_['random'](_0x1c64b2,_0x28f264)[_0x6dca('0x46')]()));}exports[_0x6dca('0x47')]=getCallerIdRandom;function decrementOriginate(_0x3525b5){if(_0x3525b5[_0x6dca('0x25')]&&_0x3525b5[_0x6dca('0x25')]>0x0){_0x3525b5['originated']-=0x1;}else{logger['error'](_0x6dca('0x48'));}}exports[_0x6dca('0x49')]=decrementOriginate;function checkContactEmpty(_0x287708){return _0x287708&&_0x287708[_0x6dca('0x4a')]>0x0;}exports[_0x6dca('0x4b')]=checkContactEmpty;function erlangb(_0x2f1794,_0x30ae3b){if(_0x30ae3b===0x0){return 0x0;}var _0x6854f0=0x1;for(var _0x2fa4ce=0x1;_0x2fa4ce<=_0x30ae3b;_0x2fa4ce+=0x1){_0x6854f0=0x1+_0x6854f0*_0x2fa4ce/_0x2f1794;}return 0x1/_0x6854f0;}exports['erlangb']=erlangb;function checkContactLowerLimitOriginate(_0x1ee03d,_0x4d9946,_0x547603){if(_0x4d9946>_0x547603){for(var _0x1ac223=0x0;_0x1ac223<_0x4d9946-_0x547603;_0x1ac223+=0x1){decrementOriginate(_0x1ee03d);}}}exports[_0x6dca('0x4c')]=checkContactLowerLimitOriginate;function setXMDContactVariables(_0x2188e5){var _0x18ef31={};var _0x1ac5c1=['id','createdAt',_0x6dca('0x4d'),'updatedAt'];const _0x3c0e67=0xfa;if(_0x2188e5){for(var _0x456154 in _0x2188e5){if(typeof _0x2188e5[_0x456154]!==_0x6dca('0x4e')){if(!_[_0x6dca('0x2b')](_0x2188e5[_0x456154])&&!_0x1ac5c1[_0x6dca('0x36')](_0x456154)){if(_0x456154==='description'&&_0x2188e5[_0x456154][_0x6dca('0x4a')]>_0x3c0e67){_0x18ef31[_0x6dca('0x4f')+_0x456154[_0x6dca('0x50')]()]=_0x2188e5[_0x456154][_0x6dca('0x46')]()[_0x6dca('0x51')](0x0,_0x3c0e67);}else{_0x18ef31[_0x6dca('0x4f')+_0x456154['toUpperCase']()]=_0x2188e5[_0x456154];}}}}}return _0x18ef31;}exports['setXMDContactVariables']=setXMDContactVariables; \ No newline at end of file +var _0xf740=['loggedIn','loggedInDb','paused','talking','pTalking','waiting','inUse','originated','Trunk','hasQueueCampaignDataChanged','dialTimezone','isNil','Interval','isEmpty','dialGlobalInterval','Intervals','UNKNOWN_TIMEZONE','SIP/','unmonitored','name','TrunkBackup','status','INACTIVE','DISACTIVED','NO_AGENTS_LOGGED','getQueueCampaignActiveStatusMessage','match','extractCalleridName','string','isUndefined','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','getCallerId','\x5cw{0,','pow','toString','getCallerIdRandom','[decrementOriginate]\x20queue\x20originate\x20value\x20is\x20negative','decrementOriginate','length','checkContactEmpty','erlangb','tags','undefined','description','substring','XMD-','toUpperCase','setXMDContactVariables','util','../../../../config/logger','../../../../config/environment/shared','timezones','ACTIVE','BLACKLIST','DEACTIVATED','IS_DISACTIVED','INTERVAL_IS_EMPTY','NOT_ACTIVE','AGENTS_NOT_LOGGED','AVAILABLE_CONTACTS_FINISHED','INTERVAL_IS_NULL','INTERVAL_IS_OVERTIME','GLOBAL_INTERVAL_IS_OVERTIME','TRUNK_IS_NOT_REACHABLE','dialMethod','preview','isPreviewCampaign','type','ivr','isIVRCampaign','outbound','isOutboundQueue','dialActive','isQueueCampaignActive','active','isIVRCampaignActive','milliseconds','diff','seconds','message','available'];(function(_0x3d6dd3,_0x312f54){var _0x38a37c=function(_0x1c8d68){while(--_0x1c8d68){_0x3d6dd3['push'](_0x3d6dd3['shift']());}};_0x38a37c(++_0x312f54);}(_0xf740,0x85));var _0x0f74=function(_0x4c3070,_0xc2fb4c){_0x4c3070=_0x4c3070-0x0;var _0x536a44=_0xf740[_0x4c3070];return _0x536a44;};'use strict';var _=require('lodash');var moment=require('moment');var util=require(_0x0f74('0x0'));var logger=require(_0x0f74('0x1'))('dialer');var timezones=require(_0x0f74('0x2'))[_0x0f74('0x3')];var CAMPAIGN_STATUS={'ACTIVE':_0x0f74('0x4'),'BLACKLIST':_0x0f74('0x5'),'CONTACTS_RESCHEDULED':'RESCHEDULED_CONTACTS','DEACTIVATED':_0x0f74('0x6'),'DISACTIVED':_0x0f74('0x7'),'EMPTY_INTERVAL':_0x0f74('0x8'),'INACTIVE':_0x0f74('0x9'),'NO_AGENTS_LOGGED':_0x0f74('0xa'),'NO_AVAILABLE_CONTACTS':_0x0f74('0xb'),'NULL_INTERVAL':_0x0f74('0xc'),'OVERTIME_INTERVAL':_0x0f74('0xd'),'OVERTIME_GLOBAL_INTERVAL':_0x0f74('0xe'),'QUEUE_RECALL':'RECALLINQUEUE','RECALL_TIMEOUT':'RECALLFAILEDTIMEOUT','RUNNING':'RUNNING','UNKNOWN_TIMEZONE':'TIMEZONE_UNKNOW','UNREACHABLE_TRUNK':_0x0f74('0xf')};exports['CAMPAIGN_STATUS']=CAMPAIGN_STATUS;function isPreviewCampaign(_0x3aa9cb){return _0x3aa9cb[_0x0f74('0x10')]===_0x0f74('0x11');}exports[_0x0f74('0x12')]=isPreviewCampaign;function isIVRCampaign(_0x32e29f){return _0x32e29f[_0x0f74('0x13')]===_0x0f74('0x14');}exports[_0x0f74('0x15')]=isIVRCampaign;function isOutboundQueue(_0x2ed5e4){return _0x2ed5e4[_0x0f74('0x13')]===_0x0f74('0x16');}exports[_0x0f74('0x17')]=isOutboundQueue;function isQueueCampaignActive(_0x9575a){return _0x9575a[_0x0f74('0x18')];}exports[_0x0f74('0x19')]=isQueueCampaignActive;function isIVRCampaignActive(_0x2cd595){return _0x2cd595[_0x0f74('0x1a')];}exports[_0x0f74('0x1b')]=isIVRCampaignActive;function getSeconds(_0x19a35e,_0x13d3ce){var _0x27f099=moment(_0x19a35e)['milliseconds'](0x0);var _0x45bf22=moment(_0x13d3ce)[_0x0f74('0x1c')](0x0);return _0x27f099[_0x0f74('0x1d')](_0x45bf22,_0x0f74('0x1e'));}exports['getSeconds']=getSeconds;function hasQueueCampaignDataChanged(_0x143ca9,_0x4e409e){var _0xa48f8b=![];var _0x1f45eb=_0x143ca9['dialMethod']!==_0x4e409e[_0x0f74('0x10')]||_0x143ca9[_0x0f74('0x18')]!==_0x4e409e['dialActive']||_0x143ca9[_0x0f74('0x1f')]!==_0x4e409e[_0x0f74('0x1f')];var _0xf3810=_0x143ca9['available']!==_0x4e409e[_0x0f74('0x20')]||_0x143ca9[_0x0f74('0x21')]!==_0x4e409e[_0x0f74('0x21')]||_0x143ca9[_0x0f74('0x22')]!==_0x4e409e['loggedInDb']||_0x143ca9[_0x0f74('0x23')]!==_0x4e409e[_0x0f74('0x23')]||_0x143ca9['talking']!==_0x4e409e[_0x0f74('0x24')]||_0x143ca9['pTalking']!==_0x4e409e[_0x0f74('0x25')]||_0x143ca9[_0x0f74('0x26')]!==_0x4e409e['waiting']||_0x143ca9[_0x0f74('0x27')]!==_0x4e409e[_0x0f74('0x27')]||_0x143ca9[_0x0f74('0x28')]!==_0x4e409e[_0x0f74('0x28')];if(_0x143ca9[_0x0f74('0x29')]&&_0x4e409e[_0x0f74('0x29')]){_0xa48f8b=_0x143ca9['Trunk']['name']!==_0x4e409e['Trunk']['name']||_0x143ca9['Trunk'][_0x0f74('0x1a')]!==_0x4e409e['Trunk'][_0x0f74('0x1a')];}return _0x1f45eb||_0xf3810||_0xa48f8b;}exports[_0x0f74('0x2a')]=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x445ca0){var _0x4cf566=null;var _0x30dc63=_0x445ca0[_0x0f74('0x2b')];if(_[_0x0f74('0x2c')](_0x445ca0['dialGlobalInterval'])||_[_0x0f74('0x2c')](_0x445ca0['Interval'])||_[_0x0f74('0x2c')](_0x445ca0[_0x0f74('0x2d')]['Intervals'])){_0x4cf566=CAMPAIGN_STATUS['NULL_INTERVAL'];}else if(_[_0x0f74('0x2e')](_0x445ca0[_0x0f74('0x2f')])||_[_0x0f74('0x2e')](_0x445ca0[_0x0f74('0x2d')][_0x0f74('0x30')])){_0x4cf566=CAMPAIGN_STATUS['EMPTY_INTERVAL'];}else if(_0x30dc63&&!timezones[_0x30dc63]){_0x4cf566=CAMPAIGN_STATUS[_0x0f74('0x31')];}return _0x4cf566;}function checkAnyValidTrunk(_0x43cda8,_0x89cea9){var _0x3fefbc=null;var _0x301821=_0x0f74('0x32');var _0x254309=['reachable',_0x0f74('0x33')];var _0x54d84e=!![];if(_0x43cda8[_0x0f74('0x29')]&&_0x43cda8[_0x0f74('0x29')][_0x0f74('0x1a')]){_0x301821+=_0x43cda8[_0x0f74('0x29')][_0x0f74('0x34')];_0x3fefbc=_0x89cea9[_0x301821];_0x54d84e=_0x254309['includes'](_0x3fefbc['status']);}else if(_0x43cda8[_0x0f74('0x35')]&&_0x43cda8[_0x0f74('0x35')][_0x0f74('0x1a')]){_0x301821+=_0x43cda8[_0x0f74('0x35')][_0x0f74('0x34')];_0x3fefbc=_0x89cea9[_0x301821];_0x54d84e=_0x254309['includes'](_0x3fefbc[_0x0f74('0x36')]);}return _0x54d84e;}function getQueueCampaignStatusMessage(_0x2bdd2b,_0x4d7f6a){var _0x1a9924=CAMPAIGN_STATUS[_0x0f74('0x4')];var _0x4da902=isPreviewCampaign(_0x2bdd2b);if(!isQueueCampaignActive(_0x2bdd2b)){if(_0x4da902){_0x1a9924=CAMPAIGN_STATUS[_0x0f74('0x37')];}else{if(_0x2bdd2b[_0x0f74('0x28')]===0x0&&_0x2bdd2b[_0x0f74('0x24')]===0x0&&_0x2bdd2b[_0x0f74('0x26')]===0x0&&(_0x2bdd2b['pTalking']||0x0)===0x0){_0x1a9924=CAMPAIGN_STATUS[_0x0f74('0x37')];}else{_0x1a9924=CAMPAIGN_STATUS[_0x0f74('0x38')];}}}else if(_0x2bdd2b[_0x0f74('0x21')]===0x0){_0x1a9924=CAMPAIGN_STATUS[_0x0f74('0x39')];}else if(!checkAnyValidTrunk(_0x2bdd2b,_0x4d7f6a)){_0x1a9924=CAMPAIGN_STATUS['UNREACHABLE_TRUNK'];}else if(!isPreviewCampaign(_0x2bdd2b)){var _0x5e8609=checkAnyValidQueueCampaignInterval(_0x2bdd2b);if(_0x5e8609){_0x1a9924=_0x5e8609;}}return _0x1a9924;}exports['getQueueCampaignStatusMessage']=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x2c732f){var _0x4236a3=CAMPAIGN_STATUS[_0x0f74('0x38')];if(_0x2c732f[_0x0f74('0x28')]===0x0&&_0x2c732f['talking']===0x0&&_0x2c732f['waiting']===0x0&&(_0x2c732f['pTalking']||0x0)===0x0){_0x4236a3=CAMPAIGN_STATUS[_0x0f74('0x37')];}return _0x4236a3;}exports[_0x0f74('0x3a')]=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x42a9f7){var _0x12ebed=_0x42a9f7[_0x0f74('0x3b')](/"(.*?)"/);return _0x12ebed?_0x12ebed[0x1]:_0x42a9f7;}exports[_0x0f74('0x3c')]=extractCalleridName;function getCallerId(_0x4ea5e3,_0x485c56,_0x5ad371){if(!_['isUndefined'](_0x5ad371)&&typeof _0x5ad371===_0x0f74('0x3d')&&!_[_0x0f74('0x2e')](_0x5ad371)){if(!_[_0x0f74('0x3e')](_0x485c56)&&typeof _0x485c56==='string'&&!_[_0x0f74('0x2e')](_0x485c56)){return util[_0x0f74('0x3f')](_0x0f74('0x40'),_0x485c56,_0x5ad371);}return util[_0x0f74('0x3f')](_0x0f74('0x40'),_0x5ad371,_0x5ad371);}if(!_['isUndefined'](_0x4ea5e3)&&typeof _0x4ea5e3===_0x0f74('0x3d')&&!_['isEmpty'](_0x4ea5e3)){return _0x4ea5e3;}return _0x0f74('0x41');}exports[_0x0f74('0x42')]=getCallerId;function getCallerIdRandom(_0x31ff29,_0x43e5a1){var _0x582a78;var _0x23ffef;var _0x1a1599;if(_0x43e5a1<=0x0){_0x43e5a1=0x1;}_0x582a78=new RegExp(_0x0f74('0x43')+_0x43e5a1+'}$');_0x23ffef=Math[_0x0f74('0x44')](0xa,_0x43e5a1-0x1);_0x1a1599=Math['pow'](0xa,_0x43e5a1)-0x1;return util[_0x0f74('0x3f')]('%s',_['replace'](_0x31ff29,_0x582a78,_['random'](_0x23ffef,_0x1a1599)[_0x0f74('0x45')]()));}exports[_0x0f74('0x46')]=getCallerIdRandom;function decrementOriginate(_0x6e4224){if(_0x6e4224[_0x0f74('0x28')]&&_0x6e4224[_0x0f74('0x28')]>0x0){_0x6e4224['originated']-=0x1;}else{logger['error'](_0x0f74('0x47'));}}exports[_0x0f74('0x48')]=decrementOriginate;function checkContactEmpty(_0x4f3b63){return _0x4f3b63&&_0x4f3b63[_0x0f74('0x49')]>0x0;}exports[_0x0f74('0x4a')]=checkContactEmpty;function erlangb(_0x24b641,_0x320fec){if(_0x320fec===0x0){return 0x0;}var _0xc65503=0x1;for(var _0x3f8708=0x1;_0x3f8708<=_0x320fec;_0x3f8708+=0x1){_0xc65503=0x1+_0xc65503*_0x3f8708/_0x24b641;}return 0x1/_0xc65503;}exports[_0x0f74('0x4b')]=erlangb;function checkContactLowerLimitOriginate(_0x727c9c,_0x19feaf,_0x3ee1bc){if(_0x19feaf>_0x3ee1bc){for(var _0x468774=0x0;_0x468774<_0x19feaf-_0x3ee1bc;_0x468774+=0x1){decrementOriginate(_0x727c9c);}}}exports['checkContactLowerLimitOriginate']=checkContactLowerLimitOriginate;function setXMDContactVariables(_0x455a97){var _0x46a1e8={};var _0x2e695f=['id','createdAt',_0x0f74('0x4c'),'updatedAt'];const _0x13f629=0xfa;if(_0x455a97){for(var _0x580051 in _0x455a97){if(typeof _0x455a97[_0x580051]!==_0x0f74('0x4d')){if(!_['isNil'](_0x455a97[_0x580051])&&!_0x2e695f['includes'](_0x580051)){if(_0x580051===_0x0f74('0x4e')&&_0x455a97[_0x580051][_0x0f74('0x49')]>_0x13f629){_0x46a1e8['XMD-'+_0x580051['toUpperCase']()]=_0x455a97[_0x580051][_0x0f74('0x45')]()[_0x0f74('0x4f')](0x0,_0x13f629);}else{_0x46a1e8[_0x0f74('0x50')+_0x580051[_0x0f74('0x51')]()]=_0x455a97[_0x580051];}}}}}return _0x46a1e8;}exports[_0x0f74('0x52')]=setXMDContactVariables; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index e63214a..37b3f03 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(_0x2fff34,_0x5c4ebd){var _0xb4edb=function(_0x464f92){while(--_0x464f92){_0x2fff34['push'](_0x2fff34['shift']());}};_0xb4edb(++_0x5c4ebd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0xa9e0[_0x2d8fc2];return _0x3a9e53;};'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(_0x26b34a,_0x3a6148){var _0x47d800=function(_0x45a3a5){while(--_0x45a3a5){_0x26b34a['push'](_0x26b34a['shift']());}};_0x47d800(++_0x3a6148);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0xa9e0[_0x5e3b04];return _0x1fc44d;};'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 14fb2d1..3df8dc2 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 _0x4b62=['dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','ext','isNil','active','SIP/%s','isTrunkReachable','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','util','bluebird','uuid','moment','tiff2pdf','./util/gs','../../../config/logger','fax','../ami','./rpcDb','./channel','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','syncNewchannel','bind','syncVarSet','newstate','newexten','syncNewExten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','hangup','syncHangup','originateresponse','prototype','context','from-voip-provider','hasOwnProperty','exten','localstationid','uniqueid','channel','name','info','variable','value','syncNewState','channelstate','channelstatedesc','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','calleridnum','\x20result\x20conversion\x20file\x20','parse','.pdf','application/pdf','then','notify','error','\x20notify\x20','stringify','catch','\x20receiveFax\x20','actions','merge','pick','response','AttachmentId','update','[Fax][Message][Error][Updated]','logger','[Fax][Message][Error][NoUpdate1]','updateStatus','[Fax][Message][NoUpdate1]','finally','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','SENDING\x20FAILED:\x20','faxstatusstring','send','execOriginate','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','message','Fax\x20failed','checkAfterSend','checkTrunk','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','path','execute','%s/%s.tif'];(function(_0x5e7b49,_0x12e924){var _0x1af593=function(_0x435cea){while(--_0x435cea){_0x5e7b49['push'](_0x5e7b49['shift']());}};_0x1af593(++_0x12e924);}(_0x4b62,0x86));var _0x24b6=function(_0x2318ec,_0x3d0924){_0x2318ec=_0x2318ec-0x0;var _0x144336=_0x4b62[_0x2318ec];return _0x144336;};'use strict';var util=require(_0x24b6('0x0'));var _=require('lodash');var BPromise=require(_0x24b6('0x1'));var uuid=require(_0x24b6('0x2'));var moment=require(_0x24b6('0x3'));var path=require('path');var tiff2pdf=require(_0x24b6('0x4'));var gs=require(_0x24b6('0x5'));var logger=require(_0x24b6('0x6'))(_0x24b6('0x7'));var ami=require(_0x24b6('0x8'));var rpcDb=require(_0x24b6('0x9'));var Channel=require(_0x24b6('0xa'));var ut=require('./util/util');var Action=require(_0x24b6('0xb'));var faxAccount=require(_0x24b6('0xc'));var attachment=require(_0x24b6('0xd'));var faxMessage=require(_0x24b6('0xe'));function Fax(_0x6cc155){this[_0x24b6('0xf')]={};this[_0x24b6('0x10')]=_0x6cc155['faxAccounts'];this[_0x24b6('0x11')]=_0x6cc155[_0x24b6('0x11')];this['actions']={};ami['on']('newchannel',this[_0x24b6('0x12')][_0x24b6('0x13')](this));ami['on']('varset',this[_0x24b6('0x14')][_0x24b6('0x13')](this));ami['on'](_0x24b6('0x15'),this['syncNewState'][_0x24b6('0x13')](this));ami['on'](_0x24b6('0x16'),this[_0x24b6('0x17')][_0x24b6('0x13')](this));ami['on'](_0x24b6('0x18'),this[_0x24b6('0x19')][_0x24b6('0x13')](this));ami['on'](_0x24b6('0x1a'),this[_0x24b6('0x1b')][_0x24b6('0x13')](this));ami['on'](_0x24b6('0x1c'),this[_0x24b6('0x1d')][_0x24b6('0x13')](this));ami['on'](_0x24b6('0x1e'),this['syncOriginateResponse'][_0x24b6('0x13')](this));}Fax[_0x24b6('0x1f')]['syncNewchannel']=function(_0x160826){if(_0x160826[_0x24b6('0x20')]===_0x24b6('0x21')){for(var _0x78739a in this['faxAccounts']){if(this[_0x24b6('0x10')][_0x24b6('0x22')](_0x78739a)){if(_0x160826[_0x24b6('0x23')]===this[_0x24b6('0x10')][_0x78739a][_0x24b6('0x24')]){this[_0x24b6('0xf')][_0x160826[_0x24b6('0x25')]]={};this[_0x24b6('0xf')][_0x160826[_0x24b6('0x25')]][_0x24b6('0x26')]=_0x160826[_0x24b6('0x26')];this['channels'][_0x160826['uniqueid']]['id']=this[_0x24b6('0x10')][_0x78739a]['id'];this[_0x24b6('0xf')][_0x160826[_0x24b6('0x25')]][_0x24b6('0x27')]=this[_0x24b6('0x10')][_0x78739a][_0x24b6('0x27')];logger[_0x24b6('0x28')](_0x160826['uniqueid'],'\x20syncNewchannel\x20');}}}}if(this['actions'][_0x160826[_0x24b6('0x25')]]){this[_0x24b6('0xf')][_0x160826[_0x24b6('0x25')]]={};this[_0x24b6('0xf')][_0x160826[_0x24b6('0x25')]]['channel']=_0x160826['channel'];logger[_0x24b6('0x28')](_0x160826[_0x24b6('0x25')],'\x20syncNewchannel\x20');}};Fax[_0x24b6('0x1f')]['syncVarSet']=function(_0x8ccb84){if(this[_0x24b6('0xf')][_0x8ccb84[_0x24b6('0x25')]]){for(var _0x350f69 in _0x8ccb84['variable']){if(_0x8ccb84[_0x24b6('0x29')][_0x24b6('0x22')](_0x350f69)){this[_0x24b6('0xf')][_0x8ccb84[_0x24b6('0x25')]][_0x350f69]=_0x8ccb84[_0x24b6('0x2a')];}}}};Fax['prototype'][_0x24b6('0x2b')]=function(_0x22b055){if(this[_0x24b6('0xf')][_0x22b055[_0x24b6('0x25')]]){this['channels'][_0x22b055[_0x24b6('0x25')]][_0x24b6('0x2c')]=_0x22b055[_0x24b6('0x2c')];this[_0x24b6('0xf')][_0x22b055[_0x24b6('0x25')]][_0x24b6('0x2d')]=_0x22b055[_0x24b6('0x2d')];}};Fax['prototype'][_0x24b6('0x17')]=function(_0x3f4e24){if(this[_0x24b6('0xf')][_0x3f4e24[_0x24b6('0x25')]]){for(var _0x287143 in _0x3f4e24[_0x24b6('0x29')]){if(_0x3f4e24[_0x24b6('0x29')][_0x24b6('0x22')](_0x287143)){this[_0x24b6('0xf')][_0x3f4e24[_0x24b6('0x25')]][_0x287143]=_0x3f4e24['value'];}}}};Fax[_0x24b6('0x1f')][_0x24b6('0x19')]=function(_0x103636){if(this[_0x24b6('0xf')][_0x103636[_0x24b6('0x25')]]){this['channels'][_0x103636['uniqueid']][_0x24b6('0x2e')]=_0x103636['operation'];this[_0x24b6('0xf')][_0x103636[_0x24b6('0x25')]][_0x24b6('0x2f')]=_0x103636[_0x24b6('0x2f')];this[_0x24b6('0xf')][_0x103636[_0x24b6('0x25')]]['localstationid']=_0x103636['localstationid'];this[_0x24b6('0xf')][_0x103636[_0x24b6('0x25')]][_0x24b6('0x30')]=_0x103636[_0x24b6('0x30')];logger[_0x24b6('0x28')](_0x103636[_0x24b6('0x25')],_0x24b6('0x31'));}};Fax[_0x24b6('0x1f')]['syncReceiveFax']=function(_0x40dd94){var _0x42ebfb=this;if(this[_0x24b6('0xf')][_0x40dd94[_0x24b6('0x25')]]){var _0x296fe3=this['channels'][_0x40dd94[_0x24b6('0x25')]]['id'];this[_0x24b6('0xf')][_0x40dd94[_0x24b6('0x25')]][_0x24b6('0x32')]=_0x40dd94[_0x24b6('0x32')];this[_0x24b6('0xf')][_0x40dd94[_0x24b6('0x25')]][_0x24b6('0x33')]=_0x40dd94[_0x24b6('0x33')];this['channels'][_0x40dd94[_0x24b6('0x25')]][_0x24b6('0x24')]=_0x40dd94[_0x24b6('0x24')];this[_0x24b6('0xf')][_0x40dd94[_0x24b6('0x25')]]['resolution']=_0x40dd94[_0x24b6('0x34')];this[_0x24b6('0xf')][_0x40dd94[_0x24b6('0x25')]]['transferrate']=_0x40dd94['transferrate'];this[_0x24b6('0xf')][_0x40dd94[_0x24b6('0x25')]][_0x24b6('0x30')]=_0x40dd94[_0x24b6('0x30')];this[_0x24b6('0xf')][_0x40dd94[_0x24b6('0x25')]][_0x24b6('0x35')]=_0x40dd94[_0x24b6('0x35')];if(this[_0x24b6('0xf')][_0x40dd94[_0x24b6('0x25')]]['pagestransferred']>0x0){tiff2pdf(_0x40dd94[_0x24b6('0x30')],'/var/opt/motion2/server/files/attachments/',function(_0x4e4273){logger[_0x24b6('0x28')](_0x40dd94[_0x24b6('0x25')],_0x24b6('0x36'),_0x4e4273['message']);attachment['create']({'name':path[_0x24b6('0x37')](_0x40dd94['filename'])[_0x24b6('0x27')],'basename':path[_0x24b6('0x37')](_0x40dd94[_0x24b6('0x30')])['name']+_0x24b6('0x38'),'type':_0x24b6('0x39')})[_0x24b6('0x3a')](function(_0xcd1029){faxAccount[_0x24b6('0x3b')](_0x296fe3,{'from':_0x40dd94[_0x24b6('0x35')],'mapKey':_0x24b6('0x7'),'body':path['parse'](_0x40dd94['filename'])[_0x24b6('0x27')]+_0x24b6('0x38'),'AttachmentId':_0xcd1029['id']})['catch'](function(_0x401850){logger[_0x24b6('0x3c')](_0x40dd94['uniqueid'],_0x24b6('0x3d'),JSON[_0x24b6('0x3e')](_0x401850));});})[_0x24b6('0x3f')](function(_0x37f5fc){logger[_0x24b6('0x3c')](_0x40dd94['uniqueid'],_0x24b6('0x40'),JSON['stringify'](_0x37f5fc));});});}logger[_0x24b6('0x28')](_0x40dd94[_0x24b6('0x25')],_0x24b6('0x40'));}};Fax['prototype']['syncOriginateResponse']=function(_0x750b79){if(this[_0x24b6('0x41')][_0x750b79[_0x24b6('0x25')]]){_[_0x24b6('0x42')](this['channels'][_0x750b79[_0x24b6('0x25')]],_[_0x24b6('0x43')](_0x750b79,[_0x24b6('0x44'),'reason']));}};function updateStatus(_0x13e959){if(_0x13e959[_0x24b6('0x45')]){faxMessage[_0x24b6('0x46')](_0x13e959[_0x24b6('0x45')],{'failMessage':'SENDING\x20FAILED\x20'})[_0x24b6('0x3a')](function(_0x40ce36){ut['logger'](_0x24b6('0x47'),_0x40ce36);})[_0x24b6('0x3f')](function(_0x7b8d9a){ut[_0x24b6('0x48')](_0x24b6('0x49'),_0x7b8d9a);});}else{ut[_0x24b6('0x48')]('[Fax][Message][Error][NoUpdate2]');}}Fax[_0x24b6('0x1f')][_0x24b6('0x4a')]=function(_0x28d562,_0x40989f,_0x2c09f3){var _0x56fc44=this;var _0x21219d={};if(_0x40989f){_0x21219d={'read':_0x40989f};}else{_0x21219d={'failMessage':_0x2c09f3};}if(this[_0x24b6('0x41')][_0x28d562][_0x24b6('0x45')]){faxMessage[_0x24b6('0x46')](this[_0x24b6('0x41')][_0x28d562][_0x24b6('0x45')],_0x21219d)[_0x24b6('0x3a')](function(_0x1af47e){ut[_0x24b6('0x48')]('[Fax][Message][Updated]',_0x1af47e);})[_0x24b6('0x3f')](function(_0x261bb0){ut['logger'](_0x24b6('0x4b'),_0x261bb0);})[_0x24b6('0x4c')](function(){delete _0x56fc44['channels'][_0x28d562];delete _0x56fc44['actions'][_0x28d562];});}else{ut['logger']('[Fax][Message][NoUpdate2]');delete this[_0x24b6('0xf')][_0x28d562];delete this[_0x24b6('0x41')][_0x28d562];}};Fax[_0x24b6('0x1f')][_0x24b6('0x1d')]=function(_0x2bb635){var _0x25f015=this;if(this[_0x24b6('0xf')][_0x2bb635[_0x24b6('0x25')]]){if(this[_0x24b6('0x41')][_0x2bb635[_0x24b6('0x25')]]){this['channels'][_0x2bb635[_0x24b6('0x25')]]['id']=this[_0x24b6('0x41')][_0x2bb635[_0x24b6('0x25')]]['id'];this[_0x24b6('0xf')][_0x2bb635['uniqueid']][_0x24b6('0x27')]=this[_0x24b6('0x41')][_0x2bb635[_0x24b6('0x25')]][_0x24b6('0x27')];}logger['info'](_0x2bb635['uniqueid'],this[_0x24b6('0x41')][_0x2bb635[_0x24b6('0x25')]]?_0x24b6('0x4d'):_0x24b6('0x4e'),JSON[_0x24b6('0x3e')](this[_0x24b6('0xf')][_0x2bb635[_0x24b6('0x25')]]));if(this[_0x24b6('0x41')][_0x2bb635[_0x24b6('0x25')]]){if(this[_0x24b6('0xf')][_0x2bb635['uniqueid']]['faxpages']>0x0&&this['channels'][_0x2bb635[_0x24b6('0x25')]][_0x24b6('0x18')]==='SUCCESS'){this[_0x24b6('0x4a')](_0x2bb635['uniqueid'],!![]);}else{this[_0x24b6('0x4a')](_0x2bb635['uniqueid'],![],this[_0x24b6('0xf')][_0x2bb635[_0x24b6('0x25')]]['faxstatusstring']?_0x24b6('0x4f')+this[_0x24b6('0xf')][_0x2bb635[_0x24b6('0x25')]][_0x24b6('0x50')]:'SENDING\x20FAILED');}}}};Fax[_0x24b6('0x1f')][_0x24b6('0x51')]=function(_0x38f8d0){var _0x552904=this;return new BPromise(function(_0xef4b8,_0x4e2000){_0x552904[_0x24b6('0x52')](_0x38f8d0,_0x552904[_0x24b6('0x10')][_0x38f8d0[_0x24b6('0x53')]])[_0x24b6('0x3a')](function(_0x3cfef6){ut[_0x24b6('0x48')](_0x24b6('0x54'),_0x3cfef6);_0xef4b8(ut['message'](_0x24b6('0x55')));})['catch'](function(_0x4ac84f){ut[_0x24b6('0x48')](_0x24b6('0x56'),_0x4ac84f);updateStatus(_0x38f8d0);_0x4e2000(ut[_0x24b6('0x57')](_0x24b6('0x58')));});});};Fax['prototype'][_0x24b6('0x59')]=function(_0x52b547){var _0x359d24=this;return new BPromise(function(_0x3db358,_0x51da5b){var _0x805c11=_0x359d24[_0x24b6('0x5a')](_0x359d24['faxAccounts'][_0x52b547[_0x24b6('0x53')]]['Trunk'],_0x52b547);if(_0x805c11[_0x24b6('0x5b')]){_0x3db358(ut['message'](_0x24b6('0x5c')));}else{_0x51da5b(ut['message'](_0x805c11[_0x24b6('0x57')]));}});};function originate(_0x45e6e0,_0x3491fc,_0x4d7ad8){return new BPromise(function(_0x3b04d8,_0x2d1efe){if(_0x4d7ad8){var _0xde104a=util[_0x24b6('0x5d')](_0x24b6('0x5e'),path[_0x24b6('0x37')](_0x45e6e0['path'])[_0x24b6('0x27')],_0x45e6e0[_0x24b6('0x5f')]);gs[_0x24b6('0x60')](_0xde104a)[_0x24b6('0x3a')](function(){_0x45e6e0[_0x24b6('0x5f')]=util[_0x24b6('0x5d')](_0x24b6('0x61'),path['parse'](_0x45e6e0[_0x24b6('0x5f')])[_0x24b6('0x62')],path['parse'](_0x45e6e0[_0x24b6('0x5f')])[_0x24b6('0x27')]);_0x3491fc[_0x24b6('0x63')]=_0x45e6e0[_0x24b6('0x5f')];ut[_0x24b6('0x48')](_0x24b6('0x64'),'');ami[_0x24b6('0x65')](ut[_0x24b6('0x66')](_0x45e6e0,_0x3491fc))['then'](function(_0x2530cb){_0x3b04d8(_0x2530cb);})[_0x24b6('0x3f')](function(_0x2727fa){_0x2d1efe(_0x2727fa);});})[_0x24b6('0x3f')](function(_0x3e9349){_0x2d1efe(_0x3e9349);});}else{ami[_0x24b6('0x65')](ut[_0x24b6('0x66')](_0x45e6e0,_0x3491fc))[_0x24b6('0x3a')](function(_0x3b66fb){_0x3b04d8(_0x3b66fb);})[_0x24b6('0x3f')](function(_0x5f2b9c){_0x2d1efe(_0x5f2b9c);});}});}Fax[_0x24b6('0x1f')][_0x24b6('0x52')]=function(_0xdae4d,_0x26a28b){var _0x18202e=this;return new BPromise(function(_0x4ac7aa,_0x398141){var _0x378d10=uuid['v4']();var _0x25818f=ut['addVariables'](_0xdae4d,_0x26a28b);_0x18202e['actions'][_0x378d10]=new Action(_0x378d10,_0x26a28b,_0xdae4d);var _0x1790a6=_0x18202e[_0x24b6('0x41')][_0x378d10];if(path[_0x24b6('0x37')](_0xdae4d[_0x24b6('0x5f')])[_0x24b6('0x67')]===_0x24b6('0x38')){originate(_0x1790a6,_0x25818f,!![])['then'](function(_0x4eeb06){_0x4ac7aa(_0x4eeb06);})[_0x24b6('0x3f')](function(_0x48c78a){_0x398141(_0x48c78a);});}else{originate(_0x1790a6,_0x25818f,![])[_0x24b6('0x3a')](function(_0x54b79e){_0x4ac7aa(_0x54b79e);})[_0x24b6('0x3f')](function(_0x17c653){_0x398141(_0x17c653);});}});};Fax['prototype']['isTrunkReachable']=function(_0x2a5682){return!_[_0x24b6('0x68')](_0x2a5682)&&!_['isNil'](_0x2a5682[_0x24b6('0x27')])&&!_[_0x24b6('0x68')](_0x2a5682[_0x24b6('0x69')])&&_0x2a5682[_0x24b6('0x69')]&&!_[_0x24b6('0x68')](this['trunks'][util['format'](_0x24b6('0x6a'),_0x2a5682['name'])])&&!_['isNil'](this[_0x24b6('0x11')][util['format'](_0x24b6('0x6a'),_0x2a5682['name'])]['status'])&&(this[_0x24b6('0x11')][util[_0x24b6('0x5d')](_0x24b6('0x6a'),_0x2a5682[_0x24b6('0x27')])]['status']==='reachable'||this[_0x24b6('0x11')][util['format'](_0x24b6('0x6a'),_0x2a5682['name'])][_0x24b6('0x2f')]==='unmonitored');};Fax['prototype']['checkTrunk']=function(_0x5a578b,_0x2e448a){if(!this[_0x24b6('0x6b')](_0x5a578b)){ut['logger'](_0x24b6('0x6c'),_['isNil'](_0x5a578b)?'':_0x5a578b['name']+_0x24b6('0x6d'));return{'isValid':![],'message':_0x24b6('0x6e')};}if(_[_0x24b6('0x68')](_0x2e448a[_0x24b6('0x7')])){ut[_0x24b6('0x48')](_0x24b6('0x6f'),JSON[_0x24b6('0x3e')](_0x2e448a));return{'isValid':![],'message':_0x24b6('0x70')};}if(_[_0x24b6('0x68')](_0x2e448a['path'])){ut[_0x24b6('0x48')](_0x24b6('0x71'),JSON[_0x24b6('0x3e')](_0x2e448a));return{'isValid':![],'message':_0x24b6('0x72')};}return{'isValid':!![],'message':_0x24b6('0x73')};};module['exports']=Fax; \ No newline at end of file +var _0x85b2=['[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','send','execOriginate','FaxAccountId','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkTrunk','Trunk','isValid','format','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','execute','%s/%s.tif','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','variablesAction','Action','addVariables','ext','isNil','trunks','SIP/%s','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Fax][checkTrunk][Empty\x20Fax]','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','exports','util','lodash','bluebird','moment','path','tiff2pdf','./util/gs','../../../config/logger','fax','../ami','./rpcDb','./channel','./util/util','../rpc/faxAccount','../rpc/faxMessage','channels','faxAccounts','actions','newchannel','syncNewchannel','bind','newstate','syncNewState','newexten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','hangup','syncHangup','originateresponse','syncOriginateResponse','prototype','context','from-voip-provider','hasOwnProperty','exten','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','syncVarSet','variable','channelstate','channelstatedesc','syncNewExten','operation','status','filename','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','message','create','parse','.pdf','then','notify','catch','error','\x20notify\x20','\x20receiveFax\x20','stringify','merge','response','reason','AttachmentId','update','SENDING\x20FAILED\x20','logger'];(function(_0x33a685,_0x2f00ff){var _0x34a360=function(_0x26e412){while(--_0x26e412){_0x33a685['push'](_0x33a685['shift']());}};_0x34a360(++_0x2f00ff);}(_0x85b2,0x11a));var _0x285b=function(_0xaeda17,_0x13579b){_0xaeda17=_0xaeda17-0x0;var _0x5503db=_0x85b2[_0xaeda17];return _0x5503db;};'use strict';var util=require(_0x285b('0x0'));var _=require(_0x285b('0x1'));var BPromise=require(_0x285b('0x2'));var uuid=require('uuid');var moment=require(_0x285b('0x3'));var path=require(_0x285b('0x4'));var tiff2pdf=require(_0x285b('0x5'));var gs=require(_0x285b('0x6'));var logger=require(_0x285b('0x7'))(_0x285b('0x8'));var ami=require(_0x285b('0x9'));var rpcDb=require(_0x285b('0xa'));var Channel=require(_0x285b('0xb'));var ut=require(_0x285b('0xc'));var Action=require('./action');var faxAccount=require(_0x285b('0xd'));var attachment=require('../rpc/attachment');var faxMessage=require(_0x285b('0xe'));function Fax(_0x55887e){this[_0x285b('0xf')]={};this[_0x285b('0x10')]=_0x55887e[_0x285b('0x10')];this['trunks']=_0x55887e['trunks'];this[_0x285b('0x11')]={};ami['on'](_0x285b('0x12'),this[_0x285b('0x13')][_0x285b('0x14')](this));ami['on']('varset',this['syncVarSet']['bind'](this));ami['on'](_0x285b('0x15'),this[_0x285b('0x16')][_0x285b('0x14')](this));ami['on'](_0x285b('0x17'),this['syncNewExten']['bind'](this));ami['on'](_0x285b('0x18'),this[_0x285b('0x19')]['bind'](this));ami['on'](_0x285b('0x1a'),this[_0x285b('0x1b')][_0x285b('0x14')](this));ami['on'](_0x285b('0x1c'),this[_0x285b('0x1d')][_0x285b('0x14')](this));ami['on'](_0x285b('0x1e'),this[_0x285b('0x1f')][_0x285b('0x14')](this));}Fax[_0x285b('0x20')][_0x285b('0x13')]=function(_0x59fe76){if(_0x59fe76[_0x285b('0x21')]===_0x285b('0x22')){for(var _0x46df50 in this['faxAccounts']){if(this[_0x285b('0x10')][_0x285b('0x23')](_0x46df50)){if(_0x59fe76[_0x285b('0x24')]===this[_0x285b('0x10')][_0x46df50][_0x285b('0x25')]){this[_0x285b('0xf')][_0x59fe76[_0x285b('0x26')]]={};this[_0x285b('0xf')][_0x59fe76[_0x285b('0x26')]][_0x285b('0x27')]=_0x59fe76[_0x285b('0x27')];this[_0x285b('0xf')][_0x59fe76[_0x285b('0x26')]]['id']=this[_0x285b('0x10')][_0x46df50]['id'];this['channels'][_0x59fe76['uniqueid']][_0x285b('0x28')]=this[_0x285b('0x10')][_0x46df50][_0x285b('0x28')];logger[_0x285b('0x29')](_0x59fe76[_0x285b('0x26')],_0x285b('0x2a'));}}}}if(this[_0x285b('0x11')][_0x59fe76[_0x285b('0x26')]]){this['channels'][_0x59fe76['uniqueid']]={};this[_0x285b('0xf')][_0x59fe76[_0x285b('0x26')]][_0x285b('0x27')]=_0x59fe76['channel'];logger[_0x285b('0x29')](_0x59fe76[_0x285b('0x26')],_0x285b('0x2a'));}};Fax['prototype'][_0x285b('0x2b')]=function(_0x239fb8){if(this[_0x285b('0xf')][_0x239fb8[_0x285b('0x26')]]){for(var _0x410c6a in _0x239fb8['variable']){if(_0x239fb8[_0x285b('0x2c')][_0x285b('0x23')](_0x410c6a)){this[_0x285b('0xf')][_0x239fb8['uniqueid']][_0x410c6a]=_0x239fb8['value'];}}}};Fax[_0x285b('0x20')][_0x285b('0x16')]=function(_0x10874e){if(this[_0x285b('0xf')][_0x10874e['uniqueid']]){this[_0x285b('0xf')][_0x10874e['uniqueid']][_0x285b('0x2d')]=_0x10874e[_0x285b('0x2d')];this[_0x285b('0xf')][_0x10874e[_0x285b('0x26')]][_0x285b('0x2e')]=_0x10874e[_0x285b('0x2e')];}};Fax[_0x285b('0x20')][_0x285b('0x2f')]=function(_0x52e8d6){if(this[_0x285b('0xf')][_0x52e8d6[_0x285b('0x26')]]){for(var _0x22e27e in _0x52e8d6[_0x285b('0x2c')]){if(_0x52e8d6[_0x285b('0x2c')][_0x285b('0x23')](_0x22e27e)){this[_0x285b('0xf')][_0x52e8d6[_0x285b('0x26')]][_0x22e27e]=_0x52e8d6['value'];}}}};Fax[_0x285b('0x20')]['syncFaxStatus']=function(_0x3edba1){if(this['channels'][_0x3edba1['uniqueid']]){this[_0x285b('0xf')][_0x3edba1[_0x285b('0x26')]][_0x285b('0x30')]=_0x3edba1[_0x285b('0x30')];this[_0x285b('0xf')][_0x3edba1[_0x285b('0x26')]][_0x285b('0x31')]=_0x3edba1['status'];this['channels'][_0x3edba1[_0x285b('0x26')]]['localstationid']=_0x3edba1['localstationid'];this['channels'][_0x3edba1['uniqueid']]['filename']=_0x3edba1[_0x285b('0x32')];logger['info'](_0x3edba1['uniqueid'],'\x20syncFaxStatus\x20');}};Fax[_0x285b('0x20')][_0x285b('0x1b')]=function(_0x16e650){var _0x49653a=this;if(this[_0x285b('0xf')][_0x16e650[_0x285b('0x26')]]){var _0x254d26=this[_0x285b('0xf')][_0x16e650[_0x285b('0x26')]]['id'];this[_0x285b('0xf')][_0x16e650[_0x285b('0x26')]][_0x285b('0x33')]=_0x16e650[_0x285b('0x33')];this[_0x285b('0xf')][_0x16e650['uniqueid']][_0x285b('0x34')]=_0x16e650[_0x285b('0x34')];this[_0x285b('0xf')][_0x16e650['uniqueid']][_0x285b('0x25')]=_0x16e650[_0x285b('0x25')];this[_0x285b('0xf')][_0x16e650[_0x285b('0x26')]][_0x285b('0x35')]=_0x16e650[_0x285b('0x35')];this[_0x285b('0xf')][_0x16e650[_0x285b('0x26')]][_0x285b('0x36')]=_0x16e650['transferrate'];this[_0x285b('0xf')][_0x16e650['uniqueid']][_0x285b('0x32')]=_0x16e650['filename'];this[_0x285b('0xf')][_0x16e650[_0x285b('0x26')]]['calleridnum']=_0x16e650[_0x285b('0x37')];if(this['channels'][_0x16e650['uniqueid']][_0x285b('0x34')]>0x0){tiff2pdf(_0x16e650[_0x285b('0x32')],_0x285b('0x38'),function(_0x59fbf3){logger[_0x285b('0x29')](_0x16e650['uniqueid'],'\x20result\x20conversion\x20file\x20',_0x59fbf3[_0x285b('0x39')]);attachment[_0x285b('0x3a')]({'name':path[_0x285b('0x3b')](_0x16e650[_0x285b('0x32')])[_0x285b('0x28')],'basename':path[_0x285b('0x3b')](_0x16e650[_0x285b('0x32')])['name']+_0x285b('0x3c'),'type':'application/pdf'})[_0x285b('0x3d')](function(_0x239832){faxAccount[_0x285b('0x3e')](_0x254d26,{'from':_0x16e650[_0x285b('0x37')],'mapKey':_0x285b('0x8'),'body':path[_0x285b('0x3b')](_0x16e650[_0x285b('0x32')])['name']+_0x285b('0x3c'),'AttachmentId':_0x239832['id']})[_0x285b('0x3f')](function(_0x55702c){logger[_0x285b('0x40')](_0x16e650[_0x285b('0x26')],_0x285b('0x41'),JSON['stringify'](_0x55702c));});})[_0x285b('0x3f')](function(_0x1862b0){logger[_0x285b('0x40')](_0x16e650[_0x285b('0x26')],_0x285b('0x42'),JSON[_0x285b('0x43')](_0x1862b0));});});}logger[_0x285b('0x29')](_0x16e650[_0x285b('0x26')],_0x285b('0x42'));}};Fax[_0x285b('0x20')][_0x285b('0x1f')]=function(_0x40178d){if(this[_0x285b('0x11')][_0x40178d[_0x285b('0x26')]]){_[_0x285b('0x44')](this[_0x285b('0xf')][_0x40178d[_0x285b('0x26')]],_['pick'](_0x40178d,[_0x285b('0x45'),_0x285b('0x46')]));}};function updateStatus(_0x5505c2){if(_0x5505c2[_0x285b('0x47')]){faxMessage[_0x285b('0x48')](_0x5505c2[_0x285b('0x47')],{'failMessage':_0x285b('0x49')})[_0x285b('0x3d')](function(_0x5349e5){ut[_0x285b('0x4a')]('[Fax][Message][Error][Updated]',_0x5349e5);})[_0x285b('0x3f')](function(_0x7a002c){ut[_0x285b('0x4a')](_0x285b('0x4b'),_0x7a002c);});}else{ut[_0x285b('0x4a')](_0x285b('0x4c'));}}Fax[_0x285b('0x20')][_0x285b('0x4d')]=function(_0x410c8f,_0x15e672,_0x469761){var _0x4eddda=this;var _0x5e215a={};if(_0x15e672){_0x5e215a={'read':_0x15e672};}else{_0x5e215a={'failMessage':_0x469761};}if(this[_0x285b('0x11')][_0x410c8f]['AttachmentId']){faxMessage[_0x285b('0x48')](this['actions'][_0x410c8f][_0x285b('0x47')],_0x5e215a)['then'](function(_0x56cfd9){ut[_0x285b('0x4a')](_0x285b('0x4e'),_0x56cfd9);})[_0x285b('0x3f')](function(_0x487e73){ut['logger'](_0x285b('0x4f'),_0x487e73);})[_0x285b('0x50')](function(){delete _0x4eddda['channels'][_0x410c8f];delete _0x4eddda[_0x285b('0x11')][_0x410c8f];});}else{ut[_0x285b('0x4a')](_0x285b('0x51'));delete this[_0x285b('0xf')][_0x410c8f];delete this['actions'][_0x410c8f];}};Fax[_0x285b('0x20')][_0x285b('0x1d')]=function(_0x293735){var _0x3de03d=this;if(this[_0x285b('0xf')][_0x293735[_0x285b('0x26')]]){if(this[_0x285b('0x11')][_0x293735[_0x285b('0x26')]]){this[_0x285b('0xf')][_0x293735[_0x285b('0x26')]]['id']=this['actions'][_0x293735[_0x285b('0x26')]]['id'];this[_0x285b('0xf')][_0x293735[_0x285b('0x26')]]['name']=this[_0x285b('0x11')][_0x293735[_0x285b('0x26')]][_0x285b('0x28')];}logger[_0x285b('0x29')](_0x293735[_0x285b('0x26')],this[_0x285b('0x11')][_0x293735[_0x285b('0x26')]]?_0x285b('0x52'):'\x20hangup\x20faxRiceive\x20',JSON[_0x285b('0x43')](this[_0x285b('0xf')][_0x293735['uniqueid']]));if(this[_0x285b('0x11')][_0x293735[_0x285b('0x26')]]){if(this[_0x285b('0xf')][_0x293735[_0x285b('0x26')]]['faxpages']>0x0&&this[_0x285b('0xf')][_0x293735[_0x285b('0x26')]][_0x285b('0x18')]===_0x285b('0x53')){this['updateStatus'](_0x293735[_0x285b('0x26')],!![]);}else{this['updateStatus'](_0x293735[_0x285b('0x26')],![],this[_0x285b('0xf')][_0x293735[_0x285b('0x26')]][_0x285b('0x54')]?_0x285b('0x55')+this[_0x285b('0xf')][_0x293735[_0x285b('0x26')]][_0x285b('0x54')]:_0x285b('0x56'));}}}};Fax[_0x285b('0x20')][_0x285b('0x57')]=function(_0x36e48f){var _0x3060d2=this;return new BPromise(function(_0x37caf4,_0x167ce9){_0x3060d2[_0x285b('0x58')](_0x36e48f,_0x3060d2[_0x285b('0x10')][_0x36e48f[_0x285b('0x59')]])['then'](function(_0x21990c){ut['logger']('[Fax][execOriginate][success]',_0x21990c);_0x37caf4(ut[_0x285b('0x39')](_0x285b('0x5a')));})[_0x285b('0x3f')](function(_0x448599){ut[_0x285b('0x4a')](_0x285b('0x5b'),_0x448599);updateStatus(_0x36e48f);_0x167ce9(ut[_0x285b('0x39')](_0x285b('0x5c')));});});};Fax[_0x285b('0x20')]['checkAfterSend']=function(_0x4de6b1){var _0x1b6dd8=this;return new BPromise(function(_0x24767f,_0x2fc018){var _0x4a26a2=_0x1b6dd8[_0x285b('0x5d')](_0x1b6dd8[_0x285b('0x10')][_0x4de6b1[_0x285b('0x59')]][_0x285b('0x5e')],_0x4de6b1);if(_0x4a26a2[_0x285b('0x5f')]){_0x24767f(ut[_0x285b('0x39')]('Trunk\x20Reachable'));}else{_0x2fc018(ut[_0x285b('0x39')](_0x4a26a2[_0x285b('0x39')]));}});};function originate(_0x41329a,_0x57d228,_0x27d9b6){return new BPromise(function(_0x116af5,_0x4d7164){if(_0x27d9b6){var _0x59dee7=util[_0x285b('0x60')](_0x285b('0x61'),path[_0x285b('0x3b')](_0x41329a[_0x285b('0x4')])[_0x285b('0x28')],_0x41329a['path']);gs[_0x285b('0x62')](_0x59dee7)[_0x285b('0x3d')](function(){_0x41329a[_0x285b('0x4')]=util['format'](_0x285b('0x63'),path[_0x285b('0x3b')](_0x41329a['path'])[_0x285b('0x64')],path[_0x285b('0x3b')](_0x41329a[_0x285b('0x4')])[_0x285b('0x28')]);_0x57d228[_0x285b('0x65')]=_0x41329a[_0x285b('0x4')];ut[_0x285b('0x4a')](_0x285b('0x66'),'');ami['Action'](ut[_0x285b('0x67')](_0x41329a,_0x57d228))[_0x285b('0x3d')](function(_0x2f71f7){_0x116af5(_0x2f71f7);})[_0x285b('0x3f')](function(_0x474b02){_0x4d7164(_0x474b02);});})[_0x285b('0x3f')](function(_0x46f818){_0x4d7164(_0x46f818);});}else{ami[_0x285b('0x68')](ut[_0x285b('0x67')](_0x41329a,_0x57d228))[_0x285b('0x3d')](function(_0x5118fe){_0x116af5(_0x5118fe);})[_0x285b('0x3f')](function(_0x6d2732){_0x4d7164(_0x6d2732);});}});}Fax[_0x285b('0x20')][_0x285b('0x58')]=function(_0x464f27,_0x38a150){var _0x338a31=this;return new BPromise(function(_0x1ee1c3,_0x57d966){var _0x445c81=uuid['v4']();var _0x1f3de5=ut[_0x285b('0x69')](_0x464f27,_0x38a150);_0x338a31[_0x285b('0x11')][_0x445c81]=new Action(_0x445c81,_0x38a150,_0x464f27);var _0x40fc9e=_0x338a31[_0x285b('0x11')][_0x445c81];if(path[_0x285b('0x3b')](_0x464f27['path'])[_0x285b('0x6a')]===_0x285b('0x3c')){originate(_0x40fc9e,_0x1f3de5,!![])[_0x285b('0x3d')](function(_0x5ae7b4){_0x1ee1c3(_0x5ae7b4);})[_0x285b('0x3f')](function(_0x19d0d1){_0x57d966(_0x19d0d1);});}else{originate(_0x40fc9e,_0x1f3de5,![])[_0x285b('0x3d')](function(_0x58df26){_0x1ee1c3(_0x58df26);})[_0x285b('0x3f')](function(_0x389d6c){_0x57d966(_0x389d6c);});}});};Fax[_0x285b('0x20')]['isTrunkReachable']=function(_0x2946e0){return!_[_0x285b('0x6b')](_0x2946e0)&&!_[_0x285b('0x6b')](_0x2946e0[_0x285b('0x28')])&&!_[_0x285b('0x6b')](_0x2946e0['active'])&&_0x2946e0['active']&&!_[_0x285b('0x6b')](this['trunks'][util[_0x285b('0x60')]('SIP/%s',_0x2946e0[_0x285b('0x28')])])&&!_[_0x285b('0x6b')](this['trunks'][util[_0x285b('0x60')]('SIP/%s',_0x2946e0['name'])][_0x285b('0x31')])&&(this[_0x285b('0x6c')][util['format'](_0x285b('0x6d'),_0x2946e0[_0x285b('0x28')])][_0x285b('0x31')]==='reachable'||this['trunks'][util[_0x285b('0x60')](_0x285b('0x6d'),_0x2946e0[_0x285b('0x28')])][_0x285b('0x31')]===_0x285b('0x6e'));};Fax['prototype'][_0x285b('0x5d')]=function(_0x20b588,_0x5c17d1){if(!this['isTrunkReachable'](_0x20b588)){ut[_0x285b('0x4a')](_0x285b('0x6f'),_['isNil'](_0x20b588)?'':_0x20b588[_0x285b('0x28')]+_0x285b('0x70'));return{'isValid':![],'message':_0x285b('0x71')};}if(_[_0x285b('0x6b')](_0x5c17d1['fax'])){ut[_0x285b('0x4a')](_0x285b('0x72'),JSON[_0x285b('0x43')](_0x5c17d1));return{'isValid':![],'message':'Empty\x20Fax'};}if(_[_0x285b('0x6b')](_0x5c17d1[_0x285b('0x4')])){ut[_0x285b('0x4a')](_0x285b('0x73'),JSON[_0x285b('0x43')](_0x5c17d1));return{'isValid':![],'message':_0x285b('0x74')};}return{'isValid':!![],'message':_0x285b('0x75')};};module[_0x285b('0x76')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index 81d03cd..acc79e5 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 _0x2427=['../rpc/faxAccount','error','inspect','resolve','then','notify','catch','util','bluebird','preview'];(function(_0x14c92b,_0x3b01db){var _0x5cb970=function(_0x2ff560){while(--_0x2ff560){_0x14c92b['push'](_0x14c92b['shift']());}};_0x5cb970(++_0x3b01db);}(_0x2427,0x165));var _0x7242=function(_0x4ba2c8,_0x3095a7){_0x4ba2c8=_0x4ba2c8-0x0;var _0x13b7ce=_0x2427[_0x4ba2c8];return _0x13b7ce;};'use strict';var util=require(_0x7242('0x0'));var BPromise=require(_0x7242('0x1'));var logger=require('../../../config/logger')(_0x7242('0x2'));var _=require('lodash');var faxAccount=require(_0x7242('0x3'));function loggerCatch(_0x4b0c46){return function(_0x66fd49){logger[_0x7242('0x4')](_0x4b0c46,util[_0x7242('0x5')](_0x66fd49,{'showHidden':![],'depth':null}));};}exports['notify']=function(_0x6ecd49,_0x4b0575){return BPromise[_0x7242('0x6')]()[_0x7242('0x7')](faxAccount[_0x7242('0x8')](_0x6ecd49,_0x4b0575))[_0x7242('0x9')](loggerCatch('[Notify]\x20'));}; \ No newline at end of file +var _0xc236=['inspect','notify','[Notify]\x20','util','../../../config/logger','preview','lodash','error'];(function(_0x250d94,_0x54c7d2){var _0x2f5168=function(_0x196c89){while(--_0x196c89){_0x250d94['push'](_0x250d94['shift']());}};_0x2f5168(++_0x54c7d2);}(_0xc236,0x183));var _0x6c23=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc236[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0x6c23('0x0'));var BPromise=require('bluebird');var logger=require(_0x6c23('0x1'))(_0x6c23('0x2'));var _=require(_0x6c23('0x3'));var faxAccount=require('../rpc/faxAccount');function loggerCatch(_0x3de200){return function(_0x156b7e){logger[_0x6c23('0x4')](_0x3de200,util[_0x6c23('0x5')](_0x156b7e,{'showHidden':![],'depth':null}));};}exports[_0x6c23('0x6')]=function(_0x31689d,_0x2d8f98){return BPromise['resolve']()['then'](faxAccount[_0x6c23('0x6')](_0x31689d,_0x2d8f98))['catch'](loggerCatch(_0x6c23('0x7')));}; \ 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 a2e5401..1bb8d36 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 _0x042b=['execute','info','Exec\x20gs','\x20Error\x20:','util','../../../../config/logger','fax','bluebird','exec'];(function(_0x45cbc9,_0x31fbd8){var _0x5b2b70=function(_0x669758){while(--_0x669758){_0x45cbc9['push'](_0x45cbc9['shift']());}};_0x5b2b70(++_0x31fbd8);}(_0x042b,0x136));var _0xb042=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x042b[_0x3bf83f];return _0x22c4a9;};'use strict';var util=require(_0xb042('0x0'));var logger=require(_0xb042('0x1'))(_0xb042('0x2'));var BPromise=require(_0xb042('0x3'));var exec=require('child_process')[_0xb042('0x4')];exports[_0xb042('0x5')]=function(_0x8033bf){return new BPromise(function(_0x5a8370,_0xca09b3){exec(_0x8033bf,function(_0x468944,_0x408e09,_0x5f2563){logger[_0xb042('0x6')](_0xb042('0x7'),_0x408e09);if(_0x468944){logger[_0xb042('0x6')](_0xb042('0x7'),_0xb042('0x8'),util['inspect'](_0x468944,{'showHidden':![],'depth':null}),_0x408e09,_0x5f2563);_0xca09b3(_0x468944);}_0x5a8370(_0x408e09);});});}; \ No newline at end of file +var _0x2972=['info','Exec\x20gs','\x20Error\x20:','inspect','../../../../config/logger','fax','child_process','exec'];(function(_0x4e101b,_0x54a626){var _0x38b553=function(_0x42ab35){while(--_0x42ab35){_0x4e101b['push'](_0x4e101b['shift']());}};_0x38b553(++_0x54a626);}(_0x2972,0x104));var _0x2297=function(_0x28bf98,_0x15ee7c){_0x28bf98=_0x28bf98-0x0;var _0x158766=_0x2972[_0x28bf98];return _0x158766;};'use strict';var util=require('util');var logger=require(_0x2297('0x0'))(_0x2297('0x1'));var BPromise=require('bluebird');var exec=require(_0x2297('0x2'))[_0x2297('0x3')];exports['execute']=function(_0x4e3d30){return new BPromise(function(_0x5c0a2e,_0x1ca7c8){exec(_0x4e3d30,function(_0x4b4c84,_0x34fff1,_0x291905){logger[_0x2297('0x4')]('Exec\x20gs',_0x34fff1);if(_0x4b4c84){logger['info'](_0x2297('0x5'),_0x2297('0x6'),util[_0x2297('0x7')](_0x4b4c84,{'showHidden':![],'depth':null}),_0x34fff1,_0x291905);_0x1ca7c8(_0x4b4c84);}_0x5c0a2e(_0x34fff1);});});}; \ 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 c40224e..b56b70c 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 _0xa3a9=['localstationid','path','variablesAction','uniqueid','originate','channel','xcally-motion-fax','from-sip','\x22%s\x22\x20<%s>','headerinfo','util','lodash','moment','message','logger','inspect','addVariables','format','\x22%s\x22','modem','gateway','faxdetect'];(function(_0x4a93bb,_0x495404){var _0x208468=function(_0x1d82b7){while(--_0x1d82b7){_0x4a93bb['push'](_0x4a93bb['shift']());}};_0x208468(++_0x495404);}(_0xa3a9,0xfc));var _0x9a3a=function(_0x1280e5,_0xddca64){_0x1280e5=_0x1280e5-0x0;var _0x42b776=_0xa3a9[_0x1280e5];return _0x42b776;};'use strict';var util=require(_0x9a3a('0x0'));var _=require(_0x9a3a('0x1'));var moment=require(_0x9a3a('0x2'));var logger=require('../../../../config/logger')('fax');exports[_0x9a3a('0x3')]=function(_0x37fb01){return{'message':_0x37fb01};};exports[_0x9a3a('0x4')]=function(_0x12662b,_0x39d280){logger['info'](_0x12662b,util[_0x9a3a('0x5')](_0x39d280,{'showHidden':![],'depth':null}));};exports[_0x9a3a('0x6')]=function(_0x2544b0,_0x3ebe34){var _0x159f4f={'XMF-ECM':_0x3ebe34['ecm'],'XMF-HEADERINFO':_0x3ebe34['headerinfo'],'XMF-MINRATE':_0x3ebe34['minrate'],'XMF-MAXRATE':_0x3ebe34['maxrate'],'XMF-MODEM':util[_0x9a3a('0x7')](_0x9a3a('0x8'),_0x3ebe34[_0x9a3a('0x9')]),'XMF-GATEWAY':_0x3ebe34[_0x9a3a('0xa')],'XMF-FAXDETECT':_0x3ebe34[_0x9a3a('0xb')],'XMF-T38TIMEOUT':_0x3ebe34['t38timeout'],'XMF-LOCALSTATIONID':_0x3ebe34[_0x9a3a('0xc')],'XMF-PATH':_0x2544b0[_0x9a3a('0xd')]};return _0x159f4f;};exports[_0x9a3a('0xe')]=function(_0x2ca335,_0x7b7e9c){return{'actionid':_0x2ca335[_0x9a3a('0xf')],'action':_0x9a3a('0x10'),'channel':_0x2ca335[_0x9a3a('0x11')],'Exten':_0x9a3a('0x12'),'Context':_0x9a3a('0x13'),'Priority':'1','callerid':util['format'](_0x9a3a('0x14'),_0x2ca335['headerinfo']?_0x2ca335[_0x9a3a('0x15')]:'',_0x2ca335[_0x9a3a('0xc')]),'variable':_0x7b7e9c,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x2ca335[_0x9a3a('0xf')]};}; \ No newline at end of file +var _0xd3f5=['channel','from-sip','format','headerinfo','localstationid','util','lodash','moment','fax','message','logger','info','inspect','addVariables','minrate','\x22%s\x22','gateway','t38timeout','path','variablesAction'];(function(_0x58eb06,_0x3e89c3){var _0x338515=function(_0x4d89b5){while(--_0x4d89b5){_0x58eb06['push'](_0x58eb06['shift']());}};_0x338515(++_0x3e89c3);}(_0xd3f5,0x7d));var _0x5d3f=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xd3f5[_0x397e5f];return _0x5302b8;};'use strict';var util=require(_0x5d3f('0x0'));var _=require(_0x5d3f('0x1'));var moment=require(_0x5d3f('0x2'));var logger=require('../../../../config/logger')(_0x5d3f('0x3'));exports[_0x5d3f('0x4')]=function(_0x35ac4b){return{'message':_0x35ac4b};};exports[_0x5d3f('0x5')]=function(_0x1a0058,_0x40d9f7){logger[_0x5d3f('0x6')](_0x1a0058,util[_0x5d3f('0x7')](_0x40d9f7,{'showHidden':![],'depth':null}));};exports[_0x5d3f('0x8')]=function(_0x2e8395,_0x57a0ed){var _0x4a467e={'XMF-ECM':_0x57a0ed['ecm'],'XMF-HEADERINFO':_0x57a0ed['headerinfo'],'XMF-MINRATE':_0x57a0ed[_0x5d3f('0x9')],'XMF-MAXRATE':_0x57a0ed['maxrate'],'XMF-MODEM':util['format'](_0x5d3f('0xa'),_0x57a0ed['modem']),'XMF-GATEWAY':_0x57a0ed[_0x5d3f('0xb')],'XMF-FAXDETECT':_0x57a0ed['faxdetect'],'XMF-T38TIMEOUT':_0x57a0ed[_0x5d3f('0xc')],'XMF-LOCALSTATIONID':_0x57a0ed['localstationid'],'XMF-PATH':_0x2e8395[_0x5d3f('0xd')]};return _0x4a467e;};exports[_0x5d3f('0xe')]=function(_0x589420,_0x67a389){return{'actionid':_0x589420['uniqueid'],'action':'originate','channel':_0x589420[_0x5d3f('0xf')],'Exten':'xcally-motion-fax','Context':_0x5d3f('0x10'),'Priority':'1','callerid':util[_0x5d3f('0x11')]('\x22%s\x22\x20<%s>',_0x589420[_0x5d3f('0x12')]?_0x589420['headerinfo']:'',_0x589420[_0x5d3f('0x13')]),'variable':_0x67a389,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x589420['uniqueid']};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 3cb978c..f5f2385 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 _0xdc87=['./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','ami','get','hour','resolve','then','getAgents','initAgents','getTelephones','initTelephones','getTrunks','getVoiceQueues','initVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','initZendeskAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','initVoiceExtensions','initFaxAccounts','getVoiceQueueReports','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','error','listen','sync','[index.js][main]','inspect','util','moment','./realtime','./report','./acw','./trigger','./preview','./fax','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/faxAccount'];(function(_0x5eb4c2,_0x958b19){var _0x504308=function(_0x83b924){while(--_0x83b924){_0x5eb4c2['push'](_0x5eb4c2['shift']());}};_0x504308(++_0x958b19);}(_0xdc87,0xd0));var _0x7dc8=function(_0x555b2f,_0x43b622){_0x555b2f=_0x555b2f-0x0;var _0x81c0a6=_0xdc87[_0x555b2f];return _0x81c0a6;};'use strict';var util=require(_0x7dc8('0x0'));var moment=require(_0x7dc8('0x1'));var server=require('./server');var Realtime=require(_0x7dc8('0x2'));var Report=require(_0x7dc8('0x3'));var Acw=require(_0x7dc8('0x4'));var Trigger=require(_0x7dc8('0x5'));var Dialer=require('./dialer');var Preview=require(_0x7dc8('0x6'));var Fax=require(_0x7dc8('0x7'));var user=require('./rpc/user');var voiceQueue=require(_0x7dc8('0x8'));var voiceQueueReport=require(_0x7dc8('0x9'));var voiceCallReport=require(_0x7dc8('0xa'));var trunk=require(_0x7dc8('0xb'));var trigger=require(_0x7dc8('0xc'));var template=require(_0x7dc8('0xd'));var cmHopperHistory=require(_0x7dc8('0xe'));var campaign=require(_0x7dc8('0xf'));var voiceExtension=require('./rpc/voiceExtension');var faxAccount=require(_0x7dc8('0x10'));var zendesk=require(_0x7dc8('0x11'));var salesforce=require(_0x7dc8('0x12'));var sugarcrm=require('./rpc/integrations/sugarcrm');var freshdesk=require('./rpc/integrations/freshdesk');var desk=require(_0x7dc8('0x13'));var zoho=require(_0x7dc8('0x14'));var vtiger=require(_0x7dc8('0x15'));var freshsales=require(_0x7dc8('0x16'));var servicenow=require(_0x7dc8('0x17'));var dynamics365=require(_0x7dc8('0x18'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require('../../config/logger')(_0x7dc8('0x19'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x7dc8('0x1a')](_0x7dc8('0x1b'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x7dc8('0x1a')](_0x7dc8('0x1b'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0x7dc8('0x1c')]()[_0x7dc8('0x1d')](user[_0x7dc8('0x1e')]())['then'](realtime[_0x7dc8('0x1f')]())[_0x7dc8('0x1d')](user[_0x7dc8('0x20')]())[_0x7dc8('0x1d')](realtime[_0x7dc8('0x21')]())[_0x7dc8('0x1d')](trunk[_0x7dc8('0x22')]())[_0x7dc8('0x1d')](realtime['initTrunks']())[_0x7dc8('0x1d')](voiceQueue[_0x7dc8('0x23')]())[_0x7dc8('0x1d')](realtime[_0x7dc8('0x24')]())[_0x7dc8('0x1d')](trigger[_0x7dc8('0x25')]())[_0x7dc8('0x1d')](realtime[_0x7dc8('0x26')]())[_0x7dc8('0x1d')](template[_0x7dc8('0x27')]())['then'](realtime[_0x7dc8('0x28')]())['then'](zendesk['getZendeskAccounts']())[_0x7dc8('0x1d')](realtime[_0x7dc8('0x29')]())[_0x7dc8('0x1d')](salesforce['getSalesforceAccounts']())['then'](realtime[_0x7dc8('0x2a')]())[_0x7dc8('0x1d')](sugarcrm[_0x7dc8('0x2b')]())['then'](realtime[_0x7dc8('0x2c')]())['then'](freshdesk[_0x7dc8('0x2d')]())[_0x7dc8('0x1d')](realtime[_0x7dc8('0x2e')]())[_0x7dc8('0x1d')](desk[_0x7dc8('0x2f')]())['then'](realtime[_0x7dc8('0x30')]())[_0x7dc8('0x1d')](zoho[_0x7dc8('0x31')]())[_0x7dc8('0x1d')](realtime[_0x7dc8('0x32')]())[_0x7dc8('0x1d')](vtiger[_0x7dc8('0x33')]())['then'](realtime[_0x7dc8('0x34')]())['then'](freshsales[_0x7dc8('0x35')]())[_0x7dc8('0x1d')](realtime[_0x7dc8('0x36')]())['then'](servicenow[_0x7dc8('0x37')]())[_0x7dc8('0x1d')](realtime[_0x7dc8('0x38')]())[_0x7dc8('0x1d')](dynamics365[_0x7dc8('0x39')]())['then'](realtime[_0x7dc8('0x3a')]())[_0x7dc8('0x1d')](campaign[_0x7dc8('0x3b')]())[_0x7dc8('0x1d')](realtime[_0x7dc8('0x3c')]())[_0x7dc8('0x1d')](voiceExtension['getVoiceExtensions']())[_0x7dc8('0x1d')](realtime[_0x7dc8('0x3d')]())[_0x7dc8('0x1d')](faxAccount['getFaxAccounts']())[_0x7dc8('0x1d')](realtime[_0x7dc8('0x3e')]())[_0x7dc8('0x1d')](function(){return realtime;});}function initParams(){return Promise['resolve']()[_0x7dc8('0x1d')](voiceQueueReport[_0x7dc8('0x3f')]())[_0x7dc8('0x1d')](realtime['initVoiceQueueReports']())['then'](cmHopperHistory['getVoiceQueueHopperHistory']())[_0x7dc8('0x1d')](realtime[_0x7dc8('0x40')]())[_0x7dc8('0x1d')](cmHopperHistory[_0x7dc8('0x41')]())[_0x7dc8('0x1d')](realtime[_0x7dc8('0x42')]())[_0x7dc8('0x1d')](voiceCallReport[_0x7dc8('0x43')]())[_0x7dc8('0x1d')](realtime[_0x7dc8('0x44')]())[_0x7dc8('0x45')](function(_0x496c07){logger[_0x7dc8('0x46')]('[index.js][initParams]',util['inspect'](_0x496c07,{'showHidden':![],'depth':null}));});}function main(){return server[_0x7dc8('0x47')](realtime,preview,fax)[_0x7dc8('0x1d')](function(){return initRealtime();})[_0x7dc8('0x1d')](function(){return initParams();})[_0x7dc8('0x1d')](function(){report[_0x7dc8('0x48')]();setInterval(initRealtime,0x1388);})[_0x7dc8('0x45')](function(_0x14c6ac){logger[_0x7dc8('0x46')](_0x7dc8('0x49'),util[_0x7dc8('0x4a')](_0x14c6ac,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file +var _0x3db9=['./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','../../config/logger','get','hour','resolve','then','getAgents','initAgents','getTelephones','initTelephones','getTrunks','initTrunks','initVoiceQueues','getTriggers','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','getSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','initVtigerAccounts','getFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','error','[index.js][main]','inspect','util','moment','./server','./acw','./preview','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/trigger','./rpc/template','./rpc/campaign'];(function(_0x2a6d45,_0x3c9321){var _0x295253=function(_0x51d622){while(--_0x51d622){_0x2a6d45['push'](_0x2a6d45['shift']());}};_0x295253(++_0x3c9321);}(_0x3db9,0x1bb));var _0x93db=function(_0x3f7d51,_0x4d37e5){_0x3f7d51=_0x3f7d51-0x0;var _0x5f2206=_0x3db9[_0x3f7d51];return _0x5f2206;};'use strict';var util=require(_0x93db('0x0'));var moment=require(_0x93db('0x1'));var server=require(_0x93db('0x2'));var Realtime=require('./realtime');var Report=require('./report');var Acw=require(_0x93db('0x3'));var Trigger=require('./trigger');var Dialer=require('./dialer');var Preview=require(_0x93db('0x4'));var Fax=require(_0x93db('0x5'));var user=require(_0x93db('0x6'));var voiceQueue=require(_0x93db('0x7'));var voiceQueueReport=require(_0x93db('0x8'));var voiceCallReport=require('./rpc/voiceCallReport');var trunk=require('./rpc/trunk');var trigger=require(_0x93db('0x9'));var template=require(_0x93db('0xa'));var cmHopperHistory=require('./rpc/cmHopperHistory');var campaign=require(_0x93db('0xb'));var voiceExtension=require(_0x93db('0xc'));var faxAccount=require(_0x93db('0xd'));var zendesk=require('./rpc/integrations/zendesk');var salesforce=require(_0x93db('0xe'));var sugarcrm=require(_0x93db('0xf'));var freshdesk=require(_0x93db('0x10'));var desk=require(_0x93db('0x11'));var zoho=require(_0x93db('0x12'));var vtiger=require(_0x93db('0x13'));var freshsales=require(_0x93db('0x14'));var servicenow=require(_0x93db('0x15'));var dynamics365=require(_0x93db('0x16'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require(_0x93db('0x17'))('ami');var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x93db('0x18')](_0x93db('0x19'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x93db('0x18')](_0x93db('0x19'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0x93db('0x1a')]()[_0x93db('0x1b')](user[_0x93db('0x1c')]())['then'](realtime[_0x93db('0x1d')]())['then'](user[_0x93db('0x1e')]())[_0x93db('0x1b')](realtime[_0x93db('0x1f')]())[_0x93db('0x1b')](trunk[_0x93db('0x20')]())[_0x93db('0x1b')](realtime[_0x93db('0x21')]())[_0x93db('0x1b')](voiceQueue['getVoiceQueues']())[_0x93db('0x1b')](realtime[_0x93db('0x22')]())['then'](trigger[_0x93db('0x23')]())[_0x93db('0x1b')](realtime['initTriggers']())['then'](template['getTemplates']())['then'](realtime[_0x93db('0x24')]())[_0x93db('0x1b')](zendesk[_0x93db('0x25')]())[_0x93db('0x1b')](realtime[_0x93db('0x26')]())[_0x93db('0x1b')](salesforce[_0x93db('0x27')]())[_0x93db('0x1b')](realtime['initSalesforceAccounts']())[_0x93db('0x1b')](sugarcrm[_0x93db('0x28')]())[_0x93db('0x1b')](realtime['initSugarcrmAccounts']())[_0x93db('0x1b')](freshdesk[_0x93db('0x29')]())['then'](realtime[_0x93db('0x2a')]())['then'](desk['getDeskAccounts']())['then'](realtime['initDeskAccounts']())[_0x93db('0x1b')](zoho['getZohoAccounts']())[_0x93db('0x1b')](realtime['initZohoAccounts']())[_0x93db('0x1b')](vtiger['getVtigerAccounts']())['then'](realtime[_0x93db('0x2b')]())[_0x93db('0x1b')](freshsales[_0x93db('0x2c')]())[_0x93db('0x1b')](realtime['initFreshsalesAccounts']())['then'](servicenow[_0x93db('0x2d')]())[_0x93db('0x1b')](realtime[_0x93db('0x2e')]())[_0x93db('0x1b')](dynamics365[_0x93db('0x2f')]())['then'](realtime['initDynamics365Accounts']())[_0x93db('0x1b')](campaign[_0x93db('0x30')]())[_0x93db('0x1b')](realtime[_0x93db('0x31')]())[_0x93db('0x1b')](voiceExtension[_0x93db('0x32')]())[_0x93db('0x1b')](realtime[_0x93db('0x33')]())[_0x93db('0x1b')](faxAccount[_0x93db('0x34')]())['then'](realtime['initFaxAccounts']())['then'](function(){return realtime;});}function initParams(){return Promise[_0x93db('0x1a')]()['then'](voiceQueueReport[_0x93db('0x35')]())[_0x93db('0x1b')](realtime[_0x93db('0x36')]())['then'](cmHopperHistory[_0x93db('0x37')]())[_0x93db('0x1b')](realtime[_0x93db('0x38')]())[_0x93db('0x1b')](cmHopperHistory[_0x93db('0x39')]())['then'](realtime[_0x93db('0x3a')]())[_0x93db('0x1b')](voiceCallReport[_0x93db('0x3b')]())[_0x93db('0x1b')](realtime[_0x93db('0x3c')]())[_0x93db('0x3d')](function(_0x18b3d0){logger['error']('[index.js][initParams]',util['inspect'](_0x18b3d0,{'showHidden':![],'depth':null}));});}function main(){return server['listen'](realtime,preview,fax)[_0x93db('0x1b')](function(){return initRealtime();})[_0x93db('0x1b')](function(){return initParams();})[_0x93db('0x1b')](function(){report['sync']();setInterval(initRealtime,0x1388);})[_0x93db('0x3d')](function(_0xc6dffe){logger[_0x93db('0x3e')](_0x93db('0x3f'),util[_0x93db('0x40')](_0xc6dffe,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file diff --git a/server/services/ami/model/agent.js b/server/services/ami/model/agent.js index f44db49..ab9c00d 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 _0xb164=['idle','inuse','talking','voiceStatus','statePause','format','email','online','stringify','user:%s','emit','user:ami:update','exports','lodash','moment','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','accountcode','fullname','stateTime','status','unknown','address','phone','mobile','interface','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','local','md5','updateStatusRealtime','state','toLowerCase','not_inuse'];(function(_0xd36819,_0x3f700b){var _0x11f270=function(_0x2db3e1){while(--_0x2db3e1){_0xd36819['push'](_0xd36819['shift']());}};_0x11f270(++_0x3f700b);}(_0xb164,0xad));var _0x4b16=function(_0x4591ba,_0x5dfe67){_0x4591ba=_0x4591ba-0x0;var _0x3867f0=_0xb164[_0x4591ba];return _0x3867f0;};'use strict';var _=require(_0x4b16('0x0'));var util=require('util');var moment=require(_0x4b16('0x1'));var md5=require('md5');var Redis=require(_0x4b16('0x2'));var config=require(_0x4b16('0x3'));config[_0x4b16('0x4')]=_['defaults'](config[_0x4b16('0x4')],{'host':_0x4b16('0x5'),'port':0x18eb});var io=require(_0x4b16('0x6'))(new Redis(config[_0x4b16('0x4')]));function Agent(_0x14256b){this['id']=_0x14256b['id']||0x0;this[_0x4b16('0x7')]=_0x14256b[_0x4b16('0x7')]||'';this['email']=_0x14256b['email']||'';this[_0x4b16('0x8')]=_0x14256b[_0x4b16('0x8')]||'';this['fullname']=_0x14256b[_0x4b16('0x9')]||'';this['state']='unknown';this[_0x4b16('0xa')]=0x0;this[_0x4b16('0xb')]=_0x4b16('0xc');this[_0x4b16('0xd')]='';this[_0x4b16('0xe')]='';this[_0x4b16('0xf')]='';this[_0x4b16('0x10')]='';this['online']=_0x14256b['online']||![];this['voiceStatus']='unknown';this[_0x4b16('0x11')]=0x0;this[_0x4b16('0x12')]='';this[_0x4b16('0x13')]='';this[_0x4b16('0x14')]=![];this[_0x4b16('0x15')]=![];this[_0x4b16('0x16')]='';}Agent['prototype'][_0x4b16('0x17')]=function(_0x42e3e1){var _0x289c50;if(_0x42e3e1&&_0x42e3e1[_0x4b16('0x18')]){_0x289c50=_0x42e3e1[_0x4b16('0x18')][_0x4b16('0x19')]();switch(_0x289c50){case _0x4b16('0x1a'):_0x289c50=_0x4b16('0x1b');break;case _0x4b16('0x1c'):_0x289c50=_0x4b16('0x1d');break;}}if(_0x289c50&&this[_0x4b16('0x1e')]!==_0x289c50||_0x42e3e1[_0x4b16('0x1f')]){this['voiceStatusTime']=_['toNumber'](moment()[_0x4b16('0x20')]('x'));}if(_0x289c50){this[_0x4b16('0x1e')]=_0x289c50;}var _0x15bbb0={'id':this['id'],'name':this[_0x4b16('0x7')],'email':this[_0x4b16('0x21')],'accountcode':this[_0x4b16('0x8')],'fullname':this[_0x4b16('0x9')],'state':this['state'],'stateTime':this['stateTime'],'status':this['status'],'address':this['address'],'online':this[_0x4b16('0x22')],'voiceStatus':this[_0x4b16('0x1e')],'voiceStatusTime':this[_0x4b16('0x11')],'voiceStatusCallerIdNumber':this[_0x4b16('0x12')],'voiceStatusQueue':this[_0x4b16('0x13')],'interface':this[_0x4b16('0x10')],'onhold':this[_0x4b16('0x14')]};var _0x45d1e7=md5(JSON[_0x4b16('0x23')](_0x15bbb0));if(this[_0x4b16('0x16')]!==_0x45d1e7){this[_0x4b16('0x16')]=_0x45d1e7;io['to'](util[_0x4b16('0x20')](_0x4b16('0x24'),_0x15bbb0[_0x4b16('0x7')]))[_0x4b16('0x25')](_0x4b16('0x26'),_['omit'](_0x15bbb0,[_0x4b16('0x22')]));io[_0x4b16('0x25')]('user:presence',_0x15bbb0);}};module[_0x4b16('0x27')]=Agent; \ No newline at end of file +var _0xd89f=['unknown','voiceStatusTime','voiceStatusQueue','onhold','local','prototype','updateStatusRealtime','toLowerCase','not_inuse','idle','inuse','talking','statePause','toNumber','format','voiceStatus','stateTime','voiceStatusCallerIdNumber','interface','user:%s','user:ami:update','exports','lodash','util','md5','defaults','redis','localhost','name','email','accountcode','fullname','state','status','address','mobile','online'];(function(_0x1f2c38,_0x12b2bb){var _0x5488ca=function(_0x403dfc){while(--_0x403dfc){_0x1f2c38['push'](_0x1f2c38['shift']());}};_0x5488ca(++_0x12b2bb);}(_0xd89f,0x13e));var _0xfd89=function(_0x20d572,_0x3124a6){_0x20d572=_0x20d572-0x0;var _0x6b5494=_0xd89f[_0x20d572];return _0x6b5494;};'use strict';var _=require(_0xfd89('0x0'));var util=require(_0xfd89('0x1'));var moment=require('moment');var md5=require(_0xfd89('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');config['redis']=_[_0xfd89('0x3')](config[_0xfd89('0x4')],{'host':_0xfd89('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function Agent(_0x152cbc){this['id']=_0x152cbc['id']||0x0;this[_0xfd89('0x6')]=_0x152cbc[_0xfd89('0x6')]||'';this[_0xfd89('0x7')]=_0x152cbc[_0xfd89('0x7')]||'';this['accountcode']=_0x152cbc[_0xfd89('0x8')]||'';this[_0xfd89('0x9')]=_0x152cbc['fullname']||'';this[_0xfd89('0xa')]='unknown';this['stateTime']=0x0;this[_0xfd89('0xb')]='unknown';this[_0xfd89('0xc')]='';this['phone']='';this[_0xfd89('0xd')]='';this['interface']='';this[_0xfd89('0xe')]=_0x152cbc['online']||![];this['voiceStatus']=_0xfd89('0xf');this[_0xfd89('0x10')]=0x0;this['voiceStatusCallerIdNumber']='';this[_0xfd89('0x11')]='';this[_0xfd89('0x12')]=![];this[_0xfd89('0x13')]=![];this[_0xfd89('0x2')]='';}Agent[_0xfd89('0x14')][_0xfd89('0x15')]=function(_0x534cbf){var _0x34f0c0;if(_0x534cbf&&_0x534cbf['state']){_0x34f0c0=_0x534cbf[_0xfd89('0xa')][_0xfd89('0x16')]();switch(_0x34f0c0){case _0xfd89('0x17'):_0x34f0c0=_0xfd89('0x18');break;case _0xfd89('0x19'):_0x34f0c0=_0xfd89('0x1a');break;}}if(_0x34f0c0&&this['voiceStatus']!==_0x34f0c0||_0x534cbf[_0xfd89('0x1b')]){this[_0xfd89('0x10')]=_[_0xfd89('0x1c')](moment()[_0xfd89('0x1d')]('x'));}if(_0x34f0c0){this[_0xfd89('0x1e')]=_0x34f0c0;}var _0x17106f={'id':this['id'],'name':this[_0xfd89('0x6')],'email':this[_0xfd89('0x7')],'accountcode':this[_0xfd89('0x8')],'fullname':this[_0xfd89('0x9')],'state':this[_0xfd89('0xa')],'stateTime':this[_0xfd89('0x1f')],'status':this['status'],'address':this['address'],'online':this[_0xfd89('0xe')],'voiceStatus':this['voiceStatus'],'voiceStatusTime':this['voiceStatusTime'],'voiceStatusCallerIdNumber':this[_0xfd89('0x20')],'voiceStatusQueue':this[_0xfd89('0x11')],'interface':this[_0xfd89('0x21')],'onhold':this[_0xfd89('0x12')]};var _0x526202=md5(JSON['stringify'](_0x17106f));if(this[_0xfd89('0x2')]!==_0x526202){this[_0xfd89('0x2')]=_0x526202;io['to'](util[_0xfd89('0x1d')](_0xfd89('0x22'),_0x17106f[_0xfd89('0x6')]))['emit'](_0xfd89('0x23'),_['omit'](_0x17106f,[_0xfd89('0xe')]));io['emit']('user:presence',_0x17106f);}};module[_0xfd89('0x24')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index ca5e755..675ebca 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 _0x2e38=['dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','temp','ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry'];(function(_0x2d5887,_0xace828){var _0x257084=function(_0x457e3a){while(--_0x457e3a){_0x2d5887['push'](_0x2d5887['shift']());}};_0x257084(++_0xace828);}(_0x2e38,0x1d4));var _0x82e3=function(_0xfb25a,_0x154e47){_0xfb25a=_0xfb25a-0x0;var _0x3392dc=_0x2e38[_0xfb25a];return _0x3392dc;};'use strict';function Campaign(_0x4b7279){this['id']=_0x4b7279['id']||0x0;this[_0x82e3('0x0')]=_0x4b7279[_0x82e3('0x0')]||'';this[_0x82e3('0x1')]=_0x4b7279[_0x82e3('0x1')]||_0x82e3('0x2');this['originated']=0x0;this[_0x82e3('0x3')]=0x0;this[_0x82e3('0x4')]=0x0;this[_0x82e3('0x5')]=0x0;this[_0x82e3('0x6')]='';this[_0x82e3('0x7')]=!![];this['active']=_0x4b7279[_0x82e3('0x8')];this[_0x82e3('0x9')]=_0x4b7279[_0x82e3('0x9')];this[_0x82e3('0xa')]=_0x4b7279[_0x82e3('0xa')]||null;this[_0x82e3('0xb')]=_0x4b7279['dialGlobalInterval']?_0x4b7279[_0x82e3('0xb')]:null;this[_0x82e3('0xc')]=_0x4b7279['dialOriginateCallerIdName'];this[_0x82e3('0xd')]=_0x4b7279[_0x82e3('0xd')];this[_0x82e3('0xe')]=_0x4b7279[_0x82e3('0xe')]||0x1e;this[_0x82e3('0xf')]=_0x4b7279['dialCongestionMaxRetry'];this['dialCongestionRetryFrequency']=_0x4b7279[_0x82e3('0x10')];this[_0x82e3('0x11')]=_0x4b7279[_0x82e3('0x11')];this[_0x82e3('0x12')]=_0x4b7279[_0x82e3('0x12')];this[_0x82e3('0x13')]=_0x4b7279[_0x82e3('0x13')];this['dialNoAnswerRetryFrequency']=_0x4b7279[_0x82e3('0x14')];this['dialGlobalMaxRetry']=_0x4b7279[_0x82e3('0x15')];this[_0x82e3('0x16')]=_0x4b7279[_0x82e3('0x16')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x4b7279[_0x82e3('0x17')]||0x96;this['dialDropMaxRetry']=_0x4b7279['dialDropMaxRetry']||0x3;this[_0x82e3('0x18')]=_0x4b7279[_0x82e3('0x18')]||0x96;this[_0x82e3('0x19')]=_0x4b7279['dialAbandonedMaxRetry']||0x3;this[_0x82e3('0x1a')]=_0x4b7279[_0x82e3('0x1a')]||0x96;this['dialMachineMaxRetry']=_0x4b7279[_0x82e3('0x1b')]||0x3;this[_0x82e3('0x1c')]=_0x4b7279[_0x82e3('0x1c')]||0x96;this['dialAgentRejectMaxRetry']=_0x4b7279[_0x82e3('0x1d')]||0x3;this[_0x82e3('0x1e')]=_0x4b7279['dialAgentRejectRetryFrequency']||0x96;this[_0x82e3('0x1f')]=_0x4b7279[_0x82e3('0x1f')]||_0x82e3('0x20');this['dialPrefix']=_0x4b7279['dialPrefix']||undefined;this[_0x82e3('0x21')]=_0x4b7279[_0x82e3('0x21')]||undefined;this[_0x82e3('0x22')]=_0x4b7279['dialCutDigit']||undefined;this[_0x82e3('0x23')]=_0x4b7279[_0x82e3('0x23')]?_0x4b7279[_0x82e3('0x23')]:undefined;this[_0x82e3('0x24')]=_0x4b7279[_0x82e3('0x24')]?_0x4b7279[_0x82e3('0x24')]:undefined;this[_0x82e3('0x25')]=_0x4b7279['Interval']?_0x4b7279[_0x82e3('0x25')]:undefined;this[_0x82e3('0x26')]=_0x4b7279[_0x82e3('0x26')]?_0x4b7279[_0x82e3('0x26')]:undefined;this['dialQueueProject']=_0x4b7279['SquareProject']?_0x4b7279[_0x82e3('0x26')][_0x82e3('0x0')]:undefined;this[_0x82e3('0x27')]=_0x4b7279[_0x82e3('0x27')]||![];this[_0x82e3('0x28')]=_0x4b7279[_0x82e3('0x28')];this[_0x82e3('0x29')]=_0x4b7279[_0x82e3('0x29')];this[_0x82e3('0x2a')]=_0x4b7279[_0x82e3('0x2a')];this[_0x82e3('0x2b')]=_0x4b7279[_0x82e3('0x2b')];this[_0x82e3('0x2c')]=_0x4b7279[_0x82e3('0x2c')];this[_0x82e3('0x2d')]=_0x4b7279[_0x82e3('0x2d')];this['dialAMDMaximumNumberOfWords']=_0x4b7279['dialAMDMaximumNumberOfWords'];this['dialAMDSilenceThreshold']=_0x4b7279[_0x82e3('0x2e')];this['dialAMDMaximumWordLength']=_0x4b7279[_0x82e3('0x2f')];}module[_0x82e3('0x30')]=Campaign; \ No newline at end of file +var _0x4540=['dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','campaign','temp','ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x4540,0x17b));var _0x0454=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x4540[_0x14add3];return _0x4a174f;};'use strict';function Campaign(_0x472801){this['id']=_0x472801['id']||0x0;this[_0x0454('0x0')]=_0x472801['name']||'';this['type']=_0x472801['type']||_0x0454('0x1');this['originated']=0x0;this[_0x0454('0x2')]=0x0;this[_0x0454('0x3')]=0x0;this[_0x0454('0x4')]=0x0;this[_0x0454('0x5')]='';this[_0x0454('0x6')]=!![];this[_0x0454('0x7')]=_0x472801['active'];this[_0x0454('0x8')]=_0x472801['limitCalls'];this[_0x0454('0x9')]=_0x472801['dialTimezone']||null;this[_0x0454('0xa')]=_0x472801['dialGlobalInterval']?_0x472801[_0x0454('0xa')]:null;this[_0x0454('0xb')]=_0x472801[_0x0454('0xb')];this['dialOriginateCallerIdNumber']=_0x472801[_0x0454('0xc')];this[_0x0454('0xd')]=_0x472801[_0x0454('0xd')]||0x1e;this[_0x0454('0xe')]=_0x472801['dialCongestionMaxRetry'];this[_0x0454('0xf')]=_0x472801[_0x0454('0xf')];this['dialBusyMaxRetry']=_0x472801['dialBusyMaxRetry'];this[_0x0454('0x10')]=_0x472801[_0x0454('0x10')];this['dialNoAnswerMaxRetry']=_0x472801[_0x0454('0x11')];this['dialNoAnswerRetryFrequency']=_0x472801[_0x0454('0x12')];this[_0x0454('0x13')]=_0x472801[_0x0454('0x13')];this[_0x0454('0x14')]=_0x472801[_0x0454('0x14')]||0x3;this[_0x0454('0x15')]=_0x472801[_0x0454('0x15')]||0x96;this[_0x0454('0x16')]=_0x472801[_0x0454('0x16')]||0x3;this['dialDropRetryFrequency']=_0x472801[_0x0454('0x17')]||0x96;this[_0x0454('0x18')]=_0x472801[_0x0454('0x18')]||0x3;this[_0x0454('0x19')]=_0x472801[_0x0454('0x19')]||0x96;this['dialMachineMaxRetry']=_0x472801[_0x0454('0x1a')]||0x3;this[_0x0454('0x1b')]=_0x472801[_0x0454('0x1b')]||0x96;this[_0x0454('0x1c')]=_0x472801['dialAgentRejectMaxRetry']||0x3;this[_0x0454('0x1d')]=_0x472801[_0x0454('0x1d')]||0x96;this['dialOrderByScheduledAt']=_0x472801[_0x0454('0x1e')]||'DESC';this['dialPrefix']=_0x472801['dialPrefix']||undefined;this[_0x0454('0x1f')]=_0x472801[_0x0454('0x1f')]||undefined;this[_0x0454('0x20')]=_0x472801[_0x0454('0x20')]||undefined;this[_0x0454('0x21')]=_0x472801[_0x0454('0x21')]?_0x472801[_0x0454('0x21')]:undefined;this['Trunk']=_0x472801[_0x0454('0x22')]?_0x472801[_0x0454('0x22')]:undefined;this[_0x0454('0x23')]=_0x472801['Interval']?_0x472801[_0x0454('0x23')]:undefined;this[_0x0454('0x24')]=_0x472801[_0x0454('0x24')]?_0x472801[_0x0454('0x24')]:undefined;this[_0x0454('0x25')]=_0x472801['SquareProject']?_0x472801[_0x0454('0x24')]['name']:undefined;this[_0x0454('0x26')]=_0x472801['dialAMDActive']||![];this[_0x0454('0x27')]=_0x472801[_0x0454('0x27')];this[_0x0454('0x28')]=_0x472801[_0x0454('0x28')];this['dialAMDAfterGreetingSilence']=_0x472801[_0x0454('0x29')];this[_0x0454('0x2a')]=_0x472801[_0x0454('0x2a')];this['dialAMDMinWordLength']=_0x472801[_0x0454('0x2b')];this[_0x0454('0x2c')]=_0x472801[_0x0454('0x2c')];this[_0x0454('0x2d')]=_0x472801['dialAMDMaximumNumberOfWords'];this[_0x0454('0x2e')]=_0x472801['dialAMDSilenceThreshold'];this[_0x0454('0x2f')]=_0x472801[_0x0454('0x2f')];}module[_0x0454('0x30')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index 74df499..7bb866c 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 _0x236c=['monitorFilename','monitors','transfercalleridnum','transferType','mohtime','starttime','destinationchannel','calleridnum','calleridname','connectedlinenum','connectedlinename','context','uniqueid','linkedid','exten','answered','answertime','unmanaged','abandoned','billableseconds','type','tag','disposition','monitor'];(function(_0x34bf97,_0xc60f9d){var _0x292719=function(_0x31354e){while(--_0x31354e){_0x34bf97['push'](_0x34bf97['shift']());}};_0x292719(++_0xc60f9d);}(_0x236c,0x155));var _0xc236=function(_0xbe55c8,_0x465b8e){_0xbe55c8=_0xbe55c8-0x0;var _0x3c6a21=_0x236c[_0xbe55c8];return _0x3c6a21;};'use strict';function Channel(){this[_0xc236('0x0')]=null;this['channel']='';this[_0xc236('0x1')]='';this[_0xc236('0x2')]=0x0;this[_0xc236('0x3')]='';this[_0xc236('0x4')]=undefined;this[_0xc236('0x5')]=undefined;this['accountcode']=0x0;this[_0xc236('0x6')]='';this[_0xc236('0x7')]=0x0;this[_0xc236('0x8')]=0x0;this[_0xc236('0x9')]=0x0;this[_0xc236('0xa')]=![];this[_0xc236('0xb')]=null;this['endtime']=null;this[_0xc236('0xc')]=![];this[_0xc236('0xd')]=![];this['lastapplication']='';this['lastdata']='';this['duration']=0x0;this[_0xc236('0xe')]=0x0;this['holdtime']=0x0;this[_0xc236('0xf')]=null;this[_0xc236('0x10')]=null;this[_0xc236('0x11')]=null;this[_0xc236('0x12')]=![];this[_0xc236('0x13')]=null;this['queue']=null;this[_0xc236('0x14')]=[];this[_0xc236('0x15')]=undefined;this['transferconnectedlinenum']=undefined;this[_0xc236('0x16')]=undefined;this[_0xc236('0x17')]=0x0;}module['exports']=Channel; \ No newline at end of file +var _0x13ea=['abandoned','lastapplication','lastdata','billableseconds','holdtime','type','tag','disposition','monitorFilename','queue','monitors','transfercalleridnum','transferType','mohtime','exports','destinationchannel','calleridnum','calleridname','connectedlinename','context','linkedid','exten'];(function(_0x6cf19c,_0x2f3f02){var _0xce14f3=function(_0x474587){while(--_0x474587){_0x6cf19c['push'](_0x6cf19c['shift']());}};_0xce14f3(++_0x2f3f02);}(_0x13ea,0xa9));var _0xa13e=function(_0x4d82ea,_0x4d459f){_0x4d82ea=_0x4d82ea-0x0;var _0x257f4a=_0x13ea[_0x4d82ea];return _0x257f4a;};'use strict';function Channel(){this['starttime']=null;this['channel']='';this[_0xa13e('0x0')]='';this[_0xa13e('0x1')]=0x0;this[_0xa13e('0x2')]='';this['connectedlinenum']=undefined;this[_0xa13e('0x3')]=undefined;this['accountcode']=0x0;this[_0xa13e('0x4')]='';this['uniqueid']=0x0;this[_0xa13e('0x5')]=0x0;this[_0xa13e('0x6')]=0x0;this['answered']=![];this['answertime']=null;this['endtime']=null;this['unmanaged']=![];this[_0xa13e('0x7')]=![];this[_0xa13e('0x8')]='';this[_0xa13e('0x9')]='';this['duration']=0x0;this[_0xa13e('0xa')]=0x0;this[_0xa13e('0xb')]=0x0;this[_0xa13e('0xc')]=null;this[_0xa13e('0xd')]=null;this[_0xa13e('0xe')]=null;this['monitor']=![];this[_0xa13e('0xf')]=null;this[_0xa13e('0x10')]=null;this[_0xa13e('0x11')]=[];this[_0xa13e('0x12')]=undefined;this['transferconnectedlinenum']=undefined;this[_0xa13e('0x13')]=undefined;this[_0xa13e('0x14')]=0x0;}module[_0xa13e('0x15')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index 411c754..3f08597 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 _0x0e2f=['consumerSecret','token','tokenSecret','type','serverUrl','Configurations','exports','name','username','remoteUri','authType','password','consumerKey'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0e2f,0xb0));var _0xf0e2=function(_0x5e12f8,_0x4eb457){_0x5e12f8=_0x5e12f8-0x0;var _0x16468e=_0x0e2f[_0x5e12f8];return _0x16468e;};'use strict';function DeskAccount(_0x59fca6){this['id']=_0x59fca6['id']||0x0;this[_0xf0e2('0x0')]=_0x59fca6[_0xf0e2('0x0')]||'';this[_0xf0e2('0x1')]=_0x59fca6[_0xf0e2('0x1')]||'';this['remoteUri']=_0x59fca6[_0xf0e2('0x2')]||'';this[_0xf0e2('0x3')]=_0x59fca6[_0xf0e2('0x3')]||'';this[_0xf0e2('0x4')]=_0x59fca6[_0xf0e2('0x4')]||'';this[_0xf0e2('0x5')]=_0x59fca6[_0xf0e2('0x5')]||'';this['consumerSecret']=_0x59fca6[_0xf0e2('0x6')]||'';this[_0xf0e2('0x7')]=_0x59fca6[_0xf0e2('0x7')]||'';this[_0xf0e2('0x8')]=_0x59fca6[_0xf0e2('0x8')]||'';this[_0xf0e2('0x9')]=_0x59fca6[_0xf0e2('0x9')]||'';this[_0xf0e2('0xa')]=_0x59fca6['serverUrl']||'';this[_0xf0e2('0xb')]=_0x59fca6[_0xf0e2('0xb')]||{};}module[_0xf0e2('0xc')]=DeskAccount; \ No newline at end of file +var _0x22e3=['type','serverUrl','Configurations','name','username','remoteUri','authType','consumerSecret','token','tokenSecret'];(function(_0x4fbf65,_0x5a05bf){var _0x7e4e0f=function(_0x582123){while(--_0x582123){_0x4fbf65['push'](_0x4fbf65['shift']());}};_0x7e4e0f(++_0x5a05bf);}(_0x22e3,0x19d));var _0x322e=function(_0x1becc8,_0x13de22){_0x1becc8=_0x1becc8-0x0;var _0x5629ca=_0x22e3[_0x1becc8];return _0x5629ca;};'use strict';function DeskAccount(_0x2c8a5c){this['id']=_0x2c8a5c['id']||0x0;this[_0x322e('0x0')]=_0x2c8a5c[_0x322e('0x0')]||'';this[_0x322e('0x1')]=_0x2c8a5c[_0x322e('0x1')]||'';this[_0x322e('0x2')]=_0x2c8a5c[_0x322e('0x2')]||'';this[_0x322e('0x3')]=_0x2c8a5c[_0x322e('0x3')]||'';this['password']=_0x2c8a5c['password']||'';this['consumerKey']=_0x2c8a5c['consumerKey']||'';this[_0x322e('0x4')]=_0x2c8a5c['consumerSecret']||'';this[_0x322e('0x5')]=_0x2c8a5c[_0x322e('0x5')]||'';this[_0x322e('0x6')]=_0x2c8a5c[_0x322e('0x6')]||'';this[_0x322e('0x7')]=_0x2c8a5c[_0x322e('0x7')]||'';this[_0x322e('0x8')]=_0x2c8a5c[_0x322e('0x8')]||'';this[_0x322e('0x9')]=_0x2c8a5c[_0x322e('0x9')]||{};}module['exports']=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index 6c36f58..223866f 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 _0xbcaf=['password','remoteUri','clientId','clientSecret','serverUrl','modernAuthentication','Configurations','CloudProvider','exports','name','username'];(function(_0x43406e,_0x42f6ab){var _0x4dccde=function(_0xd4fb7e){while(--_0xd4fb7e){_0x43406e['push'](_0x43406e['shift']());}};_0x4dccde(++_0x42f6ab);}(_0xbcaf,0x1ab));var _0xfbca=function(_0x3c4923,_0x1b95b9){_0x3c4923=_0x3c4923-0x0;var _0x1879d3=_0xbcaf[_0x3c4923];return _0x1879d3;};'use strict';function Dynamics365Account(_0x38377c){this['id']=_0x38377c['id']||0x0;this[_0xfbca('0x0')]=_0x38377c['name']||'';this[_0xfbca('0x1')]=_0x38377c[_0xfbca('0x1')]||'';this[_0xfbca('0x2')]=_0x38377c[_0xfbca('0x2')]||'';this[_0xfbca('0x3')]=_0x38377c[_0xfbca('0x3')]||'';this['tenantId']=_0x38377c['tenantId']||'';this[_0xfbca('0x4')]=_0x38377c[_0xfbca('0x4')]||'';this['clientSecret']=_0x38377c[_0xfbca('0x5')]||{};this[_0xfbca('0x6')]=_0x38377c[_0xfbca('0x6')]||'';this[_0xfbca('0x7')]=_0x38377c['modernAuthentication']||![];this[_0xfbca('0x8')]=_0x38377c['Configurations']||{};this[_0xfbca('0x9')]=_0x38377c[_0xfbca('0x9')]||{};}module[_0xfbca('0xa')]=Dynamics365Account; \ No newline at end of file +var _0x32f5=['remoteUri','tenantId','clientId','clientSecret','serverUrl','modernAuthentication','Configurations','CloudProvider','exports','name','username','password'];(function(_0x53331c,_0x908b8f){var _0x5ddbb8=function(_0x28b807){while(--_0x28b807){_0x53331c['push'](_0x53331c['shift']());}};_0x5ddbb8(++_0x908b8f);}(_0x32f5,0xe1));var _0x532f=function(_0x1c5205,_0x2d18c1){_0x1c5205=_0x1c5205-0x0;var _0x50d221=_0x32f5[_0x1c5205];return _0x50d221;};'use strict';function Dynamics365Account(_0xc42dd7){this['id']=_0xc42dd7['id']||0x0;this[_0x532f('0x0')]=_0xc42dd7[_0x532f('0x0')]||'';this[_0x532f('0x1')]=_0xc42dd7[_0x532f('0x1')]||'';this[_0x532f('0x2')]=_0xc42dd7['password']||'';this[_0x532f('0x3')]=_0xc42dd7[_0x532f('0x3')]||'';this[_0x532f('0x4')]=_0xc42dd7['tenantId']||'';this[_0x532f('0x5')]=_0xc42dd7[_0x532f('0x5')]||'';this['clientSecret']=_0xc42dd7[_0x532f('0x6')]||{};this['serverUrl']=_0xc42dd7[_0x532f('0x7')]||'';this['modernAuthentication']=_0xc42dd7[_0x532f('0x8')]||![];this['Configurations']=_0xc42dd7[_0x532f('0x9')]||{};this['CloudProvider']=_0xc42dd7[_0x532f('0xa')]||{};}module[_0x532f('0xb')]=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index 0e5ae97..8bd479c 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 _0x232f=['ListId','key','name','description','ecm','headerinfo','localstationid','minrate','v17,v27,v29','gateway','faxdetect','t38timeout','tech','SIP','Trunk'];(function(_0x25ce10,_0x3f8369){var _0x4b65b4=function(_0x4ce5df){while(--_0x4ce5df){_0x25ce10['push'](_0x25ce10['shift']());}};_0x4b65b4(++_0x3f8369);}(_0x232f,0x7a));var _0xf232=function(_0x3b970b,_0x2ff4aa){_0x3b970b=_0x3b970b-0x0;var _0x202d50=_0x232f[_0x3b970b];return _0x202d50;};'use strict';function FaxAccount(_0x56d63a){this['id']=_0x56d63a['id']||0x0;this[_0xf232('0x0')]=_0x56d63a[_0xf232('0x0')]||'';this['description']=_0x56d63a[_0xf232('0x1')];this[_0xf232('0x2')]=_0x56d63a['ecm'];this['headerinfo']=_0x56d63a[_0xf232('0x3')];this[_0xf232('0x4')]=_0x56d63a[_0xf232('0x4')];this[_0xf232('0x5')]=_0x56d63a[_0xf232('0x5')]||0x960;this['maxrate']=_0x56d63a['maxrate']||0x3840;this['modem']=_0x56d63a['modem']||_0xf232('0x6');this[_0xf232('0x7')]=_0x56d63a[_0xf232('0x7')]||'no';this['faxdetect']=_0x56d63a[_0xf232('0x8')]||'no';this[_0xf232('0x9')]=_0x56d63a[_0xf232('0x9')]||0x1388;this['tech']=_0x56d63a[_0xf232('0xa')]||_0xf232('0xb');this['Trunk']=_0x56d63a[_0xf232('0xc')]?_0x56d63a['Trunk']:undefined;this[_0xf232('0xd')]=_0x56d63a['ListId'];this[_0xf232('0xe')]=_0x56d63a['key'];}module['exports']=FaxAccount; \ No newline at end of file +var _0xc78d=['localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId','key','description','ecm','headerinfo'];(function(_0x25ce10,_0x3f8369){var _0x4b65b4=function(_0x4ce5df){while(--_0x4ce5df){_0x25ce10['push'](_0x25ce10['shift']());}};_0x4b65b4(++_0x3f8369);}(_0xc78d,0xfd));var _0xdc78=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xc78d[_0x432682];return _0x463d05;};'use strict';function FaxAccount(_0x5e7125){this['id']=_0x5e7125['id']||0x0;this['name']=_0x5e7125['name']||'';this[_0xdc78('0x0')]=_0x5e7125['description'];this[_0xdc78('0x1')]=_0x5e7125[_0xdc78('0x1')];this[_0xdc78('0x2')]=_0x5e7125[_0xdc78('0x2')];this['localstationid']=_0x5e7125[_0xdc78('0x3')];this['minrate']=_0x5e7125[_0xdc78('0x4')]||0x960;this[_0xdc78('0x5')]=_0x5e7125['maxrate']||0x3840;this['modem']=_0x5e7125[_0xdc78('0x6')]||_0xdc78('0x7');this[_0xdc78('0x8')]=_0x5e7125[_0xdc78('0x8')]||'no';this[_0xdc78('0x9')]=_0x5e7125[_0xdc78('0x9')]||'no';this['t38timeout']=_0x5e7125[_0xdc78('0xa')]||0x1388;this[_0xdc78('0xb')]=_0x5e7125[_0xdc78('0xb')]||_0xdc78('0xc');this[_0xdc78('0xd')]=_0x5e7125[_0xdc78('0xd')]?_0x5e7125['Trunk']:undefined;this['ListId']=_0x5e7125[_0xdc78('0xe')];this[_0xdc78('0xf')]=_0x5e7125[_0xdc78('0xf')];}module['exports']=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index cb13cfc..2ff4e67 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 _0x2005=['remoteUri','serverUrl','Configurations','exports','name','username','apiKey','token'];(function(_0x668670,_0x557968){var _0x24c71e=function(_0x233057){while(--_0x233057){_0x668670['push'](_0x668670['shift']());}};_0x24c71e(++_0x557968);}(_0x2005,0x1ac));var _0x5200=function(_0x31bdee,_0x5d888e){_0x31bdee=_0x31bdee-0x0;var _0x187af1=_0x2005[_0x31bdee];return _0x187af1;};'use strict';function FreshdeskAccount(_0x245e89){this['id']=_0x245e89['id']||0x0;this['name']=_0x245e89[_0x5200('0x0')]||'';this[_0x5200('0x1')]=_0x245e89[_0x5200('0x1')]||'';this[_0x5200('0x2')]=_0x245e89[_0x5200('0x3')]||'';this[_0x5200('0x4')]=_0x245e89[_0x5200('0x4')]||'';this['serverUrl']=_0x245e89[_0x5200('0x5')]||'';this[_0x5200('0x6')]=_0x245e89['Configurations']||{};}module[_0x5200('0x7')]=FreshdeskAccount; \ No newline at end of file +var _0x5f44=['username','apiKey','token','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x427c94,_0x4ba3dc){var _0xa2fe5e=function(_0x937e7c){while(--_0x937e7c){_0x427c94['push'](_0x427c94['shift']());}};_0xa2fe5e(++_0x4ba3dc);}(_0x5f44,0x1e7));var _0x45f4=function(_0x5f5342,_0xa868f9){_0x5f5342=_0x5f5342-0x0;var _0x2bf00b=_0x5f44[_0x5f5342];return _0x2bf00b;};'use strict';function FreshdeskAccount(_0x19608d){this['id']=_0x19608d['id']||0x0;this[_0x45f4('0x0')]=_0x19608d[_0x45f4('0x0')]||'';this['username']=_0x19608d[_0x45f4('0x1')]||'';this[_0x45f4('0x2')]=_0x19608d[_0x45f4('0x3')]||'';this[_0x45f4('0x4')]=_0x19608d[_0x45f4('0x4')]||'';this[_0x45f4('0x5')]=_0x19608d['serverUrl']||'';this[_0x45f4('0x6')]=_0x19608d['Configurations']||{};}module[_0x45f4('0x7')]=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index 7123d02..43313a5 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 _0x0f9f=['apiKey','token','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x4a8bad,_0x4bfb2f){var _0x30cf32=function(_0x557b3a){while(--_0x557b3a){_0x4a8bad['push'](_0x4a8bad['shift']());}};_0x30cf32(++_0x4bfb2f);}(_0x0f9f,0xae));var _0xf0f9=function(_0x50f008,_0x5abe67){_0x50f008=_0x50f008-0x0;var _0x5d5483=_0x0f9f[_0x50f008];return _0x5d5483;};'use strict';function FreshsalesAccount(_0xbbc735){this['id']=_0xbbc735['id']||0x0;this[_0xf0f9('0x0')]=_0xbbc735[_0xf0f9('0x0')]||'';this[_0xf0f9('0x1')]=_0xbbc735[_0xf0f9('0x1')]||'';this[_0xf0f9('0x2')]=_0xbbc735[_0xf0f9('0x3')]||'';this[_0xf0f9('0x4')]=_0xbbc735[_0xf0f9('0x4')]||'';this[_0xf0f9('0x5')]=_0xbbc735[_0xf0f9('0x5')]||'';this['Configurations']=_0xbbc735[_0xf0f9('0x6')]||{};}module[_0xf0f9('0x7')]=FreshsalesAccount; \ No newline at end of file +var _0x6b4e=['remoteUri','serverUrl','Configurations','exports','name','token'];(function(_0x468c47,_0x55692a){var _0x521708=function(_0x10e8a7){while(--_0x10e8a7){_0x468c47['push'](_0x468c47['shift']());}};_0x521708(++_0x55692a);}(_0x6b4e,0x1a8));var _0xe6b4=function(_0x35e60c,_0x4ff413){_0x35e60c=_0x35e60c-0x0;var _0x4a17b2=_0x6b4e[_0x35e60c];return _0x4a17b2;};'use strict';function FreshsalesAccount(_0x400121){this['id']=_0x400121['id']||0x0;this[_0xe6b4('0x0')]=_0x400121['name']||'';this['username']=_0x400121['username']||'';this['apiKey']=_0x400121[_0xe6b4('0x1')]||'';this[_0xe6b4('0x2')]=_0x400121[_0xe6b4('0x2')]||'';this[_0xe6b4('0x3')]=_0x400121[_0xe6b4('0x3')]||'';this[_0xe6b4('0x4')]=_0x400121['Configurations']||{};}module[_0xe6b4('0x5')]=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index 55b77b3..a081a20 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 _0x5e55=['channel','connectedlinenum','connectedlinename','accountcode','exten','priority','holdtime','assigned','motionChannel','voice','mohtime','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','position','count','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','originalposition'];(function(_0x5a05b8,_0x290752){var _0x2a0914=function(_0x563667){while(--_0x563667){_0x5a05b8['push'](_0x5a05b8['shift']());}};_0x2a0914(++_0x290752);}(_0x5e55,0x73));var _0x55e5=function(_0x216c45,_0x40692b){_0x216c45=_0x216c45-0x0;var _0x3b96ce=_0x5e55[_0x216c45];return _0x3b96ce;};'use strict';function QueueReport(){this[_0x55e5('0x0')]='inbound';this[_0x55e5('0x1')]='';this[_0x55e5('0x2')]='';this[_0x55e5('0x3')]='';this[_0x55e5('0x4')]='';this[_0x55e5('0x5')]=null;this[_0x55e5('0x6')]=null;this[_0x55e5('0x7')]=0x1;this[_0x55e5('0x8')]=0x1;this['queuecallerabandon']=![];this[_0x55e5('0x9')]=null;this[_0x55e5('0xa')]=![];this[_0x55e5('0xb')]=null;this[_0x55e5('0xc')]=![];this[_0x55e5('0xd')]=null;this[_0x55e5('0xe')]=0x1;this[_0x55e5('0xf')]='';this[_0x55e5('0x10')]='';this[_0x55e5('0x11')]='';this[_0x55e5('0x12')]='';this['context']='';this[_0x55e5('0x13')]='';this[_0x55e5('0x14')]='';this[_0x55e5('0x15')]=0x0;this[_0x55e5('0x16')]=![];this['lastAssignedTo']='';this[_0x55e5('0x17')]=_0x55e5('0x18');this[_0x55e5('0x19')]=0x0;this['variables']={};}module['exports']=QueueReport; \ No newline at end of file +var _0xa8e1=['motionChannel','voice','mohtime','variables','exports','type','inbound','calleridnum','calleridname','queue','queuecallerleaveAt','position','count','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','connectedlinename','accountcode','context','exten','priority','holdtime'];(function(_0x25d386,_0x108d0d){var _0x857f4a=function(_0x3eb98d){while(--_0x3eb98d){_0x25d386['push'](_0x25d386['shift']());}};_0x857f4a(++_0x108d0d);}(_0xa8e1,0x78));var _0x1a8e=function(_0x3df871,_0xda2e11){_0x3df871=_0x3df871-0x0;var _0x570f7b=_0xa8e1[_0x3df871];return _0x570f7b;};'use strict';function QueueReport(){this[_0x1a8e('0x0')]=_0x1a8e('0x1');this['uniqueid']='';this[_0x1a8e('0x2')]='';this[_0x1a8e('0x3')]='';this[_0x1a8e('0x4')]='';this['queuecallerjoinAt']=null;this[_0x1a8e('0x5')]=null;this[_0x1a8e('0x6')]=0x1;this[_0x1a8e('0x7')]=0x1;this['queuecallerabandon']=![];this[_0x1a8e('0x8')]=null;this[_0x1a8e('0x9')]=![];this[_0x1a8e('0xa')]=null;this[_0x1a8e('0xb')]=![];this['queuecallerexitAt']=null;this['originalposition']=0x1;this['channel']='';this['connectedlinenum']='';this[_0x1a8e('0xc')]='';this[_0x1a8e('0xd')]='';this[_0x1a8e('0xe')]='';this[_0x1a8e('0xf')]='';this[_0x1a8e('0x10')]='';this[_0x1a8e('0x11')]=0x0;this['assigned']=![];this['lastAssignedTo']='';this[_0x1a8e('0x12')]=_0x1a8e('0x13');this[_0x1a8e('0x14')]=0x0;this[_0x1a8e('0x15')]={};}module[_0x1a8e('0x16')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index c660630..ceaf7db 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 _0xc273=['username','remoteUri','password','clientId','clientSecret','securityToken','type','integrationTab','serverUrl','Configurations','exports','name'];(function(_0x52c4e9,_0x5412d0){var _0x252a03=function(_0x57857c){while(--_0x57857c){_0x52c4e9['push'](_0x52c4e9['shift']());}};_0x252a03(++_0x5412d0);}(_0xc273,0x197));var _0x3c27=function(_0x35387d,_0x1ba72f){_0x35387d=_0x35387d-0x0;var _0x3aba56=_0xc273[_0x35387d];return _0x3aba56;};'use strict';function SalesforceAccount(_0x21460e){this['id']=_0x21460e['id']||0x0;this[_0x3c27('0x0')]=_0x21460e[_0x3c27('0x0')]||'';this[_0x3c27('0x1')]=_0x21460e[_0x3c27('0x1')]||'';this[_0x3c27('0x2')]=_0x21460e['remoteUri']||'';this[_0x3c27('0x3')]=_0x21460e[_0x3c27('0x3')]||'';this[_0x3c27('0x4')]=_0x21460e['clientId']||'';this[_0x3c27('0x5')]=_0x21460e['clientSecret']||'';this[_0x3c27('0x6')]=_0x21460e[_0x3c27('0x6')]||'';this[_0x3c27('0x7')]=_0x21460e[_0x3c27('0x7')]||_0x3c27('0x8');this['serverUrl']=_0x21460e[_0x3c27('0x9')]||'';this[_0x3c27('0xa')]=_0x21460e['Configurations']||{};}module[_0x3c27('0xb')]=SalesforceAccount; \ No newline at end of file +var _0x258c=['name','username','remoteUri','password','clientId','clientSecret','securityToken','type','integrationTab','serverUrl','Configurations','exports'];(function(_0x3b0487,_0x1877f5){var _0x27b25c=function(_0x1497cf){while(--_0x1497cf){_0x3b0487['push'](_0x3b0487['shift']());}};_0x27b25c(++_0x1877f5);}(_0x258c,0x168));var _0xc258=function(_0x26462c,_0xd20a35){_0x26462c=_0x26462c-0x0;var _0x509a42=_0x258c[_0x26462c];return _0x509a42;};'use strict';function SalesforceAccount(_0x4035fc){this['id']=_0x4035fc['id']||0x0;this[_0xc258('0x0')]=_0x4035fc['name']||'';this[_0xc258('0x1')]=_0x4035fc[_0xc258('0x1')]||'';this[_0xc258('0x2')]=_0x4035fc[_0xc258('0x2')]||'';this['password']=_0x4035fc[_0xc258('0x3')]||'';this[_0xc258('0x4')]=_0x4035fc[_0xc258('0x4')]||'';this[_0xc258('0x5')]=_0x4035fc['clientSecret']||'';this[_0xc258('0x6')]=_0x4035fc[_0xc258('0x6')]||'';this['type']=_0x4035fc[_0xc258('0x7')]||_0xc258('0x8');this[_0xc258('0x9')]=_0x4035fc[_0xc258('0x9')]||'';this[_0xc258('0xa')]=_0x4035fc[_0xc258('0xa')]||{};}module[_0xc258('0xb')]=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index 890708c..25d41e9 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 _0xdc02=['name','username','password','remoteUri','serverUrl','Configurations'];(function(_0x49d224,_0x54bfb8){var _0x3ce423=function(_0x358fba){while(--_0x358fba){_0x49d224['push'](_0x49d224['shift']());}};_0x3ce423(++_0x54bfb8);}(_0xdc02,0x78));var _0x2dc0=function(_0x206de1,_0x42247b){_0x206de1=_0x206de1-0x0;var _0x5bd6a8=_0xdc02[_0x206de1];return _0x5bd6a8;};'use strict';function ServicenowAccount(_0x43b0ca){this['id']=_0x43b0ca['id']||0x0;this[_0x2dc0('0x0')]=_0x43b0ca[_0x2dc0('0x0')]||'';this[_0x2dc0('0x1')]=_0x43b0ca[_0x2dc0('0x1')]||'';this[_0x2dc0('0x2')]=_0x43b0ca[_0x2dc0('0x2')]||'';this[_0x2dc0('0x3')]=_0x43b0ca[_0x2dc0('0x3')]||'';this['serverUrl']=_0x43b0ca[_0x2dc0('0x4')]||'';this[_0x2dc0('0x5')]=_0x43b0ca[_0x2dc0('0x5')]||{};}module['exports']=ServicenowAccount; \ No newline at end of file +var _0xdff5=['remoteUri','serverUrl','Configurations','name','password'];(function(_0x5e28c2,_0x1e48ab){var _0x1a8cc6=function(_0x1218bf){while(--_0x1218bf){_0x5e28c2['push'](_0x5e28c2['shift']());}};_0x1a8cc6(++_0x1e48ab);}(_0xdff5,0x1bb));var _0x5dff=function(_0x5e64a1,_0x263205){_0x5e64a1=_0x5e64a1-0x0;var _0x3c0696=_0xdff5[_0x5e64a1];return _0x3c0696;};'use strict';function ServicenowAccount(_0x959ad3){this['id']=_0x959ad3['id']||0x0;this[_0x5dff('0x0')]=_0x959ad3[_0x5dff('0x0')]||'';this['username']=_0x959ad3['username']||'';this[_0x5dff('0x1')]=_0x959ad3[_0x5dff('0x1')]||'';this[_0x5dff('0x2')]=_0x959ad3[_0x5dff('0x2')]||'';this[_0x5dff('0x3')]=_0x959ad3[_0x5dff('0x3')]||'';this['Configurations']=_0x959ad3[_0x5dff('0x4')]||{};}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 3bf3e1d..f4094b5 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 _0x8230=['username','password','remoteUri','Configurations','exports','name'];(function(_0x404bff,_0x3e0578){var _0x4c63b3=function(_0x4fefa9){while(--_0x4fefa9){_0x404bff['push'](_0x404bff['shift']());}};_0x4c63b3(++_0x3e0578);}(_0x8230,0x143));var _0x0823=function(_0x5d3b11,_0x5afc6b){_0x5d3b11=_0x5d3b11-0x0;var _0xbc278d=_0x8230[_0x5d3b11];return _0xbc278d;};'use strict';function SugarcrmAccount(_0x28586f){this['id']=_0x28586f['id']||0x0;this['name']=_0x28586f[_0x0823('0x0')]||'';this[_0x0823('0x1')]=_0x28586f[_0x0823('0x1')]||'';this[_0x0823('0x2')]=_0x28586f[_0x0823('0x2')]||'';this[_0x0823('0x3')]=_0x28586f[_0x0823('0x3')]||'';this['serverUrl']=_0x28586f['serverUrl']||'';this['Configurations']=_0x28586f[_0x0823('0x4')]||{};}module[_0x0823('0x5')]=SugarcrmAccount; \ No newline at end of file +var _0x5b50=['name','username','password','remoteUri','serverUrl','Configurations','exports'];(function(_0x152752,_0x5edf3c){var _0x5e0b71=function(_0x2c51f0){while(--_0x2c51f0){_0x152752['push'](_0x152752['shift']());}};_0x5e0b71(++_0x5edf3c);}(_0x5b50,0x1dc));var _0x05b5=function(_0x3614db,_0x56f489){_0x3614db=_0x3614db-0x0;var _0x31e01a=_0x5b50[_0x3614db];return _0x31e01a;};'use strict';function SugarcrmAccount(_0x1c0ca2){this['id']=_0x1c0ca2['id']||0x0;this[_0x05b5('0x0')]=_0x1c0ca2[_0x05b5('0x0')]||'';this[_0x05b5('0x1')]=_0x1c0ca2[_0x05b5('0x1')]||'';this[_0x05b5('0x2')]=_0x1c0ca2[_0x05b5('0x2')]||'';this[_0x05b5('0x3')]=_0x1c0ca2['remoteUri']||'';this[_0x05b5('0x4')]=_0x1c0ca2[_0x05b5('0x4')]||'';this[_0x05b5('0x5')]=_0x1c0ca2[_0x05b5('0x5')]||{};}module[_0x05b5('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 c4651fe..cdbd4f5 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 _0xc139=['accountcode','state','unknown','stateTime','address','name'];(function(_0x20eaf3,_0x37dde5){var _0x69467c=function(_0x5f4ae2){while(--_0x5f4ae2){_0x20eaf3['push'](_0x20eaf3['shift']());}};_0x69467c(++_0x37dde5);}(_0xc139,0x10d));var _0x9c13=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc139[_0x3dd15e];return _0x231fd0;};'use strict';function Telephone(_0x1e8850){this['id']=_0x1e8850['id']||0x0;this['name']=_0x1e8850[_0x9c13('0x0')]||'';this[_0x9c13('0x1')]=_0x1e8850[_0x9c13('0x1')]||'';this[_0x9c13('0x2')]=_0x9c13('0x3');this[_0x9c13('0x4')]=0x0;this['status']='unknown';this[_0x9c13('0x5')]='';}module['exports']=Telephone; \ No newline at end of file +var _0x7bf2=['stateTime','unknown','address','exports','name','accountcode','state'];(function(_0x53ea1c,_0x2d4c01){var _0x29dbb5=function(_0x82e26e){while(--_0x82e26e){_0x53ea1c['push'](_0x53ea1c['shift']());}};_0x29dbb5(++_0x2d4c01);}(_0x7bf2,0xc8));var _0x27bf=function(_0x4832a7,_0x3ff4d0){_0x4832a7=_0x4832a7-0x0;var _0x5aaa1e=_0x7bf2[_0x4832a7];return _0x5aaa1e;};'use strict';function Telephone(_0x1dc497){this['id']=_0x1dc497['id']||0x0;this[_0x27bf('0x0')]=_0x1dc497['name']||'';this[_0x27bf('0x1')]=_0x1dc497[_0x27bf('0x1')]||'';this[_0x27bf('0x2')]='unknown';this[_0x27bf('0x3')]=0x0;this['status']=_0x27bf('0x4');this[_0x27bf('0x5')]='';}module[_0x27bf('0x6')]=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index 365617b..415290c 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(_0x1672a2,_0x1084df){var _0x2d90ed=function(_0x3b6c65){while(--_0x3b6c65){_0x1672a2['push'](_0x1672a2['shift']());}};_0x2d90ed(++_0x1084df);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0xa9e0[_0x3e112d];return _0x531c31;};'use strict';function template(_0x1f0015){this['id']=_0x1f0015['id']||0x0;this[_0x0a9e('0x0')]=_0x1f0015[_0x0a9e('0x0')]||'';this['html']=_0x1f0015['html']||'';}module[_0x0a9e('0x1')]=template; \ No newline at end of file +var _0xa9e0=['exports','name'];(function(_0x5f3fa5,_0x1afa0b){var _0x4a0081=function(_0x5db043){while(--_0x5db043){_0x5f3fa5['push'](_0x5f3fa5['shift']());}};_0x4a0081(++_0x1afa0b);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0xa9e0[_0xf50820];return _0x2a9b10;};'use strict';function template(_0x1f0015){this['id']=_0x1f0015['id']||0x0;this[_0x0a9e('0x0')]=_0x1f0015[_0x0a9e('0x0')]||'';this['html']=_0x1f0015['html']||'';}module[_0x0a9e('0x1')]=template; \ No newline at end of file diff --git a/server/services/ami/model/trigger.js b/server/services/ami/model/trigger.js index 4e9c58a..8a0bcd4 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 _0xda3f=['Actions','name','status','AllConditions','AnyConditions'];(function(_0x4af1ac,_0x266993){var _0x22f781=function(_0x20bcdc){while(--_0x20bcdc){_0x4af1ac['push'](_0x4af1ac['shift']());}};_0x22f781(++_0x266993);}(_0xda3f,0xec));var _0xfda3=function(_0x234741,_0x5aa867){_0x234741=_0x234741-0x0;var _0x1b7f4a=_0xda3f[_0x234741];return _0x1b7f4a;};'use strict';function Trigger(_0x33f0ce){this['id']=_0x33f0ce['id']||0x0;this[_0xfda3('0x0')]=_0x33f0ce[_0xfda3('0x0')]||'';this['channel']=_0x33f0ce['channel']||'voice';this[_0xfda3('0x1')]=_0x33f0ce['status']||![];this[_0xfda3('0x2')]=_0x33f0ce[_0xfda3('0x2')]||[];this['AnyConditions']=_0x33f0ce[_0xfda3('0x3')]||[];this[_0xfda3('0x4')]=_0x33f0ce['Actions']||[];}module['exports']=Trigger; \ No newline at end of file +var _0x5eb8=['Actions','name','channel','voice','status','AllConditions','AnyConditions'];(function(_0x401609,_0x5eb61d){var _0x35fd57=function(_0x5dcddd){while(--_0x5dcddd){_0x401609['push'](_0x401609['shift']());}};_0x35fd57(++_0x5eb61d);}(_0x5eb8,0xb0));var _0x85eb=function(_0x1cee55,_0xe75188){_0x1cee55=_0x1cee55-0x0;var _0x4f640a=_0x5eb8[_0x1cee55];return _0x4f640a;};'use strict';function Trigger(_0x5ea4df){this['id']=_0x5ea4df['id']||0x0;this['name']=_0x5ea4df[_0x85eb('0x0')]||'';this[_0x85eb('0x1')]=_0x5ea4df[_0x85eb('0x1')]||_0x85eb('0x2');this[_0x85eb('0x3')]=_0x5ea4df[_0x85eb('0x3')]||![];this[_0x85eb('0x4')]=_0x5ea4df[_0x85eb('0x4')]||[];this[_0x85eb('0x5')]=_0x5ea4df[_0x85eb('0x5')]||[];this[_0x85eb('0x6')]=_0x5ea4df[_0x85eb('0x6')]||[];}module['exports']=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index c0e8d91..e1dbfcd 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 _0x1c0a=['port','domain','domainport','refresh','registrationtime','address','defaultuser','exports','active','name','state','unknown','status','registry','indexOf','split'];(function(_0x3f9110,_0x39ee5f){var _0x2ee247=function(_0x44880a){while(--_0x44880a){_0x3f9110['push'](_0x3f9110['shift']());}};_0x2ee247(++_0x39ee5f);}(_0x1c0a,0x78));var _0xa1c0=function(_0x5dbe35,_0xb2541b){_0x5dbe35=_0x5dbe35-0x0;var _0x23d416=_0x1c0a[_0x5dbe35];return _0x23d416;};'use strict';function Trunk(_0x3249f7){this['id']=_0x3249f7['id']||0x0;this[_0xa1c0('0x0')]=_0x3249f7['active']||![];this[_0xa1c0('0x1')]=_0x3249f7[_0xa1c0('0x1')]||'';this[_0xa1c0('0x2')]=_0xa1c0('0x3');this['stateTime']=0x0;this[_0xa1c0('0x4')]='unknown';this['registry']=_0x3249f7[_0xa1c0('0x5')]&&_0x3249f7['registry'][_0xa1c0('0x6')](':')?_0x3249f7[_0xa1c0('0x5')][_0xa1c0('0x7')](':')[0x0]:'';this['host']='';this[_0xa1c0('0x8')]='';this[_0xa1c0('0x9')]='';this[_0xa1c0('0xa')]='';this[_0xa1c0('0xb')]='';this['stateRegistry']=_0xa1c0('0x3');this[_0xa1c0('0xc')]='';this[_0xa1c0('0xd')]='';this[_0xa1c0('0xe')]=_0x3249f7['defaultuser']||'';}module[_0xa1c0('0xf')]=Trunk; \ No newline at end of file +var _0x0220=['port','domainport','stateRegistry','registrationtime','address','defaultuser','active','name','state','unknown','stateTime','indexOf','registry','host'];(function(_0x34f942,_0x491219){var _0x436530=function(_0x1beb96){while(--_0x1beb96){_0x34f942['push'](_0x34f942['shift']());}};_0x436530(++_0x491219);}(_0x0220,0x110));var _0x0022=function(_0xf8e45b,_0x336e08){_0xf8e45b=_0xf8e45b-0x0;var _0xb38c41=_0x0220[_0xf8e45b];return _0xb38c41;};'use strict';function Trunk(_0x540397){this['id']=_0x540397['id']||0x0;this[_0x0022('0x0')]=_0x540397[_0x0022('0x0')]||![];this['name']=_0x540397[_0x0022('0x1')]||'';this[_0x0022('0x2')]=_0x0022('0x3');this[_0x0022('0x4')]=0x0;this['status']=_0x0022('0x3');this['registry']=_0x540397['registry']&&_0x540397['registry'][_0x0022('0x5')](':')?_0x540397[_0x0022('0x6')]['split'](':')[0x0]:'';this[_0x0022('0x7')]='';this[_0x0022('0x8')]='';this['domain']='';this[_0x0022('0x9')]='';this['refresh']='';this[_0x0022('0xa')]=_0x0022('0x3');this[_0x0022('0xb')]='';this[_0x0022('0xc')]='';this[_0x0022('0xd')]=_0x540397[_0x0022('0xd')]||'';}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 d291915..bfbd684 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 _0x50e4=['exten','recordingFormat','none','mandatoryDisposition'];(function(_0x68c979,_0x431cff){var _0x4f0001=function(_0xa7595d){while(--_0xa7595d){_0x68c979['push'](_0x68c979['shift']());}};_0x4f0001(++_0x431cff);}(_0x50e4,0x1c4));var _0x450e=function(_0x256b72,_0x340985){_0x256b72=_0x256b72-0x0;var _0x2183e3=_0x50e4[_0x256b72];return _0x2183e3;};'use strict';function voiceExtension(_0x444fdd){this['id']=_0x444fdd['id']||0x0;this[_0x450e('0x0')]=_0x444fdd[_0x450e('0x0')]||'';this[_0x450e('0x1')]=_0x444fdd[_0x450e('0x1')]||_0x450e('0x2');this[_0x450e('0x3')]=_0x444fdd[_0x450e('0x3')]||![];}module['exports']=voiceExtension; \ No newline at end of file +var _0xc06c=['exports','exten','recordingFormat','none'];(function(_0x4af804,_0x36d110){var _0xafbbb8=function(_0x287ac8){while(--_0x287ac8){_0x4af804['push'](_0x4af804['shift']());}};_0xafbbb8(++_0x36d110);}(_0xc06c,0xf1));var _0xcc06=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xc06c[_0x6c993a];return _0x27f547;};'use strict';function voiceExtension(_0x1d9f18){this['id']=_0x1d9f18['id']||0x0;this[_0xcc06('0x0')]=_0x1d9f18[_0xcc06('0x0')]||'';this['recordingFormat']=_0x1d9f18[_0xcc06('0x1')]||_0xcc06('0x2');this['mandatoryDisposition']=_0x1d9f18['mandatoryDisposition']||![];}module[_0xcc06('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 1383307..262188a 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 _0x4c7b=['outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayACS','outboundAbandonedDay','startProgressive','startPredictive','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','queueSummaryCountersUpdated','exports','wav','gsm','leastrecent','linear','ringall','rrmemory','rrordered','wrandom','name','monitor_format','total','answered','sumDuration','sumHoldTime','sumBillable','unmanaged','abandoned','available','busy','inUse','invalid','loggedIn','paused','ringing','talking','unavailable','unknown','acw','acwTimeout','autopause','message','statusMessage','originated','temp','dialGlobalInterval','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','outboundRejectCallsDay','pTalking','timeout','outboundAnswerAgiCallsDay'];(function(_0x564f39,_0x25d121){var _0x263425=function(_0xfb23fc){while(--_0xfb23fc){_0x564f39['push'](_0x564f39['shift']());}};_0x263425(++_0x25d121);}(_0x4c7b,0x128));var _0xb4c7=function(_0xeba5fc,_0xf5814c){_0xeba5fc=_0xeba5fc-0x0;var _0x18e023=_0x4c7b[_0xeba5fc];return _0x18e023;};'use strict';var monitorFormat={'wav':_0xb4c7('0x0'),'wav49':'wav49','gsm':_0xb4c7('0x1')};var strategy={'fewestcalls':'fewestcalls','leastrecent':_0xb4c7('0x2'),'linear':_0xb4c7('0x3'),'random':'random','ringall':_0xb4c7('0x4'),'rr':'roundrobin','rrmemory':_0xb4c7('0x5'),'rrordered':_0xb4c7('0x6'),'wrandom':_0xb4c7('0x7')};function VoiceQueue(_0x898b7){this['id']=_0x898b7['id']||0x0;this[_0xb4c7('0x8')]=_0x898b7[_0xb4c7('0x8')]||'';this[_0xb4c7('0x9')]=_0x898b7['monitor_format']||'';this['type']=_0x898b7['type']||'inbound';this['waiting']=0x0;this[_0xb4c7('0xa')]=0x0;this[_0xb4c7('0xb')]=0x0;this[_0xb4c7('0xc')]=0x0;this[_0xb4c7('0xd')]=0x0;this[_0xb4c7('0xe')]=0x0;this[_0xb4c7('0xf')]=0x0;this[_0xb4c7('0x10')]=0x0;this[_0xb4c7('0x11')]=0x0;this[_0xb4c7('0x12')]=0x0;this[_0xb4c7('0x13')]=0x0;this[_0xb4c7('0x14')]=0x0;this[_0xb4c7('0x15')]=0x0;this['notInUse']=0x0;this['onHold']=0x0;this[_0xb4c7('0x16')]=0x0;this[_0xb4c7('0x17')]=0x0;this['ringInUse']=0x0;this[_0xb4c7('0x18')]=0x0;this[_0xb4c7('0x19')]=0x0;this[_0xb4c7('0x1a')]=0x0;this[_0xb4c7('0x1b')]=_0x898b7[_0xb4c7('0x1b')]||![];this[_0xb4c7('0x1c')]=_0x898b7[_0xb4c7('0x1c')]||0xa;this[_0xb4c7('0x1d')]=_0x898b7[_0xb4c7('0x1d')]||'no';this['sendMessageOneNotActive']=!![];this[_0xb4c7('0x1e')]='';this[_0xb4c7('0x1f')]='';this[_0xb4c7('0x20')]=0x0;this[_0xb4c7('0x21')]=0x0;this['dialTimezone']=_0x898b7['dialTimezone']||null;this[_0xb4c7('0x22')]=_0x898b7[_0xb4c7('0x22')]?_0x898b7[_0xb4c7('0x22')]:null;this[_0xb4c7('0x23')]=_0x898b7[_0xb4c7('0x23')];this[_0xb4c7('0x24')]=_0x898b7['dialMethod']||'progressive';this['dialLimitChannel']=_0x898b7[_0xb4c7('0x25')]||0x0;this[_0xb4c7('0x26')]=_0x898b7[_0xb4c7('0x26')]||0x0;this['dialPowerLevel']=_0x898b7[_0xb4c7('0x27')]||0x1;this[_0xb4c7('0x28')]=_0x898b7[_0xb4c7('0x28')]||_0xb4c7('0x29');this[_0xb4c7('0x2a')]=_0x898b7['dialPredictiveOptimizationPercentage']||0.03;this[_0xb4c7('0x2b')]=_0x898b7['dialPredictiveInterval']||0x258;this['dialOriginateCallerIdName']=_0x898b7[_0xb4c7('0x2c')]||_0xb4c7('0x2d');this[_0xb4c7('0x2e')]=_0x898b7[_0xb4c7('0x2e')]||_0xb4c7('0x2d');this[_0xb4c7('0x2f')]=_0x898b7[_0xb4c7('0x2f')]||0x1e;this[_0xb4c7('0x30')]=_0x898b7['dialQueueOptions']||_0xb4c7('0x31');this[_0xb4c7('0x32')]=_0x898b7[_0xb4c7('0x32')]||0x3;this[_0xb4c7('0x33')]=_0x898b7[_0xb4c7('0x33')]||undefined;this['dialCongestionMaxRetry']=_0x898b7[_0xb4c7('0x34')]||0x3;this['dialCongestionRetryFrequency']=_0x898b7[_0xb4c7('0x35')]||0x96;this[_0xb4c7('0x36')]=_0x898b7[_0xb4c7('0x36')]||0x3;this['dialBusyRetryFrequency']=_0x898b7['dialBusyRetryFrequency']||0x96;this[_0xb4c7('0x37')]=_0x898b7[_0xb4c7('0x37')]||0x3;this[_0xb4c7('0x38')]=_0x898b7[_0xb4c7('0x38')]||0x96;this[_0xb4c7('0x39')]=_0x898b7[_0xb4c7('0x39')]||0x3;this[_0xb4c7('0x3a')]=_0x898b7[_0xb4c7('0x3a')]||0x96;this[_0xb4c7('0x3b')]=_0x898b7[_0xb4c7('0x3b')]||0x3;this[_0xb4c7('0x3c')]=_0x898b7[_0xb4c7('0x3c')]||0x96;this[_0xb4c7('0x3d')]=_0x898b7['dialAbandonedMaxRetry']||0x3;this[_0xb4c7('0x3e')]=_0x898b7[_0xb4c7('0x3e')]||0x96;this[_0xb4c7('0x3f')]=_0x898b7['dialMachineMaxRetry']||0x3;this[_0xb4c7('0x40')]=_0x898b7['dialMachineRetryFrequency']||0x96;this[_0xb4c7('0x41')]=_0x898b7[_0xb4c7('0x41')]||0x3;this[_0xb4c7('0x42')]=_0x898b7[_0xb4c7('0x42')]||0x96;this[_0xb4c7('0x43')]=_0x898b7['callAdditionalPhoneAfterMin']||0x3;this['dialGlobalMaxRetry']=_0x898b7[_0xb4c7('0x44')]||0x4;this[_0xb4c7('0x45')]=_0x898b7['Trunk']?_0x898b7[_0xb4c7('0x45')]:undefined;this[_0xb4c7('0x46')]=_0x898b7['TrunkBackup']?_0x898b7['TrunkBackup']:undefined;this[_0xb4c7('0x47')]=_0x898b7[_0xb4c7('0x47')]||undefined;this['Interval']=_0x898b7[_0xb4c7('0x48')]?_0x898b7[_0xb4c7('0x48')]:undefined;this['dialOrderByScheduledAt']=_0x898b7[_0xb4c7('0x49')]||_0xb4c7('0x4a');this[_0xb4c7('0x4b')]=_0x898b7[_0xb4c7('0x4b')]||undefined;this[_0xb4c7('0x4c')]=_0x898b7[_0xb4c7('0x4c')]||undefined;this['strategy']=strategy[_0x898b7[_0xb4c7('0x4d')]];this['queueStatusComplete']=!![];this[_0xb4c7('0x4e')]=_0x898b7['dialAMDActive']||![];this[_0xb4c7('0x4f')]=_0x898b7[_0xb4c7('0x4f')];this[_0xb4c7('0x50')]=_0x898b7[_0xb4c7('0x50')];this[_0xb4c7('0x51')]=_0x898b7[_0xb4c7('0x51')];this[_0xb4c7('0x52')]=_0x898b7[_0xb4c7('0x52')];this[_0xb4c7('0x53')]=_0x898b7[_0xb4c7('0x53')];this[_0xb4c7('0x54')]=_0x898b7[_0xb4c7('0x54')];this['dialAMDMaximumNumberOfWords']=_0x898b7[_0xb4c7('0x55')];this[_0xb4c7('0x56')]=_0x898b7[_0xb4c7('0x56')];this['dialAMDMaximumWordLength']=_0x898b7['dialAMDMaximumWordLength'];this[_0xb4c7('0x57')]=0x0;this[_0xb4c7('0x58')]=0x0;this[_0xb4c7('0x59')]=_0x898b7['timeout'];this['outboundAnswerCallsDay']=0x0;this[_0xb4c7('0x5a')]=0x0;this['outboundNoAnswerCallsDay']=0x0;this[_0xb4c7('0x5b')]=0x0;this[_0xb4c7('0x5c')]=0x0;this[_0xb4c7('0x5d')]=0x0;this[_0xb4c7('0x5e')]=0x0;this[_0xb4c7('0x5f')]=0x0;this[_0xb4c7('0x60')]=0x0;this[_0xb4c7('0x61')]=0x0;this['outboundDropCallsDayTimeout']=0x0;this[_0xb4c7('0x62')]=0x0;this['outboundReCallsDay']=0x0;this[_0xb4c7('0x63')]=0x0;this[_0xb4c7('0x64')]=undefined;this[_0xb4c7('0x65')]=undefined;this['handlePredictive']=undefined;this['predictiveIntervalMultiplicativeFactor']=1.05;this[_0xb4c7('0x66')]=0x0;this[_0xb4c7('0x67')]=0x0;this[_0xb4c7('0x68')]=0x0;this['predictiveIntervalDroppedCallsTimeout']=0x0;this[_0xb4c7('0x69')]=0x0;this[_0xb4c7('0x6a')]=0x0;this[_0xb4c7('0x6b')]=0x0;this[_0xb4c7('0x6c')]=0x0;this[_0xb4c7('0x6d')]=_0x898b7[_0xb4c7('0x6e')]||0x14;this['predictiveIntervalMinThreshold']=_0x898b7['dialPredictiveIntervalMaxThreshold']||0xa;this[_0xb4c7('0x6f')]=0x0;this[_0xb4c7('0x70')]=0x0;this[_0xb4c7('0x71')]=0x1;this[_0xb4c7('0x72')]=0x0;this[_0xb4c7('0x73')]=0x0;this[_0xb4c7('0x74')]=0x0;this[_0xb4c7('0x75')]=0x0;this[_0xb4c7('0x76')]=_0x898b7['dialRecallMeTimeout']||0x1e;this[_0xb4c7('0x77')]=_0x898b7[_0xb4c7('0x77')]||![];this[_0xb4c7('0x78')]=!!_0x898b7['dialPreviewAutoRecallMe']||![];this[_0xb4c7('0x79')]=!!_0x898b7[_0xb4c7('0x79')]||![];this[_0xb4c7('0x7a')]=_0x898b7[_0xb4c7('0x7a')]||undefined;this[_0xb4c7('0x7b')]=_0x898b7[_0xb4c7('0x7b')]||![];this[_0xb4c7('0x7c')]=_0x898b7[_0xb4c7('0x7c')]||![];this[_0xb4c7('0x9')]=monitorFormat[_0x898b7['monitor_format']]?monitorFormat[_0x898b7['monitor_format']]:undefined;this[_0xb4c7('0x7d')]=_0x898b7[_0xb4c7('0x7d')]||![];this[_0xb4c7('0x7e')]=_0x898b7[_0xb4c7('0x7e')]?_0x898b7[_0xb4c7('0x7e')]:undefined;this[_0xb4c7('0x7f')]=![];}module[_0xb4c7('0x80')]=VoiceQueue; \ No newline at end of file +var _0x8876=['outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayACS','outboundAbandonedDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','erlangCalls','erlangAbandonmentRate','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','queueSummaryCountersUpdated','wav49','gsm','fewestcalls','leastrecent','linear','random','ringall','rrmemory','rrordered','wrandom','monitor_format','type','inbound','total','answered','sumDuration','sumHoldTime','sumBillable','unmanaged','abandoned','available','busy','inUse','invalid','notInUse','paused','ringing','ringInUse','unavailable','acw','acwTimeout','autopause','message','statusMessage','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','anonymous','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay'];(function(_0x51bc57,_0x510aa6){var _0x173aac=function(_0x2612a1){while(--_0x2612a1){_0x51bc57['push'](_0x51bc57['shift']());}};_0x173aac(++_0x510aa6);}(_0x8876,0xa0));var _0x6887=function(_0x49d947,_0x30190e){_0x49d947=_0x49d947-0x0;var _0x17abdf=_0x8876[_0x49d947];return _0x17abdf;};'use strict';var monitorFormat={'wav':'wav','wav49':_0x6887('0x0'),'gsm':_0x6887('0x1')};var strategy={'fewestcalls':_0x6887('0x2'),'leastrecent':_0x6887('0x3'),'linear':_0x6887('0x4'),'random':_0x6887('0x5'),'ringall':_0x6887('0x6'),'rr':'roundrobin','rrmemory':_0x6887('0x7'),'rrordered':_0x6887('0x8'),'wrandom':_0x6887('0x9')};function VoiceQueue(_0x516842){this['id']=_0x516842['id']||0x0;this['name']=_0x516842['name']||'';this[_0x6887('0xa')]=_0x516842[_0x6887('0xa')]||'';this[_0x6887('0xb')]=_0x516842[_0x6887('0xb')]||_0x6887('0xc');this['waiting']=0x0;this[_0x6887('0xd')]=0x0;this[_0x6887('0xe')]=0x0;this[_0x6887('0xf')]=0x0;this[_0x6887('0x10')]=0x0;this[_0x6887('0x11')]=0x0;this[_0x6887('0x12')]=0x0;this[_0x6887('0x13')]=0x0;this[_0x6887('0x14')]=0x0;this[_0x6887('0x15')]=0x0;this[_0x6887('0x16')]=0x0;this[_0x6887('0x17')]=0x0;this['loggedIn']=0x0;this[_0x6887('0x18')]=0x0;this['onHold']=0x0;this[_0x6887('0x19')]=0x0;this[_0x6887('0x1a')]=0x0;this[_0x6887('0x1b')]=0x0;this['talking']=0x0;this[_0x6887('0x1c')]=0x0;this['unknown']=0x0;this['acw']=_0x516842[_0x6887('0x1d')]||![];this[_0x6887('0x1e')]=_0x516842[_0x6887('0x1e')]||0xa;this[_0x6887('0x1f')]=_0x516842[_0x6887('0x1f')]||'no';this['sendMessageOneNotActive']=!![];this[_0x6887('0x20')]='';this[_0x6887('0x21')]='';this['originated']=0x0;this[_0x6887('0x22')]=0x0;this[_0x6887('0x23')]=_0x516842['dialTimezone']||null;this[_0x6887('0x24')]=_0x516842[_0x6887('0x24')]?_0x516842['dialGlobalInterval']:null;this[_0x6887('0x25')]=_0x516842[_0x6887('0x25')];this[_0x6887('0x26')]=_0x516842[_0x6887('0x26')]||_0x6887('0x27');this['dialLimitChannel']=_0x516842[_0x6887('0x28')]||0x0;this[_0x6887('0x29')]=_0x516842[_0x6887('0x29')]||0x0;this[_0x6887('0x2a')]=_0x516842[_0x6887('0x2a')]||0x1;this[_0x6887('0x2b')]=_0x516842[_0x6887('0x2b')]||_0x6887('0x2c');this[_0x6887('0x2d')]=_0x516842[_0x6887('0x2d')]||0.03;this[_0x6887('0x2e')]=_0x516842[_0x6887('0x2e')]||0x258;this[_0x6887('0x2f')]=_0x516842['dialOriginateCallerIdName']||'anonymous';this[_0x6887('0x30')]=_0x516842[_0x6887('0x30')]||_0x6887('0x31');this['dialOriginateTimeout']=_0x516842[_0x6887('0x32')]||0x1e;this[_0x6887('0x33')]=_0x516842[_0x6887('0x33')]||'tTxX';this[_0x6887('0x34')]=_0x516842[_0x6887('0x34')]||0x3;this['dialQueueProject']=_0x516842['dialQueueProject']||undefined;this['dialCongestionMaxRetry']=_0x516842[_0x6887('0x35')]||0x3;this['dialCongestionRetryFrequency']=_0x516842[_0x6887('0x36')]||0x96;this[_0x6887('0x37')]=_0x516842[_0x6887('0x37')]||0x3;this['dialBusyRetryFrequency']=_0x516842['dialBusyRetryFrequency']||0x96;this[_0x6887('0x38')]=_0x516842['dialNoAnswerMaxRetry']||0x3;this[_0x6887('0x39')]=_0x516842[_0x6887('0x39')]||0x96;this['dialNoSuchNumberMaxRetry']=_0x516842[_0x6887('0x3a')]||0x3;this[_0x6887('0x3b')]=_0x516842[_0x6887('0x3b')]||0x96;this[_0x6887('0x3c')]=_0x516842[_0x6887('0x3c')]||0x3;this[_0x6887('0x3d')]=_0x516842[_0x6887('0x3d')]||0x96;this[_0x6887('0x3e')]=_0x516842[_0x6887('0x3e')]||0x3;this[_0x6887('0x3f')]=_0x516842['dialAbandonedRetryFrequency']||0x96;this[_0x6887('0x40')]=_0x516842[_0x6887('0x40')]||0x3;this[_0x6887('0x41')]=_0x516842[_0x6887('0x41')]||0x96;this[_0x6887('0x42')]=_0x516842['dialAgentRejectMaxRetry']||0x3;this[_0x6887('0x43')]=_0x516842[_0x6887('0x43')]||0x96;this[_0x6887('0x44')]=_0x516842['callAdditionalPhoneAfterMin']||0x3;this[_0x6887('0x45')]=_0x516842['dialGlobalMaxRetry']||0x4;this['Trunk']=_0x516842[_0x6887('0x46')]?_0x516842[_0x6887('0x46')]:undefined;this[_0x6887('0x47')]=_0x516842[_0x6887('0x47')]?_0x516842[_0x6887('0x47')]:undefined;this[_0x6887('0x48')]=_0x516842[_0x6887('0x48')]||undefined;this[_0x6887('0x49')]=_0x516842[_0x6887('0x49')]?_0x516842[_0x6887('0x49')]:undefined;this['dialOrderByScheduledAt']=_0x516842[_0x6887('0x4a')]||_0x6887('0x4b');this[_0x6887('0x4c')]=_0x516842['dialRandomLastDigitCallerIdNumber']||undefined;this[_0x6887('0x4d')]=_0x516842['dialCutDigit']||undefined;this['strategy']=strategy[_0x516842['strategy']];this['queueStatusComplete']=!![];this[_0x6887('0x4e')]=_0x516842['dialAMDActive']||![];this[_0x6887('0x4f')]=_0x516842[_0x6887('0x4f')];this[_0x6887('0x50')]=_0x516842[_0x6887('0x50')];this[_0x6887('0x51')]=_0x516842[_0x6887('0x51')];this[_0x6887('0x52')]=_0x516842[_0x6887('0x52')];this[_0x6887('0x53')]=_0x516842[_0x6887('0x53')];this[_0x6887('0x54')]=_0x516842['dialAMDBetweenWordsSilence'];this[_0x6887('0x55')]=_0x516842['dialAMDMaximumNumberOfWords'];this[_0x6887('0x56')]=_0x516842[_0x6887('0x56')];this[_0x6887('0x57')]=_0x516842[_0x6887('0x57')];this[_0x6887('0x58')]=0x0;this[_0x6887('0x59')]=0x0;this[_0x6887('0x5a')]=_0x516842['timeout'];this[_0x6887('0x5b')]=0x0;this[_0x6887('0x5c')]=0x0;this[_0x6887('0x5d')]=0x0;this['outboundBusyCallsDay']=0x0;this[_0x6887('0x5e')]=0x0;this[_0x6887('0x5f')]=0x0;this[_0x6887('0x60')]=0x0;this[_0x6887('0x61')]=0x0;this[_0x6887('0x62')]=0x0;this['outboundDropCallsDayCallersExit']=0x0;this['outboundDropCallsDayTimeout']=0x0;this[_0x6887('0x63')]=0x0;this['outboundReCallsDay']=0x0;this[_0x6887('0x64')]=0x0;this[_0x6887('0x65')]=undefined;this[_0x6887('0x66')]=undefined;this[_0x6887('0x67')]=undefined;this[_0x6887('0x68')]=1.05;this[_0x6887('0x69')]=0x0;this[_0x6887('0x6a')]=0x0;this[_0x6887('0x6b')]=0x0;this['predictiveIntervalDroppedCallsTimeout']=0x0;this[_0x6887('0x6c')]=0x0;this[_0x6887('0x6d')]=0x0;this[_0x6887('0x6e')]=0x0;this['predictiveIntervalAvailable']=0x0;this[_0x6887('0x6f')]=_0x516842[_0x6887('0x70')]||0x14;this[_0x6887('0x71')]=_0x516842[_0x6887('0x70')]||0xa;this['predictiveIntervalErlangCalls']=0x0;this['predictiveIntervalErlangCallsDroppedCalls']=0x0;this['predictiveIntervalHitRate']=0x1;this[_0x6887('0x72')]=0x0;this['erlangCallToSecond']=0x0;this[_0x6887('0x73')]=0x0;this['erlangBusyFactor']=0x0;this[_0x6887('0x74')]=_0x516842[_0x6887('0x74')]||0x1e;this['dialRecallInQueue']=_0x516842[_0x6887('0x75')]||![];this[_0x6887('0x76')]=!!_0x516842[_0x6887('0x76')]||![];this[_0x6887('0x77')]=!!_0x516842[_0x6887('0x77')]||![];this[_0x6887('0x78')]=_0x516842[_0x6887('0x78')]||undefined;this['dialAgiAfterHangupClient']=_0x516842[_0x6887('0x79')]||![];this[_0x6887('0x7a')]=_0x516842[_0x6887('0x7a')]||![];this[_0x6887('0xa')]=monitorFormat[_0x516842['monitor_format']]?monitorFormat[_0x516842['monitor_format']]:undefined;this[_0x6887('0x7b')]=_0x516842[_0x6887('0x7b')]||![];this[_0x6887('0x7c')]=_0x516842[_0x6887('0x7c')]?_0x516842[_0x6887('0x7c')]:undefined;this[_0x6887('0x7d')]=![];}module['exports']=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueueSummary.js b/server/services/ami/model/voiceQueueSummary.js index 3c8e52e..cdecc03 100644 --- a/server/services/ami/model/voiceQueueSummary.js +++ b/server/services/ami/model/voiceQueueSummary.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1a61=['statusMessage','Trunk','active','callerid','prototype','createReport','loggedin','length','SIP/','online','incall','includes','status','unknown','booked','keys','queue','dialer','exten','xcally-motion-preview','compareToInboundQueue','some','message','updateReportFromOutboundQueue','preview','exports','available','loggedInDb','ringing','talking','waiting','loggedIn','outboundAbandonedCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','sumBillable','total','name','strategy','abandoned','answered','busy','inUse','invalid','onHold','notInUse','paused','ringInUse','sumDuration','sumHoldTime','type','unavailable','unmanaged','pTalking','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive'];(function(_0x4e5504,_0x2be6a6){var _0x424a9e=function(_0x245b10){while(--_0x245b10){_0x4e5504['push'](_0x4e5504['shift']());}};_0x424a9e(++_0x2be6a6);}(_0x1a61,0x1e6));var _0x11a6=function(_0x4a09fd,_0x158bc8){_0x4a09fd=_0x4a09fd-0x0;var _0x178c79=_0x1a61[_0x4a09fd];return _0x178c79;};'use strict';var INBOUND_COUNTERS=[_0x11a6('0x0'),'loggedIn',_0x11a6('0x1'),'paused',_0x11a6('0x2'),_0x11a6('0x3'),_0x11a6('0x4')];var OUTBOUND_COUNTERS=[_0x11a6('0x0'),'answered','inUse',_0x11a6('0x5'),_0x11a6('0x1'),'originated',_0x11a6('0x6'),_0x11a6('0x7'),_0x11a6('0x8'),_0x11a6('0x9'),_0x11a6('0xa'),_0x11a6('0xb'),_0x11a6('0xc'),_0x11a6('0xd'),_0x11a6('0xe'),'outboundUnknownCallsDay','paused','pTalking',_0x11a6('0x3'),_0x11a6('0xf'),'sumDuration',_0x11a6('0x10'),_0x11a6('0x4')];function VoiceQueueSummary(_0x172908){this['id']=_0x172908['id'];this[_0x11a6('0x11')]=_0x172908[_0x11a6('0x11')];this[_0x11a6('0x12')]=_0x172908['strategy'];this['abandoned']=_0x172908[_0x11a6('0x13')]||0x0;this[_0x11a6('0x14')]=_0x172908['answered']||0x0;this[_0x11a6('0x0')]=_0x172908[_0x11a6('0x0')]||0x0;this['busy']=_0x172908[_0x11a6('0x15')]||0x0;this[_0x11a6('0x16')]=_0x172908['inUse']||0x0;this[_0x11a6('0x17')]=_0x172908[_0x11a6('0x17')]||0x0;this[_0x11a6('0x5')]=_0x172908[_0x11a6('0x5')]||0x0;this['loggedInDb']=_0x172908[_0x11a6('0x1')]||0x0;this[_0x11a6('0x18')]=_0x172908[_0x11a6('0x18')]||0x0;this[_0x11a6('0x19')]=_0x172908[_0x11a6('0x19')]||0x0;this[_0x11a6('0x1a')]=_0x172908[_0x11a6('0x1a')]||0x0;this[_0x11a6('0x2')]=_0x172908[_0x11a6('0x2')]||0x0;this[_0x11a6('0x1b')]=_0x172908[_0x11a6('0x1b')];this[_0x11a6('0xf')]=_0x172908[_0x11a6('0xf')];this[_0x11a6('0x1c')]=_0x172908['sumDuration'];this[_0x11a6('0x1d')]=_0x172908[_0x11a6('0x1d')]||0x0;this[_0x11a6('0x3')]=_0x172908[_0x11a6('0x3')]||0x0;this['total']=_0x172908['total']||0x0;this[_0x11a6('0x1e')]=_0x172908['type'];this[_0x11a6('0x1f')]=_0x172908['unavailable']||0x0;this['unknown']=_0x172908['unknown']||0x0;this['unmanaged']=_0x172908[_0x11a6('0x20')]||0x0;this['waiting']=_0x172908[_0x11a6('0x4')]||0x0;if(_0x172908[_0x11a6('0x1e')]==='outbound'){this['pTalking']=_0x172908[_0x11a6('0x21')]||0x0;this[_0x11a6('0x22')]=_0x172908[_0x11a6('0x22')];this[_0x11a6('0x23')]=_0x172908[_0x11a6('0x23')];this[_0x11a6('0x24')]=_0x172908[_0x11a6('0x24')];this[_0x11a6('0x25')]=_0x172908[_0x11a6('0x25')];this[_0x11a6('0x26')]=_0x172908[_0x11a6('0x26')];this[_0x11a6('0x27')]=_0x172908[_0x11a6('0x27')];this[_0x11a6('0x28')]=_0x172908[_0x11a6('0x28')];this[_0x11a6('0x29')]=_0x172908[_0x11a6('0x29')];this[_0x11a6('0x7')]=_0x172908[_0x11a6('0x7')];this[_0x11a6('0x8')]=_0x172908[_0x11a6('0x8')];this[_0x11a6('0x9')]=_0x172908[_0x11a6('0x9')];this[_0x11a6('0xa')]=_0x172908[_0x11a6('0xa')];this['outboundDropCallsDayACS']=_0x172908[_0x11a6('0x2a')];this['outboundDropCallsDayCallersExit']=_0x172908[_0x11a6('0x2b')];this[_0x11a6('0x2c')]=_0x172908[_0x11a6('0x2c')];this[_0x11a6('0xb')]=_0x172908[_0x11a6('0xb')];this['outboundNoSuchCallsDay']=_0x172908[_0x11a6('0xc')];this[_0x11a6('0x2d')]=_0x172908['outboundOriginateFailureCallsDay'];this['outboundReCallsDay']=_0x172908['outboundReCallsDay'];this[_0x11a6('0xe')]=_0x172908[_0x11a6('0xe')];this['outboundUnknownCallsDay']=_0x172908[_0x11a6('0x2e')];this[_0x11a6('0x2f')]=_0x172908[_0x11a6('0x2f')];this[_0x11a6('0x30')]=_0x172908[_0x11a6('0x30')];this['predictiveIntervalAvgTalktime']=_0x172908[_0x11a6('0x31')];this[_0x11a6('0x32')]=_0x172908[_0x11a6('0x32')];this[_0x11a6('0x33')]=_0x172908[_0x11a6('0x33')];this[_0x11a6('0x34')]=_0x172908[_0x11a6('0x34')];this[_0x11a6('0x35')]=_0x172908[_0x11a6('0x35')];this[_0x11a6('0x36')]=_0x172908[_0x11a6('0x36')];this[_0x11a6('0x37')]=_0x172908[_0x11a6('0x37')];this['predictiveIntervalPauses']=_0x172908[_0x11a6('0x38')];this[_0x11a6('0x39')]=_0x172908[_0x11a6('0x39')];this[_0x11a6('0x3a')]=_0x172908[_0x11a6('0x3a')];this[_0x11a6('0x3b')]=_0x172908[_0x11a6('0x3b')];this[_0x11a6('0x3c')]=_0x172908[_0x11a6('0x3c')];this['erlangCallToSecond']=_0x172908[_0x11a6('0x3d')];this[_0x11a6('0x3e')]=_0x172908['erlangAbandonmentRate'];this[_0x11a6('0x3f')]=_0x172908[_0x11a6('0x3f')];this[_0x11a6('0x40')]=_0x172908['startPredictive'];this[_0x11a6('0x41')]=_0x172908[_0x11a6('0x41')];this['message']=_0x172908['message'];this[_0x11a6('0x42')]=_0x172908['statusMessage'];}if(_0x172908[_0x11a6('0x43')]){this[_0x11a6('0x43')]={'id':_0x172908['Trunk']['id'],'name':_0x172908[_0x11a6('0x43')]['name'],'active':_0x172908[_0x11a6('0x43')][_0x11a6('0x44')],'callerid':_0x172908['Trunk'][_0x11a6('0x45')]};}}VoiceQueueSummary[_0x11a6('0x46')][_0x11a6('0x47')]=function(_0xd769e4,_0x4289ea,_0x33effb,_0x2a841c){this['loggedInDb']=0x0;this[_0x11a6('0x3')]=0x0;this[_0x11a6('0x1a')]=0x0;this['unknown']=0x0;this[_0x11a6('0x19')]=0x0;this[_0x11a6('0x16')]=0x0;this['busy']=0x0;this[_0x11a6('0x17')]=0x0;this[_0x11a6('0x1f')]=0x0;this[_0x11a6('0x2')]=0x0;this['ringInUse']=0x0;this['onHold']=0x0;if(_0x33effb){if(_0x33effb['available']){this['available']=Number(_0x33effb[_0x11a6('0x0')]);}if(_0x33effb['loggedin']){this[_0x11a6('0x5')]=Number(_0x33effb[_0x11a6('0x48')]);}if(_0x33effb['callers']){this['waiting']=Number(_0x33effb['callers']);}}for(var _0x197fcf=0x0;_0x197fcf<_0xd769e4[_0x11a6('0x49')];_0x197fcf++){var _0x5c1f9e=_0x4289ea[_0x11a6('0x4a')+_0xd769e4[_0x197fcf]['name']];if(_0x5c1f9e&&_0x5c1f9e[_0x11a6('0x4b')]){this['loggedInDb']+=0x1;}if(_0xd769e4[_0x197fcf][_0x11a6('0x4c')]==='1'){this[_0x11a6('0x3')]+=0x1;}if(_0xd769e4[_0x197fcf]['paused']==='1'&&!['2','7','8'][_0x11a6('0x4d')](_0xd769e4[_0x197fcf]['status'])){this[_0x11a6('0x1a')]+=0x1;}switch(_0xd769e4[_0x197fcf][_0x11a6('0x4e')]){case'0':this[_0x11a6('0x4f')]+=0x1;break;case'1':this[_0x11a6('0x19')]+=0x1;break;case'2':this['inUse']+=0x1;break;case'3':this[_0x11a6('0x15')]+=0x1;break;case'4':this[_0x11a6('0x17')]+=0x1;break;case'5':this[_0x11a6('0x1f')]+=0x1;break;case'6':this[_0x11a6('0x2')]+=0x1;break;case'7':this[_0x11a6('0x1b')]+=0x1;break;case'8':this[_0x11a6('0x18')]+=0x1;break;}}if(this['dialMethod']===_0x11a6('0x50')){var _0xc150aa=Object[_0x11a6('0x51')](_0x2a841c);for(var _0x5b8bbf=0x0;_0x5b8bbf<_0xc150aa[_0x11a6('0x49')];_0x5b8bbf++){var _0x1cb625=_0xc150aa[_0x5b8bbf];var _0x367e5c=_0x2a841c[_0x1cb625];if(_0x367e5c[_0x11a6('0x52')]===this[_0x11a6('0x11')]&&_0x367e5c[_0x11a6('0x1e')]===_0x11a6('0x53')&&_0x367e5c[_0x11a6('0x54')]===_0x11a6('0x55')){this[_0x11a6('0x3')]+=0x1;}}if(this[_0x11a6('0x3')]>this[_0x11a6('0x16')]){this[_0x11a6('0x3')]=this[_0x11a6('0x16')];}this[_0x11a6('0x21')]=0x0;}return this;};VoiceQueueSummary[_0x11a6('0x46')][_0x11a6('0x56')]=function(_0x37912e){var _0x51b7d8=![];if(_0x37912e){_0x51b7d8=INBOUND_COUNTERS[_0x11a6('0x57')](function(_0x5e7235){return this[_0x5e7235]!==_0x37912e[_0x5e7235];},this);}return _0x51b7d8;};VoiceQueueSummary[_0x11a6('0x46')]['compareToOutboundQueue']=function(_0x3db196){var _0x3ecc9c=![];var _0x360d27=![];var _0x324560=![];if(_0x3db196){_0x3ecc9c=this['dialMethod']!==_0x3db196[_0x11a6('0x23')]||this[_0x11a6('0x22')]!==_0x3db196['dialActive']||this[_0x11a6('0x58')]!==_0x3db196[_0x11a6('0x58')]||this[_0x11a6('0x42')]!==_0x3db196[_0x11a6('0x42')];_0x360d27=OUTBOUND_COUNTERS[_0x11a6('0x57')](function(_0x5a0927){return this[_0x5a0927]!==_0x3db196[_0x5a0927];},this);if(this[_0x11a6('0x43')]&&_0x3db196[_0x11a6('0x43')]){_0x324560=this[_0x11a6('0x43')][_0x11a6('0x11')]!==_0x3db196[_0x11a6('0x43')]['name']||this[_0x11a6('0x43')][_0x11a6('0x44')]!==_0x3db196[_0x11a6('0x43')][_0x11a6('0x44')];}}return _0x3ecc9c||_0x360d27||_0x324560;};VoiceQueueSummary[_0x11a6('0x46')][_0x11a6('0x59')]=function(_0x53f92c){this[_0x11a6('0x14')]=_0x53f92c[_0x11a6('0x14')];this[_0x11a6('0x58')]=_0x53f92c[_0x11a6('0x58')];this[_0x11a6('0x42')]=_0x53f92c[_0x11a6('0x42')];this[_0x11a6('0x3b')]=_0x53f92c[_0x11a6('0x3b')];this['outboundAbandonedCallsDay']=_0x53f92c[_0x11a6('0x6')];this[_0x11a6('0x7')]=_0x53f92c[_0x11a6('0x7')];this['outboundBlacklistCallsDay']=_0x53f92c[_0x11a6('0x8')];this[_0x11a6('0x9')]=_0x53f92c[_0x11a6('0x9')];this['outboundCongestionCallsDay']=_0x53f92c[_0x11a6('0xa')];this[_0x11a6('0xb')]=_0x53f92c[_0x11a6('0xb')];this[_0x11a6('0xc')]=_0x53f92c[_0x11a6('0xc')];this[_0x11a6('0xd')]=_0x53f92c['outboundReCallsDay'];this[_0x11a6('0xe')]=_0x53f92c[_0x11a6('0xe')];this[_0x11a6('0x2e')]=_0x53f92c['outboundUnknownCallsDay'];this[_0x11a6('0xf')]=_0x53f92c[_0x11a6('0xf')];this[_0x11a6('0x1c')]=_0x53f92c[_0x11a6('0x1c')];this[_0x11a6('0x10')]=_0x53f92c['total'];if(this[_0x11a6('0x23')]===_0x11a6('0x5a')){this[_0x11a6('0x21')]=_0x53f92c[_0x11a6('0x21')];}};module[_0x11a6('0x5b')]=VoiceQueueSummary; \ No newline at end of file +var _0x87d3=['outboundOriginateFailureCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','message','statusMessage','Trunk','callerid','prototype','createReport','loggedin','callers','length','SIP/','includes','status','booked','keys','queue','dialer','exten','xcally-motion-preview','pTalking','compareToInboundQueue','some','compareToOutboundQueue','dialActive','active','updateReportFromOutboundQueue','exports','available','loggedIn','loggedInDb','paused','ringing','talking','inUse','outboundAbandonedCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','sumBillable','sumDuration','total','waiting','name','strategy','abandoned','answered','busy','invalid','onHold','notInUse','ringInUse','sumHoldTime','type','unavailable','unknown','unmanaged','outbound','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout'];(function(_0x43a04a,_0x3d469f){var _0x5358a0=function(_0x537c74){while(--_0x537c74){_0x43a04a['push'](_0x43a04a['shift']());}};_0x5358a0(++_0x3d469f);}(_0x87d3,0x86));var _0x387d=function(_0x54ab1f,_0x1585d6){_0x54ab1f=_0x54ab1f-0x0;var _0x24c869=_0x87d3[_0x54ab1f];return _0x24c869;};'use strict';var INBOUND_COUNTERS=[_0x387d('0x0'),_0x387d('0x1'),_0x387d('0x2'),_0x387d('0x3'),_0x387d('0x4'),_0x387d('0x5'),'waiting'];var OUTBOUND_COUNTERS=[_0x387d('0x0'),'answered',_0x387d('0x6'),_0x387d('0x1'),_0x387d('0x2'),'originated',_0x387d('0x7'),_0x387d('0x8'),_0x387d('0x9'),_0x387d('0xa'),_0x387d('0xb'),_0x387d('0xc'),_0x387d('0xd'),_0x387d('0xe'),_0x387d('0xf'),_0x387d('0x10'),_0x387d('0x3'),'pTalking',_0x387d('0x5'),_0x387d('0x11'),_0x387d('0x12'),_0x387d('0x13'),_0x387d('0x14')];function VoiceQueueSummary(_0x297689){this['id']=_0x297689['id'];this[_0x387d('0x15')]=_0x297689[_0x387d('0x15')];this[_0x387d('0x16')]=_0x297689[_0x387d('0x16')];this[_0x387d('0x17')]=_0x297689[_0x387d('0x17')]||0x0;this[_0x387d('0x18')]=_0x297689[_0x387d('0x18')]||0x0;this[_0x387d('0x0')]=_0x297689['available']||0x0;this['busy']=_0x297689[_0x387d('0x19')]||0x0;this['inUse']=_0x297689['inUse']||0x0;this['invalid']=_0x297689[_0x387d('0x1a')]||0x0;this[_0x387d('0x1')]=_0x297689[_0x387d('0x1')]||0x0;this[_0x387d('0x2')]=_0x297689[_0x387d('0x2')]||0x0;this[_0x387d('0x1b')]=_0x297689[_0x387d('0x1b')]||0x0;this[_0x387d('0x1c')]=_0x297689['notInUse']||0x0;this[_0x387d('0x3')]=_0x297689[_0x387d('0x3')]||0x0;this[_0x387d('0x4')]=_0x297689['ringing']||0x0;this[_0x387d('0x1d')]=_0x297689['ringInUse'];this[_0x387d('0x11')]=_0x297689['sumBillable'];this[_0x387d('0x12')]=_0x297689[_0x387d('0x12')];this[_0x387d('0x1e')]=_0x297689[_0x387d('0x1e')]||0x0;this[_0x387d('0x5')]=_0x297689['talking']||0x0;this['total']=_0x297689[_0x387d('0x13')]||0x0;this[_0x387d('0x1f')]=_0x297689[_0x387d('0x1f')];this[_0x387d('0x20')]=_0x297689[_0x387d('0x20')]||0x0;this[_0x387d('0x21')]=_0x297689[_0x387d('0x21')]||0x0;this[_0x387d('0x22')]=_0x297689[_0x387d('0x22')]||0x0;this['waiting']=_0x297689['waiting']||0x0;if(_0x297689['type']===_0x387d('0x23')){this['pTalking']=_0x297689['pTalking']||0x0;this['dialActive']=_0x297689['dialActive'];this[_0x387d('0x24')]=_0x297689[_0x387d('0x24')];this[_0x387d('0x25')]=_0x297689[_0x387d('0x25')];this[_0x387d('0x26')]=_0x297689[_0x387d('0x26')];this[_0x387d('0x27')]=_0x297689[_0x387d('0x27')];this[_0x387d('0x28')]=_0x297689[_0x387d('0x28')];this[_0x387d('0x29')]=_0x297689[_0x387d('0x29')];this[_0x387d('0x2a')]=_0x297689[_0x387d('0x2a')];this[_0x387d('0x8')]=_0x297689[_0x387d('0x8')];this['outboundBlacklistCallsDay']=_0x297689[_0x387d('0x9')];this[_0x387d('0xa')]=_0x297689[_0x387d('0xa')];this['outboundCongestionCallsDay']=_0x297689[_0x387d('0xb')];this[_0x387d('0x2b')]=_0x297689[_0x387d('0x2b')];this[_0x387d('0x2c')]=_0x297689[_0x387d('0x2c')];this['outboundDropCallsDayTimeout']=_0x297689[_0x387d('0x2d')];this[_0x387d('0xc')]=_0x297689['outboundNoAnswerCallsDay'];this['outboundNoSuchCallsDay']=_0x297689[_0x387d('0xd')];this[_0x387d('0x2e')]=_0x297689[_0x387d('0x2e')];this[_0x387d('0xe')]=_0x297689[_0x387d('0xe')];this[_0x387d('0xf')]=_0x297689['outboundRejectCallsDay'];this[_0x387d('0x10')]=_0x297689[_0x387d('0x10')];this[_0x387d('0x2f')]=_0x297689[_0x387d('0x2f')];this[_0x387d('0x30')]=_0x297689[_0x387d('0x30')];this[_0x387d('0x31')]=_0x297689['predictiveIntervalAvgTalktime'];this[_0x387d('0x32')]=_0x297689[_0x387d('0x32')];this[_0x387d('0x33')]=_0x297689[_0x387d('0x33')];this[_0x387d('0x34')]=_0x297689[_0x387d('0x34')];this['predictiveIntervalErlangCallsDroppedCalls']=_0x297689['predictiveIntervalErlangCallsDroppedCalls'];this['predictiveIntervalHitRate']=_0x297689['predictiveIntervalHitRate'];this[_0x387d('0x35')]=_0x297689[_0x387d('0x35')];this['predictiveIntervalPauses']=_0x297689[_0x387d('0x36')];this[_0x387d('0x37')]=_0x297689['predictiveIntervalAvailable'];this[_0x387d('0x38')]=_0x297689[_0x387d('0x38')];this[_0x387d('0x39')]=_0x297689['originated'];this[_0x387d('0x3a')]=_0x297689['erlangCalls'];this[_0x387d('0x3b')]=_0x297689[_0x387d('0x3b')];this[_0x387d('0x3c')]=_0x297689[_0x387d('0x3c')];this['erlangBusyFactor']=_0x297689[_0x387d('0x3d')];this[_0x387d('0x3e')]=_0x297689['startPredictive'];this[_0x387d('0x3f')]=_0x297689['startProgressive'];this[_0x387d('0x40')]=_0x297689[_0x387d('0x40')];this[_0x387d('0x41')]=_0x297689['statusMessage'];}if(_0x297689[_0x387d('0x42')]){this[_0x387d('0x42')]={'id':_0x297689[_0x387d('0x42')]['id'],'name':_0x297689['Trunk'][_0x387d('0x15')],'active':_0x297689['Trunk']['active'],'callerid':_0x297689[_0x387d('0x42')][_0x387d('0x43')]};}}VoiceQueueSummary[_0x387d('0x44')][_0x387d('0x45')]=function(_0x539063,_0x4bbe56,_0x4703bd,_0x42d496){this[_0x387d('0x2')]=0x0;this[_0x387d('0x5')]=0x0;this[_0x387d('0x3')]=0x0;this[_0x387d('0x21')]=0x0;this['notInUse']=0x0;this['inUse']=0x0;this[_0x387d('0x19')]=0x0;this[_0x387d('0x1a')]=0x0;this[_0x387d('0x20')]=0x0;this['ringing']=0x0;this[_0x387d('0x1d')]=0x0;this['onHold']=0x0;if(_0x4703bd){if(_0x4703bd[_0x387d('0x0')]){this[_0x387d('0x0')]=Number(_0x4703bd[_0x387d('0x0')]);}if(_0x4703bd['loggedin']){this[_0x387d('0x1')]=Number(_0x4703bd[_0x387d('0x46')]);}if(_0x4703bd['callers']){this[_0x387d('0x14')]=Number(_0x4703bd[_0x387d('0x47')]);}}for(var _0x4d04ed=0x0;_0x4d04ed<_0x539063[_0x387d('0x48')];_0x4d04ed++){var _0x40eeb5=_0x4bbe56[_0x387d('0x49')+_0x539063[_0x4d04ed][_0x387d('0x15')]];if(_0x40eeb5&&_0x40eeb5['online']){this[_0x387d('0x2')]+=0x1;}if(_0x539063[_0x4d04ed]['incall']==='1'){this[_0x387d('0x5')]+=0x1;}if(_0x539063[_0x4d04ed][_0x387d('0x3')]==='1'&&!['2','7','8'][_0x387d('0x4a')](_0x539063[_0x4d04ed]['status'])){this[_0x387d('0x3')]+=0x1;}switch(_0x539063[_0x4d04ed][_0x387d('0x4b')]){case'0':this[_0x387d('0x21')]+=0x1;break;case'1':this[_0x387d('0x1c')]+=0x1;break;case'2':this[_0x387d('0x6')]+=0x1;break;case'3':this[_0x387d('0x19')]+=0x1;break;case'4':this[_0x387d('0x1a')]+=0x1;break;case'5':this[_0x387d('0x20')]+=0x1;break;case'6':this[_0x387d('0x4')]+=0x1;break;case'7':this[_0x387d('0x1d')]+=0x1;break;case'8':this[_0x387d('0x1b')]+=0x1;break;}}if(this['dialMethod']===_0x387d('0x4c')){var _0x322d3b=Object[_0x387d('0x4d')](_0x42d496);for(var _0x59d681=0x0;_0x59d681<_0x322d3b['length'];_0x59d681++){var _0x4dbf7c=_0x322d3b[_0x59d681];var _0xd48de8=_0x42d496[_0x4dbf7c];if(_0xd48de8[_0x387d('0x4e')]===this[_0x387d('0x15')]&&_0xd48de8[_0x387d('0x1f')]===_0x387d('0x4f')&&_0xd48de8[_0x387d('0x50')]===_0x387d('0x51')){this[_0x387d('0x5')]+=0x1;}}if(this[_0x387d('0x5')]>this[_0x387d('0x6')]){this[_0x387d('0x5')]=this[_0x387d('0x6')];}this[_0x387d('0x52')]=0x0;}return this;};VoiceQueueSummary[_0x387d('0x44')][_0x387d('0x53')]=function(_0x257937){var _0x1dfb89=![];if(_0x257937){_0x1dfb89=INBOUND_COUNTERS[_0x387d('0x54')](function(_0x3461a4){return this[_0x3461a4]!==_0x257937[_0x3461a4];},this);}return _0x1dfb89;};VoiceQueueSummary['prototype'][_0x387d('0x55')]=function(_0x22ec01){var _0x5864fb=![];var _0x4c6c6f=![];var _0x13bdd1=![];if(_0x22ec01){_0x5864fb=this[_0x387d('0x24')]!==_0x22ec01[_0x387d('0x24')]||this['dialActive']!==_0x22ec01[_0x387d('0x56')]||this[_0x387d('0x40')]!==_0x22ec01[_0x387d('0x40')]||this[_0x387d('0x41')]!==_0x22ec01[_0x387d('0x41')];_0x4c6c6f=OUTBOUND_COUNTERS[_0x387d('0x54')](function(_0x17045c){return this[_0x17045c]!==_0x22ec01[_0x17045c];},this);if(this[_0x387d('0x42')]&&_0x22ec01[_0x387d('0x42')]){_0x13bdd1=this[_0x387d('0x42')][_0x387d('0x15')]!==_0x22ec01['Trunk'][_0x387d('0x15')]||this[_0x387d('0x42')][_0x387d('0x57')]!==_0x22ec01[_0x387d('0x42')][_0x387d('0x57')];}}return _0x5864fb||_0x4c6c6f||_0x13bdd1;};VoiceQueueSummary[_0x387d('0x44')][_0x387d('0x58')]=function(_0x1afb5f){this[_0x387d('0x18')]=_0x1afb5f[_0x387d('0x18')];this[_0x387d('0x40')]=_0x1afb5f['message'];this[_0x387d('0x41')]=_0x1afb5f[_0x387d('0x41')];this['originated']=_0x1afb5f[_0x387d('0x39')];this[_0x387d('0x7')]=_0x1afb5f[_0x387d('0x7')];this[_0x387d('0x8')]=_0x1afb5f[_0x387d('0x8')];this['outboundBlacklistCallsDay']=_0x1afb5f[_0x387d('0x9')];this['outboundBusyCallsDay']=_0x1afb5f[_0x387d('0xa')];this['outboundCongestionCallsDay']=_0x1afb5f[_0x387d('0xb')];this['outboundNoAnswerCallsDay']=_0x1afb5f['outboundNoAnswerCallsDay'];this[_0x387d('0xd')]=_0x1afb5f['outboundNoSuchCallsDay'];this['outboundReCallsDay']=_0x1afb5f[_0x387d('0xe')];this[_0x387d('0xf')]=_0x1afb5f[_0x387d('0xf')];this[_0x387d('0x10')]=_0x1afb5f[_0x387d('0x10')];this['sumBillable']=_0x1afb5f['sumBillable'];this[_0x387d('0x12')]=_0x1afb5f[_0x387d('0x12')];this['total']=_0x1afb5f[_0x387d('0x13')];if(this[_0x387d('0x24')]==='preview'){this['pTalking']=_0x1afb5f[_0x387d('0x52')];}};module[_0x387d('0x59')]=VoiceQueueSummary; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index a30d44f..2c9c9aa 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 _0xa729=['remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x505f46,_0x4830ad){var _0x369e94=function(_0x204423){while(--_0x204423){_0x505f46['push'](_0x505f46['shift']());}};_0x369e94(++_0x4830ad);}(_0xa729,0x160));var _0x9a72=function(_0x552c03,_0x247fab){_0x552c03=_0x552c03-0x0;var _0x25e104=_0xa729[_0x552c03];return _0x25e104;};'use strict';function VtigerAccount(_0x3c8adc){this['id']=_0x3c8adc['id']||0x0;this[_0x9a72('0x0')]=_0x3c8adc[_0x9a72('0x0')]||'';this['username']=_0x3c8adc[_0x9a72('0x1')]||'';this['accessKey']=_0x3c8adc['accessKey']||'';this[_0x9a72('0x2')]=_0x3c8adc[_0x9a72('0x2')]||'';this[_0x9a72('0x3')]=_0x3c8adc[_0x9a72('0x3')]||'';this[_0x9a72('0x4')]=_0x3c8adc[_0x9a72('0x4')]||{};}module[_0x9a72('0x5')]=VtigerAccount; \ No newline at end of file +var _0x17b1=['serverUrl','Configurations','name','username','accessKey','remoteUri'];(function(_0x485221,_0x1f5ca6){var _0x43a0c7=function(_0x2544b3){while(--_0x2544b3){_0x485221['push'](_0x485221['shift']());}};_0x43a0c7(++_0x1f5ca6);}(_0x17b1,0x10a));var _0x117b=function(_0x190c49,_0x103457){_0x190c49=_0x190c49-0x0;var _0x475b9a=_0x17b1[_0x190c49];return _0x475b9a;};'use strict';function VtigerAccount(_0x153b7c){this['id']=_0x153b7c['id']||0x0;this['name']=_0x153b7c[_0x117b('0x0')]||'';this[_0x117b('0x1')]=_0x153b7c[_0x117b('0x1')]||'';this[_0x117b('0x2')]=_0x153b7c[_0x117b('0x2')]||'';this[_0x117b('0x3')]=_0x153b7c[_0x117b('0x3')]||'';this[_0x117b('0x4')]=_0x153b7c['serverUrl']||'';this[_0x117b('0x5')]=_0x153b7c[_0x117b('0x5')]||{};}module['exports']=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index 087f565..dcde7d7 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 _0xb83e=['token','remoteUri','authType','integrationTab','serverUrl','Configurations','exports','name','username','password'];(function(_0x54b8e9,_0x55a1e3){var _0x26fbbf=function(_0x15a75d){while(--_0x15a75d){_0x54b8e9['push'](_0x54b8e9['shift']());}};_0x26fbbf(++_0x55a1e3);}(_0xb83e,0x93));var _0xeb83=function(_0x321246,_0x487944){_0x321246=_0x321246-0x0;var _0x3ab4d8=_0xb83e[_0x321246];return _0x3ab4d8;};'use strict';function ZendeskAccount(_0x15d9ed){this['id']=_0x15d9ed['id']||0x0;this[_0xeb83('0x0')]=_0x15d9ed[_0xeb83('0x0')]||'';this[_0xeb83('0x1')]=_0x15d9ed[_0xeb83('0x1')]||'';this[_0xeb83('0x2')]=_0x15d9ed[_0xeb83('0x2')]||'';this[_0xeb83('0x3')]=_0x15d9ed['token']||'';this[_0xeb83('0x4')]=_0x15d9ed[_0xeb83('0x4')]||'';this[_0xeb83('0x5')]=_0x15d9ed[_0xeb83('0x5')]||'';this['type']=_0x15d9ed['type']||_0xeb83('0x6');this[_0xeb83('0x7')]=_0x15d9ed['serverUrl']||'';this['Configurations']=_0x15d9ed[_0xeb83('0x8')]||{};}module[_0xeb83('0x9')]=ZendeskAccount; \ No newline at end of file +var _0x4d99=['name','username','password','token','remoteUri','authType','type','integrationTab','serverUrl','Configurations'];(function(_0x2d2a1e,_0x3ca146){var _0x3d29ff=function(_0x4fcf77){while(--_0x4fcf77){_0x2d2a1e['push'](_0x2d2a1e['shift']());}};_0x3d29ff(++_0x3ca146);}(_0x4d99,0x64));var _0x94d9=function(_0x468027,_0x4f3c67){_0x468027=_0x468027-0x0;var _0x3f8bfd=_0x4d99[_0x468027];return _0x3f8bfd;};'use strict';function ZendeskAccount(_0x86e1ea){this['id']=_0x86e1ea['id']||0x0;this[_0x94d9('0x0')]=_0x86e1ea[_0x94d9('0x0')]||'';this[_0x94d9('0x1')]=_0x86e1ea['username']||'';this[_0x94d9('0x2')]=_0x86e1ea[_0x94d9('0x2')]||'';this[_0x94d9('0x3')]=_0x86e1ea[_0x94d9('0x3')]||'';this[_0x94d9('0x4')]=_0x86e1ea[_0x94d9('0x4')]||'';this['authType']=_0x86e1ea[_0x94d9('0x5')]||'';this[_0x94d9('0x6')]=_0x86e1ea[_0x94d9('0x6')]||_0x94d9('0x7');this['serverUrl']=_0x86e1ea[_0x94d9('0x8')]||'';this[_0x94d9('0x9')]=_0x86e1ea[_0x94d9('0x9')]||{};}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 5e6fa76..12d9ad7 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 _0xbeeb=['refreshToken','Configurations','name','description','host','zone','clientId','clientSecret','serverUrl'];(function(_0x46b1f8,_0x4ab4f5){var _0x26ee58=function(_0x45a283){while(--_0x45a283){_0x46b1f8['push'](_0x46b1f8['shift']());}};_0x26ee58(++_0x4ab4f5);}(_0xbeeb,0x12b));var _0xbbee=function(_0x5c4444,_0x119726){_0x5c4444=_0x5c4444-0x0;var _0x20d93d=_0xbeeb[_0x5c4444];return _0x20d93d;};'use strict';function ZohoAccount(_0x5a5d5a){this['id']=_0x5a5d5a['id']||0x0;this[_0xbbee('0x0')]=_0x5a5d5a['name']||'';this[_0xbbee('0x1')]=_0x5a5d5a[_0xbbee('0x1')]||'';this['host']=_0x5a5d5a[_0xbbee('0x2')]||'';this['zone']=_0x5a5d5a[_0xbbee('0x3')]||'';this[_0xbbee('0x4')]=_0x5a5d5a[_0xbbee('0x4')]||'';this[_0xbbee('0x5')]=_0x5a5d5a[_0xbbee('0x5')]||'';this[_0xbbee('0x6')]=_0x5a5d5a[_0xbbee('0x6')]||'';this['code']=_0x5a5d5a['code']||'';this[_0xbbee('0x7')]=_0x5a5d5a[_0xbbee('0x7')]||'';this[_0xbbee('0x8')]=_0x5a5d5a[_0xbbee('0x8')]||{};}module['exports']=ZohoAccount; \ No newline at end of file +var _0x6e1c=['code','refreshToken','Configurations','name','description','host','zone','clientId','clientSecret','serverUrl'];(function(_0x2cfb58,_0x3d9412){var _0xd99951=function(_0x329afa){while(--_0x329afa){_0x2cfb58['push'](_0x2cfb58['shift']());}};_0xd99951(++_0x3d9412);}(_0x6e1c,0xa3));var _0xc6e1=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6e1c[_0x14add3];return _0x4a174f;};'use strict';function ZohoAccount(_0x4b3e94){this['id']=_0x4b3e94['id']||0x0;this[_0xc6e1('0x0')]=_0x4b3e94['name']||'';this[_0xc6e1('0x1')]=_0x4b3e94[_0xc6e1('0x1')]||'';this[_0xc6e1('0x2')]=_0x4b3e94[_0xc6e1('0x2')]||'';this[_0xc6e1('0x3')]=_0x4b3e94['zone']||'';this['clientId']=_0x4b3e94[_0xc6e1('0x4')]||'';this[_0xc6e1('0x5')]=_0x4b3e94[_0xc6e1('0x5')]||'';this[_0xc6e1('0x6')]=_0x4b3e94[_0xc6e1('0x6')]||'';this[_0xc6e1('0x7')]=_0x4b3e94[_0xc6e1('0x7')]||'';this[_0xc6e1('0x8')]=_0x4b3e94[_0xc6e1('0x8')]||'';this[_0xc6e1('0x9')]=_0x4b3e94['Configurations']||{};}module['exports']=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index da4bb6f..634c11d 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 _0x7334=['scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countagentrejectretry','countnosuchnumberretry','countmachineretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridname','util','lodash','moment','isNil','string','uniqueid','idContact','queue','name','type','campaigntype','membername','Agent','channelAgent','format','SIP/%s','calleridname','Contact','lastName','active','calleridnum','phone'];(function(_0x461467,_0x81d0dd){var _0x5c47da=function(_0x5a10a8){while(--_0x5a10a8){_0x461467['push'](_0x461467['shift']());}};_0x5c47da(++_0x81d0dd);}(_0x7334,0x184));var _0x4733=function(_0x14cba4,_0x18e68b){_0x14cba4=_0x14cba4-0x0;var _0x144f3f=_0x7334[_0x14cba4];return _0x144f3f;};'use strict';var util=require(_0x4733('0x0'));var _=require(_0x4733('0x1'));var moment=require(_0x4733('0x2'));function checkNameSurname(_0x5016ad,_0x59882e,_0x26b8f3){var _0x4b8b5a='';if(!_[_0x4733('0x3')](_0x59882e)&&_0x4733('0x4')===typeof _0x59882e){_0x4b8b5a+=_0x59882e;}if(!_[_0x4733('0x3')](_0x26b8f3)&&_0x4733('0x4')===typeof _0x26b8f3){_0x4b8b5a+='\x20'+_0x26b8f3;}if(_0x4b8b5a!==''){return _0x4b8b5a;}return _0x5016ad;}function Action(_0x2b146d,_0x449ead,_0x16d7cc,_0x283754,_0x12cafa){this[_0x4733('0x5')]=_0x16d7cc||undefined;this[_0x4733('0x6')]=_0x2b146d['id'];this[_0x4733('0x7')]=_0x449ead[_0x4733('0x8')];this[_0x4733('0x9')]=_0x449ead[_0x4733('0x9')];this[_0x4733('0xa')]=_0x4733('0x7');this['dialAnswer']=![];this[_0x4733('0xb')]=_[_0x4733('0x3')](_0x2b146d['Agent'])?undefined:_0x2b146d[_0x4733('0xc')]['name'];this[_0x4733('0xd')]=this[_0x4733('0xb')]?util[_0x4733('0xe')](_0x4733('0xf'),this[_0x4733('0xb')]):_0x283754||undefined;this[_0x4733('0x10')]=checkNameSurname(_0x2b146d[_0x4733('0x11')]['phone'],_0x2b146d[_0x4733('0x11')]['firstName'],_0x2b146d[_0x4733('0x11')][_0x4733('0x12')]);this[_0x4733('0x13')]=_0x2b146d[_0x4733('0x13')]||![];this[_0x4733('0x14')]=_0x2b146d[_0x4733('0x15')];this[_0x4733('0x16')]=_0x2b146d[_0x4733('0x16')];this[_0x4733('0x17')]=_0x2b146d['countbusyretry']||0x0;this[_0x4733('0x18')]=_0x2b146d[_0x4733('0x18')]||0x0;this['countnoanswerretry']=_0x2b146d[_0x4733('0x19')]||0x0;this[_0x4733('0x1a')]=(_0x2b146d[_0x4733('0x17')]||0x0)+(_0x2b146d[_0x4733('0x18')]||0x0)+(_0x2b146d['countnoanswerretry']||0x0)+(_0x2b146d['countnosuchnumberretry']||0x0)+(_0x2b146d[_0x4733('0x1b')]||0x0)+(_0x2b146d[_0x4733('0x1c')]||0x0)+(_0x2b146d['countmachineretry']||0x0)+(_0x2b146d[_0x4733('0x1d')]||0x0);this[_0x4733('0x1e')]=_0x2b146d[_0x4733('0x1e')]||0x0;this[_0x4733('0x1b')]=_0x2b146d['countdropretry']||0x0;this[_0x4733('0x1c')]=_0x2b146d[_0x4733('0x1c')]||0x0;this['countmachineretry']=_0x2b146d[_0x4733('0x1f')]||0x0;this[_0x4733('0x1d')]=_0x2b146d['countagentrejectretry']||0x0;this[_0x4733('0x20')]=_0x2b146d[_0x4733('0x20')];this[_0x4733('0x21')]=_0x2b146d[_0x4733('0x21')];this[_0x4733('0x22')]=_0x2b146d[_0x4733('0x22')];this[_0x4733('0x23')]=_0x2b146d[_0x4733('0x23')];this['ContactId']=_0x2b146d[_0x4733('0x24')];this[_0x4733('0x25')]=_0x2b146d[_0x4733('0x25')];this[_0x4733('0x26')]=_[_0x4733('0x3')](_0x2b146d[_0x4733('0xc')])?_0x2b146d[_0x4733('0x26')]:_0x2b146d[_0x4733('0xc')]['id'];this[_0x4733('0x27')]=_0x2b146d[_0x4733('0x27')];this['originatecalleridnum']='';this[_0x4733('0x28')]='';}Action['prototype']['getCaller']=function(){return util[_0x4733('0xe')]('\x22%s\x22\x20<%s>',this[_0x4733('0x10')],this['number']);};module['exports']=Action; \ No newline at end of file +var _0xb016=['countabandonedretry','countmachineretry','countagentrejectretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridname','prototype','getCaller','format','\x22%s\x22\x20<%s>','exports','util','lodash','isNil','string','uniqueid','idContact','type','campaigntype','queue','dialAnswer','Agent','name','membername','Contact','phone','firstName','active','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry'];(function(_0x3d42d8,_0x4cffaa){var _0x27fc41=function(_0x3a363b){while(--_0x3a363b){_0x3d42d8['push'](_0x3d42d8['shift']());}};_0x27fc41(++_0x4cffaa);}(_0xb016,0x159));var _0x6b01=function(_0x19631b,_0x281e35){_0x19631b=_0x19631b-0x0;var _0x1070f1=_0xb016[_0x19631b];return _0x1070f1;};'use strict';var util=require(_0x6b01('0x0'));var _=require(_0x6b01('0x1'));var moment=require('moment');function checkNameSurname(_0x57ecae,_0xf74fa1,_0x531b6a){var _0x160a7d='';if(!_[_0x6b01('0x2')](_0xf74fa1)&&_0x6b01('0x3')===typeof _0xf74fa1){_0x160a7d+=_0xf74fa1;}if(!_[_0x6b01('0x2')](_0x531b6a)&&'string'===typeof _0x531b6a){_0x160a7d+='\x20'+_0x531b6a;}if(_0x160a7d!==''){return _0x160a7d;}return _0x57ecae;}function Action(_0x1b7dd6,_0x65407a,_0x192b2d,_0x5759a1,_0x5c5bfb){this[_0x6b01('0x4')]=_0x192b2d||undefined;this[_0x6b01('0x5')]=_0x1b7dd6['id'];this['queue']=_0x65407a['name'];this[_0x6b01('0x6')]=_0x65407a[_0x6b01('0x6')];this[_0x6b01('0x7')]=_0x6b01('0x8');this[_0x6b01('0x9')]=![];this['membername']=_['isNil'](_0x1b7dd6[_0x6b01('0xa')])?undefined:_0x1b7dd6[_0x6b01('0xa')][_0x6b01('0xb')];this['channelAgent']=this[_0x6b01('0xc')]?util['format']('SIP/%s',this[_0x6b01('0xc')]):_0x5759a1||undefined;this['calleridname']=checkNameSurname(_0x1b7dd6[_0x6b01('0xd')][_0x6b01('0xe')],_0x1b7dd6['Contact'][_0x6b01('0xf')],_0x1b7dd6['Contact']['lastName']);this['active']=_0x1b7dd6[_0x6b01('0x10')]||![];this['calleridnum']=_0x1b7dd6['phone'];this[_0x6b01('0x11')]=_0x1b7dd6[_0x6b01('0x11')];this[_0x6b01('0x12')]=_0x1b7dd6[_0x6b01('0x12')]||0x0;this[_0x6b01('0x13')]=_0x1b7dd6[_0x6b01('0x13')]||0x0;this[_0x6b01('0x14')]=_0x1b7dd6[_0x6b01('0x14')]||0x0;this[_0x6b01('0x15')]=(_0x1b7dd6[_0x6b01('0x12')]||0x0)+(_0x1b7dd6[_0x6b01('0x13')]||0x0)+(_0x1b7dd6['countnoanswerretry']||0x0)+(_0x1b7dd6[_0x6b01('0x16')]||0x0)+(_0x1b7dd6[_0x6b01('0x17')]||0x0)+(_0x1b7dd6[_0x6b01('0x18')]||0x0)+(_0x1b7dd6[_0x6b01('0x19')]||0x0)+(_0x1b7dd6[_0x6b01('0x1a')]||0x0);this[_0x6b01('0x16')]=_0x1b7dd6[_0x6b01('0x16')]||0x0;this[_0x6b01('0x17')]=_0x1b7dd6['countdropretry']||0x0;this[_0x6b01('0x18')]=_0x1b7dd6[_0x6b01('0x18')]||0x0;this[_0x6b01('0x19')]=_0x1b7dd6[_0x6b01('0x19')]||0x0;this[_0x6b01('0x1a')]=_0x1b7dd6[_0x6b01('0x1a')]||0x0;this[_0x6b01('0x1b')]=_0x1b7dd6['callback'];this[_0x6b01('0x1c')]=_0x1b7dd6[_0x6b01('0x1c')];this[_0x6b01('0x1d')]=_0x1b7dd6['callbackat'];this[_0x6b01('0x1e')]=_0x1b7dd6[_0x6b01('0x1e')];this[_0x6b01('0x1f')]=_0x1b7dd6[_0x6b01('0x1f')];this[_0x6b01('0x20')]=_0x1b7dd6[_0x6b01('0x20')];this[_0x6b01('0x21')]=_[_0x6b01('0x2')](_0x1b7dd6[_0x6b01('0xa')])?_0x1b7dd6[_0x6b01('0x21')]:_0x1b7dd6[_0x6b01('0xa')]['id'];this[_0x6b01('0x22')]=_0x1b7dd6[_0x6b01('0x22')];this['originatecalleridnum']='';this[_0x6b01('0x23')]='';}Action[_0x6b01('0x24')][_0x6b01('0x25')]=function(){return util[_0x6b01('0x26')](_0x6b01('0x27'),this['calleridname'],this['number']);};module[_0x6b01('0x28')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 6a2186f..b6c9da9 100644 --- a/server/services/ami/preview/index.js +++ b/server/services/ami/preview/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','emit','info','format','voice:queue:%s','name','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','originated','pTalking','available','CAMPAIGN_STATUS','INACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','\x20is\x20deactivated','syncCampaigns','hasOwnProperty','dialMethod','booked','type','outbound','dialActive','setMessage','recallMe','clearZombieChannel','sequence','isNil','Queue','queue','originated:\x20','stringify','pick','UserId','VoiceQueueId','ListId','channel','message','No\x20such\x20channel','dialAnswer','decrementTalkink','[clearZombieChannel]','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','clearZombieChannels','size','getContactRecallMe','then','length','getDiff','scheduledat','Agent','voicePause','run','[RecallMe]','catch','logger2','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[getContactRecallMe]','IsNotLoggedIn','NO_AGENTS_LOGGED','isActive','isTrunkReachable','UNREACHABLE_TRUNK','callProgressDetectingCustomer','outboundNoSuchCallsDay','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','additional','dialNoSuchNumberRetryFrequency','cloneAction','createCustomerFinal','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','scheduledAt','activeContact','linkedid','idContact','incrementPreviewCounters','ANSWER','answertime','[syncHangup][talking][increment]','pTalking:\x20','custom:agentconnect','connect','acw','mandatoryDisposition','custom:agentConnectPreview','channelAgent','uniqueid','custom:agentcomplete','complete','outboundAnswerCallsDay','answered','[16]','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','sumDuration','talktime','sumBillable','[syncHangup][talking][decrement]','\x20Queue','outboundBusyCallsDay','countbusyretry','Busy','dialBusyRetryFrequency','callAdditionalPhoneAfterMin','busy','[callProgressDetectingCustomer][logBusy]','dialGlobalMaxRetry','Global','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','unlockAgent','NOANSWER','countnoanswerretry','dialNoAnswerRetryFrequency','buildNoAnswerEventPayload','custom:agentnoanswer','dialNoAnswerMaxRetry','[callProgressDetectingCustomer][logNoAnswer]','outboundCongestionCallsDay','countcongestionretry','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','[callProgressDetectingCustomer][logCongestion]','swapAdditionalPhones','CANCEL','outboundRejectCallsDay','countagentrejectretry','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedMaxRety','countmachineretry','cause-txt','custom:amd','[callProgressDetectingCustomer][hangupInAMD]','outboundUnknownCallsDay','dialstatus','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknownGlobal]','updateOriginated','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','object','isUndefined','reason','logAgent','[callProgressDetectingAgent][logNoSuch]','NoAnswer','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','resolve','checkInBlack','Contact','phone','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','[Preview][execCall][success]','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','logBlacklist','[Blacklist][error]','Contact\x20in\x20black\x20List','active','SIP/%s','status','reachable','unmonitored','execRun','unlock','unlockContact','recallme','validateContact','checkIsBlackList','[Preview][checkIsBlackList]','[Preview][getContactPreview]','Call\x20unsuccessful','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','Trunk','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','TrunkBackup','\x20Trunk\x20Backup\x20is\x20not\x20active','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','dialPrefix','trim','dialCutDigit','substring','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','merge','toLowerVariables','variables','variablesAction','Action','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','actionid','logLookAgent','clone','responsetime','response','rejected','Answer','[callProgressDetectingAgent][logAnswer]','cause','[syncHangup][talking][cause]','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','syncHangupRequest','addVariable','keys','variable','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','uuid','../../../config/environment','preview','../../../config/logger','actionPreview','../ami','./rpcDb','./action','./util/util','../dialer/utils','redis','prototype','enqueue','tail','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','syncDialEnd','syncNewExten'];(function(_0xcdc44a,_0x302eef){var _0x3dec77=function(_0x4afa9f){while(--_0x4afa9f){_0xcdc44a['push'](_0xcdc44a['shift']());}};_0x3dec77(++_0x302eef);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0xa9e0[_0x9aada2];return _0x196dff;};'use strict';var util=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var uuid=require(_0x0a9e('0x2'));var moment=require('moment');var Redis=require('ioredis');var config=require(_0x0a9e('0x3'));var logger=require('../../../config/logger')(_0x0a9e('0x4'));var loggerAction=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var ami=require(_0x0a9e('0x7'));var rpcDb=require(_0x0a9e('0x8'));var cmHopperAdditionalPhone=require('../rpc/cmHopperAdditionalPhone');var Action=require(_0x0a9e('0x9'));var ut=require(_0x0a9e('0xa'));var utils=require(_0x0a9e('0xb'));config['redis']=_['defaults'](config[_0x0a9e('0xc')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0a9e('0xc')]));var Sequence=function(){};Sequence[_0x0a9e('0xd')][_0x0a9e('0xe')]=function(_0x3ab53f){this[_0x0a9e('0xf')]=this[_0x0a9e('0xf')]?this['tail']['finally'](_0x3ab53f):_0x3ab53f();};function Preview(_0x527cdd){this['sequence']=new Sequence();this[_0x0a9e('0x10')]=_0x527cdd[_0x0a9e('0x11')];this[_0x0a9e('0x12')]=_0x527cdd[_0x0a9e('0x12')];this[_0x0a9e('0x13')]={};this[_0x0a9e('0x14')]=_0x527cdd['agents'];this[_0x0a9e('0x15')]=0x0;ami['on'](_0x0a9e('0x16'),this[_0x0a9e('0x17')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x19'),this[_0x0a9e('0x1a')]['bind'](this));ami['on'](_0x0a9e('0x1b'),this['syncHangupRequest'][_0x0a9e('0x18')](this));ami['on']('dialend',this[_0x0a9e('0x1c')][_0x0a9e('0x18')](this));ami['on']('newexten',this[_0x0a9e('0x1d')]['bind'](this));ami['on'](_0x0a9e('0x1e'),this[_0x0a9e('0x1f')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x20'),this[_0x0a9e('0x21')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x22'),this[_0x0a9e('0x23')][_0x0a9e('0x18')](this));this[_0x0a9e('0x24')](this[_0x0a9e('0x10')]);}function emit(_0x105080,_0x4bb1e3,_0x2c3407){io['to'](_0x105080)[_0x0a9e('0x25')](_0x4bb1e3,_0x2c3407);}function emitVoiceQueueChannelRemove(_0x53682f){logger[_0x0a9e('0x26')]('[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event',JSON['stringify'](_0x53682f));emit(util[_0x0a9e('0x27')](_0x0a9e('0x28'),_0x53682f[_0x0a9e('0x29')]),_0x0a9e('0x2a'),_0x53682f);io['emit'](_0x0a9e('0x2b'),_0x53682f);}function notSendMessagesQueue(_0x2fb0e4){if(_0x2fb0e4[_0x0a9e('0x2c')]){if(_0x2fb0e4[_0x0a9e('0x2d')]===0x0&&_0x2fb0e4[_0x0a9e('0x2e')]===0x0){_0x2fb0e4[_0x0a9e('0x2c')]=![];_0x2fb0e4[_0x0a9e('0x2f')]=0x0;_0x2fb0e4['paused']=0x0;_0x2fb0e4['message']=utils[_0x0a9e('0x30')][_0x0a9e('0x31')];ut[_0x0a9e('0x32')](_0x0a9e('0x33'),_0x2fb0e4['name']+_0x0a9e('0x34'));}else{_0x2fb0e4['message']=utils[_0x0a9e('0x30')]['DEACTIVATED'];ut[_0x0a9e('0x32')](_0x0a9e('0x33'),_0x2fb0e4[_0x0a9e('0x29')]+_0x0a9e('0x35'));}}}Preview[_0x0a9e('0xd')][_0x0a9e('0x24')]=function(){var _0x11c3b6=this;setInterval(function(){_0x11c3b6[_0x0a9e('0x36')]();},0x7cf);};Preview['prototype'][_0x0a9e('0x36')]=function(){var _0x468813=this[_0x0a9e('0x10')];this[_0x0a9e('0x15')]+=0x1;for(var _0x5c877d in _0x468813){if(_0x468813[_0x0a9e('0x37')](_0x5c877d)&&(_0x468813[_0x5c877d][_0x0a9e('0x38')]===_0x0a9e('0x4')||_0x468813[_0x5c877d][_0x0a9e('0x38')]===_0x0a9e('0x39'))&&_0x468813[_0x5c877d][_0x0a9e('0x3a')]===_0x0a9e('0x3b')){if(this[_0x0a9e('0x15')]>0x7){this[_0x0a9e('0x15')]=0x0;this['clearZombieChannels']();}}if(_0x468813[_0x0a9e('0x37')](_0x5c877d)&&_0x468813[_0x5c877d]['dialMethod']===_0x0a9e('0x4')&&_0x468813[_0x5c877d][_0x0a9e('0x3a')]===_0x0a9e('0x3b')){if(_0x468813[_0x5c877d][_0x0a9e('0x3c')]){this[_0x0a9e('0x3d')](_0x468813[_0x5c877d]);if(_0x468813[_0x5c877d]['dialPreviewAutoRecallMe'])this[_0x0a9e('0x3e')](_0x468813[_0x5c877d]);}else{notSendMessagesQueue(_0x468813[_0x5c877d]);}}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x3f')]=function(_0x2da5c0){var _0x2b45ea=this;this[_0x0a9e('0x40')][_0x0a9e('0xe')](function(){if(!_[_0x0a9e('0x41')](_0x2b45ea['actions'][_0x2da5c0])){loggerAction[_0x0a9e('0x26')]('[clearZombieChannels][talking]',_0x2da5c0,_0x0a9e('0x42'),_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')],_0x0a9e('0x44'),JSON['stringify'](_0x2b45ea[_0x0a9e('0x10')][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]][_0x0a9e('0x2d')]),'pTalking:\x20',JSON['stringify'](_0x2b45ea[_0x0a9e('0x10')][_0x2b45ea['actions'][_0x2da5c0][_0x0a9e('0x43')]][_0x0a9e('0x2e')]),JSON[_0x0a9e('0x45')](_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0]['dialAnswer']),JSON[_0x0a9e('0x45')](_[_0x0a9e('0x46')](_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0],['contactId',_0x0a9e('0x47'),_0x0a9e('0x48'),_0x0a9e('0x49')])));return ami['Action']({'action':'status','channel':_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x4a')]})['catch'](function(_0x2b814e){if(_0x2b814e[_0x0a9e('0x4b')]===_0x0a9e('0x4c')){setTimeout(function(){if(_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0]){ut['updateOriginated'](_0x2b45ea['campaignsPreview'][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]],'[clearZombieChannel]');if(_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x4d')]===!![]){ut[_0x0a9e('0x4e')](_0x2b45ea['campaignsPreview'][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]],_0x0a9e('0x4f'));ut[_0x0a9e('0x50')](_0x0a9e('0x51')+_0x2da5c0,_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]);}ut[_0x0a9e('0x50')](_0x0a9e('0x52')+_0x2da5c0,_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]);delete _0x2b45ea[_0x0a9e('0x13')][_0x2da5c0];}},0x2328);}});}});};Preview[_0x0a9e('0xd')][_0x0a9e('0x53')]=function(){var _0x37f6cc=this;loggerAction['info']('[action]',_[_0x0a9e('0x54')](this[_0x0a9e('0x13')]));for(var _0x405c8f in this[_0x0a9e('0x13')]){if(_0x37f6cc[_0x0a9e('0x13')][_0x0a9e('0x37')](_0x405c8f)){_0x37f6cc[_0x0a9e('0x3f')](_0x405c8f);}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x3e')]=function(_0x25c6e6){var _0x2c2cb0=this;rpcDb[_0x0a9e('0x55')](_0x25c6e6['id'],ut['agentReadyId'](this[_0x0a9e('0x14')]))[_0x0a9e('0x56')](function(_0xdd268f){if(!_[_0x0a9e('0x41')](_0xdd268f)){for(var _0x2e8caf=0x0;_0x2e8caf<_0xdd268f[_0x0a9e('0x57')];_0x2e8caf+=0x1){if(ut[_0x0a9e('0x58')](_0xdd268f[_0x2e8caf][_0x0a9e('0x59')])<_0x25c6e6['dialRecallMeTimeout']*0x3c){if(_0xdd268f[_0x2e8caf][_0x0a9e('0x5a')]&&!_0xdd268f[_0x2e8caf]['Agent'][_0x0a9e('0x5b')]){_0x2c2cb0[_0x0a9e('0x5c')](_0xdd268f[_0x2e8caf]['id'])[_0x0a9e('0x56')](ut['logger2'](_0x0a9e('0x5d')))[_0x0a9e('0x5e')](ut[_0x0a9e('0x5f')](_0x0a9e('0x5d')));}else{rpcDb[_0x0a9e('0x60')](_0xdd268f[_0x2e8caf]['id']);}}else{var _0x37be73=new Action(_0xdd268f[_0x2e8caf],_0x25c6e6);_0x37be73[_0x0a9e('0x61')]=moment()['format'](_0x0a9e('0x62'));_0x25c6e6[_0x0a9e('0x63')]+=0x1;ut[_0x0a9e('0x64')](_0x37be73,0x17,_0x0a9e('0x65'));if(_0x25c6e6[_0x0a9e('0x66')]){rpcDb[_0x0a9e('0x67')](ut[_0x0a9e('0x68')](_0xdd268f[_0x2e8caf]));rpcDb[_0x0a9e('0x69')](_0x37be73,_0x0a9e('0x6a'));}else{ut['logCustomer'](_0x37be73,0x16,_0x0a9e('0x6b'));rpcDb[_0x0a9e('0x69')](_0x37be73,'[HistoryRecallClose]');rpcDb['createCustomerFinal'](_0x37be73,'[HistoryRecallClose]');}}}}})[_0x0a9e('0x5e')](ut[_0x0a9e('0x5f')](_0x0a9e('0x6c')));};Preview[_0x0a9e('0xd')][_0x0a9e('0x3d')]=function(_0x30decb){_0x30decb[_0x0a9e('0x2c')]=!![];if(ut[_0x0a9e('0x6d')](_0x30decb['loggedIn'])){_0x30decb['message']=utils['CAMPAIGN_STATUS'][_0x0a9e('0x6e')];}else if(!ut[_0x0a9e('0x6f')](_0x30decb[_0x0a9e('0x3c')])){_0x30decb['message']=utils[_0x0a9e('0x30')][_0x0a9e('0x31')];}else if(!this['isTrunkReachable'](_0x30decb['Trunk'])){if(!this[_0x0a9e('0x70')](_0x30decb['TrunkBackup'])){_0x30decb[_0x0a9e('0x4b')]=utils['CAMPAIGN_STATUS'][_0x0a9e('0x71')];}else{_0x30decb[_0x0a9e('0x4b')]=utils[_0x0a9e('0x30')]['ACTIVE'];}}else{_0x30decb[_0x0a9e('0x4b')]=utils[_0x0a9e('0x30')]['ACTIVE'];}};Preview['prototype'][_0x0a9e('0x72')]=function(_0x3aedd0,_0x49c095,_0x145931){var _0x5ce9ac=this;var _0x211ef9=this['actions'][_0x49c095];var _0xe22ccc=this['campaignsPreview'][_0x211ef9['queue']];var _0x5df0ad;var _0x2da03c=![];var _0x47de4c=0x2;var _0x2f7092=0x3;if(_0xe22ccc){switch(_0x145931){case'1':_0xe22ccc[_0x0a9e('0x73')]+=0x1;_0x211ef9[_0x0a9e('0x74')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x0,_0x0a9e('0x77'));ami[_0x0a9e('0x25')]('custom:agentnosuchnumber',ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0x79')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0x7a'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'0',_0xe22ccc)[_0x0a9e('0x56')](function(_0x5d86e9){_0x2da03c=_0x5d86e9[_0x0a9e('0x7c')]==0x1;_0x47de4c=_0xe22ccc[_0x0a9e('0x7d')];_0x2f7092=_0xe22ccc['callAdditionalPhoneAfterMin'];if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc['dialGlobalMaxRetry']){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,'Global');rpcDb['createCustomerFinal'](_0x5df0ad,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{if(_0x211ef9[_0x0a9e('0x74')]>=_0xe22ccc['dialNoSuchNumberMaxRetry']){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0x80'));}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,_0x0a9e('0x74'),_0xe22ccc[_0x0a9e('0x7d')]),_0x211ef9['unlockAgent'],_0x211ef9[_0x0a9e('0x83')]);}}delete this['actions'][_0x3aedd0[_0x0a9e('0x84')]];}else{_0x211ef9[_0x0a9e('0x74')]++;logger[_0x0a9e('0x26')]('actioncountonusuch',_0x211ef9[_0x0a9e('0x74')]);logger[_0x0a9e('0x26')]('id',_0x211ef9[_0x0a9e('0x85')]);_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9['idContact'],'field':{'countnosuchnumberretry':_0x211ef9[_0x0a9e('0x74')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0x87'):var _0x88dcbf=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));_0x211ef9['responsetime']=_0x88dcbf;_0x211ef9[_0x0a9e('0x88')]=_0x88dcbf;_0x211ef9[_0x0a9e('0x4d')]=!![];_0xe22ccc[_0x0a9e('0x2e')]+=0x1;logger['info'](_0x0a9e('0x89'),_0x211ef9['uniqueid'],'\x20Queue',_0xe22ccc[_0x0a9e('0x29')],_0x0a9e('0x8a'),_0xe22ccc[_0x0a9e('0x2e')]);ami[_0x0a9e('0x25')](_0x0a9e('0x8b'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0x8c'),this[_0x0a9e('0x10')][_0x211ef9[_0x0a9e('0x43')]]));if(_0xe22ccc[_0x0a9e('0x8d')]||_0xe22ccc[_0x0a9e('0x8e')]){ami[_0x0a9e('0x25')](_0x0a9e('0x8f'),{'queue':_0x211ef9[_0x0a9e('0x43')],'interface':_0x211ef9[_0x0a9e('0x90')],'uniqueid':_0x211ef9[_0x0a9e('0x91')]});}break;case'16':ami[_0x0a9e('0x25')](_0x0a9e('0x92'),ut['buildObj'](_0x211ef9,_0x0a9e('0x93'),this[_0x0a9e('0x10')][_0x211ef9[_0x0a9e('0x43')]]));emitVoiceQueueChannelRemove(ut['buildObj'](_0x211ef9,_0x0a9e('0x93')));_0xe22ccc[_0x0a9e('0x94')]+=0x1;_0xe22ccc['total']+=0x1;_0xe22ccc[_0x0a9e('0x95')]+=0x1;ut[_0x0a9e('0x4e')](_0xe22ccc,_0x0a9e('0x96'));_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x4,'Answer');rpcDb['createCustomerHistory'](_0x211ef9,_0x0a9e('0x97'));rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0x98'));rpcDb[_0x0a9e('0x99')](_0x211ef9);_0xe22ccc[_0x0a9e('0x9a')]+=_0x211ef9[_0x0a9e('0x9b')];_0xe22ccc[_0x0a9e('0x9c')]+=_0x211ef9[_0x0a9e('0x9b')];logger['info'](_0x0a9e('0x9d'),_0x211ef9[_0x0a9e('0x91')],_0x0a9e('0x9e'),_0xe22ccc['name'],_0x0a9e('0x8a'),_0xe22ccc['pTalking']);delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;case'BUSY':_0xe22ccc[_0x0a9e('0x9f')]+=0x1;_0x211ef9[_0x0a9e('0xa0')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x5,_0x0a9e('0xa1'));_0x47de4c=_0xe22ccc[_0x0a9e('0xa2')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami[_0x0a9e('0x25')]('custom:agentbusy',ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xa4')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xa5'));_0x5ce9ac['verifyAdditionalPhones'](_0x211ef9,'5',_0xe22ccc)[_0x0a9e('0x56')](function(_0x3511c9){_0x2da03c=_0x3511c9[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xa8'));}else{if(_0x211ef9[_0x0a9e('0xa0')]>=_0xe22ccc[_0x0a9e('0xa9')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xa5'));}else{rpcDb[_0x0a9e('0x81')](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xa0'),_0xe22ccc[_0x0a9e('0xa2')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xa0')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countbusyretry':_0x211ef9[_0x0a9e('0xa0')]}})['then'](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0xab'):_0xe22ccc['outboundNoAnswerCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xac')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x3,'NoAnswer');_0x47de4c=_0xe22ccc[_0x0a9e('0xad')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];var _0x2d2286=ut[_0x0a9e('0xae')](_0x211ef9,_0xe22ccc);ami[_0x0a9e('0x25')](_0x0a9e('0xaf'),_0x2d2286);rpcDb[_0x0a9e('0x69')](_0x211ef9,'[callProgressDetectingCustomer][logNoAnswer]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'3',_0xe22ccc)[_0x0a9e('0x56')](function(_0x45c109){_0x2da03c=_0x45c109[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,'Global');rpcDb[_0x0a9e('0x7f')](_0x5df0ad,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0x211ef9[_0x0a9e('0xac')]>=_0xe22ccc[_0x0a9e('0xb0')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xb1'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xac'),_0xe22ccc[_0x0a9e('0xad')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9['idContact'],'field':{'countnoanswerretry':_0x211ef9['countnoanswerretry']}})[_0x0a9e('0x56')](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});break;case'CONGESTION':_0xe22ccc[_0x0a9e('0xb2')]+=0x1;_0x211ef9[_0x0a9e('0xb3')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x8,_0x0a9e('0xb4'));_0x47de4c=_0xe22ccc['dialCongestionRetryFrequency'];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami['emit'](_0x0a9e('0xb5'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xb6')));rpcDb[_0x0a9e('0x69')](_0x211ef9,'[callProgressDetectingCustomer][logCongestion]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'8',_0xe22ccc)[_0x0a9e('0x56')](function(_0x1d4877){_0x2da03c=_0x1d4877['additional']==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xb7'));}else{if(_0x211ef9[_0x0a9e('0xb3')]>=_0xe22ccc[_0x0a9e('0xb8')]){rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xb9'));}else{rpcDb[_0x0a9e('0x81')](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xb3'),_0xe22ccc[_0x0a9e('0xa2')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xb3')]++;_0x5ce9ac['incrementPreviewCounters']({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countcongestionretry':_0x211ef9[_0x0a9e('0xb3')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0xbb'):_0xe22ccc[_0x0a9e('0xbc')]+=0x1;_0x211ef9[_0x0a9e('0xbd')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x14,_0x0a9e('0xbe'));_0x47de4c=_0xe22ccc[_0x0a9e('0xbf')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami[_0x0a9e('0x25')](_0x0a9e('0xc0'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xc1')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xc2'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'20',_0xe22ccc)[_0x0a9e('0x56')](function(_0x4989f9){_0x2da03c=_0x4989f9[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0x14,_0x0a9e('0xbe'));rpcDb['createCustomerFinal'](_0x5df0ad,_0x0a9e('0xc3'));}else{if(_0x211ef9[_0x0a9e('0xbd')]>=_0xe22ccc['dialAgentRejectMaxRetry']){rpcDb[_0x0a9e('0x7f')](_0x211ef9,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,_0x0a9e('0xbd'),_0xe22ccc[_0x0a9e('0xbf')]),_0x211ef9['unlockAgent'],_0x211ef9[_0x0a9e('0x83')]);}}}else{_0x211ef9['countnoanswerretry']++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9['countnoanswerretry']}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case'ABANDONED':_0xe22ccc['outboundAbandonedCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xc4')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0xb,_0x0a9e('0xc5'));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xc6'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'11',_0xe22ccc)[_0x0a9e('0x56')](function(_0x586510){_0x2da03c=_0x586510[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xc6'));}else{if(_0x211ef9['countabandonedetry']>=_0xe22ccc[_0x0a9e('0xc7')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xc6'));}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,'countabandonedretry',_0xe22ccc['dialAbandonedRetryFrequency']),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});break;case'18':_0xe22ccc['outboundUnknownCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xc8')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x12,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0['dialstatus']);ami['emit'](_0x0a9e('0xca'),ut[_0x0a9e('0x78')](_0x211ef9,'amd'));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xcb'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'18',_0xe22ccc)[_0x0a9e('0x56')](function(_0x2eb028){_0x2da03c=_0x2eb028['additional']==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0x12,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xcb'));}else{rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xcb'));}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac['incrementPreviewCounters']({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;case'19':_0xe22ccc[_0x0a9e('0xcc')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x13,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0[_0x0a9e('0xcd')]);ami[_0x0a9e('0x25')](_0x0a9e('0xca'),ut[_0x0a9e('0x78')](_0x211ef9,'amd'));rpcDb['createCustomerHistory'](_0x211ef9,_0x0a9e('0xce'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'18',_0xe22ccc)[_0x0a9e('0x56')](function(_0x2fea95){_0x2da03c=_0x2fea95[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb['createCustomerFinal'](_0x5df0ad,_0x0a9e('0xce'));}else{rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xce'));}}else{_0x211ef9['countnoanswerretry']++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})['then'](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;default:if(_0x211ef9[_0x0a9e('0x4d')]){ut[_0x0a9e('0x4e')](_0xe22ccc,_0x0a9e('0xcf'));ut[_0x0a9e('0x50')](_0x0a9e('0xd0')+_0xe22ccc[_0x0a9e('0x29')],_0x3aedd0);}_0xe22ccc[_0x0a9e('0xcc')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0xc,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0[_0x0a9e('0xcd')]);_0x47de4c=_0xe22ccc[_0x0a9e('0xbf')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];rpcDb['createCustomerHistory'](_0x211ef9,'[callProgressDetectingCustomer][logUnknown]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'20',_0xe22ccc)['then'](function(_0x1d999b){_0x2da03c=_0x1d999b[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xd1'));}delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];}else{_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});}});}if(!(_0x211ef9[_0x0a9e('0x4d')]&&_0x145931==='16')){ut[_0x0a9e('0xd2')](_0xe22ccc,'[callProgressDetectingCustomer]');logger[_0x0a9e('0x26')](_0x0a9e('0xd3'),_0x211ef9[_0x0a9e('0x91')],'\x20Queue',_0xe22ccc[_0x0a9e('0x29')],_0x0a9e('0x44'),_0xe22ccc[_0x0a9e('0x2d')]);}if(_0x145931!==_0x0a9e('0x87')){delete this[_0x0a9e('0x13')][_0x3aedd0['linkedid']];delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0xd4')]];}_0xe22ccc['queueSummaryCountersUpdated']=!![];}};Preview[_0x0a9e('0xd')][_0x0a9e('0xd5')]=function(_0x1f6f1c,_0x5822a7,_0x5c3b6f){if(_['isUndefined'](_0x5822a7)&&_0x0a9e('0xd6')!==typeof _0x5822a7){return;}if(_[_0x0a9e('0xd7')](_0x5c3b6f)&&'object'!==typeof _0x5c3b6f){return;}switch(_0x5c3b6f[_0x0a9e('0xd8')]){case'0':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x0,_0x0a9e('0x77'));rpcDb['createAgentHistory'](_0x1f6f1c,_0x0a9e('0xda'));break;case'3':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x3,_0x0a9e('0xdb'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xdd'));break;case'5':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x5,_0x0a9e('0xa1'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xde'));break;case'8':ut['logAgent'](_0x1f6f1c,0x8,_0x0a9e('0xb4'));rpcDb['createAgentHistory'](_0x1f6f1c,_0x0a9e('0xdf'));break;case'22':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x16,_0x0a9e('0xe0'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xe1'));break;default:ut[_0x0a9e('0xd9')](_0x1f6f1c,0xc,_0x5c3b6f['reason']);rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xdf'));}ut[_0x0a9e('0xd2')](_0x5822a7,_0x0a9e('0xe2'));logger['info'](_0x0a9e('0xe3'),_0x1f6f1c[_0x0a9e('0x91')],_0x0a9e('0x9e'),_0x5822a7[_0x0a9e('0x29')],_0x0a9e('0x44'),_0x5822a7[_0x0a9e('0x2d')]);delete this[_0x0a9e('0x13')][_0x1f6f1c[_0x0a9e('0x91')]];};Preview[_0x0a9e('0xd')][_0x0a9e('0x7b')]=function(_0x57f0ad,_0x2272bc,_0x88b25f){return cmHopperAdditionalPhone[_0x0a9e('0x7b')](_0x57f0ad,_0x2272bc,_0x88b25f)[_0x0a9e('0x5e')](logger[_0x0a9e('0x26')](_0x0a9e('0xe4')));};Preview[_0x0a9e('0xd')][_0x0a9e('0xba')]=function(_0x566b90,_0x3b581c,_0xd2391){return cmHopperAdditionalPhone[_0x0a9e('0xba')](_0x566b90,_0x3b581c,_0xd2391)['catch'](logger[_0x0a9e('0x26')](_0x0a9e('0xe5')));};Preview[_0x0a9e('0xd')][_0x0a9e('0x86')]=function(_0x370b5e){return Promise[_0x0a9e('0xe6')]()[_0x0a9e('0x56')](cmHopperAdditionalPhone[_0x0a9e('0x86')](_0x370b5e))[_0x0a9e('0x5e')](logger[_0x0a9e('0x26')]('[incrementPreviewCounters]\x20'));};Preview[_0x0a9e('0xd')][_0x0a9e('0xe7')]=function(_0x15a9ed,_0x3db98f,_0x2b624e,_0x3942fd,_0x5cb48d){var _0x382687=this;return new Promise(function(_0x4f854b,_0x5bd139){if(_['isNil'](_0x3db98f)||_[_0x0a9e('0x41')](_0x3db98f[_0x0a9e('0xe8')])||_[_0x0a9e('0x41')](_0x3db98f[_0x0a9e('0xe9')])||_['isNil'](_0x3db98f[_0x0a9e('0x48')])){_0x5bd139(ut[_0x0a9e('0x4b')](_0x0a9e('0xea'),_0x3942fd,_0x5cb48d));return;}var _0x1fdb10=uuid['v4']();var _0x2c8d1d=_0x382687['campaignsPreview'][_0x3db98f['Queue'][_0x0a9e('0x29')]];var _0x33bcb2=_0x2b624e?_0x382687[_0x0a9e('0x14')][_0x2b624e]['id']:undefined;_0x382687['actions'][_0x1fdb10]=new Action(_0x3db98f,_0x2c8d1d,_0x1fdb10,_0x2b624e,_0x33bcb2);var _0x319752=_0x382687[_0x0a9e('0x13')][_0x1fdb10];_0x319752[_0x0a9e('0xaa')]=_0x3942fd;_0x319752['activeContact']=_0x5cb48d;_0x319752[_0x0a9e('0xeb')]=_0x2b624e;if(_[_0x0a9e('0xec')](_0x15a9ed)){_0x382687[_0x0a9e('0xed')](_0x319752,_0x2c8d1d,_0x3db98f,_0x2b624e)['then'](function(_0x272291){logger[_0x0a9e('0x26')](_0x0a9e('0xee'),'Queue:\x20'+_0x319752['queue']+'\x20IdHopper:\x20'+_0x319752[_0x0a9e('0x85')],JSON[_0x0a9e('0x45')](_0x272291));ami[_0x0a9e('0x25')](_0x0a9e('0xef'),ut['buildObj'](_0x319752,_0x0a9e('0xf0'),_0x382687['campaignsPreview'][_0x319752[_0x0a9e('0x43')]]));_0x4f854b(ut[_0x0a9e('0x4b')](_0x0a9e('0xf1')));})['catch'](function(_0x33b4b3){ut[_0x0a9e('0x32')](_0x0a9e('0xf2'),_0x33b4b3);_0x5bd139(ut['message'](_0x0a9e('0xf3'),_0x3942fd,_0x5cb48d));});}else{_0x2c8d1d['outboundBlacklistCallsDay']+=0x1;ut[_0x0a9e('0xf4')](_0x319752);rpcDb['createHistory'](_0x319752,_0x0a9e('0xf5'));delete _0x382687['actions'][_0x1fdb10];_0x5bd139(ut[_0x0a9e('0x4b')](_0x0a9e('0xf6'),_0x3942fd,_0x5cb48d));}});};Preview[_0x0a9e('0xd')][_0x0a9e('0x70')]=function(_0x1e306c){return!_[_0x0a9e('0x41')](_0x1e306c)&&!_[_0x0a9e('0x41')](_0x1e306c['name'])&&!_[_0x0a9e('0x41')](_0x1e306c[_0x0a9e('0xf7')])&&_0x1e306c['active']&&!_[_0x0a9e('0x41')](this[_0x0a9e('0x12')][util['format'](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])])&&!_[_0x0a9e('0x41')](this['trunks'][util[_0x0a9e('0x27')](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')])&&(this[_0x0a9e('0x12')][util[_0x0a9e('0x27')](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')]===_0x0a9e('0xfa')||this['trunks'][util[_0x0a9e('0x27')]('SIP/%s',_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')]===_0x0a9e('0xfb'));};Preview[_0x0a9e('0xd')][_0x0a9e('0x5c')]=function(_0x2d45db,_0x5691ac){return this[_0x0a9e('0xfc')](_0x2d45db,_0x5691ac)[_0x0a9e('0x56')](function(_0x2977a7){return _['pick'](_0x2977a7,[_0x0a9e('0x4b')]);})[_0x0a9e('0x5e')](function(_0x4435d2){if(_0x4435d2[_0x0a9e('0xfd')]){rpcDb[_0x0a9e('0xfe')](_0x2d45db);}if(_0x4435d2[_0x0a9e('0xf7')]){rpcDb[_0x0a9e('0x60')](_0x2d45db);}throw _['pick'](_0x4435d2,[_0x0a9e('0x4b')]);});};Preview[_0x0a9e('0xd')][_0x0a9e('0xfc')]=function(_0x2ce3be,_0x3de77e){var _0x241404=this;var _0x8120e,_0x5d6a48;return rpcDb['getContactPreview'](_0x2ce3be)[_0x0a9e('0x56')](function(_0x3f507c){if(!_[_0x0a9e('0x41')](_0x3f507c[0x0])){_0x5d6a48=_0x3f507c[0x0][_0x0a9e('0xff')]?![]:!![];_0x8120e=_0x3f507c[0x0][_0x0a9e('0xff')]?!![]:![];_0x8120e=_0x3de77e?!![]:_0x8120e;}var _0x131da8=_0x241404[_0x0a9e('0x100')](_0x3f507c);if(_0x131da8['isValid']){rpcDb[_0x0a9e('0x101')](_[_0x0a9e('0x46')](_0x3f507c[0x0],[_0x0a9e('0x48'),_0x0a9e('0xe9')]))[_0x0a9e('0x56')](function(_0x3c6082){_0x241404[_0x0a9e('0xe7')](_0x3c6082,_0x3f507c[0x0],_0x3de77e,_0x5d6a48,_0x8120e)['then'](function(_0x311288){return _0x311288;})[_0x0a9e('0x5e')](function(_0x231826){throw _0x231826;});})['catch'](function(_0x2b8ad4){ut[_0x0a9e('0x32')](_0x0a9e('0x102'),_0x2b8ad4);throw ut[_0x0a9e('0x4b')]('Call\x20unsuccessful',_0x5d6a48,_0x8120e);});}else{throw ut[_0x0a9e('0x4b')](_0x131da8[_0x0a9e('0x4b')],_0x5d6a48,_0x8120e);}})[_0x0a9e('0x5e')](function(_0x93d953){ut[_0x0a9e('0x32')](_0x0a9e('0x103'),_0x93d953);throw ut[_0x0a9e('0x4b')](_0x0a9e('0x104'),![],!![]);});};Preview['prototype'][_0x0a9e('0x100')]=function(_0x266aa1){if(_[_0x0a9e('0x41')](_0x266aa1)||_[_0x0a9e('0xec')](_0x266aa1)||!_['isNil'](_0x266aa1[0x0]['Agent'])&&_[_0x0a9e('0x41')](_0x266aa1[0x0][_0x0a9e('0x5a')][_0x0a9e('0x29')])){ut['logger'](_0x0a9e('0x105'),_0x266aa1);return{'isValid':![],'message':_0x0a9e('0x106')};}var _0x4d8a67=this[_0x0a9e('0x10')][_0x266aa1[0x0]['Queue'][_0x0a9e('0x29')]];_0x4d8a67['message']=utils['CAMPAIGN_STATUS']['ACTIVE'];if(_[_0x0a9e('0x41')](_0x4d8a67)){ut[_0x0a9e('0x32')](_0x0a9e('0x107'),_0x4d8a67);return{'isValid':![],'message':_0x0a9e('0x108')};}if(!this[_0x0a9e('0x70')](_0x4d8a67[_0x0a9e('0x109')])){ut['logger'](_0x0a9e('0x10a'),_0x0a9e('0x10b')+_0x4d8a67[_0x0a9e('0x29')]+_0x0a9e('0x10c'));if(!this[_0x0a9e('0x70')](_0x4d8a67[_0x0a9e('0x10d')])){ut[_0x0a9e('0x32')]('[Preview][validateContact][Trunk\x20not\x20working\x20correctly]',_0x4d8a67['name']+_0x0a9e('0x10e'));return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}}if(!ut[_0x0a9e('0x6f')](_0x4d8a67[_0x0a9e('0x3c')])){ut[_0x0a9e('0x32')](_0x0a9e('0x10f'),_0x4d8a67[_0x0a9e('0x29')]+_0x0a9e('0x110'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x4d8a67[_0x0a9e('0x29')]+'\x20Not\x20Active'};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview[_0x0a9e('0xd')]['execCall']=function(_0x38dceb,_0x5dc978,_0x550cbf,_0x26223f){var _0x4a7a3c=this;return new Promise(function(_0x24470a,_0x142e53){var _0xe1ab0d=_0x38dceb['uniqueid'];var _0x4152cd=_0x4a7a3c[_0x0a9e('0x70')](_0x5dc978[_0x0a9e('0x109')])?util['format']('SIP/%s/%s%s',_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x29')],_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x111')])?'':_0x5dc978[_0x0a9e('0x111')][_0x0a9e('0x112')]()||'',_0x5dc978[_0x0a9e('0x113')]>0x0?_0x550cbf[_0x0a9e('0xe9')][_0x0a9e('0x114')](_0x5dc978[_0x0a9e('0x113')]):_0x550cbf['phone']):util['format']('SIP/%s/%s%s',_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x10d')])?_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x29')]:_0x5dc978[_0x0a9e('0x10d')][_0x0a9e('0x29')],_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x111')])?'':_0x5dc978['dialPrefix']['trim']()||'',_0x5dc978[_0x0a9e('0x113')]>0x0?_0x550cbf[_0x0a9e('0xe9')]['substring'](_0x5dc978[_0x0a9e('0x113')]):_0x550cbf[_0x0a9e('0xe9')]);var _0x2e2280=_0x4a7a3c[_0x0a9e('0x70')](_0x5dc978[_0x0a9e('0x109')])?ut[_0x0a9e('0x115')](_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x116')],_0x5dc978[_0x0a9e('0x117')],_0x5dc978[_0x0a9e('0x118')]>0x0?ut[_0x0a9e('0x119')](_0x5dc978[_0x0a9e('0x11a')],_0x5dc978['dialRandomLastDigitCallerIdNumber']):_0x5dc978[_0x0a9e('0x11a')]):ut[_0x0a9e('0x115')](_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x10d')])?_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x116')]:_0x5dc978[_0x0a9e('0x10d')][_0x0a9e('0x116')],_0x5dc978[_0x0a9e('0x117')],_0x5dc978[_0x0a9e('0x118')]>0x0?ut[_0x0a9e('0x119')](_0x5dc978[_0x0a9e('0x11a')],_0x5dc978['dialRandomLastDigitCallerIdNumber']):_0x5dc978['dialOriginateCallerIdNumber']);if(_0x2e2280){_0x38dceb[_0x0a9e('0x11b')]=ut[_0x0a9e('0x11c')](_0x2e2280);_0x38dceb[_0x0a9e('0x11d')]=ut[_0x0a9e('0x11e')](_0x2e2280);}var _0x33359a=ut[_0x0a9e('0x11f')](_0x5dc978,_0x550cbf,_0x4152cd,_0x2e2280,_0xe1ab0d,_0x38dceb);var _0xa8b5de=utils['setXMDContactVariables'](_0x550cbf[_0x0a9e('0xe8')]);Object['assign'](_0x33359a,_0xa8b5de);_[_0x0a9e('0x120')](_0x38dceb,ut[_0x0a9e('0x121')](_0x33359a));_0x38dceb[_0x0a9e('0x61')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));_0x5dc978[_0x0a9e('0x122')]=_0x33359a;var _0x465003=ut[_0x0a9e('0x123')](_0x38dceb,_0x5dc978,_0x33359a,_0x38dceb[_0x0a9e('0x83')],_0x26223f);return ami[_0x0a9e('0x124')](_0x465003)[_0x0a9e('0x56')](function(_0x8231e5){_0x5dc978[_0x0a9e('0x2d')]+=0x1;logger[_0x0a9e('0x26')](_0x0a9e('0x125'),_0xe1ab0d,_0x0a9e('0x9e'),_0x5dc978['name'],'originated:\x20',_0x5dc978[_0x0a9e('0x2d')]);_0x24470a(_0x8231e5);})[_0x0a9e('0x5e')](function(_0x52b365){ut['logAgent'](_0x38dceb,0xe,_0x0a9e('0x126'));rpcDb[_0x0a9e('0xdc')](_0x38dceb,_0x0a9e('0x127'));_0x142e53(_0x52b365);});});};Preview['prototype'][_0x0a9e('0x1d')]=function(_0x5b6447){if(this[_0x0a9e('0x13')][_0x5b6447['linkedid']]){this[_0x0a9e('0x13')][_0x5b6447['linkedid']][_0x0a9e('0x4a')]=_0x5b6447[_0x0a9e('0x4a')];}};Preview[_0x0a9e('0xd')]['syncOriginateResponse']=function(_0x316b51){var _0x497fda=this;var _0x505ffd=this[_0x0a9e('0x13')][_0x316b51[_0x0a9e('0x128')]];if(_0x505ffd){if(_0x505ffd[_0x0a9e('0xeb')]&&this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]]){ut[_0x0a9e('0x129')](_0x505ffd,this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]][_0x0a9e('0x29')],this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]]['id']);}var _0x98bf26=_[_0x0a9e('0x12a')](_0x505ffd);_0x98bf26[_0x0a9e('0x12b')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));var _0x310026=_0x497fda[_0x0a9e('0x10')][_0x505ffd[_0x0a9e('0x43')]];if(ut['isFailure'](_0x316b51[_0x0a9e('0x12c')])){if(_0x505ffd[_0x0a9e('0xaa')]){rpcDb[_0x0a9e('0xfe')](_0x505ffd[_0x0a9e('0x85')]);}if(_0x505ffd['activeContact']){rpcDb['disableContact'](_0x505ffd['idContact']);}ami[_0x0a9e('0x25')]('custom:agentringnoanswer',ut[_0x0a9e('0x78')](_0x505ffd,_0x0a9e('0x12d'),this[_0x0a9e('0x10')][_0x505ffd[_0x0a9e('0x43')]]));this[_0x0a9e('0xd5')](_0x98bf26,_0x310026,_0x316b51);}else{_0x505ffd[_0x0a9e('0x61')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));ut[_0x0a9e('0xd9')](_0x98bf26,0x4,_0x0a9e('0x12e'));rpcDb['createAgentHistory'](_0x98bf26,_0x0a9e('0x12f'));}}};Preview['prototype'][_0x0a9e('0x1a')]=function(_0x586d2f){var _0xf4de86=this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]];var _0x556bb7;if(_0xf4de86){_0x556bb7=this[_0x0a9e('0x10')][_0xf4de86[_0x0a9e('0x43')]];logger['info']('[syncHangup][talking]',_0x586d2f[_0x0a9e('0x84')],_0x0a9e('0x9e'),_0x556bb7[_0x0a9e('0x29')],'pTalking:\x20',_0x556bb7['pTalking']);}if(this['actions'][_0x586d2f[_0x0a9e('0x84')]]&&_0x586d2f[_0x0a9e('0x84')]!==_0x586d2f[_0x0a9e('0x91')]){if(_0x586d2f[_0x0a9e('0x130')]==='16'&&this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]][_0x0a9e('0x4d')]){this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}else if(this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]][_0x0a9e('0x4d')]){logger[_0x0a9e('0x26')](_0x0a9e('0x131'),_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7['name'],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}}else if(_0xf4de86&&_[_0x0a9e('0x41')](_0xf4de86['statedesc'])&&_0x556bb7[_0x0a9e('0x132')]&&_0x586d2f[_0x0a9e('0x84')]===_0x586d2f[_0x0a9e('0x91')]&&_[_0x0a9e('0x41')](_0x586d2f[_0x0a9e('0xd8')])&&_0x586d2f[_0x0a9e('0x130')]==='16'&&_0x586d2f[_0x0a9e('0x133')]==='6'&&_[_0x0a9e('0xd7')](_0xf4de86[_0x0a9e('0x134')])){if(_0xf4de86['unlockAgent']){rpcDb['unlockContact'](_0xf4de86[_0x0a9e('0x85')]);}if(_0xf4de86[_0x0a9e('0x83')]){rpcDb['disableContact'](_0xf4de86[_0x0a9e('0x85')]);}_0x586d2f[_0x0a9e('0xd8')]='22';this['callProgressDetectingAgent'](_0xf4de86,_0x556bb7,_0x586d2f);}else if(_0xf4de86&&_0xf4de86[_0x0a9e('0x134')]){if(_0x586d2f['cause']==='16'&&this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]]['dialAnswer']){logger[_0x0a9e('0x26')](_0x0a9e('0x135'),_0x586d2f['linkedid'],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7['name'],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}else if(this[_0x0a9e('0x13')][_0x586d2f['linkedid']][_0x0a9e('0x4d')]){logger[_0x0a9e('0x26')]('[syncHangup][talking][cause]',_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7[_0x0a9e('0x29')],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f['linkedid'],_0x586d2f['cause']);}}};Preview['prototype']['syncDialEnd']=function(_0x5e9817){if(this[_0x0a9e('0x13')][_0x5e9817[_0x0a9e('0xd4')]]&&_0x5e9817['destlinkedid']!==_0x5e9817['destuniqueid']){this[_0x0a9e('0x72')](_0x5e9817,_0x5e9817['destlinkedid'],_0x5e9817[_0x0a9e('0xcd')]);}};Preview[_0x0a9e('0xd')][_0x0a9e('0x136')]=function(_0x175c97){if(this[_0x0a9e('0x13')][_0x175c97[_0x0a9e('0x84')]]&&_0x175c97['linkedid']!==_0x175c97[_0x0a9e('0x91')]&&!this[_0x0a9e('0x13')][_0x175c97['linkedid']][_0x0a9e('0x4d')]){if(_0x175c97[_0x0a9e('0x130')]==='1'){this[_0x0a9e('0x72')](_0x175c97,_0x175c97[_0x0a9e('0x84')],_0x175c97[_0x0a9e('0x130')]);}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x137')]=function(_0x4a36df,_0x331216,_0x508395){if(this[_0x0a9e('0x13')][_0x4a36df]){if(_[_0x0a9e('0x41')](this['actions'][_0x4a36df][_0x0a9e('0x122')])){this[_0x0a9e('0x13')][_0x4a36df]['variables']={};}this[_0x0a9e('0x13')][_0x4a36df]['variables'][_0x331216]=_0x508395;}};Preview[_0x0a9e('0xd')][_0x0a9e('0x1f')]=function(_0x5d0620){try{if(!_[_0x0a9e('0x41')](_0x5d0620)){if(ut['filterKey'](_[_0x0a9e('0x138')](_0x5d0620[_0x0a9e('0x139')])[0x0])){this[_0x0a9e('0x137')](_0x5d0620[_0x0a9e('0x91')],_[_0x0a9e('0x138')](_0x5d0620[_0x0a9e('0x139')])[0x0],_0x5d0620[_0x0a9e('0x13a')]);}}}catch(_0x53b5c2){logger[_0x0a9e('0x13b')](_0x0a9e('0x13c'),util[_0x0a9e('0x13d')](_0x53b5c2,{'showHidden':![],'depth':null}));}};Preview[_0x0a9e('0xd')][_0x0a9e('0x21')]=function(_0x5932ad){if(_0x5932ad){if(this[_0x0a9e('0x13')][_0x5932ad['transfertargetlinkedid']]){this['actions'][_0x5932ad[_0x0a9e('0x13e')]]['transfer']=!![];}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x23')]=function(_0x58d5fd){if(_0x58d5fd){if(this[_0x0a9e('0x13')][_0x58d5fd[_0x0a9e('0x13f')]]){this[_0x0a9e('0x13')][_0x58d5fd[_0x0a9e('0x13f')]][_0x0a9e('0x134')]=!![];}}};module[_0x0a9e('0x140')]=Preview; \ No newline at end of file +var _0xa9e0=['varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','emit','info','format','voice:queue:%s','name','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','originated','pTalking','available','CAMPAIGN_STATUS','INACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','\x20is\x20deactivated','syncCampaigns','hasOwnProperty','dialMethod','booked','type','outbound','dialActive','setMessage','recallMe','clearZombieChannel','sequence','isNil','Queue','queue','originated:\x20','stringify','pick','UserId','VoiceQueueId','ListId','channel','message','No\x20such\x20channel','dialAnswer','decrementTalkink','[clearZombieChannel]','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','clearZombieChannels','size','getContactRecallMe','then','length','getDiff','scheduledat','Agent','voicePause','run','[RecallMe]','catch','logger2','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[getContactRecallMe]','IsNotLoggedIn','NO_AGENTS_LOGGED','isActive','isTrunkReachable','UNREACHABLE_TRUNK','callProgressDetectingCustomer','outboundNoSuchCallsDay','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','additional','dialNoSuchNumberRetryFrequency','cloneAction','createCustomerFinal','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','scheduledAt','activeContact','linkedid','idContact','incrementPreviewCounters','ANSWER','answertime','[syncHangup][talking][increment]','pTalking:\x20','custom:agentconnect','connect','acw','mandatoryDisposition','custom:agentConnectPreview','channelAgent','uniqueid','custom:agentcomplete','complete','outboundAnswerCallsDay','answered','[16]','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','sumDuration','talktime','sumBillable','[syncHangup][talking][decrement]','\x20Queue','outboundBusyCallsDay','countbusyretry','Busy','dialBusyRetryFrequency','callAdditionalPhoneAfterMin','busy','[callProgressDetectingCustomer][logBusy]','dialGlobalMaxRetry','Global','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','unlockAgent','NOANSWER','countnoanswerretry','dialNoAnswerRetryFrequency','buildNoAnswerEventPayload','custom:agentnoanswer','dialNoAnswerMaxRetry','[callProgressDetectingCustomer][logNoAnswer]','outboundCongestionCallsDay','countcongestionretry','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','[callProgressDetectingCustomer][logCongestion]','swapAdditionalPhones','CANCEL','outboundRejectCallsDay','countagentrejectretry','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedMaxRety','countmachineretry','cause-txt','custom:amd','[callProgressDetectingCustomer][hangupInAMD]','outboundUnknownCallsDay','dialstatus','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknownGlobal]','updateOriginated','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','object','isUndefined','reason','logAgent','[callProgressDetectingAgent][logNoSuch]','NoAnswer','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','resolve','checkInBlack','Contact','phone','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','[Preview][execCall][success]','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','logBlacklist','[Blacklist][error]','Contact\x20in\x20black\x20List','active','SIP/%s','status','reachable','unmonitored','execRun','unlock','unlockContact','recallme','validateContact','checkIsBlackList','[Preview][checkIsBlackList]','[Preview][getContactPreview]','Call\x20unsuccessful','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','Trunk','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','TrunkBackup','\x20Trunk\x20Backup\x20is\x20not\x20active','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','dialPrefix','trim','dialCutDigit','substring','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','merge','toLowerVariables','variables','variablesAction','Action','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','actionid','logLookAgent','clone','responsetime','response','rejected','Answer','[callProgressDetectingAgent][logAnswer]','cause','[syncHangup][talking][cause]','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','syncHangupRequest','addVariable','keys','variable','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','uuid','../../../config/environment','preview','../../../config/logger','actionPreview','../ami','./rpcDb','./action','./util/util','../dialer/utils','redis','prototype','enqueue','tail','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','syncDialEnd','syncNewExten'];(function(_0x238251,_0x4e6638){var _0x4c9ee6=function(_0x278510){while(--_0x278510){_0x238251['push'](_0x238251['shift']());}};_0x4c9ee6(++_0x4e6638);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0xa9e0[_0x4fc9e6];return _0x551d28;};'use strict';var util=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var uuid=require(_0x0a9e('0x2'));var moment=require('moment');var Redis=require('ioredis');var config=require(_0x0a9e('0x3'));var logger=require('../../../config/logger')(_0x0a9e('0x4'));var loggerAction=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var ami=require(_0x0a9e('0x7'));var rpcDb=require(_0x0a9e('0x8'));var cmHopperAdditionalPhone=require('../rpc/cmHopperAdditionalPhone');var Action=require(_0x0a9e('0x9'));var ut=require(_0x0a9e('0xa'));var utils=require(_0x0a9e('0xb'));config['redis']=_['defaults'](config[_0x0a9e('0xc')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0a9e('0xc')]));var Sequence=function(){};Sequence[_0x0a9e('0xd')][_0x0a9e('0xe')]=function(_0x3ab53f){this[_0x0a9e('0xf')]=this[_0x0a9e('0xf')]?this['tail']['finally'](_0x3ab53f):_0x3ab53f();};function Preview(_0x527cdd){this['sequence']=new Sequence();this[_0x0a9e('0x10')]=_0x527cdd[_0x0a9e('0x11')];this[_0x0a9e('0x12')]=_0x527cdd[_0x0a9e('0x12')];this[_0x0a9e('0x13')]={};this[_0x0a9e('0x14')]=_0x527cdd['agents'];this[_0x0a9e('0x15')]=0x0;ami['on'](_0x0a9e('0x16'),this[_0x0a9e('0x17')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x19'),this[_0x0a9e('0x1a')]['bind'](this));ami['on'](_0x0a9e('0x1b'),this['syncHangupRequest'][_0x0a9e('0x18')](this));ami['on']('dialend',this[_0x0a9e('0x1c')][_0x0a9e('0x18')](this));ami['on']('newexten',this[_0x0a9e('0x1d')]['bind'](this));ami['on'](_0x0a9e('0x1e'),this[_0x0a9e('0x1f')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x20'),this[_0x0a9e('0x21')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x22'),this[_0x0a9e('0x23')][_0x0a9e('0x18')](this));this[_0x0a9e('0x24')](this[_0x0a9e('0x10')]);}function emit(_0x105080,_0x4bb1e3,_0x2c3407){io['to'](_0x105080)[_0x0a9e('0x25')](_0x4bb1e3,_0x2c3407);}function emitVoiceQueueChannelRemove(_0x53682f){logger[_0x0a9e('0x26')]('[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event',JSON['stringify'](_0x53682f));emit(util[_0x0a9e('0x27')](_0x0a9e('0x28'),_0x53682f[_0x0a9e('0x29')]),_0x0a9e('0x2a'),_0x53682f);io['emit'](_0x0a9e('0x2b'),_0x53682f);}function notSendMessagesQueue(_0x2fb0e4){if(_0x2fb0e4[_0x0a9e('0x2c')]){if(_0x2fb0e4[_0x0a9e('0x2d')]===0x0&&_0x2fb0e4[_0x0a9e('0x2e')]===0x0){_0x2fb0e4[_0x0a9e('0x2c')]=![];_0x2fb0e4[_0x0a9e('0x2f')]=0x0;_0x2fb0e4['paused']=0x0;_0x2fb0e4['message']=utils[_0x0a9e('0x30')][_0x0a9e('0x31')];ut[_0x0a9e('0x32')](_0x0a9e('0x33'),_0x2fb0e4['name']+_0x0a9e('0x34'));}else{_0x2fb0e4['message']=utils[_0x0a9e('0x30')]['DEACTIVATED'];ut[_0x0a9e('0x32')](_0x0a9e('0x33'),_0x2fb0e4[_0x0a9e('0x29')]+_0x0a9e('0x35'));}}}Preview[_0x0a9e('0xd')][_0x0a9e('0x24')]=function(){var _0x11c3b6=this;setInterval(function(){_0x11c3b6[_0x0a9e('0x36')]();},0x7cf);};Preview['prototype'][_0x0a9e('0x36')]=function(){var _0x468813=this[_0x0a9e('0x10')];this[_0x0a9e('0x15')]+=0x1;for(var _0x5c877d in _0x468813){if(_0x468813[_0x0a9e('0x37')](_0x5c877d)&&(_0x468813[_0x5c877d][_0x0a9e('0x38')]===_0x0a9e('0x4')||_0x468813[_0x5c877d][_0x0a9e('0x38')]===_0x0a9e('0x39'))&&_0x468813[_0x5c877d][_0x0a9e('0x3a')]===_0x0a9e('0x3b')){if(this[_0x0a9e('0x15')]>0x7){this[_0x0a9e('0x15')]=0x0;this['clearZombieChannels']();}}if(_0x468813[_0x0a9e('0x37')](_0x5c877d)&&_0x468813[_0x5c877d]['dialMethod']===_0x0a9e('0x4')&&_0x468813[_0x5c877d][_0x0a9e('0x3a')]===_0x0a9e('0x3b')){if(_0x468813[_0x5c877d][_0x0a9e('0x3c')]){this[_0x0a9e('0x3d')](_0x468813[_0x5c877d]);if(_0x468813[_0x5c877d]['dialPreviewAutoRecallMe'])this[_0x0a9e('0x3e')](_0x468813[_0x5c877d]);}else{notSendMessagesQueue(_0x468813[_0x5c877d]);}}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x3f')]=function(_0x2da5c0){var _0x2b45ea=this;this[_0x0a9e('0x40')][_0x0a9e('0xe')](function(){if(!_[_0x0a9e('0x41')](_0x2b45ea['actions'][_0x2da5c0])){loggerAction[_0x0a9e('0x26')]('[clearZombieChannels][talking]',_0x2da5c0,_0x0a9e('0x42'),_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')],_0x0a9e('0x44'),JSON['stringify'](_0x2b45ea[_0x0a9e('0x10')][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]][_0x0a9e('0x2d')]),'pTalking:\x20',JSON['stringify'](_0x2b45ea[_0x0a9e('0x10')][_0x2b45ea['actions'][_0x2da5c0][_0x0a9e('0x43')]][_0x0a9e('0x2e')]),JSON[_0x0a9e('0x45')](_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0]['dialAnswer']),JSON[_0x0a9e('0x45')](_[_0x0a9e('0x46')](_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0],['contactId',_0x0a9e('0x47'),_0x0a9e('0x48'),_0x0a9e('0x49')])));return ami['Action']({'action':'status','channel':_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x4a')]})['catch'](function(_0x2b814e){if(_0x2b814e[_0x0a9e('0x4b')]===_0x0a9e('0x4c')){setTimeout(function(){if(_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0]){ut['updateOriginated'](_0x2b45ea['campaignsPreview'][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]],'[clearZombieChannel]');if(_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x4d')]===!![]){ut[_0x0a9e('0x4e')](_0x2b45ea['campaignsPreview'][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]],_0x0a9e('0x4f'));ut[_0x0a9e('0x50')](_0x0a9e('0x51')+_0x2da5c0,_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]);}ut[_0x0a9e('0x50')](_0x0a9e('0x52')+_0x2da5c0,_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]);delete _0x2b45ea[_0x0a9e('0x13')][_0x2da5c0];}},0x2328);}});}});};Preview[_0x0a9e('0xd')][_0x0a9e('0x53')]=function(){var _0x37f6cc=this;loggerAction['info']('[action]',_[_0x0a9e('0x54')](this[_0x0a9e('0x13')]));for(var _0x405c8f in this[_0x0a9e('0x13')]){if(_0x37f6cc[_0x0a9e('0x13')][_0x0a9e('0x37')](_0x405c8f)){_0x37f6cc[_0x0a9e('0x3f')](_0x405c8f);}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x3e')]=function(_0x25c6e6){var _0x2c2cb0=this;rpcDb[_0x0a9e('0x55')](_0x25c6e6['id'],ut['agentReadyId'](this[_0x0a9e('0x14')]))[_0x0a9e('0x56')](function(_0xdd268f){if(!_[_0x0a9e('0x41')](_0xdd268f)){for(var _0x2e8caf=0x0;_0x2e8caf<_0xdd268f[_0x0a9e('0x57')];_0x2e8caf+=0x1){if(ut[_0x0a9e('0x58')](_0xdd268f[_0x2e8caf][_0x0a9e('0x59')])<_0x25c6e6['dialRecallMeTimeout']*0x3c){if(_0xdd268f[_0x2e8caf][_0x0a9e('0x5a')]&&!_0xdd268f[_0x2e8caf]['Agent'][_0x0a9e('0x5b')]){_0x2c2cb0[_0x0a9e('0x5c')](_0xdd268f[_0x2e8caf]['id'])[_0x0a9e('0x56')](ut['logger2'](_0x0a9e('0x5d')))[_0x0a9e('0x5e')](ut[_0x0a9e('0x5f')](_0x0a9e('0x5d')));}else{rpcDb[_0x0a9e('0x60')](_0xdd268f[_0x2e8caf]['id']);}}else{var _0x37be73=new Action(_0xdd268f[_0x2e8caf],_0x25c6e6);_0x37be73[_0x0a9e('0x61')]=moment()['format'](_0x0a9e('0x62'));_0x25c6e6[_0x0a9e('0x63')]+=0x1;ut[_0x0a9e('0x64')](_0x37be73,0x17,_0x0a9e('0x65'));if(_0x25c6e6[_0x0a9e('0x66')]){rpcDb[_0x0a9e('0x67')](ut[_0x0a9e('0x68')](_0xdd268f[_0x2e8caf]));rpcDb[_0x0a9e('0x69')](_0x37be73,_0x0a9e('0x6a'));}else{ut['logCustomer'](_0x37be73,0x16,_0x0a9e('0x6b'));rpcDb[_0x0a9e('0x69')](_0x37be73,'[HistoryRecallClose]');rpcDb['createCustomerFinal'](_0x37be73,'[HistoryRecallClose]');}}}}})[_0x0a9e('0x5e')](ut[_0x0a9e('0x5f')](_0x0a9e('0x6c')));};Preview[_0x0a9e('0xd')][_0x0a9e('0x3d')]=function(_0x30decb){_0x30decb[_0x0a9e('0x2c')]=!![];if(ut[_0x0a9e('0x6d')](_0x30decb['loggedIn'])){_0x30decb['message']=utils['CAMPAIGN_STATUS'][_0x0a9e('0x6e')];}else if(!ut[_0x0a9e('0x6f')](_0x30decb[_0x0a9e('0x3c')])){_0x30decb['message']=utils[_0x0a9e('0x30')][_0x0a9e('0x31')];}else if(!this['isTrunkReachable'](_0x30decb['Trunk'])){if(!this[_0x0a9e('0x70')](_0x30decb['TrunkBackup'])){_0x30decb[_0x0a9e('0x4b')]=utils['CAMPAIGN_STATUS'][_0x0a9e('0x71')];}else{_0x30decb[_0x0a9e('0x4b')]=utils[_0x0a9e('0x30')]['ACTIVE'];}}else{_0x30decb[_0x0a9e('0x4b')]=utils[_0x0a9e('0x30')]['ACTIVE'];}};Preview['prototype'][_0x0a9e('0x72')]=function(_0x3aedd0,_0x49c095,_0x145931){var _0x5ce9ac=this;var _0x211ef9=this['actions'][_0x49c095];var _0xe22ccc=this['campaignsPreview'][_0x211ef9['queue']];var _0x5df0ad;var _0x2da03c=![];var _0x47de4c=0x2;var _0x2f7092=0x3;if(_0xe22ccc){switch(_0x145931){case'1':_0xe22ccc[_0x0a9e('0x73')]+=0x1;_0x211ef9[_0x0a9e('0x74')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x0,_0x0a9e('0x77'));ami[_0x0a9e('0x25')]('custom:agentnosuchnumber',ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0x79')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0x7a'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'0',_0xe22ccc)[_0x0a9e('0x56')](function(_0x5d86e9){_0x2da03c=_0x5d86e9[_0x0a9e('0x7c')]==0x1;_0x47de4c=_0xe22ccc[_0x0a9e('0x7d')];_0x2f7092=_0xe22ccc['callAdditionalPhoneAfterMin'];if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc['dialGlobalMaxRetry']){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,'Global');rpcDb['createCustomerFinal'](_0x5df0ad,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{if(_0x211ef9[_0x0a9e('0x74')]>=_0xe22ccc['dialNoSuchNumberMaxRetry']){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0x80'));}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,_0x0a9e('0x74'),_0xe22ccc[_0x0a9e('0x7d')]),_0x211ef9['unlockAgent'],_0x211ef9[_0x0a9e('0x83')]);}}delete this['actions'][_0x3aedd0[_0x0a9e('0x84')]];}else{_0x211ef9[_0x0a9e('0x74')]++;logger[_0x0a9e('0x26')]('actioncountonusuch',_0x211ef9[_0x0a9e('0x74')]);logger[_0x0a9e('0x26')]('id',_0x211ef9[_0x0a9e('0x85')]);_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9['idContact'],'field':{'countnosuchnumberretry':_0x211ef9[_0x0a9e('0x74')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0x87'):var _0x88dcbf=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));_0x211ef9['responsetime']=_0x88dcbf;_0x211ef9[_0x0a9e('0x88')]=_0x88dcbf;_0x211ef9[_0x0a9e('0x4d')]=!![];_0xe22ccc[_0x0a9e('0x2e')]+=0x1;logger['info'](_0x0a9e('0x89'),_0x211ef9['uniqueid'],'\x20Queue',_0xe22ccc[_0x0a9e('0x29')],_0x0a9e('0x8a'),_0xe22ccc[_0x0a9e('0x2e')]);ami[_0x0a9e('0x25')](_0x0a9e('0x8b'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0x8c'),this[_0x0a9e('0x10')][_0x211ef9[_0x0a9e('0x43')]]));if(_0xe22ccc[_0x0a9e('0x8d')]||_0xe22ccc[_0x0a9e('0x8e')]){ami[_0x0a9e('0x25')](_0x0a9e('0x8f'),{'queue':_0x211ef9[_0x0a9e('0x43')],'interface':_0x211ef9[_0x0a9e('0x90')],'uniqueid':_0x211ef9[_0x0a9e('0x91')]});}break;case'16':ami[_0x0a9e('0x25')](_0x0a9e('0x92'),ut['buildObj'](_0x211ef9,_0x0a9e('0x93'),this[_0x0a9e('0x10')][_0x211ef9[_0x0a9e('0x43')]]));emitVoiceQueueChannelRemove(ut['buildObj'](_0x211ef9,_0x0a9e('0x93')));_0xe22ccc[_0x0a9e('0x94')]+=0x1;_0xe22ccc['total']+=0x1;_0xe22ccc[_0x0a9e('0x95')]+=0x1;ut[_0x0a9e('0x4e')](_0xe22ccc,_0x0a9e('0x96'));_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x4,'Answer');rpcDb['createCustomerHistory'](_0x211ef9,_0x0a9e('0x97'));rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0x98'));rpcDb[_0x0a9e('0x99')](_0x211ef9);_0xe22ccc[_0x0a9e('0x9a')]+=_0x211ef9[_0x0a9e('0x9b')];_0xe22ccc[_0x0a9e('0x9c')]+=_0x211ef9[_0x0a9e('0x9b')];logger['info'](_0x0a9e('0x9d'),_0x211ef9[_0x0a9e('0x91')],_0x0a9e('0x9e'),_0xe22ccc['name'],_0x0a9e('0x8a'),_0xe22ccc['pTalking']);delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;case'BUSY':_0xe22ccc[_0x0a9e('0x9f')]+=0x1;_0x211ef9[_0x0a9e('0xa0')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x5,_0x0a9e('0xa1'));_0x47de4c=_0xe22ccc[_0x0a9e('0xa2')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami[_0x0a9e('0x25')]('custom:agentbusy',ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xa4')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xa5'));_0x5ce9ac['verifyAdditionalPhones'](_0x211ef9,'5',_0xe22ccc)[_0x0a9e('0x56')](function(_0x3511c9){_0x2da03c=_0x3511c9[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xa8'));}else{if(_0x211ef9[_0x0a9e('0xa0')]>=_0xe22ccc[_0x0a9e('0xa9')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xa5'));}else{rpcDb[_0x0a9e('0x81')](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xa0'),_0xe22ccc[_0x0a9e('0xa2')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xa0')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countbusyretry':_0x211ef9[_0x0a9e('0xa0')]}})['then'](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0xab'):_0xe22ccc['outboundNoAnswerCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xac')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x3,'NoAnswer');_0x47de4c=_0xe22ccc[_0x0a9e('0xad')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];var _0x2d2286=ut[_0x0a9e('0xae')](_0x211ef9,_0xe22ccc);ami[_0x0a9e('0x25')](_0x0a9e('0xaf'),_0x2d2286);rpcDb[_0x0a9e('0x69')](_0x211ef9,'[callProgressDetectingCustomer][logNoAnswer]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'3',_0xe22ccc)[_0x0a9e('0x56')](function(_0x45c109){_0x2da03c=_0x45c109[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,'Global');rpcDb[_0x0a9e('0x7f')](_0x5df0ad,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0x211ef9[_0x0a9e('0xac')]>=_0xe22ccc[_0x0a9e('0xb0')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xb1'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xac'),_0xe22ccc[_0x0a9e('0xad')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9['idContact'],'field':{'countnoanswerretry':_0x211ef9['countnoanswerretry']}})[_0x0a9e('0x56')](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});break;case'CONGESTION':_0xe22ccc[_0x0a9e('0xb2')]+=0x1;_0x211ef9[_0x0a9e('0xb3')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x8,_0x0a9e('0xb4'));_0x47de4c=_0xe22ccc['dialCongestionRetryFrequency'];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami['emit'](_0x0a9e('0xb5'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xb6')));rpcDb[_0x0a9e('0x69')](_0x211ef9,'[callProgressDetectingCustomer][logCongestion]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'8',_0xe22ccc)[_0x0a9e('0x56')](function(_0x1d4877){_0x2da03c=_0x1d4877['additional']==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xb7'));}else{if(_0x211ef9[_0x0a9e('0xb3')]>=_0xe22ccc[_0x0a9e('0xb8')]){rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xb9'));}else{rpcDb[_0x0a9e('0x81')](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xb3'),_0xe22ccc[_0x0a9e('0xa2')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xb3')]++;_0x5ce9ac['incrementPreviewCounters']({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countcongestionretry':_0x211ef9[_0x0a9e('0xb3')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0xbb'):_0xe22ccc[_0x0a9e('0xbc')]+=0x1;_0x211ef9[_0x0a9e('0xbd')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x14,_0x0a9e('0xbe'));_0x47de4c=_0xe22ccc[_0x0a9e('0xbf')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami[_0x0a9e('0x25')](_0x0a9e('0xc0'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xc1')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xc2'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'20',_0xe22ccc)[_0x0a9e('0x56')](function(_0x4989f9){_0x2da03c=_0x4989f9[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0x14,_0x0a9e('0xbe'));rpcDb['createCustomerFinal'](_0x5df0ad,_0x0a9e('0xc3'));}else{if(_0x211ef9[_0x0a9e('0xbd')]>=_0xe22ccc['dialAgentRejectMaxRetry']){rpcDb[_0x0a9e('0x7f')](_0x211ef9,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,_0x0a9e('0xbd'),_0xe22ccc[_0x0a9e('0xbf')]),_0x211ef9['unlockAgent'],_0x211ef9[_0x0a9e('0x83')]);}}}else{_0x211ef9['countnoanswerretry']++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9['countnoanswerretry']}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case'ABANDONED':_0xe22ccc['outboundAbandonedCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xc4')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0xb,_0x0a9e('0xc5'));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xc6'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'11',_0xe22ccc)[_0x0a9e('0x56')](function(_0x586510){_0x2da03c=_0x586510[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xc6'));}else{if(_0x211ef9['countabandonedetry']>=_0xe22ccc[_0x0a9e('0xc7')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xc6'));}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,'countabandonedretry',_0xe22ccc['dialAbandonedRetryFrequency']),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});break;case'18':_0xe22ccc['outboundUnknownCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xc8')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x12,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0['dialstatus']);ami['emit'](_0x0a9e('0xca'),ut[_0x0a9e('0x78')](_0x211ef9,'amd'));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xcb'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'18',_0xe22ccc)[_0x0a9e('0x56')](function(_0x2eb028){_0x2da03c=_0x2eb028['additional']==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0x12,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xcb'));}else{rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xcb'));}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac['incrementPreviewCounters']({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;case'19':_0xe22ccc[_0x0a9e('0xcc')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x13,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0[_0x0a9e('0xcd')]);ami[_0x0a9e('0x25')](_0x0a9e('0xca'),ut[_0x0a9e('0x78')](_0x211ef9,'amd'));rpcDb['createCustomerHistory'](_0x211ef9,_0x0a9e('0xce'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'18',_0xe22ccc)[_0x0a9e('0x56')](function(_0x2fea95){_0x2da03c=_0x2fea95[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb['createCustomerFinal'](_0x5df0ad,_0x0a9e('0xce'));}else{rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xce'));}}else{_0x211ef9['countnoanswerretry']++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})['then'](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;default:if(_0x211ef9[_0x0a9e('0x4d')]){ut[_0x0a9e('0x4e')](_0xe22ccc,_0x0a9e('0xcf'));ut[_0x0a9e('0x50')](_0x0a9e('0xd0')+_0xe22ccc[_0x0a9e('0x29')],_0x3aedd0);}_0xe22ccc[_0x0a9e('0xcc')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0xc,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0[_0x0a9e('0xcd')]);_0x47de4c=_0xe22ccc[_0x0a9e('0xbf')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];rpcDb['createCustomerHistory'](_0x211ef9,'[callProgressDetectingCustomer][logUnknown]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'20',_0xe22ccc)['then'](function(_0x1d999b){_0x2da03c=_0x1d999b[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xd1'));}delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];}else{_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});}});}if(!(_0x211ef9[_0x0a9e('0x4d')]&&_0x145931==='16')){ut[_0x0a9e('0xd2')](_0xe22ccc,'[callProgressDetectingCustomer]');logger[_0x0a9e('0x26')](_0x0a9e('0xd3'),_0x211ef9[_0x0a9e('0x91')],'\x20Queue',_0xe22ccc[_0x0a9e('0x29')],_0x0a9e('0x44'),_0xe22ccc[_0x0a9e('0x2d')]);}if(_0x145931!==_0x0a9e('0x87')){delete this[_0x0a9e('0x13')][_0x3aedd0['linkedid']];delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0xd4')]];}_0xe22ccc['queueSummaryCountersUpdated']=!![];}};Preview[_0x0a9e('0xd')][_0x0a9e('0xd5')]=function(_0x1f6f1c,_0x5822a7,_0x5c3b6f){if(_['isUndefined'](_0x5822a7)&&_0x0a9e('0xd6')!==typeof _0x5822a7){return;}if(_[_0x0a9e('0xd7')](_0x5c3b6f)&&'object'!==typeof _0x5c3b6f){return;}switch(_0x5c3b6f[_0x0a9e('0xd8')]){case'0':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x0,_0x0a9e('0x77'));rpcDb['createAgentHistory'](_0x1f6f1c,_0x0a9e('0xda'));break;case'3':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x3,_0x0a9e('0xdb'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xdd'));break;case'5':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x5,_0x0a9e('0xa1'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xde'));break;case'8':ut['logAgent'](_0x1f6f1c,0x8,_0x0a9e('0xb4'));rpcDb['createAgentHistory'](_0x1f6f1c,_0x0a9e('0xdf'));break;case'22':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x16,_0x0a9e('0xe0'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xe1'));break;default:ut[_0x0a9e('0xd9')](_0x1f6f1c,0xc,_0x5c3b6f['reason']);rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xdf'));}ut[_0x0a9e('0xd2')](_0x5822a7,_0x0a9e('0xe2'));logger['info'](_0x0a9e('0xe3'),_0x1f6f1c[_0x0a9e('0x91')],_0x0a9e('0x9e'),_0x5822a7[_0x0a9e('0x29')],_0x0a9e('0x44'),_0x5822a7[_0x0a9e('0x2d')]);delete this[_0x0a9e('0x13')][_0x1f6f1c[_0x0a9e('0x91')]];};Preview[_0x0a9e('0xd')][_0x0a9e('0x7b')]=function(_0x57f0ad,_0x2272bc,_0x88b25f){return cmHopperAdditionalPhone[_0x0a9e('0x7b')](_0x57f0ad,_0x2272bc,_0x88b25f)[_0x0a9e('0x5e')](logger[_0x0a9e('0x26')](_0x0a9e('0xe4')));};Preview[_0x0a9e('0xd')][_0x0a9e('0xba')]=function(_0x566b90,_0x3b581c,_0xd2391){return cmHopperAdditionalPhone[_0x0a9e('0xba')](_0x566b90,_0x3b581c,_0xd2391)['catch'](logger[_0x0a9e('0x26')](_0x0a9e('0xe5')));};Preview[_0x0a9e('0xd')][_0x0a9e('0x86')]=function(_0x370b5e){return Promise[_0x0a9e('0xe6')]()[_0x0a9e('0x56')](cmHopperAdditionalPhone[_0x0a9e('0x86')](_0x370b5e))[_0x0a9e('0x5e')](logger[_0x0a9e('0x26')]('[incrementPreviewCounters]\x20'));};Preview[_0x0a9e('0xd')][_0x0a9e('0xe7')]=function(_0x15a9ed,_0x3db98f,_0x2b624e,_0x3942fd,_0x5cb48d){var _0x382687=this;return new Promise(function(_0x4f854b,_0x5bd139){if(_['isNil'](_0x3db98f)||_[_0x0a9e('0x41')](_0x3db98f[_0x0a9e('0xe8')])||_[_0x0a9e('0x41')](_0x3db98f[_0x0a9e('0xe9')])||_['isNil'](_0x3db98f[_0x0a9e('0x48')])){_0x5bd139(ut[_0x0a9e('0x4b')](_0x0a9e('0xea'),_0x3942fd,_0x5cb48d));return;}var _0x1fdb10=uuid['v4']();var _0x2c8d1d=_0x382687['campaignsPreview'][_0x3db98f['Queue'][_0x0a9e('0x29')]];var _0x33bcb2=_0x2b624e?_0x382687[_0x0a9e('0x14')][_0x2b624e]['id']:undefined;_0x382687['actions'][_0x1fdb10]=new Action(_0x3db98f,_0x2c8d1d,_0x1fdb10,_0x2b624e,_0x33bcb2);var _0x319752=_0x382687[_0x0a9e('0x13')][_0x1fdb10];_0x319752[_0x0a9e('0xaa')]=_0x3942fd;_0x319752['activeContact']=_0x5cb48d;_0x319752[_0x0a9e('0xeb')]=_0x2b624e;if(_[_0x0a9e('0xec')](_0x15a9ed)){_0x382687[_0x0a9e('0xed')](_0x319752,_0x2c8d1d,_0x3db98f,_0x2b624e)['then'](function(_0x272291){logger[_0x0a9e('0x26')](_0x0a9e('0xee'),'Queue:\x20'+_0x319752['queue']+'\x20IdHopper:\x20'+_0x319752[_0x0a9e('0x85')],JSON[_0x0a9e('0x45')](_0x272291));ami[_0x0a9e('0x25')](_0x0a9e('0xef'),ut['buildObj'](_0x319752,_0x0a9e('0xf0'),_0x382687['campaignsPreview'][_0x319752[_0x0a9e('0x43')]]));_0x4f854b(ut[_0x0a9e('0x4b')](_0x0a9e('0xf1')));})['catch'](function(_0x33b4b3){ut[_0x0a9e('0x32')](_0x0a9e('0xf2'),_0x33b4b3);_0x5bd139(ut['message'](_0x0a9e('0xf3'),_0x3942fd,_0x5cb48d));});}else{_0x2c8d1d['outboundBlacklistCallsDay']+=0x1;ut[_0x0a9e('0xf4')](_0x319752);rpcDb['createHistory'](_0x319752,_0x0a9e('0xf5'));delete _0x382687['actions'][_0x1fdb10];_0x5bd139(ut[_0x0a9e('0x4b')](_0x0a9e('0xf6'),_0x3942fd,_0x5cb48d));}});};Preview[_0x0a9e('0xd')][_0x0a9e('0x70')]=function(_0x1e306c){return!_[_0x0a9e('0x41')](_0x1e306c)&&!_[_0x0a9e('0x41')](_0x1e306c['name'])&&!_[_0x0a9e('0x41')](_0x1e306c[_0x0a9e('0xf7')])&&_0x1e306c['active']&&!_[_0x0a9e('0x41')](this[_0x0a9e('0x12')][util['format'](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])])&&!_[_0x0a9e('0x41')](this['trunks'][util[_0x0a9e('0x27')](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')])&&(this[_0x0a9e('0x12')][util[_0x0a9e('0x27')](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')]===_0x0a9e('0xfa')||this['trunks'][util[_0x0a9e('0x27')]('SIP/%s',_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')]===_0x0a9e('0xfb'));};Preview[_0x0a9e('0xd')][_0x0a9e('0x5c')]=function(_0x2d45db,_0x5691ac){return this[_0x0a9e('0xfc')](_0x2d45db,_0x5691ac)[_0x0a9e('0x56')](function(_0x2977a7){return _['pick'](_0x2977a7,[_0x0a9e('0x4b')]);})[_0x0a9e('0x5e')](function(_0x4435d2){if(_0x4435d2[_0x0a9e('0xfd')]){rpcDb[_0x0a9e('0xfe')](_0x2d45db);}if(_0x4435d2[_0x0a9e('0xf7')]){rpcDb[_0x0a9e('0x60')](_0x2d45db);}throw _['pick'](_0x4435d2,[_0x0a9e('0x4b')]);});};Preview[_0x0a9e('0xd')][_0x0a9e('0xfc')]=function(_0x2ce3be,_0x3de77e){var _0x241404=this;var _0x8120e,_0x5d6a48;return rpcDb['getContactPreview'](_0x2ce3be)[_0x0a9e('0x56')](function(_0x3f507c){if(!_[_0x0a9e('0x41')](_0x3f507c[0x0])){_0x5d6a48=_0x3f507c[0x0][_0x0a9e('0xff')]?![]:!![];_0x8120e=_0x3f507c[0x0][_0x0a9e('0xff')]?!![]:![];_0x8120e=_0x3de77e?!![]:_0x8120e;}var _0x131da8=_0x241404[_0x0a9e('0x100')](_0x3f507c);if(_0x131da8['isValid']){rpcDb[_0x0a9e('0x101')](_[_0x0a9e('0x46')](_0x3f507c[0x0],[_0x0a9e('0x48'),_0x0a9e('0xe9')]))[_0x0a9e('0x56')](function(_0x3c6082){_0x241404[_0x0a9e('0xe7')](_0x3c6082,_0x3f507c[0x0],_0x3de77e,_0x5d6a48,_0x8120e)['then'](function(_0x311288){return _0x311288;})[_0x0a9e('0x5e')](function(_0x231826){throw _0x231826;});})['catch'](function(_0x2b8ad4){ut[_0x0a9e('0x32')](_0x0a9e('0x102'),_0x2b8ad4);throw ut[_0x0a9e('0x4b')]('Call\x20unsuccessful',_0x5d6a48,_0x8120e);});}else{throw ut[_0x0a9e('0x4b')](_0x131da8[_0x0a9e('0x4b')],_0x5d6a48,_0x8120e);}})[_0x0a9e('0x5e')](function(_0x93d953){ut[_0x0a9e('0x32')](_0x0a9e('0x103'),_0x93d953);throw ut[_0x0a9e('0x4b')](_0x0a9e('0x104'),![],!![]);});};Preview['prototype'][_0x0a9e('0x100')]=function(_0x266aa1){if(_[_0x0a9e('0x41')](_0x266aa1)||_[_0x0a9e('0xec')](_0x266aa1)||!_['isNil'](_0x266aa1[0x0]['Agent'])&&_[_0x0a9e('0x41')](_0x266aa1[0x0][_0x0a9e('0x5a')][_0x0a9e('0x29')])){ut['logger'](_0x0a9e('0x105'),_0x266aa1);return{'isValid':![],'message':_0x0a9e('0x106')};}var _0x4d8a67=this[_0x0a9e('0x10')][_0x266aa1[0x0]['Queue'][_0x0a9e('0x29')]];_0x4d8a67['message']=utils['CAMPAIGN_STATUS']['ACTIVE'];if(_[_0x0a9e('0x41')](_0x4d8a67)){ut[_0x0a9e('0x32')](_0x0a9e('0x107'),_0x4d8a67);return{'isValid':![],'message':_0x0a9e('0x108')};}if(!this[_0x0a9e('0x70')](_0x4d8a67[_0x0a9e('0x109')])){ut['logger'](_0x0a9e('0x10a'),_0x0a9e('0x10b')+_0x4d8a67[_0x0a9e('0x29')]+_0x0a9e('0x10c'));if(!this[_0x0a9e('0x70')](_0x4d8a67[_0x0a9e('0x10d')])){ut[_0x0a9e('0x32')]('[Preview][validateContact][Trunk\x20not\x20working\x20correctly]',_0x4d8a67['name']+_0x0a9e('0x10e'));return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}}if(!ut[_0x0a9e('0x6f')](_0x4d8a67[_0x0a9e('0x3c')])){ut[_0x0a9e('0x32')](_0x0a9e('0x10f'),_0x4d8a67[_0x0a9e('0x29')]+_0x0a9e('0x110'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x4d8a67[_0x0a9e('0x29')]+'\x20Not\x20Active'};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview[_0x0a9e('0xd')]['execCall']=function(_0x38dceb,_0x5dc978,_0x550cbf,_0x26223f){var _0x4a7a3c=this;return new Promise(function(_0x24470a,_0x142e53){var _0xe1ab0d=_0x38dceb['uniqueid'];var _0x4152cd=_0x4a7a3c[_0x0a9e('0x70')](_0x5dc978[_0x0a9e('0x109')])?util['format']('SIP/%s/%s%s',_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x29')],_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x111')])?'':_0x5dc978[_0x0a9e('0x111')][_0x0a9e('0x112')]()||'',_0x5dc978[_0x0a9e('0x113')]>0x0?_0x550cbf[_0x0a9e('0xe9')][_0x0a9e('0x114')](_0x5dc978[_0x0a9e('0x113')]):_0x550cbf['phone']):util['format']('SIP/%s/%s%s',_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x10d')])?_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x29')]:_0x5dc978[_0x0a9e('0x10d')][_0x0a9e('0x29')],_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x111')])?'':_0x5dc978['dialPrefix']['trim']()||'',_0x5dc978[_0x0a9e('0x113')]>0x0?_0x550cbf[_0x0a9e('0xe9')]['substring'](_0x5dc978[_0x0a9e('0x113')]):_0x550cbf[_0x0a9e('0xe9')]);var _0x2e2280=_0x4a7a3c[_0x0a9e('0x70')](_0x5dc978[_0x0a9e('0x109')])?ut[_0x0a9e('0x115')](_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x116')],_0x5dc978[_0x0a9e('0x117')],_0x5dc978[_0x0a9e('0x118')]>0x0?ut[_0x0a9e('0x119')](_0x5dc978[_0x0a9e('0x11a')],_0x5dc978['dialRandomLastDigitCallerIdNumber']):_0x5dc978[_0x0a9e('0x11a')]):ut[_0x0a9e('0x115')](_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x10d')])?_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x116')]:_0x5dc978[_0x0a9e('0x10d')][_0x0a9e('0x116')],_0x5dc978[_0x0a9e('0x117')],_0x5dc978[_0x0a9e('0x118')]>0x0?ut[_0x0a9e('0x119')](_0x5dc978[_0x0a9e('0x11a')],_0x5dc978['dialRandomLastDigitCallerIdNumber']):_0x5dc978['dialOriginateCallerIdNumber']);if(_0x2e2280){_0x38dceb[_0x0a9e('0x11b')]=ut[_0x0a9e('0x11c')](_0x2e2280);_0x38dceb[_0x0a9e('0x11d')]=ut[_0x0a9e('0x11e')](_0x2e2280);}var _0x33359a=ut[_0x0a9e('0x11f')](_0x5dc978,_0x550cbf,_0x4152cd,_0x2e2280,_0xe1ab0d,_0x38dceb);var _0xa8b5de=utils['setXMDContactVariables'](_0x550cbf[_0x0a9e('0xe8')]);Object['assign'](_0x33359a,_0xa8b5de);_[_0x0a9e('0x120')](_0x38dceb,ut[_0x0a9e('0x121')](_0x33359a));_0x38dceb[_0x0a9e('0x61')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));_0x5dc978[_0x0a9e('0x122')]=_0x33359a;var _0x465003=ut[_0x0a9e('0x123')](_0x38dceb,_0x5dc978,_0x33359a,_0x38dceb[_0x0a9e('0x83')],_0x26223f);return ami[_0x0a9e('0x124')](_0x465003)[_0x0a9e('0x56')](function(_0x8231e5){_0x5dc978[_0x0a9e('0x2d')]+=0x1;logger[_0x0a9e('0x26')](_0x0a9e('0x125'),_0xe1ab0d,_0x0a9e('0x9e'),_0x5dc978['name'],'originated:\x20',_0x5dc978[_0x0a9e('0x2d')]);_0x24470a(_0x8231e5);})[_0x0a9e('0x5e')](function(_0x52b365){ut['logAgent'](_0x38dceb,0xe,_0x0a9e('0x126'));rpcDb[_0x0a9e('0xdc')](_0x38dceb,_0x0a9e('0x127'));_0x142e53(_0x52b365);});});};Preview['prototype'][_0x0a9e('0x1d')]=function(_0x5b6447){if(this[_0x0a9e('0x13')][_0x5b6447['linkedid']]){this[_0x0a9e('0x13')][_0x5b6447['linkedid']][_0x0a9e('0x4a')]=_0x5b6447[_0x0a9e('0x4a')];}};Preview[_0x0a9e('0xd')]['syncOriginateResponse']=function(_0x316b51){var _0x497fda=this;var _0x505ffd=this[_0x0a9e('0x13')][_0x316b51[_0x0a9e('0x128')]];if(_0x505ffd){if(_0x505ffd[_0x0a9e('0xeb')]&&this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]]){ut[_0x0a9e('0x129')](_0x505ffd,this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]][_0x0a9e('0x29')],this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]]['id']);}var _0x98bf26=_[_0x0a9e('0x12a')](_0x505ffd);_0x98bf26[_0x0a9e('0x12b')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));var _0x310026=_0x497fda[_0x0a9e('0x10')][_0x505ffd[_0x0a9e('0x43')]];if(ut['isFailure'](_0x316b51[_0x0a9e('0x12c')])){if(_0x505ffd[_0x0a9e('0xaa')]){rpcDb[_0x0a9e('0xfe')](_0x505ffd[_0x0a9e('0x85')]);}if(_0x505ffd['activeContact']){rpcDb['disableContact'](_0x505ffd['idContact']);}ami[_0x0a9e('0x25')]('custom:agentringnoanswer',ut[_0x0a9e('0x78')](_0x505ffd,_0x0a9e('0x12d'),this[_0x0a9e('0x10')][_0x505ffd[_0x0a9e('0x43')]]));this[_0x0a9e('0xd5')](_0x98bf26,_0x310026,_0x316b51);}else{_0x505ffd[_0x0a9e('0x61')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));ut[_0x0a9e('0xd9')](_0x98bf26,0x4,_0x0a9e('0x12e'));rpcDb['createAgentHistory'](_0x98bf26,_0x0a9e('0x12f'));}}};Preview['prototype'][_0x0a9e('0x1a')]=function(_0x586d2f){var _0xf4de86=this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]];var _0x556bb7;if(_0xf4de86){_0x556bb7=this[_0x0a9e('0x10')][_0xf4de86[_0x0a9e('0x43')]];logger['info']('[syncHangup][talking]',_0x586d2f[_0x0a9e('0x84')],_0x0a9e('0x9e'),_0x556bb7[_0x0a9e('0x29')],'pTalking:\x20',_0x556bb7['pTalking']);}if(this['actions'][_0x586d2f[_0x0a9e('0x84')]]&&_0x586d2f[_0x0a9e('0x84')]!==_0x586d2f[_0x0a9e('0x91')]){if(_0x586d2f[_0x0a9e('0x130')]==='16'&&this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]][_0x0a9e('0x4d')]){this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}else if(this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]][_0x0a9e('0x4d')]){logger[_0x0a9e('0x26')](_0x0a9e('0x131'),_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7['name'],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}}else if(_0xf4de86&&_[_0x0a9e('0x41')](_0xf4de86['statedesc'])&&_0x556bb7[_0x0a9e('0x132')]&&_0x586d2f[_0x0a9e('0x84')]===_0x586d2f[_0x0a9e('0x91')]&&_[_0x0a9e('0x41')](_0x586d2f[_0x0a9e('0xd8')])&&_0x586d2f[_0x0a9e('0x130')]==='16'&&_0x586d2f[_0x0a9e('0x133')]==='6'&&_[_0x0a9e('0xd7')](_0xf4de86[_0x0a9e('0x134')])){if(_0xf4de86['unlockAgent']){rpcDb['unlockContact'](_0xf4de86[_0x0a9e('0x85')]);}if(_0xf4de86[_0x0a9e('0x83')]){rpcDb['disableContact'](_0xf4de86[_0x0a9e('0x85')]);}_0x586d2f[_0x0a9e('0xd8')]='22';this['callProgressDetectingAgent'](_0xf4de86,_0x556bb7,_0x586d2f);}else if(_0xf4de86&&_0xf4de86[_0x0a9e('0x134')]){if(_0x586d2f['cause']==='16'&&this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]]['dialAnswer']){logger[_0x0a9e('0x26')](_0x0a9e('0x135'),_0x586d2f['linkedid'],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7['name'],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}else if(this[_0x0a9e('0x13')][_0x586d2f['linkedid']][_0x0a9e('0x4d')]){logger[_0x0a9e('0x26')]('[syncHangup][talking][cause]',_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7[_0x0a9e('0x29')],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f['linkedid'],_0x586d2f['cause']);}}};Preview['prototype']['syncDialEnd']=function(_0x5e9817){if(this[_0x0a9e('0x13')][_0x5e9817[_0x0a9e('0xd4')]]&&_0x5e9817['destlinkedid']!==_0x5e9817['destuniqueid']){this[_0x0a9e('0x72')](_0x5e9817,_0x5e9817['destlinkedid'],_0x5e9817[_0x0a9e('0xcd')]);}};Preview[_0x0a9e('0xd')][_0x0a9e('0x136')]=function(_0x175c97){if(this[_0x0a9e('0x13')][_0x175c97[_0x0a9e('0x84')]]&&_0x175c97['linkedid']!==_0x175c97[_0x0a9e('0x91')]&&!this[_0x0a9e('0x13')][_0x175c97['linkedid']][_0x0a9e('0x4d')]){if(_0x175c97[_0x0a9e('0x130')]==='1'){this[_0x0a9e('0x72')](_0x175c97,_0x175c97[_0x0a9e('0x84')],_0x175c97[_0x0a9e('0x130')]);}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x137')]=function(_0x4a36df,_0x331216,_0x508395){if(this[_0x0a9e('0x13')][_0x4a36df]){if(_[_0x0a9e('0x41')](this['actions'][_0x4a36df][_0x0a9e('0x122')])){this[_0x0a9e('0x13')][_0x4a36df]['variables']={};}this[_0x0a9e('0x13')][_0x4a36df]['variables'][_0x331216]=_0x508395;}};Preview[_0x0a9e('0xd')][_0x0a9e('0x1f')]=function(_0x5d0620){try{if(!_[_0x0a9e('0x41')](_0x5d0620)){if(ut['filterKey'](_[_0x0a9e('0x138')](_0x5d0620[_0x0a9e('0x139')])[0x0])){this[_0x0a9e('0x137')](_0x5d0620[_0x0a9e('0x91')],_[_0x0a9e('0x138')](_0x5d0620[_0x0a9e('0x139')])[0x0],_0x5d0620[_0x0a9e('0x13a')]);}}}catch(_0x53b5c2){logger[_0x0a9e('0x13b')](_0x0a9e('0x13c'),util[_0x0a9e('0x13d')](_0x53b5c2,{'showHidden':![],'depth':null}));}};Preview[_0x0a9e('0xd')][_0x0a9e('0x21')]=function(_0x5932ad){if(_0x5932ad){if(this[_0x0a9e('0x13')][_0x5932ad['transfertargetlinkedid']]){this['actions'][_0x5932ad[_0x0a9e('0x13e')]]['transfer']=!![];}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x23')]=function(_0x58d5fd){if(_0x58d5fd){if(this[_0x0a9e('0x13')][_0x58d5fd[_0x0a9e('0x13f')]]){this[_0x0a9e('0x13')][_0x58d5fd[_0x0a9e('0x13f')]][_0x0a9e('0x134')]=!![];}}};module[_0x0a9e('0x140')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 38c811e..3230a91 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 _0xbaae=['error','inspect','catch','[createHistory]\x20','createHistory','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','resolve','then','[getContactPreview]\x20','createCustomerHistory','rescheduleContact','active','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','disableContact','[activeContact]\x20','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercomplete','connectedlinename','membername','context','assigned','lastAssignedTo','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','util','bluebird','preview','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/agentReportPreview','../rpc/voiceQueueReport'];(function(_0xa016f6,_0x3a8863){var _0x313949=function(_0x570eeb){while(--_0x570eeb){_0xa016f6['push'](_0xa016f6['shift']());}};_0x313949(++_0x3a8863);}(_0xbaae,0x1b1));var _0xebaa=function(_0x39f3a5,_0x4e8688){_0x39f3a5=_0x39f3a5-0x0;var _0x1a9b56=_0xbaae[_0x39f3a5];return _0x1a9b56;};'use strict';var util=require(_0xebaa('0x0'));var BPromise=require(_0xebaa('0x1'));var logger=require('../../../config/logger')(_0xebaa('0x2'));var cmHopper=require(_0xebaa('0x3'));var cmHopperHistory=require(_0xebaa('0x4'));var cmHopperBlack=require(_0xebaa('0x5'));var agentReportPreview=require(_0xebaa('0x6'));var voiceQueueReport=require(_0xebaa('0x7'));function loggerCatch(_0x133c43){return function(_0x2d9732){logger[_0xebaa('0x8')](_0x133c43,util[_0xebaa('0x9')](_0x2d9732,{'showHidden':![],'depth':null}));};}function create(_0x13c685){return cmHopperHistory['createHistory'](_0x13c685)[_0xebaa('0xa')](loggerCatch(_0xebaa('0xb')));}function createAgent(_0x2050c1){return BPromise['resolve']()['then'](agentReportPreview[_0xebaa('0xc')](_0x2050c1))['catch'](loggerCatch('[createHistory]\x20'));}function moveContact(_0x120a26){return cmHopper[_0xebaa('0xd')](_0x120a26,!![])[_0xebaa('0xa')](loggerCatch(_0xebaa('0xe')));}exports[_0xebaa('0xf')]=function(_0x3fe2ed){return cmHopperBlack[_0xebaa('0xf')](_0x3fe2ed)['catch'](loggerCatch(_0xebaa('0x10')));};exports[_0xebaa('0x11')]=function(_0x5181c5){return BPromise[_0xebaa('0x12')]()[_0xebaa('0x13')](cmHopper[_0xebaa('0x11')](_0x5181c5))[_0xebaa('0xa')](loggerCatch(_0xebaa('0x14')));};exports['createHistory']=function(_0x7df88f,_0x42dbe8){create(_0x7df88f)[_0xebaa('0xa')](loggerCatch(_0x42dbe8));moveContact(_0x7df88f)['catch'](loggerCatch(_0x42dbe8));};exports['createAgentHistory']=function(_0x8bb6a4,_0x4dc96c){createAgent(_0x8bb6a4)[_0xebaa('0xa')](loggerCatch(_0x4dc96c));};exports[_0xebaa('0x15')]=function(_0xf06fa6,_0x43b1a1){create(_0xf06fa6)[_0xebaa('0xa')](loggerCatch(_0x43b1a1));};exports['createCustomerFinal']=function(_0x56079f,_0x17aed1){moveContact(_0x56079f)[_0xebaa('0xa')](loggerCatch(_0x17aed1));};exports[_0xebaa('0x16')]=function(_0x1ab535,_0x4428,_0x5a877d){if(_0x4428){_0x1ab535['UserId']=null;}if(_0x5a877d){_0x1ab535[_0xebaa('0x17')]=![];}return cmHopper[_0xebaa('0x16')](_0x1ab535)['catch'](loggerCatch(_0xebaa('0x18')));};exports[_0xebaa('0x19')]=function(_0x482080){return cmHopper[_0xebaa('0x19')](_0x482080)[_0xebaa('0xa')](loggerCatch(_0xebaa('0x1a')));};exports[_0xebaa('0x1b')]=function(_0x39452f){return cmHopper[_0xebaa('0x1b')]({'UserId':null},_0x39452f,0x1)[_0xebaa('0xa')](loggerCatch('[unlockContact]\x20'));};exports[_0xebaa('0x1c')]=function(_0x1219cd){return cmHopper[_0xebaa('0x1b')]({'active':![]},_0x1219cd,0x1)['catch'](loggerCatch(_0xebaa('0x1d')));};exports['crateCustomerReportQueue']=function(_0x4c70bf){var _0x49af44={};_0x49af44[_0xebaa('0x1e')]=_0x4c70bf[_0xebaa('0x1e')];_0x49af44[_0xebaa('0x1f')]=_0x4c70bf[_0xebaa('0x1f')];_0x49af44[_0xebaa('0x20')]=_0x4c70bf['calleridnum'];_0x49af44['calleridname']=_0x4c70bf[_0xebaa('0x21')];_0x49af44[_0xebaa('0x22')]=_0x4c70bf[_0xebaa('0x22')];_0x49af44[_0xebaa('0x23')]=_0x4c70bf[_0xebaa('0x24')];_0x49af44[_0xebaa('0x25')]=_0x4c70bf['answertime'];_0x49af44[_0xebaa('0x26')]=0x1;_0x49af44['queuecallercompleteAt']=_0x4c70bf['endtime'];_0x49af44[_0xebaa('0x27')]=_0x4c70bf[_0xebaa('0x28')];_0x49af44[_0xebaa('0x29')]='from-sip';_0x49af44['exten']='xcally-motion-preview';_0x49af44['holdtime']=0x0;_0x49af44[_0xebaa('0x2a')]=0x1;_0x49af44[_0xebaa('0x2b')]=_0x4c70bf['membername'];_0x49af44['queuecallerexitreason']=_0xebaa('0x2c');return BPromise[_0xebaa('0x12')]()[_0xebaa('0x13')](voiceQueueReport[_0xebaa('0x2d')](_0x49af44))[_0xebaa('0xa')](loggerCatch(_0xebaa('0x2e')));};exports[_0xebaa('0x2f')]=function(_0x1d1434,_0x3687da){return BPromise[_0xebaa('0x12')]()[_0xebaa('0x13')](cmHopper[_0xebaa('0x2f')](_0x1d1434,_0x3687da))[_0xebaa('0xa')](loggerCatch(_0xebaa('0x30')));};exports['rescheduleContactInQueue']=function(_0x1fb19f){return cmHopper[_0xebaa('0x16')](_0x1fb19f,!![],!![])['catch'](loggerCatch('[rescheduleContactInQueue]\x20'));}; \ No newline at end of file +var _0x7719=['type','uniqueid','calleridnum','queue','answertime','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','membername','context','exten','holdtime','assigned','lastAssignedTo','queuecallerexitreason','COMPLETED','create','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','bluebird','../../../config/logger','../rpc/cmHopper','../rpc/cmHopperBlack','../rpc/voiceQueueReport','error','inspect','createHistory','catch','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','getContactPreview','resolve','then','createAgentHistory','createCustomerHistory','rescheduleContact','UserId','active','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','crateCustomerReportQueue'];(function(_0x32caa5,_0x13d0db){var _0x1f32ec=function(_0x51fb6a){while(--_0x51fb6a){_0x32caa5['push'](_0x32caa5['shift']());}};_0x1f32ec(++_0x13d0db);}(_0x7719,0x17c));var _0x9771=function(_0xc36bd1,_0x307e75){_0xc36bd1=_0xc36bd1-0x0;var _0x1b9790=_0x7719[_0xc36bd1];return _0x1b9790;};'use strict';var util=require(_0x9771('0x0'));var BPromise=require(_0x9771('0x1'));var logger=require(_0x9771('0x2'))('preview');var cmHopper=require(_0x9771('0x3'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require(_0x9771('0x4'));var agentReportPreview=require('../rpc/agentReportPreview');var voiceQueueReport=require(_0x9771('0x5'));function loggerCatch(_0x2eedf0){return function(_0x1bdb56){logger[_0x9771('0x6')](_0x2eedf0,util[_0x9771('0x7')](_0x1bdb56,{'showHidden':![],'depth':null}));};}function create(_0x5407af){return cmHopperHistory['createHistory'](_0x5407af)['catch'](loggerCatch('[createHistory]\x20'));}function createAgent(_0x36a97f){return BPromise['resolve']()['then'](agentReportPreview[_0x9771('0x8')](_0x36a97f))[_0x9771('0x9')](loggerCatch('[createHistory]\x20'));}function moveContact(_0x5443fd){return cmHopper[_0x9771('0xa')](_0x5443fd,!![])[_0x9771('0x9')](loggerCatch(_0x9771('0xb')));}exports['checkIsBlackList']=function(_0x758fd9){return cmHopperBlack[_0x9771('0xc')](_0x758fd9)[_0x9771('0x9')](loggerCatch('[checkIsBlackList]\x20'));};exports[_0x9771('0xd')]=function(_0x474502){return BPromise[_0x9771('0xe')]()[_0x9771('0xf')](cmHopper[_0x9771('0xd')](_0x474502))[_0x9771('0x9')](loggerCatch('[getContactPreview]\x20'));};exports[_0x9771('0x8')]=function(_0x3e94df,_0x27dd39){create(_0x3e94df)[_0x9771('0x9')](loggerCatch(_0x27dd39));moveContact(_0x3e94df)[_0x9771('0x9')](loggerCatch(_0x27dd39));};exports[_0x9771('0x10')]=function(_0x46dd91,_0x5d7aa5){createAgent(_0x46dd91)[_0x9771('0x9')](loggerCatch(_0x5d7aa5));};exports[_0x9771('0x11')]=function(_0x5d8c3a,_0x5dd419){create(_0x5d8c3a)[_0x9771('0x9')](loggerCatch(_0x5dd419));};exports['createCustomerFinal']=function(_0x3ac36c,_0x580ee0){moveContact(_0x3ac36c)[_0x9771('0x9')](loggerCatch(_0x580ee0));};exports[_0x9771('0x12')]=function(_0x2824d4,_0x31f8f5,_0x917239){if(_0x31f8f5){_0x2824d4[_0x9771('0x13')]=null;}if(_0x917239){_0x2824d4[_0x9771('0x14')]=![];}return cmHopper[_0x9771('0x12')](_0x2824d4)[_0x9771('0x9')](loggerCatch('[rescheduleContact]\x20'));};exports[_0x9771('0x15')]=function(_0x4b8ca2){return cmHopper[_0x9771('0x15')](_0x4b8ca2)[_0x9771('0x9')](loggerCatch(_0x9771('0x16')));};exports[_0x9771('0x17')]=function(_0x40e539){return cmHopper['unlockContact']({'UserId':null},_0x40e539,0x1)['catch'](loggerCatch(_0x9771('0x18')));};exports[_0x9771('0x19')]=function(_0x54eabb){return cmHopper[_0x9771('0x17')]({'active':![]},_0x54eabb,0x1)['catch'](loggerCatch(_0x9771('0x1a')));};exports[_0x9771('0x1b')]=function(_0x417900){var _0x5a9434={};_0x5a9434[_0x9771('0x1c')]=_0x417900[_0x9771('0x1c')];_0x5a9434[_0x9771('0x1d')]=_0x417900['uniqueid'];_0x5a9434[_0x9771('0x1e')]=_0x417900['calleridnum'];_0x5a9434['calleridname']=_0x417900['calleridname'];_0x5a9434[_0x9771('0x1f')]=_0x417900['queue'];_0x5a9434['queuecallerjoinAt']=_0x417900[_0x9771('0x20')];_0x5a9434[_0x9771('0x21')]=_0x417900[_0x9771('0x20')];_0x5a9434[_0x9771('0x22')]=0x1;_0x5a9434[_0x9771('0x23')]=_0x417900[_0x9771('0x24')];_0x5a9434[_0x9771('0x25')]=_0x417900[_0x9771('0x26')];_0x5a9434[_0x9771('0x27')]='from-sip';_0x5a9434[_0x9771('0x28')]='xcally-motion-preview';_0x5a9434[_0x9771('0x29')]=0x0;_0x5a9434[_0x9771('0x2a')]=0x1;_0x5a9434[_0x9771('0x2b')]=_0x417900[_0x9771('0x26')];_0x5a9434[_0x9771('0x2c')]=_0x9771('0x2d');return BPromise['resolve']()[_0x9771('0xf')](voiceQueueReport[_0x9771('0x2e')](_0x5a9434))[_0x9771('0x9')](loggerCatch('[voiceQueueReport]\x20'));};exports[_0x9771('0x2f')]=function(_0x2c5f66,_0x666e6a){return BPromise[_0x9771('0xe')]()[_0x9771('0xf')](cmHopper[_0x9771('0x2f')](_0x2c5f66,_0x666e6a))[_0x9771('0x9')](loggerCatch(_0x9771('0x30')));};exports[_0x9771('0x31')]=function(_0x361b49){return cmHopper[_0x9771('0x12')](_0x361b49,!![],!![])['catch'](loggerCatch(_0x9771('0x32')));}; \ 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 3d64425..7df0f7c 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 _0x7cf3=['../../dialer/utils','error','inspect','info','loggerError','logger2','message','getCallerId','isEmpty','format','\x22%s\x22\x20<%s>','isUndefined','isActive','isNil','addVariables','Queue','calleridname','calleridnum','ContactId','dialer','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','originatecalleridname','xcally-motion-preview','Call-Type:\x20PREVIEW','monitor_format','_XCALLY_MIXMONITOR_FORMAT','hasOwnProperty','toLower','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','Blacklist','responsetime','endtime','logAgent','ringtime','getSeconds','starttime','logLookAgent','membername','UserId','logCustomer','answertime','variablesAction','RECALL','BOOKED','uniqueid','originate','channelAgent','timeout','totalGlobal','countcongestionretry','countnoanswerretry','cloneAction','clone','Global','scheduledAt','active','scheduledat','minutes','ListId','VoiceQueueId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','lastevent','name','queue','interface','motionChannel','mandatoryDisposition','buildObj','agentReadyId','not_inuse','status','reachable','push','getDiff','milliseconds','createBody','CampaignId','filterKey','idContact','campaigntype','dialAnswer','countbusyretry','countglobal','callbackat','sipcallid','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepeer','bridgepvtcallid','\x5cw{0,','pow','replace','random','extractCalleridNumber','match','noanswer','keys','variables','toLowerCase','buildNoAnswerEventPayload','moment','../../../../config/logger','preview','env','XCALLY_IP_AGI','127.0.0.1'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x7cf3,0x114));var _0x37cf=function(_0x4cd690,_0x4797cc){_0x4cd690=_0x4cd690-0x0;var _0x4a74a9=_0x7cf3[_0x4cd690];return _0x4a74a9;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0x37cf('0x0'));var logger=require(_0x37cf('0x1'))(_0x37cf('0x2'));var ipAgi=process[_0x37cf('0x3')][_0x37cf('0x4')]||_0x37cf('0x5');var utils=require(_0x37cf('0x6'));exports['loggerCatch']=function(_0x56a692){return function(_0x4c2793){logger[_0x37cf('0x7')](_0x56a692,util[_0x37cf('0x8')](_0x4c2793,{'showHidden':![],'depth':null}));};};exports['logger']=function(_0x419e43,_0x1d633e){logger[_0x37cf('0x9')](_0x419e43,util[_0x37cf('0x8')](_0x1d633e,{'showHidden':![],'depth':null}));};exports[_0x37cf('0xa')]=function(_0x94a504,_0x530e05){logger[_0x37cf('0x7')](_0x94a504,util[_0x37cf('0x8')](_0x530e05,{'showHidden':![],'depth':null}));};exports[_0x37cf('0xb')]=function(_0x57fd22){return function(_0x2c4231){logger['info'](_0x57fd22,util[_0x37cf('0x8')](_0x2c4231,{'showHidden':![],'depth':null}));};};exports[_0x37cf('0xc')]=function(_0xaa5f1e,_0x24d8c2,_0x583c9a){return{'message':_0xaa5f1e,'unlock':_0x24d8c2,'active':_0x583c9a};};exports[_0x37cf('0xd')]=function(_0x5f68b7,_0x3f4d28,_0x2cb8ae){if(!_['isUndefined'](_0x2cb8ae)&&'string'===typeof _0x2cb8ae&&!_['isEmpty'](_0x2cb8ae)){if(!_['isUndefined'](_0x3f4d28)&&'string'===typeof _0x3f4d28&&!_[_0x37cf('0xe')](_0x3f4d28)){return util[_0x37cf('0xf')](_0x37cf('0x10'),_0x3f4d28,_0x2cb8ae);}return util[_0x37cf('0xf')](_0x37cf('0x10'),_0x2cb8ae,_0x2cb8ae);}if(!_[_0x37cf('0x11')](_0x5f68b7)&&'string'===typeof _0x5f68b7&&!_[_0x37cf('0xe')](_0x5f68b7)){return _0x5f68b7;}return'\x22\x22\x20<>';};exports[_0x37cf('0x12')]=function(_0x2eaaf4){if(_[_0x37cf('0x13')](_0x2eaaf4)){return![];}return _0x2eaaf4;};exports[_0x37cf('0x14')]=function(_0x2bf890,_0x7f2a40,_0x5d5a75,_0x175b8a,_0x3a709e,_0x48e792){var _0xc5f11b={'XMD-QUEUE':_0x7f2a40[_0x37cf('0x15')]?_0x7f2a40['Queue']['name']:'','XMD-CALLERID':_0x175b8a,'XMD-CALLERID-PREVIEW':_0x48e792?util[_0x37cf('0xf')]('\x22%s\x22\x20<%s>',_0x48e792[_0x37cf('0x16')],_0x48e792[_0x37cf('0x17')]):_0x175b8a,'XMD-DIALID':_0x3a709e,'XMD-CONTACTID':_0x7f2a40[_0x37cf('0x18')],'XMD-CDRTYPE':_0x37cf('0x19'),'CALLERID(all)':_0x175b8a,'XMD-VOICEQUEUEID':_0x7f2a40['VoiceQueueId'],'XMD-DIALCHANNEL':_0x5d5a75,'XMD-DIALTIMEOUT':_0x2bf890[_0x37cf('0x1a')]||0x1e,'XMD-DIALOPTIONS':util[_0x37cf('0xf')](_0x37cf('0x1b'),_0x2bf890[_0x37cf('0x1c')]?'g':'',_['isEmpty'](_0x2bf890['monitor_format'])?'':'U(xcally-mixmonitor-context)'),'XMD-DIALURL':_0x2bf890[_0x37cf('0x1d')]||'','XMD-AGI':_0x2bf890[_0x37cf('0x1e')]?util['format'](_0x37cf('0x1f'),ipAgi,_0x2bf890['dialQueueProject']):_0x37cf('0x20'),'XMD-AGIAFTER':_0x2bf890['dialQueueProject2']?util['format']('\x22agi://%s/square,%s\x22',ipAgi,_0x2bf890[_0x37cf('0x1c')]):_0x37cf('0x20'),'XMD-ORIGINATECALLERIDNUM':_0x48e792?_0x48e792[_0x37cf('0x21')]:'','XMD-ORIGINATECALLERIDNAME':_0x48e792?_0x48e792[_0x37cf('0x22')]:'','XMD-DESTINATION':_0x37cf('0x23'),'SIPADDHEADER':_0x37cf('0x24')};if(!_[_0x37cf('0xe')](_0x2bf890[_0x37cf('0x25')])){_0xc5f11b[util[_0x37cf('0xf')]('%s',_0x37cf('0x26'))]=_0x2bf890[_0x37cf('0x25')];_0xc5f11b[util[_0x37cf('0xf')]('%s','_XCALLY_MIXMONITOR_UNIQUEID')]=_0x3a709e;}return _0xc5f11b;};exports['toLowerVariables']=function(_0x482edb){var _0x1f1a3e={};for(var _0x1579b4 in _0x482edb){if(_0x482edb[_0x37cf('0x27')](_0x1579b4)){_0x1f1a3e[util['format']('%s',_[_0x37cf('0x28')](_0x1579b4))]=_0x482edb[_0x1579b4];}}return{'variables':_0x1f1a3e};};exports[_0x37cf('0x29')]=function(_0x186f81,_0x2ce9e4){if(!_[_0x37cf('0x13')](_0x186f81)){if(_0x186f81[_0x37cf('0x27')]('originated')){if(_0x186f81['originated']>0x0){_0x186f81[_0x37cf('0x2a')]-=0x1;}else{logger[_0x37cf('0x7')](_0x37cf('0x2b'),_0x2ce9e4);}}}else{logger[_0x37cf('0x7')]('[updateOriginated]\x20is\x20null\x20or\x20undefined',_0x2ce9e4);}};exports[_0x37cf('0x2c')]=function(_0x989d51){var _0x883548=moment()[_0x37cf('0xf')](_0x37cf('0x2d'));_0x989d51[_0x37cf('0x2e')]=0xd;_0x989d51[_0x37cf('0x2f')]=_0x37cf('0x30');_0x989d51['starttime']=_0x883548;_0x989d51[_0x37cf('0x31')]=_0x883548;_0x989d51[_0x37cf('0x32')]=_0x883548;};exports[_0x37cf('0x33')]=function(_0x5b1b19,_0x253be9,_0x284cd1){var _0x20f222=moment()[_0x37cf('0xf')]('YYYY-MM-DD\x20HH:mm:ss');_0x5b1b19[_0x37cf('0x2e')]=_0x253be9;_0x5b1b19[_0x37cf('0x2f')]=_0x284cd1;_0x5b1b19[_0x37cf('0x31')]=_0x20f222;_0x5b1b19[_0x37cf('0x34')]=utils[_0x37cf('0x35')](_0x5b1b19[_0x37cf('0x31')],_0x5b1b19[_0x37cf('0x36')]);};exports[_0x37cf('0x37')]=function(_0x5d5105,_0x519df4,_0x4c59db){_0x5d5105[_0x37cf('0x38')]=_0x519df4;_0x5d5105[_0x37cf('0x39')]=_0x4c59db;};exports[_0x37cf('0x3a')]=function(_0x12c261,_0x101301,_0x19ce4e){var _0x4b64a2=moment()[_0x37cf('0xf')](_0x37cf('0x2d'));_0x12c261['state']=_0x101301;_0x12c261[_0x37cf('0x2f')]=_0x19ce4e;_0x12c261['responsetime']=_0x12c261[_0x37cf('0x31')]?_0x12c261[_0x37cf('0x31')]:_0x4b64a2;_0x12c261[_0x37cf('0x32')]=_0x12c261[_0x37cf('0x32')]?_0x12c261[_0x37cf('0x32')]:_0x4b64a2;_0x12c261[_0x37cf('0x34')]=utils[_0x37cf('0x35')](_0x12c261[_0x37cf('0x31')]||0x0,_0x12c261[_0x37cf('0x36')]||0x0);_0x12c261['talktime']=_0x12c261[_0x37cf('0x3b')]?utils[_0x37cf('0x35')](_0x12c261['endtime'],_0x12c261[_0x37cf('0x3b')]):0x0;};exports['isFailure']=function(_0x3c3103){return _0x3c3103==='Failure';};exports[_0x37cf('0x3c')]=function(_0x55006e,_0x29bf4b,_0x528685,_0x10f853,_0x4ac21b){var _0x4973ec=_0x10f853?_0x37cf('0x3d'):_0x55006e['calleridname'];_0x4973ec=_0x4ac21b?_0x37cf('0x3e'):_0x4973ec;return{'actionid':_0x55006e[_0x37cf('0x3f')],'action':_0x37cf('0x40'),'channel':_0x55006e[_0x37cf('0x41')],'callerid':util[_0x37cf('0xf')](_0x37cf('0x10'),_0x4973ec,_0x55006e[_0x37cf('0x17')]),'Exten':_0x37cf('0x23'),'Context':'from-sip','Priority':'1','variable':_0x528685,'timeout':(_0x29bf4b[_0x37cf('0x42')]||0x1e)*0x3e8,'async':!![],'channelid':_0x55006e[_0x37cf('0x3f')]};};exports[_0x37cf('0x43')]=function(_0x185861){return _0x185861['countbusyretry']+_0x185861[_0x37cf('0x44')]+_0x185861[_0x37cf('0x45')]+_0x185861['countagentrejectretry']+_0x185861['countnosuchnumberretry'];};exports[_0x37cf('0x46')]=function(_0x544d07){var _0x510a94=_[_0x37cf('0x47')](_0x544d07);_0x510a94['state']=0xf;_0x510a94[_0x37cf('0x2f')]=_0x37cf('0x48');return _0x510a94;};exports[_0x37cf('0x49')]=function(_0xf76c71,_0x349dcc,_0x32896b){var _0x153be2={};_0x153be2[_0x349dcc]=_0xf76c71[_0x349dcc];_0x153be2[_0x37cf('0x4a')]=![];_0x153be2[_0x37cf('0x4b')]=moment()['add'](_0x32896b,_0x37cf('0x4c'))[_0x37cf('0xf')](_0x37cf('0x2d'));_0x153be2[_0x37cf('0x18')]=_0xf76c71[_0x37cf('0x18')];_0x153be2[_0x37cf('0x4d')]=_0xf76c71[_0x37cf('0x4d')];_0x153be2[_0x37cf('0x4e')]=_0xf76c71['VoiceQueueId']||undefined;return _0x153be2;};exports[_0x37cf('0x4f')]=function(_0x4f26b4,_0x2cb475){if(!_[_0x37cf('0x13')](_0x4f26b4)){if(_0x4f26b4[_0x37cf('0x50')]>0x0){_0x4f26b4[_0x37cf('0x50')]-=0x1;}else{logger[_0x37cf('0x7')](_0x2cb475,_0x37cf('0x51'));}}else{logger[_0x37cf('0x7')](_0x2cb475,_0x37cf('0x52'));}};exports[_0x37cf('0x53')]=function(_0x3de3a9){if(_0x3de3a9<=0x0){return!![];}return![];};function buildObj(_0x344bac,_0x44b97d,_0x4f861d){_0x344bac[_0x37cf('0x54')]=_0x44b97d;_0x344bac[_0x37cf('0x55')]=_0x344bac[_0x37cf('0x56')];_0x344bac[_0x37cf('0x57')]=_0x344bac[_0x37cf('0x41')];_0x344bac[_0x37cf('0x58')]='voice';if(_0x4f861d){_0x344bac[_0x37cf('0x59')]=_0x4f861d[_0x37cf('0x59')];}return _0x344bac;}exports[_0x37cf('0x5a')]=buildObj;exports[_0x37cf('0x5b')]=function(_0x40deab){var _0x45401d=[];for(var _0x94eaa4 in _0x40deab){if(_0x40deab['hasOwnProperty'](_0x94eaa4)){if(!_['isNil'](_0x40deab[_0x94eaa4])&&_0x40deab[_0x94eaa4]['state']===_0x37cf('0x5c')&&_0x40deab[_0x94eaa4][_0x37cf('0x5d')]===_0x37cf('0x5e')){_0x45401d[_0x37cf('0x5f')](_0x40deab[_0x94eaa4]['id']);}}}return _0x45401d;};exports[_0x37cf('0x60')]=function(_0x233d67){var _0x235875=moment()[_0x37cf('0x61')](0x0);var _0xe1475b=moment(_0x233d67)['milliseconds'](0x0);return _0x235875['diff'](_0xe1475b,'seconds');};exports[_0x37cf('0x62')]=function(_0x28e777){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x28e777[_0x37cf('0x18')],'ListId':_0x28e777[_0x37cf('0x4d')],'VoiceQueueId':_0x28e777[_0x37cf('0x4e')]||undefined,'CampaignId':_0x28e777[_0x37cf('0x63')]||undefined};};exports[_0x37cf('0x64')]=function(_0x50458e){if(_0x50458e===_0x37cf('0x3f')||_0x50458e===_0x37cf('0x65')||_0x50458e===_0x37cf('0x56')||_0x50458e==='type'||_0x50458e===_0x37cf('0x66')||_0x50458e===_0x37cf('0x67')||_0x50458e===_0x37cf('0x38')||_0x50458e===_0x37cf('0x41')||_0x50458e==='calleridname'||_0x50458e===_0x37cf('0x4a')||_0x50458e===_0x37cf('0x17')||_0x50458e==='scheduledat'||_0x50458e===_0x37cf('0x68')||_0x50458e===_0x37cf('0x44')||_0x50458e===_0x37cf('0x45')||_0x50458e===_0x37cf('0x69')||_0x50458e==='callback'||_0x50458e==='callbackuniqueid'||_0x50458e===_0x37cf('0x6a')||_0x50458e==='recallme'||_0x50458e===_0x37cf('0x18')||_0x50458e==='ListId'||_0x50458e==='UserId'||_0x50458e===_0x37cf('0x4e')||_0x50458e===_0x37cf('0x6b')||_0x50458e==='xmd-voicequeueid'||_0x50458e==='xmd-queue'||_0x50458e===_0x37cf('0x6c')||_0x50458e===_0x37cf('0x6d')||_0x50458e===_0x37cf('0x6e')||_0x50458e===_0x37cf('0x6f')||_0x50458e===_0x37cf('0x70')||_0x50458e===_0x37cf('0x71')||_0x50458e===_0x37cf('0x72')||_0x50458e===_0x37cf('0x73')||_0x50458e===_0x37cf('0x74')||_0x50458e===_0x37cf('0x75')||_0x50458e===_0x37cf('0x76')||_0x50458e===_0x37cf('0x77')||_0x50458e===_0x37cf('0x78')||_0x50458e===_0x37cf('0x79')||_0x50458e===_0x37cf('0x7a')||_0x50458e===_0x37cf('0x7b')||_0x50458e===_0x37cf('0x7c')||_0x50458e===_0x37cf('0x7d')||_0x50458e===_0x37cf('0x7e')||_0x50458e==='rtpaudioqosrttbridged'||_0x50458e===_0x37cf('0x78')||_0x50458e===_0x37cf('0x79')||_0x50458e===_0x37cf('0x7a')||_0x50458e===_0x37cf('0x7b')||_0x50458e===_0x37cf('0x7c')||_0x50458e===_0x37cf('0x7d')||_0x50458e===_0x37cf('0x7e')||_0x50458e===_0x37cf('0x7f')||_0x50458e===_0x37cf('0x80')||_0x50458e===_0x37cf('0x81')||_0x50458e===_0x37cf('0x2e')||_0x50458e===_0x37cf('0x2f')){return![];}return!![];};exports['getCallerIdRandom']=function(_0x465b36,_0x135df9){var _0x10c5d3,_0x220104,_0x5f4ae7;if(_0x135df9<=0x0){_0x135df9=0x1;}_0x10c5d3=new RegExp(_0x37cf('0x82')+_0x135df9+'}$');_0x220104=Math['pow'](0xa,_0x135df9-0x1);_0x5f4ae7=Math[_0x37cf('0x83')](0xa,_0x135df9)-0x1;return util['format']('%s',_[_0x37cf('0x84')](_0x465b36,_0x10c5d3,_[_0x37cf('0x85')](_0x220104,_0x5f4ae7)));};exports['extractCalleridName']=function(_0x592ba9){var _0x4b157b=_0x592ba9['match'](/"(.*?)"/);return _0x4b157b?_0x4b157b[0x1]:_0x592ba9;};exports[_0x37cf('0x86')]=function(_0x1b46fd){var _0x1f9698=_0x1b46fd[_0x37cf('0x87')](/<(.*?)>/);return _0x1f9698?_0x1f9698[0x1]:_0x1b46fd;};function buildNoAnswerEventPayload(_0x1772b7,_0x204fce){var _0x216b01=buildObj(_0x1772b7,_0x37cf('0x88'));if(!_['isEmpty'](_0x204fce['variables'])){Object[_0x37cf('0x89')](_0x204fce[_0x37cf('0x8a')])['forEach'](function(_0x1a8b82){_0x216b01[_0x1a8b82[_0x37cf('0x8b')]()]=_0x204fce[_0x37cf('0x8a')][_0x1a8b82];});}return _0x216b01;}exports[_0x37cf('0x8c')]=buildNoAnswerEventPayload; \ No newline at end of file +var _0x84c2=['countbusyretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','cloneAction','clone','Global','scheduledAt','active','minutes','ListId','VoiceQueueId','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','lastevent','queue','interface','motionChannel','voice','mandatoryDisposition','buildObj','not_inuse','status','getDiff','milliseconds','createBody','CampaignId','idContact','type','campaigntype','membername','countglobal','callback','recallme','sipcallid','xmd-queue','xmd-listid','xmd-dialurl','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqosrtt','rtpaudioqosjitter','rtpaudioqoslossbridged','bridgepeer','getCallerIdRandom','\x5cw{0,','pow','replace','extractCalleridName','match','extractCalleridNumber','noanswer','variables','keys','toLowerCase','buildNoAnswerEventPayload','util','lodash','moment','../../../../config/logger','XCALLY_IP_AGI','127.0.0.1','loggerCatch','error','logger','inspect','logger2','info','message','getCallerId','isEmpty','isUndefined','string','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','addVariables','Queue','name','calleridname','calleridnum','ContactId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','originatecalleridname','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','toLowerVariables','hasOwnProperty','toLower','updateOriginated','isNil','originated','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','Blacklist','responsetime','endtime','logAgent','statedesc','ringtime','getSeconds','starttime','logLookAgent','UserId','talktime','answertime','isFailure','Failure','variablesAction','RECALL','BOOKED','uniqueid','originate','channelAgent','xcally-motion-preview','from-sip','totalGlobal'];(function(_0x1f2efc,_0x2582af){var _0x27317e=function(_0xdf7aab){while(--_0xdf7aab){_0x1f2efc['push'](_0x1f2efc['shift']());}};_0x27317e(++_0x2582af);}(_0x84c2,0xcd));var _0x284c=function(_0x276e93,_0x44f1e3){_0x276e93=_0x276e93-0x0;var _0x536510=_0x84c2[_0x276e93];return _0x536510;};'use strict';var util=require(_0x284c('0x0'));var _=require(_0x284c('0x1'));var moment=require(_0x284c('0x2'));var logger=require(_0x284c('0x3'))('preview');var ipAgi=process['env'][_0x284c('0x4')]||_0x284c('0x5');var utils=require('../../dialer/utils');exports[_0x284c('0x6')]=function(_0x27b8e4){return function(_0x1bc4fc){logger[_0x284c('0x7')](_0x27b8e4,util['inspect'](_0x1bc4fc,{'showHidden':![],'depth':null}));};};exports[_0x284c('0x8')]=function(_0x50ae68,_0x561de0){logger['info'](_0x50ae68,util[_0x284c('0x9')](_0x561de0,{'showHidden':![],'depth':null}));};exports['loggerError']=function(_0x7b11a8,_0x18055f){logger[_0x284c('0x7')](_0x7b11a8,util[_0x284c('0x9')](_0x18055f,{'showHidden':![],'depth':null}));};exports[_0x284c('0xa')]=function(_0x4ff249){return function(_0xba9cc3){logger[_0x284c('0xb')](_0x4ff249,util['inspect'](_0xba9cc3,{'showHidden':![],'depth':null}));};};exports[_0x284c('0xc')]=function(_0x485af5,_0x2dbea1,_0x28d42c){return{'message':_0x485af5,'unlock':_0x2dbea1,'active':_0x28d42c};};exports[_0x284c('0xd')]=function(_0x2604bb,_0xea17aa,_0x579b49){if(!_['isUndefined'](_0x579b49)&&'string'===typeof _0x579b49&&!_[_0x284c('0xe')](_0x579b49)){if(!_[_0x284c('0xf')](_0xea17aa)&&_0x284c('0x10')===typeof _0xea17aa&&!_[_0x284c('0xe')](_0xea17aa)){return util[_0x284c('0x11')](_0x284c('0x12'),_0xea17aa,_0x579b49);}return util[_0x284c('0x11')](_0x284c('0x12'),_0x579b49,_0x579b49);}if(!_[_0x284c('0xf')](_0x2604bb)&&_0x284c('0x10')===typeof _0x2604bb&&!_[_0x284c('0xe')](_0x2604bb)){return _0x2604bb;}return _0x284c('0x13');};exports[_0x284c('0x14')]=function(_0x111c9d){if(_['isNil'](_0x111c9d)){return![];}return _0x111c9d;};exports[_0x284c('0x15')]=function(_0x40554c,_0x3038dc,_0x59e7ba,_0x508188,_0x1dcdec,_0x2f103d){var _0x26ad4d={'XMD-QUEUE':_0x3038dc[_0x284c('0x16')]?_0x3038dc[_0x284c('0x16')][_0x284c('0x17')]:'','XMD-CALLERID':_0x508188,'XMD-CALLERID-PREVIEW':_0x2f103d?util[_0x284c('0x11')](_0x284c('0x12'),_0x2f103d[_0x284c('0x18')],_0x2f103d[_0x284c('0x19')]):_0x508188,'XMD-DIALID':_0x1dcdec,'XMD-CONTACTID':_0x3038dc[_0x284c('0x1a')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x508188,'XMD-VOICEQUEUEID':_0x3038dc['VoiceQueueId'],'XMD-DIALCHANNEL':_0x59e7ba,'XMD-DIALTIMEOUT':_0x40554c[_0x284c('0x1b')]||0x1e,'XMD-DIALOPTIONS':util[_0x284c('0x11')](_0x284c('0x1c'),_0x40554c[_0x284c('0x1d')]?'g':'',_[_0x284c('0xe')](_0x40554c[_0x284c('0x1e')])?'':'U(xcally-mixmonitor-context)'),'XMD-DIALURL':_0x40554c['dialPreviewUrl']||'','XMD-AGI':_0x40554c[_0x284c('0x1f')]?util[_0x284c('0x11')](_0x284c('0x20'),ipAgi,_0x40554c[_0x284c('0x1f')]):_0x284c('0x21'),'XMD-AGIAFTER':_0x40554c[_0x284c('0x1d')]?util[_0x284c('0x11')](_0x284c('0x20'),ipAgi,_0x40554c[_0x284c('0x1d')]):_0x284c('0x21'),'XMD-ORIGINATECALLERIDNUM':_0x2f103d?_0x2f103d[_0x284c('0x22')]:'','XMD-ORIGINATECALLERIDNAME':_0x2f103d?_0x2f103d[_0x284c('0x23')]:'','XMD-DESTINATION':'xcally-motion-preview','SIPADDHEADER':_0x284c('0x24')};if(!_[_0x284c('0xe')](_0x40554c[_0x284c('0x1e')])){_0x26ad4d[util[_0x284c('0x11')]('%s',_0x284c('0x25'))]=_0x40554c[_0x284c('0x1e')];_0x26ad4d[util['format']('%s',_0x284c('0x26'))]=_0x1dcdec;}return _0x26ad4d;};exports[_0x284c('0x27')]=function(_0x2c826a){var _0x1852bf={};for(var _0x272bd1 in _0x2c826a){if(_0x2c826a[_0x284c('0x28')](_0x272bd1)){_0x1852bf[util['format']('%s',_[_0x284c('0x29')](_0x272bd1))]=_0x2c826a[_0x272bd1];}}return{'variables':_0x1852bf};};exports[_0x284c('0x2a')]=function(_0x47d733,_0x1e83e3){if(!_[_0x284c('0x2b')](_0x47d733)){if(_0x47d733[_0x284c('0x28')](_0x284c('0x2c'))){if(_0x47d733[_0x284c('0x2c')]>0x0){_0x47d733[_0x284c('0x2c')]-=0x1;}else{logger[_0x284c('0x7')]('[updateOriginated]\x20object\x20originated\x20is\x20negative',_0x1e83e3);}}}else{logger['error']('[updateOriginated]\x20is\x20null\x20or\x20undefined',_0x1e83e3);}};exports[_0x284c('0x2d')]=function(_0xa0b44a){var _0x56ed9c=moment()[_0x284c('0x11')](_0x284c('0x2e'));_0xa0b44a[_0x284c('0x2f')]=0xd;_0xa0b44a['statedesc']=_0x284c('0x30');_0xa0b44a['starttime']=_0x56ed9c;_0xa0b44a[_0x284c('0x31')]=_0x56ed9c;_0xa0b44a[_0x284c('0x32')]=_0x56ed9c;};exports[_0x284c('0x33')]=function(_0x2a7e89,_0x573b59,_0x4e14c1){var _0x2d1512=moment()[_0x284c('0x11')](_0x284c('0x2e'));_0x2a7e89[_0x284c('0x2f')]=_0x573b59;_0x2a7e89[_0x284c('0x34')]=_0x4e14c1;_0x2a7e89[_0x284c('0x31')]=_0x2d1512;_0x2a7e89[_0x284c('0x35')]=utils[_0x284c('0x36')](_0x2a7e89[_0x284c('0x31')],_0x2a7e89[_0x284c('0x37')]);};exports[_0x284c('0x38')]=function(_0x20d4ce,_0x215cb2,_0x2e5808){_0x20d4ce['membername']=_0x215cb2;_0x20d4ce[_0x284c('0x39')]=_0x2e5808;};exports['logCustomer']=function(_0x46a064,_0x5dd32d,_0x4c48e4){var _0x56eb04=moment()[_0x284c('0x11')](_0x284c('0x2e'));_0x46a064[_0x284c('0x2f')]=_0x5dd32d;_0x46a064[_0x284c('0x34')]=_0x4c48e4;_0x46a064[_0x284c('0x31')]=_0x46a064[_0x284c('0x31')]?_0x46a064[_0x284c('0x31')]:_0x56eb04;_0x46a064[_0x284c('0x32')]=_0x46a064['endtime']?_0x46a064[_0x284c('0x32')]:_0x56eb04;_0x46a064['ringtime']=utils[_0x284c('0x36')](_0x46a064[_0x284c('0x31')]||0x0,_0x46a064[_0x284c('0x37')]||0x0);_0x46a064[_0x284c('0x3a')]=_0x46a064[_0x284c('0x3b')]?utils[_0x284c('0x36')](_0x46a064[_0x284c('0x32')],_0x46a064[_0x284c('0x3b')]):0x0;};exports[_0x284c('0x3c')]=function(_0x34a3c5){return _0x34a3c5===_0x284c('0x3d');};exports[_0x284c('0x3e')]=function(_0xe91507,_0x222219,_0x264f1a,_0x187f3b,_0x1fa691){var _0x33d4e4=_0x187f3b?_0x284c('0x3f'):_0xe91507[_0x284c('0x18')];_0x33d4e4=_0x1fa691?_0x284c('0x40'):_0x33d4e4;return{'actionid':_0xe91507[_0x284c('0x41')],'action':_0x284c('0x42'),'channel':_0xe91507[_0x284c('0x43')],'callerid':util[_0x284c('0x11')](_0x284c('0x12'),_0x33d4e4,_0xe91507[_0x284c('0x19')]),'Exten':_0x284c('0x44'),'Context':_0x284c('0x45'),'Priority':'1','variable':_0x264f1a,'timeout':(_0x222219['timeout']||0x1e)*0x3e8,'async':!![],'channelid':_0xe91507[_0x284c('0x41')]};};exports[_0x284c('0x46')]=function(_0x356603){return _0x356603[_0x284c('0x47')]+_0x356603['countcongestionretry']+_0x356603[_0x284c('0x48')]+_0x356603[_0x284c('0x49')]+_0x356603[_0x284c('0x4a')];};exports[_0x284c('0x4b')]=function(_0x12d690){var _0xc26c7=_[_0x284c('0x4c')](_0x12d690);_0xc26c7['state']=0xf;_0xc26c7[_0x284c('0x34')]=_0x284c('0x4d');return _0xc26c7;};exports[_0x284c('0x4e')]=function(_0x3f9cf1,_0x283edc,_0x51ce79){var _0x38d1f8={};_0x38d1f8[_0x283edc]=_0x3f9cf1[_0x283edc];_0x38d1f8[_0x284c('0x4f')]=![];_0x38d1f8['scheduledat']=moment()['add'](_0x51ce79,_0x284c('0x50'))[_0x284c('0x11')]('YYYY-MM-DD\x20HH:mm:ss');_0x38d1f8[_0x284c('0x1a')]=_0x3f9cf1['ContactId'];_0x38d1f8[_0x284c('0x51')]=_0x3f9cf1[_0x284c('0x51')];_0x38d1f8['VoiceQueueId']=_0x3f9cf1[_0x284c('0x52')]||undefined;return _0x38d1f8;};exports['decrementTalkink']=function(_0x20cc33,_0x22be7d){if(!_[_0x284c('0x2b')](_0x20cc33)){if(_0x20cc33[_0x284c('0x53')]>0x0){_0x20cc33[_0x284c('0x53')]-=0x1;}else{logger['error'](_0x22be7d,_0x284c('0x54'));}}else{logger[_0x284c('0x7')](_0x22be7d,_0x284c('0x55'));}};exports[_0x284c('0x56')]=function(_0x26e5ee){if(_0x26e5ee<=0x0){return!![];}return![];};function buildObj(_0x2575a5,_0xc6e836,_0x41af95){_0x2575a5[_0x284c('0x57')]=_0xc6e836;_0x2575a5[_0x284c('0x17')]=_0x2575a5[_0x284c('0x58')];_0x2575a5[_0x284c('0x59')]=_0x2575a5[_0x284c('0x43')];_0x2575a5[_0x284c('0x5a')]=_0x284c('0x5b');if(_0x41af95){_0x2575a5['mandatoryDisposition']=_0x41af95[_0x284c('0x5c')];}return _0x2575a5;}exports[_0x284c('0x5d')]=buildObj;exports['agentReadyId']=function(_0x46cf4d){var _0x5be1eb=[];for(var _0x2b338a in _0x46cf4d){if(_0x46cf4d[_0x284c('0x28')](_0x2b338a)){if(!_['isNil'](_0x46cf4d[_0x2b338a])&&_0x46cf4d[_0x2b338a][_0x284c('0x2f')]===_0x284c('0x5e')&&_0x46cf4d[_0x2b338a][_0x284c('0x5f')]==='reachable'){_0x5be1eb['push'](_0x46cf4d[_0x2b338a]['id']);}}}return _0x5be1eb;};exports[_0x284c('0x60')]=function(_0x1e810e){var _0x15f10a=moment()[_0x284c('0x61')](0x0);var _0x41c4e7=moment(_0x1e810e)[_0x284c('0x61')](0x0);return _0x15f10a['diff'](_0x41c4e7,'seconds');};exports[_0x284c('0x62')]=function(_0x549284){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x549284[_0x284c('0x1a')],'ListId':_0x549284[_0x284c('0x51')],'VoiceQueueId':_0x549284[_0x284c('0x52')]||undefined,'CampaignId':_0x549284[_0x284c('0x63')]||undefined};};exports['filterKey']=function(_0x51d4f6){if(_0x51d4f6==='uniqueid'||_0x51d4f6===_0x284c('0x64')||_0x51d4f6===_0x284c('0x58')||_0x51d4f6===_0x284c('0x65')||_0x51d4f6===_0x284c('0x66')||_0x51d4f6==='dialAnswer'||_0x51d4f6===_0x284c('0x67')||_0x51d4f6==='channelAgent'||_0x51d4f6===_0x284c('0x18')||_0x51d4f6===_0x284c('0x4f')||_0x51d4f6===_0x284c('0x19')||_0x51d4f6==='scheduledat'||_0x51d4f6===_0x284c('0x47')||_0x51d4f6==='countcongestionretry'||_0x51d4f6===_0x284c('0x48')||_0x51d4f6===_0x284c('0x68')||_0x51d4f6===_0x284c('0x69')||_0x51d4f6==='callbackuniqueid'||_0x51d4f6==='callbackat'||_0x51d4f6===_0x284c('0x6a')||_0x51d4f6===_0x284c('0x1a')||_0x51d4f6===_0x284c('0x51')||_0x51d4f6===_0x284c('0x39')||_0x51d4f6==='VoiceQueueId'||_0x51d4f6===_0x284c('0x6b')||_0x51d4f6==='xmd-voicequeueid'||_0x51d4f6===_0x284c('0x6c')||_0x51d4f6==='xmd-phone'||_0x51d4f6===_0x284c('0x6d')||_0x51d4f6===_0x284c('0x6e')||_0x51d4f6==='xmd-dialtimeout'||_0x51d4f6==='xmd-dialoptions'||_0x51d4f6===_0x284c('0x6f')||_0x51d4f6===_0x284c('0x70')||_0x51d4f6===_0x284c('0x71')||_0x51d4f6===_0x284c('0x72')||_0x51d4f6===_0x284c('0x73')||_0x51d4f6===_0x284c('0x74')||_0x51d4f6===_0x284c('0x75')||_0x51d4f6===_0x284c('0x76')||_0x51d4f6===_0x284c('0x77')||_0x51d4f6==='rtpaudioqosjitter'||_0x51d4f6===_0x284c('0x78')||_0x51d4f6===_0x284c('0x79')||_0x51d4f6==='rtpaudioqoslossbridged'||_0x51d4f6===_0x284c('0x7a')||_0x51d4f6==='rtpaudioqosrttbridged'||_0x51d4f6===_0x284c('0x76')||_0x51d4f6==='rtpaudioqosbridged'||_0x51d4f6===_0x284c('0x7b')||_0x51d4f6===_0x284c('0x78')||_0x51d4f6==='rtpaudioqosloss'||_0x51d4f6===_0x284c('0x7c')||_0x51d4f6==='rtpaudioqosrtt'||_0x51d4f6==='rtpaudioqosrttbridged'||_0x51d4f6===_0x284c('0x7d')||_0x51d4f6==='bridgepvtcallid'||_0x51d4f6===_0x284c('0x2f')||_0x51d4f6===_0x284c('0x34')){return![];}return!![];};exports[_0x284c('0x7e')]=function(_0x50e66a,_0x44e8fb){var _0x44a03d,_0x4b5fbe,_0x17fe69;if(_0x44e8fb<=0x0){_0x44e8fb=0x1;}_0x44a03d=new RegExp(_0x284c('0x7f')+_0x44e8fb+'}$');_0x4b5fbe=Math[_0x284c('0x80')](0xa,_0x44e8fb-0x1);_0x17fe69=Math['pow'](0xa,_0x44e8fb)-0x1;return util[_0x284c('0x11')]('%s',_[_0x284c('0x81')](_0x50e66a,_0x44a03d,_['random'](_0x4b5fbe,_0x17fe69)));};exports[_0x284c('0x82')]=function(_0x3b9a63){var _0x3af715=_0x3b9a63[_0x284c('0x83')](/"(.*?)"/);return _0x3af715?_0x3af715[0x1]:_0x3b9a63;};exports[_0x284c('0x84')]=function(_0x3a4e9b){var _0x41351d=_0x3a4e9b[_0x284c('0x83')](/<(.*?)>/);return _0x41351d?_0x41351d[0x1]:_0x3a4e9b;};function buildNoAnswerEventPayload(_0x5b2e9a,_0x1285b6){var _0x418f83=buildObj(_0x5b2e9a,_0x284c('0x85'));if(!_[_0x284c('0xe')](_0x1285b6[_0x284c('0x86')])){Object[_0x284c('0x87')](_0x1285b6[_0x284c('0x86')])['forEach'](function(_0xb3040f){_0x418f83[_0xb3040f[_0x284c('0x88')]()]=_0x1285b6[_0x284c('0x86')][_0xb3040f];});}return _0x418f83;}exports[_0x284c('0x89')]=buildNoAnswerEventPayload; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 3f1108f..de780c3 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 _0x858d=['queuepause','reload','voicequeuechannel','voicechannel','voicequeuechannelhangup','voicequeuechannelredirect','queueadd','string','number','boolean','queueremove'];(function(_0x29a84f,_0xf6e497){var _0x2b92f2=function(_0x3cf794){while(--_0x3cf794){_0x29a84f['push'](_0x29a84f['shift']());}};_0x2b92f2(++_0xf6e497);}(_0x858d,0x8a));var _0xd858=function(_0x36dd01,_0xd09fb){_0x36dd01=_0x36dd01-0x0;var _0x5cbcf3=_0x858d[_0x36dd01];return _0x5cbcf3;};'use strict';exports[_0xd858('0x0')]={'queue':{'type':_0xd858('0x1'),'required':!![]},'interface':{'type':'string','required':!![]},'membername':{'type':_0xd858('0x1'),'required':!![]},'penalty':{'type':_0xd858('0x2'),'required':![]},'paused':{'type':_0xd858('0x3'),'required':![]}};exports[_0xd858('0x4')]={'queue':{'type':_0xd858('0x1'),'required':!![]},'interface':{'type':_0xd858('0x1'),'required':!![]}};exports[_0xd858('0x5')]={'interface':{'type':_0xd858('0x1'),'required':!![]},'paused':{'type':_0xd858('0x3')},'reason':{'type':_0xd858('0x1'),'required':![]}};exports[_0xd858('0x6')]={'module':{'type':'string','required':![]}};exports[_0xd858('0x7')]={'uniqueid':{'type':_0xd858('0x1'),'required':!![]}};exports[_0xd858('0x8')]={'uniqueid':{'type':_0xd858('0x1'),'required':!![]},'filename':{'type':_0xd858('0x1')},'format':{'type':_0xd858('0x1')},'mixmonitorid':{'type':_0xd858('0x1')}};exports[_0xd858('0x9')]={'uniqueid':{'type':_0xd858('0x1'),'required':!![]}};exports[_0xd858('0xa')]={'uniqueid':{'type':_0xd858('0x1'),'required':!![]},'exten':{'type':_0xd858('0x1'),'required':!![]},'context':{'type':_0xd858('0x1')}}; \ No newline at end of file +var _0x15f8=['voicequeuechannel','voicechannel','voicequeuechannelhangup','voicequeuechannelredirect','queueadd','string','boolean','queueremove'];(function(_0xbedd4a,_0x42e8ab){var _0x2b072c=function(_0x1341a7){while(--_0x1341a7){_0xbedd4a['push'](_0xbedd4a['shift']());}};_0x2b072c(++_0x42e8ab);}(_0x15f8,0x174));var _0x815f=function(_0x1ce18b,_0x256e87){_0x1ce18b=_0x1ce18b-0x0;var _0x3d012c=_0x15f8[_0x1ce18b];return _0x3d012c;};'use strict';exports[_0x815f('0x0')]={'queue':{'type':_0x815f('0x1'),'required':!![]},'interface':{'type':_0x815f('0x1'),'required':!![]},'membername':{'type':'string','required':!![]},'penalty':{'type':'number','required':![]},'paused':{'type':_0x815f('0x2'),'required':![]}};exports[_0x815f('0x3')]={'queue':{'type':_0x815f('0x1'),'required':!![]},'interface':{'type':_0x815f('0x1'),'required':!![]}};exports['queuepause']={'interface':{'type':_0x815f('0x1'),'required':!![]},'paused':{'type':_0x815f('0x2')},'reason':{'type':'string','required':![]}};exports['reload']={'module':{'type':_0x815f('0x1'),'required':![]}};exports[_0x815f('0x4')]={'uniqueid':{'type':_0x815f('0x1'),'required':!![]}};exports[_0x815f('0x5')]={'uniqueid':{'type':_0x815f('0x1'),'required':!![]},'filename':{'type':_0x815f('0x1')},'format':{'type':_0x815f('0x1')},'mixmonitorid':{'type':_0x815f('0x1')}};exports[_0x815f('0x6')]={'uniqueid':{'type':_0x815f('0x1'),'required':!![]}};exports[_0x815f('0x7')]={'uniqueid':{'type':_0x815f('0x1'),'required':!![]},'exten':{'type':_0x815f('0x1'),'required':!![]},'context':{'type':_0x815f('0x1')}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index becb6aa..16ec493 100644 --- a/server/services/ami/realtime/index.js +++ b/server/services/ami/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdb28=['initTriggers','triggers','initTemplates','initZendeskAccounts','zendeskAccounts','initFreshdeskAccounts','initZohoAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','merge','groupBy','uniqueid','queuecallerexit','queuecallerabandon','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','diff','queuecallercomplete','queuecallerleaveAt','initVoiceCallReports','outbound','duration','disposition','ANSWERED','billableseconds','initCampaigns','dialQueueProject','SquareProject','initVoiceExtensions','initCampaignHopperHistory','initVoiceQueues','exports','lodash','moment','util','../model/agent','../model/trunk','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/zendeskAccount','../model/salesforceAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','telephones','trunks','voiceQueues','campaigns','templates','voiceExtensions','channels','queueChannels','outboundChannels','timers','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','hasOwnProperty','format','SIP/%s','name','isNil','interface','sumDuration','sumBillable','isEmpty','ivrAnswerCallsDay','total','answered','unmanaged','abandoned','sumHoldTime','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundCongestionCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundRejectCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','initAgents','agents','length','isUndefined','mergeFromDatabase','initTelephones','initTrunks'];(function(_0x12087f,_0x237c3f){var _0x2077bc=function(_0x5ba6c3){while(--_0x5ba6c3){_0x12087f['push'](_0x12087f['shift']());}};_0x2077bc(++_0x237c3f);}(_0xdb28,0x106));var _0x8db2=function(_0x3907e3,_0x368f4b){_0x3907e3=_0x3907e3-0x0;var _0x6a8704=_0xdb28[_0x3907e3];return _0x6a8704;};'use strict';var _=require(_0x8db2('0x0'));var moment=require(_0x8db2('0x1'));var util=require(_0x8db2('0x2'));var Agent=require(_0x8db2('0x3'));var Telephone=require('../model/telephone');var Trunk=require(_0x8db2('0x4'));var VoiceQueue=require(_0x8db2('0x5'));var Trigger=require(_0x8db2('0x6'));var Template=require(_0x8db2('0x7'));var Campaign=require(_0x8db2('0x8'));var VoiceExtension=require('../model/voiceExtension');var ZendeskAccount=require(_0x8db2('0x9'));var SalesforceAccount=require(_0x8db2('0xa'));var FreshdeskAccount=require('../model/freshdeskAccount');var SugarcrmAccount=require('../model/sugarcrmAccount');var ZohoAccount=require(_0x8db2('0xb'));var DeskAccount=require(_0x8db2('0xc'));var VtigerAccount=require(_0x8db2('0xd'));var ServicenowAccount=require(_0x8db2('0xe'));var Dynamics365Account=require(_0x8db2('0xf'));var FreshsalesAccount=require(_0x8db2('0x10'));var FaxAccount=require(_0x8db2('0x11'));function Realtime(){this['agents']={};this[_0x8db2('0x12')]={};this[_0x8db2('0x13')]={};this[_0x8db2('0x14')]={};this['triggers']={};this[_0x8db2('0x15')]={};this[_0x8db2('0x16')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0x8db2('0x17')]={};this[_0x8db2('0x18')]={};this[_0x8db2('0x19')]={};this[_0x8db2('0x1a')]={};this[_0x8db2('0x1b')]={};this['settings']={};this['zendeskAccounts']={};this[_0x8db2('0x1c')]={};this[_0x8db2('0x1d')]={};this[_0x8db2('0x1e')]={};this[_0x8db2('0x1f')]={};this[_0x8db2('0x20')]={};this[_0x8db2('0x21')]={};this[_0x8db2('0x22')]={};this[_0x8db2('0x23')]={};this[_0x8db2('0x24')]={};this[_0x8db2('0x25')]={};}function freeIsNotKey(_0x5489a9,_0x13b0f5,_0x24da1b){var _0x48101e=_[_0x8db2('0x26')](_0x5489a9,function(_0x44957d){return _0x44957d[_0x24da1b];});for(var _0x21db8c in _0x13b0f5){if(_0x13b0f5[_0x8db2('0x27')](_0x21db8c)){if(!_0x48101e[_0x21db8c]){delete _0x13b0f5[_0x21db8c];}}}}function freeIsNotKeySip(_0x2efd06,_0x46ce14){var _0x51d60d=_['mapKeys'](_0x2efd06,function(_0x77789){return util[_0x8db2('0x28')](_0x8db2('0x29'),_0x77789[_0x8db2('0x2a')]);});for(var _0x58562e in _0x46ce14){if(_0x46ce14[_0x8db2('0x27')](_0x58562e)){if(!_0x51d60d[_0x58562e]){delete _0x46ce14[_0x58562e];}}}}function freeIsNotKeyAgent(_0x36a9ff,_0x260940){var _0x297ba3=_[_0x8db2('0x26')](_0x36a9ff,function(_0x597260){var _0x124467=_[_0x8db2('0x2b')](_0x597260[_0x8db2('0x2c')])?util[_0x8db2('0x28')](_0x8db2('0x29'),_0x597260[_0x8db2('0x2a')]):_0x597260[_0x8db2('0x2c')];return _0x124467;});for(var _0x5c6614 in _0x260940){if(_0x260940[_0x8db2('0x27')](_0x5c6614)){if(!_0x297ba3[_0x5c6614]){delete _0x260940[_0x5c6614];}}}}function clearVoiceCallReports(_0x4f6516){_0x4f6516['total']=0x0;_0x4f6516['answered']=0x0;_0x4f6516['sumHoldTime']=0x0;_0x4f6516[_0x8db2('0x2d')]=0x0;_0x4f6516[_0x8db2('0x2e')]=0x0;}function clearCampaigns(_0x3be281){if(!_[_0x8db2('0x2f')](_0x3be281)){for(var _0x145328 in _0x3be281){if(_0x3be281[_0x8db2('0x27')](_0x145328)){_0x3be281[_0x145328]['ivrTotalCallsDays']=0x0;_0x3be281[_0x145328][_0x8db2('0x30')]=0x0;}}}}function clearVoiceQueues(_0x372311){if(!_[_0x8db2('0x2f')](_0x372311)){for(var _0x8b7cec in _0x372311){if(_0x372311['hasOwnProperty'](_0x8b7cec)){_0x372311[_0x8b7cec][_0x8db2('0x31')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x32')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x33')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x34')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x35')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x2d')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x2e')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x36')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x37')]=0x0;_0x372311[_0x8b7cec]['outboundBusyCallsDay']=0x0;_0x372311[_0x8b7cec][_0x8db2('0x38')]=0x0;_0x372311[_0x8b7cec]['outboundNoSuchCallsDay']=0x0;_0x372311[_0x8b7cec]['outboundUnknownCallsDay']=0x0;_0x372311[_0x8b7cec][_0x8db2('0x39')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x3a')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x3b')]=0x0;_0x372311[_0x8b7cec]['outboundOriginateFailureCallsDay']=0x0;_0x372311[_0x8b7cec][_0x8db2('0x3c')]=0x0;_0x372311[_0x8b7cec]['outboundReCallsDay']=0x0;_0x372311[_0x8b7cec][_0x8db2('0x36')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x3d')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x3e')]=!![];}}}}Realtime['prototype']['mergeFromDatabase']=function(_0x35d337,_0x1a460b){for(var _0x4df530 in _0x1a460b){if(_0x35d337['hasOwnProperty'](_0x4df530)){_0x35d337[_0x4df530]=_0x1a460b[_0x4df530];}}};Realtime[_0x8db2('0x3f')][_0x8db2('0x40')]=function(){var _0xc884a=this;return function(_0x2a2d65){if(_0x2a2d65){freeIsNotKeyAgent(_0x2a2d65,_0xc884a[_0x8db2('0x41')]);for(var _0xd39848=0x0,_0x101711={};_0xd39848<_0x2a2d65[_0x8db2('0x42')];_0xd39848+=0x1){_0x101711=_0x2a2d65[_0xd39848];var _0x46e0c8=_[_0x8db2('0x2b')](_0x101711['interface'])?util[_0x8db2('0x28')](_0x8db2('0x29'),_0x101711['name']):_0x101711[_0x8db2('0x2c')];if(_[_0x8db2('0x43')](_0xc884a['agents'][_0x46e0c8])){_0xc884a['agents'][_0x46e0c8]=new Agent(_0x101711);}else{_0xc884a[_0x8db2('0x44')](_0xc884a['agents'][_0x46e0c8],_0x101711);}}}return _0xc884a[_0x8db2('0x41')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x45')]=function(){var _0x22c896=this;return function(_0x5cc419){if(_0x5cc419){freeIsNotKeySip(_0x5cc419,_0x22c896[_0x8db2('0x12')]);for(var _0x5e34e0=0x0,_0x227a08={};_0x5e34e0<_0x5cc419[_0x8db2('0x42')];_0x5e34e0+=0x1){_0x227a08=_0x5cc419[_0x5e34e0];if(_[_0x8db2('0x43')](_0x22c896[_0x8db2('0x12')][util['format']('SIP/%s',_0x227a08[_0x8db2('0x2a')])])){_0x22c896[_0x8db2('0x12')][util['format'](_0x8db2('0x29'),_0x227a08[_0x8db2('0x2a')])]=new Telephone(_0x227a08);}else{_0x22c896[_0x8db2('0x44')](_0x22c896['telephones'][util[_0x8db2('0x28')](_0x8db2('0x29'),_0x227a08[_0x8db2('0x2a')])],_0x227a08);}}}return _0x22c896[_0x8db2('0x12')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x46')]=function(){var _0x380046=this;return function(_0x1575ea){if(_0x1575ea){freeIsNotKeySip(_0x1575ea,_0x380046[_0x8db2('0x13')]);for(var _0x63c561=0x0,_0x21cf7c={};_0x63c561<_0x1575ea[_0x8db2('0x42')];_0x63c561+=0x1){_0x21cf7c=_0x1575ea[_0x63c561];if(_[_0x8db2('0x43')](_0x380046['trunks'][util[_0x8db2('0x28')](_0x8db2('0x29'),_0x21cf7c['name'])])){_0x380046['trunks'][util[_0x8db2('0x28')]('SIP/%s',_0x21cf7c[_0x8db2('0x2a')])]=new Trunk(_0x21cf7c);}else{_0x380046[_0x8db2('0x44')](_0x380046[_0x8db2('0x13')][util[_0x8db2('0x28')](_0x8db2('0x29'),_0x21cf7c[_0x8db2('0x2a')])],_0x21cf7c);}}}return _0x380046[_0x8db2('0x13')];};};Realtime['prototype'][_0x8db2('0x47')]=function(){var _0x3d44de=this;return function(_0x40c69e){if(_0x40c69e){freeIsNotKey(_0x40c69e,_0x3d44de[_0x8db2('0x48')],'id');for(var _0x482b26=0x0,_0x424c27={};_0x482b26<_0x40c69e[_0x8db2('0x42')];_0x482b26+=0x1){_0x424c27=_0x40c69e[_0x482b26];if(_[_0x8db2('0x43')](_0x3d44de[_0x8db2('0x48')][_0x424c27['id']])){_0x3d44de['triggers'][_0x424c27['id']]=new Trigger(_0x424c27);}else{_0x3d44de[_0x8db2('0x44')](_0x3d44de['triggers'][_0x424c27['id']],_0x424c27);}}}return _0x3d44de[_0x8db2('0x48')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x49')]=function(){var _0x4d2164=this;return function(_0x4b0e72){if(_0x4b0e72){freeIsNotKey(_0x4b0e72,_0x4d2164[_0x8db2('0x16')],'id');for(var _0x47c556=0x0,_0x173cc7={};_0x47c556<_0x4b0e72[_0x8db2('0x42')];_0x47c556+=0x1){_0x173cc7=_0x4b0e72[_0x47c556];if(_[_0x8db2('0x43')](_0x4d2164[_0x8db2('0x16')][_0x173cc7['id']])){_0x4d2164[_0x8db2('0x16')][_0x173cc7['id']]=new Template(_0x173cc7);}else{_0x4d2164[_0x8db2('0x44')](_0x4d2164[_0x8db2('0x16')][_0x173cc7['id']],_0x173cc7);}}}return _0x4d2164[_0x8db2('0x16')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x4a')]=function(){var _0x1362ed=this;return function(_0x36f9d6){if(_0x36f9d6){freeIsNotKey(_0x36f9d6,_0x1362ed['zendeskAccounts'],'id');for(var _0x449109=0x0,_0x2ada52={};_0x449109<_0x36f9d6[_0x8db2('0x42')];_0x449109+=0x1){_0x2ada52=_0x36f9d6[_0x449109];if(_[_0x8db2('0x43')](_0x1362ed['zendeskAccounts'][_0x2ada52['id']])){_0x1362ed['zendeskAccounts'][_0x2ada52['id']]=new ZendeskAccount(_0x2ada52);}else{_0x1362ed[_0x8db2('0x44')](_0x1362ed[_0x8db2('0x4b')][_0x2ada52['id']],_0x2ada52);}}}return _0x1362ed[_0x8db2('0x4b')];};};Realtime['prototype']['initSalesforceAccounts']=function(){var _0x494d6e=this;return function(_0x44ac56){if(_0x44ac56){freeIsNotKey(_0x44ac56,_0x494d6e[_0x8db2('0x1c')],'id');for(var _0x55c7dd=0x0,_0x383fa1={};_0x55c7dd<_0x44ac56[_0x8db2('0x42')];_0x55c7dd+=0x1){_0x383fa1=_0x44ac56[_0x55c7dd];if(_[_0x8db2('0x43')](_0x494d6e[_0x8db2('0x1c')][_0x383fa1['id']])){_0x494d6e['salesforceAccounts'][_0x383fa1['id']]=new SalesforceAccount(_0x383fa1);}else{_0x494d6e['mergeFromDatabase'](_0x494d6e[_0x8db2('0x1c')][_0x383fa1['id']],_0x383fa1);}}}return _0x494d6e[_0x8db2('0x1c')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x4c')]=function(){var _0x3daed6=this;return function(_0x2bf408){if(_0x2bf408){freeIsNotKey(_0x2bf408,_0x3daed6[_0x8db2('0x1e')],'id');for(var _0x3ca2a7=0x0,_0x4187d6={};_0x3ca2a7<_0x2bf408[_0x8db2('0x42')];_0x3ca2a7+=0x1){_0x4187d6=_0x2bf408[_0x3ca2a7];if(_[_0x8db2('0x43')](_0x3daed6[_0x8db2('0x1e')][_0x4187d6['id']])){_0x3daed6[_0x8db2('0x1e')][_0x4187d6['id']]=new FreshdeskAccount(_0x4187d6);}else{_0x3daed6[_0x8db2('0x44')](_0x3daed6[_0x8db2('0x1e')][_0x4187d6['id']],_0x4187d6);}}}return _0x3daed6['freshdeskAccounts'];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x4d')]=function(){var _0x579317=this;return function(_0x27b644){if(_0x27b644){freeIsNotKey(_0x27b644,_0x579317[_0x8db2('0x1f')],'id');for(var _0x3af298=0x0,_0x547215={};_0x3af298<_0x27b644[_0x8db2('0x42')];_0x3af298+=0x1){_0x547215=_0x27b644[_0x3af298];if(_[_0x8db2('0x43')](_0x579317[_0x8db2('0x1f')][_0x547215['id']])){_0x579317[_0x8db2('0x1f')][_0x547215['id']]=new ZohoAccount(_0x547215);}else{_0x579317[_0x8db2('0x44')](_0x579317['zohoAccounts'][_0x547215['id']],_0x547215);}}}return _0x579317[_0x8db2('0x1f')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x4e')]=function(){var _0x58bb60=this;return function(_0x1e7d1a){if(_0x1e7d1a){freeIsNotKey(_0x1e7d1a,_0x58bb60[_0x8db2('0x20')],'id');for(var _0x33dddd=0x0,_0x7b0de8={};_0x33dddd<_0x1e7d1a[_0x8db2('0x42')];_0x33dddd+=0x1){_0x7b0de8=_0x1e7d1a[_0x33dddd];if(_[_0x8db2('0x43')](_0x58bb60[_0x8db2('0x20')][_0x7b0de8['id']])){_0x58bb60['deskAccounts'][_0x7b0de8['id']]=new DeskAccount(_0x7b0de8);}else{_0x58bb60[_0x8db2('0x44')](_0x58bb60[_0x8db2('0x20')][_0x7b0de8['id']],_0x7b0de8);}}}return _0x58bb60['deskAccounts'];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x4f')]=function(){var _0x533e41=this;return function(_0x107bbe){if(_0x107bbe){freeIsNotKey(_0x107bbe,_0x533e41[_0x8db2('0x1d')],'id');for(var _0x63e8f7=0x0,_0x30f4f3={};_0x63e8f7<_0x107bbe[_0x8db2('0x42')];_0x63e8f7+=0x1){_0x30f4f3=_0x107bbe[_0x63e8f7];if(_[_0x8db2('0x43')](_0x533e41[_0x8db2('0x1d')][_0x30f4f3['id']])){_0x533e41[_0x8db2('0x1d')][_0x30f4f3['id']]=new SugarcrmAccount(_0x30f4f3);}else{_0x533e41[_0x8db2('0x44')](_0x533e41[_0x8db2('0x1d')][_0x30f4f3['id']],_0x30f4f3);}}}return _0x533e41[_0x8db2('0x1d')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x50')]=function(){var _0x1ce89f=this;return function(_0x64ec90){if(_0x64ec90){freeIsNotKey(_0x64ec90,_0x1ce89f[_0x8db2('0x21')],'id');for(var _0x4a20a7=0x0,_0xe0c3e={};_0x4a20a7<_0x64ec90[_0x8db2('0x42')];_0x4a20a7+=0x1){_0xe0c3e=_0x64ec90[_0x4a20a7];if(_[_0x8db2('0x43')](_0x1ce89f[_0x8db2('0x21')][_0xe0c3e['id']])){_0x1ce89f[_0x8db2('0x21')][_0xe0c3e['id']]=new VtigerAccount(_0xe0c3e);}else{_0x1ce89f['mergeFromDatabase'](_0x1ce89f[_0x8db2('0x21')][_0xe0c3e['id']],_0xe0c3e);}}}return _0x1ce89f[_0x8db2('0x21')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x51')]=function(){var _0x2ad70f=this;return function(_0x348da8){if(_0x348da8){freeIsNotKey(_0x348da8,_0x2ad70f[_0x8db2('0x22')],'id');for(var _0x2c7b04=0x0,_0x24cfe9={};_0x2c7b04<_0x348da8[_0x8db2('0x42')];_0x2c7b04+=0x1){_0x24cfe9=_0x348da8[_0x2c7b04];if(_[_0x8db2('0x43')](_0x2ad70f[_0x8db2('0x22')][_0x24cfe9['id']])){_0x2ad70f[_0x8db2('0x22')][_0x24cfe9['id']]=new ServicenowAccount(_0x24cfe9);}else{_0x2ad70f[_0x8db2('0x44')](_0x2ad70f[_0x8db2('0x22')][_0x24cfe9['id']],_0x24cfe9);}}}return _0x2ad70f[_0x8db2('0x22')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x52')]=function(){var _0x5a719f=this;return function(_0x3273dd){if(_0x3273dd){freeIsNotKey(_0x3273dd,_0x5a719f['dynamics365Accounts'],'id');for(var _0x364176=0x0,_0x570c53={};_0x364176<_0x3273dd[_0x8db2('0x42')];_0x364176+=0x1){_0x570c53=_0x3273dd[_0x364176];if(_[_0x8db2('0x43')](_0x5a719f[_0x8db2('0x23')][_0x570c53['id']])){_0x5a719f[_0x8db2('0x23')][_0x570c53['id']]=new Dynamics365Account(_0x570c53);}else{_0x5a719f[_0x8db2('0x44')](_0x5a719f['dynamics365Accounts'][_0x570c53['id']],_0x570c53);}}}return _0x5a719f['dynamics365Accounts'];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x53')]=function(){var _0x21ec87=this;return function(_0x3ba1d2){if(_0x3ba1d2){freeIsNotKey(_0x3ba1d2,_0x21ec87[_0x8db2('0x24')],'id');for(var _0x1f28d2=0x0,_0x3e3de3={};_0x1f28d2<_0x3ba1d2[_0x8db2('0x42')];_0x1f28d2+=0x1){_0x3e3de3=_0x3ba1d2[_0x1f28d2];if(_['isUndefined'](_0x21ec87[_0x8db2('0x24')][_0x3e3de3['id']])){_0x21ec87[_0x8db2('0x24')][_0x3e3de3['id']]=new FreshsalesAccount(_0x3e3de3);}else{_0x21ec87[_0x8db2('0x44')](_0x21ec87[_0x8db2('0x24')][_0x3e3de3['id']],_0x3e3de3);}}}return _0x21ec87[_0x8db2('0x24')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x54')]=function(){var _0x20caf0=this;return function(_0x4938bb){for(var _0x54318c=0x0;_0x54318c<_0x4938bb[_0x8db2('0x42')];_0x54318c+=0x1){_[_0x8db2('0x55')](_0x20caf0[_0x8db2('0x14')][_0x4938bb[_0x54318c][_0x8db2('0x2a')]],_0x4938bb[_0x54318c]);}return _0x20caf0[_0x8db2('0x14')];};};Realtime['prototype']['initVoiceQueueReports']=function(){var _0x3611da=this;return function(_0x364807){clearVoiceQueues(_0x3611da['voiceQueues']);if(_0x364807){_0x364807=_[_0x8db2('0x56')](_0x364807,_0x8db2('0x57'));for(var _0x1ab84c in _0x364807){if(_0x364807['hasOwnProperty'](_0x1ab84c)){for(var _0x26523b=0x0;_0x26523b<_0x364807[_0x1ab84c][_0x8db2('0x42')];_0x26523b+=0x1){var _0x2cf731=_0x364807[_0x1ab84c][_0x26523b]['queue'];if(_0x3611da[_0x8db2('0x14')][_0x2cf731]){if(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x58')]){_0x3611da[_0x8db2('0x14')][_0x2cf731][_0x8db2('0x33')]+=0x1;}if(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x59')]){_0x3611da['voiceQueues'][_0x2cf731][_0x8db2('0x34')]+=0x1;}_0x3611da[_0x8db2('0x14')][_0x2cf731][_0x8db2('0x35')]+=moment(_0x364807[_0x1ab84c][_0x26523b]['queuecallerleaveAt'])['diff'](moment(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x5a')]),_0x8db2('0x5b'))||0x0;if(_0x26523b===_0x364807[_0x1ab84c]['length']-0x1){_0x3611da[_0x8db2('0x14')][_0x2cf731][_0x8db2('0x2d')]+=moment(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x5c')]||_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x5d')]||_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x5e')])[_0x8db2('0x5f')](moment(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x5a')]),_0x8db2('0x5b'))||0x0;_0x3611da[_0x8db2('0x14')][_0x2cf731][_0x8db2('0x31')]+=0x1;if(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x60')]){_0x3611da[_0x8db2('0x14')][_0x2cf731][_0x8db2('0x32')]+=0x1;_0x3611da['voiceQueues'][_0x2cf731][_0x8db2('0x2e')]+=moment(_0x364807[_0x1ab84c][_0x26523b]['queuecallercompleteAt'])[_0x8db2('0x5f')](moment(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x61')]),'seconds')||0x0;}}else{_0x3611da[_0x8db2('0x14')][_0x2cf731][_0x8db2('0x2d')]+=_0x3611da['voiceQueues'][_0x2cf731][_0x8db2('0x35')]||0x0;}}}}}}return _0x3611da[_0x8db2('0x14')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x62')]=function(){var _0x242379=this;return function(_0x31a095){clearVoiceCallReports(_0x242379[_0x8db2('0x63')]);if(_0x31a095){for(var _0x3ac0fa=0x0;_0x3ac0fa<_0x31a095[_0x8db2('0x42')];_0x3ac0fa+=0x1){_0x242379['outbound']['total']+=0x1;_0x242379[_0x8db2('0x63')]['sumDuration']+=_0x31a095[_0x3ac0fa][_0x8db2('0x64')];if(_0x31a095[_0x3ac0fa][_0x8db2('0x65')]===_0x8db2('0x66')){_0x242379['outbound'][_0x8db2('0x32')]+=0x1;_0x242379[_0x8db2('0x63')][_0x8db2('0x35')]+=_0x31a095[_0x3ac0fa]['duration']-_0x31a095[_0x3ac0fa][_0x8db2('0x67')]||0x0;_0x242379[_0x8db2('0x63')][_0x8db2('0x2e')]+=_0x31a095[_0x3ac0fa][_0x8db2('0x67')];}}}return _0x242379['outbound'];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x68')]=function(){var _0x299640=this;return function(_0x1edb1a){if(_0x1edb1a){freeIsNotKey(_0x1edb1a,_0x299640[_0x8db2('0x15')],_0x8db2('0x2a'));for(var _0x1aadfb=0x0,_0x3682bf={};_0x1aadfb<_0x1edb1a[_0x8db2('0x42')];_0x1aadfb+=0x1){_0x3682bf=_0x1edb1a[_0x1aadfb];if(_[_0x8db2('0x43')](_0x299640[_0x8db2('0x15')][_0x3682bf['name']])){_0x299640[_0x8db2('0x15')][_0x3682bf[_0x8db2('0x2a')]]=new Campaign(_0x3682bf);}else{_0x299640[_0x8db2('0x44')](_0x299640['campaigns'][_0x3682bf['name']],_0x3682bf);_0x299640['campaigns'][_0x3682bf[_0x8db2('0x2a')]][_0x8db2('0x69')]=_0x3682bf[_0x8db2('0x6a')]?_0x3682bf[_0x8db2('0x6a')][_0x8db2('0x2a')]:undefined;}}}return _0x299640[_0x8db2('0x15')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x6b')]=function(){var _0x3b1929=this;return function(_0x37cf6d){if(_0x37cf6d){freeIsNotKey(_0x37cf6d,_0x3b1929[_0x8db2('0x17')],'id');for(var _0x4d0ff6=0x0,_0x360a06={};_0x4d0ff6<_0x37cf6d[_0x8db2('0x42')];_0x4d0ff6+=0x1){_0x360a06=_0x37cf6d[_0x4d0ff6];if(_[_0x8db2('0x43')](_0x3b1929[_0x8db2('0x17')][_0x360a06['id']])){_0x3b1929['voiceExtensions'][_0x360a06['id']]=new VoiceExtension(_0x360a06);}else{_0x3b1929['mergeFromDatabase'](_0x3b1929[_0x8db2('0x17')][_0x360a06['id']],_0x360a06);}}}return _0x3b1929[_0x8db2('0x17')];};};Realtime['prototype'][_0x8db2('0x6c')]=function(){var _0x121f31=this;return function(_0x9132b4){clearCampaigns(_0x121f31['campaigns']);for(var _0x5dc46c=0x0;_0x5dc46c<_0x9132b4['length'];_0x5dc46c+=0x1){_[_0x8db2('0x55')](_0x121f31[_0x8db2('0x15')][_0x9132b4[_0x5dc46c][_0x8db2('0x2a')]],_0x9132b4[_0x5dc46c]);}return _0x121f31[_0x8db2('0x15')];};};Realtime[_0x8db2('0x3f')]['initFaxAccounts']=function(){var _0x30930a=this;return function(_0x5e349c){if(_0x5e349c){freeIsNotKey(_0x5e349c,_0x30930a[_0x8db2('0x25')],'id');for(var _0x353101=0x0,_0xa083b1={};_0x353101<_0x5e349c[_0x8db2('0x42')];_0x353101+=0x1){_0xa083b1=_0x5e349c[_0x353101];if(_[_0x8db2('0x43')](_0x30930a['faxAccounts'][_0xa083b1['id']])){_0x30930a['faxAccounts'][_0xa083b1['id']]=new FaxAccount(_0xa083b1);}else{_0x30930a[_0x8db2('0x44')](_0x30930a['faxAccounts'][_0xa083b1['id']],_0xa083b1);}}}return _0x30930a[_0x8db2('0x25')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x6d')]=function(){var _0x1e7bc2=this;return function(_0x2b7224){if(_0x2b7224){freeIsNotKey(_0x2b7224,_0x1e7bc2[_0x8db2('0x14')],'name');for(var _0x19f9a0=0x0,_0x222ea2={};_0x19f9a0<_0x2b7224[_0x8db2('0x42')];_0x19f9a0+=0x1){_0x222ea2=_0x2b7224[_0x19f9a0];if(_['isUndefined'](_0x1e7bc2[_0x8db2('0x14')][_0x222ea2[_0x8db2('0x2a')]])){_0x1e7bc2['voiceQueues'][_0x222ea2[_0x8db2('0x2a')]]=new VoiceQueue(_0x222ea2);}else{_0x1e7bc2[_0x8db2('0x44')](_0x1e7bc2[_0x8db2('0x14')][_0x222ea2[_0x8db2('0x2a')]],_0x222ea2);}}}return _0x1e7bc2[_0x8db2('0x14')];};};module[_0x8db2('0x6e')]=Realtime; \ No newline at end of file +var _0xb10b=['../model/voiceExtension','../model/zendeskAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','agents','telephones','triggers','campaigns','templates','voiceExtensions','queueChannels','outboundChannels','timers','settings','zendeskAccounts','salesforceAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','hasOwnProperty','SIP/%s','name','interface','format','total','answered','sumHoldTime','sumDuration','ivrTotalCallsDays','isEmpty','unmanaged','sumBillable','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundDropCallsDayTimeout','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundAnswerCallsDay','queueStatusComplete','mergeFromDatabase','prototype','initAgents','length','isNil','isUndefined','initTelephones','trunks','initTemplates','initZendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','initDeskAccounts','initSugarcrmAccounts','sugarcrmAccounts','initVtigerAccounts','initVoiceQueueHopperHistory','voiceQueues','groupBy','uniqueid','queue','queuecallerexit','abandoned','queuecallerleaveAt','diff','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','queuecallercomplete','initVoiceCallReports','outbound','duration','billableseconds','initCampaigns','dialQueueProject','initCampaignHopperHistory','merge','initFaxAccounts','initVoiceQueues','lodash','util','../model/agent','../model/telephone','../model/voiceQueue','../model/trigger','../model/template','../model/campaign'];(function(_0x58c6e5,_0x506370){var _0x30fe13=function(_0xa9ec77){while(--_0xa9ec77){_0x58c6e5['push'](_0x58c6e5['shift']());}};_0x30fe13(++_0x506370);}(_0xb10b,0x12a));var _0xbb10=function(_0x53056c,_0x1d56a9){_0x53056c=_0x53056c-0x0;var _0x5cec88=_0xb10b[_0x53056c];return _0x5cec88;};'use strict';var _=require(_0xbb10('0x0'));var moment=require('moment');var util=require(_0xbb10('0x1'));var Agent=require(_0xbb10('0x2'));var Telephone=require(_0xbb10('0x3'));var Trunk=require('../model/trunk');var VoiceQueue=require(_0xbb10('0x4'));var Trigger=require(_0xbb10('0x5'));var Template=require(_0xbb10('0x6'));var Campaign=require(_0xbb10('0x7'));var VoiceExtension=require(_0xbb10('0x8'));var ZendeskAccount=require(_0xbb10('0x9'));var SalesforceAccount=require('../model/salesforceAccount');var FreshdeskAccount=require(_0xbb10('0xa'));var SugarcrmAccount=require(_0xbb10('0xb'));var ZohoAccount=require('../model/zohoAccount');var DeskAccount=require(_0xbb10('0xc'));var VtigerAccount=require(_0xbb10('0xd'));var ServicenowAccount=require(_0xbb10('0xe'));var Dynamics365Account=require(_0xbb10('0xf'));var FreshsalesAccount=require(_0xbb10('0x10'));var FaxAccount=require(_0xbb10('0x11'));function Realtime(){this[_0xbb10('0x12')]={};this[_0xbb10('0x13')]={};this['trunks']={};this['voiceQueues']={};this[_0xbb10('0x14')]={};this[_0xbb10('0x15')]={};this[_0xbb10('0x16')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xbb10('0x17')]={};this['channels']={};this[_0xbb10('0x18')]={};this[_0xbb10('0x19')]={};this[_0xbb10('0x1a')]={};this[_0xbb10('0x1b')]={};this[_0xbb10('0x1c')]={};this[_0xbb10('0x1d')]={};this['sugarcrmAccounts']={};this[_0xbb10('0x1e')]={};this[_0xbb10('0x1f')]={};this[_0xbb10('0x20')]={};this[_0xbb10('0x21')]={};this[_0xbb10('0x22')]={};this[_0xbb10('0x23')]={};this[_0xbb10('0x24')]={};this[_0xbb10('0x25')]={};}function freeIsNotKey(_0x3e26f4,_0x2b184e,_0x4a2bfc){var _0x2eca0f=_[_0xbb10('0x26')](_0x3e26f4,function(_0x133ac2){return _0x133ac2[_0x4a2bfc];});for(var _0x42db98 in _0x2b184e){if(_0x2b184e[_0xbb10('0x27')](_0x42db98)){if(!_0x2eca0f[_0x42db98]){delete _0x2b184e[_0x42db98];}}}}function freeIsNotKeySip(_0x1682a4,_0x575cca){var _0x30efc6=_[_0xbb10('0x26')](_0x1682a4,function(_0xe1c665){return util['format'](_0xbb10('0x28'),_0xe1c665[_0xbb10('0x29')]);});for(var _0x388fab in _0x575cca){if(_0x575cca[_0xbb10('0x27')](_0x388fab)){if(!_0x30efc6[_0x388fab]){delete _0x575cca[_0x388fab];}}}}function freeIsNotKeyAgent(_0xdf237d,_0x44e563){var _0x4deb49=_[_0xbb10('0x26')](_0xdf237d,function(_0x12ef77){var _0x50aea1=_['isNil'](_0x12ef77[_0xbb10('0x2a')])?util[_0xbb10('0x2b')](_0xbb10('0x28'),_0x12ef77[_0xbb10('0x29')]):_0x12ef77[_0xbb10('0x2a')];return _0x50aea1;});for(var _0x1824b7 in _0x44e563){if(_0x44e563[_0xbb10('0x27')](_0x1824b7)){if(!_0x4deb49[_0x1824b7]){delete _0x44e563[_0x1824b7];}}}}function clearVoiceCallReports(_0x436104){_0x436104[_0xbb10('0x2c')]=0x0;_0x436104[_0xbb10('0x2d')]=0x0;_0x436104[_0xbb10('0x2e')]=0x0;_0x436104[_0xbb10('0x2f')]=0x0;_0x436104['sumBillable']=0x0;}function clearCampaigns(_0x4fedac){if(!_['isEmpty'](_0x4fedac)){for(var _0xc93a04 in _0x4fedac){if(_0x4fedac[_0xbb10('0x27')](_0xc93a04)){_0x4fedac[_0xc93a04][_0xbb10('0x30')]=0x0;_0x4fedac[_0xc93a04]['ivrAnswerCallsDay']=0x0;}}}}function clearVoiceQueues(_0x2fdde9){if(!_[_0xbb10('0x31')](_0x2fdde9)){for(var _0x6ed43b in _0x2fdde9){if(_0x2fdde9[_0xbb10('0x27')](_0x6ed43b)){_0x2fdde9[_0x6ed43b][_0xbb10('0x2c')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x2d')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x32')]=0x0;_0x2fdde9[_0x6ed43b]['abandoned']=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x2e')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x2f')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x33')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x34')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x35')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x36')]=0x0;_0x2fdde9[_0x6ed43b]['outboundCongestionCallsDay']=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x37')]=0x0;_0x2fdde9[_0x6ed43b]['outboundUnknownCallsDay']=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x38')]=0x0;_0x2fdde9[_0x6ed43b]['outboundDropCallsDayCallersExit']=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x39')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x3a')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x3b')]=0x0;_0x2fdde9[_0x6ed43b]['outboundReCallsDay']=0x0;_0x2fdde9[_0x6ed43b]['outboundAnswerAgiCallsDay']=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x3c')]=0x0;_0x2fdde9[_0x6ed43b][_0xbb10('0x3d')]=!![];}}}}Realtime['prototype'][_0xbb10('0x3e')]=function(_0x37dde7,_0x2f653f){for(var _0x1c0b57 in _0x2f653f){if(_0x37dde7[_0xbb10('0x27')](_0x1c0b57)){_0x37dde7[_0x1c0b57]=_0x2f653f[_0x1c0b57];}}};Realtime[_0xbb10('0x3f')][_0xbb10('0x40')]=function(){var _0x4975f5=this;return function(_0x25acb3){if(_0x25acb3){freeIsNotKeyAgent(_0x25acb3,_0x4975f5[_0xbb10('0x12')]);for(var _0x441d15=0x0,_0x8c1ce6={};_0x441d15<_0x25acb3[_0xbb10('0x41')];_0x441d15+=0x1){_0x8c1ce6=_0x25acb3[_0x441d15];var _0x9de708=_[_0xbb10('0x42')](_0x8c1ce6[_0xbb10('0x2a')])?util[_0xbb10('0x2b')]('SIP/%s',_0x8c1ce6[_0xbb10('0x29')]):_0x8c1ce6[_0xbb10('0x2a')];if(_[_0xbb10('0x43')](_0x4975f5[_0xbb10('0x12')][_0x9de708])){_0x4975f5['agents'][_0x9de708]=new Agent(_0x8c1ce6);}else{_0x4975f5[_0xbb10('0x3e')](_0x4975f5['agents'][_0x9de708],_0x8c1ce6);}}}return _0x4975f5['agents'];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x44')]=function(){var _0x26e76a=this;return function(_0x120d21){if(_0x120d21){freeIsNotKeySip(_0x120d21,_0x26e76a[_0xbb10('0x13')]);for(var _0x29d11a=0x0,_0x547062={};_0x29d11a<_0x120d21[_0xbb10('0x41')];_0x29d11a+=0x1){_0x547062=_0x120d21[_0x29d11a];if(_[_0xbb10('0x43')](_0x26e76a['telephones'][util['format']('SIP/%s',_0x547062[_0xbb10('0x29')])])){_0x26e76a[_0xbb10('0x13')][util[_0xbb10('0x2b')]('SIP/%s',_0x547062[_0xbb10('0x29')])]=new Telephone(_0x547062);}else{_0x26e76a[_0xbb10('0x3e')](_0x26e76a[_0xbb10('0x13')][util['format'](_0xbb10('0x28'),_0x547062[_0xbb10('0x29')])],_0x547062);}}}return _0x26e76a[_0xbb10('0x13')];};};Realtime[_0xbb10('0x3f')]['initTrunks']=function(){var _0xd238e9=this;return function(_0x110eb5){if(_0x110eb5){freeIsNotKeySip(_0x110eb5,_0xd238e9['trunks']);for(var _0xe2040f=0x0,_0x2e3214={};_0xe2040f<_0x110eb5[_0xbb10('0x41')];_0xe2040f+=0x1){_0x2e3214=_0x110eb5[_0xe2040f];if(_[_0xbb10('0x43')](_0xd238e9[_0xbb10('0x45')][util[_0xbb10('0x2b')]('SIP/%s',_0x2e3214[_0xbb10('0x29')])])){_0xd238e9[_0xbb10('0x45')][util[_0xbb10('0x2b')](_0xbb10('0x28'),_0x2e3214['name'])]=new Trunk(_0x2e3214);}else{_0xd238e9[_0xbb10('0x3e')](_0xd238e9[_0xbb10('0x45')][util[_0xbb10('0x2b')](_0xbb10('0x28'),_0x2e3214['name'])],_0x2e3214);}}}return _0xd238e9[_0xbb10('0x45')];};};Realtime[_0xbb10('0x3f')]['initTriggers']=function(){var _0x5d9a4f=this;return function(_0x38d78f){if(_0x38d78f){freeIsNotKey(_0x38d78f,_0x5d9a4f['triggers'],'id');for(var _0x318984=0x0,_0x180933={};_0x318984<_0x38d78f['length'];_0x318984+=0x1){_0x180933=_0x38d78f[_0x318984];if(_[_0xbb10('0x43')](_0x5d9a4f[_0xbb10('0x14')][_0x180933['id']])){_0x5d9a4f[_0xbb10('0x14')][_0x180933['id']]=new Trigger(_0x180933);}else{_0x5d9a4f['mergeFromDatabase'](_0x5d9a4f[_0xbb10('0x14')][_0x180933['id']],_0x180933);}}}return _0x5d9a4f[_0xbb10('0x14')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x46')]=function(){var _0x36e1fa=this;return function(_0x19f94d){if(_0x19f94d){freeIsNotKey(_0x19f94d,_0x36e1fa[_0xbb10('0x16')],'id');for(var _0x3efa96=0x0,_0x205bb4={};_0x3efa96<_0x19f94d[_0xbb10('0x41')];_0x3efa96+=0x1){_0x205bb4=_0x19f94d[_0x3efa96];if(_[_0xbb10('0x43')](_0x36e1fa[_0xbb10('0x16')][_0x205bb4['id']])){_0x36e1fa['templates'][_0x205bb4['id']]=new Template(_0x205bb4);}else{_0x36e1fa[_0xbb10('0x3e')](_0x36e1fa[_0xbb10('0x16')][_0x205bb4['id']],_0x205bb4);}}}return _0x36e1fa['templates'];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x47')]=function(){var _0x1a7df6=this;return function(_0x5a5226){if(_0x5a5226){freeIsNotKey(_0x5a5226,_0x1a7df6[_0xbb10('0x1c')],'id');for(var _0x39f0de=0x0,_0x3e06b0={};_0x39f0de<_0x5a5226['length'];_0x39f0de+=0x1){_0x3e06b0=_0x5a5226[_0x39f0de];if(_['isUndefined'](_0x1a7df6[_0xbb10('0x1c')][_0x3e06b0['id']])){_0x1a7df6[_0xbb10('0x1c')][_0x3e06b0['id']]=new ZendeskAccount(_0x3e06b0);}else{_0x1a7df6[_0xbb10('0x3e')](_0x1a7df6['zendeskAccounts'][_0x3e06b0['id']],_0x3e06b0);}}}return _0x1a7df6['zendeskAccounts'];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x48')]=function(){var _0x1bd054=this;return function(_0xf820fe){if(_0xf820fe){freeIsNotKey(_0xf820fe,_0x1bd054[_0xbb10('0x1d')],'id');for(var _0x22b315=0x0,_0x2f2552={};_0x22b315<_0xf820fe[_0xbb10('0x41')];_0x22b315+=0x1){_0x2f2552=_0xf820fe[_0x22b315];if(_[_0xbb10('0x43')](_0x1bd054[_0xbb10('0x1d')][_0x2f2552['id']])){_0x1bd054['salesforceAccounts'][_0x2f2552['id']]=new SalesforceAccount(_0x2f2552);}else{_0x1bd054['mergeFromDatabase'](_0x1bd054[_0xbb10('0x1d')][_0x2f2552['id']],_0x2f2552);}}}return _0x1bd054[_0xbb10('0x1d')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x49')]=function(){var _0x36aa7d=this;return function(_0x440f9e){if(_0x440f9e){freeIsNotKey(_0x440f9e,_0x36aa7d[_0xbb10('0x1e')],'id');for(var _0x445870=0x0,_0x1c0d8f={};_0x445870<_0x440f9e[_0xbb10('0x41')];_0x445870+=0x1){_0x1c0d8f=_0x440f9e[_0x445870];if(_[_0xbb10('0x43')](_0x36aa7d[_0xbb10('0x1e')][_0x1c0d8f['id']])){_0x36aa7d[_0xbb10('0x1e')][_0x1c0d8f['id']]=new FreshdeskAccount(_0x1c0d8f);}else{_0x36aa7d[_0xbb10('0x3e')](_0x36aa7d[_0xbb10('0x1e')][_0x1c0d8f['id']],_0x1c0d8f);}}}return _0x36aa7d['freshdeskAccounts'];};};Realtime[_0xbb10('0x3f')]['initZohoAccounts']=function(){var _0x33d60a=this;return function(_0x2e21a0){if(_0x2e21a0){freeIsNotKey(_0x2e21a0,_0x33d60a[_0xbb10('0x1f')],'id');for(var _0x3f27ce=0x0,_0x26e66e={};_0x3f27ce<_0x2e21a0[_0xbb10('0x41')];_0x3f27ce+=0x1){_0x26e66e=_0x2e21a0[_0x3f27ce];if(_[_0xbb10('0x43')](_0x33d60a[_0xbb10('0x1f')][_0x26e66e['id']])){_0x33d60a[_0xbb10('0x1f')][_0x26e66e['id']]=new ZohoAccount(_0x26e66e);}else{_0x33d60a[_0xbb10('0x3e')](_0x33d60a[_0xbb10('0x1f')][_0x26e66e['id']],_0x26e66e);}}}return _0x33d60a[_0xbb10('0x1f')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x4a')]=function(){var _0x4475e1=this;return function(_0x5de0cc){if(_0x5de0cc){freeIsNotKey(_0x5de0cc,_0x4475e1[_0xbb10('0x20')],'id');for(var _0x466eb7=0x0,_0x1b83a9={};_0x466eb7<_0x5de0cc[_0xbb10('0x41')];_0x466eb7+=0x1){_0x1b83a9=_0x5de0cc[_0x466eb7];if(_[_0xbb10('0x43')](_0x4475e1[_0xbb10('0x20')][_0x1b83a9['id']])){_0x4475e1['deskAccounts'][_0x1b83a9['id']]=new DeskAccount(_0x1b83a9);}else{_0x4475e1[_0xbb10('0x3e')](_0x4475e1[_0xbb10('0x20')][_0x1b83a9['id']],_0x1b83a9);}}}return _0x4475e1[_0xbb10('0x20')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x4b')]=function(){var _0x22de7f=this;return function(_0x175872){if(_0x175872){freeIsNotKey(_0x175872,_0x22de7f[_0xbb10('0x4c')],'id');for(var _0x205e01=0x0,_0x40c4fb={};_0x205e01<_0x175872[_0xbb10('0x41')];_0x205e01+=0x1){_0x40c4fb=_0x175872[_0x205e01];if(_[_0xbb10('0x43')](_0x22de7f[_0xbb10('0x4c')][_0x40c4fb['id']])){_0x22de7f['sugarcrmAccounts'][_0x40c4fb['id']]=new SugarcrmAccount(_0x40c4fb);}else{_0x22de7f['mergeFromDatabase'](_0x22de7f[_0xbb10('0x4c')][_0x40c4fb['id']],_0x40c4fb);}}}return _0x22de7f[_0xbb10('0x4c')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x4d')]=function(){var _0x5573bb=this;return function(_0x506498){if(_0x506498){freeIsNotKey(_0x506498,_0x5573bb[_0xbb10('0x21')],'id');for(var _0xaf2cc3=0x0,_0x410bef={};_0xaf2cc3<_0x506498[_0xbb10('0x41')];_0xaf2cc3+=0x1){_0x410bef=_0x506498[_0xaf2cc3];if(_[_0xbb10('0x43')](_0x5573bb[_0xbb10('0x21')][_0x410bef['id']])){_0x5573bb[_0xbb10('0x21')][_0x410bef['id']]=new VtigerAccount(_0x410bef);}else{_0x5573bb['mergeFromDatabase'](_0x5573bb[_0xbb10('0x21')][_0x410bef['id']],_0x410bef);}}}return _0x5573bb[_0xbb10('0x21')];};};Realtime['prototype']['initServicenowAccounts']=function(){var _0x5a231f=this;return function(_0x32c1e8){if(_0x32c1e8){freeIsNotKey(_0x32c1e8,_0x5a231f[_0xbb10('0x22')],'id');for(var _0x155dc5=0x0,_0x5bd1c0={};_0x155dc5<_0x32c1e8['length'];_0x155dc5+=0x1){_0x5bd1c0=_0x32c1e8[_0x155dc5];if(_['isUndefined'](_0x5a231f[_0xbb10('0x22')][_0x5bd1c0['id']])){_0x5a231f[_0xbb10('0x22')][_0x5bd1c0['id']]=new ServicenowAccount(_0x5bd1c0);}else{_0x5a231f[_0xbb10('0x3e')](_0x5a231f['servicenowAccounts'][_0x5bd1c0['id']],_0x5bd1c0);}}}return _0x5a231f[_0xbb10('0x22')];};};Realtime[_0xbb10('0x3f')]['initDynamics365Accounts']=function(){var _0x4a560c=this;return function(_0x27d7b9){if(_0x27d7b9){freeIsNotKey(_0x27d7b9,_0x4a560c[_0xbb10('0x23')],'id');for(var _0xd77753=0x0,_0x237246={};_0xd77753<_0x27d7b9['length'];_0xd77753+=0x1){_0x237246=_0x27d7b9[_0xd77753];if(_[_0xbb10('0x43')](_0x4a560c[_0xbb10('0x23')][_0x237246['id']])){_0x4a560c[_0xbb10('0x23')][_0x237246['id']]=new Dynamics365Account(_0x237246);}else{_0x4a560c['mergeFromDatabase'](_0x4a560c[_0xbb10('0x23')][_0x237246['id']],_0x237246);}}}return _0x4a560c[_0xbb10('0x23')];};};Realtime[_0xbb10('0x3f')]['initFreshsalesAccounts']=function(){var _0x2ca491=this;return function(_0x31e85e){if(_0x31e85e){freeIsNotKey(_0x31e85e,_0x2ca491[_0xbb10('0x24')],'id');for(var _0x37b65f=0x0,_0x5e4a6e={};_0x37b65f<_0x31e85e[_0xbb10('0x41')];_0x37b65f+=0x1){_0x5e4a6e=_0x31e85e[_0x37b65f];if(_[_0xbb10('0x43')](_0x2ca491[_0xbb10('0x24')][_0x5e4a6e['id']])){_0x2ca491[_0xbb10('0x24')][_0x5e4a6e['id']]=new FreshsalesAccount(_0x5e4a6e);}else{_0x2ca491['mergeFromDatabase'](_0x2ca491[_0xbb10('0x24')][_0x5e4a6e['id']],_0x5e4a6e);}}}return _0x2ca491[_0xbb10('0x24')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x4e')]=function(){var _0x12f750=this;return function(_0x17807e){for(var _0x1e4694=0x0;_0x1e4694<_0x17807e['length'];_0x1e4694+=0x1){_['merge'](_0x12f750['voiceQueues'][_0x17807e[_0x1e4694][_0xbb10('0x29')]],_0x17807e[_0x1e4694]);}return _0x12f750[_0xbb10('0x4f')];};};Realtime[_0xbb10('0x3f')]['initVoiceQueueReports']=function(){var _0x5cd089=this;return function(_0x46f462){clearVoiceQueues(_0x5cd089[_0xbb10('0x4f')]);if(_0x46f462){_0x46f462=_[_0xbb10('0x50')](_0x46f462,_0xbb10('0x51'));for(var _0x260e06 in _0x46f462){if(_0x46f462[_0xbb10('0x27')](_0x260e06)){for(var _0x4cf2f3=0x0;_0x4cf2f3<_0x46f462[_0x260e06][_0xbb10('0x41')];_0x4cf2f3+=0x1){var _0x15fae2=_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x52')];if(_0x5cd089[_0xbb10('0x4f')][_0x15fae2]){if(_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x53')]){_0x5cd089['voiceQueues'][_0x15fae2]['unmanaged']+=0x1;}if(_0x46f462[_0x260e06][_0x4cf2f3]['queuecallerabandon']){_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x54')]+=0x1;}_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x2e')]+=moment(_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x55')])[_0xbb10('0x56')](moment(_0x46f462[_0x260e06][_0x4cf2f3]['queuecallerjoinAt']),_0xbb10('0x57'))||0x0;if(_0x4cf2f3===_0x46f462[_0x260e06]['length']-0x1){_0x5cd089['voiceQueues'][_0x15fae2]['sumDuration']+=moment(_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x58')]||_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x59')]||_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x5a')])[_0xbb10('0x56')](moment(_0x46f462[_0x260e06][_0x4cf2f3]['queuecallerjoinAt']),_0xbb10('0x57'))||0x0;_0x5cd089['voiceQueues'][_0x15fae2]['total']+=0x1;if(_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x5b')]){_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x2d')]+=0x1;_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x33')]+=moment(_0x46f462[_0x260e06][_0x4cf2f3]['queuecallercompleteAt'])[_0xbb10('0x56')](moment(_0x46f462[_0x260e06][_0x4cf2f3][_0xbb10('0x55')]),_0xbb10('0x57'))||0x0;}}else{_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x2f')]+=_0x5cd089[_0xbb10('0x4f')][_0x15fae2][_0xbb10('0x2e')]||0x0;}}}}}}return _0x5cd089['voiceQueues'];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x5c')]=function(){var _0x30f3ea=this;return function(_0x322b41){clearVoiceCallReports(_0x30f3ea[_0xbb10('0x5d')]);if(_0x322b41){for(var _0x172be3=0x0;_0x172be3<_0x322b41[_0xbb10('0x41')];_0x172be3+=0x1){_0x30f3ea[_0xbb10('0x5d')]['total']+=0x1;_0x30f3ea[_0xbb10('0x5d')][_0xbb10('0x2f')]+=_0x322b41[_0x172be3][_0xbb10('0x5e')];if(_0x322b41[_0x172be3]['disposition']==='ANSWERED'){_0x30f3ea['outbound'][_0xbb10('0x2d')]+=0x1;_0x30f3ea['outbound']['sumHoldTime']+=_0x322b41[_0x172be3][_0xbb10('0x5e')]-_0x322b41[_0x172be3][_0xbb10('0x5f')]||0x0;_0x30f3ea[_0xbb10('0x5d')][_0xbb10('0x33')]+=_0x322b41[_0x172be3][_0xbb10('0x5f')];}}}return _0x30f3ea[_0xbb10('0x5d')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x60')]=function(){var _0x188b97=this;return function(_0x5206e1){if(_0x5206e1){freeIsNotKey(_0x5206e1,_0x188b97[_0xbb10('0x15')],_0xbb10('0x29'));for(var _0x46b6d2=0x0,_0x35b811={};_0x46b6d2<_0x5206e1['length'];_0x46b6d2+=0x1){_0x35b811=_0x5206e1[_0x46b6d2];if(_['isUndefined'](_0x188b97[_0xbb10('0x15')][_0x35b811[_0xbb10('0x29')]])){_0x188b97[_0xbb10('0x15')][_0x35b811[_0xbb10('0x29')]]=new Campaign(_0x35b811);}else{_0x188b97['mergeFromDatabase'](_0x188b97[_0xbb10('0x15')][_0x35b811[_0xbb10('0x29')]],_0x35b811);_0x188b97[_0xbb10('0x15')][_0x35b811[_0xbb10('0x29')]][_0xbb10('0x61')]=_0x35b811['SquareProject']?_0x35b811['SquareProject'][_0xbb10('0x29')]:undefined;}}}return _0x188b97[_0xbb10('0x15')];};};Realtime[_0xbb10('0x3f')]['initVoiceExtensions']=function(){var _0x256b35=this;return function(_0x13e2ab){if(_0x13e2ab){freeIsNotKey(_0x13e2ab,_0x256b35['voiceExtensions'],'id');for(var _0x5caa06=0x0,_0x2f667f={};_0x5caa06<_0x13e2ab[_0xbb10('0x41')];_0x5caa06+=0x1){_0x2f667f=_0x13e2ab[_0x5caa06];if(_[_0xbb10('0x43')](_0x256b35['voiceExtensions'][_0x2f667f['id']])){_0x256b35[_0xbb10('0x17')][_0x2f667f['id']]=new VoiceExtension(_0x2f667f);}else{_0x256b35[_0xbb10('0x3e')](_0x256b35[_0xbb10('0x17')][_0x2f667f['id']],_0x2f667f);}}}return _0x256b35[_0xbb10('0x17')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x62')]=function(){var _0x45bd4e=this;return function(_0x226363){clearCampaigns(_0x45bd4e[_0xbb10('0x15')]);for(var _0x479d51=0x0;_0x479d51<_0x226363[_0xbb10('0x41')];_0x479d51+=0x1){_[_0xbb10('0x63')](_0x45bd4e[_0xbb10('0x15')][_0x226363[_0x479d51][_0xbb10('0x29')]],_0x226363[_0x479d51]);}return _0x45bd4e[_0xbb10('0x15')];};};Realtime[_0xbb10('0x3f')][_0xbb10('0x64')]=function(){var _0x305d52=this;return function(_0x17ed20){if(_0x17ed20){freeIsNotKey(_0x17ed20,_0x305d52[_0xbb10('0x25')],'id');for(var _0x15e043=0x0,_0x2a4278={};_0x15e043<_0x17ed20['length'];_0x15e043+=0x1){_0x2a4278=_0x17ed20[_0x15e043];if(_['isUndefined'](_0x305d52[_0xbb10('0x25')][_0x2a4278['id']])){_0x305d52[_0xbb10('0x25')][_0x2a4278['id']]=new FaxAccount(_0x2a4278);}else{_0x305d52[_0xbb10('0x3e')](_0x305d52[_0xbb10('0x25')][_0x2a4278['id']],_0x2a4278);}}}return _0x305d52[_0xbb10('0x25')];};};Realtime['prototype'][_0xbb10('0x65')]=function(){var _0x332fbe=this;return function(_0x3b4d0b){if(_0x3b4d0b){freeIsNotKey(_0x3b4d0b,_0x332fbe[_0xbb10('0x4f')],_0xbb10('0x29'));for(var _0x379d49=0x0,_0x546db5={};_0x379d49<_0x3b4d0b[_0xbb10('0x41')];_0x379d49+=0x1){_0x546db5=_0x3b4d0b[_0x379d49];if(_[_0xbb10('0x43')](_0x332fbe['voiceQueues'][_0x546db5[_0xbb10('0x29')]])){_0x332fbe['voiceQueues'][_0x546db5[_0xbb10('0x29')]]=new VoiceQueue(_0x546db5);}else{_0x332fbe[_0xbb10('0x3e')](_0x332fbe[_0xbb10('0x4f')][_0x546db5[_0xbb10('0x29')]],_0x546db5);}}}return _0x332fbe[_0xbb10('0x4f')];};};module['exports']=Realtime; \ No newline at end of file diff --git a/server/services/ami/realtime/utils.js b/server/services/ami/realtime/utils.js index 31d3ba5..743222b 100644 --- a/server/services/ami/realtime/utils.js +++ b/server/services/ami/realtime/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbf92=['mergeDBDataToRealtime','assign'];(function(_0x26616b,_0x53dd60){var _0x338d18=function(_0xab49df){while(--_0xab49df){_0x26616b['push'](_0x26616b['shift']());}};_0x338d18(++_0x53dd60);}(_0xbf92,0x127));var _0x2bf9=function(_0x294c6f,_0x142372){_0x294c6f=_0x294c6f-0x0;var _0x5560ff=_0xbf92[_0x294c6f];return _0x5560ff;};'use strict';function mergeDBDataToRealtime(_0x2d65e6,_0x4718ce){var _0x476ebe=Object[_0x2bf9('0x0')]({},_0x2d65e6);for(var _0x35c830 in _0x4718ce){if(_0x476ebe['hasOwnProperty'](_0x35c830)){_0x476ebe[_0x35c830]=_0x4718ce[_0x35c830];}}return _0x476ebe;}exports[_0x2bf9('0x1')]=mergeDBDataToRealtime; \ No newline at end of file +var _0xa140=['mergeDBDataToRealtime','assign','hasOwnProperty'];(function(_0x5712f8,_0x17156b){var _0x14a364=function(_0x1da9de){while(--_0x1da9de){_0x5712f8['push'](_0x5712f8['shift']());}};_0x14a364(++_0x17156b);}(_0xa140,0x7f));var _0x0a14=function(_0x23e7c1,_0x35110c){_0x23e7c1=_0x23e7c1-0x0;var _0x1add43=_0xa140[_0x23e7c1];return _0x1add43;};'use strict';function mergeDBDataToRealtime(_0x37970f,_0x3e61f7){var _0x8d6ec1=Object[_0x0a14('0x0')]({},_0x37970f);for(var _0x17e763 in _0x3e61f7){if(_0x8d6ec1[_0x0a14('0x1')](_0x17e763)){_0x8d6ec1[_0x17e763]=_0x3e61f7[_0x17e763];}}return _0x8d6ec1;}exports[_0x0a14('0x2')]=mergeDBDataToRealtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index 375a829..8603b50 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 _0x3421=['attendedTransfer','findAgent','find','accountcode','name','isNil','interface','lastAssignedTo','format','SIP/%s','queuecallercomplete','queuecallercompleteAt','queuecallerexitAt','YYYY-MM-DD\x20HH:mm:ss','create','match','prototype','keys','length','getCallType','channel','split','getAgentByInternal','outbound','voiceCallReport','type','queue','lastdata','context','destination','from-sip','calleridpreview','calleridnum','destinationchannel','callerid','originatecalleridnum','disposition','ANSWERED','connectedlinenum','\x22%s\x22\x20<%s>','calleridname','transfers','linkedid','uniqueid','UserId','monitor','monitors','monitorFilename','filename','exten','connectedlinename','membername','voiceAgentReport','isArray','Local','substring','indexOf','phone','transfererlinkedid','exports','lodash','util','../../../config/environment','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','./userReport','realtime','agents','telephones','sync','xdr','custom:voiceQueueReport','voiceQueueReport','bind','custom:voiceCallReport','custom:voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','blindTransfer'];(function(_0x3bd430,_0x2a2b41){var _0x35b96e=function(_0xb6a19c){while(--_0xb6a19c){_0x3bd430['push'](_0x3bd430['shift']());}};_0x35b96e(++_0x2a2b41);}(_0x3421,0x13e));var _0x1342=function(_0x13afd2,_0x228663){_0x13afd2=_0x13afd2-0x0;var _0x1ae021=_0x3421[_0x13afd2];return _0x1ae021;};'use strict';var _=require(_0x1342('0x0'));var moment=require('moment');var util=require(_0x1342('0x1'));var config=require(_0x1342('0x2'));var ami=require('../ami');var RpcVoiceAgentReport=require(_0x1342('0x3'));var RpcVoiceCallReport=require(_0x1342('0x4'));var RpcVoiceDialReport=require(_0x1342('0x5'));var RpcMemberReport=require(_0x1342('0x6'));var RpcVoiceQueueReport=require('../rpc/voiceQueueReport');var RpcVoiceRecording=require('../rpc/voiceRecording');var RpcVoiceTransferReport=require('../rpc/voiceTransferReport');var VoiceQueueReport=require(_0x1342('0x7'));var VoiceCallReport=require(_0x1342('0x8'));var VoiceAgentReport=require(_0x1342('0x9'));var VoiceDialReport=require(_0x1342('0xa'));var UserReport=require(_0x1342('0xb'));function Report(_0x40a463){this[_0x1342('0xc')]=_0x40a463;this[_0x1342('0xd')]=_0x40a463['agents'];this[_0x1342('0xe')]=_0x40a463[_0x1342('0xe')];}Report['prototype'][_0x1342('0xf')]=function(_0x4491e8){var _0x4f61d3=new VoiceQueueReport(this[_0x1342('0xc')]);var _0x589ecc=new VoiceAgentReport(this[_0x1342('0xc')]);var _0x25c810=new VoiceDialReport(this['realtime']);var _0x291220=new VoiceCallReport(this['realtime']);var _0x553645=new UserReport(this[_0x1342('0xc')]);if(config['xdr']&&config[_0x1342('0x10')]['disabled']){ami['on'](_0x1342('0x11'),this[_0x1342('0x12')][_0x1342('0x13')](this));ami['on'](_0x1342('0x14'),this['voiceCallReport'][_0x1342('0x13')](this));ami['on'](_0x1342('0x15'),this['voiceAgentReport'][_0x1342('0x13')](this));ami['on'](_0x1342('0x16'),this[_0x1342('0x17')]['bind'](this));ami['on'](_0x1342('0x18'),this[_0x1342('0x19')]['bind'](this));ami['on']('attendedtransfer',this[_0x1342('0x1a')][_0x1342('0x13')](this));}};Report['prototype'][_0x1342('0x1b')]=function(_0x2ab39d){var _0x3ffc95;_0x3ffc95=_[_0x1342('0x1c')](this[_0x1342('0xd')],function(_0x4273ff){return _0x4273ff[_0x1342('0x1d')]==_0x2ab39d||_0x4273ff[_0x1342('0x1e')]==_0x2ab39d;});if(_[_0x1342('0x1f')](_0x3ffc95)){var _0x5a0837=_[_0x1342('0x1c')](this['telephones'],function(_0x59405e){return _0x59405e[_0x1342('0x1d')]==_0x2ab39d||_0x59405e['name']==_0x2ab39d;});if(_0x5a0837){_0x3ffc95=_['find'](this[_0x1342('0xd')],function(_0x3f61d7){return _0x3f61d7[_0x1342('0x20')]==util['format']('SIP/%s',_0x5a0837[_0x1342('0x1e')]);});}}return _0x3ffc95;};Report['prototype'][_0x1342('0x12')]=function(_0x2910b8){for(var _0x358164=0x0;_0x358164<_0x2910b8['length'];_0x358164+=0x1){var _0x4c7322=this['findAgent'](_0x2910b8[_0x358164]['connectedlinenum']);if(_0x4c7322){_0x2910b8[_0x358164][_0x1342('0x1d')]=_0x4c7322[_0x1342('0x1d')];_0x2910b8[_0x358164]['assigned']=!![];_0x2910b8[_0x358164][_0x1342('0x21')]=_0x4c7322['name'];_0x2910b8[_0x358164][_0x1342('0x20')]=_['isNil'](_0x4c7322[_0x1342('0x20')])?util[_0x1342('0x22')](_0x1342('0x23'),_0x4c7322[_0x1342('0x1e')]):_0x4c7322[_0x1342('0x20')];if(_0x2910b8[_0x358164][_0x1342('0x24')]){_0x2910b8[_0x358164][_0x1342('0x25')]=moment()[_0x1342('0x22')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x2910b8[_0x358164]['queuecallerexit']){_0x2910b8[_0x358164][_0x1342('0x26')]=moment()[_0x1342('0x22')](_0x1342('0x27'));}RpcMemberReport[_0x1342('0x12')](_0x2910b8[_0x358164]);}RpcVoiceQueueReport[_0x1342('0x28')](_0x2910b8[_0x358164]);}};function extractCalleridNumber(_0x1ade88){var _0x23a501=_0x1ade88[_0x1342('0x29')](/<(.*?)>/);return _0x23a501?_0x23a501[0x1]:_0x1ade88;}Report[_0x1342('0x2a')]['getAgentByInternal']=function(_0x395775){for(var _0x4daf50=0x0;_0x4daf50','calleridname','transfers','linkedid','transfereelinkedid','type','UserId','membername','monitor','monitorFilename','monitors','filename','createdAt','connectedlinename','xcally-motion-dialer','isArray','forEach','voiceDialReport','startsWith','Local','substring','indexOf'];(function(_0x38c7f8,_0x2bd353){var _0x50778c=function(_0x1058d9){while(--_0x1058d9){_0x38c7f8['push'](_0x38c7f8['shift']());}};_0x50778c(++_0x2bd353);}(_0xfd2d,0xc0));var _0xdfd2=function(_0x259e2a,_0x3a9e9e){_0x259e2a=_0x259e2a-0x0;var _0x524ee7=_0xfd2d[_0x259e2a];return _0x524ee7;};'use strict';var _=require('lodash');var moment=require(_0xdfd2('0x0'));var util=require(_0xdfd2('0x1'));var config=require(_0xdfd2('0x2'));var ami=require(_0xdfd2('0x3'));var RpcVoiceAgentReport=require(_0xdfd2('0x4'));var RpcVoiceCallReport=require(_0xdfd2('0x5'));var RpcVoiceDialReport=require(_0xdfd2('0x6'));var RpcMemberReport=require(_0xdfd2('0x7'));var RpcVoiceQueueReport=require(_0xdfd2('0x8'));var RpcVoiceRecording=require(_0xdfd2('0x9'));var RpcVoiceTransferReport=require(_0xdfd2('0xa'));var VoiceQueueReport=require('./voiceQueueReport');var VoiceCallReport=require(_0xdfd2('0xb'));var VoiceAgentReport=require('./voiceAgentReport');var VoiceDialReport=require(_0xdfd2('0xc'));var UserReport=require(_0xdfd2('0xd'));function Report(_0x18785c){this[_0xdfd2('0xe')]=_0x18785c;this[_0xdfd2('0xf')]=_0x18785c[_0xdfd2('0xf')];this[_0xdfd2('0x10')]=_0x18785c[_0xdfd2('0x10')];}Report[_0xdfd2('0x11')]['sync']=function(_0x548c29){var _0x19fd31=new VoiceQueueReport(this[_0xdfd2('0xe')]);var _0xed81ee=new VoiceAgentReport(this[_0xdfd2('0xe')]);var _0x4e3b34=new VoiceDialReport(this['realtime']);var _0x21be10=new VoiceCallReport(this[_0xdfd2('0xe')]);var _0x5e6064=new UserReport(this[_0xdfd2('0xe')]);if(config['xdr']&&config[_0xdfd2('0x12')][_0xdfd2('0x13')]){ami['on'](_0xdfd2('0x14'),this[_0xdfd2('0x15')][_0xdfd2('0x16')](this));ami['on'](_0xdfd2('0x17'),this[_0xdfd2('0x18')][_0xdfd2('0x16')](this));ami['on'](_0xdfd2('0x19'),this[_0xdfd2('0x1a')][_0xdfd2('0x16')](this));ami['on']('custom:voiceDialReport',this['voiceDialReport'][_0xdfd2('0x16')](this));ami['on'](_0xdfd2('0x1b'),this[_0xdfd2('0x1c')][_0xdfd2('0x16')](this));ami['on']('attendedtransfer',this[_0xdfd2('0x1d')]['bind'](this));}};Report[_0xdfd2('0x11')][_0xdfd2('0x1e')]=function(_0x98818a){var _0x3c2b9b;_0x3c2b9b=_['find'](this[_0xdfd2('0xf')],function(_0x2cd9d7){return _0x2cd9d7[_0xdfd2('0x1f')]==_0x98818a||_0x2cd9d7[_0xdfd2('0x20')]==_0x98818a;});if(_[_0xdfd2('0x21')](_0x3c2b9b)){var _0x2c501d=_[_0xdfd2('0x22')](this[_0xdfd2('0x10')],function(_0x16f347){return _0x16f347[_0xdfd2('0x1f')]==_0x98818a||_0x16f347[_0xdfd2('0x20')]==_0x98818a;});if(_0x2c501d){_0x3c2b9b=_[_0xdfd2('0x22')](this[_0xdfd2('0xf')],function(_0x5bf867){return _0x5bf867['interface']==util['format'](_0xdfd2('0x23'),_0x2c501d['name']);});}}return _0x3c2b9b;};Report[_0xdfd2('0x11')][_0xdfd2('0x15')]=function(_0x3bd38c){for(var _0xc6229c=0x0;_0xc6229c<_0x3bd38c['length'];_0xc6229c+=0x1){var _0x4deaa1=this[_0xdfd2('0x1e')](_0x3bd38c[_0xc6229c][_0xdfd2('0x24')]);if(_0x4deaa1){_0x3bd38c[_0xc6229c][_0xdfd2('0x1f')]=_0x4deaa1[_0xdfd2('0x1f')];_0x3bd38c[_0xc6229c][_0xdfd2('0x25')]=!![];_0x3bd38c[_0xc6229c]['lastAssignedTo']=_0x4deaa1[_0xdfd2('0x20')];_0x3bd38c[_0xc6229c][_0xdfd2('0x26')]=_[_0xdfd2('0x21')](_0x4deaa1[_0xdfd2('0x26')])?util[_0xdfd2('0x27')](_0xdfd2('0x23'),_0x4deaa1[_0xdfd2('0x20')]):_0x4deaa1[_0xdfd2('0x26')];if(_0x3bd38c[_0xc6229c][_0xdfd2('0x28')]){_0x3bd38c[_0xc6229c]['queuecallercompleteAt']=moment()[_0xdfd2('0x27')](_0xdfd2('0x29'));}if(_0x3bd38c[_0xc6229c]['queuecallerexit']){_0x3bd38c[_0xc6229c][_0xdfd2('0x2a')]=moment()[_0xdfd2('0x27')](_0xdfd2('0x29'));}RpcMemberReport['voiceQueueReport'](_0x3bd38c[_0xc6229c]);}RpcVoiceQueueReport[_0xdfd2('0x2b')](_0x3bd38c[_0xc6229c]);}};function extractCalleridNumber(_0x5417e2){var _0x10fd1d=_0x5417e2[_0xdfd2('0x2c')](/<(.*?)>/);return _0x10fd1d?_0x10fd1d[0x1]:_0x5417e2;}Report[_0xdfd2('0x11')][_0xdfd2('0x2d')]=function(_0x341afe){for(var _0xcbad95=0x0;_0xcbad950x0?!![]:![];if(!_0x57bfec){return this[_0x7889('0x13')](this[_0x7889('0x10')]['completeEvent']);}};VoiceQueueReport[_0x7889('0x32')]['syncQueueMember']=function(_0x21d58f){var _0x27f7cc=this[_0x7889('0x10')]['id'];if(this[_0x7889('0x10')][_0x7889('0x63')][_0x27f7cc]&&this['summary']['queuestatus'][_0x27f7cc][_0x21d58f[_0x7889('0x5c')]]){this[_0x7889('0x10')][_0x7889('0x63')][_0x27f7cc][_0x21d58f[_0x7889('0x5c')]][_0x7889('0xc')][_0x7889('0x69')](_0x21d58f);}};VoiceQueueReport[_0x7889('0x32')][_0x7889('0x11')]=function(_0x30af7a){var _0x305b60=this;try{if(this[_0x7889('0x6a')](_0x30af7a)&&this[_0x7889('0x6a')](_0x30af7a[_0x7889('0x4b')])){logger[_0x7889('0x46')](_0x7889('0x6b'),util[_0x7889('0x3d')](_0x30af7a,{'showHidden':![],'depth':null}));var _0x2dcd5e=this['voiceQueues'][_0x30af7a[_0x7889('0x4b')]];if(_0x2dcd5e){logger[_0x7889('0x46')](_0x7889('0x6c'),_0x2dcd5e[_0x7889('0x5e')]);this[_0x7889('0x10')]['queues'][_0x2dcd5e['name']]={'summaryEvent':_0x30af7a};this[_0x7889('0x10')][_0x7889('0x68')]+=0x1;return ami[_0x7889('0x57')]({'action':'queuestatus','queue':_0x2dcd5e[_0x7889('0x5e')]})[_0x7889('0x6d')](function(_0x26b965){if(!_0x305b60[_0x7889('0x10')][_0x7889('0x63')][_0x30af7a[_0x7889('0x5c')]]){_0x305b60[_0x7889('0x10')][_0x7889('0x63')][_0x30af7a['actionid']]={};}_0x305b60[_0x7889('0x10')][_0x7889('0x63')][_0x30af7a['actionid']][_0x26b965[_0x7889('0x5c')]]={'queue':_0x2dcd5e[_0x7889('0x5e')],'agents':[]};})['catch'](function(_0x375fc4){throw _0x375fc4;});}}}catch(_0x4d9b22){logger[_0x7889('0x3b')](_0x7889('0x6e'),util[_0x7889('0x3d')](_0x4d9b22,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x7889('0x13')]=function(_0x2a35d4){if(this[_0x7889('0x10')]['statusRequests']>0x0){this[_0x7889('0x10')][_0x7889('0x6f')]=_0x2a35d4;return;}logger['debug'](_0x7889('0x70'),util[_0x7889('0x3d')](_0x2a35d4,{'showHidden':![],'depth':null}));this['summary']=initializeSummary();ami[_0x7889('0x44')](_0x7889('0x71'),{});};VoiceQueueReport[_0x7889('0x32')][_0x7889('0x17')]=function(_0x5ec9c3){try{if(this[_0x7889('0x6a')](_0x5ec9c3)){logger['debug'](_0x7889('0x72'),_0x5ec9c3[_0x7889('0x49')],util[_0x7889('0x3d')](_0x5ec9c3,{'showHidden':![],'depth':null}));if(_[_0x7889('0x55')](this[_0x7889('0x3e')][_0x5ec9c3[_0x7889('0x49')]])){this['queueReports'][_0x5ec9c3['uniqueid']]=[];}if(_[_0x7889('0x55')](this[_0x7889('0x33')][_0x5ec9c3[_0x7889('0x49')]])){this['channels'][_0x5ec9c3[_0x7889('0x49')]]={};}var _0x4c03b1=new QueueReport();_0x4c03b1[_0x7889('0x4b')]=_0x5ec9c3[_0x7889('0x4b')];_0x4c03b1[_0x7889('0x64')]=this['voiceQueues'][_0x4c03b1[_0x7889('0x4b')]]&&this[_0x7889('0xe')][_0x4c03b1[_0x7889('0x4b')]][_0x7889('0x64')]?this[_0x7889('0xe')][_0x4c03b1[_0x7889('0x4b')]][_0x7889('0x64')]||_0x7889('0x65'):_0x7889('0x65');_0x4c03b1[_0x7889('0x73')]=moment()['format'](_0x7889('0x74'));_0x4c03b1[_0x7889('0x75')]=_0x5ec9c3[_0x7889('0x75')];_0x4c03b1[_0x7889('0x76')]=_0x5ec9c3[_0x7889('0x76')];_0x4c03b1[_0x7889('0x49')]=_0x5ec9c3[_0x7889('0x49')];logger[_0x7889('0x77')](_0x7889('0x78'),_0x4c03b1[_0x7889('0x4b')],_0x4c03b1[_0x7889('0x64')]);Object[_0x7889('0x61')](_0x4c03b1,_[_0x7889('0x79')](_0x5ec9c3,_['keys'](_0x4c03b1)));this[_0x7889('0x3e')][_0x5ec9c3['uniqueid']][_0x7889('0x69')](_0x4c03b1);this['channels'][_0x5ec9c3['uniqueid']]=_0x4c03b1;this[_0x7889('0x45')](_0x4c03b1,'queuecallerjoin');}}catch(_0x808170){logger['error']('[%s][voiceQueueReport][queuecallerjoin]',_0x5ec9c3['uniqueid'],util[_0x7889('0x3d')](_0x808170,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x7889('0x32')][_0x7889('0x19')]=function(_0x123f53){try{if(this[_0x7889('0x6a')](_0x123f53)){logger[_0x7889('0x46')](_0x7889('0x7a'),_0x123f53[_0x7889('0x49')],util['inspect'](_0x123f53,{'showHidden':![],'depth':null}));if(this[_0x7889('0x3e')][_0x123f53[_0x7889('0x49')]]){var _0x38d2eb=_['last'](this[_0x7889('0x3e')][_0x123f53[_0x7889('0x49')]]);_0x38d2eb['queuecallercomplete']=![];_0x38d2eb[_0x7889('0x7b')]=null;_0x38d2eb['holdtime']=_0x123f53[_0x7889('0x7c')];_0x38d2eb[_0x7889('0x7d')]=_0x123f53[_0x7889('0x7d')];_0x38d2eb[_0x7889('0x18')]=!![];_0x38d2eb['queuecallerabandonAt']=moment()[_0x7889('0x4a')](_0x7889('0x74'));_0x38d2eb[_0x7889('0x4e')]=_0x7889('0x7e');_0x38d2eb['lastAssignedTo']=null;logger[_0x7889('0x77')](_0x7889('0x7f'),_0x38d2eb[_0x7889('0x4b')],_0x38d2eb[_0x7889('0x64')]);this[_0x7889('0x33')][_0x123f53[_0x7889('0x49')]]=_0x38d2eb;this[_0x7889('0x43')](_0x38d2eb,_0x7889('0x18'));}}}catch(_0xc7c38d){logger[_0x7889('0x3b')]('[%s][voiceQueueReport][queuecallerabandon]',_0x123f53['uniqueid'],util['inspect'](_0xc7c38d,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x7889('0x32')]['syncQueueCallerLeave']=function(_0x12e9fc){try{if(this['isNotNull'](_0x12e9fc)){logger['debug'](_0x7889('0x80'),_0x12e9fc[_0x7889('0x49')],util[_0x7889('0x3d')](_0x12e9fc,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x12e9fc[_0x7889('0x49')]]){var _0x22b67f=_[_0x7889('0x81')](this[_0x7889('0x3e')][_0x12e9fc[_0x7889('0x49')]]);_0x22b67f[_0x7889('0x82')]=moment()[_0x7889('0x4a')](_0x7889('0x74'));_0x22b67f['connectedlinenum']=_0x12e9fc[_0x7889('0x83')];_0x22b67f[_0x7889('0x84')]=_0x12e9fc[_0x7889('0x84')];logger['info'](_0x7889('0x85'),_0x22b67f[_0x7889('0x4b')],_0x22b67f['type'],_0x12e9fc[_0x7889('0x83')],_0x12e9fc[_0x7889('0x84')]);this[_0x7889('0x33')][_0x12e9fc['uniqueid']]=_0x22b67f;this[_0x7889('0x45')](_0x22b67f,_0x7889('0x1a'));}}}catch(_0x5cc1b3){logger['error'](_0x7889('0x80'),_0x12e9fc[_0x7889('0x49')],util['inspect'](_0x5cc1b3,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x7889('0x32')][_0x7889('0x1d')]=function(_0x3701f4){try{if(this['isNotNull'](_0x3701f4)){logger[_0x7889('0x46')]('[%s][voiceQueueReport][agentconnect]',_0x3701f4[_0x7889('0x49')],util[_0x7889('0x3d')](_0x3701f4,{'showHidden':![],'depth':null}));if(this[_0x7889('0x3e')][_0x3701f4[_0x7889('0x49')]]){var _0x2e053e=_[_0x7889('0x81')](this[_0x7889('0x3e')][_0x3701f4['uniqueid']]);_0x2e053e[_0x7889('0x86')]=!![];_0x2e053e['queuecallerexitreason']=_0x7889('0x87');logger[_0x7889('0x77')](_0x7889('0x88'),_0x2e053e[_0x7889('0x4b')],_0x2e053e[_0x7889('0x64')]);}}}catch(_0x2cb782){logger[_0x7889('0x3b')](_0x7889('0x89'),_0x3701f4[_0x7889('0x49')],util[_0x7889('0x3d')](_0x2cb782,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x7889('0x32')][_0x7889('0x8a')]=function(_0x13db4a){try{if(this['isNotNull'](_0x13db4a)){logger[_0x7889('0x46')](_0x7889('0x8b'),_0x13db4a['uniqueid'],util['inspect'](_0x13db4a,{'showHidden':![],'depth':null}));if(this[_0x7889('0x3e')][_0x13db4a[_0x7889('0x49')]]){var _0x261906=_[_0x7889('0x81')](this[_0x7889('0x3e')][_0x13db4a[_0x7889('0x49')]]);_0x261906[_0x7889('0x18')]=![];_0x261906[_0x7889('0x8c')]=null;_0x261906['assigned']=!![];_0x261906['lastAssignedTo']=_0x13db4a[_0x7889('0x8d')];_0x261906['holdtime']=_0x13db4a['holdtime'];_0x261906['queuecallercomplete']=!![];_0x261906[_0x7889('0x8e')]=![];_0x261906[_0x7889('0x8f')]=null;if(!_0x261906[_0x7889('0x90')]){if(_0x13db4a['reason']==_0x7889('0x90')){_0x261906[_0x7889('0x4e')]=_0x7889('0x91');logger[_0x7889('0x77')](_0x7889('0x92'),_0x261906[_0x7889('0x4b')],_0x261906[_0x7889('0x64')]);}else{if(_[_0x7889('0x93')](_0x13db4a[_0x7889('0x94')]['toLowerCase'](),_0x7889('0x95'))){if(this[_0x7889('0x3e')][_0x13db4a[_0x7889('0x96')]]){var _0x318e79=_[_0x7889('0x81')](this[_0x7889('0x3e')][_0x13db4a['linkedid']]);_0x318e79[_0x7889('0x86')]=![];_0x318e79[_0x7889('0x8e')]=!![];_0x318e79[_0x7889('0x8f')]=moment(_0x261906[_0x7889('0x73')])[_0x7889('0x97')](_0x13db4a[_0x7889('0x7c')],_0x7889('0x98'))[_0x7889('0x4a')](_0x7889('0x74'));_0x318e79[_0x7889('0x4e')]='FORWARDTRANSFER';_0x318e79['transfer']=!![];_0x318e79[_0x7889('0x99')]=_0x7889('0x9a');_0x318e79[_0x7889('0x9b')]=_0x13db4a[_0x7889('0x9c')];_0x318e79[_0x7889('0x9d')]=_0x13db4a[_0x7889('0x49')];logger['info'](_0x7889('0x9e'),_0x318e79[_0x7889('0x4b')],_0x318e79[_0x7889('0x64')]);var _0x42f610=this[_0x7889('0x3e')][_0x13db4a[_0x7889('0x96')]];this['queueReports'][_0x13db4a['linkedid']]=this['queueReports'][_0x13db4a[_0x7889('0x49')]];this[_0x7889('0x3e')][_0x13db4a[_0x7889('0x49')]]=_0x42f610;}}else{_0x261906[_0x7889('0x4e')]='COMPLETEDBY'+_0x13db4a[_0x7889('0x9f')][_0x7889('0xa0')]();logger['info']('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s',_0x261906['queue'],_0x261906[_0x7889('0x64')],_0x261906[_0x7889('0x4e')]);}}}this[_0x7889('0x33')][_0x13db4a[_0x7889('0x49')]]=_0x261906;}}}catch(_0x4b1599){logger[_0x7889('0x3b')](_0x7889('0x8b'),_0x13db4a[_0x7889('0x49')],util[_0x7889('0x3d')](_0x4b1599,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x7889('0x32')][_0x7889('0x1f')]=function(_0x5e2faa){try{if(this['isNotNull'](_0x5e2faa)){logger['debug'](_0x7889('0xa1'),_0x5e2faa[_0x7889('0x49')],util[_0x7889('0x3d')](_0x5e2faa,{'showHidden':![],'depth':null}));this[_0x7889('0xa2')](_0x5e2faa[_0x7889('0x49')],_[_0x7889('0xa3')](_0x5e2faa[_0x7889('0xa4')])[0x0],_0x5e2faa['value']);if(this['queueReports'][_0x5e2faa['uniqueid']]){var _0x53ccc9=_[_0x7889('0x81')](this['queueReports'][_0x5e2faa['uniqueid']]);if(_0x53ccc9){if(this[_0x7889('0x6a')](_0x5e2faa[_0x7889('0xa4')])&&this[_0x7889('0x6a')](_0x5e2faa['variable'][_0x7889('0x63')])){switch(_0x5e2faa[_0x7889('0xa5')]){case _0x7889('0xa6'):_0x53ccc9[_0x7889('0x8e')]=![];_0x53ccc9['queuecallerexitAt']=null;break;case'TIMEOUT':_0x53ccc9[_0x7889('0xa7')]=_0x7889('0xa8');_0x53ccc9['queuecallerexit']=!![];_0x53ccc9['queuecallerexitAt']=moment()[_0x7889('0x4a')](_0x7889('0x74'));_0x53ccc9[_0x7889('0x82')]=moment()[_0x7889('0x4a')](_0x7889('0x74'));logger[_0x7889('0x46')](_0x7889('0xa9'),_0x5e2faa[_0x7889('0x49')],util[_0x7889('0x3d')](_0x53ccc9,{'showHidden':![],'depth':null}));ami['emit']('custom:timeout',_0x53ccc9);break;default:_0x53ccc9[_0x7889('0x8e')]=!![];_0x53ccc9[_0x7889('0x8f')]=moment()['format'](_0x7889('0x74'));_0x53ccc9[_0x7889('0x82')]=moment()[_0x7889('0x4a')]('YYYY-MM-DD\x20HH:mm:ss');}_0x53ccc9[_0x7889('0x18')]=![];_0x53ccc9[_0x7889('0x8c')]=null;_0x53ccc9[_0x7889('0x4e')]=_0x5e2faa[_0x7889('0xa5')];this['channels'][_0x5e2faa[_0x7889('0x49')]]=_0x53ccc9;this[_0x7889('0x43')](_0x53ccc9,_0x7889('0x1e'));}else if(this[_0x7889('0x6a')](_0x5e2faa[_0x7889('0xa4')])&&this[_0x7889('0x6a')](_0x5e2faa['variable'][_0x7889('0xaa')])){if(!_0x53ccc9['queuecallerabandon']){_0x53ccc9[_0x7889('0x8e')]=!![];_0x53ccc9[_0x7889('0x8f')]=moment()[_0x7889('0x4a')](_0x7889('0x74'));_0x53ccc9['queuecallerexitreason']=_0x7889('0xab');_0x53ccc9[_0x7889('0x82')]=moment()[_0x7889('0x4a')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x7889('0x33')][_0x5e2faa[_0x7889('0x49')]]=_0x53ccc9;}}logger[_0x7889('0x77')]('[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s',_0x5e2faa['uniqueid'],_0x53ccc9['queue'],_0x53ccc9['type'],_[_0x7889('0xa3')](_0x5e2faa[_0x7889('0xa4')])[0x0],_0x5e2faa[_0x7889('0xa5')]);_0x53ccc9[_0x7889('0x3f')]=this['variables'][_0x5e2faa[_0x7889('0x49')]];}}}}catch(_0x20729a){logger[_0x7889('0x3b')](_0x7889('0xa1'),_0x5e2faa[_0x7889('0x49')],util[_0x7889('0x3d')](_0x20729a,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x7889('0xa2')]=function(_0x42d881,_0x5e92ce,_0x22c77a){var _0x5ab19a=[_0x7889('0xac'),_0x7889('0xad'),'rtpaudioqosjitter',_0x7889('0xae'),_0x7889('0xaf'),'rtpaudioqoslossbridged',_0x7889('0xb0'),_0x7889('0xb1'),_0x7889('0xb2'),_0x7889('0xb3'),_0x7889('0xb4'),_0x7889('0xb5'),_0x7889('0xb6'),_0x7889('0xb7'),_0x7889('0xb8'),_0x7889('0xb9'),'membername','memberpenalty','memberrealtime'];if(!_[_0x7889('0x36')](_0x5e92ce)&&!_['includes'](_0x5ab19a,_0x5e92ce)){if(_[_0x7889('0x55')](this[_0x7889('0x3f')][_0x42d881])){this['variables'][_0x42d881]={};}this['variables'][_0x42d881][_0x5e92ce]=_0x22c77a;}};VoiceQueueReport[_0x7889('0x32')][_0x7889('0xba')]=function(_0x495161,_0x1f40ba,_0x4ae3b4){try{var _0x18fdf0={};if(this[_0x7889('0x3e')][_0x495161]){for(var _0x5947f6=0x0;_0x5947f60x0?!![]:![];if(!_0x317e72){return this[_0x098c('0x1a')](this[_0x098c('0x15')][_0x098c('0x6d')]);}};VoiceQueueReport[_0x098c('0xb')]['syncQueueMember']=function(_0x314bf7){var _0x40acc8=this['summary']['id'];if(this['summary'][_0x098c('0x63')][_0x40acc8]&&this[_0x098c('0x15')]['queuestatus'][_0x40acc8][_0x314bf7[_0x098c('0x62')]]){this[_0x098c('0x15')][_0x098c('0x63')][_0x40acc8][_0x314bf7[_0x098c('0x62')]][_0x098c('0x11')][_0x098c('0x6e')](_0x314bf7);}};VoiceQueueReport[_0x098c('0xb')]['syncQueueSummary']=function(_0x34628d){var _0x36b0af=this;try{if(this[_0x098c('0x6f')](_0x34628d)&&this[_0x098c('0x6f')](_0x34628d[_0x098c('0x52')])){logger[_0x098c('0x4c')](_0x098c('0x70'),util[_0x098c('0x43')](_0x34628d,{'showHidden':![],'depth':null}));var _0x298d1b=this['voiceQueues'][_0x34628d[_0x098c('0x52')]];if(_0x298d1b){logger[_0x098c('0x4c')](_0x098c('0x71'),_0x298d1b[_0x098c('0x5a')]);this[_0x098c('0x15')][_0x098c('0x5d')][_0x298d1b[_0x098c('0x5a')]]={'summaryEvent':_0x34628d};this[_0x098c('0x15')][_0x098c('0x6c')]+=0x1;return ami[_0x098c('0x3d')]({'action':'queuestatus','queue':_0x298d1b[_0x098c('0x5a')]})['then'](function(_0x445f7f){if(!_0x36b0af['summary'][_0x098c('0x63')][_0x34628d['actionid']]){_0x36b0af['summary'][_0x098c('0x63')][_0x34628d[_0x098c('0x62')]]={};}_0x36b0af[_0x098c('0x15')][_0x098c('0x63')][_0x34628d['actionid']][_0x445f7f[_0x098c('0x62')]]={'queue':_0x298d1b['name'],'agents':[]};})['catch'](function(_0x574ca5){throw _0x574ca5;});}}}catch(_0x348bc3){logger['error']('[voiceQueueReport][queuesummary]',util[_0x098c('0x43')](_0x348bc3,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x098c('0xb')][_0x098c('0x1a')]=function(_0x3b9be5){if(this[_0x098c('0x15')][_0x098c('0x6c')]>0x0){this[_0x098c('0x15')][_0x098c('0x6d')]=_0x3b9be5;return;}logger[_0x098c('0x4c')](_0x098c('0x72'),util[_0x098c('0x43')](_0x3b9be5,{'showHidden':![],'depth':null}));this[_0x098c('0x15')]=initializeSummary();ami[_0x098c('0x4a')](_0x098c('0x73'),{});};VoiceQueueReport[_0x098c('0xb')][_0x098c('0x20')]=function(_0x4310c2){try{if(this['isNotNull'](_0x4310c2)){logger[_0x098c('0x4c')](_0x098c('0x74'),_0x4310c2[_0x098c('0x4f')],util[_0x098c('0x43')](_0x4310c2,{'showHidden':![],'depth':null}));if(_[_0x098c('0x5c')](this[_0x098c('0xf')][_0x4310c2['uniqueid']])){this[_0x098c('0xf')][_0x4310c2[_0x098c('0x4f')]]=[];}if(_[_0x098c('0x5c')](this[_0x098c('0x12')][_0x4310c2[_0x098c('0x4f')]])){this[_0x098c('0x12')][_0x4310c2[_0x098c('0x4f')]]={};}var _0x1c552c=new QueueReport();_0x1c552c[_0x098c('0x52')]=_0x4310c2[_0x098c('0x52')];_0x1c552c[_0x098c('0x58')]=this[_0x098c('0x13')][_0x1c552c[_0x098c('0x52')]]&&this[_0x098c('0x13')][_0x1c552c[_0x098c('0x52')]][_0x098c('0x58')]?this[_0x098c('0x13')][_0x1c552c['queue']][_0x098c('0x58')]||_0x098c('0x6a'):'inbound';_0x1c552c[_0x098c('0x75')]=moment()['format'](_0x098c('0x76'));_0x1c552c[_0x098c('0x77')]=_0x4310c2[_0x098c('0x77')];_0x1c552c[_0x098c('0x78')]=_0x4310c2[_0x098c('0x78')];_0x1c552c[_0x098c('0x4f')]=_0x4310c2[_0x098c('0x4f')];logger[_0x098c('0x79')]('[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s',_0x1c552c['queue'],_0x1c552c[_0x098c('0x58')]);Object['assign'](_0x1c552c,_[_0x098c('0x7a')](_0x4310c2,_[_0x098c('0x7b')](_0x1c552c)));this[_0x098c('0xf')][_0x4310c2[_0x098c('0x4f')]][_0x098c('0x6e')](_0x1c552c);this[_0x098c('0x12')][_0x4310c2['uniqueid']]=_0x1c552c;this[_0x098c('0x4b')](_0x1c552c,_0x098c('0x1f'));}}catch(_0x19600d){logger[_0x098c('0x42')](_0x098c('0x74'),_0x4310c2['uniqueid'],util[_0x098c('0x43')](_0x19600d,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x098c('0xb')][_0x098c('0x22')]=function(_0x1f5d51){try{if(this['isNotNull'](_0x1f5d51)){logger[_0x098c('0x4c')](_0x098c('0x7c'),_0x1f5d51[_0x098c('0x4f')],util[_0x098c('0x43')](_0x1f5d51,{'showHidden':![],'depth':null}));if(this[_0x098c('0xf')][_0x1f5d51[_0x098c('0x4f')]]){var _0x18fac4=_[_0x098c('0x7d')](this['queueReports'][_0x1f5d51[_0x098c('0x4f')]]);_0x18fac4[_0x098c('0x7e')]=![];_0x18fac4[_0x098c('0x7f')]=null;_0x18fac4[_0x098c('0x80')]=_0x1f5d51[_0x098c('0x80')];_0x18fac4[_0x098c('0x81')]=_0x1f5d51[_0x098c('0x81')];_0x18fac4[_0x098c('0x21')]=!![];_0x18fac4[_0x098c('0x82')]=moment()[_0x098c('0x50')](_0x098c('0x76'));_0x18fac4[_0x098c('0x55')]=_0x098c('0x83');_0x18fac4[_0x098c('0x84')]=null;logger['info'](_0x098c('0x85'),_0x18fac4[_0x098c('0x52')],_0x18fac4[_0x098c('0x58')]);this['channels'][_0x1f5d51['uniqueid']]=_0x18fac4;this[_0x098c('0x48')](_0x18fac4,_0x098c('0x21'));}}}catch(_0x4bcb7d){logger[_0x098c('0x42')](_0x098c('0x7c'),_0x1f5d51[_0x098c('0x4f')],util['inspect'](_0x4bcb7d,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x098c('0xb')][_0x098c('0x24')]=function(_0x488297){try{if(this[_0x098c('0x6f')](_0x488297)){logger['debug'](_0x098c('0x86'),_0x488297[_0x098c('0x4f')],util[_0x098c('0x43')](_0x488297,{'showHidden':![],'depth':null}));if(this[_0x098c('0xf')][_0x488297[_0x098c('0x4f')]]){var _0x47170b=_[_0x098c('0x7d')](this[_0x098c('0xf')][_0x488297['uniqueid']]);_0x47170b[_0x098c('0x87')]=moment()[_0x098c('0x50')]('YYYY-MM-DD\x20HH:mm:ss');_0x47170b[_0x098c('0x88')]=_0x488297[_0x098c('0x88')];_0x47170b[_0x098c('0x89')]=_0x488297[_0x098c('0x89')];logger[_0x098c('0x79')](_0x098c('0x8a'),_0x47170b['queue'],_0x47170b[_0x098c('0x58')],_0x488297[_0x098c('0x88')],_0x488297[_0x098c('0x89')]);this[_0x098c('0x12')][_0x488297[_0x098c('0x4f')]]=_0x47170b;this['emitVoiceQueueChannelSave'](_0x47170b,_0x098c('0x23'));}}}catch(_0x51b95d){logger[_0x098c('0x42')](_0x098c('0x86'),_0x488297[_0x098c('0x4f')],util['inspect'](_0x51b95d,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x098c('0xb')][_0x098c('0x27')]=function(_0x30891c){try{if(this['isNotNull'](_0x30891c)){logger[_0x098c('0x4c')](_0x098c('0x8b'),_0x30891c[_0x098c('0x4f')],util[_0x098c('0x43')](_0x30891c,{'showHidden':![],'depth':null}));if(this[_0x098c('0xf')][_0x30891c[_0x098c('0x4f')]]){var _0x499ba3=_[_0x098c('0x7d')](this[_0x098c('0xf')][_0x30891c['uniqueid']]);_0x499ba3[_0x098c('0x7e')]=!![];_0x499ba3['queuecallerexitreason']=_0x098c('0x8c');logger[_0x098c('0x79')](_0x098c('0x8d'),_0x499ba3[_0x098c('0x52')],_0x499ba3[_0x098c('0x58')]);}}}catch(_0x4a86d6){logger[_0x098c('0x42')]('[%s][voiceQueueReport][agentconnect]',_0x30891c[_0x098c('0x4f')],util[_0x098c('0x43')](_0x4a86d6,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x098c('0xb')][_0x098c('0x8e')]=function(_0x3aa68d){try{if(this['isNotNull'](_0x3aa68d)){logger['debug'](_0x098c('0x8f'),_0x3aa68d['uniqueid'],util[_0x098c('0x43')](_0x3aa68d,{'showHidden':![],'depth':null}));if(this[_0x098c('0xf')][_0x3aa68d['uniqueid']]){var _0x243432=_[_0x098c('0x7d')](this[_0x098c('0xf')][_0x3aa68d['uniqueid']]);_0x243432['queuecallerabandon']=![];_0x243432[_0x098c('0x82')]=null;_0x243432['assigned']=!![];_0x243432[_0x098c('0x84')]=_0x3aa68d['membername'];_0x243432[_0x098c('0x80')]=_0x3aa68d[_0x098c('0x80')];_0x243432[_0x098c('0x7e')]=!![];_0x243432['queuecallerexit']=![];_0x243432[_0x098c('0x90')]=null;if(!_0x243432[_0x098c('0x91')]){if(_0x3aa68d['reason']==_0x098c('0x91')){_0x243432[_0x098c('0x55')]=_0x098c('0x92');logger[_0x098c('0x79')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED',_0x243432[_0x098c('0x52')],_0x243432[_0x098c('0x58')]);}else{if(_[_0x098c('0x93')](_0x3aa68d[_0x098c('0x3f')]['toLowerCase'](),_0x098c('0x94'))){if(this[_0x098c('0xf')][_0x3aa68d[_0x098c('0x95')]]){var _0x18750a=_[_0x098c('0x7d')](this[_0x098c('0xf')][_0x3aa68d['linkedid']]);_0x18750a[_0x098c('0x7e')]=![];_0x18750a[_0x098c('0x39')]=!![];_0x18750a[_0x098c('0x90')]=moment(_0x243432[_0x098c('0x75')])[_0x098c('0x96')](_0x3aa68d['holdtime'],_0x098c('0x97'))[_0x098c('0x50')](_0x098c('0x76'));_0x18750a[_0x098c('0x55')]=_0x098c('0x98');_0x18750a[_0x098c('0x91')]=!![];_0x18750a['transfertype']='FORWARD';_0x18750a[_0x098c('0x99')]=_0x3aa68d[_0x098c('0x9a')];_0x18750a['transferuniqueid']=_0x3aa68d[_0x098c('0x4f')];logger['info'](_0x098c('0x9b'),_0x18750a[_0x098c('0x52')],_0x18750a['type']);var _0x12676e=this[_0x098c('0xf')][_0x3aa68d['linkedid']];this[_0x098c('0xf')][_0x3aa68d[_0x098c('0x95')]]=this[_0x098c('0xf')][_0x3aa68d[_0x098c('0x4f')]];this[_0x098c('0xf')][_0x3aa68d[_0x098c('0x4f')]]=_0x12676e;}}else{_0x243432[_0x098c('0x55')]=_0x098c('0x9c')+_0x3aa68d['reason'][_0x098c('0x9d')]();logger[_0x098c('0x79')](_0x098c('0x9e'),_0x243432[_0x098c('0x52')],_0x243432[_0x098c('0x58')],_0x243432['queuecallerexitreason']);}}}this[_0x098c('0x12')][_0x3aa68d[_0x098c('0x4f')]]=_0x243432;}}}catch(_0x59db5e){logger[_0x098c('0x42')](_0x098c('0x8f'),_0x3aa68d[_0x098c('0x4f')],util[_0x098c('0x43')](_0x59db5e,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x098c('0xb')][_0x098c('0x29')]=function(_0x44ae15){try{if(this[_0x098c('0x6f')](_0x44ae15)){logger[_0x098c('0x4c')](_0x098c('0x9f'),_0x44ae15['uniqueid'],util[_0x098c('0x43')](_0x44ae15,{'showHidden':![],'depth':null}));this[_0x098c('0xa0')](_0x44ae15[_0x098c('0x4f')],_[_0x098c('0x7b')](_0x44ae15[_0x098c('0xa1')])[0x0],_0x44ae15[_0x098c('0xa2')]);if(this[_0x098c('0xf')][_0x44ae15[_0x098c('0x4f')]]){var _0x23f3ca=_[_0x098c('0x7d')](this['queueReports'][_0x44ae15[_0x098c('0x4f')]]);if(_0x23f3ca){if(this['isNotNull'](_0x44ae15[_0x098c('0xa1')])&&this['isNotNull'](_0x44ae15[_0x098c('0xa1')][_0x098c('0x63')])){switch(_0x44ae15['value']){case _0x098c('0xa3'):_0x23f3ca[_0x098c('0x39')]=![];_0x23f3ca[_0x098c('0x90')]=null;break;case _0x098c('0xa4'):_0x23f3ca[_0x098c('0xa5')]=_0x098c('0xa6');_0x23f3ca[_0x098c('0x39')]=!![];_0x23f3ca[_0x098c('0x90')]=moment()[_0x098c('0x50')](_0x098c('0x76'));_0x23f3ca[_0x098c('0x87')]=moment()[_0x098c('0x50')](_0x098c('0x76'));logger[_0x098c('0x4c')](_0x098c('0xa7'),_0x44ae15[_0x098c('0x4f')],util[_0x098c('0x43')](_0x23f3ca,{'showHidden':![],'depth':null}));ami[_0x098c('0x4a')]('custom:timeout',_0x23f3ca);break;default:_0x23f3ca[_0x098c('0x39')]=!![];_0x23f3ca['queuecallerexitAt']=moment()['format'](_0x098c('0x76'));_0x23f3ca[_0x098c('0x87')]=moment()[_0x098c('0x50')](_0x098c('0x76'));}_0x23f3ca[_0x098c('0x21')]=![];_0x23f3ca['queuecallerabandonAt']=null;_0x23f3ca[_0x098c('0x55')]=_0x44ae15[_0x098c('0xa2')];this['channels'][_0x44ae15[_0x098c('0x4f')]]=_0x23f3ca;this[_0x098c('0x48')](_0x23f3ca,_0x098c('0x28'));}else if(this['isNotNull'](_0x44ae15[_0x098c('0xa1')])&&this['isNotNull'](_0x44ae15['variable'][_0x098c('0xa8')])){if(!_0x23f3ca[_0x098c('0x21')]){_0x23f3ca['queuecallerexit']=!![];_0x23f3ca[_0x098c('0x90')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x23f3ca['queuecallerexitreason']='EXITWITHKEY';_0x23f3ca[_0x098c('0x87')]=moment()[_0x098c('0x50')](_0x098c('0x76'));this[_0x098c('0x12')][_0x44ae15[_0x098c('0x4f')]]=_0x23f3ca;}}logger[_0x098c('0x79')](_0x098c('0xa9'),_0x44ae15[_0x098c('0x4f')],_0x23f3ca[_0x098c('0x52')],_0x23f3ca[_0x098c('0x58')],_[_0x098c('0x7b')](_0x44ae15[_0x098c('0xa1')])[0x0],_0x44ae15[_0x098c('0xa2')]);_0x23f3ca[_0x098c('0x16')]=this[_0x098c('0x16')][_0x44ae15['uniqueid']];}}}}catch(_0x2054ec){logger[_0x098c('0x42')](_0x098c('0x9f'),_0x44ae15[_0x098c('0x4f')],util[_0x098c('0x43')](_0x2054ec,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['addVariable']=function(_0x98e108,_0x6e78b1,_0x140920){var _0x22925f=['rtpaudioqos',_0x098c('0xaa'),'rtpaudioqosjitter',_0x098c('0xab'),'rtpaudioqosloss',_0x098c('0xac'),_0x098c('0xad'),_0x098c('0xae'),'sipcallid',_0x098c('0xaf'),'bridgepeer',_0x098c('0xb0'),_0x098c('0xb1'),'memberdynamic',_0x098c('0xb2'),_0x098c('0xb3'),_0x098c('0xb4'),'memberpenalty',_0x098c('0xb5')];if(!_['isNil'](_0x6e78b1)&&!_['includes'](_0x22925f,_0x6e78b1)){if(_[_0x098c('0x5c')](this[_0x098c('0x16')][_0x98e108])){this[_0x098c('0x16')][_0x98e108]={};}this[_0x098c('0x16')][_0x98e108][_0x6e78b1]=_0x140920;}};VoiceQueueReport[_0x098c('0xb')]['handleHangup']=function(_0xbb7654,_0x4c8569,_0x3a9922){try{var _0xa457f7={};if(this[_0x098c('0xf')][_0xbb7654]){for(var _0x546a7b=0x0;_0x546a7b=0x0?moment(_0x13cfec[_0xecce('0x1b')])[_0xecce('0x10')](_0x13cfec[_0xecce('0x1a')],_0xecce('0x11')):null,'data1':_0xecce('0x1c'),'data2':_0x13cfec[_0xecce('0x16')],'data3':_0x13cfec[_0xecce('0x13')],'data4':_0x13cfec[_0xecce('0x1d')]||null,'role':'agent','internal':_0x13cfec[_0xecce('0x16')]?_['toNumber'](_0x13cfec[_0xecce('0x16')]):undefined,'uniqueid':_0x13cfec[_0xecce('0x17')]},'log':_0xecce('0x7')});}; \ No newline at end of file +var _0xe7f6=['outbound','dialstring','moment','util','voiceQueueReport','queuecallercompleteAt','queuecallerexitAt','Request','voice','lastAssignedTo','isNil','interface','format','SIP/%s','TALKING','queuecallerleaveAt','diff','seconds','inbound','calleridnum','exten','queue','agent','accountcode','uniqueid','CreateMemberReport','starttime','endtime'];(function(_0x1f9f37,_0x18776e){var _0x21c080=function(_0x4acb93){while(--_0x4acb93){_0x1f9f37['push'](_0x1f9f37['shift']());}};_0x21c080(++_0x18776e);}(_0xe7f6,0x136));var _0x6e7f=function(_0x468b0f,_0x408566){_0x468b0f=_0x468b0f-0x0;var _0x3e74d9=_0xe7f6[_0x468b0f];return _0x3e74d9;};'use strict';var moment=require(_0x6e7f('0x0'));var _=require('lodash');var util=require(_0x6e7f('0x1'));var client=require('../client');exports[_0x6e7f('0x2')]=function(_0x1fbb02){var _0x300f9a=_0x1fbb02[_0x6e7f('0x3')]||_0x1fbb02[_0x6e7f('0x4')];return client[_0x6e7f('0x5')]('CreateMemberReport',{'body':{'channel':_0x6e7f('0x6'),'membername':_0x1fbb02[_0x6e7f('0x7')],'interface':_[_0x6e7f('0x8')](_0x1fbb02[_0x6e7f('0x9')])?util[_0x6e7f('0xa')](_0x6e7f('0xb'),_0x1fbb02[_0x6e7f('0x7')]):_0x1fbb02['interface'],'type':_0x6e7f('0xc'),'enterAt':_0x1fbb02[_0x6e7f('0xd')],'exitAt':_0x300f9a,'duration':moment(_0x300f9a)[_0x6e7f('0xe')](_0x1fbb02['queuecallerleaveAt'],_0x6e7f('0xf')),'data1':_0x6e7f('0x10'),'data2':_0x1fbb02[_0x6e7f('0x11')],'data3':_0x1fbb02[_0x6e7f('0x12')],'data4':null,'data5':_0x1fbb02[_0x6e7f('0x13')],'role':_0x6e7f('0x14'),'internal':_0x1fbb02['accountcode']?_['toNumber'](_0x1fbb02[_0x6e7f('0x15')]):undefined,'uniqueid':_0x1fbb02[_0x6e7f('0x16')]},'log':_0x6e7f('0x17')});};exports['voiceDialReport']=function(_0x17dd93){return client['Request'](_0x6e7f('0x17'),{'body':{'channel':_0x6e7f('0x6'),'membername':_0x17dd93['membername'],'interface':_0x17dd93[_0x6e7f('0x9')],'type':_0x6e7f('0xc'),'enterAt':_0x17dd93[_0x6e7f('0x18')],'exitAt':_0x17dd93[_0x6e7f('0x19')],'duration':moment(_0x17dd93[_0x6e7f('0x19')])[_0x6e7f('0xe')](_0x17dd93['starttime'],_0x6e7f('0xf'))>=0x0?moment(_0x17dd93[_0x6e7f('0x19')])[_0x6e7f('0xe')](_0x17dd93[_0x6e7f('0x18')],_0x6e7f('0xf')):null,'data1':_0x6e7f('0x1a'),'data2':_0x17dd93[_0x6e7f('0x15')],'data3':_0x17dd93['exten'],'data4':_0x17dd93[_0x6e7f('0x1b')]||null,'role':'agent','internal':_0x17dd93['accountcode']?_['toNumber'](_0x17dd93[_0x6e7f('0x15')]):undefined,'uniqueid':_0x17dd93[_0x6e7f('0x16')]},'log':_0x6e7f('0x17')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index d2685c6..c3119fe 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 _0x8c7d=['../client','Request','stopRecordingOnTransfer','previewRecallmeReminderInterval','GetSettings'];(function(_0x2c3255,_0x4e00ae){var _0x282aba=function(_0x5721d5){while(--_0x5721d5){_0x2c3255['push'](_0x2c3255['shift']());}};_0x282aba(++_0x4e00ae);}(_0x8c7d,0xe1));var _0xd8c7=function(_0x4b8f78,_0x5e0b56){_0x4b8f78=_0x4b8f78-0x0;var _0x9aa5f7=_0x8c7d[_0x4b8f78];return _0x9aa5f7;};'use strict';var client=require(_0xd8c7('0x0'));exports['getSettings']=function(){return client[_0xd8c7('0x1')]('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xd8c7('0x2'),_0xd8c7('0x3')]},'log':_0xd8c7('0x4')});}; \ No newline at end of file +var _0x5dfe=['previewRecallmeReminderInterval','getSettings','Request','ShowSetting','stopRecordingOnTransfer'];(function(_0x288552,_0x2c4c13){var _0x2a38cf=function(_0x17220a){while(--_0x17220a){_0x288552['push'](_0x288552['shift']());}};_0x2a38cf(++_0x2c4c13);}(_0x5dfe,0x1c3));var _0xe5df=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5dfe[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports[_0xe5df('0x0')]=function(){return client[_0xe5df('0x1')](_0xe5df('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xe5df('0x3'),_0xe5df('0x4')]},'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 d2ad51b..3cf2561 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 _0x846a=['name','html','../client','getTemplates','Request','GetTemplate'];(function(_0x60df74,_0x458e29){var _0x5ee872=function(_0x356888){while(--_0x356888){_0x60df74['push'](_0x60df74['shift']());}};_0x5ee872(++_0x458e29);}(_0x846a,0x104));var _0xa846=function(_0x33dade,_0x494e46){_0x33dade=_0x33dade-0x0;var _0x5d1eba=_0x846a[_0x33dade];return _0x5d1eba;};'use strict';var client=require(_0xa846('0x0'));exports[_0xa846('0x1')]=function(_0x1848c4){return function(_0x2a4ab2){return client[_0xa846('0x2')](_0xa846('0x3'),{'options':{'raw':!![],'attributes':['id',_0xa846('0x4'),_0xa846('0x5')]},'log':_0xa846('0x3')});};}; \ No newline at end of file +var _0x9e58=['getTemplates','Request','GetTemplate','html'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x9e58,0x80));var _0x89e5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9e58[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports[_0x89e5('0x0')]=function(_0x493b80){return function(_0x190f05){return client[_0x89e5('0x1')](_0x89e5('0x2'),{'options':{'raw':!![],'attributes':['id','name',_0x89e5('0x3')]},'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 66722cc..b173fb0 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 _0xfae6=['data5','data6','data7','../client','Request','channel','status','Condition','field','operator','value','AnyConditions','Action','Actions','action','data1','data2','data4'];(function(_0x71d6aa,_0x366bb3){var _0x2e80c2=function(_0x821d4e){while(--_0x821d4e){_0x71d6aa['push'](_0x71d6aa['shift']());}};_0x2e80c2(++_0x366bb3);}(_0xfae6,0x147));var _0x6fae=function(_0x5f1a92,_0xde5c39){_0x5f1a92=_0x5f1a92-0x0;var _0x39c21a=_0xfae6[_0x5f1a92];return _0x39c21a;};'use strict';var client=require(_0x6fae('0x0'));exports['getTriggers']=function(_0x48264b){return function(_0xc8505a){return client[_0x6fae('0x1')]('GetTrigger',{'options':{'raw':![],'attributes':['id','name',_0x6fae('0x2'),_0x6fae('0x3')],'include':[{'model':_0x6fae('0x4'),'as':'AllConditions','attributes':['id',_0x6fae('0x5'),_0x6fae('0x6'),_0x6fae('0x7')]},{'model':_0x6fae('0x4'),'as':_0x6fae('0x8'),'attributes':['id',_0x6fae('0x5'),_0x6fae('0x6'),_0x6fae('0x7')]},{'model':_0x6fae('0x9'),'as':_0x6fae('0xa'),'attributes':['id',_0x6fae('0xb'),_0x6fae('0xc'),_0x6fae('0xd'),'data3',_0x6fae('0xe'),_0x6fae('0xf'),_0x6fae('0x10'),_0x6fae('0x11')]}]},'log':'GetTrigger'});};}; \ No newline at end of file +var _0x0479=['GetTrigger','name','channel','Condition','AllConditions','operator','field','value','Action','Actions','action','data1','data2','data3','data4','data5','data6','data7','../client','getTriggers','Request'];(function(_0x2a8a11,_0x4a4858){var _0x554102=function(_0x52922c){while(--_0x52922c){_0x2a8a11['push'](_0x2a8a11['shift']());}};_0x554102(++_0x4a4858);}(_0x0479,0x14d));var _0x9047=function(_0x52c35f,_0x2da8c4){_0x52c35f=_0x52c35f-0x0;var _0x15147c=_0x0479[_0x52c35f];return _0x15147c;};'use strict';var client=require(_0x9047('0x0'));exports[_0x9047('0x1')]=function(_0x2877f6){return function(_0x243853){return client[_0x9047('0x2')](_0x9047('0x3'),{'options':{'raw':![],'attributes':['id',_0x9047('0x4'),_0x9047('0x5'),'status'],'include':[{'model':_0x9047('0x6'),'as':_0x9047('0x7'),'attributes':['id','field',_0x9047('0x8'),'value']},{'model':_0x9047('0x6'),'as':'AnyConditions','attributes':['id',_0x9047('0x9'),_0x9047('0x8'),_0x9047('0xa')]},{'model':_0x9047('0xb'),'as':_0x9047('0xc'),'attributes':['id',_0x9047('0xd'),_0x9047('0xe'),_0x9047('0xf'),_0x9047('0x10'),_0x9047('0x11'),_0x9047('0x12'),_0x9047('0x13'),_0x9047('0x14')]}]},'log':_0x9047('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index fd4cf39..898e4b5 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 _0x3397=['getTrunks','Request','GetTrunk','registry','defaultuser','../client'];(function(_0x309458,_0xba6e63){var _0x3306ee=function(_0x47e10c){while(--_0x47e10c){_0x309458['push'](_0x309458['shift']());}};_0x3306ee(++_0xba6e63);}(_0x3397,0x1a3));var _0x7339=function(_0x3fad5a,_0x2d3b02){_0x3fad5a=_0x3fad5a-0x0;var _0x4ca713=_0x3397[_0x3fad5a];return _0x4ca713;};'use strict';var client=require(_0x7339('0x0'));exports[_0x7339('0x1')]=function(_0x4f2421){return function(_0x4b77bf){return client[_0x7339('0x2')](_0x7339('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id','name',_0x7339('0x4'),_0x7339('0x5')]},'log':_0x7339('0x3')});};}; \ No newline at end of file +var _0x0f9a=['../client','getTrunks','GetTrunk','defaultuser'];(function(_0x2b63a0,_0x14fc48){var _0x4f0434=function(_0x8cba9e){while(--_0x8cba9e){_0x2b63a0['push'](_0x2b63a0['shift']());}};_0x4f0434(++_0x14fc48);}(_0x0f9a,0x174));var _0xa0f9=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x0f9a[_0xbca1b1];return _0x4e1686;};'use strict';var client=require(_0xa0f9('0x0'));exports[_0xa0f9('0x1')]=function(_0x1d38d3){return function(_0x101665){return client['Request'](_0xa0f9('0x2'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id','name','registry',_0xa0f9('0x3')]},'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 9680c1d..2fe875e 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 _0x9c44=['online','pauseType','Request','GetUser','agent','name','email','accountcode','lastLoginAt','lastPauseAt','voicePause','phone','mobile','interface','getTelephones','telephone','internal','PauseUser','savePause','getAgent','ShowUser','fullname'];(function(_0x531d80,_0x433b6b){var _0x2ae50e=function(_0x3744ed){while(--_0x3744ed){_0x531d80['push'](_0x531d80['shift']());}};_0x2ae50e(++_0x433b6b);}(_0x9c44,0x178));var _0x49c4=function(_0x3511d3,_0x4107ae){_0x3511d3=_0x3511d3-0x0;var _0x5d6321=_0x9c44[_0x3511d3];return _0x5d6321;};'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 +var _0x70e0=['getAgents','Request','name','email','accountcode','fullname','lastLoginAt','lastPauseAt','interface','getTelephones','GetUser','telephone','savePause','PauseUser','saveUnpause','getAgent','agent','online','pauseType','../client'];(function(_0x4d1d01,_0x1865d8){var _0x224a31=function(_0x5a7159){while(--_0x5a7159){_0x4d1d01['push'](_0x4d1d01['shift']());}};_0x224a31(++_0x1865d8);}(_0x70e0,0x17b));var _0x070e=function(_0x253b70,_0x184b36){_0x253b70=_0x253b70-0x0;var _0x179781=_0x70e0[_0x253b70];return _0x179781;};'use strict';var client=require(_0x070e('0x0'));exports[_0x070e('0x1')]=function(){return function(){return client[_0x070e('0x2')]('GetUser',{'options':{'raw':![],'where':{'role':'agent'},'attributes':['id',_0x070e('0x3'),_0x070e('0x4'),_0x070e('0x5'),_0x070e('0x6'),'online',_0x070e('0x7'),'pauseType',_0x070e('0x8'),'voicePause','phone','mobile',_0x070e('0x9')]},'log':_0x070e('0x1')});};};exports[_0x070e('0xa')]=function(){return function(){return client[_0x070e('0x2')](_0x070e('0xb'),{'options':{'raw':!![],'where':{'role':_0x070e('0xc')},'attributes':['id',_0x070e('0x3'),'accountcode','internal']},'log':_0x070e('0xa')});};};exports[_0x070e('0xd')]=function(_0x12bb37,_0xb8d819,_0xa927a2){return client[_0x070e('0x2')](_0x070e('0xe'),{'body':{'type':_0xb8d819,'uniqueid':_0xa927a2},'options':{'where':{'id':_0x12bb37['id']}},'log':_0x070e('0xd')});};exports[_0x070e('0xf')]=function(_0x5bf079){return client[_0x070e('0x2')]('UnpauseUser',{'body':{},'options':{'where':{'id':_0x5bf079['id']}},'log':'savePause'});};exports[_0x070e('0x10')]=function(_0x56c7ba){return client['Request']('ShowUser',{'options':{'raw':![],'where':{'role':_0x070e('0x11'),'id':_0x56c7ba},'attributes':['id',_0x070e('0x3'),'email','accountcode',_0x070e('0x6'),_0x070e('0x12'),_0x070e('0x7'),_0x070e('0x13'),'lastPauseAt','voicePause',_0x070e('0x9')]},'log':_0x070e('0x10')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index a3abd50..8d52025 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 _0x79b0=['Request','UpdateVoiceAgentReport','../client','create','CreateVoiceAgentReport','update'];(function(_0x1a37e3,_0x5db8f6){var _0x4db78a=function(_0x15e6c1){while(--_0x15e6c1){_0x1a37e3['push'](_0x1a37e3['shift']());}};_0x4db78a(++_0x5db8f6);}(_0x79b0,0x8c));var _0x079b=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x79b0[_0x19e35c];return _0x3e1fe8;};'use strict';var client=require(_0x079b('0x0'));exports[_0x079b('0x1')]=function(_0x25a553){return client['Request'](_0x079b('0x2'),{'body':_0x25a553,'log':_0x079b('0x2')});};exports[_0x079b('0x3')]=function(_0x1a3b77,_0x4cb664,_0x2701f2){return client[_0x079b('0x4')](_0x079b('0x5'),{'body':_0x1a3b77,'options':{'where':{'uniqueid':_0x4cb664,'interface':_0x2701f2,'agentcomplete':!![]}},'log':_0x079b('0x5')});}; \ No newline at end of file +var _0xdab3=['create','CreateVoiceAgentReport','Request','UpdateVoiceAgentReport','../client'];(function(_0x1c4306,_0x1fad0f){var _0x1a6c00=function(_0x1e3b2b){while(--_0x1e3b2b){_0x1c4306['push'](_0x1c4306['shift']());}};_0x1a6c00(++_0x1fad0f);}(_0xdab3,0xfe));var _0x3dab=function(_0x2e9298,_0x190a87){_0x2e9298=_0x2e9298-0x0;var _0x59d05a=_0xdab3[_0x2e9298];return _0x59d05a;};'use strict';var client=require(_0x3dab('0x0'));exports[_0x3dab('0x1')]=function(_0x5bf202){return client['Request'](_0x3dab('0x2'),{'body':_0x5bf202,'log':_0x3dab('0x2')});};exports['update']=function(_0x5a987e,_0x142662,_0x1f1469){return client[_0x3dab('0x3')]('UpdateVoiceAgentReport',{'body':_0x5a987e,'options':{'where':{'uniqueid':_0x142662,'interface':_0x1f1469,'agentcomplete':!![]}},'log':_0x3dab('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index 3320cb9..7a7a909 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 _0x49d0=['../client','create','Request','CreateVoiceCallReport','merge','calleridnum','context','callerid','DOCUMENTATION','GetVoiceCallReport','outbound','day','format','YYYY-MM-DD\x20HH:mm:ss','type','disposition','duration','billableseconds','moment','util','lodash'];(function(_0xdae8e6,_0x34854a){var _0x24c7a7=function(_0x5492a3){while(--_0x5492a3){_0xdae8e6['push'](_0xdae8e6['shift']());}};_0x24c7a7(++_0x34854a);}(_0x49d0,0x1a1));var _0x049d=function(_0x1f473c,_0x4e9362){_0x1f473c=_0x1f473c-0x0;var _0x369d97=_0x49d0[_0x1f473c];return _0x369d97;};'use strict';var moment=require(_0x049d('0x0'));var util=require(_0x049d('0x1'));var _=require(_0x049d('0x2'));var client=require(_0x049d('0x3'));exports[_0x049d('0x4')]=function(_0x4905cc){return client[_0x049d('0x5')](_0x049d('0x6'),{'body':_[_0x049d('0x7')](_0x4905cc,{'source':_0x4905cc[_0x049d('0x8')],'destinationcontext':_0x4905cc[_0x049d('0x9')],'callerid':_0x4905cc[_0x049d('0xa')],'amaflags':_0x049d('0xb')}),'log':'CreateVoiceCallReport'});};exports['getVoiceCallReports']=function(){return function(){return client[_0x049d('0x5')](_0x049d('0xc'),{'options':{'where':{'type':[_0x049d('0xd')],'createdAt':{'$between':[moment()['startOf'](_0x049d('0xe'))[_0x049d('0xf')](_0x049d('0x10')),moment()['endOf']('day')[_0x049d('0xf')]('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':[_0x049d('0x11'),_0x049d('0x12'),_0x049d('0x13'),_0x049d('0x14')]},'log':'GetVoiceCallReports'});};}; \ No newline at end of file +var _0x3a4a=['YYYY-MM-DD\x20HH:mm:ss','endOf','type','disposition','billableseconds','GetVoiceCallReports','moment','util','create','Request','CreateVoiceCallReport','merge','calleridnum','context','DOCUMENTATION','getVoiceCallReports','GetVoiceCallReport','outbound','day','format'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3a4a,0x92));var _0xa3a4=function(_0x434783,_0xff395d){_0x434783=_0x434783-0x0;var _0x13efcf=_0x3a4a[_0x434783];return _0x13efcf;};'use strict';var moment=require(_0xa3a4('0x0'));var util=require(_0xa3a4('0x1'));var _=require('lodash');var client=require('../client');exports[_0xa3a4('0x2')]=function(_0x205c7d){return client[_0xa3a4('0x3')](_0xa3a4('0x4'),{'body':_[_0xa3a4('0x5')](_0x205c7d,{'source':_0x205c7d[_0xa3a4('0x6')],'destinationcontext':_0x205c7d[_0xa3a4('0x7')],'callerid':_0x205c7d['callerid'],'amaflags':_0xa3a4('0x8')}),'log':_0xa3a4('0x4')});};exports[_0xa3a4('0x9')]=function(){return function(){return client[_0xa3a4('0x3')](_0xa3a4('0xa'),{'options':{'where':{'type':[_0xa3a4('0xb')],'createdAt':{'$between':[moment()['startOf'](_0xa3a4('0xc'))[_0xa3a4('0xd')](_0xa3a4('0xe')),moment()[_0xa3a4('0xf')](_0xa3a4('0xc'))[_0xa3a4('0xd')]('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':[_0xa3a4('0x10'),_0xa3a4('0x11'),'duration',_0xa3a4('0x12')]},'log':_0xa3a4('0x13')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index d5ec22e..7320f16 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 _0x2326=['../client','create','Request','CreateVoiceDialReport'];(function(_0x5a763d,_0xf6dad1){var _0x3128d9=function(_0xbb5421){while(--_0xbb5421){_0x5a763d['push'](_0x5a763d['shift']());}};_0x3128d9(++_0xf6dad1);}(_0x2326,0x124));var _0x6232=function(_0x1c285b,_0x70e1b0){_0x1c285b=_0x1c285b-0x0;var _0x2fb145=_0x2326[_0x1c285b];return _0x2fb145;};'use strict';var client=require(_0x6232('0x0'));exports[_0x6232('0x1')]=function(_0x1fee5b){return client[_0x6232('0x2')](_0x6232('0x3'),{'body':_0x1fee5b,'log':_0x6232('0x3')});}; \ No newline at end of file +var _0x471d=['create','Request','CreateVoiceDialReport'];(function(_0x2f40b0,_0x40122e){var _0x5bc71b=function(_0xcb1864){while(--_0xcb1864){_0x2f40b0['push'](_0x2f40b0['shift']());}};_0x5bc71b(++_0x40122e);}(_0x471d,0x13e));var _0xd471=function(_0xd18509,_0x343df6){_0xd18509=_0xd18509-0x0;var _0x227dc8=_0x471d[_0xd18509];return _0x227dc8;};'use strict';var client=require('../client');exports[_0xd471('0x0')]=function(_0x2d1185){return client[_0xd471('0x1')](_0xd471('0x2'),{'body':_0x2d1185,'log':_0xd471('0x2')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index 47e6c45..fecea05 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 _0x54ef=['getVoiceExtensions','Request','exten','recordingFormat','../client'];(function(_0xb6b285,_0x596e01){var _0x11393c=function(_0x506469){while(--_0x506469){_0xb6b285['push'](_0xb6b285['shift']());}};_0x11393c(++_0x596e01);}(_0x54ef,0x112));var _0xf54e=function(_0x418928,_0x5e5704){_0x418928=_0x418928-0x0;var _0x116a5c=_0x54ef[_0x418928];return _0x116a5c;};'use strict';var client=require(_0xf54e('0x0'));exports[_0xf54e('0x1')]=function(){return function(){return client[_0xf54e('0x2')]('GetVoiceExtension',{'options':{'raw':!![],'attributes':['id',_0xf54e('0x3'),_0xf54e('0x4')],'where':{'VoiceExtensionId':null}},'log':_0xf54e('0x1')});};}; \ No newline at end of file +var _0xf194=['../client','getVoiceExtensions','Request','GetVoiceExtension','recordingFormat'];(function(_0x5e57e4,_0x5e5a60){var _0x18d9c7=function(_0x1fd3a3){while(--_0x1fd3a3){_0x5e57e4['push'](_0x5e57e4['shift']());}};_0x18d9c7(++_0x5e5a60);}(_0xf194,0x91));var _0x4f19=function(_0x3a4b8a,_0xdb4722){_0x3a4b8a=_0x3a4b8a-0x0;var _0x3c52a0=_0xf194[_0x3a4b8a];return _0x3c52a0;};'use strict';var client=require(_0x4f19('0x0'));exports[_0x4f19('0x1')]=function(){return function(){return client[_0x4f19('0x2')](_0x4f19('0x3'),{'options':{'raw':!![],'attributes':['id','exten',_0x4f19('0x4')],'where':{'VoiceExtensionId':null}},'log':'getVoiceExtensions'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index c691830..59ccc1e 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 _0x0655=['dialPredictiveOptimization','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialTimezone','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','Trunk','callerid','active','Pause','mandatoryDispositionPause','TrunkBackup','Intervals','interval','getVoiceQueues','../client','Request','GetVoiceQueue','name','acw','acwTimeout','autopause','monitor_format','type','dialActive','dialLimitChannel','dialLimitQueue','dialPowerLevel'];(function(_0x4bb145,_0x3e7d33){var _0x4db596=function(_0x144489){while(--_0x144489){_0x4bb145['push'](_0x4bb145['shift']());}};_0x4db596(++_0x3e7d33);}(_0x0655,0x142));var _0x5065=function(_0xe51964,_0x433b90){_0xe51964=_0xe51964-0x0;var _0x2c2366=_0x0655[_0xe51964];return _0x2c2366;};'use strict';var client=require(_0x5065('0x0'));exports['getVoiceQueues']=function(){return function(){return client[_0x5065('0x1')](_0x5065('0x2'),{'options':{'raw':![],'attributes':['id',_0x5065('0x3'),_0x5065('0x4'),_0x5065('0x5'),_0x5065('0x6'),_0x5065('0x7'),_0x5065('0x8'),_0x5065('0x9'),'dialMethod',_0x5065('0xa'),_0x5065('0xb'),_0x5065('0xc'),_0x5065('0xd'),'dialPredictiveOptimizationPercentage',_0x5065('0xe'),_0x5065('0xf'),_0x5065('0x10'),_0x5065('0x11'),_0x5065('0x12'),_0x5065('0x13'),_0x5065('0x14'),_0x5065('0x15'),_0x5065('0x16'),_0x5065('0x17'),_0x5065('0x18'),_0x5065('0x19'),_0x5065('0x1a'),'dialGlobalMaxRetry',_0x5065('0x1b'),'dialGlobalInterval',_0x5065('0x1c'),_0x5065('0x1d'),_0x5065('0x1e'),_0x5065('0x1f'),_0x5065('0x20'),_0x5065('0x21'),'dialAMDTotalAnalysisTime',_0x5065('0x22'),_0x5065('0x23'),'dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold',_0x5065('0x24'),_0x5065('0x25'),_0x5065('0x26'),_0x5065('0x27'),_0x5065('0x28'),_0x5065('0x29'),'dialAgiAfterHangupClient',_0x5065('0x2a'),_0x5065('0x7'),_0x5065('0x2b'),_0x5065('0x2c'),_0x5065('0x2d'),_0x5065('0x2e'),_0x5065('0x2f'),'dialDropMaxRetry',_0x5065('0x30'),_0x5065('0x31'),_0x5065('0x32'),_0x5065('0x33'),_0x5065('0x34'),_0x5065('0x35'),_0x5065('0x36'),'mandatoryDisposition','dialPredictiveIntervalMaxThreshold',_0x5065('0x37'),_0x5065('0x38'),_0x5065('0x39')],'include':[{'model':_0x5065('0x3a'),'as':_0x5065('0x3a'),'attributes':['id',_0x5065('0x3'),_0x5065('0x3b'),_0x5065('0x3c')]},{'model':_0x5065('0x3d'),'as':_0x5065('0x3e'),'attributes':['id',_0x5065('0x3')]},{'model':'Trunk','as':_0x5065('0x3f'),'attributes':['id',_0x5065('0x3'),_0x5065('0x3b'),'active']},{'model':'Interval','as':'Interval','attributes':['id','name'],'include':[{'model':'Interval','as':_0x5065('0x40'),'attributes':['id','name',_0x5065('0x41')]}]}]},'log':_0x5065('0x42')});};}; \ No newline at end of file +var _0xb9d3=['Intervals','getVoiceQueues','Request','GetVoiceQueue','name','acw','acwTimeout','autopause','type','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDInitialSilence','dialAMDGreeting','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','monitor_format','strategy','dialRandomLastDigitCallerIdNumber','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialMachineMaxRetry','dialAgentRejectMaxRetry','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPreviewAutoRecallMe','Trunk','callerid','active','mandatoryDispositionPause','Interval'];(function(_0xba454,_0x3e4584){var _0x58de43=function(_0x5351e8){while(--_0x5351e8){_0xba454['push'](_0xba454['shift']());}};_0x58de43(++_0x3e4584);}(_0xb9d3,0x181));var _0x3b9d=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0xb9d3[_0x2be8c2];return _0x97f531;};'use strict';var client=require('../client');exports[_0x3b9d('0x0')]=function(){return function(){return client[_0x3b9d('0x1')](_0x3b9d('0x2'),{'options':{'raw':![],'attributes':['id',_0x3b9d('0x3'),_0x3b9d('0x4'),_0x3b9d('0x5'),_0x3b9d('0x6'),'monitor_format',_0x3b9d('0x7'),_0x3b9d('0x8'),_0x3b9d('0x9'),_0x3b9d('0xa'),_0x3b9d('0xb'),_0x3b9d('0xc'),_0x3b9d('0xd'),_0x3b9d('0xe'),_0x3b9d('0xf'),_0x3b9d('0x10'),_0x3b9d('0x11'),_0x3b9d('0x12'),_0x3b9d('0x13'),_0x3b9d('0x14'),_0x3b9d('0x15'),'dialCongestionMaxRetry',_0x3b9d('0x16'),_0x3b9d('0x17'),_0x3b9d('0x18'),_0x3b9d('0x19'),'dialNoAnswerRetryFrequency',_0x3b9d('0x1a'),_0x3b9d('0x1b'),_0x3b9d('0x1c'),_0x3b9d('0x1d'),_0x3b9d('0x1e'),'dialAMDActive',_0x3b9d('0x1f'),_0x3b9d('0x20'),'dialAMDAfterGreetingSilence',_0x3b9d('0x21'),_0x3b9d('0x22'),_0x3b9d('0x23'),_0x3b9d('0x24'),_0x3b9d('0x25'),_0x3b9d('0x26'),_0x3b9d('0x27'),'dialRecallMeTimeout',_0x3b9d('0x28'),_0x3b9d('0x29'),_0x3b9d('0x2a'),_0x3b9d('0x2b'),_0x3b9d('0x2c'),_0x3b9d('0x2d'),_0x3b9d('0x2e'),_0x3b9d('0x2f'),'dialCutDigit',_0x3b9d('0x30'),_0x3b9d('0x31'),_0x3b9d('0x32'),_0x3b9d('0x33'),_0x3b9d('0x34'),'dialAbandonedRetryFrequency',_0x3b9d('0x35'),'dialMachineRetryFrequency',_0x3b9d('0x36'),'dialAgentRejectRetryFrequency',_0x3b9d('0x37'),_0x3b9d('0x38'),'dialPredictiveIntervalMinThreshold',_0x3b9d('0x39'),'dialPreviewRecallmeReminder'],'include':[{'model':_0x3b9d('0x3a'),'as':_0x3b9d('0x3a'),'attributes':['id',_0x3b9d('0x3'),_0x3b9d('0x3b'),_0x3b9d('0x3c')]},{'model':'Pause','as':_0x3b9d('0x3d'),'attributes':['id','name']},{'model':_0x3b9d('0x3a'),'as':'TrunkBackup','attributes':['id',_0x3b9d('0x3'),_0x3b9d('0x3b'),_0x3b9d('0x3c')]},{'model':_0x3b9d('0x3e'),'as':_0x3b9d('0x3e'),'attributes':['id','name'],'include':[{'model':_0x3b9d('0x3e'),'as':_0x3b9d('0x3f'),'attributes':['id',_0x3b9d('0x3'),'interval']}]}]},'log':_0x3b9d('0x0')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index 705c37b..60b8b7b 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(_0x1e312b,_0xc716ad){var _0x5b2239=function(_0x7205fb){while(--_0x7205fb){_0x1e312b['push'](_0x1e312b['shift']());}};_0x5b2239(++_0xc716ad);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xa9e0[_0x3947c9];return _0x2e7871;};'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(_0x5115dd,_0x702a5d){var _0x145247=function(_0x51f969){while(--_0x51f969){_0x5115dd['push'](_0x5115dd['shift']());}};_0x145247(++_0x702a5d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0xa9e0[_0x1c546c];return _0x2cc384;};'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 ec11527..22cd7d7 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 _0x2b19=['GetVoiceQueueRtPauses','../client'];(function(_0x2f5dc2,_0x1dd20e){var _0x58c15e=function(_0x480fa7){while(--_0x480fa7){_0x2f5dc2['push'](_0x2f5dc2['shift']());}};_0x58c15e(++_0x1dd20e);}(_0x2b19,0x105));var _0x92b1=function(_0x5ac41b,_0x17a947){_0x5ac41b=_0x5ac41b-0x0;var _0x47d6f3=_0x2b19[_0x5ac41b];return _0x47d6f3;};'use strict';var client=require(_0x92b1('0x0'));exports['getVoiceQueueRtPauses']=function(_0x20c840){return function(){return client['Request'](_0x92b1('0x1'),{'options':{'where':{'VoiceQueueId':_0x20c840,'paused':!![]},'raw':!![]},'log':'getVoiceQueueRtPauses'});};}; \ No newline at end of file +var _0x1908=['../client','GetVoiceQueueRtPauses','getVoiceQueueRtPauses'];(function(_0x3f8040,_0x312ed4){var _0x251949=function(_0x287c3d){while(--_0x287c3d){_0x3f8040['push'](_0x3f8040['shift']());}};_0x251949(++_0x312ed4);}(_0x1908,0x9f));var _0x8190=function(_0x5b32a0,_0x2aac81){_0x5b32a0=_0x5b32a0-0x0;var _0x5ea698=_0x1908[_0x5b32a0];return _0x5ea698;};'use strict';var client=require(_0x8190('0x0'));exports['getVoiceQueueRtPauses']=function(_0x3d3028){return function(){return client['Request'](_0x8190('0x1'),{'options':{'where':{'VoiceQueueId':_0x3d3028,'paused':!![]},'raw':!![]},'log':_0x8190('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index 34e663d..1679e77 100644 --- a/server/services/ami/rpc/voiceRecording.js +++ b/server/services/ami/rpc/voiceRecording.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['CreateVoiceRecording','merge','monitorFilename','lodash','../client','create'];(function(_0x4cf2f0,_0x243347){var _0x379f01=function(_0x2ee617){while(--_0x2ee617){_0x4cf2f0['push'](_0x4cf2f0['shift']());}};_0x379f01(++_0x243347);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x7995('0x0'));var client=require(_0x7995('0x1'));exports[_0x7995('0x2')]=function(_0x10a05d){return client['Request'](_0x7995('0x3'),{'body':_[_0x7995('0x4')](_0x10a05d,{'value':_0x10a05d[_0x7995('0x5')]}),'log':_0x7995('0x3')});}; \ No newline at end of file +var _0x7a54=['create','Request','CreateVoiceRecording','monitorFilename','lodash','../client'];(function(_0x339ce7,_0x253db1){var _0xddcff7=function(_0x5244f5){while(--_0x5244f5){_0x339ce7['push'](_0x339ce7['shift']());}};_0xddcff7(++_0x253db1);}(_0x7a54,0x106));var _0x47a5=function(_0x12f793,_0x3ae6a9){_0x12f793=_0x12f793-0x0;var _0x386a66=_0x7a54[_0x12f793];return _0x386a66;};'use strict';var _=require(_0x47a5('0x0'));var client=require(_0x47a5('0x1'));exports[_0x47a5('0x2')]=function(_0x58157c){return client[_0x47a5('0x3')](_0x47a5('0x4'),{'body':_['merge'](_0x58157c,{'value':_0x58157c[_0x47a5('0x5')]}),'log':_0x47a5('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index c6161cc..e5dda30 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 _0x4a1b=['transfertargetlinkedid','origtransferercontext','origtransfererexten','attended','../client','transfers','Request','CreateVoiceTransferReport','result','transferercalleridnum','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererexten','transfererlinkedid','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereeexten','isexternal','context','extension','attendedTransfer','origtransfererchannel','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','transfertargetchannel','transfertargetcalleridnum','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4a1b,0x76));var _0xb4a1=function(_0x16d411,_0x5e0970){_0x16d411=_0x16d411-0x0;var _0x20336d=_0x4a1b[_0x16d411];return _0x20336d;};'use strict';var client=require(_0xb4a1('0x0'));exports[_0xb4a1('0x1')]={};exports['blindTransfer']=function(_0x4d73e1){return client[_0xb4a1('0x2')](_0xb4a1('0x3'),{'body':{'result':_0x4d73e1[_0xb4a1('0x4')],'transfererchannel':_0x4d73e1['transfererchannel'],'transferercalleridnum':_0x4d73e1[_0xb4a1('0x5')],'transferercalleridname':_0x4d73e1['transferercalleridname'],'transfererconnectedlinenum':_0x4d73e1[_0xb4a1('0x6')],'transfererconnectedlinename':_0x4d73e1[_0xb4a1('0x7')],'transfereraccountcode':_0x4d73e1[_0xb4a1('0x8')],'transferercontext':_0x4d73e1[_0xb4a1('0x9')],'transfererexten':_0x4d73e1[_0xb4a1('0xa')],'transfererlinkedid':_0x4d73e1[_0xb4a1('0xb')],'transfereechannel':_0x4d73e1['transfereechannel'],'transfereecalleridnum':_0x4d73e1['transfereecalleridnum'],'transfereecalleridname':_0x4d73e1[_0xb4a1('0xc')],'transfereeconnectedlinenum':_0x4d73e1[_0xb4a1('0xd')],'transfereeconnectedlinename':_0x4d73e1[_0xb4a1('0xe')],'transfereeaccountcode':_0x4d73e1[_0xb4a1('0xf')],'transfereecontext':_0x4d73e1[_0xb4a1('0x10')],'transfereeexten':_0x4d73e1[_0xb4a1('0x11')],'transfereelinkedid':_0x4d73e1['transfereelinkedid'],'isexternal':_0x4d73e1[_0xb4a1('0x12')],'context':_0x4d73e1[_0xb4a1('0x13')],'extension':_0x4d73e1[_0xb4a1('0x14')],'type':'blind'},'log':_0xb4a1('0x3')});};exports[_0xb4a1('0x15')]=function(_0x3b8e22){return client['Request'](_0xb4a1('0x3'),{'body':{'result':_0x3b8e22[_0xb4a1('0x4')],'transfererchannel':_0x3b8e22[_0xb4a1('0x16')],'transferercalleridnum':_0x3b8e22['origtransferercalleridnum'],'transferercalleridname':_0x3b8e22[_0xb4a1('0x17')],'transfererconnectedlinenum':_0x3b8e22[_0xb4a1('0x18')],'transfererconnectedlinename':_0x3b8e22[_0xb4a1('0x19')],'transfereraccountcode':_0x3b8e22[_0xb4a1('0x1a')],'transferercontext':_0x3b8e22[_0xb4a1('0x1b')],'transfererexten':_0x3b8e22['secondtransfererexten'],'transfererlinkedid':_0x3b8e22['origtransfererlinkedid'],'transfereechannel':_0x3b8e22[_0xb4a1('0x1c')],'transfereecalleridnum':_0x3b8e22[_0xb4a1('0x1d')],'transfereecalleridname':_0x3b8e22['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x3b8e22[_0xb4a1('0x1e')],'transfereeconnectedlinename':_0x3b8e22[_0xb4a1('0x1f')],'transfereeaccountcode':_0x3b8e22[_0xb4a1('0x20')],'transfereecontext':_0x3b8e22[_0xb4a1('0x21')],'transfereeexten':_0x3b8e22['transfertargetexten'],'transfereelinkedid':_0x3b8e22[_0xb4a1('0x22')],'isexternal':_0x3b8e22['isexternal'],'context':_0x3b8e22[_0xb4a1('0x23')],'extension':_0x3b8e22[_0xb4a1('0x24')],'type':_0xb4a1('0x25')},'log':_0xb4a1('0x3')});}; \ No newline at end of file +var _0x41bb=['transfereecontext','transfereeexten','transfereelinkedid','isexternal','context','attendedTransfer','CreateVoiceTransferReport','origtransferercalleridnum','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetaccountcode','transfertargetexten','transfertargetlinkedid','origtransferercontext','origtransfererexten','../client','transfers','blindTransfer','Request','result','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfereraccountcode','transfererlinkedid','transfereechannel','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode'];(function(_0x403e7f,_0x4912f0){var _0x18eef0=function(_0x2b62d2){while(--_0x2b62d2){_0x403e7f['push'](_0x403e7f['shift']());}};_0x18eef0(++_0x4912f0);}(_0x41bb,0x187));var _0xb41b=function(_0x111cb8,_0xae2d9f){_0x111cb8=_0x111cb8-0x0;var _0xb89781=_0x41bb[_0x111cb8];return _0xb89781;};'use strict';var client=require(_0xb41b('0x0'));exports[_0xb41b('0x1')]={};exports[_0xb41b('0x2')]=function(_0x2f0120){return client[_0xb41b('0x3')]('CreateVoiceTransferReport',{'body':{'result':_0x2f0120[_0xb41b('0x4')],'transfererchannel':_0x2f0120[_0xb41b('0x5')],'transferercalleridnum':_0x2f0120[_0xb41b('0x6')],'transferercalleridname':_0x2f0120[_0xb41b('0x7')],'transfererconnectedlinenum':_0x2f0120[_0xb41b('0x8')],'transfererconnectedlinename':_0x2f0120['transfererconnectedlinename'],'transfereraccountcode':_0x2f0120[_0xb41b('0x9')],'transferercontext':_0x2f0120['transferercontext'],'transfererexten':_0x2f0120['transfererexten'],'transfererlinkedid':_0x2f0120[_0xb41b('0xa')],'transfereechannel':_0x2f0120[_0xb41b('0xb')],'transfereecalleridnum':_0x2f0120['transfereecalleridnum'],'transfereecalleridname':_0x2f0120[_0xb41b('0xc')],'transfereeconnectedlinenum':_0x2f0120[_0xb41b('0xd')],'transfereeconnectedlinename':_0x2f0120[_0xb41b('0xe')],'transfereeaccountcode':_0x2f0120[_0xb41b('0xf')],'transfereecontext':_0x2f0120[_0xb41b('0x10')],'transfereeexten':_0x2f0120[_0xb41b('0x11')],'transfereelinkedid':_0x2f0120[_0xb41b('0x12')],'isexternal':_0x2f0120[_0xb41b('0x13')],'context':_0x2f0120[_0xb41b('0x14')],'extension':_0x2f0120['extension'],'type':'blind'},'log':'CreateVoiceTransferReport'});};exports[_0xb41b('0x15')]=function(_0x2bb636){return client[_0xb41b('0x3')](_0xb41b('0x16'),{'body':{'result':_0x2bb636[_0xb41b('0x4')],'transfererchannel':_0x2bb636['origtransfererchannel'],'transferercalleridnum':_0x2bb636[_0xb41b('0x17')],'transferercalleridname':_0x2bb636['origtransferercalleridname'],'transfererconnectedlinenum':_0x2bb636[_0xb41b('0x18')],'transfererconnectedlinename':_0x2bb636[_0xb41b('0x19')],'transfereraccountcode':_0x2bb636[_0xb41b('0x1a')],'transferercontext':_0x2bb636[_0xb41b('0x1b')],'transfererexten':_0x2bb636['secondtransfererexten'],'transfererlinkedid':_0x2bb636[_0xb41b('0x1c')],'transfereechannel':_0x2bb636[_0xb41b('0x1d')],'transfereecalleridnum':_0x2bb636[_0xb41b('0x1e')],'transfereecalleridname':_0x2bb636[_0xb41b('0x1f')],'transfereeconnectedlinenum':_0x2bb636['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x2bb636['transfertargetconnectedlinename'],'transfereeaccountcode':_0x2bb636[_0xb41b('0x20')],'transfereecontext':_0x2bb636['transfertargetcontext'],'transfereeexten':_0x2bb636[_0xb41b('0x21')],'transfereelinkedid':_0x2bb636[_0xb41b('0x22')],'isexternal':_0x2bb636[_0xb41b('0x13')],'context':_0x2bb636[_0xb41b('0x23')],'extension':_0x2bb636[_0xb41b('0x24')],'type':'attended'},'log':_0xb41b('0x16')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index 0b54bff..5b69e0a 100644 --- a/server/services/ami/server/index.js +++ b/server/services/ami/server/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['http','127.0.0.1','log','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','moment','../../../config/environment','../ami','../model/voiceQueueSummary','listen','name','timers','updateAcw','agents','updateStatusRealtime','voiceStatus','pause','isConnected','error','asterisk','ami\x20disconnected','join','pick','keys','reload','Reload','message','catch','username','command','action','Command','then','voiceQueues','hasOwnProperty','push','length','find','omit','undefined','values','channels','validate','map','uniqueid','channel','format','wav','MixMonitor','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','isNil','toLowerCase','mixmonitorid','rec','status','Channel\x20doesn\x27t\x20exist','Action','StopMixMonitor','destinationchannel','stop','filename','queueChannels','type','outbound','includes','Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound','filter','count','rows','voicequeuechannelhangup','voicequeuechannelredirect','Redirect','exten','context','telephones','trunks','outboundChannels','run','custom:','event','faxAccounts','send'];(function(_0x13f11b,_0x54e553){var _0x482f1f=function(_0x39f3c3){while(--_0x39f3c3){_0x13f11b['push'](_0x13f11b['shift']());}};_0x482f1f(++_0x54e553);}(_0x7a54,0x106));var _0x47a5=function(_0x34f236,_0x1c70b6){_0x34f236=_0x34f236-0x0;var _0x2cc7b9=_0x7a54[_0x34f236];return _0x2cc7b9;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var jayson=require(_0x47a5('0x2'));var schema=require('validate');var moment=require(_0x47a5('0x3'));var config=require(_0x47a5('0x4'));var properties=require('../properties');var ami=require(_0x47a5('0x5'));var VoiceQueueSummary=require(_0x47a5('0x6'));exports[_0x47a5('0x7')]=function(_0x3717e1,_0xfdf934,_0x545a97){return new Promise(function(_0x3d5629,_0x59199c){var _0x343372={'QueuePause':function(_0x30e405){return new Promise(function(_0x506eda){var _0x194fb0=util['format']('%s/%s','SIP',_0x30e405[_0x47a5('0x8')]);if(_0x3717e1[_0x47a5('0x9')]&&_0x3717e1['timers'][_0x194fb0]&&_0x3717e1[_0x47a5('0x9')][_0x194fb0]['timer']){_0x3717e1['timers'][_0x194fb0][_0x47a5('0xa')]();}if(_0x3717e1[_0x47a5('0xb')][_0x194fb0]){_0x3717e1[_0x47a5('0xb')][_0x194fb0][_0x47a5('0xc')]({'state':_0x3717e1[_0x47a5('0xb')][_0x194fb0][_0x47a5('0xd')],'statePause':_0x30e405[_0x47a5('0xe')]?!![]:![]});}_0x506eda({'code':0xc8,'message':'QueuePause'});});},'Reload':function(_0x44bd3e){var _0x221b54=this;return new Promise(function(_0x1cf309,_0x711793){if(ami[_0x47a5('0xf')]()==![]){return _0x711793(_0x221b54[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')]['username'],_0x47a5('0x12')][_0x47a5('0x13')]('\x20')));}_0x44bd3e=_[_0x47a5('0x14')](_0x44bd3e,_[_0x47a5('0x15')](properties[_0x47a5('0x16')]['module']));_0x44bd3e['action']=_0x47a5('0x17');return ami['Action'](_0x44bd3e)['then'](function(_0x423a81){_0x1cf309({'code':0xc8,'message':_0x423a81[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x1ef371){_0x711793(_0x221b54[_0x47a5('0x10')](0x1f5,_0x1ef371[_0x47a5('0x18')]));});});},'Command':function(_0x2763d6){var _0xe3c618=this;return new Promise(function(_0x3aed38,_0x4a9fcb){if(ami[_0x47a5('0xf')]()==![]){return _0x4a9fcb(_0xe3c618[_0x47a5('0x10')](0x1f4,[config['asterisk']['ip'],config[_0x47a5('0x11')][_0x47a5('0x1a')],_0x47a5('0x12')]['join']('\x20')));}_0x2763d6=_[_0x47a5('0x14')](_0x2763d6,_0x47a5('0x1b'));_0x2763d6[_0x47a5('0x1c')]=_0x47a5('0x1d');return ami['Action'](_0x2763d6)[_0x47a5('0x1e')](function(_0x385687){_0x3aed38({'code':0xc8,'message':_0x385687['content']});})[_0x47a5('0x19')](function(_0xc4cd63){_0x4a9fcb(_0xe3c618[_0x47a5('0x10')](0x1f5,_0xc4cd63[_0x47a5('0x18')]));});});},'VoiceQueues':function(){return new Promise(function(_0x3abd6a){var _0x50bf17=[];for(var _0x53078a in _0x3717e1[_0x47a5('0x1f')]){if(_0x3717e1['voiceQueues'][_0x47a5('0x20')](_0x53078a)){var _0x5b6c4e=_0x3717e1[_0x47a5('0x1f')][_0x53078a];var _0x378208=new VoiceQueueSummary(_0x5b6c4e);_0x50bf17[_0x47a5('0x21')](_0x378208);}}_0x3abd6a({'count':_0x50bf17[_0x47a5('0x22')],'rows':_0x50bf17});});},'UpdateVoiceQueue':function(_0x21f296){return new Promise(function(_0x3ba0b7,_0x24b162){var _0x136b14=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x1f')],{'id':parseInt(_0x21f296['id'])});var _0x1127f8=_[_0x47a5('0x24')](_0x21f296,['id']);if(_0x136b14){for(var _0x3ad507 in _0x1127f8){if(typeof _0x1127f8[_0x3ad507]!=='undefined'&&typeof _0x136b14[_0x3ad507]!==_0x47a5('0x25')){_0x136b14[_0x3ad507]=_0x1127f8[_0x3ad507];}}_0x3ba0b7(_0x136b14);}else{_0x24b162();}});},'VoiceChannels':function(){return new Promise(function(_0x51833b){var _0x2ef875=_[_0x47a5('0x26')](_0x3717e1[_0x47a5('0x27')]);_0x51833b({'count':_0x2ef875['length'],'rows':_0x2ef875});});},'VoiceChannelMixMonitor':function(_0x256650){var _0x625952=this;return new Promise(function(_0x39b50b,_0x1f1c68){if(ami['isConnected']()==![]){return _0x1f1c68(_0x625952['error'](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')]['username'],'ami\x20disconnected'][_0x47a5('0x13')]('\x20')));}var _0x51544e=schema(properties['voicechannel'])[_0x47a5('0x28')](_0x256650);if(_0x51544e['length']>0x0){return _0x1f1c68(_0x625952[_0x47a5('0x10')](0x1f4,_[_0x47a5('0x29')](_0x51544e,'message')['join'](',\x20')));}var _0x274e34=_['find'](_0x3717e1[_0x47a5('0x27')],{'uniqueid':_0x256650[_0x47a5('0x2a')]});if(_0x274e34&&_0x274e34[_0x47a5('0x2b')]){var _0x52749b=util[_0x47a5('0x2c')]('%s.%s',_0x256650['filename']||_0x256650[_0x47a5('0x2a')],_0x256650['format']||_0x47a5('0x2d'));return ami['Action']({'action':_0x47a5('0x2e'),'channel':_0x274e34[_0x47a5('0x2b')],'file':_0x52749b,'options':_0x47a5('0x2f')})[_0x47a5('0x1e')](function(_0x36add5){var _0xed6320=_[_0x47a5('0x23')](_0x274e34[_0x47a5('0x30')],{'filename':_0x47a5('0x31')+_0x52749b['toLowerCase']()});if(_[_0x47a5('0x32')](_0xed6320)){_0x274e34[_0x47a5('0x30')]['push']({'filename':_0x47a5('0x31')+_0x52749b[_0x47a5('0x33')](),'createdAt':moment()[_0x47a5('0x2c')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x36add5[_0x47a5('0x34')],'status':_0x47a5('0x35')});}else{_0xed6320['mixmonitorid']=_0x36add5[_0x47a5('0x34')];_0xed6320[_0x47a5('0x36')]='rec';}_0x39b50b({'code':0xc8,'message':[_0x256650['uniqueid'],'MixMonitor\x20Success',_0x36add5[_0x47a5('0x34')]]['join']('\x20'),'mixmonitorid':_0x36add5[_0x47a5('0x34')]});})[_0x47a5('0x19')](function(_0x301a85){_0x1f1c68(_0x625952[_0x47a5('0x10')](0x1f5,[_0x256650[_0x47a5('0x2a')],_0x301a85[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x1f1c68(_0x625952[_0x47a5('0x10')](0x1f5,_0x47a5('0x37')));}});},'VoiceChannelStopMixMonitor':function(_0x280500){var _0x1658e8=this;return new Promise(function(_0x23d6d8,_0x56dbbd){if(ami[_0x47a5('0xf')]()==![]){return _0x56dbbd(_0x1658e8[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')]['username'],_0x47a5('0x12')]['join']('\x20')));}var _0x47c7a2=schema(properties['voicechannel'])['validate'](_0x280500);if(_0x47c7a2[_0x47a5('0x22')]>0x0){return _0x56dbbd(_0x1658e8['error'](0x1f4,_[_0x47a5('0x29')](_0x47c7a2,_0x47a5('0x18'))[_0x47a5('0x13')](',\x20')));}var _0x494526=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x27')],{'uniqueid':_0x280500['uniqueid']});if(_0x494526){return Promise['resolve']()[_0x47a5('0x1e')](function(){if(_0x494526['channel']){return ami[_0x47a5('0x38')]({'action':_0x47a5('0x39'),'channel':_0x494526[_0x47a5('0x2b')],'mixmonitorid':_0x280500[_0x47a5('0x34')]})[_0x47a5('0x19')](function(){});}})[_0x47a5('0x1e')](function(){if(_0x494526[_0x47a5('0x3a')]){return ami[_0x47a5('0x38')]({'action':_0x47a5('0x39'),'channel':_0x494526[_0x47a5('0x3a')],'mixmonitorid':_0x280500[_0x47a5('0x34')]})[_0x47a5('0x19')](function(){});}})[_0x47a5('0x1e')](function(){var _0x3574d4=_[_0x47a5('0x23')](_0x494526[_0x47a5('0x30')],{'mixmonitorid':_0x280500['mixmonitorid']});if(_0x3574d4){_0x3574d4[_0x47a5('0x36')]=_0x47a5('0x3b');}})['then'](function(){var _0x52b3a8=util[_0x47a5('0x2c')]('%s.%s',_0x280500[_0x47a5('0x3c')]||_0x280500[_0x47a5('0x2a')],_0x280500['format']||'wav');var _0x3d85cc=_['find'](_0x494526[_0x47a5('0x30')],{'filename':_0x47a5('0x31')+_0x52b3a8[_0x47a5('0x33')]()});if(_0x3d85cc){_0x3d85cc[_0x47a5('0x36')]=_0x47a5('0x3b');}})[_0x47a5('0x1e')](function(){_0x23d6d8({'code':0xc8,'message':[_0x280500[_0x47a5('0x2a')],'StopMixMonitor\x20Success']['join']('\x20')});})[_0x47a5('0x19')](function(_0x411230){_0x56dbbd(_0x1658e8[_0x47a5('0x10')](0x1f5,[_0x280500[_0x47a5('0x2a')],_0x411230[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x56dbbd(_0x1658e8['error'](0x1f5,_0x47a5('0x37')));}});},'VoiceQueuesChannels':function(_0x1c9a62){var _0x5f6a=this;return new Promise(function(_0x5c3c75){var _0x12ca40=_['values'](_0x3717e1[_0x47a5('0x3d')]);var _0xe31817={'count':_0x12ca40[_0x47a5('0x22')],'rows':_0x12ca40};if(_0x1c9a62&&_0x1c9a62[_0x47a5('0x3e')]){if(!['inbound',_0x47a5('0x3f')][_0x47a5('0x40')](_0x1c9a62[_0x47a5('0x3e')])){return _0x59199c(_0x5f6a[_0x47a5('0x10')](0x190,_0x47a5('0x41')));}var _0x6a53b3=_[_0x47a5('0x42')](_0x12ca40,function(_0x481089){return _0x481089[_0x47a5('0x3e')]===_0x1c9a62[_0x47a5('0x3e')];});_0xe31817[_0x47a5('0x43')]=_0x6a53b3[_0x47a5('0x22')];_0xe31817[_0x47a5('0x44')]=_0x6a53b3;}_0x5c3c75(_0xe31817);});},'VoiceQueuesChannel':function(_0x1ab0bf){var _0x572233=this;return new Promise(function(_0x1ad6a9,_0x245a15){var _0x1aa581=schema(properties['voicequeuechannel'])[_0x47a5('0x28')](_0x1ab0bf);if(_0x1aa581[_0x47a5('0x22')]>0x0){return _0x245a15(_0x572233[_0x47a5('0x10')](0x1f4,_['map'](_0x1aa581,'message')[_0x47a5('0x13')](',\x20')));}var _0x376e1d=_['find'](_0x3717e1['queueChannels'],{'uniqueid':_0x1ab0bf[_0x47a5('0x2a')]});if(_0x376e1d){_0x1ad6a9(_0x376e1d);}else{return _0x245a15(_0x572233['error'](0x1f5,_0x47a5('0x37')));}});},'VoiceQueuesChannelHangup':function(_0x5d383d){var _0x482de6=this;return new Promise(function(_0x389ed9,_0x46d2d3){if(ami['isConnected']()==![]){return _0x46d2d3(_0x482de6[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config['asterisk']['username'],_0x47a5('0x12')][_0x47a5('0x13')]('\x20')));}var _0x867da0=schema(properties[_0x47a5('0x45')])['validate'](_0x5d383d);if(_0x867da0[_0x47a5('0x22')]>0x0){return _0x46d2d3(_0x482de6[_0x47a5('0x10')](0x1f4,_[_0x47a5('0x29')](_0x867da0,'message')[_0x47a5('0x13')](',\x20')));}var _0x4db625=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x3d')],{'uniqueid':_0x5d383d[_0x47a5('0x2a')]});if(_0x4db625&&_0x4db625[_0x47a5('0x2b')]){return ami[_0x47a5('0x38')]({'action':'Hangup','channel':_0x4db625[_0x47a5('0x2b')]})['then'](function(_0x5cbe97){_0x389ed9({'code':0xc8,'message':[_0x5d383d['uniqueid'],_0x5cbe97['message'][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')});})[_0x47a5('0x19')](function(_0x52e3ee){_0x46d2d3(_0x482de6['error'](0x1f5,[_0x5d383d[_0x47a5('0x2a')],_0x52e3ee[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x46d2d3(_0x482de6[_0x47a5('0x10')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelRedirect':function(_0x3474b7){var _0x519e9e=this;return new Promise(function(_0x22c886,_0x274d31){if(ami['isConnected']()==![]){return _0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f4,[config[_0x47a5('0x11')]['ip'],config[_0x47a5('0x11')][_0x47a5('0x1a')],_0x47a5('0x12')][_0x47a5('0x13')]('\x20')));}var _0x35cca8=schema(properties[_0x47a5('0x46')])['validate'](_0x3474b7);if(_0x35cca8[_0x47a5('0x22')]>0x0){return _0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f4,_[_0x47a5('0x29')](_0x35cca8,_0x47a5('0x18'))[_0x47a5('0x13')](',\x20')));}var _0x4bbe14=_[_0x47a5('0x23')](_0x3717e1[_0x47a5('0x3d')],{'uniqueid':_0x3474b7[_0x47a5('0x2a')]});if(_0x4bbe14&&_0x4bbe14[_0x47a5('0x2b')]){return ami[_0x47a5('0x38')]({'action':_0x47a5('0x47'),'channel':_0x4bbe14[_0x47a5('0x2b')],'exten':_0x3474b7[_0x47a5('0x48')],'context':_0x3474b7[_0x47a5('0x49')]||_0x4bbe14[_0x47a5('0x49')],'priority':0x1})[_0x47a5('0x1e')](function(_0x44fda9){_0x22c886({'code':0xc8,'message':[_0x3474b7[_0x47a5('0x2a')],_0x44fda9[_0x47a5('0x18')][_0x47a5('0x33')]()]['join']('\x20')});})[_0x47a5('0x19')](function(_0x284fb8){_0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f5,[_0x3474b7['uniqueid'],_0x284fb8[_0x47a5('0x18')][_0x47a5('0x33')]()][_0x47a5('0x13')]('\x20')));});}else{return _0x274d31(_0x519e9e[_0x47a5('0x10')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'Agents':function(_0x3ac402){return new Promise(function(_0x522ccf){var _0x2d5ee6=_['values'](_0x3717e1[_0x47a5('0xb')]);if(_0x3ac402&&_0x3ac402['id']){var _0x4cf7c5=_[_0x47a5('0x23')](_0x2d5ee6,function(_0x2f27c3){return _0x2f27c3['id']===_0x3ac402['id'];});_0x522ccf(_0x4cf7c5);}else{_0x522ccf({'count':_0x2d5ee6[_0x47a5('0x22')],'rows':_0x2d5ee6});}});},'Telephones':function(){return new Promise(function(_0x58473b){var _0x4af557=_['values'](_0x3717e1[_0x47a5('0x4a')]);_0x58473b({'count':_0x4af557[_0x47a5('0x22')],'rows':_0x4af557});});},'Trunks':function(){return new Promise(function(_0xe3c0a7){var _0x117510=_['values'](_0x3717e1[_0x47a5('0x4b')]);_0xe3c0a7({'count':_0x117510[_0x47a5('0x22')],'rows':_0x117510});});},'OutboundChannels':function(){return new Promise(function(_0x390bc0){var _0xd5b23f=_[_0x47a5('0x26')](_0x3717e1[_0x47a5('0x4c')]);_0x390bc0({'count':_0xd5b23f[_0x47a5('0x22')],'rows':_0xd5b23f});});},'Outbound':function(){return new Promise(function(_0x39939a){_0x39939a(_0x3717e1[_0x47a5('0x3f')]);});},'Campaigns':function(){return new Promise(function(_0xc69a68){var _0x2e6fcc=_[_0x47a5('0x26')](_0x3717e1['campaigns']);_0xc69a68({'count':_0x2e6fcc[_0x47a5('0x22')],'rows':_0x2e6fcc});});},'VoiceQueuesPreview':function(_0x4833be){var _0x2ad00a=this;return new Promise(function(_0x2ac30f,_0x281e5f){_0xfdf934[_0x47a5('0x4d')](_0x4833be['id'])[_0x47a5('0x1e')](function(_0xa9c853){_0x2ac30f({'code':0xc8,'message':_0xa9c853[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x11c1db){_0x281e5f(_0x2ad00a[_0x47a5('0x10')](0x1f4,_0x11c1db[_0x47a5('0x18')]));});});},'EventManager':function(_0x1f07ac){var _0x8f0035=this;return new Promise(function(_0x2d434c,_0x441d64){if(!_0x1f07ac['event']){return _0x441d64(_0x8f0035['error'](0x1f4,'Event\x20name\x20mandatory'));}ami['emit'](_0x47a5('0x4e')+_0x1f07ac[_0x47a5('0x4f')],_0x1f07ac['message']);_0x2d434c({'code':0xc8,'message':_0x1f07ac});});},'FaxAccounts':function(){return new Promise(function(_0x732e00){var _0x44dda2=_[_0x47a5('0x26')](_0x3717e1[_0x47a5('0x50')]);_0x732e00({'count':_0x44dda2[_0x47a5('0x22')],'rows':_0x44dda2});});},'SendFax':function(_0x930d25){var _0x218dfa=this;return new Promise(function(_0x1c7302,_0x2e9a96){_0x545a97[_0x47a5('0x51')](_0x930d25)[_0x47a5('0x1e')](function(_0x5e5f16){_0x1c7302({'code':0xc8,'message':_0x5e5f16[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x420671){_0x2e9a96(_0x218dfa['error'](0x1f4,_0x420671[_0x47a5('0x18')]));});});},'CheckAfterSend':function(_0x32f393){var _0x17b61d=this;return new Promise(function(_0x5d41d8,_0x19dc8c){_0x545a97['checkAfterSend'](_0x32f393)['then'](function(_0x356e16){_0x5d41d8({'code':0xc8,'message':_0x356e16[_0x47a5('0x18')]});})[_0x47a5('0x19')](function(_0x27333e){_0x19dc8c(_0x17b61d[_0x47a5('0x10')](0x1f4,_0x27333e[_0x47a5('0x18')]));});});}};var _0x479a82=jayson['server'](_0x343372)[_0x47a5('0x52')]();_0x479a82['on']('error',function(_0x24dbee){return _0x59199c(_0x24dbee);});_0x479a82[_0x47a5('0x7')](0x232a,_0x47a5('0x53'),function(){console[_0x47a5('0x54')]('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x3d5629(_0x47a5('0x55')+0x232a);});});}; \ No newline at end of file +var _0xb10b=['type','Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound','filter','count','rows','voicequeuechannel','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect','telephones','trunks','run','event','Event\x20name\x20mandatory','faxAccounts','send','checkAfterSend','server','http','127.0.0.1','RPC\x20listening\x20on\x20port:','lodash','jayson/promise','validate','moment','../properties','../ami','../model/voiceQueueSummary','listen','format','%s/%s','SIP','name','timers','timer','updateAcw','agents','voiceStatus','pause','QueuePause','isConnected','error','asterisk','username','ami\x20disconnected','join','pick','keys','module','action','Reload','Action','then','message','catch','command','Command','content','voiceQueues','hasOwnProperty','push','length','find','omit','undefined','values','voicechannel','map','channels','uniqueid','channel','%s.%s','filename','wav','ai(mixmonitorid)','/var/spool/asterisk/monitor/','toLowerCase','mixmonitorid','rec','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','resolve','StopMixMonitor','destinationchannel','monitors','stop','queueChannels','inbound','outbound','includes'];(function(_0x259695,_0x23769c){var _0x57d212=function(_0x41850d){while(--_0x41850d){_0x259695['push'](_0x259695['shift']());}};_0x57d212(++_0x23769c);}(_0xb10b,0x12a));var _0xbb10=function(_0x55b037,_0x2d9392){_0x55b037=_0x55b037-0x0;var _0x5f1053=_0xb10b[_0x55b037];return _0x5f1053;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var jayson=require(_0xbb10('0x1'));var schema=require(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var config=require('../../../config/environment');var properties=require(_0xbb10('0x4'));var ami=require(_0xbb10('0x5'));var VoiceQueueSummary=require(_0xbb10('0x6'));exports[_0xbb10('0x7')]=function(_0x49baf4,_0x312b72,_0x481979){return new Promise(function(_0x328583,_0x3cdd53){var _0x513741={'QueuePause':function(_0x1b9e94){return new Promise(function(_0x3fb675){var _0x21370f=util[_0xbb10('0x8')](_0xbb10('0x9'),_0xbb10('0xa'),_0x1b9e94[_0xbb10('0xb')]);if(_0x49baf4[_0xbb10('0xc')]&&_0x49baf4['timers'][_0x21370f]&&_0x49baf4['timers'][_0x21370f][_0xbb10('0xd')]){_0x49baf4[_0xbb10('0xc')][_0x21370f][_0xbb10('0xe')]();}if(_0x49baf4['agents'][_0x21370f]){_0x49baf4[_0xbb10('0xf')][_0x21370f]['updateStatusRealtime']({'state':_0x49baf4[_0xbb10('0xf')][_0x21370f][_0xbb10('0x10')],'statePause':_0x1b9e94[_0xbb10('0x11')]?!![]:![]});}_0x3fb675({'code':0xc8,'message':_0xbb10('0x12')});});},'Reload':function(_0x442548){var _0x147230=this;return new Promise(function(_0x58a612,_0x26e021){if(ami[_0xbb10('0x13')]()==![]){return _0x26e021(_0x147230[_0xbb10('0x14')](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}_0x442548=_[_0xbb10('0x19')](_0x442548,_[_0xbb10('0x1a')](properties['reload'][_0xbb10('0x1b')]));_0x442548[_0xbb10('0x1c')]=_0xbb10('0x1d');return ami[_0xbb10('0x1e')](_0x442548)[_0xbb10('0x1f')](function(_0x1682a4){_0x58a612({'code':0xc8,'message':_0x1682a4[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0xbf2906){_0x26e021(_0x147230[_0xbb10('0x14')](0x1f5,_0xbf2906['message']));});});},'Command':function(_0x5ff0cf){var _0x19f48d=this;return new Promise(function(_0x388fab,_0x109908){if(ami[_0xbb10('0x13')]()==![]){return _0x109908(_0x19f48d[_0xbb10('0x14')](0x1f4,[config['asterisk']['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],'ami\x20disconnected']['join']('\x20')));}_0x5ff0cf=_[_0xbb10('0x19')](_0x5ff0cf,_0xbb10('0x22'));_0x5ff0cf[_0xbb10('0x1c')]=_0xbb10('0x23');return ami[_0xbb10('0x1e')](_0x5ff0cf)[_0xbb10('0x1f')](function(_0x407cb4){_0x388fab({'code':0xc8,'message':_0x407cb4[_0xbb10('0x24')]});})[_0xbb10('0x21')](function(_0x395404){_0x109908(_0x19f48d[_0xbb10('0x14')](0x1f5,_0x395404[_0xbb10('0x20')]));});});},'VoiceQueues':function(){return new Promise(function(_0x537898){var _0x4fedac=[];for(var _0x4fb5e0 in _0x49baf4[_0xbb10('0x25')]){if(_0x49baf4[_0xbb10('0x25')][_0xbb10('0x26')](_0x4fb5e0)){var _0x4e25ff=_0x49baf4[_0xbb10('0x25')][_0x4fb5e0];var _0x24d586=new VoiceQueueSummary(_0x4e25ff);_0x4fedac[_0xbb10('0x27')](_0x24d586);}}_0x537898({'count':_0x4fedac[_0xbb10('0x28')],'rows':_0x4fedac});});},'UpdateVoiceQueue':function(_0x1acce9){return new Promise(function(_0x20d946,_0x2a0e8b){var _0x4aabb9=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x25')],{'id':parseInt(_0x1acce9['id'])});var _0xfc3595=_[_0xbb10('0x2a')](_0x1acce9,['id']);if(_0x4aabb9){for(var _0x1d30aa in _0xfc3595){if(typeof _0xfc3595[_0x1d30aa]!==_0xbb10('0x2b')&&typeof _0x4aabb9[_0x1d30aa]!=='undefined'){_0x4aabb9[_0x1d30aa]=_0xfc3595[_0x1d30aa];}}_0x20d946(_0x4aabb9);}else{_0x2a0e8b();}});},'VoiceChannels':function(){return new Promise(function(_0x221624){var _0x4ee02e=_[_0xbb10('0x2c')](_0x49baf4['channels']);_0x221624({'count':_0x4ee02e[_0xbb10('0x28')],'rows':_0x4ee02e});});},'VoiceChannelMixMonitor':function(_0x1dcc9c){var _0x1b59f9=this;return new Promise(function(_0x491db4,_0x518d47){if(ami[_0xbb10('0x13')]()==![]){return _0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f4,[config['asterisk']['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}var _0x37a83f=schema(properties[_0xbb10('0x2d')])[_0xbb10('0x2')](_0x1dcc9c);if(_0x37a83f['length']>0x0){return _0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x37a83f,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0xfb2c5e=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x2f')],{'uniqueid':_0x1dcc9c[_0xbb10('0x30')]});if(_0xfb2c5e&&_0xfb2c5e[_0xbb10('0x31')]){var _0x56943c=util[_0xbb10('0x8')](_0xbb10('0x32'),_0x1dcc9c[_0xbb10('0x33')]||_0x1dcc9c[_0xbb10('0x30')],_0x1dcc9c['format']||_0xbb10('0x34'));return ami['Action']({'action':'MixMonitor','channel':_0xfb2c5e[_0xbb10('0x31')],'file':_0x56943c,'options':_0xbb10('0x35')})[_0xbb10('0x1f')](function(_0x120d21){var _0x15d895=_[_0xbb10('0x29')](_0xfb2c5e['monitors'],{'filename':_0xbb10('0x36')+_0x56943c[_0xbb10('0x37')]()});if(_['isNil'](_0x15d895)){_0xfb2c5e['monitors']['push']({'filename':_0xbb10('0x36')+_0x56943c[_0xbb10('0x37')](),'createdAt':moment()[_0xbb10('0x8')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x120d21[_0xbb10('0x38')],'status':_0xbb10('0x39')});}else{_0x15d895[_0xbb10('0x38')]=_0x120d21['mixmonitorid'];_0x15d895[_0xbb10('0x3a')]=_0xbb10('0x39');}_0x491db4({'code':0xc8,'message':[_0x1dcc9c[_0xbb10('0x30')],_0xbb10('0x3b'),_0x120d21['mixmonitorid']][_0xbb10('0x18')]('\x20'),'mixmonitorid':_0x120d21[_0xbb10('0x38')]});})['catch'](function(_0xe2040f){_0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f5,[_0x1dcc9c[_0xbb10('0x30')],_0xe2040f[_0xbb10('0x20')][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')));});}else{return _0x518d47(_0x1b59f9['error'](0x1f5,_0xbb10('0x3c')));}});},'VoiceChannelStopMixMonitor':function(_0x1c7fae){var _0x3e7b4c=this;return new Promise(function(_0x3d3c41,_0x4943d9){if(ami[_0xbb10('0x13')]()==![]){return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')]['username'],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}var _0x54ac18=schema(properties['voicechannel'])[_0xbb10('0x2')](_0x1c7fae);if(_0x54ac18['length']>0x0){return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x54ac18,'message')[_0xbb10('0x18')](',\x20')));}var _0x1d82bf=_[_0xbb10('0x29')](_0x49baf4['channels'],{'uniqueid':_0x1c7fae[_0xbb10('0x30')]});if(_0x1d82bf){return Promise[_0xbb10('0x3d')]()[_0xbb10('0x1f')](function(){if(_0x1d82bf[_0xbb10('0x31')]){return ami[_0xbb10('0x1e')]({'action':_0xbb10('0x3e'),'channel':_0x1d82bf[_0xbb10('0x31')],'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]})[_0xbb10('0x21')](function(){});}})[_0xbb10('0x1f')](function(){if(_0x1d82bf[_0xbb10('0x3f')]){return ami[_0xbb10('0x1e')]({'action':'StopMixMonitor','channel':_0x1d82bf[_0xbb10('0x3f')],'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]})['catch'](function(){});}})[_0xbb10('0x1f')](function(){var _0x2f5027=_[_0xbb10('0x29')](_0x1d82bf[_0xbb10('0x40')],{'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]});if(_0x2f5027){_0x2f5027[_0xbb10('0x3a')]=_0xbb10('0x41');}})['then'](function(){var _0x4a9793=util[_0xbb10('0x8')](_0xbb10('0x32'),_0x1c7fae[_0xbb10('0x33')]||_0x1c7fae['uniqueid'],_0x1c7fae['format']||_0xbb10('0x34'));var _0x34cf4e=_[_0xbb10('0x29')](_0x1d82bf[_0xbb10('0x40')],{'filename':_0xbb10('0x36')+_0x4a9793[_0xbb10('0x37')]()});if(_0x34cf4e){_0x34cf4e[_0xbb10('0x3a')]=_0xbb10('0x41');}})[_0xbb10('0x1f')](function(){_0x3d3c41({'code':0xc8,'message':[_0x1c7fae[_0xbb10('0x30')],'StopMixMonitor\x20Success']['join']('\x20')});})[_0xbb10('0x21')](function(_0x467dba){_0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f5,[_0x1c7fae[_0xbb10('0x30')],_0x467dba[_0xbb10('0x20')][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')));});}else{return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannels':function(_0x1214f7){var _0x19ca3e=this;return new Promise(function(_0x20e18a){var _0x61e689=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x42')]);var _0x547a7a={'count':_0x61e689[_0xbb10('0x28')],'rows':_0x61e689};if(_0x1214f7&&_0x1214f7['type']){if(![_0xbb10('0x43'),_0xbb10('0x44')][_0xbb10('0x45')](_0x1214f7[_0xbb10('0x46')])){return _0x3cdd53(_0x19ca3e[_0xbb10('0x14')](0x190,_0xbb10('0x47')));}var _0x2e3326=_[_0xbb10('0x48')](_0x61e689,function(_0x180400){return _0x180400[_0xbb10('0x46')]===_0x1214f7[_0xbb10('0x46')];});_0x547a7a[_0xbb10('0x49')]=_0x2e3326[_0xbb10('0x28')];_0x547a7a[_0xbb10('0x4a')]=_0x2e3326;}_0x20e18a(_0x547a7a);});},'VoiceQueuesChannel':function(_0x4475e1){var _0x5de0cc=this;return new Promise(function(_0x4571b6,_0x466eb7){var _0x1b83a9=schema(properties[_0xbb10('0x4b')])[_0xbb10('0x2')](_0x4475e1);if(_0x1b83a9[_0xbb10('0x28')]>0x0){return _0x466eb7(_0x5de0cc['error'](0x1f4,_[_0xbb10('0x2e')](_0x1b83a9,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x14fed3=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x4475e1[_0xbb10('0x30')]});if(_0x14fed3){_0x4571b6(_0x14fed3);}else{return _0x466eb7(_0x5de0cc[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannelHangup':function(_0x40c4fb){var _0x2eb05a=this;return new Promise(function(_0x2a1ce1,_0x16932f){if(ami['isConnected']()==![]){return _0x16932f(_0x2eb05a['error'](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')]['join']('\x20')));}var _0x506498=schema(properties[_0xbb10('0x4c')])[_0xbb10('0x2')](_0x40c4fb);if(_0x506498[_0xbb10('0x28')]>0x0){return _0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x506498,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x4a5fb9=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x40c4fb['uniqueid']});if(_0x4a5fb9&&_0x4a5fb9['channel']){return ami['Action']({'action':_0xbb10('0x4d'),'channel':_0x4a5fb9[_0xbb10('0x31')]})[_0xbb10('0x1f')](function(_0x5bd1c0){_0x2a1ce1({'code':0xc8,'message':[_0x40c4fb['uniqueid'],_0x5bd1c0['message'][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')});})[_0xbb10('0x21')](function(_0x4e9fbd){_0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f5,[_0x40c4fb[_0xbb10('0x30')],_0x4e9fbd['message']['toLowerCase']()][_0xbb10('0x18')]('\x20')));});}else{return _0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannelRedirect':function(_0x237246){var _0x54b7c5=this;return new Promise(function(_0x43eaec,_0xec48ac){if(ami[_0xbb10('0x13')]()==![]){return _0xec48ac(_0x54b7c5['error'](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],'ami\x20disconnected'][_0xbb10('0x18')]('\x20')));}var _0x31e85e=schema(properties[_0xbb10('0x4e')])[_0xbb10('0x2')](_0x237246);if(_0x31e85e['length']>0x0){return _0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x31e85e,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x56b3a3=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x237246[_0xbb10('0x30')]});if(_0x56b3a3&&_0x56b3a3[_0xbb10('0x31')]){return ami[_0xbb10('0x1e')]({'action':_0xbb10('0x4f'),'channel':_0x56b3a3[_0xbb10('0x31')],'exten':_0x237246['exten'],'context':_0x237246['context']||_0x56b3a3['context'],'priority':0x1})[_0xbb10('0x1f')](function(_0x9c672d){_0x43eaec({'code':0xc8,'message':[_0x237246[_0xbb10('0x30')],_0x9c672d['message']['toLowerCase']()][_0xbb10('0x18')]('\x20')});})[_0xbb10('0x21')](function(_0xd9e743){_0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f5,[_0x237246[_0xbb10('0x30')],_0xd9e743[_0xbb10('0x20')]['toLowerCase']()][_0xbb10('0x18')]('\x20')));});}else{return _0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'Agents':function(_0x14f16b){return new Promise(function(_0x2aaaa6){var _0x5bfc68=_['values'](_0x49baf4['agents']);if(_0x14f16b&&_0x14f16b['id']){var _0x329da7=_[_0xbb10('0x29')](_0x5bfc68,function(_0x36917f){return _0x36917f['id']===_0x14f16b['id'];});_0x2aaaa6(_0x329da7);}else{_0x2aaaa6({'count':_0x5bfc68[_0xbb10('0x28')],'rows':_0x5bfc68});}});},'Telephones':function(){return new Promise(function(_0x2f7d2a){var _0x1d40b8=_['values'](_0x49baf4[_0xbb10('0x50')]);_0x2f7d2a({'count':_0x1d40b8['length'],'rows':_0x1d40b8});});},'Trunks':function(){return new Promise(function(_0x4fe3b5){var _0x519a54=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x51')]);_0x4fe3b5({'count':_0x519a54[_0xbb10('0x28')],'rows':_0x519a54});});},'OutboundChannels':function(){return new Promise(function(_0x108f99){var _0x5ce94f=_[_0xbb10('0x2c')](_0x49baf4['outboundChannels']);_0x108f99({'count':_0x5ce94f['length'],'rows':_0x5ce94f});});},'Outbound':function(){return new Promise(function(_0x165fe9){_0x165fe9(_0x49baf4[_0xbb10('0x44')]);});},'Campaigns':function(){return new Promise(function(_0x29529c){var _0x2bd2ab=_[_0xbb10('0x2c')](_0x49baf4['campaigns']);_0x29529c({'count':_0x2bd2ab[_0xbb10('0x28')],'rows':_0x2bd2ab});});},'VoiceQueuesPreview':function(_0x19fcec){var _0x2c6429=this;return new Promise(function(_0x3f3d38,_0x43cdb7){_0x312b72[_0xbb10('0x52')](_0x19fcec['id'])[_0xbb10('0x1f')](function(_0x53fa98){_0x3f3d38({'code':0xc8,'message':_0x53fa98[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0x30f3ea){_0x43cdb7(_0x2c6429[_0xbb10('0x14')](0x1f4,_0x30f3ea[_0xbb10('0x20')]));});});},'EventManager':function(_0x172be3){var _0xa3b23=this;return new Promise(function(_0x312a08,_0x5a4429){if(!_0x172be3[_0xbb10('0x53')]){return _0x5a4429(_0xa3b23[_0xbb10('0x14')](0x1f4,_0xbb10('0x54')));}ami['emit']('custom:'+_0x172be3['event'],_0x172be3[_0xbb10('0x20')]);_0x312a08({'code':0xc8,'message':_0x172be3});});},'FaxAccounts':function(){return new Promise(function(_0x5a3c44){var _0x4e3d6a=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x55')]);_0x5a3c44({'count':_0x4e3d6a[_0xbb10('0x28')],'rows':_0x4e3d6a});});},'SendFax':function(_0x12ed63){var _0x32ec27=this;return new Promise(function(_0x24dca6,_0x33116){_0x481979[_0xbb10('0x56')](_0x12ed63)[_0xbb10('0x1f')](function(_0x5206e1){_0x24dca6({'code':0xc8,'message':_0x5206e1[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0x46b6d2){_0x33116(_0x32ec27[_0xbb10('0x14')](0x1f4,_0x46b6d2['message']));});});},'CheckAfterSend':function(_0x4c0795){var _0x3547a3=this;return new Promise(function(_0x2280bd,_0x30f0a4){_0x481979[_0xbb10('0x57')](_0x4c0795)['then'](function(_0x17d596){_0x2280bd({'code':0xc8,'message':_0x17d596[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0xf7b3e1){_0x30f0a4(_0x3547a3[_0xbb10('0x14')](0x1f4,_0xf7b3e1['message']));});});}};var _0x5f0691=jayson[_0xbb10('0x58')](_0x513741)[_0xbb10('0x59')]();_0x5f0691['on'](_0xbb10('0x14'),function(_0x5239da){return _0x3cdd53(_0x5239da);});_0x5f0691[_0xbb10('0x7')](0x232a,_0xbb10('0x5a'),function(){console['log']('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x328583(_0xbb10('0x5b')+0x232a);});});}; \ No newline at end of file diff --git a/server/services/ami/trigger/cmContact/index.js b/server/services/ami/trigger/cmContact/index.js index 1d5c2c2..526ebc1 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 _0xb9be=['firstName','createdAt','updatedAt','union','resolve','then','getContacts','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','calleridname','destcalleridname','Unknown','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','','format','user:%s','name','trigger:%s','toLowerCase','merge','lodash','bluebird','ioredis','util','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact','redis','localhost','socket.io-emitter','info','[CM][%s][%s]','stringify','emit','exec','data1','isNil','data5','ListId','data3','split','phone','$or','routeId','destcalleridnum','calleridnum'];(function(_0x2e4698,_0x3e248d){var _0x86ee86=function(_0x1fc86d){while(--_0x1fc86d){_0x2e4698['push'](_0x2e4698['shift']());}};_0x86ee86(++_0x3e248d);}(_0xb9be,0xc5));var _0xeb9b=function(_0x80d733,_0x266211){_0x80d733=_0x80d733-0x0;var _0x435868=_0xb9be[_0x80d733];return _0x435868;};'use strict';var _=require(_0xeb9b('0x0'));var BPromise=require(_0xeb9b('0x1'));var Redis=require(_0xeb9b('0x2'));var util=require(_0xeb9b('0x3'));var config=require(_0xeb9b('0x4'));var logger=require(_0xeb9b('0x5'))(_0xeb9b('0x6'));var cmContactRpc=require(_0xeb9b('0x7'));config[_0xeb9b('0x8')]=_['defaults'](config['redis'],{'host':_0xeb9b('0x9'),'port':0x18eb});var io=require(_0xeb9b('0xa'))(new Redis(config[_0xeb9b('0x8')]));function emit(_0x49a8b9,_0x1ee7e0,_0x58ca1d,_0x210eeb,_0x28dc5f){logger[_0xeb9b('0xb')](_0xeb9b('0xc'),_0x49a8b9,_0x1ee7e0['id'],_0x58ca1d,_0x210eeb,JSON[_0xeb9b('0xd')](_0x28dc5f));io['to'](_0x58ca1d)[_0xeb9b('0xe')](_0x210eeb,_0x28dc5f);}exports[_0xeb9b('0xf')]=function(_0x4f4952,_0x20c855,_0x58d6a4,_0x4ea7bb){var _0xa3b541,_0x4236c0;var _0x4975dd={};var _0x2b7405;var _0x1def58=Number(_0x58d6a4[_0xeb9b('0x10')]);var _0x2a01df=_0x58d6a4['data2']?Boolean(Number(_0x58d6a4['data2'])):![];var _0x5af455;var _0x355edb=![];if(!_[_0xeb9b('0x11')](_0x58d6a4[_0xeb9b('0x12')])){if(_0x58d6a4['data5']=='1')_0x355edb=!![];}if(!_0x355edb){if(_0x4ea7bb['xmd-contactid']){_0x4975dd['id']=_0x4ea7bb['xmd-contactid'];}}if(!_0x4975dd['id']){_0x4975dd[_0xeb9b('0x13')]=_0x1def58;_0x5af455=_0x58d6a4[_0xeb9b('0x14')]&&_0x58d6a4[_0xeb9b('0x14')]!=='0'?_0x58d6a4[_0xeb9b('0x14')][_0xeb9b('0x15')](','):[_0xeb9b('0x16')];_0x4975dd[_0xeb9b('0x17')]=_['map'](_0x5af455,function(_0x2e8645){var _0x36e871={};_0x36e871[_0x2e8645]=_0x4ea7bb[_0xeb9b('0x18')]?_0x4ea7bb[_0xeb9b('0x19')]:_0x4ea7bb[_0xeb9b('0x1a')];return _0x36e871;});_0x2b7405=_0x4ea7bb[_0xeb9b('0x18')]?_0x4ea7bb[_0xeb9b('0x19')]:_0x4ea7bb[_0xeb9b('0x1a')];}var _0x2c199f=['id',_0xeb9b('0x1b'),'lastName',_0xeb9b('0x16'),'mobile','fax',_0xeb9b('0x13'),_0xeb9b('0x1c'),'scheduledAt',_0xeb9b('0x1d')];var _0x2dabb1=_[_0xeb9b('0x1e')](_0x2c199f,_0x5af455);BPromise[_0xeb9b('0x1f')]()[_0xeb9b('0x20')](cmContactRpc[_0xeb9b('0x21')]({'attributes':_0x2dabb1,'where':_0x4975dd,'phone':_0x2b7405}))[_0xeb9b('0x20')](function(_0x15e5b8){_0x4236c0=_0x15e5b8;if(!_[_0xeb9b('0x22')](_0x4236c0)){if(_0x4236c0[_0xeb9b('0x23')]===0x1){_0xa3b541=_0x4236c0[0x0];logger[_0xeb9b('0xb')](_0xeb9b('0x24'),_0x4ea7bb[_0xeb9b('0x25')],_0x20c855['id'],_0xa3b541['id']);}else{logger[_0xeb9b('0xb')](_0xeb9b('0x26'),_0x4ea7bb[_0xeb9b('0x25')],_0x20c855['id'],_['map'](_0x4236c0,'id')[_0xeb9b('0x27')](','));}return;}else{logger['info'](_0xeb9b('0x28'),_0x4ea7bb['uniqueid'],_0x20c855['id']);var _0x347ec1={'ListId':_0x1def58};var _0x4361b9=_0x58d6a4[_0xeb9b('0x29')]&&_0x58d6a4[_0xeb9b('0x29')]!=='0'?_0x58d6a4['data4']:_0xeb9b('0x16');if(_0x2a01df){logger[_0xeb9b('0xb')]('[CM][%s][%s]\x20Autocreate\x20enabled',_0x4ea7bb[_0xeb9b('0x25')],_0x20c855['id']);_0x347ec1[_0x4361b9]=_[_0xeb9b('0x11')](_0x4ea7bb['routeId'])?_0x4ea7bb[_0xeb9b('0x1a')]:_0x4ea7bb[_0xeb9b('0x19')];if(_[_0xeb9b('0x11')](_0x4ea7bb['routeId'])){_0x347ec1[_0xeb9b('0x1b')]=_0x4ea7bb['calleridname']&&_0x4ea7bb[_0xeb9b('0x2a')]!==''?_0x4ea7bb[_0xeb9b('0x2a')]:'Unknown';}else{_0x347ec1[_0xeb9b('0x1b')]=_0x4ea7bb['destcalleridname']&&_0x4ea7bb[_0xeb9b('0x2b')]!==''?_0x4ea7bb[_0xeb9b('0x2b')]:_0xeb9b('0x2c');}return BPromise[_0xeb9b('0x1f')]()[_0xeb9b('0x20')](cmContactRpc[_0xeb9b('0x2d')](_0x347ec1))[_0xeb9b('0x20')](function(_0x9efe80){_0xa3b541=_0x9efe80;_0x4236c0[_0xeb9b('0x2e')](_0x9efe80);if(_0xa3b541){logger[_0xeb9b('0xb')](_0xeb9b('0x2f'),_0x4ea7bb['uniqueid'],_0x20c855['id'],_0xa3b541['id']);}return;});}else{logger[_0xeb9b('0xb')](_0xeb9b('0x30'),_0x4ea7bb[_0xeb9b('0x25')],_0x20c855['id']);_0x347ec1[_0x4361b9]=_[_0xeb9b('0x11')](_0x4ea7bb[_0xeb9b('0x18')])?_0x4ea7bb[_0xeb9b('0x1a')]:_0x4ea7bb[_0xeb9b('0x19')];if(_['isNil'](_0x4ea7bb[_0xeb9b('0x18')])){_0x347ec1[_0xeb9b('0x1b')]=_0x4ea7bb[_0xeb9b('0x2a')]&&_0x4ea7bb['calleridname']!==_0xeb9b('0x31')?_0x4ea7bb[_0xeb9b('0x2a')]:_0xeb9b('0x2c');}else{_0x347ec1[_0xeb9b('0x1b')]=_0x4ea7bb[_0xeb9b('0x2b')]&&_0x4ea7bb[_0xeb9b('0x2b')]!==''?_0x4ea7bb[_0xeb9b('0x2b')]:_0xeb9b('0x2c');}_0xa3b541=_0x347ec1;_0x4236c0['push'](_0x347ec1);return;}}})[_0xeb9b('0x20')](function(){if(_0x4f4952){emit(_0x4ea7bb[_0xeb9b('0x25')],_0x20c855,util[_0xeb9b('0x32')](_0xeb9b('0x33'),_0x4f4952[_0xeb9b('0x34')]),util[_0xeb9b('0x32')](_0xeb9b('0x35'),_0x58d6a4['action'][_0xeb9b('0x36')]()),{'evt':_[_0xeb9b('0x37')](_0x4ea7bb,{'autoCreate':_0x2a01df}),'contact':_0xa3b541===undefined?{}:_0xa3b541,'contacts':_0x4236c0[_0xeb9b('0x23')]===0x0?undefined:_0x4236c0});}});}; \ No newline at end of file +var _0x8572=['toLowerCase','merge','length','lodash','ioredis','util','trigger','defaults','redis','socket.io-emitter','info','[CM][%s][%s]','stringify','emit','data1','data2','isNil','xmd-contactid','data3','split','$or','map','routeId','destcalleridnum','calleridnum','firstName','lastName','mobile','fax','ListId','scheduledAt','updatedAt','resolve','then','getContacts','isEmpty','[CM][%s][%s]\x20Contact\x20found:%s','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','uniqueid','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','phone','calleridname','','Unknown','destcalleridname','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','user:%s','name','trigger:%s','action'];(function(_0x22f8ab,_0x15d8ff){var _0x2a70e5=function(_0x5e6895){while(--_0x5e6895){_0x22f8ab['push'](_0x22f8ab['shift']());}};_0x2a70e5(++_0x15d8ff);}(_0x8572,0xdf));var _0x2857=function(_0x1eda20,_0x1149f4){_0x1eda20=_0x1eda20-0x0;var _0x31b953=_0x8572[_0x1eda20];return _0x31b953;};'use strict';var _=require(_0x2857('0x0'));var BPromise=require('bluebird');var Redis=require(_0x2857('0x1'));var util=require(_0x2857('0x2'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0x2857('0x3'));var cmContactRpc=require('../../rpc/cmContact');config['redis']=_[_0x2857('0x4')](config[_0x2857('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x2857('0x6'))(new Redis(config[_0x2857('0x5')]));function emit(_0x381e8d,_0x273812,_0x124a89,_0x522bb1,_0x1895f8){logger[_0x2857('0x7')](_0x2857('0x8'),_0x381e8d,_0x273812['id'],_0x124a89,_0x522bb1,JSON[_0x2857('0x9')](_0x1895f8));io['to'](_0x124a89)[_0x2857('0xa')](_0x522bb1,_0x1895f8);}exports['exec']=function(_0xe889e9,_0x36eb68,_0x67ef7c,_0x3103d8){var _0x4ab746,_0x5f3598;var _0x57ed87={};var _0x1f312b;var _0x50b59c=Number(_0x67ef7c[_0x2857('0xb')]);var _0x4b5d59=_0x67ef7c['data2']?Boolean(Number(_0x67ef7c[_0x2857('0xc')])):![];var _0x3cfef4;var _0x5a25a0=![];if(!_[_0x2857('0xd')](_0x67ef7c['data5'])){if(_0x67ef7c['data5']=='1')_0x5a25a0=!![];}if(!_0x5a25a0){if(_0x3103d8['xmd-contactid']){_0x57ed87['id']=_0x3103d8[_0x2857('0xe')];}}if(!_0x57ed87['id']){_0x57ed87['ListId']=_0x50b59c;_0x3cfef4=_0x67ef7c[_0x2857('0xf')]&&_0x67ef7c[_0x2857('0xf')]!=='0'?_0x67ef7c[_0x2857('0xf')][_0x2857('0x10')](','):['phone'];_0x57ed87[_0x2857('0x11')]=_[_0x2857('0x12')](_0x3cfef4,function(_0x4c1c6a){var _0x1a4f94={};_0x1a4f94[_0x4c1c6a]=_0x3103d8[_0x2857('0x13')]?_0x3103d8[_0x2857('0x14')]:_0x3103d8[_0x2857('0x15')];return _0x1a4f94;});_0x1f312b=_0x3103d8[_0x2857('0x13')]?_0x3103d8['destcalleridnum']:_0x3103d8['calleridnum'];}var _0xbaed8a=['id',_0x2857('0x16'),_0x2857('0x17'),'phone',_0x2857('0x18'),_0x2857('0x19'),_0x2857('0x1a'),'createdAt',_0x2857('0x1b'),_0x2857('0x1c')];var _0x472e44=_['union'](_0xbaed8a,_0x3cfef4);BPromise[_0x2857('0x1d')]()[_0x2857('0x1e')](cmContactRpc[_0x2857('0x1f')]({'attributes':_0x472e44,'where':_0x57ed87,'phone':_0x1f312b}))[_0x2857('0x1e')](function(_0xfddb5a){_0x5f3598=_0xfddb5a;if(!_[_0x2857('0x20')](_0x5f3598)){if(_0x5f3598['length']===0x1){_0x4ab746=_0x5f3598[0x0];logger['info'](_0x2857('0x21'),_0x3103d8['uniqueid'],_0x36eb68['id'],_0x4ab746['id']);}else{logger[_0x2857('0x7')](_0x2857('0x22'),_0x3103d8[_0x2857('0x23')],_0x36eb68['id'],_[_0x2857('0x12')](_0x5f3598,'id')[_0x2857('0x24')](','));}return;}else{logger['info'](_0x2857('0x25'),_0x3103d8['uniqueid'],_0x36eb68['id']);var _0x55ef4f={'ListId':_0x50b59c};var _0x45245a=_0x67ef7c[_0x2857('0x26')]&&_0x67ef7c['data4']!=='0'?_0x67ef7c[_0x2857('0x26')]:_0x2857('0x27');if(_0x4b5d59){logger['info']('[CM][%s][%s]\x20Autocreate\x20enabled',_0x3103d8[_0x2857('0x23')],_0x36eb68['id']);_0x55ef4f[_0x45245a]=_[_0x2857('0xd')](_0x3103d8[_0x2857('0x13')])?_0x3103d8[_0x2857('0x15')]:_0x3103d8[_0x2857('0x14')];if(_['isNil'](_0x3103d8[_0x2857('0x13')])){_0x55ef4f['firstName']=_0x3103d8[_0x2857('0x28')]&&_0x3103d8[_0x2857('0x28')]!==_0x2857('0x29')?_0x3103d8[_0x2857('0x28')]:_0x2857('0x2a');}else{_0x55ef4f[_0x2857('0x16')]=_0x3103d8[_0x2857('0x2b')]&&_0x3103d8['destcalleridname']!==''?_0x3103d8['destcalleridname']:_0x2857('0x2a');}return BPromise[_0x2857('0x1d')]()['then'](cmContactRpc[_0x2857('0x2c')](_0x55ef4f))['then'](function(_0x45932c){_0x4ab746=_0x45932c;_0x5f3598[_0x2857('0x2d')](_0x45932c);if(_0x4ab746){logger[_0x2857('0x7')](_0x2857('0x2e'),_0x3103d8[_0x2857('0x23')],_0x36eb68['id'],_0x4ab746['id']);}return;});}else{logger[_0x2857('0x7')](_0x2857('0x2f'),_0x3103d8[_0x2857('0x23')],_0x36eb68['id']);_0x55ef4f[_0x45245a]=_[_0x2857('0xd')](_0x3103d8[_0x2857('0x13')])?_0x3103d8['calleridnum']:_0x3103d8[_0x2857('0x14')];if(_[_0x2857('0xd')](_0x3103d8[_0x2857('0x13')])){_0x55ef4f['firstName']=_0x3103d8[_0x2857('0x28')]&&_0x3103d8[_0x2857('0x28')]!==_0x2857('0x29')?_0x3103d8[_0x2857('0x28')]:'Unknown';}else{_0x55ef4f[_0x2857('0x16')]=_0x3103d8[_0x2857('0x2b')]&&_0x3103d8['destcalleridname']!==_0x2857('0x29')?_0x3103d8[_0x2857('0x2b')]:'Unknown';}_0x4ab746=_0x55ef4f;_0x5f3598[_0x2857('0x2d')](_0x55ef4f);return;}}})[_0x2857('0x1e')](function(){if(_0xe889e9){emit(_0x3103d8[_0x2857('0x23')],_0x36eb68,util['format'](_0x2857('0x30'),_0xe889e9[_0x2857('0x31')]),util['format'](_0x2857('0x32'),_0x67ef7c[_0x2857('0x33')][_0x2857('0x34')]()),{'evt':_[_0x2857('0x35')](_0x3103d8,{'autoCreate':_0x4b5d59}),'contact':_0x4ab746===undefined?{}:_0x4ab746,'contacts':_0x5f3598[_0x2857('0x36')]===0x0?undefined:_0x5f3598});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 3419122..8229c8c 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 _0x1d84=['vtigerAccounts','servicenowAccounts','freshsalesAccounts','accounts','dynamics365Accounts','syncCustomEvent','bind','custom:agentconnect','custom:agentringnoanswer','custom:agentcomplete','custom:agentnosuchnumber','custom:agentcongestion','custom:agentreject','custom:amd','custom:queuecallerabandon','custom:timeout','custom:dialbegin','syncAgentDial','custom:dialend','custom:newinteraction','custom:substatus','custom:acceptmessage','custom:offlineMessage','prototype','emit','info','stringify','clone','motionChannel','undefined','voice','inspect','interface','checkTriggers','status','checkTrigger','merge','Actions','action','motionbar','browser','data1','data2','html','templates','render','template\x20not\x20found','uri','buildUri','isNil','data3','data4','location','uriLocation','windowWidth','data5','800','windowHeight','data6','600','winApplication','name','format','trigger:%s:%s','toLowerCase','jscripty','user:%s','trigger:%s','contactmanager','exec','integration','queue','routeId','urlforward','script','parse','query','search','replace','channel','length','every','checkConditions','some','debug','checkTrigger:\x20trigger','evt','field','account','chat','ChatWebsiteId','value','AccountId','operator','upperFirst','interaction','message','event','agent','membername','lastevent','mailSubstatus','null','substatus','offlineMessage','equals','exports','lodash','url','mustache','./urlforward','./integration','./script','../../../config/environment','../../../config/logger','trigger','../ami','redis','defaults','localhost','socket.io-emitter','popup','triggers','agents','voiceQueues','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts'];(function(_0x22093a,_0xa7acf1){var _0x2f4989=function(_0x5bf12b){while(--_0x5bf12b){_0x22093a['push'](_0x22093a['shift']());}};_0x2f4989(++_0xa7acf1);}(_0x1d84,0x173));var _0x41d8=function(_0x263a74,_0xc31414){_0x263a74=_0x263a74-0x0;var _0x2aa86c=_0x1d84[_0x263a74];return _0x2aa86c;};'use strict';var util=require('util');var _=require(_0x41d8('0x0'));var url=require(_0x41d8('0x1'));var Mustache=require(_0x41d8('0x2'));var Redis=require('ioredis');var urlforward=require(_0x41d8('0x3'));var integration=require(_0x41d8('0x4'));var cmContact=require('./cmContact');var script=require(_0x41d8('0x5'));var config=require(_0x41d8('0x6'));var logger=require(_0x41d8('0x7'))(_0x41d8('0x8'));var ami=require(_0x41d8('0x9'));config[_0x41d8('0xa')]=_[_0x41d8('0xb')](config[_0x41d8('0xa')],{'host':_0x41d8('0xc'),'port':0x18eb});var io=require(_0x41d8('0xd'))(new Redis(config[_0x41d8('0xa')]));var operators={'equals':function(_0x57b3ca,_0x4d8235){return _0x57b3ca==_0x4d8235;},'not_equals':function(_0x1ae9ad,_0x121cb5){return _0x1ae9ad!=_0x121cb5;}};var barAndWebActions=[_0x41d8('0xe'),_0x41d8('0x1'),'winapp'];function Trigger(_0x265595){this[_0x41d8('0xf')]=_0x265595[_0x41d8('0xf')];this['agents']=_0x265595[_0x41d8('0x10')];this[_0x41d8('0x11')]=_0x265595[_0x41d8('0x11')];this['templates']=_0x265595['templates'];this['voiceExtensions']=_0x265595[_0x41d8('0x12')];this[_0x41d8('0x13')]=_0x265595[_0x41d8('0x13')];this[_0x41d8('0x14')]=_0x265595[_0x41d8('0x14')];this[_0x41d8('0x15')]=_0x265595['salesforceAccounts'];this[_0x41d8('0x16')]=_0x265595[_0x41d8('0x16')];this[_0x41d8('0x17')]=_0x265595['zohoAccounts'];this[_0x41d8('0x18')]=_0x265595[_0x41d8('0x18')];this[_0x41d8('0x19')]=_0x265595[_0x41d8('0x19')];this[_0x41d8('0x1a')]=_0x265595['servicenowAccounts'];this['dynamics365Accounts']=_0x265595['dynamics365Accounts'];this[_0x41d8('0x1b')]=_0x265595[_0x41d8('0x1b')];this[_0x41d8('0x1c')]={'zendesk':this['zendeskAccounts'],'salesforce':this[_0x41d8('0x15')],'freshdesk':this[_0x41d8('0x14')],'sugarcrm':this[_0x41d8('0x16')],'zoho':this[_0x41d8('0x17')],'desk':this[_0x41d8('0x18')],'vtiger':this[_0x41d8('0x19')],'dynamics365':this[_0x41d8('0x1d')],'freshsales':this[_0x41d8('0x1b')],'servicenow':this['servicenowAccounts']};ami['on']('custom:agentcalled',this[_0x41d8('0x1e')][_0x41d8('0x1f')](this));ami['on'](_0x41d8('0x20'),this[_0x41d8('0x1e')][_0x41d8('0x1f')](this));ami['on'](_0x41d8('0x21'),this[_0x41d8('0x1e')][_0x41d8('0x1f')](this));ami['on'](_0x41d8('0x22'),this[_0x41d8('0x1e')][_0x41d8('0x1f')](this));ami['on'](_0x41d8('0x23'),this[_0x41d8('0x1e')][_0x41d8('0x1f')](this));ami['on']('custom:agentnoanswer',this['syncCustomEvent'][_0x41d8('0x1f')](this));ami['on']('custom:agentbusy',this[_0x41d8('0x1e')]['bind'](this));ami['on'](_0x41d8('0x24'),this[_0x41d8('0x1e')][_0x41d8('0x1f')](this));ami['on'](_0x41d8('0x25'),this[_0x41d8('0x1e')][_0x41d8('0x1f')](this));ami['on'](_0x41d8('0x26'),this[_0x41d8('0x1e')][_0x41d8('0x1f')](this));ami['on'](_0x41d8('0x27'),this[_0x41d8('0x1e')]['bind'](this));ami['on'](_0x41d8('0x28'),this[_0x41d8('0x1e')][_0x41d8('0x1f')](this));ami['on'](_0x41d8('0x29'),this[_0x41d8('0x2a')][_0x41d8('0x1f')](this));ami['on']('custom:dialconnect',this[_0x41d8('0x2a')][_0x41d8('0x1f')](this));ami['on'](_0x41d8('0x2b'),this['syncAgentDial'][_0x41d8('0x1f')](this));ami['on'](_0x41d8('0x2c'),this['syncCustomEvent'][_0x41d8('0x1f')](this));ami['on']('custom:closedinteraction',this['syncCustomEvent'][_0x41d8('0x1f')](this));ami['on'](_0x41d8('0x2d'),this[_0x41d8('0x1e')][_0x41d8('0x1f')](this));ami['on']('custom:incomingmessage',this[_0x41d8('0x1e')][_0x41d8('0x1f')](this));ami['on']('custom:outgoingmessage',this[_0x41d8('0x1e')]['bind'](this));ami['on'](_0x41d8('0x2e'),this[_0x41d8('0x1e')][_0x41d8('0x1f')](this));ami['on']('custom:rejectmessage',this[_0x41d8('0x1e')][_0x41d8('0x1f')](this));ami['on'](_0x41d8('0x2f'),this['syncCustomEvent']['bind'](this));}Trigger[_0x41d8('0x30')][_0x41d8('0x31')]=function(_0x1fddad,_0x2ec99a,_0x13bd33){logger[_0x41d8('0x32')](_0x1fddad,_0x2ec99a,JSON[_0x41d8('0x33')](_0x13bd33));io['to'](_0x1fddad)['emit'](_0x2ec99a,_0x13bd33);};Trigger[_0x41d8('0x30')]['syncCustomEvent']=function(_0x39aab9){var _0x4326c7=_[_0x41d8('0x34')](_0x39aab9);if(typeof _0x4326c7[_0x41d8('0x35')]===_0x41d8('0x36')){_0x4326c7[_0x41d8('0x35')]=_0x41d8('0x37');}logger['debug']('syncCustomEvent',util[_0x41d8('0x38')](_0x4326c7,{'showHidden':!![],'depth':null}));this['checkTriggers'](_0x4326c7);};Trigger[_0x41d8('0x30')][_0x41d8('0x2a')]=function(_0x416e87){if(this[_0x41d8('0x10')][_0x416e87[_0x41d8('0x39')]]){this[_0x41d8('0x1e')](_0x416e87);}};Trigger[_0x41d8('0x30')][_0x41d8('0x3a')]=function(_0x359d27){var _0x192056;for(var _0x211cc6 in this['triggers']){if(this[_0x41d8('0xf')]['hasOwnProperty'](_0x211cc6)){if(this[_0x41d8('0xf')][_0x211cc6][_0x41d8('0x3b')]){_0x192056=this[_0x41d8('0x3c')](this[_0x41d8('0xf')][_0x211cc6],_0x359d27);if(_0x192056){_[_0x41d8('0x3d')](_0x359d27,_0x359d27['variables']);for(var _0x182506=0x0,_0x4e83dc,_0x239c4a,_0x1b8d76;_0x1825060x0){_0x11c1eb=_[_0x7995('0x2b')](_0xf16cc2,_0x132a42);}return _0x11c1eb;}function getCustomFields(_0x514445,_0x456a28){var _0x3250e0=[];var _0x4253e5={'custom_fields':{}};if(_0x514445['length']>0x0){_['forEach'](_0x514445,function(_0x48e573){if(_[_0x7995('0x2c')]([_0x7995('0x2d'),_0x7995('0x2e')],_0x48e573[_0x7995('0x2f')])&&_0x48e573[_0x7995('0x30')]&&!_0x48e573[_0x7995('0x31')]){_0x4253e5[_0x48e573['nameField']['toLowerCase']()]=_0x48e573[_0x7995('0x32')]['toString']();}else if(_[_0x7995('0x2c')]([_0x7995('0x2d'),_0x7995('0x2e')],_0x48e573[_0x7995('0x2f')])&&_0x48e573[_0x7995('0x33')]&&_0x48e573['customField']){_0x4253e5[_0x7995('0x34')][_0x48e573[_0x7995('0x33')]]=_0x48e573['content']['toString']();}else if(_0x48e573['type']===_0x7995('0x35')&&_0x48e573[_0x7995('0x36')]&&_0x48e573['idField']&&_0x48e573[_0x7995('0x31')]){_0x456a28[_0x48e573['variableName']]&&(_0x4253e5[_0x7995('0x34')][_0x48e573[_0x7995('0x33')]]=_0x456a28[_0x48e573[_0x7995('0x36')]]['toString']());}else if(_0x48e573['type']===_0x7995('0x37')&&_0x48e573['Variable']&&_0x48e573['Variable'][_0x7995('0x38')]&&_0x48e573[_0x7995('0x33')]&&_0x48e573['customField']){_0x456a28[_0x48e573[_0x7995('0x39')][_0x7995('0x38')][_0x7995('0x3a')]()]&&(_0x4253e5[_0x7995('0x34')][_0x48e573[_0x7995('0x33')]]=_0x456a28[_0x48e573['Variable'][_0x7995('0x38')][_0x7995('0x3a')]()][_0x7995('0x22')]());}});}if(_0x4253e5[_0x7995('0x3b')]){_0x4253e5['priority']=Number(_0x4253e5[_0x7995('0x3b')]);}return _0x4253e5;}function getTicket(_0x235df7,_0x3eb04f,_0xe5ea43,_0x1f5bee,_0x1035dc){logger['info'](_0x7995('0x3c'));var _0x3be298=_[_0x7995('0x3d')]({'subject':intUtil[_0x7995('0x3e')](_0x1f5bee[_0x7995('0x3f')],_0x1035dc,'\x20'),'type':_0x7995('0x40'),'status':_0x7995('0x41'),'labels':[_0x7995('0x42'),_0x7995('0x43'),_0x7995('0x44')][_0x7995('0x45')](getTags(_0x1f5bee[_0x7995('0x46')],_0x7995('0x38'))),'description':intUtil['getString'](_0x1f5bee['Descriptions'],_0x1035dc,'\x0a'),'_links':{'assigned_user':{'href':util[_0x7995('0x11')](_0x7995('0x47'),_0x3eb04f['id']),'class':'user'}},'message':{'direction':'in','body':intUtil['getString'](_0x1f5bee[_0x7995('0x48')],_0x1035dc,'\x0a')}},getCustomFields(_0x1f5bee['Fields'],_0x1035dc));return request({'uri':util['format'](_0x7995('0x49'),_0x235df7[_0x7995('0x12')],_0xe5ea43['id']),'method':_0x7995('0x29'),'body':_0x3be298});}exports['queue']=function(_0x46ac4f,_0x5e85b9,_0x3993b5,_0x5a8881,_0x493066,_0x39c5b8){var _0x403f54,_0xc04e5;_0x39c5b8[_0x7995('0x12')]=intUtil['stripTrailingSlash'](_0x39c5b8[_0x7995('0x12')]);_0x39c5b8[_0x7995('0x4a')]=intUtil[_0x7995('0x4b')](_0x39c5b8[_0x7995('0x4a')]);if(_0x493066&&_0x493066['monitor_format']){logger['info'](_0x7995('0x4c'),'Recording\x20is\x20enabled!');_0x5e85b9[_0x7995('0x4d')]=util['format'](_0x7995('0x4e'),_0x39c5b8['serverUrl'],_0x5e85b9[_0x7995('0x4f')],md5(_0x5e85b9[_0x7995('0x4f')]));}else{_0x5e85b9['recordingURL']='';}headers[_0x7995('0x50')]=getAuth(_0x39c5b8);return getUser(_0x39c5b8,_0x5a8881[_0x7995('0x51')])[_0x7995('0x13')](function(_0xb70a51){_0x403f54=_0xb70a51;logger['info'](_0x7995('0x52'),_0x403f54['id']);return getEndUser(_0x39c5b8,_0x5e85b9[_0x7995('0x53')],_0x5e85b9[_0x7995('0x54')]);})['then'](function(_0xe228a5){_0xc04e5=_0xe228a5;logger[_0x7995('0xf')](_0x7995('0x55'),_0xc04e5['id']);return getTicket(_0x39c5b8,_0x403f54,_0xc04e5,_0x3993b5,_0x5e85b9);})[_0x7995('0x13')](function(_0x255313){if(_0x255313){logger['info'](_0x7995('0x56'));logger[_0x7995('0xf')]('The\x20Ticket\x20ID\x20is:',_0x255313['id']);switch(_0x39c5b8[_0x7995('0x2f')]){case'integrationTab':logger[_0x7995('0xf')](_0x7995('0x4c'),_0x7995('0x57'));emit(util[_0x7995('0x11')](_0x7995('0x58'),_0x5a8881[_0x7995('0x38')]),_0x7995('0x59'),{'recordId':_0x255313['id']});break;case'newTab':logger[_0x7995('0xf')](_0x7995('0x4c'),_0x7995('0x5a'));emit(util['format'](_0x7995('0x58'),_0x5a8881[_0x7995('0x38')]),_0x7995('0x5b'),{'uri':util['format']('https://xcally.desk.com/web/agent/case/%d',_0x255313['id'])});break;default:logger['error'](_0x7995('0x4c'),_0x7995('0x5c'));}}})['catch'](function(_0x1cd85){console[_0x7995('0x5d')](_0x1cd85);logger[_0x7995('0x5d')](_0x7995('0x4c'),JSON[_0x7995('0x1c')](_0x1cd85));});};exports['outbound']=function(_0x29ee32,_0x4ab09f,_0x14fe7f,_0x33c801,_0x206d2a,_0x50c7b5,_0x5e1f34){var _0x54e2b1,_0x563f8e;_0x50c7b5[_0x7995('0x12')]=intUtil[_0x7995('0x4b')](_0x50c7b5[_0x7995('0x12')]);_0x50c7b5[_0x7995('0x4a')]=intUtil[_0x7995('0x4b')](_0x50c7b5[_0x7995('0x4a')]);if(_0x5e1f34&&_0x5e1f34[_0x7995('0x5e')]&&_0x5e1f34[_0x7995('0x5e')]!==_0x7995('0x5f')){logger[_0x7995('0xf')](_0x7995('0x60'),_0x7995('0x61'));_0x4ab09f[_0x7995('0x4d')]=util[_0x7995('0x11')](_0x7995('0x4e'),_0x50c7b5[_0x7995('0x4a')],_0x4ab09f[_0x7995('0x4f')],md5(_0x4ab09f[_0x7995('0x4f')]));}headers[_0x7995('0x50')]=getAuth(_0x50c7b5);return getUser(_0x50c7b5,_0x33c801['email'])[_0x7995('0x13')](function(_0x630737){_0x54e2b1=_0x630737;logger[_0x7995('0xf')](_0x7995('0x52'),_0x54e2b1['id']);return getEndUser(_0x50c7b5,_0x4ab09f['destcalleridname'],_0x4ab09f['destcalleridnum']);})[_0x7995('0x13')](function(_0x197b52){_0x563f8e=_0x197b52;logger[_0x7995('0xf')](_0x7995('0x55'),_0x563f8e['id']);return getTicket(_0x50c7b5,_0x54e2b1,_0x563f8e,_0x14fe7f,_0x4ab09f);})['then'](function(_0x13cd7b){if(_0x13cd7b){logger[_0x7995('0xf')](_0x7995('0x56'));logger[_0x7995('0xf')]('The\x20Ticket\x20ID\x20is:',_0x13cd7b['id']);switch(_0x50c7b5['type']){case _0x7995('0x62'):logger[_0x7995('0xf')](_0x7995('0x4c'),_0x7995('0x57'));emit(util[_0x7995('0x11')](_0x7995('0x58'),_0x33c801[_0x7995('0x38')]),_0x7995('0x59'),{'recordId':_0x13cd7b['id']});break;case _0x7995('0x63'):logger['info'](_0x7995('0x4c'),_0x7995('0x5a'));emit(util[_0x7995('0x11')](_0x7995('0x58'),_0x33c801['name']),'trigger:browser:url',{'uri':util[_0x7995('0x11')](_0x7995('0x64'),_0x50c7b5['remoteUri'],_0x13cd7b['id'])});break;default:logger[_0x7995('0x5d')](_0x7995('0x60'),_0x7995('0x5c'));}}})[_0x7995('0x65')](function(_0x32cb04){logger['error'](_0x7995('0x60'),JSON['stringify'](_0x32cb04));});};exports[_0x7995('0x66')]=function(_0xe31dcb,_0x1722e2,_0x25b534,_0x4388c1,_0xeb8920,_0x2b3c1d){var _0x44372a,_0x10f012;_0x2b3c1d[_0x7995('0x12')]=intUtil[_0x7995('0x4b')](_0x2b3c1d[_0x7995('0x12')]);_0x2b3c1d['serverUrl']=intUtil[_0x7995('0x4b')](_0x2b3c1d[_0x7995('0x4a')]);if(_0xeb8920&&_0xeb8920[_0x7995('0x67')]){logger[_0x7995('0xf')]('['+_0x1722e2[_0x7995('0x68')]['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x1722e2[_0x7995('0x4d')]=util[_0x7995('0x11')](_0x7995('0x4e'),_0x2b3c1d[_0x7995('0x4a')],_0x1722e2['uniqueid'],md5(_0x1722e2[_0x7995('0x4f')]));}else{_0x1722e2['recordingURL']='';}headers['Authorization']=getAuth(_0x2b3c1d);return getUser(_0x2b3c1d)[_0x7995('0x13')](function(_0x36d27d){_0x44372a=_0x36d27d;logger[_0x7995('0xf')](_0x7995('0x52'),_0x44372a['id']);return getEndUser(_0x2b3c1d,_0x1722e2[_0x7995('0x53')],_0x1722e2[_0x7995('0x54')]);})[_0x7995('0x13')](function(_0x13dc73){_0x10f012=_0x13dc73;logger[_0x7995('0xf')](_0x7995('0x55'),_0x10f012['id']);return getTicket(_0x2b3c1d,_0x44372a,_0x10f012,_0x25b534,_0x1722e2);})['then'](function(_0x2dc1f7){if(_0x2dc1f7){logger[_0x7995('0xf')](_0x7995('0x56'));logger['info'](_0x7995('0x69'),_0x2dc1f7['id']);}})[_0x7995('0x65')](function(_0x705f0){logger[_0x7995('0x5d')]('['+_0x1722e2[_0x7995('0x68')][_0x7995('0x6a')]()+']',JSON[_0x7995('0x1c')](_0x705f0));});}; \ No newline at end of file +var _0x7217=['format','%s/users','remoteUri','then','total_entries','find','entries','info','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me','debug','stringify','GET','authType','basic','%s:%s','username','password','token','Basic\x20%s','base64','Searching\x20enduser\x20with\x20phone','%s/customers/search','Enduser\x20found!','_embedded','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','length','map','forEach','string','picklist','nameField','customField','content','toString','includes','idField','custom_fields','variable','variableName','type','customVariable','Variable','name','toLowerCase','priority','Creating\x20new\x20ticket...','merge','getString','new','xCALLY','Motion','CTI','Tags','Descriptions','user','%s/customers/%d/cases','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','Authorization','email','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','integrationTab','Displaying\x20ticket\x20to\x20agent...','user:%s','trigger:desk:display','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','https://xcally.desk.com/web/agent/case/%d','error','catch','outbound','recordingFormat','none','[OUTBOUND]','uniqueid','The\x20Ticket\x20ID\x20is:','%s/agent/tickets/%s','unmanaged','lastevent','toUpperCase','calleridname','lodash','md5','util','ioredis','./util','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','emit','application/json','validateEmail','Getting\x20agent\x20with\x20email'];(function(_0x564637,_0x4aa8f3){var _0x4c7f15=function(_0x3d35c8){while(--_0x3d35c8){_0x564637['push'](_0x564637['shift']());}};_0x4c7f15(++_0x4aa8f3);}(_0x7217,0x19e));var _0x7721=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0x7217[_0x37c22c];return _0x119d79;};'use strict';var _=require(_0x7721('0x0'));var rp=require('request-promise');var md5=require(_0x7721('0x1'));var util=require(_0x7721('0x2'));var Redis=require(_0x7721('0x3'));var intUtil=require(_0x7721('0x4'));var config=require(_0x7721('0x5'));var logger=require('../../../../config/logger')('desk');config[_0x7721('0x6')]=_[_0x7721('0x7')](config[_0x7721('0x6')],{'host':_0x7721('0x8'),'port':0x18eb});var io=require(_0x7721('0x9'))(new Redis(config[_0x7721('0x6')]));function emit(_0x18ab6b,_0x21f680,_0x225610){io['to'](_0x18ab6b)[_0x7721('0xa')](_0x21f680,_0x225610);}var headers={'Content-Type':_0x7721('0xb'),'Accept':_0x7721('0xb')};function getUser(_0xfa8835,_0x138740){if(intUtil[_0x7721('0xc')](_0x138740)===!![]){logger['info'](_0x7721('0xd'),_0x138740);return request({'uri':util[_0x7721('0xe')](_0x7721('0xf'),_0xfa8835[_0x7721('0x10')])})[_0x7721('0x11')](function(_0x409b37){if(_0x409b37[_0x7721('0x12')]){return _[_0x7721('0x13')](_0x409b37['_embedded'][_0x7721('0x14')],{'email':_0x138740});}})[_0x7721('0x11')](function(_0x57ff6d){if(_0x57ff6d){logger[_0x7721('0x15')](_0x7721('0x16'));return _0x57ff6d;}else{logger[_0x7721('0x15')](_0x7721('0x17'));return request({'uri':util['format'](_0x7721('0x18'),_0xfa8835[_0x7721('0x10')])});}});}else{logger['info']('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util['format'](_0x7721('0x18'),_0xfa8835[_0x7721('0x10')])});}}function request(_0x3cc909){logger[_0x7721('0x19')]('[HTTP]',JSON[_0x7721('0x1a')](_0x3cc909));return rp(_['defaults'](_0x3cc909,{'method':_0x7721('0x1b'),'headers':headers,'json':!![]}));}function getAuth(_0x5cb0e6){var _0xfec626;if(_0x5cb0e6[_0x7721('0x1c')]===_0x7721('0x1d')){_0xfec626=util[_0x7721('0xe')](_0x7721('0x1e'),_0x5cb0e6[_0x7721('0x1f')],_0x5cb0e6[_0x7721('0x20')]);}else if(_0x5cb0e6[_0x7721('0x1c')]===_0x7721('0x21')){_0xfec626=util[_0x7721('0xe')]('%s/token:%s',_0x5cb0e6[_0x7721('0x1f')],_0x5cb0e6[_0x7721('0x21')]);}return util[_0x7721('0xe')](_0x7721('0x22'),new Buffer(_0xfec626)['toString'](_0x7721('0x23')));}function getEndUser(_0x512f31,_0xb9e9dd,_0x288e3a){logger[_0x7721('0x15')](_0x7721('0x24'),_0x288e3a);return request({'uri':util[_0x7721('0xe')](_0x7721('0x25'),_0x512f31[_0x7721('0x10')]),'qs':{'phone':_0x288e3a}})['then'](function(_0x216f20){if(_0x216f20[_0x7721('0x12')]){logger[_0x7721('0x15')](_0x7721('0x26'));return _0x216f20[_0x7721('0x27')][_0x7721('0x14')][0x0];}else{logger[_0x7721('0x15')](_0x7721('0x28'));return request({'uri':util[_0x7721('0xe')]('%s/customers',_0x512f31[_0x7721('0x10')]),'method':'POST','body':{'first_name':_0xb9e9dd,'title':_0xb9e9dd,'phone_numbers':[{'type':'work','value':_0x288e3a}]}});}});}function getTags(_0x315202,_0x343c19){var _0x53c904=[];if(_0x315202&&_0x315202[_0x7721('0x29')]>0x0){_0x53c904=_[_0x7721('0x2a')](_0x315202,_0x343c19);}return _0x53c904;}function getCustomFields(_0x37b9f0,_0xd7d703){var _0x1da2d8=[];var _0x5c54f0={'custom_fields':{}};if(_0x37b9f0[_0x7721('0x29')]>0x0){_[_0x7721('0x2b')](_0x37b9f0,function(_0x497f9f){if(_['includes']([_0x7721('0x2c'),_0x7721('0x2d')],_0x497f9f['type'])&&_0x497f9f[_0x7721('0x2e')]&&!_0x497f9f[_0x7721('0x2f')]){_0x5c54f0[_0x497f9f[_0x7721('0x2e')]['toLowerCase']()]=_0x497f9f[_0x7721('0x30')][_0x7721('0x31')]();}else if(_[_0x7721('0x32')]([_0x7721('0x2c'),_0x7721('0x2d')],_0x497f9f['type'])&&_0x497f9f[_0x7721('0x33')]&&_0x497f9f[_0x7721('0x2f')]){_0x5c54f0[_0x7721('0x34')][_0x497f9f['idField']]=_0x497f9f[_0x7721('0x30')][_0x7721('0x31')]();}else if(_0x497f9f['type']===_0x7721('0x35')&&_0x497f9f['variableName']&&_0x497f9f[_0x7721('0x33')]&&_0x497f9f[_0x7721('0x2f')]){_0xd7d703[_0x497f9f[_0x7721('0x36')]]&&(_0x5c54f0[_0x7721('0x34')][_0x497f9f[_0x7721('0x33')]]=_0xd7d703[_0x497f9f[_0x7721('0x36')]][_0x7721('0x31')]());}else if(_0x497f9f[_0x7721('0x37')]===_0x7721('0x38')&&_0x497f9f[_0x7721('0x39')]&&_0x497f9f[_0x7721('0x39')]['name']&&_0x497f9f[_0x7721('0x33')]&&_0x497f9f['customField']){_0xd7d703[_0x497f9f[_0x7721('0x39')][_0x7721('0x3a')][_0x7721('0x3b')]()]&&(_0x5c54f0[_0x7721('0x34')][_0x497f9f[_0x7721('0x33')]]=_0xd7d703[_0x497f9f[_0x7721('0x39')]['name']['toLowerCase']()]['toString']());}});}if(_0x5c54f0['priority']){_0x5c54f0[_0x7721('0x3c')]=Number(_0x5c54f0[_0x7721('0x3c')]);}return _0x5c54f0;}function getTicket(_0x1acc72,_0x22ef35,_0x4a90ce,_0xa389fa,_0x4cf659){logger[_0x7721('0x15')](_0x7721('0x3d'));var _0x5a278e=_[_0x7721('0x3e')]({'subject':intUtil[_0x7721('0x3f')](_0xa389fa['Subjects'],_0x4cf659,'\x20'),'type':'phone','status':_0x7721('0x40'),'labels':[_0x7721('0x41'),_0x7721('0x42'),_0x7721('0x43')]['concat'](getTags(_0xa389fa[_0x7721('0x44')],_0x7721('0x3a'))),'description':intUtil[_0x7721('0x3f')](_0xa389fa[_0x7721('0x45')],_0x4cf659,'\x0a'),'_links':{'assigned_user':{'href':util[_0x7721('0xe')]('/api/v2/users/%d',_0x22ef35['id']),'class':_0x7721('0x46')}},'message':{'direction':'in','body':intUtil['getString'](_0xa389fa[_0x7721('0x45')],_0x4cf659,'\x0a')}},getCustomFields(_0xa389fa['Fields'],_0x4cf659));return request({'uri':util[_0x7721('0xe')](_0x7721('0x47'),_0x1acc72[_0x7721('0x10')],_0x4a90ce['id']),'method':'POST','body':_0x5a278e});}exports[_0x7721('0x48')]=function(_0x11d853,_0x1ad315,_0x481fa8,_0x9f7b1d,_0x754071,_0xdb3033){var _0x2d5f35,_0x135dbc;_0xdb3033[_0x7721('0x10')]=intUtil[_0x7721('0x49')](_0xdb3033['remoteUri']);_0xdb3033['serverUrl']=intUtil[_0x7721('0x49')](_0xdb3033[_0x7721('0x4a')]);if(_0x754071&&_0x754071[_0x7721('0x4b')]){logger[_0x7721('0x15')](_0x7721('0x4c'),_0x7721('0x4d'));_0x1ad315[_0x7721('0x4e')]=util[_0x7721('0xe')](_0x7721('0x4f'),_0xdb3033[_0x7721('0x4a')],_0x1ad315['uniqueid'],md5(_0x1ad315['uniqueid']));}else{_0x1ad315[_0x7721('0x4e')]='';}headers[_0x7721('0x50')]=getAuth(_0xdb3033);return getUser(_0xdb3033,_0x9f7b1d[_0x7721('0x51')])[_0x7721('0x11')](function(_0x589e95){_0x2d5f35=_0x589e95;logger[_0x7721('0x15')](_0x7721('0x52'),_0x2d5f35['id']);return getEndUser(_0xdb3033,_0x1ad315['calleridname'],_0x1ad315[_0x7721('0x53')]);})['then'](function(_0x2682b1){_0x135dbc=_0x2682b1;logger['info'](_0x7721('0x54'),_0x135dbc['id']);return getTicket(_0xdb3033,_0x2d5f35,_0x135dbc,_0x481fa8,_0x1ad315);})[_0x7721('0x11')](function(_0xf17c40){if(_0xf17c40){logger['info'](_0x7721('0x55'));logger[_0x7721('0x15')]('The\x20Ticket\x20ID\x20is:',_0xf17c40['id']);switch(_0xdb3033[_0x7721('0x37')]){case _0x7721('0x56'):logger[_0x7721('0x15')]('[QUEUE]',_0x7721('0x57'));emit(util['format'](_0x7721('0x58'),_0x9f7b1d[_0x7721('0x3a')]),_0x7721('0x59'),{'recordId':_0xf17c40['id']});break;case _0x7721('0x5a'):logger[_0x7721('0x15')](_0x7721('0x4c'),_0x7721('0x5b'));emit(util[_0x7721('0xe')](_0x7721('0x58'),_0x9f7b1d[_0x7721('0x3a')]),_0x7721('0x5c'),{'uri':util[_0x7721('0xe')](_0x7721('0x5d'),_0xf17c40['id'])});break;default:logger[_0x7721('0x5e')](_0x7721('0x4c'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0x7721('0x5f')](function(_0x2f6f30){console[_0x7721('0x5e')](_0x2f6f30);logger[_0x7721('0x5e')](_0x7721('0x4c'),JSON[_0x7721('0x1a')](_0x2f6f30));});};exports[_0x7721('0x60')]=function(_0x57484c,_0x234bee,_0x17036e,_0x134908,_0x3b7382,_0x1f1e84,_0x9c0d4){var _0x7fbd6c,_0x33287d;_0x1f1e84[_0x7721('0x10')]=intUtil[_0x7721('0x49')](_0x1f1e84[_0x7721('0x10')]);_0x1f1e84['serverUrl']=intUtil[_0x7721('0x49')](_0x1f1e84[_0x7721('0x4a')]);if(_0x9c0d4&&_0x9c0d4[_0x7721('0x61')]&&_0x9c0d4[_0x7721('0x61')]!==_0x7721('0x62')){logger[_0x7721('0x15')](_0x7721('0x63'),_0x7721('0x4d'));_0x234bee[_0x7721('0x4e')]=util[_0x7721('0xe')](_0x7721('0x4f'),_0x1f1e84[_0x7721('0x4a')],_0x234bee[_0x7721('0x64')],md5(_0x234bee[_0x7721('0x64')]));}headers[_0x7721('0x50')]=getAuth(_0x1f1e84);return getUser(_0x1f1e84,_0x134908['email'])['then'](function(_0x4e112e){_0x7fbd6c=_0x4e112e;logger[_0x7721('0x15')]('The\x20User\x20ID\x20is:',_0x7fbd6c['id']);return getEndUser(_0x1f1e84,_0x234bee['destcalleridname'],_0x234bee['destcalleridnum']);})['then'](function(_0x47925a){_0x33287d=_0x47925a;logger[_0x7721('0x15')](_0x7721('0x54'),_0x33287d['id']);return getTicket(_0x1f1e84,_0x7fbd6c,_0x33287d,_0x17036e,_0x234bee);})['then'](function(_0x5181d7){if(_0x5181d7){logger['info']('Ticket\x20created!');logger['info'](_0x7721('0x65'),_0x5181d7['id']);switch(_0x1f1e84['type']){case'integrationTab':logger['info'](_0x7721('0x4c'),_0x7721('0x57'));emit(util[_0x7721('0xe')]('user:%s',_0x134908[_0x7721('0x3a')]),_0x7721('0x59'),{'recordId':_0x5181d7['id']});break;case _0x7721('0x5a'):logger[_0x7721('0x15')](_0x7721('0x4c'),_0x7721('0x5b'));emit(util[_0x7721('0xe')](_0x7721('0x58'),_0x134908[_0x7721('0x3a')]),_0x7721('0x5c'),{'uri':util[_0x7721('0xe')](_0x7721('0x66'),_0x1f1e84[_0x7721('0x10')],_0x5181d7['id'])});break;default:logger[_0x7721('0x5e')](_0x7721('0x63'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0x7721('0x5f')](function(_0x2c93b0){logger[_0x7721('0x5e')](_0x7721('0x63'),JSON['stringify'](_0x2c93b0));});};exports[_0x7721('0x67')]=function(_0x104f05,_0x4c8284,_0x3e7df3,_0x5d37ad,_0x1f508d,_0x4bfb48){var _0x36a3a6,_0x3f9eaa;_0x4bfb48[_0x7721('0x10')]=intUtil[_0x7721('0x49')](_0x4bfb48[_0x7721('0x10')]);_0x4bfb48[_0x7721('0x4a')]=intUtil[_0x7721('0x49')](_0x4bfb48['serverUrl']);if(_0x1f508d&&_0x1f508d[_0x7721('0x4b')]){logger[_0x7721('0x15')]('['+_0x4c8284[_0x7721('0x68')][_0x7721('0x69')]()+']',_0x7721('0x4d'));_0x4c8284[_0x7721('0x4e')]=util[_0x7721('0xe')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4bfb48[_0x7721('0x4a')],_0x4c8284[_0x7721('0x64')],md5(_0x4c8284['uniqueid']));}else{_0x4c8284[_0x7721('0x4e')]='';}headers['Authorization']=getAuth(_0x4bfb48);return getUser(_0x4bfb48)[_0x7721('0x11')](function(_0x382800){_0x36a3a6=_0x382800;logger[_0x7721('0x15')](_0x7721('0x52'),_0x36a3a6['id']);return getEndUser(_0x4bfb48,_0x4c8284[_0x7721('0x6a')],_0x4c8284[_0x7721('0x53')]);})[_0x7721('0x11')](function(_0x5dca04){_0x3f9eaa=_0x5dca04;logger[_0x7721('0x15')](_0x7721('0x54'),_0x3f9eaa['id']);return getTicket(_0x4bfb48,_0x36a3a6,_0x3f9eaa,_0x3e7df3,_0x4c8284);})[_0x7721('0x11')](function(_0x5f08cc){if(_0x5f08cc){logger['info']('Ticket\x20created!');logger['info']('The\x20Ticket\x20ID\x20is:',_0x5f08cc['id']);}})[_0x7721('0x5f')](function(_0x2645dd){logger['error']('['+_0x4c8284[_0x7721('0x68')][_0x7721('0x69')]()+']',JSON[_0x7721('0x1a')](_0x2645dd));});}; \ 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 e8603dd..31baf26 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 _0x8da1=['validateEmail','userEmail','email','length','internalemailaddress','isdisabled','info',']\x20Agent\x20found\x20','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','destcalleridnum','calleridnum','contacts','/systemusers(','Bearer\x20','4.0','body','headers','odata-entityid','lastIndexOf','enduserId','toLowerCase','outbound','contacts?$select=','\x20eq\x20\x27','replace','%2b','contactid',']\x20Enduser\x20created!','string','picklist','nameField','customField','substring','indexOf','ticketType','incident','getString','/contacts(','Fields','phonecall','callDirection','queue','phonecalls','assign','Subjects','Descriptions','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','emit','trigger:browser:url','serverUrl','unmanaged','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','tenantId','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','[OUTBOUND]','recordingURL',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:','moduleCreate',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','openNewTab','name','error','Error\x20running\x20Dynamics365\x20integration','request-promise','util','md5','ioredis','dynamics365','../../../../config/environment','defaults','socket.io-emitter','redis','modernAuthentication','remoteUri','CloudProvider','data7','resolve','data5','POST','clientId','username','password','clientSecret','access_token','catch','toUpperCase','message','systemusers?$select=internalemailaddress,isdisabled,systemuserid','then','value'];(function(_0x57a874,_0x52ad5b){var _0x4edaec=function(_0x55f461){while(--_0x55f461){_0x57a874['push'](_0x57a874['shift']());}};_0x4edaec(++_0x52ad5b);}(_0x8da1,0x189));var _0x18da=function(_0x4df6ba,_0x477c3e){_0x4df6ba=_0x4df6ba-0x0;var _0x472acf=_0x8da1[_0x4df6ba];return _0x472acf;};'use strict';var _=require('lodash');var rp=require(_0x18da('0x0'));var util=require(_0x18da('0x1'));var intUtil=require('./util');var md5=require(_0x18da('0x2'));var Redis=require(_0x18da('0x3'));var logger=require('../../../../config/logger')(_0x18da('0x4'));var config=require(_0x18da('0x5'));config['redis']=_[_0x18da('0x6')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x18da('0x7'))(new Redis(config[_0x18da('0x8')]));function getAuthToken(_0x1ef1f6,_0x4d490c,_0x4ede43){if(_0x1ef1f6[_0x18da('0x9')]){_0x1ef1f6[_0x18da('0xa')]=_0x1ef1f6[_0x18da('0xb')][_0x18da('0xc')];_0x1ef1f6['tenantId']=_0x1ef1f6['CloudProvider']['data2'];return Promise[_0x18da('0xd')](_0x1ef1f6['CloudProvider'][_0x18da('0xe')]);}var _0x388e75={'method':_0x18da('0xf'),'uri':_0x4d490c,'form':{'client_id':_0x1ef1f6[_0x18da('0x10')],'resource':_0x1ef1f6[_0x18da('0xa')],'username':_0x1ef1f6[_0x18da('0x11')],'password':_0x1ef1f6[_0x18da('0x12')],'grant_type':_0x18da('0x12'),'client_secret':_0x1ef1f6[_0x18da('0x13')]},'json':!![]};return rp(_0x388e75)['then'](function(_0x307386){return _0x307386[_0x18da('0x14')];})[_0x18da('0x15')](function(_0x1085bf){logger['error']('['+[_0x4ede43[_0x18da('0x16')]()]+']\x20Wrong\x20credentials!');return _0x1085bf[_0x18da('0x17')];});}function getUser(_0x335c82,_0x358a75,_0x1e7a02,_0x72fc7e,_0x2443ef,_0x764715){return new Promise(function(_0x3c0427,_0x51bc73){return getAuthToken(_0x358a75,_0x72fc7e,_0x764715)['then'](function(_0x52ad13){var _0x801021={'method':'GET','uri':_0x2443ef+_0x18da('0x18'),'headers':{'Authorization':'Bearer\x20'+_0x52ad13,'OData-Version':'4.0'},'json':!![]};return rp(_0x801021);})[_0x18da('0x19')](function(_0x588b1f){var _0x1a764c=_0x588b1f[_0x18da('0x1a')];var _0x19ab78=![];var _0x46e6a6=null;if(!_['isNil'](_0x1e7a02)){if(intUtil[_0x18da('0x1b')](_0x1e7a02['email'])){_0x335c82[_0x18da('0x1c')]=_0x1e7a02[_0x18da('0x1d')];for(_0x46e6a6=0x0;_0x46e6a6<_0x1a764c[_0x18da('0x1e')];_0x46e6a6++){if(_0x1a764c[_0x46e6a6][_0x18da('0x1f')]===_0x1e7a02[_0x18da('0x1d')]&&!_0x1a764c[_0x46e6a6][_0x18da('0x20')]){_0x19ab78=!![];logger[_0x18da('0x21')]('['+[_0x764715[_0x18da('0x16')]()]+_0x18da('0x22')+_0x1a764c[_0x46e6a6][_0x18da('0x23')]+'!');_0x335c82[_0x18da('0x24')]=_0x1a764c[_0x46e6a6][_0x18da('0x23')];}}}}if(!_0x19ab78){logger[_0x18da('0x21')]('['+[_0x764715[_0x18da('0x16')]()]+_0x18da('0x25'));_0x335c82[_0x18da('0x1c')]=_0x358a75[_0x18da('0x11')];for(_0x46e6a6=0x0;_0x46e6a6<_0x1a764c['length'];_0x46e6a6++){if(_0x1a764c[_0x46e6a6]['internalemailaddress']===_0x358a75[_0x18da('0x11')]){_0x335c82[_0x18da('0x24')]=_0x1a764c[_0x46e6a6][_0x18da('0x23')];}}}_0x3c0427(_0x335c82);})['catch'](function(_0x342f1c){_0x51bc73(_0x342f1c['message']);});});}function createEndUser(_0x35ff2b,_0x152195,_0x572ff4,_0x154b73,_0x2ec40f,_0x4eec1f,_0x126bed){return new Promise(function(_0x17761f,_0x5e1add){return getAuthToken(_0x152195,_0x572ff4,_0x4eec1f)[_0x18da('0x19')](function(_0x5c7665){var _0x372625=_0x4eec1f['toLowerCase']()==='outbound'?_0x2ec40f[_0x18da('0x26')]:_0x2ec40f[_0x18da('0x27')];var _0x2cb9a1={'method':_0x18da('0xf'),'uri':_0x154b73+_0x18da('0x28'),'body':{'fullname':_0x372625,'firstname':_0x372625,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x18da('0x29')+_0x35ff2b[_0x18da('0x24')]+')'},'headers':{'Authorization':_0x18da('0x2a')+_0x5c7665,'OData-Version':_0x18da('0x2b')},'json':!![],'resolveWithFullResponse':!![]};_0x2cb9a1[_0x18da('0x2c')][_0x126bed]=_0x372625;return rp(_0x2cb9a1);})[_0x18da('0x19')](function(_0x4be942){var _0x2d66a2=_0x4be942[_0x18da('0x2d')][_0x18da('0x2e')];var _0x55a1f3=_0x2d66a2['substring'](_0x2d66a2[_0x18da('0x2f')]('(')+0x1,_0x2d66a2[_0x18da('0x2f')](')'));_0x35ff2b[_0x18da('0x30')]=_0x55a1f3;_0x17761f(_0x35ff2b);})[_0x18da('0x15')](function(_0x4424c8){_0x5e1add(_0x4424c8['message']);});});}function getEndUser(_0x558dcf,_0x5206dd,_0x1b417a,_0x4922ec,_0x21f2d3,_0x390afe,_0x2cb91d,_0x2808d6){var _0x338f7f=_0x390afe[_0x18da('0x31')]()===_0x18da('0x32')?_0x21f2d3[_0x18da('0x26')]:_0x21f2d3['calleridnum'];return getAuthToken(_0x5206dd,_0x1b417a,_0x390afe)['then'](function(_0xf087b0){_0x2808d6=_0x2808d6?_0x2808d6:'telephone1';var _0x462a5a={'method':'GET','uri':_0x4922ec+_0x18da('0x33')+_0x2808d6+'&$filter='+_0x2808d6+_0x18da('0x34')+_0x338f7f[_0x18da('0x35')]('+',_0x18da('0x36'))+'\x27','headers':{'Authorization':'Bearer\x20'+_0xf087b0,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x462a5a);})['then'](function(_0x286c14){var _0x3eb4fd=![];if(!_0x286c14)return _0x3eb4fd;var _0x1ef5bc=_0x286c14['value'];for(var _0x58526f=0x0;_0x58526f<_0x1ef5bc[_0x18da('0x1e')];_0x58526f++){if(_0x1ef5bc[_0x58526f][_0x2808d6]===_0x338f7f){_0x3eb4fd=!![];_0x558dcf['enduserId']=_0x1ef5bc[_0x58526f][_0x18da('0x37')];}}return _0x3eb4fd;})[_0x18da('0x19')](function(_0x28902a){if(_0x28902a)return _0x558dcf;if(_0x2cb91d==='nothing'){logger[_0x18da('0x21')]('['+[_0x390afe['toUpperCase']()]+']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing');return _0x558dcf;}return createEndUser(_0x558dcf,_0x5206dd,_0x1b417a,_0x4922ec,_0x21f2d3,_0x390afe,_0x2808d6)['then'](function(_0x50fb92){logger['info']('['+[_0x390afe[_0x18da('0x16')]()]+_0x18da('0x38'),_0x50fb92[_0x18da('0x30')]);return _0x50fb92;});});}function getCustomFields(_0xfda409,_0x55b10,_0x354640){var _0x5ba2d5={};if(_0xfda409['length']>0x0){_['forEach'](_0xfda409,function(_0xe202cb){if(_['includes']([_0x18da('0x39'),_0x18da('0x3a')],_0xe202cb['type'])&&_0xe202cb[_0x18da('0x3b')]&&!_0xe202cb[_0x18da('0x3c')]){var _0x58f7ae=_0xe202cb['idField'][_0x18da('0x31')]();var _0x55b54c=_0x58f7ae[_0x18da('0x3d')](0x0,_0x58f7ae[_0x18da('0x3e')]('_'));var _0x27cff7=_0x58f7ae[_0x18da('0x3d')](_0x58f7ae[_0x18da('0x3e')]('_')+0x1);if(_0x55b54c===_0x354640){_0x5ba2d5[_0x27cff7]=_0xe202cb['content'];}}});}return _0x5ba2d5;}function getTicket(_0x2c8841,_0x139035,_0x35b3db,_0x168790,_0x1645ef,_0x2e47c5,_0x359ef1){return new Promise(function(_0x3a5827,_0x597c72){var _0x1d0849;return getAuthToken(_0x139035,_0x35b3db,_0x359ef1)[_0x18da('0x19')](function(_0x1c80c2){if(_0x2e47c5[_0x18da('0x3f')]===_0x18da('0x40')){_0x1d0849={'method':_0x18da('0xf'),'uri':_0x168790+'incidents','body':Object['assign']({},{'title':intUtil[_0x18da('0x41')](_0x2e47c5['Subjects'],_0x1645ef,'\x20'),'description':intUtil[_0x18da('0x41')](_0x2e47c5['Descriptions'],_0x1645ef,'\x0a'),'customerid_contact@odata.bind':_0x2c8841['enduserId']?_0x18da('0x42')+_0x2c8841[_0x18da('0x30')]+')':undefined,'ownerid@odata.bind':'/systemusers('+_0x2c8841[_0x18da('0x24')]+')','caseorigincode':'1'},getCustomFields(_0x2e47c5[_0x18da('0x43')],_0x1645ef,_0x2e47c5[_0x18da('0x3f')])),'headers':{'Authorization':_0x18da('0x2a')+_0x1c80c2,'OData-Version':_0x18da('0x2b')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x2e47c5[_0x18da('0x3f')]===_0x18da('0x44')){var _0x4025e1=_0x2c8841[_0x18da('0x30')]?[{'partyid_systemuser@odata.bind':'/systemusers('+_0x2c8841[_0x18da('0x24')]+')','participationtypemask':_0x2c8841[_0x18da('0x45')]==='queue'?0x2:0x1},{'partyid_contact@odata.bind':_0x18da('0x42')+_0x2c8841[_0x18da('0x30')]+')','participationtypemask':_0x2c8841[_0x18da('0x45')]===_0x18da('0x46')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0x18da('0x29')+_0x2c8841[_0x18da('0x24')]+')','participationtypemask':_0x2c8841[_0x18da('0x45')]===_0x18da('0x46')?0x2:0x1}];_0x1d0849={'method':_0x18da('0xf'),'uri':_0x168790+_0x18da('0x47'),'body':Object[_0x18da('0x48')]({},{'subject':intUtil['getString'](_0x2e47c5[_0x18da('0x49')],_0x1645ef,'\x20'),'phonenumber':String(_0x1645ef[_0x18da('0x27')]),'description':intUtil['getString'](_0x2e47c5[_0x18da('0x4a')],_0x1645ef,'\x0a'),'regardingobjectid_contact@odata.bind':_0x2c8841[_0x18da('0x30')]?_0x18da('0x42')+_0x2c8841[_0x18da('0x30')]+')':undefined,'ownerid@odata.bind':'/systemusers('+_0x2c8841[_0x18da('0x24')]+')','directioncode':_0x2c8841['callDirection']===_0x18da('0x46')?![]:!![],'phonecall_activity_parties':_0x4025e1},getCustomFields(_0x2e47c5[_0x18da('0x43')],_0x1645ef,_0x2e47c5[_0x18da('0x3f')])),'headers':{'Authorization':_0x18da('0x2a')+_0x1c80c2,'OData-Version':_0x18da('0x2b')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x1d0849);})[_0x18da('0x19')](function(_0x4ec8b8){var _0x2f9e56=_0x4ec8b8[_0x18da('0x2d')]['odata-entityid'];var _0x4d2b7d=_0x2f9e56['substring'](_0x2f9e56['lastIndexOf']('(')+0x1,_0x2f9e56['lastIndexOf'](')'));_0x2c8841[_0x18da('0x4b')]=_0x4d2b7d;_0x3a5827(_0x2c8841);})['catch'](function(_0xada58e){_0x597c72(_0xada58e[_0x18da('0x17')]);});});}function emit(_0x265039,_0x499d41,_0x260923,_0x370a2f){var _0x50ce56={'uri':util[_0x18da('0x4c')](_0x18da('0x4d'),_0x265039,_0x260923,_0x370a2f)};io['to'](util[_0x18da('0x4c')]('user:%s',_0x499d41))[_0x18da('0x4e')](_0x18da('0x4f'),_0x50ce56);}exports['cs']=function(_0x34adea,_0x481ca0,_0x7dab33,_0x2042ca,_0x2ba224,_0x3e2c93,_0x243db0,_0x1f5c55){var _0x196544={};_0x3e2c93[_0x18da('0xa')]=_0x3e2c93[_0x18da('0x9')]?intUtil['stripTrailingSlash'](_0x3e2c93[_0x18da('0xb')][_0x18da('0xc')]):intUtil['stripTrailingSlash'](_0x3e2c93[_0x18da('0xa')]);_0x3e2c93[_0x18da('0x50')]=intUtil['stripTrailingSlash'](_0x3e2c93['serverUrl']);_0x196544[_0x18da('0x45')]=_0x1f5c55===_0x18da('0x46')||_0x1f5c55===_0x18da('0x51')?_0x18da('0x46'):_0x18da('0x32');var _0x44023b=_0x3e2c93[_0x18da('0x9')]?util[_0x18da('0x4c')]('%s/api/data/v9.0/',_0x3e2c93[_0x18da('0xb')][_0x18da('0xc')]):util[_0x18da('0x4c')](_0x18da('0x52'),_0x3e2c93[_0x18da('0xa')]);var _0x480699=util[_0x18da('0x4c')](_0x18da('0x53'),_0x3e2c93[_0x18da('0x54')]);var _0x30c438=util[_0x18da('0x4c')](_0x18da('0x55'),_0x3e2c93['serverUrl'],_0x481ca0[_0x18da('0x56')],md5(_0x481ca0[_0x18da('0x56')]));if(_0x2ba224&&_0x2ba224[_0x18da('0x57')]){logger[_0x18da('0x21')](_0x18da('0x58'),_0x18da('0x59'));_0x481ca0['recordingURL']=_0x30c438;}else if(_0x243db0&&_0x243db0[_0x18da('0x5a')]&&_0x243db0[_0x18da('0x5a')]!==_0x18da('0x5b')){logger[_0x18da('0x21')](_0x18da('0x5c'),_0x18da('0x59'));_0x481ca0[_0x18da('0x5d')]=_0x30c438;}else{_0x481ca0[_0x18da('0x5d')]='';}return getUser(_0x196544,_0x3e2c93,_0x2042ca,_0x480699,_0x44023b,_0x1f5c55)[_0x18da('0x19')](function(_0x37a519){logger[_0x18da('0x21')]('['+_0x1f5c55[_0x18da('0x16')]()+_0x18da('0x5e'),_0x37a519['userId']);logger['info']('['+_0x1f5c55[_0x18da('0x16')]()+_0x18da('0x5f'),_0x37a519[_0x18da('0x1c')]);return getEndUser(_0x37a519,_0x3e2c93,_0x480699,_0x44023b,_0x481ca0,_0x1f5c55,_0x7dab33[_0x18da('0x60')],_0x7dab33['additionalSearchContact']);})[_0x18da('0x19')](function(_0x5e27e5){logger[_0x18da('0x21')]('['+_0x1f5c55[_0x18da('0x16')]()+_0x18da('0x61'),_0x5e27e5['enduserId']);logger['info']('['+_0x1f5c55['toUpperCase']()+_0x18da('0x62'),_0x481ca0['calleridnum']);return getTicket(_0x5e27e5,_0x3e2c93,_0x480699,_0x44023b,_0x481ca0,_0x7dab33,_0x1f5c55);})['then'](function(_0x5d564c){logger[_0x18da('0x21')](util['format']('['+_0x1f5c55['toUpperCase']()+_0x18da('0x63'),_0x7dab33['ticketType'],_0x5d564c['ticketId']));logger[_0x18da('0x21')](util[_0x18da('0x4c')]('['+_0x1f5c55[_0x18da('0x16')]()+_0x18da('0x64'),_0x1f5c55));if(_0x1f5c55!=='unmanaged'&&_0x7dab33[_0x18da('0x65')]){logger['info']('['+_0x1f5c55[_0x18da('0x16')]()+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x3e2c93[_0x18da('0xa')],_0x2042ca[_0x18da('0x66')],_0x7dab33[_0x18da('0x3f')],_0x5d564c['ticketId']);}})[_0x18da('0x15')](function(_0x4a2a21){logger[_0x18da('0x67')]('['+_0x1f5c55[_0x18da('0x16')]()+']\x20Error\x20running\x20Dynamics365\x20integration',_0x4a2a21['message']);console[_0x18da('0x67')](_0x18da('0x68'),_0x4a2a21);});}; \ No newline at end of file +var _0x4d91=['POST','clientId','remoteUri','username','password','clientSecret','then','catch','error',']\x20Wrong\x20credentials!','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','isNil','userEmail','email','length','internalemailaddress','isdisabled',']\x20Agent\x20found\x20','systemuserid','info','toUpperCase',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','toLowerCase','destcalleridnum','calleridnum','/systemusers(','body','headers','odata-entityid','lastIndexOf','outbound','telephone1','contacts?$select=','\x20eq\x20\x27','replace','%2b','4.0','nothing',']\x20Enduser\x20created!','enduserId','forEach','string','type','nameField','idField','substring','indexOf','content','ticketType','incident','incidents','assign','getString','Subjects','Descriptions','/contacts(','callDirection','queue','phonecalls','Fields','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','format','user:%s','trigger:browser:url','modernAuthentication','data7','stripTrailingSlash','serverUrl','https://login.microsoftonline.com/%s/oauth2/token','uniqueid','monitor_format','[QUEUE]','recordingURL','recordingFormat','none','[OUTBOUND]',']\x20The\x20User\x20email\x20is:','moduleCreate','additionalSearchContact',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:','ticketId','unmanaged','openNewTab','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20Dynamics365\x20integration','Error\x20running\x20Dynamics365\x20integration','lodash','request-promise','util','./util','md5','ioredis','dynamics365','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','CloudProvider','tenantId','data2','resolve'];(function(_0x26bafe,_0x13e506){var _0x307879=function(_0x5a1548){while(--_0x5a1548){_0x26bafe['push'](_0x26bafe['shift']());}};_0x307879(++_0x13e506);}(_0x4d91,0xc6));var _0x14d9=function(_0x3c59fc,_0x10dbd2){_0x3c59fc=_0x3c59fc-0x0;var _0x2b78d4=_0x4d91[_0x3c59fc];return _0x2b78d4;};'use strict';var _=require(_0x14d9('0x0'));var rp=require(_0x14d9('0x1'));var util=require(_0x14d9('0x2'));var intUtil=require(_0x14d9('0x3'));var md5=require(_0x14d9('0x4'));var Redis=require(_0x14d9('0x5'));var logger=require('../../../../config/logger')(_0x14d9('0x6'));var config=require(_0x14d9('0x7'));config[_0x14d9('0x8')]=_[_0x14d9('0x9')](config['redis'],{'host':_0x14d9('0xa'),'port':0x18eb});var io=require(_0x14d9('0xb'))(new Redis(config['redis']));function getAuthToken(_0x5e8b0d,_0x3c4d96,_0x148451){if(_0x5e8b0d['modernAuthentication']){_0x5e8b0d['remoteUri']=_0x5e8b0d[_0x14d9('0xc')]['data7'];_0x5e8b0d[_0x14d9('0xd')]=_0x5e8b0d[_0x14d9('0xc')][_0x14d9('0xe')];return Promise[_0x14d9('0xf')](_0x5e8b0d[_0x14d9('0xc')]['data5']);}var _0x13e7b8={'method':_0x14d9('0x10'),'uri':_0x3c4d96,'form':{'client_id':_0x5e8b0d[_0x14d9('0x11')],'resource':_0x5e8b0d[_0x14d9('0x12')],'username':_0x5e8b0d[_0x14d9('0x13')],'password':_0x5e8b0d[_0x14d9('0x14')],'grant_type':_0x14d9('0x14'),'client_secret':_0x5e8b0d[_0x14d9('0x15')]},'json':!![]};return rp(_0x13e7b8)[_0x14d9('0x16')](function(_0x566d4d){return _0x566d4d['access_token'];})[_0x14d9('0x17')](function(_0x595da0){logger[_0x14d9('0x18')]('['+[_0x148451['toUpperCase']()]+_0x14d9('0x19'));return _0x595da0[_0x14d9('0x1a')];});}function getUser(_0x41d2e9,_0x5e893a,_0x35b80f,_0x354aa0,_0x38144f,_0x430171){return new Promise(function(_0x93ce36,_0x450ed6){return getAuthToken(_0x5e893a,_0x354aa0,_0x430171)['then'](function(_0x4bc248){var _0x29117b={'method':_0x14d9('0x1b'),'uri':_0x38144f+_0x14d9('0x1c'),'headers':{'Authorization':_0x14d9('0x1d')+_0x4bc248,'OData-Version':'4.0'},'json':!![]};return rp(_0x29117b);})[_0x14d9('0x16')](function(_0x274900){var _0x5bdaa6=_0x274900['value'];var _0x41ee3=![];var _0x5c5315=null;if(!_[_0x14d9('0x1e')](_0x35b80f)){if(intUtil['validateEmail'](_0x35b80f['email'])){_0x41d2e9[_0x14d9('0x1f')]=_0x35b80f[_0x14d9('0x20')];for(_0x5c5315=0x0;_0x5c5315<_0x5bdaa6[_0x14d9('0x21')];_0x5c5315++){if(_0x5bdaa6[_0x5c5315][_0x14d9('0x22')]===_0x35b80f['email']&&!_0x5bdaa6[_0x5c5315][_0x14d9('0x23')]){_0x41ee3=!![];logger['info']('['+[_0x430171['toUpperCase']()]+_0x14d9('0x24')+_0x5bdaa6[_0x5c5315][_0x14d9('0x25')]+'!');_0x41d2e9['userId']=_0x5bdaa6[_0x5c5315][_0x14d9('0x25')];}}}}if(!_0x41ee3){logger[_0x14d9('0x26')]('['+[_0x430171[_0x14d9('0x27')]()]+_0x14d9('0x28'));_0x41d2e9[_0x14d9('0x1f')]=_0x5e893a[_0x14d9('0x13')];for(_0x5c5315=0x0;_0x5c5315<_0x5bdaa6[_0x14d9('0x21')];_0x5c5315++){if(_0x5bdaa6[_0x5c5315][_0x14d9('0x22')]===_0x5e893a[_0x14d9('0x13')]){_0x41d2e9[_0x14d9('0x29')]=_0x5bdaa6[_0x5c5315][_0x14d9('0x25')];}}}_0x93ce36(_0x41d2e9);})['catch'](function(_0x255954){_0x450ed6(_0x255954[_0x14d9('0x1a')]);});});}function createEndUser(_0x759466,_0x3ef007,_0x544756,_0x34ddcf,_0x24a21f,_0x37f69e,_0x4ce039){return new Promise(function(_0x3bf32b,_0x4c4f8c){return getAuthToken(_0x3ef007,_0x544756,_0x37f69e)['then'](function(_0x26c11d){var _0x2563ff=_0x37f69e[_0x14d9('0x2a')]()==='outbound'?_0x24a21f[_0x14d9('0x2b')]:_0x24a21f[_0x14d9('0x2c')];var _0x580e4b={'method':_0x14d9('0x10'),'uri':_0x34ddcf+'contacts','body':{'fullname':_0x2563ff,'firstname':_0x2563ff,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x14d9('0x2d')+_0x759466['userId']+')'},'headers':{'Authorization':_0x14d9('0x1d')+_0x26c11d,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};_0x580e4b[_0x14d9('0x2e')][_0x4ce039]=_0x2563ff;return rp(_0x580e4b);})[_0x14d9('0x16')](function(_0x22cc62){var _0x57820b=_0x22cc62[_0x14d9('0x2f')][_0x14d9('0x30')];var _0x2c1240=_0x57820b['substring'](_0x57820b[_0x14d9('0x31')]('(')+0x1,_0x57820b['lastIndexOf'](')'));_0x759466['enduserId']=_0x2c1240;_0x3bf32b(_0x759466);})[_0x14d9('0x17')](function(_0x9221a2){_0x4c4f8c(_0x9221a2[_0x14d9('0x1a')]);});});}function getEndUser(_0x90ea2c,_0x2961e7,_0x18a96d,_0x7f59e6,_0x5d6c7e,_0x16a7a3,_0x3f2012,_0xe7ee21){var _0x2a5838=_0x16a7a3[_0x14d9('0x2a')]()===_0x14d9('0x32')?_0x5d6c7e[_0x14d9('0x2b')]:_0x5d6c7e[_0x14d9('0x2c')];return getAuthToken(_0x2961e7,_0x18a96d,_0x16a7a3)[_0x14d9('0x16')](function(_0x43d8c5){_0xe7ee21=_0xe7ee21?_0xe7ee21:_0x14d9('0x33');var _0x3c8b22={'method':'GET','uri':_0x7f59e6+_0x14d9('0x34')+_0xe7ee21+'&$filter='+_0xe7ee21+_0x14d9('0x35')+_0x2a5838[_0x14d9('0x36')]('+',_0x14d9('0x37'))+'\x27','headers':{'Authorization':_0x14d9('0x1d')+_0x43d8c5,'If-None-Match':null,'OData-Version':_0x14d9('0x38')},'json':!![]};return rp(_0x3c8b22);})[_0x14d9('0x16')](function(_0x31484b){var _0x41eadd=![];if(!_0x31484b)return _0x41eadd;var _0x6a0b05=_0x31484b['value'];for(var _0x52690c=0x0;_0x52690c<_0x6a0b05[_0x14d9('0x21')];_0x52690c++){if(_0x6a0b05[_0x52690c][_0xe7ee21]===_0x2a5838){_0x41eadd=!![];_0x90ea2c['enduserId']=_0x6a0b05[_0x52690c]['contactid'];}}return _0x41eadd;})[_0x14d9('0x16')](function(_0x31a1ad){if(_0x31a1ad)return _0x90ea2c;if(_0x3f2012===_0x14d9('0x39')){logger[_0x14d9('0x26')]('['+[_0x16a7a3[_0x14d9('0x27')]()]+']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing');return _0x90ea2c;}return createEndUser(_0x90ea2c,_0x2961e7,_0x18a96d,_0x7f59e6,_0x5d6c7e,_0x16a7a3,_0xe7ee21)[_0x14d9('0x16')](function(_0x4f09d3){logger[_0x14d9('0x26')]('['+[_0x16a7a3[_0x14d9('0x27')]()]+_0x14d9('0x3a'),_0x4f09d3[_0x14d9('0x3b')]);return _0x4f09d3;});});}function getCustomFields(_0x66a68d,_0x1b6f70,_0x378e18){var _0x35666d={};if(_0x66a68d[_0x14d9('0x21')]>0x0){_[_0x14d9('0x3c')](_0x66a68d,function(_0x881302){if(_['includes']([_0x14d9('0x3d'),'picklist'],_0x881302[_0x14d9('0x3e')])&&_0x881302[_0x14d9('0x3f')]&&!_0x881302['customField']){var _0x259783=_0x881302[_0x14d9('0x40')][_0x14d9('0x2a')]();var _0x1013a2=_0x259783[_0x14d9('0x41')](0x0,_0x259783[_0x14d9('0x42')]('_'));var _0x18a3fe=_0x259783[_0x14d9('0x41')](_0x259783[_0x14d9('0x42')]('_')+0x1);if(_0x1013a2===_0x378e18){_0x35666d[_0x18a3fe]=_0x881302[_0x14d9('0x43')];}}});}return _0x35666d;}function getTicket(_0x23df9a,_0x3c3fe2,_0x5342b8,_0x5af14a,_0x209943,_0xcbef9a,_0x33ed97){return new Promise(function(_0x217015,_0x3e0d60){var _0x47fa0d;return getAuthToken(_0x3c3fe2,_0x5342b8,_0x33ed97)[_0x14d9('0x16')](function(_0x125c45){if(_0xcbef9a[_0x14d9('0x44')]===_0x14d9('0x45')){_0x47fa0d={'method':_0x14d9('0x10'),'uri':_0x5af14a+_0x14d9('0x46'),'body':Object[_0x14d9('0x47')]({},{'title':intUtil[_0x14d9('0x48')](_0xcbef9a[_0x14d9('0x49')],_0x209943,'\x20'),'description':intUtil[_0x14d9('0x48')](_0xcbef9a[_0x14d9('0x4a')],_0x209943,'\x0a'),'customerid_contact@odata.bind':_0x23df9a[_0x14d9('0x3b')]?_0x14d9('0x4b')+_0x23df9a['enduserId']+')':undefined,'ownerid@odata.bind':_0x14d9('0x2d')+_0x23df9a[_0x14d9('0x29')]+')','caseorigincode':'1'},getCustomFields(_0xcbef9a['Fields'],_0x209943,_0xcbef9a[_0x14d9('0x44')])),'headers':{'Authorization':_0x14d9('0x1d')+_0x125c45,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}if(_0xcbef9a['ticketType']==='phonecall'){var _0x3fa5ac=_0x23df9a[_0x14d9('0x3b')]?[{'partyid_systemuser@odata.bind':_0x14d9('0x2d')+_0x23df9a[_0x14d9('0x29')]+')','participationtypemask':_0x23df9a[_0x14d9('0x4c')]==='queue'?0x2:0x1},{'partyid_contact@odata.bind':'/contacts('+_0x23df9a[_0x14d9('0x3b')]+')','participationtypemask':_0x23df9a[_0x14d9('0x4c')]===_0x14d9('0x4d')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0x14d9('0x2d')+_0x23df9a[_0x14d9('0x29')]+')','participationtypemask':_0x23df9a[_0x14d9('0x4c')]==='queue'?0x2:0x1}];_0x47fa0d={'method':_0x14d9('0x10'),'uri':_0x5af14a+_0x14d9('0x4e'),'body':Object[_0x14d9('0x47')]({},{'subject':intUtil[_0x14d9('0x48')](_0xcbef9a[_0x14d9('0x49')],_0x209943,'\x20'),'phonenumber':String(_0x209943['calleridnum']),'description':intUtil[_0x14d9('0x48')](_0xcbef9a[_0x14d9('0x4a')],_0x209943,'\x0a'),'regardingobjectid_contact@odata.bind':_0x23df9a[_0x14d9('0x3b')]?_0x14d9('0x4b')+_0x23df9a[_0x14d9('0x3b')]+')':undefined,'ownerid@odata.bind':_0x14d9('0x2d')+_0x23df9a[_0x14d9('0x29')]+')','directioncode':_0x23df9a[_0x14d9('0x4c')]===_0x14d9('0x4d')?![]:!![],'phonecall_activity_parties':_0x3fa5ac},getCustomFields(_0xcbef9a[_0x14d9('0x4f')],_0x209943,_0xcbef9a['ticketType'])),'headers':{'Authorization':_0x14d9('0x1d')+_0x125c45,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x47fa0d);})[_0x14d9('0x16')](function(_0x170a8f){var _0x1f8d3f=_0x170a8f['headers'][_0x14d9('0x30')];var _0x3d07d9=_0x1f8d3f[_0x14d9('0x41')](_0x1f8d3f[_0x14d9('0x31')]('(')+0x1,_0x1f8d3f['lastIndexOf'](')'));_0x23df9a['ticketId']=_0x3d07d9;_0x217015(_0x23df9a);})['catch'](function(_0x521485){_0x3e0d60(_0x521485[_0x14d9('0x1a')]);});});}function emit(_0x2b106,_0xf9351e,_0x24d194,_0x17da20){var _0x264c1e={'uri':util['format'](_0x14d9('0x50'),_0x2b106,_0x24d194,_0x17da20)};io['to'](util[_0x14d9('0x51')](_0x14d9('0x52'),_0xf9351e))['emit'](_0x14d9('0x53'),_0x264c1e);}exports['cs']=function(_0x1c8645,_0x2f2070,_0x2e866b,_0x57f6e1,_0x125f41,_0x1e32ee,_0x401d69,_0xbac6b6){var _0x351dda={};_0x1e32ee[_0x14d9('0x12')]=_0x1e32ee[_0x14d9('0x54')]?intUtil['stripTrailingSlash'](_0x1e32ee[_0x14d9('0xc')][_0x14d9('0x55')]):intUtil[_0x14d9('0x56')](_0x1e32ee[_0x14d9('0x12')]);_0x1e32ee[_0x14d9('0x57')]=intUtil[_0x14d9('0x56')](_0x1e32ee['serverUrl']);_0x351dda['callDirection']=_0xbac6b6===_0x14d9('0x4d')||_0xbac6b6==='unmanaged'?_0x14d9('0x4d'):_0x14d9('0x32');var _0x3e7023=_0x1e32ee['modernAuthentication']?util['format']('%s/api/data/v9.0/',_0x1e32ee['CloudProvider'][_0x14d9('0x55')]):util[_0x14d9('0x51')]('%s/api/data/v9.0/',_0x1e32ee[_0x14d9('0x12')]);var _0x4b8b67=util['format'](_0x14d9('0x58'),_0x1e32ee['tenantId']);var _0x23182a=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1e32ee[_0x14d9('0x57')],_0x2f2070[_0x14d9('0x59')],md5(_0x2f2070[_0x14d9('0x59')]));if(_0x125f41&&_0x125f41[_0x14d9('0x5a')]){logger['info'](_0x14d9('0x5b'),'Recording\x20is\x20enabled!');_0x2f2070[_0x14d9('0x5c')]=_0x23182a;}else if(_0x401d69&&_0x401d69[_0x14d9('0x5d')]&&_0x401d69[_0x14d9('0x5d')]!==_0x14d9('0x5e')){logger['info'](_0x14d9('0x5f'),'Recording\x20is\x20enabled!');_0x2f2070['recordingURL']=_0x23182a;}else{_0x2f2070[_0x14d9('0x5c')]='';}return getUser(_0x351dda,_0x1e32ee,_0x57f6e1,_0x4b8b67,_0x3e7023,_0xbac6b6)[_0x14d9('0x16')](function(_0x155366){logger[_0x14d9('0x26')]('['+_0xbac6b6[_0x14d9('0x27')]()+']\x20The\x20User\x20ID\x20is:',_0x155366['userId']);logger[_0x14d9('0x26')]('['+_0xbac6b6[_0x14d9('0x27')]()+_0x14d9('0x60'),_0x155366[_0x14d9('0x1f')]);return getEndUser(_0x155366,_0x1e32ee,_0x4b8b67,_0x3e7023,_0x2f2070,_0xbac6b6,_0x2e866b[_0x14d9('0x61')],_0x2e866b[_0x14d9('0x62')]);})[_0x14d9('0x16')](function(_0x3a70a4){logger[_0x14d9('0x26')]('['+_0xbac6b6[_0x14d9('0x27')]()+_0x14d9('0x63'),_0x3a70a4[_0x14d9('0x3b')]);logger[_0x14d9('0x26')]('['+_0xbac6b6[_0x14d9('0x27')]()+_0x14d9('0x64'),_0x2f2070[_0x14d9('0x2c')]);return getTicket(_0x3a70a4,_0x1e32ee,_0x4b8b67,_0x3e7023,_0x2f2070,_0x2e866b,_0xbac6b6);})[_0x14d9('0x16')](function(_0x839c08){logger['info'](util['format']('['+_0xbac6b6[_0x14d9('0x27')]()+']\x20The\x20%s\x20ID\x20is:\x20%s',_0x2e866b[_0x14d9('0x44')],_0x839c08[_0x14d9('0x65')]));logger[_0x14d9('0x26')](util[_0x14d9('0x51')]('['+_0xbac6b6[_0x14d9('0x27')]()+']\x20Call\x20direction:\x20%s',_0xbac6b6));if(_0xbac6b6!==_0x14d9('0x66')&&_0x2e866b[_0x14d9('0x67')]){logger[_0x14d9('0x26')]('['+_0xbac6b6[_0x14d9('0x27')]()+']',_0x14d9('0x68'));emit(_0x1e32ee[_0x14d9('0x12')],_0x57f6e1['name'],_0x2e866b[_0x14d9('0x44')],_0x839c08[_0x14d9('0x65')]);}})['catch'](function(_0x15e1e1){logger['error']('['+_0xbac6b6[_0x14d9('0x27')]()+_0x14d9('0x69'),_0x15e1e1['message']);console[_0x14d9('0x18')](_0x14d9('0x6a'),_0x15e1e1);});}; \ 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 2f61b8c..703b68b 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 _0x60cd=['remoteUri','POST','then','Ticket\x20created!','validateEmail','%s/api/v2/agents','length','Agent\x20found!','find','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','Basic\x20%s','apiKey','toString','base64','debug','[HTTP]','stringify','forEach','includes','string','picklist','nameField','customField','type','idField','content','variable','variableName','push','customVariable','Variable','toLowerCase','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','trigger:browser:url','catch','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','%s/helpdesk/tickets/%d','unmanaged','lastevent','Authorization','error','toUpperCase','lodash','md5','util','ioredis','./util','../../../../config/environment','freshdesk','redis','defaults','localhost','socket.io-emitter','emit','info','Creating\x20new\x20ticket...','merge','format','Caller\x20-\x20%s','calleridname','calleridnum','Subjects','getString','Descriptions','
','Tags','name','Fields','mapValues','keyBy','custom_fields','value','%s/api/v2/tickets'];(function(_0x131162,_0x4c2814){var _0x45285d=function(_0x19fb1f){while(--_0x19fb1f){_0x131162['push'](_0x131162['shift']());}};_0x45285d(++_0x4c2814);}(_0x60cd,0x159));var _0xd60c=function(_0x461119,_0x28ce98){_0x461119=_0x461119-0x0;var _0x4b5ed3=_0x60cd[_0x461119];return _0x4b5ed3;};'use strict';var _=require(_0xd60c('0x0'));var rp=require('request-promise');var md5=require(_0xd60c('0x1'));var util=require(_0xd60c('0x2'));var Redis=require(_0xd60c('0x3'));var intUtil=require(_0xd60c('0x4'));var config=require(_0xd60c('0x5'));var logger=require('../../../../config/logger')(_0xd60c('0x6'));config[_0xd60c('0x7')]=_[_0xd60c('0x8')](config[_0xd60c('0x7')],{'host':_0xd60c('0x9'),'port':0x18eb});var io=require(_0xd60c('0xa'))(new Redis(config[_0xd60c('0x7')]));var headers={'Content-Type':'application/json','Accept':'application/json'};function emit(_0x41bc5b,_0x5d6fef,_0xb4522d){io['to'](_0x41bc5b)[_0xd60c('0xb')](_0x5d6fef,_0xb4522d);}function getTicket(_0x28d21f,_0x22c26a,_0x189f32,_0x44235f,_0x3b48b8){logger[_0xd60c('0xc')](_0xd60c('0xd'));var _0x620c0c=_[_0xd60c('0xe')]({'responder_id':_0x22c26a['id'],'requester_id':_0x189f32['id'],'name':util[_0xd60c('0xf')](_0xd60c('0x10'),_0x3b48b8[_0xd60c('0x11')]),'phone':_0x3b48b8[_0xd60c('0x12')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil['getString'](_0x44235f[_0xd60c('0x13')],_0x3b48b8,'\x20'),'description':intUtil[_0xd60c('0x14')](_0x44235f[_0xd60c('0x15')],_0x3b48b8,_0xd60c('0x16')),'tags':getTags(_0x44235f[_0xd60c('0x17')],_0xd60c('0x18'))},getCustomFields(_0x44235f[_0xd60c('0x19')],_0x3b48b8));_0x620c0c['custom_fields']=_[_0xd60c('0x1a')](_[_0xd60c('0x1b')](_0x620c0c[_0xd60c('0x1c')],'id'),_0xd60c('0x1d'));return request({'uri':util[_0xd60c('0xf')](_0xd60c('0x1e'),_0x28d21f[_0xd60c('0x1f')]),'method':_0xd60c('0x20'),'body':_0x620c0c})[_0xd60c('0x21')](function(_0x41776b){logger[_0xd60c('0xc')](_0xd60c('0x22'));return _0x41776b;});}function getUser(_0x11700b,_0x324683){if(intUtil[_0xd60c('0x23')](_0x324683)){return request({'uri':util['format'](_0xd60c('0x24'),_0x11700b[_0xd60c('0x1f')]),'qs':{'email':_0x324683}})['then'](function(_0x1b1a24){if(_0x1b1a24[_0xd60c('0x25')]){logger[_0xd60c('0xc')](_0xd60c('0x26'));return _[_0xd60c('0x27')](_0x1b1a24,function(_0x50640b){return _0x50640b['contact'][_0xd60c('0x28')]===_0x324683;});}else{logger[_0xd60c('0xc')](_0xd60c('0x29'));return request({'uri':util[_0xd60c('0xf')](_0xd60c('0x2a'),_0x11700b['remoteUri'])})[_0xd60c('0x21')](function(_0x1374d4){logger[_0xd60c('0xc')]('Admin\x20account\x20selected.');return _0x1374d4;});}});}else{logger[_0xd60c('0xc')](_0xd60c('0x2b'));return request({'uri':util[_0xd60c('0xf')](_0xd60c('0x2a'),_0x11700b[_0xd60c('0x1f')])})[_0xd60c('0x21')](function(_0x41a592){logger[_0xd60c('0xc')]('Admin\x20account\x20selected.');return _0x41a592;});}}function getEndUser(_0x2fcb01,_0x111b70,_0x530db2){logger[_0xd60c('0xc')](_0xd60c('0x2c'),_0x530db2);return request({'uri':util[_0xd60c('0xf')](_0xd60c('0x2d'),_0x2fcb01[_0xd60c('0x1f')]),'qs':{'phone':_0x530db2}})[_0xd60c('0x21')](function(_0x19ddc6){if(_0x19ddc6[_0xd60c('0x25')]){logger[_0xd60c('0xc')]('Enduser\x20found!');return _[_0xd60c('0x27')](_0x19ddc6,{'phone':_0x530db2});}else{logger[_0xd60c('0xc')](_0xd60c('0x2e'));return request({'uri':util['format'](_0xd60c('0x2d'),_0x2fcb01[_0xd60c('0x1f')]),'method':_0xd60c('0x20'),'body':{'name':_0x111b70,'phone':_0x530db2}})[_0xd60c('0x21')](function(_0x5b2a08){logger[_0xd60c('0xc')](_0xd60c('0x2f'));return _0x5b2a08;});}});}function getAuth(_0x2840e2){return util['format'](_0xd60c('0x30'),new Buffer(_0x2840e2[_0xd60c('0x31')]+':X')[_0xd60c('0x32')](_0xd60c('0x33')));}function request(_0x894fee){logger[_0xd60c('0x34')](_0xd60c('0x35'),JSON[_0xd60c('0x36')](_0x894fee));return rp(_[_0xd60c('0x8')](_0x894fee,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x4bb6bc,_0x20ea31){var _0x422680=[];if(_0x4bb6bc&&_0x4bb6bc[_0xd60c('0x25')]>0x0){_0x422680=_['map'](_0x4bb6bc,_0x20ea31);}return _0x422680;}function getCustomFields(_0x424bb0,_0xf017ef){var _0x549828=[];var _0x174403={'custom_fields':[]};if(_0x424bb0[_0xd60c('0x25')]>0x0){_[_0xd60c('0x37')](_0x424bb0,function(_0x5bf1d9){if(_[_0xd60c('0x38')]([_0xd60c('0x39'),_0xd60c('0x3a')],_0x5bf1d9['type'])&&_0x5bf1d9[_0xd60c('0x3b')]&&!_0x5bf1d9[_0xd60c('0x3c')]){_0x174403[_0x5bf1d9[_0xd60c('0x3b')]['toLowerCase']()]=_0x5bf1d9['content'][_0xd60c('0x32')]();}else if(_[_0xd60c('0x38')]([_0xd60c('0x39'),'picklist'],_0x5bf1d9[_0xd60c('0x3d')])&&_0x5bf1d9[_0xd60c('0x3e')]&&_0x5bf1d9['customField']){_0x174403['custom_fields']['push']({'id':_0x5bf1d9[_0xd60c('0x3e')],'value':_0x5bf1d9[_0xd60c('0x3f')]['toString']()});}else if(_0x5bf1d9['type']===_0xd60c('0x40')&&_0x5bf1d9[_0xd60c('0x41')]&&_0x5bf1d9[_0xd60c('0x3e')]&&_0x5bf1d9[_0xd60c('0x3c')]){_0xf017ef[_0x5bf1d9['variableName']]&&_0x174403[_0xd60c('0x1c')][_0xd60c('0x42')]({'id':_0x5bf1d9[_0xd60c('0x3e')],'value':_0xf017ef[_0x5bf1d9['variableName']]['toString']()});}else if(_0x5bf1d9['type']===_0xd60c('0x43')&&_0x5bf1d9[_0xd60c('0x44')]&&_0x5bf1d9[_0xd60c('0x44')][_0xd60c('0x18')]&&_0x5bf1d9['idField']&&_0x5bf1d9[_0xd60c('0x3c')]){_0xf017ef[_0x5bf1d9[_0xd60c('0x44')][_0xd60c('0x18')][_0xd60c('0x45')]()]&&_0x174403[_0xd60c('0x1c')][_0xd60c('0x42')]({'id':_0x5bf1d9['idField'],'value':_0xf017ef[_0x5bf1d9['Variable'][_0xd60c('0x18')]['toLowerCase']()][_0xd60c('0x32')]()});}});}return _0x174403;}exports[_0xd60c('0x46')]=function(_0x4a8239,_0x3bee3e,_0x30aeee,_0xbf3af5,_0x2dbc18,_0x533c19){var _0x296b96,_0x242fa3;_0x533c19['remoteUri']=intUtil[_0xd60c('0x47')](_0x533c19[_0xd60c('0x1f')]);_0x533c19['serverUrl']=intUtil[_0xd60c('0x47')](_0x533c19[_0xd60c('0x48')]);if(_0x2dbc18&&_0x2dbc18[_0xd60c('0x49')]){logger[_0xd60c('0xc')](_0xd60c('0x4a'),'Recording\x20is\x20enabled!');_0x3bee3e['recordingURL']=util[_0xd60c('0xf')](_0xd60c('0x4b'),_0x533c19['serverUrl'],_0x3bee3e['uniqueid'],md5(_0x3bee3e[_0xd60c('0x4c')]));}else{_0x3bee3e[_0xd60c('0x4d')]='';}headers['Authorization']=getAuth(_0x533c19);return getUser(_0x533c19,_0xbf3af5[_0xd60c('0x28')])[_0xd60c('0x21')](function(_0x19d6f9){_0x296b96=_0x19d6f9;logger[_0xd60c('0xc')](_0xd60c('0x4e'),_0x296b96['id']);return getEndUser(_0x533c19,_0x3bee3e[_0xd60c('0x11')],_0x3bee3e['calleridnum']);})[_0xd60c('0x21')](function(_0x49fc6d){_0x242fa3=_0x49fc6d;logger[_0xd60c('0xc')](_0xd60c('0x4f'),_0x242fa3['id']);return getTicket(_0x533c19,_0x296b96,_0x242fa3,_0x30aeee,_0x3bee3e);})['then'](function(_0x1a57b9){if(_0x1a57b9&&_0x1a57b9['id']){logger[_0xd60c('0xc')](_0xd60c('0x22'));logger[_0xd60c('0xc')](_0xd60c('0x50'),_0x1a57b9['id']);logger[_0xd60c('0xc')](_0xd60c('0x4a'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xd60c('0xf')]('user:%s',_0xbf3af5['name']),_0xd60c('0x51'),{'uri':util[_0xd60c('0xf')]('%s/helpdesk/tickets/%d',_0x533c19[_0xd60c('0x1f')],_0x1a57b9['id'])});}})[_0xd60c('0x52')](function(_0x1e93f3){logger['error']('[QUEUE]',JSON[_0xd60c('0x36')](_0x1e93f3));});};exports['outbound']=function(_0x35db3c,_0x2b7bd9,_0x438e48,_0x112ad2,_0x2b5de0,_0x3dc9d1,_0xd17ca4){var _0x26b3f6,_0x442e67;_0x3dc9d1[_0xd60c('0x1f')]=intUtil[_0xd60c('0x47')](_0x3dc9d1[_0xd60c('0x1f')]);_0x3dc9d1[_0xd60c('0x48')]=intUtil[_0xd60c('0x47')](_0x3dc9d1['serverUrl']);if(_0xd17ca4&&_0xd17ca4[_0xd60c('0x53')]&&_0xd17ca4['recordingFormat']!==_0xd60c('0x54')){logger['info'](_0xd60c('0x55'),_0xd60c('0x56'));_0x2b7bd9[_0xd60c('0x4d')]=util['format'](_0xd60c('0x4b'),_0x3dc9d1[_0xd60c('0x48')],_0x2b7bd9[_0xd60c('0x4c')],md5(_0x2b7bd9[_0xd60c('0x4c')]));}headers['Authorization']=getAuth(_0x3dc9d1);return getUser(_0x3dc9d1,_0x112ad2[_0xd60c('0x28')])[_0xd60c('0x21')](function(_0x177c48){_0x26b3f6=_0x177c48;logger['info'](_0xd60c('0x4e'),_0x26b3f6['id']);return getEndUser(_0x3dc9d1,_0x2b7bd9['destcalleridname'],_0x2b7bd9['destcalleridnum']);})[_0xd60c('0x21')](function(_0x149743){_0x442e67=_0x149743;logger[_0xd60c('0xc')]('The\x20Enduser\x20ID\x20is:',_0x442e67['id']);return getTicket(_0x3dc9d1,_0x26b3f6,_0x442e67,_0x438e48,_0x2b7bd9);})[_0xd60c('0x21')](function(_0x32822b){if(_0x32822b&&_0x32822b['id']){logger['info']('Ticket\x20created!');logger['info'](_0xd60c('0x50'),_0x32822b['id']);logger[_0xd60c('0xc')](_0xd60c('0x55'),_0xd60c('0x57'));emit(util[_0xd60c('0xf')]('user:%s',_0x112ad2[_0xd60c('0x18')]),_0xd60c('0x51'),{'uri':util['format'](_0xd60c('0x58'),_0x3dc9d1['remoteUri'],_0x32822b['id'])});}})[_0xd60c('0x52')](function(_0x58bc39){logger['error'](_0xd60c('0x55'),JSON['stringify'](_0x58bc39));});};exports[_0xd60c('0x59')]=function(_0x1208ee,_0x5ae9a7,_0x4cb845,_0x205c44,_0x5d3627,_0x2bfd23){var _0x137c98,_0x5b4eed;_0x2bfd23[_0xd60c('0x1f')]=intUtil[_0xd60c('0x47')](_0x2bfd23[_0xd60c('0x1f')]);_0x2bfd23['serverUrl']=intUtil[_0xd60c('0x47')](_0x2bfd23[_0xd60c('0x48')]);if(_0x5d3627&&_0x5d3627[_0xd60c('0x49')]){logger[_0xd60c('0xc')]('['+_0x5ae9a7[_0xd60c('0x5a')]['toUpperCase']()+']',_0xd60c('0x56'));_0x5ae9a7['recordingURL']=util['format'](_0xd60c('0x4b'),_0x2bfd23['serverUrl'],_0x5ae9a7[_0xd60c('0x4c')],md5(_0x5ae9a7[_0xd60c('0x4c')]));}else{_0x5ae9a7['recordingURL']='';}headers[_0xd60c('0x5b')]=getAuth(_0x2bfd23);return getUser(_0x2bfd23,'')[_0xd60c('0x21')](function(_0x4d91e1){_0x137c98=_0x4d91e1;logger[_0xd60c('0xc')]('The\x20User\x20ID\x20is:',_0x137c98['id']);return getEndUser(_0x2bfd23,_0x5ae9a7['calleridname'],_0x5ae9a7['calleridnum']);})['then'](function(_0x2af30e){_0x5b4eed=_0x2af30e;logger[_0xd60c('0xc')](_0xd60c('0x4f'),_0x5b4eed['id']);return getTicket(_0x2bfd23,_0x137c98,_0x5b4eed,_0x4cb845,_0x5ae9a7);})[_0xd60c('0x21')](function(_0x34bc36){if(_0x34bc36){logger[_0xd60c('0xc')](_0xd60c('0x22'));logger[_0xd60c('0xc')]('The\x20Ticket\x20ID\x20is:',_0x34bc36['id']);}})[_0xd60c('0x52')](function(_0x93ed2a){logger[_0xd60c('0x5c')]('['+_0x5ae9a7['lastevent'][_0xd60c('0x5d')]()+']',JSON[_0xd60c('0x36')](_0x93ed2a));});}; \ No newline at end of file +var _0x42ed=['calleridname','calleridnum','getString','
','Tags','Fields','custom_fields','mapValues','keyBy','value','%s/api/v2/tickets','remoteUri','POST','then','info','Ticket\x20created!','validateEmail','%s/api/v2/agents','Agent\x20found!','find','contact','email','%s/api/v2/agents/me','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','length','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','Basic\x20%s','toString','base64','[HTTP]','stringify','defaults','map','forEach','includes','string','picklist','type','nameField','customField','toLowerCase','content','idField','push','variable','Variable','name','queue','serverUrl','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','%s/helpdesk/tickets/%d','catch','error','outbound','stripTrailingSlash','recordingFormat','[OUTBOUND]','Recording\x20is\x20enabled!','The\x20User\x20ID\x20is:','destcalleridname','unmanaged','monitor_format','lastevent','The\x20Enduser\x20ID\x20is:','toUpperCase','lodash','request-promise','md5','ioredis','./util','freshdesk','redis','socket.io-emitter','application/json','emit','Creating\x20new\x20ticket...','merge','format','Caller\x20-\x20%s'];(function(_0x1581f3,_0x35f3e8){var _0x3007be=function(_0x581fe9){while(--_0x581fe9){_0x1581f3['push'](_0x1581f3['shift']());}};_0x3007be(++_0x35f3e8);}(_0x42ed,0x15a));var _0xd42e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x42ed[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xd42e('0x0'));var rp=require(_0xd42e('0x1'));var md5=require(_0xd42e('0x2'));var util=require('util');var Redis=require(_0xd42e('0x3'));var intUtil=require(_0xd42e('0x4'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0xd42e('0x5'));config[_0xd42e('0x6')]=_['defaults'](config[_0xd42e('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0xd42e('0x7'))(new Redis(config['redis']));var headers={'Content-Type':_0xd42e('0x8'),'Accept':'application/json'};function emit(_0x57a9d6,_0x261219,_0xa4634b){io['to'](_0x57a9d6)[_0xd42e('0x9')](_0x261219,_0xa4634b);}function getTicket(_0x5d4e95,_0x50aca1,_0x257ce5,_0x447935,_0x289ad7){logger['info'](_0xd42e('0xa'));var _0x40e542=_[_0xd42e('0xb')]({'responder_id':_0x50aca1['id'],'requester_id':_0x257ce5['id'],'name':util[_0xd42e('0xc')](_0xd42e('0xd'),_0x289ad7[_0xd42e('0xe')]),'phone':_0x289ad7[_0xd42e('0xf')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0xd42e('0x10')](_0x447935['Subjects'],_0x289ad7,'\x20'),'description':intUtil[_0xd42e('0x10')](_0x447935['Descriptions'],_0x289ad7,_0xd42e('0x11')),'tags':getTags(_0x447935[_0xd42e('0x12')],'name')},getCustomFields(_0x447935[_0xd42e('0x13')],_0x289ad7));_0x40e542[_0xd42e('0x14')]=_[_0xd42e('0x15')](_[_0xd42e('0x16')](_0x40e542[_0xd42e('0x14')],'id'),_0xd42e('0x17'));return request({'uri':util[_0xd42e('0xc')](_0xd42e('0x18'),_0x5d4e95[_0xd42e('0x19')]),'method':_0xd42e('0x1a'),'body':_0x40e542})[_0xd42e('0x1b')](function(_0x13790f){logger[_0xd42e('0x1c')](_0xd42e('0x1d'));return _0x13790f;});}function getUser(_0x474944,_0x1d595b){if(intUtil[_0xd42e('0x1e')](_0x1d595b)){return request({'uri':util[_0xd42e('0xc')](_0xd42e('0x1f'),_0x474944['remoteUri']),'qs':{'email':_0x1d595b}})[_0xd42e('0x1b')](function(_0x3ee4d4){if(_0x3ee4d4['length']){logger[_0xd42e('0x1c')](_0xd42e('0x20'));return _[_0xd42e('0x21')](_0x3ee4d4,function(_0x46a4bc){return _0x46a4bc[_0xd42e('0x22')][_0xd42e('0x23')]===_0x1d595b;});}else{logger[_0xd42e('0x1c')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xd42e('0xc')](_0xd42e('0x24'),_0x474944[_0xd42e('0x19')])})[_0xd42e('0x1b')](function(_0xe0617d){logger[_0xd42e('0x1c')]('Admin\x20account\x20selected.');return _0xe0617d;});}});}else{logger[_0xd42e('0x1c')](_0xd42e('0x25'));return request({'uri':util[_0xd42e('0xc')](_0xd42e('0x24'),_0x474944[_0xd42e('0x19')])})[_0xd42e('0x1b')](function(_0x5eb3c0){logger['info']('Admin\x20account\x20selected.');return _0x5eb3c0;});}}function getEndUser(_0x3da750,_0x469851,_0x476267){logger[_0xd42e('0x1c')](_0xd42e('0x26'),_0x476267);return request({'uri':util['format'](_0xd42e('0x27'),_0x3da750[_0xd42e('0x19')]),'qs':{'phone':_0x476267}})[_0xd42e('0x1b')](function(_0x5896d2){if(_0x5896d2[_0xd42e('0x28')]){logger[_0xd42e('0x1c')](_0xd42e('0x29'));return _[_0xd42e('0x21')](_0x5896d2,{'phone':_0x476267});}else{logger[_0xd42e('0x1c')](_0xd42e('0x2a'));return request({'uri':util[_0xd42e('0xc')](_0xd42e('0x27'),_0x3da750[_0xd42e('0x19')]),'method':_0xd42e('0x1a'),'body':{'name':_0x469851,'phone':_0x476267}})[_0xd42e('0x1b')](function(_0x3c93b8){logger[_0xd42e('0x1c')](_0xd42e('0x2b'));return _0x3c93b8;});}});}function getAuth(_0x50692f){return util[_0xd42e('0xc')](_0xd42e('0x2c'),new Buffer(_0x50692f['apiKey']+':X')[_0xd42e('0x2d')](_0xd42e('0x2e')));}function request(_0x35c5ef){logger['debug'](_0xd42e('0x2f'),JSON[_0xd42e('0x30')](_0x35c5ef));return rp(_[_0xd42e('0x31')](_0x35c5ef,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x2dac6a,_0x51c268){var _0x4a4673=[];if(_0x2dac6a&&_0x2dac6a[_0xd42e('0x28')]>0x0){_0x4a4673=_[_0xd42e('0x32')](_0x2dac6a,_0x51c268);}return _0x4a4673;}function getCustomFields(_0x431657,_0x4e5dcf){var _0x3144d2=[];var _0x425e21={'custom_fields':[]};if(_0x431657[_0xd42e('0x28')]>0x0){_[_0xd42e('0x33')](_0x431657,function(_0x4335db){if(_[_0xd42e('0x34')]([_0xd42e('0x35'),_0xd42e('0x36')],_0x4335db[_0xd42e('0x37')])&&_0x4335db[_0xd42e('0x38')]&&!_0x4335db[_0xd42e('0x39')]){_0x425e21[_0x4335db[_0xd42e('0x38')][_0xd42e('0x3a')]()]=_0x4335db[_0xd42e('0x3b')][_0xd42e('0x2d')]();}else if(_[_0xd42e('0x34')]([_0xd42e('0x35'),_0xd42e('0x36')],_0x4335db['type'])&&_0x4335db[_0xd42e('0x3c')]&&_0x4335db[_0xd42e('0x39')]){_0x425e21[_0xd42e('0x14')][_0xd42e('0x3d')]({'id':_0x4335db['idField'],'value':_0x4335db[_0xd42e('0x3b')][_0xd42e('0x2d')]()});}else if(_0x4335db['type']===_0xd42e('0x3e')&&_0x4335db['variableName']&&_0x4335db[_0xd42e('0x3c')]&&_0x4335db[_0xd42e('0x39')]){_0x4e5dcf[_0x4335db['variableName']]&&_0x425e21[_0xd42e('0x14')][_0xd42e('0x3d')]({'id':_0x4335db['idField'],'value':_0x4e5dcf[_0x4335db['variableName']][_0xd42e('0x2d')]()});}else if(_0x4335db[_0xd42e('0x37')]==='customVariable'&&_0x4335db[_0xd42e('0x3f')]&&_0x4335db[_0xd42e('0x3f')]['name']&&_0x4335db[_0xd42e('0x3c')]&&_0x4335db['customField']){_0x4e5dcf[_0x4335db[_0xd42e('0x3f')][_0xd42e('0x40')][_0xd42e('0x3a')]()]&&_0x425e21[_0xd42e('0x14')][_0xd42e('0x3d')]({'id':_0x4335db[_0xd42e('0x3c')],'value':_0x4e5dcf[_0x4335db[_0xd42e('0x3f')][_0xd42e('0x40')][_0xd42e('0x3a')]()][_0xd42e('0x2d')]()});}});}return _0x425e21;}exports[_0xd42e('0x41')]=function(_0x476be,_0xd1bb3a,_0x2f6a87,_0x22ed53,_0x2822bd,_0x6e87b0){var _0x5f05e5,_0x35da29;_0x6e87b0[_0xd42e('0x19')]=intUtil['stripTrailingSlash'](_0x6e87b0[_0xd42e('0x19')]);_0x6e87b0[_0xd42e('0x42')]=intUtil['stripTrailingSlash'](_0x6e87b0[_0xd42e('0x42')]);if(_0x2822bd&&_0x2822bd['monitor_format']){logger['info'](_0xd42e('0x43'),'Recording\x20is\x20enabled!');_0xd1bb3a[_0xd42e('0x44')]=util[_0xd42e('0xc')](_0xd42e('0x45'),_0x6e87b0['serverUrl'],_0xd1bb3a[_0xd42e('0x46')],md5(_0xd1bb3a[_0xd42e('0x46')]));}else{_0xd1bb3a[_0xd42e('0x44')]='';}headers[_0xd42e('0x47')]=getAuth(_0x6e87b0);return getUser(_0x6e87b0,_0x22ed53[_0xd42e('0x23')])['then'](function(_0x508087){_0x5f05e5=_0x508087;logger['info']('The\x20User\x20ID\x20is:',_0x5f05e5['id']);return getEndUser(_0x6e87b0,_0xd1bb3a[_0xd42e('0xe')],_0xd1bb3a[_0xd42e('0xf')]);})['then'](function(_0x491b25){_0x35da29=_0x491b25;logger[_0xd42e('0x1c')]('The\x20Enduser\x20ID\x20is:',_0x35da29['id']);return getTicket(_0x6e87b0,_0x5f05e5,_0x35da29,_0x2f6a87,_0xd1bb3a);})['then'](function(_0x26d583){if(_0x26d583&&_0x26d583['id']){logger[_0xd42e('0x1c')](_0xd42e('0x1d'));logger[_0xd42e('0x1c')](_0xd42e('0x48'),_0x26d583['id']);logger[_0xd42e('0x1c')]('[QUEUE]',_0xd42e('0x49'));emit(util[_0xd42e('0xc')]('user:%s',_0x22ed53[_0xd42e('0x40')]),_0xd42e('0x4a'),{'uri':util[_0xd42e('0xc')](_0xd42e('0x4b'),_0x6e87b0[_0xd42e('0x19')],_0x26d583['id'])});}})[_0xd42e('0x4c')](function(_0x2c799c){logger[_0xd42e('0x4d')]('[QUEUE]',JSON['stringify'](_0x2c799c));});};exports[_0xd42e('0x4e')]=function(_0x2308c4,_0x52e1ea,_0x45448a,_0x5df9bb,_0x27b746,_0x5f0c7a,_0x50341){var _0x2ee29f,_0x566693;_0x5f0c7a[_0xd42e('0x19')]=intUtil[_0xd42e('0x4f')](_0x5f0c7a[_0xd42e('0x19')]);_0x5f0c7a['serverUrl']=intUtil['stripTrailingSlash'](_0x5f0c7a[_0xd42e('0x42')]);if(_0x50341&&_0x50341[_0xd42e('0x50')]&&_0x50341[_0xd42e('0x50')]!=='none'){logger[_0xd42e('0x1c')](_0xd42e('0x51'),_0xd42e('0x52'));_0x52e1ea[_0xd42e('0x44')]=util['format'](_0xd42e('0x45'),_0x5f0c7a[_0xd42e('0x42')],_0x52e1ea[_0xd42e('0x46')],md5(_0x52e1ea['uniqueid']));}headers['Authorization']=getAuth(_0x5f0c7a);return getUser(_0x5f0c7a,_0x5df9bb[_0xd42e('0x23')])['then'](function(_0x5d10dd){_0x2ee29f=_0x5d10dd;logger[_0xd42e('0x1c')](_0xd42e('0x53'),_0x2ee29f['id']);return getEndUser(_0x5f0c7a,_0x52e1ea[_0xd42e('0x54')],_0x52e1ea['destcalleridnum']);})[_0xd42e('0x1b')](function(_0x33e6fd){_0x566693=_0x33e6fd;logger[_0xd42e('0x1c')]('The\x20Enduser\x20ID\x20is:',_0x566693['id']);return getTicket(_0x5f0c7a,_0x2ee29f,_0x566693,_0x45448a,_0x52e1ea);})['then'](function(_0x1f8717){if(_0x1f8717&&_0x1f8717['id']){logger[_0xd42e('0x1c')](_0xd42e('0x1d'));logger[_0xd42e('0x1c')]('The\x20Ticket\x20ID\x20is:',_0x1f8717['id']);logger[_0xd42e('0x1c')](_0xd42e('0x51'),_0xd42e('0x49'));emit(util['format']('user:%s',_0x5df9bb[_0xd42e('0x40')]),_0xd42e('0x4a'),{'uri':util[_0xd42e('0xc')](_0xd42e('0x4b'),_0x5f0c7a[_0xd42e('0x19')],_0x1f8717['id'])});}})['catch'](function(_0x5cbb6c){logger[_0xd42e('0x4d')](_0xd42e('0x51'),JSON[_0xd42e('0x30')](_0x5cbb6c));});};exports[_0xd42e('0x55')]=function(_0x241707,_0x1db12,_0x268425,_0x411842,_0x47e29b,_0x18f207){var _0x5df65a,_0x65e4f1;_0x18f207[_0xd42e('0x19')]=intUtil[_0xd42e('0x4f')](_0x18f207[_0xd42e('0x19')]);_0x18f207[_0xd42e('0x42')]=intUtil[_0xd42e('0x4f')](_0x18f207['serverUrl']);if(_0x47e29b&&_0x47e29b[_0xd42e('0x56')]){logger[_0xd42e('0x1c')]('['+_0x1db12[_0xd42e('0x57')]['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x1db12[_0xd42e('0x44')]=util['format'](_0xd42e('0x45'),_0x18f207[_0xd42e('0x42')],_0x1db12[_0xd42e('0x46')],md5(_0x1db12[_0xd42e('0x46')]));}else{_0x1db12[_0xd42e('0x44')]='';}headers[_0xd42e('0x47')]=getAuth(_0x18f207);return getUser(_0x18f207,'')[_0xd42e('0x1b')](function(_0x4bbdd1){_0x5df65a=_0x4bbdd1;logger[_0xd42e('0x1c')](_0xd42e('0x53'),_0x5df65a['id']);return getEndUser(_0x18f207,_0x1db12[_0xd42e('0xe')],_0x1db12[_0xd42e('0xf')]);})[_0xd42e('0x1b')](function(_0x3e914c){_0x65e4f1=_0x3e914c;logger[_0xd42e('0x1c')](_0xd42e('0x58'),_0x65e4f1['id']);return getTicket(_0x18f207,_0x5df65a,_0x65e4f1,_0x268425,_0x1db12);})[_0xd42e('0x1b')](function(_0x21b7f5){if(_0x21b7f5){logger[_0xd42e('0x1c')]('Ticket\x20created!');logger[_0xd42e('0x1c')]('The\x20Ticket\x20ID\x20is:',_0x21b7f5['id']);}})['catch'](function(_0x31471a){logger[_0xd42e('0x4d')]('['+_0x1db12[_0xd42e('0x57')][_0xd42e('0x59')]()+']',JSON[_0xd42e('0x30')](_0x31471a));});}; \ 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 1e8b801..0146c2f 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 _0x4f2a=['Getting\x20user\x20list','Getting\x20user\x20with\x20email','agentEmail','User\x20found:','Admin\x20selected','adminEmail','userId','catch','&f=','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','endUserId','Contact\x20found\x20mobile_number:','Contact\x20found\x20work_number:','Contact\x20created:','POST','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','/api/tasks','Subjects','getString','Contact','add','ticketId','task','Task\x20created:','/contacts/','trigger:browser:url','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','username','toLowerCase','outbound','destcalleridnum','calleridnum','callDirection','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','[OUTBOUND]','recordingURL','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','request-promise','md5','moment','bluebird','ioredis','./util','../../../../config/environment','../../../../config/logger','defaults','redis','localhost','socket.io-emitter','/api/selector/owners','headers','info','Getting\x20admin\x20information','then','users','length','email','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','error','toUpperCase','message','GET'];(function(_0x105713,_0x1cbf06){var _0x24f6fc=function(_0xf018a1){while(--_0xf018a1){_0x105713['push'](_0x105713['shift']());}};_0x24f6fc(++_0x1cbf06);}(_0x4f2a,0x1dc));var _0xa4f2=function(_0x596f6e,_0x3f8857){_0x596f6e=_0x596f6e-0x0;var _0x1e0803=_0x4f2a[_0x596f6e];return _0x1e0803;};'use strict';var _=require(_0xa4f2('0x0'));var rp=require(_0xa4f2('0x1'));var md5=require(_0xa4f2('0x2'));var util=require('util');var moment=require(_0xa4f2('0x3'));var Promise=require(_0xa4f2('0x4'));var Redis=require(_0xa4f2('0x5'));var intUtil=require(_0xa4f2('0x6'));var config=require(_0xa4f2('0x7'));var logger=require(_0xa4f2('0x8'))('freshsales');config['redis']=_[_0xa4f2('0x9')](config[_0xa4f2('0xa')],{'host':_0xa4f2('0xb'),'port':0x18eb});var io=require(_0xa4f2('0xc'))(new Redis(config[_0xa4f2('0xa')]));function getAdminId(_0x10d424,_0x2d812b,_0x1e8b16,_0x213366){return new Promise(function(_0x4744f4,_0x48950b){var _0x14b72a=![];var _0xc41a53={'method':'GET','uri':_0x213366+_0xa4f2('0xd'),'json':!![]};_0xc41a53[_0xa4f2('0xe')]=_0x1e8b16;logger[_0xa4f2('0xf')](_0xa4f2('0x10'));return rp(_0xc41a53)[_0xa4f2('0x11')](function(_0x1381c8){if(_0x1381c8){var _0x1ee82d=_0x1381c8[_0xa4f2('0x12')];var _0x905cb9=null;for(_0x905cb9=0x0;_0x905cb9<_0x1ee82d[_0xa4f2('0x13')];_0x905cb9++){if(_0x1ee82d[_0x905cb9][_0xa4f2('0x14')]===_0x10d424['adminEmail']){_0x10d424[_0xa4f2('0x15')]=_0x1ee82d[_0x905cb9]['id'];_0x14b72a=!![];}}if(_0x14b72a){logger[_0xa4f2('0xf')](_0xa4f2('0x16'),_0x10d424[_0xa4f2('0x15')]);_0x4744f4(_0x10d424);}else{_0x48950b({'statusCode':0x194,'message':_0xa4f2('0x17')});}}else{_0x48950b({'statusCode':0x194,'message':_0xa4f2('0x17')});}})['catch'](function(_0x3fe428){logger[_0xa4f2('0x18')]('['+[_0x2d812b[_0xa4f2('0x19')]()]+']',_0x3fe428[_0xa4f2('0x1a')]);_0x48950b(_0x3fe428);});});}function getUser(_0x4dbd94,_0x58fbc8,_0x3f017b){return function(_0x17a49b){return new Promise(function(_0xb9ac17,_0x19f59c){var _0x184671={'method':_0xa4f2('0x1b'),'uri':_0x3f017b+'/api/selector/owners','json':!![]};_0x184671[_0xa4f2('0xe')]=_0x58fbc8;logger[_0xa4f2('0xf')](_0xa4f2('0x1c'));return rp(_0x184671)[_0xa4f2('0x11')](function(_0x15efb4){if(_0x15efb4){var _0xfb3b0=_0x15efb4['users'];var _0x574c98=![];var _0x400872=null;if(_0x17a49b['agentEmail']!==null){logger[_0xa4f2('0xf')](_0xa4f2('0x1d'),_0x17a49b[_0xa4f2('0x1e')]);_0x17a49b['userEmail']=_0x17a49b[_0xa4f2('0x1e')];for(_0x400872=0x0;_0x400872<_0xfb3b0[_0xa4f2('0x13')];_0x400872++){if(_0xfb3b0[_0x400872]['email']===_0x17a49b['agentEmail']){_0x574c98=!![];_0x17a49b['userId']=_0xfb3b0[_0x400872]['id'];logger[_0xa4f2('0xf')](_0xa4f2('0x1f'),_0x17a49b['userId']);}}}if(!_0x574c98){logger['info'](_0xa4f2('0x20'));_0x17a49b['userEmail']=_0x17a49b[_0xa4f2('0x21')];_0x17a49b[_0xa4f2('0x22')]=_0x17a49b[_0xa4f2('0x15')];_0x574c98=!![];}if(_0x574c98){_0xb9ac17(_0x17a49b);}else{_0x19f59c({'statusCode':0x194,'message':_0xa4f2('0x17')});}}else{_0x19f59c({'statusCode':0x194,'message':_0xa4f2('0x17')});}})[_0xa4f2('0x23')](function(_0x572606){logger[_0xa4f2('0x18')]('['+[_0x4dbd94['toUpperCase']()]+']',_0x572606['message']);_0x19f59c(_0x572606);});});};}function searchContact(_0x980da1,_0x326668,_0x4206fe,_0x469c36){return new Promise(function(_0x16fcb7,_0x23b1f0){var _0x1b5a3a={'method':_0xa4f2('0x1b'),'headers':_0x326668,'uri':_0x980da1+'/api/lookup?q='+_0x469c36+_0xa4f2('0x24')+_0x4206fe+'&entities=contact','json':!![]};rp(_0x1b5a3a)['then'](function(_0x41e22b){var _0x527842=_['find'](_0x41e22b[_0xa4f2('0x25')][_0xa4f2('0x25')],[_0x4206fe,_0x469c36]);_0x16fcb7(_0x527842);})[_0xa4f2('0x23')](function(_0x51f3a1){_0x23b1f0(_0x51f3a1);});});}function getEndUser(_0x4f316c,_0x1f670f,_0x23bc51){return function(_0x23479e){return new Promise(function(_0x114a94,_0x10c015){logger[_0xa4f2('0xf')](util[_0xa4f2('0x26')](_0xa4f2('0x27'),_0x23479e['contactNumber']));searchContact(_0x23bc51,_0x1f670f,'mobile_number',_0x23479e[_0xa4f2('0x28')])[_0xa4f2('0x11')](function(_0x137f51){if(_0x137f51){_0x23479e[_0xa4f2('0x29')]=_0x137f51['id'];logger['info'](_0xa4f2('0x2a'),_0x23479e[_0xa4f2('0x29')]);return _0x114a94(_0x23479e);}searchContact(_0x23bc51,_0x1f670f,'work_number',_0x23479e['contactNumber'])[_0xa4f2('0x11')](function(_0x3dc5bb){if(_0x3dc5bb){_0x23479e[_0xa4f2('0x29')]=_0x3dc5bb['id'];logger[_0xa4f2('0xf')](_0xa4f2('0x2b'),_0x23479e[_0xa4f2('0x29')]);return _0x114a94(_0x23479e);}createEndUser(_0x23479e,_0x4f316c,_0x1f670f,_0x23bc51)[_0xa4f2('0x11')](function(_0x3c7aba){logger[_0xa4f2('0xf')](_0xa4f2('0x2c'),_0x3c7aba[_0xa4f2('0x29')]);return _0x114a94(_0x3c7aba);});});})['catch'](function(_0x555ce5){_0x10c015(_0x555ce5);});});};}function createEndUser(_0x53603d,_0x7b1d10,_0x56af21,_0x2fcb67){return new Promise(function(_0x24c984,_0x5c6d89){var _0x492a84=moment();var _0x568381={'method':_0xa4f2('0x2d'),'uri':_0x2fcb67+'/api/contacts','body':{'contact':{'last_name':_0x53603d[_0xa4f2('0x28')],'work_number':_0x53603d['contactNumber'],'mobile_number':_0x53603d['contactNumber'],'owner_id':_0x53603d[_0xa4f2('0x22')],'created_at':_0x492a84['format'](_0xa4f2('0x2e'))}},'json':!![]};_0x568381['headers']=_0x56af21;logger['info'](_0xa4f2('0x2f'));return rp(_0x568381)[_0xa4f2('0x11')](function(_0x766898){_0x53603d[_0xa4f2('0x29')]=_0x766898[_0xa4f2('0x30')]['id'];_0x24c984(_0x53603d);})[_0xa4f2('0x23')](function(_0x6c50bf){logger['error']('['+[_0x7b1d10[_0xa4f2('0x19')]()]+']',_0x6c50bf[_0xa4f2('0x1a')]);_0x5c6d89(_0x6c50bf[_0xa4f2('0x1a')]);});});}function getTicket(_0x4b87d8,_0x49963a,_0x9cfe73,_0x423ade,_0x474565){return function(_0x1b3a0d){logger[_0xa4f2('0xf')](_0xa4f2('0x31'));return new Promise(function(_0x891cd5,_0x396de0){var _0x551abe=moment();var _0x15cafb={'method':_0xa4f2('0x2d'),'uri':_0x9cfe73+_0xa4f2('0x32'),'body':{'title':intUtil['getString'](_0x423ade[_0xa4f2('0x33')],_0x474565,'\x20'),'description':intUtil[_0xa4f2('0x34')](_0x423ade['Descriptions'],_0x474565,'\x0a'),'owner_id':_0x1b3a0d[_0xa4f2('0x22')],'creater_id':_0x1b3a0d[_0xa4f2('0x15')],'targetable_id':_0x1b3a0d[_0xa4f2('0x29')],'targetable_type':_0xa4f2('0x35'),'created_at':_0x551abe[_0xa4f2('0x26')](_0xa4f2('0x2e')),'due_date':_0x551abe[_0xa4f2('0x36')](0x1e,'m')[_0xa4f2('0x26')](_0xa4f2('0x2e'))},'json':!![]};_0x15cafb[_0xa4f2('0xe')]=_0x49963a;return rp(_0x15cafb)[_0xa4f2('0x11')](function(_0x1dc771){_0x1b3a0d[_0xa4f2('0x37')]=_0x1dc771[_0xa4f2('0x38')]['id'];logger[_0xa4f2('0xf')](_0xa4f2('0x39'),_0x1b3a0d[_0xa4f2('0x37')]);_0x891cd5(_0x1b3a0d);})[_0xa4f2('0x23')](function(_0x2d379a){logger[_0xa4f2('0x18')]('['+[_0x4b87d8['toUpperCase']()]+']',_0x2d379a[_0xa4f2('0x1a')]);_0x396de0(_0x2d379a[_0xa4f2('0x1a')]);});});};}function emit(_0x283350,_0x42a17a,_0x5f5d84){var _0x6f0edd={'uri':_0x283350+_0xa4f2('0x3a')+_0x5f5d84};io['to'](util[_0xa4f2('0x26')]('user:%s',_0x42a17a))['emit'](_0xa4f2('0x3b'),_0x6f0edd);}exports['cs']=function(_0x4052c4,_0x32ae2c,_0x493035,_0x22ed37,_0x404e02,_0x105834,_0x4665d4,_0x2f578f){var _0x3cf3be={};var _0x2197d4={'Authorization':_0xa4f2('0x3c')+_0x105834[_0xa4f2('0x3d')]};_0x105834[_0xa4f2('0x3e')]=intUtil[_0xa4f2('0x3f')](_0x105834['remoteUri']);_0x105834[_0xa4f2('0x40')]=intUtil[_0xa4f2('0x3f')](_0x105834[_0xa4f2('0x40')]);var _0x455d92=_0x105834[_0xa4f2('0x3e')];_0x3cf3be[_0xa4f2('0x21')]=_0x105834[_0xa4f2('0x41')];_0x3cf3be['contactNumber']=_0x2f578f[_0xa4f2('0x42')]()===_0xa4f2('0x43')?_0x32ae2c[_0xa4f2('0x44')]:_0x32ae2c[_0xa4f2('0x45')];_0x3cf3be[_0xa4f2('0x46')]=_0x2f578f===_0xa4f2('0x47')||_0x2f578f==='unmanaged'?'queue':'outbound';if(_0x22ed37){_0x3cf3be[_0xa4f2('0x1e')]=_0x22ed37['email'];}var _0x1d2c5b=util[_0xa4f2('0x26')](_0xa4f2('0x48'),_0x105834['serverUrl'],_0x32ae2c[_0xa4f2('0x49')],md5(_0x32ae2c[_0xa4f2('0x49')]));if(_0x404e02&&_0x404e02['monitor_format']){logger['info'](_0xa4f2('0x4a'),_0xa4f2('0x4b'));_0x32ae2c['recordingURL']=_0x1d2c5b;}else if(_0x4665d4&&_0x4665d4[_0xa4f2('0x4c')]&&_0x4665d4['recordingFormat']!=='none'){logger[_0xa4f2('0xf')](_0xa4f2('0x4d'),_0xa4f2('0x4b'));_0x32ae2c[_0xa4f2('0x4e')]=_0x1d2c5b;}else{_0x32ae2c['recordingURL']='';}return getAdminId(_0x3cf3be,_0x2f578f,_0x2197d4,_0x455d92)[_0xa4f2('0x11')](getUser(_0x2f578f,_0x2197d4,_0x455d92))[_0xa4f2('0x11')](getEndUser(_0x2f578f,_0x2197d4,_0x455d92))[_0xa4f2('0x11')](getTicket(_0x2f578f,_0x2197d4,_0x455d92,_0x493035,_0x32ae2c))[_0xa4f2('0x11')](function(_0x5f4067){logger['info'](util['format'](_0xa4f2('0x4f'),_0x5f4067[_0xa4f2('0x37')]));if(_0x2f578f!=='unmanaged'){logger['info']('['+[_0x2f578f[_0xa4f2('0x19')]()]+']',_0xa4f2('0x50'));emit(_0x455d92,_0x22ed37[_0xa4f2('0x51')],_0x5f4067[_0xa4f2('0x29')]);}})['catch'](function(_0x3d01f4){logger[_0xa4f2('0x18')]('['+[_0x2f578f['toUpperCase']()]+_0xa4f2('0x52'),util[_0xa4f2('0x53')](_0x3d01f4,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x4f3e=['GET','/api/selector/owners','info','Getting\x20admin\x20information','then','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','toUpperCase','message','headers','users','agentEmail','Getting\x20user\x20with\x20email','userEmail','userId','User\x20found:','Admin\x20selected','catch','error','&f=','&entities=contact','find','contacts','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','endUserId','Contact\x20found\x20mobile_number:','Contact\x20found\x20work_number:','Contact\x20created:','POST','format','YYYY-MM-DDTHH:mm:ss','contact','Creating\x20new\x20task','getString','Subjects','ticketId','task','Task\x20created:','/contacts/','user:%s','trigger:browser:url','Token\x20token=','remoteUri','stripTrailingSlash','username','toLowerCase','outbound','callDirection','queue','email','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','[OUTBOUND]','recordingURL','The\x20ticket\x20ID\x20is:\x20%s','unmanaged','Displaying\x20task\x20in\x20a\x20new\x20tab...','name','inspect','lodash','request-promise','md5','util','ioredis','../../../../config/environment','freshsales','redis','defaults'];(function(_0x34c553,_0x3e7dfc){var _0x1357d2=function(_0x3b509f){while(--_0x3b509f){_0x34c553['push'](_0x34c553['shift']());}};_0x1357d2(++_0x3e7dfc);}(_0x4f3e,0x178));var _0xe4f3=function(_0x2ab314,_0x23bab5){_0x2ab314=_0x2ab314-0x0;var _0x42fb63=_0x4f3e[_0x2ab314];return _0x42fb63;};'use strict';var _=require(_0xe4f3('0x0'));var rp=require(_0xe4f3('0x1'));var md5=require(_0xe4f3('0x2'));var util=require(_0xe4f3('0x3'));var moment=require('moment');var Promise=require('bluebird');var Redis=require(_0xe4f3('0x4'));var intUtil=require('./util');var config=require(_0xe4f3('0x5'));var logger=require('../../../../config/logger')(_0xe4f3('0x6'));config[_0xe4f3('0x7')]=_[_0xe4f3('0x8')](config[_0xe4f3('0x7')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xe4f3('0x7')]));function getAdminId(_0x4b58cc,_0x5cc1f0,_0x3d7e01,_0x669840){return new Promise(function(_0xddc84d,_0x450aa0){var _0x443b96=![];var _0x5d11c2={'method':_0xe4f3('0x9'),'uri':_0x669840+_0xe4f3('0xa'),'json':!![]};_0x5d11c2['headers']=_0x3d7e01;logger[_0xe4f3('0xb')](_0xe4f3('0xc'));return rp(_0x5d11c2)[_0xe4f3('0xd')](function(_0x3b8e5a){if(_0x3b8e5a){var _0x5a1f16=_0x3b8e5a['users'];var _0x199500=null;for(_0x199500=0x0;_0x199500<_0x5a1f16['length'];_0x199500++){if(_0x5a1f16[_0x199500]['email']===_0x4b58cc[_0xe4f3('0xe')]){_0x4b58cc[_0xe4f3('0xf')]=_0x5a1f16[_0x199500]['id'];_0x443b96=!![];}}if(_0x443b96){logger['info'](_0xe4f3('0x10'),_0x4b58cc[_0xe4f3('0xf')]);_0xddc84d(_0x4b58cc);}else{_0x450aa0({'statusCode':0x194,'message':_0xe4f3('0x11')});}}else{_0x450aa0({'statusCode':0x194,'message':_0xe4f3('0x11')});}})['catch'](function(_0x2afc36){logger['error']('['+[_0x5cc1f0[_0xe4f3('0x12')]()]+']',_0x2afc36[_0xe4f3('0x13')]);_0x450aa0(_0x2afc36);});});}function getUser(_0x13371f,_0x1d36ff,_0x39a461){return function(_0x35c9f7){return new Promise(function(_0xc61760,_0x379c76){var _0x23b4e4={'method':'GET','uri':_0x39a461+_0xe4f3('0xa'),'json':!![]};_0x23b4e4[_0xe4f3('0x14')]=_0x1d36ff;logger[_0xe4f3('0xb')]('Getting\x20user\x20list');return rp(_0x23b4e4)[_0xe4f3('0xd')](function(_0x5ac09a){if(_0x5ac09a){var _0x4d8949=_0x5ac09a[_0xe4f3('0x15')];var _0x41bd47=![];var _0x4b75a8=null;if(_0x35c9f7[_0xe4f3('0x16')]!==null){logger[_0xe4f3('0xb')](_0xe4f3('0x17'),_0x35c9f7['agentEmail']);_0x35c9f7[_0xe4f3('0x18')]=_0x35c9f7['agentEmail'];for(_0x4b75a8=0x0;_0x4b75a8<_0x4d8949['length'];_0x4b75a8++){if(_0x4d8949[_0x4b75a8]['email']===_0x35c9f7['agentEmail']){_0x41bd47=!![];_0x35c9f7[_0xe4f3('0x19')]=_0x4d8949[_0x4b75a8]['id'];logger[_0xe4f3('0xb')](_0xe4f3('0x1a'),_0x35c9f7[_0xe4f3('0x19')]);}}}if(!_0x41bd47){logger[_0xe4f3('0xb')](_0xe4f3('0x1b'));_0x35c9f7[_0xe4f3('0x18')]=_0x35c9f7[_0xe4f3('0xe')];_0x35c9f7[_0xe4f3('0x19')]=_0x35c9f7[_0xe4f3('0xf')];_0x41bd47=!![];}if(_0x41bd47){_0xc61760(_0x35c9f7);}else{_0x379c76({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x379c76({'statusCode':0x194,'message':_0xe4f3('0x11')});}})[_0xe4f3('0x1c')](function(_0x1faf66){logger[_0xe4f3('0x1d')]('['+[_0x13371f[_0xe4f3('0x12')]()]+']',_0x1faf66[_0xe4f3('0x13')]);_0x379c76(_0x1faf66);});});};}function searchContact(_0x35db89,_0xde49ca,_0x1c509c,_0x593407){return new Promise(function(_0x4eb885,_0xb6d45e){var _0x56e2ee={'method':_0xe4f3('0x9'),'headers':_0xde49ca,'uri':_0x35db89+'/api/lookup?q='+_0x593407+_0xe4f3('0x1e')+_0x1c509c+_0xe4f3('0x1f'),'json':!![]};rp(_0x56e2ee)[_0xe4f3('0xd')](function(_0x4767c5){var _0x1c80e7=_[_0xe4f3('0x20')](_0x4767c5[_0xe4f3('0x21')][_0xe4f3('0x21')],[_0x1c509c,_0x593407]);_0x4eb885(_0x1c80e7);})[_0xe4f3('0x1c')](function(_0xddda20){_0xb6d45e(_0xddda20);});});}function getEndUser(_0x13c97f,_0x1faddb,_0x1e0f54){return function(_0x5cc0c0){return new Promise(function(_0x3c1b73,_0x3eb222){logger[_0xe4f3('0xb')](util['format'](_0xe4f3('0x22'),_0x5cc0c0[_0xe4f3('0x23')]));searchContact(_0x1e0f54,_0x1faddb,_0xe4f3('0x24'),_0x5cc0c0[_0xe4f3('0x23')])[_0xe4f3('0xd')](function(_0xe7fa1b){if(_0xe7fa1b){_0x5cc0c0[_0xe4f3('0x25')]=_0xe7fa1b['id'];logger['info'](_0xe4f3('0x26'),_0x5cc0c0[_0xe4f3('0x25')]);return _0x3c1b73(_0x5cc0c0);}searchContact(_0x1e0f54,_0x1faddb,'work_number',_0x5cc0c0[_0xe4f3('0x23')])[_0xe4f3('0xd')](function(_0x323a26){if(_0x323a26){_0x5cc0c0[_0xe4f3('0x25')]=_0x323a26['id'];logger['info'](_0xe4f3('0x27'),_0x5cc0c0[_0xe4f3('0x25')]);return _0x3c1b73(_0x5cc0c0);}createEndUser(_0x5cc0c0,_0x13c97f,_0x1faddb,_0x1e0f54)['then'](function(_0x192f71){logger[_0xe4f3('0xb')](_0xe4f3('0x28'),_0x192f71['endUserId']);return _0x3c1b73(_0x192f71);});});})[_0xe4f3('0x1c')](function(_0x49f7ba){_0x3eb222(_0x49f7ba);});});};}function createEndUser(_0x17d593,_0x552588,_0x19a05b,_0x5b4233){return new Promise(function(_0x2bbac5,_0x3a50fb){var _0x1a67f5=moment();var _0x434b99={'method':_0xe4f3('0x29'),'uri':_0x5b4233+'/api/contacts','body':{'contact':{'last_name':_0x17d593[_0xe4f3('0x23')],'work_number':_0x17d593[_0xe4f3('0x23')],'mobile_number':_0x17d593[_0xe4f3('0x23')],'owner_id':_0x17d593[_0xe4f3('0x19')],'created_at':_0x1a67f5[_0xe4f3('0x2a')](_0xe4f3('0x2b'))}},'json':!![]};_0x434b99['headers']=_0x19a05b;logger[_0xe4f3('0xb')]('Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact');return rp(_0x434b99)[_0xe4f3('0xd')](function(_0xd28f74){_0x17d593['endUserId']=_0xd28f74[_0xe4f3('0x2c')]['id'];_0x2bbac5(_0x17d593);})[_0xe4f3('0x1c')](function(_0x2eb0e0){logger[_0xe4f3('0x1d')]('['+[_0x552588[_0xe4f3('0x12')]()]+']',_0x2eb0e0['message']);_0x3a50fb(_0x2eb0e0[_0xe4f3('0x13')]);});});}function getTicket(_0x18150b,_0x4c5dc8,_0x31529d,_0x70f6bf,_0x5984d4){return function(_0x43a4d8){logger['info'](_0xe4f3('0x2d'));return new Promise(function(_0x8bc62e,_0x4221a0){var _0x4b6a47=moment();var _0x41654c={'method':_0xe4f3('0x29'),'uri':_0x31529d+'/api/tasks','body':{'title':intUtil[_0xe4f3('0x2e')](_0x70f6bf[_0xe4f3('0x2f')],_0x5984d4,'\x20'),'description':intUtil[_0xe4f3('0x2e')](_0x70f6bf['Descriptions'],_0x5984d4,'\x0a'),'owner_id':_0x43a4d8[_0xe4f3('0x19')],'creater_id':_0x43a4d8[_0xe4f3('0xf')],'targetable_id':_0x43a4d8[_0xe4f3('0x25')],'targetable_type':'Contact','created_at':_0x4b6a47[_0xe4f3('0x2a')](_0xe4f3('0x2b')),'due_date':_0x4b6a47['add'](0x1e,'m')[_0xe4f3('0x2a')](_0xe4f3('0x2b'))},'json':!![]};_0x41654c[_0xe4f3('0x14')]=_0x4c5dc8;return rp(_0x41654c)[_0xe4f3('0xd')](function(_0x203681){_0x43a4d8[_0xe4f3('0x30')]=_0x203681[_0xe4f3('0x31')]['id'];logger[_0xe4f3('0xb')](_0xe4f3('0x32'),_0x43a4d8[_0xe4f3('0x30')]);_0x8bc62e(_0x43a4d8);})[_0xe4f3('0x1c')](function(_0x15472b){logger['error']('['+[_0x18150b[_0xe4f3('0x12')]()]+']',_0x15472b[_0xe4f3('0x13')]);_0x4221a0(_0x15472b[_0xe4f3('0x13')]);});});};}function emit(_0x423d09,_0x2114c7,_0x551775){var _0x243aa1={'uri':_0x423d09+_0xe4f3('0x33')+_0x551775};io['to'](util['format'](_0xe4f3('0x34'),_0x2114c7))['emit'](_0xe4f3('0x35'),_0x243aa1);}exports['cs']=function(_0x15940d,_0x529268,_0x23df1b,_0x7c230d,_0x45419e,_0x38f984,_0x52d3df,_0x876a59){var _0x4320c4={};var _0x596cc3={'Authorization':_0xe4f3('0x36')+_0x38f984['apiKey']};_0x38f984[_0xe4f3('0x37')]=intUtil[_0xe4f3('0x38')](_0x38f984[_0xe4f3('0x37')]);_0x38f984['serverUrl']=intUtil['stripTrailingSlash'](_0x38f984['serverUrl']);var _0x19da79=_0x38f984[_0xe4f3('0x37')];_0x4320c4[_0xe4f3('0xe')]=_0x38f984[_0xe4f3('0x39')];_0x4320c4[_0xe4f3('0x23')]=_0x876a59[_0xe4f3('0x3a')]()===_0xe4f3('0x3b')?_0x529268['destcalleridnum']:_0x529268['calleridnum'];_0x4320c4[_0xe4f3('0x3c')]=_0x876a59===_0xe4f3('0x3d')||_0x876a59==='unmanaged'?_0xe4f3('0x3d'):_0xe4f3('0x3b');if(_0x7c230d){_0x4320c4[_0xe4f3('0x16')]=_0x7c230d[_0xe4f3('0x3e')];}var _0x3fb100=util['format'](_0xe4f3('0x3f'),_0x38f984[_0xe4f3('0x40')],_0x529268[_0xe4f3('0x41')],md5(_0x529268[_0xe4f3('0x41')]));if(_0x45419e&&_0x45419e[_0xe4f3('0x42')]){logger[_0xe4f3('0xb')](_0xe4f3('0x43'),_0xe4f3('0x44'));_0x529268['recordingURL']=_0x3fb100;}else if(_0x52d3df&&_0x52d3df[_0xe4f3('0x45')]&&_0x52d3df[_0xe4f3('0x45')]!=='none'){logger[_0xe4f3('0xb')](_0xe4f3('0x46'),_0xe4f3('0x44'));_0x529268[_0xe4f3('0x47')]=_0x3fb100;}else{_0x529268[_0xe4f3('0x47')]='';}return getAdminId(_0x4320c4,_0x876a59,_0x596cc3,_0x19da79)[_0xe4f3('0xd')](getUser(_0x876a59,_0x596cc3,_0x19da79))[_0xe4f3('0xd')](getEndUser(_0x876a59,_0x596cc3,_0x19da79))['then'](getTicket(_0x876a59,_0x596cc3,_0x19da79,_0x23df1b,_0x529268))[_0xe4f3('0xd')](function(_0x50328d){logger[_0xe4f3('0xb')](util[_0xe4f3('0x2a')](_0xe4f3('0x48'),_0x50328d[_0xe4f3('0x30')]));if(_0x876a59!==_0xe4f3('0x49')){logger[_0xe4f3('0xb')]('['+[_0x876a59[_0xe4f3('0x12')]()]+']',_0xe4f3('0x4a'));emit(_0x19da79,_0x7c230d[_0xe4f3('0x4b')],_0x50328d['endUserId']);}})[_0xe4f3('0x1c')](function(_0x4c6067){logger['error']('['+[_0x876a59[_0xe4f3('0x12')]()]+']\x20Error\x20running\x20Freshsales\x20integration',util[_0xe4f3('0x4c')](_0x4c6067,{'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 bf70e03..2a5ac8d 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 _0x8405=['freshsales','exec','includes','data1','toLowerCase','find','Configurations','data3','queue','outbound','log','unmanaged','desk','servicenow','unknown\x20integration','../../../../config/logger','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','%s\x20account\x20#%s\x20not\x20found','data2','error','lodash','util','./zendesk','./sugarcrm','./freshdesk','./desk','./vtiger','./servicenow','./freshsales','zendesk','salesforce','sugarcrm','zoho','vtiger','dynamics365'];(function(_0x1d5320,_0x4597af){var _0x82303b=function(_0x4e9b28){while(--_0x4e9b28){_0x1d5320['push'](_0x1d5320['shift']());}};_0x82303b(++_0x4597af);}(_0x8405,0x85));var _0x5840=function(_0x2d1705,_0x4b9834){_0x2d1705=_0x2d1705-0x0;var _0x24e7bf=_0x8405[_0x2d1705];return _0x24e7bf;};'use strict';var _=require(_0x5840('0x0'));var util=require(_0x5840('0x1'));var zendesk=require(_0x5840('0x2'));var salesforce=require('./salesforce');var sugarcrm=require(_0x5840('0x3'));var freshdesk=require(_0x5840('0x4'));var zoho=require('./zoho');var desk=require(_0x5840('0x5'));var vtiger=require(_0x5840('0x6'));var servicenow=require(_0x5840('0x7'));var dynamics365=require('./dynamics365');var freshsales=require(_0x5840('0x8'));var integrations=[_0x5840('0x9'),_0x5840('0xa'),_0x5840('0xb'),'freshdesk',_0x5840('0xc'),'desk',_0x5840('0xd'),_0x5840('0xe'),_0x5840('0xf'),'servicenow'];exports[_0x5840('0x10')]=function(_0x3b6e43,_0x2a0ed2,_0x316017,_0x4aac2,_0x4c52d1,_0x19027a){if(_0x316017){if(_[_0x5840('0x11')](integrations,_0x3b6e43[_0x5840('0x12')][_0x5840('0x13')]())){try{var _0x37ec6c=null;var _0x21a527='';var _0x2a7f39=_0x316017[_0x3b6e43['data1']['toLowerCase']()];if(_0x2a7f39){var _0x46f737=_0x2a7f39[_0x3b6e43['data2']];if(_0x46f737){var _0x229565=_[_0x5840('0x14')](_0x46f737[_0x5840('0x15')],{'id':parseInt(_0x3b6e43[_0x5840('0x16')],0xa)});if(_0x229565){if(_0x4aac2){if(_0x4c52d1&&_0x2a0ed2[_0x5840('0x17')]){_0x21a527=_0x5840('0x17');}else if(_0x2a0ed2['routeId']){_0x21a527=_0x5840('0x18');}else{console[_0x5840('0x19')]('EVENT\x20UNKNOWN',_0x2a0ed2);}}else{_0x21a527=_0x5840('0x1a');}switch(_0x3b6e43[_0x5840('0x12')][_0x5840('0x13')]()){case'zendesk':zendesk[_0x21a527](_0x3b6e43,_0x2a0ed2,_0x229565,_0x4aac2,_0x4c52d1,_0x46f737,_0x19027a);break;case _0x5840('0xa'):salesforce[_0x21a527](_0x3b6e43,_0x2a0ed2,_0x229565,_0x4aac2,_0x4c52d1,_0x46f737,_0x19027a);break;case'sugarcrm':sugarcrm[_0x21a527](_0x3b6e43,_0x2a0ed2,_0x229565,_0x4aac2,_0x4c52d1,_0x46f737,_0x19027a);break;case'freshdesk':freshdesk[_0x21a527](_0x3b6e43,_0x2a0ed2,_0x229565,_0x4aac2,_0x4c52d1,_0x46f737,_0x19027a);break;case _0x5840('0xc'):zoho[_0x21a527](_0x3b6e43,_0x2a0ed2,_0x229565,_0x4aac2,_0x4c52d1,_0x46f737,_0x19027a);break;case _0x5840('0x1b'):desk[_0x21a527](_0x3b6e43,_0x2a0ed2,_0x229565,_0x4aac2,_0x4c52d1,_0x46f737,_0x19027a);break;case _0x5840('0xd'):vtiger[_0x21a527](_0x3b6e43,_0x2a0ed2,_0x229565,_0x4aac2,_0x4c52d1,_0x46f737,_0x19027a);break;case _0x5840('0xf'):freshsales['cs'](_0x3b6e43,_0x2a0ed2,_0x229565,_0x4aac2,_0x4c52d1,_0x46f737,_0x19027a,_0x21a527);break;case _0x5840('0x1c'):servicenow['cs'](_0x3b6e43,_0x2a0ed2,_0x229565,_0x4aac2,_0x4c52d1,_0x46f737,_0x19027a,_0x21a527);break;case'dynamics365':dynamics365['cs'](_0x3b6e43,_0x2a0ed2,_0x229565,_0x4aac2,_0x4c52d1,_0x46f737,_0x19027a,_0x21a527);break;default:console[_0x5840('0x19')](_0x5840('0x1d'));}}else{_0x37ec6c=require(_0x5840('0x1e'))(_0x3b6e43['data1'][_0x5840('0x13')]());_0x37ec6c['error'](_0x5840('0x1f'),util[_0x5840('0x20')](_0x5840('0x21'),_0x3b6e43[_0x5840('0x12')][_0x5840('0x13')](),_0x3b6e43[_0x5840('0x16')]));}}else{_0x37ec6c=require(_0x5840('0x1e'))(_0x3b6e43['data1']['toLowerCase']());_0x37ec6c['error'](_0x5840('0x1f'),util[_0x5840('0x20')](_0x5840('0x22'),_0x3b6e43[_0x5840('0x12')][_0x5840('0x13')](),_0x3b6e43[_0x5840('0x23')]));}}else{}}catch(_0x523f40){console[_0x5840('0x24')](_0x523f40);}}}}; \ No newline at end of file +var _0x7b03=['./freshdesk','./zoho','./desk','./vtiger','./servicenow','./dynamics365','./freshsales','zendesk','salesforce','freshdesk','zoho','freshsales','servicenow','exec','includes','data1','toLowerCase','data2','Configurations','data3','queue','outbound','log','EVENT\x20UNKNOWN','unmanaged','desk','../../../../config/logger','[EXEC]','format','error','lodash','util','./zendesk','./salesforce'];(function(_0x2788bd,_0x13e518){var _0xd76641=function(_0x53338f){while(--_0x53338f){_0x2788bd['push'](_0x2788bd['shift']());}};_0xd76641(++_0x13e518);}(_0x7b03,0x150));var _0x37b0=function(_0x25d2fa,_0x1d35c6){_0x25d2fa=_0x25d2fa-0x0;var _0x42d4aa=_0x7b03[_0x25d2fa];return _0x42d4aa;};'use strict';var _=require(_0x37b0('0x0'));var util=require(_0x37b0('0x1'));var zendesk=require(_0x37b0('0x2'));var salesforce=require(_0x37b0('0x3'));var sugarcrm=require('./sugarcrm');var freshdesk=require(_0x37b0('0x4'));var zoho=require(_0x37b0('0x5'));var desk=require(_0x37b0('0x6'));var vtiger=require(_0x37b0('0x7'));var servicenow=require(_0x37b0('0x8'));var dynamics365=require(_0x37b0('0x9'));var freshsales=require(_0x37b0('0xa'));var integrations=[_0x37b0('0xb'),_0x37b0('0xc'),'sugarcrm',_0x37b0('0xd'),_0x37b0('0xe'),'desk','vtiger','dynamics365',_0x37b0('0xf'),_0x37b0('0x10')];exports[_0x37b0('0x11')]=function(_0x175833,_0x39dd6b,_0x110a58,_0x265841,_0x4d90d0,_0x336c9b){if(_0x110a58){if(_[_0x37b0('0x12')](integrations,_0x175833[_0x37b0('0x13')][_0x37b0('0x14')]())){try{var _0x5c1f36=null;var _0x5d93cf='';var _0x2b2f70=_0x110a58[_0x175833[_0x37b0('0x13')][_0x37b0('0x14')]()];if(_0x2b2f70){var _0x37ea34=_0x2b2f70[_0x175833[_0x37b0('0x15')]];if(_0x37ea34){var _0x14845c=_['find'](_0x37ea34[_0x37b0('0x16')],{'id':parseInt(_0x175833[_0x37b0('0x17')],0xa)});if(_0x14845c){if(_0x265841){if(_0x4d90d0&&_0x39dd6b[_0x37b0('0x18')]){_0x5d93cf=_0x37b0('0x18');}else if(_0x39dd6b['routeId']){_0x5d93cf=_0x37b0('0x19');}else{console[_0x37b0('0x1a')](_0x37b0('0x1b'),_0x39dd6b);}}else{_0x5d93cf=_0x37b0('0x1c');}switch(_0x175833['data1'][_0x37b0('0x14')]()){case _0x37b0('0xb'):zendesk[_0x5d93cf](_0x175833,_0x39dd6b,_0x14845c,_0x265841,_0x4d90d0,_0x37ea34,_0x336c9b);break;case _0x37b0('0xc'):salesforce[_0x5d93cf](_0x175833,_0x39dd6b,_0x14845c,_0x265841,_0x4d90d0,_0x37ea34,_0x336c9b);break;case'sugarcrm':sugarcrm[_0x5d93cf](_0x175833,_0x39dd6b,_0x14845c,_0x265841,_0x4d90d0,_0x37ea34,_0x336c9b);break;case _0x37b0('0xd'):freshdesk[_0x5d93cf](_0x175833,_0x39dd6b,_0x14845c,_0x265841,_0x4d90d0,_0x37ea34,_0x336c9b);break;case _0x37b0('0xe'):zoho[_0x5d93cf](_0x175833,_0x39dd6b,_0x14845c,_0x265841,_0x4d90d0,_0x37ea34,_0x336c9b);break;case _0x37b0('0x1d'):desk[_0x5d93cf](_0x175833,_0x39dd6b,_0x14845c,_0x265841,_0x4d90d0,_0x37ea34,_0x336c9b);break;case'vtiger':vtiger[_0x5d93cf](_0x175833,_0x39dd6b,_0x14845c,_0x265841,_0x4d90d0,_0x37ea34,_0x336c9b);break;case _0x37b0('0xf'):freshsales['cs'](_0x175833,_0x39dd6b,_0x14845c,_0x265841,_0x4d90d0,_0x37ea34,_0x336c9b,_0x5d93cf);break;case _0x37b0('0x10'):servicenow['cs'](_0x175833,_0x39dd6b,_0x14845c,_0x265841,_0x4d90d0,_0x37ea34,_0x336c9b,_0x5d93cf);break;case'dynamics365':dynamics365['cs'](_0x175833,_0x39dd6b,_0x14845c,_0x265841,_0x4d90d0,_0x37ea34,_0x336c9b,_0x5d93cf);break;default:console[_0x37b0('0x1a')]('unknown\x20integration');}}else{_0x5c1f36=require(_0x37b0('0x1e'))(_0x175833[_0x37b0('0x13')][_0x37b0('0x14')]());_0x5c1f36['error'](_0x37b0('0x1f'),util[_0x37b0('0x20')]('%s\x20configuration\x20#%s\x20not\x20found',_0x175833['data1']['toLowerCase'](),_0x175833[_0x37b0('0x17')]));}}else{_0x5c1f36=require('../../../../config/logger')(_0x175833[_0x37b0('0x13')][_0x37b0('0x14')]());_0x5c1f36[_0x37b0('0x21')](_0x37b0('0x1f'),util[_0x37b0('0x20')]('%s\x20account\x20#%s\x20not\x20found',_0x175833[_0x37b0('0x13')][_0x37b0('0x14')](),_0x175833[_0x37b0('0x15')]));}}else{}}catch(_0xf52440){console[_0x37b0('0x21')](_0xf52440);}}}}; \ 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 bee83c8..e0755a0 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 _0xd20a=['instanceUrl','Salesforce\x20account\x20type\x20not\x20recognized','catch','unmanaged','toUpperCase','calleridnum','lastevent',']\x20Ticket\x20%s\x20created.','lodash','moment','bluebird','md5','ioredis','./util','../../../../config/environment','salesforce','redis','defaults','socket.io-emitter','emit','getString','ticketType','ActivityDate','IsReminderSet','IsRecurrence','endUserType','contact','lead','WhoId','account','WhatId','Case','ContactId','AccountId','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','isNil','find','execute','then','length','Agent\x20%s\x20found.','resolve','Name','user_id','display_name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','cloneDeep','additionalSearchContact','merge','$or','Contact','additionalSearchLead','Lead','account_contact_lead','additionalSearchAccount','Account','Phone','attributes','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','','format','Caller\x20-\x20%s','Company','No\x20Company','create','forEach','includes','string','picklist','type','idField','content','toString','variable','variableName','customVariable','Variable','name','toLowerCase','password','Connection','remoteUri','clientId','clientSecret','login','username','Connection\x20established.','queue','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridname','Fields','[QUEUE]\x20Ticket\x20%s\x20created','integrationTab','trigger:salesforce:display','newTab','user:%s','trigger:browser:url','%s/%s/e','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','recordingFormat','[OUTBOUND]','recordingURL','destcalleridname','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.'];(function(_0x377ff6,_0xf7fb77){var _0x2f6117=function(_0xa5ab68){while(--_0xa5ab68){_0x377ff6['push'](_0x377ff6['shift']());}};_0x2f6117(++_0xf7fb77);}(_0xd20a,0x17c));var _0xad20=function(_0x513878,_0x46db2d){_0x513878=_0x513878-0x0;var _0x239596=_0xd20a[_0x513878];return _0x239596;};'use strict';var _=require(_0xad20('0x0'));var rp=require('request-promise');var moment=require(_0xad20('0x1'));var BPromise=require(_0xad20('0x2'));var md5=require(_0xad20('0x3'));var jsforce=require('jsforce');var util=require('util');var Redis=require(_0xad20('0x4'));var intUtil=require(_0xad20('0x5'));var config=require(_0xad20('0x6'));var logger=require('../../../../config/logger')(_0xad20('0x7'));config[_0xad20('0x8')]=_[_0xad20('0x9')](config[_0xad20('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0xad20('0xa'))(new Redis(config[_0xad20('0x8')]));function emit(_0x56b9b0,_0x4c059f,_0x20bffb){io['to'](_0x56b9b0)[_0xad20('0xb')](_0x4c059f,_0x20bffb);}function getTicket(_0x362515,_0xf2f100,_0x149de0,_0x41cff4,_0x22cc2c,_0x49fd61,_0x210c89,_0x1bae13){var _0x3bb122=Object['assign']({},{'OwnerId':_0xf2f100['id'],'Subject':intUtil[_0xad20('0xc')](_0x41cff4['Subjects'],_0x22cc2c,'\x20'),'Description':intUtil[_0xad20('0xc')](_0x41cff4['Descriptions'],_0x22cc2c,'\x0a')},getCustomFields(_0x49fd61,_0x22cc2c));if(_0x149de0){if(_0x41cff4[_0xad20('0xd')]==='Task'){_0x3bb122[_0xad20('0xe')]=moment['utc']();_0x3bb122[_0xad20('0xf')]=![];_0x3bb122[_0xad20('0x10')]=![];if(_0x149de0[_0xad20('0x11')]===_0xad20('0x12')||_0x149de0[_0xad20('0x11')]===_0xad20('0x13')){_0x3bb122[_0xad20('0x14')]=_0x149de0['id'];}else if(_0x149de0[_0xad20('0x11')]===_0xad20('0x15')){_0x3bb122[_0xad20('0x16')]=_0x149de0['id'];}}else if(_0x41cff4['ticketType']===_0xad20('0x17')){if(_0x149de0[_0xad20('0x11')]==='contact'){_0x3bb122[_0xad20('0x18')]=_0x149de0['id'];}else if(_0x149de0[_0xad20('0x11')]===_0xad20('0x15')){_0x3bb122[_0xad20('0x19')]=_0x149de0['id'];}else if(_0x149de0['endUserType']===_0xad20('0x13')&&_0x41cff4[_0xad20('0x1a')]){_0x3bb122[_0x41cff4['leadId']]=_0x149de0['id'];}else{logger[_0xad20('0x1b')](_0xad20('0x1c'));}}}return _0x210c89[_0xad20('0x1d')](_0x41cff4[_0xad20('0xd')])['create'](_0x3bb122);}function getUser(_0x54f7e5,_0x2f2421,_0x813602){if(!_[_0xad20('0x1e')](_0x2f2421)&&intUtil['validateEmail'](_0x2f2421)){var _0x4557c9={'Email':_0x2f2421};var _0x246f81={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x813602[_0xad20('0x1d')]('User')[_0xad20('0x1f')](_0x4557c9,_0x246f81)[_0xad20('0x20')]()[_0xad20('0x21')](function(_0x11edc6){if(_0x11edc6[_0xad20('0x22')]){var _0xc208f=_[_0xad20('0x1f')](_0x11edc6,function(_0x3cbb8f){return _0x3cbb8f['Email']===_0x2f2421;});if(_0xc208f){logger[_0xad20('0x1b')](_0xad20('0x23'),_0x2f2421);return BPromise[_0xad20('0x24')]({'id':_0xc208f['Id'],'name':_0xc208f[_0xad20('0x25')]});}}else{logger['info']('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x2f2421);return _0x813602['identity']()['then'](function(_0xf1b350){return BPromise[_0xad20('0x24')]({'id':_0xf1b350[_0xad20('0x26')],'name':_0xf1b350[_0xad20('0x27')]});});}});}else{logger[_0xad20('0x1b')](_0xad20('0x28'),_0x2f2421);return _0x813602[_0xad20('0x29')]()['then'](function(_0x17bf54){return BPromise[_0xad20('0x24')]({'id':_0x17bf54[_0xad20('0x26')],'name':_0x17bf54[_0xad20('0x27')]});});}}function getEndUser(_0x5d9ef6,_0x4dc9b5,_0x10a0ee,_0x5ab713,_0x278294){var _0x22ab64={'$or':{'Phone':_0x5ab713}};var _0x2540ef={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xad20('0x24')]()[_0xad20('0x21')](function(){logger[_0xad20('0x1b')](_0xad20('0x2a'),_0x5ab713,_0x4dc9b5['moduleSearch']);switch(_0x4dc9b5[_0xad20('0x2b')]){case'contact_lead':var _0x3d085b=_[_0xad20('0x2c')](_0x22ab64);if(_0x4dc9b5[_0xad20('0x2d')]){var _0x53d710={};_0x53d710[_0x4dc9b5[_0xad20('0x2d')]]=_0x5ab713;_[_0xad20('0x2e')](_0x3d085b[_0xad20('0x2f')],_0x53d710);}return _0x278294[_0xad20('0x1d')](_0xad20('0x30'))[_0xad20('0x1f')](_0x3d085b,_0x2540ef)['execute']()['then'](function(_0x14983c){if(_0x14983c&&_0x14983c[_0xad20('0x22')]){return _0x14983c;}else{var _0x193385=_[_0xad20('0x2c')](_0x22ab64);if(_0x4dc9b5[_0xad20('0x31')]){var _0x4c856a={};_0x4c856a[_0x4dc9b5[_0xad20('0x31')]]=_0x5ab713;_[_0xad20('0x2e')](_0x193385[_0xad20('0x2f')],_0x4c856a);}return _0x278294[_0xad20('0x1d')](_0xad20('0x32'))[_0xad20('0x1f')](_0x193385,_0x2540ef);}});case _0xad20('0x33'):var _0x2590ae=_[_0xad20('0x2c')](_0x22ab64);if(_0x4dc9b5[_0xad20('0x34')]){var _0x53d710={};_0x53d710[_0x4dc9b5[_0xad20('0x34')]]=_0x5ab713;_[_0xad20('0x2e')](_0x2590ae['$or'],_0x53d710);}return _0x278294[_0xad20('0x1d')](_0xad20('0x35'))[_0xad20('0x1f')](_0x2590ae,_0x2540ef)[_0xad20('0x20')]()['then'](function(_0x3e8626){if(_0x3e8626&&_0x3e8626[_0xad20('0x22')]){return _0x3e8626;}else{var _0x53b629=_[_0xad20('0x2c')](_0x22ab64);if(_0x4dc9b5[_0xad20('0x2d')]){var _0x3f9606={};_0x3f9606[_0x4dc9b5['additionalSearchContact']]=_0x5ab713;_['merge'](_0x53b629['$or'],_0x3f9606);}return _0x278294[_0xad20('0x1d')](_0xad20('0x30'))[_0xad20('0x1f')](_0x53b629,_0x2540ef)[_0xad20('0x21')](function(_0x3b544b){if(_0x3b544b&&_0x3b544b['length']){return _0x3b544b;}else{var _0x388598=_[_0xad20('0x2c')](_0x22ab64);if(_0x4dc9b5[_0xad20('0x31')]){var _0x5ce735={};_0x5ce735[_0x4dc9b5[_0xad20('0x31')]]=_0x5ab713;_['merge'](_0x388598['$or'],_0x5ce735);}return _0x278294[_0xad20('0x1d')](_0xad20('0x32'))[_0xad20('0x1f')](_0x388598,_0x2540ef);}});}});case _0xad20('0x12'):var _0x3d085b=_[_0xad20('0x2c')](_0x22ab64);if(_0x4dc9b5[_0xad20('0x2d')]){var _0x53d710={};_0x53d710[_0x4dc9b5[_0xad20('0x2d')]]=_0x5ab713;_[_0xad20('0x2e')](_0x3d085b[_0xad20('0x2f')],_0x53d710);}return _0x278294[_0xad20('0x1d')]('Contact')['find'](_0x3d085b,_0x2540ef)[_0xad20('0x20')]();case'lead':var _0x4e5e52=_[_0xad20('0x2c')](_0x22ab64);if(_0x4dc9b5[_0xad20('0x31')]){var _0x53d710={};_0x53d710[_0x4dc9b5[_0xad20('0x31')]]=_0x5ab713;_[_0xad20('0x2e')](_0x4e5e52[_0xad20('0x2f')],_0x53d710);}return _0x278294['sobject'](_0xad20('0x32'))['find'](_0x4e5e52,_0x2540ef);case _0xad20('0x15'):var _0x2590ae=_['cloneDeep'](_0x22ab64);if(_0x4dc9b5['additionalSearchAccount']){var _0x53d710={};_0x53d710[_0x4dc9b5['additionalSearchAccount']]=_0x5ab713;_[_0xad20('0x2e')](_0x2590ae[_0xad20('0x2f')],_0x53d710);}return _0x278294['sobject'](_0xad20('0x35'))[_0xad20('0x1f')](_0x2590ae,_0x2540ef);default:return null;}})[_0xad20('0x21')](function(_0x3b28c9){if(_0x3b28c9&&_0x3b28c9[_0xad20('0x22')]){var _0x344258=_['first'](_0x3b28c9);if(_0x344258){return BPromise[_0xad20('0x24')]({'id':_0x344258['Id'],'name':_0x344258[_0xad20('0x25')],'phone':_0x344258[_0xad20('0x36')],'endUserType':_0x344258[_0xad20('0x37')]['type']['toLowerCase']()});}}})[_0xad20('0x21')](function(_0xa7f3aa){if(_0xa7f3aa){logger[_0xad20('0x1b')](_0xad20('0x38'),_0xa7f3aa[_0xad20('0x11')],_0x5ab713);return BPromise[_0xad20('0x24')](_0xa7f3aa);}else{logger['info'](_0xad20('0x39'),_0x5ab713);var _0x2ed15c={'Phone':_0x5ab713};if(_0x4dc9b5[_0xad20('0x3a')]){if(_0x4dc9b5[_0xad20('0x3a')]==='contact'){logger['info'](_0xad20('0x3b'),_0x5ab713,_0x4dc9b5['moduleCreate']);_0x2ed15c[_0xad20('0x3c')]=_0x10a0ee!==_0xad20('0x3d')?_0x10a0ee:util[_0xad20('0x3e')](_0xad20('0x3f'),_0x5ab713);}else if(_0x4dc9b5[_0xad20('0x3a')]===_0xad20('0x13')){logger[_0xad20('0x1b')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x5ab713,_0x4dc9b5['moduleCreate']);_0x2ed15c[_0xad20('0x3c')]=_0x10a0ee!==_0xad20('0x3d')?_0x10a0ee:util[_0xad20('0x3e')](_0xad20('0x3f'),_0x5ab713);_0x2ed15c[_0xad20('0x40')]=_0xad20('0x41');}else if(_0x4dc9b5[_0xad20('0x3a')]===_0xad20('0x15')){logger[_0xad20('0x1b')](_0xad20('0x3b'),_0x5ab713,_0x4dc9b5['moduleCreate']);_0x2ed15c[_0xad20('0x25')]=_0x10a0ee!==''?_0x10a0ee:util[_0xad20('0x3e')](_0xad20('0x3f'),_0x5ab713);}else{return null;}}return _0x278294[_0xad20('0x1d')](_['upperFirst'](_0x4dc9b5[_0xad20('0x3a')]))[_0xad20('0x42')](_0x2ed15c)[_0xad20('0x21')](function(_0x30a3e5){return BPromise[_0xad20('0x24')]({'id':_0x30a3e5['id'],'endUserType':_0x4dc9b5['moduleCreate']});});}});}function getCustomFields(_0xf10cd2,_0x3a1751){var _0x22edf9={};if(_0xf10cd2[_0xad20('0x22')]>0x0){_[_0xad20('0x43')](_0xf10cd2,function(_0xe744b5){if(_[_0xad20('0x44')]([_0xad20('0x45'),_0xad20('0x46')],_0xe744b5[_0xad20('0x47')])&&_0xe744b5[_0xad20('0x48')]){_0x22edf9[_0xe744b5[_0xad20('0x48')]]=_0xe744b5[_0xad20('0x49')][_0xad20('0x4a')]();}else if(_0xe744b5['type']===_0xad20('0x4b')&&_0xe744b5[_0xad20('0x4c')]&&_0xe744b5[_0xad20('0x48')]){_0x3a1751[_0xe744b5[_0xad20('0x4c')]]&&(_0x22edf9[_0xe744b5[_0xad20('0x48')]]=_0x3a1751[_0xe744b5[_0xad20('0x4c')]]['toString']());}else if(_0xe744b5[_0xad20('0x47')]===_0xad20('0x4d')&&_0xe744b5['Variable']&&_0xe744b5[_0xad20('0x4e')][_0xad20('0x4f')]&&_0xe744b5['idField']){_0x3a1751[_0xe744b5['Variable'][_0xad20('0x4f')][_0xad20('0x50')]()]&&(_0x22edf9[_0xe744b5[_0xad20('0x48')]]=_0x3a1751[_0xe744b5[_0xad20('0x4e')][_0xad20('0x4f')][_0xad20('0x50')]()]['toString']());}});}return _0x22edf9;}function getConnection(_0x8b8fca){var _0x3b6cbd=_0x8b8fca[_0xad20('0x51')]['concat'](_0x8b8fca['securityToken']);var _0x16ec93=new jsforce[(_0xad20('0x52'))]({'oauth2':{'loginUrl':_0x8b8fca[_0xad20('0x53')]||'https://login.salesforce.com','clientId':_0x8b8fca[_0xad20('0x54')],'clientSecret':_0x8b8fca[_0xad20('0x55')]}});return _0x16ec93[_0xad20('0x56')](_0x8b8fca[_0xad20('0x57')],_0x3b6cbd)['then'](function(){logger[_0xad20('0x1b')](_0xad20('0x58'));return _0x16ec93;});}exports[_0xad20('0x59')]=function(_0x57afc8,_0xcd9436,_0x4bc929,_0x1b1991,_0x5c13d0,_0x2ab305){var _0xa2d93a,_0x3c0922,_0x1d4a5f,_0x2c4aeb;_0x2ab305[_0xad20('0x5a')]=intUtil[_0xad20('0x5b')](_0x2ab305['serverUrl']);_0x2ab305[_0xad20('0x53')]=intUtil['stripTrailingSlash'](_0x2ab305[_0xad20('0x53')]);if(_0x5c13d0&&_0x5c13d0[_0xad20('0x5c')]){logger[_0xad20('0x1b')](_0xad20('0x5d'),_0xad20('0x5e'));_0xcd9436['recordingURL']=util[_0xad20('0x3e')](_0xad20('0x5f'),_0x2ab305[_0xad20('0x5a')],_0xcd9436[_0xad20('0x60')],md5(_0xcd9436[_0xad20('0x60')]));}else{_0xcd9436['recordingURL']='';}return getConnection(_0x2ab305)[_0xad20('0x21')](function(_0x22c1b0){_0x2c4aeb=_0x22c1b0;return getUser(_0x2ab305,_0x1b1991[_0xad20('0x61')],_0x2c4aeb);})[_0xad20('0x21')](function(_0x3c232f){_0xa2d93a=_0x3c232f;return getEndUser(_0x2ab305,_0x4bc929,_0xcd9436[_0xad20('0x62')],_0xcd9436['calleridnum'],_0x2c4aeb);})[_0xad20('0x21')](function(_0x1137cc){_0x3c0922=_0x1137cc;return getTicket(_0x2ab305,_0xa2d93a,_0x3c0922,_0x4bc929,_0xcd9436,_0x4bc929[_0xad20('0x63')],_0x2c4aeb,'queue');})[_0xad20('0x21')](function(_0x17d9ee){_0x1d4a5f=_0x17d9ee;logger[_0xad20('0x1b')](_0xad20('0x64'),_0x1d4a5f['id']);logger[_0xad20('0x1b')]('[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x1d4a5f['id'],_0x1b1991[_0xad20('0x4f')],_0x2ab305[_0xad20('0x47')]);switch(_0x2ab305['type']){case _0xad20('0x65'):emit(util[_0xad20('0x3e')]('user:%s',_0x1b1991[_0xad20('0x4f')]),_0xad20('0x66'),{'recordId':_0x1d4a5f['id']});break;case _0xad20('0x67'):emit(util[_0xad20('0x3e')](_0xad20('0x68'),_0x1b1991[_0xad20('0x4f')]),_0xad20('0x69'),{'uri':util[_0xad20('0x3e')](_0xad20('0x6a'),_0x2c4aeb['instanceUrl'],_0x1d4a5f['id'])});break;default:logger[_0xad20('0x6b')](_0xad20('0x6c'));}})['catch'](function(_0x5d23d4){logger['error'](_0xad20('0x5d'),_0x5d23d4);});};exports['outbound']=function(_0x11acce,_0x10a5a3,_0xbc6dee,_0x4cba0c,_0x4a6516,_0x29eb15,_0x1f0f8e){var _0x22dacd,_0x14f152,_0x37bb6c,_0x189828;_0x29eb15[_0xad20('0x5a')]=intUtil[_0xad20('0x5b')](_0x29eb15[_0xad20('0x5a')]);_0x29eb15[_0xad20('0x53')]=intUtil[_0xad20('0x5b')](_0x29eb15[_0xad20('0x53')]);if(_0x1f0f8e&&_0x1f0f8e[_0xad20('0x6d')]&&_0x1f0f8e[_0xad20('0x6d')]!=='none'){logger[_0xad20('0x1b')](_0xad20('0x6e'),'Recording\x20is\x20enabled!');_0x10a5a3[_0xad20('0x6f')]=util[_0xad20('0x3e')](_0xad20('0x5f'),_0x29eb15[_0xad20('0x5a')],_0x10a5a3[_0xad20('0x60')],md5(_0x10a5a3['uniqueid']));}return getConnection(_0x29eb15)[_0xad20('0x21')](function(_0x30cda7){_0x189828=_0x30cda7;return getUser(_0x29eb15,_0x4cba0c['email'],_0x189828);})[_0xad20('0x21')](function(_0x175b93){_0x22dacd=_0x175b93;return getEndUser(_0x29eb15,_0xbc6dee,_0x10a5a3[_0xad20('0x70')],_0x10a5a3[_0xad20('0x71')],_0x189828);})[_0xad20('0x21')](function(_0x305afe){_0x14f152=_0x305afe;return getTicket(_0x29eb15,_0x22dacd,_0x14f152,_0xbc6dee,_0x10a5a3,_0xbc6dee['Fields'],_0x189828,'outbound');})[_0xad20('0x21')](function(_0x507901){_0x37bb6c=_0x507901;logger[_0xad20('0x1b')](_0xad20('0x72'),_0x37bb6c['id']);logger['info'](_0xad20('0x73'),_0x37bb6c['id'],_0x4cba0c[_0xad20('0x4f')],_0x29eb15[_0xad20('0x47')]);switch(_0x29eb15[_0xad20('0x47')]){case _0xad20('0x65'):emit(util['format'](_0xad20('0x68'),_0x4cba0c[_0xad20('0x4f')]),_0xad20('0x66'),{'recordId':_0x37bb6c['id']});break;case _0xad20('0x67'):emit(util[_0xad20('0x3e')](_0xad20('0x68'),_0x4cba0c[_0xad20('0x4f')]),_0xad20('0x69'),{'uri':util[_0xad20('0x3e')](_0xad20('0x6a'),_0x189828[_0xad20('0x74')],_0x37bb6c['id'])});break;default:logger[_0xad20('0x6b')](_0xad20('0x6e'),_0xad20('0x75'));}})[_0xad20('0x76')](function(_0x8d9316){logger['error'](_0xad20('0x6e'),_0x8d9316);});};exports[_0xad20('0x77')]=function(_0x1c5ce3,_0x90c67e,_0x18aaf5,_0x464de9,_0x539ef4,_0x4e0745){var _0x2de034,_0x8e9004,_0x21c6ae,_0x215132;_0x4e0745[_0xad20('0x5a')]=intUtil[_0xad20('0x5b')](_0x4e0745[_0xad20('0x5a')]);_0x4e0745[_0xad20('0x53')]=intUtil['stripTrailingSlash'](_0x4e0745[_0xad20('0x53')]);if(_0x539ef4&&_0x539ef4[_0xad20('0x5c')]){logger[_0xad20('0x1b')]('['+_0x90c67e['lastevent'][_0xad20('0x78')]()+']','Recording\x20is\x20enabled!');_0x90c67e[_0xad20('0x6f')]=util[_0xad20('0x3e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4e0745[_0xad20('0x5a')],_0x90c67e[_0xad20('0x60')],md5(_0x90c67e[_0xad20('0x60')]));}else{_0x90c67e['recordingURL']='';}return getConnection(_0x4e0745)[_0xad20('0x21')](function(_0x202367){_0x215132=_0x202367;if(!_[_0xad20('0x1e')](_0x464de9)){return getUser(_0x4e0745,_0x464de9['name'],_0x215132);}else{return getUser(_0x4e0745,null,_0x215132);}})[_0xad20('0x21')](function(_0x48b1c2){_0x2de034=_0x48b1c2;return getEndUser(_0x4e0745,_0x18aaf5,_0x90c67e[_0xad20('0x62')],_0x90c67e[_0xad20('0x79')],_0x215132);})[_0xad20('0x21')](function(_0xf2a0ae){_0x8e9004=_0xf2a0ae;return getTicket(_0x4e0745,_0x2de034,_0x8e9004,_0x18aaf5,_0x90c67e,_0x18aaf5[_0xad20('0x63')],_0x215132);})[_0xad20('0x21')](function(_0x2cdc16){_0x21c6ae=_0x2cdc16;logger['info']('['+_0x90c67e[_0xad20('0x7a')][_0xad20('0x78')]()+_0xad20('0x7b'),_0x21c6ae['id']);logger[_0xad20('0x1b')]('['+_0x90c67e[_0xad20('0x7a')][_0xad20('0x78')]()+']\x20Integration\x20account\x20type\x20%s.',_0x4e0745[_0xad20('0x47')]);})[_0xad20('0x76')](function(_0x12b362){logger['error']('['+_0x90c67e[_0xad20('0x7a')][_0xad20('0x78')]()+']',_0x12b362);});}; \ No newline at end of file +var _0xc0b2=['moment','md5','jsforce','util','ioredis','./util','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','emit','assign','getString','Subjects','Descriptions','ticketType','Task','ActivityDate','utc','IsReminderSet','IsRecurrence','endUserType','contact','WhoId','WhatId','Case','ContactId','lead','create','isNil','validateEmail','sobject','User','find','execute','then','info','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','resolve','user_id','identity','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','cloneDeep','additionalSearchContact','merge','$or','Contact','length','additionalSearchLead','account_contact_lead','additionalSearchAccount','Account','Lead','account','attributes','type','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','','format','Caller\x20-\x20%s','Company','upperFirst','forEach','includes','string','picklist','idField','content','toString','variable','variableName','customVariable','Variable','name','password','securityToken','remoteUri','https://login.salesforce.com','clientId','clientSecret','login','username','queue','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','email','calleridname','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','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','outbound','recordingFormat','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','error','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','lastevent','toUpperCase',']\x20Ticket\x20%s\x20created.','request-promise'];(function(_0x810179,_0x505c10){var _0xe4916c=function(_0x5ebd7b){while(--_0x5ebd7b){_0x810179['push'](_0x810179['shift']());}};_0xe4916c(++_0x505c10);}(_0xc0b2,0x17f));var _0x2c0b=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xc0b2[_0x376b45];return _0x2341b3;};'use strict';var _=require('lodash');var rp=require(_0x2c0b('0x0'));var moment=require(_0x2c0b('0x1'));var BPromise=require('bluebird');var md5=require(_0x2c0b('0x2'));var jsforce=require(_0x2c0b('0x3'));var util=require(_0x2c0b('0x4'));var Redis=require(_0x2c0b('0x5'));var intUtil=require(_0x2c0b('0x6'));var config=require('../../../../config/environment');var logger=require(_0x2c0b('0x7'))('salesforce');config[_0x2c0b('0x8')]=_[_0x2c0b('0x9')](config[_0x2c0b('0x8')],{'host':_0x2c0b('0xa'),'port':0x18eb});var io=require(_0x2c0b('0xb'))(new Redis(config[_0x2c0b('0x8')]));function emit(_0x5691cb,_0x537d45,_0x1fb2c8){io['to'](_0x5691cb)[_0x2c0b('0xc')](_0x537d45,_0x1fb2c8);}function getTicket(_0x472b2e,_0x303559,_0x44eb92,_0x1ff687,_0x176701,_0x2ee431,_0x131506,_0x18b975){var _0x4d4f80=Object[_0x2c0b('0xd')]({},{'OwnerId':_0x303559['id'],'Subject':intUtil[_0x2c0b('0xe')](_0x1ff687[_0x2c0b('0xf')],_0x176701,'\x20'),'Description':intUtil['getString'](_0x1ff687[_0x2c0b('0x10')],_0x176701,'\x0a')},getCustomFields(_0x2ee431,_0x176701));if(_0x44eb92){if(_0x1ff687[_0x2c0b('0x11')]===_0x2c0b('0x12')){_0x4d4f80[_0x2c0b('0x13')]=moment[_0x2c0b('0x14')]();_0x4d4f80[_0x2c0b('0x15')]=![];_0x4d4f80[_0x2c0b('0x16')]=![];if(_0x44eb92[_0x2c0b('0x17')]===_0x2c0b('0x18')||_0x44eb92[_0x2c0b('0x17')]==='lead'){_0x4d4f80[_0x2c0b('0x19')]=_0x44eb92['id'];}else if(_0x44eb92['endUserType']==='account'){_0x4d4f80[_0x2c0b('0x1a')]=_0x44eb92['id'];}}else if(_0x1ff687[_0x2c0b('0x11')]===_0x2c0b('0x1b')){if(_0x44eb92['endUserType']==='contact'){_0x4d4f80[_0x2c0b('0x1c')]=_0x44eb92['id'];}else if(_0x44eb92['endUserType']==='account'){_0x4d4f80['AccountId']=_0x44eb92['id'];}else if(_0x44eb92[_0x2c0b('0x17')]===_0x2c0b('0x1d')&&_0x1ff687['leadId']){_0x4d4f80[_0x1ff687['leadId']]=_0x44eb92['id'];}else{logger['info']('Association\x20between\x20Case\x20and\x20Lead\x20skipped');}}}return _0x131506['sobject'](_0x1ff687[_0x2c0b('0x11')])[_0x2c0b('0x1e')](_0x4d4f80);}function getUser(_0x47e54a,_0x247e61,_0x54660c){if(!_[_0x2c0b('0x1f')](_0x247e61)&&intUtil[_0x2c0b('0x20')](_0x247e61)){var _0x1af447={'Email':_0x247e61};var _0xb4f65b={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x54660c[_0x2c0b('0x21')](_0x2c0b('0x22'))[_0x2c0b('0x23')](_0x1af447,_0xb4f65b)[_0x2c0b('0x24')]()[_0x2c0b('0x25')](function(_0x1d6198){if(_0x1d6198['length']){var _0x19b666=_[_0x2c0b('0x23')](_0x1d6198,function(_0x37a1fb){return _0x37a1fb['Email']===_0x247e61;});if(_0x19b666){logger[_0x2c0b('0x26')]('Agent\x20%s\x20found.',_0x247e61);return BPromise['resolve']({'id':_0x19b666['Id'],'name':_0x19b666[_0x2c0b('0x27')]});}}else{logger[_0x2c0b('0x26')](_0x2c0b('0x28'),_0x247e61);return _0x54660c['identity']()[_0x2c0b('0x25')](function(_0x2220e6){return BPromise[_0x2c0b('0x29')]({'id':_0x2220e6[_0x2c0b('0x2a')],'name':_0x2220e6['display_name']});});}});}else{logger['info'](_0x2c0b('0x28'),_0x247e61);return _0x54660c[_0x2c0b('0x2b')]()['then'](function(_0x9778fd){return BPromise['resolve']({'id':_0x9778fd[_0x2c0b('0x2a')],'name':_0x9778fd[_0x2c0b('0x2c')]});});}}function getEndUser(_0x567f80,_0x22fb8c,_0x1e812d,_0x20d5bd,_0x636b93){var _0x36f21c={'$or':{'Phone':_0x20d5bd}};var _0x424bef={'Id':!![],'Name':!![],'Phone':!![]};return BPromise['resolve']()['then'](function(){logger[_0x2c0b('0x26')](_0x2c0b('0x2d'),_0x20d5bd,_0x22fb8c[_0x2c0b('0x2e')]);switch(_0x22fb8c[_0x2c0b('0x2e')]){case'contact_lead':var _0x17677a=_[_0x2c0b('0x2f')](_0x36f21c);if(_0x22fb8c['additionalSearchContact']){var _0x1da322={};_0x1da322[_0x22fb8c[_0x2c0b('0x30')]]=_0x20d5bd;_[_0x2c0b('0x31')](_0x17677a[_0x2c0b('0x32')],_0x1da322);}return _0x636b93['sobject'](_0x2c0b('0x33'))[_0x2c0b('0x23')](_0x17677a,_0x424bef)['execute']()[_0x2c0b('0x25')](function(_0x5a26c8){if(_0x5a26c8&&_0x5a26c8[_0x2c0b('0x34')]){return _0x5a26c8;}else{var _0x5f44f5=_[_0x2c0b('0x2f')](_0x36f21c);if(_0x22fb8c[_0x2c0b('0x35')]){var _0x514e2f={};_0x514e2f[_0x22fb8c['additionalSearchLead']]=_0x20d5bd;_[_0x2c0b('0x31')](_0x5f44f5[_0x2c0b('0x32')],_0x514e2f);}return _0x636b93[_0x2c0b('0x21')]('Lead')[_0x2c0b('0x23')](_0x5f44f5,_0x424bef);}});case _0x2c0b('0x36'):var _0x303809=_['cloneDeep'](_0x36f21c);if(_0x22fb8c['additionalSearchAccount']){var _0x1da322={};_0x1da322[_0x22fb8c[_0x2c0b('0x37')]]=_0x20d5bd;_[_0x2c0b('0x31')](_0x303809[_0x2c0b('0x32')],_0x1da322);}return _0x636b93['sobject'](_0x2c0b('0x38'))[_0x2c0b('0x23')](_0x303809,_0x424bef)[_0x2c0b('0x24')]()[_0x2c0b('0x25')](function(_0x3ff564){if(_0x3ff564&&_0x3ff564[_0x2c0b('0x34')]){return _0x3ff564;}else{var _0x56fe2f=_['cloneDeep'](_0x36f21c);if(_0x22fb8c[_0x2c0b('0x30')]){var _0xc1a3ba={};_0xc1a3ba[_0x22fb8c[_0x2c0b('0x30')]]=_0x20d5bd;_['merge'](_0x56fe2f[_0x2c0b('0x32')],_0xc1a3ba);}return _0x636b93[_0x2c0b('0x21')](_0x2c0b('0x33'))['find'](_0x56fe2f,_0x424bef)[_0x2c0b('0x25')](function(_0x4f52c9){if(_0x4f52c9&&_0x4f52c9[_0x2c0b('0x34')]){return _0x4f52c9;}else{var _0x1ed320=_[_0x2c0b('0x2f')](_0x36f21c);if(_0x22fb8c[_0x2c0b('0x35')]){var _0x39586b={};_0x39586b[_0x22fb8c[_0x2c0b('0x35')]]=_0x20d5bd;_[_0x2c0b('0x31')](_0x1ed320[_0x2c0b('0x32')],_0x39586b);}return _0x636b93['sobject'](_0x2c0b('0x39'))['find'](_0x1ed320,_0x424bef);}});}});case _0x2c0b('0x18'):var _0x17677a=_[_0x2c0b('0x2f')](_0x36f21c);if(_0x22fb8c[_0x2c0b('0x30')]){var _0x1da322={};_0x1da322[_0x22fb8c[_0x2c0b('0x30')]]=_0x20d5bd;_[_0x2c0b('0x31')](_0x17677a[_0x2c0b('0x32')],_0x1da322);}return _0x636b93['sobject']('Contact')[_0x2c0b('0x23')](_0x17677a,_0x424bef)[_0x2c0b('0x24')]();case _0x2c0b('0x1d'):var _0x4e80d7=_[_0x2c0b('0x2f')](_0x36f21c);if(_0x22fb8c['additionalSearchLead']){var _0x1da322={};_0x1da322[_0x22fb8c[_0x2c0b('0x35')]]=_0x20d5bd;_[_0x2c0b('0x31')](_0x4e80d7[_0x2c0b('0x32')],_0x1da322);}return _0x636b93[_0x2c0b('0x21')](_0x2c0b('0x39'))[_0x2c0b('0x23')](_0x4e80d7,_0x424bef);case _0x2c0b('0x3a'):var _0x303809=_[_0x2c0b('0x2f')](_0x36f21c);if(_0x22fb8c[_0x2c0b('0x37')]){var _0x1da322={};_0x1da322[_0x22fb8c[_0x2c0b('0x37')]]=_0x20d5bd;_[_0x2c0b('0x31')](_0x303809[_0x2c0b('0x32')],_0x1da322);}return _0x636b93[_0x2c0b('0x21')](_0x2c0b('0x38'))[_0x2c0b('0x23')](_0x303809,_0x424bef);default:return null;}})[_0x2c0b('0x25')](function(_0x517f77){if(_0x517f77&&_0x517f77['length']){var _0x5bf32a=_['first'](_0x517f77);if(_0x5bf32a){return BPromise['resolve']({'id':_0x5bf32a['Id'],'name':_0x5bf32a['Name'],'phone':_0x5bf32a['Phone'],'endUserType':_0x5bf32a[_0x2c0b('0x3b')][_0x2c0b('0x3c')][_0x2c0b('0x3d')]()});}}})['then'](function(_0x34aa9b){if(_0x34aa9b){logger[_0x2c0b('0x26')](_0x2c0b('0x3e'),_0x34aa9b[_0x2c0b('0x17')],_0x20d5bd);return BPromise['resolve'](_0x34aa9b);}else{logger[_0x2c0b('0x26')](_0x2c0b('0x3f'),_0x20d5bd);var _0x5e82bc={'Phone':_0x20d5bd};if(_0x22fb8c[_0x2c0b('0x40')]){if(_0x22fb8c[_0x2c0b('0x40')]===_0x2c0b('0x18')){logger['info'](_0x2c0b('0x41'),_0x20d5bd,_0x22fb8c[_0x2c0b('0x40')]);_0x5e82bc[_0x2c0b('0x42')]=_0x1e812d!==_0x2c0b('0x43')?_0x1e812d:util[_0x2c0b('0x44')]('Caller\x20-\x20%s',_0x20d5bd);}else if(_0x22fb8c[_0x2c0b('0x40')]===_0x2c0b('0x1d')){logger[_0x2c0b('0x26')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x20d5bd,_0x22fb8c[_0x2c0b('0x40')]);_0x5e82bc[_0x2c0b('0x42')]=_0x1e812d!==_0x2c0b('0x43')?_0x1e812d:util[_0x2c0b('0x44')](_0x2c0b('0x45'),_0x20d5bd);_0x5e82bc[_0x2c0b('0x46')]='No\x20Company';}else if(_0x22fb8c['moduleCreate']===_0x2c0b('0x3a')){logger[_0x2c0b('0x26')](_0x2c0b('0x41'),_0x20d5bd,_0x22fb8c[_0x2c0b('0x40')]);_0x5e82bc[_0x2c0b('0x27')]=_0x1e812d!==_0x2c0b('0x43')?_0x1e812d:util['format']('Caller\x20-\x20%s',_0x20d5bd);}else{return null;}}return _0x636b93[_0x2c0b('0x21')](_[_0x2c0b('0x47')](_0x22fb8c[_0x2c0b('0x40')]))[_0x2c0b('0x1e')](_0x5e82bc)[_0x2c0b('0x25')](function(_0x470653){return BPromise[_0x2c0b('0x29')]({'id':_0x470653['id'],'endUserType':_0x22fb8c[_0x2c0b('0x40')]});});}});}function getCustomFields(_0x3d8adf,_0x5ad84d){var _0x4aca98={};if(_0x3d8adf[_0x2c0b('0x34')]>0x0){_[_0x2c0b('0x48')](_0x3d8adf,function(_0x68f1a9){if(_[_0x2c0b('0x49')]([_0x2c0b('0x4a'),_0x2c0b('0x4b')],_0x68f1a9[_0x2c0b('0x3c')])&&_0x68f1a9[_0x2c0b('0x4c')]){_0x4aca98[_0x68f1a9['idField']]=_0x68f1a9[_0x2c0b('0x4d')][_0x2c0b('0x4e')]();}else if(_0x68f1a9[_0x2c0b('0x3c')]===_0x2c0b('0x4f')&&_0x68f1a9[_0x2c0b('0x50')]&&_0x68f1a9[_0x2c0b('0x4c')]){_0x5ad84d[_0x68f1a9[_0x2c0b('0x50')]]&&(_0x4aca98[_0x68f1a9[_0x2c0b('0x4c')]]=_0x5ad84d[_0x68f1a9['variableName']]['toString']());}else if(_0x68f1a9[_0x2c0b('0x3c')]===_0x2c0b('0x51')&&_0x68f1a9['Variable']&&_0x68f1a9[_0x2c0b('0x52')]['name']&&_0x68f1a9[_0x2c0b('0x4c')]){_0x5ad84d[_0x68f1a9['Variable'][_0x2c0b('0x53')]['toLowerCase']()]&&(_0x4aca98[_0x68f1a9[_0x2c0b('0x4c')]]=_0x5ad84d[_0x68f1a9[_0x2c0b('0x52')][_0x2c0b('0x53')]['toLowerCase']()]['toString']());}});}return _0x4aca98;}function getConnection(_0x5329f1){var _0xe01708=_0x5329f1[_0x2c0b('0x54')]['concat'](_0x5329f1[_0x2c0b('0x55')]);var _0x19583=new jsforce['Connection']({'oauth2':{'loginUrl':_0x5329f1[_0x2c0b('0x56')]||_0x2c0b('0x57'),'clientId':_0x5329f1[_0x2c0b('0x58')],'clientSecret':_0x5329f1[_0x2c0b('0x59')]}});return _0x19583[_0x2c0b('0x5a')](_0x5329f1[_0x2c0b('0x5b')],_0xe01708)[_0x2c0b('0x25')](function(){logger[_0x2c0b('0x26')]('Connection\x20established.');return _0x19583;});}exports[_0x2c0b('0x5c')]=function(_0x474e1f,_0x25c5d4,_0xc6acc,_0x140436,_0x311c43,_0x5b899f){var _0x103f38,_0x1acc33,_0x4a5472,_0x37def6;_0x5b899f[_0x2c0b('0x5d')]=intUtil['stripTrailingSlash'](_0x5b899f[_0x2c0b('0x5d')]);_0x5b899f['remoteUri']=intUtil[_0x2c0b('0x5e')](_0x5b899f[_0x2c0b('0x56')]);if(_0x311c43&&_0x311c43[_0x2c0b('0x5f')]){logger['info'](_0x2c0b('0x60'),_0x2c0b('0x61'));_0x25c5d4[_0x2c0b('0x62')]=util[_0x2c0b('0x44')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5b899f[_0x2c0b('0x5d')],_0x25c5d4[_0x2c0b('0x63')],md5(_0x25c5d4[_0x2c0b('0x63')]));}else{_0x25c5d4[_0x2c0b('0x62')]='';}return getConnection(_0x5b899f)[_0x2c0b('0x25')](function(_0x43a3a5){_0x37def6=_0x43a3a5;return getUser(_0x5b899f,_0x140436[_0x2c0b('0x64')],_0x37def6);})['then'](function(_0x25391c){_0x103f38=_0x25391c;return getEndUser(_0x5b899f,_0xc6acc,_0x25c5d4[_0x2c0b('0x65')],_0x25c5d4[_0x2c0b('0x66')],_0x37def6);})[_0x2c0b('0x25')](function(_0xf48782){_0x1acc33=_0xf48782;return getTicket(_0x5b899f,_0x103f38,_0x1acc33,_0xc6acc,_0x25c5d4,_0xc6acc[_0x2c0b('0x67')],_0x37def6,_0x2c0b('0x5c'));})['then'](function(_0x6649e0){_0x4a5472=_0x6649e0;logger['info'](_0x2c0b('0x68'),_0x4a5472['id']);logger[_0x2c0b('0x26')](_0x2c0b('0x69'),_0x4a5472['id'],_0x140436[_0x2c0b('0x53')],_0x5b899f[_0x2c0b('0x3c')]);switch(_0x5b899f['type']){case _0x2c0b('0x6a'):emit(util['format'](_0x2c0b('0x6b'),_0x140436['name']),_0x2c0b('0x6c'),{'recordId':_0x4a5472['id']});break;case _0x2c0b('0x6d'):emit(util['format'](_0x2c0b('0x6b'),_0x140436['name']),_0x2c0b('0x6e'),{'uri':util[_0x2c0b('0x44')](_0x2c0b('0x6f'),_0x37def6[_0x2c0b('0x70')],_0x4a5472['id'])});break;default:logger['error'](_0x2c0b('0x71'));}})[_0x2c0b('0x72')](function(_0x19b899){logger['error'](_0x2c0b('0x60'),_0x19b899);});};exports[_0x2c0b('0x73')]=function(_0x5d9224,_0x37c07c,_0x3fb31d,_0x381656,_0x319c59,_0x4ce684,_0x391544){var _0xb84f70,_0x2965a8,_0x1b5c3a,_0xcb8b8a;_0x4ce684['serverUrl']=intUtil[_0x2c0b('0x5e')](_0x4ce684['serverUrl']);_0x4ce684[_0x2c0b('0x56')]=intUtil[_0x2c0b('0x5e')](_0x4ce684[_0x2c0b('0x56')]);if(_0x391544&&_0x391544['recordingFormat']&&_0x391544[_0x2c0b('0x74')]!=='none'){logger[_0x2c0b('0x26')](_0x2c0b('0x75'),_0x2c0b('0x61'));_0x37c07c[_0x2c0b('0x62')]=util[_0x2c0b('0x44')](_0x2c0b('0x76'),_0x4ce684[_0x2c0b('0x5d')],_0x37c07c[_0x2c0b('0x63')],md5(_0x37c07c[_0x2c0b('0x63')]));}return getConnection(_0x4ce684)[_0x2c0b('0x25')](function(_0x144e83){_0xcb8b8a=_0x144e83;return getUser(_0x4ce684,_0x381656['email'],_0xcb8b8a);})[_0x2c0b('0x25')](function(_0x1c7143){_0xb84f70=_0x1c7143;return getEndUser(_0x4ce684,_0x3fb31d,_0x37c07c[_0x2c0b('0x77')],_0x37c07c[_0x2c0b('0x78')],_0xcb8b8a);})[_0x2c0b('0x25')](function(_0x1afcc6){_0x2965a8=_0x1afcc6;return getTicket(_0x4ce684,_0xb84f70,_0x2965a8,_0x3fb31d,_0x37c07c,_0x3fb31d[_0x2c0b('0x67')],_0xcb8b8a,_0x2c0b('0x73'));})[_0x2c0b('0x25')](function(_0x2ad400){_0x1b5c3a=_0x2ad400;logger[_0x2c0b('0x26')]('[OUTBOUND]\x20Ticket\x20%s\x20created.',_0x1b5c3a['id']);logger['info'](_0x2c0b('0x79'),_0x1b5c3a['id'],_0x381656[_0x2c0b('0x53')],_0x4ce684[_0x2c0b('0x3c')]);switch(_0x4ce684['type']){case'integrationTab':emit(util[_0x2c0b('0x44')](_0x2c0b('0x6b'),_0x381656[_0x2c0b('0x53')]),_0x2c0b('0x6c'),{'recordId':_0x1b5c3a['id']});break;case'newTab':emit(util['format'](_0x2c0b('0x6b'),_0x381656['name']),_0x2c0b('0x6e'),{'uri':util[_0x2c0b('0x44')](_0x2c0b('0x6f'),_0xcb8b8a[_0x2c0b('0x70')],_0x1b5c3a['id'])});break;default:logger[_0x2c0b('0x7a')](_0x2c0b('0x75'),_0x2c0b('0x7b'));}})['catch'](function(_0x2391ef){logger[_0x2c0b('0x7a')](_0x2c0b('0x75'),_0x2391ef);});};exports[_0x2c0b('0x7c')]=function(_0x174d80,_0x358038,_0x32695a,_0xf8aa07,_0x16d616,_0x588853){var _0x31752f,_0x44a1ca,_0x4b090a,_0x37d4e8;_0x588853[_0x2c0b('0x5d')]=intUtil[_0x2c0b('0x5e')](_0x588853[_0x2c0b('0x5d')]);_0x588853[_0x2c0b('0x56')]=intUtil[_0x2c0b('0x5e')](_0x588853[_0x2c0b('0x56')]);if(_0x16d616&&_0x16d616['monitor_format']){logger[_0x2c0b('0x26')]('['+_0x358038[_0x2c0b('0x7d')][_0x2c0b('0x7e')]()+']','Recording\x20is\x20enabled!');_0x358038[_0x2c0b('0x62')]=util[_0x2c0b('0x44')](_0x2c0b('0x76'),_0x588853['serverUrl'],_0x358038['uniqueid'],md5(_0x358038[_0x2c0b('0x63')]));}else{_0x358038[_0x2c0b('0x62')]='';}return getConnection(_0x588853)[_0x2c0b('0x25')](function(_0x292953){_0x37d4e8=_0x292953;if(!_[_0x2c0b('0x1f')](_0xf8aa07)){return getUser(_0x588853,_0xf8aa07[_0x2c0b('0x53')],_0x37d4e8);}else{return getUser(_0x588853,null,_0x37d4e8);}})[_0x2c0b('0x25')](function(_0x2ad711){_0x31752f=_0x2ad711;return getEndUser(_0x588853,_0x32695a,_0x358038[_0x2c0b('0x65')],_0x358038[_0x2c0b('0x66')],_0x37d4e8);})[_0x2c0b('0x25')](function(_0x117e11){_0x44a1ca=_0x117e11;return getTicket(_0x588853,_0x31752f,_0x44a1ca,_0x32695a,_0x358038,_0x32695a[_0x2c0b('0x67')],_0x37d4e8);})['then'](function(_0x5ee602){_0x4b090a=_0x5ee602;logger[_0x2c0b('0x26')]('['+_0x358038[_0x2c0b('0x7d')]['toUpperCase']()+_0x2c0b('0x7f'),_0x4b090a['id']);logger[_0x2c0b('0x26')]('['+_0x358038[_0x2c0b('0x7d')][_0x2c0b('0x7e')]()+']\x20Integration\x20account\x20type\x20%s.',_0x588853[_0x2c0b('0x3c')]);})['catch'](function(_0x5a6a9f){logger[_0x2c0b('0x7a')]('['+_0x358038[_0x2c0b('0x7d')][_0x2c0b('0x7e')]()+']',_0x5a6a9f);});}; \ 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 2e34898..a9ec5eb 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 _0x0e19=['customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','assign','getString','Subjects','Descriptions',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber',']\x20getTicket\x20crm','label','GET','?sysparm_query=name%3D','incident','Incident','Incident\x20-\x20','push','all','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','emit','trigger:browser:url','sysparm_display_value=true','remoteUri','serverUrl','%s/api/now/table/','isNil','email','destcalleridnum','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','format','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','inspect','lodash','bluebird','request-promise','util','ioredis','./util','redis','localhost','socket.io-emitter','sys_user?sysparm_query=user_name%3Dadmin','length','adminId','sys_id','info','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','],\x20getUser\x20input\x20crm','validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','then','result','active','true','userId','adminEmail','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','POST','sys_user?','endUserNumber','user','System','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','includes','string','type','nameField','toLowerCase','toString','picklist','idField','customField','content','variable'];(function(_0xeb79ca,_0x3b9197){var _0x17f118=function(_0x8b00d8){while(--_0x8b00d8){_0xeb79ca['push'](_0xeb79ca['shift']());}};_0x17f118(++_0x3b9197);}(_0x0e19,0x179));var _0x90e1=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x0e19[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0x90e1('0x0'));var Promise=require(_0x90e1('0x1'));var rp=require(_0x90e1('0x2'));var util=require(_0x90e1('0x3'));var md5=require('md5');var Redis=require(_0x90e1('0x4'));var intUtil=require(_0x90e1('0x5'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')('servicenow');config['redis']=_['defaults'](config[_0x90e1('0x6')],{'host':_0x90e1('0x7'),'port':0x18eb});var io=require(_0x90e1('0x8'))(new Redis(config[_0x90e1('0x6')]));function getAdminUser(_0x52e1a3,_0x5e47d7,_0xe5ffc3,_0x4c33f5,_0x51efc3,_0x22e90b){return new Promise(function(_0x58600c,_0x3c40fa){var _0x41722c={'method':'GET','uri':_0x4c33f5+_0x90e1('0x9')+'&'+_0x51efc3+'&'+_0x22e90b,'auth':_0x5e47d7,'json':!![]};return rp(_0x41722c)['then'](function(_0x2f40c4){if(_0x2f40c4['result'][_0x90e1('0xa')]>0x0){_0xe5ffc3[_0x90e1('0xb')]=_0x2f40c4['result'][0x0][_0x90e1('0xc')];}logger[_0x90e1('0xd')]('['+[_0x52e1a3[_0x90e1('0xe')]()]+_0x90e1('0xf'),_0xe5ffc3);_0x58600c(_0xe5ffc3);})[_0x90e1('0x10')](function(_0x4fec23){logger[_0x90e1('0x11')]('['+[_0x52e1a3[_0x90e1('0xe')]()]+']',_0x4fec23['message']);_0x3c40fa(_0x4fec23[_0x90e1('0x12')]);});});}function getUser(_0x2c37c4,_0x2e8754,_0xbcff0b,_0x44a80e,_0x1889d1){return function(_0x3ebc30){logger['info']('['+[_0x2c37c4['toUpperCase']()]+_0x90e1('0x13'),_0x3ebc30);return new Promise(function(_0x49ec33,_0x3028d7){if(intUtil[_0x90e1('0x14')](_0x3ebc30[_0x90e1('0x15')])){var _0x2e5f6e={'method':'GET','uri':_0xbcff0b+_0x90e1('0x16')+_0x3ebc30[_0x90e1('0x15')]+'&'+_0x44a80e+'&'+_0x1889d1,'auth':_0x2e8754,'json':!![]};logger[_0x90e1('0xd')]('['+[_0x2c37c4['toUpperCase']()]+_0x90e1('0x17'),_0x2e5f6e);return rp(_0x2e5f6e)[_0x90e1('0x18')](function(_0x58608c){logger[_0x90e1('0xd')]('['+[_0x2c37c4[_0x90e1('0xe')]()]+'],\x20getUser\x20entity',_0x58608c);if(_0x58608c[_0x90e1('0x19')][_0x90e1('0xa')]>0x0&&String(_0x58608c[_0x90e1('0x19')][0x0][_0x90e1('0x1a')])===_0x90e1('0x1b')){_0x3ebc30[_0x90e1('0x1c')]=_0x58608c[_0x90e1('0x19')][0x0]['sys_id'];}else{_0x3ebc30[_0x90e1('0x1c')]=_0x3ebc30[_0x90e1('0xb')];_0x3ebc30[_0x90e1('0x15')]=_0x3ebc30[_0x90e1('0x1d')];}logger['info']('['+[_0x2c37c4[_0x90e1('0xe')]()]+_0x90e1('0x1e'),_0x3ebc30);_0x49ec33(_0x3ebc30);})[_0x90e1('0x10')](function(_0x5c2e70){logger[_0x90e1('0x11')]('['+[_0x2c37c4['toUpperCase']()]+']',_0x5c2e70[_0x90e1('0x12')]);_0x3028d7(_0x5c2e70[_0x90e1('0x12')]);});}else{logger['info']('['+[_0x2c37c4['toUpperCase']()]+_0x90e1('0x1f'));_0x3ebc30[_0x90e1('0x1c')]=_0x3ebc30[_0x90e1('0xb')];_0x3ebc30[_0x90e1('0x15')]=_0x3ebc30[_0x90e1('0x1d')];_0x49ec33(_0x3ebc30);}});};}function createEndUser(_0x32cf2f,_0x39a201,_0x284e3a,_0x801226,_0x4b6ea0){logger['info']('['+[_0x32cf2f[_0x90e1('0xe')]()]+'],\x20createEndUser\x20input\x20crm',_0x284e3a);return new Promise(function(_0x507e30,_0x244b55){var _0x2089b4={'method':_0x90e1('0x20'),'uri':_0x801226+_0x90e1('0x21')+_0x4b6ea0,'body':{'user_name':_0x284e3a[_0x90e1('0x22')],'roles':_0x90e1('0x23'),'first_name':_0x284e3a[_0x90e1('0x22')],'active':'true','date_format':_0x90e1('0x24'),'phone':_0x284e3a['endUserNumber']},'auth':_0x39a201,'json':!![]};return rp(_0x2089b4)[_0x90e1('0x18')](function(_0x32ddd6){logger[_0x90e1('0xd')]('['+[_0x32cf2f[_0x90e1('0xe')]()]+_0x90e1('0x25'),_0x32ddd6[_0x90e1('0x19')]);_0x284e3a[_0x90e1('0x26')]=_0x32ddd6[_0x90e1('0x19')][_0x90e1('0xc')];_0x507e30(_0x284e3a);})[_0x90e1('0x10')](function(_0x3e50bd){logger[_0x90e1('0x11')]('['+[_0x32cf2f['toUpperCase']()]+']',_0x3e50bd[_0x90e1('0x12')]);_0x244b55(_0x3e50bd[_0x90e1('0x12')]);});});}function getEndUser(_0x2ec272,_0x4f3a4e,_0x43ec3b,_0x40de73,_0x159afc){return function(_0x3f8174){logger[_0x90e1('0xd')]('['+[_0x2ec272[_0x90e1('0xe')]()]+_0x90e1('0x27'),_0x3f8174);return new Promise(function(_0x5ac123,_0x2f19f8){var _0x24396c={'method':'GET','uri':_0x43ec3b+_0x90e1('0x28')+_0x3f8174['endUserNumber']+'&'+_0x40de73+'&'+_0x159afc,'auth':_0x4f3a4e,'json':!![]};return rp(_0x24396c)[_0x90e1('0x18')](function(_0x438495){if(_0x438495[_0x90e1('0x19')]['length']>0x0){_0x3f8174[_0x90e1('0x26')]=_0x438495[_0x90e1('0x19')][0x0][_0x90e1('0xc')];logger[_0x90e1('0xd')]('['+[_0x2ec272[_0x90e1('0xe')]()]+_0x90e1('0x29'),_0x3f8174);_0x5ac123(_0x3f8174);}else{return createEndUser(_0x2ec272,_0x4f3a4e,_0x3f8174,_0x43ec3b,_0x40de73)[_0x90e1('0x18')](function(_0x7b69f3){logger[_0x90e1('0xd')]('['+[_0x2ec272[_0x90e1('0xe')]()]+_0x90e1('0x2a'),_0x7b69f3);_0x5ac123(_0x7b69f3);});}})[_0x90e1('0x10')](function(_0x5ae8b8){logger['error']('['+[_0x2ec272['toUpperCase']()]+']',_0x5ae8b8[_0x90e1('0x12')]);_0x2f19f8(_0x5ae8b8['message']);});});};}function getCustomFields(_0x17bb3e,_0x4819c8){var _0x573bb3={};if(_0x17bb3e[_0x90e1('0xa')]>0x0){_[_0x90e1('0x2b')](_0x17bb3e,function(_0x3d898f){if(_[_0x90e1('0x2c')]([_0x90e1('0x2d'),'picklist'],_0x3d898f[_0x90e1('0x2e')])&&_0x3d898f[_0x90e1('0x2f')]&&!_0x3d898f['customField']){_0x573bb3[_0x3d898f[_0x90e1('0x2f')][_0x90e1('0x30')]()]=_0x3d898f['content'][_0x90e1('0x31')]();}else if(_[_0x90e1('0x2c')]([_0x90e1('0x2d'),_0x90e1('0x32')],_0x3d898f[_0x90e1('0x2e')])&&_0x3d898f[_0x90e1('0x33')]&&_0x3d898f[_0x90e1('0x34')]){_0x573bb3[_0x3d898f['idField'][_0x90e1('0x30')]()]=_0x3d898f[_0x90e1('0x35')][_0x90e1('0x31')]();}else if(_0x3d898f[_0x90e1('0x2e')]===_0x90e1('0x36')&&_0x3d898f['variableName']&&_0x3d898f['idField']&&_0x3d898f[_0x90e1('0x34')]){_0x573bb3[_0x3d898f[_0x90e1('0x33')]['toLowerCase']()]=_0x4819c8[_0x3d898f['variableName']][_0x90e1('0x31')]();}else if(_0x3d898f[_0x90e1('0x2e')]===_0x90e1('0x37')&&_0x3d898f['Variable']&&_0x3d898f[_0x90e1('0x38')][_0x90e1('0x39')]&&_0x3d898f['idField']&&_0x3d898f[_0x90e1('0x34')]){_0x573bb3[_0x3d898f[_0x90e1('0x33')]['toLowerCase']()]=_0x4819c8[_0x3d898f[_0x90e1('0x38')][_0x90e1('0x39')][_0x90e1('0x30')]()][_0x90e1('0x31')]();}});}return _0x573bb3;}function getTicket(_0x5c134e,_0x32b15b,_0x3503fe,_0x54e092,_0x1fa486,_0x2b6f09){return function(_0x298e8b){logger[_0x90e1('0xd')]('['+[_0x5c134e[_0x90e1('0xe')]()]+_0x90e1('0x3a'),_0x298e8b);return new Promise(function(_0x57d836,_0x2e340e){var _0x1c8a03=_0x5c134e[_0x90e1('0x30')]()===_0x90e1('0x3b')?_0x298e8b['userId']:_0x298e8b['endUserId'];var _0x932448={'method':'POST','uri':_0x3503fe+'incident'+'?'+_0x2b6f09,'body':Object[_0x90e1('0x3c')]({},{'active':'true','caller_id':_0x1c8a03,'assigned_to':_0x298e8b['userId'],'short_description':intUtil[_0x90e1('0x3d')](_0x54e092[_0x90e1('0x3e')],_0x1fa486,'\x20'),'description':intUtil[_0x90e1('0x3d')](_0x54e092[_0x90e1('0x3f')],_0x1fa486,'\x0a')},getCustomFields(_0x54e092['Fields'],_0x1fa486)),'auth':_0x32b15b,'json':!![]};return rp(_0x932448)[_0x90e1('0x18')](function(_0x291a78){logger['info']('['+[_0x5c134e[_0x90e1('0xe')]()]+_0x90e1('0x40'),_0x291a78[_0x90e1('0x19')]);_0x298e8b[_0x90e1('0x41')]=_0x291a78[_0x90e1('0x19')]['sys_id'];_0x298e8b[_0x90e1('0x42')]=_0x291a78[_0x90e1('0x19')]['number'];logger['info']('['+[_0x5c134e[_0x90e1('0xe')]()]+_0x90e1('0x43'),_0x298e8b);_0x57d836(_0x298e8b);})[_0x90e1('0x10')](function(_0x29c25a){logger[_0x90e1('0x11')]('['+[_0x5c134e[_0x90e1('0xe')]()]+']',_0x29c25a['message']);_0x2e340e(_0x29c25a[_0x90e1('0x12')]);});});};}function createRemoteTag(_0x402165,_0x28620b,_0x53ee39,_0x5eec45){return new Promise(function(_0x585693,_0x40e985){var _0x197135={'method':_0x90e1('0x20'),'uri':_0x53ee39+_0x90e1('0x44')+'?'+_0x5eec45,'body':{'short_description':_0x402165,'global':!![],'active':!![],'name':_0x402165},'auth':_0x28620b,'json':!![]};return rp(_0x197135)['then'](function(_0x4dca35){var _0x31f566=_0x4dca35[_0x90e1('0x19')][_0x90e1('0xc')];_0x585693(_0x31f566);});});}function getRemoteTag(_0x39067e,_0x2e8aa7,_0x1bbc66,_0xd3a0e1,_0x24b74a){return new Promise(function(_0x315548,_0x4865ba){var _0xa18f7b={'method':_0x90e1('0x45'),'uri':_0x1bbc66+_0x90e1('0x44')+_0x90e1('0x46')+_0x39067e+'&'+_0xd3a0e1,'auth':_0x2e8aa7,'json':!![]};return rp(_0xa18f7b)[_0x90e1('0x18')](function(_0xe20567){if(_0xe20567[_0x90e1('0x19')][_0x90e1('0xa')]>0x0){var _0x52c32f=_0xe20567[_0x90e1('0x19')][0x0][_0x90e1('0xc')];_0x315548(_0x52c32f);}else{return createRemoteTag(_0x39067e,_0x2e8aa7,_0x1bbc66,_0xd3a0e1)[_0x90e1('0x18')](function(_0x15142a){_0x315548(_0x15142a);});}});});}function assignTagToIncident(_0x3478fa,_0x1226f9,_0x28e396,_0x400b8b,_0x1effe7){return new Promise(function(_0x38eb49,_0x2da614){var _0x51b589={'method':'POST','uri':_0x28e396+'label_entry'+'?'+_0x1effe7,'body':{'label':_0x3478fa,'table':_0x90e1('0x47'),'id_type':_0x90e1('0x48'),'table_key':_0x400b8b[_0x90e1('0x41')],'title':_0x90e1('0x49')+_0x400b8b[_0x90e1('0x42')],'id_display':_0x400b8b['ticketNumber']},'auth':_0x1226f9,'json':!![]};return rp(_0x51b589)[_0x90e1('0x18')](function(_0x3835f4){_0x38eb49();})[_0x90e1('0x10')](function(){_0x38eb49();});});}function manageTags(_0x476ccf,_0x5c3811,_0x2ed1b7,_0x49f218,_0x5819ec,_0x20d07c,_0x273609){return new Promise(function(_0xe406e6,_0xbda6af){var _0x3b19bd=[];_0x5c3811[_0x90e1('0x2b')](function(_0x1555cd){_0x3b19bd[_0x90e1('0x4a')](getRemoteTag(_0x1555cd,_0x2ed1b7,_0x49f218,_0x20d07c,_0x273609));});return Promise[_0x90e1('0x4b')](_0x3b19bd)['then'](function(_0x330b20){if(_0x330b20[_0x90e1('0xa')]){logger['info']('['+[_0x476ccf[_0x90e1('0xe')]()]+']\x20arrayPromises:\x20IDs\x20in\x20table\x20label',_0x330b20);var _0x1a709e=[];_0x330b20['forEach'](function(_0x437d9e){_0x1a709e['push'](assignTagToIncident(_0x437d9e,_0x2ed1b7,_0x49f218,_0x5819ec,_0x20d07c));});return Promise['all'](_0x1a709e)[_0x90e1('0x18')](function(){_0xe406e6();})[_0x90e1('0x10')](function(){_0xe406e6();});}else{_0xe406e6();}});});}function getTags(_0x3bccf9,_0x35d54e,_0x26a93b,_0x5edf0d,_0x2ddb23,_0x4a9e90){return function(_0x329c48){return new Promise(function(_0x3cd352,_0x1387cf){var _0x3ce866=[];var _0x1d3b53=_0x5edf0d['Tags'];if(_0x1d3b53&&_0x1d3b53[_0x90e1('0xa')]>0x0){_0x3ce866=_[_0x90e1('0x4c')](_0x1d3b53,'name');}if(_0x3ce866[_0x90e1('0xa')]>0x0){return manageTags(_0x3bccf9,_0x3ce866,_0x35d54e,_0x26a93b,_0x329c48,_0x2ddb23,_0x4a9e90)[_0x90e1('0x18')](function(){_0x3cd352(_0x329c48);});}else{_0x3cd352(_0x329c48);}});};}function emit(_0x4e45c7,_0x25227a,_0x2f8690){var _0x487261=_0x90e1('0x4d')+_0x90e1('0x4e')+_0x90e1('0x4f')+_0x90e1('0x50');var _0x41429b={'uri':_0x4e45c7+_0x90e1('0x51')+_0x2f8690+_0x487261};io['to'](util['format']('user:%s',_0x25227a))[_0x90e1('0x52')](_0x90e1('0x53'),_0x41429b);}exports['cs']=function(_0x17df1e,_0x1ef31d,_0x2ddb01,_0x22dc8a,_0x45d461,_0x3424ee,_0x1b0ba0,_0x4cfd14){var _0x5eb155={};var _0x281c58={'user':_0x3424ee['username'],'pass':_0x3424ee['password']};var _0x279aaa='sysparm_limit=1';var _0x12da71=_0x90e1('0x54');_0x3424ee[_0x90e1('0x55')]=intUtil['stripTrailingSlash'](_0x3424ee['remoteUri']);_0x3424ee[_0x90e1('0x56')]=intUtil['stripTrailingSlash'](_0x3424ee[_0x90e1('0x56')]);var _0x58f2e4=util['format'](_0x90e1('0x57'),_0x3424ee['remoteUri']);_0x5eb155[_0x90e1('0x15')]=!_[_0x90e1('0x58')](_0x22dc8a)?_0x22dc8a[_0x90e1('0x59')]:null;_0x5eb155[_0x90e1('0x1d')]=_0x3424ee['email'];_0x5eb155['endUserNumber']=_0x4cfd14[_0x90e1('0x30')]()===_0x90e1('0x3b')?_0x1ef31d[_0x90e1('0x5a')]:_0x1ef31d[_0x90e1('0x5b')];_0x5eb155[_0x90e1('0x5c')]=_0x4cfd14===_0x90e1('0x5d')||_0x4cfd14===_0x90e1('0x5e')?_0x90e1('0x5d'):_0x90e1('0x3b');var _0x1bebba=util['format'](_0x90e1('0x5f'),_0x3424ee[_0x90e1('0x56')],_0x1ef31d[_0x90e1('0x60')],md5(_0x1ef31d[_0x90e1('0x60')]));if(_0x45d461&&_0x45d461[_0x90e1('0x61')]){logger['info'](_0x90e1('0x62'),_0x90e1('0x63'));_0x1ef31d[_0x90e1('0x64')]=_0x1bebba;}else if(_0x1b0ba0&&_0x1b0ba0[_0x90e1('0x65')]&&_0x1b0ba0['recordingFormat']!==_0x90e1('0x66')){logger[_0x90e1('0xd')](_0x90e1('0x67'),'Recording\x20is\x20enabled!');_0x1ef31d[_0x90e1('0x64')]=_0x1bebba;}else{_0x1ef31d[_0x90e1('0x64')]='';}return getAdminUser(_0x4cfd14,_0x281c58,_0x5eb155,_0x58f2e4,_0x12da71,_0x279aaa)[_0x90e1('0x18')](getUser(_0x4cfd14,_0x281c58,_0x58f2e4,_0x12da71,_0x279aaa))[_0x90e1('0x18')](getEndUser(_0x4cfd14,_0x281c58,_0x58f2e4,_0x12da71,_0x279aaa))[_0x90e1('0x18')](getTicket(_0x4cfd14,_0x281c58,_0x58f2e4,_0x2ddb01,_0x1ef31d,_0x12da71))[_0x90e1('0x18')](function(_0x32ea93){logger['info'](util[_0x90e1('0x68')](_0x90e1('0x69'),_0x32ea93['ticketId']));logger[_0x90e1('0xd')](util[_0x90e1('0x68')](_0x90e1('0x6a'),_0x4cfd14));if(_0x4cfd14!=='unmanaged'){logger[_0x90e1('0xd')]('['+[_0x4cfd14[_0x90e1('0xe')]()]+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x3424ee['remoteUri'],_0x22dc8a[_0x90e1('0x39')],_0x32ea93[_0x90e1('0x41')]);}})[_0x90e1('0x10')](function(_0x5d79ca){logger[_0x90e1('0x11')]('['+[_0x4cfd14['toUpperCase']()]+']\x20Error\x20running\x20ServiceNow\x20integration',util[_0x90e1('0x6b')](_0x5d79ca,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x52a3=['label_entry','Incident','ticketId','forEach','push','all','Tags','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','format','user:%s','trigger:browser:url','password','sysparm_limit=1','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','%s/api/now/table/','calleridnum','callDirection','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','Recording\x20is\x20enabled!','none','[OUTBOUND]','recordingURL','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','request-promise','util','md5','../../../../config/environment','../../../../config/logger','servicenow','redis','defaults','localhost','sys_user?sysparm_query=user_name%3Dadmin','then','adminId','result','sys_id','info','toUpperCase','],\x20getAdminUser\x20crm','error','message','],\x20getUser\x20input\x20crm','validateEmail','userEmail','sys_user?sysparm_query=email%3D','length','active','true','adminEmail','catch',']\x20using\x20admin\x20profile','userId','],\x20createEndUser\x20input\x20crm','POST','sys_user?','endUserNumber','user','System','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','GET','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','includes','picklist','nameField','toLowerCase','type','idField','customField','toString','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','incident','assign','Subjects','getString','Descriptions',']\x20POST\x20incident\x20entity\x20schema','ticketNumber','number',']\x20getTicket\x20crm','label'];(function(_0x186dca,_0xa039bc){var _0x210191=function(_0x17c9b1){while(--_0x17c9b1){_0x186dca['push'](_0x186dca['shift']());}};_0x210191(++_0xa039bc);}(_0x52a3,0x88));var _0x352a=function(_0x42f1a8,_0x5cf392){_0x42f1a8=_0x42f1a8-0x0;var _0x2047a9=_0x52a3[_0x42f1a8];return _0x2047a9;};'use strict';var _=require('lodash');var Promise=require('bluebird');var rp=require(_0x352a('0x0'));var util=require(_0x352a('0x1'));var md5=require(_0x352a('0x2'));var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0x352a('0x3'));var logger=require(_0x352a('0x4'))(_0x352a('0x5'));config[_0x352a('0x6')]=_[_0x352a('0x7')](config[_0x352a('0x6')],{'host':_0x352a('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x352a('0x6')]));function getAdminUser(_0x282de4,_0x22d42f,_0x3379c7,_0x2dd6ba,_0x5bdc05,_0x520d70){return new Promise(function(_0x5c0a72,_0x18d225){var _0x2d8eff={'method':'GET','uri':_0x2dd6ba+_0x352a('0x9')+'&'+_0x5bdc05+'&'+_0x520d70,'auth':_0x22d42f,'json':!![]};return rp(_0x2d8eff)[_0x352a('0xa')](function(_0x3ca5d3){if(_0x3ca5d3['result']['length']>0x0){_0x3379c7[_0x352a('0xb')]=_0x3ca5d3[_0x352a('0xc')][0x0][_0x352a('0xd')];}logger[_0x352a('0xe')]('['+[_0x282de4[_0x352a('0xf')]()]+_0x352a('0x10'),_0x3379c7);_0x5c0a72(_0x3379c7);})['catch'](function(_0x573a82){logger[_0x352a('0x11')]('['+[_0x282de4[_0x352a('0xf')]()]+']',_0x573a82[_0x352a('0x12')]);_0x18d225(_0x573a82['message']);});});}function getUser(_0x551637,_0x23ffda,_0x2cfcc2,_0x1da3db,_0x1042ad){return function(_0x3c0625){logger[_0x352a('0xe')]('['+[_0x551637[_0x352a('0xf')]()]+_0x352a('0x13'),_0x3c0625);return new Promise(function(_0x170df8,_0x2252d5){if(intUtil[_0x352a('0x14')](_0x3c0625[_0x352a('0x15')])){var _0x5ab016={'method':'GET','uri':_0x2cfcc2+_0x352a('0x16')+_0x3c0625['userEmail']+'&'+_0x1da3db+'&'+_0x1042ad,'auth':_0x23ffda,'json':!![]};logger[_0x352a('0xe')]('['+[_0x551637[_0x352a('0xf')]()]+'],\x20getUser\x20rp\x20obj',_0x5ab016);return rp(_0x5ab016)[_0x352a('0xa')](function(_0x4a9223){logger[_0x352a('0xe')]('['+[_0x551637[_0x352a('0xf')]()]+'],\x20getUser\x20entity',_0x4a9223);if(_0x4a9223[_0x352a('0xc')][_0x352a('0x17')]>0x0&&String(_0x4a9223[_0x352a('0xc')][0x0][_0x352a('0x18')])===_0x352a('0x19')){_0x3c0625['userId']=_0x4a9223[_0x352a('0xc')][0x0]['sys_id'];}else{_0x3c0625['userId']=_0x3c0625['adminId'];_0x3c0625['userEmail']=_0x3c0625[_0x352a('0x1a')];}logger['info']('['+[_0x551637[_0x352a('0xf')]()]+'],\x20getUser\x20crm',_0x3c0625);_0x170df8(_0x3c0625);})[_0x352a('0x1b')](function(_0x83ef0b){logger[_0x352a('0x11')]('['+[_0x551637[_0x352a('0xf')]()]+']',_0x83ef0b[_0x352a('0x12')]);_0x2252d5(_0x83ef0b['message']);});}else{logger[_0x352a('0xe')]('['+[_0x551637[_0x352a('0xf')]()]+_0x352a('0x1c'));_0x3c0625[_0x352a('0x1d')]=_0x3c0625[_0x352a('0xb')];_0x3c0625[_0x352a('0x15')]=_0x3c0625[_0x352a('0x1a')];_0x170df8(_0x3c0625);}});};}function createEndUser(_0xa80ff9,_0x3ad828,_0x23ccf0,_0xae8654,_0x4f2b92){logger[_0x352a('0xe')]('['+[_0xa80ff9[_0x352a('0xf')]()]+_0x352a('0x1e'),_0x23ccf0);return new Promise(function(_0x2ba5ff,_0x4fdc15){var _0x1eb3b9={'method':_0x352a('0x1f'),'uri':_0xae8654+_0x352a('0x20')+_0x4f2b92,'body':{'user_name':_0x23ccf0[_0x352a('0x21')],'roles':_0x352a('0x22'),'first_name':_0x23ccf0[_0x352a('0x21')],'active':'true','date_format':_0x352a('0x23'),'phone':_0x23ccf0[_0x352a('0x21')]},'auth':_0x3ad828,'json':!![]};return rp(_0x1eb3b9)[_0x352a('0xa')](function(_0x438e88){logger['info']('['+[_0xa80ff9[_0x352a('0xf')]()]+_0x352a('0x24'),_0x438e88[_0x352a('0xc')]);_0x23ccf0[_0x352a('0x25')]=_0x438e88[_0x352a('0xc')]['sys_id'];_0x2ba5ff(_0x23ccf0);})['catch'](function(_0x1c502b){logger[_0x352a('0x11')]('['+[_0xa80ff9[_0x352a('0xf')]()]+']',_0x1c502b[_0x352a('0x12')]);_0x4fdc15(_0x1c502b[_0x352a('0x12')]);});});}function getEndUser(_0x18b09f,_0x5848c6,_0x12442d,_0x197c96,_0x5dee85){return function(_0x17e11d){logger[_0x352a('0xe')]('['+[_0x18b09f[_0x352a('0xf')]()]+_0x352a('0x26'),_0x17e11d);return new Promise(function(_0x3c486a,_0x37dcfa){var _0x1d2d60={'method':_0x352a('0x27'),'uri':_0x12442d+_0x352a('0x28')+_0x17e11d[_0x352a('0x21')]+'&'+_0x197c96+'&'+_0x5dee85,'auth':_0x5848c6,'json':!![]};return rp(_0x1d2d60)[_0x352a('0xa')](function(_0x3b71ab){if(_0x3b71ab[_0x352a('0xc')]['length']>0x0){_0x17e11d[_0x352a('0x25')]=_0x3b71ab[_0x352a('0xc')][0x0][_0x352a('0xd')];logger[_0x352a('0xe')]('['+[_0x18b09f[_0x352a('0xf')]()]+_0x352a('0x29'),_0x17e11d);_0x3c486a(_0x17e11d);}else{return createEndUser(_0x18b09f,_0x5848c6,_0x17e11d,_0x12442d,_0x197c96)['then'](function(_0x5159f9){logger[_0x352a('0xe')]('['+[_0x18b09f[_0x352a('0xf')]()]+'],\x20createEndUser\x20crm',_0x5159f9);_0x3c486a(_0x5159f9);});}})[_0x352a('0x1b')](function(_0x391451){logger[_0x352a('0x11')]('['+[_0x18b09f[_0x352a('0xf')]()]+']',_0x391451['message']);_0x37dcfa(_0x391451[_0x352a('0x12')]);});});};}function getCustomFields(_0x373e32,_0x1fc8c2){var _0x36dbd2={};if(_0x373e32[_0x352a('0x17')]>0x0){_['forEach'](_0x373e32,function(_0x12bc73){if(_[_0x352a('0x2a')](['string',_0x352a('0x2b')],_0x12bc73['type'])&&_0x12bc73[_0x352a('0x2c')]&&!_0x12bc73['customField']){_0x36dbd2[_0x12bc73[_0x352a('0x2c')][_0x352a('0x2d')]()]=_0x12bc73['content']['toString']();}else if(_[_0x352a('0x2a')](['string','picklist'],_0x12bc73[_0x352a('0x2e')])&&_0x12bc73[_0x352a('0x2f')]&&_0x12bc73[_0x352a('0x30')]){_0x36dbd2[_0x12bc73[_0x352a('0x2f')][_0x352a('0x2d')]()]=_0x12bc73['content'][_0x352a('0x31')]();}else if(_0x12bc73['type']==='variable'&&_0x12bc73[_0x352a('0x32')]&&_0x12bc73[_0x352a('0x2f')]&&_0x12bc73['customField']){_0x36dbd2[_0x12bc73[_0x352a('0x2f')]['toLowerCase']()]=_0x1fc8c2[_0x12bc73[_0x352a('0x32')]][_0x352a('0x31')]();}else if(_0x12bc73[_0x352a('0x2e')]===_0x352a('0x33')&&_0x12bc73['Variable']&&_0x12bc73[_0x352a('0x34')][_0x352a('0x35')]&&_0x12bc73[_0x352a('0x2f')]&&_0x12bc73[_0x352a('0x30')]){_0x36dbd2[_0x12bc73[_0x352a('0x2f')][_0x352a('0x2d')]()]=_0x1fc8c2[_0x12bc73[_0x352a('0x34')][_0x352a('0x35')]['toLowerCase']()]['toString']();}});}return _0x36dbd2;}function getTicket(_0x1da8f5,_0x4a7790,_0x37144a,_0x1c4250,_0x5c4e95,_0x4f0482){return function(_0x59c286){logger['info']('['+[_0x1da8f5[_0x352a('0xf')]()]+_0x352a('0x36'),_0x59c286);return new Promise(function(_0xb6dfbb,_0x44dd82){var _0x11acd0=_0x1da8f5[_0x352a('0x2d')]()===_0x352a('0x37')?_0x59c286[_0x352a('0x1d')]:_0x59c286['endUserId'];var _0x272acb={'method':_0x352a('0x1f'),'uri':_0x37144a+_0x352a('0x38')+'?'+_0x4f0482,'body':Object[_0x352a('0x39')]({},{'active':'true','caller_id':_0x11acd0,'assigned_to':_0x59c286[_0x352a('0x1d')],'short_description':intUtil['getString'](_0x1c4250[_0x352a('0x3a')],_0x5c4e95,'\x20'),'description':intUtil[_0x352a('0x3b')](_0x1c4250[_0x352a('0x3c')],_0x5c4e95,'\x0a')},getCustomFields(_0x1c4250['Fields'],_0x5c4e95)),'auth':_0x4a7790,'json':!![]};return rp(_0x272acb)[_0x352a('0xa')](function(_0x5f1b09){logger['info']('['+[_0x1da8f5['toUpperCase']()]+_0x352a('0x3d'),_0x5f1b09[_0x352a('0xc')]);_0x59c286['ticketId']=_0x5f1b09[_0x352a('0xc')][_0x352a('0xd')];_0x59c286[_0x352a('0x3e')]=_0x5f1b09[_0x352a('0xc')][_0x352a('0x3f')];logger['info']('['+[_0x1da8f5[_0x352a('0xf')]()]+_0x352a('0x40'),_0x59c286);_0xb6dfbb(_0x59c286);})['catch'](function(_0x3ad709){logger['error']('['+[_0x1da8f5[_0x352a('0xf')]()]+']',_0x3ad709[_0x352a('0x12')]);_0x44dd82(_0x3ad709[_0x352a('0x12')]);});});};}function createRemoteTag(_0x562cc0,_0x36ebb3,_0x12ed98,_0x46bb16){return new Promise(function(_0x5e40ee,_0x28aca1){var _0x2ca638={'method':'POST','uri':_0x12ed98+_0x352a('0x41')+'?'+_0x46bb16,'body':{'short_description':_0x562cc0,'global':!![],'active':!![],'name':_0x562cc0},'auth':_0x36ebb3,'json':!![]};return rp(_0x2ca638)[_0x352a('0xa')](function(_0x221c3a){var _0x38b8da=_0x221c3a[_0x352a('0xc')][_0x352a('0xd')];_0x5e40ee(_0x38b8da);});});}function getRemoteTag(_0x27fa34,_0x41aaf8,_0xb4dcaf,_0x174300,_0x389e02){return new Promise(function(_0x3bad0e,_0x2c9283){var _0x1adbd0={'method':_0x352a('0x27'),'uri':_0xb4dcaf+_0x352a('0x41')+'?sysparm_query=name%3D'+_0x27fa34+'&'+_0x174300,'auth':_0x41aaf8,'json':!![]};return rp(_0x1adbd0)[_0x352a('0xa')](function(_0x223fc7){if(_0x223fc7[_0x352a('0xc')][_0x352a('0x17')]>0x0){var _0x499591=_0x223fc7['result'][0x0][_0x352a('0xd')];_0x3bad0e(_0x499591);}else{return createRemoteTag(_0x27fa34,_0x41aaf8,_0xb4dcaf,_0x174300)[_0x352a('0xa')](function(_0x33e6ed){_0x3bad0e(_0x33e6ed);});}});});}function assignTagToIncident(_0x253226,_0x3f1204,_0x4a2ab5,_0x967077,_0x7811af){return new Promise(function(_0x62ac3d,_0x1dd26b){var _0x4944f4={'method':_0x352a('0x1f'),'uri':_0x4a2ab5+_0x352a('0x42')+'?'+_0x7811af,'body':{'label':_0x253226,'table':_0x352a('0x38'),'id_type':_0x352a('0x43'),'table_key':_0x967077[_0x352a('0x44')],'title':'Incident\x20-\x20'+_0x967077['ticketNumber'],'id_display':_0x967077[_0x352a('0x3e')]},'auth':_0x3f1204,'json':!![]};return rp(_0x4944f4)[_0x352a('0xa')](function(_0x2c5c68){_0x62ac3d();})[_0x352a('0x1b')](function(){_0x62ac3d();});});}function manageTags(_0x56cff5,_0x35411e,_0x165a2d,_0x278888,_0x233526,_0x109867,_0x197ae4){return new Promise(function(_0x4c4e99,_0x1375b0){var _0x496405=[];_0x35411e[_0x352a('0x45')](function(_0x52ac4e){_0x496405[_0x352a('0x46')](getRemoteTag(_0x52ac4e,_0x165a2d,_0x278888,_0x109867,_0x197ae4));});return Promise[_0x352a('0x47')](_0x496405)[_0x352a('0xa')](function(_0x51b9e2){if(_0x51b9e2[_0x352a('0x17')]){logger[_0x352a('0xe')]('['+[_0x56cff5[_0x352a('0xf')]()]+']\x20arrayPromises:\x20IDs\x20in\x20table\x20label',_0x51b9e2);var _0x587d15=[];_0x51b9e2['forEach'](function(_0xaacc21){_0x587d15['push'](assignTagToIncident(_0xaacc21,_0x165a2d,_0x278888,_0x233526,_0x109867));});return Promise[_0x352a('0x47')](_0x587d15)['then'](function(){_0x4c4e99();})[_0x352a('0x1b')](function(){_0x4c4e99();});}else{_0x4c4e99();}});});}function getTags(_0x27579e,_0x1c9627,_0x47fbfc,_0x42d7b3,_0x4aefd9,_0x32bbb6){return function(_0x14b3f0){return new Promise(function(_0x40d092,_0x422f98){var _0x492549=[];var _0x5a45e2=_0x42d7b3[_0x352a('0x48')];if(_0x5a45e2&&_0x5a45e2[_0x352a('0x17')]>0x0){_0x492549=_[_0x352a('0x49')](_0x5a45e2,_0x352a('0x35'));}if(_0x492549[_0x352a('0x17')]>0x0){return manageTags(_0x27579e,_0x492549,_0x1c9627,_0x47fbfc,_0x14b3f0,_0x4aefd9,_0x32bbb6)['then'](function(){_0x40d092(_0x14b3f0);});}else{_0x40d092(_0x14b3f0);}});};}function emit(_0xb1de39,_0x2f98d3,_0x246e19){var _0x5311ce=_0x352a('0x4a')+_0x352a('0x4b')+_0x352a('0x4c')+'%255EORDERBYDESCnumber';var _0x530425={'uri':_0xb1de39+'/nav_to.do?uri=incident.do?sys_id%3D'+_0x246e19+_0x5311ce};io['to'](util[_0x352a('0x4d')](_0x352a('0x4e'),_0x2f98d3))['emit'](_0x352a('0x4f'),_0x530425);}exports['cs']=function(_0x13d2d3,_0xdcd7bf,_0x3e2e5d,_0xf38eeb,_0x132546,_0x22010b,_0x15de21,_0x47046e){var _0x5d97ae={};var _0x43ed17={'user':_0x22010b['username'],'pass':_0x22010b[_0x352a('0x50')]};var _0x40e876=_0x352a('0x51');var _0x56f4c1=_0x352a('0x52');_0x22010b[_0x352a('0x53')]=intUtil['stripTrailingSlash'](_0x22010b['remoteUri']);_0x22010b['serverUrl']=intUtil[_0x352a('0x54')](_0x22010b[_0x352a('0x55')]);var _0x18b6f4=util[_0x352a('0x4d')](_0x352a('0x56'),_0x22010b[_0x352a('0x53')]);_0x5d97ae[_0x352a('0x15')]=!_['isNil'](_0xf38eeb)?_0xf38eeb['email']:null;_0x5d97ae[_0x352a('0x1a')]=_0x22010b['email'];_0x5d97ae[_0x352a('0x21')]=_0x47046e[_0x352a('0x2d')]()===_0x352a('0x37')?_0xdcd7bf['destcalleridnum']:_0xdcd7bf[_0x352a('0x57')];_0x5d97ae[_0x352a('0x58')]=_0x47046e==='queue'||_0x47046e===_0x352a('0x59')?'queue':'outbound';var _0x329ce5=util[_0x352a('0x4d')](_0x352a('0x5a'),_0x22010b['serverUrl'],_0xdcd7bf[_0x352a('0x5b')],md5(_0xdcd7bf['uniqueid']));if(_0x132546&&_0x132546[_0x352a('0x5c')]){logger[_0x352a('0xe')]('[QUEUE]',_0x352a('0x5d'));_0xdcd7bf['recordingURL']=_0x329ce5;}else if(_0x15de21&&_0x15de21['recordingFormat']&&_0x15de21['recordingFormat']!==_0x352a('0x5e')){logger['info'](_0x352a('0x5f'),_0x352a('0x5d'));_0xdcd7bf['recordingURL']=_0x329ce5;}else{_0xdcd7bf[_0x352a('0x60')]='';}return getAdminUser(_0x47046e,_0x43ed17,_0x5d97ae,_0x18b6f4,_0x56f4c1,_0x40e876)[_0x352a('0xa')](getUser(_0x47046e,_0x43ed17,_0x18b6f4,_0x56f4c1,_0x40e876))[_0x352a('0xa')](getEndUser(_0x47046e,_0x43ed17,_0x18b6f4,_0x56f4c1,_0x40e876))[_0x352a('0xa')](getTicket(_0x47046e,_0x43ed17,_0x18b6f4,_0x3e2e5d,_0xdcd7bf,_0x56f4c1))[_0x352a('0xa')](function(_0x5c67bd){logger[_0x352a('0xe')](util[_0x352a('0x4d')]('The\x20ticket\x20ID\x20is:\x20%s',_0x5c67bd[_0x352a('0x44')]));logger[_0x352a('0xe')](util['format'](_0x352a('0x61'),_0x47046e));if(_0x47046e!==_0x352a('0x59')){logger[_0x352a('0xe')]('['+[_0x47046e[_0x352a('0xf')]()]+']',_0x352a('0x62'));emit(_0x22010b[_0x352a('0x53')],_0xf38eeb[_0x352a('0x35')],_0x5c67bd[_0x352a('0x44')]);}})[_0x352a('0x1b')](function(_0x476c2f){logger[_0x352a('0x11')]('['+[_0x47046e[_0x352a('0xf')]()]+_0x352a('0x63'),util[_0x352a('0x64')](_0x476c2f,{'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 17fb1e6..3a8ee69 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 _0xa4fd=['replace','duration_hours','duration_minutes','parent_type','Contacts','parent_name','direction','forEach','variableName','push','idField','set_entry','JSON','stringify','Calls','Basic\x20%s','base64','get_server_info','Getting\x20agent\x20with\x20name','get_entry_list','Employees','format','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','then','entry_list','find','user_name','value','Agent\x20found!','resolve','name_value_list','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','length','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','Enduser\x20created.','debug','[HTTP]','merge','map','nameField','customField','toLowerCase','content','toString','type','custom_fields','variable','Variable','username','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','queue','remoteUri','serverUrl','stripTrailingSlash','uri','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','Inbound','The\x20Ticket\x20ID\x20is:','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','trigger:browser:url','catch','error','outbound','recordingFormat','none','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum','Fields','Outbound','Ticket\x20created!','users','contacts','version','[OUTBOUND]','lastevent','toUpperCase','isNil','calleridnum','lodash','request-promise','bluebird','md5','util','ioredis','./util','../../../../config/environment','sugarcrm','redis','localhost','socket.io-emitter','POST','emit','info','Creating\x20new\x20ticket...','name','getString','Subjects','assigned_user_id','created_by','Descriptions','date_start','toISOString','slice'];(function(_0x13c5a9,_0x547d90){var _0x25f7dc=function(_0x1fe88e){while(--_0x1fe88e){_0x13c5a9['push'](_0x13c5a9['shift']());}};_0x25f7dc(++_0x547d90);}(_0xa4fd,0x161));var _0xda4f=function(_0x582f1c,_0x3c652a){_0x582f1c=_0x582f1c-0x0;var _0x5747b9=_0xa4fd[_0x582f1c];return _0x5747b9;};'use strict';var _=require(_0xda4f('0x0'));var rp=require(_0xda4f('0x1'));var BPromise=require(_0xda4f('0x2'));var md5=require(_0xda4f('0x3'));var util=require(_0xda4f('0x4'));var Redis=require(_0xda4f('0x5'));var intUtil=require(_0xda4f('0x6'));var config=require(_0xda4f('0x7'));var logger=require('../../../../config/logger')(_0xda4f('0x8'));config['redis']=_['defaults'](config[_0xda4f('0x9')],{'host':_0xda4f('0xa'),'port':0x18eb});var io=require(_0xda4f('0xb'))(new Redis(config[_0xda4f('0x9')]));var def={'method':_0xda4f('0xc'),'json':!![]};function emit(_0x2c837e,_0x1519d4,_0xf76943){io['to'](_0x2c837e)[_0xda4f('0xd')](_0x1519d4,_0xf76943);}function getTicket(_0x2bdfe5,_0x4efe19,_0x112202,_0x16ea27,_0x11c921,_0x10a663,_0x21cd44,_0x58c958){logger[_0xda4f('0xe')](_0xda4f('0xf'));var _0x1b1071=new Date();var _0x40ad83=[{'name':_0xda4f('0x10'),'value':intUtil[_0xda4f('0x11')](_0x16ea27[_0xda4f('0x12')],_0x11c921,'\x20')},{'name':_0xda4f('0x13'),'value':_0x4efe19['id']},{'name':_0xda4f('0x14'),'value':_0x4efe19['id']},{'name':'description','value':intUtil[_0xda4f('0x11')](_0x16ea27[_0xda4f('0x15')],_0x11c921,'\x0a')},{'name':_0xda4f('0x16'),'value':_0x1b1071[_0xda4f('0x17')]()[_0xda4f('0x18')](0x0,0x13)[_0xda4f('0x19')]('T','\x20')},{'name':_0xda4f('0x1a'),'value':'0'},{'name':_0xda4f('0x1b'),'value':'15'},{'name':'parent_id','value':_0x112202['id']},{'name':_0xda4f('0x1c'),'value':_0xda4f('0x1d')},{'name':_0xda4f('0x1e'),'value':_0x112202['name']},{'name':_0xda4f('0x1f'),'value':_0x58c958}];if(_0x10a663['length']){_[_0xda4f('0x20')](_0x10a663,function(_0x32270d){if(_0x11c921[_0x32270d[_0xda4f('0x21')]]){_0x40ad83[_0xda4f('0x22')]({'name':_0x32270d[_0xda4f('0x23')],'value':_0x11c921[_0x32270d[_0xda4f('0x21')]]});}});}return request({'form':{'method':_0xda4f('0x24'),'input_type':_0xda4f('0x25'),'response_type':_0xda4f('0x25'),'rest_data':JSON[_0xda4f('0x26')]({'session':_0x21cd44['id'],'module_name':_0xda4f('0x27'),'name_value_list':_0x40ad83})}});}function getAuth(_0x262bbe){return util['format'](_0xda4f('0x28'),new Buffer(_0x262bbe['apiKey']+':X')['toString'](_0xda4f('0x29')));}function getServerInfo(_0x251d46){return request({'form':{'method':_0xda4f('0x2a'),'input_type':_0xda4f('0x25'),'response_type':_0xda4f('0x25'),'rest_data':JSON[_0xda4f('0x26')]({'session':_0x251d46['id']})}});}function getUser(_0x247234,_0x44accb,_0x2b5217){if(!_['isNil'](_0x44accb)){logger['info'](_0xda4f('0x2b'),_0x44accb);return request({'form':{'method':_0xda4f('0x2c'),'input_type':'JSON','response_type':_0xda4f('0x25'),'rest_data':JSON[_0xda4f('0x26')]({'session':_0x2b5217['id'],'module_name':_0xda4f('0x2d'),'query':util[_0xda4f('0x2e')](_0xda4f('0x2f'),_0x44accb),'order_by':'','offset':'0','select_fields':['id',_0xda4f('0x10'),'user_name'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xda4f('0x30')](function(_0x416791){if(_0x416791[_0xda4f('0x31')]['length']){var _0x5945a6=_[_0xda4f('0x32')](_0x416791[_0xda4f('0x31')],function(_0x24e491){return _0x24e491['name_value_list'][_0xda4f('0x33')][_0xda4f('0x34')]===_0x44accb;});if(_0x5945a6){logger[_0xda4f('0xe')](_0xda4f('0x35'));return BPromise[_0xda4f('0x36')]({'id':_0x5945a6[_0xda4f('0x37')]['id']['value'],'name':_0x5945a6[_0xda4f('0x37')]['name'][_0xda4f('0x34')]});}}logger[_0xda4f('0xe')](_0xda4f('0x38'));return BPromise[_0xda4f('0x36')]({'id':_0x2b5217[_0xda4f('0x37')][_0xda4f('0x39')][_0xda4f('0x34')],'name':_0x2b5217[_0xda4f('0x37')]['user_name'][_0xda4f('0x34')]});});}else{logger[_0xda4f('0xe')](_0xda4f('0x3a'));return BPromise[_0xda4f('0x36')]({'id':_0x2b5217[_0xda4f('0x37')][_0xda4f('0x39')][_0xda4f('0x34')],'name':_0x2b5217['name_value_list'][_0xda4f('0x33')][_0xda4f('0x34')]});}}function getEndUser(_0x3dd5e4,_0x3c2cb5,_0x2a8b77,_0x3dbdd7){logger[_0xda4f('0xe')](_0xda4f('0x3b'),_0x2a8b77);return request({'form':{'method':_0xda4f('0x2c'),'input_type':_0xda4f('0x25'),'response_type':_0xda4f('0x25'),'rest_data':JSON[_0xda4f('0x26')]({'session':_0x3dbdd7['id'],'module_name':_0xda4f('0x1d'),'query':util[_0xda4f('0x2e')](_0xda4f('0x3c'),_0x2a8b77),'order_by':'','offset':'0','select_fields':['id',_0xda4f('0x10'),_0xda4f('0x3d')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xda4f('0x30')](function(_0x954edf){if(_0x954edf[_0xda4f('0x31')][_0xda4f('0x3e')]){var _0x193ed1=_[_0xda4f('0x32')](_0x954edf['entry_list'],function(_0x24984a){return _0x24984a['name_value_list'][_0xda4f('0x3d')][_0xda4f('0x34')]===_0x2a8b77;});if(_0x193ed1){logger[_0xda4f('0xe')]('Enduser\x20found!');return BPromise[_0xda4f('0x36')]({'id':_0x193ed1['name_value_list']['id'][_0xda4f('0x34')],'name':_0x193ed1[_0xda4f('0x37')][_0xda4f('0x10')][_0xda4f('0x34')],'phone':_0x193ed1[_0xda4f('0x37')][_0xda4f('0x3d')][_0xda4f('0x34')]});}}else{logger[_0xda4f('0xe')](_0xda4f('0x3f'));return request({'form':{'method':_0xda4f('0x24'),'input_type':_0xda4f('0x25'),'response_type':'JSON','rest_data':JSON[_0xda4f('0x26')]({'session':_0x3dbdd7['id'],'module_name':_0xda4f('0x1d'),'name_value_list':[{'name':_0xda4f('0x40'),'value':_0x3c2cb5!==''?_0x3c2cb5:util[_0xda4f('0x2e')]('Caller\x20-\x20%s',_0x2a8b77)},{'name':_0xda4f('0x3d'),'value':_0x2a8b77}]})}})[_0xda4f('0x30')](function(_0x531334){logger[_0xda4f('0xe')](_0xda4f('0x41'));return BPromise[_0xda4f('0x36')]({'id':_0x531334['id'],'name':_0x531334['entry_list'][_0xda4f('0x40')][_0xda4f('0x34')],'phone':_0x531334[_0xda4f('0x31')]['phone_home'][_0xda4f('0x34')]});});}});}function request(_0x14370f){logger[_0xda4f('0x42')](_0xda4f('0x43'),JSON[_0xda4f('0x26')](_0x14370f));return rp(_[_0xda4f('0x44')](def,_0x14370f));}function getTags(_0x2e9aab,_0x680cc0){var _0x4290d2=[];if(_0x2e9aab&&_0x2e9aab[_0xda4f('0x3e')]>0x0){_0x4290d2=_[_0xda4f('0x45')](_0x2e9aab,_0x680cc0);}return _0x4290d2;}function getCustomFields(_0x44e952,_0x4ae696){var _0x38c32d=[];var _0x1551c7={'custom_fields':[]};if(_0x44e952[_0xda4f('0x3e')]>0x0){_['forEach'](_0x44e952,function(_0xe94aa2){if(_0xe94aa2['type']==='string'&&_0xe94aa2[_0xda4f('0x46')]&&!_0xe94aa2[_0xda4f('0x47')]){_0x1551c7[_0xe94aa2[_0xda4f('0x46')][_0xda4f('0x48')]()]=_0xe94aa2[_0xda4f('0x49')][_0xda4f('0x4a')]();}else if(_0xe94aa2[_0xda4f('0x4b')]==='string'&&_0xe94aa2['idField']&&_0xe94aa2[_0xda4f('0x47')]){_0x1551c7[_0xda4f('0x4c')][_0xda4f('0x22')]({'id':_0xe94aa2[_0xda4f('0x23')],'value':_0xe94aa2[_0xda4f('0x49')][_0xda4f('0x4a')]()});}else if(_0xe94aa2[_0xda4f('0x4b')]===_0xda4f('0x4d')&&_0xe94aa2['variableName']&&_0xe94aa2[_0xda4f('0x23')]&&_0xe94aa2['customField']){_0x4ae696[_0xe94aa2[_0xda4f('0x21')]]&&_0x1551c7[_0xda4f('0x4c')][_0xda4f('0x22')]({'id':_0xe94aa2[_0xda4f('0x23')],'value':_0x4ae696[_0xe94aa2[_0xda4f('0x21')]][_0xda4f('0x4a')]()});}else if(_0xe94aa2[_0xda4f('0x4b')]==='customVariable'&&_0xe94aa2[_0xda4f('0x4e')]&&_0xe94aa2[_0xda4f('0x4e')]['name']&&_0xe94aa2[_0xda4f('0x23')]&&_0xe94aa2[_0xda4f('0x47')]){_0x4ae696[_0xe94aa2[_0xda4f('0x4e')][_0xda4f('0x10')][_0xda4f('0x48')]()]&&_0x1551c7[_0xda4f('0x4c')][_0xda4f('0x22')]({'id':_0xe94aa2['idField'],'value':_0x4ae696[_0xe94aa2[_0xda4f('0x4e')][_0xda4f('0x10')]['toLowerCase']()][_0xda4f('0x4a')]()});}});}return _0x1551c7;}function getConnection(_0x47edbb){return request({'method':_0xda4f('0xc'),'form':{'method':'login','input_type':_0xda4f('0x25'),'response_type':_0xda4f('0x25'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x47edbb[_0xda4f('0x4f')],'password':_0x47edbb[_0xda4f('0x50')],'encryption':_0xda4f('0x51')},'application':_0xda4f('0x52')})}})[_0xda4f('0x30')](function(_0x4513de){var _0xdb32=_0x4513de;if(_0xdb32['id']){def[_0xda4f('0x53')]=_0xdb32['id'];return BPromise[_0xda4f('0x36')](_0xdb32);}else{throw new Error(util[_0xda4f('0x2e')](_0xda4f('0x54'),_0x47edbb['id']));}});}function setRelationship(_0x1afd91,_0x2ef2a5,_0x849c85,_0x16efc1){return request({'form':{'method':'set_relationship','input_type':_0xda4f('0x25'),'response_type':_0xda4f('0x25'),'rest_data':JSON[_0xda4f('0x26')]({'session':_0x1afd91['id'],'module_name':_0xda4f('0x27'),'module_id':_0x849c85['id'],'link_field_name':_0x16efc1,'related_ids':[_0x2ef2a5['id']],'name_value_list':[],'delete':0x0})}});}exports[_0xda4f('0x55')]=function(_0x2a8a3b,_0x56c882,_0x2d73e2,_0x3394ee,_0x52a103,_0x296d71){var _0x2b05e0,_0xa6626d,_0x3f0b92,_0x85c368;_0x296d71[_0xda4f('0x56')]=intUtil['stripTrailingSlash'](_0x296d71[_0xda4f('0x56')]);_0x296d71[_0xda4f('0x57')]=intUtil[_0xda4f('0x58')](_0x296d71[_0xda4f('0x57')]);def[_0xda4f('0x59')]=util[_0xda4f('0x2e')](_0xda4f('0x5a'),_0x296d71[_0xda4f('0x56')]);if(_0x52a103&&_0x52a103[_0xda4f('0x5b')]){logger['info'](_0xda4f('0x5c'),_0xda4f('0x5d'));_0x56c882[_0xda4f('0x5e')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x296d71[_0xda4f('0x57')],_0x56c882['uniqueid'],md5(_0x56c882[_0xda4f('0x5f')]));}else{_0x56c882[_0xda4f('0x5e')]='';}return getConnection(_0x296d71)[_0xda4f('0x30')](function(_0x1833f4){_0x85c368=_0x1833f4;return getUser(_0x296d71,_0x3394ee[_0xda4f('0x10')],_0x85c368);})[_0xda4f('0x30')](function(_0x56818d){_0x2b05e0=_0x56818d;logger[_0xda4f('0xe')](_0xda4f('0x60'),_0x2b05e0['id']);return getEndUser(_0x296d71,_0x56c882[_0xda4f('0x61')],_0x56c882['calleridnum'],_0x85c368);})['then'](function(_0x335e61){_0xa6626d=_0x335e61;logger[_0xda4f('0xe')](_0xda4f('0x62'),_0xa6626d['id']);return getTicket(_0x296d71,_0x2b05e0,_0xa6626d,_0x2d73e2,_0x56c882,_0x2d73e2['Fields'],_0x85c368,_0xda4f('0x63'));})[_0xda4f('0x30')](function(_0x5031da){_0x3f0b92=_0x5031da;logger[_0xda4f('0xe')]('Ticket\x20created!');logger[_0xda4f('0xe')](_0xda4f('0x64'),_0x3f0b92['id']);return setRelationship(_0x85c368,_0x2b05e0,_0x3f0b92,'users');})['then'](function(){return setRelationship(_0x85c368,_0xa6626d,_0x3f0b92,'contacts');})[_0xda4f('0x30')](function(){return getServerInfo(_0x85c368);})[_0xda4f('0x30')](function(_0x4c7a8f){var _0x392d26=parseInt(_0x4c7a8f['version'][_0xda4f('0x65')](0x0));var _0x572f2f=util[_0xda4f('0x2e')](_0xda4f('0x66'),_0x296d71[_0xda4f('0x56')],_0x3f0b92['id']);if(_0x392d26>0x6){_0x572f2f=util[_0xda4f('0x2e')](_0xda4f('0x67'),_0x296d71[_0xda4f('0x56')],_0x3f0b92['id']);}logger[_0xda4f('0xe')](_0xda4f('0x5c'),_0xda4f('0x68'));emit(util[_0xda4f('0x2e')](_0xda4f('0x69'),_0x3394ee[_0xda4f('0x10')]),_0xda4f('0x6a'),{'uri':_0x572f2f});})[_0xda4f('0x6b')](function(_0x1e9593){logger[_0xda4f('0x6c')](_0xda4f('0x5c'),JSON[_0xda4f('0x26')](_0x1e9593));});};exports[_0xda4f('0x6d')]=function(_0x38e359,_0x259779,_0xb6ac80,_0x44a864,_0x98981e,_0xea8593,_0x1c84ff){var _0x1b8033,_0x45f304,_0x135c5b,_0x2f382c;_0xea8593[_0xda4f('0x56')]=intUtil[_0xda4f('0x58')](_0xea8593[_0xda4f('0x56')]);_0xea8593[_0xda4f('0x57')]=intUtil[_0xda4f('0x58')](_0xea8593[_0xda4f('0x57')]);def[_0xda4f('0x59')]=util[_0xda4f('0x2e')](_0xda4f('0x5a'),_0xea8593[_0xda4f('0x56')]);if(_0x1c84ff&&_0x1c84ff['recordingFormat']&&_0x1c84ff[_0xda4f('0x6e')]!==_0xda4f('0x6f')){logger[_0xda4f('0xe')]('[OUTBOUND]',_0xda4f('0x5d'));_0x259779[_0xda4f('0x5e')]=util[_0xda4f('0x2e')](_0xda4f('0x70'),_0xea8593[_0xda4f('0x57')],_0x259779[_0xda4f('0x5f')],md5(_0x259779['uniqueid']));}return getConnection(_0xea8593)['then'](function(_0x1c3c4e){_0x2f382c=_0x1c3c4e;return getUser(_0xea8593,_0x44a864[_0xda4f('0x10')],_0x2f382c);})[_0xda4f('0x30')](function(_0x171263){_0x1b8033=_0x171263;logger['info']('The\x20User\x20ID\x20is:',_0x1b8033['id']);return getEndUser(_0xea8593,_0x259779[_0xda4f('0x71')],_0x259779[_0xda4f('0x72')],_0x2f382c);})[_0xda4f('0x30')](function(_0x1ef6ff){_0x45f304=_0x1ef6ff;logger[_0xda4f('0xe')](_0xda4f('0x62'),_0x45f304['id']);return getTicket(_0xea8593,_0x1b8033,_0x45f304,_0xb6ac80,_0x259779,_0xb6ac80[_0xda4f('0x73')],_0x2f382c,_0xda4f('0x74'));})['then'](function(_0x1e5caf){_0x135c5b=_0x1e5caf;logger[_0xda4f('0xe')](_0xda4f('0x75'));logger[_0xda4f('0xe')](_0xda4f('0x64'),_0x135c5b['id']);return setRelationship(_0x2f382c,_0x1b8033,_0x135c5b,_0xda4f('0x76'));})[_0xda4f('0x30')](function(){return setRelationship(_0x2f382c,_0x45f304,_0x135c5b,_0xda4f('0x77'));})['then'](function(){return getServerInfo(_0x2f382c);})['then'](function(_0x218ca5){var _0x4be179=parseInt(_0x218ca5[_0xda4f('0x78')][_0xda4f('0x65')](0x0));var _0x36b090=util[_0xda4f('0x2e')](_0xda4f('0x66'),_0xea8593['remoteUri'],_0x135c5b['id']);if(_0x4be179>0x6){_0x36b090=util[_0xda4f('0x2e')](_0xda4f('0x67'),_0xea8593['remoteUri'],_0x135c5b['id']);}logger[_0xda4f('0xe')](_0xda4f('0x79'),_0xda4f('0x68'));emit(util[_0xda4f('0x2e')](_0xda4f('0x69'),_0x44a864[_0xda4f('0x10')]),_0xda4f('0x6a'),{'uri':_0x36b090});})[_0xda4f('0x6b')](function(_0x5dc247){logger[_0xda4f('0x6c')]('[OUTBOUND]',JSON[_0xda4f('0x26')](_0x5dc247));});};exports['unmanaged']=function(_0xf88048,_0x5a3126,_0x6725f6,_0x45a692,_0x569e1d,_0x17fad4){var _0x51905b,_0x4e33b9,_0x32f4dc,_0x1d45dd;_0x17fad4[_0xda4f('0x56')]=intUtil[_0xda4f('0x58')](_0x17fad4[_0xda4f('0x56')]);_0x17fad4['serverUrl']=intUtil[_0xda4f('0x58')](_0x17fad4[_0xda4f('0x57')]);def[_0xda4f('0x59')]=util[_0xda4f('0x2e')](_0xda4f('0x5a'),_0x17fad4['remoteUri']);if(_0x569e1d&&_0x569e1d[_0xda4f('0x5b')]){logger[_0xda4f('0xe')]('['+_0x5a3126[_0xda4f('0x7a')][_0xda4f('0x7b')]()+']',_0xda4f('0x5d'));_0x5a3126[_0xda4f('0x5e')]=util[_0xda4f('0x2e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x17fad4[_0xda4f('0x57')],_0x5a3126['uniqueid'],md5(_0x5a3126[_0xda4f('0x5f')]));}else{_0x5a3126[_0xda4f('0x5e')]='';}return getConnection(_0x17fad4)[_0xda4f('0x30')](function(_0x2d1b59){_0x1d45dd=_0x2d1b59;if(!_[_0xda4f('0x7c')](_0x45a692)){return getUser(_0x17fad4,_0x45a692[_0xda4f('0x10')],_0x1d45dd);}else{return getUser(_0x17fad4,null,_0x1d45dd);}})['then'](function(_0x2b9115){_0x51905b=_0x2b9115;logger[_0xda4f('0xe')](_0xda4f('0x60'),_0x51905b['id']);return getEndUser(_0x17fad4,_0x5a3126[_0xda4f('0x61')],_0x5a3126[_0xda4f('0x7d')],_0x1d45dd);})[_0xda4f('0x30')](function(_0x4e3f27){_0x4e33b9=_0x4e3f27;logger[_0xda4f('0xe')]('The\x20Enduser\x20ID\x20is:',_0x4e33b9['id']);return getTicket(_0x17fad4,_0x51905b,_0x4e33b9,_0x6725f6,_0x5a3126,_0x6725f6[_0xda4f('0x73')],_0x1d45dd,_0xda4f('0x63'));})[_0xda4f('0x30')](function(_0x4a8e35){_0x32f4dc=_0x4a8e35;logger['info']('Ticket\x20created!');logger[_0xda4f('0xe')](_0xda4f('0x64'),_0x32f4dc['id']);return setRelationship(_0x1d45dd,_0x51905b,_0x32f4dc,'users');})[_0xda4f('0x30')](function(){return setRelationship(_0x1d45dd,_0x4e33b9,_0x32f4dc,_0xda4f('0x77'));})[_0xda4f('0x30')](function(){return getServerInfo(_0x1d45dd);})['catch'](function(_0x58ea19){logger['error']('['+_0x5a3126['lastevent']['toUpperCase']()+']',JSON[_0xda4f('0x26')](_0x58ea19));});}; \ No newline at end of file +var _0x1a2f=['recordingURL','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','Ticket\x20created!','users','contacts','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','error','outbound','%s/service/v4_1/rest.php','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','Outbound','The\x20Ticket\x20ID\x20is:','unmanaged','lastevent','toUpperCase','catch','lodash','md5','util','ioredis','../../../../config/environment','../../../../config/logger','sugarcrm','redis','defaults','localhost','socket.io-emitter','POST','info','name','getString','Subjects','assigned_user_id','created_by','description','Descriptions','date_start','toISOString','slice','parent_id','Contacts','direction','forEach','variableName','push','idField','set_entry','JSON','stringify','Calls','format','apiKey','base64','get_server_info','Getting\x20agent\x20with\x20name','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','entry_list','length','find','name_value_list','value','Agent\x20found!','resolve','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','phone_home','','Enduser\x20created.','first_name','debug','[HTTP]','merge','map','type','nameField','toLowerCase','content','toString','string','custom_fields','variable','customVariable','Variable','customField','username','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','queue','stripTrailingSlash','serverUrl','uri','remoteUri','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid'];(function(_0x1ac0df,_0x2808a0){var _0x289c0a=function(_0x1c871d){while(--_0x1c871d){_0x1ac0df['push'](_0x1ac0df['shift']());}};_0x289c0a(++_0x2808a0);}(_0x1a2f,0x99));var _0xf1a2=function(_0x39131e,_0x55c088){_0x39131e=_0x39131e-0x0;var _0x47a085=_0x1a2f[_0x39131e];return _0x47a085;};'use strict';var _=require(_0xf1a2('0x0'));var rp=require('request-promise');var BPromise=require('bluebird');var md5=require(_0xf1a2('0x1'));var util=require(_0xf1a2('0x2'));var Redis=require(_0xf1a2('0x3'));var intUtil=require('./util');var config=require(_0xf1a2('0x4'));var logger=require(_0xf1a2('0x5'))(_0xf1a2('0x6'));config[_0xf1a2('0x7')]=_[_0xf1a2('0x8')](config[_0xf1a2('0x7')],{'host':_0xf1a2('0x9'),'port':0x18eb});var io=require(_0xf1a2('0xa'))(new Redis(config['redis']));var def={'method':_0xf1a2('0xb'),'json':!![]};function emit(_0x1f45c2,_0x1d3be6,_0x3db224){io['to'](_0x1f45c2)['emit'](_0x1d3be6,_0x3db224);}function getTicket(_0x420f85,_0x31c229,_0x29b948,_0x34900a,_0x506a6f,_0x45bf65,_0x334944,_0x40445b){logger[_0xf1a2('0xc')]('Creating\x20new\x20ticket...');var _0x7876b8=new Date();var _0x1a2b23=[{'name':_0xf1a2('0xd'),'value':intUtil[_0xf1a2('0xe')](_0x34900a[_0xf1a2('0xf')],_0x506a6f,'\x20')},{'name':_0xf1a2('0x10'),'value':_0x31c229['id']},{'name':_0xf1a2('0x11'),'value':_0x31c229['id']},{'name':_0xf1a2('0x12'),'value':intUtil[_0xf1a2('0xe')](_0x34900a[_0xf1a2('0x13')],_0x506a6f,'\x0a')},{'name':_0xf1a2('0x14'),'value':_0x7876b8[_0xf1a2('0x15')]()[_0xf1a2('0x16')](0x0,0x13)['replace']('T','\x20')},{'name':'duration_hours','value':'0'},{'name':'duration_minutes','value':'15'},{'name':_0xf1a2('0x17'),'value':_0x29b948['id']},{'name':'parent_type','value':_0xf1a2('0x18')},{'name':'parent_name','value':_0x29b948[_0xf1a2('0xd')]},{'name':_0xf1a2('0x19'),'value':_0x40445b}];if(_0x45bf65['length']){_[_0xf1a2('0x1a')](_0x45bf65,function(_0x1e76c5){if(_0x506a6f[_0x1e76c5[_0xf1a2('0x1b')]]){_0x1a2b23[_0xf1a2('0x1c')]({'name':_0x1e76c5[_0xf1a2('0x1d')],'value':_0x506a6f[_0x1e76c5[_0xf1a2('0x1b')]]});}});}return request({'form':{'method':_0xf1a2('0x1e'),'input_type':_0xf1a2('0x1f'),'response_type':_0xf1a2('0x1f'),'rest_data':JSON[_0xf1a2('0x20')]({'session':_0x334944['id'],'module_name':_0xf1a2('0x21'),'name_value_list':_0x1a2b23})}});}function getAuth(_0x32c4ea){return util[_0xf1a2('0x22')]('Basic\x20%s',new Buffer(_0x32c4ea[_0xf1a2('0x23')]+':X')['toString'](_0xf1a2('0x24')));}function getServerInfo(_0x241f10){return request({'form':{'method':_0xf1a2('0x25'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0xf1a2('0x20')]({'session':_0x241f10['id']})}});}function getUser(_0x13c0bf,_0x29e23d,_0x5a5c6b){if(!_['isNil'](_0x29e23d)){logger['info'](_0xf1a2('0x26'),_0x29e23d);return request({'form':{'method':_0xf1a2('0x27'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0xf1a2('0x20')]({'session':_0x5a5c6b['id'],'module_name':_0xf1a2('0x28'),'query':util[_0xf1a2('0x22')](_0xf1a2('0x29'),_0x29e23d),'order_by':'','offset':'0','select_fields':['id',_0xf1a2('0xd'),_0xf1a2('0x2a')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xf1a2('0x2b')](function(_0x116c68){if(_0x116c68[_0xf1a2('0x2c')][_0xf1a2('0x2d')]){var _0x2959aa=_[_0xf1a2('0x2e')](_0x116c68[_0xf1a2('0x2c')],function(_0x28a5e7){return _0x28a5e7[_0xf1a2('0x2f')]['user_name'][_0xf1a2('0x30')]===_0x29e23d;});if(_0x2959aa){logger[_0xf1a2('0xc')](_0xf1a2('0x31'));return BPromise[_0xf1a2('0x32')]({'id':_0x2959aa['name_value_list']['id'][_0xf1a2('0x30')],'name':_0x2959aa['name_value_list'][_0xf1a2('0xd')][_0xf1a2('0x30')]});}}logger['info'](_0xf1a2('0x33'));return BPromise['resolve']({'id':_0x5a5c6b[_0xf1a2('0x2f')][_0xf1a2('0x34')]['value'],'name':_0x5a5c6b[_0xf1a2('0x2f')][_0xf1a2('0x2a')][_0xf1a2('0x30')]});});}else{logger[_0xf1a2('0xc')](_0xf1a2('0x35'));return BPromise[_0xf1a2('0x32')]({'id':_0x5a5c6b[_0xf1a2('0x2f')][_0xf1a2('0x34')][_0xf1a2('0x30')],'name':_0x5a5c6b[_0xf1a2('0x2f')][_0xf1a2('0x2a')][_0xf1a2('0x30')]});}}function getEndUser(_0x196ca8,_0x160b6b,_0x39f524,_0x4d27ee){logger[_0xf1a2('0xc')](_0xf1a2('0x36'),_0x39f524);return request({'form':{'method':_0xf1a2('0x27'),'input_type':_0xf1a2('0x1f'),'response_type':_0xf1a2('0x1f'),'rest_data':JSON['stringify']({'session':_0x4d27ee['id'],'module_name':_0xf1a2('0x18'),'query':util['format']('contacts.phone_home\x20=\x20\x22%s\x22',_0x39f524),'order_by':'','offset':'0','select_fields':['id',_0xf1a2('0xd'),_0xf1a2('0x37')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x1b0f5a){if(_0x1b0f5a[_0xf1a2('0x2c')]['length']){var _0x56a343=_['find'](_0x1b0f5a[_0xf1a2('0x2c')],function(_0x45a626){return _0x45a626[_0xf1a2('0x2f')][_0xf1a2('0x37')][_0xf1a2('0x30')]===_0x39f524;});if(_0x56a343){logger['info']('Enduser\x20found!');return BPromise[_0xf1a2('0x32')]({'id':_0x56a343[_0xf1a2('0x2f')]['id'][_0xf1a2('0x30')],'name':_0x56a343[_0xf1a2('0x2f')][_0xf1a2('0xd')][_0xf1a2('0x30')],'phone':_0x56a343[_0xf1a2('0x2f')]['phone_home']['value']});}}else{logger['info']('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'form':{'method':_0xf1a2('0x1e'),'input_type':_0xf1a2('0x1f'),'response_type':_0xf1a2('0x1f'),'rest_data':JSON['stringify']({'session':_0x4d27ee['id'],'module_name':_0xf1a2('0x18'),'name_value_list':[{'name':'first_name','value':_0x160b6b!==_0xf1a2('0x38')?_0x160b6b:util[_0xf1a2('0x22')]('Caller\x20-\x20%s',_0x39f524)},{'name':_0xf1a2('0x37'),'value':_0x39f524}]})}})['then'](function(_0x30b05d){logger[_0xf1a2('0xc')](_0xf1a2('0x39'));return BPromise[_0xf1a2('0x32')]({'id':_0x30b05d['id'],'name':_0x30b05d[_0xf1a2('0x2c')][_0xf1a2('0x3a')]['value'],'phone':_0x30b05d[_0xf1a2('0x2c')]['phone_home'][_0xf1a2('0x30')]});});}});}function request(_0x23d736){logger[_0xf1a2('0x3b')](_0xf1a2('0x3c'),JSON[_0xf1a2('0x20')](_0x23d736));return rp(_[_0xf1a2('0x3d')](def,_0x23d736));}function getTags(_0x20e571,_0x500305){var _0x288ccf=[];if(_0x20e571&&_0x20e571[_0xf1a2('0x2d')]>0x0){_0x288ccf=_[_0xf1a2('0x3e')](_0x20e571,_0x500305);}return _0x288ccf;}function getCustomFields(_0x3d6f0d,_0x2a2aff){var _0x49754f=[];var _0x97e52={'custom_fields':[]};if(_0x3d6f0d[_0xf1a2('0x2d')]>0x0){_[_0xf1a2('0x1a')](_0x3d6f0d,function(_0x39b3cd){if(_0x39b3cd[_0xf1a2('0x3f')]==='string'&&_0x39b3cd[_0xf1a2('0x40')]&&!_0x39b3cd['customField']){_0x97e52[_0x39b3cd[_0xf1a2('0x40')][_0xf1a2('0x41')]()]=_0x39b3cd[_0xf1a2('0x42')][_0xf1a2('0x43')]();}else if(_0x39b3cd[_0xf1a2('0x3f')]===_0xf1a2('0x44')&&_0x39b3cd[_0xf1a2('0x1d')]&&_0x39b3cd['customField']){_0x97e52[_0xf1a2('0x45')][_0xf1a2('0x1c')]({'id':_0x39b3cd[_0xf1a2('0x1d')],'value':_0x39b3cd['content'][_0xf1a2('0x43')]()});}else if(_0x39b3cd[_0xf1a2('0x3f')]===_0xf1a2('0x46')&&_0x39b3cd['variableName']&&_0x39b3cd[_0xf1a2('0x1d')]&&_0x39b3cd['customField']){_0x2a2aff[_0x39b3cd[_0xf1a2('0x1b')]]&&_0x97e52[_0xf1a2('0x45')]['push']({'id':_0x39b3cd[_0xf1a2('0x1d')],'value':_0x2a2aff[_0x39b3cd[_0xf1a2('0x1b')]]['toString']()});}else if(_0x39b3cd[_0xf1a2('0x3f')]===_0xf1a2('0x47')&&_0x39b3cd['Variable']&&_0x39b3cd[_0xf1a2('0x48')]['name']&&_0x39b3cd[_0xf1a2('0x1d')]&&_0x39b3cd[_0xf1a2('0x49')]){_0x2a2aff[_0x39b3cd[_0xf1a2('0x48')]['name']['toLowerCase']()]&&_0x97e52[_0xf1a2('0x45')][_0xf1a2('0x1c')]({'id':_0x39b3cd[_0xf1a2('0x1d')],'value':_0x2a2aff[_0x39b3cd[_0xf1a2('0x48')][_0xf1a2('0xd')][_0xf1a2('0x41')]()][_0xf1a2('0x43')]()});}});}return _0x97e52;}function getConnection(_0x585575){return request({'method':_0xf1a2('0xb'),'form':{'method':'login','input_type':_0xf1a2('0x1f'),'response_type':_0xf1a2('0x1f'),'rest_data':JSON[_0xf1a2('0x20')]({'user_auth':{'user_name':_0x585575[_0xf1a2('0x4a')],'password':_0x585575[_0xf1a2('0x4b')],'encryption':_0xf1a2('0x4c')},'application':_0xf1a2('0x4d')})}})[_0xf1a2('0x2b')](function(_0x57a5c2){var _0x30a24b=_0x57a5c2;if(_0x30a24b['id']){def[_0xf1a2('0x4e')]=_0x30a24b['id'];return BPromise[_0xf1a2('0x32')](_0x30a24b);}else{throw new Error(util[_0xf1a2('0x22')](_0xf1a2('0x4f'),_0x585575['id']));}});}function setRelationship(_0x5aa5bc,_0x26f2e2,_0x4f3902,_0x536023){return request({'form':{'method':_0xf1a2('0x50'),'input_type':_0xf1a2('0x1f'),'response_type':'JSON','rest_data':JSON[_0xf1a2('0x20')]({'session':_0x5aa5bc['id'],'module_name':_0xf1a2('0x21'),'module_id':_0x4f3902['id'],'link_field_name':_0x536023,'related_ids':[_0x26f2e2['id']],'name_value_list':[],'delete':0x0})}});}exports[_0xf1a2('0x51')]=function(_0x1f1aba,_0x5c490f,_0x5c227c,_0x520db2,_0xa71496,_0x498125){var _0x5be339,_0x6f0d01,_0x50453b,_0x3e5986;_0x498125['remoteUri']=intUtil[_0xf1a2('0x52')](_0x498125['remoteUri']);_0x498125[_0xf1a2('0x53')]=intUtil[_0xf1a2('0x52')](_0x498125['serverUrl']);def[_0xf1a2('0x54')]=util[_0xf1a2('0x22')]('%s/service/v4_1/rest.php',_0x498125[_0xf1a2('0x55')]);if(_0xa71496&&_0xa71496[_0xf1a2('0x56')]){logger[_0xf1a2('0xc')](_0xf1a2('0x57'),_0xf1a2('0x58'));_0x5c490f['recordingURL']=util['format'](_0xf1a2('0x59'),_0x498125[_0xf1a2('0x53')],_0x5c490f['uniqueid'],md5(_0x5c490f[_0xf1a2('0x5a')]));}else{_0x5c490f[_0xf1a2('0x5b')]='';}return getConnection(_0x498125)[_0xf1a2('0x2b')](function(_0x33df36){_0x3e5986=_0x33df36;return getUser(_0x498125,_0x520db2[_0xf1a2('0xd')],_0x3e5986);})[_0xf1a2('0x2b')](function(_0x2b0c24){_0x5be339=_0x2b0c24;logger[_0xf1a2('0xc')](_0xf1a2('0x5c'),_0x5be339['id']);return getEndUser(_0x498125,_0x5c490f[_0xf1a2('0x5d')],_0x5c490f[_0xf1a2('0x5e')],_0x3e5986);})[_0xf1a2('0x2b')](function(_0x702fc6){_0x6f0d01=_0x702fc6;logger[_0xf1a2('0xc')](_0xf1a2('0x5f'),_0x6f0d01['id']);return getTicket(_0x498125,_0x5be339,_0x6f0d01,_0x5c227c,_0x5c490f,_0x5c227c[_0xf1a2('0x60')],_0x3e5986,_0xf1a2('0x61'));})['then'](function(_0x1766a5){_0x50453b=_0x1766a5;logger[_0xf1a2('0xc')](_0xf1a2('0x62'));logger['info']('The\x20Ticket\x20ID\x20is:',_0x50453b['id']);return setRelationship(_0x3e5986,_0x5be339,_0x50453b,_0xf1a2('0x63'));})[_0xf1a2('0x2b')](function(){return setRelationship(_0x3e5986,_0x6f0d01,_0x50453b,_0xf1a2('0x64'));})['then'](function(){return getServerInfo(_0x3e5986);})[_0xf1a2('0x2b')](function(_0x1678a8){var _0x24c513=parseInt(_0x1678a8[_0xf1a2('0x65')][_0xf1a2('0x66')](0x0));var _0x128a24=util[_0xf1a2('0x22')](_0xf1a2('0x67'),_0x498125[_0xf1a2('0x55')],_0x50453b['id']);if(_0x24c513>0x6){_0x128a24=util[_0xf1a2('0x22')](_0xf1a2('0x68'),_0x498125[_0xf1a2('0x55')],_0x50453b['id']);}logger[_0xf1a2('0xc')](_0xf1a2('0x57'),_0xf1a2('0x69'));emit(util[_0xf1a2('0x22')](_0xf1a2('0x6a'),_0x520db2[_0xf1a2('0xd')]),_0xf1a2('0x6b'),{'uri':_0x128a24});})['catch'](function(_0x3260fc){logger[_0xf1a2('0x6c')](_0xf1a2('0x57'),JSON['stringify'](_0x3260fc));});};exports[_0xf1a2('0x6d')]=function(_0x2a2776,_0x3ae1ef,_0x50ac5a,_0x555143,_0x44e16a,_0x2d7ac8,_0x43396e){var _0x34c583,_0x138aa1,_0x5b189b,_0x43ecd8;_0x2d7ac8['remoteUri']=intUtil[_0xf1a2('0x52')](_0x2d7ac8[_0xf1a2('0x55')]);_0x2d7ac8['serverUrl']=intUtil[_0xf1a2('0x52')](_0x2d7ac8[_0xf1a2('0x53')]);def[_0xf1a2('0x54')]=util[_0xf1a2('0x22')](_0xf1a2('0x6e'),_0x2d7ac8[_0xf1a2('0x55')]);if(_0x43396e&&_0x43396e['recordingFormat']&&_0x43396e[_0xf1a2('0x6f')]!==_0xf1a2('0x70')){logger[_0xf1a2('0xc')](_0xf1a2('0x71'),_0xf1a2('0x58'));_0x3ae1ef[_0xf1a2('0x5b')]=util['format'](_0xf1a2('0x59'),_0x2d7ac8[_0xf1a2('0x53')],_0x3ae1ef[_0xf1a2('0x5a')],md5(_0x3ae1ef[_0xf1a2('0x5a')]));}return getConnection(_0x2d7ac8)[_0xf1a2('0x2b')](function(_0x52b4ec){_0x43ecd8=_0x52b4ec;return getUser(_0x2d7ac8,_0x555143[_0xf1a2('0xd')],_0x43ecd8);})[_0xf1a2('0x2b')](function(_0xd494b0){_0x34c583=_0xd494b0;logger[_0xf1a2('0xc')](_0xf1a2('0x5c'),_0x34c583['id']);return getEndUser(_0x2d7ac8,_0x3ae1ef[_0xf1a2('0x72')],_0x3ae1ef[_0xf1a2('0x73')],_0x43ecd8);})['then'](function(_0x5d1515){_0x138aa1=_0x5d1515;logger[_0xf1a2('0xc')](_0xf1a2('0x5f'),_0x138aa1['id']);return getTicket(_0x2d7ac8,_0x34c583,_0x138aa1,_0x50ac5a,_0x3ae1ef,_0x50ac5a[_0xf1a2('0x60')],_0x43ecd8,_0xf1a2('0x74'));})['then'](function(_0x202a04){_0x5b189b=_0x202a04;logger[_0xf1a2('0xc')](_0xf1a2('0x62'));logger['info'](_0xf1a2('0x75'),_0x5b189b['id']);return setRelationship(_0x43ecd8,_0x34c583,_0x5b189b,_0xf1a2('0x63'));})[_0xf1a2('0x2b')](function(){return setRelationship(_0x43ecd8,_0x138aa1,_0x5b189b,_0xf1a2('0x64'));})['then'](function(){return getServerInfo(_0x43ecd8);})[_0xf1a2('0x2b')](function(_0x340b3e){var _0x2bb5f0=parseInt(_0x340b3e[_0xf1a2('0x65')]['charAt'](0x0));var _0x2136d8=util[_0xf1a2('0x22')](_0xf1a2('0x67'),_0x2d7ac8[_0xf1a2('0x55')],_0x5b189b['id']);if(_0x2bb5f0>0x6){_0x2136d8=util[_0xf1a2('0x22')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x2d7ac8[_0xf1a2('0x55')],_0x5b189b['id']);}logger[_0xf1a2('0xc')](_0xf1a2('0x71'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xf1a2('0x22')](_0xf1a2('0x6a'),_0x555143[_0xf1a2('0xd')]),_0xf1a2('0x6b'),{'uri':_0x2136d8});})['catch'](function(_0x19fa75){logger[_0xf1a2('0x6c')](_0xf1a2('0x71'),JSON[_0xf1a2('0x20')](_0x19fa75));});};exports[_0xf1a2('0x76')]=function(_0x2a9d52,_0x218ffa,_0x2dafc9,_0x3066cf,_0x44cadc,_0x5691ea){var _0x4d37f8,_0x55ed09,_0x126e3c,_0x417488;_0x5691ea[_0xf1a2('0x55')]=intUtil[_0xf1a2('0x52')](_0x5691ea[_0xf1a2('0x55')]);_0x5691ea['serverUrl']=intUtil[_0xf1a2('0x52')](_0x5691ea['serverUrl']);def[_0xf1a2('0x54')]=util[_0xf1a2('0x22')](_0xf1a2('0x6e'),_0x5691ea[_0xf1a2('0x55')]);if(_0x44cadc&&_0x44cadc[_0xf1a2('0x56')]){logger['info']('['+_0x218ffa[_0xf1a2('0x77')][_0xf1a2('0x78')]()+']',_0xf1a2('0x58'));_0x218ffa[_0xf1a2('0x5b')]=util[_0xf1a2('0x22')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5691ea[_0xf1a2('0x53')],_0x218ffa[_0xf1a2('0x5a')],md5(_0x218ffa[_0xf1a2('0x5a')]));}else{_0x218ffa[_0xf1a2('0x5b')]='';}return getConnection(_0x5691ea)[_0xf1a2('0x2b')](function(_0x221959){_0x417488=_0x221959;if(!_['isNil'](_0x3066cf)){return getUser(_0x5691ea,_0x3066cf[_0xf1a2('0xd')],_0x417488);}else{return getUser(_0x5691ea,null,_0x417488);}})['then'](function(_0xd379a9){_0x4d37f8=_0xd379a9;logger[_0xf1a2('0xc')](_0xf1a2('0x5c'),_0x4d37f8['id']);return getEndUser(_0x5691ea,_0x218ffa['calleridname'],_0x218ffa[_0xf1a2('0x5e')],_0x417488);})[_0xf1a2('0x2b')](function(_0x19730b){_0x55ed09=_0x19730b;logger[_0xf1a2('0xc')](_0xf1a2('0x5f'),_0x55ed09['id']);return getTicket(_0x5691ea,_0x4d37f8,_0x55ed09,_0x2dafc9,_0x218ffa,_0x2dafc9['Fields'],_0x417488,_0xf1a2('0x61'));})[_0xf1a2('0x2b')](function(_0x1be5a0){_0x126e3c=_0x1be5a0;logger['info'](_0xf1a2('0x62'));logger[_0xf1a2('0xc')](_0xf1a2('0x75'),_0x126e3c['id']);return setRelationship(_0x417488,_0x4d37f8,_0x126e3c,_0xf1a2('0x63'));})[_0xf1a2('0x2b')](function(){return setRelationship(_0x417488,_0x55ed09,_0x126e3c,_0xf1a2('0x64'));})[_0xf1a2('0x2b')](function(){return getServerInfo(_0x417488);})[_0xf1a2('0x79')](function(_0x2f5649){logger[_0xf1a2('0x6c')]('['+_0x218ffa['lastevent'][_0xf1a2('0x78')]()+']',JSON[_0xf1a2('0x20')](_0x2f5649));});}; \ 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 8dd29f3..0a170e9 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 _0x06bd=['key','customVariable','stripTrailingSlash','slice','lastIndexOf','validateEmail','isNil','test','lodash','util','getString','sortBy','length','type','string','variable','variableName','push','Variable','name','toLowerCase','toString','keyValue','keyType','format','%s:\x20%s','keyContent'];(function(_0x462fe4,_0x394d3e){var _0x82b23a=function(_0x2c071f){while(--_0x2c071f){_0x462fe4['push'](_0x462fe4['shift']());}};_0x82b23a(++_0x394d3e);}(_0x06bd,0x1d3));var _0xd06b=function(_0x5daeb2,_0x4b007c){_0x5daeb2=_0x5daeb2-0x0;var _0x2dbb9f=_0x06bd[_0x5daeb2];return _0x2dbb9f;};'use strict';var _=require(_0xd06b('0x0'));var util=require(_0xd06b('0x1'));exports[_0xd06b('0x2')]=function(_0x5746f9,_0x581eca,_0x5c1b7e){var _0x112747=[];if(_0x5746f9['length']>0x0){var _0x1da816=_[_0xd06b('0x3')](_0x5746f9,['id']);for(var _0x459c78=0x0;_0x459c78<_0x1da816[_0xd06b('0x4')];_0x459c78++){var _0x2bcbc7=_0x1da816[_0x459c78];if(_0x2bcbc7[_0xd06b('0x5')]===_0xd06b('0x6')){_0x112747['push'](_0x2bcbc7['content']);}else if(_0x2bcbc7['type']===_0xd06b('0x7')&&_0x2bcbc7[_0xd06b('0x8')]){_0x581eca[_0x2bcbc7[_0xd06b('0x8')]]&&_0x112747[_0xd06b('0x9')](_0x581eca[_0x2bcbc7['variableName']]['toString']());}else if(_0x2bcbc7[_0xd06b('0x5')]==='customVariable'&&_0x2bcbc7['Variable']&&_0x2bcbc7['Variable']['name']){_0x581eca[_0x2bcbc7[_0xd06b('0xa')][_0xd06b('0xb')][_0xd06b('0xc')]()]&&_0x112747[_0xd06b('0x9')](_0x581eca[_0x2bcbc7[_0xd06b('0xa')][_0xd06b('0xb')][_0xd06b('0xc')]()][_0xd06b('0xd')]());}else if(_0x2bcbc7[_0xd06b('0x5')]===_0xd06b('0xe')){if(_0x2bcbc7[_0xd06b('0xf')]==='string'&&_0x2bcbc7['key']){_0x112747[_0xd06b('0x9')](util[_0xd06b('0x10')](_0xd06b('0x11'),_0x2bcbc7['key'],_0x2bcbc7[_0xd06b('0x12')]));}else if(_0x2bcbc7[_0xd06b('0xf')]===_0xd06b('0x7')&&_0x2bcbc7[_0xd06b('0x8')]&&_0x2bcbc7[_0xd06b('0x13')]){_0x581eca[_0x2bcbc7[_0xd06b('0x8')]]&&_0x112747[_0xd06b('0x9')](util['format'](_0xd06b('0x11'),_0x2bcbc7['key'],_0x581eca[_0x2bcbc7[_0xd06b('0x8')]]));}else if(_0x2bcbc7['keyType']===_0xd06b('0x14')&&_0x2bcbc7[_0xd06b('0xa')]&&_0x2bcbc7[_0xd06b('0xa')]['name']&&_0x2bcbc7[_0xd06b('0x13')]){_0x581eca[_0x2bcbc7[_0xd06b('0xa')]['name'][_0xd06b('0xc')]()]&&_0x112747[_0xd06b('0x9')](util[_0xd06b('0x10')](_0xd06b('0x11'),_0x2bcbc7[_0xd06b('0x13')],_0x581eca[_0x2bcbc7[_0xd06b('0xa')][_0xd06b('0xb')]['toLowerCase']()]));}}}}return _0x112747['join'](_0x5c1b7e);};exports[_0xd06b('0x15')]=function(_0x4f8da0){var _0x29fa2a=_0x4f8da0[_0xd06b('0x16')](-0x1);if(_0x29fa2a==='/'){_0x4f8da0=_0x4f8da0['substring'](0x0,_0x4f8da0[_0xd06b('0x17')](_0x29fa2a));}return _0x4f8da0;};exports[_0xd06b('0x18')]=function(_0x4c0392){if(!_[_0xd06b('0x19')](_0x4c0392)&&_0x4c0392!==''){var _0xda6001=/^(([^<>()\[\]\\.,;:\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 _0xda6001[_0xd06b('0x1a')](String(_0x4c0392)['toLowerCase']());}else{return![];}}; \ No newline at end of file +var _0x5ee7=['validateEmail','isNil','test','lodash','util','length','sortBy','string','push','content','type','variable','variableName','toString','Variable','name','toLowerCase','keyValue','keyType','key','format','%s:\x20%s','keyContent','customVariable','join','stripTrailingSlash','slice','substring'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x5ee7,0x1a7));var _0x75ee=function(_0x368da1,_0x25e3fd){_0x368da1=_0x368da1-0x0;var _0x98d269=_0x5ee7[_0x368da1];return _0x98d269;};'use strict';var _=require(_0x75ee('0x0'));var util=require(_0x75ee('0x1'));exports['getString']=function(_0x53cee2,_0x1df75f,_0x49111a){var _0x511b48=[];if(_0x53cee2[_0x75ee('0x2')]>0x0){var _0x1588a2=_[_0x75ee('0x3')](_0x53cee2,['id']);for(var _0x2e9287=0x0;_0x2e9287<_0x1588a2[_0x75ee('0x2')];_0x2e9287++){var _0x4a8172=_0x1588a2[_0x2e9287];if(_0x4a8172['type']===_0x75ee('0x4')){_0x511b48[_0x75ee('0x5')](_0x4a8172[_0x75ee('0x6')]);}else if(_0x4a8172[_0x75ee('0x7')]===_0x75ee('0x8')&&_0x4a8172[_0x75ee('0x9')]){_0x1df75f[_0x4a8172['variableName']]&&_0x511b48[_0x75ee('0x5')](_0x1df75f[_0x4a8172[_0x75ee('0x9')]][_0x75ee('0xa')]());}else if(_0x4a8172['type']==='customVariable'&&_0x4a8172[_0x75ee('0xb')]&&_0x4a8172['Variable'][_0x75ee('0xc')]){_0x1df75f[_0x4a8172[_0x75ee('0xb')][_0x75ee('0xc')][_0x75ee('0xd')]()]&&_0x511b48[_0x75ee('0x5')](_0x1df75f[_0x4a8172['Variable'][_0x75ee('0xc')][_0x75ee('0xd')]()][_0x75ee('0xa')]());}else if(_0x4a8172[_0x75ee('0x7')]===_0x75ee('0xe')){if(_0x4a8172[_0x75ee('0xf')]==='string'&&_0x4a8172[_0x75ee('0x10')]){_0x511b48[_0x75ee('0x5')](util[_0x75ee('0x11')](_0x75ee('0x12'),_0x4a8172[_0x75ee('0x10')],_0x4a8172[_0x75ee('0x13')]));}else if(_0x4a8172[_0x75ee('0xf')]===_0x75ee('0x8')&&_0x4a8172[_0x75ee('0x9')]&&_0x4a8172['key']){_0x1df75f[_0x4a8172[_0x75ee('0x9')]]&&_0x511b48[_0x75ee('0x5')](util[_0x75ee('0x11')](_0x75ee('0x12'),_0x4a8172[_0x75ee('0x10')],_0x1df75f[_0x4a8172[_0x75ee('0x9')]]));}else if(_0x4a8172[_0x75ee('0xf')]===_0x75ee('0x14')&&_0x4a8172[_0x75ee('0xb')]&&_0x4a8172[_0x75ee('0xb')][_0x75ee('0xc')]&&_0x4a8172[_0x75ee('0x10')]){_0x1df75f[_0x4a8172['Variable'][_0x75ee('0xc')][_0x75ee('0xd')]()]&&_0x511b48[_0x75ee('0x5')](util[_0x75ee('0x11')]('%s:\x20%s',_0x4a8172[_0x75ee('0x10')],_0x1df75f[_0x4a8172[_0x75ee('0xb')][_0x75ee('0xc')]['toLowerCase']()]));}}}}return _0x511b48[_0x75ee('0x15')](_0x49111a);};exports[_0x75ee('0x16')]=function(_0x5f08be){var _0x2e47df=_0x5f08be[_0x75ee('0x17')](-0x1);if(_0x2e47df==='/'){_0x5f08be=_0x5f08be[_0x75ee('0x18')](0x0,_0x5f08be['lastIndexOf'](_0x2e47df));}return _0x5f08be;};exports[_0x75ee('0x19')]=function(_0x412423){if(!_[_0x75ee('0x1a')](_0x412423)&&_0x412423!==''){var _0x1ab2b5=/^(([^<>()\[\]\\.,;:\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 _0x1ab2b5[_0x75ee('0x1b')](String(_0x412423)[_0x75ee('0xd')]());}else{return![];}}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/vtiger.js b/server/services/ami/trigger/integration/vtiger.js index 4160ef5..fa3aefa 100644 --- a/server/services/ami/trigger/integration/vtiger.js +++ b/server/services/ami/trigger/integration/vtiger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['result','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','getUser','username','Searching\x20end\x20user\x20with\x20phone','remoteUri','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','phone','catch','accessKey','getchallenge','token','Account\x20%d\x20is\x20not\x20valid','getConnection','queue','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','user:%s','unmanaged','lastevent','toUpperCase','lodash','request-promise','bluebird','util','ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','emit','length','forEach','includes','string','idField','content','toString','type','variable','variableName','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','Subjects','getString','Descriptions','POST','format','%s/webservice.php','create','stringify','then','success','resolve','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','statusCode','error','[vTiger],\x20%s,\x20%s,\x20%s','validateEmail','Getting\x20agent\x20with\x20email','GET','query','sessionName','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;'];(function(_0x33993e,_0xd4ae85){var _0x1c3281=function(_0x133033){while(--_0x133033){_0x33993e['push'](_0x33993e['shift']());}};_0x1c3281(++_0xd4ae85);}(_0xe706,0xa3));var _0x6e70=function(_0x20efe6,_0x2d6285){_0x20efe6=_0x20efe6-0x0;var _0x2680c2=_0xe706[_0x20efe6];return _0x2680c2;};'use strict';var _=require(_0x6e70('0x0'));var rp=require(_0x6e70('0x1'));var BPromise=require(_0x6e70('0x2'));var md5=require('md5');var util=require(_0x6e70('0x3'));var Redis=require(_0x6e70('0x4'));var intUtil=require(_0x6e70('0x5'));var config=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));config[_0x6e70('0x9')]=_[_0x6e70('0xa')](config[_0x6e70('0x9')],{'host':_0x6e70('0xb'),'port':0x18eb});var io=require(_0x6e70('0xc'))(new Redis(config[_0x6e70('0x9')]));function emit(_0x45a2d4,_0x188ed3,_0x3c4843){io['to'](_0x45a2d4)[_0x6e70('0xd')](_0x188ed3,_0x3c4843);}function getCustomFields(_0x954545,_0x25e61c){var _0x100eb7={};if(_0x954545[_0x6e70('0xe')]>0x0){_[_0x6e70('0xf')](_0x954545,function(_0x3f474a){if(_[_0x6e70('0x10')]([_0x6e70('0x11'),'picklist'],_0x3f474a['type'])&&_0x3f474a[_0x6e70('0x12')]){_0x100eb7[_0x3f474a[_0x6e70('0x12')]]=_0x3f474a[_0x6e70('0x13')][_0x6e70('0x14')]();}else if(_0x3f474a[_0x6e70('0x15')]===_0x6e70('0x16')&&_0x3f474a[_0x6e70('0x17')]&&_0x3f474a[_0x6e70('0x12')]&&_0x25e61c[_0x3f474a['variableName']]){_0x100eb7[_0x3f474a['idField']]=_0x25e61c[_0x3f474a['variableName']][_0x6e70('0x14')]();}else if(_0x3f474a['type']==='customVariable'&&_0x3f474a[_0x6e70('0x18')]&&_0x3f474a[_0x6e70('0x18')]['name']&&_0x3f474a[_0x6e70('0x12')]&&_0x25e61c[_0x3f474a['Variable'][_0x6e70('0x19')][_0x6e70('0x1a')]()]){_0x100eb7[_0x3f474a['idField']]=_0x25e61c[_0x3f474a['Variable'][_0x6e70('0x19')]['toLowerCase']()][_0x6e70('0x14')]();}});}return _0x100eb7;}function createTicket(_0x173afe,_0x53acdc,_0x497d61,_0xc238ba,_0x208e21,_0x2368eb,_0x3a9978){logger[_0x6e70('0x1b')](_0x6e70('0x1c'));var _0x1b2453=_[_0x6e70('0x1d')]({'parent_id':'','assigned_user_id':_0x53acdc['id'],'ticketpriorities':_0x6e70('0x1e'),'ticketstatus':_0x6e70('0x1f'),'ticket_title':intUtil['getString'](_0xc238ba[_0x6e70('0x20')],_0x208e21,'\x20'),'description':intUtil[_0x6e70('0x21')](_0xc238ba[_0x6e70('0x22')],_0x208e21,'\x0a'),'contact_id':_0x497d61['id']},getCustomFields(_0x2368eb,_0x208e21));var _0x502b2d={'method':_0x6e70('0x23'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x173afe['remoteUri']),'form':{'operation':_0x6e70('0x26'),'username':_0x173afe['username'],'sessionName':_0x3a9978['sessionName'],'elementType':'HelpDesk','element':JSON[_0x6e70('0x27')](_0x1b2453)},'json':!![]};return request(_0x502b2d)[_0x6e70('0x28')](function(_0x51d292){if(_0x51d292[_0x6e70('0x29')]){return BPromise[_0x6e70('0x2a')]({'id':_0x51d292['result']['id']});}else{throw new Error(util[_0x6e70('0x24')](_0x6e70('0x2b'),JSON[_0x6e70('0x27')](_0x51d292['error'])));}})['catch'](function(_0x2c4d37){var _0x3af17f=_0x2c4d37[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),'createTicket',_0x3af17f,JSON[_0x6e70('0x27')](_0x2c4d37));});}function getUser(_0x406f29,_0xecf336,_0x2864a0){if(intUtil[_0x6e70('0x2f')](_0xecf336)){logger[_0x6e70('0x1b')](_0x6e70('0x30'),_0xecf336);return request({'method':_0x6e70('0x31'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x406f29['remoteUri']),'qs':{'operation':_0x6e70('0x32'),'username':_0x406f29['username'],'sessionName':_0x2864a0[_0x6e70('0x33')],'query':util['format'](_0x6e70('0x34'),_0xecf336)},'json':!![]})[_0x6e70('0x28')](function(_0x30fa0b){if(_0x30fa0b['success']&&_0x30fa0b[_0x6e70('0x35')][_0x6e70('0xe')]){logger['info'](_0x6e70('0x36'));return BPromise[_0x6e70('0x2a')]({'id':_0x30fa0b['result'][0x0]['id'],'email':_0x30fa0b[_0x6e70('0x35')][0x0][_0x6e70('0x37')],'name':_0x30fa0b[_0x6e70('0x35')][0x0][_0x6e70('0x38')]+'\x20'+_0x30fa0b[_0x6e70('0x35')][_0x6e70('0x39')]});}else{logger[_0x6e70('0x1b')](_0x6e70('0x3a'));return BPromise[_0x6e70('0x2a')]({'id':_0x2864a0[_0x6e70('0x3b')],'email':_0x406f29['username'],'name':_0x6e70('0x3c')});}})['catch'](function(_0x23cd1a){var _0x3222a2=_0x23cd1a[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),_0x6e70('0x3d'),_0x3222a2,JSON[_0x6e70('0x27')](_0x23cd1a));});}else{logger[_0x6e70('0x1b')](_0x6e70('0x3a'));return BPromise[_0x6e70('0x2a')]({'id':_0x2864a0[_0x6e70('0x3b')],'email':_0x406f29[_0x6e70('0x3e')],'name':_0x6e70('0x3c')})['catch'](function(_0x5446a2){var _0x5424eb=_0x5446a2[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),_0x6e70('0x3d'),_0x5424eb,JSON[_0x6e70('0x27')](_0x5446a2));});}}function getEndUser(_0x3bdd87,_0x572a71,_0x3b508c,_0x9e7ad2){logger[_0x6e70('0x1b')](_0x6e70('0x3f'),_0x3b508c);return request({'method':_0x6e70('0x31'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x3bdd87[_0x6e70('0x40')]),'qs':{'operation':'query','username':_0x3bdd87[_0x6e70('0x3e')],'sessionName':_0x9e7ad2[_0x6e70('0x33')],'query':util[_0x6e70('0x24')](_0x6e70('0x41'),_0x3b508c,_0x3b508c,_0x3b508c,_0x3b508c,_0x3b508c)},'json':!![]})[_0x6e70('0x28')](function(_0x1de947){if(_0x1de947[_0x6e70('0x29')]&&_0x1de947['result']['length']){logger['info'](_0x6e70('0x42'));return BPromise[_0x6e70('0x2a')]({'id':_0x1de947[_0x6e70('0x35')][0x0]['id'],'name':_0x1de947[_0x6e70('0x35')][0x0][_0x6e70('0x43')]+'\x20'+_0x1de947['result'][0x0][_0x6e70('0x44')],'phone':_0x3b508c});}else{logger[_0x6e70('0x1b')](_0x6e70('0x45'));return request({'method':'POST','uri':util['format']('%s/webservice.php',_0x3bdd87[_0x6e70('0x40')]),'form':{'operation':'create','sessionName':_0x9e7ad2[_0x6e70('0x33')],'elementType':_0x6e70('0x46'),'element':JSON[_0x6e70('0x27')]({'lastname':_0x572a71,'phone':_0x3b508c,'assigned_user_id':'\x20'})},'json':!![]})[_0x6e70('0x28')](function(_0x59c87d){logger[_0x6e70('0x1b')]('Enduser\x20created.');return BPromise[_0x6e70('0x2a')]({'id':_0x59c87d[_0x6e70('0x35')]['id'],'name':_0x59c87d[_0x6e70('0x35')][_0x6e70('0x44')],'phone':_0x59c87d['result'][_0x6e70('0x47')]});})[_0x6e70('0x48')](function(_0x3d39c3){var _0xac87d6=_0x3d39c3[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),'getEndUser',_0xac87d6,JSON[_0x6e70('0x27')](_0x3d39c3));});}});}function getConnection(_0x3884a4){var _0x10de2a=_0x3884a4[_0x6e70('0x3e')];var _0x3f86cf=_0x3884a4[_0x6e70('0x49')];return request({'method':_0x6e70('0x31'),'uri':util['format'](_0x6e70('0x25'),_0x3884a4['remoteUri']),'qs':{'operation':_0x6e70('0x4a'),'username':_0x10de2a},'json':!![]})[_0x6e70('0x28')](function(_0x4b351e){if(_0x4b351e['success']){return request({'method':_0x6e70('0x23'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x3884a4['remoteUri']),'form':{'operation':'login','username':_0x10de2a,'accessKey':md5(_0x4b351e[_0x6e70('0x35')][_0x6e70('0x4b')]+_0x3f86cf)},'json':!![]});}})[_0x6e70('0x28')](function(_0x79653){if(_0x79653[_0x6e70('0x29')]){return BPromise[_0x6e70('0x2a')](_0x79653['result']);}else{throw new Error(util[_0x6e70('0x24')](_0x6e70('0x4c'),_0x3884a4['id']));}})[_0x6e70('0x48')](function(_0x6ed023){var _0x2c3a7d=_0x6ed023['statusCode']||0x1f4;logger['error'](_0x6e70('0x2e'),_0x6e70('0x4d'),_0x2c3a7d,JSON[_0x6e70('0x27')](_0x6ed023));});}function request(_0x15f994){logger[_0x6e70('0x1b')]('[HTTP]',JSON[_0x6e70('0x27')](_0x15f994));return rp(_0x15f994);}exports[_0x6e70('0x4e')]=function(_0x1fa320,_0x23ebfb,_0x3aba34,_0x4a111a,_0x1142cd,_0x1dd242){var _0x2c20d3,_0x3fb0d3,_0x8ef4f7,_0x3fd03d;_0x1dd242['remoteUri']=intUtil[_0x6e70('0x4f')](_0x1dd242[_0x6e70('0x40')]);if(_0x1142cd&&_0x1142cd['monitor_format']){logger[_0x6e70('0x1b')](_0x6e70('0x50'),'Recording\x20is\x20enabled!');_0x23ebfb[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x1dd242[_0x6e70('0x53')],_0x23ebfb[_0x6e70('0x54')],md5(_0x23ebfb['uniqueid']));}else{_0x23ebfb[_0x6e70('0x51')]='';}return getConnection(_0x1dd242)[_0x6e70('0x28')](function(_0x10d655){_0x3fd03d=_0x10d655;return getUser(_0x1dd242,_0x4a111a[_0x6e70('0x55')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x1fe13a){_0x2c20d3=_0x1fe13a;logger[_0x6e70('0x1b')](_0x6e70('0x56'),_0x2c20d3['id']);return getEndUser(_0x1dd242,_0x23ebfb[_0x6e70('0x57')],_0x23ebfb[_0x6e70('0x58')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x1b12a1){_0x3fb0d3=_0x1b12a1;logger[_0x6e70('0x1b')](_0x6e70('0x59'),_0x3fb0d3['id']);return createTicket(_0x1dd242,_0x2c20d3,_0x3fb0d3,_0x3aba34,_0x23ebfb,_0x3aba34[_0x6e70('0x5a')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x324fa6){_0x8ef4f7=_0x324fa6;logger[_0x6e70('0x1b')](_0x6e70('0x5b'));logger[_0x6e70('0x1b')]('The\x20Ticket\x20ID\x20is:',_0x8ef4f7['id']);var _0x28898a=util[_0x6e70('0x24')](_0x6e70('0x5c'),_0x1dd242[_0x6e70('0x40')],_[_0x6e70('0x5d')](_0x8ef4f7['id'],'x')[0x1]);logger[_0x6e70('0x1b')]('[QUEUE]',_0x6e70('0x5e'));emit(util[_0x6e70('0x24')]('user:%s',_0x4a111a[_0x6e70('0x19')]),_0x6e70('0x5f'),{'uri':_0x28898a});})[_0x6e70('0x48')](function(_0x590f7f){logger['error'](_0x6e70('0x50'),JSON[_0x6e70('0x27')](_0x590f7f));});};exports[_0x6e70('0x60')]=function(_0x41a861,_0x10d299,_0x739946,_0x30cd88,_0x57bfe5,_0x4d47e1,_0x2c8dc6){var _0x1e23c5,_0x2bf9ec,_0x2ad395,_0x5b1e6f;_0x4d47e1['remoteUri']=intUtil[_0x6e70('0x4f')](_0x4d47e1[_0x6e70('0x40')]);_0x4d47e1['serverUrl']=intUtil['stripTrailingSlash'](_0x4d47e1[_0x6e70('0x53')]);if(_0x2c8dc6&&_0x2c8dc6['recordingFormat']&&_0x2c8dc6[_0x6e70('0x61')]!==_0x6e70('0x62')){logger[_0x6e70('0x1b')](_0x6e70('0x63'),_0x6e70('0x64'));_0x10d299[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x4d47e1['serverUrl'],_0x10d299[_0x6e70('0x54')],md5(_0x10d299[_0x6e70('0x54')]));}return getConnection(_0x4d47e1)[_0x6e70('0x28')](function(_0x346c79){_0x5b1e6f=_0x346c79;return getUser(_0x4d47e1,_0x30cd88[_0x6e70('0x55')],_0x5b1e6f);})['then'](function(_0x5f5b02){_0x1e23c5=_0x5f5b02;logger['info'](_0x6e70('0x56'),_0x1e23c5['id']);return getEndUser(_0x4d47e1,_0x10d299[_0x6e70('0x65')],_0x10d299[_0x6e70('0x66')],_0x5b1e6f);})['then'](function(_0x58cf1c){_0x2bf9ec=_0x58cf1c;logger[_0x6e70('0x1b')](_0x6e70('0x59'),_0x2bf9ec['id']);return createTicket(_0x4d47e1,_0x1e23c5,_0x2bf9ec,_0x739946,_0x10d299,_0x739946[_0x6e70('0x5a')],_0x5b1e6f);})[_0x6e70('0x28')](function(_0x2285f1){_0x2ad395=_0x2285f1;logger[_0x6e70('0x1b')]('Ticket\x20created!');logger[_0x6e70('0x1b')](_0x6e70('0x67'),_0x2ad395['id']);var _0x30d11b=util[_0x6e70('0x24')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x4d47e1[_0x6e70('0x40')],_['split'](_0x2ad395['id'],'x')[0x1]);logger['info'](_0x6e70('0x63'),_0x6e70('0x5e'));emit(util[_0x6e70('0x24')](_0x6e70('0x68'),_0x30cd88[_0x6e70('0x19')]),_0x6e70('0x5f'),{'uri':_0x30d11b});})['catch'](function(_0x370eeb){logger[_0x6e70('0x2d')](_0x6e70('0x63'),JSON[_0x6e70('0x27')](_0x370eeb));});};exports[_0x6e70('0x69')]=function(_0x13c092,_0x363722,_0xd9b4a9,_0x2f1362,_0x29621a,_0x575938){var _0x44c877,_0x303c5a,_0x577c3b,_0x5d398a;_0x575938['remoteUri']=intUtil[_0x6e70('0x4f')](_0x575938[_0x6e70('0x40')]);_0x575938[_0x6e70('0x53')]=intUtil[_0x6e70('0x4f')](_0x575938[_0x6e70('0x53')]);if(_0x29621a&&_0x29621a['monitor_format']){logger['info']('['+_0x363722[_0x6e70('0x6a')][_0x6e70('0x6b')]()+']','Recording\x20is\x20enabled!');_0x363722[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x575938[_0x6e70('0x53')],_0x363722[_0x6e70('0x54')],md5(_0x363722[_0x6e70('0x54')]));}else{_0x363722[_0x6e70('0x51')]='';}return getConnection(_0x575938)[_0x6e70('0x28')](function(_0x3650e9){_0x5d398a=_0x3650e9;return getUser(_0x575938,'',_0x5d398a);})[_0x6e70('0x28')](function(_0x347cc4){_0x44c877=_0x347cc4;logger[_0x6e70('0x1b')](_0x6e70('0x56'),_0x44c877['id']);return getEndUser(_0x575938,_0x363722[_0x6e70('0x57')],_0x363722['calleridnum'],_0x5d398a);})['then'](function(_0x39ed95){_0x303c5a=_0x39ed95;logger['info'](_0x6e70('0x59'),_0x303c5a['id']);return createTicket(_0x575938,_0x44c877,_0x303c5a,_0xd9b4a9,_0x363722,_0xd9b4a9['Fields'],_0x5d398a);})['then'](function(_0x402f6f){_0x577c3b=_0x402f6f;logger['info']('Ticket\x20created!');logger[_0x6e70('0x1b')](_0x6e70('0x67'),_0x577c3b['id']);})[_0x6e70('0x48')](function(_0x4e9fda){logger['error']('['+_0x363722['lastevent'][_0x6e70('0x6b')]()+']',JSON['stringify'](_0x4e9fda));});}; \ No newline at end of file +var _0xe706=['result','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','getUser','username','Searching\x20end\x20user\x20with\x20phone','remoteUri','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','phone','catch','accessKey','getchallenge','token','Account\x20%d\x20is\x20not\x20valid','getConnection','queue','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','user:%s','unmanaged','lastevent','toUpperCase','lodash','request-promise','bluebird','util','ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','emit','length','forEach','includes','string','idField','content','toString','type','variable','variableName','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','Subjects','getString','Descriptions','POST','format','%s/webservice.php','create','stringify','then','success','resolve','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','statusCode','error','[vTiger],\x20%s,\x20%s,\x20%s','validateEmail','Getting\x20agent\x20with\x20email','GET','query','sessionName','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;'];(function(_0xb65e77,_0x238c3d){var _0x38134b=function(_0x39da21){while(--_0x39da21){_0xb65e77['push'](_0xb65e77['shift']());}};_0x38134b(++_0x238c3d);}(_0xe706,0xa3));var _0x6e70=function(_0x42e6e7,_0x4ee4f6){_0x42e6e7=_0x42e6e7-0x0;var _0x32909b=_0xe706[_0x42e6e7];return _0x32909b;};'use strict';var _=require(_0x6e70('0x0'));var rp=require(_0x6e70('0x1'));var BPromise=require(_0x6e70('0x2'));var md5=require('md5');var util=require(_0x6e70('0x3'));var Redis=require(_0x6e70('0x4'));var intUtil=require(_0x6e70('0x5'));var config=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));config[_0x6e70('0x9')]=_[_0x6e70('0xa')](config[_0x6e70('0x9')],{'host':_0x6e70('0xb'),'port':0x18eb});var io=require(_0x6e70('0xc'))(new Redis(config[_0x6e70('0x9')]));function emit(_0x45a2d4,_0x188ed3,_0x3c4843){io['to'](_0x45a2d4)[_0x6e70('0xd')](_0x188ed3,_0x3c4843);}function getCustomFields(_0x954545,_0x25e61c){var _0x100eb7={};if(_0x954545[_0x6e70('0xe')]>0x0){_[_0x6e70('0xf')](_0x954545,function(_0x3f474a){if(_[_0x6e70('0x10')]([_0x6e70('0x11'),'picklist'],_0x3f474a['type'])&&_0x3f474a[_0x6e70('0x12')]){_0x100eb7[_0x3f474a[_0x6e70('0x12')]]=_0x3f474a[_0x6e70('0x13')][_0x6e70('0x14')]();}else if(_0x3f474a[_0x6e70('0x15')]===_0x6e70('0x16')&&_0x3f474a[_0x6e70('0x17')]&&_0x3f474a[_0x6e70('0x12')]&&_0x25e61c[_0x3f474a['variableName']]){_0x100eb7[_0x3f474a['idField']]=_0x25e61c[_0x3f474a['variableName']][_0x6e70('0x14')]();}else if(_0x3f474a['type']==='customVariable'&&_0x3f474a[_0x6e70('0x18')]&&_0x3f474a[_0x6e70('0x18')]['name']&&_0x3f474a[_0x6e70('0x12')]&&_0x25e61c[_0x3f474a['Variable'][_0x6e70('0x19')][_0x6e70('0x1a')]()]){_0x100eb7[_0x3f474a['idField']]=_0x25e61c[_0x3f474a['Variable'][_0x6e70('0x19')]['toLowerCase']()][_0x6e70('0x14')]();}});}return _0x100eb7;}function createTicket(_0x173afe,_0x53acdc,_0x497d61,_0xc238ba,_0x208e21,_0x2368eb,_0x3a9978){logger[_0x6e70('0x1b')](_0x6e70('0x1c'));var _0x1b2453=_[_0x6e70('0x1d')]({'parent_id':'','assigned_user_id':_0x53acdc['id'],'ticketpriorities':_0x6e70('0x1e'),'ticketstatus':_0x6e70('0x1f'),'ticket_title':intUtil['getString'](_0xc238ba[_0x6e70('0x20')],_0x208e21,'\x20'),'description':intUtil[_0x6e70('0x21')](_0xc238ba[_0x6e70('0x22')],_0x208e21,'\x0a'),'contact_id':_0x497d61['id']},getCustomFields(_0x2368eb,_0x208e21));var _0x502b2d={'method':_0x6e70('0x23'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x173afe['remoteUri']),'form':{'operation':_0x6e70('0x26'),'username':_0x173afe['username'],'sessionName':_0x3a9978['sessionName'],'elementType':'HelpDesk','element':JSON[_0x6e70('0x27')](_0x1b2453)},'json':!![]};return request(_0x502b2d)[_0x6e70('0x28')](function(_0x51d292){if(_0x51d292[_0x6e70('0x29')]){return BPromise[_0x6e70('0x2a')]({'id':_0x51d292['result']['id']});}else{throw new Error(util[_0x6e70('0x24')](_0x6e70('0x2b'),JSON[_0x6e70('0x27')](_0x51d292['error'])));}})['catch'](function(_0x2c4d37){var _0x3af17f=_0x2c4d37[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),'createTicket',_0x3af17f,JSON[_0x6e70('0x27')](_0x2c4d37));});}function getUser(_0x406f29,_0xecf336,_0x2864a0){if(intUtil[_0x6e70('0x2f')](_0xecf336)){logger[_0x6e70('0x1b')](_0x6e70('0x30'),_0xecf336);return request({'method':_0x6e70('0x31'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x406f29['remoteUri']),'qs':{'operation':_0x6e70('0x32'),'username':_0x406f29['username'],'sessionName':_0x2864a0[_0x6e70('0x33')],'query':util['format'](_0x6e70('0x34'),_0xecf336)},'json':!![]})[_0x6e70('0x28')](function(_0x30fa0b){if(_0x30fa0b['success']&&_0x30fa0b[_0x6e70('0x35')][_0x6e70('0xe')]){logger['info'](_0x6e70('0x36'));return BPromise[_0x6e70('0x2a')]({'id':_0x30fa0b['result'][0x0]['id'],'email':_0x30fa0b[_0x6e70('0x35')][0x0][_0x6e70('0x37')],'name':_0x30fa0b[_0x6e70('0x35')][0x0][_0x6e70('0x38')]+'\x20'+_0x30fa0b[_0x6e70('0x35')][_0x6e70('0x39')]});}else{logger[_0x6e70('0x1b')](_0x6e70('0x3a'));return BPromise[_0x6e70('0x2a')]({'id':_0x2864a0[_0x6e70('0x3b')],'email':_0x406f29['username'],'name':_0x6e70('0x3c')});}})['catch'](function(_0x23cd1a){var _0x3222a2=_0x23cd1a[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),_0x6e70('0x3d'),_0x3222a2,JSON[_0x6e70('0x27')](_0x23cd1a));});}else{logger[_0x6e70('0x1b')](_0x6e70('0x3a'));return BPromise[_0x6e70('0x2a')]({'id':_0x2864a0[_0x6e70('0x3b')],'email':_0x406f29[_0x6e70('0x3e')],'name':_0x6e70('0x3c')})['catch'](function(_0x5446a2){var _0x5424eb=_0x5446a2[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),_0x6e70('0x3d'),_0x5424eb,JSON[_0x6e70('0x27')](_0x5446a2));});}}function getEndUser(_0x3bdd87,_0x572a71,_0x3b508c,_0x9e7ad2){logger[_0x6e70('0x1b')](_0x6e70('0x3f'),_0x3b508c);return request({'method':_0x6e70('0x31'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x3bdd87[_0x6e70('0x40')]),'qs':{'operation':'query','username':_0x3bdd87[_0x6e70('0x3e')],'sessionName':_0x9e7ad2[_0x6e70('0x33')],'query':util[_0x6e70('0x24')](_0x6e70('0x41'),_0x3b508c,_0x3b508c,_0x3b508c,_0x3b508c,_0x3b508c)},'json':!![]})[_0x6e70('0x28')](function(_0x1de947){if(_0x1de947[_0x6e70('0x29')]&&_0x1de947['result']['length']){logger['info'](_0x6e70('0x42'));return BPromise[_0x6e70('0x2a')]({'id':_0x1de947[_0x6e70('0x35')][0x0]['id'],'name':_0x1de947[_0x6e70('0x35')][0x0][_0x6e70('0x43')]+'\x20'+_0x1de947['result'][0x0][_0x6e70('0x44')],'phone':_0x3b508c});}else{logger[_0x6e70('0x1b')](_0x6e70('0x45'));return request({'method':'POST','uri':util['format']('%s/webservice.php',_0x3bdd87[_0x6e70('0x40')]),'form':{'operation':'create','sessionName':_0x9e7ad2[_0x6e70('0x33')],'elementType':_0x6e70('0x46'),'element':JSON[_0x6e70('0x27')]({'lastname':_0x572a71,'phone':_0x3b508c,'assigned_user_id':'\x20'})},'json':!![]})[_0x6e70('0x28')](function(_0x59c87d){logger[_0x6e70('0x1b')]('Enduser\x20created.');return BPromise[_0x6e70('0x2a')]({'id':_0x59c87d[_0x6e70('0x35')]['id'],'name':_0x59c87d[_0x6e70('0x35')][_0x6e70('0x44')],'phone':_0x59c87d['result'][_0x6e70('0x47')]});})[_0x6e70('0x48')](function(_0x3d39c3){var _0xac87d6=_0x3d39c3[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),'getEndUser',_0xac87d6,JSON[_0x6e70('0x27')](_0x3d39c3));});}});}function getConnection(_0x3884a4){var _0x10de2a=_0x3884a4[_0x6e70('0x3e')];var _0x3f86cf=_0x3884a4[_0x6e70('0x49')];return request({'method':_0x6e70('0x31'),'uri':util['format'](_0x6e70('0x25'),_0x3884a4['remoteUri']),'qs':{'operation':_0x6e70('0x4a'),'username':_0x10de2a},'json':!![]})[_0x6e70('0x28')](function(_0x4b351e){if(_0x4b351e['success']){return request({'method':_0x6e70('0x23'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x3884a4['remoteUri']),'form':{'operation':'login','username':_0x10de2a,'accessKey':md5(_0x4b351e[_0x6e70('0x35')][_0x6e70('0x4b')]+_0x3f86cf)},'json':!![]});}})[_0x6e70('0x28')](function(_0x79653){if(_0x79653[_0x6e70('0x29')]){return BPromise[_0x6e70('0x2a')](_0x79653['result']);}else{throw new Error(util[_0x6e70('0x24')](_0x6e70('0x4c'),_0x3884a4['id']));}})[_0x6e70('0x48')](function(_0x6ed023){var _0x2c3a7d=_0x6ed023['statusCode']||0x1f4;logger['error'](_0x6e70('0x2e'),_0x6e70('0x4d'),_0x2c3a7d,JSON[_0x6e70('0x27')](_0x6ed023));});}function request(_0x15f994){logger[_0x6e70('0x1b')]('[HTTP]',JSON[_0x6e70('0x27')](_0x15f994));return rp(_0x15f994);}exports[_0x6e70('0x4e')]=function(_0x1fa320,_0x23ebfb,_0x3aba34,_0x4a111a,_0x1142cd,_0x1dd242){var _0x2c20d3,_0x3fb0d3,_0x8ef4f7,_0x3fd03d;_0x1dd242['remoteUri']=intUtil[_0x6e70('0x4f')](_0x1dd242[_0x6e70('0x40')]);if(_0x1142cd&&_0x1142cd['monitor_format']){logger[_0x6e70('0x1b')](_0x6e70('0x50'),'Recording\x20is\x20enabled!');_0x23ebfb[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x1dd242[_0x6e70('0x53')],_0x23ebfb[_0x6e70('0x54')],md5(_0x23ebfb['uniqueid']));}else{_0x23ebfb[_0x6e70('0x51')]='';}return getConnection(_0x1dd242)[_0x6e70('0x28')](function(_0x10d655){_0x3fd03d=_0x10d655;return getUser(_0x1dd242,_0x4a111a[_0x6e70('0x55')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x1fe13a){_0x2c20d3=_0x1fe13a;logger[_0x6e70('0x1b')](_0x6e70('0x56'),_0x2c20d3['id']);return getEndUser(_0x1dd242,_0x23ebfb[_0x6e70('0x57')],_0x23ebfb[_0x6e70('0x58')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x1b12a1){_0x3fb0d3=_0x1b12a1;logger[_0x6e70('0x1b')](_0x6e70('0x59'),_0x3fb0d3['id']);return createTicket(_0x1dd242,_0x2c20d3,_0x3fb0d3,_0x3aba34,_0x23ebfb,_0x3aba34[_0x6e70('0x5a')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x324fa6){_0x8ef4f7=_0x324fa6;logger[_0x6e70('0x1b')](_0x6e70('0x5b'));logger[_0x6e70('0x1b')]('The\x20Ticket\x20ID\x20is:',_0x8ef4f7['id']);var _0x28898a=util[_0x6e70('0x24')](_0x6e70('0x5c'),_0x1dd242[_0x6e70('0x40')],_[_0x6e70('0x5d')](_0x8ef4f7['id'],'x')[0x1]);logger[_0x6e70('0x1b')]('[QUEUE]',_0x6e70('0x5e'));emit(util[_0x6e70('0x24')]('user:%s',_0x4a111a[_0x6e70('0x19')]),_0x6e70('0x5f'),{'uri':_0x28898a});})[_0x6e70('0x48')](function(_0x590f7f){logger['error'](_0x6e70('0x50'),JSON[_0x6e70('0x27')](_0x590f7f));});};exports[_0x6e70('0x60')]=function(_0x41a861,_0x10d299,_0x739946,_0x30cd88,_0x57bfe5,_0x4d47e1,_0x2c8dc6){var _0x1e23c5,_0x2bf9ec,_0x2ad395,_0x5b1e6f;_0x4d47e1['remoteUri']=intUtil[_0x6e70('0x4f')](_0x4d47e1[_0x6e70('0x40')]);_0x4d47e1['serverUrl']=intUtil['stripTrailingSlash'](_0x4d47e1[_0x6e70('0x53')]);if(_0x2c8dc6&&_0x2c8dc6['recordingFormat']&&_0x2c8dc6[_0x6e70('0x61')]!==_0x6e70('0x62')){logger[_0x6e70('0x1b')](_0x6e70('0x63'),_0x6e70('0x64'));_0x10d299[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x4d47e1['serverUrl'],_0x10d299[_0x6e70('0x54')],md5(_0x10d299[_0x6e70('0x54')]));}return getConnection(_0x4d47e1)[_0x6e70('0x28')](function(_0x346c79){_0x5b1e6f=_0x346c79;return getUser(_0x4d47e1,_0x30cd88[_0x6e70('0x55')],_0x5b1e6f);})['then'](function(_0x5f5b02){_0x1e23c5=_0x5f5b02;logger['info'](_0x6e70('0x56'),_0x1e23c5['id']);return getEndUser(_0x4d47e1,_0x10d299[_0x6e70('0x65')],_0x10d299[_0x6e70('0x66')],_0x5b1e6f);})['then'](function(_0x58cf1c){_0x2bf9ec=_0x58cf1c;logger[_0x6e70('0x1b')](_0x6e70('0x59'),_0x2bf9ec['id']);return createTicket(_0x4d47e1,_0x1e23c5,_0x2bf9ec,_0x739946,_0x10d299,_0x739946[_0x6e70('0x5a')],_0x5b1e6f);})[_0x6e70('0x28')](function(_0x2285f1){_0x2ad395=_0x2285f1;logger[_0x6e70('0x1b')]('Ticket\x20created!');logger[_0x6e70('0x1b')](_0x6e70('0x67'),_0x2ad395['id']);var _0x30d11b=util[_0x6e70('0x24')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x4d47e1[_0x6e70('0x40')],_['split'](_0x2ad395['id'],'x')[0x1]);logger['info'](_0x6e70('0x63'),_0x6e70('0x5e'));emit(util[_0x6e70('0x24')](_0x6e70('0x68'),_0x30cd88[_0x6e70('0x19')]),_0x6e70('0x5f'),{'uri':_0x30d11b});})['catch'](function(_0x370eeb){logger[_0x6e70('0x2d')](_0x6e70('0x63'),JSON[_0x6e70('0x27')](_0x370eeb));});};exports[_0x6e70('0x69')]=function(_0x13c092,_0x363722,_0xd9b4a9,_0x2f1362,_0x29621a,_0x575938){var _0x44c877,_0x303c5a,_0x577c3b,_0x5d398a;_0x575938['remoteUri']=intUtil[_0x6e70('0x4f')](_0x575938[_0x6e70('0x40')]);_0x575938[_0x6e70('0x53')]=intUtil[_0x6e70('0x4f')](_0x575938[_0x6e70('0x53')]);if(_0x29621a&&_0x29621a['monitor_format']){logger['info']('['+_0x363722[_0x6e70('0x6a')][_0x6e70('0x6b')]()+']','Recording\x20is\x20enabled!');_0x363722[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x575938[_0x6e70('0x53')],_0x363722[_0x6e70('0x54')],md5(_0x363722[_0x6e70('0x54')]));}else{_0x363722[_0x6e70('0x51')]='';}return getConnection(_0x575938)[_0x6e70('0x28')](function(_0x3650e9){_0x5d398a=_0x3650e9;return getUser(_0x575938,'',_0x5d398a);})[_0x6e70('0x28')](function(_0x347cc4){_0x44c877=_0x347cc4;logger[_0x6e70('0x1b')](_0x6e70('0x56'),_0x44c877['id']);return getEndUser(_0x575938,_0x363722[_0x6e70('0x57')],_0x363722['calleridnum'],_0x5d398a);})['then'](function(_0x39ed95){_0x303c5a=_0x39ed95;logger['info'](_0x6e70('0x59'),_0x303c5a['id']);return createTicket(_0x575938,_0x44c877,_0x303c5a,_0xd9b4a9,_0x363722,_0xd9b4a9['Fields'],_0x5d398a);})['then'](function(_0x402f6f){_0x577c3b=_0x402f6f;logger['info']('Ticket\x20created!');logger[_0x6e70('0x1b')](_0x6e70('0x67'),_0x577c3b['id']);})[_0x6e70('0x48')](function(_0x4e9fda){logger['error']('['+_0x363722['lastevent'][_0x6e70('0x6b')]()+']',JSON['stringify'](_0x4e9fda));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/zendesk.js b/server/services/ami/trigger/integration/zendesk.js index f685637..760e001 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 _0x7c81=['request-promise','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','application/json','info','Creating\x20new\x20ticket...','format','remoteUri','POST','merge','Tags','name','getString','Subjects','Descriptions','then','ticket','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','type:user\x20role:agent\x20email:%s','Agent\x20found!','find','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','user','%s/users/me.json','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','results','length','end-user','first','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Caller\x20-\x20%s','Enduser\x20created.','authType','password','%s:%s','username','token','%s/token:%s','Basic\x20%s','toString','base64','debug','GET','forEach','includes','string','type','nameField','customField','toLowerCase','content','idField','custom_fields','push','variable','variableName','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','[QUEUE]','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','replace','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','outbound','recordingFormat','none','[OUTBOUND]','inspect','unmanaged','toUpperCase','calleridnum','lastevent','\x20Error\x20running\x20Zendesk\x20integration'];(function(_0x16b8c4,_0x217669){var _0x4d3eff=function(_0xec6aa4){while(--_0xec6aa4){_0x16b8c4['push'](_0x16b8c4['shift']());}};_0x4d3eff(++_0x217669);}(_0x7c81,0x6b));var _0x17c8=function(_0x67f95e,_0x3ca797){_0x67f95e=_0x67f95e-0x0;var _0x538f5a=_0x7c81[_0x67f95e];return _0x538f5a;};'use strict';var _=require('lodash');var rp=require(_0x17c8('0x0'));var md5=require(_0x17c8('0x1'));var util=require(_0x17c8('0x2'));var Redis=require(_0x17c8('0x3'));var intUtil=require(_0x17c8('0x4'));var config=require(_0x17c8('0x5'));var logger=require(_0x17c8('0x6'))('zendesk');config[_0x17c8('0x7')]=_[_0x17c8('0x8')](config[_0x17c8('0x7')],{'host':_0x17c8('0x9'),'port':0x18eb});var io=require(_0x17c8('0xa'))(new Redis(config['redis']));function emit(_0x542808,_0x4ef95c,_0x4fe35e){io['to'](_0x542808)['emit'](_0x4ef95c,_0x4fe35e);}var headers={'Content-Type':_0x17c8('0xb'),'Accept':_0x17c8('0xb')};function getTicket(_0x58f40b,_0x4e0769,_0x59b7c9,_0x4b0c7b,_0x569cc3){logger[_0x17c8('0xc')](_0x17c8('0xd'));return request({'uri':util[_0x17c8('0xe')]('%s/tickets.json',_0x58f40b[_0x17c8('0xf')]),'method':_0x17c8('0x10'),'body':{'ticket':_[_0x17c8('0x11')]({'requester_id':_0x59b7c9['id'],'submitter_id':_0x4e0769?_0x4e0769['id']:undefined,'assignee_id':_0x4e0769?_0x4e0769['id']:undefined,'tags':getTags(_0x4b0c7b[_0x17c8('0x12')],_0x17c8('0x13')),'subject':intUtil[_0x17c8('0x14')](_0x4b0c7b[_0x17c8('0x15')],_0x569cc3,'\x20'),'description':intUtil[_0x17c8('0x14')](_0x4b0c7b[_0x17c8('0x16')],_0x569cc3,'\x0a'),'comment':{'public':![],'body':intUtil[_0x17c8('0x14')](_0x4b0c7b[_0x17c8('0x16')],_0x569cc3,'\x0a')}},getCustomFields(_0x4b0c7b['Fields'],_0x569cc3))}})[_0x17c8('0x17')](function(_0x31e9c5){logger['info']('Ticket\x20created!');return _0x31e9c5[_0x17c8('0x18')];});}function getUser(_0x5c6833,_0x4ca433){if(intUtil[_0x17c8('0x19')](_0x4ca433)){logger[_0x17c8('0xc')](_0x17c8('0x1a'),_0x4ca433);return request({'uri':util[_0x17c8('0xe')](_0x17c8('0x1b'),_0x5c6833['remoteUri']),'qs':{'query':util['format'](_0x17c8('0x1c'),_0x4ca433)}})[_0x17c8('0x17')](function(_0x4736a9){if(_0x4736a9['count']){logger[_0x17c8('0xc')](_0x17c8('0x1d'));return _[_0x17c8('0x1e')](_0x4736a9['results'],{'email':_0x4ca433,'role':'agent'});}else{logger[_0x17c8('0xc')](_0x17c8('0x1f'));return request({'uri':util[_0x17c8('0xe')]('%s/users/me.json',_0x5c6833['remoteUri'])})[_0x17c8('0x17')](function(_0xa32264){logger['info'](_0x17c8('0x20'));return _0xa32264[_0x17c8('0x21')];});}});}else{logger[_0x17c8('0xc')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util['format'](_0x17c8('0x22'),_0x5c6833[_0x17c8('0xf')])})['then'](function(_0x5df06b){logger['info'](_0x17c8('0x20'));return _0x5df06b['user'];});}}function getEndUser(_0x1a6ac7,_0x304e35,_0x756c2b){logger[_0x17c8('0xc')](_0x17c8('0x23'),_0x756c2b);return request({'uri':util[_0x17c8('0xe')](_0x17c8('0x1b'),_0x1a6ac7[_0x17c8('0xf')]),'qs':{'query':util['format'](_0x17c8('0x24'),_0x756c2b)}})[_0x17c8('0x17')](function(_0x5d37bd){var _0x2a1023;if(_0x5d37bd[_0x17c8('0x25')][_0x17c8('0x26')]){_0x5d37bd[_0x17c8('0x25')]=_['filter'](_0x5d37bd['results'],{'suspended':![],'role':_0x17c8('0x27')});if(_0x5d37bd['results']['length']){_0x2a1023=_[_0x17c8('0x28')](_0x5d37bd[_0x17c8('0x25')]);}}if(_0x2a1023){logger[_0x17c8('0xc')]('Enduser\x20found!');return _0x2a1023;}else{logger[_0x17c8('0xc')](_0x17c8('0x29'));return request({'uri':util['format'](_0x17c8('0x2a'),_0x1a6ac7[_0x17c8('0xf')]),'method':'POST','body':{'user':{'role':_0x17c8('0x27'),'name':util['format'](_0x17c8('0x2b'),_0x304e35||_0x756c2b),'phone':_0x756c2b}}})[_0x17c8('0x17')](function(_0x191d2d){logger[_0x17c8('0xc')](_0x17c8('0x2c'));return _0x191d2d[_0x17c8('0x21')];});}});}function getAuth(_0x4418df){var _0x96d51;if(_0x4418df[_0x17c8('0x2d')]===_0x17c8('0x2e')){_0x96d51=util[_0x17c8('0xe')](_0x17c8('0x2f'),_0x4418df[_0x17c8('0x30')],_0x4418df[_0x17c8('0x2e')]);}else if(_0x4418df['authType']===_0x17c8('0x31')){_0x96d51=util[_0x17c8('0xe')](_0x17c8('0x32'),_0x4418df['username'],_0x4418df[_0x17c8('0x31')]);}return util[_0x17c8('0xe')](_0x17c8('0x33'),new Buffer(_0x96d51)[_0x17c8('0x34')](_0x17c8('0x35')));}function request(_0xb8eb67){logger[_0x17c8('0x36')]('[HTTP]',JSON['stringify'](_0xb8eb67));return rp(_[_0x17c8('0x8')](_0xb8eb67,{'method':_0x17c8('0x37'),'headers':headers,'json':!![]}));}function getTags(_0x4b6e56,_0x293e6a){var _0x520996=[];if(_0x4b6e56&&_0x4b6e56['length']>0x0){_0x520996=_['map'](_0x4b6e56,_0x293e6a);}return _0x520996;}function getCustomFields(_0x4fc072,_0x4fbe19){var _0x3fbe8f=[];var _0x485e86={'custom_fields':[]};if(_0x4fc072['length']>0x0){_[_0x17c8('0x38')](_0x4fc072,function(_0x3fe005){if(_[_0x17c8('0x39')]([_0x17c8('0x3a'),'picklist'],_0x3fe005[_0x17c8('0x3b')])&&_0x3fe005[_0x17c8('0x3c')]&&!_0x3fe005[_0x17c8('0x3d')]){_0x485e86[_0x3fe005['nameField'][_0x17c8('0x3e')]()]=_0x3fe005[_0x17c8('0x3f')][_0x17c8('0x34')]();}else if(_[_0x17c8('0x39')]([_0x17c8('0x3a'),'picklist'],_0x3fe005['type'])&&_0x3fe005[_0x17c8('0x40')]&&_0x3fe005[_0x17c8('0x3d')]){_0x485e86[_0x17c8('0x41')][_0x17c8('0x42')]({'id':_0x3fe005[_0x17c8('0x40')],'value':_0x3fe005[_0x17c8('0x3f')]['toString']()});}else if(_0x3fe005[_0x17c8('0x3b')]===_0x17c8('0x43')&&_0x3fe005['variableName']&&_0x3fe005[_0x17c8('0x40')]&&_0x3fe005['customField']){_0x4fbe19[_0x3fe005[_0x17c8('0x44')]]&&_0x485e86[_0x17c8('0x41')][_0x17c8('0x42')]({'id':_0x3fe005[_0x17c8('0x40')],'value':_0x4fbe19[_0x3fe005[_0x17c8('0x44')]][_0x17c8('0x34')]()});}else if(_0x3fe005[_0x17c8('0x3b')]==='customVariable'&&_0x3fe005[_0x17c8('0x45')]&&_0x3fe005[_0x17c8('0x45')][_0x17c8('0x13')]&&_0x3fe005[_0x17c8('0x40')]&&_0x3fe005[_0x17c8('0x3d')]){_0x4fbe19[_0x3fe005[_0x17c8('0x45')][_0x17c8('0x13')]['toLowerCase']()]&&_0x485e86[_0x17c8('0x41')][_0x17c8('0x42')]({'id':_0x3fe005[_0x17c8('0x40')],'value':_0x4fbe19[_0x3fe005['Variable'][_0x17c8('0x13')][_0x17c8('0x3e')]()][_0x17c8('0x34')]()});}});}return _0x485e86;}exports[_0x17c8('0x46')]=function(_0x35f31b,_0x1f7c08,_0x485e77,_0x1d0494,_0x2c3d62,_0x18f00b){var _0x580cc1,_0x1d2e64;_0x18f00b['remoteUri']=intUtil[_0x17c8('0x47')](_0x18f00b[_0x17c8('0xf')]);_0x18f00b[_0x17c8('0x48')]=intUtil[_0x17c8('0x47')](_0x18f00b[_0x17c8('0x48')]);if(_0x2c3d62&&_0x2c3d62[_0x17c8('0x49')]){logger['info']('[QUEUE]',_0x17c8('0x4a'));_0x1f7c08[_0x17c8('0x4b')]=util[_0x17c8('0xe')](_0x17c8('0x4c'),_0x18f00b[_0x17c8('0x48')],_0x1f7c08['uniqueid'],md5(_0x1f7c08[_0x17c8('0x4d')]));}else{_0x1f7c08[_0x17c8('0x4b')]='';}headers[_0x17c8('0x4e')]=getAuth(_0x18f00b);return getUser(_0x18f00b,_0x1d0494[_0x17c8('0x4f')])['then'](function(_0x5c37b3){_0x580cc1=_0x5c37b3;logger['info'](_0x17c8('0x50'),_0x580cc1['id']);return getEndUser(_0x18f00b,_0x1f7c08[_0x17c8('0x51')],_0x1f7c08['calleridnum']);})['then'](function(_0x30cf29){_0x1d2e64=_0x30cf29;logger[_0x17c8('0xc')](_0x17c8('0x52'),_0x1d2e64['id']);return getTicket(_0x18f00b,_0x580cc1,_0x1d2e64,_0x485e77,_0x1f7c08);})[_0x17c8('0x17')](function(_0x406260){if(_0x406260){logger['info'](_0x17c8('0x53'),_0x406260['id']);switch(_0x18f00b['type']){case _0x17c8('0x54'):logger[_0x17c8('0xc')](_0x17c8('0x55'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0x17c8('0xe')](_0x17c8('0x56'),_0x18f00b['remoteUri'],_0x580cc1['id'],_0x406260['id']),'method':_0x17c8('0x10')});case _0x17c8('0x57'):logger[_0x17c8('0xc')](_0x17c8('0x55'),_0x17c8('0x58'));emit(util[_0x17c8('0xe')](_0x17c8('0x59'),_0x1d0494[_0x17c8('0x13')]),_0x17c8('0x5a'),{'uri':util[_0x17c8('0xe')](_0x17c8('0x5b'),_0x18f00b[_0x17c8('0xf')][_0x17c8('0x5c')](_0x17c8('0x5d'),''),_0x406260['id'])});break;default:logger[_0x17c8('0x5e')](_0x17c8('0x55'),_0x17c8('0x5f'));}}})[_0x17c8('0x60')](function(_0xa7e43b){logger[_0x17c8('0x5e')]('[QUEUE]\x20Error\x20running\x20Zendesk\x20integration',util['inspect'](_0xa7e43b,{'showHidden':!![],'depth':null}));});};exports[_0x17c8('0x61')]=function(_0x43466f,_0x10042c,_0x1c75ef,_0x372233,_0x547671,_0xa87648,_0x31edb7){var _0x3ee7de,_0x423b1c;_0xa87648[_0x17c8('0xf')]=intUtil[_0x17c8('0x47')](_0xa87648[_0x17c8('0xf')]);_0xa87648[_0x17c8('0x48')]=intUtil[_0x17c8('0x47')](_0xa87648[_0x17c8('0x48')]);if(_0x31edb7&&_0x31edb7['recordingFormat']&&_0x31edb7[_0x17c8('0x62')]!==_0x17c8('0x63')){logger[_0x17c8('0xc')](_0x17c8('0x64'),_0x17c8('0x4a'));_0x10042c[_0x17c8('0x4b')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0xa87648[_0x17c8('0x48')],_0x10042c[_0x17c8('0x4d')],md5(_0x10042c[_0x17c8('0x4d')]));}headers['Authorization']=getAuth(_0xa87648);return getUser(_0xa87648,_0x372233['email'])['then'](function(_0x47a4ca){_0x3ee7de=_0x47a4ca;logger[_0x17c8('0xc')](_0x17c8('0x50'),_0x3ee7de['id']);return getEndUser(_0xa87648,_0x10042c['destcalleridname'],_0x10042c['destcalleridnum']);})[_0x17c8('0x17')](function(_0x132357){_0x423b1c=_0x132357;logger['info'](_0x17c8('0x52'),_0x423b1c['id']);return getTicket(_0xa87648,_0x3ee7de,_0x423b1c,_0x1c75ef,_0x10042c);})[_0x17c8('0x17')](function(_0x438036){if(_0x438036){logger[_0x17c8('0xc')](_0x17c8('0x53'),_0x438036['id']);switch(_0xa87648[_0x17c8('0x3b')]){case _0x17c8('0x54'):logger[_0x17c8('0xc')](_0x17c8('0x64'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util['format'](_0x17c8('0x56'),_0xa87648[_0x17c8('0xf')],_0x3ee7de['id'],_0x438036['id']),'method':_0x17c8('0x10')});case'newTab':logger[_0x17c8('0xc')](_0x17c8('0x64'),_0x17c8('0x58'));emit(util[_0x17c8('0xe')](_0x17c8('0x59'),_0x372233[_0x17c8('0x13')]),'trigger:browser:url',{'uri':util[_0x17c8('0xe')](_0x17c8('0x5b'),_0xa87648[_0x17c8('0xf')][_0x17c8('0x5c')](_0x17c8('0x5d'),''),_0x438036['id'])});break;default:logger['error']('[OUTBOUND]','Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0x17c8('0x60')](function(_0x20ca82){logger['error']('[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration',util[_0x17c8('0x65')](_0x20ca82,{'showHidden':!![],'depth':null}));});};exports[_0x17c8('0x66')]=function(_0x29ec64,_0x591c21,_0x54930c,_0x35df7e,_0xbc46be,_0x50d1af){var _0x558dbd,_0x2f7533;_0x50d1af[_0x17c8('0xf')]=intUtil[_0x17c8('0x47')](_0x50d1af[_0x17c8('0xf')]);_0x50d1af['serverUrl']=intUtil[_0x17c8('0x47')](_0x50d1af[_0x17c8('0x48')]);if(_0xbc46be&&_0xbc46be[_0x17c8('0x49')]){logger[_0x17c8('0xc')]('['+_0x591c21['lastevent'][_0x17c8('0x67')]()+']',_0x17c8('0x4a'));_0x591c21[_0x17c8('0x4b')]=util['format'](_0x17c8('0x4c'),_0x50d1af[_0x17c8('0x48')],_0x591c21[_0x17c8('0x4d')],md5(_0x591c21[_0x17c8('0x4d')]));}else{_0x591c21[_0x17c8('0x4b')]='';}headers['Authorization']=getAuth(_0x50d1af);return getUser(_0x50d1af)[_0x17c8('0x17')](function(_0x196e3c){_0x558dbd=_0x196e3c;logger['info'](_0x17c8('0x50'),_0x558dbd['id']);return getEndUser(_0x50d1af,_0x591c21['calleridname'],_0x591c21[_0x17c8('0x68')]);})[_0x17c8('0x17')](function(_0x13e21b){_0x2f7533=_0x13e21b;logger[_0x17c8('0xc')](_0x17c8('0x52'),_0x2f7533['id']);return getTicket(_0x50d1af,_0x558dbd,_0x2f7533,_0x54930c,_0x591c21);})[_0x17c8('0x17')](function(_0xd09ce1){if(_0xd09ce1){logger[_0x17c8('0xc')](_0x17c8('0x53'),_0xd09ce1['id']);}})['catch'](function(_0x3283b6){logger['error']('['+_0x591c21[_0x17c8('0x69')][_0x17c8('0x67')]()+']'+_0x17c8('0x6a'),util[_0x17c8('0x65')](_0x3283b6,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xfdcd=['picklist','type','customField','nameField','toLowerCase','content','custom_fields','push','idField','variableName','customVariable','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','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','[QUEUE]','Displaying\x20ticket\x20to\x20agent...','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','replace','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','none','destcalleridname','destcalleridnum','[OUTBOUND]','%s/channels/voice/agents/%d/tickets/%d/display.json','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','lastevent','toUpperCase','lodash','md5','ioredis','../../../../config/environment','../../../../config/logger','redis','socket.io-emitter','emit','application/json','info','Creating\x20new\x20ticket...','format','remoteUri','POST','Tags','name','getString','Subjects','Descriptions','then','ticket','Getting\x20agent\x20with\x20email','%s/search.json','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','find','results','user','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','length','filter','end-user','first','Enduser\x20found!','%s/users.json','Enduser\x20created.','authType','password','%s:%s','username','%s/token:%s','token','toString','base64','debug','defaults','GET','map','forEach','includes'];(function(_0x4ea413,_0x51ff3a){var _0x51cf25=function(_0x3c6456){while(--_0x3c6456){_0x4ea413['push'](_0x4ea413['shift']());}};_0x51cf25(++_0x51ff3a);}(_0xfdcd,0x16f));var _0xdfdc=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xfdcd[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0xdfdc('0x0'));var rp=require('request-promise');var md5=require(_0xdfdc('0x1'));var util=require('util');var Redis=require(_0xdfdc('0x2'));var intUtil=require('./util');var config=require(_0xdfdc('0x3'));var logger=require(_0xdfdc('0x4'))('zendesk');config[_0xdfdc('0x5')]=_['defaults'](config[_0xdfdc('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0xdfdc('0x6'))(new Redis(config[_0xdfdc('0x5')]));function emit(_0x494d95,_0x153257,_0x45ec80){io['to'](_0x494d95)[_0xdfdc('0x7')](_0x153257,_0x45ec80);}var headers={'Content-Type':_0xdfdc('0x8'),'Accept':_0xdfdc('0x8')};function getTicket(_0x525d08,_0x354d8a,_0x479049,_0x5a4512,_0xcdf659){logger[_0xdfdc('0x9')](_0xdfdc('0xa'));return request({'uri':util[_0xdfdc('0xb')]('%s/tickets.json',_0x525d08[_0xdfdc('0xc')]),'method':_0xdfdc('0xd'),'body':{'ticket':_['merge']({'requester_id':_0x479049['id'],'submitter_id':_0x354d8a?_0x354d8a['id']:undefined,'assignee_id':_0x354d8a?_0x354d8a['id']:undefined,'tags':getTags(_0x5a4512[_0xdfdc('0xe')],_0xdfdc('0xf')),'subject':intUtil[_0xdfdc('0x10')](_0x5a4512[_0xdfdc('0x11')],_0xcdf659,'\x20'),'description':intUtil[_0xdfdc('0x10')](_0x5a4512['Descriptions'],_0xcdf659,'\x0a'),'comment':{'public':![],'body':intUtil[_0xdfdc('0x10')](_0x5a4512[_0xdfdc('0x12')],_0xcdf659,'\x0a')}},getCustomFields(_0x5a4512['Fields'],_0xcdf659))}})[_0xdfdc('0x13')](function(_0xfdc93){logger[_0xdfdc('0x9')]('Ticket\x20created!');return _0xfdc93[_0xdfdc('0x14')];});}function getUser(_0x500201,_0x1736c8){if(intUtil['validateEmail'](_0x1736c8)){logger[_0xdfdc('0x9')](_0xdfdc('0x15'),_0x1736c8);return request({'uri':util[_0xdfdc('0xb')](_0xdfdc('0x16'),_0x500201[_0xdfdc('0xc')]),'qs':{'query':util[_0xdfdc('0xb')](_0xdfdc('0x17'),_0x1736c8)}})[_0xdfdc('0x13')](function(_0x465a31){if(_0x465a31[_0xdfdc('0x18')]){logger[_0xdfdc('0x9')](_0xdfdc('0x19'));return _[_0xdfdc('0x1a')](_0x465a31[_0xdfdc('0x1b')],{'email':_0x1736c8,'role':'agent'});}else{logger[_0xdfdc('0x9')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xdfdc('0xb')]('%s/users/me.json',_0x500201[_0xdfdc('0xc')])})['then'](function(_0x863a70){logger[_0xdfdc('0x9')]('Admin\x20account\x20selected.');return _0x863a70[_0xdfdc('0x1c')];});}});}else{logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xdfdc('0xb')]('%s/users/me.json',_0x500201['remoteUri'])})[_0xdfdc('0x13')](function(_0x1d04ae){logger['info'](_0xdfdc('0x1d'));return _0x1d04ae[_0xdfdc('0x1c')];});}}function getEndUser(_0x1ea46f,_0x5169a0,_0x13723b){logger['info'](_0xdfdc('0x1e'),_0x13723b);return request({'uri':util[_0xdfdc('0xb')](_0xdfdc('0x16'),_0x1ea46f[_0xdfdc('0xc')]),'qs':{'query':util[_0xdfdc('0xb')](_0xdfdc('0x1f'),_0x13723b)}})[_0xdfdc('0x13')](function(_0x5564ea){var _0x201193;if(_0x5564ea['results'][_0xdfdc('0x20')]){_0x5564ea[_0xdfdc('0x1b')]=_[_0xdfdc('0x21')](_0x5564ea[_0xdfdc('0x1b')],{'suspended':![],'role':_0xdfdc('0x22')});if(_0x5564ea['results'][_0xdfdc('0x20')]){_0x201193=_[_0xdfdc('0x23')](_0x5564ea[_0xdfdc('0x1b')]);}}if(_0x201193){logger[_0xdfdc('0x9')](_0xdfdc('0x24'));return _0x201193;}else{logger[_0xdfdc('0x9')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util['format'](_0xdfdc('0x25'),_0x1ea46f['remoteUri']),'method':_0xdfdc('0xd'),'body':{'user':{'role':_0xdfdc('0x22'),'name':util['format']('Caller\x20-\x20%s',_0x5169a0||_0x13723b),'phone':_0x13723b}}})['then'](function(_0x14bce6){logger[_0xdfdc('0x9')](_0xdfdc('0x26'));return _0x14bce6[_0xdfdc('0x1c')];});}});}function getAuth(_0x46a7ab){var _0x53c3fb;if(_0x46a7ab[_0xdfdc('0x27')]===_0xdfdc('0x28')){_0x53c3fb=util['format'](_0xdfdc('0x29'),_0x46a7ab[_0xdfdc('0x2a')],_0x46a7ab[_0xdfdc('0x28')]);}else if(_0x46a7ab[_0xdfdc('0x27')]==='token'){_0x53c3fb=util['format'](_0xdfdc('0x2b'),_0x46a7ab[_0xdfdc('0x2a')],_0x46a7ab[_0xdfdc('0x2c')]);}return util['format']('Basic\x20%s',new Buffer(_0x53c3fb)[_0xdfdc('0x2d')](_0xdfdc('0x2e')));}function request(_0x53f92e){logger[_0xdfdc('0x2f')]('[HTTP]',JSON['stringify'](_0x53f92e));return rp(_[_0xdfdc('0x30')](_0x53f92e,{'method':_0xdfdc('0x31'),'headers':headers,'json':!![]}));}function getTags(_0x499447,_0x57d80f){var _0x17c3a0=[];if(_0x499447&&_0x499447[_0xdfdc('0x20')]>0x0){_0x17c3a0=_[_0xdfdc('0x32')](_0x499447,_0x57d80f);}return _0x17c3a0;}function getCustomFields(_0x3265f0,_0x133a38){var _0x43a764=[];var _0x440dfc={'custom_fields':[]};if(_0x3265f0[_0xdfdc('0x20')]>0x0){_[_0xdfdc('0x33')](_0x3265f0,function(_0x189817){if(_[_0xdfdc('0x34')](['string',_0xdfdc('0x35')],_0x189817[_0xdfdc('0x36')])&&_0x189817['nameField']&&!_0x189817[_0xdfdc('0x37')]){_0x440dfc[_0x189817[_0xdfdc('0x38')][_0xdfdc('0x39')]()]=_0x189817[_0xdfdc('0x3a')][_0xdfdc('0x2d')]();}else if(_['includes'](['string','picklist'],_0x189817[_0xdfdc('0x36')])&&_0x189817['idField']&&_0x189817[_0xdfdc('0x37')]){_0x440dfc[_0xdfdc('0x3b')][_0xdfdc('0x3c')]({'id':_0x189817[_0xdfdc('0x3d')],'value':_0x189817[_0xdfdc('0x3a')][_0xdfdc('0x2d')]()});}else if(_0x189817[_0xdfdc('0x36')]==='variable'&&_0x189817[_0xdfdc('0x3e')]&&_0x189817[_0xdfdc('0x3d')]&&_0x189817[_0xdfdc('0x37')]){_0x133a38[_0x189817[_0xdfdc('0x3e')]]&&_0x440dfc['custom_fields']['push']({'id':_0x189817[_0xdfdc('0x3d')],'value':_0x133a38[_0x189817[_0xdfdc('0x3e')]][_0xdfdc('0x2d')]()});}else if(_0x189817[_0xdfdc('0x36')]===_0xdfdc('0x3f')&&_0x189817[_0xdfdc('0x40')]&&_0x189817[_0xdfdc('0x40')][_0xdfdc('0xf')]&&_0x189817[_0xdfdc('0x3d')]&&_0x189817['customField']){_0x133a38[_0x189817['Variable']['name']['toLowerCase']()]&&_0x440dfc['custom_fields']['push']({'id':_0x189817[_0xdfdc('0x3d')],'value':_0x133a38[_0x189817[_0xdfdc('0x40')]['name']['toLowerCase']()]['toString']()});}});}return _0x440dfc;}exports[_0xdfdc('0x41')]=function(_0x76df58,_0x38b888,_0x232db7,_0x3038fd,_0x513b70,_0x44998e){var _0x308862,_0x25a004;_0x44998e[_0xdfdc('0xc')]=intUtil[_0xdfdc('0x42')](_0x44998e[_0xdfdc('0xc')]);_0x44998e[_0xdfdc('0x43')]=intUtil['stripTrailingSlash'](_0x44998e[_0xdfdc('0x43')]);if(_0x513b70&&_0x513b70[_0xdfdc('0x44')]){logger[_0xdfdc('0x9')]('[QUEUE]','Recording\x20is\x20enabled!');_0x38b888[_0xdfdc('0x45')]=util[_0xdfdc('0xb')](_0xdfdc('0x46'),_0x44998e[_0xdfdc('0x43')],_0x38b888['uniqueid'],md5(_0x38b888[_0xdfdc('0x47')]));}else{_0x38b888[_0xdfdc('0x45')]='';}headers[_0xdfdc('0x48')]=getAuth(_0x44998e);return getUser(_0x44998e,_0x3038fd[_0xdfdc('0x49')])[_0xdfdc('0x13')](function(_0xa57487){_0x308862=_0xa57487;logger[_0xdfdc('0x9')](_0xdfdc('0x4a'),_0x308862['id']);return getEndUser(_0x44998e,_0x38b888[_0xdfdc('0x4b')],_0x38b888[_0xdfdc('0x4c')]);})[_0xdfdc('0x13')](function(_0x2be7fb){_0x25a004=_0x2be7fb;logger[_0xdfdc('0x9')](_0xdfdc('0x4d'),_0x25a004['id']);return getTicket(_0x44998e,_0x308862,_0x25a004,_0x232db7,_0x38b888);})[_0xdfdc('0x13')](function(_0x128e2c){if(_0x128e2c){logger[_0xdfdc('0x9')](_0xdfdc('0x4e'),_0x128e2c['id']);switch(_0x44998e[_0xdfdc('0x36')]){case _0xdfdc('0x4f'):logger[_0xdfdc('0x9')](_0xdfdc('0x50'),_0xdfdc('0x51'));return request({'uri':util[_0xdfdc('0xb')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x44998e[_0xdfdc('0xc')],_0x308862['id'],_0x128e2c['id']),'method':_0xdfdc('0xd')});case _0xdfdc('0x52'):logger['info']('[QUEUE]',_0xdfdc('0x53'));emit(util['format'](_0xdfdc('0x54'),_0x3038fd[_0xdfdc('0xf')]),_0xdfdc('0x55'),{'uri':util[_0xdfdc('0xb')](_0xdfdc('0x56'),_0x44998e['remoteUri'][_0xdfdc('0x57')](_0xdfdc('0x58'),''),_0x128e2c['id'])});break;default:logger[_0xdfdc('0x59')](_0xdfdc('0x50'),_0xdfdc('0x5a'));}}})[_0xdfdc('0x5b')](function(_0x3b5b79){logger[_0xdfdc('0x59')](_0xdfdc('0x5c'),util[_0xdfdc('0x5d')](_0x3b5b79,{'showHidden':!![],'depth':null}));});};exports[_0xdfdc('0x5e')]=function(_0x3f73b6,_0x5c6d3e,_0x6e84cc,_0x4181be,_0x28ba0a,_0x390324,_0x16c67b){var _0x4c4497,_0x50f3ef;_0x390324['remoteUri']=intUtil[_0xdfdc('0x42')](_0x390324[_0xdfdc('0xc')]);_0x390324[_0xdfdc('0x43')]=intUtil[_0xdfdc('0x42')](_0x390324[_0xdfdc('0x43')]);if(_0x16c67b&&_0x16c67b[_0xdfdc('0x5f')]&&_0x16c67b[_0xdfdc('0x5f')]!==_0xdfdc('0x60')){logger[_0xdfdc('0x9')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x5c6d3e[_0xdfdc('0x45')]=util[_0xdfdc('0xb')](_0xdfdc('0x46'),_0x390324['serverUrl'],_0x5c6d3e[_0xdfdc('0x47')],md5(_0x5c6d3e[_0xdfdc('0x47')]));}headers[_0xdfdc('0x48')]=getAuth(_0x390324);return getUser(_0x390324,_0x4181be[_0xdfdc('0x49')])[_0xdfdc('0x13')](function(_0x23a028){_0x4c4497=_0x23a028;logger[_0xdfdc('0x9')](_0xdfdc('0x4a'),_0x4c4497['id']);return getEndUser(_0x390324,_0x5c6d3e[_0xdfdc('0x61')],_0x5c6d3e[_0xdfdc('0x62')]);})[_0xdfdc('0x13')](function(_0x2cd6ae){_0x50f3ef=_0x2cd6ae;logger[_0xdfdc('0x9')](_0xdfdc('0x4d'),_0x50f3ef['id']);return getTicket(_0x390324,_0x4c4497,_0x50f3ef,_0x6e84cc,_0x5c6d3e);})[_0xdfdc('0x13')](function(_0x401ce9){if(_0x401ce9){logger['info'](_0xdfdc('0x4e'),_0x401ce9['id']);switch(_0x390324[_0xdfdc('0x36')]){case _0xdfdc('0x4f'):logger[_0xdfdc('0x9')](_0xdfdc('0x63'),_0xdfdc('0x51'));return request({'uri':util['format'](_0xdfdc('0x64'),_0x390324[_0xdfdc('0xc')],_0x4c4497['id'],_0x401ce9['id']),'method':_0xdfdc('0xd')});case'newTab':logger[_0xdfdc('0x9')](_0xdfdc('0x63'),_0xdfdc('0x53'));emit(util[_0xdfdc('0xb')](_0xdfdc('0x54'),_0x4181be[_0xdfdc('0xf')]),_0xdfdc('0x55'),{'uri':util[_0xdfdc('0xb')]('%s/agent/tickets/%s',_0x390324[_0xdfdc('0xc')][_0xdfdc('0x57')](_0xdfdc('0x58'),''),_0x401ce9['id'])});break;default:logger['error'](_0xdfdc('0x63'),_0xdfdc('0x5a'));}}})[_0xdfdc('0x5b')](function(_0x28eef0){logger[_0xdfdc('0x59')](_0xdfdc('0x65'),util[_0xdfdc('0x5d')](_0x28eef0,{'showHidden':!![],'depth':null}));});};exports[_0xdfdc('0x66')]=function(_0x2f67e4,_0x34cd6e,_0x214cb2,_0xa2edf3,_0x35228a,_0x458fb7){var _0x527214,_0x15af2a;_0x458fb7[_0xdfdc('0xc')]=intUtil[_0xdfdc('0x42')](_0x458fb7[_0xdfdc('0xc')]);_0x458fb7[_0xdfdc('0x43')]=intUtil['stripTrailingSlash'](_0x458fb7[_0xdfdc('0x43')]);if(_0x35228a&&_0x35228a['monitor_format']){logger[_0xdfdc('0x9')]('['+_0x34cd6e[_0xdfdc('0x67')][_0xdfdc('0x68')]()+']','Recording\x20is\x20enabled!');_0x34cd6e['recordingURL']=util[_0xdfdc('0xb')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x458fb7['serverUrl'],_0x34cd6e['uniqueid'],md5(_0x34cd6e['uniqueid']));}else{_0x34cd6e[_0xdfdc('0x45')]='';}headers[_0xdfdc('0x48')]=getAuth(_0x458fb7);return getUser(_0x458fb7)[_0xdfdc('0x13')](function(_0x264dc3){_0x527214=_0x264dc3;logger[_0xdfdc('0x9')](_0xdfdc('0x4a'),_0x527214['id']);return getEndUser(_0x458fb7,_0x34cd6e[_0xdfdc('0x4b')],_0x34cd6e['calleridnum']);})[_0xdfdc('0x13')](function(_0x51f8b9){_0x15af2a=_0x51f8b9;logger['info'](_0xdfdc('0x4d'),_0x15af2a['id']);return getTicket(_0x458fb7,_0x527214,_0x15af2a,_0x214cb2,_0x34cd6e);})[_0xdfdc('0x13')](function(_0x4c7c24){if(_0x4c7c24){logger['info']('The\x20Ticket\x20ID\x20is:',_0x4c7c24['id']);}})[_0xdfdc('0x5b')](function(_0x284974){logger[_0xdfdc('0x59')]('['+_0x34cd6e['lastevent'][_0xdfdc('0x68')]()+']'+'\x20Error\x20running\x20Zendesk\x20integration',util[_0xdfdc('0x5d')](_0x284974,{'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 6913af9..dcf9e54 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 _0x0a1a=['[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','com','The\x20User\x20ID\x20is:','calleridname','calleridnum','Inbound','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','https://crm.','stripTrailingSlash','recordingFormat','none','/api/voice/recordings/','destcalleridnum','Outbound','[OUTBOUND]','/crm/EntityInfo.do?module=Calls&id=','unmanaged','lastevent','toUpperCase','lodash','request-promise','md5','util','./util','moment','ioredis','bluebird','../../../../config/logger','zoho','redis','defaults','localhost','emit','debug','[HTTP]','stringify','forEach','string','picklist','type','idField','content','toString','variable','variableName','customVariable','Variable','name','toLowerCase','indexOf','split','isNil','expires_in','zone','https://accounts.zoho.com','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','then','add','seconds','access_token','catch','error','Failing\x20creating\x20the\x20access_token','stack','Search\x20user','GET','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','users','isArrayLikeObject','findIndex','email','info','Using\x20the\x20admin\x20account!','Administrator','user','profile','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','enduserType','POST','/crm/v2/','moduleCreate','role','first_name','code','SUCCESS','startCase','log','CREATE\x20ERROR','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','https://www.zohoapis.','nothing','contact','Contacts','lead','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','Creating\x20new\x20call...','Owner','administrator','last_name','Subject','Description','getString','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','talktime','Call_Duration','utc','mm:ss','answertime','endtime','YYYY-MM-DDTHH:mm:ss','diff','starttime','format','Call_Result','Called','complete','connect','Answered','rejected','Rejected','Abandoned','timeout','Timeout','Call_Start_Time','agentcalledAt','Call_Type','merge','Fields','/crm/v2/Calls','Call\x20created!','details','err','queue','host','serverUrl','monitor_format'];(function(_0x463376,_0x13871c){var _0x336ccd=function(_0x33afd2){while(--_0x33afd2){_0x463376['push'](_0x463376['shift']());}};_0x336ccd(++_0x13871c);}(_0x0a1a,0x161));var _0xa0a1=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x0a1a[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xa0a1('0x0'));var rp=require(_0xa0a1('0x1'));var md5=require(_0xa0a1('0x2'));var util=require(_0xa0a1('0x3'));var intUtil=require(_0xa0a1('0x4'));var moment=require(_0xa0a1('0x5'));var Redis=require(_0xa0a1('0x6'));var BPromise=require(_0xa0a1('0x7'));var config=require('../../../../config/environment');var logger=require(_0xa0a1('0x8'))(_0xa0a1('0x9'));config[_0xa0a1('0xa')]=_[_0xa0a1('0xb')](config[_0xa0a1('0xa')],{'host':_0xa0a1('0xc'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xa0a1('0xa')]));function emit(_0xe8b7b3,_0xf9d4c8,_0x189e92){io['to'](_0xe8b7b3)[_0xa0a1('0xd')](_0xf9d4c8,_0x189e92);}function request(_0x303535){logger[_0xa0a1('0xe')](_0xa0a1('0xf'),JSON[_0xa0a1('0x10')](_0x303535));return rp(_0x303535);}function getCustomFields(_0x42a779,_0x2f61c5){var _0x2b9564={};if(_0x42a779['length']>0x0){_[_0xa0a1('0x11')](_0x42a779,function(_0x2d50d2){if(_['includes']([_0xa0a1('0x12'),_0xa0a1('0x13')],_0x2d50d2[_0xa0a1('0x14')])&&_0x2d50d2[_0xa0a1('0x15')]){_0x2b9564[_0x2d50d2[_0xa0a1('0x15')]]=_0x2d50d2[_0xa0a1('0x16')][_0xa0a1('0x17')]();}else if(_0x2d50d2['type']===_0xa0a1('0x18')&&_0x2d50d2[_0xa0a1('0x19')]&&_0x2d50d2[_0xa0a1('0x15')]&&_0x2f61c5[_0x2d50d2[_0xa0a1('0x19')]]){_0x2b9564[_0x2d50d2[_0xa0a1('0x15')]]=_0x2f61c5[_0x2d50d2[_0xa0a1('0x19')]][_0xa0a1('0x17')]();}else if(_0x2d50d2[_0xa0a1('0x14')]===_0xa0a1('0x1a')&&_0x2d50d2[_0xa0a1('0x1b')]&&_0x2d50d2['Variable'][_0xa0a1('0x1c')]&&_0x2d50d2['idField']&&_0x2f61c5[_0x2d50d2[_0xa0a1('0x1b')][_0xa0a1('0x1c')][_0xa0a1('0x1d')]()]){_0x2b9564[_0x2d50d2[_0xa0a1('0x15')]]=_0x2f61c5[_0x2d50d2[_0xa0a1('0x1b')][_0xa0a1('0x1c')][_0xa0a1('0x1d')]()][_0xa0a1('0x17')]();}});}return _0x2b9564;}function getName(_0x5b0e25){if(_0x5b0e25[_0xa0a1('0x1e')]('\x20')>0x0){var _0x228638=_0x5b0e25[_0xa0a1('0x1f')](/ (.+)/);if(_0x228638[0x1]){return _0x228638;}}return[_0x5b0e25,_0x5b0e25];}var accountsTokens={};function getAccessToken(_0x2d479f){return new Promise(function(_0x494553,_0x3c31dd){if(!_[_0xa0a1('0x20')](accountsTokens[_0x2d479f['id']])&&!_[_0xa0a1('0x20')](accountsTokens[_0x2d479f['id']]['access_token'])){if(moment()['isBefore'](accountsTokens[_0x2d479f['id']][_0xa0a1('0x21')])){_0x494553(accountsTokens[_0x2d479f['id']]['access_token']);}}var _0x45c72f;switch(_0x2d479f[_0xa0a1('0x22')]){case'US':_0x45c72f=_0xa0a1('0x23');break;case'AU':_0x45c72f='https://accounts.zoho.com.au';break;case'EU':_0x45c72f=_0xa0a1('0x24');break;case'IN':_0x45c72f=_0xa0a1('0x25');break;case'CN':_0x45c72f=_0xa0a1('0x26');break;default:_0x45c72f='https://accounts.zoho.eu';break;}var _0x4f84c0={'method':'POST','uri':_0x45c72f+_0xa0a1('0x27'),'qs':{'refresh_token':_0x2d479f[_0xa0a1('0x28')],'client_id':_0x2d479f[_0xa0a1('0x29')],'client_secret':_0x2d479f[_0xa0a1('0x2a')],'grant_type':_0xa0a1('0x2b')},'json':!![]};return rp(_0x4f84c0)[_0xa0a1('0x2c')](function(_0x4ca8e6){accountsTokens[_0x2d479f['id']]={'access_token':_0x4ca8e6['access_token'],'expires_in':moment()[_0xa0a1('0x2d')](_0x4ca8e6[_0xa0a1('0x21')],_0xa0a1('0x2e'))};_0x494553(_0x4ca8e6[_0xa0a1('0x2f')]);})[_0xa0a1('0x30')](function(_0x15d222){logger[_0xa0a1('0x31')](_0xa0a1('0x32'),_0x15d222[_0xa0a1('0x33')]);_0x3c31dd(_0x15d222);});});}function getUser(_0x41bc5e,_0x3b606b,_0x2255df,_0x3adee3){logger['info'](_0xa0a1('0x34'));return request({'method':_0xa0a1('0x35'),'uri':util['format'](_0xa0a1('0x36'),_0x3b606b),'qs':{'type':_0xa0a1('0x37')},'headers':{'Authorization':_0xa0a1('0x38')+_0x41bc5e},'json':!![]})[_0xa0a1('0x2c')](function(_0x471585){if(_0x471585[_0xa0a1('0x39')]){var _0x42294c=-0x1;if(_[_0xa0a1('0x3a')](_0x471585['users'])){if(!_['isNil'](_0x3adee3)){_0x42294c=_[_0xa0a1('0x3b')](_0x471585[_0xa0a1('0x39')],function(_0x586c90){return _0x586c90[_0xa0a1('0x3c')]===_0x3adee3;});}if(_0x42294c>=0x0){logger[_0xa0a1('0x3d')]('Agent\x20found!');}else{logger[_0xa0a1('0x3d')](_0xa0a1('0x3e'));_0x42294c=_[_0xa0a1('0x3b')](_0x471585[_0xa0a1('0x39')],function(_0x3dfb20){return _0x3dfb20['profile'][_0xa0a1('0x1c')]===_0xa0a1('0x3f');});}return _0x471585[_0xa0a1('0x39')][_0x42294c];}else{if(_0x471585[_0xa0a1('0x40')][_0xa0a1('0x41')]['name']==='Administrator'){logger[_0xa0a1('0x3d')](_0xa0a1('0x3e'));user=_0x471585[_0xa0a1('0x40')];return user;}else{logger[_0xa0a1('0x31')]('The\x20failing\x20result\x20is',JSON[_0xa0a1('0x10')](_0x471585));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON['stringify'](_0x471585));}}}else{logger[_0xa0a1('0x31')](_0xa0a1('0x42'),JSON['stringify'](_0x471585));throw new Error(_0xa0a1('0x43')+JSON[_0xa0a1('0x10')](_0x471585));}})[_0xa0a1('0x30')](function(_0x59cec0){console[_0xa0a1('0x31')](_0x59cec0);});}function getZohoUser(_0x264422,_0x28ea8f){return new BPromise(function(_0xfd9343,_0x49cc1c){request(_0x264422)[_0xa0a1('0x2c')](function(_0x4ed612){var _0x4e4b74=null;if(_0x4ed612){_0x4e4b74=_0x4ed612[_0xa0a1('0x44')][0x0];_0x4e4b74[_0xa0a1('0x45')]=_0x28ea8f;}_0xfd9343(_0x4e4b74);})['catch'](function(_0x40adad){_0x49cc1c(_0x40adad);});});}function createEndUser(_0xde7a3e,_0x3c8e58,_0x24f6ae,_0x2b2cda,_0x597f28,_0x270da0){var _0x24f6ae=getName(_0x24f6ae);return request({'method':_0xa0a1('0x46'),'uri':'https://www.zohoapis.'+_0x3c8e58+_0xa0a1('0x47')+_['startCase'](_0x270da0[_0xa0a1('0x48')])+'s','body':{'data':[{'Last_Name':_0x24f6ae[0x1],'First_Name':_0x24f6ae[0x0],'Phone':_0x2b2cda,'Owner':{'name':!_[_0xa0a1('0x20')](_0x597f28[_0xa0a1('0x49')][_0xa0a1('0x1c')])?_0x597f28['role']['name']:!_[_0xa0a1('0x20')](_0x597f28[_0xa0a1('0x4a')])?_0x597f28[_0xa0a1('0x4a')]+'\x20'+_0x597f28['last_name']:_0x597f28['last_name'],'id':_0x597f28['id']}}]},'headers':{'Authorization':_0xa0a1('0x38')+_0xde7a3e},'json':!![]})[_0xa0a1('0x2c')](function(_0x100bac){if(_0x100bac&&_0x100bac[_0xa0a1('0x44')][0x0][_0xa0a1('0x4b')]===_0xa0a1('0x4c')){var _0x453575=_0x100bac[_0xa0a1('0x44')][0x0]['details'];_0x453575[_0xa0a1('0x45')]=_[_0xa0a1('0x4d')](_0x270da0[_0xa0a1('0x48')])+'s';return _0x453575;}logger[_0xa0a1('0x31')](_0xa0a1('0x42'),JSON[_0xa0a1('0x10')](data));throw new Error('Error:\x20'+JSON[_0xa0a1('0x10')](data));})[_0xa0a1('0x30')](function(_0x5b750c){console[_0xa0a1('0x4e')](_0xa0a1('0x4f'),_0x5b750c);});}function getEndUser(_0x5f1449,_0x2f1045,_0x49eb3b,_0xce220f,_0x2c7298,_0x1ba6eb,_0xdaa881){var _0x4b6ef2={'method':_0xa0a1('0x35'),'uri':'','headers':{'Authorization':_0xa0a1('0x38')+_0x5f1449},'json':!![]};switch(_0xdaa881['moduleSearch']){case'contact_lead':_0x4b6ef2[_0xa0a1('0x50')]='https://www.zohoapis.'+_0x2f1045+_0xa0a1('0x51')+_0x2c7298+'))';return getZohoUser(_0x4b6ef2,'Contacts')[_0xa0a1('0x2c')](function(_0x339f9a){if(_0x339f9a)return _0x339f9a;_0x4b6ef2[_0xa0a1('0x50')]=_0xa0a1('0x52')+_0x2f1045+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x2c7298+'))';return getZohoUser(_0x4b6ef2,'Leads')[_0xa0a1('0x2c')](function(_0xa3c26f){if(_0xa3c26f)return _0xa3c26f;if(_0xdaa881[_0xa0a1('0x48')]!=_0xa0a1('0x53')){return createEndUser(_0x5f1449,_0x2f1045,_0xce220f,_0x2c7298,_0x1ba6eb,_0xdaa881);}else{return{};}});});break;case _0xa0a1('0x54'):_0x4b6ef2[_0xa0a1('0x50')]=_0xa0a1('0x52')+_0x2f1045+_0xa0a1('0x51')+_0x2c7298+'))';return getZohoUser(_0x4b6ef2,_0xa0a1('0x55'))[_0xa0a1('0x2c')](function(_0x590c1a){if(_0x590c1a)return _0x590c1a;if(_0xdaa881[_0xa0a1('0x48')]!='nothing'){return createEndUser(_0x5f1449,_0x2f1045,_0xce220f,_0x2c7298,_0x1ba6eb,_0xdaa881);}else{return{};}});break;case _0xa0a1('0x56'):_0x4b6ef2['uri']=_0xa0a1('0x52')+_0x2f1045+_0xa0a1('0x57')+_0x2c7298+'))';return getZohoUser(_0x4b6ef2,_0xa0a1('0x58'))[_0xa0a1('0x2c')](function(_0x3e721a){if(_0x3e721a)return _0x3e721a;if(_0xdaa881[_0xa0a1('0x48')]!=_0xa0a1('0x53')){return createEndUser(_0x5f1449,_0x2f1045,_0xce220f,_0x2c7298,_0x1ba6eb,_0xdaa881);}else{return{};}});break;}}function getCall(_0xa6138a,_0xf6a1cd,_0x15cb19,_0x46a68a,_0x35c13b,_0x290219,_0x38fdb8,_0x3e10d3){logger[_0xa0a1('0x3d')](_0xa0a1('0x59'));var _0x2ebbec={};_0x2ebbec[_0xa0a1('0x5a')]={'name':!_[_0xa0a1('0x20')](_0x46a68a['role'][_0xa0a1('0x1c')])&&!_[_0xa0a1('0x20')](_0x46a68a[_0xa0a1('0x41')][_0xa0a1('0x1c')])&&_0x46a68a[_0xa0a1('0x41')][_0xa0a1('0x1c')]===_0xa0a1('0x5b')?_0x46a68a[_0xa0a1('0x49')]['name']:!_[_0xa0a1('0x20')](_0x46a68a['first_name'])?_0x46a68a[_0xa0a1('0x4a')]+'\x20'+_0x46a68a['last_name']:_0x46a68a[_0xa0a1('0x5c')],'id':_0x46a68a['id']};_0x2ebbec[_0xa0a1('0x5d')]=intUtil['getString'](_0x290219['Subjects'],_0x38fdb8,'\x20');_0x2ebbec[_0xa0a1('0x5e')]=intUtil[_0xa0a1('0x5f')](_0x290219[_0xa0a1('0x60')],_0x38fdb8,'\x0a');if(_0x35c13b[_0xa0a1('0x45')]==='Contacts'){_0x2ebbec[_0xa0a1('0x61')]={'name':!_['isNil'](_0x35c13b[_0xa0a1('0x62')])?_0x35c13b[_0xa0a1('0x62')]:!_['isNil'](_0x35c13b[_0xa0a1('0x63')])?_0x35c13b[_0xa0a1('0x63')]+'\x20'+_0x35c13b[_0xa0a1('0x64')]:_0x35c13b[_0xa0a1('0x64')],'id':_0x35c13b['id']};}if(_0x35c13b[_0xa0a1('0x45')]===_0xa0a1('0x58')){_0x2ebbec[_0xa0a1('0x65')]={'name':!_[_0xa0a1('0x20')](_0x35c13b[_0xa0a1('0x62')])?_0x35c13b[_0xa0a1('0x62')]:!_[_0xa0a1('0x20')](_0x35c13b[_0xa0a1('0x63')])?_0x35c13b[_0xa0a1('0x63')]+'\x20'+_0x35c13b[_0xa0a1('0x64')]:_0x35c13b[_0xa0a1('0x64')],'id':_0x35c13b['id']};_0x2ebbec[_0xa0a1('0x66')]=_[_0xa0a1('0x4d')](_0x35c13b['enduserType']);}if(_0x38fdb8[_0xa0a1('0x67')]){_0x2ebbec[_0xa0a1('0x68')]=moment[_0xa0a1('0x69')](parseInt(_0x38fdb8[_0xa0a1('0x67')])*0x3e8)['format'](_0xa0a1('0x6a'));}else if(_0x38fdb8[_0xa0a1('0x6b')]&&_0x38fdb8[_0xa0a1('0x6c')]){_0x2ebbec[_0xa0a1('0x68')]=moment['utc'](moment(_0x38fdb8[_0xa0a1('0x6c')],_0xa0a1('0x6d'))[_0xa0a1('0x6e')](moment(_0x38fdb8[_0xa0a1('0x6f')],_0xa0a1('0x6d'))))[_0xa0a1('0x70')]('mm:ss');}switch(_0x38fdb8['lastevent']){case'called':_0x2ebbec[_0xa0a1('0x71')]=_0xa0a1('0x72');break;case _0xa0a1('0x73'):case _0xa0a1('0x74'):_0x2ebbec[_0xa0a1('0x71')]=_0xa0a1('0x75');break;case _0xa0a1('0x76'):_0x2ebbec[_0xa0a1('0x71')]=_0xa0a1('0x77');break;case'abandoned':_0x2ebbec[_0xa0a1('0x71')]=_0xa0a1('0x78');break;case _0xa0a1('0x79'):_0x2ebbec[_0xa0a1('0x71')]=_0xa0a1('0x7a');default:}_0x2ebbec[_0xa0a1('0x7b')]=(_0x3e10d3==='outbound'?moment(_0x38fdb8[_0xa0a1('0x6f')])['format'](_0xa0a1('0x6d')):moment(_0x38fdb8[_0xa0a1('0x7c')])[_0xa0a1('0x70')](_0xa0a1('0x6d')))||moment()['format'](_0xa0a1('0x6d'));_0x2ebbec[_0xa0a1('0x7d')]=_0x3e10d3||'Inbound';_0x2ebbec=_[_0xa0a1('0x7e')](_0x2ebbec,getCustomFields(_0x290219[_0xa0a1('0x7f')],_0x38fdb8));return request({'method':_0xa0a1('0x46'),'uri':_0xa0a1('0x52')+_0xf6a1cd+_0xa0a1('0x80'),'headers':{'Authorization':_0xa0a1('0x38')+_0xa6138a},'body':{'data':[_0x2ebbec]},'json':!![]})[_0xa0a1('0x2c')](function(_0x31e9ed){if(_0x31e9ed&&_0x31e9ed[_0xa0a1('0x44')][0x0][_0xa0a1('0x4b')]==='SUCCESS'){logger[_0xa0a1('0x3d')](_0xa0a1('0x81'));return{'id':_0x31e9ed[_0xa0a1('0x44')][0x0][_0xa0a1('0x82')]['id']};}})['catch'](function(_0x1bef9f){logger[_0xa0a1('0x3d')]('err',_0x1bef9f[_0xa0a1('0x33')]);console['log'](_0xa0a1('0x83'),_0x1bef9f);});}exports[_0xa0a1('0x84')]=function(_0xeeaa3d,_0x486f15,_0x206714,_0x29cee9,_0xd2118,_0x1e7b11){var _0x112da8,_0x5a2876,_0x4e34b5;_0x1e7b11['host']=intUtil['stripTrailingSlash'](_0x1e7b11[_0xa0a1('0x85')]);_0x1e7b11['serverUrl']=intUtil['stripTrailingSlash'](_0x1e7b11[_0xa0a1('0x86')]);if(_0xd2118&&_0xd2118[_0xa0a1('0x87')]){logger[_0xa0a1('0x3d')](_0xa0a1('0x88'),_0xa0a1('0x89'));_0x486f15[_0xa0a1('0x8a')]=_0x1e7b11[_0xa0a1('0x86')]+'/api/voice/recordings/'+_0x486f15[_0xa0a1('0x8b')]+_0xa0a1('0x8c')+md5(_0x486f15[_0xa0a1('0x8b')]);}else{_0x486f15['recordingURL']='';}var _0x3f71d4=_0x1e7b11[_0xa0a1('0x85')]===_0xa0a1('0x8d')?'eu':_0xa0a1('0x8e');return getAccessToken(_0x1e7b11)[_0xa0a1('0x2c')](function(_0x208c0f){_0x4e34b5=_0x208c0f;return getUser(_0x4e34b5,_0x3f71d4,_0x1e7b11,_0x29cee9[_0xa0a1('0x3c')]);})[_0xa0a1('0x2c')](function(_0x31fbd7){_0x112da8=_0x31fbd7;logger['info'](_0xa0a1('0x8f'),_0x112da8['id']);return getEndUser(_0x4e34b5,_0x3f71d4,_0x1e7b11,_0x486f15[_0xa0a1('0x90')],_0x486f15[_0xa0a1('0x91')],_0x112da8,_0x206714);})[_0xa0a1('0x2c')](function(_0x477b72){_0x5a2876=_0x477b72;return getCall(_0x4e34b5,_0x3f71d4,_0x1e7b11,_0x112da8,_0x5a2876,_0x206714,_0x486f15,_0xa0a1('0x92'));})['then'](function(_0x47b478){if(_0x47b478){logger['info'](_0xa0a1('0x93'),_0x47b478['id']);logger[_0xa0a1('0x3d')](_0xa0a1('0x88'),_0xa0a1('0x94'));emit(util[_0xa0a1('0x70')](_0xa0a1('0x95'),_0x29cee9[_0xa0a1('0x1c')]),_0xa0a1('0x96'),{'uri':_0xa0a1('0x97')+_0x1e7b11[_0xa0a1('0x85')]+'/crm/EntityInfo.do?module=Calls&id='+_0x47b478['id']});}})[_0xa0a1('0x30')](function(_0x317e19){logger[_0xa0a1('0x31')](_0xa0a1('0x88'),JSON[_0xa0a1('0x10')](_0x317e19));});};exports['outbound']=function(_0x1fba90,_0x285d5a,_0xcf28d3,_0x11bb66,_0x220213,_0x5f18cf,_0x30a9f1){var _0x297e48,_0x5894ca,_0x157da4;_0x5f18cf[_0xa0a1('0x85')]=intUtil[_0xa0a1('0x98')](_0x5f18cf['host']);_0x5f18cf[_0xa0a1('0x86')]=intUtil[_0xa0a1('0x98')](_0x5f18cf[_0xa0a1('0x86')]);if(_0x30a9f1&&_0x30a9f1['recordingFormat']&&_0x30a9f1[_0xa0a1('0x99')]!==_0xa0a1('0x9a')){logger[_0xa0a1('0x3d')]('[OUTBOUND]',_0xa0a1('0x89'));_0x285d5a[_0xa0a1('0x8a')]=_0x5f18cf[_0xa0a1('0x86')]+_0xa0a1('0x9b')+_0x285d5a[_0xa0a1('0x8b')]+'/downloads?type=uniqueid&token='+md5(_0x285d5a[_0xa0a1('0x8b')]);}var _0x52dbae=_0x5f18cf[_0xa0a1('0x85')]==='zoho.eu'?'eu':_0xa0a1('0x8e');return getAccessToken(_0x5f18cf)[_0xa0a1('0x2c')](function(_0x18367b){_0x157da4=_0x18367b;return getUser(_0x157da4,_0x52dbae,_0x5f18cf,_0x11bb66[_0xa0a1('0x3c')]);})['then'](function(_0x2b2ebb){_0x297e48=_0x2b2ebb;logger['info'](_0xa0a1('0x8f'),_0x297e48['id']);return getEndUser(_0x157da4,_0x52dbae,_0x5f18cf,_0x285d5a['destcalleridname'],_0x285d5a[_0xa0a1('0x9c')],_0x297e48,_0xcf28d3);})[_0xa0a1('0x2c')](function(_0x22893a){_0x5894ca=_0x22893a;return getCall(_0x157da4,_0x52dbae,_0x5f18cf,_0x297e48,_0x5894ca,_0xcf28d3,_0x285d5a,_0xa0a1('0x9d'));})[_0xa0a1('0x2c')](function(_0x2e00d2){if(_0x2e00d2){logger['info'](_0xa0a1('0x93'),_0x2e00d2['id']);logger[_0xa0a1('0x3d')](_0xa0a1('0x9e'),_0xa0a1('0x94'));emit(util[_0xa0a1('0x70')]('user:%s',_0x11bb66[_0xa0a1('0x1c')]),'trigger:browser:url',{'uri':'https://crm.'+_0x5f18cf[_0xa0a1('0x85')]+_0xa0a1('0x9f')+_0x2e00d2['id']});}})['catch'](function(_0x98d97e){logger[_0xa0a1('0x31')](_0xa0a1('0x9e'),JSON[_0xa0a1('0x10')](_0x98d97e));});};exports[_0xa0a1('0xa0')]=function(_0x580b02,_0x4bca5f,_0x2bee9c,_0x138969,_0x48ee96,_0x5085e4){var _0x3e4d8e,_0x3cdb3a,_0x59b76d;_0x5085e4[_0xa0a1('0x85')]=intUtil[_0xa0a1('0x98')](_0x5085e4[_0xa0a1('0x85')]);_0x5085e4[_0xa0a1('0x86')]=intUtil[_0xa0a1('0x98')](_0x5085e4[_0xa0a1('0x86')]);if(_0x48ee96&&_0x48ee96[_0xa0a1('0x87')]){logger[_0xa0a1('0x3d')]('['+_0x4bca5f[_0xa0a1('0xa1')]['toUpperCase']()+']',_0xa0a1('0x89'));_0x4bca5f['recordingURL']=_0x5085e4[_0xa0a1('0x86')]+_0xa0a1('0x9b')+_0x4bca5f[_0xa0a1('0x8b')]+_0xa0a1('0x8c')+md5(_0x4bca5f[_0xa0a1('0x8b')]);}else{_0x4bca5f[_0xa0a1('0x8a')]='';}var _0x5e882d=_0x5085e4[_0xa0a1('0x85')]===_0xa0a1('0x8d')?'eu':_0xa0a1('0x8e');return getAccessToken(_0x5085e4)[_0xa0a1('0x2c')](function(_0x4f2502){_0x59b76d=_0x4f2502;return getUser(_0x59b76d,_0x5e882d,_0x5085e4);})[_0xa0a1('0x2c')](function(_0x5cf2a5){_0x3e4d8e=_0x5cf2a5;logger[_0xa0a1('0x3d')](_0xa0a1('0x8f'),_0x3e4d8e['id']);return getEndUser(_0x59b76d,_0x5e882d,_0x5085e4,_0x4bca5f[_0xa0a1('0x90')],_0x4bca5f['calleridnum'],_0x3e4d8e,_0x2bee9c);})[_0xa0a1('0x2c')](function(_0x11ec5c){_0x3cdb3a=_0x11ec5c;return getCall(_0x59b76d,_0x5e882d,_0x5085e4,_0x3e4d8e,_0x3cdb3a,_0x2bee9c,_0x4bca5f,_0xa0a1('0x92'));})['then'](function(_0x4ee721){if(_0x4ee721){logger['info'](_0xa0a1('0x93'),_0x4ee721['id']);}})[_0xa0a1('0x30')](function(_0x4a29e7){logger[_0xa0a1('0x31')]('['+_0x4bca5f[_0xa0a1('0xa1')][_0xa0a1('0xa2')]()+']',JSON[_0xa0a1('0x10')](_0x4a29e7));});}; \ No newline at end of file +var _0x4de2=['[OUTBOUND]','Recording\x20is\x20enabled!','uniqueid','destcalleridname','destcalleridnum','Outbound','unmanaged','request-promise','md5','util','moment','bluebird','../../../../config/environment','../../../../config/logger','zoho','defaults','redis','localhost','socket.io-emitter','debug','[HTTP]','stringify','length','includes','picklist','type','idField','content','variable','variableName','Variable','name','toLowerCase','toString','indexOf','split','isNil','access_token','isBefore','expires_in','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','refreshToken','clientId','clientSecret','then','add','seconds','error','stack','info','Search\x20user','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','users','isArrayLikeObject','email','Using\x20the\x20admin\x20account!','profile','Administrator','user','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','The\x20failing\x20result\x20is','catch','data','enduserType','https://www.zohoapis.','/crm/v2/','moduleCreate','role','first_name','last_name','code','SUCCESS','details','startCase','Error:\x20','log','CREATE\x20ERROR','moduleSearch','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','contact','lead','Creating\x20new\x20call...','administrator','Subject','getString','Subjects','Description','Descriptions','Full_Name','First_Name','Last_Name','$se_module','utc','talktime','mm:ss','answertime','endtime','YYYY-MM-DDTHH:mm:ss','diff','starttime','lastevent','called','Call_Result','Called','complete','rejected','abandoned','Abandoned','timeout','Timeout','Call_Start_Time','outbound','agentcalledAt','Call_Type','Inbound','merge','Fields','/crm/v2/Calls','err','host','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','recordingURL','/api/voice/recordings/','/downloads?type=uniqueid&token=','zoho.eu','com','The\x20User\x20ID\x20is:','calleridname','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none'];(function(_0x3b8f2e,_0x5a99a8){var _0x1433d5=function(_0x5e0353){while(--_0x5e0353){_0x3b8f2e['push'](_0x3b8f2e['shift']());}};_0x1433d5(++_0x5a99a8);}(_0x4de2,0x9f));var _0x24de=function(_0x1dae94,_0x239003){_0x1dae94=_0x1dae94-0x0;var _0x36ce2d=_0x4de2[_0x1dae94];return _0x36ce2d;};'use strict';var _=require('lodash');var rp=require(_0x24de('0x0'));var md5=require(_0x24de('0x1'));var util=require(_0x24de('0x2'));var intUtil=require('./util');var moment=require(_0x24de('0x3'));var Redis=require('ioredis');var BPromise=require(_0x24de('0x4'));var config=require(_0x24de('0x5'));var logger=require(_0x24de('0x6'))(_0x24de('0x7'));config['redis']=_[_0x24de('0x8')](config[_0x24de('0x9')],{'host':_0x24de('0xa'),'port':0x18eb});var io=require(_0x24de('0xb'))(new Redis(config[_0x24de('0x9')]));function emit(_0x1fc2f5,_0x3d63cf,_0x4230df){io['to'](_0x1fc2f5)['emit'](_0x3d63cf,_0x4230df);}function request(_0x7123ac){logger[_0x24de('0xc')](_0x24de('0xd'),JSON[_0x24de('0xe')](_0x7123ac));return rp(_0x7123ac);}function getCustomFields(_0x94bbaf,_0xa188a4){var _0xb5d5e3={};if(_0x94bbaf[_0x24de('0xf')]>0x0){_['forEach'](_0x94bbaf,function(_0x2feb8f){if(_[_0x24de('0x10')](['string',_0x24de('0x11')],_0x2feb8f[_0x24de('0x12')])&&_0x2feb8f[_0x24de('0x13')]){_0xb5d5e3[_0x2feb8f[_0x24de('0x13')]]=_0x2feb8f[_0x24de('0x14')]['toString']();}else if(_0x2feb8f['type']===_0x24de('0x15')&&_0x2feb8f[_0x24de('0x16')]&&_0x2feb8f['idField']&&_0xa188a4[_0x2feb8f[_0x24de('0x16')]]){_0xb5d5e3[_0x2feb8f['idField']]=_0xa188a4[_0x2feb8f[_0x24de('0x16')]]['toString']();}else if(_0x2feb8f[_0x24de('0x12')]==='customVariable'&&_0x2feb8f[_0x24de('0x17')]&&_0x2feb8f[_0x24de('0x17')][_0x24de('0x18')]&&_0x2feb8f['idField']&&_0xa188a4[_0x2feb8f[_0x24de('0x17')][_0x24de('0x18')][_0x24de('0x19')]()]){_0xb5d5e3[_0x2feb8f[_0x24de('0x13')]]=_0xa188a4[_0x2feb8f[_0x24de('0x17')][_0x24de('0x18')][_0x24de('0x19')]()][_0x24de('0x1a')]();}});}return _0xb5d5e3;}function getName(_0x51014d){if(_0x51014d[_0x24de('0x1b')]('\x20')>0x0){var _0xd662be=_0x51014d[_0x24de('0x1c')](/ (.+)/);if(_0xd662be[0x1]){return _0xd662be;}}return[_0x51014d,_0x51014d];}var accountsTokens={};function getAccessToken(_0x3f4335){return new Promise(function(_0x2b8381,_0x54214e){if(!_[_0x24de('0x1d')](accountsTokens[_0x3f4335['id']])&&!_[_0x24de('0x1d')](accountsTokens[_0x3f4335['id']][_0x24de('0x1e')])){if(moment()[_0x24de('0x1f')](accountsTokens[_0x3f4335['id']][_0x24de('0x20')])){_0x2b8381(accountsTokens[_0x3f4335['id']][_0x24de('0x1e')]);}}var _0x426db6;switch(_0x3f4335[_0x24de('0x21')]){case'US':_0x426db6=_0x24de('0x22');break;case'AU':_0x426db6=_0x24de('0x23');break;case'EU':_0x426db6=_0x24de('0x24');break;case'IN':_0x426db6=_0x24de('0x25');break;case'CN':_0x426db6='https://accounts.zoho.com.cn';break;default:_0x426db6='https://accounts.zoho.eu';break;}var _0x456232={'method':'POST','uri':_0x426db6+'/oauth/v2/token','qs':{'refresh_token':_0x3f4335[_0x24de('0x26')],'client_id':_0x3f4335[_0x24de('0x27')],'client_secret':_0x3f4335[_0x24de('0x28')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x456232)[_0x24de('0x29')](function(_0x5f5860){accountsTokens[_0x3f4335['id']]={'access_token':_0x5f5860[_0x24de('0x1e')],'expires_in':moment()[_0x24de('0x2a')](_0x5f5860['expires_in'],_0x24de('0x2b'))};_0x2b8381(_0x5f5860['access_token']);})['catch'](function(_0x2868b9){logger[_0x24de('0x2c')]('Failing\x20creating\x20the\x20access_token',_0x2868b9[_0x24de('0x2d')]);_0x54214e(_0x2868b9);});});}function getUser(_0xe098fc,_0x4da3c6,_0x5a3f75,_0x1eeaad){logger[_0x24de('0x2e')](_0x24de('0x2f'));return request({'method':_0x24de('0x30'),'uri':util[_0x24de('0x31')](_0x24de('0x32'),_0x4da3c6),'qs':{'type':_0x24de('0x33')},'headers':{'Authorization':_0x24de('0x34')+_0xe098fc},'json':!![]})[_0x24de('0x29')](function(_0x5383dc){if(_0x5383dc[_0x24de('0x35')]){var _0xaf7f31=-0x1;if(_[_0x24de('0x36')](_0x5383dc[_0x24de('0x35')])){if(!_['isNil'](_0x1eeaad)){_0xaf7f31=_['findIndex'](_0x5383dc['users'],function(_0x544961){return _0x544961[_0x24de('0x37')]===_0x1eeaad;});}if(_0xaf7f31>=0x0){logger[_0x24de('0x2e')]('Agent\x20found!');}else{logger[_0x24de('0x2e')](_0x24de('0x38'));_0xaf7f31=_['findIndex'](_0x5383dc[_0x24de('0x35')],function(_0x46d2ee){return _0x46d2ee[_0x24de('0x39')][_0x24de('0x18')]===_0x24de('0x3a');});}return _0x5383dc[_0x24de('0x35')][_0xaf7f31];}else{if(_0x5383dc[_0x24de('0x3b')][_0x24de('0x39')][_0x24de('0x18')]===_0x24de('0x3a')){logger[_0x24de('0x2e')](_0x24de('0x38'));user=_0x5383dc['user'];return user;}else{logger[_0x24de('0x2c')]('The\x20failing\x20result\x20is',JSON['stringify'](_0x5383dc));throw new Error(_0x24de('0x3c')+JSON[_0x24de('0xe')](_0x5383dc));}}}else{logger[_0x24de('0x2c')](_0x24de('0x3d'),JSON[_0x24de('0xe')](_0x5383dc));throw new Error(_0x24de('0x3c')+JSON[_0x24de('0xe')](_0x5383dc));}})[_0x24de('0x3e')](function(_0x57dcd5){console[_0x24de('0x2c')](_0x57dcd5);});}function getZohoUser(_0x529888,_0x3d2c27){return new BPromise(function(_0x4f8347,_0x22acff){request(_0x529888)[_0x24de('0x29')](function(_0xd701a0){var _0xb1f1=null;if(_0xd701a0){_0xb1f1=_0xd701a0[_0x24de('0x3f')][0x0];_0xb1f1[_0x24de('0x40')]=_0x3d2c27;}_0x4f8347(_0xb1f1);})[_0x24de('0x3e')](function(_0x3bde15){_0x22acff(_0x3bde15);});});}function createEndUser(_0x16bae8,_0x2b43e4,_0x17d354,_0x18ecfb,_0x3110cd,_0x2a2ced){var _0x17d354=getName(_0x17d354);return request({'method':'POST','uri':_0x24de('0x41')+_0x2b43e4+_0x24de('0x42')+_['startCase'](_0x2a2ced[_0x24de('0x43')])+'s','body':{'data':[{'Last_Name':_0x17d354[0x1],'First_Name':_0x17d354[0x0],'Phone':_0x18ecfb,'Owner':{'name':!_['isNil'](_0x3110cd[_0x24de('0x44')][_0x24de('0x18')])?_0x3110cd['role'][_0x24de('0x18')]:!_['isNil'](_0x3110cd[_0x24de('0x45')])?_0x3110cd['first_name']+'\x20'+_0x3110cd['last_name']:_0x3110cd[_0x24de('0x46')],'id':_0x3110cd['id']}}]},'headers':{'Authorization':_0x24de('0x34')+_0x16bae8},'json':!![]})['then'](function(_0x32ca08){if(_0x32ca08&&_0x32ca08['data'][0x0][_0x24de('0x47')]===_0x24de('0x48')){var _0x5f157b=_0x32ca08[_0x24de('0x3f')][0x0][_0x24de('0x49')];_0x5f157b[_0x24de('0x40')]=_[_0x24de('0x4a')](_0x2a2ced[_0x24de('0x43')])+'s';return _0x5f157b;}logger[_0x24de('0x2c')]('The\x20failing\x20result\x20is',JSON[_0x24de('0xe')](data));throw new Error(_0x24de('0x4b')+JSON['stringify'](data));})[_0x24de('0x3e')](function(_0x51a6d4){console[_0x24de('0x4c')](_0x24de('0x4d'),_0x51a6d4);});}function getEndUser(_0xf28a1c,_0x4634d4,_0x4d7c38,_0x1c8a8a,_0x9bc657,_0x42279b,_0x14660a){var _0x5a545e={'method':'GET','uri':'','headers':{'Authorization':_0x24de('0x34')+_0xf28a1c},'json':!![]};switch(_0x14660a[_0x24de('0x4e')]){case'contact_lead':_0x5a545e[_0x24de('0x4f')]=_0x24de('0x41')+_0x4634d4+_0x24de('0x50')+_0x9bc657+'))';return getZohoUser(_0x5a545e,_0x24de('0x51'))[_0x24de('0x29')](function(_0x5ca489){if(_0x5ca489)return _0x5ca489;_0x5a545e[_0x24de('0x4f')]=_0x24de('0x41')+_0x4634d4+_0x24de('0x52')+_0x9bc657+'))';return getZohoUser(_0x5a545e,_0x24de('0x53'))['then'](function(_0x2033b7){if(_0x2033b7)return _0x2033b7;if(_0x14660a[_0x24de('0x43')]!=_0x24de('0x54')){return createEndUser(_0xf28a1c,_0x4634d4,_0x1c8a8a,_0x9bc657,_0x42279b,_0x14660a);}else{return{};}});});break;case _0x24de('0x55'):_0x5a545e[_0x24de('0x4f')]='https://www.zohoapis.'+_0x4634d4+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x9bc657+'))';return getZohoUser(_0x5a545e,_0x24de('0x51'))[_0x24de('0x29')](function(_0x35a24a){if(_0x35a24a)return _0x35a24a;if(_0x14660a[_0x24de('0x43')]!=_0x24de('0x54')){return createEndUser(_0xf28a1c,_0x4634d4,_0x1c8a8a,_0x9bc657,_0x42279b,_0x14660a);}else{return{};}});break;case _0x24de('0x56'):_0x5a545e[_0x24de('0x4f')]=_0x24de('0x41')+_0x4634d4+_0x24de('0x52')+_0x9bc657+'))';return getZohoUser(_0x5a545e,_0x24de('0x53'))['then'](function(_0x5d308e){if(_0x5d308e)return _0x5d308e;if(_0x14660a[_0x24de('0x43')]!='nothing'){return createEndUser(_0xf28a1c,_0x4634d4,_0x1c8a8a,_0x9bc657,_0x42279b,_0x14660a);}else{return{};}});break;}}function getCall(_0x486078,_0x5815c1,_0x2dab25,_0x1eb708,_0x25314f,_0x5d4160,_0x1c8127,_0x52bf34){logger[_0x24de('0x2e')](_0x24de('0x57'));var _0x145ff5={};_0x145ff5['Owner']={'name':!_[_0x24de('0x1d')](_0x1eb708[_0x24de('0x44')][_0x24de('0x18')])&&!_[_0x24de('0x1d')](_0x1eb708['profile']['name'])&&_0x1eb708[_0x24de('0x39')][_0x24de('0x18')]===_0x24de('0x58')?_0x1eb708[_0x24de('0x44')]['name']:!_[_0x24de('0x1d')](_0x1eb708[_0x24de('0x45')])?_0x1eb708[_0x24de('0x45')]+'\x20'+_0x1eb708['last_name']:_0x1eb708[_0x24de('0x46')],'id':_0x1eb708['id']};_0x145ff5[_0x24de('0x59')]=intUtil[_0x24de('0x5a')](_0x5d4160[_0x24de('0x5b')],_0x1c8127,'\x20');_0x145ff5[_0x24de('0x5c')]=intUtil[_0x24de('0x5a')](_0x5d4160[_0x24de('0x5d')],_0x1c8127,'\x0a');if(_0x25314f[_0x24de('0x40')]===_0x24de('0x51')){_0x145ff5['Who_Id']={'name':!_['isNil'](_0x25314f[_0x24de('0x5e')])?_0x25314f['Full_Name']:!_[_0x24de('0x1d')](_0x25314f[_0x24de('0x5f')])?_0x25314f[_0x24de('0x5f')]+'\x20'+_0x25314f[_0x24de('0x60')]:_0x25314f[_0x24de('0x60')],'id':_0x25314f['id']};}if(_0x25314f[_0x24de('0x40')]===_0x24de('0x53')){_0x145ff5['What_Id']={'name':!_[_0x24de('0x1d')](_0x25314f[_0x24de('0x5e')])?_0x25314f[_0x24de('0x5e')]:!_[_0x24de('0x1d')](_0x25314f[_0x24de('0x5f')])?_0x25314f['First_Name']+'\x20'+_0x25314f[_0x24de('0x60')]:_0x25314f[_0x24de('0x60')],'id':_0x25314f['id']};_0x145ff5[_0x24de('0x61')]=_[_0x24de('0x4a')](_0x25314f[_0x24de('0x40')]);}if(_0x1c8127['talktime']){_0x145ff5['Call_Duration']=moment[_0x24de('0x62')](parseInt(_0x1c8127[_0x24de('0x63')])*0x3e8)[_0x24de('0x31')](_0x24de('0x64'));}else if(_0x1c8127[_0x24de('0x65')]&&_0x1c8127[_0x24de('0x66')]){_0x145ff5['Call_Duration']=moment[_0x24de('0x62')](moment(_0x1c8127[_0x24de('0x66')],_0x24de('0x67'))[_0x24de('0x68')](moment(_0x1c8127[_0x24de('0x69')],_0x24de('0x67'))))[_0x24de('0x31')]('mm:ss');}switch(_0x1c8127[_0x24de('0x6a')]){case _0x24de('0x6b'):_0x145ff5[_0x24de('0x6c')]=_0x24de('0x6d');break;case _0x24de('0x6e'):case'connect':_0x145ff5[_0x24de('0x6c')]='Answered';break;case _0x24de('0x6f'):_0x145ff5[_0x24de('0x6c')]='Rejected';break;case _0x24de('0x70'):_0x145ff5['Call_Result']=_0x24de('0x71');break;case _0x24de('0x72'):_0x145ff5['Call_Result']=_0x24de('0x73');default:}_0x145ff5[_0x24de('0x74')]=(_0x52bf34===_0x24de('0x75')?moment(_0x1c8127['starttime'])[_0x24de('0x31')](_0x24de('0x67')):moment(_0x1c8127[_0x24de('0x76')])['format'](_0x24de('0x67')))||moment()[_0x24de('0x31')]('YYYY-MM-DDTHH:mm:ss');_0x145ff5[_0x24de('0x77')]=_0x52bf34||_0x24de('0x78');_0x145ff5=_[_0x24de('0x79')](_0x145ff5,getCustomFields(_0x5d4160[_0x24de('0x7a')],_0x1c8127));return request({'method':'POST','uri':_0x24de('0x41')+_0x5815c1+_0x24de('0x7b'),'headers':{'Authorization':_0x24de('0x34')+_0x486078},'body':{'data':[_0x145ff5]},'json':!![]})[_0x24de('0x29')](function(_0xb76c0f){if(_0xb76c0f&&_0xb76c0f[_0x24de('0x3f')][0x0][_0x24de('0x47')]===_0x24de('0x48')){logger[_0x24de('0x2e')]('Call\x20created!');return{'id':_0xb76c0f[_0x24de('0x3f')][0x0]['details']['id']};}})[_0x24de('0x3e')](function(_0x4b1f5a){logger[_0x24de('0x2e')](_0x24de('0x7c'),_0x4b1f5a[_0x24de('0x2d')]);console['log'](_0x24de('0x7c'),_0x4b1f5a);});}exports['queue']=function(_0x43d4ac,_0x191607,_0x20b523,_0x16a856,_0x213215,_0x267ada){var _0x1d08d8,_0x5454ce,_0x482807;_0x267ada[_0x24de('0x7d')]=intUtil[_0x24de('0x7e')](_0x267ada[_0x24de('0x7d')]);_0x267ada[_0x24de('0x7f')]=intUtil[_0x24de('0x7e')](_0x267ada['serverUrl']);if(_0x213215&&_0x213215[_0x24de('0x80')]){logger[_0x24de('0x2e')](_0x24de('0x81'),'Recording\x20is\x20enabled!');_0x191607[_0x24de('0x82')]=_0x267ada[_0x24de('0x7f')]+_0x24de('0x83')+_0x191607['uniqueid']+_0x24de('0x84')+md5(_0x191607['uniqueid']);}else{_0x191607[_0x24de('0x82')]='';}var _0x469940=_0x267ada[_0x24de('0x7d')]===_0x24de('0x85')?'eu':_0x24de('0x86');return getAccessToken(_0x267ada)[_0x24de('0x29')](function(_0x3f6a43){_0x482807=_0x3f6a43;return getUser(_0x482807,_0x469940,_0x267ada,_0x16a856[_0x24de('0x37')]);})['then'](function(_0x19d988){_0x1d08d8=_0x19d988;logger[_0x24de('0x2e')](_0x24de('0x87'),_0x1d08d8['id']);return getEndUser(_0x482807,_0x469940,_0x267ada,_0x191607[_0x24de('0x88')],_0x191607['calleridnum'],_0x1d08d8,_0x20b523);})[_0x24de('0x29')](function(_0x593404){_0x5454ce=_0x593404;return getCall(_0x482807,_0x469940,_0x267ada,_0x1d08d8,_0x5454ce,_0x20b523,_0x191607,'Inbound');})[_0x24de('0x29')](function(_0x1bc007){if(_0x1bc007){logger[_0x24de('0x2e')](_0x24de('0x89'),_0x1bc007['id']);logger[_0x24de('0x2e')](_0x24de('0x81'),_0x24de('0x8a'));emit(util[_0x24de('0x31')](_0x24de('0x8b'),_0x16a856[_0x24de('0x18')]),_0x24de('0x8c'),{'uri':_0x24de('0x8d')+_0x267ada[_0x24de('0x7d')]+_0x24de('0x8e')+_0x1bc007['id']});}})[_0x24de('0x3e')](function(_0x173378){logger[_0x24de('0x2c')](_0x24de('0x81'),JSON[_0x24de('0xe')](_0x173378));});};exports[_0x24de('0x75')]=function(_0x52af3d,_0x5c10b1,_0x13ef74,_0x62164b,_0x2fe8a9,_0x3ddc3a,_0x24a07b){var _0x4d4eed,_0x51731f,_0x2761f4;_0x3ddc3a[_0x24de('0x7d')]=intUtil[_0x24de('0x7e')](_0x3ddc3a[_0x24de('0x7d')]);_0x3ddc3a[_0x24de('0x7f')]=intUtil[_0x24de('0x7e')](_0x3ddc3a[_0x24de('0x7f')]);if(_0x24a07b&&_0x24a07b[_0x24de('0x8f')]&&_0x24a07b[_0x24de('0x8f')]!==_0x24de('0x90')){logger[_0x24de('0x2e')](_0x24de('0x91'),_0x24de('0x92'));_0x5c10b1[_0x24de('0x82')]=_0x3ddc3a[_0x24de('0x7f')]+_0x24de('0x83')+_0x5c10b1[_0x24de('0x93')]+_0x24de('0x84')+md5(_0x5c10b1['uniqueid']);}var _0xae30a2=_0x3ddc3a['host']===_0x24de('0x85')?'eu':_0x24de('0x86');return getAccessToken(_0x3ddc3a)[_0x24de('0x29')](function(_0x248207){_0x2761f4=_0x248207;return getUser(_0x2761f4,_0xae30a2,_0x3ddc3a,_0x62164b[_0x24de('0x37')]);})[_0x24de('0x29')](function(_0x5bd908){_0x4d4eed=_0x5bd908;logger[_0x24de('0x2e')](_0x24de('0x87'),_0x4d4eed['id']);return getEndUser(_0x2761f4,_0xae30a2,_0x3ddc3a,_0x5c10b1[_0x24de('0x94')],_0x5c10b1[_0x24de('0x95')],_0x4d4eed,_0x13ef74);})['then'](function(_0xa21dad){_0x51731f=_0xa21dad;return getCall(_0x2761f4,_0xae30a2,_0x3ddc3a,_0x4d4eed,_0x51731f,_0x13ef74,_0x5c10b1,_0x24de('0x96'));})['then'](function(_0x323a35){if(_0x323a35){logger[_0x24de('0x2e')](_0x24de('0x89'),_0x323a35['id']);logger[_0x24de('0x2e')]('[OUTBOUND]',_0x24de('0x8a'));emit(util['format'](_0x24de('0x8b'),_0x62164b['name']),_0x24de('0x8c'),{'uri':_0x24de('0x8d')+_0x3ddc3a['host']+_0x24de('0x8e')+_0x323a35['id']});}})[_0x24de('0x3e')](function(_0x50da8b){logger['error'](_0x24de('0x91'),JSON[_0x24de('0xe')](_0x50da8b));});};exports[_0x24de('0x97')]=function(_0x1d53be,_0x172554,_0x26b566,_0x256edf,_0x5f093b,_0x2f347a){var _0x391623,_0x1e545c,_0x321537;_0x2f347a[_0x24de('0x7d')]=intUtil[_0x24de('0x7e')](_0x2f347a[_0x24de('0x7d')]);_0x2f347a[_0x24de('0x7f')]=intUtil[_0x24de('0x7e')](_0x2f347a['serverUrl']);if(_0x5f093b&&_0x5f093b[_0x24de('0x80')]){logger[_0x24de('0x2e')]('['+_0x172554[_0x24de('0x6a')]['toUpperCase']()+']',_0x24de('0x92'));_0x172554[_0x24de('0x82')]=_0x2f347a[_0x24de('0x7f')]+_0x24de('0x83')+_0x172554[_0x24de('0x93')]+'/downloads?type=uniqueid&token='+md5(_0x172554[_0x24de('0x93')]);}else{_0x172554['recordingURL']='';}var _0x2ed18a=_0x2f347a[_0x24de('0x7d')]===_0x24de('0x85')?'eu':_0x24de('0x86');return getAccessToken(_0x2f347a)[_0x24de('0x29')](function(_0x2d5327){_0x321537=_0x2d5327;return getUser(_0x321537,_0x2ed18a,_0x2f347a);})['then'](function(_0x18b824){_0x391623=_0x18b824;logger[_0x24de('0x2e')](_0x24de('0x87'),_0x391623['id']);return getEndUser(_0x321537,_0x2ed18a,_0x2f347a,_0x172554[_0x24de('0x88')],_0x172554['calleridnum'],_0x391623,_0x26b566);})['then'](function(_0x557e1e){_0x1e545c=_0x557e1e;return getCall(_0x321537,_0x2ed18a,_0x2f347a,_0x391623,_0x1e545c,_0x26b566,_0x172554,_0x24de('0x78'));})[_0x24de('0x29')](function(_0x44a93f){if(_0x44a93f){logger[_0x24de('0x2e')](_0x24de('0x89'),_0x44a93f['id']);}})[_0x24de('0x3e')](function(_0x3ac140){logger['error']('['+_0x172554[_0x24de('0x6a')]['toUpperCase']()+']',JSON[_0x24de('0xe')](_0x3ac140));});}; \ 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 7733449..5cb34b5 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 _0x33d9=['util','mustache','../../../../config/logger','trigger','exec','data2','render','data3','error','format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s'];(function(_0x45d815,_0xf0e685){var _0x3a91f8=function(_0x53a33e){while(--_0x53a33e){_0x45d815['push'](_0x45d815['shift']());}};_0x3a91f8(++_0xf0e685);}(_0x33d9,0x104));var _0x933d=function(_0x14e0ad,_0x53fcfc){_0x14e0ad=_0x14e0ad-0x0;var _0x4123a4=_0x33d9[_0x14e0ad];return _0x4123a4;};'use strict';var util=require(_0x933d('0x0'));var sh=require('shelljs');var Mustache=require(_0x933d('0x1'));var logger=require(_0x933d('0x2'))(_0x933d('0x3'));exports[_0x933d('0x4')]=function(_0x341e17,_0x498505){var _0xdc4769=_0x341e17['data2']?_0x341e17[_0x933d('0x5')]:'Script';var _0x53cdf2=_0x341e17['data3']?Mustache[_0x933d('0x6')](_0x341e17[_0x933d('0x7')],_0x498505):_0x498505;sh['exec'](_0x53cdf2,function(_0x144823,_0x33e62a,_0x54ca71){if(_0x144823!==0x0){logger[_0x933d('0x8')](util[_0x933d('0x9')](_0x933d('0xa'),_0xdc4769,_0x53cdf2,_0x144823,_0x54ca71));}else{logger[_0x933d('0xb')](util[_0x933d('0x9')](_0x933d('0xc'),_0xdc4769,_0x53cdf2,_0x33e62a));}});}; \ No newline at end of file +var _0x9c0e=['data3','render','error','format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','shelljs','mustache','../../../../config/logger','exec','data2','Script'];(function(_0x1f3a08,_0x327bd6){var _0x5f2c65=function(_0x118cc7){while(--_0x118cc7){_0x1f3a08['push'](_0x1f3a08['shift']());}};_0x5f2c65(++_0x327bd6);}(_0x9c0e,0x1da));var _0xe9c0=function(_0x245831,_0x11387d){_0x245831=_0x245831-0x0;var _0x48e206=_0x9c0e[_0x245831];return _0x48e206;};'use strict';var util=require(_0xe9c0('0x0'));var sh=require(_0xe9c0('0x1'));var Mustache=require(_0xe9c0('0x2'));var logger=require(_0xe9c0('0x3'))('trigger');exports[_0xe9c0('0x4')]=function(_0x293004,_0x5a0ebb){var _0x4a0b51=_0x293004[_0xe9c0('0x5')]?_0x293004['data2']:_0xe9c0('0x6');var _0x5efeed=_0x293004[_0xe9c0('0x7')]?Mustache[_0xe9c0('0x8')](_0x293004[_0xe9c0('0x7')],_0x5a0ebb):_0x5a0ebb;sh[_0xe9c0('0x4')](_0x5efeed,function(_0x270ad8,_0x432018,_0x3e27fd){if(_0x270ad8!==0x0){logger[_0xe9c0('0x9')](util[_0xe9c0('0xa')](_0xe9c0('0xb'),_0x4a0b51,_0x5efeed,_0x270ad8,_0x3e27fd));}else{logger['info'](util[_0xe9c0('0xa')](_0xe9c0('0xc'),_0x4a0b51,_0x5efeed,_0x432018));}});}; \ 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 aa958aa..9b3fa6f 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 _0xd87f=['DELETE','data7','body','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','then',',\x20request\x20body:\x20','object','statusCode','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','message','request-promise','util','lodash','mustache','../../../../config/logger','trigger','exec','data1','render','data2','data5','number','headers','data6','parse','error','stack','toUpperCase','GET'];(function(_0x4cff9c,_0x399879){var _0xc9ba62=function(_0x20b788){while(--_0x20b788){_0x4cff9c['push'](_0x4cff9c['shift']());}};_0xc9ba62(++_0x399879);}(_0xd87f,0xb3));var _0xfd87=function(_0x2d3b99,_0x1ef1e0){_0x2d3b99=_0x2d3b99-0x0;var _0x164d35=_0xd87f[_0x2d3b99];return _0x164d35;};'use strict';var rp=require(_0xfd87('0x0'));var util=require(_0xfd87('0x1'));var _=require(_0xfd87('0x2'));var Mustache=require(_0xfd87('0x3'));var logger=require(_0xfd87('0x4'))(_0xfd87('0x5'));exports[_0xfd87('0x6')]=function(_0x2a971a,_0x3131a2){var _0x50079f,_0x5a55bc;var _0x38cc4c={'method':_0x2a971a[_0xfd87('0x7')]['toUpperCase'](),'uri':Mustache[_0xfd87('0x8')](_0x2a971a[_0xfd87('0x9')],_0x3131a2),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x2a971a[_0xfd87('0xa')])===_0xfd87('0xb')&&parseInt(_0x2a971a[_0xfd87('0xa')])>=0x1&&parseInt(_0x2a971a[_0xfd87('0xa')])<=0xa?parseInt(_0x2a971a[_0xfd87('0xa')])*0x3e8:0x5*0x3e8};try{_0x38cc4c[_0xfd87('0xc')]=_0x2a971a[_0xfd87('0xd')]?JSON[_0xfd87('0xe')](Mustache['render'](_0x2a971a[_0xfd87('0xd')],_0x3131a2)):{};}catch(_0x5d3ff5){logger[_0xfd87('0xf')](_0x5d3ff5[_0xfd87('0x10')]);}switch(_0x2a971a['data1'][_0xfd87('0x11')]()){case _0xfd87('0x12'):case _0xfd87('0x13'):_0x50079f=null;_0x38cc4c['qs']=_0x3131a2;break;case'POST':case'PUT':if(_0x2a971a[_0xfd87('0x14')]){try{_0x50079f=JSON['parse'](Mustache[_0xfd87('0x8')](_0x2a971a[_0xfd87('0x14')],_0x3131a2));_0x38cc4c[_0xfd87('0x15')]=_0x50079f;}catch(_0x1a064a){logger[_0xfd87('0xf')](_0x1a064a[_0xfd87('0x10')]);logger['error'](_0xfd87('0x16'));}}else{_0x50079f=_0x3131a2;_0x38cc4c['body']=_0x50079f;}break;}logger[_0xfd87('0x17')](util[_0xfd87('0x18')](_0xfd87('0x19'),_0x2a971a['data1'],_0x2a971a[_0xfd87('0x9')],JSON[_0xfd87('0x1a')](_0x38cc4c)));rp(_0x38cc4c)[_0xfd87('0x1b')](function(_0x17d4c9){_0x50079f=!_['isNil'](_0x50079f)?_0xfd87('0x1c')+_0x50079f:'';_0x5a55bc=typeof _0x17d4c9['body']===_0xfd87('0x1d')?JSON[_0xfd87('0x1a')](_0x17d4c9['body']):_0x17d4c9['body'];logger[_0xfd87('0x17')](util[_0xfd87('0x18')]('%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s',_0x2a971a[_0xfd87('0x7')],_0x2a971a['data2'],_0x17d4c9[_0xfd87('0x1e')],_0x5a55bc));})['catch'](function(_0x48f36f){logger[_0xfd87('0xf')](util['format'](_0xfd87('0x1f'),_0x2a971a[_0xfd87('0x7')],_0x2a971a[_0xfd87('0x9')],_0x48f36f['statusCode'],_0x48f36f['name'],_0x48f36f[_0xfd87('0x20')]));});}; \ No newline at end of file +var _0x52c6=['DELETE','POST','PUT','data7','body','stack','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','then','isNil',',\x20request\x20body:\x20','object','info','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','statusCode','name','message','request-promise','lodash','mustache','trigger','data1','toUpperCase','render','data2','data5','number','headers','data6','parse','error','GET'];(function(_0x2faddb,_0xc18b78){var _0x273c05=function(_0x1a3785){while(--_0x1a3785){_0x2faddb['push'](_0x2faddb['shift']());}};_0x273c05(++_0xc18b78);}(_0x52c6,0x167));var _0x652c=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0x52c6[_0xa1e3e3];return _0xc980e9;};'use strict';var rp=require(_0x652c('0x0'));var util=require('util');var _=require(_0x652c('0x1'));var Mustache=require(_0x652c('0x2'));var logger=require('../../../../config/logger')(_0x652c('0x3'));exports['exec']=function(_0x2e322f,_0x50bea2){var _0x2464d3,_0x29b98c;var _0x3e3185={'method':_0x2e322f[_0x652c('0x4')][_0x652c('0x5')](),'uri':Mustache[_0x652c('0x6')](_0x2e322f[_0x652c('0x7')],_0x50bea2),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x2e322f[_0x652c('0x8')])===_0x652c('0x9')&&parseInt(_0x2e322f[_0x652c('0x8')])>=0x1&&parseInt(_0x2e322f[_0x652c('0x8')])<=0xa?parseInt(_0x2e322f['data5'])*0x3e8:0x5*0x3e8};try{_0x3e3185[_0x652c('0xa')]=_0x2e322f[_0x652c('0xb')]?JSON[_0x652c('0xc')](Mustache[_0x652c('0x6')](_0x2e322f[_0x652c('0xb')],_0x50bea2)):{};}catch(_0x38bc2f){logger[_0x652c('0xd')](_0x38bc2f['stack']);}switch(_0x2e322f['data1'][_0x652c('0x5')]()){case _0x652c('0xe'):case _0x652c('0xf'):_0x2464d3=null;_0x3e3185['qs']=_0x50bea2;break;case _0x652c('0x10'):case _0x652c('0x11'):if(_0x2e322f[_0x652c('0x12')]){try{_0x2464d3=JSON['parse'](Mustache[_0x652c('0x6')](_0x2e322f[_0x652c('0x12')],_0x50bea2));_0x3e3185[_0x652c('0x13')]=_0x2464d3;}catch(_0x47c764){logger[_0x652c('0xd')](_0x47c764[_0x652c('0x14')]);logger['error']('body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format');}}else{_0x2464d3=_0x50bea2;_0x3e3185[_0x652c('0x13')]=_0x2464d3;}break;}logger['info'](util[_0x652c('0x15')](_0x652c('0x16'),_0x2e322f['data1'],_0x2e322f[_0x652c('0x7')],JSON[_0x652c('0x17')](_0x3e3185)));rp(_0x3e3185)[_0x652c('0x18')](function(_0x4e7608){_0x2464d3=!_[_0x652c('0x19')](_0x2464d3)?_0x652c('0x1a')+_0x2464d3:'';_0x29b98c=typeof _0x4e7608[_0x652c('0x13')]===_0x652c('0x1b')?JSON[_0x652c('0x17')](_0x4e7608[_0x652c('0x13')]):_0x4e7608[_0x652c('0x13')];logger[_0x652c('0x1c')](util[_0x652c('0x15')](_0x652c('0x1d'),_0x2e322f[_0x652c('0x4')],_0x2e322f[_0x652c('0x7')],_0x4e7608['statusCode'],_0x29b98c));})['catch'](function(_0x17f46a){logger[_0x652c('0xd')](util['format'](_0x652c('0x1e'),_0x2e322f[_0x652c('0x4')],_0x2e322f[_0x652c('0x7')],_0x17f46a[_0x652c('0x1f')],_0x17f46a[_0x652c('0x20')],_0x17f46a[_0x652c('0x21')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index 9813acd..bca2887 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 _0x5ced=['bluebird','../../config/logger','client','Request','request','then','rpc','routing','error','message','result','catch','exports','jayson/promise'];(function(_0xba227,_0xadb60e){var _0x31700b=function(_0xb4dbfe){while(--_0xb4dbfe){_0xba227['push'](_0xba227['shift']());}};_0x31700b(++_0xadb60e);}(_0x5ced,0x125));var _0xd5ce=function(_0x408165,_0x5fe9b9){_0x408165=_0x408165-0x0;var _0x3979bf=_0x5ced[_0x408165];return _0x3979bf;};'use strict';var jayson=require(_0xd5ce('0x0'));var BPromise=require(_0xd5ce('0x1'));var logger=require(_0xd5ce('0x2'))('routing');var client=jayson[_0xd5ce('0x3')]['http']({'port':0x2329});client[_0xd5ce('0x4')]=function(_0x4df5fc,_0x64fd9b){return new BPromise(function(_0x488136,_0x4bc275){return client[_0xd5ce('0x5')](_0x4df5fc,_0x64fd9b)[_0xd5ce('0x6')](function(_0x30053b){logger['debug'](_0xd5ce('0x7'),_0xd5ce('0x8'),_0x4df5fc,_0x64fd9b,_0x30053b);if(_0x30053b[_0xd5ce('0x9')]){logger[_0xd5ce('0x9')](_0xd5ce('0x7'),_0xd5ce('0x8'),_0x4df5fc,_0x30053b[_0xd5ce('0x9')][_0xd5ce('0xa')],_0x64fd9b);return _0x4bc275(_0x30053b[_0xd5ce('0x9')][_0xd5ce('0xa')]);}else{return _0x488136(_0x30053b[_0xd5ce('0xb')]);}})[_0xd5ce('0xc')](function(_0x4cf817){logger[_0xd5ce('0x9')]('rpc',_0xd5ce('0x8'),_0x4df5fc,_0x4cf817,_0x64fd9b);return _0x4bc275(_0x4cf817);});});};module[_0xd5ce('0xd')]=client; \ No newline at end of file +var _0x8bde=['bluebird','../../config/logger','http','Request','request','then','debug','routing','rpc','error','message','result','catch','jayson/promise'];(function(_0x105a6b,_0x7fd8d7){var _0x4e50da=function(_0x51763e){while(--_0x51763e){_0x105a6b['push'](_0x105a6b['shift']());}};_0x4e50da(++_0x7fd8d7);}(_0x8bde,0x141));var _0xe8bd=function(_0x494d1f,_0x3f72ff){_0x494d1f=_0x494d1f-0x0;var _0x457b6e=_0x8bde[_0x494d1f];return _0x457b6e;};'use strict';var jayson=require(_0xe8bd('0x0'));var BPromise=require(_0xe8bd('0x1'));var logger=require(_0xe8bd('0x2'))('routing');var client=jayson['client'][_0xe8bd('0x3')]({'port':0x2329});client[_0xe8bd('0x4')]=function(_0x227549,_0x5f50f0){return new BPromise(function(_0x532816,_0x59900c){return client[_0xe8bd('0x5')](_0x227549,_0x5f50f0)[_0xe8bd('0x6')](function(_0xff0044){logger[_0xe8bd('0x7')]('rpc',_0xe8bd('0x8'),_0x227549,_0x5f50f0,_0xff0044);if(_0xff0044['error']){logger['error'](_0xe8bd('0x9'),_0xe8bd('0x8'),_0x227549,_0xff0044['error']['message'],_0x5f50f0);return _0x59900c(_0xff0044[_0xe8bd('0xa')][_0xe8bd('0xb')]);}else{return _0x532816(_0xff0044[_0xe8bd('0xc')]);}})[_0xe8bd('0xd')](function(_0x1b4826){logger[_0xe8bd('0xa')](_0xe8bd('0x9'),_0xe8bd('0x8'),_0x227549,_0x1b4826,_0x5f50f0);return _0x59900c(_0x1b4826);});});};module['exports']=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 0bc728b..90422eb 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 _0x49c3=['./lib/email','./rpc/mailAccount','resolve','then','initMailAccounts','refresh','listen','getSettings','error','Email\x20service\x20initialization','./server'];(function(_0x95a23f,_0xb7dbf1){var _0x2af726=function(_0xa9342a){while(--_0xa9342a){_0x95a23f['push'](_0x95a23f['shift']());}};_0x2af726(++_0xb7dbf1);}(_0x49c3,0x196));var _0x349c=function(_0x4310c2,_0x5a4ef6){_0x4310c2=_0x4310c2-0x0;var _0x52fee3=_0x49c3[_0x4310c2];return _0x52fee3;};'use strict';var server=require(_0x349c('0x0'));var Realtime=require('./realtime');var EmailChannel=require(_0x349c('0x1'));var mailAccount=require(_0x349c('0x2'));var setting=require('./rpc/setting');var logger=require('../../config/logger')('email');var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0x349c('0x3')]()['then'](mailAccount['getMailAccounts']())[_0x349c('0x4')](realtime[_0x349c('0x5')]())[_0x349c('0x4')](function(){email[_0x349c('0x6')](realtime['mailAccounts']);return realtime;});}function main(){return server[_0x349c('0x7')](realtime,email)[_0x349c('0x4')](function(){return initRealtime();})[_0x349c('0x4')](function(){return setting[_0x349c('0x8')]();})[_0x349c('0x4')](function(_0x2b5d6e){return setInterval(initRealtime,_0x2b5d6e['loginMailFrequency']*0x3e8);})['catch'](function(_0x19d432){logger[_0x349c('0x9')](_0x349c('0xa'),_0x19d432);});}main(); \ No newline at end of file +var _0x6c65=['./rpc/mailAccount','../../config/logger','email','resolve','then','getMailAccounts','initMailAccounts','refresh','mailAccounts','listen','getSettings','loginMailFrequency','Email\x20service\x20initialization','./realtime','./lib/email'];(function(_0x3e259e,_0x2dc3d7){var _0x3311ed=function(_0x2b4937){while(--_0x2b4937){_0x3e259e['push'](_0x3e259e['shift']());}};_0x3311ed(++_0x2dc3d7);}(_0x6c65,0x94));var _0x56c6=function(_0x35e7fb,_0x57b674){_0x35e7fb=_0x35e7fb-0x0;var _0x4257e1=_0x6c65[_0x35e7fb];return _0x4257e1;};'use strict';var server=require('./server');var Realtime=require(_0x56c6('0x0'));var EmailChannel=require(_0x56c6('0x1'));var mailAccount=require(_0x56c6('0x2'));var setting=require('./rpc/setting');var logger=require(_0x56c6('0x3'))(_0x56c6('0x4'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0x56c6('0x5')]()[_0x56c6('0x6')](mailAccount[_0x56c6('0x7')]())['then'](realtime[_0x56c6('0x8')]())[_0x56c6('0x6')](function(){email[_0x56c6('0x9')](realtime[_0x56c6('0xa')]);return realtime;});}function main(){return server[_0x56c6('0xb')](realtime,email)['then'](function(){return initRealtime();})[_0x56c6('0x6')](function(){return setting[_0x56c6('0xc')]();})[_0x56c6('0x6')](function(_0x48cdb2){return setInterval(initRealtime,_0x48cdb2[_0x56c6('0xd')]*0x3e8);})['catch'](function(_0x5f117f){logger['error'](_0x56c6('0xe'),_0x5f117f);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 48bd80c..dd2d3cf 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 _0xdb3a=['mailAccount:update','refresh','hasOwnProperty','active','provider','box','handleImapBox','bind','handleImapEmail','end','handleImapEnd','error','disabled','messageStatus','messages','total','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','from','notify','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','handleImapError','sendMail','verifySmtp','Smtp','verify','exports','lodash','bluebird','md5','ioredis','../../../config/environment','../../../config/logger','email','redis','localhost','./imap','./smtp','info','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','prototype','emit','name','Imap','status','isNil','stringify'];(function(_0x3ae256,_0x464cbd){var _0xdf0c35=function(_0x4f8484){while(--_0x4f8484){_0x3ae256['push'](_0x3ae256['shift']());}};_0xdf0c35(++_0x464cbd);}(_0xdb3a,0x163));var _0xadb3=function(_0x1ee04b,_0x554b3d){_0x1ee04b=_0x1ee04b-0x0;var _0x412848=_0xdb3a[_0x1ee04b];return _0x412848;};'use strict';var _=require(_0xadb3('0x0'));var moment=require('moment');var BPromise=require(_0xadb3('0x1'));var md5=require(_0xadb3('0x2'));var Redis=require(_0xadb3('0x3'));var config=require(_0xadb3('0x4'));var logger=require(_0xadb3('0x5'))(_0xadb3('0x6'));config[_0xadb3('0x7')]=_['defaults'](config[_0xadb3('0x7')],{'host':_0xadb3('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var EmailImap=require(_0xadb3('0x9'));var EmailSmtp=require(_0xadb3('0xa'));var mailAccount=require('../rpc/mailAccount');var md5Accounts={};function EmailChannel(_0x5794a2){logger[_0xadb3('0xb')](_0xadb3('0xc'));this[_0xadb3('0xd')]=_0x5794a2[_0xadb3('0xd')];this[_0xadb3('0xe')]={};this[_0xadb3('0xf')]=new EmailSmtp();}EmailChannel[_0xadb3('0x10')][_0xadb3('0x11')]=function(_0x4c7e04){var _0x50712a=this[_0xadb3('0xd')][_0x4c7e04];var _0x8469f={'id':_0x50712a['id'],'name':_0x50712a[_0xadb3('0x12')],'key':_0x50712a['key'],'active':_0x50712a['active'],'Imap':{'status':_0x50712a[_0xadb3('0x13')][_0xadb3('0x14')],'messageStatus':_0x50712a[_0xadb3('0x13')]['messageStatus'],'total':_0x50712a[_0xadb3('0x13')]['total']}};if(_[_0xadb3('0x15')](md5Accounts[_0x4c7e04])){md5Accounts[_0x4c7e04]={};}var _0x5d0d82=md5(JSON[_0xadb3('0x16')](_0x8469f));if(md5Accounts[_0x4c7e04]['md5']!==_0x5d0d82){md5Accounts[_0x4c7e04][_0xadb3('0x2')]=_0x5d0d82;io[_0xadb3('0x11')](_0xadb3('0x17'),_0x8469f);}};EmailChannel['prototype'][_0xadb3('0x18')]=function(_0x231946){for(var _0x1bad9d in _0x231946){if(_0x231946[_0xadb3('0x19')](_0x1bad9d)){if(_0x231946[_0x1bad9d]['Imap']&&_0x231946[_0x1bad9d][_0xadb3('0x1a')]){var _0x1eb745=_0x231946[_0x1bad9d]['Imap'];if(!_0x1eb745['service']&&_0x231946[_0x1bad9d][_0xadb3('0x1b')]!=='custom')_0x1eb745['service']=_0x231946[_0x1bad9d]['provider'];if(!this[_0xadb3('0xe')][_0xadb3('0x19')](_0x1eb745['id'])){this[_0xadb3('0xe')][_0x1eb745['id']]=new EmailImap(_0x1eb745,_0x231946[_0x1bad9d][_0xadb3('0x6')]);this[_0xadb3('0xe')][_0x1eb745['id']]['on'](_0xadb3('0x1c'),this[_0xadb3('0x1d')][_0xadb3('0x1e')](this,_0x1bad9d));this[_0xadb3('0xe')][_0x1eb745['id']]['on']('email',this[_0xadb3('0x1f')][_0xadb3('0x1e')](this,_0x1bad9d));this[_0xadb3('0xe')][_0x1eb745['id']]['on'](_0xadb3('0x20'),this[_0xadb3('0x21')][_0xadb3('0x1e')](this,_0x1bad9d));this[_0xadb3('0xe')][_0x1eb745['id']]['on'](_0xadb3('0x22'),this['handleImapError']['bind'](this,_0x1bad9d));}}else{if(_['isNil'](this['mailAccounts'][_0x1bad9d]['Imap'])){this['mailAccounts'][_0x1bad9d][_0xadb3('0x13')]={};}this['mailAccounts'][_0x1bad9d][_0xadb3('0x13')][_0xadb3('0x14')]=_0xadb3('0x23');this['mailAccounts'][_0x1bad9d][_0xadb3('0x13')][_0xadb3('0x24')]='';this['emit'](_0x1bad9d);}}}};EmailChannel[_0xadb3('0x10')][_0xadb3('0x1d')]=function(_0x1449c3,_0x2354f9){if(this['mailAccounts'][_0x1449c3]){this['mailAccounts'][_0x1449c3][_0xadb3('0x13')]['status']='connected';this[_0xadb3('0xd')][_0x1449c3]['Imap'][_0xadb3('0x24')]=_0x2354f9['name'];if(_0x2354f9[_0xadb3('0x25')]){this[_0xadb3('0xd')][_0x1449c3][_0xadb3('0x13')][_0xadb3('0x26')]=_0x2354f9[_0xadb3('0x25')][_0xadb3('0x26')];}return this[_0xadb3('0x11')](_0x1449c3);}};EmailChannel[_0xadb3('0x10')][_0xadb3('0x1f')]=function(_0x51482d,_0x414296){logger[_0xadb3('0xb')](_0xadb3('0x27'),_0x414296[_0xadb3('0x28')],_0x414296[_0xadb3('0x29')],_0x414296[_0xadb3('0x2a')],_0x51482d);if(this['mailAccounts'][_0x51482d]){return mailAccount[_0xadb3('0x2b')](_0x51482d,_0x414296)['then'](function(_0x37034a){if(_0x37034a){logger['info'](_0xadb3('0x2c'));}})[_0xadb3('0x2d')](function(_0x185e13){logger[_0xadb3('0x22')](_0xadb3('0x2e'),JSON['stringify'](_0x185e13));});}};EmailChannel[_0xadb3('0x10')][_0xadb3('0x21')]=function(_0xb18e9e){if(this[_0xadb3('0xd')][_0xb18e9e]&&this[_0xadb3('0xd')][_0xb18e9e][_0xadb3('0x13')]){if(this[_0xadb3('0xe')][this['mailAccounts'][_0xb18e9e][_0xadb3('0x13')]['id']]){delete this[_0xadb3('0xe')][this[_0xadb3('0xd')][_0xb18e9e][_0xadb3('0x13')]['id']];}this[_0xadb3('0xd')][_0xb18e9e]['Imap'][_0xadb3('0x2f')]=moment();this[_0xadb3('0x11')](_0xb18e9e);}};EmailChannel[_0xadb3('0x10')][_0xadb3('0x30')]=function(_0xf6de65,_0xa32d33){if(this[_0xadb3('0xd')][_0xf6de65]){this['mailAccounts'][_0xf6de65]['Imap'][_0xadb3('0x14')]=_0xadb3('0x22');this['mailAccounts'][_0xf6de65][_0xadb3('0x13')][_0xadb3('0x24')]=_0xa32d33;return this[_0xadb3('0x11')](_0xf6de65);}};EmailChannel['prototype'][_0xadb3('0x31')]=function(_0x28d4b5,_0x5af2c0){return this['smtp']['send'](_0x28d4b5,_0x5af2c0);};EmailChannel[_0xadb3('0x10')][_0xadb3('0x32')]=function(_0x27ec7b){var _0x231790=this;if(this[_0xadb3('0xd')][_0x27ec7b['id']]){if(_[_0xadb3('0x15')](this[_0xadb3('0xd')][_0x27ec7b['id']][_0xadb3('0x33')])){this[_0xadb3('0xd')][_0x27ec7b['id']]['Smtp']={};}this['mailAccounts'][_0x27ec7b['id']][_0xadb3('0x33')][_0xadb3('0x2f')]=moment();return new BPromise(function(_0x529bf5,_0x441cc3){return _0x231790[_0xadb3('0xf')][_0xadb3('0x34')](_0x27ec7b)['then'](function(_0x26b61e){_0x231790[_0xadb3('0xd')][_0x27ec7b['id']][_0xadb3('0x33')][_0xadb3('0x14')]='verified';_0x231790[_0xadb3('0xd')][_0x27ec7b['id']][_0xadb3('0x33')][_0xadb3('0x24')]='';_0x231790[_0xadb3('0x11')](_0x27ec7b['id']);_0x529bf5(_0x26b61e);})[_0xadb3('0x2d')](function(_0x38e3a3){_0x231790[_0xadb3('0xd')][_0x27ec7b['id']][_0xadb3('0x33')][_0xadb3('0x14')]=_0xadb3('0x22');_0x231790[_0xadb3('0xd')][_0x27ec7b['id']]['Smtp']['messageStatus']=_0x38e3a3;_0x231790[_0xadb3('0x11')](_0x27ec7b['id']);_0x441cc3(_0x38e3a3);});});}return this[_0xadb3('0xf')][_0xadb3('0x34')](_0x27ec7b);};module[_0xadb3('0x35')]=EmailChannel; \ No newline at end of file +var _0x3c2a=['localhost','socket.io-emitter','./imap','./smtp','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','emit','name','key','active','Imap','messageStatus','total','isNil','stringify','prototype','refresh','hasOwnProperty','service','provider','custom','box','handleImapBox','bind','end','error','status','connected','messages','handleImapEmail','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','notify','then','catch','handleImapEnd','lastSync','send','verifySmtp','Smtp','verify','verified','exports','lodash','moment','bluebird','md5','ioredis','../../../config/logger','email','redis','defaults'];(function(_0x5fa520,_0xaf0e7d){var _0x1bf6c4=function(_0x2a7440){while(--_0x2a7440){_0x5fa520['push'](_0x5fa520['shift']());}};_0x1bf6c4(++_0xaf0e7d);}(_0x3c2a,0x186));var _0xa3c2=function(_0x580693,_0x334344){_0x580693=_0x580693-0x0;var _0x339e33=_0x3c2a[_0x580693];return _0x339e33;};'use strict';var _=require(_0xa3c2('0x0'));var moment=require(_0xa3c2('0x1'));var BPromise=require(_0xa3c2('0x2'));var md5=require(_0xa3c2('0x3'));var Redis=require(_0xa3c2('0x4'));var config=require('../../../config/environment');var logger=require(_0xa3c2('0x5'))(_0xa3c2('0x6'));config[_0xa3c2('0x7')]=_[_0xa3c2('0x8')](config[_0xa3c2('0x7')],{'host':_0xa3c2('0x9'),'port':0x18eb});var io=require(_0xa3c2('0xa'))(new Redis(config[_0xa3c2('0x7')]));var EmailImap=require(_0xa3c2('0xb'));var EmailSmtp=require(_0xa3c2('0xc'));var mailAccount=require(_0xa3c2('0xd'));var md5Accounts={};function EmailChannel(_0x274d76){logger[_0xa3c2('0xe')](_0xa3c2('0xf'));this[_0xa3c2('0x10')]=_0x274d76[_0xa3c2('0x10')];this[_0xa3c2('0x11')]={};this[_0xa3c2('0x12')]=new EmailSmtp();}EmailChannel['prototype'][_0xa3c2('0x13')]=function(_0x32abcc){var _0x2d213b=this[_0xa3c2('0x10')][_0x32abcc];var _0x54e802={'id':_0x2d213b['id'],'name':_0x2d213b[_0xa3c2('0x14')],'key':_0x2d213b[_0xa3c2('0x15')],'active':_0x2d213b[_0xa3c2('0x16')],'Imap':{'status':_0x2d213b[_0xa3c2('0x17')]['status'],'messageStatus':_0x2d213b[_0xa3c2('0x17')][_0xa3c2('0x18')],'total':_0x2d213b[_0xa3c2('0x17')][_0xa3c2('0x19')]}};if(_[_0xa3c2('0x1a')](md5Accounts[_0x32abcc])){md5Accounts[_0x32abcc]={};}var _0x3382e9=md5(JSON[_0xa3c2('0x1b')](_0x54e802));if(md5Accounts[_0x32abcc][_0xa3c2('0x3')]!==_0x3382e9){md5Accounts[_0x32abcc][_0xa3c2('0x3')]=_0x3382e9;io[_0xa3c2('0x13')]('mailAccount:update',_0x54e802);}};EmailChannel[_0xa3c2('0x1c')][_0xa3c2('0x1d')]=function(_0x3aca31){for(var _0x1fd895 in _0x3aca31){if(_0x3aca31[_0xa3c2('0x1e')](_0x1fd895)){if(_0x3aca31[_0x1fd895][_0xa3c2('0x17')]&&_0x3aca31[_0x1fd895][_0xa3c2('0x16')]){var _0x34ca97=_0x3aca31[_0x1fd895][_0xa3c2('0x17')];if(!_0x34ca97[_0xa3c2('0x1f')]&&_0x3aca31[_0x1fd895][_0xa3c2('0x20')]!==_0xa3c2('0x21'))_0x34ca97[_0xa3c2('0x1f')]=_0x3aca31[_0x1fd895][_0xa3c2('0x20')];if(!this[_0xa3c2('0x11')]['hasOwnProperty'](_0x34ca97['id'])){this[_0xa3c2('0x11')][_0x34ca97['id']]=new EmailImap(_0x34ca97,_0x3aca31[_0x1fd895][_0xa3c2('0x6')]);this[_0xa3c2('0x11')][_0x34ca97['id']]['on'](_0xa3c2('0x22'),this[_0xa3c2('0x23')]['bind'](this,_0x1fd895));this['imapAccounts'][_0x34ca97['id']]['on']('email',this['handleImapEmail'][_0xa3c2('0x24')](this,_0x1fd895));this['imapAccounts'][_0x34ca97['id']]['on'](_0xa3c2('0x25'),this['handleImapEnd'][_0xa3c2('0x24')](this,_0x1fd895));this['imapAccounts'][_0x34ca97['id']]['on'](_0xa3c2('0x26'),this['handleImapError'][_0xa3c2('0x24')](this,_0x1fd895));}}else{if(_[_0xa3c2('0x1a')](this[_0xa3c2('0x10')][_0x1fd895][_0xa3c2('0x17')])){this[_0xa3c2('0x10')][_0x1fd895][_0xa3c2('0x17')]={};}this[_0xa3c2('0x10')][_0x1fd895]['Imap']['status']='disabled';this['mailAccounts'][_0x1fd895]['Imap'][_0xa3c2('0x18')]='';this[_0xa3c2('0x13')](_0x1fd895);}}}};EmailChannel[_0xa3c2('0x1c')][_0xa3c2('0x23')]=function(_0x48672a,_0x4df431){if(this[_0xa3c2('0x10')][_0x48672a]){this['mailAccounts'][_0x48672a]['Imap'][_0xa3c2('0x27')]=_0xa3c2('0x28');this['mailAccounts'][_0x48672a]['Imap'][_0xa3c2('0x18')]=_0x4df431['name'];if(_0x4df431['messages']){this['mailAccounts'][_0x48672a]['Imap'][_0xa3c2('0x19')]=_0x4df431[_0xa3c2('0x29')][_0xa3c2('0x19')];}return this[_0xa3c2('0x13')](_0x48672a);}};EmailChannel[_0xa3c2('0x1c')][_0xa3c2('0x2a')]=function(_0x54e49c,_0x1c4b03){logger['info'](_0xa3c2('0x2b'),_0x1c4b03[_0xa3c2('0x2c')],_0x1c4b03[_0xa3c2('0x2d')],_0x1c4b03['from'],_0x54e49c);if(this[_0xa3c2('0x10')][_0x54e49c]){return mailAccount[_0xa3c2('0x2e')](_0x54e49c,_0x1c4b03)[_0xa3c2('0x2f')](function(_0xba83c6){if(_0xba83c6){logger[_0xa3c2('0xe')]('Mail\x20accepted\x20from\x20routing');}})[_0xa3c2('0x30')](function(_0x5888c5){logger[_0xa3c2('0x26')]('Mail\x20not\x20accepted\x20from\x20routing\x20%s',JSON[_0xa3c2('0x1b')](_0x5888c5));});}};EmailChannel['prototype'][_0xa3c2('0x31')]=function(_0x2e986a){if(this[_0xa3c2('0x10')][_0x2e986a]&&this[_0xa3c2('0x10')][_0x2e986a]['Imap']){if(this[_0xa3c2('0x11')][this['mailAccounts'][_0x2e986a]['Imap']['id']]){delete this[_0xa3c2('0x11')][this[_0xa3c2('0x10')][_0x2e986a][_0xa3c2('0x17')]['id']];}this[_0xa3c2('0x10')][_0x2e986a]['Imap'][_0xa3c2('0x32')]=moment();this[_0xa3c2('0x13')](_0x2e986a);}};EmailChannel[_0xa3c2('0x1c')]['handleImapError']=function(_0x48a113,_0x149f62){if(this[_0xa3c2('0x10')][_0x48a113]){this['mailAccounts'][_0x48a113]['Imap'][_0xa3c2('0x27')]=_0xa3c2('0x26');this[_0xa3c2('0x10')][_0x48a113][_0xa3c2('0x17')][_0xa3c2('0x18')]=_0x149f62;return this[_0xa3c2('0x13')](_0x48a113);}};EmailChannel[_0xa3c2('0x1c')]['sendMail']=function(_0xad626b,_0x5a6afe){return this['smtp'][_0xa3c2('0x33')](_0xad626b,_0x5a6afe);};EmailChannel['prototype'][_0xa3c2('0x34')]=function(_0x49275b){var _0x4dfbe6=this;if(this[_0xa3c2('0x10')][_0x49275b['id']]){if(_['isNil'](this[_0xa3c2('0x10')][_0x49275b['id']][_0xa3c2('0x35')])){this[_0xa3c2('0x10')][_0x49275b['id']][_0xa3c2('0x35')]={};}this[_0xa3c2('0x10')][_0x49275b['id']][_0xa3c2('0x35')][_0xa3c2('0x32')]=moment();return new BPromise(function(_0x4e67fa,_0x54026f){return _0x4dfbe6['smtp'][_0xa3c2('0x36')](_0x49275b)[_0xa3c2('0x2f')](function(_0x58ac48){_0x4dfbe6[_0xa3c2('0x10')][_0x49275b['id']][_0xa3c2('0x35')][_0xa3c2('0x27')]=_0xa3c2('0x37');_0x4dfbe6['mailAccounts'][_0x49275b['id']][_0xa3c2('0x35')][_0xa3c2('0x18')]='';_0x4dfbe6[_0xa3c2('0x13')](_0x49275b['id']);_0x4e67fa(_0x58ac48);})['catch'](function(_0x235f91){_0x4dfbe6[_0xa3c2('0x10')][_0x49275b['id']][_0xa3c2('0x35')][_0xa3c2('0x27')]=_0xa3c2('0x26');_0x4dfbe6[_0xa3c2('0x10')][_0x49275b['id']]['Smtp'][_0xa3c2('0x18')]=_0x235f91;_0x4dfbe6[_0xa3c2('0x13')](_0x49275b['id']);_0x54026f(_0x235f91);});});}return this[_0xa3c2('0x12')][_0xa3c2('0x36')](_0x49275b);};module[_0xa3c2('0x38')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index ac839b0..8d970a1 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 _0x93c1=['handleMessageBody','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','parser','emit','handleFetchError','stringify','textCode','upperFirst','exports','lodash','util','imap','simpleParser','iconv','Iconv','events','EventEmitter','./utils','../../../config/logger','mailbox','account','getAccount','ready','handleReady','bind','once','end','handleEnd','handleError','inherits','prototype','connTimeout','authTimeout','service','user','modernAuthentication','xoauth2','data5','password','authentication','email','host','port','tls','required','handleOpenBox','box','readUnseen','handleCloseBox','search','UNSEEN','handleReadUnseen','length','fetch','handleFetchMessage','error','handleFetchEnd','closeBox','body'];(function(_0x31d7ba,_0x2ca0f5){var _0x333aad=function(_0x563e40){while(--_0x563e40){_0x31d7ba['push'](_0x31d7ba['shift']());}};_0x333aad(++_0x2ca0f5);}(_0x93c1,0x1be));var _0x193c=function(_0x1d24eb,_0x12295b){_0x1d24eb=_0x1d24eb-0x0;var _0x1dc576=_0x93c1[_0x1d24eb];return _0x1dc576;};'use strict';var _=require(_0x193c('0x0'));var util=require(_0x193c('0x1'));var Imap=require(_0x193c('0x2'));var simpleParser=require('mailparser')[_0x193c('0x3')];var Iconv=require(_0x193c('0x4'))[_0x193c('0x5')];var EventEmitter=require(_0x193c('0x6'))[_0x193c('0x7')];var utils=require(_0x193c('0x8'));var logger=require(_0x193c('0x9'))('email');function EmailImap(_0x486da0,_0x587c7a){this[_0x193c('0xa')]=_0x486da0[_0x193c('0xa')];this[_0x193c('0xb')]=this[_0x193c('0xc')](_0x486da0,_0x587c7a);this[_0x193c('0x2')]=new Imap(this[_0x193c('0xb')]);this[_0x193c('0x2')]['once'](_0x193c('0xd'),this[_0x193c('0xe')][_0x193c('0xf')](this));this['imap'][_0x193c('0x10')](_0x193c('0x11'),this[_0x193c('0x12')][_0x193c('0xf')](this));this[_0x193c('0x2')]['on']('error',this[_0x193c('0x13')][_0x193c('0xf')](this));this[_0x193c('0x2')]['connect']();}util[_0x193c('0x14')](EmailImap,EventEmitter);EmailImap[_0x193c('0x15')][_0x193c('0xc')]=function(_0x3988ca,_0x1bd749){var _0x4acfd6={'connTimeout':_0x3988ca[_0x193c('0x16')]?_0x3988ca['connTimeout']*0x3e8:0x2710,'authTimeout':_0x3988ca['authTimeout']?_0x3988ca[_0x193c('0x17')]*0x3e8:0x1388};if(_0x3988ca[_0x193c('0x18')]){_0x4acfd6[_0x193c('0x19')]=_0x3988ca[_0x193c('0x19')];if(_0x3988ca[_0x193c('0x1a')]){_0x4acfd6[_0x193c('0x1b')]=utils['generateXOAuth2Token'](_0x3988ca['CloudProvider'][_0x193c('0x1c')],_0x3988ca[_0x193c('0x19')]);}else{_0x4acfd6[_0x193c('0x1d')]=_0x3988ca[_0x193c('0x1d')];}}else{if(_0x3988ca[_0x193c('0x1e')]){_0x4acfd6[_0x193c('0x19')]=_0x3988ca[_0x193c('0x19')];_0x4acfd6[_0x193c('0x1d')]=_0x3988ca['password'];}}_0x4acfd6[_0x193c('0x1f')]=_0x1bd749||_0x3988ca[_0x193c('0x19')]||'anonymous@xcally.com';_0x4acfd6['host']=_0x3988ca[_0x193c('0x20')];_0x4acfd6[_0x193c('0x21')]=_0x3988ca[_0x193c('0x21')]||0x3e1;if(_0x3988ca['tls']){_0x4acfd6[_0x193c('0x22')]=!![];}else{_0x4acfd6[_0x193c('0x22')]=![];_0x4acfd6['autotls']=_0x193c('0x23');}return _0x4acfd6;};EmailImap[_0x193c('0x15')][_0x193c('0xe')]=function(){this[_0x193c('0x2')]['openBox'](this['mailbox'],![],this[_0x193c('0x24')][_0x193c('0xf')](this));};EmailImap['prototype'][_0x193c('0x24')]=function(_0x4fd73a,_0x582165){if(_0x4fd73a){this[_0x193c('0x13')](_0x4fd73a,!![]);}else{this['emit'](_0x193c('0x25'),_0x582165);this[_0x193c('0x26')]();}};EmailImap[_0x193c('0x15')][_0x193c('0x27')]=function(_0x23fbbb){if(_0x23fbbb){this[_0x193c('0x13')](_0x23fbbb,!![]);}else{this[_0x193c('0x2')][_0x193c('0x11')]();}};EmailImap['prototype'][_0x193c('0x26')]=function(){this['imap'][_0x193c('0x28')]([_0x193c('0x29')],this[_0x193c('0x2a')][_0x193c('0xf')](this));};EmailImap[_0x193c('0x15')][_0x193c('0x2a')]=function(_0x36dde8,_0x53bb90){if(_0x36dde8){this[_0x193c('0x13')](_0x36dde8,!![]);}else{if(_0x53bb90[_0x193c('0x2b')]){try{var _0x4053c2=this[_0x193c('0x2')][_0x193c('0x2c')](_0x53bb90,{'bodies':'','markSeen':!![]});_0x4053c2['on']('message',this[_0x193c('0x2d')][_0x193c('0xf')](this));_0x4053c2['once'](_0x193c('0x2e'),this['handleFetchError']['bind'](this));_0x4053c2[_0x193c('0x10')](_0x193c('0x11'),this[_0x193c('0x2f')][_0x193c('0xf')](this));}catch(_0x4666a4){logger['error'](_0x4666a4);}}else{this[_0x193c('0x2')][_0x193c('0x30')](!![],this['handleCloseBox'][_0x193c('0xf')](this));}}};EmailImap[_0x193c('0x15')][_0x193c('0x2d')]=function(_0x4d4714){_0x4d4714['on'](_0x193c('0x31'),this[_0x193c('0x32')][_0x193c('0xf')](this));_0x4d4714[_0x193c('0x10')](_0x193c('0x33'),this[_0x193c('0x34')][_0x193c('0xf')](this));_0x4d4714['once'](_0x193c('0x11'),this[_0x193c('0x35')][_0x193c('0xf')](this));};EmailImap[_0x193c('0x15')][_0x193c('0x32')]=function(_0x574489){simpleParser(_0x574489,{'Iconv':Iconv},this[_0x193c('0x36')]['bind'](this));};EmailImap[_0x193c('0x15')][_0x193c('0x34')]=function(){};EmailImap[_0x193c('0x15')]['handleMessageEnd']=function(){};EmailImap[_0x193c('0x15')][_0x193c('0x36')]=function(_0x1695e1,_0x4e57ae){if(_0x1695e1){logger[_0x193c('0x2e')](_0x1695e1);}else{var _0xaa0f77=this;utils[_0x193c('0x37')](this[_0x193c('0xb')],_0x4e57ae,function(_0x5b7ed1){_0xaa0f77[_0x193c('0x38')](_0x193c('0x1f'),_0x5b7ed1);});}};EmailImap[_0x193c('0x15')]['handleFetchEnd']=function(){this[_0x193c('0x2')][_0x193c('0x30')](!![],this[_0x193c('0x27')]['bind'](this));};EmailImap['prototype'][_0x193c('0x39')]=function(_0x211c2b){this[_0x193c('0x13')](_0x211c2b);this['imap'][_0x193c('0x30')](!![],this[_0x193c('0x27')][_0x193c('0xf')](this));};EmailImap[_0x193c('0x15')]['handleEnd']=function(){this[_0x193c('0x38')](_0x193c('0x11'));};EmailImap[_0x193c('0x15')][_0x193c('0x13')]=function(_0x2e34df,_0x598b33){logger[_0x193c('0x2e')](_0x193c('0x13'),this[_0x193c('0xb')][_0x193c('0x1f')],JSON[_0x193c('0x3a')](_0x2e34df));var _0x423d29='';if(_0x2e34df){if(_0x2e34df['textCode']){_0x423d29=_0x2e34df[_0x193c('0x3b')];}else{for(var _0x47bee7 in _0x2e34df){if(_0x2e34df['hasOwnProperty'](_0x47bee7)){_0x423d29+=_[_0x193c('0x3c')](_0x47bee7)+':\x20'+_0x2e34df[_0x47bee7]+'\x0a';}}}}if(_0x598b33){this[_0x193c('0x2')][_0x193c('0x11')]();}else{this[_0x193c('0x38')](_0x193c('0x2e'),_0x423d29);this[_0x193c('0x38')](_0x193c('0x11'));}};module[_0x193c('0x3d')]=EmailImap; \ No newline at end of file +var _0xc678=['password','authentication','anonymous@xcally.com','host','port','tls','required','openBox','handleOpenBox','emit','box','readUnseen','search','UNSEEN','handleReadUnseen','fetch','handleFetchMessage','handleFetchError','handleFetchEnd','closeBox','handleCloseBox','body','handleMessageBody','attributes','handleMessageAttributes','handleSimpleParser','handleMessageEnd','parser','error','stringify','textCode','hasOwnProperty','upperFirst','exports','lodash','util','imap','mailparser','simpleParser','Iconv','events','EventEmitter','email','mailbox','account','getAccount','once','handleReady','bind','end','handleEnd','handleError','connect','inherits','prototype','connTimeout','authTimeout','user','modernAuthentication','CloudProvider','data5'];(function(_0x569020,_0x4d7f3a){var _0x42bed8=function(_0x381acd){while(--_0x381acd){_0x569020['push'](_0x569020['shift']());}};_0x42bed8(++_0x4d7f3a);}(_0xc678,0x116));var _0x8c67=function(_0x1e97c1,_0xab00d2){_0x1e97c1=_0x1e97c1-0x0;var _0x27361f=_0xc678[_0x1e97c1];return _0x27361f;};'use strict';var _=require(_0x8c67('0x0'));var util=require(_0x8c67('0x1'));var Imap=require(_0x8c67('0x2'));var simpleParser=require(_0x8c67('0x3'))[_0x8c67('0x4')];var Iconv=require('iconv')[_0x8c67('0x5')];var EventEmitter=require(_0x8c67('0x6'))[_0x8c67('0x7')];var utils=require('./utils');var logger=require('../../../config/logger')(_0x8c67('0x8'));function EmailImap(_0x179142,_0x2829a5){this[_0x8c67('0x9')]=_0x179142[_0x8c67('0x9')];this[_0x8c67('0xa')]=this[_0x8c67('0xb')](_0x179142,_0x2829a5);this[_0x8c67('0x2')]=new Imap(this[_0x8c67('0xa')]);this[_0x8c67('0x2')][_0x8c67('0xc')]('ready',this[_0x8c67('0xd')][_0x8c67('0xe')](this));this[_0x8c67('0x2')][_0x8c67('0xc')](_0x8c67('0xf'),this[_0x8c67('0x10')][_0x8c67('0xe')](this));this[_0x8c67('0x2')]['on']('error',this[_0x8c67('0x11')][_0x8c67('0xe')](this));this[_0x8c67('0x2')][_0x8c67('0x12')]();}util[_0x8c67('0x13')](EmailImap,EventEmitter);EmailImap[_0x8c67('0x14')][_0x8c67('0xb')]=function(_0x1949fe,_0x3632b9){var _0xe41a4f={'connTimeout':_0x1949fe[_0x8c67('0x15')]?_0x1949fe[_0x8c67('0x15')]*0x3e8:0x2710,'authTimeout':_0x1949fe[_0x8c67('0x16')]?_0x1949fe[_0x8c67('0x16')]*0x3e8:0x1388};if(_0x1949fe['service']){_0xe41a4f[_0x8c67('0x17')]=_0x1949fe[_0x8c67('0x17')];if(_0x1949fe[_0x8c67('0x18')]){_0xe41a4f['xoauth2']=utils['generateXOAuth2Token'](_0x1949fe[_0x8c67('0x19')][_0x8c67('0x1a')],_0x1949fe['user']);}else{_0xe41a4f[_0x8c67('0x1b')]=_0x1949fe['password'];}}else{if(_0x1949fe[_0x8c67('0x1c')]){_0xe41a4f[_0x8c67('0x17')]=_0x1949fe[_0x8c67('0x17')];_0xe41a4f[_0x8c67('0x1b')]=_0x1949fe[_0x8c67('0x1b')];}}_0xe41a4f[_0x8c67('0x8')]=_0x3632b9||_0x1949fe[_0x8c67('0x17')]||_0x8c67('0x1d');_0xe41a4f['host']=_0x1949fe[_0x8c67('0x1e')];_0xe41a4f[_0x8c67('0x1f')]=_0x1949fe['port']||0x3e1;if(_0x1949fe[_0x8c67('0x20')]){_0xe41a4f[_0x8c67('0x20')]=!![];}else{_0xe41a4f[_0x8c67('0x20')]=![];_0xe41a4f['autotls']=_0x8c67('0x21');}return _0xe41a4f;};EmailImap[_0x8c67('0x14')][_0x8c67('0xd')]=function(){this[_0x8c67('0x2')][_0x8c67('0x22')](this['mailbox'],![],this[_0x8c67('0x23')][_0x8c67('0xe')](this));};EmailImap[_0x8c67('0x14')][_0x8c67('0x23')]=function(_0x3ca264,_0xd220ae){if(_0x3ca264){this['handleError'](_0x3ca264,!![]);}else{this[_0x8c67('0x24')](_0x8c67('0x25'),_0xd220ae);this[_0x8c67('0x26')]();}};EmailImap[_0x8c67('0x14')]['handleCloseBox']=function(_0x7aa193){if(_0x7aa193){this['handleError'](_0x7aa193,!![]);}else{this[_0x8c67('0x2')][_0x8c67('0xf')]();}};EmailImap[_0x8c67('0x14')][_0x8c67('0x26')]=function(){this[_0x8c67('0x2')][_0x8c67('0x27')]([_0x8c67('0x28')],this[_0x8c67('0x29')][_0x8c67('0xe')](this));};EmailImap['prototype'][_0x8c67('0x29')]=function(_0x29a98e,_0x22205a){if(_0x29a98e){this[_0x8c67('0x11')](_0x29a98e,!![]);}else{if(_0x22205a['length']){try{var _0x255ea9=this[_0x8c67('0x2')][_0x8c67('0x2a')](_0x22205a,{'bodies':'','markSeen':!![]});_0x255ea9['on']('message',this[_0x8c67('0x2b')]['bind'](this));_0x255ea9[_0x8c67('0xc')]('error',this[_0x8c67('0x2c')][_0x8c67('0xe')](this));_0x255ea9[_0x8c67('0xc')](_0x8c67('0xf'),this[_0x8c67('0x2d')][_0x8c67('0xe')](this));}catch(_0x157103){logger['error'](_0x157103);}}else{this[_0x8c67('0x2')][_0x8c67('0x2e')](!![],this[_0x8c67('0x2f')][_0x8c67('0xe')](this));}}};EmailImap[_0x8c67('0x14')][_0x8c67('0x2b')]=function(_0x22abd7){_0x22abd7['on'](_0x8c67('0x30'),this[_0x8c67('0x31')][_0x8c67('0xe')](this));_0x22abd7[_0x8c67('0xc')](_0x8c67('0x32'),this[_0x8c67('0x33')][_0x8c67('0xe')](this));_0x22abd7['once'](_0x8c67('0xf'),this['handleMessageEnd'][_0x8c67('0xe')](this));};EmailImap[_0x8c67('0x14')]['handleMessageBody']=function(_0x568f8b){simpleParser(_0x568f8b,{'Iconv':Iconv},this[_0x8c67('0x34')][_0x8c67('0xe')](this));};EmailImap[_0x8c67('0x14')][_0x8c67('0x33')]=function(){};EmailImap[_0x8c67('0x14')][_0x8c67('0x35')]=function(){};EmailImap[_0x8c67('0x14')][_0x8c67('0x34')]=function(_0x5420b4,_0x484a89){if(_0x5420b4){logger['error'](_0x5420b4);}else{var _0x13ad08=this;utils[_0x8c67('0x36')](this['account'],_0x484a89,function(_0xad4b73){_0x13ad08['emit']('email',_0xad4b73);});}};EmailImap['prototype'][_0x8c67('0x2d')]=function(){this['imap'][_0x8c67('0x2e')](!![],this['handleCloseBox'][_0x8c67('0xe')](this));};EmailImap[_0x8c67('0x14')][_0x8c67('0x2c')]=function(_0x2a9924){this[_0x8c67('0x11')](_0x2a9924);this['imap']['closeBox'](!![],this['handleCloseBox']['bind'](this));};EmailImap[_0x8c67('0x14')][_0x8c67('0x10')]=function(){this[_0x8c67('0x24')]('end');};EmailImap['prototype'][_0x8c67('0x11')]=function(_0x36da93,_0xe8b80c){logger[_0x8c67('0x37')](_0x8c67('0x11'),this['account'][_0x8c67('0x8')],JSON[_0x8c67('0x38')](_0x36da93));var _0xc5c122='';if(_0x36da93){if(_0x36da93[_0x8c67('0x39')]){_0xc5c122=_0x36da93['textCode'];}else{for(var _0x1bdca4 in _0x36da93){if(_0x36da93[_0x8c67('0x3a')](_0x1bdca4)){_0xc5c122+=_[_0x8c67('0x3b')](_0x1bdca4)+':\x20'+_0x36da93[_0x1bdca4]+'\x0a';}}}}if(_0xe8b80c){this[_0x8c67('0x2')]['end']();}else{this['emit']('error',_0xc5c122);this[_0x8c67('0x24')](_0x8c67('0xf'));}};module[_0x8c67('0x3c')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index fe2a844..6eebc0f 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 _0x97c6=['prototype','send','createTransport','compile','sendMail','toString','verify','Not\x20verifired','exports','nodemailer-plugin-inline-base64'];(function(_0x54e217,_0x243297){var _0x590ead=function(_0x2f1d78){while(--_0x2f1d78){_0x54e217['push'](_0x54e217['shift']());}};_0x590ead(++_0x243297);}(_0x97c6,0x1ad));var _0x697c=function(_0x178f52,_0x5d9675){_0x178f52=_0x178f52-0x0;var _0x556f99=_0x97c6[_0x178f52];return _0x556f99;};'use strict';var nodemailer=require('nodemailer');var inlineBase64=require(_0x697c('0x0'));function EmailSmtp(){}EmailSmtp[_0x697c('0x1')][_0x697c('0x2')]=function(_0x51a4d5,_0x2574af){return new Promise(function(_0x459b15,_0x5b249b){var _0x634b5b=nodemailer[_0x697c('0x3')](_0x51a4d5);_0x634b5b['use'](_0x697c('0x4'),inlineBase64());_0x634b5b[_0x697c('0x5')](_0x2574af,function(_0x261a72,_0x4c3994){if(_0x261a72){_0x5b249b(_0x261a72[_0x697c('0x6')]());}else{_0x459b15(_0x4c3994);}});});};EmailSmtp[_0x697c('0x1')][_0x697c('0x7')]=function(_0x2b5afb){return new Promise(function(_0x370c78,_0x11757a){var _0x50dad1=nodemailer[_0x697c('0x3')](_0x2b5afb);_0x50dad1['verify'](function(_0x10e205,_0x117553){if(_0x10e205){_0x11757a(_0x10e205[_0x697c('0x6')]());}else{if(_0x117553){_0x370c78(_0x117553);}else{_0x11757a(_0x697c('0x8'));}}});});};module[_0x697c('0x9')]=EmailSmtp; \ No newline at end of file +var _0xb96a=['Not\x20verifired','exports','nodemailer','nodemailer-plugin-inline-base64','prototype','send','createTransport','use','compile','toString','verify'];(function(_0x342e17,_0x5c8041){var _0x235049=function(_0x5b5dd4){while(--_0x5b5dd4){_0x342e17['push'](_0x342e17['shift']());}};_0x235049(++_0x5c8041);}(_0xb96a,0xc8));var _0xab96=function(_0x571fe7,_0x4fc7c6){_0x571fe7=_0x571fe7-0x0;var _0x3115d6=_0xb96a[_0x571fe7];return _0x3115d6;};'use strict';var nodemailer=require(_0xab96('0x0'));var inlineBase64=require(_0xab96('0x1'));function EmailSmtp(){}EmailSmtp[_0xab96('0x2')][_0xab96('0x3')]=function(_0x3faa6a,_0x4a6244){return new Promise(function(_0x3120c1,_0x435574){var _0x28e720=nodemailer[_0xab96('0x4')](_0x3faa6a);_0x28e720[_0xab96('0x5')](_0xab96('0x6'),inlineBase64());_0x28e720['sendMail'](_0x4a6244,function(_0x305830,_0x4b4f67){if(_0x305830){_0x435574(_0x305830[_0xab96('0x7')]());}else{_0x3120c1(_0x4b4f67);}});});};EmailSmtp[_0xab96('0x2')][_0xab96('0x8')]=function(_0x5b24c6){return new Promise(function(_0x4ab756,_0x2393fc){var _0x32addb=nodemailer['createTransport'](_0x5b24c6);_0x32addb[_0xab96('0x8')](function(_0x4be906,_0x2c0fac){if(_0x4be906){_0x2393fc(_0x4be906[_0xab96('0x7')]());}else{if(_0x2c0fac){_0x4ab756(_0x2c0fac);}else{_0x2393fc(_0xab96('0x9'));}}});});};module[_0xab96('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 730000f..6de1308 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 _0xc4a5=['filter','info','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','messageId','parseBuffer','first','content','

Empty\x20message

','Attachments','Title','Data','generateXOAuth2Token','user=','auth=Bearer\x20','utf-8','toString','lodash','moment','randomstring','path','util','node-tnef','../../../config/logger','email','../../../config/environment','value','address','anonymous','generate','@xcally.com','head','name','substring','indexOf','slice','join','split','length','isEmpty','test','html','replace','includes','\x20[Attachment:\x20','\x20]','body','textAsHtml','0x1?_0x3d7d6c[_0x5c4a('0x12')](0x0,-0x1)[_0x5c4a('0x13')]('\x20'):_0x347861['name'];}return'Anonymous';}function getLastName(_0x1629eb){var _0x113636=_['head'](_0x1629eb[_0x5c4a('0x9')]);if(_0x113636&&_0x113636[_0x5c4a('0xf')]){var _0x6f5171=_0x113636[_0x5c4a('0xf')][_0x5c4a('0x14')](/\s+/);return _0x6f5171[_0x5c4a('0x15')]>0x1?_0x6f5171['pop']():'';}return'';}function getMails(_0x52f915,_0x447e6e){var _0x1a2df2='';for(var _0x1f2e6e=0x0;_0x1f2e6e<_0x447e6e[_0x5c4a('0x9')][_0x5c4a('0x15')];_0x1f2e6e+=0x1){if(_0x447e6e[_0x5c4a('0x9')][_0x1f2e6e][_0x5c4a('0xa')]!==_0x52f915){if(!_[_0x5c4a('0x16')](_0x1a2df2)){_0x1a2df2+=',';}_0x1a2df2+=_0x447e6e[_0x5c4a('0x9')][_0x1f2e6e][_0x5c4a('0xf')]||_0x447e6e['value'][_0x1f2e6e][_0x5c4a('0xa')]||'';_0x1a2df2+='\x20<';_0x1a2df2+=_0x447e6e[_0x5c4a('0x9')][_0x1f2e6e]['address']?_0x447e6e[_0x5c4a('0x9')][_0x1f2e6e][_0x5c4a('0xa')]:_0x5c4a('0xb')+random[_0x5c4a('0xc')](0x6)+_0x5c4a('0xd');_0x1a2df2+='>';}}return _0x1a2df2;}function parseEmail(_0x7c7701,_0x444f5f,_0x35390a){if(_0x444f5f['html']){var _0x561f6f=/)<[^<]*)*<\/script>/gi;while(_0x561f6f[_0x5c4a('0x17')](_0x444f5f[_0x5c4a('0x18')])){_0x444f5f[_0x5c4a('0x18')]=_0x444f5f[_0x5c4a('0x18')][_0x5c4a('0x19')](_0x561f6f,'');}if(_0x444f5f[_0x5c4a('0x18')][_0x5c4a('0x1a')](_0x5c4a('0x1b'))){var _0x575bd7=[];_0x444f5f[_0x5c4a('0x1c')][_0x5c4a('0x1d')](_0x27ec81=>{_0x575bd7[_0x5c4a('0x1e')](_0x27ec81[_0x5c4a('0x1f')]);});var _0x4a4722=/]+>/g;var _0x193bb1=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0xea9080=_0x444f5f[_0x5c4a('0x18')][_0x5c4a('0x19')](_0x193bb1,_0x5c4a('0x20'));var _0xc886d2=_0xea9080[_0x5c4a('0x19')](_0x4a4722,_0x5c4a('0x21'));for(let _0x534913=0x0;_0x534913<_0x575bd7[_0x5c4a('0x15')];_0x534913++){var _0x4e6f9b=_0xc886d2[_0x5c4a('0x19')](_0x5c4a('0x21'),_0x5c4a('0x22')+_0x575bd7[_0x534913]+_0x5c4a('0x23'));_0xc886d2=_0x4e6f9b;}_0x444f5f[_0x5c4a('0x18')]=_0xc886d2;}_0x35390a[_0x5c4a('0x24')]=_0x444f5f[_0x5c4a('0x18')];}else{_0x35390a[_0x5c4a('0x24')]=_0x444f5f[_0x5c4a('0x25')];}if(_0x35390a[_0x5c4a('0x24')]){_0x35390a[_0x5c4a('0x24')]=_0x35390a['body']['replace'](/0x0){var _0x5c5ddc=['Auto-Submitted:\x20auto-replied','X-Auto-Response-Suppress:\x20All','Precedence:\x20auto_reply'];for(var _0x22ace9=0x0;_0x22ace9<_0x444f5f[_0x5c4a('0x30')][_0x5c4a('0x15')];_0x22ace9++){var _0x122aac=_[_0x5c4a('0x11')](_0x5c5ddc,_0x444f5f[_0x5c4a('0x30')][_0x22ace9]['line']);if(_0x122aac>=0x0){_0x35390a[_0x5c4a('0x31')]=!![];}}}return _0x35390a;}exports[_0x5c4a('0x32')]=function(_0x482cbd,_0x4028e3,_0x2d789a){var _0x1020de={'from':getAddress(_0x4028e3[_0x5c4a('0x33')]),'firstName':getFirstName(_0x4028e3[_0x5c4a('0x33')]),'lastName':getLastName(_0x4028e3[_0x5c4a('0x33')]),'mapKey':_0x5c4a('0x7'),'message':{'from':getMails(_0x482cbd[_0x5c4a('0x7')],_0x4028e3[_0x5c4a('0x33')]),'to':_0x482cbd['email'],'cc':'','subject':_0x4028e3['subject']||'','messageId':_0x4028e3['messageId'],'inReplyTo':_0x4028e3[_0x5c4a('0x34')],'sentAt':moment(_0x4028e3[_0x5c4a('0x35')])[_0x5c4a('0x2c')](_0x5c4a('0x36')),'attach':![],'attachments':[]}};if(!_0x4028e3['html']&&!_0x4028e3[_0x5c4a('0x25')]){var _0x49d54d=_[_0x5c4a('0x37')](_0x4028e3[_0x5c4a('0x1c')],{'contentType':'application/ms-tnef'});if(_0x49d54d[_0x5c4a('0x15')]){logger[_0x5c4a('0x38')](util[_0x5c4a('0x2c')](_0x5c4a('0x39'),_0x4028e3[_0x5c4a('0x3a')]));tnef[_0x5c4a('0x3b')](_[_0x5c4a('0x3c')](_0x49d54d)[_0x5c4a('0x3d')],function(_0xf6bcc0,_0xa5ed92){if(_0xa5ed92){_0x4028e3['html']=_0xa5ed92['BodyHTML']||_0x5c4a('0x3e');if(_0xa5ed92[_0x5c4a('0x3f')]){for(var _0xfaef8d=0x0;_0xfaef8d<_0xa5ed92[_0x5c4a('0x3f')][_0x5c4a('0x15')];_0xfaef8d++){var _0x264f96=_0xa5ed92[_0x5c4a('0x3f')][_0xfaef8d];_0x1020de[_0x5c4a('0x27')][_0x5c4a('0x1c')][_0x5c4a('0x1e')]({'filename':_0x264f96[_0x5c4a('0x40')],'content':Buffer[_0x5c4a('0x33')](_0x264f96[_0x5c4a('0x41')])});}}}_0x2d789a(parseEmail(_0x482cbd,_0x4028e3,_0x1020de));});}else{_0x4028e3[_0x5c4a('0x18')]=_0x5c4a('0x3e');_0x2d789a(parseEmail(_0x482cbd,_0x4028e3,_0x1020de));}}else{_0x2d789a(parseEmail(_0x482cbd,_0x4028e3,_0x1020de));}};exports[_0x5c4a('0x42')]=function(_0x376fbc,_0xb2c041){var _0x397f22=[_0x5c4a('0x43')+(_0xb2c041||''),_0x5c4a('0x44')+_0x376fbc,'',''];return Buffer[_0x5c4a('0x33')](_0x397f22[_0x5c4a('0x13')](''),_0x5c4a('0x45'))[_0x5c4a('0x46')]('base64');}; \ No newline at end of file +var _0x3d97=['line','isAutoreply','from','subject','messageId','date','format','textAsHtml','filter','application/ms-tnef','info','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','BodyHTML','

Empty\x20message

','Attachments','generateXOAuth2Token','user=','auth=Bearer\x20','utf-8','toString','base64','lodash','randomstring','node-tnef','../../../config/logger','email','../../../config/environment','address','anonymous','@xcally.com','head','value','name','substring','length','slice','join','split','isEmpty','generate','html','test','\x20[Attachment:\x20','\x20]','body','0x1?_0x5e99b3[_0x73d9('0xe')](0x0,-0x1)[_0x73d9('0xf')]('\x20'):_0x11ea02[_0x73d9('0xb')];}return'Anonymous';}function getLastName(_0x4bc655){var _0x2c79aa=_['head'](_0x4bc655['value']);if(_0x2c79aa&&_0x2c79aa[_0x73d9('0xb')]){var _0x2ccef2=_0x2c79aa[_0x73d9('0xb')][_0x73d9('0x10')](/\s+/);return _0x2ccef2[_0x73d9('0xd')]>0x1?_0x2ccef2['pop']():'';}return'';}function getMails(_0x5dcf54,_0x57fa61){var _0x15c02f='';for(var _0xaa7d08=0x0;_0xaa7d08<_0x57fa61['value'][_0x73d9('0xd')];_0xaa7d08+=0x1){if(_0x57fa61[_0x73d9('0xa')][_0xaa7d08]['address']!==_0x5dcf54){if(!_[_0x73d9('0x11')](_0x15c02f)){_0x15c02f+=',';}_0x15c02f+=_0x57fa61[_0x73d9('0xa')][_0xaa7d08]['name']||_0x57fa61['value'][_0xaa7d08]['address']||'';_0x15c02f+='\x20<';_0x15c02f+=_0x57fa61[_0x73d9('0xa')][_0xaa7d08][_0x73d9('0x6')]?_0x57fa61['value'][_0xaa7d08][_0x73d9('0x6')]:_0x73d9('0x7')+random[_0x73d9('0x12')](0x6)+'@xcally.com';_0x15c02f+='>';}}return _0x15c02f;}function parseEmail(_0xd8347e,_0x9a399a,_0x8826be){if(_0x9a399a[_0x73d9('0x13')]){var _0x1872b7=/)<[^<]*)*<\/script>/gi;while(_0x1872b7[_0x73d9('0x14')](_0x9a399a[_0x73d9('0x13')])){_0x9a399a[_0x73d9('0x13')]=_0x9a399a[_0x73d9('0x13')]['replace'](_0x1872b7,'');}if(_0x9a399a[_0x73d9('0x13')]['includes'](_0x73d9('0x15'))){var _0x1a4421=[];_0x9a399a[_0x73d9('0x16')][_0x73d9('0x17')](_0x12da8f=>{_0x1a4421['push'](_0x12da8f[_0x73d9('0x18')]);});var _0xf8291e=/]+>/g;var _0x197ff5=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x338003=_0x9a399a[_0x73d9('0x13')][_0x73d9('0x19')](_0x197ff5,_0x73d9('0x1a'));var _0x5bcaa6=_0x338003['replace'](_0xf8291e,_0x73d9('0x1b'));for(let _0x566552=0x0;_0x566552<_0x1a4421['length'];_0x566552++){var _0xb08b3f=_0x5bcaa6[_0x73d9('0x19')](_0x73d9('0x1b'),_0x73d9('0x1c')+_0x1a4421[_0x566552]+_0x73d9('0x1d'));_0x5bcaa6=_0xb08b3f;}_0x9a399a[_0x73d9('0x13')]=_0x5bcaa6;}_0x8826be['body']=_0x9a399a[_0x73d9('0x13')];}else{_0x8826be['body']=_0x9a399a['textAsHtml'];}if(_0x8826be[_0x73d9('0x1e')]){_0x8826be[_0x73d9('0x1e')]=_0x8826be[_0x73d9('0x1e')][_0x73d9('0x19')](/0x0){var _0x4daf3c=['Auto-Submitted:\x20auto-replied',_0x73d9('0x2f'),'Precedence:\x20auto_reply'];for(var _0x5a4a46=0x0;_0x5a4a46<_0x9a399a['headerLines'][_0x73d9('0xd')];_0x5a4a46++){var _0x4c0cc9=_[_0x73d9('0x30')](_0x4daf3c,_0x9a399a[_0x73d9('0x2e')][_0x5a4a46][_0x73d9('0x31')]);if(_0x4c0cc9>=0x0){_0x8826be[_0x73d9('0x32')]=!![];}}}return _0x8826be;}exports['parser']=function(_0x24655b,_0x3db1d1,_0x2365c8){var _0x5a2b87={'from':getAddress(_0x3db1d1[_0x73d9('0x33')]),'firstName':getFirstName(_0x3db1d1['from']),'lastName':getLastName(_0x3db1d1['from']),'mapKey':_0x73d9('0x4'),'message':{'from':getMails(_0x24655b[_0x73d9('0x4')],_0x3db1d1[_0x73d9('0x33')]),'to':_0x24655b['email'],'cc':'','subject':_0x3db1d1[_0x73d9('0x34')]||'','messageId':_0x3db1d1[_0x73d9('0x35')],'inReplyTo':_0x3db1d1['inReplyTo'],'sentAt':moment(_0x3db1d1[_0x73d9('0x36')])[_0x73d9('0x37')]('YYYY-MM-DD\x20HH:mm:ss'),'attach':![],'attachments':[]}};if(!_0x3db1d1[_0x73d9('0x13')]&&!_0x3db1d1[_0x73d9('0x38')]){var _0x20dcce=_[_0x73d9('0x39')](_0x3db1d1[_0x73d9('0x16')],{'contentType':_0x73d9('0x3a')});if(_0x20dcce[_0x73d9('0xd')]){logger[_0x73d9('0x3b')](util['format'](_0x73d9('0x3c'),_0x3db1d1['messageId']));tnef['parseBuffer'](_['first'](_0x20dcce)[_0x73d9('0x2b')],function(_0x1a8526,_0x5431ec){if(_0x5431ec){_0x3db1d1[_0x73d9('0x13')]=_0x5431ec[_0x73d9('0x3d')]||_0x73d9('0x3e');if(_0x5431ec[_0x73d9('0x3f')]){for(var _0x4f12fa=0x0;_0x4f12fa<_0x5431ec[_0x73d9('0x3f')]['length'];_0x4f12fa++){var _0x2547a1=_0x5431ec[_0x73d9('0x3f')][_0x4f12fa];_0x5a2b87['message']['attachments'][_0x73d9('0x2c')]({'filename':_0x2547a1['Title'],'content':Buffer['from'](_0x2547a1['Data'])});}}}_0x2365c8(parseEmail(_0x24655b,_0x3db1d1,_0x5a2b87));});}else{_0x3db1d1[_0x73d9('0x13')]=_0x73d9('0x3e');_0x2365c8(parseEmail(_0x24655b,_0x3db1d1,_0x5a2b87));}}else{_0x2365c8(parseEmail(_0x24655b,_0x3db1d1,_0x5a2b87));}};exports[_0x73d9('0x40')]=function(_0x25ba24,_0x3a186a){var _0x26dbd3=[_0x73d9('0x41')+(_0x3a186a||''),_0x73d9('0x42')+_0x25ba24,'',''];return Buffer[_0x73d9('0x33')](_0x26dbd3[_0x73d9('0xf')](''),_0x73d9('0x43'))[_0x73d9('0x44')](_0x73d9('0x45'));}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index 61e70f9..80d6efc 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 _0x3a35=['lodash','name','Service','key','active','Imap','Smtp','exports'];(function(_0x417e0a,_0x446db8){var _0x223dab=function(_0x56978c){while(--_0x56978c){_0x417e0a['push'](_0x417e0a['shift']());}};_0x223dab(++_0x446db8);}(_0x3a35,0x108));var _0x53a3=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x3a35[_0x2d7f0e];return _0x110b07;};'use strict';var _=require(_0x53a3('0x0'));function MailAccount(_0x3ac964){this['id']=_0x3ac964['id']||0x0;this[_0x53a3('0x1')]=_0x3ac964[_0x53a3('0x1')]||_0x53a3('0x2');this[_0x53a3('0x3')]=_0x3ac964['key']||'SERV';this[_0x53a3('0x4')]=_0x3ac964[_0x53a3('0x4')]||![];this['Imap']=_0x3ac964[_0x53a3('0x5')]||[];this[_0x53a3('0x6')]=_0x3ac964[_0x53a3('0x6')]||[];}module[_0x53a3('0x7')]=MailAccount; \ No newline at end of file +var _0xb4d1=['Imap','Smtp','exports','name','key','active'];(function(_0x376d7e,_0x48cf7d){var _0x58c19d=function(_0x30c419){while(--_0x30c419){_0x376d7e['push'](_0x376d7e['shift']());}};_0x58c19d(++_0x48cf7d);}(_0xb4d1,0x15f));var _0x1b4d=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0xb4d1[_0x110c3d];return _0x226d67;};'use strict';var _=require('lodash');function MailAccount(_0x3bc03f){this['id']=_0x3bc03f['id']||0x0;this[_0x1b4d('0x0')]=_0x3bc03f['name']||'Service';this[_0x1b4d('0x1')]=_0x3bc03f[_0x1b4d('0x1')]||'SERV';this[_0x1b4d('0x2')]=_0x3bc03f[_0x1b4d('0x2')]||![];this[_0x1b4d('0x3')]=_0x3bc03f[_0x1b4d('0x3')]||[];this['Smtp']=_0x3bc03f[_0x1b4d('0x4')]||[];}module[_0x1b4d('0x5')]=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index 494e860..a54ae0c 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 _0x26d0=['isUndefined','mailAccounts','merge','exports','lodash','../model/mailAccount','mapKeys','prototype','mergeFromDatabase','hasOwnProperty','length'];(function(_0x2a12f6,_0x3e671a){var _0x20e702=function(_0x68a276){while(--_0x68a276){_0x2a12f6['push'](_0x2a12f6['shift']());}};_0x20e702(++_0x3e671a);}(_0x26d0,0x67));var _0x026d=function(_0x1067cf,_0x19f1fd){_0x1067cf=_0x1067cf-0x0;var _0x1324aa=_0x26d0[_0x1067cf];return _0x1324aa;};'use strict';var _=require(_0x026d('0x0'));var MailAccount=require(_0x026d('0x1'));var Realtime=function(){this['mailAccounts']={};};function freeIsNotKey(_0x4dfa01,_0x4a3831,_0x4e2a17){var _0x4c4630=_[_0x026d('0x2')](_0x4dfa01,function(_0x8e4ee1,_0x377256){return _0x8e4ee1[_0x4e2a17];});for(var _0x593035 in _0x4a3831){if(_0x4a3831['hasOwnProperty'](_0x593035)){if(!_0x4c4630[_0x593035]){delete _0x4a3831[_0x593035];}}}}Realtime[_0x026d('0x3')][_0x026d('0x4')]=function(_0x5906d0,_0x381a3b){for(var _0x4a465b in _0x381a3b){if(_0x5906d0[_0x026d('0x5')](_0x4a465b)){_0x5906d0[_0x4a465b]=_0x381a3b[_0x4a465b];}}};Realtime[_0x026d('0x3')]['initMailAccounts']=function(){var _0x1e427c=this;return function(_0x229459){if(_0x229459){freeIsNotKey(_0x229459,_0x1e427c['mailAccounts'],'id');for(var _0x199f7f=0x0,_0x95dfa7={},_0x291337={};_0x199f7f<_0x229459[_0x026d('0x6')];_0x199f7f+=0x1){_0x95dfa7=_0x229459[_0x199f7f];if(_[_0x026d('0x7')](_0x1e427c[_0x026d('0x8')][_0x95dfa7['id']])){_0x1e427c['mailAccounts'][_0x95dfa7['id']]=new MailAccount(_0x95dfa7);}else{_[_0x026d('0x9')](_0x1e427c[_0x026d('0x8')][_0x95dfa7['id']],_0x95dfa7);}}}return _0x1e427c[_0x026d('0x8')];};};module[_0x026d('0xa')]=Realtime; \ No newline at end of file +var _0x7147=['prototype','initMailAccounts','isUndefined','merge','exports','../model/mailAccount','mailAccounts','mapKeys','hasOwnProperty'];(function(_0x9c62a3,_0x3e878f){var _0x390f67=function(_0x1ac987){while(--_0x1ac987){_0x9c62a3['push'](_0x9c62a3['shift']());}};_0x390f67(++_0x3e878f);}(_0x7147,0x1e2));var _0x7714=function(_0x5cbace,_0x33943c){_0x5cbace=_0x5cbace-0x0;var _0x6de5b8=_0x7147[_0x5cbace];return _0x6de5b8;};'use strict';var _=require('lodash');var MailAccount=require(_0x7714('0x0'));var Realtime=function(){this[_0x7714('0x1')]={};};function freeIsNotKey(_0x456715,_0xddc79c,_0x24f4e7){var _0x397644=_[_0x7714('0x2')](_0x456715,function(_0x389257,_0x356b4e){return _0x389257[_0x24f4e7];});for(var _0x12303a in _0xddc79c){if(_0xddc79c[_0x7714('0x3')](_0x12303a)){if(!_0x397644[_0x12303a]){delete _0xddc79c[_0x12303a];}}}}Realtime[_0x7714('0x4')]['mergeFromDatabase']=function(_0x40dcaa,_0x3b3044){for(var _0x1bab61 in _0x3b3044){if(_0x40dcaa[_0x7714('0x3')](_0x1bab61)){_0x40dcaa[_0x1bab61]=_0x3b3044[_0x1bab61];}}};Realtime[_0x7714('0x4')][_0x7714('0x5')]=function(){var _0x161eeb=this;return function(_0x123404){if(_0x123404){freeIsNotKey(_0x123404,_0x161eeb[_0x7714('0x1')],'id');for(var _0x20fe9f=0x0,_0x364085={},_0x43b787={};_0x20fe9f<_0x123404['length'];_0x20fe9f+=0x1){_0x364085=_0x123404[_0x20fe9f];if(_[_0x7714('0x6')](_0x161eeb[_0x7714('0x1')][_0x364085['id']])){_0x161eeb[_0x7714('0x1')][_0x364085['id']]=new MailAccount(_0x364085);}else{_[_0x7714('0x7')](_0x161eeb['mailAccounts'][_0x364085['id']],_0x364085);}}}return _0x161eeb[_0x7714('0x1')];};};module[_0x7714('0x8')]=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index 45006ab..fedc589 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 _0x5fed=['GetMailAccount','name','provider','service','active','key','TemplateId','MailServerIn','Imap','type','data5','MailServerOut','Smtp','CloudProvider','getMailAccount','notify','NotifyMailAccount','../client','getMailAccounts','Request'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x5fed,0xed));var _0xd5fe=function(_0x2f4311,_0xd2d511){_0x2f4311=_0x2f4311-0x0;var _0x309ccb=_0x5fed[_0x2f4311];return _0x309ccb;};'use strict';var client=require(_0xd5fe('0x0'));exports[_0xd5fe('0x1')]=function(){return function(){return client[_0xd5fe('0x2')](_0xd5fe('0x3'),{'options':{'attributes':['id',_0xd5fe('0x4'),_0xd5fe('0x5'),_0xd5fe('0x6'),'email',_0xd5fe('0x7'),_0xd5fe('0x8'),'ListId',_0xd5fe('0x9')],'raw':![],'include':[{'model':_0xd5fe('0xa'),'as':_0xd5fe('0xb'),'include':[{'model':'CloudProvider','attributes':['id','name','service',_0xd5fe('0xc'),_0xd5fe('0xd')],'as':'CloudProvider'}]},{'model':_0xd5fe('0xe'),'as':_0xd5fe('0xf'),'include':[{'model':_0xd5fe('0x10'),'attributes':['id','name',_0xd5fe('0x6'),_0xd5fe('0xc'),_0xd5fe('0xd')],'as':_0xd5fe('0x10')}]}]},'log':_0xd5fe('0x11')});};};exports[_0xd5fe('0x12')]=function(_0x2d9d14,_0xd326f4){return client['Request']('NotifyMailAccount',{'account':{'id':_0x2d9d14},'body':_0xd326f4,'log':_0xd5fe('0x13')});}; \ No newline at end of file +var _0x2b59=['name','provider','service','active','TemplateId','MailServerIn','Imap','CloudProvider','data5','MailServerOut','type','getMailAccount','notify','Request','../client','getMailAccounts'];(function(_0x5d8973,_0x2d662c){var _0x2c5dea=function(_0x52386a){while(--_0x52386a){_0x5d8973['push'](_0x5d8973['shift']());}};_0x2c5dea(++_0x2d662c);}(_0x2b59,0x1de));var _0x92b5=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x2b59[_0xfae23b];return _0x200640;};'use strict';var client=require(_0x92b5('0x0'));exports[_0x92b5('0x1')]=function(){return function(){return client['Request']('GetMailAccount',{'options':{'attributes':['id',_0x92b5('0x2'),_0x92b5('0x3'),_0x92b5('0x4'),'email',_0x92b5('0x5'),'key','ListId',_0x92b5('0x6')],'raw':![],'include':[{'model':_0x92b5('0x7'),'as':_0x92b5('0x8'),'include':[{'model':_0x92b5('0x9'),'attributes':['id',_0x92b5('0x2'),_0x92b5('0x4'),'type',_0x92b5('0xa')],'as':_0x92b5('0x9')}]},{'model':_0x92b5('0xb'),'as':'Smtp','include':[{'model':_0x92b5('0x9'),'attributes':['id','name',_0x92b5('0x4'),_0x92b5('0xc'),'data5'],'as':_0x92b5('0x9')}]}]},'log':_0x92b5('0xd')});};};exports[_0x92b5('0xe')]=function(_0x132943,_0x42a9ab){return client[_0x92b5('0xf')]('NotifyMailAccount',{'account':{'id':_0x132943},'body':_0x42a9ab,'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 4b3a48c..e0239ea 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 _0x54fc=['../client','getSettings','Request','loginMailFrequency','GetSettings'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x54fc,0x6e));var _0xc54f=function(_0x4d02f0,_0x11bd74){_0x4d02f0=_0x4d02f0-0x0;var _0x6eb031=_0x54fc[_0x4d02f0];return _0x6eb031;};'use strict';var client=require(_0xc54f('0x0'));exports[_0xc54f('0x1')]=function(){return client[_0xc54f('0x2')]('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xc54f('0x3')]},'log':_0xc54f('0x4')});}; \ No newline at end of file +var _0xda51=['ShowSetting','GetSettings','../client','getSettings','Request'];(function(_0x1988b4,_0xae660f){var _0x34028b=function(_0x249e79){while(--_0x249e79){_0x1988b4['push'](_0x1988b4['shift']());}};_0x34028b(++_0xae660f);}(_0xda51,0x14c));var _0x1da5=function(_0x24a88e,_0x22a0b8){_0x24a88e=_0x24a88e-0x0;var _0x232cbb=_0xda51[_0x24a88e];return _0x232cbb;};'use strict';var client=require(_0x1da5('0x0'));exports[_0x1da5('0x1')]=function(){return client[_0x1da5('0x2')](_0x1da5('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':['loginMailFrequency']},'log':_0x1da5('0x4')});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index 2a45fb0..0064fa7 100644 --- a/server/services/email/server/index.js +++ b/server/services/email/server/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xa9e0,0x123));var _0x0a9e=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0xa9e0[_0x40ac5e];return _0x2839d6;};'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(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xa9e0,0x123));var _0x0a9e=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0xa9e0[_0x29b609];return _0x54c952;};'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 0a9ef43..d723403 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 _0x4f75=['../../config/environment','timeout','port','socket.io','websocket','polling','redis','localhost','adapter','socket.io-redis','../../config/triggers','default','../../config/socketio','../../config/express','../../routes','once','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','lodash','http','express','sticky-session','ioredis'];(function(_0x1df8d9,_0xf253fd){var _0x142c25=function(_0x5ce490){while(--_0x5ce490){_0x1df8d9['push'](_0x1df8d9['shift']());}};_0x142c25(++_0xf253fd);}(_0x4f75,0xc3));var _0x54f7=function(_0x44be01,_0x3ffcbc){_0x44be01=_0x44be01-0x0;var _0x5c4cce=_0x4f75[_0x44be01];return _0x5c4cce;};'use strict';var _=require(_0x54f7('0x0'));var http=require(_0x54f7('0x1'));var express=require(_0x54f7('0x2'));var sticky=require(_0x54f7('0x3'));var Redis=require(_0x54f7('0x4'));var config=require(_0x54f7('0x5'));var app=express();var server=http['createServer'](app);server[_0x54f7('0x6')]=0xdbba0;if(sticky['listen'](server,config[_0x54f7('0x7')])){var socketio=require(_0x54f7('0x8'))(server,{'transports':[_0x54f7('0x9'),_0x54f7('0xa')]});config[_0x54f7('0xb')]=_['defaults'](config[_0x54f7('0xb')],{'host':_0x54f7('0xc'),'port':0x18eb});socketio[_0x54f7('0xd')](require(_0x54f7('0xe'))({'pubClient':new Redis(config[_0x54f7('0xb')]),'subClient':new Redis(config[_0x54f7('0xb')])}));require(_0x54f7('0xf'))[_0x54f7('0x10')]();require(_0x54f7('0x11'))[_0x54f7('0x10')](socketio);require(_0x54f7('0x12'))['default'](app);require(_0x54f7('0x13'))['default'](app);}else{server[_0x54f7('0x14')](_0x54f7('0x15'),function(){console[_0x54f7('0x16')](_0x54f7('0x17'),config[_0x54f7('0x7')]);});}exports=module[_0x54f7('0x18')]=app; \ No newline at end of file +var _0x1a2f=['createServer','timeout','listen','socket.io','websocket','defaults','redis','adapter','socket.io-redis','../../config/triggers','default','../../config/express','once','log','Express\x20server\x20listening\x20on\x20port\x20%d!','port','lodash','http','sticky-session','ioredis','../../config/environment'];(function(_0xa4b901,_0x2ffb10){var _0x129835=function(_0x4c0b32){while(--_0x4c0b32){_0xa4b901['push'](_0xa4b901['shift']());}};_0x129835(++_0x2ffb10);}(_0x1a2f,0x175));var _0xf1a2=function(_0x3f10a4,_0xacdaeb){_0x3f10a4=_0x3f10a4-0x0;var _0x372f5c=_0x1a2f[_0x3f10a4];return _0x372f5c;};'use strict';var _=require(_0xf1a2('0x0'));var http=require(_0xf1a2('0x1'));var express=require('express');var sticky=require(_0xf1a2('0x2'));var Redis=require(_0xf1a2('0x3'));var config=require(_0xf1a2('0x4'));var app=express();var server=http[_0xf1a2('0x5')](app);server[_0xf1a2('0x6')]=0xdbba0;if(sticky[_0xf1a2('0x7')](server,config['port'])){var socketio=require(_0xf1a2('0x8'))(server,{'transports':[_0xf1a2('0x9'),'polling']});config['redis']=_[_0xf1a2('0xa')](config[_0xf1a2('0xb')],{'host':'localhost','port':0x18eb});socketio[_0xf1a2('0xc')](require(_0xf1a2('0xd'))({'pubClient':new Redis(config[_0xf1a2('0xb')]),'subClient':new Redis(config[_0xf1a2('0xb')])}));require(_0xf1a2('0xe'))[_0xf1a2('0xf')]();require('../../config/socketio')['default'](socketio);require(_0xf1a2('0x10'))[_0xf1a2('0xf')](app);require('../../routes')[_0xf1a2('0xf')](app);}else{server[_0xf1a2('0x11')]('listening',function(){console[_0xf1a2('0x12')](_0xf1a2('0x13'),config[_0xf1a2('0x14')]);});}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 fa1aa4a..42e12c2 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 _0x8649=['catch','exports','routing','client','http','Request','request','then','debug','rpc','error','message','result'];(function(_0x2657c1,_0x50043d){var _0x2a94c3=function(_0x6915e2){while(--_0x6915e2){_0x2657c1['push'](_0x2657c1['shift']());}};_0x2a94c3(++_0x50043d);}(_0x8649,0xab));var _0x9864=function(_0x2c64f9,_0x35ca72){_0x2c64f9=_0x2c64f9-0x0;var _0x53d89f=_0x8649[_0x2c64f9];return _0x53d89f;};'use strict';var jayson=require('jayson/promise');var BPromise=require('bluebird');var logger=require('../../config/logger')(_0x9864('0x0'));var client=jayson[_0x9864('0x1')][_0x9864('0x2')]({'port':0x2329});client[_0x9864('0x3')]=function(_0x5455eb,_0x93f41f){return new BPromise(function(_0x47cd10,_0x28c2ab){return client[_0x9864('0x4')](_0x5455eb,_0x93f41f)[_0x9864('0x5')](function(_0x26f08f){logger[_0x9864('0x6')](_0x9864('0x7'),'routing',_0x5455eb,_0x93f41f,_0x26f08f);if(_0x26f08f['error']){logger[_0x9864('0x8')](_0x9864('0x7'),_0x9864('0x0'),_0x5455eb,_0x26f08f[_0x9864('0x8')][_0x9864('0x9')],_0x93f41f);return _0x28c2ab(_0x26f08f[_0x9864('0x8')]['message']);}else{return _0x47cd10(_0x26f08f[_0x9864('0xa')]);}})[_0x9864('0xb')](function(_0x305ce6){logger[_0x9864('0x8')](_0x9864('0x7'),_0x9864('0x0'),_0x5455eb,_0x305ce6,_0x93f41f);return _0x28c2ab(_0x305ce6);});});};module[_0x9864('0xc')]=client; \ No newline at end of file +var _0x9682=['routing','request','then','rpc','error','message','result','catch','exports','jayson/promise','bluebird','../../config/logger'];(function(_0x2948ba,_0x2b378d){var _0x4d8cde=function(_0x3b2983){while(--_0x3b2983){_0x2948ba['push'](_0x2948ba['shift']());}};_0x4d8cde(++_0x2b378d);}(_0x9682,0x14d));var _0x2968=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x9682[_0x3bf83f];return _0x22c4a9;};'use strict';var jayson=require(_0x2968('0x0'));var BPromise=require(_0x2968('0x1'));var logger=require(_0x2968('0x2'))(_0x2968('0x3'));var client=jayson['client']['http']({'port':0x2329});client['Request']=function(_0x4750d7,_0x63b7d3){return new BPromise(function(_0x345821,_0x6c3220){return client[_0x2968('0x4')](_0x4750d7,_0x63b7d3)[_0x2968('0x5')](function(_0x579770){logger['debug'](_0x2968('0x6'),_0x2968('0x3'),_0x4750d7,_0x63b7d3,_0x579770);if(_0x579770['error']){logger[_0x2968('0x7')](_0x2968('0x6'),_0x2968('0x3'),_0x4750d7,_0x579770[_0x2968('0x7')]['message'],_0x63b7d3);return _0x6c3220(_0x579770['error'][_0x2968('0x8')]);}else{return _0x345821(_0x579770[_0x2968('0x9')]);}})[_0x2968('0xa')](function(_0x375bb5){logger[_0x2968('0x7')]('rpc',_0x2968('0x3'),_0x4750d7,_0x375bb5,_0x63b7d3);return _0x6c3220(_0x375bb5);});});};module[_0x2968('0xb')]=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index 16cd10c..d8234f8 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 _0xec5b=['getFaxQueues','initFaxQueues','getWhatsappQueues','initWhatsappQueues','listen','catch','log','bluebird','./realtime','./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve','then','getAgents','getIntervals','initIntervals','getOpenchannelQueues','initOpenchannelQueues','initChatQueues','getSmsQueues','initSmsQueues','initMailQueues'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xec5b,0x1c1));var _0xbec5=function(_0x861e31,_0x52a4b9){_0x861e31=_0x861e31-0x0;var _0x194bdf=_0xec5b[_0x861e31];return _0x194bdf;};'use strict';var BPromise=require(_0xbec5('0x0'));var server=require('./server');var Realtime=require(_0xbec5('0x1'));var user=require(_0xbec5('0x2'));var interval=require(_0xbec5('0x3'));var openchannelQueue=require(_0xbec5('0x4'));var chatQueue=require('./rpc/chatQueue');var smsQueue=require('./rpc/smsQueue');var mailQueue=require(_0xbec5('0x5'));var faxQueue=require(_0xbec5('0x6'));var whatsappQueue=require(_0xbec5('0x7'));var realtime=new Realtime();function initRealtime(){return BPromise[_0xbec5('0x8')]()[_0xbec5('0x9')](user[_0xbec5('0xa')]())['then'](realtime['initAgents']())[_0xbec5('0x9')](interval[_0xbec5('0xb')]())[_0xbec5('0x9')](realtime[_0xbec5('0xc')]())[_0xbec5('0x9')](openchannelQueue[_0xbec5('0xd')]())[_0xbec5('0x9')](realtime[_0xbec5('0xe')]())[_0xbec5('0x9')](chatQueue['getChatQueues']())['then'](realtime[_0xbec5('0xf')]())[_0xbec5('0x9')](smsQueue[_0xbec5('0x10')]())[_0xbec5('0x9')](realtime[_0xbec5('0x11')]())[_0xbec5('0x9')](mailQueue['getMailQueues']())['then'](realtime[_0xbec5('0x12')]())['then'](faxQueue[_0xbec5('0x13')]())['then'](realtime[_0xbec5('0x14')]())['then'](whatsappQueue[_0xbec5('0x15')]())['then'](realtime[_0xbec5('0x16')]())[_0xbec5('0x9')](function(){return realtime;});}function main(){return server[_0xbec5('0x17')](realtime)[_0xbec5('0x9')](function(_0x54e251){return initRealtime();})[_0xbec5('0x9')](function(_0x3b6e77){return setInterval(initRealtime,0x1388);})[_0xbec5('0x18')](function(_0x50bae8){console[_0xbec5('0x19')](_0x50bae8);});}main(); \ No newline at end of file +var _0x6b3e=['resolve','then','getAgents','initAgents','getIntervals','initIntervals','getOpenchannelQueues','getChatQueues','initChatQueues','getSmsQueues','initFaxQueues','getWhatsappQueues','initWhatsappQueues','listen','catch','./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/mailQueue','./rpc/whatsappQueue'];(function(_0x31ee6c,_0x3c4217){var _0x8fae3a=function(_0x569129){while(--_0x569129){_0x31ee6c['push'](_0x31ee6c['shift']());}};_0x8fae3a(++_0x3c4217);}(_0x6b3e,0xc3));var _0xe6b3=function(_0x4aac0b,_0x302d1d){_0x4aac0b=_0x4aac0b-0x0;var _0x20cc8f=_0x6b3e[_0x4aac0b];return _0x20cc8f;};'use strict';var BPromise=require('bluebird');var server=require('./server');var Realtime=require('./realtime');var user=require('./rpc/user');var interval=require(_0xe6b3('0x0'));var openchannelQueue=require(_0xe6b3('0x1'));var chatQueue=require(_0xe6b3('0x2'));var smsQueue=require('./rpc/smsQueue');var mailQueue=require(_0xe6b3('0x3'));var faxQueue=require('./rpc/faxQueue');var whatsappQueue=require(_0xe6b3('0x4'));var realtime=new Realtime();function initRealtime(){return BPromise[_0xe6b3('0x5')]()[_0xe6b3('0x6')](user[_0xe6b3('0x7')]())['then'](realtime[_0xe6b3('0x8')]())[_0xe6b3('0x6')](interval[_0xe6b3('0x9')]())[_0xe6b3('0x6')](realtime[_0xe6b3('0xa')]())[_0xe6b3('0x6')](openchannelQueue[_0xe6b3('0xb')]())[_0xe6b3('0x6')](realtime['initOpenchannelQueues']())['then'](chatQueue[_0xe6b3('0xc')]())[_0xe6b3('0x6')](realtime[_0xe6b3('0xd')]())[_0xe6b3('0x6')](smsQueue[_0xe6b3('0xe')]())['then'](realtime['initSmsQueues']())[_0xe6b3('0x6')](mailQueue['getMailQueues']())['then'](realtime['initMailQueues']())[_0xe6b3('0x6')](faxQueue['getFaxQueues']())[_0xe6b3('0x6')](realtime[_0xe6b3('0xf')]())['then'](whatsappQueue[_0xe6b3('0x10')]())[_0xe6b3('0x6')](realtime[_0xe6b3('0x11')]())[_0xe6b3('0x6')](function(){return realtime;});}function main(){return server[_0xe6b3('0x12')](realtime)[_0xe6b3('0x6')](function(_0x242348){return initRealtime();})[_0xe6b3('0x6')](function(_0x4ced7b){return setInterval(initRealtime,0x1388);})[_0xe6b3('0x13')](function(_0x338ef5){console['log'](_0x338ef5);});}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 062ad70..8a1d6ee 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 _0x1261=['isNil','register','ignoreFactChanges','activeRules','prototype','isArray','rules','concat','isObject','push','sync','filter','orderBy','asc','result','clone','name','nextTick','ruleRef','isEqual','restart','length','condition','noop','findRules','matches','turn','prioritize','priority','toString','consequence','fromJSON','isString','parse','map','object','exports','util','events','EventEmitter','init'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x1261,0x144));var _0x1126=function(_0x377f50,_0x5589ba){_0x377f50=_0x377f50-0x0;var _0x14a9d2=_0x1261[_0x377f50];return _0x14a9d2;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var EventEmitter=require(_0x1126('0x1'))[_0x1126('0x2')];function RuleEngine(_0x331a2c,_0x39b786){this[_0x1126('0x3')]();if(!_[_0x1126('0x4')](_0x331a2c)){this[_0x1126('0x5')](_0x331a2c);}if(_0x39b786){this[_0x1126('0x6')]=_0x39b786[_0x1126('0x6')];}return this;}util['inherits'](RuleEngine,EventEmitter);RuleEngine['prototype'][_0x1126('0x3')]=function(_0x907180){this['rules']=[];this[_0x1126('0x7')]=[];};RuleEngine[_0x1126('0x8')][_0x1126('0x5')]=function(_0x3abb0b){if(Array[_0x1126('0x9')](_0x3abb0b)){this['rules']=this[_0x1126('0xa')][_0x1126('0xb')](_0x3abb0b);}else if(_0x3abb0b!==null&&_[_0x1126('0xc')](_0x3abb0b)){this['rules'][_0x1126('0xd')](_0x3abb0b);}this['sync']();};RuleEngine['prototype'][_0x1126('0xe')]=function(){this['activeRules']=this[_0x1126('0xa')][_0x1126('0xf')](function(_0xd26a32){if(_[_0x1126('0x4')](_0xd26a32['on'])){_0xd26a32['on']=!![];}if(_0xd26a32['on']===!![]){return _0xd26a32;}});this[_0x1126('0x7')]=_[_0x1126('0x10')](this[_0x1126('0x7')],['p'],[_0x1126('0x11')]);};RuleEngine[_0x1126('0x8')]['execute']=function(_0x5de9a7,_0x1af673){var _0x154e20=![];_0x5de9a7[_0x1126('0x12')]=!![];var _0x4be0c6=_[_0x1126('0x13')](_0x5de9a7);var _0x4794a7=_[_0x1126('0x13')](_0x5de9a7);var _0x42f379=this[_0x1126('0x7')];var _0x4e1c97=[];var _0x245cd7=this[_0x1126('0x6')];(function FnRuleLoop(_0x4a7b49){var _0x4d2b38={'rules':function(){return _0x42f379;},'rule':function(){return _0x42f379[_0x4a7b49];},'when':function(_0x22ae0b){if(_0x22ae0b){var _0x2b2487=_0x42f379[_0x4a7b49]['consequence'];_0x2b2487['ruleRef']=_0x42f379[_0x4a7b49]['id']||_0x42f379[_0x4a7b49][_0x1126('0x14')]||'index_'+_0x4a7b49;process[_0x1126('0x15')](function(){_0x4e1c97[_0x1126('0xd')](_0x2b2487[_0x1126('0x16')]);_0x2b2487['call'](_0x4be0c6,_0x4d2b38);});}else{process[_0x1126('0x15')](function(){_0x4d2b38['next']();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x154e20=!![];return FnRuleLoop(0x0);},'next':function(_0x56efeb){if(!_0x245cd7&&!_[_0x1126('0x17')](_0x4794a7,_0x4be0c6)){_0x4794a7=_[_0x1126('0x13')](_0x4be0c6);process[_0x1126('0x15')](function(){_0x4d2b38[_0x1126('0x18')]();});}else{process['nextTick'](function(){if(_[_0x1126('0x4')](_0x56efeb)){return FnRuleLoop(_0x4a7b49+0x1);}else{return FnRuleLoop(_0x56efeb);}});}}};if(_0x4a7b49<_0x42f379[_0x1126('0x19')]&&_0x154e20===![]){var _0x48a08d=_0x42f379[_0x4a7b49][_0x1126('0x1a')];_0x48a08d['call'](_0x4be0c6,_0x4d2b38);}else{process['nextTick'](function(){_0x4be0c6['matchPath']=_0x4e1c97;return _0x1af673?_0x1af673(_0x4be0c6):_[_0x1126('0x1b')]();});}}(0x0));};RuleEngine[_0x1126('0x8')][_0x1126('0x1c')]=function(_0x34bcf1){if(_[_0x1126('0x4')](_0x34bcf1)){return this[_0x1126('0xa')];}else{var _0xea0971=_[_0x1126('0x1d')](_0x34bcf1);return _['filter'](this[_0x1126('0xa')],_0xea0971);}};RuleEngine[_0x1126('0x8')][_0x1126('0x1e')]=function(_0x5ddf63,_0x541bc9){var _0xeb7d89=_0x5ddf63==='on'||_0x5ddf63==='ON'?!![]:![];var _0x39bf0e=this['findRules'](_0x541bc9);for(var _0x2fb797=0x0,_0x23d2bc=_0x39bf0e['length'];_0x2fb797<_0x23d2bc;_0x2fb797+=0x1){_0x39bf0e[_0x2fb797]['on']=_0xeb7d89;}this[_0x1126('0xe')]();};RuleEngine['prototype'][_0x1126('0x1f')]=function(_0x4bd50b,_0x771bb8){_0x4bd50b=parseInt(_0x4bd50b,0xa);var _0x583ce6=this[_0x1126('0x1c')](_0x771bb8);for(var _0x5f2611=0x0,_0x5252e0=_0x583ce6['length'];_0x5f2611<_0x5252e0;_0x5f2611+=0x1){_0x583ce6[_0x5f2611][_0x1126('0x20')]=_0x4bd50b;}this[_0x1126('0xe')]();};RuleEngine[_0x1126('0x8')]['toJSON']=function(){var _0x2a3055=this[_0x1126('0xa')];if(_0x2a3055 instanceof Array){_0x2a3055=_0x2a3055['map'](function(_0x3dd50e){_0x3dd50e[_0x1126('0x1a')]=_0x3dd50e[_0x1126('0x1a')][_0x1126('0x21')]();_0x3dd50e['consequence']=_0x3dd50e['consequence'][_0x1126('0x21')]();return _0x3dd50e;});}else if(!_[_0x1126('0x4')](_0x2a3055)){_0x2a3055[_0x1126('0x1a')]=_0x2a3055[_0x1126('0x1a')]['toString']();_0x2a3055[_0x1126('0x22')]=_0x2a3055[_0x1126('0x22')][_0x1126('0x21')]();}return _0x2a3055;};RuleEngine[_0x1126('0x8')][_0x1126('0x23')]=function(_0x5df232){this[_0x1126('0x3')]();if(_[_0x1126('0x24')](_0x5df232)){_0x5df232=JSON[_0x1126('0x25')](_0x5df232);}if(_0x5df232 instanceof Array){_0x5df232=_0x5df232[_0x1126('0x26')](function(_0x5c019d){_0x5c019d['condition']=eval('('+_0x5c019d[_0x1126('0x1a')]+')');_0x5c019d[_0x1126('0x22')]=eval('('+_0x5c019d['consequence']+')');return _0x5c019d;});}else if(_0x5df232!==null&&typeof _0x5df232==_0x1126('0x27')){_0x5df232[_0x1126('0x1a')]=eval('('+_0x5df232[_0x1126('0x1a')]+')');_0x5df232['consequence']=eval('('+_0x5df232['consequence']+')');}this[_0x1126('0x5')](_0x5df232);};module[_0x1126('0x28')]=RuleEngine; \ No newline at end of file +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(_0x270876,_0x50516b){var _0x1bc190=function(_0x555995){while(--_0x555995){_0x270876['push'](_0x270876['shift']());}};_0x1bc190(++_0x50516b);}(_0x326f,0xd1));var _0xf326=function(_0x22ad1d,_0x150283){_0x22ad1d=_0x22ad1d-0x0;var _0x5a1ddc=_0x326f[_0x22ad1d];return _0x5a1ddc;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var EventEmitter=require('events')[_0xf326('0x1')];function RuleEngine(_0x330ddb,_0x22aabf){this[_0xf326('0x2')]();if(!_[_0xf326('0x3')](_0x330ddb)){this[_0xf326('0x4')](_0x330ddb);}if(_0x22aabf){this[_0xf326('0x5')]=_0x22aabf[_0xf326('0x5')];}return this;}util[_0xf326('0x6')](RuleEngine,EventEmitter);RuleEngine[_0xf326('0x7')]['init']=function(_0x3c254d){this[_0xf326('0x8')]=[];this[_0xf326('0x9')]=[];};RuleEngine[_0xf326('0x7')]['register']=function(_0x4c206c){if(Array['isArray'](_0x4c206c)){this[_0xf326('0x8')]=this[_0xf326('0x8')][_0xf326('0xa')](_0x4c206c);}else if(_0x4c206c!==null&&_[_0xf326('0xb')](_0x4c206c)){this[_0xf326('0x8')]['push'](_0x4c206c);}this[_0xf326('0xc')]();};RuleEngine['prototype'][_0xf326('0xc')]=function(){this['activeRules']=this[_0xf326('0x8')]['filter'](function(_0x3162f9){if(_[_0xf326('0x3')](_0x3162f9['on'])){_0x3162f9['on']=!![];}if(_0x3162f9['on']===!![]){return _0x3162f9;}});this['activeRules']=_[_0xf326('0xd')](this[_0xf326('0x9')],['p'],[_0xf326('0xe')]);};RuleEngine[_0xf326('0x7')]['execute']=function(_0x45c1b6,_0x5204ee){var _0x54bd1a=![];_0x45c1b6[_0xf326('0xf')]=!![];var _0x11f6d2=_[_0xf326('0x10')](_0x45c1b6);var _0xa63d1a=_[_0xf326('0x10')](_0x45c1b6);var _0x287a2a=this[_0xf326('0x9')];var _0x2cf2ca=[];var _0x5a682a=this[_0xf326('0x5')];(function FnRuleLoop(_0x453100){var _0x18bee3={'rules':function(){return _0x287a2a;},'rule':function(){return _0x287a2a[_0x453100];},'when':function(_0x31ffb9){if(_0x31ffb9){var _0xcef2b5=_0x287a2a[_0x453100][_0xf326('0x11')];_0xcef2b5['ruleRef']=_0x287a2a[_0x453100]['id']||_0x287a2a[_0x453100]['name']||'index_'+_0x453100;process[_0xf326('0x12')](function(){_0x2cf2ca[_0xf326('0x13')](_0xcef2b5['ruleRef']);_0xcef2b5['call'](_0x11f6d2,_0x18bee3);});}else{process[_0xf326('0x12')](function(){_0x18bee3['next']();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x54bd1a=!![];return FnRuleLoop(0x0);},'next':function(_0x5b6d3c){if(!_0x5a682a&&!_[_0xf326('0x14')](_0xa63d1a,_0x11f6d2)){_0xa63d1a=_[_0xf326('0x10')](_0x11f6d2);process['nextTick'](function(){_0x18bee3['restart']();});}else{process[_0xf326('0x12')](function(){if(_[_0xf326('0x3')](_0x5b6d3c)){return FnRuleLoop(_0x453100+0x1);}else{return FnRuleLoop(_0x5b6d3c);}});}}};if(_0x453100<_0x287a2a['length']&&_0x54bd1a===![]){var _0x337ed5=_0x287a2a[_0x453100][_0xf326('0x15')];_0x337ed5[_0xf326('0x16')](_0x11f6d2,_0x18bee3);}else{process[_0xf326('0x12')](function(){_0x11f6d2[_0xf326('0x17')]=_0x2cf2ca;return _0x5204ee?_0x5204ee(_0x11f6d2):_[_0xf326('0x18')]();});}}(0x0));};RuleEngine['prototype']['findRules']=function(_0x4f31f6){if(_[_0xf326('0x3')](_0x4f31f6)){return this[_0xf326('0x8')];}else{var _0x2cd45a=_[_0xf326('0x19')](_0x4f31f6);return _[_0xf326('0x1a')](this[_0xf326('0x8')],_0x2cd45a);}};RuleEngine['prototype'][_0xf326('0x1b')]=function(_0xa3c0b,_0x212d5d){var _0x581531=_0xa3c0b==='on'||_0xa3c0b==='ON'?!![]:![];var _0x1617d2=this['findRules'](_0x212d5d);for(var _0x4a9abf=0x0,_0x6a8e89=_0x1617d2[_0xf326('0x1c')];_0x4a9abf<_0x6a8e89;_0x4a9abf+=0x1){_0x1617d2[_0x4a9abf]['on']=_0x581531;}this[_0xf326('0xc')]();};RuleEngine['prototype'][_0xf326('0x1d')]=function(_0x292500,_0x55790d){_0x292500=parseInt(_0x292500,0xa);var _0x225776=this[_0xf326('0x1e')](_0x55790d);for(var _0xd77aba=0x0,_0x18d110=_0x225776[_0xf326('0x1c')];_0xd77aba<_0x18d110;_0xd77aba+=0x1){_0x225776[_0xd77aba][_0xf326('0x1f')]=_0x292500;}this[_0xf326('0xc')]();};RuleEngine[_0xf326('0x7')][_0xf326('0x20')]=function(){var _0x349a03=this['rules'];if(_0x349a03 instanceof Array){_0x349a03=_0x349a03[_0xf326('0x21')](function(_0x424104){_0x424104[_0xf326('0x15')]=_0x424104['condition'][_0xf326('0x22')]();_0x424104[_0xf326('0x11')]=_0x424104[_0xf326('0x11')]['toString']();return _0x424104;});}else if(!_['isNil'](_0x349a03)){_0x349a03[_0xf326('0x15')]=_0x349a03[_0xf326('0x15')][_0xf326('0x22')]();_0x349a03[_0xf326('0x11')]=_0x349a03[_0xf326('0x11')][_0xf326('0x22')]();}return _0x349a03;};RuleEngine[_0xf326('0x7')][_0xf326('0x23')]=function(_0x580374){this[_0xf326('0x2')]();if(_[_0xf326('0x24')](_0x580374)){_0x580374=JSON['parse'](_0x580374);}if(_0x580374 instanceof Array){_0x580374=_0x580374[_0xf326('0x21')](function(_0x4e5d7c){_0x4e5d7c[_0xf326('0x15')]=eval('('+_0x4e5d7c['condition']+')');_0x4e5d7c['consequence']=eval('('+_0x4e5d7c[_0xf326('0x11')]+')');return _0x4e5d7c;});}else if(_0x580374!==null&&typeof _0x580374=='object'){_0x580374[_0xf326('0x15')]=eval('('+_0x580374['condition']+')');_0x580374[_0xf326('0x11')]=eval('('+_0x580374[_0xf326('0x11')]+')');}this[_0xf326('0x4')](_0x580374);};module['exports']=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index c80cf35..4ac0cc5 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 _0xdbce=['request','then','error','message','catch','SendMail','bluebird','client','http'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xdbce,0x7b));var _0xedbc=function(_0x17b8e2,_0x4d7aab){_0x17b8e2=_0x17b8e2-0x0;var _0x5e4b36=_0xdbce[_0x17b8e2];return _0x5e4b36;};'use strict';var BPromise=require(_0xedbc('0x0'));var jayson=require('jayson/promise');var client=jayson[_0xedbc('0x1')][_0xedbc('0x2')]({'port':0x232b});function request(_0x2f17fa,_0x2fd23a){return new BPromise(function(_0x18cda5,_0x4d5f50){return client[_0xedbc('0x3')](_0x2f17fa,_0x2fd23a)[_0xedbc('0x4')](function(_0x4d8a20){if(_0x4d8a20['error']){return _0x4d5f50(_0x4d8a20[_0xedbc('0x5')][_0xedbc('0x6')]);}else{return _0x18cda5(_0x4d8a20['result']);}})[_0xedbc('0x7')](function(_0x195e79){return _0x4d5f50(_0x195e79);});});}exports['sendMailMessage']=function(_0x2f384f,_0x715132){return request(_0xedbc('0x8'),{'account':_0x2f384f,'message':_0x715132});}; \ No newline at end of file +var _0xcd51=['SendMail','bluebird','http','error','result','sendMailMessage'];(function(_0x23e3b2,_0x49b368){var _0x3ea7b7=function(_0x22fb6f){while(--_0x22fb6f){_0x23e3b2['push'](_0x23e3b2['shift']());}};_0x3ea7b7(++_0x49b368);}(_0xcd51,0xcd));var _0x1cd5=function(_0xc080be,_0x19d7e3){_0xc080be=_0xc080be-0x0;var _0x18e3eb=_0xcd51[_0xc080be];return _0x18e3eb;};'use strict';var BPromise=require(_0x1cd5('0x0'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1cd5('0x1')]({'port':0x232b});function request(_0x4ca923,_0x1122dd){return new BPromise(function(_0x32d965,_0xcea363){return client['request'](_0x4ca923,_0x1122dd)['then'](function(_0x191712){if(_0x191712[_0x1cd5('0x2')]){return _0xcea363(_0x191712['error']['message']);}else{return _0x32d965(_0x191712[_0x1cd5('0x3')]);}})['catch'](function(_0x2f0885){return _0xcea363(_0x2f0885);});});}exports[_0x1cd5('0x4')]=function(_0x5a1129,_0x25d9b7){return request(_0x1cd5('0x5'),{'account':_0x5a1129,'message':_0x25d9b7});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index 041149a..b2ffeb0 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 _0x781d=['getChannelStatus','Status','format','faxStatus','faxCurrentCapacity','openchannelWaitingInteractions','whatsappWaitingInteractions','emit','user:routing:update','exports','lodash','md5','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatusTime','faxCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','chatWaitingInteractions','faxWaitingInteractions','mailWaitingInteractions','smsWaitingInteractions','prototype','CurrentCapacity','Capacity','maxcapacity','working','idle','mail','chat','openchannel','sms','length'];(function(_0x33d38c,_0x2ff27b){var _0x537b31=function(_0x152458){while(--_0x152458){_0x33d38c['push'](_0x33d38c['shift']());}};_0x537b31(++_0x2ff27b);}(_0x781d,0x14a));var _0xd781=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x781d[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0xd781('0x0'));var md5=require(_0xd781('0x1'));var moment=require('moment');var Redis=require('ioredis');var config=require(_0xd781('0x2'));config[_0xd781('0x3')]=_[_0xd781('0x4')](config[_0xd781('0x3')],{'host':_0xd781('0x5'),'port':0x18eb});var io=require(_0xd781('0x6'))(new Redis(config[_0xd781('0x3')]));function Agent(_0x1d4f4e){this['id']=_0x1d4f4e['id']||0x0;this[_0xd781('0x7')]=_0x1d4f4e[_0xd781('0x7')]||'';this['online']=_0x1d4f4e[_0xd781('0x8')]||!![];this[_0xd781('0x9')]=_0x1d4f4e[_0xd781('0x9')]||![];this[_0xd781('0xa')]=_0x1d4f4e['chatPause']||![];this[_0xd781('0xb')]=_0x1d4f4e['mailPause']||![];this[_0xd781('0xc')]=_0x1d4f4e[_0xd781('0xc')]||![];this['smsPause']=_0x1d4f4e[_0xd781('0xd')]||![];this[_0xd781('0xe')]=_0x1d4f4e['openchannelPause']||![];this['chatStatus']=_0xd781('0xf');this[_0xd781('0x10')]=0x0;this[_0xd781('0x11')]=_0x1d4f4e[_0xd781('0x11')]||0x0;this[_0xd781('0x12')]=0x0;this[_0xd781('0x13')]=_0xd781('0xf');this[_0xd781('0x14')]=0x0;this[_0xd781('0x15')]=_0x1d4f4e[_0xd781('0x15')]||0x0;this[_0xd781('0x16')]=0x0;this['faxStatus']=_0xd781('0xf');this[_0xd781('0x17')]=0x0;this['faxCapacity']=_0x1d4f4e[_0xd781('0x18')]||0x0;this['faxCurrentCapacity']=0x0;this[_0xd781('0x19')]=_0xd781('0xf');this[_0xd781('0x1a')]=0x0;this[_0xd781('0x1b')]=_0x1d4f4e[_0xd781('0x1b')]||0x0;this[_0xd781('0x1c')]=0x0;this[_0xd781('0x1d')]='unknown';this[_0xd781('0x1e')]=0x0;this[_0xd781('0x1f')]=_0x1d4f4e[_0xd781('0x1f')]||0x0;this[_0xd781('0x20')]=0x0;this[_0xd781('0x21')]=_0xd781('0xf');this[_0xd781('0x22')]=0x0;this[_0xd781('0x23')]=_0x1d4f4e['openchannelCapacity']||0x0;this[_0xd781('0x24')]=0x0;this[_0xd781('0x25')]=![];this[_0xd781('0x26')]=undefined;this[_0xd781('0x1')]='';this[_0xd781('0x27')]={};this[_0xd781('0x28')]={};this[_0xd781('0x29')]={};this['openchannelWaitingInteractions']={};this[_0xd781('0x2a')]={};this['whatsappWaitingInteractions']={};this['updateRealtime']();}Agent[_0xd781('0x2b')]['getChannelStatus']=function(_0x175ba6){if(this[_0x175ba6+_0xd781('0x2c')]>0x0){if(this[_0x175ba6+_0xd781('0x2d')]>0x0&&this[_0x175ba6+_0xd781('0x2c')]>=this[_0x175ba6+_0xd781('0x2d')]){return _0xd781('0x2e');}else{return _0xd781('0x2f');}}else{return _0xd781('0x30');}};Agent[_0xd781('0x2b')]['updateRealtime']=function(){var _0x529ca1=[_0xd781('0x31'),_0xd781('0x32'),_0xd781('0x33'),'fax',_0xd781('0x34'),'whatsapp'];for(var _0x47c609=0x0;_0x47c609<_0x529ca1[_0xd781('0x35')];_0x47c609+=0x1){var _0x54fe00=this[_0xd781('0x36')](_0x529ca1[_0x47c609]);if(this[_0x529ca1[_0x47c609]+_0xd781('0x37')]!==_0x54fe00){this[_0x529ca1[_0x47c609]+'StatusTime']=_['toNumber'](moment()[_0xd781('0x38')]('x'));}this[_0x529ca1[_0x47c609]+'Status']=_0x54fe00;}var _0x296a0b={'id':this['id'],'name':this['name'],'online':this[_0xd781('0x8')],'voicePause':this[_0xd781('0x9')],'chatPause':this['chatPause'],'mailPause':this['mailPause'],'smsPause':this[_0xd781('0xd')],'faxPause':this[_0xd781('0xc')],'openchannelPause':this[_0xd781('0xe')],'chatStatus':this['chatStatus'],'chatStatusTime':this['chatStatusTime'],'chatCapacity':this[_0xd781('0x11')],'chatCurrentCapacity':this[_0xd781('0x12')],'mailStatus':this[_0xd781('0x13')],'mailStatusTime':this['mailStatusTime'],'mailCapacity':this['mailCapacity'],'mailCurrentCapacity':this[_0xd781('0x16')],'faxStatus':this[_0xd781('0x39')],'faxStatusTime':this['faxStatusTime'],'faxCapacity':this[_0xd781('0x18')],'faxCurrentCapacity':this[_0xd781('0x3a')],'smsStatus':this['smsStatus'],'smsStatusTime':this[_0xd781('0x1a')],'smsCapacity':this[_0xd781('0x1b')],'smsCurrentCapacity':this[_0xd781('0x1c')],'whatsappStatus':this[_0xd781('0x1d')],'whatsappStatusTime':this['whatsappStatusTime'],'whatsappCapacity':this[_0xd781('0x1f')],'whatsappCurrentCapacity':this[_0xd781('0x20')],'openchannelStatus':this[_0xd781('0x21')],'openchannelStatusTime':this[_0xd781('0x22')],'openchannelCapacity':this['openchannelCapacity'],'openchannelCurrentCapacity':this[_0xd781('0x24')],'busy':this[_0xd781('0x25')],'busyQueue':this['busyQueue'],'chatWaitingInteractions':this[_0xd781('0x27')],'faxWaitingInteractions':this['faxWaitingInteractions'],'mailWaitingInteractions':this[_0xd781('0x29')],'openchannelWaitingInteractions':this[_0xd781('0x3b')],'smsWaitingInteractions':this['smsWaitingInteractions'],'whatsappWaitingInteractions':this[_0xd781('0x3c')]};var _0x2c6be3=md5(JSON['stringify'](_0x296a0b));if(this[_0xd781('0x1')]!==_0x2c6be3){this['md5']=_0x2c6be3;io[_0xd781('0x3d')](_0xd781('0x3e'),_['omit'](_0x296a0b,[_0xd781('0x8')]));}};module[_0xd781('0x3f')]=Agent; \ No newline at end of file +var _0x5204=['working','idle','mail','chat','openchannel','fax','sms','whatsapp','length','getChannelStatus','StatusTime','format','Status','faxStatusTime','openchannelCurrentCapacity','busyQueue','chatWaitingInteractions','smsWaitingInteractions','emit','user:routing:update','omit','exports','lodash','md5','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxCapacity','faxCurrentCapacity','smsStatus','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','faxWaitingInteractions','mailWaitingInteractions','openchannelWaitingInteractions','whatsappWaitingInteractions','updateRealtime','prototype','CurrentCapacity','Capacity'];(function(_0x141d40,_0x21e9e1){var _0x14011e=function(_0x3bf987){while(--_0x3bf987){_0x141d40['push'](_0x141d40['shift']());}};_0x14011e(++_0x21e9e1);}(_0x5204,0xdf));var _0x4520=function(_0x187399,_0x40c56d){_0x187399=_0x187399-0x0;var _0x40fa92=_0x5204[_0x187399];return _0x40fa92;};'use strict';var _=require(_0x4520('0x0'));var md5=require(_0x4520('0x1'));var moment=require('moment');var Redis=require(_0x4520('0x2'));var config=require(_0x4520('0x3'));config[_0x4520('0x4')]=_[_0x4520('0x5')](config[_0x4520('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x4520('0x6'))(new Redis(config['redis']));function Agent(_0x180174){this['id']=_0x180174['id']||0x0;this[_0x4520('0x7')]=_0x180174[_0x4520('0x7')]||'';this[_0x4520('0x8')]=_0x180174[_0x4520('0x8')]||!![];this[_0x4520('0x9')]=_0x180174[_0x4520('0x9')]||![];this['chatPause']=_0x180174[_0x4520('0xa')]||![];this['mailPause']=_0x180174[_0x4520('0xb')]||![];this[_0x4520('0xc')]=_0x180174[_0x4520('0xc')]||![];this[_0x4520('0xd')]=_0x180174[_0x4520('0xd')]||![];this[_0x4520('0xe')]=_0x180174[_0x4520('0xe')]||![];this[_0x4520('0xf')]=_0x4520('0x10');this[_0x4520('0x11')]=0x0;this[_0x4520('0x12')]=_0x180174[_0x4520('0x12')]||0x0;this[_0x4520('0x13')]=0x0;this[_0x4520('0x14')]=_0x4520('0x10');this[_0x4520('0x15')]=0x0;this[_0x4520('0x16')]=_0x180174[_0x4520('0x16')]||0x0;this[_0x4520('0x17')]=0x0;this[_0x4520('0x18')]=_0x4520('0x10');this['faxStatusTime']=0x0;this[_0x4520('0x19')]=_0x180174[_0x4520('0x19')]||0x0;this[_0x4520('0x1a')]=0x0;this[_0x4520('0x1b')]=_0x4520('0x10');this['smsStatusTime']=0x0;this[_0x4520('0x1c')]=_0x180174[_0x4520('0x1c')]||0x0;this[_0x4520('0x1d')]=0x0;this[_0x4520('0x1e')]=_0x4520('0x10');this[_0x4520('0x1f')]=0x0;this[_0x4520('0x20')]=_0x180174[_0x4520('0x20')]||0x0;this[_0x4520('0x21')]=0x0;this[_0x4520('0x22')]=_0x4520('0x10');this[_0x4520('0x23')]=0x0;this['openchannelCapacity']=_0x180174[_0x4520('0x24')]||0x0;this['openchannelCurrentCapacity']=0x0;this['busy']=![];this['busyQueue']=undefined;this[_0x4520('0x1')]='';this['chatWaitingInteractions']={};this[_0x4520('0x25')]={};this[_0x4520('0x26')]={};this[_0x4520('0x27')]={};this['smsWaitingInteractions']={};this[_0x4520('0x28')]={};this[_0x4520('0x29')]();}Agent[_0x4520('0x2a')]['getChannelStatus']=function(_0x198c34){if(this[_0x198c34+_0x4520('0x2b')]>0x0){if(this[_0x198c34+_0x4520('0x2c')]>0x0&&this[_0x198c34+_0x4520('0x2b')]>=this[_0x198c34+_0x4520('0x2c')]){return'maxcapacity';}else{return _0x4520('0x2d');}}else{return _0x4520('0x2e');}};Agent[_0x4520('0x2a')][_0x4520('0x29')]=function(){var _0x57306b=[_0x4520('0x2f'),_0x4520('0x30'),_0x4520('0x31'),_0x4520('0x32'),_0x4520('0x33'),_0x4520('0x34')];for(var _0x2d6902=0x0;_0x2d6902<_0x57306b[_0x4520('0x35')];_0x2d6902+=0x1){var _0x180c44=this[_0x4520('0x36')](_0x57306b[_0x2d6902]);if(this[_0x57306b[_0x2d6902]+'Status']!==_0x180c44){this[_0x57306b[_0x2d6902]+_0x4520('0x37')]=_['toNumber'](moment()[_0x4520('0x38')]('x'));}this[_0x57306b[_0x2d6902]+_0x4520('0x39')]=_0x180c44;}var _0x43b4a2={'id':this['id'],'name':this[_0x4520('0x7')],'online':this[_0x4520('0x8')],'voicePause':this[_0x4520('0x9')],'chatPause':this['chatPause'],'mailPause':this[_0x4520('0xb')],'smsPause':this['smsPause'],'faxPause':this[_0x4520('0xc')],'openchannelPause':this['openchannelPause'],'chatStatus':this[_0x4520('0xf')],'chatStatusTime':this['chatStatusTime'],'chatCapacity':this[_0x4520('0x12')],'chatCurrentCapacity':this['chatCurrentCapacity'],'mailStatus':this['mailStatus'],'mailStatusTime':this[_0x4520('0x15')],'mailCapacity':this[_0x4520('0x16')],'mailCurrentCapacity':this[_0x4520('0x17')],'faxStatus':this['faxStatus'],'faxStatusTime':this[_0x4520('0x3a')],'faxCapacity':this[_0x4520('0x19')],'faxCurrentCapacity':this[_0x4520('0x1a')],'smsStatus':this[_0x4520('0x1b')],'smsStatusTime':this['smsStatusTime'],'smsCapacity':this['smsCapacity'],'smsCurrentCapacity':this[_0x4520('0x1d')],'whatsappStatus':this[_0x4520('0x1e')],'whatsappStatusTime':this['whatsappStatusTime'],'whatsappCapacity':this[_0x4520('0x20')],'whatsappCurrentCapacity':this[_0x4520('0x21')],'openchannelStatus':this[_0x4520('0x22')],'openchannelStatusTime':this[_0x4520('0x23')],'openchannelCapacity':this[_0x4520('0x24')],'openchannelCurrentCapacity':this[_0x4520('0x3b')],'busy':this['busy'],'busyQueue':this[_0x4520('0x3c')],'chatWaitingInteractions':this[_0x4520('0x3d')],'faxWaitingInteractions':this['faxWaitingInteractions'],'mailWaitingInteractions':this[_0x4520('0x26')],'openchannelWaitingInteractions':this['openchannelWaitingInteractions'],'smsWaitingInteractions':this[_0x4520('0x3e')],'whatsappWaitingInteractions':this[_0x4520('0x28')]};var _0x4f2dc4=md5(JSON['stringify'](_0x43b4a2));if(this['md5']!==_0x4f2dc4){this[_0x4520('0x1')]=_0x4f2dc4;io[_0x4520('0x3f')](_0x4520('0x40'),_[_0x4520('0x41')](_0x43b4a2,[_0x4520('0x8')]));}};module[_0x4520('0x42')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index d865c2a..b0f76f7 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 _0xc581=['available','loggedIn','stringify','format','emit','chat_queue:save','exports','lodash','md5','ioredis','../../../config/environment','redis','localhost','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRealtime','prototype','updateRouting','_rr','map','paused','length','online','chatPause'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xc581,0x1ba));var _0x1c58=function(_0x4127cb,_0x508a52){_0x4127cb=_0x4127cb-0x0;var _0x2143af=_0xc581[_0x4127cb];return _0x2143af;};'use strict';var _=require(_0x1c58('0x0'));var md5=require(_0x1c58('0x1'));var util=require('util');var Redis=require(_0x1c58('0x2'));var config=require(_0x1c58('0x3'));config[_0x1c58('0x4')]=_['defaults'](config[_0x1c58('0x4')],{'host':_0x1c58('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x1c58('0x4')]));function ChatQueue(_0x4665bf){this['id']=_0x4665bf['id']||0x0;this[_0x1c58('0x6')]=_0x4665bf['name']||'';this[_0x1c58('0x7')]=_0x4665bf[_0x1c58('0x7')]||0xa;this[_0x1c58('0x8')]=_0x4665bf['strategy']||_0x1c58('0x9');this[_0x1c58('0xa')]=_0x4665bf['Agents'];this[_0x1c58('0xb')]={};this[_0x1c58('0xc')]=0x0;this[_0x1c58('0x1')]='';this['updateRouting']();this[_0x1c58('0xd')]();}ChatQueue[_0x1c58('0xe')][_0x1c58('0xf')]=function(){var _0x5a7c88=this['mapAgentsId'][_0x1c58('0x10')];this[_0x1c58('0xb')]=_[_0x1c58('0x11')](this[_0x1c58('0xa')],'id');this[_0x1c58('0xb')][_0x1c58('0x10')]=_0x5a7c88;};ChatQueue['prototype']['updateRealtime']=function(){this['loggedIn']=0x0;this[_0x1c58('0x12')]=0x0;for(var _0x14eb96=0x0;_0x14eb96=0x0?this[_0x1c58('0x16')]:0x0;var _0x24901e={'id':this['id'],'available':this[_0x1c58('0x16')],'loggedIn':this[_0x1c58('0x17')],'name':this[_0x1c58('0x6')],'paused':this[_0x1c58('0x12')],'waiting':this[_0x1c58('0xc')]};var _0x1b23a9=md5(JSON[_0x1c58('0x18')](_0x24901e));if(this[_0x1c58('0x1')]!==_0x1b23a9){this[_0x1c58('0x1')]=_0x1b23a9;io['to'](util[_0x1c58('0x19')]('chat:queue:%s',_0x24901e[_0x1c58('0x6')]))[_0x1c58('0x1a')](_0x1c58('0x1b'),_0x24901e);}};module[_0x1c58('0x1c')]=ChatQueue; \ No newline at end of file +var _0xb5e0=['socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','loggedIn','paused','length','online','available','stringify','format','chat:queue:%s','chat_queue:save','exports','md5','util','ioredis','../../../config/environment','defaults','redis','localhost'];(function(_0x13f00d,_0x305400){var _0x586563=function(_0x29e4ee){while(--_0x29e4ee){_0x13f00d['push'](_0x13f00d['shift']());}};_0x586563(++_0x305400);}(_0xb5e0,0x11b));var _0x0b5e=function(_0x300d33,_0x17dc36){_0x300d33=_0x300d33-0x0;var _0x845616=_0xb5e0[_0x300d33];return _0x845616;};'use strict';var _=require('lodash');var md5=require(_0x0b5e('0x0'));var util=require(_0x0b5e('0x1'));var Redis=require(_0x0b5e('0x2'));var config=require(_0x0b5e('0x3'));config['redis']=_[_0x0b5e('0x4')](config[_0x0b5e('0x5')],{'host':_0x0b5e('0x6'),'port':0x18eb});var io=require(_0x0b5e('0x7'))(new Redis(config['redis']));function ChatQueue(_0x4d5f48){this['id']=_0x4d5f48['id']||0x0;this[_0x0b5e('0x8')]=_0x4d5f48[_0x0b5e('0x8')]||'';this[_0x0b5e('0x9')]=_0x4d5f48['timeout']||0xa;this[_0x0b5e('0xa')]=_0x4d5f48[_0x0b5e('0xa')]||_0x0b5e('0xb');this['Agents']=_0x4d5f48[_0x0b5e('0xc')];this[_0x0b5e('0xd')]={};this[_0x0b5e('0xe')]=0x0;this[_0x0b5e('0x0')]='';this[_0x0b5e('0xf')]();this[_0x0b5e('0x10')]();}ChatQueue[_0x0b5e('0x11')]['updateRouting']=function(){var _0x441d20=this[_0x0b5e('0xd')]['_rr'];this[_0x0b5e('0xd')]=_['map'](this['Agents'],'id');this[_0x0b5e('0xd')][_0x0b5e('0x12')]=_0x441d20;};ChatQueue[_0x0b5e('0x11')][_0x0b5e('0x10')]=function(){this[_0x0b5e('0x13')]=0x0;this[_0x0b5e('0x14')]=0x0;for(var _0x33ceba=0x0;_0x33ceba=0x0?this[_0x0b5e('0x17')]:0x0;var _0x373162={'id':this['id'],'available':this[_0x0b5e('0x17')],'loggedIn':this[_0x0b5e('0x13')],'name':this[_0x0b5e('0x8')],'paused':this[_0x0b5e('0x14')],'waiting':this[_0x0b5e('0xe')]};var _0x5a23a1=md5(JSON[_0x0b5e('0x18')](_0x373162));if(this['md5']!==_0x5a23a1){this['md5']=_0x5a23a1;io['to'](util[_0x0b5e('0x19')](_0x0b5e('0x1a'),_0x373162['name']))['emit'](_0x0b5e('0x1b'),_0x373162);}};module[_0x0b5e('0x1c')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index 4251fce..1c64c32 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 _0x299b=['fax:queue:%s','emit','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','map','loggedIn','length','online','available','paused','format'];(function(_0x530d09,_0x37d4f2){var _0xb0c00e=function(_0x1ea845){while(--_0x1ea845){_0x530d09['push'](_0x530d09['shift']());}};_0xb0c00e(++_0x37d4f2);}(_0x299b,0xf5));var _0xb299=function(_0x50bf5a,_0x807bba){_0x50bf5a=_0x50bf5a-0x0;var _0x4ddc1d=_0x299b[_0x50bf5a];return _0x4ddc1d;};'use strict';var _=require(_0xb299('0x0'));var md5=require(_0xb299('0x1'));var util=require(_0xb299('0x2'));var Redis=require(_0xb299('0x3'));var config=require(_0xb299('0x4'));config[_0xb299('0x5')]=_[_0xb299('0x6')](config[_0xb299('0x5')],{'host':_0xb299('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xb299('0x5')]));function FaxQueue(_0x4386d0){this['id']=_0x4386d0['id']||0x0;this['name']=_0x4386d0[_0xb299('0x8')]||'';this[_0xb299('0x9')]=_0x4386d0[_0xb299('0x9')]||0xa;this[_0xb299('0xa')]=_0x4386d0[_0xb299('0xa')]||_0xb299('0xb');this['Agents']=_0x4386d0[_0xb299('0xc')];this[_0xb299('0xd')]={};this[_0xb299('0xe')]=0x0;this[_0xb299('0x1')]='';this[_0xb299('0xf')]();this[_0xb299('0x10')]();}FaxQueue[_0xb299('0x11')][_0xb299('0xf')]=function(){var _0x3c52b5=this[_0xb299('0xd')]['_rr'];this[_0xb299('0xd')]=_[_0xb299('0x12')](this['Agents'],'id');this[_0xb299('0xd')]['_rr']=_0x3c52b5;};FaxQueue[_0xb299('0x11')][_0xb299('0x10')]=function(){this[_0xb299('0x13')]=0x0;this['paused']=0x0;for(var _0x165aac=0x0;_0x165aac=0x0?this['available']:0x0;var _0x4479ed={'id':this['id'],'available':this[_0xb299('0x16')],'loggedIn':this[_0xb299('0x13')],'name':this['name'],'paused':this['paused'],'waiting':this['waiting']};var _0x46038d=md5(JSON['stringify'](_0x4479ed));if(this[_0xb299('0x1')]!==_0x46038d){this[_0xb299('0x1')]=_0x46038d;io['to'](util[_0xb299('0x18')](_0xb299('0x19'),_0x4479ed[_0xb299('0x8')]))[_0xb299('0x1a')]('fax_queue:save',_0x4479ed);}};module['exports']=FaxQueue; \ No newline at end of file +var _0x72d8=['mapAgentsId','waiting','updateRealtime','prototype','updateRouting','map','_rr','paused','length','online','loggedIn','faxPause','available','format','fax:queue:%s','emit','fax_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents'];(function(_0x33c9f8,_0x5aedbb){var _0x2d7004=function(_0x4f4f43){while(--_0x4f4f43){_0x33c9f8['push'](_0x33c9f8['shift']());}};_0x2d7004(++_0x5aedbb);}(_0x72d8,0x129));var _0x872d=function(_0x43e0a7,_0x379636){_0x43e0a7=_0x43e0a7-0x0;var _0xe4d4f1=_0x72d8[_0x43e0a7];return _0xe4d4f1;};'use strict';var _=require(_0x872d('0x0'));var md5=require(_0x872d('0x1'));var util=require(_0x872d('0x2'));var Redis=require(_0x872d('0x3'));var config=require(_0x872d('0x4'));config[_0x872d('0x5')]=_['defaults'](config[_0x872d('0x5')],{'host':_0x872d('0x6'),'port':0x18eb});var io=require(_0x872d('0x7'))(new Redis(config[_0x872d('0x5')]));function FaxQueue(_0x1b57bd){this['id']=_0x1b57bd['id']||0x0;this[_0x872d('0x8')]=_0x1b57bd[_0x872d('0x8')]||'';this[_0x872d('0x9')]=_0x1b57bd['timeout']||0xa;this[_0x872d('0xa')]=_0x1b57bd[_0x872d('0xa')]||_0x872d('0xb');this['Agents']=_0x1b57bd[_0x872d('0xc')];this[_0x872d('0xd')]={};this[_0x872d('0xe')]=0x0;this[_0x872d('0x1')]='';this['updateRouting']();this[_0x872d('0xf')]();}FaxQueue[_0x872d('0x10')][_0x872d('0x11')]=function(){var _0x32879e=this[_0x872d('0xd')]['_rr'];this['mapAgentsId']=_[_0x872d('0x12')](this['Agents'],'id');this[_0x872d('0xd')][_0x872d('0x13')]=_0x32879e;};FaxQueue[_0x872d('0x10')][_0x872d('0xf')]=function(){this['loggedIn']=0x0;this[_0x872d('0x14')]=0x0;for(var _0x3fd104=0x0;_0x3fd104=0x0?this['available']:0x0;var _0x3548ed={'id':this['id'],'available':this[_0x872d('0x19')],'loggedIn':this[_0x872d('0x17')],'name':this['name'],'paused':this[_0x872d('0x14')],'waiting':this['waiting']};var _0x550e8f=md5(JSON['stringify'](_0x3548ed));if(this[_0x872d('0x1')]!==_0x550e8f){this[_0x872d('0x1')]=_0x550e8f;io['to'](util[_0x872d('0x1a')](_0x872d('0x1b'),_0x3548ed[_0x872d('0x8')]))[_0x872d('0x1c')](_0x872d('0x1d'),_0x3548ed);}};module[_0x872d('0x1e')]=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index 68689b2..fa0d94c 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 _0x71d1=['exports','name','Intervals'];(function(_0x4a5195,_0x20603e){var _0x30908e=function(_0x3c57bf){while(--_0x3c57bf){_0x4a5195['push'](_0x4a5195['shift']());}};_0x30908e(++_0x20603e);}(_0x71d1,0x1ba));var _0x171d=function(_0x21ecc8,_0x2bdead){_0x21ecc8=_0x21ecc8-0x0;var _0x510c1d=_0x71d1[_0x21ecc8];return _0x510c1d;};'use strict';function Interval(_0x512bbf){this['id']=_0x512bbf['id']||0x0;this[_0x171d('0x0')]=_0x512bbf['name']||'';this[_0x171d('0x1')]=_0x512bbf[_0x171d('0x1')]||{};}module[_0x171d('0x2')]=Interval; \ No newline at end of file +var _0x1c29=['Intervals','exports','name'];(function(_0x38cbb7,_0x16bca5){var _0x107674=function(_0x32464c){while(--_0x32464c){_0x38cbb7['push'](_0x38cbb7['shift']());}};_0x107674(++_0x16bca5);}(_0x1c29,0x1df));var _0x91c2=function(_0x5eda45,_0x4e1eab){_0x5eda45=_0x5eda45-0x0;var _0x4bd3f2=_0x1c29[_0x5eda45];return _0x4bd3f2;};'use strict';function Interval(_0x2a4a41){this['id']=_0x2a4a41['id']||0x0;this[_0x91c2('0x0')]=_0x2a4a41[_0x91c2('0x0')]||'';this[_0x91c2('0x1')]=_0x2a4a41['Intervals']||{};}module[_0x91c2('0x2')]=Interval; \ No newline at end of file diff --git a/server/services/routing/model/mailQueue.js b/server/services/routing/model/mailQueue.js index a443067..4174956 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 _0x8a87=['map','_rr','loggedIn','paused','online','mailPause','available','format','mail:queue:%s','emit','mail_queue:save','exports','lodash','md5','util','../../../config/environment','redis','defaults','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','updateRouting','updateRealtime','prototype'];(function(_0xd4ef3,_0x47e660){var _0x5416a7=function(_0x56161a){while(--_0x56161a){_0xd4ef3['push'](_0xd4ef3['shift']());}};_0x5416a7(++_0x47e660);}(_0x8a87,0x7c));var _0x78a8=function(_0x175f1b,_0x1a7de0){_0x175f1b=_0x175f1b-0x0;var _0x2da79a=_0x8a87[_0x175f1b];return _0x2da79a;};'use strict';var _=require(_0x78a8('0x0'));var md5=require(_0x78a8('0x1'));var util=require(_0x78a8('0x2'));var Redis=require('ioredis');var config=require(_0x78a8('0x3'));config[_0x78a8('0x4')]=_[_0x78a8('0x5')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x78a8('0x6'))(new Redis(config['redis']));function MailQueue(_0x5c08a3){this['id']=_0x5c08a3['id']||0x0;this[_0x78a8('0x7')]=_0x5c08a3['name']||'';this[_0x78a8('0x8')]=_0x5c08a3['timeout']||0xa;this[_0x78a8('0x9')]=_0x5c08a3[_0x78a8('0x9')]||_0x78a8('0xa');this[_0x78a8('0xb')]=_0x5c08a3['Agents'];this[_0x78a8('0xc')]={};this['waiting']=0x0;this[_0x78a8('0x1')]='';this[_0x78a8('0xd')]();this[_0x78a8('0xe')]();}MailQueue[_0x78a8('0xf')][_0x78a8('0xd')]=function(){var _0x3a7aae=this['mapAgentsId']['_rr'];this['mapAgentsId']=_[_0x78a8('0x10')](this['Agents'],'id');this['mapAgentsId'][_0x78a8('0x11')]=_0x3a7aae;};MailQueue['prototype'][_0x78a8('0xe')]=function(){this[_0x78a8('0x12')]=0x0;this[_0x78a8('0x13')]=0x0;for(var _0x4968fc=0x0;_0x4968fc=0x0?this['available']:0x0;var _0x5b5741={'id':this['id'],'available':this[_0x78a8('0x16')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this[_0x78a8('0x13')],'waiting':this['waiting']};var _0x3304ff=md5(JSON['stringify'](_0x5b5741));if(this[_0x78a8('0x1')]!==_0x3304ff){this[_0x78a8('0x1')]=_0x3304ff;io['to'](util[_0x78a8('0x17')](_0x78a8('0x18'),_0x5b5741[_0x78a8('0x7')]))[_0x78a8('0x19')](_0x78a8('0x1a'),_0x5b5741);}};module[_0x78a8('0x1b')]=MailQueue; \ No newline at end of file +var _0x0505=['waiting','stringify','format','mail:queue:%s','emit','mail_queue:save','exports','lodash','md5','util','../../../config/environment','defaults','redis','name','timeout','strategy','Agents','mapAgentsId','updateRouting','prototype','_rr','map','updateRealtime','loggedIn','paused','length','online','mailPause','available'];(function(_0x1c689c,_0x1626de){var _0x2cbdc0=function(_0x49842e){while(--_0x49842e){_0x1c689c['push'](_0x1c689c['shift']());}};_0x2cbdc0(++_0x1626de);}(_0x0505,0xb5));var _0x5050=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0x0505[_0xdea41a];return _0x15d0d8;};'use strict';var _=require(_0x5050('0x0'));var md5=require(_0x5050('0x1'));var util=require(_0x5050('0x2'));var Redis=require('ioredis');var config=require(_0x5050('0x3'));config['redis']=_[_0x5050('0x4')](config[_0x5050('0x5')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x5050('0x5')]));function MailQueue(_0x41df48){this['id']=_0x41df48['id']||0x0;this['name']=_0x41df48[_0x5050('0x6')]||'';this[_0x5050('0x7')]=_0x41df48[_0x5050('0x7')]||0xa;this[_0x5050('0x8')]=_0x41df48['strategy']||'beepall';this[_0x5050('0x9')]=_0x41df48[_0x5050('0x9')];this[_0x5050('0xa')]={};this['waiting']=0x0;this['md5']='';this[_0x5050('0xb')]();this['updateRealtime']();}MailQueue[_0x5050('0xc')][_0x5050('0xb')]=function(){var _0x44ee9e=this[_0x5050('0xa')][_0x5050('0xd')];this[_0x5050('0xa')]=_[_0x5050('0xe')](this[_0x5050('0x9')],'id');this['mapAgentsId'][_0x5050('0xd')]=_0x44ee9e;};MailQueue['prototype'][_0x5050('0xf')]=function(){this[_0x5050('0x10')]=0x0;this[_0x5050('0x11')]=0x0;for(var _0x58c2fc=0x0;_0x58c2fc=0x0?this[_0x5050('0x15')]:0x0;var _0x5272a4={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0x5050('0x6')],'paused':this[_0x5050('0x11')],'waiting':this[_0x5050('0x16')]};var _0x393f57=md5(JSON[_0x5050('0x17')](_0x5272a4));if(this[_0x5050('0x1')]!==_0x393f57){this[_0x5050('0x1')]=_0x393f57;io['to'](util[_0x5050('0x18')](_0x5050('0x19'),_0x5272a4[_0x5050('0x6')]))[_0x5050('0x1a')](_0x5050('0x1b'),_0x5272a4);}};module[_0x5050('0x1c')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index 7d044db..b3f83cc 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(_0x4a7631,_0x2c85b9){var _0x1a5a6f=function(_0x1ee3fd){while(--_0x1ee3fd){_0x4a7631['push'](_0x4a7631['shift']());}};_0x1a5a6f(++_0x2c85b9);}(_0x1261,0x144));var _0x1126=function(_0x155c64,_0x26ff95){_0x155c64=_0x155c64-0x0;var _0x1f154a=_0x1261[_0x155c64];return _0x1f154a;};'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 _0x326f=['exports','lodash','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','mapAgentsId','waiting','md5','updateRouting','updateRealtime','Agents','prototype','loggedIn','paused','online','openchannelPause','available','stringify','openchannel:queue:%s','openchannel_queue:save'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0x326f,0xd1));var _0xf326=function(_0x4f5a9b,_0x2b1a23){_0x4f5a9b=_0x4f5a9b-0x0;var _0x4fcaeb=_0x326f[_0x4f5a9b];return _0x4fcaeb;};'use strict';var _=require(_0xf326('0x0'));var md5=require('md5');var util=require('util');var Redis=require(_0xf326('0x1'));var config=require(_0xf326('0x2'));config[_0xf326('0x3')]=_[_0xf326('0x4')](config[_0xf326('0x3')],{'host':_0xf326('0x5'),'port':0x18eb});var io=require(_0xf326('0x6'))(new Redis(config[_0xf326('0x3')]));function OpenchannelQueue(_0x1b5a56){this['id']=_0x1b5a56['id']||0x0;this[_0xf326('0x7')]=_0x1b5a56['name']||'';this[_0xf326('0x8')]=_0x1b5a56[_0xf326('0x8')]||0xa;this[_0xf326('0x9')]=_0x1b5a56[_0xf326('0x9')]||'beepall';this['Agents']=_0x1b5a56['Agents'];this[_0xf326('0xa')]={};this[_0xf326('0xb')]=0x0;this[_0xf326('0xc')]='';this[_0xf326('0xd')]();this[_0xf326('0xe')]();}OpenchannelQueue['prototype'][_0xf326('0xd')]=function(){var _0x53cbcd=this[_0xf326('0xa')]['_rr'];this[_0xf326('0xa')]=_['map'](this[_0xf326('0xf')],'id');this[_0xf326('0xa')]['_rr']=_0x53cbcd;};OpenchannelQueue[_0xf326('0x10')][_0xf326('0xe')]=function(){this[_0xf326('0x11')]=0x0;this[_0xf326('0x12')]=0x0;for(var _0x5c8483=0x0;_0x5c8483=0x0?this[_0xf326('0x15')]:0x0;var _0x18bee3={'id':this['id'],'available':this[_0xf326('0x15')],'loggedIn':this[_0xf326('0x11')],'name':this[_0xf326('0x7')],'paused':this['paused'],'waiting':this['waiting']};var _0x56ad41=md5(JSON[_0xf326('0x16')](_0x18bee3));if(this[_0xf326('0xc')]!==_0x56ad41){this['md5']=_0x56ad41;io['to'](util['format'](_0xf326('0x17'),_0x18bee3['name']))['emit'](_0xf326('0x18'),_0x18bee3);}};module[_0xf326('0x19')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index a49a8a7..397c74d 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 _0xe107=['format','sms:queue:%s','emit','sms_queue:save','exports','lodash','util','ioredis','../../../config/environment','defaults','socket.io-emitter','redis','timeout','strategy','Agents','md5','updateRouting','updateRealtime','prototype','mapAgentsId','map','_rr','loggedIn','paused','length','online','available','waiting','stringify'];(function(_0x54dbf9,_0x501d79){var _0x196dcc=function(_0x4d6683){while(--_0x4d6683){_0x54dbf9['push'](_0x54dbf9['shift']());}};_0x196dcc(++_0x501d79);}(_0xe107,0xb3));var _0x7e10=function(_0x2989c2,_0x5a26bb){_0x2989c2=_0x2989c2-0x0;var _0x2a577f=_0xe107[_0x2989c2];return _0x2a577f;};'use strict';var _=require(_0x7e10('0x0'));var md5=require('md5');var util=require(_0x7e10('0x1'));var Redis=require(_0x7e10('0x2'));var config=require(_0x7e10('0x3'));config['redis']=_[_0x7e10('0x4')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x7e10('0x5'))(new Redis(config[_0x7e10('0x6')]));function SmsQueue(_0x841f6d){this['id']=_0x841f6d['id']||0x0;this['name']=_0x841f6d['name']||'';this[_0x7e10('0x7')]=_0x841f6d[_0x7e10('0x7')]||0xa;this[_0x7e10('0x8')]=_0x841f6d[_0x7e10('0x8')]||'beepall';this['Agents']=_0x841f6d[_0x7e10('0x9')];this['mapAgentsId']={};this['waiting']=0x0;this[_0x7e10('0xa')]='';this[_0x7e10('0xb')]();this[_0x7e10('0xc')]();}SmsQueue[_0x7e10('0xd')][_0x7e10('0xb')]=function(){var _0x52ba74=this[_0x7e10('0xe')]['_rr'];this[_0x7e10('0xe')]=_[_0x7e10('0xf')](this[_0x7e10('0x9')],'id');this['mapAgentsId'][_0x7e10('0x10')]=_0x52ba74;};SmsQueue[_0x7e10('0xd')][_0x7e10('0xc')]=function(){this[_0x7e10('0x11')]=0x0;this[_0x7e10('0x12')]=0x0;for(var _0x1b4d9d=0x0;_0x1b4d9d=0x0?this['available']:0x0;var _0x3208c6={'id':this['id'],'available':this[_0x7e10('0x15')],'loggedIn':this[_0x7e10('0x11')],'name':this['name'],'paused':this[_0x7e10('0x12')],'waiting':this[_0x7e10('0x16')]};var _0x157b22=md5(JSON[_0x7e10('0x17')](_0x3208c6));if(this[_0x7e10('0xa')]!==_0x157b22){this['md5']=_0x157b22;io['to'](util[_0x7e10('0x18')](_0x7e10('0x19'),_0x3208c6['name']))[_0x7e10('0x1a')](_0x7e10('0x1b'),_0x3208c6);}};module[_0x7e10('0x1c')]=SmsQueue; \ No newline at end of file +var _0xdab2=['sms:queue:%s','emit','sms_queue:save','exports','lodash','md5','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','updateRouting','updateRealtime','mapAgentsId','_rr','map','loggedIn','paused','length','online','smsPause','available','stringify','format'];(function(_0x2a3b81,_0x3c56fa){var _0x2784d9=function(_0x4fcb65){while(--_0x4fcb65){_0x2a3b81['push'](_0x2a3b81['shift']());}};_0x2784d9(++_0x3c56fa);}(_0xdab2,0x130));var _0x2dab=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdab2[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2dab('0x0'));var md5=require(_0x2dab('0x1'));var util=require('util');var Redis=require(_0x2dab('0x2'));var config=require(_0x2dab('0x3'));config[_0x2dab('0x4')]=_[_0x2dab('0x5')](config['redis'],{'host':_0x2dab('0x6'),'port':0x18eb});var io=require(_0x2dab('0x7'))(new Redis(config[_0x2dab('0x4')]));function SmsQueue(_0x203350){this['id']=_0x203350['id']||0x0;this[_0x2dab('0x8')]=_0x203350[_0x2dab('0x8')]||'';this[_0x2dab('0x9')]=_0x203350[_0x2dab('0x9')]||0xa;this[_0x2dab('0xa')]=_0x203350[_0x2dab('0xa')]||_0x2dab('0xb');this[_0x2dab('0xc')]=_0x203350[_0x2dab('0xc')];this['mapAgentsId']={};this['waiting']=0x0;this[_0x2dab('0x1')]='';this[_0x2dab('0xd')]();this[_0x2dab('0xe')]();}SmsQueue['prototype']['updateRouting']=function(){var _0x29e96b=this[_0x2dab('0xf')][_0x2dab('0x10')];this[_0x2dab('0xf')]=_[_0x2dab('0x11')](this['Agents'],'id');this[_0x2dab('0xf')][_0x2dab('0x10')]=_0x29e96b;};SmsQueue['prototype'][_0x2dab('0xe')]=function(){this[_0x2dab('0x12')]=0x0;this[_0x2dab('0x13')]=0x0;for(var _0x597a6e=0x0;_0x597a6e=0x0?this[_0x2dab('0x17')]:0x0;var _0x2a86b5={'id':this['id'],'available':this['available'],'loggedIn':this[_0x2dab('0x12')],'name':this[_0x2dab('0x8')],'paused':this[_0x2dab('0x13')],'waiting':this['waiting']};var _0x3340fd=md5(JSON[_0x2dab('0x18')](_0x2a86b5));if(this[_0x2dab('0x1')]!==_0x3340fd){this['md5']=_0x3340fd;io['to'](util[_0x2dab('0x19')](_0x2dab('0x1a'),_0x2a86b5[_0x2dab('0x8')]))[_0x2dab('0x1b')](_0x2dab('0x1c'),_0x2a86b5);}};module[_0x2dab('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 6ba18cb..98f3754 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 _0xf32a=['paused','online','available','stringify','whatsapp:queue:%s','whatsapp_queue:save','exports','lodash','util','ioredis','redis','localhost','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','updateRouting','updateRealtime','prototype','_rr','loggedIn'];(function(_0x540dcb,_0x4eacb6){var _0x49353c=function(_0x449bb1){while(--_0x449bb1){_0x540dcb['push'](_0x540dcb['shift']());}};_0x49353c(++_0x4eacb6);}(_0xf32a,0x17e));var _0xaf32=function(_0x4b8cd2,_0x1186d1){_0x4b8cd2=_0x4b8cd2-0x0;var _0x49e7d8=_0xf32a[_0x4b8cd2];return _0x49e7d8;};'use strict';var _=require(_0xaf32('0x0'));var md5=require('md5');var util=require(_0xaf32('0x1'));var Redis=require(_0xaf32('0x2'));var config=require('../../../config/environment');config['redis']=_['defaults'](config[_0xaf32('0x3')],{'host':_0xaf32('0x4'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xaf32('0x3')]));function WhatsappQueue(_0x55b56d){this['id']=_0x55b56d['id']||0x0;this[_0xaf32('0x5')]=_0x55b56d['name']||'';this[_0xaf32('0x6')]=_0x55b56d[_0xaf32('0x6')]||0xa;this[_0xaf32('0x7')]=_0x55b56d[_0xaf32('0x7')]||_0xaf32('0x8');this[_0xaf32('0x9')]=_0x55b56d[_0xaf32('0x9')];this[_0xaf32('0xa')]={};this[_0xaf32('0xb')]=0x0;this[_0xaf32('0xc')]='';this[_0xaf32('0xd')]();this[_0xaf32('0xe')]();}WhatsappQueue[_0xaf32('0xf')][_0xaf32('0xd')]=function(){var _0x1728a3=this[_0xaf32('0xa')][_0xaf32('0x10')];this['mapAgentsId']=_['map'](this[_0xaf32('0x9')],'id');this[_0xaf32('0xa')][_0xaf32('0x10')]=_0x1728a3;};WhatsappQueue[_0xaf32('0xf')]['updateRealtime']=function(){this[_0xaf32('0x11')]=0x0;this[_0xaf32('0x12')]=0x0;for(var _0x53c7f9=0x0;_0x53c7f9=0x0?this[_0xaf32('0x14')]:0x0;var _0x455506={'id':this['id'],'available':this[_0xaf32('0x14')],'loggedIn':this[_0xaf32('0x11')],'name':this[_0xaf32('0x5')],'paused':this['paused'],'waiting':this[_0xaf32('0xb')]};var _0x47bbcc=md5(JSON[_0xaf32('0x15')](_0x455506));if(this['md5']!==_0x47bbcc){this[_0xaf32('0xc')]=_0x47bbcc;io['to'](util['format'](_0xaf32('0x16'),_0x455506[_0xaf32('0x5')]))['emit'](_0xaf32('0x17'),_0x455506);}};module[_0xaf32('0x18')]=WhatsappQueue; \ No newline at end of file +var _0x1d4a=['md5','updateRouting','prototype','_rr','updateRealtime','loggedIn','paused','online','available','stringify','format','whatsapp:queue:%s','emit','whatsapp_queue:save','exports','lodash','util','ioredis','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting'];(function(_0x4aeec4,_0x17cf9f){var _0x295f0a=function(_0x2e1a28){while(--_0x2e1a28){_0x4aeec4['push'](_0x4aeec4['shift']());}};_0x295f0a(++_0x17cf9f);}(_0x1d4a,0x16b));var _0xa1d4=function(_0x4b4c5b,_0x37c500){_0x4b4c5b=_0x4b4c5b-0x0;var _0x54f74e=_0x1d4a[_0x4b4c5b];return _0x54f74e;};'use strict';var _=require(_0xa1d4('0x0'));var md5=require('md5');var util=require(_0xa1d4('0x1'));var Redis=require(_0xa1d4('0x2'));var config=require(_0xa1d4('0x3'));config['redis']=_[_0xa1d4('0x4')](config[_0xa1d4('0x5')],{'host':_0xa1d4('0x6'),'port':0x18eb});var io=require(_0xa1d4('0x7'))(new Redis(config[_0xa1d4('0x5')]));function WhatsappQueue(_0x2b203c){this['id']=_0x2b203c['id']||0x0;this[_0xa1d4('0x8')]=_0x2b203c[_0xa1d4('0x8')]||'';this[_0xa1d4('0x9')]=_0x2b203c[_0xa1d4('0x9')]||0xa;this[_0xa1d4('0xa')]=_0x2b203c[_0xa1d4('0xa')]||'beepall';this[_0xa1d4('0xb')]=_0x2b203c[_0xa1d4('0xb')];this[_0xa1d4('0xc')]={};this[_0xa1d4('0xd')]=0x0;this[_0xa1d4('0xe')]='';this[_0xa1d4('0xf')]();this['updateRealtime']();}WhatsappQueue[_0xa1d4('0x10')]['updateRouting']=function(){var _0x4f0d02=this[_0xa1d4('0xc')][_0xa1d4('0x11')];this[_0xa1d4('0xc')]=_['map'](this[_0xa1d4('0xb')],'id');this[_0xa1d4('0xc')]['_rr']=_0x4f0d02;};WhatsappQueue['prototype'][_0xa1d4('0x12')]=function(){this[_0xa1d4('0x13')]=0x0;this[_0xa1d4('0x14')]=0x0;for(var _0x14a7eb=0x0;_0x14a7eb=0x0?this[_0xa1d4('0x16')]:0x0;var _0x357796={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0xa1d4('0x8')],'paused':this[_0xa1d4('0x14')],'waiting':this[_0xa1d4('0xd')]};var _0x943cdb=md5(JSON[_0xa1d4('0x17')](_0x357796));if(this[_0xa1d4('0xe')]!==_0x943cdb){this[_0xa1d4('0xe')]=_0x943cdb;io['to'](util[_0xa1d4('0x18')](_0xa1d4('0x19'),_0x357796[_0xa1d4('0x8')]))[_0xa1d4('0x1a')](_0xa1d4('0x1b'),_0x357796);}};module[_0xa1d4('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 d91e9c1..d425b07 100644 --- a/server/services/routing/realtime/index.js +++ b/server/services/routing/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['isUndefined','initIntervals','updateRealtime','updateRouting','initSmsQueues','smsQueues','initMailQueues','mailQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','chatQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0xa9e0[_0x32d457];return _0x338386;};'use strict';var BPromise=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var moment=require('moment');var Agent=require('../model/agent');var Interval=require(_0x0a9e('0x3'));var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0x0a9e('0x4'));var SmsQueue=require(_0x0a9e('0x5'));var MailQueue=require(_0x0a9e('0x6'));var FaxQueue=require(_0x0a9e('0x7'));var WhatsappQueue=require(_0x0a9e('0x8'));var Realtime=function(){this['agents']={};this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]={};this[_0x0a9e('0xb')]={};this['smsQueues']={};this['mailQueues']={};this[_0x0a9e('0xc')]={};this['whatsappQueues']={};this['chatQueuesWaitingInteractions']={};this[_0x0a9e('0xd')]={};this[_0x0a9e('0xe')]={};this[_0x0a9e('0xf')]={};this[_0x0a9e('0x10')]={};this[_0x0a9e('0x11')]={};};function freeIsNotKey(_0xbd1168,_0x4a4c56,_0x50dfb2){var _0x527cdd=_['mapKeys'](_0xbd1168,function(_0x273d4d,_0x36471c){return _0x273d4d[_0x50dfb2];});for(var _0xd5b662 in _0x4a4c56){if(_0x4a4c56[_0x0a9e('0x12')](_0xd5b662)){if(!_0x527cdd[_0xd5b662]){delete _0x4a4c56[_0xd5b662];}}}}Realtime[_0x0a9e('0x13')][_0x0a9e('0x14')]=function(_0x5db4b0,_0x4283ce){for(var _0x239b12 in _0x4283ce){if(_0x5db4b0[_0x0a9e('0x12')](_0x239b12)){_0x5db4b0[_0x239b12]=_0x4283ce[_0x239b12];}}};Realtime[_0x0a9e('0x13')][_0x0a9e('0x15')]=function(){var _0x4d5611=this;return function(_0x52a03d){if(_0x52a03d){freeIsNotKey(_0x52a03d,_0x4d5611[_0x0a9e('0x16')],'id');for(var _0x5d0880=0x0,_0x1985b6={},_0x519dfd={};_0x5d0880<_0x52a03d[_0x0a9e('0x17')];_0x5d0880+=0x1){_0x1985b6=_0x52a03d[_0x5d0880];if(_[_0x0a9e('0x18')](_0x4d5611['agents'][_0x1985b6['id']])){_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']]=new Agent(_0x1985b6);}else{_0x4d5611['mergeFromDatabase'](_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']],_0x1985b6);}}}return _0x4d5611[_0x0a9e('0x16')];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x19')]=function(){var _0x31b1ca=this;return function(_0x2eb11f){if(_0x2eb11f){freeIsNotKey(_0x2eb11f,_0x31b1ca[_0x0a9e('0x9')],'id');for(var _0x20559e=0x0,_0x1314ae={},_0x112016={};_0x20559e<_0x2eb11f[_0x0a9e('0x17')];_0x20559e+=0x1){_0x1314ae=_0x2eb11f[_0x20559e];if(_[_0x0a9e('0x18')](_0x31b1ca['intervals'][_0x1314ae['id']])){_0x31b1ca[_0x0a9e('0x9')][_0x1314ae['id']]=new Interval(_0x1314ae);}else{_0x31b1ca[_0x0a9e('0x14')](_0x31b1ca['intervals'][_0x1314ae['id']],_0x1314ae);}}}return _0x31b1ca[_0x0a9e('0x9')];};};Realtime['prototype']['initOpenchannelQueues']=function(){var _0x3a02e1=this;return function(_0x432e56){if(_0x432e56){freeIsNotKey(_0x432e56,_0x3a02e1[_0x0a9e('0xa')],'id');for(var _0x30bae6=0x0,_0x4abc77={},_0xfb6e48={};_0x30bae6<_0x432e56[_0x0a9e('0x17')];_0x30bae6+=0x1){_0x4abc77=_0x432e56[_0x30bae6];if(_[_0x0a9e('0x18')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']])){_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']]=new OpenchannelQueue(_0x4abc77);}else{_0x3a02e1[_0x0a9e('0x14')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']],_0x4abc77);}_0x3a02e1['openchannelQueues'][_0x4abc77['id']]['updateRouting']();_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']][_0x0a9e('0x1a')]();}}return _0x3a02e1[_0x0a9e('0xa')];};};Realtime[_0x0a9e('0x13')]['initChatQueues']=function(){var _0x384319=this;return function(_0x479bc4){if(_0x479bc4){freeIsNotKey(_0x479bc4,_0x384319[_0x0a9e('0xb')],'id');for(var _0x5bfb33=0x0,_0x1dc186={},_0x34dc65={};_0x5bfb33<_0x479bc4[_0x0a9e('0x17')];_0x5bfb33+=0x1){_0x1dc186=_0x479bc4[_0x5bfb33];if(_[_0x0a9e('0x18')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']])){_0x384319[_0x0a9e('0xb')][_0x1dc186['id']]=new ChatQueue(_0x1dc186);}else{_0x384319[_0x0a9e('0x14')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']],_0x1dc186);}_0x384319['chatQueues'][_0x1dc186['id']][_0x0a9e('0x1b')]();_0x384319[_0x0a9e('0xb')][_0x1dc186['id']][_0x0a9e('0x1a')]();}}return _0x384319[_0x0a9e('0xb')];};};Realtime['prototype'][_0x0a9e('0x1c')]=function(){var _0x40e7a3=this;return function(_0x1843b2){if(_0x1843b2){freeIsNotKey(_0x1843b2,_0x40e7a3[_0x0a9e('0x1d')],'id');for(var _0x58b06f=0x0,_0x563b45={},_0x296f41={};_0x58b06f<_0x1843b2[_0x0a9e('0x17')];_0x58b06f+=0x1){_0x563b45=_0x1843b2[_0x58b06f];if(_[_0x0a9e('0x18')](_0x40e7a3['smsQueues'][_0x563b45['id']])){_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']]=new SmsQueue(_0x563b45);}else{_0x40e7a3['mergeFromDatabase'](_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']],_0x563b45);}_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1b')]();_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1a')]();}}return _0x40e7a3['smsQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x1e')]=function(){var _0x40cb85=this;return function(_0x2da5c0){if(_0x2da5c0){freeIsNotKey(_0x2da5c0,_0x40cb85[_0x0a9e('0x1f')],'id');for(var _0x409319=0x0,_0x332d35={},_0x39e565={};_0x409319<_0x2da5c0['length'];_0x409319+=0x1){_0x332d35=_0x2da5c0[_0x409319];if(_[_0x0a9e('0x18')](_0x40cb85['mailQueues'][_0x332d35['id']])){_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]=new MailQueue(_0x332d35);}else{_0x40cb85[_0x0a9e('0x14')](_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']],_0x332d35);}_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]['updateRouting']();_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']][_0x0a9e('0x1a')]();}}return _0x40cb85[_0x0a9e('0x1f')];};};Realtime[_0x0a9e('0x13')]['initFaxQueues']=function(){var _0x54135e=this;return function(_0x1e8694){if(_0x1e8694){freeIsNotKey(_0x1e8694,_0x54135e['faxQueues'],'id');for(var _0x24936a=0x0,_0x3d9717={},_0x381c37={};_0x24936a<_0x1e8694[_0x0a9e('0x17')];_0x24936a+=0x1){_0x3d9717=_0x1e8694[_0x24936a];if(_['isUndefined'](_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']])){_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]=new FaxQueue(_0x3d9717);}else{_0x54135e[_0x0a9e('0x14')](_0x54135e['faxQueues'][_0x3d9717['id']],_0x3d9717);}_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']][_0x0a9e('0x1b')]();_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]['updateRealtime']();}}return _0x54135e['faxQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x20')]=function(){var _0x5adda1=this;return function(_0x2b814e){if(_0x2b814e){freeIsNotKey(_0x2b814e,_0x5adda1[_0x0a9e('0x21')],'id');for(var _0x2e1b3a=0x0,_0x148f55={},_0x4b38d9={};_0x2e1b3a<_0x2b814e['length'];_0x2e1b3a+=0x1){_0x148f55=_0x2b814e[_0x2e1b3a];if(_[_0x0a9e('0x18')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']])){_0x5adda1['whatsappQueues'][_0x148f55['id']]=new WhatsappQueue(_0x148f55);}else{_0x5adda1[_0x0a9e('0x14')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']],_0x148f55);}_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']]['updateRouting']();_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']][_0x0a9e('0x1a')]();}}return _0x5adda1[_0x0a9e('0x21')];};};module[_0x0a9e('0x22')]=Realtime; \ No newline at end of file +var _0xa9e0=['isUndefined','initIntervals','updateRealtime','updateRouting','initSmsQueues','smsQueues','initMailQueues','mailQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','chatQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa9e0,0x123));var _0x0a9e=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xa9e0[_0x30ae5e];return _0x1f2e93;};'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 94f0167..67d54bf 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 _0x63d3=['AddTagsToChatInteraction','addTagsToChatInteraction','../client','Request','UpdateChatInteraction','updateChatInteraction','addTags'];(function(_0x5e05b3,_0x2cfa36){var _0x2452ff=function(_0x42b820){while(--_0x42b820){_0x5e05b3['push'](_0x5e05b3['shift']());}};_0x2452ff(++_0x2cfa36);}(_0x63d3,0x1de));var _0x363d=function(_0x1c1e68,_0x189f46){_0x1c1e68=_0x1c1e68-0x0;var _0x458961=_0x63d3[_0x1c1e68];return _0x458961;};'use strict';var client=require(_0x363d('0x0'));exports['update']=function(_0x2329fc,_0x259918){return client[_0x363d('0x1')](_0x363d('0x2'),{'body':_0x259918,'options':{'where':{'id':_0x2329fc}},'log':_0x363d('0x3')});};exports[_0x363d('0x4')]=function(_0x5ac599,_0x3b514c){return client['Request'](_0x363d('0x5'),{'body':_0x3b514c,'options':{'where':{'id':_0x5ac599}},'log':_0x363d('0x6')});}; \ No newline at end of file +var _0x888b=['updateChatInteraction','addTags','AddTagsToChatInteraction','addTagsToChatInteraction','../client','Request','UpdateChatInteraction'];(function(_0x2ced75,_0xf003d0){var _0x39fa86=function(_0x26d388){while(--_0x26d388){_0x2ced75['push'](_0x2ced75['shift']());}};_0x39fa86(++_0xf003d0);}(_0x888b,0xcf));var _0xb888=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x888b[_0x57b54c];return _0x59cc19;};'use strict';var client=require(_0xb888('0x0'));exports['update']=function(_0x24a99e,_0x6b33df){return client[_0xb888('0x1')](_0xb888('0x2'),{'body':_0x6b33df,'options':{'where':{'id':_0x24a99e}},'log':_0xb888('0x3')});};exports[_0xb888('0x4')]=function(_0x1c8354,_0x3606e7){return client[_0xb888('0x1')](_0xb888('0x5'),{'body':_0x3606e7,'options':{'where':{'id':_0x1c8354}},'log':_0xb888('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index fa6bd94..5806d52 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 _0x226d=['Request','CreateChatMessage','create'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x226d,0xa4));var _0xd226=function(_0x23957f,_0x122338){_0x23957f=_0x23957f-0x0;var _0x1291cb=_0x226d[_0x23957f];return _0x1291cb;};'use strict';var client=require('../client');exports[_0xd226('0x0')]=function(_0x2f54a3){return client[_0xd226('0x1')](_0xd226('0x2'),{'body':_0x2f54a3,'log':'createChatMessage'});}; \ No newline at end of file +var _0x6e6a=['create','Request','CreateChatMessage','createChatMessage','../client'];(function(_0x18fb16,_0x45edbc){var _0x147b0d=function(_0x5b1b00){while(--_0x5b1b00){_0x18fb16['push'](_0x18fb16['shift']());}};_0x147b0d(++_0x45edbc);}(_0x6e6a,0xa4));var _0xa6e6=function(_0x1a9bd9,_0x38fc9b){_0x1a9bd9=_0x1a9bd9-0x0;var _0x4845b4=_0x6e6a[_0x1a9bd9];return _0x4845b4;};'use strict';var client=require(_0xa6e6('0x0'));exports[_0xa6e6('0x1')]=function(_0x3ab034){return client[_0xa6e6('0x2')](_0xa6e6('0x3'),{'body':_0x3ab034,'log':_0xa6e6('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index a6ad50a..5be9e64 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 _0x54da=['Agents','name','online','../client','Request','timeout','User'];(function(_0x197185,_0x251145){var _0x2c8af1=function(_0x1dbcfd){while(--_0x1dbcfd){_0x197185['push'](_0x197185['shift']());}};_0x2c8af1(++_0x251145);}(_0x54da,0x9d));var _0xa54d=function(_0x550151,_0x49d953){_0x550151=_0x550151-0x0;var _0x1ba3cb=_0x54da[_0x550151];return _0x1ba3cb;};'use strict';var client=require(_0xa54d('0x0'));exports['getChatQueues']=function(){return function(){return client[_0xa54d('0x1')]('GetChatQueue',{'options':{'raw':![],'attributes':['id','name',_0xa54d('0x2'),'strategy'],'include':[{'model':_0xa54d('0x3'),'as':_0xa54d('0x4'),'attributes':['id',_0xa54d('0x5'),_0xa54d('0x6'),'chatPause']}]},'log':'getChatQueues'});};}; \ No newline at end of file +var _0x00b3=['User','Agents','chatPause','getChatQueues','../client','GetChatQueue','name'];(function(_0x36eaaa,_0x326732){var _0x461349=function(_0x4e4180){while(--_0x4e4180){_0x36eaaa['push'](_0x36eaaa['shift']());}};_0x461349(++_0x326732);}(_0x00b3,0x97));var _0x300b=function(_0x5819e4,_0xb8e9ab){_0x5819e4=_0x5819e4-0x0;var _0x535376=_0x00b3[_0x5819e4];return _0x535376;};'use strict';var client=require(_0x300b('0x0'));exports['getChatQueues']=function(){return function(){return client['Request'](_0x300b('0x1'),{'options':{'raw':![],'attributes':['id',_0x300b('0x2'),'timeout','strategy'],'include':[{'model':_0x300b('0x3'),'as':_0x300b('0x4'),'attributes':['id',_0x300b('0x2'),'online',_0x300b('0x5')]}]},'log':_0x300b('0x6')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index 3cfc10d..59d9909 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 _0xf874=['update','UpdateChatQueueReport','DESC','../client','Request','CreateChatQueueReport'];(function(_0x570432,_0x29ec48){var _0x20f99f=function(_0xad0666){while(--_0xad0666){_0x570432['push'](_0x570432['shift']());}};_0x20f99f(++_0x29ec48);}(_0xf874,0x177));var _0x4f87=function(_0x4431a0,_0x5ab684){_0x4431a0=_0x4431a0-0x0;var _0x109890=_0xf874[_0x4431a0];return _0x109890;};'use strict';var client=require(_0x4f87('0x0'));exports['create']=function(_0x391d9f){return client[_0x4f87('0x1')](_0x4f87('0x2'),{'body':_0x391d9f,'log':_0x4f87('0x2')});};exports[_0x4f87('0x3')]=function(_0xe4464e,_0x87123d){return client['Request'](_0x4f87('0x4'),{'body':_0x87123d,'options':{'where':{'uniqueid':_0xe4464e},'order':[['id',_0x4f87('0x5')]],'limit':0x1},'log':'UpdateChatQueueReport'});}; \ No newline at end of file +var _0xc7e9=['../client','create','Request','CreateChatQueueReport','DESC'];(function(_0x455de7,_0x183e57){var _0x4833ba=function(_0x23c1d2){while(--_0x23c1d2){_0x455de7['push'](_0x455de7['shift']());}};_0x4833ba(++_0x183e57);}(_0xc7e9,0x1ef));var _0x9c7e=function(_0x44946b,_0xf874ec){_0x44946b=_0x44946b-0x0;var _0x249bc4=_0xc7e9[_0x44946b];return _0x249bc4;};'use strict';var client=require(_0x9c7e('0x0'));exports[_0x9c7e('0x1')]=function(_0x581e2d){return client[_0x9c7e('0x2')](_0x9c7e('0x3'),{'body':_0x581e2d,'log':_0x9c7e('0x3')});};exports['update']=function(_0x340997,_0x34cef0){return client['Request']('UpdateChatQueueReport',{'body':_0x34cef0,'options':{'where':{'uniqueid':_0x340997},'order':[['id',_0x9c7e('0x4')]],'limit':0x1},'log':'UpdateChatQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index c1d5b44..8ea33c6 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(_0x5d312b,_0x38cf18){var _0x4dd79c=function(_0x3b68ce){while(--_0x3b68ce){_0x5d312b['push'](_0x5d312b['shift']());}};_0x4dd79c(++_0x38cf18);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'use strict';var client=require(_0x7995('0x0'));exports[_0x7995('0x1')]=function(_0x2722a3,_0x10a05d){return client['Request'](_0x7995('0x2'),{'body':_0x10a05d,'options':{'where':{'id':_0x2722a3}},'log':_0x7995('0x3')});};exports[_0x7995('0x4')]=function(_0x462a03,_0x576d89){return client[_0x7995('0x5')](_0x7995('0x6'),{'body':_0x576d89,'options':{'where':{'id':_0x462a03}},'log':_0x7995('0x7')});}; \ No newline at end of file +var _0x7a54=['Request','UpdateFaxInteraction','addTags','AddTagsToFaxInteraction','../client','update'];(function(_0x2bf141,_0x31eac7){var _0x48277b=function(_0x9fe560){while(--_0x9fe560){_0x2bf141['push'](_0x2bf141['shift']());}};_0x48277b(++_0x31eac7);}(_0x7a54,0x106));var _0x47a5=function(_0x20aaa8,_0x4c0516){_0x20aaa8=_0x20aaa8-0x0;var _0x19bcf2=_0x7a54[_0x20aaa8];return _0x19bcf2;};'use strict';var client=require(_0x47a5('0x0'));exports[_0x47a5('0x1')]=function(_0x44b31e,_0x58157c){return client[_0x47a5('0x2')](_0x47a5('0x3'),{'body':_0x58157c,'options':{'where':{'id':_0x44b31e}},'log':'updateFaxInteraction'});};exports[_0x47a5('0x4')]=function(_0x11bf85,_0x2a1a7e){return client[_0x47a5('0x2')](_0x47a5('0x5'),{'body':_0x2a1a7e,'options':{'where':{'id':_0x11bf85}},'log':'addTagsToFaxInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index a063406..04db222 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 _0x5c26=['CreateFaxMessage','create','Request'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x5c26,0x1c6));var _0x65c2=function(_0x47abc9,_0x83ca19){_0x47abc9=_0x47abc9-0x0;var _0x1dceaa=_0x5c26[_0x47abc9];return _0x1dceaa;};'use strict';var client=require('../client');exports[_0x65c2('0x0')]=function(_0x514fba){return client[_0x65c2('0x1')](_0x65c2('0x2'),{'body':_0x514fba,'log':'createFaxMessage'});}; \ No newline at end of file +var _0x4cf1=['CreateFaxMessage','createFaxMessage','create','Request'];(function(_0x4063a4,_0x19d730){var _0x17908d=function(_0x3ce714){while(--_0x3ce714){_0x4063a4['push'](_0x4063a4['shift']());}};_0x17908d(++_0x19d730);}(_0x4cf1,0x12a));var _0x14cf=function(_0x15ea09,_0x2f30ab){_0x15ea09=_0x15ea09-0x0;var _0x3e9c78=_0x4cf1[_0x15ea09];return _0x3e9c78;};'use strict';var client=require('../client');exports[_0x14cf('0x0')]=function(_0x4687af){return client[_0x14cf('0x1')](_0x14cf('0x2'),{'body':_0x4687af,'log':_0x14cf('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index a183567..0a87c3d 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 _0xff2f=['faxPause','../client','getFaxQueues','Request','GetFaxQueue','name','strategy','Agents'];(function(_0xea66c8,_0x13b73e){var _0x7b950=function(_0x59cf60){while(--_0x59cf60){_0xea66c8['push'](_0xea66c8['shift']());}};_0x7b950(++_0x13b73e);}(_0xff2f,0xa9));var _0xfff2=function(_0xa34f01,_0x4dfd44){_0xa34f01=_0xa34f01-0x0;var _0x34c117=_0xff2f[_0xa34f01];return _0x34c117;};'use strict';var client=require(_0xfff2('0x0'));exports[_0xfff2('0x1')]=function(){return function(){return client[_0xfff2('0x2')](_0xfff2('0x3'),{'options':{'raw':![],'attributes':['id',_0xfff2('0x4'),'timeout',_0xfff2('0x5')],'include':[{'model':'User','as':_0xfff2('0x6'),'attributes':['id',_0xfff2('0x4'),'online',_0xfff2('0x7')]}]},'log':_0xfff2('0x1')});};}; \ No newline at end of file +var _0x9d0a=['name','timeout','strategy','User','Agents','online','getFaxQueues','../client'];(function(_0x15ca89,_0x24f5cd){var _0x3ed187=function(_0x38cd02){while(--_0x38cd02){_0x15ca89['push'](_0x15ca89['shift']());}};_0x3ed187(++_0x24f5cd);}(_0x9d0a,0xa7));var _0xa9d0=function(_0x4ea571,_0x524bc2){_0x4ea571=_0x4ea571-0x0;var _0x122eba=_0x9d0a[_0x4ea571];return _0x122eba;};'use strict';var client=require(_0xa9d0('0x0'));exports['getFaxQueues']=function(){return function(){return client['Request']('GetFaxQueue',{'options':{'raw':![],'attributes':['id',_0xa9d0('0x1'),_0xa9d0('0x2'),_0xa9d0('0x3')],'include':[{'model':_0xa9d0('0x4'),'as':_0xa9d0('0x5'),'attributes':['id','name',_0xa9d0('0x6'),'faxPause']}]},'log':_0xa9d0('0x7')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index d1dac9c..06cce64 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 _0x0d73=['update','UpdateFaxQueueReport','DESC','../client','create','Request','CreateFaxQueueReport'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0x0d73,0x15a));var _0x30d7=function(_0x1967d3,_0x42f943){_0x1967d3=_0x1967d3-0x0;var _0xa9d34e=_0x0d73[_0x1967d3];return _0xa9d34e;};'use strict';var client=require(_0x30d7('0x0'));exports[_0x30d7('0x1')]=function(_0x3f6a47){return client[_0x30d7('0x2')](_0x30d7('0x3'),{'body':_0x3f6a47,'log':_0x30d7('0x3')});};exports[_0x30d7('0x4')]=function(_0x57cd76,_0xfcc7e6){return client[_0x30d7('0x2')](_0x30d7('0x5'),{'body':_0xfcc7e6,'options':{'where':{'uniqueid':_0x57cd76},'order':[['id',_0x30d7('0x6')]],'limit':0x1},'log':'UpdateFaxQueueReport'});}; \ No newline at end of file +var _0x654d=['Request','CreateFaxQueueReport','update','UpdateFaxQueueReport','DESC','../client','create'];(function(_0x4e63f1,_0x34a2db){var _0xdbd910=function(_0x40261f){while(--_0x40261f){_0x4e63f1['push'](_0x4e63f1['shift']());}};_0xdbd910(++_0x34a2db);}(_0x654d,0x194));var _0xd654=function(_0x9ac872,_0x1cbaf2){_0x9ac872=_0x9ac872-0x0;var _0x4d7788=_0x654d[_0x9ac872];return _0x4d7788;};'use strict';var client=require(_0xd654('0x0'));exports[_0xd654('0x1')]=function(_0x2b63f4){return client[_0xd654('0x2')]('CreateFaxQueueReport',{'body':_0x2b63f4,'log':_0xd654('0x3')});};exports[_0xd654('0x4')]=function(_0x1e524c,_0x450224){return client[_0xd654('0x2')](_0xd654('0x5'),{'body':_0x450224,'options':{'where':{'uniqueid':_0x1e524c},'order':[['id',_0xd654('0x6')]],'limit':0x1},'log':_0xd654('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index be84616..d48a593 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 _0x6c09=['getIntervals','Request','name','Intervals','interval','../client'];(function(_0x4da493,_0x15e45a){var _0x33e403=function(_0x11dfd3){while(--_0x11dfd3){_0x4da493['push'](_0x4da493['shift']());}};_0x33e403(++_0x15e45a);}(_0x6c09,0x14f));var _0x96c0=function(_0xdd69ea,_0x3555fd){_0xdd69ea=_0xdd69ea-0x0;var _0x19af0b=_0x6c09[_0xdd69ea];return _0x19af0b;};'use strict';var client=require(_0x96c0('0x0'));exports[_0x96c0('0x1')]=function(){return function(){return client[_0x96c0('0x2')]('GetInterval',{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x96c0('0x3')],'include':[{'model':'Interval','as':_0x96c0('0x4'),'attributes':['id','name',_0x96c0('0x5')]}]},'log':_0x96c0('0x1')});};}; \ No newline at end of file +var _0xc683=['interval','../client','getIntervals','Request','GetInterval','name','Intervals'];(function(_0x40d047,_0x11e68b){var _0x338368=function(_0x181db5){while(--_0x181db5){_0x40d047['push'](_0x40d047['shift']());}};_0x338368(++_0x11e68b);}(_0xc683,0x1c1));var _0x3c68=function(_0x631a3c,_0x1b61b6){_0x631a3c=_0x631a3c-0x0;var _0x2bdfa3=_0xc683[_0x631a3c];return _0x2bdfa3;};'use strict';var client=require(_0x3c68('0x0'));exports[_0x3c68('0x1')]=function(){return function(){return client[_0x3c68('0x2')](_0x3c68('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x3c68('0x4')],'include':[{'model':'Interval','as':_0x3c68('0x5'),'attributes':['id','name',_0x3c68('0x6')]}]},'log':_0x3c68('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index de6be52..841eba7 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 _0x32f4=['updateMailInteraction','Request','AddTagsToMailInteraction','addTagsToChatInteraction','../client','update','UpdateMailInteraction'];(function(_0xe84074,_0xaf6bcf){var _0x4de41a=function(_0x3ed7c0){while(--_0x3ed7c0){_0xe84074['push'](_0xe84074['shift']());}};_0x4de41a(++_0xaf6bcf);}(_0x32f4,0x154));var _0x432f=function(_0x5177c5,_0x2b3d33){_0x5177c5=_0x5177c5-0x0;var _0x4783d6=_0x32f4[_0x5177c5];return _0x4783d6;};'use strict';var client=require(_0x432f('0x0'));exports[_0x432f('0x1')]=function(_0x29845b,_0x2b22ad){return client['Request'](_0x432f('0x2'),{'body':_0x2b22ad,'options':{'where':{'id':_0x29845b}},'log':_0x432f('0x3')});};exports['addTags']=function(_0x354293,_0x1eabac){return client[_0x432f('0x4')](_0x432f('0x5'),{'body':_0x1eabac,'options':{'where':{'id':_0x354293}},'log':_0x432f('0x6')});}; \ No newline at end of file +var _0x02ce=['addTagsToChatInteraction','../client','update','Request','updateMailInteraction','addTags','AddTagsToMailInteraction'];(function(_0x57c064,_0x39ad94){var _0x668959=function(_0x5bf7b5){while(--_0x5bf7b5){_0x57c064['push'](_0x57c064['shift']());}};_0x668959(++_0x39ad94);}(_0x02ce,0x1ac));var _0xe02c=function(_0x12d3c0,_0x31b823){_0x12d3c0=_0x12d3c0-0x0;var _0x242b52=_0x02ce[_0x12d3c0];return _0x242b52;};'use strict';var client=require(_0xe02c('0x0'));exports[_0xe02c('0x1')]=function(_0x3f9bc7,_0x5a49d9){return client[_0xe02c('0x2')]('UpdateMailInteraction',{'body':_0x5a49d9,'options':{'where':{'id':_0x3f9bc7}},'log':_0xe02c('0x3')});};exports[_0xe02c('0x4')]=function(_0x46475c,_0xf4b764){return client[_0xe02c('0x2')](_0xe02c('0x5'),{'body':_0xf4b764,'options':{'where':{'id':_0x46475c}},'log':_0xe02c('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index 2ddb963..c6916d6 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 _0xbd63=['Request','createMailMessage','../client','create'];(function(_0x1a3f6c,_0x2177cc){var _0x361953=function(_0x270019){while(--_0x270019){_0x1a3f6c['push'](_0x1a3f6c['shift']());}};_0x361953(++_0x2177cc);}(_0xbd63,0x1d2));var _0x3bd6=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xbd63[_0x4a9fb1];return _0x348672;};'use strict';var client=require(_0x3bd6('0x0'));exports[_0x3bd6('0x1')]=function(_0x20259a){return client[_0x3bd6('0x2')]('CreateMailMessage',{'body':_0x20259a,'log':_0x3bd6('0x3')});}; \ No newline at end of file +var _0x91dc=['CreateMailMessage','createMailMessage','create','Request'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x91dc,0x8a));var _0xc91d=function(_0x275e93,_0x23d397){_0x275e93=_0x275e93-0x0;var _0x2617d6=_0x91dc[_0x275e93];return _0x2617d6;};'use strict';var client=require('../client');exports[_0xc91d('0x0')]=function(_0x3b8c59){return client[_0xc91d('0x1')](_0xc91d('0x2'),{'body':_0x3b8c59,'log':_0xc91d('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index 11f8c93..b2d986c 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 _0xd242=['timeout','strategy','User','Agents','getMailQueues','../client','Request','GetMailQueue','name'];(function(_0x4e9086,_0x4167a4){var _0x23b71f=function(_0x2f08f0){while(--_0x2f08f0){_0x4e9086['push'](_0x4e9086['shift']());}};_0x23b71f(++_0x4167a4);}(_0xd242,0x137));var _0x2d24=function(_0x4ee2be,_0x188b82){_0x4ee2be=_0x4ee2be-0x0;var _0x165535=_0xd242[_0x4ee2be];return _0x165535;};'use strict';var client=require(_0x2d24('0x0'));exports['getMailQueues']=function(){return function(){return client[_0x2d24('0x1')](_0x2d24('0x2'),{'options':{'raw':![],'attributes':['id',_0x2d24('0x3'),_0x2d24('0x4'),_0x2d24('0x5')],'include':[{'model':_0x2d24('0x6'),'as':_0x2d24('0x7'),'attributes':['id',_0x2d24('0x3'),'online','mailPause']}]},'log':_0x2d24('0x8')});};}; \ No newline at end of file +var _0x0ea9=['online','getMailQueues','../client','Request','GetMailQueue','timeout','strategy','User','Agents','name'];(function(_0x545a7f,_0x4fee82){var _0x1e6e03=function(_0x8507bd){while(--_0x8507bd){_0x545a7f['push'](_0x545a7f['shift']());}};_0x1e6e03(++_0x4fee82);}(_0x0ea9,0x160));var _0x90ea=function(_0xf3af93,_0x40fcb6){_0xf3af93=_0xf3af93-0x0;var _0x19a5b9=_0x0ea9[_0xf3af93];return _0x19a5b9;};'use strict';var client=require(_0x90ea('0x0'));exports['getMailQueues']=function(){return function(){return client[_0x90ea('0x1')](_0x90ea('0x2'),{'options':{'raw':![],'attributes':['id','name',_0x90ea('0x3'),_0x90ea('0x4')],'include':[{'model':_0x90ea('0x5'),'as':_0x90ea('0x6'),'attributes':['id',_0x90ea('0x7'),_0x90ea('0x8'),'mailPause']}]},'log':_0x90ea('0x9')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index 4e23277..329236a 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 _0x0ef9=['create','CreateMailQueueReport','update','UpdateMailQueueReport','DESC'];(function(_0x752d50,_0x4f8e32){var _0x1876a5=function(_0x510001){while(--_0x510001){_0x752d50['push'](_0x752d50['shift']());}};_0x1876a5(++_0x4f8e32);}(_0x0ef9,0x6e));var _0x90ef=function(_0x17ec16,_0x2436e3){_0x17ec16=_0x17ec16-0x0;var _0x1f59f5=_0x0ef9[_0x17ec16];return _0x1f59f5;};'use strict';var client=require('../client');exports[_0x90ef('0x0')]=function(_0x28a634){return client['Request'](_0x90ef('0x1'),{'body':_0x28a634,'log':'CreateMailQueueReport'});};exports[_0x90ef('0x2')]=function(_0x536077,_0x2cafac){return client['Request'](_0x90ef('0x3'),{'body':_0x2cafac,'options':{'where':{'uniqueid':_0x536077},'order':[['id',_0x90ef('0x4')]],'limit':0x1},'log':_0x90ef('0x3')});}; \ No newline at end of file +var _0xb17b=['CreateMailQueueReport','UpdateMailQueueReport','DESC','../client','create','Request'];(function(_0x46c10c,_0x264f5d){var _0x149abe=function(_0x35b840){while(--_0x35b840){_0x46c10c['push'](_0x46c10c['shift']());}};_0x149abe(++_0x264f5d);}(_0xb17b,0x135));var _0xbb17=function(_0xa05b55,_0x126064){_0xa05b55=_0xa05b55-0x0;var _0x599a97=_0xb17b[_0xa05b55];return _0x599a97;};'use strict';var client=require(_0xbb17('0x0'));exports[_0xbb17('0x1')]=function(_0x3f4cbc){return client[_0xbb17('0x2')](_0xbb17('0x3'),{'body':_0x3f4cbc,'log':_0xbb17('0x3')});};exports['update']=function(_0x44694a,_0x210e65){return client[_0xbb17('0x2')](_0xbb17('0x4'),{'body':_0x210e65,'options':{'where':{'uniqueid':_0x44694a},'order':[['id',_0xbb17('0x5')]],'limit':0x1},'log':_0xbb17('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index dbc115d..ecab3ea 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 _0xc2da=['../client','update','Request','UpdateOpenchannelInteraction','AddTagsToOpenchannelInteraction','addTagsToChatInteraction'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0xc2da,0x156));var _0xac2d=function(_0x5a6e7b,_0x3dabdc){_0x5a6e7b=_0x5a6e7b-0x0;var _0x5bef75=_0xc2da[_0x5a6e7b];return _0x5bef75;};'use strict';var client=require(_0xac2d('0x0'));exports[_0xac2d('0x1')]=function(_0x50ac8e,_0x4a5eac){return client[_0xac2d('0x2')](_0xac2d('0x3'),{'body':_0x4a5eac,'options':{'where':{'id':_0x50ac8e}},'log':'updateOpenchannelInteraction'});};exports['addTags']=function(_0x2b19ce,_0x1940bd){return client[_0xac2d('0x2')](_0xac2d('0x4'),{'body':_0x1940bd,'options':{'where':{'id':_0x2b19ce}},'log':_0xac2d('0x5')});}; \ No newline at end of file +var _0x4034=['addTags','addTagsToChatInteraction','../client','update','Request','UpdateOpenchannelInteraction','updateOpenchannelInteraction'];(function(_0x4b1d61,_0x306115){var _0x509071=function(_0x2bc341){while(--_0x2bc341){_0x4b1d61['push'](_0x4b1d61['shift']());}};_0x509071(++_0x306115);}(_0x4034,0x14b));var _0x4403=function(_0x4d6f6f,_0xef3141){_0x4d6f6f=_0x4d6f6f-0x0;var _0x4b7e32=_0x4034[_0x4d6f6f];return _0x4b7e32;};'use strict';var client=require(_0x4403('0x0'));exports[_0x4403('0x1')]=function(_0x97792b,_0x3ca213){return client[_0x4403('0x2')](_0x4403('0x3'),{'body':_0x3ca213,'options':{'where':{'id':_0x97792b}},'log':_0x4403('0x4')});};exports[_0x4403('0x5')]=function(_0x497924,_0x563c95){return client[_0x4403('0x2')]('AddTagsToOpenchannelInteraction',{'body':_0x563c95,'options':{'where':{'id':_0x497924}},'log':_0x4403('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index 834b2f3..b00088f 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 _0xa4f4=['../client','create','Request','CreateOpenchannelMessage','createOpenchannelMessage'];(function(_0x5012e0,_0x47a186){var _0x72706d=function(_0x13d02e){while(--_0x13d02e){_0x5012e0['push'](_0x5012e0['shift']());}};_0x72706d(++_0x47a186);}(_0xa4f4,0x1ea));var _0x4a4f=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xa4f4[_0x57b54c];return _0x59cc19;};'use strict';var client=require(_0x4a4f('0x0'));exports[_0x4a4f('0x1')]=function(_0x19dae4){return client[_0x4a4f('0x2')](_0x4a4f('0x3'),{'body':_0x19dae4,'log':_0x4a4f('0x4')});}; \ No newline at end of file +var _0x79fa=['createOpenchannelMessage','create','Request','CreateOpenchannelMessage'];(function(_0x23d87e,_0x59568e){var _0x28c37b=function(_0x53f521){while(--_0x53f521){_0x23d87e['push'](_0x23d87e['shift']());}};_0x28c37b(++_0x59568e);}(_0x79fa,0x1e9));var _0xa79f=function(_0x1cea16,_0x9ef2b4){_0x1cea16=_0x1cea16-0x0;var _0x286dac=_0x79fa[_0x1cea16];return _0x286dac;};'use strict';var client=require('../client');exports[_0xa79f('0x0')]=function(_0x262d8d){return client[_0xa79f('0x1')](_0xa79f('0x2'),{'body':_0x262d8d,'log':_0xa79f('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index 5deecc2..cd84b14 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 _0x958f=['GetOpenchannelQueue','name','strategy','Agents','online','openchannelPause','../client','getOpenchannelQueues','Request'];(function(_0x27793a,_0x1bf59a){var _0x4dc325=function(_0x2ccf27){while(--_0x2ccf27){_0x27793a['push'](_0x27793a['shift']());}};_0x4dc325(++_0x1bf59a);}(_0x958f,0x114));var _0xf958=function(_0x599f41,_0x4db732){_0x599f41=_0x599f41-0x0;var _0x2e4d58=_0x958f[_0x599f41];return _0x2e4d58;};'use strict';var client=require(_0xf958('0x0'));exports[_0xf958('0x1')]=function(){return function(){return client[_0xf958('0x2')](_0xf958('0x3'),{'options':{'raw':![],'attributes':['id',_0xf958('0x4'),'timeout',_0xf958('0x5')],'include':[{'model':'User','as':_0xf958('0x6'),'attributes':['id','name',_0xf958('0x7'),_0xf958('0x8')]}]},'log':'getOpenchannelQueues'});};}; \ No newline at end of file +var _0x8937=['GetOpenchannelQueue','name','Agents','online','openchannelPause','../client','getOpenchannelQueues','Request'];(function(_0x1bb191,_0x552afb){var _0x31b09f=function(_0x385788){while(--_0x385788){_0x1bb191['push'](_0x1bb191['shift']());}};_0x31b09f(++_0x552afb);}(_0x8937,0x15d));var _0x7893=function(_0x335b4f,_0x3fe10d){_0x335b4f=_0x335b4f-0x0;var _0x3b02de=_0x8937[_0x335b4f];return _0x3b02de;};'use strict';var client=require(_0x7893('0x0'));exports[_0x7893('0x1')]=function(){return function(){return client[_0x7893('0x2')](_0x7893('0x3'),{'options':{'raw':![],'attributes':['id',_0x7893('0x4'),'timeout','strategy'],'include':[{'model':'User','as':_0x7893('0x5'),'attributes':['id',_0x7893('0x4'),_0x7893('0x6'),_0x7893('0x7')]}]},'log':_0x7893('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index cf31087..5688020 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 _0x62ed=['update','DESC','UpdateOpenchannelQueueReport','create','CreateOpenchannelQueueReport'];(function(_0xe45118,_0x5dffbc){var _0x15e15d=function(_0x17eaec){while(--_0x17eaec){_0xe45118['push'](_0xe45118['shift']());}};_0x15e15d(++_0x5dffbc);}(_0x62ed,0x18e));var _0xd62e=function(_0x3408f0,_0x190d1b){_0x3408f0=_0x3408f0-0x0;var _0x271e2d=_0x62ed[_0x3408f0];return _0x271e2d;};'use strict';var client=require('../client');exports[_0xd62e('0x0')]=function(_0xe2aebc){return client['Request'](_0xd62e('0x1'),{'body':_0xe2aebc,'log':_0xd62e('0x1')});};exports[_0xd62e('0x2')]=function(_0x94c426,_0x2c395c){return client['Request']('UpdateOpenchannelQueueReport',{'body':_0x2c395c,'options':{'where':{'uniqueid':_0x94c426},'order':[['id',_0xd62e('0x3')]],'limit':0x1},'log':_0xd62e('0x4')});}; \ No newline at end of file +var _0xed26=['../client','Request','CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport'];(function(_0x5e4a4c,_0x1b8d7e){var _0x1afefb=function(_0x2f4eb0){while(--_0x2f4eb0){_0x5e4a4c['push'](_0x5e4a4c['shift']());}};_0x1afefb(++_0x1b8d7e);}(_0xed26,0x64));var _0x6ed2=function(_0x19d8ea,_0x6d5425){_0x19d8ea=_0x19d8ea-0x0;var _0x565b43=_0xed26[_0x19d8ea];return _0x565b43;};'use strict';var client=require(_0x6ed2('0x0'));exports['create']=function(_0x4ad5e7){return client[_0x6ed2('0x1')](_0x6ed2('0x2'),{'body':_0x4ad5e7,'log':_0x6ed2('0x2')});};exports[_0x6ed2('0x3')]=function(_0x3de2f8,_0x5c5aaa){return client['Request'](_0x6ed2('0x4'),{'body':_0x5c5aaa,'options':{'where':{'uniqueid':_0x3de2f8},'order':[['id','DESC']],'limit':0x1},'log':_0x6ed2('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index 193aa93..7f7ed36 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 _0x1f63=['addTags','AddTagsToSmsInteraction','addTagsToSmsInteraction','../client','update','Request','UpdateSmsInteraction'];(function(_0x2749b8,_0x570e1c){var _0x589657=function(_0x4b5169){while(--_0x4b5169){_0x2749b8['push'](_0x2749b8['shift']());}};_0x589657(++_0x570e1c);}(_0x1f63,0x7a));var _0x31f6=function(_0x575c6b,_0x6c4c22){_0x575c6b=_0x575c6b-0x0;var _0x438856=_0x1f63[_0x575c6b];return _0x438856;};'use strict';var client=require(_0x31f6('0x0'));exports[_0x31f6('0x1')]=function(_0x57257d,_0x165252){return client[_0x31f6('0x2')](_0x31f6('0x3'),{'body':_0x165252,'options':{'where':{'id':_0x57257d}},'log':'updateSmsInteraction'});};exports[_0x31f6('0x4')]=function(_0x33b415,_0x5326b7){return client['Request'](_0x31f6('0x5'),{'body':_0x5326b7,'options':{'where':{'id':_0x33b415}},'log':_0x31f6('0x6')});}; \ No newline at end of file +var _0x92e8=['addTagsToSmsInteraction','../client','UpdateSmsInteraction','updateSmsInteraction','addTags','Request'];(function(_0x3d40e3,_0x3229f2){var _0x43ff73=function(_0x46ff0f){while(--_0x46ff0f){_0x3d40e3['push'](_0x3d40e3['shift']());}};_0x43ff73(++_0x3229f2);}(_0x92e8,0x7f));var _0x892e=function(_0x2ef8c1,_0x2f72f4){_0x2ef8c1=_0x2ef8c1-0x0;var _0x288305=_0x92e8[_0x2ef8c1];return _0x288305;};'use strict';var client=require(_0x892e('0x0'));exports['update']=function(_0x5b0726,_0x354c6e){return client['Request'](_0x892e('0x1'),{'body':_0x354c6e,'options':{'where':{'id':_0x5b0726}},'log':_0x892e('0x2')});};exports[_0x892e('0x3')]=function(_0xe95e5f,_0x297ee4){return client[_0x892e('0x4')]('AddTagsToSmsInteraction',{'body':_0x297ee4,'options':{'where':{'id':_0xe95e5f}},'log':_0x892e('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index ba04aca..c8eece6 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 _0x48fc=['../client','create','Request','createSmsMessage'];(function(_0x5b0cdb,_0x3dd3e3){var _0x199c8e=function(_0x565ab2){while(--_0x565ab2){_0x5b0cdb['push'](_0x5b0cdb['shift']());}};_0x199c8e(++_0x3dd3e3);}(_0x48fc,0x148));var _0xc48f=function(_0x3706bb,_0x2679e1){_0x3706bb=_0x3706bb-0x0;var _0x5c498b=_0x48fc[_0x3706bb];return _0x5c498b;};'use strict';var client=require(_0xc48f('0x0'));exports[_0xc48f('0x1')]=function(_0x47ca63){return client[_0xc48f('0x2')]('CreateSmsMessage',{'body':_0x47ca63,'log':_0xc48f('0x3')});}; \ No newline at end of file +var _0x0b34=['createSmsMessage','../client','create'];(function(_0x1f4f41,_0x4e0e7a){var _0x5e51c4=function(_0x5a8b27){while(--_0x5a8b27){_0x1f4f41['push'](_0x1f4f41['shift']());}};_0x5e51c4(++_0x4e0e7a);}(_0x0b34,0x6a));var _0x40b3=function(_0x4957d1,_0x4416f1){_0x4957d1=_0x4957d1-0x0;var _0x2e5164=_0x0b34[_0x4957d1];return _0x2e5164;};'use strict';var client=require(_0x40b3('0x0'));exports[_0x40b3('0x1')]=function(_0xbe0e17){return client['Request']('CreateSmsMessage',{'body':_0xbe0e17,'log':_0x40b3('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 1b7293d..6dabed1 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 _0xe706=['Agents','online','smsPause','../client','getSmsQueues','Request','name','timeout','strategy','User'];(function(_0x424a32,_0x74d7e5){var _0x5393bf=function(_0x171b99){while(--_0x171b99){_0x424a32['push'](_0x424a32['shift']());}};_0x5393bf(++_0x74d7e5);}(_0xe706,0xa3));var _0x6e70=function(_0x336df4,_0x52c1dc){_0x336df4=_0x336df4-0x0;var _0x580d8c=_0xe706[_0x336df4];return _0x580d8c;};'use strict';var client=require(_0x6e70('0x0'));exports[_0x6e70('0x1')]=function(){return function(){return client[_0x6e70('0x2')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id',_0x6e70('0x3'),_0x6e70('0x4'),_0x6e70('0x5')],'include':[{'model':_0x6e70('0x6'),'as':_0x6e70('0x7'),'attributes':['id',_0x6e70('0x3'),_0x6e70('0x8'),_0x6e70('0x9')]}]},'log':_0x6e70('0x1')});};}; \ No newline at end of file +var _0x0713=['getSmsQueues','Request','GetSmsQueue','name','timeout','strategy','Agents','online','smsPause'];(function(_0x24f870,_0x2c8a88){var _0x5d065b=function(_0x168247){while(--_0x168247){_0x24f870['push'](_0x24f870['shift']());}};_0x5d065b(++_0x2c8a88);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports['getSmsQueues']=function(){return function(){return client[_0x3071('0x0')](_0x3071('0x1'),{'options':{'raw':![],'attributes':['id',_0x3071('0x2'),_0x3071('0x3'),_0x3071('0x4')],'include':[{'model':'User','as':_0x3071('0x5'),'attributes':['id',_0x3071('0x2'),_0x3071('0x6'),_0x3071('0x7')]}]},'log':_0x3071('0x8')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index 3b2fbab..576e9a1 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 _0x3e74=['CreateSmsQueueReport','UpdateSmsQueueReport','DESC','../client','Request'];(function(_0x200032,_0xe28a59){var _0x2f905b=function(_0x289a54){while(--_0x289a54){_0x200032['push'](_0x200032['shift']());}};_0x2f905b(++_0xe28a59);}(_0x3e74,0x175));var _0x43e7=function(_0xef4b0b,_0x3b0a24){_0xef4b0b=_0xef4b0b-0x0;var _0x439b22=_0x3e74[_0xef4b0b];return _0x439b22;};'use strict';var client=require(_0x43e7('0x0'));exports['create']=function(_0x349480){return client[_0x43e7('0x1')](_0x43e7('0x2'),{'body':_0x349480,'log':'CreateSmsQueueReport'});};exports['update']=function(_0xc58479,_0x4f9bbe){return client[_0x43e7('0x1')](_0x43e7('0x3'),{'body':_0x4f9bbe,'options':{'where':{'uniqueid':_0xc58479},'order':[['id',_0x43e7('0x4')]],'limit':0x1},'log':_0x43e7('0x3')});}; \ No newline at end of file +var _0xedd9=['create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC'];(function(_0x5a27e8,_0x492a2f){var _0x4e38f7=function(_0x2a4048){while(--_0x2a4048){_0x5a27e8['push'](_0x5a27e8['shift']());}};_0x4e38f7(++_0x492a2f);}(_0xedd9,0xfc));var _0x9edd=function(_0x5182bd,_0xff8120){_0x5182bd=_0x5182bd-0x0;var _0x3b902d=_0xedd9[_0x5182bd];return _0x3b902d;};'use strict';var client=require('../client');exports[_0x9edd('0x0')]=function(_0x2d7989){return client[_0x9edd('0x1')](_0x9edd('0x2'),{'body':_0x2d7989,'log':_0x9edd('0x2')});};exports[_0x9edd('0x3')]=function(_0x3e6d3a,_0x36b53f){return client['Request'](_0x9edd('0x4'),{'body':_0x36b53f,'options':{'where':{'uniqueid':_0x3e6d3a},'order':[['id',_0x9edd('0x5')]],'limit':0x1},'log':_0x9edd('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 1a17212..6508a17 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(_0x1de497,_0x5b2194){var _0x4f1c8f=function(_0x3a1364){while(--_0x3a1364){_0x1de497['push'](_0x1de497['shift']());}};_0x4f1c8f(++_0x5b2194);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xa9e0[_0x1ac595];return _0x455fff;};'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(_0x15e64a,_0x1e4343){var _0x56039b=function(_0x9f25ea){while(--_0x9f25ea){_0x15e64a['push'](_0x15e64a['shift']());}};_0x56039b(++_0x1e4343);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xa9e0[_0x6c993a];return _0x27f547;};'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 56b9d3d..e8bf507 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 _0x6691=['UpdateWhatsappInteraction','updateWhatsappInteraction','addTags','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client','update','Request'];(function(_0x17d7c9,_0xfc5fe1){var _0x2c2aba=function(_0x1c017b){while(--_0x1c017b){_0x17d7c9['push'](_0x17d7c9['shift']());}};_0x2c2aba(++_0xfc5fe1);}(_0x6691,0x12d));var _0x1669=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x6691[_0x3bf83f];return _0x22c4a9;};'use strict';var client=require(_0x1669('0x0'));exports[_0x1669('0x1')]=function(_0xc9ad5a,_0x1cc116){return client[_0x1669('0x2')](_0x1669('0x3'),{'body':_0x1cc116,'options':{'where':{'id':_0xc9ad5a}},'log':_0x1669('0x4')});};exports[_0x1669('0x5')]=function(_0x19a3f5,_0x2ad807){return client['Request'](_0x1669('0x6'),{'body':_0x2ad807,'options':{'where':{'id':_0x19a3f5}},'log':_0x1669('0x7')});}; \ No newline at end of file +var _0xee3c=['../client','update','Request','UpdateWhatsappInteraction','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction'];(function(_0x1ec475,_0x307b56){var _0x292145=function(_0x2237cd){while(--_0x2237cd){_0x1ec475['push'](_0x1ec475['shift']());}};_0x292145(++_0x307b56);}(_0xee3c,0x14a));var _0xcee3=function(_0x118963,_0x1f3cef){_0x118963=_0x118963-0x0;var _0x219b6a=_0xee3c[_0x118963];return _0x219b6a;};'use strict';var client=require(_0xcee3('0x0'));exports[_0xcee3('0x1')]=function(_0x325d92,_0x3de08f){return client[_0xcee3('0x2')](_0xcee3('0x3'),{'body':_0x3de08f,'options':{'where':{'id':_0x325d92}},'log':'updateWhatsappInteraction'});};exports['addTags']=function(_0x435892,_0x4cd398){return client[_0xcee3('0x2')](_0xcee3('0x4'),{'body':_0x4cd398,'options':{'where':{'id':_0x435892}},'log':_0xcee3('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index 34766a3..6043c3b 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 _0x9e67=['../client','create','Request'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x9e67,0x19b));var _0x79e6=function(_0x24e14f,_0x46e02a){_0x24e14f=_0x24e14f-0x0;var _0x2a8072=_0x9e67[_0x24e14f];return _0x2a8072;};'use strict';var client=require(_0x79e6('0x0'));exports[_0x79e6('0x1')]=function(_0x218047){return client[_0x79e6('0x2')]('CreateWhatsappMessage',{'body':_0x218047,'log':'createWhatsappMessage'});}; \ No newline at end of file +var _0x6517=['CreateWhatsappMessage','create','Request'];(function(_0x88cd7b,_0x4c884c){var _0x56fcc8=function(_0x513b3d){while(--_0x513b3d){_0x88cd7b['push'](_0x88cd7b['shift']());}};_0x56fcc8(++_0x4c884c);}(_0x6517,0x15d));var _0x7651=function(_0x2c1e39,_0x291158){_0x2c1e39=_0x2c1e39-0x0;var _0x2d017c=_0x6517[_0x2c1e39];return _0x2d017c;};'use strict';var client=require('../client');exports[_0x7651('0x0')]=function(_0x2ff67f){return client[_0x7651('0x1')](_0x7651('0x2'),{'body':_0x2ff67f,'log':'createWhatsappMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index 94c3f88..737e1a7 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 _0xe0ee=['strategy','online','whatsappPause','getWhatsappQueues','Request','name','timeout'];(function(_0x3e2394,_0x2dc34c){var _0x29743b=function(_0x44ede3){while(--_0x44ede3){_0x3e2394['push'](_0x3e2394['shift']());}};_0x29743b(++_0x2dc34c);}(_0xe0ee,0x100));var _0xee0e=function(_0x4c8fa1,_0x4e4bde){_0x4c8fa1=_0x4c8fa1-0x0;var _0x9768c9=_0xe0ee[_0x4c8fa1];return _0x9768c9;};'use strict';var client=require('../client');exports['getWhatsappQueues']=function(){return function(){return client[_0xee0e('0x0')]('GetWhatsappQueue',{'options':{'raw':![],'attributes':['id',_0xee0e('0x1'),_0xee0e('0x2'),_0xee0e('0x3')],'include':[{'model':'User','as':'Agents','attributes':['id',_0xee0e('0x1'),_0xee0e('0x4'),_0xee0e('0x5')]}]},'log':_0xee0e('0x6')});};}; \ No newline at end of file +var _0x3fd7=['Agents','online','../client','getWhatsappQueues','Request','name','strategy','User'];(function(_0x2d6f58,_0x7772ad){var _0x21c32e=function(_0x155966){while(--_0x155966){_0x2d6f58['push'](_0x2d6f58['shift']());}};_0x21c32e(++_0x7772ad);}(_0x3fd7,0x82));var _0x73fd=function(_0x2ba819,_0x11d820){_0x2ba819=_0x2ba819-0x0;var _0x574c4c=_0x3fd7[_0x2ba819];return _0x574c4c;};'use strict';var client=require(_0x73fd('0x0'));exports[_0x73fd('0x1')]=function(){return function(){return client[_0x73fd('0x2')]('GetWhatsappQueue',{'options':{'raw':![],'attributes':['id',_0x73fd('0x3'),'timeout',_0x73fd('0x4')],'include':[{'model':_0x73fd('0x5'),'as':_0x73fd('0x6'),'attributes':['id',_0x73fd('0x3'),_0x73fd('0x7'),'whatsappPause']}]},'log':_0x73fd('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 401181a..b21f305 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 _0x0fc6=['Request','UpdateWhatsappQueueReport','create','CreateWhatsappQueueReport','update'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x0fc6,0x1a1));var _0x60fc=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x0fc6[_0x178e48];return _0x440d7e;};'use strict';var client=require('../client');exports[_0x60fc('0x0')]=function(_0x393cb6){return client['Request']('CreateWhatsappQueueReport',{'body':_0x393cb6,'log':_0x60fc('0x1')});};exports[_0x60fc('0x2')]=function(_0x420f63,_0x5d790d){return client[_0x60fc('0x3')](_0x60fc('0x4'),{'body':_0x5d790d,'options':{'where':{'uniqueid':_0x420f63},'order':[['id','DESC']],'limit':0x1},'log':_0x60fc('0x4')});}; \ No newline at end of file +var _0x16e1=['create','Request','CreateWhatsappQueueReport','update','UpdateWhatsappQueueReport','DESC','../client'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x16e1,0x110));var _0x116e=function(_0x28611e,_0x586726){_0x28611e=_0x28611e-0x0;var _0x530f69=_0x16e1[_0x28611e];return _0x530f69;};'use strict';var client=require(_0x116e('0x0'));exports[_0x116e('0x1')]=function(_0x4e9438){return client[_0x116e('0x2')](_0x116e('0x3'),{'body':_0x4e9438,'log':_0x116e('0x3')});};exports[_0x116e('0x4')]=function(_0x2da5ce,_0x70b611){return client[_0x116e('0x2')](_0x116e('0x5'),{'body':_0x70b611,'options':{'where':{'uniqueid':_0x2da5ce},'order':[['id',_0x116e('0x6')]],'limit':0x1},'log':_0x116e('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 4bf5173..f9202e0 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 _0x6435=['info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','length','error','[%s][AGENT]\x20%s','stop','find','agents','timeout','createQueue','atimeout','channel','START:%s','end','close','rules','complete','[%s][AGENT]\x20ROUTING\x20END','next','log','[%s][QUEUE]\x20%s','validate','lodash','./strategy','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x6435,0xb4));var _0x5643=function(_0x4de5d0,_0x1305be){_0x4de5d0=_0x4de5d0-0x0;var _0x24510c=_0x6435[_0x4de5d0];return _0x24510c;};'use strict';var schema=require(_0x5643('0x0'));var _=require(_0x5643('0x1'));var util=require('util');var seqqueue=require('seq-queue');var logger=require('../../../../config/logger')('routing');var strategy=require(_0x5643('0x2'));var queue=schema({'name':{'type':'string','required':!![],'message':_0x5643('0x3')},'timeout':{'type':_0x5643('0x4'),'message':_0x5643('0x5')}});function writeLog(_0x45f043,_0x261ac0,_0x40595d){return logger[_0x5643('0x6')](util[_0x5643('0x7')](_0x5643('0x8'),_0x45f043,_0x261ac0[_0x5643('0x9')],_0x40595d));}function handleFindAgent(_0x53a776){return function(_0x28df16){return _0x28df16[_0x5643('0x9')][_0x5643('0xa')]()===_0x53a776[_0x5643('0xa')]();};}exports[_0x5643('0xb')]=function(_0x3ec85e,_0x9e8e72,_0x5ecb46,_0x251c13){return function(_0x4227b0){try{var _0x55d765={'name':_0x9e8e72[0x0],'timeout':_0x9e8e72[0x1]};var _0x58ea69=queue[_0x5643('0x0')](_0x55d765,{'typecast':!![]});if(_0x58ea69[_0x5643('0xc')]){logger[_0x5643('0xd')](_0x5643('0xe'),_0x3ec85e,_['map'](_0x58ea69,'message')['join'](',\x20'));_0x4227b0[_0x5643('0xf')]();}else{var _0x1971d2=_[_0x5643('0x10')](_0x5ecb46[_0x5643('0x11')],handleFindAgent(_0x55d765[_0x5643('0x9')]));if(_0x1971d2){var _0x24ed8a=(_0x55d765[_0x5643('0x12')]||0xa)*0x3e8;var _0x354113,_0x4d75f3;var _0x1eaf39=seqqueue[_0x5643('0x13')](_0x24ed8a);_0x1eaf39['id']=_0x3ec85e;_0x1eaf39[_0x5643('0x14')]=_0x24ed8a;_0x1eaf39[_0x5643('0x15')]=_0x251c13[_0x5643('0x15')];writeLog(_0x3ec85e,_0x1971d2,util[_0x5643('0x7')](_0x5643('0x16'),_0x24ed8a));_0x5ecb46['rules'][_0x3ec85e]['on'](_0x5643('0x17'),function(){logger['info']('[%s][AGENT]\x20ROUTING\x20STOPPED',_0x3ec85e);clearTimeout(_0x4d75f3);_0x4d75f3=undefined;_0x1eaf39[_0x5643('0x18')]();if(_0x5ecb46['rules'][_0x3ec85e]){delete _0x5ecb46[_0x5643('0x19')][_0x3ec85e];}_0x4227b0[_0x5643('0xf')]();});_0x5ecb46[_0x5643('0x19')][_0x3ec85e]['on'](_0x5643('0x1a'),function(){if(_0x5ecb46['rules'][_0x3ec85e]){delete _0x5ecb46[_0x5643('0x19')][_0x3ec85e];}});_0x4d75f3=setTimeout(function(){logger[_0x5643('0x6')](_0x5643('0x1b'),_0x3ec85e);clearTimeout(_0x4d75f3);_0x1eaf39[_0x5643('0x18')]();_0x4227b0[_0x5643('0x1c')]();},_0x24ed8a);strategy['agent'](_0x1eaf39,_0x1971d2,_0x5ecb46,_0x251c13);}else{logger[_0x5643('0xd')]('[%s][AGENT]\x20agent\x20not\x20found\x20%s',_0x3ec85e,_0x55d765[_0x5643('0x9')]);_0x4227b0['stop']();}}}catch(_0xf8e5){console[_0x5643('0x1d')](_0xf8e5);logger['error'](_0x5643('0x1e'),_0x3ec85e,_0xf8e5['stack']);_0x4227b0[_0x5643('0xf')]();}};}; \ No newline at end of file +var _0xf7bb=['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','length','error','[%s][AGENT]\x20%s','map','message','join','stop','find','agents','timeout','createQueue','atimeout','channel','START:%s','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','complete','[%s][AGENT]\x20ROUTING\x20END','next','agent','log','[%s][QUEUE]\x20%s','util','seq-queue','../../../../config/logger','routing','./strategy'];(function(_0x219e10,_0x1202b3){var _0x162e2b=function(_0xc3f164){while(--_0xc3f164){_0x219e10['push'](_0x219e10['shift']());}};_0x162e2b(++_0x1202b3);}(_0xf7bb,0x70));var _0xbf7b=function(_0x561c69,_0x2c9588){_0x561c69=_0x561c69-0x0;var _0x3f0b2f=_0xf7bb[_0x561c69];return _0x3f0b2f;};'use strict';var schema=require('validate');var _=require('lodash');var util=require(_0xbf7b('0x0'));var seqqueue=require(_0xbf7b('0x1'));var logger=require(_0xbf7b('0x2'))(_0xbf7b('0x3'));var strategy=require(_0xbf7b('0x4'));var queue=schema({'name':{'type':_0xbf7b('0x5'),'required':!![],'message':_0xbf7b('0x6')},'timeout':{'type':_0xbf7b('0x7'),'message':_0xbf7b('0x8')}});function writeLog(_0xad08f2,_0x328774,_0x45efce){return logger[_0xbf7b('0x9')](util[_0xbf7b('0xa')](_0xbf7b('0xb'),_0xad08f2,_0x328774[_0xbf7b('0xc')],_0x45efce));}function handleFindAgent(_0x513ae4){return function(_0x17e828){return _0x17e828[_0xbf7b('0xc')][_0xbf7b('0xd')]()===_0x513ae4['toLowerCase']();};}exports[_0xbf7b('0xe')]=function(_0x3e191c,_0x3920b5,_0x5ea51e,_0x9d1ccd){return function(_0x522ff1){try{var _0x394664={'name':_0x3920b5[0x0],'timeout':_0x3920b5[0x1]};var _0x455f2e=queue['validate'](_0x394664,{'typecast':!![]});if(_0x455f2e[_0xbf7b('0xf')]){logger[_0xbf7b('0x10')](_0xbf7b('0x11'),_0x3e191c,_[_0xbf7b('0x12')](_0x455f2e,_0xbf7b('0x13'))[_0xbf7b('0x14')](',\x20'));_0x522ff1[_0xbf7b('0x15')]();}else{var _0x43040f=_[_0xbf7b('0x16')](_0x5ea51e[_0xbf7b('0x17')],handleFindAgent(_0x394664[_0xbf7b('0xc')]));if(_0x43040f){var _0x2e0352=(_0x394664[_0xbf7b('0x18')]||0xa)*0x3e8;var _0x3d7284,_0x49cd02;var _0xe61334=seqqueue[_0xbf7b('0x19')](_0x2e0352);_0xe61334['id']=_0x3e191c;_0xe61334[_0xbf7b('0x1a')]=_0x2e0352;_0xe61334[_0xbf7b('0x1b')]=_0x9d1ccd[_0xbf7b('0x1b')];writeLog(_0x3e191c,_0x43040f,util[_0xbf7b('0xa')](_0xbf7b('0x1c'),_0x2e0352));_0x5ea51e[_0xbf7b('0x1d')][_0x3e191c]['on'](_0xbf7b('0x1e'),function(){logger['info'](_0xbf7b('0x1f'),_0x3e191c);clearTimeout(_0x49cd02);_0x49cd02=undefined;_0xe61334[_0xbf7b('0x20')]();if(_0x5ea51e[_0xbf7b('0x1d')][_0x3e191c]){delete _0x5ea51e[_0xbf7b('0x1d')][_0x3e191c];}_0x522ff1[_0xbf7b('0x15')]();});_0x5ea51e[_0xbf7b('0x1d')][_0x3e191c]['on'](_0xbf7b('0x21'),function(){if(_0x5ea51e[_0xbf7b('0x1d')][_0x3e191c]){delete _0x5ea51e[_0xbf7b('0x1d')][_0x3e191c];}});_0x49cd02=setTimeout(function(){logger['info'](_0xbf7b('0x22'),_0x3e191c);clearTimeout(_0x49cd02);_0xe61334[_0xbf7b('0x20')]();_0x522ff1[_0xbf7b('0x23')]();},_0x2e0352);strategy[_0xbf7b('0x24')](_0xe61334,_0x43040f,_0x5ea51e,_0x9d1ccd);}else{logger['error']('[%s][AGENT]\x20agent\x20not\x20found\x20%s',_0x3e191c,_0x394664[_0xbf7b('0xc')]);_0x522ff1['stop']();}}}catch(_0x54e63c){console[_0xbf7b('0x25')](_0x54e63c);logger[_0xbf7b('0x10')](_0xbf7b('0x26'),_0x3e191c,_0x54e63c['stack']);_0x522ff1[_0xbf7b('0x15')]();}};}; \ 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 5cbe25d..fa8ed83 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 _0x52f8=['info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','chat','ChatWebsiteId','upperFirst','AccountId','account','created','isEmpty','body','getMustacheRender','create','then','catch','stringify','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','$LATEST','message','postText','error','next','amazonlex','providerResponse','Message','dialogState','aws-sdk','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId'];(function(_0x524969,_0x3e0d6c){var _0x27c147=function(_0x32b72c){while(--_0x32b72c){_0x524969['push'](_0x524969['shift']());}};_0x27c147(++_0x3e0d6c);}(_0x52f8,0x114));var _0x852f=function(_0xf73a20,_0x35d5cb){_0xf73a20=_0xf73a20-0x0;var _0x186c54=_0x52f8[_0xf73a20];return _0x186c54;};'use strict';var _=require('lodash');var moment=require('moment');var AWS=require(_0x852f('0x0'));var utils=require('./utils');var logger=require('../../../../config/logger')(_0x852f('0x1'));var rpc={'chatMessage':require(_0x852f('0x2')),'openchannelMessage':require(_0x852f('0x3')),'mailMessage':require(_0x852f('0x4')),'smsMessage':require(_0x852f('0x5')),'faxMessage':require(_0x852f('0x6')),'whatsappMessage':require(_0x852f('0x7'))};exports[_0x852f('0x8')]=function(_0x31eb88,_0x5d50ad){return function(_0x4781e8){try{if(!_[_0x852f('0x9')](this[_0x852f('0xa')][_0x852f('0xb')])){logger[_0x852f('0xc')](_0x852f('0xd'),_0x31eb88,_0x852f('0xe'));return _0x4781e8['next']();}var _0x104cb4={'ContactId':this[_0x852f('0xf')]['id'],'sentAt':moment()['format'](_0x852f('0x10')),'direction':_0x852f('0x11')};if(this[_0x852f('0x12')]===_0x852f('0x13')||this['channel']===_0x852f('0x14')){_0x104cb4[_0x852f('0x15')]=this[_0x852f('0xa')][_0x852f('0x15')];}var _0x114488=this[_0x852f('0x12')];if(_0x114488===_0x852f('0x16')){_0x104cb4[_0x852f('0x17')]=this['account']['id'];}else{_0x104cb4[_[_0x852f('0x18')](_0x114488)+_0x852f('0x19')]=this[_0x852f('0x1a')]['id'];}_0x104cb4[_[_0x852f('0x18')](_0x114488)+'InteractionId']=this[_0x852f('0xa')]['id'];if(this[_0x852f('0xa')][_0x852f('0x1b')]){var _0x5a3e7f=_0x5d50ad[0x4];if(!_[_0x852f('0x1c')](_0x5a3e7f)){_0x104cb4[_0x852f('0x1d')]=utils[_0x852f('0x1e')](_0x5a3e7f,this);return rpc[_0x114488+'Message'][_0x852f('0x1f')](_0x104cb4)[_0x852f('0x20')](function(_0x42a042){logger[_0x852f('0xc')]('[%s][AMAZONLEX]\x20%s',_0x31eb88,_0x104cb4[_0x852f('0x1d')]);})[_0x852f('0x21')](function(_0x220dca){logger['error'](_0x852f('0xd'),_0x31eb88,JSON[_0x852f('0x22')](_0x220dca));})['finally'](function(){logger[_0x852f('0xc')](_0x852f('0x23'),_0x31eb88);_0x4781e8[_0x852f('0x24')]();});}else{logger[_0x852f('0xc')](_0x852f('0x25'),_0x31eb88);_0x4781e8['stop']();}}else{var _0x48669f=this;var _0x320583=new AWS[(_0x852f('0x26'))]({'accessKeyId':_0x5d50ad[0x0],'secretAccessKey':_0x5d50ad[0x1],'region':_0x5d50ad[0x2]});var _0x23e47e={'botAlias':_0x852f('0x27'),'botName':_0x5d50ad[0x3],'inputText':this[_0x852f('0x28')][_0x852f('0x1d')],'userId':this[_0x852f('0x12')]+':'+this[_0x852f('0xa')]['id']['toString']()};_0x320583[_0x852f('0x29')](_0x23e47e,function(_0x2aac5e,_0x3b497e){if(_0x2aac5e){logger[_0x852f('0x2a')]('[%s][AMAZONLEX]\x20%s',_0x31eb88,_0x2aac5e[_0x852f('0x28')]);_0x4781e8[_0x852f('0x2b')]();}else if(_0x3b497e&&_0x3b497e[_0x852f('0x28')]){_0x48669f['body'][_0x852f('0x2c')]=_0x3b497e;_0x104cb4[_0x852f('0x1d')]=_0x3b497e[_0x852f('0x28')];_0x104cb4['providerName']=_0x852f('0x2c');_0x104cb4[_0x852f('0x2d')]=JSON[_0x852f('0x22')](_0x3b497e);return rpc[_0x114488+_0x852f('0x2e')]['create'](_0x104cb4)[_0x852f('0x20')](function(_0x273f95){logger[_0x852f('0xc')](_0x852f('0xd'),_0x31eb88,_0x104cb4[_0x852f('0x1d')]);if(_0x3b497e[_0x852f('0x2f')]=='Failed'){_0x4781e8[_0x852f('0x2b')]();}else{_0x4781e8[_0x852f('0x24')]();}})[_0x852f('0x21')](function(_0x419861){logger[_0x852f('0x2a')](_0x852f('0xd'),_0x31eb88,JSON[_0x852f('0x22')](_0x419861));_0x4781e8[_0x852f('0x2b')]();});}else{_0x4781e8[_0x852f('0x2b')]();}});}}catch(_0x3ce3fd){logger[_0x852f('0x2a')](_0x852f('0xd'),_0x31eb88,JSON[_0x852f('0x22')](_0x3ce3fd));_0x4781e8[_0x852f('0x24')]();}};}; \ No newline at end of file +var _0xa74a=['../../../../config/logger','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','info','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','whatsapp','phone','chat','ChatWebsiteId','account','upperFirst','AccountId','created','isEmpty','body','getMustacheRender','Message','create','then','[%s][AMAZONLEX]\x20%s','catch','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','LexRuntime','toString','postText','error','message','amazonlex','providerName','providerResponse','stringify','dialogState','Failed','lodash','moment','aws-sdk','./utils'];(function(_0x4843f9,_0x4af459){var _0x193c6a=function(_0x51eca9){while(--_0x51eca9){_0x4843f9['push'](_0x4843f9['shift']());}};_0x193c6a(++_0x4af459);}(_0xa74a,0x134));var _0xaa74=function(_0x496c03,_0x469a38){_0x496c03=_0x496c03-0x0;var _0x5eccc5=_0xa74a[_0x496c03];return _0x5eccc5;};'use strict';var _=require(_0xaa74('0x0'));var moment=require(_0xaa74('0x1'));var AWS=require(_0xaa74('0x2'));var utils=require(_0xaa74('0x3'));var logger=require(_0xaa74('0x4'))('routing');var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0xaa74('0x5')),'mailMessage':require(_0xaa74('0x6')),'smsMessage':require(_0xaa74('0x7')),'faxMessage':require(_0xaa74('0x8')),'whatsappMessage':require(_0xaa74('0x9'))};exports[_0xaa74('0xa')]=function(_0x48bd66,_0x1f2c10){return function(_0x4d2b8b){try{if(!_[_0xaa74('0xb')](this[_0xaa74('0xc')][_0xaa74('0xd')])){logger[_0xaa74('0xe')]('[%s][AMAZONLEX]\x20%s',_0x48bd66,_0xaa74('0xf'));return _0x4d2b8b[_0xaa74('0x10')]();}var _0x533a84={'ContactId':this[_0xaa74('0x11')]['id'],'sentAt':moment()[_0xaa74('0x12')](_0xaa74('0x13')),'direction':_0xaa74('0x14')};if(this[_0xaa74('0x15')]==='sms'||this['channel']===_0xaa74('0x16')){_0x533a84[_0xaa74('0x17')]=this['interaction']['phone'];}var _0x2a7257=this['channel'];if(_0x2a7257===_0xaa74('0x18')){_0x533a84[_0xaa74('0x19')]=this[_0xaa74('0x1a')]['id'];}else{_0x533a84[_[_0xaa74('0x1b')](_0x2a7257)+_0xaa74('0x1c')]=this[_0xaa74('0x1a')]['id'];}_0x533a84[_[_0xaa74('0x1b')](_0x2a7257)+'InteractionId']=this[_0xaa74('0xc')]['id'];if(this[_0xaa74('0xc')][_0xaa74('0x1d')]){var _0x415c9b=_0x1f2c10[0x4];if(!_[_0xaa74('0x1e')](_0x415c9b)){_0x533a84[_0xaa74('0x1f')]=utils[_0xaa74('0x20')](_0x415c9b,this);return rpc[_0x2a7257+_0xaa74('0x21')][_0xaa74('0x22')](_0x533a84)[_0xaa74('0x23')](function(_0x18f16a){logger['info'](_0xaa74('0x24'),_0x48bd66,_0x533a84[_0xaa74('0x1f')]);})[_0xaa74('0x25')](function(_0x2c83b6){logger['error'](_0xaa74('0x24'),_0x48bd66,JSON['stringify'](_0x2c83b6));})[_0xaa74('0x26')](function(){logger[_0xaa74('0xe')](_0xaa74('0x27'),_0x48bd66);_0x4d2b8b[_0xaa74('0x28')]();});}else{logger[_0xaa74('0xe')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x48bd66);_0x4d2b8b[_0xaa74('0x28')]();}}else{var _0x3b7a22=this;var _0x21028f=new AWS[(_0xaa74('0x29'))]({'accessKeyId':_0x1f2c10[0x0],'secretAccessKey':_0x1f2c10[0x1],'region':_0x1f2c10[0x2]});var _0xde7651={'botAlias':'$LATEST','botName':_0x1f2c10[0x3],'inputText':this['message']['body'],'userId':this[_0xaa74('0x15')]+':'+this['interaction']['id'][_0xaa74('0x2a')]()};_0x21028f[_0xaa74('0x2b')](_0xde7651,function(_0xfcfcb8,_0x26e218){if(_0xfcfcb8){logger[_0xaa74('0x2c')](_0xaa74('0x24'),_0x48bd66,_0xfcfcb8['message']);_0x4d2b8b[_0xaa74('0x10')]();}else if(_0x26e218&&_0x26e218[_0xaa74('0x2d')]){_0x3b7a22['body'][_0xaa74('0x2e')]=_0x26e218;_0x533a84[_0xaa74('0x1f')]=_0x26e218[_0xaa74('0x2d')];_0x533a84[_0xaa74('0x2f')]=_0xaa74('0x2e');_0x533a84[_0xaa74('0x30')]=JSON[_0xaa74('0x31')](_0x26e218);return rpc[_0x2a7257+'Message'][_0xaa74('0x22')](_0x533a84)[_0xaa74('0x23')](function(_0x1d901a){logger[_0xaa74('0xe')]('[%s][AMAZONLEX]\x20%s',_0x48bd66,_0x533a84[_0xaa74('0x1f')]);if(_0x26e218[_0xaa74('0x32')]==_0xaa74('0x33')){_0x4d2b8b[_0xaa74('0x10')]();}else{_0x4d2b8b[_0xaa74('0x28')]();}})[_0xaa74('0x25')](function(_0x296e6f){logger['error']('[%s][AMAZONLEX]\x20%s',_0x48bd66,JSON[_0xaa74('0x31')](_0x296e6f));_0x4d2b8b[_0xaa74('0x10')]();});}else{_0x4d2b8b[_0xaa74('0x10')]();}});}}catch(_0x2537aa){logger['error'](_0xaa74('0x24'),_0x48bd66,JSON[_0xaa74('0x31')](_0x2537aa));_0x4d2b8b[_0xaa74('0x28')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/autoreply.js b/server/services/routing/server/applications/autoreply.js index 349fcc4..17f78fa 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 _0x1ba4=['','headers','All','smtpOptions','then','Message','create','catch','[RPC][%s][AUTOREPLY]\x20%s','stringify','resolve','autoreplyExecuted','Interaction','update','error','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','finally','stop','moment','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/whatsappInteraction','../../mailRpc','channel','body','isAutoreply','info','next','isNil','interaction','created','[%s][AUTOREPLY]\x20%s','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','YYYY-MM-DD\x20HH:mm:ss','out','mail','getMustacheRender','message','from','phone','read','subject','Re:\x20','chat','ChatWebsiteId','account','upperFirst','AccountId','inReplyTo','messageId','replace'];(function(_0x565ed7,_0x398228){var _0x183ad7=function(_0x5a43d7){while(--_0x5a43d7){_0x565ed7['push'](_0x565ed7['shift']());}};_0x183ad7(++_0x398228);}(_0x1ba4,0x1b8));var _0x41ba=function(_0x259301,_0x497973){_0x259301=_0x259301-0x0;var _0x37633a=_0x1ba4[_0x259301];return _0x37633a;};'use strict';var _=require('lodash');var moment=require(_0x41ba('0x0'));var utils=require('./utils');var logger=require('../../../../config/logger')(_0x41ba('0x1'));var rpc={'chatMessage':require(_0x41ba('0x2')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x41ba('0x3')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x41ba('0x4')),'whatsappMessage':require(_0x41ba('0x5')),'chatInteraction':require(_0x41ba('0x6')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'mailInteraction':require(_0x41ba('0x7')),'smsInteraction':require(_0x41ba('0x8')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0x41ba('0x9'))};var mailRpc=require(_0x41ba('0xa'));exports['consequence']=function(_0x109ac1,_0x2bb19e,_0x402e77,_0x472a20){return function(_0x3f34c7){try{var _0xff865d=this[_0x41ba('0xb')];if(_0xff865d==='mail'&&_0x472a20[_0x41ba('0xc')][_0x41ba('0xd')]){logger[_0x41ba('0xe')]('[%s][AUTOREPLY]\x20%s',_0x109ac1,'Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)');return _0x3f34c7[_0x41ba('0xf')]();}if(_0x2bb19e[0x0]==='1'&&(_[_0x41ba('0x10')](this[_0x41ba('0x11')]['created'])||!this[_0x41ba('0x11')][_0x41ba('0x12')])){logger[_0x41ba('0xe')](_0x41ba('0x13'),_0x109ac1,'Autoreply\x20already\x20sent');return _0x3f34c7[_0x41ba('0xf')]();}if(_0x2bb19e[0x0]==='2'&&this[_0x41ba('0x11')]['autoreplyExecuted']){logger[_0x41ba('0xe')](_0x41ba('0x14'),_0x109ac1,_0x41ba('0x15'));return _0x3f34c7[_0x41ba('0xf')]();}var _0x159e3b={'ContactId':this['contact']['id'],'sentAt':moment()['format'](_0x41ba('0x16')),'direction':_0x41ba('0x17')};if(this[_0x41ba('0xb')]===_0x41ba('0x18')){_0x159e3b[_0x41ba('0xc')]=utils[_0x41ba('0x19')](_0x2bb19e[0x2],this);}else{_0x159e3b[_0x41ba('0xc')]=utils[_0x41ba('0x19')](_0x2bb19e[0x1],this);}if(this[_0x41ba('0x1a')]){_0x159e3b['to']=this[_0x41ba('0x1a')][_0x41ba('0x1b')]||'';if(this[_0x41ba('0xb')]===_0x41ba('0x18')&&_0x2bb19e[0x1]==='1'){_0x159e3b['cc']=this['message']['cc']||'';}_0x159e3b[_0x41ba('0x1b')]=this[_0x41ba('0x1a')]['to']||'';_0x159e3b['phone']=this['message'][_0x41ba('0x1c')]||'';_0x159e3b[_0x41ba('0x1d')]=!![];if(this['message'][_0x41ba('0x1e')]){_0x159e3b[_0x41ba('0x1e')]='';_0x159e3b[_0x41ba('0x1e')]+=_['startsWith'](this[_0x41ba('0x1a')]['subject'],'Re:')?'':_0x41ba('0x1f');_0x159e3b['subject']+=this[_0x41ba('0x1a')][_0x41ba('0x1e')];}}if(this['channel']===_0x41ba('0x20')){_0x159e3b[_0x41ba('0x21')]=this[_0x41ba('0x22')]['id'];}else{_0x159e3b[_[_0x41ba('0x23')](this['channel'])+_0x41ba('0x24')]=this[_0x41ba('0x22')]['id'];}_0x159e3b[_[_0x41ba('0x23')](this[_0x41ba('0xb')])+'InteractionId']=this['interaction']['id'];var _0x378da3=this[_0x41ba('0x11')];if(rpc[this[_0x41ba('0xb')]+'Message']){if(this[_0x41ba('0xb')]==='mail'){_0x159e3b[_0x41ba('0x25')]=this[_0x41ba('0x1a')][_0x41ba('0x26')];_0x159e3b['html']=''+_[_0x41ba('0x27')](_0x159e3b[_0x41ba('0xc')],_0x41ba('0x28'),_0x41ba('0x29'))+_0x41ba('0x2a');_0x159e3b[_0x41ba('0x2b')]={'Auto-Submitted':'auto-replied','X-Auto-Response-Suppress':_0x41ba('0x2c'),'Precedence':'auto_reply'};return mailRpc['sendMailMessage'](this[_0x41ba('0x22')][_0x41ba('0x2d')],_0x159e3b)[_0x41ba('0x2e')](function(_0x40cdc0){logger[_0x41ba('0xe')]('[%s][AUTOREPLY]\x20SMTP\x20SENT',_0x109ac1);_0x159e3b[_0x41ba('0x26')]=_0x40cdc0[_0x41ba('0x1a')][_0x41ba('0x26')];return rpc[_0xff865d+_0x41ba('0x2f')][_0x41ba('0x30')](_0x159e3b);})[_0x41ba('0x2e')](function(_0x47e11b){logger[_0x41ba('0xe')](_0x41ba('0x13'),_0x109ac1,JSON['stringify'](_0x47e11b));})[_0x41ba('0x31')](function(_0x345213){logger['error'](_0x41ba('0x32'),_0x109ac1,JSON[_0x41ba('0x33')](_0x345213));})['finally'](function(){Promise[_0x41ba('0x34')]()['then'](function(){if(_0x2bb19e[0x0]!=='2'||_0x378da3[_0x41ba('0x35')])return;return rpc[_0xff865d+_0x41ba('0x36')][_0x41ba('0x37')](_0x378da3['id'],{'autoreplyExecuted':!![]})[_0x41ba('0x2e')](function(_0x26d458){logger[_0x41ba('0xe')]('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x109ac1,JSON[_0x41ba('0x33')](_0x26d458));})[_0x41ba('0x31')](function(_0x10c7d4){logger[_0x41ba('0x38')](_0x41ba('0x39'),_0x109ac1,JSON[_0x41ba('0x33')](_0x10c7d4));});})[_0x41ba('0x2e')](function(){_0x3f34c7[_0x41ba('0xf')]();});});}else{return rpc[this[_0x41ba('0xb')]+_0x41ba('0x2f')][_0x41ba('0x30')](_0x159e3b)[_0x41ba('0x2e')](function(){logger[_0x41ba('0xe')](_0x41ba('0x13'),_0x109ac1,_0x159e3b[_0x41ba('0xc')]);})[_0x41ba('0x31')](function(_0x13591d){logger[_0x41ba('0x38')](_0x41ba('0x13'),_0x109ac1,JSON[_0x41ba('0x33')](_0x13591d));})[_0x41ba('0x3a')](function(){Promise[_0x41ba('0x34')]()['then'](function(){if(_0x2bb19e[0x0]!=='2'||_0x378da3[_0x41ba('0x35')])return;return rpc[_0xff865d+_0x41ba('0x36')]['update'](_0x378da3['id'],{'autoreplyExecuted':!![]})['then'](function(_0x4111da){logger['info']('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x109ac1,JSON[_0x41ba('0x33')](_0x4111da));})['catch'](function(_0x12dfc1){logger[_0x41ba('0x38')](_0x41ba('0x39'),_0x109ac1,JSON[_0x41ba('0x33')](_0x12dfc1));});})[_0x41ba('0x2e')](function(){_0x3f34c7[_0x41ba('0xf')]();});});}}}catch(_0x346b5d){logger['error'](_0x41ba('0x13'),_0x109ac1,JSON[_0x41ba('0x33')](_0x346b5d));_0x3f34c7[_0x41ba('0x3b')]();}};}; \ No newline at end of file +var _0xd980=['All','auto_reply','smtpOptions','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','create','stringify','catch','[RPC][%s][AUTOREPLY]\x20%s','resolve','Interaction','update','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','error','stop','lodash','moment','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../mailRpc','consequence','mail','info','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','next','isNil','interaction','created','[%s][AUTOREPLY]\x20%s','autoreplyExecuted','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','body','getMustacheRender','message','from','phone','subject','startsWith','Re:','Re:\x20','ChatWebsiteId','upperFirst','AccountId','account','InteractionId','Message','inReplyTo','messageId','html','replace','','headers','auto-replied'];(function(_0x4fb50a,_0x91f264){var _0x1999c6=function(_0xc070a8){while(--_0xc070a8){_0x4fb50a['push'](_0x4fb50a['shift']());}};_0x1999c6(++_0x91f264);}(_0xd980,0xde));var _0x0d98=function(_0x49fdcb,_0x2dcea7){_0x49fdcb=_0x49fdcb-0x0;var _0xa6f2d4=_0xd980[_0x49fdcb];return _0xa6f2d4;};'use strict';var _=require(_0x0d98('0x0'));var moment=require(_0x0d98('0x1'));var utils=require(_0x0d98('0x2'));var logger=require(_0x0d98('0x3'))('routing');var rpc={'chatMessage':require(_0x0d98('0x4')),'openchannelMessage':require(_0x0d98('0x5')),'mailMessage':require(_0x0d98('0x6')),'smsMessage':require(_0x0d98('0x7')),'faxMessage':require(_0x0d98('0x8')),'whatsappMessage':require(_0x0d98('0x9')),'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0x0d98('0xa')),'mailInteraction':require(_0x0d98('0xb')),'smsInteraction':require('../../rpc/smsInteraction'),'faxInteraction':require(_0x0d98('0xc')),'whatsappInteraction':require(_0x0d98('0xd'))};var mailRpc=require(_0x0d98('0xe'));exports[_0x0d98('0xf')]=function(_0x290488,_0x24154d,_0x1e8656,_0x12d7af){return function(_0x273a18){try{var _0x1c4efa=this['channel'];if(_0x1c4efa===_0x0d98('0x10')&&_0x12d7af['body']['isAutoreply']){logger[_0x0d98('0x11')]('[%s][AUTOREPLY]\x20%s',_0x290488,_0x0d98('0x12'));return _0x273a18[_0x0d98('0x13')]();}if(_0x24154d[0x0]==='1'&&(_[_0x0d98('0x14')](this[_0x0d98('0x15')][_0x0d98('0x16')])||!this[_0x0d98('0x15')][_0x0d98('0x16')])){logger['info'](_0x0d98('0x17'),_0x290488,'Autoreply\x20already\x20sent');return _0x273a18[_0x0d98('0x13')]();}if(_0x24154d[0x0]==='2'&&this[_0x0d98('0x15')][_0x0d98('0x18')]){logger['info'](_0x0d98('0x19'),_0x290488,_0x0d98('0x1a'));return _0x273a18[_0x0d98('0x13')]();}var _0x6dca1a={'ContactId':this['contact']['id'],'sentAt':moment()[_0x0d98('0x1b')](_0x0d98('0x1c')),'direction':_0x0d98('0x1d')};if(this[_0x0d98('0x1e')]===_0x0d98('0x10')){_0x6dca1a[_0x0d98('0x1f')]=utils[_0x0d98('0x20')](_0x24154d[0x2],this);}else{_0x6dca1a[_0x0d98('0x1f')]=utils['getMustacheRender'](_0x24154d[0x1],this);}if(this[_0x0d98('0x21')]){_0x6dca1a['to']=this['message'][_0x0d98('0x22')]||'';if(this[_0x0d98('0x1e')]===_0x0d98('0x10')&&_0x24154d[0x1]==='1'){_0x6dca1a['cc']=this[_0x0d98('0x21')]['cc']||'';}_0x6dca1a[_0x0d98('0x22')]=this['message']['to']||'';_0x6dca1a['phone']=this['message'][_0x0d98('0x23')]||'';_0x6dca1a['read']=!![];if(this[_0x0d98('0x21')][_0x0d98('0x24')]){_0x6dca1a['subject']='';_0x6dca1a[_0x0d98('0x24')]+=_[_0x0d98('0x25')](this[_0x0d98('0x21')][_0x0d98('0x24')],_0x0d98('0x26'))?'':_0x0d98('0x27');_0x6dca1a[_0x0d98('0x24')]+=this['message'][_0x0d98('0x24')];}}if(this['channel']==='chat'){_0x6dca1a[_0x0d98('0x28')]=this['account']['id'];}else{_0x6dca1a[_[_0x0d98('0x29')](this[_0x0d98('0x1e')])+_0x0d98('0x2a')]=this[_0x0d98('0x2b')]['id'];}_0x6dca1a[_[_0x0d98('0x29')](this[_0x0d98('0x1e')])+_0x0d98('0x2c')]=this[_0x0d98('0x15')]['id'];var _0x344090=this[_0x0d98('0x15')];if(rpc[this['channel']+_0x0d98('0x2d')]){if(this['channel']==='mail'){_0x6dca1a[_0x0d98('0x2e')]=this[_0x0d98('0x21')][_0x0d98('0x2f')];_0x6dca1a[_0x0d98('0x30')]=''+_[_0x0d98('0x31')](_0x6dca1a[_0x0d98('0x1f')],_0x0d98('0x32'),']+(>|$)/g,''),'priorityTrue':_0x32fb0c[0x1],'priorityFalse':_0x32fb0c[0x2]};var _0x4176e0=gotoif[_0xe638('0x0')](_0x341e31,{'typecast':!![]});if(_0x4176e0[_0xe638('0xd')]){logger[_0xe638('0xe')](_0xe638('0xf'),_0x1d4539,_['map'](_0x4176e0,_0xe638('0x10'))[_0xe638('0x11')](',\x20'));_0x5bbc00[_0xe638('0x12')]();}else{try{var _0x491402=eval('('+_0x341e31[_0xe638('0x13')]+')');var _0x1cfcfa=_0x491402?_0x341e31['priorityTrue']:_0x341e31[_0xe638('0x14')];logger[_0xe638('0x15')](_0xe638('0x16'),_0x1d4539,_0x341e31[_0xe638('0x13')],_0x491402,_0x1cfcfa||'next');if(_0x1cfcfa){var _0x53ffde=_[_0xe638('0x17')](_0x5bbc00[_0xe638('0x18')](),{'p':_0x1cfcfa});if(_0x53ffde>=0x0){logger[_0xe638('0x15')]('[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x1d4539,_0x1cfcfa||_0xe638('0x19'),_0x53ffde);_0x5bbc00[_0xe638('0x19')](_0x53ffde);}else{logger[_0xe638('0x15')](_0xe638('0x1a'),_0x1d4539,_0x1cfcfa||'next');_0x5bbc00[_0xe638('0x12')]();}}else{_0x5bbc00[_0xe638('0x19')]();}}catch(_0x4e2bf5){logger[_0xe638('0xe')](_0xe638('0x1b'),_0x1d4539,_0x4e2bf5['message']);_0x5bbc00[_0xe638('0x12')]();}}}catch(_0xc49b7f){logger[_0xe638('0xe')](_0xe638('0xf'),_0x1d4539,JSON[_0xe638('0x1c')](_0xc49b7f));_0x5bbc00[_0xe638('0x12')]();}};}; \ No newline at end of file +var _0x9c43=['findIndex','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','error','[%s][GOTOIF]\x20eval\x20error:\x20%s','stringify','validate','html-to-text','./utils','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','fromString','getMustacheRender','length','[%s][GOTOIF]\x20%s','map','message','stop','condition','priorityTrue','priorityFalse','info','next'];(function(_0x4245ca,_0xcdc5df){var _0x396c94=function(_0x50c1be){while(--_0x50c1be){_0x4245ca['push'](_0x4245ca['shift']());}};_0x396c94(++_0xcdc5df);}(_0x9c43,0x130));var _0x39c4=function(_0x85d5a8,_0x1977be){_0x85d5a8=_0x85d5a8-0x0;var _0x20479b=_0x9c43[_0x85d5a8];return _0x20479b;};'use strict';var schema=require(_0x39c4('0x0'));var _=require('lodash');var htmlToText=require(_0x39c4('0x1'));var utils=require(_0x39c4('0x2'));var logger=require('../../../../config/logger')('routing');var gotoif=schema({'condition':{'type':_0x39c4('0x3'),'required':!![],'message':_0x39c4('0x4')},'priorityTrue':{'type':_0x39c4('0x5'),'message':_0x39c4('0x6')},'priorityFalse':{'type':_0x39c4('0x5'),'message':_0x39c4('0x7')}});exports['consequence']=function(_0x2bc970,_0x1ce13b){return function(_0x2f07fa){try{var _0x33714d={'condition':htmlToText[_0x39c4('0x8')](utils[_0x39c4('0x9')](_0x1ce13b[0x0],this),{'wordwrap':![]})['replace'](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x1ce13b[0x1],'priorityFalse':_0x1ce13b[0x2]};var _0x195daf=gotoif['validate'](_0x33714d,{'typecast':!![]});if(_0x195daf[_0x39c4('0xa')]){logger['error'](_0x39c4('0xb'),_0x2bc970,_[_0x39c4('0xc')](_0x195daf,_0x39c4('0xd'))['join'](',\x20'));_0x2f07fa[_0x39c4('0xe')]();}else{try{var _0x5571e2=eval('('+_0x33714d[_0x39c4('0xf')]+')');var _0x2936a4=_0x5571e2?_0x33714d[_0x39c4('0x10')]:_0x33714d[_0x39c4('0x11')];logger[_0x39c4('0x12')]('[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s',_0x2bc970,_0x33714d['condition'],_0x5571e2,_0x2936a4||_0x39c4('0x13'));if(_0x2936a4){var _0x39e509=_[_0x39c4('0x14')](_0x2f07fa[_0x39c4('0x15')](),{'p':_0x2936a4});if(_0x39e509>=0x0){logger['info'](_0x39c4('0x16'),_0x2bc970,_0x2936a4||_0x39c4('0x13'),_0x39e509);_0x2f07fa[_0x39c4('0x13')](_0x39e509);}else{logger[_0x39c4('0x12')](_0x39c4('0x17'),_0x2bc970,_0x2936a4||_0x39c4('0x13'));_0x2f07fa[_0x39c4('0xe')]();}}else{_0x2f07fa[_0x39c4('0x13')]();}}catch(_0x4c90db){logger[_0x39c4('0x18')](_0x39c4('0x19'),_0x2bc970,_0x4c90db[_0x39c4('0xd')]);_0x2f07fa[_0x39c4('0xe')]();}}}catch(_0x25b2fe){logger[_0x39c4('0x18')](_0x39c4('0xb'),_0x2bc970,JSON[_0x39c4('0x1a')](_0x25b2fe));_0x2f07fa[_0x39c4('0xe')]();}};}; \ 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 4cb984a..354495d 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 _0x8c0a=['rules','info','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stop','stringify','validate','lodash','../../../../config/logger','number','consequence','length','error','[%s][GOTOP]\x20%s','map','message','join','[%s][GOTOP]\x20priority\x20%s','priority','findIndex'];(function(_0x1f36bb,_0x8af718){var _0xaf97fa=function(_0xeca489){while(--_0xeca489){_0x1f36bb['push'](_0x1f36bb['shift']());}};_0xaf97fa(++_0x8af718);}(_0x8c0a,0x118));var _0xa8c0=function(_0x43a3dc,_0x2eb8eb){_0x43a3dc=_0x43a3dc-0x0;var _0x2b804d=_0x8c0a[_0x43a3dc];return _0x2b804d;};'use strict';var schema=require(_0xa8c0('0x0'));var _=require(_0xa8c0('0x1'));var logger=require(_0xa8c0('0x2'))('routing');var gotop=schema({'priority':{'type':_0xa8c0('0x3'),'required':!![],'message':'priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required'}});exports[_0xa8c0('0x4')]=function(_0x3dd4b1,_0xd43540){return function(_0x456864){try{var _0x4a4225={'priority':_0xd43540[0x0]};var _0x50498a=gotop[_0xa8c0('0x0')](_0x4a4225,{'typecast':!![]});if(_0x50498a[_0xa8c0('0x5')]){logger[_0xa8c0('0x6')](_0xa8c0('0x7'),_0x3dd4b1,_[_0xa8c0('0x8')](_0x50498a,_0xa8c0('0x9'))[_0xa8c0('0xa')](',\x20'));_0x456864['stop']();}else{logger['info'](_0xa8c0('0xb'),_0x3dd4b1,_0x4a4225[_0xa8c0('0xc')]);if(_0x4a4225[_0xa8c0('0xc')]){var _0x3e4e48=_[_0xa8c0('0xd')](_0x456864[_0xa8c0('0xe')](),{'p':_0x4a4225[_0xa8c0('0xc')]});if(_0x3e4e48>=0x0){logger[_0xa8c0('0xf')](_0xa8c0('0x10'),_0x3dd4b1,_0x4a4225[_0xa8c0('0xc')]||_0xa8c0('0x11'),_0x3e4e48);_0x456864[_0xa8c0('0x11')](_0x3e4e48);}else{logger[_0xa8c0('0xf')](_0xa8c0('0x12'),_0x3dd4b1,_0x4a4225[_0xa8c0('0xc')]||_0xa8c0('0x11'));_0x456864[_0xa8c0('0x13')]();}}else{_0x456864['next']();}}}catch(_0x259f02){logger[_0xa8c0('0x6')](_0xa8c0('0x7'),_0x3dd4b1,JSON[_0xa8c0('0x14')](_0x259f02));_0x456864['stop']();}};}; \ No newline at end of file +var _0x7fac=['join','stop','info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stringify','validate','lodash','../../../../config/logger','routing','number','consequence','length','[%s][GOTOP]\x20%s','message'];(function(_0x525a65,_0x5521a3){var _0x4f768f=function(_0x1f3f67){while(--_0x1f3f67){_0x525a65['push'](_0x525a65['shift']());}};_0x4f768f(++_0x5521a3);}(_0x7fac,0x6f));var _0xc7fa=function(_0x65c50e,_0x1aa926){_0x65c50e=_0x65c50e-0x0;var _0x4573e7=_0x7fac[_0x65c50e];return _0x4573e7;};'use strict';var schema=require(_0xc7fa('0x0'));var _=require(_0xc7fa('0x1'));var logger=require(_0xc7fa('0x2'))(_0xc7fa('0x3'));var gotop=schema({'priority':{'type':_0xc7fa('0x4'),'required':!![],'message':'priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required'}});exports[_0xc7fa('0x5')]=function(_0x5b327b,_0xbf5e02){return function(_0x346082){try{var _0x388181={'priority':_0xbf5e02[0x0]};var _0x356073=gotop[_0xc7fa('0x0')](_0x388181,{'typecast':!![]});if(_0x356073[_0xc7fa('0x6')]){logger['error'](_0xc7fa('0x7'),_0x5b327b,_['map'](_0x356073,_0xc7fa('0x8'))[_0xc7fa('0x9')](',\x20'));_0x346082[_0xc7fa('0xa')]();}else{logger[_0xc7fa('0xb')](_0xc7fa('0xc'),_0x5b327b,_0x388181[_0xc7fa('0xd')]);if(_0x388181[_0xc7fa('0xd')]){var _0x336451=_[_0xc7fa('0xe')](_0x346082[_0xc7fa('0xf')](),{'p':_0x388181['priority']});if(_0x336451>=0x0){logger['info'](_0xc7fa('0x10'),_0x5b327b,_0x388181[_0xc7fa('0xd')]||_0xc7fa('0x11'),_0x336451);_0x346082[_0xc7fa('0x11')](_0x336451);}else{logger[_0xc7fa('0xb')](_0xc7fa('0x12'),_0x5b327b,_0x388181[_0xc7fa('0xd')]||_0xc7fa('0x11'));_0x346082[_0xc7fa('0xa')]();}}else{_0x346082[_0xc7fa('0x11')]();}}}catch(_0x3fdf1e){logger['error'](_0xc7fa('0x7'),_0x5b327b,JSON[_0xc7fa('0x13')](_0x3fdf1e));_0x346082[_0xc7fa('0xa')]();}};}; \ 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 00cdedd..4efc796 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 _0xab23=['../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','contact','channel','chat','ChatWebsiteId','account','upperFirst','AccountId','interaction','Message','create','then','info','[%s][MESSAGE]\x20%s','body','next','catch','stop','stringify','lodash','./utils','../../../../config/logger','routing'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xab23,0x1bc));var _0x3ab2=function(_0x47dfd5,_0x56fc43){_0x47dfd5=_0x47dfd5-0x0;var _0x3dc00c=_0xab23[_0x47dfd5];return _0x3dc00c;};'use strict';var _=require(_0x3ab2('0x0'));var utils=require(_0x3ab2('0x1'));var logger=require(_0x3ab2('0x2'))(_0x3ab2('0x3'));var rpc={'chatMessage':require(_0x3ab2('0x4')),'openchannelMessage':require(_0x3ab2('0x5')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x3ab2('0x6')),'faxMessage':require(_0x3ab2('0x7')),'whatsappMessage':require(_0x3ab2('0x8'))};exports[_0x3ab2('0x9')]=function(_0x5cb595,_0x5222ba){return function(_0x3445f2){try{var _0x4e8d92={'body':utils['getMustacheRender'](_0x5222ba[0x0],this),'ContactId':this[_0x3ab2('0xa')]['id']};if(this[_0x3ab2('0xb')]===_0x3ab2('0xc')){_0x4e8d92[_0x3ab2('0xd')]=this[_0x3ab2('0xe')]['id'];}else{_0x4e8d92[_[_0x3ab2('0xf')](this[_0x3ab2('0xb')])+_0x3ab2('0x10')]=this[_0x3ab2('0xe')]['id'];}_0x4e8d92[_[_0x3ab2('0xf')](this[_0x3ab2('0xb')])+'InteractionId']=this[_0x3ab2('0x11')]['id'];if(rpc[this[_0x3ab2('0xb')]+_0x3ab2('0x12')]){return rpc[this['channel']+'Message'][_0x3ab2('0x13')](_0x4e8d92)[_0x3ab2('0x14')](function(_0x1f967a){logger[_0x3ab2('0x15')](_0x3ab2('0x16'),_0x5cb595,_0x4e8d92[_0x3ab2('0x17')]);_0x3445f2[_0x3ab2('0x18')]();})[_0x3ab2('0x19')](function(_0x11d439){logger['error'](_0x3ab2('0x16'),_0x5cb595,JSON['stringify'](_0x11d439));_0x3445f2[_0x3ab2('0x1a')]();});}}catch(_0x458f08){logger['error']('[%s][MESSAGE]\x20%s',_0x5cb595,JSON[_0x3ab2('0x1b')](_0x458f08));_0x3445f2[_0x3ab2('0x1a')]();}};}; \ No newline at end of file +var _0xecf3=['upperFirst','InteractionId','interaction','Message','create','info','[%s][MESSAGE]\x20%s','error','stringify','stop','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','consequence','getMustacheRender','contact','channel','chat','ChatWebsiteId','account'];(function(_0x3dc18e,_0x251fc7){var _0x52d741=function(_0x4c3dc9){while(--_0x4c3dc9){_0x3dc18e['push'](_0x3dc18e['shift']());}};_0x52d741(++_0x251fc7);}(_0xecf3,0x66));var _0x3ecf=function(_0x551933,_0x189e2b){_0x551933=_0x551933-0x0;var _0x20f0c1=_0xecf3[_0x551933];return _0x20f0c1;};'use strict';var _=require('lodash');var utils=require('./utils');var logger=require(_0x3ecf('0x0'))(_0x3ecf('0x1'));var rpc={'chatMessage':require(_0x3ecf('0x2')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x3ecf('0x3')),'smsMessage':require(_0x3ecf('0x4')),'faxMessage':require(_0x3ecf('0x5')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0x3ecf('0x6')]=function(_0x245570,_0x4af095){return function(_0xe52550){try{var _0x4d13b8={'body':utils[_0x3ecf('0x7')](_0x4af095[0x0],this),'ContactId':this[_0x3ecf('0x8')]['id']};if(this[_0x3ecf('0x9')]===_0x3ecf('0xa')){_0x4d13b8[_0x3ecf('0xb')]=this[_0x3ecf('0xc')]['id'];}else{_0x4d13b8[_[_0x3ecf('0xd')](this[_0x3ecf('0x9')])+'AccountId']=this[_0x3ecf('0xc')]['id'];}_0x4d13b8[_[_0x3ecf('0xd')](this['channel'])+_0x3ecf('0xe')]=this[_0x3ecf('0xf')]['id'];if(rpc[this['channel']+_0x3ecf('0x10')]){return rpc[this['channel']+_0x3ecf('0x10')][_0x3ecf('0x11')](_0x4d13b8)['then'](function(_0x1bc3c7){logger[_0x3ecf('0x12')](_0x3ecf('0x13'),_0x245570,_0x4d13b8['body']);_0xe52550['next']();})['catch'](function(_0x5df0be){logger[_0x3ecf('0x14')](_0x3ecf('0x13'),_0x245570,JSON[_0x3ecf('0x15')](_0x5df0be));_0xe52550[_0x3ecf('0x16')]();});}}catch(_0x5dd720){logger['error']('[%s][MESSAGE]\x20%s',_0x245570,JSON[_0x3ecf('0x15')](_0x5dd720));_0xe52550[_0x3ecf('0x16')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/noop.js b/server/services/routing/server/applications/noop.js index fd9b95a..ef99d40 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 _0xc888=['getMustacheRender','next','error','stringify','stop','../../../../config/logger','consequence','[%s][NOOP]\x20%s'];(function(_0x215dc8,_0x52c245){var _0x583ea3=function(_0x32350d){while(--_0x32350d){_0x215dc8['push'](_0x215dc8['shift']());}};_0x583ea3(++_0x52c245);}(_0xc888,0x9d));var _0x8c88=function(_0x187e82,_0x5254eb){_0x187e82=_0x187e82-0x0;var _0x58625e=_0xc888[_0x187e82];return _0x58625e;};'use strict';var utils=require('./utils');var logger=require(_0x8c88('0x0'))('routing');exports[_0x8c88('0x1')]=function(_0x10ae16,_0x5edf9a){return function(_0x42fa93){try{logger['info'](_0x8c88('0x2'),_0x10ae16,utils[_0x8c88('0x3')](_0x5edf9a[0x0],this));_0x42fa93[_0x8c88('0x4')]();}catch(_0x4500ca){logger[_0x8c88('0x5')](_0x8c88('0x2'),_0x10ae16,JSON[_0x8c88('0x6')](_0x4500ca));_0x42fa93[_0x8c88('0x7')]();}};}; \ No newline at end of file +var _0x3510=['error','stringify','stop','./utils','../../../../config/logger','routing','consequence','info','[%s][NOOP]\x20%s','getMustacheRender','next'];(function(_0x30033a,_0x5ce4a6){var _0x5e3518=function(_0x11494a){while(--_0x11494a){_0x30033a['push'](_0x30033a['shift']());}};_0x5e3518(++_0x5ce4a6);}(_0x3510,0xa8));var _0x0351=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0x3510[_0x46aff0];return _0x9d78cf;};'use strict';var utils=require(_0x0351('0x0'));var logger=require(_0x0351('0x1'))(_0x0351('0x2'));exports[_0x0351('0x3')]=function(_0x174500,_0x57b35e){return function(_0x156a83){try{logger[_0x0351('0x4')](_0x0351('0x5'),_0x174500,utils[_0x0351('0x6')](_0x57b35e[0x0],this));_0x156a83[_0x0351('0x7')]();}catch(_0x598eca){logger[_0x0351('0x8')](_0x0351('0x5'),_0x174500,JSON[_0x0351('0x9')](_0x598eca));_0x156a83[_0x0351('0xa')]();}};}; \ 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 74a2ead..e027c7d 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 _0xe424=['lodash','util','seq-queue','moment','ioredis','../../../../config/environment','../../../../config/logger','./strategy','redis','defaults','socket.io-emitter','account','queue','from','joinAt','clone','queue_id','push','InteractionId','%sQueuesWaitingInteractions','pick','format','%s_queue_waiting_interaction:%s','save','remove','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','../../rpc/mailInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel','QueueId','interaction','message','chat','AccountId','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','error','create\x20queue\x20report','accepted','update','then','QueueReport','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','catch','toLowerCase','consequence','map','join','stop','find','Queues','atimeout','rules','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','complete','[%s][QUEUE]\x20APPLICATION\x20END','next','rrmemory','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','[%s][QUEUE]\x20%s','validate'];(function(_0xaa793a,_0x45c8d3){var _0x16d1a9=function(_0x4d3bb9){while(--_0x4d3bb9){_0xaa793a['push'](_0xaa793a['shift']());}};_0x16d1a9(++_0x45c8d3);}(_0xe424,0x13f));var _0x4e42=function(_0x581af1,_0x4f02c5){_0x581af1=_0x581af1-0x0;var _0x54c22e=_0xe424[_0x581af1];return _0x54c22e;};'use strict';var schema=require(_0x4e42('0x0'));var _=require(_0x4e42('0x1'));var util=require(_0x4e42('0x2'));var seqqueue=require(_0x4e42('0x3'));var moment=require(_0x4e42('0x4'));var Redis=require(_0x4e42('0x5'));var config=require(_0x4e42('0x6'));var logger=require(_0x4e42('0x7'))('routing');var strategy=require(_0x4e42('0x8'));config[_0x4e42('0x9')]=_[_0x4e42('0xa')](config[_0x4e42('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0x4e42('0xb'))(new Redis(config[_0x4e42('0x9')]));var attributes=['id','queue_id',_0x4e42('0xc'),_0x4e42('0xd'),_0x4e42('0xe'),_0x4e42('0xf')];function emit(_0xc5ae9e,_0x164f3d,_0x935af7){io['to'](_0xc5ae9e)['emit'](_0x164f3d,_0x935af7);}function emitChannelQueueInteraction(_0x159839,_0x511124,_0x301f19,_0x3f84e3,_0x38c2fc,_0x398d2d,_0x117369,_0x37ba91){var _0x3d3908=_[_0x4e42('0x10')](_0x301f19);_0x3d3908[_0x4e42('0x11')]=_0x37ba91;_0x3d3908[_0x4e42('0xd')]=_0x511124;_0x3d3908[_0x4e42('0xc')]=_0x3f84e3;_0x3d3908['id']=_0x38c2fc;if(_0x398d2d){attributes[_0x4e42('0x12')](_['capitalize'](_0x159839)+_0x4e42('0x13'));_0x117369[util['format'](_0x4e42('0x14'),_0x159839)][_0x38c2fc]=_[_0x4e42('0x15')](_0x3d3908,attributes);}else{delete _0x117369[util[_0x4e42('0x16')](_0x4e42('0x14'),_0x159839)][_0x38c2fc];}emit(util[_0x4e42('0x16')]('%s:queue:%s',_0x159839,_0x511124),util[_0x4e42('0x16')](_0x4e42('0x17'),_0x159839,_0x398d2d?_0x4e42('0x18'):_0x4e42('0x19')),_[_0x4e42('0x15')](_0x3d3908,attributes));}var rpc={'openchannelQueueReport':require(_0x4e42('0x1a')),'mailQueueReport':require(_0x4e42('0x1b')),'chatQueueReport':require(_0x4e42('0x1c')),'smsQueueReport':require(_0x4e42('0x1d')),'faxQueueReport':require(_0x4e42('0x1e')),'whatsappQueueReport':require(_0x4e42('0x1f')),'chatInteraction':require('../../rpc/chatInteraction'),'faxInteraction':require('../../rpc/faxInteraction'),'mailInteraction':require(_0x4e42('0x20')),'openchannelInteraction':require(_0x4e42('0x21')),'smsInteraction':require(_0x4e42('0x22')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var queue=schema({'name':{'type':_0x4e42('0x23'),'required':!![],'message':_0x4e42('0x24')},'timeout':{'type':'number','message':'timeout\x20is\x20a\x20number'}});function startRouting(_0x10f9bc,_0x2dfd89,_0x2be258,_0x1ac15f){if(_0x10f9bc&&_0x2dfd89&&_0x2be258){_0x2dfd89[_0x4e42('0x25')]+=0x1;var _0x2ee52b={'uniqueid':_0x10f9bc,'from':_0x2be258[_0x4e42('0x26')]?_0x2be258[_0x4e42('0x26')][_0x4e42('0xe')]:'','joinAt':moment()[_0x4e42('0x16')](_0x4e42('0x27')),'ContactId':_0x2be258[_0x4e42('0x28')]?_0x2be258[_0x4e42('0x28')]['id']:null,'ListId':_0x2be258[_0x4e42('0x29')]?_0x2be258[_0x4e42('0x29')]['id']:null};_0x2ee52b[_[_0x4e42('0x2a')](_0x2be258[_0x4e42('0x2b')])+_0x4e42('0x2c')]=_0x2dfd89['id']||null;_0x2ee52b[_[_0x4e42('0x2a')](_0x2be258[_0x4e42('0x2b')])+_0x4e42('0x13')]=_0x2be258[_0x4e42('0x2d')]?_0x2be258[_0x4e42('0x2d')]['id']:null;_0x2ee52b[_[_0x4e42('0x2a')](_0x2be258['channel'])+'MessageId']=_0x2be258['message']?_0x2be258[_0x4e42('0x2e')]['id']:null;_0x2ee52b[_['upperFirst'](_0x2be258[_0x4e42('0x2b')])+(_0x2be258[_0x4e42('0x2b')]!==_0x4e42('0x2f')?_0x4e42('0x30'):_0x4e42('0x31'))]=_0x2be258[_0x4e42('0xc')]?_0x2be258[_0x4e42('0xc')]['id']:null;logger[_0x4e42('0x32')](util['format'](_0x4e42('0x33'),_0x10f9bc,_0x2dfd89[_0x4e42('0x34')]));emitChannelQueueInteraction(_0x2be258[_0x4e42('0x2b')],_0x2dfd89['name'],_0x2ee52b,_0x2be258['account']['name'],_0x2be258[_0x4e42('0x2e')]['id'],!![],_0x1ac15f,_0x2dfd89['id']);if(rpc[_0x2be258[_0x4e42('0x2b')]+'QueueReport']){return rpc[_0x2be258[_0x4e42('0x2b')]+'QueueReport']['create'](_0x2ee52b)['catch'](function(_0x3e53b7){logger[_0x4e42('0x35')](_0x4e42('0x36'),_0x3e53b7);});}}}function stopRouting(_0x40c735,_0x477ad6,_0xe77883,_0x1f185a){if(_0x40c735&&_0x477ad6){_0x477ad6['waiting']-=0x1;var _0x40e5ad={'leaveAt':moment()[_0x4e42('0x16')]('YYYY-MM-DD\x20HH:mm:ss'),'acceptAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0x4e42('0x37')};logger[_0x4e42('0x32')](util[_0x4e42('0x16')]('[%s][STOP:QUEUE][NAME:%s]',_0x40c735,_0x477ad6['name']));emitChannelQueueInteraction(_0xe77883[_0x4e42('0x2b')],_0x477ad6[_0x4e42('0x34')],_0xe77883[_0x4e42('0x26')],_0xe77883[_0x4e42('0xc')][_0x4e42('0x34')],_0xe77883[_0x4e42('0x2e')]['id'],![],_0x1f185a,_0x477ad6['id']);return rpc[_0xe77883[_0x4e42('0x2b')]+'Interaction'][_0x4e42('0x38')](_0xe77883[_0x4e42('0x2d')]['id'],{'queueId':_0x477ad6['id']})[_0x4e42('0x39')](function(){if(rpc[_0xe77883[_0x4e42('0x2b')]+_0x4e42('0x3a')]){return rpc[_0xe77883[_0x4e42('0x2b')]+_0x4e42('0x3a')][_0x4e42('0x38')](_0x40c735,_0x40e5ad)['catch'](function(_0x321959){logger['error'](_0x4e42('0x3b'),_0x321959);});}});}}function endRouting(_0x6d2b2d,_0x2f8a3d,_0x4ec2b6,_0x45c419){if(_0x6d2b2d&&_0x2f8a3d){_0x2f8a3d[_0x4e42('0x25')]-=0x1;var _0x29213f={'leaveAt':moment()[_0x4e42('0x16')](_0x4e42('0x27')),'exitAt':moment()[_0x4e42('0x16')](_0x4e42('0x27')),'reason':_0x4e42('0x3c')};logger[_0x4e42('0x32')](util[_0x4e42('0x16')](_0x4e42('0x3d'),_0x6d2b2d,_0x2f8a3d['name']));emitChannelQueueInteraction(_0x4ec2b6[_0x4e42('0x2b')],_0x2f8a3d[_0x4e42('0x34')],_0x4ec2b6['body'],_0x4ec2b6[_0x4e42('0xc')][_0x4e42('0x34')],_0x4ec2b6[_0x4e42('0x2e')]['id'],![],_0x45c419);if(rpc[_0x4ec2b6[_0x4e42('0x2b')]+_0x4e42('0x3a')]){return rpc[_0x4ec2b6['channel']+_0x4e42('0x3a')][_0x4e42('0x38')](_0x6d2b2d,_0x29213f)[_0x4e42('0x3e')](function(_0x1addd2){logger[_0x4e42('0x35')](_0x4e42('0x3b'),_0x1addd2);});}}}function handleFindQueue(_0x369ed2){return function(_0x29c222){return _0x29c222[_0x4e42('0x34')]['toLowerCase']()===_0x369ed2[_0x4e42('0x3f')]();};}exports[_0x4e42('0x40')]=function(_0x53ed98,_0x2bd0d9,_0x4cb2c5,_0x1b40d1){return function(_0x778985){try{var _0x3f3127={'name':_0x2bd0d9[0x0],'timeout':_0x2bd0d9[0x1]};var _0x3688be=queue[_0x4e42('0x0')](_0x3f3127,{'typecast':!![]});if(_0x3688be['length']){logger[_0x4e42('0x35')]('[%s][QUEUE]\x20%s',_0x53ed98,_[_0x4e42('0x41')](_0x3688be,_0x4e42('0x2e'))[_0x4e42('0x42')](',\x20'));_0x778985[_0x4e42('0x43')]();}else{var _0x5bb286=_[_0x4e42('0x44')](_0x4cb2c5[_0x1b40d1[_0x4e42('0x2b')]+_0x4e42('0x45')],handleFindQueue(_0x3f3127[_0x4e42('0x34')]));if(_0x5bb286){startRouting(_0x53ed98,_0x5bb286,_0x1b40d1,_0x4cb2c5);var _0x11a68e=(_0x5bb286['timeout']||0xa)*0x3e8;var _0x198acf=(_0x3f3127[_0x4e42('0x3c')]||0x14)*0x3e8;var _0x41b03d;if(_0x11a68e>_0x198acf){_0x198acf=_0x11a68e;}var _0x225186=seqqueue['createQueue'](_0x11a68e);_0x225186['id']=_0x53ed98;_0x225186[_0x4e42('0x46')]=_0x11a68e;_0x225186['qtimeout']=_0x198acf;_0x225186['channel']=_0x1b40d1[_0x4e42('0x2b')];_0x4cb2c5[_0x4e42('0x47')][_0x53ed98]['on']('end',function(){logger['info'](_0x4e42('0x48'),_0x53ed98);stopRouting(_0x53ed98,_0x5bb286,_0x1b40d1,_0x4cb2c5);clearTimeout(_0x41b03d);_0x41b03d=undefined;_0x225186[_0x4e42('0x49')](!![]);if(_0x4cb2c5['rules'][_0x53ed98]){delete _0x4cb2c5['rules'][_0x53ed98];}_0x778985[_0x4e42('0x43')]();});_0x4cb2c5[_0x4e42('0x47')][_0x53ed98]['on'](_0x4e42('0x4a'),function(){if(_0x4cb2c5[_0x4e42('0x47')][_0x53ed98]){delete _0x4cb2c5[_0x4e42('0x47')][_0x53ed98];}});_0x41b03d=setTimeout(function(){logger[_0x4e42('0x32')](_0x4e42('0x4b'),_0x53ed98);endRouting(_0x53ed98,_0x5bb286,_0x1b40d1,_0x4cb2c5);clearTimeout(_0x41b03d);_0x225186[_0x4e42('0x49')](!![]);_0x778985[_0x4e42('0x4c')]();},_0x198acf);switch(_0x5bb286['strategy']){case _0x4e42('0x4d'):strategy[_0x4e42('0x4d')](_0x225186,_0x5bb286,_0x4cb2c5,_0x1b40d1);break;default:strategy['beepall'](_0x225186,_0x5bb286,_0x4cb2c5,_0x1b40d1);}}else{logger[_0x4e42('0x35')](_0x4e42('0x4e'),_0x53ed98,_0x3f3127['name']);_0x778985[_0x4e42('0x43')]();}}}catch(_0x5a7341){logger[_0x4e42('0x35')](_0x4e42('0x4f'),_0x53ed98,_0x5a7341['stack']);_0x778985[_0x4e42('0x43')]();}};}; \ No newline at end of file +var _0x9632=['info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','catch','error','YYYY-MM-DD\x20HH:mm:ss','[%s][STOP:QUEUE][NAME:%s]','Interaction','then','update','update\x20queue\x20report','toLowerCase','consequence','length','[%s][QUEUE]\x20%s','map','join','stop','find','Queues','timeout','createQueue','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','complete','[%s][QUEUE]\x20APPLICATION\x20END','strategy','rrmemory','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','validate','lodash','util','seq-queue','../../../../config/environment','../../../../config/logger','routing','./strategy','redis','localhost','socket.io-emitter','queue_id','account','from','joinAt','clone','queue','capitalize','InteractionId','pick','format','save','remove','../../rpc/openchannelQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','../../rpc/faxInteraction','../../rpc/mailInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/whatsappInteraction','string','number','timeout\x20is\x20a\x20number','waiting','body','contact','list','upperFirst','QueueId','channel','interaction','MessageId','message','chat','AccountId'];(function(_0x1d8119,_0xc98f17){var _0x3e30f6=function(_0x2c7f3e){while(--_0x2c7f3e){_0x1d8119['push'](_0x1d8119['shift']());}};_0x3e30f6(++_0xc98f17);}(_0x9632,0x1b6));var _0x2963=function(_0x2f1be9,_0x2cbaf8){_0x2f1be9=_0x2f1be9-0x0;var _0x275c0d=_0x9632[_0x2f1be9];return _0x275c0d;};'use strict';var schema=require(_0x2963('0x0'));var _=require(_0x2963('0x1'));var util=require(_0x2963('0x2'));var seqqueue=require(_0x2963('0x3'));var moment=require('moment');var Redis=require('ioredis');var config=require(_0x2963('0x4'));var logger=require(_0x2963('0x5'))(_0x2963('0x6'));var strategy=require(_0x2963('0x7'));config[_0x2963('0x8')]=_['defaults'](config[_0x2963('0x8')],{'host':_0x2963('0x9'),'port':0x18eb});var io=require(_0x2963('0xa'))(new Redis(config[_0x2963('0x8')]));var attributes=['id',_0x2963('0xb'),_0x2963('0xc'),'queue',_0x2963('0xd'),_0x2963('0xe')];function emit(_0x4fa985,_0x6468a7,_0x35029f){io['to'](_0x4fa985)['emit'](_0x6468a7,_0x35029f);}function emitChannelQueueInteraction(_0x29f880,_0x1a36c7,_0x31eaa8,_0x346563,_0x344025,_0x5d6dad,_0x645793,_0x1ae56e){var _0x48436a=_[_0x2963('0xf')](_0x31eaa8);_0x48436a['queue_id']=_0x1ae56e;_0x48436a[_0x2963('0x10')]=_0x1a36c7;_0x48436a[_0x2963('0xc')]=_0x346563;_0x48436a['id']=_0x344025;if(_0x5d6dad){attributes['push'](_[_0x2963('0x11')](_0x29f880)+_0x2963('0x12'));_0x645793[util['format']('%sQueuesWaitingInteractions',_0x29f880)][_0x344025]=_[_0x2963('0x13')](_0x48436a,attributes);}else{delete _0x645793[util['format']('%sQueuesWaitingInteractions',_0x29f880)][_0x344025];}emit(util[_0x2963('0x14')]('%s:queue:%s',_0x29f880,_0x1a36c7),util[_0x2963('0x14')]('%s_queue_waiting_interaction:%s',_0x29f880,_0x5d6dad?_0x2963('0x15'):_0x2963('0x16')),_[_0x2963('0x13')](_0x48436a,attributes));}var rpc={'openchannelQueueReport':require(_0x2963('0x17')),'mailQueueReport':require('../../rpc/mailQueueReport'),'chatQueueReport':require(_0x2963('0x18')),'smsQueueReport':require(_0x2963('0x19')),'faxQueueReport':require(_0x2963('0x1a')),'whatsappQueueReport':require(_0x2963('0x1b')),'chatInteraction':require('../../rpc/chatInteraction'),'faxInteraction':require(_0x2963('0x1c')),'mailInteraction':require(_0x2963('0x1d')),'openchannelInteraction':require(_0x2963('0x1e')),'smsInteraction':require(_0x2963('0x1f')),'whatsappInteraction':require(_0x2963('0x20'))};var queue=schema({'name':{'type':_0x2963('0x21'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0x2963('0x22'),'message':_0x2963('0x23')}});function startRouting(_0x242994,_0x2a6f87,_0x3cf3b5,_0x1a8351){if(_0x242994&&_0x2a6f87&&_0x3cf3b5){_0x2a6f87[_0x2963('0x24')]+=0x1;var _0x17eeff={'uniqueid':_0x242994,'from':_0x3cf3b5[_0x2963('0x25')]?_0x3cf3b5['body'][_0x2963('0xd')]:'','joinAt':moment()[_0x2963('0x14')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x3cf3b5['contact']?_0x3cf3b5[_0x2963('0x26')]['id']:null,'ListId':_0x3cf3b5[_0x2963('0x27')]?_0x3cf3b5[_0x2963('0x27')]['id']:null};_0x17eeff[_[_0x2963('0x28')](_0x3cf3b5['channel'])+_0x2963('0x29')]=_0x2a6f87['id']||null;_0x17eeff[_[_0x2963('0x28')](_0x3cf3b5[_0x2963('0x2a')])+_0x2963('0x12')]=_0x3cf3b5['interaction']?_0x3cf3b5[_0x2963('0x2b')]['id']:null;_0x17eeff[_[_0x2963('0x28')](_0x3cf3b5[_0x2963('0x2a')])+_0x2963('0x2c')]=_0x3cf3b5[_0x2963('0x2d')]?_0x3cf3b5[_0x2963('0x2d')]['id']:null;_0x17eeff[_[_0x2963('0x28')](_0x3cf3b5['channel'])+(_0x3cf3b5['channel']!==_0x2963('0x2e')?_0x2963('0x2f'):'WebsiteId')]=_0x3cf3b5[_0x2963('0xc')]?_0x3cf3b5['account']['id']:null;logger[_0x2963('0x30')](util[_0x2963('0x14')](_0x2963('0x31'),_0x242994,_0x2a6f87[_0x2963('0x32')]));emitChannelQueueInteraction(_0x3cf3b5[_0x2963('0x2a')],_0x2a6f87[_0x2963('0x32')],_0x17eeff,_0x3cf3b5[_0x2963('0xc')][_0x2963('0x32')],_0x3cf3b5[_0x2963('0x2d')]['id'],!![],_0x1a8351,_0x2a6f87['id']);if(rpc[_0x3cf3b5[_0x2963('0x2a')]+_0x2963('0x33')]){return rpc[_0x3cf3b5[_0x2963('0x2a')]+_0x2963('0x33')][_0x2963('0x34')](_0x17eeff)[_0x2963('0x35')](function(_0x6e3828){logger[_0x2963('0x36')]('create\x20queue\x20report',_0x6e3828);});}}}function stopRouting(_0x245192,_0x3c23d4,_0x4d5d04,_0x168138){if(_0x245192&&_0x3c23d4){_0x3c23d4[_0x2963('0x24')]-=0x1;var _0x80e678={'leaveAt':moment()[_0x2963('0x14')]('YYYY-MM-DD\x20HH:mm:ss'),'acceptAt':moment()[_0x2963('0x14')](_0x2963('0x37')),'reason':'accepted'};logger[_0x2963('0x30')](util[_0x2963('0x14')](_0x2963('0x38'),_0x245192,_0x3c23d4['name']));emitChannelQueueInteraction(_0x4d5d04['channel'],_0x3c23d4[_0x2963('0x32')],_0x4d5d04[_0x2963('0x25')],_0x4d5d04['account'][_0x2963('0x32')],_0x4d5d04[_0x2963('0x2d')]['id'],![],_0x168138,_0x3c23d4['id']);return rpc[_0x4d5d04[_0x2963('0x2a')]+_0x2963('0x39')]['update'](_0x4d5d04[_0x2963('0x2b')]['id'],{'queueId':_0x3c23d4['id']})[_0x2963('0x3a')](function(){if(rpc[_0x4d5d04[_0x2963('0x2a')]+_0x2963('0x33')]){return rpc[_0x4d5d04['channel']+_0x2963('0x33')][_0x2963('0x3b')](_0x245192,_0x80e678)[_0x2963('0x35')](function(_0x102970){logger[_0x2963('0x36')](_0x2963('0x3c'),_0x102970);});}});}}function endRouting(_0x629ef8,_0x1a589d,_0x357253,_0x1b9d37){if(_0x629ef8&&_0x1a589d){_0x1a589d[_0x2963('0x24')]-=0x1;var _0x239411={'leaveAt':moment()['format'](_0x2963('0x37')),'exitAt':moment()[_0x2963('0x14')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':'timeout'};logger[_0x2963('0x30')](util[_0x2963('0x14')]('[%s][END:QUEUE][NAME:%s]',_0x629ef8,_0x1a589d['name']));emitChannelQueueInteraction(_0x357253[_0x2963('0x2a')],_0x1a589d[_0x2963('0x32')],_0x357253[_0x2963('0x25')],_0x357253['account'][_0x2963('0x32')],_0x357253['message']['id'],![],_0x1b9d37);if(rpc[_0x357253[_0x2963('0x2a')]+_0x2963('0x33')]){return rpc[_0x357253[_0x2963('0x2a')]+_0x2963('0x33')][_0x2963('0x3b')](_0x629ef8,_0x239411)[_0x2963('0x35')](function(_0x1a8c8d){logger[_0x2963('0x36')](_0x2963('0x3c'),_0x1a8c8d);});}}}function handleFindQueue(_0x28b010){return function(_0x3ecda6){return _0x3ecda6[_0x2963('0x32')][_0x2963('0x3d')]()===_0x28b010['toLowerCase']();};}exports[_0x2963('0x3e')]=function(_0xa2491b,_0x2ef0b4,_0x52b041,_0x36ef4f){return function(_0x3a2539){try{var _0x30f0e6={'name':_0x2ef0b4[0x0],'timeout':_0x2ef0b4[0x1]};var _0x2b43be=queue[_0x2963('0x0')](_0x30f0e6,{'typecast':!![]});if(_0x2b43be[_0x2963('0x3f')]){logger[_0x2963('0x36')](_0x2963('0x40'),_0xa2491b,_[_0x2963('0x41')](_0x2b43be,'message')[_0x2963('0x42')](',\x20'));_0x3a2539[_0x2963('0x43')]();}else{var _0x525663=_[_0x2963('0x44')](_0x52b041[_0x36ef4f[_0x2963('0x2a')]+_0x2963('0x45')],handleFindQueue(_0x30f0e6['name']));if(_0x525663){startRouting(_0xa2491b,_0x525663,_0x36ef4f,_0x52b041);var _0x54a510=(_0x525663[_0x2963('0x46')]||0xa)*0x3e8;var _0x2c98a7=(_0x30f0e6[_0x2963('0x46')]||0x14)*0x3e8;var _0x51ff13;if(_0x54a510>_0x2c98a7){_0x2c98a7=_0x54a510;}var _0x5dd2ac=seqqueue[_0x2963('0x47')](_0x54a510);_0x5dd2ac['id']=_0xa2491b;_0x5dd2ac['atimeout']=_0x54a510;_0x5dd2ac['qtimeout']=_0x2c98a7;_0x5dd2ac[_0x2963('0x2a')]=_0x36ef4f[_0x2963('0x2a')];_0x52b041[_0x2963('0x48')][_0xa2491b]['on'](_0x2963('0x49'),function(){logger[_0x2963('0x30')](_0x2963('0x4a'),_0xa2491b);stopRouting(_0xa2491b,_0x525663,_0x36ef4f,_0x52b041);clearTimeout(_0x51ff13);_0x51ff13=undefined;_0x5dd2ac[_0x2963('0x4b')](!![]);if(_0x52b041['rules'][_0xa2491b]){delete _0x52b041['rules'][_0xa2491b];}_0x3a2539['stop']();});_0x52b041[_0x2963('0x48')][_0xa2491b]['on'](_0x2963('0x4c'),function(){if(_0x52b041['rules'][_0xa2491b]){delete _0x52b041[_0x2963('0x48')][_0xa2491b];}});_0x51ff13=setTimeout(function(){logger['info'](_0x2963('0x4d'),_0xa2491b);endRouting(_0xa2491b,_0x525663,_0x36ef4f,_0x52b041);clearTimeout(_0x51ff13);_0x5dd2ac[_0x2963('0x4b')](!![]);_0x3a2539['next']();},_0x2c98a7);switch(_0x525663[_0x2963('0x4e')]){case _0x2963('0x4f'):strategy[_0x2963('0x4f')](_0x5dd2ac,_0x525663,_0x52b041,_0x36ef4f);break;default:strategy['beepall'](_0x5dd2ac,_0x525663,_0x52b041,_0x36ef4f);}}else{logger[_0x2963('0x36')](_0x2963('0x50'),_0xa2491b,_0x30f0e6['name']);_0x3a2539[_0x2963('0x43')]();}}}catch(_0xe2d2d2){logger[_0x2963('0x36')](_0x2963('0x40'),_0xa2491b,_0xe2d2d2['stack']);_0x3a2539[_0x2963('0x43')]();}};}; \ 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 ee29a87..005e71a 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 _0x5178=['isNil','realtime','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','busy','saveWaitingNotification','channel','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','busyQueue','removeWaitingNotification','writeLog','STOP','TIMEOUT','exports','uuid','./util','../../../../../config/logger','routing','notificationId','agent','squeue','push','handleRun','bind','handleTimeout','drained','handleDrained','prototype','debug','[%s][AGENT]\x20try\x20with\x20%s'];(function(_0x1a36a5,_0x746928){var _0x746243=function(_0x481966){while(--_0x481966){_0x1a36a5['push'](_0x1a36a5['shift']());}};_0x746243(++_0x746928);}(_0x5178,0x171));var _0x8517=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x5178[_0x2d7f0e];return _0x110b07;};'use strict';var _=require('lodash');var uuid=require(_0x8517('0x0'));var util=require(_0x8517('0x1'));var logger=require(_0x8517('0x2'))(_0x8517('0x3'));var Agent=function(_0x38d5b3,_0x5e0a44,_0x483381,_0x3ed6a5){this[_0x8517('0x4')]=uuid['v4']();this['squeue']=_0x38d5b3;this[_0x8517('0x5')]=_0x5e0a44;this['realtime']=_0x483381;this[_0x8517('0x3')]=_0x3ed6a5;this[_0x8517('0x6')][_0x8517('0x7')](this[_0x8517('0x8')][_0x8517('0x9')](this),this['handleTimeout'][_0x8517('0x9')](this));this['squeue']['on']('timeout',this[_0x8517('0xa')][_0x8517('0x9')](this));this['squeue']['on'](_0x8517('0xb'),this[_0x8517('0xc')][_0x8517('0x9')](this));};Agent[_0x8517('0xd')][_0x8517('0x7')]=function(){this[_0x8517('0x6')][_0x8517('0x7')](this[_0x8517('0x8')]['bind'](this),this[_0x8517('0xa')][_0x8517('0x9')](this));};Agent[_0x8517('0xd')][_0x8517('0xc')]=function(){this[_0x8517('0xa')](!![]);};Agent['prototype'][_0x8517('0x8')]=function(){logger[_0x8517('0xe')](_0x8517('0xf'),this[_0x8517('0x6')]['id'],this[_0x8517('0x5')]['id']);if(_[_0x8517('0x10')](this[_0x8517('0x11')][_0x8517('0x12')][this[_0x8517('0x5')]['id']])){logger[_0x8517('0xe')](_0x8517('0x13'),this[_0x8517('0x6')]['id'],this['agent']['id']);setTimeout(this[_0x8517('0x7')][_0x8517('0x9')](this),0x3e8);}else{if(this[_0x8517('0x3')][_0x8517('0x14')]||util[_0x8517('0x15')](this[_0x8517('0x6')]['id'],this[_0x8517('0x11')]['agents'][this[_0x8517('0x5')]['id']],this['squeue']['channel'],![])){this[_0x8517('0x11')][_0x8517('0x12')][this[_0x8517('0x5')]['id']][_0x8517('0x16')]=!![];this[_0x8517('0x11')][_0x8517('0x12')][this['agent']['id']]['busyQueue']=undefined;util[_0x8517('0x17')](this[_0x8517('0x11')],this[_0x8517('0x3')],this[_0x8517('0x5')],this[_0x8517('0x6')][_0x8517('0x18')]);util['showNotification'](this[_0x8517('0x4')],this[_0x8517('0x6')]['id'],this['realtime'][_0x8517('0x12')][this[_0x8517('0x5')]['id']],null,this[_0x8517('0x3')]);util['writeLog'](this[_0x8517('0x6')]['id'],this['realtime'][_0x8517('0x12')][this[_0x8517('0x5')]['id']],_0x8517('0x19')+(this[_0x8517('0x3')][_0x8517('0x14')]?_0x8517('0x1a'):''));}else{logger['debug'](_0x8517('0x1b'),this['squeue']['id'],this[_0x8517('0x5')]['id']);setTimeout(this[_0x8517('0x7')][_0x8517('0x9')](this),0x3e8);}}};Agent[_0x8517('0xd')][_0x8517('0xa')]=function(_0x1b2423){if(_['isNil'](this[_0x8517('0x11')]['agents'][this[_0x8517('0x5')]['id']])){return logger[_0x8517('0xe')](_0x8517('0x13'),this[_0x8517('0x6')]['id'],this[_0x8517('0x5')]['id']);}else{logger[_0x8517('0xe')](_0x8517('0x1c'),this[_0x8517('0x6')]['id'],this[_0x8517('0x5')]['id']);util['hideNotification'](this[_0x8517('0x4')],this[_0x8517('0x6')]['id'],this[_0x8517('0x11')]['agents'][this['agent']['id']],null,this['routing']);this[_0x8517('0x11')][_0x8517('0x12')][this[_0x8517('0x5')]['id']][_0x8517('0x16')]=![];this[_0x8517('0x11')][_0x8517('0x12')][this['agent']['id']][_0x8517('0x1d')]=undefined;util[_0x8517('0x1e')](this[_0x8517('0x11')],this['routing'],this[_0x8517('0x5')],this['squeue'][_0x8517('0x18')]);util[_0x8517('0x1f')](this['squeue']['id'],this['realtime'][_0x8517('0x12')][this[_0x8517('0x5')]['id']],_0x1b2423?_0x8517('0x20'):_0x8517('0x21'));}if(!_0x1b2423){setTimeout(this['push']['bind'](this),0x3e8);}};function agent(_0x2cb889,_0x11a1b3,_0x1835ac,_0x516fb1){return new Agent(_0x2cb889,_0x11a1b3,_0x1835ac,_0x516fb1);}module[_0x8517('0x22')]=agent; \ No newline at end of file +var _0xb66c=['TIMEOUT','lodash','./util','routing','notificationId','squeue','agent','push','handleRun','bind','handleTimeout','timeout','handleDrained','prototype','debug','isNil','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','realtime','agents','busyQueue','saveWaitingNotification','channel','forcedOwnership',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','busy','writeLog','STOP'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xb66c,0x175));var _0xcb66=function(_0x56eb84,_0xc744f4){_0x56eb84=_0x56eb84-0x0;var _0x3c5fb5=_0xb66c[_0x56eb84];return _0x3c5fb5;};'use strict';var _=require(_0xcb66('0x0'));var uuid=require('uuid');var util=require(_0xcb66('0x1'));var logger=require('../../../../../config/logger')(_0xcb66('0x2'));var Agent=function(_0x24ea13,_0xf7ccc5,_0x5f487c,_0x35d439){this[_0xcb66('0x3')]=uuid['v4']();this[_0xcb66('0x4')]=_0x24ea13;this[_0xcb66('0x5')]=_0xf7ccc5;this['realtime']=_0x5f487c;this['routing']=_0x35d439;this[_0xcb66('0x4')][_0xcb66('0x6')](this[_0xcb66('0x7')][_0xcb66('0x8')](this),this[_0xcb66('0x9')]['bind'](this));this[_0xcb66('0x4')]['on'](_0xcb66('0xa'),this[_0xcb66('0x9')][_0xcb66('0x8')](this));this[_0xcb66('0x4')]['on']('drained',this[_0xcb66('0xb')][_0xcb66('0x8')](this));};Agent[_0xcb66('0xc')][_0xcb66('0x6')]=function(){this['squeue'][_0xcb66('0x6')](this[_0xcb66('0x7')][_0xcb66('0x8')](this),this[_0xcb66('0x9')]['bind'](this));};Agent[_0xcb66('0xc')][_0xcb66('0xb')]=function(){this[_0xcb66('0x9')](!![]);};Agent[_0xcb66('0xc')]['handleRun']=function(){logger[_0xcb66('0xd')]('[%s][AGENT]\x20try\x20with\x20%s',this[_0xcb66('0x4')]['id'],this['agent']['id']);if(_[_0xcb66('0xe')](this['realtime']['agents'][this[_0xcb66('0x5')]['id']])){logger[_0xcb66('0xd')](_0xcb66('0xf'),this[_0xcb66('0x4')]['id'],this['agent']['id']);setTimeout(this[_0xcb66('0x6')][_0xcb66('0x8')](this),0x3e8);}else{if(this[_0xcb66('0x2')]['forcedOwnership']||util[_0xcb66('0x10')](this['squeue']['id'],this[_0xcb66('0x11')][_0xcb66('0x12')][this[_0xcb66('0x5')]['id']],this[_0xcb66('0x4')]['channel'],![])){this['realtime']['agents'][this[_0xcb66('0x5')]['id']]['busy']=!![];this['realtime'][_0xcb66('0x12')][this['agent']['id']][_0xcb66('0x13')]=undefined;util[_0xcb66('0x14')](this[_0xcb66('0x11')],this[_0xcb66('0x2')],this[_0xcb66('0x5')],this[_0xcb66('0x4')][_0xcb66('0x15')]);util['showNotification'](this[_0xcb66('0x3')],this['squeue']['id'],this['realtime'][_0xcb66('0x12')][this[_0xcb66('0x5')]['id']],null,this[_0xcb66('0x2')]);util['writeLog'](this[_0xcb66('0x4')]['id'],this[_0xcb66('0x11')][_0xcb66('0x12')][this[_0xcb66('0x5')]['id']],'RINGING'+(this[_0xcb66('0x2')][_0xcb66('0x16')]?_0xcb66('0x17'):''));}else{logger[_0xcb66('0xd')](_0xcb66('0x18'),this[_0xcb66('0x4')]['id'],this[_0xcb66('0x5')]['id']);setTimeout(this[_0xcb66('0x6')][_0xcb66('0x8')](this),0x3e8);}}};Agent[_0xcb66('0xc')]['handleTimeout']=function(_0x2152dc){if(_['isNil'](this['realtime']['agents'][this[_0xcb66('0x5')]['id']])){return logger['debug'](_0xcb66('0xf'),this[_0xcb66('0x4')]['id'],this[_0xcb66('0x5')]['id']);}else{logger['debug'](_0xcb66('0x19'),this[_0xcb66('0x4')]['id'],this[_0xcb66('0x5')]['id']);util[_0xcb66('0x1a')](this[_0xcb66('0x3')],this[_0xcb66('0x4')]['id'],this[_0xcb66('0x11')][_0xcb66('0x12')][this[_0xcb66('0x5')]['id']],null,this[_0xcb66('0x2')]);this['realtime'][_0xcb66('0x12')][this[_0xcb66('0x5')]['id']][_0xcb66('0x1b')]=![];this[_0xcb66('0x11')][_0xcb66('0x12')][this[_0xcb66('0x5')]['id']][_0xcb66('0x13')]=undefined;util['removeWaitingNotification'](this[_0xcb66('0x11')],this[_0xcb66('0x2')],this[_0xcb66('0x5')],this[_0xcb66('0x4')]['channel']);util[_0xcb66('0x1c')](this[_0xcb66('0x4')]['id'],this[_0xcb66('0x11')][_0xcb66('0x12')][this[_0xcb66('0x5')]['id']],_0x2152dc?_0xcb66('0x1d'):_0xcb66('0x1e'));}if(!_0x2152dc){setTimeout(this[_0xcb66('0x6')][_0xcb66('0x8')](this),0x3e8);}};function agent(_0x299156,_0x3dc592,_0x17b087,_0x4ef8ba){return new Agent(_0x299156,_0x3dc592,_0x17b087,_0x4ef8ba);}module['exports']=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 714da27..9f2f717 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 _0x9265=['busy','busyQueue','removeWaitingNotification','exports','lodash','./util','../../../../../config/logger','routing','queue','realtime','squeue','push','handleRun','bind','handleTimeout','timeout','drained','prototype','isNil','Agents','length','agents','debug','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','channel','writeLog','RINGING','saveWaitingNotification','showNotification','notificationId','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','[%s][QUEUE]\x20EMPTY','hideNotification','TIMEOUT'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x9265,0x1ee));var _0x5926=function(_0x2e595c,_0x450c00){_0x2e595c=_0x2e595c-0x0;var _0x2fd3e1=_0x9265[_0x2e595c];return _0x2fd3e1;};'use strict';var _=require(_0x5926('0x0'));var uuid=require('uuid');var util=require(_0x5926('0x1'));var logger=require(_0x5926('0x2'))(_0x5926('0x3'));var Beepall=function(_0x1ef5dd,_0x128505,_0x3106a6,_0x137134){this['notificationId']=uuid['v4']();this['squeue']=_0x1ef5dd;this[_0x5926('0x4')]=_0x128505;this[_0x5926('0x5')]=_0x3106a6;this['routing']=_0x137134;this[_0x5926('0x6')][_0x5926('0x7')](this[_0x5926('0x8')][_0x5926('0x9')](this),this[_0x5926('0xa')][_0x5926('0x9')](this));this[_0x5926('0x6')]['on'](_0x5926('0xb'),this[_0x5926('0xa')][_0x5926('0x9')](this));this['squeue']['on'](_0x5926('0xc'),this['handleDrained'][_0x5926('0x9')](this));};Beepall[_0x5926('0xd')][_0x5926('0x7')]=function(){this[_0x5926('0x6')][_0x5926('0x7')](this[_0x5926('0x8')]['bind'](this),this[_0x5926('0xa')]['bind'](this));};Beepall[_0x5926('0xd')]['handleDrained']=function(){this[_0x5926('0xa')](!![]);};Beepall['prototype']['handleRun']=function(){var _0xaa765d=!![];if(!_[_0x5926('0xe')](this[_0x5926('0x4')])&&!_[_0x5926('0xe')](this[_0x5926('0x4')][_0x5926('0xf')])&&this[_0x5926('0x4')][_0x5926('0xf')][_0x5926('0x10')]>0x0){for(var _0x1b79a0=0x0,_0x2a5e98;_0x1b79a00x0){for(var _0xf5fa9=0x0,_0x2aa6f4;_0xf5fa90x0&&_0x2e010d[_0x2c3d31+'CurrentCapacity']>=_0x2e010d[_0x2c3d31+_0x0a9f('0x24')]){writeLog(_0x1c3a4f,_0x2e010d,_0x2c3d31['toUpperCase']()+_0x0a9f('0x26'));return![];}}return!![];};exports[_0x0a9f('0x27')]=function(_0x74f17d,_0x4dbb18,_0x331b2d,_0x47f3fc,_0x2244aa){return sendNotification(!![],_0x74f17d,_0x4dbb18,_0x331b2d,_0x47f3fc,_0x2244aa);};exports['hideNotification']=function(_0x52cae3,_0x540374,_0x44b380,_0x433801,_0x163d67){return sendNotification(![],_0x52cae3,_0x540374,_0x44b380,_0x433801,_0x163d67);};exports['checkWaitingNotifications']=function(_0x48e90b,_0x18d470,_0x48cfc5){var _0x31ca86=_0x18d470['interaction']['UserId'];if(!_0x31ca86&&_0x48cfc5){_0x31ca86=_0x48cfc5['id'];}var _0x7af7ef=_[_0x0a9f('0x28')](_0x48e90b[_0x18d470[_0x0a9f('0x29')]+_0x0a9f('0x2a')],function(_0x40bd5d){var _0x340d94=_[_0x0a9f('0x2b')](_0x18d470[_0x0a9f('0x29')])+_0x0a9f('0x2c');return _0x40bd5d[_0x340d94]===_0x18d470['interaction']['id'];});if(!_0x7af7ef&&_0x31ca86&&_0x48e90b['agents'][_0x31ca86]){_0x7af7ef=_['some'](_0x48e90b['agents'][_0x31ca86][_0x18d470['channel']+_0x0a9f('0x2d')],function(_0xa5a235){return _0xa5a235['id']===_0x18d470[_0x0a9f('0x2e')]['id'];});}return _0x7af7ef;};exports['saveWaitingNotification']=function(_0x3de055,_0x3d47aa,_0xb00a4a,_0x53e52f){if(_0xb00a4a&&_0xb00a4a['id']&&_0x3de055[_0x0a9f('0x2f')]&&_0x3de055['agents'][_0xb00a4a['id']]){_0x3de055[_0x0a9f('0x2f')][_0xb00a4a['id']][_0x53e52f+_0x0a9f('0x2d')][_0x3d47aa['message']['id']]={'id':_0x3d47aa[_0x0a9f('0x2e')]['id']};}};exports[_0x0a9f('0x30')]=function(_0x340efd,_0x22a329,_0x52f230,_0x192c48){if(_0x52f230&&_0x52f230['id']&&_0x340efd[_0x0a9f('0x2f')]&&_0x340efd[_0x0a9f('0x2f')][_0x52f230['id']]){delete _0x340efd[_0x0a9f('0x2f')][_0x52f230['id']][_0x192c48+_0x0a9f('0x2d')][_0x22a329[_0x0a9f('0x31')]['id']];}};exports['writeLog']=writeLog; \ No newline at end of file +var _0xbaf7=['capitalize','interaction','agents','WaitingInteractions','saveWaitingNotification','lodash','util','../utils','ioredis','../../../../../config/environment','routing','redis','defaults','localhost','socket.io-emitter','split','\x20interaction','notificationSound','account','notificationShake','body','queue','msg','I\x20can\x27t\x20render\x20your\x20template','format','[%s][QUEUE]\x20%s','message','user:%s','name','emit','notification:%s','save','remove','debug','[%s][QUEUE][AGENT:%s][STATUS:%s]','busy','BUSY','online','OFFLINE','Pause','PAUSE','hasOwnProperty','Capacity','CurrentCapacity','toUpperCase','\x20MAXCAPACITY','checkWaitingNotifications','UserId','some','channel','QueuesWaitingInteractions'];(function(_0x3f1506,_0x857e16){var _0x3019e1=function(_0x10b78f){while(--_0x10b78f){_0x3f1506['push'](_0x3f1506['shift']());}};_0x3019e1(++_0x857e16);}(_0xbaf7,0x137));var _0x7baf=function(_0x40f2fa,_0xade550){_0x40f2fa=_0x40f2fa-0x0;var _0x1685c9=_0xbaf7[_0x40f2fa];return _0x1685c9;};'use strict';var _=require(_0x7baf('0x0'));var util=require(_0x7baf('0x1'));var utils=require(_0x7baf('0x2'));var Redis=require(_0x7baf('0x3'));var config=require(_0x7baf('0x4'));var logger=require('../../../../../config/logger')(_0x7baf('0x5'));config[_0x7baf('0x6')]=_[_0x7baf('0x7')](config[_0x7baf('0x6')],{'host':_0x7baf('0x8'),'port':0x18eb});var io=require(_0x7baf('0x9'))(new Redis(config[_0x7baf('0x6')]));function sendNotification(_0x4d83ed,_0x40ab9f,_0x310e0c,_0xa4cbe5,_0x301361,_0x33aecd){var _0x59ef84=_0x33aecd||{};var _0x56997e=_0x310e0c[_0x7baf('0xa')]('.');var _0x5b1529={'uniqueid':_0x40ab9f,'channel':_0x56997e[0x0],'id':_0x56997e[0x1],'title':_0x56997e[0x0]+_0x7baf('0xb'),'interactionId':_0x56997e[0x2],'queue':_0x301361?_0x301361['name']:null,'sound':_0x59ef84['account'][_0x7baf('0xc')],'shake':_0x59ef84[_0x7baf('0xd')][_0x7baf('0xe')]};try{if(!_0x59ef84['body']){_0x59ef84[_0x7baf('0xf')]={};}if(_0x301361){_0x59ef84[_0x7baf('0xf')][_0x7baf('0x10')]=_0x301361;}else if(_0x59ef84[_0x7baf('0xf')][_0x7baf('0x10')]){delete _0x59ef84[_0x7baf('0xf')][_0x7baf('0x10')];}_0x5b1529[_0x7baf('0x11')]=utils['getMustacheRender'](_0x59ef84[_0x7baf('0xd')]['notificationTemplate'],_0x59ef84);}catch(_0x38df2e){_0x5b1529[_0x7baf('0x11')]=_0x7baf('0x12');logger['error'](util[_0x7baf('0x13')](_0x7baf('0x14'),_0x40ab9f,_0x38df2e[_0x7baf('0x15')]));}io['to'](util[_0x7baf('0x13')](_0x7baf('0x16'),_0xa4cbe5[_0x7baf('0x17')]))[_0x7baf('0x18')](util[_0x7baf('0x13')](_0x7baf('0x19'),_0x4d83ed?_0x7baf('0x1a'):_0x7baf('0x1b')),_0x5b1529);}function writeLog(_0x2201f7,_0x428a6c,_0x3a9350){return logger[_0x7baf('0x1c')](util[_0x7baf('0x13')](_0x7baf('0x1d'),_0x2201f7,_0x428a6c[_0x7baf('0x17')],_0x3a9350));}exports['isAgentAvailable']=function(_0x9a8f82,_0x4cb942,_0x4800c4,_0x3428a4){if(_0x4cb942[_0x7baf('0x1e')]){writeLog(_0x9a8f82,_0x4cb942,_0x7baf('0x1f'));return![];}if(!_0x4cb942[_0x7baf('0x20')]){writeLog(_0x9a8f82,_0x4cb942,_0x7baf('0x21'));return![];}if(_0x4cb942[_0x4800c4+_0x7baf('0x22')]){writeLog(_0x9a8f82,_0x4cb942,_0x7baf('0x23'));return![];}if(_0x3428a4&&_0x4cb942[_0x7baf('0x24')](_0x4800c4+_0x7baf('0x25'))&&_0x4cb942['hasOwnProperty'](_0x4800c4+'CurrentCapacity')){if(_0x4cb942[_0x4800c4+_0x7baf('0x25')]>0x0&&_0x4cb942[_0x4800c4+_0x7baf('0x26')]>=_0x4cb942[_0x4800c4+_0x7baf('0x25')]){writeLog(_0x9a8f82,_0x4cb942,_0x4800c4[_0x7baf('0x27')]()+_0x7baf('0x28'));return![];}}return!![];};exports['showNotification']=function(_0xfda2ae,_0x5cedc5,_0x3a7691,_0x539ebf,_0x1f63c8){return sendNotification(!![],_0xfda2ae,_0x5cedc5,_0x3a7691,_0x539ebf,_0x1f63c8);};exports['hideNotification']=function(_0x4d64e5,_0x3ccb36,_0x5b9c9c,_0x357d1f,_0x1971b9){return sendNotification(![],_0x4d64e5,_0x3ccb36,_0x5b9c9c,_0x357d1f,_0x1971b9);};exports[_0x7baf('0x29')]=function(_0x1cf5be,_0x1c9f3d,_0x415484){var _0x144e9c=_0x1c9f3d['interaction'][_0x7baf('0x2a')];if(!_0x144e9c&&_0x415484){_0x144e9c=_0x415484['id'];}var _0x34bfd8=_[_0x7baf('0x2b')](_0x1cf5be[_0x1c9f3d[_0x7baf('0x2c')]+_0x7baf('0x2d')],function(_0x363080){var _0x2f4530=_[_0x7baf('0x2e')](_0x1c9f3d[_0x7baf('0x2c')])+'InteractionId';return _0x363080[_0x2f4530]===_0x1c9f3d[_0x7baf('0x2f')]['id'];});if(!_0x34bfd8&&_0x144e9c&&_0x1cf5be[_0x7baf('0x30')][_0x144e9c]){_0x34bfd8=_[_0x7baf('0x2b')](_0x1cf5be[_0x7baf('0x30')][_0x144e9c][_0x1c9f3d[_0x7baf('0x2c')]+_0x7baf('0x31')],function(_0x499e5a){return _0x499e5a['id']===_0x1c9f3d[_0x7baf('0x2f')]['id'];});}return _0x34bfd8;};exports[_0x7baf('0x32')]=function(_0x4cf568,_0x7d954b,_0xddaebf,_0x335f97){if(_0xddaebf&&_0xddaebf['id']&&_0x4cf568[_0x7baf('0x30')]&&_0x4cf568['agents'][_0xddaebf['id']]){_0x4cf568[_0x7baf('0x30')][_0xddaebf['id']][_0x335f97+_0x7baf('0x31')][_0x7d954b[_0x7baf('0x15')]['id']]={'id':_0x7d954b[_0x7baf('0x2f')]['id']};}};exports['removeWaitingNotification']=function(_0x2cea83,_0x5935f9,_0x9771da,_0x42d1a3){if(_0x9771da&&_0x9771da['id']&&_0x2cea83[_0x7baf('0x30')]&&_0x2cea83['agents'][_0x9771da['id']]){delete _0x2cea83[_0x7baf('0x30')][_0x9771da['id']][_0x42d1a3+'WaitingInteractions'][_0x5935f9[_0x7baf('0x15')]['id']];}};exports['writeLog']=writeLog; \ No newline at end of file diff --git a/server/services/routing/server/applications/system.js b/server/services/routing/server/applications/system.js index 7d3691e..0a734a1 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 _0x8926=['getMustacheRender','[%s][SYSTEM]\x20result\x20code:\x20%s','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','isObject','stringify','shelljs','lodash','./utils','../../../../config/logger','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','validate','[%s][SYSTEM]\x20%s','map','message','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next'];(function(_0x40ddc0,_0x41c082){var _0x1aebf1=function(_0x3ba1f6){while(--_0x3ba1f6){_0x40ddc0['push'](_0x40ddc0['shift']());}};_0x1aebf1(++_0x41c082);}(_0x8926,0x199));var _0x6892=function(_0x5a641f,_0x112a0e){_0x5a641f=_0x5a641f-0x0;var _0x5c779f=_0x8926[_0x5a641f];return _0x5c779f;};'use strict';var schema=require('validate');var sh=require(_0x6892('0x0'));var _=require(_0x6892('0x1'));var utils=require(_0x6892('0x2'));var logger=require(_0x6892('0x3'))(_0x6892('0x4'));var system=schema({'command':{'type':_0x6892('0x5'),'required':!![],'message':_0x6892('0x6')}});exports[_0x6892('0x7')]=function(_0x5e288e,_0x6fceb1){return function(_0x45e1f6){try{var _0x370d12={'command':_0x6fceb1[0x0]};var _0x570475=system[_0x6892('0x8')](_0x370d12,{'typecast':!![]});if(_0x570475['length']){logger['error'](_0x6892('0x9'),_0x5e288e,_[_0x6892('0xa')](_0x570475,_0x6892('0xb'))[_0x6892('0xc')](',\x20'));logger[_0x6892('0xd')](_0x6892('0xe'),_0x5e288e);_0x45e1f6[_0x6892('0xf')]();}else{var _0x36fd93=this;var _0x397f11=utils[_0x6892('0x10')](_0x6fceb1[0x0],this);logger[_0x6892('0xd')]('[%s][SYSTEM]\x20commnad:\x20%s',_0x5e288e,_0x397f11);sh['exec'](_['trim'](_0x397f11),function(_0x3295e3,_0x180c58){logger[_0x6892('0xd')](_0x6892('0x11'),_0x5e288e,_0x3295e3);if(_0x3295e3==0x0){var _0x42c83d=_0x180c58['replace'](/(\r\n|\n|\r)/gm,'');if(_[_0x6892('0x12')](_0x6fceb1[0x1])||_[_0x6892('0x13')](_0x6fceb1[0x1])){logger[_0x6892('0xd')](_0x6892('0x14'),_0x5e288e);_0x36fd93[_0x6892('0x15')][_0x6fceb1[0x1]]=_0x42c83d;}else{logger['info'](_0x6892('0x16'),_0x5e288e,_0x6fceb1[0x1],_0x42c83d);_0x36fd93['body'][_0x6fceb1[0x1]]=_0x42c83d;}}_0x45e1f6[_0x6892('0xf')]();});}}catch(_0x28f8e2){logger['error']('[%s][SYSTEM]\x20%s',_0x5e288e,_[_0x6892('0x17')](_0x28f8e2)?JSON[_0x6892('0x18')](_0x28f8e2):_0x28f8e2);logger[_0x6892('0xd')](_0x6892('0xe'),_0x5e288e);_0x45e1f6[_0x6892('0xf')]();}};}; \ No newline at end of file +var _0xec82=['[%s][SYSTEM]\x20%s','message','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','isNil','[%s][SYSTEM]\x20no\x20variable','body','stringify','validate','./utils','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error'];(function(_0x59107e,_0x44032c){var _0x20de63=function(_0x4e3a57){while(--_0x4e3a57){_0x59107e['push'](_0x59107e['shift']());}};_0x20de63(++_0x44032c);}(_0xec82,0x184));var _0x2ec8=function(_0x304795,_0x567c54){_0x304795=_0x304795-0x0;var _0x1b3b4f=_0xec82[_0x304795];return _0x1b3b4f;};'use strict';var schema=require(_0x2ec8('0x0'));var sh=require('shelljs');var _=require('lodash');var utils=require(_0x2ec8('0x1'));var logger=require('../../../../config/logger')(_0x2ec8('0x2'));var system=schema({'command':{'type':_0x2ec8('0x3'),'required':!![],'message':_0x2ec8('0x4')}});exports[_0x2ec8('0x5')]=function(_0x38493c,_0x1bfe18){return function(_0x444c4e){try{var _0x305ddb={'command':_0x1bfe18[0x0]};var _0x41655b=system[_0x2ec8('0x0')](_0x305ddb,{'typecast':!![]});if(_0x41655b[_0x2ec8('0x6')]){logger[_0x2ec8('0x7')](_0x2ec8('0x8'),_0x38493c,_['map'](_0x41655b,_0x2ec8('0x9'))[_0x2ec8('0xa')](',\x20'));logger[_0x2ec8('0xb')](_0x2ec8('0xc'),_0x38493c);_0x444c4e[_0x2ec8('0xd')]();}else{var _0x1ce7b4=this;var _0x36d3f8=utils[_0x2ec8('0xe')](_0x1bfe18[0x0],this);logger['info']('[%s][SYSTEM]\x20commnad:\x20%s',_0x38493c,_0x36d3f8);sh[_0x2ec8('0xf')](_[_0x2ec8('0x10')](_0x36d3f8),function(_0x3374d2,_0x2b1cf0){logger['info'](_0x2ec8('0x11'),_0x38493c,_0x3374d2);if(_0x3374d2==0x0){var _0x39f270=_0x2b1cf0['replace'](/(\r\n|\n|\r)/gm,'');if(_[_0x2ec8('0x12')](_0x1bfe18[0x1])||_['isEmpty'](_0x1bfe18[0x1])){logger[_0x2ec8('0xb')](_0x2ec8('0x13'),_0x38493c);_0x1ce7b4['body'][_0x1bfe18[0x1]]=_0x39f270;}else{logger['info']('[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s',_0x38493c,_0x1bfe18[0x1],_0x39f270);_0x1ce7b4[_0x2ec8('0x14')][_0x1bfe18[0x1]]=_0x39f270;}}_0x444c4e[_0x2ec8('0xd')]();});}}catch(_0x2901be){logger[_0x2ec8('0x7')](_0x2ec8('0x8'),_0x38493c,_['isObject'](_0x2901be)?JSON[_0x2ec8('0x15')](_0x2901be):_0x2901be);logger[_0x2ec8('0xb')](_0x2ec8('0xc'),_0x38493c);_0x444c4e[_0x2ec8('0xd')]();}};}; \ 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 3d150d5..7676642 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 _0x5798=['TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','length','error','[%s][TAG]\x20%s','map','join','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','Interaction','interaction','info','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','stringify','finally','isObject','validate','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger'];(function(_0x7b889a,_0xfd568f){var _0x20725f=function(_0x4878b9){while(--_0x4878b9){_0x7b889a['push'](_0x7b889a['shift']());}};_0x20725f(++_0xfd568f);}(_0x5798,0xd0));var _0x8579=function(_0x33ebf5,_0x258ec6){_0x33ebf5=_0x33ebf5-0x0;var _0x66957b=_0x5798[_0x33ebf5];return _0x66957b;};'use strict';var schema=require(_0x8579('0x0'));var _=require(_0x8579('0x1'));var rpc={'chatInteraction':require(_0x8579('0x2')),'openchannelInteraction':require(_0x8579('0x3')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0x8579('0x4')),'faxInteraction':require(_0x8579('0x5')),'whatsappInteraction':require(_0x8579('0x6'))};var logger=require(_0x8579('0x7'))('routing');var tag=schema({'tag':{'type':'number','required':!![],'message':_0x8579('0x8')}});exports['consequence']=function(_0x5ce3ac,_0x201518,_0x41df86,_0x42b346){return function(_0x5a8bb3){try{var _0x3abefa={'tag':_0x201518[0x0]};var _0x3da9c8=tag[_0x8579('0x0')](_0x3abefa,{'typecast':!![]});if(_0x3da9c8[_0x8579('0x9')]){logger[_0x8579('0xa')](_0x8579('0xb'),_0x5ce3ac,_[_0x8579('0xc')](_0x3da9c8,'message')[_0x8579('0xd')](',\x20'));logger['info'](_0x8579('0xe'),_0x5ce3ac);_0x5a8bb3[_0x8579('0xf')]();}else{var _0x9121a3={'ids':[_0x201518[0x0]]};if(rpc[_0x42b346[_0x8579('0x10')]+'Interaction']){rpc[_0x42b346['channel']+_0x8579('0x11')]['addTags'](_0x42b346[_0x8579('0x12')]['id'],_0x9121a3)['then'](function(_0x5ea37a){logger[_0x8579('0x13')](_0x8579('0x14'),_0x5ce3ac,_0x201518[0x1],_0x42b346[_0x8579('0x10')],_0x42b346[_0x8579('0x12')]['id']);})['catch'](function(_0x4c72d0){logger[_0x8579('0xa')](_0x8579('0xb'),_0x5ce3ac,JSON[_0x8579('0x15')](_0x4c72d0));logger['info'](_0x8579('0xe'),_0x5ce3ac);})[_0x8579('0x16')](function(){_0x5a8bb3[_0x8579('0xf')]();});}}}catch(_0x18b52d){logger[_0x8579('0xa')](_0x8579('0xb'),_0x5ce3ac,_[_0x8579('0x17')](_0x18b52d)?JSON[_0x8579('0x15')](_0x18b52d):_0x18b52d);logger[_0x8579('0x13')](_0x8579('0xe'),_0x5ce3ac);_0x5a8bb3[_0x8579('0xf')]();}};}; \ No newline at end of file +var _0x88f2=['../../rpc/faxInteraction','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','error','[%s][TAG]\x20%s','map','message','join','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','Interaction','addTags','interaction','then','info','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','finally','isObject','stringify','validate','lodash','../../rpc/openchannelInteraction','../../rpc/smsInteraction'];(function(_0x285a42,_0x395ef3){var _0x35c8c4=function(_0x2ced4d){while(--_0x2ced4d){_0x285a42['push'](_0x285a42['shift']());}};_0x35c8c4(++_0x395ef3);}(_0x88f2,0x11c));var _0x288f=function(_0x34268f,_0x54f78d){_0x34268f=_0x34268f-0x0;var _0x4560bf=_0x88f2[_0x34268f];return _0x4560bf;};'use strict';var schema=require(_0x288f('0x0'));var _=require(_0x288f('0x1'));var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0x288f('0x2')),'smsInteraction':require(_0x288f('0x3')),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0x288f('0x4')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var logger=require('../../../../config/logger')('routing');var tag=schema({'tag':{'type':_0x288f('0x5'),'required':!![],'message':_0x288f('0x6')}});exports['consequence']=function(_0x5a7153,_0x25c457,_0x302a19,_0x4155d5){return function(_0x8937e9){try{var _0x57cf01={'tag':_0x25c457[0x0]};var _0x444c2b=tag[_0x288f('0x0')](_0x57cf01,{'typecast':!![]});if(_0x444c2b['length']){logger[_0x288f('0x7')](_0x288f('0x8'),_0x5a7153,_[_0x288f('0x9')](_0x444c2b,_0x288f('0xa'))[_0x288f('0xb')](',\x20'));logger['info'](_0x288f('0xc'),_0x5a7153);_0x8937e9[_0x288f('0xd')]();}else{var _0x195446={'ids':[_0x25c457[0x0]]};if(rpc[_0x4155d5[_0x288f('0xe')]+_0x288f('0xf')]){rpc[_0x4155d5[_0x288f('0xe')]+'Interaction'][_0x288f('0x10')](_0x4155d5[_0x288f('0x11')]['id'],_0x195446)[_0x288f('0x12')](function(_0x5a147c){logger[_0x288f('0x13')](_0x288f('0x14'),_0x5a7153,_0x25c457[0x1],_0x4155d5[_0x288f('0xe')],_0x4155d5['interaction']['id']);})['catch'](function(_0x2956a0){logger[_0x288f('0x7')]('[%s][TAG]\x20%s',_0x5a7153,JSON['stringify'](_0x2956a0));logger[_0x288f('0x13')](_0x288f('0xc'),_0x5a7153);})[_0x288f('0x15')](function(){_0x8937e9[_0x288f('0xd')]();});}}}catch(_0x15bb66){logger[_0x288f('0x7')](_0x288f('0x8'),_0x5a7153,_[_0x288f('0x16')](_0x15bb66)?JSON[_0x288f('0x17')](_0x15bb66):_0x15bb66);logger[_0x288f('0x13')](_0x288f('0xc'),_0x5a7153);_0x8937e9[_0x288f('0xd')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/tvox.js b/server/services/routing/server/applications/tvox.js index a744f21..ca26609 100644 --- a/server/services/routing/server/applications/tvox.js +++ b/server/services/routing/server/applications/tvox.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc806=['../../../../config/logger','routing','lodash','consequence','replace','\x20-\x20','includes','push','urlOnAnswer','?params=','urlOnRing','jsonrpc','2.0','method','login','params','stringify','POST','application/json-rpc','then','parse','logged','channelId=','&sessionId=','info','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','stop','catch','error','[%s][TVOX]\x20%s','isObject','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next'];(function(_0x580576,_0x2f107d){var _0x3f55a0=function(_0x2e180b){while(--_0x2e180b){_0x580576['push'](_0x580576['shift']());}};_0x3f55a0(++_0x2f107d);}(_0xc806,0xa5));var _0x6c80=function(_0x5b923e,_0x1707cb){_0x5b923e=_0x5b923e-0x0;var _0x21b3bf=_0xc806[_0x5b923e];return _0x21b3bf;};'use strict';var rp=require('request-promise');var logger=require(_0x6c80('0x0'))(_0x6c80('0x1'));var _=require(_0x6c80('0x2'));var arr=[];exports[_0x6c80('0x3')]=function(_0x4ebd6d,_0x1abee1){return function(_0x54b690){var _0x41cbea=_0x1abee1[0xa];var _0x194724=_0x1abee1[0xb];var _0x37283f=_0x1abee1[0xc];var _0x226640=_0x1abee1[0xd];var _0x187202=_0x1abee1[0xe];var _0x16dab3=_0x1abee1[0xf][_0x6c80('0x4')](/\n/g,_0x6c80('0x5'));var _0x1361c9=_0x1abee1[0x10]['replace'](/\n/g,'\x20');if(!arr[_0x6c80('0x6')](_0x194724)){arr[_0x6c80('0x7')](_0x194724);var _0x275422=_0x1abee1[0x3];var _0x5a56d6=_0x1abee1[0x4];var _0x56c920=_0x1abee1[0x1];var _0x4d5293=_0x1abee1[0x0];var _0x34b732={};_0x34b732[_0x6c80('0x8')]=_0x1abee1[0x8]+_0x6c80('0x9')+_0x37283f+'|'+_0x41cbea+'|'+_0x226640+'|'+_0x194724+'|'+_0x187202;_0x34b732[_0x6c80('0xa')]=_0x1abee1[0x7]+_0x6c80('0x9')+_0x37283f+'|'+_0x41cbea+'|'+_0x226640+'|'+_0x194724+'|'+_0x187202+'|'+_0x16dab3+'|'+_0x1361c9;_0x34b732['title']=_0x1abee1[0x9];var _0x137ab2={};_0x137ab2[_0x6c80('0xb')]=_0x6c80('0xc');_0x137ab2[_0x6c80('0xd')]=_0x6c80('0xe');var _0x540169=[];_0x540169[_0x6c80('0x7')](_0x1abee1[0x2]);_0x540169[_0x6c80('0x7')](_0x1abee1[0x5]);_0x540169[_0x6c80('0x7')](_0x1abee1[0x6]);_0x137ab2[_0x6c80('0xf')]=_0x540169;_0x137ab2['id']=0x1;var _0x2dc594=JSON[_0x6c80('0x10')](_0x137ab2);var _0x1a9c3e={'encoding':'utf8','method':_0x6c80('0x11'),'timeout':0x2710,'url':_0x275422,'headers':{'Content-Type':_0x6c80('0x12')},'body':_0x2dc594};return rp(_0x1a9c3e)[_0x6c80('0x13')](function(_0x3b87b9){const _0x12cb05=JSON[_0x6c80('0x14')](_0x3b87b9);if(!_0x12cb05['result'][_0x6c80('0x15')]){throw new Error('Unable\x20to\x20login\x20with\x20TVox\x20application');}var _0x28b50f=_0x194724;var _0x5f3905=_0x6c80('0x16')+_0x56c920+'&serviceId='+_0x4d5293+_0x6c80('0x17')+_0x28b50f+'&data='+JSON[_0x6c80('0x10')](_0x34b732);var _0x1a99f8=_0x5a56d6+'?'+_0x5f3905;return rp(_0x1a99f8);})[_0x6c80('0x13')](function(_0x417bbe){logger[_0x6c80('0x18')](_0x6c80('0x19'),_0x4ebd6d,_0x417bbe);_0x54b690[_0x6c80('0x1a')]();})[_0x6c80('0x1b')](function(_0x121f6e){logger[_0x6c80('0x1c')](_0x6c80('0x1d'),_0x4ebd6d,_[_0x6c80('0x1e')](_0x121f6e)?JSON[_0x6c80('0x10')](_0x121f6e):_0x121f6e);_0x54b690['stop']();});}else{logger[_0x6c80('0x18')](_0x6c80('0x1f'),_0x4ebd6d);_0x54b690[_0x6c80('0x20')]();}};}; \ No newline at end of file +var _0xa04a=['&sessionId=','stringify','info','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','catch','error','[%s][TVOX]\x20%s','isObject','stop','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','../../../../config/logger','routing','lodash','consequence','replace','includes','push','urlOnAnswer','?params=','urlOnRing','jsonrpc','login','params','utf8','POST','application/json-rpc','then','parse','result','Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','&serviceId='];(function(_0x221089,_0x44c7e1){var _0x65b9ee=function(_0x3856c9){while(--_0x3856c9){_0x221089['push'](_0x221089['shift']());}};_0x65b9ee(++_0x44c7e1);}(_0xa04a,0x1ca));var _0xaa04=function(_0x19d060,_0x48acdc){_0x19d060=_0x19d060-0x0;var _0x51900a=_0xa04a[_0x19d060];return _0x51900a;};'use strict';var rp=require('request-promise');var logger=require(_0xaa04('0x0'))(_0xaa04('0x1'));var _=require(_0xaa04('0x2'));var arr=[];exports[_0xaa04('0x3')]=function(_0x118b30,_0x339c46){return function(_0x179130){var _0x45bbc4=_0x339c46[0xa];var _0x29886f=_0x339c46[0xb];var _0x7f00d=_0x339c46[0xc];var _0x4dd964=_0x339c46[0xd];var _0x292658=_0x339c46[0xe];var _0x3bae3b=_0x339c46[0xf]['replace'](/\n/g,'\x20-\x20');var _0x134479=_0x339c46[0x10][_0xaa04('0x4')](/\n/g,'\x20');if(!arr[_0xaa04('0x5')](_0x29886f)){arr[_0xaa04('0x6')](_0x29886f);var _0x49418f=_0x339c46[0x3];var _0x3041ce=_0x339c46[0x4];var _0x3c8808=_0x339c46[0x1];var _0x355a92=_0x339c46[0x0];var _0x1cbba6={};_0x1cbba6[_0xaa04('0x7')]=_0x339c46[0x8]+_0xaa04('0x8')+_0x7f00d+'|'+_0x45bbc4+'|'+_0x4dd964+'|'+_0x29886f+'|'+_0x292658;_0x1cbba6[_0xaa04('0x9')]=_0x339c46[0x7]+_0xaa04('0x8')+_0x7f00d+'|'+_0x45bbc4+'|'+_0x4dd964+'|'+_0x29886f+'|'+_0x292658+'|'+_0x3bae3b+'|'+_0x134479;_0x1cbba6['title']=_0x339c46[0x9];var _0x21594f={};_0x21594f[_0xaa04('0xa')]='2.0';_0x21594f['method']=_0xaa04('0xb');var _0x5b7c86=[];_0x5b7c86['push'](_0x339c46[0x2]);_0x5b7c86[_0xaa04('0x6')](_0x339c46[0x5]);_0x5b7c86[_0xaa04('0x6')](_0x339c46[0x6]);_0x21594f[_0xaa04('0xc')]=_0x5b7c86;_0x21594f['id']=0x1;var _0x3598fe=JSON['stringify'](_0x21594f);var _0x33ce0c={'encoding':_0xaa04('0xd'),'method':_0xaa04('0xe'),'timeout':0x2710,'url':_0x49418f,'headers':{'Content-Type':_0xaa04('0xf')},'body':_0x3598fe};return rp(_0x33ce0c)[_0xaa04('0x10')](function(_0x25d67b){const _0x5a08ed=JSON[_0xaa04('0x11')](_0x25d67b);if(!_0x5a08ed[_0xaa04('0x12')]['logged']){throw new Error(_0xaa04('0x13'));}var _0xed6c2e=_0x29886f;var _0x45f59f=_0xaa04('0x14')+_0x3c8808+_0xaa04('0x15')+_0x355a92+_0xaa04('0x16')+_0xed6c2e+'&data='+JSON[_0xaa04('0x17')](_0x1cbba6);var _0xc2275e=_0x3041ce+'?'+_0x45f59f;return rp(_0xc2275e);})[_0xaa04('0x10')](function(_0x54dd2a){logger[_0xaa04('0x18')](_0xaa04('0x19'),_0x118b30,_0x54dd2a);_0x179130['stop']();})[_0xaa04('0x1a')](function(_0x402b76){logger[_0xaa04('0x1b')](_0xaa04('0x1c'),_0x118b30,_[_0xaa04('0x1d')](_0x402b76)?JSON[_0xaa04('0x17')](_0x402b76):_0x402b76);_0x179130[_0xaa04('0x1e')]();});}else{logger['info'](_0xaa04('0x1f'),_0x118b30);_0x179130['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 48112e1..b4e4249 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(_0x1d7643,_0x11cecb){var _0xf27e63=function(_0x50eea2){while(--_0x50eea2){_0x1d7643['push'](_0x1d7643['shift']());}};_0xf27e63(++_0x11cecb);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0xa9e0[_0x3c4737];return _0x2bb926;};'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 _0xa9e0=['message','account','interaction','mustache','lodash','exports','render','body','contact'];(function(_0x4eabef,_0x5c2fb1){var _0x526b54=function(_0x58e5ec){while(--_0x58e5ec){_0x4eabef['push'](_0x4eabef['shift']());}};_0x526b54(++_0x5c2fb1);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xa9e0[_0xbca1b1];return _0x4e1686;};'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 diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index 2555fc2..fdf6245 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 _0xf4a9=['Push\x20new\x20rule','on\x20interval','\x20|\x20','execute','info','Applications\x20executed','stringify','matchPath','emit','Skipped\x20routing\x20for\x20%s','No\x20applications\x20to\x20execute','stack','error','routing\x20is\x20empty','agent','agents','end','QueueReport','update','UserId','error\x20update\x20queue\x20report','message\x20is\x20empty','busy','capacity','hasOwnProperty','CurrentCapacity','agent\x20not\x20found','find','chatQueues','available','name','paused','mailQueues','waiting','openchannelQueues','smsQueues','loggedIn','faxQueues','whatsappQueues','values','openchannelQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','127.0.0.1','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','bluebird','./applications/strategy/util','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','listen','rules','channel','message','interaction','checkWaitingNotifications','transfer','applications','isArray','length','existsSync','join','app','.js','toLowerCase','mail','push','slice','split','dialogflowv2','appdata','tag','TagId','tvox','getMustacheRender','account','notificationTemplate','ContactId','body','%s:%s:%s','./interval','intervals','./applications/','consequence','priority'];(function(_0x4d65c0,_0x3fc577){var _0x3683a3=function(_0x41cabb){while(--_0x41cabb){_0x4d65c0['push'](_0x4d65c0['shift']());}};_0x3683a3(++_0x3fc577);}(_0xf4a9,0x164));var _0x9f4a=function(_0x12723c,_0x148a5a){_0x12723c=_0x12723c-0x0;var _0x3fc804=_0xf4a9[_0x12723c];return _0x3fc804;};'use strict';var _=require(_0x9f4a('0x0'));var util=require(_0x9f4a('0x1'));var path=require('path');var fs=require('fs');var jayson=require(_0x9f4a('0x2'));var BPromise=require(_0x9f4a('0x3'));var utils=require('./applications/utils');var sUtils=require(_0x9f4a('0x4'));var logger=require(_0x9f4a('0x5'))(_0x9f4a('0x6'));var rpc={'openchannelQueueReport':require(_0x9f4a('0x7')),'mailQueueReport':require(_0x9f4a('0x8')),'chatQueueReport':require(_0x9f4a('0x9')),'smsQueueReport':require(_0x9f4a('0xa')),'faxQueueReport':require(_0x9f4a('0xb')),'whatsappQueueReport':require(_0x9f4a('0xc'))};var RuleEngine=require(_0x9f4a('0xd'));function getId(_0x485bcc,_0x23576c,_0xe24605){return util[_0x9f4a('0xe')](_0x9f4a('0xf'),_0x485bcc,_0x23576c||0x0,_0xe24605||0x0);}function getIntervals(_0x6bffff,_0x3a1781){var _0x14264e=[];if(!_[_0x9f4a('0x10')](_0x3a1781[_0x9f4a('0x11')])&&!_['isNil'](_0x6bffff[_0x3a1781['IntervalId']])&&!_[_0x9f4a('0x10')](_0x6bffff[_0x3a1781[_0x9f4a('0x11')]][_0x9f4a('0x12')])){_0x14264e=_[_0x9f4a('0x13')](_0x6bffff[_0x3a1781[_0x9f4a('0x11')]][_0x9f4a('0x12')],_0x9f4a('0x14'));}else if(!_[_0x9f4a('0x10')](_0x3a1781[_0x9f4a('0x14')])){_0x14264e=[_0x3a1781[_0x9f4a('0x14')]];}return _0x14264e;}exports[_0x9f4a('0x15')]=function(_0x2c1398){_0x2c1398[_0x9f4a('0x16')]={};return new BPromise(function(_0x52d0ee,_0x973739){var _0x2525b5={'Start':function(_0x579574){var _0x38454c=this;return new Promise(function(_0x16e448,_0x157754){if(_0x579574){try{var _0xf2b5a1=[];var _0x30582f=getId(_0x579574[_0x9f4a('0x17')],_0x579574[_0x9f4a('0x18')]?_0x579574[_0x9f4a('0x18')]['id']:0x0,_0x579574[_0x9f4a('0x19')]?_0x579574['interaction']['id']:0x0);var _0x5f3050=sUtils[_0x9f4a('0x1a')](_0x2c1398,_0x579574);if(_0x579574[_0x9f4a('0x1b')]||!_0x5f3050&&_0x579574[_0x9f4a('0x1c')]&&_[_0x9f4a('0x1d')](_0x579574[_0x9f4a('0x1c')])&&_0x579574[_0x9f4a('0x1c')]['length']){for(var _0x15fdc5=0x0;_0x15fdc5<_0x579574[_0x9f4a('0x1c')][_0x9f4a('0x1e')];_0x15fdc5+=0x1){var _0x74776b=_0x579574['applications'][_0x15fdc5];if(fs[_0x9f4a('0x1f')](path[_0x9f4a('0x20')](__dirname,_0x9f4a('0x1c'),_0x74776b[_0x9f4a('0x21')]+_0x9f4a('0x22')))){var _0x557a2e=[];switch(_0x74776b['app'][_0x9f4a('0x23')]()){case'autoreply':var _0x56b767=_0x74776b['appdata']['split'](',');if(_0x579574[_0x9f4a('0x17')]===_0x9f4a('0x24')){_0x557a2e['push'](_0x56b767[0x0]);_0x557a2e[_0x9f4a('0x25')](_0x56b767[0x1]);_0x557a2e[_0x9f4a('0x25')](_0x56b767['slice'](0x2,_0x56b767['length'])[_0x9f4a('0x20')](','));}else{_0x557a2e[_0x9f4a('0x25')](_0x56b767[0x0]);_0x557a2e[_0x9f4a('0x25')](_0x56b767[_0x9f4a('0x26')](0x1,_0x56b767[_0x9f4a('0x1e')])[_0x9f4a('0x20')](','));}break;case'dialogflow':var _0xa60a21=_0x74776b['appdata'][_0x9f4a('0x27')](',');_0x557a2e[_0x9f4a('0x25')](_0xa60a21[0x0]);_0x557a2e[_0x9f4a('0x25')](_0xa60a21[0x1]);_0x557a2e[_0x9f4a('0x25')](_0xa60a21[_0x9f4a('0x26')](0x2,_0xa60a21[_0x9f4a('0x1e')])[_0x9f4a('0x20')](','));break;case _0x9f4a('0x28'):var _0x1ea51=_0x74776b[_0x9f4a('0x29')][_0x9f4a('0x27')](',');_0x557a2e[_0x9f4a('0x25')](_0x1ea51[0x0]);_0x557a2e[_0x9f4a('0x25')](_0x1ea51[0x1]);_0x557a2e[_0x9f4a('0x25')](_0x1ea51[0x2]);_0x557a2e['push'](_0x1ea51[0x3]);_0x557a2e[_0x9f4a('0x25')](_0x1ea51[_0x9f4a('0x26')](0x4,_0x1ea51[_0x9f4a('0x1e')])[_0x9f4a('0x20')](','));break;case'amazonlex':var _0x272b96=_0x74776b[_0x9f4a('0x29')][_0x9f4a('0x27')](',');_0x557a2e[_0x9f4a('0x25')](_0x272b96[0x0]);_0x557a2e[_0x9f4a('0x25')](_0x272b96[0x1]);_0x557a2e['push'](_0x272b96[0x2]);_0x557a2e[_0x9f4a('0x25')](_0x272b96[0x3]);_0x557a2e[_0x9f4a('0x25')](_0x272b96[_0x9f4a('0x26')](0x4,_0x272b96[_0x9f4a('0x1e')])[_0x9f4a('0x20')](','));break;case _0x9f4a('0x18'):_0x557a2e[_0x9f4a('0x25')](_0x74776b[_0x9f4a('0x29')]);break;case _0x9f4a('0x2a'):_0x557a2e[_0x9f4a('0x25')](_0x74776b[_0x9f4a('0x2b')]);_0x557a2e[_0x9f4a('0x25')](_0x74776b['appdata']);break;case _0x9f4a('0x2c'):var _0x4bf7d6=utils[_0x9f4a('0x2d')](_0x579574[_0x9f4a('0x2e')][_0x9f4a('0x2f')],_0x579574);var _0x5e1df9=_0x74776b[_0x9f4a('0x29')][_0x9f4a('0x27')](',');_0x557a2e['push'](_0x5e1df9[0x0]);_0x557a2e[_0x9f4a('0x25')](_0x5e1df9[0x1]);_0x557a2e['push'](_0x5e1df9[0x2]);_0x557a2e[_0x9f4a('0x25')](_0x5e1df9[0x3]);_0x557a2e['push'](_0x5e1df9[0x4]);_0x557a2e[_0x9f4a('0x25')](_0x5e1df9[0x5]);_0x557a2e[_0x9f4a('0x25')](_0x5e1df9[0x6]);_0x557a2e[_0x9f4a('0x25')](_0x5e1df9[0x7]);_0x557a2e[_0x9f4a('0x25')](_0x5e1df9[0x8]);_0x557a2e[_0x9f4a('0x25')](_0x5e1df9[0x9]);_0x557a2e[_0x9f4a('0x25')](_0x5e1df9[0xa]);_0x557a2e[_0x9f4a('0x25')](_0x579574[_0x9f4a('0x19')]['id']);_0x557a2e[_0x9f4a('0x25')](_0x579574[_0x9f4a('0x18')]['id']);_0x557a2e[_0x9f4a('0x25')](_0x74776b['ChatWebsiteId']);_0x557a2e['push'](_0x579574[_0x9f4a('0x19')][_0x9f4a('0x30')]);_0x557a2e[_0x9f4a('0x25')](_0x579574[_0x9f4a('0x31')][_0x9f4a('0x31')]);_0x557a2e['push'](_0x4bf7d6);break;default:_0x557a2e=_['isNil'](_0x74776b['appdata'])?[]:_0x74776b[_0x9f4a('0x29')][_0x9f4a('0x27')](',');}var _0x16cd24={'id':util[_0x9f4a('0xe')](_0x9f4a('0x32'),_0x30582f,_0x74776b['id'],_0x74776b[_0x9f4a('0x21')]),'condition':require(_0x9f4a('0x33'))['condition'](_0x30582f,getIntervals(_0x2c1398[_0x9f4a('0x34')],_0x74776b),_0x2c1398),'consequence':require(_0x9f4a('0x35')+_0x74776b[_0x9f4a('0x21')])[_0x9f4a('0x36')](_0x30582f,_0x557a2e,_0x2c1398,_0x579574),'p':_0x74776b[_0x9f4a('0x37')]||0x0};logger['info'](_0x9f4a('0x38'),_0x16cd24['id'],_0x9f4a('0x39'),getIntervals(_0x2c1398[_0x9f4a('0x34')],_0x74776b)['join'](_0x9f4a('0x3a')));_0xf2b5a1[_0x9f4a('0x25')](_0x16cd24);}else{logger['error']('Please\x20create\x20a\x20new\x20file\x20under',path[_0x9f4a('0x20')](__dirname,'applications',_0x74776b['app']+_0x9f4a('0x22')));}}_0x2c1398[_0x9f4a('0x16')][_0x30582f]=new RuleEngine(_0xf2b5a1);_0x2c1398['rules'][_0x30582f][_0x9f4a('0x3b')](_0x579574,function(_0x2a0c84){logger[_0x9f4a('0x3c')](_0x9f4a('0x3d'),JSON[_0x9f4a('0x3e')](_0x2a0c84[_0x9f4a('0x3f')]));if(_0x2c1398[_0x9f4a('0x16')][_0x30582f]){_0x2c1398[_0x9f4a('0x16')][_0x30582f][_0x9f4a('0x40')]('complete');}});return _0x16e448({'code':0xc8,'message':_0x579574});}else{if(_0x5f3050){logger[_0x9f4a('0x3c')](util[_0x9f4a('0xe')](_0x9f4a('0x41'),_0x30582f));}else{logger['info'](_0x9f4a('0x42'));}return _0x16e448({'code':0xc8,'message':_0x579574});}}catch(_0x6f88b6){logger['error'](_0x6f88b6[_0x9f4a('0x43')]);return _0x157754(_0x38454c[_0x9f4a('0x44')](0x1f4,_0x6f88b6));}}return _0x157754(_0x9f4a('0x45'));});},'AcceptMessage':function(_0x3cb5c4){var _0x4ffb1d=this;return new Promise(function(_0x566e35,_0x210a36){if(_0x3cb5c4[_0x9f4a('0x46')]&&_0x3cb5c4[_0x9f4a('0x46')]['id']){if(_0x2c1398['agents'][_0x3cb5c4[_0x9f4a('0x46')]['id']]){_0x2c1398['agents'][_0x3cb5c4['agent']['id']]['busy']=![];_0x2c1398[_0x9f4a('0x47')][_0x3cb5c4[_0x9f4a('0x46')]['id']]['busyQueue']=undefined;}}if(_0x3cb5c4[_0x9f4a('0x18')]&&_0x3cb5c4[_0x9f4a('0x18')]['id']){try{var _0x7df13b=getId(_0x3cb5c4[_0x9f4a('0x17')],_0x3cb5c4[_0x9f4a('0x18')]?_0x3cb5c4[_0x9f4a('0x18')]['id']:0x0,_0x3cb5c4[_0x9f4a('0x19')]?_0x3cb5c4['interaction']['id']:0x0);if(_0x2c1398['rules'][_0x7df13b]){_0x2c1398['rules'][_0x7df13b][_0x9f4a('0x40')](_0x9f4a('0x48'));if(rpc[_0x3cb5c4['channel']+_0x9f4a('0x49')]){rpc[_0x3cb5c4[_0x9f4a('0x17')]+_0x9f4a('0x49')][_0x9f4a('0x4a')](_0x7df13b,{'UserId':_0x3cb5c4[_0x9f4a('0x18')][_0x9f4a('0x4b')]})['catch'](function(){logger[_0x9f4a('0x44')](_0x9f4a('0x4c'));});}}return _0x566e35({'code':0xc8,'message':_0x3cb5c4});}catch(_0x5ddf5a){logger[_0x9f4a('0x44')](_0x5ddf5a[_0x9f4a('0x43')]);return _0x210a36(_0x4ffb1d[_0x9f4a('0x44')](0x1f4,_0x5ddf5a));}}logger[_0x9f4a('0x44')]('message\x20is\x20empty');return _0x210a36(_0x4ffb1d[_0x9f4a('0x44')](0x1f4,_0x9f4a('0x4d')));});},'RejectMessage':function(_0x44dbd4){var _0x2588ce=this;return new Promise(function(_0x1dc152,_0x13d24f){if(_0x44dbd4['agent']&&_0x44dbd4[_0x9f4a('0x46')]['id']){try{if(_0x2c1398[_0x9f4a('0x47')][_0x44dbd4[_0x9f4a('0x46')]['id']]){_0x2c1398[_0x9f4a('0x47')][_0x44dbd4[_0x9f4a('0x46')]['id']][_0x9f4a('0x4e')]=![];_0x2c1398['agents'][_0x44dbd4[_0x9f4a('0x46')]['id']]['busyQueue']=undefined;}return _0x1dc152({'code':0xc8,'message':_0x44dbd4});}catch(_0x58e6a5){logger[_0x9f4a('0x44')](_0x58e6a5[_0x9f4a('0x43')]);return _0x13d24f(_0x2588ce[_0x9f4a('0x44')](0x1f4,_0x58e6a5));}}logger[_0x9f4a('0x44')](_0x9f4a('0x4d'));return _0x13d24f(_0x2588ce[_0x9f4a('0x44')](0x1f4,'message\x20is\x20empty'));});},'AbandonInteraction':function(_0x2cb72a){var _0x631ccf=this;return new Promise(function(_0x175a58,_0x4e8edb){if(_0x2cb72a[_0x9f4a('0x17')]&&_0x2cb72a[_0x9f4a('0x19')]&&_0x2cb72a[_0x9f4a('0x19')]['id']){try{var _0x4b410d=getId(_0x2cb72a['channel'],_0x2cb72a[_0x9f4a('0x18')]?_0x2cb72a['message']['id']:0x0,_0x2cb72a['interaction']?_0x2cb72a[_0x9f4a('0x19')]['id']:0x0);if(_0x2c1398['rules'][_0x4b410d]){_0x2c1398[_0x9f4a('0x16')][_0x4b410d][_0x9f4a('0x40')]('end');}return _0x175a58({'code':0xc8,'message':_0x2cb72a});}catch(_0x2fc737){logger['error'](_0x2fc737['stack']);return _0x4e8edb(_0x631ccf[_0x9f4a('0x44')](0x1f4,_0x2fc737));}}logger[_0x9f4a('0x44')](_0x9f4a('0x4d'));return _0x4e8edb(_0x631ccf[_0x9f4a('0x44')](0x1f4,_0x9f4a('0x4d')));});},'AgentCapacity':function(_0x445749){var _0x34bc31=this;return new Promise(function(_0x197121,_0x191277){if(_0x2c1398['agents']['hasOwnProperty'](_0x445749['id'])){for(var _0x4fbf3b in _0x445749[_0x9f4a('0x4f')]){if(_0x445749[_0x9f4a('0x4f')][_0x9f4a('0x50')](_0x4fbf3b)){if(_0x2c1398[_0x9f4a('0x47')][_0x445749['id']][_0x9f4a('0x50')](_0x4fbf3b+_0x9f4a('0x51'))){_0x2c1398[_0x9f4a('0x47')][_0x445749['id']][_0x4fbf3b+_0x9f4a('0x51')]=parseInt(_0x445749['capacity'][_0x4fbf3b],0xa);}}}_0x2c1398[_0x9f4a('0x47')][_0x445749['id']]['updateRealtime']();return _0x197121({'code':0xc8,'message':_0x2c1398[_0x9f4a('0x47')][_0x445749['id']]});}else{return _0x191277(_0x34bc31[_0x9f4a('0x44')](0x1f4,_0x9f4a('0x52')));}});},'Agents':function(_0x5ab21f){return new Promise(function(_0x56c510){var _0x543253=_['values'](_0x2c1398[_0x9f4a('0x47')]);if(_0x5ab21f&&_0x5ab21f['id']){var _0x1a4e7a=_[_0x9f4a('0x53')](_0x543253,function(_0xd5828e){return _0xd5828e['id']===_0x5ab21f['id'];});_0x56c510(_0x1a4e7a);}else{_0x56c510({'count':_0x543253[_0x9f4a('0x1e')],'rows':_0x543253});}});},'ChatQueues':function(){return new Promise(function(_0x39f6cd){var _0x3b2851=[];for(var _0x538049 in _0x2c1398[_0x9f4a('0x54')]){if(_0x2c1398['chatQueues'][_0x9f4a('0x50')](_0x538049)){var _0x2162af=_0x2c1398[_0x9f4a('0x54')][_0x538049];var _0x14ad34={'id':_0x2162af['id'],'available':_0x2162af[_0x9f4a('0x55')],'loggedIn':_0x2162af['loggedIn'],'name':_0x2162af[_0x9f4a('0x56')],'paused':_0x2162af[_0x9f4a('0x57')],'waiting':_0x2162af['waiting']};_0x3b2851[_0x9f4a('0x25')](_0x14ad34);}}_0x39f6cd({'count':_0x3b2851[_0x9f4a('0x1e')],'rows':_0x3b2851});});},'MailQueues':function(){return new Promise(function(_0x515758){var _0x3d7d04=[];for(var _0x4d42bb in _0x2c1398[_0x9f4a('0x58')]){if(_0x2c1398[_0x9f4a('0x58')][_0x9f4a('0x50')](_0x4d42bb)){var _0x4b3705=_0x2c1398[_0x9f4a('0x58')][_0x4d42bb];var _0x2bcba4={'id':_0x4b3705['id'],'available':_0x4b3705['available'],'loggedIn':_0x4b3705['loggedIn'],'name':_0x4b3705[_0x9f4a('0x56')],'paused':_0x4b3705[_0x9f4a('0x57')],'waiting':_0x4b3705[_0x9f4a('0x59')]};_0x3d7d04[_0x9f4a('0x25')](_0x2bcba4);}}_0x515758({'count':_0x3d7d04[_0x9f4a('0x1e')],'rows':_0x3d7d04});});},'OpenchannelQueues':function(){return new Promise(function(_0x4660fe){var _0x565972=[];for(var _0x229807 in _0x2c1398[_0x9f4a('0x5a')]){if(_0x2c1398[_0x9f4a('0x5a')][_0x9f4a('0x50')](_0x229807)){var _0x3de98b=_0x2c1398['openchannelQueues'][_0x229807];var _0x4ea4f8={'id':_0x3de98b['id'],'available':_0x3de98b[_0x9f4a('0x55')],'loggedIn':_0x3de98b['loggedIn'],'name':_0x3de98b['name'],'paused':_0x3de98b['paused'],'waiting':_0x3de98b[_0x9f4a('0x59')]};_0x565972[_0x9f4a('0x25')](_0x4ea4f8);}}_0x4660fe({'count':_0x565972[_0x9f4a('0x1e')],'rows':_0x565972});});},'SmsQueues':function(){return new Promise(function(_0x5c1896){var _0x7dec15=[];for(var _0x189f1d in _0x2c1398['smsQueues']){if(_0x2c1398[_0x9f4a('0x5b')][_0x9f4a('0x50')](_0x189f1d)){var _0x3a2194=_0x2c1398[_0x9f4a('0x5b')][_0x189f1d];var _0x3048ed={'id':_0x3a2194['id'],'available':_0x3a2194[_0x9f4a('0x55')],'loggedIn':_0x3a2194[_0x9f4a('0x5c')],'name':_0x3a2194[_0x9f4a('0x56')],'paused':_0x3a2194[_0x9f4a('0x57')],'waiting':_0x3a2194[_0x9f4a('0x59')]};_0x7dec15[_0x9f4a('0x25')](_0x3048ed);}}_0x5c1896({'count':_0x7dec15[_0x9f4a('0x1e')],'rows':_0x7dec15});});},'FaxQueues':function(){return new Promise(function(_0x32842d){var _0x406f41=[];for(var _0x1db856 in _0x2c1398['faxQueues']){if(_0x2c1398[_0x9f4a('0x5d')][_0x9f4a('0x50')](_0x1db856)){var _0x338537=_0x2c1398[_0x9f4a('0x5d')][_0x1db856];var _0x6c1fef={'id':_0x338537['id'],'available':_0x338537[_0x9f4a('0x55')],'loggedIn':_0x338537[_0x9f4a('0x5c')],'name':_0x338537['name'],'paused':_0x338537[_0x9f4a('0x57')],'waiting':_0x338537[_0x9f4a('0x59')]};_0x406f41[_0x9f4a('0x25')](_0x6c1fef);}}_0x32842d({'count':_0x406f41[_0x9f4a('0x1e')],'rows':_0x406f41});});},'WhatsappQueues':function(){return new Promise(function(_0x16d134){var _0x25175e=[];for(var _0x5e5022 in _0x2c1398[_0x9f4a('0x5e')]){if(_0x2c1398[_0x9f4a('0x5e')]['hasOwnProperty'](_0x5e5022)){var _0xb904e0=_0x2c1398[_0x9f4a('0x5e')][_0x5e5022];var _0xb9c644={'id':_0xb904e0['id'],'available':_0xb904e0[_0x9f4a('0x55')],'loggedIn':_0xb904e0['loggedIn'],'name':_0xb904e0[_0x9f4a('0x56')],'paused':_0xb904e0[_0x9f4a('0x57')],'waiting':_0xb904e0[_0x9f4a('0x59')]};_0x25175e[_0x9f4a('0x25')](_0xb9c644);}}_0x16d134({'count':_0x25175e['length'],'rows':_0x25175e});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x167b42){var _0x2758ed=_[_0x9f4a('0x5f')](_0x2c1398['chatQueuesWaitingInteractions']);_0x167b42({'count':_0x2758ed['length'],'rows':_0x2758ed});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x564b14){var _0x1cac3f=_[_0x9f4a('0x5f')](_0x2c1398['mailQueuesWaitingInteractions']);_0x564b14({'count':_0x1cac3f['length'],'rows':_0x1cac3f});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0xfc78ee){var _0x5e265=_[_0x9f4a('0x5f')](_0x2c1398[_0x9f4a('0x60')]);_0xfc78ee({'count':_0x5e265['length'],'rows':_0x5e265});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x1fb27d){var _0x3f4305=_[_0x9f4a('0x5f')](_0x2c1398['smsQueuesWaitingInteractions']);_0x1fb27d({'count':_0x3f4305[_0x9f4a('0x1e')],'rows':_0x3f4305});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x4a273f){var _0x31dbc8=_['values'](_0x2c1398[_0x9f4a('0x61')]);_0x4a273f({'count':_0x31dbc8[_0x9f4a('0x1e')],'rows':_0x31dbc8});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x2c6a5c){var _0x23ed94=_['values'](_0x2c1398[_0x9f4a('0x62')]);_0x2c6a5c({'count':_0x23ed94[_0x9f4a('0x1e')],'rows':_0x23ed94});});}};var _0x3a069a=jayson[_0x9f4a('0x63')](_0x2525b5)[_0x9f4a('0x64')]();_0x3a069a['on'](_0x9f4a('0x44'),function(_0x3e4baa){logger[_0x9f4a('0x44')](JSON[_0x9f4a('0x3e')](_0x3e4baa));return _0x973739(_0x3e4baa);});_0x3a069a[_0x9f4a('0x15')](0x232c,_0x9f4a('0x65'),function(){console['log']('Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232c);return _0x52d0ee(_0x9f4a('0x66')+0x232c);});});}; \ No newline at end of file +var _0x069e=['getMustacheRender','account','notificationTemplate','ChatWebsiteId','ContactId','body','format','%s:%s:%s','./interval','condition','intervals','./applications/','priority','info','on\x20interval','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','execute','stringify','emit','complete','agent','agents','busy','busyQueue','end','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','stack','hasOwnProperty','capacity','updateRealtime','agent\x20not\x20found','values','find','chatQueues','available','loggedIn','name','paused','waiting','mailQueues','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','server','http','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','util','jayson/promise','bluebird','./applications/utils','./applications/strategy/util','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','listen','rules','channel','message','interaction','checkWaitingNotifications','applications','isArray','length','join','app','.js','toLowerCase','autoreply','split','push','slice','dialogflow','appdata','amazonlex','tag','TagId','tvox'];(function(_0x3ff8b5,_0x4db1a2){var _0x2eb188=function(_0x1324cf){while(--_0x1324cf){_0x3ff8b5['push'](_0x3ff8b5['shift']());}};_0x2eb188(++_0x4db1a2);}(_0x069e,0x108));var _0xe069=function(_0xf405ad,_0x1afcdf){_0xf405ad=_0xf405ad-0x0;var _0x45c5a7=_0x069e[_0xf405ad];return _0x45c5a7;};'use strict';var _=require('lodash');var util=require(_0xe069('0x0'));var path=require('path');var fs=require('fs');var jayson=require(_0xe069('0x1'));var BPromise=require(_0xe069('0x2'));var utils=require(_0xe069('0x3'));var sUtils=require(_0xe069('0x4'));var logger=require(_0xe069('0x5'))(_0xe069('0x6'));var rpc={'openchannelQueueReport':require(_0xe069('0x7')),'mailQueueReport':require(_0xe069('0x8')),'chatQueueReport':require(_0xe069('0x9')),'smsQueueReport':require(_0xe069('0xa')),'faxQueueReport':require('../rpc/faxQueueReport'),'whatsappQueueReport':require(_0xe069('0xb'))};var RuleEngine=require(_0xe069('0xc'));function getId(_0x4847b1,_0x50c96c,_0xbde176){return util['format'](_0xe069('0xd'),_0x4847b1,_0x50c96c||0x0,_0xbde176||0x0);}function getIntervals(_0x17147c,_0x1651e5){var _0x229519=[];if(!_[_0xe069('0xe')](_0x1651e5[_0xe069('0xf')])&&!_[_0xe069('0xe')](_0x17147c[_0x1651e5[_0xe069('0xf')]])&&!_[_0xe069('0xe')](_0x17147c[_0x1651e5[_0xe069('0xf')]][_0xe069('0x10')])){_0x229519=_[_0xe069('0x11')](_0x17147c[_0x1651e5[_0xe069('0xf')]]['Intervals'],_0xe069('0x12'));}else if(!_[_0xe069('0xe')](_0x1651e5[_0xe069('0x12')])){_0x229519=[_0x1651e5[_0xe069('0x12')]];}return _0x229519;}exports[_0xe069('0x13')]=function(_0x211945){_0x211945[_0xe069('0x14')]={};return new BPromise(function(_0x1b657e,_0x2c7c2d){var _0x10ffec={'Start':function(_0x22a978){var _0x4b2ad9=this;return new Promise(function(_0xe33b2e,_0x1604bf){if(_0x22a978){try{var _0x486bc2=[];var _0x55f88c=getId(_0x22a978[_0xe069('0x15')],_0x22a978[_0xe069('0x16')]?_0x22a978[_0xe069('0x16')]['id']:0x0,_0x22a978[_0xe069('0x17')]?_0x22a978[_0xe069('0x17')]['id']:0x0);var _0x467fde=sUtils[_0xe069('0x18')](_0x211945,_0x22a978);if(_0x22a978['transfer']||!_0x467fde&&_0x22a978[_0xe069('0x19')]&&_[_0xe069('0x1a')](_0x22a978[_0xe069('0x19')])&&_0x22a978[_0xe069('0x19')][_0xe069('0x1b')]){for(var _0x4c9256=0x0;_0x4c9256<_0x22a978[_0xe069('0x19')][_0xe069('0x1b')];_0x4c9256+=0x1){var _0x2ae7b2=_0x22a978[_0xe069('0x19')][_0x4c9256];if(fs['existsSync'](path[_0xe069('0x1c')](__dirname,_0xe069('0x19'),_0x2ae7b2[_0xe069('0x1d')]+_0xe069('0x1e')))){var _0x33a6dc=[];switch(_0x2ae7b2[_0xe069('0x1d')][_0xe069('0x1f')]()){case _0xe069('0x20'):var _0x5be8bf=_0x2ae7b2['appdata'][_0xe069('0x21')](',');if(_0x22a978[_0xe069('0x15')]==='mail'){_0x33a6dc[_0xe069('0x22')](_0x5be8bf[0x0]);_0x33a6dc[_0xe069('0x22')](_0x5be8bf[0x1]);_0x33a6dc[_0xe069('0x22')](_0x5be8bf['slice'](0x2,_0x5be8bf[_0xe069('0x1b')])['join'](','));}else{_0x33a6dc[_0xe069('0x22')](_0x5be8bf[0x0]);_0x33a6dc[_0xe069('0x22')](_0x5be8bf[_0xe069('0x23')](0x1,_0x5be8bf['length'])[_0xe069('0x1c')](','));}break;case _0xe069('0x24'):var _0x1b4dc3=_0x2ae7b2[_0xe069('0x25')][_0xe069('0x21')](',');_0x33a6dc[_0xe069('0x22')](_0x1b4dc3[0x0]);_0x33a6dc[_0xe069('0x22')](_0x1b4dc3[0x1]);_0x33a6dc[_0xe069('0x22')](_0x1b4dc3[_0xe069('0x23')](0x2,_0x1b4dc3[_0xe069('0x1b')])[_0xe069('0x1c')](','));break;case'dialogflowv2':var _0x427a54=_0x2ae7b2[_0xe069('0x25')]['split'](',');_0x33a6dc[_0xe069('0x22')](_0x427a54[0x0]);_0x33a6dc[_0xe069('0x22')](_0x427a54[0x1]);_0x33a6dc[_0xe069('0x22')](_0x427a54[0x2]);_0x33a6dc[_0xe069('0x22')](_0x427a54[0x3]);_0x33a6dc[_0xe069('0x22')](_0x427a54[_0xe069('0x23')](0x4,_0x427a54[_0xe069('0x1b')])[_0xe069('0x1c')](','));break;case _0xe069('0x26'):var _0x1a32ea=_0x2ae7b2[_0xe069('0x25')][_0xe069('0x21')](',');_0x33a6dc['push'](_0x1a32ea[0x0]);_0x33a6dc[_0xe069('0x22')](_0x1a32ea[0x1]);_0x33a6dc[_0xe069('0x22')](_0x1a32ea[0x2]);_0x33a6dc[_0xe069('0x22')](_0x1a32ea[0x3]);_0x33a6dc[_0xe069('0x22')](_0x1a32ea['slice'](0x4,_0x1a32ea[_0xe069('0x1b')])['join'](','));break;case _0xe069('0x16'):_0x33a6dc[_0xe069('0x22')](_0x2ae7b2[_0xe069('0x25')]);break;case _0xe069('0x27'):_0x33a6dc[_0xe069('0x22')](_0x2ae7b2[_0xe069('0x28')]);_0x33a6dc[_0xe069('0x22')](_0x2ae7b2['appdata']);break;case _0xe069('0x29'):var _0x450dc2=utils[_0xe069('0x2a')](_0x22a978[_0xe069('0x2b')][_0xe069('0x2c')],_0x22a978);var _0x1e5431=_0x2ae7b2[_0xe069('0x25')][_0xe069('0x21')](',');_0x33a6dc[_0xe069('0x22')](_0x1e5431[0x0]);_0x33a6dc['push'](_0x1e5431[0x1]);_0x33a6dc[_0xe069('0x22')](_0x1e5431[0x2]);_0x33a6dc['push'](_0x1e5431[0x3]);_0x33a6dc[_0xe069('0x22')](_0x1e5431[0x4]);_0x33a6dc[_0xe069('0x22')](_0x1e5431[0x5]);_0x33a6dc[_0xe069('0x22')](_0x1e5431[0x6]);_0x33a6dc[_0xe069('0x22')](_0x1e5431[0x7]);_0x33a6dc[_0xe069('0x22')](_0x1e5431[0x8]);_0x33a6dc[_0xe069('0x22')](_0x1e5431[0x9]);_0x33a6dc['push'](_0x1e5431[0xa]);_0x33a6dc[_0xe069('0x22')](_0x22a978[_0xe069('0x17')]['id']);_0x33a6dc['push'](_0x22a978[_0xe069('0x16')]['id']);_0x33a6dc[_0xe069('0x22')](_0x2ae7b2[_0xe069('0x2d')]);_0x33a6dc['push'](_0x22a978[_0xe069('0x17')][_0xe069('0x2e')]);_0x33a6dc['push'](_0x22a978[_0xe069('0x2f')][_0xe069('0x2f')]);_0x33a6dc[_0xe069('0x22')](_0x450dc2);break;default:_0x33a6dc=_[_0xe069('0xe')](_0x2ae7b2['appdata'])?[]:_0x2ae7b2[_0xe069('0x25')][_0xe069('0x21')](',');}var _0x1f5104={'id':util[_0xe069('0x30')](_0xe069('0x31'),_0x55f88c,_0x2ae7b2['id'],_0x2ae7b2[_0xe069('0x1d')]),'condition':require(_0xe069('0x32'))[_0xe069('0x33')](_0x55f88c,getIntervals(_0x211945[_0xe069('0x34')],_0x2ae7b2),_0x211945),'consequence':require(_0xe069('0x35')+_0x2ae7b2[_0xe069('0x1d')])['consequence'](_0x55f88c,_0x33a6dc,_0x211945,_0x22a978),'p':_0x2ae7b2[_0xe069('0x36')]||0x0};logger[_0xe069('0x37')]('Push\x20new\x20rule',_0x1f5104['id'],_0xe069('0x38'),getIntervals(_0x211945[_0xe069('0x34')],_0x2ae7b2)[_0xe069('0x1c')](_0xe069('0x39')));_0x486bc2[_0xe069('0x22')](_0x1f5104);}else{logger[_0xe069('0x3a')](_0xe069('0x3b'),path[_0xe069('0x1c')](__dirname,_0xe069('0x19'),_0x2ae7b2[_0xe069('0x1d')]+'.js'));}}_0x211945['rules'][_0x55f88c]=new RuleEngine(_0x486bc2);_0x211945[_0xe069('0x14')][_0x55f88c][_0xe069('0x3c')](_0x22a978,function(_0x24624a){logger[_0xe069('0x37')]('Applications\x20executed',JSON[_0xe069('0x3d')](_0x24624a['matchPath']));if(_0x211945[_0xe069('0x14')][_0x55f88c]){_0x211945[_0xe069('0x14')][_0x55f88c][_0xe069('0x3e')](_0xe069('0x3f'));}});return _0xe33b2e({'code':0xc8,'message':_0x22a978});}else{if(_0x467fde){logger['info'](util[_0xe069('0x30')]('Skipped\x20routing\x20for\x20%s',_0x55f88c));}else{logger[_0xe069('0x37')]('No\x20applications\x20to\x20execute');}return _0xe33b2e({'code':0xc8,'message':_0x22a978});}}catch(_0x5b136c){logger['error'](_0x5b136c['stack']);return _0x1604bf(_0x4b2ad9[_0xe069('0x3a')](0x1f4,_0x5b136c));}}return _0x1604bf('routing\x20is\x20empty');});},'AcceptMessage':function(_0x2266cb){var _0xad068b=this;return new Promise(function(_0x41f34b,_0x1fa306){if(_0x2266cb[_0xe069('0x40')]&&_0x2266cb[_0xe069('0x40')]['id']){if(_0x211945[_0xe069('0x41')][_0x2266cb[_0xe069('0x40')]['id']]){_0x211945[_0xe069('0x41')][_0x2266cb['agent']['id']][_0xe069('0x42')]=![];_0x211945[_0xe069('0x41')][_0x2266cb[_0xe069('0x40')]['id']][_0xe069('0x43')]=undefined;}}if(_0x2266cb[_0xe069('0x16')]&&_0x2266cb[_0xe069('0x16')]['id']){try{var _0x136d53=getId(_0x2266cb[_0xe069('0x15')],_0x2266cb['message']?_0x2266cb['message']['id']:0x0,_0x2266cb[_0xe069('0x17')]?_0x2266cb[_0xe069('0x17')]['id']:0x0);if(_0x211945[_0xe069('0x14')][_0x136d53]){_0x211945[_0xe069('0x14')][_0x136d53][_0xe069('0x3e')](_0xe069('0x44'));if(rpc[_0x2266cb[_0xe069('0x15')]+'QueueReport']){rpc[_0x2266cb['channel']+'QueueReport']['update'](_0x136d53,{'UserId':_0x2266cb[_0xe069('0x16')][_0xe069('0x45')]})[_0xe069('0x46')](function(){logger[_0xe069('0x3a')](_0xe069('0x47'));});}}return _0x41f34b({'code':0xc8,'message':_0x2266cb});}catch(_0x1cc170){logger[_0xe069('0x3a')](_0x1cc170['stack']);return _0x1fa306(_0xad068b[_0xe069('0x3a')](0x1f4,_0x1cc170));}}logger[_0xe069('0x3a')](_0xe069('0x48'));return _0x1fa306(_0xad068b['error'](0x1f4,_0xe069('0x48')));});},'RejectMessage':function(_0x5e6786){var _0x5ac5da=this;return new Promise(function(_0x597120,_0x3c4fdc){if(_0x5e6786[_0xe069('0x40')]&&_0x5e6786[_0xe069('0x40')]['id']){try{if(_0x211945[_0xe069('0x41')][_0x5e6786[_0xe069('0x40')]['id']]){_0x211945[_0xe069('0x41')][_0x5e6786['agent']['id']][_0xe069('0x42')]=![];_0x211945['agents'][_0x5e6786[_0xe069('0x40')]['id']][_0xe069('0x43')]=undefined;}return _0x597120({'code':0xc8,'message':_0x5e6786});}catch(_0xe2c468){logger[_0xe069('0x3a')](_0xe2c468[_0xe069('0x49')]);return _0x3c4fdc(_0x5ac5da[_0xe069('0x3a')](0x1f4,_0xe2c468));}}logger[_0xe069('0x3a')](_0xe069('0x48'));return _0x3c4fdc(_0x5ac5da['error'](0x1f4,'message\x20is\x20empty'));});},'AbandonInteraction':function(_0x19ef9b){var _0x10a1f5=this;return new Promise(function(_0xbb0fca,_0x478ea8){if(_0x19ef9b[_0xe069('0x15')]&&_0x19ef9b[_0xe069('0x17')]&&_0x19ef9b['interaction']['id']){try{var _0x487615=getId(_0x19ef9b[_0xe069('0x15')],_0x19ef9b[_0xe069('0x16')]?_0x19ef9b[_0xe069('0x16')]['id']:0x0,_0x19ef9b[_0xe069('0x17')]?_0x19ef9b[_0xe069('0x17')]['id']:0x0);if(_0x211945[_0xe069('0x14')][_0x487615]){_0x211945[_0xe069('0x14')][_0x487615][_0xe069('0x3e')](_0xe069('0x44'));}return _0xbb0fca({'code':0xc8,'message':_0x19ef9b});}catch(_0x1b134a){logger[_0xe069('0x3a')](_0x1b134a[_0xe069('0x49')]);return _0x478ea8(_0x10a1f5[_0xe069('0x3a')](0x1f4,_0x1b134a));}}logger['error']('message\x20is\x20empty');return _0x478ea8(_0x10a1f5[_0xe069('0x3a')](0x1f4,_0xe069('0x48')));});},'AgentCapacity':function(_0x315ffe){var _0x188087=this;return new Promise(function(_0x599a2b,_0x551254){if(_0x211945[_0xe069('0x41')][_0xe069('0x4a')](_0x315ffe['id'])){for(var _0x1061d4 in _0x315ffe[_0xe069('0x4b')]){if(_0x315ffe['capacity'][_0xe069('0x4a')](_0x1061d4)){if(_0x211945[_0xe069('0x41')][_0x315ffe['id']][_0xe069('0x4a')](_0x1061d4+'CurrentCapacity')){_0x211945[_0xe069('0x41')][_0x315ffe['id']][_0x1061d4+'CurrentCapacity']=parseInt(_0x315ffe[_0xe069('0x4b')][_0x1061d4],0xa);}}}_0x211945['agents'][_0x315ffe['id']][_0xe069('0x4c')]();return _0x599a2b({'code':0xc8,'message':_0x211945['agents'][_0x315ffe['id']]});}else{return _0x551254(_0x188087[_0xe069('0x3a')](0x1f4,_0xe069('0x4d')));}});},'Agents':function(_0x450cc7){return new Promise(function(_0x3049ff){var _0x5228b4=_[_0xe069('0x4e')](_0x211945[_0xe069('0x41')]);if(_0x450cc7&&_0x450cc7['id']){var _0x1ba5af=_[_0xe069('0x4f')](_0x5228b4,function(_0x5313be){return _0x5313be['id']===_0x450cc7['id'];});_0x3049ff(_0x1ba5af);}else{_0x3049ff({'count':_0x5228b4[_0xe069('0x1b')],'rows':_0x5228b4});}});},'ChatQueues':function(){return new Promise(function(_0x57f545){var _0x47d587=[];for(var _0x47b4f0 in _0x211945[_0xe069('0x50')]){if(_0x211945[_0xe069('0x50')]['hasOwnProperty'](_0x47b4f0)){var _0xf1bbd=_0x211945[_0xe069('0x50')][_0x47b4f0];var _0x59a8a2={'id':_0xf1bbd['id'],'available':_0xf1bbd[_0xe069('0x51')],'loggedIn':_0xf1bbd[_0xe069('0x52')],'name':_0xf1bbd[_0xe069('0x53')],'paused':_0xf1bbd[_0xe069('0x54')],'waiting':_0xf1bbd[_0xe069('0x55')]};_0x47d587[_0xe069('0x22')](_0x59a8a2);}}_0x57f545({'count':_0x47d587[_0xe069('0x1b')],'rows':_0x47d587});});},'MailQueues':function(){return new Promise(function(_0x4c8a19){var _0x54523a=[];for(var _0x3ffd6c in _0x211945[_0xe069('0x56')]){if(_0x211945[_0xe069('0x56')][_0xe069('0x4a')](_0x3ffd6c)){var _0x414f1a=_0x211945[_0xe069('0x56')][_0x3ffd6c];var _0x3f19a6={'id':_0x414f1a['id'],'available':_0x414f1a[_0xe069('0x51')],'loggedIn':_0x414f1a[_0xe069('0x52')],'name':_0x414f1a[_0xe069('0x53')],'paused':_0x414f1a[_0xe069('0x54')],'waiting':_0x414f1a[_0xe069('0x55')]};_0x54523a[_0xe069('0x22')](_0x3f19a6);}}_0x4c8a19({'count':_0x54523a[_0xe069('0x1b')],'rows':_0x54523a});});},'OpenchannelQueues':function(){return new Promise(function(_0xe6753d){var _0xb272c5=[];for(var _0x112596 in _0x211945[_0xe069('0x57')]){if(_0x211945[_0xe069('0x57')]['hasOwnProperty'](_0x112596)){var _0x1f7a90=_0x211945[_0xe069('0x57')][_0x112596];var _0x1d47cc={'id':_0x1f7a90['id'],'available':_0x1f7a90[_0xe069('0x51')],'loggedIn':_0x1f7a90[_0xe069('0x52')],'name':_0x1f7a90['name'],'paused':_0x1f7a90[_0xe069('0x54')],'waiting':_0x1f7a90[_0xe069('0x55')]};_0xb272c5[_0xe069('0x22')](_0x1d47cc);}}_0xe6753d({'count':_0xb272c5[_0xe069('0x1b')],'rows':_0xb272c5});});},'SmsQueues':function(){return new Promise(function(_0x3e916f){var _0x4f3685=[];for(var _0x3a74ed in _0x211945[_0xe069('0x58')]){if(_0x211945[_0xe069('0x58')][_0xe069('0x4a')](_0x3a74ed)){var _0x4fc5c9=_0x211945[_0xe069('0x58')][_0x3a74ed];var _0x30d7e9={'id':_0x4fc5c9['id'],'available':_0x4fc5c9[_0xe069('0x51')],'loggedIn':_0x4fc5c9[_0xe069('0x52')],'name':_0x4fc5c9[_0xe069('0x53')],'paused':_0x4fc5c9[_0xe069('0x54')],'waiting':_0x4fc5c9['waiting']};_0x4f3685[_0xe069('0x22')](_0x30d7e9);}}_0x3e916f({'count':_0x4f3685['length'],'rows':_0x4f3685});});},'FaxQueues':function(){return new Promise(function(_0x57fe61){var _0x28bc34=[];for(var _0x4b4984 in _0x211945[_0xe069('0x59')]){if(_0x211945[_0xe069('0x59')][_0xe069('0x4a')](_0x4b4984)){var _0x437a31=_0x211945['faxQueues'][_0x4b4984];var _0xd3eae={'id':_0x437a31['id'],'available':_0x437a31[_0xe069('0x51')],'loggedIn':_0x437a31[_0xe069('0x52')],'name':_0x437a31['name'],'paused':_0x437a31[_0xe069('0x54')],'waiting':_0x437a31[_0xe069('0x55')]};_0x28bc34['push'](_0xd3eae);}}_0x57fe61({'count':_0x28bc34[_0xe069('0x1b')],'rows':_0x28bc34});});},'WhatsappQueues':function(){return new Promise(function(_0x2e5bf1){var _0x3feaa9=[];for(var _0x5592b8 in _0x211945[_0xe069('0x5a')]){if(_0x211945[_0xe069('0x5a')][_0xe069('0x4a')](_0x5592b8)){var _0x365c7b=_0x211945[_0xe069('0x5a')][_0x5592b8];var _0xb8a149={'id':_0x365c7b['id'],'available':_0x365c7b['available'],'loggedIn':_0x365c7b[_0xe069('0x52')],'name':_0x365c7b[_0xe069('0x53')],'paused':_0x365c7b['paused'],'waiting':_0x365c7b[_0xe069('0x55')]};_0x3feaa9[_0xe069('0x22')](_0xb8a149);}}_0x2e5bf1({'count':_0x3feaa9[_0xe069('0x1b')],'rows':_0x3feaa9});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x2e6b31){var _0x25d52a=_['values'](_0x211945[_0xe069('0x5b')]);_0x2e6b31({'count':_0x25d52a['length'],'rows':_0x25d52a});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x1a93d0){var _0x52fd4b=_[_0xe069('0x4e')](_0x211945[_0xe069('0x5c')]);_0x1a93d0({'count':_0x52fd4b[_0xe069('0x1b')],'rows':_0x52fd4b});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x4e8dca){var _0x36124b=_['values'](_0x211945[_0xe069('0x5d')]);_0x4e8dca({'count':_0x36124b[_0xe069('0x1b')],'rows':_0x36124b});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x361a51){var _0x361d96=_[_0xe069('0x4e')](_0x211945[_0xe069('0x5e')]);_0x361a51({'count':_0x361d96[_0xe069('0x1b')],'rows':_0x361d96});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x57d62f){var _0x50089e=_[_0xe069('0x4e')](_0x211945[_0xe069('0x5f')]);_0x57d62f({'count':_0x50089e['length'],'rows':_0x50089e});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x5e8013){var _0x58a98d=_[_0xe069('0x4e')](_0x211945['whatsappQueuesWaitingInteractions']);_0x5e8013({'count':_0x58a98d[_0xe069('0x1b')],'rows':_0x58a98d});});}};var _0x434f14=jayson[_0xe069('0x60')](_0x10ffec)[_0xe069('0x61')]();_0x434f14['on'](_0xe069('0x3a'),function(_0x3729e4){logger[_0xe069('0x3a')](JSON[_0xe069('0x3d')](_0x3729e4));return _0x2c7c2d(_0x3729e4);});_0x434f14['listen'](0x232c,_0xe069('0x62'),function(){console[_0xe069('0x63')](_0xe069('0x64'),0x232c);return _0x1b657e(_0xe069('0x65')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index 4abff1e..a49e023 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 _0xeedc=['format','iftime\x20%s','then','indexOf','all','some','info','join','\x20|\x20','when','catch','[%s][INTERVAL]\x20%s\x20%s','stack','util','bluebird','jayson/promise','../../../config/logger','routing','client','http','request','error','message','result','condition','rules','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','push'];(function(_0x193bcc,_0x434411){var _0x12ccff=function(_0x4c6576){while(--_0x4c6576){_0x193bcc['push'](_0x193bcc['shift']());}};_0x12ccff(++_0x434411);}(_0xeedc,0x67));var _0xceed=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xeedc[_0x2dafbe];return _0x58a45a;};'use strict';var util=require(_0xceed('0x0'));var BPromise=require(_0xceed('0x1'));var jayson=require(_0xceed('0x2'));var _=require('lodash');var logger=require(_0xceed('0x3'))(_0xceed('0x4'));var client=jayson[_0xceed('0x5')][_0xceed('0x6')]({'port':0x232a});function request(_0x25cc31,_0x1df91c){return new BPromise(function(_0x42cec8,_0x4c2c72){return client[_0xceed('0x7')](_0x25cc31,_0x1df91c)['then'](function(_0x3390be){if(_0x3390be['error']){return _0x4c2c72(_0x3390be[_0xceed('0x8')][_0xceed('0x9')]);}else{return _0x42cec8(_0x3390be[_0xceed('0xa')]);}})['catch'](function(_0x5d9aff){return _0x4c2c72(_0x5d9aff);});});}exports[_0xceed('0xb')]=function(_0xff5cf,_0x395ab9,_0x2d10ff){return function(_0x1f04b5){if(_0x2d10ff[_0xceed('0xc')]&&!_0x2d10ff[_0xceed('0xc')][_0xff5cf]){logger['info'](_0xceed('0xd'),_0xff5cf);return _0x1f04b5[_0xceed('0xe')]();}var _0x165aff=[];for(var _0x1f285b=0x0;_0x1f285b<_0x395ab9[_0xceed('0xf')];_0x1f285b+=0x1){_0x165aff[_0xceed('0x10')](request('Command',{'command':util[_0xceed('0x11')](_0xceed('0x12'),_0x395ab9[_0x1f285b])})[_0xceed('0x13')](function(_0x48720c){return _0x48720c&&_0x48720c[_0xceed('0x9')]&&_0x48720c[_0xceed('0x9')][_0xceed('0x14')]('true')>=0x0?!![]:![];})['catch'](function(){logger[_0xceed('0x8')]('[%s][INTERVAL]\x20%s',_0xff5cf,_0x395ab9[_0x1f285b]);}));}BPromise[_0xceed('0x15')](_0x165aff)[_0xceed('0x13')](function(_0x368b21){var _0x53b54b=_[_0xceed('0x16')](_0x368b21);logger[_0xceed('0x17')]('[%s][INTERVAL]\x20%s\x20%s',_0xff5cf,_0x395ab9[_0xceed('0x18')](_0xceed('0x19')),_0x53b54b);_0x1f04b5[_0xceed('0x1a')](_0x53b54b);})[_0xceed('0x1b')](function(_0xdd169c){logger[_0xceed('0x8')](_0xceed('0x1c'),_0xff5cf,_0x395ab9[_0xceed('0x18')](_0xceed('0x19')),_0xdd169c[_0xceed('0x1d')]);_0x1f04b5[_0xceed('0xe')]();});};}; \ No newline at end of file +var _0xc49a=['then','error','message','result','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','Command','catch','[%s][INTERVAL]\x20%s','some','[%s][INTERVAL]\x20%s\x20%s','\x20|\x20','when','stack','jayson/promise','lodash','../../../config/logger','routing','client','http','request'];(function(_0x5ad07c,_0x324dcd){var _0x204bae=function(_0x1245bc){while(--_0x1245bc){_0x5ad07c['push'](_0x5ad07c['shift']());}};_0x204bae(++_0x324dcd);}(_0xc49a,0x161));var _0xac49=function(_0x1e44f4,_0x55c46c){_0x1e44f4=_0x1e44f4-0x0;var _0x8d3462=_0xc49a[_0x1e44f4];return _0x8d3462;};'use strict';var util=require('util');var BPromise=require('bluebird');var jayson=require(_0xac49('0x0'));var _=require(_0xac49('0x1'));var logger=require(_0xac49('0x2'))(_0xac49('0x3'));var client=jayson[_0xac49('0x4')][_0xac49('0x5')]({'port':0x232a});function request(_0x435be2,_0x3eec2d){return new BPromise(function(_0x5eecb0,_0x3d2a5a){return client[_0xac49('0x6')](_0x435be2,_0x3eec2d)[_0xac49('0x7')](function(_0x3d46eb){if(_0x3d46eb[_0xac49('0x8')]){return _0x3d2a5a(_0x3d46eb[_0xac49('0x8')][_0xac49('0x9')]);}else{return _0x5eecb0(_0x3d46eb[_0xac49('0xa')]);}})['catch'](function(_0x57ec54){return _0x3d2a5a(_0x57ec54);});});}exports['condition']=function(_0x22c2ec,_0x1d9164,_0xb9653c){return function(_0x23f59c){if(_0xb9653c[_0xac49('0xb')]&&!_0xb9653c[_0xac49('0xb')][_0x22c2ec]){logger[_0xac49('0xc')](_0xac49('0xd'),_0x22c2ec);return _0x23f59c[_0xac49('0xe')]();}var _0x3ac9cc=[];for(var _0x5743c1=0x0;_0x5743c1<_0x1d9164[_0xac49('0xf')];_0x5743c1+=0x1){_0x3ac9cc['push'](request(_0xac49('0x10'),{'command':util['format']('iftime\x20%s',_0x1d9164[_0x5743c1])})['then'](function(_0xbd64eb){return _0xbd64eb&&_0xbd64eb[_0xac49('0x9')]&&_0xbd64eb[_0xac49('0x9')]['indexOf']('true')>=0x0?!![]:![];})[_0xac49('0x11')](function(){logger[_0xac49('0x8')](_0xac49('0x12'),_0x22c2ec,_0x1d9164[_0x5743c1]);}));}BPromise['all'](_0x3ac9cc)[_0xac49('0x7')](function(_0x57e1cc){var _0x2cba63=_[_0xac49('0x13')](_0x57e1cc);logger[_0xac49('0xc')](_0xac49('0x14'),_0x22c2ec,_0x1d9164['join'](_0xac49('0x15')),_0x2cba63);_0x23f59c[_0xac49('0x16')](_0x2cba63);})[_0xac49('0x11')](function(_0x1b5be4){logger[_0xac49('0x8')](_0xac49('0x14'),_0x22c2ec,_0x1d9164['join'](_0xac49('0x15')),_0x1b5be4[_0xac49('0x17')]);_0x23f59c['stop']();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index 4e59405..4fe80b2 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 _0x96cc=['rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','agent','lodash','./utils','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','membername','interface','connectedlinenum','lastevent','getVoiceQueueByName','then','type','agentacw','agentcomplete','acwtime','acwTimeout','CreateVoiceAgentReport','request','agentcalled','debug','destuniqueid','agentcalledAt','now','called','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','[%s][agents][agentcalled]','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','reason','timeout','ringtime','talktime','push','queuecallerabandon','forIn','includes','[%s][agents][queuecallerabandon]','abandoned','holdtime','agentconnect','[%s][agents][agentconnect]','agentconnectAt','connectedlinename','connect','answered_elsewhere','answeredelsewheredestinationuniqueid','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','extension','transferuniqueid','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','[%s][agents][attendedtransfer]\x20agent:%s','secondtransfereruniqueid','ATTENDED','transferexten','origtransfererexten','transfereeuniqueid','agententerreason','calleridnum','calleridname','secondtransfererlinkedid','secondtransfererexten','transfertargetuniqueid','clone','hangup','[%s][agents][hangup]','cause'];(function(_0x1b71e4,_0x28ef28){var _0x41342e=function(_0x297f7b){while(--_0x297f7b){_0x1b71e4['push'](_0x1b71e4['shift']());}};_0x41342e(++_0x28ef28);}(_0x96cc,0x16c));var _0xc96c=function(_0x57d53b,_0x4b0c2f){_0x57d53b=_0x57d53b-0x0;var _0x13a2df=_0x96cc[_0x57d53b];return _0x13a2df;};'use strict';var _=require(_0xc96c('0x0'));var util=require('util');var utils=require(_0xc96c('0x1'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x5f11f2,_0x30bf8a){utils[_0xc96c('0x2')](util[_0xc96c('0x3')](_0xc96c('0x4'),_0x5f11f2[_0xc96c('0x5')],_0x5f11f2[_0xc96c('0x6')],_0x5f11f2[_0xc96c('0x7')],_0x5f11f2[_0xc96c('0x8')],_0x5f11f2[_0xc96c('0x9')],_0x5f11f2['calleridnum'],_0x5f11f2[_0xc96c('0xa')],_0x5f11f2[_0xc96c('0xb')]));if(_0x5f11f2[_0xc96c('0x7')]){utils[_0xc96c('0xc')](_0x5f11f2[_0xc96c('0x7')])[_0xc96c('0xd')](function(_0x36b2b4){if(_0x36b2b4){_0x5f11f2['type']=_0x36b2b4[_0xc96c('0xe')];_0x5f11f2[_0xc96c('0xf')]=_0x5f11f2[_0xc96c('0x10')]?_0x36b2b4['acw']:![];_0x5f11f2[_0xc96c('0x11')]=_0x5f11f2['agentacw']?_0x36b2b4[_0xc96c('0x12')]:0x0;}utils['request'](_0xc96c('0x13'),_0x5f11f2);});}else{utils[_0xc96c('0x14')](_0xc96c('0x13'),_0x5f11f2);}if(_0x30bf8a){delete transfers[_0x5f11f2[_0xc96c('0x5')]];}else{delete agents[_0x5f11f2['destuniqueid']];}}exports[_0xc96c('0x15')]=function(_0x43fcaa){try{utils[_0xc96c('0x16')](util[_0xc96c('0x3')]('[%s][agents][agentcalled]',_0x43fcaa[_0xc96c('0x5')]),_0x43fcaa);agents[_0x43fcaa[_0xc96c('0x17')]]=_0x43fcaa;agents[_0x43fcaa[_0xc96c('0x17')]][_0xc96c('0x18')]=utils[_0xc96c('0x19')]();agents[_0x43fcaa[_0xc96c('0x17')]][_0xc96c('0xb')]=_0xc96c('0x1a');agents[_0x43fcaa[_0xc96c('0x17')]][_0xc96c('0xa')]=null;agents[_0x43fcaa[_0xc96c('0x17')]]['connectedlinename']=null;utils['info'](util[_0xc96c('0x3')](_0xc96c('0x1b'),_0x43fcaa[_0xc96c('0x5')],agents[_0x43fcaa[_0xc96c('0x17')]]['membername'],_0x43fcaa[_0xc96c('0x17')]));}catch(_0x100fdb){utils[_0xc96c('0x1c')](util[_0xc96c('0x3')](_0xc96c('0x1d'),_0x43fcaa[_0xc96c('0x5')]),_0x100fdb);}};exports[_0xc96c('0x1e')]=function(_0x41daba){try{if(!_[_0xc96c('0x1f')](agents[_0x41daba[_0xc96c('0x17')]])){utils[_0xc96c('0x16')](util[_0xc96c('0x3')](_0xc96c('0x20'),_0x41daba[_0xc96c('0x5')]),_0x41daba);utils[_0xc96c('0x2')](util[_0xc96c('0x3')](_0xc96c('0x21'),_0x41daba['uniqueid'],agents[_0x41daba[_0xc96c('0x17')]][_0xc96c('0x8')],_0x41daba[_0xc96c('0x17')]));agents[_0x41daba[_0xc96c('0x17')]][_0xc96c('0x1e')]=!![];agents[_0x41daba[_0xc96c('0x17')]][_0xc96c('0x22')]=utils[_0xc96c('0x19')]();agents[_0x41daba[_0xc96c('0x17')]][_0xc96c('0xb')]='timeout';agents[_0x41daba[_0xc96c('0x17')]][_0xc96c('0x23')]=_0xc96c('0x24');agents[_0x41daba[_0xc96c('0x17')]]['holdtime']=_0x41daba['ringtime']?parseInt(_0x41daba[_0xc96c('0x25')])/0x3e8:0x0;agents[_0x41daba[_0xc96c('0x17')]][_0xc96c('0x26')]=0x0;unanswered[_0xc96c('0x27')](_0x41daba[_0xc96c('0x17')]);}}catch(_0x5e1727){utils[_0xc96c('0x1c')](util[_0xc96c('0x3')](_0xc96c('0x20'),_0x41daba[_0xc96c('0x5')]),_0x5e1727);}};exports[_0xc96c('0x28')]=function(_0x40c72b){try{_[_0xc96c('0x29')](agents,function(_0x328ee4,_0x556108){if(_0x328ee4[_0xc96c('0x5')]==_0x40c72b['uniqueid']&&!_[_0xc96c('0x2a')](unanswered,_0x328ee4[_0xc96c('0x17')])){utils[_0xc96c('0x16')](util['format'](_0xc96c('0x2b'),_0x40c72b[_0xc96c('0x5')]),_0x40c72b);utils[_0xc96c('0x2')](util[_0xc96c('0x3')]('[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x40c72b['uniqueid'],_0x328ee4[_0xc96c('0x8')],_0x328ee4[_0xc96c('0x17')]));_0x328ee4[_0xc96c('0x1e')]=!![];_0x328ee4['agentringnoanswerAt']=utils[_0xc96c('0x19')]();_0x328ee4[_0xc96c('0xb')]=_0xc96c('0x2c');_0x328ee4[_0xc96c('0x23')]='abandoned';_0x328ee4[_0xc96c('0x2d')]=_0x40c72b[_0xc96c('0x2d')];_0x328ee4['talktime']=0x0;writeDB(_0x328ee4);}});}catch(_0x2b1dec){utils[_0xc96c('0x1c')](util[_0xc96c('0x3')](_0xc96c('0x2b'),_0x40c72b[_0xc96c('0x5')]),_0x2b1dec);}};exports[_0xc96c('0x2e')]=function(_0x4e8241){try{if(agents[_0x4e8241[_0xc96c('0x17')]]){utils[_0xc96c('0x16')](util[_0xc96c('0x3')](_0xc96c('0x2f'),_0x4e8241[_0xc96c('0x5')]),_0x4e8241);utils[_0xc96c('0x2')](util['format']('[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x4e8241[_0xc96c('0x5')],agents[_0x4e8241[_0xc96c('0x17')]]['membername'],_0x4e8241['destuniqueid']));agents[_0x4e8241[_0xc96c('0x17')]][_0xc96c('0x30')]=utils[_0xc96c('0x19')]();agents[_0x4e8241[_0xc96c('0x17')]][_0xc96c('0xa')]=_0x4e8241[_0xc96c('0xa')];agents[_0x4e8241[_0xc96c('0x17')]][_0xc96c('0x31')]=_0x4e8241[_0xc96c('0x31')];agents[_0x4e8241[_0xc96c('0x17')]][_0xc96c('0x2d')]=_0x4e8241['ringtime'];agents[_0x4e8241[_0xc96c('0x17')]][_0xc96c('0xb')]=_0xc96c('0x32');_[_0xc96c('0x29')](agents,function(_0x4eb180,_0x167671){if(_0x4eb180[_0xc96c('0x17')]!=_0x4e8241[_0xc96c('0x17')]&&_0x4eb180['uniqueid']==_0x4e8241['uniqueid']){_0x4eb180[_0xc96c('0x26')]=0x0;_0x4eb180[_0xc96c('0x2d')]=_0x4e8241[_0xc96c('0x25')];_0x4eb180['agentringnoanswer']=!![];_0x4eb180[_0xc96c('0x22')]=utils[_0xc96c('0x19')]();_0x4eb180[_0xc96c('0xb')]=_0xc96c('0x33');_0x4eb180[_0xc96c('0x23')]=_0xc96c('0x33');_0x4eb180[_0xc96c('0x34')]=_0x4e8241[_0xc96c('0x17')];_0x4eb180[_0xc96c('0x35')]=_0x4e8241['membername'];writeDB(_0x4eb180);}});}}catch(_0x4c3088){utils[_0xc96c('0x1c')](util[_0xc96c('0x3')](_0xc96c('0x2f'),_0x4e8241[_0xc96c('0x5')]),_0x4c3088);}};exports['agentcomplete']=function(_0x5ee6ac){try{if(!_[_0xc96c('0x1f')](agents[_0x5ee6ac[_0xc96c('0x17')]])){utils[_0xc96c('0x16')](util[_0xc96c('0x3')](_0xc96c('0x36'),_0x5ee6ac[_0xc96c('0x5')]),_0x5ee6ac);utils[_0xc96c('0x2')](util['format'](_0xc96c('0x37'),_0x5ee6ac[_0xc96c('0x5')],agents[_0x5ee6ac[_0xc96c('0x17')]][_0xc96c('0x8')],_0x5ee6ac['destuniqueid']));agents[_0x5ee6ac['destuniqueid']][_0xc96c('0x10')]=!![];agents[_0x5ee6ac[_0xc96c('0x17')]][_0xc96c('0x38')]=utils[_0xc96c('0x19')]();agents[_0x5ee6ac[_0xc96c('0x17')]][_0xc96c('0x26')]=utils[_0xc96c('0x39')](agents[_0x5ee6ac[_0xc96c('0x17')]][_0xc96c('0x38')],agents[_0x5ee6ac[_0xc96c('0x17')]][_0xc96c('0x30')]);agents[_0x5ee6ac[_0xc96c('0x17')]][_0xc96c('0x23')]=_0x5ee6ac['reason'];agents[_0x5ee6ac[_0xc96c('0x17')]][_0xc96c('0xb')]=_0xc96c('0x3a');writeDB(agents[_0x5ee6ac[_0xc96c('0x17')]]);}}catch(_0x56bce1){utils[_0xc96c('0x1c')](util['format'](_0xc96c('0x36'),_0x5ee6ac[_0xc96c('0x5')]),_0x56bce1);}};exports['blindtransfer']=function(_0x2581ae){try{if(!_[_0xc96c('0x1f')](agents[_0x2581ae[_0xc96c('0x3b')]])){utils[_0xc96c('0x16')](util[_0xc96c('0x3')](_0xc96c('0x3c'),_0x2581ae['uniqueid']),_0x2581ae);utils['info'](util['format'](_0xc96c('0x3d'),_0x2581ae['uniqueid'],agents[_0x2581ae[_0xc96c('0x3b')]][_0xc96c('0x8')],agents[_0x2581ae[_0xc96c('0x3b')]][_0xc96c('0x5')]));agents[_0x2581ae[_0xc96c('0x3b')]][_0xc96c('0x3e')]=!![];agents[_0x2581ae[_0xc96c('0x3b')]][_0xc96c('0x3f')]=_0xc96c('0x40');agents[_0x2581ae[_0xc96c('0x3b')]]['transferexten']=_0x2581ae[_0xc96c('0x41')];agents[_0x2581ae[_0xc96c('0x3b')]][_0xc96c('0x42')]=agents[_0x2581ae[_0xc96c('0x3b')]][_0xc96c('0x5')];}}catch(_0xcde9){utils[_0xc96c('0x1c')](util[_0xc96c('0x3')]('[%s][agents][blindtransfer]',_0x2581ae['uniqueid']),_0xcde9);}};exports['attendedtransfer']=function(_0x5c3d95){try{utils[_0xc96c('0x16')](util[_0xc96c('0x3')](_0xc96c('0x43'),_0x5c3d95[_0xc96c('0x44')]),_0x5c3d95);if(_0x5c3d95[_0xc96c('0x44')]==_0x5c3d95[_0xc96c('0x45')]){if(!_[_0xc96c('0x1f')](agents[_0x5c3d95['secondtransfereruniqueid']])){utils[_0xc96c('0x2')](util[_0xc96c('0x3')](_0xc96c('0x46'),_0x5c3d95[_0xc96c('0x44')],agents[_0x5c3d95[_0xc96c('0x47')]][_0xc96c('0x8')]));agents[_0x5c3d95[_0xc96c('0x47')]]['transfer']=!![];agents[_0x5c3d95[_0xc96c('0x47')]][_0xc96c('0x3f')]=_0xc96c('0x48');agents[_0x5c3d95[_0xc96c('0x47')]][_0xc96c('0x49')]=_0x5c3d95[_0xc96c('0x4a')];agents[_0x5c3d95[_0xc96c('0x47')]][_0xc96c('0x42')]=_0x5c3d95[_0xc96c('0x44')];}if(_0x5c3d95[_0xc96c('0x4b')]&&agents[_0x5c3d95[_0xc96c('0x4b')]]){agents[_0x5c3d95[_0xc96c('0x4b')]][_0xc96c('0x4c')]=0x1;transfers[_0x5c3d95[_0xc96c('0x4b')]]=_['clone'](agents[_0x5c3d95[_0xc96c('0x4b')]]);transfers[_0x5c3d95[_0xc96c('0x4b')]][_0xc96c('0x4d')]=agents[_0x5c3d95[_0xc96c('0x47')]][_0xc96c('0x4d')];transfers[_0x5c3d95['transfereeuniqueid']][_0xc96c('0x4e')]=agents[_0x5c3d95[_0xc96c('0x47')]][_0xc96c('0x4e')];transfers[_0x5c3d95[_0xc96c('0x4b')]]['agentcalledAt']=utils[_0xc96c('0x19')]();transfers[_0x5c3d95[_0xc96c('0x4b')]]['agentconnectAt']=utils['now']();transfers[_0x5c3d95['transfereeuniqueid']][_0xc96c('0x2d')]=0x0;transfers[_0x5c3d95[_0xc96c('0x4b')]][_0xc96c('0x4c')]=0x2;}}else if(_0x5c3d95[_0xc96c('0x47')]==_0x5c3d95[_0xc96c('0x4f')]){if(!_['isNil'](agents[_0x5c3d95['origtransfereruniqueid']])){utils[_0xc96c('0x2')](util[_0xc96c('0x3')](_0xc96c('0x46'),_0x5c3d95[_0xc96c('0x44')],agents[_0x5c3d95[_0xc96c('0x44')]]['membername']));agents[_0x5c3d95[_0xc96c('0x44')]][_0xc96c('0x3e')]=!![];agents[_0x5c3d95[_0xc96c('0x44')]][_0xc96c('0x3f')]='ATTENDED';agents[_0x5c3d95['origtransfereruniqueid']][_0xc96c('0x49')]=_0x5c3d95[_0xc96c('0x50')];agents[_0x5c3d95['origtransfereruniqueid']][_0xc96c('0x42')]=_0x5c3d95['secondtransfereruniqueid'];}if(_0x5c3d95[_0xc96c('0x51')]&&agents[_0x5c3d95[_0xc96c('0x51')]]){agents[_0x5c3d95[_0xc96c('0x51')]][_0xc96c('0x4c')]=0x1;transfers[_0x5c3d95[_0xc96c('0x51')]]=_[_0xc96c('0x52')](agents[_0x5c3d95[_0xc96c('0x51')]]);transfers[_0x5c3d95[_0xc96c('0x51')]][_0xc96c('0x4d')]=agents[_0x5c3d95[_0xc96c('0x44')]]['calleridnum'];transfers[_0x5c3d95[_0xc96c('0x51')]]['calleridname']=agents[_0x5c3d95[_0xc96c('0x44')]][_0xc96c('0x4e')];transfers[_0x5c3d95['transfertargetuniqueid']][_0xc96c('0x18')]=utils['now']();transfers[_0x5c3d95[_0xc96c('0x51')]][_0xc96c('0x30')]=utils[_0xc96c('0x19')]();transfers[_0x5c3d95[_0xc96c('0x51')]][_0xc96c('0x2d')]=0x0;transfers[_0x5c3d95[_0xc96c('0x51')]][_0xc96c('0x4c')]=0x2;}}}catch(_0xbd6525){utils[_0xc96c('0x1c')](util['format'](_0xc96c('0x43'),_0x5c3d95[_0xc96c('0x44')]),_0xbd6525);}};exports[_0xc96c('0x53')]=function(_0x43f94e){try{utils['debug'](util[_0xc96c('0x3')](_0xc96c('0x54'),_0x43f94e['uniqueid']),_0x43f94e);if(agents[_0x43f94e['uniqueid']]&&agents[_0x43f94e[_0xc96c('0x5')]]['reason']===_0xc96c('0x24')){if(_0x43f94e[_0xc96c('0x55')]==='21'){agents[_0x43f94e[_0xc96c('0x5')]][_0xc96c('0x23')]=_0xc96c('0x56');agents[_0x43f94e[_0xc96c('0x5')]][_0xc96c('0xb')]=_0xc96c('0x56');}utils[_0xc96c('0x2')](util['format'](_0xc96c('0x57'),_0x43f94e[_0xc96c('0x5')],agents[_0x43f94e[_0xc96c('0x5')]]['membername'],agents[_0x43f94e['uniqueid']][_0xc96c('0x23')],agents[_0x43f94e[_0xc96c('0x5')]][_0xc96c('0xb')]));writeDB(agents[_0x43f94e[_0xc96c('0x5')]]);var _0x1efa88=unanswered[_0xc96c('0x58')](_0x43f94e[_0xc96c('0x5')]);if(_0x1efa88>-0x1){unanswered['splice'](_0x1efa88,0x1);}}if(transfers[_0x43f94e[_0xc96c('0x5')]]){transfers[_0x43f94e[_0xc96c('0x5')]]['agentcomplete']=!![];transfers[_0x43f94e[_0xc96c('0x5')]]['agentcompleteAt']=utils[_0xc96c('0x19')]();transfers[_0x43f94e[_0xc96c('0x5')]][_0xc96c('0x26')]=utils[_0xc96c('0x39')](transfers[_0x43f94e[_0xc96c('0x5')]][_0xc96c('0x38')],transfers[_0x43f94e[_0xc96c('0x5')]][_0xc96c('0x30')]);transfers[_0x43f94e[_0xc96c('0x5')]]['reason']=_0xc96c('0x59');transfers[_0x43f94e[_0xc96c('0x5')]]['lastevent']=_0xc96c('0x3a');utils['info'](util[_0xc96c('0x3')](_0xc96c('0x57'),_0x43f94e[_0xc96c('0x5')],transfers[_0x43f94e['uniqueid']][_0xc96c('0x8')],transfers[_0x43f94e[_0xc96c('0x5')]]['reason'],transfers[_0x43f94e[_0xc96c('0x5')]][_0xc96c('0xb')]));writeDB(transfers[_0x43f94e[_0xc96c('0x5')]],!![]);}if(agents[_0x43f94e['uniqueid']]&&agents[_0x43f94e[_0xc96c('0x5')]][_0xc96c('0x30')]){agents[_0x43f94e[_0xc96c('0x5')]][_0xc96c('0x10')]=!![];agents[_0x43f94e[_0xc96c('0x5')]][_0xc96c('0x38')]=utils[_0xc96c('0x19')]();agents[_0x43f94e[_0xc96c('0x5')]][_0xc96c('0x26')]=utils[_0xc96c('0x39')](agents[_0x43f94e[_0xc96c('0x5')]][_0xc96c('0x38')],agents[_0x43f94e[_0xc96c('0x5')]][_0xc96c('0x30')]);agents[_0x43f94e[_0xc96c('0x5')]]['reason']=agents[_0x43f94e[_0xc96c('0x5')]][_0xc96c('0x3e')]?_0xc96c('0x3e'):_0xc96c('0x59');agents[_0x43f94e[_0xc96c('0x5')]]['lastevent']=_0xc96c('0x3a');utils[_0xc96c('0x2')](util[_0xc96c('0x3')](_0xc96c('0x57'),_0x43f94e[_0xc96c('0x5')],agents[_0x43f94e['uniqueid']]['membername'],agents[_0x43f94e[_0xc96c('0x5')]][_0xc96c('0x23')],agents[_0x43f94e['uniqueid']][_0xc96c('0xb')]));writeDB(agents[_0x43f94e[_0xc96c('0x5')]]);}}catch(_0x563449){utils[_0xc96c('0x1c')](util[_0xc96c('0x3')]('[%s][agents][hangup]',_0x43f94e[_0xc96c('0x5')]),_0x563449);}}; \ No newline at end of file +var _0x58a4=['clone','hangup','[%s][agents][hangup]','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','agent','lodash','util','./utils','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','membername','interface','lastevent','getVoiceQueueByName','then','type','agentacw','agentcomplete','acw','acwtime','acwTimeout','request','CreateVoiceAgentReport','destuniqueid','agentcalled','agentcalledAt','now','connectedlinenum','connectedlinename','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','[%s][agents][agentcalled]','debug','[%s][agents][agentringnoanswer]','agentringnoanswer','agentringnoanswerAt','timeout','reason','holdtime','ringtime','queuecallerabandon','forIn','includes','abandoned','[%s][agents][queuecallerabandon]','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connect','talktime','answered_elsewhere','answeredelsewheredestinationuniqueid','isNil','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','diffTime','complete','[%s][agents][agentcomplete]','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','blind','transferexten','extension','attendedtransfer','[%s][agents][attendedtransfer]','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','origtransfereruniqueid','transfer','transfertype','ATTENDED','origtransfererexten','transferuniqueid','transfereeuniqueid','calleridnum','calleridname','agententerreason','secondtransfererlinkedid','secondtransfererexten','transfertargetuniqueid'];(function(_0x9cdcbd,_0x4097a1){var _0x563564=function(_0x165ca4){while(--_0x165ca4){_0x9cdcbd['push'](_0x9cdcbd['shift']());}};_0x563564(++_0x4097a1);}(_0x58a4,0xbf));var _0x458a=function(_0x15876a,_0x15383d){_0x15876a=_0x15876a-0x0;var _0xbd900f=_0x58a4[_0x15876a];return _0xbd900f;};'use strict';var _=require(_0x458a('0x0'));var util=require(_0x458a('0x1'));var utils=require(_0x458a('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x1e23ea,_0xd2a36e){utils[_0x458a('0x3')](util[_0x458a('0x4')](_0x458a('0x5'),_0x1e23ea[_0x458a('0x6')],_0x1e23ea[_0x458a('0x7')],_0x1e23ea[_0x458a('0x8')],_0x1e23ea[_0x458a('0x9')],_0x1e23ea[_0x458a('0xa')],_0x1e23ea['calleridnum'],_0x1e23ea['connectedlinenum'],_0x1e23ea[_0x458a('0xb')]));if(_0x1e23ea[_0x458a('0x8')]){utils[_0x458a('0xc')](_0x1e23ea[_0x458a('0x8')])[_0x458a('0xd')](function(_0x55bf10){if(_0x55bf10){_0x1e23ea['type']=_0x55bf10[_0x458a('0xe')];_0x1e23ea[_0x458a('0xf')]=_0x1e23ea[_0x458a('0x10')]?_0x55bf10[_0x458a('0x11')]:![];_0x1e23ea[_0x458a('0x12')]=_0x1e23ea['agentacw']?_0x55bf10[_0x458a('0x13')]:0x0;}utils[_0x458a('0x14')]('CreateVoiceAgentReport',_0x1e23ea);});}else{utils[_0x458a('0x14')](_0x458a('0x15'),_0x1e23ea);}if(_0xd2a36e){delete transfers[_0x1e23ea[_0x458a('0x6')]];}else{delete agents[_0x1e23ea[_0x458a('0x16')]];}}exports[_0x458a('0x17')]=function(_0x5bd09e){try{utils['debug'](util[_0x458a('0x4')]('[%s][agents][agentcalled]',_0x5bd09e[_0x458a('0x6')]),_0x5bd09e);agents[_0x5bd09e[_0x458a('0x16')]]=_0x5bd09e;agents[_0x5bd09e[_0x458a('0x16')]][_0x458a('0x18')]=utils[_0x458a('0x19')]();agents[_0x5bd09e[_0x458a('0x16')]]['lastevent']='called';agents[_0x5bd09e['destuniqueid']][_0x458a('0x1a')]=null;agents[_0x5bd09e[_0x458a('0x16')]][_0x458a('0x1b')]=null;utils['info'](util[_0x458a('0x4')](_0x458a('0x1c'),_0x5bd09e[_0x458a('0x6')],agents[_0x5bd09e[_0x458a('0x16')]][_0x458a('0x9')],_0x5bd09e['destuniqueid']));}catch(_0x4f57e3){utils[_0x458a('0x1d')](util['format'](_0x458a('0x1e'),_0x5bd09e[_0x458a('0x6')]),_0x4f57e3);}};exports['agentringnoanswer']=function(_0x468416){try{if(!_['isNil'](agents[_0x468416[_0x458a('0x16')]])){utils[_0x458a('0x1f')](util['format'](_0x458a('0x20'),_0x468416[_0x458a('0x6')]),_0x468416);utils['info'](util[_0x458a('0x4')]('[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout',_0x468416[_0x458a('0x6')],agents[_0x468416['destuniqueid']][_0x458a('0x9')],_0x468416['destuniqueid']));agents[_0x468416[_0x458a('0x16')]][_0x458a('0x21')]=!![];agents[_0x468416[_0x458a('0x16')]][_0x458a('0x22')]=utils[_0x458a('0x19')]();agents[_0x468416[_0x458a('0x16')]][_0x458a('0xb')]=_0x458a('0x23');agents[_0x468416[_0x458a('0x16')]][_0x458a('0x24')]=_0x458a('0x23');agents[_0x468416[_0x458a('0x16')]][_0x458a('0x25')]=_0x468416['ringtime']?parseInt(_0x468416[_0x458a('0x26')])/0x3e8:0x0;agents[_0x468416[_0x458a('0x16')]]['talktime']=0x0;unanswered['push'](_0x468416[_0x458a('0x16')]);}}catch(_0x596fe2){utils[_0x458a('0x1d')](util[_0x458a('0x4')](_0x458a('0x20'),_0x468416['uniqueid']),_0x596fe2);}};exports[_0x458a('0x27')]=function(_0x2531f7){try{_[_0x458a('0x28')](agents,function(_0x562c36,_0x47e20d){if(_0x562c36[_0x458a('0x6')]==_0x2531f7['uniqueid']&&!_[_0x458a('0x29')](unanswered,_0x562c36['destuniqueid'])){utils[_0x458a('0x1f')](util[_0x458a('0x4')]('[%s][agents][queuecallerabandon]',_0x2531f7[_0x458a('0x6')]),_0x2531f7);utils[_0x458a('0x3')](util[_0x458a('0x4')]('[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned',_0x2531f7[_0x458a('0x6')],_0x562c36[_0x458a('0x9')],_0x562c36[_0x458a('0x16')]));_0x562c36[_0x458a('0x21')]=!![];_0x562c36[_0x458a('0x22')]=utils['now']();_0x562c36[_0x458a('0xb')]=_0x458a('0x2a');_0x562c36[_0x458a('0x24')]=_0x458a('0x2a');_0x562c36[_0x458a('0x25')]=_0x2531f7[_0x458a('0x25')];_0x562c36['talktime']=0x0;writeDB(_0x562c36);}});}catch(_0x2a6b9c){utils[_0x458a('0x1d')](util[_0x458a('0x4')](_0x458a('0x2b'),_0x2531f7[_0x458a('0x6')]),_0x2a6b9c);}};exports[_0x458a('0x2c')]=function(_0x262ad0){try{if(agents[_0x262ad0[_0x458a('0x16')]]){utils[_0x458a('0x1f')](util['format'](_0x458a('0x2d'),_0x262ad0[_0x458a('0x6')]),_0x262ad0);utils[_0x458a('0x3')](util[_0x458a('0x4')](_0x458a('0x2e'),_0x262ad0[_0x458a('0x6')],agents[_0x262ad0[_0x458a('0x16')]][_0x458a('0x9')],_0x262ad0[_0x458a('0x16')]));agents[_0x262ad0[_0x458a('0x16')]][_0x458a('0x2f')]=utils[_0x458a('0x19')]();agents[_0x262ad0[_0x458a('0x16')]][_0x458a('0x1a')]=_0x262ad0[_0x458a('0x1a')];agents[_0x262ad0['destuniqueid']][_0x458a('0x1b')]=_0x262ad0[_0x458a('0x1b')];agents[_0x262ad0[_0x458a('0x16')]][_0x458a('0x25')]=_0x262ad0[_0x458a('0x26')];agents[_0x262ad0[_0x458a('0x16')]][_0x458a('0xb')]=_0x458a('0x30');_[_0x458a('0x28')](agents,function(_0x44c5ba,_0x20cf10){if(_0x44c5ba['destuniqueid']!=_0x262ad0[_0x458a('0x16')]&&_0x44c5ba[_0x458a('0x6')]==_0x262ad0['uniqueid']){_0x44c5ba[_0x458a('0x31')]=0x0;_0x44c5ba[_0x458a('0x25')]=_0x262ad0[_0x458a('0x26')];_0x44c5ba['agentringnoanswer']=!![];_0x44c5ba[_0x458a('0x22')]=utils[_0x458a('0x19')]();_0x44c5ba[_0x458a('0xb')]=_0x458a('0x32');_0x44c5ba[_0x458a('0x24')]=_0x458a('0x32');_0x44c5ba[_0x458a('0x33')]=_0x262ad0[_0x458a('0x16')];_0x44c5ba['answeredelsewheremembername']=_0x262ad0[_0x458a('0x9')];writeDB(_0x44c5ba);}});}}catch(_0x145e3c){utils[_0x458a('0x1d')](util['format'](_0x458a('0x2d'),_0x262ad0[_0x458a('0x6')]),_0x145e3c);}};exports['agentcomplete']=function(_0x598707){try{if(!_[_0x458a('0x34')](agents[_0x598707[_0x458a('0x16')]])){utils[_0x458a('0x1f')](util[_0x458a('0x4')]('[%s][agents][agentcomplete]',_0x598707['uniqueid']),_0x598707);utils[_0x458a('0x3')](util[_0x458a('0x4')](_0x458a('0x35'),_0x598707[_0x458a('0x6')],agents[_0x598707['destuniqueid']][_0x458a('0x9')],_0x598707[_0x458a('0x16')]));agents[_0x598707['destuniqueid']][_0x458a('0x10')]=!![];agents[_0x598707['destuniqueid']][_0x458a('0x36')]=utils[_0x458a('0x19')]();agents[_0x598707[_0x458a('0x16')]]['talktime']=utils[_0x458a('0x37')](agents[_0x598707[_0x458a('0x16')]][_0x458a('0x36')],agents[_0x598707['destuniqueid']]['agentconnectAt']);agents[_0x598707[_0x458a('0x16')]][_0x458a('0x24')]=_0x598707[_0x458a('0x24')];agents[_0x598707['destuniqueid']]['lastevent']=_0x458a('0x38');writeDB(agents[_0x598707[_0x458a('0x16')]]);}}catch(_0x25bee8){utils[_0x458a('0x1d')](util[_0x458a('0x4')](_0x458a('0x39'),_0x598707[_0x458a('0x6')]),_0x25bee8);}};exports[_0x458a('0x3a')]=function(_0xb22232){try{if(!_[_0x458a('0x34')](agents[_0xb22232[_0x458a('0x3b')]])){utils[_0x458a('0x1f')](util[_0x458a('0x4')](_0x458a('0x3c'),_0xb22232[_0x458a('0x6')]),_0xb22232);utils[_0x458a('0x3')](util['format'](_0x458a('0x3d'),_0xb22232[_0x458a('0x6')],agents[_0xb22232[_0x458a('0x3b')]][_0x458a('0x9')],agents[_0xb22232[_0x458a('0x3b')]]['uniqueid']));agents[_0xb22232['transfereruniqueid']]['transfer']=!![];agents[_0xb22232[_0x458a('0x3b')]]['transfertype']=_0x458a('0x3e');agents[_0xb22232[_0x458a('0x3b')]][_0x458a('0x3f')]=_0xb22232[_0x458a('0x40')];agents[_0xb22232[_0x458a('0x3b')]]['transferuniqueid']=agents[_0xb22232['transfereruniqueid']][_0x458a('0x6')];}}catch(_0x2d8b77){utils[_0x458a('0x1d')](util[_0x458a('0x4')](_0x458a('0x3c'),_0xb22232['uniqueid']),_0x2d8b77);}};exports[_0x458a('0x41')]=function(_0x4eed01){try{utils[_0x458a('0x1f')](util['format'](_0x458a('0x42'),_0x4eed01['origtransfereruniqueid']),_0x4eed01);if(_0x4eed01['origtransfereruniqueid']==_0x4eed01['origtransfererlinkedid']){if(!_[_0x458a('0x34')](agents[_0x4eed01[_0x458a('0x43')]])){utils['info'](util[_0x458a('0x4')](_0x458a('0x44'),_0x4eed01[_0x458a('0x45')],agents[_0x4eed01['secondtransfereruniqueid']][_0x458a('0x9')]));agents[_0x4eed01[_0x458a('0x43')]][_0x458a('0x46')]=!![];agents[_0x4eed01[_0x458a('0x43')]][_0x458a('0x47')]=_0x458a('0x48');agents[_0x4eed01['secondtransfereruniqueid']][_0x458a('0x3f')]=_0x4eed01[_0x458a('0x49')];agents[_0x4eed01[_0x458a('0x43')]][_0x458a('0x4a')]=_0x4eed01[_0x458a('0x45')];}if(_0x4eed01[_0x458a('0x4b')]&&agents[_0x4eed01[_0x458a('0x4b')]]){agents[_0x4eed01[_0x458a('0x4b')]]['agententerreason']=0x1;transfers[_0x4eed01[_0x458a('0x4b')]]=_['clone'](agents[_0x4eed01[_0x458a('0x4b')]]);transfers[_0x4eed01[_0x458a('0x4b')]][_0x458a('0x4c')]=agents[_0x4eed01[_0x458a('0x43')]]['calleridnum'];transfers[_0x4eed01['transfereeuniqueid']][_0x458a('0x4d')]=agents[_0x4eed01[_0x458a('0x43')]][_0x458a('0x4d')];transfers[_0x4eed01[_0x458a('0x4b')]][_0x458a('0x18')]=utils[_0x458a('0x19')]();transfers[_0x4eed01['transfereeuniqueid']][_0x458a('0x2f')]=utils[_0x458a('0x19')]();transfers[_0x4eed01['transfereeuniqueid']][_0x458a('0x25')]=0x0;transfers[_0x4eed01['transfereeuniqueid']][_0x458a('0x4e')]=0x2;}}else if(_0x4eed01[_0x458a('0x43')]==_0x4eed01[_0x458a('0x4f')]){if(!_[_0x458a('0x34')](agents[_0x4eed01[_0x458a('0x45')]])){utils[_0x458a('0x3')](util[_0x458a('0x4')](_0x458a('0x44'),_0x4eed01['origtransfereruniqueid'],agents[_0x4eed01[_0x458a('0x45')]][_0x458a('0x9')]));agents[_0x4eed01['origtransfereruniqueid']][_0x458a('0x46')]=!![];agents[_0x4eed01[_0x458a('0x45')]]['transfertype']=_0x458a('0x48');agents[_0x4eed01[_0x458a('0x45')]]['transferexten']=_0x4eed01[_0x458a('0x50')];agents[_0x4eed01[_0x458a('0x45')]]['transferuniqueid']=_0x4eed01[_0x458a('0x43')];}if(_0x4eed01[_0x458a('0x51')]&&agents[_0x4eed01[_0x458a('0x51')]]){agents[_0x4eed01[_0x458a('0x51')]][_0x458a('0x4e')]=0x1;transfers[_0x4eed01[_0x458a('0x51')]]=_[_0x458a('0x52')](agents[_0x4eed01[_0x458a('0x51')]]);transfers[_0x4eed01['transfertargetuniqueid']][_0x458a('0x4c')]=agents[_0x4eed01[_0x458a('0x45')]][_0x458a('0x4c')];transfers[_0x4eed01[_0x458a('0x51')]][_0x458a('0x4d')]=agents[_0x4eed01[_0x458a('0x45')]][_0x458a('0x4d')];transfers[_0x4eed01[_0x458a('0x51')]][_0x458a('0x18')]=utils[_0x458a('0x19')]();transfers[_0x4eed01['transfertargetuniqueid']][_0x458a('0x2f')]=utils['now']();transfers[_0x4eed01[_0x458a('0x51')]][_0x458a('0x25')]=0x0;transfers[_0x4eed01[_0x458a('0x51')]][_0x458a('0x4e')]=0x2;}}}catch(_0xfb99c8){utils[_0x458a('0x1d')](util[_0x458a('0x4')](_0x458a('0x42'),_0x4eed01[_0x458a('0x45')]),_0xfb99c8);}};exports[_0x458a('0x53')]=function(_0x31074e){try{utils[_0x458a('0x1f')](util[_0x458a('0x4')](_0x458a('0x54'),_0x31074e[_0x458a('0x6')]),_0x31074e);if(agents[_0x31074e[_0x458a('0x6')]]&&agents[_0x31074e['uniqueid']][_0x458a('0x24')]==='timeout'){if(_0x31074e[_0x458a('0x55')]==='21'){agents[_0x31074e[_0x458a('0x6')]]['reason']=_0x458a('0x56');agents[_0x31074e[_0x458a('0x6')]][_0x458a('0xb')]='rejected';}utils[_0x458a('0x3')](util[_0x458a('0x4')](_0x458a('0x57'),_0x31074e[_0x458a('0x6')],agents[_0x31074e[_0x458a('0x6')]][_0x458a('0x9')],agents[_0x31074e['uniqueid']][_0x458a('0x24')],agents[_0x31074e['uniqueid']]['lastevent']));writeDB(agents[_0x31074e[_0x458a('0x6')]]);var _0x36ba6e=unanswered[_0x458a('0x58')](_0x31074e[_0x458a('0x6')]);if(_0x36ba6e>-0x1){unanswered[_0x458a('0x59')](_0x36ba6e,0x1);}}if(transfers[_0x31074e[_0x458a('0x6')]]){transfers[_0x31074e[_0x458a('0x6')]][_0x458a('0x10')]=!![];transfers[_0x31074e[_0x458a('0x6')]][_0x458a('0x36')]=utils[_0x458a('0x19')]();transfers[_0x31074e[_0x458a('0x6')]][_0x458a('0x31')]=utils[_0x458a('0x37')](transfers[_0x31074e['uniqueid']]['agentcompleteAt'],transfers[_0x31074e['uniqueid']][_0x458a('0x2f')]);transfers[_0x31074e['uniqueid']][_0x458a('0x24')]=_0x458a('0x5a');transfers[_0x31074e[_0x458a('0x6')]][_0x458a('0xb')]=_0x458a('0x38');utils[_0x458a('0x3')](util[_0x458a('0x4')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x31074e[_0x458a('0x6')],transfers[_0x31074e[_0x458a('0x6')]]['membername'],transfers[_0x31074e[_0x458a('0x6')]]['reason'],transfers[_0x31074e[_0x458a('0x6')]]['lastevent']));writeDB(transfers[_0x31074e[_0x458a('0x6')]],!![]);}if(agents[_0x31074e[_0x458a('0x6')]]&&agents[_0x31074e[_0x458a('0x6')]][_0x458a('0x2f')]){agents[_0x31074e['uniqueid']][_0x458a('0x10')]=!![];agents[_0x31074e[_0x458a('0x6')]][_0x458a('0x36')]=utils[_0x458a('0x19')]();agents[_0x31074e[_0x458a('0x6')]][_0x458a('0x31')]=utils[_0x458a('0x37')](agents[_0x31074e[_0x458a('0x6')]]['agentcompleteAt'],agents[_0x31074e[_0x458a('0x6')]][_0x458a('0x2f')]);agents[_0x31074e[_0x458a('0x6')]][_0x458a('0x24')]=agents[_0x31074e['uniqueid']][_0x458a('0x46')]?_0x458a('0x46'):'agent';agents[_0x31074e[_0x458a('0x6')]][_0x458a('0xb')]=_0x458a('0x38');utils[_0x458a('0x3')](util[_0x458a('0x4')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x31074e[_0x458a('0x6')],agents[_0x31074e[_0x458a('0x6')]][_0x458a('0x9')],agents[_0x31074e[_0x458a('0x6')]][_0x458a('0x24')],agents[_0x31074e[_0x458a('0x6')]][_0x458a('0xb')]));writeDB(agents[_0x31074e['uniqueid']]);}}catch(_0x1f9925){utils['error'](util[_0x458a('0x4')](_0x458a('0x54'),_0x31074e[_0x458a('0x6')]),_0x1f9925);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 51fb6f7..855016b 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 _0x1b92=['musiconholdstop','[%s][calls][musiconholdstop]','mohtime','varset','variable','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','xmd-phone','destination','\x22\x20<','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-callerid-preview','xmcs-queue','xmd-queue','xmd-contactid','ContactId','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','[%s][calls][varset]','application','appdata','toLowerCase','set','startsWith','cdr','split','substring','lastIndexOf','includes','execif','gotoif','lastapplication','lastdata','[%s][calls][newexten]','util','./utils','NO\x20ANSWER','FAILED','BUSY','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','connectedlinenum','accountcode','getUserByInternal','then','UserId','request','CreateVoiceCallReport','linkedid','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','calleridnum','now','newstate','[%s][calls][newstate]','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','ANSWERED','error','hangup','debug','[%s][calls][hangup]','callerid','calleridname','cause-txt','endtime','duration','diffTime','billableseconds','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','transfereechannel','origtransfereruniqueid','secondtransfererchannel','userfield','_attended','origtransfererchannel','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstartAt'];(function(_0x52121d,_0x1d1704){var _0x448627=function(_0x495bf0){while(--_0x495bf0){_0x52121d['push'](_0x52121d['shift']());}};_0x448627(++_0x1d1704);}(_0x1b92,0x1a7));var _0x21b9=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x1b92[_0x465a0c];return _0x1e202e;};'use strict';var _=require('lodash');var util=require(_0x21b9('0x0'));var utils=require(_0x21b9('0x1'));var dispositions=[_0x21b9('0x2'),_0x21b9('0x3'),_0x21b9('0x3'),_0x21b9('0x2'),_0x21b9('0x2'),_0x21b9('0x2'),'ANSWERED',_0x21b9('0x4'),'FAILED',_0x21b9('0x3'),_0x21b9('0x3')];var channels={};function writeDB(_0x48f026){utils[_0x21b9('0x5')](util[_0x21b9('0x6')](_0x21b9('0x7'),_0x48f026[_0x21b9('0x8')],_0x48f026[_0x21b9('0x9')],_0x48f026[_0x21b9('0xa')],_0x48f026['membername'],_0x48f026['interface'],_0x48f026['calleridnum'],_0x48f026[_0x21b9('0xb')],_0x48f026['lastevent']));if(_0x48f026[_0x21b9('0xc')]){utils[_0x21b9('0xd')](_0x48f026[_0x21b9('0xc')])[_0x21b9('0xe')](function(_0x23813e){if(_0x23813e){_0x48f026[_0x21b9('0xf')]=_0x23813e['id'];}utils[_0x21b9('0x10')](_0x21b9('0x11'),_0x48f026);});}else{utils['request']('CreateVoiceCallReport',_0x48f026);}if(channels[_0x48f026['uniqueid']]){delete channels[_0x48f026[_0x21b9('0x8')]];}}exports['newchannel']=function(_0x202b9a){try{utils['debug'](util[_0x21b9('0x6')]('[%s][calls][newchannel]',_0x202b9a['uniqueid']),_0x202b9a);if(_0x202b9a[_0x21b9('0x8')]==_0x202b9a[_0x21b9('0x12')]&&_0x202b9a['channel']!='OutgoingSpoolFailed'){utils[_0x21b9('0x5')](util[_0x21b9('0x6')](_0x21b9('0x13'),_0x202b9a[_0x21b9('0x8')],_0x202b9a[_0x21b9('0x14')],_0x202b9a[_0x21b9('0x15')]));channels[_0x202b9a[_0x21b9('0x8')]]={'uniqueid':_0x202b9a[_0x21b9('0x8')],'accountcode':_0x202b9a[_0x21b9('0xc')],'source':_0x202b9a[_0x21b9('0x16')],'destination':_0x202b9a[_0x21b9('0x15')],'destinationcontext':_0x202b9a[_0x21b9('0x14')],'channel':_0x202b9a[_0x21b9('0x9')],'starttime':utils[_0x21b9('0x17')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':'NO\x20ANSWER','amaflags':'DOCUMENTATION'};}}catch(_0x3619cc){utils['error'](util[_0x21b9('0x6')]('[%s][calls][newchannel]',_0x202b9a[_0x21b9('0x8')]),_0x3619cc);}};exports[_0x21b9('0x18')]=function(_0xfb418f){try{utils['debug'](util[_0x21b9('0x6')](_0x21b9('0x19'),_0xfb418f['uniqueid']),_0xfb418f);if(!_[_0x21b9('0x1a')](channels[_0xfb418f[_0x21b9('0x8')]])&&_0xfb418f[_0x21b9('0x1b')]==0x6){utils[_0x21b9('0x5')](util[_0x21b9('0x6')](_0x21b9('0x1c'),_0xfb418f[_0x21b9('0x8')],_0xfb418f[_0x21b9('0x14')],_0xfb418f[_0x21b9('0x9')]));if(_['isNil'](channels[_0xfb418f['uniqueid']][_0x21b9('0x1d')])){channels[_0xfb418f[_0x21b9('0x8')]][_0x21b9('0x1d')]=utils['now']();}}else if(!_[_0x21b9('0x1a')](channels[_0xfb418f[_0x21b9('0x12')]])&&_0xfb418f[_0x21b9('0x1b')]==0x6&&_0xfb418f[_0x21b9('0x14')]!=_0x21b9('0x1e')){utils['info'](util[_0x21b9('0x6')](_0x21b9('0x1f'),_0xfb418f[_0x21b9('0x8')],_0xfb418f[_0x21b9('0x12')],_0xfb418f['context'],_0xfb418f[_0x21b9('0x9')]));channels[_0xfb418f[_0x21b9('0x12')]][_0x21b9('0xc')]=_0xfb418f[_0x21b9('0xc')];channels[_0xfb418f[_0x21b9('0x12')]][_0x21b9('0x20')]=_0xfb418f[_0x21b9('0x9')];if(_[_0x21b9('0x1a')](channels[_0xfb418f['linkedid']]['answertime'])){channels[_0xfb418f[_0x21b9('0x12')]][_0x21b9('0x21')]=utils[_0x21b9('0x17')]();}channels[_0xfb418f[_0x21b9('0x12')]]['disposition']=dispositions[_['toNumber'](_0xfb418f[_0x21b9('0x1b')])]||_0x21b9('0x22');}}catch(_0x442052){utils[_0x21b9('0x23')](util[_0x21b9('0x6')](_0x21b9('0x19'),_0xfb418f['uniqueid']),_0x442052);}};exports[_0x21b9('0x24')]=function(_0x2944ea){try{if(!_[_0x21b9('0x1a')](channels[_0x2944ea['uniqueid']])){utils[_0x21b9('0x25')](util[_0x21b9('0x6')](_0x21b9('0x26'),_0x2944ea[_0x21b9('0x8')]),_0x2944ea);if(_[_0x21b9('0x1a')](channels[_0x2944ea[_0x21b9('0x8')]][_0x21b9('0x27')])){channels[_0x2944ea[_0x21b9('0x8')]][_0x21b9('0x27')]=_0x2944ea[_0x21b9('0x28')]+'\x20<'+_0x2944ea[_0x21b9('0x16')]+'>';}utils[_0x21b9('0x5')](util[_0x21b9('0x6')]('[%s][calls][hangup]\x20callerid:%s\x20reason:%s',_0x2944ea[_0x21b9('0x8')],channels[_0x2944ea[_0x21b9('0x8')]][_0x21b9('0x27')],_0x2944ea[_0x21b9('0x29')]));channels[_0x2944ea[_0x21b9('0x8')]][_0x21b9('0x2a')]=utils[_0x21b9('0x17')]();channels[_0x2944ea[_0x21b9('0x8')]][_0x21b9('0x2b')]=utils[_0x21b9('0x2c')](channels[_0x2944ea[_0x21b9('0x8')]][_0x21b9('0x2a')],channels[_0x2944ea[_0x21b9('0x8')]]['starttime']);channels[_0x2944ea[_0x21b9('0x8')]][_0x21b9('0x2d')]=channels[_0x2944ea[_0x21b9('0x8')]][_0x21b9('0x21')]?utils['diffTime'](channels[_0x2944ea[_0x21b9('0x8')]][_0x21b9('0x2a')],channels[_0x2944ea[_0x21b9('0x8')]][_0x21b9('0x21')]):0x0;writeDB(channels[_0x2944ea[_0x21b9('0x8')]]);}}catch(_0x14533a){utils[_0x21b9('0x23')](util[_0x21b9('0x6')](_0x21b9('0x26'),_0x2944ea[_0x21b9('0x8')]),_0x14533a);}};exports[_0x21b9('0x2e')]=function(_0x481bf8){try{if(!_['isNil'](channels[_0x481bf8[_0x21b9('0x2f')]])){utils[_0x21b9('0x25')](util[_0x21b9('0x6')](_0x21b9('0x30'),_0x481bf8['origtransfereruniqueid']),_0x481bf8);if(channels[_0x481bf8[_0x21b9('0x2f')]]['channel']==_0x481bf8[_0x21b9('0x31')]){utils[_0x21b9('0x5')](util[_0x21b9('0x6')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x481bf8[_0x21b9('0x32')],_0x481bf8['localtwolinkedid'],_0x481bf8[_0x21b9('0x33')]));channels[_0x481bf8[_0x21b9('0x2f')]]['destinationchannel']=_0x481bf8['secondtransfererchannel'];channels[_0x481bf8[_0x21b9('0x2f')]][_0x21b9('0x34')]=_0x21b9('0x35');}else if(channels[_0x481bf8[_0x21b9('0x2f')]][_0x21b9('0x9')]=_0x481bf8['transfertargetchannel']){utils[_0x21b9('0x5')](util['format']('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x481bf8['origtransfereruniqueid'],_0x481bf8['localtwolinkedid'],_0x481bf8[_0x21b9('0x36')]));channels[_0x481bf8[_0x21b9('0x2f')]][_0x21b9('0x20')]=_0x481bf8[_0x21b9('0x36')];channels[_0x481bf8[_0x21b9('0x2f')]][_0x21b9('0x34')]=_0x21b9('0x35');}}}catch(_0x2a4e14){utils[_0x21b9('0x23')](util[_0x21b9('0x6')](_0x21b9('0x30'),_0x481bf8[_0x21b9('0x32')]),_0x2a4e14);}};exports['musiconholdstart']=function(_0x213d0c){try{if(!_['isNil'](channels[_0x213d0c[_0x21b9('0x8')]])){utils['debug'](util[_0x21b9('0x6')]('[%s][calls][musiconholdstart]',_0x213d0c[_0x21b9('0x8')]),_0x213d0c);channels[_0x213d0c[_0x21b9('0x8')]]['musiconholdstartAt']=utils[_0x21b9('0x17')]();utils['info'](util[_0x21b9('0x6')](_0x21b9('0x37'),_0x213d0c['uniqueid'],channels[_0x213d0c[_0x21b9('0x8')]][_0x21b9('0x38')]));}}catch(_0x3cf7b6){utils['error'](util[_0x21b9('0x6')]('[%s][calls][musiconholdstart]',_0x213d0c[_0x21b9('0x8')]),_0x3cf7b6);}};exports[_0x21b9('0x39')]=function(_0x1b7fca){try{if(!_[_0x21b9('0x1a')](channels[_0x1b7fca[_0x21b9('0x8')]])){utils[_0x21b9('0x25')](util[_0x21b9('0x6')](_0x21b9('0x3a'),_0x1b7fca[_0x21b9('0x8')]),_0x1b7fca);if(!_[_0x21b9('0x1a')](channels[_0x1b7fca['uniqueid']][_0x21b9('0x38')])){channels[_0x1b7fca['uniqueid']][_0x21b9('0x3b')]+=utils[_0x21b9('0x2c')](utils['now'](),channels[_0x1b7fca['uniqueid']][_0x21b9('0x38')]);utils['info'](util[_0x21b9('0x6')]('[%s][calls][musiconholdstop]\x20mohtime:%s',_0x1b7fca[_0x21b9('0x8')],channels[_0x1b7fca[_0x21b9('0x8')]]['mohtime']));delete channels[_0x1b7fca[_0x21b9('0x8')]][_0x21b9('0x38')];}}}catch(_0x2ccce0){utils[_0x21b9('0x23')](util[_0x21b9('0x6')]('[%s][calls][musiconholdstop]',_0x1b7fca[_0x21b9('0x8')]),_0x2ccce0);}};exports[_0x21b9('0x3c')]=function(_0x4fb81b){try{if(!_[_0x21b9('0x1a')](channels[_0x4fb81b['uniqueid']])){utils['debug'](util[_0x21b9('0x6')]('[%s][calls][varset]',_0x4fb81b[_0x21b9('0x8')]),_0x4fb81b);if(!_['isNil'](_0x4fb81b[_0x21b9('0x3d')]['xmd-originatecalleridnum'])){utils[_0x21b9('0x5')](util[_0x21b9('0x6')](_0x21b9('0x3e'),_0x4fb81b[_0x21b9('0x8')],_0x4fb81b['value']));channels[_0x4fb81b[_0x21b9('0x8')]]['source']=_0x4fb81b[_0x21b9('0x3f')];}if(!_[_0x21b9('0x1a')](_0x4fb81b['variable'][_0x21b9('0x40')])){utils['info'](util['format']('[%s][calls][varset]\x20variable:xmd-phone\x20value:%s',_0x4fb81b['uniqueid'],_0x4fb81b[_0x21b9('0x3f')]));channels[_0x4fb81b['uniqueid']][_0x21b9('0x41')]=_0x4fb81b[_0x21b9('0x3f')];channels[_0x4fb81b[_0x21b9('0x8')]][_0x21b9('0x27')]='\x22'+_0x4fb81b[_0x21b9('0x3f')]+_0x21b9('0x42')+_0x4fb81b[_0x21b9('0x3f')]+'>';}if(!_[_0x21b9('0x1a')](_0x4fb81b[_0x21b9('0x3d')]['xmd-callerid-preview'])||!_[_0x21b9('0x1a')](_0x4fb81b[_0x21b9('0x3d')][_0x21b9('0x43')])){utils[_0x21b9('0x5')](util[_0x21b9('0x6')](_0x21b9('0x44'),_0x4fb81b[_0x21b9('0x8')],!_[_0x21b9('0x1a')](_0x4fb81b[_0x21b9('0x3d')][_0x21b9('0x45')])?_0x21b9('0x45'):'xmd-callerid',_0x4fb81b[_0x21b9('0x3f')]));channels[_0x4fb81b[_0x21b9('0x8')]]['callerid']=_0x4fb81b[_0x21b9('0x3f')];}if(!_['isNil'](_0x4fb81b[_0x21b9('0x3d')]['xmd-queue'])||!_[_0x21b9('0x1a')](_0x4fb81b['variable'][_0x21b9('0x46')])){utils[_0x21b9('0x5')](util[_0x21b9('0x6')](_0x21b9('0x44'),_0x4fb81b['uniqueid'],!_['isNil'](_0x4fb81b['variable'][_0x21b9('0x47')])?_0x21b9('0x47'):_0x21b9('0x46'),_0x4fb81b[_0x21b9('0x3f')]));channels[_0x4fb81b['uniqueid']]['lastapplication']='Queue';channels[_0x4fb81b[_0x21b9('0x8')]]['lastdata']=_0x4fb81b[_0x21b9('0x3f')];channels[_0x4fb81b['uniqueid']][_0x21b9('0xa')]=!![];}if(!_[_0x21b9('0x1a')](_0x4fb81b['variable'][_0x21b9('0x48')])){utils[_0x21b9('0x5')](util[_0x21b9('0x6')]('[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s',_0x4fb81b[_0x21b9('0x8')],_0x4fb81b[_0x21b9('0x3f')]));channels[_0x4fb81b[_0x21b9('0x8')]][_0x21b9('0x49')]=_0x4fb81b['value'];}if(!_[_0x21b9('0x1a')](_0x4fb81b[_0x21b9('0x3d')][_0x21b9('0x4a')])){utils[_0x21b9('0x5')](util[_0x21b9('0x6')](_0x21b9('0x4b'),_0x4fb81b[_0x21b9('0x8')],_0x4fb81b[_0x21b9('0x3f')]));channels[_0x4fb81b[_0x21b9('0x8')]]['type']=_0x4fb81b[_0x21b9('0x3f')];}if(!_[_0x21b9('0x1a')](_0x4fb81b[_0x21b9('0x3d')][_0x21b9('0x4c')])){utils[_0x21b9('0x5')](util[_0x21b9('0x6')](_0x21b9('0x4d'),_0x4fb81b[_0x21b9('0x8')],_0x4fb81b[_0x21b9('0x3f')]));channels[_0x4fb81b[_0x21b9('0x8')]]['routeid']=_0x4fb81b['value'];}if(!_[_0x21b9('0x1a')](_0x4fb81b[_0x21b9('0x3d')][_0x21b9('0x4e')])){utils['info'](util[_0x21b9('0x6')](_0x21b9('0x4f'),_0x4fb81b[_0x21b9('0x8')],_0x4fb81b[_0x21b9('0x3f')]));channels[_0x4fb81b[_0x21b9('0x8')]]['sipcallid']=_0x4fb81b[_0x21b9('0x3f')];}}}catch(_0x47f643){utils[_0x21b9('0x23')](util['format'](_0x21b9('0x50'),_0x4fb81b[_0x21b9('0x8')]),_0x47f643);}};exports['newexten']=function(_0x7650eb){try{if(!_[_0x21b9('0x1a')](channels[_0x7650eb[_0x21b9('0x8')]])){utils[_0x21b9('0x25')](util[_0x21b9('0x6')]('[%s][calls][newexten]',_0x7650eb[_0x21b9('0x8')]),_0x7650eb);utils['info'](util[_0x21b9('0x6')]('[%s][calls][newexten]\x20application:%s\x20appdata:%s',_0x7650eb[_0x21b9('0x8')],_0x7650eb[_0x21b9('0x51')],_0x7650eb[_0x21b9('0x52')]));if(_0x7650eb[_0x21b9('0x51')][_0x21b9('0x53')]()==_0x21b9('0x54')&&_[_0x21b9('0x55')](_0x7650eb[_0x21b9('0x52')][_0x21b9('0x53')](),_0x21b9('0x56'))){var _0x4e216d=_0x7650eb[_0x21b9('0x52')][_0x21b9('0x57')]('=');var _0x292376=_0x4e216d[0x0][_0x21b9('0x58')](_0x4e216d[0x0][_0x21b9('0x59')]('(')+0x1,_0x4e216d[0x0]['lastIndexOf'](')'));var _0x139beb=_0x4e216d[0x1];channels[_0x7650eb[_0x21b9('0x8')]][_0x292376]=_0x139beb;}if(!_[_0x21b9('0x5a')]([_0x21b9('0x24'),'noop',_0x21b9('0x5b'),_0x21b9('0x54'),_0x21b9('0x5c')],_0x7650eb[_0x21b9('0x51')][_0x21b9('0x53')]())){channels[_0x7650eb[_0x21b9('0x8')]][_0x21b9('0x5d')]=_0x7650eb['application'];channels[_0x7650eb['uniqueid']][_0x21b9('0x5e')]=_0x7650eb[_0x21b9('0x52')];}}}catch(_0x3f84ad){utils['error'](util[_0x21b9('0x6')](_0x21b9('0x5f'),_0x7650eb['uniqueid']),_0x3f84ad);}}; \ No newline at end of file +var _0xcabe=['sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','[%s][calls][newexten]','appdata','application','startsWith','toLowerCase','split','lastIndexOf','includes','noop','set','gotoif','lodash','./utils','NO\x20ANSWER','FAILED','ANSWERED','info','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','queue','membername','interface','calleridnum','connectedlinenum','lastevent','accountcode','getUserByInternal','then','UserId','CreateVoiceCallReport','request','newchannel','debug','format','[%s][calls][newchannel]','linkedid','channel','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','exten','context','now','DOCUMENTATION','error','[%s][calls][newstate]','isNil','channelstate','systemanswertime','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','disposition','toNumber','hangup','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','duration','starttime','billableseconds','diffTime','[%s][calls][hangup]','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','secondtransfererchannel','userfield','transfertargetchannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','origtransfererchannel','_attended','musiconholdstart','musiconholdstartAt','[%s][calls][musiconholdstart]','[%s][calls][musiconholdstop]\x20mohtime:%s','mohtime','[%s][calls][musiconholdstop]','varset','[%s][calls][varset]','variable','xmd-originatecalleridnum','value','xmd-phone','\x22\x20<','xmd-callerid-preview','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-callerid','xmd-queue','xmcs-queue','lastapplication','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s'];(function(_0x47990b,_0xf722d6){var _0x57bb0a=function(_0x26b8d0){while(--_0x26b8d0){_0x47990b['push'](_0x47990b['shift']());}};_0x57bb0a(++_0xf722d6);}(_0xcabe,0x13c));var _0xecab=function(_0x1e4c7a,_0x4c6545){_0x1e4c7a=_0x1e4c7a-0x0;var _0x3cbf71=_0xcabe[_0x1e4c7a];return _0x3cbf71;};'use strict';var _=require(_0xecab('0x0'));var util=require('util');var utils=require(_0xecab('0x1'));var dispositions=[_0xecab('0x2'),_0xecab('0x3'),'FAILED','NO\x20ANSWER','NO\x20ANSWER','NO\x20ANSWER',_0xecab('0x4'),'BUSY',_0xecab('0x3'),'FAILED',_0xecab('0x3')];var channels={};function writeDB(_0x3ef620){utils[_0xecab('0x5')](util['format'](_0xecab('0x6'),_0x3ef620[_0xecab('0x7')],_0x3ef620['channel'],_0x3ef620[_0xecab('0x8')],_0x3ef620[_0xecab('0x9')],_0x3ef620[_0xecab('0xa')],_0x3ef620[_0xecab('0xb')],_0x3ef620[_0xecab('0xc')],_0x3ef620[_0xecab('0xd')]));if(_0x3ef620[_0xecab('0xe')]){utils[_0xecab('0xf')](_0x3ef620[_0xecab('0xe')])[_0xecab('0x10')](function(_0x3eabe1){if(_0x3eabe1){_0x3ef620[_0xecab('0x11')]=_0x3eabe1['id'];}utils['request'](_0xecab('0x12'),_0x3ef620);});}else{utils[_0xecab('0x13')](_0xecab('0x12'),_0x3ef620);}if(channels[_0x3ef620['uniqueid']]){delete channels[_0x3ef620['uniqueid']];}}exports[_0xecab('0x14')]=function(_0x5cda93){try{utils[_0xecab('0x15')](util[_0xecab('0x16')](_0xecab('0x17'),_0x5cda93['uniqueid']),_0x5cda93);if(_0x5cda93[_0xecab('0x7')]==_0x5cda93[_0xecab('0x18')]&&_0x5cda93[_0xecab('0x19')]!=_0xecab('0x1a')){utils['info'](util[_0xecab('0x16')](_0xecab('0x1b'),_0x5cda93['uniqueid'],_0x5cda93['context'],_0x5cda93['exten']));channels[_0x5cda93['uniqueid']]={'uniqueid':_0x5cda93[_0xecab('0x7')],'accountcode':_0x5cda93[_0xecab('0xe')],'source':_0x5cda93['calleridnum'],'destination':_0x5cda93[_0xecab('0x1c')],'destinationcontext':_0x5cda93[_0xecab('0x1d')],'channel':_0x5cda93[_0xecab('0x19')],'starttime':utils[_0xecab('0x1e')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0xecab('0x2'),'amaflags':_0xecab('0x1f')};}}catch(_0xccb88){utils[_0xecab('0x20')](util['format'](_0xecab('0x17'),_0x5cda93['uniqueid']),_0xccb88);}};exports['newstate']=function(_0x20af77){try{utils[_0xecab('0x15')](util[_0xecab('0x16')](_0xecab('0x21'),_0x20af77[_0xecab('0x7')]),_0x20af77);if(!_[_0xecab('0x22')](channels[_0x20af77[_0xecab('0x7')]])&&_0x20af77[_0xecab('0x23')]==0x6){utils[_0xecab('0x5')](util[_0xecab('0x16')]('[%s][calls][newstate]\x20context:%s\x20channel:%s',_0x20af77[_0xecab('0x7')],_0x20af77['context'],_0x20af77[_0xecab('0x19')]));if(_['isNil'](channels[_0x20af77['uniqueid']][_0xecab('0x24')])){channels[_0x20af77[_0xecab('0x7')]][_0xecab('0x24')]=utils[_0xecab('0x1e')]();}}else if(!_[_0xecab('0x22')](channels[_0x20af77['linkedid']])&&_0x20af77['channelstate']==0x6&&_0x20af77[_0xecab('0x1d')]!='transfer'){utils[_0xecab('0x5')](util[_0xecab('0x16')](_0xecab('0x25'),_0x20af77['uniqueid'],_0x20af77['linkedid'],_0x20af77[_0xecab('0x1d')],_0x20af77[_0xecab('0x19')]));channels[_0x20af77[_0xecab('0x18')]][_0xecab('0xe')]=_0x20af77[_0xecab('0xe')];channels[_0x20af77[_0xecab('0x18')]][_0xecab('0x26')]=_0x20af77[_0xecab('0x19')];if(_['isNil'](channels[_0x20af77['linkedid']][_0xecab('0x27')])){channels[_0x20af77[_0xecab('0x18')]]['answertime']=utils[_0xecab('0x1e')]();}channels[_0x20af77[_0xecab('0x18')]][_0xecab('0x28')]=dispositions[_[_0xecab('0x29')](_0x20af77['channelstate'])]||_0xecab('0x4');}}catch(_0x3e41c8){utils[_0xecab('0x20')](util[_0xecab('0x16')]('[%s][calls][newstate]',_0x20af77[_0xecab('0x7')]),_0x3e41c8);}};exports[_0xecab('0x2a')]=function(_0x2ad90){try{if(!_[_0xecab('0x22')](channels[_0x2ad90[_0xecab('0x7')]])){utils[_0xecab('0x15')](util['format']('[%s][calls][hangup]',_0x2ad90[_0xecab('0x7')]),_0x2ad90);if(_[_0xecab('0x22')](channels[_0x2ad90['uniqueid']][_0xecab('0x2b')])){channels[_0x2ad90[_0xecab('0x7')]][_0xecab('0x2b')]=_0x2ad90[_0xecab('0x2c')]+'\x20<'+_0x2ad90[_0xecab('0xb')]+'>';}utils[_0xecab('0x5')](util['format'](_0xecab('0x2d'),_0x2ad90[_0xecab('0x7')],channels[_0x2ad90['uniqueid']][_0xecab('0x2b')],_0x2ad90[_0xecab('0x2e')]));channels[_0x2ad90[_0xecab('0x7')]][_0xecab('0x2f')]=utils['now']();channels[_0x2ad90[_0xecab('0x7')]][_0xecab('0x30')]=utils['diffTime'](channels[_0x2ad90[_0xecab('0x7')]]['endtime'],channels[_0x2ad90[_0xecab('0x7')]][_0xecab('0x31')]);channels[_0x2ad90[_0xecab('0x7')]][_0xecab('0x32')]=channels[_0x2ad90[_0xecab('0x7')]][_0xecab('0x27')]?utils[_0xecab('0x33')](channels[_0x2ad90['uniqueid']][_0xecab('0x2f')],channels[_0x2ad90['uniqueid']][_0xecab('0x27')]):0x0;writeDB(channels[_0x2ad90[_0xecab('0x7')]]);}}catch(_0x32d1e1){utils[_0xecab('0x20')](util['format'](_0xecab('0x34'),_0x2ad90['uniqueid']),_0x32d1e1);}};exports[_0xecab('0x35')]=function(_0x3ab1e8){try{if(!_[_0xecab('0x22')](channels[_0x3ab1e8[_0xecab('0x36')]])){utils[_0xecab('0x15')](util[_0xecab('0x16')](_0xecab('0x37'),_0x3ab1e8[_0xecab('0x38')]),_0x3ab1e8);if(channels[_0x3ab1e8[_0xecab('0x36')]][_0xecab('0x19')]==_0x3ab1e8['transfereechannel']){utils[_0xecab('0x5')](util[_0xecab('0x16')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x3ab1e8[_0xecab('0x38')],_0x3ab1e8[_0xecab('0x36')],_0x3ab1e8[_0xecab('0x39')]));channels[_0x3ab1e8[_0xecab('0x36')]][_0xecab('0x26')]=_0x3ab1e8[_0xecab('0x39')];channels[_0x3ab1e8[_0xecab('0x36')]][_0xecab('0x3a')]='_attended';}else if(channels[_0x3ab1e8[_0xecab('0x36')]][_0xecab('0x19')]=_0x3ab1e8[_0xecab('0x3b')]){utils['info'](util[_0xecab('0x16')](_0xecab('0x3c'),_0x3ab1e8['origtransfereruniqueid'],_0x3ab1e8[_0xecab('0x36')],_0x3ab1e8[_0xecab('0x3d')]));channels[_0x3ab1e8['localtwolinkedid']]['destinationchannel']=_0x3ab1e8[_0xecab('0x3d')];channels[_0x3ab1e8[_0xecab('0x36')]][_0xecab('0x3a')]=_0xecab('0x3e');}}}catch(_0x384f0c){utils[_0xecab('0x20')](util[_0xecab('0x16')](_0xecab('0x37'),_0x3ab1e8[_0xecab('0x38')]),_0x384f0c);}};exports[_0xecab('0x3f')]=function(_0x50b37f){try{if(!_['isNil'](channels[_0x50b37f[_0xecab('0x7')]])){utils['debug'](util[_0xecab('0x16')]('[%s][calls][musiconholdstart]',_0x50b37f[_0xecab('0x7')]),_0x50b37f);channels[_0x50b37f[_0xecab('0x7')]][_0xecab('0x40')]=utils[_0xecab('0x1e')]();utils['info'](util[_0xecab('0x16')]('[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s',_0x50b37f[_0xecab('0x7')],channels[_0x50b37f[_0xecab('0x7')]][_0xecab('0x40')]));}}catch(_0x15f5e){utils[_0xecab('0x20')](util[_0xecab('0x16')](_0xecab('0x41'),_0x50b37f[_0xecab('0x7')]),_0x15f5e);}};exports['musiconholdstop']=function(_0x6ed575){try{if(!_[_0xecab('0x22')](channels[_0x6ed575[_0xecab('0x7')]])){utils[_0xecab('0x15')](util[_0xecab('0x16')]('[%s][calls][musiconholdstop]',_0x6ed575[_0xecab('0x7')]),_0x6ed575);if(!_['isNil'](channels[_0x6ed575['uniqueid']]['musiconholdstartAt'])){channels[_0x6ed575[_0xecab('0x7')]]['mohtime']+=utils[_0xecab('0x33')](utils[_0xecab('0x1e')](),channels[_0x6ed575[_0xecab('0x7')]][_0xecab('0x40')]);utils[_0xecab('0x5')](util['format'](_0xecab('0x42'),_0x6ed575[_0xecab('0x7')],channels[_0x6ed575[_0xecab('0x7')]][_0xecab('0x43')]));delete channels[_0x6ed575['uniqueid']][_0xecab('0x40')];}}}catch(_0x32ab69){utils[_0xecab('0x20')](util[_0xecab('0x16')](_0xecab('0x44'),_0x6ed575['uniqueid']),_0x32ab69);}};exports[_0xecab('0x45')]=function(_0x1dd4af){try{if(!_[_0xecab('0x22')](channels[_0x1dd4af[_0xecab('0x7')]])){utils[_0xecab('0x15')](util[_0xecab('0x16')](_0xecab('0x46'),_0x1dd4af[_0xecab('0x7')]),_0x1dd4af);if(!_['isNil'](_0x1dd4af[_0xecab('0x47')][_0xecab('0x48')])){utils['info'](util[_0xecab('0x16')]('[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x1dd4af['uniqueid'],_0x1dd4af[_0xecab('0x49')]));channels[_0x1dd4af[_0xecab('0x7')]]['source']=_0x1dd4af[_0xecab('0x49')];}if(!_[_0xecab('0x22')](_0x1dd4af[_0xecab('0x47')][_0xecab('0x4a')])){utils['info'](util[_0xecab('0x16')]('[%s][calls][varset]\x20variable:xmd-phone\x20value:%s',_0x1dd4af['uniqueid'],_0x1dd4af['value']));channels[_0x1dd4af['uniqueid']]['destination']=_0x1dd4af[_0xecab('0x49')];channels[_0x1dd4af[_0xecab('0x7')]][_0xecab('0x2b')]='\x22'+_0x1dd4af[_0xecab('0x49')]+_0xecab('0x4b')+_0x1dd4af[_0xecab('0x49')]+'>';}if(!_[_0xecab('0x22')](_0x1dd4af[_0xecab('0x47')][_0xecab('0x4c')])||!_[_0xecab('0x22')](_0x1dd4af[_0xecab('0x47')]['xmd-callerid'])){utils[_0xecab('0x5')](util[_0xecab('0x16')](_0xecab('0x4d'),_0x1dd4af[_0xecab('0x7')],!_[_0xecab('0x22')](_0x1dd4af[_0xecab('0x47')][_0xecab('0x4c')])?'xmd-callerid-preview':_0xecab('0x4e'),_0x1dd4af[_0xecab('0x49')]));channels[_0x1dd4af[_0xecab('0x7')]][_0xecab('0x2b')]=_0x1dd4af[_0xecab('0x49')];}if(!_['isNil'](_0x1dd4af[_0xecab('0x47')][_0xecab('0x4f')])||!_[_0xecab('0x22')](_0x1dd4af[_0xecab('0x47')]['xmcs-queue'])){utils[_0xecab('0x5')](util[_0xecab('0x16')](_0xecab('0x4d'),_0x1dd4af[_0xecab('0x7')],!_[_0xecab('0x22')](_0x1dd4af[_0xecab('0x47')]['xmd-queue'])?'xmd-queue':_0xecab('0x50'),_0x1dd4af[_0xecab('0x49')]));channels[_0x1dd4af[_0xecab('0x7')]][_0xecab('0x51')]='Queue';channels[_0x1dd4af[_0xecab('0x7')]]['lastdata']=_0x1dd4af[_0xecab('0x49')];channels[_0x1dd4af[_0xecab('0x7')]][_0xecab('0x8')]=!![];}if(!_[_0xecab('0x22')](_0x1dd4af['variable'][_0xecab('0x52')])){utils['info'](util[_0xecab('0x16')](_0xecab('0x53'),_0x1dd4af[_0xecab('0x7')],_0x1dd4af[_0xecab('0x49')]));channels[_0x1dd4af[_0xecab('0x7')]][_0xecab('0x54')]=_0x1dd4af[_0xecab('0x49')];}if(!_['isNil'](_0x1dd4af[_0xecab('0x47')]['xmd-cdrtype'])){utils[_0xecab('0x5')](util[_0xecab('0x16')]('[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x1dd4af[_0xecab('0x7')],_0x1dd4af['value']));channels[_0x1dd4af[_0xecab('0x7')]][_0xecab('0x55')]=_0x1dd4af['value'];}if(!_[_0xecab('0x22')](_0x1dd4af[_0xecab('0x47')][_0xecab('0x56')])){utils[_0xecab('0x5')](util['format'](_0xecab('0x57'),_0x1dd4af[_0xecab('0x7')],_0x1dd4af['value']));channels[_0x1dd4af[_0xecab('0x7')]]['routeid']=_0x1dd4af['value'];}if(!_[_0xecab('0x22')](_0x1dd4af[_0xecab('0x47')][_0xecab('0x58')])){utils[_0xecab('0x5')](util[_0xecab('0x16')](_0xecab('0x59'),_0x1dd4af[_0xecab('0x7')],_0x1dd4af[_0xecab('0x49')]));channels[_0x1dd4af[_0xecab('0x7')]][_0xecab('0x58')]=_0x1dd4af[_0xecab('0x49')];}}}catch(_0x224be9){utils[_0xecab('0x20')](util[_0xecab('0x16')](_0xecab('0x46'),_0x1dd4af[_0xecab('0x7')]),_0x224be9);}};exports['newexten']=function(_0x451e66){try{if(!_['isNil'](channels[_0x451e66['uniqueid']])){utils[_0xecab('0x15')](util['format'](_0xecab('0x5a'),_0x451e66[_0xecab('0x7')]),_0x451e66);utils[_0xecab('0x5')](util[_0xecab('0x16')]('[%s][calls][newexten]\x20application:%s\x20appdata:%s',_0x451e66[_0xecab('0x7')],_0x451e66['application'],_0x451e66[_0xecab('0x5b')]));if(_0x451e66[_0xecab('0x5c')]['toLowerCase']()=='set'&&_[_0xecab('0x5d')](_0x451e66[_0xecab('0x5b')][_0xecab('0x5e')](),'cdr')){var _0x5054d0=_0x451e66['appdata'][_0xecab('0x5f')]('=');var _0x267131=_0x5054d0[0x0]['substring'](_0x5054d0[0x0][_0xecab('0x60')]('(')+0x1,_0x5054d0[0x0]['lastIndexOf'](')'));var _0x468912=_0x5054d0[0x1];channels[_0x451e66[_0xecab('0x7')]][_0x267131]=_0x468912;}if(!_[_0xecab('0x61')]([_0xecab('0x2a'),_0xecab('0x62'),'execif',_0xecab('0x63'),_0xecab('0x64')],_0x451e66['application']['toLowerCase']())){channels[_0x451e66[_0xecab('0x7')]][_0xecab('0x51')]=_0x451e66[_0xecab('0x5c')];channels[_0x451e66['uniqueid']]['lastdata']=_0x451e66[_0xecab('0x5b')];}}}catch(_0x15d048){utils['error'](util[_0xecab('0x16')](_0xecab('0x5a'),_0x451e66[_0xecab('0x7')]),_0x15d048);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index d3bf957..5be864c 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 _0xde28=['[core]\x20connected','fullybooted','[core]\x20fullybooted','error','close','[core]\x20close','connect','info'];(function(_0x1d3acb,_0x2cd0a4){var _0x3f88de=function(_0x4ffe9d){while(--_0x4ffe9d){_0x1d3acb['push'](_0x1d3acb['shift']());}};_0x3f88de(++_0x2cd0a4);}(_0xde28,0xae));var _0x8de2=function(_0x43244c,_0xa2a77f){_0x43244c=_0x43244c-0x0;var _0x34babb=_0xde28[_0x43244c];return _0x34babb;};'use strict';var utils=require('./utils');exports[_0x8de2('0x0')]=function(){utils[_0x8de2('0x1')](_0x8de2('0x2'));};exports['shutdown']=function(){utils[_0x8de2('0x1')]('[core]\x20shutdown');};exports[_0x8de2('0x3')]=function(){utils[_0x8de2('0x1')](_0x8de2('0x4'));};exports[_0x8de2('0x5')]=function(_0x3bb0c8){utils['error']('[core]\x20error',_0x3bb0c8);};exports[_0x8de2('0x6')]=function(){utils[_0x8de2('0x1')](_0x8de2('0x7'));};exports['managerevent']=function(_0x3ba61a){}; \ No newline at end of file +var _0xb5cb=['connect','shutdown','info','[core]\x20shutdown','fullybooted','error','[core]\x20error','close','[core]\x20close','managerevent'];(function(_0x50f3e7,_0x139233){var _0x47c04f=function(_0x2d22a3){while(--_0x2d22a3){_0x50f3e7['push'](_0x50f3e7['shift']());}};_0x47c04f(++_0x139233);}(_0xb5cb,0xdc));var _0xbb5c=function(_0x19318d,_0x408a95){_0x19318d=_0x19318d-0x0;var _0x3a505e=_0xb5cb[_0x19318d];return _0x3a505e;};'use strict';var utils=require('./utils');exports[_0xbb5c('0x0')]=function(){utils['info']('[core]\x20connected');};exports[_0xbb5c('0x1')]=function(){utils[_0xbb5c('0x2')](_0xbb5c('0x3'));};exports[_0xbb5c('0x4')]=function(){utils[_0xbb5c('0x2')]('[core]\x20fullybooted');};exports[_0xbb5c('0x5')]=function(_0x5b6100){utils[_0xbb5c('0x5')](_0xbb5c('0x6'),_0x5b6100);};exports[_0xbb5c('0x7')]=function(){utils[_0xbb5c('0x2')](_0xbb5c('0x8'));};exports[_0xbb5c('0x9')]=function(_0x4d857f){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index 1507ff4..5c261a2 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 _0x65dd=['./utils','info','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','dialstring','calleridnum','connectedlinenum','dialstatus','request','CreateVoiceDialReport','uniqueid','newexten','debug','format','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','split','varset','isNil','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','[%s][dials][varset]','dialbegin','[%s][dials][dialbegin]','assign','starttime','now','lastevent','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','error','[%s][dials][dialend]','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','complete','diffTime','endtime','holdtime','billableseconds','util'];(function(_0x304eae,_0x2f8dd3){var _0x4a3753=function(_0x531e78){while(--_0x531e78){_0x304eae['push'](_0x304eae['shift']());}};_0x4a3753(++_0x2f8dd3);}(_0x65dd,0x137));var _0xd65d=function(_0x12b5c8,_0x1b3ad8){_0x12b5c8=_0x12b5c8-0x0;var _0x223a78=_0x65dd[_0x12b5c8];return _0x223a78;};'use strict';var _=require('lodash');var util=require(_0xd65d('0x0'));var utils=require(_0xd65d('0x1'));var dials={};function writeDB(_0x372088){utils[_0xd65d('0x2')](util['format'](_0xd65d('0x3'),_0x372088['uniqueid'],_0x372088['channel'],_0x372088[_0xd65d('0x4')],_0x372088[_0xd65d('0x5')],_0x372088[_0xd65d('0x6')],_0x372088[_0xd65d('0x7')]));utils[_0xd65d('0x8')](_0xd65d('0x9'),_0x372088);delete dials[_0x372088[_0xd65d('0xa')]];}exports[_0xd65d('0xb')]=function(_0x217e9f){try{utils[_0xd65d('0xc')](util[_0xd65d('0xd')](_0xd65d('0xe'),_0x217e9f['uniqueid']),_0x217e9f);utils[_0xd65d('0x2')](util[_0xd65d('0xd')](_0xd65d('0xf'),_0x217e9f[_0xd65d('0xa')],_0x217e9f[_0xd65d('0x10')],_0x217e9f[_0xd65d('0x11')]));if(_0x217e9f[_0xd65d('0x10')][_0xd65d('0x12')]()==_0xd65d('0x13')&&_[_0xd65d('0x14')](_0x217e9f[_0xd65d('0x11')][_0xd65d('0x12')](),'cdr(routeid)')){var _0x2f6e64=_0x217e9f[_0xd65d('0x11')][_0xd65d('0x15')]('=');dials[_0x217e9f[_0xd65d('0xa')]]={'routeId':_0x2f6e64[0x1]};}}catch(_0x518e9e){utils['error'](util[_0xd65d('0xd')](_0xd65d('0xe'),_0x217e9f[_0xd65d('0xa')]),_0x518e9e);}};exports[_0xd65d('0x16')]=function(_0x110a1b){try{utils[_0xd65d('0xc')](util['format']('[%s][dials][varset]',_0x110a1b[_0xd65d('0xa')]),_0x110a1b);if(!_[_0xd65d('0x17')](_0x110a1b[_0xd65d('0x18')][_0xd65d('0x19')])){utils['info'](util[_0xd65d('0xd')](_0xd65d('0x1a'),_0x110a1b[_0xd65d('0xa')],_0x110a1b[_0xd65d('0x1b')]));dials[_0x110a1b[_0xd65d('0xa')]]={'routeId':_0x110a1b['value']};}}catch(_0x44329f){utils['error'](util['format'](_0xd65d('0x1c'),_0x110a1b[_0xd65d('0xa')]),_0x44329f);}};exports[_0xd65d('0x1d')]=function(_0x3101db){try{if(!_['isNil'](dials[_0x3101db['uniqueid']])){utils['debug'](util['format'](_0xd65d('0x1e'),_0x3101db['uniqueid']),_0x3101db);dials[_0x3101db['uniqueid']]=_[_0xd65d('0x1f')](dials[_0x3101db[_0xd65d('0xa')]],_0x3101db);dials[_0x3101db['uniqueid']][_0xd65d('0x20')]=utils[_0xd65d('0x21')]();dials[_0x3101db[_0xd65d('0xa')]][_0xd65d('0x22')]='called';utils[_0xd65d('0x2')](util[_0xd65d('0xd')](_0xd65d('0x23'),_0x3101db['uniqueid'],dials[_0x3101db[_0xd65d('0xa')]][_0xd65d('0x20')]));}}catch(_0x1a9e72){utils[_0xd65d('0x24')](util['format'](_0xd65d('0x1e'),_0x3101db[_0xd65d('0xa')]),_0x1a9e72);}};exports['dialend']=function(_0xe01155){try{if(!_[_0xd65d('0x17')](dials[_0xe01155[_0xd65d('0xa')]])){utils[_0xd65d('0xc')](util[_0xd65d('0xd')](_0xd65d('0x25'),_0xe01155[_0xd65d('0xa')]),_0xe01155);dials[_0xe01155[_0xd65d('0xa')]][_0xd65d('0x7')]=_0xe01155[_0xd65d('0x7')];if(_0xe01155[_0xd65d('0x7')]=='ANSWER'){dials[_0xe01155[_0xd65d('0xa')]]=_[_0xd65d('0x1f')](dials[_0xe01155[_0xd65d('0xa')]],_0xe01155);dials[_0xe01155[_0xd65d('0xa')]][_0xd65d('0x26')]=utils[_0xd65d('0x21')]();dials[_0xe01155['uniqueid']][_0xd65d('0x22')]=_0xd65d('0x27');utils[_0xd65d('0x2')](util[_0xd65d('0xd')](_0xd65d('0x28'),_0xe01155[_0xd65d('0xa')],_0xe01155[_0xd65d('0x7')],dials[_0xe01155[_0xd65d('0xa')]][_0xd65d('0x26')]));}else{utils[_0xd65d('0x2')](util[_0xd65d('0xd')](_0xd65d('0x29'),_0xe01155[_0xd65d('0xa')],_0xe01155[_0xd65d('0x7')]));}}}catch(_0x983f58){utils[_0xd65d('0x24')](util[_0xd65d('0xd')](_0xd65d('0x25'),_0xe01155[_0xd65d('0xa')]),_0x983f58);}};exports[_0xd65d('0x2a')]=function(_0x7d32a0){try{if(!_['isNil'](dials[_0x7d32a0[_0xd65d('0xa')]])){utils[_0xd65d('0xc')](util[_0xd65d('0xd')](_0xd65d('0x2b'),_0x7d32a0[_0xd65d('0xa')]),_0x7d32a0);utils[_0xd65d('0x2')](util['format'](_0xd65d('0x2c'),_0x7d32a0[_0xd65d('0xa')],_0x7d32a0[_0xd65d('0x5')],_0x7d32a0[_0xd65d('0x2d')],_0x7d32a0[_0xd65d('0x2e')]));dials[_0x7d32a0['uniqueid']]=_['assign'](dials[_0x7d32a0[_0xd65d('0xa')]],{'endtime':utils[_0xd65d('0x21')](),'lastevent':_0xd65d('0x2f')});dials[_0x7d32a0[_0xd65d('0xa')]]['duration']=utils[_0xd65d('0x30')](dials[_0x7d32a0[_0xd65d('0xa')]][_0xd65d('0x31')],dials[_0x7d32a0[_0xd65d('0xa')]][_0xd65d('0x20')]);dials[_0x7d32a0[_0xd65d('0xa')]][_0xd65d('0x32')]=utils['diffTime'](dials[_0x7d32a0['uniqueid']][_0xd65d('0x26')]||dials[_0x7d32a0['uniqueid']]['endtime'],dials[_0x7d32a0['uniqueid']]['starttime']);dials[_0x7d32a0['uniqueid']][_0xd65d('0x33')]=dials[_0x7d32a0[_0xd65d('0xa')]][_0xd65d('0x26')]?utils[_0xd65d('0x30')](dials[_0x7d32a0[_0xd65d('0xa')]][_0xd65d('0x31')],dials[_0x7d32a0[_0xd65d('0xa')]]['answertime']):0x0;writeDB(dials[_0x7d32a0[_0xd65d('0xa')]]);}}catch(_0x961fc4){utils['error'](util[_0xd65d('0xd')]('[%s][dials][hangup]',_0x7d32a0[_0xd65d('0xa')]),_0x961fc4);}}; \ No newline at end of file +var _0x9553=['[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','cause-txt','complete','duration','holdtime','diffTime','endtime','billableseconds','lodash','util','format','channel','dialstring','calleridnum','connectedlinenum','dialstatus','request','CreateVoiceDialReport','uniqueid','newexten','debug','[%s][dials][newexten]','info','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','varset','[%s][dials][varset]','isNil','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','error','dialbegin','[%s][dials][dialbegin]','assign','starttime','now','called','dialend','[%s][dials][dialend]','ANSWER','answertime','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','hangup'];(function(_0x3cdd0b,_0x544bb7){var _0x497153=function(_0x3b26ea){while(--_0x3b26ea){_0x3cdd0b['push'](_0x3cdd0b['shift']());}};_0x497153(++_0x544bb7);}(_0x9553,0x16f));var _0x3955=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x9553[_0x53ccf2];return _0x5a2964;};'use strict';var _=require(_0x3955('0x0'));var util=require(_0x3955('0x1'));var utils=require('./utils');var dials={};function writeDB(_0x448e7f){utils['info'](util[_0x3955('0x2')]('[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s',_0x448e7f['uniqueid'],_0x448e7f[_0x3955('0x3')],_0x448e7f[_0x3955('0x4')],_0x448e7f[_0x3955('0x5')],_0x448e7f[_0x3955('0x6')],_0x448e7f[_0x3955('0x7')]));utils[_0x3955('0x8')](_0x3955('0x9'),_0x448e7f);delete dials[_0x448e7f[_0x3955('0xa')]];}exports[_0x3955('0xb')]=function(_0x3bdba6){try{utils[_0x3955('0xc')](util[_0x3955('0x2')](_0x3955('0xd'),_0x3bdba6[_0x3955('0xa')]),_0x3bdba6);utils[_0x3955('0xe')](util['format'](_0x3955('0xf'),_0x3bdba6[_0x3955('0xa')],_0x3bdba6[_0x3955('0x10')],_0x3bdba6[_0x3955('0x11')]));if(_0x3bdba6[_0x3955('0x10')][_0x3955('0x12')]()==_0x3955('0x13')&&_[_0x3955('0x14')](_0x3bdba6[_0x3955('0x11')][_0x3955('0x12')](),'cdr(routeid)')){var _0x47ebe4=_0x3bdba6[_0x3955('0x11')]['split']('=');dials[_0x3bdba6[_0x3955('0xa')]]={'routeId':_0x47ebe4[0x1]};}}catch(_0x1d703c){utils['error'](util[_0x3955('0x2')]('[%s][dials][newexten]',_0x3bdba6[_0x3955('0xa')]),_0x1d703c);}};exports[_0x3955('0x15')]=function(_0x79518a){try{utils[_0x3955('0xc')](util[_0x3955('0x2')](_0x3955('0x16'),_0x79518a[_0x3955('0xa')]),_0x79518a);if(!_[_0x3955('0x17')](_0x79518a[_0x3955('0x18')][_0x3955('0x19')])){utils[_0x3955('0xe')](util['format'](_0x3955('0x1a'),_0x79518a[_0x3955('0xa')],_0x79518a[_0x3955('0x1b')]));dials[_0x79518a[_0x3955('0xa')]]={'routeId':_0x79518a['value']};}}catch(_0x30fb34){utils[_0x3955('0x1c')](util[_0x3955('0x2')]('[%s][dials][varset]',_0x79518a[_0x3955('0xa')]),_0x30fb34);}};exports[_0x3955('0x1d')]=function(_0x51f584){try{if(!_[_0x3955('0x17')](dials[_0x51f584['uniqueid']])){utils[_0x3955('0xc')](util[_0x3955('0x2')](_0x3955('0x1e'),_0x51f584['uniqueid']),_0x51f584);dials[_0x51f584[_0x3955('0xa')]]=_[_0x3955('0x1f')](dials[_0x51f584['uniqueid']],_0x51f584);dials[_0x51f584[_0x3955('0xa')]][_0x3955('0x20')]=utils[_0x3955('0x21')]();dials[_0x51f584[_0x3955('0xa')]]['lastevent']=_0x3955('0x22');utils['info'](util[_0x3955('0x2')]('[%s][dials][hangup]\x20starttime:%s\x20lastevent:called',_0x51f584[_0x3955('0xa')],dials[_0x51f584[_0x3955('0xa')]]['starttime']));}}catch(_0x217c67){utils[_0x3955('0x1c')](util[_0x3955('0x2')](_0x3955('0x1e'),_0x51f584['uniqueid']),_0x217c67);}};exports[_0x3955('0x23')]=function(_0x33bc06){try{if(!_['isNil'](dials[_0x33bc06[_0x3955('0xa')]])){utils[_0x3955('0xc')](util[_0x3955('0x2')](_0x3955('0x24'),_0x33bc06[_0x3955('0xa')]),_0x33bc06);dials[_0x33bc06[_0x3955('0xa')]]['dialstatus']=_0x33bc06[_0x3955('0x7')];if(_0x33bc06['dialstatus']==_0x3955('0x25')){dials[_0x33bc06[_0x3955('0xa')]]=_['assign'](dials[_0x33bc06[_0x3955('0xa')]],_0x33bc06);dials[_0x33bc06[_0x3955('0xa')]][_0x3955('0x26')]=utils[_0x3955('0x21')]();dials[_0x33bc06[_0x3955('0xa')]]['lastevent']='connect';utils[_0x3955('0xe')](util[_0x3955('0x2')](_0x3955('0x27'),_0x33bc06[_0x3955('0xa')],_0x33bc06[_0x3955('0x7')],dials[_0x33bc06[_0x3955('0xa')]][_0x3955('0x26')]));}else{utils[_0x3955('0xe')](util[_0x3955('0x2')]('[%s][dials][dialend]\x20dialstatus:%s',_0x33bc06['uniqueid'],_0x33bc06[_0x3955('0x7')]));}}}catch(_0x339be1){utils['error'](util['format'](_0x3955('0x24'),_0x33bc06[_0x3955('0xa')]),_0x339be1);}};exports[_0x3955('0x28')]=function(_0xe0498e){try{if(!_[_0x3955('0x17')](dials[_0xe0498e[_0x3955('0xa')]])){utils['debug'](util[_0x3955('0x2')](_0x3955('0x29'),_0xe0498e[_0x3955('0xa')]),_0xe0498e);utils[_0x3955('0xe')](util[_0x3955('0x2')](_0x3955('0x2a'),_0xe0498e[_0x3955('0xa')],_0xe0498e[_0x3955('0x5')],_0xe0498e[_0x3955('0x2b')],_0xe0498e[_0x3955('0x2c')]));dials[_0xe0498e[_0x3955('0xa')]]=_[_0x3955('0x1f')](dials[_0xe0498e[_0x3955('0xa')]],{'endtime':utils[_0x3955('0x21')](),'lastevent':_0x3955('0x2d')});dials[_0xe0498e[_0x3955('0xa')]][_0x3955('0x2e')]=utils['diffTime'](dials[_0xe0498e['uniqueid']]['endtime'],dials[_0xe0498e[_0x3955('0xa')]][_0x3955('0x20')]);dials[_0xe0498e[_0x3955('0xa')]][_0x3955('0x2f')]=utils[_0x3955('0x30')](dials[_0xe0498e[_0x3955('0xa')]]['answertime']||dials[_0xe0498e[_0x3955('0xa')]][_0x3955('0x31')],dials[_0xe0498e['uniqueid']][_0x3955('0x20')]);dials[_0xe0498e[_0x3955('0xa')]][_0x3955('0x32')]=dials[_0xe0498e[_0x3955('0xa')]][_0x3955('0x26')]?utils[_0x3955('0x30')](dials[_0xe0498e[_0x3955('0xa')]][_0x3955('0x31')],dials[_0xe0498e[_0x3955('0xa')]]['answertime']):0x0;writeDB(dials[_0xe0498e[_0x3955('0xa')]]);}}catch(_0x236435){utils[_0x3955('0x1c')](util['format'](_0x3955('0x29'),_0xe0498e[_0x3955('0xa')]),_0x236435);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 972d1a0..3c383e2 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 _0xb81d=['managerevent','devicestatechange','debug','format','[%s][index][devicestatechange]','device','error','[%s][index][agentcalled]','uniqueid','agentcalled','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','[%s][index][queuecallerabandon]','queuecallerabandon','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','[%s][index][blindtransfer]','blindtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','attendedtransfer','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','dialbegin','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','./utils','util','xdr','disabled','env','production','asterisk','password','keepConnected','info','XDR\x20DISABLED','./agents.controller','./calls.controller','./recordings.controller','./members.controller','./dials.controller','./core.controller','connect','shutdown','fullybooted','close'];(function(_0x18546c,_0x4daf94){var _0x46ef43=function(_0x559377){while(--_0x559377){_0x18546c['push'](_0x18546c['shift']());}};_0x46ef43(++_0x4daf94);}(_0xb81d,0x1d3));var _0xdb81=function(_0x37bc7c,_0x2cae93){_0x37bc7c=_0x37bc7c-0x0;var _0x4bef12=_0xb81d[_0x37bc7c];return _0x4bef12;};var AsteriskManager=require(_0xdb81('0x0'));var config=require(_0xdb81('0x1'));var utils=require(_0xdb81('0x2'));var util=require(_0xdb81('0x3'));var isXDREnabled=config[_0xdb81('0x4')]&&config['xdr'][_0xdb81('0x5')]?!config[_0xdb81('0x4')][_0xdb81('0x5')]:!![];var isProduction=config[_0xdb81('0x6')]===_0xdb81('0x7')||![];var isLocalAsterisk=config[_0xdb81('0x4')]&&config[_0xdb81('0x4')]['local']===!![]||![];var ami=new AsteriskManager(config['asterisk']['port'],config[_0xdb81('0x8')]['ip'],config[_0xdb81('0x8')]['username'],config[_0xdb81('0x8')][_0xdb81('0x9')],!![]);ami[_0xdb81('0xa')]();if(!isXDREnabled){utils[_0xdb81('0xb')](_0xdb81('0xc'));}else if(!isProduction&&!isLocalAsterisk){utils['info']('Asterisk\x20disabled\x20on\x20localhost');}else{var agents=require(_0xdb81('0xd'));var calls=require(_0xdb81('0xe'));var queues=require('./queues.controller');var recordings=require(_0xdb81('0xf'));var members=require(_0xdb81('0x10'));var dials=require(_0xdb81('0x11'));var transfers=require('./transfers.controller');var core=require(_0xdb81('0x12'));ami['on'](_0xdb81('0x13'),core[_0xdb81('0x13')]);ami['on'](_0xdb81('0x14'),core[_0xdb81('0x14')]);ami['on'](_0xdb81('0x15'),core[_0xdb81('0x15')]);ami['on']('error',core['error']);ami['on'](_0xdb81('0x16'),core[_0xdb81('0x16')]);ami['on'](_0xdb81('0x17'),core[_0xdb81('0x17')]);ami['on'](_0xdb81('0x18'),function(_0x16b659){try{utils[_0xdb81('0x19')](util[_0xdb81('0x1a')](_0xdb81('0x1b'),_0x16b659[_0xdb81('0x1c')]),_0x16b659);members[_0xdb81('0x18')](_0x16b659);}catch(_0x4c4753){utils[_0xdb81('0x1d')](util[_0xdb81('0x1a')](_0xdb81('0x1b'),_0x16b659[_0xdb81('0x1c')]),_0x4c4753);}});ami['on']('agentcalled',function(_0x5703bc){try{utils[_0xdb81('0x19')](util[_0xdb81('0x1a')](_0xdb81('0x1e'),_0x5703bc[_0xdb81('0x1f')]),_0x5703bc);agents[_0xdb81('0x20')](_0x5703bc);}catch(_0x3cf1e8){utils[_0xdb81('0x1d')](util[_0xdb81('0x1a')]('[%s][index][agentcalled]',_0x5703bc['uniqueid']),_0x3cf1e8);}});ami['on'](_0xdb81('0x21'),function(_0xb66739){try{utils[_0xdb81('0x19')](util['format'](_0xdb81('0x22'),_0xb66739['uniqueid']),_0xb66739);agents['agentringnoanswer'](_0xb66739);}catch(_0x131fe0){utils[_0xdb81('0x1d')](util[_0xdb81('0x1a')]('[%s][index][agentringnoanswer]',_0xb66739['uniqueid']),_0x131fe0);}});ami['on'](_0xdb81('0x23'),function(_0x1b0d9b){try{utils[_0xdb81('0x19')](util['format']('[%s][index][agentconnect]',_0x1b0d9b['uniqueid']),_0x1b0d9b);agents['agentconnect'](_0x1b0d9b);queues[_0xdb81('0x23')](_0x1b0d9b);}catch(_0x5e62ca){utils[_0xdb81('0x1d')](util[_0xdb81('0x1a')](_0xdb81('0x24'),_0x1b0d9b[_0xdb81('0x1f')]),_0x5e62ca);}});ami['on']('agentcomplete',function(_0x31b3d5){try{utils[_0xdb81('0x19')](util[_0xdb81('0x1a')]('[%s][index][agentcomplete]',_0x31b3d5[_0xdb81('0x1f')]),_0x31b3d5);agents[_0xdb81('0x25')](_0x31b3d5);queues[_0xdb81('0x25')](_0x31b3d5);members['agentcomplete'](_0x31b3d5);}catch(_0x360ec4){utils[_0xdb81('0x1d')](util[_0xdb81('0x1a')](_0xdb81('0x26'),_0x31b3d5[_0xdb81('0x1f')]),_0x360ec4);}});ami['on']('queuecallerabandon',function(_0x2f099a){try{utils[_0xdb81('0x19')](util[_0xdb81('0x1a')](_0xdb81('0x27'),_0x2f099a[_0xdb81('0x1f')]),_0x2f099a);agents[_0xdb81('0x28')](_0x2f099a);queues[_0xdb81('0x28')](_0x2f099a);}catch(_0x3ef272){utils['error'](util[_0xdb81('0x1a')](_0xdb81('0x27'),_0x2f099a['uniqueid']),_0x3ef272);}});ami['on'](_0xdb81('0x29'),function(_0x5166b5){try{utils[_0xdb81('0x19')](util[_0xdb81('0x1a')](_0xdb81('0x2a'),_0x5166b5[_0xdb81('0x1f')]),_0x5166b5);queues[_0xdb81('0x29')](_0x5166b5);recordings['queuecallerjoin'](_0x5166b5);}catch(_0x126c1b){utils[_0xdb81('0x1d')](util[_0xdb81('0x1a')](_0xdb81('0x2a'),_0x5166b5[_0xdb81('0x1f')]),_0x126c1b);}});ami['on'](_0xdb81('0x2b'),function(_0x5d39ec){try{utils['debug'](util['format'](_0xdb81('0x2c'),_0x5d39ec['uniqueid']),_0x5d39ec);queues['queuecallerleave'](_0x5d39ec);}catch(_0x1b1a93){utils[_0xdb81('0x1d')](util[_0xdb81('0x1a')](_0xdb81('0x2c'),_0x5d39ec['uniqueid']),_0x1b1a93);}});ami['on'](_0xdb81('0x2d'),function(_0x3cc54c){try{utils[_0xdb81('0x19')](util[_0xdb81('0x1a')](_0xdb81('0x2e'),_0x3cc54c[_0xdb81('0x1f')]),_0x3cc54c);queues[_0xdb81('0x2d')](_0x3cc54c);calls[_0xdb81('0x2d')](_0x3cc54c);}catch(_0x3c332e){utils[_0xdb81('0x1d')](util[_0xdb81('0x1a')](_0xdb81('0x2e'),_0x3cc54c[_0xdb81('0x1f')]),_0x3c332e);}});ami['on'](_0xdb81('0x2f'),function(_0x215ef9){try{utils['debug'](util[_0xdb81('0x1a')](_0xdb81('0x30'),_0x215ef9[_0xdb81('0x1f')]),_0x215ef9);queues[_0xdb81('0x2f')](_0x215ef9);calls[_0xdb81('0x2f')](_0x215ef9);}catch(_0x3aeb6c){utils[_0xdb81('0x1d')](util['format'](_0xdb81('0x30'),_0x215ef9['uniqueid']),_0x3aeb6c);}});ami['on'](_0xdb81('0x31'),function(_0x3a93a9){try{utils['debug'](util[_0xdb81('0x1a')]('[%s][index][newstate]',_0x3a93a9[_0xdb81('0x1f')]),_0x3a93a9);calls[_0xdb81('0x31')](_0x3a93a9);recordings[_0xdb81('0x31')](_0x3a93a9);}catch(_0xf635e){utils['error'](util['format'](_0xdb81('0x32'),_0x3a93a9[_0xdb81('0x1f')]),_0xf635e);}});ami['on'](_0xdb81('0x33'),function(_0x20f7af){try{utils[_0xdb81('0x19')](util['format'](_0xdb81('0x34'),_0x20f7af[_0xdb81('0x1f')]),_0x20f7af);calls[_0xdb81('0x33')](_0x20f7af);recordings[_0xdb81('0x33')](_0x20f7af);dials['hangup'](_0x20f7af);agents[_0xdb81('0x33')](_0x20f7af);queues['hangup'](_0x20f7af);}catch(_0x205b52){utils[_0xdb81('0x1d')](util[_0xdb81('0x1a')](_0xdb81('0x34'),_0x20f7af[_0xdb81('0x1f')]),_0x205b52);}});ami['on'](_0xdb81('0x35'),function(_0x338f70){try{utils[_0xdb81('0x19')](util[_0xdb81('0x1a')](_0xdb81('0x36'),_0x338f70[_0xdb81('0x1f')]),_0x338f70);members[_0xdb81('0x35')](_0x338f70);}catch(_0x4aa17b){utils[_0xdb81('0x1d')](util['format'](_0xdb81('0x36'),_0x338f70[_0xdb81('0x1f')]),_0x4aa17b);}});ami['on']('blindtransfer',function(_0x28aca3){try{utils[_0xdb81('0x19')](util[_0xdb81('0x1a')](_0xdb81('0x37'),_0x28aca3[_0xdb81('0x1f')]),_0x28aca3);queues[_0xdb81('0x38')](_0x28aca3);agents[_0xdb81('0x38')](_0x28aca3);transfers[_0xdb81('0x38')](_0x28aca3);}catch(_0x4b4306){utils[_0xdb81('0x1d')](util[_0xdb81('0x1a')](_0xdb81('0x37'),_0x28aca3['uniqueid']),_0x4b4306);}});ami['on']('attendedtransfer',function(_0x42035a){try{utils[_0xdb81('0x19')](util[_0xdb81('0x1a')](_0xdb81('0x39'),_0x42035a[_0xdb81('0x3a')]),_0x42035a);queues[_0xdb81('0x3b')](_0x42035a);transfers[_0xdb81('0x3b')](_0x42035a);agents[_0xdb81('0x3b')](_0x42035a);calls[_0xdb81('0x3b')](_0x42035a);}catch(_0x5c077d){utils[_0xdb81('0x1d')](util['format']('[%s][index][attendedtransfer]',_0x42035a[_0xdb81('0x3a')]),_0x5c077d);}});ami['on'](_0xdb81('0x3c'),function(_0x24754c){try{utils[_0xdb81('0x19')](util[_0xdb81('0x1a')](_0xdb81('0x3d'),_0x24754c['uniqueid']),_0x24754c);queues[_0xdb81('0x3c')](_0x24754c);recordings[_0xdb81('0x3c')](_0x24754c);calls[_0xdb81('0x3c')](_0x24754c);dials[_0xdb81('0x3c')](_0x24754c);}catch(_0x32ddcc){utils['error'](util[_0xdb81('0x1a')](_0xdb81('0x3d'),_0x24754c[_0xdb81('0x1f')]),_0x32ddcc);}});ami['on'](_0xdb81('0x3e'),function(_0x5a48eb){try{utils[_0xdb81('0x19')](util['format']('[%s][index][newexten]',_0x5a48eb[_0xdb81('0x1f')]),_0x5a48eb);calls[_0xdb81('0x3e')](_0x5a48eb);recordings['newexten'](_0x5a48eb);dials['newexten'](_0x5a48eb);}catch(_0x590f06){utils[_0xdb81('0x1d')](util[_0xdb81('0x1a')](_0xdb81('0x3f'),_0x5a48eb['uniqueid']),_0x590f06);}});ami['on'](_0xdb81('0x40'),function(_0x2a2d74){try{utils[_0xdb81('0x19')](util[_0xdb81('0x1a')]('[%s][index][newchannel]',_0x2a2d74[_0xdb81('0x1f')]),_0x2a2d74);calls[_0xdb81('0x40')](_0x2a2d74);recordings['newchannel'](_0x2a2d74);}catch(_0x27d7c6){utils[_0xdb81('0x1d')](util[_0xdb81('0x1a')](_0xdb81('0x41'),_0x2a2d74[_0xdb81('0x1f')]),_0x27d7c6);}});ami['on']('dialbegin',function(_0x3a3ece){try{utils[_0xdb81('0x19')](util[_0xdb81('0x1a')]('[%s][index][dialbegin]',_0x3a3ece[_0xdb81('0x1f')]),_0x3a3ece);dials[_0xdb81('0x42')](_0x3a3ece);}catch(_0x1e4fe7){utils['error'](util[_0xdb81('0x1a')](_0xdb81('0x43'),_0x3a3ece[_0xdb81('0x1f')]),_0x1e4fe7);}});ami['on'](_0xdb81('0x44'),function(_0x5aa20c){try{utils[_0xdb81('0x19')](util['format'](_0xdb81('0x45'),_0x5aa20c['uniqueid']),_0x5aa20c);dials[_0xdb81('0x44')](_0x5aa20c);}catch(_0x4696a1){utils[_0xdb81('0x1d')](util[_0xdb81('0x1a')](_0xdb81('0x45'),_0x5aa20c[_0xdb81('0x1f')]),_0x4696a1);}});} \ No newline at end of file +var _0xbecd=['queuecallerleave','[%s][index][musiconholdstart]','musiconholdstart','[%s][index][musiconholdstop]','musiconholdstop','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','origtransfereruniqueid','attendedtransfer','varset','[%s][index][newexten]','newexten','newchannel','[%s][index][newchannel]','[%s][index][dialbegin]','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','./utils','util','xdr','disabled','env','production','local','asterisk','port','username','password','keepConnected','info','XDR\x20DISABLED','Asterisk\x20disabled\x20on\x20localhost','./calls.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','connect','shutdown','fullybooted','error','close','managerevent','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]','[%s][index][queuecallerjoin]','queuecallerjoin'];(function(_0xa9eda4,_0x3fde0d){var _0x30fe3b=function(_0x244854){while(--_0x244854){_0xa9eda4['push'](_0xa9eda4['shift']());}};_0x30fe3b(++_0x3fde0d);}(_0xbecd,0xa2));var _0xdbec=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xbecd[_0x321bb2];return _0x9c12ed;};var AsteriskManager=require(_0xdbec('0x0'));var config=require(_0xdbec('0x1'));var utils=require(_0xdbec('0x2'));var util=require(_0xdbec('0x3'));var isXDREnabled=config[_0xdbec('0x4')]&&config[_0xdbec('0x4')][_0xdbec('0x5')]?!config[_0xdbec('0x4')][_0xdbec('0x5')]:!![];var isProduction=config[_0xdbec('0x6')]===_0xdbec('0x7')||![];var isLocalAsterisk=config[_0xdbec('0x4')]&&config[_0xdbec('0x4')][_0xdbec('0x8')]===!![]||![];var ami=new AsteriskManager(config[_0xdbec('0x9')][_0xdbec('0xa')],config[_0xdbec('0x9')]['ip'],config[_0xdbec('0x9')][_0xdbec('0xb')],config[_0xdbec('0x9')][_0xdbec('0xc')],!![]);ami[_0xdbec('0xd')]();if(!isXDREnabled){utils[_0xdbec('0xe')](_0xdbec('0xf'));}else if(!isProduction&&!isLocalAsterisk){utils['info'](_0xdbec('0x10'));}else{var agents=require('./agents.controller');var calls=require(_0xdbec('0x11'));var queues=require('./queues.controller');var recordings=require(_0xdbec('0x12'));var members=require(_0xdbec('0x13'));var dials=require(_0xdbec('0x14'));var transfers=require(_0xdbec('0x15'));var core=require('./core.controller');ami['on'](_0xdbec('0x16'),core[_0xdbec('0x16')]);ami['on']('shutdown',core[_0xdbec('0x17')]);ami['on']('fullybooted',core[_0xdbec('0x18')]);ami['on']('error',core[_0xdbec('0x19')]);ami['on'](_0xdbec('0x1a'),core[_0xdbec('0x1a')]);ami['on'](_0xdbec('0x1b'),core['managerevent']);ami['on']('devicestatechange',function(_0x564029){try{utils[_0xdbec('0x1c')](util[_0xdbec('0x1d')](_0xdbec('0x1e'),_0x564029['device']),_0x564029);members['devicestatechange'](_0x564029);}catch(_0x4c43f5){utils[_0xdbec('0x19')](util['format'](_0xdbec('0x1e'),_0x564029[_0xdbec('0x1f')]),_0x4c43f5);}});ami['on'](_0xdbec('0x20'),function(_0x31a98e){try{utils[_0xdbec('0x1c')](util[_0xdbec('0x1d')](_0xdbec('0x21'),_0x31a98e['uniqueid']),_0x31a98e);agents[_0xdbec('0x20')](_0x31a98e);}catch(_0x33a73f){utils[_0xdbec('0x19')](util['format']('[%s][index][agentcalled]',_0x31a98e[_0xdbec('0x22')]),_0x33a73f);}});ami['on'](_0xdbec('0x23'),function(_0x1200a4){try{utils[_0xdbec('0x1c')](util[_0xdbec('0x1d')]('[%s][index][agentringnoanswer]',_0x1200a4[_0xdbec('0x22')]),_0x1200a4);agents[_0xdbec('0x23')](_0x1200a4);}catch(_0x436307){utils[_0xdbec('0x19')](util['format'](_0xdbec('0x24'),_0x1200a4['uniqueid']),_0x436307);}});ami['on'](_0xdbec('0x25'),function(_0x4ad8f3){try{utils[_0xdbec('0x1c')](util['format']('[%s][index][agentconnect]',_0x4ad8f3['uniqueid']),_0x4ad8f3);agents[_0xdbec('0x25')](_0x4ad8f3);queues[_0xdbec('0x25')](_0x4ad8f3);}catch(_0x158fec){utils[_0xdbec('0x19')](util[_0xdbec('0x1d')](_0xdbec('0x26'),_0x4ad8f3[_0xdbec('0x22')]),_0x158fec);}});ami['on'](_0xdbec('0x27'),function(_0x3958c6){try{utils[_0xdbec('0x1c')](util[_0xdbec('0x1d')](_0xdbec('0x28'),_0x3958c6[_0xdbec('0x22')]),_0x3958c6);agents[_0xdbec('0x27')](_0x3958c6);queues[_0xdbec('0x27')](_0x3958c6);members[_0xdbec('0x27')](_0x3958c6);}catch(_0xb22613){utils[_0xdbec('0x19')](util[_0xdbec('0x1d')](_0xdbec('0x28'),_0x3958c6[_0xdbec('0x22')]),_0xb22613);}});ami['on'](_0xdbec('0x29'),function(_0x1fd539){try{utils[_0xdbec('0x1c')](util[_0xdbec('0x1d')](_0xdbec('0x2a'),_0x1fd539['uniqueid']),_0x1fd539);agents[_0xdbec('0x29')](_0x1fd539);queues[_0xdbec('0x29')](_0x1fd539);}catch(_0x2a75f1){utils['error'](util[_0xdbec('0x1d')](_0xdbec('0x2a'),_0x1fd539[_0xdbec('0x22')]),_0x2a75f1);}});ami['on']('queuecallerjoin',function(_0x108106){try{utils['debug'](util[_0xdbec('0x1d')](_0xdbec('0x2b'),_0x108106['uniqueid']),_0x108106);queues[_0xdbec('0x2c')](_0x108106);recordings[_0xdbec('0x2c')](_0x108106);}catch(_0x42beca){utils[_0xdbec('0x19')](util['format'](_0xdbec('0x2b'),_0x108106['uniqueid']),_0x42beca);}});ami['on']('queuecallerleave',function(_0x1f4e88){try{utils[_0xdbec('0x1c')](util[_0xdbec('0x1d')]('[%s][index][queuecallerleave]',_0x1f4e88[_0xdbec('0x22')]),_0x1f4e88);queues[_0xdbec('0x2d')](_0x1f4e88);}catch(_0x66936a){utils['error'](util[_0xdbec('0x1d')]('[%s][index][queuecallerleave]',_0x1f4e88[_0xdbec('0x22')]),_0x66936a);}});ami['on']('musiconholdstart',function(_0x46e795){try{utils[_0xdbec('0x1c')](util[_0xdbec('0x1d')](_0xdbec('0x2e'),_0x46e795[_0xdbec('0x22')]),_0x46e795);queues[_0xdbec('0x2f')](_0x46e795);calls[_0xdbec('0x2f')](_0x46e795);}catch(_0x235ad3){utils[_0xdbec('0x19')](util['format'](_0xdbec('0x2e'),_0x46e795[_0xdbec('0x22')]),_0x235ad3);}});ami['on']('musiconholdstop',function(_0x3bf59f){try{utils['debug'](util[_0xdbec('0x1d')](_0xdbec('0x30'),_0x3bf59f[_0xdbec('0x22')]),_0x3bf59f);queues['musiconholdstop'](_0x3bf59f);calls[_0xdbec('0x31')](_0x3bf59f);}catch(_0x2f419b){utils['error'](util['format'](_0xdbec('0x30'),_0x3bf59f[_0xdbec('0x22')]),_0x2f419b);}});ami['on'](_0xdbec('0x32'),function(_0x7a1eab){try{utils[_0xdbec('0x1c')](util[_0xdbec('0x1d')](_0xdbec('0x33'),_0x7a1eab[_0xdbec('0x22')]),_0x7a1eab);calls[_0xdbec('0x32')](_0x7a1eab);recordings[_0xdbec('0x32')](_0x7a1eab);}catch(_0x1cbc47){utils['error'](util[_0xdbec('0x1d')]('[%s][index][newstate]',_0x7a1eab[_0xdbec('0x22')]),_0x1cbc47);}});ami['on'](_0xdbec('0x34'),function(_0x31e31f){try{utils[_0xdbec('0x1c')](util[_0xdbec('0x1d')](_0xdbec('0x35'),_0x31e31f[_0xdbec('0x22')]),_0x31e31f);calls[_0xdbec('0x34')](_0x31e31f);recordings[_0xdbec('0x34')](_0x31e31f);dials['hangup'](_0x31e31f);agents[_0xdbec('0x34')](_0x31e31f);queues[_0xdbec('0x34')](_0x31e31f);}catch(_0x17ae09){utils[_0xdbec('0x19')](util[_0xdbec('0x1d')](_0xdbec('0x35'),_0x31e31f[_0xdbec('0x22')]),_0x17ae09);}});ami['on'](_0xdbec('0x36'),function(_0x2a1820){try{utils[_0xdbec('0x1c')](util[_0xdbec('0x1d')](_0xdbec('0x37'),_0x2a1820['uniqueid']),_0x2a1820);members['cdr'](_0x2a1820);}catch(_0x2bf7c2){utils[_0xdbec('0x19')](util[_0xdbec('0x1d')](_0xdbec('0x37'),_0x2a1820['uniqueid']),_0x2bf7c2);}});ami['on'](_0xdbec('0x38'),function(_0x72f180){try{utils[_0xdbec('0x1c')](util[_0xdbec('0x1d')](_0xdbec('0x39'),_0x72f180['uniqueid']),_0x72f180);queues['blindtransfer'](_0x72f180);agents[_0xdbec('0x38')](_0x72f180);transfers[_0xdbec('0x38')](_0x72f180);}catch(_0x1cd033){utils[_0xdbec('0x19')](util['format'](_0xdbec('0x39'),_0x72f180[_0xdbec('0x22')]),_0x1cd033);}});ami['on']('attendedtransfer',function(_0x26b5be){try{utils['debug'](util[_0xdbec('0x1d')]('[%s][index][attendedtransfer]',_0x26b5be[_0xdbec('0x3a')]),_0x26b5be);queues[_0xdbec('0x3b')](_0x26b5be);transfers['attendedtransfer'](_0x26b5be);agents[_0xdbec('0x3b')](_0x26b5be);calls[_0xdbec('0x3b')](_0x26b5be);}catch(_0x1f9993){utils[_0xdbec('0x19')](util['format']('[%s][index][attendedtransfer]',_0x26b5be[_0xdbec('0x3a')]),_0x1f9993);}});ami['on'](_0xdbec('0x3c'),function(_0x3ed882){try{utils['debug'](util[_0xdbec('0x1d')]('[%s][index][varset]',_0x3ed882['uniqueid']),_0x3ed882);queues[_0xdbec('0x3c')](_0x3ed882);recordings[_0xdbec('0x3c')](_0x3ed882);calls[_0xdbec('0x3c')](_0x3ed882);dials['varset'](_0x3ed882);}catch(_0x53cfab){utils[_0xdbec('0x19')](util[_0xdbec('0x1d')]('[%s][index][varset]',_0x3ed882[_0xdbec('0x22')]),_0x53cfab);}});ami['on']('newexten',function(_0x5b0f07){try{utils[_0xdbec('0x1c')](util[_0xdbec('0x1d')](_0xdbec('0x3d'),_0x5b0f07[_0xdbec('0x22')]),_0x5b0f07);calls[_0xdbec('0x3e')](_0x5b0f07);recordings['newexten'](_0x5b0f07);dials[_0xdbec('0x3e')](_0x5b0f07);}catch(_0x5f13e1){utils['error'](util['format'](_0xdbec('0x3d'),_0x5b0f07[_0xdbec('0x22')]),_0x5f13e1);}});ami['on'](_0xdbec('0x3f'),function(_0x124d9d){try{utils[_0xdbec('0x1c')](util[_0xdbec('0x1d')](_0xdbec('0x40'),_0x124d9d[_0xdbec('0x22')]),_0x124d9d);calls['newchannel'](_0x124d9d);recordings[_0xdbec('0x3f')](_0x124d9d);}catch(_0x1ca73c){utils[_0xdbec('0x19')](util[_0xdbec('0x1d')](_0xdbec('0x40'),_0x124d9d[_0xdbec('0x22')]),_0x1ca73c);}});ami['on']('dialbegin',function(_0x392197){try{utils[_0xdbec('0x1c')](util['format'](_0xdbec('0x41'),_0x392197[_0xdbec('0x22')]),_0x392197);dials['dialbegin'](_0x392197);}catch(_0x154876){utils['error'](util[_0xdbec('0x1d')](_0xdbec('0x42'),_0x392197[_0xdbec('0x22')]),_0x154876);}});ami['on']('dialend',function(_0x3f1520){try{utils['debug'](util[_0xdbec('0x1d')]('[%s][index][dialend]',_0x3f1520[_0xdbec('0x22')]),_0x3f1520);dials[_0xdbec('0x43')](_0x3f1520);}catch(_0x317d02){utils[_0xdbec('0x19')](util[_0xdbec('0x1d')](_0xdbec('0x44'),_0x3f1520[_0xdbec('0x22')]),_0x317d02);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index eb75ff8..de8dda5 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 _0x2c64=['[%s][members][writeDB]','startsWith','devicestatechange','debug','format','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','TALKING','agent','NOT_INUSE','exitAt','now','duration','diffTime','enterAt','agentcomplete','isNil','[%s][members][agentcomplete]','queue','assign','cdr','[%s][members][cdr]','data1','type','source','data3','destination','destinationchannel','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','lodash','./utils','Local/_attended@transfer','Queue:','info','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','channel','data2','membername','interface','getUserByInterface','then','internal','request','CreateMemberReport','getUserByName','split','name','catch','error'];(function(_0x5d88c0,_0x5d7d83){var _0x1b40f0=function(_0x3fde10){while(--_0x3fde10){_0x5d88c0['push'](_0x5d88c0['shift']());}};_0x1b40f0(++_0x5d7d83);}(_0x2c64,0xbf));var _0x42c6=function(_0x74892f,_0x1e981b){_0x74892f=_0x74892f-0x0;var _0x10ee61=_0x2c64[_0x74892f];return _0x10ee61;};'use strict';var _=require(_0x42c6('0x0'));var util=require('util');var utils=require(_0x42c6('0x1'));var members={};var exclude=[_0x42c6('0x2'),_0x42c6('0x3')];function writeDB(_0xdd6011){utils[_0x42c6('0x4')](util['format'](_0x42c6('0x5'),_0xdd6011[_0x42c6('0x6')],_0xdd6011['interface'],_0xdd6011[_0x42c6('0x7')],_0xdd6011[_0x42c6('0x8')],_0xdd6011[_0x42c6('0x9')],_0xdd6011['type']));if(_0xdd6011[_0x42c6('0xa')]){utils[_0x42c6('0xb')](_0xdd6011['interface'])[_0x42c6('0xc')](function(_0x42f0ac){if(_0x42f0ac){_0xdd6011['membername']=_0x42f0ac['name'];_0xdd6011[_0x42c6('0xd')]=_0x42f0ac[_0x42c6('0xd')];utils[_0x42c6('0xe')](_0x42c6('0xf'),_0xdd6011);}else{utils[_0x42c6('0x10')](_0xdd6011[_0x42c6('0xa')][_0x42c6('0x11')]('/')[0x1])['then'](function(_0x57fab7){if(_0x57fab7){_0xdd6011[_0x42c6('0x9')]=_0x57fab7[_0x42c6('0x12')];_0xdd6011['internal']=_0x57fab7[_0x42c6('0xd')];utils[_0x42c6('0xe')](_0x42c6('0xf'),_0xdd6011);}});}})[_0x42c6('0x13')](function(_0x3a008f){utils[_0x42c6('0x14')](util['format'](_0x42c6('0x15'),_0xdd6011[_0x42c6('0x6')]),_0x3a008f);});}delete members[_0xdd6011[_0x42c6('0xa')]];}function startsWith(_0x58e66b,_0x570918){return _['some'](_0x58e66b,function(_0x2825d0){return _[_0x42c6('0x16')](_0x570918,_0x2825d0);});}exports[_0x42c6('0x17')]=function(_0xa47b34){try{utils[_0x42c6('0x18')](util[_0x42c6('0x19')](_0x42c6('0x1a'),members[_0xa47b34['device']]?members[_0xa47b34[_0x42c6('0x1b')]][_0x42c6('0x6')]:_0xa47b34[_0x42c6('0x1b')]),_0xa47b34);utils['info'](util[_0x42c6('0x19')](_0x42c6('0x1c'),members[_0xa47b34[_0x42c6('0x1b')]]?members[_0xa47b34['device']]['uniqueid']:_0xa47b34['device'],_0xa47b34[_0x42c6('0x1d')],_0xa47b34['device']));switch(_0xa47b34[_0x42c6('0x1d')]){case _0x42c6('0x1e'):case'BUSY':if(!startsWith(exclude,_0xa47b34[_0x42c6('0x1b')])){members[_0xa47b34[_0x42c6('0x1b')]]={'channel':'voice','interface':_0xa47b34['device'],'type':_0x42c6('0x1f'),'enterAt':utils['now'](),'role':_0x42c6('0x20')};}break;case _0x42c6('0x21'):if(!_['isNil'](members[_0xa47b34[_0x42c6('0x1b')]])){members[_0xa47b34[_0x42c6('0x1b')]][_0x42c6('0x22')]=utils[_0x42c6('0x23')]();members[_0xa47b34[_0x42c6('0x1b')]][_0x42c6('0x24')]=utils[_0x42c6('0x25')](members[_0xa47b34[_0x42c6('0x1b')]][_0x42c6('0x22')],members[_0xa47b34[_0x42c6('0x1b')]][_0x42c6('0x26')]);if(members[_0xa47b34[_0x42c6('0x1b')]][_0x42c6('0x6')]){writeDB(members[_0xa47b34[_0x42c6('0x1b')]]);}}break;default:break;}}catch(_0x1db854){utils[_0x42c6('0x14')](util[_0x42c6('0x19')](_0x42c6('0x1a'),members[_0xa47b34[_0x42c6('0x1b')]]?members[_0xa47b34[_0x42c6('0x1b')]][_0x42c6('0x6')]:_0xa47b34['device']),_0x1db854);}};exports[_0x42c6('0x27')]=function(_0x22661e){try{if(!_[_0x42c6('0x28')](members[_0x22661e['interface']])){utils[_0x42c6('0x18')](util[_0x42c6('0x19')](_0x42c6('0x29'),_0x22661e['uniqueid']),_0x22661e);utils[_0x42c6('0x4')](util[_0x42c6('0x19')]('[%s][members][agentcomplete]\x20interface:%s\x20queue:%s',_0x22661e[_0x42c6('0x6')],_0x22661e[_0x42c6('0xa')],_0x22661e[_0x42c6('0x2a')]));members[_0x22661e[_0x42c6('0xa')]]=_[_0x42c6('0x2b')](members[_0x22661e['interface']],{'data4':_0x22661e[_0x42c6('0x2a')],'uniqueid':_0x22661e['uniqueid']});}}catch(_0xb78a18){utils[_0x42c6('0x14')](util[_0x42c6('0x19')]('[%s][members][agentcomplete]',_0x22661e[_0x42c6('0x6')]),_0xb78a18);}};exports[_0x42c6('0x2c')]=function(_0x475f2e){try{utils[_0x42c6('0x18')](util[_0x42c6('0x19')](_0x42c6('0x2d'),_0x475f2e[_0x42c6('0x6')]),_0x475f2e);if(_0x475f2e['channel']){var _0x2e24ca=_0x475f2e['channel'][_0x42c6('0x11')]('-')[0x0];if(!_[_0x42c6('0x28')](members[_0x2e24ca])){members[_0x2e24ca]=_[_0x42c6('0x2b')](members[_0x2e24ca],{'data1':members[_0x2e24ca][_0x42c6('0x2e')]||_0x475f2e[_0x42c6('0x2f')],'data2':members[_0x2e24ca]['data2']||_0x475f2e[_0x42c6('0x30')],'data3':members[_0x2e24ca][_0x42c6('0x31')]||_0x475f2e[_0x42c6('0x32')],'uniqueid':members[_0x2e24ca]['uniqueid']||_0x475f2e[_0x42c6('0x6')]});utils[_0x42c6('0x4')](util[_0x42c6('0x19')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x475f2e[_0x42c6('0x6')],members[_0x2e24ca]['data1'],members[_0x2e24ca][_0x42c6('0x8')],members[_0x2e24ca][_0x42c6('0x31')]));if(members[_0x2e24ca]['exitAt']){writeDB(members[_0x2e24ca]);}}}if(_0x475f2e[_0x42c6('0x33')]){var _0x568c37=_0x475f2e[_0x42c6('0x33')][_0x42c6('0x11')]('-')[0x0];if(!_[_0x42c6('0x28')](members[_0x568c37])){members[_0x568c37]=_[_0x42c6('0x2b')](members[_0x568c37],{'data1':members[_0x568c37][_0x42c6('0x2e')]||_0x475f2e[_0x42c6('0x2f')],'data2':members[_0x568c37][_0x42c6('0x8')]||_0x475f2e[_0x42c6('0x30')],'data3':members[_0x568c37][_0x42c6('0x31')]||_0x475f2e['destination'],'uniqueid':members[_0x568c37][_0x42c6('0x6')]||_0x475f2e[_0x42c6('0x6')]});utils[_0x42c6('0x4')](util[_0x42c6('0x19')](_0x42c6('0x34'),_0x475f2e[_0x42c6('0x6')],members[_0x568c37][_0x42c6('0x2e')],members[_0x568c37][_0x42c6('0x8')],members[_0x568c37]['data3']));if(members[_0x568c37][_0x42c6('0x22')]){writeDB(members[_0x568c37]);}}}}catch(_0x3d03fd){utils[_0x42c6('0x14')](util[_0x42c6('0x19')](_0x42c6('0x2d'),_0x475f2e[_0x42c6('0x6')]),_0x3d03fd);}}; \ No newline at end of file +var _0x5bbb=['lodash','util','./utils','Local/_attended@transfer','Queue:','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','membername','getUserByInterface','then','name','request','CreateMemberReport','split','internal','catch','[%s][members][writeDB]','some','startsWith','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','voice','agent','now','duration','diffTime','exitAt','enterAt','error','agentcomplete','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','assign','queue','cdr','debug','channel','isNil','data1','type','source','data3','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','data2','destinationchannel','[%s][members][cdr]'];(function(_0x17928f,_0x4ad33f){var _0x500b63=function(_0x127644){while(--_0x127644){_0x17928f['push'](_0x17928f['shift']());}};_0x500b63(++_0x4ad33f);}(_0x5bbb,0x132));var _0xb5bb=function(_0x526038,_0x3c1c48){_0x526038=_0x526038-0x0;var _0x40bd1c=_0x5bbb[_0x526038];return _0x40bd1c;};'use strict';var _=require(_0xb5bb('0x0'));var util=require(_0xb5bb('0x1'));var utils=require(_0xb5bb('0x2'));var members={};var exclude=[_0xb5bb('0x3'),_0xb5bb('0x4')];function writeDB(_0x14b806){utils[_0xb5bb('0x5')](util[_0xb5bb('0x6')](_0xb5bb('0x7'),_0x14b806[_0xb5bb('0x8')],_0x14b806[_0xb5bb('0x9')],_0x14b806['channel'],_0x14b806['data2'],_0x14b806[_0xb5bb('0xa')],_0x14b806['type']));if(_0x14b806['interface']){utils[_0xb5bb('0xb')](_0x14b806[_0xb5bb('0x9')])[_0xb5bb('0xc')](function(_0x313d83){if(_0x313d83){_0x14b806['membername']=_0x313d83[_0xb5bb('0xd')];_0x14b806['internal']=_0x313d83['internal'];utils[_0xb5bb('0xe')](_0xb5bb('0xf'),_0x14b806);}else{utils['getUserByName'](_0x14b806['interface'][_0xb5bb('0x10')]('/')[0x1])[_0xb5bb('0xc')](function(_0x27ff7e){if(_0x27ff7e){_0x14b806['membername']=_0x27ff7e[_0xb5bb('0xd')];_0x14b806[_0xb5bb('0x11')]=_0x27ff7e[_0xb5bb('0x11')];utils['request'](_0xb5bb('0xf'),_0x14b806);}});}})[_0xb5bb('0x12')](function(_0x23ffb0){utils['error'](util[_0xb5bb('0x6')](_0xb5bb('0x13'),_0x14b806[_0xb5bb('0x8')]),_0x23ffb0);});}delete members[_0x14b806['interface']];}function startsWith(_0x2f95fa,_0x109aca){return _[_0xb5bb('0x14')](_0x2f95fa,function(_0x288e83){return _[_0xb5bb('0x15')](_0x109aca,_0x288e83);});}exports['devicestatechange']=function(_0xdab98f){try{utils['debug'](util['format'](_0xb5bb('0x16'),members[_0xdab98f[_0xb5bb('0x17')]]?members[_0xdab98f[_0xb5bb('0x17')]]['uniqueid']:_0xdab98f[_0xb5bb('0x17')]),_0xdab98f);utils[_0xb5bb('0x5')](util[_0xb5bb('0x6')](_0xb5bb('0x18'),members[_0xdab98f[_0xb5bb('0x17')]]?members[_0xdab98f[_0xb5bb('0x17')]]['uniqueid']:_0xdab98f[_0xb5bb('0x17')],_0xdab98f[_0xb5bb('0x19')],_0xdab98f['device']));switch(_0xdab98f[_0xb5bb('0x19')]){case _0xb5bb('0x1a'):case'BUSY':if(!startsWith(exclude,_0xdab98f[_0xb5bb('0x17')])){members[_0xdab98f['device']]={'channel':_0xb5bb('0x1b'),'interface':_0xdab98f[_0xb5bb('0x17')],'type':'TALKING','enterAt':utils['now'](),'role':_0xb5bb('0x1c')};}break;case'NOT_INUSE':if(!_['isNil'](members[_0xdab98f['device']])){members[_0xdab98f['device']]['exitAt']=utils[_0xb5bb('0x1d')]();members[_0xdab98f[_0xb5bb('0x17')]][_0xb5bb('0x1e')]=utils[_0xb5bb('0x1f')](members[_0xdab98f[_0xb5bb('0x17')]][_0xb5bb('0x20')],members[_0xdab98f[_0xb5bb('0x17')]][_0xb5bb('0x21')]);if(members[_0xdab98f['device']][_0xb5bb('0x8')]){writeDB(members[_0xdab98f[_0xb5bb('0x17')]]);}}break;default:break;}}catch(_0xca9e6a){utils[_0xb5bb('0x22')](util['format'](_0xb5bb('0x16'),members[_0xdab98f['device']]?members[_0xdab98f[_0xb5bb('0x17')]]['uniqueid']:_0xdab98f[_0xb5bb('0x17')]),_0xca9e6a);}};exports[_0xb5bb('0x23')]=function(_0x902e46){try{if(!_['isNil'](members[_0x902e46['interface']])){utils['debug'](util['format']('[%s][members][agentcomplete]',_0x902e46[_0xb5bb('0x8')]),_0x902e46);utils[_0xb5bb('0x5')](util[_0xb5bb('0x6')](_0xb5bb('0x24'),_0x902e46[_0xb5bb('0x8')],_0x902e46['interface'],_0x902e46['queue']));members[_0x902e46[_0xb5bb('0x9')]]=_[_0xb5bb('0x25')](members[_0x902e46[_0xb5bb('0x9')]],{'data4':_0x902e46[_0xb5bb('0x26')],'uniqueid':_0x902e46[_0xb5bb('0x8')]});}}catch(_0x895c42){utils[_0xb5bb('0x22')](util[_0xb5bb('0x6')]('[%s][members][agentcomplete]',_0x902e46[_0xb5bb('0x8')]),_0x895c42);}};exports[_0xb5bb('0x27')]=function(_0x51e294){try{utils[_0xb5bb('0x28')](util[_0xb5bb('0x6')]('[%s][members][cdr]',_0x51e294[_0xb5bb('0x8')]),_0x51e294);if(_0x51e294[_0xb5bb('0x29')]){var _0x1f382a=_0x51e294['channel'][_0xb5bb('0x10')]('-')[0x0];if(!_[_0xb5bb('0x2a')](members[_0x1f382a])){members[_0x1f382a]=_[_0xb5bb('0x25')](members[_0x1f382a],{'data1':members[_0x1f382a][_0xb5bb('0x2b')]||_0x51e294[_0xb5bb('0x2c')],'data2':members[_0x1f382a]['data2']||_0x51e294[_0xb5bb('0x2d')],'data3':members[_0x1f382a][_0xb5bb('0x2e')]||_0x51e294['destination'],'uniqueid':members[_0x1f382a][_0xb5bb('0x8')]||_0x51e294['uniqueid']});utils[_0xb5bb('0x5')](util[_0xb5bb('0x6')](_0xb5bb('0x2f'),_0x51e294['uniqueid'],members[_0x1f382a]['data1'],members[_0x1f382a][_0xb5bb('0x30')],members[_0x1f382a][_0xb5bb('0x2e')]));if(members[_0x1f382a]['exitAt']){writeDB(members[_0x1f382a]);}}}if(_0x51e294[_0xb5bb('0x31')]){var _0x4b630b=_0x51e294[_0xb5bb('0x31')][_0xb5bb('0x10')]('-')[0x0];if(!_[_0xb5bb('0x2a')](members[_0x4b630b])){members[_0x4b630b]=_[_0xb5bb('0x25')](members[_0x4b630b],{'data1':members[_0x4b630b][_0xb5bb('0x2b')]||_0x51e294['type'],'data2':members[_0x4b630b][_0xb5bb('0x30')]||_0x51e294[_0xb5bb('0x2d')],'data3':members[_0x4b630b]['data3']||_0x51e294['destination'],'uniqueid':members[_0x4b630b][_0xb5bb('0x8')]||_0x51e294[_0xb5bb('0x8')]});utils['info'](util[_0xb5bb('0x6')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x51e294['uniqueid'],members[_0x4b630b]['data1'],members[_0x4b630b][_0xb5bb('0x30')],members[_0x4b630b][_0xb5bb('0x2e')]));if(members[_0x4b630b][_0xb5bb('0x20')]){writeDB(members[_0x4b630b]);}}}}catch(_0x17b8d1){utils['error'](util['format'](_0xb5bb('0x32'),_0x51e294['uniqueid']),_0x17b8d1);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 1a0e5dd..4b5f5f6 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 _0x472b=['origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','ATTENDED','transferexten','ATTENDEDTRANSFER','transfereelinkedid','queuecallerenterreason','clone','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','transfertargetuniqueid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][musiconholdstart]','musiconholdstartAt','musiconholdstop','[%s][queues][musiconholdstop]','diffTime','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','util','info','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel','lastAssignedTo','calleridnum','accountcode','queuecallerexitreason','queue','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','[%s][queues][queuecallerjoin]','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','now','hangup','isNil','debug','[%s][queues][hangup]','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','error','variable','queuestatus','value','queuecallerabandon','queuecallerexitAt','toUpperCase','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','queuecallerexit','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][varset]','[%s][queues][queuecallerabandon]','queuecallerabandonAt','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','queuecallerleave','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinename','holdtime','queuecallerjoinAt','count','connectedlinenum','[%s][queues][queuecallerleave]','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','assigned','destaccountcode','agentcomplete','[%s][queues][agentcomplete]','transfer','TRANSFER','COMPLETEDBY','reason','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','[%s][queues][blindtransfer]','transfereeuniqueid','transfertype','BLIND','extension','transferuniqueid','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','attendedtransfer','[%s][queues][attendedtransfer]'];(function(_0x37bc34,_0x238252){var _0x4e3dc2=function(_0x4fc334){while(--_0x4fc334){_0x37bc34['push'](_0x37bc34['shift']());}};_0x4e3dc2(++_0x238252);}(_0x472b,0x83));var _0xb472=function(_0x323244,_0x122157){_0x323244=_0x323244-0x0;var _0x7dcf5b=_0x472b[_0x323244];return _0x7dcf5b;};'use strict';var _=require('lodash');var util=require(_0xb472('0x0'));var utils=require('./utils');var queues={};function writeDB(_0x499359){utils[_0xb472('0x1')](util[_0xb472('0x2')](_0xb472('0x3'),_0x499359[_0xb472('0x4')],_0x499359[_0xb472('0x5')],_0x499359['queue'],_0x499359[_0xb472('0x6')],_0x499359[_0xb472('0x7')],_0x499359[_0xb472('0x8')],_0x499359[_0xb472('0x9')]));if(_0x499359[_0xb472('0xa')]){utils[_0xb472('0xb')](_0x499359['queue'])[_0xb472('0xc')](function(_0x3d0fd0){if(_0x3d0fd0){_0x499359[_0xb472('0xd')]=_0x3d0fd0[_0xb472('0xd')];}utils['request']('CreateVoiceQueueReport',_0x499359);});}else{utils[_0xb472('0xe')](_0xb472('0xf'),_0x499359);}if(_0x499359[_0xb472('0x10')]){delete queues[_0x499359['transfereduniqueid']];}else{delete queues[_0x499359[_0xb472('0x4')]];}}exports[_0xb472('0x11')]=function(_0x594b74){try{utils['debug'](util['format'](_0xb472('0x12'),_0x594b74[_0xb472('0x4')]),_0x594b74);utils[_0xb472('0x1')](util[_0xb472('0x2')](_0xb472('0x13'),_0x594b74[_0xb472('0x4')],_0x594b74[_0xb472('0xa')],_0x594b74[_0xb472('0x14')]));queues[_0x594b74['uniqueid']]=_['assign'](_0x594b74,{'originalposition':_0x594b74['position'],'queuecallerjoinAt':utils[_0xb472('0x15')](),'mohtime':0x0});}catch(_0x5adf3b){utils['error'](util[_0xb472('0x2')](_0xb472('0x12'),_0x594b74[_0xb472('0x4')]),_0x5adf3b);}};exports[_0xb472('0x16')]=function(_0x53016a){try{if(!_[_0xb472('0x17')](queues[_0x53016a[_0xb472('0x4')]])){utils[_0xb472('0x18')](util[_0xb472('0x2')](_0xb472('0x19'),_0x53016a[_0xb472('0x4')]),_0x53016a);if(queues[_0x53016a[_0xb472('0x4')]][_0xb472('0x1a')]){if(!queues[_0x53016a[_0xb472('0x4')]]['queuecallerabandon']&&!queues[_0x53016a['uniqueid']]['queuecallerexit']){queues[_0x53016a['uniqueid']][_0xb472('0x1b')]=!![];queues[_0x53016a[_0xb472('0x4')]][_0xb472('0x1c')]=utils[_0xb472('0x15')]();queues[_0x53016a[_0xb472('0x4')]][_0xb472('0x9')]='COMPLETEDBYAGENT';}utils[_0xb472('0x1')](util[_0xb472('0x2')](_0xb472('0x1d'),_0x53016a[_0xb472('0x4')],queues[_0x53016a['uniqueid']][_0xb472('0x1e')],queues[_0x53016a['uniqueid']][_0xb472('0x9')]));writeDB(queues[_0x53016a['uniqueid']]);}else if(queues[_0x53016a['uniqueid']][_0xb472('0x10')]){utils[_0xb472('0x1')](util[_0xb472('0x2')]('[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s',_0x53016a[_0xb472('0x4')],queues[_0x53016a[_0xb472('0x4')]][_0xb472('0x1e')],queues[_0x53016a[_0xb472('0x4')]][_0xb472('0x10')]));queues[queues[_0x53016a['uniqueid']][_0xb472('0x10')]]=queues[_0x53016a['uniqueid']];queues[queues[_0x53016a[_0xb472('0x4')]]['transfereduniqueid']]['queuecallerenterreason']=0x2;delete queues[_0x53016a[_0xb472('0x4')]];}}}catch(_0x715224){utils[_0xb472('0x1f')](util[_0xb472('0x2')](_0xb472('0x19'),_0x53016a['uniqueid']),_0x715224);}};exports['varset']=function(_0x1efbf0){try{utils[_0xb472('0x18')](util[_0xb472('0x2')]('[%s][queues][varset]',_0x1efbf0['uniqueid']),_0x1efbf0);if(!_[_0xb472('0x17')](_0x1efbf0[_0xb472('0x20')][_0xb472('0x21')])&&_0x1efbf0[_0xb472('0x22')]['toUpperCase']()!=='CONTINUE'){if(!_['isNil'](queues[_0x1efbf0[_0xb472('0x4')]])){queues[_0x1efbf0[_0xb472('0x4')]][_0xb472('0x23')]=![];queues[_0x1efbf0[_0xb472('0x4')]]['queuecallerabandonAt']=null;queues[_0x1efbf0[_0xb472('0x4')]]['queuecallerexit']=!![];queues[_0x1efbf0[_0xb472('0x4')]][_0xb472('0x24')]=utils[_0xb472('0x15')]();queues[_0x1efbf0[_0xb472('0x4')]][_0xb472('0x9')]=_0x1efbf0[_0xb472('0x22')][_0xb472('0x25')]();utils[_0xb472('0x1')](util[_0xb472('0x2')](_0xb472('0x26'),_0x1efbf0[_0xb472('0x4')],queues[_0x1efbf0[_0xb472('0x4')]][_0xb472('0x1e')],_0x1efbf0[_0xb472('0x22')],queues[_0x1efbf0[_0xb472('0x4')]]['queuecallerexitreason']));writeDB(queues[_0x1efbf0[_0xb472('0x4')]]);}}else if(!_[_0xb472('0x17')](_0x1efbf0[_0xb472('0x20')][_0xb472('0x27')])){if(!_[_0xb472('0x17')](queues[_0x1efbf0[_0xb472('0x4')]])&&!queues[_0x1efbf0['uniqueid']]['queuecallerabandon']){queues[_0x1efbf0[_0xb472('0x4')]]['queuecallerabandon']=![];queues[_0x1efbf0['uniqueid']]['queuecallerabandonAt']=null;queues[_0x1efbf0[_0xb472('0x4')]][_0xb472('0x28')]=!![];queues[_0x1efbf0['uniqueid']]['queuecallerexitAt']=utils[_0xb472('0x15')]();queues[_0x1efbf0[_0xb472('0x4')]][_0xb472('0x9')]='EXITWITHKEY';utils[_0xb472('0x1')](util[_0xb472('0x2')](_0xb472('0x29'),_0x1efbf0['uniqueid'],queues[_0x1efbf0[_0xb472('0x4')]][_0xb472('0x1e')],_0x1efbf0[_0xb472('0x22')],queues[_0x1efbf0[_0xb472('0x4')]][_0xb472('0x9')]));}}}catch(_0x3cb85d){utils[_0xb472('0x1f')](util[_0xb472('0x2')](_0xb472('0x2a'),_0x1efbf0[_0xb472('0x4')]),_0x3cb85d);}};exports[_0xb472('0x23')]=function(_0x3c2935){try{if(!_[_0xb472('0x17')](queues[_0x3c2935[_0xb472('0x4')]])){utils[_0xb472('0x18')](util[_0xb472('0x2')](_0xb472('0x2b'),_0x3c2935['uniqueid']),_0x3c2935);queues[_0x3c2935[_0xb472('0x4')]][_0xb472('0x28')]=![];queues[_0x3c2935['uniqueid']][_0xb472('0x24')]=null;queues[_0x3c2935[_0xb472('0x4')]][_0xb472('0x23')]=!![];queues[_0x3c2935[_0xb472('0x4')]][_0xb472('0x2c')]=utils['now']();queues[_0x3c2935[_0xb472('0x4')]][_0xb472('0x9')]=_0xb472('0x2d');utils[_0xb472('0x1')](util['format'](_0xb472('0x2e'),_0x3c2935[_0xb472('0x4')],queues[_0x3c2935['uniqueid']][_0xb472('0x1e')],queues[_0x3c2935['uniqueid']][_0xb472('0x9')]));}}catch(_0x5192f1){utils['error'](util[_0xb472('0x2')](_0xb472('0x2b'),_0x3c2935[_0xb472('0x4')]),_0x5192f1);}};exports[_0xb472('0x2f')]=function(_0x2f393d){try{if(!_[_0xb472('0x17')](queues[_0x2f393d[_0xb472('0x4')]])){utils[_0xb472('0x18')](util[_0xb472('0x2')]('[%s][queues][queuecallerleave]',_0x2f393d[_0xb472('0x4')]),_0x2f393d);utils[_0xb472('0x1')](util[_0xb472('0x2')](_0xb472('0x30'),_0x2f393d[_0xb472('0x4')],queues[_0x2f393d['uniqueid']]['name'],_0x2f393d['connectedlinenum'],_0x2f393d[_0xb472('0x31')]));queues[_0x2f393d[_0xb472('0x4')]]['queuecallerleave']=!![];queues[_0x2f393d['uniqueid']]['queuecallerleaveAt']=utils[_0xb472('0x15')]();queues[_0x2f393d['uniqueid']][_0xb472('0x32')]=utils['diffTime'](queues[_0x2f393d[_0xb472('0x4')]][_0xb472('0x1a')],queues[_0x2f393d[_0xb472('0x4')]][_0xb472('0x33')]);queues[_0x2f393d['uniqueid']][_0xb472('0x14')]=_0x2f393d[_0xb472('0x14')];queues[_0x2f393d[_0xb472('0x4')]][_0xb472('0x34')]=_0x2f393d[_0xb472('0x34')];queues[_0x2f393d[_0xb472('0x4')]]['connectedlinenum']=_0x2f393d[_0xb472('0x35')];queues[_0x2f393d[_0xb472('0x4')]][_0xb472('0x31')]=_0x2f393d[_0xb472('0x31')];}}catch(_0x10add8){utils['error'](util[_0xb472('0x2')](_0xb472('0x36'),_0x2f393d[_0xb472('0x4')]),_0x10add8);}};exports['agentconnect']=function(_0x2c0107){try{if(!_['isNil'](queues[_0x2c0107[_0xb472('0x4')]])){utils[_0xb472('0x18')](util[_0xb472('0x2')](_0xb472('0x37'),_0x2c0107['uniqueid']),_0x2c0107);utils[_0xb472('0x1')](util[_0xb472('0x2')](_0xb472('0x38'),_0x2c0107[_0xb472('0x4')],queues[_0x2c0107[_0xb472('0x4')]][_0xb472('0x1e')],_0x2c0107[_0xb472('0x39')],_0x2c0107['destaccountcode']));queues[_0x2c0107[_0xb472('0x4')]][_0xb472('0x23')]=![];queues[_0x2c0107[_0xb472('0x4')]][_0xb472('0x23')]=![];queues[_0x2c0107['uniqueid']]['queuecallerabandonAt']=null;queues[_0x2c0107[_0xb472('0x4')]]['queuecallerexit']=![];queues[_0x2c0107[_0xb472('0x4')]]['queuecallerexitreason']=null;queues[_0x2c0107[_0xb472('0x4')]][_0xb472('0x24')]=null;queues[_0x2c0107[_0xb472('0x4')]][_0xb472('0x3a')]=!![];queues[_0x2c0107['uniqueid']][_0xb472('0x8')]=_0x2c0107[_0xb472('0x3b')];queues[_0x2c0107[_0xb472('0x4')]]['lastAssignedTo']=_0x2c0107['membername'];}}catch(_0x3dd877){utils[_0xb472('0x1f')](util[_0xb472('0x2')]('[%s][queues][agentconnect]',_0x2c0107[_0xb472('0x4')]),_0x3dd877);}};exports[_0xb472('0x3c')]=function(_0x5778c7){try{if(!_[_0xb472('0x17')](queues[_0x5778c7[_0xb472('0x4')]])){if(queues[_0x5778c7[_0xb472('0x4')]][_0xb472('0x1a')]){utils[_0xb472('0x18')](util[_0xb472('0x2')](_0xb472('0x3d'),_0x5778c7['uniqueid']),_0x5778c7);queues[_0x5778c7[_0xb472('0x4')]]['queuecallerabandon']=![];queues[_0x5778c7['uniqueid']][_0xb472('0x23')]=![];queues[_0x5778c7[_0xb472('0x4')]][_0xb472('0x2c')]=null;queues[_0x5778c7[_0xb472('0x4')]][_0xb472('0x28')]=![];queues[_0x5778c7[_0xb472('0x4')]][_0xb472('0x24')]=null;queues[_0x5778c7[_0xb472('0x4')]]['assigned']=!![];queues[_0x5778c7[_0xb472('0x4')]][_0xb472('0x6')]=_0x5778c7[_0xb472('0x39')];queues[_0x5778c7[_0xb472('0x4')]][_0xb472('0x1b')]=!![];queues[_0x5778c7[_0xb472('0x4')]]['queuecallercompleteAt']=utils[_0xb472('0x15')]();if(_0x5778c7['reason']==_0xb472('0x3e')){if(!queues[_0x5778c7[_0xb472('0x4')]][_0xb472('0x3e')]){queues[_0x5778c7[_0xb472('0x4')]][_0xb472('0x9')]=_0xb472('0x3f');}}else{queues[_0x5778c7[_0xb472('0x4')]]['queuecallerexitreason']=_0xb472('0x40')+_0x5778c7[_0xb472('0x41')][_0xb472('0x25')]();}utils[_0xb472('0x1')](util[_0xb472('0x2')](_0xb472('0x42'),_0x5778c7[_0xb472('0x4')],queues[_0x5778c7[_0xb472('0x4')]][_0xb472('0x1e')],_0x5778c7[_0xb472('0x39')],queues[_0x5778c7[_0xb472('0x4')]][_0xb472('0x9')]));writeDB(queues[_0x5778c7['uniqueid']]);}}}catch(_0x557a34){utils['error'](util[_0xb472('0x2')](_0xb472('0x3d'),_0x5778c7[_0xb472('0x4')]),_0x557a34);}};exports[_0xb472('0x43')]=function(_0x360783){try{if(!_['isNil'](queues[_0x360783['transfereeuniqueid']])){utils[_0xb472('0x18')](util[_0xb472('0x2')](_0xb472('0x44'),_0x360783[_0xb472('0x4')]),_0x360783);queues[_0x360783['transfereeuniqueid']][_0xb472('0x3e')]=!![];queues[_0x360783[_0xb472('0x45')]][_0xb472('0x46')]=_0xb472('0x47');queues[_0x360783[_0xb472('0x45')]]['transferexten']=_0x360783[_0xb472('0x48')];queues[_0x360783[_0xb472('0x45')]][_0xb472('0x49')]=_0x360783['transfereeuniqueid'];queues[_0x360783[_0xb472('0x45')]]['queuecallerexitreason']='BLINDTRANSFER';utils['info'](util[_0xb472('0x2')](_0xb472('0x4a'),_0x360783[_0xb472('0x4')],queues[_0x360783[_0xb472('0x45')]][_0xb472('0x1e')],_0x360783['transfereeuniqueid'],_0x360783[_0xb472('0x48')]));}}catch(_0x5197f0){utils[_0xb472('0x1f')](util[_0xb472('0x2')](_0xb472('0x44'),_0x360783[_0xb472('0x4')]),_0x5197f0);}};exports[_0xb472('0x4b')]=function(_0x3033fc){try{utils[_0xb472('0x18')](util['format'](_0xb472('0x4c'),_0x3033fc[_0xb472('0x4d')]),_0x3033fc);if(_0x3033fc[_0xb472('0x4d')]==_0x3033fc[_0xb472('0x4e')]){if(!_['isNil'](queues[_0x3033fc[_0xb472('0x4f')]])){utils[_0xb472('0x1')](util[_0xb472('0x2')](_0xb472('0x50'),_0x3033fc[_0xb472('0x4d')],queues[_0x3033fc[_0xb472('0x4f')]][_0xb472('0x1e')],_0x3033fc[_0xb472('0x51')]));queues[_0x3033fc[_0xb472('0x4f')]]['transfer']=!![];queues[_0x3033fc[_0xb472('0x4f')]][_0xb472('0x46')]=_0xb472('0x52');queues[_0x3033fc[_0xb472('0x4f')]][_0xb472('0x53')]=_0x3033fc[_0xb472('0x51')];queues[_0x3033fc[_0xb472('0x4f')]][_0xb472('0x49')]=_0x3033fc[_0xb472('0x4d')];queues[_0x3033fc[_0xb472('0x4f')]][_0xb472('0x9')]=_0xb472('0x54');}if(!_[_0xb472('0x17')](queues[_0x3033fc[_0xb472('0x4e')]])){if(_0x3033fc[_0xb472('0x55')]&&queues[_0x3033fc[_0xb472('0x55')]]){queues[_0x3033fc['transfereelinkedid']][_0xb472('0x56')]=0x1;queues[_0x3033fc['transfereeuniqueid']]=_[_0xb472('0x57')](queues[_0x3033fc[_0xb472('0x55')]]);queues[_0x3033fc[_0xb472('0x45')]]['transfereduniqueid']=_0x3033fc['transfertargetuniqueid'];queues[_0x3033fc[_0xb472('0x45')]]['queuecallerenterreason']=0x2;queues[_0x3033fc[_0xb472('0x45')]]['calleridnum']=queues[_0x3033fc['secondtransfererlinkedid']][_0xb472('0x7')];queues[_0x3033fc[_0xb472('0x45')]][_0xb472('0x58')]=queues[_0x3033fc[_0xb472('0x4f')]][_0xb472('0x58')];queues[_0x3033fc[_0xb472('0x45')]]['queuecallerjoinAt']=utils[_0xb472('0x15')]();queues[_0x3033fc[_0xb472('0x45')]]['queuecallerleaveAt']=utils[_0xb472('0x15')]();queues[_0x3033fc[_0xb472('0x45')]]['holdtime']=0x0;queues[_0x3033fc[_0xb472('0x45')]][_0xb472('0x59')]=0x0;utils[_0xb472('0x1')](util[_0xb472('0x2')](_0xb472('0x5a'),_0x3033fc[_0xb472('0x4d')],queues[_0x3033fc[_0xb472('0x45')]]['name'],queues[_0x3033fc[_0xb472('0x45')]]['calleridnum'],queues[_0x3033fc[_0xb472('0x45')]][_0xb472('0x58')]));}else{utils[_0xb472('0x1')](util[_0xb472('0x2')](_0xb472('0x5b'),_0x3033fc[_0xb472('0x4d')],queues[_0x3033fc[_0xb472('0x4e')]]['name'],_0x3033fc[_0xb472('0x4f')]));queues[_0x3033fc['origtransfererlinkedid']][_0xb472('0x10')]=_0x3033fc[_0xb472('0x4f')];}}}else if(_0x3033fc[_0xb472('0x5c')]==_0x3033fc[_0xb472('0x4f')]){if(!_[_0xb472('0x17')](queues[_0x3033fc[_0xb472('0x4e')]])){utils[_0xb472('0x1')](util[_0xb472('0x2')](_0xb472('0x5d'),_0x3033fc[_0xb472('0x4d')],queues[_0x3033fc[_0xb472('0x4e')]][_0xb472('0x1e')],_0x3033fc['secondtransfereruniqueid'],_0x3033fc[_0xb472('0x5e')]));queues[_0x3033fc[_0xb472('0x4e')]][_0xb472('0x3e')]=!![];queues[_0x3033fc[_0xb472('0x4e')]][_0xb472('0x46')]=_0xb472('0x52');queues[_0x3033fc[_0xb472('0x4e')]]['transferexten']=_0x3033fc[_0xb472('0x5e')];queues[_0x3033fc[_0xb472('0x4e')]][_0xb472('0x49')]=_0x3033fc[_0xb472('0x5c')];queues[_0x3033fc[_0xb472('0x4e')]]['queuecallerexitreason']=_0xb472('0x54');}if(!_['isNil'](queues[_0x3033fc[_0xb472('0x4f')]])){if(_0x3033fc[_0xb472('0x5f')]&&queues[_0x3033fc['transfertargetlinkedid']]){queues[_0x3033fc[_0xb472('0x5f')]]['queuecallerenterreason']=0x1;queues[_0x3033fc[_0xb472('0x60')]]=_[_0xb472('0x57')](queues[_0x3033fc[_0xb472('0x5f')]]);queues[_0x3033fc[_0xb472('0x60')]][_0xb472('0x10')]=_0x3033fc[_0xb472('0x60')];queues[_0x3033fc[_0xb472('0x60')]]['queuecallerenterreason']=0x2;queues[_0x3033fc[_0xb472('0x60')]]['calleridnum']=queues[_0x3033fc[_0xb472('0x4e')]][_0xb472('0x7')];queues[_0x3033fc[_0xb472('0x60')]][_0xb472('0x58')]=queues[_0x3033fc['origtransfererlinkedid']][_0xb472('0x58')];queues[_0x3033fc[_0xb472('0x60')]][_0xb472('0x33')]=utils[_0xb472('0x15')]();queues[_0x3033fc['transfertargetuniqueid']][_0xb472('0x1a')]=utils[_0xb472('0x15')]();queues[_0x3033fc['transfertargetuniqueid']][_0xb472('0x32')]=0x0;queues[_0x3033fc[_0xb472('0x60')]]['mohtime']=0x0;utils[_0xb472('0x1')](util[_0xb472('0x2')](_0xb472('0x61'),_0x3033fc[_0xb472('0x4d')],queues[_0x3033fc[_0xb472('0x60')]]['name'],queues[_0x3033fc[_0xb472('0x60')]][_0xb472('0x10')],queues[_0x3033fc[_0xb472('0x60')]][_0xb472('0x7')],queues[_0x3033fc[_0xb472('0x60')]][_0xb472('0x58')]));}else{utils[_0xb472('0x1')](util[_0xb472('0x2')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x3033fc[_0xb472('0x4d')],queues[_0x3033fc[_0xb472('0x4f')]][_0xb472('0x1e')],_0x3033fc['origtransfererlinkedid']));queues[_0x3033fc[_0xb472('0x4f')]][_0xb472('0x10')]=_0x3033fc[_0xb472('0x4e')];}}}}catch(_0x3e6235){utils[_0xb472('0x1f')](util[_0xb472('0x2')](_0xb472('0x4c'),_0x3033fc['origtransfereruniqueid']),_0x3e6235);}};exports['musiconholdstart']=function(_0x3a0f65){try{if(!_['isNil'](queues[_0x3a0f65['uniqueid']])){utils[_0xb472('0x18')](util[_0xb472('0x2')](_0xb472('0x62'),_0x3a0f65['uniqueid']),_0x3a0f65);queues[_0x3a0f65['uniqueid']][_0xb472('0x63')]=utils['now']();utils[_0xb472('0x1')](util['format']('[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s',_0x3a0f65[_0xb472('0x4')],queues[_0x3a0f65[_0xb472('0x4')]][_0xb472('0x1e')],queues[_0x3a0f65[_0xb472('0x4')]][_0xb472('0x63')]));}}catch(_0x14b43f){utils[_0xb472('0x1f')](util[_0xb472('0x2')](_0xb472('0x62'),_0x3a0f65[_0xb472('0x4')]),_0x14b43f);}};exports[_0xb472('0x64')]=function(_0x58b589){try{if(!_[_0xb472('0x17')](queues[_0x58b589[_0xb472('0x4')]])){if(!_[_0xb472('0x17')](queues[_0x58b589[_0xb472('0x4')]]['musiconholdstartAt'])){utils[_0xb472('0x18')](util[_0xb472('0x2')](_0xb472('0x65'),_0x58b589[_0xb472('0x4')]),_0x58b589);queues[_0x58b589[_0xb472('0x4')]][_0xb472('0x59')]+=utils[_0xb472('0x66')](utils[_0xb472('0x15')](),queues[_0x58b589[_0xb472('0x4')]][_0xb472('0x63')]);utils[_0xb472('0x1')](util['format'](_0xb472('0x67'),_0x58b589['uniqueid'],queues[_0x58b589['uniqueid']][_0xb472('0x1e')],queues[_0x58b589[_0xb472('0x4')]][_0xb472('0x59')]));delete queues[_0x58b589[_0xb472('0x4')]][_0xb472('0x63')];}}}catch(_0x1e927d){utils['error'](util['format']('[%s][queues][musiconholdstop]',_0x58b589['uniqueid']),_0x1e927d);}}; \ No newline at end of file +var _0x6255=['format','uniqueid','channel','queue','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','error','hangup','[%s][queues][hangup]','queuecallerabandon','queuecallercomplete','queuecallercompleteAt','now','queuecallerexitreason','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','name','queuecallerenterreason','varset','variable','CONTINUE','queuecallerexit','toUpperCase','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','value','isNil','queuecallerexitAt','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][varset]','queuecallerabandonAt','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','queuecallerleave','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','queuecallerleaveAt','diffTime','count','[%s][queues][queuecallerleave]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','accountcode','lastAssignedTo','[%s][queues][agentconnect]','agentcomplete','[%s][queues][agentcomplete]','assigned','reason','transfer','TRANSFER','COMPLETEDBY','blindtransfer','transfereeuniqueid','[%s][queues][blindtransfer]','transfertype','BLIND','extension','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','ATTENDED','transferexten','transfereelinkedid','clone','transfertargetuniqueid','calleridnum','calleridname','queuecallerjoinAt','holdtime','[%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','ATTENDEDTRANSFER','transfertargetlinkedid','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','[%s][queues][musiconholdstart]','musiconholdstop','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','./utils','info'];(function(_0x4c3baf,_0x22f5c6){var _0x483f69=function(_0xbc64b4){while(--_0xbc64b4){_0x4c3baf['push'](_0x4c3baf['shift']());}};_0x483f69(++_0x22f5c6);}(_0x6255,0x1a1));var _0x5625=function(_0x3bf96b,_0x241008){_0x3bf96b=_0x3bf96b-0x0;var _0x431ced=_0x6255[_0x3bf96b];return _0x431ced;};'use strict';var _=require(_0x5625('0x0'));var util=require('util');var utils=require(_0x5625('0x1'));var queues={};function writeDB(_0x176d7f){utils[_0x5625('0x2')](util[_0x5625('0x3')]('[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s',_0x176d7f[_0x5625('0x4')],_0x176d7f[_0x5625('0x5')],_0x176d7f[_0x5625('0x6')],_0x176d7f['lastAssignedTo'],_0x176d7f['calleridnum'],_0x176d7f['accountcode'],_0x176d7f['queuecallerexitreason']));if(_0x176d7f[_0x5625('0x6')]){utils['getVoiceQueueByName'](_0x176d7f['queue'])['then'](function(_0x36c4f9){if(_0x36c4f9){_0x176d7f[_0x5625('0x7')]=_0x36c4f9[_0x5625('0x7')];}utils[_0x5625('0x8')](_0x5625('0x9'),_0x176d7f);});}else{utils[_0x5625('0x8')](_0x5625('0x9'),_0x176d7f);}if(_0x176d7f[_0x5625('0xa')]){delete queues[_0x176d7f[_0x5625('0xa')]];}else{delete queues[_0x176d7f[_0x5625('0x4')]];}}exports[_0x5625('0xb')]=function(_0x89b830){try{utils[_0x5625('0xc')](util[_0x5625('0x3')](_0x5625('0xd'),_0x89b830[_0x5625('0x4')]),_0x89b830);utils[_0x5625('0x2')](util[_0x5625('0x3')](_0x5625('0xe'),_0x89b830['uniqueid'],_0x89b830['queue'],_0x89b830[_0x5625('0xf')]));queues[_0x89b830[_0x5625('0x4')]]=_[_0x5625('0x10')](_0x89b830,{'originalposition':_0x89b830['position'],'queuecallerjoinAt':utils['now'](),'mohtime':0x0});}catch(_0x4c9d00){utils[_0x5625('0x11')](util[_0x5625('0x3')](_0x5625('0xd'),_0x89b830[_0x5625('0x4')]),_0x4c9d00);}};exports[_0x5625('0x12')]=function(_0x18fdbf){try{if(!_['isNil'](queues[_0x18fdbf[_0x5625('0x4')]])){utils[_0x5625('0xc')](util[_0x5625('0x3')](_0x5625('0x13'),_0x18fdbf[_0x5625('0x4')]),_0x18fdbf);if(queues[_0x18fdbf[_0x5625('0x4')]]['queuecallerleaveAt']){if(!queues[_0x18fdbf[_0x5625('0x4')]][_0x5625('0x14')]&&!queues[_0x18fdbf[_0x5625('0x4')]]['queuecallerexit']){queues[_0x18fdbf[_0x5625('0x4')]][_0x5625('0x15')]=!![];queues[_0x18fdbf['uniqueid']][_0x5625('0x16')]=utils[_0x5625('0x17')]();queues[_0x18fdbf['uniqueid']][_0x5625('0x18')]=_0x5625('0x19');}utils[_0x5625('0x2')](util['format'](_0x5625('0x1a'),_0x18fdbf[_0x5625('0x4')],queues[_0x18fdbf[_0x5625('0x4')]]['name'],queues[_0x18fdbf[_0x5625('0x4')]]['queuecallerexitreason']));writeDB(queues[_0x18fdbf[_0x5625('0x4')]]);}else if(queues[_0x18fdbf[_0x5625('0x4')]][_0x5625('0xa')]){utils[_0x5625('0x2')](util[_0x5625('0x3')](_0x5625('0x1b'),_0x18fdbf['uniqueid'],queues[_0x18fdbf['uniqueid']][_0x5625('0x1c')],queues[_0x18fdbf[_0x5625('0x4')]][_0x5625('0xa')]));queues[queues[_0x18fdbf['uniqueid']][_0x5625('0xa')]]=queues[_0x18fdbf[_0x5625('0x4')]];queues[queues[_0x18fdbf[_0x5625('0x4')]]['transfereduniqueid']][_0x5625('0x1d')]=0x2;delete queues[_0x18fdbf['uniqueid']];}}}catch(_0x1ec222){utils[_0x5625('0x11')](util[_0x5625('0x3')](_0x5625('0x13'),_0x18fdbf['uniqueid']),_0x1ec222);}};exports[_0x5625('0x1e')]=function(_0x300dec){try{utils[_0x5625('0xc')](util[_0x5625('0x3')]('[%s][queues][varset]',_0x300dec[_0x5625('0x4')]),_0x300dec);if(!_['isNil'](_0x300dec[_0x5625('0x1f')]['queuestatus'])&&_0x300dec['value']['toUpperCase']()!==_0x5625('0x20')){if(!_['isNil'](queues[_0x300dec[_0x5625('0x4')]])){queues[_0x300dec['uniqueid']][_0x5625('0x14')]=![];queues[_0x300dec[_0x5625('0x4')]]['queuecallerabandonAt']=null;queues[_0x300dec[_0x5625('0x4')]][_0x5625('0x21')]=!![];queues[_0x300dec[_0x5625('0x4')]]['queuecallerexitAt']=utils[_0x5625('0x17')]();queues[_0x300dec[_0x5625('0x4')]]['queuecallerexitreason']=_0x300dec['value'][_0x5625('0x22')]();utils['info'](util[_0x5625('0x3')](_0x5625('0x23'),_0x300dec[_0x5625('0x4')],queues[_0x300dec[_0x5625('0x4')]][_0x5625('0x1c')],_0x300dec[_0x5625('0x24')],queues[_0x300dec[_0x5625('0x4')]][_0x5625('0x18')]));writeDB(queues[_0x300dec[_0x5625('0x4')]]);}}else if(!_[_0x5625('0x25')](_0x300dec[_0x5625('0x1f')]['queueposition'])){if(!_['isNil'](queues[_0x300dec['uniqueid']])&&!queues[_0x300dec[_0x5625('0x4')]][_0x5625('0x14')]){queues[_0x300dec[_0x5625('0x4')]][_0x5625('0x14')]=![];queues[_0x300dec[_0x5625('0x4')]]['queuecallerabandonAt']=null;queues[_0x300dec['uniqueid']][_0x5625('0x21')]=!![];queues[_0x300dec[_0x5625('0x4')]][_0x5625('0x26')]=utils['now']();queues[_0x300dec[_0x5625('0x4')]][_0x5625('0x18')]=_0x5625('0x27');utils['info'](util[_0x5625('0x3')](_0x5625('0x28'),_0x300dec[_0x5625('0x4')],queues[_0x300dec[_0x5625('0x4')]][_0x5625('0x1c')],_0x300dec[_0x5625('0x24')],queues[_0x300dec[_0x5625('0x4')]][_0x5625('0x18')]));}}}catch(_0x2a81bc){utils[_0x5625('0x11')](util[_0x5625('0x3')](_0x5625('0x29'),_0x300dec['uniqueid']),_0x2a81bc);}};exports[_0x5625('0x14')]=function(_0x5e4306){try{if(!_[_0x5625('0x25')](queues[_0x5e4306['uniqueid']])){utils['debug'](util[_0x5625('0x3')]('[%s][queues][queuecallerabandon]',_0x5e4306[_0x5625('0x4')]),_0x5e4306);queues[_0x5e4306[_0x5625('0x4')]][_0x5625('0x21')]=![];queues[_0x5e4306['uniqueid']][_0x5625('0x26')]=null;queues[_0x5e4306[_0x5625('0x4')]][_0x5625('0x14')]=!![];queues[_0x5e4306[_0x5625('0x4')]][_0x5625('0x2a')]=utils['now']();queues[_0x5e4306[_0x5625('0x4')]][_0x5625('0x18')]='ABANDONED';utils[_0x5625('0x2')](util[_0x5625('0x3')](_0x5625('0x2b'),_0x5e4306['uniqueid'],queues[_0x5e4306[_0x5625('0x4')]][_0x5625('0x1c')],queues[_0x5e4306[_0x5625('0x4')]][_0x5625('0x18')]));}}catch(_0x4b768c){utils[_0x5625('0x11')](util['format'](_0x5625('0x2c'),_0x5e4306[_0x5625('0x4')]),_0x4b768c);}};exports[_0x5625('0x2d')]=function(_0x2976f0){try{if(!_[_0x5625('0x25')](queues[_0x2976f0[_0x5625('0x4')]])){utils[_0x5625('0xc')](util[_0x5625('0x3')]('[%s][queues][queuecallerleave]',_0x2976f0[_0x5625('0x4')]),_0x2976f0);utils['info'](util['format'](_0x5625('0x2e'),_0x2976f0[_0x5625('0x4')],queues[_0x2976f0[_0x5625('0x4')]][_0x5625('0x1c')],_0x2976f0[_0x5625('0x2f')],_0x2976f0[_0x5625('0x30')]));queues[_0x2976f0[_0x5625('0x4')]][_0x5625('0x2d')]=!![];queues[_0x2976f0[_0x5625('0x4')]][_0x5625('0x31')]=utils['now']();queues[_0x2976f0[_0x5625('0x4')]]['holdtime']=utils[_0x5625('0x32')](queues[_0x2976f0['uniqueid']][_0x5625('0x31')],queues[_0x2976f0['uniqueid']]['queuecallerjoinAt']);queues[_0x2976f0[_0x5625('0x4')]]['position']=_0x2976f0[_0x5625('0xf')];queues[_0x2976f0[_0x5625('0x4')]]['count']=_0x2976f0[_0x5625('0x33')];queues[_0x2976f0[_0x5625('0x4')]][_0x5625('0x2f')]=_0x2976f0[_0x5625('0x2f')];queues[_0x2976f0[_0x5625('0x4')]][_0x5625('0x30')]=_0x2976f0[_0x5625('0x30')];}}catch(_0x3ebf94){utils[_0x5625('0x11')](util[_0x5625('0x3')](_0x5625('0x34'),_0x2976f0['uniqueid']),_0x3ebf94);}};exports['agentconnect']=function(_0x161f08){try{if(!_['isNil'](queues[_0x161f08[_0x5625('0x4')]])){utils['debug'](util['format']('[%s][queues][agentconnect]',_0x161f08['uniqueid']),_0x161f08);utils['info'](util[_0x5625('0x3')](_0x5625('0x35'),_0x161f08[_0x5625('0x4')],queues[_0x161f08[_0x5625('0x4')]]['name'],_0x161f08[_0x5625('0x36')],_0x161f08[_0x5625('0x37')]));queues[_0x161f08['uniqueid']][_0x5625('0x14')]=![];queues[_0x161f08[_0x5625('0x4')]][_0x5625('0x14')]=![];queues[_0x161f08[_0x5625('0x4')]][_0x5625('0x2a')]=null;queues[_0x161f08[_0x5625('0x4')]][_0x5625('0x21')]=![];queues[_0x161f08[_0x5625('0x4')]][_0x5625('0x18')]=null;queues[_0x161f08[_0x5625('0x4')]][_0x5625('0x26')]=null;queues[_0x161f08[_0x5625('0x4')]]['assigned']=!![];queues[_0x161f08['uniqueid']][_0x5625('0x38')]=_0x161f08[_0x5625('0x37')];queues[_0x161f08['uniqueid']][_0x5625('0x39')]=_0x161f08['membername'];}}catch(_0x21b078){utils[_0x5625('0x11')](util['format'](_0x5625('0x3a'),_0x161f08[_0x5625('0x4')]),_0x21b078);}};exports[_0x5625('0x3b')]=function(_0x2e1260){try{if(!_[_0x5625('0x25')](queues[_0x2e1260[_0x5625('0x4')]])){if(queues[_0x2e1260['uniqueid']][_0x5625('0x31')]){utils[_0x5625('0xc')](util[_0x5625('0x3')](_0x5625('0x3c'),_0x2e1260[_0x5625('0x4')]),_0x2e1260);queues[_0x2e1260[_0x5625('0x4')]][_0x5625('0x14')]=![];queues[_0x2e1260['uniqueid']][_0x5625('0x14')]=![];queues[_0x2e1260[_0x5625('0x4')]][_0x5625('0x2a')]=null;queues[_0x2e1260[_0x5625('0x4')]]['queuecallerexit']=![];queues[_0x2e1260['uniqueid']][_0x5625('0x26')]=null;queues[_0x2e1260[_0x5625('0x4')]][_0x5625('0x3d')]=!![];queues[_0x2e1260['uniqueid']]['lastAssignedTo']=_0x2e1260[_0x5625('0x36')];queues[_0x2e1260[_0x5625('0x4')]][_0x5625('0x15')]=!![];queues[_0x2e1260[_0x5625('0x4')]][_0x5625('0x16')]=utils[_0x5625('0x17')]();if(_0x2e1260[_0x5625('0x3e')]==_0x5625('0x3f')){if(!queues[_0x2e1260[_0x5625('0x4')]]['transfer']){queues[_0x2e1260['uniqueid']][_0x5625('0x18')]=_0x5625('0x40');}}else{queues[_0x2e1260['uniqueid']][_0x5625('0x18')]=_0x5625('0x41')+_0x2e1260[_0x5625('0x3e')][_0x5625('0x22')]();}utils['info'](util['format']('[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s',_0x2e1260[_0x5625('0x4')],queues[_0x2e1260['uniqueid']][_0x5625('0x1c')],_0x2e1260['membername'],queues[_0x2e1260[_0x5625('0x4')]][_0x5625('0x18')]));writeDB(queues[_0x2e1260[_0x5625('0x4')]]);}}}catch(_0xe36281){utils[_0x5625('0x11')](util[_0x5625('0x3')](_0x5625('0x3c'),_0x2e1260[_0x5625('0x4')]),_0xe36281);}};exports[_0x5625('0x42')]=function(_0x3ea5a6){try{if(!_[_0x5625('0x25')](queues[_0x3ea5a6[_0x5625('0x43')]])){utils[_0x5625('0xc')](util[_0x5625('0x3')](_0x5625('0x44'),_0x3ea5a6[_0x5625('0x4')]),_0x3ea5a6);queues[_0x3ea5a6['transfereeuniqueid']]['transfer']=!![];queues[_0x3ea5a6['transfereeuniqueid']][_0x5625('0x45')]=_0x5625('0x46');queues[_0x3ea5a6['transfereeuniqueid']]['transferexten']=_0x3ea5a6[_0x5625('0x47')];queues[_0x3ea5a6[_0x5625('0x43')]][_0x5625('0x48')]=_0x3ea5a6[_0x5625('0x43')];queues[_0x3ea5a6[_0x5625('0x43')]]['queuecallerexitreason']=_0x5625('0x49');utils[_0x5625('0x2')](util['format'](_0x5625('0x4a'),_0x3ea5a6[_0x5625('0x4')],queues[_0x3ea5a6[_0x5625('0x43')]][_0x5625('0x1c')],_0x3ea5a6['transfereeuniqueid'],_0x3ea5a6[_0x5625('0x47')]));}}catch(_0x1b9634){utils['error'](util[_0x5625('0x3')](_0x5625('0x44'),_0x3ea5a6['uniqueid']),_0x1b9634);}};exports['attendedtransfer']=function(_0x143f73){try{utils[_0x5625('0xc')](util[_0x5625('0x3')]('[%s][queues][attendedtransfer]',_0x143f73[_0x5625('0x4b')]),_0x143f73);if(_0x143f73[_0x5625('0x4b')]==_0x143f73[_0x5625('0x4c')]){if(!_['isNil'](queues[_0x143f73[_0x5625('0x4d')]])){utils[_0x5625('0x2')](util[_0x5625('0x3')](_0x5625('0x4e'),_0x143f73[_0x5625('0x4b')],queues[_0x143f73[_0x5625('0x4d')]][_0x5625('0x1c')],_0x143f73[_0x5625('0x4f')]));queues[_0x143f73['secondtransfererlinkedid']][_0x5625('0x3f')]=!![];queues[_0x143f73[_0x5625('0x4d')]]['transfertype']=_0x5625('0x50');queues[_0x143f73['secondtransfererlinkedid']][_0x5625('0x51')]=_0x143f73[_0x5625('0x4f')];queues[_0x143f73[_0x5625('0x4d')]][_0x5625('0x48')]=_0x143f73['origtransfereruniqueid'];queues[_0x143f73[_0x5625('0x4d')]][_0x5625('0x18')]='ATTENDEDTRANSFER';}if(!_['isNil'](queues[_0x143f73[_0x5625('0x4c')]])){if(_0x143f73[_0x5625('0x52')]&&queues[_0x143f73[_0x5625('0x52')]]){queues[_0x143f73['transfereelinkedid']][_0x5625('0x1d')]=0x1;queues[_0x143f73['transfereeuniqueid']]=_[_0x5625('0x53')](queues[_0x143f73[_0x5625('0x52')]]);queues[_0x143f73['transfereeuniqueid']]['transfereduniqueid']=_0x143f73[_0x5625('0x54')];queues[_0x143f73[_0x5625('0x43')]][_0x5625('0x1d')]=0x2;queues[_0x143f73['transfereeuniqueid']][_0x5625('0x55')]=queues[_0x143f73[_0x5625('0x4d')]][_0x5625('0x55')];queues[_0x143f73[_0x5625('0x43')]][_0x5625('0x56')]=queues[_0x143f73[_0x5625('0x4d')]][_0x5625('0x56')];queues[_0x143f73[_0x5625('0x43')]][_0x5625('0x57')]=utils[_0x5625('0x17')]();queues[_0x143f73[_0x5625('0x43')]][_0x5625('0x31')]=utils[_0x5625('0x17')]();queues[_0x143f73['transfereeuniqueid']][_0x5625('0x58')]=0x0;queues[_0x143f73[_0x5625('0x43')]]['mohtime']=0x0;utils[_0x5625('0x2')](util[_0x5625('0x3')](_0x5625('0x59'),_0x143f73[_0x5625('0x4b')],queues[_0x143f73[_0x5625('0x43')]][_0x5625('0x1c')],queues[_0x143f73[_0x5625('0x43')]][_0x5625('0x55')],queues[_0x143f73[_0x5625('0x43')]][_0x5625('0x56')]));}else{utils['info'](util[_0x5625('0x3')](_0x5625('0x5a'),_0x143f73[_0x5625('0x4b')],queues[_0x143f73[_0x5625('0x4c')]]['name'],_0x143f73['secondtransfererlinkedid']));queues[_0x143f73[_0x5625('0x4c')]][_0x5625('0xa')]=_0x143f73[_0x5625('0x4d')];}}}else if(_0x143f73[_0x5625('0x5b')]==_0x143f73['secondtransfererlinkedid']){if(!_['isNil'](queues[_0x143f73[_0x5625('0x4c')]])){utils[_0x5625('0x2')](util['format'](_0x5625('0x5c'),_0x143f73[_0x5625('0x4b')],queues[_0x143f73[_0x5625('0x4c')]][_0x5625('0x1c')],_0x143f73['secondtransfereruniqueid'],_0x143f73[_0x5625('0x5d')]));queues[_0x143f73[_0x5625('0x4c')]][_0x5625('0x3f')]=!![];queues[_0x143f73[_0x5625('0x4c')]][_0x5625('0x45')]=_0x5625('0x50');queues[_0x143f73['origtransfererlinkedid']][_0x5625('0x51')]=_0x143f73['secondtransfererexten'];queues[_0x143f73[_0x5625('0x4c')]]['transferuniqueid']=_0x143f73['secondtransfereruniqueid'];queues[_0x143f73[_0x5625('0x4c')]]['queuecallerexitreason']=_0x5625('0x5e');}if(!_['isNil'](queues[_0x143f73[_0x5625('0x4d')]])){if(_0x143f73[_0x5625('0x5f')]&&queues[_0x143f73[_0x5625('0x5f')]]){queues[_0x143f73[_0x5625('0x5f')]][_0x5625('0x1d')]=0x1;queues[_0x143f73[_0x5625('0x54')]]=_[_0x5625('0x53')](queues[_0x143f73[_0x5625('0x5f')]]);queues[_0x143f73[_0x5625('0x54')]][_0x5625('0xa')]=_0x143f73[_0x5625('0x54')];queues[_0x143f73['transfertargetuniqueid']][_0x5625('0x1d')]=0x2;queues[_0x143f73[_0x5625('0x54')]]['calleridnum']=queues[_0x143f73[_0x5625('0x4c')]][_0x5625('0x55')];queues[_0x143f73[_0x5625('0x54')]][_0x5625('0x56')]=queues[_0x143f73[_0x5625('0x4c')]]['calleridname'];queues[_0x143f73[_0x5625('0x54')]][_0x5625('0x57')]=utils['now']();queues[_0x143f73[_0x5625('0x54')]][_0x5625('0x31')]=utils[_0x5625('0x17')]();queues[_0x143f73[_0x5625('0x54')]][_0x5625('0x58')]=0x0;queues[_0x143f73[_0x5625('0x54')]][_0x5625('0x60')]=0x0;utils['info'](util[_0x5625('0x3')](_0x5625('0x61'),_0x143f73[_0x5625('0x4b')],queues[_0x143f73[_0x5625('0x54')]][_0x5625('0x1c')],queues[_0x143f73[_0x5625('0x54')]][_0x5625('0xa')],queues[_0x143f73[_0x5625('0x54')]]['calleridnum'],queues[_0x143f73[_0x5625('0x54')]][_0x5625('0x56')]));}else{utils['info'](util[_0x5625('0x3')](_0x5625('0x5a'),_0x143f73['origtransfereruniqueid'],queues[_0x143f73['secondtransfererlinkedid']][_0x5625('0x1c')],_0x143f73[_0x5625('0x4c')]));queues[_0x143f73[_0x5625('0x4d')]][_0x5625('0xa')]=_0x143f73[_0x5625('0x4c')];}}}}catch(_0x2bcdbf){utils[_0x5625('0x11')](util[_0x5625('0x3')](_0x5625('0x62'),_0x143f73[_0x5625('0x4b')]),_0x2bcdbf);}};exports['musiconholdstart']=function(_0x37b370){try{if(!_[_0x5625('0x25')](queues[_0x37b370['uniqueid']])){utils[_0x5625('0xc')](util[_0x5625('0x3')]('[%s][queues][musiconholdstart]',_0x37b370[_0x5625('0x4')]),_0x37b370);queues[_0x37b370[_0x5625('0x4')]][_0x5625('0x63')]=utils[_0x5625('0x17')]();utils['info'](util[_0x5625('0x3')](_0x5625('0x64'),_0x37b370[_0x5625('0x4')],queues[_0x37b370['uniqueid']][_0x5625('0x1c')],queues[_0x37b370[_0x5625('0x4')]]['musiconholdstartAt']));}}catch(_0x23a716){utils[_0x5625('0x11')](util[_0x5625('0x3')](_0x5625('0x65'),_0x37b370[_0x5625('0x4')]),_0x23a716);}};exports[_0x5625('0x66')]=function(_0x594974){try{if(!_['isNil'](queues[_0x594974[_0x5625('0x4')]])){if(!_['isNil'](queues[_0x594974[_0x5625('0x4')]][_0x5625('0x63')])){utils[_0x5625('0xc')](util['format'](_0x5625('0x67'),_0x594974[_0x5625('0x4')]),_0x594974);queues[_0x594974[_0x5625('0x4')]][_0x5625('0x60')]+=utils['diffTime'](utils[_0x5625('0x17')](),queues[_0x594974['uniqueid']][_0x5625('0x63')]);utils[_0x5625('0x2')](util[_0x5625('0x3')](_0x5625('0x68'),_0x594974[_0x5625('0x4')],queues[_0x594974[_0x5625('0x4')]][_0x5625('0x1c')],queues[_0x594974[_0x5625('0x4')]][_0x5625('0x60')]));delete queues[_0x594974[_0x5625('0x4')]][_0x5625('0x63')];}}}catch(_0x322080){utils[_0x5625('0x11')](util['format'](_0x5625('0x67'),_0x594974['uniqueid']),_0x322080);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 770a759..830d913 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 _0xf1a3=['format','[%s][recordings][newchannel]','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','newstate','[%s][recordings][newstate]','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','error','varset','variable','mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','.wav49','replace','find','monitors','push','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','type','outbound','forEach','clone','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','appdata','application','toLowerCase','set','startsWith','cdr','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','lodash','util','./utils','info','[%s][recordings][writeDB]','uniqueid','accountcode','getUserByInternal','then','name','UserId','request','CreateVoiceRecording','debug'];(function(_0x33e923,_0x18fcbd){var _0x2ace09=function(_0x681474){while(--_0x681474){_0x33e923['push'](_0x33e923['shift']());}};_0x2ace09(++_0x18fcbd);}(_0xf1a3,0x78));var _0x3f1a=function(_0x27604f,_0x5ae336){_0x27604f=_0x27604f-0x0;var _0x40d189=_0xf1a3[_0x27604f];return _0x40d189;};'use strict';var _=require(_0x3f1a('0x0'));var util=require(_0x3f1a('0x1'));var utils=require(_0x3f1a('0x2'));var recordings={};function writeDB(_0x16a3a1){utils[_0x3f1a('0x3')](util['format'](_0x3f1a('0x4'),_0x16a3a1[_0x3f1a('0x5')]));if(_0x16a3a1[_0x3f1a('0x6')]){utils[_0x3f1a('0x7')](_0x16a3a1[_0x3f1a('0x6')])[_0x3f1a('0x8')](function(_0x4017a9){if(_0x4017a9){_0x16a3a1['membername']=_0x4017a9[_0x3f1a('0x9')];_0x16a3a1[_0x3f1a('0xa')]=_0x4017a9['id'];}utils[_0x3f1a('0xb')](_0x3f1a('0xc'),_0x16a3a1);});}else{utils[_0x3f1a('0xb')](_0x3f1a('0xc'),_0x16a3a1);}}exports['newchannel']=function(_0x8ebcaf){try{utils[_0x3f1a('0xd')](util[_0x3f1a('0xe')](_0x3f1a('0xf'),_0x8ebcaf[_0x3f1a('0x5')]),_0x8ebcaf);if(_0x8ebcaf[_0x3f1a('0x5')]==_0x8ebcaf[_0x3f1a('0x10')]){utils[_0x3f1a('0x3')](util[_0x3f1a('0xe')](_0x3f1a('0x11'),_0x8ebcaf[_0x3f1a('0x5')],_0x8ebcaf[_0x3f1a('0x12')],_0x8ebcaf['exten']));recordings[_0x8ebcaf[_0x3f1a('0x5')]]={'uniqueid':_0x8ebcaf[_0x3f1a('0x5')],'accountcode':_0x8ebcaf['accountcode'],'exten':_0x8ebcaf[_0x3f1a('0x13')],'context':_0x8ebcaf[_0x3f1a('0x12')],'channel':_0x8ebcaf[_0x3f1a('0x14')],'monitors':[]};}}catch(_0xae874a){utils['error'](util[_0x3f1a('0xe')](_0x3f1a('0xf'),_0x8ebcaf[_0x3f1a('0x5')]),_0xae874a);}};exports[_0x3f1a('0x15')]=function(_0x5d57e0){try{utils[_0x3f1a('0xd')](util[_0x3f1a('0xe')](_0x3f1a('0x16'),_0x5d57e0[_0x3f1a('0x5')]),_0x5d57e0);if(!_[_0x3f1a('0x17')](recordings[_0x5d57e0[_0x3f1a('0x5')]])&&_0x5d57e0[_0x3f1a('0x18')]==0x6){utils['info'](util[_0x3f1a('0xe')](_0x3f1a('0x19'),_0x5d57e0['uniqueid'],_0x5d57e0[_0x3f1a('0x12')],_0x5d57e0['channel']));}else if(!_['isNil'](recordings[_0x5d57e0['linkedid']])&&_0x5d57e0[_0x3f1a('0x18')]==0x6&&_0x5d57e0[_0x3f1a('0x12')]!=_0x3f1a('0x1a')){utils[_0x3f1a('0x3')](util['format'](_0x3f1a('0x1b'),_0x5d57e0[_0x3f1a('0x5')],_0x5d57e0[_0x3f1a('0x10')],_0x5d57e0[_0x3f1a('0x12')],_0x5d57e0['channel']));recordings[_0x5d57e0[_0x3f1a('0x10')]][_0x3f1a('0x6')]=_0x5d57e0[_0x3f1a('0x6')];}}catch(_0x311118){utils[_0x3f1a('0x1c')](util[_0x3f1a('0xe')]('[%s][recordings][newstate]',_0x5d57e0[_0x3f1a('0x5')]),_0x311118);}};exports[_0x3f1a('0x1d')]=function(_0x482a72){try{if(!_['isNil'](_0x482a72[_0x3f1a('0x1e')])&&!_['isNil'](_0x482a72[_0x3f1a('0x1e')][_0x3f1a('0x1f')])){utils['debug'](util[_0x3f1a('0xe')](_0x3f1a('0x20'),_0x482a72[_0x3f1a('0x5')]),_0x482a72);utils[_0x3f1a('0x3')](util[_0x3f1a('0xe')](_0x3f1a('0x21'),_0x482a72[_0x3f1a('0x5')],_0x482a72[_0x3f1a('0x1e')],_0x482a72[_0x3f1a('0x22')]));if(_['endsWith'](_0x482a72[_0x3f1a('0x22')],_0x3f1a('0x23'))){_0x482a72[_0x3f1a('0x22')]=_0x482a72[_0x3f1a('0x22')][_0x3f1a('0x24')](_0x3f1a('0x23'),'.WAV');}if(recordings[_0x482a72['linkedid']]){var _0xbad88d=_[_0x3f1a('0x25')](recordings[_0x482a72[_0x3f1a('0x10')]][_0x3f1a('0x26')],{'value':_0x482a72[_0x3f1a('0x22')]});if(_[_0x3f1a('0x17')](_0xbad88d)){recordings[_0x482a72[_0x3f1a('0x10')]]['monitors'][_0x3f1a('0x27')]({'value':_0x482a72['value']});}}}}catch(_0x54d63e){utils['error'](util[_0x3f1a('0xe')]('[%s][recordings][varset]',_0x482a72[_0x3f1a('0x5')]),_0x54d63e);}};exports[_0x3f1a('0x28')]=function(_0x492ef7){try{if(!_[_0x3f1a('0x17')](recordings[_0x492ef7['uniqueid']])){utils[_0x3f1a('0xd')](util[_0x3f1a('0xe')](_0x3f1a('0x29'),_0x492ef7[_0x3f1a('0x5')]),_0x492ef7);utils['info'](util[_0x3f1a('0xe')](_0x3f1a('0x2a'),_0x492ef7[_0x3f1a('0x5')],_0x492ef7[_0x3f1a('0x2b')],_0x492ef7[_0x3f1a('0x2c')],_0x492ef7[_0x3f1a('0x2d')]));recordings[_0x492ef7[_0x3f1a('0x5')]][_0x3f1a('0x2b')]=_0x492ef7[_0x3f1a('0x2b')];recordings[_0x492ef7[_0x3f1a('0x5')]][_0x3f1a('0x2c')]=_0x492ef7[_0x3f1a('0x2c')];recordings[_0x492ef7['uniqueid']][_0x3f1a('0x2e')]=_0x492ef7[_0x3f1a('0x2e')];recordings[_0x492ef7[_0x3f1a('0x5')]][_0x3f1a('0x2f')]=_0x492ef7[_0x3f1a('0x2f')];if(recordings[_0x492ef7[_0x3f1a('0x5')]][_0x3f1a('0x30')]==_0x3f1a('0x31')&&recordings[_0x492ef7[_0x3f1a('0x5')]]['accountcode']){recordings[_0x492ef7['uniqueid']][_0x3f1a('0x2e')]=recordings[_0x492ef7[_0x3f1a('0x5')]][_0x3f1a('0x6')];recordings[_0x492ef7[_0x3f1a('0x5')]][_0x3f1a('0x2f')]='';}recordings[_0x492ef7[_0x3f1a('0x5')]]['monitors'][_0x3f1a('0x32')](function(_0x47f7ab){var _0x1cdaff=_[_0x3f1a('0x33')](recordings[_0x492ef7['uniqueid']]);_0x1cdaff[_0x3f1a('0x22')]=_0x47f7ab[_0x3f1a('0x22')];writeDB(_0x1cdaff);});delete recordings[_0x492ef7[_0x3f1a('0x5')]];}}catch(_0xf5124f){utils['error'](util[_0x3f1a('0xe')](_0x3f1a('0x29'),_0x492ef7[_0x3f1a('0x5')]),_0xf5124f);}};exports[_0x3f1a('0x34')]=function(_0x915e30){try{if(!_[_0x3f1a('0x17')](recordings[_0x915e30[_0x3f1a('0x5')]])){utils[_0x3f1a('0xd')](util['format'](_0x3f1a('0x35'),_0x915e30[_0x3f1a('0x5')]),_0x915e30);utils['info'](util[_0x3f1a('0xe')](_0x3f1a('0x36'),_0x915e30[_0x3f1a('0x5')],_0x915e30['application'],_0x915e30[_0x3f1a('0x37')]));if(_0x915e30[_0x3f1a('0x38')][_0x3f1a('0x39')]()==_0x3f1a('0x3a')&&_[_0x3f1a('0x3b')](_0x915e30[_0x3f1a('0x37')][_0x3f1a('0x39')](),_0x3f1a('0x3c'))){var _0x19dcde=_0x915e30[_0x3f1a('0x37')]['split']('=');var _0x1cf6ef=_0x19dcde[0x0][_0x3f1a('0x3d')](_0x19dcde[0x0]['lastIndexOf']('(')+0x1,_0x19dcde[0x0][_0x3f1a('0x3e')](')'));var _0x5d066a=_0x19dcde[0x1];recordings[_0x915e30['uniqueid']][_0x1cf6ef]=_0x5d066a;}}}catch(_0x14cfa8){utils['error'](util['format'](_0x3f1a('0x35'),_0x915e30[_0x3f1a('0x5')]),_0x14cfa8);}};exports[_0x3f1a('0x3f')]=function(_0x39c274){try{if(!_['isNil'](recordings[_0x39c274['uniqueid']])){utils[_0x3f1a('0xd')](util[_0x3f1a('0xe')](_0x3f1a('0x40'),_0x39c274[_0x3f1a('0x5')]),_0x39c274);utils[_0x3f1a('0x3')](util[_0x3f1a('0xe')](_0x3f1a('0x41'),_0x39c274[_0x3f1a('0x5')],_0x39c274[_0x3f1a('0x42')]));recordings[_0x39c274[_0x3f1a('0x5')]]['queue']=_0x39c274[_0x3f1a('0x42')];}}catch(_0x2df694){utils[_0x3f1a('0x1c')](util['format']('[%s][recordings][queuecallerjoin]',_0x39c274['uniqueid']),_0x2df694);}}; \ No newline at end of file +var _0x96ed=['[%s][recordings][newchannel]','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','exten','error','[%s][recordings][newstate]','isNil','[%s][recordings][newstate]\x20context:%s\x20channel:%s','context','channel','linkedid','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','varset','variable','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','.wav49','replace','find','monitors','push','[%s][recordings][varset]','hangup','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridname','cause-txt','calleridnum','connectedlinename','type','outbound','forEach','clone','newexten','[%s][recordings][newexten]','application','appdata','toLowerCase','startsWith','cdr','split','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','util','./utils','info','format','[%s][recordings][writeDB]','uniqueid','accountcode','getUserByInternal','then','membername','name','CreateVoiceRecording','request','debug'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x96ed,0x6c));var _0xd96e=function(_0x3a600e,_0x1a2a7c){_0x3a600e=_0x3a600e-0x0;var _0x51ffce=_0x96ed[_0x3a600e];return _0x51ffce;};'use strict';var _=require('lodash');var util=require(_0xd96e('0x0'));var utils=require(_0xd96e('0x1'));var recordings={};function writeDB(_0x444891){utils[_0xd96e('0x2')](util[_0xd96e('0x3')](_0xd96e('0x4'),_0x444891[_0xd96e('0x5')]));if(_0x444891[_0xd96e('0x6')]){utils[_0xd96e('0x7')](_0x444891[_0xd96e('0x6')])[_0xd96e('0x8')](function(_0x579a6a){if(_0x579a6a){_0x444891[_0xd96e('0x9')]=_0x579a6a[_0xd96e('0xa')];_0x444891['UserId']=_0x579a6a['id'];}utils['request'](_0xd96e('0xb'),_0x444891);});}else{utils[_0xd96e('0xc')](_0xd96e('0xb'),_0x444891);}}exports['newchannel']=function(_0x1bffbc){try{utils[_0xd96e('0xd')](util[_0xd96e('0x3')](_0xd96e('0xe'),_0x1bffbc['uniqueid']),_0x1bffbc);if(_0x1bffbc[_0xd96e('0x5')]==_0x1bffbc['linkedid']){utils[_0xd96e('0x2')](util[_0xd96e('0x3')](_0xd96e('0xf'),_0x1bffbc[_0xd96e('0x5')],_0x1bffbc['context'],_0x1bffbc[_0xd96e('0x10')]));recordings[_0x1bffbc[_0xd96e('0x5')]]={'uniqueid':_0x1bffbc[_0xd96e('0x5')],'accountcode':_0x1bffbc['accountcode'],'exten':_0x1bffbc[_0xd96e('0x10')],'context':_0x1bffbc['context'],'channel':_0x1bffbc['channel'],'monitors':[]};}}catch(_0x5a59b0){utils[_0xd96e('0x11')](util[_0xd96e('0x3')](_0xd96e('0xe'),_0x1bffbc['uniqueid']),_0x5a59b0);}};exports['newstate']=function(_0x52ea67){try{utils[_0xd96e('0xd')](util[_0xd96e('0x3')](_0xd96e('0x12'),_0x52ea67[_0xd96e('0x5')]),_0x52ea67);if(!_[_0xd96e('0x13')](recordings[_0x52ea67[_0xd96e('0x5')]])&&_0x52ea67['channelstate']==0x6){utils['info'](util[_0xd96e('0x3')](_0xd96e('0x14'),_0x52ea67[_0xd96e('0x5')],_0x52ea67[_0xd96e('0x15')],_0x52ea67[_0xd96e('0x16')]));}else if(!_[_0xd96e('0x13')](recordings[_0x52ea67[_0xd96e('0x17')]])&&_0x52ea67['channelstate']==0x6&&_0x52ea67[_0xd96e('0x15')]!=_0xd96e('0x18')){utils[_0xd96e('0x2')](util[_0xd96e('0x3')](_0xd96e('0x19'),_0x52ea67['uniqueid'],_0x52ea67[_0xd96e('0x17')],_0x52ea67[_0xd96e('0x15')],_0x52ea67[_0xd96e('0x16')]));recordings[_0x52ea67[_0xd96e('0x17')]][_0xd96e('0x6')]=_0x52ea67[_0xd96e('0x6')];}}catch(_0x4502dc){utils['error'](util['format'](_0xd96e('0x12'),_0x52ea67[_0xd96e('0x5')]),_0x4502dc);}};exports[_0xd96e('0x1a')]=function(_0x108d84){try{if(!_['isNil'](_0x108d84['variable'])&&!_[_0xd96e('0x13')](_0x108d84[_0xd96e('0x1b')]['mixmonitor_filename'])){utils[_0xd96e('0xd')](util[_0xd96e('0x3')]('[%s][recordings][varset]',_0x108d84[_0xd96e('0x5')]),_0x108d84);utils[_0xd96e('0x2')](util[_0xd96e('0x3')](_0xd96e('0x1c'),_0x108d84[_0xd96e('0x5')],_0x108d84[_0xd96e('0x1b')],_0x108d84[_0xd96e('0x1d')]));if(_[_0xd96e('0x1e')](_0x108d84[_0xd96e('0x1d')],_0xd96e('0x1f'))){_0x108d84[_0xd96e('0x1d')]=_0x108d84['value'][_0xd96e('0x20')](_0xd96e('0x1f'),'.WAV');}if(recordings[_0x108d84[_0xd96e('0x17')]]){var _0x7e428b=_[_0xd96e('0x21')](recordings[_0x108d84[_0xd96e('0x17')]]['monitors'],{'value':_0x108d84[_0xd96e('0x1d')]});if(_[_0xd96e('0x13')](_0x7e428b)){recordings[_0x108d84[_0xd96e('0x17')]][_0xd96e('0x22')][_0xd96e('0x23')]({'value':_0x108d84[_0xd96e('0x1d')]});}}}}catch(_0x431745){utils[_0xd96e('0x11')](util[_0xd96e('0x3')](_0xd96e('0x24'),_0x108d84[_0xd96e('0x5')]),_0x431745);}};exports[_0xd96e('0x25')]=function(_0x222f14){try{if(!_['isNil'](recordings[_0x222f14[_0xd96e('0x5')]])){utils[_0xd96e('0xd')](util['format']('[%s][recordings][hangup]',_0x222f14[_0xd96e('0x5')]),_0x222f14);utils[_0xd96e('0x2')](util[_0xd96e('0x3')](_0xd96e('0x26'),_0x222f14[_0xd96e('0x5')],_0x222f14['calleridnum'],_0x222f14[_0xd96e('0x27')],_0x222f14[_0xd96e('0x28')]));recordings[_0x222f14[_0xd96e('0x5')]][_0xd96e('0x29')]=_0x222f14[_0xd96e('0x29')];recordings[_0x222f14[_0xd96e('0x5')]][_0xd96e('0x27')]=_0x222f14['calleridname'];recordings[_0x222f14[_0xd96e('0x5')]]['connectedlinenum']=_0x222f14['connectedlinenum'];recordings[_0x222f14['uniqueid']][_0xd96e('0x2a')]=_0x222f14['connectedlinename'];if(recordings[_0x222f14['uniqueid']][_0xd96e('0x2b')]==_0xd96e('0x2c')&&recordings[_0x222f14[_0xd96e('0x5')]]['accountcode']){recordings[_0x222f14['uniqueid']]['connectedlinenum']=recordings[_0x222f14[_0xd96e('0x5')]][_0xd96e('0x6')];recordings[_0x222f14['uniqueid']][_0xd96e('0x2a')]='';}recordings[_0x222f14[_0xd96e('0x5')]]['monitors'][_0xd96e('0x2d')](function(_0x452563){var _0xf92c9a=_[_0xd96e('0x2e')](recordings[_0x222f14[_0xd96e('0x5')]]);_0xf92c9a[_0xd96e('0x1d')]=_0x452563['value'];writeDB(_0xf92c9a);});delete recordings[_0x222f14[_0xd96e('0x5')]];}}catch(_0x413ff6){utils['error'](util[_0xd96e('0x3')]('[%s][recordings][hangup]',_0x222f14[_0xd96e('0x5')]),_0x413ff6);}};exports[_0xd96e('0x2f')]=function(_0x479945){try{if(!_[_0xd96e('0x13')](recordings[_0x479945[_0xd96e('0x5')]])){utils[_0xd96e('0xd')](util['format'](_0xd96e('0x30'),_0x479945[_0xd96e('0x5')]),_0x479945);utils[_0xd96e('0x2')](util[_0xd96e('0x3')]('[%s][recordings][newexten]\x20application:%s\x20appdata:%s',_0x479945[_0xd96e('0x5')],_0x479945[_0xd96e('0x31')],_0x479945[_0xd96e('0x32')]));if(_0x479945[_0xd96e('0x31')][_0xd96e('0x33')]()=='set'&&_[_0xd96e('0x34')](_0x479945[_0xd96e('0x32')][_0xd96e('0x33')](),_0xd96e('0x35'))){var _0x49307d=_0x479945['appdata'][_0xd96e('0x36')]('=');var _0x1b3185=_0x49307d[0x0][_0xd96e('0x37')](_0x49307d[0x0]['lastIndexOf']('(')+0x1,_0x49307d[0x0][_0xd96e('0x38')](')'));var _0x47ffac=_0x49307d[0x1];recordings[_0x479945[_0xd96e('0x5')]][_0x1b3185]=_0x47ffac;}}}catch(_0x5f3c38){utils['error'](util[_0xd96e('0x3')](_0xd96e('0x30'),_0x479945[_0xd96e('0x5')]),_0x5f3c38);}};exports[_0xd96e('0x39')]=function(_0x560da8){try{if(!_[_0xd96e('0x13')](recordings[_0x560da8[_0xd96e('0x5')]])){utils[_0xd96e('0xd')](util[_0xd96e('0x3')](_0xd96e('0x3a'),_0x560da8[_0xd96e('0x5')]),_0x560da8);utils['info'](util['format'](_0xd96e('0x3b'),_0x560da8[_0xd96e('0x5')],_0x560da8[_0xd96e('0x3c')]));recordings[_0x560da8[_0xd96e('0x5')]]['queue']=_0x560da8[_0xd96e('0x3c')];}}catch(_0x51372f){utils[_0xd96e('0x11')](util[_0xd96e('0x3')](_0xd96e('0x3a'),_0x560da8[_0xd96e('0x5')]),_0x51372f);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index 682b5dc..8f387c8 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 _0x0e23=['type','origtransfereruniqueid','uniqueid','request','CreateVoiceTransferReport','info','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','blind','error','[%s][transfers][blindtransfer]','attendedtransfer','debug','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','assign','origtransfererchannel','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','attended','isNil','transfereechannel','transfertargetchannel','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','[%s][transfers][attendedtransfer]','lodash','format'];(function(_0x4af431,_0x4493a1){var _0x41cfff=function(_0x5ef837){while(--_0x5ef837){_0x4af431['push'](_0x4af431['shift']());}};_0x41cfff(++_0x4493a1);}(_0x0e23,0x1ea));var _0x30e2=function(_0x23088e,_0x9b50b0){_0x23088e=_0x23088e-0x0;var _0x242c4c=_0x0e23[_0x23088e];return _0x242c4c;};'use strict';var _=require(_0x30e2('0x0'));var util=require('util');var utils=require('./utils');function writeDB(_0x44cdbc){utils['info'](util[_0x30e2('0x1')]('[%s][transfers][writeDB]\x20type:%s',_0x44cdbc[_0x30e2('0x2')]==='attended'?_0x44cdbc[_0x30e2('0x3')]:_0x44cdbc[_0x30e2('0x4')],_0x44cdbc[_0x30e2('0x2')]));utils[_0x30e2('0x5')](_0x30e2('0x6'),_0x44cdbc);}exports['blindtransfer']=function(_0x29cb31){try{utils['debug'](util[_0x30e2('0x1')]('[%s][transfers][blindtransfer]',_0x29cb31[_0x30e2('0x4')]),_0x29cb31);utils[_0x30e2('0x7')](util[_0x30e2('0x1')](_0x30e2('0x8'),_0x29cb31[_0x30e2('0x4')],_0x29cb31[_0x30e2('0x9')],_0x29cb31[_0x30e2('0xa')],_0x29cb31[_0x30e2('0xb')],_0x29cb31[_0x30e2('0xc')]));_0x29cb31[_0x30e2('0x2')]=_0x30e2('0xd');writeDB(_0x29cb31);}catch(_0x382878){utils[_0x30e2('0xe')](util[_0x30e2('0x1')](_0x30e2('0xf'),_0x29cb31[_0x30e2('0x4')]),_0x382878);}};exports[_0x30e2('0x10')]=function(_0x933840){try{utils[_0x30e2('0x11')](util[_0x30e2('0x1')]('[%s][transfers][attendedtransfer]',_0x933840[_0x30e2('0x3')]),_0x933840);utils[_0x30e2('0x7')](util['format']('[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x933840[_0x30e2('0x3')],_0x933840[_0x30e2('0x12')],_0x933840[_0x30e2('0x13')],_0x933840[_0x30e2('0x14')],_0x933840[_0x30e2('0x15')]));_0x933840=_[_0x30e2('0x16')](_0x933840,{'transfererchannel':_0x933840[_0x30e2('0x17')],'transferercalleridnum':_0x933840[_0x30e2('0x12')],'transferercalleridname':_0x933840['origtransferercalleridname'],'transfererconnectedlinenum':_0x933840['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x933840[_0x30e2('0x18')],'transfereraccountcode':_0x933840[_0x30e2('0x19')],'transferercontext':_0x933840[_0x30e2('0x1a')],'transfererexten':_0x933840[_0x30e2('0x1b')],'transfererlinkedid':_0x933840[_0x30e2('0x1c')],'context':_0x933840[_0x30e2('0x1d')],'extension':_0x933840[_0x30e2('0x1e')],'type':_0x30e2('0x1f')});if(_[_0x30e2('0x20')](_0x933840[_0x30e2('0x21')])){_0x933840=_[_0x30e2('0x16')](_0x933840,{'transfereechannel':_0x933840[_0x30e2('0x22')],'transfereecalleridnum':_0x933840['transfertargetcalleridnum'],'transfereecalleridname':_0x933840[_0x30e2('0x15')],'transfereeconnectedlinenum':_0x933840['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x933840[_0x30e2('0x23')],'transfereeaccountcode':_0x933840[_0x30e2('0x24')],'transfereecontext':_0x933840[_0x30e2('0x25')],'transfereeexten':_0x933840[_0x30e2('0x26')],'transfereelinkedid':_0x933840[_0x30e2('0x27')]});}writeDB(_0x933840);}catch(_0x4b39de){utils[_0x30e2('0xe')](util['format'](_0x30e2('0x28'),_0x933840['origtransfereruniqueid']),_0x4b39de);}}; \ No newline at end of file +var _0x3b13=['blindtransfer','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','attendedtransfer','[%s][transfers][attendedtransfer]','origtransfereruniqueid','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','assign','origtransfererchannel','secondtransfererconnectedlinenum','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransferercontext','transfereechannel','transfertargetchannel','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','error','lodash','util','info','format','[%s][transfers][writeDB]\x20type:%s','type','attended','uniqueid','request'];(function(_0x3add87,_0x36e70f){var _0x43dc78=function(_0x4d5d5a){while(--_0x4d5d5a){_0x3add87['push'](_0x3add87['shift']());}};_0x43dc78(++_0x36e70f);}(_0x3b13,0x8f));var _0x33b1=function(_0x1534d4,_0x33c784){_0x1534d4=_0x1534d4-0x0;var _0x274edd=_0x3b13[_0x1534d4];return _0x274edd;};'use strict';var _=require(_0x33b1('0x0'));var util=require(_0x33b1('0x1'));var utils=require('./utils');function writeDB(_0x313550){utils[_0x33b1('0x2')](util[_0x33b1('0x3')](_0x33b1('0x4'),_0x313550[_0x33b1('0x5')]===_0x33b1('0x6')?_0x313550['origtransfereruniqueid']:_0x313550[_0x33b1('0x7')],_0x313550[_0x33b1('0x5')]));utils[_0x33b1('0x8')]('CreateVoiceTransferReport',_0x313550);}exports[_0x33b1('0x9')]=function(_0x4e7312){try{utils['debug'](util[_0x33b1('0x3')](_0x33b1('0xa'),_0x4e7312[_0x33b1('0x7')]),_0x4e7312);utils[_0x33b1('0x2')](util[_0x33b1('0x3')](_0x33b1('0xb'),_0x4e7312['uniqueid'],_0x4e7312[_0x33b1('0xc')],_0x4e7312[_0x33b1('0xd')],_0x4e7312[_0x33b1('0xe')],_0x4e7312[_0x33b1('0xf')]));_0x4e7312[_0x33b1('0x5')]='blind';writeDB(_0x4e7312);}catch(_0x267d19){utils['error'](util[_0x33b1('0x3')](_0x33b1('0xa'),_0x4e7312[_0x33b1('0x7')]),_0x267d19);}};exports[_0x33b1('0x10')]=function(_0x458c8e){try{utils['debug'](util['format'](_0x33b1('0x11'),_0x458c8e[_0x33b1('0x12')]),_0x458c8e);utils[_0x33b1('0x2')](util[_0x33b1('0x3')]('[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x458c8e[_0x33b1('0x12')],_0x458c8e[_0x33b1('0x13')],_0x458c8e[_0x33b1('0x14')],_0x458c8e[_0x33b1('0x15')],_0x458c8e[_0x33b1('0x16')]));_0x458c8e=_[_0x33b1('0x17')](_0x458c8e,{'transfererchannel':_0x458c8e[_0x33b1('0x18')],'transferercalleridnum':_0x458c8e[_0x33b1('0x13')],'transferercalleridname':_0x458c8e['origtransferercalleridname'],'transfererconnectedlinenum':_0x458c8e[_0x33b1('0x19')],'transfererconnectedlinename':_0x458c8e['secondtransfererconnectedlinename'],'transfereraccountcode':_0x458c8e[_0x33b1('0x1a')],'transferercontext':_0x458c8e[_0x33b1('0x1b')],'transfererexten':_0x458c8e[_0x33b1('0x1c')],'transfererlinkedid':_0x458c8e['origtransfererlinkedid'],'context':_0x458c8e[_0x33b1('0x1d')],'extension':_0x458c8e['origtransfererexten'],'type':_0x33b1('0x6')});if(_['isNil'](_0x458c8e[_0x33b1('0x1e')])){_0x458c8e=_['assign'](_0x458c8e,{'transfereechannel':_0x458c8e[_0x33b1('0x1f')],'transfereecalleridnum':_0x458c8e[_0x33b1('0x15')],'transfereecalleridname':_0x458c8e['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x458c8e[_0x33b1('0x20')],'transfereeconnectedlinename':_0x458c8e[_0x33b1('0x21')],'transfereeaccountcode':_0x458c8e[_0x33b1('0x22')],'transfereecontext':_0x458c8e[_0x33b1('0x23')],'transfereeexten':_0x458c8e[_0x33b1('0x24')],'transfereelinkedid':_0x458c8e['transfertargetlinkedid']});}writeDB(_0x458c8e);}catch(_0x8fe24a){utils[_0x33b1('0x25')](util[_0x33b1('0x3')]('[%s][transfers][attendedtransfer]',_0x458c8e[_0x33b1('0x12')]),_0x8fe24a);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index 3e607fe..60d4307 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 _0x9999=['getUserByInternal','[utils][getUserByInternal]\x20internal:%s\x20%s','found','notfound','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s\x20%s','[utils][getVoiceQueueByName]','addTime','add','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','diffTime','diff','now','isAfter','isBefore','bluebird','jayson/promise','util','http','../../config/logger','info','debug','inspect','request','then','[utils][request]\x20name:%s','catch','error','GetUser','internal','name','interface','[utils][getUser]\x20where:%s','stringify','result','length'];(function(_0x416df5,_0x5cd9e7){var _0x53235b=function(_0xc8811e){while(--_0xc8811e){_0x416df5['push'](_0x416df5['shift']());}};_0x53235b(++_0x5cd9e7);}(_0x9999,0xaf));var _0x9999=function(_0x2d9350,_0x36025a){_0x2d9350=_0x2d9350-0x0;var _0x49910b=_0x9999[_0x2d9350];return _0x49910b;};'use strict';var BPromise=require(_0x9999('0x0'));var jayson=require(_0x9999('0x1'));var moment=require('moment');var util=require(_0x9999('0x2'));var client=jayson['client'][_0x9999('0x3')]({'port':0x2329});var logger=require(_0x9999('0x4'))('xdr');exports[_0x9999('0x5')]=function(_0x242450,_0x38ab56){logger['info'](_0x242450,_0x38ab56?util['inspect'](_0x38ab56,{'showHidden':![],'depth':null}):'');};exports[_0x9999('0x6')]=function(_0x16d823,_0x5207ac){logger[_0x9999('0x6')](_0x16d823,_0x5207ac?util[_0x9999('0x7')](_0x5207ac,{'showHidden':![],'depth':null}):'');};exports['error']=function(_0x4c4ce9,_0x4ef0ab){logger['error'](_0x4c4ce9,_0x4ef0ab?util['inspect'](_0x4ef0ab,{'showHidden':![],'depth':null}):'');};exports['request']=function(_0x4dee74,_0x52bced){return client[_0x9999('0x8')](_0x4dee74,{'body':_0x52bced})[_0x9999('0x9')](function(_0x567dd9){logger['debug'](_0x9999('0xa'),_0x4dee74,_0x567dd9?util[_0x9999('0x7')](_0x567dd9,{'showHidden':![],'depth':null}):'');})[_0x9999('0xb')](function(_0x3a2aa4){logger[_0x9999('0xc')](_0x9999('0xa'),_0x4dee74,_0x3a2aa4?util[_0x9999('0x7')](_0x3a2aa4,{'showHidden':![],'depth':null}):'');});};function getUser(_0x1756c1){return client[_0x9999('0x8')](_0x9999('0xd'),{'options':{'raw':!![],'attributes':['id',_0x9999('0xe'),_0x9999('0xf'),_0x9999('0x10')],'where':_0x1756c1,'limit':0x1}})[_0x9999('0x9')](function(_0x2e78ae){logger[_0x9999('0x6')](_0x9999('0x11'),JSON[_0x9999('0x12')](_0x1756c1),_0x2e78ae?util[_0x9999('0x7')](_0x2e78ae,{'showHidden':![],'depth':null}):'');return _0x2e78ae[_0x9999('0x13')][_0x9999('0x14')]?_0x2e78ae[_0x9999('0x13')][0x0]:null;});}exports[_0x9999('0x15')]=function(_0x164532){return new BPromise(function(_0x4fdcdd,_0x403226){if(_0x164532){return getUser({'internal':_0x164532})['then'](function(_0x19b9f4){logger[_0x9999('0x5')](_0x9999('0x16'),_0x164532,_0x19b9f4?_0x9999('0x17'):_0x9999('0x18'));return _0x4fdcdd(_0x19b9f4);})[_0x9999('0xb')](function(_0x4c9331){logger[_0x9999('0xc')](_0x9999('0x19'),_0x4c9331?util['inspect'](_0x4c9331,{'showHidden':![],'depth':null}):'');return _0x4fdcdd(null);});}return _0x4fdcdd(null);});};exports[_0x9999('0x1a')]=function(_0x1e52f1){return new BPromise(function(_0x275fd3,_0x5c8519){if(_0x1e52f1){return getUser({'interface':_0x1e52f1})[_0x9999('0x9')](function(_0x3bbe16){logger[_0x9999('0x5')]('[utils][getUserByInterface]\x20interface:%s\x20%s',_0x1e52f1,_0x3bbe16?_0x9999('0x17'):_0x9999('0x18'));return _0x275fd3(_0x3bbe16);})[_0x9999('0xb')](function(_0x246af2){logger[_0x9999('0xc')](_0x9999('0x1b'),_0x246af2?util[_0x9999('0x7')](_0x246af2,{'showHidden':![],'depth':null}):'');return _0x275fd3(null);});}return _0x275fd3(null);});};exports[_0x9999('0x1c')]=function(_0x219ce3){return new BPromise(function(_0x4aed1b,_0xe7e5c9){if(_0x219ce3){return getUser({'name':_0x219ce3})['then'](function(_0x46da2b){logger['info'](_0x9999('0x1d'),_0x219ce3,_0x46da2b?_0x9999('0x17'):_0x9999('0x18'));return _0x4aed1b(_0x46da2b);})[_0x9999('0xb')](function(_0x2b0ed7){logger['error'](_0x9999('0x1e'),_0x2b0ed7?util[_0x9999('0x7')](_0x2b0ed7,{'showHidden':![],'depth':null}):'');return _0x4aed1b(null);});}return _0x4aed1b(null);});};exports[_0x9999('0x1f')]=function(_0x47d915){return new BPromise(function(_0xc7562b,_0x447f90){if(_0x47d915){return client[_0x9999('0x8')](_0x9999('0x20'),{'options':{'raw':!![],'attributes':['id','name','type',_0x9999('0x21'),_0x9999('0x22')],'where':{'name':_0x47d915},'limit':0x1}})[_0x9999('0x9')](function(_0x3f21de){logger[_0x9999('0x6')]('[utils][getVoiceQueueByName]\x20name:%s',_0x47d915,_0x3f21de?util[_0x9999('0x7')](_0x3f21de,{'showHidden':![],'depth':null}):'');logger[_0x9999('0x5')](_0x9999('0x23'),_0x47d915,_0x3f21de?'found':_0x9999('0x18'));return _0xc7562b(_0x3f21de[_0x9999('0x13')][_0x9999('0x14')]?_0x3f21de[_0x9999('0x13')][0x0]:null);})[_0x9999('0xb')](function(_0x54f604){logger[_0x9999('0xc')](_0x9999('0x24'),_0x54f604?util[_0x9999('0x7')](_0x54f604,{'showHidden':![],'depth':null}):'');return _0xc7562b(null);});}return _0xc7562b(null);});};exports[_0x9999('0x25')]=function(_0x56e94c,_0x7626d6){return moment(_0x56e94c)[_0x9999('0x26')](_0x7626d6,_0x9999('0x27'))[_0x9999('0x28')](_0x9999('0x29'));};exports[_0x9999('0x2a')]=function(_0x3d4a96,_0x3fffaa){return moment(_0x3d4a96)[_0x9999('0x2b')](_0x3fffaa,_0x9999('0x27'))[_0x9999('0x28')](_0x9999('0x29'));};exports[_0x9999('0x2c')]=function(_0x1b8290,_0x27f7cf){return moment(_0x1b8290)[_0x9999('0x2d')](moment(_0x27f7cf),_0x9999('0x27'));};exports['sumTime']=function(_0x5b0973,_0x48c64e){return parseInt(_0x5b0973,0xa)+parseInt(_0x48c64e,0xa);};exports[_0x9999('0x2e')]=function(){return moment()['format'](_0x9999('0x29'));};exports[_0x9999('0x2f')]=function(_0xc7932f,_0x22bec3){if(_0x22bec3){return moment(_0xc7932f)[_0x9999('0x2f')](_0x22bec3);}return!![];};exports[_0x9999('0x30')]=function(_0x4e8d60,_0x6c1c46){if(_0x6c1c46){return moment(_0x4e8d60)[_0x9999('0x30')](_0x6c1c46);}else if(_0x4e8d60){return!![];}return![];}; \ No newline at end of file +var _0x6b22=['notfound','[utils][getUserByInternal]','getUserByInterface','found','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]','getVoiceQueueByName','type','acw','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','[utils][getVoiceQueueByName]','add','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtract','diff','now','isAfter','isBefore','jayson/promise','moment','client','http','../../config/logger','xdr','info','debug','inspect','error','request','then','[utils][request]\x20name:%s','catch','internal','name','interface','[utils][getUser]\x20where:%s','stringify','result','length'];(function(_0x2f60b7,_0x23f7bb){var _0x2c2745=function(_0x3ce532){while(--_0x3ce532){_0x2f60b7['push'](_0x2f60b7['shift']());}};_0x2c2745(++_0x23f7bb);}(_0x6b22,0x1c4));var _0x26b2=function(_0x5ee42e,_0x10f836){_0x5ee42e=_0x5ee42e-0x0;var _0x17a6dd=_0x6b22[_0x5ee42e];return _0x17a6dd;};'use strict';var BPromise=require('bluebird');var jayson=require(_0x26b2('0x0'));var moment=require(_0x26b2('0x1'));var util=require('util');var client=jayson[_0x26b2('0x2')][_0x26b2('0x3')]({'port':0x2329});var logger=require(_0x26b2('0x4'))(_0x26b2('0x5'));exports[_0x26b2('0x6')]=function(_0x24cadf,_0x2818b1){logger[_0x26b2('0x6')](_0x24cadf,_0x2818b1?util['inspect'](_0x2818b1,{'showHidden':![],'depth':null}):'');};exports[_0x26b2('0x7')]=function(_0x1c53c0,_0x3c6017){logger[_0x26b2('0x7')](_0x1c53c0,_0x3c6017?util[_0x26b2('0x8')](_0x3c6017,{'showHidden':![],'depth':null}):'');};exports[_0x26b2('0x9')]=function(_0x22ab86,_0x237e1d){logger[_0x26b2('0x9')](_0x22ab86,_0x237e1d?util['inspect'](_0x237e1d,{'showHidden':![],'depth':null}):'');};exports[_0x26b2('0xa')]=function(_0x2aa888,_0x51d7e9){return client[_0x26b2('0xa')](_0x2aa888,{'body':_0x51d7e9})[_0x26b2('0xb')](function(_0x46beaa){logger[_0x26b2('0x7')](_0x26b2('0xc'),_0x2aa888,_0x46beaa?util[_0x26b2('0x8')](_0x46beaa,{'showHidden':![],'depth':null}):'');})[_0x26b2('0xd')](function(_0x2bdf45){logger['error'](_0x26b2('0xc'),_0x2aa888,_0x2bdf45?util[_0x26b2('0x8')](_0x2bdf45,{'showHidden':![],'depth':null}):'');});};function getUser(_0x4c8b1e){return client[_0x26b2('0xa')]('GetUser',{'options':{'raw':!![],'attributes':['id',_0x26b2('0xe'),_0x26b2('0xf'),_0x26b2('0x10')],'where':_0x4c8b1e,'limit':0x1}})['then'](function(_0x3189ab){logger[_0x26b2('0x7')](_0x26b2('0x11'),JSON[_0x26b2('0x12')](_0x4c8b1e),_0x3189ab?util['inspect'](_0x3189ab,{'showHidden':![],'depth':null}):'');return _0x3189ab[_0x26b2('0x13')][_0x26b2('0x14')]?_0x3189ab[_0x26b2('0x13')][0x0]:null;});}exports['getUserByInternal']=function(_0x1a7b45){return new BPromise(function(_0x1579ae,_0x4bec76){if(_0x1a7b45){return getUser({'internal':_0x1a7b45})['then'](function(_0x162a57){logger[_0x26b2('0x6')]('[utils][getUserByInternal]\x20internal:%s\x20%s',_0x1a7b45,_0x162a57?'found':_0x26b2('0x15'));return _0x1579ae(_0x162a57);})[_0x26b2('0xd')](function(_0x36cacb){logger[_0x26b2('0x9')](_0x26b2('0x16'),_0x36cacb?util[_0x26b2('0x8')](_0x36cacb,{'showHidden':![],'depth':null}):'');return _0x1579ae(null);});}return _0x1579ae(null);});};exports[_0x26b2('0x17')]=function(_0x466cf7){return new BPromise(function(_0xa5d18d,_0x25744e){if(_0x466cf7){return getUser({'interface':_0x466cf7})['then'](function(_0x558180){logger[_0x26b2('0x6')]('[utils][getUserByInterface]\x20interface:%s\x20%s',_0x466cf7,_0x558180?_0x26b2('0x18'):_0x26b2('0x15'));return _0xa5d18d(_0x558180);})[_0x26b2('0xd')](function(_0x39a35b){logger[_0x26b2('0x9')](_0x26b2('0x19'),_0x39a35b?util[_0x26b2('0x8')](_0x39a35b,{'showHidden':![],'depth':null}):'');return _0xa5d18d(null);});}return _0xa5d18d(null);});};exports[_0x26b2('0x1a')]=function(_0x2bf585){return new BPromise(function(_0x4c79e8,_0x38ac91){if(_0x2bf585){return getUser({'name':_0x2bf585})[_0x26b2('0xb')](function(_0x21253f){logger[_0x26b2('0x6')]('[utils][getUserByName]\x20name:%s\x20%s',_0x2bf585,_0x21253f?_0x26b2('0x18'):_0x26b2('0x15'));return _0x4c79e8(_0x21253f);})[_0x26b2('0xd')](function(_0x4cba67){logger[_0x26b2('0x9')](_0x26b2('0x1b'),_0x4cba67?util[_0x26b2('0x8')](_0x4cba67,{'showHidden':![],'depth':null}):'');return _0x4c79e8(null);});}return _0x4c79e8(null);});};exports[_0x26b2('0x1c')]=function(_0x15723c){return new BPromise(function(_0x57277e,_0x2af209){if(_0x15723c){return client['request']('GetVoiceQueue',{'options':{'raw':!![],'attributes':['id',_0x26b2('0xf'),_0x26b2('0x1d'),_0x26b2('0x1e'),'acwTimeout'],'where':{'name':_0x15723c},'limit':0x1}})[_0x26b2('0xb')](function(_0x2832ef){logger[_0x26b2('0x7')](_0x26b2('0x1f'),_0x15723c,_0x2832ef?util[_0x26b2('0x8')](_0x2832ef,{'showHidden':![],'depth':null}):'');logger[_0x26b2('0x6')](_0x26b2('0x20'),_0x15723c,_0x2832ef?_0x26b2('0x18'):_0x26b2('0x15'));return _0x57277e(_0x2832ef['result'][_0x26b2('0x14')]?_0x2832ef[_0x26b2('0x13')][0x0]:null);})['catch'](function(_0x4e2ac6){logger[_0x26b2('0x9')](_0x26b2('0x21'),_0x4e2ac6?util[_0x26b2('0x8')](_0x4e2ac6,{'showHidden':![],'depth':null}):'');return _0x57277e(null);});}return _0x57277e(null);});};exports['addTime']=function(_0x50dc09,_0x46441b){return moment(_0x50dc09)[_0x26b2('0x22')](_0x46441b,_0x26b2('0x23'))[_0x26b2('0x24')](_0x26b2('0x25'));};exports['subtractTime']=function(_0x1fc9d1,_0x182baf){return moment(_0x1fc9d1)[_0x26b2('0x26')](_0x182baf,_0x26b2('0x23'))[_0x26b2('0x24')](_0x26b2('0x25'));};exports['diffTime']=function(_0x34cd32,_0x26f092){return moment(_0x34cd32)[_0x26b2('0x27')](moment(_0x26f092),_0x26b2('0x23'));};exports['sumTime']=function(_0x2d39a3,_0x4f32e5){return parseInt(_0x2d39a3,0xa)+parseInt(_0x4f32e5,0xa);};exports[_0x26b2('0x28')]=function(){return moment()[_0x26b2('0x24')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x26b2('0x29')]=function(_0xf1f871,_0x1dee5a){if(_0x1dee5a){return moment(_0xf1f871)['isAfter'](_0x1dee5a);}return!![];};exports[_0x26b2('0x2a')]=function(_0x5db21e,_0xb701b5){if(_0xb701b5){return moment(_0x5db21e)['isBefore'](_0xb701b5);}else if(_0x5db21e){return!![];}return![];}; \ No newline at end of file diff --git a/server/utils/client-side-logger.js b/server/utils/client-side-logger.js index d4931ac..af96347 100644 --- a/server/utils/client-side-logger.js +++ b/server/utils/client-side-logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x71b9=['no-user','data','timestamp','error','api','auth','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','\x20body=%s','headers','x-forwarded-for','connection','remoteAddress','url','responseTime','inspect','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','format','other','agent_name','setupLoggers','fs-extra','express-winston','path','util','./loggers','./mask-sensitive-data','maskSensitiveData','join','/var','log','xcally','client','role','name','ensureDir','catch','user','then'];(function(_0x19e425,_0x7f53c0){var _0x220e1d=function(_0x824c8){while(--_0x824c8){_0x19e425['push'](_0x19e425['shift']());}};_0x220e1d(++_0x7f53c0);}(_0x71b9,0xfc));var _0x971b=function(_0x44883e,_0x4e1af1){_0x44883e=_0x44883e-0x0;var _0x5a541c=_0x71b9[_0x44883e];return _0x5a541c;};var fs=require(_0x971b('0x0'));var _=require('lodash');var ewinston=require(_0x971b('0x1'));var path=require(_0x971b('0x2'));var util=require(_0x971b('0x3'));var fileLogger=require(_0x971b('0x4'))['fileLogger'];var safeTemplate=require('./safe-template')['safeTemplate'];var maskSensitiveData=require(_0x971b('0x5'))[_0x971b('0x6')];function ClientSideLogger(){function _0xce1412(_0x1a22f6){var _0x2e5c90=path[_0x971b('0x7')](_0x971b('0x8'),_0x971b('0x9'),_0x971b('0xa'));var _0xfb4e4b=path[_0x971b('0x7')](_0x971b('0xb'),_0x1a22f6[_0x971b('0xc')]+'-'+_0x1a22f6[_0x971b('0xd')]);return fs[_0x971b('0xe')](path[_0x971b('0x7')](_0x2e5c90,_0xfb4e4b))['then'](function(){var _0x19ad50=fileLogger('client',path[_0x971b('0x7')](_0x2e5c90,_0xfb4e4b));return _0x19ad50;})[_0x971b('0xf')](function(_0x4e8298){throw _0x4e8298;});}this[_0x971b('0x9')]=function(_0x319e58,_0x18d867,_0x351db2,_0x9bc8b4){return _0xce1412(_0x319e58[_0x971b('0x10')])[_0x971b('0x11')](function(_0x3811fa){var _0x343e12=_0x3811fa[_0x18d867];return _0x343e12;})[_0x971b('0x11')](function(_0x5b486f){var _0x493d0a=_0x319e58[_0x971b('0x10')]?_0x319e58['user']['id']:_0x971b('0x12');var _0x2da014=_0x9bc8b4[_0x971b('0x13')];var _0x3653b5=_0x9bc8b4[_0x971b('0x14')];var _0x52c0ce=new Date(Number(_0x3653b5));return _0x5b486f(_0x493d0a,_0x52c0ce,_0x351db2,_0x2da014);})[_0x971b('0xf')](function(_0x5ac65c){fileLogger(_0x971b('0xb'))[_0x971b('0x15')](_0x5ac65c);});};}function setupLoggers(_0x5585b6){return new Promise(function(_0x596298){var _0xbf3e03=new ClientSideLogger();var _0x39004b=fileLogger(_0x971b('0x16'));var _0x54a019=fileLogger(_0x971b('0x17'));_0x5585b6['set']('client-side-logger',_0xbf3e03);_0x5585b6[_0x971b('0x18')](ewinston[_0x971b('0x19')]({'winstonInstance':_0x39004b,'meta':![],'statusLevels':!![],'msg':function(_0x5212ba,_0x498c14){var _0x45c829=_0x971b('0x1a');if(!_[_0x971b('0x1b')](_0x5212ba[_0x971b('0x1c')])){_0x45c829+=_0x971b('0x1d');var _0x52270e=_0x5212ba[_0x971b('0x1c')];maskSensitiveData(_0x52270e);}return safeTemplate(util['format'](_0x45c829,_0x5212ba['method'],_0x5212ba[_0x971b('0x1e')][_0x971b('0x1f')]?_0x5212ba[_0x971b('0x1e')]['x-forwarded-for']:_0x5212ba[_0x971b('0x20')][_0x971b('0x21')]||_0x5212ba['ip'],_0x5212ba[_0x971b('0x22')],_0x498c14['statusCode'],_0x498c14[_0x971b('0x23')],_0x5212ba[_0x971b('0x10')]?_0x5212ba['user']['id']:null,_0x5212ba['user']?_0x5212ba['user'][_0x971b('0xd')]:null,_0x5212ba[_0x971b('0x10')]?_0x5212ba[_0x971b('0x10')][_0x971b('0xc')]:null,_0x52270e?util[_0x971b('0x24')](_0x52270e,![],null):''));}}));_0x5585b6[_0x971b('0x18')](ewinston[_0x971b('0x19')]({'winstonInstance':_0x54a019,'meta':![],'statusLevels':!![],'msg':function(_0xa04359,_0x35f630){var _0x1d53ff=_0x971b('0x25');if(_0xa04359[_0x971b('0x1c')]&&_0xa04359[_0x971b('0x1c')][_0x971b('0x26')]&&_0xa04359[_0x971b('0x1c')][_0x971b('0x27')]){_0x1d53ff=_0x971b('0x28');}return util[_0x971b('0x29')](_0x1d53ff,_0xa04359['method'],_0xa04359['headers']['x-forwarded-for']?_0xa04359['headers'][_0x971b('0x1f')]:_0xa04359[_0x971b('0x20')]['remoteAddress']||_0xa04359['ip'],_0xa04359[_0x971b('0x22')],_0x35f630['statusCode'],_0x35f630[_0x971b('0x23')],_0xa04359[_0x971b('0x10')]?_0xa04359[_0x971b('0x10')]['id']:null,_0xa04359[_0x971b('0x10')]?_0xa04359['user'][_0x971b('0xd')]:null,_0xa04359['user']?_0xa04359[_0x971b('0x10')][_0x971b('0xc')]:null,_0xa04359[_0x971b('0x1c')]&&_0xa04359['body'][_0x971b('0x26')]?_0xa04359[_0x971b('0x1c')]['device']:_0x971b('0x2a'),_0xa04359[_0x971b('0x1c')]&&_0xa04359[_0x971b('0x1c')][_0x971b('0x27')]?_0xa04359[_0x971b('0x1c')][_0x971b('0x27')]:'',_0xa04359[_0x971b('0x1c')]&&_0xa04359[_0x971b('0x1c')][_0x971b('0x2b')]?_0xa04359[_0x971b('0x1c')][_0x971b('0x2b')]:'');},'ignoreRoute':function(_0x5b5813){var _0x44c3d9=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x44c3d9['test'](_0x5b5813[_0x971b('0x22')]);}}));return _0x596298();});}exports[_0x971b('0x2c')]=setupLoggers; \ No newline at end of file +var _0x9615=['client','then','catch','log','user','data','error','api','auth','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','\x20body=%s','format','method','headers','x-forwarded-for','connection','statusCode','name','role','use','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','agent_id','url','responseTime','agent_name','test','fs-extra','lodash','express-winston','path','util','fileLogger','./safe-template','./mask-sensitive-data','maskSensitiveData','join'];(function(_0x343041,_0x31de3b){var _0x4b7dc=function(_0x398ce4){while(--_0x398ce4){_0x343041['push'](_0x343041['shift']());}};_0x4b7dc(++_0x31de3b);}(_0x9615,0xe6));var _0x5961=function(_0x21ec99,_0x441d6f){_0x21ec99=_0x21ec99-0x0;var _0x365b06=_0x9615[_0x21ec99];return _0x365b06;};var fs=require(_0x5961('0x0'));var _=require(_0x5961('0x1'));var ewinston=require(_0x5961('0x2'));var path=require(_0x5961('0x3'));var util=require(_0x5961('0x4'));var fileLogger=require('./loggers')[_0x5961('0x5')];var safeTemplate=require(_0x5961('0x6'))['safeTemplate'];var maskSensitiveData=require(_0x5961('0x7'))[_0x5961('0x8')];function ClientSideLogger(){function _0x442757(_0x14d487){var _0x371959=path['join']('/var','log','xcally');var _0x255cfb=path[_0x5961('0x9')](_0x5961('0xa'),_0x14d487['role']+'-'+_0x14d487['name']);return fs['ensureDir'](path[_0x5961('0x9')](_0x371959,_0x255cfb))[_0x5961('0xb')](function(){var _0xd66457=fileLogger(_0x5961('0xa'),path[_0x5961('0x9')](_0x371959,_0x255cfb));return _0xd66457;})[_0x5961('0xc')](function(_0x347bd1){throw _0x347bd1;});}this[_0x5961('0xd')]=function(_0x3b0d81,_0x2d4c09,_0x3ac637,_0x59353d){return _0x442757(_0x3b0d81[_0x5961('0xe')])['then'](function(_0x5a2086){var _0x40533f=_0x5a2086[_0x2d4c09];return _0x40533f;})[_0x5961('0xb')](function(_0x46e2e9){var _0x1516ae=_0x3b0d81[_0x5961('0xe')]?_0x3b0d81[_0x5961('0xe')]['id']:'no-user';var _0x4bbffd=_0x59353d[_0x5961('0xf')];var _0x53a926=_0x59353d['timestamp'];var _0x5c7feb=new Date(Number(_0x53a926));return _0x46e2e9(_0x1516ae,_0x5c7feb,_0x3ac637,_0x4bbffd);})[_0x5961('0xc')](function(_0x3bf563){fileLogger('client')[_0x5961('0x10')](_0x3bf563);});};}function setupLoggers(_0x11e6e3){return new Promise(function(_0x23f0fc){var _0x3d0cf3=new ClientSideLogger();var _0x35458b=fileLogger(_0x5961('0x11'));var _0x3e0ff5=fileLogger(_0x5961('0x12'));_0x11e6e3['set']('client-side-logger',_0x3d0cf3);_0x11e6e3['use'](ewinston[_0x5961('0x13')]({'winstonInstance':_0x35458b,'meta':![],'statusLevels':!![],'msg':function(_0x36ace0,_0x183df5){var _0x621264=_0x5961('0x14');if(!_[_0x5961('0x15')](_0x36ace0[_0x5961('0x16')])){_0x621264+=_0x5961('0x17');var _0xf6bcc5=_0x36ace0[_0x5961('0x16')];maskSensitiveData(_0xf6bcc5);}return safeTemplate(util[_0x5961('0x18')](_0x621264,_0x36ace0[_0x5961('0x19')],_0x36ace0[_0x5961('0x1a')][_0x5961('0x1b')]?_0x36ace0[_0x5961('0x1a')][_0x5961('0x1b')]:_0x36ace0[_0x5961('0x1c')]['remoteAddress']||_0x36ace0['ip'],_0x36ace0['url'],_0x183df5[_0x5961('0x1d')],_0x183df5['responseTime'],_0x36ace0['user']?_0x36ace0[_0x5961('0xe')]['id']:null,_0x36ace0[_0x5961('0xe')]?_0x36ace0[_0x5961('0xe')][_0x5961('0x1e')]:null,_0x36ace0[_0x5961('0xe')]?_0x36ace0[_0x5961('0xe')][_0x5961('0x1f')]:null,_0xf6bcc5?util['inspect'](_0xf6bcc5,![],null):''));}}));_0x11e6e3[_0x5961('0x20')](ewinston[_0x5961('0x13')]({'winstonInstance':_0x3e0ff5,'meta':![],'statusLevels':!![],'msg':function(_0x2cde06,_0x232595){var _0x9c4588=_0x5961('0x21');if(_0x2cde06[_0x5961('0x16')]&&_0x2cde06['body'][_0x5961('0x22')]&&_0x2cde06['body'][_0x5961('0x23')]){_0x9c4588='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)';}return util[_0x5961('0x18')](_0x9c4588,_0x2cde06[_0x5961('0x19')],_0x2cde06['headers'][_0x5961('0x1b')]?_0x2cde06[_0x5961('0x1a')]['x-forwarded-for']:_0x2cde06['connection']['remoteAddress']||_0x2cde06['ip'],_0x2cde06[_0x5961('0x24')],_0x232595['statusCode'],_0x232595[_0x5961('0x25')],_0x2cde06['user']?_0x2cde06[_0x5961('0xe')]['id']:null,_0x2cde06[_0x5961('0xe')]?_0x2cde06['user'][_0x5961('0x1e')]:null,_0x2cde06[_0x5961('0xe')]?_0x2cde06[_0x5961('0xe')]['role']:null,_0x2cde06[_0x5961('0x16')]&&_0x2cde06[_0x5961('0x16')][_0x5961('0x22')]?_0x2cde06['body'][_0x5961('0x22')]:'other',_0x2cde06['body']&&_0x2cde06['body']['agent_id']?_0x2cde06[_0x5961('0x16')][_0x5961('0x23')]:'',_0x2cde06[_0x5961('0x16')]&&_0x2cde06[_0x5961('0x16')][_0x5961('0x26')]?_0x2cde06['body'][_0x5961('0x26')]:'');},'ignoreRoute':function(_0x2faab7){var _0x1e35a0=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x1e35a0[_0x5961('0x27')](_0x2faab7[_0x5961('0x24')]);}}));return _0x23f0fc();});}exports['setupLoggers']=setupLoggers; \ No newline at end of file diff --git a/server/utils/iftime.js b/server/utils/iftime.js index 530884c..137fa2c 100644 --- a/server/utils/iftime.js +++ b/server/utils/iftime.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe899=['slice','concat','exports','monthsShort','toLowerCase','indexOf','circularMonthInterval','clone','hours','minutes','isBefore','endOf','isBetween','format','ddd','includes','dowCompare','date','max','min','domCompare','MMM','isMoment','padStart','length','iftime','lodash','moment-timezone','map','Date\x20not\x20valid','isValid','split','locale','weekdaysShort'];(function(_0x104648,_0x36d686){var _0x54463d=function(_0x3254a6){while(--_0x3254a6){_0x104648['push'](_0x104648['shift']());}};_0x54463d(++_0x36d686);}(_0xe899,0x12a));var _0x9e89=function(_0x5a7618,_0x3f44c2){_0x5a7618=_0x5a7618-0x0;var _0x12dc65=_0xe899[_0x5a7618];return _0x12dc65;};var _=require(_0x9e89('0x0'));var moment=require(_0x9e89('0x1'));var timeRx=/(\*|(\d{1,2}:\d{1,2})(-(\d{1,2}:\d{1,2}))?)/;var dowRx=/(\*|((sun|mon|tue|wed|thu|fri|sat)(-(sun|mon|tue|wed|thu|fri|sat))?))/;var domRx=/(\*|(\d{1,2})(-(\d{1,2}))?)/;var moyRx=/(\*|(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)(-(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec))?)/;var globalRx=[timeRx,dowRx,domRx,moyRx][_0x9e89('0x2')](function(_0x2eccaf){return _0x2eccaf['source'];})['join'](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING='Interval\x20string\x20not\x20valid';var EINVALID_DATE=_0x9e89('0x3');function throwIfDateNotValid(_0x3a0b86){if(!_0x3a0b86[_0x9e89('0x4')]()){throw new Error(EINVALID_DATE);}}function extractTime(_0x5d3d08){var _0xaf47d4=_0x5d3d08[_0x9e89('0x5')](':')[_0x9e89('0x2')](function(_0x57d5ec){return parseInt(_0x57d5ec,0xa);});var _0x4291cf=_0xaf47d4[0x0];var _0xfe0378=_0xaf47d4[0x1];if(_0x4291cf<0x0||_0x4291cf>0x17||_0xfe0378<0x0||_0xfe0378>0x3b){throw new Error(EINVALID_DATE);}return[_0x4291cf,_0xfe0378];}function circularDoWInterval(_0x5cef0,_0x376dee){if(_0x5cef0===_0x376dee){return[_0x5cef0];}else{var _0x760e0=moment[_0x9e89('0x6')]();moment['locale']('en');var _0xcfc163=moment[_0x9e89('0x7')]()[_0x9e89('0x2')](function(_0x1f48d7){return _0x1f48d7['toLowerCase']();});moment[_0x9e89('0x6')](_0x760e0);var _0x40f445=_0xcfc163['indexOf'](_0x5cef0);var _0x20127e=_0xcfc163['indexOf'](_0x376dee);if(_0x20127e>_0x40f445){return _0xcfc163[_0x9e89('0x8')](_0x40f445,_0x20127e+0x1);}else{var _0x273587=_0xcfc163[_0x9e89('0x8')](0x0,_0x20127e+0x1);var _0x1e8e40=_0xcfc163[_0x9e89('0x8')](_0x40f445);return _0x1e8e40[_0x9e89('0x9')](_0x273587);}}}module[_0x9e89('0xa')]['circularDoWInterval']=circularDoWInterval;function circularMonthInterval(_0x733d61,_0x5330e6){if(_0x733d61===_0x5330e6){return[_0x733d61];}else{var _0x321841=moment['locale']();moment[_0x9e89('0x6')]('en');var _0x4fee54=moment[_0x9e89('0xb')]()['map'](function(_0x561539){return _0x561539[_0x9e89('0xc')]();});moment[_0x9e89('0x6')](_0x321841);var _0x42ca30=_0x4fee54[_0x9e89('0xd')](_0x733d61);var _0xcb1e72=_0x4fee54[_0x9e89('0xd')](_0x5330e6);if(_0xcb1e72>_0x42ca30){return _0x4fee54['slice'](_0x42ca30,_0xcb1e72+0x1);}else{var _0x24332d=_0x4fee54[_0x9e89('0x8')](0x0,_0xcb1e72+0x1);var _0x5cbc0b=_0x4fee54[_0x9e89('0x8')](_0x42ca30);return _0x5cbc0b['concat'](_0x24332d);}}}module[_0x9e89('0xa')][_0x9e89('0xe')]=circularMonthInterval;function parseDom(_0x3f9ea9){var _0x43bafb=parseInt(_0x3f9ea9,0xa);if(_0x43bafb<0x1||_0x43bafb>0x1f){throw new Error(EINVALID_DATE);}return _0x43bafb;}function timeCompare(_0x1e8653,_0x3e918c,_0x3b8112){var _0x2ee19c=_0x1e8653['clone']();var _0x46a34c=extractTime(_0x3e918c);var _0x1810a8=_0x46a34c[0x0];var _0x494930=_0x46a34c[0x1];var _0x27cabc=_0x1e8653[_0x9e89('0xf')]()[_0x9e89('0x10')](_0x1810a8)[_0x9e89('0x11')](_0x494930);throwIfDateNotValid(_0x27cabc);var _0x2eb3f9=extractTime(_0x3b8112);var _0x3eefe6=_0x2eb3f9[0x0];var _0x23cb36=_0x2eb3f9[0x1];var _0x540dec=_0x1e8653[_0x9e89('0xf')]()['hours'](_0x3eefe6)['minutes'](_0x23cb36);throwIfDateNotValid(_0x540dec);if(_0x540dec[_0x9e89('0x12')](_0x27cabc)){var _0x511777=_0x2ee19c[_0x9e89('0xf')]()['startOf']('day');var _0x47c678=_0x2ee19c[_0x9e89('0xf')]()[_0x9e89('0x13')]('day');return _0x2ee19c['isBetween'](_0x27cabc,_0x47c678,undefined,'[]')||_0x2ee19c[_0x9e89('0x14')](_0x511777,_0x540dec,undefined,'[]');}else{return _0x2ee19c[_0x9e89('0x14')](_0x27cabc,_0x540dec,undefined,'[]');}}module[_0x9e89('0xa')]['timeCompare']=timeCompare;function dowCompare(_0x3cee10,_0x42a661,_0x4c1f3b){var _0x3e7c5f=_0x3cee10[_0x9e89('0x6')]('en')[_0x9e89('0x15')](_0x9e89('0x16'))[_0x9e89('0xc')]();return circularDoWInterval(_0x42a661,_0x4c1f3b)[_0x9e89('0x17')](_0x3e7c5f);}module['exports'][_0x9e89('0x18')]=dowCompare;function domCompare(_0x250d02,_0x39b453,_0x1b2d7c){var _0x513bda=_0x250d02[_0x9e89('0x19')]();if(_0x39b453===_0x1b2d7c){return _0x513bda===_0x39b453;}else{var _0x5bde92=_0x250d02['daysInMonth']();var _0x437c4e=_0x39b453<_0x1b2d7c;let _0x317ca5=![];var _0x179378=0x0;var _0x31fdea=0x0;if(_0x437c4e){_0x179378=Math[_0x9e89('0x1a')](0x1,_0x39b453);_0x31fdea=Math[_0x9e89('0x1b')](_0x1b2d7c,_0x5bde92);_0x317ca5=_0x513bda>=_0x179378&&_0x513bda<=_0x31fdea;}else{_0x179378=Math[_0x9e89('0x1b')](_0x39b453,_0x5bde92);_0x31fdea=Math[_0x9e89('0x1a')](0x1,_0x1b2d7c);_0x317ca5=_0x513bda>=_0x179378||_0x513bda<=_0x31fdea;}return _0x317ca5;}}module['exports'][_0x9e89('0x1c')]=domCompare;function monthCompare(_0x515b5a,_0x54d18e,_0x5ee0e8){var _0x3849a2=_0x515b5a[_0x9e89('0x6')]('en')[_0x9e89('0x15')](_0x9e89('0x1d'))[_0x9e89('0xc')]();return circularMonthInterval(_0x54d18e,_0x5ee0e8)[_0x9e89('0x17')](_0x3849a2);}module[_0x9e89('0xa')]['monthCompare']=monthCompare;function iftime(_0x458a12,_0x4a80d2=moment['tz']['guess'](),_0x3e818e=moment()){if(!validateRx['test'](_0x458a12)){throw new Error(EINVALID_STRING);}else{var _0x4d71e1=(moment[_0x9e89('0x1e')](_0x3e818e)?_0x3e818e[_0x9e89('0xf')]():moment(_0x3e818e))['tz'](_0x4a80d2)[_0x9e89('0x6')]('en');throwIfDateNotValid(_0x4d71e1);var _0xd28da3=_0x458a12[_0x9e89('0x5')](',');var _0xa1ce0e=_0xd28da3[0x0];var _0x1e31ab=_0xd28da3[0x1];var _0x4c904a=_0xd28da3[0x2];var _0x2e6820=_0xd28da3[0x3];let _0x27fadd=!![];if(_0xa1ce0e!=='*'){var _0x473917=_0xa1ce0e['split']('-');var _0x4fac5e=_[_0x9e89('0x1f')](_0x473917[0x0],0x5,'0');var _0x46f94e=_0x473917[_0x9e89('0x20')]===0x2?_[_0x9e89('0x1f')](_0x473917[0x1],0x5,'0'):_0x4fac5e;_0x27fadd=timeCompare(_0x4d71e1,_0x4fac5e,_0x46f94e);}let _0x5f44e0=!![];if(_0x1e31ab!=='*'){var _0xdf3f7d=_0x1e31ab['split']('-');var _0x2c375c=_0xdf3f7d[0x0];var _0x5afe30=_0xdf3f7d['length']===0x2?_0xdf3f7d[0x1]:_0x2c375c;_0x5f44e0=dowCompare(_0x4d71e1,_0x2c375c,_0x5afe30);}let _0x6478a=!![];if(_0x4c904a!=='*'){var _0x738316=_0x4c904a[_0x9e89('0x5')]('-');var _0x2dbea3=parseDom(_0x738316[0x0]);var _0x370713=_0x738316[_0x9e89('0x20')]===0x2?parseDom(_0x738316[0x1]):_0x2dbea3;_0x6478a=domCompare(_0x4d71e1,_0x2dbea3,_0x370713);}let _0x22d78e=!![];if(_0x2e6820!=='*'){var _0x262fac=_0x2e6820[_0x9e89('0x5')]('-');var _0x3e5167=_0x262fac[0x0];var _0xdd7f03=_0x262fac[_0x9e89('0x20')]===0x2?_0x262fac[0x1]:_0x262fac[0x0];_0x22d78e=monthCompare(_0x4d71e1,_0x3e5167,_0xdd7f03);}return _0x27fadd&&_0x5f44e0&&_0x6478a&&_0x22d78e;}}module[_0x9e89('0xa')][_0x9e89('0x21')]=iftime; \ No newline at end of file +var _0xbf6c=['format','ddd','includes','dowCompare','date','daysInMonth','max','min','domCompare','monthCompare','test','isMoment','split','padStart','length','iftime','lodash','moment-timezone','map','source','join','Interval\x20string\x20not\x20valid','Date\x20not\x20valid','isValid','locale','weekdaysShort','toLowerCase','indexOf','slice','concat','exports','monthsShort','clone','hours','minutes','isBefore','startOf','day','endOf','timeCompare'];(function(_0x38966c,_0x4391fb){var _0x11dcb5=function(_0x1592b2){while(--_0x1592b2){_0x38966c['push'](_0x38966c['shift']());}};_0x11dcb5(++_0x4391fb);}(_0xbf6c,0x1f0));var _0xcbf6=function(_0x4508b0,_0x38f015){_0x4508b0=_0x4508b0-0x0;var _0x5db952=_0xbf6c[_0x4508b0];return _0x5db952;};var _=require(_0xcbf6('0x0'));var moment=require(_0xcbf6('0x1'));var timeRx=/(\*|(\d{1,2}:\d{1,2})(-(\d{1,2}:\d{1,2}))?)/;var dowRx=/(\*|((sun|mon|tue|wed|thu|fri|sat)(-(sun|mon|tue|wed|thu|fri|sat))?))/;var domRx=/(\*|(\d{1,2})(-(\d{1,2}))?)/;var moyRx=/(\*|(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)(-(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec))?)/;var globalRx=[timeRx,dowRx,domRx,moyRx][_0xcbf6('0x2')](function(_0x2f9f7c){return _0x2f9f7c[_0xcbf6('0x3')];})[_0xcbf6('0x4')](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING=_0xcbf6('0x5');var EINVALID_DATE=_0xcbf6('0x6');function throwIfDateNotValid(_0x45d053){if(!_0x45d053[_0xcbf6('0x7')]()){throw new Error(EINVALID_DATE);}}function extractTime(_0x15b866){var _0x20cd4d=_0x15b866['split'](':')[_0xcbf6('0x2')](function(_0xffa90c){return parseInt(_0xffa90c,0xa);});var _0x3848c5=_0x20cd4d[0x0];var _0x49994a=_0x20cd4d[0x1];if(_0x3848c5<0x0||_0x3848c5>0x17||_0x49994a<0x0||_0x49994a>0x3b){throw new Error(EINVALID_DATE);}return[_0x3848c5,_0x49994a];}function circularDoWInterval(_0xbda110,_0x224fe6){if(_0xbda110===_0x224fe6){return[_0xbda110];}else{var _0x30147e=moment[_0xcbf6('0x8')]();moment[_0xcbf6('0x8')]('en');var _0x4d366b=moment[_0xcbf6('0x9')]()['map'](function(_0x1da0ee){return _0x1da0ee[_0xcbf6('0xa')]();});moment[_0xcbf6('0x8')](_0x30147e);var _0x26648e=_0x4d366b[_0xcbf6('0xb')](_0xbda110);var _0x2f17e5=_0x4d366b['indexOf'](_0x224fe6);if(_0x2f17e5>_0x26648e){return _0x4d366b[_0xcbf6('0xc')](_0x26648e,_0x2f17e5+0x1);}else{var _0x1f9711=_0x4d366b[_0xcbf6('0xc')](0x0,_0x2f17e5+0x1);var _0x268389=_0x4d366b[_0xcbf6('0xc')](_0x26648e);return _0x268389[_0xcbf6('0xd')](_0x1f9711);}}}module[_0xcbf6('0xe')]['circularDoWInterval']=circularDoWInterval;function circularMonthInterval(_0x3b2479,_0x142a74){if(_0x3b2479===_0x142a74){return[_0x3b2479];}else{var _0x537701=moment[_0xcbf6('0x8')]();moment[_0xcbf6('0x8')]('en');var _0x90b02=moment[_0xcbf6('0xf')]()[_0xcbf6('0x2')](function(_0x40546e){return _0x40546e[_0xcbf6('0xa')]();});moment[_0xcbf6('0x8')](_0x537701);var _0x1c4c2a=_0x90b02[_0xcbf6('0xb')](_0x3b2479);var _0x25526c=_0x90b02['indexOf'](_0x142a74);if(_0x25526c>_0x1c4c2a){return _0x90b02[_0xcbf6('0xc')](_0x1c4c2a,_0x25526c+0x1);}else{var _0x309419=_0x90b02['slice'](0x0,_0x25526c+0x1);var _0x19b803=_0x90b02['slice'](_0x1c4c2a);return _0x19b803['concat'](_0x309419);}}}module['exports']['circularMonthInterval']=circularMonthInterval;function parseDom(_0xca4bfa){var _0x134a89=parseInt(_0xca4bfa,0xa);if(_0x134a89<0x1||_0x134a89>0x1f){throw new Error(EINVALID_DATE);}return _0x134a89;}function timeCompare(_0x35b6ee,_0x18e380,_0x4606ed){var _0x1ef5d3=_0x35b6ee[_0xcbf6('0x10')]();var _0x2fdff9=extractTime(_0x18e380);var _0x1feaab=_0x2fdff9[0x0];var _0x3219dc=_0x2fdff9[0x1];var _0x47db8c=_0x35b6ee[_0xcbf6('0x10')]()[_0xcbf6('0x11')](_0x1feaab)[_0xcbf6('0x12')](_0x3219dc);throwIfDateNotValid(_0x47db8c);var _0x5cb31a=extractTime(_0x4606ed);var _0x5a5620=_0x5cb31a[0x0];var _0x3d758d=_0x5cb31a[0x1];var _0x21b2ba=_0x35b6ee[_0xcbf6('0x10')]()[_0xcbf6('0x11')](_0x5a5620)[_0xcbf6('0x12')](_0x3d758d);throwIfDateNotValid(_0x21b2ba);if(_0x21b2ba[_0xcbf6('0x13')](_0x47db8c)){var _0xb5dfc5=_0x1ef5d3[_0xcbf6('0x10')]()[_0xcbf6('0x14')](_0xcbf6('0x15'));var _0x398304=_0x1ef5d3[_0xcbf6('0x10')]()[_0xcbf6('0x16')](_0xcbf6('0x15'));return _0x1ef5d3['isBetween'](_0x47db8c,_0x398304,undefined,'[]')||_0x1ef5d3['isBetween'](_0xb5dfc5,_0x21b2ba,undefined,'[]');}else{return _0x1ef5d3['isBetween'](_0x47db8c,_0x21b2ba,undefined,'[]');}}module[_0xcbf6('0xe')][_0xcbf6('0x17')]=timeCompare;function dowCompare(_0x54b0dd,_0x270f9b,_0x5eee4f){var _0x3ad131=_0x54b0dd['locale']('en')[_0xcbf6('0x18')](_0xcbf6('0x19'))[_0xcbf6('0xa')]();return circularDoWInterval(_0x270f9b,_0x5eee4f)[_0xcbf6('0x1a')](_0x3ad131);}module[_0xcbf6('0xe')][_0xcbf6('0x1b')]=dowCompare;function domCompare(_0x2595ed,_0x453bb7,_0x221ef0){var _0x366050=_0x2595ed[_0xcbf6('0x1c')]();if(_0x453bb7===_0x221ef0){return _0x366050===_0x453bb7;}else{var _0x9fc18b=_0x2595ed[_0xcbf6('0x1d')]();var _0x38d5a8=_0x453bb7<_0x221ef0;let _0x409790=![];var _0x272c4a=0x0;var _0x5ca729=0x0;if(_0x38d5a8){_0x272c4a=Math[_0xcbf6('0x1e')](0x1,_0x453bb7);_0x5ca729=Math[_0xcbf6('0x1f')](_0x221ef0,_0x9fc18b);_0x409790=_0x366050>=_0x272c4a&&_0x366050<=_0x5ca729;}else{_0x272c4a=Math['min'](_0x453bb7,_0x9fc18b);_0x5ca729=Math[_0xcbf6('0x1e')](0x1,_0x221ef0);_0x409790=_0x366050>=_0x272c4a||_0x366050<=_0x5ca729;}return _0x409790;}}module[_0xcbf6('0xe')][_0xcbf6('0x20')]=domCompare;function monthCompare(_0x5db65e,_0x5b0dd4,_0xd9378){var _0x7c6b22=_0x5db65e[_0xcbf6('0x8')]('en')[_0xcbf6('0x18')]('MMM')[_0xcbf6('0xa')]();return circularMonthInterval(_0x5b0dd4,_0xd9378)[_0xcbf6('0x1a')](_0x7c6b22);}module[_0xcbf6('0xe')][_0xcbf6('0x21')]=monthCompare;function iftime(_0x51b113,_0x1fa31e=moment['tz']['guess'](),_0x874fd6=moment()){if(!validateRx[_0xcbf6('0x22')](_0x51b113)){throw new Error(EINVALID_STRING);}else{var _0x472673=(moment[_0xcbf6('0x23')](_0x874fd6)?_0x874fd6[_0xcbf6('0x10')]():moment(_0x874fd6))['tz'](_0x1fa31e)[_0xcbf6('0x8')]('en');throwIfDateNotValid(_0x472673);var _0x5b6a7e=_0x51b113['split'](',');var _0x58ae38=_0x5b6a7e[0x0];var _0x365cce=_0x5b6a7e[0x1];var _0x2c4150=_0x5b6a7e[0x2];var _0x17c379=_0x5b6a7e[0x3];let _0x1761fd=!![];if(_0x58ae38!=='*'){var _0x53b450=_0x58ae38[_0xcbf6('0x24')]('-');var _0x29913f=_[_0xcbf6('0x25')](_0x53b450[0x0],0x5,'0');var _0x53e763=_0x53b450[_0xcbf6('0x26')]===0x2?_[_0xcbf6('0x25')](_0x53b450[0x1],0x5,'0'):_0x29913f;_0x1761fd=timeCompare(_0x472673,_0x29913f,_0x53e763);}let _0x146cf1=!![];if(_0x365cce!=='*'){var _0x31b951=_0x365cce[_0xcbf6('0x24')]('-');var _0x27b3f3=_0x31b951[0x0];var _0x30aff9=_0x31b951[_0xcbf6('0x26')]===0x2?_0x31b951[0x1]:_0x27b3f3;_0x146cf1=dowCompare(_0x472673,_0x27b3f3,_0x30aff9);}let _0x5dabbb=!![];if(_0x2c4150!=='*'){var _0x5480e3=_0x2c4150[_0xcbf6('0x24')]('-');var _0x4d0400=parseDom(_0x5480e3[0x0]);var _0x15b548=_0x5480e3[_0xcbf6('0x26')]===0x2?parseDom(_0x5480e3[0x1]):_0x4d0400;_0x5dabbb=domCompare(_0x472673,_0x4d0400,_0x15b548);}let _0x59e08e=!![];if(_0x17c379!=='*'){var _0x33c21a=_0x17c379[_0xcbf6('0x24')]('-');var _0x24ea8a=_0x33c21a[0x0];var _0x3874cf=_0x33c21a[_0xcbf6('0x26')]===0x2?_0x33c21a[0x1]:_0x33c21a[0x0];_0x59e08e=monthCompare(_0x472673,_0x24ea8a,_0x3874cf);}return _0x1761fd&&_0x146cf1&&_0x5dabbb&&_0x59e08e;}}module['exports'][_0xcbf6('0x27')]=iftime; \ No newline at end of file diff --git a/server/utils/loggers.js b/server/utils/loggers.js index 5ed61c8..2211f80 100644 --- a/server/utils/loggers.js +++ b/server/utils/loggers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x87a7=['join','format','%s-%s.log','message','replace','}}}','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','{{{','meta','keys','stringify','Console','Logger','transports','File','%s-%s','error','fileLogger','moment','../config/environment','debugLevel','toLowerCase','info','redBG\x20white','red','bold\x20yellow','white','bold\x20green','gray','bold\x20magenta','bold\x20blue','bold\x20cyan','addColors','/var/log/xcally'];(function(_0x24541f,_0x3c88bd){var _0x459bcd=function(_0x934830){while(--_0x934830){_0x24541f['push'](_0x24541f['shift']());}};_0x459bcd(++_0x3c88bd);}(_0x87a7,0x1c4));var _0x787a=function(_0x2a01f6,_0xf6d2fb){_0x2a01f6=_0x2a01f6-0x0;var _0x1c28a5=_0x87a7[_0x2a01f6];return _0x1c28a5;};'use strict';var path=require('path');var util=require('util');var moment=require(_0x787a('0x0'));var winston=require('winston');var config=require(_0x787a('0x1'));var debugLevel=config[_0x787a('0x2')]?config[_0x787a('0x2')][_0x787a('0x3')]():_0x787a('0x4');var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':_0x787a('0x5'),'error':_0x787a('0x6'),'warn':_0x787a('0x7'),'info':_0x787a('0x8'),'print':'bold\x20white','success':_0x787a('0x9'),'http':_0x787a('0xa'),'verbose':_0x787a('0xb'),'debug':_0x787a('0xc'),'silly':_0x787a('0xd')};winston[_0x787a('0xe')](XC_LOG_COLORS);function getLogFileName(_0x105f9d,_0x1ce208,_0x5dbb24){var _0x16bc2f=_0x105f9d||_0x787a('0xf');return path[_0x787a('0x10')](_0x16bc2f,util[_0x787a('0x11')](_0x787a('0x12'),_0x1ce208,_0x5dbb24));}function formatter(_0x431cd7,_0x3c6103){_0x3c6103[_0x787a('0x13')]=_0x3c6103[_0x787a('0x13')]['replace'](/@@{/g,'{{{')[_0x787a('0x14')](/}@@/g,_0x787a('0x15'))[_0x787a('0x14')](/@{/g,'{{')[_0x787a('0x14')](/}@/g,'}}');return util[_0x787a('0x11')]('[%s]\x20[%s]\x20%s\x20-\x20%s',moment()[_0x787a('0x11')](_0x787a('0x16')),_0x3c6103[_0x787a('0x17')][_0x787a('0x18')](),_0x431cd7,_0x3c6103[_0x787a('0x13')]);}function fileFormat(_0x16b718,_0x2e8de3){_0x2e8de3[_0x787a('0x13')]=_0x2e8de3[_0x787a('0x13')]['replace'](/@@{/g,_0x787a('0x19'))[_0x787a('0x14')](/}@@/g,_0x787a('0x15'))[_0x787a('0x14')](/@{/g,'{{')['replace'](/}@/g,'}}');var _0x1dc3ab=_0x2e8de3[_0x787a('0x1a')]&&Object[_0x787a('0x1b')](_0x2e8de3[_0x787a('0x1a')])['length']?'\x0a\x09'+JSON[_0x787a('0x1c')](_0x2e8de3[_0x787a('0x1a')]):'';return util[_0x787a('0x11')]('[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s',moment()[_0x787a('0x11')](_0x787a('0x16')),_0x2e8de3['level'][_0x787a('0x18')](),_0x16b718,_0x2e8de3[_0x787a('0x13')],_0x1dc3ab);}function consoleLogger(){var _0x7ca81a=new winston['Logger']({'levels':XC_LOG_LEVELS,'transports':[new winston['transports'][(_0x787a('0x1d'))]({'level':'warn','json':![],'formatter':function(_0x1e5f5c){return formatter('',_0x1e5f5c);}})]});return _0x7ca81a;}function fileLogger(_0x36b834,_0xc933a1){var _0x39deee=new winston[(_0x787a('0x1e'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x787a('0x1f'))][(_0x787a('0x20'))]({'name':util[_0x787a('0x11')](_0x787a('0x21'),_0x36b834,'error'),'filename':getLogFileName(_0xc933a1,_0x36b834,_0x787a('0x22')),'level':_0x787a('0x22'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x524076){return fileFormat(_0x36b834,_0x524076);}}),new winston[(_0x787a('0x1f'))]['File']({'name':util[_0x787a('0x11')](_0x787a('0x21'),_0x36b834,debugLevel),'filename':getLogFileName(_0xc933a1,_0x36b834,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x5e823e){return fileFormat(_0x36b834,_0x5e823e);}}),new winston[(_0x787a('0x1f'))][(_0x787a('0x1d'))]({'level':'warn','json':![],'formatter':function(_0x3678bc){return fileFormat(_0x36b834,_0x3678bc);}})]});return _0x39deee;}exports['consoleLogger']=consoleLogger;exports[_0x787a('0x23')]=fileLogger; \ No newline at end of file +var _0x932e=['YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','meta','keys','stringify','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','Logger','transports','File','%s-%s','error','Console','consoleLogger','fileLogger','moment','../config/environment','debugLevel','info','redBG\x20white','red','bold\x20yellow','white','bold\x20green','gray','bold\x20magenta','bold\x20blue','bold\x20cyan','addColors','/var/log/xcally','join','%s-%s.log','message','replace','{{{','}}}','format','[%s]\x20[%s]\x20%s\x20-\x20%s'];(function(_0x16141c,_0x336553){var _0xa96b0=function(_0x495563){while(--_0x495563){_0x16141c['push'](_0x16141c['shift']());}};_0xa96b0(++_0x336553);}(_0x932e,0x18b));var _0xe932=function(_0x37f4a9,_0x5f109a){_0x37f4a9=_0x37f4a9-0x0;var _0x41dfec=_0x932e[_0x37f4a9];return _0x41dfec;};'use strict';var path=require('path');var util=require('util');var moment=require(_0xe932('0x0'));var winston=require('winston');var config=require(_0xe932('0x1'));var debugLevel=config[_0xe932('0x2')]?config[_0xe932('0x2')]['toLowerCase']():_0xe932('0x3');var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':_0xe932('0x4'),'error':_0xe932('0x5'),'warn':_0xe932('0x6'),'info':_0xe932('0x7'),'print':'bold\x20white','success':_0xe932('0x8'),'http':_0xe932('0x9'),'verbose':_0xe932('0xa'),'debug':_0xe932('0xb'),'silly':_0xe932('0xc')};winston[_0xe932('0xd')](XC_LOG_COLORS);function getLogFileName(_0x3c63c4,_0x7c1a8c,_0x2dab87){var _0x547779=_0x3c63c4||_0xe932('0xe');return path[_0xe932('0xf')](_0x547779,util['format'](_0xe932('0x10'),_0x7c1a8c,_0x2dab87));}function formatter(_0x41d122,_0x15cf3b){_0x15cf3b['message']=_0x15cf3b[_0xe932('0x11')][_0xe932('0x12')](/@@{/g,_0xe932('0x13'))[_0xe932('0x12')](/}@@/g,_0xe932('0x14'))[_0xe932('0x12')](/@{/g,'{{')[_0xe932('0x12')](/}@/g,'}}');return util[_0xe932('0x15')](_0xe932('0x16'),moment()['format'](_0xe932('0x17')),_0x15cf3b[_0xe932('0x18')][_0xe932('0x19')](),_0x41d122,_0x15cf3b[_0xe932('0x11')]);}function fileFormat(_0x4efc55,_0x5b675f){_0x5b675f[_0xe932('0x11')]=_0x5b675f['message'][_0xe932('0x12')](/@@{/g,_0xe932('0x13'))[_0xe932('0x12')](/}@@/g,_0xe932('0x14'))[_0xe932('0x12')](/@{/g,'{{')[_0xe932('0x12')](/}@/g,'}}');var _0x51d949=_0x5b675f[_0xe932('0x1a')]&&Object[_0xe932('0x1b')](_0x5b675f[_0xe932('0x1a')])['length']?'\x0a\x09'+JSON[_0xe932('0x1c')](_0x5b675f[_0xe932('0x1a')]):'';return util[_0xe932('0x15')](_0xe932('0x1d'),moment()['format'](_0xe932('0x17')),_0x5b675f[_0xe932('0x18')]['toUpperCase'](),_0x4efc55,_0x5b675f['message'],_0x51d949);}function consoleLogger(){var _0x179201=new winston[(_0xe932('0x1e'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xe932('0x1f'))]['Console']({'level':'warn','json':![],'formatter':function(_0x4c0ff7){return formatter('',_0x4c0ff7);}})]});return _0x179201;}function fileLogger(_0x1ac8bb,_0x38392e){var _0x5969cc=new winston[(_0xe932('0x1e'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xe932('0x1f'))][(_0xe932('0x20'))]({'name':util[_0xe932('0x15')](_0xe932('0x21'),_0x1ac8bb,_0xe932('0x22')),'filename':getLogFileName(_0x38392e,_0x1ac8bb,_0xe932('0x22')),'level':_0xe932('0x22'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x20a9fc){return fileFormat(_0x1ac8bb,_0x20a9fc);}}),new winston['transports'][(_0xe932('0x20'))]({'name':util['format'](_0xe932('0x21'),_0x1ac8bb,debugLevel),'filename':getLogFileName(_0x38392e,_0x1ac8bb,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x3492dd){return fileFormat(_0x1ac8bb,_0x3492dd);}}),new winston[(_0xe932('0x1f'))][(_0xe932('0x23'))]({'level':'warn','json':![],'formatter':function(_0x3f1cce){return fileFormat(_0x1ac8bb,_0x3f1cce);}})]});return _0x5969cc;}exports[_0xe932('0x24')]=consoleLogger;exports[_0xe932('0x25')]=fileLogger; \ No newline at end of file diff --git a/server/utils/mask-sensitive-data.js b/server/utils/mask-sensitive-data.js index 67ae8b0..a6a05ef 100644 --- a/server/utils/mask-sensitive-data.js +++ b/server/utils/mask-sensitive-data.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdb28=['registry','oldPassword','isPlainObject','length','isString','replace','@@{','}@@','exports','maskSensitiveData','lodash','username','password','newPassword','firstName','lastName','street','phone','mobile','email','clientId','code','accessKey','tenantId','token','channelSecret','accessToken','accessTokenSecret','consumerKey','consumerSecret','membername','calleridnum','exten','clientEmail','privateKey','accesskeyid','secretaccesskey','key','accountSid','localstationid','dsn','secret'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xdb28,0x106));var _0x8db2=function(_0x174714,_0x1c5cb7){_0x174714=_0x174714-0x0;var _0x54e189=_0xdb28[_0x174714];return _0x54e189;};var _=require(_0x8db2('0x0'));var sensitiveFields=[_0x8db2('0x1'),_0x8db2('0x2'),_0x8db2('0x3'),'apiKey',_0x8db2('0x4'),_0x8db2('0x5'),_0x8db2('0x6'),_0x8db2('0x7'),_0x8db2('0x8'),'fax',_0x8db2('0x9'),_0x8db2('0xa'),'clientSecret','securityToken',_0x8db2('0xb'),_0x8db2('0xc'),_0x8db2('0xd'),_0x8db2('0xe'),_0x8db2('0xf'),_0x8db2('0x10'),_0x8db2('0x11'),'authToken',_0x8db2('0x12'),_0x8db2('0x13'),_0x8db2('0x14'),'calleridname',_0x8db2('0x15'),_0x8db2('0x16'),'vidaooApiKey',_0x8db2('0x17'),_0x8db2('0x18'),_0x8db2('0x19'),_0x8db2('0x1a'),_0x8db2('0x1b'),'user','pass',_0x8db2('0x1c'),_0x8db2('0x1d'),_0x8db2('0x1e'),_0x8db2('0x1f'),_0x8db2('0x20'),_0x8db2('0x21')];function maskSensitiveData(_0x2f177a){const _0x3c96a7=/(?!^)[\s\S](?!$)/g;if(_[_0x8db2('0x22')](_0x2f177a)){for(const _0x16c8c2 in _0x2f177a){if(_['isArray'](_0x2f177a[_0x16c8c2])){for(let _0x13b0f5=0x0;_0x13b0f5<_0x2f177a[_0x16c8c2][_0x8db2('0x23')];_0x13b0f5++){maskSensitiveData(_0x2f177a[_0x16c8c2][_0x13b0f5]);}}else if(_['isPlainObject'](_0x2f177a[_0x16c8c2])){maskSensitiveData(_0x2f177a[_0x16c8c2]);}else if(_[_0x8db2('0x24')](_0x2f177a[_0x16c8c2])){_0x2f177a[_0x16c8c2]=_0x2f177a[_0x16c8c2][_0x8db2('0x25')](/{{{/g,_0x8db2('0x26'))[_0x8db2('0x25')](/}}}/g,_0x8db2('0x27'))[_0x8db2('0x25')](/{{/g,'@{')['replace'](/}}/g,'}@');if(_['includes'](sensitiveFields,_0x16c8c2)){_0x2f177a[_0x16c8c2]=_0x2f177a[_0x16c8c2][_0x8db2('0x25')](_0x3c96a7,'*');}}}}}module[_0x8db2('0x28')][_0x8db2('0x29')]=maskSensitiveData; \ No newline at end of file +var _0x2ef3=['email','securityToken','code','accessKey','tenantId','token','channelSecret','accessToken','accessTokenSecret','authToken','consumerKey','calleridname','calleridnum','exten','vidaooApiKey','privateKey','secretaccesskey','user','pass','dsn','registry','oldPassword','length','isPlainObject','@@{','replace','}@@','includes','exports','maskSensitiveData','lodash','username','password','newPassword','apiKey','firstName','street','phone','fax'];(function(_0x37a0ce,_0x28dc04){var _0x569f4e=function(_0x1671c0){while(--_0x1671c0){_0x37a0ce['push'](_0x37a0ce['shift']());}};_0x569f4e(++_0x28dc04);}(_0x2ef3,0xba));var _0x32ef=function(_0x4670c6,_0x29c0e8){_0x4670c6=_0x4670c6-0x0;var _0x54615e=_0x2ef3[_0x4670c6];return _0x54615e;};var _=require(_0x32ef('0x0'));var sensitiveFields=[_0x32ef('0x1'),_0x32ef('0x2'),_0x32ef('0x3'),_0x32ef('0x4'),_0x32ef('0x5'),'lastName',_0x32ef('0x6'),_0x32ef('0x7'),'mobile',_0x32ef('0x8'),_0x32ef('0x9'),'clientId','clientSecret',_0x32ef('0xa'),_0x32ef('0xb'),_0x32ef('0xc'),_0x32ef('0xd'),_0x32ef('0xe'),_0x32ef('0xf'),_0x32ef('0x10'),_0x32ef('0x11'),_0x32ef('0x12'),_0x32ef('0x13'),'consumerSecret','membername',_0x32ef('0x14'),_0x32ef('0x15'),_0x32ef('0x16'),_0x32ef('0x17'),'clientEmail',_0x32ef('0x18'),'accesskeyid',_0x32ef('0x19'),'key',_0x32ef('0x1a'),_0x32ef('0x1b'),'accountSid','localstationid',_0x32ef('0x1c'),'secret',_0x32ef('0x1d'),_0x32ef('0x1e')];function maskSensitiveData(_0x93d492){const _0x54c7f5=/(?!^)[\s\S](?!$)/g;if(_['isPlainObject'](_0x93d492)){for(const _0x55bf0b in _0x93d492){if(_['isArray'](_0x93d492[_0x55bf0b])){for(let _0x13db1a=0x0;_0x13db1a<_0x93d492[_0x55bf0b][_0x32ef('0x1f')];_0x13db1a++){maskSensitiveData(_0x93d492[_0x55bf0b][_0x13db1a]);}}else if(_[_0x32ef('0x20')](_0x93d492[_0x55bf0b])){maskSensitiveData(_0x93d492[_0x55bf0b]);}else if(_['isString'](_0x93d492[_0x55bf0b])){_0x93d492[_0x55bf0b]=_0x93d492[_0x55bf0b]['replace'](/{{{/g,_0x32ef('0x21'))[_0x32ef('0x22')](/}}}/g,_0x32ef('0x23'))['replace'](/{{/g,'@{')[_0x32ef('0x22')](/}}/g,'}@');if(_[_0x32ef('0x24')](sensitiveFields,_0x55bf0b)){_0x93d492[_0x55bf0b]=_0x93d492[_0x55bf0b]['replace'](_0x54c7f5,'*');}}}}}module[_0x32ef('0x25')][_0x32ef('0x26')]=maskSensitiveData; \ No newline at end of file diff --git a/server/utils/misc.js b/server/utils/misc.js index 80cf771..53f2136 100644 --- a/server/utils/misc.js +++ b/server/utils/misc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5fab=['exports','replace','\x5c$&'];(function(_0x1be790,_0x112549){var _0x7668c8=function(_0x47a470){while(--_0x47a470){_0x1be790['push'](_0x1be790['shift']());}};_0x7668c8(++_0x112549);}(_0x5fab,0x177));var _0xb5fa=function(_0x4e6eac,_0x3f4365){_0x4e6eac=_0x4e6eac-0x0;var _0x79f963=_0x5fab[_0x4e6eac];return _0x79f963;};module[_0xb5fa('0x0')]={'escapeRegExp'(_0x1c67fb,_0x4c67f9=/[-[\]{}()*+?.,\\\/^$|#\s]/g){return _0x1c67fb[_0xb5fa('0x1')](_0x4c67f9,_0xb5fa('0x2'));}}; \ No newline at end of file +var _0xf494=['exports','\x5c$&'];(function(_0x51858b,_0x421f5a){var _0x20982c=function(_0x304eac){while(--_0x304eac){_0x51858b['push'](_0x51858b['shift']());}};_0x20982c(++_0x421f5a);}(_0xf494,0x1c6));var _0x4f49=function(_0x3e26f,_0x4b4bad){_0x3e26f=_0x3e26f-0x0;var _0x3d0810=_0xf494[_0x3e26f];return _0x3d0810;};module[_0x4f49('0x0')]={'escapeRegExp'(_0x32e808,_0x3063f3=/[-[\]{}()*+?.,\\\/^$|#\s]/g){return _0x32e808['replace'](_0x3063f3,_0x4f49('0x1'));}}; \ No newline at end of file diff --git a/server/utils/safe-template.js b/server/utils/safe-template.js index ae3b52c..e4fd1ca 100644 --- a/server/utils/safe-template.js +++ b/server/utils/safe-template.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4213=['{\x20{\x20','\x20}\x20}','string','isArray','isPlainObject','keys','reduce','exports','safeTemplate','lodash'];(function(_0x4b4344,_0x5712b9){var _0xa45d77=function(_0x2da403){while(--_0x2da403){_0x4b4344['push'](_0x4b4344['shift']());}};_0xa45d77(++_0x5712b9);}(_0x4213,0x77));var _0x3421=function(_0x2221be,_0x2d5377){_0x2221be=_0x2221be-0x0;var _0x2a8fd9=_0x4213[_0x2221be];return _0x2a8fd9;};var _=require(_0x3421('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x445ef6){return _0x445ef6==='{{'?_0x3421('0x1'):_0x3421('0x2');}function safeTemplate(_0x2613b6){var _0x153f3a=_0x2613b6;if(typeof _0x2613b6===_0x3421('0x3')){_0x153f3a=_0x2613b6['replace'](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0x3421('0x4')](_0x2613b6)){_0x153f3a=_0x2613b6['map'](function(_0x459c5e){return safeTemplate(_0x459c5e);});}else if(_[_0x3421('0x5')](_0x2613b6)){_0x153f3a=Object[_0x3421('0x6')](_0x2613b6)[_0x3421('0x7')](function(_0x5469d8,_0x50e464){_0x5469d8[_0x50e464]=safeTemplate(_0x2613b6[_0x50e464]);return _0x5469d8;},{});}return _0x153f3a;}module[_0x3421('0x8')][_0x3421('0x9')]=safeTemplate; \ No newline at end of file +var _0x4fc2=['reduce','exports','safeTemplate','lodash','{\x20{\x20','\x20}\x20}','string','replace','map','keys'];(function(_0x1da978,_0x56979c){var _0x360cb4=function(_0x52c842){while(--_0x52c842){_0x1da978['push'](_0x1da978['shift']());}};_0x360cb4(++_0x56979c);}(_0x4fc2,0x111));var _0x24fc=function(_0x417538,_0x5a1ad6){_0x417538=_0x417538-0x0;var _0x3b15b1=_0x4fc2[_0x417538];return _0x3b15b1;};var _=require(_0x24fc('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x2b05a5){return _0x2b05a5==='{{'?_0x24fc('0x1'):_0x24fc('0x2');}function safeTemplate(_0x5aaa74){var _0x365c56=_0x5aaa74;if(typeof _0x5aaa74===_0x24fc('0x3')){_0x365c56=_0x5aaa74[_0x24fc('0x4')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array['isArray'](_0x5aaa74)){_0x365c56=_0x5aaa74[_0x24fc('0x5')](function(_0x3772eb){return safeTemplate(_0x3772eb);});}else if(_['isPlainObject'](_0x5aaa74)){_0x365c56=Object[_0x24fc('0x6')](_0x5aaa74)[_0x24fc('0x7')](function(_0x4889f4,_0x115851){_0x4889f4[_0x115851]=safeTemplate(_0x5aaa74[_0x115851]);return _0x4889f4;},{});}return _0x365c56;}module[_0x24fc('0x8')][_0x24fc('0x9')]=safeTemplate; \ No newline at end of file diff --git a/server/utils/update-app-config.js b/server/utils/update-app-config.js index edd60d1..3de86e0 100644 --- a/server/utils/update-app-config.js +++ b/server/utils/update-app-config.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5071=['pathExists','then','readJSON','updated','info','writeJSON','exports','fs-extra','path','../config/environment','root','resolve','server/app.json','apps','findIndex','name','motion2','env','NODE_PATH','string'];(function(_0xf67f45,_0x36e087){var _0xd9ab5=function(_0x594070){while(--_0x594070){_0xf67f45['push'](_0xf67f45['shift']());}};_0xd9ab5(++_0x36e087);}(_0x5071,0x16f));var _0x1507=function(_0x4e87ba,_0x2d95f9){_0x4e87ba=_0x4e87ba-0x0;var _0x212b08=_0x5071[_0x4e87ba];return _0x212b08;};var fs=require(_0x1507('0x0'));var path=require(_0x1507('0x1'));var config=require(_0x1507('0x2'));var root=config[_0x1507('0x3')];var APP_JSON_PATH=path[_0x1507('0x4')](root,_0x1507('0x5'));var NODEPATH=path[_0x1507('0x4')](root,'legacy-libs');function setLegacyLibsNodeEnvPath(_0x754a10){let _0x8816f9=![];if(Array['isArray'](_0x754a10[_0x1507('0x6')])){var _0xace4c7=_0x754a10[_0x1507('0x6')][_0x1507('0x7')](function(_0x4aa16b){return _0x4aa16b[_0x1507('0x8')]===_0x1507('0x9');});if(_0xace4c7>-0x1){var _0x46e1c5=_0x754a10[_0x1507('0x6')][_0xace4c7];if(typeof _0x46e1c5[_0x1507('0xa')][_0x1507('0xb')]!==_0x1507('0xc')){_0x46e1c5[_0x1507('0xa')][_0x1507('0xb')]=NODEPATH;_0x8816f9=!![];}}return{'appConfig':_0x754a10,'updated':_0x8816f9};}}function updateAppConfig(_0x57be5b){return fs[_0x1507('0xd')](APP_JSON_PATH)[_0x1507('0xe')](function(_0x36b408){if(_0x36b408){return fs[_0x1507('0xf')](APP_JSON_PATH)['then'](function(_0x2cf15f){var _0x3442d1=setLegacyLibsNodeEnvPath(_0x2cf15f);if(_0x3442d1[_0x1507('0x10')]){_0x57be5b[_0x1507('0x11')]('Updating\x20app.json');return fs[_0x1507('0x12')](APP_JSON_PATH,_0x2cf15f,{'spaces':0x2});}else{return Promise[_0x1507('0x4')]();}});}else{return Promise[_0x1507('0x4')]();}});}module[_0x1507('0x13')]=updateAppConfig; \ No newline at end of file +var _0xbccd=['info','Updating\x20app.json','writeJSON','resolve','exports','fs-extra','path','../config/environment','root','legacy-libs','isArray','apps','findIndex','name','motion2','env','NODE_PATH','pathExists','then'];(function(_0x42fd48,_0x22c426){var _0x1fba26=function(_0x22ad6b){while(--_0x22ad6b){_0x42fd48['push'](_0x42fd48['shift']());}};_0x1fba26(++_0x22c426);}(_0xbccd,0x64));var _0xdbcc=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0xbccd[_0x1d9aa0];return _0x226868;};var fs=require(_0xdbcc('0x0'));var path=require(_0xdbcc('0x1'));var config=require(_0xdbcc('0x2'));var root=config[_0xdbcc('0x3')];var APP_JSON_PATH=path['resolve'](root,'server/app.json');var NODEPATH=path['resolve'](root,_0xdbcc('0x4'));function setLegacyLibsNodeEnvPath(_0x5cefab){let _0x25eaa8=![];if(Array[_0xdbcc('0x5')](_0x5cefab[_0xdbcc('0x6')])){var _0x36208e=_0x5cefab['apps'][_0xdbcc('0x7')](function(_0x3946a0){return _0x3946a0[_0xdbcc('0x8')]===_0xdbcc('0x9');});if(_0x36208e>-0x1){var _0x32caa4=_0x5cefab['apps'][_0x36208e];if(typeof _0x32caa4[_0xdbcc('0xa')][_0xdbcc('0xb')]!=='string'){_0x32caa4[_0xdbcc('0xa')][_0xdbcc('0xb')]=NODEPATH;_0x25eaa8=!![];}}return{'appConfig':_0x5cefab,'updated':_0x25eaa8};}}function updateAppConfig(_0x1aa983){return fs[_0xdbcc('0xc')](APP_JSON_PATH)[_0xdbcc('0xd')](function(_0x204dcc){if(_0x204dcc){return fs['readJSON'](APP_JSON_PATH)['then'](function(_0x217723){var _0x283e95=setLegacyLibsNodeEnvPath(_0x217723);if(_0x283e95['updated']){_0x1aa983[_0xdbcc('0xe')](_0xdbcc('0xf'));return fs[_0xdbcc('0x10')](APP_JSON_PATH,_0x217723,{'spaces':0x2});}else{return Promise['resolve']();}});}else{return Promise[_0xdbcc('0x11')]();}});}module[_0xdbcc('0x12')]=updateAppConfig; \ No newline at end of file